当前位置: 首页>>代码示例>>Python>>正文


Python util.capitalize函数代码示例

本文整理汇总了Python中pymel.util.capitalize函数的典型用法代码示例。如果您正苦于以下问题:Python capitalize函数的具体用法?Python capitalize怎么用?Python capitalize使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了capitalize函数的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: pymelName

    def pymelName(self, forceType=None):
        parts = list(self)
        if forceType:
            parts[0] = forceType
        else:
            mfn = getattr( api, self[0] )
            mayaTypeDict = apiCache.apiEnumsToMayaTypes[ mfn().type() ]
            parts[0] = _util.capitalize( mayaTypeDict.keys()[0] )

        return '.'.join( [str(x) for x in parts] )
开发者ID:cgrebeld,项目名称:pymel,代码行数:10,代码来源:apicache.py

示例2: __new__

	def __new__(cls, transform, **kwargs):
		if not isinstance(transform, Transform):
			transform = transform.getParent()
		select(transform, replace=True)
		nClothCreate()
		shape = selected()[0]
		nc_xform = shape.getParent()
		rename(nc_xform, transform.namespace() + 'snCloth' + \
			_util.capitalize(transform.name().split(':')[-1]))
		shape.__class__ = cls
		return shape
开发者ID:jedmao,项目名称:maya-scripts,代码行数:11,代码来源:ncloth.py

示例3: _createUIClasses

def _createUIClasses():

    for funcName in _factories.uiClassList:
        # Create Class
        classname = _util.capitalize(funcName)
        try:
            cls = dynModule[classname]
        except KeyError:
            if classname.endswith("Layout"):
                bases = (Layout,)
            else:
                bases = (PyUI,)
            dynModule[classname] = (_factories.MetaMayaUIWrapper, (classname, bases, {}))
开发者ID:kinetifex,项目名称:pymel,代码行数:13,代码来源:uitypes.py

示例4: _createClassCommands

def _createClassCommands():
    def createCallback( classname ):
        """
        create a callback that will trigger lazyLoading
        """
        def callback(*args, **kwargs):
            import uitypes
            res = getattr(uitypes, classname)(*args, **kwargs)
            return res
        return callback

    for funcName in _factories.uiClassList:
        # Create Class
        classname = _util.capitalize(funcName)
        #cls = _uitypes[classname]

        # Create Function
        func = _factories.functionFactory( funcName, createCallback(classname), _thisModule, uiWidget=True )
        if func:
            func.__module__ = __name__
            setattr(_thisModule, funcName, func)
开发者ID:CountZer0,项目名称:pymel,代码行数:21,代码来源:windows.py

示例5: _createUIClasses

def _createUIClasses():
    immediate = bool(os.environ.get('PYMEL_NO_LAZY_TYPES', False))

    for funcName in _factories.uiClassList:
        # Create Class
        classname = _util.capitalize(funcName)
        try:
            cls = dynModule[classname]
        except KeyError:
            if classname.endswith(('Layout', 'Grp')):
                bases = (Layout,)
            elif classname.endswith('Panel'):
                bases = (Panel,)
            else:
                bases = (PyUI,)
            if immediate:
                setattr(dynModule, classname,
                        _factories.MetaMayaUIWrapper(classname, bases, {}))
            else:
                dynModule[classname] = (_factories.MetaMayaUIWrapper,
                                        (classname, bases, {}))
开发者ID:LumaPictures,项目名称:pymel,代码行数:21,代码来源:uitypes.py

