svn merge -r 16866:17042 https://svn.blender.org/svnroot/bf-blender/trunk/blender
authorDaniel Genrich <daniel.genrich@gmx.net>
Sun, 12 Oct 2008 12:17:57 +0000 (12:17 +0000)
committerDaniel Genrich <daniel.genrich@gmx.net>
Sun, 12 Oct 2008 12:17:57 +0000 (12:17 +0000)
223 files changed:
CMakeLists.txt
config/linux2-config.py
config/win32-vc-config.py
doc/blender-scons.txt
extern/SConscript
extern/bullet2/src/BulletCollision/CollisionShapes/btTriangleIndexVertexArray.cpp
extern/bullet2/src/BulletCollision/Gimpact/btBoxCollision.h
extern/bullet2/src/BulletCollision/Gimpact/btClipPolygon.h
extern/bullet2/src/BulletCollision/Gimpact/btContactProcessing.h
extern/bullet2/src/BulletCollision/Gimpact/btGImpactBvh.cpp
extern/bullet2/src/BulletCollision/Gimpact/btGImpactBvh.h
extern/bullet2/src/BulletCollision/Gimpact/btGImpactCollisionAlgorithm.cpp
extern/bullet2/src/BulletCollision/Gimpact/btGImpactCollisionAlgorithm.h
extern/bullet2/src/BulletCollision/Gimpact/btGImpactMassUtil.h
extern/bullet2/src/BulletCollision/Gimpact/btGImpactQuantizedBvh.cpp
extern/bullet2/src/BulletCollision/Gimpact/btGImpactQuantizedBvh.h
extern/bullet2/src/BulletCollision/Gimpact/btGImpactShape.h
extern/bullet2/src/BulletCollision/Gimpact/btGenericPoolAllocator.cpp
extern/bullet2/src/BulletCollision/Gimpact/btGenericPoolAllocator.h
extern/bullet2/src/BulletCollision/Gimpact/btGeometryOperations.h
extern/bullet2/src/BulletCollision/Gimpact/btQuantization.h
extern/bullet2/src/BulletCollision/Gimpact/btTriangleShapeEx.cpp
extern/bullet2/src/BulletCollision/Gimpact/btTriangleShapeEx.h
extern/bullet2/src/BulletCollision/Gimpact/gim_array.h
extern/bullet2/src/BulletCollision/Gimpact/gim_basic_geometry_operations.h
extern/bullet2/src/BulletCollision/Gimpact/gim_bitset.h
extern/bullet2/src/BulletCollision/Gimpact/gim_box_collision.h
extern/bullet2/src/BulletCollision/Gimpact/gim_box_set.h
extern/bullet2/src/BulletCollision/Gimpact/gim_clip_polygon.h
extern/bullet2/src/BulletCollision/Gimpact/gim_contact.h
extern/bullet2/src/BulletCollision/Gimpact/gim_geom_types.h
extern/bullet2/src/BulletCollision/Gimpact/gim_geometry.h
extern/bullet2/src/BulletCollision/Gimpact/gim_hash_table.h
extern/bullet2/src/BulletCollision/Gimpact/gim_linear_math.h
extern/bullet2/src/BulletCollision/Gimpact/gim_math.h
extern/bullet2/src/BulletCollision/Gimpact/gim_memory.h
extern/bullet2/src/BulletCollision/Gimpact/gim_radixsort.h
extern/bullet2/src/BulletCollision/Gimpact/gim_tri_collision.cpp
extern/bullet2/src/BulletCollision/Gimpact/gim_tri_collision.h
extern/bullet2/src/BulletDynamics/Dynamics/btDiscreteDynamicsWorld.cpp
extern/bullet2/src/BulletSoftBody/btSoftBody.cpp
extern/bullet2/src/BulletSoftBody/btSoftBody.h
extern/bullet2/src/BulletSoftBody/btSoftRigidCollisionAlgorithm.cpp
extern/bullet2/src/LinearMath/btScalar.h
intern/SoundSystem/SND_Utils.h
intern/SoundSystem/fmod/SND_FmodDevice.cpp
intern/SoundSystem/intern/SND_Scene.cpp
intern/SoundSystem/intern/SND_SoundObject.cpp
intern/SoundSystem/intern/SND_Utils.cpp
intern/SoundSystem/sdl/SND_SDLCDDevice.cpp
intern/elbeem/intern/Makefile
intern/elbeem/intern/elbeem.cpp
intern/elbeem/intern/mvmcoords.cpp
intern/ghost/intern/GHOST_WindowWin32.cpp
release/scripts/bpymodules/dxfLibrary.py [new file with mode: 0644]
release/scripts/bvh_import.py
release/scripts/c3d_import.py
release/scripts/config.py
release/scripts/export_dxf.py
release/scripts/help_browser.py
release/scripts/vrml97_export.py
release/text/Python-license.txt
source/blender/blenkernel/BKE_blender.h
source/blender/blenkernel/BKE_displist.h
source/blender/blenkernel/BKE_global.h
source/blender/blenkernel/BKE_writeffmpeg.h
source/blender/blenkernel/intern/DerivedMesh.c
source/blender/blenkernel/intern/bullet.c
source/blender/blenkernel/intern/curve.c
source/blender/blenkernel/intern/displist.c
source/blender/blenkernel/intern/exotic.c
source/blender/blenkernel/intern/fluidsim.c
source/blender/blenkernel/intern/idprop.c
source/blender/blenkernel/intern/image.c
source/blender/blenkernel/intern/key.c
source/blender/blenkernel/intern/library.c
source/blender/blenkernel/intern/modifier.c
source/blender/blenkernel/intern/multires.c
source/blender/blenkernel/intern/particle_system.c
source/blender/blenkernel/intern/pointcache.c
source/blender/blenkernel/intern/writeffmpeg.c
source/blender/blenlib/intern/dynlib.c
source/blender/blenlib/intern/fileops.c
source/blender/blenlib/intern/util.c
source/blender/blenloader/intern/readfile.c
source/blender/gpu/intern/gpu_codegen.c
source/blender/gpu/intern/gpu_draw.c
source/blender/gpu/intern/gpu_material.c
source/blender/imbuf/intern/cineon/cineon_dpx.c
source/blender/imbuf/intern/cineon/cineonlib.c
source/blender/imbuf/intern/cineon/dpxlib.c
source/blender/imbuf/intern/dynlibtiff.c
source/blender/include/BDR_editobject.h
source/blender/include/BDR_gpencil.h
source/blender/include/BIF_drawgpencil.h
source/blender/include/BIF_editaction.h
source/blender/include/BIF_keyframing.h
source/blender/include/BSE_seqaudio.h
source/blender/makesdna/DNA_actuator_types.h
source/blender/makesdna/DNA_constraint_types.h
source/blender/makesdna/DNA_gpencil_types.h
source/blender/makesdna/DNA_object_fluidsim.h
source/blender/makesdna/DNA_sensor_types.h
source/blender/makesdna/DNA_userdef_types.h
source/blender/makesdna/DNA_view3d_types.h
source/blender/python/BPY_interface.c
source/blender/python/BPY_menus.c
source/blender/python/api2_2x/Ipocurve.c
source/blender/python/api2_2x/NMesh.c
source/blender/python/api2_2x/Object.c
source/blender/python/api2_2x/Particle.c
source/blender/python/api2_2x/Window.c
source/blender/python/api2_2x/doc/IpoCurve.py
source/blender/python/api2_2x/doc/Object.py
source/blender/render/extern/include/RE_shader_ext.h
source/blender/render/intern/include/shading.h
source/blender/render/intern/source/convertblender.c
source/blender/render/intern/source/rayshade.c
source/blender/render/intern/source/rendercore.c
source/blender/render/intern/source/shadeinput.c
source/blender/render/intern/source/zbuf.c
source/blender/src/SConscript
source/blender/src/buttons_editing.c
source/blender/src/buttons_logic.c
source/blender/src/buttons_object.c
source/blender/src/buttons_scene.c
source/blender/src/buttons_shading.c
source/blender/src/drawarmature.c
source/blender/src/drawgpencil.c
source/blender/src/drawimage.c
source/blender/src/drawnode.c
source/blender/src/drawobject.c
source/blender/src/drawseq.c
source/blender/src/drawtext.c
source/blender/src/drawtime.c
source/blender/src/drawview.c
source/blender/src/edit.c
source/blender/src/editaction_gpencil.c
source/blender/src/editmesh.c
source/blender/src/editmesh_lib.c
source/blender/src/editnode.c
source/blender/src/editobject.c
source/blender/src/editsound.c
source/blender/src/fluidsim.c
source/blender/src/ghostwinlay.c
source/blender/src/gpencil.c
source/blender/src/header_action.c
source/blender/src/header_view3d.c
source/blender/src/imagepaint.c
source/blender/src/interface.c
source/blender/src/keyframing.c
source/blender/src/playanim.c
source/blender/src/retopo.c
source/blender/src/seqaudio.c
source/blender/src/sequence.c
source/blender/src/space.c
source/blender/src/toets.c
source/blender/src/transform_conversions.c
source/blender/src/transform_manipulator.c
source/blender/src/transform_snap.c
source/blender/src/usiblender.c
source/blender/src/view.c
source/blender/yafray/intern/export_Plugin.cpp
source/creator/CMakeLists.txt
source/creator/creator.c
source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp
source/gameengine/BlenderRoutines/KX_BlenderGL.cpp
source/gameengine/Converter/BL_ActionActuator.cpp
source/gameengine/Converter/BL_BlenderDataConversion.cpp
source/gameengine/Converter/BL_ShapeActionActuator.cpp
source/gameengine/Converter/KX_BlenderScalarInterpolator.cpp
source/gameengine/Converter/KX_ConvertActuators.cpp
source/gameengine/Converter/KX_ConvertSensors.cpp
source/gameengine/Expressions/PyObjectPlus.h
source/gameengine/GameLogic/Joystick/SCA_Joystick.cpp
source/gameengine/GameLogic/Joystick/SCA_Joystick.h
source/gameengine/GameLogic/Joystick/SCA_JoystickEvents.cpp
source/gameengine/GameLogic/SCA_ActuatorSensor.cpp
source/gameengine/GameLogic/SCA_DelaySensor.cpp
source/gameengine/GameLogic/SCA_ISensor.cpp
source/gameengine/GameLogic/SCA_JoystickManager.cpp
source/gameengine/GameLogic/SCA_JoystickSensor.cpp
source/gameengine/GameLogic/SCA_JoystickSensor.h
source/gameengine/GameLogic/SCA_KeyboardSensor.cpp
source/gameengine/GameLogic/SCA_MouseSensor.cpp
source/gameengine/GameLogic/SCA_PropertyActuator.cpp
source/gameengine/GameLogic/SCA_PropertySensor.cpp
source/gameengine/GameLogic/SCA_PythonController.cpp
source/gameengine/GameLogic/SCA_RandomActuator.cpp
source/gameengine/GameLogic/SCA_RandomSensor.cpp
source/gameengine/GamePlayer/ghost/GPG_ghost.cpp
source/gameengine/Ketsji/KXNetwork/KX_NetworkMessageSensor.cpp
source/gameengine/Ketsji/KX_CameraActuator.cpp
source/gameengine/Ketsji/KX_ConstraintActuator.cpp
source/gameengine/Ketsji/KX_ConstraintActuator.h
source/gameengine/Ketsji/KX_GameActuator.cpp
source/gameengine/Ketsji/KX_IpoActuator.cpp
source/gameengine/Ketsji/KX_IpoActuator.h
source/gameengine/Ketsji/KX_MouseFocusSensor.cpp
source/gameengine/Ketsji/KX_NearSensor.cpp
source/gameengine/Ketsji/KX_ParentActuator.cpp
source/gameengine/Ketsji/KX_PyConstraintBinding.cpp
source/gameengine/Ketsji/KX_PythonInit.cpp
source/gameengine/Ketsji/KX_PythonInit.h
source/gameengine/Ketsji/KX_RadarSensor.cpp
source/gameengine/Ketsji/KX_RaySensor.cpp
source/gameengine/Ketsji/KX_SCA_AddObjectActuator.cpp
source/gameengine/Ketsji/KX_SCA_ReplaceMeshActuator.cpp
source/gameengine/Ketsji/KX_SceneActuator.cpp
source/gameengine/Ketsji/KX_SoundActuator.cpp
source/gameengine/Ketsji/KX_StateActuator.cpp
source/gameengine/Ketsji/KX_TouchSensor.cpp
source/gameengine/Ketsji/KX_TrackToActuator.cpp
source/gameengine/Ketsji/KX_VisibilityActuator.cpp
source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp
source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.h
source/gameengine/Physics/Dummy/DummyPhysicsEnvironment.cpp
source/gameengine/Physics/Dummy/DummyPhysicsEnvironment.h
source/gameengine/Physics/Sumo/SumoPhysicsEnvironment.cpp
source/gameengine/Physics/Sumo/SumoPhysicsEnvironment.h
source/gameengine/Physics/common/PHY_IPhysicsEnvironment.h
tools/Blender.py
tools/btools.py

index 506353628a4c43db4180bf50e63a8e108128cd49..9e615ecdfa593239f70801a97a882eca6b730903 100644 (file)
@@ -64,7 +64,7 @@ OPTION(WITH_OPENEXR           "Enable OpenEXR Support (http://www.openexr.com)"       ON)
 OPTION(WITH_FFMPEG             "Enable FFMPeg Support (http://ffmpeg.mplayerhq.hu/)"   OFF)
 OPTION(WITH_OPENAL             "Enable OpenAL Support (http://www.openal.org)"         ON)
 OPTION(WITH_OPENMP             "Enable OpenMP (has to be supported by the compiler)"   OFF)
-OPTION(WITH_WEBPLUGIN          "Enable Web Plugin (Mozilla-Unix only)"                 OFF)
+OPTION(WITH_WEBPLUGIN          "Enable Web Plugin (Unix only)"                         OFF)
 
 IF(NOT WITH_GAMEENGINE AND WITH_PLAYER)
   MESSAGE("WARNING: WITH_PLAYER needs WITH_GAMEENGINE")
@@ -428,6 +428,17 @@ SET(FTGL_INC ${FTGL}/include)
 SET(FTGL_LIB extern_ftgl)
 
 
+#-----------------------------------------------------------------------------
+# Blender WebPlugin
+
+IF(WITH_WEBPLUGIN) 
+  SET(GECKO_DIR "${CMAKE_SOURCE_DIR}/../gecko-sdk/" CACHE PATH "Gecko SDK path")
+  SET(WEBPLUGIN_SANDBOX_MODE "apparmor" CACHE STRING "WEB Plugin sandbox mode, can be apparmor, privsep, none")
+
+  SET(WITH_PLAYER ON)
+ENDIF(WITH_WEBPLUGIN)
+
+
 #-----------------------------------------------------------------------------
 # Configure OpenGL.
 INCLUDE(${CMAKE_ROOT}/Modules/FindOpenGL.cmake)
