Deleting the wrapper missed that it had a second job: being a type serialize.cpp could ignore by name, which a bare osg::Object parked in a user data container cannot be singled out for. Without it a scene dump hoists the entire template subtree into the user-data block and demotes the node's real children to bare UniqueID back-references, and no blunt filter can fix that because the same containers carry shaderPrefix, recordIndex and fileHash value objects that the dump should keep. TemplateMultiRef stays gone, the eight call sites still share one addTemplateRef helper that ignores a null template, and holding a ref_ptr<const osg::Object> means no call site needs a const_cast any more.
The helper lived in its own templateref.hpp, which no longer declared any TemplateRef type, so it now sits next to SceneUtil::CopyOp in clone.hpp where the shallow-copy safety contract it exists to serve is already documented; the file and its CMake entry are gone and the five call sites include clone.hpp instead. The helper also skips a null template rather than parking a null ref_ptr in the user data container, which AnimBlendRulesManager::getRules can hit today because it adds the override rules unconditionally while only dereferencing them under a null check.
Replace six scattered const_cast+addUserObject calls with one named helper
so the intent (pin a dependency's lifetime to owner's) is obvious and the
const_cast lives in exactly one commented place.
Rename keepAlive helper to addTemplateRef
Match the domain vocabulary used by the wrappers this replaces: the object
being pinned is the template, the owner is the shallow-cloned derivative.
Signature becomes addTemplateRef(osg::Object& derived, const osg::Object* tmpl).
Both were osg::Object subclasses whose only job was to hold a ref_ptr to another Object so it could be parked in a UserDataContainer. Since UserDataContainer already keeps a ref to any object handed to it, the wrapper is dead weight; add the referenced object directly with addUserObject instead. Nothing reads the wrappers back (no dynamic_cast hits on either type), so pure keep-alive semantics are preserved and no visitor logic changes; serializer ignore-list entries for the two class names are dropped alongside.
Static variables should be initalized once instead of initializing them with
nullptr and then doing actual initialization behind if condition. Otherwise a
race condition may happen leading to undefined behaviour.
`ciCompareLen(a, b, b.size()) == 0` expression is an equivalent of checking for
equality of `a` prefix with size `b.size()` with `b`.
`ciCompareLen(a, b, a.size()) == 0` is also the same thing but `a` is a prefix
`b` should start with.
This PR fixes a crash caused by the improperly ensured lifetime of RigGeometry::mSourceGeometry. mSourceGeometry was not adequate to ensure mSourceGeometry would outlive mGeometry because we extend mGeometrys lifetime beyond this lifetime by passing mGeometry to the draw traversal instead of this.
In addition,
We add important comments.
We detect and prevent generally unsafe operations in high level code.
We add a sprinkling of const to help clarify intentions.
Make sure it copies all relevant drawable parent nodes (e.g. including the node with the environment map effect)
Make sure it doesn't copy nodes multiple times
The double buffering is an implementation detail so it should be handled as such, rather than mandating the scene graph to be structured in a certain way.
Override accept(NodeVisitor&) instead of using callbacks.
This resulted in a crash/corruption because the KeyframeController, for performance reasons, does not check that the expected user data is there and of correct type.
(Fixes#3829)
A Warning indicates a potential problem in the content file(s) that the user told OpenMW to load. E.g. this might cause an object to not display at all or as intended, however the rest of the game will run fine.
An Error, however, is more likely to be a bug with the engine itself - it means that basic assumptions have been violated and the engine might not run correctly anymore.
The above mostly applies to errors/warnings during game-play; startup issues are handled differently: when a file is completely invalid/corrupted to the point that the engine can not start, that might cause messages that are worded as Error due to the severity of the issue but are not necessarily the engine's fault.
Hopefully, being a little more consistent here will alleviate confusion among users as to when a log message should be reported and to whom.