Various bugfixes:
authorJoshua Leung <aligorith@gmail.com>
Mon, 23 Nov 2009 09:47:56 +0000 (09:47 +0000)
committerJoshua Leung <aligorith@gmail.com>
Mon, 23 Nov 2009 09:47:56 +0000 (09:47 +0000)
* Tweaked the code for operator buttons so that only those operator buttons in the toolbar have their text left-aligned. This is done at layout-block level

* Silenced "file_init" print when opening the file browser

* Disabled animateability of the "active_shape_key_index" for Objects, since this property behaves in a very unpredictable manner, leading to problems with users trying to keyframe shapekey values and ending up keying the list.

* Remove some unnecessary RNA wrapping code

source/blender/editors/animation/fmodifier_ui.c
source/blender/editors/include/UI_interface.h
source/blender/editors/interface/interface_layout.c
source/blender/editors/interface/interface_widgets.c
source/blender/editors/screen/area.c
source/blender/editors/space_file/space_file.c
source/blender/makesrna/intern/rna_fcurve.c
source/blender/makesrna/intern/rna_object.c
source/blender/makesrna/intern/rna_scene.c

index 35c578d..b1241bd 100644 (file)
@@ -331,7 +331,6 @@ static void draw_modifier__noise(uiLayout *layout, ID *id, FModifier *fcm, short
 static void draw_modifier__sound(const bContext *C, uiLayout *layout, ID *id, FModifier *fcm, short width)
 {
        FMod_Sound *data= (FMod_Sound *)fcm->data;
-       uiLayout *split, *col;
        PointerRNA ptr;
        
        /* init the RNA-pointer */
@@ -348,16 +347,9 @@ static void draw_modifier__sound(const bContext *C, uiLayout *layout, ID *id, FM
                        /* blending mode */
                        uiItemR(layout, NULL, 0, &ptr, "modification", 0);
                        
-                       /* split into 2 columns */
-                       split= uiLayoutSplit(layout, 0.5f);
-                       
-                       /* col 1 */
-                       col= uiLayoutColumn(split, 0);
-                       uiItemR(col, NULL, 0, &ptr, "strength", 0);
-                       
-                       /* col 2 */
-                       col= uiLayoutColumn(split, 0);
-                       uiItemR(col, NULL, 0, &ptr, "delay", 0);
+                       /* settings */
+                       uiItemR(layout, NULL, 0, &ptr, "strength", 0);
+                       uiItemR(layout, NULL, 0, &ptr, "delay", 0);
                }
                else
                {
index 82ff756..00b060b 100644 (file)
@@ -560,6 +560,7 @@ void UI_exit(void);
 #define UI_LAYOUT_PANEL                        0
 #define UI_LAYOUT_HEADER               1
 #define UI_LAYOUT_MENU                 2
+#define UI_LAYOUT_TOOLBAR              3
  
 #define UI_UNIT_X                              20
 #define UI_UNIT_Y                              20
index 53ccc25..9ffd2bf 100644 (file)
@@ -629,7 +629,11 @@ PointerRNA uiItemFullO(uiLayout *layout, char *name, int icon, char *idname, IDP
                but= uiDefIconButO(block, BUT, ot->idname, context, icon, 0, 0, w, UI_UNIT_Y, NULL);
        else
                but= uiDefButO(block, BUT, ot->idname, context, (char*)name, 0, 0, w, UI_UNIT_Y, NULL);
-
+       
+       /* text alignment for toolbar buttons */
+       if((layout->root->type == UI_LAYOUT_TOOLBAR) && !icon)
+               but->flag |= UI_TEXT_LEFT;
+       
        /* assign properties */
        if(properties || (flag & UI_ITEM_O_RETURN_PROPS)) {
                PointerRNA *opptr= uiButGetOperatorPtrRNA(but);
index 649b19e..fa577f6 100644 (file)
@@ -2451,9 +2451,6 @@ void ui_draw_but(const bContext *C, ARegion *ar, uiStyle *style, uiBut *but, rct
                                
                        case BUT:
                                wt= widget_type(UI_WTYPE_EXEC);
-                               if (!(but->flag & UI_HAS_ICON)) {
-                                       but->flag |= UI_TEXT_LEFT;
-                               }
                                break;
 
                        case NUM:
index 0f22b30..08a05f4 100644 (file)
@@ -1272,7 +1272,15 @@ void ED_region_panels(const bContext *C, ARegion *ar, int vertical, char *contex
                        }
 
                        if(open) {
-                               panel->layout= uiBlockLayout(block, UI_LAYOUT_VERTICAL, UI_LAYOUT_PANEL,
+                               short panelContext;
+                               
+                               /* panel context can either be toolbar region or normal panels region */
+                               if (ar->regiontype == RGN_TYPE_TOOLS)
+                                       panelContext= UI_LAYOUT_TOOLBAR;
+                               else
+                                       panelContext= UI_LAYOUT_PANEL;
+                               
+                               panel->layout= uiBlockLayout(block, UI_LAYOUT_VERTICAL, panelContext,
                                        style->panelspace, 0, w-2*style->panelspace, em, style);
 
                                pt->draw(C, panel);
index d58055d..08ac919 100644 (file)
@@ -156,7 +156,7 @@ static void file_free(SpaceLink *sl)
 static void file_init(struct wmWindowManager *wm, ScrArea *sa)
 {
        SpaceFile *sfile= (SpaceFile*)sa->spacedata.first;
-       printf("file_init\n");
+       //printf("file_init\n");
 
        if(sfile->layout) sfile->layout->dirty= 1;
 }
index eaffdc2..67d562d 100644 (file)
@@ -229,11 +229,6 @@ static int rna_FCurve_modifiers_remove(FCurve *fcu, bContext *C, int index)
        return remove_fmodifier_index(&fcu->modifiers, index);
 }
 
-static int rna_Sound_id_editable(PointerRNA *ptr)
-{
-       return PROP_EDITABLE;
-}
-
 #else
 
 static void rna_def_fmodifier_generator(BlenderRNA *brna)
@@ -578,7 +573,6 @@ static void rna_def_fmodifier_sound(BlenderRNA *brna)
        prop= RNA_def_property(srna, "sound", PROP_POINTER, PROP_NONE);
        RNA_def_property_struct_type(prop, "Sound");
        RNA_def_property_flag(prop, PROP_EDITABLE);
-       RNA_def_property_editable_func(prop, "rna_Sound_id_editable");
        RNA_def_property_ui_text(prop, "Sound", "Sound datablock used by this modifier.");
 
 }
index ad47a1c..d42e862 100644 (file)
@@ -1800,6 +1800,7 @@ static void rna_def_object(BlenderRNA *brna)
 
        prop= RNA_def_property(srna, "active_shape_key_index", PROP_INT, PROP_NONE);
        RNA_def_property_int_sdna(prop, NULL, "shapenr");
+       RNA_def_property_clear_flag(prop, PROP_ANIMATEABLE); // XXX this is really unpredictable...
        RNA_def_property_int_funcs(prop, "rna_Object_active_shape_key_index_get", "rna_Object_active_shape_key_index_set", "rna_Object_active_shape_key_index_range");
        RNA_def_property_ui_text(prop, "Active Shape Key Index", "Current shape key index.");
        RNA_def_property_update(prop, 0, "rna_Object_active_shape_update");
index 0aa669e..babbf70 100644 (file)
@@ -2340,7 +2340,6 @@ void RNA_def_scene(BlenderRNA *brna)
        prop= RNA_def_property(srna, "set", PROP_POINTER, PROP_NONE);
        RNA_def_property_pointer_sdna(prop, NULL, "set");
        RNA_def_property_struct_type(prop, "Scene");
-       //RNA_def_property_flag(prop, PROP_EDITABLE|PROP_ID_SELF_CHECK);
        RNA_def_property_flag(prop, PROP_EDITABLE|PROP_ID_SELF_CHECK);
        RNA_def_property_pointer_funcs(prop, NULL, "rna_Scene_set_set", NULL);
        RNA_def_property_ui_text(prop, "Set Scene", "Background set scene.");