Skip to content

Commit

Permalink
Merge pull request ImageEngine#1235 from andrewkaufman/maya2022
Browse files Browse the repository at this point in the history
Update for Maya 2022
  • Loading branch information
andrewkaufman authored Feb 17, 2022
2 parents 16216e4 + 9a8db57 commit 7f59e66
Show file tree
Hide file tree
Showing 73 changed files with 288 additions and 259 deletions.
2 changes: 1 addition & 1 deletion SConstruct
Original file line number Diff line number Diff line change
Expand Up @@ -2322,7 +2322,7 @@ mayaEnvAppends = {
"OpenMayaUI",
"OpenMayaAnim",
"OpenMayaFX",
"boost_python" + pythonEnv["BOOST_LIB_SUFFIX"],
"boost_python" + boostPythonLibSuffix,
],
"CPPFLAGS" : [
"-D_BOOL",
Expand Down
2 changes: 1 addition & 1 deletion include/IECoreMaya/ParameterisedHolderModificationCmd.h
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ class IECOREMAYA_API ParameterisedHolderModificationCmd : public MPxCommand
static IECore::ConstCompoundDataPtr g_originalClasses;
static IECore::ConstObjectPtr g_newValue;
static IECore::ConstCompoundDataPtr g_newClasses;
friend void IECoreMaya::parameterisedHolderAssignModificationState( IECore::ObjectPtr originalValue, IECore::CompoundDataPtr originalClasses, IECore::ObjectPtr newValue, IECore::CompoundDataPtr newClasses );
friend void parameterisedHolderAssignModificationState( IECore::ObjectPtr originalValue, IECore::CompoundDataPtr originalClasses, IECore::ObjectPtr newValue, IECore::CompoundDataPtr newClasses );
};

}
Expand Down
34 changes: 20 additions & 14 deletions include/IECoreMaya/SceneShapeInterfaceComponentBoundIterator.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,20 +57,26 @@ class IECOREMAYA_API SceneShapeInterfaceComponentBoundIterator : public MPxGeome

SceneShapeInterfaceComponentBoundIterator( void *userGeometry, MObjectArray &components );
SceneShapeInterfaceComponentBoundIterator( void *userGeometry, MObject &components );
~SceneShapeInterfaceComponentBoundIterator();

virtual bool isDone() const;
virtual void next();
virtual void reset();
virtual void component( MObject &component );
virtual bool hasPoints() const;
virtual int iteratorCount() const;
virtual MPoint point() const;
virtual void setPoint(const MPoint &) const;
virtual int setPointGetNext(MPoint &);
virtual int index() const;
virtual bool hasNormals() const;
virtual int indexUnsimplified() const;
~SceneShapeInterfaceComponentBoundIterator() override = default;

bool isDone() const override;

#if MAYA_API_VERSION < 202200
void next() override;
#else
MStatus next() override;
#endif

void reset() override;
void component( MObject &component ) override;
bool hasPoints() const override;
int iteratorCount() const override;
MPoint point() const override;
void setPoint(const MPoint &) const override;
int setPointGetNext(MPoint &) override;
int index() const override;
bool hasNormals() const override;
int indexUnsimplified() const override;

private:

Expand Down
1 change: 1 addition & 0 deletions python/IECoreMaya/BoxParameterUI.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@

import IECore
import IECoreMaya
from six.moves import range

class BoxParameterUI( IECoreMaya.ParameterUI ) :

Expand Down
3 changes: 2 additions & 1 deletion python/IECoreMaya/ClassVectorParameterUI.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@

import IECore
import IECoreMaya
from six.moves import range

## A ParameterUI for ClassVectorParameters. Supports the following Parameter userData entries :
#
Expand Down Expand Up @@ -676,7 +677,7 @@ def __layerMenu( self ) :

result = IECore.MenuDefinition()

layerNames = self.__vectorParent().parameter.keys()
layerNames = list(self.__vectorParent().parameter.keys())
layerIndex = layerNames.index( self.__parameter.name )

