2.5 Part 2 of Layout Code Cleanup:
authorThomas Dinges <blender@dingto.org>
Tue, 28 Jul 2009 06:26:10 +0000 (06:26 +0000)
committerThomas Dinges <blender@dingto.org>
Tue, 28 Jul 2009 06:26:10 +0000 (06:26 +0000)
* Cleanup of Modifier and Text Data Panels.
* Made some small layout tweaks.

* Added missing RNA properties for Cast Modifier.

release/ui/buttons_data_modifier.py
release/ui/buttons_data_text.py
source/blender/makesrna/intern/rna_modifier.c

index c4d2aea06e551c669c1779f20d41ee022d21893a..909677d61f00d54145b8ff55f4f93c387d4dc0f9 100644 (file)
@@ -10,8 +10,9 @@ class DATA_PT_modifiers(DataButtonsPanel):
        __label__ = "Modifiers"
 
        def draw(self, context):
-               ob = context.object
                layout = self.layout
+               
+               ob = context.object
 
                row = layout.row()
                row.item_menu_enumO("object.modifier_add", "type")
@@ -84,9 +85,11 @@ class DATA_PT_modifiers(DataButtonsPanel):
                                                        
        def armature(self, layout, ob, md):
                layout.itemR(md, "object")
+               
                row = layout.row()
                row.item_pointerR(md, "vertex_group", ob, "vertex_groups")
                row.itemR(md, "invert")
+               
                flow = layout.column_flow()
                flow.itemR(md, "use_vertex_groups", text="Vertex Groups")
                flow.itemR(md, "use_bone_envelopes", text="Bone Envelopes")
@@ -107,34 +110,31 @@ class DATA_PT_modifiers(DataButtonsPanel):
                split = layout.split()
                
                col = split.column()
-               col = col.column()
                col.itemR(md, "constant_offset")
-               colsub = col.column()
-               colsub.active = md.constant_offset
-               colsub.itemR(md, "constant_offset_displacement", text="")
+               sub = col.column()
+               sub.active = md.constant_offset
+               sub.itemR(md, "constant_offset_displacement", text="")
 
                col.itemS()
 
-               sub = col.row().itemR(md, "merge_adjacent_vertices", text="Merge")
-               colsub = col.column()
-               colsub.active = md.merge_adjacent_vertices
-               colsub.itemR(md, "merge_end_vertices", text="First Last")
-               colsub.itemR(md, "merge_distance", text="Distance")
+               col.itemR(md, "merge_adjacent_vertices", text="Merge")
+               sub = col.column()
+               sub.active = md.merge_adjacent_vertices
+               sub.itemR(md, "merge_end_vertices", text="First Last")
+               sub.itemR(md, "merge_distance", text="Distance")
                
                col = split.column()
-               col = col.column()
                col.itemR(md, "relative_offset")
-               colsub = col.column()
-               colsub.active = md.relative_offset
-               colsub.itemR(md, "relative_offset_displacement", text="")
+               sub = col.column()
+               sub.active = md.relative_offset
+               sub.itemR(md, "relative_offset_displacement", text="")
 
                col.itemS()
 
-               col = col.column()
                col.itemR(md, "add_offset_object")
-               colsub = col.column()
-               colsub.active = md.add_offset_object
-               colsub.itemR(md, "offset_object", text="")
+               sub = col.column()
+               sub.active = md.add_offset_object
+               sub.itemR(md, "offset_object", text="")
 
                layout.itemS()
                
@@ -148,14 +148,11 @@ class DATA_PT_modifiers(DataButtonsPanel):
                row.itemR(md, "only_vertices")
                
                layout.itemL(text="Limit Method:")
-               row = layout.row()
-               row.itemR(md, "limit_method", expand=True)
+               layout.row().itemR(md, "limit_method", expand=True)
                if md.limit_method == 'ANGLE':
-                       row = layout.row()
-                       row.itemR(md, "angle")
+                       layout.itemR(md, "angle")
                elif md.limit_method == 'WEIGHT':
