THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 29/06/2011 at 15:48, xxxxxxxx wrote:
I'm trying to load a dialog created with the resedit plugin in a CommandData plugin.
At this stage it's just an example plugin with a single checkbox dialog but I can't get it to work
My Folder Structure is :
Example
--res
----dialogs
------IDD_EXAMPLE.res
----Example.tif
--strings_us
----IDD_EXAMPLE.str
--c4d_symbols.h
--Example.pyp
And the code for my plugin is :
import os
import c4d
from c4d import plugins, bitmaps, gui
PLUGIN_ID = 1000001 #be sure to use a unique ID obtained from www.plugincafe.com
class MyDialog(gui.GeDialog) :
def CreateLayout(self) :
return self.LoadDialogResource(IDD_EXAMPLE)
class Example(plugins.CommandData) :
def Execute(self, doc) :
dialog = MyDialog()
dialog.Open(c4d.DLG_TYPE_MODAL)
return True
if __name__ == "__main__":
path, fn = os.path.split(__file__)
bmp = bitmaps.BaseBitmap()
bmp.InitWith(os.path.join(path, "res", "Example.tif"))
plugins.RegisterCommandPlugin(id = PLUGIN_ID,
str = "Example", help = "Command Plugin Example",
dat = Example(), info = 0, icon = bmp)
A dialog is succesfully created but it's empty, and when I close it,
I get the error :
"NameError:global name 'IDD_EXAMPLE' is not defined".
So it seems I need to do something more to initialise the resource or point to the 'res' folder but I don't know what.
None of the plugin examples seem to load an external dialog file, so I'm a bit stuck.
Any help would be gratefully recieved.