本文整理汇总了C++中iecore::ConstObjectPtr::isInstanceOf方法的典型用法代码示例。如果您正苦于以下问题:C++ ConstObjectPtr::isInstanceOf方法的具体用法?C++ ConstObjectPtr::isInstanceOf怎么用?C++ ConstObjectPtr::isInstanceOf使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类iecore::ConstObjectPtr
的用法示例。
在下文中一共展示了ConstObjectPtr::isInstanceOf方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
示例2: pathScope
virtual task *execute()
{
ScenePlug::PathScope pathScope( m_sceneGadget->m_context.get(), m_scenePath );
// Update attributes, and compute visibility.
const bool previouslyVisible = m_sceneGraph->m_visible;
if( m_dirtyFlags & AttributesDirty )
{
const IECore::MurmurHash attributesHash = m_sceneGadget->m_scene->attributesPlug()->hash();
if( attributesHash != m_sceneGraph->m_attributesHash )
{
IECore::ConstCompoundObjectPtr attributes = m_sceneGadget->m_scene->attributesPlug()->getValue( &attributesHash );
const IECore::BoolData *visibilityData = attributes->member<IECore::BoolData>( "scene:visible" );
m_sceneGraph->m_visible = visibilityData ? visibilityData->readable() : true;
IECore::ConstRunTimeTypedPtr glStateCachedTyped = IECoreGL::CachedConverter::defaultCachedConverter()->convert( attributes.get() );
IECoreGL::ConstStatePtr glStateCached = IECore::runTimeCast<const IECoreGL::State>( glStateCachedTyped );
IECoreGL::ConstStatePtr visState = NULL;
deferReferenceRemoval( m_sceneGraph->m_attributesRenderable );
m_sceneGraph->m_attributesRenderable = AttributeVisualiser::allVisualisations( attributes.get(), visState );
deferReferenceRemoval( m_sceneGraph->m_state );
if( visState )
{
IECoreGL::StatePtr glState = new IECoreGL::State( *glStateCached );
glState->add( const_cast< IECoreGL::State* >( visState.get() ) );
m_sceneGraph->m_state = glState;
}
else
{
m_sceneGraph->m_state = glStateCached;
}
m_sceneGraph->m_attributesHash = attributesHash;
}
}
if( !m_sceneGraph->m_visible )
{
// No need to update further since we're not visible.
return NULL;
}
else if( !previouslyVisible )
{
// We didn't perform any updates when we were invisible,
// so we need to update everything now.
m_dirtyFlags = AllDirty;
}
// Update the object - converting it into an IECoreGL::Renderable
if( m_dirtyFlags & ObjectDirty )
{
const IECore::MurmurHash objectHash = m_sceneGadget->m_scene->objectPlug()->hash();
if( objectHash != m_sceneGraph->m_objectHash )
{
IECore::ConstObjectPtr object = m_sceneGadget->m_scene->objectPlug()->getValue( &objectHash );
deferReferenceRemoval( m_sceneGraph->m_renderable );
if( !object->isInstanceOf( IECore::NullObjectTypeId ) )
{
m_sceneGraph->m_renderable = objectToRenderable( object.get() );
}
m_sceneGraph->m_objectHash = objectHash;
}
}
// Update the transform and bound
if( m_dirtyFlags & TransformDirty )
{
m_sceneGraph->m_transform = m_sceneGadget->m_scene->transformPlug()->getValue();
}
m_sceneGraph->m_bound = m_sceneGraph->m_renderable ? m_sceneGraph->m_renderable->bound() : Box3f();
// Update the expansion state
const bool previouslyExpanded = m_sceneGraph->m_expanded;
if( m_dirtyFlags & ExpansionDirty )
{
m_sceneGraph->m_expanded = m_sceneGadget->m_minimumExpansionDepth >= m_scenePath.size();
if( !m_sceneGraph->m_expanded )
{
m_sceneGraph->m_expanded = m_sceneGadget->m_expandedPaths->readable().match( m_scenePath ) & Filter::ExactMatch;
}
}
// If we're not expanded, then we can early out after creating a bounding box.
deferReferenceRemoval( m_sceneGraph->m_boundRenderable );
if( !m_sceneGraph->m_expanded )
{
// We're not expanded, so we early out before updating the children.
//.........这里部分代码省略.........