[PYTHON] Tips for opening a scene with a broken reference with a script

In Maya, if the reference is cut off, you will have to specify each time to reconnect or leave it. bTEuf3iQXjodhnR1577182342_1577182358.png

Here are some tips for skipping this dialog.


Let's write the file open process as follows.

import maya.cmds as cmds

_show_dialog = cmds.file(q=True, prompt=True)
cmds.file(prompt=False)

cmds.file(
    "hoge.ma",
    f=True,
    options="v=0;",
    ignoreVersion=True,
    typ="mayaAscii",
    o=True)

cmds.file(prompt=_show_dialog)

This way of writing makes it possible to open the data without displaying a dialog.

Recommended Posts

Tips for opening a scene with a broken reference with a script
Tips for running Go with docker
A little script for malware self-defense
Write a batch script with Python3.5 ~
A collection of tips for speeding up learning and reasoning with PyTorch
Programming for humans with a well-defined __repr__
Tips for dealing with binaries in Python
Create a star system with Blender 2.80 script
Tips for using python + caffe with TSUBAME
Manage logrotate generations with a shell script.
View today's weather forecast with a shell script
Get a ticket for a theme park with python
Create a LINE BOT with Minette for Python
Procedure for creating a LineBot made with Python
~ Tips for Python beginners from Pythonista with love ① ~
Create a dashboard for Network devices with Django!
Commands for creating a python3 environment with virtualenv
Tips for using ElasticSearch in a good way
~ Tips for Python beginners from Pythonista with love ② ~