svn merge -r 17502:18705 https://svn.blender.org/svnroot/bf-blender/trunk/blender
authorDaniel Genrich <daniel.genrich@gmx.net>
Wed, 28 Jan 2009 00:43:46 +0000 (00:43 +0000)
committerDaniel Genrich <daniel.genrich@gmx.net>
Wed, 28 Jan 2009 00:43:46 +0000 (00:43 +0000)
236 files changed:
CMakeLists.txt
SConstruct
config/darwin-config.py
config/irix6-config.py [new file with mode: 0644]
config/linux2-config.py
config/sunos5-config.py
config/win32-mingw-config.py
config/win32-vc-config.py
extern/Makefile
extern/bullet2/src/BulletCollision/CollisionShapes/btCompoundShape.cpp
extern/libopenjpeg/SConscript
extern/libopenjpeg/openjpeg.h
intern/SoundSystem/Makefile
intern/elbeem/intern/utilities.h
intern/ghost/intern/GHOST_SystemX11.cpp
projectfiles_vc9/blender/blender.sln
projectfiles_vc9/blender/blender.vcproj
projectfiles_vc9/blender/nodes/nodes.vcproj
projectfiles_vc9/gameengine/gameplayer/ghost/GP_ghost.vcproj
release/Makefile
release/scripts/ac3d_import.py
release/scripts/animation_bake_constraints.py
release/scripts/bpymodules/BPyImage.py
release/scripts/bpymodules/BPyMathutils.py
release/scripts/bpymodules/BPyMesh.py
release/scripts/bpymodules/BPySys.py
release/scripts/bpymodules/dxfLibrary.py
release/scripts/export_fbx.py
release/scripts/help_bpy_api.py
release/scripts/help_browser.py
release/scripts/help_getting_started.py
release/scripts/help_manual.py
release/scripts/help_release_notes.py
release/scripts/help_tutorials.py
release/scripts/help_web_blender.py
release/scripts/help_web_devcomm.py
release/scripts/help_web_eshop.py
release/scripts/help_web_usercomm.py
release/scripts/import_web3d.py
release/scripts/mesh_edges2curves.py
release/scripts/scripttemplate_background_job.py [new file with mode: 0644]
release/scripts/uvcalc_follow_active_coords.py
release/scripts/uvcalc_quad_clickproj.py
release/scripts/vertexpaint_from_material.py
source/Makefile
source/blender/blenkernel/BKE_blender.h
source/blender/blenkernel/BKE_brush.h
source/blender/blenkernel/BKE_customdata.h
source/blender/blenkernel/BKE_global.h
source/blender/blenkernel/BKE_node.h
source/blender/blenkernel/CMakeLists.txt
source/blender/blenkernel/SConscript
source/blender/blenkernel/intern/brush.c
source/blender/blenkernel/intern/collision.c
source/blender/blenkernel/intern/constraint.c
source/blender/blenkernel/intern/curve.c
source/blender/blenkernel/intern/customdata.c
source/blender/blenkernel/intern/displist.c
source/blender/blenkernel/intern/effect.c
source/blender/blenkernel/intern/image.c
source/blender/blenkernel/intern/node.c
source/blender/blenkernel/intern/particle_system.c
source/blender/blenlib/BLI_arithb.h
source/blender/blenlib/intern/arithb.c
source/blender/blenlib/intern/graph.c
source/blender/blenlib/intern/storage.c
source/blender/blenloader/intern/readfile.c
source/blender/blenpluginapi/iff.h
source/blender/gpu/intern/gpu_material.c
source/blender/imbuf/IMB_imbuf_types.h
source/blender/imbuf/intern/IMB_jp2.h [new file with mode: 0644]
source/blender/imbuf/intern/imageprocess.c
source/blender/imbuf/intern/jp2.c [new file with mode: 0644]
source/blender/imbuf/intern/openexr/CMakeLists.txt
source/blender/imbuf/intern/readimage.c
source/blender/imbuf/intern/util.c
source/blender/imbuf/intern/writeimage.c
source/blender/include/BIF_editparticle.h
source/blender/include/BIF_outliner.h
source/blender/include/BSE_view.h
source/blender/include/butspace.h
source/blender/include/transform.h
source/blender/makesdna/DNA_actuator_types.h
source/blender/makesdna/DNA_customdata_types.h
source/blender/makesdna/DNA_scene_types.h
source/blender/makesdna/DNA_scriptlink_types.h
source/blender/nodes/CMakeLists.txt
source/blender/nodes/SConscript
source/blender/nodes/TEX_node.h
source/blender/nodes/intern/CMP_nodes/CMP_filter.c
source/blender/nodes/intern/TEX_nodes/TEX_coord.c [new file with mode: 0644]
source/blender/nodes/intern/TEX_nodes/TEX_distance.c [new file with mode: 0644]
source/blender/nodes/intern/TEX_util.c
source/blender/python/BPY_interface.c
source/blender/python/api2_2x/Blender.c
source/blender/python/api2_2x/Constraint.c
source/blender/python/api2_2x/CurNurb.c
source/blender/python/api2_2x/Curve.c
source/blender/python/api2_2x/IDProp.c
source/blender/python/api2_2x/Mesh.c
source/blender/python/api2_2x/Modifier.c
source/blender/python/api2_2x/NMesh.c
source/blender/python/api2_2x/Sys.c
source/blender/python/api2_2x/doc/API_related.py
source/blender/python/api2_2x/doc/Modifier.py
source/blender/python/api2_2x/doc/Sys.py
source/blender/python/api2_2x/sceneSequence.c
source/blender/radiosity/intern/source/radfactors.c
source/blender/radiosity/intern/source/radrender.c
source/blender/readblenfile/intern/BLO_readblenfile.c
source/blender/render/intern/source/occlusion.c
source/blender/render/intern/source/pipeline.c
source/blender/render/intern/source/rendercore.c
source/blender/render/intern/source/shadeinput.c
source/blender/src/SConscript
source/blender/src/buttons_editing.c
source/blender/src/buttons_logic.c
source/blender/src/buttons_scene.c
source/blender/src/drawimage.c
source/blender/src/drawview.c
source/blender/src/editface.c
source/blender/src/editparticle.c
source/blender/src/edittime.c
source/blender/src/filelist.c
source/blender/src/header_buttonswin.c
source/blender/src/header_info.c
source/blender/src/header_time.c
source/blender/src/header_view3d.c
source/blender/src/imagepaint.c
source/blender/src/outliner.c
source/blender/src/playanim.c
source/blender/src/seqeffects.c
source/blender/src/space.c
source/blender/src/transform.c
source/blender/src/transform_constraints.c
source/blender/src/transform_conversions.c
source/blender/src/transform_generics.c
source/blender/src/transform_snap.c
source/blender/src/view.c
source/blender/src/writeimage.c
source/creator/creator.c
source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp
source/gameengine/BlenderRoutines/Makefile
source/gameengine/Converter/BL_ActionActuator.cpp
source/gameengine/Converter/BL_ActionActuator.h
source/gameengine/Converter/BL_ShapeActionActuator.h
source/gameengine/Converter/KX_ConvertActuators.cpp
source/gameengine/Expressions/PyObjectPlus.cpp
source/gameengine/Expressions/PyObjectPlus.h
source/gameengine/Expressions/Value.cpp
source/gameengine/Expressions/Value.h
source/gameengine/GameLogic/SCA_2DFilterActuator.cpp
source/gameengine/GameLogic/SCA_ActuatorSensor.cpp
source/gameengine/GameLogic/SCA_ActuatorSensor.h
source/gameengine/GameLogic/SCA_DelaySensor.cpp
source/gameengine/GameLogic/SCA_DelaySensor.h
source/gameengine/GameLogic/SCA_ILogicBrick.cpp
source/gameengine/GameLogic/SCA_ILogicBrick.h
source/gameengine/GameLogic/SCA_ISensor.cpp
source/gameengine/GameLogic/SCA_ISensor.h
source/gameengine/GameLogic/SCA_JoystickSensor.cpp
source/gameengine/GameLogic/SCA_JoystickSensor.h
source/gameengine/GameLogic/SCA_KeyboardSensor.cpp
source/gameengine/GameLogic/SCA_KeyboardSensor.h
source/gameengine/GameLogic/SCA_MouseSensor.cpp
source/gameengine/GameLogic/SCA_MouseSensor.h
source/gameengine/GameLogic/SCA_PropertyActuator.cpp
source/gameengine/GameLogic/SCA_PropertyActuator.h
source/gameengine/GameLogic/SCA_PropertySensor.cpp
source/gameengine/GameLogic/SCA_PropertySensor.h
source/gameengine/GameLogic/SCA_PythonController.cpp
source/gameengine/GameLogic/SCA_PythonController.h
source/gameengine/GameLogic/SCA_RandomActuator.cpp
source/gameengine/GameLogic/SCA_RandomActuator.h
source/gameengine/GameLogic/SCA_RandomSensor.cpp
source/gameengine/GameLogic/SCA_RandomSensor.h
source/gameengine/GamePlayer/common/unix/Makefile
source/gameengine/GamePlayer/ghost/CMakeLists.txt
source/gameengine/GamePlayer/ghost/GPG_Application.cpp
source/gameengine/GamePlayer/ghost/GPG_ghost.cpp
source/gameengine/GamePlayer/ghost/Makefile
source/gameengine/GamePlayer/ghost/SConscript
source/gameengine/Ketsji/KX_BulletPhysicsController.cpp
source/gameengine/Ketsji/KX_BulletPhysicsController.h
source/gameengine/Ketsji/KX_Camera.cpp
source/gameengine/Ketsji/KX_ConvertPhysicsObjects.cpp
source/gameengine/Ketsji/KX_GameObject.cpp
source/gameengine/Ketsji/KX_GameObject.h
source/gameengine/Ketsji/KX_IPhysicsController.cpp
source/gameengine/Ketsji/KX_IPhysicsController.h
source/gameengine/Ketsji/KX_KetsjiEngine.cpp
source/gameengine/Ketsji/KX_KetsjiEngine.h
source/gameengine/Ketsji/KX_OdePhysicsController.cpp
source/gameengine/Ketsji/KX_OdePhysicsController.h
source/gameengine/Ketsji/KX_PolyProxy.cpp
source/gameengine/Ketsji/KX_PythonInit.cpp
source/gameengine/Ketsji/KX_SCA_DynamicActuator.cpp
source/gameengine/Ketsji/KX_SCA_DynamicActuator.h
source/gameengine/Ketsji/KX_Scene.cpp
source/gameengine/Ketsji/KX_SumoPhysicsController.cpp
source/gameengine/Ketsji/KX_SumoPhysicsController.h
source/gameengine/Physics/Bullet/CcdPhysicsController.cpp
source/gameengine/Physics/Bullet/CcdPhysicsController.h
source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp
source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.h
source/gameengine/Physics/common/PHY_DynamicTypes.h
source/gameengine/PyDoc/BL_ActionActuator.py
source/gameengine/PyDoc/BL_ShapeActionActuator.py
source/gameengine/PyDoc/KX_ActuatorSensor.py
source/gameengine/PyDoc/KX_GameObject.py
source/gameengine/PyDoc/SCA_DelaySensor.py
source/gameengine/PyDoc/SCA_ILogicBrick.py
source/gameengine/PyDoc/SCA_ISensor.py
source/gameengine/PyDoc/SCA_JoystickSensor.py
source/gameengine/PyDoc/SCA_KeyboardSensor.py
source/gameengine/PyDoc/SCA_MouseSensor.py
source/gameengine/PyDoc/SCA_PropertyActuator.py
source/gameengine/PyDoc/SCA_PropertySensor.py
source/gameengine/PyDoc/SCA_PythonController.py
source/gameengine/PyDoc/SCA_RandomActuator.py
source/gameengine/Rasterizer/RAS_FramingManager.h
source/gameengine/Rasterizer/RAS_IRasterizer.h
source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.cpp
source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.h
source/gameengine/VideoTexture/Exception.cpp
source/gameengine/VideoTexture/Exception.h
source/gameengine/VideoTexture/ImageRender.cpp
source/gameengine/VideoTexture/ImageRender.h
source/gameengine/VideoTexture/ImageViewport.cpp
source/gameengine/VideoTexture/ImageViewport.h
source/gameengine/VideoTexture/Texture.h
source/gameengine/VideoTexture/blendVideoTex.cpp
source/nan_compile.mk
source/nan_definitions.mk
source/nan_link.mk
tools/btools.py

index e01a37d3b3edfa2d2b834cd4d020c77c977686cf..4b96ca585a6ea49a30d152d03149e1c1412ff70b 100644 (file)
@@ -175,7 +175,7 @@ IF(UNIX)
 
   SET(FFMPEG /usr)
   SET(FFMPEG_INC ${FFMPEG}/include)
-  SET(FFMPEG_LIB avformat avcodec avutil)
+  SET(FFMPEG_LIB avformat avcodec avutil avdevice swscale)
   SET(FFMPEG_LIBPATH ${FFMPEG}/lib)
 
   SET(JPEG_LIB jpeg)
index 16e98e64f6b0f91201c3aaff24cf2948c6354f34..809166586e6af8a4c891cf40e0714e2de45a2be3 100644 (file)
@@ -115,8 +115,9 @@ if toolset:
                env.Tool('mstoolkit', ['tools'])
        else:
                env = BlenderEnvironment(tools=[toolset], ENV = os.environ)
-               if env:
-                       btools.SetupSpawn(env)
+               # xxx commented out, as was supressing warnings under mingw..
+               #if env:
+               #       btools.SetupSpawn(env)
 else:
        env = BlenderEnvironment(ENV = os.environ)
 
@@ -321,10 +322,15 @@ if not quickie and do_clean:
                                print "remove file %s"%(B.root_build_dir+entry)
                                os.remove(B.root_build_dir+entry)
                for confile in ['extern/ffmpeg/config.mak', 'extern/x264/config.mak',
-                               'extern/xvidcore/build/generic/platform.inc']:
+                               'extern/xvidcore/build/generic/platform.inc', 'extern/ffmpeg/include']:
                        if os.path.exists(confile):
                                print "clean file %s"%confile
-                               os.remove(confile)
+                               if os.path.isdir(confile):
+                                       for root, dirs, files in os.walk(confile):
+                                               for name in files:
+                                                       os.remove(os.path.join(root, name))
+                               else:
+                                       os.remove(confile)
                print B.bc.OKGREEN+'...done'+B.bc.ENDC
        else:
                print B.bc.HEADER+'Already Clean, nothing to do.'+B.bc.ENDC
index 3ef7b7132d97c157cedd3cc8a89f396dd1e4493b..cfd6a9395bba8d4d8a4a88c71f37158c56887e9c 100644 (file)
@@ -40,7 +40,11 @@ else:
 # enable ffmpeg  support
 WITH_BF_FFMPEG = True  # -DWITH_FFMPEG
 BF_FFMPEG = "#extern/ffmpeg"
-BF_FFMPEG_INC = '${BF_FFMPEG}/include'
+# trick : The version of ffmpeg in extern/ffmpeg uses explicit libav.. directory in #include statements
+#         To keep Blender compatible with older versions, I add ${BF_FFMPEG} to the inc dir so that ffmpeg
+#         finds the files directly in extern/ffmpeg/libav... while blender finds them in
+#         extern/ffmpeg/include. 
+BF_FFMPEG_INC = '${BF_FFMPEG}/include ${BF_FFMPEG}'
 if USE_SDK==True:
        BF_FFMPEG_EXTRA = '-isysroot '+MACOSX_SDK+' -mmacosx-version-min='+MAC_MIN_VERS
 #BF_FFMPEG_LIBPATH='${BF_FFMPEG}/lib'
diff --git a/config/irix6-config.py b/config/irix6-config.py
new file mode 100644 (file)
index 0000000..81a301f
--- /dev/null
@@ -0,0 +1,231 @@
+import os
+
+LCGDIR = os.getcwd()+"/../lib/irix-6.5-mips"
+LIBDIR = LCGDIR
+print LCGDIR
+
+WITH_BF_VERSE = 'false'
+BF_VERSE_INCLUDE = "#extern/verse/dist"
+
+BF_PYTHON = LCGDIR+'/python'
+BF_PYTHON_VERSION = '2.5'
+WITH_BF_STATICPYTHON = 'true'
+BF_PYTHON_INC = '${BF_PYTHON}/include/python${BF_PYTHON_VERSION}'
+BF_PYTHON_BINARY = '${BF_PYTHON}/bin/python${BF_PYTHON_VERSION}'
+BF_PYTHON_LIB = 'python${BF_PYTHON_VERSION}' #BF_PYTHON+'/lib/python'+BF_PYTHON_VERSION+'/config/libpython'+BF_PYTHON_VERSION+'.a'
+BF_PYTHON_LINKFLAGS = ['-Xlinker', '-export-dynamic']
+BF_PYTHON_LIB_STATIC = '${BF_PYTHON}/lib/python2.5/config/libpython${BF_PYTHON_VERSION}.a'
+
+WITH_BF_OPENAL = 'true'
+WITH_BF_STATICOPENAL = 'true'
+BF_OPENAL = LCGDIR+'/openal'
+BF_OPENAL_INC = '${BF_OPENAL}/include'
+BF_OPENAL_LIB = 'openal'
+BF_OPENAL_LIB_STATIC = '${BF_OPENAL}/lib/libopenal.a'
+BF_OPENAL_LIBPATH = LIBDIR + '/lib'
+
+# some distros have a separate libalut
+# if you get linker complaints, you need to uncomment the line below
+# BF_OPENAL_LIB = 'openal alut'  
+# BF_OPENAL_LIB_STATIC = '${BF_OPENAL}/lib/libopenal.a ${BF_OPENAL}/lib/libalut.a'
+
+BF_CXX = '/usr'
+WITH_BF_STATICCXX = 'false'
+BF_CXX_LIB_STATIC = '${BF_CXX}/lib/libstdc++.a'
+
+WITH_BF_SDL = 'true'
+BF_SDL = LCGDIR+'/SDL' #$(shell sdl-config --prefix)
+BF_SDL_INC = '${BF_SDL}/include/SDL' #$(shell $(BF_SDL)/bin/sdl-config --cflags)
+BF_SDL_LIB = 'SDL audio iconv charset' #BF_SDL #$(shell $(BF_SDL)/bin/sdl-config --libs) -lSDL_mixer
+BF_SDL_LIBPATH = '${BF_SDL}/lib'
+
+WITH_BF_FMOD = 'false'
+BF_FMOD = LIBDIR + '/fmod'
+
+WITH_BF_OPENEXR = 'false'
+WITH_BF_STATICOPENEXR = 'false'
+BF_OPENEXR = '/usr'
+# when compiling with your own openexr lib you might need to set...
+# BF_OPENEXR_INC = '${BF_OPENEXR}/include/OpenEXR ${BF_OPENEXR}/include'
+
+BF_OPENEXR_INC = '${BF_OPENEXR}/include/OpenEXR'
+BF_OPENEXR_LIB = 'Half IlmImf Iex Imath '
+BF_OPENEXR_LIB_STATIC = '${BF_OPENEXR}/lib/libHalf.a ${BF_OPENEXR}/lib/libIlmImf.a ${BF_OPENEXR}/lib/libIex.a ${BF_OPENEXR}/lib/libImath.a ${BF_OPENEXR}/lib/libIlmThread.a'
+# BF_OPENEXR_LIBPATH = '${BF_OPENEXR}/lib'
+
+
+WITH_BF_DDS = 'false'
+
+WITH_BF_JPEG = 'false'
+BF_JPEG = LCGDIR+'/jpeg'
+BF_JPEG_INC = '${BF_JPEG}/include'
+BF_JPEG_LIB = 'jpeg'
+BF_JPEG_LIBPATH = '${BF_JPEG}/lib'
+
+WITH_BF_PNG = 'false'
+BF_PNG = LCGDIR+"/png"
+BF_PNG_INC = '${BF_PNG}/include'
+BF_PNG_LIB = 'png'
+BF_PNG_LIBPATH = '${BF_PNG}/lib'
+
+BF_TIFF = '/usr/nekoware'
+BF_TIFF_INC = '${BF_TIFF}/include'
+
+WITH_BF_ZLIB = 'true'
+BF_ZLIB = LCGDIR+"/zlib"
+BF_ZLIB_INC = '${BF_ZLIB}/include'
+BF_ZLIB_LIB = 'z'
+BF_ZLIB_LIBPATH = '${BF_ZLIB}/lib'
+
+WITH_BF_INTERNATIONAL = 'true'
+
+BF_GETTEXT = LCGDIR+'/gettext'
+BF_GETTEXT_INC = '${BF_GETTEXT}/include'
+BF_GETTEXT_LIB = 'gettextpo intl'
+BF_GETTEXT_LIBPATH = '${BF_GETTEXT}/lib'
+
+WITH_BF_FTGL = 'true'
+BF_FTGL = '#extern/bFTGL'
+BF_FTGL_INC = '${BF_FTGL}/include'
+BF_FTGL_LIB = 'extern_ftgl'
+
+WITH_BF_GAMEENGINE='false'
+
+WITH_BF_ODE = 'false'
+BF_ODE = LIBDIR + '/ode'
+BF_ODE_INC = BF_ODE + '/include'
+BF_ODE_LIB = BF_ODE + '/lib/libode.a'
+
+WITH_BF_BULLET = 'true'
+BF_BULLET = '#extern/bullet2/src'
+BF_BULLET_INC = '${BF_BULLET}'
+BF_BULLET_LIB = 'extern_bullet'
+
+BF_SOLID = '#extern/solid'
+BF_SOLID_INC = '${BF_SOLID}'
+BF_SOLID_LIB = 'extern_solid'
+
+WITH_BF_YAFRAY = 'true'
+
+#WITH_BF_NSPR = 'true'
+#BF_NSPR = $(LIBDIR)/nspr
+#BF_NSPR_INC = -I$(BF_NSPR)/include -I$(BF_NSPR)/include/nspr
+#BF_NSPR_LIB = 
+
+# Uncomment the following line to use Mozilla inplace of netscape
+#CPPFLAGS += -DMOZ_NOT_NET
+# Location of MOZILLA/Netscape header files...
+#BF_MOZILLA = $(LIBDIR)/mozilla
+#BF_MOZILLA_INC = -I$(BF_MOZILLA)/include/mozilla/nspr -I$(BF_MOZILLA)/include/mozilla -I$(BF_MOZILLA)/include/mozilla/xpcom -I$(BF_MOZILLA)/include/mozilla/idl
+#BF_MOZILLA_LIB =
+# Will fall back to look in BF_MOZILLA_INC/nspr and BF_MOZILLA_LIB
+# if this is not set.
+#
+# Be paranoid regarding library creation (do not update archives)
+#BF_PARANOID = 'true'
+
+# enable freetype2 support for text objects
+BF_FREETYPE = LCGDIR+'/freetype'
+BF_FREETYPE_INC = '${BF_FREETYPE}/include ${BF_FREETYPE}/include/freetype2'
+BF_FREETYPE_LIB = 'freetype'
+BF_FREETYPE_LIBPATH = '${BF_FREETYPE}/lib'
+
+WITH_BF_QUICKTIME = 'false' # -DWITH_QUICKTIME
+BF_QUICKTIME = '/usr/local'
+BF_QUICKTIME_INC = '${BF_QUICKTIME}/include'
+
+WITH_BF_ICONV = 'true'
+BF_ICONV = LIBDIR + "/iconv"
+BF_ICONV_INC = '${BF_ICONV}/include'
+BF_ICONV_LIB = 'iconv charset'
+BF_ICONV_LIBPATH = '${BF_ICONV}/lib'
+
+WITH_BF_BINRELOC = 'false'
+
+# enable ffmpeg  support
+WITH_BF_FFMPEG = 'true'  # -DWITH_FFMPEG
+# Uncomment the following two lines to use system's ffmpeg
+BF_FFMPEG = LCGDIR+'/ffmpeg'
+BF_FFMPEG_LIB = 'avformat avcodec swscale avutil avdevice faad faac vorbis x264 ogg mp3lame z'
+BF_FFMPEG_INC = '${BF_FFMPEG}/include'
+BF_FFMPEG_LIBPATH='${BF_FFMPEG}/lib'
+
+# enable ogg, vorbis and theora in ffmpeg
+WITH_BF_OGG = 'false'  # -DWITH_OGG 
+BF_OGG = '/usr'
+BF_OGG_INC = '${BF_OGG}/include'
+BF_OGG_LIB = 'ogg vorbis theoraenc theoradec'
+
+WITH_BF_OPENJPEG = 'false' 
+BF_OPENJPEG = '#extern/libopenjpeg'
+BF_OPENJPEG_LIB = ''
+BF_OPENJPEG_INC = '${BF_OPENJPEG}'
+BF_OPENJPEG_LIBPATH='${BF_OPENJPEG}/lib'
+
+WITH_BF_REDCODE = 'false'  
+BF_REDCODE = '#extern/libredcode'
+BF_REDCODE_LIB = ''
+BF_REDCODE_INC = '${BF_REDCODE}/include'
+BF_REDCODE_LIBPATH='${BF_REDCODE}/lib'
+
+# Mesa Libs should go here if your using them as well....
+WITH_BF_STATICOPENGL = 'false'
+BF_OPENGL = '/usr'
+BF_OPENGL_INC = '${BF_OPENGL}/include'
+BF_OPENGL_LIB = 'GL GLU X11 Xi Xext'
+BF_OPENGL_LIBPATH = '/usr/X11R6/lib'
+BF_OPENGL_LIB_STATIC = '${BF_OPENGL}/libGL.a ${BF_OPENGL}/libGLU.a ${BF_OPENGL}/libXxf86vm.a ${BF_OPENGL}/libX11.a ${BF_OPENGL}/libXi.a ${BF_OPENGL}/libXext.a ${BF_OPENGL}/libXxf86vm.a'
+
+
+CC = 'c99'
+CXX = 'CC'
+
+
+CCFLAGS = ['-pipe','-fPIC', '-n32']
+
+CPPFLAGS = ['-DXP_UNIX']
+CXXFLAGS = ['-pipe','-fPIC', '-n32']
+REL_CFLAGS = ['-O2']
+REL_CCFLAGS = ['-O2']
+##BF_DEPEND = 'true'
+##
+##AR = ar
+##ARFLAGS = ruv
+##ARFLAGSQUIET = ru
+##
+C_WARN = '-no_prelink -ptused'
+
+CC_WARN = '-no_prelink -ptused'
+
+##FIX_STUBS_WARNINGS = -Wno-unused
+
+LLIBS = 'c m dl pthread dmedia movie'
+##LOPTS = --dynamic
+##DYNLDFLAGS = -shared $(LDFLAGS)
+
+BF_PROFILE_FLAGS = ['-pg','-g']
+BF_PROFILE = 'false'
+
+BF_DEBUG = 'false'
+BF_DEBUG_FLAGS = '-g'
+
+BF_BUILDDIR = '../build/irix6'
+BF_INSTALLDIR='../install/irix6'
+BF_DOCDIR='../install/doc'
+
+#Link against pthread
+LDIRS = []
+LDIRS.append(BF_FREETYPE_LIBPATH)
+LDIRS.append(BF_PNG_LIBPATH)
+LDIRS.append(BF_ZLIB_LIBPATH)
+LDIRS.append(BF_SDL_LIBPATH)
+LDIRS.append(BF_OPENAL_LIBPATH)
+LDIRS.append(BF_ICONV_LIBPATH)
+
+PLATFORM_LINKFLAGS = []
+for x in LDIRS:
+    PLATFORM_LINKFLAGS.append("-L"+x)
+    
+PLATFORM_LINKFLAGS += ['-L${LCGDIR}/jpeg/lib' , '-L/usr/lib32',  '-n32', '-v', '-no_prelink']
+print PLATFORM_LINKFLAGS
+LINKFLAGS= PLATFORM_LINKFLAGS
index 2984c06d2df9c2fc7bb89f9499565183fb7660f3..6ba3052048d088d3d229ac745e7e3129035527fb 100644 (file)
@@ -139,8 +139,13 @@ BF_FFMPEG = '#extern/ffmpeg'
 BF_FFMPEG_LIB = ''
 # Uncomment the following two lines to use system's ffmpeg
 # BF_FFMPEG = '/usr'
