[Bf-blender-cvs] [81e4f77] soc-2014-remesh: Initial configuration, to add the quadrilateral remeshing tool as a modifier remeshing
Alexander Pinzon Fernandez
noreply at git.blender.org
Wed Jun 4 03:16:17 CEST 2014
Commit: 81e4f77bb0fe2ddea9491cf0cf3c3c5c70616fbf
Author: Alexander Pinzon Fernandez
Date: Tue Jun 3 20:15:23 2014 -0500
https://developer.blender.org/rB81e4f77bb0fe2ddea9491cf0cf3c3c5c70616fbf
Initial configuration, to add the quadrilateral remeshing tool as a modifier remeshing
===================================================================
M release/scripts/startup/bl_ui/properties_data_modifier.py
M source/blender/editors/object/object_intern.h
M source/blender/editors/object/object_modifier.c
M source/blender/editors/object/object_ops.c
M source/blender/makesdna/DNA_modifier_types.h
M source/blender/makesrna/RNA_access.h
M source/blender/makesrna/intern/rna_modifier.c
M source/blender/modifiers/CMakeLists.txt
M source/blender/modifiers/MOD_modifiertypes.h
M source/blender/modifiers/intern/MOD_util.c
===================================================================
diff --git a/release/scripts/startup/bl_ui/properties_data_modifier.py b/release/scripts/startup/bl_ui/properties_data_modifier.py
index 60187ff..6abc195 100644
--- a/release/scripts/startup/bl_ui/properties_data_modifier.py
+++ b/release/scripts/startup/bl_ui/properties_data_modifier.py
@@ -991,6 +991,23 @@ class DATA_PT_modifiers(ModifierButtonsPanel, Panel):
row.active = md.use_remove_disconnected
row.prop(md, "threshold")
+ def QUADREMESH(self, layout, ob, md):
+ is_bind = md.is_bind
+
+ row = layout.row()
+ row.active = not is_bind
+ row.label(text="Features Vertex Group:")
+
+ row = layout.row()
+ row.enabled = not is_bind
+ row.prop_search(md, "vertex_group", ob, "vertex_groups", text="")
+
+ layout.separator()
+
+ row = layout.row()
+ row.enabled = bool(md.vertex_group)
+ row.operator("object.quadremesh_bind", text="Unbind" if is_bind else "Bind")
+
@staticmethod
def vertex_weight_mask(layout, ob, md):
layout.label(text="Influence/Mask Options:")
diff --git a/source/blender/editors/object/object_intern.h b/source/blender/editors/object/object_intern.h
index fd6b9a1..fd479a6 100644
--- a/source/blender/editors/object/object_intern.h
+++ b/source/blender/editors/object/object_intern.h
@@ -175,6 +175,7 @@ void OBJECT_OT_skin_loose_mark_clear(struct wmOperatorType *ot);
void OBJECT_OT_skin_radii_equalize(struct wmOperatorType *ot);
void OBJECT_OT_skin_armature_create(struct wmOperatorType *ot);
void OBJECT_OT_laplaciandeform_bind(struct wmOperatorType *ot);
+void OBJECT_OT_quadremesh_bind(struct wmOperatorType *ot);
/* object_constraint.c */
void OBJECT_OT_constraint_add(struct wmOperatorType *ot);
diff --git a/source/blender/editors/object/object_modifier.c b/source/blender/editors/object/object_modifier.c
index 3e33268..eb5cdc4 100644
--- a/source/blender/editors/object/object_modifier.c
+++ b/source/blender/editors/object/object_modifier.c
@@ -2226,3 +2226,54 @@ void OBJECT_OT_laplaciandeform_bind(wmOperatorType *ot)
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_INTERNAL;
edit_modifier_properties(ot);
}
+
+
+/************************ QuadRemesh bind operator *********************/
+
+static int quadremesh_poll(bContext *C)
+{
+ return edit_modifier_poll_generic(C, &RNA_QuadRemeshModifier, 0);
+}
+
+static int quadremesh_bind_exec(bContext *C, wmOperator *op)
+{
+ Object *ob = ED_object_active_context(C);
+ QuadRemeshModifierData *lmd = (QuadRemeshModifierData *)edit_modifier_property_get(op, ob, eModifierType_QuadRemesh);
+
+ if (!lmd)
+ return OPERATOR_CANCELLED;
+ if (lmd->flag & MOD_QUADREMESH_BIND) {
+ lmd->flag &= ~MOD_QUADREMESH_BIND;
+ }
+ else {
+ lmd->flag |= MOD_QUADREMESH_BIND;
+ }
+ DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
+ WM_event_add_notifier(C, NC_OBJECT | ND_MODIFIER, ob);
+ return OPERATOR_FINISHED;
+}
+
+static int quadremesh_bind_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event))
+{
+ if (edit_modifier_invoke_properties(C, op))
+ return quadremesh_bind_exec(C, op);
+ else
+ return OPERATOR_CANCELLED;
+}
+
+void OBJECT_OT_quadremesh_bind(wmOperatorType *ot)
+{
+ /* identifiers */
+ ot->name = "Quad Remesh Bind";
+ ot->description = "Bind mesh to system in Quad Remesh modifier";
+ ot->idname = "OBJECT_OT_quadremesh_bind";
+
+ /* api callbacks */
+ ot->poll = quadremesh_poll;
+ ot->invoke = quadremesh_bind_invoke;
+ ot->exec = quadremesh_bind_exec;
+
+ /* flags */
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_INTERNAL;
+ edit_modifier_properties(ot);
+}
diff --git a/source/blender/editors/object/object_ops.c b/source/blender/editors/object/object_ops.c
index a8f0774..2d86ead 100644
--- a/source/blender/editors/object/object_ops.c
+++ b/source/blender/editors/object/object_ops.c
@@ -247,6 +247,7 @@ void ED_operatortypes_object(void)
WM_operatortype_append(OBJECT_OT_lod_remove);
WM_operatortype_append(OBJECT_OT_vertex_random);
+ WM_operatortype_append(OBJECT_OT_quadremesh_bind);
}
void ED_operatormacros_object(void)
diff --git a/source/blender/makesdna/DNA_modifier_types.h b/source/blender/makesdna/DNA_modifier_types.h
index 7c5846e..5e2b0c0 100644
--- a/source/blender/makesdna/DNA_modifier_types.h
+++ b/source/blender/makesdna/DNA_modifier_types.h
@@ -82,6 +82,7 @@ typedef enum ModifierType {
eModifierType_MeshCache = 46,
eModifierType_LaplacianDeform = 47,
eModifierType_Wireframe = 48,
+ eModifierType_QuadRemesh = 49,
NUM_MODIFIER_TYPES
} ModifierType;
@@ -1362,6 +1363,17 @@ enum {
MOD_WIREFRAME_CREASE = (1 << 5),
};
+typedef struct QuadRemeshModifierData {
+ ModifierData modifier;
+ char anchor_grp_name[64]; /* MAX_VGROUP_NAME */
+ short flag, pad[3];
+
+} QuadRemeshModifierData;
+
+/* QuadRemesh modifier flags */
+enum {
+ MOD_QUADREMESH_BIND = 1,
+};
#endif /* __DNA_MODIFIER_TYPES_H__ */
diff --git a/source/blender/makesrna/RNA_access.h b/source/blender/makesrna/RNA_access.h
index add59ba..9d0a505 100644
--- a/source/blender/makesrna/RNA_access.h
+++ b/source/blender/makesrna/RNA_access.h
@@ -455,6 +455,7 @@ extern StructRNA RNA_PropertyGroupItem;
extern StructRNA RNA_PropertySensor;
extern StructRNA RNA_PythonConstraint;
extern StructRNA RNA_PythonController;
+extern StructRNA RNA_QuadRemeshModifier;
extern StructRNA RNA_QuickTimeSettings;
extern StructRNA RNA_RadarSensor;
extern StructRNA RNA_RandomSensor;
diff --git a/source/blender/makesrna/intern/rna_modifier.c b/source/blender/makesrna/intern/rna_modifier.c
index 191d6d2..b4bd118 100644
--- a/source/blender/makesrna/intern/rna_modifier.c
+++ b/source/blender/makesrna/intern/rna_modifier.c
@@ -75,6 +75,7 @@ EnumPropertyItem modifier_type_items[] = {
{eModifierType_Mirror, "MIRROR", ICON_MOD_MIRROR, "Mirror", ""},
{eModifierType_Multires, "MULTIRES", ICON_MOD_MULTIRES, "Multiresolution", ""},
{eModifierType_Remesh, "REMESH", ICON_MOD_REMESH, "Remesh", ""},
+ {eModifierType_QuadRemesh, "QUADREMESH", ICON_MOD_REMESH, "Quadrilateral Remesh", "" },
{eModifierType_Screw, "SCREW", ICON_MOD_SCREW, "Screw", ""},
{eModifierType_Skin, "SKIN", ICON_MOD_SKIN, "Skin", ""},
{eModifierType_Solidify, "SOLIDIFY", ICON_MOD_SOLIDIFY, "Solidify", ""},
@@ -244,6 +245,8 @@ static StructRNA *rna_Modifier_refine(struct PointerRNA *ptr)
return &RNA_LaplacianDeformModifier;
case eModifierType_Wireframe:
return &RNA_WireframeModifier;
+ case eModifierType_QuadRemesh:
+ return &RNA_QuadRemeshModifier;
/* Default */
case eModifierType_None:
case eModifierType_ShapeKey:
@@ -332,6 +335,7 @@ RNA_MOD_VGROUP_NAME_SET(WeightVGMix, mask_defgrp_name);
RNA_MOD_VGROUP_NAME_SET(WeightVGProximity, defgrp_name);
RNA_MOD_VGROUP_NAME_SET(WeightVGProximity, mask_defgrp_name);
RNA_MOD_VGROUP_NAME_SET(Wireframe, defgrp_name);
+RNA_MOD_VGROUP_NAME_SET(QuadRemesh, anchor_grp_name);
static void rna_ExplodeModifier_vgroup_get(PointerRNA *ptr, char *value)
{
@@ -604,6 +608,12 @@ static int rna_LaplacianDeformModifier_is_bind_get(PointerRNA *ptr)
return ((lmd->flag & MOD_LAPLACIANDEFORM_BIND) && (lmd->cache_system != NULL));
}
+static int rna_QuadRemeshModifier_is_bind_get(PointerRNA *ptr)
+{
+ QuadRemeshModifierData *qmd = (QuadRemeshModifierData *)ptr->data;
+ return (qmd->flag & MOD_QUADREMESH_BIND);
+}
+
#else
static PropertyRNA *rna_def_property_subdivision_common(StructRNA *srna, const char type[])
@@ -3647,6 +3657,30 @@ static void rna_def_modifier_wireframe(BlenderRNA *brna)
RNA_def_property_update(prop, 0, "rna_Modifier_update");
}
+static void rna_def_modifier_quadremesh(BlenderRNA *brna)
+{
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ srna = RNA_def_struct(brna, "QuadRemeshModifier", "Modifier");
+ RNA_def_struct_ui_text(srna, "Quadrilateral Remesh Modifier", "Quadrilateral Remesh modifier");
+ RNA_def_struct_sdna(srna, "QuadRemeshModifierData");
+ RNA_def_struct_ui_icon(srna, ICON_MOD_REMESH);
+
+ prop = RNA_def_property(srna, "vertex_group", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_sdna(prop, NULL, "anchor_grp_name");
+ RNA_def_property_ui_text(prop, "Vertex group for feature points",
+ "Name of Vertex Group which determines feature points");
+ RNA_def_property_string_funcs(prop, NULL, NULL, "rna_QuadRemeshModifier_anchor_grp_name_set");
+
+ prop = RNA_def_property(srna, "is_bind", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_funcs(prop, "rna_QuadRemeshModifier_is_bind_get", NULL);
+ RNA_def_property_ui_text(prop, "Bound", "Whether geometry has been bound to anchors");
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+}
+
void RNA_def_modifier(BlenderRNA *brna)
{
StructRNA *srna;
@@ -3759,6 +3793,7 @@ void RNA_def_modifier(BlenderRNA *brna)
rna_def_modifier_meshcache(brna);
rna_def_modifier_laplaciandeform(brna);
rna_def_modifier_wireframe(brna);
+ rna_def_modifier_quadremesh(brna);
}
#endif
diff --git a/source/blender/modifiers/CMakeLists.txt b/source/blender/modifiers/CMakeLists.txt
index b841356..8d12cd7 100644
--- a/source/blender/modifiers/CMakeLists.txt
+++ b/source/blender/modifiers/CMakeLists.txt
@@ -76,6 +76,7 @@ set(SRC
intern/MOD_ocean.c
intern/MOD_particleinstance.c
intern/MOD_particlesystem.c
+ intern/MOD_quadremesh.c
intern/MOD_remesh.c
intern/MOD_screw.c
intern/MOD_shapekey.c
diff --git a/source/blender/modifiers/MOD_modifiertypes.h b/source/blender/modifiers/MOD_modifiertypes.h
index 9c7c21c..2292961 100644
--- a/source/blender/modifiers/MOD_modifiertypes.h
+++ b/source/blender/modifiers/MOD_modifiertypes.h
@@ -81,6 +81,7 @@ extern ModifierTypeInfo modifierType_UVWarp;
extern ModifierTypeInfo modifierType_MeshCache;
extern ModifierTypeInfo modifierType_LaplacianDeform;
extern ModifierTypeInfo modifierType_Wireframe;
+extern ModifierTypeInfo modifierType_QuadRemesh;
/* MOD_util.c */
void modifier_type_init(ModifierTypeInfo *types[]);
diff --git a/source/blender/modifiers/intern/MOD_util.c b/source/blender/modifiers/intern/MOD_util.c
index 386d6d9..47060db 100644
--- a/source/blender/modifiers/intern/MOD_util.c
+++ b/source/blender/modifiers/intern/MOD_util.c
@@ -309,5 +309,6 @@ voi
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list