Home >Backend Development >Python Tutorial >Python code solves the problem of RenderView window not found

Python code solves the problem of RenderView window not found

高洛峰
高洛峰Original
2017-02-27 17:03:531245browse

Source

Error:setParent: Object 'renderView' not found
This is a very common problem at work. I used to have it when doing special effects. There is a 10% probability of encountering it, mostly when opening Maya scene files transferred from other groups;
When you can’t solve it whether you open it from the File menu or drag it directly into Maya, use the following code. ;

Process

This was originally a piece of Mel. I rewrote it in Python and turned it into Python code~ According to the development trend, Python may Comprehensive replacement of Mel.

import maya.cmds as mc

exists = 0
getPan = mc.getPanel(scriptType = 'renderWindowPanel')
for item in getPan:
  if item == 'renderView':
    print 'renderView exists.\n'
    exists = 1
if exists == 0:
  for item in getPan:
    print item + '\n'
     if item == 'renderWindowPanel1':
      mc.deleteUI( renderWindowPanel1 )
      renderPanel = mc.scriptPanel( type = 'renderWindowPanel', unParent = renderView)
      mc.scriptedPanel( ex = 1, l = "renderPanel", rp = 'renderPanel')

Copy the code to Maya's Script Editor and press Ctrl+Enter to execute it;

Someone uses the front-end rendering plug-in to solve this problem , in fact, the function of the front-end rendering plug-in is to solve the problem of "only one frame can be rendered".

Extension

This code can also be added to Maya’s tool shelf. The specific steps are as follows:

Python代码解决RenderView窗口not found问题

In some companies, they regard special effects as the last link in the CG process (in fact, special effects can be produced simultaneously after the modeling is confirmed). After opening the project file through model, animation, lighting, and rendering, hand over the special effects When the team has it, it will be full of redundant nodes, and many people do not have the habit of cleaning up the scene, which can easily lead to various problems with the files.

For more Python code to solve the problem of RenderView window not found, please pay attention to the PHP Chinese website for related articles!


Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Previous article:File operations in PythonNext article:File operations in Python