示例6: __new__

    def __new__(cls, name=None, create=False, **kwargs):
        """
        Provides the ability to create the PyUI Element when creating a class::

            import pymel.core as pm
            n = pm.Window("myWindow",create=True)
            n.__repr__()
            # Result: Window('myWindow')
        """

        if cls is PyUI:
            try:
                uiType = objectTypeUI(name)
            except RuntimeError:
                uiType = 'PyUI'
            uiType = _uiTypesToCommands.get(uiType, uiType)

            try:
                newcls = getattr(dynModule, _util.capitalize(uiType))
            except AttributeError:
                newcls = PyUI
                # objectTypeUI for panels seems to return weird results -
                # ie, TmodelPane ... check for them this way.
                # Other types should be detected correctly by objectTypeUI,
                # but this just provides a failsafe...
                for testType in 'panel scriptedPanel window control layout menu'.split():
                    if getattr(cmds, testType)(name, ex=1, q=1):
                        newcls = getattr(dynModule, _util.capitalize(testType),
                                         PyUI)
                        if newcls != PyUI:
                            break
        else:
            newcls = cls

        if not newcls is PyUI:
            if cls._isBeingCreated(name, create, kwargs):
                name = newcls.__melcmd__(name, **kwargs)
                _logger.debug("PyUI: created... %s" % name)
            else:
                # find the long name
                if '|' not in name and not issubclass(newcls,
                                                      (Window,
                                                       Panel,
                                                       dynModule.ScriptedPanel,
                                                       dynModule.RadioCollection,
                                                       dynModule.ToolCollection)):
                    import windows
                    try:
                        if issubclass(newcls, Layout):
                            parent = windows.layout(name, q=1, p=1)
                        elif issubclass(newcls, OptionMenu):
                            parent = windows.optionMenu(name, q=1, p=1)
                        elif issubclass(newcls, Menu):
                            parent = windows.menu(name, q=1, p=1)
                        else:
                            parent = windows.control(name, q=1, p=1)
                        if parent:
                            name = parent + '|' + name

                    except RuntimeError:
                        # editors don't have a long name, so we keep the short name
                        if name not in cmds.lsUI(long=True, editors=True):
                            raise

        # correct for optionMenu
        if newcls == PopupMenu and cmds.optionMenu(name, ex=1):
            newcls = OptionMenu
        return unicode.__new__(newcls, name)
开发者ID:eahneahn,项目名称:pymel,代码行数:68,代码来源:uitypes.py

示例7: nodeToApiName

def nodeToApiName(nodeName):
    return 'k' + _util.capitalize(nodeName)
开发者ID:SarielD,项目名称:pymel,代码行数:2,代码来源:apicache.py

示例8: __init__

 def __init__(self, valueType, scriptUtil=None, size=1, asTypeNPtr=False):
     """
     :Parameters:
     valueType : `string`
         The name of the maya pointer type you would like
         returned - ie, 'int', 'short', 'float'.
     scriptUtil : `MScriptUtil`
         If you wish to use an existing MScriptUtil as
         the 'storage' for the value returned, specify it
         here - otherwise, a new MScriptUtil object is
         created.
     size : `int`
         If we want a pointer to an array, size indicates
         the number of items the array holds.  If we are
         creating an MScriptUtil, it will be initialized
         to hold this many items - if we are fed an
         MScriptUtil, then it is your responsibility to
         make sure it can hold the necessary number of items,
         or else maya will crash!
     asTypeNPtr : `bool`
         If we want a call to this SafeApiPtr to return a pointer
         for an argument such as:
            int2 &myArg;
         then we need to set asTypeNPtr to True:
            SafeApiPtr('int', size=2, asTypeNPtr=True)
         Otherwise, it is assumed that calling the object returns array
         ptrs:
            int myArg[2];
     """
     if not scriptUtil:
         self.scriptUtil = MScriptUtil()
         if size < 1:
             raise ValueError('size must be >= 1')
         else:
             # Value stored here doesn't matter - just make sure
             # it's large enough!
             self.scriptUtil.createFromList([0.0] * size, size)
     else:
         self.scriptUtil = scriptUtil
     self.size = size
     capValue = util.capitalize(valueType)
     self._normPtr = getattr(self.scriptUtil, 'as' + capValue + 'Ptr')()
     # Unforunately, arguments such as:
     #    float2 &foo;
     # need to be handled differently - calling it, we need
     # to return asFloat2Ptr()... but when indexing, use the same old
     # asFloatPtr() result to feed into getFloatArrayValue.
     # Also, note that asFloatPtr() must be called BEFORE asFloat2Ptr() -
     # if it is called after, the float2 ptr seems to get reset!
     self._sizedIndexGetter = None
     self._sizedIndexSetter = None
     if asTypeNPtr:
         self._nPtr = getattr(self.scriptUtil, 'as' + capValue +
                              str(size) + 'Ptr')()
         self._ptr = self._nPtr
         self._sizedIndexGetter = getattr(
             MScriptUtil, 'get' + capValue + str(size) + 'ArrayItem', None)
         self._sizedIndexSetter = getattr(
             MScriptUtil, 'set' + capValue + str(size) + 'ArrayItem', None)
     else:
         self._ptr = self._normPtr
     self._getter = getattr(MScriptUtil, 'get' + capValue, None)
     self._setter = getattr(MScriptUtil, 'set' + capValue, None)
     self._indexGetter = getattr(MScriptUtil,
                                 'get' + capValue + 'ArrayItem', None)
     self._indexSetter = getattr(MScriptUtil,
                                 'set' + capValue + 'Array', None)