-# BF_FFMPEG_LIB = 'avformat avcodec swscale avutil'
-BF_FFMPEG_INC = '${BF_FFMPEG}/include'
+# BF_FFMPEG_LIB = 'avformat avcodec swscale avutil avdevice'
+# trick : The version of ffmpeg in extern/ffmpeg uses explicit libav.. directory in #include statements
+#         To keep Blender compatible with older version, I add ${BF_FFMPEG} to the inc dir so that ffmpeg
+#         finds the files directly in extern/ffmpeg/libav... while blender finds them in
+#         extern/ffmpeg/include. When using system ffmpeg, you don't need that, assuming the system library
+#         still use the flat directory model, otherwise will not compile anyway
+BF_FFMPEG_INC = '${BF_FFMPEG}/include ${BF_FFMPEG}'
 BF_FFMPEG_LIBPATH='${BF_FFMPEG}/lib'
 
 # enable ogg, vorbis and theora in ffmpeg
@@ -152,13 +157,14 @@ BF_OGG_LIB = 'ogg vorbis theoraenc theoradec'
 WITH_BF_OPENJPEG = True 
 BF_OPENJPEG = '#extern/libopenjpeg'
 BF_OPENJPEG_LIB = ''
-BF_OPENJPEG_INC = '${BF_OPENJPEG}/include'
+BF_OPENJPEG_INC = '${BF_OPENJPEG}'
 BF_OPENJPEG_LIBPATH='${BF_OPENJPEG}/lib'
 
 WITH_BF_REDCODE = False  
 BF_REDCODE = '#extern/libredcode'
 BF_REDCODE_LIB = ''
-BF_REDCODE_INC = '${BF_REDCODE}/include'
+# BF_REDCODE_INC = '${BF_REDCODE}/include'
+BF_REDCODE_INC = '${BF_REDCODE}/../' #C files request "libredcode/format.h" which is in "#extern/libredcode/format.h", stupid but compiles for now.
 BF_REDCODE_LIBPATH='${BF_REDCODE}/lib'
 
 # Mesa Libs should go here if your using them as well....
index a44a9df7c75e7dea8d70dc877535d110dd4657f6..dda7d0ff2f391305168e015767abba01d88c587c 100644 (file)
@@ -131,7 +131,7 @@ WITH_BF_FFMPEG = False  # -DWITH_FFMPEG
 BF_FFMPEG = '/usr/local'
 BF_FFMPEG_INC = '${BF_FFMPEG}/include'
 BF_FFMPEG_LIBPATH='${BF_FFMPEG}/lib'
-BF_FFMPEG_LIB = 'avformat avcodec avutil'
+BF_FFMPEG_LIB = 'avformat avcodec avutil avdevice'
 
 # Mesa Libs should go here if your using them as well....
 WITH_BF_STATICOPENGL = False
index 6278672ca3df936baecf56863a846edf541a45ff..b94747637e91729463d0d55fdbb823fae556a0a9 100644 (file)
@@ -6,10 +6,12 @@ BF_VERSE_INCLUDE = "#extern/verse/dist"
 
 BF_PYTHON = LIBDIR + '/python'
 BF_PYTHON_VERSION = '2.5'
+WITH_BF_STATICPYTHON = False
 BF_PYTHON_INC = '${BF_PYTHON}/include/python${BF_PYTHON_VERSION}'
 BF_PYTHON_BINARY = 'python'
 BF_PYTHON_LIB = 'python25'
 BF_PYTHON_LIBPATH = '${BF_PYTHON}/lib/lib25_vs2005'
+BF_PYTHON_LIB_STATIC = '${BF_PYTHON}/lib/lib25_vs2005/libpython25.a'
 
 WITH_BF_OPENAL = True
 WITH_BF_STATICOPENAL = False
@@ -21,7 +23,7 @@ BF_OPENAL_LIBPATH = '${BF_OPENAL}/lib'
 BF_OPENAL_LIB_STATIC = '${BF_OPENAL}/lib/libopenal.a'
 
 WITH_BF_FFMPEG = False
-BF_FFMPEG_LIB = 'avformat swscale avcodec avutil xvidcore x264'
+BF_FFMPEG_LIB = 'avformat swscale avcodec avutil avdevice xvidcore x264'
 BF_FFMPEG_LIBPATH = LIBDIR + '/gcc/ffmpeg/lib'
 BF_FFMPEG_INC =  LIBDIR + '/gcc/ffmpeg/include'
 
@@ -170,4 +172,4 @@ BF_PROFILE = False
 
 BF_BUILDDIR = '..\\build\\win32-mingw'
 BF_INSTALLDIR='..\\install\\win32-mingw'
-BF_DOCDIR = '..\\install\\doc'
\ No newline at end of file
+BF_DOCDIR = '..\\install\\doc'
index d7165401705d9872ed79a4f0b1738a5c81521b6f..d4e9fa9b30ebad942b8998d4a48d69a6c3d12752 100644 (file)
@@ -153,6 +153,10 @@ BF_QUICKTIME_LIB = 'qtmlClient'
 BF_QUICKTIME_LIBPATH = '${BF_QUICKTIME}/Libraries'
 
 WITH_BF_OPENJPEG = True 
+BF_OPENJPEG = '#extern/libopenjpeg'
+BF_OPENJPEG_LIB = ''
+BF_OPENJPEG_INC = '${BF_OPENJPEG}'
+BF_OPENJPEG_LIBPATH='${BF_OPENJPEG}/lib'
 
 WITH_BF_REDCODE = False  
 BF_REDCODE_INC = '#extern'
index 26ee25b608f0049f3777f5d57086f8ca5752ff98..51213698ebbfd83b88d7afaeab13090389279f52 100644 (file)
@@ -57,10 +57,7 @@ ifeq ($(WITH_BINRELOC), true)
     DIRS += binreloc
 endif
 
-TARGET =
-ifneq ($(OS),irix)
-  TARGET=solid
-endif
+TARGET = solid
 
 all::
        @[ -d $(OCGDIR)/extern ] || mkdir -p $(OCGDIR)/extern
index f08b810eadbc37ab728db159a43d04d1d9109275..997361a5069da7a50c6209ad9deb473ccd2130ff 100644 (file)
@@ -49,8 +49,6 @@ void  btCompoundShape::addChildShape(const btTransform& localTransform,btCollisio
        child.m_childShapeType = shape->getShapeType();
        child.m_childMargin = shape->getMargin();
 
-       m_children.push_back(child);
-
        //extend the local aabbMin/aabbMax
        btVector3 localAabbMin,localAabbMax;
        shape->getAabb(localTransform,localAabbMin,localAabbMax);
@@ -69,10 +67,11 @@ void        btCompoundShape::addChildShape(const btTransform& localTransform,btCollisio
        if (m_dynamicAabbTree)
        {
                const btDbvtVolume      bounds=btDbvtVolume::FromMM(localAabbMin,localAabbMax);
-               int index = m_children.size()-1;
+               int index = m_children.size();
                child.m_node = m_dynamicAabbTree->insert(bounds,(void*)index);
        }
 
+       m_children.push_back(child);
 }
 
 void btCompoundShape::removeChildShapeByIndex(int childShapeIndex)
index 837701eeae0c3416ce316447ffddc23232f88f0b..eb408c1e9c049985e5a11a97e9614147967dcbc8 100644 (file)
@@ -6,9 +6,12 @@ Import('env')
 
 sources = env.Glob('*.c')
 incs = '.'
+flags = []
+defs = []
 
 if env['OURPLATFORM'] == 'win32-vc':
        flags = []
+       defs.append('OPJ_STATIC')
 else:
        flags = ['-Wall', '-O3', '-ffast-math', '-std=c99']
 
@@ -19,6 +22,6 @@ if not env['OURPLATFORM'] == 'win32-vc':
 
 oj_env.BlenderLib ( libname='extern_openjpeg', 
                     sources=sources, includes=Split(incs),
-                    defines=[],
+                    defines=defs,
                     libtype=['core','intern','player'],
-                    priority=[10, 10, 300], compileflags = flags)
+                    priority=[300, 300, 300], compileflags = flags)
index ffcaacaf6e57fd490b6de72f398a298797c7f458..ae7764eab2f5028a4f57d35aa73e7672c34d9e33 100644 (file)
 ==========================================================
 */
 
-#if defined(OPJ_STATIC) || !(defined(WIN32) || defined(__WIN32__))
 #define OPJ_API
 #define OPJ_CALLCONV
-#else
-#define OPJ_CALLCONV __stdcall
-/*
-The following ifdef block is the standard way of creating macros which make exporting 
-from a DLL simpler. All files within this DLL are compiled with the OPJ_EXPORTS
-symbol defined on the command line. this symbol should not be defined on any project
-that uses this DLL. This way any other project whose source files include this file see 
-OPJ_API functions as being imported from a DLL, wheras this DLL sees symbols
-defined with this macro as being exported.
-*/
-#ifdef OPJ_EXPORTS
-#define OPJ_API __declspec(dllexport)
-#else
-#define OPJ_API __declspec(dllimport)
-#endif /* OPJ_EXPORTS */
-#endif /* !OPJ_STATIC || !WIN32 */
 
 #ifndef __cplusplus
 #if defined(HAVE_STDBOOL_H)
index d00339f351c4957b86c5d063f92ef275dfcd2989..051e2643a87dd7a0a1cfe95c5bec69d8b7ffecf6 100644 (file)
@@ -47,6 +47,9 @@ ifneq ($(NAN_NO_OPENAL),true)
   ifeq ($(OS),$(findstring $(OS), "linux freebsd solaris"))
     DIRS += openal sdl
   endif
+  ifeq ($(OS), irix)
+    DIRS += sdl
+  endif
 else
   export CPPFLAGS += -DNO_SOUND
 endif
index 825e92251fe5d4d7705fb06b3878631ce3648730..a5f63e696a6db6de4b7d757e8391d1e1fbd8223c 100644 (file)
@@ -154,12 +154,18 @@ int writePng(const char *fileName, unsigned char **rowsp, int w, int h);
  */
 
 /* minimum */
+#ifdef MIN
+#undef MIN
+#endif
 template < class T >
 inline T
 MIN( T a, T b )
 { return (a < b) ? a : b ; }
 
 /* maximum */
+#ifdef MAX
+#undef MAX
+#endif
 template < class T >
 inline T
 MAX( T a, T b )
