smartphonenanax.blogg.se

Maya python setattr visibility false
Maya python setattr visibility false













deleteMayaLODChain ( ) # Create a new LOD group object def generateMayaLODChain (self ) : # Clear the old Maya LOD group delete (obj ) # Generates a Maya LOD chain for all the LOD objects by instancing them # under a new object. deleteMayaLODChain ( ) # Delete all LODS for obj in self. LOD_CHAIN_NAME ) # Deletes all LODs in the scene including the Maya LOD chian object. def deleteMayaLODChain ( ) : # Remove existing LOD chain if there is one if cmds. addObject (lod ) # Deletes the Maya LOD group object. _numLODs = lodIndex + 1 # Add a LOD stage if one doesn't exist if lodIndex not in self. getLODIndex (lod ) if lodIndex = None : raise Exception ( "Found a LOD object for which the LOD index could not be obtained." ) if lodIndex > self. # Extract the LOD index from the name of the object for lod in lodObjects : def createLODStages (self, lodObjects ) : distance = 0 # Creates all the LOD stages from the incoming collection of LOD objects. extend (children ) elif not object in objects : Need to make sure # not to add an object twice. listRelatives ( object, c = True, type = "transform" ) # Sometimes the selection contains both parent and child. for object in sourceObjects :Ĭhildren = cmds. Objects = # Loop the hierarchy of the source objects and only add the transform objects. def addSourceMeshes (self, sourceObjects ) : # It will make sure to only add the transforms and clears out parent structures. # They from LODStage0 and will be set to distance 0. _numLODs = 0 # Adds the source meshes that was used to create the LOD stages with. # Resets the LODManager by clearing out the LOD stages. # Returns the number of LOD stages def numLODs (self ) : return self. LOD_CHAIN_NAME = "SIMPLYGON_LOD_CHAIN" def _init_ (self ) : select (newSelection ) class LODManager : """ objects ) # Uses the incoming selection to determine which objects to select in this LOD stage. showHidden ( object ) # Hides the objects in this LOD stage def hide (self ) :Ĭmds. extend (objects ) # Shows the objects in this LOD stage def show (self ) : for object in self. Distance is not calculated when # using this method. append ( object ) # Adds a collection of object to this LOD stage. If it's the distance hasn't been set yet the # recommended switch distance will be calculated using this object def addObject (self, object ) : if self. # The recommended distance to use this LOD stage at def distance (self ) : return self. # The name of the objects in this LOD stage def objects (self ) : return self. _distance = None # The index of this LOD stage def index (self ) : return self. rfind ( "_LOD" ) if lodStrIndex != - 1 : return int ( object ) else : print ( "Could not get the LOD index for " + object ) return None class LODStage : """Ĭontains all the meshes and information about a LOD stage. # Returns the LOD index of the incoming object (based on name) def getLODIndex ( object ) : Not to be confused with normalized distanceĭistance = radius / math. atan (screen_ratio / normalized_distance ) # The distance in real world units from the camera to the center of the # bounding sphere. tan (fov_y / 2 ) ) # The view-angle of the bounding sphere rendered onscreen.īsphere_angle = math. Screen_ratio = float (pixelsize ) / float (screenheight ) getPortFieldOfView (screenwidth, screenheight ) # Calculates screen ratio active3dView ( )ĬurCam = Camera (curCamPath. getMaxDeviation ( object ) # Calculates the pixel size (OnScreenSize)ĬurView = OpenMayaUI. getSceneRadius ( object ) # Reads the MaxDeviation attributeĭeviation = SimplygonWrapper. SimplygonQuery (gpm = True ) # Calculates the recommended distance to start showing the incoming object def calculateLODSwitchDistance ( object ) : # Object is the mesh transform # Reads the. Simplygon (ri = True, sf =settingsFile ,įmn = '' ) return cmds. # Processes the current selection using the specified settings file. getAttr ( object + ".SceneRadius" ) except : print ( "Warning: SceneRadius attribute does not exist on this object." ) return sceneRadius # Retrieves the scene radius of the incoming object def getSceneRadius ( object ) : getAttr ( object + ".MaxDeviation" ) except : print ( "Warning: MaxDeviation attribute does not exist on this object." ) return maxDeviation """ # Retrieves the deviation of the incoming object def getMaxDeviation ( object ) :

#Maya python setattr visibility false update#

nodetypes import CameraĬlass that contains all the Simplygon specificities in order to make it easy to update as Simplygon changes.













Maya python setattr visibility false