THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 17/06/2011 at 09:42, xxxxxxxx wrote:
And this one is a good one.
I hate restarting cinema 4d because i want to test my async dialog but i can only open it in a command data >.>
from c4d.gui import GeDialog
from threading import Thread
class DialogThread(Thread) :
A class to enable opening ASync Dialogs in the Skript Manager.
Initialise with a GeDialog subclass instance.
class ArgumentError(Exception) :
""" Raised when a bad argument is given. """
def __init__(self, dlg) :
# initialise with a GeDialog subclass instance
if not issubclass(dlg.__class__, GeDialog) :
raise self.ArgumentError, "Overloaded argument 'dlg' is not an instance of GeDialog or an instance of a subclass of GeDialog.\n" \
\+ "It is an instance of: %s" % dlg.__class__.__name__
self.dlg = dlg
def run(self) :
# wait until the dialog is closed
while self.dlg.IsOpen() :
def start(self, opentype = c4d.DLG_TYPE_ASYNC) :
# open the dialog and start Superclass' start().
def OpenAsyncDialog(dlg) :
dlg_thread = DialogThread(dlg)
Maybe at least this can be added to the Py4D Standart Library ? Would be pretty useful for skripts, hehe.
Hm, again some issues.
is there any way to keep the globals within a Thread ? >.>