This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## パターン2 `__init__.py`に書き込まないパターン | |
--- | |
結論2: | |
e.g.): | |
packageForda(testMVC) | |
├── view.py | |
class<View(object)> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ロギング用モジュール ################################################### | |
import YO_logger | |
from imp import reload | |
reload(YO_logger) | |
# YO_logger.getLineNo() : 行番号を指し示す出力、として利用しています | |
from YO_logger import Decorator # ログデコレーター用クラス | |
# ############################# | |
# 開発用(development)と、本番用(product) を共存させています | |
# 本コード内にある、 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
**partial** | |
```python | |
# -*- coding: utf-8 -*- | |
import pymel.core as pm | |
import maya.cmds as cmds | |
from functools import partial | |
def buttonSakusei(): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'''This piece of code creates three buttons along the bottom of a window | |
equally seperated and adjustable by the changing of the window size. | |
To change where they are positioned in the form layout, swap out the | |
values in the attachForm with the attachNone values. For example, if | |
I wanted to place the buttons along the top I would swap out the | |
attachForm values for each "bottom" value with the attachNone values | |
for "top". | |
''' | |
window = cmds.window() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import shiboken2 | |
from maya import cmds | |
from maya import OpenMayaUI | |
from PySide2 import QtWidgets | |
panels = cmds.getPanel(scriptType="scriptEditorPanel") | |
# Get all script editor panel names. | |
if panels: # Make sure one actually exists! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# OK: メインウィンドウparent 実現 | |
# NG: Windowの重複回避 実現できていない | |
# MayaのWindowを重複させない方法というのを書いたのですが、これだと一部問題がある | |
# MayaのScriptEditor上で実行した場合や.pyでImportしている場合でreloadをした場合 | |
# クラスのIDが変わってしまうらしく、同じクラス名でも別クラス扱いになってしまい | |
# findChildren関数が動かないという問題がありました。 | |
## -*- coding: utf-8 -*- | |
# *----------------------------------------------*# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import json | |
def getDirectroy(self): | |
# フォルダ作成 | |
directory = os.path.join(pm.internalVar(userAppDir = True), 'lightManager') | |
# print (directory) | |
if not os.path.exists(directory): | |
os.mkdir(directory) # create a new directory | |
return directory | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
import maya.cmds as cmds | |
from functools import partial | |
win = 'testWin' | |
def defaultButtonPush(*args): | |
print(args) | |
print(args[0], args[1]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import maya.cmds as cmds | |
from functools import partial | |
def Cmd1( *args): | |
print(args) | |
if cmds.window(win, exists=True): | |
cmds.deleteUI(win, window=True) | |