[Bf-blender-cvs] [8547816] alembic_basic_io: Remove custom ID properties writing code for now.

Kévin Dietrich noreply at git.blender.org
Mon Jun 20 18:59:40 CEST 2016


Commit: 8547816ca2f31fdfab6f95dfff5dd50f179ba6c1
Author: Kévin Dietrich
Date:   Mon Jun 20 18:45:08 2016 +0200
Branches: alembic_basic_io
https://developer.blender.org/rB8547816ca2f31fdfab6f95dfff5dd50f179ba6c1

Remove custom ID properties writing code for now.

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

M	source/blender/alembic/intern/abc_camera.cc
M	source/blender/alembic/intern/abc_exporter.cc
M	source/blender/alembic/intern/abc_mesh.cc
M	source/blender/alembic/intern/abc_object.cc
M	source/blender/alembic/intern/abc_object.h
M	source/blender/alembic/intern/abc_transform.cc

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

diff --git a/source/blender/alembic/intern/abc_camera.cc b/source/blender/alembic/intern/abc_camera.cc
index 5928777..dcd4788 100644
--- a/source/blender/alembic/intern/abc_camera.cc
+++ b/source/blender/alembic/intern/abc_camera.cc
@@ -66,14 +66,6 @@ AbcCameraWriter::AbcCameraWriter(Scene *scene,
 
 void AbcCameraWriter::do_write()
 {
-	if (m_first_frame) {
-		ID *id = static_cast<ID *>(m_object->data);
-
-		if (hasProperties(id)) {
-			writeProperties(id, m_camera_schema.getUserProperties(), true);
-		}
-	}
-
 	Camera *cam = static_cast<Camera *>(m_object->data);
 
 	m_stereo_distance.set(cam->stereo.convergence_distance);
diff --git a/source/blender/alembic/intern/abc_exporter.cc b/source/blender/alembic/intern/abc_exporter.cc
index e7eb0c1..16ab176 100644
--- a/source/blender/alembic/intern/abc_exporter.cc
+++ b/source/blender/alembic/intern/abc_exporter.cc
@@ -458,36 +458,6 @@ void AbcExporter::createShapeWriter(Object *ob, Object *dupliObParent)
 		return;
 	}
 
-	int enable_hair = true;
-	int enable_hair_child = true;
-	int enable_geo = true;
-
-	ID *id = reinterpret_cast<ID *>(ob);
-	IDProperty *xport_props = IDP_GetProperties(id, 0);
-
-	/* Check for special export object flags. */
-	if (xport_props) {
-		IDProperty *enable_prop = IDP_GetPropertyFromGroup(xport_props, "abc_hair");
-		if (enable_prop) {
-			enable_hair = IDP_Int(enable_prop);
-		}
-
-		enable_prop = IDP_GetPropertyFromGroup(xport_props, "abc_geo");
-		if (enable_prop) {
-			if (IDP_Int(enable_prop) == 2) {
-				enable_geo = false;
-			}
-			else {
-				enable_geo = IDP_Int(enable_prop);
-			}
-		}
-
-		enable_prop = IDP_GetPropertyFromGroup(xport_props, "abc_hair_child");
-		if (enable_prop) {
-			enable_hair_child = IDP_Int(enable_prop);
-		}
-	}
-
 	ParticleSystem *psys = static_cast<ParticleSystem *>(ob->particlesystem.first);
 
 	for (; psys; psys = psys->next) {
@@ -495,8 +465,8 @@ void AbcExporter::createShapeWriter(Object *ob, Object *dupliObParent)
 			continue;
 		}
 
-		if ((psys->part->type == PART_HAIR) && enable_hair) {
-			m_settings.export_child_hairs = enable_hair_child;
+		if (psys->part->type == PART_HAIR) {
+			m_settings.export_child_hairs = true;
 			m_shapes.push_back(new AbcHairWriter(m_scene, ob, xform, m_shape_sampling_index, m_settings, psys));
 		}
 		else if (psys->part->type == PART_EMITTER) {
@@ -507,30 +477,24 @@ void AbcExporter::createShapeWriter(Object *ob, Object *dupliObParent)
 	switch(ob->type) {
 		case OB_MESH:
 		{
-			if (enable_geo) {
-				Mesh *me = static_cast<Mesh *>(ob->data);
-
-				if (!me || me->totvert == 0) {
-					return;
-				}
+			Mesh *me = static_cast<Mesh *>(ob->data);
 
-				m_shapes.push_back(new AbcMeshWriter(m_scene, ob, xform, m_shape_sampling_index, m_settings));
+			if (!me || me->totvert == 0) {
+				return;
 			}
 
+			m_shapes.push_back(new AbcMeshWriter(m_scene, ob, xform, m_shape_sampling_index, m_settings));
 			break;
 		}
 		case OB_SURF:
 		{
-			if (enable_geo) {
-				Curve *cu = static_cast<Curve *>(ob->data);
-
-				if (!cu) {
-					return;
-				}
+			Curve *cu = static_cast<Curve *>(ob->data);
 
-				m_shapes.push_back(new AbcNurbsWriter(m_scene, ob, xform, m_shape_sampling_index, m_settings));
+			if (!cu) {
+				return;
 			}
 
+			m_shapes.push_back(new AbcNurbsWriter(m_scene, ob, xform, m_shape_sampling_index, m_settings));
 			break;
 		}
 		case OB_CAMERA:
diff --git a/source/blender/alembic/intern/abc_mesh.cc b/source/blender/alembic/intern/abc_mesh.cc
index 38fb02d..6b9ca23 100644
--- a/source/blender/alembic/intern/abc_mesh.cc
+++ b/source/blender/alembic/intern/abc_mesh.cc
@@ -488,17 +488,6 @@ void AbcMeshWriter::writeCommonData(DerivedMesh *dm, Schema &schema)
 		samp.setFaces(Int32ArraySample(it->second));
 		face_set.getSchema().set(samp);
 	}
-
-	if (hasProperties(reinterpret_cast<ID *>(m_object->data))) {
-		if (m_settings.export_props_as_geo_params) {
-			writeProperties(reinterpret_cast<ID *>(m_object->data),
-			                schema.getArbGeomParams(), false);
-		}
-		else {
-			writeProperties(reinterpret_cast<ID *>(m_object->data),
-			                schema.getUserProperties(), true);
-		}
-	}
 }
 
 DerivedMesh *AbcMeshWriter::getFinalMesh()
diff --git a/source/blender/alembic/intern/abc_object.cc b/source/blender/alembic/intern/abc_object.cc
index 5b9c093..1eabf91 100644
--- a/source/blender/alembic/intern/abc_object.cc
+++ b/source/blender/alembic/intern/abc_object.cc
@@ -113,229 +113,6 @@ void AbcObjectWriter::write()
 	m_first_frame = false;
 }
 
-bool AbcObjectWriter::hasProperties(ID *id)
-{
-	IDProperty *idgroup = IDP_GetProperties(id, false);
-	getAllProperties(idgroup, m_props, "");
-	return !m_props.empty();
-}
-
-void AbcObjectWriter::writeProperties(ID *id, const OCompoundProperty &props, bool writeAsUserData)
-{
-	for (int i = 0, e = m_props.size(); i < e; ++i) {
-		if (props.getPropertyHeader(m_props[i].first)){
-			continue;
-		}
-
-		if (writeAsUserData) {
-			writeProperty(m_props[i].second, m_props[i].first, props);
-		}
-		else {
-			writeGeomProperty(m_props[i].second, m_props[i].first, props);
-		}
-	}
-}
-
-void AbcObjectWriter::getAllProperties(IDProperty *group,
-                                       std::vector<std::pair<std::string, IDProperty *> > &allProps,
-                                       const std::string &parent)
-{
-	if (!group) {
-		return;
-	}
-
-	const char *separator = ".";
-
-	IDProperty *prop = static_cast<IDProperty *>(group->data.group.first);
-
-	while (prop) {
-		switch (prop->type) {
-			case IDP_STRING:
-			case IDP_INT:
-			case IDP_FLOAT:
-			case IDP_DOUBLE:
-			{
-				std::string name(parent);
-
-				if (!name.empty()) {
-					name.append(separator);
-				}
-
-				name.append(prop->name);
-				allProps.push_back(std::make_pair(name, prop));
-
-				break;
-			}
-			case IDP_GROUP:
-			{
-				/* ignore ui properties */
-				if (STREQ("_RNA_UI", prop->name)) {
-					std::string name(parent);
-
-					if (!name.empty()) {
-						name.append(separator);
-					}
-
-					name.append(prop->name);
-					getAllProperties(prop, allProps, name);
-				}
-
-				break;
-			}
-			case IDP_ARRAY:
-			case IDP_ID:
-			case IDP_IDPARRAY:
-			break;
-		}
-
-		prop = prop->next;
-	}
-}
-
-void AbcObjectWriter::writeArrayProperty(IDProperty *p, const OCompoundProperty &abcProps)
-{
-	std::string name(p->name);
-
-	switch (p->subtype) {
-		case IDP_INT:
-		{
-			OInt32ArrayProperty op(abcProps, name);
-			op.set(OInt32ArrayProperty::sample_type(static_cast<int *>(IDP_Array(p)), p->len));
-			break;
-		}
-		case IDP_FLOAT:
-		{
-			OFloatArrayProperty op(abcProps, name);
-			op.set(OFloatArrayProperty::sample_type(static_cast<float *>(IDP_Array(p)), p->len));
-			break;
-		}
-		case IDP_DOUBLE:
-		{
-			ODoubleArrayProperty op(abcProps, name);
-			op.set(ODoubleArrayProperty::sample_type(static_cast<double *>(IDP_Array(p)), p->len));
-			break;
-		}
-	}
-}
-
-void AbcObjectWriter::writeProperty(IDProperty *p, const std::string &name, const OCompoundProperty &abcProps)
-{
-	switch (p->type) {
-		case IDP_STRING:
-		{
-			OStringProperty op(abcProps, name);
-			op.set(IDP_String(p));
-			break;
-		}
-		case IDP_INT:
-		{
-			OInt32Property op(abcProps, name);
-			op.set(IDP_Int(p));
-			break;
-		}
-		case IDP_FLOAT:
-		{
-			OFloatProperty op(abcProps, name);
-			op.set(IDP_Float(p));
-			break;
-		}
-		case IDP_DOUBLE:
-		{
-			ODoubleProperty op(abcProps, name);
-			op.set(IDP_Double(p));
-			break;
-		}
-		case IDP_ARRAY:
-		{
-			writeArrayProperty(p, abcProps);
-			break;
-		}
-		case IDP_ID:
-		case IDP_IDPARRAY:
-		case IDP_GROUP:
-			break;
-	}
-}
-
-void AbcObjectWriter::writeGeomProperty(IDProperty *p, const std::string &name, const OCompoundProperty &abcProps)
-{
-	switch (p->type) {
-		case IDP_STRING:
-		{
-			std::string val = IDP_String(p);
-			Alembic::AbcGeom::OStringGeomParam param(abcProps, name, false, Alembic::AbcGeom::kConstantScope, 1, 0);
-			Alembic::AbcGeom::OStringGeomParam::Sample samp;
-			samp.setScope(Alembic::AbcGeom::kConstantScope);
-			samp.setVals(Alembic::AbcGeom::StringArraySample(&val, 1));
-			param.set(samp);
-
-			break;
-		}
-		case IDP_INT:
-		{
-			int val = IDP_Int(p);
-			Alembic::AbcGeom::OInt32GeomParam param(abcProps, name, false, Alembic::AbcGeom::kConstantScope, 1, 0);
-			Alembic::AbcGeom::OInt32GeomParam::Sample samp;
-			samp.setScope(Alembic::AbcGeom::kConstantScope);
-			samp.setVals(Alembic::AbcGeom::Int32ArraySample(&val, 1));
-			param.set(samp);
-
-			break;
-		}
-		case IDP_FLOAT:
-		{
-			float val = IDP_Float(p);
-			Alembic::AbcGeom::OFloatGeomParam param(abcProps, name, false, Alembic::AbcGeom::kConstantScope, 1, 0);
-			Alembic::AbcGeom::OFloatGeomParam::Sample samp;
-			samp.setScope(Alembic::AbcGeom::kConstantScope);
-			samp.setVals(Alembic::AbcGeom::FloatArraySample(&val, 1));
-			param.set(samp);
-
-			break;
-		}
-		case IDP_DOUBLE:
-		{
-			double val = IDP_Double(p);
-			Alembic::AbcGeom::ODoubleGeomParam param(abcProps, name, false, Alembic::AbcGeom::kConstantScope, 1, 0);
-			Alembic::AbcGeom::ODoubleGeomParam::Sample samp;
-			samp.setScope(Alembic::AbcGeom::kConstantScope);
-			samp.setVals(Alembic::AbcGeom::DoubleArraySample(&val, 1));
-			param.set(samp);
-
-			break;
-		}
-		case IDP_ARRAY:
-		case IDP_IDPARRAY:
-		case IDP_GROUP:
-		case IDP_ID:
-			break;
-	}
-}
-
-bool AbcObjectWriter::getPropertyValue(ID *id, const std::string &name, double &val)
-{
-	IDProperty *idgroup = IDP_GetProperties(id, false);
-	IDProperty *prop = IDP_GetPropertyFromGroup(idgroup, name.c_str());
-
-	if (prop) {
-		switch (prop->type) {
-			case IDP_FLOAT:
-				val = IDP_Float(prop);
-				return true;
-
-			case IDP_DOUBLE:
-				val = IDP_Double(prop);
-				return true;
-
-			case IDP_INT:
-				val = IDP_Int(prop);
-				return true;
-		}
-	}
-
-	return false;
-}
-
 /* ************************************************************************** */
 
 AbcObjectReader::AbcObjectReader(const IObject &object, ImportSettings &settings)
diff --git a/source/blender/alembic/intern/abc_object.h b/source/blender/alembic/intern/abc_object.h
index 62fd121..5283bc9 100644
--- a/source/blender/alembic/intern/abc_object.h
+++ b/source/blender/alembic/intern/abc_object.h
@@ -70,18 +70,6 @@ public:
 
 

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list