當前位置: 首頁>>代碼示例>>Python>>正文


Python cmds.currentUnit方法代碼示例

本文整理匯總了Python中maya.cmds.currentUnit方法的典型用法代碼示例。如果您正苦於以下問題:Python cmds.currentUnit方法的具體用法?Python cmds.currentUnit怎麽用?Python cmds.currentUnit使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在maya.cmds的用法示例。


在下文中一共展示了cmds.currentUnit方法的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: getFrameRate

# 需要導入模塊: from maya import cmds [as 別名]
# 或者: from maya.cmds import currentUnit [as 別名]
def getFrameRate():
    '''
    Return an int of the current frame rate
    '''
    currentUnit = mc.currentUnit(query=True, time=True)
    if currentUnit == 'film':
        return 24
    if currentUnit == 'show':
        return 48
    if currentUnit == 'pal':
        return 25
    if currentUnit == 'ntsc':
        return 30
    if currentUnit == 'palf':
        return 50
    if currentUnit == 'ntscf':
        return 60
    if 'fps' in currentUnit:
        return int(currentUnit.substitute('fps',''))

    return 1 
開發者ID:morganloomis,項目名稱:ml_tools,代碼行數:23,代碼來源:ml_utilities.py

示例2: getDistanceInMeters

# 需要導入模塊: from maya import cmds [as 別名]
# 或者: from maya.cmds import currentUnit [as 別名]
def getDistanceInMeters():

    unit = mc.currentUnit(query=True, linear=True)

    if unit == 'mm':
        return 1000
    elif unit == 'cm':
        return 100
    elif unit == 'km':
        return 0.001
    elif unit == 'in':
        return 39.3701
    elif unit == 'ft':
        return 3.28084
    elif unit == 'yd':
        return 1.09361
    elif unit == 'mi':
        return 0.000621371

    return 1 
開發者ID:morganloomis,項目名稱:ml_tools,代碼行數:22,代碼來源:ml_utilities.py

示例3: BT_SetUnits

# 需要導入模塊: from maya import cmds [as 別名]
# 或者: from maya.cmds import currentUnit [as 別名]
def BT_SetUnits():
    if cmds.currentUnit(q = True, linear = True) != "cm":
        cmds.currentUnit(linear = "cm")
        return True
    return False 
開發者ID:duncanskertchly,項目名稱:BlendTransforms,代碼行數:7,代碼來源:BlendTransforms.py

示例4: dpCheckLinearUnit

# 需要導入模塊: from maya import cmds [as 別名]
# 或者: from maya.cmds import currentUnit [as 別名]
def dpCheckLinearUnit(self, origRadius, defaultUnit="centimeter", *args):
        """ Verify if the Maya linear unit is in Centimeter.
            Return the radius to the new unit size.

            WIP!
            Changing to shapeSize cluster setup
        """
        newRadius = origRadius
    #    newRadius = 1
    #    linearUnit = cmds.currentUnit(query=True, linear=True, fullName=True)
    #    # centimeter
    #    if linearUnit == defaultUnit:
    #        newRadius = origRadius
    #    elif linearUnit == "meter":
    #        newRadius = origRadius*0.01
    #    elif linearUnit == "millimeter":
    #        newRadius = origRadius*10
    #    elif linearUnit == "inch":
    #        newRadius = origRadius*0.393701
    #    elif linearUnit == "foot":
    #        newRadius = origRadius*0.032808
    #    elif linearUnit == "yard":
    #        newRadius = origRadius*0.010936
        return newRadius
    
    
    #@utils.profiler 
開發者ID:nilouco,項目名稱:dpAutoRigSystem,代碼行數:29,代碼來源:dpControls.py

示例5: set_fps

# 需要導入模塊: from maya import cmds [as 別名]
# 或者: from maya.cmds import currentUnit [as 別名]
def set_fps(fps = None):
    fps_string = "pal"
    if fps == 25:
        fps_string = "pal"
    if fps == 24:
        fps_string = "film"
    if fps == 30:
        fps_string = "ntsc"                
    cmds.currentUnit(t=fps_string) 
開發者ID:liorbenhorin,項目名稱:pipeline,代碼行數:11,代碼來源:maya_warpper.py

示例6: initializeGL

