## popup message -A disappearing message def popupMessage(function_name): """ Displays an in-view message indicating that a function has been copied to the clipboard. :param function_name: #The name of the function that has been copied. :return: """ mc.inViewMessage(amg="Copied!!\nFunction name '{0}' has been copied to the clipboard.".format(function_name), pos='midCenter', fade=True) # Test function is provided to test main function popupMessage def test_popupMessage(): popupMessage(function_name='exampleFunction') # Since mc.inViewMessage affects the UI, manual verification is required. print("popupMessage executed successfully.") test_popupMessage()
top of page

โœจ๐ŸŽฏ ๐˜ฟ๐™–๐™ฎ02 -100-๐˜ฟ๐™–๐™ฎ๐™จ ๐˜พ๐™ค๐™™๐™š ๐™Ž๐™ฃ๐™ž๐™ฅ๐™ฅ๐™š๐™ฉ๐™จ ๐˜พ๐™๐™–๐™ก๐™ก๐™š๐™ฃ๐™œ๐™š

Writer's picture: Subbu AddankiSubbu Addanki

Updated: Oct 22, 2024

โœจ๐ŸŽฌ ๐™‰๐™š๐™ฌ ๐™‹๐™ž๐™ฅ๐™š๐™ก๐™ž๐™ฃ๐™š ๐™๐™ž๐™ฅ: ๐™Ž๐™๐™ค๐™ฌ๐™‹๐™ง๐™ค๐™œ๐™ง๐™š๐™จ๐™จ๐˜ฝ๐™–๐™ง ๐™๐™„ ๐Ÿš€




Hello VFX & Animation Professionals! ๐Ÿ‘‹

I'm thrilled to introduce a game-changing utility to elevate your Maya scripting workflowโ€”showProgressBar! ๐ŸŽ‰

In the fast-paced world of VFX and animation, efficient pipelines are crucial. showProgressBarย is designed to provide real-time progress updates directly within Maya, ensuring you stay informed without disrupting your creative flow. Whether you're running long simulations, rendering batches, or processing complex scenes, this tool keeps you in the loop effortlessly.

๐ŸŽจ ๐™„๐™ฃ๐™ฉ๐™ง๐™ค๐™™๐™ช๐™˜๐™ž๐™ฃ๐™œ ๐™‹๐™ง๐™ค๐™œ๐™ง๐™š๐™จ๐™จ๐˜ฝ๐™–๐™ง๐™๐™„

Our new UI, ProgressBarUI, is not just functional but also sleek and modern. Here's what it includes:

  • Progress Bar: Visually tracks the progress of your operations.

  • Status Text: Displays current action details.

  • Cancel Button: Allows you to abort the process if needed.

  • Agave Font: Consistent and stylish typography across all elements.

All UI elements are crafted using the elegant Agave font, ensuring a cohesive and professional look.

๐Ÿ› ๏ธ๐Ÿ› ๏ธ ๐™จ๐™๐™ค๐™ฌ๐™‹๐™ง๐™ค๐™œ๐™ง๐™š๐™จ๐™จ๐˜ฝ๐™–๐™ง (๐™ข๐™–๐™ฎ๐™–.๐™˜๐™ข๐™™๐™จ Version):

##1

import maya.cmds as mc

import time

def showProgressBar(title, maxValue, message):

"""

Displays a progress bar within Maya to track long-running operations.

:param title: <str> The title of the progress window.

:param maxValue: <int> The maximum value of the progress bar.

:param message: <str> The initial status message.

:return: <None>

"""

# Open the progress window

mc.progressWindow(title=title, progress=0, status=message, isInterruptable=True)

for i in range(maxValue + 1):

# Check if the user has canceled the operation

if mc.progressWindow(query=True, isCancelled=True):

mc.progressWindow(endProgress=True)

print "Operation cancelled by user."

return

# Update the progress window

mc.progressWindow(edit=True, progress=i, status="Processing step {}/{}".format(i, maxValue))

# Simulate a long-running task

time.sleep(0.05)

# Close the progress window upon completion

