Remove global variables and overwrite of cmds.playblast()
There was an issue where Maya wouldn't boot and I think making these two changes will fix it. Fingers crossed.
This commit is contained in:
parent
b37a541ce3
commit
b58b2ef422
|
@ -1,9 +1,13 @@
|
|||
# Tinyblast v1.0.0
|
||||
# Tinyblast v1.0.1
|
||||
|
||||
# **Important!**
|
||||
|
||||
FFmpeg is no longer bundled with Tinyblast directly in the source. In order to download the plugin with FFmpeg please go to the [release page on this repo](https://git.jackmchristensen.com/jack/tinyblast/-/releases/v1.0.0) and download tinyblast_v1.0.0.zip or download it [here](https://drive.proton.me/urls/JVV34W2H3R#VOJzkesz0Cgq). If you only download the source, the plugin **will not work**.
|
||||
|
||||
## Version 1.0.1 Hotfix
|
||||
|
||||
There was an issue in v1.0.0 that would cause Maya to hang on 'Loading plugins (lookdevXmaya)' when booting. Removing Tinyblast from the plug-ins directory temporarily would fix it for a time, but it would inevitably happen again. v1.0.1 aims to remove the issue entirely. If the issue still arises please contact me and let me know and I'll keep working on it.
|
||||
|
||||
## Overview
|
||||
|
||||
Tinyblast is a lightweight plugin designed to enhance Maya’s playblast workflow by converting uncompressed `.avi` files to compressed `.mp4` files using the efficient H.264 codec. It adds a custom button to Maya's Playblast Options window, enabling users to save playblasts in the more storage-friendly `.mp4` format, significantly reducing file sizes without sacrificing quality.
|
||||
|
|
29
tinyblast.py
29
tinyblast.py
|
@ -5,10 +5,6 @@ import os
|
|||
import subprocess
|
||||
import sys
|
||||
|
||||
# Global variable to store the scriptJob ID
|
||||
playblast_job_id = None
|
||||
original_playblast = cmds.playblast
|
||||
|
||||
def get_plugin_directory():
|
||||
# Get the path of the currently loaded plugin
|
||||
plugin_name = "tinyblast"
|
||||
|
@ -23,7 +19,7 @@ def custom_playblast(*args, **kwargs):
|
|||
kwargs['quality'] = 100
|
||||
kwargs['widthHeight'] = (1920, 1080)
|
||||
|
||||
result = original_playblast(*args, **kwargs)
|
||||
result = cmds.playblast(*args, **kwargs)
|
||||
print(f"{result}")
|
||||
|
||||
if result:
|
||||
|
@ -107,10 +103,8 @@ def add_custom_button_to_playblast():
|
|||
else:
|
||||
print("Playblast Options window not found.")
|
||||
|
||||
|
||||
def custom_button_action(*args):
|
||||
cmds.playblast()
|
||||
|
||||
custom_playblast()
|
||||
|
||||
def get_playblast_options_window():
|
||||
# Check if the Playblast Options window is open
|
||||
|
@ -120,9 +114,7 @@ def get_playblast_options_window():
|
|||
return window
|
||||
return None
|
||||
|
||||
def setup_script_job():
|
||||
global playblast_job_id
|
||||
|
||||
def setup_script_job(playblast_job_id):
|
||||
# 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)
|
||||
|
@ -143,19 +135,18 @@ class Tinyblast(ompx.MPxCommand):
|
|||
|
||||
def doIt(selfself, args):
|
||||
print("Executing custom playblast command.")
|
||||
cmds.playblast()
|
||||
custom_playblast()
|
||||
|
||||
@staticmethod
|
||||
def cmdCreator():
|
||||
return ompx.asMPxPtr(Tinyblast())
|
||||
def tinyblastCmd():
|
||||
return ompx.asMPxPtr(Tinyblast())
|
||||
|
||||
def initializePlugin(mobject):
|
||||
try:
|
||||
mplugin = ompx.MFnPlugin(mobject, "Jack Christensen", "1.0.0", "Any")
|
||||
mplugin.registerCommand("tinyblast", Tinyblast.cmdCreator)
|
||||
mplugin = ompx.MFnPlugin(mobject, "Jack Christensen", "1.0.1", "Any")
|
||||
mplugin.registerCommand("tinyblast", tinyblastCmd)
|
||||
om.MGlobal.displayInfo("Tinyblast plugin loaded.")
|
||||
setup_script_job()
|
||||
cmds.playblast = custom_playblast
|
||||
playblast_job_id = None
|
||||
setup_script_job(playblast_job_id)
|
||||
except Exception as e:
|
||||
om.MGlobal.displayError(f"Failed to initialize plugin: {str(e)}")
|
||||
raise
|
||||
|
|
Loading…
Reference in New Issue