[Bf-blender-cvs] [60d541c7286] soc-2019-npr: Add option to select contour verts
Sebastian Parborg
noreply at git.blender.org
Tue Jun 18 10:23:26 CEST 2019
Commit: 60d541c7286283ffa55a9fb7af25746f341d5634
Author: Sebastian Parborg
Date: Thu Nov 22 23:05:26 2018 +0100
Branches: soc-2019-npr
https://developer.blender.org/rB60d541c7286283ffa55a9fb7af25746f341d5634
Add option to select contour verts
===================================================================
M release/scripts/startup/bl_ui/properties_data_modifier.py
M source/blender/makesdna/DNA_modifier_types.h
M source/blender/makesrna/intern/rna_modifier.c
M source/blender/modifiers/intern/MOD_mybmesh.c
===================================================================
diff --git a/release/scripts/startup/bl_ui/properties_data_modifier.py b/release/scripts/startup/bl_ui/properties_data_modifier.py
index 9283cc68851..b6a4346410d 100644
--- a/release/scripts/startup/bl_ui/properties_data_modifier.py
+++ b/release/scripts/startup/bl_ui/properties_data_modifier.py
@@ -666,6 +666,8 @@ class DATA_PT_modifiers(ModifierButtonsPanel, Panel):
col.label(text="Camera Object:")
col.prop(md, "camera_object", text="")
+ col.prop(md, "do_sel")
+
def OCEAN(self, layout, ob, md):
if not bpy.app.build_options.mod_oceansim:
layout.label(text="Built without OceanSim modifier")
diff --git a/source/blender/makesdna/DNA_modifier_types.h b/source/blender/makesdna/DNA_modifier_types.h
index 761f302ed7f..ce353df52ad 100644
--- a/source/blender/makesdna/DNA_modifier_types.h
+++ b/source/blender/makesdna/DNA_modifier_types.h
@@ -1747,6 +1747,7 @@ enum {
MOD_MYBMESH_RAD_I = (1 << 5),
MOD_MYBMESH_RAD_FLIP = (1 << 6),
MOD_MYBMESH_OPTI = (1 << 7),
+ MOD_MYBMESH_SEL = (1 << 8),
};
#endif /* __DNA_MODIFIER_TYPES_H__ */
diff --git a/source/blender/makesrna/intern/rna_modifier.c b/source/blender/makesrna/intern/rna_modifier.c
index de0c9d970f6..cb157b985a8 100644
--- a/source/blender/makesrna/intern/rna_modifier.c
+++ b/source/blender/makesrna/intern/rna_modifier.c
@@ -5026,6 +5026,11 @@ static void rna_def_modifier_mybmesh(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Camera Object", "Object to use as camera location");
RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_SELF_CHECK);
RNA_def_property_update(prop, 0, "rna_Modifier_dependency_update");
+
+ prop = RNA_def_property(srna, "do_sel", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_MYBMESH_SEL);
+ RNA_def_property_ui_text(prop, "Select C verts", "Select contour verts for GP stroke creation");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
}
static void rna_def_modifier_weightednormal(BlenderRNA *brna)
diff --git a/source/blender/modifiers/intern/MOD_mybmesh.c b/source/blender/modifiers/intern/MOD_mybmesh.c
index ae3808d348f..ef9bdb2ffca 100644
--- a/source/blender/modifiers/intern/MOD_mybmesh.c
+++ b/source/blender/modifiers/intern/MOD_mybmesh.c
@@ -4261,6 +4261,23 @@ static void create_vert_mapping(MeshData *m_d){
}
}
+static void select_C_verts(MeshData *m_d){
+ BMVert *vert;
+ BMIter iter;
+
+ //Deselect all verts
+ BM_ITER_MESH (vert, &iter, m_d->bm, BM_VERTS_OF_MESH) {
+ BM_elem_flag_disable(vert, BM_ELEM_SELECT);
+ }
+
+ BM_mesh_deselect_flush(m_d->bm);
+
+ for(int vert_i = 0; vert_i < m_d->C_verts->count; vert_i++){
+ vert = BLI_buffer_at(m_d->C_verts, BMVert*, vert_i);
+ BM_elem_flag_enable(vert, BM_ELEM_SELECT);
+ }
+}
+
/* bmesh only function */
static Mesh *mybmesh_do(Mesh *mesh, MyBMeshModifierData *mmd, float cam_loc[3])
{
@@ -4422,6 +4439,11 @@ static Mesh *mybmesh_do(Mesh *mesh, MyBMeshModifierData *mmd, float cam_loc[3])
recalc_face_normals(bm);
}
+ if (mmd->flag & MOD_MYBMESH_SEL){
+ //Select C verts so we can easily export them as GP strokes
+ select_C_verts(&mesh_data);
+ }
+
TIMEIT_START(debug_color);
debug_colorize(bm, cam_loc);
debug_colorize_radi(&mesh_data);
@@ -4491,6 +4513,10 @@ static Mesh *applyModifier(ModifierData *md, const ModifierEvalContext *ctx,
*/
}
+ //Scene *scene = DEG_get_evaluated_scene(ctx->depsgraph);
+ //Only needed for GP
+ //int scene_frame = BKE_scene_frame_get(scene);
+
if (!(result = mybmesh_do(mesh, mmd, cam_loc))) {
return mesh;
}
More information about the Bf-blender-cvs
mailing list