[Bf-blender-cvs] [7c0d688] alembic_basic_io: Merge the 'Alembic' modifier in the 'Mesh Cache' modifier.

Kévin Dietrich noreply at git.blender.org
Sun Mar 27 23:31:08 CEST 2016


Commit: 7c0d68838bd816148272aa890b6d8be454448e90
Author: Kévin Dietrich
Date:   Sun Mar 27 19:24:29 2016 +0200
Branches: alembic_basic_io
https://developer.blender.org/rB7c0d68838bd816148272aa890b6d8be454448e90

Merge the 'Alembic' modifier in the 'Mesh Cache' modifier.

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

M	release/scripts/startup/bl_operators/alembic_import.py
M	release/scripts/startup/bl_ui/properties_data_modifier.py
M	source/blender/alembic/ABC_alembic.h
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
D	source/blender/modifiers/intern/MOD_alembic.c
M	source/blender/modifiers/intern/MOD_meshcache.c
A	source/blender/modifiers/intern/MOD_meshcache_abc.c
M	source/blender/modifiers/intern/MOD_meshcache_util.h
M	source/blender/modifiers/intern/MOD_util.c

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

diff --git a/release/scripts/startup/bl_operators/alembic_import.py b/release/scripts/startup/bl_operators/alembic_import.py
index 38bf70a..e084009 100644
--- a/release/scripts/startup/bl_operators/alembic_import.py
+++ b/release/scripts/startup/bl_operators/alembic_import.py
@@ -137,12 +137,12 @@ def _import_abc(filename, sub_object, object_name=None, object_type='mesh', free
     bpy.context.scene.update()
 
     if object_type in ('mesh', 'nurb'):
-        # Set Alembic modifier
-        mod = obj.modifiers.new(type="ALEMBIC", name="Abc")
-        mod.use_materials = 0
-        mod.use_vertices = 1
+        # Set cache modifier
+        mod = obj.modifiers.new(type="MESH_CACHE", name="Mesh Cache")
+        mod.cache_format = 'ABC'
+        mod.time_mode = 'TIME'
         mod.filepath = filename
-        mod.subobject = sub_object
+        mod.sub_object = sub_object
 
     if freeze:
         obj.lock_location[0] = True
diff --git a/release/scripts/startup/bl_ui/properties_data_modifier.py b/release/scripts/startup/bl_ui/properties_data_modifier.py
index 32981c7..b9ba4d2 100644
--- a/release/scripts/startup/bl_ui/properties_data_modifier.py
+++ b/release/scripts/startup/bl_ui/properties_data_modifier.py
@@ -185,6 +185,9 @@ class DATA_PT_modifiers(ModifierButtonsPanel, Panel):
         layout.prop(md, "cache_format")
         layout.prop(md, "filepath")
 
+        if md.cache_format == 'ABC':
+            layout.prop(md, "sub_object")
+
         layout.label(text="Evaluation:")
         layout.prop(md, "factor", slider=True)
         layout.prop(md, "deform_mode")
@@ -1386,13 +1389,6 @@ class DATA_PT_modifiers(ModifierButtonsPanel, Panel):
         sub = row.row(align=True)
         sub.active = bool(md.vertex_group)
         sub.prop(md, "invert_vertex_group", text="", icon='ARROW_LEFTRIGHT')
-        
-    def ALEMBIC(self, layout, ob, md):
-        split = layout.split()
-        col = split.column()
-        col.prop(md, "filepath", text="Alembic cache file")
-        col.prop(md, "subobject", text="Alembic sub object")
-        col.prop(md, "startframe", text="Start:")
 
     def NORMAL_EDIT(self, layout, ob, md):
         has_vgroup = bool(md.vertex_group)
diff --git a/source/blender/alembic/ABC_alembic.h b/source/blender/alembic/ABC_alembic.h
index 26af2a6..a274c9f 100644
--- a/source/blender/alembic/ABC_alembic.h
+++ b/source/blender/alembic/ABC_alembic.h
@@ -38,7 +38,7 @@ struct Scene;
 #define BL_ABC_NO_ERR 0
 #define BL_ABC_UNKNOWN_ERROR 1
 
-int ABC_export( Scene *sce, const char *filename,
+int ABC_export(struct Scene *sce, const char *filename,
 				double start, double end,
 				double xformstep, double geomstep,
 				double shutter_open, double shutter_close,
@@ -54,17 +54,17 @@ int ABC_export( Scene *sce, const char *filename,
 				bool packuv
 				);
 
-struct DerivedMesh *abcGetDerivedMesh(const char* filepath, float time, void* mesh_data, Object* ob, int assign_mat, const char* sub_obj);
+struct DerivedMesh *abcGetDerivedMesh(const char* filepath, float time, void* mesh_data, struct Object* ob, int assign_mat, const char* sub_obj);
 void 			abcGetVertexCache(const char* filepath, float time, void *key, void* verts, int max_verts, const char* sub_obj, int is_mvert);
-Mesh* 			abcGetMesh(const char* filepath, float time, void *key, int assign_mats, const char* sub_obj, bool *p_only);
-struct Curve* 	abcGetNurbs(const char* filepath, float time, const char* sub_obj);
-void 			abcApplyMaterials(Object *ob, void* key);
+struct Mesh *abcGetMesh(const char* filepath, float time, void *key, int assign_mats, const char* sub_obj, bool *p_only);
+struct Curve *abcGetNurbs(const char* filepath, float time, const char* sub_obj);
+void 			abcApplyMaterials(struct Object *ob, void* key);
 
 void 			ABC_getObjects(const char *filename, char* result);
 void 			ABC_getNurbs(const char *filename, char* result);
 void 			ABC_getCamera(const char *filename, char* result);
 void 			ABC_getTransform(const char *filename, const char* abc_subobject, float time, float mat[][4], int to_y_up);
-void		 	ABC_setCustomProperties(Object* bobj);
+void		 	ABC_setCustomProperties(struct Object* bobj);
 void 			ABC_set_camera(const char* filename, const char* abc_subobject, float time, struct Camera* bcam);
 void 			abcDestroyMeshData(void* key);
 int 			checkSubobjectValid(const char* name, const char* sub_obj);
diff --git a/source/blender/makesdna/DNA_modifier_types.h b/source/blender/makesdna/DNA_modifier_types.h
index 38d0cee..03dbcaa 100644
--- a/source/blender/makesdna/DNA_modifier_types.h
+++ b/source/blender/makesdna/DNA_modifier_types.h
@@ -85,7 +85,6 @@ typedef enum ModifierType {
 	eModifierType_DataTransfer      = 49,
 	eModifierType_NormalEdit        = 50,
 	eModifierType_CorrectiveSmooth  = 51,
-	eModifierType_Alembic           = 52,
 	NUM_MODIFIER_TYPES
 } ModifierType;
 
@@ -1274,22 +1273,6 @@ typedef struct TriangulateModifierData {
 	int pad;
 } TriangulateModifierData;
 
-/* AlembicModifierData.flag */
-enum {
-	MOD_ALEMBIC_VERTS = (1 << 0),
-    MOD_ALEMBIC_ASSIGN_MATS = (1 << 1),
-	MOD_ALEMBIC_DISABLED = (1 << 3),
-};
-
-/* Alembic modifier */
-typedef struct AlembicModifierData {
-	ModifierData modifier;
-
-	int   flag, frame_start;
-	char  cache_filename[1024];
-	char  sub_object[1024];
-} AlembicModifierData;
-
 #ifdef DNA_DEPRECATED
 enum {
 	MOD_TRIANGULATE_BEAUTY = (1 << 0), /* deprecated */
@@ -1416,11 +1399,13 @@ typedef struct MeshCacheModifierData {
 	float eval_factor;
 
 	char filepath[1024];  /* FILE_MAX */
+	char sub_object[1024];  /* Alembic sub object */
 } MeshCacheModifierData;
 
 enum {
 	MOD_MESHCACHE_TYPE_MDD  = 1,
 	MOD_MESHCACHE_TYPE_PC2  = 2,
+	MOD_MESHCACHE_TYPE_ABC  = 3,
 };
 
 enum {
diff --git a/source/blender/makesrna/RNA_access.h b/source/blender/makesrna/RNA_access.h
index a5e7809..3a19211 100644
--- a/source/blender/makesrna/RNA_access.h
+++ b/source/blender/makesrna/RNA_access.h
@@ -58,7 +58,6 @@ extern StructRNA RNA_ActuatorSensor;
 extern StructRNA RNA_Addon;
 extern StructRNA RNA_AddonPreferences;
 extern StructRNA RNA_AdjustmentSequence;
-extern StructRNA RNA_AlembicModifier;
 extern StructRNA RNA_AlwaysSensor;
 extern StructRNA RNA_AndController;
 extern StructRNA RNA_AnimData;
diff --git a/source/blender/makesrna/intern/rna_modifier.c b/source/blender/makesrna/intern/rna_modifier.c
index e6982ac..47d2faf 100644
--- a/source/blender/makesrna/intern/rna_modifier.c
+++ b/source/blender/makesrna/intern/rna_modifier.c
@@ -63,7 +63,6 @@
 
 EnumPropertyItem rna_enum_object_modifier_type_items[] = {
 	{0, "", 0, N_("Modify"), ""},
-	{eModifierType_Alembic, "ALEMBIC", ICON_MOD_MESHDEFORM, "Alembic", ""},
 	{eModifierType_DataTransfer, "DATA_TRANSFER", ICON_MOD_DATA_TRANSFER, "Data Transfer", ""},
 	{eModifierType_MeshCache, "MESH_CACHE", ICON_MOD_MESHDEFORM, "Mesh Cache", ""},
 	{eModifierType_NormalEdit, "NORMAL_EDIT", ICON_MOD_NORMALEDIT, "Normal Edit", ""},
@@ -394,8 +393,6 @@ static StructRNA *rna_Modifier_refine(struct PointerRNA *ptr)
 			return &RNA_LaplacianDeformModifier;
 		case eModifierType_Wireframe:
 			return &RNA_WireframeModifier;
-		case eModifierType_Alembic:
-			return &RNA_AlembicModifier;
 		case eModifierType_DataTransfer:
 			return &RNA_DataTransferModifier;
 		case eModifierType_NormalEdit:
@@ -1613,42 +1610,6 @@ static void rna_def_modifier_decimate(BlenderRNA *brna)
 	RNA_def_property_ui_text(prop, "Face Count", "The current number of faces in the decimated mesh");
 }
 
-static void rna_def_modifier_alembic(BlenderRNA *brna)
-{
-	StructRNA *srna;
-	PropertyRNA *prop;
-
-	srna = RNA_def_struct(brna, "AlembicModifier", "Modifier");
-	RNA_def_struct_ui_text(srna, "Alembic Cache Modifier", "Alembic Cache modifier");
-	RNA_def_struct_sdna(srna, "AlembicModifierData");
-	RNA_def_struct_ui_icon(srna, ICON_MOD_MESHDEFORM);
-
-	prop = RNA_def_property(srna, "filepath", PROP_STRING, PROP_FILEPATH);
-	RNA_def_property_string_sdna(prop, NULL, "cache_filename");
-	RNA_def_property_ui_text(prop, "Cache Path", "Path to an Alembic cache");
-	RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
-	prop = RNA_def_property(srna, "subobject", PROP_STRING, PROP_NONE);
-	RNA_def_property_string_sdna(prop, NULL, "sub_object");
-	RNA_def_property_ui_text(prop, "Cache Path", "Path to an Alembic cache");
-	RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
-	prop = RNA_def_property(srna, "use_vertices", PROP_BOOLEAN, PROP_NONE);
-	RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_ALEMBIC_VERTS);
-	RNA_def_property_ui_text(prop, "Use as cache", "Use input vertices");
-	RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
-	prop = RNA_def_property(srna, "use_materials", PROP_BOOLEAN, PROP_NONE);
-	RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_ALEMBIC_ASSIGN_MATS);
-	RNA_def_property_ui_text(prop, "Use materials", "Flag face set as new material");
-	RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
-	prop = RNA_def_property(srna, "startframe", PROP_INT, PROP_NONE);
-	RNA_def_property_int_sdna(prop, NULL, "frame_start");
-	RNA_def_property_ui_text(prop, "Startframe",  "Begin animation cache at this frame");
-	RNA_def_property_update(prop, 0, "rna_Modifier_update");
-}
-
 static void rna_def_modifier_wave(BlenderRNA *brna)
 {
 	StructRNA *srna;
@@ -4119,6 +4080,7 @@ static void rna_def_modifier_meshcache(BlenderRNA *brna)
 	static EnumPropertyItem prop_format_type_items[] = {
 		{MOD_MESHCACHE_TYPE_MDD, "MDD", 0, "MDD ", ""},
 		{MOD_MESHCACHE_TYPE_PC2, "PC2", 0, "PC2", ""},
+	    {MOD_MESHCACHE_TYPE_ABC, "ABC", 0, "Alembic", ""},
 		{0, NULL, 0, NULL, NULL}
 	};
 
@@ -4197,6 +4159,10 @@ static void rna_def_modifier_meshcache(BlenderRNA *brna)
 	RNA_def_property_ui_text(prop, "File Path", "Path to external displacements file");
 	RNA_def_property_update(prop, 0, "rna_Modifier_update");
 
+	prop = RNA_def_property(srna, "sub_object", PROP_STRING, PROP_FILEPATH);
+	RNA_def_property_ui_text(prop, "Object", "Name of the object in the file");
+	RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
 	prop = RNA_def_property(srna, "factor", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "factor");
 	RNA_def_property_range(prop, 0.0f, 1.0f);
@@ -4781,7 +47

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list