-                       row = layout.row()
-                       row.itemR(md, "edge_weight_method", expand=True)
+                       layout.row().itemR(md, "edge_weight_method", expand=True)
                        
        def boolean(self, layout, ob, md):
                layout.itemR(md, "operation")
@@ -170,23 +167,27 @@ class DATA_PT_modifiers(DataButtonsPanel):
 
                col = split.column()
                col.itemR(md, "randomize")
-               colsub = col.column()
-               colsub.active = md.randomize
-               colsub.itemR(md, "seed")
-                       
-               
-                       
+               sub = col.column()
+               sub.active = md.randomize
+               sub.itemR(md, "seed")
+
        def cast(self, layout, ob, md):
                layout.itemR(md, "cast_type")
-               col = layout.column_flow()
-               col.itemR(md, "x")
-               col.itemR(md, "y")
-               col.itemR(md, "z")
-               col.itemR(md, "factor")
-               col.itemR(md, "radius")
-               col.itemR(md, "size")
+               layout.itemR(md, "object")
+               if md.object:
+                       layout.itemR(md, "use_transform")
+               
+               flow = layout.column_flow()
+               flow.itemR(md, "x")
+               flow.itemR(md, "y")
+               flow.itemR(md, "z")
+               flow.itemR(md, "factor")
+               flow.itemR(md, "radius")
+               flow.itemR(md, "size")
+
+               layout.itemR(md, "from_radius")
+               
                layout.item_pointerR(md, "vertex_group", ob, "vertex_groups")
-               #Missing: "OB" and "From Radius"
                
        def cloth(self, layout, ob, md):
                layout.itemL(text="See Cloth panel.")
@@ -220,9 +221,10 @@ class DATA_PT_modifiers(DataButtonsPanel):
                
                col = split.column()
                col.itemR(md, "use_edge_angle", text="Edge Angle")
-               colsub = col.column()
-               colsub.active = md.use_edge_angle
-               colsub.itemR(md, "split_angle")
+               sub = col.column()
+               sub.active = md.use_edge_angle
+               sub.itemR(md, "split_angle")
+               
                col = split.column()
                col.itemR(md, "use_sharp", text="Sharp Edges")
                
@@ -233,7 +235,7 @@ class DATA_PT_modifiers(DataButtonsPanel):
                layout.itemR(md, "unborn")
                layout.itemR(md, "alive")
                layout.itemR(md, "dead")
-               # Missing: "Refresh" and "Clear Vertex Group" ?
+               # Missing: "Refresh" and "Clear Vertex Group" Operator
                
        def fluid(self, layout, ob, md):
                layout.itemL(text="See Fluid panel.")
@@ -243,7 +245,7 @@ class DATA_PT_modifiers(DataButtonsPanel):
                layout.itemR(md, "force", slider=True)
                layout.itemR(md, "object")
                layout.item_pointerR(md, "vertex_group", ob, "vertex_groups")
-               # Missing: "Reset" and "Recenter"
+               # Missing: "Reset" and "Recenter" Operator
                
        def lattice(self, layout, ob, md):
                layout.itemR(md, "object")
@@ -263,6 +265,7 @@ class DATA_PT_modifiers(DataButtonsPanel):
                layout.itemR(md, "invert")
 
                layout.itemS()
+               
                layout.itemO("object.modifier_mdef_bind", text="Bind")
                row = layout.row()
                row.itemR(md, "precision")
@@ -272,17 +275,19 @@ class DATA_PT_modifiers(DataButtonsPanel):
                layout.itemR(md, "merge_limit")
                split = layout.split()
                
