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

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrecht Van Lommel <brechtvanlommel@pandora.be>2009-02-04 14:52:16 +0300
committerBrecht Van Lommel <brechtvanlommel@pandora.be>2009-02-04 14:52:16 +0300
commitdf7e7660325611847721768fb7d082e7d5f2736c (patch)
treea13434a5824a3f55c46f6d876275f864647c0f95 /source/blender/editors/mesh/editmesh_tools.c
parent0341e762b28f732dd2913ebec48405f7718a4617 (diff)
UI
* Changed uiPupMenuOperator usage to uiPupMenuBegin/End (simpler, no need to build a string). Also made transform orientation and subdiv type enums instead of ints for this. * Added an icon argument to many of the uiMenu calls, and added a uiMenuItemIntO. * Move auto rna button creation out of outliner code, now is uiDefAutoButR for individual buttons and uiDefAutoButsRNA for a whole block. * Implemented uiPupBlock(O). Pressing F6 gives a menu with the properties of the last operator to test. I tried to make a redo last operator out of this but couldn't get the context correct for the operator to repeat in. Further the popup block also has some issues getting closed while editing buttons. * Fix uiAfterFunc memory leak on Ctrl+Q quit. * Fix handling of RNA number button dragging and sliding for RNA buttons with range -inf/inf.
Diffstat (limited to 'source/blender/editors/mesh/editmesh_tools.c')
-rw-r--r--source/blender/editors/mesh/editmesh_tools.c41
1 files changed, 19 insertions, 22 deletions
diff --git a/source/blender/editors/mesh/editmesh_tools.c b/source/blender/editors/mesh/editmesh_tools.c
index 805081b6a6f..86a4577e269 100644
--- a/source/blender/editors/mesh/editmesh_tools.c
+++ b/source/blender/editors/mesh/editmesh_tools.c
@@ -6474,39 +6474,29 @@ void MESH_OT_subdivide_smooth(wmOperatorType *ot)
static int subdivs_invoke(bContext *C, wmOperator *op, wmEvent *event)
{
- int items;
- char *menu, *p;
-
- items = 4;
-
- menu= MEM_callocN(items * OP_MAX_TYPENAME, "string");
-
- p= menu + sprintf(menu, "%s %%t", "subdiv");
- p+= sprintf(p, "|%s %%x%d", "simple", 3);
- p+= sprintf(p, "|%s %%x%d", "multi", 2);
- p+= sprintf(p, "|%s %%x%d", "fractal", 1);
- p+= sprintf(p, "|%s %%x%d", "smooth", 0);
-
- uiPupMenuOperator(C, 20, op, "index", menu);
- MEM_freeN(menu);
+ uiMenuItem *head;
+
+ head= uiPupMenuBegin("Subdivision Type", 0);
+ uiMenuItemsEnumO(head, "MESH_OT_subdivs", "type");
+ uiPupMenuEnd(C, head);
- return OPERATOR_RUNNING_MODAL;
+ return OPERATOR_CANCELLED;
}
static int subdivs_exec(bContext *C, wmOperator *op)
{
- switch(RNA_int_get(op->ptr, "index"))
+ switch(RNA_int_get(op->ptr, "type"))
{
- case 3: // simple
+ case 0: // simple
subdivide_exec(C,op);
break;
- case 2: // multi
+ case 1: // multi
subdivide_multi_exec(C,op);
break;
- case 1: // fractal;
+ case 2: // fractal;
subdivide_multi_fractal_exec(C,op);
break;
- case 0: //smooth
+ case 3: //smooth
subdivide_smooth_exec(C,op);
break;
}
@@ -6516,6 +6506,13 @@ static int subdivs_exec(bContext *C, wmOperator *op)
void MESH_OT_subdivs(wmOperatorType *ot)
{
+ static EnumPropertyItem type_items[]= {
+ {0, "SIMPLE", "Simple", ""},
+ {1, "MULTI", "Multi", ""},
+ {2, "FRACTAL", "Fractal", ""},
+ {3, "SMOOTH", "Smooth", ""},
+ {0, NULL, NULL}};
+
/* identifiers */
ot->name= "subdivs";
ot->idname= "MESH_OT_subdivs";
@@ -6530,7 +6527,7 @@ void MESH_OT_subdivs(wmOperatorType *ot)
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
/*props */
- RNA_def_int(ot->srna, "index", 0, 0, INT_MAX, "Index", "", 0, 1000);
+ RNA_def_enum(ot->srna, "type", type_items, 0, "Type", "");
/* this is temp, the ops are different, but they are called from subdivs, so all the possible props should be here as well*/
RNA_def_int(ot->srna, "number_cuts", 4, 0, 100, "Number of Cuts", "", 0, INT_MAX);