Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions include/IECore/SceneInterface.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//////////////////////////////////////////////////////////////////////////
//
// Copyright (c) 2013, Image Engine Design Inc. All rights reserved.
// Copyright (c) 2013-2014, Image Engine Design Inc. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
Expand Down Expand Up @@ -93,7 +93,7 @@ class SceneInterface : public RunTimeTyped
/// Utility variable that can be used anytime you want to refer to the root path in the Scene.
static const Path &rootPath;
/// Name of the visibility attribute
static const Name visibilityName;
static const Name &visibilityName;

/// Create an instance of a subclass which is able to open the file found at "path".
/// Files can be opened for Read, Write, or Append depending on the derived classes.
Expand Down
2 changes: 1 addition & 1 deletion include/IECoreHoudini/ROP_SceneCacheWriter.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ class ROP_SceneCacheWriter : public ROP_Node

private :

static const IECore::SceneInterface::Name &visibleAttribute;
static const IECore::SceneInterface::Name &changingHierarchyAttribute;

bool linked( const std::string &file ) const;

Expand Down
4 changes: 2 additions & 2 deletions src/IECore/SceneInterface.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//////////////////////////////////////////////////////////////////////////
//
// Copyright (c) 2013, Image Engine Design Inc. All rights reserved.
// Copyright (c) 2013-2014, Image Engine Design Inc. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
Expand Down Expand Up @@ -42,7 +42,7 @@ IE_CORE_DEFINERUNTIMETYPEDDESCRIPTION( SceneInterface )

const SceneInterface::Name &SceneInterface::rootName = IndexedIO::rootName;
const SceneInterface::Path &SceneInterface::rootPath = IndexedIO::rootPath;
const SceneInterface::Name SceneInterface::visibilityName( "scene:visible" );
const SceneInterface::Name &SceneInterface::visibilityName( "scene:visible" );

class SceneInterface::CreatorMap : public std::map< std::pair< std::string, IndexedIO::OpenModeFlags >, CreatorFn>
{
Expand Down
18 changes: 10 additions & 8 deletions src/IECoreHoudini/ROP_SceneCacheWriter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ PRM_Default ROP_SceneCacheWriter::fileDefault( 0, "$HIP/output.scc" );
PRM_Default ROP_SceneCacheWriter::rootObjectDefault( 0, "/obj" );
PRM_SpareData ROP_SceneCacheWriter::forceObjectsSpareData;

const SceneInterface::Name &ROP_SceneCacheWriter::visibleAttribute( "scene:visible" );
const SceneInterface::Name &ROP_SceneCacheWriter::changingHierarchyAttribute( "sceneInterface:changingHierarchy" );

OP_TemplatePair *ROP_SceneCacheWriter::buildParameters()
{
Expand Down Expand Up @@ -387,13 +387,14 @@ ROP_RENDER_CODE ROP_SceneCacheWriter::doWrite( const SceneInterface *liveScene,

if ( time != m_startTime )
{
outChild->writeAttribute( visibleAttribute, new BoolData( false ), time - 1e-6 );
outChild->writeAttribute( changingHierarchyAttribute, new BoolData( true ), time );
outChild->writeAttribute( IECore::SceneInterface::visibilityName, new BoolData( false ), time - 1e-6 );
}
}

if ( outChild->hasAttribute( visibleAttribute ) )
if ( outChild->hasAttribute( changingHierarchyAttribute ) )
{
outChild->writeAttribute( visibleAttribute, new BoolData( true ), time );
outChild->writeAttribute( IECore::SceneInterface::visibilityName, new BoolData( true ), time );
}

ROP_RENDER_CODE status = doWrite( liveChild, outChild, time, progress );
Expand All @@ -403,20 +404,21 @@ ROP_RENDER_CODE ROP_SceneCacheWriter::doWrite( const SceneInterface *liveScene,
}
}

// turn visibleAttribute off if the child disappears
// turn visibility off if the child disappears
SceneInterface::NameList outChildren;
outScene->childNames( outChildren );
for ( SceneInterface::NameList::iterator it = outChildren.begin(); it != outChildren.end(); ++it )
{
if ( !liveScene->hasChild( *it ) )
{
SceneInterfacePtr outChild = outScene->child( *it );
if ( !outChild->hasAttribute( visibleAttribute ) )
if ( !outChild->hasAttribute( IECore::SceneInterface::visibilityName ) )
{
outChild->writeAttribute( visibleAttribute, new BoolData( true ), time - 1e-6 );
outChild->writeAttribute( IECore::SceneInterface::visibilityName, new BoolData( true ), time - 1e-6 );
}

outChild->writeAttribute( visibleAttribute, new BoolData( false ), time );
outChild->writeAttribute( changingHierarchyAttribute, new BoolData( true ), time );
outChild->writeAttribute( IECore::SceneInterface::visibilityName, new BoolData( false ), time );
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/IECorePython/SceneInterfaceBinding.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//////////////////////////////////////////////////////////////////////////
//
// Copyright (c) 2013, Image Engine Design Inc. All rights reserved.
// Copyright (c) 2013-2014, Image Engine Design Inc. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
Expand Down Expand Up @@ -268,7 +268,7 @@ void bindSceneInterface()
.def( "create", SceneInterface::create ).staticmethod( "create" )
.def( "supportedExtensions", supportedExtensions, ( arg("modes") = IndexedIO::Read|IndexedIO::Write|IndexedIO::Append ) ).staticmethod( "supportedExtensions" )

.add_static_property( "visibilityName", make_getter(&SceneInterface::visibilityName, return_value_policy<reference_existing_object>() ) )
.def_readonly("visibilityName", &SceneInterface::visibilityName )
;
}

Expand Down