开发者ID:assumptionsoup,项目名称:pymel,代码行数:67,代码来源:allapi.py

示例9: __new__

    def __new__(cls, name=None, create=False, **kwargs):
        """
        Provides the ability to create the PyUI Element when creating a class::

            import pymel.core as pm
            n = pm.Window("myWindow",create=True)
            n.__repr__()
            # Result: Window('myWindow')
        """

        if cls is PyUI:
            try:
                uiType = cmds.objectTypeUI(name)
                uiType = _uiTypesToCommands.get(uiType, uiType)
            except RuntimeError:
                try:
                    # some ui types (radioCollections) can only be identified with their shortname
                    uiType = cmds.objectTypeUI(name.split("|")[-1])
                    uiType = _uiTypesToCommands.get(uiType, uiType)
                except RuntimeError:
                    # we cannot query the type of rowGroupLayout children: check common types for these
                    uiType = None
                    for control in (
                        "checkBox floatField button floatSlider intSlider "
                        "floatField textField intField optionMenu radioButton".split()
                    ):
                        if getattr(cmds, control)(name, ex=1, q=1):
                            uiType = control
                            break
                    if not uiType:
                        uiType = "PyUI"
            try:
                newcls = getattr(dynModule, _util.capitalize(uiType))
            except AttributeError:
                newcls = PyUI
                # objectTypeUI for panels seems to return weird results -
                # ie, TmodelPane ... check for them this way.
                # Other types should be detected correctly by objectTypeUI,
                # but this just provides a failsafe...
                for testType in "panel scriptedPanel window control layout menu".split():
                    if getattr(cmds, testType)(name, ex=1, q=1):
                        newcls = getattr(dynModule, _util.capitalize(testType), PyUI)
                        if newcls != PyUI:
                            break
        else:
            newcls = cls

        if not newcls is PyUI:
            if cls._isBeingCreated(name, create, kwargs):
                name = newcls.__melcmd__(name, **kwargs)
                _logger.debug("PyUI: created... %s" % name)
            else:
                # find the long name
                if "|" not in name and not issubclass(
                    newcls,
                    (Window, Panel, dynModule.ScriptedPanel, dynModule.RadioCollection, dynModule.ToolCollection),
                ):
                    import windows

                    try:
                        if issubclass(newcls, Layout):
                            parent = windows.layout(name, q=1, p=1)
                        elif issubclass(newcls, OptionMenu):
                            parent = windows.optionMenu(name, q=1, p=1)
                        elif issubclass(newcls, Menu):
                            parent = windows.menu(name, q=1, p=1)
                        else:
                            parent = windows.control(name, q=1, p=1)
                        if parent:
                            name = parent + "|" + name

                    except RuntimeError:
                        # editors don't have a long name, so we keep the short name
                        if name not in cmds.lsUI(long=True, editors=True):
                            raise

        # correct for optionMenu
        if newcls == PopupMenu and cmds.optionMenu(name, ex=1):
            newcls = OptionMenu
        return unicode.__new__(newcls, name)
开发者ID:hunnybear,项目名称:pymel,代码行数:80,代码来源:uitypes.py


注:本文中的pymel.util.capitalize函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。