I'm aware, I'm doing something out of the box here. If it's too absurd, simply ignore my question.
For organizational reasons in a larger project, I'm trying to register a ToolData plugin from a "sub module".
This is roughly the intended project structure:
|-- usual suspects here
A link to a small example project follows at the end.
I'd like to call
RegisterToolPlugin() from within submodule.py as follows.
import submodule # actually a tad bit more complicated, as the subdirs need to be manually added to the search path first
This already worked for
CommandData plugins or maybe also any plugin type, as long as no resource files are involved. But I doubt one can have a ToolData without at least a dummy resource...
In case of the above example with a dummy ToolData I end with the following error thrown by the call of
ReferenceError:Could not find required '__res__'.
If I do instead in myplugin.pyp:
it works again. But for several reasons it is not what I'd like to have...
My guess is, C4D is somehow looking in the wrong place for the expected resource files. Yet, having another res folder in submodule doesn't make a difference. So I have no idea, where it's looking for resources. Then again, I may be misinterpreting the error message completely...
As said in the beginning, I'm aware I'm doing something esoteric here and I understand, if no time can be invested to support such stupid ideas. On the other hand I hope, above error message may ring a bell and I could get a hint, what to do differently.
Here's an example project (really just the few lines needed) demonstrating the issue (change
REGISTER_HERE in myplugin.pyp from True to False to switch between both cases):
test_tooldata_registration.zip (temporary link to my Dropbox, if a future reader still needs this, please PM me)
It also shows, with a CommandData the approach works in principal.
Thanks in advance.