diff options
author | Joerg Mueller <nexyon@gmail.com> | 2011-08-23 00:31:46 +0400 |
---|---|---|
committer | Joerg Mueller <nexyon@gmail.com> | 2011-08-23 00:31:46 +0400 |
commit | f0d5abfcb2b54f6fd7a24220e81e0c88a914d87f (patch) | |
tree | 328a631d447ea7c7be2a757d092065c721090f82 /source/blender/editors | |
parent | 1d529d83a0693693878749110a05d8b0fa929d0f (diff) | |
parent | 6a374d266d8213629f74a9f4c9a4984ddf59ef4c (diff) |
Merging trunk up to r39637.
Diffstat (limited to 'source/blender/editors')
36 files changed, 232 insertions, 186 deletions
diff --git a/source/blender/editors/armature/SConscript b/source/blender/editors/armature/SConscript index beabd912a20..b7f9a263bc1 100644 --- a/source/blender/editors/armature/SConscript +++ b/source/blender/editors/armature/SConscript @@ -7,7 +7,7 @@ incs = '../include ../../blenlib ../../blenkernel ../../makesdna ../../imbuf ../ incs += ' ../../windowmanager #/intern/guardedalloc #/extern/glew/include' incs += ' ../../gpu ../../makesrna #/intern/opennl/extern' -if env['OURPLATFORM'] == 'linux2': +if env['OURPLATFORM'] == 'linux': cflags='-pthread' incs += ' ../../../extern/binreloc/include' diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c index ccc5ac52744..0dee7a3813a 100644 --- a/source/blender/editors/interface/interface.c +++ b/source/blender/editors/interface/interface.c @@ -710,6 +710,27 @@ int uiButActiveOnly(const bContext *C, uiBlock *block, uiBut *but) return 1; } +/* use to check if we need to disable undo, but dont make any changes + * returns FALSE if undo needs to be disabled. */ +static int ui_but_is_rna_undo(uiBut *but) +{ + if(but->rnapoin.id.data) { + /* avoid undo push for buttons who's ID are screen or wm level + * we could disable undo for buttons with no ID too but may have + * unforseen conciquences, so best check for ID's we _know_ are not + * handled by undo - campbell */ + ID *id= but->rnapoin.id.data; + if(ELEM(GS(id->name), ID_SCR, ID_WM)) { + return FALSE; + } + else { + return TRUE; + } + } + + return TRUE; +} + /* assigns automatic keybindings to menu items for fast access * (underline key in menu) */ static void ui_menu_block_set_keyaccels(uiBlock *block) @@ -1245,14 +1266,14 @@ int ui_is_but_float(uiBut *but) int ui_is_but_unit(uiBut *but) { - Scene *scene= CTX_data_scene((bContext *)but->block->evil_C); - int unit_type= uiButGetUnitType(but); + UnitSettings *unit= but->block->unit; + const int unit_type= uiButGetUnitType(but); if(unit_type == PROP_UNIT_NONE) return 0; #if 1 // removed so angle buttons get correct snapping - if (scene->unit.system_rotation == USER_UNIT_ROT_RADIANS && unit_type == PROP_UNIT_ROTATION) + if (unit->system_rotation == USER_UNIT_ROT_RADIANS && unit_type == PROP_UNIT_ROTATION) return 0; #endif @@ -1260,7 +1281,7 @@ int ui_is_but_unit(uiBut *but) if (unit_type == PROP_UNIT_TIME) return 0; - if (scene->unit.system == USER_UNIT_NONE) { + if (unit->system == USER_UNIT_NONE) { if (unit_type != PROP_UNIT_ROTATION) { return 0; } @@ -1293,19 +1314,19 @@ double ui_get_but_val(uiBut *but) switch(RNA_property_type(prop)) { case PROP_BOOLEAN: - if(RNA_property_array_length(&but->rnapoin, prop)) + if(RNA_property_array_check(prop)) value= RNA_property_boolean_get_index(&but->rnapoin, prop, but->rnaindex); else value= RNA_property_boolean_get(&but->rnapoin, prop); break; case PROP_INT: - if(RNA_property_array_length(&but->rnapoin, prop)) + if(RNA_property_array_check(prop)) value= RNA_property_int_get_index(&but->rnapoin, prop, but->rnaindex); else value= RNA_property_int_get(&but->rnapoin, prop); break; case PROP_FLOAT: - if(RNA_property_array_length(&but->rnapoin, prop)) + if(RNA_property_array_check(prop)) value= RNA_property_float_get_index(&but->rnapoin, prop, but->rnaindex); else value= RNA_property_float_get(&but->rnapoin, prop); @@ -1459,19 +1480,20 @@ int ui_get_but_string_max_length(uiBut *but) static double ui_get_but_scale_unit(uiBut *but, double value) { - Scene *scene= CTX_data_scene((bContext *)but->block->evil_C); + UnitSettings *unit= but->block->unit; int unit_type= uiButGetUnitType(but); if(unit_type == PROP_UNIT_LENGTH) { - return value * (double)scene->unit.scale_length; + return value * (double)unit->scale_length; } else if(unit_type == PROP_UNIT_AREA) { - return value * pow(scene->unit.scale_length, 2); + return value * pow(unit->scale_length, 2); } else if(unit_type == PROP_UNIT_VOLUME) { - return value * pow(scene->unit.scale_length, 3); + return value * pow(unit->scale_length, 3); } else if(unit_type == PROP_UNIT_TIME) { /* WARNING - using evil_C :| */ + Scene *scene= CTX_data_scene(but->block->evil_C); return FRA2TIME(value); } else { @@ -1483,14 +1505,14 @@ static double ui_get_but_scale_unit(uiBut *but, double value) void ui_convert_to_unit_alt_name(uiBut *but, char *str, int maxlen) { if(ui_is_but_unit(but)) { + UnitSettings *unit= but->block->unit; int unit_type= uiButGetUnitType(but); char *orig_str; - Scene *scene= CTX_data_scene((bContext *)but->block->evil_C); orig_str= MEM_callocN(sizeof(char)*maxlen + 1, "textedit sub str"); memcpy(orig_str, str, maxlen); - bUnit_ToUnitAltName(str, maxlen, orig_str, scene->unit.system, unit_type>>16); + bUnit_ToUnitAltName(str, maxlen, orig_str, unit->system, unit_type>>16); MEM_freeN(orig_str); } @@ -1498,27 +1520,26 @@ void ui_convert_to_unit_alt_name(uiBut *but, char *str, int maxlen) static void ui_get_but_string_unit(uiBut *but, char *str, int len_max, double value, int pad) { - Scene *scene= CTX_data_scene((bContext *)but->block->evil_C); - int do_split= scene->unit.flag & USER_UNIT_OPT_SPLIT; + UnitSettings *unit= but->block->unit; + int do_split= unit->flag & USER_UNIT_OPT_SPLIT; int unit_type= uiButGetUnitType(but); int precision= but->a2; - if(scene->unit.scale_length<0.0001f) scene->unit.scale_length= 1.0f; // XXX do_versions + if(unit->scale_length<0.0001f) unit->scale_length= 1.0f; // XXX do_versions /* Sanity checks */ if(precision > PRECISION_FLOAT_MAX) precision= PRECISION_FLOAT_MAX; else if(precision==0) precision= 2; - bUnit_AsString(str, len_max, ui_get_but_scale_unit(but, value), precision, scene->unit.system, unit_type>>16, do_split, pad); + bUnit_AsString(str, len_max, ui_get_but_scale_unit(but, value), precision, unit->system, unit_type>>16, do_split, pad); } static float ui_get_but_step_unit(uiBut *but, float step_default) { - Scene *scene= CTX_data_scene((bContext *)but->block->evil_C); int unit_type= uiButGetUnitType(but)>>16; float step; - step = bUnit_ClosestScalar(ui_get_but_scale_unit(but, step_default), scene->unit.system, unit_type); + step = bUnit_ClosestScalar(ui_get_but_scale_unit(but, step_default), but->block->unit->system, unit_type); if(step > 0.0f) { /* -1 is an error value */ return (float)((double)step/ui_get_but_scale_unit(but, 1.0))*100.0f; @@ -1606,12 +1627,11 @@ static int ui_set_but_string_eval_num_unit(bContext *C, uiBut *but, const char * { char str_unit_convert[256]; const int unit_type= uiButGetUnitType(but); - Scene *scene= CTX_data_scene((bContext *)but->block->evil_C); BLI_strncpy(str_unit_convert, str, sizeof(str_unit_convert)); /* ugly, use the draw string to get the value, this could cause problems if it includes some text which resolves to a unit */ - bUnit_ReplaceString(str_unit_convert, sizeof(str_unit_convert), but->drawstr, ui_get_but_scale_unit(but, 1.0), scene->unit.system, unit_type>>16); + bUnit_ReplaceString(str_unit_convert, sizeof(str_unit_convert), but->drawstr, ui_get_but_scale_unit(but, 1.0), but->block->unit->system, unit_type>>16); return (BPY_button_exec(C, str_unit_convert, value, TRUE) != -1); } @@ -1962,7 +1982,10 @@ uiBlock *uiBeginBlock(const bContext *C, ARegion *region, const char *name, shor block->active= 1; block->dt= dt; block->evil_C= (void*)C; // XXX - if (scn) block->color_profile= (scn->r.color_mgt_flag & R_COLOR_MANAGEMENT); + if (scn) { + block->color_profile= (scn->r.color_mgt_flag & R_COLOR_MANAGEMENT); + block->unit= &scn->unit; + } BLI_strncpy(block->name, name, sizeof(block->name)); if(region) @@ -2510,12 +2533,10 @@ static uiBut *ui_def_but(uiBlock *block, int type, int retval, const char *str, static uiBut *ui_def_but_rna(uiBlock *block, int type, int retval, const char *str, int x1, int y1, short x2, short y2, PointerRNA *ptr, PropertyRNA *prop, int index, float min, float max, float a1, float a2, const char *tip) { + const PropertyType proptype= RNA_property_type(prop); uiBut *but; - PropertyType proptype; int freestr= 0, icon= 0; - proptype= RNA_property_type(prop); - /* use rna values if parameters are not specified */ if(!str) { if(type == MENU && proptype == PROP_ENUM) { @@ -2640,9 +2661,14 @@ static uiBut *ui_def_but_rna(uiBlock *block, int type, int retval, const char *s UI_DEF_BUT_RNA_DISABLE(but); } + if (but->flag & UI_BUT_UNDO && (ui_but_is_rna_undo(but) == FALSE)) { + but->flag &= ~UI_BUT_UNDO; + } + /* If this button uses units, calculate the step from this */ - if(ui_is_but_unit(but)) + if((proptype == PROP_FLOAT) && ui_is_but_unit(but)) { but->a1= ui_get_but_step_unit(but, but->a1); + } if(freestr) MEM_freeN((void *)str); @@ -2686,6 +2712,7 @@ static uiBut *ui_def_but_operator(uiBlock *block, int type, const char *opname, but= ui_def_but(block, type, -1, str, x1, y1, x2, y2, NULL, 0, 0, 0, 0, tip); but->optype= ot; but->opcontext= opcontext; + but->flag &= ~UI_BUT_UNDO; /* no need for ui_but_is_undo(), we never need undo here */ if(!ot) { but->flag |= UI_BUT_DISABLED; @@ -2715,6 +2742,7 @@ static uiBut *ui_def_but_operator_text(uiBlock *block, int type, const char *opn but= ui_def_but(block, type, -1, str, x1, y1, x2, y2, poin, min, max, a1, a2, tip); but->optype= ot; but->opcontext= opcontext; + but->flag &= ~UI_BUT_UNDO; /* no need for ui_but_is_undo(), we never need undo here */ if(!ot) { but->flag |= UI_BUT_DISABLED; diff --git a/source/blender/editors/interface/interface_draw.c b/source/blender/editors/interface/interface_draw.c index 97299a6a766..dd7d2ca765f 100644 --- a/source/blender/editors/interface/interface_draw.c +++ b/source/blender/editors/interface/interface_draw.c @@ -140,26 +140,25 @@ void uiDrawBox(int mode, float minx, float miny, float maxx, float maxy, float r glEnd(); } -static void round_box_shade_col(float *col1, float *col2, float fac) +static void round_box_shade_col(const float col1[3], float const col2[3], const float fac) { - float col[4]; + float col[3]; col[0]= (fac*col1[0] + (1.0f-fac)*col2[0]); col[1]= (fac*col1[1] + (1.0f-fac)*col2[1]); col[2]= (fac*col1[2] + (1.0f-fac)*col2[2]); - col[3]= (fac*col1[3] + (1.0f-fac)*col2[3]); - glColor4fv(col); + glColor3fv(col); } - /* linear horizontal shade within button or in outline */ /* view2d scrollers use it */ void uiDrawBoxShade(int mode, float minx, float miny, float maxx, float maxy, float rad, float shadetop, float shadedown) { float vec[7][2]= {{0.195, 0.02}, {0.383, 0.067}, {0.55, 0.169}, {0.707, 0.293}, {0.831, 0.45}, {0.924, 0.617}, {0.98, 0.805}}; - float div= maxy-miny; - float coltop[4], coldown[4], color[4]; + const float div= maxy - miny; + const float idiv= 1.0f / div; + float coltop[3], coldown[3], color[4]; int a; /* mult */ @@ -173,11 +172,9 @@ void uiDrawBoxShade(int mode, float minx, float miny, float maxx, float maxy, fl coltop[0]= color[0]+shadetop; if(coltop[0]>1.0f) coltop[0]= 1.0f; coltop[1]= color[1]+shadetop; if(coltop[1]>1.0f) coltop[1]= 1.0f; coltop[2]= color[2]+shadetop; if(coltop[2]>1.0f) coltop[2]= 1.0f; - coltop[3]= color[3]; coldown[0]= color[0]+shadedown; if(coldown[0]<0.0f) coldown[0]= 0.0f; coldown[1]= color[1]+shadedown; if(coldown[1]<0.0f) coldown[1]= 0.0f; coldown[2]= color[2]+shadedown; if(coldown[2]<0.0f) coldown[2]= 0.0f; - coldown[3]= color[3]; glShadeModel(GL_SMOOTH); glBegin(mode); @@ -189,11 +186,11 @@ void uiDrawBoxShade(int mode, float minx, float miny, float maxx, float maxy, fl glVertex2f(maxx-rad, miny); for(a=0; a<7; a++) { - round_box_shade_col(coltop, coldown, vec[a][1]/div); + round_box_shade_col(coltop, coldown, vec[a][1]*idiv); glVertex2f(maxx-rad+vec[a][0], miny+vec[a][1]); } - round_box_shade_col(coltop, coldown, rad/div); + round_box_shade_col(coltop, coldown, rad*idiv); glVertex2f(maxx, miny+rad); } else { @@ -204,11 +201,11 @@ void uiDrawBoxShade(int mode, float minx, float miny, float maxx, float maxy, fl /* corner right-top */ if(roundboxtype & 2) { - round_box_shade_col(coltop, coldown, (div-rad)/div); + round_box_shade_col(coltop, coldown, (div-rad)*idiv); glVertex2f(maxx, maxy-rad); for(a=0; a<7; a++) { - round_box_shade_col(coltop, coldown, (div-rad+vec[a][1])/div); + round_box_shade_col(coltop, coldown, (div-rad+vec[a][1])*idiv); glVertex2f(maxx-vec[a][1], maxy-rad+vec[a][0]); } round_box_shade_col(coltop, coldown, 1.0); @@ -226,11 +223,11 @@ void uiDrawBoxShade(int mode, float minx, float miny, float maxx, float maxy, fl glVertex2f(minx+rad, maxy); for(a=0; a<7; a++) { - round_box_shade_col(coltop, coldown, (div-vec[a][1])/div); + round_box_shade_col(coltop, coldown, (div-vec[a][1])*idiv); glVertex2f(minx+rad-vec[a][0], maxy-vec[a][1]); } - round_box_shade_col(coltop, coldown, (div-rad)/div); + round_box_shade_col(coltop, coldown, (div-rad)*idiv); glVertex2f(minx, maxy-rad); } else { @@ -241,11 +238,11 @@ void uiDrawBoxShade(int mode, float minx, float miny, float maxx, float maxy, fl /* corner left-bottom */ if(roundboxtype & 8) { - round_box_shade_col(coltop, coldown, rad/div); + round_box_shade_col(coltop, coldown, rad*idiv); glVertex2f(minx, miny+rad); for(a=0; a<7; a++) { - round_box_shade_col(coltop, coldown, (rad-vec[a][1])/div); + round_box_shade_col(coltop, coldown, (rad-vec[a][1])*idiv); glVertex2f(minx+vec[a][1], miny+rad-vec[a][0]); } @@ -267,7 +264,8 @@ void uiDrawBoxVerticalShade(int mode, float minx, float miny, float maxx, float { float vec[7][2]= {{0.195, 0.02}, {0.383, 0.067}, {0.55, 0.169}, {0.707, 0.293}, {0.831, 0.45}, {0.924, 0.617}, {0.98, 0.805}}; - float div= maxx-minx; + const float div= maxx - minx; + const float idiv= 1.0f / div; float colLeft[3], colRight[3], color[4]; int a; @@ -295,11 +293,11 @@ void uiDrawBoxVerticalShade(int mode, float minx, float miny, float maxx, float glVertex2f(maxx-rad, miny); for(a=0; a<7; a++) { - round_box_shade_col(colLeft, colRight, vec[a][0]/div); + round_box_shade_col(colLeft, colRight, vec[a][0]*idiv); glVertex2f(maxx-rad+vec[a][0], miny+vec[a][1]); } - round_box_shade_col(colLeft, colRight, rad/div); + round_box_shade_col(colLeft, colRight, rad*idiv); glVertex2f(maxx, miny+rad); } else { @@ -314,10 +312,10 @@ void uiDrawBoxVerticalShade(int mode, float minx, float miny, float maxx, float for(a=0; a<7; a++) { - round_box_shade_col(colLeft, colRight, (div-rad-vec[a][0])/div); + round_box_shade_col(colLeft, colRight, (div-rad-vec[a][0])*idiv); glVertex2f(maxx-vec[a][1], maxy-rad+vec[a][0]); } - round_box_shade_col(colLeft, colRight, (div-rad)/div); + round_box_shade_col(colLeft, colRight, (div-rad)*idiv); glVertex2f(maxx-rad, maxy); } else { @@ -327,11 +325,11 @@ void uiDrawBoxVerticalShade(int mode, float minx, float miny, float maxx, float /* corner left-top */ if(roundboxtype & 1) { - round_box_shade_col(colLeft, colRight, (div-rad)/div); + round_box_shade_col(colLeft, colRight, (div-rad)*idiv); glVertex2f(minx+rad, maxy); for(a=0; a<7; a++) { - round_box_shade_col(colLeft, colRight, (div-rad+vec[a][0])/div); + round_box_shade_col(colLeft, colRight, (div-rad+vec[a][0])*idiv); glVertex2f(minx+rad-vec[a][0], maxy-vec[a][1]); } @@ -349,7 +347,7 @@ void uiDrawBoxVerticalShade(int mode, float minx, float miny, float maxx, float glVertex2f(minx, miny+rad); for(a=0; a<7; a++) { - round_box_shade_col(colLeft, colRight, (vec[a][0])/div); + round_box_shade_col(colLeft, colRight, (vec[a][0])*idiv); glVertex2f(minx+vec[a][1], miny+rad-vec[a][0]); } diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c index 15f46b4eee4..173aa98374c 100644 --- a/source/blender/editors/interface/interface_handlers.c +++ b/source/blender/editors/interface/interface_handlers.c @@ -2310,13 +2310,13 @@ static float ui_numedit_apply_snapf(uiBut *but, float tempf, float softmin, floa float fac= 1.0f; if(ui_is_but_unit(but)) { - Scene *scene= CTX_data_scene((bContext *)but->block->evil_C); + UnitSettings *unit= but->block->unit; int unit_type= uiButGetUnitType(but)>>16; - if(bUnit_IsValid(scene->unit.system, unit_type)) { - fac= (float)bUnit_BaseScalar(scene->unit.system, unit_type); + if(bUnit_IsValid(unit->system, unit_type)) { + fac= (float)bUnit_BaseScalar(unit->system, unit_type); if(ELEM3(unit_type, B_UNIT_LENGTH, B_UNIT_AREA, B_UNIT_VOLUME)) { - fac /= scene->unit.scale_length; + fac /= unit->scale_length; } } } diff --git a/source/blender/editors/interface/interface_intern.h b/source/blender/editors/interface/interface_intern.h index 76a56598e14..ebc8725ad5d 100644 --- a/source/blender/editors/interface/interface_intern.h +++ b/source/blender/editors/interface/interface_intern.h @@ -332,7 +332,9 @@ struct uiBlock { void *evil_C; // XXX hack for dynamic operator enums float _hsv[3]; // XXX, only access via ui_block_hsv_get() - char color_profile; // color profile for correcting linear colors for display + char color_profile; // color profile for correcting linear colors for display + struct UnitSettings *unit; // unit system, used a lot for numeric buttons so include here rather then fetching through the scene every time. + }; typedef struct uiSafetyRct { diff --git a/source/blender/editors/interface/interface_layout.c b/source/blender/editors/interface/interface_layout.c index 4810b3fdf54..3575a8527fc 100644 --- a/source/blender/editors/interface/interface_layout.c +++ b/source/blender/editors/interface/interface_layout.c @@ -1017,12 +1017,10 @@ void uiItemFullR(uiLayout *layout, PointerRNA *ptr, PropertyRNA *prop, int index ui_item_array(layout, block, name, icon, ptr, prop, len, 0, 0, w, h, expand, slider, toggle, icon_only); /* enum item */ else if(type == PROP_ENUM && index == RNA_ENUM_VALUE) { - const char *identifier= RNA_property_identifier(prop); - if(icon && name[0] && !icon_only) uiDefIconTextButR_prop(block, ROW, 0, icon, name, 0, 0, w, h, ptr, prop, -1, 0, value, -1, -1, NULL); else if(icon) - uiDefIconButR(block, ROW, 0, icon, 0, 0, w, h, ptr, identifier, -1, 0, value, -1, -1, NULL); + uiDefIconButR_prop(block, ROW, 0, icon, 0, 0, w, h, ptr, prop, -1, 0, value, -1, -1, NULL); else uiDefButR_prop(block, ROW, 0, name, 0, 0, w, h, ptr, prop, -1, 0, value, -1, -1, NULL); } diff --git a/source/blender/editors/interface/interface_regions.c b/source/blender/editors/interface/interface_regions.c index 8bce27e366b..a55ee01202c 100644 --- a/source/blender/editors/interface/interface_regions.c +++ b/source/blender/editors/interface/interface_regions.c @@ -424,7 +424,8 @@ ARegion *ui_tooltip_create(bContext *C, ARegion *butregion, uiBut *but) if (unit_type == PROP_UNIT_ROTATION) { if (RNA_property_type(but->rnaprop) == PROP_FLOAT) { - BLI_snprintf(data->lines[data->totline], sizeof(data->lines[0]), "Radians: %f", RNA_property_float_get_index(&but->rnapoin, but->rnaprop, but->rnaindex)); + float value= RNA_property_array_check(but->rnaprop) ? RNA_property_float_get_index(&but->rnapoin, but->rnaprop, but->rnaindex) : RNA_property_float_get(&but->rnapoin, but->rnaprop); + BLI_snprintf(data->lines[data->totline], sizeof(data->lines[0]), "Radians: %f", value); data->color[data->totline]= 0x888888; data->totline++; } diff --git a/source/blender/editors/interface/interface_widgets.c b/source/blender/editors/interface/interface_widgets.c index d235fd0c16a..5da875356ea 100644 --- a/source/blender/editors/interface/interface_widgets.c +++ b/source/blender/editors/interface/interface_widgets.c @@ -180,7 +180,7 @@ void ui_draw_anti_tria(float x1, float y1, float x2, float y2, float x3, float y glEnable(GL_BLEND); glGetFloatv(GL_CURRENT_COLOR, color); - color[3]*= 0.125; + color[3] *= 0.125f; glColor4fv(color); /* for each AA step */ diff --git a/source/blender/editors/mesh/SConscript b/source/blender/editors/mesh/SConscript index 34936c025bc..b992ae5f04c 100644 --- a/source/blender/editors/mesh/SConscript +++ b/source/blender/editors/mesh/SConscript @@ -8,7 +8,7 @@ incs += ' ../../windowmanager #/intern/guardedalloc #/extern/glew/include' incs += ' ../../gpu ../../blenloader' incs += ' ../../makesrna ../../render/extern/include #/intern/elbeem/extern' -if env['OURPLATFORM'] == 'linux2': +if env['OURPLATFORM'] == 'linux': cflags='-pthread' incs += ' ../../../extern/binreloc/include' diff --git a/source/blender/editors/object/SConscript b/source/blender/editors/object/SConscript index 660643fbb0f..ca048cb59f9 100644 --- a/source/blender/editors/object/SConscript +++ b/source/blender/editors/object/SConscript @@ -10,7 +10,7 @@ incs += ' ../../render/extern/include ../../gpu' # for object_bake.c defs = [] -if env['OURPLATFORM'] == 'linux2': +if env['OURPLATFORM'] == 'linux': cflags='-pthread' incs += ' ../../../extern/binreloc/include' diff --git a/source/blender/editors/object/object_add.c b/source/blender/editors/object/object_add.c index 4660d38a208..5212bf32834 100644 --- a/source/blender/editors/object/object_add.c +++ b/source/blender/editors/object/object_add.c @@ -188,7 +188,7 @@ void ED_object_add_generic_props(wmOperatorType *ot, int do_editmode) } RNA_def_float_vector_xyz(ot->srna, "location", 3, NULL, -FLT_MAX, FLT_MAX, "Location", "Location for the newly added object", -FLT_MAX, FLT_MAX); - RNA_def_float_rotation(ot->srna, "rotation", 3, NULL, -FLT_MAX, FLT_MAX, "Rotation", "Rotation for the newly added object", -M_PI * 2.0f, M_PI * 2.0f); + RNA_def_float_rotation(ot->srna, "rotation", 3, NULL, -FLT_MAX, FLT_MAX, "Rotation", "Rotation for the newly added object", (float)-M_PI * 2.0f, (float)M_PI * 2.0f); prop = RNA_def_boolean_layer_member(ot->srna, "layers", 20, NULL, "Layer", ""); RNA_def_property_flag(prop, PROP_HIDDEN); diff --git a/source/blender/editors/object/object_bake.c b/source/blender/editors/object/object_bake.c index 679e4e58017..ee162464c70 100644 --- a/source/blender/editors/object/object_bake.c +++ b/source/blender/editors/object/object_bake.c @@ -636,14 +636,14 @@ static void apply_heights_data(void *bake_data) if(ibuf->rect_float) { float *rrgbf= ibuf->rect_float + i*4; - if(max-min > 1e-5) height= (heights[i]-min)/(max-min); + if(max-min > 1e-5f) height= (heights[i]-min)/(max-min); else height= 0; rrgbf[0]=rrgbf[1]=rrgbf[2]= height; } else { char *rrgb= (char*)ibuf->rect + i*4; - if(max-min > 1e-5) height= (heights[i]-min)/(max-min); + if(max-min > 1e-5f) height= (heights[i]-min)/(max-min); else height= 0; rrgb[0]=rrgb[1]=rrgb[2]= FTOCHAR(height); diff --git a/source/blender/editors/physics/SConscript b/source/blender/editors/physics/SConscript index 274819c918c..188416eb04c 100644 --- a/source/blender/editors/physics/SConscript +++ b/source/blender/editors/physics/SConscript @@ -10,7 +10,7 @@ incs += ' ../../makesrna ../../render/extern/include #/intern/elbeem/extern' defs = '' -if env['OURPLATFORM'] == 'linux2': +if env['OURPLATFORM'] == 'linux': cflags='-pthread' incs += ' ../../../extern/binreloc/include' diff --git a/source/blender/editors/render/SConscript b/source/blender/editors/render/SConscript index 2b9737557cd..53418500ea6 100644 --- a/source/blender/editors/render/SConscript +++ b/source/blender/editors/render/SConscript @@ -9,7 +9,7 @@ incs += ' ../../gpu' incs += ' ../../makesrna ../../render/extern/include #/intern/elbeem/extern' incs += ' ../../blenloader' -if env['OURPLATFORM'] == 'linux2': +if env['OURPLATFORM'] == 'linux': cflags='-pthread' incs += ' ../../../extern/binreloc/include' diff --git a/source/blender/editors/render/render_shading.c b/source/blender/editors/render/render_shading.c index cfed2750e18..fbdcf7ba9b3 100644 --- a/source/blender/editors/render/render_shading.c +++ b/source/blender/editors/render/render_shading.c @@ -787,7 +787,7 @@ void TEXTURE_OT_envmap_save(wmOperatorType *ot) ot->poll= envmap_save_poll; /* flags */ - ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; + ot->flag= OPTYPE_REGISTER; /* no undo since this doesnt modify the env-map */ /* properties */ //RNA_def_enum(ot->srna, "file_type", image_file_type_items, R_PNG, "File Type", "File type to save image as."); @@ -875,8 +875,6 @@ static int copy_material_exec(bContext *C, wmOperator *UNUSED(op)) copy_matcopybuf(ma); - WM_event_add_notifier(C, NC_MATERIAL, ma); - return OPERATOR_FINISHED; } @@ -891,7 +889,7 @@ void MATERIAL_OT_copy(wmOperatorType *ot) ot->exec= copy_material_exec; /* flags */ - ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; + ot->flag= OPTYPE_REGISTER; /* no undo needed since no changes are made to the material */ } static int paste_material_exec(bContext *C, wmOperator *UNUSED(op)) @@ -1015,8 +1013,6 @@ static int copy_mtex_exec(bContext *C, wmOperator *UNUSED(op)) copy_mtex_copybuf(id); - WM_event_add_notifier(C, NC_TEXTURE, NULL); - return OPERATOR_FINISHED; } @@ -1039,7 +1035,7 @@ void TEXTURE_OT_slot_copy(wmOperatorType *ot) ot->poll= copy_mtex_poll; /* flags */ - ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; + ot->flag= OPTYPE_REGISTER; /* no undo needed since no changes are made to the mtex */ } static int paste_mtex_exec(bContext *C, wmOperator *UNUSED(op)) diff --git a/source/blender/editors/screen/SConscript b/source/blender/editors/screen/SConscript index 61f3429521d..1381c820224 100644 --- a/source/blender/editors/screen/SConscript +++ b/source/blender/editors/screen/SConscript @@ -10,7 +10,7 @@ incs += ' #/intern/guardedalloc #/extern/glew/include' defs = '' -if env['OURPLATFORM'] == 'linux2': +if env['OURPLATFORM'] == 'linux': cflags='-pthread' incs += ' ../../../extern/binreloc/include' diff --git a/source/blender/editors/screen/area.c b/source/blender/editors/screen/area.c index 82986dfbcc4..bc97cd9d3ff 100644 --- a/source/blender/editors/screen/area.c +++ b/source/blender/editors/screen/area.c @@ -1406,6 +1406,7 @@ int ED_area_header_switchbutton(const bContext *C, uiBlock *block, int yco) "Displays current editor type. " "Click for menu of available types"); uiButSetFunc(but, spacefunc, NULL, NULL); + uiButClearFlag(but, UI_BUT_UNDO); /* skip undo on screen buttons */ return xco + UI_UNIT_X + 14; } @@ -1414,6 +1415,7 @@ int ED_area_header_standardbuttons(const bContext *C, uiBlock *block, int yco) { ScrArea *sa= CTX_wm_area(C); int xco= 8; + uiBut *but; if (!sa->full) xco= ED_area_header_switchbutton(C, block, yco); @@ -1421,20 +1423,22 @@ int ED_area_header_standardbuttons(const bContext *C, uiBlock *block, int yco) uiBlockSetEmboss(block, UI_EMBOSSN); if (sa->flag & HEADER_NO_PULLDOWN) { - uiDefIconButBitS(block, TOG, HEADER_NO_PULLDOWN, 0, + but= uiDefIconButBitS(block, TOG, HEADER_NO_PULLDOWN, 0, ICON_DISCLOSURE_TRI_RIGHT, xco,yco,UI_UNIT_X,UI_UNIT_Y-2, &(sa->flag), 0, 0, 0, 0, "Show pulldown menus"); } else { - uiDefIconButBitS(block, TOG, HEADER_NO_PULLDOWN, 0, + but= uiDefIconButBitS(block, TOG, HEADER_NO_PULLDOWN, 0, ICON_DISCLOSURE_TRI_DOWN, xco,yco,UI_UNIT_X,UI_UNIT_Y-2, &(sa->flag), 0, 0, 0, 0, "Hide pulldown menus"); } + uiButClearFlag(but, UI_BUT_UNDO); /* skip undo on screen buttons */ + uiBlockSetEmboss(block, UI_EMBOSS); return xco + UI_UNIT_X; diff --git a/source/blender/editors/sculpt_paint/SConscript b/source/blender/editors/sculpt_paint/SConscript index 90b56ded2cd..b3927fcee68 100644 --- a/source/blender/editors/sculpt_paint/SConscript +++ b/source/blender/editors/sculpt_paint/SConscript @@ -10,7 +10,7 @@ incs += ' ../../windowmanager #/intern/guardedalloc #/extern/glew/include' incs += ' ../../render/extern/include' incs += ' ../../gpu ../../makesrna ../../blenloader' -if env['OURPLATFORM'] == 'linux2': +if env['OURPLATFORM'] == 'linux': cflags='-pthread' incs += ' ../../../extern/binreloc/include' diff --git a/source/blender/editors/space_buttons/buttons_context.c b/source/blender/editors/space_buttons/buttons_context.c index 35500ac9518..9d2ac3fd8e2 100644 --- a/source/blender/editors/space_buttons/buttons_context.c +++ b/source/blender/editors/space_buttons/buttons_context.c @@ -910,6 +910,7 @@ void buttons_context_draw(const bContext *C, uiLayout *layout) block= uiLayoutGetBlock(row); uiBlockSetEmboss(block, UI_EMBOSSN); but= uiDefIconButBitC(block, ICONTOG, SB_PIN_CONTEXT, 0, ICON_UNPINNED, 0, 0, UI_UNIT_X, UI_UNIT_Y, &sbuts->flag, 0, 0, 0, 0, "Follow context or keep fixed datablock displayed"); + uiButClearFlag(but, UI_BUT_UNDO); /* skip undo on screen buttons */ uiButSetFunc(but, pin_cb, NULL, NULL); for(a=0; a<path->len; a++) { diff --git a/source/blender/editors/space_buttons/buttons_header.c b/source/blender/editors/space_buttons/buttons_header.c index 19c600be937..e631718b0cb 100644 --- a/source/blender/editors/space_buttons/buttons_header.c +++ b/source/blender/editors/space_buttons/buttons_header.c @@ -104,6 +104,7 @@ void buttons_header_buttons(const bContext *C, ARegion *ar) { SpaceButs *sbuts= CTX_wm_space_buts(C); uiBlock *block; + uiBut *but; int xco, yco= 2; buttons_context_compute(C, sbuts); @@ -118,33 +119,32 @@ void buttons_header_buttons(const bContext *C, ARegion *ar) xco -= UI_UNIT_X; // Default panels + uiBlockBeginAlign(block); - if(sbuts->pathflag & (1<<BCONTEXT_RENDER)) - uiDefIconButS(block, ROW, B_CONTEXT_SWITCH, ICON_SCENE, xco+=BUT_UNIT_X, yco, BUT_UNIT_X, UI_UNIT_Y, &(sbuts->mainb), 0.0, (float)BCONTEXT_RENDER, 0, 0, "Render"); - if(sbuts->pathflag & (1<<BCONTEXT_SCENE)) - uiDefIconButS(block, ROW, B_CONTEXT_SWITCH, ICON_SCENE_DATA, xco+=BUT_UNIT_X, yco, BUT_UNIT_X, UI_UNIT_Y, &(sbuts->mainb), 0.0, (float)BCONTEXT_SCENE, 0, 0, "Scene"); - if(sbuts->pathflag & (1<<BCONTEXT_WORLD)) - uiDefIconButS(block, ROW, B_CONTEXT_SWITCH, ICON_WORLD, xco+=BUT_UNIT_X, yco, BUT_UNIT_X, UI_UNIT_Y, &(sbuts->mainb), 0.0, (float)BCONTEXT_WORLD, 0, 0, "World"); - if(sbuts->pathflag & (1<<BCONTEXT_OBJECT)) - uiDefIconButS(block, ROW, B_CONTEXT_SWITCH, ICON_OBJECT_DATA, xco+=BUT_UNIT_X, yco, BUT_UNIT_X, UI_UNIT_Y, &(sbuts->mainb), 0.0, (float)BCONTEXT_OBJECT, 0, 0, "Object"); - if(sbuts->pathflag & (1<<BCONTEXT_CONSTRAINT)) - uiDefIconButS(block, ROW, B_CONTEXT_SWITCH, ICON_CONSTRAINT, xco+=BUT_UNIT_X, yco, BUT_UNIT_X, UI_UNIT_Y, &(sbuts->mainb), 0.0, (float)BCONTEXT_CONSTRAINT, 0, 0, "Object Constraints"); - if(sbuts->pathflag & (1<<BCONTEXT_MODIFIER)) - uiDefIconButS(block, ROW, B_CONTEXT_SWITCH, ICON_MODIFIER, xco+=BUT_UNIT_X, yco, BUT_UNIT_X, UI_UNIT_Y, &(sbuts->mainb), 0.0, (float)BCONTEXT_MODIFIER, 0, 0, "Modifiers"); - if(sbuts->pathflag & (1<<BCONTEXT_DATA)) - uiDefIconButS(block, ROW, B_CONTEXT_SWITCH, sbuts->dataicon, xco+=BUT_UNIT_X, yco, BUT_UNIT_X, UI_UNIT_Y, &(sbuts->mainb), 0.0, (float)BCONTEXT_DATA, 0, 0, "Object Data"); - if(sbuts->pathflag & (1<<BCONTEXT_BONE)) - uiDefIconButS(block, ROW, B_CONTEXT_SWITCH, ICON_BONE_DATA, xco+=BUT_UNIT_X, yco, BUT_UNIT_X, UI_UNIT_Y, &(sbuts->mainb), 0.0, (float)BCONTEXT_BONE, 0, 0, "Bone"); - if(sbuts->pathflag & (1<<BCONTEXT_BONE_CONSTRAINT)) - uiDefIconButS(block, ROW, B_CONTEXT_SWITCH, ICON_CONSTRAINT_BONE, xco+=BUT_UNIT_X, yco, BUT_UNIT_X, UI_UNIT_Y, &(sbuts->mainb), 0.0, (float)BCONTEXT_BONE_CONSTRAINT, 0, 0, "Bone Constraints"); - if(sbuts->pathflag & (1<<BCONTEXT_MATERIAL)) - uiDefIconButS(block, ROW, B_CONTEXT_SWITCH, ICON_MATERIAL, xco+=BUT_UNIT_X, yco, BUT_UNIT_X, UI_UNIT_Y, &(sbuts->mainb), 0.0, (float)BCONTEXT_MATERIAL, 0, 0, "Material"); - if(sbuts->pathflag & (1<<BCONTEXT_TEXTURE)) - uiDefIconButS(block, ROW, B_BUTSPREVIEW, ICON_TEXTURE, xco+=BUT_UNIT_X, yco, BUT_UNIT_X, UI_UNIT_Y, &(sbuts->mainb), 0.0, (float)BCONTEXT_TEXTURE, 0, 0, "Texture"); - if(sbuts->pathflag & (1<<BCONTEXT_PARTICLE)) - uiDefIconButS(block, ROW, B_CONTEXT_SWITCH, ICON_PARTICLES, xco+=BUT_UNIT_X, yco, BUT_UNIT_X, UI_UNIT_Y, &(sbuts->mainb), 0.0, (float)BCONTEXT_PARTICLE, 0, 0, "Particles"); - if(sbuts->pathflag & (1<<BCONTEXT_PHYSICS)) - uiDefIconButS(block, ROW, B_CONTEXT_SWITCH, ICON_PHYSICS, xco+=BUT_UNIT_X, yco, BUT_UNIT_X, UI_UNIT_Y, &(sbuts->mainb), 0.0, (float)BCONTEXT_PHYSICS, 0, 0, "Physics"); + +#define BUTTON_HEADER_CTX(_ctx, _icon, _tip) \ + if(sbuts->pathflag & (1<<_ctx)) { \ + but= uiDefIconButS(block, ROW, B_CONTEXT_SWITCH, _icon, xco+=BUT_UNIT_X, yco, BUT_UNIT_X, UI_UNIT_Y, &(sbuts->mainb), 0.0, (float)_ctx, 0, 0, _tip); \ + uiButClearFlag(but, UI_BUT_UNDO); \ + } \ + + + BUTTON_HEADER_CTX(BCONTEXT_RENDER, ICON_SCENE, "Render") + BUTTON_HEADER_CTX(BCONTEXT_SCENE, ICON_SCENE_DATA, "Scene"); + BUTTON_HEADER_CTX(BCONTEXT_WORLD, ICON_WORLD, "World"); + BUTTON_HEADER_CTX(BCONTEXT_OBJECT, ICON_OBJECT_DATA, "Object"); + BUTTON_HEADER_CTX(BCONTEXT_CONSTRAINT, ICON_CONSTRAINT, "Object Constraints"); + BUTTON_HEADER_CTX(BCONTEXT_MODIFIER, ICON_MODIFIER, "Object Modifiers"); + BUTTON_HEADER_CTX(BCONTEXT_DATA, sbuts->dataicon, "Object Data"); + BUTTON_HEADER_CTX(BCONTEXT_BONE, ICON_BONE_DATA, "Bone"); + BUTTON_HEADER_CTX(BCONTEXT_BONE_CONSTRAINT, ICON_CONSTRAINT_BONE, "Bone Constraints"); + BUTTON_HEADER_CTX(BCONTEXT_MATERIAL, ICON_MATERIAL, "Material"); + BUTTON_HEADER_CTX(BCONTEXT_TEXTURE, ICON_TEXTURE, "Textures"); + BUTTON_HEADER_CTX(BCONTEXT_PARTICLE, ICON_PARTICLES, "Particles"); + BUTTON_HEADER_CTX(BCONTEXT_PHYSICS, ICON_PHYSICS, "Physics"); + +#undef BUTTON_HEADER_CTX + xco+= BUT_UNIT_X; uiBlockEndAlign(block); diff --git a/source/blender/editors/space_file/SConscript b/source/blender/editors/space_file/SConscript index 7c55b40e816..ad96840f7b9 100644 --- a/source/blender/editors/space_file/SConscript +++ b/source/blender/editors/space_file/SConscript @@ -19,7 +19,7 @@ if env['WITH_BF_OPENEXR']: if env['WITH_BF_TIFF']: defs.append('WITH_TIFF') -if env['OURPLATFORM'] == 'linux2': +if env['OURPLATFORM'] == 'linux': cflags='-pthread' incs += ' ../../../extern/binreloc/include' diff --git a/source/blender/editors/space_image/image_ops.c b/source/blender/editors/space_image/image_ops.c index ea8c7fc0cfa..6e0d1909963 100644 --- a/source/blender/editors/space_image/image_ops.c +++ b/source/blender/editors/space_image/image_ops.c @@ -1331,7 +1331,7 @@ void IMAGE_OT_reload(wmOperatorType *ot) ot->exec= reload_exec; /* flags */ - ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; + ot->flag= OPTYPE_REGISTER; /* no undo, image buffer is not handled by undo */ } /********************** new image operator *********************/ @@ -1989,7 +1989,7 @@ void IMAGE_OT_sample_line(wmOperatorType *ot) ot->cancel= WM_gesture_straightline_cancel; /* flags */ - ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; + ot->flag= 0; /* no undo/register since this operates on the space */ WM_operator_properties_gesture_straightline(ot, CURSOR_EDIT); } diff --git a/source/blender/editors/space_info/info_ops.c b/source/blender/editors/space_info/info_ops.c index d58fb7b11f0..e09565d38e9 100644 --- a/source/blender/editors/space_info/info_ops.c +++ b/source/blender/editors/space_info/info_ops.c @@ -273,7 +273,7 @@ void FILE_OT_report_missing_files(wmOperatorType *ot) ot->exec= report_missing_files_exec; /* flags */ - ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; + ot->flag= 0; /* only reports so no need to undo/register */ } /********************* find missing files operator *********************/ diff --git a/source/blender/editors/space_node/SConscript b/source/blender/editors/space_node/SConscript index 634d4b777d9..c4309dcfca3 100644 --- a/source/blender/editors/space_node/SConscript +++ b/source/blender/editors/space_node/SConscript @@ -15,7 +15,7 @@ if env['CC'] == 'gcc': #cf.append('-Werror') pass -if env['OURPLATFORM'] == 'linux2': +if env['OURPLATFORM'] == 'linux': cflags='-pthread' incs += ' ../../../extern/binreloc/include' diff --git a/source/blender/editors/space_node/node_edit.c b/source/blender/editors/space_node/node_edit.c index 9cafc46ca53..011f9a31c93 100644 --- a/source/blender/editors/space_node/node_edit.c +++ b/source/blender/editors/space_node/node_edit.c @@ -550,14 +550,16 @@ void ED_node_set_active(Main *bmain, bNodeTree *ntree, bNode *node) } } else if(node->type==CMP_NODE_COMPOSITE) { - bNode *tnode; - - for(tnode= ntree->nodes.first; tnode; tnode= tnode->next) - if( tnode->type==CMP_NODE_COMPOSITE) - tnode->flag &= ~NODE_DO_OUTPUT; - - node->flag |= NODE_DO_OUTPUT; - ED_node_generic_update(bmain, ntree, node); + if (was_output==0) { + bNode *tnode; + + for(tnode= ntree->nodes.first; tnode; tnode= tnode->next) + if( tnode->type==CMP_NODE_COMPOSITE) + tnode->flag &= ~NODE_DO_OUTPUT; + + node->flag |= NODE_DO_OUTPUT; + ED_node_generic_update(bmain, ntree, node); + } } } else if(ntree->type==NTREE_TEXTURE) { diff --git a/source/blender/editors/space_outliner/outliner_intern.h b/source/blender/editors/space_outliner/outliner_intern.h index e87b68a9ac3..9da09144125 100644 --- a/source/blender/editors/space_outliner/outliner_intern.h +++ b/source/blender/editors/space_outliner/outliner_intern.h @@ -122,8 +122,8 @@ typedef struct TreeElement { #define OL_TOGW OL_TOG_RESTRICT_VIEWX #define OL_RNA_COLX (UI_UNIT_X*15) -#define OL_RNA_COL_SIZEX (UI_UNIT_X*7.5) -#define OL_RNA_COL_SPACEX (UI_UNIT_X*2.5) +#define OL_RNA_COL_SIZEX (UI_UNIT_X*7.5f) +#define OL_RNA_COL_SPACEX (UI_UNIT_X*2.5f) /* outliner_tree.c ----------------------------------------------- */ @@ -141,9 +141,6 @@ void outliner_build_tree(struct Main *mainvar, struct Scene *scene, struct Space void draw_outliner(const struct bContext *C); /* outliner_select.c -------------------------------------------- */ - -void outliner_select(struct SpaceOops *soops, ListBase *lb, int *index, short *selecting); - int tree_element_type_active(struct bContext *C, struct Scene *scene, struct SpaceOops *soops, TreeElement *te, TreeStoreElem *tselem, int set); int tree_element_active(struct bContext *C, struct Scene *scene, SpaceOops *soops, TreeElement *te, int set); diff --git a/source/blender/editors/space_outliner/outliner_select.c b/source/blender/editors/space_outliner/outliner_select.c index b701aecafb8..2c0a8c34747 100644 --- a/source/blender/editors/space_outliner/outliner_select.c +++ b/source/blender/editors/space_outliner/outliner_select.c @@ -104,10 +104,11 @@ /* ****************************************************** */ /* Outliner Selection (grey-blue highlight for rows) */ -void outliner_select(SpaceOops *soops, ListBase *lb, int *index, short *selecting) +static int outliner_select(SpaceOops *soops, ListBase *lb, int *index, short *selecting) { TreeElement *te; TreeStoreElem *tselem; + int change= 0; for (te= lb->first; te && *index >= 0; te=te->next, (*index)--) { tselem= TREESTORE(te); @@ -129,6 +130,8 @@ void outliner_select(SpaceOops *soops, ListBase *lb, int *index, short *selectin tselem->flag |= TSE_SELECTED; else tselem->flag &= ~TSE_SELECTED; + + change |= 1; } } else if ((tselem->flag & TSE_CLOSED)==0) { @@ -140,10 +143,12 @@ void outliner_select(SpaceOops *soops, ListBase *lb, int *index, short *selectin * function correctly */ (*index)--; - outliner_select(soops, &te->subtree, index, selecting); + change |= outliner_select(soops, &te->subtree, index, selecting); (*index)++; } } + + return change; } /* ****************************************************** */ @@ -837,11 +842,14 @@ static int outliner_item_activate(bContext *C, wmOperator *op, wmEvent *event) fmval[0], fmval[1], NULL, &row); /* select relevant row */ - outliner_select(soops, &soops->tree, &row, &selecting); + if(outliner_select(soops, &soops->tree, &row, &selecting)) { - soops->storeflag |= SO_TREESTORE_REDRAW; + soops->storeflag |= SO_TREESTORE_REDRAW; - ED_undo_push(C, "Outliner selection event"); + /* no need for undo push here, only changing outliner data which is + * scene level - campbell */ + /* ED_undo_push(C, "Outliner selection event"); */ + } } ED_region_tag_redraw(ar); diff --git a/source/blender/editors/space_sequencer/sequencer_edit.c b/source/blender/editors/space_sequencer/sequencer_edit.c index c967d60b001..24f2f5e7b4a 100644 --- a/source/blender/editors/space_sequencer/sequencer_edit.c +++ b/source/blender/editors/space_sequencer/sequencer_edit.c @@ -1203,7 +1203,7 @@ void SEQUENCER_OT_reload(struct wmOperatorType *ot) ot->poll= sequencer_edit_poll; /* flags */ - ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; + ot->flag= OPTYPE_REGISTER; /* no undo, the data changed is stored outside 'main' */ } /* reload operator */ @@ -1229,9 +1229,6 @@ void SEQUENCER_OT_refresh_all(struct wmOperatorType *ot) /* api callbacks */ ot->exec= sequencer_refresh_all_exec; ot->poll= sequencer_edit_poll; - - /* flags */ - ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; } static int sequencer_reassign_inputs_exec(bContext *C, wmOperator *op) @@ -2526,7 +2523,7 @@ void SEQUENCER_OT_copy(wmOperatorType *ot) ot->poll= sequencer_edit_poll; /* flags */ - ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; + ot->flag= OPTYPE_REGISTER; /* properties */ } diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c index 75cd250d831..2ab33669e4a 100644 --- a/source/blender/editors/space_view3d/drawobject.c +++ b/source/blender/editors/space_view3d/drawobject.c @@ -2414,7 +2414,20 @@ static void draw_em_measure_stats(View3D *v3d, RegionView3D *rv3d, Object *ob, E } } } - + + /* useful for debugging index vs shape key index */ +#if 0 + { + EditVert *eve; + int j; + UI_GetThemeColor3ubv(TH_DRAWEXTRA_FACEANG, col); + for(eve= em->verts.first, j= 0; eve; eve= eve->next, j++) { + sprintf(val, "%d:%d", j, eve->keyindex); + view3d_cached_text_draw_add(eve->co, val, 0, V3D_CACHE_TEXT_ASCII, col); + } + } +#endif + if(v3d->zbuf) { glEnable(GL_DEPTH_TEST); bglPolygonOffset(rv3d->dist, 0.0f); diff --git a/source/blender/editors/space_view3d/view3d_draw.c b/source/blender/editors/space_view3d/view3d_draw.c index 7cf95261211..f8837594ddb 100644 --- a/source/blender/editors/space_view3d/view3d_draw.c +++ b/source/blender/editors/space_view3d/view3d_draw.c @@ -721,7 +721,7 @@ static void draw_rotation_guide(RegionView3D *rv3d) { #define ROT_AXIS_DETAIL 13 const float s = 0.05f * scale; - const float step = 2.f * M_PI / ROT_AXIS_DETAIL; + const float step = 2.f * (float)(M_PI / ROT_AXIS_DETAIL); float angle; int i; @@ -1041,7 +1041,7 @@ static void drawviewborder_triangle(float x1, float x2, float y1, float y2, cons glBegin(GL_LINES); if(w > h) { if(golden) { - ofs = w * (1.0f-(1.0f/1.61803399)); + ofs = w * (1.0f-(1.0f/1.61803399f)); } else { ofs = h * (h / w); @@ -1059,7 +1059,7 @@ static void drawviewborder_triangle(float x1, float x2, float y1, float y2, cons } else { if(golden) { - ofs = h * (1.0f-(1.0f/1.61803399)); + ofs = h * (1.0f-(1.0f/1.61803399f)); } else { ofs = w * (w / h); @@ -1203,7 +1203,7 @@ static void drawviewborder(Scene *scene, ARegion *ar, View3D *v3d) if (ca->dtx & CAM_DTX_GOLDEN) { UI_ThemeColorBlendShade(TH_WIRE, TH_BACK, 0.25, 0); - drawviewborder_grid3(x1, x2, y1, y2, 1.0f-(1.0f/1.61803399)); + drawviewborder_grid3(x1, x2, y1, y2, 1.0f-(1.0f/1.61803399f)); } if (ca->dtx & CAM_DTX_GOLDEN_TRI_A) { diff --git a/source/blender/editors/space_view3d/view3d_edit.c b/source/blender/editors/space_view3d/view3d_edit.c index 3e6bbc13334..979a602b4f5 100644 --- a/source/blender/editors/space_view3d/view3d_edit.c +++ b/source/blender/editors/space_view3d/view3d_edit.c @@ -1697,7 +1697,7 @@ void VIEW3D_OT_zoom(wmOperatorType *ot) static void view_dolly_mouseloc(ARegion *ar, float orig_ofs[3], float dvec[3], float dfac) { RegionView3D *rv3d= ar->regiondata; - madd_v3_v3v3fl(rv3d->ofs, orig_ofs, dvec, -(1.0 - dfac)); + madd_v3_v3v3fl(rv3d->ofs, orig_ofs, dvec, -(1.0f - dfac)); } static void viewdolly_apply(ViewOpsData *vod, int x, int y, const short zoom_invert) @@ -1718,7 +1718,7 @@ static void viewdolly_apply(ViewOpsData *vod, int x, int y, const short zoom_inv if (zoom_invert) SWAP(float, len1, len2); - zfac = 1.0 + ((len2 - len1) * 0.01 * vod->rv3d->dist); + zfac = 1.0f + ((len2 - len1) * 0.01f * vod->rv3d->dist); } if(zfac != 1.0f) diff --git a/source/blender/editors/space_view3d/view3d_fly.c b/source/blender/editors/space_view3d/view3d_fly.c index 046037a092f..30d1a508888 100644 --- a/source/blender/editors/space_view3d/view3d_fly.c +++ b/source/blender/editors/space_view3d/view3d_fly.c @@ -867,7 +867,7 @@ static int flyApply(bContext *C, FlyInfo *fly) upvec[2]=1; mul_m3_v3(mat, upvec); /*make sure we have some z rolling*/ - if (fabs(upvec[2]) > 0.00001f) { + if (fabsf(upvec[2]) > 0.00001f) { roll= upvec[2] * -5.0f; upvec[0]= 1.0f; /*rotate the view about this axis*/ diff --git a/source/blender/editors/space_view3d/view3d_header.c b/source/blender/editors/space_view3d/view3d_header.c index 5b95ae63e56..78dcf6c9a5c 100644 --- a/source/blender/editors/space_view3d/view3d_header.c +++ b/source/blender/editors/space_view3d/view3d_header.c @@ -281,31 +281,32 @@ static char *view3d_modeselect_pup(Scene *scene) str += sprintf(str, formatstr, "Object Mode", OB_MODE_OBJECT, ICON_OBJECT_DATA); if(ob==NULL || ob->data==NULL) return string; - if(ob->id.lib || ((ID *)ob->data)->lib) return string; + if(ob->id.lib) return string; - /* if active object is editable */ - if ( ((ob->type == OB_MESH) - || (ob->type == OB_CURVE) || (ob->type == OB_SURF) || (ob->type == OB_FONT) - || (ob->type == OB_MBALL) || (ob->type == OB_LATTICE))) { - - str += sprintf(str, formatstr, "Edit Mode", OB_MODE_EDIT, ICON_EDITMODE_HLT); - } - else if (ob->type == OB_ARMATURE) { - if (ob->mode & OB_MODE_POSE) - str += sprintf(str, formatstr, "Edit Mode", OB_MODE_EDIT|OB_MODE_POSE, ICON_EDITMODE_HLT); - else + if(!((ID *)ob->data)->lib) { + /* if active object is editable */ + if ( ((ob->type == OB_MESH) + || (ob->type == OB_CURVE) || (ob->type == OB_SURF) || (ob->type == OB_FONT) + || (ob->type == OB_MBALL) || (ob->type == OB_LATTICE))) { + str += sprintf(str, formatstr, "Edit Mode", OB_MODE_EDIT, ICON_EDITMODE_HLT); - } + } + else if (ob->type == OB_ARMATURE) { + if (ob->mode & OB_MODE_POSE) + str += sprintf(str, formatstr, "Edit Mode", OB_MODE_EDIT|OB_MODE_POSE, ICON_EDITMODE_HLT); + else + str += sprintf(str, formatstr, "Edit Mode", OB_MODE_EDIT, ICON_EDITMODE_HLT); + } - if (ob->type == OB_MESH) { + if (ob->type == OB_MESH) { - str += sprintf(str, formatstr, "Sculpt Mode", OB_MODE_SCULPT, ICON_SCULPTMODE_HLT); - str += sprintf(str, formatstr, "Vertex Paint", OB_MODE_VERTEX_PAINT, ICON_VPAINT_HLT); - str += sprintf(str, formatstr, "Texture Paint", OB_MODE_TEXTURE_PAINT, ICON_TPAINT_HLT); - str += sprintf(str, formatstr, "Weight Paint", OB_MODE_WEIGHT_PAINT, ICON_WPAINT_HLT); + str += sprintf(str, formatstr, "Sculpt Mode", OB_MODE_SCULPT, ICON_SCULPTMODE_HLT); + str += sprintf(str, formatstr, "Vertex Paint", OB_MODE_VERTEX_PAINT, ICON_VPAINT_HLT); + str += sprintf(str, formatstr, "Texture Paint", OB_MODE_TEXTURE_PAINT, ICON_TPAINT_HLT); + str += sprintf(str, formatstr, "Weight Paint", OB_MODE_WEIGHT_PAINT, ICON_WPAINT_HLT); + } } - - + /* if active object is an armature */ if (ob->type==OB_ARMATURE) { str += sprintf(str, formatstr, "Pose Mode", OB_MODE_POSE, ICON_POSE_HLT); @@ -465,6 +466,7 @@ void uiTemplateHeader3D(uiLayout *layout, struct bContext *C) Object *ob= OBACT; Object *obedit = CTX_data_edit_object(C); uiBlock *block; + uiBut *but; uiLayout *row; const float dpi_fac= UI_DPI_FAC; @@ -512,9 +514,12 @@ void uiTemplateHeader3D(uiLayout *layout, struct bContext *C) block= uiLayoutGetBlock(row); if(v3d->twflag & V3D_USE_MANIPULATOR) { - uiDefIconButBitC(block, TOG, V3D_MANIP_TRANSLATE, B_MAN_TRANS, ICON_MAN_TRANS, 0,0,UI_UNIT_X,UI_UNIT_Y, &v3d->twtype, 1.0, 0.0, 0, 0, "Translate manipulator mode"); - uiDefIconButBitC(block, TOG, V3D_MANIP_ROTATE, B_MAN_ROT, ICON_MAN_ROT, 0,0,UI_UNIT_X,UI_UNIT_Y, &v3d->twtype, 1.0, 0.0, 0, 0, "Rotate manipulator mode"); - uiDefIconButBitC(block, TOG, V3D_MANIP_SCALE, B_MAN_SCALE, ICON_MAN_SCALE, 0,0,UI_UNIT_X,UI_UNIT_Y, &v3d->twtype, 1.0, 0.0, 0, 0, "Scale manipulator mode"); + but= uiDefIconButBitC(block, TOG, V3D_MANIP_TRANSLATE, B_MAN_TRANS, ICON_MAN_TRANS, 0,0,UI_UNIT_X,UI_UNIT_Y, &v3d->twtype, 1.0, 0.0, 0, 0, "Translate manipulator mode"); + uiButClearFlag(but, UI_BUT_UNDO); /* skip undo on screen buttons */ + but= uiDefIconButBitC(block, TOG, V3D_MANIP_ROTATE, B_MAN_ROT, ICON_MAN_ROT, 0,0,UI_UNIT_X,UI_UNIT_Y, &v3d->twtype, 1.0, 0.0, 0, 0, "Rotate manipulator mode"); + uiButClearFlag(but, UI_BUT_UNDO); /* skip undo on screen buttons */ + but= uiDefIconButBitC(block, TOG, V3D_MANIP_SCALE, B_MAN_SCALE, ICON_MAN_SCALE, 0,0,UI_UNIT_X,UI_UNIT_Y, &v3d->twtype, 1.0, 0.0, 0, 0, "Scale manipulator mode"); + uiButClearFlag(but, UI_BUT_UNDO); /* skip undo on screen buttons */ } if (v3d->twmode > (BIF_countTransformOrientation(C) - 1) + V3D_MANIP_CUSTOM) { @@ -522,7 +527,8 @@ void uiTemplateHeader3D(uiLayout *layout, struct bContext *C) } str_menu = BIF_menustringTransformOrientation(C, "Orientation"); - uiDefButC(block, MENU, B_MAN_MODE, str_menu,0,0,70 * dpi_fac, UI_UNIT_Y, &v3d->twmode, 0, 0, 0, 0, "Transform Orientation"); + but= uiDefButC(block, MENU, B_MAN_MODE, str_menu,0,0,70 * dpi_fac, UI_UNIT_Y, &v3d->twmode, 0, 0, 0, 0, "Transform Orientation"); + uiButClearFlag(but, UI_BUT_UNDO); /* skip undo on screen buttons */ MEM_freeN((void *)str_menu); } diff --git a/source/blender/editors/space_view3d/view3d_select.c b/source/blender/editors/space_view3d/view3d_select.c index c6835b0cad3..86112a42d99 100644 --- a/source/blender/editors/space_view3d/view3d_select.c +++ b/source/blender/editors/space_view3d/view3d_select.c @@ -1335,9 +1335,9 @@ static int mouse_select(bContext *C, const int mval[2], short extend, short obce if(oldbasact != basact) { ED_base_object_activate(C, basact); /* adds notifier */ } - - WM_event_add_notifier(C, NC_SCENE|ND_OB_SELECT, scene); } + + WM_event_add_notifier(C, NC_SCENE|ND_OB_SELECT, scene); } return retval; @@ -1841,8 +1841,8 @@ static int view3d_select_invoke(bContext *C, wmOperator *op, wmEvent *event) int retval = 0; view3d_operator_needs_opengl(C); - - if(obedit) { + + if(obedit && center==FALSE) { if(obedit->type==OB_MESH) retval = mouse_mesh(C, event->mval, extend); else if(obedit->type==OB_ARMATURE) @@ -1889,7 +1889,7 @@ void VIEW3D_OT_select(wmOperatorType *ot) /* properties */ RNA_def_boolean(ot->srna, "extend", 0, "Extend", "Extend selection instead of deselecting everything first."); - RNA_def_boolean(ot->srna, "center", 0, "Center", "Use the object center when selecting (object mode only)."); + RNA_def_boolean(ot->srna, "center", 0, "Center", "Use the object center when selecting, in editmode used to extend object selection."); RNA_def_boolean(ot->srna, "enumerate", 0, "Enumerate", "List objects under the mouse (object mode only)."); } diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c index 425e55af535..09507194969 100644 --- a/source/blender/editors/transform/transform.c +++ b/source/blender/editors/transform/transform.c @@ -1356,16 +1356,15 @@ void saveTransform(bContext *C, TransInfo *t, wmOperator *op) ToolSettings *ts = CTX_data_tool_settings(C); int constraint_axis[3] = {0, 0, 0}; int proportional = 0; + PropertyRNA *prop; - if (RNA_struct_find_property(op->ptr, "value")) - { - if (t->flag & T_AUTOVALUES) - { - RNA_float_set_array(op->ptr, "value", t->auto_values); + if ((prop= RNA_struct_find_property(op->ptr, "value"))) { + float *values= (t->flag & T_AUTOVALUES) ? t->auto_values : t->values; + if (RNA_property_array_check(prop)) { + RNA_property_float_set_array(op->ptr, prop, values); } - else - { - RNA_float_set_array(op->ptr, "value", t->values); + else { + RNA_property_float_set(op->ptr, prop, values[0]); } } @@ -4670,7 +4669,7 @@ static int createSlideVerts(TransInfo *t) uv_new = tf->uv[k]; if (ev->tmp.l) { - if (fabs(suv->origuv[0]-uv_new[0]) > 0.0001f || fabs(suv->origuv[1]-uv_new[1]) > 0.0001f) { + if (fabsf(suv->origuv[0]-uv_new[0]) > 0.0001f || fabs(suv->origuv[1]-uv_new[1]) > 0.0001f) { ev->tmp.l = -1; /* Tag as invalid */ BLI_linklist_free(suv->fuv_list,NULL); suv->fuv_list = NULL; diff --git a/source/blender/editors/uvedit/uvedit_unwrap_ops.c b/source/blender/editors/uvedit/uvedit_unwrap_ops.c index ae6836446fa..e8a7896abd5 100644 --- a/source/blender/editors/uvedit/uvedit_unwrap_ops.c +++ b/source/blender/editors/uvedit/uvedit_unwrap_ops.c @@ -205,11 +205,7 @@ static ParamHandle *construct_param_handle(Scene *scene, EditMesh *em, short imp float *uv[4]; int nverts; - if(scene->toolsettings->uv_flag & UV_SYNC_SELECTION) { - if(efa->h) - continue; - } - else if((efa->h) || (sel && (efa->f & SELECT)==0)) + if((efa->h) || (sel && (efa->f & SELECT)==0)) continue; tf= (MTFace *)CustomData_em_get(&em->fdata, efa->data, CD_MTFACE); @@ -586,7 +582,7 @@ void ED_uvedit_live_unwrap_begin(Scene *scene, Object *obedit) return; } - liveHandle = construct_param_handle(scene, em, 0, fillholes, 1, 1); + liveHandle = construct_param_handle(scene, em, 0, fillholes, 0, 1); param_lscm_begin(liveHandle, PARAM_TRUE, abf); BKE_mesh_end_editmesh(obedit->data, em); |