diff options
author | Joshua Leung <aligorith@gmail.com> | 2009-06-25 08:33:21 +0400 |
---|---|---|
committer | Joshua Leung <aligorith@gmail.com> | 2009-06-25 08:33:21 +0400 |
commit | a1c5c501a6b4b8bfdee6f60869c122fb6f321726 (patch) | |
tree | b2bd0a250560638b3f08627494eeb002e067a8c9 /source/blender/editors | |
parent | e5f6a41b1b7125a4c3bc7ef2554c04b768ac765c (diff) | |
parent | 7a357cba3994bee7d05c7a8bf5736eb94067d564 (diff) |
At last... this merge should finally do the trick!
21073 to 21145
Diffstat (limited to 'source/blender/editors')
112 files changed, 1435 insertions, 681 deletions
diff --git a/source/blender/editors/animation/Makefile b/source/blender/editors/animation/Makefile index 19b62891b63..a7f36aa58ac 100644 --- a/source/blender/editors/animation/Makefile +++ b/source/blender/editors/animation/Makefile @@ -1,5 +1,5 @@ # -# $Id: Makefile 14 2002-10-13 15:57:19Z hans $ +# $Id$ # # ***** BEGIN GPL LICENSE BLOCK ***** # diff --git a/source/blender/editors/animation/anim_channels.c b/source/blender/editors/animation/anim_channels.c index 9230cdfc9a2..4ac1648361e 100644 --- a/source/blender/editors/animation/anim_channels.c +++ b/source/blender/editors/animation/anim_channels.c @@ -1,5 +1,5 @@ /** - * $Id: editaction.c 17746 2008-12-08 11:19:44Z aligorith $ + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * diff --git a/source/blender/editors/animation/keyframes_draw.c b/source/blender/editors/animation/keyframes_draw.c index 07db47c8fed..56b1c63db74 100644 --- a/source/blender/editors/animation/keyframes_draw.c +++ b/source/blender/editors/animation/keyframes_draw.c @@ -1,5 +1,5 @@ /** - * $Id: drawaction.c 17746 2008-12-08 11:19:44Z aligorith $ + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * diff --git a/source/blender/editors/armature/Makefile b/source/blender/editors/armature/Makefile index 6c7ce81a8a1..0291bcb1830 100644 --- a/source/blender/editors/armature/Makefile +++ b/source/blender/editors/armature/Makefile @@ -1,5 +1,5 @@ # -# $Id: Makefile 14 2002-10-13 15:57:19Z hans $ +# $Id$ # # ***** BEGIN GPL LICENSE BLOCK ***** # diff --git a/source/blender/editors/armature/editarmature_sketch.c b/source/blender/editors/armature/editarmature_sketch.c index f010abdb7e7..fb030b91ce1 100644 --- a/source/blender/editors/armature/editarmature_sketch.c +++ b/source/blender/editors/armature/editarmature_sketch.c @@ -243,6 +243,7 @@ void BIF_makeListTemplates(bContext *C) { Object *obedit = CTX_data_edit_object(C); Scene *scene = CTX_data_scene(C); + ToolSettings *ts = CTX_data_tool_settings(C); Base *base; int index = 0; @@ -263,7 +264,7 @@ void BIF_makeListTemplates(bContext *C) index++; BLI_ghash_insert(TEMPLATES_HASH, SET_INT_IN_POINTER(index), ob); - if (ob == scene->toolsettings->skgen_template) + if (ob == ts->skgen_template) { TEMPLATES_CURRENT = index; } @@ -305,8 +306,9 @@ char *BIF_listTemplates(bContext *C) int BIF_currentTemplate(bContext *C) { - Scene *scene = CTX_data_scene(C); - if (TEMPLATES_CURRENT == 0 && scene->toolsettings->skgen_template != NULL) + ToolSettings *ts = CTX_data_tool_settings(C); + + if (TEMPLATES_CURRENT == 0 && ts->skgen_template != NULL) { GHashIterator ghi; BLI_ghashIterator_init(&ghi, TEMPLATES_HASH); @@ -316,7 +318,7 @@ int BIF_currentTemplate(bContext *C) Object *ob = BLI_ghashIterator_getValue(&ghi); int key = GET_INT_FROM_POINTER(BLI_ghashIterator_getKey(&ghi)); - if (ob == scene->toolsettings->skgen_template) + if (ob == ts->skgen_template) { TEMPLATES_CURRENT = key; break; @@ -360,8 +362,8 @@ RigGraph* sk_makeTemplateGraph(bContext *C, Object *ob) int BIF_nbJointsTemplate(bContext *C) { - Scene *scene = CTX_data_scene(C); - RigGraph *rg = sk_makeTemplateGraph(C, scene->toolsettings->skgen_template); + ToolSettings *ts = CTX_data_tool_settings(C); + RigGraph *rg = sk_makeTemplateGraph(C, ts->skgen_template); if (rg) { @@ -375,7 +377,7 @@ int BIF_nbJointsTemplate(bContext *C) char * BIF_nameBoneTemplate(bContext *C) { - Scene *scene = CTX_data_scene(C); + ToolSettings *ts = CTX_data_tool_settings(C); SK_Sketch *stk = GLOBAL_sketch; RigGraph *rg; int index = 0; @@ -385,7 +387,7 @@ char * BIF_nameBoneTemplate(bContext *C) index = stk->active_stroke->nb_points; } - rg = sk_makeTemplateGraph(C, scene->toolsettings->skgen_template); + rg = sk_makeTemplateGraph(C, ts->skgen_template); if (rg == NULL) { @@ -418,14 +420,14 @@ void BIF_freeTemplates(bContext *C) void BIF_setTemplate(bContext *C, int index) { - Scene *scene = CTX_data_scene(C); + ToolSettings *ts = CTX_data_tool_settings(C); if (index > 0) { - scene->toolsettings->skgen_template = BLI_ghash_lookup(TEMPLATES_HASH, SET_INT_IN_POINTER(index)); + ts->skgen_template = BLI_ghash_lookup(TEMPLATES_HASH, SET_INT_IN_POINTER(index)); } else { - scene->toolsettings->skgen_template = NULL; + ts->skgen_template = NULL; if (TEMPLATE_RIGG != NULL) { @@ -439,19 +441,19 @@ void BIF_setTemplate(bContext *C, int index) void sk_autoname(bContext *C, ReebArc *arc) { - Scene *scene = CTX_data_scene(C); - if (scene->toolsettings->skgen_retarget_options & SK_RETARGET_AUTONAME) + ToolSettings *ts = CTX_data_tool_settings(C); + if (ts->skgen_retarget_options & SK_RETARGET_AUTONAME) { if (arc == NULL) { - char *num = scene->toolsettings->skgen_num_string; + char *num = ts->skgen_num_string; int i = atoi(num); i++; BLI_snprintf(num, 8, "%i", i); } else { - char *side = scene->toolsettings->skgen_side_string; + char *side = ts->skgen_side_string; int valid = 0; int caps = 0; @@ -525,7 +527,7 @@ ReebArc *sk_strokeToArc(SK_Stroke *stk, float imat[][4], float tmat[][3]) void sk_retargetStroke(bContext *C, SK_Stroke *stk) { - Scene *scene = CTX_data_scene(C); + ToolSettings *ts = CTX_data_tool_settings(C); Object *obedit = CTX_data_edit_object(C); float imat[4][4]; float tmat[3][3]; @@ -541,7 +543,7 @@ void sk_retargetStroke(bContext *C, SK_Stroke *stk) sk_autoname(C, arc); - rg = sk_makeTemplateGraph(C, scene->toolsettings->skgen_template); + rg = sk_makeTemplateGraph(C, ts->skgen_template); BIF_retargetArc(C, arc, rg); @@ -1408,10 +1410,10 @@ void sk_startStroke(SK_Sketch *sketch) void sk_endStroke(bContext *C, SK_Sketch *sketch) { - Scene *scene = CTX_data_scene(C); + ToolSettings *ts = CTX_data_tool_settings(C); sk_shrinkStrokeBuffer(sketch->active_stroke); - if (scene->toolsettings->bone_sketching & BONE_SKETCHING_ADJUST) + if (ts->bone_sketching & BONE_SKETCHING_ADJUST) { sk_endOverdraw(sketch); } @@ -1521,10 +1523,10 @@ int sk_addStrokeDrawPoint(bContext *C, SK_Sketch *sketch, SK_Stroke *stk, SK_Dra int sk_getStrokeSnapPoint(bContext *C, SK_Point *pt, SK_Sketch *sketch, SK_Stroke *stk, SK_DrawData *dd) { - Scene *scene = CTX_data_scene(C); + ToolSettings *ts = CTX_data_tool_settings(C); int point_added = 0; - if (scene->snap_mode == SCE_SNAP_MODE_VOLUME) + if (ts->snap_mode == SCE_SNAP_MODE_VOLUME) { ListBase depth_peels; DepthPeel *p1, *p2; @@ -1557,7 +1559,7 @@ int sk_getStrokeSnapPoint(bContext *C, SK_Point *pt, SK_Sketch *sketch, SK_Strok p1->flag = 1; /* if peeling objects, take the first and last from each object */ - if (scene->snap_flag & SCE_SNAP_PEEL_OBJECT) + if (ts->snap_flag & SCE_SNAP_PEEL_OBJECT) { DepthPeel *peel; for (peel = p1->next; peel; peel = peel->next) @@ -1627,7 +1629,7 @@ int sk_getStrokeSnapPoint(bContext *C, SK_Point *pt, SK_Sketch *sketch, SK_Strok int dist = SNAP_MIN_DISTANCE; // Use a user defined value here /* snap to strokes */ - // if (scene->snap_mode == SCE_SNAP_MODE_VERTEX) /* snap all the time to strokes */ + // if (ts->snap_mode == SCE_SNAP_MODE_VERTEX) /* snap all the time to strokes */ for (snap_stk = sketch->strokes.first; snap_stk; snap_stk = snap_stk->next) { SK_Point *spt = NULL; @@ -1713,7 +1715,7 @@ int sk_addStrokeSnapPoint(bContext *C, SK_Sketch *sketch, SK_Stroke *stk, SK_Dra void sk_addStrokePoint(bContext *C, SK_Sketch *sketch, SK_Stroke *stk, SK_DrawData *dd, short snap) { - Scene *scene = CTX_data_scene(C); + ToolSettings *ts = CTX_data_tool_settings(C); int point_added = 0; if (snap) @@ -1726,7 +1728,7 @@ void sk_addStrokePoint(bContext *C, SK_Sketch *sketch, SK_Stroke *stk, SK_DrawDa point_added = sk_addStrokeDrawPoint(C, sketch, stk, dd); } - if (stk == sketch->active_stroke && scene->toolsettings->bone_sketching & BONE_SKETCHING_ADJUST) + if (stk == sketch->active_stroke && ts->bone_sketching & BONE_SKETCHING_ADJUST) { sk_updateOverdraw(C, sketch, stk, dd); } @@ -1951,7 +1953,7 @@ static int iteratorStopped(void *arg) void sk_convertStroke(bContext *C, SK_Stroke *stk) { Object *obedit = CTX_data_edit_object(C); - Scene *scene = CTX_data_scene(C); + ToolSettings *ts = CTX_data_tool_settings(C); bArmature *arm = obedit->data; SK_Point *head; EditBone *parent = NULL; @@ -1990,17 +1992,17 @@ void sk_convertStroke(bContext *C, SK_Stroke *stk) initStrokeIterator(iter, stk, head_index, i); - if (scene->toolsettings->bone_sketching_convert == SK_CONVERT_CUT_ADAPTATIVE) + if (ts->bone_sketching_convert == SK_CONVERT_CUT_ADAPTATIVE) { - bone = subdivideArcBy(scene->toolsettings, arm, arm->edbo, iter, invmat, tmat, nextAdaptativeSubdivision); + bone = subdivideArcBy(ts, arm, arm->edbo, iter, invmat, tmat, nextAdaptativeSubdivision); } - else if (scene->toolsettings->bone_sketching_convert == SK_CONVERT_CUT_LENGTH) + else if (ts->bone_sketching_convert == SK_CONVERT_CUT_LENGTH) { - bone = subdivideArcBy(scene->toolsettings, arm, arm->edbo, iter, invmat, tmat, nextLengthSubdivision); + bone = subdivideArcBy(ts, arm, arm->edbo, iter, invmat, tmat, nextLengthSubdivision); } - else if (scene->toolsettings->bone_sketching_convert == SK_CONVERT_CUT_FIXED) + else if (ts->bone_sketching_convert == SK_CONVERT_CUT_FIXED) { - bone = subdivideArcBy(scene->toolsettings, arm, arm->edbo, iter, invmat, tmat, nextFixedSubdivision); + bone = subdivideArcBy(ts, arm, arm->edbo, iter, invmat, tmat, nextFixedSubdivision); } } @@ -2042,14 +2044,14 @@ void sk_convertStroke(bContext *C, SK_Stroke *stk) void sk_convert(bContext *C, SK_Sketch *sketch) { - Scene *scene = CTX_data_scene(C); + ToolSettings *ts = CTX_data_tool_settings(C); SK_Stroke *stk; for (stk = sketch->strokes.first; stk; stk = stk->next) { if (stk->selected == 1) { - if (scene->toolsettings->bone_sketching_convert == SK_CONVERT_RETARGET) + if (ts->bone_sketching_convert == SK_CONVERT_RETARGET) { sk_retargetStroke(C, stk); } @@ -2693,7 +2695,7 @@ void sk_selectStroke(bContext *C, SK_Sketch *sketch, short mval[2], int extend) rect.ymin= mval[1]-5; rect.ymax= mval[1]+5; - hits= view3d_opengl_select(&vc, buffer, MAXPICKBUF, &rect); + hits = view3d_opengl_select(&vc, buffer, MAXPICKBUF, &rect); if (hits>0) { @@ -2743,6 +2745,7 @@ void sk_queueRedrawSketch(SK_Sketch *sketch) void sk_drawSketch(Scene *scene, SK_Sketch *sketch, int with_names) { + ToolSettings *ts= scene->toolsettings; SK_Stroke *stk; glDisable(GL_DEPTH_TEST); @@ -2779,7 +2782,7 @@ void sk_drawSketch(Scene *scene, SK_Sketch *sketch, int with_names) if (stk->selected == 1) { - sk_drawStrokeSubdivision(scene->toolsettings, stk); + sk_drawStrokeSubdivision(ts, stk); } } @@ -2794,9 +2797,9 @@ void sk_drawSketch(Scene *scene, SK_Sketch *sketch, int with_names) { SK_Point *last = sk_lastStrokePoint(sketch->active_stroke); - if (scene->toolsettings->bone_sketching & BONE_SKETCHING_QUICK) + if (ts->bone_sketching & BONE_SKETCHING_QUICK) { - sk_drawStrokeSubdivision(scene->toolsettings, sketch->active_stroke); + sk_drawStrokeSubdivision(ts, sketch->active_stroke); } if (last != NULL) @@ -2839,7 +2842,7 @@ void sk_drawSketch(Scene *scene, SK_Sketch *sketch, int with_names) int sk_finish_stroke(bContext *C, SK_Sketch *sketch) { - Scene *scene = CTX_data_scene(C); + ToolSettings *ts = CTX_data_tool_settings(C); if (sketch->active_stroke != NULL) { @@ -2847,9 +2850,9 @@ int sk_finish_stroke(bContext *C, SK_Sketch *sketch) sk_endStroke(C, sketch); - if (scene->toolsettings->bone_sketching & BONE_SKETCHING_QUICK) + if (ts->bone_sketching & BONE_SKETCHING_QUICK) { - if (scene->toolsettings->bone_sketching_convert == SK_CONVERT_RETARGET) + if (ts->bone_sketching_convert == SK_CONVERT_RETARGET) { sk_retargetStroke(C, stk); } @@ -3196,11 +3199,11 @@ static int sketch_draw_preview(bContext *C, wmOperator *op, wmEvent *event) int ED_operator_sketch_mode_active_stroke(bContext *C) { Object *obedit = CTX_data_edit_object(C); - Scene *scene = CTX_data_scene(C); + ToolSettings *ts = CTX_data_tool_settings(C); if (obedit && obedit->type == OB_ARMATURE && - scene->toolsettings->bone_sketching & BONE_SKETCHING && + ts->bone_sketching & BONE_SKETCHING && GLOBAL_sketch != NULL && GLOBAL_sketch->active_stroke != NULL) { @@ -3215,12 +3218,12 @@ int ED_operator_sketch_mode_active_stroke(bContext *C) int ED_operator_sketch_mode_gesture(bContext *C) { Object *obedit = CTX_data_edit_object(C); - Scene *scene = CTX_data_scene(C); + ToolSettings *ts = CTX_data_tool_settings(C); if (obedit && obedit->type == OB_ARMATURE && - scene->toolsettings->bone_sketching & BONE_SKETCHING && - (scene->toolsettings->bone_sketching & BONE_SKETCHING_QUICK) == 0 && + ts->bone_sketching & BONE_SKETCHING && + (ts->bone_sketching & BONE_SKETCHING_QUICK) == 0 && GLOBAL_sketch != NULL && GLOBAL_sketch->active_stroke == NULL) { @@ -3235,12 +3238,12 @@ int ED_operator_sketch_mode_gesture(bContext *C) int ED_operator_sketch_full_mode(bContext *C) { Object *obedit = CTX_data_edit_object(C); - Scene *scene = CTX_data_scene(C); + ToolSettings *ts = CTX_data_tool_settings(C); if (obedit && obedit->type == OB_ARMATURE && - scene->toolsettings->bone_sketching & BONE_SKETCHING && - (scene->toolsettings->bone_sketching & BONE_SKETCHING_QUICK) == 0) + ts->bone_sketching & BONE_SKETCHING && + (ts->bone_sketching & BONE_SKETCHING_QUICK) == 0) { return 1; } @@ -3253,11 +3256,11 @@ int ED_operator_sketch_full_mode(bContext *C) int ED_operator_sketch_mode(bContext *C) { Object *obedit = CTX_data_edit_object(C); - Scene *scene = CTX_data_scene(C); + ToolSettings *ts = CTX_data_tool_settings(C); if (obedit && obedit->type == OB_ARMATURE && - scene->toolsettings->bone_sketching & BONE_SKETCHING) + ts->bone_sketching & BONE_SKETCHING) { return 1; } diff --git a/source/blender/editors/curve/Makefile b/source/blender/editors/curve/Makefile index 6b1f628f231..6449700e50b 100644 --- a/source/blender/editors/curve/Makefile +++ b/source/blender/editors/curve/Makefile @@ -1,5 +1,5 @@ # -# $Id: Makefile 14 2002-10-13 15:57:19Z hans $ +# $Id$ # # ***** BEGIN GPL LICENSE BLOCK ***** # diff --git a/source/blender/editors/curve/curve_intern.h b/source/blender/editors/curve/curve_intern.h index a73a54323ee..2146855a75e 100644 --- a/source/blender/editors/curve/curve_intern.h +++ b/source/blender/editors/curve/curve_intern.h @@ -49,7 +49,6 @@ void FONT_OT_case_toggle(struct wmOperatorType *ot); void FONT_OT_case_set(struct wmOperatorType *ot); void FONT_OT_style_toggle(struct wmOperatorType *ot); void FONT_OT_style_set(struct wmOperatorType *ot); -void FONT_OT_material_set(struct wmOperatorType *ot); void FONT_OT_text_copy(struct wmOperatorType *ot); void FONT_OT_text_cut(struct wmOperatorType *ot); diff --git a/source/blender/editors/curve/curve_ops.c b/source/blender/editors/curve/curve_ops.c index 5292d86d3c9..66cde772f3e 100644 --- a/source/blender/editors/curve/curve_ops.c +++ b/source/blender/editors/curve/curve_ops.c @@ -106,7 +106,6 @@ void ED_operatortypes_curve(void) WM_operatortype_append(FONT_OT_case_set); WM_operatortype_append(FONT_OT_style_toggle); WM_operatortype_append(FONT_OT_style_set); - WM_operatortype_append(FONT_OT_material_set); WM_operatortype_append(FONT_OT_text_copy); WM_operatortype_append(FONT_OT_text_cut); diff --git a/source/blender/editors/curve/editcurve.c b/source/blender/editors/curve/editcurve.c index 466908c562c..5283aacf39e 100644 --- a/source/blender/editors/curve/editcurve.c +++ b/source/blender/editors/curve/editcurve.c @@ -189,7 +189,7 @@ static short swap_selection_bpoint(BPoint *bp) return select_bpoint(bp, SELECT, 1, VISIBLE); } -short isNurbsel(Nurb *nu) +int isNurbsel(Nurb *nu) { BezTriple *bezt; BPoint *bp; diff --git a/source/blender/editors/curve/editfont.c b/source/blender/editors/curve/editfont.c index 5389db9e2ee..9f2bd6f26f9 100644 --- a/source/blender/editors/curve/editfont.c +++ b/source/blender/editors/curve/editfont.c @@ -700,50 +700,6 @@ void FONT_OT_style_toggle(wmOperatorType *ot) RNA_def_enum(ot->srna, "style", style_items, CU_BOLD, "Style", "Style to set selection to."); } -/******************* set material operator ********************/ - -static int set_material_exec(bContext *C, wmOperator *op) -{ - Scene *scene= CTX_data_scene(C); - Object *obedit= CTX_data_edit_object(C); - Curve *cu= obedit->data; - EditFont *ef= cu->editfont; - int i, mat_nr, selstart, selend; - - if(!BKE_font_getselection(obedit, &selstart, &selend)) - return OPERATOR_CANCELLED; - - if(RNA_property_is_set(op->ptr, "index")) - mat_nr= RNA_int_get(op->ptr, "index"); - else - mat_nr= obedit->actcol; - - for(i=selstart; i<=selend; i++) - ef->textbufinfo[i].mat_nr = mat_nr; - - DAG_object_flush_update(scene, obedit, OB_RECALC_DATA); - WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_DATA, obedit); - - return OPERATOR_FINISHED; -} - -void FONT_OT_material_set(wmOperatorType *ot) -{ - /* identifiers */ - ot->name= "Set Material"; - ot->idname= "FONT_OT_material_set"; - - /* api callbacks */ - ot->exec= set_material_exec; - ot->poll= ED_operator_editfont; - - /* flags */ - ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; - - /* properties */ - RNA_def_int(ot->srna, "index", 0, 0, INT_MAX, "Material Index", "Material slot index.", 0, INT_MAX); -} - /******************* copy text operator ********************/ static void copy_selection(Object *obedit) diff --git a/source/blender/editors/datafiles/Bfont.c b/source/blender/editors/datafiles/Bfont.c index 4080a0d369f..cd45debcbe4 100644 --- a/source/blender/editors/datafiles/Bfont.c +++ b/source/blender/editors/datafiles/Bfont.c @@ -1,6 +1,6 @@ /* DataToC output of file <Bfont> */ /* - * $Id: Bfont.c 125 2002-11-25 12:02:15Z mein $ + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * diff --git a/source/blender/editors/datafiles/Makefile b/source/blender/editors/datafiles/Makefile index 4162125623e..d7bb4e7222f 100644 --- a/source/blender/editors/datafiles/Makefile +++ b/source/blender/editors/datafiles/Makefile @@ -1,5 +1,5 @@ # -# $Id: Makefile 14 2002-10-13 15:57:19Z hans $ +# $Id$ # # ***** BEGIN GPL LICENSE BLOCK ***** # diff --git a/source/blender/editors/gpencil/Makefile b/source/blender/editors/gpencil/Makefile index f4c1cd246f4..9bc5f491a83 100644 --- a/source/blender/editors/gpencil/Makefile +++ b/source/blender/editors/gpencil/Makefile @@ -1,5 +1,5 @@ # -# $Id: Makefile 14 2002-10-13 15:57:19Z hans $ +# $Id$ # # ***** BEGIN GPL LICENSE BLOCK ***** # diff --git a/source/blender/editors/gpencil/gpencil_edit.c b/source/blender/editors/gpencil/gpencil_edit.c index bad86c170ab..c0c1cbc7ac6 100644 --- a/source/blender/editors/gpencil/gpencil_edit.c +++ b/source/blender/editors/gpencil/gpencil_edit.c @@ -1,5 +1,5 @@ /** - * $Id: gpencil.c 19758 2009-04-16 13:10:08Z aligorith $ + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * diff --git a/source/blender/editors/include/BIF_gl.h b/source/blender/editors/include/BIF_gl.h index 014201648c9..c1b3b056d62 100644 --- a/source/blender/editors/include/BIF_gl.h +++ b/source/blender/editors/include/BIF_gl.h @@ -1,5 +1,5 @@ /** - * $Id: BIF_gl.h 10455 2007-04-04 13:18:41Z campbellbarton $ + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * diff --git a/source/blender/editors/include/ED_curve.h b/source/blender/editors/include/ED_curve.h index c619ee80f70..2cebc6a572a 100644 --- a/source/blender/editors/include/ED_curve.h +++ b/source/blender/editors/include/ED_curve.h @@ -30,6 +30,7 @@ struct Base; struct bContext; +struct Nurb; struct Object; struct Scene; struct Text; @@ -52,6 +53,8 @@ void mouse_nurb (struct bContext *C, short mval[2], int extend); struct Nurb *add_nurbs_primitive(struct bContext *C, int type, int newname); +int isNurbsel (struct Nurb *nu);; + /* editfont.h */ void undo_push_font (struct bContext *C, char *name); void make_editText (struct Object *obedit); diff --git a/source/blender/editors/include/ED_fluidsim.h b/source/blender/editors/include/ED_fluidsim.h index bda879173c3..586f16f42aa 100644 --- a/source/blender/editors/include/ED_fluidsim.h +++ b/source/blender/editors/include/ED_fluidsim.h @@ -1,7 +1,7 @@ /** * BKE_fluidsim.h * - * $Id: LBM_fluidsim.h 17433 2008-11-12 21:16:53Z blendix $ + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * diff --git a/source/blender/editors/include/ED_keyframes_draw.h b/source/blender/editors/include/ED_keyframes_draw.h index 153b10cf832..d2269300d24 100644 --- a/source/blender/editors/include/ED_keyframes_draw.h +++ b/source/blender/editors/include/ED_keyframes_draw.h @@ -1,5 +1,5 @@ /** - * $Id: BDR_drawaction.h 17579 2008-11-26 11:01:56Z aligorith $ + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * diff --git a/source/blender/editors/include/ED_keyframing.h b/source/blender/editors/include/ED_keyframing.h index fbb469f8d43..9d063910aa9 100644 --- a/source/blender/editors/include/ED_keyframing.h +++ b/source/blender/editors/include/ED_keyframing.h @@ -1,5 +1,5 @@ /** - * $Id: BIF_keyframing.h 17216 2008-10-29 11:20:02Z aligorith $ + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * @@ -178,9 +178,9 @@ void ANIM_OT_remove_driver_button(struct wmOperatorType *ot); /* Auto-Keying macros for use by various tools */ /* check if auto-keyframing is enabled (per scene takes presidence) */ -#define IS_AUTOKEY_ON(scene) ((scene) ? (scene->autokey_mode & AUTOKEY_ON) : (U.autokey_mode & AUTOKEY_ON)) +#define IS_AUTOKEY_ON(scene) ((scene) ? (scene->toolsettings->autokey_mode & AUTOKEY_ON) : (U.autokey_mode & AUTOKEY_ON)) /* check the mode for auto-keyframing (per scene takes presidence) */ -#define IS_AUTOKEY_MODE(scene, mode) ((scene) ? (scene->autokey_mode == AUTOKEY_MODE_##mode) : (U.autokey_mode == AUTOKEY_MODE_##mode)) +#define IS_AUTOKEY_MODE(scene, mode) ((scene) ? (scene->toolsettings->autokey_mode == AUTOKEY_MODE_##mode) : (U.autokey_mode == AUTOKEY_MODE_##mode)) /* check if a flag is set for auto-keyframing (as userprefs only!) */ #define IS_AUTOKEY_FLAG(flag) (U.autokey_flag & AUTOKEY_FLAG_##flag) diff --git a/source/blender/editors/include/ED_mesh.h b/source/blender/editors/include/ED_mesh.h index 6dff4ee6ca4..937f6384f6a 100644 --- a/source/blender/editors/include/ED_mesh.h +++ b/source/blender/editors/include/ED_mesh.h @@ -147,6 +147,9 @@ int EM_init_backbuf_circle(struct ViewContext *vc, short xs, short ys, short r void EM_hide_mesh(struct EditMesh *em, int swap); void EM_reveal_mesh(struct EditMesh *em); +void EM_select_by_material(struct EditMesh *em, int index); +void EM_deselect_by_material(struct EditMesh *em, int index); + /* editface.c */ struct MTFace *EM_get_active_mtface(struct EditMesh *em, struct EditFace **act_efa, struct MCol **mcol, int sloppy); diff --git a/source/blender/editors/include/ED_particle.h b/source/blender/editors/include/ED_particle.h index 0e5d7302837..43cb5053f48 100644 --- a/source/blender/editors/include/ED_particle.h +++ b/source/blender/editors/include/ED_particle.h @@ -1,5 +1,5 @@ /* - * $Id: ED_editparticle.h $ + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * diff --git a/source/blender/editors/include/ED_pointcache.h b/source/blender/editors/include/ED_pointcache.h index 7bf51d9d53d..dc50e274fa9 100644 --- a/source/blender/editors/include/ED_pointcache.h +++ b/source/blender/editors/include/ED_pointcache.h @@ -1,5 +1,5 @@ /* - * $Id: ED_editparticle.h $ + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * diff --git a/source/blender/editors/include/UI_icons.h b/source/blender/editors/include/UI_icons.h index a38dfd93c30..602e94838b7 100644 --- a/source/blender/editors/include/UI_icons.h +++ b/source/blender/editors/include/UI_icons.h @@ -74,8 +74,8 @@ DEF_ICON(ICON_CHECKBOX_DEHLT) DEF_ICON(ICON_CHECKBOX_HLT) DEF_ICON(ICON_UNLOCKED) DEF_ICON(ICON_LOCKED) -DEF_ICON(ICON_PINNED) DEF_ICON(ICON_UNPINNED) +DEF_ICON(ICON_PINNED) DEF_ICON(ICON_BLANK015) DEF_ICON(ICON_RIGHTARROW) DEF_ICON(ICON_DOWNARROW_HLT) @@ -658,12 +658,12 @@ DEF_ICON(ICON_SNAP_VERTEX) DEF_ICON(ICON_SNAP_EDGE) DEF_ICON(ICON_SNAP_FACE) DEF_ICON(ICON_SNAP_VOLUME) +DEF_ICON(ICON_UVS_FACE) DEF_ICON(ICON_STICKY_UVS_LOC) DEF_ICON(ICON_STICKY_UVS_DISABLE) DEF_ICON(ICON_STICKY_UVS_VERT) DEF_ICON(ICON_CLIPUV_DEHLT) DEF_ICON(ICON_CLIPUV_HLT) -DEF_ICON(ICON_BLANK219) DEF_ICON(ICON_SNAP_PEEL_OBJECT) DEF_ICON(ICON_BLANK221) DEF_ICON(ICON_GRID) diff --git a/source/blender/editors/include/UI_interface.h b/source/blender/editors/include/UI_interface.h index 62469686e7f..f5e2b45d41e 100644 --- a/source/blender/editors/include/UI_interface.h +++ b/source/blender/editors/include/UI_interface.h @@ -53,6 +53,8 @@ struct uiStyle; struct uiFontStyle; struct ColorBand; struct CurveMapping; +struct Image; +struct ImageUser; typedef struct uiBut uiBut; typedef struct uiBlock uiBlock; @@ -415,7 +417,7 @@ void uiBlockPickerButtons(struct uiBlock *block, float *col, float *hsv, float * void uiBlockColorbandButtons(struct uiBlock *block, struct ColorBand *coba, struct rctf *butr, int event); uiBut *uiDefAutoButR(uiBlock *block, struct PointerRNA *ptr, struct PropertyRNA *prop, int index, char *name, int icon, int x1, int y1, int x2, int y2); -void uiDefAutoButsRNA(const struct bContext *C, uiLayout *layout, struct PointerRNA *ptr); +void uiDefAutoButsRNA(const struct bContext *C, uiLayout *layout, struct PointerRNA *ptr, int columns); /* Links * @@ -452,7 +454,7 @@ typedef void (*uiButSearchFunc)(const struct bContext *C, void *arg, char *str, typedef void (*uiBlockHandleFunc)(struct bContext *C, void *arg, int event); /* use inside searchfunc to add items */ -int uiSearchItemAdd(uiSearchItems *items, const char *name, void *poin); +int uiSearchItemAdd(uiSearchItems *items, const char *name, void *poin, int iconid); /* bfunc gets search item *poin as arg2, or if NULL the old string */ void uiButSetSearchFunc (uiBut *but, uiButSearchFunc sfunc, void *arg1, uiButHandleFunc bfunc); /* height in pixels, it's using hardcoded values still */ @@ -614,6 +616,8 @@ void uiTemplatePreview(uiLayout *layout, struct ID *id); void uiTemplateColorRamp(uiLayout *layout, struct ColorBand *coba, int expand); void uiTemplateCurveMapping(uiLayout *layout, struct CurveMapping *cumap, int type); void uiTemplateLayers(uiLayout *layout, struct PointerRNA *ptr, char *propname); +void uiTemplateImageLayers(uiLayout *layout, struct bContext *C, struct Image *ima, struct ImageUser *iuser); +void uiTemplateList(uiLayout *layout, struct PointerRNA *ptr, char *propname, char *activeprop, int items); /* items */ void uiItemO(uiLayout *layout, char *name, int icon, char *opname); diff --git a/source/blender/editors/include/UI_resources.h b/source/blender/editors/include/UI_resources.h index 7168e593a8a..1ae3634c73b 100644 --- a/source/blender/editors/include/UI_resources.h +++ b/source/blender/editors/include/UI_resources.h @@ -1,5 +1,5 @@ /** - * $Id: UI_resources.h 13057 2007-12-30 12:08:28Z aligorith $ + * $Id$ * * ***** BEGIN GPL/BL DUAL LICENSE BLOCK ***** * diff --git a/source/blender/editors/interface/Makefile b/source/blender/editors/interface/Makefile index dfc8187de49..a3d0692f1e1 100644 --- a/source/blender/editors/interface/Makefile +++ b/source/blender/editors/interface/Makefile @@ -1,5 +1,5 @@ # -# $Id: Makefile 14 2002-10-13 15:57:19Z hans $ +# $Id$ # # ***** BEGIN GPL LICENSE BLOCK ***** # diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c index 5ffc6440dc4..73425eac0e1 100644 --- a/source/blender/editors/interface/interface.c +++ b/source/blender/editors/interface/interface.c @@ -1,5 +1,5 @@ /** - * $Id: interface.c 16882 2008-10-02 12:29:45Z ton $ + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * @@ -671,7 +671,8 @@ void uiDrawBlock(const bContext *C, uiBlock *block) /* widgets */ for(but= block->buttons.first; but; but= but->next) { ui_but_to_pixelrect(&rect, ar, block, but); - ui_draw_but(C, ar, &style, but, &rect); + if(!(but->flag & UI_HIDDEN)) + ui_draw_but(C, ar, &style, but, &rect); } /* restore matrix */ @@ -1281,17 +1282,13 @@ void ui_get_but_string(uiBut *but, char *str, int maxlen) else if(type == PROP_POINTER) { /* RNA pointer */ PointerRNA ptr= RNA_property_pointer_get(&but->rnapoin, but->rnaprop); - PropertyRNA *nameprop; - - if(ptr.data && (nameprop = RNA_struct_name_property(ptr.type))) - buf= RNA_property_string_get_alloc(&ptr, nameprop, str, maxlen); - else - BLI_strncpy(str, "", maxlen); + buf= RNA_struct_name_get_alloc(&ptr, str, maxlen); } - else - BLI_strncpy(str, "", maxlen); - if(buf && buf != str) { + if(!buf) { + BLI_strncpy(str, "", maxlen); + } + else if(buf && buf != str) { /* string was too long, we have to truncate */ BLI_strncpy(str, buf, maxlen); MEM_freeN(buf); @@ -1339,20 +1336,14 @@ void ui_get_but_string(uiBut *but, char *str, int maxlen) static void ui_rna_ID_collection(bContext *C, uiBut *but, PointerRNA *ptr, PropertyRNA **prop) { - CollectionPropertyIterator iter; - PropertyRNA *iterprop, *iprop; StructRNA *srna; /* look for collection property in Main */ RNA_pointer_create(NULL, &RNA_Main, CTX_data_main(C), ptr); - iterprop= RNA_struct_iterator_property(ptr->type); - RNA_property_collection_begin(ptr, iterprop, &iter); *prop= NULL; - for(; iter.valid; RNA_property_collection_next(&iter)) { - iprop= iter.ptr.data; - + RNA_STRUCT_BEGIN(ptr, iprop) { /* if it's a collection and has same pointer type, we've got it */ if(RNA_property_type(iprop) == PROP_COLLECTION) { srna= RNA_property_pointer_type(ptr, iprop); @@ -1363,8 +1354,7 @@ static void ui_rna_ID_collection(bContext *C, uiBut *but, PointerRNA *ptr, Prope } } } - - RNA_property_collection_end(&iter); + RNA_STRUCT_END; } /* autocomplete callback for RNA pointers */ @@ -1372,9 +1362,8 @@ static void ui_rna_ID_autocomplete(bContext *C, char *str, void *arg_but) { uiBut *but= arg_but; AutoComplete *autocpl; - CollectionPropertyIterator iter; PointerRNA ptr; - PropertyRNA *prop, *nameprop; + PropertyRNA *prop; char *name; if(str[0]==0) return; @@ -1384,22 +1373,19 @@ static void ui_rna_ID_autocomplete(bContext *C, char *str, void *arg_but) if(prop==NULL) return; autocpl= autocomplete_begin(str, ui_get_but_string_max_length(but)); - RNA_property_collection_begin(&ptr, prop, &iter); /* loop over items in collection */ - for(; iter.valid; RNA_property_collection_next(&iter)) { - if(iter.ptr.data && (nameprop = RNA_struct_name_property(iter.ptr.type))) { - name= RNA_property_string_get_alloc(&iter.ptr, nameprop, NULL, 0); - - if(name) { - /* test item name */ - autocomplete_do_name(autocpl, name); - MEM_freeN(name); - } + RNA_PROP_BEGIN(&ptr, itemptr, prop) { + name= RNA_struct_name_get_alloc(&itemptr, NULL, 0); + + /* test item name */ + if(name) { + autocomplete_do_name(autocpl, name); + MEM_freeN(name); } } + RNA_PROP_END; - RNA_property_collection_end(&iter); autocomplete_end(autocpl, str); } @@ -2753,7 +2739,7 @@ void uiBlockFlipOrder(uiBlock *block) uiBut *but, *next; float centy, miny=10000, maxy= -10000; - if(!(U.uiflag & USER_DIRECTIONALORDER)) + if(U.uiflag & USER_MENUFIXEDORDER) return; for(but= block->buttons.first; but; but= but->next) { diff --git a/source/blender/editors/interface/interface_draw.c b/source/blender/editors/interface/interface_draw.c index 6d6d4ab9299..8400fee0c55 100644 --- a/source/blender/editors/interface/interface_draw.c +++ b/source/blender/editors/interface/interface_draw.c @@ -1,5 +1,5 @@ /** - * $Id: interface_draw.c 15733 2008-07-24 09:23:13Z aligorith $ + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c index fb5afbf5e36..2382af53a11 100644 --- a/source/blender/editors/interface/interface_handlers.c +++ b/source/blender/editors/interface/interface_handlers.c @@ -404,7 +404,15 @@ static void ui_apply_but_TOG(bContext *C, uiBlock *block, uiBut *but, uiHandleBu static void ui_apply_but_ROW(bContext *C, uiBlock *block, uiBut *but, uiHandleButtonData *data) { + uiBut *bt; + ui_set_but_val(but, but->hardmax); + + /* states of other row buttons */ + for(bt= block->buttons.first; bt; bt= bt->next) + if(bt!=but && bt->poin==but->poin && bt->type==ROW) + ui_check_but(bt); + ui_apply_but_func(C, but); data->retval= but->retval; @@ -738,11 +746,8 @@ static void ui_apply_button(bContext *C, uiBlock *block, uiBut *but, uiHandleBut ui_apply_but_ROW(C, block, but, data); break; case SCROLL: - break; case NUM: case NUMABS: - ui_apply_but_NUM(C, but, data); - break; case SLI: case NUMSLI: ui_apply_but_NUM(C, but, data); @@ -1433,7 +1438,6 @@ static void ui_do_but_textedit(bContext *C, uiBlock *block, uiBut *but, uiHandle } } else if(inbox) { - printf("release inside \n"); button_activate_state(C, but, BUTTON_STATE_EXIT); retval= WM_UI_HANDLER_BREAK; } @@ -2053,6 +2057,11 @@ static int ui_numedit_but_SLI(uiBut *but, uiHandleButtonData *data, int shift, i if(but->type==NUMSLI) deler= ((but->x2-but->x1) - 5.0*but->aspect); else if(but->type==HSVSLI) deler= ((but->x2-but->x1)/2 - 5.0*but->aspect); + else if(but->type==SCROLL) { + int horizontal= (but->x2 - but->x1 > but->y2 - but->y1); + float size= (horizontal)? (but->x2-but->x1): -(but->y2-but->y1); + deler= size*(but->softmax - but->softmin)/(but->softmax - but->softmin + but->a1); + } else deler= (but->x2-but->x1- 5.0*but->aspect); f= (float)(mx-data->dragstartx)/deler + data->dragfstart; @@ -2223,6 +2232,54 @@ static int ui_do_but_SLI(bContext *C, uiBlock *block, uiBut *but, uiHandleButton return retval; } +static int ui_do_but_SCROLL(bContext *C, uiBlock *block, uiBut *but, uiHandleButtonData *data, wmEvent *event) +{ + int mx, my, click= 0; + int retval= WM_UI_HANDLER_CONTINUE; + int horizontal= (but->x2 - but->x1 > but->y2 - but->y1); + + mx= event->x; + my= event->y; + ui_window_to_block(data->region, block, &mx, &my); + + if(data->state == BUTTON_STATE_HIGHLIGHT) { + if(event->val==KM_PRESS) { + if(event->type == LEFTMOUSE) { + if(horizontal) { + data->dragstartx= mx; + data->draglastx= mx; + } + else { + data->dragstartx= my; + data->draglastx= my; + } + button_activate_state(C, but, BUTTON_STATE_NUM_EDITING); + retval= WM_UI_HANDLER_BREAK; + } + else if(ELEM(event->type, PADENTER, RETKEY) && event->val==KM_PRESS) + click= 1; + } + } + else if(data->state == BUTTON_STATE_NUM_EDITING) { + if(event->type == ESCKEY) { + data->cancel= 1; + data->escapecancel= 1; + button_activate_state(C, but, BUTTON_STATE_EXIT); + } + else if(event->type == LEFTMOUSE && event->val!=KM_PRESS) { + button_activate_state(C, but, BUTTON_STATE_EXIT); + } + else if(event->type == MOUSEMOVE) { + if(ui_numedit_but_SLI(but, data, 0, 0, (horizontal)? mx: my)) + ui_numedit_apply(C, block, but, data); + } + + retval= WM_UI_HANDLER_BREAK; + } + + return retval; +} + static int ui_do_but_BLOCK(bContext *C, uiBut *but, uiHandleButtonData *data, wmEvent *event) { @@ -3065,13 +3122,9 @@ static int ui_do_button(bContext *C, uiBlock *block, uiBut *but, wmEvent *event) case OPTIONN: retval= ui_do_but_TOG(C, but, data, event); break; -#if 0 case SCROLL: - /* DrawBut(b, 1); */ - /* do_scrollbut(b); */ - /* DrawBut(b,0); */ + retval= ui_do_but_SCROLL(C, block, but, data, event); break; -#endif case NUM: case NUMABS: retval= ui_do_but_NUM(C, block, but, data, event); @@ -3232,7 +3285,8 @@ static uiBut *ui_but_find_mouse_over(ARegion *ar, int x, int y) for(but=block->buttons.first; but; but= but->next) { if(ELEM3(but->type, LABEL, ROUNDBOX, SEPR)) continue; - + if(but->flag & UI_HIDDEN) + continue; if(ui_but_contains_pt(but, mx, my)) /* give precedence to already activated buttons */ if(!butover || (!butover->active && but->active)) diff --git a/source/blender/editors/interface/interface_intern.h b/source/blender/editors/interface/interface_intern.h index 3aed2a7c299..379c11a6f31 100644 --- a/source/blender/editors/interface/interface_intern.h +++ b/source/blender/editors/interface/interface_intern.h @@ -1,5 +1,5 @@ /** - * $Id: interface.h 14444 2008-04-16 22:40:48Z hos $ + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * @@ -50,6 +50,9 @@ struct bContextStore; /* visual types for drawing */ /* for time being separated from functional types */ typedef enum { + /* default */ + UI_WTYPE_REGULAR, + /* standard set */ UI_WTYPE_LABEL, UI_WTYPE_TOGGLE, @@ -78,7 +81,8 @@ typedef enum { UI_WTYPE_SWATCH, UI_WTYPE_RGB_PICKER, UI_WTYPE_NORMAL, - UI_WTYPE_BOX + UI_WTYPE_BOX, + UI_WTYPE_SCROLL } uiWidgetTypeEnum; @@ -98,7 +102,7 @@ typedef enum { #define UI_ACTIVE 4 #define UI_HAS_ICON 8 #define UI_TEXTINPUT 16 - +#define UI_HIDDEN 32 /* warn: rest of uiBut->flag in UI_interface.h */ /* internal panel drawing defines */ @@ -416,7 +420,7 @@ extern void ui_draw_but(const struct bContext *C, ARegion *ar, struct uiStyle *s struct ThemeUI; void ui_widget_color_init(struct ThemeUI *tui); -void ui_draw_menu_item(struct uiFontStyle *fstyle, rcti *rect, char *name, int state); +void ui_draw_menu_item(struct uiFontStyle *fstyle, rcti *rect, char *name, int iconid, int state); /* interface_style.c */ void uiStyleInit(void); diff --git a/source/blender/editors/interface/interface_layout.c b/source/blender/editors/interface/interface_layout.c index 81c49105870..03da6861974 100644 --- a/source/blender/editors/interface/interface_layout.c +++ b/source/blender/editors/interface/interface_layout.c @@ -601,7 +601,7 @@ void uiItemsEnumO(uiLayout *layout, char *opname, char *propname) RNA_property_enum_items(&ptr, prop, &item, &totitem); for(i=0; i<totitem; i++) - uiItemEnumO(layout, NULL, 0, opname, propname, item[i].value); + uiItemEnumO(layout, (char*)item[i].name, item[i].icon, opname, propname, item[i].value); } } @@ -716,6 +716,8 @@ static void ui_item_rna_size(uiLayout *layout, char *name, int icon, PropertyRNA else if(ui_layout_vary_direction(layout) == UI_ITEM_VARY_X) { if(type == PROP_BOOLEAN && strcmp(name, "") != 0) w += UI_UNIT_X; + else if(type == PROP_ENUM) + w += UI_UNIT_X/2; } *r_w= w; @@ -745,9 +747,11 @@ void uiItemFullR(uiLayout *layout, char *name, int icon, PointerRNA *ptr, Proper if(!icon) icon= RNA_property_ui_icon(prop); - if(ELEM5(type, PROP_INT, PROP_FLOAT, PROP_STRING, PROP_ENUM, PROP_POINTER)) + if(ELEM4(type, PROP_INT, PROP_FLOAT, PROP_STRING, PROP_POINTER)) name= ui_item_name_add_colon(name, namestr); - if(type == PROP_BOOLEAN && len) + else if(type == PROP_BOOLEAN && len) + 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) { @@ -1267,7 +1271,6 @@ static void ui_litem_layout_box(uiLayout *litem) h= litem->h; litem->x += style->boxspace; - litem->y -= style->boxspace; if(w != 0) litem->w -= 2*style->boxspace; if(h != 0) litem->h -= 2*style->boxspace; @@ -1348,6 +1351,7 @@ static void ui_litem_estimate_column_flow(uiLayout *litem) } } + litem->w= x; litem->h= litem->y - miny; } @@ -1453,9 +1457,9 @@ static void ui_litem_layout_free(uiLayout *litem) totw -= minx; toth -= miny; - if(litem->w && totw > litem->w) + if(litem->w && totw > 0) scalex= (float)litem->w/(float)totw; - if(litem->h && toth > litem->h) + if(litem->h && toth > 0) scaley= (float)litem->h/(float)toth; x= litem->x; @@ -1466,15 +1470,15 @@ static void ui_litem_layout_free(uiLayout *litem) ui_item_size(item, &itemw, &itemh); if(scalex != 1.0f) { - newx= itemx*scalex; - itemw= (itemx + itemw)*scalex - newx; - itemx= newx; + newx= (itemx - minx)*scalex; + itemw= (itemx - minx + itemw)*scalex - newx; + itemx= minx + newx; } if(scaley != 1.0f) { - newy= itemy*scaley; - itemh= (itemy + itemh)*scaley - newy; - itemy= newy; + newy= (itemy - miny)*scaley; + itemh= (itemy - miny + itemh)*scaley - newy; + itemy= miny + newy; } ui_item_position(item, x+itemx-minx, y+itemy-miny, itemw, itemh); diff --git a/source/blender/editors/interface/interface_regions.c b/source/blender/editors/interface/interface_regions.c index 32bcae77e6b..a1dae39d687 100644 --- a/source/blender/editors/interface/interface_regions.c +++ b/source/blender/editors/interface/interface_regions.c @@ -40,6 +40,7 @@ #include "BLI_dynstr.h" #include "BKE_context.h" +#include "BKE_icons.h" #include "BKE_report.h" #include "BKE_screen.h" #include "BKE_texture.h" @@ -181,7 +182,7 @@ MenuData *decompose_menu_string(char *str) *s= '\0'; s++; } - } else if (c=='|' || c=='\0') { + } else if (c=='|' || c == '\n' || c=='\0') { if (nitem) { *s= '\0'; @@ -433,7 +434,7 @@ struct uiSearchItems { char **names; void **pointers; - + int *icons; }; typedef struct uiSearchboxData { @@ -448,7 +449,7 @@ typedef struct uiSearchboxData { /* exported for use by search callbacks */ /* returns zero if nothing to add */ -int uiSearchItemAdd(uiSearchItems *items, const char *name, void *poin) +int uiSearchItemAdd(uiSearchItems *items, const char *name, void *poin, int iconid) { if(items->totitem>=items->maxitem) { @@ -464,6 +465,7 @@ int uiSearchItemAdd(uiSearchItems *items, const char *name, void *poin) BLI_strncpy(items->names[items->totitem], name, items->maxstrlen); items->pointers[items->totitem]= poin; + items->icons[items->totitem]= iconid; items->totitem++; @@ -639,7 +641,8 @@ static void ui_searchbox_region_draw(const bContext *C, ARegion *ar) for(a=0; a<data->items.totitem; a++) { ui_searchbox_butrect(&rect, data, a); - ui_draw_menu_item(&data->fstyle, &rect, data->items.names[a], (a+1)==data->active?UI_ACTIVE:0); + /* widget itself */ + ui_draw_menu_item(&data->fstyle, &rect, data->items.names[a], data->items.icons[a], (a+1)==data->active?UI_ACTIVE:0); } /* indicate more */ @@ -666,6 +669,7 @@ static void ui_searchbox_region_free(ARegion *ar) MEM_freeN(data->items.names[a]); MEM_freeN(data->items.names); MEM_freeN(data->items.pointers); + MEM_freeN(data->items.icons); MEM_freeN(data); ar->regiondata= NULL; @@ -794,6 +798,7 @@ ARegion *ui_searchbox_create(bContext *C, ARegion *butregion, uiBut *but) data->items.totitem= 0; data->items.names= MEM_callocN(SEARCH_ITEMS*sizeof(void *), "search names"); data->items.pointers= MEM_callocN(SEARCH_ITEMS*sizeof(void *), "search pointers"); + data->items.icons= MEM_callocN(SEARCH_ITEMS*sizeof(int), "search icons"); for(x1=0; x1<SEARCH_ITEMS; x1++) data->items.names[x1]= MEM_callocN(but->hardmax+1, "search pointers"); @@ -1720,24 +1725,118 @@ static void do_picker_small_cb(bContext *C, void *bt1, void *hsv1) popup->menuretval= UI_RETURN_UPDATE; } +/* picker sizes S hsize, F full size, D spacer, B button/pallette height */ +#define SPICK1 150.0 +#define DPICK1 6.0 -/* only the color, a circle, slider */ -void uiBlockPickerSmall(uiBlock *block, float *col, float *hsv, float *old, char *hexcol, char mode, short retval) +/* only the color, a HS circle and V slider */ +static void uiBlockPickerSmall(uiBlock *block, float *col, float *hsv, float *old, char *hexcol, char mode, short retval) { uiBut *bt; VECCOPY(old, col); // old color stored there, for palette_cb to work /* HS circle */ - bt= uiDefButF(block, HSVCIRCLE, retval, "", 0, 0,SPICK,SPICK, col, 0.0, 0.0, 0, 0, ""); + bt= uiDefButF(block, HSVCIRCLE, retval, "", 0, 0,SPICK1,SPICK1, col, 0.0, 0.0, 0, 0, ""); + uiButSetFunc(bt, do_picker_small_cb, bt, hsv); + + /* value */ + bt= uiDefButF(block, HSVCUBE, retval, "", SPICK1+DPICK1,0,14,SPICK1, col, 0.0, 0.0, 4, 0, ""); uiButSetFunc(bt, do_picker_small_cb, bt, hsv); +} + + +static void picker_new_hide_reveal(uiBlock *block, short colormode) +{ + uiBut *bt; + + /* tag buttons */ + for(bt= block->buttons.first; bt; bt= bt->next) { + + if(bt->type==NUMSLI || bt->type==TEX) { + if( bt->str[1]=='e') { + if(colormode==2) bt->flag &= ~UI_HIDDEN; + else bt->flag |= UI_HIDDEN; + } + else if( ELEM3(bt->str[0], 'R', 'G', 'B')) { + if(colormode==0) bt->flag &= ~UI_HIDDEN; + else bt->flag |= UI_HIDDEN; + } + else if( ELEM3(bt->str[0], 'H', 'S', 'V')) { + if(colormode==1) bt->flag &= ~UI_HIDDEN; + else bt->flag |= UI_HIDDEN; + } + } + } +} + +static void do_picker_new_mode_cb(bContext *C, void *bt1, void *colv) +{ + uiBut *bt= bt1; + short colormode= ui_get_but_val(bt); + + picker_new_hide_reveal(bt->block, colormode); +} + +/* a HS circle, V slider, rgb/hsv/hex sliders */ +static void uiBlockPickerNew(uiBlock *block, float *col, float *hsv, float *old, char *hexcol, char mode, short retval) +{ + static short colormode= 0; /* temp? 0=rgb, 1=hsv, 2=hex */ + uiBut *bt; + int width; + + VECCOPY(old, col); // old color stored there, for palette_cb to work + + /* HS circle */ + bt= uiDefButF(block, HSVCIRCLE, retval, "", 0, 0,SPICK1,SPICK1, col, 0.0, 0.0, 0, 0, ""); + uiButSetFunc(bt, do_picker_small_cb, bt, hsv); + /* value */ - bt= uiDefButF(block, HSVCUBE, retval, "", SPICK+DPICK,0,14,SPICK, col, 0.0, 0.0, 4, 0, ""); + bt= uiDefButF(block, HSVCUBE, retval, "", SPICK1+DPICK1,0,14,SPICK1, col, 0.0, 0.0, 4, 0, ""); uiButSetFunc(bt, do_picker_small_cb, bt, hsv); + + /* mode */ + width= (SPICK1+DPICK1+14)/3; + uiBlockBeginAlign(block); + bt= uiDefButS(block, ROW, retval, "RGB", 0, -30, width, 19, &colormode, 0.0, 0.0, 0, 0, ""); + uiButSetFunc(bt, do_picker_new_mode_cb, bt, col); + bt= uiDefButS(block, ROW, retval, "HSV", width, -30, width, 19, &colormode, 0.0, 1.0, 0, 0, ""); + uiButSetFunc(bt, do_picker_new_mode_cb, bt, hsv); + bt= uiDefButS(block, ROW, retval, "Hex", 2*width, -30, width, 19, &colormode, 0.0, 2.0, 0, 0, ""); + uiButSetFunc(bt, do_picker_new_mode_cb, bt, hexcol); + uiBlockEndAlign(block); + + /* sliders or hex */ + width= (SPICK1+DPICK1+14); + rgb_to_hsv(col[0], col[1], col[2], hsv, hsv+1, hsv+2); + sprintf(hexcol, "%02X%02X%02X", (unsigned int)(col[0]*255.0), (unsigned int)(col[1]*255.0), (unsigned int)(col[2]*255.0)); + + uiBlockBeginAlign(block); + bt= uiDefButF(block, NUMSLI, 0, "R ", 0, -60, width, 19, col, 0.0, 1.0, 10, 3, ""); + uiButSetFunc(bt, do_palette1_cb, bt, hsv); + bt= uiDefButF(block, NUMSLI, 0, "G ", 0, -80, width, 19, col+1, 0.0, 1.0, 10, 3, ""); + uiButSetFunc(bt, do_palette1_cb, bt, hsv); + bt= uiDefButF(block, NUMSLI, 0, "B ", 0, -100, width, 19, col+2, 0.0, 1.0, 10, 3, ""); + uiButSetFunc(bt, do_palette1_cb, bt, hsv); + uiBlockEndAlign(block); + + uiBlockBeginAlign(block); + bt= uiDefButF(block, NUMSLI, 0, "H ", 0, -60, width, 19, hsv, 0.0, 1.0, 10, 3, ""); + uiButSetFunc(bt, do_palette2_cb, bt, col); + bt= uiDefButF(block, NUMSLI, 0, "S ", 0, -80, width, 19, hsv+1, 0.0, 1.0, 10, 3, ""); + uiButSetFunc(bt, do_palette2_cb, bt, col); + bt= uiDefButF(block, NUMSLI, 0, "V ", 0, -100, width, 19, hsv+2, 0.0, 1.0, 10, 3, ""); + uiButSetFunc(bt, do_palette2_cb, bt, col); + uiBlockEndAlign(block); + + bt= uiDefBut(block, TEX, 0, "Hex: ", 0, -80, width, 19, hexcol, 0, 8, 0, 0, "Hex triplet for color (#RRGGBB)"); + uiButSetFunc(bt, do_palette_hex_cb, bt, hexcol); + picker_new_hide_reveal(block, colormode); } + static int ui_picker_small_wheel(const bContext *C, uiBlock *block, wmEvent *event) { float add= 0.0f; @@ -1790,13 +1889,22 @@ uiBlock *ui_block_func_COL(bContext *C, uiPopupBlockHandle *handle, void *arg_bu block->flag= UI_BLOCK_LOOP|UI_BLOCK_REDRAW|UI_BLOCK_KEEP_OPEN; uiBoundsBlock(block, 3); } - else { + else if(win->eventstate->alt) { uiBlockPickerSmall(block, handle->retvec, hsvcol, oldcol, hexcol, 'p', 0); block->flag= UI_BLOCK_LOOP|UI_BLOCK_REDRAW|UI_BLOCK_RET_1|UI_BLOCK_OUT_1; uiBoundsBlock(block, 10); block->block_event_func= ui_picker_small_wheel; - } + } + else { + uiBlockPickerNew(block, handle->retvec, hsvcol, oldcol, hexcol, 'p', 0); + block->flag= UI_BLOCK_LOOP|UI_BLOCK_REDRAW|UI_BLOCK_KEEP_OPEN; + uiBoundsBlock(block, 10); + + block->block_event_func= ui_picker_small_wheel; + } + + /* and lets go */ block->direction= UI_TOP; @@ -2464,7 +2572,6 @@ static uiPopupBlockHandle *ui_pup_menu(bContext *C, int maxrow, uiMenuHandleFunc return menu; } - static void operator_name_cb(bContext *C, void *arg, int retval) { const char *opname= arg; diff --git a/source/blender/editors/interface/interface_style.c b/source/blender/editors/interface/interface_style.c index 831a8a5bf6c..e8fba38f793 100644 --- a/source/blender/editors/interface/interface_style.c +++ b/source/blender/editors/interface/interface_style.c @@ -92,6 +92,7 @@ static uiStyle *ui_style_new(ListBase *styles, const char *name) style->paneltitle.uifont_id= UIFONT_DEFAULT; style->paneltitle.points= 13; style->paneltitle.kerning= 0.0; + style->paneltitle.overlap= 0; style->paneltitle.shadow= 5; style->paneltitle.shadx= 2; style->paneltitle.shady= -2; @@ -101,6 +102,7 @@ static uiStyle *ui_style_new(ListBase *styles, const char *name) style->grouplabel.uifont_id= UIFONT_DEFAULT; style->grouplabel.points= 12; style->grouplabel.kerning= 0.0; + style->grouplabel.overlap= 0; style->grouplabel.shadow= 3; style->grouplabel.shadx= 1; style->grouplabel.shady= -1; @@ -109,6 +111,7 @@ static uiStyle *ui_style_new(ListBase *styles, const char *name) style->widgetlabel.uifont_id= UIFONT_DEFAULT; style->widgetlabel.points= 11; style->widgetlabel.kerning= 0.0; + style->widgetlabel.overlap= 0; style->widgetlabel.shadow= 3; style->widgetlabel.shadx= 1; style->widgetlabel.shady= -1; @@ -145,22 +148,6 @@ static uiFont *uifont_to_blfont(int id) /* *************** draw ************************ */ -static void ui_font_shadow_draw(uiFontStyle *fs, int x, int y, char *str) -{ - float color[4]; - - glGetFloatv(GL_CURRENT_COLOR, color); - - glColor4f(fs->shadowcolor, fs->shadowcolor, fs->shadowcolor, fs->shadowalpha); - - BLF_blur(fs->shadow); - BLF_position(x+fs->shadx, y+fs->shady, 0.0f); - BLF_draw(str); - BLF_blur(0); - - glColor4fv(color); -} - void uiStyleFontDraw(uiFontStyle *fs, rcti *rect, char *str) { float height; @@ -179,14 +166,23 @@ void uiStyleFontDraw(uiFontStyle *fs, rcti *rect, char *str) /* clip is very strict, so we give it some space */ BLF_clipping(rect->xmin-1, rect->ymin-4, rect->xmax+1, rect->ymax+4); BLF_enable(BLF_CLIPPING); - - if(fs->shadow) - ui_font_shadow_draw(fs, rect->xmin+xofs, rect->ymin+yofs, str); - BLF_position(rect->xmin+xofs, rect->ymin+yofs, 0.0f); - BLF_draw(str); + if (fs->shadow) { + BLF_enable(BLF_SHADOW); + BLF_shadow(fs->shadow, fs->shadowcolor, fs->shadowcolor, fs->shadowcolor, fs->shadowalpha); + BLF_shadow_offset(fs->shadx, fs->shady); + } + + if (fs->overlap) + BLF_enable(BLF_OVERLAP_CHAR); + + BLF_draw(str); BLF_disable(BLF_CLIPPING); + if (fs->shadow) + BLF_disable(BLF_SHADOW); + if (fs->overlap) + BLF_disable(BLF_OVERLAP_CHAR); } /* ************** helpers ************************ */ diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c index a0ee264cf01..dd87ee15474 100644 --- a/source/blender/editors/interface/interface_templates.c +++ b/source/blender/editors/interface/interface_templates.c @@ -27,9 +27,12 @@ #include "MEM_guardedalloc.h" +#include "DNA_screen_types.h" + #include "BLI_string.h" #include "BKE_context.h" +#include "BKE_icons.h" #include "BKE_library.h" #include "BKE_utildefines.h" @@ -146,9 +149,24 @@ static void id_search_cb(const struct bContext *C, void *arg_litem, char *str, u ID *id; for(id= lb->first; id; id= id->next) { + int iconid= 0; + + /* icon */ + switch(GS(id->name)) + { + case ID_MA: /* fall through */ + case ID_TE: /* fall through */ + case ID_IM: /* fall through */ + case ID_WO: /* fall through */ + case ID_LA: /* fall through */ + iconid= BKE_icon_getid(id); + break; + default: + break; + } if(BLI_strcasestr(id->name+2, str)) { - if(0==uiSearchItemAdd(items, id->name+2, id)) + if(0==uiSearchItemAdd(items, id->name+2, id, iconid)) break; } } @@ -362,6 +380,15 @@ static void modifiers_del(bContext *C, void *ob_v, void *md_v) BKE_reports_clear(&reports); } +static void modifiers_activate(bContext *C, void *ob_v, void *md_v) +{ + Scene *scene= CTX_data_scene(C); + Object *ob= ob_v; + + WM_event_add_notifier(C, NC_OBJECT|ND_MODIFIER, ob); + DAG_object_flush_update(scene, ob, OB_RECALC_DATA); +} + static void modifiers_moveUp(bContext *C, void *ob_v, void *md_v) { Scene *scene= CTX_data_scene(C); @@ -555,7 +582,10 @@ static uiLayout *draw_modifier(uiLayout *layout, Object *ob, ModifierData *md, i uiBlockSetEmboss(block, UI_EMBOSSN); uiDefIconButBitI(block, ICONTOG, eModifierMode_Expanded, 0, ICON_TRIA_RIGHT, 0, 0, UI_UNIT_X, UI_UNIT_Y, &md->mode, 0.0, 0.0, 0.0, 0.0, "Collapse/Expand Modifier"); } - + + /* modifier-type icon */ + uiDefIconBut(block, BUT, 0, RNA_struct_ui_icon(ptr.type), 0, 0, UI_UNIT_X, UI_UNIT_Y, NULL, 0.0, 0.0, 0.0, 0.0, "Current Modifier Type"); + uiBlockSetEmboss(block, UI_EMBOSS); if (isVirtual) { @@ -566,14 +596,16 @@ static uiLayout *draw_modifier(uiLayout *layout, Object *ob, ModifierData *md, i uiButSetFunc(but, modifiers_convertToReal, ob, md); } else { uiBlockBeginAlign(block); - uiDefBut(block, TEX, 0, "", 0, 0, buttonWidth-60, UI_UNIT_Y, md->name, 0.0, sizeof(md->name)-1, 0.0, 0.0, "Modifier name"); + uiDefBut(block, TEX, 0, "", 0, 0, buttonWidth-40, UI_UNIT_Y, md->name, 0.0, sizeof(md->name)-1, 0.0, 0.0, "Modifier name"); /* Softbody not allowed in this situation, enforce! */ if (((md->type!=eModifierType_Softbody && md->type!=eModifierType_Collision) || !(ob->pd && ob->pd->deflect)) && (md->type!=eModifierType_Surface)) { uiDefIconButBitI(block, TOG, eModifierMode_Render, 0, ICON_SCENE, 0, 0, 19, UI_UNIT_Y,&md->mode, 0, 0, 1, 0, "Enable modifier during rendering"); but= uiDefIconButBitI(block, TOG, eModifierMode_Realtime, 0, ICON_VIEW3D, 0, 0, 19, UI_UNIT_Y,&md->mode, 0, 0, 1, 0, "Enable modifier during interactive display"); + uiButSetFunc(but, modifiers_activate, ob, md); if (mti->flags&eModifierTypeFlag_SupportsEditmode) { - uiDefIconButBitI(block, TOG, eModifierMode_Editmode, 0, ICON_EDITMODE_HLT, 0, 0, 19, UI_UNIT_Y,&md->mode, 0, 0, 1, 0, "Enable modifier during Editmode (only if enabled for display)"); + but= uiDefIconButBitI(block, TOG, eModifierMode_Editmode, 0, ICON_EDITMODE_HLT, 0, 0, 19, UI_UNIT_Y,&md->mode, 0, 0, 1, 0, "Enable modifier during Editmode (only if enabled for display)"); + uiButSetFunc(but, modifiers_activate, ob, md); } } uiBlockEndAlign(block); @@ -1490,3 +1522,149 @@ void uiTemplateLayers(uiLayout *layout, PointerRNA *ptr, char *propname) } } } + + +/************************* List Template **************************/ + +typedef struct ListItem { + PointerRNA ptr; + PropertyRNA *prop; + PropertyRNA *activeprop; + + PointerRNA activeptr; + int activei; + + int selected; +} ListItem; + +static void list_item_cb(bContext *C, void *arg_item, void *arg_unused) +{ + ListItem *item= (ListItem*)arg_item; + PropertyType activetype; + char *activename; + + if(item->selected) { + activetype= RNA_property_type(item->activeprop); + + if(activetype == PROP_POINTER) + RNA_property_pointer_set(&item->ptr, item->activeprop, item->activeptr); + else if(activetype == PROP_INT) + RNA_property_int_set(&item->ptr, item->activeprop, item->activei); + else if(activetype == PROP_STRING) { + activename= RNA_struct_name_get_alloc(&item->activeptr, NULL, 0); + RNA_property_string_set(&item->ptr, item->activeprop, activename); + MEM_freeN(activename); + } + } +} + +void uiTemplateList(uiLayout *layout, PointerRNA *ptr, char *propname, char *activepropname, int items) +{ + PropertyRNA *prop, *activeprop; + PropertyType type, activetype; + PointerRNA activeptr; + uiLayout *box, *row, *col; + uiBlock *block; + uiBut *but; + char *name, *activename= NULL; + int i= 1, activei= 0, len; + static int scroll = 1; + + /* validate arguments */ + if(!ptr->data) + return; + + prop= RNA_struct_find_property(ptr, propname); + if(!prop) { + printf("uiTemplateList: property not found: %s\n", propname); + return; + } + + activeprop= RNA_struct_find_property(ptr, activepropname); + if(!activeprop) { + printf("uiTemplateList: property not found: %s\n", activepropname); + return; + } + + type= RNA_property_type(prop); + if(type != PROP_COLLECTION) { + printf("uiTemplateList: expected collection property.\n"); + return; + } + + activetype= RNA_property_type(activeprop); + if(!ELEM3(activetype, PROP_POINTER, PROP_INT, PROP_STRING)) { + printf("uiTemplateList: expected pointer, integer or string property.\n"); + return; + } + + if(items == 0) + items= 5; + + /* get active data */ + if(activetype == PROP_POINTER) + activeptr= RNA_property_pointer_get(ptr, activeprop); + else if(activetype == PROP_INT) + activei= RNA_property_int_get(ptr, activeprop); + else if(activetype == PROP_STRING) + activename= RNA_property_string_get_alloc(ptr, activeprop, NULL, 0); + + box= uiLayoutBox(layout); + row= uiLayoutRow(box, 0); + col = uiLayoutColumn(row, 1); + + block= uiLayoutGetBlock(col); + uiBlockSetEmboss(block, UI_EMBOSSN); + + len= RNA_property_collection_length(ptr, prop); + scroll= MIN2(scroll, len-items+1); + scroll= MAX2(scroll, 1); + + RNA_PROP_BEGIN(ptr, itemptr, prop) { + if(i >= scroll && i<scroll+items) { + name= RNA_struct_name_get_alloc(&itemptr, NULL, 0); + + if(name) { + ListItem *item= MEM_callocN(sizeof(ListItem), "uiTemplateList ListItem"); + + item->ptr= *ptr; + item->prop= prop; + item->activeprop= activeprop; + item->activeptr= itemptr; + item->activei= i; + + if(activetype == PROP_POINTER) + item->selected= (activeptr.data == itemptr.data)? i: -1; + else if(activetype == PROP_INT) + item->selected= (activei == i)? i: -1; + else if(activetype == PROP_STRING) + item->selected= (strcmp(activename, name) == 0)? i: -1; + + but= uiDefIconTextButI(block, ROW, 0, RNA_struct_ui_icon(itemptr.type), name, 0,0,UI_UNIT_X*10,UI_UNIT_Y, &item->selected, 0, i, 0, 0, ""); + uiButSetFlag(but, UI_ICON_LEFT|UI_TEXT_LEFT); + uiButSetNFunc(but, list_item_cb, item, NULL); + + MEM_freeN(name); + } + } + + i++; + } + RNA_PROP_END; + + while(i < scroll+items) { + if(i >= scroll) + uiItemL(col, "", 0); + i++; + } + + uiBlockSetEmboss(block, UI_EMBOSS); + + if(len > items) { + col= uiLayoutColumn(row, 0); + uiDefButI(block, SCROLL, 0, "", 0,0,UI_UNIT_X*0.75,UI_UNIT_Y*items, &scroll, 1, len-items+1, items, 0, ""); + } + + //uiDefButI(block, SCROLL, 0, "", 0,0,UI_UNIT_X*15,UI_UNIT_Y*0.75, &scroll, 1, 16-5, 5, 0, ""); +} + diff --git a/source/blender/editors/interface/interface_utils.c b/source/blender/editors/interface/interface_utils.c index a75a3402774..e67e5b5a871 100644 --- a/source/blender/editors/interface/interface_utils.c +++ b/source/blender/editors/interface/interface_utils.c @@ -43,6 +43,7 @@ #include "BKE_colortools.h" #include "BKE_context.h" #include "BKE_idprop.h" +#include "BKE_icons.h" #include "BKE_library.h" #include "BKE_main.h" #include "BKE_texture.h" @@ -120,6 +121,8 @@ uiBut *uiDefAutoButR(uiBlock *block, PointerRNA *ptr, PropertyRNA *prop, int ind if(!pptr.type) pptr.type= RNA_property_pointer_type(ptr, prop); icon= RNA_struct_ui_icon(pptr.type); + if(icon == ICON_DOT) + icon= 0; but= uiDefIconTextButR(block, IDPOIN, 0, icon, name, x1, y1, x2, y2, ptr, propname, index, 0, 0, -1, -1, NULL); break; @@ -139,69 +142,39 @@ uiBut *uiDefAutoButR(uiBlock *block, PointerRNA *ptr, PropertyRNA *prop, int ind return but; } -void uiDefAutoButsRNA(const bContext *C, uiLayout *layout, PointerRNA *ptr) +void uiDefAutoButsRNA(const bContext *C, uiLayout *layout, PointerRNA *ptr, int columns) { - CollectionPropertyIterator iter; - PropertyRNA *iterprop, *prop; - uiLayout *split; + uiLayout *split, *col; char *name; uiItemL(layout, (char*)RNA_struct_ui_name(ptr->type), 0); - iterprop= RNA_struct_iterator_property(ptr->type); - RNA_property_collection_begin(ptr, iterprop, &iter); - - for(; iter.valid; RNA_property_collection_next(&iter)) { - prop= iter.ptr.data; - + RNA_STRUCT_BEGIN(ptr, prop) { if(strcmp(RNA_property_identifier(prop), "rna_type") == 0) continue; - split = uiLayoutSplit(layout, 0.5f); - name= (char*)RNA_property_ui_name(prop); - uiItemL(uiLayoutColumn(split, 0), name, 0); - uiItemFullR(uiLayoutColumn(split, 0), "", 0, ptr, prop, -1, 0, 0, 0, 0); - } + if(columns == 1) { + col= uiLayoutColumn(layout, 1); + uiItemL(col, name, 0); + } + else if(columns == 2) { + split = uiLayoutSplit(layout, 0.5f); - RNA_property_collection_end(&iter); -} + uiItemL(uiLayoutColumn(split, 0), name, 0); + col= uiLayoutColumn(split, 0); + } -/* temp call, single collumn, test for toolbar only */ -void uiDefAutoButsRNA_single(const bContext *C, uiLayout *layout, PointerRNA *ptr) -{ - CollectionPropertyIterator iter; - PropertyRNA *iterprop, *prop; - uiLayout *col; - char *name; - - uiItemL(layout, (char*)RNA_struct_ui_name(ptr->type), 0); - - iterprop= RNA_struct_iterator_property(ptr->type); - RNA_property_collection_begin(ptr, iterprop, &iter); - - for(; iter.valid; RNA_property_collection_next(&iter)) { - prop= iter.ptr.data; - - if(strcmp(RNA_property_identifier(prop), "rna_type") == 0) - continue; - - name= (char*)RNA_property_ui_name(prop); - col= uiLayoutColumn(layout, 1); - uiItemL(col, name, 0); - /* temp hack to show normal button for spin/screw */ if(strcmp(name, "Axis")==0) { - uiDefButR(uiLayoutGetBlock(layout), BUT_NORMAL, 0, name, 0, 0, 100, 100, ptr, "axis", -1, 0, 0, -1, -1, NULL); + uiDefButR(uiLayoutGetBlock(col), BUT_NORMAL, 0, name, 0, 0, 100, 100, ptr, "axis", -1, 0, 0, -1, -1, NULL); } else uiItemFullR(col, "", 0, ptr, prop, -1, 0, 0, 0, 0); } - - RNA_property_collection_end(&iter); + RNA_STRUCT_END; } - /***************************** ID Utilities *******************************/ /* note, C code version, will be replaced with version in interface_templates.c */ @@ -304,9 +277,25 @@ static void id_search_cb(const struct bContext *C, void *arg_params, char *str, ID *id; for(id= params->lb->first; id; id= id->next) { + int iconid= 0; + + + /* icon */ + switch(GS(id->name)) + { + case ID_MA: /* fall through */ + case ID_TE: /* fall through */ + case ID_IM: /* fall through */ + case ID_WO: /* fall through */ + case ID_LA: /* fall through */ + iconid= BKE_icon_getid(id); + break; + default: + break; + } if(BLI_strcasestr(id->name+2, str)) { - if(0==uiSearchItemAdd(items, id->name+2, id)) + if(0==uiSearchItemAdd(items, id->name+2, id, iconid)) break; } } diff --git a/source/blender/editors/interface/interface_widgets.c b/source/blender/editors/interface/interface_widgets.c index 14df9026078..735cfe742c6 100644 --- a/source/blender/editors/interface/interface_widgets.c +++ b/source/blender/editors/interface/interface_widgets.c @@ -102,6 +102,7 @@ typedef struct uiWidgetBase { float inner_uv[64][2]; short inner, outline, emboss; /* set on/off */ + short shadedir; uiWidgetTrias tria1; uiWidgetTrias tria2; @@ -199,6 +200,7 @@ static void widget_init(uiWidgetBase *wtb) wtb->inner= 1; wtb->outline= 1; wtb->emboss= 1; + wtb->shadedir= 1; } /* helper call, makes shadow rect, with 'sun' above menu, so only shadow to left/right/bottom */ @@ -583,7 +585,7 @@ static void widgetbase_draw(uiWidgetBase *wtb, uiWidgetColors *wcol) glShadeModel(GL_SMOOTH); glBegin(GL_POLYGON); for(a=0; a<wtb->totvert; a++) { - round_box_shade_col4(col1, col2, wtb->inner_uv[a][1]); + round_box_shade_col4(col1, col2, wtb->inner_uv[a][wtb->shadedir]); glVertex2fv(wtb->inner_v[a]); } glEnd(); @@ -1088,6 +1090,32 @@ static struct uiWidgetColors wcol_box= { 0, 0 }; +static struct uiWidgetColors wcol_toggle= { + {25, 25, 25, 255}, + {153, 153, 153, 255}, + {100, 100, 100, 255}, + {25, 25, 25, 255}, + + {0, 0, 0, 255}, + {255, 255, 255, 255}, + + 0, + 0, 0 +}; + +static struct uiWidgetColors wcol_scroll= { + {25, 25, 25, 255}, + {180, 180, 180, 255}, + {153, 153, 153, 255}, + {90, 90, 90, 255}, + + {0, 0, 0, 255}, + {255, 255, 255, 255}, + + 1, + 0, -20 +}; + /* free wcol struct to play with */ static struct uiWidgetColors wcol_tmp= { {0, 0, 0, 255}, @@ -1109,9 +1137,10 @@ void ui_widget_color_init(ThemeUI *tui) tui->wcol_regular= wcol_regular; tui->wcol_tool= wcol_tool; - tui->wcol_radio= wcol_radio; tui->wcol_text= wcol_text; + tui->wcol_radio= wcol_radio; tui->wcol_option= wcol_option; + tui->wcol_toggle= wcol_toggle; tui->wcol_num= wcol_num; tui->wcol_numslider= wcol_numslider; tui->wcol_menu= wcol_menu; @@ -1119,6 +1148,7 @@ void ui_widget_color_init(ThemeUI *tui) tui->wcol_menu_back= wcol_menu_back; tui->wcol_menu_item= wcol_menu_item; tui->wcol_box= wcol_box; + tui->wcol_scroll= wcol_scroll; } /* ************ button callbacks, state ***************** */ @@ -1602,6 +1632,75 @@ void ui_draw_link_bezier(rcti *rect) } } +static void widget_scroll(uiBut *but, uiWidgetColors *wcol, rcti *rect, int state, int roundboxalign) +{ + uiWidgetBase wtb; + rcti rect1; + double value; + char inner[3]; + float fac, size, rad; + int horizontal; + + /* determine horizontal/vertical */ + horizontal= (rect->xmax - rect->xmin > rect->ymax - rect->ymin); + + if(horizontal) + rad= 0.5f*(rect->ymax - rect->ymin); + else + rad= 0.5f*(rect->xmax - rect->xmin); + + widget_init(&wtb); + wtb.shadedir= (horizontal)? 1: 0; + + /* draw back part, colors swapped and shading inverted */ + VECCOPY(inner, wcol->inner); + VECCOPY(wcol->inner, wcol->item); + if(horizontal) + SWAP(short, wcol->shadetop, wcol->shadedown); + if(state & UI_SELECT) + SWAP(short, wcol->shadetop, wcol->shadedown); + + round_box_edges(&wtb, roundboxalign, rect, rad); /* XXX vertical gradient is wrong */ + widgetbase_draw(&wtb, wcol); + + VECCOPY(wcol->inner, inner); + if(horizontal) + SWAP(short, wcol->shadetop, wcol->shadedown); + if(state & UI_SELECT) + SWAP(short, wcol->shadetop, wcol->shadedown); + + /* front part */ + value= ui_get_but_val(but); + + size= (but->softmax + but->a1 - but->softmin); + size= MAX2(size, 2); + + /* position */ + rect1= *rect; + + if(horizontal) { + fac= (rect->xmax - rect->xmin)/(size-1); + rect1.xmin= rect1.xmin + ceil(fac*(value - but->softmin)); + rect1.xmax= rect1.xmin + ceil(fac*(but->a1 - but->softmin)); + } + else { + fac= (rect->ymax - rect->ymin)/(size-1); + rect1.ymax= rect1.ymax - ceil(fac*(value - but->softmin)); + rect1.ymin= rect1.ymax - ceil(fac*(but->a1 - but->softmin)); + } + + /* draw */ + wtb.emboss= 0; /* only emboss once */ + + if(!horizontal) + SWAP(short, wcol->shadetop, wcol->shadedown); + + round_box_edges(&wtb, roundboxalign, &rect1, rad); /* XXX vertical gradient is wrong */ + widgetbase_draw(&wtb, wcol); + + if(!horizontal) + SWAP(short, wcol->shadetop, wcol->shadedown); +} static void widget_link(uiBut *but, uiWidgetColors *wcol, rcti *rect, int state, int roundboxalign) { @@ -1896,12 +1995,16 @@ static uiWidgetType *widget_type(uiWidgetTypeEnum type) wt.text= widget_draw_text_icon; switch(type) { + case UI_WTYPE_REGULAR: + break; + case UI_WTYPE_LABEL: wt.draw= NULL; wt.state= widget_state_label; break; case UI_WTYPE_TOGGLE: + wt.wcol_theme= &btheme->tui.wcol_toggle; break; case UI_WTYPE_OPTION: @@ -1914,7 +2017,7 @@ static uiWidgetType *widget_type(uiWidgetTypeEnum type) wt.wcol_theme= &btheme->tui.wcol_radio; wt.draw= widget_radiobut; break; - + case UI_WTYPE_NUMBER: wt.wcol_theme= &btheme->tui.wcol_num; wt.draw= widget_numbut; @@ -1995,6 +2098,11 @@ static uiWidgetType *widget_type(uiWidgetTypeEnum type) case UI_WTYPE_NORMAL: break; + + case UI_WTYPE_SCROLL: + wt.wcol_theme= &btheme->tui.wcol_scroll; + wt.custom= widget_scroll; + break; } return &wt; @@ -2089,6 +2197,7 @@ void ui_draw_but(const bContext *C, ARegion *ar, uiStyle *style, uiBut *but, rct case BUT: wt= widget_type(UI_WTYPE_EXEC); break; + case NUM: wt= widget_type(UI_WTYPE_NUMBER); break; @@ -2184,9 +2293,13 @@ void ui_draw_but(const bContext *C, ARegion *ar, uiStyle *style, uiBut *but, rct case BUT_CURVE: ui_draw_but_CURVE(ar, but, &tui->wcol_regular, rect); break; - + + case SCROLL: + wt= widget_type(UI_WTYPE_SCROLL); + break; + default: - wt= widget_type(UI_WTYPE_TOGGLE); + wt= widget_type(UI_WTYPE_REGULAR); } } @@ -2195,6 +2308,7 @@ void ui_draw_but(const bContext *C, ARegion *ar, uiStyle *style, uiBut *but, rct int roundboxalign, state; roundboxalign= widget_roundbox_set(but, rect); + state= but->flag; if(but->editstr) state |= UI_TEXTINPUT; @@ -2242,7 +2356,7 @@ void ui_draw_search_back(uiStyle *style, uiBlock *block, rcti *rect) /* helper call to draw a menu item without button */ /* state: UI_ACTIVE or 0 */ -void ui_draw_menu_item(uiFontStyle *fstyle, rcti *rect, char *name, int state) +void ui_draw_menu_item(uiFontStyle *fstyle, rcti *rect, char *name, int iconid, int state) { uiWidgetType *wt= widget_type(UI_WTYPE_MENU_ITEM); rcti _rect= *rect; @@ -2256,6 +2370,7 @@ void ui_draw_menu_item(uiFontStyle *fstyle, rcti *rect, char *name, int state) /* text location offset */ rect->xmin+=5; + if(iconid) rect->xmin+= ICON_HEIGHT; /* cut string in 2 parts? */ cpoin= strchr(name, '|'); @@ -2278,5 +2393,12 @@ void ui_draw_menu_item(uiFontStyle *fstyle, rcti *rect, char *name, int state) /* restore rect, was messed with */ *rect= _rect; + if(iconid) { + int xs= rect->xmin+4; + int ys= 1 + (rect->ymin+rect->ymax- ICON_HEIGHT)/2; + glEnable(GL_BLEND); + UI_icon_draw_aspect_blended(xs, ys, iconid, 1.2f, 0); /* XXX scale weak get from fstyle? */ + glDisable(GL_BLEND); + } } diff --git a/source/blender/editors/interface/resources.c b/source/blender/editors/interface/resources.c index af68c5e6b25..4b2d5af956d 100644 --- a/source/blender/editors/interface/resources.c +++ b/source/blender/editors/interface/resources.c @@ -1,5 +1,5 @@ /** - * $Id: resources.c 12755 2007-12-02 05:50:38Z aligorith $ + * $Id$ * * ***** BEGIN GPL/BL DUAL LICENSE BLOCK ***** * diff --git a/source/blender/editors/mesh/Makefile b/source/blender/editors/mesh/Makefile index 650771519cd..8ae40e1b957 100644 --- a/source/blender/editors/mesh/Makefile +++ b/source/blender/editors/mesh/Makefile @@ -1,5 +1,5 @@ # -# $Id: Makefile 14 2002-10-13 15:57:19Z hans $ +# $Id$ # # ***** BEGIN GPL LICENSE BLOCK ***** # diff --git a/source/blender/editors/mesh/editmesh.c b/source/blender/editors/mesh/editmesh.c index dd003d103d5..7f5201f4704 100644 --- a/source/blender/editors/mesh/editmesh.c +++ b/source/blender/editors/mesh/editmesh.c @@ -841,7 +841,7 @@ void make_editMesh(Scene *scene, Object *ob) em= me->edit_mesh; - em->selectmode= scene->selectmode; // warning needs to be synced + em->selectmode= scene->toolsettings->selectmode; // warning needs to be synced em->act_face = NULL; em->totvert= tot= me->totvert; em->totedge= me->totedge; @@ -1556,7 +1556,7 @@ static int mesh_separate_material(Scene *scene, Base *editbase) /* clear selection, we're going to use that to select material group */ EM_clear_flag_all(em, SELECT); /* select the material */ - editmesh_select_by_material(em, curr_mat); + EM_select_by_material(em, curr_mat); /* and now separate */ if(0==mesh_separate_selected(scene, editbase)) { BKE_mesh_end_editmesh(me, em); diff --git a/source/blender/editors/mesh/editmesh_mods.c b/source/blender/editors/mesh/editmesh_mods.c index a1f8b3251c8..7e9fcb10984 100644 --- a/source/blender/editors/mesh/editmesh_mods.c +++ b/source/blender/editors/mesh/editmesh_mods.c @@ -3484,7 +3484,7 @@ void MESH_OT_select_random(wmOperatorType *ot) RNA_def_float_percentage(ot->srna, "percent", 0.5f, 0.0f, 1.0f, "Percent", "Percentage of vertices to select randomly.", 0.0001f, 1.0f); } -void editmesh_select_by_material(EditMesh *em, int index) +void EM_select_by_material(EditMesh *em, int index) { EditFace *efa; @@ -3497,7 +3497,7 @@ void editmesh_select_by_material(EditMesh *em, int index) EM_selectmode_flush(em); } -void editmesh_deselect_by_material(EditMesh *em, int index) +void EM_deselect_by_material(EditMesh *em, int index) { EditFace *efa; @@ -3531,7 +3531,7 @@ static void mesh_selection_type(Scene *scene, EditMesh *em, int val) /* note, em stores selectmode to be able to pass it on everywhere without scene, this is only until all select modes and toolsettings are settled more */ - scene->selectmode= em->selectmode; + scene->toolsettings->selectmode= em->selectmode; // if (EM_texFaceCheck()) } } diff --git a/source/blender/editors/object/Makefile b/source/blender/editors/object/Makefile index c0312023bfd..70ada46c80f 100644 --- a/source/blender/editors/object/Makefile +++ b/source/blender/editors/object/Makefile @@ -1,5 +1,5 @@ # -# $Id: Makefile 14 2002-10-13 15:57:19Z hans $ +# $Id$ # # ***** BEGIN GPL LICENSE BLOCK ***** # diff --git a/source/blender/editors/object/object_edit.c b/source/blender/editors/object/object_edit.c index 74a1fc12631..7a75e3875ea 100644 --- a/source/blender/editors/object/object_edit.c +++ b/source/blender/editors/object/object_edit.c @@ -3661,7 +3661,7 @@ void special_editmenu(Scene *scene, View3D *v3d) if(!psys) return; - if(scene->selectmode & SCE_SELECT_POINT) + if(pset->selectmode & SCE_SELECT_POINT) nr= pupmenu("Specials%t|Rekey%x1|Subdivide%x2|Select First%x3|Select Last%x4|Remove Doubles%x5"); else nr= pupmenu("Specials%t|Rekey%x1|Remove Doubles%x5"); diff --git a/source/blender/editors/physics/Makefile b/source/blender/editors/physics/Makefile index a71ea9e2083..63968fdd537 100644 --- a/source/blender/editors/physics/Makefile +++ b/source/blender/editors/physics/Makefile @@ -1,5 +1,5 @@ # -# $Id: Makefile 14 2002-10-13 15:57:19Z hans $ +# $Id$ # # ***** BEGIN GPL LICENSE BLOCK ***** # diff --git a/source/blender/editors/physics/ed_pointcache.c b/source/blender/editors/physics/ed_pointcache.c index e47f44c5c1a..3374e05883c 100644 --- a/source/blender/editors/physics/ed_pointcache.c +++ b/source/blender/editors/physics/ed_pointcache.c @@ -83,7 +83,7 @@ static int ptcache_bake_all_exec(bContext *C, wmOperator *op) baker.render = 0; baker.break_test = cache_break_test; baker.break_data = NULL; - baker.progressbar = WM_timecursor; + baker.progressbar = (void (*)(void *, int))WM_timecursor; baker.progresscontext = CTX_wm_window(C); BKE_ptcache_make_cache(&baker); @@ -170,7 +170,7 @@ static int ptcache_bake_particle_system_exec(bContext *C, wmOperator *op) baker.render = 0; baker.break_test = cache_break_test; baker.break_data = NULL; - baker.progressbar = WM_timecursor; + baker.progressbar = (void (*)(void *, int))WM_timecursor; baker.progresscontext = CTX_wm_window(C); BKE_ptcache_make_cache(&baker); diff --git a/source/blender/editors/physics/editparticle.c b/source/blender/editors/physics/editparticle.c index a9fc65bdc37..1b6b5b43522 100644 --- a/source/blender/editors/physics/editparticle.c +++ b/source/blender/editors/physics/editparticle.c @@ -225,7 +225,7 @@ void PE_hide_keys_time(Scene *scene, ParticleSystem *psys, float cfra) ParticleEditSettings *pset=PE_settings(scene); int i, k, totpart= psys->totpart; - if(pset->draw_timed && scene->selectmode==SCE_SELECT_POINT) { + if(pset->draw_timed && pset->selectmode==SCE_SELECT_POINT) { LOOP_PARTICLES(i, pa) { LOOP_KEYS(k, key) { if(fabs(cfra-*key->time) < pset->draw_timed) @@ -425,11 +425,12 @@ static void for_mouse_hit_keys(PEData *data, ForKeyFunc func, int nearest) ParticleEdit *edit= psys->edit; ParticleData *pa; ParticleEditKey *key; + ParticleEditSettings *pset= PE_settings(data->scene); int i, k, totpart, nearest_pa, nearest_key; float dist= data->rad; /* in path select mode we have no keys */ - if(data->scene->selectmode==SCE_SELECT_PATH) + if(pset->selectmode==SCE_SELECT_PATH) return; totpart= psys->totpart; @@ -439,7 +440,7 @@ static void for_mouse_hit_keys(PEData *data, ForKeyFunc func, int nearest) LOOP_PARTICLES(i, pa) { if(pa->flag & PARS_HIDE) continue; - if(data->scene->selectmode == SCE_SELECT_END) { + if(pset->selectmode == SCE_SELECT_END) { /* only do end keys */ key= edit->keys[i] + pa->totkey-1; @@ -481,18 +482,19 @@ static void foreach_mouse_hit_particle(PEData *data, ForParticleFunc func, int s ParticleSystem *psys= data->psys; ParticleData *pa; ParticleEditKey *key; + ParticleEditSettings *pset= PE_settings(data->scene); int i, k, totpart; totpart= psys->totpart; /* all is selected in path mode */ - if(data->scene->selectmode==SCE_SELECT_PATH) + if(pset->selectmode==SCE_SELECT_PATH) selected=0; LOOP_PARTICLES(i, pa) { if(pa->flag & PARS_HIDE) continue; - if(data->scene->selectmode==SCE_SELECT_END) { + if(pset->selectmode==SCE_SELECT_END) { /* only do end keys */ key= psys->edit->keys[i] + pa->totkey-1; @@ -522,6 +524,7 @@ static void foreach_mouse_hit_key(PEData *data, ForKeyMatFunc func, int selected ParticleData *pa; ParticleEditKey *key; ParticleSystemModifierData *psmd=0; + ParticleEditSettings *pset= PE_settings(data->scene); int i, k, totpart; float mat[4][4], imat[4][4]; @@ -529,7 +532,7 @@ static void foreach_mouse_hit_key(PEData *data, ForKeyMatFunc func, int selected totpart= psys->totpart; /* all is selected in path mode */ - if(data->scene->selectmode==SCE_SELECT_PATH) + if(pset->selectmode==SCE_SELECT_PATH) selected= 0; Mat4One(imat); @@ -541,7 +544,7 @@ static void foreach_mouse_hit_key(PEData *data, ForKeyMatFunc func, int selected psys_mat_hair_to_global(data->ob, psmd->dm, psys->part->from, pa, mat); Mat4Invert(imat,mat); - if(data->scene->selectmode==SCE_SELECT_END) { + if(pset->selectmode==SCE_SELECT_END) { /* only do end keys */ key= psys->edit->keys[i] + pa->totkey-1; @@ -610,6 +613,7 @@ static int count_selected_keys(Scene *scene, ParticleSystem *psys) { ParticleData *pa; ParticleEditKey *key; + ParticleEditSettings *pset= PE_settings(scene); int i, k, totpart, sel= 0; totpart= psys->totpart; @@ -619,12 +623,12 @@ static int count_selected_keys(Scene *scene, ParticleSystem *psys) key= psys->edit->keys[i]; - if(scene->selectmode==SCE_SELECT_POINT) { + if(pset->selectmode==SCE_SELECT_POINT) { for(k=0; k<pa->totkey; k++,key++) if(key->flag & PEK_SELECT) sel++; } - else if(scene->selectmode==SCE_SELECT_END) { + else if(pset->selectmode==SCE_SELECT_END) { key += pa->totkey-1; if(key->flag & PEK_SELECT) @@ -1454,6 +1458,7 @@ int PE_lasso_select(bContext *C, short mcords[][2], short moves, short select) ParticleEdit *edit; ParticleData *pa; ParticleEditKey *key; + ParticleEditSettings *pset= PE_settings(scene); float co[3], mat[4][4]; short vertco[2]; int i, k, totpart; @@ -1470,7 +1475,7 @@ int PE_lasso_select(bContext *C, short mcords[][2], short moves, short select) psys_mat_hair_to_global(ob, psmd->dm, psys->part->from, pa, mat); - if(scene->selectmode==SCE_SELECT_POINT) { + if(pset->selectmode==SCE_SELECT_POINT) { LOOP_KEYS(k, key) { VECCOPY(co, key->co); Mat4MulVecfl(mat, co); @@ -1487,7 +1492,7 @@ int PE_lasso_select(bContext *C, short mcords[][2], short moves, short select) } } } - else if(scene->selectmode==SCE_SELECT_END) { + else if(pset->selectmode==SCE_SELECT_END) { key= edit->keys[i] + pa->totkey - 1; VECCOPY(co, key->co); @@ -2349,7 +2354,7 @@ enum { DEL_PARTICLE, DEL_KEY }; static EnumPropertyItem delete_type_items[]= { {DEL_PARTICLE, "PARTICLE", 0, "Particle", ""}, {DEL_KEY, "KEY", 0, "Key", ""}, - {0, NULL, NULL}}; + {0, NULL, 0, NULL, NULL}}; static void set_delete_particle(PEData *data, int pa_index) { @@ -3842,6 +3847,7 @@ void PE_change_act_psys(Scene *scene, Object *ob, ParticleSystem *psys) static int specials_menu_invoke(bContext *C, wmOperator *op, wmEvent *event) { Scene *scene= CTX_data_scene(C); + ParticleEditSettings *pset=PE_settings(scene); uiPopupMenu *pup; uiLayout *layout; @@ -3849,7 +3855,7 @@ static int specials_menu_invoke(bContext *C, wmOperator *op, wmEvent *event) layout= uiPupMenuLayout(pup); uiItemO(layout, NULL, 0, "PARTICLE_OT_rekey"); - if(scene->selectmode & SCE_SELECT_POINT) { + if(pset->selectmode & SCE_SELECT_POINT) { uiItemO(layout, NULL, 0, "PARTICLE_OT_subdivide"); uiItemO(layout, NULL, 0, "PARTICLE_OT_select_first"); uiItemO(layout, NULL, 0, "PARTICLE_OT_select_last"); diff --git a/source/blender/editors/preview/Makefile b/source/blender/editors/preview/Makefile index c44da6753f3..48e1dc64673 100644 --- a/source/blender/editors/preview/Makefile +++ b/source/blender/editors/preview/Makefile @@ -1,5 +1,5 @@ # -# $Id: Makefile 14 2002-10-13 15:57:19Z hans $ +# $Id$ # # ***** BEGIN GPL LICENSE BLOCK ***** # diff --git a/source/blender/editors/screen/Makefile b/source/blender/editors/screen/Makefile index cf6e692c304..923a020afcf 100644 --- a/source/blender/editors/screen/Makefile +++ b/source/blender/editors/screen/Makefile @@ -1,5 +1,5 @@ # -# $Id: Makefile 14 2002-10-13 15:57:19Z hans $ +# $Id$ # # ***** BEGIN GPL LICENSE BLOCK ***** # diff --git a/source/blender/editors/screen/glutil.c b/source/blender/editors/screen/glutil.c index a81a52fd544..a23487effa1 100644 --- a/source/blender/editors/screen/glutil.c +++ b/source/blender/editors/screen/glutil.c @@ -1,5 +1,5 @@ /** - * $Id: glutil.c 11920 2007-09-02 17:25:03Z elubie $ + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * diff --git a/source/blender/editors/sculpt_paint/Makefile b/source/blender/editors/sculpt_paint/Makefile index 9353116a4bc..012a39b8d25 100644 --- a/source/blender/editors/sculpt_paint/Makefile +++ b/source/blender/editors/sculpt_paint/Makefile @@ -1,5 +1,5 @@ # -# $Id: Makefile 14 2002-10-13 15:57:19Z hans $ +# $Id$ # # ***** BEGIN GPL LICENSE BLOCK ***** # diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c index ac86e2ed962..f40880b901f 100644 --- a/source/blender/editors/sculpt_paint/sculpt.c +++ b/source/blender/editors/sculpt_paint/sculpt.c @@ -1,5 +1,5 @@ /* - * $Id: sculptmode.c 18309 2009-01-04 07:47:11Z nicholasbishop $ + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * diff --git a/source/blender/editors/sculpt_paint/sculpt_intern.h b/source/blender/editors/sculpt_paint/sculpt_intern.h index 112da5b4f0f..febca301939 100644 --- a/source/blender/editors/sculpt_paint/sculpt_intern.h +++ b/source/blender/editors/sculpt_paint/sculpt_intern.h @@ -1,5 +1,5 @@ /* - * $Id: BDR_sculptmode.h 13396 2008-01-25 04:17:38Z nicholasbishop $ + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * diff --git a/source/blender/editors/space_action/Makefile b/source/blender/editors/space_action/Makefile index 840f31b8a40..e856587acca 100644 --- a/source/blender/editors/space_action/Makefile +++ b/source/blender/editors/space_action/Makefile @@ -1,5 +1,5 @@ # -# $Id: Makefile 14 2002-10-13 15:57:19Z hans $ +# $Id$ # # ***** BEGIN GPL LICENSE BLOCK ***** # diff --git a/source/blender/editors/space_action/action_draw.c b/source/blender/editors/space_action/action_draw.c index 61048598644..f3a0dda4ce7 100644 --- a/source/blender/editors/space_action/action_draw.c +++ b/source/blender/editors/space_action/action_draw.c @@ -1,5 +1,5 @@ /** - * $Id: drawaction.c 17746 2008-12-08 11:19:44Z aligorith $ + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * diff --git a/source/blender/editors/space_action/action_edit.c b/source/blender/editors/space_action/action_edit.c index 70dbc42fe6e..61dbc41e7c8 100644 --- a/source/blender/editors/space_action/action_edit.c +++ b/source/blender/editors/space_action/action_edit.c @@ -1,5 +1,5 @@ /** - * $Id: editaction.c 17746 2008-12-08 11:19:44Z aligorith $ + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * diff --git a/source/blender/editors/space_action/action_select.c b/source/blender/editors/space_action/action_select.c index 3583d16fd8c..451d120ff9b 100644 --- a/source/blender/editors/space_action/action_select.c +++ b/source/blender/editors/space_action/action_select.c @@ -1,5 +1,5 @@ /** - * $Id: editaction.c 17746 2008-12-08 11:19:44Z aligorith $ + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * diff --git a/source/blender/editors/space_api/Makefile b/source/blender/editors/space_api/Makefile index 46f926afbc9..474fbe89053 100644 --- a/source/blender/editors/space_api/Makefile +++ b/source/blender/editors/space_api/Makefile @@ -1,5 +1,5 @@ # -# $Id: Makefile 14 2002-10-13 15:57:19Z hans $ +# $Id$ # # ***** BEGIN GPL LICENSE BLOCK ***** # diff --git a/source/blender/editors/space_buttons/Makefile b/source/blender/editors/space_buttons/Makefile index b96d1cc5495..a4894ede06b 100644 --- a/source/blender/editors/space_buttons/Makefile +++ b/source/blender/editors/space_buttons/Makefile @@ -1,5 +1,5 @@ # -# $Id: Makefile 14 2002-10-13 15:57:19Z hans $ +# $Id$ # # ***** BEGIN GPL LICENSE BLOCK ***** # diff --git a/source/blender/editors/space_buttons/buttons_context.c b/source/blender/editors/space_buttons/buttons_context.c index d97b4acdb96..01794d1bba8 100644 --- a/source/blender/editors/space_buttons/buttons_context.c +++ b/source/blender/editors/space_buttons/buttons_context.c @@ -552,7 +552,7 @@ int buttons_context(const bContext *C, const char *member, bContextDataResult *r if(ptr) { Object *ob= ptr->data; - if(ob && ob->type && (ob->type<OB_LAMP)) + if(ob && ob->type && (ob->type<OB_LAMP) && ob->totcol) CTX_data_pointer_set(result, &ob->id, &RNA_MaterialSlot, ob->mat+ob->actcol-1); } @@ -668,7 +668,6 @@ void buttons_context_draw(const bContext *C, uiLayout *layout) uiBlock *block; uiBut *but; PointerRNA *ptr; - PropertyRNA *nameprop; char namebuf[128], *name; int a, icon; @@ -688,7 +687,7 @@ void buttons_context_draw(const bContext *C, uiLayout *layout) if(ptr->data) { icon= RNA_struct_ui_icon(ptr->type); - nameprop= RNA_struct_name_property(ptr->type); + name= RNA_struct_name_get_alloc(ptr, namebuf, sizeof(namebuf)); #if 0 if(sbuts->mainb != BCONTEXT_SCENE && ptr->type == &RNA_Scene) { @@ -696,9 +695,7 @@ void buttons_context_draw(const bContext *C, uiLayout *layout) } else #endif - if(nameprop) { - name= RNA_property_string_get_alloc(ptr, nameprop, namebuf, sizeof(namebuf)); - + if(name) { uiItemL(row, name, icon); if(name != namebuf) diff --git a/source/blender/editors/space_buttons/buttons_intern.h b/source/blender/editors/space_buttons/buttons_intern.h index 196647a3750..b213e4288be 100644 --- a/source/blender/editors/space_buttons/buttons_intern.h +++ b/source/blender/editors/space_buttons/buttons_intern.h @@ -61,6 +61,12 @@ void buttons_context_draw(const struct bContext *C, struct uiLayout *layout); void buttons_context_register(struct ARegionType *art); /* buttons_ops.c */ +void OBJECT_OT_material_slot_add(struct wmOperatorType *ot); +void OBJECT_OT_material_slot_remove(struct wmOperatorType *ot); +void OBJECT_OT_material_slot_assign(struct wmOperatorType *ot); +void OBJECT_OT_material_slot_select(struct wmOperatorType *ot); +void OBJECT_OT_material_slot_deselect(struct wmOperatorType *ot); + void MATERIAL_OT_new(struct wmOperatorType *ot); void TEXTURE_OT_new(struct wmOperatorType *ot); void WORLD_OT_new(struct wmOperatorType *ot); diff --git a/source/blender/editors/space_buttons/buttons_ops.c b/source/blender/editors/space_buttons/buttons_ops.c index 63469a8294d..6755a2be1b7 100644 --- a/source/blender/editors/space_buttons/buttons_ops.c +++ b/source/blender/editors/space_buttons/buttons_ops.c @@ -30,6 +30,7 @@ #include "MEM_guardedalloc.h" +#include "DNA_curve_types.h" #include "DNA_object_types.h" #include "DNA_material_types.h" #include "DNA_texture_types.h" @@ -37,31 +38,250 @@ #include "DNA_world_types.h" #include "BKE_context.h" +#include "BKE_depsgraph.h" +#include "BKE_font.h" #include "BKE_library.h" #include "BKE_material.h" #include "BKE_texture.h" +#include "BKE_utildefines.h" #include "BKE_world.h" +#include "BLI_editVert.h" + #include "RNA_access.h" #include "WM_api.h" #include "WM_types.h" +#include "ED_curve.h" +#include "ED_mesh.h" + #include "buttons_intern.h" // own include +/********************** material slot operators *********************/ + +static int material_slot_add_exec(bContext *C, wmOperator *op) +{ + Object *ob= CTX_data_pointer_get_type(C, "object", &RNA_Object).data; + + if(!ob) + return OPERATOR_CANCELLED; + + object_add_material_slot(ob); + WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, ob); + + return OPERATOR_FINISHED; +} + +void OBJECT_OT_material_slot_add(wmOperatorType *ot) +{ + /* identifiers */ + ot->name= "Add Material Slot"; + ot->idname= "OBJECT_OT_material_slot_add"; + + /* api callbacks */ + ot->exec= material_slot_add_exec; + + /* flags */ + ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; +} + +static int material_slot_remove_exec(bContext *C, wmOperator *op) +{ + Object *ob= CTX_data_pointer_get_type(C, "object", &RNA_Object).data; + + if(!ob) + return OPERATOR_CANCELLED; + + object_remove_material_slot(ob); + WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, ob); + + return OPERATOR_FINISHED; +} + +void OBJECT_OT_material_slot_remove(wmOperatorType *ot) +{ + /* identifiers */ + ot->name= "Remove Material Slot"; + ot->idname= "OBJECT_OT_material_slot_remove"; + + /* api callbacks */ + ot->exec= material_slot_remove_exec; + + /* flags */ + ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; +} + +static int material_slot_assign_exec(bContext *C, wmOperator *op) +{ + Scene *scene= CTX_data_scene(C); + Object *ob= CTX_data_pointer_get_type(C, "object", &RNA_Object).data; + + if(!ob) + return OPERATOR_CANCELLED; + + if(ob && ob->actcol>0) { + if(ob->type == OB_MESH) { + EditMesh *em= ((Mesh*)ob->data)->edit_mesh; + EditFace *efa; + + if(em) { + for(efa= em->faces.first; efa; efa=efa->next) + if(efa->f & SELECT) + efa->mat_nr= ob->actcol-1; + } + } + else if(ELEM(ob->type, OB_CURVE, OB_SURF)) { + ListBase *editnurb= ((Curve*)ob->data)->editnurb; + Nurb *nu; + + if(editnurb) { + for(nu= editnurb->first; nu; nu= nu->next) + if(isNurbsel(nu)) + nu->mat_nr= nu->charidx= ob->actcol-1; + } + } + else if(ob->type == OB_FONT) { + EditFont *ef= ((Curve*)ob->data)->editfont; + int i, selstart, selend; + + if(ef && BKE_font_getselection(ob, &selstart, &selend)) { + for(i=selstart; i<=selend; i++) + ef->textbufinfo[i].mat_nr = ob->actcol-1; + } + } + } + + DAG_object_flush_update(scene, ob, OB_RECALC_DATA); + WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_DATA, ob); + + return OPERATOR_FINISHED; +} + +void OBJECT_OT_material_slot_assign(wmOperatorType *ot) +{ + /* identifiers */ + ot->name= "Assign Material Slot"; + ot->idname= "OBJECT_OT_material_slot_assign"; + + /* api callbacks */ + ot->exec= material_slot_assign_exec; + + /* flags */ + ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; +} + +static int material_slot_de_select(bContext *C, int select) +{ + Object *ob= CTX_data_pointer_get_type(C, "object", &RNA_Object).data; + + if(!ob) + return OPERATOR_CANCELLED; + + if(ob->type == OB_MESH) { + EditMesh *em= ((Mesh*)ob->data)->edit_mesh; + + if(em) { + if(select) + EM_select_by_material(em, ob->actcol-1); + else + EM_deselect_by_material(em, ob->actcol-1); + } + } + else if ELEM(ob->type, OB_CURVE, OB_SURF) { + ListBase *editnurb= ((Curve*)ob->data)->editnurb; + Nurb *nu; + BPoint *bp; + BezTriple *bezt; + int a; + + for(nu= editnurb->first; nu; nu=nu->next) { + if(nu->mat_nr==ob->actcol-1) { + if(nu->bezt) { + a= nu->pntsu; + bezt= nu->bezt; + while(a--) { + if(bezt->hide==0) { + if(select) { + bezt->f1 |= SELECT; + bezt->f2 |= SELECT; + bezt->f3 |= SELECT; + } + else { + bezt->f1 &= ~SELECT; + bezt->f2 &= ~SELECT; + bezt->f3 &= ~SELECT; + } + } + bezt++; + } + } + else if(nu->bp) { + a= nu->pntsu*nu->pntsv; + bp= nu->bp; + while(a--) { + if(bp->hide==0) { + if(select) bp->f1 |= SELECT; + else bp->f1 &= ~SELECT; + } + bp++; + } + } + } + } + } + + WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, ob); + + return OPERATOR_FINISHED; +} + +static int material_slot_select_exec(bContext *C, wmOperator *op) +{ + return material_slot_de_select(C, 1); +} + +void OBJECT_OT_material_slot_select(wmOperatorType *ot) +{ + /* identifiers */ + ot->name= "Select Material Slot"; + ot->idname= "OBJECT_OT_material_slot_select"; + + /* api callbacks */ + ot->exec= material_slot_select_exec; + + /* flags */ + ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; +} + +static int material_slot_deselect_exec(bContext *C, wmOperator *op) +{ + return material_slot_de_select(C, 0); +} + +void OBJECT_OT_material_slot_deselect(wmOperatorType *ot) +{ + /* identifiers */ + ot->name= "Deselect Material Slot"; + ot->idname= "OBJECT_OT_material_slot_deselect"; + + /* api callbacks */ + ot->exec= material_slot_deselect_exec; + + /* flags */ + ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; +} + /********************** new material operator *********************/ static int new_material_exec(bContext *C, wmOperator *op) { - PointerRNA ptr; - Material *ma; + Material *ma= CTX_data_pointer_get_type(C, "material", &RNA_Material).data; Object *ob; + PointerRNA ptr; int index; /* add or copy material */ - ptr= CTX_data_pointer_get(C, "material"); - ma= (RNA_struct_is_a(ptr.type, &RNA_Material))? ptr.data: NULL; - if(ma) ma= copy_material(ma); else @@ -70,9 +290,9 @@ static int new_material_exec(bContext *C, wmOperator *op) ma->id.us--; /* compensating for us++ in assign_material */ /* attempt to assign to material slot */ - ptr= CTX_data_pointer_get(C, "material_slot"); + ptr= CTX_data_pointer_get_type(C, "material_slot", &RNA_MaterialSlot); - if(RNA_struct_is_a(ptr.type, &RNA_MaterialSlot)) { + if(ptr.data) { ob= ptr.id.data; index= (Material**)ptr.data - ob->mat; @@ -80,6 +300,8 @@ static int new_material_exec(bContext *C, wmOperator *op) WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, ob); } + + WM_event_add_notifier(C, NC_MATERIAL|NA_ADDED, ma); return OPERATOR_FINISHED; } @@ -101,15 +323,12 @@ void MATERIAL_OT_new(wmOperatorType *ot) static int new_texture_exec(bContext *C, wmOperator *op) { - PointerRNA ptr; + Tex *tex= CTX_data_pointer_get_type(C, "texture", &RNA_Texture).data; ID *id; - Tex *tex; MTex *mtex; + PointerRNA ptr; /* add or copy texture */ - ptr= CTX_data_pointer_get(C, "texture"); - tex= (RNA_struct_is_a(ptr.type, &RNA_Texture))? ptr.data: NULL; - if(tex) tex= copy_texture(tex); else @@ -118,9 +337,9 @@ static int new_texture_exec(bContext *C, wmOperator *op) id_us_min(&tex->id); /* attempt to assign to texture slot */ - ptr= CTX_data_pointer_get(C, "texture_slot"); + ptr= CTX_data_pointer_get_type(C, "texture_slot", &RNA_TextureSlot); - if(RNA_struct_is_a(ptr.type, &RNA_TextureSlot)) { + if(ptr.data) { id= ptr.id.data; mtex= ptr.data; @@ -133,6 +352,8 @@ static int new_texture_exec(bContext *C, wmOperator *op) /* XXX nodes, notifier .. */ } + + WM_event_add_notifier(C, NC_TEXTURE|NA_ADDED, tex); return OPERATOR_FINISHED; } @@ -154,27 +375,21 @@ void TEXTURE_OT_new(wmOperatorType *ot) static int new_world_exec(bContext *C, wmOperator *op) { - PointerRNA ptr; - Scene *scene; - World *wo; + Scene *scene= CTX_data_scene(C); + World *wo= CTX_data_pointer_get_type(C, "world", &RNA_World).data; /* add or copy world */ - ptr= CTX_data_pointer_get(C, "world"); - wo= (RNA_struct_is_a(ptr.type, &RNA_World))? ptr.data: NULL; - if(wo) wo= copy_world(wo); else wo= add_world("World"); /* assign to scene */ - scene= CTX_data_scene(C); - if(scene->world) id_us_min(&scene->world->id); scene->world= wo; - // XXX notifier + WM_event_add_notifier(C, NC_WORLD|NA_ADDED, wo); return OPERATOR_FINISHED; } diff --git a/source/blender/editors/space_buttons/space_buttons.c b/source/blender/editors/space_buttons/space_buttons.c index e5d2215be29..483a1dc6100 100644 --- a/source/blender/editors/space_buttons/space_buttons.c +++ b/source/blender/editors/space_buttons/space_buttons.c @@ -210,6 +210,12 @@ static void buttons_main_area_draw(const bContext *C, ARegion *ar) void buttons_operatortypes(void) { + WM_operatortype_append(OBJECT_OT_material_slot_add); + WM_operatortype_append(OBJECT_OT_material_slot_remove); + WM_operatortype_append(OBJECT_OT_material_slot_assign); + WM_operatortype_append(OBJECT_OT_material_slot_select); + WM_operatortype_append(OBJECT_OT_material_slot_deselect); + WM_operatortype_append(MATERIAL_OT_new); WM_operatortype_append(TEXTURE_OT_new); WM_operatortype_append(WORLD_OT_new); @@ -337,6 +343,11 @@ static void buttons_area_listener(ScrArea *sa, wmNotifier *wmn) case ND_GEOM_SELECT: ED_area_tag_redraw(sa); break; + case ND_SHADING: + case ND_SHADING_DRAW: + /* currently works by redraws... if preview is set, it (re)starts job */ + sbuts->preview= 1; + break; } break; case NC_MATERIAL: @@ -347,7 +358,6 @@ static void buttons_area_listener(ScrArea *sa, wmNotifier *wmn) case ND_SHADING_DRAW: /* currently works by redraws... if preview is set, it (re)starts job */ sbuts->preview= 1; - printf("shader notifier \n"); break; } break; diff --git a/source/blender/editors/space_file/Makefile b/source/blender/editors/space_file/Makefile index 8f48217473c..2f4180448e5 100644 --- a/source/blender/editors/space_file/Makefile +++ b/source/blender/editors/space_file/Makefile @@ -1,5 +1,5 @@ # -# $Id: Makefile 14 2002-10-13 15:57:19Z hans $ +# $Id$ # # ***** BEGIN GPL LICENSE BLOCK ***** # diff --git a/source/blender/editors/space_file/file_draw.c b/source/blender/editors/space_file/file_draw.c index 6ed8f87d987..bb47d3458fe 100644 --- a/source/blender/editors/space_file/file_draw.c +++ b/source/blender/editors/space_file/file_draw.c @@ -550,7 +550,24 @@ void file_draw_list(const bContext *C, ARegion *ar) } } -static void file_draw_fsmenu_category(const bContext *C, ARegion *ar, FSMenuCategory category, const char* category_name, short *starty) +static void file_draw_fsmenu_category_name(ARegion *ar, const char *category_name, short *starty) +{ + short sx, sy; + int bmwidth = ar->v2d.cur.xmax - ar->v2d.cur.xmin - 2*TILE_BORDER_X - ICON_DEFAULT_WIDTH - 4; + int fontsize = file_font_pointsize(); + + sx = ar->v2d.cur.xmin + TILE_BORDER_X; + sy = *starty; + + UI_ThemeColor(TH_TEXT_HI); + file_draw_string(sx, sy, category_name, bmwidth, fontsize, FILE_SHORTEN_END); + + sy -= fontsize*2.0f; + + *starty= sy; +} + +static void file_draw_fsmenu_category(const bContext *C, ARegion *ar, FSMenuCategory category, short *starty) { struct FSMenu* fsmenu = fsmenu_get(); char bookmark[FILE_MAX]; @@ -565,11 +582,6 @@ static void file_draw_fsmenu_category(const bContext *C, ARegion *ar, FSMenuCate sx = ar->v2d.cur.xmin + TILE_BORDER_X; sy = *starty; - UI_ThemeColor(TH_TEXT_HI); - file_draw_string(sx, sy, category_name, bmwidth, fontsize, FILE_SHORTEN_END); - - sy -= fontsize*2.0f; - switch(category) { case FS_CATEGORY_SYSTEM: cat_icon = ICON_DISK_DRIVE; break; @@ -616,15 +628,54 @@ static void file_draw_fsmenu_category(const bContext *C, ARegion *ar, FSMenuCate *starty = sy; } +void file_draw_fsmenu_operator(const bContext *C, ARegion *ar, wmOperator *op, short *starty) +{ + uiStyle *style= U.uistyles.first; + uiBlock *block; + uiLayout *layout; + int sy; + + sy= *starty; + + block= uiBeginBlock(C, ar, "file_options", UI_EMBOSS); + layout= uiBlockLayout(block, UI_LAYOUT_VERTICAL, UI_LAYOUT_PANEL, TILE_BORDER_X, sy, ar->winx-2*TILE_BORDER_X, 20, style); + + RNA_STRUCT_BEGIN(op->ptr, prop) { + if(strcmp(RNA_property_identifier(prop), "rna_type") == 0) + continue; + if(strcmp(RNA_property_identifier(prop), "filename") == 0) + continue; + + uiItemFullR(layout, NULL, 0, op->ptr, prop, -1, 0, 0, 0, 0); + } + RNA_STRUCT_END; + + uiBlockLayoutResolve(C, block, NULL, &sy); + uiEndBlock(C, block); + uiDrawBlock(C, block); + + *starty= sy; +} + void file_draw_fsmenu(const bContext *C, ARegion *ar) { + SpaceFile *sfile= (SpaceFile*)CTX_wm_space_data(C); int linestep = file_font_pointsize()*2.0f; short sy= ar->v2d.cur.ymax-2*TILE_BORDER_Y; - file_draw_fsmenu_category(C, ar, FS_CATEGORY_SYSTEM, "SYSTEM", &sy); + file_draw_fsmenu_category_name(ar, "SYSTEM", &sy); + file_draw_fsmenu_category(C, ar, FS_CATEGORY_SYSTEM, &sy); sy -= linestep; - file_draw_fsmenu_category(C, ar, FS_CATEGORY_BOOKMARKS, "BOOKMARKS", &sy); + file_draw_fsmenu_category_name(ar, "BOOKMARKS", &sy); + file_draw_fsmenu_category(C, ar, FS_CATEGORY_BOOKMARKS, &sy); sy -= linestep; - file_draw_fsmenu_category(C, ar, FS_CATEGORY_RECENT, "RECENT", &sy); - + file_draw_fsmenu_category_name(ar, "RECENT", &sy); + file_draw_fsmenu_category(C, ar, FS_CATEGORY_RECENT, &sy); + + if(sfile->op) { + sy -= linestep; + file_draw_fsmenu_category_name(ar, "OPTIONS", &sy); + file_draw_fsmenu_operator(C, ar, sfile->op, &sy); + } } + diff --git a/source/blender/editors/space_file/file_ops.c b/source/blender/editors/space_file/file_ops.c index 0c6cadc05c1..ab02147d020 100644 --- a/source/blender/editors/space_file/file_ops.c +++ b/source/blender/editors/space_file/file_ops.c @@ -190,7 +190,7 @@ static int file_border_select_exec(bContext *C, wmOperator *op) rect.xmax= RNA_int_get(op->ptr, "xmax"); rect.ymax= RNA_int_get(op->ptr, "ymax"); - BLI_isect_rctf(&(ar->v2d.mask), &rect, &rect); + BLI_isect_rcti(&(ar->v2d.mask), &rect, &rect); file_select(sfile, ar, &rect, val ); WM_event_add_notifier(C, NC_WINDOW, NULL); diff --git a/source/blender/editors/space_file/filesel.c b/source/blender/editors/space_file/filesel.c index 4c2def72de0..9c0bcc6b991 100644 --- a/source/blender/editors/space_file/filesel.c +++ b/source/blender/editors/space_file/filesel.c @@ -162,7 +162,7 @@ float file_string_width(const char* str) { uiStyle *style= U.uistyles.first; uiStyleFontSet(&style->widget); - return BLF_width(str); + return BLF_width((char *)str); } float file_font_pointsize() diff --git a/source/blender/editors/space_graph/Makefile b/source/blender/editors/space_graph/Makefile index 340495ecc79..e04a354fb1d 100644 --- a/source/blender/editors/space_graph/Makefile +++ b/source/blender/editors/space_graph/Makefile @@ -1,5 +1,5 @@ # -# $Id: Makefile 14 2002-10-13 15:57:19Z hans $ +# $Id$ # # ***** BEGIN GPL LICENSE BLOCK ***** # diff --git a/source/blender/editors/space_graph/graph_draw.c b/source/blender/editors/space_graph/graph_draw.c index d9e12afc947..6393b6877b9 100644 --- a/source/blender/editors/space_graph/graph_draw.c +++ b/source/blender/editors/space_graph/graph_draw.c @@ -1,5 +1,5 @@ /** - * $Id: drawipo.c 17512 2008-11-20 05:55:42Z aligorith $ + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * diff --git a/source/blender/editors/space_graph/graph_edit.c b/source/blender/editors/space_graph/graph_edit.c index 057c3c40ddf..fc04308077c 100644 --- a/source/blender/editors/space_graph/graph_edit.c +++ b/source/blender/editors/space_graph/graph_edit.c @@ -1,5 +1,5 @@ /** - * $Id: editaction.c 17746 2008-12-08 11:19:44Z aligorith $ + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * diff --git a/source/blender/editors/space_graph/graph_select.c b/source/blender/editors/space_graph/graph_select.c index 4451cfae227..d600396fd77 100644 --- a/source/blender/editors/space_graph/graph_select.c +++ b/source/blender/editors/space_graph/graph_select.c @@ -1,5 +1,5 @@ /** - * $Id: editaction.c 17746 2008-12-08 11:19:44Z aligorith $ + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * diff --git a/source/blender/editors/space_image/Makefile b/source/blender/editors/space_image/Makefile index 44d841a0606..e7e9a9b5665 100644 --- a/source/blender/editors/space_image/Makefile +++ b/source/blender/editors/space_image/Makefile @@ -1,5 +1,5 @@ # -# $Id: Makefile 14 2002-10-13 15:57:19Z hans $ +# $Id$ # # ***** BEGIN GPL LICENSE BLOCK ***** # diff --git a/source/blender/editors/space_image/image_buttons.c b/source/blender/editors/space_image/image_buttons.c index b5df0257e71..a08a23c1263 100644 --- a/source/blender/editors/space_image/image_buttons.c +++ b/source/blender/editors/space_image/image_buttons.c @@ -383,6 +383,7 @@ static void image_editcursor_buts(const bContext *C, View2D *v2d, uiBlock *block } } +#if 0 static void image_panel_view_properties(const bContext *C, Panel *pa) { SpaceImage *sima= (SpaceImage*)CTX_wm_space_data(C); @@ -439,6 +440,7 @@ static void image_panel_view_properties(const bContext *C, Panel *pa) } image_editcursor_buts(C, &ar->v2d, block); } +#endif void brush_buttons(const bContext *C, uiBlock *block, short fromsima, int evt_nop, int evt_change, @@ -1023,42 +1025,53 @@ static void image_load_fs_cb(bContext *C, void *ima_pp_v, void *iuser_v) static void image_multi_cb(bContext *C, void *rr_v, void *iuser_v) { BKE_image_multilayer_index(rr_v, iuser_v); + WM_event_add_notifier(C, NC_IMAGE|ND_DRAW, NULL); } static void image_multi_inclay_cb(bContext *C, void *rr_v, void *iuser_v) { RenderResult *rr= rr_v; ImageUser *iuser= iuser_v; int tot= BLI_countlist(&rr->layers) + (rr->rectf?1:0); /* fake compo result layer */ - if(iuser->layer<tot-1) + + if(iuser->layer<tot-1) { iuser->layer++; - BKE_image_multilayer_index(rr, iuser); + BKE_image_multilayer_index(rr, iuser); + WM_event_add_notifier(C, NC_IMAGE|ND_DRAW, NULL); + } } static void image_multi_declay_cb(bContext *C, void *rr_v, void *iuser_v) { ImageUser *iuser= iuser_v; - if(iuser->layer>0) + + if(iuser->layer>0) { iuser->layer--; - BKE_image_multilayer_index(rr_v, iuser); + BKE_image_multilayer_index(rr_v, iuser); + WM_event_add_notifier(C, NC_IMAGE|ND_DRAW, NULL); + } } static void image_multi_incpass_cb(bContext *C, void *rr_v, void *iuser_v) { RenderResult *rr= rr_v; ImageUser *iuser= iuser_v; RenderLayer *rl= BLI_findlink(&rr->layers, iuser->layer); + if(rl) { int tot= BLI_countlist(&rl->passes) + (rl->rectf?1:0); /* builtin render result has no combined pass in list */ if(iuser->pass<tot-1) { iuser->pass++; BKE_image_multilayer_index(rr, iuser); + WM_event_add_notifier(C, NC_IMAGE|ND_DRAW, NULL); } } } static void image_multi_decpass_cb(bContext *C, void *rr_v, void *iuser_v) { ImageUser *iuser= iuser_v; + if(iuser->pass>0) { iuser->pass--; BKE_image_multilayer_index(rr_v, iuser); + WM_event_add_notifier(C, NC_IMAGE|ND_DRAW, NULL); } } @@ -1353,6 +1366,23 @@ void ED_image_uiblock_panel(const bContext *C, uiBlock *block, Image **ima_pp, I uiBlockEndAlign(block); } +void uiTemplateImageLayers(uiLayout *layout, bContext *C, Image *ima, ImageUser *iuser) +{ + uiBlock *block= uiLayoutFreeBlock(layout); + Scene *scene= CTX_data_scene(C); + RenderResult *rr; + + /* render layers and passes */ + if(ima && iuser) { + rr= BKE_image_get_renderresult(scene, ima); + + if(rr) { + uiBlockBeginAlign(block); + uiblock_layer_pass_buttons(block, rr, iuser, 0, 0, 0, 160); + uiBlockEndAlign(block); + } + } +} static void image_panel_properties(const bContext *C, Panel *pa) { @@ -1377,12 +1407,6 @@ void image_buttons_register(ARegionType *art) pt->draw= image_panel_properties; BLI_addtail(&art->paneltypes, pt); - pt= MEM_callocN(sizeof(PanelType), "spacetype image view properties"); - strcpy(pt->idname, "IMAGE_PT_view_properties"); - strcpy(pt->label, "View Properties"); - pt->draw= image_panel_view_properties; - BLI_addtail(&art->paneltypes, pt); - pt= MEM_callocN(sizeof(PanelType), "spacetype image panel paint"); strcpy(pt->idname, "IMAGE_PT_paint"); strcpy(pt->label, "Paint"); diff --git a/source/blender/editors/space_image/image_draw.c b/source/blender/editors/space_image/image_draw.c index 122e298baaa..e61931f2fad 100644 --- a/source/blender/editors/space_image/image_draw.c +++ b/source/blender/editors/space_image/image_draw.c @@ -311,12 +311,14 @@ static void sima_draw_alpha_pixelsf(float x1, float y1, int rectx, int recty, fl // glColorMask(1, 1, 1, 1); } +#ifdef WITH_LCMS static void sima_draw_colorcorrected_pixels(float x1, float y1, ImBuf *ibuf) { colorcorrection_do_ibuf(ibuf, "MONOSCNR.ICM"); /* path is hardcoded here, find some place better */ glaDrawPixelsSafe(x1, y1, ibuf->x, ibuf->y, ibuf->x, GL_RGBA, GL_UNSIGNED_BYTE, ibuf->crect); } +#endif static void sima_draw_zbuf_pixels(float x1, float y1, int rectx, int recty, int *recti) { @@ -450,7 +452,7 @@ static unsigned int *get_part_from_ibuf(ImBuf *ibuf, short startx, short starty, return rectmain; } -static void draw_image_buffer_tiled(SpaceImage *sima, ARegion *ar, Image *ima, ImBuf *ibuf, float zoomx, float zoomy) +static void draw_image_buffer_tiled(SpaceImage *sima, ARegion *ar, Image *ima, ImBuf *ibuf, float fx, float fy, float zoomx, float zoomy) { unsigned int *rect; int dx, dy, sx, sy, x, y; @@ -477,7 +479,7 @@ static void draw_image_buffer_tiled(SpaceImage *sima, ARegion *ar, Image *ima, I /* draw repeated */ for(sy=0; sy+dy<=ibuf->y; sy+= dy) { for(sx=0; sx+dx<=ibuf->x; sx+= dx) { - UI_view2d_view_to_region(&ar->v2d, (float)sx/(float)ibuf->x, (float)sy/(float)ibuf->y, &x, &y); + UI_view2d_to_region_no_clip(&ar->v2d, fx + (float)sx/(float)ibuf->x, fy + (float)sy/(float)ibuf->y, &x, &y); glaDrawPixelsSafe(x, y, dx, dy, dx, GL_RGBA, GL_UNSIGNED_BYTE, rect); } @@ -488,16 +490,19 @@ static void draw_image_buffer_tiled(SpaceImage *sima, ARegion *ar, Image *ima, I MEM_freeN(rect); } -static void draw_image_buffer_repeated(SpaceImage *sima, ARegion *ar, Scene *scene, ImBuf *ibuf, float zoomx, float zoomy) +static void draw_image_buffer_repeated(SpaceImage *sima, ARegion *ar, Scene *scene, Image *ima, ImBuf *ibuf, float zoomx, float zoomy) { float x, y; double time_current; time_current = PIL_check_seconds_timer(); - for(x=ar->v2d.cur.xmin; x<ar->v2d.cur.xmax; x += zoomx) { - for(y=ar->v2d.cur.ymin; y<ar->v2d.cur.ymax; y += zoomy) { - draw_image_buffer(sima, ar, scene, ibuf, x, y, zoomx, zoomy); + for(x=floor(ar->v2d.cur.xmin); x<ar->v2d.cur.xmax; x += 1.0f) { + for(y=floor(ar->v2d.cur.ymin); y<ar->v2d.cur.ymax; y += 1.0f) { + if(ima && (ima->tpageflag & IMA_TILES)) + draw_image_buffer_tiled(sima, ar, ima, ibuf, x, y, zoomx, zoomy); + else + draw_image_buffer(sima, ar, scene, ibuf, x, y, zoomx, zoomy); /* only draw until running out of time */ if((PIL_check_seconds_timer() - time_current) > 0.25) @@ -667,9 +672,9 @@ void draw_image_main(SpaceImage *sima, ARegion *ar, Scene *scene) if(ibuf==NULL) draw_image_grid(ar, zoomx, zoomy); else if(sima->flag & SI_DRAW_TILE) - draw_image_buffer_repeated(sima, ar, scene, ibuf, zoomx, zoomy); + draw_image_buffer_repeated(sima, ar, scene, ima, ibuf, zoomx, zoomy); else if(ima && (ima->tpageflag & IMA_TILES)) - draw_image_buffer_tiled(sima, ar, ima, ibuf, zoomx, zoomy); + draw_image_buffer_tiled(sima, ar, ima, ibuf, 0.0f, 0.0, zoomx, zoomy); else draw_image_buffer(sima, ar, scene, ibuf, 0.0f, 0.0f, zoomx, zoomy); @@ -699,12 +704,5 @@ void draw_image_main(SpaceImage *sima, ARegion *ar, Scene *scene) } } #endif - -#if 0 - /* it is important to end a view in a transform compatible with buttons */ - bwin_scalematrix(sa->win, sima->blockscale, sima->blockscale, sima->blockscale); - if(!(G.rendering && show_render)) - image_blockhandlers(sa); -#endif } diff --git a/source/blender/editors/space_image/image_header.c b/source/blender/editors/space_image/image_header.c index adf4772efde..9550c4c3a29 100644 --- a/source/blender/editors/space_image/image_header.c +++ b/source/blender/editors/space_image/image_header.c @@ -802,11 +802,11 @@ void image_header_buttons(const bContext *C, ARegion *ar) uiBlockBeginAlign(block); uiDefIconButBitS(block, TOG, SCE_SELECT_VERTEX, B_REDR, ICON_VERTEXSEL, - xco,yco,XIC,YIC, &scene->selectmode, 1.0, 0.0, 0, 0, "Vertex select mode"); + xco,yco,XIC,YIC, &scene->toolsettings->selectmode, 1.0, 0.0, 0, 0, "Vertex select mode"); uiDefIconButBitS(block, TOG, SCE_SELECT_EDGE, B_REDR, ICON_EDGESEL, - xco+=XIC,yco,XIC,YIC, &scene->selectmode, 1.0, 0.0, 0, 0, "Edge select mode"); + xco+=XIC,yco,XIC,YIC, &scene->toolsettings->selectmode, 1.0, 0.0, 0, 0, "Edge select mode"); uiDefIconButBitS(block, TOG, SCE_SELECT_FACE, B_REDR, ICON_FACESEL, - xco+=XIC,yco,XIC,YIC, &scene->selectmode, 1.0, 0.0, 0, 0, "Face select mode"); + xco+=XIC,yco,XIC,YIC, &scene->toolsettings->selectmode, 1.0, 0.0, 0, 0, "Face select mode"); uiBlockEndAlign(block); } @@ -837,14 +837,14 @@ void image_header_buttons(const bContext *C, ARegion *ar) /* snap options, identical to options in 3d view header */ uiBlockBeginAlign(block); - if (scene->snap_flag & SCE_SNAP) { - uiDefIconButBitS(block, TOG, SCE_SNAP, B_REDR, ICON_SNAP_GEO,xco,yco,XIC,YIC, &scene->snap_flag, 0, 0, 0, 0, "Use Snap or Grid (Shift Tab)."); + if (scene->toolsettings->snap_flag & SCE_SNAP) { + uiDefIconButBitS(block, TOG, SCE_SNAP, B_REDR, ICON_SNAP_GEO,xco,yco,XIC,YIC, &scene->toolsettings->snap_flag, 0, 0, 0, 0, "Use Snap or Grid (Shift Tab)."); xco+= XIC; - uiDefButS(block, MENU, B_NOP, "Mode%t|Closest%x0|Center%x1|Median%x2",xco,yco,70,YIC, &scene->snap_target, 0, 0, 0, 0, "Snap Target Mode."); + uiDefButS(block, MENU, B_NOP, "Mode%t|Closest%x0|Center%x1|Median%x2",xco,yco,70,YIC, &scene->toolsettings->snap_target, 0, 0, 0, 0, "Snap Target Mode."); xco+= 70; } else { - uiDefIconButBitS(block, TOG, SCE_SNAP, B_REDR, ICON_SNAP_GEAR,xco,yco,XIC,YIC, &scene->snap_flag, 0, 0, 0, 0, "Snap while Ctrl is held during transform (Shift Tab)."); + uiDefIconButBitS(block, TOG, SCE_SNAP, B_REDR, ICON_SNAP_GEAR,xco,yco,XIC,YIC, &scene->toolsettings->snap_flag, 0, 0, 0, 0, "Snap while Ctrl is held during transform (Shift Tab)."); xco+= XIC; } diff --git a/source/blender/editors/space_image/image_ops.c b/source/blender/editors/space_image/image_ops.c index 537996601b8..8f9bb0d05fe 100644 --- a/source/blender/editors/space_image/image_ops.c +++ b/source/blender/editors/space_image/image_ops.c @@ -577,34 +577,30 @@ void IMAGE_OT_view_zoom_ratio(wmOperatorType *ot) /**************** load/replace/save callbacks ******************/ -static char *filesel_imagetype_string(Image *ima) -{ - char *strp, *str= MEM_callocN(15*32, "menu for filesel"); - - strp= str; - str += sprintf(str, "Save Image as: %%t|"); - str += sprintf(str, "Targa %%x%d|", R_TARGA); - str += sprintf(str, "Targa Raw %%x%d|", R_RAWTGA); - str += sprintf(str, "PNG %%x%d|", R_PNG); - str += sprintf(str, "BMP %%x%d|", R_BMP); - str += sprintf(str, "Jpeg %%x%d|", R_JPEG90); +/* XXX make dynamic */ +static const EnumPropertyItem image_file_type_items[] = { + {R_TARGA, "TARGA", 0, "Targa", ""}, + {R_RAWTGA, "TARGA RAW", 0, "Targa Raw", ""}, + {R_PNG, "PNG", 0, "PNG", ""}, + {R_BMP, "BMP", 0, "BMP", ""}, + {R_JPEG90, "JPEG", 0, "Jpeg", ""}, #ifdef WITH_OPENJPEG - str += sprintf(str, "Jpeg 2000 %%x%d|", R_JP2); + {R_JP2, "JPEG_2000", 0, "Jpeg 2000", ""}, #endif - str += sprintf(str, "Iris %%x%d|", R_IRIS); - if(G.have_libtiff) - str += sprintf(str, "Tiff %%x%d|", R_TIFF); - str += sprintf(str, "Radiance HDR %%x%d|", R_RADHDR); - str += sprintf(str, "Cineon %%x%d|", R_CINEON); - str += sprintf(str, "DPX %%x%d|", R_DPX); + {R_IRIS, "IRIS", 0, "Iris", ""}, + //if(G.have_libtiff) + {R_TIFF, "TIFF", 0, "Tiff", ""}, + {R_RADHDR, "RADIANCE_HDR", 0, "Radiance HDR", ""}, + {R_CINEON, "CINEON", 0, "Cineon", ""}, + {R_DPX, "DPX", 0, "DPX", ""}, #ifdef WITH_OPENEXR - str += sprintf(str, "OpenEXR %%x%d|", R_OPENEXR); + {R_OPENEXR, "OPENEXR", 0, "OpenEXR", ""}, /* saving sequences of multilayer won't work, they copy buffers */ - if(ima->source==IMA_SRC_SEQUENCE && ima->type==IMA_TYPE_MULTILAYER); - else str += sprintf(str, "MultiLayer %%x%d|", R_MULTILAYER); + /*if(ima->source==IMA_SRC_SEQUENCE && ima->type==IMA_TYPE_MULTILAYER); + else*/ + {R_MULTILAYER, "MULTILAYER", 0, "MultiLayer", ""}, #endif - return strp; -} + {0, NULL, 0, NULL, NULL}}; static void image_filesel(bContext *C, wmOperator *op, const char *path) { @@ -799,7 +795,9 @@ static int save_as_exec(bContext *C, wmOperator *op) if(!ima) return OPERATOR_CANCELLED; + sima->imtypenr= RNA_enum_get(op->ptr, "file_type"); RNA_string_get(op->ptr, "filename", str); + save_image_doit(C, sima, scene, op, str); return OPERATOR_FINISHED; @@ -820,10 +818,6 @@ static int save_as_invoke(bContext *C, wmOperator *op, wmEvent *event) /* always opens fileselect */ if(ibuf) { - char *strp; - - strp= filesel_imagetype_string(ima); // XXX unused still - /* 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; @@ -831,14 +825,14 @@ static int save_as_invoke(bContext *C, wmOperator *op, wmEvent *event) sima->imtypenr= scene->r.imtype; else sima->imtypenr= BKE_ftype_to_imtype(ibuf->ftype); + + RNA_enum_set(op->ptr, "file_type", sima->imtypenr); if(ibuf->name[0]==0) BLI_strncpy(ibuf->name, G.ima, FILE_MAX); // XXX note: we can give default menu enums to operator for this image_filesel(C, op, ibuf->name); - - MEM_freeN(strp); return OPERATOR_RUNNING_MODAL; } @@ -862,6 +856,7 @@ void IMAGE_OT_save_as(wmOperatorType *ot) /* properties */ RNA_def_string_file_path(ot->srna, "filename", "", FILE_MAX, "Filename", "File path to save image to."); + RNA_def_enum(ot->srna, "file_type", image_file_type_items, R_PNG, "File Type", "File type to save image as."); } /******************** save image operator ********************/ diff --git a/source/blender/editors/space_image/space_image.c b/source/blender/editors/space_image/space_image.c index 49f950fe67b..7d6faa00dfc 100644 --- a/source/blender/editors/space_image/space_image.c +++ b/source/blender/editors/space_image/space_image.c @@ -327,12 +327,10 @@ static void image_main_area_set_view2d(SpaceImage *sima, ARegion *ar, Scene *sce #endif if(sima->image) { ImBuf *ibuf= ED_space_image_buffer(sima); - float xuser_asp, yuser_asp; - ED_image_aspect(sima->image, &xuser_asp, &yuser_asp); if(ibuf) { - width= ibuf->x*xuser_asp; - height= ibuf->y*yuser_asp; + width= ibuf->x; + height= ibuf->y; } else if(sima->image->type==IMA_TYPE_R_RESULT) { /* not very important, just nice */ @@ -683,7 +681,7 @@ void ED_image_aspect(Image *ima, float *aspx, float *aspy) *aspx= *aspy= 1.0; if((ima == NULL) || (ima->type == IMA_TYPE_R_RESULT) || (ima->type == IMA_TYPE_COMPOSITE) || - (ima->tpageflag & IMA_TILES) || (ima->aspx==0.0 || ima->aspy==0.0)) + (ima->aspx==0.0 || ima->aspy==0.0)) return; /* x is always 1 */ diff --git a/source/blender/editors/space_info/Makefile b/source/blender/editors/space_info/Makefile index bc04ddc7824..931c2f2097c 100644 --- a/source/blender/editors/space_info/Makefile +++ b/source/blender/editors/space_info/Makefile @@ -1,5 +1,5 @@ # -# $Id: Makefile 14 2002-10-13 15:57:19Z hans $ +# $Id$ # # ***** BEGIN GPL LICENSE BLOCK ***** # diff --git a/source/blender/editors/space_info/info_header.c b/source/blender/editors/space_info/info_header.c index c8dd3df8425..7b65a70117c 100644 --- a/source/blender/editors/space_info/info_header.c +++ b/source/blender/editors/space_info/info_header.c @@ -415,7 +415,7 @@ static void operator_search_cb(const struct bContext *C, void *arg, char *str, u name[len]= '|'; } - if(0==uiSearchItemAdd(items, name, ot)) + if(0==uiSearchItemAdd(items, name, ot, 0)) break; } } diff --git a/source/blender/editors/space_logic/Makefile b/source/blender/editors/space_logic/Makefile index e07a5bbf4a9..d5709993368 100644 --- a/source/blender/editors/space_logic/Makefile +++ b/source/blender/editors/space_logic/Makefile @@ -1,5 +1,5 @@ # -# $Id: Makefile 14 2002-10-13 15:57:19Z hans $ +# $Id$ # # ***** BEGIN GPL LICENSE BLOCK ***** # diff --git a/source/blender/editors/space_logic/logic_buttons.c b/source/blender/editors/space_logic/logic_buttons.c index 240ddfc2614..b082d5d6ae2 100644 --- a/source/blender/editors/space_logic/logic_buttons.c +++ b/source/blender/editors/space_logic/logic_buttons.c @@ -1,5 +1,5 @@ /** - * $Id: image_buttons.c 20913 2009-06-16 01:22:56Z blendix $ + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * diff --git a/source/blender/editors/space_logic/logic_window.c b/source/blender/editors/space_logic/logic_window.c index b328ed74e08..55e21561c34 100644 --- a/source/blender/editors/space_logic/logic_window.c +++ b/source/blender/editors/space_logic/logic_window.c @@ -3056,12 +3056,12 @@ void logic_buttons(bContext *C, ARegion *ar) /* ******************************* */ xco= 500; yco= 170; width= 300; - uiDefPulldownBut(block, controller_menu, NULL, "Controllers", xco-10, yco+35, 100, 19, ""); + uiDefBlockBut(block, controller_menu, NULL, "Controllers", xco-10, yco+35, 100, UI_UNIT_Y, ""); uiBlockBeginAlign(block); - uiDefButBitS(block, TOG, BUTS_CONT_SEL, B_REDR, "Sel", xco+110, yco+35, (width-100)/3, 19, &slogic->scaflag, 0, 0, 0, 0, "Show all selected Objects"); - uiDefButBitS(block, TOG, BUTS_CONT_ACT, B_REDR, "Act", xco+110+(width-100)/3, yco+35, (width-100)/3, 19, &slogic->scaflag, 0, 0, 0, 0, "Show active Object"); - uiDefButBitS(block, TOG, BUTS_CONT_LINK, B_REDR, "Link", xco+110+2*(width-100)/3, yco+35, (width-100)/3, 19, &slogic->scaflag, 0, 0, 0, 0, "Show linked Objects to Sensor/Actuator"); + uiDefButBitS(block, TOG, BUTS_CONT_SEL, B_REDR, "Sel", xco+110, yco+35, (width-100)/3, UI_UNIT_Y, &slogic->scaflag, 0, 0, 0, 0, "Show all selected Objects"); + uiDefButBitS(block, TOG, BUTS_CONT_ACT, B_REDR, "Act", xco+110+(width-100)/3, yco+35, (width-100)/3, UI_UNIT_Y, &slogic->scaflag, 0, 0, 0, 0, "Show active Object"); + uiDefButBitS(block, TOG, BUTS_CONT_LINK, B_REDR, "Link", xco+110+2*(width-100)/3, yco+35, (width-100)/3, UI_UNIT_Y, &slogic->scaflag, 0, 0, 0, 0, "Show linked Objects to Sensor/Actuator"); uiBlockEndAlign(block); ob= CTX_data_active_object(C); @@ -3077,9 +3077,9 @@ void logic_buttons(bContext *C, ARegion *ar) /* presume it is only objects for now */ uiBlockBeginAlign(block); // if(ob->controllers.first) uiSetCurFont(block, UI_HELVB); - uiDefButBitS(block, TOG, OB_SHOWCONT, B_REDR, ob->id.name+2,(short)(xco-10), yco, (short)(width-30), 19, &ob->scaflag, 0, 0, 0, 0, "Active Object name"); + uiDefButBitS(block, TOG, OB_SHOWCONT, B_REDR, ob->id.name+2,(short)(xco-10), yco, (short)(width-30), UI_UNIT_Y, &ob->scaflag, 0, 0, 0, 0, "Active Object name"); // if(ob->controllers.first) uiSetCurFont(block, UI_HELV); - uiDefButBitS(block, TOG, OB_ADDCONT, B_ADD_CONT, "Add",(short)(xco+width-40), yco, 50, 19, &ob->scaflag, 0, 0, 0, 0, "Add a new Controller"); + uiDefButBitS(block, TOG, OB_ADDCONT, B_ADD_CONT, "Add",(short)(xco+width-40), yco, 50, UI_UNIT_Y, &ob->scaflag, 0, 0, 0, 0, "Add a new Controller"); uiBlockEndAlign(block); yco-=20; @@ -3100,7 +3100,7 @@ void logic_buttons(bContext *C, ARegion *ar) if(ob->scaflag & OB_SHOWCONT) { /* first show the state */ - uiDefBlockBut(block, object_state_mask_menu, ob, "State", (short)(xco-10), (short)(yco-10), 36, 19, "Object state menu: store and retrieve initial state"); + uiDefBlockBut(block, object_state_mask_menu, ob, "State", (short)(xco-10), (short)(yco-10), 36, UI_UNIT_Y, "Object state menu: store and retrieve initial state"); if (!ob->state) ob->state = 1; @@ -3116,9 +3116,9 @@ void logic_buttons(bContext *C, ARegion *ar) } } uiBlockBeginAlign(block); - uiDefButBitS(block, TOG, OB_SETSTBIT, B_SET_STATE_BIT, "All",(short)(xco+226), yco-10, 22, 19, &ob->scaflag, 0, 0, 0, 0, "Set all state bits"); - uiDefButBitS(block, TOG, OB_INITSTBIT, B_INIT_STATE_BIT, "Ini",(short)(xco+248), yco-10, 22, 19, &ob->scaflag, 0, 0, 0, 0, "Set the initial state"); - uiDefButBitS(block, TOG, OB_DEBUGSTATE, 0, "D",(short)(xco+270), yco-10, 15, 19, &ob->scaflag, 0, 0, 0, 0, "Print state debug info"); + uiDefButBitS(block, TOG, OB_SETSTBIT, B_SET_STATE_BIT, "All",(short)(xco+226), yco-10, 22, UI_UNIT_Y, &ob->scaflag, 0, 0, 0, 0, "Set all state bits"); + uiDefButBitS(block, TOG, OB_INITSTBIT, B_INIT_STATE_BIT, "Ini",(short)(xco+248), yco-10, 22, UI_UNIT_Y, &ob->scaflag, 0, 0, 0, 0, "Set the initial state"); + uiDefButBitS(block, TOG, OB_DEBUGSTATE, 0, "D",(short)(xco+270), yco-10, 15, UI_UNIT_Y, &ob->scaflag, 0, 0, 0, 0, "Print state debug info"); uiBlockEndAlign(block); yco-=35; @@ -3142,17 +3142,17 @@ void logic_buttons(bContext *C, ARegion *ar) if (act) act->flag |= ACT_VISIBLE; } - uiDefIconButBitS(block, TOG, CONT_DEL, B_DEL_CONT, ICON_X, xco, yco, 22, 19, &cont->flag, 0, 0, 0, 0, "Delete Controller"); - uiDefIconButBitS(block, ICONTOG, CONT_SHOW, B_REDR, ICON_RIGHTARROW, (short)(xco+width-22), yco, 22, 19, &cont->flag, 0, 0, 0, 0, "Controller settings"); - uiDefIconButBitS(block, TOG, CONT_PRIO, B_REDR, ICON_BOOKMARKS, (short)(xco+width-66), yco, 22, 19, &cont->flag, 0, 0, 0, 0, "Mark controller for execution before all non-marked controllers (good for startup scripts)"); + uiDefIconButBitS(block, TOG, CONT_DEL, B_DEL_CONT, ICON_X, xco, yco, 22, UI_UNIT_Y, &cont->flag, 0, 0, 0, 0, "Delete Controller"); + uiDefIconButBitS(block, ICONTOG, CONT_SHOW, B_REDR, ICON_RIGHTARROW, (short)(xco+width-22), yco, 22, UI_UNIT_Y, &cont->flag, 0, 0, 0, 0, "Controller settings"); + uiDefIconButBitS(block, TOG, CONT_PRIO, B_REDR, ICON_BOOKMARKS, (short)(xco+width-66), yco, 22, UI_UNIT_Y, &cont->flag, 0, 0, 0, 0, "Mark controller for execution before all non-marked controllers (good for startup scripts)"); sprintf(name, "%d", first_bit(cont->state_mask)+1); - uiDefBlockBut(block, controller_state_mask_menu, cont, name, (short)(xco+width-44), yco, 22, 19, "Set controller state index (from 1 to 30)"); + uiDefBlockBut(block, controller_state_mask_menu, cont, name, (short)(xco+width-44), yco, 22, UI_UNIT_Y, "Set controller state index (from 1 to 30)"); if(cont->flag & CONT_SHOW) { cont->otype= cont->type; - uiDefButS(block, MENU, B_CHANGE_CONT, controller_pup(),(short)(xco+22), yco, 70, 19, &cont->type, 0, 0, 0, 0, "Controller type"); - but= uiDefBut(block, TEX, 1, "", (short)(xco+92), yco, (short)(width-158), 19, cont->name, 0, 31, 0, 0, "Controller name"); + uiDefButS(block, MENU, B_CHANGE_CONT, controller_pup(),(short)(xco+22), yco, 70, UI_UNIT_Y, &cont->type, 0, 0, 0, 0, "Controller type"); + but= uiDefBut(block, TEX, 1, "", (short)(xco+92), yco, (short)(width-158), UI_UNIT_Y, cont->name, 0, 31, 0, 0, "Controller name"); uiButSetFunc(but, make_unique_prop_names_cb, cont->name, (void*) 0); ycoo= yco; @@ -3162,17 +3162,17 @@ void logic_buttons(bContext *C, ARegion *ar) else { cpack(0x999999); glRecti(xco+22, yco, xco+width-22,yco+19); - but= uiDefBut(block, LABEL, 0, controller_name(cont->type), (short)(xco+22), yco, 70, 19, cont, 0, 0, 0, 0, "Controller type"); + but= uiDefBut(block, LABEL, 0, controller_name(cont->type), (short)(xco+22), yco, 70, UI_UNIT_Y, cont, 0, 0, 0, 0, "Controller type"); uiButSetFunc(but, sca_move_controller, cont, NULL); - but= uiDefBut(block, LABEL, 0, cont->name,(short)(xco+92), yco,(short)(width-158), 19, cont, 0, 0, 0, 0, "Controller name"); + but= uiDefBut(block, LABEL, 0, cont->name,(short)(xco+92), yco,(short)(width-158), UI_UNIT_Y, cont, 0, 0, 0, 0, "Controller name"); uiButSetFunc(but, sca_move_controller, cont, NULL); ycoo= yco; } - but= uiDefIconBut(block, LINK, 0, ICON_LINK, (short)(xco+width), ycoo, 19, 19, NULL, 0, 0, 0, 0, ""); + but= uiDefIconBut(block, LINK, 0, ICON_LINK, (short)(xco+width), ycoo, UI_UNIT_X, UI_UNIT_Y, NULL, 0, 0, 0, 0, ""); uiSetButLink(but, NULL, (void ***)&(cont->links), &cont->totlinks, LINK_CONTROLLER, LINK_ACTUATOR); - uiDefIconBut(block, INLINK, 0, ICON_INLINK,(short)(xco-19), ycoo, 19, 19, cont, LINK_CONTROLLER, 0, 0, 0, ""); + uiDefIconBut(block, INLINK, 0, ICON_INLINK,(short)(xco-19), ycoo, UI_UNIT_X, UI_UNIT_Y, cont, LINK_CONTROLLER, 0, 0, 0, ""); /* offset is >0 if at least one controller was displayed */ offset++; yco-=20; @@ -3188,13 +3188,13 @@ void logic_buttons(bContext *C, ARegion *ar) /* ******************************* */ xco= 10; yco= 170; width= 400; - uiDefPulldownBut(block, sensor_menu, NULL, "Sensors", xco-10, yco+35, 70, 19, ""); + uiDefBlockBut(block, sensor_menu, NULL, "Sensors", xco-10, yco+35, 70, UI_UNIT_Y, ""); uiBlockBeginAlign(block); - uiDefButBitS(block, TOG, BUTS_SENS_SEL, B_REDR, "Sel", xco+80, yco+35, (width-70)/4, 19, &slogic->scaflag, 0, 0, 0, 0, "Show all selected Objects"); - uiDefButBitS(block, TOG, BUTS_SENS_ACT, B_REDR, "Act", xco+80+(width-70)/4, yco+35, (width-70)/4, 19, &slogic->scaflag, 0, 0, 0, 0, "Show active Object"); - uiDefButBitS(block, TOG, BUTS_SENS_LINK, B_REDR, "Link", xco+80+2*(width-70)/4, yco+35, (width-70)/4, 19, &slogic->scaflag, 0, 0, 0, 0, "Show linked Objects to Controller"); - uiDefButBitS(block, TOG, BUTS_SENS_STATE, B_REDR, "State", xco+80+3*(width-70)/4, yco+35, (width-70)/4, 19, &slogic->scaflag, 0, 0, 0, 0, "Show only sensors connected to active states"); + uiDefButBitS(block, TOG, BUTS_SENS_SEL, B_REDR, "Sel", xco+80, yco+35, (width-70)/4, UI_UNIT_Y, &slogic->scaflag, 0, 0, 0, 0, "Show all selected Objects"); + uiDefButBitS(block, TOG, BUTS_SENS_ACT, B_REDR, "Act", xco+80+(width-70)/4, yco+35, (width-70)/4, UI_UNIT_Y, &slogic->scaflag, 0, 0, 0, 0, "Show active Object"); + uiDefButBitS(block, TOG, BUTS_SENS_LINK, B_REDR, "Link", xco+80+2*(width-70)/4, yco+35, (width-70)/4, UI_UNIT_Y, &slogic->scaflag, 0, 0, 0, 0, "Show linked Objects to Controller"); + uiDefButBitS(block, TOG, BUTS_SENS_STATE, B_REDR, "State", xco+80+3*(width-70)/4, yco+35, (width-70)/4, UI_UNIT_Y, &slogic->scaflag, 0, 0, 0, 0, "Show only sensors connected to active states"); uiBlockEndAlign(block); for(a=0; a<count; a++) { @@ -3207,9 +3207,9 @@ void logic_buttons(bContext *C, ARegion *ar) /* presume it is only objects for now */ uiBlockBeginAlign(block); // if(ob->sensors.first) uiSetCurFont(block, UI_HELVB); - uiDefButBitS(block, TOG, OB_SHOWSENS, B_REDR, ob->id.name+2,(short)(xco-10), yco, (short)(width-30), 19, &ob->scaflag, 0, 31, 0, 0, "Object name, click to show/hide sensors"); + uiDefButBitS(block, TOG, OB_SHOWSENS, B_REDR, ob->id.name+2,(short)(xco-10), yco, (short)(width-30), UI_UNIT_Y, &ob->scaflag, 0, 31, 0, 0, "Object name, click to show/hide sensors"); // if(ob->sensors.first) uiSetCurFont(block, UI_HELV); - uiDefButBitS(block, TOG, OB_ADDSENS, B_ADD_SENS, "Add",(short)(xco+width-40), yco, 50, 19, &ob->scaflag, 0, 0, 0, 0, "Add a new Sensor"); + uiDefButBitS(block, TOG, OB_ADDSENS, B_ADD_SENS, "Add",(short)(xco+width-40), yco, 50, UI_UNIT_Y, &ob->scaflag, 0, 0, 0, 0, "Add a new Sensor"); uiBlockEndAlign(block); yco-=20; @@ -3226,17 +3226,17 @@ void logic_buttons(bContext *C, ARegion *ar) pin = (slogic->scaflag & BUTS_SENS_STATE && (sens->flag & SENS_SHOW || sens->flag & SENS_PIN)) ? 1:0 ; sens->flag |= SENS_VISIBLE; - uiDefIconButBitS(block, TOG, SENS_DEL, B_DEL_SENS, ICON_X, xco, yco, 22, 19, &sens->flag, 0, 0, 0, 0, "Delete Sensor"); + uiDefIconButBitS(block, TOG, SENS_DEL, B_DEL_SENS, ICON_X, xco, yco, 22, UI_UNIT_Y, &sens->flag, 0, 0, 0, 0, "Delete Sensor"); if (pin) - uiDefIconButBitS(block, ICONTOG, SENS_PIN, B_REDR, ICON_PINNED, (short)(xco+width-44), yco, 22, 19, &sens->flag, 0, 0, 0, 0, "Display when not linked to a visible states controller"); + uiDefIconButBitS(block, ICONTOG, SENS_PIN, B_REDR, ICON_PINNED, (short)(xco+width-44), yco, 22, UI_UNIT_Y, &sens->flag, 0, 0, 0, 0, "Display when not linked to a visible states controller"); - uiDefIconButBitS(block, ICONTOG, SENS_SHOW, B_REDR, ICON_RIGHTARROW, (short)(xco+width-22), yco, 22, 19, &sens->flag, 0, 0, 0, 0, "Sensor settings"); + uiDefIconButBitS(block, ICONTOG, SENS_SHOW, B_REDR, ICON_RIGHTARROW, (short)(xco+width-22), yco, 22, UI_UNIT_Y, &sens->flag, 0, 0, 0, 0, "Sensor settings"); ycoo= yco; if(sens->flag & SENS_SHOW) { - uiDefButS(block, MENU, B_CHANGE_SENS, sensor_pup(), (short)(xco+22), yco, 80, 19, &sens->type, 0, 0, 0, 0, "Sensor type"); - but= uiDefBut(block, TEX, 1, "", (short)(xco+102), yco, (short)(width-(pin?146:124)), 19, sens->name, 0, 31, 0, 0, "Sensor name"); + uiDefButS(block, MENU, B_CHANGE_SENS, sensor_pup(), (short)(xco+22), yco, 80, UI_UNIT_Y, &sens->type, 0, 0, 0, 0, "Sensor type"); + but= uiDefBut(block, TEX, 1, "", (short)(xco+102), yco, (short)(width-(pin?146:124)), UI_UNIT_Y, sens->name, 0, 31, 0, 0, "Sensor name"); uiButSetFunc(but, make_unique_prop_names_cb, sens->name, (void*) 0); sens->otype= sens->type; @@ -3246,13 +3246,13 @@ void logic_buttons(bContext *C, ARegion *ar) else { set_col_sensor(sens->type, 1); glRecti(xco+22, yco, xco+width-22,yco+19); - but= uiDefBut(block, LABEL, 0, sensor_name(sens->type), (short)(xco+22), yco, 80, 19, sens, 0, 0, 0, 0, ""); + but= uiDefBut(block, LABEL, 0, sensor_name(sens->type), (short)(xco+22), yco, 80, UI_UNIT_Y, sens, 0, 0, 0, 0, ""); uiButSetFunc(but, sca_move_sensor, sens, NULL); - but= uiDefBut(block, LABEL, 0, sens->name, (short)(xco+102), yco, (short)(width-(pin?146:124)), 19, sens, 0, 31, 0, 0, ""); + but= uiDefBut(block, LABEL, 0, sens->name, (short)(xco+102), yco, (short)(width-(pin?146:124)), UI_UNIT_Y, sens, 0, 31, 0, 0, ""); uiButSetFunc(but, sca_move_sensor, sens, NULL); } - but= uiDefIconBut(block, LINK, 0, ICON_LINK, (short)(xco+width), ycoo, 19, 19, NULL, 0, 0, 0, 0, ""); + but= uiDefIconBut(block, LINK, 0, ICON_LINK, (short)(xco+width), ycoo, UI_UNIT_X, UI_UNIT_Y, NULL, 0, 0, 0, 0, ""); uiSetButLink(but, NULL, (void ***)&(sens->links), &sens->totlinks, LINK_SENSOR, LINK_CONTROLLER); yco-=20; @@ -3266,13 +3266,13 @@ void logic_buttons(bContext *C, ARegion *ar) /* ******************************* */ xco= 900; yco= 170; width= 400; - uiDefPulldownBut(block, actuator_menu, NULL, "Actuators", xco-10, yco+35, 90, 19, ""); + uiDefBlockBut(block, actuator_menu, NULL, "Actuators", xco-10, yco+35, 90, UI_UNIT_Y, ""); uiBlockBeginAlign(block); - uiDefButBitS(block, TOG, BUTS_ACT_SEL, B_REDR, "Sel", xco+110, yco+35, (width-100)/4, 19, &slogic->scaflag, 0, 0, 0, 0, "Show all selected Objects"); - uiDefButBitS(block, TOG, BUTS_ACT_ACT, B_REDR, "Act", xco+110+(width-100)/4, yco+35, (width-100)/4, 19, &slogic->scaflag, 0, 0, 0, 0, "Show active Object"); - uiDefButBitS(block, TOG, BUTS_ACT_LINK, B_REDR, "Link", xco+110+2*(width-100)/4, yco+35, (width-100)/4, 19, &slogic->scaflag, 0, 0, 0, 0, "Show linked Objects to Controller"); - uiDefButBitS(block, TOG, BUTS_ACT_STATE, B_REDR, "State", xco+110+3*(width-100)/4, yco+35, (width-100)/4, 19, &slogic->scaflag, 0, 0, 0, 0, "Show only actuators connected to active states"); + uiDefButBitS(block, TOG, BUTS_ACT_SEL, B_REDR, "Sel", xco+110, yco+35, (width-100)/4, UI_UNIT_Y, &slogic->scaflag, 0, 0, 0, 0, "Show all selected Objects"); + uiDefButBitS(block, TOG, BUTS_ACT_ACT, B_REDR, "Act", xco+110+(width-100)/4, yco+35, (width-100)/4, UI_UNIT_Y, &slogic->scaflag, 0, 0, 0, 0, "Show active Object"); + uiDefButBitS(block, TOG, BUTS_ACT_LINK, B_REDR, "Link", xco+110+2*(width-100)/4, yco+35, (width-100)/4, UI_UNIT_Y, &slogic->scaflag, 0, 0, 0, 0, "Show linked Objects to Controller"); + uiDefButBitS(block, TOG, BUTS_ACT_STATE, B_REDR, "State", xco+110+3*(width-100)/4, yco+35, (width-100)/4, UI_UNIT_Y, &slogic->scaflag, 0, 0, 0, 0, "Show only actuators connected to active states"); uiBlockEndAlign(block); for(a=0; a<count; a++) { ob= (Object *)idar[a]; @@ -3283,9 +3283,9 @@ void logic_buttons(bContext *C, ARegion *ar) /* presume it is only objects for now */ uiBlockBeginAlign(block); // if(ob->actuators.first) uiSetCurFont(block, UI_HELVB); - uiDefButBitS(block, TOG, OB_SHOWACT, B_REDR, ob->id.name+2,(short)(xco-10), yco,(short)(width-30), 19, &ob->scaflag, 0, 31, 0, 0, "Object name, click to show/hide actuators"); + uiDefButBitS(block, TOG, OB_SHOWACT, B_REDR, ob->id.name+2,(short)(xco-10), yco,(short)(width-30), UI_UNIT_Y, &ob->scaflag, 0, 31, 0, 0, "Object name, click to show/hide actuators"); // if(ob->actuators.first) uiSetCurFont(block, UI_HELV); - uiDefButBitS(block, TOG, OB_ADDACT, B_ADD_ACT, "Add",(short)(xco+width-40), yco, 50, 19, &ob->scaflag, 0, 0, 0, 0, "Add a new Actuator"); + uiDefButBitS(block, TOG, OB_ADDACT, B_ADD_ACT, "Add",(short)(xco+width-40), yco, 50, UI_UNIT_Y, &ob->scaflag, 0, 0, 0, 0, "Add a new Actuator"); uiBlockEndAlign(block); yco-=20; @@ -3301,15 +3301,15 @@ void logic_buttons(bContext *C, ARegion *ar) pin = (slogic->scaflag & BUTS_ACT_STATE && (act->flag & SENS_SHOW || act->flag & SENS_PIN)) ? 1:0 ; act->flag |= ACT_VISIBLE; /* mark the actuator as visible to help implementing the up/down action */ - uiDefIconButBitS(block, TOG, ACT_DEL, B_DEL_ACT, ICON_X, xco, yco, 22, 19, &act->flag, 0, 0, 0, 0, "Delete Actuator"); + uiDefIconButBitS(block, TOG, ACT_DEL, B_DEL_ACT, ICON_X, xco, yco, 22, UI_UNIT_Y, &act->flag, 0, 0, 0, 0, "Delete Actuator"); if (pin) - uiDefIconButBitS(block, ICONTOG, ACT_PIN, B_REDR, ICON_PINNED, (short)(xco+width-44), yco, 22, 19, &act->flag, 0, 0, 0, 0, "Display when not linked to a visible states controller"); - uiDefIconButBitS(block, ICONTOG, ACT_SHOW, B_REDR, ICON_RIGHTARROW, (short)(xco+width-22), yco, 22, 19, &act->flag, 0, 0, 0, 0, "Display the actuator"); + uiDefIconButBitS(block, ICONTOG, ACT_PIN, B_REDR, ICON_PINNED, (short)(xco+width-44), yco, 22, UI_UNIT_Y, &act->flag, 0, 0, 0, 0, "Display when not linked to a visible states controller"); + uiDefIconButBitS(block, ICONTOG, ACT_SHOW, B_REDR, ICON_RIGHTARROW, (short)(xco+width-22), yco, 22, UI_UNIT_Y, &act->flag, 0, 0, 0, 0, "Display the actuator"); if(act->flag & ACT_SHOW) { act->otype= act->type; - uiDefButS(block, MENU, B_CHANGE_ACT, actuator_pup(ob), (short)(xco+22), yco, 90, 19, &act->type, 0, 0, 0, 0, "Actuator type"); - but= uiDefBut(block, TEX, 1, "", (short)(xco+112), yco, (short)(width-(pin?156:134)), 19, act->name, 0, 31, 0, 0, "Actuator name"); + uiDefButS(block, MENU, B_CHANGE_ACT, actuator_pup(ob), (short)(xco+22), yco, 90, UI_UNIT_Y, &act->type, 0, 0, 0, 0, "Actuator type"); + but= uiDefBut(block, TEX, 1, "", (short)(xco+112), yco, (short)(width-(pin?156:134)), UI_UNIT_Y, act->name, 0, 31, 0, 0, "Actuator name"); uiButSetFunc(but, make_unique_prop_names_cb, act->name, (void*) 0); ycoo= yco; @@ -3319,14 +3319,14 @@ void logic_buttons(bContext *C, ARegion *ar) else { set_col_actuator(act->type, 1); glRecti((short)(xco+22), yco, (short)(xco+width-22),(short)(yco+19)); - but= uiDefBut(block, LABEL, 0, actuator_name(act->type), (short)(xco+22), yco, 90, 19, act, 0, 0, 0, 0, "Actuator type"); + but= uiDefBut(block, LABEL, 0, actuator_name(act->type), (short)(xco+22), yco, 90, UI_UNIT_Y, act, 0, 0, 0, 0, "Actuator type"); uiButSetFunc(but, sca_move_actuator, act, NULL); - but= uiDefBut(block, LABEL, 0, act->name, (short)(xco+112), yco, (short)(width-(pin?156:134)), 19, act, 0, 0, 0, 0, "Actuator name"); + but= uiDefBut(block, LABEL, 0, act->name, (short)(xco+112), yco, (short)(width-(pin?156:134)), UI_UNIT_Y, act, 0, 0, 0, 0, "Actuator name"); uiButSetFunc(but, sca_move_actuator, act, NULL); ycoo= yco; } - uiDefIconBut(block, INLINK, 0, ICON_INLINK,(short)(xco-19), ycoo, 19, 19, act, LINK_ACTUATOR, 0, 0, 0, ""); + uiDefIconBut(block, INLINK, 0, ICON_INLINK,(short)(xco-19), ycoo, UI_UNIT_X, UI_UNIT_Y, act, LINK_ACTUATOR, 0, 0, 0, ""); yco-=20; } diff --git a/source/blender/editors/space_nla/Makefile b/source/blender/editors/space_nla/Makefile index 43f010e6adc..d7c9477dc83 100644 --- a/source/blender/editors/space_nla/Makefile +++ b/source/blender/editors/space_nla/Makefile @@ -1,5 +1,5 @@ # -# $Id: Makefile 14 2002-10-13 15:57:19Z hans $ +# $Id$ # # ***** BEGIN GPL LICENSE BLOCK ***** # diff --git a/source/blender/editors/space_node/Makefile b/source/blender/editors/space_node/Makefile index 60f81255a74..5bd6e95e28c 100644 --- a/source/blender/editors/space_node/Makefile +++ b/source/blender/editors/space_node/Makefile @@ -1,5 +1,5 @@ # -# $Id: Makefile 14 2002-10-13 15:57:19Z hans $ +# $Id$ # # ***** BEGIN GPL LICENSE BLOCK ***** # diff --git a/source/blender/editors/space_node/node_draw.c b/source/blender/editors/space_node/node_draw.c index 0670dd9e01f..f2e2486075b 100644 --- a/source/blender/editors/space_node/node_draw.c +++ b/source/blender/editors/space_node/node_draw.c @@ -1,5 +1,5 @@ /** - * $Id: drawnode.c 17439 2008-11-13 09:57:11Z kakbarnf $ + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * diff --git a/source/blender/editors/space_outliner/Makefile b/source/blender/editors/space_outliner/Makefile index 19d40a4a31e..8d7cd017e0b 100644 --- a/source/blender/editors/space_outliner/Makefile +++ b/source/blender/editors/space_outliner/Makefile @@ -1,5 +1,5 @@ # -# $Id: Makefile 14 2002-10-13 15:57:19Z hans $ +# $Id$ # # ***** BEGIN GPL LICENSE BLOCK ***** # diff --git a/source/blender/editors/space_outliner/outliner.c b/source/blender/editors/space_outliner/outliner.c index eba0aa84e85..6563a7dc7df 100644 --- a/source/blender/editors/space_outliner/outliner.c +++ b/source/blender/editors/space_outliner/outliner.c @@ -1031,7 +1031,7 @@ static TreeElement *outliner_add_element(SpaceOops *soops, ListBase *lb, void *i } else if(ELEM3(type, TSE_RNA_STRUCT, TSE_RNA_PROPERTY, TSE_RNA_ARRAY_ELEM)) { PointerRNA pptr, propptr, *ptr= (PointerRNA*)idv; - PropertyRNA *prop, *iterprop, *nameprop; + PropertyRNA *prop, *iterprop; PropertyType proptype; PropertySubType propsubtype; int a, tot; @@ -1043,12 +1043,10 @@ static TreeElement *outliner_add_element(SpaceOops *soops, ListBase *lb, void *i } else if(type == TSE_RNA_STRUCT) { /* struct */ - nameprop= RNA_struct_name_property(ptr->type); + te->name= RNA_struct_name_get_alloc(ptr, NULL, 0); - if(nameprop) { - te->name= RNA_property_string_get_alloc(ptr, nameprop, NULL, 0); + if(te->name) te->flag |= TE_FREE_NAME; - } else te->name= (char*)RNA_struct_ui_name(ptr->type); @@ -3075,7 +3073,7 @@ static void tree_element_to_path(SpaceOops *soops, TreeElement *te, TreeStoreEle TreeElement *tem, *temnext, *temsub; TreeStoreElem *tse, *tsenext; PointerRNA *ptr, *nextptr; - PropertyRNA *prop, *nameprop; + PropertyRNA *prop; char *newpath=NULL; /* optimise tricks: @@ -3119,17 +3117,16 @@ static void tree_element_to_path(SpaceOops *soops, TreeElement *te, TreeStoreEle newpath= RNA_path_append(*path, ptr, prop, 0, NULL); } else if(RNA_property_type(prop) == PROP_COLLECTION) { + char buf[128], *name; + temnext= (TreeElement*)(ld->next->data); tsenext= TREESTORE(temnext); nextptr= &temnext->rnaptr; - nameprop= RNA_struct_name_property(nextptr->type); + name= RNA_struct_name_get_alloc(nextptr, buf, sizeof(buf)); - if(nameprop) { + if(name) { /* if possible, use name as a key in the path */ - char buf[128], *name; - name= RNA_property_string_get_alloc(nextptr, nameprop, buf, sizeof(buf)); - newpath= RNA_path_append(*path, NULL, prop, 0, name); if(name != buf) diff --git a/source/blender/editors/space_script/Makefile b/source/blender/editors/space_script/Makefile index 48e1cd8e861..3322cb61a7f 100644 --- a/source/blender/editors/space_script/Makefile +++ b/source/blender/editors/space_script/Makefile @@ -1,5 +1,5 @@ # -# $Id: Makefile 14 2002-10-13 15:57:19Z hans $ +# $Id$ # # ***** BEGIN GPL LICENSE BLOCK ***** # diff --git a/source/blender/editors/space_sequencer/Makefile b/source/blender/editors/space_sequencer/Makefile index 80699db4baa..7be0bc9cfef 100644 --- a/source/blender/editors/space_sequencer/Makefile +++ b/source/blender/editors/space_sequencer/Makefile @@ -1,5 +1,5 @@ # -# $Id: Makefile 14 2002-10-13 15:57:19Z hans $ +# $Id$ # # ***** BEGIN GPL LICENSE BLOCK ***** # diff --git a/source/blender/editors/space_sequencer/sequencer_buttons.c b/source/blender/editors/space_sequencer/sequencer_buttons.c index f127ab4b0cf..cc4f5cf5ce3 100644 --- a/source/blender/editors/space_sequencer/sequencer_buttons.c +++ b/source/blender/editors/space_sequencer/sequencer_buttons.c @@ -1,5 +1,5 @@ /** - * $Id: sequencer_buttons.c 20279 2009-05-19 17:13:33Z blendix $ + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * diff --git a/source/blender/editors/space_sound/Makefile b/source/blender/editors/space_sound/Makefile index 4d375282223..a072684d543 100644 --- a/source/blender/editors/space_sound/Makefile +++ b/source/blender/editors/space_sound/Makefile @@ -1,5 +1,5 @@ # -# $Id: Makefile 14 2002-10-13 15:57:19Z hans $ +# $Id$ # # ***** BEGIN GPL LICENSE BLOCK ***** # diff --git a/source/blender/editors/space_text/Makefile b/source/blender/editors/space_text/Makefile index 33e12dc1abb..50871017085 100644 --- a/source/blender/editors/space_text/Makefile +++ b/source/blender/editors/space_text/Makefile @@ -1,5 +1,5 @@ # -# $Id: Makefile 14 2002-10-13 15:57:19Z hans $ +# $Id$ # # ***** BEGIN GPL LICENSE BLOCK ***** # diff --git a/source/blender/editors/space_text/text_header.c b/source/blender/editors/space_text/text_header.c index 1b8149cb5a2..c761587198f 100644 --- a/source/blender/editors/space_text/text_header.c +++ b/source/blender/editors/space_text/text_header.c @@ -88,6 +88,7 @@ /* ************************ header area region *********************** */ #ifndef DISABLE_PYTHON +#if 0 static void do_text_template_scriptsmenu(bContext *C, void *arg, int event) { // XXX BPY_menu_do_python(PYMENU_SCRIPTTEMPLATE, event); @@ -154,6 +155,7 @@ static uiBlock *text_plugin_scriptsmenu(bContext *C, void *args_unused) return block; } #endif +#endif /************************** properties ******************************/ diff --git a/source/blender/editors/space_time/Makefile b/source/blender/editors/space_time/Makefile index 20877b48559..e0bf3943dd8 100644 --- a/source/blender/editors/space_time/Makefile +++ b/source/blender/editors/space_time/Makefile @@ -1,5 +1,5 @@ # -# $Id: Makefile 14 2002-10-13 15:57:19Z hans $ +# $Id$ # # ***** BEGIN GPL LICENSE BLOCK ***** # diff --git a/source/blender/editors/space_time/time_header.c b/source/blender/editors/space_time/time_header.c index cf9c12f3dff..29f31671670 100644 --- a/source/blender/editors/space_time/time_header.c +++ b/source/blender/editors/space_time/time_header.c @@ -567,12 +567,12 @@ void time_header_buttons(const bContext *C, ARegion *ar) uiBlockBeginAlign(block); uiDefIconButBitS(block, TOG, AUTOKEY_ON, B_REDRAWALL, ICON_REC, - xco, yco, XIC, YIC, &(scene->autokey_mode), 0, 0, 0, 0, "Automatic keyframe insertion for Objects and Bones"); + xco, yco, XIC, YIC, &(scene->toolsettings->autokey_mode), 0, 0, 0, 0, "Automatic keyframe insertion for Objects and Bones"); xco+= XIC; if (IS_AUTOKEY_ON(scene)) { uiDefButS(block, MENU, B_REDRAWALL, "Auto-Keying Mode %t|Add/Replace Keys%x3|Replace Keys %x5", - xco, yco, (int)5.5*XIC, YIC, &(scene->autokey_mode), 0, 1, 0, 0, + xco, yco, (int)5.5*XIC, YIC, &(scene->toolsettings->autokey_mode), 0, 1, 0, 0, "Mode of automatic keyframe insertion for Objects and Bones"); xco+= (6*XIC); } diff --git a/source/blender/editors/space_view3d/Makefile b/source/blender/editors/space_view3d/Makefile index dd4eab89411..5e6f8a6c426 100644 --- a/source/blender/editors/space_view3d/Makefile +++ b/source/blender/editors/space_view3d/Makefile @@ -1,5 +1,5 @@ # -# $Id: Makefile 14 2002-10-13 15:57:19Z hans $ +# $Id$ # # ***** BEGIN GPL LICENSE BLOCK ***** # diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c index 42da6775d5f..05490e2fce1 100644 --- a/source/blender/editors/space_view3d/drawobject.c +++ b/source/blender/editors/space_view3d/drawobject.c @@ -117,7 +117,7 @@ (vd->drawtype==OB_SOLID && vd->flag2 & V3D_SOLID_TEX)) #define CHECK_OB_DRAWFACEDOT(sce, vd, dt) \ -( (sce->selectmode & SCE_SELECT_FACE) && \ +( (sce->toolsettings->selectmode & SCE_SELECT_FACE) && \ (vd->drawtype<=OB_SOLID) && \ (((vd->drawtype==OB_SOLID) && (dt>=OB_SOLID) && (vd->flag2 & V3D_SOLID_TEX) && (vd->flag & V3D_ZBUF_SELECT)) == 0) \ ) @@ -1493,14 +1493,14 @@ void nurbs_foreachScreenVert(ViewContext *vc, void (*func)(void *userData, Nurb static void draw_dm_face_normals__mapFunc(void *userData, int index, float *cent, float *no) { - Scene *scene= (Scene *)userData; + ToolSettings *ts= ((Scene *)userData)->toolsettings; EditFace *efa = EM_get_face_for_index(index); if (efa->h==0 && efa->fgonf!=EM_FGON) { glVertex3fv(cent); - glVertex3f( cent[0] + no[0]*scene->editbutsize, - cent[1] + no[1]*scene->editbutsize, - cent[2] + no[2]*scene->editbutsize); + glVertex3f( cent[0] + no[0]*ts->normalsize, + cent[1] + no[1]*ts->normalsize, + cent[2] + no[2]*ts->normalsize); } } static void draw_dm_face_normals(Scene *scene, DerivedMesh *dm) @@ -1529,19 +1529,20 @@ static void draw_dm_face_centers(DerivedMesh *dm, int sel) static void draw_dm_vert_normals__mapFunc(void *userData, int index, float *co, float *no_f, short *no_s) { Scene *scene= (Scene *)userData; + ToolSettings *ts= scene->toolsettings; EditVert *eve = EM_get_vert_for_index(index); if (eve->h==0) { glVertex3fv(co); if (no_f) { - glVertex3f( co[0] + no_f[0]*scene->editbutsize, - co[1] + no_f[1]*scene->editbutsize, - co[2] + no_f[2]*scene->editbutsize); + glVertex3f( co[0] + no_f[0]*ts->normalsize, + co[1] + no_f[1]*ts->normalsize, + co[2] + no_f[2]*ts->normalsize); } else { - glVertex3f( co[0] + no_s[0]*scene->editbutsize/32767.0f, - co[1] + no_s[1]*scene->editbutsize/32767.0f, - co[2] + no_s[2]*scene->editbutsize/32767.0f); + glVertex3f( co[0] + no_s[0]*ts->normalsize/32767.0f, + co[1] + no_s[1]*ts->normalsize/32767.0f, + co[2] + no_s[2]*ts->normalsize/32767.0f); } } } @@ -1762,7 +1763,9 @@ static void draw_dm_bweights__mapFunc(void *userData, int index, float *co, floa } static void draw_dm_bweights(Scene *scene, DerivedMesh *dm) { - if (scene->selectmode & SCE_SELECT_VERTEX) { + ToolSettings *ts= scene->toolsettings; + + if (ts->selectmode & SCE_SELECT_VERTEX) { glPointSize(UI_GetThemeValuef(TH_VERTEX_SIZE) + 2); bglBegin(GL_POINTS); dm->foreachMappedVert(dm, draw_dm_bweights__mapFunc, NULL); @@ -1786,6 +1789,7 @@ static void draw_dm_bweights(Scene *scene, DerivedMesh *dm) static void draw_em_fancy_verts(Scene *scene, View3D *v3d, Object *obedit, EditMesh *em, DerivedMesh *cageDM, EditVert *eve_act) { + ToolSettings *ts= scene->toolsettings; int sel; if(v3d->zbuf) glDepthMask(0); // disable write in zbuffer, zbuf select @@ -1817,7 +1821,7 @@ static void draw_em_fancy_verts(Scene *scene, View3D *v3d, Object *obedit, EditM col[3] = fcol[3] = 255; } - if(scene->selectmode & SCE_SELECT_VERTEX) { + if(ts->selectmode & SCE_SELECT_VERTEX) { glPointSize(size); glColor4ubv((GLubyte *)col); draw_dm_verts(cageDM, sel, eve_act); @@ -1842,6 +1846,7 @@ static void draw_em_fancy_verts(Scene *scene, View3D *v3d, Object *obedit, EditM static void draw_em_fancy_edges(Scene *scene, View3D *v3d, Mesh *me, DerivedMesh *cageDM, short sel_only, EditEdge *eed_act) { + ToolSettings *ts= scene->toolsettings; int pass; unsigned char wireCol[4], selCol[4], actCol[4]; @@ -1871,11 +1876,11 @@ static void draw_em_fancy_edges(Scene *scene, View3D *v3d, Mesh *me, DerivedMesh if (!sel_only) wireCol[3] = 255; } - if(scene->selectmode == SCE_SELECT_FACE) { + if(ts->selectmode == SCE_SELECT_FACE) { draw_dm_edges_sel(cageDM, wireCol, selCol, actCol, eed_act); } - else if( (me->drawflag & ME_DRAWEDGES) || (scene->selectmode & SCE_SELECT_EDGE) ) { - if(cageDM->drawMappedEdgesInterp && (scene->selectmode & SCE_SELECT_VERTEX)) { + else if( (me->drawflag & ME_DRAWEDGES) || (ts->selectmode & SCE_SELECT_EDGE) ) { + if(cageDM->drawMappedEdgesInterp && (ts->selectmode & SCE_SELECT_VERTEX)) { glShadeModel(GL_SMOOTH); draw_dm_edges_sel_interp(cageDM, wireCol, selCol); glShadeModel(GL_FLAT); @@ -3664,13 +3669,13 @@ static void draw_particle_edit(Scene *scene, View3D *v3d, RegionView3D *rv3d, Ob } /* draw edit vertices */ - if(scene->selectmode!=SCE_SELECT_PATH){ + if(pset->selectmode!=SCE_SELECT_PATH){ glDisableClientState(GL_NORMAL_ARRAY); glEnableClientState(GL_COLOR_ARRAY); glDisable(GL_LIGHTING); glPointSize(UI_GetThemeValuef(TH_VERTEX_SIZE)); - if(scene->selectmode==SCE_SELECT_POINT){ + if(pset->selectmode==SCE_SELECT_POINT){ float *cd=0,*cdata=0; cd=cdata=MEM_callocN(edit->totkeys*(timed?4:3)*sizeof(float), "particle edit color data"); @@ -3709,7 +3714,7 @@ static void draw_particle_edit(Scene *scene, View3D *v3d, RegionView3D *rv3d, Ob MEM_freeN(cdata); cd=cdata=0; } - else if(scene->selectmode == SCE_SELECT_END){ + else if(pset->selectmode == SCE_SELECT_END){ for(i=0, pa=psys->particles; i<totpart; i++, pa++){ if((pa->flag & PARS_HIDE)==0){ key = edit->keys[i] + pa->totkey - 1; @@ -3947,6 +3952,7 @@ static void draw_editnurb(Object *ob, Nurb *nurb, int sel) static void drawnurb(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base, Nurb *nurb, int dt) { + ToolSettings *ts= scene->toolsettings; Object *ob= base->object; Curve *cu = ob->data; Nurb *nu; @@ -3978,7 +3984,7 @@ static void drawnurb(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base, /* direction vectors for 3d curve paths when at its lowest, dont render normals */ - if(cu->flag & CU_3D && scene->editbutsize > 0.0015) { + if(cu->flag & CU_3D && ts->normalsize > 0.0015) { UI_ThemeColor(TH_WIRE); for (bl=cu->bev.first,nu=nurb; nu && bl; bl=bl->next,nu=nu->next) { BevPoint *bevp= (BevPoint *)(bl+1); @@ -3986,7 +3992,7 @@ static void drawnurb(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base, int skip= nu->resolu/16; while (nr-->0) { /* accounts for empty bevel lists */ - float fac= bevp->radius * scene->editbutsize; + float fac= bevp->radius * ts->normalsize; float ox,oy,oz; // Offset perpendicular to the curve float dx,dy,dz; // Delta along the curve @@ -5408,6 +5414,7 @@ static void bbs_mesh_solid(Scene *scene, View3D *v3d, Object *ob) void draw_object_backbufsel(Scene *scene, View3D *v3d, RegionView3D *rv3d, Object *ob) { + ToolSettings *ts= scene->toolsettings; wmMultMatrix(ob->obmat); @@ -5425,8 +5432,8 @@ void draw_object_backbufsel(Scene *scene, View3D *v3d, RegionView3D *rv3d, Objec EM_init_index_arrays(em, 1, 1, 1); - bbs_mesh_solid_EM(scene, v3d, ob, dm, scene->selectmode & SCE_SELECT_FACE); - if(scene->selectmode & SCE_SELECT_FACE) + bbs_mesh_solid_EM(scene, v3d, ob, dm, ts->selectmode & SCE_SELECT_FACE); + if(ts->selectmode & SCE_SELECT_FACE) em_solidoffs = 1+em->totface; else em_solidoffs= 1; @@ -5438,7 +5445,7 @@ void draw_object_backbufsel(Scene *scene, View3D *v3d, RegionView3D *rv3d, Objec em_wireoffs= em_solidoffs + em->totedge; // we draw verts if vert select mode or if in transform (for snap). - if(scene->selectmode & SCE_SELECT_VERTEX || G.moving & G_TRANSFORM_EDIT) { + if(ts->selectmode & SCE_SELECT_VERTEX || G.moving & G_TRANSFORM_EDIT) { bbs_mesh_verts(dm, em_wireoffs); em_vertoffs= em_wireoffs + em->totvert; } diff --git a/source/blender/editors/space_view3d/view3d_buttons.c b/source/blender/editors/space_view3d/view3d_buttons.c index b6e9e05b120..91565235591 100644 --- a/source/blender/editors/space_view3d/view3d_buttons.c +++ b/source/blender/editors/space_view3d/view3d_buttons.c @@ -1663,7 +1663,7 @@ static void view3d_panel_bonesketch_spaces(const bContext *C, Panel *pa) uiBlockEndAlign(block); - uiDefButBitS(block, TOG, SCE_SNAP_PEEL_OBJECT, B_NOP, "Peel Objects", 10, yco, 200, 20, &scene->snap_flag, 0, 0, 0, 0, "Peel whole objects as one"); + uiDefButBitS(block, TOG, SCE_SNAP_PEEL_OBJECT, B_NOP, "Peel Objects", 10, yco, 200, 20, &scene->toolsettings->snap_flag, 0, 0, 0, 0, "Peel whole objects as one"); } @@ -1710,7 +1710,7 @@ static void view3d_panel_operator_redo(const bContext *C, Panel *pa) } RNA_pointer_create(&wm->id, op->type->srna, op->properties, &ptr); - uiDefAutoButsRNA(C, pa->layout, &ptr); + uiDefAutoButsRNA(C, pa->layout, &ptr, 2); } void view3d_buttons_register(ARegionType *art) diff --git a/source/blender/editors/space_view3d/view3d_header.c b/source/blender/editors/space_view3d/view3d_header.c index de0680c6cc1..79ea90864f3 100644 --- a/source/blender/editors/space_view3d/view3d_header.c +++ b/source/blender/editors/space_view3d/view3d_header.c @@ -1812,6 +1812,7 @@ static void do_view3d_transformmenu(bContext *C, void *arg, int event) { #if 0 Scene *scene= CTX_data_scene(C); + ToolSettings *ts= CTX_data_tool_settings(C); switch(event) { case 1: @@ -1870,22 +1871,22 @@ static void do_view3d_transformmenu(bContext *C, void *arg, int event) Transform(); break; case 15: - scene->snap_flag &= ~SCE_SNAP; + ts->snap_flag &= ~SCE_SNAP; break; case 16: - scene->snap_flag |= SCE_SNAP; + ts->snap_flag |= SCE_SNAP; break; case 17: - scene->snap_target = SCE_SNAP_TARGET_CLOSEST; + ts->snap_target = SCE_SNAP_TARGET_CLOSEST; break; case 18: - scene->snap_target = SCE_SNAP_TARGET_CENTER; + ts->snap_target = SCE_SNAP_TARGET_CENTER; break; case 19: - scene->snap_target = SCE_SNAP_TARGET_MEDIAN; + ts->snap_target = SCE_SNAP_TARGET_MEDIAN; break; case 20: - scene->snap_target = SCE_SNAP_TARGET_ACTIVE; + ts->snap_target = SCE_SNAP_TARGET_ACTIVE; break; case 21: alignmenu(); @@ -1896,7 +1897,7 @@ static void do_view3d_transformmenu(bContext *C, void *arg, int event) static uiBlock *view3d_transformmenu(bContext *C, ARegion *ar, void *arg_unused) { - Scene *scene= CTX_data_scene(C); + ToolSettings *ts= CTX_data_tool_settings(C); Object *obedit = CTX_data_edit_object(C); uiBlock *block; short yco = 20, menuwidth = 120; @@ -1948,7 +1949,7 @@ static uiBlock *view3d_transformmenu(bContext *C, ARegion *ar, void *arg_unused) { uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, ""); - if (scene->snap_flag & SCE_SNAP) + if (ts->snap_flag & SCE_SNAP) { uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_DEHLT, "Grid", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 15, ""); uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_HLT, "Snap", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 16, ""); @@ -1961,7 +1962,7 @@ static uiBlock *view3d_transformmenu(bContext *C, ARegion *ar, void *arg_unused) uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, ""); - switch(scene->snap_target) + switch(ts->snap_target) { case SCE_SNAP_TARGET_CLOSEST: uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_HLT, "Snap Closest", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 17, ""); @@ -2650,34 +2651,34 @@ static uiBlock *view3d_edit_objectmenu(bContext *C, ARegion *ar, void *arg_unuse static void do_view3d_edit_propfalloffmenu(bContext *C, void *arg, int event) { - Scene *scene= CTX_data_scene(C); + ToolSettings *ts= CTX_data_tool_settings(C); - scene->prop_mode= event; + ts->prop_mode= event; } static uiBlock *view3d_edit_propfalloffmenu(bContext *C, ARegion *ar, void *arg_unused) { - Scene *scene= CTX_data_scene(C); + ToolSettings *ts= CTX_data_tool_settings(C); uiBlock *block; short yco = 20, menuwidth = 120; block= uiBeginBlock(C, ar, "view3d_edit_propfalloffmenu", UI_EMBOSSP); uiBlockSetButmFunc(block, do_view3d_edit_propfalloffmenu, NULL); - if (scene->prop_mode==PROP_SMOOTH) uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_HLT, "Smooth|Shift O", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, PROP_SMOOTH, ""); + if (ts->prop_mode==PROP_SMOOTH) uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_HLT, "Smooth|Shift O", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, PROP_SMOOTH, ""); else uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_DEHLT, "Smooth|Shift O", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, PROP_SMOOTH, ""); - if (scene->prop_mode==PROP_SPHERE) uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_HLT, "Sphere|Shift O", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, PROP_SPHERE, ""); + if (ts->prop_mode==PROP_SPHERE) uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_HLT, "Sphere|Shift O", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, PROP_SPHERE, ""); else uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_DEHLT, "Sphere|Shift O", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, PROP_SPHERE, ""); - if (scene->prop_mode==PROP_ROOT) uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_HLT, "Root|Shift O", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, PROP_ROOT, ""); + if (ts->prop_mode==PROP_ROOT) uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_HLT, "Root|Shift O", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, PROP_ROOT, ""); else uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_DEHLT, "Root|Shift O", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, PROP_ROOT, ""); - if (scene->prop_mode==PROP_SHARP) uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_HLT, "Sharp|Shift O", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, PROP_SHARP, ""); + if (ts->prop_mode==PROP_SHARP) uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_HLT, "Sharp|Shift O", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, PROP_SHARP, ""); else uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_DEHLT, "Sharp|Shift O", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, PROP_SHARP, ""); - if (scene->prop_mode==PROP_LIN) uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_HLT, "Linear|Shift O", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, PROP_LIN, ""); + if (ts->prop_mode==PROP_LIN) uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_HLT, "Linear|Shift O", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, PROP_LIN, ""); else uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_DEHLT, "Linear|Shift O", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, PROP_LIN, ""); - if (scene->prop_mode==PROP_RANDOM) uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_HLT, "Random|Shift O", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, PROP_RANDOM, ""); + if (ts->prop_mode==PROP_RANDOM) uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_HLT, "Random|Shift O", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, PROP_RANDOM, ""); else uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_DEHLT, "Random|Shift O", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, PROP_RANDOM, ""); - if (scene->prop_mode==PROP_CONST) uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_HLT, "Constant|Shift O", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, PROP_CONST, ""); + if (ts->prop_mode==PROP_CONST) uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_HLT, "Constant|Shift O", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, PROP_CONST, ""); else uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_DEHLT, "Constant|Shift O", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, PROP_CONST, ""); uiBlockSetDirection(block, UI_RIGHT); @@ -2698,7 +2699,7 @@ void do_view3d_edit_mesh_verticesmenu(bContext *C, void *arg, int event) make_parent(); break; case 1: /* remove doubles */ - count= removedoublesflag(1, 0, scene->toolsettings->doublimit); + count= removedoublesflag(1, 0, ts->doublimit); notice("Removed: %d", count); if (count) { /* only undo and redraw if an action is taken */ DAG_object_flush_update(scene, obedit, OB_RECALC_DATA); @@ -2768,18 +2769,18 @@ void do_view3d_edit_mesh_edgesmenu(bContext *C, void *arg, int event) switch(event) { case 0: /* subdivide smooth */ - esubdivideflag(1, 0.0, scene->toolsettings->editbutflag | B_SMOOTH,1,0); + esubdivideflag(1, 0.0, ts->editbutflag | B_SMOOTH,1,0); ED_undo_push(C, "Subdivide Smooth"); break; case 1: /*subdivide fractal */ randfac= 10; if(button(&randfac, 1, 100, "Rand fac:")==0) return; fac= -( (float)randfac )/100; - esubdivideflag(1, fac, scene->toolsettings->editbutflag,1,0); + esubdivideflag(1, fac, ts->editbutflag,1,0); ED_undo_push(C, "Subdivide Fractal"); break; case 2: /* subdivide */ - esubdivideflag(1, 0.0, scene->toolsettings->editbutflag,1,0); + esubdivideflag(1, 0.0, ts->editbutflag,1,0); ED_undo_push(C, "Subdivide"); break; case 3: /* knife subdivide */ @@ -3142,6 +3143,7 @@ static uiBlock *view3d_edit_mesh_scriptsmenu(bContext *C, ARegion *ar, void *arg static void do_view3d_edit_meshmenu(bContext *C, void *arg, int event) { #if 0 + ToolSettings *ts= CTX_data_tool_settings(C); Scene *scene= CTX_data_scene(C); ScrArea *sa= CTX_wm_area(C); View3D *v3d= sa->spacedata.first; @@ -3185,12 +3187,12 @@ static void do_view3d_edit_meshmenu(bContext *C, void *arg, int event) Transform(); break; case 12: /* proportional edit (toggle) */ - if(scene->proportional) scene->proportional= 0; - else scene->proportional= 1; + if(ts->proportional) ts->proportional= 0; + else ts->proportional= 1; break; case 13: /* automerge edit (toggle) */ - if(scene->automerge) scene->automerge= 0; - else scene->automerge= 1; + if(ts->automerge) ts->automerge= 0; + else ts->automerge= 1; break; case 15: uv_autocalc_tface(); @@ -3204,7 +3206,7 @@ static void do_view3d_edit_meshmenu(bContext *C, void *arg, int event) static uiBlock *view3d_edit_meshmenu(bContext *C, ARegion *ar, void *arg_unused) { - Scene *scene= CTX_data_scene(C); + ToolSettings *ts= CTX_data_tool_settings(C); Object *obedit = CTX_data_edit_object(C); uiBlock *block; short yco= 0, menuwidth=120; @@ -3250,7 +3252,7 @@ static uiBlock *view3d_edit_meshmenu(bContext *C, ARegion *ar, void *arg_unused) - if(scene->proportional) { + if(ts->proportional) { uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_HLT, "Proportional Editing|O", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 12, ""); } else { uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_DEHLT, "Proportional Editing|O", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 12, ""); @@ -3261,7 +3263,7 @@ static uiBlock *view3d_edit_meshmenu(bContext *C, ARegion *ar, void *arg_unused) /* PITA but we should let users know that automerge cant work with multires :/ */ uiDefIconTextBut(block, BUTM, 1, - scene->automerge ? ICON_CHECKBOX_HLT : ICON_CHECKBOX_DEHLT, + ts->automerge ? ICON_CHECKBOX_HLT : ICON_CHECKBOX_DEHLT, ((Mesh*)obedit->data)->mr ? "AutoMerge Editing (disabled by multires)" : "AutoMerge Editing", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 13, ""); @@ -3536,8 +3538,8 @@ static void do_view3d_edit_latticemenu(bContext *C, void *arg, int event) Transform(); break; case 5: /* proportional edit (toggle) */ - if(scene->proportional) scene->proportional= 0; - else scene->proportional= 1; + if(ts->proportional) ts->proportional= 0; + else ts->proportional= 1; break; case 7: /* delete keyframe */ common_deletekey(); @@ -3548,7 +3550,7 @@ static void do_view3d_edit_latticemenu(bContext *C, void *arg, int event) static uiBlock *view3d_edit_latticemenu(bContext *C, ARegion *ar, void *arg_unused) { - Scene *scene= CTX_data_scene(C); + ToolSettings *ts= CTX_data_tool_settings(C); uiBlock *block; short yco= 0, menuwidth=120; @@ -3574,7 +3576,7 @@ static uiBlock *view3d_edit_latticemenu(bContext *C, ARegion *ar, void *arg_unus uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, ""); - if(scene->proportional) { + if(ts->proportional) { uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_HLT, "Proportional Editing|O", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 5, ""); } else { uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_DEHLT, "Proportional Editing|O", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 5, ""); @@ -4695,7 +4697,7 @@ static uiBlock *view3d_faceselmenu(bContext *C, ARegion *ar, void *arg_unused) static void view3d_select_particlemenu(bContext *C, uiLayout *layout, void *arg_unused) { - Scene *scene= CTX_data_scene(C); + ToolSettings *ts= CTX_data_tool_settings(C); uiItemO(layout, NULL, 0, "VIEW3D_OT_select_border"); @@ -4704,7 +4706,7 @@ static void view3d_select_particlemenu(bContext *C, uiLayout *layout, void *arg_ uiItemO(layout, NULL, 0, "PARTICLE_OT_select_all_toggle"); uiItemO(layout, NULL, 0, "PARTICLE_OT_select_linked"); - if(scene->selectmode & SCE_SELECT_POINT) { + if(ts->particle.selectmode & SCE_SELECT_POINT) { uiItemO(layout, NULL, 0, "PARTICLE_OT_select_last"); // |W, 4 uiItemO(layout, NULL, 0, "PARTICLE_OT_select_first"); // |W, 3 } @@ -4724,7 +4726,7 @@ static void view3d_particle_showhidemenu(bContext *C, uiLayout *layout, void *ar static void view3d_particlemenu(bContext *C, uiLayout *layout, void *arg_unused) { - Scene *scene= CTX_data_scene(C); + ToolSettings *ts= CTX_data_tool_settings(C); // XXX uiDefIconTextBut(block, BUTM, 1, ICON_MENU_PANEL, "Particle Edit Properties|N", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 1, ""); // add_blockhandler(sa, VIEW3D_HANDLER_OBJECT, UI_PNL_UNSTOW); @@ -4739,7 +4741,7 @@ static void view3d_particlemenu(bContext *C, uiLayout *layout, void *arg_unused) uiItemO(layout, NULL, 0, "PARTICLE_OT_remove_doubles"); // |W, 5 uiItemO(layout, NULL, 0, "PARTICLE_OT_delete"); - if(scene->selectmode & SCE_SELECT_POINT) + if(ts->particle.selectmode & SCE_SELECT_POINT) uiItemO(layout, NULL, 0, "PARTICLE_OT_subdivide"); // |W, 2 uiItemO(layout, NULL, 0, "PARTICLE_OT_rekey"); // |W, 1 @@ -4873,6 +4875,7 @@ static void do_view3d_header_buttons(bContext *C, void *arg, int event) { wmWindow *win= CTX_wm_window(C); Scene *scene= CTX_data_scene(C); + ToolSettings *ts= CTX_data_tool_settings(C); ScrArea *sa= CTX_wm_area(C); View3D *v3d= sa->spacedata.first; Base *basact= CTX_data_active_base(C); @@ -5007,7 +5010,7 @@ static void do_view3d_header_buttons(bContext *C, void *arg, int event) if(em) { if(shift==0 || em->selectmode==0) em->selectmode= SCE_SELECT_VERTEX; - scene->selectmode= em->selectmode; + ts->selectmode= em->selectmode; EM_selectmode_set(em); WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit); ED_undo_push(C, "Selectmode Set: Vertex"); @@ -5021,7 +5024,7 @@ static void do_view3d_header_buttons(bContext *C, void *arg, int event) } em->selectmode = SCE_SELECT_EDGE; } - scene->selectmode= em->selectmode; + ts->selectmode= em->selectmode; EM_selectmode_set(em); WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit); ED_undo_push(C, "Selectmode Set: Edge"); @@ -5030,12 +5033,12 @@ static void do_view3d_header_buttons(bContext *C, void *arg, int event) case B_SEL_FACE: if(em) { if( shift==0 || em->selectmode==0){ - if( ((scene->selectmode ^ SCE_SELECT_FACE) == SCE_SELECT_VERTEX) || ((scene->selectmode ^ SCE_SELECT_FACE) == SCE_SELECT_EDGE)){ - if(ctrl) EM_convertsel(em, (scene->selectmode ^ SCE_SELECT_FACE),SCE_SELECT_FACE); + if( ((ts->selectmode ^ SCE_SELECT_FACE) == SCE_SELECT_VERTEX) || ((ts->selectmode ^ SCE_SELECT_FACE) == SCE_SELECT_EDGE)){ + if(ctrl) EM_convertsel(em, (ts->selectmode ^ SCE_SELECT_FACE),SCE_SELECT_FACE); } em->selectmode = SCE_SELECT_FACE; } - scene->selectmode= em->selectmode; + ts->selectmode= em->selectmode; EM_selectmode_set(em); WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit); ED_undo_push(C, "Selectmode Set: Face"); @@ -5043,15 +5046,15 @@ static void do_view3d_header_buttons(bContext *C, void *arg, int event) break; case B_SEL_PATH: - scene->selectmode= SCE_SELECT_PATH; + ts->particle.selectmode= SCE_SELECT_PATH; ED_undo_push(C, "Selectmode Set: Path"); break; case B_SEL_POINT: - scene->selectmode = SCE_SELECT_POINT; + ts->particle.selectmode = SCE_SELECT_POINT; ED_undo_push(C, "Selectmode Set: Point"); break; case B_SEL_END: - scene->selectmode = SCE_SELECT_END; + ts->particle.selectmode = SCE_SELECT_END; ED_undo_push(C, "Selectmode Set: End point"); break; @@ -5280,6 +5283,7 @@ void view3d_header_buttons(const bContext *C, ARegion *ar) ScrArea *sa= CTX_wm_area(C); View3D *v3d= sa->spacedata.first; Scene *scene= CTX_data_scene(C); + ToolSettings *ts= CTX_data_tool_settings(C); Object *ob= OBACT; Object *obedit = CTX_data_edit_object(C); uiBlock *block; @@ -5449,11 +5453,11 @@ void view3d_header_buttons(const bContext *C, ARegion *ar) if((obedit && (obedit->type == OB_MESH || obedit->type == OB_CURVE || obedit->type == OB_SURF || obedit->type == OB_LATTICE)) || G.f & G_PARTICLEEDIT) { uiBlockBeginAlign(block); - uiDefIconTextButS(block, ICONTEXTROW,B_REDR, ICON_PROP_OFF, "Proportional %t|Off %x0|On %x1|Connected %x2", xco,yco,XIC+10,YIC, &(scene->proportional), 0, 1.0, 0, 0, "Proportional Edit Falloff (Hotkeys: O, Alt O) "); + uiDefIconTextButS(block, ICONTEXTROW,B_REDR, ICON_PROP_OFF, "Proportional %t|Off %x0|On %x1|Connected %x2", xco,yco,XIC+10,YIC, &(ts->proportional), 0, 1.0, 0, 0, "Proportional Edit Falloff (Hotkeys: O, Alt O) "); xco+= XIC+10; - if(scene->proportional) { - uiDefIconTextButS(block, ICONTEXTROW,B_REDR, ICON_SMOOTHCURVE, propfalloff_pup(), xco,yco,XIC+10,YIC, &(scene->prop_mode), 0.0, 0.0, 0, 0, "Proportional Edit Falloff (Hotkey: Shift O) "); + if(ts->proportional) { + uiDefIconTextButS(block, ICONTEXTROW,B_REDR, ICON_SMOOTHCURVE, propfalloff_pup(), xco,yco,XIC+10,YIC, &(ts->prop_mode), 0.0, 0.0, 0, 0, "Proportional Edit Falloff (Hotkey: Shift O) "); xco+= XIC+10; } uiBlockEndAlign(block); @@ -5464,21 +5468,21 @@ void view3d_header_buttons(const bContext *C, ARegion *ar) if (BIF_snappingSupported(obedit)) { uiBlockBeginAlign(block); - if (scene->snap_flag & SCE_SNAP) { - uiDefIconButBitS(block, TOG, SCE_SNAP, B_REDR, ICON_SNAP_GEO,xco,yco,XIC,YIC, &scene->snap_flag, 0, 0, 0, 0, "Snap while Ctrl is held during transform (Shift Tab)"); + if (ts->snap_flag & SCE_SNAP) { + uiDefIconButBitS(block, TOG, SCE_SNAP, B_REDR, ICON_SNAP_GEO,xco,yco,XIC,YIC, &ts->snap_flag, 0, 0, 0, 0, "Snap while Ctrl is held during transform (Shift Tab)"); xco+= XIC; - uiDefIconButBitS(block, TOG, SCE_SNAP_ROTATE, B_REDR, ICON_SNAP_NORMAL,xco,yco,XIC,YIC, &scene->snap_flag, 0, 0, 0, 0, "Align rotation with the snapping target"); + uiDefIconButBitS(block, TOG, SCE_SNAP_ROTATE, B_REDR, ICON_SNAP_NORMAL,xco,yco,XIC,YIC, &ts->snap_flag, 0, 0, 0, 0, "Align rotation with the snapping target"); xco+= XIC; - if (scene->snap_mode == SCE_SNAP_MODE_VOLUME) { - uiDefIconButBitS(block, TOG, SCE_SNAP_PEEL_OBJECT, B_REDR, ICON_SNAP_PEEL_OBJECT,xco,yco,XIC,YIC, &scene->snap_flag, 0, 0, 0, 0, "Consider objects as whole when finding volume center"); + if (ts->snap_mode == SCE_SNAP_MODE_VOLUME) { + uiDefIconButBitS(block, TOG, SCE_SNAP_PEEL_OBJECT, B_REDR, ICON_SNAP_PEEL_OBJECT,xco,yco,XIC,YIC, &ts->snap_flag, 0, 0, 0, 0, "Consider objects as whole when finding volume center"); xco+= XIC; } - uiDefIconTextButS(block, ICONTEXTROW,B_REDR, ICON_SNAP_VERTEX, snapmode_pup(), xco,yco,XIC+10,YIC, &(scene->snap_mode), 0.0, 0.0, 0, 0, "Snapping mode"); + uiDefIconTextButS(block, ICONTEXTROW,B_REDR, ICON_SNAP_VERTEX, snapmode_pup(), xco,yco,XIC+10,YIC, &(ts->snap_mode), 0.0, 0.0, 0, 0, "Snapping mode"); xco+= XIC; - uiDefButS(block, MENU, B_NOP, "Snap Mode%t|Closest%x0|Center%x1|Median%x2|Active%x3",xco,yco,70,YIC, &scene->snap_target, 0, 0, 0, 0, "Snap Target Mode"); + uiDefButS(block, MENU, B_NOP, "Snap Mode%t|Closest%x0|Center%x1|Median%x2|Active%x3",xco,yco,70,YIC, &ts->snap_target, 0, 0, 0, 0, "Snap Target Mode"); xco+= XIC+70; } else { - uiDefIconButBitS(block, TOG, SCE_SNAP, B_REDR, ICON_SNAP_GEAR,xco,yco,XIC,YIC, &scene->snap_flag, 0, 0, 0, 0, "Snap while Ctrl is held during transform (Shift Tab)"); + uiDefIconButBitS(block, TOG, SCE_SNAP, B_REDR, ICON_SNAP_GEAR,xco,yco,XIC,YIC, &ts->snap_flag, 0, 0, 0, 0, "Snap while Ctrl is held during transform (Shift Tab)"); xco+= XIC; } @@ -5509,11 +5513,11 @@ void view3d_header_buttons(const bContext *C, ARegion *ar) } else if(G.f & G_PARTICLEEDIT) { uiBlockBeginAlign(block); - uiDefIconButBitS(block, TOG, SCE_SELECT_PATH, B_SEL_PATH, ICON_EDGESEL, xco,yco,XIC,YIC, &scene->selectmode, 1.0, 0.0, 0, 0, "Path edit mode"); + uiDefIconButBitI(block, TOG, SCE_SELECT_PATH, B_SEL_PATH, ICON_EDGESEL, xco,yco,XIC,YIC, &ts->particle.selectmode, 1.0, 0.0, 0, 0, "Path edit mode"); xco+= XIC; - uiDefIconButBitS(block, TOG, SCE_SELECT_POINT, B_SEL_POINT, ICON_VERTEXSEL, xco,yco,XIC,YIC, &scene->selectmode, 1.0, 0.0, 0, 0, "Point select mode"); + uiDefIconButBitI(block, TOG, SCE_SELECT_POINT, B_SEL_POINT, ICON_VERTEXSEL, xco,yco,XIC,YIC, &ts->particle.selectmode, 1.0, 0.0, 0, 0, "Point select mode"); xco+= XIC; - uiDefIconButBitS(block, TOG, SCE_SELECT_END, B_SEL_END, ICON_FACESEL, xco,yco,XIC,YIC, &scene->selectmode, 1.0, 0.0, 0, 0, "Tip select mode"); + uiDefIconButBitI(block, TOG, SCE_SELECT_END, B_SEL_END, ICON_FACESEL, xco,yco,XIC,YIC, &ts->particle.selectmode, 1.0, 0.0, 0, 0, "Tip select mode"); xco+= XIC; uiBlockEndAlign(block); diff --git a/source/blender/editors/space_view3d/view3d_select.c b/source/blender/editors/space_view3d/view3d_select.c index e0e8ac7c7a7..a153f795292 100644 --- a/source/blender/editors/space_view3d/view3d_select.c +++ b/source/blender/editors/space_view3d/view3d_select.c @@ -438,6 +438,7 @@ static void do_lasso_select_mesh__doSelectFace(void *userData, EditFace *efa, in static void do_lasso_select_mesh(ViewContext *vc, short mcords[][2], short moves, short select) { struct { ViewContext vc; rcti *rect; short (*mcords)[2], moves, select, pass, done; } data; + ToolSettings *ts= vc->scene->toolsettings; rcti rect; int bbsel; @@ -456,14 +457,14 @@ static void do_lasso_select_mesh(ViewContext *vc, short mcords[][2], short moves bbsel= EM_mask_init_backbuf_border(vc, mcords, moves, rect.xmin, rect.ymin, rect.xmax, rect.ymax); - if(vc->scene->selectmode & SCE_SELECT_VERTEX) { + if(ts->selectmode & SCE_SELECT_VERTEX) { if (bbsel) { EM_backbuf_checkAndSelectVerts(vc->em, select); } else { mesh_foreachScreenVert(vc, do_lasso_select_mesh__doSelectVert, &data, 1); } } - if(vc->scene->selectmode & SCE_SELECT_EDGE) { + if(ts->selectmode & SCE_SELECT_EDGE) { /* Does both bbsel and non-bbsel versions (need screen cos for both) */ data.pass = 0; @@ -475,7 +476,7 @@ static void do_lasso_select_mesh(ViewContext *vc, short mcords[][2], short moves } } - if(vc->scene->selectmode & SCE_SELECT_FACE) { + if(ts->selectmode & SCE_SELECT_FACE) { if (bbsel) { EM_backbuf_checkAndSelectFaces(vc->em, select); } else { @@ -1277,6 +1278,7 @@ static void do_mesh_box_select__doSelectFace(void *userData, EditFace *efa, int static void do_mesh_box_select(ViewContext *vc, rcti *rect, int select) { struct { ViewContext vc; rcti *rect; short select, pass, done; } data; + ToolSettings *ts= vc->scene->toolsettings; int bbsel; data.vc= *vc; @@ -1287,14 +1289,14 @@ static void do_mesh_box_select(ViewContext *vc, rcti *rect, int select) bbsel= EM_init_backbuf_border(vc, rect->xmin, rect->ymin, rect->xmax, rect->ymax); - if(vc->scene->selectmode & SCE_SELECT_VERTEX) { + if(ts->selectmode & SCE_SELECT_VERTEX) { if (bbsel) { EM_backbuf_checkAndSelectVerts(vc->em, select); } else { mesh_foreachScreenVert(vc, do_mesh_box_select__doSelectVert, &data, 1); } } - if(vc->scene->selectmode & SCE_SELECT_EDGE) { + if(ts->selectmode & SCE_SELECT_EDGE) { /* Does both bbsel and non-bbsel versions (need screen cos for both) */ data.pass = 0; @@ -1306,7 +1308,7 @@ static void do_mesh_box_select(ViewContext *vc, rcti *rect, int select) } } - if(vc->scene->selectmode & SCE_SELECT_FACE) { + if(ts->selectmode & SCE_SELECT_FACE) { if(bbsel) { EM_backbuf_checkAndSelectFaces(vc->em, select); } else { @@ -1639,6 +1641,7 @@ static void mesh_circle_doSelectFace(void *userData, EditFace *efa, int x, int y static void mesh_circle_select(ViewContext *vc, int selecting, short *mval, float rad) { + ToolSettings *ts= vc->scene->toolsettings; int bbsel; if(vc->obedit==NULL && (FACESEL_PAINT_TEST)) { @@ -1666,7 +1669,7 @@ static void mesh_circle_select(ViewContext *vc, int selecting, short *mval, floa data.mval[1] = mval[1]; data.radius = rad; - if(vc->scene->selectmode & SCE_SELECT_VERTEX) { + if(ts->selectmode & SCE_SELECT_VERTEX) { if(bbsel) { EM_backbuf_checkAndSelectVerts(vc->em, selecting==LEFTMOUSE); } else { @@ -1674,7 +1677,7 @@ static void mesh_circle_select(ViewContext *vc, int selecting, short *mval, floa } } - if(vc->scene->selectmode & SCE_SELECT_EDGE) { + if(ts->selectmode & SCE_SELECT_EDGE) { if (bbsel) { EM_backbuf_checkAndSelectEdges(vc->em, selecting==LEFTMOUSE); } else { @@ -1682,7 +1685,7 @@ static void mesh_circle_select(ViewContext *vc, int selecting, short *mval, floa } } - if(vc->scene->selectmode & SCE_SELECT_FACE) { + if(ts->selectmode & SCE_SELECT_FACE) { if(bbsel) { EM_backbuf_checkAndSelectFaces(vc->em, selecting==LEFTMOUSE); } else { diff --git a/source/blender/editors/space_view3d/view3d_toolbar.c b/source/blender/editors/space_view3d/view3d_toolbar.c index 1e55f2e4a9a..15254ba505e 100644 --- a/source/blender/editors/space_view3d/view3d_toolbar.c +++ b/source/blender/editors/space_view3d/view3d_toolbar.c @@ -120,8 +120,6 @@ static void redo_cb(bContext *C, void *arg_op, void *arg2) static void view3d_panel_operator_redo(const bContext *C, Panel *pa) { - /* XXX temp */ - extern void uiDefAutoButsRNA_single(const bContext *C, uiLayout *layout, PointerRNA *ptr); wmWindowManager *wm= CTX_wm_manager(C); wmOperator *op; PointerRNA ptr; @@ -147,7 +145,7 @@ static void view3d_panel_operator_redo(const bContext *C, Panel *pa) } RNA_pointer_create(&wm->id, op->type->srna, op->properties, &ptr); - uiDefAutoButsRNA_single(C, pa->layout, &ptr); + uiDefAutoButsRNA(C, pa->layout, &ptr, 1); } void view3d_toolbar_register(ARegionType *art) diff --git a/source/blender/editors/space_view3d/view3d_view.c b/source/blender/editors/space_view3d/view3d_view.c index 2db5f2c97fd..782d426641f 100644 --- a/source/blender/editors/space_view3d/view3d_view.c +++ b/source/blender/editors/space_view3d/view3d_view.c @@ -76,11 +76,12 @@ #include "UI_resources.h" #include "UI_view2d.h" +#include "GPU_draw.h" + #include "PIL_time.h" /* smoothview */ #include "view3d_intern.h" // own include - /* use this call when executing an operator, event system doesn't set for each event the opengl drawing context */ diff --git a/source/blender/editors/transform/Makefile b/source/blender/editors/transform/Makefile index bc3e08a2ae8..607038b413b 100644 --- a/source/blender/editors/transform/Makefile +++ b/source/blender/editors/transform/Makefile @@ -1,5 +1,5 @@ # -# $Id: Makefile 14 2002-10-13 15:57:19Z hans $ +# $Id$ # # ***** BEGIN GPL LICENSE BLOCK ***** # diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c index a417aa46773..ded6edbbb0e 100644 --- a/source/blender/editors/transform/transform.c +++ b/source/blender/editors/transform/transform.c @@ -1137,7 +1137,7 @@ void drawTransform(const struct bContext *C, struct ARegion *ar, void *arg) void saveTransform(bContext *C, TransInfo *t, wmOperator *op) { - Scene *sce = CTX_data_scene(C); + ToolSettings *ts = CTX_data_tool_settings(C); int constraint_axis[3] = {0, 0, 0}; int proportional = 0; @@ -1198,8 +1198,8 @@ void saveTransform(bContext *C, TransInfo *t, wmOperator *op) // XXX If modal, save settings back in scene if (t->flag & T_MODAL) { - sce->prop_mode = t->prop_mode; - sce->proportional = proportional; + ts->prop_mode = t->prop_mode; + ts->proportional = proportional; if(t->spacetype == SPACE_VIEW3D) { @@ -2362,7 +2362,7 @@ static void ElementResize(TransInfo *t, TransData *td, float mat[3][3]) { } else if (t->flag & T_EDIT) { - if(t->around==V3D_LOCAL && (t->scene->selectmode & SCE_SELECT_FACE)) { + if(t->around==V3D_LOCAL && (t->settings->selectmode & SCE_SELECT_FACE)) { VECCOPY(center, td->center); } else { @@ -2663,7 +2663,7 @@ static void ElementRotation(TransInfo *t, TransData *td, float mat[3][3], short } else { /* !TODO! Make this if not rely on G */ - if(around==V3D_LOCAL && (t->scene->selectmode & SCE_SELECT_FACE)) { + if(around==V3D_LOCAL && (t->settings->selectmode & SCE_SELECT_FACE)) { center = td->center; } } @@ -3129,7 +3129,7 @@ static void headerTranslation(TransInfo *t, float vec[3], char *str) { sprintf(distvec, "%.4f", dist); if(t->flag & T_AUTOIK) { - short chainlen= t->scene->toolsettings->autoik_chainlen; + short chainlen= t->settings->autoik_chainlen; if(chainlen) sprintf(autoik, "AutoIK-Len: %d", chainlen); @@ -4254,7 +4254,7 @@ int Align(TransInfo *t, short mval[2]) VECCOPY(t->center, td->center); } else { - if(t->scene->selectmode & SCE_SELECT_FACE) { + if(t->settings->selectmode & SCE_SELECT_FACE) { VECCOPY(t->center, td->center); } } diff --git a/source/blender/editors/transform/transform.h b/source/blender/editors/transform/transform.h index c0a57a85033..1b35701a753 100644 --- a/source/blender/editors/transform/transform.h +++ b/source/blender/editors/transform/transform.h @@ -264,6 +264,7 @@ typedef struct TransInfo { struct ScrArea *sa; struct ARegion *ar; struct Scene *scene; + struct ToolSettings *settings; struct wmTimer *animtimer; short mval[2]; /* current mouse position */ struct Object *obedit; diff --git a/source/blender/editors/transform/transform_conversions.c b/source/blender/editors/transform/transform_conversions.c index 1f75384880e..08ce1b1d554 100644 --- a/source/blender/editors/transform/transform_conversions.c +++ b/source/blender/editors/transform/transform_conversions.c @@ -778,7 +778,7 @@ static void pchan_autoik_adjust (bPoseChannel *pchan, short chainlen) /* change the chain-length of auto-ik */ void transform_autoik_update (TransInfo *t, short mode) { - short *chainlen= &t->scene->toolsettings->autoik_chainlen; + short *chainlen= &t->settings->autoik_chainlen; bPoseChannel *pchan; /* mode determines what change to apply to chainlen */ @@ -1632,7 +1632,7 @@ static void createTransParticleVerts(bContext *C, TransInfo *t) int count = 0, hasselected = 0; int propmode = t->flag & T_PROP_EDIT; - if(psys==NULL || t->scene->selectmode==SCE_SELECT_PATH) return; + if(psys==NULL || t->settings->particle.selectmode==SCE_SELECT_PATH) return; psmd = psys_get_modifier(ob,psys); @@ -2102,7 +2102,7 @@ void createTransBMeshVerts(TransInfo *t, BME_Mesh *bm, BME_TransData_Head *td) { static void createTransEditVerts(bContext *C, TransInfo *t) { - Scene *scene = CTX_data_scene(C); + ToolSettings *ts = CTX_data_tool_settings(C); TransData *tob = NULL; EditMesh *em = ((Mesh *)t->obedit->data)->edit_mesh; EditVert *eve; @@ -2120,7 +2120,7 @@ static void createTransEditVerts(bContext *C, TransInfo *t) } // transform now requires awareness for select mode, so we tag the f1 flags in verts - if(scene->selectmode & SCE_SELECT_VERTEX) { + if(ts->selectmode & SCE_SELECT_VERTEX) { for(eve= em->verts.first; eve; eve= eve->next) { if(eve->h==0 && (eve->f & SELECT)) eve->f1= SELECT; @@ -2128,7 +2128,7 @@ static void createTransEditVerts(bContext *C, TransInfo *t) eve->f1= 0; } } - else if(scene->selectmode & SCE_SELECT_EDGE) { + else if(ts->selectmode & SCE_SELECT_EDGE) { EditEdge *eed; for(eve= em->verts.first; eve; eve= eve->next) eve->f1= 0; for(eed= em->edges.first; eed; eed= eed->next) { diff --git a/source/blender/editors/transform/transform_generics.c b/source/blender/editors/transform/transform_generics.c index a60135107bc..db7c6d6ee99 100644 --- a/source/blender/editors/transform/transform_generics.c +++ b/source/blender/editors/transform/transform_generics.c @@ -622,6 +622,7 @@ void resetTransRestrictions(TransInfo *t) int initTransInfo (bContext *C, TransInfo *t, wmOperator *op, wmEvent *event) { Scene *sce = CTX_data_scene(C); + ToolSettings *ts = CTX_data_tool_settings(C); ARegion *ar = CTX_wm_region(C); ScrArea *sa = CTX_wm_area(C); Object *obedit = CTX_data_edit_object(C); @@ -636,6 +637,7 @@ int initTransInfo (bContext *C, TransInfo *t, wmOperator *op, wmEvent *event) t->sa = sa; t->ar = ar; t->obedit = obedit; + t->settings = ts; t->data = NULL; t->ext = NULL; @@ -709,9 +711,10 @@ int initTransInfo (bContext *C, TransInfo *t, wmOperator *op, wmEvent *event) } else if(t->spacetype==SPACE_IMAGE || t->spacetype==SPACE_NODE) { + SpaceImage *sima = sa->spacedata.first; // XXX for now, get View2D from the active region t->view = &ar->v2d; - t->around = ar->v2d.around; + t->around = sima->around; } else { @@ -731,7 +734,7 @@ int initTransInfo (bContext *C, TransInfo *t, wmOperator *op, wmEvent *event) // Need stuff to take it from edit mesh or whatnot here else { - if (t->obedit && t->obedit->type == OB_MESH && sce->toolsettings->editbutflag & B_MESH_X_MIRROR) + if (t->obedit && t->obedit->type == OB_MESH && ts->editbutflag & B_MESH_X_MIRROR) { t->flag |= T_MIRROR; } @@ -751,10 +754,10 @@ int initTransInfo (bContext *C, TransInfo *t, wmOperator *op, wmEvent *event) } else { - if ((t->options & CTX_NO_PET) == 0 && (sce->proportional)) { + if ((t->options & CTX_NO_PET) == 0 && (ts->proportional)) { t->flag |= T_PROP_EDIT; - if(sce->proportional == 2) + if(ts->proportional == 2) t->flag |= T_PROP_CONNECTED; // yes i know, has to become define } } @@ -765,7 +768,7 @@ int initTransInfo (bContext *C, TransInfo *t, wmOperator *op, wmEvent *event) } else { - t->prop_size = sce->toolsettings->proportional_size; + t->prop_size = ts->proportional_size; } if (op && RNA_struct_find_property(op->ptr, "proportional_editing_falloff") && RNA_property_is_set(op->ptr, "proportional_editing_falloff")) @@ -774,7 +777,7 @@ int initTransInfo (bContext *C, TransInfo *t, wmOperator *op, wmEvent *event) } else { - t->prop_mode = sce->prop_mode; + t->prop_mode = ts->prop_mode; } /* TRANSFORM_FIX_ME rna restrictions */ diff --git a/source/blender/editors/transform/transform_input.c b/source/blender/editors/transform/transform_input.c index 76b3f58f75c..631eb1eb134 100644 --- a/source/blender/editors/transform/transform_input.c +++ b/source/blender/editors/transform/transform_input.c @@ -1,5 +1,5 @@ /** - * $Id: transform_input.c 18142 2008-12-29 07:19:16Z aligorith $ + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * diff --git a/source/blender/editors/transform/transform_ops.c b/source/blender/editors/transform/transform_ops.c index de731ad7d95..28606932c64 100644 --- a/source/blender/editors/transform/transform_ops.c +++ b/source/blender/editors/transform/transform_ops.c @@ -1,5 +1,5 @@ /** - * $Id: transform_ops.c 17542 2008-11-23 15:27:53Z theeth $ + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** * diff --git a/source/blender/editors/transform/transform_snap.c b/source/blender/editors/transform/transform_snap.c index 72901110388..0b9a176dbdf 100644 --- a/source/blender/editors/transform/transform_snap.c +++ b/source/blender/editors/transform/transform_snap.c @@ -210,7 +210,7 @@ int handleSnapping(TransInfo *t, wmEvent *event) if (BIF_snappingSupported(t->obedit) && event->type == TABKEY && event->shift) { /* toggle snap and reinit */ - t->scene->snap_flag ^= SCE_SNAP; + t->settings->snap_flag ^= SCE_SNAP; initSnapping(t, NULL); status = 1; } @@ -282,10 +282,10 @@ int validSnappingNormal(TransInfo *t) void initSnapping(TransInfo *t, wmOperator *op) { - Scene *scene = t->scene; + ToolSettings *ts = t->settings; Object *obedit = t->obedit; int snapping = 0; - short snap_mode = t->scene->snap_target; + short snap_mode = t->settings->snap_target; resetSnapping(t); @@ -310,8 +310,8 @@ void initSnapping(TransInfo *t, wmOperator *op) } else { - snapping = ((scene->snap_flag & SCE_SNAP) == SCE_SNAP); - t->tsnap.align = ((t->scene->snap_flag & SCE_SNAP_ROTATE) == SCE_SNAP_ROTATE); + snapping = ((ts->snap_flag & SCE_SNAP) == SCE_SNAP); + t->tsnap.align = ((t->settings->snap_flag & SCE_SNAP_ROTATE) == SCE_SNAP_ROTATE); } if ((t->spacetype == SPACE_VIEW3D || t->spacetype == SPACE_IMAGE) && // Only 3D view or UV @@ -542,7 +542,7 @@ void CalcSnapGeometry(TransInfo *t, float *vec) int dist = SNAP_MIN_DISTANCE; // Use a user defined value here SnapMode mode; - if (t->scene->snap_mode == SCE_SNAP_MODE_VOLUME) + if (t->settings->snap_mode == SCE_SNAP_MODE_VOLUME) { ListBase depth_peels; DepthPeel *p1, *p2; @@ -575,7 +575,7 @@ void CalcSnapGeometry(TransInfo *t, float *vec) p1->flag = 1; /* if peeling objects, take the first and last from each object */ - if (t->scene->snap_flag & SCE_SNAP_PEEL_OBJECT) + if (t->settings->snap_flag & SCE_SNAP_PEEL_OBJECT) { DepthPeel *peel; for (peel = p1->next; peel; peel = peel->next) @@ -1346,6 +1346,7 @@ int snapDerivedMesh(short snap_mode, ARegion *ar, Object *ob, DerivedMesh *dm, E int snapObject(Scene *scene, ARegion *ar, Object *ob, int editobject, float obmat[][4], float ray_start[3], float ray_normal[3], short mval[2], float *loc, float *no, int *dist, float *depth) { + ToolSettings *ts= scene->toolsettings; int retval = 0; if (ob->type == OB_MESH) { @@ -1363,13 +1364,13 @@ int snapObject(Scene *scene, ARegion *ar, Object *ob, int editobject, float obma dm = mesh_get_derived_final(scene, ob, CD_MASK_BAREMESH); } - retval = snapDerivedMesh(scene->snap_mode, ar, ob, dm, em, obmat, ray_start, ray_normal, mval, loc, no, dist, depth); + retval = snapDerivedMesh(ts->snap_mode, ar, ob, dm, em, obmat, ray_start, ray_normal, mval, loc, no, dist, depth); dm->release(dm); } else if (ob->type == OB_ARMATURE) { - retval = snapArmature(scene->snap_mode, ar, ob, ob->data, obmat, ray_start, ray_normal, mval, loc, no, dist, depth); + retval = snapArmature(ts->snap_mode, ar, ob, ob->data, obmat, ray_start, ray_normal, mval, loc, no, dist, depth); } return retval; diff --git a/source/blender/editors/util/Makefile b/source/blender/editors/util/Makefile index da701dc5d86..303079daeee 100644 --- a/source/blender/editors/util/Makefile +++ b/source/blender/editors/util/Makefile @@ -1,5 +1,5 @@ # -# $Id: Makefile 14 2002-10-13 15:57:19Z hans $ +# $Id$ # # ***** BEGIN GPL LICENSE BLOCK ***** # diff --git a/source/blender/editors/uvedit/Makefile b/source/blender/editors/uvedit/Makefile index b8a8f0bc8af..d589bbec3bc 100644 --- a/source/blender/editors/uvedit/Makefile +++ b/source/blender/editors/uvedit/Makefile @@ -1,5 +1,5 @@ # -# $Id: Makefile 14 2002-10-13 15:57:19Z hans $ +# $Id$ # # ***** BEGIN GPL LICENSE BLOCK ***** # diff --git a/source/blender/editors/uvedit/uvedit_draw.c b/source/blender/editors/uvedit/uvedit_draw.c index aded5a4cff9..b811906f5e5 100644 --- a/source/blender/editors/uvedit/uvedit_draw.c +++ b/source/blender/editors/uvedit/uvedit_draw.c @@ -102,17 +102,19 @@ static void drawcursor_sima(SpaceImage *sima, ARegion *ar) static int draw_uvs_face_check(Scene *scene) { + ToolSettings *ts= scene->toolsettings; + /* checks if we are selecting only faces */ - if(scene->toolsettings->uv_flag & UV_SYNC_SELECTION) { - if(scene->selectmode == SCE_SELECT_FACE) + if(ts->uv_flag & UV_SYNC_SELECTION) { + if(ts->selectmode == SCE_SELECT_FACE) return 2; - else if(scene->selectmode & SCE_SELECT_FACE) + else if(ts->selectmode & SCE_SELECT_FACE) return 1; else return 0; } else - return (scene->toolsettings->uv_selectmode == UV_SELECT_FACE); + return (ts->uv_selectmode == UV_SELECT_FACE); } static void draw_uvs_shadow(SpaceImage *sima, Object *obedit) @@ -418,7 +420,7 @@ static void draw_uvs_other(SpaceImage *sima, Scene *scene, Object *obedit, MTFac /* draws uv's in the image space */ static void draw_uvs(SpaceImage *sima, Scene *scene, Object *obedit) { - ToolSettings *settings; + ToolSettings *ts; Mesh *me= obedit->data; EditMesh *em; EditFace *efa, *efa_act; @@ -432,13 +434,13 @@ static void draw_uvs(SpaceImage *sima, Scene *scene, Object *obedit) em= BKE_mesh_get_editmesh(me); activetf= EM_get_active_mtface(em, &efa_act, NULL, 0); /* will be set to NULL if hidden */ - settings= scene->toolsettings; + ts= scene->toolsettings; drawfaces= draw_uvs_face_check(scene); - if(settings->uv_flag & UV_SYNC_SELECTION) - interpedges= (scene->selectmode & SCE_SELECT_VERTEX); + if(ts->uv_flag & UV_SYNC_SELECTION) + interpedges= (ts->selectmode & SCE_SELECT_VERTEX); else - interpedges= (settings->uv_selectmode == UV_SELECT_VERTEX); + interpedges= (ts->uv_selectmode == UV_SELECT_VERTEX); /* draw other uvs */ if(sima->flag & SI_DRAW_OTHER) @@ -454,7 +456,7 @@ static void draw_uvs(SpaceImage *sima, Scene *scene, Object *obedit) /* when sync selection is enabled, all faces are drawn (except for hidden) * so if cage is the same as the final, theres no point in drawing this */ - if(!((settings->uv_flag & UV_SYNC_SELECTION) && (cagedm == finaldm))) + if(!((ts->uv_flag & UV_SYNC_SELECTION) && (cagedm == finaldm))) draw_uvs_dm_shadow(finaldm); /* release derivedmesh again */ diff --git a/source/blender/editors/uvedit/uvedit_ops.c b/source/blender/editors/uvedit/uvedit_ops.c index 7dca4d34c48..7582145c63b 100644 --- a/source/blender/editors/uvedit/uvedit_ops.c +++ b/source/blender/editors/uvedit/uvedit_ops.c @@ -191,7 +191,9 @@ static void uvedit_pixel_to_float(SpaceImage *sima, float *dist, float pixeldist int uvedit_face_visible_nolocal(Scene *scene, EditFace *efa) { - if(scene->toolsettings->uv_flag & UV_SYNC_SELECTION) + ToolSettings *ts= scene->toolsettings; + + if(ts->uv_flag & UV_SYNC_SELECTION) return (efa->h==0); else return (efa->h==0 && (efa->f & SELECT)); @@ -199,7 +201,9 @@ int uvedit_face_visible_nolocal(Scene *scene, EditFace *efa) int uvedit_face_visible(Scene *scene, Image *ima, EditFace *efa, MTFace *tf) { - if(scene->toolsettings->uv_flag & UV_SHOW_SAME_IMAGE) + ToolSettings *ts= scene->toolsettings; + + if(ts->uv_flag & UV_SHOW_SAME_IMAGE) return (tf->tpage==ima)? uvedit_face_visible_nolocal(scene, efa): 0; else return uvedit_face_visible_nolocal(scene, efa); @@ -207,7 +211,9 @@ int uvedit_face_visible(Scene *scene, Image *ima, EditFace *efa, MTFace *tf) int uvedit_face_selected(Scene *scene, EditFace *efa, MTFace *tf) { - if(scene->toolsettings->uv_flag & UV_SYNC_SELECTION) + ToolSettings *ts= scene->toolsettings; + + if(ts->uv_flag & UV_SYNC_SELECTION) return (efa->f & SELECT); else return (!(~tf->flag & (TF_SEL1|TF_SEL2|TF_SEL3)) &&(!efa->v4 || tf->flag & TF_SEL4)); @@ -215,7 +221,9 @@ int uvedit_face_selected(Scene *scene, EditFace *efa, MTFace *tf) void uvedit_face_select(Scene *scene, EditFace *efa, MTFace *tf) { - if(scene->toolsettings->uv_flag & UV_SYNC_SELECTION) + ToolSettings *ts= scene->toolsettings; + + if(ts->uv_flag & UV_SYNC_SELECTION) EM_select_face(efa, 1); else tf->flag |= (TF_SEL1|TF_SEL2|TF_SEL3|TF_SEL4); @@ -223,7 +231,9 @@ void uvedit_face_select(Scene *scene, EditFace *efa, MTFace *tf) void uvedit_face_deselect(Scene *scene, EditFace *efa, MTFace *tf) { - if(scene->toolsettings->uv_flag & UV_SYNC_SELECTION) + ToolSettings *ts= scene->toolsettings; + + if(ts->uv_flag & UV_SYNC_SELECTION) EM_select_face(efa, 0); else tf->flag &= ~(TF_SEL1|TF_SEL2|TF_SEL3|TF_SEL4); @@ -231,12 +241,13 @@ void uvedit_face_deselect(Scene *scene, EditFace *efa, MTFace *tf) int uvedit_edge_selected(Scene *scene, EditFace *efa, MTFace *tf, int i) { + ToolSettings *ts= scene->toolsettings; int nvert= (efa->v4)? 4: 3; - if(scene->toolsettings->uv_flag & UV_SYNC_SELECTION) { - if(scene->selectmode == SCE_SELECT_FACE) + if(ts->uv_flag & UV_SYNC_SELECTION) { + if(ts->selectmode == SCE_SELECT_FACE) return (efa->f & SELECT); - else if(scene->selectmode == SCE_SELECT_EDGE) + else if(ts->selectmode == SCE_SELECT_EDGE) return (*(&efa->e1 + i))->f & SELECT; else return (((efa->v1 + i)->f & SELECT) && ((efa->v1 + (i+1)%nvert)->f & SELECT)); @@ -247,12 +258,13 @@ int uvedit_edge_selected(Scene *scene, EditFace *efa, MTFace *tf, int i) void uvedit_edge_select(Scene *scene, EditFace *efa, MTFace *tf, int i) { + ToolSettings *ts= scene->toolsettings; int nvert= (efa->v4)? 4: 3; - if(scene->toolsettings->uv_flag & UV_SYNC_SELECTION) { - if(scene->selectmode == SCE_SELECT_FACE) + if(ts->uv_flag & UV_SYNC_SELECTION) { + if(ts->selectmode == SCE_SELECT_FACE) EM_select_face(efa, 1); - else if(scene->selectmode == SCE_SELECT_EDGE) + else if(ts->selectmode == SCE_SELECT_EDGE) EM_select_edge((*(&efa->e1 + i)), 1); else { (efa->v1 + i)->f |= SELECT; @@ -265,12 +277,13 @@ void uvedit_edge_select(Scene *scene, EditFace *efa, MTFace *tf, int i) void uvedit_edge_deselect(Scene *scene, EditFace *efa, MTFace *tf, int i) { + ToolSettings *ts= scene->toolsettings; int nvert= (efa->v4)? 4: 3; - if(scene->toolsettings->uv_flag & UV_SYNC_SELECTION) { - if(scene->selectmode == SCE_SELECT_FACE) + if(ts->uv_flag & UV_SYNC_SELECTION) { + if(ts->selectmode == SCE_SELECT_FACE) EM_select_face(efa, 0); - else if(scene->selectmode == SCE_SELECT_EDGE) + else if(ts->selectmode == SCE_SELECT_EDGE) EM_select_edge((*(&efa->e1 + i)), 0); else { (efa->v1 + i)->f &= ~SELECT; @@ -283,8 +296,10 @@ void uvedit_edge_deselect(Scene *scene, EditFace *efa, MTFace *tf, int i) int uvedit_uv_selected(Scene *scene, EditFace *efa, MTFace *tf, int i) { - if(scene->toolsettings->uv_flag & UV_SYNC_SELECTION) { - if(scene->selectmode == SCE_SELECT_FACE) + ToolSettings *ts= scene->toolsettings; + + if(ts->uv_flag & UV_SYNC_SELECTION) { + if(ts->selectmode == SCE_SELECT_FACE) return (efa->f & SELECT); else return (*(&efa->v1 + i))->f & SELECT; @@ -295,8 +310,10 @@ int uvedit_uv_selected(Scene *scene, EditFace *efa, MTFace *tf, int i) void uvedit_uv_select(Scene *scene, EditFace *efa, MTFace *tf, int i) { - if(scene->toolsettings->uv_flag & UV_SYNC_SELECTION) { - if(scene->selectmode == SCE_SELECT_FACE) + ToolSettings *ts= scene->toolsettings; + + if(ts->uv_flag & UV_SYNC_SELECTION) { + if(ts->selectmode == SCE_SELECT_FACE) EM_select_face(efa, 1); else (*(&efa->v1 + i))->f |= SELECT; @@ -307,8 +324,10 @@ void uvedit_uv_select(Scene *scene, EditFace *efa, MTFace *tf, int i) void uvedit_uv_deselect(Scene *scene, EditFace *efa, MTFace *tf, int i) { - if(scene->toolsettings->uv_flag & UV_SYNC_SELECTION) { - if(scene->selectmode == SCE_SELECT_FACE) + ToolSettings *ts= scene->toolsettings; + + if(ts->uv_flag & UV_SYNC_SELECTION) { + if(ts->selectmode == SCE_SELECT_FACE) EM_select_face(efa, 0); else (*(&efa->v1 + i))->f &= ~SELECT; @@ -1289,6 +1308,7 @@ void UV_OT_stitch(wmOperatorType *ot) static int select_inverse_exec(bContext *C, wmOperator *op) { Scene *scene; + ToolSettings *ts; Object *obedit; EditMesh *em; EditFace *efa; @@ -1296,11 +1316,12 @@ static int select_inverse_exec(bContext *C, wmOperator *op) MTFace *tf; scene= CTX_data_scene(C); + ts= CTX_data_tool_settings(C); obedit= CTX_data_edit_object(C); em= BKE_mesh_get_editmesh((Mesh*)obedit->data); ima= CTX_data_edit_image(C); - if(scene->toolsettings->uv_flag & UV_SYNC_SELECTION) { + if(ts->uv_flag & UV_SYNC_SELECTION) { EM_select_swap(em); } else { @@ -1339,6 +1360,7 @@ void UV_OT_select_invert(wmOperatorType *ot) static int de_select_all_exec(bContext *C, wmOperator *op) { Scene *scene; + ToolSettings *ts; Object *obedit; EditMesh *em; EditFace *efa; @@ -1347,11 +1369,12 @@ static int de_select_all_exec(bContext *C, wmOperator *op) int sel; scene= CTX_data_scene(C); + ts= CTX_data_tool_settings(C); obedit= CTX_data_edit_object(C); em= BKE_mesh_get_editmesh((Mesh*)obedit->data); ima= CTX_data_edit_image(C); - if(scene->toolsettings->uv_flag & UV_SYNC_SELECTION) { + if(ts->uv_flag & UV_SYNC_SELECTION) { EM_toggle_select_all(em); } else { @@ -1431,6 +1454,7 @@ static int mouse_select(bContext *C, float co[2], int extend, int loop) { SpaceImage *sima= (SpaceImage*)CTX_wm_space_data(C); Scene *scene= CTX_data_scene(C); + ToolSettings *ts= CTX_data_tool_settings(C); Object *obedit= CTX_data_edit_object(C); Image *ima= CTX_data_edit_image(C); EditMesh *em= BKE_mesh_get_editmesh((Mesh*)obedit->data); @@ -1445,12 +1469,12 @@ static int mouse_select(bContext *C, float co[2], int extend, int loop) uvedit_pixel_to_float(sima, penalty, 5.0f); /* retrieve operation mode */ - if(scene->toolsettings->uv_flag & UV_SYNC_SELECTION) { + if(ts->uv_flag & UV_SYNC_SELECTION) { sync= 1; - if(scene->selectmode & SCE_SELECT_FACE) + if(ts->selectmode & SCE_SELECT_FACE) selectmode= UV_SELECT_FACE; - else if(scene->selectmode & SCE_SELECT_EDGE) + else if(ts->selectmode & SCE_SELECT_EDGE) selectmode= UV_SELECT_EDGE; else selectmode= UV_SELECT_VERTEX; @@ -1459,7 +1483,7 @@ static int mouse_select(bContext *C, float co[2], int extend, int loop) } else { sync= 0; - selectmode= scene->toolsettings->uv_selectmode; + selectmode= ts->uv_selectmode; sticky= sima->sticky; } @@ -1681,7 +1705,7 @@ static int mouse_select(bContext *C, float co[2], int extend, int loop) if(sync) { /* flush for mesh selection */ - if(scene->selectmode != SCE_SELECT_FACE) { + if(ts->selectmode != SCE_SELECT_FACE) { if(flush==1) EM_select_flush(em); else if(flush==-1) EM_deselect_flush(em); } @@ -1794,13 +1818,14 @@ static int select_linked_exec(bContext *C, wmOperator *op) { SpaceImage *sima= (SpaceImage*)CTX_wm_space_data(C); Scene *scene= CTX_data_scene(C); + ToolSettings *ts= CTX_data_tool_settings(C); Object *obedit= CTX_data_edit_object(C); Image *ima= CTX_data_edit_image(C); EditMesh *em= BKE_mesh_get_editmesh((Mesh*)obedit->data); float limit[2]; int extend; - if(scene->toolsettings->uv_flag & UV_SYNC_SELECTION) { + if(ts->uv_flag & UV_SYNC_SELECTION) { BKE_report(op->reports, RPT_ERROR, "Can't select linked when sync selection is enabled."); BKE_mesh_end_editmesh(obedit->data, em); return OPERATOR_CANCELLED; @@ -1838,13 +1863,14 @@ void UV_OT_select_linked(wmOperatorType *ot) static int unlink_selection_exec(bContext *C, wmOperator *op) { Scene *scene= CTX_data_scene(C); + ToolSettings *ts= CTX_data_tool_settings(C); Object *obedit= CTX_data_edit_object(C); Image *ima= CTX_data_edit_image(C); EditMesh *em= BKE_mesh_get_editmesh((Mesh*)obedit->data); EditFace *efa; MTFace *tf; - if(scene->toolsettings->uv_flag & UV_SYNC_SELECTION) { + if(ts->uv_flag & UV_SYNC_SELECTION) { BKE_report(op->reports, RPT_ERROR, "Can't unlink selection when sync selection is enabled."); BKE_mesh_end_editmesh(obedit->data, em); return OPERATOR_CANCELLED; @@ -1901,12 +1927,13 @@ static void uv_faces_do_sticky(bContext *C, SpaceImage *sima, Scene *scene, Obje * This only needs to be done when the Mesh is not used for * selection (so for sticky modes, vertex or location based). */ + ToolSettings *ts= CTX_data_tool_settings(C); EditMesh *em= BKE_mesh_get_editmesh((Mesh*)obedit->data); EditFace *efa; MTFace *tf; int nverts, i; - if((scene->toolsettings->uv_flag & UV_SYNC_SELECTION)==0 && sima->sticky == SI_STICKY_VERTEX) { + if((ts->uv_flag & UV_SYNC_SELECTION)==0 && sima->sticky == SI_STICKY_VERTEX) { /* Tag all verts as untouched, then touch the ones that have a face center * in the loop and select all MTFace UV's that use a touched vert. */ EditVert *eve; @@ -1937,7 +1964,7 @@ static void uv_faces_do_sticky(bContext *C, SpaceImage *sima, Scene *scene, Obje } } } - else if((scene->toolsettings->uv_flag & UV_SYNC_SELECTION)==0 && sima->sticky == SI_STICKY_LOC) { + else if((ts->uv_flag & UV_SYNC_SELECTION)==0 && sima->sticky == SI_STICKY_LOC) { EditFace *efa_vlist; MTFace *tf_vlist; UvMapVert *start_vlist=NULL, *vlist_iter; @@ -2008,7 +2035,7 @@ static void uv_faces_do_sticky(bContext *C, SpaceImage *sima, Scene *scene, Obje EM_free_uv_vert_map(vmap); } - else { /* SI_STICKY_DISABLE or scene->toolsettings->uv_flag & UV_SYNC_SELECTION */ + else { /* SI_STICKY_DISABLE or ts->uv_flag & UV_SYNC_SELECTION */ for(efa= em->faces.first; efa; efa= efa->next) { if(efa->tmp.l) { tf = CustomData_em_get(&em->fdata, efa->data, CD_MTFACE); @@ -2026,6 +2053,7 @@ static int border_select_exec(bContext *C, wmOperator *op) { SpaceImage *sima= (SpaceImage*)CTX_wm_space_data(C); Scene *scene= CTX_data_scene(C); + ToolSettings *ts= CTX_data_tool_settings(C); Object *obedit= CTX_data_edit_object(C); Image *ima= CTX_data_edit_image(C); ARegion *ar= CTX_wm_region(C); @@ -2049,10 +2077,10 @@ static int border_select_exec(bContext *C, wmOperator *op) select= (RNA_int_get(op->ptr, "event_type") == LEFTMOUSE); // XXX hardcoded pinned= RNA_boolean_get(op->ptr, "pinned"); - if(scene->toolsettings->uv_flag & UV_SYNC_SELECTION) - faces= (scene->selectmode == SCE_SELECT_FACE); + if(ts->uv_flag & UV_SYNC_SELECTION) + faces= (ts->selectmode == SCE_SELECT_FACE); else - faces= (scene->toolsettings->uv_selectmode == UV_SELECT_FACE); + faces= (ts->uv_selectmode == UV_SELECT_FACE); /* do actual selection */ if(faces && !pinned) { @@ -2084,7 +2112,7 @@ static int border_select_exec(bContext *C, wmOperator *op) for(efa= em->faces.first; efa; efa= efa->next) { tface= CustomData_em_get(&em->fdata, efa->data, CD_MTFACE); if(uvedit_face_visible(scene, ima, efa, tface)) { - if(!pinned || (scene->toolsettings->uv_flag & UV_SYNC_SELECTION) ) { + if(!pinned || (ts->uv_flag & UV_SYNC_SELECTION) ) { /* UV_SYNC_SELECTION - can't do pinned selection */ if(BLI_in_rctf(&rectf, tface->uv[0][0], tface->uv[0][1])) { if(select) uvedit_uv_select(scene, efa, tface, 0); @@ -2133,8 +2161,8 @@ static int border_select_exec(bContext *C, wmOperator *op) if(change) { /* make sure newly selected vert selection is updated*/ - if(scene->toolsettings->uv_flag & UV_SYNC_SELECTION) { - if(scene->selectmode != SCE_SELECT_FACE) { + if(ts->uv_flag & UV_SYNC_SELECTION) { + if(ts->selectmode != SCE_SELECT_FACE) { if(select) EM_select_flush(em); else EM_deselect_flush(em); } @@ -2668,14 +2696,14 @@ void UV_OT_select_pinned(wmOperatorType *ot) static int hide_exec(bContext *C, wmOperator *op) { SpaceImage *sima= (SpaceImage*)CTX_wm_space_data(C); - Scene *scene= CTX_data_scene(C); + ToolSettings *ts= CTX_data_tool_settings(C); Object *obedit= CTX_data_edit_object(C); EditMesh *em= BKE_mesh_get_editmesh((Mesh*)obedit->data); EditFace *efa; MTFace *tf; int swap= RNA_boolean_get(op->ptr, "unselected"); - if(scene->toolsettings->uv_flag & UV_SYNC_SELECTION) { + if(ts->uv_flag & UV_SYNC_SELECTION) { EM_hide_mesh(em, swap); WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit); @@ -2811,14 +2839,14 @@ void UV_OT_hide(wmOperatorType *ot) static int reveal_exec(bContext *C, wmOperator *op) { SpaceImage *sima= (SpaceImage*)CTX_wm_space_data(C); - Scene *scene= CTX_data_scene(C); + ToolSettings *ts= CTX_data_tool_settings(C); Object *obedit= CTX_data_edit_object(C); EditMesh *em= BKE_mesh_get_editmesh((Mesh*)obedit->data); EditFace *efa; MTFace *tf; /* call the mesh function if we are in mesh sync sel */ - if(scene->toolsettings->uv_flag & UV_SYNC_SELECTION) { + if(ts->uv_flag & UV_SYNC_SELECTION) { EM_reveal_mesh(em); WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit); |