[Bf-blender-cvs] [51ea1eea485] modifier-panels-ui: Use a panel based UI to draw modifiers

Hans Goudey noreply at git.blender.org
Sat Mar 28 05:38:12 CET 2020


Commit: 51ea1eea485c48fcb73293db1c94357ab5924fd4
Author: Hans Goudey
Date:   Fri Mar 27 23:28:33 2020 -0500
Branches: modifier-panels-ui
https://developer.blender.org/rB51ea1eea485c48fcb73293db1c94357ab5924fd4

Use a panel based UI to draw modifiers

Currently an interface template creates a RECREATE panel for each
modifier, which is then drawn with the rest of the panels. The python
 based modifier drawing is removed.

 This also adds a UIList and the idea of an active modifier, along with
 object operations to add and move it.

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

M	release/scripts/startup/bl_ui/properties_data_modifier.py
M	source/blender/editors/interface/interface_templates.c
M	source/blender/editors/object/object_intern.h
M	source/blender/editors/object/object_modifier.c
M	source/blender/editors/object/object_ops.c
M	source/blender/makesdna/DNA_object_types.h
M	source/blender/makesrna/intern/rna_object.c
M	source/blender/makesrna/intern/rna_ui_api.c

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

diff --git a/release/scripts/startup/bl_ui/properties_data_modifier.py b/release/scripts/startup/bl_ui/properties_data_modifier.py
index e5ea1a94945..cccbcb07603 100644
--- a/release/scripts/startup/bl_ui/properties_data_modifier.py
+++ b/release/scripts/startup/bl_ui/properties_data_modifier.py
@@ -18,7 +18,7 @@
 
 # <pep8 compliant>
 import bpy
-from bpy.types import Panel
+from bpy.types import Panel, UIList
 from bpy.app.translations import pgettext_iface as iface_
 
 
@@ -39,1749 +39,46 @@ class DATA_PT_modifiers(ModifierButtonsPanel, Panel):
 
     def draw(self, context):
         layout = self.layout
