View svn_update.py
import subprocess
import sys
def get_update_file(buff):
buff = buff.decode('cp932').split("\n")
ret_val = []
for i in buff:
ret_val.append(os.path.basename(i.strip()))
return ret_val
View export_sets.py
import pymel.core as pm
default = ['TurtleDefaultBakeLayer','defaultLightSet','defaultObjectSet','initialParticleSE','initialShadingGroup']
set_list = [x for x in pm.ls(type="objectSet") if x.name() not in default]
cmd_list = []
for set in set_list:
if set.isReferenced() is True:
View export_sets.py
import pymel.core as pm
default = ['TurtleDefaultBakeLayer','defaultLightSet','defaultObjectSet','initialParticleSE','initialShadingGroup']
set_list = [x for x in pm.ls(type="objectSet") if x.name() not in default]
cmd_list = []
for set in set_list:
if set.isReferenced() is True:
View export_sets.py
import pymel.core as pm
default = ['TurtleDefaultBakeLayer','defaultLightSet','defaultObjectSet','initialParticleSE','initialShadingGroup']
set_list = [x for x in pm.ls(type="objectSet") if x.name() not in default]
print ""
print u"// ↓をmelに貼り付けて実行"
for set in set_list:
if set.isReferenced() is True:
continue
View clipboard_test.py
# -*- coding: utf-8 -*-
"""
クリップボード取得
"""
import win32clipboard
win32clipboard.OpenClipboard()
# データ取得
print win32clipboard.GetClipboardData()
# ストリームを閉じる
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"---------------"