UI:
authorBrecht Van Lommel <brechtvanlommel@pandora.be>
Mon, 27 Apr 2009 18:05:58 +0000 (18:05 +0000)
committerBrecht Van Lommel <brechtvanlommel@pandora.be>
Mon, 27 Apr 2009 18:05:58 +0000 (18:05 +0000)
* Made separator item work horizontal & vertical.
* Add colon (:) automatic for int/float/enum/string.
* Added space variables to uiStyle and use them in the
  layout engine.

* Added initial World buttons by Thomas Dinges, thanks!
* Added some code for modifiers in the Object Data context.
  This will become a template though.
* Use a common poll() callback in the scripts to reduce code.

26 files changed:
release/ui/buttons_data.py [new file with mode: 0644]
release/ui/buttons_objects.py
release/ui/buttons_scene.py
release/ui/buttons_world.py [new file with mode: 0644]
source/blender/editors/armature/poselib.c
source/blender/editors/include/UI_interface.h
source/blender/editors/interface/interface.c
source/blender/editors/interface/interface_api.c
source/blender/editors/interface/interface_handlers.c
source/blender/editors/interface/interface_layout.c
source/blender/editors/interface/interface_regions.c
source/blender/editors/interface/interface_style.c
source/blender/editors/interface/interface_utils.c
source/blender/editors/object/object_edit.c
source/blender/editors/object/object_intern.h
source/blender/editors/object/object_modifier.c [new file with mode: 0644]
source/blender/editors/object/object_ops.c
source/blender/editors/screen/screen_ops.c
source/blender/editors/space_image/image_header.c
source/blender/editors/space_sequencer/sequencer_header.c
source/blender/editors/space_text/text_header.c
source/blender/editors/space_view3d/view3d_header.c
source/blender/makesdna/DNA_userdef_types.h
source/blender/makesrna/RNA_enum_types.h
source/blender/makesrna/intern/rna_modifier.c
source/blender/makesrna/intern/rna_scene.c

diff --git a/release/ui/buttons_data.py b/release/ui/buttons_data.py
new file mode 100644 (file)
index 0000000..b141b3f
--- /dev/null
@@ -0,0 +1,56 @@
+
+import bpy
+
+class DataButtonsPanel(bpy.types.Panel):
+       __space_type__ = "BUTTONS_WINDOW"
+       __region_type__ = "WINDOW"
+       __context__ = "data"
+
+class DATA_PT_modifiers(DataButtonsPanel):
+       __idname__ = "DATA_PT_modifiers"
+       __label__ = "Modifiers"
+
+       def draw(self, context):
+               ob = context.active_object
+               layout = self.layout
+
+               if not ob:
+                       return
+
+               layout.row()
+               layout.item_menu_enumO("OBJECT_OT_modifier_add", "type")
+
+               for md in ob.modifiers:
+                       sub = layout.box()
+
+                       sub.row()
+                       sub.itemR(md, "expanded", text="")
+                       sub.itemR(md, "name", text="")
+
+                       sub.itemR(md, "render", text="")
+                       sub.itemR(md, "realtime", text="")
+                       sub.itemR(md, "editmode", text="")
+                       sub.itemR(md, "on_cage", text="")
+
+                       if md.expanded:
+                               sub.row()
+                               sub.itemS()
+
+                               if md.type == "ARMATURE":
+                                       self.armature(sub, md)
+
+       def armature(self, layout, md):
+               layout.column()
+               layout.itemR(md, "object")
+               layout.row()
+               layout.itemR(md, "vertex_group")
+               layout.itemR(md, "invert")
+               layout.column_flow()
+               layout.itemR(md, "use_vertex_groups")
+               layout.itemR(md, "use_bone_envelopes")
+               layout.itemR(md, "quaternion")
+               layout.itemR(md, "b_bone_rest")
+               layout.itemR(md, "multi_modifier")
+
+bpy.types.register(DATA_PT_modifiers)
+
index f971d167f7f83aca6825049189b4495a7c719a74..8e76bf5083732d6631b51601deddf6fe7cbac7e0 100644 (file)
@@ -6,6 +6,9 @@ class ObjectButtonsPanel(bpy.types.Panel):
        __region_type__ = "WINDOW"
        __context__ = "object"
 
+       def poll(self, context):
+               return (context.active_object != None)
+
 class OBJECT_PT_transform(ObjectButtonsPanel):
        __idname__ = "OBJECT_PT_transform"
        __label__ = "Transform"
@@ -14,9 +17,6 @@ class OBJECT_PT_transform(ObjectButtonsPanel):
                ob = context.active_object
                layout = self.layout
 
-               if not ob:
-                       return
-
                layout.row()
                layout.itemR(ob, "location")
                layout.itemR(ob, "rotation")
@@ -30,9 +30,6 @@ class OBJECT_PT_groups(ObjectButtonsPanel):
                ob = context.active_object
                layout = self.layout
 
-               if not ob:
-                       return
-
                layout.row()
                layout.itemR(ob, "pass_index")
                layout.itemR(ob, "parent")
@@ -59,13 +56,7 @@ class OBJECT_PT_display(ObjectButtonsPanel):
        def draw(self, context):
                ob = context.active_object
                layout = self.layout
-
-               if not ob:
-                       return
                        
-               layout.row()
-               layout.itemR(ob, "type", text="Object Type")
-
                layout.row()
                layout.itemR(ob, "max_draw_type", text="Type")
                layout.itemR(ob, "draw_bounds_type", text="Bounds")
@@ -86,18 +77,15 @@ class OBJECT_PT_duplication(ObjectButtonsPanel):
                ob = context.active_object
                layout = self.layout
 
-               if not ob:
-                       return
-
                layout.column()
                layout.itemR(ob, "dupli_type", text="", expand=True)
 
                if ob.dupli_type == "FRAMES":
                        layout.column_flow()
-                       layout.itemR(ob, "dupli_frames_start", text="Start:")
-                       layout.itemR(ob, "dupli_frames_end", text="End:")
-                       layout.itemR(ob, "dupli_frames_on", text="On:")
-                       layout.itemR(ob, "dupli_frames_off", text="Off:")
+                       layout.itemR(ob, "dupli_frames_start", text="Start")
+                       layout.itemR(ob, "dupli_frames_end", text="End")
+                       layout.itemR(ob, "dupli_frames_on", text="On")
+                       layout.itemR(ob, "dupli_frames_off", text="Off")
 
 class OBJECT_PT_animation(ObjectButtonsPanel):
        __idname__ = "OBJECT_PT_animation"
@@ -107,9 +95,6 @@ class OBJECT_PT_animation(ObjectButtonsPanel):
                ob = context.active_object
                layout = self.layout
 
-               if not ob:
-                       return
-
                layout.split(number=2)
                
                sub = layout.sub(0)
@@ -119,7 +104,7 @@ class OBJECT_PT_animation(ObjectButtonsPanel):
                sub.itemR(ob, "time_offset_particle", text="Particle")
                sub.itemR(ob, "time_offset_parent", text="Parent")
                sub.itemR(ob, "slow_parent")
-               sub.itemR(ob, "time_offset", text="Offset:")
+               sub.itemR(ob, "time_offset", text="Offset")
                
                sub = layout.sub(1)
                sub.column()
index 89945c1e5318cd8e56ee0350c3fe26947bc5834f..fa9969870433e4b2b8b2b4063487677cd31eea04 100644 (file)
@@ -13,9 +13,6 @@ class RENDER_PT_shading(RenderButtonsPanel):
                scene = context.scene
                layout = self.layout
 
-               if not scene:
-                       return
-
                rd = scene.render_data
 
                layout.column_flow()
@@ -40,9 +37,6 @@ class RENDER_PT_image(RenderButtonsPanel):
                scene = context.scene
                layout = self.layout
 
-               if not scene:
-                       return
-
                rd = scene.render_data
 
                layout.column_flow()
@@ -70,9 +64,6 @@ class RENDER_PT_antialiasing(RenderButtonsPanel):
                scene = context.scene
                layout = self.layout
 
-               if not scene:
-                       return
-
                rd = scene.render_data
 
                layout.row()
@@ -95,9 +86,6 @@ class RENDER_PT_render(RenderButtonsPanel):
                scene = context.scene
                layout = self.layout
 
-               if not scene:
-                       return
-
                rd = scene.render_data
 
                layout.row()
