UI: use property split for motion paths

This commit is contained in:
William Reynish 2018-09-11 16:49:52 +10:00 committed by Campbell Barton
parent 17e57859e7
commit a0581daf75
Notes: blender-bot 2023-02-14 05:19:52 +01:00
Referenced by issue #56770, Crash after set language to Simplified Chinese
4 changed files with 116 additions and 45 deletions

View File

@ -38,63 +38,67 @@ class MotionPathButtonsPanel:
# Display Range
layout.use_property_split = True
layout.row().prop(mps, "type")
col = layout.column()
layout.prop(mps, "type")
sub = col.column(align=True)
if mps.type == 'CURRENT_FRAME':
sub.prop(mps, "frame_before", text="Frame Range Before")
sub.prop(mps, "frame_after", text="After")
col = layout.column(align=True)
col.prop(mps, "frame_before", text="Frame Range Before")
col.prop(mps, "frame_after", text="After")
col.prop(mps, "frame_step", text="Step")
elif mps.type == 'RANGE':
row = layout.row()
sub = row.column()
if mps.type == 'RANGE':
if bones:
sub.operator("pose.paths_range_update", text="", icon='TIME')
else:
sub.operator("object.paths_range_update", text="", icon='TIME')
sub = row.column(align=True)
sub.prop(mps, "frame_start", text="Frame Range Start")
sub.prop(mps, "frame_end", text="End")
sub.prop(mps, "frame_step", text="Step")
if mps.type == 'RANGE':
if bones:
sub.operator("pose.paths_range_update")
else:
sub.operator("object.paths_range_update")
col = layout.column(align=True)
if bones:
col.label(text="Cache for Bone:")
else:
col.label(text="Cache")
sub.prop(mps, "frame_step", text="Step")
if mpath:
sub = col.column(align=True)
sub.enabled = False
sub.prop(mpath, "frame_start", text="From")
sub.prop(mpath, "frame_end", text="To")
sub = col.row(align=True)
col = layout.column(align=True)
col.enabled = False
if bones:
sub.operator("pose.paths_update", text="Update Paths", icon='BONE_DATA')
sub.operator("pose.paths_clear", text="", icon='X')
col.prop(mpath, "frame_start", text="Bone Cache From")
else:
sub.operator("object.paths_update", text="Update Paths", icon='OBJECT_DATA')
sub.operator("object.paths_clear", text="", icon='X')
col.prop(mpath, "frame_start", text="Cache From")
col.prop(mpath, "frame_end", text="To")
row = layout.row(align=True)
if bones:
row.operator("pose.paths_update", text="Update Paths", icon='BONE_DATA')
row.operator("pose.paths_clear", text="", icon='X')
else:
row.operator("object.paths_update", text="Update Paths", icon='OBJECT_DATA')
row.operator("object.paths_clear", text="", icon='X')
else:
sub = col.column(align=True)
sub.label(text="Nothing to show yet...", icon='ERROR')
col = layout.column(align=True)
col.label(text="Nothing to show yet...", icon='ERROR')
if bones:
sub.operator("pose.paths_calculate", text="Calculate...", icon='BONE_DATA')
col.operator("pose.paths_calculate", text="Calculate...", icon='BONE_DATA')
else:
sub.operator("object.paths_calculate", text="Calculate...", icon='OBJECT_DATA')
col.operator("object.paths_calculate", text="Calculate...", icon='OBJECT_DATA')
# Display Settings
layout.label(text="Display")
class MotionPathButtonsPanel_display:
bl_space_type = 'PROPERTIES'
bl_region_type = 'WINDOW'
bl_label = "Display"
def draw_settings(self, context, avs, mpath, bones=False):
layout = self.layout
mps = avs.motion_path
layout.use_property_split = True
layout.use_property_decorate = False
col = layout.column()
col.prop(mps, "show_frame_numbers", text="Frame Numbers")
if mpath is not None:
col.prop(mpath, "lines", text="Lines")
col.prop(mpath, "line_thickness", text="Thickness")
col.prop(mps, "show_keyframe_highlight", text="Keyframes")
sub = col.column()
sub.enabled = mps.show_keyframe_highlight
@ -104,11 +108,15 @@ class MotionPathButtonsPanel:
# Customize path
if mpath is not None:
col.prop(mpath, "lines", text="Lines")
col.prop(mpath, "line_thickness", text="Thickness")
col.prop(mpath, "use_custom_color", text="Custom Color")
sub = col.column()
split = col.split(factor=0.6)
split.prop(mpath, "use_custom_color", text="Custom Color")
sub = split.column()
sub.enabled = mpath.use_custom_color
sub.prop(mpath, "color")
sub.prop(mpath, "color", text="")
# FIXME: this panel still needs to be ported so that it will work correctly with animviz

