Ignore missing plugins - NodeData
-
I have this plugin where I have a
SceneHook
derived plugin, and severalNodeData
derived plugins. Over time I have created numerous scene files containing the registeredNodeData
-derived plugins. Having now realized some of theseNodeData
-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 theNodeData
in theSceneHook
somehow, and ignore it? Or do I still have to create a dummyNodeData
derived plugin for the obsolete pluginIDs? -
Hello,
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?
best wishes,
Sebastian -
Thanks Sebastian,
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'sGeListHead
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? -
Hello,
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.
best wishes,
Sebastian -
@s_bach
Order?
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. -
Hello,
yes, having dummy plugins seems necessary.
-
Hello again,
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:
- In the main part of the plugin I register these NodeData plugins.
- In the SceneHook::Init I allocate these NodeData and insert them in scenehooks' node branch.
- For new NodeData that were introduced for new features, and are not yet available in older scene files, I allocate NodeData and insert them in the scenehooks' node branch during the SceneHook::Read.
- In the SceneHook:Write I save all using following implementation
Bool MySceneHook::Write(GeListNode *node, HyperFile *hf) { return mBranchHead->WriteObject(hf); } class MySceneHook : public SceneHookData { private: AutoAlloc<GeListHead> mBranchHead;
If I understand correctly, to filter out the unneeded NodeData I have to:
- still register the NodeData plugin
- skip allocating and inserting them during SceneHook::Init
- skip allocating and inserting them during SceneHook::Read
- ??? do what in SceneHook::Write ???
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 ?
-
Hello,
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.
best wishes,
Sebastian