-               sub = split.column()
-               sub.itemR(md, "x")
-               sub.itemR(md, "y")
-               sub.itemR(md, "z")
-               sub = split.column()
-               sub.itemL(text="Textures:")
-               sub.itemR(md, "mirror_u")
-               sub.itemR(md, "mirror_v")
-               sub = split.column()
-               sub.itemR(md, "clip", text="Do Clipping")
-               sub.itemR(md, "mirror_vertex_groups", text="Vertex Group")
+               col = split.column()
+               col.itemR(md, "x")
+               col.itemR(md, "y")
+               col.itemR(md, "z")
+               
+               col = split.column()
+               col.itemL(text="Textures:")
+               col.itemR(md, "mirror_u")
+               col.itemR(md, "mirror_v")
+               
+               col = split.column()
+               col.itemR(md, "clip", text="Do Clipping")
+               col.itemR(md, "mirror_vertex_groups", text="Vertex Group")
                
                layout.itemR(md, "mirror_object")
                
@@ -295,19 +300,19 @@ class DATA_PT_modifiers(DataButtonsPanel):
                layout.itemR(md, "object")
                layout.itemR(md, "particle_system_number")
                
-               col = layout.column_flow()
-               col.itemR(md, "normal")
-               col.itemR(md, "children")
-               col.itemR(md, "size")
-               col.itemR(md, "path")
+               flow = layout.column_flow()
+               flow.itemR(md, "normal")
+               flow.itemR(md, "children")
+               flow.itemR(md, "size")
+               flow.itemR(md, "path")
                if md.path:
-                       col.itemR(md, "keep_shape")
-               col.itemR(md, "unborn")
-               col.itemR(md, "alive")
-               col.itemR(md, "dead")
-               col.itemL(md, "")
+                       flow.itemR(md, "keep_shape")
+               flow.itemR(md, "unborn")
+               flow.itemR(md, "alive")
+               flow.itemR(md, "dead")
+               flow.itemL(md, "")
                if md.path:
-                       col.itemR(md, "axis", text="")
+                       flow.itemR(md, "axis", text="")
                
                if md.path:
                        row = layout.row()
@@ -332,14 +337,13 @@ class DATA_PT_modifiers(DataButtonsPanel):
                        row.itemR(md, "y")
                        row.itemR(md, "z")
                
-                       col = layout.column_flow()
-                       col.itemR(md, "negative")
-                       col.itemR(md, "positive")
-                       col.itemR(md, "cull_front_faces")
-                       col.itemR(md, "cull_back_faces")
+                       flow = layout.column_flow()
+                       flow.itemR(md, "negative")
+                       flow.itemR(md, "positive")
+                       flow.itemR(md, "cull_front_faces")
+                       flow.itemR(md, "cull_back_faces")
                elif md.mode == 'NEAREST_SURFACEPOINT':
                        layout.itemR(md, "keep_above_surface")
-               # To-Do: Validate if structs
                
        def simpledeform(self, layout, ob, md):
                layout.itemR(md, "mode")
@@ -354,13 +358,15 @@ class DATA_PT_modifiers(DataButtonsPanel):
        
        def smooth(self, layout, ob, md):
                split = layout.split()
-               sub = split.column()
-               sub.itemR(md, "x")
-               sub.itemR(md, "y")
-               sub.itemR(md, "z")
-               sub = split.column()
-               sub.itemR(md, "factor")
-               sub.itemR(md, "repeat")
+               
+               col = split.column()
+               col.itemR(md, "x")
+               col.itemR(md, "y")
+               col.itemR(md, "z")
+               
+               col = split.column()
+               col.itemR(md, "factor")
+               col.itemR(md, "repeat")
                
                layout.item_pointerR(md, "vertex_group", ob, "vertex_groups")
                
@@ -369,11 +375,12 @@ class DATA_PT_modifiers(DataButtonsPanel):
        
        def subsurf(self, layout, ob, md):
                layout.itemR(md, "subdivision_type")
-               col = layout.column_flow()
-               col.itemR(md, "levels", text="Preview")
-               col.itemR(md, "render_levels", text="Render")
-               col.itemR(md, "optimal_draw", text="Optimal Display")
-               col.itemR(md, "subsurf_uv")
+               
+               flow = layout.column_flow()
+               flow.itemR(md, "levels", text="Preview")
+               flow.itemR(md, "render_levels", text="Render")
+               flow.itemR(md, "optimal_draw", text="Optimal Display")
+               flow.itemR(md, "subsurf_uv")
 
        def surface(self, layout, ob, md):
                layout.itemL(text="See Fields panel.")