mc.progressWindow(endProgress=True)

print "Progress completed successfully."

# Test function to demonstrate showProgressBar

def test_showProgressBar():

showProgressBar(title="Processing...", maxValue=100, message="Starting processing...")

test_showProgressBar()


๐™จ๐™๐™ค๐™ฌ๐™‹๐™ง๐™ค๐™œ๐™ง๐™š๐™จ๐™จ๐˜ฝ๐™–๐™ง (๐™‹๐™ฎ๐™Ž๐™ž๐™™๐™š2 Version):

import maya.cmds as mc

from PySide2 import QtWidgets, QtCore

def showProgressBar(title, maxValue):

"""

Displays a progress bar within Maya to track long-running operations.

:param title: <str> The title of the progress window.

:param maxValue: <int> The maximum value of the progress bar.

:return: <tuple> (window, progressBar, cancelButton)

"""

window = QtWidgets.QWidget()

window.setWindowTitle(title)

window.setObjectName('ProgressStyleUI')

window.setStyleSheet("font-family: 'Agave';")

layout = QtWidgets.QVBoxLayout()

progressBar = QtWidgets.QProgressBar()

progressBar.setMaximum(maxValue)

layout.addWidget(progressBar)

statusLabel = QtWidgets.QLabel("Starting...")

layout.addWidget(statusLabel)

cancelButton = QtWidgets.QPushButton("Cancel")

layout.addWidget(cancelButton)

window.setLayout(layout)

window.setFixedSize(300, 100)

cancelButton.clicked.connect(lambda: mc.progressWindow(endProgress=True))

return window, progressBar, statusLabel

if __name__ == "__main__":

window, progressBar, statusLabel = showProgressBar("Processing...", 100)

window.show()

for i in range(101):

mc.progressWindow(edit=True, progress=i, status="Processing frame {}".format(i))

progressBar.setValue(i)

statusLabel.setText("Processing frame {}".format(i))

QtWidgets.QApplication.processEvents()

# Simulate a long-running task

QtCore.QThread.sleep(1)

mc.progressWindow(endProgress=True)

window.close()

๐Ÿ” ๐™’๐™๐™–๐™ฉ ๐™จ๐™๐™ค๐™ฌ๐™‹๐™ง๐™ค๐™œ๐™ง๐™š๐™จ๐™จ๐˜ฝ๐™–๐™ง ๐™Š๐™›๐™›๐™š๐™ง๐™จ:

  • Real-Time Feedback: Monitor the progress of your scripts without leaving Maya.

  • User Control: Option to cancel ongoing processes, providing flexibility and control.

  • Seamless Integration: Built with Maya 2020 and Python 2.7 using PySide2, ensuring smooth performance and compatibility.

  • Stylish UI: Modern and trendy interface that enhances user experience.

๐Ÿ”ง ๐™†๐™š๐™ฎ ๐˜ฝ๐™š๐™ฃ๐™š๐™›๐™ž๐™ฉ๐™จ:

โ€ข ๐Ÿš€ Boost Efficiency: Keep track of script executions in real-time, minimizing downtime and maximizing productivity.

โ€ข ๐Ÿ› ๏ธ Enhanced Control: Easily manage and cancel processes without disrupting your workflow.

โ€ข ๐Ÿ’ก Professional Appearance: A polished UI that aligns with industry standards, making your tools more appealing and user-friendly.

โ€ข ๐Ÿ“ˆ Scalable: Perfect for both simple tasks and complex, long-running operations within your pipeline.

I'm sharing showProgressBarย to help Maya developers and technical artists create more intuitive and efficient scripts. Say goodbye to uncertainty during script execution and hello to clear, in-context progress updates!

โœจ Ready to Transform Your Workflow?ย โœจ Reach out or comment below to see showProgressBar in action. Letโ€™s take our Maya scripting to the next level together! ๐Ÿ’ช๐ŸŽ‰

๐™Ž๐™ช๐™—๐™—๐™ช'๐™จ ๐™‡๐™ž๐™ฃ๐™ ๐™จ :

20 views0 comments

Comments


bottom of page