This file contains hidden or 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 torch | |
from diffusers import FluxPipeline | |
base_model = "D:/flux1-dev" | |
pipe = FluxPipeline.from_pretrained(base_model, torch_dtype=torch.bfloat16, local_files_only=True, use_safetensors=True) | |
pipe.enable_model_cpu_offload() | |
lora_path = "D:/training_output/fern.safetensors" | |
prefix = "fern" |
This file contains hidden or 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
class A(object): | |
def __init__(self): | |
self.var1 = None | |
self.var2 = None | |
class B(object): | |
def __init__(self): | |
self.var3 = None | |
self.var4 = None |
This file contains hidden or 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
from PySide2 import QtWidgets,QtCore, QtGui | |
import maya.cmds as mc | |
import maya.mel as mm | |
import maya.api.OpenMaya as om2 | |
from maya.app.general.mayaMixin import MayaQWidgetDockableMixin | |
from functools import partial | |
class UI(MayaQWidgetDockableMixin, QtWidgets.QWidget): | |
def __init__(self, *args, **kwargs): | |
super(UI, self).__init__(*args, **kwargs) |
This file contains hidden or 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 mc | |
from maya.api.OpenMaya import MGlobal | |
sel = mc.ls(sl=1) | |
ret = mc.polyCompare(sel,v=1,e=1,fd=1) | |
if ret != 0: | |
MGlobal.displayInfo("geos NOT match!") | |
else: | |
MGlobal.displayInfo("geos match!") |
This file contains hidden or 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
''' | |
source : https://groups.google.com/forum/?utm_medium=email&utm_source=footer#!msg/python_inside_maya/rpO70NI1jc0/I10eDlxZCQAJ | |
''' | |
import maya.OpenMaya as om | |
def catchFileImport(ret, fileObj, *args): | |
print "Importing:", fileObj.resolvedFullName() | |
om.MScriptUtil.setBool(ret, True) | |
mid = om.MSceneMessage.addCheckFileCallback(om.MSceneMessage.kBeforeImportCheck, catchFileImport) |
This file contains hidden or 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
from PySide import QtCore, QtGui | |
import shiboken | |
import maya.OpenMayaUI as omui | |
from maya.app.general.mayaMixin import MayaQWidgetDockableMixin | |
import pymel.core as pm | |
def wrapInstance(ptr, base=None): | |
""" | |
Utility to convert a pointer to a Qt class instance (PySide/PyQt compatible) | |
borrowed from http://nathanhorne.com/?p=485 |
This file contains hidden or 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 pymel.core as pm | |
import re | |
def parseVtxIdx(idxList): | |
"""convert vertex index list from strings to indexes. | |
idxList : [u'vtx[1]', u'vtx[3]', u'vtx[6]', u'vtx[8]', u'vtx[12:13]'] | |
return : [1,3,6,8,12,13] | |
""" | |
parseIdxList = [] |
This file contains hidden or 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 | |
import re | |
import maya.OpenMaya as om | |
def getComponentId(component): | |
"""get id number from a component (i.e. pCube.vtx[12]) , and return as int (i.e. 12 ) .""" | |
tokens = re.split('[\[\]]',str(component)) | |
try: | |
return int(tokens[1]) |