-
         ob = context.object
 
         layout.operator_menu_enum("object.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 ARMATURE(self, layout, ob, md):
-        split = layout.split()
-
-        col = split.column()
-        col.label(text="Object:")
-        col.prop(md, "object", text="")
-        col.prop(md, "use_deform_preserve_volume")
-
-        col = split.column()
-        col.label(text="Bind To:")
-        col.prop(md, "use_vertex_groups", text="Vertex Groups")
-        col.prop(md, "use_bone_envelopes", text="Bone Envelopes")
-
-        layout.separator()
-
-        split = layout.split()
-
-        row = split.row(align=True)
-        row.prop_search(md, "vertex_group", ob, "vertex_groups", text="")
-        sub = row.row(align=True)
-        sub.active = bool(md.vertex_group)
-        sub.prop(md, "invert_vertex_group", text="", icon='ARROW_LEFTRIGHT')
-
-        split.prop(md, "use_multi_modifier")
-
-    def ARRAY(self, layout, _ob, md):
-        layout.prop(md, "fit_type")
-
-        if md.fit_type == 'FIXED_COUNT':
-            layout.prop(md, "count")
-        elif md.fit_type == 'FIT_LENGTH':
-            layout.prop(md, "fit_length")
-        elif md.fit_type == 'FIT_CURVE':
-            layout.prop(md, "curve")
-
-        layout.separator()
-
-        split = layout.split()
-
-        col = split.column()
-        col.prop(md, "use_constant_offset")
-        sub = col.column()
-        sub.active = md.use_constant_offset
-        sub.prop(md, "constant_offset_displace", text="")
-
-        col.separator()
-
-        col.prop(md, "use_merge_vertices", text="Merge")
-        sub = col.column()
-        sub.active = md.use_merge_vertices
-        sub.prop(md, "use_merge_vertices_cap", text="First Last")
-        sub.prop(md, "merge_threshold", text="Distance")
-
-        col = split.column()
-        col.prop(md, "use_relative_offset")
-        sub = col.column()
-        sub.active = md.use_relative_offset
-        sub.prop(md, "relative_offset_displace", text="")
-
-        col.separator()
-
-        col.prop(md, "use_object_offset")
-        sub = col.column()
-        sub.active = md.use_object_offset
-        sub.prop(md, "offset_object", text="")
-
-        row = layout.row()
-        split = row.split()
-        col = split.column()
-        col.label(text="UVs:")
-        sub = col.column(align=True)
-        sub.prop(md, "offset_u")
-        sub.prop(md, "offset_v")
-        layout.separator()
-
-        layout.prop(md, "start_cap")
-        layout.prop(md, "end_cap")
-
-    def BEVEL(self, layout, ob, md):
-        offset_type = md.offset_type
-        if offset_type == 'PERCENT':
-            layout.prop(md, "width_pct")
-        else:
-            offset_text = "Width"
-            if offset_type == 'DEPTH':
-                offset_text = "Depth"
-            elif offset_type == 'OFFSET':
-                offset_text = "Offset"
-            layout.prop(md, "width", text=offset_text)
-        layout.row().prop(md, "offset_type", expand=True)
-
-        split = layout.split()
-        col = split.column()
-        col.prop(md, "use_only_vertices")
-        col.prop(md, "use_clamp_overlap")
-        col.prop(md, "loop_slide")
-        col = split.column()
-        col.prop(md, "mark_seam")
-        col.prop(md, "mark_sharp")
-        col.prop(md, "harden_normals")
-
-        layout.row().prop(md, "segments")
-        layout.row().prop(md, "profile")
-        layout.row().prop(md, "material")
-
-        layout.label(text="Miter Type:")
-        layout.row().prop(md, "miter_outer", text="Outer")
-        layout.row().prop(md, "miter_inner", text="Inner")
-        if md.miter_inner in {'MITER_PATCH', 'MITER_ARC'}:
-            layout.row().prop(md, "spread")
-
-        layout.label(text="Limit Method:")
-        layout.row().prop(md, "limit_method", expand=True)
-        if md.limit_method == 'ANGLE':
-            layout.prop(md, "angle_limit")
-        elif md.limit_method == 'VGROUP':
-            row = layout.row(align=True)
-            row.prop_search(md, "vertex_group", ob, "vertex_groups", text="")
-            row.prop(md, "invert_vertex_group", text="", icon='ARROW_LEFTRIGHT')
-
-        layout.label(text="Face Strength Mode:")
-        layout.row().prop(md, "face_strength_mode", expand=True)
-
-        layout.label(text="Intersection Type:")
-        layout.row().prop(md, "vmesh_method", expand=True)
-        layout.row().prop(md, "use_custom_profile")
-        row = layout.row()
-        row.enabled = md.use_custom_profile
-        if md.use_custom_profile:
-            layout.template_curveprofile(md, "custom_profile")
-
-    def BOOLEAN(self, layout, _ob, md):
-        split = layout.split()
-
-        col = split.column()
-        col.label(text="Operation:")
-        col.prop(md, "operation", text="")
-
-        col = split.column()
-        col.label(text="Object:")
-        col.prop(md, "object", text="")
-
-        layout.prop(md, "double_threshold")
-
-        if bpy.app.debug:
-            layout.prop(md, "debug_options")
-
-    def BUILD(self, layout, _ob, md):
-        split = layout.split()
-
-        col = split.column()
-        col.prop(md, "frame_start")
-        col.prop(md, "frame_duration")
-        col.prop(md, "use_reverse")
-
-        col = split.column()
-        col.prop(md, "use_random_order")
-        sub = col.column()
-        sub.active = md.use_random_order
-        sub.prop(md, "seed")
-
-    def MESH_CACHE(self, layout, _ob, md):
-        layout.prop(md, "cache_format")
-        layout.prop(md, "filepath")
-
-        if md.cache_format == 'ABC':
-            layout.prop(md, "sub_object")
-
-        layout.label(text="Evaluation:")
-        layout.prop(md, "factor", slider=True)
-        layout.prop(md, "deform_mode")
-        layout.prop(md, "interpolation")
-
-        layout.label(text="Time Mapping:")
-
-        row = layout.row()
-        row.prop(md, "time_mode", expand=True)
-        row = layout.row()
-        row.prop(md, "play_mode", expand=True)
-        if md.play_mode == 'SCENE':
-            layout.prop(md, "frame_start")
-            layout.prop(md, "frame_scale")
-        else:
-            time_mode = md.time_mode
-            if time_mode == 'FRAME':
-                layout.prop(md, "eval_frame")
-            elif time_mode == 'TIME':
-                layout.prop(md, "eval_time")
-            elif time_mode == 'FACTOR':
-                layout.prop(md, "eval_factor")
-
-        layout.label(text="Axis Mapping:")
-        split = layout.split(factor=0.5, align=True)
-        split.alert = (md.forward_axis[-1] == md.up_axis[-1])
-        split.label(text="Forward/Up Axis:")
-        split.prop(md, "forward_axis", text="")
-        split.prop(md, "up_axis", text="")
-        split = layout.split(factor=0.5)
-        split.label(text="Flip Axis:")
-        row = split.row()
-        row.prop(md, "flip_axis")
-
-    def MESH_SEQUENCE_CACHE(self, layout, ob, md):
-        layout.label(text="Cache File Properties:")
-        box = layout.box()
-        box.template_cache_file(md, "cache_file")
-
-        cache_file = md.cache_file
-
-        layout.label(text="Modifier Properties:")
-        box = layout.box()
-
-        if cache_file is not None:
-            box.prop_search(md, "object_path", cache_file, "object_paths")
-
-        if ob.type == 'MESH':
-            box.row().prop(md, "read_data")
-
-    def CAST(self, layout, ob, md):
-        split = layout.split(factor=0.25)
-
-        split.label(text="Cast Type:")
-        split.prop(md, "cast_type", text="")
-
-        split = layout.split(factor=0.25)
-
-        col = split.column()
-        col.prop(md, "use_x")
-        col.prop(md, "use_y")
-        col.prop(md, "use_z")
-
-        col = split.column()
-        col.prop(md, "factor")
-        col.prop(md, "radius")
-        col.prop(md, "size")
-        col.prop(md, "use_radius_as_size")
-
-        split = layout.split()
-
-        col = split.column()
-        col.label(text="Vertex Group:")
-        row = col.row(align=True)
-        row.prop_search(md, "vertex_group", ob, "vertex_groups", text="")
-        row.prop(md, "invert_vertex_group", text="", icon='ARROW_LEFTRIGHT')
-        col = split.column()
-        col.label(text="Control Object:")
-        col.prop(md, "object", text="")
-        if md.object:
-            col.prop(md, "use_transform")
-
-    def CLOTH(self, layout, _ob, _md):
-        layout.label(text="Settings are inside the Physics tab")
-
-    def COLLISION(self, layout, _ob, _md):
-        layout.label(text="Settings are inside the Physics tab")
-
-    def CURVE(self, layout, ob, md):
-        split = layout.split()
-
-        col = split.column()
-        col.label(text="Object:")
-        col.prop(md, "object", text="")
-        col = split.column()
-        col.label(text="Vertex Group:")
-        row = col.row(align=True)
-        row.prop_search(md, "vertex_group", ob, "vertex_groups", text="")
-        row.prop(md, "invert_vertex_group", text="", icon='ARROW_LEFTRIGHT')
-        layout.label(text="Deformation Axis:")
-        layout.row().prop(md, "deform_axis", expand=True)
-
-    def DECIMATE(self, layout, ob, md):
-        decimate_type = md.decimat

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list