View exec_file.py
# test.py ファイル
def test_script(arg):
print arg
# ↑を実行しようとした場合
G = {}
execfile("C:/test.py", G)
G['test_script']("hello world!!")
View ma_parse.py
# -*- coding: utf-8 -*-
import re
# constant
TRUE_KEYWORDS = ["true", "on", "yes"]
FALSE_KEYWORDS = ["false", "off", "no"]
MA_COMMAND = ["requires",
"fileInfo",
"currentUnit",
"createNode",
View ma_parse.py
# -*- coding: utf-8 -*-
import re
# constant
TRUE_KEYWORDS = ["true", "on", "yes"]
FALSE_KEYWORD = ["false", "off", "no"]
MA_COMMAND = ["requires",
"fileInfo",
"currentUnit",
"createNode",
View deco_test.py
# -*- coding: utf-8 -*-
def test_val(func):
def _func(*args, **kwargs):
# クラス名
# クラスの関数の1つ目の引数はClass自身=selfなので
# そこからクラス名を取得する
print args[0].__class__.__name__
return func(*args, **kwargs)
return _func
View get_func_file.py
# -*- coding: utf-8 -*-
import inspect
def test_val(num):
def _deco(func):
def _func(*args, **kwargs):
print u"---func filepath---"
print inspect.getfile(func)
print u"---------------"
View deco_sample.py
# -*- coding: utf-8 -*-
def test_val(num):
def _deco(func):
def _func(*args, **kwargs):
print u"---func name---"
print func.__name__
print u"---------------"
return func(*args, **kwargs)
return _func
return _deco
View get_constraint_source_node.py
import maya.cmds as mc
selection = mc.ls(sl=1)
toSelect = []
for item in selection:
constraint = mc.listConnections( item+'.parentInverseMatrix[0]', d=1, s=0,type='constraint')
for i in constraint:
src = mc.listConnections(i+'.target[0].targetParentMatrix', d=0, s=1)
if src:
toSelect.extend(src)
try:
View setProject.py
# -*- coding: utf-8 -*-
import maya.cmds as mc
import os
def set_project(path):
"""
Mayaのプロジェクトを作成する
"""
View test_Ui.py
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'test_Ui.ui'
#
# Created: Thu Apr 21 23:47:46 2016
# by: pyside-uic 0.2.15 running on PySide 1.2.2
#
# WARNING! All changes made in this file will be lost!
from PySide import QtCore, QtGui
View main_ui.py
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'main_ui.ui'
#
# Created: Mon Mar 07 23:01:24 2016
# by: pyside-uic 0.2.15 running on PySide 1.2.2
#
# WARNING! All changes made in this file will be lost!
from PySide import QtCore, QtGui