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
path: root/source
diff options
context:
space:
mode:
authorShaul Kedem <shaul_kedem@yahoo.com>2009-01-19 21:36:54 +0300
committerShaul Kedem <shaul_kedem@yahoo.com>2009-01-19 21:36:54 +0300
commit33ab2636df06df6cce66cd75fce1417bd508a85b (patch)
tree2c77fd4e00d71b05d2c9f485559c01b3fa5b8d37 /source
parent1c590a4d06fa268003eff22a017895c190cffa69 (diff)
subdivides are now grouped in a menu - WKEY
Diffstat (limited to 'source')
-rw-r--r--source/blender/editors/mesh/editmesh_tools.c66
-rw-r--r--source/blender/editors/mesh/mesh_intern.h1
-rw-r--r--source/blender/editors/mesh/mesh_ops.c9
3 files changed, 73 insertions, 3 deletions
diff --git a/source/blender/editors/mesh/editmesh_tools.c b/source/blender/editors/mesh/editmesh_tools.c
index bb81c7605e5..e6020361961 100644
--- a/source/blender/editors/mesh/editmesh_tools.c
+++ b/source/blender/editors/mesh/editmesh_tools.c
@@ -6407,3 +6407,69 @@ void MESH_OT_subdivide_smooth(wmOperatorType *ot)
/* props */
RNA_def_float(ot->srna, "smoothness", 5.0f, 0.0f, 1000.0f, "Smoothness", "", 0.0f, FLT_MAX);
}
+
+static int subdivs_invoke(bContext *C, wmOperator *op, wmEvent *event)
+{
+ wmWindowManager *wm= CTX_wm_manager(C);
+ wmOperator *lastop;
+ 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);
+
+ return OPERATOR_RUNNING_MODAL;
+}
+
+static int subdivs_exec(bContext *C, wmOperator *op)
+{
+ switch(RNA_int_get(op->ptr, "index"))
+ {
+ case 3: // simple
+ subdivide_exec(C,op);
+ break;
+ case 2: // multi
+ subdivide_multi_exec(C,op);
+ break;
+ case 1: // fractal;
+ subdivide_multi_fractal_exec(C,op);
+ break;
+ case 0: //smooth
+ subdivide_smooth_exec(C,op);
+ break;
+ }
+
+ return OPERATOR_FINISHED;
+}
+
+void MESH_OT_subdivs(wmOperatorType *ot)
+{
+ /* identifiers */
+ ot->name= "subdivs";
+ ot->idname= "MESH_OT_subdivs";
+
+ /* api callbacks */
+ ot->invoke= subdivs_invoke;
+ ot->exec= subdivs_exec;
+
+ ot->poll= ED_operator_editmesh;
+
+ /*props */
+ RNA_def_int(ot->srna, "index", 0, 0, INT_MAX, "Index", "", 0, 1000);
+
+ /* 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);
+ RNA_def_float(ot->srna, "random_factor", 5.0, 0.0f, FLT_MAX, "Random Factor", "", 0.0f, 1000.0f);
+ RNA_def_float(ot->srna, "smoothness", 5.0f, 0.0f, 1000.0f, "Smoothness", "", 0.0f, FLT_MAX);
+
+} \ No newline at end of file
diff --git a/source/blender/editors/mesh/mesh_intern.h b/source/blender/editors/mesh/mesh_intern.h
index a8edd9153fa..8b169babdc3 100644
--- a/source/blender/editors/mesh/mesh_intern.h
+++ b/source/blender/editors/mesh/mesh_intern.h
@@ -210,6 +210,7 @@ int removedoublesflag(EditMesh *em, short flag, short automerge, float limit);
void esubdivideflag(Object *obedit, EditMesh *em, int flag, float rad, int beauty, int numcuts, int seltype);
int EdgeSlide(EditMesh *em, short immediate, float imperc);
+void MESH_OT_subdivs(struct wmOperatorType *ot);
void MESH_OT_subdivide(struct wmOperatorType *ot);
void MESH_OT_subdivide_multi(struct wmOperatorType *ot);
void MESH_OT_subdivide_multi_fractal(struct wmOperatorType *ot);
diff --git a/source/blender/editors/mesh/mesh_ops.c b/source/blender/editors/mesh/mesh_ops.c
index 997e1f55967..4e7ec737b96 100644
--- a/source/blender/editors/mesh/mesh_ops.c
+++ b/source/blender/editors/mesh/mesh_ops.c
@@ -117,6 +117,7 @@ void ED_operatortypes_mesh(void)
WM_operatortype_append(MESH_OT_subdivide_multi);
WM_operatortype_append(MESH_OT_subdivide_multi_fractal);
WM_operatortype_append(MESH_OT_subdivide_smooth);
+ WM_operatortype_append(MESH_OT_subdivs);
WM_operatortype_append(MESH_OT_select_linked_flat_faces);
WM_operatortype_append(MESH_OT_select_sharp_edges);
WM_operatortype_append(MESH_OT_add_primitive_plane);
@@ -161,10 +162,12 @@ void ED_keymap_mesh(wmWindowManager *wm)
RNA_int_set(WM_keymap_add_item(keymap, "MESH_OT_righthandfaces", NKEY, KM_PRESS, KM_CTRL|KM_SHIFT, 0)->ptr, "select", 2);
RNA_int_set(WM_keymap_add_item(keymap, "MESH_OT_righthandfaces", NKEY, KM_PRESS, KM_CTRL, 0)->ptr, "select", 1);
- WM_keymap_add_item(keymap, "MESH_OT_subdivide", WKEY, KM_PRESS, 0, 0);
- WM_keymap_add_item(keymap, "MESH_OT_subdivide_multi", WKEY, KM_PRESS, KM_CTRL|KM_SHIFT, 0);
+ WM_keymap_add_item(keymap, "MESH_OT_subdivs", WKEY, KM_PRESS, 0, 0); // this is the menu
+ /*WM_keymap_add_item(keymap, "MESH_OT_subdivide_multi", WKEY, KM_PRESS, KM_CTRL|KM_SHIFT, 0);
WM_keymap_add_item(keymap, "MESH_OT_subdivide_multi_fractal", WKEY, KM_PRESS, KM_ALT, 0);
- WM_keymap_add_item(keymap, "MESH_OT_subdivide_smooth", WKEY, KM_PRESS, KM_CTRL|KM_ALT, 0);
+ WM_keymap_add_item(keymap, "MESH_OT_subdivide_smooth", WKEY, KM_PRESS, KM_CTRL|KM_ALT, 0);*/
+
+
/* add */
WM_keymap_add_item(keymap, "MESH_OT_add_duplicate", DKEY, KM_PRESS, KM_SHIFT, 0);