Or am I the only one still using R16 and ResEdit for my Dialog Layouts? :)
I'm wondering, is it possible to avoid
Message to support older C4D-Versions.
In another thread: https://plugincafe.maxon.net/topic/11462/understanding-setcommanddragid/4 we've talked about the ability to drag BitmapButtons into the layout via
def CreateLayout(self): bc = c4d.BaseContainer() bc.SetBool(c4d.BITMAPBUTTON_BUTTON, True) bc.SetInt32(c4d.BITMAPBUTTON_ICONID1, c4d.Ocube) bc.SetInt32(c4d.BITMAPBUTTON_FORCE_SIZE, 32) button = self.AddCustomGui(10003, c4d.CUSTOMGUI_BITMAPBUTTON, "but", c4d.BFH_SCALEFIT | c4d.BFV_SCALEFIT, 40, 40, bc) button.SetCommandDragId(c4d.Ocube) return True def Message(self, msg, result): if msg.GetId() == c4d.BFM_INTERACTEND: if self.IsActive(10003): print 'Icon clicked in the GeDialog.'
Is it simply not possible to support older C4D-Versions AND have a draggable BitmapButton...?
Hi @swever ,
not sure if I fully understand your request, but you could try
MographToNulls_Python.c4d for that:
It basically copies your cloner into a set of new objects. From here you can bake your animation (colors included).
material color is probably not the best way to think about this, it's probably better to use the
display color of each object and use that within a given shader. This way it works with every renderengine.
I'm using it currently more or less like this:
StreamHandler will print the result to the Python-Console and the
FileHandler will write to disk. However, I'm also keen to know how to create my own LoggerInterface via Python. A simple example on this would be really appreciated.
import c4d import os import logging def get_logger(): plugin_name = "YourAwesomePlugin" #Logger for printing to Python-Console formatter1 = logging.Formatter('YourAwesomePlugin: [%(asctime)s] : %(module)s[%(lineno)s] : [%(levelname)s] "%(message)s"') handler = logging.StreamHandler() handler.setFormatter(formatter1) logger = logging.Logger(plugin_name) logger.addHandler(handler) #Logger for *.log file formatter2 = logging.Formatter('[%(asctime)s] : %(module)s[%(lineno)s] : [%(levelname)s] "%(message)s"') logpath = os.path.join(c4d.storage.GeGetC4DPath(c4d.C4D_PATH_DESKTOP), "MyLog.log") filehandler = logging.FileHandler(logpath) filehandler.setFormatter(formatter2) logger.addHandler(filehandler) return logger def main(): logger = get_logger() logger.debug('This is a debug message') logger.info('This is an info message') logger.warning('This is a warning message') logger.error('This is an error message') logger.critical('This is a critical message') if __name__=='__main__': main()
not sure I'm finding the right words, or the right explanation for my problem, but I'll try to explain as thorough as possible. :)
I'm currently developing a new plugin that shares one important global variable, amongst others, across different
CommandData plugins. It's a "global" filepath called
rootfolder a user can select within a
I guess my main question is, how one would go about sharing this
filepath with different classes, because I find it kind of ugly to
init the same thing over and over again...
For example, I have a
myOverview() within a
ListView(c4d.gui.TreeViewFunctions) and every class should know about the
rootfolder deriving from the
OptionsDialog(c4d.gui.GeDialog) is initialized like this:
def __init__(self): self._treegui = None # Our CustomGui TreeView self._listView = None # Our Instance of c4d.gui.TreeViewFunctions #loading from c4d.plugins.GetWorldPluginData() self._data = myContainer.load() self.rootfolder = self._data.GetFilename(ids.IDC_FILEPATH) or self.GetFilename(ids.IDC_FILEPATH) or None
I basically could use
myContainer.load().GetFilename(ids.IDC_FILEPATH) in every other class, but it seems a little bit awkward, so I'm just wondering what's the best way to store this "global" path from the
GeDialog and it reusing all over the places.
How would you guys go about this, is
c4d.plugins.GetWorldPluginData() really the best way store the data and initializing it in every Class..? I mean it's working okay I guess, but I was wondering if there are better decisions code/design wise out there...
If you need any further explanation or examples, I'm happy to see what I can share.
Thanks for reading, and happy coding.
Thank you so much, @m_adam !!!
Wow, thanks for the example, @r_gigante.
Was it always possible to import a
redshift module? Or is there any info from which version on (C4D / Redshift) this is possible!?
Nice, thanks for the example @m_adam ! Have a great vacation and looking forward to the decorator example!
BTW – This example might come in handy if we want to integrate animated images, kinda a like a gif but based on an image-sequence... hmmm, I have to think about this! :)
Thanks & Cheers,
Yeah, I'm looking into this as well...
Ideally I want to run different function with a decorator:
@execute_on_own_thread which would be very convenient.