diff --git a/release/ui/buttons_world.py b/release/ui/buttons_world.py
new file mode 100644 (file)
index 0000000..699f7c3
--- /dev/null
@@ -0,0 +1,130 @@
+
+import bpy
+
+class WorldButtonsPanel(bpy.types.Panel):
+       __space_type__ = "BUTTONS_WINDOW"
+       __region_type__ = "WINDOW"
+       __context__ = "world"
+
+       def poll(self, context):
+               return (context.scene.world != None)
+       
+class WORLD_PT_world(WorldButtonsPanel):
+       __label__ = "World"
+
+       def draw(self, context):
+               world = context.scene.world
+               layout = self.layout
+               
+               layout.row()
+               layout.itemR(world, "blend_sky")
+               layout.itemR(world, "paper_sky")
+               layout.itemR(world, "real_sky")
+               
+               layout.row()
+               layout.itemR(world, "horizon_color")
+               layout.itemR(world, "zenith_color")
+               layout.itemR(world, "ambient_color")
+               
+class WORLD_PT_color_correction(WorldButtonsPanel):
+       __label__ = "Color Correction"
+
+       def draw(self, context):
+               world = context.scene.world
+               layout = self.layout
+
+               layout.row()
+               layout.itemR(world, "exposure")
+               layout.itemR(world, "range")
+       
+class WORLD_PT_mist(WorldButtonsPanel):
+       __label__ = "Mist"
+
+       def draw(self, context):
+               world = context.scene.world
+               layout = self.layout
+
+               layout.row()
+               layout.itemR(world.mist, "enabled", text="Enable")
+               layout.itemR(world.mist, "falloff")
+       
+               layout.column_flow()
+               layout.itemR(world.mist, "start")
+               layout.itemR(world.mist, "depth")
+               layout.itemR(world.mist, "height")
+               layout.itemR(world.mist, "intensity")
+               
+class WORLD_PT_stars(WorldButtonsPanel):
+       __label__ = "Stars"
+
+       def draw(self, context):
+               world = context.scene.world
+               layout = self.layout
+
+               layout.row()
+               layout.itemR(world.stars, "enabled", text="Enable")
+
+               layout.column_flow()
+               layout.itemR(world.stars, "size")
+               layout.itemR(world.stars, "min_distance", text="MinDist")
+               layout.itemR(world.stars, "average_separation", text="StarDist")
+               layout.itemR(world.stars, "color_randomization", text="Colnoise")
+               
+class WORLD_PT_ambient_occlusion(WorldButtonsPanel):
+       __label__ = "Ambient Occlusion"
+
+       def draw(self, context):
+               world = context.scene.world
+               layout = self.layout
+
+               ao = world.ambient_occlusion
+               
+               layout.row()
+               layout.itemR(ao, "enabled", text="Enable")
+
+               layout.row()
+               layout.itemR(ao, "gather_method", expand=True)
+               
+               if ao.gather_method == 'RAYTRACE':
+                       layout.row()
+                       layout.itemR(ao, "samples")
+                       layout.itemR(ao, "distance")
+                       
+                       layout.row()
+                       layout.itemR(ao, "sample_method")
+                       if ao.sample_method == 'ADAPTIVE_QMC':
+                               layout.row()
+                               layout.itemR(ao, "threshold")
+                               layout.itemR(ao, "adapt_to_speed")
+                               
+                       if ao.sample_method == 'CONSTANT_JITTERED':
+                               layout.row()
+                               layout.itemR(ao, "bias")
+                                               
+               if ao.gather_method == 'APPROXIMATE':
+                       layout.row()
+                       layout.itemR(ao, "passes")
+                       layout.itemR(ao, "error_tolerance")
+                       
+                       layout.row()
+                       layout.itemR(ao, "correction")
+                       layout.itemR(ao, "pixel_cache")
+
+               layout.row()
+               layout.itemS()
+                       
+               layout.row()
+               layout.itemR(ao, "falloff")     
+               layout.itemR(ao, "strength")
+               
+               layout.column()
+               layout.itemR(ao, "blend_mode", expand=True)
+               layout.itemR(ao, "color", expand=True)
+               layout.itemR(ao, "energy")
+       
+bpy.types.register(WORLD_PT_world)
+bpy.types.register(WORLD_PT_mist)
+bpy.types.register(WORLD_PT_stars)
+bpy.types.register(WORLD_PT_ambient_occlusion)
+bpy.types.register(WORLD_PT_color_correction)
+
index 9b4a9d63439c7ddd80b62274bd01d5077b910dfa..43590346299ee3e4f20aa4054dbeaa365ddfe6fd 100644 (file)
@@ -339,7 +339,7 @@ static int poselib_add_menu_invoke (bContext *C, wmOperator *op, wmEvent *evt)
                uiItemIntO(layout, "Add New (Current Frame)", 0, "POSELIB_OT_pose_add", "frame", CFRA);
                
                /* replace existing - submenu */
-               uiItemLevel(layout, "Replace Existing...", 0, poselib_add_menu_invoke__replacemenu);
+               uiItemMenuF(layout, "Replace Existing...", 0, poselib_add_menu_invoke__replacemenu);
        }
        
        uiPupMenuEnd(C, pup);
index ea1a8efe9fc3f57c7a524dfc43dde8d925e41e33..26042f70b4af6ef9a92df9e92f87c44f2eeda8d2 100644 (file)
@@ -48,6 +48,7 @@ struct PointerRNA;
 struct PropertyRNA;
 struct ReportList;
 struct rcti;
+struct uiStyle;
 struct uiFontStyle;
 
 typedef struct uiBut uiBut;
@@ -532,7 +533,7 @@ uiBut *uiDefMenuTogR(uiBlock *block, struct PointerRNA *ptr, char *propname, cha
 #define UI_LAYOUT_HEADER               1
 #define UI_LAYOUT_MENU                 2
 
-uiLayout *uiLayoutBegin(int dir, int type, int x, int y, int size, int em);
+uiLayout *uiLayoutBegin(int dir, int type, int x, int y, int size, int em, struct uiStyle *style);
 void uiLayoutEnd(const struct bContext *C, uiBlock *block, uiLayout *layout, int *x, int *y);
 
 void uiLayoutContext(uiLayout *layout, int opcontext);
@@ -571,9 +572,9 @@ void uiItemM(uiLayout *layout, char *name, int icon, char *menuname); /* menu */
 void uiItemV(uiLayout *layout, char *name, int icon, int argval); /* value */
 void uiItemS(uiLayout *layout); /* separator */
 
-void uiItemLevel(uiLayout *layout, char *name, int icon, uiMenuCreateFunc func);
-void uiItemLevelEnumO(uiLayout *layout, char *name, int icon, char *opname, char *propname);
-void uiItemLevelEnumR(uiLayout *layout, char *name, int icon, struct PointerRNA *ptr, char *propname);
+void uiItemMenuF(uiLayout *layout, char *name, int icon, uiMenuCreateFunc func);
+void uiItemMenuEnumO(uiLayout *layout, char *name, int icon, char *opname, char *propname);
+void uiItemMenuEnumR(uiLayout *layout, char *name, int icon, struct PointerRNA *ptr, char *propname);
 
 /* utilities */
 #define UI_PANEL_WIDTH                 340
index 22ecd8ee2f8b0ddc68444f852046576fbec2945f..fa25153a1581052feb0ee9c207860e6c1a895a11 100644 (file)
@@ -444,7 +444,7 @@ static int ui_but_equals_old(uiBut *but, uiBut *oldbut)
        if(but->funcN != oldbut->funcN) return 0;
        if(oldbut->func_arg1 != oldbut && but->func_arg1 != oldbut->func_arg1) return 0;
        if(oldbut->func_arg2 != oldbut && but->func_arg2 != oldbut->func_arg2) return 0;
-       if(!but->funcN && (but->poin != oldbut->poin || but->pointype != oldbut->pointype)) return 0;
+       if(!but->funcN && ((but->poin != oldbut->poin && (uiBut*)oldbut->poin != oldbut) || but->pointype != oldbut->pointype)) return 0;
 
        return 1;
 }
index 3153f13bd0bcb5424d02e523c2c24ca6ff655119..1cd804851b5468e4381b76c7fd0fabb8a8fab5c1 100644 (file)
@@ -92,7 +92,7 @@ void RNA_api_ui_layout(StructRNA *srna)
        parm= RNA_def_string(func, "property", "", 0, "", "Identifier of property in data.");
        RNA_def_property_flag(parm, PROP_REQUIRED);
 
-       func= RNA_def_function(srna, "item_level_enumR", "uiItemLevelEnumR");
+       func= RNA_def_function(srna, "item_menu_enumR", "uiItemMenuEnumR");
        api_ui_item_common(func);
        parm= RNA_def_pointer(func, "data", "AnyType", "", "Data from which to take property.");
        RNA_def_property_flag(parm, PROP_REQUIRED);
@@ -124,7 +124,7 @@ void RNA_api_ui_layout(StructRNA *srna)
        parm= RNA_def_string(func, "property", "", 0, "", "Identifier of property in operator.");
        RNA_def_property_flag(parm, PROP_REQUIRED);
 