index 8073756e453221a23c55d25b9ca07c7f86a770c1..9950ef8887976806be71ef5c9c0ff595be064143 100644 (file)
@@ -1031,15 +1031,20 @@ getClipboard(int flag
        //This needs to change so we do not wait for ever or check owner first
        while(1) {
                XNextEvent(m_display, &xevent);
-               if(xevent.type == SelectionNotify) {
-                       if(XGetWindowProperty(m_display, m_window, xevent.xselection.property, 0L, 4096L, False, AnyPropertyType, &rtype, &bits, &len, &bytes, &data) == Success) {
-                               if (data) {
-                                       tmp_data = (unsigned char*) malloc(strlen((char*)data)+1);
-                                       strcpy((char*)tmp_data, (char*)data);
-                                       XFree(data);
-                                       return (GHOST_TUns8*)tmp_data;
+               if(xevent.type == SelectionNotify) { 
+                       if (xevent.xselection.property ) { /* eric4 on linux gives zero Atom xevent.xselection.property value, closes blender instantly */
+                               if(XGetWindowProperty(m_display, m_window, xevent.xselection.property , 0L, 4096L, False, AnyPropertyType, &rtype, &bits, &len, &bytes, &data) == Success) {
+                                       if (data) {
+                                               tmp_data = (unsigned char*) malloc(strlen((char*)data)+1);
+                                               strcpy((char*)tmp_data, (char*)data);
+                                               XFree(data);
+                                               return (GHOST_TUns8*)tmp_data;
+                                       }
                                }
                        }
+                       else {
+                               fprintf(stderr, "error: cut buffer had a zero xevent.xselection.property, FIXME\n"); // XXX fix this problem!
+                       }
                        return NULL;
                }
        }
index 4a12fcb29630ddfb12084df79dc8bffa7601b13a..ac4c7f60c95c18a8d7bfe50a8ae581964d973b5a 100644 (file)
@@ -151,6 +151,7 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "blenderplayer", "..\gameeng
                {415BFD6E-64CF-422B-AF88-C07F040A7292} = {415BFD6E-64CF-422B-AF88-C07F040A7292}\r
                {670EC17A-0548-4BBF-A27B-636C7C188139} = {670EC17A-0548-4BBF-A27B-636C7C188139}\r
                {4C3AB78A-52CA-4276-A041-39776E52D8C8} = {4C3AB78A-52CA-4276-A041-39776E52D8C8}\r
+               {E784098D-3ED8-433A-9353-9679415DDDC5} = {E784098D-3ED8-433A-9353-9679415DDDC5}\r
                {6B801390-5F95-4F07-81A7-97FBA046AACC} = {6B801390-5F95-4F07-81A7-97FBA046AACC}\r
                {CAE37E91-6570-43AC-A4B4-7A37A4B0FC94} = {CAE37E91-6570-43AC-A4B4-7A37A4B0FC94}\r
                {76D90B92-ECC7-409C-9F98-A8814B90F3C0} = {76D90B92-ECC7-409C-9F98-A8814B90F3C0}\r
@@ -167,13 +168,16 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "blenderplayer", "..\gameeng
                {E90C7BC2-CF30-4A60-A8F2-0050D592E358} = {E90C7BC2-CF30-4A60-A8F2-0050D592E358}\r
                {8B8D4FC3-3234-4E54-8376-5AB83D00D164} = {8B8D4FC3-3234-4E54-8376-5AB83D00D164}\r
                {4B6AFCC5-968C-424A-8F20-76E41B3BEF74} = {4B6AFCC5-968C-424A-8F20-76E41B3BEF74}\r
+               {0112CAD5-3584-412A-A2E5-1315A00437B4} = {0112CAD5-3584-412A-A2E5-1315A00437B4}\r
                {5A2EA6DC-1A53-4E87-9166-52870CE3B4EA} = {5A2EA6DC-1A53-4E87-9166-52870CE3B4EA}\r
                {E86B7BDE-C33C-4E55-9433-E74C141D7538} = {E86B7BDE-C33C-4E55-9433-E74C141D7538}\r
                {32CC75E2-EE85-45E6-8E3D-513F58464F43} = {32CC75E2-EE85-45E6-8E3D-513F58464F43}\r
                {9A307EE5-CD77-47BC-BD87-62508C7E19D8} = {9A307EE5-CD77-47BC-BD87-62508C7E19D8}\r
                {AB590CED-F71F-4A17-A89B-18583ECD633D} = {AB590CED-F71F-4A17-A89B-18583ECD633D}\r
+               {B83C6BED-11EC-46C8-AFFA-121EEDE94373} = {B83C6BED-11EC-46C8-AFFA-121EEDE94373}\r
                {1CC733F1-6AB5-4904-8F63-C08C46B79DD9} = {1CC733F1-6AB5-4904-8F63-C08C46B79DD9}\r
                {B789C2F3-279E-4A85-8F0A-7F7AC068E598} = {B789C2F3-279E-4A85-8F0A-7F7AC068E598}\r
+               {524264F4-DF21-4B79-847F-E7CA643ECD0B} = {524264F4-DF21-4B79-847F-E7CA643ECD0B}\r
        EndProjectSection\r
 EndProject\r
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "KX_blenderhook", "..\gameengine\blenderhook\KX_blenderhook.vcproj", "{8154A59A-CAED-403D-AB94-BC4E7C032666}"\r
@@ -621,19 +625,25 @@ Global
                {0112CAD5-3584-412A-A2E5-1315A00437B4}.Blender Release|Win32.ActiveCfg = Blender Release|Win32\r
                {0112CAD5-3584-412A-A2E5-1315A00437B4}.Blender Release|Win32.Build.0 = Blender Release|Win32\r
                {0112CAD5-3584-412A-A2E5-1315A00437B4}.BlenderPlayer Debug|Win32.ActiveCfg = Blender Debug|Win32\r
+               {0112CAD5-3584-412A-A2E5-1315A00437B4}.BlenderPlayer Debug|Win32.Build.0 = Blender Debug|Win32\r
                {0112CAD5-3584-412A-A2E5-1315A00437B4}.BlenderPlayer Release|Win32.ActiveCfg = Blender Release|Win32\r
+               {0112CAD5-3584-412A-A2E5-1315A00437B4}.BlenderPlayer Release|Win32.Build.0 = Blender Release|Win32\r
                {B83C6BED-11EC-46C8-AFFA-121EEDE94373}.Blender Debug|Win32.ActiveCfg = Blender Debug|Win32\r
                {B83C6BED-11EC-46C8-AFFA-121EEDE94373}.Blender Debug|Win32.Build.0 = Blender Debug|Win32\r
                {B83C6BED-11EC-46C8-AFFA-121EEDE94373}.Blender Release|Win32.ActiveCfg = Blender Release|Win32\r
                {B83C6BED-11EC-46C8-AFFA-121EEDE94373}.Blender Release|Win32.Build.0 = Blender Release|Win32\r
                {B83C6BED-11EC-46C8-AFFA-121EEDE94373}.BlenderPlayer Debug|Win32.ActiveCfg = Blender Debug|Win32\r
+               {B83C6BED-11EC-46C8-AFFA-121EEDE94373}.BlenderPlayer Debug|Win32.Build.0 = Blender Debug|Win32\r
                {B83C6BED-11EC-46C8-AFFA-121EEDE94373}.BlenderPlayer Release|Win32.ActiveCfg = Blender Release|Win32\r
+               {B83C6BED-11EC-46C8-AFFA-121EEDE94373}.BlenderPlayer Release|Win32.Build.0 = Blender Release|Win32\r
                {524264F4-DF21-4B79-847F-E7CA643ECD0B}.Blender Debug|Win32.ActiveCfg = Blender Debug|Win32\r
                {524264F4-DF21-4B79-847F-E7CA643ECD0B}.Blender Debug|Win32.Build.0 = Blender Debug|Win32\r
                {524264F4-DF21-4B79-847F-E7CA643ECD0B}.Blender Release|Win32.ActiveCfg = Blender Release|Win32\r
                {524264F4-DF21-4B79-847F-E7CA643ECD0B}.Blender Release|Win32.Build.0 = Blender Release|Win32\r
                {524264F4-DF21-4B79-847F-E7CA643ECD0B}.BlenderPlayer Debug|Win32.ActiveCfg = Blender Debug|Win32\r
+               {524264F4-DF21-4B79-847F-E7CA643ECD0B}.BlenderPlayer Debug|Win32.Build.0 = Blender Debug|Win32\r
                {524264F4-DF21-4B79-847F-E7CA643ECD0B}.BlenderPlayer Release|Win32.ActiveCfg = Blender Release|Win32\r
+               {524264F4-DF21-4B79-847F-E7CA643ECD0B}.BlenderPlayer Release|Win32.Build.0 = Blender Release|Win32\r
                {D696C86B-0B53-4471-A50D-5B983A6FA4AD}.Blender Debug|Win32.ActiveCfg = Blender Debug|Win32\r
                {D696C86B-0B53-4471-A50D-5B983A6FA4AD}.Blender Debug|Win32.Build.0 = Blender Debug|Win32\r
                {D696C86B-0B53-4471-A50D-5B983A6FA4AD}.Blender Release|Win32.ActiveCfg = Blender Release|Win32\r
@@ -669,6 +679,7 @@ Global
                {6461F05D-4698-47AB-A8E8-1CA2ACC9948B}.Blender Release|Win32.ActiveCfg = Blender Release|Win32\r
                {6461F05D-4698-47AB-A8E8-1CA2ACC9948B}.Blender Release|Win32.Build.0 = Blender Release|Win32\r
                {6461F05D-4698-47AB-A8E8-1CA2ACC9948B}.BlenderPlayer Debug|Win32.ActiveCfg = Blender Debug|Win32\r
+               {6461F05D-4698-47AB-A8E8-1CA2ACC9948B}.BlenderPlayer Debug|Win32.Build.0 = Blender Debug|Win32\r
                {6461F05D-4698-47AB-A8E8-1CA2ACC9948B}.BlenderPlayer Release|Win32.ActiveCfg = Blender Release|Win32\r
                {6461F05D-4698-47AB-A8E8-1CA2ACC9948B}.BlenderPlayer Release|Win32.Build.0 = Blender Release|Win32\r
                {531D4862-D0E7-4B9B-A0B6-B3A6A25B547A}.Blender Debug|Win32.ActiveCfg = Blender Debug|Win32\r
@@ -694,7 +705,9 @@ Global
                {E784098D-3ED8-433A-9353-9679415DDDC5}.Blender Release|Win32.ActiveCfg = Blender Release|Win32\r
                {E784098D-3ED8-433A-9353-9679415DDDC5}.Blender Release|Win32.Build.0 = Blender Release|Win32\r
                {E784098D-3ED8-433A-9353-9679415DDDC5}.BlenderPlayer Debug|Win32.ActiveCfg = Blender Debug|Win32\r
+               {E784098D-3ED8-433A-9353-9679415DDDC5}.BlenderPlayer Debug|Win32.Build.0 = Blender Debug|Win32\r
                {E784098D-3ED8-433A-9353-9679415DDDC5}.BlenderPlayer Release|Win32.ActiveCfg = Blender Release|Win32\r
+               {E784098D-3ED8-433A-9353-9679415DDDC5}.BlenderPlayer Release|Win32.Build.0 = Blender Release|Win32\r
                {EB75F4D6-2970-4A3A-8D99-2BAD7201C0E9}.Blender Debug|Win32.ActiveCfg = Blender Debug|Win32\r
                {EB75F4D6-2970-4A3A-8D99-2BAD7201C0E9}.Blender Debug|Win32.Build.0 = Blender Debug|Win32\r
                {EB75F4D6-2970-4A3A-8D99-2BAD7201C0E9}.Blender Release|Win32.ActiveCfg = Blender Release|Win32\r
index 8950ef822a1aef3da21899f5b5833f0482ac0bb5..a8c5fb0a5b5ed497b111c96da0bc0a4e864df15a 100644 (file)
@@ -73,7 +73,7 @@
                        <Tool\r
                                Name="VCLinkerTool"\r
                                AdditionalOptions="/MACHINE:I386"\r
-                               AdditionalDependencies="SDL.lib freetype2ST.lib gnu_gettext.lib qtmlClient.lib openal_static.lib ws2_32.lib dxguid.lib opengl32.lib libjpeg.lib glu32.lib vfw32.lib winmm.lib libpng_st.lib zlib.lib python25.lib pthreadVSE2.lib pthreadVC2.lib libtiff.lib Half.lib Iex.lib IlmImf.lib Imath.lib IlmThread.lib avcodec-51.lib avformat-52.lib avutil-49.lib swscale-0.lib"\r
+                               AdditionalDependencies="SDL.lib freetype2ST.lib gnu_gettext.lib qtmlClient.lib openal_static.lib ws2_32.lib dxguid.lib opengl32.lib libjpeg.lib glu32.lib vfw32.lib winmm.lib libpng_st.lib zlib.lib python25.lib pthreadVSE2.lib pthreadVC2.lib libtiff.lib Half.lib Iex.lib IlmImf.lib Imath.lib IlmThread.lib avcodec-51.lib avformat-52.lib avutil-49.lib swscale-0.lib avdevice-52.lib"\r
                                ShowProgress="0"\r
                                OutputFile="..\..\bin\blender.exe"\r
                                LinkIncremental="1"\r
index d32ef98da2fc5a4304e41b080fcc3336155bab1f..4b194c83c0055ee8246cf2a418b21da9d6577dfb 100644 (file)
                                        RelativePath="..\..\..\source\blender\nodes\intern\TEX_nodes\TEX_checker.c"\r
                                        >\r
                                </File>\r
+                               <File\r
+                                       RelativePath="..\..\..\source\blender\nodes\intern\TEX_nodes\TEX_coord.c"\r
+                                       >\r
+                               </File>\r
                                <File\r
                                        RelativePath="..\..\..\source\blender\nodes\intern\TEX_nodes\TEX_curves.c"\r
                                        >\r
                                </File>\r
+                               <File\r
+                                       RelativePath="..\..\..\source\blender\nodes\intern\TEX_nodes\TEX_distance.c"\r
+                                       >\r
+                               </File>\r
                                <File\r
                                        RelativePath="..\..\..\source\blender\nodes\intern\TEX_nodes\TEX_hueSatVal.c"\r
                                        >\r
index 43e692e9bad6572cf899be6f4aabb60bed4b32ff..ab0b05c208c9fe6055448dbc09234fa45e25f95c 100644 (file)
                        <Tool\r
                                Name="VCLinkerTool"\r
                                AdditionalOptions="/MACHINE:I386&#x0D;&#x0A;"\r
-                               AdditionalDependencies="odelib.lib fmodvc.lib libbmfont.lib ws2_32.lib vfw32.lib odbc32.lib odbccp32.lib opengl32.lib glu32.lib openal_static.lib libjpeg.lib dxguid.lib libeay32.lib libpng.lib libz.lib qtmlClient.lib SDL.lib freetype2ST.lib python25_d.lib pthreadVSE2.lib pthreadVC2.lib Half.lib Iex.lib IlmImf.lib IlmThread.lib Imath.lib avcodec-51.lib avformat-52.lib avutil-49.lib swscale-0.lib"\r
+                               AdditionalDependencies="odelib.lib fmodvc.lib ws2_32.lib vfw32.lib odbc32.lib odbccp32.lib opengl32.lib glu32.lib openal_static.lib libjpeg.lib dxguid.lib libeay32.lib libpng.lib libz.lib qtmlClient.lib SDL.lib freetype2ST.lib python25_d.lib pthreadVSE2.lib pthreadVC2.lib Half.lib Iex.lib IlmImf.lib IlmThread.lib Imath.lib avcodec-51.lib avformat-52.lib avutil-49.lib swscale-0.lib"\r
                                ShowProgress="0"\r
                                OutputFile="..\..\..\..\bin\debug\blenderplayer.exe"\r
                                LinkIncremental="2"\r
                                SuppressStartupBanner="true"\r
-                               AdditionalLibraryDirectories="..\..\..\..\..\lib\windows\sdl\lib;..\..\..\..\..\lib\windows\zlib\lib;..\..\..\..\..\lib\windows\ode\lib;..\..\..\..\..\lib\windows\png\lib;..\..\..\..\..\lib\windows\jpeg\lib;..\..\..\..\..\lib\windows\fmod\lib;..\..\..\..\..\lib\windows\openal\lib;..\..\..\..\..\lib\windows\freetype\lib;..\..\..\..\..\lib\windows\openexr\lib_vs2008;..\..\..\..\..\lib\windows\python\lib\lib25_vs2008;..\..\..\..\..\lib\windows\openssl\lib;..\..\..\..\..\lib\windows\QTDevWin\Libraries;..\..\..\..\..\build\msvc_9\libs\intern\debug;..\..\..\..\..\build\msvc_9\libs\extern\debug;..\..\..\..\..\lib\windows\pthreads\lib;..\..\..\..\..\lib\windows\ffmpeg\lib"\r
+                               AdditionalLibraryDirectories="..\..\..\..\..\lib\windows\sdl\lib;..\..\..\..\..\lib\windows\zlib\lib;..\..\..\..\..\lib\windows\ode\lib;..\..\..\..\..\lib\windows\png\lib;..\..\..\..\..\lib\windows\jpeg\lib;..\..\..\..\..\lib\windows\fmod\lib;..\..\..\..\..\lib\windows\openal\lib;..\..\..\..\..\lib\windows\freetype\lib;..\..\..\..\..\lib\windows\openexr\lib_vs2008;..\..\..\..\..\lib\windows\python\lib\lib25_vs2008;..\..\..\..\..\lib\windows\openssl\lib;..\..\..\..\..\lib\windows\QTDevWin\Libraries;..\..\..\..\..\lib\windows\pthreads\lib;..\..\..\..\..\lib\windows\ffmpeg\lib"\r
                                IgnoreDefaultLibraryNames="libc.lib;libcmt.lib;msvcrt.lib;libcd.lib;msvcrtd.lib"\r
                                GenerateDebugInformation="true"\r
                                ProgramDatabaseFile="..\..\..\..\..\build\msvc_9\libs\debug\blenderplayer.pdb"\r
                        <Tool\r
                                Name="VCLinkerTool"\r
                                AdditionalOptions="/MACHINE:I386"\r
-                               AdditionalDependencies="odelib.lib fmodvc.lib libbmfont.lib ws2_32.lib vfw32.lib odbc32.lib odbccp32.lib opengl32.lib glu32.lib openal_static.lib libjpeg.lib dxguid.lib libeay32.lib libpng.lib libz.lib qtmlClient.lib SDL.lib freetype2ST.lib python25.lib pthreadVSE2.lib pthreadVC2.lib Half.lib Iex.lib IlmImf.lib IlmThread.lib Imath.lib avcodec-51.lib avformat-52.lib avutil-49.lib swscale-0.lib"\r
+                               AdditionalDependencies="odelib.lib fmodvc.lib ws2_32.lib vfw32.lib odbc32.lib odbccp32.lib opengl32.lib glu32.lib openal_static.lib libjpeg.lib dxguid.lib libeay32.lib libpng.lib libz.lib qtmlClient.lib SDL.lib freetype2ST.lib python25_d.lib pthreadVSE2.lib pthreadVC2.lib Half.lib Iex.lib IlmImf.lib IlmThread.lib Imath.lib avcodec-51.lib avformat-52.lib avutil-49.lib swscale-0.lib"\r
                                OutputFile="..\..\..\..\bin\blenderplayer.exe"\r
                                LinkIncremental="1"\r
                                SuppressStartupBanner="true"\r
-                               AdditionalLibraryDirectories="..\..\..\..\..\lib\windows\sdl\lib;..\..\..\..\..\lib\windows\zlib\lib;..\..\..\..\..\lib\windows\ode\lib;..\..\..\..\..\lib\windows\png\lib;..\..\..\..\..\lib\windows\jpeg\lib;..\..\..\..\..\lib\windows\fmod\lib;..\..\..\..\..\lib\windows\openal\lib;..\..\..\..\..\lib\windows\freetype\lib;..\..\..\..\..\lib\windows\openexr\lib_vs2008;..\..\..\..\..\lib\windows\python\lib\lib25_vs2008;..\..\..\..\..\lib\windows\openssl\lib;..\..\..\..\..\lib\windows\QTDevWin\Libraries;..\..\..\..\..\build\msvc_9\libs\intern;..\..\..\..\..\build\msvc_9\libs\extern;..\..\..\..\..\lib\windows\pthreads\lib;..\..\..\..\..\lib\windows\ffmpeg\lib"\r
+                               AdditionalLibraryDirectories="..\..\..\..\..\lib\windows\sdl\lib;..\..\..\..\..\lib\windows\zlib\lib;..\..\..\..\..\lib\windows\ode\lib;..\..\..\..\..\lib\windows\png\lib;..\..\..\..\..\lib\windows\jpeg\lib;..\..\..\..\..\lib\windows\fmod\lib;..\..\..\..\..\lib\windows\openal\lib;..\..\..\..\..\lib\windows\freetype\lib;..\..\..\..\..\lib\windows\openexr\lib_vs2008;..\..\..\..\..\lib\windows\python\lib\lib25_vs2008;..\..\..\..\..\lib\windows\openssl\lib;..\..\..\..\..\lib\windows\QTDevWin\Libraries;..\..\..\..\..\lib\windows\pthreads\lib;..\..\..\..\..\lib\windows\ffmpeg\lib"\r
                                IgnoreDefaultLibraryNames="libc.lib, msvcrt.lib, libcd.lib, libcmtd.lib, msvcrtd.lib"\r
                                ProgramDatabaseFile="..\..\..\..\..\build\msvc_9\libs\blenderplayer.pdb"\r
                                SubSystem="1"\r
index f440e2dface576b478221895a35c0be860c7118d..43a369d8f77f10377673ee62e029b67237062e8c 100644 (file)
@@ -57,6 +57,12 @@ ifeq ($(OS),$(findstring $(OS), "freebsd irix linux openbsd solaris"))
        NOPLUGINS?=true
      endif
    endif
+   # don"t build plugins on irix if using gcc
+   ifeq ($(OS), irix)
+     ifeq ($(IRIX_USE_GCC), true)
+       NOPLUGINS?=true
+     endif
+   endif
 endif
 
 ifeq ($(OS),windows)
index 6a2b290e010a5f851664d5b15c5c838440927948..2f5512e715079581cfb81cdbdb6d656c94cf80dd 100644 (file)
@@ -10,7 +10,7 @@ Tip: 'Import an AC3D (.ac) file.'
 __author__ = "Willian P. Germano"
 __url__ = ("blender", "blenderartists.org", "AC3D's homepage, http://www.ac3d.org",
        "PLib 3d gaming lib, http://plib.sf.net")
-__version__ = "2.43.1 2007-02-21"
+__version__ = "2.48.1 2009-01-11"
 
 __bpydoc__ = """\
 This script imports AC3D models into Blender.
@@ -31,6 +31,7 @@ Known issues:<br>
 Config Options:<br>
     - display transp (toggle): if "on", objects that have materials with alpha < 1.0 are shown with translucency (transparency) in the 3D View.<br>
     - subdiv (toggle): if "on", ac3d objects meant to be subdivided receive a SUBSURF modifier in Blender.<br>
+    - emis as mircol: store the emissive rgb color from AC3D as mirror color in Blender -- this is a hack to preserve the values and be able to export them using the equivalent option in the exporter.<br>
     - textures dir (string): if non blank, when imported texture paths are
 wrong in the .ac file, Blender will also look for them at this dir.
 
@@ -50,11 +51,12 @@ users can configure (see config options above).
 # --------------------------------------------------------------------------
 # Thanks: Melchior Franz for extensive bug testing and reporting, making this
 # version cope much better with old or bad .ac files, among other improvements;
-# Stewart Andreason for reporting a serious crash.
+# Stewart Andreason for reporting a serious crash; Francesco Brisa for the
+# emis as mircol functionality (w/ patch).
 # --------------------------------------------------------------------------
 # ***** BEGIN GPL LICENSE BLOCK *****
 #
-# Copyright (C) 2004-2007: Willian P. Germano, wgermano _at_ ig.com.br
+# Copyright (C) 2004-2009: Willian P. Germano, wgermano _at_ ig.com.br
 #
 # This program is free software; you can redistribute it and/or
 # modify it under the terms of the GNU General Public License
@@ -89,15 +91,19 @@ DISPLAY_TRANSP = True
 
 SUBDIV = True
 
+EMIS_AS_MIRCOL = False
+
+
 tooltips = {
        'DISPLAY_TRANSP': 'Turn transparency on in the 3d View for objects using materials with alpha < 1.0.',
        'SUBDIV': 'Apply a SUBSURF modifier to objects meant to appear subdivided.',
-       'TEXTURES_DIR': 'Additional folder to look for missing textures.'
+       'TEXTURES_DIR': 'Additional folder to look for missing textures.',
+       'EMIS_AS_MIRCOL': 'Store emis color as mirror color in Blender.'        
 }
 
 def update_registry():
-       global TEXTURES_DIR, DISPLAY_TRANSP
-       rd = dict([('tooltips', tooltips), ('TEXTURES_DIR', TEXTURES_DIR), ('DISPLAY_TRANSP', DISPLAY_TRANSP), ('SUBDIV', SUBDIV)])
+       global TEXTURES_DIR, DISPLAY_TRANSP, EMIS_AS_MIRCOL
+       rd = dict([('tooltips', tooltips), ('TEXTURES_DIR', TEXTURES_DIR), ('DISPLAY_TRANSP', DISPLAY_TRANSP), ('SUBDIV', SUBDIV), ('EMIS_AS_MIRCOL', EMIS_AS_MIRCOL)])
        Registry.SetKey('ac3d_import', rd, True)
 
 rd = Registry.GetKey('ac3d_import', True)
@@ -109,6 +115,7 @@ if rd:
                TEXTURES_DIR = rd['TEXTURES_DIR']
                DISPLAY_TRANSP = rd['DISPLAY_TRANSP']
                SUBDIV = rd['SUBDIV']
+               EMIS_AS_MIRCOL = rd['EMIS_AS_MIRCOL']
        except:
                update_registry()
 else: update_registry()
@@ -299,7 +306,7 @@ class AC3DImport:
                lines = self.lines
                line = lines[i].split()
                mat_name = ''
-               mat_col = mat_amb = mat_emit = mat_spec_col = [0,0,0]
+               mat_col = mat_amb = mat_emit = mat_spec_col = mat_mir_col = [0,0,0]
                mat_alpha = 1
                mat_spec = 1.0
 
@@ -310,11 +317,15 @@ class AC3DImport:
                        mat_amb = (v[0]+v[1]+v[2]) / 3.0
                        v = map(float,[line[11],line[12],line[13]])
                        mat_emit = (v[0]+v[1]+v[2]) / 3.0
+                       if EMIS_AS_MIRCOL:
+                               mat_emit = 0
+                               mat_mir_col = map(float,[line[11],line[12],line[13]])
+
                        mat_spec_col = map(float,[line[15],line[16],line[17]])
                        mat_spec = float(line[19]) / 64.0
                        mat_alpha = float(line[-1])
                        mat_alpha = 1 - mat_alpha
-                       self.mlist.append([mat_name, mat_col, mat_amb, mat_emit, mat_spec_col, mat_spec, mat_alpha])
+                       self.mlist.append([mat_name, mat_col, mat_amb, mat_emit, mat_spec_col, mat_spec, mat_mir_col, mat_alpha])
                        i += 1
                        line = lines[i].split()
 
@@ -590,7 +601,8 @@ class AC3DImport:
                        m.emit = mat[3]
                        m.specCol = (mat[4][0], mat[4][1], mat[4][2])
                        m.spec = mat[5]
-                       m.alpha = mat[6]
+                       m.mirCol = (mat[6][0], mat[6][1], mat[6][2])
+                       m.alpha = mat[7]
                        if m.alpha < 1.0:
                                m.mode |= MAT_MODE_ZTRANSP
                                has_transp_mats = True
index 58e9e2b1d02b62c8947134627233da14959ab2f8..1685582846028fa718b39dbf6f57ff2e9af069f0 100644 (file)
@@ -155,7 +155,7 @@ usrObjectNamePrefix= ""
 # if that armature had bones (spine, neck, arm) and the bone prefix was "a."
 #  the bones and IPO curves will be (a.spine, a.neck, a.arm)
 
-R2D = 18/3.1415  # radian to grad
+R2D = 18/3.141592653589793  # radian to grad
 BLENDER_VERSION = Blender.Get('version')
 
 # Gets the current scene, there can be many scenes in 1 blend file. 
index 2c342ddec39ceab2fad1098397a826b8a42f3801..504e4ee29ba6fe7118e99f3c8a1a212a1b03c533 100644 (file)
@@ -79,7 +79,7 @@ def addSlash(path):
        return path + sys.sep
 
 
-def comprehensiveImageLoad(imagePath, filePath, PLACE_HOLDER= True, RECURSIVE=True, VERBOSE=False):
+def comprehensiveImageLoad(imagePath, filePath, PLACE_HOLDER= True, RECURSIVE=True, VERBOSE=False, CONVERT_CALLBACK=None):
        '''
        imagePath: The image filename
                If a path precedes it, this will be searched as well.
@@ -93,13 +93,30 @@ def comprehensiveImageLoad(imagePath, filePath, PLACE_HOLDER= True, RECURSIVE=Tr
        
        RECURSIVE: If True, directories will be recursivly searched.
                Be carefull with this if you have files in your root directory because it may take a long time.
+       
+       CASE_INSENSITIVE: for non win32 systems, find the correct case for the file.
+       
+       CONVERT_CALLBACK: a function that takes an existing path and returns a new one.
+               Use this when loading image formats blender may not support, the CONVERT_CALLBACK
+               can take the path for a GIF (for example), convert it to a PNG and return the PNG's path.
+               For formats blender can read, simply return the path that is given.
        '''
        
+       # VERBOSE = True
+       
        if VERBOSE: print 'img:', imagePath, 'file:', filePath
+       
+       if os == None and CASE_INSENSITIVE:
+               CASE_INSENSITIVE = True
+       
        # When we have the file load it with this. try/except niceness.
        def imageLoad(path):
                #if path.endswith('\\') or path.endswith('/'):
                #       raise 'INVALID PATH'
+               
+               if CONVERT_CALLBACK:
+                       path = CONVERT_CALLBACK(path)
+               
                try:
                        img = bpy.data.images.new(filename=path)
                        if VERBOSE: print '\t\tImage loaded "%s"' % path
index 27736b4169e41d1157f51b469f85433c7b9df7f7..bfa1dcc3c615716f088ceeafef8cf9f44270eaaa 100644 (file)
@@ -225,15 +225,5 @@ from math import pi, sin, cos, sqrt
 
 def angleToLength(angle):
        # Alredy accounted for
-       if angle < 0.000001:
-               return 1.0
-       
-       angle = 2*pi*angle/360
-       x,y = cos(angle), sin(angle)
-       # print "YX", x,y
-       # 0 d is hoz to the right.
-       # 90d is vert upward.
-       fac=1/x
-       x=x*fac
-       y=y*fac
-       return sqrt((x*x)+(y*y))
+       if angle < 0.000001:    return 1.0
+       else:                                   return abs(1.0 / cos(pi*angle/180));
index 415c2a12c6972374f7a5542859645054405549f4..6bbfaa463d0e835ef82815e1febf2bda22abbd54 100644 (file)
@@ -479,7 +479,7 @@ def pickMeshRayFaceWeight(me, orig, rdir):
        
        w0 = (l1+l2)
        w1 = (l0+l2)
-       w2 = (l1+l2)
+       w2 = (l1+l0)
        
        totw= w0 + w1 + w2
        w0=w0/totw
index 594264fad847b04d6d4c50274adf229be3b547a3..a2d2120ebff8619063bb60ee8a3567ac99f9b628 100644 (file)
@@ -12,3 +12,63 @@ def cleanName(name):
        for ch in invalid:      name = name.replace(ch, '_')
        return name
 
+def caseInsensitivePath(path, RET_FOUND=False):
+       '''
+       Get a case insensitive path on a case sensitive system
+       
+       RET_FOUND is for internal use only, to avoid too many calls to os.path.exists
+       # Example usage
+       getCaseInsensitivePath('/hOmE/mE/sOmEpAtH.tXt')
+       '''
+       import os # todo, what happens with no os?
+       
+       if os==None:
+               if RET_FOUND:   ret = path, True
+               else:                   ret = path
+               return ret
+       
+       if path=='' or os.path.exists(path):
+               if RET_FOUND:   ret = path, True
+               else:                   ret = path
+               return ret
+       
+       f = os.path.basename(path) # f may be a directory or a file
+       d = os.path.dirname(path)
+       
+       suffix = ''
+       if not f: # dir ends with a slash?
+               if len(d) < len(path):
+                       suffix = path[:len(path)-len(d)]
+
+               f = os.path.basename(d)
+               d = os.path.dirname(d)
+       
+       if not os.path.exists(d):
+               d, found = caseInsensitivePath(d, True)
+               
+               if not found:
+                       if RET_FOUND:   ret = path, False
+                       else:                   ret = path
+                       return ret
+       
+       # at this point, the directory exists but not the file
+       
+       try: # we are expecting 'd' to be a directory, but it could be a file
+               files = os.listdir(d)
+       except:
+               if RET_FOUND:   ret = path, False
+               else:                   ret = path
+
+       f_low = f.lower()
+       
+       try:    f_nocase = [fl for fl in files if fl.lower() == f_low][0]
+       except: f_nocase = None
+       
+       if f_nocase:
+               if RET_FOUND:   ret = os.path.join(d, f_nocase) + suffix, True
+               else:                   ret = os.path.join(d, f_nocase) + suffix
+               return ret
+       else:
+               if RET_FOUND:   ret = path, False
+               else:                   ret = path
+               return ret # cant find the right one, just return the path as is.
\ No newline at end of file
index 5c63e7f5bf5683563a92dd6d30af35530ca9869a..96caa50cc416af9d777c644f8c1f7bb7a0dc0349 100644 (file)
@@ -1,10 +1,10 @@
 #dxfLibrary.py : provides functions for generating DXF files
 # --------------------------------------------------------------------------
-__version__ = "v1.27beta - 2008.10.05"
-__author__  = "Stani Michiels(Stani), Remigiusz Fiedler(migius)"
+__version__ = "v1.28beta - 2008.12.13"
+__author__ = "Stani Michiels(Stani), Remigiusz Fiedler(migius)"
 __license__ = "GPL"
-__url__         = "http://wiki.blender.org/index.php/Scripts/Manual/Export/autodesk_dxf"
-__bpydoc__ ="""The script exports geometry data to DXF format r12 version.
+__url__ = "http://wiki.blender.org/index.php/Scripts/Manual/Export/autodesk_dxf"
+__bpydoc__ ="""The library to export geometry data to DXF format r12 version.
 
 Copyright %s
 Version %s
@@ -12,15 +12,17 @@ License %s
 Homepage %s
 
 See the homepage for documentation.
-url:
+Dedicated thread on BlenderArtists: http://blenderartists.org/forum/showthread.php?t=136439
 
 IDEAs:
 -
-               
+
 TODO:
--
+- add support for SPLINEs
 
 History
+v1.28 - 2008.12.13 by Steeve/BlenderArtists
+- bugfix for EXTMIN/EXTMAX to suit Cycas-CAD
 v1.27 - 2008.10.07 by migius
 - beautifying output code: keys whitespace prefix
 - refactoring DXF-strings format: NewLine moved to the end of
@@ -154,56 +156,56 @@ BYBLOCK=0
 BYLAYER=256
 
 #---block-type flags (bit coded values, may be combined):
-ANONYMOUS                         =1  # This is an anonymous block generated by hatching, associative dimensioning, other internal operations, or an application
+ANONYMOUS =1  # This is an anonymous block generated by hatching, associative dimensioning, other internal operations, or an application
 NON_CONSTANT_ATTRIBUTES =2  # This block has non-constant attribute definitions (this bit is not set if the block has any attribute definitions that are constant, or has no attribute definitions at all)
-XREF                                   =4  # This block is an external reference (xref)
-XREF_OVERLAY                   =8  # This block is an xref overlay
-EXTERNAL                               =16 # This block is externally dependent
-RESOLVED                               =32 # This is a resolved external reference, or dependent of an external reference (ignored on input)
-REFERENCED                       =64 # This definition is a referenced external reference (ignored on input)
+XREF =4  # This block is an external reference (xref)
+XREF_OVERLAY =8  # This block is an xref overlay
+EXTERNAL =16 # This block is externally dependent
+RESOLVED =32 # This is a resolved external reference, or dependent of an external reference (ignored on input)
+REFERENCED =64 # This definition is a referenced external reference (ignored on input)
 
 #---mtext flags
 #attachment point
-TOP_LEFT               = 1
-TOP_CENTER       = 2
-TOP_RIGHT         = 3
-MIDDLE_LEFT     = 4
-MIDDLE_CENTER   = 5
+TOP_LEFT = 1
+TOP_CENTER = 2
+TOP_RIGHT = 3
+MIDDLE_LEFT = 4
+MIDDLE_CENTER = 5
 MIDDLE_RIGHT   = 6
-BOTTOM_LEFT     = 7
-BOTTOM_CENTER   = 8
-BOTTOM_RIGHT   = 9
+BOTTOM_LEFT = 7
+BOTTOM_CENTER = 8
+BOTTOM_RIGHT = 9
 #drawing direction
-LEFT_RIGHT       = 1
-TOP_BOTTOM       = 3
-BY_STYLE               = 5 #the flow direction is inherited from the associated text style
+LEFT_RIGHT = 1
+TOP_BOTTOM = 3
+BY_STYLE = 5 #the flow direction is inherited from the associated text style
 #line spacing style (optional):
-AT_LEAST               = 1 #taller characters will override
-EXACT             = 2 #taller characters will not override
+AT_LEAST = 1 #taller characters will override
+EXACT = 2 #taller characters will not override
 
 #---polyline flags
-CLOSED                                   =1      # This is a closed polyline (or a polygon mesh closed in the M direction)
-CURVE_FIT                                 =2     # Curve-fit vertices have been added
-SPLINE_FIT                               =4      # Spline-fit vertices have been added
-POLYLINE_3D                             =8       # This is a 3D polyline
-POLYGON_MESH                           =16      # This is a 3D polygon mesh
-CLOSED_N                                       =32      # The polygon mesh is closed in the N direction
-POLYFACE_MESH                     =64   # The polyline is a polyface mesh
-CONTINOUS_LINETYPE_PATTERN  =128       # The linetype pattern is generated continuously around the vertices of this polyline
+CLOSED =1        # This is a closed polyline (or a polygon mesh closed in the M direction)
+CURVE_FIT =2     # Curve-fit vertices have been added
+SPLINE_FIT =4    # Spline-fit vertices have been added
+POLYLINE_3D =8   # This is a 3D polyline
+POLYGON_MESH =16        # This is a 3D polygon mesh
+CLOSED_N =32    # The polygon mesh is closed in the N direction
+POLYFACE_MESH =64       # The polyline is a polyface mesh
+CONTINOUS_LINETYPE_PATTERN =128        # The linetype pattern is generated continuously around the vertices of this polyline
 
 #---text flags
 #horizontal
-LEFT           = 0
-CENTER   = 1
-RIGHT     = 2
-ALIGNED         = 3 #if vertical alignment = 0
-MIDDLE   = 4 #if vertical alignment = 0
-FIT             = 5 #if vertical alignment = 0
+LEFT = 0
+CENTER = 1
+RIGHT = 2
+ALIGNED = 3 #if vertical alignment = 0
+MIDDLE = 4 #if vertical alignment = 0
+FIT = 5 #if vertical alignment = 0
 #vertical
-BASELINE       = 0
-BOTTOM   = 1
-MIDDLE   = 2
-TOP             = 3
+BASELINE = 0
+BOTTOM = 1
+MIDDLE = 2
+TOP = 3
 
 ####3) Classes
 #---entitities -----------------------------------------------
@@ -239,7 +241,7 @@ class Face(_Entity):
        """3dface"""
        def __init__(self,points,**common):
                _Entity.__init__(self,**common)
-               if len(points)<4: #fix for r12 format
+               while len(points)<4: #fix for r12 format
                        points.append(points[-1])
                self.points=points
                
@@ -336,10 +338,14 @@ class PolyLine(_Entity):
 
 #-----------------------------------------------
 class Point(_Entity):
-       """Colored solid fill."""
+       """Point."""
        def __init__(self,points=None,**common):
                _Entity.__init__(self,**common)
                self.points=points
+       def __str__(self): #TODO:
+               return '  0\nPOINT\n%s%s\n' %(self._common(),
+                        _points(self.points)
+                       )
 
 #-----------------------------------------------
 class Solid(_Entity):
@@ -468,7 +474,7 @@ class Block(_Collection):
                self.name=name
                self.flag=0
                self.base=base
-       def __str__(self):
+       def __str__(self): #TODO:
                e=''.join([str(x)for x in self.entities])
                return '  0\nBLOCK\n  8\n%s\n  2\n%s\n 70\n%s\n%s\n  3\n%s\n%s  0\nENDBLK\n'%\
                           (self.layer,self.name.upper(),self.flag,_point(self.base),self.name.upper(),e)
@@ -552,11 +558,12 @@ def ViewByWindow(name,leftBottom=(0,0),rightTop=(1,1),**options):
 #-----------------------------------------------
 class Drawing(_Collection):
        """Dxf drawing. Use append or any other list methods to add objects."""
-       def __init__(self,insbase=(0.0,0.0,0.0),extmin=(0.0,0.0),extmax=(0.0,0.0),
+       def __init__(self,insbase=(0.0,0.0,0.0),extmin=(0.0,0.0,0.0),extmax=(0.0,0.0,0.0),
                                 layers=[Layer()],linetypes=[LineType()],styles=[Style()],blocks=[],
                                 views=[],entities=None,fileName='test.dxf'):
                # TODO: replace list with None,arial
-               if not entities:entities=[]
+               if not entities:
+                       entities=[]
                _Collection.__init__(self,entities)
                self.insbase=insbase
                self.extmin=extmin
@@ -680,9 +687,9 @@ def test():
        #Drawing
        d=Drawing()
        #tables
-       d.blocks.append(b)                                        #table blocks
-       d.styles.append(Style())                                #table styles
-       d.views.append(View('Normal'))            #table view
+       d.blocks.append(b)  #table blocks
+       d.styles.append(Style())  #table styles
+       d.views.append(View('Normal'))  #table view
        d.views.append(ViewByWindow('Window',leftBottom=(1,0),rightTop=(2,1)))  #idem
 
        #entities
index 3f02a71f95194f4ea63d1aa41490d1e67b791238..6f96411896430d5495d3070c6cff1820da285cb8 100644 (file)
@@ -66,8 +66,6 @@ import BPyMesh
 import BPySys
 import BPyMessages
 
-import sys
-
 ## This was used to make V, but faster not to do all that
 ##valid = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-_,.()[]{}'
 ##v = range(255)
@@ -184,7 +182,19 @@ def sane_texname(data):            return sane_name(data, sane_name_mapping_tex)
 def sane_takename(data):       return sane_name(data, sane_name_mapping_take)
 def sane_groupname(data):      return sane_name(data, sane_name_mapping_group)
 
-
+def derived_paths(fname_orig, basepath, FORCE_CWD=False):
+       '''
+       fname_orig - blender path, can be relative
+       basepath - fname_rel will be relative to this
+       FORCE_CWD - dont use the basepath, just add a ./ to the filename.
+               use when we know the file will be in the basepath.
+       '''
+       fname = Blender.sys.expandpath(fname_orig)
+       fname_strip = strip_path(fname)
+       if FORCE_CWD:   fname_rel = '.' + Blender.sys.sep + fname_strip
+       else:                           fname_rel = Blender.sys.relpath(fname, basepath)
+       if fname_rel.startswith('//'): fname_rel = '.' + Blender.sys.sep + fname_rel[2:]
+       return fname, fname_strip, fname_rel
 
 
 def mat4x4str(mat):
@@ -342,6 +352,8 @@ def write(filename, batch_objects = None, \
        
        # end batch support
        
+       # Use this for working out paths relative to the export location
+       basepath = Blender.sys.dirname(filename)
        
        # ----------------------------------------------
        # storage classes
@@ -1141,10 +1153,9 @@ def write(filename, batch_objects = None, \
                        Property: "Width", "int", "",0
                        Property: "Height", "int", "",0''')
                if tex:
-                       fname = tex.filename
-                       fname_strip = strip_path(fname)
+                       fname, fname_strip, fname_rel = derived_paths(tex.filename, basepath, EXP_IMAGE_COPY)
                else:
-                       fname = fname_strip = ''
+                       fname = fname_strip = fname_rel = ''
                
                file.write('\n\t\t\tProperty: "Path", "charptr", "", "%s"' % fname_strip)
                
@@ -1163,7 +1174,7 @@ def write(filename, batch_objects = None, \
                
                file.write('\n\t\tFilename: "%s"' % fname_strip)
                if fname_strip: fname_strip = '/' + fname_strip
-               file.write('\n\t\tRelativeFilename: "fbx%s"' % fname_strip) # make relative
+               file.write('\n\t\tRelativeFilename: "%s"' % fname_rel) # make relative
                file.write('\n\t}')
 
        
@@ -1202,13 +1213,14 @@ def write(filename, batch_objects = None, \
                }''')
                
                file.write('\n\t\tMedia: "Video::%s"' % texname)
+               
                if tex:
-                       fname = tex.filename
-                       file.write('\n\t\tFileName: "%s"' % strip_path(fname))
-                       file.write('\n\t\tRelativeFilename: "fbx/%s"' % strip_path(fname)) # need some make relative command
+                       fname, fname_strip, fname_rel = derived_paths(tex.filename, basepath, EXP_IMAGE_COPY)
                else:
-                       file.write('\n\t\tFileName: ""')
-                       file.write('\n\t\tRelativeFilename: "fbx"')
+                       fname = fname_strip = fname_rel = ''
+               
+               file.write('\n\t\tFileName: "%s"' % fname_strip)
+               file.write('\n\t\tRelativeFilename: "%s"' % fname_rel) # need some make relative command
                
                file.write('''
                ModelUVTranslation: 0,0
@@ -1434,13 +1446,13 @@ def write(filename, batch_objects = None, \
                                for f in me.faces:
                                        for col in f.col:
                                                if i==-1:
-                                                       file.write('%i,%i,%i' % (col[0], col[1], col[2]))
+                                                       file.write('%i,%i,%i,255' % (col[0], col[1], col[2]))
                                                        i=0
                                                else:
                                                        if i==7:
                                                                file.write('\n\t\t\t\t')
                                                                i=0
-                                                       file.write(',%i,%i,%i' % (col[0], col[1], col[2]))
+                                                       file.write(',%i,%i,%i,255' % (col[0], col[1], col[2]))
                                                i+=1
                                                ii+=1 # One more Color
                                
@@ -2658,7 +2670,7 @@ Takes:  {''')
        
        # copy images if enabled
        if EXP_IMAGE_COPY:
-               copy_images( Blender.sys.dirname(filename),  [ tex[1] for tex in textures if tex[1] != None ])  
+               copy_images( basepath,  [ tex[1] for tex in textures if tex[1] != None ])       
        
        print 'export finished in %.4f sec.' % (Blender.sys.time() - start_time)
        return True
index 484663b32b314db9234efc54fd8ce81383cbd355..9c3a24af2882c6aa5dd6167fa35c046cd2f16b46 100644 (file)
@@ -1,17 +1,17 @@
 #!BPY
 """
 Name: 'Blender/Python Scripting API'
-Blender: 244
+Blender: 248
 Group: 'Help'
 Tooltip: 'The Blender Python API reference manual'
 """
 
 __author__ = "Matt Ebb"
 __url__ = ("blender", "blenderartist")
-__version__ = "1.0"
+__version__ = "1.0.1"
 __bpydoc__ = """\
 This script opens the user's default web browser at http://www.blender.org's
-"Blenders Python API" page.
+"Blender Python API Reference" page.
 """
 
 # --------------------------------------------------------------------------
@@ -38,4 +38,4 @@ This script opens the user's default web browser at http://www.blender.org's
 
 import Blender, webbrowser
 version = str(int(Blender.Get('version')))
-webbrowser.open('http://www.blender.org/documentation/'+ version +'PythonDoc/index.html')
+webbrowser.open('http://www.blender.org/documentation/'+ version +'PythonDoc/')
index b27e266f368aa5c9ccd0d7e5614360fc83d2f179..c207a12068fb6e25f4dcc999db9785320151c712 100644 (file)
@@ -8,7 +8,7 @@ Tooltip: 'Show help information about a chosen installed script.'
 """
 
 __author__ = "Willian P. Germano"
-__version__ = "0.1 11/02/04"
+__version__ = "0.3 01/21/09"
 __email__ = ('scripts', 'Author, wgermano:ig*com*br')
 __url__ = ('blender', 'blenderartists.org')
 
@@ -47,8 +47,6 @@ Hotkeys:<br>
 # $Id$
 #
 # --------------------------------------------------------------------------
-# sysinfo.py version 0.1 Jun 09, 2004
-# --------------------------------------------------------------------------
 # ***** BEGIN GPL LICENSE BLOCK *****
 #
 # Copyright (C) 2004: Willian P. Germano, wgermano _at_ ig.com.br
@@ -69,6 +67,9 @@ Hotkeys:<br>
 #
 # ***** END GPL LICENCE BLOCK *****
 # --------------------------------------------------------------------------
+# Thanks: Brendon Murphy (suggestion) and Kevin Morgan (implementation)
+# for the "run" button; Jean-Michel Soler for pointing a parsing error
+# with multilines using triple single quotes.
 
 import Blender
 from Blender import sys as bsys, Draw, Window, Registry
@@ -355,7 +356,12 @@ def parse_pyobj(var, lines, i):
                        l = "ERROR"
 
        elif l[0] == "'":
-               if l[-1] == '\\':
+               if l[1:3] == "''": # '''
+                       if l.find("'''", 3) < 0: # multiline
+                               l2, i = parse_pyobj_close("'''", lines, i)
+                               if l[-1] == '\\': l = l[:-1]
+                               l = "%s%s" % (l, l2)
+               elif l[-1] == '\\':
                        l2, i = parse_pyobj_close("'", lines, i)
                        l = "%s%s" % (l, l2)
                elif l[-1] == "'" and l[-2] !=  '\\': # single line: '...'
@@ -543,6 +549,7 @@ BEVT_GMENU = range(100, len_gmenus + 100)
 BEVT_VIEWSOURCE = 1
 BEVT_EXIT = 2
 BEVT_BACK = 3
+BEVT_EXEC = 4  # Executes Script
 
 # gui callbacks:
 
@@ -551,7 +558,7 @@ def gui(): # drawing the screen
        global SCREEN, START_SCREEN, SCRIPT_SCREEN
        global SCRIPT_INFO, AllGroups, GROUP_MENUS
        global BEVT_EMAIL, BEVT_LINK
-       global BEVT_VIEWSOURCE, BEVT_EXIT, BEVT_BACK, BEVT_GMENU, BUT_GMENU
+       global BEVT_VIEWSOURCE, BEVT_EXIT, BEVT_BACK, BEVT_GMENU, BUT_GMENU, BEVT_EXEC
        global PADDING, WIN_W, WIN_H, SCROLL_DOWN, COLUMNS, FMODE
 
        theme = Theme.Get()[0]
@@ -674,8 +681,11 @@ def gui(): # drawing the screen
                                'View this script\'s source code in the Text Editor (hotkey: S)')
                        Draw.PushButton('exit', BEVT_EXIT, x + 45, 17, 45, bh,
                                'Exit from Scripts Help Browser (hotkey: Q)')
-                       if not FMODE: Draw.PushButton('back', BEVT_BACK, x + 2*45, 17, 45, bh,
+                       if not FMODE: 
+                               Draw.PushButton('back', BEVT_BACK, x + 2*45, 17, 45, bh,
                                'Back to scripts selection screen (hotkey: ESC)')
+                               Draw.PushButton('run script', BEVT_EXEC, x + 3*45, 17, 60, bh, 'Run this script')
+
                        BGL.glColor3ub(COL_TXTHI[0],COL_TXTHI[1], COL_TXTHI[2])
                        BGL.glRasterPos2i(x, 5)
                        Draw.Text('use the arrow keys or the mouse wheel to scroll text', 'small')
@@ -766,6 +776,14 @@ def button_event(evt): # gui button events
                        SCRIPT_INFO = None
                        SCROLL_DOWN = 0
                        Draw.Redraw()
+       elif evt == BEVT_EXEC: # Execute script
+               exec_line = ''
+               if SCRIPT_INFO.script.userdir:
+                       exec_line = bsys.join(Blender.Get('uscriptsdir'), SCRIPT_INFO.script.fname)
+               else:
+                       exec_line = bsys.join(Blender.Get('scriptsdir'), SCRIPT_INFO.script.fname)
+
+               Blender.Run(exec_line)
 
 keepon = True
 FMODE = False # called by Blender.ShowHelp(name) API function ?
index 81b002da4e49fc5b6b045067fca8dd10adae2c08..a4f6da5cc55c8cd23f204945976d445f2fd5d67b 100644 (file)
@@ -1,16 +1,16 @@
 #!BPY
 """
 Name: 'Getting Started'
-Blender: 234
+Blender: 248
 Group: 'Help'
 Tooltip: 'Help for new users'
 """
 
 __author__ = "Matt Ebb"
 __url__ = ("blender", "blenderartists.org")
-__version__ = "1.0"
+__version__ = "1.0.1"
 __bpydoc__ = """\
-This script opens the user's default web browser at www.blender3d.org's
+This script opens the user's default web browser at www.blender.org's
 "Getting Started" page.
 """
 
@@ -39,5 +39,4 @@ This script opens the user's default web browser at www.blender3d.org's
 # --------------------------------------------------------------------------
 
 import Blender, webbrowser
-version = str(Blender.Get('version'))
-webbrowser.open('http://www.blender3d.org/Help/?pg=GettingStarted&ver=' + version)
+webbrowser.open('http://www.blender.org/education-help/tutorials/getting-started/')
index cf293bf7c2cac10b73bf2be6144cbf765f33977a..b830975e593906ce00d772aad530005ff00059ce 100644 (file)
@@ -1,17 +1,17 @@
 #!BPY
 """
 Name: 'Manual'
-Blender: 234
+Blender: 248
 Group: 'Help'
-Tooltip: 'The Blender reference manual'
+Tooltip: 'The Blender Wiki manual'
 """
 
 __author__ = "Matt Ebb"
 __url__ = ("blender", "blenderartists.org")
-__version__ = "1.0"
+__version__ = "1.0.1"
 __bpydoc__ = """\
-This script opens the user's default web browser at www.blender3d.org's
-"Blender Manual" page.
+This script opens the user's default web browser at www.blender.org's
+"Manual" page.
 """
 
 # --------------------------------------------------------------------------
@@ -37,5 +37,4 @@ This script opens the user's default web browser at www.blender3d.org's
 # --------------------------------------------------------------------------
 
 import Blender, webbrowser
-version = str(Blender.Get('version'))
-webbrowser.open('http://www.blender3d.org/Help/?pg=Manual&ver=' + version)
+webbrowser.open('http://wiki.blender.org/index.php/Manual')
index af7a70424895de59afab25b9e4076df432a02809..919ec72da3cad16e337e3a18ff9c57dcc5a1e9ed 100644 (file)
@@ -1,17 +1,17 @@
 #!BPY
 """
-Name: 'Release Notes'
-Blender: 234
+Name: 'Release Logs'
+Blender: 248
 Group: 'Help'
 Tooltip: 'Information about the changes in this version of Blender'
 """
 
 __author__ = "Matt Ebb"
 __url__ = ("blender", "blenderartists.org")
-__version__ = "1.0"
+__version__ = "1.0.1"
 __bpydoc__ = """\
-This script opens the user's default web browser at www.blender3d.org's
-"Release Notes" page.
+This script opens the user's default web browser at www.blender.org's
+"Release Logs" page.
 """
 
 # --------------------------------------------------------------------------
@@ -37,5 +37,5 @@ This script opens the user's default web browser at www.blender3d.org's
 # --------------------------------------------------------------------------
 
 import Blender, webbrowser
-version = str(Blender.Get('version'))
-webbrowser.open('http://www.blender3d.org/Help/?pg=ReleaseNotes&ver=' + version)
+
+webbrowser.open('http://www.blender.org/development/release-logs/')
index 04d6c79945562c21f505314d502eab111a765448..1fe466560f0bb0032eadf499500cd16e4c67e9fd 100644 (file)
@@ -2,17 +2,17 @@
 
 """
 Name: 'Tutorials'
-Blender: 234
+Blender: 248
 Group: 'Help'
 Tooltip: 'Tutorials for learning to use Blender'
 """
 
 __author__ = "Matt Ebb"
 __url__ = ("blender", "blenderartists.org")
-__version__ = "1.0"
+__version__ = "1.0.1"
 __bpydoc__ = """\
-This script opens the user's default web browser at www.blender3d.org's
-"Blender Tutorials" page.
+This script opens the user's default web browser at www.blender.org's
+"Tutorials" page.
 """
 
 # --------------------------------------------------------------------------
@@ -38,5 +38,4 @@ This script opens the user's default web browser at www.blender3d.org's
 # --------------------------------------------------------------------------
 
 import Blender, webbrowser
-version = str(Blender.Get('version'))
-webbrowser.open('http://www.blender3d.org/Help/?pg=Tutorials&ver=' + version)
+webbrowser.open('http://www.blender.org/education-help/tutorials/')
index 0f9e32dea0eda27cbd3de3e4498b8ceadc679195..db0a78d90f758ff07f1ae6c2986ab2cb248c0118 100644 (file)
@@ -2,17 +2,17 @@
 
 """
 Name: 'Blender Website'
-Blender: 234
+Blender: 248
 Group: 'HelpWebsites'
 Tooltip: 'The official Blender website'
 """
 
 __author__ = "Matt Ebb"
 __url__ = ("blender", "blenderartists.org")
-__version__ = "1.0"
+__version__ = "1.0.1"
 __bpydoc__ = """\
 This script opens the user's default web browser at Blender's main site,
-www.blender3d.org.
+www.blender.org.
 """
 
 
@@ -39,4 +39,4 @@ www.blender3d.org.
 # --------------------------------------------------------------------------
 
 import Blender, webbrowser
-webbrowser.open('http://www.blender3d.org/')
+webbrowser.open('http://www.blender.org/')
index 344622cc11375bfb50bd45ebe2a74e1fbcca38e9..e04a54501f7bf68ef1db5a3f316172e7b778574e 100644 (file)
@@ -2,17 +2,17 @@
 
 """
 Name: 'Developer Community'
-Blender: 234
+Blender: 248
 Group: 'HelpWebsites'
 Tooltip: 'Get involved with Blender development'
 """
 
 __author__ = "Matt Ebb"
 __url__ = ("blender", "blenderartists.org")
-__version__ = "1.0"
+__version__ = "1.0.1"
 __bpydoc__ = """\
-This script opens the user's default web browser at www.blender.org, the
-Blender development portal.
+This script opens the user's default web browser at www.blender.org's
+"Get Involved" page.
 """
 
 # --------------------------------------------------------------------------
@@ -38,4 +38,4 @@ Blender development portal.
 # --------------------------------------------------------------------------
 
 import webbrowser
-webbrowser.open('http://www.blender.org')
+webbrowser.open('http://www.blender.org/community/get-involved/')
index 451fd7351508f7daf7f4c39401ad1c9d919a4f6b..c33849ac41912631482416e5a6224ffea61ec4a1 100644 (file)
@@ -2,16 +2,16 @@
 
 """
 Name: 'Blender E-Shop'
-Blender: 234
+Blender: 248
 Group: 'HelpWebsites'
 Tooltip: 'Buy official Blender resources and merchandise online'
 """
 
 __author__ = "Matt Ebb"
 __url__ = ("blender", "blenderartists.org")
-__version__ = "1.0"
+__version__ = "1.0.1"
 __bpydoc__ = """\
-This script opens the user's default web browser at www.blender3d.org's
+This script opens the user's default web browser at www.blender.org's
 "E-Shop" section.
 """
 
index fbe19956eb770a2dda22f37aa2f946f9b395cf9f..a77a2bb9fefcadbd15dbda1f98ba3ed550e78285 100644 (file)
@@ -2,16 +2,16 @@
 
 """
 Name: 'User Community'
-Blender: 234
+Blender: 248
 Group: 'HelpWebsites'
 Tooltip: 'Get involved with other Blender users'
 """
 
 __author__ = "Matt Ebb"
 __url__ = ("blender", "blenderartists.org")
-__version__ = "1.0"
+__version__ = "1.0.1"
 __bpydoc__ = """\
-This script opens the user's default web browser at www.blender3d.org's
+This script opens the user's default web browser at www.blender.org's
 "User Community" page.
 """
 
@@ -38,4 +38,4 @@ This script opens the user's default web browser at www.blender3d.org's
 # --------------------------------------------------------------------------
 
 import webbrowser
-webbrowser.open('http://www.blender3d.org/Community')
+webbrowser.open('http://www.blender.org/community/user-community/')
index 9447f15fb79b2b55c34603782d87c42dcd4158f7..28bc1a40ef080c67a9fd9ae38f698d9b87c864d2 100755 (executable)
@@ -36,6 +36,8 @@ __bpydoc__ = """\
 This script is an importer for the X3D and VRML97 file formats.
 """
 
+DEBUG = False
+
 # This should work without a blender at all
 try:
        from Blender.sys import exists
@@ -48,6 +50,27 @@ def baseName(path):
 def dirName(path):
        return path[:-len(baseName(path))]
 
+def imageConvertCompat(path):
+       
+       try:             import os
+       except:          return path
+       if os.sep=='\\': return path # assime win32 has quicktime, dont convert
+       
+       if path.lower().endswith('.gif'):
+               path_to = path[:-3] + 'png'
+               
+               '''
+               if exists(path_to):
+                       return path_to
+               '''
+               # print '\n'+path+'\n'+path_to+'\n'
+               os.system('convert "%s" "%s"' % (path, path_to)) # for now just hope we have image magick
+               
+               if exists(path_to):
+                       return path_to
+       
+       return path
+
 # notes
 # transform are relative 
 # order dosnt matter for loc/size/rot
@@ -78,6 +101,7 @@ def vrmlFormat(data):
                        return l
                
                # Most cases accounted for! if we have a comment at the end of the line do this...
+               #j = l.find('url "')
                j = l.find('"')
                
                if j == -1: # simple no strings
@@ -96,7 +120,39 @@ def vrmlFormat(data):
        
        data = '\n'.join([strip_comment(l) for l in data.split('\n') ]) # remove all whitespace
        
+       EXTRACT_STRINGS = True # only needed when strings or filesnames containe ,[]{} chars :/
+       
+       if EXTRACT_STRINGS:
                
+               # We need this so we can detect URL's
+               data = '\n'.join([' '.join(l.split()) for l in data.split('\n')]) # remove all whitespace
+               
+               string_ls = []
+               
+               #search = 'url "'
+               search = '"'
+               
+               ok = True
+               last_i = 0
+               while ok:
+                       ok = False
+                       i = data.find(search, last_i)
+                       if i != -1:
+                               
+                               start = i + len(search) # first char after end of search
+                               end = data.find('"', start)
+                               if end != -1:
+                                       item = data[start:end]
+                                       string_ls.append( item )
+                                       data = data[:start] + data[end:]
+                                       ok = True # keep looking
+                                       
+                                       last_i = (end - len(item)) + 1
+                                       # print last_i, item, '|' + data[last_i] + '|'
+               
+       # done with messy extracting strings part
+       
+       
        # Bad, dont take strings into account
        '''
        data = data.replace('#', '\n#')
@@ -108,6 +164,28 @@ def vrmlFormat(data):
        data = data.replace(']', '\n]\n')
        data = data.replace(',', ' , ') # make sure comma's seperate
        
+       if EXTRACT_STRINGS:
+               # add strings back in 
+               
+               search = '"' # fill in these empty strings
+               
+               ok = True
+               last_i = 0
+               while ok:
+                       ok = False
+                       i = data.find(search + '"', last_i)
+                       # print i
+                       if i != -1:
+                               start = i + len(search) # first char after end of search
+                               item = string_ls.pop(0)
+                               # print item
+                               data = data[:start] + item + data[start:]
+                               
+                               last_i = start + len(item) + 1
+                               
+                               ok = True
+       
+       
        # More annoying obscure cases where USE or DEF are placed on a newline
        # data = data.replace('\nDEF ', ' DEF ')
        # data = data.replace('\nUSE ', ' USE ')
@@ -125,6 +203,7 @@ def vrmlFormat(data):
 NODE_NORMAL = 1 # {}
 NODE_ARRAY = 2 # []
 NODE_REFERENCE = 3 # USE foobar
+# NODE_PROTO = 4 #
 
 lines = []
 
@@ -135,6 +214,10 @@ def getNodePreText(i, words):
                
                if i>=len(lines):
                        break
+                       '''
+               elif lines[i].startswith('PROTO'):
+                       return NODE_PROTO, i+1
+                       '''
                elif lines[i]=='{':
                        # words.append(lines[i]) # no need
                        # print "OK"
@@ -168,6 +251,23 @@ def is_nodeline(i, words):
        if not lines[i][0].isalpha():
                return 0, 0
        
+       #if lines[i].startswith('field'):
+       #       return 0, 0
+       
+       # Is this a prototype??
+       if lines[i].startswith('PROTO'):
+               words[:] = lines[i].split()
+               return NODE_NORMAL, i+1 # TODO - assumes the next line is a '[\n', skip that
+       if lines[i].startswith('EXTERNPROTO'):
+               words[:] = lines[i].split()
+               return NODE_ARRAY, i+1 # TODO - assumes the next line is a '[\n', skip that
+       
+       '''
+       proto_type, new_i = is_protoline(i, words, proto_field_defs)
+       if new_i != -1:
+               return proto_type, new_i
+       '''
+       
        # Simple "var [" type
        if lines[i+1] == '[':
                if lines[i].count('"') % 2 == 0:
@@ -177,6 +277,7 @@ def is_nodeline(i, words):
        node_type, new_i = getNodePreText(i, words)
        
        if not node_type:
+               if DEBUG: print "not node_type", lines[i]
                return 0, 0
        
        # Ok, we have a { after some values
@@ -199,21 +300,46 @@ def is_numline(i):
        '''
        Does this line start with a number?
        '''
+       
+       # Works but too slow.
+       '''
+       l = lines[i]
+       for w in l.split():
+               if w==',':
+                       pass
+               else:
+                       try:
+                               float(w)
+                               return True
+                       
+                       except:
+                               return False
+       
+       return False
+       '''
+       
        l = lines[i]
+       
+       line_start = 0
+       
+       if l.startswith(', '):
+               line_start += 2
+       
        line_end = len(l)-1
-       line_end_new = l.find(' ') # comma's always have a space before them
+       line_end_new = l.find(' ', line_start) # comma's always have a space before them
        
        if line_end_new != -1:
                line_end = line_end_new
        
        try:
-               float(l[:line_end]) # works for a float or int
+               float(l[line_start:line_end]) # works for a float or int
                return True
        except:
                return False
 
+
 class vrmlNode(object):
-       __slots__ = 'id', 'fields', 'node_type', 'parent', 'children', 'parent', 'array_data', 'reference', 'lineno', 'filename', 'blendObject', 'DEF_NAMESPACE', 'FIELD_NAMESPACE', 'x3dNode'
+       __slots__ = 'id', 'fields', 'proto_node', 'proto_field_defs', 'proto_fields', 'node_type', 'parent', 'children', 'parent', 'array_data', 'reference', 'lineno', 'filename', 'blendObject', 'DEF_NAMESPACE', 'ROUTE_IPO_NAMESPACE', 'PROTO_NAMESPACE', 'x3dNode'
        def __init__(self, parent, node_type, lineno):
                self.id = None
                self.node_type = node_type
@@ -228,10 +354,17 @@ class vrmlNode(object):
                # This is only set from the root nodes.
                # Having a filename also denotes a root node
                self.filename = None
+               self.proto_node = None # proto field definition eg: "field SFColor seatColor .6 .6 .1"
                
                # Store in the root node because each inline file needs its own root node and its own namespace
                self.DEF_NAMESPACE = None 
+               self.ROUTE_IPO_NAMESPACE = None 
+               '''
                self.FIELD_NAMESPACE = None
+               '''
+               
+               
+               self.PROTO_NAMESPACE = None
                
                self.reference = None
                
@@ -241,28 +374,52 @@ class vrmlNode(object):
                        return 
                
                self.fields = [] # fields have no order, in some cases rool level values are not unique so dont use a dict
+               
+               self.proto_field_defs = [] # proto field definition eg: "field SFColor seatColor .6 .6 .1"
+               self.proto_fields = [] # proto field usage "diffuseColor IS seatColor"
                self.children = []
                self.array_data = [] # use for arrays of data - should only be for NODE_ARRAY types
                
        
        # Only available from the root node
+       '''
        def getFieldDict(self):
                if self.FIELD_NAMESPACE != None:
                        return self.FIELD_NAMESPACE
                else:
                        return self.parent.getFieldDict()
+       '''
+       def getProtoDict(self):
+               if self.PROTO_NAMESPACE != None:
+                       return self.PROTO_NAMESPACE
+               else:
+                       return self.parent.getProtoDict()
        
        def getDefDict(self):
                if self.DEF_NAMESPACE != None:
                        return self.DEF_NAMESPACE
                else:
                        return self.parent.getDefDict()
+                       
+       def getRouteIpoDict(self):
+               if self.ROUTE_IPO_NAMESPACE != None:
+                       return self.ROUTE_IPO_NAMESPACE
+               else:
+                       return self.parent.getRouteIpoDict()
        
        def setRoot(self, filename):
                self.filename = filename
-               self.FIELD_NAMESPACE =  {}
-               self.DEF_NAMESPACE=             {}
-               
+               # self.FIELD_NAMESPACE =                {}
+               self.DEF_NAMESPACE =            {}
+               self.ROUTE_IPO_NAMESPACE =      {}
+               self.PROTO_NAMESPACE =          {}
+       
+       def isRoot(self):
+               if self.filename == None:
+                       return False
+               else:
+                       return True
+       
        def getFilename(self):
                if self.filename:
                        return self.filename
@@ -284,15 +441,36 @@ class vrmlNode(object):
                except:
                        return None
        
-       def getDefName(self):
+       def findSpecRecursive(self, spec):
                self_real = self.getRealNode()
+               if spec == self_real.getSpec():
+                       return self
                
-               if 'DEF' in self_real.id:
-                       # print self_real.id
-                       return self_real.id[ list(self_real.id).index('DEF')+1 ]
-               else:
-                       return None
+               for child in self_real.children:
+                       if child.findSpecRecursive(spec):
+                               return child
+               
+               return None
+       
+       def getPrefix(self):
+               if self.id:
+                       return self.id[0]
+               return None
+       
+       def getSpecialTypeName(self, typename):
+               self_real = self.getRealNode()
+               try:            return self_real.id[ list(self_real.id).index(typename)+1 ]
+               except: return None
+       
+       
+       def getDefName(self):
+               return self.getSpecialTypeName('DEF')
+       
+       def getProtoName(self):
+               return self.getSpecialTypeName('PROTO')
                
+       def getExternprotoName(self):
+               return self.getSpecialTypeName('EXTERNPROTO')
        
        def getChildrenBySpec(self, node_spec): # spec could be Transform, Shape, Appearance
                self_real = self.getRealNode()
@@ -329,7 +507,26 @@ class vrmlNode(object):
                ancestry.append(self)
                for child in self.getRealNode().children:
                        if child not in ancestry:
-                               child.getSerialized(results, ancestry)
+                               # We dont want to load proto's, they are only references
+                               # We could enforce this elsewhere
+                               
+                               # Only add this in a very special case
+                               # where the parent of this object is not the real parent
+                               # - In this case we have added the proto as a child to a node instancing it.
+                               # This is a bit arbitary, but its how Proto's are done with this importer.
+                               if child.getProtoName() == None and child.getExternprotoName() == None:
+                                       child.getSerialized(results, ancestry)
+                               else:
+                                       
+                                       if DEBUG: print 'getSerialized() is proto:', child.getProtoName(), child.getExternprotoName(), self.getSpec()
+                                       
+                                       self_spec = self.getSpec()
+                                       
+                                       if child.getProtoName() == self_spec or child.getExternprotoName() == self_spec:
+                                               if DEBUG: "FoundProto!"
+                                               child.getSerialized(results, ancestry)
+                                       
+                                       
                
                return results
                
@@ -342,7 +539,7 @@ class vrmlNode(object):
                        child.searchNodeTypeID(node_spec, results)
                return results
        
-       def getFieldName(self, field):
+       def getFieldName(self, field, ancestry, AS_CHILD=False):
                self_real = self.getRealNode() # incase we're an instance
                
                for f in self_real.fields:
@@ -350,14 +547,81 @@ class vrmlNode(object):
                        if f and f[0] == field:
                                # print '\tfound field', f
                                
-                               return f[1:]
+                               if len(f)>=3 and f[1] == 'IS': # eg: 'diffuseColor IS legColor'
+                                       field_id = f[2]
+                                       
+                                       # print "\n\n\n\n\n\nFOND IS!!!"
+                                       f_proto_lookup = None
+                                       f_proto_child_lookup = None
+                                       i = len(ancestry)
+                                       while i:
+                                               i -= 1
+                                               node = ancestry[i]
+                                               node = node.getRealNode()
+                                               
+                                               # proto settings are stored in "self.proto_node"
+                                               if node.proto_node: 
+                                                       # Get the default value from the proto, this can be overwridden by the proto instace
+                                                       # 'field SFColor legColor .8 .4 .7'
+                                                       if AS_CHILD:
+                                                               for child in node.proto_node.children:
+                                                                       #if child.id  and  len(child.id) >= 3  and child.id[2]==field_id:
+                                                                       if child.id and ('point' in child.id or 'points' in child.id):
+                                                                               f_proto_child_lookup = child
+                                                       
+                                                       else:
+                                                               for f_def in node.proto_node.proto_field_defs:
+                                                                       if len(f_def) >= 4:
+                                                                               if f_def[0]=='field' and f_def[2]==field_id:
+                                                                                       f_proto_lookup = f_def[3:]
+                                               
+                                               # Node instance, Will be 1 up from the proto-node in the ancestry list. but NOT its parent.
+                                               # This is the setting as defined by the instance, including this setting is optional,
+                                               # and will override the default PROTO value 
+                                               # eg: 'legColor 1 0 0'
+                                               if AS_CHILD:
+                                                       for child in node.children:
+                                                               if child.id and child.id[0]==field_id:
+                                                                       f_proto_child_lookup = child
+                                               else:
+                                                       for f_def in node.fields:
+                                                               if len(f_def) >= 2:
+                                                                       if f_def[0]==field_id:
+                                                                               if DEBUG: print "getFieldName(), found proto", f_def
+                                                                               f_proto_lookup = f_def[1:]
+                                               
+                                       
+                                       if AS_CHILD:
+                                               if f_proto_child_lookup:
+                                                       if DEBUG:
+                                                               print "getFieldName() - AS_CHILD=True, child found"
+                                                               print f_proto_child_lookup
+                                               return f_proto_child_lookup
+                                       else:
+                                               return f_proto_lookup
+                               else:
+                                       if AS_CHILD:
+                                               return None
+                                       else:
+                                               # Not using a proto
+                                               return f[1:]
+                                               
                # print '\tfield not found', field
+               
+               
+               # See if this is a proto name
+               if AS_CHILD:
+                       child_array = None
+                       for child in self_real.children:
+                               if child.id and len(child.id) == 1 and child.id[0] == field:
+                                       return child
+               
                return None
        
-       def getFieldAsInt(self, field, default):
+       def getFieldAsInt(self, field, default, ancestry):
                self_real = self.getRealNode() # incase we're an instance
                
-               f = self_real.getFieldName(field)
+               f = self_real.getFieldName(field, ancestry)
                if f==None:     return default
                if ',' in f: f = f[:f.index(',')] # strip after the comma
                
@@ -371,10 +635,10 @@ class vrmlNode(object):
                        print '\tvalue "%s" could not be used as an int for field "%s"' % (f[0], field)
                        return default
        
-       def getFieldAsFloat(self, field, default):
+       def getFieldAsFloat(self, field, default, ancestry):
                self_real = self.getRealNode() # incase we're an instance
                
-               f = self_real.getFieldName(field)
+               f = self_real.getFieldName(field, ancestry)
                if f==None:     return default
                if ',' in f: f = f[:f.index(',')] # strip after the comma
                
@@ -388,10 +652,10 @@ class vrmlNode(object):
                        print '\tvalue "%s" could not be used as a float for field "%s"' % (f[0], field)
                        return default
        
-       def getFieldAsFloatTuple(self, field, default):
+       def getFieldAsFloatTuple(self, field, default, ancestry):
                self_real = self.getRealNode() # incase we're an instance
                
-               f = self_real.getFieldName(field)
+               f = self_real.getFieldName(field, ancestry)
                if f==None:     return default
                # if ',' in f: f = f[:f.index(',')] # strip after the comma
                
@@ -412,10 +676,10 @@ class vrmlNode(object):
                        print '\tvalue "%s" could not be used as a float tuple for field "%s"' % (f, field)
                        return default
        
-       def getFieldAsBool(self, field, default):
+       def getFieldAsBool(self, field, default, ancestry):
                self_real = self.getRealNode() # incase we're an instance
                
-               f = self_real.getFieldName(field)
+               f = self_real.getFieldName(field, ancestry)
                if f==None:     return default
                if ',' in f: f = f[:f.index(',')] # strip after the comma
                
@@ -431,10 +695,10 @@ class vrmlNode(object):
                        print '\t"%s" could not be used as a bool for field "%s"' % (f[1], field)
                        return default
        
-       def getFieldAsString(self, field, default=None):
+       def getFieldAsString(self, field, default, ancestry):
                self_real = self.getRealNode() # incase we're an instance
                
-               f = self_real.getFieldName(field)
+               f = self_real.getFieldName(field, ancestry)
                if f==None:     return default
                if len(f) < 1:
                        print '\t"%s" wrong length for string conversion for field "%s"' % (f, field)
@@ -456,22 +720,22 @@ class vrmlNode(object):
                        print '\tvalue "%s" could not be used as a string for field "%s"' % (f[0], field)
                        return default
        
-       def getFieldAsArray(self, field, group):
+       def getFieldAsArray(self, field, group, ancestry):
                '''
                For this parser arrays are children
                '''
                self_real = self.getRealNode() # incase we're an instance
                
-               child_array = None
-               for child in self_real.children:
-                       if child.id and len(child.id) == 1 and child.id[0] == field:
-                               child_array = child
-                               break
+               child_array = self_real.getFieldName(field, ancestry, True)
                
+               #if type(child_array)==list: # happens occasionaly
+               #       array_data = child_array 
+                       
                if child_array==None:
+                       
                        # For x3d, should work ok with vrml too
                        # for x3d arrays are fields, vrml they are nodes, annoying but not tooo bad.
-                       data_split = self.getFieldName(field)
+                       data_split = self.getFieldName(field, ancestry)
                        if not data_split:
                                return []
                        array_data = ' '.join(data_split)
@@ -489,9 +753,12 @@ class vrmlNode(object):
                                        print '\tWarning, could not parse array data from field'
                                        array_data = []
                else:
-                       
+                       # print child_array
                        # Normal vrml
                        array_data = child_array.array_data
+                       
+               
+               # print 'array_data', array_data
                
                if group==-1 or len(array_data)==0:
                        return array_data
@@ -520,8 +787,6 @@ class vrmlNode(object):
                # We requested a flat array
                if group == 0:
                        return flat_array
-                       
-                       
                
                new_array = []
                sub_array = []
@@ -537,6 +802,30 @@ class vrmlNode(object):
                
                return new_array
        
+       def getFieldAsStringArray(self, field, ancestry):
+               '''
+               Get a list of strings
+               '''
+               self_real = self.getRealNode() # incase we're an instance
+               
+               child_array = None
+               for child in self_real.children:
+                       if child.id and len(child.id) == 1 and child.id[0] == field:
+                               child_array = child
+                               break
+               if not child_array:
+                       return []
+               
+               # each string gets its own list, remove ""'s
+               try:
+                       new_array = [f[0][1:-1] for f in child_array.fields]
+               except:
+                       print '\twarning, string array could not be made'
+                       new_array = []
+               
+               return new_array
+       
+       
        def getLevel(self):
                # Ignore self_real
                level = 0
@@ -551,7 +840,6 @@ class vrmlNode(object):
        def __repr__(self):
                level = self.getLevel()
                ind = '  ' * level
-               
                if self.node_type==NODE_REFERENCE:
                        brackets = ''
                elif self.node_type==NODE_NORMAL:
@@ -564,38 +852,102 @@ class vrmlNode(object):
                else:
                        text = ''
                
-               text += ind + 'ID: ' + str(self.id) + ' ' + str(level) + ('lineno %d\n' % self.lineno)
+               text += ind + 'ID: ' + str(self.id) + ' ' + str(level) + (' lineno %d\n' % self.lineno)
                
                if self.node_type==NODE_REFERENCE:
+                       text += ind + "(reference node)\n"
                        return text
                
-               for item in self.fields:
+               if self.proto_node:
+                       text += ind + 'PROTO NODE...\n'
+                       text += str(self.proto_node)
+                       text += ind + 'PROTO NODE_DONE\n'
+               
+               text += ind + 'FIELDS:' + str(len(self.fields)) + '\n'
+               
+               for i,item in enumerate(self.fields):
+                       text += ind + 'FIELD:\n'
                        text += ind + str(item) +'\n'
+
+               text += ind + 'PROTO_FIELD_DEFS:' + str(len(self.proto_field_defs)) + '\n'
                
-               #text += ind + 'ARRAY: ' + str(len(self.array_data)) + ' ' + str(self.array_data) + '\n'
-               text += ind + 'ARRAY: ' + str(len(self.array_data)) + '[...] \n'
+               for i,item in enumerate(self.proto_field_defs):
+                       text += ind + 'PROTO_FIELD:\n'
+                       text += ind + str(item) +'\n'
+
+               text += ind + 'ARRAY: ' + str(len(self.array_data)) + ' ' + str(self.array_data) + '\n'
+               #text += ind + 'ARRAY: ' + str(len(self.array_data)) + '[...] \n'
                
                text += ind + 'CHILDREN: ' + str(len(self.children)) + '\n'
-               for child in self.children:
+               for i, child in enumerate(self.children):
+                       text += ind + ('CHILD%d:\n' % i)
                        text += str(child)
                
                text += '\n' + ind + brackets[1]
                
                return text
        
-       def parse(self, i):
-               new_i = self.__parse(i)
+       def parse(self, i, IS_PROTO_DATA=False):
+               new_i = self.__parse(i, IS_PROTO_DATA)
                
                # print self.id, self.getFilename()
                
-               # If we were an inline then try load the file
+               # Check if this node was an inline or externproto
+               
+               url_ls = []
+               
                if self.node_type == NODE_NORMAL and self.getSpec() == 'Inline':
-                       url = self.getFieldAsString('url', None)
+                       ancestry = [] # Warning! - PROTO's using this wont work at all.
+                       url = self.getFieldAsString('url', None, ancestry)
+                       if url:
+                               url_ls = [(url, None)]
+                       del ancestry
+               
+               elif self.getExternprotoName():
+                       # externproto
+                       url_ls = []
+                       for f in self.fields:
+                               
+                               if type(f)==str:
+                                       f = [f]
+                               
+                               for ff in f:
+                                       for f_split in ff.split('"'):
+                                               # print f_split
+                                               # "someextern.vrml#SomeID"
+                                               if '#' in f_split:
+                                                       
+                                                       f_split, f_split_id = f_split.split('#') # there should only be 1 # anyway
+                                                       
+                                                       url_ls.append( (f_split, f_split_id) )
+                                               else:
+                                                       url_ls.append( (f_split, None) )
+               
+               
+               # Was either an Inline or an EXTERNPROTO
+               if url_ls:
                        
-                       if url != None:
-                               if not exists(url):
-                                       url = dirName(self.getFilename()) + baseName(url)
-                               if not exists(url):
+                       # print url_ls
+                       
+                       for url, extern_key in url_ls:
+                               print url
+                               urls = []
+                               urls.append( url )
+                               urls.append( BPySys.caseInsensitivePath(urls[-1]) )
+                               
+                               urls.append( dirName(self.getFilename()) + url )
+                               urls.append( BPySys.caseInsensitivePath(urls[-1]) )
+                               
+                               urls.append( dirName(self.getFilename()) + baseName(url) )
+                               urls.append( BPySys.caseInsensitivePath(urls[-1]) )
+                               
+                               try:
+                                       url = [url for url in urls if exists(url)][0]
+                                       url_found = True
+                               except:
+                                       url_found = False
+                               
+                               if not url_found:
                                        print '\tWarning: Inline URL could not be found:', url
                                else:
                                        if url==self.getFilename(): 
@@ -603,12 +955,12 @@ class vrmlNode(object):
                                        else:
                                                
                                                try:
-                                                       f = open(url, 'rU')
+                                                       data = gzipOpen(url)
                                                except:
                                                        print '\tWarning: cant open the file:', url
-                                                       f = None
+                                                       data = None
                                                
-                                               if f:
+                                               if data:
                                                        # Tricky - inline another VRML
                                                        print '\tLoading Inline:"%s"...' % url
                                                        
@@ -616,26 +968,50 @@ class vrmlNode(object):
                                                        lines_old = lines[:]
                                                        
                                                        
-                                                       lines[:] = vrmlFormat( f.read() )
-                                                       f.close()
+                                                       lines[:] = vrmlFormat( data )
                                                        
                                                        lines.insert(0, '{')
                                                        lines.insert(0, 'root_node____')
                                                        lines.append('}')
+                                                       '''
+                                                       ff = open('/tmp/test.txt', 'w')
+                                                       ff.writelines([l+'\n' for l in lines])
+                                                       '''
                                                        
                                                        child = vrmlNode(self, NODE_NORMAL, -1)
                                                        child.setRoot(url) # initialized dicts
                                                        child.parse(0)
                                                        
+                                                       # if self.getExternprotoName():
+                                                       if self.getExternprotoName():
+                                                               if not extern_key: # if none is spesified - use the name
+                                                                       extern_key = self.getSpec()
+                                                               
+                                                               if extern_key:
+                                                                       
+                                                                       self.children.remove(child)
+                                                                       child.parent = None
+                                                                       
+                                                                       extern_child = child.findSpecRecursive(extern_key)
+                                                                       
+                                                                       if extern_child:
+                                                                               self.children.append(extern_child)
+                                                                               extern_child.parent = self
+                                                                               
+                                                                               if DEBUG: print "\tEXTERNPROTO ID found!:", extern_key
+                                                                       else:
+                                                                               print "\tEXTERNPROTO ID not found!:", extern_key
+                                                                       
                                                        # Watch it! - restore lines
                                                        lines[:] = lines_old
-                                       
                
                return new_i
        
-       def __parse(self, i):
-               # print 'parsing at', i,
-               # print i, self.id, self.lineno
+       def __parse(self, i, IS_PROTO_DATA=False):
+               '''
+               print 'parsing at', i,
+               print i, self.id, self.lineno
+               '''
                l = lines[i]
                
                if l=='[':
@@ -644,9 +1020,11 @@ class vrmlNode(object):
                        i+=1
                else:
                        words = []
+                       
                        node_type, new_i = is_nodeline(i, words)
                        if not node_type: # fail for parsing new node.
-                               raise "error"
+                               print "Failed to parse new node"
+                               raise ValueError
                        
                        if self.node_type==NODE_REFERENCE:
                                # Only assign the reference and quit
@@ -660,40 +1038,72 @@ class vrmlNode(object):
                        
                        # fill in DEF/USE
                        key = self.getDefName()
-                       
                        if key != None:
                                self.getDefDict()[ key ] = self
                        
+                       key = self.getProtoName()
+                       if not key:     key = self.getExternprotoName()
+                       
+                       proto_dict = self.getProtoDict()
+                       if key != None:
+                               proto_dict[ key ] = self
+                               
+                               # Parse the proto nodes fields
+                               self.proto_node = vrmlNode(self, NODE_ARRAY, new_i)
+                               new_i = self.proto_node.parse(new_i)
+                               
+                               self.children.remove(self.proto_node)
+                               
+                               # print self.proto_node
+                               
+                               new_i += 1 # skip past the {
+                               
+                       
+                       else: # If we're a proto instance, add the proto node as our child.
+                               spec = self.getSpec()
+                               try:
+                                       self.children.append( proto_dict[spec] )
+                                       #pass
+                               except:
+                                       pass
+                               
+                               del spec
+                       
+                       del proto_dict, key
+                       
                        i = new_i
                
                # print self.id
                ok = True
                while ok:
+                       if i>=len(lines):
+                               return len(lines)-1
+                       
                        l = lines[i]
-                       # print '\t', i, l
+                       # print '\tDEBUG:', i, self.node_type, l
                        if l=='':
                                i+=1
                                continue 
                        
                        if l=='}':
-                               if self.node_type != NODE_NORMAL:
-                                       print 'wrong node ending, expected an } ' + str(i)
-                                       raise ""
+                               if self.node_type != NODE_NORMAL: # also ends proto nodes, we may want a type for these too.
+                                       print 'wrong node ending, expected an } ' + str(i) + ' ' + str(self.node_type)
+                                       if DEBUG:
+                                               raise ValueError
                                ### print "returning", i
                                return i+1
                        if l==']':
                                if self.node_type != NODE_ARRAY:
-                                       print 'wrong node ending, expected a ] ' + str(i)
-                                       raise ""
+                                       print 'wrong node ending, expected a ] ' + str(i) + ' ' + str(self.node_type)
+                                       if DEBUG:
+                                               raise ValueError
                                ### print "returning", i
                                return i+1
                                
                        node_type, new_i = is_nodeline(i, [])
                        if node_type: # check text\n{
-                               ### print '\t\tgroup', i
                                child = vrmlNode(self, node_type, i)
                                i = child.parse(i)
-                               # print child.id, 'YYY'
                                
                        elif l=='[': # some files have these anonymous lists
                                child = vrmlNode(self, NODE_ARRAY, i)
@@ -723,7 +1133,9 @@ class vrmlNode(object):
                                        values = l_split
                                
                                # This should not extend over multiple lines however it is possible
-                               self.array_data.extend( values )
+                               # print self.array_data
+                               if values:
+                                       self.array_data.extend( values )
                                i+=1
                        else:
                                words = l.split()
@@ -774,6 +1186,7 @@ class vrmlNode(object):
                                                                        # this IS a key but the previous value was not a key, ot it was a defined field.
                                                                        if (not iskey(field_context[-1])) or ((len(field_context)==3 and field_context[1]=='IS')):
                                                                                field_list.append(field_context)
+                                                                               
                                                                                field_context = [value[j]]
                                                                        else:
                                                                                # The last item was not a value, multiple keys are needed in some cases.
@@ -796,18 +1209,9 @@ class vrmlNode(object):
                                                
                                                if value[0]=='field':
                                                        # field SFFloat creaseAngle 4
-                                                       self.getFieldDict()[value[2]] = value[3:] # skip the first 3 values
+                                                       self.proto_field_defs.append(value)
                                                else:
-                                                       # Get referenced field
-                                                       if len(value) >= 3 and value[1]=='IS':
-                                                               try:
-                                                                       value = [ value[0] ] + self.getFieldDict()[ value[2] ]
-                                                               except:
-                                                                       print '\tWarning, field could not be found:', value, 'TODO add support for exposedField'
-                                                                       print '\t', self.getFieldDict()
-                                                                       self.fields.append(value)
-                                                       else:
-                                                               self.fields.append(value)
+                                                       self.fields.append(value)
                                i+=1
 
 def gzipOpen(path):
@@ -843,12 +1247,13 @@ def vrml_parse(path):
        lines.insert(0, '{')
        lines.insert(0, 'dymmy_node')
        lines.append('}')
-       
        # Use for testing our parsed output, so we can check on line numbers.
        
-       ## ff = open('m:\\test.txt', 'w')
-       ## ff.writelines([l+'\n' for l in lines])
-       
+       '''
+       ff = open('/tmp/test.txt', 'w')
+       ff.writelines([l+'\n' for l in lines])
+       ff.close()
+       '''
        
        # Now evaluate it
        node_type, new_i = is_nodeline(0, [])
@@ -866,9 +1271,13 @@ def vrml_parse(path):
        # Parse recursively
        root.parse(0)
        
-       # print root
+       # This prints a load of text
+       if DEBUG:
+               print root
+       
        return root, ''
 
+
 # ====================== END VRML 
 
 
@@ -881,7 +1290,7 @@ class x3dNode(vrmlNode):
                vrmlNode.__init__(self, parent, node_type, -1)
                self.x3dNode = x3dNode
                
-       def parse(self):
+       def parse(self, IS_PROTO_DATA=False):
                # print self.x3dNode.tagName
                
                define = self.x3dNode.getAttributeNode('DEF')
@@ -996,6 +1405,9 @@ for i, f in enumerate(files):
 # -----------------------------------------------------------------------------------
 import bpy
 import BPyImage
+import BPySys
+reload(BPySys)
+reload(BPyImage)
 import Blender
 from Blender import Texture, Material, Mathutils, Mesh, Types, Window
 from Blender.Mathutils import TranslationMatrix
@@ -1018,12 +1430,12 @@ def translateScale(sca):
        mat[2][2] = sca[2]
        return mat
 
-def translateTransform(node):
-       cent =          node.getFieldAsFloatTuple('center', None) # (0.0, 0.0, 0.0)
-       rot =           node.getFieldAsFloatTuple('rotation', None) # (0.0, 0.0, 1.0, 0.0)
-       sca =           node.getFieldAsFloatTuple('scale', None) # (1.0, 1.0, 1.0)
-       scaori =        node.getFieldAsFloatTuple('scaleOrientation', None) # (0.0, 0.0, 1.0, 0.0)
-       tx =            node.getFieldAsFloatTuple('translation', None) # (0.0, 0.0, 0.0)
+def translateTransform(node, ancestry):
+       cent =          node.getFieldAsFloatTuple('center', None, ancestry) # (0.0, 0.0, 0.0)
+       rot =           node.getFieldAsFloatTuple('rotation', None, ancestry) # (0.0, 0.0, 1.0, 0.0)
+       sca =           node.getFieldAsFloatTuple('scale', None, ancestry) # (1.0, 1.0, 1.0)
+       scaori =        node.getFieldAsFloatTuple('scaleOrientation', None, ancestry) # (0.0, 0.0, 1.0, 0.0)
+       tx =            node.getFieldAsFloatTuple('translation', None, ancestry) # (0.0, 0.0, 0.0)
        
        if cent:
                cent_mat = TranslationMatrix(Vector(cent)).resize4x4()
@@ -1055,11 +1467,11 @@ def translateTransform(node):
        
        return new_mat
 
-def translateTexTransform(node):
-       cent =          node.getFieldAsFloatTuple('center', None) # (0.0, 0.0)
-       rot =           node.getFieldAsFloat('rotation', None) # 0.0
-       sca =           node.getFieldAsFloatTuple('scale', None) # (1.0, 1.0)
-       tx =            node.getFieldAsFloatTuple('translation', None) # (0.0, 0.0)
+def translateTexTransform(node, ancestry):
+       cent =          node.getFieldAsFloatTuple('center', None, ancestry) # (0.0, 0.0)
+       rot =           node.getFieldAsFloat('rotation', None, ancestry) # 0.0
+       sca =           node.getFieldAsFloatTuple('scale', None, ancestry) # (1.0, 1.0)
+       tx =            node.getFieldAsFloatTuple('translation', None, ancestry) # (0.0, 0.0)
        
        
        if cent:
@@ -1090,6 +1502,7 @@ def translateTexTransform(node):
        return new_mat
 
 
+
 def getFinalMatrix(node, mtx, ancestry):
        
        transform_nodes = [node_tx for node_tx in ancestry if node_tx.getSpec() == 'Transform']
@@ -1101,17 +1514,17 @@ def getFinalMatrix(node, mtx, ancestry):
                mtx = Matrix()
        
        for node_tx in transform_nodes:
-               mat = translateTransform(node_tx)
+               mat = translateTransform(node_tx, ancestry)
                mtx = mtx * mat
        
        return mtx
 
-def importMesh_IndexedFaceSet(geom, bpyima):
+def importMesh_IndexedFaceSet(geom, bpyima, ancestry):
        # print geom.lineno, geom.id, vrmlNode.DEF_NAMESPACE.keys()
        
-       ccw =                           geom.getFieldAsBool('ccw', True)
-       ifs_colorPerVertex =    geom.getFieldAsBool('colorPerVertex', True) # per vertex or per face
-       ifs_normalPerVertex =   geom.getFieldAsBool('normalPerVertex', True)
+       ccw =                           geom.getFieldAsBool('ccw', True, ancestry)
+       ifs_colorPerVertex =    geom.getFieldAsBool('colorPerVertex', True, ancestry) # per vertex or per face
+       ifs_normalPerVertex =   geom.getFieldAsBool('normalPerVertex', True, ancestry)
        
        # This is odd how point is inside Coordinate
        
@@ -1120,14 +1533,14 @@ def importMesh_IndexedFaceSet(geom, bpyima):
        
        coord = geom.getChildBySpec('Coordinate') # works for x3d and vrml
        
-       if coord:       ifs_points = coord.getFieldAsArray('point', 3)
+       if coord:       ifs_points = coord.getFieldAsArray('point', 3, ancestry)
        else:           coord = []
        
        if not coord:
                print '\tWarnint: IndexedFaceSet has no points'
                return None, ccw
        
-       ifs_faces = geom.getFieldAsArray('coordIndex', 0)
+       ifs_faces = geom.getFieldAsArray('coordIndex', 0, ancestry)
        
        coords_tex = None
        if ifs_faces: # In rare cases this causes problems - no faces but UVs???
@@ -1137,8 +1550,8 @@ def importMesh_IndexedFaceSet(geom, bpyima):
                coords_tex = geom.getChildBySpec('TextureCoordinate')
                
                if coords_tex:
-                       ifs_texpoints = coords_tex.getFieldAsArray('point', 2)
-                       ifs_texfaces = geom.getFieldAsArray('texCoordIndex', 0)
+                       ifs_texpoints = coords_tex.getFieldAsArray('point', 2, ancestry)
+                       ifs_texfaces = geom.getFieldAsArray('texCoordIndex', 0, ancestry)
                        
                        if not ifs_texpoints:
                                # IF we have no coords, then dont bother
@@ -1151,11 +1564,11 @@ def importMesh_IndexedFaceSet(geom, bpyima):
        vcolor_spot = None # spot color when we dont have an array of colors
        if vcolor:
                # float to char
-               ifs_vcol = [[int(c*256) for c in col] for col in vcolor.getFieldAsArray('color', 3)]
-               ifs_color_index = geom.getFieldAsArray('colorIndex', 0)
+               ifs_vcol = [[int(c*256) for c in col] for col in vcolor.getFieldAsArray('color', 3, ancestry)]
+               ifs_color_index = geom.getFieldAsArray('colorIndex', 0, ancestry)
                
                if not ifs_vcol:
-                       vcolor_spot = [int(c*256) for c in vcolor.getFieldAsFloatTuple('color', [])]
+                       vcolor_spot = [int(c*256) for c in vcolor.getFieldAsFloatTuple('color', [], ancestry)]
        
        # Convert faces into somthing blender can use
        edges = []
@@ -1338,12 +1751,18 @@ def importMesh_IndexedFaceSet(geom, bpyima):
                                fv = f.verts
                                for i,c in enumerate(fcol):
                                        color_index = fv[i].index # color index is vert index
-                                       if ifs_color_index: color_index = ifs_color_index[color_index]
+                                       if ifs_color_index:
+                                               try:
+                                                       color_index = ifs_color_index[color_index]
+                                               except:
+                                                       print '\tWarning: per vertex color index out of range'
+                                                       continue
                                        
                                        if len(ifs_vcol) < color_index:
                                                c.r, c.g, c.b = ifs_vcol[color_index]
                                        else:
-                                               print '\tWarning: per face color index out of range'
+                                               #print '\tWarning: per face color index out of range'
+                                               pass
                        else:
                                if vcolor_spot: # use 1 color, when ifs_vcol is []
                                        for c in fcol:
@@ -1361,24 +1780,27 @@ def importMesh_IndexedFaceSet(geom, bpyima):
                                        
                                        col = ifs_vcol[color_index]
                                        for i,c in enumerate(fcol):
-                                               c.r, c.g, c.b = col
+                                               try:
+                                                       c.r, c.g, c.b = col
+                                               except:
+                                                       pass # incase its not between 0 and 255
        
        bpymesh.verts.delete([0,]) # EEKADOODLE
        
        return bpymesh, ccw
 
-def importMesh_IndexedLineSet(geom):
+def importMesh_IndexedLineSet(geom, ancestry):
        # VRML not x3d
        #coord = geom.getChildByName('coord') # 'Coordinate'
        coord = geom.getChildBySpec('Coordinate') # works for x3d and vrml
-       if coord:       points = coord.getFieldAsArray('point', 3)
+       if coord:       points = coord.getFieldAsArray('point', 3, ancestry)
        else:           points = []
        
        if not points:
                print '\tWarning: IndexedLineSet had no points'
                return None
        
-       ils_lines = geom.getFieldAsArray('coordIndex', 0)
+       ils_lines = geom.getFieldAsArray('coordIndex', 0, ancestry)
        
        lines = []
        line = []
@@ -1417,11 +1839,11 @@ def importMesh_IndexedLineSet(geom):
        return bpycurve
 
 
-def importMesh_PointSet(geom):
+def importMesh_PointSet(geom, ancestry):
        # VRML not x3d
        #coord = geom.getChildByName('coord') # 'Coordinate'
        coord = geom.getChildBySpec('Coordinate')  # works for x3d and vrml
-       if coord:       points = coord.getFieldAsArray('point', 3)
+       if coord:       points = coord.getFieldAsArray('point', 3, ancestry)
        else:           points = []
        
        # vcolor = geom.getChildByName('color') # blender dosnt have per vertex color
@@ -1435,26 +1857,26 @@ GLOBALS['CIRCLE_DETAIL'] = 12
 
 MATRIX_Z_TO_Y = RotationMatrix(90, 4, 'x')
 
-def importMesh_Sphere(geom):
+def importMesh_Sphere(geom, ancestry):
        # bpymesh = bpy.data.meshes.new()
-       diameter = geom.getFieldAsFloat('radius', 0.5) * 2 # * 2 for the diameter
+       diameter = geom.getFieldAsFloat('radius', 0.5, ancestry) * 2 # * 2 for the diameter
        bpymesh = Mesh.Primitives.UVsphere(GLOBALS['CIRCLE_DETAIL'], GLOBALS['CIRCLE_DETAIL'], diameter)  
        bpymesh.transform(MATRIX_Z_TO_Y)
        return bpymesh
 
-def importMesh_Cylinder(geom):
+def importMesh_Cylinder(geom, ancestry):
        # bpymesh = bpy.data.meshes.new()
-       diameter = geom.getFieldAsFloat('radius', 1.0) * 2 # * 2 for the diameter
-       height = geom.getFieldAsFloat('height', 2)
+       diameter = geom.getFieldAsFloat('radius', 1.0, ancestry) * 2 # * 2 for the diameter
+       height = geom.getFieldAsFloat('height', 2, ancestry)
        bpymesh = Mesh.Primitives.Cylinder(GLOBALS['CIRCLE_DETAIL'], diameter, height) 
        bpymesh.transform(MATRIX_Z_TO_Y)
        
        # Warning - Rely in the order Blender adds verts
        # not nice design but wont change soon.
        
-       bottom = geom.getFieldAsBool('bottom', True)
-       side = geom.getFieldAsBool('side', True)
-       top = geom.getFieldAsBool('top', True)
+       bottom = geom.getFieldAsBool('bottom', True, ancestry)
+       side = geom.getFieldAsBool('side', True, ancestry)
+       top = geom.getFieldAsBool('top', True, ancestry)
        
        if not top: # last vert is top center of tri fan.
                bpymesh.verts.delete([(GLOBALS['CIRCLE_DETAIL']+GLOBALS['CIRCLE_DETAIL'])+1])
@@ -1468,18 +1890,18 @@ def importMesh_Cylinder(geom):
        
        return bpymesh
 
-def importMesh_Cone(geom):
+def importMesh_Cone(geom, ancestry):
        # bpymesh = bpy.data.meshes.new()
-       diameter = geom.getFieldAsFloat('bottomRadius', 1.0) * 2 # * 2 for the diameter
-       height = geom.getFieldAsFloat('height', 2)
+       diameter = geom.getFieldAsFloat('bottomRadius', 1.0, ancestry) * 2 # * 2 for the diameter
+       height = geom.getFieldAsFloat('height', 2, ancestry)
        bpymesh = Mesh.Primitives.Cone(GLOBALS['CIRCLE_DETAIL'], diameter, height) 
        bpymesh.transform(MATRIX_Z_TO_Y)
        
        # Warning - Rely in the order Blender adds verts
        # not nice design but wont change soon.
        
-       bottom = geom.getFieldAsBool('bottom', True)
-       side = geom.getFieldAsBool('side', True)
+       bottom = geom.getFieldAsBool('bottom', True, ancestry)
+       side = geom.getFieldAsBool('side', True, ancestry)
        
        if not bottom: # last vert is on the bottom
                bpymesh.verts.delete([GLOBALS['CIRCLE_DETAIL']+1])
@@ -1488,10 +1910,10 @@ def importMesh_Cone(geom):
        
        return bpymesh
 
-def importMesh_Box(geom):
+def importMesh_Box(geom, ancestry):
        # bpymesh = bpy.data.meshes.new()
        
-       size = geom.getFieldAsFloatTuple('size', (2.0, 2.0, 2.0))
+       size = geom.getFieldAsFloatTuple('size', (2.0, 2.0, 2.0), ancestry)
        bpymesh = Mesh.Primitives.Cube(1.0) 
 
        # Scale the box to the size set
@@ -1517,6 +1939,9 @@ def importShape(node, ancestry):
                bpymat = None
                bpyima = None
                texmtx = None
+               
+               depth = 0 # so we can set alpha face flag later
+               
                if appr:
                        
                        #mat = appr.getChildByName('material') # 'Material'
@@ -1532,7 +1957,7 @@ def importShape(node, ancestry):
                        textx = appr.getChildBySpec('TextureTransform')
                        
                        if textx:
-                               texmtx = translateTexTransform(textx)
+                               texmtx = translateTexTransform(textx, ancestry)
                        
 
                        
@@ -1544,29 +1969,34 @@ def importShape(node, ancestry):
                                
                                # all values between 0.0 and 1.0, defaults from VRML docs
                                bpymat = bpy.data.materials.new()
-                               bpymat.amb =            mat.getFieldAsFloat('ambientIntensity', 0.2)
-                               bpymat.rgbCol =         mat.getFieldAsFloatTuple('diffuseColor', [0.8, 0.8, 0.8])
+                               bpymat.amb =            mat.getFieldAsFloat('ambientIntensity', 0.2, ancestry)
+                               bpymat.rgbCol =         mat.getFieldAsFloatTuple('diffuseColor', [0.8, 0.8, 0.8], ancestry)
                                
                                # NOTE - blender dosnt support emmisive color
                                # Store in mirror color and approximate with emit.
-                               emit =                          mat.getFieldAsFloatTuple('emissiveColor', [0.0, 0.0, 0.0])
+                               emit =                          mat.getFieldAsFloatTuple('emissiveColor', [0.0, 0.0, 0.0], ancestry)
                                bpymat.mirCol =         emit
                                bpymat.emit =           (emit[0]+emit[1]+emit[2])/3.0
                                
-                               bpymat.hard =           int(1+(510*mat.getFieldAsFloat('shininess', 0.2))) # 0-1 -> 1-511
-                               bpymat.specCol =        mat.getFieldAsFloatTuple('specularColor', [0.0, 0.0, 0.0])
-                               bpymat.alpha =          1.0 - mat.getFieldAsFloat('transparency', 0.0)
+                               bpymat.hard =           int(1+(510*mat.getFieldAsFloat('shininess', 0.2, ancestry))) # 0-1 -> 1-511
+                               bpymat.specCol =        mat.getFieldAsFloatTuple('specularColor', [0.0, 0.0, 0.0], ancestry)
+                               bpymat.alpha =          1.0 - mat.getFieldAsFloat('transparency', 0.0, ancestry)
                                if bpymat.alpha < 0.999:
                                        bpymat.mode |= Material.Modes.ZTRANSP
                        
                        
                        if ima:
-                               # print ima
-                               ima_url =                       ima.getFieldAsString('url')
+                               
+                               ima_url =                       ima.getFieldAsString('url', None, ancestry)
+                               
+                               if ima_url==None:
+                                       try:            ima_url = ima.getFieldAsStringArray('url', ancestry)[0] # in some cases we get a list of images.
+                                       except:         ima_url = None
+                               
                                if ima_url==None:
                                        print "\twarning, image with no URL, this is odd"
                                else:
-                                       bpyima= BPyImage.comprehensiveImageLoad(ima_url, dirName(node.getFilename()), PLACE_HOLDER= False, RECURSIVE= False)
+                                       bpyima= BPyImage.comprehensiveImageLoad(ima_url, dirName(node.getFilename()), PLACE_HOLDER= False, RECURSIVE= False, CONVERT_CALLBACK= imageConvertCompat)
                                        if bpyima:
                                                texture= bpy.data.textures.new()
                                                texture.setType('Image')
@@ -1585,10 +2015,11 @@ def importShape(node, ancestry):
                                                else:
                                                        bpymat.setTexture(0, texture, Texture.TexCo.UV, Texture.MapTo.COL)
                                                        
-                                               ima_repS =                      ima.getFieldAsBool('repeatS', True)
-                                               ima_repT =                      ima.getFieldAsBool('repeatT', True)
+                                               ima_repS =                      ima.getFieldAsBool('repeatS', True, ancestry)
+                                               ima_repT =                      ima.getFieldAsBool('repeatT', True, ancestry)
                                                
-                                               texture.repeat =        max(1, ima_repS * 512), max(1, ima_repT * 512)
+                                               # To make this work properly we'd need to scale the UV's too, better to ignore th
+                                               # texture.repeat =      max(1, ima_repS * 512), max(1, ima_repT * 512)
                                                
                                                if not ima_repS: bpyima.clampX = True
                                                if not ima_repT: bpyima.clampY = True
@@ -1597,19 +2028,19 @@ def importShape(node, ancestry):
                geom_spec = geom.getSpec()
                ccw = True
                if geom_spec == 'IndexedFaceSet':
-                       bpydata, ccw = importMesh_IndexedFaceSet(geom, bpyima)
+                       bpydata, ccw = importMesh_IndexedFaceSet(geom, bpyima, ancestry)
                elif geom_spec == 'IndexedLineSet':
-                       bpydata = importMesh_IndexedLineSet(geom)
+                       bpydata = importMesh_IndexedLineSet(geom, ancestry)
                elif geom_spec == 'PointSet':
-                       bpydata = importMesh_PointSet(geom)
+                       bpydata = importMesh_PointSet(geom, ancestry)
                elif geom_spec == 'Sphere':
-                       bpydata = importMesh_Sphere(geom)
+                       bpydata = importMesh_Sphere(geom, ancestry)
                elif geom_spec == 'Box':
-                       bpydata = importMesh_Box(geom)
+                       bpydata = importMesh_Box(geom, ancestry)
                elif geom_spec == 'Cylinder':
-                       bpydata = importMesh_Cylinder(geom)
+                       bpydata = importMesh_Cylinder(geom, ancestry)
                elif geom_spec == 'Cone':
-                       bpydata = importMesh_Cone(geom)
+                       bpydata = importMesh_Cone(geom, ancestry)
                else:
                        print '\tWarning: unsupported type "%s"' % geom_spec
                        return
@@ -1622,8 +2053,8 @@ def importShape(node, ancestry):
                        bpyob  = node.blendObject = bpy.data.scenes.active.objects.new(bpydata)
                        
                        if type(bpydata) == Types.MeshType:
-                               is_solid =                      geom.getFieldAsBool('solid', True)
-                               creaseAngle =           geom.getFieldAsFloat('creaseAngle', None)
+                               is_solid =                      geom.getFieldAsBool('solid', True, ancestry)
+                               creaseAngle =           geom.getFieldAsFloat('creaseAngle', None, ancestry)
                                
                                if creaseAngle != None:
                                        bpydata.maxSmoothAngle = 1+int(min(79, creaseAngle * RAD_TO_DEG))
@@ -1632,15 +2063,22 @@ def importShape(node, ancestry):
                                # Only ever 1 material per shape
                                if bpymat:      bpydata.materials = [bpymat]
                                
-                               if bpydata.faceUV and texmtx:
-                                       # Apply texture transform?
-                                       uv_copy = Vector()
-                                       for f in bpydata.faces:
-                                               for uv in f.uv:
-                                                       uv_copy.x = uv.x
-                                                       uv_copy.y = uv.y
-                                                       
-                                                       uv.x, uv.y = (uv_copy * texmtx)[0:2]
+                               if bpydata.faceUV:
+                                       
+                                       if depth==32: # set the faces alpha flag?
+                                               transp = Mesh.FaceTranspModes.ALPHA
+                                               for f in bpydata.faces:
+                                                       f.transp = transp
+                               
+                                       if texmtx:
+                                               # Apply texture transform?
+                                               uv_copy = Vector()
+                                               for f in bpydata.faces:
+                                                       for uv in f.uv:
+                                                               uv_copy.x = uv.x
+                                                               uv_copy.y = uv.y
+                                                               
+                                                               uv.x, uv.y = (uv_copy * texmtx)[0:2]
                                # Done transforming the texture
                                
                                
@@ -1657,17 +2095,17 @@ def importShape(node, ancestry):
                        bpyob.setMatrix( getFinalMatrix(node, None, ancestry) )
 
 
-def importLamp_PointLight(node):
+def importLamp_PointLight(node, ancestry):
        vrmlname = node.getDefName()
        if not vrmlname: vrmlname = 'PointLight'
        
-       # ambientIntensity = node.getFieldAsFloat('ambientIntensity', 0.0) # TODO
-       # attenuation = node.getFieldAsFloatTuple('attenuation', (1.0, 0.0, 0.0)) # TODO
-       color = node.getFieldAsFloatTuple('color', (1.0, 1.0, 1.0))
-       intensity = node.getFieldAsFloat('intensity', 1.0) # max is documented to be 1.0 but some files have higher.
-       location = node.getFieldAsFloatTuple('location', (0.0, 0.0, 0.0))
-       # is_on = node.getFieldAsBool('on', True) # TODO
-       radius = node.getFieldAsFloat('radius', 100.0)
+       # ambientIntensity = node.getFieldAsFloat('ambientIntensity', 0.0, ancestry) # TODO
+       # attenuation = node.getFieldAsFloatTuple('attenuation', (1.0, 0.0, 0.0), ancestry) # TODO
+       color = node.getFieldAsFloatTuple('color', (1.0, 1.0, 1.0), ancestry)
+       intensity = node.getFieldAsFloat('intensity', 1.0, ancestry) # max is documented to be 1.0 but some files have higher.
+       location = node.getFieldAsFloatTuple('location', (0.0, 0.0, 0.0), ancestry)
+       # is_on = node.getFieldAsBool('on', True, ancestry) # TODO
+       radius = node.getFieldAsFloat('radius', 100.0, ancestry)
        
        bpylamp = bpy.data.lamps.new()
        bpylamp.setType('Lamp')
@@ -1679,15 +2117,15 @@ def importLamp_PointLight(node):
        
        return bpylamp, mtx
 
-def importLamp_DirectionalLight(node):
+def importLamp_DirectionalLight(node, ancestry):
        vrmlname = node.getDefName()
        if not vrmlname: vrmlname = 'DirectLight'
        
        # ambientIntensity = node.getFieldAsFloat('ambientIntensity', 0.0) # TODO
-       color = node.getFieldAsFloatTuple('color', (1.0, 1.0, 1.0))
-       direction = node.getFieldAsFloatTuple('direction', (0.0, 0.0, -1.0))
-       intensity = node.getFieldAsFloat('intensity', 1.0) # max is documented to be 1.0 but some files have higher.
-       # is_on = node.getFieldAsBool('on', True) # TODO
+       color = node.getFieldAsFloatTuple('color', (1.0, 1.0, 1.0), ancestry)
+       direction = node.getFieldAsFloatTuple('direction', (0.0, 0.0, -1.0), ancestry)
+       intensity = node.getFieldAsFloat('intensity', 1.0, ancestry) # max is documented to be 1.0 but some files have higher.
+       # is_on = node.getFieldAsBool('on', True, ancestry) # TODO
        
        bpylamp = bpy.data.lamps.new(vrmlname)
        bpylamp.setType('Sun')
@@ -1701,20 +2139,20 @@ def importLamp_DirectionalLight(node):
 
 # looks like default values for beamWidth and cutOffAngle were swapped in VRML docs.
 
-def importLamp_SpotLight(node):
+def importLamp_SpotLight(node, ancestry):
        vrmlname = node.getDefName()
        if not vrmlname: vrmlname = 'SpotLight'
        
-       # ambientIntensity = geom.getFieldAsFloat('ambientIntensity', 0.0) # TODO
-       # attenuation = geom.getFieldAsFloatTuple('attenuation', (1.0, 0.0, 0.0)) # TODO
-       beamWidth = node.getFieldAsFloat('beamWidth', 1.570796) * RAD_TO_DEG # max is documented to be 1.0 but some files have higher.
-       color = node.getFieldAsFloatTuple('color', (1.0, 1.0, 1.0))
-       cutOffAngle = node.getFieldAsFloat('cutOffAngle', 0.785398) * RAD_TO_DEG # max is documented to be 1.0 but some files have higher.
-       direction = node.getFieldAsFloatTuple('direction', (0.0, 0.0, -1.0))
-       intensity = node.getFieldAsFloat('intensity', 1.0) # max is documented to be 1.0 but some files have higher.
-       location = node.getFieldAsFloatTuple('location', (0.0, 0.0, 0.0))
-       # is_on = node.getFieldAsBool('on', True) # TODO
-       radius = node.getFieldAsFloat('radius', 100.0)
+       # ambientIntensity = geom.getFieldAsFloat('ambientIntensity', 0.0, ancestry) # TODO
+       # attenuation = geom.getFieldAsFloatTuple('attenuation', (1.0, 0.0, 0.0), ancestry) # TODO
+       beamWidth = node.getFieldAsFloat('beamWidth', 1.570796, ancestry) * RAD_TO_DEG # max is documented to be 1.0 but some files have higher.
+       color = node.getFieldAsFloatTuple('color', (1.0, 1.0, 1.0), ancestry)
+       cutOffAngle = node.getFieldAsFloat('cutOffAngle', 0.785398, ancestry) * RAD_TO_DEG # max is documented to be 1.0 but some files have higher.
+       direction = node.getFieldAsFloatTuple('direction', (0.0, 0.0, -1.0), ancestry)
+       intensity = node.getFieldAsFloat('intensity', 1.0, ancestry) # max is documented to be 1.0 but some files have higher.
+       location = node.getFieldAsFloatTuple('location', (0.0, 0.0, 0.0), ancestry)
+       # is_on = node.getFieldAsBool('on', True, ancestry) # TODO
+       radius = node.getFieldAsFloat('radius', 100.0, ancestry)
        
        bpylamp = bpy.data.lamps.new(vrmlname)
        bpylamp.setType('Spot')
@@ -1733,21 +2171,21 @@ def importLamp_SpotLight(node):
        # Convert 
        
        # lamps have their direction as -z, y==up
-       mtx = TranslationMatrix(Vector(location)) * Vector(direction).toTrackQuat('-z', 'y').toMatrix().resize4x4()
+       mtx = Vector(direction).toTrackQuat('-z', 'y').toMatrix().resize4x4() * TranslationMatrix(Vector(location))
        
        return bpylamp, mtx
 
 
 def importLamp(node, spec, ancestry):
        if spec=='PointLight':
-               bpylamp,mtx = importLamp_PointLight(node)
+               bpylamp,mtx = importLamp_PointLight(node, ancestry)
        elif spec=='DirectionalLight':
-               bpylamp,mtx = importLamp_DirectionalLight(node)
+               bpylamp,mtx = importLamp_DirectionalLight(node, ancestry)
        elif spec=='SpotLight':
-               bpylamp,mtx = importLamp_SpotLight(node)
+               bpylamp,mtx = importLamp_SpotLight(node, ancestry)
        else:
                print "Error, not a lamp"
-               raise ""
+               raise ValueError
        
        bpyob = node.blendObject = bpy.data.scenes.active.objects.new(bpylamp)
        bpyob.setMatrix( getFinalMatrix(node, mtx, ancestry) )
@@ -1757,17 +2195,17 @@ def importViewpoint(node, ancestry):
        name = node.getDefName()
        if not name: name = 'Viewpoint'
        
-       fieldOfView = node.getFieldAsFloat('fieldOfView', 0.785398) * RAD_TO_DEG # max is documented to be 1.0 but some files have higher.
-       # jump = node.getFieldAsBool('jump', True)
-       orientation = node.getFieldAsFloatTuple('orientation', (0.0, 0.0, 1.0, 0.0))
-       position = node.getFieldAsFloatTuple('position', (0.0, 0.0, 10.0))
-       description = node.getFieldAsString('description', '')
+       fieldOfView = node.getFieldAsFloat('fieldOfView', 0.785398, ancestry) * RAD_TO_DEG # max is documented to be 1.0 but some files have higher.
+       # jump = node.getFieldAsBool('jump', True, ancestry)
+       orientation = node.getFieldAsFloatTuple('orientation', (0.0, 0.0, 1.0, 0.0), ancestry)
+       position = node.getFieldAsFloatTuple('position', (0.0, 0.0, 0.0), ancestry)
+       description = node.getFieldAsString('description', '', ancestry)
        
        bpycam = bpy.data.cameras.new(name)
        
        bpycam.angle = fieldOfView
        
-       mtx = TranslationMatrix(Vector(position)) * translateRotation(orientation) * MATRIX_Z_TO_Y
+       mtx = translateRotation(orientation) * TranslationMatrix(Vector(position))
        
        
        bpyob = node.blendObject = bpy.data.scenes.active.objects.new(bpycam)
@@ -1781,6 +2219,173 @@ def importTransform(node, ancestry):
        bpyob = node.blendObject = bpy.data.scenes.active.objects.new('Empty', name) # , name)
        bpyob.setMatrix( getFinalMatrix(node, None, ancestry) )
 
+       # so they are not too annoying
+       bpyob.emptyShape= Blender.Object.EmptyShapes.AXES
+       bpyob.drawSize= 0.2
+
+       
+#def importTimeSensor(node):
+
+
+def translatePositionInterpolator(node, ipo, ancestry):
+       key = node.getFieldAsArray('key', 0, ancestry)
+       keyValue = node.getFieldAsArray('keyValue', 3, ancestry)
+       
+       try:
+               loc_x = ipo.addCurve('LocX')
+               loc_y = ipo.addCurve('LocY')
+               loc_z = ipo.addCurve('LocZ')
+       except ValueError:
+               return
+               
+       loc_x.interpolation = loc_y.interpolation = loc_z.interpolation = Blender.IpoCurve.InterpTypes.LINEAR
+       
+       for i, time in enumerate(key):
+               try:            x,y,z = keyValue[i]
+               except: continue
+               
+               loc_x.append((time,x))
+               loc_y.append((time,y))
+               loc_z.append((time,z))
+
+def translateOrientationInterpolator(node, ipo, ancestry):
+       key = node.getFieldAsArray('key', 0, ancestry)
+       keyValue = node.getFieldAsArray('keyValue', 4, ancestry)
+       
+       try:
+               rot_x = ipo.addCurve('RotX')
+               rot_y = ipo.addCurve('RotY')
+               rot_z = ipo.addCurve('RotZ')
+       except ValueError:
+               return
+       
+       rot_x.interpolation = rot_y.interpolation = rot_z.interpolation = Blender.IpoCurve.InterpTypes.LINEAR
+       
+       for i, time in enumerate(key):
+               try:            x,y,z,w = keyValue[i]
+               except: continue
+               
+               mtx = translateRotation((x,y,z,w))
+               eul = mtx.toEuler()
+               rot_x.append((time,eul.x/10.0))
+               rot_y.append((time,eul.y/10.0))
+               rot_z.append((time,eul.z/10.0))
+
+# Untested!
+def translateScalarInterpolator(node, ipo, ancestry):
+       key = node.getFieldAsArray('key', 0, ancestry)
+       keyValue = node.getFieldAsArray('keyValue', 4, ancestry)
+       
+       try:
+               sca_x = ipo.addCurve('ScaleX')
+               sca_y = ipo.addCurve('ScaleY')
+               sca_z = ipo.addCurve('ScaleZ')
+       except ValueError:
+               return
+       
+       sca_x.interpolation = sca_y.interpolation = sca_z.interpolation = Blender.IpoCurve.InterpTypes.LINEAR
+       
+       for i, time in enumerate(key):
+               try:            x,y,z = keyValue[i]
+               except: continue
+               sca_x.append((time,x/10.0))
+               sca_y.append((time,y/10.0))
+               sca_z.append((time,z/10.0))
+
+def translateTimeSensor(node, ipo, ancestry):
+       '''
+       Apply a time sensor to an IPO, VRML has many combinations of loop/start/stop/cycle times
+       to give different results, for now just do the basics
+       '''
+       
+       time_cu = ipo.addCurve('Time')
+       time_cu.interpolation = Blender.IpoCurve.InterpTypes.LINEAR
+       
+       cycleInterval = node.getFieldAsFloat('cycleInterval', None, ancestry)
+       
+       startTime = node.getFieldAsFloat('startTime', 0.0, ancestry)
+       stopTime = node.getFieldAsFloat('stopTime', 250.0, ancestry)
+               
+       if cycleInterval != None:
+               stopTime = startTime+cycleInterval
+       
+       loop = node.getFieldAsBool('loop', False, ancestry)
+       
+       time_cu.append((1+startTime, 0.0))
+       time_cu.append((1+stopTime, 1.0/10.0))# anoying, the UI uses /10
+       
+       
+       if loop:
+               time_cu.extend = Blender.IpoCurve.ExtendTypes.CYCLIC # or - EXTRAP, CYCLIC_EXTRAP, CONST, 
+
+
+def importRoute(node, ancestry):
+       '''
+       Animation route only at the moment
+       '''
+       
+       if not hasattr(node, 'fields'):
+               return
+       
+       routeIpoDict = node.getRouteIpoDict()
+       
+       def getIpo(id):
+               try: ipo =      routeIpoDict[id]
+               except: ipo = routeIpoDict[id] = bpy.data.ipos.new('web3d_ipo', 'Object')
+               return ipo
+       
+       # for getting definitions
+       defDict = node.getDefDict()
+       '''
+       Handles routing nodes to eachother
+       
+ROUTE vpPI.value_changed TO champFly001.set_position
+ROUTE vpOI.value_changed TO champFly001.set_orientation
+ROUTE vpTs.fraction_changed TO vpPI.set_fraction
+ROUTE vpTs.fraction_changed TO vpOI.set_fraction
+ROUTE champFly001.bindTime TO vpTs.set_startTime
+       '''
+       
+       #from_id, from_type = node.id[1].split('.')
+       #to_id, to_type = node.id[3].split('.')
+       
+       #value_changed
+       set_position_node = None
+       set_orientation_node = None
+       time_node = None
+       
+       for field in node.fields:
+               if field and field[0]=='ROUTE':
+                       try:
+                               from_id, from_type = field[1].split('.')
+                               to_id, to_type = field[3].split('.')
+                       except:
+                               print "Warning, invalid ROUTE", field
+                               continue
+                       
+                       if from_type == 'value_changed':
+                               if to_type == 'set_position':
+                                       ipo = getIpo(to_id)
+                                       set_data_from_node = defDict[from_id]
+                                       translatePositionInterpolator(set_data_from_node, ipo, ancestry)
+                               
+                               if to_type in ('set_orientation', 'rotation'):
+                                       ipo = getIpo(to_id)
+                                       set_data_from_node = defDict[from_id]
+                                       translateOrientationInterpolator(set_data_from_node, ipo, ancestry)
+                               
+                               if to_type == 'set_scale':
+                                       ipo = getIpo(to_id)
+                                       set_data_from_node = defDict[from_id]
+                                       translateScalarInterpolator(set_data_from_node, ipo, ancestry)
+                               
+                       elif from_type =='bindTime':
+                               ipo = getIpo(from_id)
+                               time_node = defDict[to_id]
+                               translateTimeSensor(time_node, ipo, ancestry)
+                       
+               
+
 
 def load_web3d(path, PREF_FLAT=False, PREF_CIRCLE_DIV=16, HELPER_FUNC = None):
        
@@ -1809,6 +2414,16 @@ def load_web3d(path, PREF_FLAT=False, PREF_CIRCLE_DIV=16, HELPER_FUNC = None):
                #       continue
                
                spec = node.getSpec()
+               '''
+               prefix = node.getPrefix()
+               if prefix=='PROTO':
+                       pass
+               else
+               '''
+               if HELPER_FUNC and HELPER_FUNC(node, ancestry):
+                       # Note, include this function so the VRML/X3D importer can be extended
+                       # by an external script. - gets first pick 
+                       pass
                if spec=='Shape':
                        importShape(node, ancestry)
                elif spec in ('PointLight', 'DirectionalLight', 'SpotLight'):
@@ -1818,14 +2433,38 @@ def load_web3d(path, PREF_FLAT=False, PREF_CIRCLE_DIV=16, HELPER_FUNC = None):
                elif spec=='Transform':
                        # Only use transform nodes when we are not importing a flat object hierarchy
                        if PREF_FLAT==False:
-                               importTransform(node, ancestry)                 
-               else:
-                       
-                       # Note, include this function so the VRML/X3D importer can be extended
-                       # by an external script.
-                       if HELPER_FUNC:
-                               HELPER_FUNC(node, ancestry)
+                               importTransform(node, ancestry)
+                       '''
+               # These are delt with later within importRoute
+               elif spec=='PositionInterpolator':
+                       ipo = bpy.data.ipos.new('web3d_ipo', 'Object')
+                       translatePositionInterpolator(node, ipo)
+                       '''
+       
+       
+       
+       # After we import all nodes, route events - anim paths
+       for node, ancestry in all_nodes:
+               importRoute(node, ancestry)
+       
+       for node, ancestry in all_nodes:
+               if node.isRoot():
+                       # we know that all nodes referenced from will be in 
+                       # routeIpoDict so no need to run node.getDefDict() for every node.
+                       routeIpoDict = node.getRouteIpoDict()
+                       defDict = node.getDefDict()
                        
+                       for key, ipo in routeIpoDict.iteritems():
+                               
+                               # Assign anim curves
+                               node = defDict[key]
+                               if node.blendObject==None: # Add an object if we need one for animation
+                                       node.blendObject = bpy.data.scenes.active.objects.new('Empty', 'AnimOb') # , name)
+                                       
+                               node.blendObject.setIpo(ipo)
+
+       
+       
        # Add in hierarchy
        if PREF_FLAT==False:
                child_dict = {}
@@ -1886,7 +2525,7 @@ def load_ui(path):
 if __name__ == '__main__':
        Window.FileSelector(load_ui, 'Import X3D/VRML97')
        
-       
+
 # Testing stuff
 
 # load_web3d('/test.x3d')
@@ -1921,24 +2560,32 @@ if __name__ == '__main__':
 
 # load_web3d('/fe/x3d/www.web3d.org/x3d/content/examples/Basic/StudentProjects/PlayRoom.x3d') # invalid UVs
 
-'''
-import os
-# files = os.popen('find /fe/wrl -iname "*.wrl"').readlines()
-# files = os.popen('find /fe/x3d -iname "*.x3d"').readlines()
-files = os.popen('find   /fe/x3d/X3dExamplesSavage   -iname "*.x3d"').readlines()
 
-files.sort()
-tot = len(files)
-for i, f in enumerate(files):
-       if i < 12803 or i > 1000000:
-               continue
-       #if i != 12686:
-       #       continue
+
+def test():
+       import os
        
-       f = f.strip()
-       print f, i, tot
-       sce = bpy.data.scenes.new(f.split('/')[-1])
-       bpy.data.scenes.active = sce
-       # Window.
-       load_web3d(f, PREF_FLAT=True)
-'''
\ No newline at end of file
+       files = os.popen('find /fe/wrl -iname "*.wrl"').readlines()
+       # files = os.popen('find /fe/x3d -iname "*.x3d"').readlines()
+       # files = os.popen('find   /fe/x3d/X3dExamplesSavage   -iname "*.x3d"').readlines()
+
+       files.sort()
+       tot = len(files)
+       for i, f in enumerate(files):
+               if i < 124 or i > 1000000:
+                       continue
+               
+               #if i != 1068:
+               #       continue
+               
+               #if i != 12686:
+               #       continue
+               
+               f = f.strip()
+               print f, i, tot
+               sce = bpy.data.scenes.new(str(i) + '_' + f.split('/')[-1])
+               bpy.data.scenes.active = sce
+               # Window.
+               load_web3d(f, PREF_FLAT=True)
+       
+# test()
index 006bdf10b49f3b38e0c72c44c96b8c8d528ffd73..670165dda51cdaba6814b4837519114b6e11f091 100644 (file)
@@ -112,7 +112,7 @@ def mesh2polys():
        Window.EditMode(0)
        me = meshOb.getData(mesh=1)
        polygons= polysFromMesh(me)
-       w=t=1
+       w = 1.0
        cu= Curve.New()
        cu.name = me.name
        cu.setFlag(1)
@@ -128,7 +128,7 @@ def mesh2polys():
                        vIdx= 0
                
                v= poly[vIdx]
-               cu.appendNurb([v.co.x, v.co.y, v.co.z, w, t])
+               cu.appendNurb((v.co.x, v.co.y, v.co.z, w))
                vIdx += 1
                cu[i].type= 0 # Poly Line
                
@@ -139,7 +139,7 @@ def mesh2polys():
                # Add all the points in the polyline.
                while vIdx<len(poly):
                        v= poly[vIdx]
-                       cu.appendPoint(i, [v.co.x, v.co.y, v.co.z, w])
+                       cu.appendPoint(i, (v.co.x, v.co.y, v.co.z, w))
                        vIdx+=1
                i+=1
        Window.WaitCursor(0)
diff --git a/release/scripts/scripttemplate_background_job.py b/release/scripts/scripttemplate_background_job.py
new file mode 100644 (file)
index 0000000..86b5899
--- /dev/null
@@ -0,0 +1,124 @@
+#!BPY
+"""
+Name: 'Background Job Example'
+Blender: 248
+Group: 'ScriptTemplate'
+Tooltip: 'Script template for automating tasks from the command line with blender'
+"""
+
+from Blender import Window
+import bpy
+
+script_data = \
+'''# This script is an example of how you can run blender from the command line (in background mode with no interface)
+# to automate tasks, in this example it creates a text object, camera and light, then renders and/or saves it.
+# This example also shows how you can parse command line options to python scripts.
+# 
+# Example usage for this test.
+#  blender -b -P $HOME/background_job.py -- --text="Hello World" --render="/tmp/hello" --save="/tmp/hello.blend"
+# 
+# Notice all python args are after the '--' argument.
+
+import Blender
+import bpy
+
+def example_function(body_text, save_path, render_path):
+       
+       sce= bpy.data.scenes.active
+
+       txt_data= bpy.data.curves.new('MyText', 'Text3d')
+       
+       # Text Object
+       txt_ob = sce.objects.new(txt_data)                      # add the data to the scene as an object
+       txt_data.setText(body_text)                                     # set the body text to the command line arg given
+       txt_data.setAlignment(Blender.Text3d.MIDDLE)# center text
+       
+       # Camera
+       cam_data= bpy.data.cameras.new('MyCam')         # create new camera data
+       cam_ob= sce.objects.new(cam_data)                       # add the camera data to the scene (creating a new object)
+       sce.objects.camera= cam_ob                                      # set the active camera
+       cam_ob.loc= 0,0,10
+       
+       # Lamp
+       lamp_data= bpy.data.lamps.new('MyLamp')
+       lamp_ob= sce.objects.new(lamp_data)
+       lamp_ob.loc= 2,2,5
+
+       if save_path:
+               try:
+                       f= open(save_path, 'w')
+                       f.close()
+                       ok= True
+               except:
+                       print 'Cannot save to path "%s"' % save_path
+                       ok= False
+               
+               if ok:
+                       Blender.Save(save_path, 1)
+       
+       if render_path:
+               render= sce.render
+               render.extensions= True
+               render.renderPath = render_path
+               render.sFrame= 1
+               render.eFrame= 1
+               render.renderAnim()
+
+
+
+import sys             # to get command line args
+import optparse        # to parse options for us and print a nice help message
+
+script_name= 'background_job.py'
+
+def main():
+       
+       # get the args passed to blender after "--", all of which are ignored by blender specifically
+       # so python may receive its own arguments
+       argv= sys.argv
+
+       if '--' not in argv:
+               argv = [] # as if no args are passed
+       else:   
+               argv = argv[argv.index('--')+1: ] # get all args after "--"
+       
+       # When --help or no args are given, print this help
+       usage_text =  'Run blender in background mode with this script:\n'
+       usage_text += '  blender -b -P ' + script_name + ' -- [options]'
+                       
+       parser = optparse.OptionParser(usage = usage_text)
+       
+
+       # Example background utility, add some text and renders or saves it (with options)
+       # Possible types are: string, int, long, choice, float and complex.
+       parser.add_option('-t', '--text', dest='body_text', help='This text will be used to render an image', type='string')
+
+       parser.add_option('-s', '--save', dest='save_path', help='Save the generated file to the specified path', metavar='FILE')
+       parser.add_option('-r', '--render', dest='render_path', help='Render an image to the specified path', metavar='FILE')
+
+       options, args = parser.parse_args(argv) # In this example we wont use the args
+       
+       if not argv:
+               parser.print_help()
+               return
+
+       if not options.body_text:
+               print 'Error: --text="some string" argument not given, aborting.\n'
+               parser.print_help()
+               return
+       
+       # Run the example function
+       example_function(options.body_text, options.save_path, options.render_path)
+
+       print 'batch job finished, exiting'
+
+
+if __name__ == '__main__':
+       main()
+'''
+
+new_text = bpy.data.texts.new('background_job.py')
+new_text.write(script_data)
+bpy.data.texts.active = new_text
+Window.RedrawAll()
+
index 79a445329cccfc14a4aa8dd0885f9e8588bebec4..83df200991f24e112dfb55e0124bf7a8c642cf9c 100644 (file)
@@ -42,28 +42,15 @@ from Blender import *
 import bpy
 import BPyMesh
 
-def extend():
-       sce = bpy.data.scenes.active
-       ob = sce.objects.active
-       
-       # print ob, ob.type
-       if ob == None or ob.type != 'Mesh':
-               Draw.PupMenu('ERROR: No mesh object.')
+def extend(EXTEND_MODE,ob):
+       if EXTEND_MODE == -1:
                return
-       
-       # Toggle Edit mode
+       me = ob.getData(mesh=1)
+       me_verts = me.verts
+               # Toggle Edit mode
        is_editmode = Window.EditMode()
        if is_editmode:
                Window.EditMode(0)
-       
-       me = ob.getData(mesh=1)
-       me_verts = me.verts
-       
-       # 0:normal extend, 1:edge length
-       EXTEND_MODE = Draw.PupMenu("Use Face Area%t|Loop Average%x2|None%x0")
-       if EXTEND_MODE == -1:
-               return
-       
        Window.WaitCursor(1)
        t = sys.time()
        edge_average_lengths = {}
@@ -153,8 +140,7 @@ def extend():
                        uvs_vhash_target[edgepair_outer_target[iA]][:] = uvs_vhash_source[edgepair_inner_source[1]] + (uvs_vhash_source[edgepair_inner_source[1]] - uvs_vhash_source[edgepair_outer_source[0]])
        
        if not me.faceUV:
-               Draw.PupMenu('ERROR: Mesh has no face UV coords.')
-               return
+               me.faceUV= True
        
        face_act =      me.activeFace
        if face_act == -1:
@@ -247,7 +233,22 @@ def extend():
        Window.RedrawAll()
        Window.WaitCursor(0)
 
-if __name__ == '__main__':
-       extend()
+
+def main():
+       sce = bpy.data.scenes.active
+       ob = sce.objects.active
+       
+       # print ob, ob.type
+       if ob == None or ob.type != 'Mesh':
+               Draw.PupMenu('ERROR: No mesh object.')
+               return
        
-       
\ No newline at end of file
+
+       
+       # 0:normal extend, 1:edge length
+       EXTEND_MODE = Draw.PupMenu("Use Face Area%t|Loop Average%x2|None%x0")
+       extend(EXTEND_MODE,ob)
+
+if __name__ == '__main__':
+       main()
+
index 0bba747e010cb73968f667eb0f80bfec603f28a2..130a7e5af7729e83fa1680e43ad5f9b7f451e381 100644 (file)
@@ -171,6 +171,9 @@ def main():
                f_uv = f.uv
                return [(v.co-face_corner_main, f_uv[i]) for i,v in enumerate(f.v)]
        
+       if me.faceUV==False:
+               me.faceUV= True
+
        coords = [ (co,uv) for f in me.faces if f.sel for co, uv in get_face_coords(f)]
        
        coords_orig = [uv.copy() for co, uv in coords]
@@ -264,4 +267,5 @@ def main():
        
 if __name__=='__main__':
        main()
-       Window.DrawProgressBar(1.0, '')
\ No newline at end of file
+       Window.DrawProgressBar(1.0, '')
+
index 2df5b7e721fcfe186ddbedd8ba91d939392d46dd..9668c521f3a2553bd0a974d65155bb056dbb2745 100644 (file)
@@ -27,6 +27,7 @@ def matcol(mat):
                int(mat.R*255),\
                int(mat.G*255),\
                int(mat.B*255)
+       else:
                return None
 
 def mat2vcol(PREF_SEL_FACES_ONLY, PREF_ACTOB_ONLY, PREF_MULTIPLY_COLOR):
@@ -47,7 +48,7 @@ def mat2vcol(PREF_SEL_FACES_ONLY, PREF_ACTOB_ONLY, PREF_MULTIPLY_COLOR):
                me= ob.getData(mesh=1)
                
                try:
-                       me.faceUV=True
+                       me.vertexColors=True
                except: # no faces
                        continue
                
index 662cb1df0a6e28a8258e52487342f177d8bbf951..e9671cdae35e8877dbaadc147079d69014cdc044 100644 (file)
@@ -194,7 +194,7 @@ ifeq ($(WITH_FREETYPE2), true)
     else
       COMLIB += $(NAN_FTGL)/lib/libftgl.a
       ifeq ($(OS), irix)
-        COMLIB += $(NAN_FREETYPE)/lib32/libfreetype.a
+        COMLIB += $(NAN_FREETYPE)/lib/libfreetype.a
         else
             COMLIB += $(NAN_FREETYPE)/lib/libfreetype.a
       endif
@@ -395,9 +395,16 @@ else
         NAN_SND_LIBS += $(ALUT)
         NAN_SND_LIBS += $(SOUNDSYSTEM)
       else
-        NAN_SND_LIBS =  $(SOUNDSYSTEM)
-        NAN_SND_LIBS += $(DUMMYSOUND)
-        NAN_SND_LIBS += $(SOUNDSYSTEM)
+        ifeq ($(OS), irix)
+           NAN_SND_LIBS = $(SOUNDSYSTEM)
+           NAN_SND_LIBS += $(DUMMYSOUND)
+           NAN_SND_LIBS += $(SDLSOUND)
+           NAN_SND_LIBS += $(SOUNDSYSTEM)
+        else
+           NAN_SND_LIBS =  $(SOUNDSYSTEM)
+           NAN_SND_LIBS += $(DUMMYSOUND)
+           NAN_SND_LIBS += $(SOUNDSYSTEM)
+        endif
       endif
     endif
   endif
index db6d4762b17f7a01a6a33e65e2c1e7461eedca05..2c7502afa444cb25230831b0f135fb3ba8063cec 100644 (file)
@@ -1,3 +1,4 @@
+
 /**
  * blenlib/BKE_blender.h (mar-2001 nzc)
  *     
index f1f4653f092233bb194db32c059c26ebdf7e8c1b..398d203709f0f1c5693b1d5e1362937854beda90 100644 (file)
@@ -53,6 +53,7 @@ int brush_clone_image_delete(struct Brush *brush);
 
 /* sampling */
 float brush_sample_falloff(struct Brush *brush, float dist);
+float brush_sample_falloff_noalpha(struct Brush *brush, float dist);
 void brush_sample_tex(struct Brush *brush, float *xy, float *rgba);
 void brush_imbuf_new(struct Brush *brush, short flt, short texfalloff, int size,
        struct ImBuf **imbuf);
index c84b690bc49d419764b5c5d46aeba2db9a1e4121..10791968f7958abc98dcbfbad0851f0df796dbc3 100644 (file)
@@ -198,8 +198,12 @@ int CustomData_get_layer_index(const struct CustomData *data, int type);
 int CustomData_get_named_layer_index(const struct CustomData *data, int type, char *name);
 int CustomData_get_active_layer_index(const struct CustomData *data, int type);
 int CustomData_get_render_layer_index(const struct CustomData *data, int type);
+int CustomData_get_clone_layer_index(const struct CustomData *data, int type);
+int CustomData_get_mask_layer_index(const struct CustomData *data, int type);
 int CustomData_get_active_layer(const struct CustomData *data, int type);
 int CustomData_get_render_layer(const struct CustomData *data, int type);
+int CustomData_get_clone_layer(const struct CustomData *data, int type);
+int CustomData_get_mask_layer(const struct CustomData *data, int type);
 
 /* copies the data from source to the data element at index in the first
  * layer of type
@@ -227,10 +231,14 @@ void *CustomData_set_layer_n(const struct CustomData *data, int type, int n, voi
 /* sets the nth layer of type as active */
 void CustomData_set_layer_active(struct CustomData *data, int type, int n);
 void CustomData_set_layer_render(struct CustomData *data, int type, int n);
+void CustomData_set_layer_clone(struct CustomData *data, int type, int n);
+void CustomData_set_layer_mask(struct CustomData *data, int type, int n);
 
 /* same as above but works with an index from CustomData_get_layer_index */
 void CustomData_set_layer_active_index(struct CustomData *data, int type, int n);
 void CustomData_set_layer_render_index(struct CustomData *data, int type, int n);
+void CustomData_set_layer_clone_index(struct CustomData *data, int type, int n);
+void CustomData_set_layer_mask_index(struct CustomData *data, int type, int n);
 
 /* adds flag to the layer flags */
 void CustomData_set_layer_flag(struct CustomData *data, int type, int flag);
index 3a2dca525b8d484e23b2a6020dd6c48e8ce7eab8..e8918bcdce6ff82b9302c79cd8960607b2429ef4 100644 (file)
@@ -227,6 +227,7 @@ typedef struct Global {
 #define G_FILE_GLSL_NO_RAMPS    (1 << 19)
 #define G_FILE_GLSL_NO_NODES    (1 << 20)
 #define G_FILE_GLSL_NO_EXTRA_TEX (1 << 21)
+#define G_FILE_IGNORE_DEPRECATION_WARNINGS     (1 << 22)
 
 /* G.windowstate */
 #define G_WINDOWSTATE_USERDEF          0
index fa3a654c1c271572c096b517d859716061ac97cf..1c5b6b124b288e228202e4d24ae1719e083321c1 100644 (file)
@@ -401,6 +401,8 @@ struct TexResult;
 #define TEX_NODE_ROTATE     114
 #define TEX_NODE_VIEWER     115
 #define TEX_NODE_TRANSLATE  116
+#define TEX_NODE_COORD      117
+#define TEX_NODE_DISTANCE   118
 
 /* 201-299 reserved. Use like this: TEX_NODE_PROC + TEX_CLOUDS, etc */
 #define TEX_NODE_PROC      200
index 0ed4f38e457bffbf932c3131d49ece2d22d47a1e..04ca5c79a113d7eaf815c0139b9829f733b6d52c 100644 (file)
@@ -65,8 +65,6 @@ IF(WITH_PLAYER)
   SUBDIRS(bad_level_call_stubs)
 ENDIF(WITH_PLAYER)
 
-ADD_DEFINITIONS(-DWITH_CCGSUBSURF)
-
 BLENDERLIB(bf_blenkernel "${SRC}" "${INC}")
 
 IF(WITH_VERSE)
index ab122e40bfc06de55e6fb32cdc9cdf4f6c969680..fb67c855b81876eb159ca621887f22c1db6d5c87 100644 (file)
@@ -42,6 +42,9 @@ if env['WITH_BF_VERSE']:
 if env['WITH_BF_OPENEXR']:
     defs += ' WITH_OPENEXR'
 
+if env['WITH_BF_OPENJPEG']:
+    defs += ' WITH_OPENJPEG'
+
 if env['WITH_BF_DDS']:
     defs += ' WITH_DDS'
 
@@ -53,6 +56,9 @@ if env['WITH_BF_QUICKTIME']:
     defs += ' WITH_QUICKTIME'
     incs += ' ' + env['BF_QUICKTIME_INC']
 
+if env['WITH_BF_BULLET']:
+    defs += ' WITH_BULLET'
+
 if env['BF_NO_ELBEEM']:
     defs += ' DISABLE_ELBEEM'
 
index 1c53af97dbb86a2f52eb0e54170463a53f89a9fa..021f76fd2f135df7ea68c8dd2f1c01bbbddf949e 100644 (file)
@@ -328,6 +328,23 @@ float brush_sample_falloff(Brush *brush, float dist)
                return 0.0f;
 }
 
+float brush_sample_falloff_noalpha(Brush *brush, float dist)
+{
+       float outer, inner;
+
+       outer = brush->size >> 1;
+       inner = outer*brush->innerradius;
+
+       if (dist <= inner) {
+               return 1.0f;
+       }
+       else if ((dist < outer) && (inner < outer)) {
+               return 1.0f - sqrt((dist - inner)/(outer - inner));
+       }
+       else 
+               return 0.0f;
+}
+
 void brush_sample_tex(Brush *brush, float *xy, float *rgba)
 {
        MTex *mtex= brush->mtex[brush->texact];
index 775f1dee241be01f004eaf36475697bd71e07d21..0b5465ea25d1cd6421fd0215328655ac07e5e133 100644 (file)
@@ -1236,7 +1236,7 @@ int cloth_collision_moving_edges ( ClothModifierData *clmd, CollisionModifierDat
                                                if(out_normalVelocity < 0.0)
                                                {
                                                        out_normalVelocity*= -1.0;
-                                                       VecMulf(out_normal, -1.0);
+                                                       VecNegf(out_normal);
                                                }
 */
                                                /* Inelastic repulsion impulse. */
index 5639f00ee39fce2a4b2895b80917c9bb946a8032..b668a1f214db8864b8e794f9eabaf2a612c059c7 100644 (file)
@@ -1044,7 +1044,7 @@ static void vectomat (float *vec, float *target_up, short axis, short upflag, sh
                n[2] = 1.0;
        }
        if (axis > 2) axis -= 3;
-       else VecMulf(n,-1);
+       else VecNegf(n);
 
        /* n specifies the transformation of the track axis */
        if (flags & TARGET_Z_UP) { 
@@ -2182,7 +2182,7 @@ static void locktrack_evaluate (bConstraint *con, bConstraintOb *cob, ListBase *
                                        Projf(vec2, vec, cob->matrix[0]);
                                        VecSubf(totmat[1], vec, vec2);
                                        Normalize(totmat[1]);
-                                       VecMulf(totmat[1],-1);
+                                       VecNegf(totmat[1]);
                                        
                                        /* the x axis is fixed */
                                        totmat[0][0] = cob->matrix[0][0];
@@ -2200,7 +2200,7 @@ static void locktrack_evaluate (bConstraint *con, bConstraintOb *cob, ListBase *
                                        Projf(vec2, vec, cob->matrix[0]);
                                        VecSubf(totmat[2], vec, vec2);
                                        Normalize(totmat[2]);
-                                       VecMulf(totmat[2],-1);
+                                       VecNegf(totmat[2]);
                                                
                                        /* the x axis is fixed */
                                        totmat[0][0] = cob->matrix[0][0];
@@ -2265,7 +2265,7 @@ static void locktrack_evaluate (bConstraint *con, bConstraintOb *cob, ListBase *
                                        Projf(vec2, vec, cob->matrix[1]);
                                        VecSubf(totmat[0], vec, vec2);
                                        Normalize(totmat[0]);
-                                       VecMulf(totmat[0],-1);
+                                       VecNegf(totmat[0]);
                                        
                                        /* the y axis is fixed */
                                        totmat[1][0] = cob->matrix[1][0];
@@ -2283,7 +2283,7 @@ static void locktrack_evaluate (bConstraint *con, bConstraintOb *cob, ListBase *
                                        Projf(vec2, vec, cob->matrix[1]);
                                        VecSubf(totmat[2], vec, vec2);
                                        Normalize(totmat[2]);
-                                       VecMulf(totmat[2],-1);
+                                       VecNegf(totmat[2]);
                                        
                                        /* the y axis is fixed */
                                        totmat[1][0] = cob->matrix[1][0];
@@ -2348,7 +2348,7 @@ static void locktrack_evaluate (bConstraint *con, bConstraintOb *cob, ListBase *
                                        Projf(vec2, vec, cob->matrix[2]);
                                        VecSubf(totmat[0], vec, vec2);
                                        Normalize(totmat[0]);
-                                       VecMulf(totmat[0],-1);
+                                       VecNegf(totmat[0]);
                                        
                                        /* the z axis is fixed */
                                        totmat[2][0] = cob->matrix[2][0];
@@ -2366,7 +2366,7 @@ static void locktrack_evaluate (bConstraint *con, bConstraintOb *cob, ListBase *
                                        Projf(vec2, vec, cob->matrix[2]);
                                        VecSubf(totmat[1], vec, vec2);
                                        Normalize(totmat[1]);
-                                       VecMulf(totmat[1],-1);
+                                       VecNegf(totmat[1]);
                                        
                                        /* the z axis is fixed */
                                        totmat[2][0] = cob->matrix[2][0];
index 1a671dfe771ec73d5ad2f473317280148ae1a421..7fa4f406c7b2bc2390c37f037306fe3c951f844e 100644 (file)
@@ -833,7 +833,6 @@ void makeNurbcurve(Nurb *nu, float *coord_array, float *tilt_array, float *radiu
        sum= (float *)MEM_callocN(sizeof(float)*len, "makeNurbcurve1");
        
        resolu= (resolu*SEGMENTSU(nu));
-       if((nu->flagu & CU_CYCLIC)==0) resolu++;
        
        if(resolu==0) {
                MEM_freeN(sum);
@@ -1685,7 +1684,6 @@ void makeBevelList(Object *ob)
                        else if((nu->type & 7)==CU_NURBS) {
                                if(nu->pntsv==1) {
                                        len= (resolu*SEGMENTSU(nu));
-                                       if((nu->flagu & CU_CYCLIC)==0) len++;
                                        
                                        bl= MEM_callocN(sizeof(BevList)+len*sizeof(BevPoint), "makeBevelList3");
                                        BLI_addtail(&(cu->bev), bl);
index e93266c85f301a422762309e707830267e5d2f3e..05271aa59a7a2ebb645d55d50d43c123af7875c8 100644 (file)
@@ -606,7 +606,7 @@ void CustomData_merge(const struct CustomData *source, struct CustomData *dest,
 {
        const LayerTypeInfo *typeInfo;
        CustomDataLayer *layer, *newlayer;
-       int i, type, number = 0, lasttype = -1, lastactive = 0, lastrender = 0;
+       int i, type, number = 0, lasttype = -1, lastactive = 0, lastrender = 0, lastclone = 0, lastmask = 0;
 
        for(i = 0; i < source->totlayer; ++i) {
                layer = &source->layers[i];
@@ -618,6 +618,8 @@ void CustomData_merge(const struct CustomData *source, struct CustomData *dest,
                        number = 0;
                        lastactive = layer->active;
                        lastrender = layer->active_rnd;
+                       lastclone = layer->active_clone;
+                       lastmask = layer->active_mask;
                        lasttype = type;
                }
                else
@@ -637,6 +639,8 @@ void CustomData_merge(const struct CustomData *source, struct CustomData *dest,
                if(newlayer) {
                        newlayer->active = lastactive;
                        newlayer->active_rnd = lastrender;
+                       newlayer->active_clone = lastclone;
+                       newlayer->active_mask = lastmask;
                }
        }
 }
@@ -736,6 +740,28 @@ int CustomData_get_render_layer_index(const CustomData *data, int type)
        return -1;
 }
 
+int CustomData_get_clone_layer_index(const CustomData *data, int type)
+{
+       int i;
+
+       for(i=0; i < data->totlayer; ++i)
+               if(data->layers[i].type == type)
+                       return i + data->layers[i].active_clone;
+
+       return -1;
+}
+
+int CustomData_get_mask_layer_index(const CustomData *data, int type)
+{
+       int i;
+
+       for(i=0; i < data->totlayer; ++i)
+               if(data->layers[i].type == type)
+                       return i + data->layers[i].active_mask;
+
+       return -1;
+}
+
 int CustomData_get_active_layer(const CustomData *data, int type)
 {
        int i;
@@ -758,6 +784,27 @@ int CustomData_get_render_layer(const CustomData *data, int type)
        return -1;
 }
 
+int CustomData_get_clone_layer(const CustomData *data, int type)
+{
+       int i;
+
+       for(i=0; i < data->totlayer; ++i)
+               if(data->layers[i].type == type)
+                       return data->layers[i].active_clone;
+
+       return -1;
+}
+
+int CustomData_get_mask_layer(const CustomData *data, int type)
+{
+       int i;
+
+       for(i=0; i < data->totlayer; ++i)
+               if(data->layers[i].type == type)
+                       return data->layers[i].active_mask;
+
+       return -1;
+}
 
 void CustomData_set_layer_active(CustomData *data, int type, int n)
 {
@@ -777,6 +824,24 @@ void CustomData_set_layer_render(CustomData *data, int type, int n)
                        data->layers[i].active_rnd = n;
 }
 
+void CustomData_set_layer_clone(CustomData *data, int type, int n)
+{
+       int i;
+
+       for(i=0; i < data->totlayer; ++i)
+               if(data->layers[i].type == type)
+                       data->layers[i].active_clone = n;
+}
+
+void CustomData_set_layer_mask(CustomData *data, int type, int n)
+{
+       int i;
+
+       for(i=0; i < data->totlayer; ++i)
+               if(data->layers[i].type == type)
+                       data->layers[i].active_mask = n;
+}
+
 /* for using with an index from CustomData_get_active_layer_index and CustomData_get_render_layer_index */
 void CustomData_set_layer_active_index(CustomData *data, int type, int n)
 {
@@ -796,6 +861,23 @@ void CustomData_set_layer_render_index(CustomData *data, int type, int n)
                        data->layers[i].active_rnd = n-i;
 }
 
+void CustomData_set_layer_clone_index(CustomData *data, int type, int n)
+{
+       int i;
+
+       for(i=0; i < data->totlayer; ++i)
+               if(data->layers[i].type == type)
+                       data->layers[i].active_clone = n-i;
+}
+
+void CustomData_set_layer_mask_index(CustomData *data, int type, int n)
+{
+       int i;
+
+       for(i=0; i < data->totlayer; ++i)
+               if(data->layers[i].type == type)
+                       data->layers[i].active_mask = n-i;
+}
 
 void CustomData_set_layer_flag(struct CustomData *data, int type, int flag)
 {
@@ -882,9 +964,13 @@ static CustomDataLayer *customData_add_layer__internal(CustomData *data,
        if(index > 0 && data->layers[index-1].type == type) {
                data->layers[index].active = data->layers[index-1].active;
                data->layers[index].active_rnd = data->layers[index-1].active_rnd;
+               data->layers[index].active_clone = data->layers[index-1].active_clone;
+               data->layers[index].active_mask = data->layers[index-1].active_mask;
        } else {
                data->layers[index].active = 0;
                data->layers[index].active_rnd = 0;
+               data->layers[index].active_clone = 0;
+               data->layers[index].active_mask = 0;
        }
        
        customData_update_offsets(data);
@@ -944,6 +1030,8 @@ int CustomData_free_layer(CustomData *data, int type, int totelem, int index)
                        for (; i < data->totlayer && data->layers[i].type == type; i++) {
                                data->layers[i].active--;
                                data->layers[i].active_rnd--;
+                               data->layers[i].active_clone--;
+                               data->layers[i].active_mask--;
                        }
        }
 
index 35097c053581d546eec72e4bec44781e697f5477..7716d71225eb9d76889b7bf785ed68fae63e7348 100644 (file)
@@ -887,7 +887,6 @@ static void curve_to_displist(Curve *cu, ListBase *nubase, ListBase *dispbase)
                        }
                        else if((nu->type & 7)==CU_NURBS) {
                                len= (resolu*SEGMENTSU(nu));
-                               if((nu->flagu & CU_CYCLIC)==0) len++;
                                
                                dl= MEM_callocN(sizeof(DispList), "makeDispListsurf");
                                dl->verts= MEM_callocN(len*3*sizeof(float), "dlverts");
@@ -1381,7 +1380,7 @@ void makeDispListSurf(Object *ob, ListBase *dispbase, int forRender)
        for (nu=nubase->first; nu; nu=nu->next) {
                if(forRender || nu->hide==0) {
                        if(nu->pntsv==1) {
-                               len= nu->pntsu*nu->resolu;
+                               len= SEGMENTSU(nu)*nu->resolu;
                                
                                dl= MEM_callocN(sizeof(DispList), "makeDispListsurf");
                                dl->verts= MEM_callocN(len*3*sizeof(float), "dlverts");
index f91a99accef3c116b082b27ceb0c6b6d62949073..b5d3213ac0adccc971856560343e9ef4c6a1521f 100644 (file)
@@ -251,7 +251,7 @@ static float eff_calc_visibility(Object *ob, float *co, float *dir)
                return 0;
        
        VECCOPY(norm, dir);
-       VecMulf(norm, -1.0);
+       VecNegf(norm);
        len = Normalize(norm);
        
        // check all collision objects
index d5166fc7a838d49075edf8c501eb3407f5e3ff55..e817c38618f3a2e389e7fe7202675aa2553d64db 100644 (file)
@@ -767,6 +767,10 @@ int BKE_imtype_to_ftype(int imtype)
                return RAWTGA;
        else if(imtype==R_HAMX)
                return AN_hamx;
+#ifdef WITH_OPENJPEG
+       else if(imtype==R_JP2)
+               return JP2;
+#endif
        else
                return JPG|90;
 }
@@ -801,6 +805,10 @@ int BKE_ftype_to_imtype(int ftype)
                return R_RAWTGA;
        else if(ftype == AN_hamx)
                return R_HAMX;
+#ifdef WITH_OPENJPEG
+       else if(ftype & JP2)
+               return R_JP2;
+#endif
        else
                return R_JPEG90;
 }
@@ -877,6 +885,12 @@ void BKE_add_image_extension(char *string, int imtype)
                if(!BLI_testextensie(string, ".tga"))
                        extension= ".tga";
        }
+#ifdef WITH_OPENJPEG
+       else if(imtype==R_JP2) {
+               if(!BLI_testextensie(string, ".jp2"))
+                       extension= ".jp2";
+       }
+#endif
        else { //   R_MOVIE, R_AVICODEC, R_AVIRAW, R_AVIJPEG, R_JPEG90, R_QUICKTIME etc
                if(!( BLI_testextensie(string, ".jpg") || BLI_testextensie(string, ".jpeg")))
                        extension= ".jpg";
@@ -1220,6 +1234,28 @@ int BKE_write_ibuf(ImBuf *ibuf, char *name, int imtype, int subimtype, int quali
        else if(imtype==R_HAMX) {
                ibuf->ftype= AN_hamx;
        }
+#ifdef WITH_OPENJPEG
+       else if(imtype==R_JP2) {
+               if(quality < 10) quality= 90;
+               ibuf->ftype= JP2|quality;
+               
+               if (subimtype & R_JPEG2K_16BIT) {
+                       ibuf->ftype |= JP2_16BIT;
+               } else if (subimtype & R_JPEG2K_12BIT) {
+                       ibuf->ftype |= JP2_12BIT;
+               }
+               
+               if (subimtype & R_JPEG2K_YCC) {
+                       ibuf->ftype |= JP2_YCC;
+               }
+               
+               if (subimtype & R_JPEG2K_CINE_PRESET) {
+                       ibuf->ftype |= JP2_CINE;
+                       if (subimtype & R_JPEG2K_CINE_48FPS)
+                               ibuf->ftype |= JP2_CINE_48FPS;
+               }
+       }
+#endif
        else {
                /* R_JPEG90, R_MOVIE, etc. default we save jpegs */
                if(quality < 10) quality= 90;
index ae81a31c37365b825dbfd6737fe9a315602a9213..4c84c56180c0a65d6a4879aa9433ce9c1d874119 100644 (file)
@@ -2886,6 +2886,8 @@ static void registerTextureNodes(ListBase *ntypelist)
        nodeRegisterType(ntypelist, &tex_node_curve_time);
        nodeRegisterType(ntypelist, &tex_node_invert);
        nodeRegisterType(ntypelist, &tex_node_hue_sat);
+       nodeRegisterType(ntypelist, &tex_node_coord);
+       nodeRegisterType(ntypelist, &tex_node_distance);
        
        nodeRegisterType(ntypelist, &tex_node_output);
        nodeRegisterType(ntypelist, &tex_node_viewer);
index 39226faff1e9275791a431384deacd7e7264e208..8a964c5b32eac7dec605fb953ed1d0a59e8cb452 100644 (file)
@@ -831,7 +831,7 @@ void psys_thread_distribute_particle(ParticleThread *thread, ParticleData *pa, C
                                        VecCopyf(tan,seam->tan);
                                        VecSubf(temp2,co1,temp);
                                        if(Inpf(tan,temp2)<0.0f)
-                                               VecMulf(tan,-1.0f);
+                                               VecNegf(tan);
                                }
                                for(w=0; w<maxw; w++){
                                        VecSubf(temp2,ptn[w].co,temp);
@@ -1877,7 +1877,7 @@ void reset_particle(ParticleData *pa, ParticleSystem *psys, ParticleSystemModifi
                }
                
                /* create rotation quat */
-               VecMulf(rot_vec,-1.0);
+               VecNegf(rot_vec);
                vectoquat(rot_vec, OB_POSX, OB_POSZ, q2);
 
                /* randomize rotation quat */
@@ -3022,7 +3022,7 @@ static void particle_intersect_face(void *userdata, int index, const BVHTreeRay
                                        CalcNormFloat(t0, t1, t2, col->nor);
                                        VECSUB(temp, co2, co1);
                                        if(Inpf(col->nor, temp) > 0.0f)
-                                               VecMulf(col->nor, -1.0f);
+                                               VecNegf(col->nor);
 
                                        VECCOPY(col->vel,vel);
 
@@ -3802,7 +3802,7 @@ static void boid_body(BoidVecFunc *bvf, ParticleData *pa, ParticleSystem *psys,
        VecRotToQuat(pa->state.vel,bank,q);
 
        VECCOPY(dvec,pa->state.vel);
-       VecMulf(dvec,-1.0f);
+       VecNegf(dvec);
        vectoquat(dvec, OB_POSX, OB_POSZ, q2);
 
        QuatMul(pa->state.rot,q,q2);
index d59fd3d52e011f16f74b1f14f5937f7a319454a3..8123e9b067ecf3629e82724c8c0521d7da176749 100644 (file)
@@ -241,6 +241,7 @@ int VecLen(int *v1, int *v2);
 float VecLenf(float *v1, float *v2);
 float VecLength(float *v);
 void VecMulf(float *v1, float f);
+void VecNegf(float *v1);
 
 int VecLenCompare(float *v1, float *v2, float limit);
 int VecCompare(float *v1, float *v2, float limit);
index 5cfee8bf7846c4331f1199526d7595ca81fa5d04..96016eda1faa628828f9d67f26085ac8a4d7e026 100644 (file)
@@ -2190,6 +2190,13 @@ void VecMulf(float *v1, float f)
        v1[2]*= f;
 }
 
+void VecNegf(float *v1)
+{
+       v1[0] = -v1[0];
+       v1[1] = -v1[1];
+       v1[2] = -v1[2];
+}
+
 void VecOrthoBasisf(float *v, float *v1, float *v2)
 {
        float f = sqrt(v[0]*v[0] + v[1]*v[1]);
@@ -3958,7 +3965,7 @@ int SweepingSphereIntersectsTriangleUV(float p1[3], float p2[3], float radius, f
        Normalize(nor);
 
        /* flip normal */
-       if(Inpf(nor,vel)>0.0f) VecMulf(nor,-1.0f);
+       if(Inpf(nor,vel)>0.0f) VecNegf(nor);
        
        a=Inpf(p1,nor)-Inpf(v0,nor);
        nordotv=Inpf(nor,vel);
@@ -4629,7 +4636,7 @@ void tangent_from_uv(float *uv1, float *uv2, float *uv3, float *co1, float *co2,
 
        /* check flip */
        if ((ct[0]*n[0] + ct[1]*n[1] + ct[2]*n[2]) < 0.0f)
-               VecMulf(tang, -1.0f);
+               VecNegf(tang);
 }
 
 /* used for zoom values*/
index 8f35b38379e6c0b83f21f909ee286566b5a363ce..bcd8a2ce7cdd97e2353a7729fb09dc6f201ad7f7 100644 (file)
@@ -809,15 +809,15 @@ static void testAxialSymmetry(BGraph *graph, BNode* root_node, BNode* node1, BNo
        
        if (abs(nor[0]) > abs(nor[1]) && abs(nor[0]) > abs(nor[2]) && nor[0] < 0)
        {
-               VecMulf(nor, -1);
+               VecNegf(nor);
        }
        else if (abs(nor[1]) > abs(nor[0]) && abs(nor[1]) > abs(nor[2]) && nor[1] < 0)
        {
-               VecMulf(nor, -1);
+               VecNegf(nor);
        }
        else if (abs(nor[2]) > abs(nor[1]) && abs(nor[2]) > abs(nor[0]) && nor[2] < 0)
        {
-               VecMulf(nor, -1);
+               VecNegf(nor);
        }
        
        /* mirror node2 along axis */
index ca7a376d3a2bc96235d1f48e05e183022cbe68ff..8ba03ad1343ac7e593b353fd5233c02c021a7671 100644 (file)
@@ -47,9 +47,9 @@
 #include <time.h>
 #include <sys/stat.h>
 
-#if defined (__sun__) || defined (__sun)
+#if defined (__sun__) || defined (__sun) || defined (__sgi)
 #include <sys/statvfs.h> /* Other modern unix os's should probably use this also */
-#elif !defined(__FreeBSD__) && !defined(linux) && (defined(__sgi) || defined(__sparc) || defined(__sparc__))
+#elif !defined(__FreeBSD__) && !defined(linux) && (defined(__sparc) || defined(__sparc__))
 #include <sys/statfs.h>
 #endif
 
@@ -179,7 +179,7 @@ double BLI_diskfree(char *dir)
        return (double) (freec*bytesps*sectorspc);
 #else
 
-#if defined (__sun__) || defined (__sun)
+#if defined (__sun__) || defined (__sun) || defined (__sgi)
        struct statvfs disk;
 #else
        struct statfs disk;
@@ -204,9 +204,9 @@ double BLI_diskfree(char *dir)
        return -1;
 #endif
 
-#if defined (__sun__) || defined (__sun)
+#if defined (__sun__) || defined (__sun) || defined (__sgi)
        if (statvfs(name, &disk)) return(-1);   
-#elif !defined(__FreeBSD__) && !defined(linux) && (defined (__sgi) || defined(__sparc) || defined(__sparc__))
+#elif !defined(__FreeBSD__) && !defined(linux) && (defined(__sparc) || defined(__sparc__))
        /* WARNING - This may not be supported by geeneric unix os's - Campbell */
        if (statfs(name, &disk, sizeof(struct statfs), 0)) return(-1);
 #endif
index 7993d2eec890dc3474e1d4332446155f5b7a684b..664a57f2300a5f36ae99237beb154fde1186500b 100644 (file)
@@ -3191,6 +3191,7 @@ static void direct_link_modifiers(FileData *fd, ListBase *lb)
                        FluidsimModifierData *fluidmd = (FluidsimModifierData*) md;
                        
                        fluidmd->fss= newdataadr(fd, fluidmd->fss);
+                       fluidmd->fss->meshSurfNormals = 0;
                }
                else if (md->type==eModifierType_Collision) {
                        
@@ -7870,6 +7871,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
                                
                                fluidmd->fss->lastgoodframe = INT_MAX;
                                fluidmd->fss->flag = 0;
+                               fluidmd->fss->meshSurfNormals = 0;
                        }
                }
        }
@@ -8093,6 +8095,17 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
                }
        }
 
+       if (main->versionfile < 248 || (main->versionfile == 248 && main->subversionfile < 2)) {
+               Scene *sce;
+               
+               /* Note, these will need to be added for painting */
+               for (sce= main->scene.first; sce; sce= sce->id.next) {
+                       sce->toolsettings->imapaint.seam_bleed = 2;
+                       sce->toolsettings->imapaint.normal_angle = 80;
+               }
+       }
+       
+       
        /* WATCH IT!!!: pointers from libdata have not been converted yet here! */
        /* WATCH IT 2!: Userdef struct init has to be in src/usiblender.c! */
 
index 92cbd7dd0939ce347544bd636436700053ff388d..e7f328d870f8084f97b8d99417fffb85522f7e64 100644 (file)
 #endif
 #define RADHDR  (1<<24)
 
+#ifdef WITH_OPENJPEG
+#define JP2                            (1 << 18)
+#endif
+
 #define RAWTGA (TGA | 1)
 
 #define JPG_STD        (JPG | (0 << 8))
 #define IS_tim(x)              (x->ftype & TIM)
 #define IS_tiff(x)             (x->ftype & TIFF)
 #define IS_openexr(x)           (x->ftype & OPENEXR)
+#define IS_jp2(x)           (x->ftype & JP2)
 
 
 #define IMAGIC         0732
index 46df003cbbc0116cf51fe25a6b5875e6b82b7085..87703bc73bfc45af90107c311beafb5f918db921 100644 (file)
@@ -306,7 +306,7 @@ void GPU_material_bind_uniforms(GPUMaterial *material, float obmat[][4], float v
                        if(material->dynproperty & DYN_LAMP_VEC) {
                                VECCOPY(lamp->dynvec, lamp->vec);
                                Normalize(lamp->dynvec);
-                               VecMulf(lamp->dynvec, -1.0f);
+                               VecNegf(lamp->dynvec);
                                Mat4Mul3Vecfl(viewmat, lamp->dynvec);
                        }
 
index 73ef83393b02234adfda0c77f66974018803ab47..eadd7affe6aa2577766a975726eaa5955efc9318 100644 (file)
@@ -181,6 +181,15 @@ typedef enum {
 #define DDS                            (1 << 19)
 #endif
 
+#ifdef WITH_OPENJPEG
+#define JP2                            (1 << 18)
+#define JP2_12BIT                      (1 << 17)
+#define JP2_16BIT                      (1 << 16)
+#define JP2_YCC                        (1 << 15)
+#define JP2_CINE                       (1 << 14)
+#define JP2_CINE_48FPS         (1 << 13) 
+#endif
+
 #define RAWTGA         (TGA | 1)
 
 #define JPG_STD                (JPG | (0 << 8))
@@ -217,6 +226,7 @@ typedef enum {
 #define IS_tga(x)              (x->ftype & TGA)
 #define IS_png(x)              (x->ftype & PNG)
 #define IS_openexr(x)  (x->ftype & OPENEXR)
+#define IS_jp2(x)              (x->ftype & JP2)
 #define IS_cineon(x)   (x->ftype & CINEON)
 #define IS_dpx(x)              (x->ftype & DPX)
 #define IS_bmp(x)              (x->ftype & BMP)
diff --git a/source/blender/imbuf/intern/IMB_jp2.h b/source/blender/imbuf/intern/IMB_jp2.h
new file mode 100644 (file)
index 0000000..fcdd458
--- /dev/null
@@ -0,0 +1,49 @@
+/*
+ * IMB_jp2.h
+ *
+ * $Id: IMB_bmp.h 14444 2008-04-16 22:40:48Z hos $
+ *
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+ *
+ * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): none yet.
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+/**
+ * \file IMB_jp2.h
+ * \ingroup imbuf
+ * \brief Function declarations for jp2.c
+ */
+
+#ifndef IMB_JP2_H
+#define IMB_JP2_H
+
+#ifdef WITH_OPENJPEG
+struct ImBuf;
+
+int imb_is_a_jp2(void *buf);
+struct ImBuf *imb_jp2_decode(unsigned char *mem, int size, int flags);
+short imb_savejp2(struct ImBuf *ibuf, char *name, int flags);
+#endif /* WITH_OPENJPEG */
+
+#endif
+
index f25872538cfbab612efeebe5dc809eeef0110a8e..fe7e26eac2b427c15ab18811783d76e6b49f5c34 100644 (file)
@@ -80,16 +80,16 @@ void IMB_convert_rgba_to_abgr(struct ImBuf&n