[Bf-blender-cvs] [377842af6d6] temp-greasepencil-object-stacksplit: WIP: Prepare python panel

Antonio Vazquez noreply at git.blender.org
Mon Jun 18 19:53:42 CEST 2018


Commit: 377842af6d6bf7eca15a59c611e0ee50e91d7826
Author: Antonio Vazquez
Date:   Mon Jun 18 18:57:07 2018 +0200
Branches: temp-greasepencil-object-stacksplit
https://developer.blender.org/rB377842af6d6bf7eca15a59c611e0ee50e91d7826

WIP: Prepare python panel

===================================================================

M	release/scripts/startup/bl_ui/properties_data_modifier.py

===================================================================

diff --git a/release/scripts/startup/bl_ui/properties_data_modifier.py b/release/scripts/startup/bl_ui/properties_data_modifier.py
index d43d1f61908..943606dd2a8 100644
--- a/release/scripts/startup/bl_ui/properties_data_modifier.py
+++ b/release/scripts/startup/bl_ui/properties_data_modifier.py
@@ -1562,6 +1562,27 @@ class DATA_PT_modifiers(ModifierButtonsPanel, Panel):
         if md.rest_source == 'BIND':
             layout.operator("object.correctivesmooth_bind", text="Unbind" if is_bind else "Bind")
 
+
+class DATA_PT_gpencil_modifiers(ModifierButtonsPanel, Panel):
+    bl_label = "Modifiers"
+
+    def draw(self, context):
+        layout = self.layout
+
+        ob = context.object
+
+        layout.operator_menu_enum("object.gpencil_modifier_add", "type")
+
+        for md in ob.modifiers:
+            box = layout.template_modifier(md)
+            if box:
+                # match enum type to our functions, avoids a lookup table.
+                getattr(self, md.type)(box, ob, md)
+
+    # the mt.type enum is (ab)used for a lookup on function names
+    # ...to avoid lengthy if statements
+    # so each type must have a function here.
+
     def GP_NOISE(self, layout, ob, md):
         gpd = ob.data
         split = layout.split()
@@ -1953,9 +1974,9 @@ class DATA_PT_modifiers(ModifierButtonsPanel, Panel):
         row.prop(md, "pass_index", text="Pass")
         row.prop(md, "invert_pass", text="", icon="ARROW_LEFTRIGHT")
 
-
 classes = (
     DATA_PT_modifiers,
+    DATA_PT_gpencil_modifiers,
 )
 
 if __name__ == "__main__":  # only for live edit.



More information about the Bf-blender-cvs mailing list