Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2011-08-24 06:29:45 +0400
committerCampbell Barton <ideasman42@gmail.com>2011-08-24 06:29:45 +0400
commitfd4575b2e3e47fb331ac6c9b30fb23cfb05a53ae (patch)
treefc22ef5086c488010fbc3d5058198d1686260562 /source/blender/editors
parent98f87b77f40b5617409ccc026be604fcaaff9f8e (diff)
parentf9bffb3ca0ca88a7e774b0ee0da1d384707f0495 (diff)
svn merge -r39493:39664 https://svn.blender.org/svnroot/bf-blender/trunk/blender
Diffstat (limited to 'source/blender/editors')
-rw-r--r--source/blender/editors/armature/SConscript2
-rw-r--r--source/blender/editors/armature/editarmature.c14
-rw-r--r--source/blender/editors/interface/interface.c80
-rw-r--r--source/blender/editors/interface/interface_draw.c48
-rw-r--r--source/blender/editors/interface/interface_handlers.c8
-rw-r--r--source/blender/editors/interface/interface_intern.h4
-rw-r--r--source/blender/editors/interface/interface_layout.c4
-rw-r--r--source/blender/editors/interface/interface_widgets.c2
-rw-r--r--source/blender/editors/mesh/SConscript2
-rw-r--r--source/blender/editors/object/SConscript2
-rw-r--r--source/blender/editors/object/object_add.c2
-rw-r--r--source/blender/editors/object/object_bake.c4
-rw-r--r--source/blender/editors/physics/SConscript2
-rw-r--r--source/blender/editors/render/SConscript2
-rw-r--r--source/blender/editors/render/render_shading.c10
-rw-r--r--source/blender/editors/screen/SConscript2
-rw-r--r--source/blender/editors/screen/area.c8
-rw-r--r--source/blender/editors/sculpt_paint/SConscript2
-rw-r--r--source/blender/editors/space_buttons/buttons_context.c1
-rw-r--r--source/blender/editors/space_buttons/buttons_header.c52
-rw-r--r--source/blender/editors/space_console/space_console.c5
-rw-r--r--source/blender/editors/space_file/SConscript2
-rw-r--r--source/blender/editors/space_image/image_ops.c246
-rw-r--r--source/blender/editors/space_info/info_ops.c2
-rw-r--r--source/blender/editors/space_node/SConscript2
-rw-r--r--source/blender/editors/space_node/node_edit.c18
-rw-r--r--source/blender/editors/space_outliner/outliner_intern.h7
-rw-r--r--source/blender/editors/space_outliner/outliner_select.c18
-rw-r--r--source/blender/editors/space_sequencer/sequencer_edit.c7
-rw-r--r--source/blender/editors/space_view3d/drawobject.c13
-rw-r--r--source/blender/editors/space_view3d/view3d_draw.c8
-rw-r--r--source/blender/editors/space_view3d/view3d_edit.c4
-rw-r--r--source/blender/editors/space_view3d/view3d_fly.c2
-rw-r--r--source/blender/editors/space_view3d/view3d_header.c13
-rw-r--r--source/blender/editors/space_view3d/view3d_ops.c10
-rw-r--r--source/blender/editors/space_view3d/view3d_select.c18
-rw-r--r--source/blender/editors/transform/transform.c15
-rw-r--r--source/blender/editors/uvedit/uvedit_unwrap_ops.c15
38 files changed, 375 insertions, 281 deletions
diff --git a/source/blender/editors/armature/SConscript b/source/blender/editors/armature/SConscript
index e9694bab63f..23e4da5ca41 100644
--- a/source/blender/editors/armature/SConscript
+++ b/source/blender/editors/armature/SConscript
@@ -8,7 +8,7 @@ incs += ' ../../windowmanager #/intern/guardedalloc #/extern/glew/include'
incs += ' ../../render/extern/include ../../bmesh'
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/armature/editarmature.c b/source/blender/editors/armature/editarmature.c
index 9a1c2737a9b..d6c6e73bd1a 100644
--- a/source/blender/editors/armature/editarmature.c
+++ b/source/blender/editors/armature/editarmature.c
@@ -5403,12 +5403,14 @@ void ED_armature_bone_rename(bArmature *arm, char *oldnamep, char *newnamep)
ScrArea *sa;
/* add regions */
for(sa= screen->areabase.first; sa; sa= sa->next) {
- SpaceLink *sl= sa->spacedata.first;
- if(sl->spacetype == SPACE_VIEW3D) {
- View3D *v3d= (View3D *)sl;
- if(v3d->ob_centre && v3d->ob_centre->data == arm) {
- if (!strcmp(v3d->ob_centre_bone, oldname)) {
- BLI_strncpy(v3d->ob_centre_bone, newname, MAXBONENAME);
+ SpaceLink *sl;
+ for (sl= sa->spacedata.first; sl; sl= sl->next) {
+ if(sl->spacetype==SPACE_VIEW3D) {
+ View3D *v3d= (View3D *)sl;
+ if(v3d->ob_centre && v3d->ob_centre->data == arm) {
+ if (!strcmp(v3d->ob_centre_bone, oldname)) {
+ BLI_strncpy(v3d->ob_centre_bone, newname, MAXBONENAME);
+ }
}
}
}
diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c
index e31e3a26b40..a5ceb8bdb19 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);
}
@@ -1958,7 +1978,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)
@@ -2506,12 +2529,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) {
@@ -2636,9 +2657,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);
@@ -2682,6 +2708,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;
@@ -2711,6 +2738,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 6f3ca2bf003..3bd29f8de3e 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 242210e01bb..40b98bebcd0 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_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 dc352e07fec..88df192c2fa 100644
--- a/source/blender/editors/mesh/SConscript
+++ b/source/blender/editors/mesh/SConscript
@@ -9,7 +9,7 @@ incs += ' ../../gpu ../../blenloader'
incs += ' ../../makesrna ../../render/extern/include #/intern/elbeem/extern'
incs += ' ../../bmesh ../uvedit '
-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 5db12f32d8b..d3e7df92471 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 6689991bfef..18cafd77b45 100644
--- a/source/blender/editors/object/object_add.c
+++ b/source/blender/editors/object/object_add.c
@@ -182,7 +182,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 af755e06bd4..67660ef51ea 100644
--- a/source/blender/editors/object/object_bake.c
+++ b/source/blender/editors/object/object_bake.c
@@ -658,14 +658,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 dad0e25ca5e..a478b2afb1c 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 bd6dcf73546..1f93db653f5 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 ../../bmesh'
-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 05c80d42ecf..158b017b1a2 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 6370c9d3153..ade26a0b80f 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 829a2760d1a..8f1f47b5004 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 ../../bmesh'
-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 8e1a4b2d16c..0d81a84deea 100644
--- a/source/blender/editors/space_buttons/buttons_context.c
+++ b/source/blender/editors/space_buttons/buttons_context.c
@@ -904,6 +904,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_console/space_console.c b/source/blender/editors/space_console/space_console.c
index 890a6cf545a..52c5100900d 100644
--- a/source/blender/editors/space_console/space_console.c
+++ b/source/blender/editors/space_console/space_console.c
@@ -165,8 +165,11 @@ static void id_drop_copy(wmDrag *drag, wmDropBox *drop)
{
char text[64];
ID *id= drag->poin;
+ char id_esc[(sizeof(id->name) - 2) * 2];
- snprintf(text, sizeof(text), "bpy.data.%s['%s']", BKE_idcode_to_name_plural(GS(id->name)), id->name+2);
+ BLI_strescape(id_esc, id->name+2, sizeof(id_esc));
+
+ snprintf(text, sizeof(text), "bpy.data.%s[\"%s\"]", BKE_idcode_to_name_plural(GS(id->name)), id_esc);
/* copy drag path to properties */
RNA_string_set(drop->ptr, "text", text);
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..d483dd45f7f 100644
--- a/source/blender/editors/space_image/image_ops.c
+++ b/source/blender/editors/space_image/image_ops.c
@@ -938,9 +938,100 @@ void IMAGE_OT_replace(wmOperatorType *ot)
/******************** save image as operator ********************/
+typedef struct {
+ /* matching scene->r settings */
+ short planes, imtype, subimtype, quality;
+ char filepath[FILE_MAX]; /* keep absolute */
+} SaveImageOptions;
+
+static void save_image_options_defaults(SaveImageOptions *simopts)
+{
+ simopts->planes= R_PLANES24;
+ simopts->imtype= R_PNG;
+ simopts->subimtype= 0;
+ simopts->quality= 90;
+ simopts->filepath[0]= '\0';
+}
+
+static int save_image_options_init(SaveImageOptions *simopts, SpaceImage *sima, Scene *scene, const short guess_path)
+{
+ void *lock;
+ ImBuf *ibuf= ED_space_image_acquire_buffer(sima, &lock);
+
+ if(ibuf) {
+ Image *ima= sima->image;
+ RenderResult *rr= BKE_image_acquire_renderresult(scene, ima);
+
+ simopts->planes= ibuf->depth;
+
+ /* cant save multilayer sequence, ima->rr isn't valid for a specific frame */
+ if(rr && !(ima->source==IMA_SRC_SEQUENCE && ima->type==IMA_TYPE_MULTILAYER))
+ simopts->imtype= R_MULTILAYER;
+ else if(ima->type==IMA_TYPE_R_RESULT)
+ simopts->imtype= scene->r.imtype;
+ else if (ima->source == IMA_SRC_GENERATED)
+ simopts->imtype= R_PNG;
+ else
+ simopts->imtype= BKE_ftype_to_imtype(ibuf->ftype);
+
+ simopts->subimtype= scene->r.subimtype; /* XXX - this is lame, we need to make these available too! */
+ simopts->quality= ibuf->ftype & 0xff;
+
+ BLI_strncpy(simopts->filepath, ibuf->name, sizeof(simopts->filepath));
+
+ /* sanitize all settings */
+
+ /* unlikely but just incase */
+ if (ELEM3(simopts->planes, R_PLANESBW, R_PLANES24, R_PLANES32) == 0) {
+ simopts->planes= 32;
+ }
+
+ /* some formats dont use quality so fallback to scenes quality */
+ if (simopts->quality == 0) {
+ simopts->quality= scene->r.quality;
+ }
+
+ /* check for empty path */
+ if(guess_path && simopts->filepath[0]==0) {
+ if ( (G.ima[0] == '/') && (G.ima[1] == '/') && (G.ima[2] == '\0') ) {
+ BLI_strncpy(simopts->filepath, "//untitled", FILE_MAX);
+ } else {
+ BLI_strncpy(simopts->filepath, G.ima, FILE_MAX);
+ }
+ BLI_path_abs(simopts->filepath, G.main->name);
+ }
+
+ /* cleanup */
+ BKE_image_release_renderresult(scene, ima);
+ }
+
+ ED_space_image_release_buffer(sima, lock);
+
+ return (ibuf != NULL);
+}
+
+static void save_image_options_from_op(SaveImageOptions *simopts, wmOperator *op)
+{
+ if (RNA_property_is_set(op->ptr, "color_mode")) simopts->planes= RNA_enum_get(op->ptr, "color_mode");
+ if (RNA_property_is_set(op->ptr, "file_format")) simopts->imtype= RNA_enum_get(op->ptr, "file_format");
+ // if (RNA_property_is_set(op->ptr, "subimtype")) simopts->subimtype= RNA_enum_get(op->ptr, "subimtype"); // XXX
+ if (RNA_property_is_set(op->ptr, "file_quality")) simopts->quality= RNA_int_get(op->ptr, "file_quality");
+
+ if (RNA_property_is_set(op->ptr, "filepath")) RNA_string_get(op->ptr, "filepath", simopts->filepath);
+}
+
+static void save_image_options_to_op(SaveImageOptions *simopts, wmOperator *op)
+{
+ RNA_enum_set(op->ptr, "color_mode", simopts->planes);
+ RNA_enum_set(op->ptr, "file_format", simopts->imtype);
+ // RNA_enum_set(op->ptr, "subimtype", simopts->subimtype);
+ RNA_int_set(op->ptr, "file_quality", simopts->quality);
+ RNA_string_set(op->ptr, "filepath", simopts->filepath);
+}
+
/* assumes name is FILE_MAX */
/* ima->name and ibuf->name should end up the same */
-static void save_image_doit(bContext *C, SpaceImage *sima, Scene *scene, wmOperator *op, char *path, int do_newpath)
+static void save_image_doit(bContext *C, SpaceImage *sima, wmOperator *op, SaveImageOptions *simopts, int do_newpath)
{
Image *ima= ED_space_image(sima);
void *lock;
@@ -952,18 +1043,17 @@ static void save_image_doit(bContext *C, SpaceImage *sima, Scene *scene, wmOpera
const short save_copy= (RNA_struct_find_property(op->ptr, "copy") && RNA_boolean_get(op->ptr, "copy"));
short ok= FALSE;
- BLI_path_abs(path, bmain->name);
/* old global to ensure a 2nd save goes to same dir */
- BLI_strncpy(G.ima, path, sizeof(G.ima));
+ BLI_strncpy(G.ima, simopts->filepath, sizeof(G.ima));
WM_cursor_wait(1);
if(ima->type == IMA_TYPE_R_RESULT) {
/* enforce user setting for RGB or RGBA, but skip BW */
- if(scene->r.planes==32) {
+ if(simopts->planes==32) {
ibuf->depth= 32;
}
- else if(scene->r.planes==24) {
+ else if(simopts->planes==24) {
ibuf->depth= 24;
}
}
@@ -974,15 +1064,12 @@ static void save_image_doit(bContext *C, SpaceImage *sima, Scene *scene, wmOpera
ibuf->depth= BKE_alphatest_ibuf(ibuf) ? 32 : 24;
}
}
-
- if(scene->r.scemode & R_EXTENSION) {
- BKE_add_image_extension(path, sima->imtypenr);
- }
- if(sima->imtypenr==R_MULTILAYER) {
+ if(simopts->imtype==R_MULTILAYER) {
+ Scene *scene= CTX_data_scene(C);
RenderResult *rr= BKE_image_acquire_renderresult(scene, ima);
if(rr) {
- RE_WriteRenderResult(rr, path, scene->r.quality);
+ RE_WriteRenderResult(rr, simopts->filepath, simopts->quality);
ok= TRUE;
}
else {
@@ -990,23 +1077,23 @@ static void save_image_doit(bContext *C, SpaceImage *sima, Scene *scene, wmOpera
}
BKE_image_release_renderresult(scene, ima);
}
- else if (BKE_write_ibuf(ibuf, path, sima->imtypenr, scene->r.subimtype, scene->r.quality)) {
+ else if (BKE_write_ibuf(ibuf, simopts->filepath, simopts->imtype, simopts->subimtype, simopts->quality)) {
ok= TRUE;
}
if(ok) {
if(relative)
- BLI_path_rel(path, bmain->name); /* only after saving */
+ BLI_path_rel(simopts->filepath, bmain->name); /* only after saving */
if(ibuf->name[0]==0) {
- BLI_strncpy(ibuf->name, path, sizeof(ibuf->name));
- BLI_strncpy(ima->name, path, sizeof(ima->name));
+ BLI_strncpy(ibuf->name, simopts->filepath, sizeof(ibuf->name));
+ BLI_strncpy(ima->name, simopts->filepath, sizeof(ima->name));
}
if(!save_copy) {
if(do_newpath) {
- BLI_strncpy(ima->name, path, sizeof(ima->name));
- BLI_strncpy(ibuf->name, path, sizeof(ibuf->name));
+ BLI_strncpy(ima->name, simopts->filepath, sizeof(ima->name));
+ BLI_strncpy(ibuf->name, simopts->filepath, sizeof(ibuf->name));
}
ibuf->userflags &= ~IB_BITMAPDIRTY;
@@ -1034,7 +1121,7 @@ static void save_image_doit(bContext *C, SpaceImage *sima, Scene *scene, wmOpera
}
}
else {
- BKE_reportf(op->reports, RPT_ERROR, "Couldn't write image: %s", path);
+ BKE_reportf(op->reports, RPT_ERROR, "Couldn't write image: %s", simopts->filepath);
}
@@ -1049,17 +1136,14 @@ static void save_image_doit(bContext *C, SpaceImage *sima, Scene *scene, wmOpera
static int save_as_exec(bContext *C, wmOperator *op)
{
SpaceImage *sima= CTX_wm_space_image(C);
- Scene *scene= CTX_data_scene(C);
- Image *ima = ED_space_image(sima);
- char str[FILE_MAX];
-
- if(!ima)
- return OPERATOR_CANCELLED;
+ SaveImageOptions simopts;
- sima->imtypenr= RNA_enum_get(op->ptr, "file_type");
- RNA_string_get(op->ptr, "filepath", str);
+ /* just incase to initialize values,
+ * these should be set on invoke or by the caller. */
+ save_image_options_defaults(&simopts);
+ save_image_options_from_op(&simopts, op);
- save_image_doit(C, sima, scene, op, str, TRUE);
+ save_image_doit(C, sima, op, &simopts, TRUE);
return OPERATOR_FINISHED;
}
@@ -1069,7 +1153,7 @@ static int save_as_check(bContext *UNUSED(C), wmOperator *op)
{
char filepath[FILE_MAX];
RNA_string_get(op->ptr, "filepath", filepath);
- if(BKE_add_image_extension(filepath, RNA_enum_get(op->ptr, "file_type"))) {
+ if(BKE_add_image_extension(filepath, RNA_enum_get(op->ptr, "file_format"))) {
RNA_string_set(op->ptr, "filepath", filepath);
return TRUE;
}
@@ -1081,65 +1165,33 @@ static int save_as_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
SpaceImage *sima= CTX_wm_space_image(C);
Image *ima = ED_space_image(sima);
Scene *scene= CTX_data_scene(C);
- ImBuf *ibuf;
- char filename[FILE_MAX];
-
- void *lock;
+ SaveImageOptions simopts;
if(!RNA_property_is_set(op->ptr, "relative_path"))
RNA_boolean_set(op->ptr, "relative_path", U.flag & USER_RELPATHS);
if(RNA_property_is_set(op->ptr, "filepath"))
return save_as_exec(C, op);
-
- if(!ima)
- return OPERATOR_CANCELLED;
-
- /* always opens fileselect */
- ibuf= ED_space_image_acquire_buffer(sima, &lock);
-
- if(ibuf) {
- /* cant save multilayer sequence, ima->rr isn't valid for a specific frame */
- if(ima->rr && !(ima->source==IMA_SRC_SEQUENCE && ima->type==IMA_TYPE_MULTILAYER))
- sima->imtypenr= R_MULTILAYER;
- else if(ima->type==IMA_TYPE_R_RESULT)
- sima->imtypenr= scene->r.imtype;
- else if (ima->source == IMA_SRC_GENERATED)
- sima->imtypenr= R_PNG;
- else
- sima->imtypenr= BKE_ftype_to_imtype(ibuf->ftype);
- RNA_enum_set(op->ptr, "file_type", sima->imtypenr);
-
- if(ibuf->name[0]==0)
- if ( (G.ima[0] == '/') && (G.ima[1] == '/') && (G.ima[2] == '\0') ) {
- BLI_strncpy(filename, "//untitled", FILE_MAX);
- } else {
- BLI_strncpy(filename, G.ima, FILE_MAX);
- }
- else
- BLI_strncpy(filename, ibuf->name, FILE_MAX);
-
- /* enable save_copy by default for render results */
- if(ELEM(ima->type, IMA_TYPE_R_RESULT, IMA_TYPE_COMPOSITE) && !RNA_property_is_set(op->ptr, "copy")) {
- RNA_boolean_set(op->ptr, "copy", TRUE);
- }
-
- // XXX note: we can give default menu enums to operator for this
- image_filesel(C, op, filename);
+ if (save_image_options_init(&simopts, sima, scene, TRUE) == 0)
+ return OPERATOR_CANCELLED;
+ save_image_options_to_op(&simopts, op);
- ED_space_image_release_buffer(sima, lock);
-
- return OPERATOR_RUNNING_MODAL;
+ /* enable save_copy by default for render results */
+ if(ELEM(ima->type, IMA_TYPE_R_RESULT, IMA_TYPE_COMPOSITE) && !RNA_property_is_set(op->ptr, "copy")) {
+ RNA_boolean_set(op->ptr, "copy", TRUE);
}
- ED_space_image_release_buffer(sima, lock);
+ // XXX note: we can give default menu enums to operator for this
+ image_filesel(C, op, simopts.filepath);
- return OPERATOR_CANCELLED;
+ return OPERATOR_RUNNING_MODAL;
}
void IMAGE_OT_save_as(wmOperatorType *ot)
{
+ PropertyRNA *prop;
+
/* identifiers */
ot->name= "Save As Image";
ot->idname= "IMAGE_OT_save_as";
@@ -1154,7 +1206,13 @@ void IMAGE_OT_save_as(wmOperatorType *ot)
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
/* properties */
- RNA_def_enum(ot->srna, "file_type", image_file_type_items, R_PNG, "File Type", "File type to save image as.");
+
+ /* format options */
+ RNA_def_enum(ot->srna, "file_format", image_file_type_items, R_PNG, "File Type", "File type to save image as.");
+ RNA_def_enum(ot->srna, "color_mode", image_color_mode_items, R_PLANES24, "Channels", "Image channels to save");
+ prop= RNA_def_int(ot->srna, "file_quality", 90, 0, 100, "Quality", "", 0, 100);
+ RNA_def_property_subtype(prop, PROP_PERCENTAGE);
+
WM_operator_properties_filesel(ot, FOLDERFILE|IMAGEFILE|MOVIEFILE, FILE_SPECIAL, FILE_SAVE, WM_FILESEL_FILEPATH|WM_FILESEL_RELPATH);
RNA_def_boolean(ot->srna, "copy", 0, "Copy", "Create a new image file without modifying the current image in blender");
@@ -1164,45 +1222,19 @@ void IMAGE_OT_save_as(wmOperatorType *ot)
static int save_exec(bContext *C, wmOperator *op)
{
- Main *bmain= CTX_data_main(C);
SpaceImage *sima= CTX_wm_space_image(C);
- Image *ima = ED_space_image(sima);
- void *lock;
- ImBuf *ibuf= ED_space_image_acquire_buffer(sima, &lock);
Scene *scene= CTX_data_scene(C);
- RenderResult *rr;
- char name[FILE_MAX];
+ SaveImageOptions simopts;
- if(!ima || !ibuf) {
- ED_space_image_release_buffer(sima, lock);
+ if (save_image_options_init(&simopts, sima, scene, FALSE) == 0)
return OPERATOR_CANCELLED;
- }
+ save_image_options_from_op(&simopts, op);
- /* if exists, saves over without fileselect */
-
- BLI_strncpy(name, ima->name, FILE_MAX);
- if(name[0]==0)
- BLI_strncpy(name, G.ima, FILE_MAX);
- else
- BLI_path_abs(name, bmain->name);
-
- if(BLI_exists(name) && BLI_is_writable(name)) {
- rr= BKE_image_acquire_renderresult(scene, ima);
-
- if(rr)
- sima->imtypenr= R_MULTILAYER;
- else
- sima->imtypenr= BKE_ftype_to_imtype(ibuf->ftype);
-
- BKE_image_release_renderresult(scene, ima);
- ED_space_image_release_buffer(sima, lock);
-
- save_image_doit(C, sima, scene, op, name, FALSE);
+ if (BLI_exists(simopts.filepath) && BLI_is_writable(simopts.filepath)) {
+ save_image_doit(C, sima, op, &simopts, FALSE);
}
else {
- ED_space_image_release_buffer(sima, lock);
-
- BKE_report(op->reports, RPT_ERROR, "Can not save image.");
+ BKE_reportf(op->reports, RPT_ERROR, "Can not save image, path '%s' is not writable.", simopts.filepath);
return OPERATOR_CANCELLED;
}
@@ -1331,7 +1363,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 +2021,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 6a5556e3e51..a21b27502a8 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 85bbbd4fffb..cf4ce9c06a8 100644
--- a/source/blender/editors/space_outliner/outliner_intern.h
+++ b/source/blender/editors/space_outliner/outliner_intern.h
@@ -124,8 +124,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 ----------------------------------------------- */
@@ -143,9 +143,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 620a936a944..46a9bde8267 100644
--- a/source/blender/editors/space_outliner/outliner_select.c
+++ b/source/blender/editors/space_outliner/outliner_select.c
@@ -106,10 +106,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);
@@ -131,6 +132,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) {
@@ -142,10 +145,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;
}
/* ****************************************************** */
@@ -839,11 +844,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 5429f0ee98f..e876da41bd9 100644
--- a/source/blender/editors/space_sequencer/sequencer_edit.c
+++ b/source/blender/editors/space_sequencer/sequencer_edit.c
@@ -1202,7 +1202,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 */
@@ -1228,9 +1228,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)
@@ -2525,7 +2522,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 06a88cd7866..59b46526596 100644
--- a/source/blender/editors/space_view3d/drawobject.c
+++ b/source/blender/editors/space_view3d/drawobject.c
@@ -2435,6 +2435,19 @@ static void draw_em_measure_stats(View3D *v3d, RegionView3D *rv3d,
}
}
+ /* 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 c85f7d3af8a..e4c316a91f2 100644
--- a/source/blender/editors/space_view3d/view3d_header.c
+++ b/source/blender/editors/space_view3d/view3d_header.c
@@ -461,6 +461,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;
@@ -514,9 +515,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) {
@@ -524,7 +528,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_ops.c b/source/blender/editors/space_view3d/view3d_ops.c
index e47cb1db753..8416b37fd5e 100644
--- a/source/blender/editors/space_view3d/view3d_ops.c
+++ b/source/blender/editors/space_view3d/view3d_ops.c
@@ -263,9 +263,13 @@ void view3d_keymap(wmKeyConfig *keyconf)
/* selection*/
WM_keymap_add_item(keymap, "VIEW3D_OT_select", SELECTMOUSE, KM_PRESS, 0, 0);
- RNA_boolean_set(WM_keymap_add_item(keymap, "VIEW3D_OT_select", SELECTMOUSE, KM_PRESS, KM_SHIFT, 0)->ptr, "extend", TRUE);
- RNA_boolean_set(WM_keymap_add_item(keymap, "VIEW3D_OT_select", SELECTMOUSE, KM_PRESS, KM_CTRL, 0)->ptr, "center", TRUE);
- RNA_boolean_set(WM_keymap_add_item(keymap, "VIEW3D_OT_select", SELECTMOUSE, KM_PRESS, KM_ALT, 0)->ptr, "enumerate", TRUE);
+ kmi = WM_keymap_add_item(keymap, "VIEW3D_OT_select", SELECTMOUSE, KM_PRESS, KM_SHIFT, 0);
+ RNA_boolean_set(kmi->ptr, "extend", TRUE);
+ kmi= WM_keymap_add_item(keymap, "VIEW3D_OT_select", SELECTMOUSE, KM_PRESS, KM_CTRL, 0);
+ RNA_boolean_set(kmi->ptr, "center", TRUE);
+ RNA_boolean_set(kmi->ptr, "object", TRUE); /* use Ctrl+Select for 2 purposes */
+ kmi= WM_keymap_add_item(keymap, "VIEW3D_OT_select", SELECTMOUSE, KM_PRESS, KM_ALT, 0);
+ RNA_boolean_set(kmi->ptr, "enumerate", TRUE);
/* selection key-combinations */
kmi = WM_keymap_add_item(keymap, "VIEW3D_OT_select", SELECTMOUSE, KM_PRESS, KM_SHIFT|KM_CTRL, 0);
diff --git a/source/blender/editors/space_view3d/view3d_select.c b/source/blender/editors/space_view3d/view3d_select.c
index 652682a2257..78d2d27cd79 100644
--- a/source/blender/editors/space_view3d/view3d_select.c
+++ b/source/blender/editors/space_view3d/view3d_select.c
@@ -1237,8 +1237,8 @@ static int mouse_select(bContext *C, const int mval[2], short extend, short obce
if(BASACT && BASACT->next) startbase= BASACT->next;
/* This block uses the control key to make the object selected by its center point rather than its contents */
- /* XXX later on, in editmode do not activate */
- if(vc.obedit==NULL && obcenter) {
+ /* in editmode do not activate */
+ if(obcenter) {
/* note; shift+alt goes to group-flush-selecting */
if(enumerate) {
@@ -1844,11 +1844,22 @@ static int view3d_select_invoke(bContext *C, wmOperator *op, wmEvent *event)
short extend= RNA_boolean_get(op->ptr, "extend");
short center= RNA_boolean_get(op->ptr, "center");
short enumerate= RNA_boolean_get(op->ptr, "enumerate");
+ short object= RNA_boolean_get(op->ptr, "object");
int retval = 0;
view3d_operator_needs_opengl(C);
- if(obedit && center==FALSE) {
+ if(object) {
+ obedit= NULL;
+ obact= NULL;
+
+ /* ack, this is incorrect but to do this correctly we would need an
+ * alternative editmode/objectmode keymap, this copies the functionality
+ * from 2.4x where Ctrl+Select in editmode does object select only */
+ center= FALSE;
+ }
+
+ if(obedit && object==FALSE) {
if(obedit->type==OB_MESH)
retval = mouse_mesh(C, event->mval, extend);
else if(obedit->type==OB_ARMATURE)
@@ -1897,6 +1908,7 @@ void VIEW3D_OT_select(wmOperatorType *ot)
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, in editmode used to extend object selection.");
RNA_def_boolean(ot->srna, "enumerate", 0, "Enumerate", "List objects under the mouse (object mode only).");
+ RNA_def_boolean(ot->srna, "object", 0, "Object", "Use object selection (editmode only).");
}
diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c
index 0637f46ddb5..44704afc520 100644
--- a/source/blender/editors/transform/transform.c
+++ b/source/blender/editors/transform/transform.c
@@ -1360,16 +1360,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]);
}
}
diff --git a/source/blender/editors/uvedit/uvedit_unwrap_ops.c b/source/blender/editors/uvedit/uvedit_unwrap_ops.c
index b1558a98ff6..fd6514f1281 100644
--- a/source/blender/editors/uvedit/uvedit_unwrap_ops.c
+++ b/source/blender/editors/uvedit/uvedit_unwrap_ops.c
@@ -230,16 +230,9 @@ static ParamHandle *construct_param_handle(Scene *scene, BMEditMesh *em,
float *co[4];
float *uv[4];
int lsel;
-
- if(scene->toolsettings->uv_flag & UV_SYNC_SELECTION) {
- if(BM_TestHFlag(efa, BM_HIDDEN)) {
- continue;
- }
- }
- else {
- if((BM_TestHFlag(efa, BM_HIDDEN)) || (sel && BM_TestHFlag(efa, BM_SELECT)==0))
- continue;
- }
+
+ if((BM_TestHFlag(efa, BM_HIDDEN)) || (sel && BM_TestHFlag(efa, BM_SELECT)==0))
+ continue;
tf= (MTexPoly *)CustomData_em_get(&em->bm->pdata, efa->head.data, CD_MTEXPOLY);
lsel = 0;
@@ -643,7 +636,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);
}