UI: use property split for motion paths
authorWilliam Reynish <billreynish>
Tue, 11 Sep 2018 06:49:52 +0000 (16:49 +1000)
committerCampbell Barton <ideasman42@gmail.com>
Tue, 11 Sep 2018 06:52:18 +0000 (16:52 +1000)
release/scripts/startup/bl_ui/properties_animviz.py
release/scripts/startup/bl_ui/properties_data_armature.py
release/scripts/startup/bl_ui/properties_object.py
release/scripts/startup/bl_ui/properties_view_layer.py

index 7ba503bffd276d8360430cf220159872b09b0e3b..eb031b54caada70381a2d124d01e57425bb27ac9 100644 (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")
 
-        sub.prop(mps, "frame_step", text="Step")
-
-        if mps.type == 'RANGE':
+        if mpath:
+            col = layout.column(align=True)
+            col.enabled = False
             if bones:
-                sub.operator("pose.paths_range_update")
+                col.prop(mpath, "frame_start", text="Bone Cache From")
             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")
+                col.prop(mpath, "frame_start", text="Cache From")
+            col.prop(mpath, "frame_end", text="To")
 
-        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)
+            row = layout.row(align=True)
             if bones:
-                sub.operator("pose.paths_update", text="Update Paths", icon='BONE_DATA')
-                sub.operator("pose.paths_clear", text="", icon='X')
+                row.operator("pose.paths_update", text="Update Paths", icon='BONE_DATA')
+                row.operator("pose.paths_clear", text="", icon='X')
             else:
-                sub.operator("object.paths_update", text="Update Paths", icon='OBJECT_DATA')
-                sub.operator("object.paths_clear", text="", icon='X')
+                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")
+
+            split = col.split(factor=0.6)
 
-            col.prop(mpath, "use_custom_color", text="Custom Color")
-            sub = col.column()
+            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
index 4f0f18889fc62aab4e3921925a5816a5b49acc93..833643cdafcc5d5848760a988a9d0f29728aa358 100644 (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,
index 4f95f1fbf050c40669c6793fc2356411fbd59b0d..65126691d8c262816c9b106aaf51b5f4cd6adb46 100644 (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,
 )
 
index f96bf0413113e1a30579f88c85bc33397890b924..b962c8f58280ba6348cb07158cc90895540b9aa4 100644 (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")