result.append(
Expand Down
4 changes: 2 additions & 2 deletions python/IECoreMaya/DAGPathParameter.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ def __getattr__( self, attrName ):
"""
@staticmethod
def pathValidator():
return re.compile( "^(\|?[^\t\n\r\f\v\|]+)+\|?$" )
return re.compile( r"^(\|?[^\t\n\r\f\v|]+)+\|?$" )

"""
Returns (True, "") only if the value is a correct DAG path string and also checks that the DAG node exists or doesn't exist
Expand Down Expand Up @@ -164,7 +164,7 @@ def getDAGPathValue( self ) :
return dp
except:
if self.mustExist :
raise Exception, "Node '%s' does not exist!" % dagNodePath
raise Exception("Node '%s' does not exist!" % dagNodePath)
return None

IECore.registerRunTimeTyped( DAGPathParameter )
4 changes: 2 additions & 2 deletions python/IECoreMaya/DAGPathVectorParameter.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
from maya.OpenMaya import *
import re

from DAGPathParameter import DAGPathParameter
from .DAGPathParameter import DAGPathParameter

"""
Parameter class for specifying a list of Maya DAG paths.
Expand Down Expand Up @@ -172,7 +172,7 @@ def getDAGPathVectorValue( self ) :
result.append( dp )
except:
if self.mustExist :
raise Exception, "Node '%s' does not exist!" % dagNodePath
raise Exception("Node '%s' does not exist!" % dagNodePath)

return result

Expand Down
10 changes: 5 additions & 5 deletions python/IECoreMaya/FileBrowser.py
Original file line number Diff line number Diff line change
Expand Up @@ -296,8 +296,8 @@ def __getItemsForPath( self, path, *args ) :

try:
fullDirContents = os.listdir( self.__path )
except Exception, e :
print e
except Exception as e :
print(e)
maya.cmds.evalDeferred( 'import maya.cmds; maya.cmds.confirmDialog( b="OK", title="Error retrieving file list...", message="%s" )' % e )
return

Expand Down Expand Up @@ -624,7 +624,7 @@ def disconnect( self, callable ) :
self.__slots.remove( callable )


class _PathField( object, IECoreMaya.UIElement ) :
class _PathField( IECoreMaya.UIElement ) :

def __init__( self, uiParent=None, **kw ) :

Expand Down Expand Up @@ -674,7 +674,7 @@ def __emitValueChanged( self, *args ) :
self.__s_valueChanged( self.value )


class _FileList( object, IECoreMaya.UIElement ) :
class _FileList( IECoreMaya.UIElement ) :

def __init__( self, uiParent=None, **kw ) :

Expand Down Expand Up @@ -838,7 +838,7 @@ def __emitItemChosen( self, *args ) :
self.__s_itemChosen( self.getItem( selection[0] ) )


class _DefaultFileListSort( object, IECoreMaya.UIElement ) :
class _DefaultFileListSort( IECoreMaya.UIElement ) :

def __init__( self, uiParent=None, **kw ) :

Expand Down
7 changes: 4 additions & 3 deletions python/IECoreMaya/FnDagNode.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,16 @@
import maya.cmds

import IECore
import StringUtil
from . import StringUtil
import six

## This class extends Maya's MFnDagNode to add assorted helper functions.
class FnDagNode( maya.OpenMaya.MFnDagNode ) :

## \param obj - MObject, This can also be a string or an MObjectHandle.
def __init__( self, obj ) :

if isinstance( obj, str ) or isinstance( obj, unicode ) :
if isinstance( obj, str ) or isinstance( obj, six.text_type ) :

obj = StringUtil.dependencyNodeFromString( obj )

Expand Down Expand Up @@ -114,7 +115,7 @@ def defaultShapeName( transformNode ):

parentShort = transformNode.rpartition( "|" )[-1]

numbersMatch = re.search( "[0-9]+$", parentShort )
numbersMatch = re.search( r"[0-9]+$", parentShort )
if numbersMatch is not None :
numbers = numbersMatch.group()
shapeName = parentShort[:-len(numbers)] + "Shape" + numbers
Expand Down
2 changes: 1 addition & 1 deletion python/IECoreMaya/FnOpHolder.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
#
##########################################################################

from FnParameterisedHolder import FnParameterisedHolder
from .FnParameterisedHolder import FnParameterisedHolder

import maya.cmds

Expand Down
12 changes: 7 additions & 5 deletions python/IECoreMaya/FnParameterisedHolder.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,10 @@

import IECore

import _IECoreMaya
import StringUtil
from . import _IECoreMaya
from . import StringUtil
import six
from six.moves import zip

## A function set for operating on the various IECoreMaya::ParameterisedHolder
# types. This allows setting and getting of plug and parameter values, and
Expand All @@ -53,7 +55,7 @@ class FnParameterisedHolder( maya.OpenMaya.MFnDependencyNode ) :
# either be an MObject or a node name in string or unicode form.
def __init__( self, object ) :

if isinstance( object, str ) or isinstance( object, unicode ) :
if isinstance( object, str ) or isinstance( object, six.text_type ) :
object = StringUtil.dependencyNodeFromString( object )

maya.OpenMaya.MFnDependencyNode.__init__( self, object )
Expand Down Expand Up @@ -173,7 +175,7 @@ def parameterPlugPath( self, parameter ) :
# of the maya plug or its OpenMaya.MPlug instance.
def plugParameter( self, plug ) :

if isinstance( plug, str ) or isinstance( plug, unicode ) :
if isinstance( plug, str ) or isinstance( plug, six.text_type ) :
plug = StringUtil.plugFromString( plug )

return _IECoreMaya._parameterisedHolderPlugParameter( self, plug )
Expand Down Expand Up @@ -298,7 +300,7 @@ def _classParameterStates( self, parameter=None, parentParameterPath="", result=

classInfo = parameter.getClasses( True )
if classInfo :
classInfo = zip( *classInfo )
classInfo = list(zip( *classInfo ))
else :
classInfo = [ [], [], [], [] ]

Expand Down
12 changes: 7 additions & 5 deletions python/IECoreMaya/FnSceneShape.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,9 @@
import IECore
import IECoreScene
import IECoreMaya
import StringUtil
from . import StringUtil
import six
from six.moves import range


## A function set for operating on the IECoreMaya::SceneShape type.
Expand Down Expand Up @@ -73,7 +75,7 @@ class FnSceneShape( maya.OpenMaya.MFnDagNode ) :
# either be an MObject or a node name in string or unicode form.
# Note: Most of the member functions assume that this function set is initialized with the full dag path.
def __init__( self, object ) :
if isinstance( object, basestring ) :
if isinstance( object, six.string_types ) :
object = StringUtil.dagPathFromString( object )

maya.OpenMaya.MFnDagNode.__init__( self, object )
Expand All @@ -95,7 +97,7 @@ def create( parentName, transformParent = None, shadingEngine = None ) :
@IECoreMaya.UndoFlush()
def createShape( parentNode, shadingEngine = None ) :
parentShort = parentNode.rpartition( "|" )[-1]
numbersMatch = re.search( "[0-9]+$", parentShort )
numbersMatch = re.search( r"[0-9]+$", parentShort )
if numbersMatch is not None :
numbers = numbersMatch.group()
shapeName = parentShort[:-len(numbers)] + "SceneShape" + numbers
Expand Down Expand Up @@ -163,7 +165,7 @@ def selectedComponentNames( self ) :
## Selects the components specified by the passed names.
def selectComponentNames( self, componentNames ) :
if not isinstance( componentNames, set ) :
if isinstance( componentNames, basestring ):
if isinstance( componentNames, six.string_types ):
componentNames = set( (componentNames, ) )
else:
componentNames = set( componentNames )
Expand Down Expand Up @@ -284,7 +286,7 @@ def __createChild( self, childName, sceneFile, sceneRoot, drawGeo = False, drawC
# Set visible if I have any of the draw flags in my hierarchy, otherwise set hidden
if drawTagsFilter:
childTags = fnChild.sceneInterface().readTags( IECoreScene.SceneInterface.EveryTag )
commonTags = filter( lambda x: str(x) in childTags, drawTagsFilter.split() )
commonTags = [x for x in drawTagsFilter.split() if str(x) in childTags]
if not commonTags:
dgMod.newPlugValueBool( fnChildTransform.findPlug( "visibility" ), False )
else:
Expand Down
4 changes: 2 additions & 2 deletions python/IECoreMaya/FnTransientParameterisedHolderNode.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@
import maya.OpenMaya
import maya.cmds
import IECoreMaya
import _IECoreMaya
import StringUtil
from . import _IECoreMaya
from . import StringUtil

class FnTransientParameterisedHolderNode( IECoreMaya.FnParameterisedHolder ) :

Expand Down
1 change: 1 addition & 0 deletions python/IECoreMaya/GenericParameterUI.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
import IECore
import IECoreMaya.ParameterUI
import IECoreMaya.StringUtil
from six.moves import range

class GenericParameterUI( IECoreMaya.ParameterUI ) :

Expand Down
1 change: 1 addition & 0 deletions python/IECoreMaya/LineSegmentParameterUI.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@

import IECore
import IECoreMaya
from six.moves import range

class LineSegmentParameterUI( IECoreMaya.ParameterUI ) :

Expand Down
2 changes: 1 addition & 1 deletion python/IECoreMaya/ManipulatorUI.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def __manupulateMenuModifier( menuDefinition, parameter, node, parent=None ) :
if parameterManip not in maya.cmds.listNodeTypes( 'ieParameterManipulator' ) :
return

if len( menuDefinition.items() ):
if len( list(menuDefinition.items()) ):
menuDefinition.append( "/ManipulateDivider", { "divider" : True } )

menuDefinition.append(
Expand Down
7 changes: 4 additions & 3 deletions python/IECoreMaya/MayaTypeId.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@
##########################################################################

import maya.OpenMaya
import _IECoreMaya
from . import _IECoreMaya
import six

class _MayaTypeIdMeta(type):

Expand All @@ -45,7 +46,7 @@ def __getattr__( self, n ) :

return maya.OpenMaya.MTypeId( getattr( _IECoreMaya._MayaTypeId, n ) )

class MayaTypeId :
class MayaTypeId(six.with_metaclass(_MayaTypeIdMeta)) :

__metaclass__ = _MayaTypeIdMeta
pass

6 changes: 3 additions & 3 deletions python/IECoreMaya/Menu.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@

import IECore

from UIElement import UIElement
from .UIElement import UIElement

## A class for making maya menus from an IECore.MenuDefinition. The menu is built dynamically when it's
# displayed, so the definition can be edited at any time to change the menu.
Expand Down Expand Up @@ -106,7 +106,7 @@ def _parseDefinition( self, parent, definition ):
if not isinstance( definition, IECore.MenuDefinition ):
raise IECore.Exception( "Definition is not a valid IECore.MenuDefinition object." )

allPaths = dict(definition.items()).keys()
allPaths = list(dict(definition.items()).keys())
rootItemDefinitions = IECore.MenuDefinition( [] )

# scan definition once and get root item definitions
Expand Down Expand Up @@ -178,4 +178,4 @@ def __wrapCallback( self, cb ) :
def __postMenu( self, parent, definition, *args ) :

maya.cmds.menu( parent, edit = True, deleteAllItems = True )
self._parseDefinition( parent, definition )
self._parseDefinition( parent, definition )
1 change: 1 addition & 0 deletions python/IECoreMaya/MeshOpHolderUtil.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@

import IECoreMaya
import IECore
from six.moves import range

def __getFloat3PlugValue(plug):

Expand Down
2 changes: 1 addition & 1 deletion python/IECoreMaya/NodeParameter.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ def __getattr__( self, attrName ):
"""
@staticmethod
def pathValidator():
return re.compile( "^(\|?[^\t\n\r\f\v\|]+)+\|?$" )
return re.compile( r"^(\|?[^\t\n\r\f\v|]+)+\|?$" )

"""
Returns (True, "") only if the value is a correct dependency nodestring and also checks that the node exists or doesn't exist
Expand Down
2 changes: 1 addition & 1 deletion python/IECoreMaya/NumericParameterUI.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ def __init__( self, node, parameter, **kw ) :

kw['precision'] = 12

if parameter.userData().has_key( 'UI' ) :
if 'UI' in parameter.userData() :

if self.parameter.isInstanceOf( IECore.TypeId.DoubleParameter ) or self.parameter.isInstanceOf( IECore.TypeId.FloatParameter ):
precision = parameter.userData()['UI'].get( "precision", None )
Expand Down
1 change: 1 addition & 0 deletions python/IECoreMaya/NumericVectorParameterUI.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@

import IECore
import IECoreMaya
from six.moves import range

class NumericVectorParameterUI( IECoreMaya.ParameterUI ) :

Expand Down
Loading

0 comments on commit 7f59e66

Please sign in to comment.