@@ -381,7 +388,7 @@ class DATA_PT_modifiers(DataButtonsPanel):
        def uvproject(self, layout, ob, md):
                if ob.type == 'MESH':
                        layout.item_pointerR(md, "uv_layer", ob.data, "uv_layers")
-                       layout.itemR(md, "projectors")
+                       #layout.itemR(md, "projectors")
                        layout.itemR(md, "image")
                        layout.itemR(md, "horizontal_aspect_ratio")
                        layout.itemR(md, "vertical_aspect_ratio")
@@ -391,27 +398,27 @@ class DATA_PT_modifiers(DataButtonsPanel):
        def wave(self, layout, ob, md):
                split = layout.split()
                
-               sub = split.column()
-               sub.itemL(text="Motion:")
-               sub.itemR(md, "x")
-               sub.itemR(md, "y")
-               sub.itemR(md, "cyclic")
-               
-               sub = split.column()
-               sub.itemR(md, "normals")
-               row = sub.row(align=True)
-               row.active = md.normals
-               row.itemR(md, "x_normal", text="X", toggle=True)
-               row.itemR(md, "y_normal", text="Y", toggle=True)
-               row.itemR(md, "z_normal", text="Z", toggle=True)
-               
-               col = layout.column_flow()
-               col.itemR(md, "time_offset")
-               col.itemR(md, "lifetime")
-               col.itemR(md, "damping_time")
-               col.itemR(md, "falloff_radius")
-               col.itemR(md, "start_position_x")
-               col.itemR(md, "start_position_y")
+               col = split.column()
+               col.itemL(text="Motion:")
+               col.itemR(md, "x")
+               col.itemR(md, "y")
+               col.itemR(md, "cyclic")
+               
+               col = split.column()
+               col.itemR(md, "normals")
+               sub = col.row(align=True)
+               sub.active = md.normals
+               sub.itemR(md, "x_normal", text="X", toggle=True)
+               sub.itemR(md, "y_normal", text="Y", toggle=True)
+               sub.itemR(md, "z_normal", text="Z", toggle=True)
+               
+               flow = layout.column_flow()
+               flow.itemR(md, "time_offset")
+               flow.itemR(md, "lifetime")
+               flow.itemR(md, "damping_time")
+               flow.itemR(md, "falloff_radius")
+               flow.itemR(md, "start_position_x")
+               flow.itemR(md, "start_position_y")
                
                layout.itemR(md, "start_position_object")
                layout.item_pointerR(md, "vertex_group", ob, "vertex_groups")
@@ -422,10 +429,10 @@ class DATA_PT_modifiers(DataButtonsPanel):
                elif md.texture_coordinates == 'OBJECT':
                        layout.itemR(md, "texture_coordinates_object")
                
-               col = layout.column_flow()
-               col.itemR(md, "speed", slider=True)
-               col.itemR(md, "height", slider=True)
-               col.itemR(md, "width", slider=True)
-               col.itemR(md, "narrowness", slider=True)
+               flow = layout.column_flow()
+               flow.itemR(md, "speed", slider=True)
+               flow.itemR(md, "height", slider=True)
+               flow.itemR(md, "width", slider=True)
+               flow.itemR(md, "narrowness", slider=True)
 
 bpy.types.register(DATA_PT_modifiers)
index 9fabf25b11b11cf5e443f5f4cba3d0421cdad77e..757e61307dfe5aca725a21b4011e2865a7ccb106 100644 (file)
@@ -43,81 +43,82 @@ class DATA_PT_shape_text(DataButtonsPanel):
                                                        
                        split = layout.split()
                
-                       sub = split.column()
-                       sub.itemL(text="Caps:")
-                       sub.itemR(curve, "front")
-                       sub.itemR(curve, "back")
+                       col = split.column()
+                       col.itemL(text="Caps:")
+                       col.itemR(curve, "front")
+                       col.itemR(curve, "back")
+                       col.itemL(text="Textures:")
+                       col.itemR(curve, "uv_orco")
+                       col.itemR(curve, "auto_texspace")
                        
