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


Python cmds.modelEditor方法代码示例

本文整理汇总了Python中maya.cmds.modelEditor方法的典型用法代码示例。如果您正苦于以下问题:Python cmds.modelEditor方法的具体用法?Python cmds.modelEditor怎么用?Python cmds.modelEditor使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在maya.cmds的用法示例。


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

示例1: _applied_viewport_options

# 需要导入模块: from maya import cmds [as 别名]
# 或者: from maya.cmds import modelEditor [as 别名]
def _applied_viewport_options(options, panel):
    """Context manager for applying `options` to `panel`"""

    options = dict(ViewportOptions, **(options or {}))

    # separate the plugin display filter options since they need to
    # be set differently (see #55)
    plugins = cmds.pluginDisplayFilter(query=True, listFilters=True)
    plugin_options = dict()
    for plugin in plugins:
        if plugin in options:
            plugin_options[plugin] = options.pop(plugin)

    # default options
    cmds.modelEditor(panel, edit=True, **options)

    # plugin display filter options
    for plugin, state in plugin_options.items():
        cmds.modelEditor(panel, edit=True, pluginObjects=(plugin, state))

    yield 
开发者ID:bumpybox,项目名称:pyblish-bumpybox,代码行数:23,代码来源:capture.py

示例2: test_apply_parsed_view_exact

# 需要导入模块: from maya import cmds [as 别名]
# 或者: from maya.cmds import modelEditor [as 别名]
def test_apply_parsed_view_exact():
    """Apply parsed view sanity check works"""

    import maya.cmds as cmds
    panel = "modelPanel1"

    cmds.modelEditor(panel, edit=True, displayAppearance="wireframe")
    parsed = capture.parse_view(panel)
    display = parsed["viewport_options"]["displayAppearance"]
    assert display == "wireframe"

    # important to test both, just in case wireframe was already
    # set when making the first query, and to make sure this
    # actually does something.
    cmds.modelEditor(panel, edit=True, displayAppearance="smoothShaded")
    parsed = capture.parse_view(panel)
    display = parsed["viewport_options"]["displayAppearance"]
    assert display == "smoothShaded"

    capture.apply_view(panel,
                       viewport_options={"displayAppearance": "wireframe"})
    assert cmds.modelEditor(panel,
                            query=True,
                            displayAppearance=True) == "wireframe" 
开发者ID:abstractfactory,项目名称:maya-capture,代码行数:26,代码来源:tests.py

示例3: _applied_viewport_options

# 需要导入模块: from maya import cmds [as 别名]
# 或者: from maya.cmds import modelEditor [as 别名]
def _applied_viewport_options(options, panel):
    """Context manager for applying `options` to `panel`"""

    options = dict(ViewportOptions, **(options or {}))
    
    # separate the plugin display filter options since they need to
    # be set differently (see #55)
    plugins = cmds.pluginDisplayFilter(query=True, listFilters=True)
    plugin_options = dict()
    for plugin in plugins:
        if plugin in options:
            plugin_options[plugin] = options.pop(plugin)
    
    # default options
    cmds.modelEditor(panel, edit=True, **options)

    # plugin display filter options
    for plugin, state in plugin_options.items():
        cmds.modelEditor(panel, edit=True, pluginObjects=(plugin, state))
    
    yield 
开发者ID:abstractfactory,项目名称:maya-capture,代码行数:23,代码来源:capture.py

示例4: get_outputs

# 需要导入模块: from maya import cmds [as 别名]
# 或者: from maya.cmds import modelEditor [as 别名]
def get_outputs(self):
        """
        Retrieve all settings of each available sub widgets
        :return: 
        """

        inputs = self.get_inputs(as_preset=False)
        outputs = dict()
        outputs['off_screen'] = inputs['off_screen']

        import capture_gui.lib

        # Get isolate view members of the active panel
        if inputs['isolate_view']:
            panel = capture_gui.lib.get_active_editor()
            filter_set = mc.modelEditor(panel, query=True, viewObjects=True)
            isolate = mc.sets(filter_set, query=True) if filter_set else None
            outputs['isolate'] = isolate

        return outputs 
开发者ID:Colorbleed,项目名称:maya-capture-gui,代码行数:22,代码来源:genericplugin.py

示例5: apply_view

# 需要导入模块: from maya import cmds [as 别名]
# 或者: from maya.cmds import modelEditor [as 别名]
def apply_view(panel, **options):
    """Apply options to panel"""

    camera = cmds.modelPanel(panel, camera=True, query=True)

    # Display options
    display_options = options.get("display_options", {})
    for key, value in display_options.iteritems():
        if key in _DisplayOptionsRGB:
            cmds.displayRGBColor(key, *value)
        else:
            cmds.displayPref(**{key: value})

    # Camera options
    camera_options = options.get("camera_options", {})
    for key, value in camera_options.iteritems():
        cmds.setAttr("{0}.{1}".format(camera, key), value)

    # Viewport options
    viewport_options = options.get("viewport_options", {})
    for key, value in viewport_options.iteritems():
        cmds.modelEditor(panel, edit=True, **{key: value})

    viewport2_options = options.get("viewport2_options", {})
    for key, value in viewport2_options.iteritems():
        attr = "hardwareRenderingGlobals.{0}".format(key)
        cmds.setAttr(attr, value) 
