I have this plugin where I have a SceneHook derived plugin, and several NodeData derived plugins. Over time I have created numerous scene files containing the registered NodeData-derived plugins. Having now realized some of these NodeData-derived plugins are obsolete, I thought of removing them from the project, and thus not registering them anymore. However, when I then open a saved scene file, it complains (obviously) about the missing plugins.
What options do I have to not register the obsolete plugins, but avoid the "missing plugin" warning?
Can I read the NodeData in the SceneHook somehow, and ignore it? Or do I still have to create a dummy NodeData derived plugin for the obsolete pluginIDs?
I also don't see any other way then to have at least some dummy plugins to avoid that message.
Would it make sense to have some kind of converter that handles a scene with with the old elements and removes them correctly?
How are your scene hook and the other plugins related? Do you store the NodeData based plugins within your scene hook?
I do register a SceneHook using a "level" value, which represents the version.
Each NodeData is created during SceneHook::Init and inserted into the scenehook's GeListHead
The SceneHook::Read performs a GeListHead::ReadObject and then checks the level value and there I create new NodeData introduced after that particular level value.
The SceneHook::Write does perform a GeListHead::WriteObject.
Should / Could I check for the particular level value and remove obsolete NodeData from the GeListHead before writing out?
Or do I need to filter out the obsolete NodeData during the Read?
Currently, the Init method does not create, nor insert the obsolete NodeData into the SceneHook's GeListHead (anymore). I suppose this needs to be reverted, as the obsolete NodeDatas need to be known in order to filter them out.
So, a convertor to read the old elements and removes them would be indeed what I am after.
How should I proceed?
you could try to filter the unneeded nodes after reading (as far as I understand you don't have any use for these nodes anyway). This would still requires at least some dummy nodes to avoid issues.
After filtering, you could write the GeListHead as it is in Write().
Why do you need the order of the nodes? You could get the type of the nodes to check if it is still a needed node or not.
Ah, yeah! Sorry, I see why you assume I need a specific order from following sentence:
"as the obsolete NodeDatas need to be known in order to filter them out."
But what I meant to say was that I assume the obsolete NodeData need to be known, for them to be filtered out. Where "order" was not meant as meaning "a specific sequence".
So, I still need dummy plugins, and apparently it would also be better to have dummy NodeData to avoid issues?
I guess I better keep the original plugin and NodeData then. They're obsolete, so I could remove any processing implementation from their methods. But still leave them as is, instead of trying to replace them by dummy ones.
yes, having dummy plugins seems necessary.
I am having second thoughts, as I still would like to clean up the mistakes I made.
I want to filter out unneeded NodeData.
But how does the actual filtering work? What needs to be done?
Following is what I do for the needed NodeData:
Bool MySceneHook::Write(GeListNode *node, HyperFile *hf)
class MySceneHook : public SceneHookData
If I understand correctly, to filter out the unneeded NodeData I have to:
In theory, once all scene files have been updated (removed from unneeded NodeData), I then could also skip registering the needed NodeData plugins.
Main question thus remains, what to do in the SceneHook::Write ?
I don't think you have to do anything else in Write(). WriteObject() should only write the nodes that you inserted into the list head. If you don't add outdated nodes to your list head, they are not written into the file.