void ImagePrimitive::load(IECore::Object::LoadContextPtr context)
{
	assert( context );

	Primitive::load(context);
	unsigned int v = m_ioVersion;

	ConstIndexedIOPtr container = context->container(staticTypeName(), v);

	container->read(g_displayWindowMinXEntry, m_displayWindow.min.x);
	container->read(g_displayWindowMinYEntry, m_displayWindow.min.y);
	container->read(g_displayWindowMaxXEntry, m_displayWindow.max.x);
	container->read(g_displayWindowMaxYEntry, m_displayWindow.max.y);

	if ( v < 1 )
	{
		m_dataWindow = m_displayWindow;
	}
	else
	{
		container->read(g_dataWindowMinXEntry, m_dataWindow.min.x);
		container->read(g_dataWindowMinYEntry, m_dataWindow.min.y);
		container->read(g_dataWindowMaxXEntry, m_dataWindow.max.x);
		container->read(g_dataWindowMaxYEntry, m_dataWindow.max.y);
	}
}
Exemple #2
0
		void load( IECore::Object::LoadContextPtr context )
		{
			unsigned int v = g_ioVersion;
			ConstIndexedIOPtr container = context->container( staticTypeName(), v );

			ConstIndexedIOPtr shaders = container->subdirectory( "shaders" );
			IndexedIO::EntryIDList handles;
			shaders->entryIds( handles, IndexedIO::Directory );
			for( const auto &handle : handles )
			{
				ShaderPtr shader = context->load<Shader>( shaders.get(), handle );
				setShader( handle, shader.get() );
			}

			ConstIndexedIOPtr connections = container->subdirectory( "connections" );
			IndexedIO::EntryIDList connectionIndices;
			for( const auto &connectionIndex : connectionIndices )
			{
				InternedString c[4];
				InternedString *cp = c;
				connections->read( connectionIndex, cp, 4 );
				addConnection(
					Connection( Parameter( cp[0], cp[1] ), Parameter( cp[2], cp[3] ) )
				);
			}

			InternedString o[2];
			InternedString *op = o;
			container->read( "output", op, 2 );
			m_output = Parameter( op[0], op[1] );
		}
