[Bf-blender-cvs] [09d0db2654f] soc-2018-npr: Initial port to 2.8

Sebastian Parborg noreply at git.blender.org
Tue Jul 17 11:26:55 CEST 2018


Commit: 09d0db2654fe4fffef18892598ea43f20b78798c
Author: Sebastian Parborg
Date:   Thu Jun 28 12:03:36 2018 +0200
Branches: soc-2018-npr
https://developer.blender.org/rB09d0db2654fe4fffef18892598ea43f20b78798c

Initial port to 2.8

===================================================================

M	release/scripts/startup/bl_ui/properties_data_modifier.py
M	source/blender/bmesh/intern/bmesh_polygon.c
M	source/blender/editors/space_outliner/outliner_draw.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
A	source/blender/modifiers/intern/MOD_mybmesh.c
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 03ebea69d2b..c331f9ecd3e 100644
--- a/release/scripts/startup/bl_ui/properties_data_modifier.py
+++ b/release/scripts/startup/bl_ui/properties_data_modifier.py
@@ -624,6 +624,31 @@ class DATA_PT_modifiers(ModifierButtonsPanel, Panel):
             row.operator("object.multires_external_save", text="Save External...")
             row.label()
 
+    def MY_BMESH(self, layout, ob, md):
+        split = layout.split(percentage=0.25)
+
+        col = split.column()
+        col.label(text="§6.1:")
+        col.prop(md, "do_tri")
+        col.prop(md, "do_ff_bb_split")
+
+        col = split.column()
+        col.label(text="§6.2:")
+        col.prop(md, "do_cusp_dect")
+        col.prop(md, "do_insert")
+        col.prop(md, "do_cusp_insert")
+
+        col = split.column()
+        col.label(text="§6.3:")
+        col.prop(md, "do_rad_insert")
+        col.prop(md, "do_rad_flip")
+        col.prop(md, "do_opti")
+
+
+        col = layout.column()
+        col.label(text="Camera Object:")
+        col.prop(md, "camera_object", text="")
+
     def OCEAN(self, layout, ob, md):
         if not bpy.app.build_options.mod_oceansim:
             layout.label("Built without OceanSim modifier")