View File

@ -288,6 +288,7 @@ class DATA_PT_iksolver_itasc(ArmatureButtonsPanel, Panel):
from .properties_animviz import (
MotionPathButtonsPanel,
MotionPathButtonsPanel_display,
OnionSkinButtonsPanel,
)
@ -313,6 +314,29 @@ class DATA_PT_motion_paths(MotionPathButtonsPanel, Panel):
self.draw_settings(context, avs, mpath, bones=True)
class DATA_PT_motion_paths_display(MotionPathButtonsPanel_display, Panel):
#bl_label = "Bones Motion Paths"
bl_context = "data"
bl_parent_id = "DATA_PT_motion_paths"
bl_options = {'DEFAULT_CLOSED'}
@classmethod
def poll(cls, context):
# XXX: include pose-mode check?
return (context.object) and (context.armature)
def draw(self, context):
# layout = self.layout
ob = context.object
avs = ob.pose.animation_visualization
pchan = context.active_pose_bone
mpath = pchan.motion_path if pchan else None
self.draw_settings(context, avs, mpath, bones=True)
class DATA_PT_onion_skinning(OnionSkinButtonsPanel): # , Panel): # inherit from panel when ready
#bl_label = "Bones Onion Skinning"
bl_context = "data"
@ -342,6 +366,7 @@ classes = (
DATA_PT_bone_groups,
DATA_PT_pose_library,
DATA_PT_motion_paths,
DATA_PT_motion_paths_display,
DATA_PT_ghost,
DATA_PT_iksolver_itasc,
DATA_PT_custom_props_arm,

View File

@ -328,6 +328,7 @@ class OBJECT_PT_duplication(ObjectButtonsPanel, Panel):
from .properties_animviz import (
MotionPathButtonsPanel,
MotionPathButtonsPanel_display,
OnionSkinButtonsPanel,
)
@ -351,6 +352,26 @@ class OBJECT_PT_motion_paths(MotionPathButtonsPanel, Panel):
self.draw_settings(context, avs, mpath)
class OBJECT_PT_motion_paths_display(MotionPathButtonsPanel_display, Panel):
#bl_label = "Object Motion Paths"
bl_context = "object"
bl_parent_id = "OBJECT_PT_motion_paths"
bl_options = {'DEFAULT_CLOSED'}
@classmethod
def poll(cls, context):
return (context.object)
def draw(self, context):
# layout = self.layout
ob = context.object
avs = ob.animation_visualization
mpath = ob.motion_path
self.draw_settings(context, avs, mpath)
class OBJECT_PT_onion_skinning(OnionSkinButtonsPanel): # , Panel): # inherit from panel when ready
#bl_label = "Object Onion Skinning"
bl_context = "object"
@ -381,6 +402,7 @@ classes = (
OBJECT_PT_duplication,
OBJECT_PT_display,
OBJECT_PT_motion_paths,
OBJECT_PT_motion_paths_display,
OBJECT_PT_custom_props,
)

View File

@ -38,14 +38,21 @@ class VIEWLAYER_PT_layer(ViewLayerButtonsPanel, Panel):
def draw(self, context):
layout = self.layout
layout.use_property_split = True
flow = layout.grid_flow(row_major=True, columns=0, even_columns=True, even_rows=False, align=False)
layout.use_property_split = True
scene = context.scene
rd = scene.render
layer = bpy.context.view_layer
layout.prop(layer, "use", text="Use for Rendering")
layout.prop(rd, "use_single_layer", text="Render Single Layer")
col = flow.column()
col.prop(layer, "use", text="Use for Rendering")
col = flow.column()
col.prop(rd, "use_single_layer", text="Render Single Layer")
class VIEWLAYER_PT_eevee_layer_passes(ViewLayerButtonsPanel, Panel):
@ -55,19 +62,28 @@ class VIEWLAYER_PT_eevee_layer_passes(ViewLayerButtonsPanel, Panel):
def draw(self, context):
layout = self.layout
layout.use_property_split = True
flow = layout.grid_flow(row_major=True, columns=0, even_columns=True, even_rows=False, align=False)
scene = context.scene
rd = scene.render
view_layer = context.view_layer
col = layout.column()
col = flow.column()
col.prop(view_layer, "use_pass_combined")
col = flow.column()
col.prop(view_layer, "use_pass_z")
col = flow.column()
col.prop(view_layer, "use_pass_mist")
col = flow.column()
col.prop(view_layer, "use_pass_normal")
col = flow.column()
col.prop(view_layer, "use_pass_ambient_occlusion")
col = flow.column()
col.prop(view_layer, "use_pass_subsurface_direct", text="Subsurface Direct")
col = flow.column()
col.prop(view_layer, "use_pass_subsurface_color", text="Subsurface Color")