diff --git a/include/niflib.h b/include/niflib.h index a14357d97febbe9043193cec00b61f8a8c8aa701..939f01bede42902c791dc2cdf4d69395113991e0 100644 --- a/include/niflib.h +++ b/include/niflib.h @@ -140,6 +140,11 @@ NIFLIB_API vector< Ref<NiObject> > ReadNifList( string const & file_name, NifInf */ NIFLIB_API vector< Ref<NiObject> > ReadNifList( istream & in, NifInfo * info = NULL ); +/*! + * Like ReadNifList but returns root. + */ +NIFLIB_API Ref<NiObject> ReadNifTree( istream & in, list<Ref<NiObject> > & missing_link_stack, NifInfo * info ); + /*! * Reads the given file by file name and returns a reference to the root object. * \param file_name The name of the file to load, or the complete path if it is not in the working directory. diff --git a/src/niflib.cpp b/src/niflib.cpp index 6280ca03782d093c4ec85bc2e3e37ad61c5f628e..5bed1efb1b748ffe9b41482e338e79bcf5ef7438 100644 --- a/src/niflib.cpp +++ b/src/niflib.cpp @@ -60,6 +60,11 @@ static void SplitNifTree( NiObject * root_object, NiObjectRef& xnif_root, list<N //--Function Bodies--// +NiObjectRef ReadNifTree( istream & in, list<NiObjectRef> & missing_link_stack, NifInfo * info ) { + vector<NiObjectRef> objects = ReadNifList( in, missing_link_stack, info ); + return FindRoot( objects ); +} + NiObjectRef ReadNifTree( string const & file_name, NifInfo * info ) { //Read object list vector<NiObjectRef> objects = ReadNifList( file_name, info );