小男孩‘自慰网亚洲一区二区,亚洲一级在线播放毛片,亚洲中文字幕av每天更新,黄aⅴ永久免费无码,91成人午夜在线精品,色网站免费在线观看,亚洲欧洲wwwww在线观看

分享

如何在maya中查詢當(dāng)前視口渲染器

 印度阿三17 2019-07-25

任何人都有一個很好的解決方案來查詢python中當(dāng)前的maya視口渲染器(Viewport 2.0,默認視口,高質(zhì)量視口)?

解決方法:

@Tomek的答案將完美無缺.如果你要去PyMEL路線,你可以這樣做:

import pymel.core.uitypes as pmui

model_panel = pmui.ModelEditor(pm.getPanel(withFocus=True))
print pmui.ModelEditor.getRendererName(model_panel)

雖然,那個片段似乎很有氣質(zhì).它有時會拋出錯誤,抱怨未找到模型編輯器,尤其是從架子上執(zhí)行時.

另一種方式有點羅嗦,但它每次都有效:

import pymel.core as pm
import pymel.core.uitypes as pmui

modelPanelList = []
modelEditorList = pm.lsUI(editors=True)
for myModelPanel in modelEditorList:
    if myModelPanel.find('modelPanel') != -1:
        modelPanelList.append(myModelPanel)

for modelPanel in modelPanelList:    
    if pmui.ModelEditor(modelPanel).getActiveView():
        try:
            # Always better to try in the case of active panel operations
            # as the active panel might not be a viewport.
            print pmui.ModelEditor(modelPanel).getRendererName()
        except Exception as e:
            # Handle exception
            print e

一個簡潔的偽PyMEL方式就是PyMEL-ify Tomek的答案:

import pymel.core as pm
print pm.modelEditor(pm.getPanel(wf=True), q=True, rnm=True)

要獲取視口渲染器列表:

import pymel.core.uitypes as pmui
print pmui.ModelEditor().getRendererList()

以下是模型編輯器和視口渲染器的一些額外信息.
獲得他們“友好”的名字:

import pymel.core.uitypes as pmui
print pmui.ModelEditor().getRendererListUI()

簡單地說,設(shè)置它們,我會使用PyMEL并執(zhí)行:

import pymel.core.uitypes as pmui

# assuming you know which modelPanel you want to affect
pmui.ModelEditor("modelPanel4").setRendererName("ogsRenderer")

要影響所有視口(modelPanels),我會這樣做:

import pymel.core as pm
import pymel.core.uitypes as pmui

modelPanelList = []
modelEditorList = pm.lsUI(editors=True)
for myModelPanel in modelEditorList:
    if myModelPanel.find('modelPanel') != -1:
        modelPanelList.append(myModelPanel)

for modelPanel in modelPanelList:
    pmui.ModelEditor(modelPanel).setRendererName("ogsRenderer")

僅影響焦點視口:

import pymel.core as pm
import pymel.core.uitypes as pmui

modelPanelList = []
modelEditorList = pm.lsUI(editors=True)
for myModelPanel in modelEditorList:
    if myModelPanel.find('modelPanel') != -1:
        modelPanelList.append(myModelPanel)

for modelPanel in modelPanelList:    
    if pmui.ModelEditor(modelPanel).getActiveView():
        try:
            # Always better to try in the case of active panel operations
            # as the active panel might not be a viewport.
            pmui.ModelEditor(modelPanel).setRendererName("ogsRenderer")
        except Exception as e:
            # Handle exception
            print e
來源:https://www./content-4-352951.html

    本站是提供個人知識管理的網(wǎng)絡(luò)存儲空間,所有內(nèi)容均由用戶發(fā)布,不代表本站觀點。請注意甄別內(nèi)容中的聯(lián)系方式、誘導(dǎo)購買等信息,謹防詐騙。如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請點擊一鍵舉報。
    轉(zhuǎn)藏 分享 獻花(0

    0條評論

    發(fā)表

    請遵守用戶 評論公約