Skip to content

Commit

Permalink
Hide advanced retargeting options under a dropdown
Browse files Browse the repository at this point in the history
  • Loading branch information
greisane committed Oct 2, 2022
1 parent 80a010b commit 5500ea7
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 16 deletions.
26 changes: 19 additions & 7 deletions mesh/retarget_mesh.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,13 +156,21 @@ def draw_panel(self, context):
row.label(text="", icon='FORWARD')
row.prop(settings, 'retarget_dst', text="")

row = col.row(align=True)
row.prop(settings, 'retarget_function', text="")
row.prop(settings, 'retarget_radius', text="")
row = col.row()
row.alignment = 'LEFT'
icon = 'DOWNARROW_HLT' if settings.retarget_show_advanced else 'RIGHTARROW'
row.prop(settings, 'retarget_show_advanced', icon=icon, emboss=False)

if settings.retarget_show_advanced:
row = col.row(align=True)
row.prop(settings, 'retarget_function', text="")
row.prop(settings, 'retarget_radius', text="")

col.prop(settings, 'retarget_only_selection')
col.prop(settings, 'retarget_high_quality')
col.prop(settings, 'retarget_use_mirror_x')
col.prop(settings, 'retarget_only_selection')
col.prop(settings, 'retarget_high_quality')
col.prop(settings, 'retarget_use_mirror_x')

col.separator()

row = col.row(align=True)
op1 = row.operator('gret.retarget_mesh', icon='CHECKMARK', text="Retarget")
Expand Down Expand Up @@ -210,7 +218,7 @@ def register(settings, prefs):

settings.add_property('retarget_src', bpy.props.PointerProperty(
name="Mesh Retarget Source",
description="Base mesh that the meshes are fit to",
description="Original mesh that the meshes are fit to",
type=bpy.types.Object,
poll=lambda self, obj: obj and obj.type == 'MESH',
update=retarget_src_update,
Expand All @@ -221,6 +229,10 @@ def register(settings, prefs):
Expected to share topology and vertex order with the source mesh""",
items=retarget_dst_items,
))
settings.add_property('retarget_show_advanced', bpy.props.BoolProperty(
name="Advanced Options",
description="Show advanced options",
))
retarget_props = GRET_OT_retarget_mesh.__annotations__
settings.add_property('retarget_function', retarget_props['function'])
settings.add_property('retarget_radius', retarget_props['radius'])
Expand Down
30 changes: 21 additions & 9 deletions rig/retarget_armature.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,15 +164,23 @@ def draw_panel(self, context):
row.label(text="", icon='FORWARD')
row.prop(settings, 'retarget_dst', text="")

row = col.row(align=True)
row.prop(settings, 'retarget_function', text="")
row.prop(settings, 'retarget_radius', text="")
row = col.row()
row.alignment = 'LEFT'
icon = 'DOWNARROW_HLT' if settings.retarget_show_advanced else 'RIGHTARROW'
row.prop(settings, 'retarget_show_advanced', icon=icon, emboss=False)

if settings.retarget_show_advanced:
row = col.row(align=True)
row.prop(settings, 'retarget_function', text="")
row.prop(settings, 'retarget_radius', text="")

col.prop(settings, 'retarget_only_selection')
col.prop(settings, 'retarget_high_quality')
col.prop(settings, 'retarget_use_mirror_x')
col.prop(settings, 'retarget_lock_length')
col.prop(settings, 'retarget_lock_direction')
col.prop(settings, 'retarget_only_selection')
col.prop(settings, 'retarget_high_quality')
col.prop(settings, 'retarget_use_mirror_x')
col.prop(settings, 'retarget_lock_length')
col.prop(settings, 'retarget_lock_direction')

col.separator()

if obj and obj.data and getattr(obj.data, 'use_mirror_x', False):
col.label(text="X-Axis Mirror is enabled.")
Expand Down Expand Up @@ -226,7 +234,7 @@ def register(settings, prefs):

settings.add_property('retarget_src', bpy.props.PointerProperty(
name="Mesh Retarget Source",
description="Base mesh that the meshes are fit to",
description="Original mesh that the meshes are fit to",
type=bpy.types.Object,
poll=lambda self, obj: obj and obj.type == 'MESH',
update=retarget_src_update,
Expand All @@ -237,6 +245,10 @@ def register(settings, prefs):
Expected to share topology and vertex order with the source mesh""",
items=retarget_dst_items,
))
settings.add_property('retarget_show_advanced', bpy.props.BoolProperty(
name="Advanced Options",
description="Show advanced options",
))
retarget_props = GRET_OT_retarget_armature.__annotations__
settings.add_property('retarget_function', retarget_props['function'])
settings.add_property('retarget_radius', retarget_props['radius'])
Expand Down

0 comments on commit 5500ea7

Please sign in to comment.