Switching Test IDs To Official IDs [CLOSED]
On 08/02/2015 at 06:33, xxxxxxxx wrote:
Cinema 4D Version: 15
Platform: Windows ;
Language(s) : C++ ;
when writing plugins one can use ids in the range 1000001 to 1000010. When I obtain official ids from the website, my old scenes alert errors, that some (or all) plugins are missing.
That behavior makes absolutely sense, but does anyone know a trick, to tell C4D that the plugins now have different ids? Is there any way so that I don't lose all the settings in my testing scenes. It would be a lot of work to recreate all settings/material/tags etc.
On 08/02/2015 at 10:12, xxxxxxxx wrote:
Well next time you know to use a Plugin ID immediately. ;)
I think your most feasable option is to write the BaseContainer to a
HyperFile, and then load it again in your plugin with the new Plugin ID.
On 08/02/2015 at 11:47, xxxxxxxx wrote:
Huh, I was afraid that it won't be easy.
Could you give me some hints what to write to the HyperFile? I guess I can write data from, for example, only a tag to a file. Let's say that I could simply write only the data of the most annoying one and do the rest by hand?
Are there really no scenarios where someone has to change an id after release or in such a situation? I feel really dumb, that I have underestimated the id problem^^
On 08/02/2015 at 18:08, xxxxxxxx wrote:
I only use test IDs for internal projects or tests. While it is something of a waste, for plugins that will be made public or when involving test documents, I immediately get all of my plugin IDs even if not all end up being used or the plugin is never released (happens once in a while). The ID is the association. Once it is saved into a document, you can't just tell C4D to look at a different ID.
On 09/02/2015 at 00:09, xxxxxxxx wrote:
Thanks for the replies, I set this to [CLOSED].
On 09/02/2015 at 09:23, xxxxxxxx wrote:
at first I'd like to thank Niklas and Robert for doing my work
And then I wanted to let you know, that we'll add something to the docs and the PluginID request site, to make this matter more clear. Sorry, Andreas, you stepped into this trap. But at least we want to make sure, it doesn't happen again in future.
On 01/06/2015 at 08:22, xxxxxxxx wrote:
I know, this thread is closed for quite some time.
Nevertheless I want to propose a possible workaround.
Let's assume you have a NodeData plugin (or any one derived from NodeData) and you want to change the PluginID. You will register two Plugins, one with the old and one with the new IDs, for as long as you need a conversion/compatibility layer. Now, in the plugin with the old ID you can remove most of the code, but you will want to implement:
- Alloc(), Free() and Init()
- Write(), here simply return false to prevent the old nodes from being written
- Message(), this is where the magic happens. You need to implement MSG_DOCUMENTINFO -MSG_DOCUMENTINFO_TYPE_LOAD, only. That's where you get informed, that the scene got loaded. Then you walk over all nodes from your old plugin, allocate nodes of the new plugin, transfer the data properly from new to old, insert the new nodes and remove the old nodes from the scene.
@Andreas: I'm terribly sorry, that I come up with this solution only after it's probably too late for you.
On 01/06/2015 at 14:43, xxxxxxxx wrote:
thanks for the response! Your solution is fine for reference. As you guessed correctly, we already have updated our scenes manually;-)