forked from bartvdbraak/blender
Applies Patch 20200
Shuffle IK Restriction and iTaSC parameter panels into more fitting context.
This commit is contained in:
parent
a674f1a2cc
commit
921d4b8eb0
@ -235,9 +235,63 @@ class DATA_PT_ghost(DataButtonsPanel):
|
||||
col.label(text="Display:")
|
||||
col.prop(arm, "ghost_only_selected", text="Selected Only")
|
||||
|
||||
class DATA_PT_iksolver_itasc(DataButtonsPanel):
|
||||
bl_label = "iTaSC parameters"
|
||||
bl_default_closed = True
|
||||
|
||||
def poll(self, context):
|
||||
ob = context.object
|
||||
return (ob and ob.pose)
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
|
||||
ob = context.object
|
||||
|
||||
itasc = ob.pose.ik_param
|
||||
wide_ui = context.region.width > narrowui
|
||||
|
||||
row = layout.row()
|
||||
row.prop(ob.pose, "ik_solver")
|
||||
|
||||
layout.prop(itasc, "mode", expand=True)
|
||||
simulation = itasc.mode == 'SIMULATION'
|
||||
if simulation:
|
||||
layout.label(text="Reiteration:")
|
||||
layout.prop(itasc, "reiteration", expand=True)
|
||||
|
||||
split = layout.split()
|
||||
split.active = not simulation or itasc.reiteration != 'NEVER'
|
||||
col = split.column()
|
||||
col.prop(itasc, "precision")
|
||||
|
||||
if wide_ui:
|
||||
col = split.column()
|
||||
col.prop(itasc, "num_iter")
|
||||
|
||||
|
||||
if simulation:
|
||||
layout.prop(itasc, "auto_step")
|
||||
row = layout.row()
|
||||
if itasc.auto_step:
|
||||
row.prop(itasc, "min_step", text="Min")
|
||||
row.prop(itasc, "max_step", text="Max")
|
||||
else:
|
||||
row.prop(itasc, "num_step")
|
||||
|
||||
layout.prop(itasc, "solver")
|
||||
if simulation:
|
||||
layout.prop(itasc, "feedback")
|
||||
layout.prop(itasc, "max_velocity")
|
||||
if itasc.solver == 'DLS':
|
||||
row = layout.row()
|
||||
row.prop(itasc, "dampmax", text="Damp", slider=True)
|
||||
row.prop(itasc, "dampeps", text="Eps", slider=True)
|
||||
|
||||
bpy.types.register(DATA_PT_context_arm)
|
||||
bpy.types.register(DATA_PT_skeleton)
|
||||
bpy.types.register(DATA_PT_display)
|
||||
bpy.types.register(DATA_PT_bone_groups)
|
||||
bpy.types.register(DATA_PT_paths)
|
||||
bpy.types.register(DATA_PT_ghost)
|
||||
bpy.types.register(DATA_PT_iksolver_itasc)
|
||||
|
@ -226,6 +226,107 @@ class BONE_PT_display(BoneButtonsPanel):
|
||||
col.label(text="Custom Shape:")
|
||||
col.prop(pchan, "custom_shape", text="")
|
||||
|
||||
class BONE_PT_inverse_kinematics(BoneButtonsPanel):
|
||||
bl_label = "Inverse Kinematics"
|
||||
bl_default_closed = True
|
||||
|
||||
def poll(self, context):
|
||||
ob = context.object
|
||||
bone = context.bone
|
||||
pchan = ob.pose.bones[bone.name]
|
||||
|
||||
if ob and bone and pchan:
|
||||
return True
|
||||
|
||||
return False
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
|
||||
ob = context.object
|
||||
bone = context.bone
|
||||
pchan = ob.pose.bones[bone.name]
|
||||
wide_ui = context.region.width > narrowui
|
||||
|
||||
split = layout.split(percentage=0.25)
|
||||
split.prop(pchan, "ik_dof_x", text="X")
|
||||
split.active = pchan.has_ik
|
||||
row = split.row()
|
||||
row.prop(pchan, "ik_stiffness_x", text="Stiffness", slider=True)
|
||||
row.active = pchan.ik_dof_x and pchan.has_ik
|
||||
|
||||
if wide_ui:
|
||||
split = layout.split(percentage=0.25)
|
||||
sub = split.row()
|
||||
else:
|
||||
sub = layout.column(align=True)
|
||||
sub.prop(pchan, "ik_limit_x", text="Limit")
|
||||
sub.active = pchan.ik_dof_x and pchan.has_ik
|
||||
if wide_ui:
|
||||
sub = split.row(align=True)
|
||||
sub.prop(pchan, "ik_min_x", text="")
|
||||
sub.prop(pchan, "ik_max_x", text="")
|
||||
sub.active = pchan.ik_dof_x and pchan.ik_limit_x and pchan.has_ik
|
||||
|
||||
split = layout.split(percentage=0.25)
|
||||
split.prop(pchan, "ik_dof_y", text="Y")
|
||||
split.active = pchan.has_ik and pchan.has_ik
|
||||
row = split.row()
|
||||
row.prop(pchan, "ik_stiffness_y", text="Stiffness", slider=True)
|
||||
row.active = pchan.ik_dof_y and pchan.has_ik
|
||||
|
||||
if wide_ui:
|
||||
split = layout.split(percentage=0.25)
|
||||
sub = split.row()
|
||||
else:
|
||||
sub = layout.column(align=True)
|
||||
sub.prop(pchan, "ik_limit_y", text="Limit")
|
||||
sub.active = pchan.ik_dof_y and pchan.has_ik
|
||||
if wide_ui:
|
||||
sub = split.row(align=True)
|
||||
sub.prop(pchan, "ik_min_y", text="")
|
||||
sub.prop(pchan, "ik_max_y", text="")
|
||||
sub.active = pchan.ik_dof_y and pchan.ik_limit_y and pchan.has_ik
|
||||
|
||||
split = layout.split(percentage=0.25)
|
||||
split.prop(pchan, "ik_dof_z", text="Z")
|
||||
split.active = pchan.has_ik and pchan.has_ik
|
||||
sub = split.row()
|
||||
sub.prop(pchan, "ik_stiffness_z", text="Stiffness", slider=True)
|
||||
sub.active = pchan.ik_dof_z and pchan.has_ik
|
||||
|
||||
if wide_ui:
|
||||
split = layout.split(percentage=0.25)
|
||||
sub = split.row()
|
||||
else:
|
||||
sub = layout.column(align=True)
|
||||
sub.prop(pchan, "ik_limit_z", text="Limit")
|
||||
sub.active = pchan.ik_dof_z and pchan.has_ik
|
||||
if wide_ui:
|
||||
sub = split.row(align=True)
|
||||
sub.prop(pchan, "ik_min_z", text="")
|
||||
sub.prop(pchan, "ik_max_z", text="")
|
||||
sub.active = pchan.ik_dof_z and pchan.ik_limit_z and pchan.has_ik
|
||||
split = layout.split()
|
||||
split.prop(pchan, "ik_stretch", text="Stretch", slider=True)
|
||||
if wide_ui:
|
||||
split.label()
|
||||
split.active = pchan.has_ik
|
||||
|
||||
if ob.pose.ik_solver == 'ITASC':
|
||||
split = layout.split()
|
||||
col = split.column()
|
||||
col.prop(pchan, "ik_rot_control", text="Control Rotation")
|
||||
col.active = pchan.has_ik
|
||||
if wide_ui:
|
||||
col = split.column()
|
||||
col.prop(pchan, "ik_rot_weight", text="Weight", slider=True)
|
||||
col.active = pchan.has_ik
|
||||
# not supported yet
|
||||
#row = layout.row()
|
||||
#row.prop(pchan, "ik_lin_control", text="Joint Size")
|
||||
#row.prop(pchan, "ik_lin_weight", text="Weight", slider=True)
|
||||
|
||||
|
||||
class BONE_PT_deform(BoneButtonsPanel):
|
||||
bl_label = "Deform"
|
||||
@ -298,5 +399,6 @@ bpy.types.register(BONE_PT_transform)
|
||||
bpy.types.register(BONE_PT_transform_locks)
|
||||
bpy.types.register(BONE_PT_relations)
|
||||
bpy.types.register(BONE_PT_display)
|
||||
bpy.types.register(BONE_PT_inverse_kinematics)
|
||||
bpy.types.register(BONE_PT_deform)
|
||||
bpy.types.register(BONE_PT_properties)
|
||||
|
@ -735,164 +735,6 @@ class OBJECT_PT_constraints(ConstraintButtonsPanel):
|
||||
for con in ob.constraints:
|
||||
self.draw_constraint(context, con)
|
||||
|
||||
|
||||
class BONE_PT_inverse_kinematics(ConstraintButtonsPanel):
|
||||
bl_label = "Inverse Kinematics"
|
||||
bl_default_closed = True
|
||||
bl_context = "bone_constraint"
|
||||
|
||||
def poll(self, context):
|
||||
ob = context.object
|
||||
bone = context.bone
|
||||
|
||||
if ob and bone:
|
||||
pchan = ob.pose.bones[bone.name]
|
||||
return pchan.has_ik
|
||||
|
||||
return False
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
|
||||
ob = context.object
|
||||
bone = context.bone
|
||||
pchan = ob.pose.bones[bone.name]
|
||||
wide_ui = context.region.width > narrowui
|
||||
|
||||
row = layout.row()
|
||||
row.prop(ob.pose, "ik_solver")
|
||||
|
||||
split = layout.split(percentage=0.25)
|
||||
split.prop(pchan, "ik_dof_x", text="X")
|
||||
row = split.row()
|
||||
row.prop(pchan, "ik_stiffness_x", text="Stiffness", slider=True)
|
||||
row.active = pchan.ik_dof_x
|
||||
|
||||
if wide_ui:
|
||||
split = layout.split(percentage=0.25)
|
||||
sub = split.row()
|
||||
else:
|
||||
sub = layout.column(align=True)
|
||||
sub.prop(pchan, "ik_limit_x", text="Limit")
|
||||
sub.active = pchan.ik_dof_x
|
||||
if wide_ui:
|
||||
sub = split.row(align=True)
|
||||
sub.prop(pchan, "ik_min_x", text="")
|
||||
sub.prop(pchan, "ik_max_x", text="")
|
||||
sub.active = pchan.ik_dof_x and pchan.ik_limit_x
|
||||
|
||||
split = layout.split(percentage=0.25)
|
||||
split.prop(pchan, "ik_dof_y", text="Y")
|
||||
row = split.row()
|
||||
row.prop(pchan, "ik_stiffness_y", text="Stiffness", slider=True)
|
||||
row.active = pchan.ik_dof_y
|
||||
|
||||
if wide_ui:
|
||||
split = layout.split(percentage=0.25)
|
||||
sub = split.row()
|
||||
else:
|
||||
sub = layout.column(align=True)
|
||||
sub.prop(pchan, "ik_limit_y", text="Limit")
|
||||
sub.active = pchan.ik_dof_y
|
||||
if wide_ui:
|
||||
sub = split.row(align=True)
|
||||
sub.prop(pchan, "ik_min_y", text="")
|
||||
sub.prop(pchan, "ik_max_y", text="")
|
||||
sub.active = pchan.ik_dof_y and pchan.ik_limit_y
|
||||
|
||||
split = layout.split(percentage=0.25)
|
||||
split.prop(pchan, "ik_dof_z", text="Z")
|
||||
sub = split.row()
|
||||
sub.prop(pchan, "ik_stiffness_z", text="Stiffness", slider=True)
|
||||
sub.active = pchan.ik_dof_z
|
||||
|
||||
if wide_ui:
|
||||
split = layout.split(percentage=0.25)
|
||||
sub = split.row()
|
||||
else:
|
||||
sub = layout.column(align=True)
|
||||
sub.prop(pchan, "ik_limit_z", text="Limit")
|
||||
sub.active = pchan.ik_dof_z
|
||||
if wide_ui:
|
||||
sub = split.row(align=True)
|
||||
sub.prop(pchan, "ik_min_z", text="")
|
||||
sub.prop(pchan, "ik_max_z", text="")
|
||||
sub.active = pchan.ik_dof_z and pchan.ik_limit_z
|
||||
split = layout.split()
|
||||
split.prop(pchan, "ik_stretch", text="Stretch", slider=True)
|
||||
if wide_ui:
|
||||
split.label()
|
||||
|
||||
if ob.pose.ik_solver == 'ITASC':
|
||||
split = layout.split()
|
||||
col = split.column()
|
||||
col.prop(pchan, "ik_rot_control", text="Control Rotation")
|
||||
if wide_ui:
|
||||
col = split.column()
|
||||
col.prop(pchan, "ik_rot_weight", text="Weight", slider=True)
|
||||
# not supported yet
|
||||
#row = layout.row()
|
||||
#row.prop(pchan, "ik_lin_control", text="Joint Size")
|
||||
#row.prop(pchan, "ik_lin_weight", text="Weight", slider=True)
|
||||
|
||||
|
||||
class BONE_PT_iksolver_itasc(ConstraintButtonsPanel):
|
||||
bl_label = "iTaSC parameters"
|
||||
bl_default_closed = True
|
||||
bl_context = "bone_constraint"
|
||||
|
||||
def poll(self, context):
|
||||
ob = context.object
|
||||
bone = context.bone
|
||||
|
||||
if ob and bone:
|
||||
pchan = ob.pose.bones[bone.name]
|
||||
return pchan.has_ik and ob.pose.ik_solver == 'ITASC' and ob.pose.ik_param
|
||||
|
||||
return False
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
|
||||
ob = context.object
|
||||
itasc = ob.pose.ik_param
|
||||
wide_ui = context.region.width > narrowui
|
||||
|
||||
layout.prop(itasc, "mode", expand=True)
|
||||
simulation = itasc.mode == 'SIMULATION'
|
||||
if simulation:
|
||||
layout.label(text="Reiteration:")
|
||||
layout.prop(itasc, "reiteration", expand=True)
|
||||
|
||||
split = layout.split()
|
||||
split.active = not simulation or itasc.reiteration != 'NEVER'
|
||||
col = split.column()
|
||||
col.prop(itasc, "precision")
|
||||
|
||||
if wide_ui:
|
||||
col = split.column()
|
||||
col.prop(itasc, "num_iter")
|
||||
|
||||
|
||||
if simulation:
|
||||
layout.prop(itasc, "auto_step")
|
||||
row = layout.row()
|
||||
if itasc.auto_step:
|
||||
row.prop(itasc, "min_step", text="Min")
|
||||
row.prop(itasc, "max_step", text="Max")
|
||||
else:
|
||||
row.prop(itasc, "num_step")
|
||||
|
||||
layout.prop(itasc, "solver")
|
||||
if simulation:
|
||||
layout.prop(itasc, "feedback")
|
||||
layout.prop(itasc, "max_velocity")
|
||||
if itasc.solver == 'DLS':
|
||||
row = layout.row()
|
||||
row.prop(itasc, "dampmax", text="Damp", slider=True)
|
||||
row.prop(itasc, "dampeps", text="Eps", slider=True)
|
||||
|
||||
|
||||
class BONE_PT_constraints(ConstraintButtonsPanel):
|
||||
bl_label = "Bone Constraints"
|
||||
bl_context = "bone_constraint"
|
||||
@ -917,6 +759,4 @@ class BONE_PT_constraints(ConstraintButtonsPanel):
|
||||
self.draw_constraint(context, con)
|
||||
|
||||
bpy.types.register(OBJECT_PT_constraints)
|
||||
bpy.types.register(BONE_PT_iksolver_itasc)
|
||||
bpy.types.register(BONE_PT_inverse_kinematics)
|
||||
bpy.types.register(BONE_PT_constraints)
|
||||
|
Loading…
Reference in New Issue
Block a user