Skip to content

Instantly share code, notes, and snippets.

@teionn
teionn / diffVtxOrder_text.py
Last active May 25, 2020 23:05
diff vertex order
src_list=[]
src = "pCube1"
trg = "pSphere1"
for vtx in cmds.ls("{}.vtx[*]".format(src), fl=True):
cmds.select(vtx)
cmds.polySelectConstraint(pp=1,t=0x0001)
src_list.append([int(re.findall("\[(\d+)\]", index)[0]) for index in cmds.ls(sl=True, fl=True)])
@teionn
teionn / openUrl.py
Created August 16, 2019 05:35
readfile on maya (pyside2)
from PySide2.QtGui import QDesktopServices
from PySide2.QtCore import QUrl
QDesktopServices.openUrl(QUrl.fromLocalFile(r"C:\WINDOWS\win.ini"))
@teionn
teionn / QtSingleApplication.py
Last active July 26, 2019 00:48
PySide2 (Qt fot Python) QtSingleApplicationでスタンドアロンアプリケーションの多重起動を防ぐ
from PySide2.QtCore import Signal, QTextStream, Qt
from PySide2.QtWidgets import QApplication
from PySide2.QtNetwork import QLocalSocket, QLocalServer
from win32gui import SetWindowPos
import win32con
# https://stackoverflow.com/questions/12712360/qtsingleapplication-for-pyside-or-pyqt
# https://stackoverflow.com/questions/12118939/how-to-make-a-pyqt4-window-jump-to-the-front
class QSingleApplication(QApplication):
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
import os
import glob
import random
import shutil
def randomSplashScreen():
_tgtDir = "%s/prefs/icons" % os.environ.get("MAYA_APP_DIR")
_srcDir = "%s/startupImages" % _tgtDir
if not os.path.exists(_srcDir):
set XBMLANGPATH=%~dp0
"C:/Program Files/Autodesk/Maya2018/bin/maya.exe"
import os
def split_path(path):
_dir, _file = os.path.split(path)
_name, _ext = os.path.splitext(_file)
return _dir.replace(os.sep,"/"), _name, _ext
split_path("C:/Program Files/Autodesk/Maya2018/bin/maya.exe")
# Result: ('C:/Program Files/Autodesk/Maya2018/bin', 'maya', '.exe') #
cmds.ls(sl=False,selection=True)
#sl selection どちらかが True だったらフラグがオンになる
#anyを使用している?
#any([False,True])
cmds.ls(typ="mesh",type=["transform","camera"])
#typ type どちらも処理される。
#文字列,リストの両方が使える。
#文字列を一旦リストに格納してから処理を行っているのだと思う。
@teionn
teionn / multiArgFunc.py
Last active December 19, 2018 01:22
multiArgFunc
# !python2.7
# -*- coding: utf-8 -*-
# ------------------------------------------------------------------------------
from __future__ import absolute_import, division, generators, print_function, unicode_literals
from future_builtins import *
# ------------------------------------------------------------------------------
import maya.cmds as cmds
# ------------------------------------------------------------------------------
def multiArgFunc(**kwargs):
Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\Control Panel\Desktop\WindowMetrics]
"BorderWidth"="-15"
"CaptionHeight"="-270"
"CaptionWidth"="-270"
"MenuHeight"="-270"
"MenuWidth"="-270"
"ScrollHeight"="-240"
"ScrollWidth"="-240"