This commit is contained in:
2025-12-05 08:08:44 +08:00
parent e0d4d0c364
commit 1f10abfb32
2909 changed files with 2470486 additions and 3024 deletions

View File

@@ -0,0 +1,129 @@
##GLOBAL VARIABLEs
try:
from PySide6 import QtWidgets, QtCore, QtGui
from PySide6.QtWidgets import *
from PySide6.QtGui import *
from PySide6.QtCore import *
from shiboken6 import wrapInstance
except ImportError:
from PySide2 import QtWidgets, QtCore, QtGui
from shiboken2 import wrapInstance
from PySide2.QtGui import QIcon
from PySide2.QtWidgets import QWidget
import shiboken2
from maya import cmds as mc
import json
import os
import maya.cmds as cmds
from maya import OpenMayaUI as omui
from . import ModIt_CSS
##_____________________________________________PATH
USERAPPDIR = mc.internalVar(userAppDir=True)
VERSION = mc.about(v=True)
IconsPathThemeClassic = os.path.join(USERAPPDIR, VERSION+'/scripts/ModIt/Icons/Theme_Classic/')
ToolPath = os.path.join(USERAPPDIR, VERSION+'/scripts/ModIt/Tools/')
PreferencePath = os.path.join(USERAPPDIR, VERSION+'/scripts/ModIt/Preferences/')
PlugInsPath = os.path.join(USERAPPDIR, VERSION+'/plug-ins')
PrefIcons = os.path.join(USERAPPDIR, VERSION+'/prefs/icons')
UserScriptFolder = os.path.join(USERAPPDIR, VERSION+'/scripts')
RessourcePath = os.path.join(USERAPPDIR, VERSION+'/scripts/ModIt/Ressources/')
##_____________________________________________PREFERENCES
ModItTitle = "ModIt - 3.3"
##_____________________________________________UI
#_____________#Theme
Theme_pref = json.load(open(PreferencePath + 'Pref_Theme.json', "r"))
PREF_THEME = (Theme_pref['THEME'])
if PREF_THEME == 0:
Theme = ModIt_CSS.ModIt_CSS
IconPath = IconsPathThemeClassic
elif PREF_THEME == 1:
Theme = ModIt_CSS.Maya_CSS
IconPath = IconsPathThemeClassic
#_____________#IconSize
IconSize_pref = json.load(open(PreferencePath + 'Pref_IconSize.json', "r"))
PREF_ICONSIZE = (IconSize_pref['ICONSIZE'])
IconButtonSize = PREF_ICONSIZE
# ******************************************
# BUTTONS PARAMS
# ******************************************
iconFixeSize = 30
iconButtonSize = 30
separatorWidth = 1
##_____________________________________________WARNING POP UP
def WarningWindow(message, size, *args):
BackgroundColor = 0.16
# ________________//
if mc.window("WarningWindow", exists=True):
mc.deleteUI("WarningWindow")
mc.window("WarningWindow", title=' Warning ', s=False, vis=True, rtf=False)
mc.columnLayout(adj=True, rs=3, bgc=[BackgroundColor, BackgroundColor, BackgroundColor])
mc.separator(h=8, style='none')
mc.text(l=" " + message + " ", al="center")
mc.separator(h=8, style='none')
mc.button(l="OK", c=WarningOKButton)
mc.window("WarningWindow", e=True, wh=(size, 80))
qw = omui.MQtUtil.findWindow("WarningWindow")
widget = wrapInstance(int(qw), QWidget)
icon = QIcon(IconPath + "Windows_Ico_Warning.png")
widget.setWindowIcon(icon)
mc.showWindow()
def WarningOKButton(*args):
mc.deleteUI("WarningWindow")
def LoadingWindow(message, size, *args):
BackgroundColor = 0.110
# ________________//
if mc.window("LoadingWindow", exists=True):
mc.deleteUI("LoadingWindow")
mc.window("LoadingWindow", title='Loading Asset', s=False, vis=True, rtf=False)
mc.columnLayout(adj=True, rs=3, bgc=[BackgroundColor, BackgroundColor, BackgroundColor])
mc.separator(h=5, style='none')
mc.text(l=" " + message + " ", al="center")
mc.iconTextButton(image1= IconPath + "Refresh_Button.png")
mc.window("LoadingWindow", e=True, wh=(size, 70))
qw = omui.MQtUtil.findWindow("LoadingWindow")
widget = wrapInstance(int(qw), QWidget)
icon = QIcon(IconPath + "Windows_Ico2.png")
widget.setWindowIcon(icon)
mc.showWindow()