-       func= RNA_def_function(srna, "item_level_enumO", "uiItemLevelEnumO");
+       func= RNA_def_function(srna, "item_menu_enumO", "uiItemMenuEnumO");
        api_ui_item_op_common(func);
        parm= RNA_def_string(func, "property", "", 0, "", "Identifier of property in operator.");
        RNA_def_property_flag(parm, PROP_REQUIRED);
index 924d7df8c459e56cf25b4b0dc57d40acaa893385..5aa2cded642159b6e05a5e08e55ebad5a8de2aac 100644 (file)
@@ -2833,11 +2833,11 @@ static uiBut *ui_but_find_mouse_over(ARegion *ar, int x, int y)
                ui_window_to_block(ar, block, &mx, &my);
 
                for(but=block->buttons.first; but; but= but->next) {
-                       /* give precedence to already activated buttons */
                        if(but->flag & UI_NO_HILITE)
                                continue;
 
                        if(ui_but_contains_pt(but, mx, my))
+                               /* give precedence to already activated buttons */
                                if(!butover || (!butover->active && but->active))
                                        butover= but;
                }
index f9e08d2937047969ad90370a46bbc25934713b58..6ed02a38ca1bbae1f2c9c85caa35457c8d4d1687 100644 (file)
@@ -9,6 +9,7 @@
 #include "DNA_ID.h"
 #include "DNA_scene_types.h"
 #include "DNA_screen_types.h"
+#include "DNA_userdef_types.h"
 #include "DNA_windowmanager_types.h"
 
 #include "BLI_listbase.h"
@@ -45,6 +46,8 @@
 
 #define EM_UNIT_X              XIC
 #define EM_UNIT_Y              YIC
+
+#define EM_SEPR_X              6
 #define EM_SEPR_Y              6
 
 /* Item */
@@ -165,14 +168,10 @@ struct uiLayout {
        int x, y, w, h;
        int emw, emh;
 
-       int column_space;
-       int template_space;
-       int box_space;
-       int button_space_x;
-       int button_space_y;
-
        uiMenuHandleFunc handlefunc;
        void *argv;
+
+       uiStyle *style;
 };
 
 void ui_layout_free(uiLayout *layout);
@@ -187,6 +186,15 @@ static void ui_item_name(uiItem *item, char *name)
                item->name= item->namestr;
        }
 }
+static void ui_item_name_add_colon(uiItem *item)
+{
+       int len= strlen(item->namestr);
+
+       if(len != 0 && len+1 < sizeof(item->namestr)) {
+               item->namestr[len]= ':';
+               item->namestr[len+1]= '\0';
+       }
+}
 
 #define UI_FIT_EXPAND 1
 
