Add pose mode

This commit is contained in:
JannisX11 2021-11-23 12:51:09 +01:00
parent 3325691a61
commit 8beef0e1f0
9 changed files with 21 additions and 13 deletions

View File

@ -1426,7 +1426,7 @@ const BARS = {
animation_channel: 'rotation',
toolbar: Blockbench.isMobile ? 'element_rotation' : 'main_tools',
alt_tool: 'pivot_tool',
modes: ['edit', 'display', 'animate'],
modes: ['edit', 'display', 'animate', 'pose'],
keybind: new Keybind({key: 'r'})
})
new Tool('pivot_tool', {

View File

@ -226,7 +226,7 @@ function setupPanels() {
Interface.Panels.element = new Panel({
id: 'element',
icon: 'fas.fa-cube',
condition: !Blockbench.isMobile && {modes: ['edit']},
condition: !Blockbench.isMobile && {modes: ['edit', 'pose']},
selection_only: true,
toolbars: {
element_position: !Blockbench.isMobile && Toolbars.element_position,

View File

@ -208,6 +208,7 @@ new Property(ModelFormat, 'boolean', 'canvas_limit');
new Property(ModelFormat, 'boolean', 'rotation_limit');
new Property(ModelFormat, 'boolean', 'uv_rotation');
new Property(ModelFormat, 'boolean', 'animation_files');
new Property(ModelFormat, 'boolean', 'pose_mode');
new Property(ModelFormat, 'boolean', 'display_mode');
new Property(ModelFormat, 'boolean', 'animation_mode');
new Property(ModelFormat, 'boolean', 'texture_folder');

View File

@ -163,6 +163,7 @@ const format = new ModelFormat({
single_texture: true,
integer_size: true,
rotate_cubes: true,
pose_mode: true,
codec
})
format.new = function() {

View File

@ -118,7 +118,7 @@ BARS.defineActions(function() {
new Mode('edit', {
default_tool: 'move_tool',
category: 'navigate',
condition: () => Format,
condition: () => Format && !Format.pose_mode,
})
new Mode('paint', {
default_tool: 'brush_tool',
@ -148,6 +148,11 @@ BARS.defineActions(function() {
three_grid.visible = true;
},
})
new Mode('pose', {
default_tool: 'rotate_tool',
category: 'navigate',
condition: () => Format && Format.pose_mode,
})
new Mode('display', {
selectElements: false,
default_tool: 'move_tool',

View File

@ -1233,7 +1233,7 @@ Interface.definePanels(function() {
Interface.Panels.outliner = new Panel({
id: 'outliner',
icon: 'list_alt',
condition: {modes: ['edit', 'paint', 'animate']},
condition: {modes: ['edit', 'paint', 'animate', 'pose']},
toolbars: {
head: Toolbars.outliner
},

View File

@ -729,7 +729,7 @@
this.updateSelection = function() {
this.elements.empty()
if (Modes.edit || Toolbox.selected.id == 'pivot_tool') {
if (Modes.edit || Modes.pose || Toolbox.selected.id == 'pivot_tool') {
if (Outliner.selected.length) {
Outliner.selected.forEach(element => {
if (
@ -830,7 +830,7 @@
this.center = function() {
delete Transformer.rotation_ref;
Transformer.rotation_selection.set(0, 0, 0);
if (Modes.edit || Toolbox.selected.id == 'pivot_tool') {
if (Modes.edit || Modes.pose || Toolbox.selected.id == 'pivot_tool') {
if (Transformer.visible) {
var rotation_tool = Toolbox.selected.id === 'rotate_tool' || Toolbox.selected.id === 'pivot_tool'
var rotation_object = getRotationObject()
@ -1035,7 +1035,7 @@
function beforeFirstChange(event, point) {
if (scope.hasChanged) return;
if (Modes.edit || Toolbox.selected.id == 'pivot_tool') {
if (Modes.edit || Modes.pose || Toolbox.selected.id == 'pivot_tool') {
if (Toolbox.selected.id === 'resize_tool') {
var axisnr = getAxisNumber(scope.axis.toLowerCase().replace('n', ''));
@ -1194,7 +1194,7 @@
}
let transform_space = Transformer.getTransformSpace()
if (Modes.edit || Toolbox.selected.id == 'pivot_tool') {
if (Modes.edit || Modes.pose || Toolbox.selected.id == 'pivot_tool') {
if (Toolbox.selected.id === 'move_tool') {
@ -1560,7 +1560,7 @@
Blockbench.setStatusBarText();
if (Modes.id === 'edit' || Toolbox.selected.id == 'pivot_tool') {
if (Modes.id === 'edit' || Modes.id === 'pose' || Toolbox.selected.id == 'pivot_tool') {
if (Toolbox.selected.id === 'resize_tool') {
//Scale
selected.forEach(function(obj) {

View File

@ -988,7 +988,7 @@ BARS.defineActions(function() {
}
})
new BarSelect('rotation_space', {
condition: {modes: ['edit', 'animate'], tools: ['rotate_tool']},
condition: {modes: ['edit', 'animate', 'pose'], tools: ['rotate_tool']},
category: 'transform',
value: 'local',
options: {
@ -1233,7 +1233,7 @@ BARS.defineActions(function() {
description: tl('action.slider_rotation.desc', ['X']),
color: 'x',
category: 'transform',
condition: () => (Modes.edit && getRotationObject()),
condition: () => ((Modes.edit || Modes.pose) && getRotationObject()),
get: function() {
if (Format.bone_rig && Group.selected) {
return Group.selected.rotation[0];
@ -1260,7 +1260,7 @@ BARS.defineActions(function() {
description: tl('action.slider_rotation.desc', ['Y']),
color: 'y',
category: 'transform',
condition: () => (Modes.edit && getRotationObject()),
condition: () => ((Modes.edit || Modes.pose) && getRotationObject()),
get: function() {
if (Format.bone_rig && Group.selected) {
return Group.selected.rotation[1];
@ -1287,7 +1287,7 @@ BARS.defineActions(function() {
description: tl('action.slider_rotation.desc', ['Z']),
color: 'z',
category: 'transform',
condition: () => (Modes.edit && getRotationObject()),
condition: () => ((Modes.edit || Modes.pose) && getRotationObject()),
get: function() {
if (Format.bone_rig && Group.selected) {
return Group.selected.rotation[2];

View File

@ -74,6 +74,7 @@
"mode.paint": "Paint",
"mode.display": "Display",
"mode.animate": "Animate",
"mode.pose": "Pose",
"mode.start.new": "New",
"mode.start.recent": "Recent",