Alembic procedural: use an enumeration to discriminate IObjects
Using the various IObject::matches() to do so was expensive and would show up in profiles as requires creating std::strings for each call.
This commit is contained in:
parent
d9abcee47e
commit
3d5e290ee0
|
@ -609,6 +609,7 @@ NODE_DEFINE(AlembicObject)
|
|||
|
||||
AlembicObject::AlembicObject() : Node(node_type)
|
||||
{
|
||||
schema_type = INVALID;
|
||||
}
|
||||
|
||||
AlembicObject::~AlembicObject()
|
||||
|
@ -1402,13 +1403,13 @@ void AlembicProcedural::generate(Scene *scene, Progress &progress)
|
|||
continue;
|
||||
}
|
||||
|
||||
if (IPolyMesh::matches(object->iobject.getHeader())) {
|
||||
if (object->schema_type == AlembicObject::POLY_MESH) {
|
||||
read_mesh(scene, object, frame_time, progress);
|
||||
}
|
||||
else if (ICurves::matches(object->iobject.getHeader())) {
|
||||
else if (object->schema_type == AlembicObject::CURVES) {
|
||||
read_curves(scene, object, frame_time, progress);
|
||||
}
|
||||
else if (ISubD::matches(object->iobject.getHeader())) {
|
||||
else if (object->schema_type == AlembicObject::SUBD) {
|
||||
read_subd(scene, object, frame_time, progress);
|
||||
}
|
||||
|
||||
|
@ -1823,6 +1824,7 @@ void AlembicProcedural::walk_hierarchy(
|
|||
if (iter != object_map.end()) {
|
||||
AlembicObject *abc_object = iter->second;
|
||||
abc_object->iobject = subd;
|
||||
abc_object->schema_type = AlembicObject::SUBD;
|
||||
|
||||
if (xform_samples) {
|
||||
abc_object->xform_samples = *xform_samples;
|
||||
|
@ -1840,6 +1842,7 @@ void AlembicProcedural::walk_hierarchy(
|
|||
if (iter != object_map.end()) {
|
||||
AlembicObject *abc_object = iter->second;
|
||||
abc_object->iobject = mesh;
|
||||
abc_object->schema_type = AlembicObject::POLY_MESH;
|
||||
|
||||
if (xform_samples) {
|
||||
abc_object->xform_samples = *xform_samples;
|
||||
|
@ -1857,6 +1860,7 @@ void AlembicProcedural::walk_hierarchy(
|
|||
if (iter != object_map.end()) {
|
||||
AlembicObject *abc_object = iter->second;
|
||||
abc_object->iobject = curves;
|
||||
abc_object->schema_type = AlembicObject::CURVES;
|
||||
|
||||
if (xform_samples) {
|
||||
abc_object->xform_samples = *xform_samples;
|
||||
|
|
|
@ -263,12 +263,24 @@ class AlembicObject : public Node {
|
|||
|
||||
bool has_data_loaded() const;
|
||||
|
||||
/* Enumeration used to speed up the discrimination of an IObject as IObject::matches() methods
|
||||
* are too expensive and show up in profiles. */
|
||||
enum AbcSchemaType {
|
||||
INVALID,
|
||||
POLY_MESH,
|
||||
SUBD,
|
||||
CURVES,
|
||||
};
|
||||
|
||||
bool need_shader_update = true;
|
||||
|
||||
MatrixSampleMap xform_samples;
|
||||
Alembic::AbcGeom::IObject iobject;
|
||||
Transform xform;
|
||||
|
||||
/* Set if the path points to a valid IObject whose type is supported. */
|
||||
AbcSchemaType schema_type;
|
||||
|
||||
CachedData &get_cached_data()
|
||||
{
|
||||
return cached_data;
|
||||
|
|
Loading…
Reference in New Issue