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:
authorXiao Xiangquan <xiaoxiangquan@gmail.com>2011-09-01 19:08:32 +0400
committerXiao Xiangquan <xiaoxiangquan@gmail.com>2011-09-01 19:08:32 +0400
commit981f7fcd0d315abb425bf34dd37f7cd4d9e8d55e (patch)
tree70800c93ec1a12579c32874e2a72eaf3290eba8e /source/blender/editors/interface
parent5b91a783cf0ec132398a2767d3419d675e5126b5 (diff)
parent2365c64014b3e067bb212b2061f1d14c1f944090 (diff)
merge with trunk r39834
Diffstat (limited to 'source/blender/editors/interface')
-rw-r--r--source/blender/editors/interface/interface.c96
-rw-r--r--source/blender/editors/interface/interface_anim.c77
-rw-r--r--source/blender/editors/interface/interface_draw.c88
-rw-r--r--source/blender/editors/interface/interface_handlers.c20
-rw-r--r--source/blender/editors/interface/interface_icons.c3
-rw-r--r--source/blender/editors/interface/interface_intern.h10
-rw-r--r--source/blender/editors/interface/interface_layout.c72
-rw-r--r--source/blender/editors/interface/interface_regions.c9
-rw-r--r--source/blender/editors/interface/interface_templates.c54
-rw-r--r--source/blender/editors/interface/interface_utils.c2
-rw-r--r--source/blender/editors/interface/interface_widgets.c2
-rw-r--r--source/blender/editors/interface/resources.c36
12 files changed, 316 insertions, 153 deletions
diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c
index 8e91c5c9008..c95862c6fdb 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);
}
@@ -1701,6 +1721,10 @@ int ui_set_but_string(bContext *C, uiBut *but, const char *str)
/* driver expression */
return 1;
}
+ else if(str[0]=='#') {
+ /* shortcut to create new driver expression (versus immediate Py-execution) */
+ return ui_but_anim_expression_create(but, str+1);
+ }
else {
/* number editing */
double value;
@@ -1958,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)
@@ -2506,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) {
@@ -2636,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);
@@ -2682,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;
@@ -2711,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;
@@ -3214,11 +3246,17 @@ void uiButSetUnitType(uiBut *but, const int unit_type)
int uiButGetUnitType(uiBut *but)
{
- if(but->rnaprop) {
- return RNA_SUBTYPE_UNIT(RNA_property_subtype(but->rnaprop));
+ int ownUnit = (int)but->unit_type;
+
+ /* own unit define always takes precidence over RNA provided, allowing for overriding
+ * default value provided in RNA in a few special cases (i.e. Active Keyframe in Graph Edit)
+ */
+ // XXX: this doesn't allow clearing unit completely, though the same could be said for icons
+ if ((ownUnit != 0) || (but->rnaprop == NULL)) {
+ return ownUnit << 16;
}
else {
- return ((int)but->unit_type)<<16;
+ return RNA_SUBTYPE_UNIT(RNA_property_subtype(but->rnaprop));
}
}
diff --git a/source/blender/editors/interface/interface_anim.c b/source/blender/editors/interface/interface_anim.c
index d9691819b29..1113f90a652 100644
--- a/source/blender/editors/interface/interface_anim.c
+++ b/source/blender/editors/interface/interface_anim.c
@@ -30,6 +30,7 @@
#include <stdlib.h>
#include <string.h>
+#include "MEM_guardedalloc.h"
#include "DNA_anim_types.h"
#include "DNA_scene_types.h"
@@ -37,15 +38,19 @@
#include "BLI_listbase.h"
#include "BLI_string.h"
+#include "BLI_utildefines.h"
#include "BKE_context.h"
+#include "BKE_animsys.h"
#include "BKE_fcurve.h"
-
+#include "BKE_global.h"
#include "ED_keyframing.h"
#include "UI_interface.h"
+#include "RNA_access.h"
+
#include "WM_api.h"
#include "WM_types.h"
@@ -108,7 +113,7 @@ int ui_but_anim_expression_set(uiBut *but, const char *str)
if(fcu && driven) {
driver= fcu->driver;
-
+
if(driver && driver->type == DRIVER_TYPE_PYTHON) {
BLI_strncpy(driver->expression, str, sizeof(driver->expression));
driver->flag |= DRIVER_FLAG_RECOMPILE;
@@ -120,6 +125,74 @@ int ui_but_anim_expression_set(uiBut *but, const char *str)
return 0;
}
+/* create new expression for button (i.e. a "scripted driver"), if it can be created... */
+int ui_but_anim_expression_create(uiBut *but, const char *str)
+{
+ bContext *C = but->block->evil_C;
+ ID *id;
+ FCurve *fcu;
+ char *path;
+ short ok=0;
+
+ /* button must have RNA-pointer to a numeric-capable property */
+ if (ELEM(NULL, but->rnapoin.data, but->rnaprop)) {
+ if (G.f & G_DEBUG)
+ printf("ERROR: create expression failed - button has no RNA info attached\n");
+ return 0;
+ }
+
+ /* make sure we have animdata for this */
+ // FIXME: until materials can be handled by depsgraph, don't allow drivers to be created for them
+ id = (ID *)but->rnapoin.id.data;
+ if ((id == NULL) || (GS(id->name)==ID_MA) || (GS(id->name)==ID_TE)) {
+ if (G.f & G_DEBUG)
+ printf("ERROR: create expression failed - invalid id-datablock for adding drivers (%p)\n", id);
+ return 0;
+ }
+
+ /* get path */
+ path = RNA_path_from_ID_to_property(&but->rnapoin, but->rnaprop);
+
+ /* create driver */
+ fcu = verify_driver_fcurve(id, path, but->rnaindex, 1);
+ if (fcu) {
+ ChannelDriver *driver= fcu->driver;
+
+ if (driver) {
+ /* set type of driver */
+ driver->type = DRIVER_TYPE_PYTHON;
+
+ /* set the expression */
+ // TODO: need some way of identifying variables used
+ BLI_strncpy(driver->expression, str, sizeof(driver->expression));
+
+ /* FIXME: for now, assume that
+ * - for expressions, users are likely to be using "frame" -> current frame" as a variable
+ * - driver_add_new_variable() adds a single-prop variable by default
+ */
+ {
+ DriverVar *dvar;
+ DriverTarget *dtar;
+
+ dvar = driver_add_new_variable(driver);
+ BLI_strncpy(dvar->name, "frame", sizeof(dvar->name));
+
+ dtar = &dvar->targets[0];
+ dtar->id = (ID *)CTX_data_scene(C); // XXX: should we check that C is valid first?
+ dtar->rna_path = BLI_sprintfN("frame_current");
+ }
+
+ /* updates */
+ driver->flag |= DRIVER_FLAG_RECOMPILE;
+ WM_event_add_notifier(C, NC_ANIMATION|ND_KEYFRAME, NULL);
+ }
+ }
+
+ MEM_freeN(path);
+
+ return ok;
+}
+
void ui_but_anim_autokey(bContext *C, uiBut *but, Scene *scene, float cfra)
{
ID *id;
diff --git a/source/blender/editors/interface/interface_draw.c b/source/blender/editors/interface/interface_draw.c
index 97299a6a766..76ed9891b8e 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]);
}
@@ -532,14 +530,11 @@ static void ui_draw_but_CHARTAB(uiBut *but)
int charmax = G.charmax;
/* FO_BUILTIN_NAME font in use. There are TTF FO_BUILTIN_NAME and non-TTF FO_BUILTIN_NAME fonts */
- if(!strcmp(G.selfont->name, FO_BUILTIN_NAME))
- {
- if(G.ui_international == TRUE)
- {
+ if(!strcmp(G.selfont->name, FO_BUILTIN_NAME)) {
+ if(G.ui_international == TRUE) {
charmax = 0xff;
}
- else
- {
+ else {
charmax = 0xff;
}
}
@@ -564,16 +559,13 @@ static void ui_draw_but_CHARTAB(uiBut *but)
cs = G.charstart;
/* Set the font, in case it is not FO_BUILTIN_NAME font */
- if(G.selfont && strcmp(G.selfont->name, FO_BUILTIN_NAME))
- {
+ if(G.selfont && strcmp(G.selfont->name, FO_BUILTIN_NAME)) {
// Is the font file packed, if so then use the packed file
- if(G.selfont->packedfile)
- {
+ if(G.selfont->packedfile) {
pf = G.selfont->packedfile;
FTF_SetFont(pf->data, pf->size, 14.0);
}
- else
- {
+ else {
char tmpStr[256];
int err;
@@ -582,10 +574,8 @@ static void ui_draw_but_CHARTAB(uiBut *but)
err = FTF_SetFont((unsigned char *)tmpStr, 0, 14.0);
}
}
- else
- {
- if(G.ui_international == TRUE)
- {
+ else {
+ if(G.ui_international == TRUE) {
FTF_SetFont((unsigned char *) datatoc_bfont_ttf, datatoc_bfont_ttf_size, 14.0);
}
}
@@ -597,8 +587,7 @@ static void ui_draw_but_CHARTAB(uiBut *but)
glRectf((rect->xmin), (rect->ymin), (rect->xmax), (rect->ymax));
glColor3ub(0, 0, 0);
- for(y = 0; y < 6; y++)
- {
+ for(y = 0; y < 6; y++) {
// Do not draw more than the category allows
if(cs > charmax) break;
@@ -678,23 +667,19 @@ static void ui_draw_but_CHARTAB(uiBut *but)
glShadeModel(GL_FLAT);
/* Return Font Settings to original */
- if(U.fontsize && U.fontname[0])
- {
+ if(U.fontsize && U.fontname[0]) {
result = FTF_SetFont((unsigned char *)U.fontname, 0, U.fontsize);
}
- else if (U.fontsize)
- {
+ else if (U.fontsize) {
result = FTF_SetFont((unsigned char *) datatoc_bfont_ttf, datatoc_bfont_ttf_size, U.fontsize);
}
- if (result == 0)
- {
+ if (result == 0) {
result = FTF_SetFont((unsigned char *) datatoc_bfont_ttf, datatoc_bfont_ttf_size, 11);
}
/* resets the font size */
- if(G.ui_international == TRUE)
- {
+ if(G.ui_international == TRUE) {
// uiSetCurFont(but->block, UI_HELV);
}
}
@@ -1606,7 +1591,6 @@ void ui_dropshadow(rctf *rct, float radius, float aspect, int UNUSED(select))
#endif
{
a= i*aspect;
-
}
for(; i--; a-=aspect) {
diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c
index 066d7c470af..125928c136b 100644
--- a/source/blender/editors/interface/interface_handlers.c
+++ b/source/blender/editors/interface/interface_handlers.c
@@ -800,8 +800,7 @@ static void ui_add_smart_controller(bContext *C, uiBut *from, uiBut *to)
if(!act_iter) return;
/* (3) add a new controller */
- if (WM_operator_name_call(C, "LOGIC_OT_controller_add", WM_OP_EXEC_DEFAULT, NULL) & OPERATOR_FINISHED)
- {
+ if (WM_operator_name_call(C, "LOGIC_OT_controller_add", WM_OP_EXEC_DEFAULT, NULL) & OPERATOR_FINISHED) {
cont = (bController *)ob->controllers.last;
/* (4) link the sensor->controller->actuator */
@@ -1236,7 +1235,7 @@ static short test_special_char(char ch)
case ':':
case ';':
case '\'':
- case '\"':
+ case '\"': // " - an extra closing one for Aligorith's text editor
case '<':
case '>':
case ',':
@@ -2310,13 +2309,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;
}
}
}
@@ -4235,6 +4234,7 @@ static int ui_but_menu(bContext *C, uiBut *but)
/* Keyframes */
if(but->flag & UI_BUT_ANIMATED_KEY) {
+ /* replace/delete keyfraemes */
if(length) {
uiItemBooleanO(layout, "Replace Keyframes", ICON_NONE, "ANIM_OT_keyframe_insert_button", "all", 1);
uiItemBooleanO(layout, "Replace Single Keyframe", ICON_NONE, "ANIM_OT_keyframe_insert_button", "all", 0);
@@ -4245,6 +4245,11 @@ static int ui_but_menu(bContext *C, uiBut *but)
uiItemBooleanO(layout, "Replace Keyframe", ICON_NONE, "ANIM_OT_keyframe_insert_button", "all", 0);
uiItemBooleanO(layout, "Delete Keyframe", ICON_NONE, "ANIM_OT_keyframe_delete_button", "all", 0);
}
+
+ /* keyframe settings */
+ uiItemS(layout);
+
+
}
else if(but->flag & UI_BUT_DRIVEN);
else if(is_anim) {
@@ -4287,6 +4292,7 @@ static int ui_but_menu(bContext *C, uiBut *but)
}
/* Keying Sets */
+ // TODO: check on modifyability of Keying Set when doing this
if(is_anim) {
uiItemS(layout);
diff --git a/source/blender/editors/interface/interface_icons.c b/source/blender/editors/interface/interface_icons.c
index 412c0233c35..c3a0f438fbe 100644
--- a/source/blender/editors/interface/interface_icons.c
+++ b/source/blender/editors/interface/interface_icons.c
@@ -1103,8 +1103,7 @@ int ui_id_icon_get(bContext *C, ID *id, int big)
int iconid= 0;
/* icon */
- switch(GS(id->name))
- {
+ switch(GS(id->name)) {
case ID_BR:
iconid= ui_id_brush_get_icon(C, id);
break;
diff --git a/source/blender/editors/interface/interface_intern.h b/source/blender/editors/interface/interface_intern.h
index 8475090b468..ebc8725ad5d 100644
--- a/source/blender/editors/interface/interface_intern.h
+++ b/source/blender/editors/interface/interface_intern.h
@@ -213,7 +213,7 @@ struct uiBut {
BIFIconID icon;
char lock;
- char dt;
+ char dt; /* drawtype: UI_EMBOSS, UI_EMBOSSN ... etc, copied from the block */
char changed; /* could be made into a single flag */
unsigned char unit_type; /* so buttons can support unit systems which are not RNA */
short modifier_key;
@@ -306,7 +306,8 @@ struct uiBlock {
void *drawextra_arg2;
int flag;
- char direction, dt;
+ char direction;
+ char dt; /* drawtype: UI_EMBOSS, UI_EMBOSSN ... etc, copied to buttons */
short auto_open;
double auto_open_last;
@@ -331,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 {
@@ -520,6 +523,7 @@ void ui_but_anim_add_keyingset(struct bContext *C);
void ui_but_anim_remove_keyingset(struct bContext *C);
int ui_but_anim_expression_get(uiBut *but, char *str, int maxlen);
int ui_but_anim_expression_set(uiBut *but, const char *str);
+int ui_but_anim_expression_create(uiBut *but, const char *str);
void ui_but_anim_autokey(struct bContext *C, uiBut *but, struct Scene *scene, float cfra);
#endif
diff --git a/source/blender/editors/interface/interface_layout.c b/source/blender/editors/interface/interface_layout.c
index 9ba7fc9effc..f4e53e2aa52 100644
--- a/source/blender/editors/interface/interface_layout.c
+++ b/source/blender/editors/interface/interface_layout.c
@@ -369,7 +369,7 @@ static void ui_item_array(uiLayout *layout, uiBlock *block, const char *name, in
unit= UI_UNIT_X*0.75;
butw= unit;
buth= unit;
-
+
if(ptr->type == &RNA_Armature) {
bArmature *arm= (bArmature *)ptr->data;
layer_used= arm->layer_used;
@@ -381,7 +381,7 @@ static void ui_item_array(uiLayout *layout, uiBlock *block, const char *name, in
for(a=0; a<colbuts; a++) {
if(layer_used & (1<<(a+b*colbuts))) icon= ICON_LAYER_USED;
else icon= ICON_BLANK1;
-
+
but= uiDefAutoButR(block, ptr, prop, a+b*colbuts, "", icon, x + butw*a, y+buth, butw, buth);
if(subtype == PROP_LAYER_MEMBER)
uiButSetFunc(but, ui_layer_but_cb, but, SET_INT_IN_POINTER(a+b*colbuts));
@@ -389,7 +389,7 @@ static void ui_item_array(uiLayout *layout, uiBlock *block, const char *name, in
for(a=0; a<colbuts; a++) {
if(layer_used & (1<<(a+len/2+b*colbuts))) icon= ICON_LAYER_USED;
else icon= ICON_BLANK1;
-
+
but= uiDefAutoButR(block, ptr, prop, a+len/2+b*colbuts, "", icon, x + butw*a, y, butw, buth);
if(subtype == PROP_LAYER_MEMBER)
uiButSetFunc(but, ui_layer_but_cb, but, SET_INT_IN_POINTER(a+len/2+b*colbuts));
@@ -424,35 +424,46 @@ static void ui_item_array(uiLayout *layout, uiBlock *block, const char *name, in
uiDefButR_prop(block, BUT_NORMAL, 0, name, x, y, UI_UNIT_X*3, UI_UNIT_Y*3, ptr, prop, 0, 0, 0, -1, -1, NULL);
}
else {
- if(ELEM(subtype, PROP_COLOR, PROP_COLOR_GAMMA) && !expand)
+ /* note, this block of code is a bit arbitrary and has just been made
+ * to work with common cases, but may need to be re-worked */
+
+ /* special case, boolean array in a menu, this could be used in a more generic way too */
+ if(ELEM(subtype, PROP_COLOR, PROP_COLOR_GAMMA) && !expand) {
uiDefAutoButR(block, ptr, prop, -1, "", ICON_NONE, 0, 0, w, UI_UNIT_Y);
+ }
+ else {
+ int *boolarr= NULL;
- if(!ELEM(subtype, PROP_COLOR, PROP_COLOR_GAMMA) || expand) {
- /* layout for known array subtypes */
- char str[3];
+ /* even if 'expand' is fale, expanding anyway */
- for(a=0; a<len; a++) {
- str[0]= RNA_property_array_item_char(prop, a);
+ /* layout for known array subtypes */
+ char str[3]= {'\0'};
- if(str[0]) {
- if (icon_only) {
- str[0] = '\0';
- }
- else if(type == PROP_BOOLEAN) {
- str[1]= '\0';
- }
- else {
- str[1]= ':';
- str[2]= '\0';
- }
+ if(!icon_only) {
+ if(type != PROP_BOOLEAN) {
+ str[1]= ':';
}
+ }
+ /* show checkboxes for rna on a non-emboss block (menu for eg) */
+ if(type == PROP_BOOLEAN && ELEM(layout->root->block->dt, UI_EMBOSSN, UI_EMBOSSP)) {
+ boolarr= MEM_callocN(sizeof(int)*len, "ui_item_array");
+ RNA_property_boolean_get_array(ptr, prop, boolarr);
+ }
+
+ for(a=0; a<len; a++) {
+ if(!icon_only) str[0]= RNA_property_array_item_char(prop, a);
+ if(boolarr) icon= boolarr[a] ? ICON_CHECKBOX_HLT: ICON_CHECKBOX_DEHLT;
but= uiDefAutoButR(block, ptr, prop, a, str, icon, 0, 0, w, UI_UNIT_Y);
if(slider && but->type==NUM)
but->type= NUMSLI;
if(toggle && but->type==OPTION)
but->type= TOG;
}
+
+ if(boolarr) {
+ MEM_freeN(boolarr);
+ }
}
}
@@ -953,13 +964,14 @@ void uiItemFullR(uiLayout *layout, PointerRNA *ptr, PropertyRNA *prop, int index
uiBut *but;
PropertyType type;
char namestr[UI_MAX_NAME_STR];
- int len, w, h, slider, toggle, expand, icon_only, no_bg;
+ int len, is_array, w, h, slider, toggle, expand, icon_only, no_bg;
uiBlockSetCurLayout(block, layout);
/* retrieve info */
type= RNA_property_type(prop);
- len= RNA_property_array_length(ptr, prop);
+ is_array= RNA_property_array_check(prop);
+ len= (is_array) ? RNA_property_array_length(ptr, prop) : 0;
/* set name and icon */
if(!name)
@@ -969,14 +981,16 @@ void uiItemFullR(uiLayout *layout, PointerRNA *ptr, PropertyRNA *prop, int index
if(ELEM4(type, PROP_INT, PROP_FLOAT, PROP_STRING, PROP_POINTER))
name= ui_item_name_add_colon(name, namestr);
- else if(type == PROP_BOOLEAN && len && index == RNA_NO_INDEX)
+ else if(type == PROP_BOOLEAN && is_array && index == RNA_NO_INDEX)
name= ui_item_name_add_colon(name, namestr);
else if(type == PROP_ENUM && index != RNA_ENUM_VALUE)
name= ui_item_name_add_colon(name, namestr);
if(layout->root->type == UI_LAYOUT_MENU) {
- if(type == PROP_BOOLEAN)
- icon= (RNA_property_boolean_get(ptr, prop))? ICON_CHECKBOX_HLT: ICON_CHECKBOX_DEHLT;
+ if(type == PROP_BOOLEAN && ((is_array == FALSE) || (index != RNA_NO_INDEX))) {
+ if(is_array) icon= (RNA_property_boolean_get_index(ptr, prop, index)) ? ICON_CHECKBOX_HLT: ICON_CHECKBOX_DEHLT;
+ else icon= (RNA_property_boolean_get(ptr, prop)) ? ICON_CHECKBOX_HLT: ICON_CHECKBOX_DEHLT;
+ }
else if(type == PROP_ENUM && index == RNA_ENUM_VALUE) {
int enum_value= RNA_property_enum_get(ptr, prop);
if(RNA_property_flag(prop) & PROP_ENUM_FLAG) {
@@ -1001,16 +1015,14 @@ void uiItemFullR(uiLayout *layout, PointerRNA *ptr, PropertyRNA *prop, int index
uiBlockSetEmboss(block, UI_EMBOSSN);
/* array property */
- if(index == RNA_NO_INDEX && len > 0)
+ if(index == RNA_NO_INDEX && is_array)
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);
}
@@ -1351,7 +1363,7 @@ void uiItemPointerR(uiLayout *layout, struct PointerRNA *ptr, const char *propna
static void ui_item_menutype_func(bContext *C, uiLayout *layout, void *arg_mt)
{
MenuType *mt= (MenuType*)arg_mt;
- Menu menu = {0};
+ Menu menu = {NULL};
menu.type= mt;
menu.layout= layout;
diff --git a/source/blender/editors/interface/interface_regions.c b/source/blender/editors/interface/interface_regions.c
index ba259ed3def..f4aaf6212a8 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++;
}
@@ -1188,7 +1189,7 @@ static void ui_block_position(wmWindow *window, ARegion *butregion, uiBut *but,
uiBut *bt;
uiSafetyRct *saferct;
rctf butrct;
- float aspect;
+ /*float aspect;*/ /*UNUSED*/
int xsize, ysize, xof=0, yof=0, center;
short dir1= 0, dir2=0;
@@ -1223,7 +1224,7 @@ static void ui_block_position(wmWindow *window, ARegion *butregion, uiBut *but,
}
}
- aspect= (float)(block->maxx - block->minx + 4);
+ /*aspect= (float)(block->maxx - block->minx + 4);*/ /*UNUSED*/
ui_block_to_window_fl(butregion, but->block, &block->minx, &block->miny);
ui_block_to_window_fl(butregion, but->block, &block->maxx, &block->maxy);
@@ -1232,7 +1233,7 @@ static void ui_block_position(wmWindow *window, ARegion *butregion, uiBut *but,
xsize= block->maxx - block->minx+4; // 4 for shadow
ysize= block->maxy - block->miny+4;
- aspect/= (float)xsize;
+ /*aspect/= (float)xsize;*/ /*UNUSED*/
if(but) {
int left=0, right=0, top=0, down=0;
diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c
index 92b15ab4269..e510d6bb38d 100644
--- a/source/blender/editors/interface/interface_templates.c
+++ b/source/blender/editors/interface/interface_templates.c
@@ -33,12 +33,14 @@
#include "MEM_guardedalloc.h"
+#include "DNA_anim_types.h"
#include "DNA_key_types.h"
#include "DNA_scene_types.h"
#include "DNA_userdef_types.h"
#include "BLI_string.h"
#include "BLI_utildefines.h"
+#include "BLI_ghash.h"
#include "BKE_animsys.h"
#include "BKE_colortools.h"
@@ -57,6 +59,7 @@
#include "ED_render.h"
#include "RNA_access.h"
+#include "RNA_enum_types.h"
#include "WM_api.h"
#include "WM_types.h"
@@ -236,7 +239,7 @@ static void template_id_cb(bContext *C, void *arg_litem, void *arg_event)
{
TemplateID *template= (TemplateID*)arg_litem;
PointerRNA idptr= RNA_property_pointer_get(&template->ptr, template->prop);
- ID *id= idptr.data, *newid;
+ ID *id= idptr.data;
int event= GET_INT_FROM_POINTER(arg_event);
switch(event) {
@@ -286,17 +289,8 @@ static void template_id_cb(bContext *C, void *arg_litem, void *arg_event)
WM_event_add_notifier(C, NC_SCENE|ND_OB_ACTIVE, scene);
}
else {
- if(id_copy(id, &newid, 0) && newid) {
- /* copy animation actions too */
- BKE_copy_animdata_id_action(id);
- /* us is 1 by convention, but RNA_property_pointer_set
- will also incremement it, so set it to zero */
- newid->us= 0;
-
- /* assign copy */
- RNA_id_pointer_create(newid, &idptr);
- RNA_property_pointer_set(&template->ptr, template->prop, idptr);
- RNA_property_update(C, &template->ptr, template->prop);
+ if(id) {
+ id_single_user(C, id, &template->ptr, template->prop);
}
}
}
@@ -320,11 +314,13 @@ static const char *template_id_browse_tip(StructRNA *type)
case ID_MA: return _("Browse Material to be linked");
case ID_TE: return _("Browse Texture to be linked");
case ID_IM: return _("Browse Image to be linked");
- case ID_LA: return _("Browse Lattice Data to be linked");
+ case ID_LT: return _("Browse Lattice Data to be linked");
+ case ID_LA: return _("Browse Lamp Data to be linked");
case ID_CA: return _("Browse Camera Data to be linked");
case ID_WO: return _("Browse World Settings to be linked");
case ID_SCR: return _("Choose Screen lay-out");
case ID_TXT: return _("Browse Text to be linked");
+ case ID_SPK: return _("Browse Speaker Data to be linked");
case ID_SO: return _("Browse Sound to be linked");
case ID_AR: return _("Browse Armature data to be linked");
case ID_AC: return _("Browse Action to be linked");
@@ -2110,7 +2106,7 @@ static void list_item_row(bContext *C, uiLayout *layout, PointerRNA *ptr, Pointe
}
else if(itemptr->type == &RNA_ShapeKey) {
Object *ob= (Object*)activeptr->data;
- Key *key= (Key*)itemptr->data;
+ Key *key= (Key*)itemptr->id.data;
split= uiLayoutSplit(sub, 0.75f, 0);
@@ -2126,6 +2122,15 @@ static void list_item_row(bContext *C, uiLayout *layout, PointerRNA *ptr, Pointe
//uiItemR(row, itemptr, "mute", 0, "", ICON_MUTE_IPO_OFF);
uiBlockSetEmboss(block, UI_EMBOSS);
}
+ else if(itemptr->type == &RNA_KeyingSetPath) {
+ KS_Path *ksp = (KS_Path*)itemptr->data;
+
+ /* icon needs to be the type of ID which is currently active */
+ RNA_enum_icon_from_value(id_type_items, ksp->idtype, &icon);
+
+ /* nothing else special to do... */
+ uiItemL(sub, name, icon); /* fails, backdrop LISTROW... */
+ }
else
uiItemL(sub, name, icon); /* fails, backdrop LISTROW... */
@@ -2322,10 +2327,11 @@ static void operator_call_cb(bContext *C, void *UNUSED(arg1), void *arg2)
static void operator_search_cb(const bContext *C, void *UNUSED(arg), const char *str, uiSearchItems *items)
{
- wmOperatorType *ot = WM_operatortype_first();
-
- for(; ot; ot= ot->next) {
-
+ GHashIterator *iter= WM_operatortype_iter();
+
+ for( ; !BLI_ghashIterator_isDone(iter); BLI_ghashIterator_step(iter)) {
+ wmOperatorType *ot= BLI_ghashIterator_getValue(iter);
+
if(BLI_strcasestr(ot->name, str)) {
if(WM_operator_poll((bContext*)C, ot)) {
char name[256];
@@ -2345,6 +2351,7 @@ static void operator_search_cb(const bContext *C, void *UNUSED(arg), const char
}
}
}
+ BLI_ghashIterator_free(iter);
}
void uiTemplateOperatorSearch(uiLayout *layout)
@@ -2366,6 +2373,7 @@ void uiTemplateOperatorSearch(uiLayout *layout)
#define B_STOPCAST 2
#define B_STOPANIM 3
#define B_STOPCOMPO 4
+#define B_STOPSEQ 5
static void do_running_jobs(bContext *C, void *UNUSED(arg), int event)
{
@@ -2382,6 +2390,9 @@ static void do_running_jobs(bContext *C, void *UNUSED(arg), int event)
case B_STOPCOMPO:
WM_jobs_stop(CTX_wm_manager(C), CTX_wm_area(C), NULL);
break;
+ case B_STOPSEQ:
+ WM_jobs_stop(CTX_wm_manager(C), CTX_wm_area(C), NULL);
+ break;
}
}
@@ -2403,8 +2414,11 @@ void uiTemplateRunningJobs(uiLayout *layout, bContext *C)
if(WM_jobs_test(wm, sa))
owner = sa;
handle_event= B_STOPCOMPO;
- }
- else {
+ } else if (sa->spacetype==SPACE_SEQ) {
+ if(WM_jobs_test(wm, sa))
+ owner = sa;
+ handle_event = B_STOPSEQ;
+ } else {
Scene *scene;
/* another scene can be rendering too, for example via compositor */
for(scene= CTX_data_main(C)->scene.first; scene; scene= scene->id.next)
diff --git a/source/blender/editors/interface/interface_utils.c b/source/blender/editors/interface/interface_utils.c
index 90735cc419b..26f2c50fffd 100644
--- a/source/blender/editors/interface/interface_utils.c
+++ b/source/blender/editors/interface/interface_utils.c
@@ -145,7 +145,7 @@ int uiDefAutoButsRNA(uiLayout *layout, PointerRNA *ptr, int (*check_prop)(Proper
if(label_align != '\0') {
PropertyType type = RNA_property_type(prop);
- int is_boolean = (type == PROP_BOOLEAN && !RNA_property_array_check(ptr, prop));
+ int is_boolean = (type == PROP_BOOLEAN && !RNA_property_array_check(prop));
name= RNA_property_ui_name(prop);
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/interface/resources.c b/source/blender/editors/interface/resources.c
index e71f709f89b..692c8940a21 100644
--- a/source/blender/editors/interface/resources.c
+++ b/source/blender/editors/interface/resources.c
@@ -250,6 +250,8 @@ const unsigned char *UI_ThemeGetColorPtr(bTheme *btheme, int spacetype, int colo
cp= ts->wire; break;
case TH_LAMP:
cp= ts->lamp; break;
+ case TH_SPEAKER:
+ cp= ts->speaker; break;
case TH_SELECT:
cp= ts->select; break;
case TH_ACTIVE:
@@ -326,6 +328,8 @@ const unsigned char *UI_ThemeGetColorPtr(bTheme *btheme, int spacetype, int colo
cp= ts->handle_free; break;
case TH_HANDLE_AUTO:
cp= ts->handle_auto; break;
+ case TH_HANDLE_AUTOCLAMP:
+ cp= ts->handle_auto_clamped; break;
case TH_HANDLE_VECT:
cp= ts->handle_vect; break;
case TH_HANDLE_ALIGN:
@@ -334,11 +338,13 @@ const unsigned char *UI_ThemeGetColorPtr(bTheme *btheme, int spacetype, int colo
cp= ts->handle_sel_free; break;
case TH_HANDLE_SEL_AUTO:
cp= ts->handle_sel_auto; break;
+ case TH_HANDLE_SEL_AUTOCLAMP:
+ cp= ts->handle_sel_auto_clamped; break;
case TH_HANDLE_SEL_VECT:
cp= ts->handle_sel_vect; break;
case TH_HANDLE_SEL_ALIGN:
cp= ts->handle_sel_align; break;
-
+
case TH_SYNTAX_B:
cp= ts->syntaxb; break;
case TH_SYNTAX_V:
@@ -587,6 +593,7 @@ void ui_theme_init_default(void)
SETCOLF(btheme->tv3d.grid, 0.251, 0.251, 0.251, 1.0);
SETCOL(btheme->tv3d.wire, 0x0, 0x0, 0x0, 255);
SETCOL(btheme->tv3d.lamp, 0, 0, 0, 40);
+ SETCOL(btheme->tv3d.speaker, 0, 0, 0, 255);
SETCOL(btheme->tv3d.select, 241, 88, 0, 255);
SETCOL(btheme->tv3d.active, 255, 170, 64, 255);
SETCOL(btheme->tv3d.group, 8, 48, 8, 255);
@@ -666,7 +673,9 @@ void ui_theme_init_default(void)
SETCOL(btheme->tipo.handle_vertex, 0, 0, 0, 255);
SETCOL(btheme->tipo.handle_vertex_select, 255, 133, 0, 255);
- btheme->tipo.handle_vertex_size= 3;
+ SETCOL(btheme->tipo.handle_auto_clamped, 0x99, 0x40, 0x30, 255);
+ SETCOL(btheme->tipo.handle_sel_auto_clamped, 0xf0, 0xaf, 0x90, 255);
+ btheme->tipo.handle_vertex_size= 4;
SETCOL(btheme->tipo.ds_channel, 82, 96, 110, 255);
SETCOL(btheme->tipo.ds_subchannel, 124, 137, 150, 255);
@@ -1564,6 +1573,29 @@ void init_userdef_do_versions(void)
}
}
+ if (bmain->versionfile < 258 || (bmain->versionfile == 258 && bmain->subversionfile < 1)) {
+ bTheme *btheme;
+
+ /* if new keyframes handle default is stuff "auto", make it "auto-clamped" instead */
+ if (U.keyhandles_new == HD_AUTO)
+ U.keyhandles_new = HD_AUTO_ANIM;
+
+ /* theme color additions */
+ for (btheme= U.themes.first; btheme; btheme= btheme->next) {
+ /* auto-clamped handles -> based on auto */
+ SETCOL(btheme->tipo.handle_auto_clamped, 0x99, 0x40, 0x30, 255);
+ SETCOL(btheme->tipo.handle_sel_auto_clamped, 0xf0, 0xaf, 0x90, 255);
+ }
+ }
+
+ if (bmain->versionfile < 259 || (bmain->versionfile == 259 && bmain->subversionfile < 1)) {
+ bTheme *btheme;
+
+ for(btheme= U.themes.first; btheme; btheme= btheme->next) {
+ btheme->tv3d.speaker[3] = 255;
+ }
+ }
+
/* GL Texture Garbage Collection (variable abused above!) */
if (U.textimeout == 0) {
U.texcollectrate = 60;