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

Changed order of %include's: Ref.h is now %included before niflib.h. It looks...

Changed order of %include's: Ref.h is now %included before niflib.h. It looks like the problem with illegal return types under SWIG is solved. (Solution suggested by Shon.)
parent a1cd6608
No related branches found
No related tags found
No related merge requests found
......@@ -11,10 +11,6 @@ using namespace std;
Niflib::NiNodeRef CreateNiNode() { return Niflib::NiNodeRef(new Niflib::NiNode); }
// SWIG does not like ReadNifTree; so far I have no idea why.
// As a workaround, you can use this wrapper function.
Niflib::NiObjectRef ReadNifFile( string name, Niflib::NifInfo * nifinfo) { return Niflib::ReadNifTree(name, nifinfo);}
};
#endif
......@@ -355,8 +355,14 @@ POSSIBILITY OF SUCH DAMAGE. */
// Headers exposed to the Python interface
%include "../include/niflib.h"
// NOTE: It is mandatory that Ref.h is included before niflib.h, and actually,
// before any header that uses Ref types.
// Otherwise, swig will not recognize Ref<> to be part of the Niflib namespace
// and consequently all functions in niflib.h returning Ref<> types will not
// return correctly wrapped python types.
// Briefly, it is safest to include Ref.h first.
%include "../include/Ref.h"
%include "../include/niflib.h"
%include "../include/Type.h"
%include "../include/nif_math.h"
......
......@@ -20,7 +20,7 @@ class TestNiNode(unittest.TestCase):
# read nif file
self.nifinfo_in = NifInfo()
root_obj = ReadNifFile("test.nif", self.nifinfo_in)
root_obj = ReadNifTree("test.nif", self.nifinfo_in)
root_in = DynamicCastToNiNode(root_obj.Ptr())
self.x_in = root_in.GetLocalTransform()
......
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