Various bugfixes:

* 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
This commit is contained in:
Joshua Leung 2009-11-23 09:47:56 +00:00
parent 7617736bd1
commit c6dbbde16b
Notes: blender-bot 2023-02-14 10:04:50 +01:00
Referenced by issue #50438, Inconsistent text alignment for operator buttons
9 changed files with 20 additions and 24 deletions

View 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
{

View 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

View 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);

View 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:

View 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);

View 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;
}

View 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.");
}

View 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");

View 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.");