Skip to content

Commit e387719

Browse files
authored
Merge pull request #7 from anasrar/development
add mix_mode and the default is after
2 parents f43c584 + 7458130 commit e387719

File tree

2 files changed

+28
-2
lines changed

2 files changed

+28
-2
lines changed

README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,7 @@
77
- No worry about bone orientation and scale.
88
- The purpose is to retarget animation and clean up action with **NLA Editor**
99

10-
## Current Version : 0.1.1 [16/11/2020]
11-
10+
## Current Version : 0.1.2 [19/12/2020]
1211

1312
## Feature
1413

ReNimNode/production/node_mapping.py

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,15 @@ class NODE_BONE(Node):
7979
subtype="XYZ",
8080
default=[0.0, 0.0, 0.0]
8181
)
82+
mix_mode: bpy.props.EnumProperty(
83+
name="Mix Mode",
84+
description="Specify how the copied and existing transformations are combined",
85+
items=[
86+
("BEFORE", "Before Original", "Apply copied transformation before original, as if the constraint target is a parent. Scale is handled specially to avoid creating shear"),
87+
("AFTER", "After Original", "Apply copied transformation after original, as if the constraint target is a child. Scale is handled specially to avoid creating shear")
88+
],
89+
default="AFTER"
90+
)
8291

8392
bone_target: bpy.props.StringProperty(default="")
8493
bone_source: bpy.props.StringProperty(default="")
@@ -206,6 +215,21 @@ def add_constraint_bone(self, context):
206215
const_copy_transform_target_bone.target_space = "LOCAL_WITH_PARENT"
207216
const_copy_transform_target_bone.mix_mode = "BEFORE"
208217

218+
const_mix_mode_driver = const_copy_transform_target_bone.driver_add('mix_mode').driver
219+
const_mix_mode_driver.type = 'SCRIPTED'
220+
221+
const_mix_mode_driver_var = const_mix_mode_driver.variables.new()
222+
const_mix_mode_driver_var.name = 'mix_mode'
223+
const_mix_mode_driver_var.type = 'SINGLE_PROP'
224+
const_mix_mode_driver_var_target = const_mix_mode_driver_var.targets[0]
225+
const_mix_mode_driver_var_target.id_type = 'NODETREE'
226+
const_mix_mode_driver_var_target.id = self.id_data
227+
const_mix_mode_driver_var_target.data_path = "{}".format(self.path_from_id('mix_mode'))
228+
const_mix_mode_driver_var_target.rotation_mode = 'AUTO'
229+
const_mix_mode_driver_var_target.transform_space = 'LOCAL_SPACE'
230+
231+
const_mix_mode_driver.expression = 'mix_mode + 1'
232+
209233
# change rotation mode to XYZ just to make it easier to add driver
210234
mimic_source_bone.rotation_mode = 'XYZ'
211235

@@ -540,6 +564,7 @@ def draw_buttons(self, context, layout):
540564
col.label(text="Influence")
541565
col.label(text="Multiply")
542566
col.label(text="Offset")
567+
col.label(text="Mix")
543568
col.label(text="Bone Target")
544569
col.label(text="Bone Source")
545570
col = split.column()
@@ -564,6 +589,8 @@ def draw_buttons(self, context, layout):
564589
sub_col.row().prop(self, "scale_influence", text="", slider=True)
565590
sub_col.row().prop(self, "scale_multiply", text="")
566591
sub_col.row().prop(self, "scale_offset", text="")
592+
sub_col = col.column()
593+
sub_col.prop(self, "mix_mode", text="")
567594
col = col.column()
568595
col.enabled = not self.is_bind
569596
if self.inputs[0].is_linked:

0 commit comments

Comments
 (0)