diff options
author | Matt Ebb <matt@mke3.net> | 2010-05-07 07:44:34 +0400 |
---|---|---|
committer | Matt Ebb <matt@mke3.net> | 2010-05-07 07:44:34 +0400 |
commit | 9084df418d1bbd1fd3cf8f1bf118cbef4d50a4c7 (patch) | |
tree | 7ec1f715e00d8149b9740364310a67f91bca1cf9 /source | |
parent | d559cf97bb4e21c988aa9a7f7acbcfa5277634bd (diff) |
Warning cleanup
While I was looking in outliner.c, made some changes to let extra passes display
there such as environment (commented out before due to a previous limitation).
Also changed outliner object visbility/selectability/renderability toggles to use
RNA buttons so you can insert keyframes with RMB menu etc.
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/blenkernel/intern/colortools.c | 6 | ||||
-rw-r--r-- | source/blender/editors/animation/keyframing.c | 10 | ||||
-rw-r--r-- | source/blender/editors/interface/interface_draw.c | 2 | ||||
-rw-r--r-- | source/blender/editors/object/object_constraint.c | 2 | ||||
-rw-r--r-- | source/blender/editors/render/render_shading.c | 2 | ||||
-rw-r--r-- | source/blender/editors/space_outliner/outliner.c | 73 | ||||
-rw-r--r-- | source/blender/makesdna/DNA_scene_types.h | 36 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_object.c | 3 | ||||
-rw-r--r-- | source/blender/python/generic/blf_api.c | 1 |
9 files changed, 77 insertions, 58 deletions
diff --git a/source/blender/blenkernel/intern/colortools.c b/source/blender/blenkernel/intern/colortools.c index 44a52964f2a..66ebac2e25e 100644 --- a/source/blender/blenkernel/intern/colortools.c +++ b/source/blender/blenkernel/intern/colortools.c @@ -939,12 +939,12 @@ void scopes_update(Scopes *scopes, ImBuf *ibuf, int use_color_management) { int x, y, c, n, nl; double div, divl; - float *rf; - unsigned char *rc; + float *rf=NULL; + unsigned char *rc=NULL; unsigned int *bin_r, *bin_g, *bin_b, *bin_lum; int savedlines, saveline; float rgb[3], ycc[3]; - int ycc_mode; + int ycc_mode=-1; if (scopes->ok == 1 ) return; diff --git a/source/blender/editors/animation/keyframing.c b/source/blender/editors/animation/keyframing.c index 669a1042998..e7689df9535 100644 --- a/source/blender/editors/animation/keyframing.c +++ b/source/blender/editors/animation/keyframing.c @@ -1033,9 +1033,13 @@ static int modify_key_op_poll(bContext *C) if (ELEM(NULL, sa, scene)) return 0; - /* if Outliner, only allow in DataBlocks view */ - if (so && (so->outlinevis != SO_DATABLOCKS)) - return 0; + /* if Outliner, don't allow in some views */ + if (so) { + if (ELEM4(so->outlinevis, SO_GROUPS, SO_LIBRARIES, SO_VERSE_SESSION, SO_VERSE_SESSION)) + return 0; + if (ELEM3(so->outlinevis, SO_SEQUENCE, SO_USERDEF, SO_KEYMAP)) + return 0; + } /* TODO: checks for other space types can be added here */ diff --git a/source/blender/editors/interface/interface_draw.c b/source/blender/editors/interface/interface_draw.c index 74324a244de..9c5b4febc40 100644 --- a/source/blender/editors/interface/interface_draw.c +++ b/source/blender/editors/interface/interface_draw.c @@ -969,7 +969,7 @@ float polar_to_y(float center, float diam, float ampli, float angle) void vectorscope_draw_target(float centerx, float centery, float diam, float r, float g, float b) { float y,u,v; - float tangle, tampli; + float tangle=0.f, tampli; float dangle, dampli, dangle2, dampli2; rgb_to_yuv(r,g,b, &y, &u, &v); diff --git a/source/blender/editors/object/object_constraint.c b/source/blender/editors/object/object_constraint.c index d9d04cb3247..c52fd151d83 100644 --- a/source/blender/editors/object/object_constraint.c +++ b/source/blender/editors/object/object_constraint.c @@ -496,7 +496,7 @@ static bConstraint *edit_constraint_property_get(bContext *C, wmOperator *op, Ob char constraint_name[32]; int owner = RNA_enum_get(op->ptr, "owner"); bConstraint *con; - ListBase *list; + ListBase *list=NULL; RNA_string_get(op->ptr, "constraint", constraint_name); diff --git a/source/blender/editors/render/render_shading.c b/source/blender/editors/render/render_shading.c index efd579735e0..45dbb05064c 100644 --- a/source/blender/editors/render/render_shading.c +++ b/source/blender/editors/render/render_shading.c @@ -796,7 +796,7 @@ void TEXTURE_OT_slot_move(wmOperatorType *ot) static int save_envmap(wmOperator *op, Scene *scene, EnvMap *env, char *str, int imtype) { - ImBuf *ibuf; + ImBuf *ibuf=NULL; int dx; int retval; diff --git a/source/blender/editors/space_outliner/outliner.c b/source/blender/editors/space_outliner/outliner.c index d4283b7b6d3..1affa67a5cc 100644 --- a/source/blender/editors/space_outliner/outliner.c +++ b/source/blender/editors/space_outliner/outliner.c @@ -27,6 +27,7 @@ * ***** END GPL LICENSE BLOCK ***** */ +#include <math.h> #include <string.h> #include <stdlib.h> #include <stddef.h> @@ -433,13 +434,17 @@ static void outliner_sort(SpaceOops *soops, ListBase *lb) static TreeElement *outliner_add_element(SpaceOops *soops, ListBase *lb, void *idv, TreeElement *parent, short type, short index); +#define LOG2I(x) (int)(log(x)/log(2.0)) static void outliner_add_passes(SpaceOops *soops, TreeElement *tenla, ID *id, SceneRenderLayer *srl) { TreeStoreElem *tselem= TREESTORE(tenla); TreeElement *te; + + /* log stuff is to convert bitflags (powers of 2) to small integers, + * in order to not overflow short tselem->nr */ - te= outliner_add_element(soops, &tenla->subtree, id, tenla, TSE_R_PASS, SCE_PASS_COMBINED); + te= outliner_add_element(soops, &tenla->subtree, id, tenla, TSE_R_PASS, LOG2I(SCE_PASS_COMBINED)); te->name= "Combined"; te->directdata= &srl->passflag; @@ -447,73 +452,72 @@ static void outliner_add_passes(SpaceOops *soops, TreeElement *tenla, ID *id, Sc if(tselem->flag & TSE_CLOSED) return; - te= outliner_add_element(soops, &tenla->subtree, id, tenla, TSE_R_PASS, SCE_PASS_Z); + te= outliner_add_element(soops, &tenla->subtree, id, tenla, TSE_R_PASS, LOG2I(SCE_PASS_Z)); te->name= "Z"; te->directdata= &srl->passflag; - te= outliner_add_element(soops, &tenla->subtree, id, tenla, TSE_R_PASS, SCE_PASS_VECTOR); + te= outliner_add_element(soops, &tenla->subtree, id, tenla, TSE_R_PASS, LOG2I(SCE_PASS_VECTOR)); te->name= "Vector"; te->directdata= &srl->passflag; - te= outliner_add_element(soops, &tenla->subtree, id, tenla, TSE_R_PASS, SCE_PASS_NORMAL); + te= outliner_add_element(soops, &tenla->subtree, id, tenla, TSE_R_PASS, LOG2I(SCE_PASS_NORMAL)); te->name= "Normal"; te->directdata= &srl->passflag; - te= outliner_add_element(soops, &tenla->subtree, id, tenla, TSE_R_PASS, SCE_PASS_UV); + te= outliner_add_element(soops, &tenla->subtree, id, tenla, TSE_R_PASS, LOG2I(SCE_PASS_UV)); te->name= "UV"; te->directdata= &srl->passflag; - te= outliner_add_element(soops, &tenla->subtree, id, tenla, TSE_R_PASS, SCE_PASS_MIST); + te= outliner_add_element(soops, &tenla->subtree, id, tenla, TSE_R_PASS, LOG2I(SCE_PASS_MIST)); te->name= "Mist"; te->directdata= &srl->passflag; - te= outliner_add_element(soops, &tenla->subtree, id, tenla, TSE_R_PASS, SCE_PASS_INDEXOB); + te= outliner_add_element(soops, &tenla->subtree, id, tenla, TSE_R_PASS, LOG2I(SCE_PASS_INDEXOB)); te->name= "Index Object"; te->directdata= &srl->passflag; - te= outliner_add_element(soops, &tenla->subtree, id, tenla, TSE_R_PASS, SCE_PASS_RGBA); + te= outliner_add_element(soops, &tenla->subtree, id, tenla, TSE_R_PASS, LOG2I(SCE_PASS_RGBA)); te->name= "Color"; te->directdata= &srl->passflag; - te= outliner_add_element(soops, &tenla->subtree, id, tenla, TSE_R_PASS, SCE_PASS_DIFFUSE); + te= outliner_add_element(soops, &tenla->subtree, id, tenla, TSE_R_PASS, LOG2I(SCE_PASS_DIFFUSE)); te->name= "Diffuse"; te->directdata= &srl->passflag; - te= outliner_add_element(soops, &tenla->subtree, id, tenla, TSE_R_PASS, SCE_PASS_SPEC); + te= outliner_add_element(soops, &tenla->subtree, id, tenla, TSE_R_PASS, LOG2I(SCE_PASS_SPEC)); te->name= "Specular"; te->directdata= &srl->passflag; - te= outliner_add_element(soops, &tenla->subtree, id, tenla, TSE_R_PASS, SCE_PASS_SHADOW); + te= outliner_add_element(soops, &tenla->subtree, id, tenla, TSE_R_PASS, LOG2I(SCE_PASS_SHADOW)); te->name= "Shadow"; te->directdata= &srl->passflag; - te= outliner_add_element(soops, &tenla->subtree, id, tenla, TSE_R_PASS, SCE_PASS_AO); + te= outliner_add_element(soops, &tenla->subtree, id, tenla, TSE_R_PASS, LOG2I(SCE_PASS_AO)); te->name= "AO"; te->directdata= &srl->passflag; - te= outliner_add_element(soops, &tenla->subtree, id, tenla, TSE_R_PASS, SCE_PASS_REFLECT); + te= outliner_add_element(soops, &tenla->subtree, id, tenla, TSE_R_PASS, LOG2I(SCE_PASS_REFLECT)); te->name= "Reflection"; te->directdata= &srl->passflag; - te= outliner_add_element(soops, &tenla->subtree, id, tenla, TSE_R_PASS, SCE_PASS_REFRACT); + te= outliner_add_element(soops, &tenla->subtree, id, tenla, TSE_R_PASS, LOG2I(SCE_PASS_REFRACT)); te->name= "Refraction"; te->directdata= &srl->passflag; - te= outliner_add_element(soops, &tenla->subtree, id, tenla, TSE_R_PASS, SCE_PASS_INDIRECT); + te= outliner_add_element(soops, &tenla->subtree, id, tenla, TSE_R_PASS, LOG2I(SCE_PASS_INDIRECT)); te->name= "Indirect"; te->directdata= &srl->passflag; - /* TODO SCE_PASS_ENVIRONMENT/EMIT overflow short.. - - te= outliner_add_element(soops, &tenla->subtree, id, tenla, TSE_R_PASS, SCE_PASS_ENVIRONMENT); + te= outliner_add_element(soops, &tenla->subtree, id, tenla, TSE_R_PASS, LOG2I(SCE_PASS_ENVIRONMENT)); te->name= "Environment"; te->directdata= &srl->passflag; - te= outliner_add_element(soops, &tenla->subtree, id, tenla, TSE_R_PASS, SCE_PASS_EMIT); + te= outliner_add_element(soops, &tenla->subtree, id, tenla, TSE_R_PASS, LOG2I(SCE_PASS_EMIT)); te->name= "Emit"; - te->directdata= &srl->passflag;*/ + te->directdata= &srl->passflag; } +#undef LOG2I /* special handling of hierarchical non-lib data */ static void outliner_add_bone(SpaceOops *soops, ListBase *lb, ID *id, Bone *curBone, @@ -4977,22 +4981,29 @@ static void outliner_draw_restrictbuts(uiBlock *block, Scene *scene, ARegion *ar if(te->ys+2*OL_H >= ar->v2d.cur.ymin && te->ys <= ar->v2d.cur.ymax) { /* objects have toggle-able restriction flags */ if(tselem->type==0 && te->idcode==ID_OB) { + PointerRNA ptr; + ob = (Object *)tselem->id; + RNA_pointer_create((ID *)ob, &RNA_Object, ob, &ptr); uiBlockSetEmboss(block, UI_EMBOSSN); - bt= uiDefIconButBitS(block, ICONTOG, OB_RESTRICT_VIEW, 0, ICON_RESTRICT_VIEW_OFF, - (int)ar->v2d.cur.xmax-OL_TOG_RESTRICT_VIEWX, (short)te->ys, 17, OL_H-1, &(ob->restrictflag), 0, 0, 0, 0, "Restrict/Allow visibility in the 3D View"); + bt= uiDefIconButR(block, ICONTOG, 0, ICON_RESTRICT_VIEW_OFF, + (int)ar->v2d.cur.xmax-OL_TOG_RESTRICT_VIEWX, (short)te->ys, 17, OL_H-1, + &ptr, "restrict_view", -1, 0, 0, -1, -1, NULL); uiButSetFunc(bt, restrictbutton_view_cb, scene, ob); - bt= uiDefIconButBitS(block, ICONTOG, OB_RESTRICT_SELECT, 0, ICON_RESTRICT_SELECT_OFF, - (int)ar->v2d.cur.xmax-OL_TOG_RESTRICT_SELECTX, (short)te->ys, 17, OL_H-1, &(ob->restrictflag), 0, 0, 0, 0, "Restrict/Allow selection in the 3D View"); + bt= uiDefIconButR(block, ICONTOG, 0, ICON_RESTRICT_SELECT_OFF, + (int)ar->v2d.cur.xmax-OL_TOG_RESTRICT_SELECTX, (short)te->ys, 17, OL_H-1, + &ptr, "restrict_select", -1, 0, 0, -1, -1, NULL); uiButSetFunc(bt, restrictbutton_sel_cb, scene, ob); - bt= uiDefIconButBitS(block, ICONTOG, OB_RESTRICT_RENDER, 0, ICON_RESTRICT_RENDER_OFF, - (int)ar->v2d.cur.xmax-OL_TOG_RESTRICT_RENDERX, (short)te->ys, 17, OL_H-1, &(ob->restrictflag), 0, 0, 0, 0, "Restrict/Allow renderability"); + bt= uiDefIconButR(block, ICONTOG, 0, ICON_RESTRICT_RENDER_OFF, + (int)ar->v2d.cur.xmax-OL_TOG_RESTRICT_RENDERX, (short)te->ys, 17, OL_H-1, + &ptr, "restrict_render", -1, 0, 0, -1, -1, NULL); uiButSetFunc(bt, restrictbutton_rend_cb, scene, ob); uiBlockSetEmboss(block, UI_EMBOSS); + } /* scene render layers and passes have toggle-able flags too! */ else if(tselem->type==TSE_R_LAYER) { @@ -5006,16 +5017,18 @@ static void outliner_draw_restrictbuts(uiBlock *block, Scene *scene, ARegion *ar } else if(tselem->type==TSE_R_PASS) { int *layflag= te->directdata; + int passflag= 1<<tselem->nr; + uiBlockSetEmboss(block, UI_EMBOSSN); - /* NOTE: tselem->nr is short! */ - bt= uiDefIconButBitI(block, ICONTOG, tselem->nr, 0, ICON_CHECKBOX_HLT-1, + + bt= uiDefIconButBitI(block, ICONTOG, passflag, 0, ICON_CHECKBOX_HLT-1, (int)ar->v2d.cur.xmax-OL_TOG_RESTRICT_VIEWX, (short)te->ys, 17, OL_H-1, layflag, 0, 0, 0, 0, "Render this Pass"); uiButSetFunc(bt, restrictbutton_r_lay_cb, tselem->id, NULL); layflag++; /* is lay_xor */ - if(ELEM8(tselem->nr, SCE_PASS_SPEC, SCE_PASS_SHADOW, SCE_PASS_AO, SCE_PASS_REFLECT, SCE_PASS_REFRACT, SCE_PASS_INDIRECT, SCE_PASS_EMIT, SCE_PASS_ENVIRONMENT)) - bt= uiDefIconButBitI(block, TOG, tselem->nr, 0, (*layflag & tselem->nr)?ICON_DOT:ICON_BLANK1, + if(ELEM8(passflag, SCE_PASS_SPEC, SCE_PASS_SHADOW, SCE_PASS_AO, SCE_PASS_REFLECT, SCE_PASS_REFRACT, SCE_PASS_INDIRECT, SCE_PASS_EMIT, SCE_PASS_ENVIRONMENT)) + bt= uiDefIconButBitI(block, TOG, passflag, 0, (*layflag & passflag)?ICON_DOT:ICON_BLANK1, (int)ar->v2d.cur.xmax-OL_TOG_RESTRICT_SELECTX, (short)te->ys, 17, OL_H-1, layflag, 0, 0, 0, 0, "Exclude this Pass from Combined"); uiButSetFunc(bt, restrictbutton_r_lay_cb, tselem->id, NULL); diff --git a/source/blender/makesdna/DNA_scene_types.h b/source/blender/makesdna/DNA_scene_types.h index 44cf1398495..8fe48f7d56a 100644 --- a/source/blender/makesdna/DNA_scene_types.h +++ b/source/blender/makesdna/DNA_scene_types.h @@ -179,24 +179,24 @@ typedef struct SceneRenderLayer { #define SCE_LAY_NEG_ZMASK 0x80000 /* srl->passflag */ -#define SCE_PASS_COMBINED 1 -#define SCE_PASS_Z 2 -#define SCE_PASS_RGBA 4 -#define SCE_PASS_DIFFUSE 8 -#define SCE_PASS_SPEC 16 -#define SCE_PASS_SHADOW 32 -#define SCE_PASS_AO 64 -#define SCE_PASS_REFLECT 128 -#define SCE_PASS_NORMAL 256 -#define SCE_PASS_VECTOR 512 -#define SCE_PASS_REFRACT 1024 -#define SCE_PASS_INDEXOB 2048 -#define SCE_PASS_UV 4096 -#define SCE_PASS_INDIRECT 8192 -#define SCE_PASS_MIST 16384 -#define SCE_PASS_RAYHITS 32768 -#define SCE_PASS_EMIT 65536 -#define SCE_PASS_ENVIRONMENT 131072 +#define SCE_PASS_COMBINED (1<<0) +#define SCE_PASS_Z (1<<1) +#define SCE_PASS_RGBA (1<<2) +#define SCE_PASS_DIFFUSE (1<<3) +#define SCE_PASS_SPEC (1<<4) +#define SCE_PASS_SHADOW (1<<5) +#define SCE_PASS_AO (1<<6) +#define SCE_PASS_REFLECT (1<<7) +#define SCE_PASS_NORMAL (1<<8) +#define SCE_PASS_VECTOR (1<<9) +#define SCE_PASS_REFRACT (1<<10) +#define SCE_PASS_INDEXOB (1<<11) +#define SCE_PASS_UV (1<<12) +#define SCE_PASS_INDIRECT (1<<13) +#define SCE_PASS_MIST (1<<14) +#define SCE_PASS_RAYHITS (1<<15) +#define SCE_PASS_EMIT (1<<16) +#define SCE_PASS_ENVIRONMENT (1<<17) /* note, srl->passflag is treestore element 'nr' in outliner, short still... */ diff --git a/source/blender/makesrna/intern/rna_object.c b/source/blender/makesrna/intern/rna_object.c index 23184af93ff..c16110b4c0a 100644 --- a/source/blender/makesrna/intern/rna_object.c +++ b/source/blender/makesrna/intern/rna_object.c @@ -1781,16 +1781,19 @@ static void rna_def_object(BlenderRNA *brna) prop= RNA_def_property(srna, "restrict_view", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "restrictflag", OB_RESTRICT_VIEW); RNA_def_property_ui_text(prop, "Restrict View", "Restrict visibility in the viewport"); + RNA_def_property_ui_icon(prop, ICON_RESTRICT_VIEW_OFF, 1); RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, NULL); prop= RNA_def_property(srna, "restrict_select", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "restrictflag", OB_RESTRICT_SELECT); RNA_def_property_ui_text(prop, "Restrict Select", "Restrict selection in the viewport"); + RNA_def_property_ui_icon(prop, ICON_RESTRICT_SELECT_OFF, 1); RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, NULL); prop= RNA_def_property(srna, "restrict_render", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "restrictflag", OB_RESTRICT_RENDER); RNA_def_property_ui_text(prop, "Restrict Render", "Restrict renderability"); + RNA_def_property_ui_icon(prop, ICON_RESTRICT_RENDER_OFF, 1); RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, NULL); /* anim */ diff --git a/source/blender/python/generic/blf_api.c b/source/blender/python/generic/blf_api.c index 81c7da15438..a16481d760c 100644 --- a/source/blender/python/generic/blf_api.c +++ b/source/blender/python/generic/blf_api.c @@ -346,7 +346,6 @@ static char py_blf_load_doc[] = static PyObject *py_blf_load(PyObject *self, PyObject *args) { - int fontid = 0; char* filename; if (!PyArg_ParseTuple(args, "s:blf.load", &filename)) |