开发者ID:bumpybox,项目名称:pyblish-bumpybox,代码行数:29,代码来源:capture.py

示例6: getCurrentCamera

# 需要导入模块: from maya import cmds [as 别名]
# 或者: from maya.cmds import modelEditor [as 别名]
def getCurrentCamera():
    '''
    Returns the camera that you're currently looking through.
    If the current highlighted panel isn't a modelPanel,
    '''

    panel = mc.getPanel(withFocus=True)

    if mc.getPanel(typeOf=panel) != 'modelPanel':
        #just get the first visible model panel we find, hopefully the correct one.
        for p in mc.getPanel(visiblePanels=True):
            if mc.getPanel(typeOf=p) == 'modelPanel':
                panel = p
                mc.setFocus(panel)
                break

    if mc.getPanel(typeOf=panel) != 'modelPanel':
        OpenMaya.MGlobal.displayWarning('Please highlight a camera viewport.')
        return False

    camShape = mc.modelEditor(panel, query=True, camera=True)
    if not camShape:
        return False

    camNodeType = mc.nodeType(camShape)
    if mc.nodeType(camShape) == 'transform':
        return camShape
    elif mc.nodeType(camShape) in ['camera','stereoRigCamera']:
        return mc.listRelatives(camShape, parent=True, path=True)[0] 
开发者ID:morganloomis,项目名称:ml_tools,代码行数:31,代码来源:ml_utilities.py

示例7: get_renderers

# 需要导入模块: from maya import cmds [as 别名]
# 或者: from maya.cmds import modelEditor [as 别名]
def get_renderers(self):
        """Collect all available renderers for playblast"""
        active_editor = lib.get_active_editor()
        renderers_ui = cmds.modelEditor(active_editor,
                                        query=True,
                                        rendererListUI=True)
        renderers_id = cmds.modelEditor(active_editor,
                                        query=True,
                                        rendererList=True)

        renderers = dict(zip(renderers_ui, renderers_id))
        renderers.pop("Stub Renderer")

        return renderers 
开发者ID:Colorbleed,项目名称:maya-capture-gui,代码行数:16,代码来源:rendererplugin.py

示例8: parse_view

# 需要导入模块: from maya import cmds [as 别名]
# 或者: from maya.cmds import modelEditor [as 别名]
def parse_view(panel):
    """Parse the scene, panel and camera for their current settings

    Example:
        >>> parse_view("modelPanel1")

    Arguments:
        panel (str): Name of modelPanel

    """

    camera = cmds.modelPanel(panel, query=True, camera=True)

    # Display options
    display_options = {}
    for key in DisplayOptions:
        if key in _DisplayOptionsRGB:
            display_options[key] = cmds.displayRGBColor(key, query=True)
        else:
            display_options[key] = cmds.displayPref(query=True, **{key: True})

    # Camera options
    camera_options = {}
    for key in CameraOptions:
        camera_options[key] = cmds.getAttr("{0}.{1}".format(camera, key))

    # Viewport options
    viewport_options = {}

    # capture plugin display filters first to ensure we never override
    # built-in arguments if ever possible a plugin has similarly named
    # plugin display filters (which it shouldn't!)
    plugins = cmds.pluginDisplayFilter(query=True, listFilters=True)
    for plugin in plugins:
        plugin = str(plugin)  # unicode->str for simplicity of the dict
        state = cmds.modelEditor(panel, query=True, queryPluginObjects=plugin)
        viewport_options[plugin] = state

    for key in ViewportOptions:
        viewport_options[key] = cmds.modelEditor(
            panel, query=True, **{key: True})

    viewport2_options = {}
    for key in Viewport2Options.keys():
        attr = "hardwareRenderingGlobals.{0}".format(key)
        try:
            viewport2_options[key] = cmds.getAttr(attr)
        except ValueError:
            continue

    return {
        "camera": camera,
        "display_options": display_options,
        "camera_options": camera_options,
        "viewport_options": viewport_options,
        "viewport2_options": viewport2_options
    } 
开发者ID:bumpybox,项目名称:pyblish-bumpybox,代码行数:59,代码来源:capture.py

示例9: _independent_panel