-                       sub.itemL(text="Textures:")
-                       sub.itemR(curve, "uv_orco")
-                       sub.itemR(curve, "auto_texspace")
-                       
-                       sub = split.column()    
-                       sub.itemL(text="Resolution:")
+                       col = split.column()    
+                       col.itemL(text="Resolution:")
+                       sub = col.column(align=True)
                        sub.itemR(curve, "resolution_u", text="Preview U")
-                       sub.itemR(curve, "resolution_v", text="Preview V")
                        sub.itemR(curve, "render_resolution_u", text="Render U")
+                       sub = col.column(align=True)
+                       sub.itemR(curve, "resolution_v", text="Preview V")
                        sub.itemR(curve, "render_resolution_v", text="Render V")
-
-                       sub.itemL(text="Display:")
-                       sub.itemR(curve, "fast")
+                       col.itemL(text="Display:")
+                       col.itemR(curve, "fast")
 
 class DATA_PT_geometry_text(DataButtonsPanel):
        __label__ = "Geometry"
 
        def draw(self, context):
                layout = self.layout
+               
                curve = context.curve
 
                split = layout.split()
        
-               sub = split.column()
-               sub.itemL(text="Modification:")
-               sub.itemR(curve, "width")
-               sub.itemR(curve, "extrude")
-               sub.itemR(curve, "taper_object")
+               col = split.column()
+               col.itemL(text="Modification:")
+               col.itemR(curve, "width")
+               col.itemR(curve, "extrude")
+               col.itemR(curve, "taper_object")
                
-               sub = split.column()
-               sub.itemL(text="Bevel:")
-               sub.itemR(curve, "bevel_depth", text="Depth")
-               sub.itemR(curve, "bevel_resolution", text="Resolution")
-               sub.itemR(curve, "bevel_object")
+               col = split.column()
+               col.itemL(text="Bevel:")
+               col.itemR(curve, "bevel_depth", text="Depth")
+               col.itemR(curve, "bevel_resolution", text="Resolution")
+               col.itemR(curve, "bevel_object")
 
 class DATA_PT_font(DataButtonsPanel):
        __label__ = "Font"
 
        def draw(self, context):
                layout = self.layout
+               
                text = context.curve
 
-               layout.row()
                layout.itemR(text, "font")
                
                split = layout.split()
                
-               sub = split.column()    
-       #       sub.itemR(text, "style")
-       #       sub.itemR(text, "bold")
-       #       sub.itemR(text, "italic")
-       #       sub.itemR(text, "underline")
+               col = split.column()    
+       #       col.itemR(text, "style")
+       #       col.itemR(text, "bold")
+       #       col.itemR(text, "italic")
+       #       col.itemR(text, "underline")
        #       ToDo: These settings are in a sub struct (Edit Format). 
-               sub.itemR(text, "text_size")            
-               sub.itemR(text, "shear")
-
-               sub = split.column()
-               sub.itemR(text, "text_on_curve")
-               sub.itemR(text, "family")
-               sub.itemL(text="Underline:")
-               sub.itemR(text, "ul_position", text="Position")
-               sub.itemR(text, "ul_height", text="Height")
+               col.itemR(text, "text_size")            
+               col.itemR(text, "shear")
 
-       #       sub.itemR(text, "edit_format")
+               col = split.column()
+               col.itemR(text, "text_on_curve")
+               col.itemR(text, "family")
+               col.itemL(text="Underline:")
+               col.itemR(text, "ul_position", text="Position")
+               col.itemR(text, "ul_height", text="Height")
+       #       col.itemR(text, "edit_format")
 
 class DATA_PT_paragraph(DataButtonsPanel):
        __label__ = "Paragraph"
 
        def draw(self, context):
                layout = self.layout
+               
                text = context.curve
 
                layout.itemL(text="Align:")
