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

* Fixes for windows build under SCons.

* Renamed python.h to pyniflib.h to avoid confusion with the python.h file from python installation.
* Updated python test script.
* Enabled many things again in the swig wrapper interface, to ease debugging.
* Added "using namespace std;" in Ref.h (as in the rest of the library)
parent 86b03700
No related branches found
No related tags found
No related merge requests found
......@@ -396,14 +396,15 @@ blender/blender_niflib.cpp
""")
# build niflib shared library
niflib = env.SharedLibrary('niflib', [core_objfiles, gen_objfiles, obj_objfiles, NvTriStrip_files, TriStripper_files], LIBPATH=['.'], CPPPATH = '.')
# (SCons bug: SharedLibrary should also build .lib file, but this is broken; so for now just build static one)
niflib = env.StaticLibrary('niflib', [core_objfiles, gen_objfiles, obj_objfiles, NvTriStrip_files, TriStripper_files] , LIBPATH='.', CPPPATH = '.')
# build Python wrapper
if PYWRAP:
SConscript('swig/SConscript' , exports=['env', 'python_lib', 'python_libpath', 'python_include'])
SConscript('swig/SConscript' , exports=['env', 'python_lib', 'python_libpath', 'python_include', 'niflib'])
# Here's how to compile niflyze:
#env.Program('niflyze', 'niflyze.cpp', LIBS=['niflib'], LIBPATH=['.'])
#env.Program('niflyze', 'niflyze.cpp', LIBS=[niflib], LIBPATH=['.'])
# A test program:
#env.Program('test', 'test.cpp', LIBS=['niflib'], LIBPATH=['.'])
#env.Program('test', 'test.cpp', LIBS=[niflib], LIBPATH=['.'])
......@@ -7,12 +7,14 @@ All rights reserved. Please see niflib.h for licence. */
#include <ostream>
namespace Niflib {
using namespace std;
/**
* Smart Pointer Template
*/
template<class T> class Ref;
template<class T> std::ostream & operator<<(std::ostream &, const Ref<T> &);
template<class T> ostream & operator<<(ostream &, const Ref<T> &);
template <class T> class Ref {
public:
......@@ -46,7 +48,7 @@ public:
//These operators generate problems in SWIG
#ifndef SWIG
friend std::ostream & operator<< <T>(std::ostream & os, const Ref & ref);
friend ostream & operator<< <T>(ostream & os, const Ref & ref);
Ref & operator=( T * object );
Ref & operator=( const Ref & ref );
operator T*() const;
......@@ -192,7 +194,7 @@ bool Ref<T>::operator!=(const Ref & ref) const {
#ifndef SWIG
template <class T>
std::ostream & operator<<(std::ostream & os, const Ref<T> & ref) {
ostream & operator<<(ostream & os, const Ref<T> & ref) {
if (ref._object)
os << ref->GetIDString();
else
......
Import('*')
niflib_python = env.SharedLibrary('_niflib', 'pyniflib.i', LIBS=['niflib'] + python_lib, LIBPATH=['..'] + python_libpath, SWIGFLAGS = '-c++ -python', CPPPATH = ['.'] + python_include, SHLIBPREFIX='')
niflib_python = env.SharedLibrary('_niflib', 'pyniflib.i', LIBS=[niflib] + python_lib, LIBPATH = python_libpath, SWIGFLAGS = '-c++ -python', CPPPATH = ['.'] + python_include, SHLIBPREFIX='')
#ifndef _PYNIFLIB_H_
#define _PYNIFLIB_H_
#include "../include/obj/NiNode.h"
namespace Niflib {
using namespace std;
Niflib::NiNodeRef CreateNiNode() { return Niflib::NiNodeRef(new Niflib::NiNode); }
};
#endif
This diff is collapsed.
......@@ -3,12 +3,11 @@
from niflib import *
root = CreateNiNode()
x = Matrix44(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16)
root.SetLocalTransform(x)
print root
nifinfo = NifInfo()
nifinfo.version = 0x14000005
nifinfo.creator = "amorilia"
WriteNifTree( "test.nif", root.Ptr(), nifinfo )
using namespace Niflib;
#include "../include/obj/NiNode.h"
NiNodeRef CreateNiNode() { return NiNodeRef(new NiNode); }
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