# 需要导入模块: from maya import cmds [as 别名]
# 或者: from maya.cmds import modelEditor [as 别名]
def _independent_panel(width, height, off_screen=False):
    """Create capture-window context without decorations

    Arguments:
        width (int): Width of panel
        height (int): Height of panel

    Example:
        >>> with _independent_panel(800, 600):
        ...   cmds.capture()

    """

    # center panel on screen
    screen_width, screen_height = _get_screen_size()
    topLeft = [int((screen_height-height)/2.0),
               int((screen_width-width)/2.0)]

    window = cmds.window(width=width,
                         height=height,
                         topLeftCorner=topLeft,
                         menuBarVisible=False,
                         titleBar=False,
                         visible=not off_screen)
    cmds.paneLayout()
    panel = cmds.modelPanel(menuBarVisible=False,
                            label='CapturePanel')

    # Hide icons under panel menus
    bar_layout = cmds.modelPanel(panel, q=True, barLayout=True)
    cmds.frameLayout(bar_layout, edit=True, collapse=True)

    if not off_screen:
        cmds.showWindow(window)

    # Set the modelEditor of the modelPanel as the active view so it takes
    # the playback focus. Does seem redundant with the `refresh` added in.
    editor = cmds.modelPanel(panel, query=True, modelEditor=True)
    cmds.modelEditor(editor, edit=True, activeView=True)

    # Force a draw refresh of Maya so it keeps focus on the new panel
    # This focus is required to force preview playback in the independent panel
    cmds.refresh(force=True)

    try:
        yield panel
    finally:
        # Delete the panel to fix memory leak (about 5 mb per capture)
        cmds.deleteUI(panel, panel=True)
        cmds.deleteUI(window) 
开发者ID:bumpybox,项目名称:pyblish-bumpybox,代码行数:52,代码来源:capture.py

示例10: parse_view

# 需要导入模块: from maya import cmds [as 别名]
# 或者: from maya.cmds import modelEditor [as 别名]
def parse_view(panel):
    """Parse the scene, panel and camera for their current settings

    Example:
        >>> parse_view("modelPanel1")

    Arguments:
        panel (str): Name of modelPanel

    """

    camera = cmds.modelPanel(panel, query=True, camera=True)

    # Display options
    display_options = {}
    for key in DisplayOptions:
        if key in _DisplayOptionsRGB:
            display_options[key] = cmds.displayRGBColor(key, query=True)
        else:
            display_options[key] = cmds.displayPref(query=True, **{key: True})

    # Camera options
    camera_options = {}
    for key in CameraOptions:
        camera_options[key] = cmds.getAttr("{0}.{1}".format(camera, key))

    # Viewport options
    viewport_options = {}
    
    # capture plugin display filters first to ensure we never override 
    # built-in arguments if ever possible a plugin has similarly named 
    # plugin display filters (which it shouldn't!)
    plugins = cmds.pluginDisplayFilter(query=True, listFilters=True)
    for plugin in plugins:
        plugin = str(plugin)  # unicode->str for simplicity of the dict
        state = cmds.modelEditor(panel, query=True, queryPluginObjects=plugin)
        viewport_options[plugin] = state
    
    for key in ViewportOptions:
        viewport_options[key] = cmds.modelEditor(
            panel, query=True, **{key: True})

    viewport2_options = {}
    for key in Viewport2Options.keys():
        attr = "hardwareRenderingGlobals.{0}".format(key)
        try:
            viewport2_options[key] = cmds.getAttr(attr)
        except ValueError:
            continue

    return {
        "camera": camera,
        "display_options": display_options,
        "camera_options": camera_options,
        "viewport_options": viewport_options,
        "viewport2_options": viewport2_options
    } 
开发者ID:abstractfactory,项目名称:maya-capture,代码行数:59,代码来源:capture.py

示例11: get_current_camera

# 需要导入模块: from maya import cmds [as 别名]
# 或者: from maya.cmds import modelEditor [as 别名]
def get_current_camera():
    """Returns the currently active camera.

    Searched in the order of:
        1. Active Panel
        2. Selected Camera Shape
        3. Selected Camera Transform

    Returns:
        str: name of active camera transform

    """

    # Get camera from active modelPanel  (if any)
    panel = cmds.getPanel(withFocus=True)
    if cmds.getPanel(typeOf=panel) == "modelPanel":
        cam = cmds.modelEditor(panel, query=True, camera=True)
        # In some cases above returns the shape, but most often it returns the
        # transform. Still we need to make sure we return the transform.
        if cam:
            if cmds.nodeType(cam) == "transform":
                return cam
            # camera shape is a shape type
            elif cmds.objectType(cam, isAType="shape"):
                parent = cmds.listRelatives(cam, parent=True, fullPath=True)
                if parent:
                    return parent[0]

    # Check if a camShape is selected (if so use that)
    cam_shapes = cmds.ls(selection=True, type="camera")
    if cam_shapes:
        return cmds.listRelatives(cam_shapes,
                                  parent=True,
                                  fullPath=True)[0]

    # Check if a transform of a camShape is selected
    # (return cam transform if any)
    transforms = cmds.ls(selection=True, type="transform")
    if transforms:
        cam_shapes = cmds.listRelatives(transforms, shapes=True, type="camera")
        if cam_shapes:
            return cmds.listRelatives(cam_shapes,
                                      parent=True,
                                      fullPath=True)[0] 
开发者ID:Colorbleed,项目名称:maya-capture-gui,代码行数:46,代码来源:lib.py


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