4
6

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Maya Pythonスクリプトの実行方法

Posted at

概要

MayaでPythonスクリプトを実行する方法。
(結構適当です)

MayaはスクリプトをD&Dしても実行してくれない。
エディタに直接書いて実行もできるが、
相対パスとか使いたいスクリプトではそれは使えない。
そういう時の解決方法を直ぐ忘れるのでメモ。

コード

import pymel.core as pm
import sys

p = r"<スクリプトが入っているフォルダのフルパス>"
if not p in sys.path: sys.path.append(p)

import <スクリプト名>
reload(<スクリプト名>)

test=  <スクリプト名.クラス名()>
<スクリプト名.メソッド名()>

Windowを出したければ
それ用のメソッドを作成しておばそれを呼ぶだけで現れる。

4
6
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
6

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?