mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-24 21:04:40 +01:00
implemented scripts menu to launcher
This commit is contained in:
parent
f9c55ee5ea
commit
ed730c02e6
4 changed files with 121 additions and 42 deletions
|
|
@ -14,4 +14,4 @@ def install():
|
|||
|
||||
|
||||
def uninstall():
|
||||
pyblish.deregister_plugin_path(PUBLISH_PATH)
|
||||
pyblish.deregister_plugin_path(PUBLISH_PATH)
|
||||
|
|
|
|||
61
colorbleed/maya/menu.json
Normal file
61
colorbleed/maya/menu.json
Normal file
|
|
@ -0,0 +1,61 @@
|
|||
{"Animation": [{"title" : "Script A",
|
||||
"tooltip": "Script A",
|
||||
"command": "$SCRIPTMENU/script_a.py",
|
||||
"sourcetype": "file",
|
||||
"tags": ["test", "script", "cluster"],
|
||||
"icon": "$SCRIPTMENU/resources/script_a.png",
|
||||
"label": "SCR A"},
|
||||
{"title" : "Script B",
|
||||
"tooltip": "Run script B",
|
||||
"command": "$SCRIPTMENU/script_b.py",
|
||||
"sourcetype": "file",
|
||||
"tags": ["test", "script", "curves"]},
|
||||
{"title" : "Script C",
|
||||
"tooltip": "Run script C",
|
||||
"command": "$SCRIPTMENU/script_c.py",
|
||||
"sourcetype": "file",
|
||||
"tags": ["test", "script", "joints"],
|
||||
"icon": ""}
|
||||
],
|
||||
|
||||
"Modeling": [{"title" : "Script A",
|
||||
"tooltip": "Run script A",
|
||||
"command": "$SCRIPTMENU/script_a.py",
|
||||
"sourcetype": "file",
|
||||
"tags": ["test", "script", "model", "blendshapes"]},
|
||||
{"title" : "Script B",
|
||||
"tooltip": "Run script B",
|
||||
"command": "$SCRIPTMENU/script_b.py",
|
||||
"sourcetype": "file",
|
||||
"tags": ["test", "script", "normals", "model"]},
|
||||
{"title" : "Script C",
|
||||
"tooltip": "Run script C",
|
||||
"command": "$SCRIPTMENU/script_c.py",
|
||||
"sourcetype": "file",
|
||||
"tags": ["math", "power", "sum"]}
|
||||
],
|
||||
|
||||
"Rigging": [{"title" : "Script A",
|
||||
"tooltip": "Run script A",
|
||||
"command": "$SCRIPTMENU/script_a.py",
|
||||
"sourcetype": "file",
|
||||
"tags": ["test", "tool", "rig", "skeleton"]},
|
||||
{"title" : "Script B",
|
||||
"tooltip": "Run script A",
|
||||
"command": "$SCRIPTMENU/script_b.py",
|
||||
"sourcetype": "file",
|
||||
"tags": ["test", "script", "cloth", "rig", "setup"]},
|
||||
{"title" : "Script C",
|
||||
"tooltip": "Run script C",
|
||||
"command": "$SCRIPTMENU/script_c.py",
|
||||
"sourcetype": "file",
|
||||
"tags": ["test", "script", "approval"]}
|
||||
],
|
||||
|
||||
"MEL": [{"title" : "Create cube",
|
||||
"tooltip": "Launch character rigging tool",
|
||||
"command": "polyCube -w 1 -h 1 -d 1;",
|
||||
"sourcetype": "mel",
|
||||
"tags": ["test", "script", "mel"]}
|
||||
]
|
||||
}
|
||||
|
|
@ -1,62 +1,80 @@
|
|||
import sys
|
||||
from maya import cmds
|
||||
|
||||
from avalon.vendor.Qt import QtWidgets, QtCore
|
||||
|
||||
self = sys.modules[__name__]
|
||||
self._menu = "colorbleed"
|
||||
self._parent = {
|
||||
widget.objectName(): widget
|
||||
for widget in QtWidgets.QApplication.topLevelWidgets()
|
||||
}.get("MayaWindow")
|
||||
self._parent = {widget.objectName(): widget for widget in
|
||||
QtWidgets.QApplication.topLevelWidgets()}.get("MayaWindow")
|
||||
|
||||
|
||||
def install():
|
||||
from . import interactive
|
||||
# from . import interactive
|
||||
|
||||
uninstall()
|
||||
|
||||
def deferred():
|
||||
cmds.menu(self._menu,
|
||||
label="Colorbleed",
|
||||
tearOff=True,
|
||||
parent="MayaWindow")
|
||||
|
||||
# Modeling sub-menu
|
||||
cmds.menuItem("Modeling",
|
||||
label="Modeling",
|
||||
tearOff=True,
|
||||
subMenu=True,
|
||||
parent=self._menu)
|
||||
import site
|
||||
import os
|
||||
|
||||
cmds.menuItem("Combine", command=interactive.combine)
|
||||
# todo: replace path with server / library path
|
||||
site.addsitedir("C:\Users\User\Documents\development\scriptsmenu\python")
|
||||
|
||||
# Rigging sub-menu
|
||||
cmds.menuItem("Rigging",
|
||||
label="Rigging",
|
||||
tearOff=True,
|
||||
subMenu=True,
|
||||
parent=self._menu)
|
||||
from scriptsmenu import launchformaya
|
||||
import scriptsmenu.scriptsmenu as menu
|
||||
|
||||
cmds.menuItem("Auto Connect", command=interactive.auto_connect)
|
||||
cmds.menuItem("Clone (Local)", command=interactive.clone_localspace)
|
||||
cmds.menuItem("Clone (World)", command=interactive.clone_worldspace)
|
||||
cmds.menuItem("Clone (Special)", command=interactive.clone_special)
|
||||
cmds.menuItem("Create Follicle", command=interactive.follicle)
|
||||
# load configuration of custon menu
|
||||
config_path = os.path.join(os.path.dirname(__file__), "menu.json")
|
||||
config = menu.load_configuration(config_path)
|
||||
|
||||
# Animation sub-menu
|
||||
cmds.menuItem("Animation",
|
||||
label="Animation",
|
||||
tearOff=True,
|
||||
subMenu=True,
|
||||
parent=self._menu)
|
||||
# create menu in appliction
|
||||
cb_menu = launchformaya.main(title=self._menu, parent=self._parent)
|
||||
|
||||
cmds.menuItem("Set Defaults", command=interactive.set_defaults)
|
||||
# apply configuration
|
||||
menu.load_from_configuration(cb_menu, config)
|
||||
|
||||
cmds.setParent("..", menu=True)
|
||||
|
||||
cmds.menuItem(divider=True)
|
||||
|
||||
cmds.menuItem("Auto Connect", command=interactive.auto_connect_assets)
|
||||
# cmds.menu(self._menu,
|
||||
# label=self._menu.capitalize(),
|
||||
# tearOff=True,
|
||||
# parent="MayaWindow")
|
||||
#
|
||||
# # Modeling sub-menu
|
||||
# cmds.menuItem("Modeling",
|
||||
# label="Modeling",
|
||||
# tearOff=True,
|
||||
# subMenu=True,
|
||||
# parent=self._menu)
|
||||
#
|
||||
# cmds.menuItem("Combine", command=interactive.combine)
|
||||
#
|
||||
# # Rigging sub-menu
|
||||
# cmds.menuItem("Rigging",
|
||||
# label="Rigging",
|
||||
# tearOff=True,
|
||||
# subMenu=True,
|
||||
# parent=self._menu)
|
||||
#
|
||||
# cmds.menuItem("Auto Connect", command=interactive.auto_connect)
|
||||
# cmds.menuItem("Clone (Local)", command=interactive.clone_localspace)
|
||||
# cmds.menuItem("Clone (World)", command=interactive.clone_worldspace)
|
||||
# cmds.menuItem("Clone (Special)", command=interactive.clone_special)
|
||||
# cmds.menuItem("Create Follicle", command=interactive.follicle)
|
||||
#
|
||||
# # Animation sub-menu
|
||||
# cmds.menuItem("Animation",
|
||||
# label="Animation",
|
||||
# tearOff=True,
|
||||
# subMenu=True,
|
||||
# parent=self._menu)
|
||||
#
|
||||
# cmds.menuItem("Set Defaults", command=interactive.set_defaults)
|
||||
#
|
||||
# cmds.setParent("..", menu=True)
|
||||
#
|
||||
# cmds.menuItem(divider=True)
|
||||
#
|
||||
# cmds.menuItem("Auto Connect", command=interactive.auto_connect_assets)
|
||||
|
||||
# Allow time for uninstallation to finish.
|
||||
QtCore.QTimer.singleShot(100, deferred)
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ class ValidateUniqueNodeIds(pyblish.api.InstancePlugin):
|
|||
|
||||
import maya.cmds as cmds
|
||||
|
||||
uuid_attr = "mbId"
|
||||
uuid_attr = "cbId"
|
||||
|
||||
# Collect each id with their members
|
||||
from collections import defaultdict
|
||||
Loading…
Add table
Add a link
Reference in a new issue