@@ -457,12 +468,6 @@ SUBDIRS(
 # Blender Application
 SUBDIRS(source/creator)
 
-#-----------------------------------------------------------------------------
-# Blender WebPlugin
-IF(WITH_WEBPLUGIN) 
-  SET(MOZILLA_DIR "${CMAKE_SOURCE_DIR}/../gecko-sdk/" CACHE PATH "Gecko SDK path")
-  SET(WITH_PLAYER ON)
-ENDIF(WITH_WEBPLUGIN)
 
 #-----------------------------------------------------------------------------
 # Blender Player
index cd7e6659af1cc7d3cd2a0a30431f0059a9ad7cdd..2b7bf074f83eb14a29a6e26207bc814886a4e1f5 100644 (file)
@@ -143,21 +143,21 @@ BF_FFMPEG_LIB = ''
 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 = 'true' 
 BF_OPENJPEG = '#extern/libopenjpeg'
 BF_OPENJPEG_LIB = ''
-# Uncomment the following two lines to use system's ffmpeg
-# BF_FFMPEG = '/usr'
-# BF_FFMPEG_LIB = 'avformat avcodec swscale avutil'
 BF_OPENJPEG_INC = '${BF_OPENJPEG}/include'
 BF_OPENJPEG_LIBPATH='${BF_OPENJPEG}/lib'
 
 WITH_BF_REDCODE = 'false'  
 BF_REDCODE = '#extern/libredcode'
 BF_REDCODE_LIB = ''
-# Uncomment the following two lines to use system's ffmpeg
-# BF_FFMPEG = '/usr'
-# BF_FFMPEG_LIB = 'avformat avcodec swscale avutil'
 BF_REDCODE_INC = '${BF_REDCODE}/include'
 BF_REDCODE_LIBPATH='${BF_REDCODE}/lib'
 
index 063d1461def1a4f811e8870ca95d2050fca02012..1b7737ed004510376e6014d7ea4fc2f27124644a 100644 (file)
@@ -5,7 +5,7 @@ WITH_BF_VERSE = 'false'
 BF_VERSE_INCLUDE = "#extern/verse/dist"
 
 # enable ffmpeg  support
-WITH_BF_FFMPEG = 'false'  # -DWITH_FFMPEG
+WITH_BF_FFMPEG = 'true'  # -DWITH_FFMPEG
 BF_FFMPEG = LIBDIR +'/ffmpeg'
 BF_FFMPEG_INC = '${BF_FFMPEG}/include'
 BF_FFMPEG_LIBPATH='${BF_FFMPEG}/lib'
@@ -57,7 +57,7 @@ WITH_BF_STATICOPENEXR = 'false'
 BF_OPENEXR = LIBDIR + '/openexr'
 BF_OPENEXR_INC = '${BF_OPENEXR}/include ${BF_OPENEXR}/include/IlmImf ${BF_OPENEXR}/include/Iex ${BF_OPENEXR}/include/Imath '
 BF_OPENEXR_LIB = ' Iex Half IlmImf Imath IlmThread '
-BF_OPENEXR_LIBPATH = '${BF_OPENEXR}/lib_msvc'
+BF_OPENEXR_LIBPATH = '${BF_OPENEXR}/lib_vs2008'
 # Warning, this static lib configuration is untested! users of this OS please confirm.
 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'
 
@@ -96,7 +96,8 @@ BF_FTGL = LIBDIR + '/ftgl'
 BF_FTGL_INC = '${BF_FTGL}/include'
 BF_FTGL_LIB = 'extern_ftgl'
 
-WITH_BF_GAMEENGINE = 'false'
+WITH_BF_GAMEENGINE = 'true'
+WITH_BF_PLAYER = 'true'
 
 WITH_BF_ODE = 'true'
 BF_ODE = LIBDIR + '/ode'
@@ -158,7 +159,7 @@ BF_OPENGL_LIB_STATIC = [ '${BF_OPENGL}/lib/libGL.a', '${BF_OPENGL}/lib/libGLU.a'
 CC = 'cl.exe'
 CXX = 'cl.exe'
 
-CCFLAGS = ['/nologo', '/Og', '/Ot', '/Ob1', '/Op', '/G6','/EHsc', '/J', '/W3', '/Gd', '/MT']
+CCFLAGS = ['/nologo', '/Ob1', '/J', '/W3', '/Gd', '/MT']
 
 BF_DEBUG_FLAGS = ['/Zi', '/FR${TARGET}.sbr']
 
@@ -171,17 +172,18 @@ CC_WARN = []
 LLIBS = 'ws2_32 vfw32 winmm kernel32 user32 gdi32 comdlg32 advapi32 shfolder shell32 ole32 oleaut32 uuid'
 
 PLATFORM_LINKFLAGS = '''
-                        /SUBSYSTEM:CONSOLE 
-                        /MACHINE:IX86 
-                        /ENTRY:mainCRTStartup 
-                        /INCREMENTAL:NO 
-                        /NODEFAULTLIB:"msvcprt.lib" 
-                        /NODEFAULTLIB:"glut32.lib" 
-                        /NODEFAULTLIB:"libc.lib"
-                        /NODEFAULTLIB:"libcd.lib"
-                        /NODEFAULTLIB:"libcpd.lib" 
-                        /NODEFAULTLIB:"libcp.lib" 
-                    '''
-                        
+                       /SUBSYSTEM:CONSOLE
+                       /MACHINE:IX86
+                       /ENTRY:mainCRTStartup
+                       /INCREMENTAL:NO
+                       /NODEFAULTLIB:"msvcprt.lib"
+                       /NODEFAULTLIB:"glut32.lib"
+                       /NODEFAULTLIB:"libc.lib"
+                       /NODEFAULTLIB:"libcd.lib"
+                       /NODEFAULTLIB:"libcpd.lib"
+                       /NODEFAULTLIB:"libcp.lib"
+                       /LARGEADDRESSAWARE
+                   '''
+
 BF_BUILDDIR = '..\\build\\win32-vc'
 BF_INSTALLDIR='..\\install\\win32-vc'
index a7bbd28764e40f41f077a463b005d7e6b4516c55..8578d3f2fd42a987848bc66d6339f820f676e424 100644 (file)
@@ -58,6 +58,13 @@ $Id$
     $BLENDERHOME/config/(platform)-config.py. After the build successfully
     completes, you can find everything you need in BF_INSTALLDIR.
 
+    If you want to create the installer package of Blender on Windows you'll
+    need to install nullsoft scriptable install system from http://nsis.sf.net.
+    As an extra dependency, you need the MoreInfo plugin too. The creation of
+    the installer is tied into the build process and can be triggered with:
+
+        % scons nsis
+
 
     Configuring the build
     ---------------------
@@ -166,18 +173,6 @@ $Id$
     debug symbols.  Also note that BF_QUICKDEBUG and BF_DEBUG_LIBS are combined;
     for example, setting BF_QUICKDEBUG won't overwrite the contents of BF_DEBUG_LIBS.
 
-
-    Not installing
-    --------------
-
-    If you dont want to install the build result, you can use the following option either
-    on the commandline or in your user-config.py :
-
-        WITHOUT_BF_INSTALL='true'
-
-    by default, this is set to 'false', and so the build is installed
-
-
     Supported toolset
     -----------------
 
@@ -194,7 +189,6 @@ $Id$
     specify what toolset to use
 
         % scons BF_TOOLSET=msvc
-        % scons BF_TOOLSET=mstoolkit
         % scons BF_TOOLSET=mingw
 
     If you have only the toolkit installed, you will also need to give
index ce425ef9579b0e0c13e9e8486228a4951c44f1d3..4c892e1956dee1eceb5c7ad545cecdba49398fa5 100644 (file)
@@ -32,4 +32,5 @@ if env['WITH_BF_REDCODE'] and env['BF_REDCODE_LIB'] == '':
 if env['OURPLATFORM'] == 'linux2':
     SConscript(['binreloc/SConscript']);
 
-SConscript(['fftw/SConscript'])
+# FFTW not needed atm - dg
+# SConscript(['fftw/SConscript'])
index 8d634a6714393d4b04eeee2ba38287dbb2a35bd4..b962829041ac80a881abdd418d8ae2d0e1a1b88f 100644 (file)
@@ -16,6 +16,7 @@ subject to the following restrictions:
 #include "btTriangleIndexVertexArray.h"
 
 btTriangleIndexVertexArray::btTriangleIndexVertexArray(int numTriangles,int* triangleIndexBase,int triangleIndexStride,int numVertices,btScalar* vertexBase,int vertexStride)
+: m_hasAabb(0)
 {
        btIndexedMesh mesh;
 
index c98526f09f8497943d76fb013e6e6dbbf65f5a07..cf43f487e240df0bf5d1b44a9249710c4d99f7cc 100644 (file)
@@ -2,7 +2,7 @@
 #define BT_BOX_COLLISION_H_INCLUDED
 
 /*! \file gim_box_collision.h
-\author Francisco León Nájera
+\author Francisco Le\7fn Nßjera
 */
 /*
 This source file is part of GIMPACT Library.
index 32d470a2398346f023391342ae0ea2003860a343..28c03b7e03925cd4efd143911995fa46f32a424d 100644 (file)
@@ -2,7 +2,7 @@
 #define BT_CLIP_POLYGON_H_INCLUDED
 
 /*! \file btClipPolygon.h
-\author Francisco León Nájera
+\author Francisco Le\7fn Nßjera
 */
 /*
 This source file is part of GIMPACT Library.
index 5ff762937fb96826175b2218efe1f2f5f1fa04fb..0cfd013b962a082b96ba5b3d376f7d2cc5852fb7 100644 (file)
@@ -2,7 +2,7 @@
 #define BT_CONTACT_H_INCLUDED
 
 /*! \file gim_contact.h
-\author Francisco León Nájera
+\author Francisco Le\7fn Nßjera
 */
 /*
 This source file is part of GIMPACT Library.
index 8d08ca80080fe22d91db1269b66ae04902df69cf..b07926c30dca644f711bdb47f88356dedc16a089 100644 (file)
@@ -1,5 +1,5 @@
 /*! \file gim_box_set.h
-\author Francisco León Nájera
+\author Francisco Le\7fn Nßjera
 */
 /*
 This source file is part of GIMPACT Library.
index 7138b2366aa24e088581f16763be7346ceb3327a..1907efc2463cc0127eb01b555cc0177622d71fac 100644 (file)
@@ -2,7 +2,7 @@
 #define GIM_BOX_SET_H_INCLUDED
 
 /*! \file gim_box_set.h
-\author Francisco León Nájera
+\author Francisco Le\7fn Nßjera
 */
 /*
 This source file is part of GIMPACT Library.
index 60bcfe797b65bd81389603554e7ac9fd0bf103a4..28ad18fbde242ccdf3cd3c6681e34fcc5b09abba 100644 (file)
@@ -18,7 +18,7 @@ subject to the following restrictions:
 3. This notice may not be removed or altered from any source distribution.
 */
 /*
-Author: Francisco León Nájera
+Author: Francisco Le\7fn Nßjera
 Concave-Concave Collision
 
 */
index 8998cd06cf0356915d4d44d8a20db1d53ae61860..c745b7ed5d86074251596fe7d4f09ce2b2b28350 100644 (file)
@@ -1,5 +1,5 @@
 /*! \file btGImpactShape.h
-\author Francisco León Nájera
+\author Francisco Le\7fn Nßjera
 */
 /*
 This source file is part of GIMPACT Library.
index b3c40569f2311a085b1d68cfbe1c81e202cd2c4b..0a10f3cdb7b8e70a6f14aa2c11749042d2735aac 100644 (file)
@@ -1,5 +1,5 @@
 /*! \file btGImpactMassUtil.h
-\author Francisco León Nájera
+\author Francisco Le\7fn Nßjera
 */
 /*
 This source file is part of GIMPACT Library.
index 957cc97df9c6ebbd1db7d1cd30370c59524ac833..0b1ef6acd83a0d34e204eaf9720937f7ef5a7fe4 100644 (file)
@@ -1,5 +1,5 @@
 /*! \file gim_box_set.h
-\author Francisco León Nájera
+\author Francisco Le\7fn Nßjera
 */
 /*
 This source file is part of GIMPACT Library.
index e9e60c7348d767727792a15c75d4fe8095ab8ee9..3a4774b849da9bc9b9254f7663ae80eed6402917 100644 (file)
@@ -2,7 +2,7 @@
 #define GIM_QUANTIZED_SET_H_INCLUDED
 
 /*! \file btGImpactQuantizedBvh.h
-\author Francisco León Nájera
+\author Francisco Le\7fn Nßjera
 */
 /*
 This source file is part of GIMPACT Library.
index 2e16509457a49143c87739a3f042aba260fabf0b..43f32bea5a1a90b31cacc562ef47826e50d7185a 100644 (file)
@@ -1,5 +1,5 @@
 /*! \file btGImpactShape.h
-\author Francisco León Nájera
+\author Francisco Le\7fn Nßjera
 */
 /*
 This source file is part of GIMPACT Library.
index a1e46e655757cc52c789df94d3d1eec493e41e32..4b4b5e20dd39cad091a96a4ab8f4547bb24f58e9 100644 (file)
@@ -1,5 +1,5 @@
 /*! \file btGenericPoolAllocator.cpp
-\author Francisco León Nájera. email projectileman@yahoo.com
+\author Francisco Le\7fn Nßjera. email projectileman@yahoo.com
 
 General purpose allocator class
 */
index 0e6a585ee5e72a8ddbae4d2292a6dccde6564e79..05b79a825167e94807e8a0ec4f2fbf35e5b44f12 100644 (file)
@@ -1,5 +1,5 @@
 /*! \file btGenericPoolAllocator.h
-\author Francisco León Nájera. email projectileman@yahoo.com
+\author Francisco Le\7fn Nßjera. email projectileman@yahoo.com
 
 General purpose allocator class
 */
index 72ab00e6cb4d5592e20bec7cd9b835bfe16ee3e3..f5800716a967623949d0fa1177a0f8f7403d326b 100644 (file)
@@ -2,7 +2,7 @@
 #define BT_BASIC_GEOMETRY_OPERATIONS_H_INCLUDED
 
 /*! \file btGeometryOperations.h
-*\author Francisco León Nájera
+*\author Francisco Le\7fn Nßjera
 
 */
 /*
index fd4aea42470316621764e7cdee623c7b5188500e..e9e6ad3d80534a502a044b591c022394ea958be6 100644 (file)
@@ -2,7 +2,7 @@
 #define BT_QUANTIZATION_H_INCLUDED
 
 /*! \file btQuantization.h
-*\author Francisco León Nájera
+*\author Francisco Le\7fn Nßjera
 
 */
 /*
index 8cb980dfc0c84d2087254809750e78f15e39dc0c..0267f7e67c74960aff739a8e0dc1b56b687a849c 100644 (file)
@@ -1,5 +1,5 @@
 /*! \file btGImpactTriangleShape.h
-\author Francisco León Nájera
+\author Francisco Le\7fn Nßjera
 */
 /*
 This source file is part of GIMPACT Library.
index c5c737cf2be8e0b346ca61bc61d864741e239759..bdaa323d564b05091d80ae6a04546fee308750cb 100644 (file)
@@ -1,5 +1,5 @@
 /*! \file btGImpactShape.h
-\author Francisco León Nájera
+\author Francisco Le\7fn Nßjera
 */
 /*
 This source file is part of GIMPACT Library.
index 80c35f7113941646ff215727e058a14d94e6adb9..89fbb5ab0a565f2fddddf592cba51931aa1697c7 100644 (file)
@@ -1,7 +1,7 @@
 #ifndef GIM_ARRAY_H_INCLUDED
 #define GIM_ARRAY_H_INCLUDED
 /*! \file gim_array.h
-\author Francisco León Nájera
+\author Francisco Le\7fn Nßjera
 */
 /*
 -----------------------------------------------------------------------------
index 9c77ebbf6f5d94017c605a2fb7abe405d48231e1..d4cbce04b5e696c610abdac61d0f46e57776466e 100644 (file)
@@ -2,7 +2,7 @@
 #define GIM_BASIC_GEOMETRY_OPERATIONS_H_INCLUDED
 
 /*! \file gim_basic_geometry_operations.h
-*\author Francisco León Nájera
+*\author Francisco Le\7fn Nßjera
 type independant geometry routines
 
 */
index 417aa72fe22b3739c771e3a1476825a0bf26f0b3..7784aeff140170d9a8ba484f2d35a2fd6eca8037 100644 (file)
@@ -1,7 +1,7 @@
 #ifndef GIM_BITSET_H_INCLUDED
 #define GIM_BITSET_H_INCLUDED
 /*! \file gim_bitset.h
-\author Francisco León Nájera
+\author Francisco Le\7fn Nßjera
 */
 /*
 -----------------------------------------------------------------------------
index 4f825cf520817cd89e9517e15c02b9661eea1f2e..c9bb83e36539680616b894a869f58d4ebb0ecf51 100644 (file)
@@ -2,7 +2,7 @@
 #define GIM_BOX_COLLISION_H_INCLUDED
 
 /*! \file gim_box_collision.h
-\author Francisco León Nájera
+\author Francisco Le\7fn Nßjera
 */
 /*
 -----------------------------------------------------------------------------
index 1c6c3955f8bf51f14aae77fddd8c340f4f86495e..ece5936de6bd755fd32adfed4f1be9aaf3097d38 100644 (file)
@@ -2,7 +2,7 @@
 #define GIM_BOX_SET_H_INCLUDED
 
 /*! \file gim_box_set.h
-\author Francisco León Nájera
+\author Francisco Le\7fn Nßjera
 */
 /*
 -----------------------------------------------------------------------------
index f833732e61a47af137ed28801eab0417f1f3421d..62151cb97b7dac8d4f736564a366cc962d18c00a 100644 (file)
@@ -2,7 +2,7 @@
 #define GIM_CLIP_POLYGON_H_INCLUDED
 
 /*! \file gim_tri_collision.h
-\author Francisco León Nájera
+\author Francisco Le\7fn Nßjera
 */
 /*
 -----------------------------------------------------------------------------
index 7670d87e49623ac4ec9de1d12a1db1a9e836d469..62df51b782f37b875891bd84f1611c3f40d446a1 100644 (file)
@@ -2,7 +2,7 @@
 #define GIM_CONTACT_H_INCLUDED
 
 /*! \file gim_contact.h
-\author Francisco León Nájera
+\author Francisco Le\7fn Nßjera
 */
 /*
 -----------------------------------------------------------------------------
index 8fad60a70b3ea663b5c374804d3b7a284dbe4d3e..cd3e53dcc0c83c57fc76779d6d4635569b486b6d 100644 (file)
@@ -2,7 +2,7 @@
 #define GIM_GEOM_TYPES_H_INCLUDED
 
 /*! \file gim_geom_types.h
-\author Francisco León Nájera
+\author Francisco Le\7fn Nßjera
 */
 /*
 -----------------------------------------------------------------------------
index 40cf66361d83c1033f90aaaa76bd305b26007abc..6cc4167210115926f3c91ebe76e6f1f3495bcad0 100644 (file)
@@ -2,7 +2,7 @@
 #define GIM_GEOMETRY_H_INCLUDED
 
 /*! \file gim_geometry.h
-\author Francisco León Nájera
+\author Francisco Le\7fn Nßjera
 */
 /*
 -----------------------------------------------------------------------------
index 18cf93c4eb1b2739147af6703ba875fdda042dfe..fd980dff5faa4f27a96277677f721ac72b9adaea 100644 (file)
@@ -1,7 +1,7 @@
 #ifndef GIM_HASH_TABLE_H_INCLUDED
 #define GIM_HASH_TABLE_H_INCLUDED
 /*! \file gim_trimesh_data.h
-\author Francisco León Nájera
+\author Francisco Le\7fn Nßjera
 */
 /*
 -----------------------------------------------------------------------------
index 7bfd50409dbb04677e7b7ffe4a10886d383bb849..adf1c1c2ddfce5e3d2d5d79a4f26c375779af94f 100644 (file)
@@ -2,7 +2,7 @@
 #define GIM_LINEAR_H_INCLUDED
 
 /*! \file gim_linear_math.h
-*\author Francisco León Nájera
+*\author Francisco Le\7fn Nßjera
 Type Independant Vector and matrix operations.
 */
 /*
index a30180f2810cd408673f16ba2df985806906c403..25ad1e21c7f19f41a57c8d739d46379c74b1cf5b 100644 (file)
@@ -1,7 +1,7 @@
 #ifndef GIM_MATH_H_INCLUDED
 #define GIM_MATH_H_INCLUDED
 /*! \file gim_math.h
-\author Francisco León Nájera
+\author Francisco Le\7fn Nßjera
 */
 /*
 -----------------------------------------------------------------------------
index 08cff1e300b48b2657c628b84166975d64f715ed..469a8280f7d74edbfba5ca54e188b169951c108a 100644 (file)
@@ -1,7 +1,7 @@
 #ifndef GIM_MEMORY_H_INCLUDED
 #define GIM_MEMORY_H_INCLUDED
 /*! \file gim_memory.h
-\author Francisco León Nájera
+\author Francisco Le\7fn Nßjera
 */
 /*
 -----------------------------------------------------------------------------
index b917d57bd94e8813610ceff3a289dbc3ab785cdf..9ecf61bdc6d3c302d89220c1955387f388abbd51 100644 (file)
@@ -1,7 +1,7 @@
 #ifndef GIM_RADIXSORT_H_INCLUDED
 #define GIM_RADIXSORT_H_INCLUDED
 /*! \file gim_radixsort.h
-\author Francisco León Nájera.
+\author Francisco Le\7fn Nßjera.
 Based on the work of Michael Herf : "fast floating-point radix sort"
 Avaliable on http://www.stereopsis.com/radix.html
 */
index 73c11c0fe0bc945bd6f02c6bb4cc3a925f60849c..ef6feabdfee74eca295721e92831617c553e6347 100644 (file)
@@ -1,6 +1,6 @@
 
 /*! \file gim_tri_collision.h
-\author Francisco León Nájera
+\author Francisco Le\7fn Nßjera
 */
 /*
 -----------------------------------------------------------------------------
index a7423956c1812a930430fd66b74c372cdea7d507..7cea8fc33a61d38bda9784f973479c3e1c29e725 100644 (file)
@@ -2,7 +2,7 @@
 #define GIM_TRI_COLLISION_H_INCLUDED
 
 /*! \file gim_tri_collision.h
-\author Francisco León Nájera
+\author Francisco Le\7fn Nßjera
 */
 /*
 -----------------------------------------------------------------------------
index 329a1d9cde3671b7d12400dee453b6d233719ce2..745694e2f70f202e127ef279f26046e20367b67b 100644 (file)
@@ -423,6 +423,13 @@ btVector3 btDiscreteDynamicsWorld::getGravity () const
 
 void   btDiscreteDynamicsWorld::removeRigidBody(btRigidBody* body)
 {
+       //remove all constraints too
+       while (body->getNumConstraintRefs())
+       {
+               btTypedConstraint* constraint = body->getConstraintRef(0);
+               removeConstraint(constraint);
+       }
+
        removeCollisionObject(body);
 }
 
index 0a27dbcedb5f8d17558a1c5d00eb271b5d195245..1ec668c9c78dca09461b673b592857abd1a37cb0 100644 (file)
@@ -306,8 +306,16 @@ void                       btSoftBody::appendFace(int node0,int node1,int node2,Material* mat)
 }
 
 //
-void                   btSoftBody::appendAnchor(int node,btRigidBody* body)
+void                   btSoftBody::appendAnchor(int node,btRigidBody* body,bool disableCollisionWithBody=false)
 {
+       if (disableCollisionWithBody)
+       {
+               if (m_collisionDisabledObjects.findLinearSearch(body)==m_collisionDisabledObjects.size())
+               {
+                       m_collisionDisabledObjects.push_back(body);
+               }
+       }
+
        Anchor  a;
        a.m_node                        =       &m_nodes[node];
        a.m_body                        =       body;
@@ -2439,6 +2447,10 @@ void                             btSoftBody::PSolve_RContacts(btSoftBody* psb,btScalar kst,btScalar ti)
        for(int i=0,ni=psb->m_rcontacts.size();i<ni;++i)
        {
                const RContact&         c=psb->m_rcontacts[i];
+               ///skip object that don't have collision response
+               if (!psb->getWorldInfo()->m_dispatcher->needsResponse(psb,c.m_cti.m_body))
+                       continue;
+
                const sCti&                     cti=c.m_cti;    
                const btVector3         va=cti.m_body->getVelocityInLocalPoint(c.m_c1)*dt;
                const btVector3         vb=c.m_node->m_x-c.m_node->m_q; 
index 79d272765e01c04ddd9ca245585b1540e3baf20c..743462d259a48a7d1c9bc2203016692ce420616e 100644 (file)
@@ -49,6 +49,8 @@ struct        btSoftBodyWorldInfo
 class  btSoftBody : public btCollisionObject
 {
 public:
+       btAlignedObjectArray<class btCollisionObject*> m_collisionDisabledObjects;
+
        //
        // Enumerations
        //
@@ -667,7 +669,7 @@ public:
                                                                        Material* mat=0);
        /* Append anchor                                                                                                                */ 
        void                            appendAnchor(   int node,
-                                                                               btRigidBody* body);
+                                                                               btRigidBody* body,bool disableCollision);
        /* Append linear joint                                                                                                  */ 
        void                            appendLinearJoint(const LJoint::Specs& specs,Cluster* body0,Body body1);
        void                            appendLinearJoint(const LJoint::Specs& specs,Body body=Body());
index 835a03b8e3c79610bb9715095c72017354297982..e5feb5ef749d4ad6b15aabb9203ebfc0469cc86f 100644 (file)
@@ -59,7 +59,10 @@ void btSoftRigidCollisionAlgorithm::processCollision (btCollisionObject* body0,b
        btSoftBody* softBody =  m_isSwapped? (btSoftBody*)body1 : (btSoftBody*)body0;
        btCollisionObject* rigidCollisionObject = m_isSwapped? body0 : body1;
        
-       softBody->defaultCollisionHandler(rigidCollisionObject);
+       if (softBody->m_collisionDisabledObjects.findLinearSearch(rigidCollisionObject)==softBody->m_collisionDisabledObjects.size())
+       {
+               softBody->defaultCollisionHandler(rigidCollisionObject);
+       }
 
 
 }
index 3c96857d4eb4dc273dc65b4c2326cb91a01d6896..e8433405b20a61e04cd6582116a4ad9e2fb0b36e 100644 (file)
@@ -141,6 +141,10 @@ inline int btGetVersion()
 /// older compilers (gcc 3.x) and Sun needs double version of sqrt etc.
 /// exclude Apple Intel (i's assumed to be a Macbook or new Intel Dual Core Processor)
 #if defined (__sun) || defined (__sun__) || defined (__sparc) || (defined (__APPLE__) && ! defined (__i386__))
+/* XXX Need to fix these... needed for SunOS 5.8 */
+#define sinf(a)         sin((double)(a))
+#define cosf(a)         cos((double)(a))
+#define fabsf(a)        fabs((double)(a))
 //use slow double float precision operation on those platforms
 #ifndef BT_USE_DOUBLE_PRECISION
 #define BT_FORCE_DOUBLE_FUNCTIONS
@@ -194,7 +198,7 @@ SIMD_FORCE_INLINE btScalar btSqrt(btScalar y)
        tempf = y;
        *tfptr = (0xbfcdd90a - *tfptr)>>1; /* estimate of 1/sqrt(y) */
        x =  tempf;
-       z =  y*btScalar(0.5);                        /* hoist out the \93/2\94    */
+       z =  y*btScalar(0.5);                        /* hoist out the ô/2ö    */
        x = (btScalar(1.5)*x)-(x*x)*(x*z);         /* iteration formula     */
        x = (btScalar(1.5)*x)-(x*x)*(x*z);
        x = (btScalar(1.5)*x)-(x*x)*(x*z);
index c54aa434eec292381c02a8c8dcbd1d556aeeeb61..26cf1bda11cc19dab04986825563f95803393676 100644 (file)
@@ -97,8 +97,8 @@ extern unsigned int SND_GetSampleFormat(void* sample);
 extern unsigned int SND_GetNumberOfChannels(void* sample);
 extern unsigned int SND_GetSampleRate(void* sample);
 extern unsigned int SND_GetBitRate(void* sample);
-extern unsigned int SND_GetNumberOfSamples(void* sample);
-extern unsigned int SND_GetHeaderSize(void* sample);
+extern unsigned int SND_GetNumberOfSamples(void* sample, int sample_length);
+extern unsigned int SND_GetHeaderSize(void* sample, int sample_length);
 extern unsigned int SND_GetExtraChunk(void* sample);
 
 extern void SND_GetSampleInfo(signed char* sample, SND_WaveSlot* waveslot);
index cc252954fea70e47fd210cd46700fcb5def9eb00..3ba0802a5b046fd80d5fc2b9c16ae035d61083fa 100644 (file)
@@ -162,7 +162,7 @@ SND_WaveSlot* SND_FmodDevice::LoadSample(const STR_String& name,
                                                int numberofchannels = SND_GetNumberOfChannels(memlocation);
                                                int samplerate = SND_GetSampleRate(memlocation);
                                                int bitrate = SND_GetBitRate(memlocation);
-                                               int numberofsamples = SND_GetNumberOfSamples(memlocation);
+                                               int numberofsamples = SND_GetNumberOfSamples(memlocation, size);
                                                
                                                waveslot->SetFileSize(size);
                                                waveslot->SetData(memlocation);
index bbf971ddc871dccb514f1c508e69f3275b603821..9d050a81161f8b3a8f022694dc94bb8786322112 100644 (file)
@@ -388,11 +388,18 @@ void SND_Scene::UpdateActiveObects()
 #endif
 #ifdef USE_OPENAL
                        // ok, properties Set. now see if it must play
-                       if (pObject->GetPlaystate() == SND_MUST_PLAY)
-                       {
+                       switch (pObject->GetPlaystate()){
+                       case SND_MUST_PLAY:
                                m_audiodevice->PlayObject(id);
                                pObject->SetPlaystate(SND_PLAYING);
-                               //break;
+                               break;
+                       case SND_MUST_STOP:
+                               RemoveActiveObject(pObject);
+                               break;
+                       case SND_MUST_PAUSE:
+                               m_audiodevice->PauseObject(id);
+                               pObject->SetPlaystate(SND_PAUSED);
+                               break;
                        }
 #endif
 
index e514a186e5e219f322e2e923f679d78eef68b6b7..7a244b5090dbf90189a91fcbd61a620441aa45e5 100644 (file)
@@ -91,21 +91,24 @@ SND_SoundObject::~SND_SoundObject()
 
 void SND_SoundObject::StartSound()
 {
-       m_playstate = SND_MUST_PLAY;
+       if (m_id >= 0)
+               m_playstate = SND_MUST_PLAY;
 }
 
 
 
 void SND_SoundObject::StopSound()
 {
-       m_playstate = SND_MUST_STOP;
+       if (m_id >= 0)
+               m_playstate = SND_MUST_STOP;
 }
 
 
 
 void SND_SoundObject::PauseSound()
 {
-       m_playstate = SND_MUST_PAUSE;
+       if (m_id >= 0)
+               m_playstate = SND_MUST_PAUSE;
 }
 
 
index 754c8b029a1a6c182d2d34b15d58389a09979a5e..78115807970c08c7c53aef3d3c36dc316bdf3a15 100644 (file)
@@ -285,26 +285,32 @@ unsigned int SND_GetBitRate(void* sample)
 
 
 /* gets the length of the actual sample data (without the header) */
-unsigned int SND_GetNumberOfSamples(void* sample)
+unsigned int SND_GetNumberOfSamples(void* sample, int sample_length)
 {
-       unsigned int chunklength, length = 0, offset = 16;
-       char data[4];
-       
+       unsigned int chunklength, length = 0, offset;
+       unsigned short block_align;
        if (CheckSample(sample))
        {
-               memcpy(&chunklength, ((char*)sample) + offset, 4);
+               memcpy(&chunklength, ((char*)sample) + 16, 4);
+               memcpy(&block_align, ((char*)sample) + 32, 2); /* always 2 or 4 it seems */
+               
                /* This was endian unsafe. See top of the file for the define. */
-               if (SND_fEndian == SND_endianBig) SWITCH_INT(chunklength);
-
-               offset = offset + chunklength + 4;
-               memcpy(data, ((char*)sample) + offset, 4);
+               if (SND_fEndian == SND_endianBig)
+               {
+                       SWITCH_INT(chunklength);
+                       SWITCH_SHORT(block_align);
+               }
+                               
+               offset = 16 + chunklength + 4;
 
                /* This seems very unsafe, what if data is never found (f.i. corrupt file)... */
                // lets find "data"
-               while (memcmp(data, "data", 4))
+               while (memcmp(((char*)sample) + offset, "data", 4))
                {
-                       offset += 4;
-                       memcpy(data, ((char*)sample) + offset, 4);
+                       offset += block_align;
+                       
+                       if (offset+block_align > sample_length) /* save us from crashing */
+                               return 0;
                }
                offset += 4;
                memcpy(&length, ((char*)sample) + offset, 4);
@@ -319,34 +325,38 @@ unsigned int SND_GetNumberOfSamples(void* sample)
 
 
 /* gets the size of the entire header (file - sampledata) */
-unsigned int SND_GetHeaderSize(void* sample)
+unsigned int SND_GetHeaderSize(void* sample, int sample_length)
 {
        unsigned int chunklength, headersize = 0, offset = 16;
-       char data[4];
-       
+       unsigned short block_align;
        if (CheckSample(sample))
        {
                memcpy(&chunklength, ((char*)sample) + offset, 4);
+               memcpy(&block_align, ((char*)sample) + 32, 2); /* always 2 or 4 it seems */
+               
                /* This was endian unsafe. See top of the file for the define. */
-               if (SND_fEndian == SND_endianBig) SWITCH_INT(chunklength);
+               if (SND_fEndian == SND_endianBig)
+               {
+                       SWITCH_INT(chunklength);
+                       SWITCH_SHORT(block_align);
+               }
                offset = offset + chunklength + 4;
-               memcpy(data, ((char*)sample) + offset, 4);
 
                // lets find "data"
-               while (memcmp(data, "data", 4))
+               while (memcmp(((char*)sample) + offset, "data", 4))
                {
-                       offset += 4;
-                       memcpy(data, ((char*)sample) + offset, 4);
+                       offset += block_align;
+                       
+                       if (offset+block_align > sample_length) /* save us from crashing */
+                               return 0;
                }
                headersize = offset + 8;
        }
 
-
        return headersize;
 }
 
 
-
 unsigned int SND_GetExtraChunk(void* sample)
 {
        unsigned int extrachunk = 0, chunklength, offset = 16;
@@ -382,58 +392,60 @@ void SND_GetSampleInfo(signed char* sample, SND_WaveSlot* waveslot)
        if (CheckSample(sample))
        {
                memcpy(&fileheader, sample, sizeof(WavFileHeader));
-               fileheader.size = SND_GetHeaderSize(sample);
-               sample += sizeof(WavFileHeader);
-               fileheader.size = ((fileheader.size+1) & ~1) - 4;
+               fileheader.size = SND_GetHeaderSize(sample, waveslot->GetFileSize());
+               if (fileheader.size) { /* this may fail for corrupt files */
+                       sample += sizeof(WavFileHeader);
+                       fileheader.size = ((fileheader.size+1) & ~1) - 4;
 
-               while ((fileheader.size > 0) && (memcpy(&chunkheader, sample, sizeof(WavChunkHeader))))
-               {
-                       sample += sizeof(WavChunkHeader);
-                       if (!memcmp(chunkheader.id, "fmt ", 4))
+                       while ((fileheader.size > 0) && (memcpy(&chunkheader, sample, sizeof(WavChunkHeader))))
                        {
-                               memcpy(&fmtheader, sample, sizeof(WavFmtHeader));
-                               waveslot->SetSampleFormat(fmtheader.format);
-
-                               if (fmtheader.format == 0x0001)
+                               sample += sizeof(WavChunkHeader);
+                               if (!memcmp(chunkheader.id, "fmt ", 4))
                                {
-                                       waveslot->SetNumberOfChannels(fmtheader.numberofchannels);
-                                       waveslot->SetBitRate(fmtheader.bitrate);
-                                       waveslot->SetSampleRate(fmtheader.samplerate);
-                                       sample += chunkheader.size;
-                               } 
-                               else
-                               {
-                                       memcpy(&fmtexheader, sample, sizeof(WavFmtExHeader));
-                                       sample += chunkheader.size;
-                               }
-                       }
-                       else if (!memcmp(chunkheader.id, "data", 4))
-                       {
-                               if (fmtheader.format == 0x0001)
-                               {
-                                       waveslot->SetNumberOfSamples(chunkheader.size);
-                                       sample += chunkheader.size;
+                                       memcpy(&fmtheader, sample, sizeof(WavFmtHeader));
+                                       waveslot->SetSampleFormat(fmtheader.format);
+
+                                       if (fmtheader.format == 0x0001)
+                                       {
+                                               waveslot->SetNumberOfChannels(fmtheader.numberofchannels);
+                                               waveslot->SetBitRate(fmtheader.bitrate);
+                                               waveslot->SetSampleRate(fmtheader.samplerate);
+                                               sample += chunkheader.size;
+                                       } 
+                                       else
+                                       {
+                                               memcpy(&fmtexheader, sample, sizeof(WavFmtExHeader));
+                                               sample += chunkheader.size;
+                                       }
                                }
-                               else if (fmtheader.format == 0x0011)
+                               else if (!memcmp(chunkheader.id, "data", 4))
                                {
-                                       //IMA ADPCM
+                                       if (fmtheader.format == 0x0001)
+                                       {
+                                               waveslot->SetNumberOfSamples(chunkheader.size);
+                                               sample += chunkheader.size;
+                                       }
+                                       else if (fmtheader.format == 0x0011)
+                                       {
+                                               //IMA ADPCM
+                                       }
+                                       else if (fmtheader.format == 0x0055)
+                                       {
+                                               //MP3 WAVE
+                                       }
                                }
-                               else if (fmtheader.format == 0x0055)
+                               else if (!memcmp(chunkheader.id, "smpl", 4))
                                {
-                                       //MP3 WAVE
+                                       memcpy(&sampleheader, sample, sizeof(WavSampleHeader));
+                                       //loop = sampleheader.loops;
+                                       sample += chunkheader.size;
                                }
-                       }
-                       else if (!memcmp(chunkheader.id, "smpl", 4))
-                       {
-                               memcpy(&sampleheader, sample, sizeof(WavSampleHeader));
-                               //loop = sampleheader.loops;
-                               sample += chunkheader.size;
-                       }
-                       else
-                               sample += chunkheader.size;
+                               else
+                                       sample += chunkheader.size;
 
-                       sample += chunkheader.size & 1;
-                       fileheader.size -= (((chunkheader.size + 1) & ~1) + 8);
+                               sample += chunkheader.size & 1;
+                               fileheader.size -= (((chunkheader.size + 1) & ~1) + 8);
+                       }
                }
        }
 }
index 0ab0fa94c7b74a4d06ecd10e7ede0bf924926d52..b1bac964c614ea30d938e168036866ee37a7eeda 100644 (file)
@@ -41,7 +41,9 @@
 #include "SND_SDLCDDevice.h"
 #include "SoundDefines.h"
 
+#ifndef DISABLE_SDL
 #include <SDL.h>
+#endif
 
 SND_SDLCDDevice::SND_SDLCDDevice() :
        m_cdrom(NULL),
index c03b8678186f2f39d92d6caa32eca0c7e0f56a54..ec92a5dd5a8462d9ba61a3b3e26e9991a42ad32d 100644 (file)
@@ -37,6 +37,10 @@ unexport NAN_QUIET
 
 CCFLAGS += $(LEVEL_2_CPP_WARNINGS)
 
+ifeq ($(WITH_BF_OPENMP),true)
+   CPPFLAGS += -DPARALLEL
+endif
+
 CPPFLAGS += -DNOGUI -DELBEEM_BLENDER
 CPPFLAGS += -I.
 CPPFLAGS += -I../extern
index f7923322d5b4e3e008197cfb14056ea7e3abc99f..179e103e326774915f4f304651f8d5c9078eb8b6 100644 (file)
@@ -204,6 +204,7 @@ int elbeemAddMesh(elbeemMesh *mesh) {
        
        ntlGeometryObjModel *obj = new ntlGeometryObjModel( );
        gpWorld->getRenderGlobals()->getSimScene()->addGeoClass( obj );
+       gpWorld->getRenderGlobals()->getRenderScene()->addGeoClass(obj);
        obj->initModel(
                        mesh->numVertices, mesh->vertices, mesh->numTriangles, mesh->triangles,
                        mesh->channelSizeVertices, mesh->channelVertices );
index ac954b956d046b055e16418a4411857ed0b5cd21..03f6482ae84003c93dfe674015937903b2cf1475 100644 (file)
@@ -98,9 +98,9 @@ void MeanValueMeshCoords::computeWeights(vector<ntlVec3Gfx> &reference_vertices,
                if(mvmFullDebug) errMsg("MeanValueMeshCoords::computeWeights","c="<<c<<" phi="<<phi<<" d="<<d);
                //if (c[0] > 1. || c[0] < 0. || c[1] > 1. || c[1] < 0. || c[2] > 1. || c[2] < 0.) continue;
 
-               s[0] = sqrtf((float)(1.-c[0]*c[0]));
-               s[1] = sqrtf((float)(1.-c[1]*c[1]));
-               s[2] = sqrtf((float)(1.-c[2]*c[2]));
+               s[0] = sqrt((float)(1.-c[0]*c[0]));
+               s[1] = sqrt((float)(1.-c[1]*c[1]));
+               s[2] = sqrt((float)(1.-c[2]*c[2]));
 
                if(mvmFullDebug) errMsg("MeanValueMeshCoords::computeWeights","s");
                if (s[0] <= cEPS || s[1] <= cEPS || s[2] <= cEPS) {
index c30b915c019b4068661fa82fa86b02f6d58a1284..6a06f4d715a65863b38c6556eede99c16ed874fa 100644 (file)
@@ -434,16 +434,6 @@ GHOST_TSuccess GHOST_WindowWin32::setOrder(GHOST_TWindowOrder order)
 
 GHOST_TSuccess GHOST_WindowWin32::swapBuffers()
 {
-       // adding a glFinish() here is to prevent Geforce in 'full scene antialias' mode
-       // from antialising the Blender window. Officially a swapbuffers does a glFinish
-       // itself, so this feels really like a hack... but it won't harm. (ton)
-       // 
-       // disabled this because it is a performance killer for the game engine, glFinish
-       // forces synchronization with the graphics card and calling it is strongly
-       // discouraged for good performance. (brecht)
-       //
-       // glFinish();
-
        return ::SwapBuffers(m_hDC) == TRUE ? GHOST_kSuccess : GHOST_kFailure;
 }
 
diff --git a/release/scripts/bpymodules/dxfLibrary.py b/release/scripts/bpymodules/dxfLibrary.py
new file mode 100644 (file)
index 0000000..5c63e7f
--- /dev/null
@@ -0,0 +1,708 @@
+#dxfLibrary.py : provides functions for generating DXF files
+# --------------------------------------------------------------------------
+__version__ = "v1.27beta - 2008.10.05"
+__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.
+
+Copyright %s
+Version %s
+License %s
+Homepage %s
+
+See the homepage for documentation.
+url:
+
+IDEAs:
+-
+               
+TODO:
+-
+
+History
+v1.27 - 2008.10.07 by migius
+- beautifying output code: keys whitespace prefix
+- refactoring DXF-strings format: NewLine moved to the end of
+v1.26 - 2008.10.05 by migius
+- modif POLYLINE to support POLYFACE
+v1.25 - 2008.09.28 by migius
+- modif FACE class for r12
+v1.24 - 2008.09.27 by migius
+- modif POLYLINE class for r12
+- changing output format from r9 to r12(AC1009)
+v1.1 (20/6/2005) by www.stani.be/python/sdxf
+- Python library to generate dxf drawings
+______________________________________________________________
+""" % (__author__,__version__,__license__,__url__)
+
+# --------------------------------------------------------------------------
+# DXF Library: copyright (C) 2005 by Stani Michiels (AKA Stani)
+#                            2008 modif by Remigiusz Fiedler (AKA migius)
+# --------------------------------------------------------------------------
+# ***** 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.
+#
+# ***** END GPL LICENCE BLOCK *****
+
+
+#import Blender
+#from Blender import Mathutils, Window, Scene, sys, Draw
+#import BPyMessages
+
+try:
+       import copy
+       #from struct import pack
+except:
+       copy = None
+
+####1) Private (only for developpers)
+_HEADER_POINTS=['insbase','extmin','extmax']
+
+#---helper functions-----------------------------------
+def _point(x,index=0):
+       """Convert tuple to a dxf point"""
+       #print 'deb: _point=', x #-------------
+       return '\n'.join([' %s\n%s'%((i+1)*10+index,x[i]) for i in range(len(x))])
+
+def _points(plist):
+       """Convert a list of tuples to dxf points"""
+       out = '\n'.join([_point(plist[i],i)for i in range(len(plist))])
+       #print 'deb: points=\n', out #-------------------
+       return out
+
+#---base classes----------------------------------------
+class _Call:
+       """Makes a callable class."""
+       def copy(self):
+               """Returns a copy."""
+               return copy.deepcopy(self)
+
+       def __call__(self,**attrs):
+               """Returns a copy with modified attributes."""
+               copied=self.copy()
+               for attr in attrs:setattr(copied,attr,attrs[attr])
+               return copied
+
+#-------------------------------------------------------
+class _Entity(_Call):
+       """Base class for _common group codes for entities."""
+       def __init__(self,color=None,extrusion=None,layer='0',
+                                lineType=None,lineTypeScale=None,lineWeight=None,
+                                thickness=None,parent=None):
+               """None values will be omitted."""
+               self.color                = color
+               self.extrusion    = extrusion
+               self.layer                = layer
+               self.lineType      = lineType
+               self.lineTypeScale  = lineTypeScale
+               self.lineWeight  = lineWeight
+               self.thickness    = thickness
+               self.parent              = parent
+
+       def _common(self):
+               """Return common group codes as a string."""
+               if self.parent:parent=self.parent
+               else:parent=self
+               result =''
+               if parent.layer!=None: result+='  8\n%s\n'%parent.layer
+               if parent.color!=None: result+=' 62\n%s\n'%parent.color
+               if parent.extrusion!=None: result+='%s\n'%_point(parent.extrusion,200)
+               if parent.lineType!=None: result+='  6\n%s\n'%parent.lineType
+               #TODO: if parent.lineWeight!=None: result+='370\n%s\n'%parent.lineWeight
+               if parent.lineTypeScale!=None: result+=' 48\n%s\n'%parent.lineTypeScale
+               if parent.thickness!=None: result+=' 39\n%s\n'%parent.thickness
+               return result
+
+#--------------------------
+class _Entities:
+       """Base class to deal with composed objects."""
+       def __dxf__(self):
+               return []
+
+       def __str__(self):
+               return ''.join([str(x) for x in self.__dxf__()])
+
+#--------------------------
+class _Collection(_Call):
+       """Base class to expose entities methods to main object."""
+       def __init__(self,entities=[]):
+               self.entities=copy.copy(entities)
+               #link entities methods to drawing
+               for attr in dir(self.entities):
+                       if attr[0]!='_':
+                               attrObject=getattr(self.entities,attr)
+                               if callable(attrObject):
+                                       setattr(self,attr,attrObject)
+
+####2) Constants
+#---color values
+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
+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)
+
+#---mtext flags
+#attachment point
+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
+#drawing direction
+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
+
+#---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
+
+#---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
+#vertical
+BASELINE       = 0
+BOTTOM   = 1
+MIDDLE   = 2
+TOP             = 3
+
+####3) Classes
+#---entitities -----------------------------------------------
+#--------------------------
+class Arc(_Entity):
+       """Arc, angles in degrees."""
+       def __init__(self,center=(0,0,0),radius=1,
+                                startAngle=0.0,endAngle=90,**common):
+               """Angles in degrees."""
+               _Entity.__init__(self,**common)
+               self.center=center
+               self.radius=radius
+               self.startAngle=startAngle
+               self.endAngle=endAngle
+       def __str__(self):
+               return '  0\nARC\n%s%s\n 40\n%s\n 50\n%s\n 51\n%s\n'%\
+                          (self._common(),_point(self.center),
+                               self.radius,self.startAngle,self.endAngle)
+
+#-----------------------------------------------
+class Circle(_Entity):
+       """Circle"""
+       def __init__(self,center=(0,0,0),radius=1,**common):
+               _Entity.__init__(self,**common)
+               self.center=center
+               self.radius=radius
+       def __str__(self):
+               return '  0\nCIRCLE\n%s%s\n 40\n%s\n'%\
+                          (self._common(),_point(self.center),self.radius)
+
+#-----------------------------------------------
+class Face(_Entity):
+       """3dface"""
+       def __init__(self,points,**common):
+               _Entity.__init__(self,**common)
+               if len(points)<4: #fix for r12 format
+                       points.append(points[-1])
+               self.points=points
+               
+       def __str__(self):
+               out = '  0\n3DFACE\n%s%s\n' %(self._common(),_points(self.points))
+               #print 'deb:out=', out #-------------------
+               return out
+
+#-----------------------------------------------
+class Insert(_Entity):
+       """Block instance."""
+       def __init__(self,name,point=(0,0,0),
+                                xscale=None,yscale=None,zscale=None,
+                                cols=None,colspacing=None,rows=None,rowspacing=None,
+                                rotation=None,
+                                **common):
+               _Entity.__init__(self,**common)
+               self.name=name
+               self.point=point
+               self.xscale=xscale
+               self.yscale=yscale
+               self.zscale=zscale
+               self.cols=cols
+               self.colspacing=colspacing
+               self.rows=rows
+               self.rowspacing=rowspacing
+               self.rotation=rotation
+
+       def __str__(self):
+               result='  0\nINSERT\n  2\n%s\n%s\n%s\n'%\
+                               (self.name,self._common(),_point(self.point))
+               if self.xscale!=None:result+=' 41\n%s\n'%self.xscale
+               if self.yscale!=None:result+=' 42\n%s\n'%self.yscale
+               if self.zscale!=None:result+=' 43\n%s\n'%self.zscale
+               if self.rotation:result+=' 50\n%s\n'%self.rotation
+               if self.cols!=None:result+=' 70\n%s\n'%self.cols
+               if self.colspacing!=None:result+=' 44\n%s\n'%self.colspacing
+               if self.rows!=None:result+=' 71\n%s\n'%self.rows
+               if self.rowspacing!=None:result+=' 45\n%s\n'%self.rowspacing
+               return result
+
+#-----------------------------------------------
+class Line(_Entity):
+       """Line"""
+       def __init__(self,points,**common):
+               _Entity.__init__(self,**common)
+               self.points=points
+       def __str__(self):
+               return '  0\nLINE\n%s%s\n' %(
+                               self._common(), _points(self.points))
+
+
+#-----------------------------------------------
+class PolyLine(_Entity):
+       def __init__(self,points,org_point=[0,0,0],flag=0,width=None,**common):
+               _Entity.__init__(self,**common)
+               self.points=points
+               self.org_point=org_point
+               self.flag=flag
+               if self.flag==64:
+                       self.points=points[0]
+                       self.faces=points[1]
+                       self.p_count=len(self.points)
+                       self.f_count=len(self.faces)
+               self.width=width
+
+       def __str__(self):
+               result= '  0\nPOLYLINE\n%s 70\n%s\n' %(self._common(),self.flag)
+               #print 'deb: self._common()', self._common() #----------
+               result+=' 66\n1\n'
+               result+='%s\n' %_point(self.org_point)
+               if self.flag==64:
+                       result+=' 71\n%s\n' %self.p_count
+                       result+=' 72\n%s\n' %self.f_count
+               for point in self.points:
+                       result+='  0\nVERTEX\n'
+                       result+='  8\n%s\n' %self.layer
+                       result+='%s\n' %_point(point)
+                       if self.flag==64: result+=' 70\n192\n'
+                       if self.width: result+=' 40\n%s\n 41\n%s\n' %(self.width,self.width)
+               if self.flag==64:
+                       for face in self.faces:
+                               result+='  0\nVERTEX\n'
+                               result+='  8\n%s\n' %self.layer
+                               result+='%s\n' %_point(self.org_point)
+                               result+=' 70\n128\n'
+                               result+=' 71\n%s\n' %face[0]
+                               result+=' 72\n%s\n' %face[1]
+                               result+=' 73\n%s\n' %face[2]
+                               if len(face)==4: result+=' 74\n%s\n' %face[3]
+               result+='  0\nSEQEND\n'
+               result+='  8\n%s\n' %self.layer
+               return result
+
+#-----------------------------------------------
+class Point(_Entity):
+       """Colored solid fill."""
+       def __init__(self,points=None,**common):
+               _Entity.__init__(self,**common)
+               self.points=points
+
+#-----------------------------------------------
+class Solid(_Entity):
+       """Colored solid fill."""
+       def __init__(self,points=None,**common):
+               _Entity.__init__(self,**common)
+               self.points=points
+       def __str__(self):
+               return '  0\nSOLID\n%s%s\n' %(self._common(),
+                        _points(self.points[:2]+[self.points[3],self.points[2]])
+                       )
+
+
+#-----------------------------------------------
+class Text(_Entity):
+       """Single text line."""
+       def __init__(self,text='',point=(0,0,0),alignment=None,
+                                flag=None,height=1,justifyhor=None,justifyver=None,
+                                rotation=None,obliqueAngle=None,style=None,xscale=None,**common):
+               _Entity.__init__(self,**common)
+               self.text=text
+               self.point=point
+               self.alignment=alignment
+               self.flag=flag
+               self.height=height
+               self.justifyhor=justifyhor
+               self.justifyver=justifyver
+               self.rotation=rotation
+               self.obliqueAngle=obliqueAngle
+               self.style=style
+               self.xscale=xscale
+       def __str__(self):
+               result= '  0\nTEXT\n%s%s\n 40\n%s\n  1\n%s\n'%\
+                               (self._common(),_point(self.point),self.height,self.text)
+               if self.rotation: result+=' 50\n%s\n'%self.rotation
+               if self.xscale: result+=' 41\n%s\n'%self.xscale
+               if self.obliqueAngle: result+=' 51\n%s\n'%self.obliqueAngle
+               if self.style: result+='  7\n%s\n'%self.style
+               if self.flag: result+=' 71\n%s\n'%self.flag
+               if self.justifyhor: result+=' 72\n%s\n'%self.justifyhor
+               #TODO: if self.alignment: result+='%s\n'%_point(self.alignment,1)
+               if self.justifyver: result+=' 73\n%s\n'%self.justifyver
+               return result
+
+#-----------------------------------------------
+class Mtext(Text):
+       """Surrogate for mtext, generates some Text instances."""
+       def __init__(self,text='',point=(0,0,0),width=250,spacingFactor=1.5,down=0,spacingWidth=None,**options):
+               Text.__init__(self,text=text,point=point,**options)
+               if down:spacingFactor*=-1
+               self.spacingFactor=spacingFactor
+               self.spacingWidth=spacingWidth
+               self.width=width
+               self.down=down
+       def __str__(self):
+               texts=self.text.replace('\r\n','\n').split('\n')
+               if not self.down:texts.reverse()
+               result=''
+               x=y=0
+               if self.spacingWidth:spacingWidth=self.spacingWidth
+               else:spacingWidth=self.height*self.spacingFactor
+               for text in texts:
+                       while text:
+                               result+='%s\n'%Text(text[:self.width],
+                                       point=(self.point[0]+x*spacingWidth,
+                                                  self.point[1]+y*spacingWidth,
+                                                  self.point[2]),
+                                       alignment=self.alignment,flag=self.flag,height=self.height,
+                                       justifyhor=self.justifyhor,justifyver=self.justifyver,
+                                       rotation=self.rotation,obliqueAngle=self.obliqueAngle,
+                                       style=self.style,xscale=self.xscale,parent=self
+                               )
+                               text=text[self.width:]
+                               if self.rotation:x+=1
+                               else:y+=1
+               return result[1:]
+
+#-----------------------------------------------
+##class _Mtext(_Entity):
+##     """Mtext not functioning for minimal dxf."""
+##     def __init__(self,text='',point=(0,0,0),attachment=1,
+##                              charWidth=None,charHeight=1,direction=1,height=100,rotation=0,
+##                              spacingStyle=None,spacingFactor=None,style=None,width=100,
+##                              xdirection=None,**common):
+##             _Entity.__init__(self,**common)
+##             self.text=text
+##             self.point=point
+##             self.attachment=attachment
+##             self.charWidth=charWidth
+##             self.charHeight=charHeight
+##             self.direction=direction
+##             self.height=height
+##             self.rotation=rotation
+##             self.spacingStyle=spacingStyle
+##             self.spacingFactor=spacingFactor
+##             self.style=style
+##             self.width=width
+##             self.xdirection=xdirection
+##     def __str__(self):
+##             input=self.text
+##             text=''
+##             while len(input)>250:
+##                     text+='3\n%s\n'%input[:250]
+##                     input=input[250:]
+##             text+='1\n%s\n'%input
+##             result= '0\nMTEXT\n%s\n%s\n40\n%s\n41\n%s\n71\n%s\n72\n%s%s\n43\n%s\n50\n%s\n'%\
+##                             (self._common(),_point(self.point),self.charHeight,self.width,
+##                              self.attachment,self.direction,text,
+##                              self.height,
+##                              self.rotation)
+##             if self.style:result+='7\n%s\n'%self.style
+##             if self.xdirection:result+='%s\n'%_point(self.xdirection,1)
+##             if self.charWidth:result+='42\n%s\n'%self.charWidth
+##             if self.spacingStyle:result+='73\n%s\n'%self.spacingStyle
+##             if self.spacingFactor:result+='44\n%s\n'%self.spacingFactor
+##             return result
+
+#---tables ---------------------------------------------------
+#-----------------------------------------------
+class Block(_Collection):
+       """Use list methods to add entities, eg append."""
+       def __init__(self,name,layer='0',flag=0,base=(0,0,0),entities=[]):
+               self.entities=copy.copy(entities)
+               _Collection.__init__(self,entities)
+               self.layer=layer
+               self.name=name
+               self.flag=0
+               self.base=base
+       def __str__(self):
+               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)
+
+#-----------------------------------------------
+class Layer(_Call):
+       """Layer"""
+       def __init__(self,name='pydxf',color=7,lineType='continuous',flag=64):
+               self.name=name
+               self.color=color
+               self.lineType=lineType
+               self.flag=flag
+       def __str__(self):
+               return '  0\nLAYER\n  2\n%s\n 70\n%s\n 62\n%s\n  6\n%s\n'%\
+                          (self.name.upper(),self.flag,self.color,self.lineType)
+
+#-----------------------------------------------
+class LineType(_Call):
+       """Custom linetype"""
+       def __init__(self,name='continuous',description='Solid line',elements=[],flag=64):
+               # TODO: Implement lineType elements
+               self.name=name
+               self.description=description
+               self.elements=copy.copy(elements)
+               self.flag=flag
+       def __str__(self):
+               return '  0\nLTYPE\n  2\n%s\n 70\n%s\n  3\n%s\n 72\n65\n 73\n%s\n 40\n0.0\n'%\
+                       (self.name.upper(),self.flag,self.description,len(self.elements))
+
+#-----------------------------------------------
+class Style(_Call):
+       """Text style"""
+       def __init__(self,name='standard',flag=0,height=0,widthFactor=40,obliqueAngle=50,
+                                mirror=0,lastHeight=1,font='arial.ttf',bigFont=''):
+               self.name=name
+               self.flag=flag
+               self.height=height
+               self.widthFactor=widthFactor
+               self.obliqueAngle=obliqueAngle
+               self.mirror=mirror
+               self.lastHeight=lastHeight
+               self.font=font
+               self.bigFont=bigFont
+       def __str__(self):
+               return '  0\nSTYLE\n  2\n%s\n 70\n%s\n 40\n%s\n 41\n%s\n 50\n%s\n 71\n%s\n 42\n%s\n 3\n%s\n 4\n%s\n'%\
+                          (self.name.upper(),self.flag,self.flag,self.widthFactor,
+                               self.obliqueAngle,self.mirror,self.lastHeight,
+                               self.font.upper(),self.bigFont.upper())
+
+#-----------------------------------------------
+class View(_Call):
+       def __init__(self,name,flag=0,width=1,height=1,center=(0.5,0.5),
+                                direction=(0,0,1),target=(0,0,0),lens=50,
+                                frontClipping=0,backClipping=0,twist=0,mode=0):
+               self.name=name
+               self.flag=flag
+               self.width=width
+               self.height=height
+               self.center=center
+               self.direction=direction
+               self.target=target
+               self.lens=lens
+               self.frontClipping=frontClipping
+               self.backClipping=backClipping
+               self.twist=twist
+               self.mode=mode
+       def __str__(self):
+               return '  0\nVIEW\n  2\n%s\n 70\n%s\n 40\n%s\n%s\n 41\n%s\n%s\n%s\n 42\n%s\n 43\n%s\n 44\n%s\n 50\n%s\n 71\n%s\n'%\
+                          (self.name,self.flag,self.height,_point(self.center),self.width,
+                               _point(self.direction,1),_point(self.target,2),self.lens,
+                               self.frontClipping,self.backClipping,self.twist,self.mode)
+
+#-----------------------------------------------
+def ViewByWindow(name,leftBottom=(0,0),rightTop=(1,1),**options):
+       width=abs(rightTop[0]-leftBottom[0])
+       height=abs(rightTop[1]-leftBottom[1])
+       center=((rightTop[0]+leftBottom[0])*0.5,(rightTop[1]+leftBottom[1])*0.5)
+       return View(name=name,width=width,height=height,center=center,**options)
+
+#---drawing
+#-----------------------------------------------
+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),
+                                layers=[Layer()],linetypes=[LineType()],styles=[Style()],blocks=[],
+                                views=[],entities=None,fileName='test.dxf'):
+               # TODO: replace list with None,arial
+               if not entities:entities=[]
+               _Collection.__init__(self,entities)
+               self.insbase=insbase
+               self.extmin=extmin
+               self.extmax=extmax
+               self.layers=copy.copy(layers)
+               self.linetypes=copy.copy(linetypes)
+               self.styles=copy.copy(styles)
+               self.views=copy.copy(views)
+               self.blocks=copy.copy(blocks)
+               self.fileName=fileName
+               #private
+               #self.acadver='9\n$ACADVER\n1\nAC1006\n'
+               self.acadver='  9\n$ACADVER\n  1\nAC1009\n'
+               """DXF AutoCAD-Release format codes
+               AC1021  2008, 2007 
+               AC1018  2006, 2005, 2004 
+               AC1015  2002, 2000i, 2000 
+               AC1014  R14,14.01 
+               AC1012  R13    
+               AC1009  R12,11 
+               AC1006  R10    
+               AC1004  R9    
+               AC1002  R2.6  
+               AC1.50  R2.05 
+               """
+
+       def _name(self,x):
+               """Helper function for self._point"""
+               return '  9\n$%s\n' %x.upper()
+
+       def _point(self,name,x):
+               """Point setting from drawing like extmin,extmax,..."""
+               return '%s%s' %(self._name(name),_point(x))
+
+       def _section(self,name,x):
+               """Sections like tables,blocks,entities,..."""
+               if x: xstr=''.join(x)
+               else: xstr=''
+               return '  0\nSECTION\n  2\n%s\n%s  0\nENDSEC\n'%(name.upper(),xstr)
+
+       def _table(self,name,x):
+               """Tables like ltype,layer,style,..."""
+               if x: xstr=''.join(x)
+               else: xstr=''
+               return '  0\nTABLE\n  2\n%s\n 70\n%s\n%s  0\nENDTAB\n'%(name.upper(),len(x),xstr)
+
+       def __str__(self):
+               """Returns drawing as dxf string."""
+               header=[self.acadver]+[self._point(attr,getattr(self,attr))+'\n' for attr in _HEADER_POINTS]
+               header=self._section('header',header)
+
+               tables=[self._table('ltype',[str(x) for x in self.linetypes]),
+                               self._table('layer',[str(x) for x in self.layers]),
+                               self._table('style',[str(x) for x in self.styles]),
+                               self._table('view',[str(x) for x in self.views]),
+               ]
+               tables=self._section('tables',tables)
+
+               blocks=self._section('blocks',[str(x) for x in self.blocks])
+
+               entities=self._section('entities',[str(x) for x in self.entities])
+
+               all=''.join([header,tables,blocks,entities,'  0\nEOF\n'])
+               return all
+
+       def saveas(self,fileName):
+               self.fileName=fileName
+               self.save()
+
+       def save(self):
+               test=open(self.fileName,'w')
+               test.write(str(self))
+               test.close()
+
+
+#---extras
+#-----------------------------------------------
+class Rectangle(_Entity):
+       """Rectangle, creates lines."""
+       def __init__(self,point=(0,0,0),width=1,height=1,solid=None,line=1,**common):
+               _Entity.__init__(self,**common)
+               self.point=point
+               self.width=width
+               self.height=height
+               self.solid=solid
+               self.line=line
+       def __str__(self):
+               result=''
+               points=[self.point,(self.point[0]+self.width,self.point[1],self.point[2]),
+                       (self.point[0]+self.width,self.point[1]+self.height,self.point[2]),
+                       (self.point[0],self.point[1]+self.height,self.point[2]),self.point]
+               if self.solid:
+                       result+= Solid(points=points[:-1],parent=self.solid)
+               if self.line:
+                       for i in range(4):
+                               result+= Line(points=[points[i],points[i+1]],parent=self)
+               return result[1:]
+
+#-----------------------------------------------
+class LineList(_Entity):
+       """Like polyline, but built of individual lines."""
+       def __init__(self,points=[],org_point=[0,0,0],closed=0,**common):
+               _Entity.__init__(self,**common)
+               self.closed=closed
+               self.points=copy.copy(points)
+       def __str__(self):
+               if self.closed:points=self.points+[self.points[0]]
+               else: points=self.points
+               result=''
+               for i in range(len(points)-1):
+                       result+= Line(points=[points[i],points[i+1]],parent=self)
+               return result[1:]
+
+#-----------------------------------------------------
+def test():
+       #Blocks
+       b=Block('test')
+       b.append(Solid(points=[(0,0,0),(1,0,0),(1,1,0),(0,1,0)],color=1))
+       b.append(Arc(center=(1,0,0),color=2))
+
+       #Drawing
+       d=Drawing()
+       #tables
+       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
+       d.append(Circle(center=(1,1,0),color=3))
+       d.append(Face(points=[(0,0,0),(1,0,0),(1,1,0),(0,1,0)],color=4))
+       d.append(Insert('test',point=(3,3,3),cols=5,colspacing=2))
+       d.append(Line(points=[(0,0,0),(1,1,1)]))
+       d.append(Mtext('Click on Ads\nmultiple lines with mtext',point=(1,1,1),color=5,rotation=90))
+       d.append(Text('Please donate!',point=(3,0,1)))
+       d.append(Rectangle(point=(2,2,2),width=4,height=3,color=6,solid=Solid(color=2)))
+       d.append(Solid(points=[(4,4,0),(5,4,0),(7,8,0),(9,9,0)],color=3))
+       d.append(PolyLine(points=[(1,1,1),(2,1,1),(2,2,1),(1,2,1)],closed=1,color=1))
+
+       #d.saveas('c:\\test.dxf')
+       d.saveas('test.dxf')
+
+
+#-----------------------------------------------------
+if __name__=='__main__':
+       if not copy:
+               Draw.PupMenu('Error%t|This script requires a full python install')
+       main()
+       
\ No newline at end of file
index 2093ac109f73fca7791f7af0d3e3786d2e5c48ff..5cdd8a712316da1b1b088de37afa05d0a05f29a6 100644 (file)
@@ -231,7 +231,7 @@ def read_bvh(file_path, GLOBAL_SCALE=1.0):
        
        bvh_nodes_list= bvh_nodes.values()
        
-       while lineIdx < len(file_lines) -1:
+       while lineIdx < len(file_lines):
                line= file_lines[lineIdx]
                for bvh_node in bvh_nodes_list:
                        #for bvh_node in bvh_nodes_serial:
@@ -726,7 +726,7 @@ def load_bvh_ui(file, PREF_UI= True):
        Blender.Window.WaitCursor(1)
        # Get the BVH data and act on it.
        t1= Blender.sys.time()
-       print '\tpassing bvh...',
+       print '\tparsing bvh...',
        bvh_nodes= read_bvh(file, IMPORT_SCALE)
        print '%.4f' % (Blender.sys.time()-t1)
        t1= Blender.sys.time()
index ca4f8cd79e90e12e21cf0611a03db5ae11e4696e..bfe691c394c6c5d691c9676f8590f75493037b93 100644 (file)
@@ -1,5 +1,5 @@
 #!BPY
-
+# -*- coding: latin-1 -*-
 """
 Name: 'Motion Capture  (.c3d)...'
 Blender: 246
index 4251bad86544e9ea9918d3a0321f107c9a305081..cbf8e272b9151194f1642396518a7df607361416 100644 (file)
@@ -246,6 +246,10 @@ information about how to fix this.
                        fields = fields[2].split()
                        if len(fields) > 1:
                                fname = fields[1].split(sep)[-1]
+                               i = 1
+                               while not fname.endswith('.py'):
+                                       i += 1
+                                       fname = "%s %s" % (fname, fields[i])
                                ALL_SCRIPTS[fname] = (menuname, group_len - 1)
        return True
 
index 665861563596935d65c144342289e28ddf6c6420..061e29b81c79c4f5f3a4a886c15ed32a20a8fbe7 100644 (file)
@@ -7,52 +7,65 @@
  Tooltip: 'Export geometry to DXF-r12 (Drawing eXchange Format).'
 """
 
-__version__ = "v1.25beta - 2008.09.28"
-__author__  = "Stani & migius(Remigiusz Fiedler)"
+__version__ = "v1.27beta - 2008.10.07"
+__author__  = "Remigiusz Fiedler (AKA migius)"
 __license__ = "GPL"
 __url__         = "http://wiki.blender.org/index.php/Scripts/Manual/Export/autodesk_dxf"
 __bpydoc__ ="""The script exports Blender geometry to DXF format r12 version.
 
-Copyright %s
 Version %s
+Copyright %s
 License %s
-Homepage %s
+
+extern dependances: dxfLibrary.py
 
 See the homepage for documentation.
-url:
-""" % (__author__,__version__,__license__,__url__)
+url: %s
 
-"""
 IDEAs:
- - correct normals for POLYLINE-POLYFACE objects via correct point-order
- - HPGL output for 2d and flattened3d content
+ - correct normals for POLYLINE-POLYFACE via proper point-order
+ - HPGL output for 2d and flattened 3d content
                
 TODO:
- - support hierarchies: groups, instances, parented structures
- - support 210-code (3d orientation vector)
- - presets for architectural scales
+- optimize back-faces removal (probably needs matrix transform)
+- optimize POLYFACE routine: remove double-vertices
+- optimize POLYFACE routine: remove unused vertices
+- support hierarchies: groups, instances, parented structures
+- support 210-code (3d orientation vector)
+- presets for architectural scales
+- write drawing extends for automatic view positioning in CAD
 
 History
+v1.27 - 2008.10.07 by migius
+- exclude Stani's DXF-Library to extern module
+v1.26 - 2008.10.05 by migius
+- add "hidden mode" substitut: back-faces removal
+- add support for mesh ->POLYFACE
+- optimized code for "Flat" procedure
 v1.25 - 2008.09.28 by migius
- - modif FACE class for r12
- - add mesh-polygon -> Bezier-curve converter (Yorik's code)
- - add support for curves ->POLYLINEs
- - add "3d-View to Flat" - geometry projection to XY-plane
+- modif FACE class for r12
+- add mesh-polygon -> Bezier-curve converter (Yorik's code)
+- add support for curves ->POLYLINEs
+- add "3d-View to Flat" - geometry projection to XY-plane
 v1.24 - 2008.09.27 by migius
- - add start UI with preferences
- - modif POLYLINE class for r12
- - changing output format from r9 to r12(AC1009)
+- add start UI with preferences
+- modif POLYLINE class for r12
+- changing output format from r9 to r12(AC1009)
 v1.23 - 2008.09.26 by migius
- - add finish message-box
+- add finish message-box
 v1.22 - 2008.09.26 by migius
- - add support for curves ->LINEs
- - add support for mesh-edges ->LINEs
+- add support for curves ->LINEs
+- add support for mesh-edges ->LINEs
 v1.21 - 2008.06.04 by migius
- - initial adaptation for Blender
-v1.1 (20/6/2005) by www.stani.be/python/sdxf
- - Python library to generate dxf drawings
+- initial adaptation for Blender
+v1.1 (20/6/2005) by Stani Michiels www.stani.be/python/sdxf
+- Python library to generate dxf drawings
 ______________________________________________________________
-"""
+""" % (__author__,__version__,__license__,__url__)
+
+# --------------------------------------------------------------------------
+# Script copyright (C) 2008 Remigiusz Fiedler (AKA migius)
+# --------------------------------------------------------------------------
 # ***** BEGIN GPL LICENSE BLOCK *****
 #
 # This program is free software; you can redistribute it and/or
@@ -76,602 +89,254 @@ import Blender
 from Blender import Mathutils, Window, Scene, sys, Draw
 import BPyMessages
 
-try:
-       import copy
-       #from struct import pack
-except:
-       copy = None
-
-####1) Private (only for developpers)
-_HEADER_POINTS=['insbase','extmin','extmax']
-
-#---helper functions-----------------------------------
-def _point(x,index=0):
-       """Convert tuple to a dxf point"""
-       #print '_point=', x #-------------
-       return '\n'.join(['%s\n%s'%((i+1)*10+index,x[i]) for i in range(len(x))])
-
-def _points(plist):
-       """Convert a list of tuples to dxf points"""
-       return [_point(plist[i],i)for i in range(len(plist))]
-
-#---base classes----------------------------------------
-class _Call:
-       """Makes a callable class."""
-       def copy(self):
-               """Returns a copy."""
-               return copy.deepcopy(self)
-
-       def __call__(self,**attrs):
-               """Returns a copy with modified attributes."""
-               copied=self.copy()
-               for attr in attrs:setattr(copied,attr,attrs[attr])
-               return copied
-
-#-------------------------------------------------------
-class _Entity(_Call):
-       """Base class for _common group codes for entities."""
-       def __init__(self,color=None,extrusion=None,layer='0',
-                                lineType=None,lineTypeScale=None,lineWeight=None,
-                                thickness=None,parent=None):
-               """None values will be omitted."""
-               self.color                = color
-               self.extrusion    = extrusion
-               self.layer                = layer
-               self.lineType      = lineType
-               self.lineTypeScale  = lineTypeScale
-               self.lineWeight  = lineWeight
-               self.thickness    = thickness
-               self.parent              = parent
-
-       def _common(self):
-               """Return common group codes as a string."""
-               if self.parent:parent=self.parent
-               else:parent=self
-               result='8\n%s'%parent.layer
-               if parent.color!=None:            result+='\n62\n%s'%parent.color
-               if parent.extrusion!=None:        result+='\n%s'%_point(parent.extrusion,200)
-               if parent.lineType!=None:          result+='\n6\n%s'%parent.lineType
-               if parent.lineWeight!=None:      result+='\n370\n%s'%parent.lineWeight
-               if parent.lineTypeScale!=None:  result+='\n48\n%s'%parent.lineTypeScale
-               if parent.thickness!=None:        result+='\n39\n%s'%parent.thickness
-               return result
-
-#--------------------------
-class _Entities:
-       """Base class to deal with composed objects."""
-       def __dxf__(self):
-               return []
-
-       def __str__(self):
-               return '\n'.join([str(x) for x in self.__dxf__()])
-
-#--------------------------
-class _Collection(_Call):
-       """Base class to expose entities methods to main object."""
-       def __init__(self,entities=[]):
-               self.entities=copy.copy(entities)
-               #link entities methods to drawing
-               for attr in dir(self.entities):
-                       if attr[0]!='_':
-                               attrObject=getattr(self.entities,attr)
-                               if callable(attrObject):
-                                       setattr(self,attr,attrObject)
-
-####2) Constants
-#---color values
-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
-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)
-
-#---mtext flags
-#attachment point
-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
-#drawing direction
-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
-
-#---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
-
-#---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
-#vertical
-BASELINE       = 0
-BOTTOM   = 1
-MIDDLE   = 2
-TOP             = 3
-
-####3) Classes
-#---entitities -----------------------------------------------
-#--------------------------
-class Arc(_Entity):
-       """Arc, angles in degrees."""
-       def __init__(self,center=(0,0,0),radius=1,
-                                startAngle=0.0,endAngle=90,**common):
-               """Angles in degrees."""
-               _Entity.__init__(self,**common)
-               self.center=center
-               self.radius=radius
-               self.startAngle=startAngle
-               self.endAngle=endAngle
-       def __str__(self):
-               return '0\nARC\n%s\n%s\n40\n%s\n50\n%s\n51\n%s'%\
-                          (self._common(),_point(self.center),
-                               self.radius,self.startAngle,self.endAngle)
-
-#-----------------------------------------------
-class Circle(_Entity):
-       """Circle"""
-       def __init__(self,center=(0,0,0),radius=1,**common):
-               _Entity.__init__(self,**common)
-               self.center=center
-               self.radius=radius
-       def __str__(self):
-               return '0\nCIRCLE\n%s\n%s\n40\n%s'%\
-                          (self._common(),_point(self.center),self.radius)
-
-#-----------------------------------------------
-class Face(_Entity):
-       """3dface"""
-       def __init__(self,points,**common):
-               _Entity.__init__(self,**common)
-               if len(points)<4: #fix for r12 format
-                       points.append(points[-1])
-               self.points=points
-               
-       def __str__(self):
-               return '\n'.join(['0\n3DFACE',self._common()]+
-                                                _points(self.points)
-                                                )
-#-----------------------------------------------
-class Insert(_Entity):
-       """Block instance."""
-       def __init__(self,name,point=(0,0,0),
-                                xscale=None,yscale=None,zscale=None,
-                                cols=None,colspacing=None,rows=None,rowspacing=None,
-                                rotation=None,
-                                **common):
-               _Entity.__init__(self,**common)
-               self.name=name
-               self.point=point
-               self.xscale=xscale
-               self.yscale=yscale
-               self.zscale=zscale
-               self.cols=cols
-               self.colspacing=colspacing
-               self.rows=rows
-               self.rowspacing=rowspacing
-               self.rotation=rotation
-
-       def __str__(self):
-               result='0\nINSERT\n2\n%s\n%s\n%s'%\
-                               (self.name,self._common(),_point(self.point))
-               if self.xscale!=None:result+='\n41\n%s'%self.xscale
-               if self.yscale!=None:result+='\n42\n%s'%self.yscale
-               if self.zscale!=None:result+='\n43\n%s'%self.zscale
-               if self.rotation:result+='\n50\n%s'%self.rotation
-               if self.cols!=None:result+='\n70\n%s'%self.cols
-               if self.colspacing!=None:result+='\n44\n%s'%self.colspacing
-               if self.rows!=None:result+='\n71\n%s'%self.rows
-               if self.rowspacing!=None:result+='\n45\n%s'%self.rowspacing
-               return result
-
-#-----------------------------------------------
-class Line(_Entity):
-       """Line"""
-       def __init__(self,points,**common):
-               _Entity.__init__(self,**common)
-               self.points=points
-       def __str__(self):
-               return '\n'.join(['0\nLINE',self._common()]+
-                                                _points(self.points))
-
-#-----------------------------------------------
-class PolyLine(_Entity):
-       #TODO: Finish polyline (now implemented as a series of lines)
-       def __init__(self,points,org_point=[0,0,0],flag=0,width=None,**common):
-               _Entity.__init__(self,**common)
-               self.points=points
-               self.org_point=org_point
-               self.flag=flag
-               self.width=width
-       def __str__(self):
-               result= '0\nPOLYLINE\n%s\n70\n%s' %(self._common(),self.flag)
-               #print 'self._common()', self._common() #----------
-               result+='\n66\n1'
-               result+='\n%s' %_point(self.org_point)
-               for point in self.points:
-                       result+='\n0\nVERTEX'
-                       result+='\n8\n%s' %self.layer
-                       result+='\n%s' %_point(point)
-                       if self.width:result+='\n40\n%s\n41\n%s' %(self.width,self.width)
-               result+='\n0\nSEQEND'
-               result+='\n8\n%s' %self.layer
-               return result
-
-#-----------------------------------------------
-class Point(_Entity):
-       """Colored solid fill."""
-       def __init__(self,points=None,**common):
-               _Entity.__init__(self,**common)
-               self.points=points
-
-#-----------------------------------------------
-class Solid(_Entity):
-       """Colored solid fill."""
-       def __init__(self,points=None,**common):
-               _Entity.__init__(self,**common)
-               self.points=points
-       def __str__(self):
-               return '\n'.join(['0\nSOLID',self._common()]+
-                                                _points(self.points[:2]+[self.points[3],self.points[2]])
-                                                )
-
-#-----------------------------------------------
-class Text(_Entity):
-       """Single text line."""
-       def __init__(self,text='',point=(0,0,0),alignment=None,
-                                flag=None,height=1,justifyhor=None,justifyver=None,
-                                rotation=None,obliqueAngle=None,style=None,xscale=None,**common):
-               _Entity.__init__(self,**common)
-               self.text=text
-               self.point=point
-               self.alignment=alignment
-               self.flag=flag
-               self.height=height
-               self.justifyhor=justifyhor
-               self.justifyver=justifyver
-               self.rotation=rotation
-               self.obliqueAngle=obliqueAngle
-               self.style=style
-               self.xscale=xscale
-       def __str__(self):
-               result= '0\nTEXT\n%s\n%s\n40\n%s\n1\n%s'%\
-                               (self._common(),_point(self.point),self.height,self.text)
-               if self.rotation:result+='\n50\n%s'%self.rotation
-               if self.xscale:result+='\n41\n%s'%self.xscale
-               if self.obliqueAngle:result+='\n51\n%s'%self.obliqueAngle
-               if self.style:result+='\n7\n%s'%self.style
-               if self.flag:result+='\n71\n%s'%self.flag
-               if self.justifyhor:result+='\n72\n%s'%self.justifyhor
-               if self.alignment:result+='\n%s'%_point(self.alignment,1)
-               if self.justifyver:result+='\n73\n%s'%self.justifyver
-               return result
-
-#-----------------------------------------------
-class Mtext(Text):
-       """Surrogate for mtext, generates some Text instances."""
-       def __init__(self,text='',point=(0,0,0),width=250,spacingFactor=1.5,down=0,spacingWidth=None,**options):
-               Text.__init__(self,text=text,point=point,**options)
-               if down:spacingFactor*=-1
-               self.spacingFactor=spacingFactor
-               self.spacingWidth=spacingWidth
-               self.width=width
-               self.down=down
-       def __str__(self):
-               texts=self.text.replace('\r\n','\n').split('\n')
-               if not self.down:texts.reverse()
-               result=''
-               x=y=0
-               if self.spacingWidth:spacingWidth=self.spacingWidth
-               else:spacingWidth=self.height*self.spacingFactor
-               for text in texts:
-                       while text:
-                               result+='\n%s'%Text(text[:self.width],
-                                       point=(self.point[0]+x*spacingWidth,
-                                                  self.point[1]+y*spacingWidth,
-                                                  self.point[2]),
-                                       alignment=self.alignment,flag=self.flag,height=self.height,
-                                       justifyhor=self.justifyhor,justifyver=self.justifyver,
-                                       rotation=self.rotation,obliqueAngle=self.obliqueAngle,
-                                       style=self.style,xscale=self.xscale,parent=self
-                               )
-                               text=text[self.width:]
-                               if self.rotation:x+=1
-                               else:y+=1
-               return result[1:]
-
-#-----------------------------------------------
-##class _Mtext(_Entity):
-##     """Mtext not functioning for minimal dxf."""
-##     def __init__(self,text='',point=(0,0,0),attachment=1,
-##                              charWidth=None,charHeight=1,direction=1,height=100,rotation=0,
-##                              spacingStyle=None,spacingFactor=None,style=None,width=100,
-##                              xdirection=None,**common):
-##             _Entity.__init__(self,**common)
-##             self.text=text
-##             self.point=point
-##             self.attachment=attachment
-##             self.charWidth=charWidth
-##             self.charHeight=charHeight
-##             self.direction=direction
-##             self.height=height
-##             self.rotation=rotation
-##             self.spacingStyle=spacingStyle
-##             self.spacingFactor=spacingFactor
-##             self.style=style
-##             self.width=width
-##             self.xdirection=xdirection
-##     def __str__(self):
-##             input=self.text
-##             text=''
-##             while len(input)>250:
-##                     text+='\n3\n%s'%input[:250]
-##                     input=input[250:]
-##             text+='\n1\n%s'%input
-##             result= '0\nMTEXT\n%s\n%s\n40\n%s\n41\n%s\n71\n%s\n72\n%s%s\n43\n%s\n50\n%s'%\
-##                             (self._common(),_point(self.point),self.charHeight,self.width,
-##                              self.attachment,self.direction,text,
-##                              self.height,
-##                              self.rotation)
-##             if self.style:result+='\n7\n%s'%self.style
-##             if self.xdirection:result+='\n%s'%_point(self.xdirection,1)
-##             if self.charWidth:result+='\n42\n%s'%self.charWidth
-##             if self.spacingStyle:result+='\n73\n%s'%self.spacingStyle
-##             if self.spacingFactor:result+='\n44\n%s'%self.spacingFactor
-##             return result
-
-#---tables ---------------------------------------------------
-#-----------------------------------------------
-class Block(_Collection):
-       """Use list methods to add entities, eg append."""
-       def __init__(self,name,layer='0',flag=0,base=(0,0,0),entities=[]):
-               self.entities=copy.copy(entities)
-               _Collection.__init__(self,entities)
-               self.layer=layer
-               self.name=name
-               self.flag=0
-               self.base=base
-       def __str__(self):
-               e='\n'.join([str(x)for x in self.entities])
-               return '0\nBLOCK\n8\n%s\n2\n%s\n70\n%s\n%s\n3\n%s\n%s\n0\nENDBLK'%\
-                          (self.layer,self.name.upper(),self.flag,_point(self.base),self.name.upper(),e)
-
-#-----------------------------------------------
-class Layer(_Call):
-       """Layer"""
-       def __init__(self,name='pydxf',color=7,lineType='continuous',flag=64):
-               self.name=name
-               self.color=color
-               self.lineType=lineType
-               self.flag=flag
-       def __str__(self):
-               return '0\nLAYER\n2\n%s\n70\n%s\n62\n%s\n6\n%s'%\
-                          (self.name.upper(),self.flag,self.color,self.lineType)
-
-#-----------------------------------------------
-class LineType(_Call):
-       """Custom linetype"""
-       def __init__(self,name='continuous',description='Solid line',elements=[],flag=64):
-               # TODO: Implement lineType elements
-               self.name=name
-               self.description=description
-               self.elements=copy.copy(elements)
-               self.flag=flag
-       def __str__(self):
-               return '0\nLTYPE\n2\n%s\n70\n%s\n3\n%s\n72\n65\n73\n%s\n40\n0.0'%\
-                       (self.name.upper(),self.flag,self.description,len(self.elements))
-
-#-----------------------------------------------
-class Style(_Call):
-       """Text style"""
-       def __init__(self,name='standard',flag=0,height=0,widthFactor=40,obliqueAngle=50,
-                                mirror=0,lastHeight=1,font='arial.ttf',bigFont=''):
-               self.name=name
-               self.flag=flag
-               self.height=height
-               self.widthFactor=widthFactor
-               self.obliqueAngle=obliqueAngle
-               self.mirror=mirror
-               self.lastHeight=lastHeight
-               self.font=font
-               self.bigFont=bigFont
-       def __str__(self):
-               return '0\nSTYLE\n2\n%s\n70\n%s\n40\n%s\n41\n%s\n50\n%s\n71\n%s\n42\n%s\n3\n%s\n4\n%s'%\
-                          (self.name.upper(),self.flag,self.flag,self.widthFactor,
-                               self.obliqueAngle,self.mirror,self.lastHeight,
-                               self.font.upper(),self.bigFont.upper())
-
-#-----------------------------------------------
-class View(_Call):
-       def __init__(self,name,flag=0,width=1,height=1,center=(0.5,0.5),
-                                direction=(0,0,1),target=(0,0,0),lens=50,
-                                frontClipping=0,backClipping=0,twist=0,mode=0):
-               self.name=name
-               self.flag=flag
-               self.width=width
-               self.height=height
-               self.center=center
-               self.direction=direction
-               self.target=target
-               self.lens=lens
-               self.frontClipping=frontClipping
-               self.backClipping=backClipping
-               self.twist=twist
-               self.mode=mode
-       def __str__(self):
-               return '0\nVIEW\n2\n%s\n70\n%s\n40\n%s\n%s\n41\n%s\n%s\n%s\n42\n%s\n43\n%s\n44\n%s\n50\n%s\n71\n%s'%\
-                          (self.name,self.flag,self.height,_point(self.center),self.width,
-                               _point(self.direction,1),_point(self.target,2),self.lens,
-                               self.frontClipping,self.backClipping,self.twist,self.mode)
-
-#-----------------------------------------------
-def ViewByWindow(name,leftBottom=(0,0),rightTop=(1,1),**options):
-       width=abs(rightTop[0]-leftBottom[0])
-       height=abs(rightTop[1]-leftBottom[1])
-       center=((rightTop[0]+leftBottom[0])*0.5,(rightTop[1]+leftBottom[1])*0.5)
-       return View(name=name,width=width,height=height,center=center,**options)
-
-#---drawing
-#-----------------------------------------------
-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),
-                                layers=[Layer()],linetypes=[LineType()],styles=[Style()],blocks=[],
-                                views=[],entities=None,fileName='test.dxf'):
-               # TODO: replace list with None,arial
-               if not entities:entities=[]
-               _Collection.__init__(self,entities)
-               self.insbase=insbase
-               self.extmin=extmin
-               self.extmax=extmax
-               self.layers=copy.copy(layers)
-               self.linetypes=copy.copy(linetypes)
-               self.styles=copy.copy(styles)
-               self.views=copy.copy(views)
-               self.blocks=copy.copy(blocks)
-               self.fileName=fileName
-               #private
-               #self.acadver='9\n$ACADVER\n1\nAC1006'
-               self.acadver='9\n$ACADVER\n1\nAC1009'
-               """DXF AutoCAD-Release format code
-               AC1021  2008, 2007 
-               AC1018  2006, 2005, 2004 
-               AC1015  2002, 2000i, 2000 
-               AC1014  R14,14.01 
-               AC1012  R13    
-               AC1009  R12,11 
-               AC1006  R10    
-               AC1004  R9    
-               AC1002  R2.6  
-               AC1.50  R2.05 
-               """
-
-       def _name(self,x):
-               """Helper function for self._point"""
-               return '9\n$%s'%x.upper()
-
-       def _point(self,name,x):
-               """Point setting from drawing like extmin,extmax,..."""
-               return '%s\n%s'%(self._name(name),_point(x))
-
-       def _section(self,name,x):
-               """Sections like tables,blocks,entities,..."""
-               if x:xstr='\n'+'\n'.join(x)
-               else:xstr=''
-               return '0\nSECTION\n2\n%s%s\n0\nENDSEC'%(name.upper(),xstr)
-
-       def _table(self,name,x):
-               """Tables like ltype,layer,style,..."""
-               if x:xstr='\n'+'\n'.join(x)
-               else:xstr=''
-               return '0\nTABLE\n2\n%s\n70\n%s%s\n0\nENDTAB'%(name.upper(),len(x),xstr)
-
-       def __str__(self):
-               """Returns drawing as dxf string."""
-               header=[self.acadver]+[self._point(attr,getattr(self,attr)) for attr in _HEADER_POINTS]
-               header=self._section('header',header)
-
-               tables=[self._table('ltype',[str(x) for x in self.linetypes]),
-                               self._table('layer',[str(x) for x in self.layers]),
-                               self._table('style',[str(x) for x in self.styles]),
-                               self._table('view',[str(x) for x in self.views]),
-               ]
-               tables=self._section('tables',tables)
-
-               blocks=self._section('blocks',[str(x) for x in self.blocks])
-
-               entities=self._section('entities',[str(x) for x in self.entities])
-
-               all='\n'.join([header,tables,blocks,entities,'0\nEOF\n'])
-               return all
-
-       def saveas(self,fileName):
-               self.fileName=fileName
-               self.save()
-
-       def save(self):
-               test=open(self.fileName,'w')
-               test.write(str(self))
-               test.close()
-
-
-#---extras
-#-----------------------------------------------
-class Rectangle(_Entity):
-       """Rectangle, creates lines."""
-       def __init__(self,point=(0,0,0),width=1,height=1,solid=None,line=1,**common):
-               _Entity.__init__(self,**common)
-               self.point=point
-               self.width=width
-               self.height=height
-               self.solid=solid
-               self.line=line
-       def __str__(self):
-               result=''
-               points=[self.point,(self.point[0]+self.width,self.point[1],self.point[2]),
-                       (self.point[0]+self.width,self.point[1]+self.height,self.point[2]),
-                       (self.point[0],self.point[1]+self.height,self.point[2]),self.point]
-               if self.solid:
-                       result+='\n%s'%Solid(points=points[:-1],parent=self.solid)
-               if self.line:
-                       for i in range(4):result+='\n%s'%\
-                               Line(points=[points[i],points[i+1]],parent=self)
-               return result[1:]
-
-#-----------------------------------------------
-class LineList(_Entity):
-       """Like polyline, but built of individual lines."""
-       def __init__(self,points=[],org_point=[0,0,0],closed=0,**common):
-               _Entity.__init__(self,**common)
-               self.closed=closed
-               self.points=copy.copy(points)
-       def __str__(self):
-               if self.closed:points=self.points+[self.points[0]]
-               else: points=self.points
-               result=''
-               for i in range(len(points)-1):
-                       result+='\n%s' %Line(points=[points[i],points[i+1]],parent=self)
-               return result[1:]
+#import dxfLibrary
+#reload(dxfLibrary)
+from  dxfLibrary import *
+
+
+#-----------------------------------------------------
+def hidden_status(faces, mx_n):
+       #print 'HIDDEN_MODE: caution! not full implemented yet'
+       ok_faces = []
+       ok_edges = []
+       #sort out back-faces = with normals pointed away from camera
+       for f in faces:
+               #print 'deb: face=', f #---------
+               # get its normal-vector in localCS
+               vec_normal = f.no.copy()
+               #print 'deb: vec_normal=', vec_normal #------------------
+               #must be transfered to camera/view-CS
+               vec_normal *= mx_n
+               #vec_normal *= mb.rotationPart()
+               #print 'deb:2vec_normal=', vec_normal #------------------
+               #vec_normal *= mw0.rotationPart()
+               #print 'deb:3vec_normal=', vec_normal, '\n' #------------------
+
+               # normal must point the Z direction-hemisphere
+               if vec_normal[2] > 0.0 :
+                       ok_faces.append(f.index)
+                       for key in f.edge_keys:
+                               #this test can be done faster with set()
+                               if key not in ok_edges:
+                                        ok_edges.append(key)
+       #print 'deb: amount of visible faces=', len(ok_faces) #---------
+       #print 'deb: visible faces=', ok_faces #---------
+       #print 'deb: amount of visible edges=', len(ok_edges) #---------
+       #print 'deb: visible edges=', ok_edges #---------
+       return ok_faces, ok_edges
+
 
 #-----------------------------------------------------
 def projected_co(vec, mw):
-       # convert the world coordinates of v to screen coordinates
+       # convert the world coordinates of vector to screen coordinates
        #co = vec.co.copy().resize4D()
        co = vec.copy().resize4D()
        co[3] = 1.0
        sc = co * mw
-       #print 'viewprojection=', sc #---------
+       #print 'deb: viewprojection=', sc #---------
        return [sc[0],sc[1],0.0]
 
 
+#--------not used---------------------------------------------
+def flatten(points, mw):
+       for i,v in enumerate(points):
+               v = projected_co(v, mw)
+               points[i]=v
+       #print 'deb: flatten points=', points #---------
+       return points
+
+#-----------------------------------------------------
+def    exportMesh(ob, mx, mx_n):
+       entities = []
+       me = ob.getData(mesh=1)
+       #me.transform(mx)
+       # above is eventualy faster, but bad, cause
+       # directly transforms origin geometry and write back rounding errors
+       me_verts = me.verts[:] #we dont want manipulate origin data
+       #print 'deb: me_verts=', me_verts #---------
+       #me.transform(mx_inv) #counterpart to - back to the origin state
+       for v in me_verts:
+               v.co *= mx
+       faces=[]
+       edges=[]
+       if HIDDEN_MODE:
+               ok_faces, ok_edges = hidden_status(me.faces, mx_n)
+
+       #if (not FLATTEN) and len(me.faces)>0 and ONLYFACES:
+       if ONLYFACES:
+               if POLYFACES: #export 3D as POLYFACEs
+                       allpoints = []
+                       allfaces = []
+                       allpoints =  [v.co[:3] for v in me_verts]
+                       for f in me.faces:
+                               #print 'deb: face=', f #---------
+                               if not HIDDEN_MODE or \
+                                       (HIDDEN_MODE and f.index in ok_faces):
+                                       if 1:
+                                               points = f.verts
+                                               face = [p.index+1 for p in points]
+                                               #print 'deb: face=', face #---------
+                                               allfaces.append(face)
+                                       else: #bad, cause create multiple vertex instances
+                                               points  = f.verts
+                                               points = [ me_verts[p.index].co[:3] for p in points]
+                                               #points = [p.co[:3] for p in points]
+                                               #print 'deb: points=', points #---------
+                                               index = len(allpoints)+1
+                                               face = [index+i for i in range(len(points))]
+                                               allpoints.extend(points)
+                                               allfaces.append(face)
+                       if allpoints and allfaces:
+                               #print 'deb: allpoints=', allpoints #---------
+                               #print 'deb: allfaces=', allfaces #---------
+                               dxfPOLYFACE = PolyLine([allpoints, allfaces], flag=64)
+                               entities.append(dxfPOLYFACE)
+               else: #export 3D as 3DFACEs
+                       for f in me.faces:
+                               #print 'deb: face=', f #---------
+                               if not HIDDEN_MODE or \
+                                       (HIDDEN_MODE and f.index in ok_faces):
+                                       points  = f.verts
+                                       points = [ me_verts[p.index].co[:3] for p in points]
+                                       #points = [p.co[:3] for p in points]
+                                       #print 'deb: points=', points #---------
+                                       dxfFACE = Face(points)
+                                       entities.append(dxfFACE)
+
+       else:   #export 3D as LINEs
+               if HIDDEN_MODE and len(me.faces)!=0:
+                       for e in ok_edges:
+                               points = [ me_verts[key].co[:3] for key in e]
+                               dxfLINE = Line(points)
+                               entities.append(dxfLINE)
+                               
+               else:
+                       for e in me.edges:
+                               #print 'deb: edge=', e #---------
+                               points=[]
+                               #points = [e.v1.co*mx, e.v2.co*mx]
+                               points = [ me_verts[key].co[:3] for key in e.key]
+                               #print 'deb: points=', points #---------
+                               dxfLINE = Line(points)
+                               entities.append(dxfLINE)
+       return entities
+
+
+#-----------------------------------------------------
+def exportCurve(ob, mx):
+       entities = []
+       curve = ob.getData()
+       for cur in curve:
+               #print 'deb: START cur=', cur #--------------
+               if 1: #not cur.isNurb():
+                       #print 'deb: START points' #--------------
+                       points = []
+                       org_point = [0.0,0.0,0.0]
+                       for point in cur:
+                               #print 'deb: point=', point #---------
+                               if cur.isNurb():
+                                       vec = point[0:3]
+                               else:
+                                       point = point.getTriple()
+                                       #print 'deb: point=', point #---------
+                                       vec = point[1]
+                               #print 'deb: vec=', vec #---------
+                               pkt = Mathutils.Vector(vec) * mx
+                               #print 'deb: pkt=', pkt #---------
+                               #pkt *= SCALE_FACTOR
+                               if 0: #FLATTEN:
+                                       pkt = projected_co(pkt, mw)
+                               points.append(pkt)
+                       if cur.isCyclic(): closed = 1
+                       else: closed = 0
+                       if len(points)>1:
+                               #print 'deb: points', points #--------------
+                               if POLYLINES: dxfPLINE = PolyLine(points,org_point,closed)
+                               else: dxfPLINE = LineList(points,org_point,closed)
+                               entities.append(dxfPLINE)
+       return entities
+
+#-----------------------------------------------------
+def do_export(sel_group, filepath):
+       Window.WaitCursor(1)
+       t = sys.time()
+
+       #init Drawing ---------------------
+       d=Drawing()
+       #add Tables -----------------
+       #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
+
+       #add Entities --------------------
+       something_ready = False
+       #ViewVector = Mathutils.Vector(Window.GetViewVector())
+       #print 'deb: ViewVector=', ViewVector #------------------
+       mw0 = Window.GetViewMatrix()
+       #mw0 = Window.GetPerspMatrix() #TODO: how get it working?
+       mw = mw0.copy()
+       if FLATTEN:
+               m0 = Mathutils.Matrix()
+               m0[2][2]=0.0
+               mw *= m0 #flatten ViewMatrix
+
+       for ob in sel_group:
+               entities = []
+               mx = ob.matrix.copy()
+               mb = mx.copy()
+               #print 'deb: mb    =\n', mb     #---------
+               #print 'deb: mw0    =\n', mw0     #---------
+               mx_n = mx.rotationPart() * mw0.rotationPart() #trans-matrix for normal_vectors
+               if SCALE_FACTOR!=1.0: mx *= SCALE_FACTOR
+               if FLATTEN:     mx *= mw
+                       
+               #mx_inv = mx.copy().invert()
+               #print 'deb: mx    =\n', mx     #---------
+               #print 'deb: mx_inv=\n', mx_inv #---------
+
+               if (ob.type == 'Mesh'):
+                       entities = exportMesh(ob, mx, mx_n)
+               elif (ob.type == 'Curve'):
+                       entities = exportCurve(ob, mx)
+
+               for e in entities:
+                       d.append(e)
+                       something_ready = True
+
+       if something_ready:
+               d.saveas(filepath)
+               Window.WaitCursor(0)
+               #Draw.PupMenu('DXF Exporter: job finished')
+               print 'exported to %s' % filepath
+               print 'finished in %.2f seconds' % (sys.time()-t)
+       else:
+               Window.WaitCursor(0)
+               print "Abort: selected objects dont mach choosen export option, nothing exported!"
+               Draw.PupMenu('DXF Exporter:   nothing exported!|selected objects dont mach choosen export option!')
+
+#----globals------------------------------------------
+ONLYSELECTED = True
+POLYLINES = True
+ONLYFACES = False
+POLYFACES = 1
+FLATTEN = 0
+HIDDEN_MODE = False #filter out hidden lines
+SCALE_FACTOR = 1.0 #optional, can be done later in CAD too
+
+
+
 #-----------------------------------------------------
 def dxf_export_ui(filepath):
-       print '\n\nDXF-Export %s' %__version__
+       global  ONLYSELECTED,\
+       POLYLINES,\
+       ONLYFACES,\
+       POLYFACES,\
+       FLATTEN,\
+       HIDDEN_MODE,\
+       SCALE_FACTOR
+
+       print '\n\nDXF-Export %s -----------------------' %__version__
        #filepath = 'blend_test.dxf'
        # Dont overwrite
        if not BPyMessages.Warning_SaveOver(filepath):
@@ -679,29 +344,28 @@ def dxf_export_ui(filepath):
                return
        #test():return
 
-       ONLYSELECTED = True
-       POLYLINES = True
-       ONLYFACES = False
-       FLATTEN = 0 #dimmensions:1,2,3. Force Z dimmension value to 0.0, equal ground projection
-       SCALE_FACTOR = 1.0 #optional, can be done in CAD too
+
        PREF_ONLYSELECTED= Draw.Create(ONLYSELECTED)
        PREF_POLYLINES= Draw.Create(POLYLINES)
        PREF_ONLYFACES= Draw.Create(ONLYFACES)
+       PREF_POLYFACES= Draw.Create(POLYFACES)
        PREF_FLATTEN= Draw.Create(FLATTEN)
+       PREF_HIDDEN_MODE= Draw.Create(HIDDEN_MODE)
        PREF_SCALE_FACTOR= Draw.Create(SCALE_FACTOR)
        PREF_HELP= Draw.Create(0)
        block = [\
        ("only selected", PREF_ONLYSELECTED, "export only selected geometry"),\
        ("global Scale:", PREF_SCALE_FACTOR, 0.001, 1000, "set global Scale factor for exporting geometry"),\
-       ("only faces", PREF_ONLYFACES, "from mesh-objects export only faces, not edges"),\
-       ("write POLYLINEs", PREF_POLYLINES, "export curves to POLYLINEs, otherwise to LINEs"),\
+       ("only faces", PREF_ONLYFACES, "from mesh-objects export only faces, otherwise only edges"),\
+       ("write POLYFACE", PREF_POLYFACES, "export mesh to POLYFACE, otherwise to 3DFACEs"),\
+       ("write POLYLINEs", PREF_POLYLINES, "export curve to POLYLINE, otherwise to LINEs"),\
        ("3D-View to Flat", PREF_FLATTEN, "flatten geometry according current 3d-View"),\
-       (''),\
+       ("Hidden Mode", PREF_HIDDEN_MODE, "filter out hidden lines"),\
+       #(''),\
        ("online Help", PREF_HELP, "calls DXF-Exporter Manual Page on Wiki.Blender.org"),\
        ]
        
-       if not Draw.PupBlock("DXF-Exporter %s" %__version__[:10], block):
-               return
+       if not Draw.PupBlock("DXF-Exporter %s" %__version__[:10], block): return
 
        if PREF_HELP.val!=0:
                try:
@@ -715,139 +379,22 @@ http://wiki.blender.org/index.php?title=Scripts/Manual/Export/autodesk_dxf')
        ONLYSELECTED = PREF_ONLYSELECTED.val
        POLYLINES = PREF_POLYLINES.val
        ONLYFACES = PREF_ONLYFACES.val
+       POLYFACES = PREF_POLYFACES.val
        FLATTEN = PREF_FLATTEN.val
+       HIDDEN_MODE = PREF_HIDDEN_MODE.val
        SCALE_FACTOR = PREF_SCALE_FACTOR.val
 
        sce = Scene.GetCurrent()
        if ONLYSELECTED: sel_group = sce.objects.selected
        else: sel_group = sce.objects
 
-       if sel_group:
-               Window.WaitCursor(1)
-               t = sys.time()
-
-               #init Drawing ---------------------
-               d=Drawing()
-               #add Tables -----------------
-               #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
-
-               #add Entities --------------------
-               something_ready = False
-               mw = Window.GetViewMatrix()
-               #mw = Window.GetPerspMatrix() #TODO: how get it working?
-               for ob in sel_group:
-                       entities = []
-                       mx = ob.matrix
-                       if (ob.type == 'Mesh'):
-                               me = ob.getData(mesh=1)
-                               faces=[]
-                               edges=[]
-                               if (not FLATTEN) and len(me.faces)>0 and ONLYFACES:
-                                       #export 3D as 3DFACEs
-                                       for f in me.faces:
-                                               #print 'face=', f #---------
-                                               verts = f.verts
-                                               points = [verts[i].co*mx for i in range(len(verts))]
-                                               if SCALE_FACTOR!=1.0:
-                                                       points = [p*SCALE_FACTOR for p in points]
-                                               #print 'points=', points #---------
-                                               dxfFACE = Face(points)
-                                               entities.append(dxfFACE)
-                               else:   #export 3D as LINEs
-                                       for e in me.edges:
-                                               #print 'edge=', e #---------
-                                               points=[]
-                                               points = [e.v1.co*mx, e.v2.co*mx]
-                                               if SCALE_FACTOR!=1.0:
-                                                       points = [p*SCALE_FACTOR for p in points]
-                                               if FLATTEN:
-#                                                      for p in points: p[FLATTEN-1]=0.0
-                                                       for i,v in enumerate(points):
-                                                               v = projected_co(v, mw)
-                                                               points[i]=v
-                                                       #print 'flatten points=', points #---------
-                                               dxfLINE = Line(points)
-                                               entities.append(dxfLINE)
-                       elif (ob.type == 'Curve'):
-                               curve = ob.getData()
-                               for cur in curve:
-                                       #print 'deb: START cur=', cur #--------------
-                                       if 1: #not cur.isNurb():
-                                               #print 'deb: START points' #--------------
-                                               points = []
-                                               org_point = [0.0,0.0,0.0]
-                                               for point in cur:
-                                                       #print 'point=', point #---------
-                                                       if cur.isNurb():
-                                                               vec = point[0:3]
-                                                       else:
-                                                               point = point.getTriple()
-                                                               #print 'point=', point #---------
-                                                               vec = point[1]
-                                                       #print 'vec=', vec #---------
-                                                       pkt = Mathutils.Vector(vec) * mx
-                                                       #print 'pkt=', pkt #---------
-                                                       pkt *= SCALE_FACTOR
-                                                       if FLATTEN:
-                                                               pkt = projected_co(pkt, mw)
-                                                       points.append(pkt)
-                                               if cur.isCyclic(): closed = 1
-                                               else: closed = 0
-                                               if len(points)>1:
-                                                       #print 'deb: points', points #--------------
-                                                       if POLYLINES: dxfPLINE = PolyLine(points,org_point,closed)
-                                                       else: dxfPLINE = LineList(points,org_point,closed)
-                                                       entities.append(dxfPLINE)
-                       for e in entities:
-                               d.append(e)
-                               something_ready = True
-               if something_ready:
-                       d.saveas(filepath)
-                       Window.WaitCursor(0)
-                       #Draw.PupMenu('DXF Exporter: job finished|search for blend_test.dxf in current project directory')
-                       print 'exported to %s' % filepath
-                       print 'finished in %.2f seconds' % (sys.time()-t)
-               else:
-                       print "Abort: no supported object types selected, nothing exported!"
-                       Draw.PupMenu('DXF Exporter:        Abort!|Not-supported object types selected.')
+       if sel_group: do_export(sel_group, filepath)
        else:
                print "Abort: selection was empty, no object to export!"
-               Draw.PupMenu('DXF Exporter:        Abort!|empty selection, no object to export!')
+               Draw.PupMenu('DXF Exporter:   nothing exported!|empty selection!')
        # Timing the script is a good way to be aware on any speed hits when scripting
 
 
-#-----------------------------------------------------
-def test():
-       #Blocks
-       b=Block('test')
-       b.append(Solid(points=[(0,0,0),(1,0,0),(1,1,0),(0,1,0)],color=1))
-       b.append(Arc(center=(1,0,0),color=2))
-
-       #Drawing
-       d=Drawing()
-       #tables
-       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
-       d.append(Circle(center=(1,1,0),color=3))
-       d.append(Face(points=[(0,0,0),(1,0,0),(1,1,0),(0,1,0)],color=4))
-       d.append(Insert('test',point=(3,3,3),cols=5,colspacing=2))
-       d.append(Line(points=[(0,0,0),(1,1,1)]))
-       d.append(Mtext('Click on Ads\nmultiple lines with mtext',point=(1,1,1),color=5,rotation=90))
-       d.append(Text('Please donate!',point=(3,0,1)))
-       d.append(Rectangle(point=(2,2,2),width=4,height=3,color=6,solid=Solid(color=2)))
-       d.append(Solid(points=[(4,4,0),(5,4,0),(7,8,0),(9,9,0)],color=3))
-       d.append(PolyLine(points=[(1,1,1),(2,1,1),(2,2,1),(1,2,1)],closed=1,color=1))
-
-       #d.saveas('c:\\test.dxf')
-       d.saveas('test.dxf')
-
 
 #-----------------------------------------------------
 if __name__=='__main__':
index 696dfd3ca2b48f5395224c4e1e7d93ce76fbb630..b27e266f368aa5c9ccd0d7e5614360fc83d2f179 100644 (file)
@@ -448,11 +448,19 @@ def parse_help_info(script):
 
 def parse_script_line(l):
 
+       tip = 'No tooltip'
        try:
                pieces = l.split("'")
                name = pieces[1].replace('...','')
-               version, fname, userdir = pieces[2].strip().split()
-               tip = pieces[3]
+               data = pieces[2].strip().split()
+               version = data[0]
+               userdir = data[-1]
+               fname = data[1]
+               i = 1
+               while not fname.endswith('.py'):
+                       i += 1
+                       fname = '%s %s' % (fname, data[i])
+               if len(pieces) > 3: tip = pieces[3]
        except:
                return None
 
index b28c7f5bbdc615506c299afdc07f12d6e5624d30..db21cabe14fc6e6ae9cb11544ac172678300ce97 100644 (file)
@@ -206,7 +206,7 @@ class VRML2Export:
                if scene != inlines[0]:
                        return
                else:
-                       for i in range(allinlines):
+                       for i in xrange(allinlines):
                                nameinline=inlines[i].getName()
                                if (nameinline not in self.namesStandard) and (i > 0):
                                        self.writeIndented("DEF %s Inline {\n" % \
@@ -219,7 +219,7 @@ class VRML2Export:
        def writeScript(self):
                textEditor = Blender.Text.Get() 
                alltext = len(textEditor)
-               for i in range(alltext):
+               for i in xrange(alltext):
                        nametext = textEditor[i].getName()
                        nlines = textEditor[i].getNLines()
                        if (self.proto == 1):
@@ -227,14 +227,14 @@ class VRML2Export:
                                        nametext == "proto.txt") and (nlines != None):
                                        nalllines = len(textEditor[i].asLines())
                                        alllines = textEditor[i].asLines()
-                                       for j in range(nalllines):
+                                       for j in xrange(nalllines):
                                                self.writeIndented(alllines[j] + "\n")
                        elif (self.proto == 0):
                                if (nametext == "route" or nametext == "route.js" or \
                                        nametext == "route.txt") and (nlines != None):
                                        nalllines = len(textEditor[i].asLines())
                                        alllines = textEditor[i].asLines()
-                                       for j in range(nalllines):
+                                       for j in xrange(nalllines):
                                                self.writeIndented(alllines[j] + "\n")
                self.writeIndented("\n")
 
@@ -556,31 +556,28 @@ class VRML2Export:
                issmooth = 0
 
                maters = me.materials
-               nummats = self.getNumMaterials(me)
+               nummats = len(me.materials)
 
                # Vertex and Face colors trump materials and image textures
                if (self.facecolors or self.vcolors):
                        if nummats > 0:
-                               if maters[0]:
-                                       self.writeShape(ob, me, 0, None)
-                               else:
-                                       self.writeShape(ob, me, -1, None)
+                               self.writeShape(ob, me, 0, None)
                        else:
                                self.writeShape(ob, me, -1, None)
-               # Do meshes with materials, possible with image textures
+
+               # Do meshes with materials, possibly with image textures
                elif nummats > 0:
-                       for matnum in range(len(maters)):
-                               if maters[matnum]:
-                                       images = []
-                                       if me.faceUV:
-                                               images = self.getImages(me, matnum)
-                                               if len(images) > 0:
-                                                       for image in images:
-                                                               self.writeShape(ob, me, matnum, image)
-                                               else:
-                                                       self.writeShape(ob, me, matnum, None)
+                       for matnum in xrange(len(maters)):
+                               images = []
+                               if me.faceUV:
+                                       images = self.getImages(me, matnum)
+                                       if len(images) > 0:
+                                               for image in images:
+                                                       self.writeShape(ob, me, matnum, image)
                                        else:
                                                self.writeShape(ob, me, matnum, None)
+                               else:
+                                       self.writeShape(ob, me, matnum, None)
                else:
                        if me.faceUV:
                                images = self.getImages(me, -1)
@@ -608,15 +605,6 @@ class VRML2Export:
                                                imageNames[imName]=1
                return images
 
-       def getNumMaterials(self, me):
-               # Oh silly Blender, why do you sometimes have 'None' as
-               # a member of the me.materials array?
-               num = 0
-               for mat in me.materials:
-                       if mat:
-                               num = num + 1
-               return num
-
        def writeCoordinates(self, me, meshName):
                coordName = "coord_%s" % (meshName)
                # look up coord name, use it if available
@@ -644,20 +632,43 @@ class VRML2Export:
                self.writeIndented("}\n", -1)
                self.writeIndented("\n")
 
+       def testShape(self, ob, me, matnum, image):
+               if ( (matnum == -1) and (image == None) ):
+                       if ( len(me.faces) > 0 ):
+                               return True
+               # Check if any faces the material or image
+               for face in me.faces:
+                       if (matnum == -1):
+                               if (f.image == image):
+                                       return True
+                       elif (image == None):
+                               if (face.mat == matnum):
+                                       return True
+                       else:
+                               if ((face.image == image) and (face.mat == matnum)):
+                                       return True
+
+               return False
+
        def writeShape(self, ob, me, matnum, image):
-               # Note: at this point it is assumed for matnum!=-1 that the 
-               # material in me.materials[matnum] is not equal to 'None'.
-               # Such validation should be performed by the function that
-               # calls this one.
+               # matnum == -1  means don't check the face.mat
+               # image == None means don't check face.image
+
+               if ( not self.testShape(ob, me, matnum, image) ):
+                       return False
+
                self.writeIndented("Shape {\n",1)
 
                self.writeIndented("appearance Appearance {\n", 1)
                if (matnum != -1):
                        mater = me.materials[matnum]
-                       self.writeMaterial(mater, self.cleanStr(mater.name,''))
-                       if (mater.mode & Blender.Material.Modes['TEXFACE']):
-                               if image != None:
-                                       self.writeImageTexture(image.name, image.filename)
+                       if (mater):
+                               self.writeMaterial(mater, self.cleanStr(mater.name,''))
+                               if (mater.mode & Blender.Material.Modes['TEXFACE']):
+                                       if image != None:
+                                               self.writeImageTexture(image.name, image.filename)
+                       else:
+                               self.writeDefaultMaterial()     
                else:
                        if image != None:
                                self.writeImageTexture(image.name, image.filename)
@@ -668,6 +679,8 @@ class VRML2Export:
 
                self.writeIndented("}\n", -1)
 
+               return True
+
        def writeGeometry(self, ob, me, matnum, image):
 
                #-- IndexedFaceSet or IndexedLineSet
@@ -723,7 +736,7 @@ class VRML2Export:
                        indexStr = ""
                        if (matnum == -1) or (face.mat == matnum):
                                if (face.image == image):
-                                       for i in range(len(face.verts)):
+                                       for i in xrange(len(face.verts)):
                                                uv = face.uv[i]
                                                indexStr += "%s " % (j)
                                                coordStr += "%s %s, " % \
@@ -770,13 +783,13 @@ class VRML2Export:
                cols = [None] * len(me.verts)
 
                for face in me.faces:
-                       for vind in range(len(face.v)):
+                       for vind in xrange(len(face.v)):
                                vertex = face.v[vind]
                                i = vertex.index
                                if cols[i] == None:
                                        cols[i] = face.col[vind]
                                        
-               for i in range(len(me.verts)):
+               for i in xrange(len(me.verts)):
                        aColor = self.rgbToFS(cols[i])
                        self.writeUnindented("%s\n" % aColor)
 
@@ -784,6 +797,23 @@ class VRML2Export:
                self.writeIndented("]\n",-1)
                self.writeIndented("}\n",-1)
 
+       def writeDefaultMaterial(self):
+               matName = "default"
+
+               # look up material name, use it if available
+               if self.matNames.has_key(matName):
+                       self.writeIndented("material USE MA_%s\n" % matName)
+                       self.matNames[matName]+=1
+                       return;
+
+               self.matNames[matName]=1
+               self.writeIndented("material DEF MA_%s Material {\n" % matName, 1)
+               self.writeIndented("diffuseColor 0.8 0.8 0.8\n")
+               self.writeIndented("specularColor 1.0 1.0 1.0\n")
+               self.writeIndented("shininess 0.5\n")
+               self.writeIndented("transparency 0.0\n")
+               self.writeIndented("}\n",-1)
+
        def writeMaterial(self, mat, matName):
                # look up material name, use it if available
                if self.matNames.has_key(matName):
index 1487c1e9eb3fa13799a4127acb93adf2b4ff1511..b3e8fb53db0f606c54716d797d758dd50eaaa1fa 100644 (file)
@@ -1,37 +1,37 @@
-PSF LICENSE AGREEMENT FOR PYTHON 2.3
-------------------------------------
+PYTHON SOFTWARE FOUNDATION LICENSE VERSION 2
+--------------------------------------------
 
 1. This LICENSE AGREEMENT is between the Python Software Foundation
 ("PSF"), and the Individual or Organization ("Licensee") accessing and
-otherwise using Python 2.3 software in source or binary form and its
-associated documentation.
+otherwise using this software ("Python") in source or binary form and
+its associated documentation.
 
 2. Subject to the terms and conditions of this License Agreement, PSF
 hereby grants Licensee a nonexclusive, royalty-free, world-wide
 license to reproduce, analyze, test, perform and/or display publicly,
-prepare derivative works, distribute, and otherwise use Python 2.3
+prepare derivative works, distribute, and otherwise use Python
 alone or in any derivative version, provided, however, that PSF's
 License Agreement and PSF's notice of copyright, i.e., "Copyright (c)
-2001, 2002, 2003 Python Software Foundation; All Rights Reserved" are
-retained in Python 2.3 alone or in any derivative version prepared by
-Licensee.
+2001, 2002, 2003, 2004, 2005, 2006 Python Software Foundation; All Rights
+Reserved" are retained in Python alone or in any derivative version 
+prepared by Licensee.
 
 3. In the event Licensee prepares a derivative work that is based on
-or incorporates Python 2.3 or any part thereof, and wants to make
+or incorporates Python or any part thereof, and wants to make
 the derivative work available to others as provided herein, then
 Licensee hereby agrees to include in any such work a brief summary of
-the changes made to Python 2.3.
+the changes made to Python.
 
-4. PSF is making Python 2.3 available to Licensee on an "AS IS"
+4. PSF is making Python available to Licensee on an "AS IS"
 basis.  PSF MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR
 IMPLIED.  BY WAY OF EXAMPLE, BUT NOT LIMITATION, PSF MAKES NO AND
 DISCLAIMS ANY REPRESENTATION OR WARRANTY OF MERCHANTABILITY OR FITNESS
-FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF PYTHON 2.3 WILL NOT
+FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF PYTHON WILL NOT
 INFRINGE ANY THIRD PARTY RIGHTS.
 
 5. PSF SHALL NOT BE LIABLE TO LICENSEE OR ANY OTHER USERS OF PYTHON
-2.3 FOR ANY INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES OR LOSS AS
-A RESULT OF MODIFYING, DISTRIBUTING, OR OTHERWISE USING PYTHON 2.3,
+FOR ANY INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES OR LOSS AS
+A RESULT OF MODIFYING, DISTRIBUTING, OR OTHERWISE USING PYTHON,
 OR ANY DERIVATIVE THEREOF, EVEN IF ADVISED OF THE POSSIBILITY THEREOF.
 
 6. This License Agreement will automatically terminate upon a material
@@ -43,6 +43,7 @@ Licensee.  This License Agreement does not grant permission to use PSF
 trademarks or trade name in a trademark sense to endorse or promote
 products or services of Licensee, or any third party.
 
-8. By copying, installing or otherwise using Python 2.3, Licensee
+8. By copying, installing or otherwise using Python, Licensee
 agrees to be bound by the terms and conditions of this License
 Agreement.
+
index 0105587c5b484d0f5c4eec17fa60eb77101b9c26..421b4300c8a6e2c20e4baff3d90a32b8222a5501 100644 (file)
@@ -41,7 +41,7 @@ struct ListBase;
 struct MemFile;
 
 #define BLENDER_VERSION                        247
-#define BLENDER_SUBVERSION             9
+#define BLENDER_SUBVERSION             10
 
 #define BLENDER_MINVERSION             245
 #define BLENDER_MINSUBVERSION  15
index d6b438a3010dc25f9cd59ace7192dc3379aa6b9f..a534dcc3669a15b15fc5462cfdd618727c804df1 100644 (file)
 #define DL_FRONT_CURVE 4
 #define DL_BACK_CURVE  8
 
-#define DL_SURFINDEX(cyclu, cyclv, sizeu, sizev)           \
-\
-if( (cyclv)==0 && a==(sizev)-1) break;             \
-if(cyclu) {                                                \
-       p1= sizeu*a;                                        \
-               p2= p1+ sizeu-1;                                    \
-                       p3= p1+ sizeu;                                      \
-                               p4= p2+ sizeu;                                      \
-                                       b= 0;                                               \
-}                                                          \
-else {                                             \
-       p2= sizeu*a;                                        \
-               p1= p2+1;                                           \
-                       p4= p2+ sizeu;                                      \
-                               p3= p1+ sizeu;                                      \
-                                       b= 1;                                               \
-}                                                          \
-if( (cyclv) && a==sizev-1) {                       \
-       p3-= sizeu*sizev;                                   \
-               p4-= sizeu*sizev;                                   \
-}
-
 
 /* prototypes */
 
@@ -114,6 +92,7 @@ extern void makeDispListMBall(struct Object *ob);
 extern void shadeDispList(struct Base *base);
 extern void shadeMeshMCol(struct Object *ob, struct Mesh *me);
 
+int surfindex_displist(DispList *dl, int a, int *b, int *p1, int *p2, int *p3, int *p4);
 void imagestodisplist(void);
 void reshadeall_displist(void);
 void filldisplist(struct ListBase *dispbase, struct ListBase *to);
index 1cc336db69e640be86dabada852f7bef973426ce..3a2dca525b8d484e23b2a6020dd6c48e8ce7eab8 100644 (file)
@@ -157,10 +157,10 @@ typedef struct Global {
 /* **************** GLOBAL ********************* */
 
 /* G.f */
-#define G_DISABLE_OK   (1 <<  0)
+#define G_RENDER_OGL   (1 <<  0)
 #define G_PLAYANIM             (1 <<  1)
 /* also uses G_FILE_AUTOPLAY */
-#define G_SIMULATION   (1 <<  3)
+#define G_RENDER_SHADOW        (1 <<  3)
 #define G_BACKBUFSEL   (1 <<  4)
 #define G_PICKSEL              (1 <<  5)
 #define G_DRAWNORMALS  (1 <<  6)
index 7819919fba888e4b8ec4ca40ddd25ff887cb3662..02f7ba6f8602861b3805d404f075c773efe5eccd 100644 (file)
@@ -44,15 +44,7 @@ extern "C" {
 #define FFMPEG_XVID     7
 #define FFMPEG_FLV      8
 #define FFMPEG_MKV      9
-
-#define FFMPEG_CODEC_MPEG1 0
-#define FFMPEG_CODEC_MPEG2 1
-#define FFMPEG_CODEC_MPEG4 2
-#define FFMPEG_CODEC_HUFFYUV 3
-#define FFMPEG_CODEC_DV 4
-#define FFMPEG_CODEC_H264 5
-#define FFMPEG_CODEC_XVID 6
-#define FFMPEG_CODEC_FLV1 7
+#define FFMPEG_OGG      10
 
 #define FFMPEG_PRESET_NONE 0
 #define FFMPEG_PRESET_DVD  1
index d4b17f97ad9191e433d40b5ad46b55adc7f43447..b7f068c936b1ad983f4ccabaef7a1a39e7907158 100644 (file)
@@ -2701,17 +2701,22 @@ static void mesh_build_data(Object *ob, CustomDataMask dataMask)
                if( (G.f & G_WEIGHTPAINT) && ob==obact ) {
                        MCol *wpcol = (MCol*)calc_weightpaint_colors(ob);
                        int layernum = CustomData_number_of_layers(&me->fdata, CD_MCOL);
+                       int prevactive = CustomData_get_active_layer(&me->fdata, CD_MCOL);
+                       int prevrender = CustomData_get_render_layer(&me->fdata, CD_MCOL);
 
                        /* ugly hack here, we temporarily add a new active mcol layer with
                           weightpaint colors in it, that is then duplicated in CDDM_from_mesh */
                        CustomData_add_layer(&me->fdata, CD_MCOL, CD_ASSIGN, wpcol, me->totface);
                        CustomData_set_layer_active(&me->fdata, CD_MCOL, layernum);
+                       CustomData_set_layer_render(&me->fdata, CD_MCOL, layernum);
 
                        mesh_calc_modifiers(ob, NULL, &ob->derivedDeform,
                                            &ob->derivedFinal, 0, 1,
                                            needMapping, dataMask, -1);
 
                        CustomData_free_layer_active(&me->fdata, CD_MCOL, me->totface);
+                       CustomData_set_layer_active(&me->fdata, CD_MCOL, prevactive);
+                       CustomData_set_layer_render(&me->fdata, CD_MCOL, prevrender);
                } else {
                        mesh_calc_modifiers(ob, NULL, &ob->derivedDeform,
                                            &ob->derivedFinal, G.rendering, 1,
index eeec4d0bd4e8ce5570e93270d81c1041cd8931be..b389f8c0536aa912e8fb0195138e478c2213925b 100644 (file)
@@ -78,6 +78,7 @@ BulletSoftBody *bsbNew(void)
 
        bsb->kSHR                       =       1.0f;
        bsb->kAHR                       =       0.7f;
+       
        bsb->collisionflags = 0;
        //bsb->collisionflags = OB_BSB_COL_CL_RS + OB_BSB_COL_CL_SS;
        bsb->numclusteriterations = 64;
index 6ece16deb4b3147173fda9e3d41ab8dd374d7bde..b090ac2b538466081caa7dc58f167af137fbe179 100644 (file)
@@ -832,7 +832,9 @@ void makeNurbcurve(Nurb *nu, float *coord_array, float *tilt_array, float *radiu
        if(len==0) return;
        sum= (float *)MEM_callocN(sizeof(float)*len, "makeNurbcurve1");
        
-       resolu= (resolu*SEGMENTSU(nu))+1;
+       resolu= (resolu*SEGMENTSU(nu));
+       if((nu->flagu & CU_CYCLIC)==0) resolu++;
+       
        if(resolu==0) {
                MEM_freeN(sum);
                return;
@@ -842,7 +844,8 @@ void makeNurbcurve(Nurb *nu, float *coord_array, float *tilt_array, float *radiu
        ustart= fp[nu->orderu-1];
        if(nu->flagu & CU_CYCLIC) uend= fp[nu->pntsu+nu->orderu-1];
        else uend= fp[nu->pntsu];
-       ustep= (uend-ustart)/(resolu-1);
+       ustep= (uend-ustart)/(resolu - ((nu->flagu & CU_CYCLIC) ? 0 : 1));
+       
        basisu= (float *)MEM_mallocN(sizeof(float)*KNOTSU(nu), "makeNurbcurve3");
 
        if(nu->flagu & CU_CYCLIC) cycl= nu->orderu-1; 
@@ -1531,7 +1534,7 @@ void makeBevelList(Object *ob)
                
                /* check if we will calculate tilt data */
                do_tilt = ((nu->type & CU_2D) && (cu->flag & CU_3D)==0) ? 0 : 1;
-               do_radius = do_tilt; /* normal display uses the radius, better just to calculate them */
+               do_radius = (do_tilt || cu->bevobj) ? 1 : 0; /* normal display uses the radius, better just to calculate them */
                
                /* check we are a single point? also check we are not a surface and that the orderu is sane,
                 * enforced in the UI but can go wrong possibly */
@@ -1678,7 +1681,9 @@ void makeBevelList(Object *ob)
                        }
                        else if((nu->type & 7)==CU_NURBS) {
                                if(nu->pntsv==1) {
-                                       len= (resolu*SEGMENTSU(nu))+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);
                                        bl->nr= len;
index be24d1d247423993ab0ddb593e7c73d1d1d4edb2..3b6820461be5da0ad1649df8a4af7568fc3b42d0 100644 (file)
@@ -206,8 +206,9 @@ void addnormalsDispList(Object *ob, ListBase *lb)
                                ndata= dl->nors;
                                
                                for(a=0; a<dl->parts; a++) {
-       
-                                       DL_SURFINDEX(dl->flag & DL_CYCL_U, dl->flag & DL_CYCL_V, dl->nr, dl->parts);
+                                       
+                                       if (surfindex_displist(dl, a, &b, &p1, &p2, &p3, &p4)==0)
+                                               break;
        
                                        v1= vdata+ 3*p1; 
                                        n1= ndata+ 3*p1;
@@ -271,6 +272,33 @@ void count_displist(ListBase *lb, int *totvert, int *totface)
        }
 }
 
+int surfindex_displist(DispList *dl, int a, int *b, int *p1, int *p2, int *p3, int *p4)
+{
+       if((dl->flag & DL_CYCL_V)==0 && a==(dl->parts)-1) {
+               return 0;
+       }
+       
+       if(dl->flag & DL_CYCL_U) {
+               (*p1)= dl->nr*a;
+               (*p2)= (*p1)+ dl->nr-1;
+               (*p3)= (*p1)+ dl->nr;
+               (*p4)= (*p2)+ dl->nr;
+               (*b)= 0;
+       } else {
+               (*p2)= dl->nr*a;
+               (*p1)= (*p2)+1;
+               (*p4)= (*p2)+ dl->nr;
+               (*p3)= (*p1)+ dl->nr;
+               (*b)= 1;
+       }
+       
+       if( (dl->flag & DL_CYCL_V) && a==dl->parts-1) {                     \
+               (*p3)-= dl->nr*dl->parts;                                   \
+               (*p4)-= dl->nr*dl->parts;                                   \
+       }
+       
+       return 1;
+}
 
 /* ***************************** shade displist. note colors now are in rgb(a) order ******************** */
 
@@ -858,12 +886,14 @@ static void curve_to_displist(Curve *cu, ListBase *nubase, ListBase *dispbase)
                                }
                        }
                        else if((nu->type & 7)==CU_NURBS) {
-                               len= (resolu*SEGMENTSU(nu))+1;
+                               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");
                                BLI_addtail(dispbase, dl);
                                dl->parts= 1;
+                               
                                dl->nr= len;
                                dl->col= nu->mat_nr;
                                dl->charidx = nu->charidx;
@@ -1253,13 +1283,40 @@ static void curve_calc_modifiers_post(Object *ob, ListBase *nurb, ListBase *disp
 
        for (; md; md=md->next) {
                ModifierTypeInfo *mti = modifierType_getInfo(md->type);
-
+               
                if ((md->mode & required_mode) != required_mode) continue;
                if (mti->isDisabled && mti->isDisabled(md)) continue;
                if (mti->type!=eModifierTypeType_OnlyDeform && mti->type!=eModifierTypeType_DeformOrConstruct) continue;
 
-               for (dl=dispbase->first; dl; dl=dl->next) {
-                       mti->deformVerts(md, ob, NULL, (float(*)[3]) dl->verts, (dl->type==DL_INDEX3)?dl->nr:dl->parts*dl->nr);
+               /* need to put all verts in 1 block for curve deform */
+               if(md->type==eModifierType_Curve) {
+                       float *allverts, *fp;
+                       int totvert= 0;
+                       
+                       for (dl=dispbase->first; dl; dl=dl->next)
+                               totvert+= (dl->type==DL_INDEX3)?dl->nr:dl->parts*dl->nr;
+                       
+                       fp= allverts= MEM_mallocN(totvert*sizeof(float)*3, "temp vert");
+                       for (dl=dispbase->first; dl; dl=dl->next) {
+                               int offs= 3 * ((dl->type==DL_INDEX3)?dl->nr:dl->parts*dl->nr);
+                               memcpy(fp, dl->verts, sizeof(float) * offs);
+                               fp+= offs;
+                       }
+                       
+                       mti->deformVerts(md, ob, NULL, (float(*)[3]) allverts, totvert);
+                       
+                       fp= allverts;
+                       for (dl=dispbase->first; dl; dl=dl->next) {
+                               int offs= 3 * ((dl->type==DL_INDEX3)?dl->nr:dl->parts*dl->nr);
+                               memcpy(dl->verts, fp, sizeof(float) * offs);
+                               fp+= offs;
+                       }
+                       MEM_freeN(allverts);
+               }
+               else {
+                       for (dl=dispbase->first; dl; dl=dl->next) {
+                               mti->deformVerts(md, ob, NULL, (float(*)[3]) dl->verts, (dl->type==DL_INDEX3)?dl->nr:dl->parts*dl->nr);
+                       }
                }
        }
 
@@ -1281,7 +1338,8 @@ static void displist_surf_indices(DispList *dl)
        
        for(a=0; a<dl->parts; a++) {
                
-               DL_SURFINDEX(dl->flag & DL_CYCL_U, dl->flag & DL_CYCL_V, dl->nr, dl->parts);
+               if (surfindex_displist(dl, a, &b, &p1, &p2, &p3, &p4)==0)
+                       break;
                
                for(; b<dl->nr; b++, index+=4) {        
                        index[0]= p1;
index 479be2ee6446b9a07b4ad4b560a83f66f9bfdde8..561b564ac39657a9009225773bc2476d9704bd47 100644 (file)
@@ -2097,8 +2097,10 @@ static void displist_to_mesh(DispList *dlfirst)
                        }
 
                        for(a=0; a<dl->parts; a++) {
-
-                               DL_SURFINDEX(dl->flag & DL_CYCL_U, dl->flag & DL_CYCL_V, dl->nr, dl->parts);
+                               
+                               if (surfindex_displist(dl, a, &b, &p1, &p2, &p3, &p4)==0)
+                                       break;
+                               
                                p1+= startve; 
                                p2+= startve; 
                                p3+= startve; 
index 9c1b3ee5a8d4642e2f62e17b56903fcc414b2095..4580c6cbf8ba649ad9b32a553836022cc9cfb610 100644 (file)
@@ -77,7 +77,7 @@ void fluidsim_init(FluidsimModifierData *fluidmd)
                if(!fss)
                        return;
                
-               fss->type = 0;
+               fss->type = OB_FSBND_NOSLIP;
                fss->show_advancedoptions = 0;
 
                fss->resolutionxyz = 50;
index 0a140ebaba14f9a764ef6c6113136f40995d6db1..79ecbf09f55f446b43a6e08ef81b46c9757e100b 100644 (file)
@@ -111,6 +111,7 @@ void IDP_ResizeArray(IDProperty *prop, int newlen)
        newp->type = prop->type;
        newp->flag = prop->flag;
        newp->data.val = prop->data.val;
+       newp->data.val2 = prop->data.val2;
 
        return newp;
  }
@@ -219,6 +220,10 @@ IDProperty *IDP_CopyGroup(IDProperty *prop)
        return newp;
 }
 
+/*
+ replaces a property with the same name in a group, or adds 
+ it if the propery doesn't exist.
+*/
 void IDP_ReplaceInGroup(IDProperty *group, IDProperty *prop)
 {
        IDProperty *loop;
@@ -229,8 +234,7 @@ void IDP_ReplaceInGroup(IDProperty *group, IDProperty *prop)
                        
                        BLI_remlink(&group->data.group, loop);
                        IDP_FreeProperty(loop);
-                       MEM_freeN(loop);
-                       
+                       MEM_freeN(loop);                        
                        return;
                }
        }
@@ -262,7 +266,7 @@ int IDP_InsertToGroup(IDProperty *group, IDProperty *previous, IDProperty *pnew)
        }
        
        group->len++;
-       
+
        BLI_insertlink(&group->data.group, previous, pnew);
        return 1;
 }
@@ -348,6 +352,10 @@ IDProperty *IDP_GetProperties(ID *id, int create_if_needed)
                if (create_if_needed) {
                        id->properties = MEM_callocN(sizeof(IDProperty), "IDProperty");
                        id->properties->type = IDP_GROUP;
+                       /* dont overwite the data's name and type
+                        * some functions might need this if they
+                        * dont have a real ID, should be named elsewhere - Campbell */
+                       /* strcpy(id->name, "top_level_group");*/
                }
                return id->properties;
        }
@@ -423,7 +431,7 @@ IDProperty *IDP_New(int type, IDPropertyTemplate val, char *name)
        return prop;
 }
 
-/*NOTE: this will free all child properties of list arrays and groups!
+/*NOTE: this will free all child properties including list arrays and groups!
   Also, note that this does NOT unlink anything!  Plus it doesn't free
   the actual IDProperty struct either.*/
 void IDP_FreeProperty(IDProperty *prop)
@@ -441,7 +449,8 @@ void IDP_FreeProperty(IDProperty *prop)
        }
 }
 
-/*Unlinks any IDProperty<->ID linkage that might be going on.*/
+/*Unlinks any IDProperty<->ID linkage that might be going on.
+  note: currently unused.*/
 void IDP_UnlinkProperty(IDProperty *prop)
 {
        switch (prop->type) {
index 185705150571cda9e438bf98c0827cf306356d42..d5166fc7a838d49075edf8c501eb3407f5e3ff55 100644 (file)
@@ -1571,7 +1571,7 @@ static ImBuf *image_load_sequence_multilayer(Image *ima, ImageUser *iuser, int f
                        ibuf->channels= rpass->channels;
                        
                        image_initialize_after_load(ima, ibuf);
-                       image_assign_ibuf(ima, ibuf, iuser->multi_index, frame);
+                       image_assign_ibuf(ima, ibuf, iuser?iuser->multi_index:0, frame);
                        
                }
                // else printf("pass not found\n");
index dd6c7ddacd20cb0cdb0afbd229bc366b7aca547b..755a41ec4b284f602045b1924cee6e6ca375a958 100644 (file)
@@ -284,10 +284,10 @@ void set_four_ipo(float d, float *data, int type)
                }
                else if(type==KEY_BSPLINE) {
 
-                       data[0]= -0.1666f*d3    +0.5f*d2        -0.5f*d +0.16666f;
-                       data[1]= 0.5f*d3                -d2                             +0.6666f;
-                       data[2]= -0.5f*d3               +0.5f*d2        +0.5f*d +0.1666f;
-                       data[3]= 0.1666f*d3                     ;
+                       data[0]= -0.16666666f*d3        +0.5f*d2        -0.5f*d +0.16666666f;
+                       data[1]= 0.5f*d3                -d2                             +0.6666666f;
+                       data[2]= -0.5f*d3               +0.5f*d2        +0.5f*d +0.16666666f;
+                       data[3]= 0.16666666f*d3                 ;
                }
        }
 }
@@ -313,10 +313,10 @@ void set_afgeleide_four_ipo(float d, float *data, int type)
                }
                else if(type==KEY_BSPLINE) {
 
-                       data[0]= -0.1666f*3.0f*d2       +d      -0.5f;
+                       data[0]= -0.16666666f*3.0f*d2   +d      -0.5f;
                        data[1]= 1.5f*d2                -2.0f*d;
                        data[2]= -1.5f*d2               +d      +0.5f;
-                       data[3]= 0.1666f*3.0f*d2                        ;
+                       data[3]= 0.16666666f*3.0f*d2                    ;
                }
        }
 }
index c3dddf06e7c0df668276d404ef1f14323dfcb6a8..3d1b342bf732d88f942d0aa50abdac1e1cd9611a 100644 (file)
@@ -407,6 +407,10 @@ void *copy_libblock(void *rt)
        lb= wich_libbase(G.main, GS(id->name));
        idn= alloc_libblock(lb, GS(id->name), id->name+2);
        
+       if(idn==NULL) {
+               printf("ERROR: Illegal ID name for %s (Crashing now)\n", id->name);
+       }
+       
        idn_len= MEM_allocN_len(idn);
        if(idn_len - sizeof(ID) > 0) {
                cp= (char *)id;
index b9a60ca9329ee264c39b7195133d83d1a8093faf..13dc2e834f234de04fa532aec14fec4932adb325 100644 (file)
@@ -7759,6 +7759,8 @@ static void shrinkwrapModifier_copyData(ModifierData *md, ModifierData *target)
        tsmd->keepDist  = smd->keepDist;
        tsmd->shrinkType= smd->shrinkType;
        tsmd->shrinkOpts= smd->shrinkOpts;
+       tsmd->projAxis = smd->projAxis;
+       tsmd->subsurfLevels = smd->subsurfLevels;
 }
 
 CustomDataMask shrinkwrapModifier_requiredDataMask(ModifierData *md)
index 259a4e0de0409588b4fb1415d0037f365ab59986..4d312632b1a8645880d57fca706d0d02f9fb0d63 100644 (file)
@@ -642,6 +642,10 @@ static void multires_update_vertices(Mesh *me, EditMesh *em)
        MultiApplyData data;
        int i, j;
 
+       /* XXX added this to prevent crash, but if it works? (ton) */
+       if(me->mr->verts==NULL)
+               return;
+       
        /* Prepare deltas */
        pr_deltas= MEM_callocN(sizeof(vec3f)*last_lvl->totvert, "multires deltas 1");
        cr_deltas= MEM_callocN(sizeof(vec3f)*last_lvl->totvert, "multires deltas 2");
index 8f7a90625ba1916ab8dd0c2534e15fdb3eaa8f62..39226faff1e9275791a431384deacd7e7264e208 100644 (file)
@@ -3101,7 +3101,7 @@ static void deflect_particle(Object *pob, ParticleSystemModifierData *psmd, Part
                                col.md = ( CollisionModifierData * ) ( modifiers_findByType ( ec->ob, eModifierType_Collision ) );
                                col.ob_t = ob;
 
-                               if(col.md->bvhtree)
+                               if(col.md && col.md->bvhtree)
                                        BLI_bvhtree_ray_cast(col.md->bvhtree, col.co1, ray_dir, radius, &hit, particle_intersect_face, &col);
                        }
                }
@@ -3973,9 +3973,6 @@ static void dynamics_step(Object *ob, ParticleSystem *psys, ParticleSystemModifi
                        }
                        pa->size=psys_get_size(ob,ma,psmd,icu_esize,psys,part,pa,vg_size);
 
-                       if(part->type==PART_REACTOR)
-                               initialize_particle(pa,p,ob,psys,psmd);
-
                        reset_particle(pa,psys,psmd,ob,dtime,cfra,vg_vel,vg_tan,vg_rot);
 
                        if(cfra>pa->time && part->flag & PART_LOOP && part->type!=PART_HAIR){
index 43805959e620f2a5d456c79d14dba472c5f514f9..d4676653a4e007ad3bd499ebc571cc301ef6732e 100644 (file)
 #include <unistd.h>
 #endif
 
+#ifdef _WIN32
+#ifndef snprintf
+#define snprintf _snprintf
+#endif
+#endif
+
 /* Creating ID's */
 
 void BKE_ptcache_id_from_softbody(PTCacheID *pid, Object *ob, SoftBody *sb)
@@ -164,6 +170,9 @@ void BKE_ptcache_ids_from_object(ListBase *lb, Object *ob)
        - stack_index: index in the modifier stack. we can have cache for more then one stack_index
 */
 
+#define MAX_PTCACHE_PATH FILE_MAX
+#define MAX_PTCACHE_FILE ((FILE_MAXDIR+FILE_MAXFILE)*2)
+
 static int ptcache_path(PTCacheID *pid, char *filename)
 {
        Library *lib;
@@ -172,7 +181,7 @@ static int ptcache_path(PTCacheID *pid, char *filename)
        lib= (pid)? pid->ob->id.lib: NULL;
 
        if (G.relbase_valid || lib) {
-               char file[FILE_MAX]; /* we dont want the dir, only the file */
+               char file[MAX_PTCACHE_PATH]; /* we dont want the dir, only the file */
                char *blendfilename;
 
                blendfilename= (lib)? lib->filename: G.sce;
@@ -184,7 +193,7 @@ static int ptcache_path(PTCacheID *pid, char *filename)
                if (i > 6)
                        file[i-6] = '\0';
                
-               sprintf(filename, "//"PTCACHE_PATH"%s", file); /* add blend file name to pointcache dir */
+               snprintf(filename, MAX_PTCACHE_PATH, "//"PTCACHE_PATH"%s", file); /* add blend file name to pointcache dir */
                BLI_convertstringcode(filename, blendfilename);
                BLI_add_slash(filename);
                return strlen(filename);
@@ -192,7 +201,7 @@ static int ptcache_path(PTCacheID *pid, char *filename)
        
        /* use the temp path. this is weak but better then not using point cache at all */
        /* btempdir is assumed to exist and ALWAYS has a trailing slash */
-       sprintf(filename, "%s"PTCACHE_PATH"%d", btempdir, abs(getpid()));
+       snprintf(filename, MAX_PTCACHE_PATH, "%s"PTCACHE_PATH"%d", btempdir, abs(getpid()));
        BLI_add_slash(filename);
        return strlen(filename);
 }
@@ -215,13 +224,13 @@ static int BKE_ptcache_id_filename(PTCacheID *pid, char *filename, int cfra, sho
        idname = (pid->ob->id.name+2);
        /* convert chars to hex so they are always a valid filename */
        while('\0' != *idname) {
-               sprintf(newname, "%02X", (char)(*idname++));
+               snprintf(newname, MAX_PTCACHE_FILE, "%02X", (char)(*idname++));
                newname+=2;
                len += 2;
        }
        
        if (do_ext) {
-               sprintf(newname, "_%06d_%02d"PTCACHE_EXT, cfra, pid->stack_index); /* always 6 chars */
+               snprintf(newname, MAX_PTCACHE_FILE, "_%06d_%02d"PTCACHE_EXT, cfra, pid->stack_index); /* always 6 chars */
                len += 16;
        }
        
@@ -290,9 +299,10 @@ void BKE_ptcache_id_clear(PTCacheID *pid, int mode, int cfra)
        /* mode is same as fopen's modes */
        DIR *dir; 
        struct dirent *de;
-       char path[FILE_MAX];
-       char filename[(FILE_MAXDIR+FILE_MAXFILE)*2];
-       char path_full[(FILE_MAXDIR+FILE_MAXFILE)*2];
+       char path[MAX_PTCACHE_PATH];
+       char filename[MAX_PTCACHE_FILE];
+       char path_full[MAX_PTCACHE_FILE];
+       char ext[MAX_PTCACHE_PATH];
 
        if(!pid->cache)
                return;
@@ -315,9 +325,11 @@ void BKE_ptcache_id_clear(PTCacheID *pid, int mode, int cfra)
                dir = opendir(path);
                if (dir==NULL)
                        return;
+
+               snprintf(ext, sizeof(ext), "_%02d"PTCACHE_EXT, pid->stack_index);
                
                while ((de = readdir(dir)) != NULL) {
-                       if (strstr(de->d_name, PTCACHE_EXT)) { /* do we have the right extension?*/
+                       if (strstr(de->d_name, ext)) { /* do we have the right extension?*/
                                if (strncmp(filename, de->d_name, len ) == 0) { /* do we have the right prefix */
                                        if (mode == PTCACHE_CLEAR_ALL) {
                                                BLI_join_dirfile(path_full, path, de->d_name);
@@ -326,8 +338,9 @@ void BKE_ptcache_id_clear(PTCacheID *pid, int mode, int cfra)
                                                /* read the number of the file */
                                                int frame, len2 = strlen(de->d_name);
                                                char num[7];
+
                                                if (len2 > 15) { /* could crash if trying to copy a string out of this range*/
-                                                       strncpy(num, de->d_name + (strlen(de->d_name) - 15), 6);
+                                                       BLI_strncpy(num, de->d_name + (strlen(de->d_name) - 15), sizeof(num));
                                                        frame = atoi(num);
                                                        
                                                        if((mode==PTCACHE_CLEAR_BEFORE && frame < cfra) || 
@@ -353,7 +366,7 @@ void BKE_ptcache_id_clear(PTCacheID *pid, int mode, int cfra)
 
 int BKE_ptcache_id_exist(PTCacheID *pid, int cfra)
 {
-       char filename[(FILE_MAXDIR+FILE_MAXFILE)*2];
+       char filename[MAX_PTCACHE_FILE];
 
        if(!pid->cache)
                return 0;
@@ -499,8 +512,8 @@ int BKE_ptcache_object_reset(Object *ob, int mode)
 /* Use this when quitting blender, with unsaved files */
 void BKE_ptcache_remove(void)
 {
-       char path[FILE_MAX];
-       char path_full[FILE_MAX];
+       char path[MAX_PTCACHE_PATH];
+       char path_full[MAX_PTCACHE_PATH];
        int rmdir = 1;
        
        ptcache_path(NULL, path);
index 64af8258f80bb69aded4c1b2623b04d1370039cc..cef6f802729cf5e13f53337b68a22fb72232b43a 100644 (file)
@@ -230,6 +230,10 @@ static const char** get_file_extensions(int format)
                static const char * rv[] = { ".mkv", NULL };
                return rv;
        }
+       case FFMPEG_OGG: {
+               static const char * rv[] = { ".ogg", ".ogv", NULL };
+               return rv;
+       }
        default:
                return NULL;
        }
@@ -251,14 +255,18 @@ static void write_video_frame(AVFrame* frame)
                AVPacket packet;
                av_init_packet(&packet);
 
+               if (c->coded_frame->pts != AV_NOPTS_VALUE) {
 #ifdef FFMPEG_CODEC_TIME_BASE
-               packet.pts = av_rescale_q(c->coded_frame->pts,
-                                         c->time_base,
-                                         video_stream->time_base);
+                       packet.pts = av_rescale_q(c->coded_frame->pts,
+                                                 c->time_base,
+                                                 video_stream->time_base);
 #else
-               packet.pts = c->coded_frame->pts;
+                       packet.pts = c->coded_frame->pts;
 #endif
-               fprintf(stderr, "Video Frame PTS: %lld\n", packet.pts);
+                       fprintf(stderr, "Video Frame PTS: %lld\n", packet.pts);
+               } else {
+                       fprintf(stderr, "Video Frame PTS: not set\n");
+               }
                if (c->coded_frame->key_frame)
                        packet.flags |= PKT_FLAG_KEY;
                packet.stream_index = video_stream->index;
@@ -669,6 +677,8 @@ void start_ffmpeg_impl(struct RenderData *rd, int rectx, int recty)
        switch(ffmpeg_type) {
        case FFMPEG_AVI:
        case FFMPEG_MOV:
+       case FFMPEG_OGG:
+       case FFMPEG_MKV:
                fmt->video_codec = ffmpeg_codec;
                break;
        case FFMPEG_DV:
index e7fa3332f435ac27fcc9209fa88bc405101510e8..858aa6e60bf96582c5379469b431d79d27bd0681 100644 (file)
@@ -78,10 +78,7 @@ char *PIL_dynlib_get_error_as_string(PILdynlib* lib) {
 
        /* if lib is NULL reset the last error code */
        err= GetLastError();
-       if (!lib) {
-               SetLastError(ERROR_SUCCESS);
-               err = ERROR_SUCCESS;
-       }
+       if (!lib) SetLastError(ERROR_SUCCESS);
 
        if (err) {
                static char buf[1024];
@@ -96,7 +93,7 @@ char *PIL_dynlib_get_error_as_string(PILdynlib* lib) {
                        return buf;
        }
        
-       return "unrecognized error";
+       return err;
 }
 
 void PIL_dynlib_close(PILdynlib *lib) {
index 2acbbbe6712c8197c67957c7961cf5640dd718d2..76437720e452dc6e916f4154a30d2c681107cce0 100644 (file)
@@ -303,7 +303,8 @@ void BLI_recurdir_fileops(char *dirname) {
 int BLI_rename(char *from, char *to) {
        if (!BLI_exists(from)) return 0;
 
-       if (BLI_exists(to))
+       /* make sure the filenames are different (case insensitive) before removing */
+       if (BLI_exists(to) && BLI_strcasecmp(from, to))
                if(BLI_delete(to, 0, 0)) return 1;
                
        return rename(from, to);
index 442a629b12d9366e5e0da57b3c8ade05546bd500..013b9e0bb1b49fde7ffa8c615e793edfd48eacbc 100644 (file)
@@ -893,7 +893,10 @@ void BLI_cleanup_file(const char *relabase, char *dir)
         */
        
 #ifdef WIN32
-       if(dir[0]=='.') {       /* happens for example in FILE_MAIN */
+       
+       /* Note, this should really be moved to the file selector,
+        * since this function is used in many areas */
+       if(strcmp(dir, ".")==0) {       /* happens for example in FILE_MAIN */
           get_default_root(dir);
           return;
        }       
@@ -1182,7 +1185,7 @@ int BLI_convertstringcode(char *path, const char *basepath)
         * Add a / prefix and lowercase the driveletter, remove the :
         * C:\foo.JPG -> /c/foo.JPG */
        
-       if (tmp[1] == ':' && isalpha(tmp[0]) && (tmp[2]=='\\' || tmp[2]=='/') ) {
+       if (isalpha(tmp[0]) && tmp[1] == ':' && (tmp[2]=='\\' || tmp[2]=='/') ) {
                tmp[1] = tolower(tmp[0]); /* replace ':' with driveletter */
                tmp[0] = '/'; 
                /* '\' the slash will be converted later */
index 249459bf3a468a1b00f7f251b0bff46c2b357f0d..3cae5fe4972a44c289600d8b35497e4a35fd303f 100644 (file)
@@ -7963,9 +7963,27 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
                        la->sky_exposure= 1.0f;
                }
        }
+       
+       /* BGE message actuators needed OB prefix, very confusing */
+       if (main->versionfile < 247 || (main->versionfile == 247 && main->subversionfile < 10)) {
+               bActuator *act;
+               Object *ob;
                
-               
-               
+               for(ob = main->object.first; ob; ob= ob->id.next) {
+                       for(act= ob->actuators.first; act; act= act->next) {
+                               if (act->type == ACT_MESSAGE) {
+                                       bMessageActuator *msgAct = (bMessageActuator *) act->data;
+                                       if (strlen(msgAct->toPropName) > 2) {
+                                               /* strip first 2 chars, would have only worked if these were OB anyway */
+                                               strncpy(msgAct->toPropName, msgAct->toPropName+2, sizeof(msgAct->toPropName));
+                                       } else {
+                                               msgAct->toPropName[0] = '\0';
+                                       }
+                               }
+                       }
+               }
+       }
+       
        /* 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 1c29bdc8741d46772d8b5b816e76e4f068d7eb69..94c1910e3bc4494aabfbedb10b03bd0a0b60924a 100644 (file)
@@ -516,10 +516,14 @@ static void codegen_set_unique_ids(ListBase *nodes)
                                                input->texid = GET_INT_FROM_POINTER(BLI_ghash_lookup(bindhash, input->ima));
                                }
                                else {
-                                       /* input is user created texture, we know there there is
-                                          only one, so assign new texid */
-                                       input->bindtex = 1;
-                                       input->texid = texid++;
+                                       if (!BLI_ghash_haskey(bindhash, input->tex)) {
+                                               /* input is user created texture, check tex pointer */
+                                               input->texid = texid++;
+                                               input->bindtex = 1;
+                                               BLI_ghash_insert(bindhash, input->tex, SET_INT_IN_POINTER(input->texid));
+                                       }
+                                       else
+                                               input->texid = GET_INT_FROM_POINTER(BLI_ghash_lookup(bindhash, input->tex));
                                }
 
                                /* make sure this pixel is defined exactly once */
@@ -836,11 +840,9 @@ void GPU_pass_bind(GPUPass *pass, double time)
                if (input->ima)
                        input->tex = GPU_texture_from_blender(input->ima, input->iuser, time);
 
-               if(input->ima || input->tex) {
-                       if(input->tex) {
-                               GPU_texture_bind(input->tex, input->texid);
-                               GPU_shader_uniform_texture(shader, input->shaderloc, input->tex);
-                       }
+               if(input->tex && input->bindtex) {
+                       GPU_texture_bind(input->tex, input->texid);
+                       GPU_shader_uniform_texture(shader, input->shaderloc, input->tex);
                }
        }
 }
@@ -871,9 +873,9 @@ void GPU_pass_unbind(GPUPass *pass)
                return;
 
        for (input=inputs->first; input; input=input->next) {
-               if (input->tex)
-                       if(input->bindtex)
-                               GPU_texture_unbind(input->tex);
+               if(input->tex && input->bindtex)
+                       GPU_texture_unbind(input->tex);
+
                if (input->ima)
                        input->tex = 0;
        }
index 700dd6dedb238eb5066abf182a7b3021f713ffe3..4025a12a867ba993b08518af1575124d311206c8 100644 (file)
@@ -220,12 +220,24 @@ static int gpu_get_mipmap(void)
        return GTS.domipmap && (!(G.f & G_TEXTUREPAINT));
 }
 
-static GLenum gpu_get_mipmap_filter()
+static GLenum gpu_get_mipmap_filter(int mag)
 {
-       /* linearmipmap is off by default
-        * when mipmapping is off, use unfiltered display */
-       return GTS.linearmipmap? GL_LINEAR_MIPMAP_LINEAR :
-                               (GTS.domipmap ? GL_LINEAR_MIPMAP_NEAREST : GL_NEAREST);
+       /* linearmipmap is off by default *when mipmapping is off,
+        * use unfiltered display */
+       if(mag) {
+               if(GTS.linearmipmap || GTS.domipmap)
+                       return GL_LINEAR;
+               else
+                       return GL_NEAREST;
+       }
+       else {
+               if(GTS.linearmipmap)
+                       return GL_LINEAR_MIPMAP_LINEAR;
+               else if(GTS.domipmap)
+                       return GL_LINEAR_MIPMAP_NEAREST;
+               else
+                       return GL_NEAREST;
+       }
 }
 
 /* Set OpenGL state for an MTFace */
@@ -359,6 +371,8 @@ int GPU_verify_image(Image *ima, int tftile, int tfmode, int compare)
        else
                GTS.tile= tftile;
 
+       GTS.tile = MAX2(0, GTS.tile);
+
        if(ima) {
                GTS.tileXRep = ima->xrep;
                GTS.tileYRep = ima->yrep;
@@ -477,12 +491,12 @@ int GPU_verify_image(Image *ima, int tftile, int tfmode, int compare)
        if (!gpu_get_mipmap()) {
                glTexImage2D(GL_TEXTURE_2D, 0,  GL_RGBA,  rectw, recth, 0, GL_RGBA, GL_UNSIGNED_BYTE, rect);
                glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
-               glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, gpu_get_mipmap_filter());
+               glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, gpu_get_mipmap_filter(1));
        }
        else {
                gluBuild2DMipmaps(GL_TEXTURE_2D, GL_RGBA, rectw, recth, GL_RGBA, GL_UNSIGNED_BYTE, rect);
-               glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, gpu_get_mipmap_filter());
-               glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, gpu_get_mipmap_filter());
+               glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, gpu_get_mipmap_filter(0));
+               glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, gpu_get_mipmap_filter(1));
 
                ima->tpageflag |= IMA_MIPMAP_COMPLETE;
        }
@@ -574,8 +588,8 @@ void GPU_paint_set_mipmap(int mipmap)
                        if(ima->bindcode) {
                                if(ima->tpageflag & IMA_MIPMAP_COMPLETE) {
                                        glBindTexture(GL_TEXTURE_2D, ima->bindcode);
-                                       glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, gpu_get_mipmap_filter());
-                                       glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, gpu_get_mipmap_filter());
+                                       glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, gpu_get_mipmap_filter(0));
+                                       glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, gpu_get_mipmap_filter(1));
                                }
                                else
                                        GPU_free_image(ima);
@@ -588,7 +602,7 @@ void GPU_paint_set_mipmap(int mipmap)
                        if(ima->bindcode) {
                                glBindTexture(GL_TEXTURE_2D, ima->bindcode);
                                glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
-                               glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, gpu_get_mipmap_filter());
+                               glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, gpu_get_mipmap_filter(1));
                        }
                }
        }
@@ -1046,7 +1060,7 @@ int GPU_scene_object_lights(Scene *scene, Object *ob, int lay, float viewmat[][4
                
                if(la->type==LA_SUN) {
                        /* sun lamp */
-                       VECCOPY(position, base->object->obmat[2]);
+                       VECCOPY(direction, base->object->obmat[2]);
                        direction[3]= 0.0;
 
                        glLightfv(GL_LIGHT0+count, GL_POSITION, direction); 
index d4da2866d968881d1e0dd36a7b68fda65689a555..db6117d854b1b3475cab939cf8637bb062e0d492 100644 (file)
@@ -693,7 +693,7 @@ static void shade_one_light(GPUShadeInput *shi, GPUShadeResult *shr, GPULamp *la
                                                shr->spec, &shr->spec);
                                
                                add_user_list(&mat->lamps, lamp);
-                               add_user_list(&lamp->materials, ma);
+                               add_user_list(&lamp->materials, shi->gpumat->ma);
                                return;
                        }
                        
@@ -702,7 +702,7 @@ static void shade_one_light(GPUShadeInput *shi, GPUShadeResult *shr, GPULamp *la
        }
        else if((G.fileflags & G_FILE_GLSL_NO_SHADOWS) && (lamp->mode & LA_ONLYSHADOW)) {
                add_user_list(&mat->lamps, lamp);
-               add_user_list(&lamp->materials, ma);
+               add_user_list(&lamp->materials, shi->gpumat->ma);
                return;
        }
        else
@@ -755,7 +755,7 @@ static void shade_one_light(GPUShadeInput *shi, GPUShadeResult *shr, GPULamp *la
        }
 
        add_user_list(&mat->lamps, lamp);
-       add_user_list(&lamp->materials, ma);
+       add_user_list(&lamp->materials, shi->gpumat->ma);
 }
 
 static void material_lights(GPUShadeInput *shi, GPUShadeResult *shr)
@@ -928,7 +928,7 @@ static void do_material_tex(GPUShadeInput *shi)
                        else if(mtex->texco==TEXCO_OBJECT)
                                texco= texco_object;
                        else if(mtex->texco==TEXCO_NORM)
-                               texco= texco_norm;
+                               texco= orn;
                        else if(mtex->texco==TEXCO_TANGENT)
                                texco= texco_object;
                        else if(mtex->texco==TEXCO_GLOB)
@@ -1145,6 +1145,8 @@ void GPU_shaderesult_set(GPUShadeInput *shi, GPUShadeResult *shr)
        if((G.fileflags & G_FILE_GLSL_NO_LIGHTS) || (ma->mode & MA_SHLESS)) {
                shr->combined = shi->rgb;
                shr->alpha = shi->alpha;
+               GPU_link(mat, "set_rgb", shi->rgb, &shr->diff);
+               GPU_link(mat, "set_rgb_zero", &shr->spec);
        }
        else {
                if(GPU_link_changed(shi->emit) || ma->emit != 0.0f) {
index 2959ed654abe9e1c07f53d367c31b27acd7ffb86..514d6b5522b623d4c07c945e18a944dceb408dc4 100644 (file)
 
 static void cineon_conversion_parameters(LogImageByteConversionParameters *params)
 {
-       params->blackPoint = G.scene->r.cineonblack;
-       params->whitePoint = G.scene->r.cineonwhite;
-       params->gamma = G.scene->r.cineongamma;
-       params->doLogarithm = G.scene->r.subimtype & R_CINEON_LOG;
+       params->blackPoint = G.scene?G.scene->r.cineonblack:95;
+       params->whitePoint = G.scene?G.scene->r.cineonwhite:685;
+       params->gamma = G.scene?G.scene->r.cineongamma:1.7f;
+       params->doLogarithm = G.scene?G.scene->r.subimtype & R_CINEON_LOG:0;
 }
 
 static struct ImBuf *imb_load_dpx_cineon(unsigned char *mem, int use_cineon, int size, int flags)
index ecee3c7d6c0a3ddb23cfa835072f13e44ebd5e14..75516bbf3ae8a28bc9fdd2774ccd6049d054357e 100644 (file)
@@ -617,7 +617,7 @@ cineonOpenFromMem(unsigned char *mem, unsigned int size) {
        
        cineon->file = 0;
        cineon->reading = 1;
-       verbose = 1;
+       verbose = 0;
        if (size < sizeof(CineonGenericHeader)) {
                if (verbose) d_printf("Not enough data for header!\n");
                cineonClose(cineon);
index 1710cdde501fc6cd4e2d005b565cc47812734546..8a9adc73cdc1a1e010caa767b1d086ac79e91c2f 100644 (file)
@@ -199,7 +199,7 @@ dumpDpxMainHeader(DpxMainHeader* header) {
 #endif
 }
 
-static int verbose = 1;
+static int verbose = 0;
 void
 dpxSetVerbose(int verbosity) {
        verbose = verbosity;
index b057e3f8bd26ae6d60514c25f09c17280ce44f4f..b9186e482c5c6ac90ac1a4fd4cc2d7f1d49a0c7f 100644 (file)
@@ -106,8 +106,11 @@ void *libtiff_findsymbol(char *name)
        assert(libtiff != NULL);
        symbol = PIL_dynlib_find_symbol(libtiff, name);
        if (symbol == NULL) {
-               printf("libtiff_findsymbol: error %s\n",
-                       PIL_dynlib_get_error_as_string(libtiff));
+               char *err = PIL_dynlib_get_error_as_string(libtiff);
+
+               if (err) printf("libtiff_findsymbol: error %s\n",err);
+               else printf("libtiff_findsymbol: error Unknown.\n");
+
                libtiff = NULL;
                G.have_libtiff = (0);
                return NULL;
index bc95c221b511e7a82ded3c9f6155c7d976f17c2c..11e6478f29a41fc6fe5e297133641933fc113114 100644 (file)
@@ -76,6 +76,7 @@ void link_to_scene(unsigned short nr);
 void make_links_menu(void);
 void make_links(short event);
 void make_duplilist_real(void);
+void make_object_duplilist_real(struct Base *base);
 void apply_objects_locrot(void);
 void apply_objects_scale(void);
 void apply_objects_rot(void);
index 9b9294b0343fab9c34db32b5cf04c0fe4661b7a7..6af156775bea5f34ef9feac0f33b62db740dc006 100644 (file)
@@ -1,5 +1,5 @@
 /**
- * $Id: BDR_gpencil.h 14444 2008-04-16 22:40:48Z aligorith $
+ * $Id$
  *
  * ***** BEGIN GPL LICENSE BLOCK *****
  *
@@ -57,10 +57,13 @@ struct bGPDframe *gpencil_frame_addnew(struct bGPDlayer *gpl, int cframe);
 struct bGPDlayer *gpencil_layer_addnew(struct bGPdata *gpd);
 struct bGPdata *gpencil_data_addnew(void);
 
+struct bGPDframe *gpencil_frame_duplicate(struct bGPDframe *src);
+struct bGPDlayer *gpencil_layer_duplicate(struct bGPDlayer *src);
 struct bGPdata *gpencil_data_duplicate(struct bGPdata *gpd);
 
 struct bGPdata *gpencil_data_getactive(struct ScrArea *sa);
 short gpencil_data_setactive(struct ScrArea *sa, struct bGPdata *gpd);
+struct ScrArea *gpencil_data_findowner(struct bGPdata *gpd);
 
 void gpencil_frame_delete_laststroke(struct bGPDframe *gpf);
 
@@ -79,7 +82,6 @@ void gpencil_delete_menu(void);
 void gpencil_convert_operation(short mode);
 void gpencil_convert_menu(void);
 
-//short gpencil_paint(short mousebutton);
 short gpencil_do_paint(struct ScrArea *sa, short mousebutton);
 
 #endif /*  BDR_GPENCIL_H */
index eacafce058d92e5ec064372a839b314c2827fe13..ae2ec192cc789775664d3f18eff9ced53797f69a 100644 (file)
@@ -1,5 +1,5 @@
 /**
- * $Id: BIF_drawgpencil.h 14444 2008-04-16 22:40:48Z aligorith $
+ * $Id$
  *
  * ***** BEGIN GPL LICENSE BLOCK *****
  *
index 1425cf6a67c51c3dabdea5129de762aaa9393127..ae330b30d81f02c0a2a3f216b411eb3c33bde7f3 100644 (file)
@@ -201,6 +201,10 @@ void delete_gpencil_layers(void);
 void delete_gplayer_frames(struct bGPDlayer *gpl);
 void duplicate_gplayer_frames(struct bGPDlayer *gpd);
 
+void free_gpcopybuf(void);
+void copy_gpdata(void);
+void paste_gpdata(void);
+
 void snap_gplayer_frames(struct bGPDlayer *gpl, short mode);
 void mirror_gplayer_frames(struct bGPDlayer *gpl, short mode);
 
index 5d43a50efec3729428e95605df6883509ee18007..dbbe55123e409a497659a43e4a47c1bc36b1a462 100644 (file)
@@ -1,5 +1,5 @@
 /**
- * $Id: BIF_keyframing.h 14444 2008-04-16 22:40:48Z aligorith $
+ * $Id$
  *
  * ***** BEGIN GPL LICENSE BLOCK *****
  *
@@ -65,7 +65,7 @@ enum {
 /* -------- */
 
 /* Main Keyframing API calls: 
- *     Use this to create any necessary animation data,, and then insert a keyframe
+ *     Use this to create any necessary animation data, and then insert a keyframe
  *     using the current value being keyframed, in the relevant place. Returns success.
  */
        // TODO: adapt this for new data-api -> this blocktype, etc. stuff is evil!
@@ -104,18 +104,28 @@ void common_deletekey(void);
 
 /* ************ Keyframe Checking ******************** */
 
-/* Checks whether a keyframe exists for the given ID-block one the given frame */
-short id_cfra_has_keyframe(struct ID *id, short filter);
+/* Main Keyframe Checking API call:
+ * Checks whether a keyframe exists for the given ID-block one the given frame.
+ *  - It is recommended to call this method over the other keyframe-checkers directly,
+ *       in case some detail of the implementation changes...
+ *     - frame: the value of this is quite often result of frame_to_float(CFRA)
+ */
+short id_frame_has_keyframe(struct ID *id, float frame, short filter);
 
-/* filter flags fr id_cfra_has_keyframe */
+/* filter flags for id_cfra_has_keyframe 
+ *
+ * WARNING: do not alter order of these, as also stored in files
+ *     (for v3d->keyflags)
+ */
 enum {
                /* general */
-       ANIMFILTER_ALL          = 0,                    /* include all available animation data */
        ANIMFILTER_LOCAL        = (1<<0),               /* only include locally available anim data */
+       ANIMFILTER_MUTED        = (1<<1),               /* include muted elements */
+       ANIMFILTER_ACTIVE       = (1<<2),               /* only include active-subelements */
        
                /* object specific */
-       ANIMFILTER_MAT          = (1<<1),               /* include material keyframes too */
-       ANIMFILTER_SKEY         = (1<<2),               /* shape keys (for geometry) */
+       ANIMFILTER_NOMAT                = (1<<9),               /* don't include material keyframes */
+       ANIMFILTER_NOSKEY               = (1<<10),              /* don't include shape keys (for geometry) */
 } eAnimFilterFlags;
 
 #endif /*  BIF_KEYFRAMING_H */
index 9b2c21a08170a483db4329e94066adf5bd7e1d99..64aa50c661daf83b4f41e827523b5c110048c468 100644 (file)
 #ifndef BSE_SEQAUDIO_H
 #define BSE_SEQAUDIO_H
 
+#ifndef DISABLE_SDL
 #include "SDL.h"
+#endif
+
 /* muha, we don't init (no SDL_main)! */
 #ifdef main
 #      undef main
 #endif
 
 #include "DNA_sound_types.h"
+#include "BLO_sys_types.h"
 
 void audio_mixdown();
 void audio_makestream(bSound *sound);
-void audiostream_play(Uint32 startframe, Uint32 duration, int mixdown);
-void audiostream_fill(Uint8* mixdown, int len);
-void audiostream_start(Uint32 frame);
-void audiostream_scrub(Uint32 frame);
+void audiostream_play(uint32_t startframe, uint32_t duration, int mixdown);
+void audiostream_fill(uint8_t* mixdown, int len);
+void audiostream_start(uint32_t frame);
+void audiostream_scrub(uint32_t frame);
 void audiostream_stop(void);
 int audiostream_pos(void);
 
index 2487216f764a45c6bbdb755e2e9fa1dee8cd62b7..43dada97d0e996258cbbb40047d48c2827d09734 100644 (file)
@@ -113,6 +113,7 @@ typedef struct bIpoActuator {
        short flag, type;
        int sta, end;
        char name[32];
+       char frameProp[32];     /* Set this property to the actions current frame */
        
        short pad1, cur, butsta, butend;
        
@@ -369,6 +370,7 @@ typedef struct FreeCamera {
 #define ACT_CONST_PERMANENT 256
 #define ACT_CONST_DISTANCE     512
 #define ACT_CONST_LOCAL     1024
+#define ACT_CONST_DOROTFH      2048
 
 /* constraint mode */
 #define ACT_CONST_DIRPX                1
@@ -382,6 +384,7 @@ typedef struct FreeCamera {
 #define ACT_CONST_TYPE_LOC     0
 #define ACT_CONST_TYPE_DIST    1
 #define ACT_CONST_TYPE_ORI     2
+#define ACT_CONST_TYPE_FH   3
 
 /* editObjectActuator->type */
 #define ACT_EDOB_ADD_OBJECT            0
index ecfb7dc7a90106742de3d2232ba501dcd6c7d225..fe19cf60f12fe44a38882ef46cd7b3846b19645e 100644 (file)
@@ -520,6 +520,7 @@ typedef enum B_CONSTRAINTCHANNEL_FLAG {
 
 /* Rigid-Body Constraint */
 #define CONSTRAINT_DRAW_PIVOT 0x40
+#define CONSTRAINT_DISABLE_LINKED_COLLISION 0x80
 
 /* important: these defines need to match up with PHY_DynamicTypes headerfile */
 #define CONSTRAINT_RB_BALL             1
index cc0c99120572ca33ce3d6539e99d61537e59a82a..70f469b2bb8fc80840ce8055bd5f6cb786fa0f5d 100644 (file)
@@ -1,5 +1,5 @@
 /**
- * $Id: DNA_gpencil_types.h 8768 2006-11-07 00:10:37Z aligorith $
+ * $Id$
  *
  * ***** BEGIN GPL LICENSE BLOCK *****
  *
index fde1ce57875827fc8d9d2e25b272c68179eecffd..2914330a2b0bc62289fc6243a125cf5933dba5f7 100644 (file)
@@ -142,7 +142,7 @@ typedef struct FluidsimSettings {
 #define OB_FLUIDSIM_PARTICLE    64
 #define OB_FLUIDSIM_CONTROL    128
 
-#define OB_TYPEFLAG_START       0
+#define OB_TYPEFLAG_START       7
 #define OB_FSGEO_THIN           (1<<(OB_TYPEFLAG_START+1))
 #define OB_FSBND_NOSLIP         (1<<(OB_TYPEFLAG_START+2))
 #define OB_FSBND_PARTSLIP       (1<<(OB_TYPEFLAG_START+3))
index 1fd97fe0158166d9cea5ab6ed677515fb76de715..d8a1ffc6c2429c47f19672a12071c40ac8db4fcf 100644 (file)
@@ -163,12 +163,12 @@ typedef struct bSensor {
 
 typedef struct bJoystickSensor {
        char name[32];
-       short type;
-       short joyindex;
+       char type;
+       char joyindex;
+       short flag;
        int axis;
        int axisf;
        int button;
-       int buttonf;
        int hat;
        int hatf;
        int precision;
@@ -252,6 +252,8 @@ typedef struct bJoystickSensor {
 #define BL_SENS_MOUSE_MOUSEOVER      16
 #define BL_SENS_MOUSE_MOUSEOVER_ANY     32
 
+#define SENS_JOY_ANY_EVENT             1
+
 #define SENS_JOY_BUTTON                0
 #define SENS_JOY_BUTTON_PRESSED        0
 #define SENS_JOY_BUTTON_RELEASED       1
@@ -266,6 +268,7 @@ typedef struct bJoystickSensor {
 #define SENS_JOY_HAT                   2
 #define SENS_JOY_HAT_DIR               0
 
+
 #define SENS_DELAY_REPEAT              1
 // should match JOYINDEX_MAX in SCA_JoystickDefines.h */
 #define SENS_JOY_MAXINDEX              8
index ead1df4ddac3ee6946af860700b202a07060d33a..fbd962f937216606171df38b4d74b57d403279c3 100644 (file)
@@ -189,8 +189,8 @@ typedef struct UserDef {
        struct ListBase themes;
        short undosteps;
        short undomemory;
-       short gp_manhattendist, gp_euclideandist, pad;
-       short curssize;
+       short gp_manhattendist, gp_euclideandist, gp_eraser;
+       short gp_settings;
        short tb_leftmouse, tb_rightmouse;
        struct SolidLight light[3];
        short tw_hotspot, tw_flag, tw_handlesize, tw_size;
@@ -206,7 +206,7 @@ typedef struct UserDef {
        short smooth_viewtx;    /* miliseconds to spend spinning the view */
        short glreslimit;
        short ndof_pan, ndof_rotate;
-       short pads[2];
+       short curssize, pad;
 //     char pad[8];
        char versemaster[160];
        char verseuser[160];
@@ -326,5 +326,9 @@ extern UserDef U; /* from usiblender.c !!!! */
 
 /* tw_flag (transform widget) */
 
+/* gp_settings (Grease Pencil Settings) */
+#define GP_PAINT_DOSMOOTH              (1<<0)
+#define GP_PAINT_DOSIMPLIFY            (1<<1)
+
 
 #endif
index 777a5dc8eca566634aec9f371ac68868adc14af6..ae0dcfc3f0eeb6d65d0af5c78d740d4425367f06 100644 (file)
@@ -137,7 +137,7 @@ typedef struct View3D {
        
        short gridsubdiv;       /* Number of subdivisions in the grid between each highlighted grid line */
        
-       short pad3;
+       short keyflags;         /* flags for display of keyframes */
        
        char ndofmode;  /* mode of transform for 6DOF devices -1 not found, 0 normal, 1 fly, 2 ob transform */
        char ndoffilter;                /*filter for 6DOF devices 0 normal, 1 dominant */
index 59b72702c504dcbfcbfd0427be95e7eff417041b..29ef6c5da1d28ea371231857bca7931773294887 100644 (file)
@@ -95,6 +95,7 @@
 PyObject *bpy_pydriver_Dict = NULL;
 PyObject *bpy_orig_syspath_List = NULL;
 
+
 /*
  * set up a weakref list for Armatures
  *    creates list in __main__ module dict 
@@ -194,7 +195,7 @@ void BPY_start_python( int argc, char **argv )
        //stuff for Registry module
        bpy_registryDict = PyDict_New(  );/* check comment at start of this file */
        if( !bpy_registryDict )
-               printf( "Error: Couldn't create the Registry Python Dictionary!" );
+               printf( "Warning: Couldn't create the Registry Python Dictionary!" );
        Py_SetProgramName( "blender" );
 
        /* Py_Initialize() will attempt to import the site module and
@@ -222,11 +223,11 @@ void BPY_start_python( int argc, char **argv )
        
        //Start the interpreter
        Py_Initialize(  );
+       
        PySys_SetArgv( argc_copy, argv_copy );
-
        /* Initialize thread support (also acquires lock) */
        PyEval_InitThreads();
-
+       
        //Overrides __import__
        init_ourImport(  );
        init_ourReload(  );
@@ -236,7 +237,6 @@ void BPY_start_python( int argc, char **argv )
 
        //Look for a python installation
        init_syspath( first_time ); /* not first_time: some msgs are suppressed */
-
        py_tstate = PyGILState_GetThisThreadState();
        PyEval_ReleaseThread(py_tstate);
 
@@ -289,9 +289,6 @@ void syspath_append( char *dirname )
 {
        PyObject *mod_sys= NULL, *dict= NULL, *path= NULL, *dir= NULL;
        short ok=1;
-       PyErr_Clear(  );
-
-       dir = PyString_FromString( dirname );
 
        mod_sys = PyImport_ImportModule( "sys" );       /* new ref */
        
@@ -303,16 +300,21 @@ void syspath_append( char *dirname )
                }
        } else {
                /* cant get the sys module */
+               /* PyErr_Clear(); is called below */
                ok = 0;
        }
        
-       if (PySequence_Contains(path, dir)==0) { /* Only add if we need to */
-               if (ok && PyList_Append( path, dir ) != 0) /* decref below */
-                       ok = 0; /* append failed */
+       dir = PyString_FromString( dirname );
        
-               if( (ok==0) || PyErr_Occurred(  ) )
-                       Py_FatalError( "could import or build sys.path, can't continue" );
+       if (ok && PySequence_Contains(path, dir)==0) { /* Only add if we need to */
+               if (PyList_Append( path, dir ) != 0) /* decref below */
+                       ok = 0; /* append failed */
        }
+       
+       if( (ok==0) || PyErr_Occurred(  ) )
+               fprintf(stderr, "Warning: could import or build sys.path\n" );
+       
+       PyErr_Clear();
        Py_DECREF( dir );
        Py_XDECREF( mod_sys );
 }
@@ -331,8 +333,10 @@ void init_syspath( int first_time )
                d = PyModule_GetDict( mod );
                EXPP_dict_set_item_str( d, "progname", PyString_FromString( bprogname ) );
                Py_DECREF( mod );
-       } else
-               printf( "Warning: could not set Blender.sys.progname\n" );
+       } else {
+               printf( "Warning: could not set Blender.sys\n" );
+               PyErr_Clear();
+       }
 
        progname = BLI_last_slash( bprogname ); /* looks for the last dir separator */
 
@@ -391,7 +395,8 @@ void init_syspath( int first_time )
                
                Py_DECREF( mod );
        } else{
-               printf("import of sys module failed\n");
+               PyErr_Clear( );
+               printf("Warning: import of sys module failed\n");
        }
 }
 
@@ -404,13 +409,14 @@ void BPY_rebuild_syspath( void )
 
        mod = PyImport_ImportModule( "sys" );   
        if (!mod) {
-               printf("error: could not import python sys module. some modules may not import.\n");
+               printf("Warning: could not import python sys module. some modules may not import.\n");
+               PyErr_Clear(  );
                PyGILState_Release(gilstate);
                return;
        }
        
        if (!bpy_orig_syspath_List) { /* should never happen */
-               printf("error refershing python path\n");
+               printf("Warning: cant refresh python path, bpy_orig_syspath_List is NULL\n");
                Py_DECREF(mod);
                PyGILState_Release(gilstate);
                return;
@@ -1226,6 +1232,8 @@ static int bpy_pydriver_create_dict(void)
                PyDict_SetItemString(d, "Blender", mod);
                PyDict_SetItemString(d, "b", mod);
                Py_DECREF(mod);
+       } else {
+               PyErr_Clear();
        }
 
        mod = PyImport_ImportModule("math");
@@