Skip to content

Commit 99159eb

Browse files
committed
IECoreMaya : Fixed SceneShape isolate selection in maya.
This commit fixes the isolate selection of SceneShape objects. An even better improvement would be to support isolate selection of components within a collapsed SceneShape. From an initial investigation, I believe the issue first stems from not being able to add SceneShape components to a maya object set. The documentation is not entirely clear on what is involved in this process, but the "Geometry Data" subsection of the following article may hold some clues. https://around-the-corner.typepad.com/adn/2012/09/custom-shapes-in-the-maya-api-1.html The crux of the situation may depend on implementing an MPxGeometryData for SceneShape (which is a bit crude since the scene interface may contain an entire scene, not just a single shape). However the blog seems to indicate that "Set information for components is stored with the geometryData".
1 parent df78cb8 commit 99159eb

File tree

1 file changed

+31
-17
lines changed

1 file changed

+31
-17
lines changed

src/IECoreMaya/SceneShapeSubSceneOverride.cpp

Lines changed: 31 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1121,17 +1121,22 @@ bool SceneShapeSubSceneOverride::requiresUpdate(const MSubSceneContainer& contai
11211121
{
11221122
allInvisibleByFilter = true;
11231123

1124-
MObject component;
1125-
MSelectionList viewSelectedSet;
1126-
view.filteredObjectList( viewSelectedSet );
1124+
// Create a selection list of the dagPaths which are visible after the view is filtered
1125+
MSelectionList visibleList;
1126+
view.filteredObjectList( visibleList );
11271127

1128-
for( size_t i = 0; i < dagPaths.length(); ++i )
1128+
// Create a selection list with all of our dag paths
1129+
MSelectionList dagPathList;
1130+
for( const auto &dagPath : dagPaths )
11291131
{
1130-
if( viewSelectedSet.hasItemPartly( dagPaths[i], component ) )
1131-
{
1132-
allInvisibleByFilter = false;
1133-
break;
1134-
}
1132+
dagPathList.add( dagPath );
1133+
}
1134+
1135+
// Intersect the two lists to determine if any of our dag paths remain unfiltered
1136+
visibleList.intersect( dagPathList, true );
1137+
if( !visibleList.isEmpty() )
1138+
{
1139+
allInvisibleByFilter = false;
11351140
}
11361141
}
11371142

@@ -1360,22 +1365,31 @@ void SceneShapeSubSceneOverride::update( MSubSceneContainer& container, const MF
13601365
M3dView view;
13611366
MString panelName;
13621367
MSelectionList viewSelectedSet;
1363-
MObject component;
13641368
frameContext.renderingDestination( panelName );
13651369
M3dView::getM3dViewFromModelPanel( panelName, view );
13661370
view.filteredObjectList( viewSelectedSet );
13671371

13681372
bool allInvisibleByFilter = false;
1369-
if ( view.viewIsFiltered() )
1373+
if( view.viewIsFiltered() )
13701374
{
13711375
allInvisibleByFilter = true;
1372-
for( auto &instance : m_instances )
1376+
1377+
// Create a selection list of the dagPaths which are visible after the view is filtered
1378+
MSelectionList visibleList;
1379+
view.filteredObjectList( visibleList );
1380+
1381+
// Create a selection list with all of our dag paths
1382+
MSelectionList dagPathList;
1383+
for( const auto &instance : m_instances )
13731384
{
1374-
if ( viewSelectedSet.hasItemPartly( instance.path, component ) )
1375-
{
1376-
allInvisibleByFilter = false;
1377-
break;
1378-
}
1385+
dagPathList.add( instance.path );
1386+
}
1387+
1388+
// Intersect the two lists to determine if any of our dag paths remain unfiltered
1389+
visibleList.intersect( dagPathList, true );
1390+
if( !visibleList.isEmpty() )
1391+
{
1392+
allInvisibleByFilter = false;
13791393
}
13801394
}
13811395

0 commit comments

Comments
 (0)