Update
This commit is contained in:
131
2024/scripts/modeling_tools/ModIt/ModIt_Global.py
Normal file
131
2024/scripts/modeling_tools/ModIt/ModIt_Global.py
Normal file
@@ -0,0 +1,131 @@
|
||||
##GLOBAL VARIABLEs
|
||||
from PySide2 import QtWidgets, QtCore, QtGui
|
||||
from maya import cmds as mc
|
||||
import maya.mel as mel
|
||||
import json
|
||||
from .Qt import QtWidgets, QtCore, QtCompat
|
||||
import os
|
||||
import maya.cmds as cmds
|
||||
from maya import OpenMayaUI as omui
|
||||
|
||||
# Special cases for different Maya versions
|
||||
try:
|
||||
from shiboken2 import wrapInstance
|
||||
except ImportError:
|
||||
from shiboken import wrapInstance
|
||||
|
||||
try:
|
||||
from PySide2.QtGui import QIcon
|
||||
from PySide2.QtWidgets import QWidget
|
||||
except ImportError:
|
||||
from PySide.QtGui import QIcon, QWidget
|
||||
|
||||
from . import ModIt_CSS
|
||||
|
||||
|
||||
##_____________________________________________PATH
|
||||
USERAPPDIR = mc.internalVar(userAppDir=True)
|
||||
VERSION = mc.about(v=True)
|
||||
# Get ModIt's actual location
|
||||
ModItDir = os.path.dirname(os.path.abspath(__file__))
|
||||
IconsPathThemeClassic = os.path.join(ModItDir, 'Icons/Theme_Classic/')
|
||||
ToolPath = os.path.join(ModItDir, 'Tools/')
|
||||
PreferencePath = os.path.join(ModItDir, '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(ModItDir, 'Ressources/')
|
||||
|
||||
|
||||
|
||||
##_____________________________________________PREFERENCES
|
||||
ModItTitle = "ModIt - 3.1.1"
|
||||
|
||||
|
||||
##_____________________________________________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()
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user