当前位置: 首页>>代码示例>>C++>>正文


C++ iecore::ConstCompoundObjectPtr类代码示例

本文整理汇总了C++中iecore::ConstCompoundObjectPtr的典型用法代码示例。如果您正苦于以下问题:C++ ConstCompoundObjectPtr类的具体用法?C++ ConstCompoundObjectPtr怎么用?C++ ConstCompoundObjectPtr使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了ConstCompoundObjectPtr类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: computeProcessedGlobals

IECore::ConstCompoundObjectPtr DeleteGlobals::computeProcessedGlobals( const Gaffer::Context *context, IECore::ConstCompoundObjectPtr inputGlobals ) const
{
	if( inputGlobals->members().empty() )
	{
		return inputGlobals;
	}

	const std::string names = namesPlug()->getValue();
	const bool invert = invertNamesPlug()->getValue();
	if( !invert && !names.size() )
	{
		return inputGlobals;
	}

	const std::string prefix = namePrefix();

	IECore::CompoundObjectPtr result = new IECore::CompoundObject;
	for( IECore::CompoundObject::ObjectMap::const_iterator it = inputGlobals->members().begin(), eIt = inputGlobals->members().end(); it != eIt; ++it )
	{
		bool keep = true;
		if( boost::starts_with( it->first.c_str(), prefix ) )
		{
			if( matchMultiple( it->first.c_str() + prefix.size(), names.c_str() ) != invert )
			{
				keep = false;
			}
		}
		if( keep )
		{
			result->members()[it->first] = it->second;
		}
	}

	return result;
}
开发者ID:cedriclaunay,项目名称:gaffer,代码行数:35,代码来源:DeleteGlobals.cpp

示例2: computeProcessedAttributes

IECore::ConstCompoundObjectPtr AttributeProcessor::computeProcessedAttributes( const ScenePath &path, const Gaffer::Context *context, IECore::ConstCompoundObjectPtr inputAttributes ) const
{
	if( inputAttributes->members().empty() )
	{
		return inputAttributes;
	}

	const std::string names = namesPlug()->getValue();
	const bool invert = invertNamesPlug()->getValue();

	CompoundObjectPtr result = new CompoundObject;
	for( CompoundObject::ObjectMap::const_iterator it = inputAttributes->members().begin(), eIt = inputAttributes->members().end(); it != eIt; ++it )
	{
		ConstObjectPtr attribute = it->second;
		if( matchMultiple( it->first, names ) != invert )
		{
			attribute = processAttribute( path, context, it->first, attribute.get() );
		}

		if( attribute )
		{
			result->members().insert(
				CompoundObject::ObjectMap::value_type(
					it->first,
					// cast is ok - result is const immediately on
					// returning from this function, and attribute will
					// therefore not be modified.
					boost::const_pointer_cast<Object>( attribute )
				)
			);
		}
	}

	return result;
}
开发者ID:Kthulhu,项目名称:gaffer,代码行数:35,代码来源:AttributeProcessor.cpp

示例3: fullAttributes

IECore::CompoundObjectPtr ScenePlug::fullAttributes( const ScenePath &scenePath ) const
{
	ContextPtr tmpContext = new Context( *Context::current(), Context::Borrowed );
	Context::Scope scopedContext( tmpContext.get() );

	IECore::CompoundObjectPtr result = new IECore::CompoundObject;
	IECore::CompoundObject::ObjectMap &resultMembers = result->members();
	ScenePath path( scenePath );
	while( path.size() )
	{
		tmpContext->set( scenePathContextName, path );
		IECore::ConstCompoundObjectPtr a = attributesPlug()->getValue();
		const IECore::CompoundObject::ObjectMap &aMembers = a->members();
		for( IECore::CompoundObject::ObjectMap::const_iterator it = aMembers.begin(), eIt = aMembers.end(); it != eIt; it++ )
		{
			if( resultMembers.find( it->first ) == resultMembers.end() )
			{
				resultMembers.insert( *it );
			}
		}		
		path.pop_back();
	}
	
	return result;
}
开发者ID:dboogert,项目名称:gaffer,代码行数:25,代码来源:ScenePlug.cpp

示例4: updateLights

void InteractiveRender::updateLights()
{
	if( !m_lightsDirty || !updateLightsPlug()->getValue() )
	{
		return;
	}
	IECore::ConstCompoundObjectPtr globals = inPlug()->globalsPlug()->getValue();
	outputLightsInternal( globals.get(), /* editing = */ true );
	m_lightsDirty = false;
}
开发者ID:Kthulhu,项目名称:gaffer,代码行数:10,代码来源:InteractiveRender.cpp

示例5: updateCamera

void InteractiveRender::updateCamera()
{
	if( !m_cameraDirty || !updateCameraPlug()->getValue() )
	{
		return;
	}
	IECore::ConstCompoundObjectPtr globals = inPlug()->globalsPlug()->getValue();
	{
		EditBlock edit( m_renderer.get(), "option", CompoundDataMap() );
		outputCamera( inPlug(), globals.get(), m_renderer.get() );
	}
	m_cameraDirty = false;
}
开发者ID:daevid,项目名称:gaffer,代码行数:13,代码来源:InteractiveRender.cpp

示例6: updateCoordinateSystems

void InteractiveRender::updateCoordinateSystems()
{
	if( !m_coordinateSystemsDirty || !updateCoordinateSystemsPlug()->getValue() )
	{
		return;
	}

	IECore::ConstCompoundObjectPtr globals = inPlug()->globalsPlug()->getValue();
	{
		EditBlock edit( m_renderer.get(), "attribute", CompoundDataMap() );
		outputCoordinateSystems( inPlug(), globals.get(), m_renderer.get() );
	}
	m_coordinateSystemsDirty = false;
}
开发者ID:Kthulhu,项目名称:gaffer,代码行数:14,代码来源:InteractiveRender.cpp

示例7: computeProcessedGlobals

IECore::ConstCompoundObjectPtr Options::computeProcessedGlobals( const Gaffer::Context *context, IECore::ConstCompoundObjectPtr inputGlobals ) const
{
	const CompoundDataPlug *p = optionsPlug();
	if( !p->children().size() )
	{
		return inputGlobals;
	}

	IECore::CompoundObjectPtr result = new IECore::CompoundObject;
	// Since we're not going to modify any existing members (only add new ones),
	// and our result becomes const on returning it, we can directly reference
	// the input members in our result without copying. Be careful not to modify
	// them though!
	result->members() = inputGlobals->members();

	const std::string prefix = computePrefix( context );

	std::string name;
	for( NameValuePlugIterator it( p ); !it.done(); ++it )
	{
		IECore::DataPtr d = p->memberDataAndName( it->get(), name );
		if( d )
		{
			result->members()[prefix + name] = d;
		}
	}

	return result;
}
开发者ID:ImageEngine,项目名称:gaffer,代码行数:29,代码来源:Options.cpp

示例8: computeProcessedGlobals

IECore::ConstCompoundObjectPtr Displays::computeProcessedGlobals( const Gaffer::Context *context, IECore::ConstCompoundObjectPtr inputGlobals ) const
{
	const CompoundPlug *dsp = displaysPlug(); 
	if( !dsp->children().size() )
	{
		return inputGlobals;
	}
	
	CompoundObjectPtr result = inputGlobals->copy();
	
	// add our displays to the result
	for( InputCompoundPlugIterator it( dsp ); it != it.end(); it++ )
	{
		const CompoundPlug *displayPlug = *it;
		if( displayPlug->getChild<BoolPlug>( "active" )->getValue() )
		{
			std::string name = displayPlug->getChild<StringPlug>( "name" )->getValue();
			std::string type = displayPlug->getChild<StringPlug>( "type" )->getValue();
			std::string data = displayPlug->getChild<StringPlug>( "data" )->getValue();
			if( name.size() && type.size() && data.size() )
			{
				DisplayPtr d = new Display( name, type, data );
				displayPlug->getChild<CompoundDataPlug>( "parameters" )->fillCompoundData( d->parameters() );
				result->members()["display:" + name] = d;
			}
		}
	}
	
	return result;
}
开发者ID:7on7on,项目名称:gaffer,代码行数:30,代码来源:Displays.cpp

示例9: computeProcessedGlobals

IECore::ConstCompoundObjectPtr Set::computeProcessedGlobals( const Gaffer::Context *context, IECore::ConstCompoundObjectPtr inputGlobals ) const
{
	std::string name = namePlug()->getValue();
	if( !name.size() )
	{
		return inputGlobals;
	}

	IECore::CompoundObjectPtr result = new IECore::CompoundObject;
	// Since we're not going to modify any existing members other than the sets,
	// and our result becomes const on returning it, we can directly reference
	// the input members in our result without copying. We have to be careful not
	// to modify the input sets though.
	result->members() = inputGlobals->members();

	CompoundDataPtr sets = new CompoundData;
	if( const CompoundData *inputSets = inputGlobals->member<CompoundData>( "gaffer:sets" ) )
	{
		sets->writable() = inputSets->readable();
	}
	result->members()["gaffer:sets"] = sets;

	ConstObjectPtr set = pathMatcherPlug()->getValue();
	// const cast is acceptable because we're just using it to place a const object into a
	// container that will be treated as const everywhere immediately after return from this method.
	sets->writable()[name] = const_cast<Data *>( static_cast<const Data *>( set.get() ) );

	return result;
}
开发者ID:cedriclaunay,项目名称:gaffer,代码行数:29,代码来源:Set.cpp

示例10: computeProcessedAttributes

IECore::ConstCompoundObjectPtr Attributes::computeProcessedAttributes( const ScenePath &path, const Gaffer::Context *context, IECore::ConstCompoundObjectPtr inputAttributes ) const
{
	const CompoundDataPlug *ap = attributesPlug();
	if( !ap->children().size() )
	{
		return inputAttributes;
	}

	/// \todo You might think that we wouldn't have to check this again
	/// because the base class would have used processesAttributes()
	/// to avoid even calling this function. But that isn't the case for
	/// some reason.
	if( globalPlug()->getValue() )
	{
		return inputAttributes;
	}

	CompoundObjectPtr result = new CompoundObject;
	// Since we're not going to modify any existing members (only add new ones),
	// and our result becomes const on returning it, we can directly reference
	// the input members in our result without copying. Be careful not to modify
	// them though!
	result->members() = inputAttributes->members();

	ap->fillCompoundObject( result->members() );

	return result;
}
开发者ID:HughMacdonald,项目名称:gaffer,代码行数:28,代码来源:Attributes.cpp

示例11: computeProcessedAttributes

IECore::ConstCompoundObjectPtr AttributeProcessor::computeProcessedAttributes( const ScenePath &path, const Gaffer::Context *context, IECore::ConstCompoundObjectPtr inputAttributes ) const
{
	if( inputAttributes->members().empty() )
	{
		return inputAttributes;
	}
		
	/// \todo See todos about name matching in PrimitiveVariableProcessor.
	typedef boost::tokenizer<boost::char_separator<char> > Tokenizer;
	std::string namesValue = namesPlug()->getValue();
	Tokenizer names( namesValue, boost::char_separator<char>( " " ) );
		
	bool invert = invertNamesPlug()->getValue();

	CompoundObjectPtr result = new CompoundObject;
	IECore::PrimitiveVariableMap::iterator next;
	for( CompoundObject::ObjectMap::const_iterator it = inputAttributes->members().begin(), eIt = inputAttributes->members().end(); it != eIt; ++it )
	{
		ConstObjectPtr attribute = it->second;
		bool found = std::find( names.begin(), names.end(), it->first.string() ) != names.end();
		if( found != invert )
		{
			attribute = processAttribute( path, context, it->first, attribute.get() );
		}
		if( attribute )
		{
			result->members().insert(
				CompoundObject::ObjectMap::value_type(
					it->first,
					// cast is ok - result is const immediately on
					// returning from this function, and attribute will
					// therefore not be modified.
					constPointerCast<Object>( attribute )
				)
			);
		}
	}
	
	return result;
}
开发者ID:7on7on,项目名称:gaffer,代码行数:40,代码来源:AttributeProcessor.cpp

示例12: computeProcessedGlobals

IECore::ConstCompoundObjectPtr Outputs::computeProcessedGlobals( const Gaffer::Context *context, IECore::ConstCompoundObjectPtr inputGlobals ) const
{
	const CompoundPlug *dsp = outputsPlug();
	if( !dsp->children().size() )
	{
		return inputGlobals;
	}

	IECore::CompoundObjectPtr result = new IECore::CompoundObject;
	// Since we're not going to modify any existing members (only add new ones),
	// and our result becomes const on returning it, we can directly reference
	// the input members in our result without copying. Be careful not to modify
	// them though!
	result->members() = inputGlobals->members();

	// add our outputs to the result
	for( InputCompoundPlugIterator it( dsp ); it != it.end(); it++ )
	{
		const CompoundPlug *outputPlug = it->get();
		if( outputPlug->getChild<BoolPlug>( "active" )->getValue() )
		{
			// backwards compatibility with old plug layout
			const StringPlug *namePlug = outputPlug->getChild<StringPlug>( "label" );
			if( !namePlug )
			{
				namePlug = outputPlug->getChild<StringPlug>( "name" );
			}
			const std::string name = namePlug->getValue();

			const StringPlug *fileNamePlug = outputPlug->getChild<StringPlug>( "fileName" );
			if( !fileNamePlug )
			{
				// backwards compatibility with old plug layout
				fileNamePlug = outputPlug->getChild<StringPlug>( "name" );
			}
			const std::string fileName = fileNamePlug->getValue();

			const std::string type = outputPlug->getChild<StringPlug>( "type" )->getValue();
			const std::string data = outputPlug->getChild<StringPlug>( "data" )->getValue();
			if( name.size() && fileName.size() && type.size() && data.size() )
			{
				DisplayPtr d = new Display( fileName, type, data );
				outputPlug->getChild<CompoundDataPlug>( "parameters" )->fillCompoundData( d->parameters() );
				result->members()["output:" + name] = d;
			}
		}
	}

	return result;
}
开发者ID:CRiant,项目名称:gaffer,代码行数:50,代码来源:Outputs.cpp

示例13: computeProcessedGlobals

IECore::ConstCompoundObjectPtr Options::computeProcessedGlobals( const Gaffer::Context *context, IECore::ConstCompoundObjectPtr inputGlobals ) const
{
	IECore::CompoundObjectPtr result = inputGlobals->copy();
	const CompoundDataPlug *p = optionsPlug();

	std::string name;
	for( CompoundDataPlug::MemberPlugIterator it( p ); it != it.end(); ++it )
	{
		IECore::DataPtr d = p->memberDataAndName( it->get(), name );
		if( d )
		{
			result->members()["option:" + name] = d;
		}
	}

	return result;
}
开发者ID:daevid,项目名称:gaffer,代码行数:17,代码来源:Options.cpp

示例14: computeProcessedAttributes

