コード例 #1
0
ファイル: Options.cpp プロジェクト: AtomicFiction/cortex
void Options::load( LoadContextPtr context )
{
	PreWorldRenderable::load( context );
	unsigned int v = m_ioVersion;
	ConstIndexedIOPtr container = context->container( staticTypeName(), v );
	m_options = context->load<CompoundData>( container.get(), g_optionsEntry );
}
コード例 #2
0
void MatrixTransform::load( LoadContextPtr context )
{
	Transform::load( context );
	unsigned int v = m_ioVersion;
	ConstIndexedIOPtr container = context->container( staticTypeName(), v );
	float *f = matrix.getValue();
	container->read( g_matrixEntry, f, 16 );
}
コード例 #3
0
ファイル: Shader.cpp プロジェクト: AtomicFiction/cortex
void Shader::load( LoadContextPtr context )
{
	StateRenderable::load( context );
	unsigned int v = m_ioVersion;
	ConstIndexedIOPtr container = context->container( staticTypeName(), v );
	container->read( g_nameEntry, m_name );
	container->read( g_typeEntry, m_type );
	m_parameters = context->load<CompoundData>( container.get(), g_parametersEntry );
}
コード例 #4
0
void MatrixMotionTransform::load( LoadContextPtr context )
{
	Transform::load( context );
	unsigned int v = m_ioVersion;

	ConstIndexedIOPtr container = context->container( staticTypeName(), v );
	container = container->subdirectory( g_snapshotsEntry );
	m_snapshots.clear();
	IndexedIO::EntryIDList names;
	container->entryIds( names, IndexedIO::Directory );
	IndexedIO::EntryIDList::const_iterator it;
	for( it=names.begin(); it!=names.end(); it++ )
	{
		ConstIndexedIOPtr snapshotContainer = container->subdirectory( *it );
		float t; snapshotContainer->read( g_timeEntry, t );
		M44f m;
		float *f = m.getValue();
		snapshotContainer->read( g_matrixEntry, f, 16 );
		m_snapshots[t] = m;
	}
}
コード例 #5
0
void ObjectVector::load( LoadContextPtr context )
{
	Object::load( context );
	unsigned int v = m_ioVersion;
	ConstIndexedIOPtr container = context->container( staticTypeName(), v );

	unsigned int size = 0;
	container->read( g_sizeEntry, size );

	m_members.resize( size );
	std::fill( m_members.begin(), m_members.end(), (IECore::Object*)0 );

	ConstIndexedIOPtr ioMembers = container->subdirectory( g_membersEntry );

	IndexedIO::EntryIDList l;
	ioMembers->entryIds(l);
	for( IndexedIO::EntryIDList::const_iterator it=l.begin(); it!=l.end(); it++ )
	{
		MemberContainer::size_type i = boost::lexical_cast<MemberContainer::size_type>( (*it).value() );
		m_members[i] = context->load<Object>( ioMembers, *it );
	}
}
コード例 #6
0
void PathMatcherData::load( LoadContextPtr context )
{
	Data::load( context );
	unsigned int v = g_ioVersion;
	ConstIndexedIOPtr container = context->container( staticTypeName(), v );

	const IndexedIO::Entry stringsEntry = container->entry( "strings" );
	std::vector<InternedString> strings;
	strings.resize( stringsEntry.arrayLength() );
	InternedString *stringsPtr = strings.data();
	container->read( "strings", stringsPtr, stringsEntry.arrayLength() );

	const IndexedIO::Entry pathLengthsEntry = container->entry( "pathLengths" );
	std::vector<unsigned int> pathLengths;
	pathLengths.resize( pathLengthsEntry.arrayLength() );
	unsigned int *pathLengthsPtr = pathLengths.data();
	container->read( "pathLengths", pathLengthsPtr, pathLengthsEntry.arrayLength() );

	const IndexedIO::Entry exactMatchesEntry = container->entry( "exactMatches" );
	std::vector<unsigned char> exactMatches;
	exactMatches.resize( exactMatchesEntry.arrayLength() );
	unsigned char *exactMatchesPtr = exactMatches.data();
	container->read( "exactMatches", exactMatchesPtr, exactMatchesEntry.arrayLength() );

	std::vector<InternedString> path;
	for( size_t i = 0, e = pathLengths.size(); i < e; ++i )
	{
		path.resize( pathLengths[i] );
		if( pathLengths[i] )
		{
			path.back() = *stringsPtr++;
		}
		if( exactMatches[i] )
		{
			writable().addPath( path );
		}
	}
}
コード例 #7
0
ファイル: TimePeriodData.cpp プロジェクト: Shockspot/cortex
void TypedData< TimePeriod >::load( LoadContextPtr context )
{
	Data::load( context );

	unsigned int v = 0;

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

	std::string beginStr;
	container->read( g_beginEntry, beginStr );
	boost::posix_time::ptime begin;
	try
	{
		begin = boost::posix_time::from_iso_string( beginStr );
	}
	catch ( boost::bad_lexical_cast )
	{
		/// Do these checks here instead of first as they're likely to be the least-used cases.
		if ( beginStr == "not-a-date-time" )
		{
			begin = boost::posix_time::not_a_date_time;
		}
		else if ( beginStr == "+infinity" )
		{
			begin = boost::posix_time::pos_infin;
		}
		else if ( beginStr == "-infinity" )
		{
			begin = boost::posix_time::neg_infin;
		}
		else
		{
			throw;
		}
	}

	std::string endStr;
	container->read( g_endEntry, endStr );
	boost::posix_time::ptime end;
	try
	{
		end = boost::posix_time::from_iso_string( endStr );
	}
	catch ( boost::bad_lexical_cast )
	{
		/// Do these checks here instead of first as they're likely to be the least-used cases.
		if ( endStr == "not-a-date-time" )
		{
			end = boost::posix_time::not_a_date_time;
		}
		else if ( endStr == "+infinity" )
		{
			end = boost::posix_time::pos_infin;
		}
		else if ( endStr == "-infinity" )
		{
			end = boost::posix_time::neg_infin;
		}
		else
		{
			throw;
		}
	}

	writable() = boost::posix_time::time_period( begin, end );
}