diff --git a/source/blender/bmesh/intern/bmesh_polygon.c b/source/blender/bmesh/intern/bmesh_polygon.c
index 421b2adc3a7..c39456ca95f 100644
--- a/source/blender/bmesh/intern/bmesh_polygon.c
+++ b/source/blender/bmesh/intern/bmesh_polygon.c
@@ -946,7 +946,7 @@ void BM_face_triangulate(
 	int nf_i = 0;
 	int ne_i = 0;
 
-	BLI_assert(BM_face_is_normal_valid(f));
+	//BLI_assert(BM_face_is_normal_valid(f));
 
 	/* ensure both are valid or NULL */
 	BLI_assert((r_faces_new == NULL) == (r_faces_new_tot == NULL));
diff --git a/source/blender/editors/space_outliner/outliner_draw.c b/source/blender/editors/space_outliner/outliner_draw.c
index 8a8f4715ea3..603efb43569 100644
--- a/source/blender/editors/space_outliner/outliner_draw.c
+++ b/source/blender/editors/space_outliner/outliner_draw.c
@@ -1104,6 +1104,9 @@ static void tselem_draw_icon(
 					case eModifierType_Wireframe:
 						ICON_DRAW(ICON_MOD_WIREFRAME);
 						break;
+					case eModifierType_MyBMesh:
+						ICON_DRAW(ICON_MOD_MESHDEFORM); /* XXX, needs own icon */
+						 break;
 					case eModifierType_LaplacianDeform:
 						ICON_DRAW(ICON_MOD_MESHDEFORM); /* XXX, needs own icon */
 						break;
diff --git a/source/blender/makesdna/DNA_modifier_types.h b/source/blender/makesdna/DNA_modifier_types.h
index ecece648ce1..fad666d5189 100644
--- a/source/blender/makesdna/DNA_modifier_types.h
+++ b/source/blender/makesdna/DNA_modifier_types.h
@@ -90,6 +90,7 @@ typedef enum ModifierType {
 	eModifierType_CorrectiveSmooth  = 51,
 	eModifierType_MeshSequenceCache = 52,
 	eModifierType_SurfaceDeform     = 53,
+	eModifierType_MyBMesh           = 54,
 	NUM_MODIFIER_TYPES
 } ModifierType;
 
@@ -1494,6 +1495,13 @@ enum {
 	MOD_WIREFRAME_CREASE        = (1 << 5),
 };
 
+/* Modifier data stored in the blend file */
+typedef struct MyBMeshModifierData {
+	ModifierData modifier;
+	struct Object *camera_ob;
+	int flag;  /* options stored here */
+	short pad[2];
+} MyBMeshModifierData;
 
 typedef struct DataTransferModifierData {
 	ModifierData modifier;
@@ -1638,4 +1646,15 @@ enum {
 #define MOD_MESHSEQ_READ_ALL \
 	(MOD_MESHSEQ_READ_VERT | MOD_MESHSEQ_READ_POLY | MOD_MESHSEQ_READ_UV | MOD_MESHSEQ_READ_COLOR)
 
+enum {
+	MOD_MYBMESH_TRIANG = (1 << 0),
+	MOD_MYBMESH_FF_SPLIT = (1 << 1),
+	MOD_MYBMESH_CUSP_D = (1 << 2),
+	MOD_MYBMESH_CUSP_I = (1 << 3),
+	MOD_MYBMESH_FB_SPLIT = (1 << 4),
+	MOD_MYBMESH_RAD_I = (1 << 5),
+	MOD_MYBMESH_RAD_FLIP = (1 << 6),
+	MOD_MYBMESH_OPTI = (1 << 7),
+};
+
 #endif  /* __DNA_MODIFIER_TYPES_H__ */
diff --git a/source/blender/makesrna/RNA_access.h b/source/blender/makesrna/RNA_access.h
index f66c80beeab..c73d29b29ce 100644
--- a/source/blender/makesrna/RNA_access.h
+++ b/source/blender/makesrna/RNA_access.h
@@ -426,6 +426,7 @@ extern StructRNA RNA_MovieTrackingStabilization;
 extern StructRNA RNA_MulticamSequence;
 extern StructRNA RNA_MultiresModifier;
 extern StructRNA RNA_MusgraveTexture;
+extern StructRNA RNA_MyBMeshModifier;
 extern StructRNA RNA_NandController;
 extern StructRNA RNA_NearSensor;
 extern StructRNA RNA_NlaStrip;
diff --git a/source/blender/makesrna/intern/rna_modifier.c b/source/blender/makesrna/intern/rna_modifier.c
index 57b12d6a3fd..bc8cbe49a50 100644
--- a/source/blender/makesrna/intern/rna_modifier.c
+++ b/source/blender/makesrna/intern/rna_modifier.c
@@ -91,6 +91,7 @@ const EnumPropertyItem rna_enum_object_modifier_type_items[] = {
 	{eModifierType_Subsurf, "SUBSURF", ICON_MOD_SUBSURF, "Subdivision Surface", ""},
 	{eModifierType_Triangulate, "TRIANGULATE", ICON_MOD_TRIANGULATE, "Triangulate", ""},
 	{eModifierType_Wireframe, "WIREFRAME", ICON_MOD_WIREFRAME, "Wireframe", "Generate a wireframe on the edges of a mesh"},
+	{eModifierType_MyBMesh, "MY_BMESH", ICON_DOT /* dummy! */, "My BMesh", ""},
 	{0, "", 0, N_("Deform"), ""},
 	{eModifierType_Armature, "ARMATURE", ICON_MOD_ARMATURE, "Armature", ""},
 	{eModifierType_Cast, "CAST", ICON_MOD_CAST, "Cast", ""},
@@ -414,6 +415,8 @@ static StructRNA *rna_Modifier_refine(struct PointerRNA *ptr)
 			return &RNA_MeshSequenceCacheModifier;
 		case eModifierType_SurfaceDeform:
 			return &RNA_SurfaceDeformModifier;
+		case eModifierType_MyBMesh:
+			return &RNA_MyBMeshModifier;
 		/* Default */
 		case eModifierType_None:
 		case eModifierType_ShapeKey:
@@ -4877,6 +4880,63 @@ static void rna_def_modifier_surfacedeform(BlenderRNA *brna)
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 }
 
+static void rna_def_modifier_mybmesh(BlenderRNA *brna)
+{
+	StructRNA *srna;
+	PropertyRNA *prop;
+
+	srna = RNA_def_struct(brna, "MyBMeshModifier", "Modifier");
+	RNA_def_struct_ui_text(srna, "Wireframe Modifier", "Wireframe effect modifier");
+	RNA_def_struct_sdna(srna, "MyBMeshModifierData");
+	RNA_def_struct_ui_icon(srna, ICON_MOD_MESHDEFORM);
+
+	prop = RNA_def_property(srna, "do_tri", PROP_BOOLEAN, PROP_NONE);
+	RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_MYBMESH_TRIANG);
+	RNA_def_property_ui_text(prop, "b)", "Triangulate the mesh");
+	RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+	prop = RNA_def_property(srna, "do_ff_bb_split", PROP_BOOLEAN, PROP_NONE);
+	RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_MYBMESH_FF_SPLIT);
+	RNA_def_property_ui_text(prop, "Split", "Split inconsitent FF/BB edges");
+	RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+	prop = RNA_def_property(srna, "do_cusp_dect", PROP_BOOLEAN, PROP_NONE);
+	RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_MYBMESH_CUSP_D);
+	RNA_def_property_ui_text(prop, "Cusp detetion", "Detect cusps and insert new edges");
+	RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+	prop = RNA_def_property(srna, "do_insert", PROP_BOOLEAN, PROP_NONE);
+	RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_MYBMESH_FB_SPLIT);
+	RNA_def_property_ui_text(prop, "FB split", "Split FB edges");
+	RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+	prop = RNA_def_property(srna, "do_cusp_insert", PROP_BOOLEAN, PROP_NONE);
+	RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_MYBMESH_CUSP_I);
+	RNA_def_property_ui_text(prop, "Cusp insertion", "Insert cusps from detection stage");
+	RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+	prop = RNA_def_property(srna, "do_rad_insert", PROP_BOOLEAN, PROP_NONE);
+	RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_MYBMESH_RAD_I);
+	RNA_def_property_ui_text(prop, "Radial edge insert", "Insert radial edges");
+	RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+	prop = RNA_def_property(srna, "do_rad_flip", PROP_BOOLEAN, PROP_NONE);
+	RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_MYBMESH_RAD_FLIP);
+	RNA_def_property_ui_text(prop, "Radial edge flip", "Do radial edge flipping");
+	RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+	prop = RNA_def_property(srna, "do_opti", PROP_BOOLEAN, PROP_NONE);
+	RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_MYBMESH_OPTI);
+	RNA_def_property_ui_text(prop, "Mesh optimization", "Try to eliminate inconsistent faces");
+	RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+	prop = RNA_def_property(srna, "camera_object", PROP_POINTER, PROP_NONE);
+	RNA_def_property_pointer_sdna(prop, NULL, "camera_ob");
+	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");
+}
+
 void RNA_def_modifier(BlenderRNA *brna)
 {
 	StructRNA *srna;
@@ -4998,6 +5058,7 @@ void RNA_def_modifier(BlenderRNA *brna)
 	rna_def_modifier_normaledit(brna);
 	rna_def_modifier_meshseqcache(brna);
 	rna_def_modifier_surfacedeform(brna);
+	rna_def_modifier_mybmesh(brna);
 }
 
 #endif
