svn merge -r39800:39900 https://svn.blender.org/svnroot/bf-blender/trunk/blender
authorCampbell Barton <ideasman42@gmail.com>
Tue, 13 Sep 2011 07:19:36 +0000 (07:19 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Tue, 13 Sep 2011 07:19:36 +0000 (07:19 +0000)
172 files changed:
CMakeLists.txt
build_files/scons/config/darwin-config.py
build_files/scons/config/win32-vc-config.py
build_files/scons/tools/Blender.py
build_files/scons/tools/btools.py
doc/python_api/rst/bge.render.rst
doc/python_api/rst/bge.types.rst
doc/python_api/rst/info_tips_and_tricks.rst [new file with mode: 0644]
intern/audaspace/intern/AUD_JOSResampleReaderCoeff.cpp
intern/audaspace/intern/AUD_SoftwareDevice.cpp
intern/ghost/intern/GHOST_ISystemPaths.cpp
intern/ghost/intern/GHOST_Path-api.cpp
intern/ghost/intern/GHOST_SystemCarbon.cpp
intern/ghost/intern/GHOST_WindowWin32.cpp
intern/guardedalloc/MEM_sys_types.h
intern/iksolver/intern/IK_QSegment.cpp
intern/opennl/superlu/superlu_sys_types.h
release/scripts/startup/bl_ui/properties_data_armature.py
release/scripts/startup/bl_ui/properties_game.py
source/blender/blenfont/intern/blf_font.c
source/blender/blenkernel/intern/collision.c
source/blender/blenkernel/intern/customdata.c
source/blender/blenkernel/intern/mesh_validate.c
source/blender/blenkernel/intern/nla.c
source/blender/blenkernel/intern/sound.c
source/blender/blenlib/BLI_callbacks.h
source/blender/blenlib/intern/math_geom.c
source/blender/blenlib/intern/math_matrix.c
source/blender/blenloader/BLO_sys_types.h
source/blender/blenpluginapi/iff.h
source/blender/collada/AnimationExporter.cpp
source/blender/collada/AnimationExporter.h
source/blender/collada/AnimationImporter.cpp
source/blender/collada/AnimationImporter.h
source/blender/collada/ArmatureExporter.cpp
source/blender/collada/ArmatureImporter.cpp
source/blender/collada/ArmatureImporter.h
source/blender/collada/DocumentExporter.cpp
source/blender/collada/ExtraHandler.cpp
source/blender/collada/ExtraTags.cpp
source/blender/collada/MeshImporter.cpp
source/blender/collada/SkinInfo.cpp
source/blender/collada/TransformWriter.cpp
source/blender/editors/animation/anim_filter.c
source/blender/editors/animation/keyframing.c
source/blender/editors/interface/interface_draw.c
source/blender/editors/mesh/editmesh.c
source/blender/editors/mesh/editmesh_lib.c
source/blender/editors/object/object_add.c
source/blender/editors/object/object_bake.c
source/blender/editors/object/object_edit.c
source/blender/editors/object/object_hook.c
source/blender/editors/object/object_relations.c
source/blender/editors/sound/sound_ops.c
source/blender/editors/space_image/image_ops.c
source/blender/editors/space_logic/logic_window.c
source/blender/editors/space_node/drawnode.c
source/blender/editors/space_outliner/outliner_draw.c
source/blender/editors/space_outliner/outliner_edit.c
source/blender/editors/space_outliner/outliner_intern.h
source/blender/editors/space_outliner/outliner_tools.c
source/blender/editors/space_outliner/outliner_tree.c
source/blender/editors/space_text/space_text.c
source/blender/editors/space_text/text_draw.c
source/blender/editors/space_text/text_intern.h
source/blender/editors/space_view3d/view3d_edit.c
source/blender/editors/space_view3d/view3d_view.c
source/blender/imbuf/IMB_imbuf.h
source/blender/imbuf/intern/anim_movie.c
source/blender/imbuf/intern/indexer_dv.c
source/blender/imbuf/intern/openexr/openexr_api.cpp
source/blender/imbuf/intern/openexr/openexr_multi.h
source/blender/imbuf/intern/rectop.c
source/blender/imbuf/intern/writeimage.c
source/blender/makesrna/intern/rna_access.c
source/blender/makesrna/intern/rna_fluidsim.c
source/blender/makesrna/intern/rna_scene_api.c
source/blender/makesrna/intern/rna_space.c
source/blender/makesrna/intern/rna_wm.c
source/blender/python/generic/bgl.c
source/blender/python/generic/py_capi_utils.c
source/blender/python/intern/bpy_app_handlers.c
source/blender/python/intern/bpy_intern_string.c
source/blender/python/intern/bpy_rna.c
source/blender/render/extern/include/RE_pipeline.h
source/blender/render/intern/source/pipeline.c
source/blender/render/intern/source/shadeoutput.c
source/blender/render/intern/source/zbuf.c
source/blender/windowmanager/intern/wm_operators.c
source/gameengine/BlenderRoutines/KX_BlenderInputDevice.h
source/gameengine/Converter/BL_ActionActuator.cpp
source/gameengine/Converter/BL_ActionActuator.h
source/gameengine/Converter/BL_BlenderDataConversion.cpp
source/gameengine/Converter/BL_MeshDeformer.h
source/gameengine/Converter/BL_ShapeDeformer.cpp
source/gameengine/Converter/BL_ShapeDeformer.h
source/gameengine/Converter/BlenderWorldInfo.cpp
source/gameengine/Converter/KX_BlenderSceneConverter.cpp
source/gameengine/Converter/KX_ConvertActuators.cpp
source/gameengine/Converter/KX_ConvertSensors.cpp
source/gameengine/Converter/KX_IpoConvert.cpp
source/gameengine/Expressions/InputParser.cpp
source/gameengine/GameLogic/SCA_2DFilterActuator.cpp
source/gameengine/GameLogic/SCA_2DFilterActuator.h
source/gameengine/GameLogic/SCA_ISensor.cpp
source/gameengine/GameLogic/SCA_ISensor.h
source/gameengine/GameLogic/SCA_KeyboardSensor.cpp
source/gameengine/GameLogic/SCA_MouseSensor.cpp
source/gameengine/GameLogic/SCA_PythonController.h
source/gameengine/GameLogic/SCA_RandomActuator.cpp
source/gameengine/GameLogic/SCA_RandomNumberGenerator.cpp
source/gameengine/GameLogic/SCA_RandomSensor.cpp
source/gameengine/GameLogic/SCA_XORController.cpp
source/gameengine/GamePlayer/common/bmfont.cpp
source/gameengine/GamePlayer/ghost/GPG_Application.cpp
source/gameengine/GamePlayer/ghost/GPG_ghost.cpp
source/gameengine/Ketsji/BL_BlenderShader.cpp
source/gameengine/Ketsji/KXNetwork/KX_NetworkEventManager.cpp
source/gameengine/Ketsji/KXNetwork/KX_NetworkEventManager.h
source/gameengine/Ketsji/KXNetwork/KX_NetworkMessageActuator.cpp
source/gameengine/Ketsji/KXNetwork/KX_NetworkMessageSensor.cpp
source/gameengine/Ketsji/KX_BlenderMaterial.cpp
source/gameengine/Ketsji/KX_BulletPhysicsController.cpp
source/gameengine/Ketsji/KX_Camera.cpp
source/gameengine/Ketsji/KX_Dome.cpp
source/gameengine/Ketsji/KX_GameObject.cpp
source/gameengine/Ketsji/KX_KetsjiEngine.cpp
source/gameengine/Ketsji/KX_Light.cpp
source/gameengine/Ketsji/KX_MeshProxy.cpp
source/gameengine/Ketsji/KX_MouseFocusSensor.cpp
source/gameengine/Ketsji/KX_ObjectActuator.cpp
source/gameengine/Ketsji/KX_OrientationInterpolator.cpp
source/gameengine/Ketsji/KX_PolygonMaterial.cpp
source/gameengine/Ketsji/KX_PythonInit.cpp
source/gameengine/Ketsji/KX_RaySensor.cpp
source/gameengine/Ketsji/KX_SCA_EndObjectActuator.cpp
source/gameengine/Ketsji/KX_Scene.cpp
source/gameengine/Ketsji/KX_Scene.h
source/gameengine/Ketsji/KX_TrackToActuator.cpp
source/gameengine/Ketsji/KX_TrackToActuator.h
source/gameengine/Network/LoopBackNetwork/NG_LoopBackNetworkDeviceInterface.h
source/gameengine/Network/NG_NetworkDeviceInterface.h
source/gameengine/Physics/Bullet/CcdPhysicsController.h
source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp
source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.h
source/gameengine/Rasterizer/RAS_2DFilterManager.cpp
source/gameengine/Rasterizer/RAS_CameraData.h
source/gameengine/Rasterizer/RAS_IRasterizer.h
source/gameengine/Rasterizer/RAS_OpenGLFilters/RAS_Blur2DFilter.h
source/gameengine/Rasterizer/RAS_OpenGLFilters/RAS_Dilation2DFilter.h
source/gameengine/Rasterizer/RAS_OpenGLFilters/RAS_Erosion2DFilter.h
source/gameengine/Rasterizer/RAS_OpenGLFilters/RAS_Laplacian2DFilter.h
source/gameengine/Rasterizer/RAS_OpenGLFilters/RAS_Prewitt2DFilter.h
source/gameengine/Rasterizer/RAS_OpenGLFilters/RAS_Sharpen2DFilter.h
source/gameengine/Rasterizer/RAS_OpenGLFilters/RAS_Sobel2DFilter.h
source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.cpp
source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.h
source/gameengine/SceneGraph/SG_BBox.cpp
source/gameengine/SceneGraph/SG_DList.h
source/gameengine/SceneGraph/SG_IObject.h
source/gameengine/SceneGraph/SG_QList.h
source/gameengine/SceneGraph/SG_Spatial.cpp
source/gameengine/VideoTexture/Exception.cpp
source/gameengine/VideoTexture/Exception.h
source/gameengine/VideoTexture/FilterColor.h
source/gameengine/VideoTexture/ImageBase.cpp
source/gameengine/VideoTexture/ImageMix.cpp
source/gameengine/VideoTexture/ImageRender.cpp
source/gameengine/VideoTexture/ImageViewport.cpp
source/gameengine/VideoTexture/VideoFFmpeg.cpp
source/gameengine/VideoTexture/blendVideoTex.cpp
source/tests/check_deprecated.py

index 77f0bed1dce229fb85b42edf46263afb581cd30d..38ce86898552da0509a9143d596c3362e15507b3 100644 (file)
@@ -948,7 +948,7 @@ elseif(APPLE)
                # we use precompiled libraries for py 3.2 and up by default
 
                # normally cached but not since we include them with blender
-                set(PYTHON_VERSION 3.2)
+               set(PYTHON_VERSION 3.2)
                set(PYTHON_INCLUDE_DIR "${LIBDIR}/python/include/python${PYTHON_VERSION}")
                # set(PYTHON_BINARY "${LIBDIR}/python/bin/python${PYTHON_VERSION}") # not used yet
                set(PYTHON_LIBRARY python${PYTHON_VERSION})
index 06abaf468dd8d2a92bf28b840ead7aaad780fb64..102ec73a4e309439232208a9d0f460492c54ae28 100644 (file)
@@ -14,7 +14,7 @@ USE_SDK=True
 ###################     Cocoa & architecture settings      ##################
 #############################################################################
 WITH_GHOST_COCOA=True
-MACOSX_ARCHITECTURE = 'i386' # valid archs: ppc, i386, ppc64, x86_64
+MACOSX_ARCHITECTURE = 'x86_64' # valid archs: ppc, i386, ppc64, x86_64
 
 
 cmd = 'uname -p'
@@ -104,14 +104,26 @@ BF_FFMPEG_LIBPATH='${BF_FFMPEG}/lib'
 BF_FFMPEG_LIB = 'avcodec avdevice avformat avutil mp3lame swscale x264 xvidcore theora theoradec theoraenc vorbis vorbisenc vorbisfile ogg bz2'
 #bz2 is a standard osx dynlib
 
-# python 3.1 uses precompiled libraries in bf svn /lib by default
 BF_PYTHON_VERSION = '3.2'
-BF_PYTHON = LIBDIR + '/python'
-BF_PYTHON_INC = '${BF_PYTHON}/include/python${BF_PYTHON_VERSION}'
-# BF_PYTHON_BINARY = '${BF_PYTHON}/bin/python${BF_PYTHON_VERSION}'
-BF_PYTHON_LIB = 'python${BF_PYTHON_VERSION}'
-BF_PYTHON_LIBPATH = '${BF_PYTHON}/lib/python${BF_PYTHON_VERSION}'
-# BF_PYTHON_LINKFLAGS = ['-u', '_PyMac_Error', '-framework', 'System']
+WITH_OSX_STATICPYTHON = True
+
+if WITH_OSX_STATICPYTHON:
+       # python 3.2 uses precompiled libraries in bf svn /lib by default
+
+       BF_PYTHON = LIBDIR + '/python'
+       BF_PYTHON_INC = '${BF_PYTHON}/include/python${BF_PYTHON_VERSION}'
+       # BF_PYTHON_BINARY = '${BF_PYTHON}/bin/python${BF_PYTHON_VERSION}'
+       BF_PYTHON_LIB = 'python${BF_PYTHON_VERSION}'
+       BF_PYTHON_LIBPATH = '${BF_PYTHON}/lib/python${BF_PYTHON_VERSION}'
+       # BF_PYTHON_LINKFLAGS = ['-u', '_PyMac_Error', '-framework', 'System']
+else:
+       # python 3.2 uses Python-framework additionally installed in /Library/Frameworks
+       
+       BF_PYTHON = '/Library/Frameworks/Python.framework/Versions/'
+       BF_PYTHON_INC = '${BF_PYTHON}${BF_PYTHON_VERSION}/include/python${BF_PYTHON_VERSION}m'
+       BF_PYTHON_BINARY = '${BF_PYTHON}${BF_PYTHON_VERSION}/bin/python${BF_PYTHON_VERSION}'
+       #BF_PYTHON_LIB = ''
+       BF_PYTHON_LIBPATH = '${BF_PYTHON}${BF_PYTHON_VERSION}/lib/python${BF_PYTHON_VERSION}/config-3.2m'
        
 WITH_BF_OPENAL = True
 #different lib must be used  following version of gcc
@@ -315,6 +327,10 @@ if WITH_BF_QUICKTIME:
        else:
                PLATFORM_LINKFLAGS = PLATFORM_LINKFLAGS+['-framework','QuickTime']
 
+if not WITH_OSX_STATICPYTHON:
+               PLATFORM_LINKFLAGS = PLATFORM_LINKFLAGS+['-framework','Python']
+
+
 #note to build succesfully on 10.3.9 SDK you need to patch  10.3.9 by adding the SystemStubs.a lib from 10.4
 #for 10.7.sdk, SystemStubs needs to be excluded (lib doesn't exist anymore)
 if MACOSX_DEPLOYMENT_TARGET == '10.7':
index 2f8fa297667d977ce05fec81d001aee5f6d23c66..2950ca9380f60f962965382a1e523f296edc33cc 100644 (file)
@@ -40,7 +40,7 @@ BF_JACK_INC = '${BF_JACK}/include ${BF_FFMPEG}/include/msvc'
 BF_JACK_LIB = 'libjack'
 BF_JACK_LIBPATH = '${BF_JACK}/lib'
 
-WITH_BF_SNDFILE = False
+WITH_BF_SNDFILE = True
 BF_SNDFILE = LIBDIR + '/sndfile'
 BF_SNDFILE_INC = '${BF_SNDFILE}/include'
 BF_SNDFILE_LIB = 'libsndfile-1'
index 94d09732be75f45c165f2c72eba9787fb5a4ed07..c537e435de8c3ae0bd6afd1c1139b1b42b54756b 100644 (file)
@@ -536,7 +536,10 @@ def AppIt(target=None, source=None, env=None):
     print("Installing to %s"%(installdir))
     # TODO, use tar.
     python_zip = 'python_' + osxarch + '.zip' # set specific python_arch.zip
-    print("unzipping to app-bundle: %s"%(python_zip))
+    if env['WITH_OSX_STATICPYTHON']:
+        print("unzipping to app-bundle: %s"%(python_zip))
+    else:
+        print("dynamic build - make sure to have python3.x-framework installed")
     bldroot = env.Dir('.').abspath
     binary = env['BINARYKIND']
      
@@ -569,10 +572,11 @@ def AppIt(target=None, source=None, env=None):
     commands.getoutput(cmd)
     cmd = 'cp %s/release/bin/%s/.Blanguages %s/%s.app/Contents/Resources/'%(bldroot,VERSION,installdir,binary)
     commands.getoutput(cmd)
-    cmd = 'mkdir %s/%s.app/Contents/MacOS/%s/python/'%(installdir,binary, VERSION)
-    commands.getoutput(cmd)
-    cmd = 'unzip -q %s/release/%s -d %s/%s.app/Contents/MacOS/%s/python/'%(libdir,python_zip,installdir,binary,VERSION)
-    commands.getoutput(cmd)
+    if env['WITH_OSX_STATICPYTHON']:
+        cmd = 'mkdir %s/%s.app/Contents/MacOS/%s/python/'%(installdir,binary, VERSION)
+        commands.getoutput(cmd)
+        cmd = 'unzip -q %s/release/%s -d %s/%s.app/Contents/MacOS/%s/python/'%(libdir,python_zip,installdir,binary,VERSION)
+        commands.getoutput(cmd) 
 
     if binary == 'blender':#not copy everything for blenderplayer
         cmd = 'cp -R %s/release/scripts %s/%s.app/Contents/MacOS/%s/'%(bldroot,installdir,binary,VERSION)
index d222c0bcc18a11f4410eb93ca3426a593a848fc6..be059241727a5f13bcf19d2aa0dc67a14cd7393a 100644 (file)
@@ -78,7 +78,7 @@ def print_arguments(args, bc):
 
 def validate_arguments(args, bc):
     opts_list = [
-            'WITH_BF_PYTHON', 'WITH_BF_PYTHON_SAFETY', 'BF_PYTHON', 'BF_PYTHON_VERSION', 'BF_PYTHON_INC', 'BF_PYTHON_BINARY', 'BF_PYTHON_LIB', 'BF_PYTHON_LIBPATH', 'WITH_BF_STATICPYTHON', 'BF_PYTHON_LIB_STATIC', 'BF_PYTHON_DLL', 'BF_PYTHON_ABI_FLAGS', 
+            'WITH_BF_PYTHON', 'WITH_BF_PYTHON_SAFETY', 'BF_PYTHON', 'BF_PYTHON_VERSION', 'BF_PYTHON_INC', 'BF_PYTHON_BINARY', 'BF_PYTHON_LIB', 'BF_PYTHON_LIBPATH', 'WITH_BF_STATICPYTHON', 'WITH_OSX_STATICPYTHON', 'BF_PYTHON_LIB_STATIC', 'BF_PYTHON_DLL', 'BF_PYTHON_ABI_FLAGS', 
             'WITH_BF_OPENAL', 'BF_OPENAL', 'BF_OPENAL_INC', 'BF_OPENAL_LIB', 'BF_OPENAL_LIBPATH', 'WITH_BF_STATICOPENAL', 'BF_OPENAL_LIB_STATIC',
             'WITH_BF_SDL', 'BF_SDL', 'BF_SDL_INC', 'BF_SDL_LIB', 'BF_SDL_LIBPATH',
             'BF_LIBSAMPLERATE', 'BF_LIBSAMPLERATE_INC', 'BF_LIBSAMPLERATE_LIB', 'BF_LIBSAMPLERATE_LIBPATH', 'WITH_BF_STATICLIBSAMPLERATE', 'BF_LIBSAMPLERATE_LIB_STATIC',
@@ -230,6 +230,7 @@ def read_opts(env, cfg, args):
         ('BF_PYTHON_LIBPATH', 'Library path', ''),
         ('BF_PYTHON_LINKFLAGS', 'Python link flags', ''),
         (BoolVariable('WITH_BF_STATICPYTHON', 'Staticly link to python', False)),
+        (BoolVariable('WITH_OSX_STATICPYTHON', 'Staticly link to python', True)),
         ('BF_PYTHON_ABI_FLAGS', 'Python ABI flags (suffix in library version: m, mu, etc)', ''),
 
         (BoolVariable('BF_NO_ELBEEM', 'Disable Fluid Sim', False)),
index 10514049a8a7efecb7f18f4dbcb54c7134c353c2..eeb50a833ffbd2577b8b141146041f3108450e72 100644 (file)
@@ -215,7 +215,19 @@ Functions
    :type setting: string (lights, shaders, shadows, ramps, nodes, extra_textures)
    :rtype: boolean
 
+.. function:: setAnisotropicFiltering(level)
 
+   Set the anisotropic filtering level for textures.
+   
+   :arg level: The new anisotropic filtering level to use
+   :type level: integer (must be one of 1, 2, 4, 8, 16)
+   
+.. function:: getAnisotropicFiltering()
+
+   Get the anisotropic filtering level used for textures.
+   
+   :rtype: integer (one of 1, 2, 4, 8, 16)
+   
 .. function:: drawLine(fromVec,toVec,color)
 
    Draw a line in the 3D scene.
index d1fc8593e42fd53cb529ee5d85fdc2fabf9d87ad..b1277df4c90d08d31858ec1ccfec003d9b2b0f23 100644 (file)
@@ -1539,62 +1539,66 @@ Game Types (bge.types)
       Return the value matching key, or the default value if its not found.
       :return: The key value or a default.
 
-   .. method:: playAction(name, start_frame, end_frame, layer=0, priority=0 blendin=0, play_mode=ACT_MODE_PLAY, layer_weight=0.0, ipo_flags=0, speed=1.0)
+   .. method:: playAction(name, start_frame, end_frame, layer=0, priority=0, blendin=0, play_mode=ACT_MODE_PLAY, layer_weight=0.0, ipo_flags=0, speed=1.0)
 
       Plays an action.
-         
+      
       :arg name: the name of the action
-         :type name: string
+      :type name: string
       :arg start: the start frame of the action
-         :type start: float
+      :type start: float
       :arg end: the end frame of the action
-         :type end: float
+      :type end: float
       :arg layer: the layer the action will play in (actions in different layers are added/blended together)
-         :type layer: integer
+      :type layer: integer
       :arg priority: only play this action if there isn't an action currently playing in this layer with a higher (lower number) priority
-         :type priority: integer
+      :type priority: integer
       :arg blendin: the amount of blending between this animation and the previous one on this layer
-         :type blendin: float
+      :type blendin: float
       :arg play_mode: the play mode
-         :type play_mode: KX_ACTION_PLAY, KX_ACTION_LOOP, or KX_ACTION_PING_PONG
+      :type play_mode: KX_ACTION_MODE_PLAY, KX_ACTION_MODE_LOOP, or KX_ACTION_MODE_PING_PONG
       :arg layer_weight: how much of the previous layer to use for blending (0 = add)
-         :type layer_weight: float
+      :type layer_weight: float
       :arg ipo_flags: flags for the old IPO behaviors (force, etc)
-         :type ipo_flags: int bitfield
+      :type ipo_flags: int bitfield
       :arg speed: the playback speed of the action as a factor (1.0 = normal speed, 2.0 = 2x speed, etc)
-         :type speed: float
+      :type speed: float
 
    .. method:: stopAction(layer=0)
       
-         Stop playing the action on the given layer.
-         
-         :arg layer: The layer to stop playing.
-         :type layer: integer
-         
+      Stop playing the action on the given layer.
+      
+      :arg layer: The layer to stop playing.
+      :type layer: integer
+      
    .. method:: getActionFrame(layer=0)
    
       Gets the current frame of the action playing in the supplied layer.
-         
-         :arg layer: The layer that you want to get the frame from.
-         :type layer: integer
-         
-         :return: The current frame of the action
-         
+      
+      :arg layer: The layer that you want to get the frame from.
+      :type layer: integer
+      
+      :return: The current frame of the action
+      :rtype: float
+      
    .. method:: setActionFrame(frame, layer=0)
    
       Set the current frame of the action playing in the supplied layer.
-         
-         :arg layer: The layer where you want to set the frame
-         :type layer: integer
-         :arg frame: The frame to set the action to
-         :type frame: float
+      
+      :arg layer: The layer where you want to set the frame
+      :type layer: integer
+      :arg frame: The frame to set the action to
+      :type frame: float
 
    .. method:: isPlayingAction(layer=0)
    
        Checks to see if there is an action playing in the given layer.
-          
-          :arg layer: The layer to check for a playing action.
-          :type layer: integer
+       
+       :arg layer: The layer to check for a playing action.
+       :type layer: integer
+       
+       :return: Whether or not the action is playing
+       :rtype: boolean
 
 .. class:: KX_IpoActuator(SCA_IActuator)
 
diff --git a/doc/python_api/rst/info_tips_and_tricks.rst b/doc/python_api/rst/info_tips_and_tricks.rst
new file mode 100644 (file)
index 0000000..bd5faf0
--- /dev/null
@@ -0,0 +1,57 @@
+###############
+Tips and Tricks
+###############
+
+Some of these are just python features that scripters may not have thaught to use with blender.
+
+
+****************
+Use The Terminal
+****************
+
+For Linux and OSX users this means starting the terminal first, then running blender from within it. on Windows the terminal can be enabled from the help menu.
+
+********************
+Run External Scripts
+********************
+
+
+******************
+Don't Use Blender!
+******************
+
+
+******************
+Use External Tools
+******************
+
+
+**************
+Bundled Python
+**************
+
+Blender from blender.org includes a compleate python installation on all platforms, this has the disadvantage that any extensions you have installed in you're systems python wont be found by blender.
+
+There are 2 ways around this:
+
+* remove blender python subdirectory, blender will then look for the systems python and use that instead **python version must match the one that blender comes with**.
+
+* copy the extensions into blender's python subdirectry so blender can access them, you could also copy the entire python installation into blenders subdirectory, replacing the one blender comes with. This works as long as the python versions match and the paths are created in the same location relative locations. Doing this has the advantage that you can redistribute this bundle to others with blender and/or the game player, including any extensions you rely on.
+
+********
+Advanced
+********
+
+
+===================
+Blender as a module
+===================
+
+
+============================
+Python Safety (Build Option)
+============================
+
+=================
+CTypes in Blender
+=================
index 19ebfc00d25959a9fa373d938e19b90d50a56c9f..59c69301a0202931b0eb020549e50a50ed188550 100644 (file)
@@ -1,3 +1,33 @@
+/*
+ * $Id$
+ *
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * Copyright 2009-2011 Jörg Hermann Müller
+ *
+ * This file is part of AudaSpace.
+ *
+ * Audaspace 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.
+ *
+ * AudaSpace 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 Audaspace; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+/** \file audaspace/intern/AUD_JOSResampleReaderCoeff.cpp
+ *  \ingroup audaspaceintern
+ */
+
 #include "AUD_JOSResampleReader.h"
 
 // sinc filter coefficients, Nz = 136, L = 2304, freq = 0.963904, Kaiser Window B = 16
index 496ad6992bc4e252da58d6324952ea3a5cfd3cd2..0413c488b5da38bc07a64d47f0b1bd87499143a3 100644 (file)
@@ -516,7 +516,7 @@ bool AUD_SoftwareDevice::AUD_SoftwareHandle::setVolumeMaximum(float volume)
 float AUD_SoftwareDevice::AUD_SoftwareHandle::getVolumeMinimum()
 {
        if(!m_status)
-               return std::numeric_limits<float>::quiet_NaN();;
+               return std::numeric_limits<float>::quiet_NaN();
 
        return m_volume_min;
 }
@@ -634,7 +634,7 @@ bool AUD_SoftwareDevice::AUD_SoftwareHandle::setConeAngleInner(float angle)
 float AUD_SoftwareDevice::AUD_SoftwareHandle::getConeVolumeOuter()
 {
        if(!m_status)
-               return std::numeric_limits<float>::quiet_NaN();;
+               return std::numeric_limits<float>::quiet_NaN();
 
        return m_cone_volume_outer;
 }
index 8873398a320352e1aacc19003dc983936fe0ba22..1aa043ebc8025c77db0bab758e279db23f844bdb 100644 (file)
@@ -70,7 +70,7 @@ GHOST_TSuccess GHOST_ISystemPaths::create()
 #              ifdef GHOST_COCOA
                        m_systemPaths = new GHOST_SystemPathsCocoa ();
 #              else
-                       m_systemPaths = new GHOST_SystemPathsarbon ();
+                       m_systemPaths = new GHOST_SystemPathsCarbon ();
 #              endif
 #      else 
                m_systemPaths = new GHOST_SystemPathsX11 ();
index dee66029d19eb643473ea4141ffad0f9ec7a4b34..053eb7d03e8f8392f4cf0e29808a9009bdcdca71 100644 (file)
@@ -39,7 +39,7 @@
 
 GHOST_TSuccess GHOST_CreateSystemPaths(void)
 {
-       return GHOST_ISystemPaths::create();;
+       return GHOST_ISystemPaths::create();
 }
 
 GHOST_TSuccess GHOST_DisposeSystemPaths(void)
index d5e5fbc7a587d42c0e81e50be29b899c53226198..e02e569cc6e758421ac51a0c17823db456bf8f15 100644 (file)
@@ -48,7 +48,9 @@
 #include "GHOST_EventButton.h"
 #include "GHOST_EventCursor.h"
 #include "GHOST_EventWheel.h"
+#ifdef WITH_INPUT_NDOF
 #include "GHOST_EventNDOF.h"
+#endif
 
 #include "GHOST_TimerManager.h"
 #include "GHOST_TimerTask.h"
@@ -1101,7 +1103,9 @@ OSStatus GHOST_SystemCarbon::sEventHandlerProc(EventHandlerCallRef handler, Even
        GHOST_SystemCarbon* sys = (GHOST_SystemCarbon*) userData;
     OSStatus err = eventNotHandledErr;
        GHOST_IWindow* window;
+#ifdef WITH_INPUT_NDOF
        GHOST_TEventNDOFData data;
+#endif
        UInt32 kind;
        
     switch (::GetEventClass(event))
@@ -1122,6 +1126,7 @@ OSStatus GHOST_SystemCarbon::sEventHandlerProc(EventHandlerCallRef handler, Even
                        err = sys->handleKeyEvent(event);
                        break;
                case kEventClassBlender :
+#ifdef WITH_INPUT_NDOF
                        window = sys->m_windowManager->getActiveWindow();
                        sys->m_ndofManager->GHOST_NDOFGetDatas(data);
                        kind = ::GetEventKind(event);
@@ -1137,6 +1142,7 @@ OSStatus GHOST_SystemCarbon::sEventHandlerProc(EventHandlerCallRef handler, Even
 //                                     printf("button\n");
                                        break;
                        }
+#endif
                        err = noErr;
                        break;
                default : 
index 0c8c0adf0413e46d1cf2737f32e63ca42349bcb8..d9a495ad0f4a817d6f8dc69393ec89b426b088ad 100644 (file)
@@ -866,6 +866,8 @@ GHOST_TSuccess GHOST_WindowWin32::installDrawingContext(GHOST_TDrawingContextTyp
                                {
 
                                        // Make sure we don't screw up the context
+                                       if (m_hGlRc == s_firsthGLRc)
+                                               s_firsthGLRc = NULL;
                                        m_drawingContextType = GHOST_kDrawingContextTypeOpenGL;
                                        removeDrawingContext();
 
index c5148e84ffed932d1dcfe6d142441504905461bc..48230db23a339f126839afe4ed0e6612806b473f 100644 (file)
@@ -88,7 +88,7 @@ typedef unsigned long uintptr_t;
 #define _UINTPTR_T_DEFINED
 #endif
 
-#elif defined(__linux__) || defined(__NetBSD__)
+#elif defined(__linux__) || defined(__NetBSD__) || defined(__OpenBSD__)
 
        /* Linux-i386, Linux-Alpha, Linux-ppc */
 #include <stdint.h>
index df4fbc8fadd5b922dd4e3dcd2522eb5e444c8b04..ba4fbb8854260e7b6861c26998020b579dab14ab 100644 (file)
@@ -319,7 +319,7 @@ void IK_QSegment::RemoveChild(IK_QSegment *child)
        else {
                IK_QSegment *seg = m_child;
 
-               while (seg->m_sibling != child);
+               while (seg->m_sibling != child)
                        seg = seg->m_sibling;
 
                if (child == seg->m_sibling)
index 2cd9cab453d684969c01fef85baf00813c224770..c154b4c50acf554b97879e2c691cfa16d0abc5ff 100644 (file)
@@ -89,7 +89,7 @@ typedef unsigned long uintptr_t;
 #define _UINTPTR_T_DEFINED
 #endif
 
-#elif defined(__linux__) || defined(__NetBSD__)
+#elif defined(__linux__) || defined(__NetBSD__) || defined(__OpenBSD__)
 
        /* Linux-i386, Linux-Alpha, Linux-ppc */
 #include <stdint.h>
index e17064178b8645aa744f5016c8ad7db29be5ca34..463ba84470f9445635d90bc41e11d4a8fce58b38 100644 (file)
@@ -185,9 +185,13 @@ class DATA_PT_pose_library(ArmatureButtonsPanel, Panel):
         layout.template_ID(ob, "pose_library", new="poselib.new", unlink="poselib.unlink")
 
         if poselib:
+            
+            # list of poses in pose library 
             row = layout.row()
             row.template_list(poselib, "pose_markers", poselib.pose_markers, "active_index", rows=5)
-
+            
+            # column of operators for active pose
+            # - goes beside list
             col = row.column(align=True)
             col.active = (poselib.library is None)
 
@@ -202,8 +206,12 @@ class DATA_PT_pose_library(ArmatureButtonsPanel, Panel):
             if pose_marker_active is not None:
                 col.operator("poselib.pose_remove", icon='ZOOMOUT', text="").pose = pose_marker_active.name
                 col.operator("poselib.apply_pose", icon='ZOOM_SELECTED', text="").pose_index = poselib.pose_markers.active_index
-
-            layout.operator("poselib.action_sanitise")
+            
+            col.operator("poselib.action_sanitise", icon='HELP', text="") # XXX: put in menu?
+            
+            # properties for active marker
+            if pose_marker_active is not None:
+                layout.prop(pose_marker_active, "name")
 
 
 # TODO: this panel will soon be depreceated too
index e3c576e70934be24c9fa7df26aceef3c9d969c07..161e4b10cff86ca8e186a078fb2a0bb9c39c9c21 100644 (file)
@@ -340,10 +340,12 @@ class RENDER_PT_game_performance(RenderButtonsPanel, Panel):
         layout = self.layout
 
         gs = context.scene.game_settings
-        row = layout.row()
+        col = layout.column()
+        row = col.row()
         row.prop(gs, "use_frame_rate")
         row.prop(gs, "use_display_lists")
-        row.prop(gs, "restrict_animation_updates")
+        
+        col.prop(gs, "restrict_animation_updates")
 
 
 class RENDER_PT_game_display(RenderButtonsPanel, Panel):
index 708b3708ab7fbcd12b20779324098d98f95cd3f9..fb6505fe935f28112a62159e54c79587e427c13d 100644 (file)
@@ -213,7 +213,7 @@ void blf_font_buffer(FontBLF *font, const char *str)
 {
        unsigned char *cbuf;
        unsigned int c;
-       unsigned char b_col_char[3];
+       unsigned char b_col_char[4];
        GlyphBLF *g, *g_prev;
        FT_Vector delta;
        FT_UInt glyph_index;
@@ -232,6 +232,7 @@ void blf_font_buffer(FontBLF *font, const char *str)
        b_col_char[0]= font->b_col[0] * 255;
        b_col_char[1]= font->b_col[1] * 255;
        b_col_char[2]= font->b_col[2] * 255;
+       b_col_char[3]= font->b_col[3] * 255;
 
        while (str[i]) {
                int pen_y;
@@ -296,16 +297,19 @@ void blf_font_buffer(FontBLF *font, const char *str)
                                                a= *(g->bitmap + x + (yb * g->pitch)) / 255.0f;
 
                                                if(a > 0.0f) {
+                                                       float alphatest;
                                                        fbuf= font->b_fbuf + font->bch * ((chx + x) + ((pen_y + y)*font->bw));
                                                        if (a >= 1.0f) {
                                                                fbuf[0]= font->b_col[0];
                                                                fbuf[1]= font->b_col[1];
                                                                fbuf[2]= font->b_col[2];
+                                                               fbuf[3]= (alphatest= (fbuf[3] + (font->b_col[3]))) < 1.0f ? alphatest : 1.0f;
                                                        }
                                                        else {
                                                                fbuf[0]= (font->b_col[0]*a) + (fbuf[0] * (1-a));
                                                                fbuf[1]= (font->b_col[1]*a) + (fbuf[1] * (1-a));
                                                                fbuf[2]= (font->b_col[2]*a) + (fbuf[2] * (1-a));
+                                                               fbuf[3]= (alphatest= (fbuf[3] + (font->b_col[3]*a))) < 1.0f ? alphatest : 1.0f;
                                                        }
                                                }
                                        }
@@ -324,16 +328,19 @@ void blf_font_buffer(FontBLF *font, const char *str)
                                                a= *(g->bitmap + x + (yb * g->pitch)) / 255.0f;
 
                                                if(a > 0.0f) {
+                                                       int alphatest;
                                                        cbuf= font->b_cbuf + font->bch * ((chx + x) + ((pen_y + y)*font->bw));
                                                        if (a >= 1.0f) {
                                                                cbuf[0]= b_col_char[0];
                                                                cbuf[1]= b_col_char[1];
                                                                cbuf[2]= b_col_char[2];
+                                                               cbuf[3]= (alphatest= ((int)cbuf[3] + (int)b_col_char[3])) < 255 ? alphatest : 255;
                                                        }
                                                        else {
                                                                cbuf[0]= (b_col_char[0]*a) + (cbuf[0] * (1-a));
                                                                cbuf[1]= (b_col_char[1]*a) + (cbuf[1] * (1-a));
                                                                cbuf[2]= (b_col_char[2]*a) + (cbuf[2] * (1-a));
+                                                               cbuf[3]= (alphatest= ((int)cbuf[3] + (int)((font->b_col[3]*a)*255.0f))) < 255 ? alphatest : 255;
                                                        }
                                                }
                                        }
index e2a1b0dfb33e1277b3c10ae913ea75d57dd18bf4..ed073f032709545e317f8ef29c96c54591fd665d 100644 (file)
@@ -1091,7 +1091,7 @@ static int cloth_collision_response_moving ( ClothModifierData *clmd, CollisionM
                                
                                VECADDMUL(cloth1->verts[collpair->ap1].impulse, pimpulse, w1*2.0);
                                VECADDMUL(cloth1->verts[collpair->ap2].impulse, pimpulse, w2*2.0);
-                               VECADDMUL(cloth1->verts[collpair->ap3].impulse, pimpulse, w3*2.0);;
+                               VECADDMUL(cloth1->verts[collpair->ap3].impulse, pimpulse, w3*2.0);
                                cloth1->verts[collpair->ap1].impulse_count++;
                                cloth1->verts[collpair->ap2].impulse_count++;
                                cloth1->verts[collpair->ap3].impulse_count++;
@@ -1487,8 +1487,8 @@ static CollPair* cloth_collision ( ModifierData *md1, ModifierData *md2,
                
                sdis = clmd->coll_parms->distance_repel + epsilon2 + FLT_EPSILON;
                
-               /*apply a repulsion force, to help the solver along.
-          this is kindof crude, it only tests one vert of the triangle*/
+               /* apply a repulsion force, to help the solver along.
+                * this is kindof crude, it only tests one vert of the triangle */
                if (isect_ray_plane_v3(cloth->verts[collpair->ap1].tx, n2, collmd->current_xnew[collpair->bp1].co, 
                        collmd->current_xnew[collpair->bp2].co,
                        collmd->current_xnew[collpair->bp3].co, &l, 0))
index 8d19322c0db5b7355df04251fc6ef11fdbef3aaf..c342bbc917f5b96ee850515d949fa3f422404057 100644 (file)
@@ -808,41 +808,65 @@ static void layerDefault_mcol(void *data, int count)
 
 
 static const LayerTypeInfo LAYERTYPEINFO[CD_NUMTYPES] = {
+       /* 0: CD_MVERT */
        {sizeof(MVert), "MVert", 1, NULL, NULL, NULL, NULL, NULL, NULL},
+       /* 1: CD_MSTICKY */
        {sizeof(MSticky), "MSticky", 1, NULL, NULL, NULL, layerInterp_msticky, NULL,
         NULL},
+       /* 2: CD_MDEFORMVERT */
        {sizeof(MDeformVert), "MDeformVert", 1, NULL, layerCopy_mdeformvert,
         layerFree_mdeformvert, layerInterp_mdeformvert, NULL, NULL},
+       /* 3: CD_MEDGE */
        {sizeof(MEdge), "MEdge", 1, NULL, NULL, NULL, NULL, NULL, NULL},
+       /* 4: CD_MFACE */
        {sizeof(MFace), "MFace", 1, NULL, NULL, NULL, NULL, NULL, NULL},
+       /* 5: CD_MTFACE */
        {sizeof(MTFace), "MTFace", 1, "UVTex", layerCopy_tface, NULL,
         layerInterp_tface, layerSwap_tface, layerDefault_tface},
+       /* 6: CD_MCOL */
        /* 4 MCol structs per face */
        {sizeof(MCol)*4, "MCol", 4, "Col", NULL, NULL, layerInterp_mcol,
         layerSwap_mcol, layerDefault_mcol},
+       /* 7: CD_ORIGINDEX */
        {sizeof(int), "", 0, NULL, NULL, NULL, NULL, NULL, NULL},
+       /* 8: CD_NORMAL */
        /* 3 floats per normal vector */
        {sizeof(float)*3, "", 0, NULL, NULL, NULL, NULL, NULL, NULL},
+       /* 9: CD_FLAGS */
        {sizeof(int), "", 0, NULL, NULL, NULL, NULL, NULL, NULL},
+       /* 10: CD_PROP_FLT */
        {sizeof(MFloatProperty), "MFloatProperty",1,"Float",NULL,NULL,NULL,NULL},
+       /* 11: CD_PROP_INT */
        {sizeof(MIntProperty), "MIntProperty",1,"Int",NULL,NULL,NULL,NULL},
+       /* 12: CD_PROP_STR */
        {sizeof(MStringProperty), "MStringProperty",1,"String",NULL,NULL,NULL,NULL},
+       /* 13: CD_ORIGSPACE */
        {sizeof(OrigSpaceFace), "OrigSpaceFace", 1, "UVTex", layerCopy_origspace_face, NULL,
         layerInterp_origspace_face, layerSwap_origspace_face, layerDefault_origspace_face},
+       /* 14: CD_ORCO */
        {sizeof(float)*3, "", 0, NULL, NULL, NULL, NULL, NULL, NULL},
+       /* 15: CD_MTEXPOLY */
        {sizeof(MTexPoly), "MTexPoly", 1, "Face Texture", NULL, NULL, NULL, NULL, NULL},
+       /* 16: CD_MLOOPUV */
        {sizeof(MLoopUV), "MLoopUV", 1, "UV coord", NULL, NULL, layerInterp_mloopuv, NULL, NULL},
+       /* 17: CD_MLOOPCOL */
        {sizeof(MLoopCol), "MLoopCol", 1, "Col", NULL, NULL, layerInterp_mloopcol, NULL, layerDefault_mloopcol},
+       /* 18: CD_TANGENT */
        {sizeof(float)*4*4, "", 0, NULL, NULL, NULL, NULL, NULL, NULL},
+       /* 19: CD_MDISPS */
        {sizeof(MDisps), "MDisps", 1, NULL, layerCopy_mdisps,
         layerFree_mdisps, layerInterp_mdisps, layerSwap_mdisps, NULL, layerRead_mdisps, layerWrite_mdisps,
         layerFilesize_mdisps, layerValidate_mdisps},
+       /* 20: CD_WEIGHT_MCOL */
        {sizeof(MCol)*4, "MCol", 4, "WeightCol", NULL, NULL, layerInterp_mcol,
         layerSwap_mcol, layerDefault_mcol},
-        {sizeof(MCol)*4, "MCol", 4, "IDCol", NULL, NULL, layerInterp_mcol,
+       /* 21: CD_ID_MCOL */
+       {sizeof(MCol)*4, "MCol", 4, "IDCol", NULL, NULL, layerInterp_mcol,
         layerSwap_mcol, layerDefault_mcol},
-        {sizeof(MCol)*4, "MCol", 4, "TexturedCol", NULL, NULL, layerInterp_mcol,
+       /* 22: CD_TEXTURE_MCOL */
+       {sizeof(MCol)*4, "MCol", 4, "TexturedCol", NULL, NULL, layerInterp_mcol,
         layerSwap_mcol, layerDefault_mcol},
+       /* 23: CD_CLOTH_ORCO */
        {sizeof(float)*3, "", 0, NULL, NULL, NULL, NULL, NULL, NULL}
 };
 
index 9c916d517c587fb8a9824384d5da9ccdc2c930f7..70398594872d122647fa8a30fca17eeb9adb3044 100644 (file)
@@ -166,7 +166,7 @@ int BKE_mesh_validate_arrays(Mesh *me, MVert *UNUSED(mverts), unsigned int totve
                }
 
                if(BLI_edgehash_haskey(edge_hash, med->v1, med->v2)) {
-                       PRINT("    edge %u: is a duplicate of, %u\n", i, GET_INT_FROM_POINTER(BLI_edgehash_lookup(edge_hash, med->v1, med->v2)));
+                       PRINT("    edge %u: is a duplicate of, %d\n", i, GET_INT_FROM_POINTER(BLI_edgehash_lookup(edge_hash, med->v1, med->v2)));
                        remove= do_fixes;
                }
 
index 25f824bba19dce5ca4996a2bc5b84ecc4b10d9b0..6ce80342dd6de9aa31c4546e29e903e9e756e40e 100644 (file)
@@ -359,6 +359,9 @@ NlaStrip *add_nla_soundstrip (Scene *scene, Speaker *speaker)
 #endif
        {
                strip->end = 10.0f;
+               /* quiet compiler warnings */
+               (void)scene;
+               (void)speaker;
        }
        
        /* general settings */
index cdb509ab8e121075e4553e19f282011643fd14ab..74f4830b86c5cb777a24b26aa606306449a1de52 100644 (file)
 #include "BKE_sequencer.h"
 #include "BKE_scene.h"
 
+#ifdef WITH_AUDASPACE
 // evil global ;-)
 static int sound_cfra;
+#endif
 
 struct bSound* sound_new_file(struct Main *bmain, const char *filename)
 {
@@ -760,5 +762,17 @@ void sound_seek_scene(struct bContext *UNUSED(C)) {}
 float sound_sync_scene(struct Scene *UNUSED(scene)) { return 0.0f; }
 int sound_scene_playing(struct Scene *UNUSED(scene)) { return -1; }
 int sound_read_sound_buffer(struct bSound* UNUSED(sound), float* UNUSED(buffer), int UNUSED(length), float UNUSED(start), float UNUSED(end)) { return 0; }
+void sound_read_waveform(struct bSound* sound) { (void)sound; }
+void sound_init_main(struct Main *bmain) { (void)bmain; }
+void sound_set_cfra(int cfra) { (void)cfra; }
+void sound_update_sequencer(struct Main* main, struct bSound* sound) { (void)main; (void)sound; }
+void sound_update_scene(struct Scene* scene) { (void)scene; }
+void sound_update_scene_sound(void* handle, struct bSound* sound) { (void)handle; (void)sound; }
+void sound_update_scene_listener(struct Scene *scene) { (void)scene; }
+void sound_update_fps(struct Scene *scene) { (void)scene; }
+void sound_set_scene_sound_volume(void* handle, float volume, char animated) { (void)handle; (void)volume; (void)animated; }
+void sound_set_scene_sound_pan(void* handle, float pan, char animated) { (void)handle; (void)pan; (void)animated; }
+void sound_set_scene_volume(struct Scene *scene, float volume) { (void)scene; (void)volume; }
+void sound_set_scene_sound_pitch(void* handle, float pitch, char animated) { (void)handle; (void)pitch; (void)animated; }
 
 #endif // WITH_AUDASPACE
index 1735848e774c5bcfeadec66875f4368840daf979..f20cef9c3ea0a8d3989fe0cd0886ba8373045062 100644 (file)
@@ -42,6 +42,7 @@ struct ID;
 typedef enum {
        BLI_CB_EVT_RENDER_PRE,
        BLI_CB_EVT_RENDER_POST,
+       BLI_CB_EVT_RENDER_STATS,
        BLI_CB_EVT_LOAD_PRE,
        BLI_CB_EVT_LOAD_POST,
        BLI_CB_EVT_SAVE_PRE,
index 5b5de3ab3b61649b0a4653d37834665dd0d6aa07..8f025880a86ab8febb308cad48ae124c4e591197 100644 (file)
@@ -1968,7 +1968,7 @@ void resolve_tri_uv(float uv[2], const float st[2], const float st0[2], const fl
 void resolve_quad_uv(float uv[2], const float st[2], const float st0[2], const float st1[2], const float st2[2], const float st3[2])
 {
        const double signed_area= (st0[0]*st1[1] - st0[1]*st1[0]) + (st1[0]*st2[1] - st1[1]*st2[0]) +
-                              (st2[0]*st3[1] - st2[1]*st3[0]) + (st3[0]*st0[1] - st3[1]*st0[0]);
+                                 (st2[0]*st3[1] - st2[1]*st3[0]) + (st3[0]*st0[1] - st3[1]*st0[0]);
 
        /* X is 2D cross product (determinant)
           A= (p0-p) X (p0-p3)*/
index 5edf6e28d4c50d03614cd7041202d07ec8e1b0a8..3c79a77707ae67992becb9bfe555024b9f9dbbb3 100644 (file)
@@ -820,7 +820,7 @@ void normalize_m4_m4(float rmat[][4], float mat[][4])
        len= normalize_v3_v3(rmat[1], mat[1]);
        if(len!=0.0f) rmat[1][3]= mat[1][3] / len;
        len= normalize_v3_v3(rmat[2], mat[2]);
-       if(len!=0.0f) rmat[2][3]= mat[2][3] / len;;
+       if(len!=0.0f) rmat[2][3]= mat[2][3] / len;
 }
 
 void adjoint_m3_m3(float m1[][3], float m[][3])
index d56723ec1c54939e98de4a7f98046797a2991c6c..2114fc34bf16ff8fe9ecb5ec2784afeb15ba41a2 100644 (file)
@@ -83,7 +83,7 @@ typedef unsigned long uintptr_t;
 #define _UINTPTR_T_DEFINED
 #endif
 
-#elif defined(__linux__) || defined(__NetBSD__)
+#elif defined(__linux__) || defined(__NetBSD__) || defined(__OpenBSD__)
 
        /* Linux-i386, Linux-Alpha, Linux-ppc */
 #include <stdint.h>
index 77cdf889ea55159443bc0de57ada7863b258083b..d29853f7d157abe4c3f3ee5c7817d0e65e26618b 100644 (file)
@@ -115,7 +115,7 @@ LIBIMPORT void IMB_rectcpy(struct ImBuf *dbuf, struct ImBuf *sbuf,
 
 LIBIMPORT void IMB_rectfill(struct ImBuf *drect, const float col[4]);
 LIBIMPORT void IMB_rectfill_area(struct ImBuf *ibuf, float *col, int x1, int y1, int x2, int y2);
-LIBIMPORT void buf_rectfill_area(unsigned char *rect, float *rectf, int width, int height, float *col, int x1, int y1, int x2, int y2);
+LIBIMPORT void buf_rectfill_area(unsigned char *rect, float *rectf, int width, int height, const float col[4], int x1, int y1, int x2, int y2);
 LIBIMPORT void IMB_rectfill_alpha(struct ImBuf *drect, const float value);
 
 #endif /* IFF_H */
index 8a0a39da5580dd91c8a67c04d70eb4f24fa58846..4c20d1cf6c18ded7308281f6faad6a5e524a9369 100644 (file)
@@ -1,26 +1,26 @@
 /*
- * $Id$
- *
- * ***** 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Contributor(s): Chingiz Dyussenov, Arystanbek Dyussenov, Jan Diederich, Tod Liverseed.
- *
- * ***** END GPL LICENSE BLOCK *****
- */
+* $Id$
+*
+* ***** 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+*
+* Contributor(s): Chingiz Dyussenov, Arystanbek Dyussenov, Jan Diederich, Tod Liverseed.
+*
+* ***** END GPL LICENSE BLOCK *****
+*/
 
 #include "GeometryExporter.h"
 #include "AnimationExporter.h"
@@ -30,10 +30,10 @@ template<class Functor>
 void forEachObjectInScene(Scene *sce, Functor &f)
 {
        Base *base= (Base*) sce->base.first;
-       
+
        while(base) {
                Object *ob = base->object;
-                       
+
                f(ob);
 
                base= base->next;
@@ -61,7 +61,7 @@ void AnimationExporter::operator() (Object *ob)
        bool isMatAnim = false;
 
        //Export transform animations
-       if(ob->adt && ob->adt->action)      
+       if(ob->adt && ob->adt->action)
        {
                fcu = (FCurve*)ob->adt->action->curves.first;
 
@@ -72,21 +72,21 @@ void AnimationExporter::operator() (Object *ob)
                        for (Bone *bone = (Bone*)arm->bonebase.first; bone; bone = bone->next)
                                write_bone_animation_matrix(ob, bone);
                }
-               
+
                while (fcu) {
                        //for armature animations as objects
                        if ( ob->type == OB_ARMATURE )
                                transformName =  fcu->rna_path;
                        else 
                                transformName = extract_transform_name( fcu->rna_path );
-               
+
                        if ((!strcmp(transformName, "location") || !strcmp(transformName, "scale")) ||
                                (!strcmp(transformName, "rotation_euler") && ob->rotmode == ROT_MODE_EUL)||
                                (!strcmp(transformName, "rotation_quaternion"))) 
                                dae_animation(ob ,fcu, transformName, false);
                        fcu = fcu->next;
                }
-       
+
        }
 
        //Export Lamp parameter animations
@@ -94,8 +94,8 @@ void AnimationExporter::operator() (Object *ob)
        {
                fcu = (FCurve*)(((Lamp*)ob ->data)->adt->action->curves.first);
                while (fcu) {
-               transformName = extract_transform_name( fcu->rna_path );
-                       
+                       transformName = extract_transform_name( fcu->rna_path );
+
                        if ((!strcmp(transformName, "color")) || (!strcmp(transformName, "spot_size"))|| (!strcmp(transformName, "spot_blend"))||
                                (!strcmp(transformName, "distance")) ) 
                                dae_animation(ob , fcu, transformName, true );
@@ -108,8 +108,8 @@ void AnimationExporter::operator() (Object *ob)
        {               
                fcu = (FCurve*)(((Camera*)ob ->data)->adt->action->curves.first);
                while (fcu) {
-               transformName = extract_transform_name( fcu->rna_path );
-                       
+                       transformName = extract_transform_name( fcu->rna_path );
+
                        if ((!strcmp(transformName, "lens"))||
                                (!strcmp(transformName, "ortho_scale"))||
                                (!strcmp(transformName, "clip_end"))||(!strcmp(transformName, "clip_start"))) 
@@ -129,7 +129,7 @@ void AnimationExporter::operator() (Object *ob)
                        fcu = (FCurve*)ma->adt->action->curves.first;
                        while (fcu) {
                                transformName = extract_transform_name( fcu->rna_path );
-                               
+
                                if ((!strcmp(transformName, "specular_hardness"))||(!strcmp(transformName, "specular_color"))
                                        ||(!strcmp(transformName, "diffuse_color"))||(!strcmp(transformName, "alpha"))||
                                        (!strcmp(transformName, "ior"))) 
@@ -137,384 +137,384 @@ void AnimationExporter::operator() (Object *ob)
                                fcu = fcu->next;
                        }
                }
-               
+
        }
 }
 
-       //euler sources from quternion sources
-       float * AnimationExporter::get_eul_source_for_quat(Object *ob )
+//euler sources from quternion sources
+float * AnimationExporter::get_eul_source_for_quat(Object *ob )
+{
+       FCurve *fcu = (FCurve*)ob->adt->action->curves.first;
+       const int keys = fcu->totvert;  
+       float *quat = (float*)MEM_callocN(sizeof(float) * fcu->totvert * 4, "quat output source values");  
+       float *eul = (float*)MEM_callocN(sizeof(float) * fcu->totvert * 3, "quat output source values");
+       float temp_quat[4];
+       float temp_eul[3];
+       while(fcu)
        {
-               FCurve *fcu = (FCurve*)ob->adt->action->curves.first;
-               const int keys = fcu->totvert;  
-               float *quat = (float*)MEM_callocN(sizeof(float) * fcu->totvert * 4, "quat output source values");  
-               float *eul = (float*)MEM_callocN(sizeof(float) * fcu->totvert * 3, "quat output source values");
-               float temp_quat[4];
-               float temp_eul[3];
-                       while(fcu)
-                       {
-                               char * transformName = extract_transform_name( fcu->rna_path );
-                               
-                               if( !strcmp(transformName, "rotation_quaternion") )     { 
-                                       for ( int i = 0 ; i < fcu->totvert ; i++){
-                                               *(quat + ( i * 4 ) + fcu->array_index) = fcu->bezt[i].vec[1][1];
-                                       }
-                               }
-                                       fcu = fcu->next;
+               char * transformName = extract_transform_name( fcu->rna_path );
+
+               if( !strcmp(transformName, "rotation_quaternion") )     { 
+                       for ( int i = 0 ; i < fcu->totvert ; i++){
+                               *(quat + ( i * 4 ) + fcu->array_index) = fcu->bezt[i].vec[1][1];
                        }
+               }
+               fcu = fcu->next;
+       }
 
-                       for ( int i = 0 ; i < keys ; i++){
-                               for ( int j = 0;j<4;j++)
-                                       temp_quat[j] = quat[(i*4)+j];
+       for ( int i = 0 ; i < keys ; i++){
+               for ( int j = 0;j<4;j++)
+                       temp_quat[j] = quat[(i*4)+j];
 
-                               quat_to_eul(temp_eul,temp_quat);
+               quat_to_eul(temp_eul,temp_quat);
 
-                               for (int k = 0;k<3;k++)
-                                       eul[i*3 + k] = temp_eul[k];
-
-                       }
-        MEM_freeN(quat);
-               return eul;
+               for (int k = 0;k<3;k++)
+                       eul[i*3 + k] = temp_eul[k];
 
        }
+       MEM_freeN(quat);
+       return eul;
+
+}
+
+//Get proper name for bones
+std::string AnimationExporter::getObjectBoneName( Object* ob,const FCurve* fcu ) 
+{
+       //hard-way to derive the bone name from rna_path. Must find more compact method
+       std::string rna_path = std::string(fcu->rna_path);
 
-       //Get proper name for bones
-       std::string AnimationExporter::getObjectBoneName( Object* ob,const FCurve* fcu ) 
+       char* boneName = strtok((char *)rna_path.c_str(), "\"");
+       boneName = strtok(NULL,"\"");
+
+       if( boneName != NULL )
+               return /*id_name(ob) + "_" +*/ std::string(boneName);
+       else            
+               return id_name(ob);
+}
+
+//convert f-curves to animation curves and write
+void AnimationExporter::dae_animation(Object* ob, FCurve *fcu, char* transformName , bool is_param, Material * ma )
+{
+       const char *axis_name = NULL;
+       char anim_id[200];
+
+       bool has_tangents = false;
+       bool quatRotation = false;
+
+       if ( !strcmp(transformName, "rotation_quaternion") )
        {
-               //hard-way to derive the bone name from rna_path. Must find more compact method
-               std::string rna_path = std::string(fcu->rna_path);
-
-               char* boneName = strtok((char *)rna_path.c_str(), "\"");
-               boneName = strtok(NULL,"\"");
-               
-               if( boneName != NULL )
-                       return /*id_name(ob) + "_" +*/ std::string(boneName);
-               else            
-                       return id_name(ob);
+               fprintf(stderr, "quaternion rotation curves are not supported. rotation curve will not be exported\n");
+               quatRotation = true;
+               return;
        }
 
-       //convert f-curves to animation curves and write
-       void AnimationExporter::dae_animation(Object* ob, FCurve *fcu, char* transformName , bool is_param, Material * ma )
+       //axis names for colors
+       else if ( !strcmp(transformName, "color")||!strcmp(transformName, "specular_color")||!strcmp(transformName, "diffuse_color")||
+               (!strcmp(transformName, "alpha")))
        {
-               const char *axis_name = NULL;
-               char anim_id[200];
-               
-               bool has_tangents = false;
-               bool quatRotation = false;
-               
-               if ( !strcmp(transformName, "rotation_quaternion") )
-               {
-                       fprintf(stderr, "quaternion rotation curves are not supported. rotation curve will not be exported\n");
-                       quatRotation = true;
-                       return;
-               }
-               
-               //axis names for colors
-               else if ( !strcmp(transformName, "color")||!strcmp(transformName, "specular_color")||!strcmp(transformName, "diffuse_color")||
-                                 (!strcmp(transformName, "alpha")))
-               {
-                       const char *axis_names[] = {"R", "G", "B"};
-                       if (fcu->array_index < 3)
+               const char *axis_names[] = {"R", "G", "B"};
+               if (fcu->array_index < 3)
                        axis_name = axis_names[fcu->array_index];
-               }
+       }
 
-               //axis names for transforms
-               else if ((!strcmp(transformName, "location") || !strcmp(transformName, "scale")) ||
-                               (!strcmp(transformName, "rotation_euler"))||(!strcmp(transformName, "rotation_quaternion")))
-               {
-                       const char *axis_names[] = {"X", "Y", "Z"};
-                       if (fcu->array_index < 3)
+       //axis names for transforms
+       else if ((!strcmp(transformName, "location") || !strcmp(transformName, "scale")) ||
+               (!strcmp(transformName, "rotation_euler"))||(!strcmp(transformName, "rotation_quaternion")))
+       {
+               const char *axis_names[] = {"X", "Y", "Z"};
+               if (fcu->array_index < 3)
                        axis_name = axis_names[fcu->array_index];
-               }
+       }
 
-               //no axis name. single parameter.
-               else{
-                       axis_name = "";
-               }
-               
-               std::string ob_name = std::string("null");
-
-               //Create anim Id
-               if (ob->type == OB_ARMATURE) 
-               {   
-                       ob_name =  getObjectBoneName( ob , fcu);
-                       BLI_snprintf(anim_id, sizeof(anim_id), "%s_%s.%s", (char*)translate_id(ob_name).c_str(),
-                               transformName, axis_name);
-               }
-               else 
-               {
-                       if (ma)
-                               ob_name = id_name(ob) + "_material";
-                       else
-                               ob_name = id_name(ob);
-                       BLI_snprintf(anim_id, sizeof(anim_id), "%s_%s_%s", (char*)translate_id(ob_name).c_str(),
-                                fcu->rna_path, axis_name);
-               }
-               
-               openAnimation(anim_id, COLLADABU::Utils::EMPTY_STRING);
+       //no axis name. single parameter.
+       else{
+               axis_name = "";
+       }
 
-               // create input source
-               std::string input_id = create_source_from_fcurve(COLLADASW::InputSemantic::INPUT, fcu, anim_id, axis_name);
+       std::string ob_name = std::string("null");
 
-               // create output source
-               std::string output_id ;
-               
-               //quat rotations are skipped for now, because of complications with determining axis.
-               if(quatRotation) 
-               {
-                       float * eul  = get_eul_source_for_quat(ob);
-                       float * eul_axis = (float*)MEM_callocN(sizeof(float) * fcu->totvert, "quat output source values");
-                               for ( int i = 0 ; i< fcu->totvert ; i++)
-                                       eul_axis[i] = eul[i*3 + fcu->array_index];
-                       output_id= create_source_from_array(COLLADASW::InputSemantic::OUTPUT, eul_axis , fcu->totvert, quatRotation, anim_id, axis_name);
-                       MEM_freeN(eul);
-                       MEM_freeN(eul_axis);
-               }
-               else 
-               {
-                       output_id= create_source_from_fcurve(COLLADASW::InputSemantic::OUTPUT, fcu, anim_id, axis_name);
-               }
-               // create interpolations source
-               std::string interpolation_id = create_interpolation_source(fcu, anim_id, axis_name, &has_tangents);
-
-               // handle tangents (if required)
-               std::string intangent_id;
-               std::string outtangent_id;
-               
-               if (has_tangents) {
-                       // create in_tangent source
-                       intangent_id = create_source_from_fcurve(COLLADASW::InputSemantic::IN_TANGENT, fcu, anim_id, axis_name);
-
-                       // create out_tangent source
-                       outtangent_id = create_source_from_fcurve(COLLADASW::InputSemantic::OUT_TANGENT, fcu, anim_id, axis_name);
-               }
+       //Create anim Id
+       if (ob->type == OB_ARMATURE) 
+       {   
+               ob_name =  getObjectBoneName( ob , fcu);
+               BLI_snprintf(anim_id, sizeof(anim_id), "%s_%s.%s", (char*)translate_id(ob_name).c_str(),
+                       transformName, axis_name);
+       }
+       else 
+       {
+               if (ma)
+                       ob_name = id_name(ob) + "_material";
+               else
+                       ob_name = id_name(ob);
+               BLI_snprintf(anim_id, sizeof(anim_id), "%s_%s_%s", (char*)translate_id(ob_name).c_str(),
+                       fcu->rna_path, axis_name);
+       }
 
-               std::string sampler_id = std::string(anim_id) + SAMPLER_ID_SUFFIX;
-               COLLADASW::LibraryAnimations::Sampler sampler(sw, sampler_id);
-               std::string empty;
-               sampler.addInput(COLLADASW::InputSemantic::INPUT, COLLADABU::URI(empty, input_id));
-               sampler.addInput(COLLADASW::InputSemantic::OUTPUT, COLLADABU::URI(empty, output_id));
+       openAnimation(anim_id, COLLADABU::Utils::EMPTY_STRING);
 
-               // this input is required
-               sampler.addInput(COLLADASW::InputSemantic::INTERPOLATION, COLLADABU::URI(empty, interpolation_id));
+       // create input source
+       std::string input_id = create_source_from_fcurve(COLLADASW::InputSemantic::INPUT, fcu, anim_id, axis_name);
 
-               if (has_tangents) {
-                       sampler.addInput(COLLADASW::InputSemantic::IN_TANGENT, COLLADABU::URI(empty, intangent_id));
-                       sampler.addInput(COLLADASW::InputSemantic::OUT_TANGENT, COLLADABU::URI(empty, outtangent_id));
-               }
+       // create output source
+       std::string output_id ;
 
-               addSampler(sampler);
+       //quat rotations are skipped for now, because of complications with determining axis.
+       if(quatRotation) 
+       {
+               float * eul  = get_eul_source_for_quat(ob);
+               float * eul_axis = (float*)MEM_callocN(sizeof(float) * fcu->totvert, "quat output source values");
+               for ( int i = 0 ; i< fcu->totvert ; i++)
+                       eul_axis[i] = eul[i*3 + fcu->array_index];
+               output_id= create_source_from_array(COLLADASW::InputSemantic::OUTPUT, eul_axis , fcu->totvert, quatRotation, anim_id, axis_name);
+               MEM_freeN(eul);
+               MEM_freeN(eul_axis);
+       }
+       else 
+       {
+               output_id= create_source_from_fcurve(COLLADASW::InputSemantic::OUTPUT, fcu, anim_id, axis_name);
+       }
+       // create interpolations source
+       std::string interpolation_id = create_interpolation_source(fcu, anim_id, axis_name, &has_tangents);
 
-               std::string target ;
+       // handle tangents (if required)
+       std::string intangent_id;
+       std::string outtangent_id;
 
-               if ( !is_param )
-                       target = translate_id(ob_name)
-                       + "/" + get_transform_sid(fcu->rna_path, -1, axis_name, true);
-               else 
-               {
-                       if ( ob->type == OB_LAMP )
-                               target = get_light_id(ob)
-                               + "/" + get_light_param_sid(fcu->rna_path, -1, axis_name, true);
+       if (has_tangents) {
+               // create in_tangent source
+               intangent_id = create_source_from_fcurve(COLLADASW::InputSemantic::IN_TANGENT, fcu, anim_id, axis_name);
 
-                       if ( ob->type == OB_CAMERA )
-                               target = get_camera_id(ob)
-                               + "/" + get_camera_param_sid(fcu->rna_path, -1, axis_name, true);
+               // create out_tangent source
+               outtangent_id = create_source_from_fcurve(COLLADASW::InputSemantic::OUT_TANGENT, fcu, anim_id, axis_name);
+       }
 
-                       if( ma ) 
-                               target = translate_id(id_name(ma)) + "-effect"
-                                               +"/common/" /*profile common is only supported */ + get_transform_sid(fcu->rna_path, -1, axis_name, true);
-               }
-               addChannel(COLLADABU::URI(empty, sampler_id), target);
+       std::string sampler_id = std::string(anim_id) + SAMPLER_ID_SUFFIX;
+       COLLADASW::LibraryAnimations::Sampler sampler(sw, sampler_id);
+       std::string empty;
+       sampler.addInput(COLLADASW::InputSemantic::INPUT, COLLADABU::URI(empty, input_id));
+       sampler.addInput(COLLADASW::InputSemantic::OUTPUT, COLLADABU::URI(empty, output_id));
+
+       // this input is required
+       sampler.addInput(COLLADASW::InputSemantic::INTERPOLATION, COLLADABU::URI(empty, interpolation_id));
 
-               closeAnimation();
+       if (has_tangents) {
+               sampler.addInput(COLLADASW::InputSemantic::IN_TANGENT, COLLADABU::URI(empty, intangent_id));
+               sampler.addInput(COLLADASW::InputSemantic::OUT_TANGENT, COLLADABU::URI(empty, outtangent_id));
        }
 
+       addSampler(sampler);
+
+       std::string target ;
 
-       
-       //write bone animations in transform matrix sources
-       void AnimationExporter::write_bone_animation_matrix(Object *ob_arm, Bone *bone)
+       if ( !is_param )
+               target = translate_id(ob_name)
+               + "/" + get_transform_sid(fcu->rna_path, -1, axis_name, true);
+       else 
        {
-               if (!ob_arm->adt)
-                       return;
-               
-               //This will only export animations of bones in deform group.
-               /*if(!is_bone_deform_group(bone))
-                       return;*/
-               
-               sample_and_write_bone_animation_matrix(ob_arm, bone);
-
-               for (Bone *child = (Bone*)bone->childbase.first; child; child = child->next)
-                       write_bone_animation_matrix(ob_arm, child);
+               if ( ob->type == OB_LAMP )
+                       target = get_light_id(ob)
+                       + "/" + get_light_param_sid(fcu->rna_path, -1, axis_name, true);
+
+               if ( ob->type == OB_CAMERA )
+                       target = get_camera_id(ob)
+                       + "/" + get_camera_param_sid(fcu->rna_path, -1, axis_name, true);
+
+               if( ma ) 
+                       target = translate_id(id_name(ma)) + "-effect"
+                       +"/common/" /*profile common is only supported */ + get_transform_sid(fcu->rna_path, -1, axis_name, true);
        }
+       addChannel(COLLADABU::URI(empty, sampler_id), target);
 
-       bool AnimationExporter::is_bone_deform_group(Bone * bone)
+       closeAnimation();
+}
+
+
+
+//write bone animations in transform matrix sources
+void AnimationExporter::write_bone_animation_matrix(Object *ob_arm, Bone *bone)
+{
+       if (!ob_arm->adt)
+               return;
+
+       //This will only export animations of bones in deform group.
+       /*if(!is_bone_deform_group(bone))
+       return;*/
+
+       sample_and_write_bone_animation_matrix(ob_arm, bone);
+
+       for (Bone *child = (Bone*)bone->childbase.first; child; child = child->next)
+               write_bone_animation_matrix(ob_arm, child);
+}
+
+bool AnimationExporter::is_bone_deform_group(Bone * bone)
+{   
+       bool is_def;
+       //Check if current bone is deform
+       if((bone->flag & BONE_NO_DEFORM) == 0 ) return true;
+       //Check child bones
+       else 
        {   
-               bool is_def;
-               //Check if current bone is deform
-               if((bone->flag & BONE_NO_DEFORM) == 0 ) return true;
-               //Check child bones
-               else 
-               {   
-                       for (Bone *child = (Bone*)bone->childbase.first; child; child = child->next){
-                               //loop through all the children until deform bone is found, and then return
-                               is_def = is_bone_deform_group(child);
-                               if (is_def) return true;
-                       }
+               for (Bone *child = (Bone*)bone->childbase.first; child; child = child->next){
+                       //loop through all the children until deform bone is found, and then return
+                       is_def = is_bone_deform_group(child);
+                       if (is_def) return true;
                }
-        //no deform bone found in children also
-               return false;
        }
+       //no deform bone found in children also
+       return false;
+}
 
-       void AnimationExporter::sample_and_write_bone_animation_matrix(Object *ob_arm, Bone *bone)
-       {
-               bArmature *arm = (bArmature*)ob_arm->data;
-               int flag = arm->flag;
-               std::vector<float> fra;
-               //char prefix[256];
-
-               FCurve* fcu = (FCurve*)ob_arm->adt->action->curves.first;
-               while(fcu)
-               {
-                       std::string bone_name = getObjectBoneName(ob_arm,fcu);
-                       int val = BLI_strcasecmp((char*)bone_name.c_str(),bone->name);
-                       if(val==0) break;
-                       fcu = fcu->next;
-               }
+void AnimationExporter::sample_and_write_bone_animation_matrix(Object *ob_arm, Bone *bone)
+{
+       bArmature *arm = (bArmature*)ob_arm->data;
+       int flag = arm->flag;
+       std::vector<float> fra;
+       //char prefix[256];
 
-               if(!(fcu)) return; 
-               bPoseChannel *pchan = get_pose_channel(ob_arm->pose, bone->name);
-               if (!pchan)
-                       return;
-       
-               find_frames(ob_arm, fra);
+       FCurve* fcu = (FCurve*)ob_arm->adt->action->curves.first;
+       while(fcu)
+       {
+               std::string bone_name = getObjectBoneName(ob_arm,fcu);
+               int val = BLI_strcasecmp((char*)bone_name.c_str(),bone->name);
+               if(val==0) break;
+               fcu = fcu->next;
+       }
 
-               if (flag & ARM_RESTPOS) {
-                       arm->flag &= ~ARM_RESTPOS;
-                       where_is_pose(scene, ob_arm);
-               }
+       if(!(fcu)) return; 
+       bPoseChannel *pchan = get_pose_channel(ob_arm->pose, bone->name);
+       if (!pchan)
+               return;
 
-               if (fra.size()) {
-                       dae_baked_animation(fra ,ob_arm, bone );
-               }
+       find_frames(ob_arm, fra);
 
-               if (flag & ARM_RESTPOS) 
-                       arm->flag = flag;
+       if (flag & ARM_RESTPOS) {
+               arm->flag &= ~ARM_RESTPOS;
                where_is_pose(scene, ob_arm);
        }
 
-       void AnimationExporter::dae_baked_animation(std::vector<float> &fra, Object *ob_arm , Bone *bone)
-       {
-               std::string ob_name = id_name(ob_arm);
-               std::string bone_name = bone->name;
-               char anim_id[200];
-               
-               if (!fra.size())
-                       return;
+       if (fra.size()) {
+               dae_baked_animation(fra ,ob_arm, bone );
+       }
 
-               BLI_snprintf(anim_id, sizeof(anim_id), "%s_%s_%s", (char*)translate_id(ob_name).c_str(),
-                                        (char*)translate_id(bone_name).c_str(), "pose_matrix");
+       if (flag & ARM_RESTPOS) 
+               arm->flag = flag;
+       where_is_pose(scene, ob_arm);
+}
 
-               openAnimation(anim_id, COLLADABU::Utils::EMPTY_STRING);
+void AnimationExporter::dae_baked_animation(std::vector<float> &fra, Object *ob_arm , Bone *bone)
+{
+       std::string ob_name = id_name(ob_arm);
+       std::string bone_name = bone->name;
+       char anim_id[200];
 
-               // create input source
-               std::string input_id = create_source_from_vector(COLLADASW::InputSemantic::INPUT, fra, false, anim_id, "");
+       if (!fra.size())
+               return;
 
-               // create output source
-               std::string output_id;
-               output_id = create_4x4_source( fra, ob_arm , bone ,  anim_id);
+       BLI_snprintf(anim_id, sizeof(anim_id), "%s_%s_%s", (char*)translate_id(ob_name).c_str(),
+               (char*)translate_id(bone_name).c_str(), "pose_matrix");
 
-               // create interpolations source
-               std::string interpolation_id = fake_interpolation_source(fra.size(), anim_id, "");
+       openAnimation(anim_id, COLLADABU::Utils::EMPTY_STRING);
 
-               std::string sampler_id = std::string(anim_id) + SAMPLER_ID_SUFFIX;
-               COLLADASW::LibraryAnimations::Sampler sampler(sw, sampler_id);
-               std::string empty;
-               sampler.addInput(COLLADASW::InputSemantic::INPUT, COLLADABU::URI(empty, input_id));
-               sampler.addInput(COLLADASW::InputSemantic::OUTPUT, COLLADABU::URI(empty, output_id));
+       // create input source
+       std::string input_id = create_source_from_vector(COLLADASW::InputSemantic::INPUT, fra, false, anim_id, "");
 
-               // TODO create in/out tangents source
+       // create output source
+       std::string output_id;
+       output_id = create_4x4_source( fra, ob_arm , bone ,  anim_id);
 
-               // this input is required
-               sampler.addInput(COLLADASW::InputSemantic::INTERPOLATION, COLLADABU::URI(empty, interpolation_id));
+       // create interpolations source
+       std::string interpolation_id = fake_interpolation_source(fra.size(), anim_id, "");
 
-               addSampler(sampler);
+       std::string sampler_id = std::string(anim_id) + SAMPLER_ID_SUFFIX;
+       COLLADASW::LibraryAnimations::Sampler sampler(sw, sampler_id);
+       std::string empty;
+       sampler.addInput(COLLADASW::InputSemantic::INPUT, COLLADABU::URI(empty, input_id));
+       sampler.addInput(COLLADASW::InputSemantic::OUTPUT, COLLADABU::URI(empty, output_id));
 
-               std::string target = translate_id(bone_name) + "/transform";
-               addChannel(COLLADABU::URI(empty, sampler_id), target);
+       // TODO create in/out tangents source
 
-               closeAnimation();
-       }
+       // this input is required
+       sampler.addInput(COLLADASW::InputSemantic::INTERPOLATION, COLLADABU::URI(empty, interpolation_id));
 
-       // dae_bone_animation -> add_bone_animation
-       // (blend this into dae_bone_animation)
-       void AnimationExporter::dae_bone_animation(std::vector<float> &fra, float *values, int tm_type, int axis, std::string ob_name, std::string bone_name)
-       {
-               const char *axis_names[] = {"X", "Y", "Z"};
-               const char *axis_name = NULL;
-               char anim_id[200];
-               bool is_rot = tm_type == 0;
-               
-               if (!fra.size())
-                       return;
+       addSampler(sampler);
 
-               char rna_path[200];
-               BLI_snprintf(rna_path, sizeof(rna_path), "pose.bones[\"%s\"].%s", bone_name.c_str(),
-                                        tm_type == 0 ? "rotation_quaternion" : (tm_type == 1 ? "scale" : "location"));
+       std::string target = translate_id(bone_name) + "/transform";
+       addChannel(COLLADABU::URI(empty, sampler_id), target);
 
-               if (axis > -1)
-                       axis_name = axis_names[axis];
-               
-               std::string transform_sid = get_transform_sid(NULL, tm_type, axis_name, false);
-               
-               BLI_snprintf(anim_id, sizeof(anim_id), "%s_%s_%s", (char*)translate_id(ob_name).c_str(),
-                                        (char*)translate_id(bone_name).c_str(), (char*)transform_sid.c_str());
+       closeAnimation();
+}
 
-               openAnimation(anim_id, COLLADABU::Utils::EMPTY_STRING);
+// dae_bone_animation -> add_bone_animation
+// (blend this into dae_bone_animation)
+void AnimationExporter::dae_bone_animation(std::vector<float> &fra, float *values, int tm_type, int axis, std::string ob_name, std::string bone_name)
+{
+       const char *axis_names[] = {"X", "Y", "Z"};
+       const char *axis_name = NULL;
+       char anim_id[200];
+       bool is_rot = tm_type == 0;
 
-               // create input source
-               std::string input_id = create_source_from_vector(COLLADASW::InputSemantic::INPUT, fra, is_rot, anim_id, axis_name);
+       if (!fra.size())
+               return;
 
-               // create output source
-               std::string output_id;
-               if (axis == -1)
-                       output_id = create_xyz_source(values, fra.size(), anim_id);
-               else
-                       output_id = create_source_from_array(COLLADASW::InputSemantic::OUTPUT, values, fra.size(), is_rot, anim_id, axis_name);
+       char rna_path[200];
+       BLI_snprintf(rna_path, sizeof(rna_path), "pose.bones[\"%s\"].%s", bone_name.c_str(),
+               tm_type == 0 ? "rotation_quaternion" : (tm_type == 1 ? "scale" : "location"));
 
-               // create interpolations source
-               std::string interpolation_id = fake_interpolation_source(fra.size(), anim_id, axis_name);
+       if (axis > -1)
+               axis_name = axis_names[axis];
 
-               std::string sampler_id = std::string(anim_id) + SAMPLER_ID_SUFFIX;
-               COLLADASW::LibraryAnimations::Sampler sampler(sw, sampler_id);
-               std::string empty;
-               sampler.addInput(COLLADASW::InputSemantic::INPUT, COLLADABU::URI(empty, input_id));
-               sampler.addInput(COLLADASW::InputSemantic::OUTPUT, COLLADABU::URI(empty, output_id));
+       std::string transform_sid = get_transform_sid(NULL, tm_type, axis_name, false);
 
-               // TODO create in/out tangents source
+       BLI_snprintf(anim_id, sizeof(anim_id), "%s_%s_%s", (char*)translate_id(ob_name).c_str(),
+               (char*)translate_id(bone_name).c_str(), (char*)transform_sid.c_str());
 
-               // this input is required
-               sampler.addInput(COLLADASW::InputSemantic::INTERPOLATION, COLLADABU::URI(empty, interpolation_id));
+       openAnimation(anim_id, COLLADABU::Utils::EMPTY_STRING);
 
-               addSampler(sampler);
+       // create input source
+       std::string input_id = create_source_from_vector(COLLADASW::InputSemantic::INPUT, fra, is_rot, anim_id, axis_name);
 
-               std::string target = translate_id(ob_name + "_" + bone_name) + "/" + transform_sid;
-               addChannel(COLLADABU::URI(empty, sampler_id), target);
+       // create output source
+       std::string output_id;
+       if (axis == -1)
+               output_id = create_xyz_source(values, fra.size(), anim_id);
+       else
+               output_id = create_source_from_array(COLLADASW::InputSemantic::OUTPUT, values, fra.size(), is_rot, anim_id, axis_name);
 
-               closeAnimation();
-       }
+       // create interpolations source
+       std::string interpolation_id = fake_interpolation_source(fra.size(), anim_id, axis_name);
 
-       float AnimationExporter::convert_time(float frame)
-       {
-               return FRA2TIME(frame);
-       }
+       std::string sampler_id = std::string(anim_id) + SAMPLER_ID_SUFFIX;
+       COLLADASW::LibraryAnimations::Sampler sampler(sw, sampler_id);
+       std::string empty;
+       sampler.addInput(COLLADASW::InputSemantic::INPUT, COLLADABU::URI(empty, input_id));
+       sampler.addInput(COLLADASW::InputSemantic::OUTPUT, COLLADABU::URI(empty, output_id));
 
-       float AnimationExporter::convert_angle(float angle)
-       {
-               return COLLADABU::Math::Utils::radToDegF(angle);
-       }
+       // TODO create in/out tangents source
 
-       std::string AnimationExporter::get_semantic_suffix(COLLADASW::InputSemantic::Semantics semantic)
-       {
-               switch(semantic) {
+       // this input is required
+       sampler.addInput(COLLADASW::InputSemantic::INTERPOLATION, COLLADABU::URI(empty, interpolation_id));
+
+       addSampler(sampler);
+
+       std::string target = translate_id(ob_name + "_" + bone_name) + "/" + transform_sid;
+       addChannel(COLLADABU::URI(empty, sampler_id), target);
+
+       closeAnimation();
+}
+
+float AnimationExporter::convert_time(float frame)
+{
+       return FRA2TIME(frame);
+}
+
+float AnimationExporter::convert_angle(float angle)
+{
+       return COLLADABU::Math::Utils::radToDegF(angle);
+}
+
+std::string AnimationExporter::get_semantic_suffix(COLLADASW::InputSemantic::Semantics semantic)
+{
+       switch(semantic) {
                case COLLADASW::InputSemantic::INPUT:
                        return INPUT_SOURCE_ID_SUFFIX;
                case COLLADASW::InputSemantic::OUTPUT:
@@ -527,14 +527,14 @@ void AnimationExporter::operator() (Object *ob)
                        return OUTTANGENT_SOURCE_ID_SUFFIX;
                default:
                        break;
-               }
-               return "";
        }
+       return "";
+}
 
-       void AnimationExporter::add_source_parameters(COLLADASW::SourceBase::ParameterNameList& param,
-                                                          COLLADASW::InputSemantic::Semantics semantic, bool is_rot, const char *axis, bool transform)
-       {
-               switch(semantic) {
+void AnimationExporter::add_source_parameters(COLLADASW::SourceBase::ParameterNameList& param,
+                                                                                         COLLADASW::InputSemantic::Semantics semantic, bool is_rot, const char *axis, bool transform)
+{
+       switch(semantic) {
                case COLLADASW::InputSemantic::INPUT:
                        param.push_back("TIME");
                        break;
@@ -547,14 +547,14 @@ void AnimationExporter::operator() (Object *ob)
                                        param.push_back(axis);
                                }
                                else 
-                               if ( transform )
-                               {
-                                       param.push_back("TRANSFORM");  
-                               }else{                           //assumes if axis isn't specified all axises are added
-                                       param.push_back("X");
-                                       param.push_back("Y");
-                                       param.push_back("Z");
-                               }
+                                       if ( transform )
+                                       {
+                                               param.push_back("TRANSFORM");  
+                                       }else{ //assumes if axis isn't specified all axises are added
+                                               param.push_back("X");
+                                               param.push_back("Y");
+                                               param.push_back("Z");
+                                       }
                        }
                        break;
                case COLLADASW::InputSemantic::IN_TANGENT:
@@ -564,12 +564,12 @@ void AnimationExporter::operator() (Object *ob)
                        break;
                default:
                        break;
-               }
        }
+}
 
-       void AnimationExporter::get_source_values(BezTriple *bezt, COLLADASW::InputSemantic::Semantics semantic, bool rotation, float *values, int *length)
-       {
-               switch (semantic) {
+void AnimationExporter::get_source_values(BezTriple *bezt, COLLADASW::InputSemantic::Semantics semantic, bool rotation, float *values, int *length)
+{
+       switch (semantic) {
                case COLLADASW::InputSemantic::INPUT:
                        *length = 1;
                        values[0] = convert_time(bezt->vec[1][0]);
@@ -583,9 +583,9 @@ void AnimationExporter::operator() (Object *ob)
                                values[0] = bezt->vec[1][1];
                        }
                        break;
-               
+
                case COLLADASW::InputSemantic::IN_TANGENT:
-               *length = 2;
+                       *length = 2;
                        values[0] = convert_time(bezt->vec[0][0]);
                        if (bezt->ipo != BEZT_IPO_BEZ) {
                                // We're in a mixed interpolation scenario, set zero as it's irrelevant but value might contain unused data
@@ -598,7 +598,7 @@ void AnimationExporter::operator() (Object *ob)
                                values[1] = bezt->vec[0][1];
                        }
                        break;
-               
+
                case COLLADASW::InputSemantic::OUT_TANGENT:
                        *length = 2;
                        values[0] = convert_time(bezt->vec[2][0]);
@@ -617,283 +617,283 @@ void AnimationExporter::operator() (Object *ob)
                default:
                        *length = 0;
                        break;
-               }
        }
+}
 
-       std::string AnimationExporter::create_source_from_fcurve(COLLADASW::InputSemantic::Semantics semantic, FCurve *fcu, const std::string& anim_id, const char *axis_name)
-       {
-               std::string source_id = anim_id + get_semantic_suffix(semantic);
-
-               //bool is_rotation = !strcmp(fcu->rna_path, "rotation");
-               bool is_angle = false;
-               
-               if (strstr(fcu->rna_path, "rotation")) is_angle = true;
-               
-               COLLADASW::FloatSourceF source(mSW);
-               source.setId(source_id);
-               source.setArrayId(source_id + ARRAY_ID_SUFFIX);
-               source.setAccessorCount(fcu->totvert);
-               
-               switch (semantic) {
+std::string AnimationExporter::create_source_from_fcurve(COLLADASW::InputSemantic::Semantics semantic, FCurve *fcu, const std::string& anim_id, const char *axis_name)
+{
+       std::string source_id = anim_id + get_semantic_suffix(semantic);
+
+       //bool is_rotation = !strcmp(fcu->rna_path, "rotation");
+       bool is_angle = false;
+
+       if (strstr(fcu->rna_path, "rotation")) is_angle = true;
+
+       COLLADASW::FloatSourceF source(mSW);
+       source.setId(source_id);
+       source.setArrayId(source_id + ARRAY_ID_SUFFIX);
+       source.setAccessorCount(fcu->totvert);
+
+       switch (semantic) {
                case COLLADASW::InputSemantic::INPUT:
                case COLLADASW::InputSemantic::OUTPUT:
-               source.setAccessorStride(1);                    
+                       source.setAccessorStride(1);                    
                        break;
                case COLLADASW::InputSemantic::IN_TANGENT:
                case COLLADASW::InputSemantic::OUT_TANGENT:
-               source.setAccessorStride(2);                    
+                       source.setAccessorStride(2);                    
                        break;
-               }
-               
-               
-               COLLADASW::SourceBase::ParameterNameList &param = source.getParameterNameList();
-               add_source_parameters(param, semantic, is_angle, axis_name, false);
+       }
 
-               source.prepareToAppendValues();
 
-               for (unsigned int i = 0; i < fcu->totvert; i++) {
-                       float values[3]; // be careful!
-                       int length = 0;
-                       get_source_values(&fcu->bezt[i], semantic, is_angle, values, &length);
-                               for (int j = 0; j < length; j++)
-                               source.appendValues(values[j]);
-               }
+       COLLADASW::SourceBase::ParameterNameList &param = source.getParameterNameList();
+       add_source_parameters(param, semantic, is_angle, axis_name, false);
 
-               source.finish();
+       source.prepareToAppendValues();
 
-               return source_id;
+       for (unsigned int i = 0; i < fcu->totvert; i++) {
+               float values[3]; // be careful!
+               int length = 0;
+               get_source_values(&fcu->bezt[i], semantic, is_angle, values, &length);
+               for (int j = 0; j < length; j++)
+                       source.appendValues(values[j]);
        }
 
-       //Currently called only to get OUTPUT source values ( if rotation and hence the axis is also specified )
-       std::string AnimationExporter::create_source_from_array(COLLADASW::InputSemantic::Semantics semantic, float *v, int tot, bool is_rot, const std::string& anim_id, const char *axis_name)
-       {
-               std::string source_id = anim_id + get_semantic_suffix(semantic);
-
-               COLLADASW::FloatSourceF source(mSW);
-               source.setId(source_id);
-               source.setArrayId(source_id + ARRAY_ID_SUFFIX);
-               source.setAccessorCount(tot);
-               source.setAccessorStride(1);
-               
-               COLLADASW::SourceBase::ParameterNameList &param = source.getParameterNameList();
-               add_source_parameters(param, semantic, is_rot, axis_name,  false);
-
-               source.prepareToAppendValues();
-
-               for (int i = 0; i < tot; i++) {
-                       float val = v[i];
-                       ////if (semantic == COLLADASW::InputSemantic::INPUT)
-                       //      val = convert_time(val);
-                       //else
-                               if (is_rot)                       
-                               val *= 180.0f / M_PI;
-                       source.appendValues(val);
-               }
+       source.finish();
 
-               source.finish();
+       return source_id;
+}
 
-               return source_id;
+//Currently called only to get OUTPUT source values ( if rotation and hence the axis is also specified )
+std::string AnimationExporter::create_source_from_array(COLLADASW::InputSemantic::Semantics semantic, float *v, int tot, bool is_rot, const std::string& anim_id, const char *axis_name)
+{
+       std::string source_id = anim_id + get_semantic_suffix(semantic);
+
+       COLLADASW::FloatSourceF source(mSW);
+       source.setId(source_id);
+       source.setArrayId(source_id + ARRAY_ID_SUFFIX);
+       source.setAccessorCount(tot);
+       source.setAccessorStride(1);
+
+       COLLADASW::SourceBase::ParameterNameList &param = source.getParameterNameList();
+       add_source_parameters(param, semantic, is_rot, axis_name,  false);
+
+       source.prepareToAppendValues();
+
+       for (int i = 0; i < tot; i++) {
+               float val = v[i];
+               ////if (semantic == COLLADASW::InputSemantic::INPUT)
+               //      val = convert_time(val);
+               //else
+               if (is_rot)
+                       val *= 180.0f / M_PI;
+               source.appendValues(val);
        }
-// only used for sources with INPUT semantic
-       std::string AnimationExporter::create_source_from_vector(COLLADASW::InputSemantic::Semantics semantic, std::vector<float> &fra, bool is_rot, const std::string& anim_id, const char *axis_name)
-       {
-               std::string source_id = anim_id + get_semantic_suffix(semantic);
-
-               COLLADASW::FloatSourceF source(mSW);
-               source.setId(source_id);
-               source.setArrayId(source_id + ARRAY_ID_SUFFIX);
-               source.setAccessorCount(fra.size());
-               source.setAccessorStride(1);
-               
-               COLLADASW::SourceBase::ParameterNameList &param = source.getParameterNameList();
-               add_source_parameters(param, semantic, is_rot, axis_name, false);
-
-               source.prepareToAppendValues();
-
-               std::vector<float>::iterator it;
-               for (it = fra.begin(); it != fra.end(); it++) {
-                       float val = *it;
-                       //if (semantic == COLLADASW::InputSemantic::INPUT)
-                               val = convert_time(val);
-                       /*else if (is_rot)
-                               val = convert_angle(val);*/
-                       source.appendValues(val);
-               }
 
-               source.finish();
+       source.finish();
 
-               return source_id;
+       return source_id;
+}
+// only used for sources with INPUT semantic
+std::string AnimationExporter::create_source_from_vector(COLLADASW::InputSemantic::Semantics semantic, std::vector<float> &fra, bool is_rot, const std::string& anim_id, const char *axis_name)
+{
+       std::string source_id = anim_id + get_semantic_suffix(semantic);
+
+       COLLADASW::FloatSourceF source(mSW);
+       source.setId(source_id);
+       source.setArrayId(source_id + ARRAY_ID_SUFFIX);
+       source.setAccessorCount(fra.size());
+       source.setAccessorStride(1);
+
+       COLLADASW::SourceBase::ParameterNameList &param = source.getParameterNameList();
+       add_source_parameters(param, semantic, is_rot, axis_name, false);
+
+       source.prepareToAppendValues();
+
+       std::vector<float>::iterator it;
+       for (it = fra.begin(); it != fra.end(); it++) {
+               float val = *it;
+               //if (semantic == COLLADASW::InputSemantic::INPUT)
+               val = convert_time(val);
+               /*else if (is_rot)
+               val = convert_angle(val);*/
+               source.appendValues(val);
        }
 
-       std::string AnimationExporter::create_4x4_source(std::vector<float> &frames , Object * ob_arm, Bone *bone , const std::string& anim_id)
-       {
-               COLLADASW::InputSemantic::Semantics semantic = COLLADASW::InputSemantic::OUTPUT;
-               std::string source_id = anim_id + get_semantic_suffix(semantic);
+       source.finish();
 
-               COLLADASW::Float4x4Source source(mSW);
-               source.setId(source_id);
-               source.setArrayId(source_id + ARRAY_ID_SUFFIX);
-               source.setAccessorCount(frames.size());
-               source.setAccessorStride(16);
-               
-               COLLADASW::SourceBase::ParameterNameList &param = source.getParameterNameList();
-               add_source_parameters(param, semantic, false, NULL, true);
+       return source_id;
+}
 
-               source.prepareToAppendValues();
-               
-               bPoseChannel *parchan = NULL;
-               bPoseChannel *pchan = NULL;
-               bPose *pose = ob_arm->pose;
+std::string AnimationExporter::create_4x4_source(std::vector<float> &frames , Object * ob_arm, Bone *bone , const std::string& anim_id)
+{
+       COLLADASW::InputSemantic::Semantics semantic = COLLADASW::InputSemantic::OUTPUT;
+       std::string source_id = anim_id + get_semantic_suffix(semantic);
 
-               pchan = get_pose_channel(pose, bone->name);
+       COLLADASW::Float4x4Source source(mSW);
+       source.setId(source_id);
+       source.setArrayId(source_id + ARRAY_ID_SUFFIX);
+       source.setAccessorCount(frames.size());
+       source.setAccessorStride(16);
 
-               if (!pchan)
-                       return "";
+       COLLADASW::SourceBase::ParameterNameList &param = source.getParameterNameList();
+       add_source_parameters(param, semantic, false, NULL, true);
 
-               parchan = pchan->parent;
+       source.prepareToAppendValues();
 
-               enable_fcurves(ob_arm->adt->action, bone->name);
+       bPoseChannel *parchan = NULL;
+       bPoseChannel *pchan = NULL;
+       bPose *pose = ob_arm->pose;
 
-               std::vector<float>::iterator it;
-               int j = 0;
-               for (it = frames.begin(); it != frames.end(); it++) {
-                       float mat[4][4], ipar[4][4];
+       pchan = get_pose_channel(pose, bone->name);
 
-                       float ctime = bsystem_time(scene, ob_arm, *it, 0.0f);
+       if (!pchan)
+               return "";
 
-                       BKE_animsys_evaluate_animdata(scene , &ob_arm->id, ob_arm->adt, ctime, ADT_RECALC_ANIM);
-                       where_is_pose_bone(scene, ob_arm, pchan, ctime, 1);
+       parchan = pchan->parent;
 
-                       // compute bone local mat
-                       if (bone->parent) {
-                               invert_m4_m4(ipar, parchan->pose_mat);
-                               mul_m4_m4m4(mat, pchan->pose_mat, ipar);
-                       }
-                       else
-                               copy_m4_m4(mat, pchan->pose_mat);
-                       UnitConverter converter;
+       enable_fcurves(ob_arm->adt->action, bone->name);
 
-                       float outmat[4][4];
-                       converter.mat4_to_dae(outmat,mat);
+       std::vector<float>::iterator it;
+       int j = 0;
+       for (it = frames.begin(); it != frames.end(); it++) {
+               float mat[4][4], ipar[4][4];
 
+               float ctime = bsystem_time(scene, ob_arm, *it, 0.0f);
 
-                       source.appendValues(outmat);
-                       
+               BKE_animsys_evaluate_animdata(scene , &ob_arm->id, ob_arm->adt, ctime, ADT_RECALC_ANIM);
+               where_is_pose_bone(scene, ob_arm, pchan, ctime, 1);
 
-                       j++;
+               // compute bone local mat
+               if (bone->parent) {
+                       invert_m4_m4(ipar, parchan->pose_mat);
+                       mul_m4_m4m4(mat, pchan->pose_mat, ipar);
                }
+               else
+                       copy_m4_m4(mat, pchan->pose_mat);
+               UnitConverter converter;
 
-               enable_fcurves(ob_arm->adt->action, NULL);
+               float outmat[4][4];
+               converter.mat4_to_dae(outmat,mat);
 
-               source.finish();
 
-               return source_id;
-       }
-       // only used for sources with OUTPUT semantic ( locations and scale)
-       std::string AnimationExporter::create_xyz_source(float *v, int tot, const std::string& anim_id)
-       {
-               COLLADASW::InputSemantic::Semantics semantic = COLLADASW::InputSemantic::OUTPUT;
-               std::string source_id = anim_id + get_semantic_suffix(semantic);
-
-               COLLADASW::FloatSourceF source(mSW);
-               source.setId(source_id);
-               source.setArrayId(source_id + ARRAY_ID_SUFFIX);
-               source.setAccessorCount(tot);
-               source.setAccessorStride(3);
-               
-               COLLADASW::SourceBase::ParameterNameList &param = source.getParameterNameList();
-               add_source_parameters(param, semantic, false, NULL, false);
-
-               source.prepareToAppendValues();
-
-               for (int i = 0; i < tot; i++) {
-                       source.appendValues(*v, *(v + 1), *(v + 2));
-                       v += 3;
-               }
+               source.appendValues(outmat);
 
-               source.finish();
 
-               return source_id;
+               j++;
        }
 
-       std::string AnimationExporter::create_interpolation_source(FCurve *fcu, const std::string& anim_id, const char *axis_name, bool *has_tangents)
-       {
-               std::string source_id = anim_id + get_semantic_suffix(COLLADASW::InputSemantic::INTERPOLATION);
+       enable_fcurves(ob_arm->adt->action, NULL);
 
-               COLLADASW::NameSource source(mSW);
-               source.setId(source_id);
-               source.setArrayId(source_id + ARRAY_ID_SUFFIX);
-               source.setAccessorCount(fcu->totvert);
-               source.setAccessorStride(1);
-               
-               COLLADASW::SourceBase::ParameterNameList &param = source.getParameterNameList();
-               param.push_back("INTERPOLATION");
+       source.finish();
 
-               source.prepareToAppendValues();
+       return source_id;
+}
+// only used for sources with OUTPUT semantic ( locations and scale)
+std::string AnimationExporter::create_xyz_source(float *v, int tot, const std::string& anim_id)
+{
+       COLLADASW::InputSemantic::Semantics semantic = COLLADASW::InputSemantic::OUTPUT;
+       std::string source_id = anim_id + get_semantic_suffix(semantic);
 
-               *has_tangents = false;
+       COLLADASW::FloatSourceF source(mSW);
+       source.setId(source_id);
+       source.setArrayId(source_id + ARRAY_ID_SUFFIX);
+       source.setAccessorCount(tot);
+       source.setAccessorStride(3);
 
-               for (unsigned int i = 0; i < fcu->totvert; i++) {
-                       if (fcu->bezt[i].ipo==BEZT_IPO_BEZ) {
-                               source.appendValues(BEZIER_NAME);
-                               *has_tangents = true;
-                       } else if (fcu->bezt[i].ipo==BEZT_IPO_CONST) {
-                               source.appendValues(STEP_NAME);
-                       } else { // BEZT_IPO_LIN
-                               source.appendValues(LINEAR_NAME);
-                       }
-               }
-               // unsupported? -- HERMITE, CARDINAL, BSPLINE, NURBS
+       COLLADASW::SourceBase::ParameterNameList &param = source.getParameterNameList();
+       add_source_parameters(param, semantic, false, NULL, false);
 
-               source.finish();
+       source.prepareToAppendValues();
 
-               return source_id;
+       for (int i = 0; i < tot; i++) {
+               source.appendValues(*v, *(v + 1), *(v + 2));
+               v += 3;
        }
 
-       std::string AnimationExporter::fake_interpolation_source(int tot, const std::string& anim_id, const char *axis_name)
-       {
-               std::string source_id = anim_id + get_semantic_suffix(COLLADASW::InputSemantic::INTERPOLATION);
+       source.finish();
+
+       return source_id;
+}
+
+std::string AnimationExporter::create_interpolation_source(FCurve *fcu, const std::string& anim_id, const char *axis_name, bool *has_tangents)
+{
+       std::string source_id = anim_id + get_semantic_suffix(COLLADASW::InputSemantic::INTERPOLATION);
+
+       COLLADASW::NameSource source(mSW);
+       source.setId(source_id);
+       source.setArrayId(source_id + ARRAY_ID_SUFFIX);
+       source.setAccessorCount(fcu->totvert);
+       source.setAccessorStride(1);
+
+       COLLADASW::SourceBase::ParameterNameList &param = source.getParameterNameList();
+       param.push_back("INTERPOLATION");
 
-               COLLADASW::NameSource source(mSW);
-               source.setId(source_id);
-               source.setArrayId(source_id + ARRAY_ID_SUFFIX);
-               source.setAccessorCount(tot);
-               source.setAccessorStride(1);
-               
-               COLLADASW::SourceBase::ParameterNameList &param = source.getParameterNameList();
-               param.push_back("INTERPOLATION");
+       source.prepareToAppendValues();
 
-               source.prepareToAppendValues();
+       *has_tangents = false;
 
-               for (int i = 0; i < tot; i++) {
+       for (unsigned int i = 0; i < fcu->totvert; i++) {
+               if (fcu->bezt[i].ipo==BEZT_IPO_BEZ) {
+                       source.appendValues(BEZIER_NAME);
+                       *has_tangents = true;
+               } else if (fcu->bezt[i].ipo==BEZT_IPO_CONST) {
+                       source.appendValues(STEP_NAME);
+               } else { // BEZT_IPO_LIN
                        source.appendValues(LINEAR_NAME);
                }
+       }
+       // unsupported? -- HERMITE, CARDINAL, BSPLINE, NURBS
+
+       source.finish();
+
+       return source_id;
+}
+
+std::string AnimationExporter::fake_interpolation_source(int tot, const std::string& anim_id, const char *axis_name)
+{
+       std::string source_id = anim_id + get_semantic_suffix(COLLADASW::InputSemantic::INTERPOLATION);
+
+       COLLADASW::NameSource source(mSW);
+       source.setId(source_id);
+       source.setArrayId(source_id + ARRAY_ID_SUFFIX);
+       source.setAccessorCount(tot);
+       source.setAccessorStride(1);
+
+       COLLADASW::SourceBase::ParameterNameList &param = source.getParameterNameList();
+       param.push_back("INTERPOLATION");
 
-               source.finish();
+       source.prepareToAppendValues();
 
-               return source_id;
+       for (int i = 0; i < tot; i++) {
+               source.appendValues(LINEAR_NAME);
        }
 
-       std::string AnimationExporter::get_light_param_sid(char *rna_path, int tm_type, const char *axis_name, bool append_axis)
-       {
-               std::string tm_name;
-               // when given rna_path, determine tm_type from it
-               if (rna_path) {
-                       char *name = extract_transform_name(rna_path);
-
-                       if (!strcmp(name, "color"))
-                               tm_type = 1;
-                       else if (!strcmp(name, "spot_size"))
-                               tm_type = 2;
-                       else if (!strcmp(name, "spot_blend"))
-                               tm_type = 3;
-                       else if (!strcmp(name, "distance"))
-                               tm_type = 4;
-                       else
-                               tm_type = -1;
-               }
+       source.finish();
 
-               switch (tm_type) {
+       return source_id;
+}
+
+std::string AnimationExporter::get_light_param_sid(char *rna_path, int tm_type, const char *axis_name, bool append_axis)
+{
+       std::string tm_name;
+       // when given rna_path, determine tm_type from it
+       if (rna_path) {
+               char *name = extract_transform_name(rna_path);
+
+               if (!strcmp(name, "color"))
+                       tm_type = 1;
+               else if (!strcmp(name, "spot_size"))
+                       tm_type = 2;
+               else if (!strcmp(name, "spot_blend"))
+                       tm_type = 3;
+               else if (!strcmp(name, "distance"))
+                       tm_type = 4;
+               else
+                       tm_type = -1;
+       }
+
+       switch (tm_type) {
                case 1:
                        tm_name = "color";
                        break;
@@ -906,43 +906,43 @@ void AnimationExporter::operator() (Object *ob)
                case 4:
                        tm_name = "blender/blender_dist";
                        break;
-               
+
                default:
                        tm_name = "";
                        break;
-               }
-          
-               if (tm_name.size()) {
-                       if (axis_name != "")
-                               return tm_name + "." + std::string(axis_name);
-                       else 
-                               return tm_name;
-               }
+       }
 
-               return std::string("");
+       if (tm_name.size()) {
+               if (axis_name != "")
+                       return tm_name + "." + std::string(axis_name);
+               else 
+                       return tm_name;
        }
-       
-       std::string AnimationExporter::get_camera_param_sid(char *rna_path, int tm_type, const char *axis_name, bool append_axis)
-       {
-               std::string tm_name;
-               // when given rna_path, determine tm_type from it
-               if (rna_path) {
-                       char *name = extract_transform_name(rna_path);
-
-                       if (!strcmp(name, "lens"))
-                               tm_type = 0;
-                       else if (!strcmp(name, "ortho_scale"))
-                               tm_type = 1;
-                       else if (!strcmp(name, "clip_end"))
-                               tm_type = 2;
-                       else if (!strcmp(name, "clip_start"))
-                               tm_type = 3;
-                       
-                       else
-                               tm_type = -1;
-               }
 
-               switch (tm_type) {
+       return std::string("");
+}
+
+std::string AnimationExporter::get_camera_param_sid(char *rna_path, int tm_type, const char *axis_name, bool append_axis)
+{
+       std::string tm_name;
+       // when given rna_path, determine tm_type from it
+       if (rna_path) {
+               char *name = extract_transform_name(rna_path);
+
+               if (!strcmp(name, "lens"))
+                       tm_type = 0;
+               else if (!strcmp(name, "ortho_scale"))
+                       tm_type = 1;
+               else if (!strcmp(name, "clip_end"))
+                       tm_type = 2;
+               else if (!strcmp(name, "clip_start"))
+                       tm_type = 3;
+
+               else
+                       tm_type = -1;
+       }
+
+       switch (tm_type) {
                case 0:
                        tm_name = "xfov";
                        break;
@@ -955,56 +955,56 @@ void AnimationExporter::operator() (Object *ob)
                case 3:
                        tm_name = "znear";
                        break;
-               
+
                default:
                        tm_name = "";
                        break;
-               }
-          
-               if (tm_name.size()) {
-                       if (axis_name != "")
-                               return tm_name + "." + std::string(axis_name);
-                       else 
-                               return tm_name;
-               }
+       }
 
-               return std::string("");
+       if (tm_name.size()) {
+               if (axis_name != "")
+                       return tm_name + "." + std::string(axis_name);
+               else 
+                       return tm_name;
        }
 
-       // Assign sid of the animated parameter or transform 
-       // for rotation, axis name is always appended and the value of append_axis is ignored
-       std::string AnimationExporter::get_transform_sid(char *rna_path, int tm_type, const char *axis_name, bool append_axis)
-       {
-               std::string tm_name;
-               bool is_rotation =false;
-               // when given rna_path, determine tm_type from it
-               if (rna_path) {
-                       char *name = extract_transform_name(rna_path);
-
-                       if (!strcmp(name, "rotation_euler"))
-                               tm_type = 0;
-                       else if (!strcmp(name, "rotation_quaternion"))
-                               tm_type = 1;
-                       else if (!strcmp(name, "scale"))
-                               tm_type = 2;
-                       else if (!strcmp(name, "location"))
-                               tm_type = 3;
-                       else if (!strcmp(name, "specular_hardness"))
-                               tm_type = 4;
-                       else if (!strcmp(name, "specular_color"))
-                               tm_type = 5;
-                       else if (!strcmp(name, "diffuse_color"))
-                               tm_type = 6;
-                       else if (!strcmp(name, "alpha"))
-                               tm_type = 7;
-                       else if (!strcmp(name, "ior"))
-                               tm_type = 8;
-                       
-                       else
-                               tm_type = -1;
-               }
+       return std::string("");
+}
+
+// Assign sid of the animated parameter or transform 
+// for rotation, axis name is always appended and the value of append_axis is ignored
+std::string AnimationExporter::get_transform_sid(char *rna_path, int tm_type, const char *axis_name, bool append_axis)
+{
+       std::string tm_name;
+       bool is_rotation =false;
+       // when given rna_path, determine tm_type from it
+       if (rna_path) {
+               char *name = extract_transform_name(rna_path);
+
+               if (!strcmp(name, "rotation_euler"))
+                       tm_type = 0;
+               else if (!strcmp(name, "rotation_quaternion"))
+                       tm_type = 1;
+               else if (!strcmp(name, "scale"))
+                       tm_type = 2;
+               else if (!strcmp(name, "location"))
+                       tm_type = 3;
+               else if (!strcmp(name, "specular_hardness"))
+                       tm_type = 4;
+               else if (!strcmp(name, "specular_color"))
+                       tm_type = 5;
+               else if (!strcmp(name, "diffuse_color"))
+                       tm_type = 6;
+               else if (!strcmp(name, "alpha"))
+                       tm_type = 7;
+               else if (!strcmp(name, "ior"))
+                       tm_type = 8;
 
-               switch (tm_type) {
+               else
+                       tm_type = -1;
+       }
+
+       switch (tm_type) {
                case 0:
                case 1:
                        tm_name = "rotation";
@@ -1031,173 +1031,173 @@ void AnimationExporter::operator() (Object *ob)
                case 8:
                        tm_name = "index_of_refraction";
                        break;  
-               
+
                default:
                        tm_name = "";
                        break;
-               }
-          
-               if (tm_name.size()) {
-                       if (is_rotation)
-                               return tm_name + std::string(axis_name) + ".ANGLE";
-                       else
-                               if (axis_name != "")
-                                       return tm_name + "." + std::string(axis_name);
-                               else 
-                                       return tm_name;
-               }
-
-               return std::string("");
        }
 
-       char* AnimationExporter::extract_transform_name(char *rna_path)
-       {
-               char *dot = strrchr(rna_path, '.');
-               return dot ? (dot + 1) : rna_path;
+       if (tm_name.size()) {
+               if (is_rotation)
+                       return tm_name + std::string(axis_name) + ".ANGLE";
+               else
+                       if (axis_name != "")
+                               return tm_name + "." + std::string(axis_name);
+                       else 
+                               return tm_name;
        }
 
-       //find keyframes of all the objects animations
-       void AnimationExporter::find_frames(Object *ob, std::vector<float> &fra)
-       {
-               FCurve *fcu= (FCurve*)ob->adt->action->curves.first;
+       return std::string("");
+}
 
-               for (; fcu; fcu = fcu->next) {
-                       
-                       for (unsigned int i = 0; i < fcu->totvert; i++) {
-                               float f = fcu->bezt[i].vec[1][0];     //
-                               if (std::find(fra.begin(), fra.end(), f) == fra.end())   
-                                       fra.push_back(f);
-                       }
-               }
+char* AnimationExporter::extract_transform_name(char *rna_path)
+{
+       char *dot = strrchr(rna_path, '.');
+       return dot ? (dot + 1) : rna_path;
+}
 
-               // keep the keys in ascending order
-               std::sort(fra.begin(), fra.end());
-       }
+//find keyframes of all the objects animations
+void AnimationExporter::find_frames(Object *ob, std::vector<float> &fra)
+{
+       FCurve *fcu= (FCurve*)ob->adt->action->curves.first;
 
-               
+       for (; fcu; fcu = fcu->next) {
 
-       // enable fcurves driving a specific bone, disable all the rest
-       // if bone_name = NULL enable all fcurves
-       void AnimationExporter::enable_fcurves(bAction *act, char *bone_name)
-       {
-               FCurve *fcu;
-               char prefix[200];
-
-               if (bone_name)
-                       BLI_snprintf(prefix, sizeof(prefix), "pose.bones[\"%s\"]", bone_name);
-
-               for (fcu = (FCurve*)act->curves.first; fcu; fcu = fcu->next) {
-                       if (bone_name) {
-                               if (!strncmp(fcu->rna_path, prefix, strlen(prefix)))
-                                       fcu->flag &= ~FCURVE_DISABLED;
-                               else
-                                       fcu->flag |= FCURVE_DISABLED;
-                       }
-                       else {
-                               fcu->flag &= ~FCURVE_DISABLED;
-                       }
+               for (unsigned int i = 0; i < fcu->totvert; i++) {
+                       float f = fcu->bezt[i].vec[1][0];
+                       if (std::find(fra.begin(), fra.end(), f) == fra.end())   
+                               fra.push_back(f);
                }
        }
-       
-       bool AnimationExporter::hasAnimations(Scene *sce)
-       {
-               Base *base= (Base*) sce->base.first;
-               
-               while(base) {
-                       Object *ob = base->object;
-                       
-                       FCurve *fcu = 0;
-                       //Check for object transform animations
-                       if(ob->adt && ob->adt->action)      
-                               fcu = (FCurve*)ob->adt->action->curves.first;
-                       //Check for Lamp parameter animations
-                       else if( (ob->type == OB_LAMP ) && ((Lamp*)ob ->data)->adt && ((Lamp*)ob ->data)->adt->action )
-                               fcu = (FCurve*)(((Lamp*)ob ->data)->adt->action->curves.first);
-                       //Check for Camera parameter animations
-                       else if( (ob->type == OB_CAMERA ) && ((Camera*)ob ->data)->adt && ((Camera*)ob ->data)->adt->action )
-                               fcu = (FCurve*)(((Camera*)ob ->data)->adt->action->curves.first);
-                       
-                       //Check Material Effect parameter animations.
-                       for(int a = 0; a < ob->totcol; a++)
-                       {
-                               Material *ma = give_current_material(ob, a+1);
-                               if (!ma) continue;
-                               if(ma->adt && ma->adt->action)
-                               {
-                                       fcu = (FCurve*)ma->adt->action->curves.first;   
-                               }
-                       }
 
-                       if ( fcu) 
-                               return true;
-                       base= base->next;
+       // keep the keys in ascending order
+       std::sort(fra.begin(), fra.end());
+}
+
+
+
+// enable fcurves driving a specific bone, disable all the rest
+// if bone_name = NULL enable all fcurves
+void AnimationExporter::enable_fcurves(bAction *act, char *bone_name)
+{
+       FCurve *fcu;
+       char prefix[200];
+
+       if (bone_name)
+               BLI_snprintf(prefix, sizeof(prefix), "pose.bones[\"%s\"]", bone_name);
+
+       for (fcu = (FCurve*)act->curves.first; fcu; fcu = fcu->next) {
+               if (bone_name) {
+                       if (!strncmp(fcu->rna_path, prefix, strlen(prefix)))
+                               fcu->flag &= ~FCURVE_DISABLED;
+                       else
+                               fcu->flag |= FCURVE_DISABLED;
+               }
+               else {
+                       fcu->flag &= ~FCURVE_DISABLED;
                }
-               return false;
        }
+}
 
-       //------------------------------- Not used in the new system.--------------------------------------------------------
-       void AnimationExporter::find_rotation_frames(Object *ob, std::vector<float> &fra, const char *prefix, int rotmode)
-       {
-               if (rotmode > 0)
-                       find_frames(ob, fra, prefix, "rotation_euler");
-               else if (rotmode == ROT_MODE_QUAT)
-                       find_frames(ob, fra, prefix, "rotation_quaternion");
-               /*else if (rotmode == ROT_MODE_AXISANGLE)
-                       ;*/
-       }
+bool AnimationExporter::hasAnimations(Scene *sce)
+{
+       Base *base= (Base*) sce->base.first;
 
-       void AnimationExporter::find_frames(Object *ob, std::vector<float> &fra, const char *prefix, const char *tm_name)
-       {
-               FCurve *fcu= (FCurve*)ob->adt->action->curves.first;
-
-               for (; fcu; fcu = fcu->next) {
-                       if (prefix && strncmp(prefix, fcu->rna_path, strlen(prefix)))
-                               continue;
-
-                       char *name = extract_transform_name(fcu->rna_path);
-                       if (!strcmp(name, tm_name)) {
-                               for (unsigned int i = 0; i < fcu->totvert; i++) {
-                                       float f = fcu->bezt[i].vec[1][0];     //
-                                       if (std::find(fra.begin(), fra.end(), f) == fra.end())   
-                                               fra.push_back(f);
-                               }
+       while(base) {
+               Object *ob = base->object;
+
+               FCurve *fcu = 0;
+               //Check for object transform animations
+               if(ob->adt && ob->adt->action)
+                       fcu = (FCurve*)ob->adt->action->curves.first;
+               //Check for Lamp parameter animations
+               else if( (ob->type == OB_LAMP ) && ((Lamp*)ob ->data)->adt && ((Lamp*)ob ->data)->adt->action )
+                       fcu = (FCurve*)(((Lamp*)ob ->data)->adt->action->curves.first);
+               //Check for Camera parameter animations
+               else if( (ob->type == OB_CAMERA ) && ((Camera*)ob ->data)->adt && ((Camera*)ob ->data)->adt->action )
+                       fcu = (FCurve*)(((Camera*)ob ->data)->adt->action->curves.first);
+
+               //Check Material Effect parameter animations.
+               for(int a = 0; a < ob->totcol; a++)
+               {
+                       Material *ma = give_current_material(ob, a+1);
+                       if (!ma) continue;
+                       if(ma->adt && ma->adt->action)
+                       {
+                               fcu = (FCurve*)ma->adt->action->curves.first;   
                        }
                }
 
-               // keep the keys in ascending order
-               std::sort(fra.begin(), fra.end());
+               if ( fcu) 
+                       return true;
+               base= base->next;
        }
+       return false;
+}
 
-       void AnimationExporter::write_bone_animation(Object *ob_arm, Bone *bone)
-       {
-               if (!ob_arm->adt)
-                       return;
-               
-               //write bone animations for 3 transform types
-               //i=0 --> rotations
-               //i=1 --> scale
-               //i=2 --> location
-               for (int i = 0; i < 3; i++)
-                       sample_and_write_bone_animation(ob_arm, bone, i);
-               
-               for (Bone *child = (Bone*)bone->childbase.first; child; child = child->next)
-                       write_bone_animation(ob_arm, child);
+//------------------------------- Not used in the new system.--------------------------------------------------------
+void AnimationExporter::find_rotation_frames(Object *ob, std::vector<float> &fra, const char *prefix, int rotmode)
+{
+       if (rotmode > 0)
+               find_frames(ob, fra, prefix, "rotation_euler");
+       else if (rotmode == ROT_MODE_QUAT)
+               find_frames(ob, fra, prefix, "rotation_quaternion");
+       /*else if (rotmode == ROT_MODE_AXISANGLE)
+       ;*/
+}
+
+void AnimationExporter::find_frames(Object *ob, std::vector<float> &fra, const char *prefix, const char *tm_name)
+{
+       FCurve *fcu= (FCurve*)ob->adt->action->curves.first;
+
+       for (; fcu; fcu = fcu->next) {
+               if (prefix && strncmp(prefix, fcu->rna_path, strlen(prefix)))
+                       continue;
+
+               char *name = extract_transform_name(fcu->rna_path);
+               if (!strcmp(name, tm_name)) {
+                       for (unsigned int i = 0; i < fcu->totvert; i++) {
+                               float f = fcu->bezt[i].vec[1][0];
+                               if (std::find(fra.begin(), fra.end(), f) == fra.end())   
+                                       fra.push_back(f);
+                       }
+               }
        }
 
-       void AnimationExporter::sample_and_write_bone_animation(Object *ob_arm, Bone *bone, int transform_type)
-       {
-               bArmature *arm = (bArmature*)ob_arm->data;
-               int flag = arm->flag;
-               std::vector<float> fra;
-               char prefix[256];
+       // keep the keys in ascending order
+       std::sort(fra.begin(), fra.end());
+}
 
-               BLI_snprintf(prefix, sizeof(prefix), "pose.bones[\"%s\"]", bone->name);
+void AnimationExporter::write_bone_animation(Object *ob_arm, Bone *bone)
+{
+       if (!ob_arm->adt)
+               return;
+
+       //write bone animations for 3 transform types
+       //i=0 --> rotations
+       //i=1 --> scale
+       //i=2 --> location
+       for (int i = 0; i < 3; i++)
+               sample_and_write_bone_animation(ob_arm, bone, i);
+
+       for (Bone *child = (Bone*)bone->childbase.first; child; child = child->next)
+               write_bone_animation(ob_arm, child);
+}
 
-               bPoseChannel *pchan = get_pose_channel(ob_arm->pose, bone->name);
-               if (!pchan)
-                       return;
-               //Fill frame array with key frame values framed at @param:transform_type
-               switch (transform_type) {
+void AnimationExporter::sample_and_write_bone_animation(Object *ob_arm, Bone *bone, int transform_type)
+{
+       bArmature *arm = (bArmature*)ob_arm->data;
+       int flag = arm->flag;
+       std::vector<float> fra;
+       char prefix[256];
+
+       BLI_snprintf(prefix, sizeof(prefix), "pose.bones[\"%s\"]", bone->name);
+
+       bPoseChannel *pchan = get_pose_channel(ob_arm->pose, bone->name);
+       if (!pchan)
+               return;
+       //Fill frame array with key frame values framed at @param:transform_type
+       switch (transform_type) {
                case 0:
                        find_rotation_frames(ob_arm, fra, prefix, pchan->rotmode);
                        break;
@@ -1209,77 +1209,77 @@ void AnimationExporter::operator() (Object *ob)
                        break;
                default:
                        return;
-               }
+       }
 
-               // exit rest position
-               if (flag & ARM_RESTPOS) {
-                       arm->flag &= ~ARM_RESTPOS;
-                       where_is_pose(scene, ob_arm);
-               }
-               //v array will hold all values which will be exported. 
-               if (fra.size()) {
-                       float *values = (float*)MEM_callocN(sizeof(float) * 3 * fra.size(), "temp. anim frames");
-                       sample_animation(values, fra, transform_type, bone, ob_arm, pchan);
-
-                       if (transform_type == 0) {
-                               // write x, y, z curves separately if it is rotation
-                               float *axisValues = (float*)MEM_callocN(sizeof(float) * fra.size(), "temp. anim frames");   
-                       
-                               for (int i = 0; i < 3; i++) {
-                                       for (unsigned int j = 0; j < fra.size(); j++)
-                                               axisValues[j] = values[j * 3 + i];
-
-                                       dae_bone_animation(fra, axisValues, transform_type, i, id_name(ob_arm), bone->name);
-                               }
-                               MEM_freeN(axisValues);
-                       }
-                       else {
-                               // write xyz at once if it is location or scale
-                               dae_bone_animation(fra, values, transform_type, -1, id_name(ob_arm), bone->name);
-                       }
+       // exit rest position
+       if (flag & ARM_RESTPOS) {
+               arm->flag &= ~ARM_RESTPOS;
+               where_is_pose(scene, ob_arm);
+       }
+       //v array will hold all values which will be exported. 
+       if (fra.size()) {
+               float *values = (float*)MEM_callocN(sizeof(float) * 3 * fra.size(), "temp. anim frames");
+               sample_animation(values, fra, transform_type, bone, ob_arm, pchan);
 
-                       MEM_freeN(values);
+               if (transform_type == 0) {
+                       // write x, y, z curves separately if it is rotation
+                       float *axisValues = (float*)MEM_callocN(sizeof(float) * fra.size(), "temp. anim frames");   
+
+                       for (int i = 0; i < 3; i++) {
+                               for (unsigned int j = 0; j < fra.size(); j++)
+                                       axisValues[j] = values[j * 3 + i];
+
+                               dae_bone_animation(fra, axisValues, transform_type, i, id_name(ob_arm), bone->name);
+                       }
+                       MEM_freeN(axisValues);
+               }
+               else {
+                       // write xyz at once if it is location or scale
+                       dae_bone_animation(fra, values, transform_type, -1, id_name(ob_arm), bone->name);
                }
 
-               // restore restpos
-               if (flag & ARM_RESTPOS) 
-                       arm->flag = flag;
-               where_is_pose(scene, ob_arm);
+               MEM_freeN(values);
        }
 
-       void AnimationExporter::sample_animation(float *v, std::vector<float> &frames, int type, Bone *bone, Object *ob_arm, bPoseChannel *pchan)
-       {
-               bPoseChannel *parchan = NULL;
-               bPose *pose = ob_arm->pose;
+       // restore restpos
+       if (flag & ARM_RESTPOS) 
+               arm->flag = flag;
+       where_is_pose(scene, ob_arm);
+}
 
-               pchan = get_pose_channel(pose, bone->name);
+void AnimationExporter::sample_animation(float *v, std::vector<float> &frames, int type, Bone *bone, Object *ob_arm, bPoseChannel *pchan)
+{
+       bPoseChannel *parchan = NULL;
+       bPose *pose = ob_arm->pose;
 
-               if (!pchan)
-                       return;
+       pchan = get_pose_channel(pose, bone->name);
 
-               parchan = pchan->parent;
+       if (!pchan)
+               return;
 
-               enable_fcurves(ob_arm->adt->action, bone->name);
+       parchan = pchan->parent;
 
-               std::vector<float>::iterator it;
-               for (it = frames.begin(); it != frames.end(); it++) {
-                       float mat[4][4], ipar[4][4];
+       enable_fcurves(ob_arm->adt->action, bone->name);
 
-                       float ctime = bsystem_time(scene, ob_arm, *it, 0.0f);
+       std::vector<float>::iterator it;
+       for (it = frames.begin(); it != frames.end(); it++) {
+               float mat[4][4], ipar[4][4];
 
+               float ctime = bsystem_time(scene, ob_arm, *it, 0.0f);
 
-                       BKE_animsys_evaluate_animdata(scene , &ob_arm->id, ob_arm->adt, ctime, ADT_RECALC_ANIM);
-                       where_is_pose_bone(scene, ob_arm, pchan, ctime, 1);
 
-                       // compute bone local mat
-                       if (bone->parent) {
-                               invert_m4_m4(ipar, parchan->pose_mat);
-                               mul_m4_m4m4(mat, pchan->pose_mat, ipar);
-                       }
-                       else
-                               copy_m4_m4(mat, pchan->pose_mat);
+               BKE_animsys_evaluate_animdata(scene , &ob_arm->id, ob_arm->adt, ctime, ADT_RECALC_ANIM);
+               where_is_pose_bone(scene, ob_arm, pchan, ctime, 1);
+
+               // compute bone local mat
+               if (bone->parent) {
+                       invert_m4_m4(ipar, parchan->pose_mat);
+                       mul_m4_m4m4(mat, pchan->pose_mat, ipar);
+               }
+               else
+                       copy_m4_m4(mat, pchan->pose_mat);
 
-                       switch (type) {
+               switch (type) {
                        case 0:
                                mat4_to_eul(v, mat);
                                break;
@@ -1289,12 +1289,10 @@ void AnimationExporter::operator() (Object *ob)
                        case 2:
                                copy_v3_v3(v, mat[3]);
                                break;
-                       }
-
-                       v += 3;
                }
 
-               enable_fcurves(ob_arm->adt->action, NULL);
+               v += 3;
        }
 
-
+       enable_fcurves(ob_arm->adt->action, NULL);
+}
index 267ad4be8875b4dd53bc1d022c7643d5f4db92f5..d277dad8e8cda2585dde70bb20c2a5f1952ca0ab 100644 (file)
@@ -160,4 +160,4 @@ protected:
        char* extract_transform_name(char *rna_path);
 
        std::string getObjectBoneName ( Object *ob,const FCurve * fcu);
-};
\ No newline at end of file
+};
index 4a3cd5eeb06678c04f8cf784ce8fff953837c636..db32664f73680694711dba0f8995d82d181206ef 100644 (file)
@@ -89,17 +89,17 @@ void AnimationImporter::animation_to_fcurves(COLLADAFW::AnimationCurve *curve)
 {
        COLLADAFW::FloatOrDoubleArray& input = curve->getInputValues();
        COLLADAFW::FloatOrDoubleArray& output = curve->getOutputValues();
-    
+
        if( curve->getInterpolationType() == COLLADAFW::AnimationCurve::INTERPOLATION_BEZIER ||
                curve->getInterpolationType() == COLLADAFW::AnimationCurve::INTERPOLATION_STEP ) {
-       COLLADAFW::FloatOrDoubleArray& intan = curve->getInTangentValues();
-    COLLADAFW::FloatOrDoubleArray& outtan = curve->getOutTangentValues();
+                       COLLADAFW::FloatOrDoubleArray& intan = curve->getInTangentValues();
+                       COLLADAFW::FloatOrDoubleArray& outtan = curve->getOutTangentValues();
        }
 
        float fps = (float)FPS;
        size_t dim = curve->getOutDimension();
        unsigned int i;
-       
+
        std::vector<FCurve*>& fcurves = curve_map[curve->getUniqueId()];
 
        switch (dim) {
@@ -110,18 +110,18 @@ void AnimationImporter::animation_to_fcurves(COLLADAFW::AnimationCurve *curve)
                {
                        for (i = 0; i < dim; i++ ) {
                                FCurve *fcu = (FCurve*)MEM_callocN(sizeof(FCurve), "FCurve");
-                       
+
                                fcu->flag = (FCURVE_VISIBLE|FCURVE_AUTO_HANDLES|FCURVE_SELECTED);
                                // fcu->rna_path = BLI_strdupn(path, strlen(path));
                                fcu->array_index = 0;
                                fcu->totvert = curve->getKeyCount();
-                       
+
                                // create beztriple for each key
                                for (unsigned int j = 0; j < curve->getKeyCount(); j++) {
                                        BezTriple bez;
                                        memset(&bez, 0, sizeof(BezTriple));
 
-                                       
+
                                        // input, output
                                        bez.vec[1][0] = bc_get_float_value(input, j) * fps; 
                                        bez.vec[1][1] = bc_get_float_value(output, j * dim + i);
@@ -131,20 +131,20 @@ void AnimationImporter::animation_to_fcurves(COLLADAFW::AnimationCurve *curve)
                                                curve->getInterpolationType() == COLLADAFW::AnimationCurve::INTERPOLATION_STEP) 
                                        {
                                                COLLADAFW::FloatOrDoubleArray& intan = curve->getInTangentValues();
-                        COLLADAFW::FloatOrDoubleArray& outtan = curve->getOutTangentValues();
+                                               COLLADAFW::FloatOrDoubleArray& outtan = curve->getOutTangentValues();
 
                                                // intangent
-                                                bez.vec[0][0] = bc_get_float_value(intan, (j * 2 * dim ) + (2 * i)) * fps;
-                                                bez.vec[0][1] = bc_get_float_value(intan, (j * 2 * dim )+ (2 * i) + 1);
+                                               bez.vec[0][0] = bc_get_float_value(intan, (j * 2 * dim ) + (2 * i)) * fps;
+                                               bez.vec[0][1] = bc_get_float_value(intan, (j * 2 * dim )+ (2 * i) + 1);
 
-                                                // outtangent
-                                                bez.vec[2][0] = bc_get_float_value(outtan, (j * 2 * dim ) + (2 * i)) * fps;
-                                                bez.vec[2][1] = bc_get_float_value(outtan, (j * 2 * dim )+ (2 * i) + 1);
-                                                if(curve->getInterpolationType() == COLLADAFW::AnimationCurve::INTERPOLATION_BEZIER) 
+                                               // outtangent
+                                               bez.vec[2][0] = bc_get_float_value(outtan, (j * 2 * dim ) + (2 * i)) * fps;
+                                               bez.vec[2][1] = bc_get_float_value(outtan, (j * 2 * dim )+ (2 * i) + 1);
+                                               if(curve->getInterpolationType() == COLLADAFW::AnimationCurve::INTERPOLATION_BEZIER) 
                                                        bez.ipo = BEZT_IPO_BEZ;
-                                                else 
-                                                        bez.ipo = BEZT_IPO_CONST;
-                                                //bez.h1 = bez.h2 = HD_AUTO;   
+                                               else 
+                                                       bez.ipo = BEZT_IPO_CONST;
+                                               //bez.h1 = bez.h2 = HD_AUTO;    
                                        }
                                        else 
                                        {
@@ -153,7 +153,7 @@ void AnimationImporter::animation_to_fcurves(COLLADAFW::AnimationCurve *curve)
                                        }
                                        // bez.ipo = U.ipo_new; /* use default interpolation mode here... */
                                        bez.f1 = bez.f2 = bez.f3 = SELECT;
-                                       
+
                                        insert_bezt_fcurve(fcu, &bez, 0);
                                }
 
@@ -306,9 +306,9 @@ bool AnimationImporter::write_animation(const COLLADAFW::Animation* anim)
 bool AnimationImporter::write_animation_list(const COLLADAFW::AnimationList* animlist) 
 {
        const COLLADAFW::UniqueId& animlist_id = animlist->getUniqueId();
-    
+
        animlist_map[animlist_id] = animlist;
-    
+
 #if 0
 
        // should not happen
@@ -317,10 +317,10 @@ bool AnimationImporter::write_animation_list(const COLLADAFW::AnimationList* ani
        }
 
        // for bones rna_path is like: pose.bones["bone-name"].rotation
-       
+
 
 #endif
-       
+
        return true;
 }
 
@@ -433,7 +433,7 @@ virtual void AnimationImporter::change_eul_to_quat(Object *ob, bAction *act)
 
 //sets the rna_path and array index to curve
 void AnimationImporter::modify_fcurve(std::vector<FCurve*>* curves , char* rna_path , int array_index )
-{   
+{
        std::vector<FCurve*>::iterator it;
        int i;
        for (it = curves->begin(), i = 0; it != curves->end(); it++, i++) {
@@ -450,18 +450,18 @@ void AnimationImporter::modify_fcurve(std::vector<FCurve*>* curves , char* rna_p
 void AnimationImporter::find_frames( std::vector<float>* frames , std::vector<FCurve*>* curves)
 {
        std::vector<FCurve*>::iterator iter;
-               for (iter = curves->begin(); iter != curves->end(); iter++) {
-                       FCurve *fcu = *iter;
-        
-                       for (unsigned int k = 0; k < fcu->totvert; k++) {
-                               //get frame value from bezTriple
-                               float fra = fcu->bezt[k].vec[1][0];
-                               //if frame already not added add frame to frames
-                               if (std::find(frames->begin(), frames->end(), fra) == frames->end())
-                                       frames->push_back(fra);
-                                                               
-                       }
+       for (iter = curves->begin(); iter != curves->end(); iter++) {
+               FCurve *fcu = *iter;
+
+               for (unsigned int k = 0; k < fcu->totvert; k++) {
+                       //get frame value from bezTriple
+                       float fra = fcu->bezt[k].vec[1][0];
+                       //if frame already not added add frame to frames
+                       if (std::find(frames->begin(), frames->end(), fra) == frames->end())
+                               frames->push_back(fra);
+
                }
+       }
 }
 
 //creates the rna_paths and array indices of fcurves from animations using transformation and bound animation class of each animation.
@@ -472,18 +472,18 @@ void AnimationImporter:: Assign_transform_animations(COLLADAFW::Transformation *
        COLLADAFW::Transformation::TransformationType tm_type = transform->getTransformationType();
        bool is_matrix = tm_type == COLLADAFW::Transformation::MATRIX;
        bool is_rotation = tm_type  == COLLADAFW::Transformation::ROTATE;
-       
+
        //to check if the no of curves are valid
        bool xyz = ((tm_type == COLLADAFW::Transformation::TRANSLATE ||tm_type  == COLLADAFW::Transformation::SCALE) && binding->animationClass == COLLADAFW::AnimationList::POSITION_XYZ);
-                        
-       
+
+
        if (!((!xyz && curves->size() == 1) || (xyz && curves->size() == 3) || is_matrix)) {
                fprintf(stderr, "expected %d curves, got %d\n", xyz ? 3 : 1, (int)curves->size());
                return;
        }
-       
+
        char rna_path[100];
-                                                       
+
        switch (tm_type) {
                case COLLADAFW::Transformation::TRANSLATE:
                case COLLADAFW::Transformation::SCALE:
@@ -495,80 +495,80 @@ void AnimationImporter:: Assign_transform_animations(COLLADAFW::Transformation *
                                        BLI_strncpy(rna_path, loc ? "location" : "scale", sizeof(rna_path));
 
                                switch (binding->animationClass) {
-                                       case COLLADAFW::AnimationList::POSITION_X:
-                                               modify_fcurve(curves, rna_path, 0 );
-                                               break;
-                                       case COLLADAFW::AnimationList::POSITION_Y:
-                                               modify_fcurve(curves, rna_path, 1 );
-                                               break;
-                                       case COLLADAFW::AnimationList::POSITION_Z:
-                                               modify_fcurve(curves, rna_path, 2 );
-                                               break;
-                                       case COLLADAFW::AnimationList::POSITION_XYZ:
-                                               modify_fcurve(curves, rna_path, -1 );
-                                               break;
-                                       default:
-                                               fprintf(stderr, "AnimationClass %d is not supported for %s.\n",
-                                                               binding->animationClass, loc ? "TRANSLATE" : "SCALE");
-                                       }
-               break;
+               case COLLADAFW::AnimationList::POSITION_X:
+                       modify_fcurve(curves, rna_path, 0 );
+                       break;
+               case COLLADAFW::AnimationList::POSITION_Y:
+                       modify_fcurve(curves, rna_path, 1 );
+                       break;
+               case COLLADAFW::AnimationList::POSITION_Z:
+                       modify_fcurve(curves, rna_path, 2 );
+                       break;
+               case COLLADAFW::AnimationList::POSITION_XYZ:
+                       modify_fcurve(curves, rna_path, -1 );
+                       break;
+               default:
+                       fprintf(stderr, "AnimationClass %d is not supported for %s.\n",
+                               binding->animationClass, loc ? "TRANSLATE" : "SCALE");
+                               }
+                               break;
                        }
-               
-               
+
+
                case COLLADAFW::Transformation::ROTATE:
                        {
                                if (is_joint)
                                        BLI_snprintf(rna_path, sizeof(rna_path), "%s.rotation_euler", joint_path);
                                else
                                        BLI_strncpy(rna_path, "rotation_euler", sizeof(rna_path));
-                std::vector<FCurve*>::iterator iter;
+                               std::vector<FCurve*>::iterator iter;
                                for (iter = curves->begin(); iter != curves->end(); iter++) {
                                        FCurve* fcu = *iter;
-                                       
+
                                        //if transform is rotation the fcurves values must be turned in to radian.
                                        if (is_rotation)
                                                fcurve_deg_to_rad(fcu);          
                                }                                       
                                COLLADAFW::Rotate* rot = (COLLADAFW::Rotate*)transform;
                                COLLADABU::Math::Vector3& axis = rot->getRotationAxis();
-                       
+
                                switch (binding->animationClass) {
-                                       case COLLADAFW::AnimationList::ANGLE:
-                                               if (COLLADABU::Math::Vector3::UNIT_X == axis) {
-                                                       modify_fcurve(curves, rna_path, 0 );
-                                               }
-                                               else if (COLLADABU::Math::Vector3::UNIT_Y == axis) {
-                                                       modify_fcurve(curves, rna_path, 1 );
-                                               }
-                                               else if (COLLADABU::Math::Vector3::UNIT_Z == axis) {
-                                                       modify_fcurve(curves, rna_path, 2 );
-                                               }
-                                               break;
-                                       case COLLADAFW::AnimationList::AXISANGLE:
-                                               // TODO convert axis-angle to quat? or XYZ?
-                                       default:
-                                               fprintf(stderr, "AnimationClass %d is not supported for ROTATE transformation.\n",
-                                                               binding->animationClass);
-                                       }
+               case COLLADAFW::AnimationList::ANGLE:
+                       if (COLLADABU::Math::Vector3::UNIT_X == axis) {
+                               modify_fcurve(curves, rna_path, 0 );
+                       }
+                       else if (COLLADABU::Math::Vector3::UNIT_Y == axis) {
+                               modify_fcurve(curves, rna_path, 1 );
+                       }
+                       else if (COLLADABU::Math::Vector3::UNIT_Z == axis) {
+                               modify_fcurve(curves, rna_path, 2 );
+                       }
                        break;
+               case COLLADAFW::AnimationList::AXISANGLE:
+                       // TODO convert axis-angle to quat? or XYZ?
+               default:
+                       fprintf(stderr, "AnimationClass %d is not supported for ROTATE transformation.\n",
+                               binding->animationClass);
+                               }
+                               break;
                        }
-                       
+
                case COLLADAFW::Transformation::MATRIX:
                        /*{
-                               COLLADAFW::Matrix* mat = (COLLADAFW::Matrix*)transform;
-                               COLLADABU::Math::Matrix4 mat4 = mat->getMatrix();
-                               switch (binding->animationClass) {
-                                       case COLLADAFW::AnimationList::TRANSFORM:
-                                       
-                               }
+                       COLLADAFW::Matrix* mat = (COLLADAFW::Matrix*)transform;
+                       COLLADABU::Math::Matrix4 mat4 = mat->getMatrix();
+                       switch (binding->animationClass) {
+                       case COLLADAFW::AnimationList::TRANSFORM:
+
+                       }
                        }*/
                        break;
                case COLLADAFW::Transformation::SKEW:
                case COLLADAFW::Transformation::LOOKAT:
                        fprintf(stderr, "Animation of SKEW and LOOKAT transformations is not supported yet.\n");
                        break;
-               }
-       
+       }
+
 }
 
 //creates the rna_paths and array indices of fcurves from animations using color and bound animation class of each animation.
@@ -576,15 +576,15 @@ void AnimationImporter:: Assign_color_animations(const COLLADAFW::UniqueId& list
 {
        char rna_path[100];
        BLI_strncpy(rna_path,anim_type, sizeof(rna_path));
-    
+
        const COLLADAFW::AnimationList *animlist = animlist_map[listid];
        const COLLADAFW::AnimationList::AnimationBindings& bindings = animlist->getAnimationBindings();
-                               //all the curves belonging to the current binding
-       std::vector<FCurve*> animcurves;    
+       //all the curves belonging to the current binding
+       std::vector<FCurve*> animcurves;
        for (unsigned int j = 0; j < bindings.getCount(); j++) {
-                animcurves = curve_map[bindings[j].animation];
-               
-           switch (bindings[j].animationClass) {
+               animcurves = curve_map[bindings[j].animation];
+
+               switch (bindings[j].animationClass) {
                case COLLADAFW::AnimationList::COLOR_R:
                        modify_fcurve(&animcurves, rna_path, 0 );
                        break;
@@ -598,13 +598,13 @@ void AnimationImporter:: Assign_color_animations(const COLLADAFW::UniqueId& list
                case COLLADAFW::AnimationList::COLOR_RGBA: // to do-> set intensity
                        modify_fcurve(&animcurves, rna_path, -1 );
                        break;
-                       
+
                default:
                        fprintf(stderr, "AnimationClass %d is not supported for %s.\n",
-                                       bindings[j].animationClass, "COLOR" );
+                               bindings[j].animationClass, "COLOR" );
                }
 
-                std::vector<FCurve*>::iterator iter;
+               std::vector<FCurve*>::iterator iter;
                //Add the curves of the current animation to the object
                for (iter = animcurves.begin(); iter != animcurves.end(); iter++) {
                        FCurve * fcu = *iter;
@@ -612,7 +612,7 @@ void AnimationImporter:: Assign_color_animations(const COLLADAFW::UniqueId& list
                }                               
        }
 
-       
+
 }
 
 void AnimationImporter:: Assign_float_animations(const COLLADAFW::UniqueId& listid, ListBase *AnimCurves, char * anim_type)
@@ -625,7 +625,7 @@ void AnimationImporter:: Assign_float_animations(const COLLADAFW::UniqueId& list
                const COLLADAFW::AnimationList *animlist = animlist_map[listid];
                const COLLADAFW::AnimationList::AnimationBindings& bindings = animlist->getAnimationBindings();
                //all the curves belonging to the current binding
-               std::vector<FCurve*> animcurves;    
+               std::vector<FCurve*> animcurves;
                for (unsigned int j = 0; j < bindings.getCount(); j++) {
                         animcurves = curve_map[bindings[j].animation];
                
@@ -671,28 +671,28 @@ void AnimationImporter::apply_matrix_curves( Object * ob, std::vector<FCurve*>&
                copy_m4_m4(rest, bone->arm_mat);
                invert_m4_m4(irest, rest);
        }
-    // new curves to assign matrix transform animation
+       // new curves to assign matrix transform animation
        FCurve *newcu[10]; // if tm_type is matrix, then create 10 curves: 4 rot, 3 loc, 3 scale
        unsigned int totcu = 10 ;
-    const char *tm_str = NULL;
+       const char *tm_str = NULL;
        char rna_path[200];
        for (int i = 0; i < totcu; i++) {
 
                int axis = i;
 
-                       if (i < 4) {
-                               tm_str = "rotation_quaternion";
-                               axis = i;
-                       }
-                       else if (i < 7) {
-                               tm_str = "location";
-                               axis = i - 4;
-                       }
-                       else {
-                               tm_str = "scale";
-                               axis = i - 7;
-                       }
-               
+               if (i < 4) {
+                       tm_str = "rotation_quaternion";
+                       axis = i;
+               }
+               else if (i < 7) {
+                       tm_str = "location";
+                       axis = i - 4;
+               }
+               else {
+                       tm_str = "scale";
+                       axis = i - 7;
+               }
+
 
                if (is_joint)
                        BLI_snprintf(rna_path, sizeof(rna_path), "%s.%s", joint_path, tm_str);
@@ -702,11 +702,11 @@ void AnimationImporter::apply_matrix_curves( Object * ob, std::vector<FCurve*>&
                newcu[i]->totvert = frames.size();
        }
 
-    if (frames.size() == 0)
+       if (frames.size() == 0)
                return;
 
-std::sort(frames.begin(), frames.end());
-               
+       std::sort(frames.begin(), frames.end());
+
        std::vector<float>::iterator it;
 
        // sample values at each frame
@@ -717,7 +717,7 @@ std::sort(frames.begin(), frames.end());
                float matfra[4][4];
 
                unit_m4(matfra);
-        
+
                // calc object-space mat
                evaluate_transform_at_frame(matfra, node, fra);
 
@@ -743,23 +743,23 @@ std::sort(frames.begin(), frames.end());
                }
 
                float  rot[4], loc[3], scale[3];
-        
-                       mat4_to_quat(rot, mat);
-                       /*for ( int i = 0 ; i < 4  ;  i ++ )
-                       {
-                               rot[i] = rot[i] * (180 / M_PI); 
-                       }*/
-                       copy_v3_v3(loc, mat[3]);
-                       mat4_to_size(scale, mat);
-               
+
+               mat4_to_quat(rot, mat);
+               /*for ( int i = 0 ; i < 4  ;  i ++ )
+               {
+               rot[i] = rot[i] * (180 / M_PI); 
+               }*/
+               copy_v3_v3(loc, mat[3]);
+               mat4_to_size(scale, mat);
+
                // add keys
                for (int i = 0; i < totcu; i++) {
-                               if (i < 4)
-                                       add_bezt(newcu[i], fra, rot[i]);
-                               else if (i < 7)
-                                       add_bezt(newcu[i], fra, loc[i - 4]);
-                               else
-                                       add_bezt(newcu[i], fra, scale[i - 7]);
+                       if (i < 4)
+                               add_bezt(newcu[i], fra, rot[i]);
+                       else if (i < 7)
+                               add_bezt(newcu[i], fra, loc[i - 4]);
+                       else
+                               add_bezt(newcu[i], fra, scale[i - 7]);
                }
        }
        verify_adt_action((ID*)&ob->id, 1);
@@ -774,13 +774,13 @@ std::sort(frames.begin(), frames.end());
                        BLI_addtail(curves, newcu[i]);
        }
 
-               if (is_joint) {
-                       bPoseChannel *chan = get_pose_channel(ob->pose, bone_name);
-                       chan->rotmode = ROT_MODE_QUAT;
-               }
-               else {
-                       ob->rotmode = ROT_MODE_QUAT;
-               }
+       if (is_joint) {
+               bPoseChannel *chan = get_pose_channel(ob->pose, bone_name);
+               chan->rotmode = ROT_MODE_QUAT;
+       }
+       else {
+               ob->rotmode = ROT_MODE_QUAT;
+       }
 
        return;
 
@@ -804,24 +804,24 @@ void AnimationImporter::translate_Animations ( COLLADAFW::Node * node ,
 
        bAction * act;
        bActionGroup *grp = NULL;
-    
+
        if ( (animType->transform) != 0 )
        {
-       const char *bone_name = is_joint ? bc_get_joint_name(node) : NULL;
-        char joint_path[200];
+               const char *bone_name = is_joint ? bc_get_joint_name(node) : NULL;
+               char joint_path[200];
 
                if ( is_joint ) 
-               armature_importer->get_rna_path_for_joint(node, joint_path, sizeof(joint_path));
-               
-       
+                       armature_importer->get_rna_path_for_joint(node, joint_path, sizeof(joint_path));
+
+
                if (!ob->adt || !ob->adt->action) act = verify_adt_action((ID*)&ob->id, 1);
                else act = ob->adt->action;
-               
-           //Get the list of animation curves of the object
-           ListBase *AnimCurves = &(act->curves);
+
+               //Get the list of animation curves of the object
+               ListBase *AnimCurves = &(act->curves);
 
                const COLLADAFW::TransformationPointerArray& nodeTransforms = node->getTransformations();
-       
+
                //for each transformation in node 
                for (unsigned int i = 0; i < nodeTransforms.getCount(); i++) {
                        COLLADAFW::Transformation *transform = nodeTransforms[i];
@@ -829,10 +829,10 @@ void AnimationImporter::translate_Animations ( COLLADAFW::Node * node ,
 
                        bool is_rotation = tm_type == COLLADAFW::Transformation::ROTATE;
                        bool is_matrix = tm_type == COLLADAFW::Transformation::MATRIX;
-                               
+
                        const COLLADAFW::UniqueId& listid = transform->getAnimationList();
-               
-                       //check if transformation has animations    
+
+                       //check if transformation has animations
                        if (animlist_map.find(listid) == animlist_map.end()) continue ; 
                        else 
                        {
@@ -840,25 +840,25 @@ void AnimationImporter::translate_Animations ( COLLADAFW::Node * node ,
                                const COLLADAFW::AnimationList *animlist = animlist_map[listid];
                                const COLLADAFW::AnimationList::AnimationBindings& bindings = animlist->getAnimationBindings();
                                //all the curves belonging to the current binding
-                               std::vector<FCurve*> animcurves;    
+                               std::vector<FCurve*> animcurves;
                                for (unsigned int j = 0; j < bindings.getCount(); j++) {
-                                        animcurves = curve_map[bindings[j].animation];
-                                        if ( is_matrix )
-                                                apply_matrix_curves(ob, animcurves, root , node,  transform  );
-                                        else {                         
+                                       animcurves = curve_map[bindings[j].animation];
+                                       if ( is_matrix )
+                                               apply_matrix_curves(ob, animcurves, root , node,  transform  );
+                                       else {                          
                                                //calculate rnapaths and array index of fcurves according to transformation and animation class
-                                                Assign_transform_animations(transform, &bindings[j], &animcurves, is_joint, joint_path ); 
-                                               
-                                                std::vector<FCurve*>::iterator iter;
-                                                       //Add the curves of the current animation to the object
-                                                       for (iter = animcurves.begin(); iter != animcurves.end(); iter++) {
-                                                               FCurve * fcu = *iter;
-                                                               if ((ob->type == OB_ARMATURE))
-                                                                       add_bone_fcurve( ob, node , fcu );
-                                                               else 
-                                                                       BLI_addtail(AnimCurves, fcu);   
-                                                       }
+                                               Assign_transform_animations(transform, &bindings[j], &animcurves, is_joint, joint_path ); 
+
+                                               std::vector<FCurve*>::iterator iter;
+                                               //Add the curves of the current animation to the object
+                                               for (iter = animcurves.begin(); iter != animcurves.end(); iter++) {
+                                                       FCurve * fcu = *iter;
+                                                       if ((ob->type == OB_ARMATURE))
+                                                               add_bone_fcurve( ob, node , fcu );
+                                                       else 
+                                                               BLI_addtail(AnimCurves, fcu);   
                                                }
+                                       }
                                }
                        }
                        if (is_rotation) {
@@ -880,7 +880,7 @@ void AnimationImporter::translate_Animations ( COLLADAFW::Node * node ,
                Lamp * lamp  = (Lamp*) ob->data;
 
                if (!lamp->adt || !lamp->adt->action) act = verify_adt_action((ID*)&lamp->id, 1);
-                                       else act = lamp->adt->action;
+               else act = lamp->adt->action;
 
                ListBase *AnimCurves = &(act->curves);
                const COLLADAFW::InstanceLightPointerArray& nodeLights = node->getInstanceLights();
@@ -892,23 +892,23 @@ void AnimationImporter::translate_Animations ( COLLADAFW::Node * node ,
                        {
                                const COLLADAFW::Color *col =  &(light->getColor());
                                const COLLADAFW::UniqueId& listid = col->getAnimationList();
-                               
+
                                Assign_color_animations(listid, AnimCurves, "color"); 
                        }
                        if ((animType->light & LIGHT_FOA) != 0 )
                        {
                                const COLLADAFW::AnimatableFloat *foa =  &(light->getFallOffAngle());
                                const COLLADAFW::UniqueId& listid = foa->getAnimationList();
-                               
+
                                Assign_float_animations( listid ,AnimCurves, "spot_size"); 
                        }
                        if ( (animType->light & LIGHT_FOE) != 0 )
                        {
                                const COLLADAFW::AnimatableFloat *foe =  &(light->getFallOffExponent());
                                const COLLADAFW::UniqueId& listid = foe->getAnimationList();
-                               
+
                                Assign_float_animations( listid ,AnimCurves, "spot_blend"); 
-                       
+
                        }
                }
        }
@@ -918,7 +918,7 @@ void AnimationImporter::translate_Animations ( COLLADAFW::Node * node ,
                Camera * camera  = (Camera*) ob->data;
 
                if (!camera->adt || !camera->adt->action) act = verify_adt_action((ID*)&camera->id, 1);
-                                       else act = camera->adt->action;
+               else act = camera->adt->action;
 
                ListBase *AnimCurves = &(act->curves);
                const COLLADAFW::InstanceCameraPointerArray& nodeCameras= node->getInstanceCameras();
@@ -957,12 +957,12 @@ void AnimationImporter::translate_Animations ( COLLADAFW::Node * node ,
                }
        }
        if ( animType->material != 0){
-                Material *ma = give_current_material(ob, 1);
-                if (!ma->adt || !ma->adt->action) act = verify_adt_action((ID*)&ma->id, 1);
-                               else act = ma->adt->action;
+               Material *ma = give_current_material(ob, 1);
+               if (!ma->adt || !ma->adt->action) act = verify_adt_action((ID*)&ma->id, 1);
+               else act = ma->adt->action;
 
                ListBase *AnimCurves = &(act->curves);
-               
+
                const COLLADAFW::InstanceGeometryPointerArray& nodeGeoms = node->getInstanceGeometries();
                for (unsigned int i = 0; i < nodeGeoms.getCount(); i++) {
                        const COLLADAFW::MaterialBindingArray& matBinds = nodeGeoms[i]->getMaterialBindings();
@@ -988,7 +988,7 @@ void AnimationImporter::translate_Animations ( COLLADAFW::Node * node ,
                                        const COLLADAFW::UniqueId& listid =  cot->getColor().getAnimationList();
                                        Assign_color_animations( listid, AnimCurves , "specular_color" );
                                }
-                               
+
                                if((animType->material & MATERIAL_DIFF_COLOR) != 0){
                                        const COLLADAFW::ColorOrTexture *cot = &(efc->getDiffuse());
                                        const COLLADAFW::UniqueId& listid =  cot->getColor().getAnimationList();
@@ -1005,15 +1005,15 @@ AnimationImporter::AnimMix* AnimationImporter::get_animation_type ( const COLLAD
                                                                                        std::map<COLLADAFW::UniqueId, const COLLADAFW::Object*> FW_object_map) 
 {
        AnimMix *types = new AnimMix();
-       
+
        const COLLADAFW::TransformationPointerArray& nodeTransforms = node->getTransformations();
-       
+
        //for each transformation in node 
        for (unsigned int i = 0; i < nodeTransforms.getCount(); i++) {
                COLLADAFW::Transformation *transform = nodeTransforms[i];
                const COLLADAFW::UniqueId& listid = transform->getAnimationList();
-               
-               //check if transformation has animations    
+
+               //check if transformation has animations
                if (animlist_map.find(listid) == animlist_map.end()) continue ;
                else 
                {
@@ -1028,9 +1028,9 @@ AnimationImporter::AnimMix* AnimationImporter::get_animation_type ( const COLLAD
                types->light = setAnimType(&(light->getColor()),(types->light), LIGHT_COLOR);
                types->light = setAnimType(&(light->getFallOffAngle()),(types->light), LIGHT_FOA);
                types->light = setAnimType(&(light->getFallOffExponent()),(types->light), LIGHT_FOE);
-               
+
                if ( types->light != 0) break;
-               
+
        }
 
        const COLLADAFW::InstanceCameraPointerArray& nodeCameras = node->getInstanceCameras();
@@ -1039,9 +1039,9 @@ AnimationImporter::AnimMix* AnimationImporter::get_animation_type ( const COLLAD
 
                if ( camera->getCameraType() == COLLADAFW::Camera::PERSPECTIVE )
                {
-                   types->camera = setAnimType(&(camera->getXMag()),(types->camera), CAMERA_XFOV);
+                       types->camera = setAnimType(&(camera->getXMag()),(types->camera), CAMERA_XFOV);
                }
-               else 
+               else
                {
                        types->camera = setAnimType(&(camera->getXMag()),(types->camera), CAMERA_XMAG);
                }
@@ -1063,7 +1063,7 @@ AnimationImporter::AnimMix* AnimationImporter::get_animation_type ( const COLLAD
                        types->material =  setAnimType(&(efc->getShininess()),(types->material), MATERIAL_SHININESS);
                        types->material =  setAnimType(&(efc->getSpecular().getColor()),(types->material), MATERIAL_SPEC_COLOR);
                        types->material =  setAnimType(&(efc->getDiffuse().getColor()),(types->material), MATERIAL_DIFF_COLOR);
-                  // types->material =  setAnimType(&(efc->get()),(types->material), MATERIAL_TRANSPARENCY);
+                       // types->material =  setAnimType(&(efc->get()),(types->material), MATERIAL_TRANSPARENCY);
                        types->material =  setAnimType(&(efc->getIndexOfRefraction()),(types->material), MATERIAL_IOR);
                }
        }
@@ -1101,7 +1101,7 @@ void AnimationImporter::find_frames_old(std::vector<float> * frames, COLLADAFW::
                                
                                const COLLADAFW::AnimationList *animlist = animlist_map[listid];
                                const COLLADAFW::AnimationList::AnimationBindings& bindings = animlist->getAnimationBindings();
-                
+
                                if (bindings.getCount()) {
                                        //for each AnimationBinding get the fcurves which animate the transform
                                        for (unsigned int j = 0; j < bindings.getCount(); j++) {
@@ -1113,7 +1113,7 @@ void AnimationImporter::find_frames_old(std::vector<float> * frames, COLLADAFW::
 
                                                        for (iter = curves.begin(); iter != curves.end(); iter++) {
                                                                FCurve *fcu = *iter;
-                                
+
                                                                //if transform is rotation the fcurves values must be turned in to radian.
                                                                if (is_rotation)
                                                                        fcurve_deg_to_rad(fcu);
@@ -1448,9 +1448,9 @@ bool AnimationImporter::evaluate_animation(COLLADAFW::Transformation *tm, float
        COLLADAFW::Transformation::TransformationType type = tm->getTransformationType();
 
        if (type != COLLADAFW::Transformation::ROTATE &&
-           type != COLLADAFW::Transformation::SCALE &&
-           type != COLLADAFW::Transformation::TRANSLATE &&
-           type != COLLADAFW::Transformation::MATRIX) {
+               type != COLLADAFW::Transformation::SCALE &&
+               type != COLLADAFW::Transformation::TRANSLATE &&
+               type != COLLADAFW::Transformation::MATRIX) {
                fprintf(stderr, "animation of transformation %d is not supported yet\n", type);
                return false;
        }
@@ -1572,7 +1572,7 @@ bool AnimationImporter::evaluate_animation(COLLADAFW::Transformation *tm, float
 
                                COLLADAFW::Matrix tm(matrix);
                                dae_matrix_to_mat4(&tm, mat);
-                
+
                                std::vector<FCurve*>::iterator it;
 
                                return true;
index 18303eb2f0bda524598f4f83cde51e0a25f0a630..ed9a2171c878921f884f5ae09c970536e6fc9574 100644 (file)
@@ -88,7 +88,7 @@ private:
        void add_fcurves_to_object(Object *ob, std::vector<FCurve*>& curves, char *rna_path, int array_index, Animation *animated);
        
        int typeFlag;
-    
+
        enum lightAnim
        {
 //             INANIMATE = 0,
@@ -144,7 +144,7 @@ public:
 #if 0
        virtual void change_eul_to_quat(Object *ob, bAction *act);
 #endif
-  
+
        void translate_Animations( COLLADAFW::Node * Node , 
                                                                                                   std::map<COLLADAFW::UniqueId, COLLADAFW::Node*>& root_map,
                                                                                                   std::map<COLLADAFW::UniqueId, Object*>& object_map ,
@@ -161,7 +161,7 @@ public:
 
        void Assign_color_animations(const COLLADAFW::UniqueId& listid, ListBase *AnimCurves ,char * anim_type);
        void Assign_float_animations(const COLLADAFW::UniqueId& listid, ListBase *AnimCurves, char * anim_type);
-    
+
        int setAnimType ( const COLLADAFW::Animatable * prop , int type, int addition);
        
        void modify_fcurve(std::vector<FCurve*>* curves , char* rna_path , int array_index );
@@ -206,5 +206,5 @@ public:
 
        void extra_data_importer(std::string elementName);
 };
- #endif
+
+#endif
index 92d06bb639f83a0c3bf0834abe4d229cfc43f824..de01c0003731511aa6aa9d3fa5ae768a1a33f4bd 100644 (file)
@@ -188,7 +188,7 @@ void ArmatureExporter::add_bone_node(Bone *bone, Object *ob_arm)
        for (Bone *child = (Bone*)bone->childbase.first; child; child = child->next) {
                add_bone_node(child, ob_arm);
        }
-    node.end();
+       node.end();
        //}
 }
 
index 1e7879b352ff055a5dd32d104cfe3e753507d92d..27aee133557c5a64d2e29a2a615062a26cf41e53 100644 (file)
@@ -87,7 +87,7 @@ void ArmatureImporter::create_unskinned_bone( COLLADAFW::Node *node, EditBone *p
        if ( it != finished_joints.end()) return; 
 
        float mat[4][4];
-    float obmat[4][4];
+       float obmat[4][4];
 
        // object-space
        get_node_mat(obmat, node, NULL, NULL);
@@ -296,7 +296,7 @@ void ArmatureImporter::add_leaf_bone(float mat[][4], EditBone *bone,  COLLADAFW:
                et->setData("tip_z",&z);
                float vec[3] = {x,y,z};
                copy_v3_v3(leaf.bone->tail, leaf.bone->head);
-           add_v3_v3v3(leaf.bone->tail, leaf.bone->head, vec);
+               add_v3_v3v3(leaf.bone->tail, leaf.bone->head, vec);
        }else
                leaf_bones.push_back(leaf);
 }
@@ -310,9 +310,10 @@ void ArmatureImporter::fix_leaf_bones( )
                LeafBone& leaf = *it;
 
                // pointing up
-               float vec[3] = {0.0f, 0.0f, 1.0f};
+               float vec[3] = {0.0f, 0.0f, 0.1f};
                
-               //mul_v3_fl(vec, leaf_bone_length);
+               // if parent: take parent length and direction
+               if(leaf.bone->parent) sub_v3_v3v3(vec, leaf.bone->parent->tail, leaf.bone->parent->head);
 
                copy_v3_v3(leaf.bone->tail, leaf.bone->head);
                add_v3_v3v3(leaf.bone->tail, leaf.bone->head, vec);
index 4f4aed210f20576502b71c9c440a509d97bac81e..a197e612a875ffb363277e6178e225602b1f35e7 100644 (file)
@@ -115,7 +115,7 @@ private:
 
        void fix_leaf_bones();
        
-    void set_pose ( Object * ob_arm ,  COLLADAFW::Node * root_node ,char * parentname, float parent_mat[][4]);
+       void set_pose ( Object * ob_arm ,  COLLADAFW::Node * root_node ,char * parentname, float parent_mat[][4]);
 
 
 #if 0
@@ -171,7 +171,7 @@ public:
        
        // gives a world-space mat
        bool get_joint_bind_mat(float m[][4], COLLADAFW::Node *joint);
-    
+
        void set_tags_map( TagsMap& tags_map);
        
 };
index 285ab283b372b691033a5cadf39cd07e9ae26b77..6e780889d16130d4dc98df4fee00e6d639d26bab 100644 (file)
@@ -328,9 +328,7 @@ void DocumentExporter::exportCurrentScene(Scene *sce, const char* filename, bool
        //scale = RNA_struct_find_property(&unit_settings, "scale_length");
 
        std::string unitname = "meter";
-       float linearmeasure = 1.0f;
-
-       linearmeasure = RNA_float_get(&unit_settings, "scale_length");
+       float linearmeasure = RNA_float_get(&unit_settings, "scale_length");
 
        switch(RNA_property_enum_get(&unit_settings, system)) {
                case USER_UNIT_NONE:
@@ -368,8 +366,7 @@ void DocumentExporter::exportCurrentScene(Scene *sce, const char* filename, bool
 
        asset.setUnit(unitname, linearmeasure);
        asset.setUpAxisType(COLLADASW::Asset::Z_UP);
-       // TODO: need an Author field in userpref
-       if(strlen(U.author) > 0) {
+       if(U.author[0] != '\0') {
                asset.getContributor().mAuthor = U.author;
        }
        else {
index a60ef8b2ea5cc23865b03e5dbb922781ef6d5547..820665ad7571b4c7edb4da757507854047405360 100644 (file)
@@ -56,7 +56,7 @@ bool ExtraHandler::textData(const char* text, size_t textLength)
 {
        char buf[1024];
        
-       if(currentElement.length() == 0) return false;
+       if(currentElement.length() == 0 || currentExtraTags == 0) return false;
        
        BLI_snprintf(buf, textLength+1, "%s", text);
        currentExtraTags->addTag(currentElement, std::string(buf));
index 653d4a377cd91956364d998da0463fc4072afba1..f0c6d2228b1156bde4c96e1af38177b26ea40cc0 100644 (file)
@@ -90,32 +90,28 @@ std::string ExtraTags::asString( std::string tag, bool *ok)
 void ExtraTags::setData(std::string tag, short *data)
 {
        bool ok = false;
-       int tmp = 0;
-       tmp = asInt(tag, &ok);
+       int tmp = asInt(tag, &ok);
        if(ok)
                *data = (short)tmp;
 }
 void ExtraTags::setData(std::string tag, int *data)
 {
        bool ok = false;
-       int tmp = 0;
-       tmp = asInt(tag, &ok);
+       int tmp = asInt(tag, &ok);
        if(ok)
                *data = tmp;
 }
 void ExtraTags::setData(std::string tag, float *data)
 {
        bool ok = false;
-       float tmp = 0.0f;
-       tmp = asFloat(tag, &ok);
+       float tmp = asFloat(tag, &ok);
        if(ok)
                *data = tmp;
 }
 void ExtraTags::setData(std::string tag, char *data)
 {
        bool ok = false;
-       int tmp = 0;
-       tmp = asInt(tag, &ok);
+       int tmp = asInt(tag, &ok);
        if(ok)
                *data = (char)tmp;
 }
index 760fb2359a4588eff8af71957a2baf9b0a2cd831..e9086f0562800f0abc96fb0415fa0973ff81a340 100644 (file)
@@ -220,8 +220,8 @@ void MeshImporter::set_face_uv(MTFace *mtface, UVDataWrapper &uvs,
 
        if (quad) uvs.getUV(indices[index + 3], mtface->uv[3]);
 
-#ifdef COLLADA_DEBUG
-       /*if (quad) {
+#if 1 // #ifdef COLLADA_DEBUG
+       if (quad) {
                fprintf(stderr, "face uv:\n"
                                "((%d, %d, %d, %d))\n"
                                "((%.1f, %.1f), (%.1f, %.1f), (%.1f, %.1f), (%.1f, %.1f))\n",
@@ -248,7 +248,7 @@ void MeshImporter::set_face_uv(MTFace *mtface, UVDataWrapper &uvs,
                                mtface->uv[0][0], mtface->uv[0][1],
                                mtface->uv[1][0], mtface->uv[1][1],
                                mtface->uv[2][0], mtface->uv[2][1]);
-       }*/
+       }
 #endif
 }
 
@@ -411,7 +411,7 @@ int MeshImporter::count_new_tris(COLLADAFW::Mesh *mesh, Mesh *me)
 }
 
 // TODO: import uv set names
-void MeshImporter::read_faces(COLLADAFW::Mesh *mesh, Mesh *me, int new_tris)        //TODO:: Refactor. Possibly replace by iterators
+void MeshImporter::read_faces(COLLADAFW::Mesh *mesh, Mesh *me, int new_tris) //TODO:: Refactor. Possibly replace by iterators
 {
        unsigned int i;
        
@@ -587,7 +587,7 @@ void MeshImporter::read_faces(COLLADAFW::Mesh *mesh, Mesh *me, int new_tris)
                                        for (k = 0; k < index_list_array.getCount(); k++) {
                                                // get mtface by face index and uv set index
                                                MTFace *mtface = (MTFace*)CustomData_get_layer_n(&me->fdata, CD_MTFACE, k);
-                                               set_face_uv(&mtface[face_index], uvs, *index_list_array[k], index, mface->v4 != 0);
+                                               set_face_uv(&mtface[face_index], uvs, *index_list_array[k], index, vcount == 4);
                                        }
 #endif
 
index ce0d561c524dc6c54c0516854ed46087998972ee..1d890415ebe81f105192cee1eb440e14e57154b8 100644 (file)
@@ -266,9 +266,9 @@ void SkinInfo::link_armature(bContext *C, Object *ob, std::map<COLLADAFW::Unique
        // ^ bone index can be -1 meaning weight toward bind shape, how to express this in Blender?
 
        // for each vertex in weight indices
-       //   for each bone index in vertex
-       //     add vertex to group at group index
-       //     treat group index -1 specially
+       //      for each bone index in vertex
+       //              add vertex to group at group index
+       //              treat group index -1 specially
 
        // get def group by index with BLI_findlink
 
index 7bad9bdeba7e094fdda229bd377c74064ce4d93e..88ed112c3fe3a22926d425bf303a62b57e5c0f57 100644 (file)
@@ -50,7 +50,7 @@ void TransformWriter::add_node_transform(COLLADASW::Node& node, float mat[][4],
 
        double dmat[4][4];
        UnitConverter* converter = new UnitConverter();
-    converter->mat4_to_dae_double(dmat,local);
+       converter->mat4_to_dae_double(dmat,local);
 
        TransformBase::decompose(local, loc, rot, NULL, scale);
        if ( node.getType() == COLLADASW::Node::JOINT)
index 8010a41ccb334c87e1bd58cf9ef0312a7258f514..bb710a3279420bef13fb01152246db120960f81b 100644 (file)
@@ -1177,29 +1177,34 @@ static size_t animfilter_nla (bAnimContext *UNUSED(ac), ListBase *anim_data, bDo
 /* determine what animation data from AnimData block should get displayed */
 static size_t animfilter_block_data (bAnimContext *ac, ListBase *anim_data, bDopeSheet *ads, ID *id, int filter_mode)
 {
-       IdAdtTemplate *iat = (IdAdtTemplate*)id;
        AnimData *adt = BKE_animdata_from_id(id);
        size_t items = 0;
-       
-       /* NOTE: this macro is used instead of inlining the logic here, since this sort of filtering is still needed 
-        * in a few places in he rest of the code still - notably for the few cases where special mode-based 
-        * different types of data expanders are required.
-        */
-       ANIMDATA_FILTER_CASES(iat,
-               { /* AnimData */
-                       /* specifically filter animdata block */
-                       ANIMCHANNEL_NEW_CHANNEL(adt, ANIMTYPE_ANIMDATA, id);
-               },
-               { /* NLA */
-                       items += animfilter_nla(ac, anim_data, ads, adt, filter_mode, id); 
-               },
-               { /* Drivers */
-                       items += animfilter_fcurves(anim_data, ads, adt->drivers.first, NULL, filter_mode, id);
-               },
-               { /* Keyframes */
-                       items += animfilter_action(ac, anim_data, ads, adt->action, filter_mode, id);
-               });
-       
+
+       /* image object datablocks have no anim-data so check for NULL */
+       if(adt) {
+               IdAdtTemplate *iat = (IdAdtTemplate*)id;
+
+               /* NOTE: this macro is used instead of inlining the logic here, since this sort of filtering is still needed
+                * in a few places in he rest of the code still - notably for the few cases where special mode-based
+                * different types of data expanders are required.
+                */
+               ANIMDATA_FILTER_CASES(iat,
+                       { /* AnimData */
+                               /* specifically filter animdata block */
+                               ANIMCHANNEL_NEW_CHANNEL(adt, ANIMTYPE_ANIMDATA, id);
+                       },
+                       { /* NLA */
+                               items += animfilter_nla(ac, anim_data, ads, adt, filter_mode, id);
+                       },
+                       { /* Drivers */
+                               items += animfilter_fcurves(anim_data, ads, adt->drivers.first, NULL, filter_mode, id);
+                       },
+                       { /* Keyframes */
+                               items += animfilter_action(ac, anim_data, ads, adt->action, filter_mode, id);
+                       }
+               );
+       }
+
        return items;
 }
 
index 4e87409b7fd01d8aeced8b8086ac363004191686..53c9fc4d82c7807db1a2b67a168474c466d6cb53 100644 (file)
@@ -530,6 +530,7 @@ static short visualkey_can_use (PointerRNA *ptr, PropertyRNA *prop)
 {
        bConstraint *con= NULL;
        short searchtype= VISUALKEY_NONE;
+       short has_parent = FALSE;
        char *identifier= NULL;
        
        /* validate data */
@@ -548,6 +549,7 @@ static short visualkey_can_use (PointerRNA *ptr, PropertyRNA *prop)
                
                con= ob->constraints.first;
                identifier= (char *)RNA_property_identifier(prop);
+               has_parent= (ob->parent != NULL);
        }
        else if (ptr->type == &RNA_PoseBone) {
                /* Pose Channel */
@@ -555,10 +557,11 @@ static short visualkey_can_use (PointerRNA *ptr, PropertyRNA *prop)
                
                con= pchan->constraints.first;
                identifier= (char *)RNA_property_identifier(prop);
+               has_parent= (pchan->parent != NULL);
        }
        
        /* check if any data to search using */
-       if (ELEM(NULL, con, identifier))
+       if (ELEM(NULL, con, identifier) && (has_parent == FALSE))
                return 0;
                
        /* location or rotation identifiers only... */
@@ -573,7 +576,12 @@ static short visualkey_can_use (PointerRNA *ptr, PropertyRNA *prop)
        
        
        /* only search if a searchtype and initial constraint are available */
-       if (searchtype && con) {
+       if (searchtype) {
+               /* parent is always matching */
+               if (has_parent)
+                       return 1;
+               
+               /* constraints */
                for (; con; con= con->next) {
                        /* only consider constraint if it is not disabled, and has influence */
                        if (con->flag & CONSTRAINT_DISABLE) continue;
@@ -645,39 +653,34 @@ static float visualkey_get_value (PointerRNA *ptr, PropertyRNA *prop, int array_
        if (ptr->type == &RNA_Object) {
                Object *ob= (Object *)ptr->data;
                
-               /* parented objects are not supported, as the effects of the parent
-                * are included in the matrix, which kindof beats the point
-                */
-               if (ob->parent == NULL) {
-                       /* only Location or Rotation keyframes are supported now */
-                       if (strstr(identifier, "location")) {
-                               return ob->obmat[3][array_index];
-                       }
-                       else if (strstr(identifier, "rotation_euler")) {
-                               float eul[3];
-                               
-                               mat4_to_eulO(eul, ob->rotmode, ob->obmat);
-                               return eul[array_index];
-                       }
-                       else if (strstr(identifier, "rotation_quaternion")) {
-                               float trimat[3][3], quat[4];
-                               
-                               copy_m3_m4(trimat, ob->obmat);
-                               mat3_to_quat_is_ok(quat, trimat);
-                               
-                               return quat[array_index];
-                       }
-                       else if (strstr(identifier, "rotation_axis_angle")) {
-                               float axis[3], angle;
-                               
-                               mat4_to_axis_angle(axis, &angle, ob->obmat);
-                               
-                               /* w = 0, x,y,z = 1,2,3 */
-                               if (array_index == 0)
-                                       return angle;
-                               else
-                                       return axis[array_index - 1];
-                       }
+               /* only Location or Rotation keyframes are supported now */
+               if (strstr(identifier, "location")) {
+                       return ob->obmat[3][array_index];
+               }
+               else if (strstr(identifier, "rotation_euler")) {
+                       float eul[3];
+                       
+                       mat4_to_eulO(eul, ob->rotmode, ob->obmat);
+                       return eul[array_index];
+               }
+               else if (strstr(identifier, "rotation_quaternion")) {
+                       float trimat[3][3], quat[4];
+                       
+                       copy_m3_m4(trimat, ob->obmat);
+                       mat3_to_quat_is_ok(quat, trimat);
+                       
+                       return quat[array_index];
+               }
+               else if (strstr(identifier, "rotation_axis_angle")) {
+                       float axis[3], angle;
+                       
+                       mat4_to_axis_angle(axis, &angle, ob->obmat);
+                       
+                       /* w = 0, x,y,z = 1,2,3 */
+                       if (array_index == 0)
+                               return angle;
+                       else
+                               return axis[array_index - 1];
                }
        }
        else if (ptr->type == &RNA_PoseBone) {
index 76ed9891b8e5d62c07f7b0cd563e66abe0c4889d..2267f04aab4b7120df4216d4eaf0748f9e7c1598 100644 (file)
@@ -770,7 +770,11 @@ void ui_draw_but_HISTOGRAM(ARegion *ar, uiBut *but, uiWidgetColors *UNUSED(wcol)
        glColor4f(0.f, 0.f, 0.f, 0.3f);
        uiSetRoundBox(15);
        uiDrawBox(GL_POLYGON, rect.xmin-1, rect.ymin-1, rect.xmax+1, rect.ymax+1, 3.0f);
-       
+
+       /* need scissor test, histogram can draw outside of boundary */
+       glGetIntegerv(GL_VIEWPORT, scissor);
+       glScissor(ar->winrct.xmin + (rect.xmin-1), ar->winrct.ymin+(rect.ymin-1), (rect.xmax+1)-(rect.xmin-1), (rect.ymax+1)-(rect.ymin-1));
+
        glColor4f(1.f, 1.f, 1.f, 0.08f);
        /* draw grid lines here */
        for (i=1; i<4; i++) {
@@ -778,10 +782,6 @@ void ui_draw_but_HISTOGRAM(ARegion *ar, uiBut *but, uiWidgetColors *UNUSED(wcol)
                fdrawline(rect.xmin+(i/4.f)*w, rect.ymin, rect.xmin+(i/4.f)*w, rect.ymax);
        }
        
-       /* need scissor test, histogram can draw outside of boundary */
-       glGetIntegerv(GL_VIEWPORT, scissor);
-       glScissor(ar->winrct.xmin + (rect.xmin-1), ar->winrct.ymin+(rect.ymin-1), (rect.xmax+1)-(rect.xmin-1), (rect.ymax+1)-(rect.ymin-1));
-       
        if (hist->mode == HISTO_MODE_LUMA)
                histogram_draw_one(1.0, 1.0, 1.0, 0.75, rect.xmin, rect.ymin, w, h, hist->data_luma, res);
        else {
index 132db6caaeb6856e5285b0eb306e2b1f8a807a4b..7673bd8f31c35fce5385c8d8c11ea05a9cac50a5 100644 (file)
@@ -1099,7 +1099,7 @@ void load_editMesh(Scene *scene, Object *obedit)
                int j;
 
                for (ob=G.main->object.first; ob; ob=ob->id.next) {
-                       if (ob->parent==ob && ELEM(ob->partype, PARVERT1,PARVERT3)) {
+                       if (ob->parent==obedit && ELEM(ob->partype, PARVERT1,PARVERT3)) {
                                
                                /* duplicate code from below, make it function later...? */
                                if (!vertMap) {
index b7ed6ec14caa41d26313f74612aed551a908369a..0afa2d01702fdea13c3f5d68d9f1e777e1f1cc69 100644 (file)
@@ -1141,6 +1141,9 @@ short extrudeflag_face_indiv(EditMesh *em, short UNUSED(flag), float *UNUSED(nor
        
        EM_select_flush(em);
        
+       /* step 5; update normals after extrude */
+       recalc_editnormals(em);
+
        return 'n';
 }
 
@@ -1206,6 +1209,9 @@ short extrudeflag_edges_indiv(EditMesh *em, short flag, float *nor)
                if(eed->v1->f & eed->v2->f & flag) eed->f |= flag;
        }
        
+       /* update normals after extrude */
+       recalc_editnormals(em);
+
        if(is_zero_v3(nor)) return 'g'; // g is grab
        return 'n';  // n is for normal constraint
 }
@@ -1485,6 +1491,9 @@ static short extrudeflag_edge(Object *obedit, EditMesh *em, short UNUSED(flag),
 
        EM_select_flush(em);
 
+       /* step 8; update normals after extrude */
+       recalc_editnormals(em);
+
        if(is_zero_v3(nor)) return 'g'; // grab
        return 'n'; // normal constraint 
 }
index 5212bf32834dccd68704fb7b63d81ec88f6d099d..fa529374bf783990ad929ec7b52d6d0a7146a823 100644 (file)
@@ -276,8 +276,10 @@ int ED_object_add_generic_get_opts(bContext *C, wmOperator *op, float *loc, floa
                RNA_boolean_set(op->ptr, "view_align", view_align);
        }
        
-       if (view_align)
+       if (view_align) {
                ED_object_rotation_from_view(C, rot);
+               RNA_float_set_array(op->ptr, "rotation", rot);
+       }
        else
                RNA_float_get_array(op->ptr, "rotation", rot);
        
index ee162464c70402dcfdcf8847c5119936bf8576f7..07c006a7995c8440d89ddb88b423fce2b71cc821 100644 (file)
@@ -159,7 +159,7 @@ typedef struct {
 static void multiresbake_get_normal(const MResolvePixelData *data, float norm[], const int face_num, const int vert_index)
 {
        unsigned int indices[]= {data->mface[face_num].v1, data->mface[face_num].v2,
-                             data->mface[face_num].v3, data->mface[face_num].v4};
+                                data->mface[face_num].v3, data->mface[face_num].v4};
        const int smoothnormal= (data->mface[face_num].flag & ME_SMOOTH);
 
        if(!smoothnormal)  { /* flat */
index 61734bc51a2ae23f47c23e317b83ebe7a4c9695e..79cbfb6574be67471ceb2440066f20e7bd64dcd3 100644 (file)
@@ -1411,6 +1411,8 @@ static int forcefield_toggle_exec(bContext *C, wmOperator *UNUSED(op))
        else
                ob->pd->forcefield = 0;
        
+       WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, NULL);
+
        return OPERATOR_FINISHED;
 }
 
index bb32869469ac74b21bd22e6f5e1f20b048bd51b6..266556773f09c22a2e6fb6655641d79c343ab318 100644 (file)
@@ -64,6 +64,7 @@
 
 #include "ED_curve.h"
 #include "ED_mesh.h"
+#include "ED_lattice.h"
 #include "ED_screen.h"
 
 #include "WM_types.h"
@@ -292,7 +293,7 @@ static int return_editcurve_indexar(Object *obedit, int *tot, int **indexar, flo
        return totvert;
 }
 
-static int object_hook_index_array(Object *obedit, int *tot, int **indexar, char *name, float *cent_r)
+static int object_hook_index_array(Scene *scene, Object *obedit, int *tot, int **indexar, char *name, float *cent_r)
 {
        *indexar= NULL;
        *tot= 0;
@@ -302,7 +303,12 @@ static int object_hook_index_array(Object *obedit, int *tot, int **indexar, char
                case OB_MESH:
                {
                        Mesh *me= obedit->data;
-                       EditMesh *em = BKE_mesh_get_editmesh(me);
+                       EditMesh *em;
+
+                       load_editMesh(scene, obedit);
+                       make_editMesh(scene, obedit);
+
+                       em = BKE_mesh_get_editmesh(me);
 
                        /* check selected vertices first */
                        if( return_editmesh_indexar(em, tot, indexar, cent_r)) {
@@ -316,10 +322,17 @@ static int object_hook_index_array(Object *obedit, int *tot, int **indexar, char
                }
                case OB_CURVE:
                case OB_SURF:
+                       load_editNurb(obedit);
+                       make_editNurb(obedit);
+
                        return return_editcurve_indexar(obedit, tot, indexar, cent_r);
                case OB_LATTICE:
                {
                        Lattice *lt= obedit->data;
+
+                       load_editLatt(obedit);
+                       make_editLatt(obedit);
+
                        return return_editlattice_indexar(lt->editlatt->latt, tot, indexar, cent_r);
                }
                default:
@@ -427,7 +440,7 @@ static void add_hook_object(Main *bmain, Scene *scene, Object *obedit, Object *o
        int tot, ok, *indexar;
        char name[32];
        
-       ok = object_hook_index_array(obedit, &tot, &indexar, name, cent);
+       ok = object_hook_index_array(scene, obedit, &tot, &indexar, name, cent);
        
        if (!ok) return;        // XXX error("Requires selected vertices or active Vertex Group");
        
@@ -760,7 +773,7 @@ static int object_hook_assign_exec(bContext *C, wmOperator *op)
        
        /* assign functionality */
        
-       if(!object_hook_index_array(ob, &tot, &indexar, name, cent)) {
+       if(!object_hook_index_array(CTX_data_scene(C), ob, &tot, &indexar, name, cent)) {
                BKE_report(op->reports, RPT_WARNING, "Requires selected vertices or active vertex group");
                return OPERATOR_CANCELLED;
        }
index e9418ca9f9f995d2c922b44026b5c7719369a648..b9208e778c7e52d80e4deea3776bf0e25c03305d 100644 (file)
@@ -91,6 +91,8 @@
 
 #include "ED_armature.h"
 #include "ED_curve.h"
+#include "ED_lattice.h"
+#include "ED_mesh.h"
 #include "ED_keyframing.h"
 #include "ED_object.h"
 #include "ED_screen.h"
@@ -122,7 +124,12 @@ static int vertex_parent_set_exec(bContext *C, wmOperator *op)
        
        if(obedit->type==OB_MESH) {
                Mesh *me= obedit->data;
-               EditMesh *em = BKE_mesh_get_editmesh(me);
+               EditMesh *em;
+
+               load_editMesh(scene, obedit);
+               make_editMesh(scene, obedit);
+
+               em = BKE_mesh_get_editmesh(me);
 
                eve= em->verts.first;
                while(eve) {
@@ -140,7 +147,12 @@ static int vertex_parent_set_exec(bContext *C, wmOperator *op)
                BKE_mesh_end_editmesh(me, em);
        }
        else if(ELEM(obedit->type, OB_SURF, OB_CURVE)) {
-               ListBase *editnurb= curve_get_editcurve(obedit);
+               ListBase *editnurb;
+
+               load_editNurb(obedit);
+               make_editNurb(obedit);
+
+               editnurb= curve_get_editcurve(obedit);
                
                cu= obedit->data;
 
@@ -180,8 +192,13 @@ static int vertex_parent_set_exec(bContext *C, wmOperator *op)
                }
        }
        else if(obedit->type==OB_LATTICE) {
-               Lattice *lt= obedit->data;
-               
+               Lattice *lt;
+
+               load_editLatt(obedit);
+               make_editLatt(obedit);
+
+               lt= obedit->data;
+
                a= lt->editlatt->latt->pntsu*lt->editlatt->latt->pntsv*lt->editlatt->latt->pntsw;
                bp= lt->editlatt->latt->def;
                while(a--) {
index e66abffbfd1ac74e61296f8b8f04f734d646829b..70884d47c236f6104a75385e21dc48c03b8f535b 100644 (file)
@@ -221,6 +221,7 @@ void SOUND_OT_open_mono(wmOperatorType *ot)
 
 static int mixdown_exec(bContext *C, wmOperator *op)
 {
+#ifdef WITH_AUDASPACE
        char path[FILE_MAX];
        char filename[FILE_MAX];
        Scene *scene;
@@ -254,7 +255,10 @@ static int mixdown_exec(bContext *C, wmOperator *op)
                BKE_report(op->reports, RPT_ERROR, result);
                return OPERATOR_CANCELLED;
        }
-
+#else // WITH_AUDASPACE
+       (void)C;
+       (void)op;
+#endif // WITH_AUDASPACE
        return OPERATOR_FINISHED;
 }
 
@@ -278,6 +282,7 @@ static int mixdown_draw_check_prop(PropertyRNA *prop)
        );
 }
 
+#ifdef WITH_AUDASPACE
 static void mixdown_draw(bContext *C, wmOperator *op)
 {
        static EnumPropertyItem pcm_format_items[] = {
@@ -429,9 +434,11 @@ static void mixdown_draw(bContext *C, wmOperator *op)
        /* main draw call */
        uiDefAutoButsRNA(layout, &ptr, mixdown_draw_check_prop, '\0');
 }
+#endif // WITH_AUDASPACE
 
 void SOUND_OT_mixdown(wmOperatorType *ot)
 {
+#ifdef WITH_AUDASPACE
        static EnumPropertyItem format_items[] = {
                {AUD_FORMAT_U8, "U8", 0, "U8", "8 bit unsigned"},
                {AUD_FORMAT_S16, "S16", 0, "S16", "16 bit signed"},
@@ -469,6 +476,8 @@ void SOUND_OT_mixdown(wmOperatorType *ot)
                {AUD_CODEC_VORBIS, "VORBIS", 0, "Vorbis", "Xiph.Org Vorbis Codec"},
                {0, NULL, 0, NULL, NULL}};
 
+#endif // WITH_AUDASPACE
+
        /* identifiers */
        ot->name= "Mixdown";
        ot->description= "Mixes the scene's audio to a sound file";
@@ -477,18 +486,22 @@ void SOUND_OT_mixdown(wmOperatorType *ot)
        /* api callbacks */
        ot->exec= mixdown_exec;
        ot->invoke= mixdown_invoke;
-       ot->ui= mixdown_draw;
 
+#ifdef WITH_AUDASPACE
+       ot->ui= mixdown_draw;
+#endif
        /* flags */
        ot->flag= OPTYPE_REGISTER;
 
        /* properties */
        WM_operator_properties_filesel(ot, FOLDERFILE|SOUNDFILE, FILE_SPECIAL, FILE_SAVE, WM_FILESEL_FILEPATH);
+#ifdef WITH_AUDASPACE
        RNA_def_int(ot->srna, "accuracy", 1024, 1, 16777216, "Accuracy", "Sample accuracy. Important for animation data. The lower the value, the more accurate.", 1, 16777216);
        RNA_def_enum(ot->srna, "container", container_items, AUD_CONTAINER_FLAC, "Container", "File format");
        RNA_def_enum(ot->srna, "codec", codec_items, AUD_CODEC_FLAC, "Codec", "Audio Codec");
        RNA_def_enum(ot->srna, "format", format_items, AUD_FORMAT_S16, "Format", "Sample format");
        RNA_def_int(ot->srna, "bitrate", 192, 32, 512, "Bitrate", "Bitrate in kbit/s", 32, 512);
+#endif // WITH_AUDASPACE
 }
 
 /* ******************************************************* */
index d58b78ff6a7db0e160045b01afb6a8c071951ba6..68f9e4d033e704b1003eec4e7feab18d81005302 100644 (file)
@@ -960,20 +960,19 @@ static int save_image_options_init(SaveImageOptions *simopts, SpaceImage *sima,
 
        if(ibuf) {
                Image *ima= sima->image;
-               RenderResult *rr= BKE_image_acquire_renderresult(scene, ima);
 
                simopts->planes= ibuf->depth;
 
-               /* cant save multilayer sequence, ima->rr isn't valid for a specific frame */
-               if(rr && !(ima->source==IMA_SRC_SEQUENCE && ima->type==IMA_TYPE_MULTILAYER))
-                       simopts->imtype= R_MULTILAYER;
-               else if(ima->type==IMA_TYPE_R_RESULT)
+               if(ELEM(ima->type, IMA_TYPE_R_RESULT, IMA_TYPE_COMPOSITE)) {
                        simopts->imtype= scene->r.imtype;
-               else if (ima->source == IMA_SRC_GENERATED)
+                       simopts->planes= scene->r.planes;
+               }
+               else if (ima->source == IMA_SRC_GENERATED) {
                        simopts->imtype= R_PNG;
-               else
+               }
+               else {
                        simopts->imtype= BKE_ftype_to_imtype(ibuf->ftype);
-
+               }
                simopts->subimtype= scene->r.subimtype; /* XXX - this is lame, we need to make these available too! */
                simopts->quality= ibuf->ftype & 0xff;
 
@@ -1000,8 +999,6 @@ static int save_image_options_init(SaveImageOptions *simopts, SpaceImage *sima,
                        }
                        BLI_path_abs(simopts->filepath, G.main->name);
                }
-               /* cleanup */
-               BKE_image_release_renderresult(scene, ima);
        }
 
        ED_space_image_release_buffer(sima, lock);
@@ -1016,7 +1013,10 @@ static void save_image_options_from_op(SaveImageOptions *simopts, wmOperator *op
        // if (RNA_property_is_set(op->ptr, "subimtype")) simopts->subimtype= RNA_enum_get(op->ptr, "subimtype"); // XXX
        if (RNA_property_is_set(op->ptr, "file_quality")) simopts->quality= RNA_int_get(op->ptr, "file_quality");
 
-       if (RNA_property_is_set(op->ptr, "filepath")) RNA_string_get(op->ptr, "filepath", simopts->filepath);
+       if (RNA_property_is_set(op->ptr, "filepath")) {
+               RNA_string_get(op->ptr, "filepath", simopts->filepath);
+               BLI_path_abs(simopts->filepath, G.main->name);
+       }
 }
 
 static void save_image_options_to_op(SaveImageOptions *simopts, wmOperator *op)
@@ -1069,7 +1069,7 @@ static void save_image_doit(bContext *C, SpaceImage *sima, wmOperator *op, SaveI
                        Scene *scene= CTX_data_scene(C);
                        RenderResult *rr= BKE_image_acquire_renderresult(scene, ima);
                        if(rr) {
-                               RE_WriteRenderResult(rr, simopts->filepath, simopts->quality);
+                               RE_WriteRenderResult(op->reports, rr, simopts->filepath, simopts->quality);
                                ok= TRUE;
                        }
                        else {
index 882d89fcd33c975c950e825603321a4b095a07c4..920e93cc0fc1bc8d413b99a09e1ce65d0351e1df 100644 (file)
@@ -3677,7 +3677,7 @@ static void draw_actuator_action(uiLayout *layout, PointerRNA *ptr)
 {
        Object *ob = (Object *)ptr->id.data;
        PointerRNA settings_ptr;
-       uiLayout *row, *subrow, *col;;
+       uiLayout *row, *subrow, *col;
 
        RNA_pointer_create((ID *)ob, &RNA_GameObjectSettings, ob, &settings_ptr);
 
index c32d05e9c30b4ebfaa791e8de6ff233a5ea3ddf4..0474d1f3bb1a36928a168b9626098787cdcde96c 100644 (file)
@@ -1385,7 +1385,7 @@ static void node_texture_set_butfunc(bNodeType *ntype)
                default:
                        ntype->uifunc= NULL;
        }
-        if (ntype->uifuncbut == NULL) ntype->uifuncbut = ntype->uifunc;
+       if (ntype->uifuncbut == NULL) ntype->uifuncbut = ntype->uifunc;
 }
 
 /* ******* init draw callbacks for all tree types, only called in usiblender.c, once ************* */
index 0cb05fa211502423fda7049163c06916e214964d..95a315272b97b0155624a17e18639505418e90db 100644 (file)
@@ -236,7 +236,7 @@ static int group_select_flag(Group *gr)
        return 0;
 }
 
-static void restrictbutton_gr_restrict_flag(void *poin, void *poin2, int flag)
+void restrictbutton_gr_restrict_flag(void *poin, void *poin2, int flag)
 {      
        Scene *scene = (Scene *)poin;           
        GroupObject *gob;
index fbd5281b1d94d4bb12e9d93477df0a0fcb1871f6..2b451a487489b26ec7fe024b10a0cb1e26b254de 100644 (file)
@@ -218,6 +218,34 @@ void OUTLINER_OT_item_openclose(wmOperatorType *ot)
 
 /* Rename --------------------------------------------------- */
 
+void do_item_rename(ARegion *ar, TreeElement *te, TreeStoreElem *tselem, ReportList *reports)
+{
+       /* can't rename rna datablocks entries */
+       if(ELEM3(tselem->type, TSE_RNA_STRUCT, TSE_RNA_PROPERTY, TSE_RNA_ARRAY_ELEM))
+                       ;
+       else if(ELEM10(tselem->type, TSE_ANIM_DATA, TSE_NLA, TSE_DEFGROUP_BASE, TSE_CONSTRAINT_BASE, TSE_MODIFIER_BASE, TSE_SCRIPT_BASE, TSE_POSE_BASE, TSE_POSEGRP_BASE, TSE_R_LAYER_BASE, TSE_R_PASS)) 
+                       BKE_report(reports, RPT_WARNING, "Cannot edit builtin name");
+       else if(ELEM3(tselem->type, TSE_SEQUENCE, TSE_SEQ_STRIP, TSE_SEQUENCE_DUP))
+               BKE_report(reports, RPT_WARNING, "Cannot edit sequence name");
+       else if(tselem->id->lib) {
+               // XXX                                          error_libdata();
+       } 
+       else if(te->idcode == ID_LI && te->parent) {
+               BKE_report(reports, RPT_WARNING, "Cannot edit the path of an indirectly linked library");
+       } 
+       else {
+               tselem->flag |= TSE_TEXTBUT;
+               ED_region_tag_redraw(ar);
+       }
+}
+
+void item_rename_cb(bContext *C, Scene *UNUSED(scene), TreeElement *te, TreeStoreElem *UNUSED(tsep), TreeStoreElem *tselem)
+{
+       ARegion *ar= CTX_wm_region(C);
+       ReportList *reports= CTX_wm_reports(C); // XXX
+       do_item_rename(ar, te, tselem, reports) ;
+}
+
 static int do_outliner_item_rename(bContext *C, ARegion *ar, SpaceOops *soops, TreeElement *te, const float mval[2])
 {      
        ReportList *reports= CTX_wm_reports(C); // XXX
@@ -228,23 +256,7 @@ static int do_outliner_item_rename(bContext *C, ARegion *ar, SpaceOops *soops, T
                /* name and first icon */
                if(mval[0]>te->xs+UI_UNIT_X && mval[0]<te->xend) {
                        
-                       /* can't rename rna datablocks entries */
-                       if(ELEM3(tselem->type, TSE_RNA_STRUCT, TSE_RNA_PROPERTY, TSE_RNA_ARRAY_ELEM))
-                          ;
-                       else if(ELEM10(tselem->type, TSE_ANIM_DATA, TSE_NLA, TSE_DEFGROUP_BASE, TSE_CONSTRAINT_BASE, TSE_MODIFIER_BASE, TSE_SCRIPT_BASE, TSE_POSE_BASE, TSE_POSEGRP_BASE, TSE_R_LAYER_BASE, TSE_R_PASS)) 
-                                       BKE_report(reports, RPT_WARNING, "Cannot edit builtin name");
-                       else if(ELEM3(tselem->type, TSE_SEQUENCE, TSE_SEQ_STRIP, TSE_SEQUENCE_DUP))
-                               BKE_report(reports, RPT_WARNING, "Cannot edit sequence name");
-                       else if(tselem->id->lib) {
-                               // XXX                                          error_libdata();
-                       } 
-                       else if(te->idcode == ID_LI && te->parent) {
-                               BKE_report(reports, RPT_WARNING, "Cannot edit the path of an indirectly linked library");
-                       } 
-                       else {
-                               tselem->flag |= TSE_TEXTBUT;
-                               ED_region_tag_redraw(ar);
-                       }
+                       do_item_rename(ar, te, tselem, reports) ;
                }
                return 1;
        }
@@ -377,6 +389,12 @@ void object_toggle_visibility_cb(bContext *C, Scene *scene, TreeElement *te, Tre
        }
 }
 
+void group_toggle_visibility_cb(bContext *UNUSED(C), Scene *scene, TreeElement *UNUSED(te), TreeStoreElem *UNUSED(tsep), TreeStoreElem *tselem)
+{
+       Group *group= (Group *)tselem->id;
+       restrictbutton_gr_restrict_flag(scene, group, OB_RESTRICT_VIEW);
+}
+
 static int outliner_toggle_visibility_exec(bContext *C, wmOperator *UNUSED(op))
 {
        SpaceOops *soops= CTX_wm_space_outliner(C);
@@ -417,6 +435,12 @@ void object_toggle_selectability_cb(bContext *UNUSED(C), Scene *scene, TreeEleme
        }
 }
 
+void group_toggle_selectability_cb(bContext *UNUSED(C), Scene *scene, TreeElement *UNUSED(te), TreeStoreElem *UNUSED(tsep), TreeStoreElem *tselem)
+{
+       Group *group= (Group *)tselem->id;
+       restrictbutton_gr_restrict_flag(scene, group, OB_RESTRICT_SELECT);
+}
+
 static int outliner_toggle_selectability_exec(bContext *C, wmOperator *UNUSED(op))
 {
        SpaceOops *soops= CTX_wm_space_outliner(C);
@@ -457,6 +481,12 @@ void object_toggle_renderability_cb(bContext *UNUSED(C), Scene *scene, TreeEleme
        }
 }
 
+void group_toggle_renderability_cb(bContext *UNUSED(C), Scene *scene, TreeElement *UNUSED(te), TreeStoreElem *UNUSED(tsep), TreeStoreElem *tselem)
+{
+       Group *group= (Group *)tselem->id;
+       restrictbutton_gr_restrict_flag(scene, group, OB_RESTRICT_RENDER);
+}
+
 static int outliner_toggle_renderability_exec(bContext *C, wmOperator *UNUSED(op))
 {
        SpaceOops *soops= CTX_wm_space_outliner(C);
index 9da0914412507971d09bbc858e435c49a7b280c8..61507d1ffe588d47a7a5aebaedf493b99e9f0cbb 100644 (file)
@@ -129,6 +129,7 @@ typedef struct TreeElement {
 /* outliner_tree.c ----------------------------------------------- */
 
 void outliner_free_tree(ListBase *lb);
+void outliner_cleanup_tree(struct SpaceOops *soops);
 
 TreeElement *outliner_find_tse(struct SpaceOops *soops, TreeStoreElem *tse);
 TreeElement *outliner_find_id(struct SpaceOops *soops, ListBase *lb, struct ID *id);
@@ -139,6 +140,7 @@ void outliner_build_tree(struct Main *mainvar, struct Scene *scene, struct Space
 /* outliner_draw.c ---------------------------------------------- */
 
 void draw_outliner(const struct bContext *C);
+void restrictbutton_gr_restrict_flag(void *poin, void *poin2, int flag);
 
 /* outliner_select.c -------------------------------------------- */
 int tree_element_type_active(struct bContext *C, struct Scene *scene, struct SpaceOops *soops, TreeElement *te, TreeStoreElem *tselem, int set);
@@ -158,6 +160,13 @@ void object_toggle_visibility_cb(struct bContext *C, struct Scene *scene, TreeEl
 void object_toggle_selectability_cb(struct bContext *C, struct Scene *scene, TreeElement *te, struct TreeStoreElem *tsep, struct TreeStoreElem *tselem);
 void object_toggle_renderability_cb(struct bContext *C, struct Scene *scene, TreeElement *te, struct TreeStoreElem *tsep, struct TreeStoreElem *tselem);
 
+
+void group_toggle_visibility_cb(struct bContext *C, struct Scene *scene, TreeElement *te, struct TreeStoreElem *tsep, struct TreeStoreElem *tselem);
+void group_toggle_selectability_cb(struct bContext *C, struct Scene *scene, TreeElement *te, struct TreeStoreElem *tsep, struct TreeStoreElem *tselem);
+void group_toggle_renderability_cb(struct bContext *C, struct Scene *scene, TreeElement *te, struct TreeStoreElem *tsep, struct TreeStoreElem *tselem);
+
+void item_rename_cb(struct bContext *C, struct Scene *scene, TreeElement *te, struct TreeStoreElem *tsep, struct TreeStoreElem *tselem);
+
 /* ...................................................... */
 
 void OUTLINER_OT_item_activate(struct wmOperatorType *ot);
index 3ae158bd275aa41485e17443a520d127956658a3..b3170f9cd1e34e1fc8fcf7d58666d4a632ad282e 100644 (file)
@@ -287,6 +287,8 @@ static void object_delete_cb(bContext *C, Scene *scene, TreeElement *te, TreeSto
        if(base==NULL) 
                base= object_in_scene((Object *)tselem->id, scene);
        if(base) {
+               SpaceOops *soops= CTX_wm_space_outliner(C);
+
                // check also library later
                if(scene->obedit==base->object) 
                        ED_object_exit_editmode(C, EM_FREEDATA|EM_FREEUNDO|EM_WAITCURSOR|EM_DO_UNDO);
@@ -294,6 +296,13 @@ static void object_delete_cb(bContext *C, Scene *scene, TreeElement *te, TreeSto
                ED_base_object_free_and_unlink(CTX_data_main(C), scene, base);
                te->directdata= NULL;
                tselem->id= NULL;
+
+               /* XXX: tree management normally happens from draw_outliner(), but when
+                       you're clicking to fast on Delete object from context menu in
+                       outliner several mouse events can be handled in one cycle without
+                       handling notifiers/redraw which leads to deleting the same object twice.
+                       cleanup tree here to prevent such cases. */
+               outliner_cleanup_tree(soops);
        }
 
 }
@@ -510,6 +519,7 @@ static EnumPropertyItem prop_object_op_types[] = {
        {6, "TOGVIS", 0, "Toggle Visible", ""},
        {7, "TOGSEL", 0, "Toggle Selectable", ""},
        {8, "TOGREN", 0, "Toggle Renderable", ""},
+       {9, "RENAME", 0, "Rename", ""},
        {0, NULL, 0, NULL, NULL}
 };
 
@@ -567,6 +577,10 @@ static int outliner_object_operation_exec(bContext *C, wmOperator *op)
                str= "Toggle Renderability";
                WM_event_add_notifier(C, NC_SCENE|ND_OB_RENDER, scene);
        }
+       else if(event==9) {
+               outliner_do_object_operation(C, scene, soops, &soops->tree, item_rename_cb);
+               str= "Rename Object";
+       }
 
        ED_undo_push(C, str);
        
@@ -600,6 +614,7 @@ static EnumPropertyItem prop_group_op_types[] = {
        {4, "TOGVIS", 0, "Toggle Visible", ""},
        {5, "TOGSEL", 0, "Toggle Selectable", ""},
        {6, "TOGREN", 0, "Toggle Renderable", ""},
+       {7, "RENAME", 0, "Rename", ""},
        {0, NULL, 0, NULL, NULL}
 };
 
@@ -608,6 +623,7 @@ static int outliner_group_operation_exec(bContext *C, wmOperator *op)
        Scene *scene= CTX_data_scene(C);
        SpaceOops *soops= CTX_wm_space_outliner(C);
        int event;
+       const char *str= NULL;
        
        /* check for invalid states */
        if (soops == NULL)
@@ -617,18 +633,35 @@ static int outliner_group_operation_exec(bContext *C, wmOperator *op)
        
        if(event==1) {
                outliner_do_libdata_operation(C, scene, soops, &soops->tree, unlink_group_cb);
-               ED_undo_push(C, "Unlink group");
+               str= "Unlink group";
        }
        else if(event==2) {
                outliner_do_libdata_operation(C, scene, soops, &soops->tree, id_local_cb);
-               ED_undo_push(C, "Localized Data");
+               str= "Localized Data";
        }
        else if(event==3) {
                outliner_do_libdata_operation(C, scene, soops, &soops->tree, group_linkobs2scene_cb);
-               ED_undo_push(C, "Link Group Objects to Scene");
+               str= "Link Group Objects to Scene";
+       }
+       else if(event==4) {
+               outliner_do_libdata_operation(C, scene, soops, &soops->tree, group_toggle_visibility_cb);
+               str= "Toggle Visibility";
+       }
+       else if(event==5) {
+               outliner_do_libdata_operation(C, scene, soops, &soops->tree, group_toggle_selectability_cb);
+               str= "Toggle Selectability";
+       }
+       else if(event==6) {
+               outliner_do_libdata_operation(C, scene, soops, &soops->tree, group_toggle_renderability_cb);
+               str= "Toggle Renderability";
+       }
+       else if(event==7) {
+               outliner_do_libdata_operation(C, scene, soops, &soops->tree, item_rename_cb);
+               str= "Rename";
        }
        
        
+       ED_undo_push(C, str);
        WM_event_add_notifier(C, NC_GROUP, NULL);
        
        return OPERATOR_FINISHED;
@@ -662,7 +695,8 @@ typedef enum eOutlinerIdOpTypes {
        OUTLINER_IDOP_SINGLE,
        
        OUTLINER_IDOP_FAKE_ADD,
-       OUTLINER_IDOP_FAKE_CLEAR
+       OUTLINER_IDOP_FAKE_CLEAR,
+       OUTLINER_IDOP_RENAME
 } eOutlinerIdOpTypes;
 
 // TODO: implement support for changing the ID-block used
@@ -672,6 +706,7 @@ static EnumPropertyItem prop_id_op_types[] = {
        {OUTLINER_IDOP_SINGLE, "SINGLE", 0, "Make Single User", ""},
        {OUTLINER_IDOP_FAKE_ADD, "ADD_FAKE", 0, "Add Fake User", "Ensure datablock gets saved even if it isn't in use (e.g. for motion and material libraries)"},
        {OUTLINER_IDOP_FAKE_CLEAR, "CLEAR_FAKE", 0, "Clear Fake User", ""},
+       {OUTLINER_IDOP_RENAME, "RENAME", 0, "Rename", ""},
        {0, NULL, 0, NULL, NULL}
 };
 
@@ -765,6 +800,14 @@ static int outliner_id_operation_exec(bContext *C, wmOperator *op)
                        ED_undo_push(C, "Clear Fake User");
                }
                        break;
+               case OUTLINER_IDOP_RENAME:
+                       /* rename */
+                       outliner_do_libdata_operation(C, scene, soops, &soops->tree, item_rename_cb);
+
+                       WM_event_add_notifier(C, NC_ID|NA_EDITED, NULL);
+                       ED_undo_push(C, "Rename");
+
+                       break;
                        
                default:
                        // invalid - unhandled
index 0b07c824f3e4e39e5f1dc16b8b0cc4da5149fff4..8904dcc360fc53e7b5da808879e2f8347e24bcc5 100644 (file)
@@ -222,6 +222,12 @@ void outliner_free_tree(ListBase *lb)
        }
 }
 
+void outliner_cleanup_tree(SpaceOops *soops)
+{
+       outliner_free_tree(&soops->tree);
+       outliner_storage_cleanup(soops);
+}
+
 /* Find ith item from the treestore */
 static TreeElement *outliner_find_tree_element(ListBase *lb, int store_index)
 {
index c7d4d78422e440c616bbb3e254e565ba2c0da37e..47f051e1ec40b0174298abbfc900883e908d949f 100644 (file)
@@ -154,6 +154,11 @@ static void text_listener(ScrArea *sa, wmNotifier *wmn)
                                case NA_REMOVED:
                                        ED_area_tag_redraw(sa);
                                        break;
+                               case NA_SELECTED:
+                                       if(st->text && st->text == wmn->reference)
+                                               text_scroll_to_cursor(st, sa);
+
+                                       break;
                        }
 
                        break;
index 28230b7a48b9d2ea2227c890e4ead7acd5a000df..066404f23baa731ca7c6115f7675d8bd80d7e0f4 100644 (file)
@@ -1821,12 +1821,10 @@ void text_update_character_width(SpaceText *st)
 
 /* Moves the view to the cursor location,
   also used to make sure the view isnt outside the file */
-void text_update_cursor_moved(bContext *C)
+void text_scroll_to_cursor(SpaceText *st, ScrArea *sa)
 {
-       ScrArea *sa= CTX_wm_area(C);
-       SpaceText *st= CTX_wm_space_text(C);
        Text *text;
-       ARegion *ar;
+       ARegion *ar= NULL;
        int i, x, winx= 0;
 
        if(ELEM3(NULL, st, st->text, st->text->curl)) return;
@@ -1834,8 +1832,10 @@ void text_update_cursor_moved(bContext *C)
        text= st->text;
 
        for(ar=sa->regionbase.first; ar; ar= ar->next)
-               if(ar->regiontype==RGN_TYPE_WINDOW)
+               if(ar->regiontype==RGN_TYPE_WINDOW) {
                        winx= ar->winx;
+                       break;
+               }
        
        winx -= TXT_SCROLL_WIDTH;
 
@@ -1844,7 +1844,7 @@ void text_update_cursor_moved(bContext *C)
        i= txt_get_span(text->lines.first, text->sell);
        if(st->wordwrap) {
                int offl, offc;
-               wrap_offset(st, CTX_wm_region(C), text->sell, text->selc, &offl, &offc);
+               wrap_offset(st, ar, text->sell, text->selc, &offl, &offc);
                i+= offl;
        }
 
@@ -1865,3 +1865,10 @@ void text_update_cursor_moved(bContext *C)
        if(st->left <0) st->left= 0;
 }
 
+void text_update_cursor_moved(bContext *C)
+{
+       ScrArea *sa= CTX_wm_area(C);
+       SpaceText *st= CTX_wm_space_text(C);
+
+       text_scroll_to_cursor(st, sa);
+}
index cb55f41acb51c11ba5aead947a0ba4089baf2caa..b34c7815f3506919ef0356da7d2db0dd6bad8357 100644 (file)
@@ -55,6 +55,7 @@ int text_font_width(struct SpaceText *st, const char *str);
 void text_update_line_edited(struct TextLine *line);
 void text_update_edited(struct Text *text);
 void text_update_character_width(struct SpaceText *st);
+void text_scroll_to_cursor(struct SpaceText *st, struct ScrArea *sa);
 void text_update_cursor_moved(struct bContext *C);
 
        /* TXT_OFFSET used to be 35 when the scrollbar was on the left... */
index e9ed5dac3de009ddded51b2381f9df7a773f3a96..19e8d42db2d6ea94c8625e81c4c970c155cc7ce7 100644 (file)
@@ -3475,7 +3475,7 @@ void ED_view3d_from_m4(float mat[][4], float ofs[3], float quat[4], float *dist)
                copy_m3_m4(nmat, mat);
                normalize_m3(nmat);
 
-               mul_m3_v3(nmat, vec);;
+               mul_m3_v3(nmat, vec);
                sub_v3_v3(ofs, vec);
        }
 }
index c48459108ebd67d93103bd0b2875620d1223a8f7..44ae6837aa2ab7c8f3cd9f4b75e986a5c6f916e8 100644 (file)
@@ -625,8 +625,8 @@ void ED_view3d_win_to_3d(ARegion *ar, const float depth_pt[3], const float mval[
                }
        }
        else {
-        const float dx= (2.0f * mval[0] / (float)ar->winx) - 1.0f;
-        const float dy= (2.0f * mval[1] / (float)ar->winy) - 1.0f;
+               const float dx= (2.0f * mval[0] / (float)ar->winx) - 1.0f;
+               const float dy= (2.0f * mval[1] / (float)ar->winy) - 1.0f;
                line_sta[0]= (rv3d->persinv[0][0] * dx) + (rv3d->persinv[1][0] * dy) + rv3d->viewinv[3][0];
                line_sta[1]= (rv3d->persinv[0][1] * dx) + (rv3d->persinv[1][1] * dy) + rv3d->viewinv[3][1];
                line_sta[2]= (rv3d->persinv[0][2] * dx) + (rv3d->persinv[1][2] * dy) + rv3d->viewinv[3][2];
index 1fbe8e01fd4137d5128e05132c8076585947531c..2c926f2d94b1c0f12286f03c40a70e79d9f89bca 100644 (file)
@@ -499,7 +499,7 @@ void IMB_rectfill_area(struct ImBuf *ibuf, float *col, int x1, int y1, int x2, i
 void IMB_rectfill_alpha(struct ImBuf *ibuf, const float value);
 
 /* this should not be here, really, we needed it for operating on render data, IMB_rectfill_area calls it */
-void buf_rectfill_area(unsigned char *rect, float *rectf, int width, int height, float *col, int x1, int y1, int x2, int y2);
+void buf_rectfill_area(unsigned char *rect, float *rectf, int width, int height, const float col[4], int x1, int y1, int x2, int y2);
 
 /* defined in metadata.c */
 int IMB_metadata_change_field(struct ImBuf *img, const char *key, const char *field);
index 7b172008bee7282e153050529c889a0780c566e8..c4fe1523e90c51f61b569d5f1b7f43bd60da89f5 100644 (file)
@@ -922,7 +922,7 @@ static int ffmpeg_decode_video_frame(struct anim * anim)
 static void ffmpeg_decode_video_frame_scan(
        struct anim * anim, int64_t pts_to_search)
 {
-        /* there seem to exist *very* silly GOP lengths out in the wild... */
+       /* there seem to exist *very* silly GOP lengths out in the wild... */
        int count = 1000;
 
        av_log(anim->pFormatCtx,
index 2def0d042b762905b5e1e68f5fa746a45441e976..d1202136d56ccb61cda77664fb1d57905e7d653b 100644 (file)
@@ -30,8 +30,8 @@
 #include <time.h>
 
 typedef struct indexer_dv_bitstream {
-        unsigned char* buffer;
-        int bit_pos;
+       unsigned char* buffer;
+       int bit_pos;
 } indexer_dv_bitstream;
 
 static indexer_dv_bitstream bitstream_new(unsigned char* buffer_) 
@@ -57,41 +57,41 @@ static unsigned long bitstream_get_bits(indexer_dv_bitstream * This, int num)
 }
 
 static int parse_num(indexer_dv_bitstream * b, int numbits) {
-        return bitstream_get_bits(b, numbits);
+       return bitstream_get_bits(b, numbits);
 }
 
 static int parse_bcd(indexer_dv_bitstream * b, int n) 
 {
-        char s[256];
+       char s[256];
        char * p = s + (n+3)/4;
 
        *p-- = 0;
 
-        while (n > 4) {
-                char a;
-                int v = bitstream_get_bits(b, 4);
+       while (n > 4) {
+               char a;
+               int v = bitstream_get_bits(b, 4);
 
-                n -= 4;
+               n -= 4;
                a = '0' + v;
 
-                if (a > '9') {
-                       bitstream_get_bits(b, n); 
+               if (a > '9') {
+                       bitstream_get_bits(b, n);
                        return -1;
-                }
+               }
 
                *p-- = a;
-        }
-        if (n) {
-                char a;
-                int v = bitstream_get_bits(b, n);
-                a = '0' + v;
-                if (a > '9') {
+       }
+       if (n) {
+               char a;
+               int v = bitstream_get_bits(b, n);
+               a = '0' + v;
+               if (a > '9') {
                        return -1;
-                }
-                *p-- = a;
-        }
+               }
+               *p-- = a;
+       }
 
-        return atol(s);
+       return atol(s);
 }
 
 typedef struct indexer_dv_context
@@ -125,124 +125,124 @@ typedef struct indexer_dv_context
 
 static void parse_packet(indexer_dv_context * This, unsigned char * p)
 {
-        indexer_dv_bitstream b;
-        int type = p[0];
+       indexer_dv_bitstream b;
+       int type = p[0];
 
        b = bitstream_new(p + 1);
 
-        switch (type) {
-        case 0x62: // Record date
-                parse_num(&b, 8);
-                This->rec_curr_day = parse_bcd(&b, 6);
-                parse_num(&b, 2);
-                This->rec_curr_month = parse_bcd(&b, 5);
-                parse_num(&b, 3);
-                This->rec_curr_year = parse_bcd(&b, 8);
-                if (This->rec_curr_year < 25) {
-                        This->rec_curr_year += 2000;
-                } else {
-                        This->rec_curr_year += 1900;
-                }
-                This->got_record_date = 1;
-                break;
-        case 0x63: // Record time
-                This->rec_curr_frame = parse_bcd(&b, 6);
-                parse_num(&b, 2);
-                This->rec_curr_second = parse_bcd(&b, 7);
-                parse_num(&b, 1);
-                This->rec_curr_minute = parse_bcd(&b, 7);
-                parse_num(&b, 1);
-                This->rec_curr_hour = parse_bcd(&b, 6);
-                This->got_record_time = 1;
-                break;
-        }
+       switch (type) {
+               case 0x62: // Record date
+                       parse_num(&b, 8);
+                       This->rec_curr_day = parse_bcd(&b, 6);
+                       parse_num(&b, 2);
+                       This->rec_curr_month = parse_bcd(&b, 5);
+                       parse_num(&b, 3);
+                       This->rec_curr_year = parse_bcd(&b, 8);
+                       if (This->rec_curr_year < 25) {
+                               This->rec_curr_year += 2000;
+                       } else {
+                               This->rec_curr_year += 1900;
+                       }
+                       This->got_record_date = 1;
+                       break;
+               case 0x63: // Record time
+                       This->rec_curr_frame = parse_bcd(&b, 6);
+                       parse_num(&b, 2);
+                       This->rec_curr_second = parse_bcd(&b, 7);
+                       parse_num(&b, 1);
+                       This->rec_curr_minute = parse_bcd(&b, 7);
+                       parse_num(&b, 1);
+                       This->rec_curr_hour = parse_bcd(&b, 6);
+                       This->got_record_time = 1;
+                       break;
+       }
 }
 
 static void parse_header_block(indexer_dv_context * This, unsigned char* target)
 {
        int i;
-        for (i = 3; i < 80; i += 5) {
-                  if (target[i] != 0xff) {
-                          parse_packet(This, target + i);
-                  }
-        }
+       for (i = 3; i < 80; i += 5) {
+               if (target[i] != 0xff) {
+                       parse_packet(This, target + i);
+               }
+       }
 }
 
 static void parse_subcode_blocks(
-       indexer_dv_context * This, unsigned char* target)
+        indexer_dv_context * This, unsigned char* target)
 {
        int i,j;
 
-        for (j = 0; j < 2; j++) {
-                for (i = 3; i < 80; i += 5) {
-                        if (target[i] != 0xff) {
-                                parse_packet(This, target + i);
-                        }
-                }
-        }
+       for (j = 0; j < 2; j++) {
+               for (i = 3; i < 80; i += 5) {
+                       if (target[i] != 0xff) {
+                               parse_packet(This, target + i);
+                       }
+               }
+       }
 }
 
 static void parse_vaux_blocks(
-       indexer_dv_context * This, unsigned char* target)
+        indexer_dv_context * This, unsigned char* target)
 {
        int i,j;
 
-        for (j = 0; j < 3; j++) {
-                for (i = 3; i < 80; i += 5) {
-                        if (target[i] != 0xff) {
-                                parse_packet(This, target + i);
-                        }
-                }
-                target += 80;
-        }
+       for (j = 0; j < 3; j++) {
+               for (i = 3; i < 80; i += 5) {
+                       if (target[i] != 0xff) {
+                               parse_packet(This, target + i);
+                       }
+               }
+               target += 80;
+       }
 }
 
 static void parse_audio_headers(
-       indexer_dv_context * This, unsigned char* target)
+        indexer_dv_context * This, unsigned char* target)
 {
        int i;
 
-        for(i = 0; i < 9; i++) {
-                if (target[3] != 0xff) {
-                        parse_packet(This, target + 3);
-                }
-                target += 16 * 80;
-        }
+       for(i = 0; i < 9; i++) {
+               if (target[3] != 0xff) {<