IECore::ConstCompoundObjectPtr ShaderAssignment::computeProcessedAttributes( const ScenePath &path, const Gaffer::Context *context, IECore::ConstCompoundObjectPtr inputAttributes ) const
{
	CompoundObjectPtr result = inputAttributes->copy();

	const Shader *shader = shaderPlug()->source<Plug>()->ancestor<Shader>();
	if( shader )
	{
		// Shader::state() returns a const object, so that in the future it may
		// come from a cached value. we're putting it into our result which, once
		// returned, will also be treated as const and cached. for that reason the
		// temporary const_cast needed to put it into the result is justified -
		// we never change the object and nor can anyone after it is returned.
		ObjectVectorPtr state = boost::const_pointer_cast<ObjectVector>( shader->state() );
		if( state->members().size() )
		{
			result->members()["shader"] = state;
		}
	}

	return result;
}
开发者ID:daevid,项目名称:gaffer,代码行数:21,代码来源:ShaderAssignment.cpp

示例15: computeProcessedAttributes

IECore::ConstCompoundObjectPtr AttributeVisualiser::computeProcessedAttributes( const ScenePath &path, const Gaffer::Context *context, IECore::ConstCompoundObjectPtr inputAttributes ) const
{
	const std::string attributeName = attributeNamePlug()->getValue();
	if( !attributeName.size() )
	{
		return inputAttributes;
	}

	const std::string shaderType = shaderTypePlug()->getValue();
	if( !shaderType.size() )
	{
		return inputAttributes;
	}

	const Object *attribute = inputAttributes->member<Object>( attributeName );
	if( !attribute )
	{
		if( !inputAttributes->member<Object>( shaderType ) )
		{
			return inputAttributes;
		}
	}

	CompoundObjectPtr result = new CompoundObject;
	// Since we're not going to modify any existing members (only add a new one),
	// and our result becomes const on returning it, we can directly reference
	// the input members in our result without copying. Be careful not to modify
	// them though!
	result->members() = inputAttributes->members();

	if( !attribute )
	{
		result->members().erase( shaderType );
		return result;
	}

	// Compute our colour.

	Color3f color( 0.0f );
	const Mode mode = (Mode)modePlug()->getValue();
	if( mode == Random )
	{
		Rand32 r( tbb_hasher( attribute->hash() ) );
		for( int i = 0; i < 3; ++i )
		{
			color[i] = r.nextf();
		}
	}
	else if( mode == ShaderNodeColor )
	{
		const Shader *shader = runTimeCast<const Shader>( attribute );
		if( !shader )
		{
			if( const ShaderNetwork *network = runTimeCast<const ShaderNetwork>( attribute ) )
			{
				shader = network->outputShader();
			}
		}
		if( shader )
		{
			const Color3fData *colorData = shader->blindData()->member<const Color3fData>( "gaffer:nodeColor" );
			if( colorData )
			{
				color = colorData->readable();
			}
		}
	}
	else
	{
		// Color or FalseColor
		switch( attribute->typeId() )
		{
			case FloatDataTypeId :
				color = Color3f( static_cast<const FloatData *>( attribute )->readable() );
				break;
			case DoubleDataTypeId :
				color = Color3f( static_cast<const DoubleData *>( attribute )->readable() );
				break;
			case IntDataTypeId :
				color = Color3f( static_cast<const IntData *>( attribute )->readable() );
				break;
			case BoolDataTypeId :
				color = Color3f( static_cast<const BoolData *>( attribute )->readable() );
				break;
			case Color3fDataTypeId :
				color = static_cast<const Color3fData *>( attribute )->readable();
				break;
			default :
				throw IECore::Exception( boost::str(
					boost::format( "Unsupported attribute data type \"%s\"" ) % attribute->typeName()
				) );
		}
		const Color3f min( minPlug()->getValue() );
		const Color3f max( maxPlug()->getValue() );
		color = ( color - min ) / ( max - min );
		if( mode == FalseColor )
		{
			const SplinefColor3f ramp = rampPlug()->getValue().spline();
			color = ramp( color[0] );
		}
//.........这里部分代码省略.........
开发者ID:ImageEngine,项目名称:gaffer,代码行数:101,代码来源:AttributeVisualiser.cpp


注:本文中的iecore::ConstCompoundObjectPtr类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。