# 需要導入模塊: from maya import cmds [as 別名]
# 或者: from maya.cmds import currentUnit [as 別名]
def initializeGL(self):

        #scene measure units
        unit = cmds.currentUnit(q=1, linear=1)
        if unit == "m":
            self.unit = float(self.unit) * 100.0

        self.glFT = OpenMayaRender.MHardwareRenderer.theRenderer().glFunctionTable() 
開發者ID:volodinroman,項目名稱:mViewportDrawOpenGL,代碼行數:10,代碼來源:ViewportPainter.py

示例7: _currentTimeUnit

# 需要導入模塊: from maya import cmds [as 別名]
# 或者: from maya.cmds import currentUnit [as 別名]
def _currentTimeUnit(cls):
		""" Returns the current time unit name. See MayaScene._timeUnitToFPS to map this value
		to real world fps.
		:return: The name of the current fps
		"""
		return cmds.currentUnit(q=True, time=True) 
開發者ID:blurstudio,項目名稱:cross3d,代碼行數:8,代碼來源:mayascene.py

示例8: setAnimationFPS

# 需要導入模塊: from maya import cmds [as 別名]
# 或者: from maya.cmds import currentUnit [as 別名]
def setAnimationFPS(self, fps, changeType=constants.FPSChangeType.Seconds, callback=None):
		""" Updates the scene's fps to the provided value and scales existing keys as specified.
		StudioMax Note: If you have any code that you need to run after changing the fps and plan to use it in
			3dsMax you will need to pass that code into the callback argument.
		Maya Note: Maya only supports specific fps settings. If you provide it with a value it doesn't understand,
			it will be set to the closest matching value. See MayaScene._timeUnitToFPS for valid values.
		:param fps: The FPS value to set.
		:param changeType: <constants.FPSChangeType> Defaults to constants.FPSChangeType.Frames
		:param callback: <funciton> Code called after the fps is changed.
		:return: bool success
		"""
		# Maya doesn't appear to allow you to set the fps to a specific value,
		# so we attempt to find a exact match in our _timeUnitToConst dictonary
		name = self._timeUnitToConst.get(fps)
		if not name:
			# If there isn't a exact match, find the value closest to the requested fps.
			closest = min(self._timeUnitToConst, key=lambda x: abs(x - fps))
			name = self._timeUnitToConst[closest]
		# Only update the fps if the value is different
		if name != self._currentTimeUnit():
			# Only update animation if Seconds is specified
			updateAnimation = changeType == constants.FPSChangeType.Seconds
			cmds.currentUnit(time=name, updateAnimation=updateAnimation)
		if callback:
			callback()
		return True 
開發者ID:blurstudio,項目名稱:cross3d,代碼行數:28,代碼來源:mayascene.py

示例9: reset_frame_range

# 需要導入模塊: from maya import cmds [as 別名]
# 或者: from maya.cmds import currentUnit [as 別名]
def reset_frame_range():
    """Set frame range to current asset"""
    shot = api.Session["AVALON_ASSET"]
    shot = io.find_one({"name": shot, "type": "asset"})

    try:

        frame_start = shot["data"].get(
            "frameStart",
            # backwards compatibility
            shot["data"].get("edit_in")
        )
        frame_end = shot["data"].get(
            "frameEnd",
            # backwards compatibility
            shot["data"].get("edit_out")
        )
    except KeyError:
        cmds.warning("No edit information found for %s" % shot["name"])
        return

    fps = {15: 'game',
           24: 'film',
           25: 'pal',
           30: 'ntsc',
           48: 'show',
           50: 'palf',
           60: 'ntscf',
           23.98: '23.976fps',
           23.976: '23.976fps',
           29.97: '29.97fps',
           47.952: '47.952fps',
           47.95: '47.952fps',
           59.94: '59.94fps',
           44100: '44100fps',
           48000: '48000fps'
           }.get(float(api.Session.get("AVALON_FPS", 25)), "pal")

    cmds.currentUnit(time=fps)

    cmds.playbackOptions(minTime=frame_start)
    cmds.playbackOptions(maxTime=frame_end)
    cmds.playbackOptions(animationStartTime=frame_start)
    cmds.playbackOptions(animationEndTime=frame_end)
    cmds.playbackOptions(minTime=frame_start)
    cmds.playbackOptions(maxTime=frame_end)
    cmds.currentTime(frame_start) 
開發者ID:getavalon,項目名稱:core,代碼行數:49,代碼來源:commands.py


注:本文中的maya.cmds.currentUnit方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。