陕西快乐10分钟开奖结果查询|陕西快乐10分钟走势图

如何在maya中查询当前视口渲染器

任何人都有一个很好的解决方案来查询python中当前的maya视口渲染器(Viewport 2.0,默认视口,高质量视口)?

解决方法:

@Tomek的答案将完美无缺.如果你要去PyMEL路线,你可以这样做:

import pymel.core.uitypes as pmuimodel_panel = pmui.ModelEditor(pm.getPanel(withFocus=True))print pmui.ModelEditor.getRendererName(model_panel)

虽然,那个片段似乎很有气质.它有时会抛出错误,抱怨未找到模型编辑器,尤其是从架子上执行时.

另一种方式有点罗嗦,但它每次都有效:

import pymel.core as pmimport pymel.core.uitypes as pmuimodelPanelList = []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 pmprint pm.modelEditor(pm.getPanel(wf=True), q=True, rnm=True)

要获取视口渲染器列表:

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

以下是模型编辑器和视口渲染器的一些额外信息.

获得他们“友好”的名字:

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

简单地说,设置它们,?#19968;?#20351;用PyMEL并执行:

import pymel.core.uitypes as pmui# assuming you know which modelPanel you want to affectpmui.ModelEditor("modelPanel4").setRendererName("ogsRenderer")

要影响所有视口(modelPanels),?#19968;?#36825;样做:

import pymel.core as pmimport pymel.core.uitypes as pmuimodelPanelList = []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 pmimport pymel.core.uitypes as pmuimodelPanelList = []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.icode9.com/content-4-352951.html

免责声明:本文仅代表文章作者的个人观点,与本站无关。其原创性、真实性以及文中陈述文字和内容未经本站证实,对本文以及其中全部或者部分内容文字的真实性、完整性和原创性本站不作任何保证或?#20449;擔?#35831;读者仅作参考,并自行核实相关内容。

http://www.liwmx.tw/style/images/nopic.gif
我要收藏
赞一个
踩一下
分享到
相关推荐
精选文章
?
陕西快乐10分钟开奖结果查询 牌九至尊下载入口 北京pk10选号码技巧 赌场线上开户 快速时时正规吗 pt游戏交易 体彩排列三万能六码 彩迷官网 能赢钱的棋牌游戏 时时彩哪个计划好用 山东十一选五走势图360