diff --git a/source/blender/modifiers/CMakeLists.txt b/source/blender/modifiers/CMakeLists.txt
index 84a7a7ddbe8..f9462f3848f 100644
--- a/source/blender/modifiers/CMakeLists.txt
+++ b/source/blender/modifiers/CMakeLists.txt
@@ -76,6 +76,7 @@ set(SRC
 	intern/MOD_meshsequencecache.c
 	intern/MOD_mirror.c
 	intern/MOD_multires.c
+	intern/MOD_mybmesh.c
 	intern/MOD_none.c
 	intern/MOD_normal_edit.c
 	intern/MOD_ocean.c
@@ -145,6 +146,10 @@ endif()
 
 if(WITH_OPENSUBDIV)
 	add_definitions(-DWITH_OPENSUBDIV)
+	list(APPEND INC_SYS
+		../../../intern/opensubdiv
+		${OPENSUBDIV_INCLUDE_DIRS}
+	)
 endif()
 
 # So we can have special tricks in modifier system.
diff --git a/source/blender/modifiers/MOD_modifiertypes.h b/source/blender/modifiers/MOD_modifiertypes.h
index bf121af2bd1..01574dc7ef3 100644
--- a/source/blender/modifiers/MOD_modifiertypes.h
+++ b/source/blender/modifiers/MOD_modifiertypes.h
@@ -86,6 +86,7 @@ extern ModifierTypeInfo modifierType_NormalEdit;
 extern ModifierTypeInfo modifierType_CorrectiveSmooth;
 extern ModifierTypeInfo modifierType_MeshSequenceCache;
 extern ModifierTypeInfo modifierType_SurfaceDeform;
+extern ModifierTypeInfo modifierType_MyBMesh;
 
 /* MOD_util.c *

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list