Exemple #3
0
PrimitiveVariableMap Primitive::loadPrimitiveVariables( const IndexedIO *ioInterface, const IndexedIO::EntryID &name, const IndexedIO::EntryIDList &primVarNames )
{
    IECore::Object::LoadContextPtr context = new Object::LoadContext( ioInterface->subdirectory( name )->subdirectory( g_dataEntry ) );

    unsigned int v = m_ioVersion;
    ConstIndexedIOPtr container = context->container( Primitive::staticTypeName(), v );
    if ( !container )
    {
        throw Exception( "Could not find Primitive entry in the file!" );
    }
    ConstIndexedIOPtr ioVariables = container->subdirectory( g_variablesEntry );

    PrimitiveVariableMap variables;
    IndexedIO::EntryIDList::const_iterator it;
    for( it=primVarNames.begin(); it!=primVarNames.end(); it++ )
    {
        ConstIndexedIOPtr ioPrimVar = ioVariables->subdirectory( *it, IndexedIO::NullIfMissing );
        if ( !ioPrimVar )
        {
            continue;
        }
        int i;
        ioPrimVar->read( g_interpolationEntry, i );
        variables.insert(
            PrimitiveVariableMap::value_type( *it, PrimitiveVariable( (PrimitiveVariable::Interpolation)i, context->load<Data>( ioPrimVar.get(), g_dataEntry ) ) )
        );
    }

    return variables;
}
Exemple #4
0
void Primitive::load( IECore::Object::LoadContextPtr context )
{
    unsigned int v = m_ioVersion;
    ConstIndexedIOPtr container = context->container( staticTypeName(), v );

    // we changed the inheritance hierarchy at io version 1
    if( v==0 )
    {
        Renderable::load( context );
    }
    else
    {
        VisibleRenderable::load( context );
    }

    ConstIndexedIOPtr ioVariables = container->subdirectory( g_variablesEntry );

    variables.clear();
    IndexedIO::EntryIDList names;
    ioVariables->entryIds( names, IndexedIO::Directory );
    IndexedIO::EntryIDList::const_iterator it;
    for( it=names.begin(); it!=names.end(); it++ )
    {
        ConstIndexedIOPtr ioPrimVar = ioVariables->subdirectory( *it );
        int i;
        ioPrimVar->read( g_interpolationEntry, i );
        variables.insert(
            PrimitiveVariableMap::value_type( *it, PrimitiveVariable( (PrimitiveVariable::Interpolation)i, context->load<Data>( ioPrimVar.get(), g_dataEntry ) ) )
        );
    }
}
void SmoothSkinningData::load( IECore::Object::LoadContextPtr context )
{
	Data::load(context);
	unsigned int v = m_ioVersion;

	ConstIndexedIOPtr container = context->container( staticTypeName(), v );

	m_influenceNames = context->load<StringVectorData>( container.get(), g_influenceNamesEntry );
	m_influencePose = context->load<M44fVectorData>( container.get(), g_influencePoseEntry );
	m_pointIndexOffsets = context->load<IntVectorData>( container.get(), g_pointIndexOffsetsEntry );
	m_pointInfluenceCounts = context->load<IntVectorData>( container.get(), g_pointInfluenceCountsEntry );
	m_pointInfluenceIndices = context->load<IntVectorData>( container.get(), g_pointInfluenceIndicesEntry );
	m_pointInfluenceWeights = context->load<FloatVectorData>( container.get(), g_pointInfluenceWeightsEntry );

}
Exemple #6
0
void MeshPrimitive::load( IECore::Object::LoadContextPtr context )
{
    Primitive::load(context);
    unsigned int v = m_ioVersion;

    ConstIndexedIOPtr container = context->container( staticTypeName(), v );

    m_verticesPerFace = context->load<IntVectorData>( container, g_verticesPerFaceEntry );
    m_vertexIds = context->load<IntVectorData>( container, g_vertexIdsEntry );

    unsigned int numVertices;
    container->read( g_numVerticesEntry, numVertices );
    m_numVertices = numVertices;

    container->read( g_interpolationEntry, m_interpolation );
}
void CurvesPrimitive::load( IECore::Object::LoadContextPtr context )
{
	Primitive::load( context );
	unsigned int v = m_ioVersion;

	ConstIndexedIOPtr container = context->container( staticTypeName(), v );
	float *f = m_basis.matrix.getValue();
	container->read( g_basisMatrixEntry, f, 16 );
	container->read( g_basisStepEntry, m_basis.step );
	m_linear = m_basis==CubicBasisf::linear();
	int p = 0;
	container->read( g_periodicEntry, p );
	m_periodic = p;
	m_vertsPerCurve = context->load<IntVectorData>( container.get(), g_verticesPerCurveEntry );
	container->read( g_numVertsEntry, m_numVerts );
	container->read( g_numFaceVaryingEntry, m_numFaceVarying );
}
void NURBSPrimitive::load( IECore::Object::LoadContextPtr context )
{
	Primitive::load(context);
	unsigned int v = m_ioVersion;

	ConstIndexedIOPtr container = context->container( staticTypeName(), v );

	container->read( g_uOrderEntry, m_uOrder );
	m_uKnot = context->load<FloatVectorData>( container.get(), g_uKnotEntry );
	container->read( g_uMinEntry, m_uMin );
	container->read( g_uMaxEntry, m_uMax );

	container->read( g_vOrderEntry, m_vOrder );
	m_vKnot = context->load<FloatVectorData>( container.get(), g_vKnotEntry );
	container->read( g_vMinEntry, m_vMin );
	container->read( g_vMaxEntry, m_vMax );
}
void MotionPrimitive::load( IECore::Object::LoadContextPtr context )
{
	VisibleRenderable::load( context );
	unsigned int v = m_ioVersion;
	ConstIndexedIOPtr container = context->container( staticTypeName(), v );
	ConstIndexedIOPtr snapshots = container->subdirectory( g_snapshotsEntry );
	m_snapshots.clear();
	IndexedIO::EntryIDList names;
	snapshots->entryIds( names, IndexedIO::Directory );
	IndexedIO::EntryIDList::const_iterator it;
	for( it=names.begin(); it!=names.end(); it++ )
	{
		ConstIndexedIOPtr snapshot = snapshots->subdirectory( *it );
		float t; 
		snapshot->read( g_timeEntry, t );
		m_snapshots[t] = context->load<Primitive>( snapshot, g_primitiveEntry );
	}
}