@@ -215,6 +223,7 @@ static int ui_item_fit(int item, int pos, int all, int available, int spacing, i
 /* create buttons for an item with an RNA array */
 static void ui_item_array(uiLayout *layout, uiBlock *block, uiItemRNA *rnaitem, int len, int x, int y, int w, int h)
 {
+       uiStyle *style= layout->style;
        PropertyType type;
        PropertySubType subtype;
        int a;
@@ -234,7 +243,7 @@ static void ui_item_array(uiLayout *layout, uiBlock *block, uiItemRNA *rnaitem,
                /* special check for layer layout */
                int butw, buth;
 
-               butw= ui_item_fit(EM_UNIT_X, 0, EM_UNIT_X*10 + layout->button_space_x, w, 0, 0, UI_FIT_EXPAND);
+               butw= ui_item_fit(EM_UNIT_X, 0, EM_UNIT_X*10 + style->buttonspacex, w, 0, 0, UI_FIT_EXPAND);
                buth= MIN2(EM_UNIT_Y, butw);
 
                y += 2*(EM_UNIT_Y - buth);
@@ -246,7 +255,7 @@ static void ui_item_array(uiLayout *layout, uiBlock *block, uiItemRNA *rnaitem,
                        uiDefAutoButR(block, &rnaitem->ptr, rnaitem->prop, a+10, "", ICON_BLANK1, x + butw*a, y, butw, buth);
                uiBlockEndAlign(block);
 
-               x += 5*butw + layout->button_space_x;
+               x += 5*butw + style->buttonspacex;
 
                uiBlockBeginAlign(block);
                for(a=0; a<5; a++)
@@ -507,8 +516,14 @@ static void ui_item_size(uiItem *item, int *r_w, int *r_h, int flag)
        }
        else {
                /* other */
-               w= ui_text_icon_width(item->name, item->icon, flag & UI_ITEM_VARY_X);
-               h= (item->type == ITEM_SEPARATOR)? EM_SEPR_Y: EM_UNIT_Y;
+               if(item->type == ITEM_SEPARATOR) {
+                       w= EM_SEPR_X;
+                       h= EM_SEPR_Y;
+               }
+               else {
+                       w= ui_text_icon_width(item->name, item->icon, flag & UI_ITEM_VARY_X);
+                       h= EM_UNIT_Y;
+               }
        }
 
        if(r_w) *r_w= w;
@@ -860,7 +875,7 @@ void uiItemS(uiLayout *layout)
 }
 
 /* level items */
-void uiItemLevel(uiLayout *layout, char *name, int icon, uiMenuCreateFunc func)
+void uiItemMenuF(uiLayout *layout, char *name, int icon, uiMenuCreateFunc func)
 {
        uiTemplate *template= layout->templates.last;
        uiItemMenu *menuitem;
@@ -872,7 +887,7 @@ void uiItemLevel(uiLayout *layout, char *name, int icon, uiMenuCreateFunc func)
 
        menuitem= MEM_callocN(sizeof(uiItemMenu), "uiItemMenu");
 
-       if(!icon)
+       if(!icon && layout->type == UI_LAYOUT_MENU)
                icon= ICON_RIGHTARROW_THIN,
 
        ui_item_name(&menuitem->item, name);
@@ -896,11 +911,11 @@ static void menu_item_enum_opname_menu(bContext *C, uiLayout *layout, void *arg)
 {
        MenuItemLevel *lvl= (MenuItemLevel*)(((uiBut*)arg)->func_argN);
 
-       uiLayoutContext(layout, lvl->opcontext);
+       uiLayoutContext(layout, WM_OP_EXEC_REGION_WIN);
        uiItemsEnumO(layout, lvl->opname, lvl->propname);
 }
 
-void uiItemLevelEnumO(uiLayout *layout, char *name, int icon, char *opname, char *propname)
+void uiItemMenuEnumO(uiLayout *layout, char *name, int icon, char *opname, char *propname)
 {
        wmOperatorType *ot= WM_operatortype_find(opname);
        uiTemplate *template= layout->templates.last;
@@ -916,7 +931,7 @@ void uiItemLevelEnumO(uiLayout *layout, char *name, int icon, char *opname, char
 
        menuitem= MEM_callocN(sizeof(uiItemMenu), "uiItemMenu");
 
-       if(!icon)
+       if(!icon && layout->type == UI_LAYOUT_MENU)
                icon= ICON_RIGHTARROW_THIN;
        if(!name)
                name= ot->name;
@@ -945,7 +960,7 @@ static void menu_item_enum_rna_menu(bContext *C, uiLayout *layout, void *arg)
        uiItemsEnumR(layout, &lvl->rnapoin, lvl->propname);
 }
 
-void uiItemLevelEnumR(uiLayout *layout, char *name, int icon, struct PointerRNA *ptr, char *propname)
+void uiItemMenuEnumR(uiLayout *layout, char *name, int icon, struct PointerRNA *ptr, char *propname)
 {
        uiTemplate *template= layout->templates.last;
        uiItemMenu *menuitem;
@@ -963,7 +978,7 @@ void uiItemLevelEnumR(uiLayout *layout, char *name, int icon, struct PointerRNA
 
        menuitem= MEM_callocN(sizeof(uiItemMenu), "uiItemMenu");
 
-       if(!icon)
+       if(!icon && layout->type == UI_LAYOUT_MENU)
                icon= ICON_RIGHTARROW_THIN;
        if(!name)
                name= (char*)RNA_property_ui_name(prop);
@@ -989,6 +1004,7 @@ void uiItemLevelEnumR(uiLayout *layout, char *name, int icon, struct PointerRNA
 /* single row layout */
 static void ui_layout_row(uiLayout *layout, uiBlock *block, uiTemplate *template)
 {
+       uiStyle *style= layout->style;
        uiItem *item;
        int tot=0, totw= 0, maxh= 0, itemw, itemh, x, w;
 
@@ -1009,10 +1025,10 @@ static void ui_layout_row(uiLayout *layout, uiBlock *block, uiTemplate *template
 
        for(item=template->items.first; item; item=item->next) {
                ui_item_size(item, &itemw, &itemh, UI_ITEM_VARY_Y);
-               itemw= ui_item_fit(itemw, x, totw, w, (tot-1)*layout->button_space_x, !item->next, UI_FIT_EXPAND);
+               itemw= ui_item_fit(itemw, x, totw, w, (tot-1)*style->buttonspacex, !item->next, UI_FIT_EXPAND);
 
                ui_item_buts(layout, block, item, layout->x+x, layout->y-itemh, itemw, itemh);
-               x += itemw+layout->button_space_x;
+               x += itemw+style->buttonspacex;
        }
 
        layout->y -= maxh;
@@ -1021,6 +1037,7 @@ static void ui_layout_row(uiLayout *layout, uiBlock *block, uiTemplate *template
 /* multi-column layout */
 static void ui_layout_column(uiLayout *layout, uiBlock *block, uiTemplate *template)
 {
+       uiStyle *style= layout->style;
        uiItem *item;
        int col, totcol= 0, x, y, miny, itemw, itemh, w;
 
@@ -1039,7 +1056,7 @@ static void ui_layout_column(uiLayout *layout, uiBlock *block, uiTemplate *templ
        for(col=0; col<totcol; col++) {
                y= 0;
 
-               itemw= ui_item_fit(1, x, totcol, w, (totcol-1)*layout->column_space, col == totcol-1, UI_FIT_EXPAND);
+               itemw= ui_item_fit(1, x, totcol, w, (totcol-1)*style->columnspace, col == totcol-1, UI_FIT_EXPAND);
 
                for(item=template->items.first; item; item=item->next) {
                        if(item->slot != col)
@@ -1049,10 +1066,10 @@ static void ui_layout_column(uiLayout *layout, uiBlock *block, uiTemplate *templ
 
                        y -= itemh;
                        ui_item_buts(layout, block, item, layout->x+x, layout->y+y, itemw, itemh);
-                       y -= layout->button_space_y;
+                       y -= style->buttonspacey;
                }
 
-               x += itemw + layout->column_space;
+               x += itemw + style->columnspace;
                miny= MIN2(miny, y);
        }
 
@@ -1062,6 +1079,7 @@ static void ui_layout_column(uiLayout *layout, uiBlock *block, uiTemplate *templ
 /* multi-column layout, automatically flowing to the next */
 static void ui_layout_column_flow(uiLayout *layout, uiBlock *block, uiTemplate *template)
 {
+       uiStyle *style= layout->style;
        uiTemplateFlow *flow= (uiTemplateFlow*)template;
        uiItem *item;
        int col, x, y, w, emh, emy, miny, itemw, itemh, maxw=0;
@@ -1101,17 +1119,17 @@ static void ui_layout_column_flow(uiLayout *layout, uiBlock *block, uiTemplate *
        col= 0;
        for(item=template->items.first; item; item=item->next) {
                ui_item_size(item, NULL, &itemh, UI_ITEM_VARY_Y);
-               itemw= ui_item_fit(1, x, totcol, w, (totcol-1)*layout->column_space, col == totcol-1, UI_FIT_EXPAND);
+               itemw= ui_item_fit(1, x, totcol, w, (totcol-1)*style->columnspace, col == totcol-1, UI_FIT_EXPAND);
        
                y -= itemh;
                emy -= itemh;
                ui_item_buts(layout, block, item, layout->x+x, layout->y+y, itemw, itemh);
-               y -= layout->button_space_y;
+               y -= style->buttonspacey;
                miny= MIN2(miny, y);
 
                /* decide to go to next one */
                if(col < totcol-1 && emy <= -emh) {
-                       x += itemw + layout->column_space;
+                       x += itemw + style->columnspace;
                        y= 0;
                        col++;
                }
@@ -1141,7 +1159,7 @@ static void ui_layout_split(uiLayout *layout, uiBlock *block, uiTemplate *templa
        /* create buttons starting from left and right */
        lx= 0;
        rx= 0;
-       w= layout->w - layout->button_space_x*(tot-1) + layout->button_space_x;
+       w= layout->w - style->buttonspacex*(tot-1) + style->buttonspacex;
 
        for(item=template->items.first; item; item=item->next) {
                ui_item_size(item, &itemw, &itemh, UI_ITEM_VARY_Y);
@@ -1149,11 +1167,11 @@ static void ui_layout_split(uiLayout *layout, uiBlock *block, uiTemplate *templa
                if(item->slot == UI_TSLOT_LR_LEFT) {
                        itemw= ui_item_fit(itemw, lx, totw, w, 0, 0);
                        ui_item_buts(layout, block, item, layout->x+lx, layout->y-itemh, itemw, itemh);
-                       lx += itemw + layout->button_space_x;
+                       lx += itemw + style->buttonspacex;
                }
                else {
                        itemw= ui_item_fit(itemw, totw + rx, totw, w, 0, 0);
-                       rx -= itemw + layout->button_space_x;
+                       rx -= itemw + style->buttonspacex;
                        ui_item_buts(layout, block, item, layout->x+layout->w+rx, layout->y-itemh, itemw, itemh);
                }
        }
@@ -1165,6 +1183,7 @@ static void ui_layout_split(uiLayout *layout, uiBlock *block, uiTemplate *templa
 /* split in columns */
 static void ui_layout_split(const bContext *C, uiLayout *layout, uiBlock *block, uiTemplate *template)
 {
+       uiStyle *style= layout->style;
        uiTemplateSplt *split= (uiTemplateSplt*)template;
        uiLayout *sublayout;
        int a, x, y, miny, w= layout->w, h= layout->h, splitw;
@@ -1176,7 +1195,7 @@ static void ui_layout_split(const bContext *C, uiLayout *layout, uiBlock *block,
        for(a=0; a<split->number; a++) {
                sublayout= split->sublayout[a];
 
-               splitw= ui_item_fit(1, x, split->number, w, (split->number-1)*layout->column_space, a == split->number-1, UI_FIT_EXPAND);
+               splitw= ui_item_fit(1, x, split->number, w, (split->number-1)*style->columnspace, a == split->number-1, UI_FIT_EXPAND);
                sublayout->x= layout->x + x;
                sublayout->w= splitw;
                sublayout->y= layout->y;
@@ -1189,7 +1208,7 @@ static void ui_layout_split(const bContext *C, uiLayout *layout, uiBlock *block,
                ui_layout_end(C, block, sublayout, NULL, &y);
                miny= MIN2(y, miny);
 
-               x += splitw + layout->column_space;
+               x += splitw + style->columnspace;
        }
 
        layout->y= miny;
@@ -1198,6 +1217,7 @@ static void ui_layout_split(const bContext *C, uiLayout *layout, uiBlock *block,
 /* element in a box layout */
 static void ui_layout_box(const bContext *C, uiLayout *layout, uiBlock *block, uiTemplate *template)
 {
+       uiStyle *style= layout->style;
        uiTemplateBx *box= (uiTemplateBx*)template;
        int starty, startx, w= layout->w, h= layout->h;
 
@@ -1205,9 +1225,9 @@ static void ui_layout_box(const bContext *C, uiLayout *layout, uiBlock *block, u
        starty= layout->y;
 
        /* some extra padding */
-       box->sublayout->x= layout->x + layout->box_space;
-       box->sublayout->w= w - 2*layout->box_space;
-       box->sublayout->y= layout->y - layout->box_space;
+       box->sublayout->x= layout->x + style->boxspace;
+       box->sublayout->w= w - 2*style->boxspace;
+       box->sublayout->y= layout->y - style->boxspace;
        box->sublayout->h= h;
 
        box->sublayout->emw= layout->emw;
@@ -1433,7 +1453,7 @@ uiLayout *uiLayoutBox(uiLayout *layout)
 
        box= MEM_callocN(sizeof(uiTemplateBx), "uiTemplateBx");
        box->template.type= TEMPLATE_BOX;
-       box->sublayout= uiLayoutBegin(layout->dir, layout->type, 0, 0, 0, 0);
+       box->sublayout= uiLayoutBegin(layout->dir, layout->type, 0, 0, 0, 0, layout->style);
        BLI_addtail(&layout->templates, box);
 
        return box->sublayout;
@@ -1451,7 +1471,7 @@ void uiLayoutSplit(uiLayout *layout, int number, int lr)
        split->sublayout= MEM_callocN(sizeof(uiLayout*)*number, "uiTemplateSpltSub");
 
        for(a=0; a<number; a++)
-               split->sublayout[a]= uiLayoutBegin(layout->dir, layout->type, 0, 0, 0, 0);
+               split->sublayout[a]= uiLayoutBegin(layout->dir, layout->type, 0, 0, 0, 0, layout->style);
 
        BLI_addtail(&layout->templates, split);
 }
@@ -1563,7 +1583,12 @@ static void ui_layout_init_items(const bContext *C, uiLayout *layout)
                        }
                        else if(item->type == ITEM_RNA_PROPERTY) {
                                rnaitem= (uiItemRNA*)item;
+                               type= RNA_property_type(rnaitem->prop);
+
                                ui_item_name(item, (char*)RNA_property_ui_name(rnaitem->prop));
+
+                               if(ELEM4(type, PROP_INT, PROP_FLOAT, PROP_STRING, PROP_ENUM))
+                                       ui_item_name_add_colon(item);
                        }
                        else if(item->type == ITEM_OPERATOR) {
                                opitem= (uiItemOp*)item;
@@ -1593,6 +1618,7 @@ static void ui_layout_init_items(const bContext *C, uiLayout *layout)
 
 static void ui_layout_templates(const bContext *C, uiBlock *block, uiLayout *layout)
 {
+       uiStyle *style= layout->style;
        uiTemplate *template;
 
        ui_layout_init_items(C, layout);
@@ -1611,7 +1637,7 @@ static void ui_layout_templates(const bContext *C, uiBlock *block, uiLayout *lay
                                        break;
                        }
 
-                       layout->x += layout->template_space;
+                       layout->x += style->templatespace;
                }
        }
        else {
@@ -1635,7 +1661,7 @@ static void ui_layout_templates(const bContext *C, uiBlock *block, uiLayout *lay
                                        break;
                        }
 
-                       layout->y -= layout->template_space;
+                       layout->y -= style->templatespace;
                }
        }
 }
@@ -1663,7 +1689,7 @@ void ui_layout_free(uiLayout *layout)
        MEM_freeN(layout);
 }
 
-uiLayout *uiLayoutBegin(int dir, int type, int x, int y, int size, int em)
+uiLayout *uiLayoutBegin(int dir, int type, int x, int y, int size, int em, uiStyle *style)
 {
        uiLayout *layout;
 
@@ -1673,12 +1699,7 @@ uiLayout *uiLayoutBegin(int dir, int type, int x, int y, int size, int em)
        layout->type= type;
        layout->x= x;
        layout->y= y;
-
-       layout->column_space= 5;
-       layout->template_space= 5;
-       layout->box_space= 5;
-       layout->button_space_x= 5;
-       layout->button_space_y= 2;
+       layout->style= style;
 
        if(dir == UI_LAYOUT_HORIZONTAL) {
                layout->h= size;
@@ -1713,6 +1734,7 @@ void uiLayoutEnd(const bContext *C, uiBlock *block, uiLayout *layout, int *x, in
 
 void uiRegionPanelLayout(const bContext *C, ARegion *ar, int vertical, char *context)
 {
+       uiStyle *style= U.uistyles.first;
        uiBlock *block;
        PanelType *pt;
        Panel *panel;
@@ -1751,7 +1773,7 @@ void uiRegionPanelLayout(const bContext *C, ARegion *ar, int vertical, char *con
                                }
 
                                panel->type= pt;
-                               panel->layout= uiLayoutBegin(UI_LAYOUT_VERTICAL, UI_LAYOUT_PANEL, PNL_SAFETY, 0, w-2*PNL_SAFETY, em);
+                               panel->layout= uiLayoutBegin(UI_LAYOUT_VERTICAL, UI_LAYOUT_PANEL, PNL_SAFETY, 0, w-2*PNL_SAFETY, em, style);
 
                                pt->draw(C, panel);
 
@@ -1781,6 +1803,7 @@ void uiRegionPanelLayout(const bContext *C, ARegion *ar, int vertical, char *con
 
 void uiRegionHeaderLayout(const bContext *C, ARegion *ar)
 {
+       uiStyle *style= U.uistyles.first;
        uiBlock *block;
        uiLayout *layout;
        HeaderType *ht;
@@ -1808,7 +1831,7 @@ void uiRegionHeaderLayout(const bContext *C, ARegion *ar)
        /* draw all headers types */
        for(ht= ar->type->headertypes.first; ht; ht= ht->next) {
                block= uiBeginBlock(C, ar, "header buttons", UI_EMBOSS);
-               layout= uiLayoutBegin(UI_LAYOUT_HORIZONTAL, UI_LAYOUT_HEADER, xco, yco, 24, 1);
+               layout= uiLayoutBegin(UI_LAYOUT_HORIZONTAL, UI_LAYOUT_HEADER, xco, yco, 24, 1, style);
 
                if(ht->draw) {
                        header.type= ht;
index 7bc7e2e3c192ce9fe9a2726f016f94dfbe089bd1..59725cc495429b0a7b5da808d8ad69d91eeb6176 100644 (file)
@@ -1763,12 +1763,13 @@ static uiBlock *ui_block_func_MENU_ITEM(bContext *C, uiPopupBlockHandle *handle,
 
 uiPopupBlockHandle *ui_popup_menu_create(bContext *C, ARegion *butregion, uiBut *but, uiMenuCreateFunc menu_func, void *arg)
 {
+       uiStyle *style= U.uistyles.first;
        uiPopupBlockHandle *handle;
        uiPopupMenu *pup;
        uiMenuInfo info;
        
        pup= MEM_callocN(sizeof(uiPopupMenu), "menu dummy");
-       pup->layout= uiLayoutBegin(UI_LAYOUT_VERTICAL, UI_LAYOUT_MENU, 0, 0, 200, 0);
+       pup->layout= uiLayoutBegin(UI_LAYOUT_VERTICAL, UI_LAYOUT_MENU, 0, 0, 200, 0, style);
        uiLayoutContext(pup->layout, WM_OP_INVOKE_REGION_WIN);
        uiLayoutColumn(pup->layout);
 
@@ -1793,10 +1794,11 @@ uiPopupBlockHandle *ui_popup_menu_create(bContext *C, ARegion *butregion, uiBut
 /* only return handler, and set optional title */
 uiPopupMenu *uiPupMenuBegin(const char *title, int icon)
 {
+       uiStyle *style= U.uistyles.first;
        uiPopupMenu *pup= MEM_callocN(sizeof(uiPopupMenu), "menu start");
        
        pup->icon= icon;
-       pup->layout= uiLayoutBegin(UI_LAYOUT_VERTICAL, UI_LAYOUT_MENU, 0, 0, 200, 0);
+       pup->layout= uiLayoutBegin(UI_LAYOUT_VERTICAL, UI_LAYOUT_MENU, 0, 0, 200, 0, style);
        uiLayoutContext(pup->layout, WM_OP_EXEC_REGION_WIN);
        uiLayoutColumn(pup->layout);
        
index 87e70523870125bb927fa361bd548dec2d63e1e5..db5dacf5a7529fa70ad6e3bbd3a09260b7dbe6a4 100644 (file)
@@ -115,6 +115,12 @@ static uiStyle *ui_style_new(ListBase *styles, const char *name)
        style->widget.uifont_id= UIFONT_DEFAULT;
        style->widget.points= 11;
        style->widget.shadowalpha= 0.25f;
+
+       style->columnspace= 5;
+       style->templatespace= 5;
+       style->boxspace= 5;
+       style->buttonspacex= 5;
+       style->buttonspacey= 2;
        
        return style;
 }
index 67cca059d778d74c9b0662994f32da199a78c1fd..4ae90dee0bcfa0e1378a54046bed26121bafa942 100644 (file)
@@ -293,13 +293,14 @@ uiBut *uiDefAutoButR(uiBlock *block, PointerRNA *ptr, PropertyRNA *prop, int ind
 
 int uiDefAutoButsRNA(const bContext *C, uiBlock *block, PointerRNA *ptr)
 {
+       uiStyle *style= U.uistyles.first;
        CollectionPropertyIterator iter;
        PropertyRNA *iterprop, *prop;
        uiLayout *layout;
        char *name;
        int x= 0, y= 0;
 
-       layout= uiLayoutBegin(UI_LAYOUT_VERTICAL, UI_LAYOUT_PANEL, x, y, DEF_BUT_WIDTH*2, 20);
+       layout= uiLayoutBegin(UI_LAYOUT_VERTICAL, UI_LAYOUT_PANEL, x, y, DEF_BUT_WIDTH*2, 20, style);
 
        uiLayoutColumn(layout);
        uiItemL(layout, (char*)RNA_struct_ui_name(ptr->type), 0);
@@ -331,13 +332,14 @@ int uiDefAutoButsRNA(const bContext *C, uiBlock *block, PointerRNA *ptr)
 /* temp call, single collumn, test for toolbar only */
 int uiDefAutoButsRNA_single(const bContext *C, uiBlock *block, PointerRNA *ptr)
 {
+       uiStyle *style= U.uistyles.first;
        CollectionPropertyIterator iter;
        PropertyRNA *iterprop, *prop;
        uiLayout *layout;
        char *name;
        int x= 0, y= 0;
        
-       layout= uiLayoutBegin(UI_LAYOUT_VERTICAL, UI_LAYOUT_PANEL, x, y, block->panel->sizex, 20);
+       layout= uiLayoutBegin(UI_LAYOUT_VERTICAL, UI_LAYOUT_PANEL, x, y, block->panel->sizex, 20, style);
        
        uiLayoutColumn(layout);
        uiItemL(layout, (char*)RNA_struct_ui_name(ptr->type), 0);
index 1a3b3e5e031ee4d51268d6e88ef50f49928a1704..37b50da39b43b6d4a03801dd3c5e84a81bc738df 100644 (file)
@@ -637,9 +637,9 @@ static int object_primitive_add_invoke(bContext *C, wmOperator *op, wmEvent *eve
        uiPopupMenu *pup= uiPupMenuBegin("Add Object", 0);
        uiLayout *layout= uiPupMenuLayout(pup);
        
-       uiItemLevelEnumO(layout, NULL, 0, "OBJECT_OT_mesh_add", "type");
-       uiItemLevelEnumO(layout, NULL, 0, "OBJECT_OT_curve_add", "type");
-       uiItemLevelEnumO(layout, NULL, 0, "OBJECT_OT_surface_add", "type");
+       uiItemMenuEnumO(layout, NULL, 0, "OBJECT_OT_mesh_add", "type");
+       uiItemMenuEnumO(layout, NULL, 0, "OBJECT_OT_curve_add", "type");
+       uiItemMenuEnumO(layout, NULL, 0, "OBJECT_OT_surface_add", "type");
        uiItemO(layout, NULL, 0, "OBJECT_OT_text_add");
        uiItemEnumO(layout, NULL, 0, "OBJECT_OT_object_add", "type", OB_MBALL);
        uiItemEnumO(layout, NULL, 0, "OBJECT_OT_object_add", "type", OB_CAMERA);
index 1c56b0c7115909d20d6bd84235f0cd6c4d68bbe6..7203f56b40f826666d2919adaf70e5477d9acc96 100644 (file)
@@ -84,5 +84,8 @@ void GROUP_OT_objects_remove(struct wmOperatorType *ot);
 void GROUP_OT_objects_add_active(struct wmOperatorType *ot);
 void GROUP_OT_objects_remove_active(struct wmOperatorType *ot);
 
+/* object_modifier.c */
+void OBJECT_OT_modifier_add(struct wmOperatorType *ot);
+
 #endif /* ED_OBJECT_INTERN_H */
 
diff --git a/source/blender/editors/object/object_modifier.c b/source/blender/editors/object/object_modifier.c
new file mode 100644 (file)
index 0000000..b430cdd
--- /dev/null
@@ -0,0 +1,98 @@
+/**
+ * $Id$
+ *
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+ *
+ * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
+ * All rights reserved.
+ *
+ * Contributor(s): Blender Foundation, 2009
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "DNA_modifier_types.h"
+#include "DNA_object_types.h"
+#include "DNA_scene_types.h"
+
+#include "BLI_listbase.h"
+
+#include "BKE_context.h"
+#include "BKE_depsgraph.h"
+#include "BKE_modifier.h"
+
+#include "RNA_access.h"
+#include "RNA_define.h"
+#include "RNA_enum_types.h"
+
+#include "ED_screen.h"
+
+#include "WM_api.h"
+#include "WM_types.h"
+
+#include "object_intern.h"
+
+/********************* add modifier operator ********************/
+
+static int modifier_add_exec(bContext *C, wmOperator *op)
+{
+       Scene *scene= CTX_data_scene(C);
+    Object *ob = CTX_data_active_object(C);
+       ModifierData *md;
+       int type= RNA_enum_get(op->ptr, "type");
+       ModifierTypeInfo *mti = modifierType_getInfo(type);
+
+       if(mti->flags&eModifierTypeFlag_RequiresOriginalData) {
+               md = ob->modifiers.first;
+
+               while(md && modifierType_getInfo(md->type)->type==eModifierTypeType_OnlyDeform)
+                       md = md->next;
+
+               BLI_insertlinkbefore(&ob->modifiers, md, modifier_new(type));
+       }
+       else
+               BLI_addtail(&ob->modifiers, modifier_new(type));
+
+       DAG_object_flush_update(scene, ob, OB_RECALC_DATA);
+       WM_event_add_notifier(C, NC_OBJECT|ND_MODIFIER, ob);
+       
+       return OPERATOR_FINISHED;
+}
+
+void OBJECT_OT_modifier_add(wmOperatorType *ot)
+{
+       /* identifiers */
+       ot->name= "Add Modifier";
+       ot->description = "Add a modifier to the active object.";
+       ot->idname= "OBJECT_OT_modifier_add";
+       
+       /* api callbacks */
+       ot->invoke= WM_menu_invoke;
+       ot->exec= modifier_add_exec;
+       
+       ot->poll= ED_operator_object_active;
+       
+       /* flags */
+       ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+       
+       /* XXX only some types should be here */
+       RNA_def_enum(ot->srna, "type", modifier_type_items, 0, "Type", "");
+}
+
index 6c8c6e6b60f496d37f5632aabd18e70a5ef33464..e668c494fba8bad02e618380e64d73be5c4d2e72 100644 (file)
@@ -98,6 +98,8 @@ void ED_operatortypes_object(void)
        WM_operatortype_append(OBJECT_OT_armature_add);
        WM_operatortype_append(OBJECT_OT_object_add);
        WM_operatortype_append(OBJECT_OT_primitive_add);
+
+       WM_operatortype_append(OBJECT_OT_modifier_add);
 }
 
 void ED_keymap_object(wmWindowManager *wm)
index 85d4d822c0df2efc26506874ae7112931e24580b..e441a93fe2397e2d810b6ae9d46e3f8de62da472 100644 (file)
@@ -1834,7 +1834,7 @@ static int testing123(bContext *C, wmOperator *op, wmEvent *event)
        uiItemO(layout, NULL, ICON_PROP_ON, "SCREEN_OT_region_flip");
        uiItemO(layout, NULL, ICON_PROP_CON, "SCREEN_OT_screen_full_area");
        uiItemO(layout, NULL, ICON_SMOOTHCURVE, "SCREEN_OT_region_foursplit");
-       uiItemLevel(layout, "Submenu", 0, newlevel1);
+       uiItemMenuF(layout, "Submenu", 0, newlevel1);
        
        uiPupMenuEnd(C, pup);
        
index 7e009dfc479f819bc0ebeaf37786cb72b2892a15..457d322f56560984bab5fdabd2062b2cadf135eb 100644 (file)
@@ -155,7 +155,7 @@ static void image_viewmenu(bContext *C, uiLayout *layout, void *arg_unused)
 
        uiItemS(layout);
 
-       uiItemLevel(layout, "View Navigation", 0, image_view_viewnavmenu);
+       uiItemMenuF(layout, "View Navigation", 0, image_view_viewnavmenu);
        if(show_uvedit) uiItemO(layout, NULL, 0, "IMAGE_OT_view_selected");
        uiItemO(layout, NULL, 0, "IMAGE_OT_view_all");
 
@@ -238,7 +238,7 @@ static void image_imagemenu(bContext *C, uiLayout *layout, void *arg_unused)
                        
                        /* move to realtime properties panel */
                        RNA_id_pointer_create(&ima->id, &imaptr);
-                       uiItemLevelEnumR(layout, NULL, 0, &imaptr, "mapping");
+                       uiItemMenuEnumR(layout, NULL, 0, &imaptr, "mapping");
                }
        }
 
@@ -357,24 +357,24 @@ static void image_uvsmenu(bContext *C, uiLayout *layout, void *arg_unused)
 
        uiItemS(layout);
 
-       uiItemLevel(layout, "Transform", 0, image_uvs_transformmenu);
-       uiItemLevel(layout, "Mirror", 0, image_uvs_mirrormenu);
-       uiItemLevel(layout, "Weld/Align", 0, image_uvs_weldalignmenu);
+       uiItemMenuF(layout, "Transform", 0, image_uvs_transformmenu);
+       uiItemMenuF(layout, "Mirror", 0, image_uvs_mirrormenu);
+       uiItemMenuF(layout, "Weld/Align", 0, image_uvs_weldalignmenu);
 
        uiItemS(layout);
 
        uiItemR(layout, NULL, 0, &sceneptr, "proportional_editing", 0);
-       uiItemLevelEnumR(layout, NULL, 0, &sceneptr, "proportional_editing_falloff");
+       uiItemMenuEnumR(layout, NULL, 0, &sceneptr, "proportional_editing_falloff");
 
        uiItemS(layout);
 
-       uiItemLevel(layout, "Show/Hide Faces", 0, image_uvs_showhidemenu);
+       uiItemMenuF(layout, "Show/Hide Faces", 0, image_uvs_showhidemenu);
 
 #if 0
 #ifndef DISABLE_PYTHON
        uiItemS(layout);
 
-       uiItemLevel(layout, "Scripts", image_uvs_scriptsmenu);
+       uiItemMenuF(layout, "Scripts", image_uvs_scriptsmenu);
 #endif
 #endif
 }
@@ -948,10 +948,10 @@ static int toolbox_invoke(bContext *C, wmOperator *op, wmEvent *event)
        pup= uiPupMenuBegin("Toolbox", 0);
        layout= uiPupMenuLayout(pup);
 
-       uiItemLevel(layout, "View", 0, image_viewmenu);
-       if(show_uvedit) uiItemLevel(layout, "Select", 0, image_selectmenu);
-       uiItemLevel(layout, "Image", 0, image_imagemenu);
-       if(show_uvedit) uiItemLevel(layout, "UVs", 0, image_uvsmenu);
+       uiItemMenuF(layout, "View", 0, image_viewmenu);
+       if(show_uvedit) uiItemMenuF(layout, "Select", 0, image_selectmenu);
+       uiItemMenuF(layout, "Image", 0, image_imagemenu);
+       if(show_uvedit) uiItemMenuF(layout, "UVs", 0, image_uvsmenu);
 
        uiPupMenuEnd(C, pup);
 
index c8dc4cc006acb93fd99303cae388713abc9cdace..0e9a9d7130b57d8c1df11103ac00e15db7c512c7 100644 (file)
@@ -235,7 +235,7 @@ static void seq_addmenu_effectmenu(bContext *C, uiLayout *layout, void *arg_unus
 //static uiBlock *seq_addmenu(bContext *C, ARegion *ar, void *arg_unused)
 static void seq_addmenu(bContext *C, uiLayout *layout, void *arg_unused)
 {
-       uiItemLevel(layout, "Effects...", 0, seq_addmenu_effectmenu);
+       uiItemMenuF(layout, "Effects...", 0, seq_addmenu_effectmenu);
        uiItemS(layout);
 
        uiLayoutContext(layout, WM_OP_INVOKE_REGION_WIN);
index a3b62adf6c85768cb82f5db55e65d5d4e7f30f0c..83c144d88c53de7f40e8ea31db0d52f7c08b0226 100644 (file)
@@ -188,7 +188,7 @@ static void text_formatmenu(const bContext *C, Menu *menu)
 
        uiItemS(layout);
 
-       uiItemLevelEnumO(layout, NULL, 0, "TEXT_OT_convert_whitespace", "type");
+       uiItemMenuEnumO(layout, NULL, 0, "TEXT_OT_convert_whitespace", "type");
 }
 
 static void text_editmenu_to3dmenu(bContext *C, uiLayout *layout, void *arg_unused)
@@ -217,9 +217,9 @@ static void text_editmenu(const bContext *C, Menu *menu)
 
        uiItemS(layout);
 
-       uiItemLevel(layout, "View", 0, text_editmenu_viewmenu);
-       uiItemLevel(layout, "Select", 0, text_editmenu_selectmenu);
-       uiItemLevel(layout, "Markers", 0, text_editmenu_markermenu);
+       uiItemMenuF(layout, "View", 0, text_editmenu_viewmenu);
+       uiItemMenuF(layout, "Select", 0, text_editmenu_selectmenu);
+       uiItemMenuF(layout, "Markers", 0, text_editmenu_markermenu);
 
        uiItemS(layout);
 
@@ -228,7 +228,7 @@ static void text_editmenu(const bContext *C, Menu *menu)
 
        uiItemS(layout);
 
-       uiItemLevel(layout, "Text to 3D Object", 0, text_editmenu_to3dmenu);
+       uiItemMenuF(layout, "Text to 3D Object", 0, text_editmenu_to3dmenu);
 }
 
 /********************** header buttons ***********************/
index e968756b11a8d284b438d7f9775de9c63d2238eb..fba8e0c4eb796afef081c44a52501d7d57574d0c 100644 (file)
@@ -660,7 +660,7 @@ static void view3d_viewmenu(bContext *C, uiLayout *layout, void *arg_unused)
        uiItemEnumO(layout, NULL, 0, "VIEW3D_OT_viewnumpad", "type", V3D_VIEW_FRONT);
        uiItemEnumO(layout, NULL, 0, "VIEW3D_OT_viewnumpad", "type", V3D_VIEW_RIGHT);
        
-       //uiItemLevel(layout, "Cameras", view3d_view_camerasmenu);
+       //uiItemMenuF(layout, "Cameras", view3d_view_camerasmenu);
        
        uiItemS(layout);
 
@@ -677,8 +677,8 @@ static void view3d_viewmenu(bContext *C, uiLayout *layout, void *arg_unused)
        
 //     uiItemS(layout);
        
-       uiItemLevel(layout, "View Navigation", 0, view3d_view_viewnavmenu);
-       uiItemLevel(layout, "Align View", 0, view3d_view_alignviewmenu);
+       uiItemMenuF(layout, "View Navigation", 0, view3d_view_viewnavmenu);
+       uiItemMenuF(layout, "Align View", 0, view3d_view_alignviewmenu);
        
        uiItemS(layout);
 
@@ -3356,17 +3356,17 @@ static void view3d_edit_curvemenu(bContext *C, uiLayout *layout, void *arg_unuse
 
        uiItemS(layout);
 
-       uiItemLevel(layout, "Control Points", 0, view3d_edit_curve_controlpointsmenu);
-       uiItemLevel(layout, "Segments", 0, view3d_edit_curve_segmentsmenu);
+       uiItemMenuF(layout, "Control Points", 0, view3d_edit_curve_controlpointsmenu);
+       uiItemMenuF(layout, "Segments", 0, view3d_edit_curve_segmentsmenu);
 
        uiItemS(layout);
 
        uiItemR(layout, NULL, 0, &sceneptr, "proportional_editing", 0); // |O
-       uiItemLevelEnumR(layout, NULL, 0, &sceneptr, "proportional_editing_falloff");
+       uiItemMenuEnumR(layout, NULL, 0, &sceneptr, "proportional_editing_falloff");
 
        uiItemS(layout);
 
-       uiItemLevel(layout, "Show/Hide Control Points", 0, view3d_edit_curve_showhidemenu);
+       uiItemMenuF(layout, "Show/Hide Control Points", 0, view3d_edit_curve_showhidemenu);
 }
 
 static void do_view3d_edit_mball_showhidemenu(bContext *C, void *arg, int event)
@@ -3513,7 +3513,7 @@ static void view3d_edit_textmenu(bContext *C, uiLayout *layout, void *arg_unused
 {
        uiItemO(layout, NULL, 0, "FONT_OT_file_paste");
        uiItemS(layout);
-       uiItemLevel(layout, "Special Characters", 0, view3d_edit_text_charsmenu);
+       uiItemMenuF(layout, "Special Characters", 0, view3d_edit_text_charsmenu);
 }
 
 static void do_view3d_edit_latticemenu(bContext *C, void *arg, int event)
@@ -4747,7 +4747,7 @@ static void view3d_particlemenu(bContext *C, uiLayout *layout, void *arg_unused)
 
        uiItemS(layout);
 
-       uiItemLevel(layout, "Show/Hide Particles", 0, view3d_particle_showhidemenu);
+       uiItemMenuF(layout, "Show/Hide Particles", 0, view3d_particle_showhidemenu);
 }
 
 static char *view3d_modeselect_pup(Scene *scene)
index 91c81023c8c2d51f9132bde4610203ce124fc724..ab2b7ba498af10cb869a0e0b1a7204067301629c 100644 (file)
@@ -94,8 +94,14 @@ typedef struct uiStyle {
        
        short minlabelchars;    /* in characters */
        short minwidgetchars;   /* in characters */
-       int pad;
-       
+
+       short columnspace;
+       short templatespace;
+       short boxspace;
+       short buttonspacex;
+       short buttonspacey;
+
+       short pad;
 } uiStyle;
 
 typedef struct uiWidgetColors {
index f8c0ba18c29f6af2f908446c33cae557de4fdfcd..065c1eba606e185f9ffa2c7b4f64d436a626e4de 100644 (file)
@@ -32,6 +32,7 @@
 extern EnumPropertyItem prop_mode_items[];
 extern EnumPropertyItem space_type_items[];
 extern EnumPropertyItem region_type_items[];
+extern EnumPropertyItem modifier_type_items[];
 
 #endif /* RNA_ENUM_TYPES */
 
index 5c609550d3fbf3ea79fd4ce4825750d5e5fe58c5..3263c6d4bfc6cd4255d3a2f9bfc0929109decfb0 100644 (file)
 
 #include "WM_types.h"
 
+EnumPropertyItem modifier_type_items[] ={
+       {eModifierType_Subsurf, "SUBSURF", "Subsurf", ""},
+       {eModifierType_Lattice, "LATTICE", "Lattice", ""},
+       {eModifierType_Curve, "CURVE", "Curve", ""},
+       {eModifierType_Build, "BUILD", "Build", ""},
+       {eModifierType_Mirror, "MIRROR", "Mirror", ""},
+       {eModifierType_Decimate, "DECIMATE", "Decimate", ""},
+       {eModifierType_Wave, "WAVE", "Wave", ""},
+       {eModifierType_Armature, "ARMATURE", "Armature", ""},
+       {eModifierType_Hook, "HOOK", "Hook", ""},
+       {eModifierType_Softbody, "SOFTBODY", "Softbody", ""},
+       {eModifierType_Boolean, "BOOLEAN", "Boolean", ""},
+       {eModifierType_Array, "ARRAY", "Array", ""},
+       {eModifierType_EdgeSplit, "EDGE_SPLIT", "Edge Split", ""},
+       {eModifierType_Displace, "DISPLACE", "Displace", ""},
+       {eModifierType_UVProject, "UV_PROJECT", "UV Project", ""},
+       {eModifierType_Smooth, "SMOOTH", "Smooth", ""},
+       {eModifierType_Cast, "CAST", "Cast", ""},
+       {eModifierType_MeshDeform, "MESH_DEFORM", "Mesh Deform", ""},
+       {eModifierType_ParticleSystem, "PARTICLE_SYSTEM", "Particle System", ""},
+       {eModifierType_ParticleInstance, "PARTICLE_INSTANCE", "Particle Instance", ""},
+       {eModifierType_Explode, "EXPLODE", "Explode", ""},
+       {eModifierType_Cloth, "CLOTH", "Cloth", ""},
+       {eModifierType_Collision, "COLLISION", "Collision", ""},
+       {eModifierType_Bevel, "BEVEL", "Bevel", ""},
+       {eModifierType_Shrinkwrap, "SHRINKWRAP", "Shrinkwrap", ""},
+       {eModifierType_Fluidsim, "FLUID_SIMULATION", "Fluid Simulation", ""},
+       {eModifierType_Mask, "MASK", "Mask", ""},
+       {eModifierType_SimpleDeform, "SIMPLE_DEFORM", "Simple Deform", ""},
+       {eModifierType_Multires, "MULTIRES", "Multires", ""},
+       {0, NULL, NULL, NULL}};
+
+
 #ifdef RNA_RUNTIME
 
 #include "BKE_context.h"
@@ -634,10 +667,10 @@ static void rna_def_modifier_armature(BlenderRNA *brna)
        RNA_def_struct_ui_text(srna, "Armature Modifier", "Armature deformation modifier.");
        RNA_def_struct_sdna(srna, "ArmatureModifierData");
 
-       prop= RNA_def_property(srna, "armature", PROP_POINTER, PROP_NONE);
+       prop= RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE);
        RNA_def_property_pointer_sdna(prop, NULL, "object");
        RNA_def_property_struct_type(prop, "Object");
-       RNA_def_property_ui_text(prop, "Armature", "Armature object to deform with.");
+       RNA_def_property_ui_text(prop, "Object", "Armature object to deform with.");
        RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_Modifier_update");
 
        prop= RNA_def_property(srna, "vertex_group", PROP_STRING, PROP_NONE);
@@ -668,7 +701,12 @@ static void rna_def_modifier_armature(BlenderRNA *brna)
 
        prop= RNA_def_property(srna, "b_bone_rest", PROP_BOOLEAN, PROP_NONE);
        RNA_def_property_boolean_sdna(prop, NULL, "deformflag", ARM_DEF_B_BONE_REST);
-       RNA_def_property_ui_text(prop, "Quaternion",  "Make B-Bones deform already in rest position");
+       RNA_def_property_ui_text(prop, "B-Bone Rest",  "Make B-Bones deform already in rest position");
+       RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_Modifier_update");
+
+       prop= RNA_def_property(srna, "multi_modifier", PROP_BOOLEAN, PROP_NONE);
+       RNA_def_property_boolean_sdna(prop, NULL, "multi", 0);
+       RNA_def_property_ui_text(prop, "Multi Modifier",  "Use same input as previous modifier, and mix results using overall vgroup");
        RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_Modifier_update");
 }
 
@@ -1524,38 +1562,6 @@ void RNA_def_modifier(BlenderRNA *brna)
        StructRNA *srna;
        PropertyRNA *prop;
        
-       static EnumPropertyItem type_items[] ={
-               {eModifierType_Subsurf, "SUBSURF", "Subsurf", ""},
-               {eModifierType_Lattice, "LATTICE", "Lattice", ""},
-               {eModifierType_Curve, "CURVE", "Curve", ""},
-               {eModifierType_Build, "BUILD", "Build", ""},
-               {eModifierType_Mirror, "MIRROR", "Mirror", ""},
-               {eModifierType_Decimate, "DECIMATE", "Decimate", ""},
-               {eModifierType_Wave, "WAVE", "Wave", ""},
-               {eModifierType_Armature, "ARMATURE", "Armature", ""},
-               {eModifierType_Hook, "HOOK", "Hook", ""},
-               {eModifierType_Softbody, "SOFTBODY", "Softbody", ""},
-               {eModifierType_Boolean, "BOOLEAN", "Boolean", ""},
-               {eModifierType_Array, "ARRAY", "Array", ""},
-               {eModifierType_EdgeSplit, "EDGE_SPLIT", "Edge Split", ""},
-               {eModifierType_Displace, "DISPLACE", "Displace", ""},
-               {eModifierType_UVProject, "UV_PROJECT", "UV Project", ""},
-               {eModifierType_Smooth, "SMOOTH", "Smooth", ""},
-               {eModifierType_Cast, "CAST", "Cast", ""},
-               {eModifierType_MeshDeform, "MESH_DEFORM", "Mesh Deform", ""},
-               {eModifierType_ParticleSystem, "PARTICLE_SYSTEM", "Particle System", ""},
-               {eModifierType_ParticleInstance, "PARTICLE_INSTANCE", "Particle Instance", ""},
-               {eModifierType_Explode, "EXPLODE", "Explode", ""},
-               {eModifierType_Cloth, "CLOTH", "Cloth", ""},
-               {eModifierType_Collision, "COLLISION", "Collision", ""},
-               {eModifierType_Bevel, "BEVEL", "Bevel", ""},
-               {eModifierType_Shrinkwrap, "SHRINKWRAP", "Shrinkwrap", ""},
-               {eModifierType_Fluidsim, "FLUID_SIMULATION", "Fluid Simulation", ""},
-               {eModifierType_Mask, "MASK", "Mask", ""},
-               {eModifierType_SimpleDeform, "SIMPLE_DEFORM", "Simple Deform", ""},
-               {eModifierType_SimpleDeform, "MULTIRES", "Multires", ""},
-               {0, NULL, NULL, NULL}};
-       
        /* data */
        srna= RNA_def_struct(brna, "Modifier", NULL);
        RNA_def_struct_ui_text(srna , "Modifier", "Modifier affecting the geometry data of an object.");
@@ -1571,7 +1577,7 @@ void RNA_def_modifier(BlenderRNA *brna)
        prop= RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
        RNA_def_property_clear_flag(prop, PROP_EDITABLE);
        RNA_def_property_enum_sdna(prop, NULL, "type");
-       RNA_def_property_enum_items(prop, type_items);
+       RNA_def_property_enum_items(prop, modifier_type_items);
        RNA_def_property_ui_text(prop, "Type", "");
        
        /* flags */
index 225d92a79a53faf6e8aa1e21258351d1215e2140..d61db6cc6e899b03142575a627ee55c1ee96cd4f 100644 (file)
@@ -475,7 +475,11 @@ void RNA_def_scene(BlenderRNA *brna)
 
        prop= RNA_def_property(srna, "camera", PROP_POINTER, PROP_NONE);
        RNA_def_property_flag(prop, PROP_EDITABLE);
-       RNA_def_property_ui_text(prop, "Active Camera", "Active camera used for rendering the scene.");
+       RNA_def_property_ui_text(prop, "Camera", "Active camera used for rendering the scene.");
+
+       prop= RNA_def_property(srna, "world", PROP_POINTER, PROP_NONE);
+       RNA_def_property_flag(prop, PROP_EDITABLE);
+       RNA_def_property_ui_text(prop, "World", "World used for rendering the scene.");
 
        prop= RNA_def_property(srna, "cursor_location", PROP_FLOAT, PROP_VECTOR);
        RNA_def_property_float_sdna(prop, NULL, "cursor");