本文整理汇总了C++中iecore::ConstObjectPtr类的典型用法代码示例。如果您正苦于以下问题:C++ ConstObjectPtr类的具体用法?C++ ConstObjectPtr怎么用?C++ ConstObjectPtr使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ConstObjectPtr类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: if
Imath::Box3f ObjectSource::computeBound( const SceneNode::ScenePath &path, const Gaffer::Context *context, const ScenePlug *parent ) const
{
Imath::Box3f result;
IECore::ConstObjectPtr object = sourcePlug()->getValue();
if( const IECore::VisibleRenderable *renderable = IECore::runTimeCast<const IECore::VisibleRenderable>( object.get() ) )
{
result = renderable->bound();
}
else if( object->isInstanceOf( IECore::Camera::staticTypeId() ) )
{
result = Imath::Box3f( Imath::V3f( -0.5, -0.5, 0 ), Imath::V3f( 0.5, 0.5, 2.0 ) );
}
else if( object->isInstanceOf( IECore::CoordinateSystem::staticTypeId() ) )
{
result = Imath::Box3f( Imath::V3f( 0 ), Imath::V3f( 1 ) );
}
else
{
result = Imath::Box3f( Imath::V3f( -0.5 ), Imath::V3f( 0.5 ) );
}
if( path.size() == 0 )
{
result = Imath::transform( result, transformPlug()->matrix() );
}
return result;
}
开发者ID:cedriclaunay,项目名称:gaffer,代码行数:28,代码来源:ObjectSource.cpp
示例2: getClipboardContents
static IECore::ObjectPtr getClipboardContents( ApplicationRoot &a )
{
IECore::ConstObjectPtr o = a.getClipboardContents();
if( o )
{
return o->copy();
}
return 0;
}
开发者ID:7on7on,项目名称:gaffer,代码行数:9,代码来源:ApplicationRootBinding.cpp
示例3: sourcePlug
Imath::Box3f ObjectSource::computeBound( const SceneNode::ScenePath &path, const Gaffer::Context *context, const ScenePlug *parent ) const
{
IECore::ConstObjectPtr object = sourcePlug()->getValue();
Imath::Box3f result = bound( object.get() );
if( path.size() == 0 )
{
result = Imath::transform( result, transformPlug()->matrix() );
}
return result;
}
开发者ID:Kthulhu,项目名称:gaffer,代码行数:11,代码来源:ObjectSource.cpp
示例4:
void VectorTypedParameterHandler<ParameterType>::setParameterValue()
{
IECore::ConstObjectPtr o = m_plug->getValue();
if( o )
{
m_parameter->setValue( o->copy() );
}
else
{
m_parameter->setValue( m_parameter->defaultValue()->copy() );
}
}
开发者ID:dboogert,项目名称:gaffer,代码行数:12,代码来源:VectorTypedParameterHandler.cpp
示例5: setObjectValue
void ValuePlug::setObjectValue( IECore::ConstObjectPtr value )
{
bool haveInput = getInput<Plug>();
if( direction()==In && !haveInput )
{
// input plug with no input connection. there can only ever be a single value,
// which we store directly on the plug. when setting this we need to take care
// of undo, and also of triggering the plugValueSet signal and propagating the
// plugDirtiedSignal.
if( getFlags( ReadOnly ) )
{
// We don't allow static values to be set on read only plugs, so we throw.
// Note that it is perfectly acceptable to call setValue() on a read only
// plug during a computation because the result is not written onto the
// plug itself, so we don't make the check in the case that we call
// receiveResult() below. This allows plugs which have inputs to be made
// read only after having their input set.
throw IECore::Exception( boost::str( boost::format( "Cannot set value for read only plug \"%s\"" ) % fullName() ) );
}
if( value->isNotEqualTo( m_staticValue.get() ) )
{
Action::enact( new SetValueAction( this, value ) );
}
return;
}
// An input plug with an input connection or an output plug. We must be currently in a computation
// triggered by getObjectValue() for a setObjectValue() call to be valid (receiveResult will check this).
// We never trigger plugValueSet or plugDirtiedSignals during computation.
ComputeProcess::receiveResult( this, value );
}
开发者ID:HughMacdonald,项目名称:gaffer,代码行数:34,代码来源:ValuePlug.cpp
示例6: computeProcessedObject
IECore::ConstObjectPtr PointsType::computeProcessedObject( const ScenePath &path, const Gaffer::Context *context, IECore::ConstObjectPtr inputObject ) const
{
const PointsPrimitive *inputPoints = runTimeCast<const PointsPrimitive>( inputObject.get() );
if( !inputPoints )
{
return inputObject;
}
const std::string type = typePlug()->getValue();
if( type == "" )
{
return inputObject;
}
if( const StringData *existingType = inputPoints->variableData<StringData>( "type" ) )
{
if( existingType->readable() == type )
{
return inputObject;
}
}
PointsPrimitivePtr result = inputPoints->copy();
result->variables["type"] = PrimitiveVariable( PrimitiveVariable::Constant, new StringData( type ) );
return result;
}
开发者ID:mattigruener,项目名称:gaffer,代码行数:27,代码来源:PointsType.cpp
示例7: computeProcessedObject
IECore::ConstObjectPtr PointsGridToPoints::computeProcessedObject( const ScenePath &path, const Gaffer::Context *context, IECore::ConstObjectPtr inputObject ) const
{
const VDBObject *vdbObject = runTimeCast<const VDBObject>( inputObject.get() );
if( !vdbObject )
{
return inputObject;
}
openvdb::GridBase::ConstPtr grid = vdbObject->findGrid( gridPlug()->getValue() );
if ( !grid )
{
return inputObject;
}
std::string names = namesPlug()->getValue();
bool invert = invertNamesPlug()->getValue();
auto primitiveVariableFilter = [names, invert](const std::string& primitiveVariableName) -> bool
{
if (primitiveVariableName == "P")
{
return false;
}
return StringAlgo::matchMultiple( primitiveVariableName, names ) != invert;
};
IECoreScene::PointsPrimitivePtr points = createPointsPrimitive( grid, primitiveVariableFilter );
if ( !points )
{
return inputObject;
}
return points;
}
开发者ID:appleseedhq,项目名称:gaffer,代码行数:35,代码来源:PointsGridToPoints.cpp
示例8: getValue
std::string StringPlug::getValue() const
{
IECore::ConstObjectPtr o = getObjectValue();
const IECore::StringData *s = IECore::runTimeCast<const IECore::StringData>( o.get() );
if( !s )
{
throw IECore::Exception( "StringPlug::getObjectValue() didn't return StringData - is the hash being computed correctly?" );
}
bool performSubstitution =
direction()==Plug::In &&
inCompute() &&
Plug::getFlags( Plug::PerformsSubstitutions ) &&
Context::hasSubstitutions( s->readable() );
return performSubstitution ? Context::current()->substitute( s->readable() ) : s->readable();
}
开发者ID:JohanAberg,项目名称:gaffer,代码行数:17,代码来源:TypedPlug.cpp
示例9: hash
IECore::MurmurHash StringPlug::hash() const
{
bool performSubstitution = direction()==Plug::In && !getInput<ValuePlug>() && Plug::getFlags( Plug::PerformsSubstitutions );
if( performSubstitution )
{
IECore::ConstObjectPtr o = getObjectValue();
const IECore::StringData *s = IECore::runTimeCast<const IECore::StringData>( o.get() );
if( !s )
{
throw IECore::Exception( "StringPlug::getObjectValue() didn't return StringData - is the hash being computed correctly?" );
}
if( Context::hasSubstitutions( s->readable() ) )
{
IECore::MurmurHash result;
result.append( Context::current()->substitute( s->readable() ) );
return result;
}
}
// no substitutions
return ValuePlug::hash();
}
开发者ID:JohanAberg,项目名称:gaffer,代码行数:23,代码来源:TypedPlug.cpp
示例10: computeProcessedObject
IECore::ConstObjectPtr OSLObject::computeProcessedObject( const ScenePath &path, const Gaffer::Context *context, IECore::ConstObjectPtr inputObject ) const
{
const Primitive *inputPrimitive = runTimeCast<const Primitive>( inputObject.get() );
if( !inputPrimitive )
{
return inputObject;
}
if( !inputPrimitive->variableData<V3fVectorData>( "P", PrimitiveVariable::Vertex ) )
{
return inputObject;
}
ConstOSLShaderPtr shader = runTimeCast<const OSLShader>( shaderPlug()->source<Plug>()->node() );
ConstShadingEnginePtr shadingEngine = shader ? shader->shadingEngine() : NULL;
if( !shadingEngine )
{
return inputObject;
}
CompoundDataPtr shadingPoints = new CompoundData;
for( PrimitiveVariableMap::const_iterator it = inputPrimitive->variables.begin(), eIt = inputPrimitive->variables.end(); it != eIt; ++it )
{
if( it->second.interpolation == PrimitiveVariable::Vertex )
{
// cast is ok - we're only using it to be able to reference the data from the shadingPoints,
// but nothing will modify the data itself.
shadingPoints->writable()[it->first] = boost::const_pointer_cast<Data>( it->second.data );
}
}
PrimitivePtr outputPrimitive = inputPrimitive->copy();
ShadingEngine::Transforms transforms;
transforms[ g_world ] = ShadingEngine::Transform( inPlug()->fullTransform( path ));
CompoundDataPtr shadedPoints = shadingEngine->shade( shadingPoints.get(), transforms );
for( CompoundDataMap::const_iterator it = shadedPoints->readable().begin(), eIt = shadedPoints->readable().end(); it != eIt; ++it )
{
if( it->first != "Ci" )
{
outputPrimitive->variables[it->first] = PrimitiveVariable( PrimitiveVariable::Vertex, it->second );
}
}
return outputPrimitive;
}
开发者ID:johnhaddon,项目名称:gaffer,代码行数:49,代码来源:OSLObject.cpp
示例11: getValue
Format FormatPlug::getValue( const IECore::MurmurHash *precomputedHash ) const
{
IECore::ConstObjectPtr o = getObjectValue( precomputedHash );
const GafferImage::FormatData *d = IECore::runTimeCast<const GafferImage::FormatData>( o.get() );
if( !d )
{
throw IECore::Exception( "FormatPlug::getObjectValue() didn't return FormatData - is the hash being computed correctly?" );
}
Format result = d->readable();
if( result.getDisplayWindow().isEmpty() && inCompute() )
{
return Context::current()->get<Format>( Format::defaultFormatContextName, Format() );
}
return result;
}
开发者ID:CRiant,项目名称:gaffer,代码行数:15,代码来源:FormatPlug.cpp
示例12: computeProcessedObject
IECore::ConstObjectPtr MapOffset::computeProcessedObject( const ScenePath &path, const Gaffer::Context *context, IECore::ConstObjectPtr inputObject ) const
{
// early out if it's not a primitive
const Primitive *inputPrimitive = runTimeCast<const Primitive>( inputObject.get() );
if( !inputPrimitive )
{
return inputObject;
}
// early out if the s/t names haven't been provided.
std::string sName = sNamePlug()->getValue();
std::string tName = tNamePlug()->getValue();
if( sName == "" || tName == "" )
{
return inputObject;
}
// do the work
PrimitivePtr result = inputPrimitive->copy();
V2f offset = offsetPlug()->getValue();
const int udim = udimPlug()->getValue();
offset.x += (udim - 1001) % 10;
offset.y += (udim - 1001) / 10;
if( FloatVectorDataPtr sData = result->variableData<FloatVectorData>( sName ) )
{
for( vector<float>::iterator it = sData->writable().begin(), eIt = sData->writable().end(); it != eIt; ++it )
{
*it += offset.x;
}
}
if( FloatVectorDataPtr tData = result->variableData<FloatVectorData>( tName ) )
{
for( vector<float>::iterator it = tData->writable().begin(), eIt = tData->writable().end(); it != eIt; ++it )
{
*it += offset.y;
}
}
return result;
}
开发者ID:Kthulhu,项目名称:gaffer,代码行数:47,代码来源:MapOffset.cpp
示例13: computeProcessedObject
IECore::ConstObjectPtr LevelSetToMesh::computeProcessedObject( const ScenePath &path, const Gaffer::Context *context, IECore::ConstObjectPtr inputObject ) const
{
const VDBObject *vdbObject = runTimeCast<const VDBObject>( inputObject.get() );
if( !vdbObject )
{
return inputObject;
}
openvdb::GridBase::ConstPtr grid = vdbObject->findGrid( gridPlug()->getValue() );
if (!grid)
{
return inputObject;
}
return volumeToMesh( grid, isoValuePlug()->getValue(), adaptivityPlug()->getValue() );
}
开发者ID:ImageEngine,项目名称:gaffer,代码行数:17,代码来源:LevelSetToMesh.cpp
示例14: computeProcessedObject
IECore::ConstObjectPtr OSLObject::computeProcessedObject( const ScenePath &path, const Gaffer::Context *context, IECore::ConstObjectPtr inputObject ) const
{
const Primitive *inputPrimitive = runTimeCast<const Primitive>( inputObject.get() );
if( !inputPrimitive )
{
return inputObject;
}
if( !inputPrimitive->variableData<V3fVectorData>( "P", PrimitiveVariable::Vertex ) )
{
return inputObject;
}
OSLRenderer::ConstShadingEnginePtr shadingEngine = OSLImage::shadingEngine( shaderPlug() );
if( !shadingEngine )
{
return inputObject;
}
CompoundDataPtr shadingPoints = new CompoundData;
for( PrimitiveVariableMap::const_iterator it = inputPrimitive->variables.begin(), eIt = inputPrimitive->variables.end(); it != eIt; ++it )
{
if( it->second.interpolation == PrimitiveVariable::Vertex )
{
// cast is ok - we're only using it to be able to reference the data from the shadingPoints,
// but nothing will modify the data itself.
shadingPoints->writable()[it->first] = constPointerCast<Data>( it->second.data );
}
}
PrimitivePtr outputPrimitive = inputPrimitive->copy();
ConstCompoundDataPtr shadedPoints = shadingEngine->shade( shadingPoints );
const std::vector<Color3f> &ci = shadedPoints->member<Color3fVectorData>( "Ci" )->readable();
V3fVectorDataPtr p = new V3fVectorData;
p->writable().reserve( ci.size() );
std::copy( ci.begin(), ci.end(), back_inserter( p->writable() ) );
outputPrimitive->variables["P"] = PrimitiveVariable( PrimitiveVariable::Vertex, p );
/// \todo Allow shaders to write arbitrary primitive variables.
return outputPrimitive;
}
开发者ID:7on7on,项目名称:gaffer,代码行数:45,代码来源:OSLObject.cpp
示例15: computeProcessedObject
IECore::ConstObjectPtr MeshDistortion::computeProcessedObject( const ScenePath &path, const Gaffer::Context *context, IECore::ConstObjectPtr inputObject ) const
{
const MeshPrimitive *mesh = runTimeCast<const MeshPrimitive>( inputObject.get() );
if( !mesh )
{
return inputObject;
}
const std::string position = positionPlug()->getValue();
const std::string referencePosition = referencePositionPlug()->getValue();
const std::string uvSet = uvSetPlug()->getValue();
if( position.empty() || referencePosition.empty() || uvSet.empty() )
{
return inputObject;
}
const std::string distortion = distortionPlug()->getValue();
const std::string uvDistortion = uvDistortionPlug()->getValue();
if( distortion.empty() && uvDistortion.empty() )
{
return inputObject;
}
auto distortions = MeshAlgo::calculateDistortion(
mesh,
uvSet,
referencePosition,
position
);
MeshPrimitivePtr result = mesh->copy();
if( !distortion.empty() )
{
result->variables[distortion] = distortions.first;
}
if( !uvDistortion.empty() )
{
result->variables[uvDistortion] = distortions.second;
}
return result;
}
开发者ID:ImageEngine,项目名称:gaffer,代码行数:44,代码来源:MeshDistortion.cpp
示例16: computeProcessedObject
IECore::ConstObjectPtr OSLObject::computeProcessedObject( const ScenePath &path, const Gaffer::Context *context, IECore::ConstObjectPtr inputObject ) const
{
const Primitive *inputPrimitive = runTimeCast<const Primitive>( inputObject.get() );
if( !inputPrimitive )
{
return inputObject;
}
const OSLShader *shader = runTimeCast<const OSLShader>( shaderPlug()->source()->node() );
ConstShadingEnginePtr shadingEngine = shader ? shader->shadingEngine() : nullptr;
if( !shadingEngine )
{
return inputObject;
}
PrimitiveVariable::Interpolation interpolation = static_cast<PrimitiveVariable::Interpolation>( interpolationPlug()->getValue() );
IECoreScene::ConstPrimitivePtr resampledObject = IECore::runTimeCast<const IECoreScene::Primitive>( resampledInPlug()->objectPlug()->getValue() );
CompoundDataPtr shadingPoints = prepareShadingPoints( resampledObject.get(), shadingEngine.get() );
PrimitivePtr outputPrimitive = inputPrimitive->copy();
ShadingEngine::Transforms transforms;
transforms[ g_world ] = ShadingEngine::Transform( inPlug()->fullTransform( path ));
CompoundDataPtr shadedPoints = shadingEngine->shade( shadingPoints.get(), transforms );
for( CompoundDataMap::const_iterator it = shadedPoints->readable().begin(), eIt = shadedPoints->readable().end(); it != eIt; ++it )
{
// Ignore the output color closure as the debug closures are used to define what is 'exported' from the shader
if( it->first != "Ci" )
{
outputPrimitive->variables[it->first] = PrimitiveVariable( interpolation, it->second );
}
}
return outputPrimitive;
}
开发者ID:andrewkaufman,项目名称:gaffer,代码行数:40,代码来源:OSLObject.cpp
示例17: doConversion
IECore::RunTimeTypedPtr ToGLStateConverter::doConversion( IECore::ConstObjectPtr src, IECore::ConstCompoundObjectPtr operands ) const
{
const CompoundObject *co = runTimeCast<const CompoundObject>( src.get() );
if( !co )
{
throw Exception( "Expected a CompoundObject" );
}
const AttributeToStateMap &m = attributeToStateMap();
const StatePtr result = new State( false );
for( CompoundObject::ObjectMap::const_iterator it = co->members().begin(), eIt = co->members().end(); it != eIt; ++it )
{
AttributeToStateMap::const_iterator mIt = m.find( it->first );
if( mIt != m.end() )
{
StateComponentPtr s = mIt->second( it->second.get() );
result->add( s );
}
}
return result;
}
开发者ID:AtomicFiction,项目名称:cortex,代码行数:22,代码来源:ToGLStateConverter.cpp
示例18: computeProcessedObject
IECore::ConstObjectPtr DeleteCurves::computeProcessedObject( const ScenePath &path, const Gaffer::Context *context, IECore::ConstObjectPtr inputObject ) const
{
const CurvesPrimitive *curves = runTimeCast<const CurvesPrimitive>( inputObject.get() );
if( !curves )
{
return inputObject;
}
std::string deletePrimVarName = curvesPlug()->getValue();
if( boost::trim_copy( deletePrimVarName ).empty() )
{
return inputObject;
}
PrimitiveVariableMap::const_iterator it = curves->variables.find( deletePrimVarName );
if (it == curves->variables.end())
{
throw InvalidArgumentException( boost::str( boost::format( "DeleteCurves : No primitive variable \"%s\" found" ) % deletePrimVarName ) );
}
return CurvesAlgo::deleteCurves(curves, it->second);
}
开发者ID:mattigruener,项目名称:gaffer,代码行数:23,代码来源:DeleteCurves.cpp
示例19: computeProcessedObject
IECore::ConstObjectPtr MeshTangents::computeProcessedObject( const ScenePath &path, const Gaffer::Context *context, IECore::ConstObjectPtr inputObject ) const
{
const MeshPrimitive *mesh = runTimeCast<const MeshPrimitive>( inputObject.get() );
if( !mesh )
{
return inputObject;
}
std::string uvSet = uvSetPlug()->getValue();
std::string position = positionPlug()->getValue();
bool ortho = orthogonalPlug()->getValue();
std::string uTangent = uTangentPlug()->getValue();
std::string vTangent = vTangentPlug()->getValue();
std::pair<PrimitiveVariable, PrimitiveVariable> tangentPrimvars = MeshAlgo::calculateTangents( mesh, uvSet, ortho, position);
MeshPrimitivePtr meshWithTangents = runTimeCast<MeshPrimitive>( mesh->copy() );
meshWithTangents->variables[uTangent] = tangentPrimvars.first;
meshWithTangents->variables[vTangent] = tangentPrimvars.second;
return meshWithTangents;
}
开发者ID:andrewkaufman,项目名称:gaffer,代码行数:23,代码来源:MeshTangents.cpp
示例20: getValue
static IECore::ObjectPtr getValue( Detail::PythonObjectKnob &knob )
{
check( knob );
IECore::ConstObjectPtr v = knob.objectKnob->getValue();
return v ? v->copy() : 0;
}
开发者ID:AtomicFiction,项目名称:cortex,代码行数:6,代码来源:ObjectKnobBinding.cpp
注:本文中的iecore::ConstObjectPtr类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论