diff --git a/tinyblast.py b/tinyblast.py index 85db41f..115bc22 100644 --- a/tinyblast.py +++ b/tinyblast.py @@ -6,11 +6,14 @@ import os import subprocess import sys +<<<<<<< HEAD from shiboken6 import wrapInstance from PySide6 import QtWidgets playblast_job_id = None +======= +>>>>>>> b58b2ef4229368607d47e3706a478b303ffda410 def get_plugin_directory(): # Get the path of the currently loaded plugin plugin_name = "tinyblast" @@ -92,6 +95,7 @@ class WindowWatcher: if self.on_close_callback: self.on_close_callback() +<<<<<<< HEAD def find_button_by_label(window, label_text): for widget in window.findChildren(QtWidgets.QPushButton): if widget.text() == label_text: @@ -110,6 +114,46 @@ def override_playblast_button(): def setup_script_job(): global playblast_job_id +======= + def get_window_by_title(self, title): + # Check all open windows and return the one that matches the title + windows = cmds.lsUI(windows=True) + for window in windows: + if cmds.window(window, query=True, title=True) == title: + return window + return None + + +def add_custom_button_to_playblast(): + # Get the Playblast Options window + window = get_playblast_options_window() + + if window: + # Find the layout of the Playblast Options window + layout = cmds.columnLayout(adjustableColumn=True) + if layout: + # Add a custom button below existing UI + cmds.setParent(layout) # Set the parent to the top-level layout + cmds.columnLayout(adjustableColumn=True) + cmds.button(label="Tinyblast", command=custom_button_action) + else: + print("Couldn't find the layout for the Playblast Options window.") + else: + print("Playblast Options window not found.") + +def custom_button_action(*args): + custom_playblast() + +def get_playblast_options_window(): + # Check if the Playblast Options window is open + windows = cmds.lsUI(windows=True) + for window in windows: + if cmds.window(window, query=True, title=True) == "Playblast Options": # Exact title match + return window + return None + +def setup_script_job(playblast_job_id): +>>>>>>> b58b2ef4229368607d47e3706a478b303ffda410 # Kill any previously running scriptJob if playblast_job_id is not None and cmds.scriptJob(exists=playblast_job_id): cmds.scriptJob(kill=playblast_job_id, force=True) @@ -131,19 +175,34 @@ class Tinyblast(ompx.MPxCommand): ompx.MPxCommand.__init__(self) def doIt(selfself, args): +<<<<<<< HEAD print("So I started blastin'.") custom_playblast() def tinyblast_cmd(): +======= + print("Executing custom playblast command.") + custom_playblast() + +def tinyblastCmd(): +>>>>>>> b58b2ef4229368607d47e3706a478b303ffda410 return ompx.asMPxPtr(Tinyblast()) def initializePlugin(mobject): global playblast_job_id try: +<<<<<<< HEAD mplugin = ompx.MFnPlugin(mobject, "Jack Christensen", "1.1.0", "Any") mplugin.registerCommand("tinyblast", tinyblast_cmd) om.MGlobal.displayInfo("Tinyblast plugin loaded.") setup_script_job() +======= + mplugin = ompx.MFnPlugin(mobject, "Jack Christensen", "1.0.1", "Any") + mplugin.registerCommand("tinyblast", tinyblastCmd) + om.MGlobal.displayInfo("Tinyblast plugin loaded.") + playblast_job_id = None + setup_script_job(playblast_job_id) +>>>>>>> b58b2ef4229368607d47e3706a478b303ffda410 except Exception as e: om.MGlobal.displayError(f"Failed to initialize plugin: {str(e)}") raise