nightstyles / alembic

Automatically exported from code.google.com/p/alembic
Other
1 stars 0 forks source link

IXformSchema::getInheritsXforms() crash with no samples #313

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Just got a file from a Nuke export, which was reporting the following info in 
abcecho :

Object name=/Meshes
  CompoundProperty  Name=.xform; Schema=AbcGeom_Xform_v3
    ArrayProperty  Name=.animChans; Interpretation=; DataType=uint32_t; DataTypeExtent=1; ArraySize=0; NumSamps=0
        Values :  No Samples
    ScalarProperty  Name=.inherits; Interpretation=; DataType=bool_t; DataTypeExtent=1; ArraySize=0; NumSamps=0
        Values :  No Samples
Object name=/Meshes/WriteGeo1
  CompoundProperty  Name=.xform; Schema=AbcGeom_Xform_v3
    ArrayProperty  Name=.animChans; Interpretation=; DataType=uint32_t; DataTypeExtent=1; ArraySize=0; NumSamps=0
        Values :  No Samples
    ScalarProperty  Name=.inherits; Interpretation=; DataType=bool_t; DataTypeExtent=1; ArraySize=0; NumSamps=0
        Values :  No Samples
...

And I was getting an exception from getInheritsXform() on the XformSchema.

...
terminate called after throwing an instance of 'Alembic::Util::v6::Exception'
  what():  IXformSchema::getInheritsXforms()
ERROR: EXCEPTION:
Out-of-range acyclic index: -1, range [0-218]
...

Turns out adding a simple check in the function for no samples seem to fix it :

--- a/src/lib/Alembic/AbcGeom/IXform.cpp
+++ b/src/lib/Alembic/AbcGeom/IXform.cpp
@@ -318,6 +318,8 @@ bool IXformSchema::getInheritsXforms( const 
Abc::ISampleSelector &iSS )

     if ( ! m_inheritsProperty ) { return true; }

+    if ( m_inheritsProperty.getNumSamples() == 0 ) { return true; }
+
     AbcA::index_t sampIdx = iSS.getIndex( m_inheritsProperty.getTimeSampling(),
                                           m_inheritsProperty.getNumSamples() );

Cheers
Francois

Original issue reported on code.google.com by skydiver...@gmail.com on 2 Sep 2013 at 4:09

GoogleCodeExporter commented 9 years ago
What Nuke exporter are you using?

Although your fix is uncontroversial the way it's writing out the data looks a 
little suspicious.

Original comment by miller.lucas on 5 Sep 2013 at 9:35

GoogleCodeExporter commented 9 years ago
I'm actually not quite sure what nuke plugin is used to export
the geo, but I agree that the data written out is kind of "broken"
having attributes with no samples at all would lead to very unpredicatable 
results
depending on how you read it ...

The "fix" I made might actually be in the wrong place though, the getIndex()
should probably return -1 nicely and be caught by the "if (sampIdx<0) return 
true;"
just after

Original comment by skydiver...@gmail.com on 5 Sep 2013 at 9:38

GoogleCodeExporter commented 9 years ago
The fix was ok, here is what will go into 1.5.1:
http://code.google.com/r/millerlucas-dev/source/detail?r=202d87477f43014d171767d
bd8c49d7cbba1fc40

I also was more careful about creating that .inherits property with this:

http://code.google.com/r/millerlucas-dev/source/detail?r=4c410af786c1ef75f3a37b9
ba220df5caf4fa0c6

It has a nice side effect of reducing disk space for default identity xforms.

One other suspicious thing about your example is the use of acyclic sampling.

Original comment by miller.lucas on 18 Sep 2013 at 12:03

GoogleCodeExporter commented 9 years ago

Original comment by miller.lucas on 19 Sep 2013 at 8:13

GoogleCodeExporter commented 9 years ago
Thanks for putting that in !

Francois

Original comment by skydiver...@gmail.com on 19 Sep 2013 at 8:26