@@ -125,17 +126,17 @@ class DATA_PT_paragraph(DataButtonsPanel):
 
                split = layout.split()
                
-               sub = split.column()    
-               sub.itemL(text="Spacing:")
-               sub.itemR(text, "spacing", text="Character")
-               sub.itemR(text, "word_spacing", text="Word")
-               sub.itemR(text, "line_dist", text="Line")
-
-               sub = split.column()
-               sub.itemL(text="Offset:")
-               sub.itemR(text, "x_offset", text="X")
-               sub.itemR(text, "y_offset", text="Y")
-               #sub.itemR(text, "wrap")
+               col = split.column(align=True)  
+               col.itemL(text="Spacing:")
+               col.itemR(text, "spacing", text="Character")
+               col.itemR(text, "word_spacing", text="Word")
+               col.itemR(text, "line_dist", text="Line")
+
+               col = split.column(align=True)
+               col.itemL(text="Offset:")
+               col.itemR(text, "x_offset", text="X")
+               col.itemR(text, "y_offset", text="Y")
+               #col.itemR(text, "wrap")
 
 """            
 class DATA_PT_textboxes(DataButtonsPanel):
@@ -143,6 +144,7 @@ class DATA_PT_textboxes(DataButtonsPanel):
 
                def draw(self, context):
                        layout = self.layout
+                       
                        text = context.curve
 """
 
index b3dfc6a8dd6aa4f0746a6eebfbdba35a77fff80a..c89cc4ad63e41e0d282fc0fb3f14b399b6a0bdf4 100644 (file)
@@ -311,6 +311,11 @@ static void rna_CurveModifier_object_set(PointerRNA *ptr, PointerRNA value)
        modifier_object_set(&((CurveModifierData*)ptr->data)->object, OB_CURVE, value);
 }
 
+static void rna_CastModifier_object_set(PointerRNA *ptr, PointerRNA value)
+{
+       modifier_object_set(&((CastModifierData*)ptr->data)->object, OB_MESH, value);
+}
+
 static void rna_ArmatureModifier_object_set(PointerRNA *ptr, PointerRNA value)
 {
        modifier_object_set(&((ArmatureModifierData*)ptr->data)->object, OB_ARMATURE, value);
@@ -1203,6 +1208,12 @@ static void rna_def_modifier_cast(BlenderRNA *brna)
        RNA_def_property_enum_items(prop, prop_cast_type_items);
        RNA_def_property_ui_text(prop, "Cast Type", "");
        RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_Modifier_update");
+       
+       prop= RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE);
+       RNA_def_property_ui_text(prop, "Object", "Control object: if available, its location determines the center of the effect");
+       RNA_def_property_pointer_funcs(prop, NULL, "rna_CastModifier_object_set", NULL);
+       RNA_def_property_flag(prop, PROP_EDITABLE);
+       RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_Modifier_dependency_update");
 
        prop= RNA_def_property(srna, "x", PROP_BOOLEAN, PROP_NONE);
        RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_CAST_X);
@@ -1219,6 +1230,16 @@ static void rna_def_modifier_cast(BlenderRNA *brna)
        RNA_def_property_ui_text(prop, "Z", "");
        RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_Modifier_update");
        
+       prop= RNA_def_property(srna, "from_radius", PROP_BOOLEAN, PROP_NONE);
+       RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_CAST_SIZE_FROM_RADIUS);
+       RNA_def_property_ui_text(prop, "From Radius", "Use radius as size of projection shape (0 = auto)");
+       RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_Modifier_update");
+       
+       prop= RNA_def_property(srna, "use_transform", PROP_BOOLEAN, PROP_NONE);
+       RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_CAST_USE_OB_TRANSFORM);
+       RNA_def_property_ui_text(prop, "Use transform", "Use object transform to control projection shape");
+       RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_Modifier_update");
+       
        prop= RNA_def_property(srna, "factor", PROP_FLOAT, PROP_NONE);
        RNA_def_property_float_sdna(prop, NULL, "fac");
        RNA_def_property_range(prop, -FLT_MAX, FLT_MAX);