View jsonToObj.py
# -*- coding: utf-8 -*-
# Dictをいい感じに整形して val.param 形式にしてくれる
# 参考 https://stackoverflow.com/questions/6578986/how-to-convert-json-data-into-a-python-object
import json
from collections import namedtuple
data = {"name": "John Smith", "hometown": {"name": "New York", "id": 123}}
func = lambda d: namedtuple('X', d.keys())(*d.values())
print func(data)
View saveUI.py
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'saveUI.ui'
#
# Created: Mon Dec 04 20:08:57 2017
# by: pyside-uic 0.2.15 running on PySide 1.2.4
#
# WARNING! All changes made in this file will be lost!
from PySide import QtCore, QtGui
View send_to_boostnote.py
# -*- coding: utf-8 -*-
import shutil
import os.path
import clipboard
import sys
to_path = "<boostnoteの画像置き場>"
argvs = sys.argv
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",