def setName( self, name ): """ \remarks implements AbstractSceneWrapper.setName to set the name of this atmosepheric instance \sa name \param name <str> \return <bool> success """ self._nativePointer.name = name return True def setEnabled( self, state ): """ \remarks implements AbstractSceneAtmospheric.setEnabled method to set this atmospheric enabled in the scene \param state <bool> \return <bool> success """ mxs.setActive( self._nativePointer, state ) return True def uniqueId( self ): """ \remarks implements AbstractSceneWrapper.uniqueId to return the unique id for this atmospheric instance \sa setUniqueId \return <int> id """ return mxs.blurUtil.uniqueId( self._nativePointer ) # register the symbol import cross3d cross3d.registerSymbol( 'SceneAtmospheric', StudiomaxSceneAtmospheric )
def viewOptions(self): viewOptions = {'Camera Visibility': {}, 'Camera Display': {}} for parameter in self._nativePointer.Properties('Camera Visibility').Parameters: viewOptions['Camera Visibility'][ parameter.ScriptName ] = parameter.Value for parameter in self._nativePointer.Properties('Camera Display').Parameters: viewOptions['Camera Display'][ parameter.ScriptName ] = parameter.Value viewOptions[ 'viewcubeshow' ] = xsi.GetValue('preferences.ViewCube.show') return viewOptions def setViewOptions(self, viewOptions): for prop in viewOptions: if prop in [ 'Camera Visibility', 'Camera Display' ]: for param in viewOptions[prop]: if not param in ['hidlincol', 'wrfrmdpthcuecol']: try: self._nativePointer.Properties(prop).Parameters(param).Value = viewOptions[prop][param] except: print 'TRACEBACK: skipping param: {} {}...'.format(prop, param) print traceback.format_exc() xsi.SetValue('preferences.ViewCube.show', viewOptions.get('viewcubeshow'), xsi.GetValue('preferences.ViewCube.show')) return True # register the symbol import cross3d cross3d.registerSymbol('SceneCamera', SoftimageSceneCamera)
def setDisplayName( self, name ): """ \remarks set the name of this wrapper instance \sa name \param name <str> \return <bool> success """ # NOTE: passing a PyQt4.QtCore.QString object will crash Softimage self.nativePointer().Name = unicode(name) return True def name( self ): return self._nativePointer.FullName def displayName( self ): return self._nativePointer.Name def propertyNames(self): return [prop.name for prop in self._nativePointer.Properties] def hasProperty(self, key): return (key in self.propertyNames()) def isReferenced(self): return self._nativePointer.Model.ModelKind == xsiConstants.siModelKind_Reference # register the symbol import cross3d cross3d.registerSymbol( 'SceneWrapper', SoftimageSceneWrapper )
""" nativeController = cls._createNewNative(scene, controllerType) if nativeController: from cross3d import SceneAnimationController return SceneAnimationController(scene, nativeController) return None def frameRange(self): keys = self.keys() if len(keys) > 1: return FrameRange([keys[0].time(), keys[-1].time()]) return FrameRange([0, 0]) def valueRange(self, frameRange=None): frameRange = self.frameRange() if frameRange is None else frameRange low = None high = None for frame in range(frameRange.start(), frameRange.end() + 1): value = self.valueAtFrame(frame) if low is None or value < low: low = value if high is None or value > high: high = value return (low, high) # register the symbol cross3d.registerSymbol('SceneAnimationController', AbstractSceneAnimationController, ifNotFound=True)
""" Allow the user to edit the renderer """ return False @abstractmethod def rendererType(self): """ Return the renderer type for this instance :return: :data:`cross3d.constants.RendererType` """ return 0 @abstractmethod def setRendererType(self, rendererType): """ Set the renderer type for this instance to the inputed type :param rendererType: :data:`cross3d.constants.RendererType` :return: bool """ return False # register the symbol cross3d.registerSymbol('SceneRenderer', AbstractSceneRenderer, ifNotFound=True)
if rounded: return int(round(fov)) return fov def _nativeFocalLength(self): return self._nativeTypePointer.focalLength() def setLens(self, value): self._nativeTypePointer.setFocalLength(value) def matchViewport(self, viewport): return self.matchCamera(viewport.camera()) def matchCamera(self, camera): """ Match this camera to another one. """ self.setParameters(camera.parameters()) self.setViewOptions(camera.viewOptions()) self.matchTransforms(camera) return True def pictureRatio(self): return self._nativeTypePointer.aspectRatio() def setPictureRatio(self, pictureRatio): self._nativeTypePointer.setAspectRatio(pictureRatio) return True # register the symbol import cross3d cross3d.registerSymbol('SceneCamera', MayaSceneCamera)
# Clearing the temporary holders. self._vault['name'] = None self._vault['nativeObjects'] = None self._vault['nativeGroups'] = None def export(self, fileName): # Exploding in Max means basically loosing the name space. self.explode() # ExportNativeObjects call will trigger sceneSaveFinished and scene data is invalid until the name space is restored. dispatch.blockSignals(True) self._scene._exportNativeObjects( self._vault.get('nativeObjects') + [self._nativePointer], fileName) dispatch.blockSignals(False) # Recomposing reverts the name space. self.recompose() def _nativeGroups(self, wildcard='*'): """ For groups in Max we return native layers instead since they do not exist. """ return self._scene._nativeLayers('.'.join( [self.displayName(), wildcard])) # register the symbol import cross3d cross3d.registerSymbol('SceneModel', StudiomaxSceneModel)
def isEnabled(self): """ \remarks implements the AbstractSceneCache.isEnabled method to return wether or not this cache is enabled in the scene \return <bool> enabled """ return self._nativePointer.enabled def setEnabled(self, state): """ \remarks implements the AbstractSceneCache.setEnabled method to mark whether or not this cache is enabled in the scene \param state <bool> \return <bool> success """ self._nativePointer.enabled = state return True def setFilename(self, filename): """ \remarks implements the AbstractSceneCache.setFilename method to set the filename for this cache data to the inputed filename \param filename <str> \return <bool> success """ self._nativePointer.filename = filename return True # register the symbol import cross3d cross3d.registerSymbol('SceneCache', StudiomaxSceneCache)
return '' @abstractmethod def value(self, propname, default=None): """ Return the value for the inputed propname, returining the default value if not found """ return default @staticmethod def fromXml(scene, xml): """ Restores a property set from the scene based on the inputed xml :param scene: :class:`cross3d.Scene` :param xml: :class:`cross3d.migrate.XMLElement` :return: :class:`cross3d.classes.ScenePropSet` or None """ if (not xml): return None return scene.findPropSet(name=xml.attribute('name'), uniqueId=int(xml.attribute('id', 0))) # register the class to the system cross3d.registerSymbol('ScenePropSet', AbstractScenePropSet) cross3d.registerSymbol('SceneObjectPropSet', AbstractScenePropSet)
# update the atmospherics on this layer for atmos in self.atmospherics(): atmos.setEnabled( not state ) # update the fx instances on this layer for fx in self.fxs(): fx.setEnabled( not state ) return True def setUniqueId( self, uniqueId ): """ \remarks implements the AbstractSceneLayer.setUniqueId method to set the unique layer id for this layer instance \sa uniqueId \param uniqueId <int> \return <bool> success """ mxs.blurUtil.setUniqueId( self._nativePointer.layerAsRefTarg, uniqueId ) return True def uniqueId( self ): """ \remarks implements the AbstractSceneLayer.uniqueId method to retrieve the unique layer id for this layer instance \sa setUniqueId \return <int> id """ return mxs.blurUtil.uniqueId( self._nativePointer.layerAsRefTarg ) # register the symbol cross3d.registerSymbol( 'SceneLayer', StudiomaxSceneLayer )
# protected methods #------------------------------------------------------------------------------------------------------------------------ def _nativeCamera( self ): cameraName = self.nativePointer().Camera.Value from cross3d import Scene scene = Scene() return scene.findObject( cameraName ) def _setNativeCamera( self, nativeCamera ): self.nativePointer().Camera.Value = nativeCamera.FullName return True #------------------------------------------------------------------------------------------------------------------------ # public methods #------------------------------------------------------------------------------------------------------------------------ def name( self ): return self.nativePointer().FullName def displayName( self ): return self.nativePointer().Name def setDisplayName( self, name ): self.nativePointer().Name = name return True # register the symbol import cross3d cross3d.registerSymbol( 'SceneRenderPass', SoftimageSceneRenderPass )
@abstractmethod def filters(self): """Returns a list of stringified names of enabled filters on the TrackGroup. Returns: list: A list of the string names of enabled filters. """ return None @abstractmethod def getClipPortions(self, occludedPortions=[]): """Analyzes the weights for all tracks in the TrackGroup and returns a tuple of two lists, a list of ClipPortion instance for every used section of clips within the TrackGroup, and a list of TrackPortion instances for every occluding portion in the TrackGroup. Returns: tuple: A tuple containing a list of ClipPortion instances for each used portion of a Clip in any enabled Track in the TrackGroup, and a list of TrackPortion instances for each portion of fully occluding Clip in any enabled Track in the TrackGroup. """ return None # register the symbol cross3d.registerSymbol('TrackGroup', AbstractTrackGroup, ifNotFound=True)
\sa name \param name <str> \return <bool> success """ if hasattr(self._nativePointer, 'name'): self._nativePointer.name = name return True else: return False def setEnabled(self, state, ids=[]): """ \remarks this is a no-op since there doesn't appear to be a way to affect dynamics object this way. \param state <bool> \return <bool> success """ mxs.cross3dhelper.toggleSubDyn(self.nativePointer(), state) def uniqueId(self): """ \remarks implements AbstractSceneWrapper.uniqueId to return the unique id for this fx instance \sa setUniqueId \return <int> id """ return mxs.blurUtil.uniqueId(self._nativePointer) # register the symbol import cross3d cross3d.registerSymbol('SceneFx', StudiomaxSceneFx)
instances. """ yield None @abstractmethod def trackGroups(self): """Returns a list of TrackGroup instances for every TrackGroup in the Mixer, ordered from top to bottom. Returns: list: A list of TrackGroup instances. """ return None @abstractmethod def getClipPortions(self): """Analyzes the weights for all tracks in all TrackGroups in the Mixer, and compares the filters on each track group in order to generate a list of ClipPortion instance for every used section of every clip on an enabled Track. Returns: list: A list of ClipPortion instances for each used portion of a Clip. """ return None # register the symbol cross3d.registerSymbol('Mixer', AbstractMixer, ifNotFound=True)
cross3d.UserProps(self._nativePointer )['reference'] = cmds.referenceQuery( referenceNodeName, filename=True) # Setting the current resolution property. self.setProperty(resolutionAttr, i) return True else: self.userProps()[resolutionAttr] = resolution return True def setResolutionPath(self, path, name=''): return False def update(self): return False def _setModelUserProps(self, newDict): super(MayaSceneModel, self).setUserProps(newDict) def _referenceNodeName(self): filename = self.userProps().get('reference') if filename: return cmds.referenceQuery(filename, referenceNode=True) return None # register the symbol cross3d.registerSymbol('SceneModel', MayaSceneModel)
import cross3d from cross3d.abstract.abstractgroup import AbstractGroup class MayaGroup(AbstractGroup): pass # register the symbol cross3d.registerSymbol('Group', MayaGroup)
\remarks overloading the AbstractSceneAnimationKey.propertyNames method to remove 'value' and 'time' from the properties since these should be accessed via the time/setTime and value/setValue methods \return <list> [ <str> propname, .. ] """ names = AbstractSceneAnimationKey.propertyNames( self ) if ( 'time' in names ): names.remove('time') if ( 'value' in names ): names.remove('value') return names def setTime( self, time ): """ \remarks implements the AbstractSceneAnimationKey.setTime method to set the value of this key to the inputed value \param time <float> \return <bool> success """ self._nativePointer.time = time return True def time( self ): """ \remarks implements the AbstractSceneAnimationKey.time method to return the time frame of this key \return <float> value """ return float(self._nativePointer.time) # register the symbol import cross3d cross3d.registerSymbol( 'SceneAnimationKey', StudiomaxSceneAnimationKey )
:return: :class:`cross3d.Scene` or None """ return self._scene @abstractmethod def setEnabled(self, state): """Set whether or not this atmospheric is currently enabled in the scene :return: True if successful """ return False @classmethod def fromXml(cls, scene, xml): """Restore the atmospheric from the inputed xml node :param scene: :class:`cross3d.Scene` :param xml: :class:`cross3d.migrate.XMLElement` :return: :class:`cross3d.SceneAtmospheric` or None """ return scene.findAtmospheric(name=xml.attribute('name'), uniqueId=int(xml.attribute('id', 0))) # register the symbol cross3d.registerSymbol('SceneAtmospheric', AbstractSceneAtmospheric, ifNotFound=True)
def setHidden(self, key, state): """ Hide the mecinism that stores user props in software that supports it. :param key: The key used to access the user prop :param state: If the item is hidden or shown """ prop = self._nativePointer.Properties(key) if not prop: raise KeyError('%s is not a property' % key) prop.SetCapabilityFlag(constants.siNotInspectable, state) return True @staticmethod def escapeValue(string): """ \remarks replaces any unstorable characters in value with their html codes \return <str> """ if not isinstance(string, (str, unicode)): string = unicode(string) return string class SoftimageFileProps(SoftimageUserProps): def __init__(self, nativePointer): super(SoftimageFileProps, self).__init__( cross3d.Scene().rootObject().nativePointer()) # register the symbol cross3d.registerSymbol('UserProps', SoftimageUserProps) cross3d.registerSymbol('FileProps', SoftimageFileProps)
If set to true, the refresh method will not refresh. """ if self._blockRefresh != blockRefresh: self._blockRefresh = blockRefresh cross3d.Scene().setUpdatesEnabled(not blockRefresh) return True return False def shouldBlockSignal(self, signal, default): """ Allows the Application to conditionally block a signal. Normally you should pass cross3d.dispatch.signalsBlocked() to default. In general if default is True this method should just return True. This will prevent unexpected signal emits when a script called cross3d.dispatch.blockSignals(True) to block all signals. Args: signal (str): The name of the signal to check if it should be blocked. default (bool): Returned if signal doesn't match any requirements. Returns: bool: If the signal should be blocked. """ return default # register the symbol cross3d.registerSymbol('Application', AbstractApplication, ifNotFound=True) # Creating a single instance of Application for all code to use. cross3d.registerSymbol('application', AbstractApplication(), ifNotFound=True)
'14000': "Max2012", '16000': "Max2014", '18000': "Max2016", 'default': "Max2014"} if jobTypeDic.has_key(str(version[0])): jobType = jobTypeDic[str(version[0])] else: jobType = jobTypeDic['default'] return jobType def id(self): """ \remarks implements AbstractScene.softwareId to return a unique version/bits string information that will represent the exact version of the software being run. \return <str> """ mversion = mxs.maxVersion()[0]/1000 sixtyfour = '' if ( mversion > 10 ): mversion = 2009 + (mversion-11) # shifted to years at version 11 if ( mxs.is64BitApplication() ): sixtyfour = '_64' return 'MAX%i%s' % (mversion,sixtyfour) # register the symbol cross3d.registerSymbol( 'Application', StudiomaxApplication) # Creating a single instance of Application for all code to use. cross3d.registerSymbol( 'application', StudiomaxApplication())
""" \remarks [virtual] returns the nativeObject Type of the ObjectType supplied \param <variant> ObjectType || None \return <bool> success """ return None @staticmethod def _subclasses(cls, classes=[], includeClass=False): if includeClass: classes.append(cls) for subclass in cls.__subclasses__(): cls._subclasses(subclass, classes, True) return classes @staticmethod def fromXml(scene, xml): """Create a new object from the inputed xml data :param xml: :class:`cross3d.migrate.XMLElement` """ if (xml): return scene.findObject(name=xml.attribute('name'), uniqueId=int(xml.attribute('id', 0))) return None # register the symbol cross3d.registerSymbol('SceneObject', AbstractSceneObject, ifNotFound=True)
def _nativeCamera(self): # new douglas return None def _setNativeCamera(self, nativeCamera): # new douglas return False #------------------------------------------------------------------------------------------------------------------------ # public methods #------------------------------------------------------------------------------------------------------------------------ def camera(self): # new douglas from cross3d import SceneCamera return SceneCamera(self._nativeCamera()) def setCamera(self, sceneCamera): # new douglas return self._setNativeCamera(sceneCamera.nativePointer()) def name(self): # new douglas return "" def displayName(self): # new douglas return "" def setDisplayName(self, name): # new douglas return False # register the symbol cross3d.registerSymbol('SceneRenderPass', AbstractSceneRenderPass)
""" Set the value of this key to the inputed value. Returns True. if successful, False otherwise. """ return self._setNativeValue(self._scene._toNativeValue(value)) @abstractmethod def time(self): """ Return the time frame of this key. """ return 0.0 def value(self): """ Return the value of this key. """ return self._scene._fromNativeValue(self._nativeValue()) @abstractmethod def setTangentType(self, tangeantType): return False @abstractmethod def tangentType(self): return 0 # register the symbol cross3d.registerSymbol('SceneAnimationKey', AbstractSceneAnimationKey, ifNotFound=True)
\sa name \param name <str> \return <bool> success """ if hasattr(self._nativePointer, 'name'): self._nativePointer.name = name return True else: return False def setEnabled(self, state, ids=[]): """ \remarks this is a no-op since there doesn't appear to be a way to affect dynamics object this way. \param state <bool> \return <bool> success """ mxs.cross3dhelper.toggleSubDyn(self.nativePointer(), state) def uniqueId( self ): """ \remarks implements AbstractSceneWrapper.uniqueId to return the unique id for this fx instance \sa setUniqueId \return <int> id """ return mxs.blurUtil.uniqueId( self._nativePointer ) # register the symbol import cross3d cross3d.registerSymbol( 'SceneFx', StudiomaxSceneFx )
""" return [f for f in self.iterFilters()] def getClipPortions(self, occludedPortions=[]): """Analyzes the weights for all tracks in the TrackGroup and returns a tuple of two lists, a list of ClipPortion instance for every used section of clips within the TrackGroup, and a list of TrackPortion instances for every occluding portion in the TrackGroup. Returns: tuple: A tuple containing a list of ClipPortion instances for each used portion of a Clip in any enabled Track in the TrackGroup, and a list of TrackPortion instances for each portion of fully occluding Clip in any enabled Track in the TrackGroup. """ ClipPortions = [] for track in self.iterEnabledTracks(): sc, occl = track.analyzeWeights(occludedPortions) occludedPortions.extend(occl) ClipPortions.extend(sc) return ClipPortions, occludedPortions ################################################################################ # register the symbol import cross3d cross3d.registerSymbol('TrackGroup', StudiomaxTrackGroup)
for tr in usedTrackPortions: start = max(clip.globStart, tr.start) end = min(clip.globEnd, tr.end) if end > start: currClipPortions.append(ClipPortion(clip, start, end)) # Coalesce ClipPortions for this clip before appending to the output clipPortions.extend(self._coalesceClipPortions(currClipPortions)) return clipPortions def _coalesceClipPortions(self, inputPortions): ClipPortions = [] portion = inputPortions.pop(0) scStart = portion.start scEnd = portion.end while len(inputPortions): portion = inputPortions.pop(0) if scEnd == portion.start: scEnd = portion.end else: ClipPortions.append(ClipPortion(portion.clip, scStart, scEnd)) scStart, scEnd = portion.start, portion.end ClipPortions.append(ClipPortion(portion.clip, scStart, scEnd)) return ClipPortions ################################################################################ # register the symbol import cross3d cross3d.registerSymbol('Track', StudiomaxTrack)
@abstractmethod def uniqueId(self): """Return the unique id for this controller instance """ return 0 def userProps(self): """Returns the UserProps object associated with this element :return; :class:`cross3d.UserProps` """ return UserProps(self._nativePointer) #------------------------------------------------------------------------------------------------------------------------ # static/class methods #------------------------------------------------------------------------------------------------------------------------ @classmethod def fromXml(cls, scene, xml): """Create a new wrapper instance from the inputed xml data :param xml: :class:`cross3d.migrate.XMLElement` """ return 0 # register the symbol cross3d.registerSymbol('SceneWrapper', AbstractSceneWrapper, ifNotFound=True)
# record booleans as integers if ( type(val) == bool ): val = int(val) output.append( str(val) ) return '|'.join( output ) def setValue( self, key, value ): if ( key == 'Mr_castModeFGIllum' ): value = self.castModeFgIllumDict.get( str(value).lower(), value ) return StudiomaxScenePropSet.setValue( self, key, value ) def value( self, key ): value = StudiomaxScenePropSet.value( self, key ) # map this property from a name to an integer if ( key == 'Mr_castModeFGIllum' ): for n, val in self.castModeFgIllumDict.items(): if ( val == value ): return mxs.pyhelper.namify(n) return value # register the class to the system import cross3d cross3d.registerSymbol( 'ScenePropSet', StudiomaxScenePropSet ) cross3d.registerSymbol( 'SceneObjectPropSet', StudiomaxSceneObjectPropSet )
# Also you will notice we set the reference path using the reference variable and not the path one. # Well believe or not the second time you load a reference the actual "resolved" path get a {1} suffix. # You can see that if you look in File > Reference Editor. cross3d.UserProps(self._nativePointer)['reference'] = cmds.referenceQuery(referenceNodeName, filename=True) # Setting the current resolution property. self.setProperty(resolutionAttr, i) return True else: self.userProps()[resolutionAttr] = resolution return True def setResolutionPath(self, path, name=''): return False def update(self): return False def _setModelUserProps(self, newDict): super(MayaSceneModel, self).setUserProps(newDict) def _referenceNodeName(self): filename = self.userProps().get('reference') if filename: return cmds.referenceQuery(filename, referenceNode=True) return None # register the symbol cross3d.registerSymbol('SceneModel', MayaSceneModel)
def filename(self): """Return the filename that this cache is pulling from """ return '' @abstractmethod def isEnabled(self): """Return wether or not this cache is enabled in the scene """ return False @abstractmethod def setEnabled(self, state): """Mark whether or not this cache is enabled in the scene """ return False @abstractmethod def setFilename(self, filename): """Set the filename for this cache data to the inputed filename """ return False # register the symbol cross3d.registerSymbol('SceneCache', AbstractSceneCache, ifNotFound=True)
mapRefs[mapPath] = bitmap bitmap.name = os.path.basename(mapPath) + '_{}'.format(prop) mtl.setProperty(propMap[prop], bitmap) # If we have a list of object names that the material # should be assigned to, get the object by name and do so. for objName in objects: obj = mxs.getNodeByName(objName) if obj: obj.material = mtl scn = Scene() return StudiomaxSceneMaterial(scn, mtl) def name(self): """The name of this material.""" return self._nativePointer.name def setName(self, name): """Sets the name of this material. Args: name(str): The new material name. """ self._nativePointer.name = name def uniqueId(self): """The unique ID of this material.""" return mxs.blurUtil.uniqueId(self._nativePointer) import cross3d cross3d.registerSymbol('SceneMaterial', StudiomaxSceneMaterial)
## # \namespace cross3d.studiomax.collection # # \remarks This module implements the collection class allowing to manipulate multiple objects. # # \author douglas # \author Blur Studio # \date 04/20/15 # #------------------------------------------------------------------------------------------------------------------------ import cross3d from cross3d.abstract.collection import Collection as AbstractCollection class Collection(AbstractCollection): pass # Registering the symbol. cross3d.registerSymbol('Collection', Collection)
import cross3d from cross3d.abstract.abstractgroup import AbstractGroup class MayaGroup(AbstractGroup): pass # register the symbol cross3d.registerSymbol('Group', MayaGroup)
return ':' def refresh(self): if not self._blockRefresh: # Ensure the scene object is created. if self._scene == None: self._scene = cross3d.Scene() self._scene.viewport().nativePointer().refresh(True, True) return True return False def sceneFileExtension(self): return 'ma' def modelFileExtension(sefl): return 'ma' def version(self): v = cmds.about(version=True).replace(' x64', '') return int(v) def year(self): return self.version() # register the symbol cross3d.registerSymbol('Application', MayaApplication) # Creating a single instance of Application for all code to use. cross3d.registerSymbol('application', MayaApplication())
import cross3d from cross3d import SceneWrapper, abstractmethod class AbstractSceneMap(SceneWrapper): #------------------------------------------------------------------------------------------------------------------------ # public methods #------------------------------------------------------------------------------------------------------------------------ @abstractmethod def edit(self): """Allow the user to edit the map """ return False @staticmethod def fromXml(scene, xml): """Create a new map from the inputed xml data :param xml: :class:`cross3d.migrate.XMLElement` """ if (xml): return scene.findMap(name=xml.attribute('name'), uniqueId=int(xml.attribute('id', 0))) return None # register the symbol cross3d.registerSymbol('SceneMap', AbstractSceneMap, ifNotFound=True)
self._end = end @property def end(self): """The end of the region, in global frames.""" return self._end @end.setter def end(self, value): self._end = value @property def start(self): """The start of the region, in global frames.""" return self._start @start.setter def start(self, value): self._start = value @property def track(self): """The associated Track object.""" return self._track @track.setter def track(self, value): self._track = value ################################################################################ # register the symbol cross3d.registerSymbol('TrackPortion', AbstractTrackPortion, ifNotFound=True)
""" Allow the user to edit the renderer """ return False @abstractmethod def rendererType(self): """ Return the renderer type for this instance :return: :data:`cross3d.constants.RendererType` """ return 0 @abstractmethod def setRendererType(self, rendererType): """ Set the renderer type for this instance to the inputed type :param rendererType: :data:`cross3d.constants.RendererType` :return: bool """ return False # register the symbol cross3d.registerSymbol('SceneRenderer', AbstractSceneRenderer, ifNotFound=True)
'default' : "XSI2013"} if versionDic.has_key(version): jobType = versionDic[str(version)] else: jobType = versionDic['default'] #print("debug =" + jobType) return jobType def refresh( self ): if not self._blockRefresh: xsi.SceneRefresh() xsi.Refresh() return True return False def log( self, message ): xsi.LogMessage( message ) def sceneFileExtension(self): return 'scn' def modelFileExtension(self): return 'emdl' # register the symbol cross3d.registerSymbol( 'Application', SoftimageApplication) # Creating a single instance of Application for all code to use. cross3d.registerSymbol( 'application', SoftimageApplication())
occludedPortions.extend(atg['occludedPortions']) sc, occl = tg.getClipPortions(occludedPortions=occludedPortions) tgInfo['occludedPortions'] = occl tgInfo['i'] = i clipPortions.extend(sc) analyzedTrackGroups.append(tgInfo) if start or end: clipPortions = self._cropClipPortions(clipPortions, start, end) return clipPortions def _cropClipPortions(self, clipPortions, start, end): cpReturn = [] for clipPortion in clipPortions: if clipPortion.start < start: if clipPortion.end < start: continue clipPortion.start = start if clipPortion.end > end: if clipPortion.start > end: continue clipPortion.end = end cpReturn.append(clipPortion) return cpReturn ################################################################################ # register the symbol import cross3d cross3d.registerSymbol('Mixer', StudiomaxMixer)
for frame in range(start, end + 1): currentValue = self.valueAtFrame(frame) if closest: if abs(value - currentValue) < abs(value - closestValue): closestValue = currentValue closestFrame = frame if round(currentValue) == round(value): if previousValue is None or abs( value - currentValue) < abs(value - previousValue): frames[index] = frame # Saving value as previous value. previousValue = currentValue elif frames.get(index): index += 1 previousValue = None if not frames and closest: return [closestFrame] return sorted(frames.values()) # register the symbol import cross3d cross3d.registerSymbol('SceneAnimationController', StudiomaxSceneAnimationController)
import cross3d from cross3d import SceneWrapper, abstractmethod class AbstractSceneMap(SceneWrapper): #------------------------------------------------------------------------------------------------------------------------ # public methods #------------------------------------------------------------------------------------------------------------------------ @abstractmethod def edit(self): """Allow the user to edit the map """ return False @staticmethod def fromXml(scene, xml): """Create a new map from the inputed xml data :param xml: :class:`cross3d.migrate.XMLElement` """ if (xml): return scene.findMap(name=xml.attribute('name'), uniqueId=int(xml.attribute('id', 0))) return None # register the symbol cross3d.registerSymbol('SceneMap', AbstractSceneMap, ifNotFound=True)
""" \remarks implements AbstractSceneRenderer.edit to allow the user to edit the renderer \return <bool> success """ medit = mxs.medit medit.PutMtlToMtlEditor( self._nativePointer, medit.GetActiveMtlSlot() ) mxs.matEditor.open() return True def rendererType( self ): """ \remarks implements AbstractSceneRenderer.rendererType to return the renderer type for this instance \sa setRendererType \return <cross3d.constants.RendererType> """ from cross3d.constants import RendererType classname = str(mxs.classof(self._nativePointer)).lower() if ( classname == 'default_scanline_renderer' ): return RendererType.Scanline elif ( classname == 'mental_ray_renderer' ): return RendererType.MentalRay elif ( 'v_ray' in classname ): return RendererType.VRay return 0 # register the symbol import cross3d cross3d.registerSymbol( 'SceneRenderer', StudiomaxSceneRenderer )
## # :namespace cross3d.studiomax.studiomaxgroup # # :remarks [desc::commented] # # :author douglas # :author Blur Studio # :date 09/26/13 # import cross3d from cross3d.studiomax.studiomaxscenelayer import StudiomaxSceneLayer class StudiomaxGroup(StudiomaxSceneLayer): ''' Since Max does not have a native group object that fit our need, we are exposing layers instead. For your information, native groups in Max are a way to contain a bunch of object under a single transform. ''' pass # register the symbol cross3d.registerSymbol('Group', StudiomaxGroup)
model = self._scene._findNativeObject(split[0]) if model and UserProps(model).get('model'): split[-1] = unicode(name) name = '.'.join(split) self._nativePointer.name = name return True def hasProperty( self, key ): """ \remarks implements the AbstractSceneWrapper.hasProperty method to check to see if the inputed property name exists for this controller \sa property, setProperty \param key <str> \return <bool> found """ key = unicode(key) return mxs.isProperty( self._nativePointer, key ) or mxs.hasProperty( self._nativePointer, key ) def propertyNames( self ): """ \remarks implements the AbstractSceneWrapper.propertyNames method to return a list of the properties that this object can access \return <list> [ <str> propname, .. ] """ return [ unicode(propname) for propname in mxs.getPropNames( self._nativePointer ) ] # register the symbol import cross3d cross3d.registerSymbol( 'SceneWrapper', StudiomaxSceneWrapper )
## # \namespace cross3d.softimage.collection # # \remarks This module implements the collection class allowing to manipulate multiple objects. # # \author douglas # \author Blur Studio # \date 04/20/15 # #------------------------------------------------------------------------------------------------------------------------ import cross3d from cross3d.abstract.collection import Collection as AbstractCollection class Collection(AbstractCollection): pass # Registering the symbol. cross3d.registerSymbol('Collection', Collection)
""" return self._scene @abstractmethod def setEnabled(self, state): """Set whether or not this atmospheric is currently enabled in the scene :return: True if successful """ return False @classmethod def fromXml(cls, scene, xml): """Restore the atmospheric from the inputed xml node :param scene: :class:`cross3d.Scene` :param xml: :class:`cross3d.migrate.XMLElement` :return: :class:`cross3d.SceneAtmospheric` or None """ return scene.findAtmospheric(name=xml.attribute('name'), uniqueId=int(xml.attribute('id', 0))) # register the symbol cross3d.registerSymbol('SceneAtmospheric', AbstractSceneAtmospheric, ifNotFound=True)
width = size[0] height = size[1] cmds.setAttr('defaultResolution.width', width) cmds.setAttr('defaultResolution.height', height) return True def setSelection(self, objects, additive=False): """ Selects the inputed objects in the scene :param objects: <list> [ <cross3d.SceneObject>, .. ] :return: <bool> success """ if isinstance(objects, basestring): return self._addToNativeSelection(objects) if additive else self._setNativeSelection(objects) elif isinstance(objects, _collections.Iterable): # Note: This is passing the transform object not the nativePointer nativeObjects = [obj._nativeTransform for obj in objects] return self._addToNativeSelection(nativeObjects) if additive else self._setNativeSelection(nativeObjects) raise TypeError('Argument 1 must be str or list of cross3d.SceneObjects') def viewports(self): """ Returns all the visible viewports :return: [<cross3d.SceneViewport>, ...] """ out = [] for index in range(omUI.M3dView.numberOf3dViews()): out.append(cross3d.SceneViewport(self, index)) return out # register the symbol cross3d.registerSymbol('Scene', MayaScene)
frameRange(FrameRange): If provided, all frames within this range will be analyzed. Otherwise, only the current frame will be analyzed. step(int): Step to use within frameRange for analysis. allowClipping(bool): Whether the camera's near/far clipping planes should be considered for object culling. """ return [] def matchCamera(self, camera): """ Match this camera to another one. """ return False def restoreViewOptions(self): """ Stores this camera view options. """ return self.setViewOptions(self._viewOptions) def storeViewOptions(self): """ Restores previously stored view options. """ self._viewOptions = self.viewOptions() return True # register the symbol cross3d.registerSymbol('SceneCamera', AbstractSceneCamera, ifNotFound=True)
def lookupProps(self): dso = self.dso() if self.dso().open(self.fileName): self._scheduleClose() ret = {} [ ret.update({prop.name(): self.unescapeValue(prop.value())}) for prop in self.dso().customProperties() ] return ret else: raise cross3d.Exceptions.FileNotDSO def update(self, *args, **kwargs): """ Adds all provided items and imedeately saves the changes. There is no QTimer delay. """ if self.dso().open(self.fileName): for k, v in dict(*args, **kwargs).iteritems(): self[k] = v self._saveScheduled = True self._close() else: raise cross3d.Exceptions.FileNotDSO # register the symbol cross3d.registerSymbol('UserProps', AbstractUserProps, ifNotFound=True) cross3d.registerSymbol('FileProps', AbstractFileProps, ifNotFound=True)
def slateIsActive( self ): import cross3d application = cross3d.application version = application.version() if version > 9: camera = self._nativeCamera() return xsi.GetValue( camera.FullName + '.camvis.camerainfo' ) return False def setSlateIsActive( self, state ): import cross3d application = cross3d.application version = application.version() if version > 9: camera = self._nativeCamera() xsi.SetValue( camera.FullName + '.camvis.camerainfo', state ) return True def setSlateText( self, text='' ): import cross3d application = cross3d.application version = application.version() if version > 9: camera = self._nativeCamera() xsi.SetValue( camera.FullName + '.camvis.camerainfotext', text ) return True # register the symbol import cross3d cross3d.registerSymbol( 'SceneViewport', SoftimageSceneViewport )
import cross3d from PyQt4.QtCore import QObject class AbstractUndoContext(QObject): def __init__(self, name): super(AbstractUndoContext, self).__init__() self.name = name def __enter__(self): return None def __exit__(self, exc_type, exc_value, traceback): return False @classmethod def openUndo(cls, name): return None @classmethod def closeUndo(cls): return False # register the symbol cross3d.registerSymbol('UndoContext', AbstractUndoContext, ifNotFound=True)
# \author Blur Studio # \date 09/28/15 # import Py3dsMax from Py3dsMax import mxs from cross3d.abstract.mixer.trackportion import AbstractTrackPortion ################################################################################ #####------------------------------ Classes -------------------------------##### ################################################################################ class StudiomaxTrackPortion(AbstractTrackPortion): """A region within a Track. Attributes: end: The end of the region, in global frames. start: The start of the region, in global frames. """ def __str__(self): return '{}: {}-{}'.format(self.track, self.start, self.end) ################################################################################ # register the symbol import cross3d cross3d.registerSymbol('TrackPortion', StudiomaxTrackPortion)
should be accessed via the time/setTime and value/setValue methods \return <list> [ <str> propname, .. ] """ names = AbstractSceneAnimationKey.propertyNames(self) if ('time' in names): names.remove('time') if ('value' in names): names.remove('value') return names def setTime(self, time): """ \remarks implements the AbstractSceneAnimationKey.setTime method to set the value of this key to the inputed value \param time <float> \return <bool> success """ self._nativePointer.time = time return True def time(self): """ \remarks implements the AbstractSceneAnimationKey.time method to return the time frame of this key \return <float> value """ return float(self._nativePointer.time) # register the symbol import cross3d cross3d.registerSymbol('SceneAnimationKey', StudiomaxSceneAnimationKey)