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:
authorJoseph Eagar <joeedh@gmail.com>2009-05-18 14:29:37 +0400
committerJoseph Eagar <joeedh@gmail.com>2009-05-18 14:29:37 +0400
commit088579f36bc5c9c0cf65c23cba68dfd64abb0bba (patch)
tree1353f604a403ff1ed722c0623a1f0a42f7e13f91 /source/blender/editors/mesh/editmesh_tools.c
parent0ba863de29ad6768260e1b4e67f3eec9c8ae4c81 (diff)
selection now works. next up, undo, and also need to track down an odd bug with face selection and the subdivide tool, which may be related to the bmesh derivedmesh not being refreshed often enough. also committing a start on a set of docs, which are in mediawiki format.
Diffstat (limited to 'source/blender/editors/mesh/editmesh_tools.c')
-rw-r--r--source/blender/editors/mesh/editmesh_tools.c189
1 files changed, 2 insertions, 187 deletions
diff --git a/source/blender/editors/mesh/editmesh_tools.c b/source/blender/editors/mesh/editmesh_tools.c
index 0342a39f855..046366eb553 100644
--- a/source/blender/editors/mesh/editmesh_tools.c
+++ b/source/blender/editors/mesh/editmesh_tools.c
@@ -75,6 +75,8 @@ editmesh_tool.c: UI called tools for editmesh, geometry changes here, otherwise
#include "BKE_utildefines.h"
#include "BKE_bmesh.h"
#include "BKE_report.h"
+#include "BKE_tessmesh.h"
+
#include "BIF_gl.h"
#include "BIF_glutil.h"
@@ -6471,193 +6473,6 @@ void MESH_OT_mirror_colors(wmOperatorType *ot)
/* flags */
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
}
-
-static int subdivide_exec(bContext *C, wmOperator *op)
-{
- Object *obedit= CTX_data_edit_object(C);
- Scene *scene = CTX_data_scene(C);
- EditMesh *em= EM_GetEditMesh((Mesh *)obedit->data);
-
- BM_esubdivideflag_conv(obedit, em, 1, 0.0, scene->toolsettings->editbutflag, 1, 0);
-
- WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
-
- EM_EndEditMesh(obedit->data, em);
- return OPERATOR_FINISHED;
-}
-
-void MESH_OT_subdivide(wmOperatorType *ot)
-{
- /* identifiers */
- ot->name= "Subdivide";
- ot->idname= "MESH_OT_subdivide";
-
- /* api callbacks */
- ot->exec= subdivide_exec;
- ot->poll= ED_operator_editmesh;
-
- /* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
-}
-
-static int subdivide_multi_exec(bContext *C, wmOperator *op)
-{
- Object *obedit= CTX_data_edit_object(C);
- Scene *scene = CTX_data_scene(C);
- EditMesh *em= EM_GetEditMesh((Mesh *)obedit->data);
-
- BM_esubdivideflag_conv(obedit, em, 1, 0.0, scene->toolsettings->editbutflag, RNA_int_get(op->ptr,"number_cuts"), 0);
-
- WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
-
- EM_EndEditMesh(obedit->data, em);
- return OPERATOR_FINISHED;
-}
-
-void MESH_OT_subdivide_multi(wmOperatorType *ot)
-{
- /* identifiers */
- ot->name= "Subdivide Multi";
- ot->idname= "MESH_OT_subdivide_multi";
-
- /* api callbacks */
- ot->exec= subdivide_multi_exec;
- ot->poll= ED_operator_editmesh;
-
- /* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
-
- /* props */
- RNA_def_int(ot->srna, "number_cuts", 4, 1, 100, "Number of Cuts", "", 1, INT_MAX);
-}
-
-static int subdivide_multi_fractal_exec(bContext *C, wmOperator *op)
-{
- Object *obedit= CTX_data_edit_object(C);
- Scene *scene = CTX_data_scene(C);
- EditMesh *em= EM_GetEditMesh((Mesh *)obedit->data);
-
- BM_esubdivideflag_conv(obedit, em, 1, -(RNA_float_get(op->ptr, "random_factor")/100), scene->toolsettings->editbutflag, RNA_int_get(op->ptr, "number_cuts"), 0);
-
- WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
-
- EM_EndEditMesh(obedit->data, em);
- return OPERATOR_FINISHED;
-}
-
-void MESH_OT_subdivide_multi_fractal(wmOperatorType *ot)
-{
- /* identifiers */
- ot->name= "Subdivide Multi Fractal";
- ot->idname= "MESH_OT_subdivide_multi_fractal";
-
- /* api callbacks */
- ot->exec= subdivide_multi_fractal_exec;
- ot->poll= ED_operator_editmesh;
-
- /* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
-
- /* properties */
- RNA_def_int(ot->srna, "number_cuts", 4, 1, 100, "Number of Cuts", "", 1, INT_MAX);
- RNA_def_float(ot->srna, "random_factor", 5.0, 0.0f, FLT_MAX, "Random Factor", "", 0.0f, 1000.0f);
-}
-
-static int subdivide_smooth_exec(bContext *C, wmOperator *op)
-{
- Object *obedit= CTX_data_edit_object(C);
- Scene *scene = CTX_data_scene(C);
- EditMesh *em= EM_GetEditMesh((Mesh *)obedit->data);
-
- BM_esubdivideflag_conv(obedit, em, 1, 0.292f*RNA_float_get(op->ptr, "smoothness"), scene->toolsettings->editbutflag | B_SMOOTH, 1, 0);
-
- WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
-
- EM_EndEditMesh(obedit->data, em);
- return OPERATOR_FINISHED;
-}
-
-void MESH_OT_subdivide_smooth(wmOperatorType *ot)
-{
- /* identifiers */
- ot->name= "Subdivide Smooth";
- ot->idname= "MESH_OT_subdivide_smooth";
-
- /* api callbacks */
- ot->exec= subdivide_smooth_exec;
- ot->poll= ED_operator_editmesh;
-
- /* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
-
- /* props */
- RNA_def_float(ot->srna, "smoothness", 1.0f, 0.0f, 1000.0f, "Smoothness", "", 0.0f, FLT_MAX);
-}
-
-static int subdivs_invoke(bContext *C, wmOperator *op, wmEvent *event)
-{
- uiMenuItem *head;
-
- head= uiPupMenuBegin("Subdivision Type", 0);
- uiMenuItemsEnumO(head, "MESH_OT_subdivs", "type");
- uiPupMenuEnd(C, head);
-
- return OPERATOR_CANCELLED;
-}
-
-static int subdivs_exec(bContext *C, wmOperator *op)
-{
- switch(RNA_int_get(op->ptr, "type"))
- {
- case 0: // simple
- subdivide_exec(C,op);
- break;
- case 1: // multi
- subdivide_multi_exec(C,op);
- break;
- case 2: // fractal;
- subdivide_multi_fractal_exec(C,op);
- break;
- case 3: //smooth
- subdivide_smooth_exec(C,op);
- break;
- }
-
- return OPERATOR_FINISHED;
-}
-
-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";
-
- /* api callbacks */
- ot->invoke= subdivs_invoke;
- ot->exec= subdivs_exec;
-
- ot->poll= ED_operator_editmesh;
-
- /* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
-
- /*props */
- 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, 1, 10, "Number of Cuts", "", 1, 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", 1.0f, 0.0f, 1000.0f, "Smoothness", "", 0.0f, FLT_MAX);
-
-}
-
/* ************************************* */
/* note; the EM_selectmode_set() calls here illustrate how badly constructed it all is... from before the