On 14/11/2016 at 08:37, xxxxxxxx wrote:
Working on a plugin I assumed that InitDefaultSettings would be called each time the python plugins are reloaded.
For now, the method is only called the first time the plugin is activated after starting Cinema4D, and only the first time you perform "reload python plugins" after Cinema4D has started.
Any subsequent "reload python plugins" just simply doesn't call the InitDefaultSettings.
Is this as intended?
Below is a simplified plugin which shows this behaviour.
import c4d import os from c4d import gui, plugins, bitmaps, utils PLUGIN_ID = 1031001 # dummy ID class Testing(plugins.ToolData) : def __init__(self) : print "__init__" return def InitDefaultSettings(self, doc, data) : print "InitDefaultSettings" return def InitTool(self, doc, data, bt) : print "InitTool" return True def FreeTool(self, doc, data) : print "FreeTool" return def Message(self, doc, data, type, t_data) : return True # =============== Main ============= def PluginMain() : try: bmp = bitmaps.BaseBitmap() dir, file = os.path.split(__file__) fn = os.path.join(dir, "res", "Testing.tif") bmp.InitWith(fn) plugins.RegisterToolPlugin(id=PLUGIN_ID, str="Testing", info=0, icon=bmp, help="Testing", dat=Testing()) except TypeError: # when performing a 'reload plugin' without the plugin being registered to the system yet # -> user should restart Cinema 4D print "Unable to load plugin (Testing)" if __name__ == "__main__": PluginMain()
On 16/11/2016 at 07:03, xxxxxxxx wrote:
sorry for being quiet here. I'm currently waiting for an answer from our development to give a more profound answer.
On 16/11/2016 at 12:22, xxxxxxxx wrote:
Thanks for the message, Andreas.
Looking forward to such reply.
On 22/12/2016 at 01:51, xxxxxxxx wrote:
Any update on this?
On 23/12/2016 at 09:06, xxxxxxxx wrote:
I confirm ToolData.InitDefaultSettings() is only called once for each ToolData and execution of Cinema 4D.
So the default settings for a ToolData are initialized once and this is the normal behavior.