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:
authorNicholas Bishop <nicholasbishop@gmail.com>2009-05-23 11:12:55 +0400
committerNicholas Bishop <nicholasbishop@gmail.com>2009-05-23 11:12:55 +0400
commit380efe9dc47978431d81642ce538676be59bad18 (patch)
tree5c7b90be350e6223f13f85f1d9be5b6ae87ff4d4 /source/blender/editors/object
parent1a69eab4a09f77db63830aa337872fb306372f94 (diff)
Multires/2.5:
Added subdivide operator and button for multires. Since this seems to be the only modifier with an operator defined, I'm not sure if I put it in a good place or not, someone can check on this?
Diffstat (limited to 'source/blender/editors/object')
-rw-r--r--source/blender/editors/object/object_intern.h1
-rw-r--r--source/blender/editors/object/object_modifier.c27
-rw-r--r--source/blender/editors/object/object_ops.c1
3 files changed, 29 insertions, 0 deletions
diff --git a/source/blender/editors/object/object_intern.h b/source/blender/editors/object/object_intern.h
index 7203f56b40f..223f2190f4b 100644
--- a/source/blender/editors/object/object_intern.h
+++ b/source/blender/editors/object/object_intern.h
@@ -86,6 +86,7 @@ void GROUP_OT_objects_remove_active(struct wmOperatorType *ot);
/* object_modifier.c */
void OBJECT_OT_modifier_add(struct wmOperatorType *ot);
+void OBJECT_OT_multires_subdivide(struct wmOperatorType *ot);
#endif /* ED_OBJECT_INTERN_H */
diff --git a/source/blender/editors/object/object_modifier.c b/source/blender/editors/object/object_modifier.c
index 04bcc4e3717..68b8c4a6a14 100644
--- a/source/blender/editors/object/object_modifier.c
+++ b/source/blender/editors/object/object_modifier.c
@@ -46,6 +46,7 @@
#include "BKE_global.h"
#include "BKE_mesh.h"
#include "BKE_modifier.h"
+#include "BKE_multires.h"
#include "BKE_report.h"
#include "BKE_object.h"
#include "BKE_particle.h"
@@ -367,6 +368,32 @@ void OBJECT_OT_modifier_add(wmOperatorType *ot)
RNA_def_enum(ot->srna, "type", modifier_type_items, 0, "Type", "");
}
+static int multires_subdivide_exec(bContext *C, wmOperator *op)
+{
+ Object *ob = CTX_data_active_object(C);
+ MultiresModifierData *mmd = find_multires_modifier(ob);
+
+ if(mmd) {
+ multiresModifier_subdivide(mmd, ob, 1, 0, mmd->simple);
+ WM_event_add_notifier(C, NC_OBJECT|ND_MODIFIER, ob);
+ }
+
+ return OPERATOR_FINISHED;
+}
+
+void OBJECT_OT_multires_subdivide(wmOperatorType *ot)
+{
+ ot->name= "Multires Subdivide";
+ ot->description= "Add a new level of subdivision.";
+ ot->idname= "OBJECT_OT_multires_subdivide";
+ ot->poll= ED_operator_object_active;
+
+ ot->exec= multires_subdivide_exec;
+
+ /* flags */
+ ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+}
+
#if 0
static void modifiers_add(void *ob_v, int type)
{
diff --git a/source/blender/editors/object/object_ops.c b/source/blender/editors/object/object_ops.c
index e668c494fba..f2a020e69a6 100644
--- a/source/blender/editors/object/object_ops.c
+++ b/source/blender/editors/object/object_ops.c
@@ -100,6 +100,7 @@ void ED_operatortypes_object(void)
WM_operatortype_append(OBJECT_OT_primitive_add);
WM_operatortype_append(OBJECT_OT_modifier_add);
+ WM_operatortype_append(OBJECT_OT_multires_subdivide);
}
void ED_keymap_object(wmWindowManager *wm)