From cb143e79813ee1a62f994b6938f6654c23755260 Mon Sep 17 00:00:00 2001 From: Jack Date: Wed, 18 Sep 2024 11:17:23 -0400 Subject: [PATCH] Add shelf and button to open Tinyblast Options window and update README --- README.md | 7 +------ tinyblast.py | 18 ++++++++++++++++++ .../tinyblast_options.cpython-311.pyc | Bin 28524 -> 28524 bytes 3 files changed, 19 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 755fe56..d96f821 100644 --- a/README.md +++ b/README.md @@ -28,12 +28,7 @@ Tinyblast is a custom playblast tool for Maya, designed to offer more flexible c 3. Access the Playblast Options window in Maya. ## How to Use -Currently, there is no menu button to open Tinyblast. You will need to run the following command in Maya's script editor: - -```python -import maya.cmds as cmds -cmds.openTinyblastOptions() -``` +The plugin creates a custom shelf called Tinyblast in Maya with a button that opens the Tinyblast Options window where you can choose settings and create a playblast. Use Tinyblast as you would the regular Maya playblast. ## Future Plans - Further improvements to format and codec compatibility. diff --git a/tinyblast.py b/tinyblast.py index d7e389b..84baef4 100644 --- a/tinyblast.py +++ b/tinyblast.py @@ -448,6 +448,23 @@ class OpenTinyblastOptions(ompx.MPxCommand): def cmdCreator(): return ompx.asMPxPtr(OpenTinyblastOptions()) +def create_custom_shelf(): + # Check if the shelf already exists + shelf_name = "Tinyblast" + if cmds.shelfLayout(shelf_name, exists=True): + cmds.deleteUI(shelf_name) # Delete the existing shelf (if you want to reset it) + + # Create a new shelf + cmds.shelfLayout(shelf_name, parent="ShelfLayout") + + # Add a button to the shelf (this will call your UI function) + cmds.shelfButton( + label="Tinyblast", + annotation="Open Tinyblast UI", # Tooltip text + image="pythonFamily.png", # You can replace this with any icon you want + command="cmds.openTinyblastOptions()" # Command to open your UI + ) + def initializePlugin(mobject): global tinyblast_instance tinyblast_instance = Tinyblast() @@ -460,6 +477,7 @@ def initializePlugin(mobject): except Exception as e: om.MGlobal.displayError(f"Failed to initialize plugin: {str(e)}") raise + create_custom_shelf() def uninitializePlugin(mobject): try: diff --git a/ui/__pycache__/tinyblast_options.cpython-311.pyc b/ui/__pycache__/tinyblast_options.cpython-311.pyc index 059b06d8ce77122d4eb48e710bd7fb3a8784afcb..16badc702da2d2829b2ab6beff27cde8e45065f4 100644 GIT binary patch delta 22 ccmaEJkMYetM(*Xjyj%=GQ2gZ8M()IX0A)@HIsgCw delta 22 ccmaEJkMYetM(*Xjyj%=GaAe<$jogX(0A`m6V*mgE