Skip to content
Snippets Groups Projects
Commit 3dd17c3e authored by Amorilia's avatar Amorilia
Browse files

Added target_root argument to clone functions.

parent 1e928f30
No related branches found
No related tags found
No related merge requests found
...@@ -204,9 +204,10 @@ NIFLIB_API void WriteFileGroup( string const & file_name, NiObject * root_object ...@@ -204,9 +204,10 @@ NIFLIB_API void WriteFileGroup( string const & file_name, NiObject * root_object
* \param[in] root The root object to start from when cloning the NIF data. All referenced objects will be included in the new tree. * \param[in] root The root object to start from when cloning the NIF data. All referenced objects will be included in the new tree.
* \param[in] version The version of the NIF format to use when writing a file. Default is version 4.0.0.2. * \param[in] version The version of the NIF format to use when writing a file. Default is version 4.0.0.2.
* \param[in] user_version The user version of the NIF format to use when writing a file. Default is user version 0. * \param[in] user_version The user version of the NIF format to use when writing a file. Default is user version 0.
* \param[in] target_root The root of the nif tree in which the cloned tree will be embedded. If specified, missing links will be resolved to that tree.
* \return The root of the new cloned tree. * \return The root of the new cloned tree.
*/ */
NIFLIB_API Ref<NiObject> CloneNifTree( NiObject * root, unsigned version = 0xFFFFFFFF, unsigned user_version = 0 ); NIFLIB_API Ref<NiObject> CloneNifTree( NiObject * root, unsigned version = 0xFFFFFFFF, unsigned user_version = 0, NiObject * target_root = NULL );
//TODO: Figure out how to fix this to work with the new system //TODO: Figure out how to fix this to work with the new system
......
...@@ -74,9 +74,10 @@ public: ...@@ -74,9 +74,10 @@ public:
* if you need to clone an obsolete piece of information. * if you need to clone an obsolete piece of information.
* \param[in] version The version number to use in the memory streaming operation. Default is the highest version availiable. * \param[in] version The version number to use in the memory streaming operation. Default is the highest version availiable.
* \param[in] user_version The game-specific version number extention. * \param[in] user_version The game-specific version number extention.
* \param[in] target_root The root of the nif tree in which the cloned object will be embedded. If specified, missing links will be resolved to that tree.
* \return A cloned copy of this object as a new object. * \return A cloned copy of this object as a new object.
*/ */
NIFLIB_API Ref<NiObject> Clone( unsigned int version = 0xFFFFFFFF, unsigned int user_version = 0 ); NIFLIB_API Ref<NiObject> Clone( unsigned int version = 0xFFFFFFFF, unsigned int user_version = 0, NiObject *target_root = NULL );
public: public:
/*! Block number in the nif file. Only set when you read /*! Block number in the nif file. Only set when you read
......
...@@ -1295,7 +1295,7 @@ string FormatVersionString(unsigned version) { ...@@ -1295,7 +1295,7 @@ string FormatVersionString(unsigned version) {
} }
Ref<NiObject> CloneNifTree( NiObject * root, unsigned version, unsigned user_version ) { Ref<NiObject> CloneNifTree( NiObject *root, unsigned version, unsigned user_version, NiObject *target_root ) {
//Create a string stream to temporarily hold the state-save of this tree //Create a string stream to temporarily hold the state-save of this tree
stringstream tmp; stringstream tmp;
......
...@@ -96,7 +96,7 @@ std::list<NiObject *> NiObject::GetPtrs() const { ...@@ -96,7 +96,7 @@ std::list<NiObject *> NiObject::GetPtrs() const {
//--BEGIN MISC CUSTOM CODE--// //--BEGIN MISC CUSTOM CODE--//
NiObjectRef NiObject::Clone( unsigned int version, unsigned int user_version ) { NiObjectRef NiObject::Clone( unsigned int version, unsigned int user_version, NiObject *target_root ) {
//Create a string stream to temporarily hold the state-save of this object //Create a string stream to temporarily hold the state-save of this object
stringstream tmp; stringstream tmp;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment