diff options
author | Campbell Barton <ideasman42@gmail.com> | 2011-09-01 04:56:21 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2011-09-01 04:56:21 +0400 |
commit | fb3f7d95664dd71a545061ddf8d75726ff423c10 (patch) | |
tree | 49fa13b4c511d05070ad7f359f2b646ba33dbb09 | |
parent | 9bc92b21468f1d0fee77e7aac34145f3f0345dfc (diff) | |
parent | 22676a434efdb99e38535b2f4a2623ea670ebf4d (diff) |
svn merge -r39792:39829 https://svn.blender.org/svnroot/bf-blender/trunk/blender
93 files changed, 489 insertions, 510 deletions
diff --git a/build_files/scons/config/darwin-config.py b/build_files/scons/config/darwin-config.py index 06abaf468dd..102ec73a4e3 100644 --- a/build_files/scons/config/darwin-config.py +++ b/build_files/scons/config/darwin-config.py @@ -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': diff --git a/build_files/scons/config/win32-vc-config.py b/build_files/scons/config/win32-vc-config.py index 2f8fa297667..2950ca9380f 100644 --- a/build_files/scons/config/win32-vc-config.py +++ b/build_files/scons/config/win32-vc-config.py @@ -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' diff --git a/build_files/scons/tools/Blender.py b/build_files/scons/tools/Blender.py index 94d09732be7..c537e435de8 100644 --- a/build_files/scons/tools/Blender.py +++ b/build_files/scons/tools/Blender.py @@ -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) diff --git a/build_files/scons/tools/btools.py b/build_files/scons/tools/btools.py index d222c0bcc18..be059241727 100644 --- a/build_files/scons/tools/btools.py +++ b/build_files/scons/tools/btools.py @@ -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)), diff --git a/doc/python_api/rst/bge.render.rst b/doc/python_api/rst/bge.render.rst index 10514049a8a..eeb50a833ff 100644 --- a/doc/python_api/rst/bge.render.rst +++ b/doc/python_api/rst/bge.render.rst @@ -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. diff --git a/doc/python_api/rst/bge.types.rst b/doc/python_api/rst/bge.types.rst index d1fc8593e42..d9a93a945ed 100644 --- a/doc/python_api/rst/bge.types.rst +++ b/doc/python_api/rst/bge.types.rst @@ -1542,59 +1542,63 @@ Game Types (bge.types) .. 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/sphinx_doc_gen.py b/doc/python_api/sphinx_doc_gen.py index 6d29c57c91f..e378dd19e73 100644 --- a/doc/python_api/sphinx_doc_gen.py +++ b/doc/python_api/sphinx_doc_gen.py @@ -1222,7 +1222,6 @@ def rna2sphinx(BASEPATH): shutil.copy2(os.path.join(BASEPATH, "..", "rst", "change_log.rst"), BASEPATH) - if not EXCLUDE_INFO_DOCS: for info, info_desc in INFO_DOCS: shutil.copy2(os.path.join(BASEPATH, "..", "rst", info), BASEPATH) diff --git a/intern/audaspace/CMakeLists.txt b/intern/audaspace/CMakeLists.txt index 8b7cb1d9e69..25510ebd2a5 100644 --- a/intern/audaspace/CMakeLists.txt +++ b/intern/audaspace/CMakeLists.txt @@ -116,6 +116,7 @@ set(SRC intern/AUD_ReadDevice.h intern/AUD_Reference.h intern/AUD_ReferenceHandler.cpp + intern/AUD_ResampleFactory.h intern/AUD_ResampleReader.cpp intern/AUD_ResampleReader.h intern/AUD_SequencerEntry.cpp diff --git a/intern/audaspace/intern/AUD_DefaultMixer.cpp b/intern/audaspace/intern/AUD_DefaultMixer.cpp deleted file mode 100644 index 20471d6e874..00000000000 --- a/intern/audaspace/intern/AUD_DefaultMixer.cpp +++ /dev/null @@ -1,77 +0,0 @@ -/* - * $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_DefaultMixer.cpp - * \ingroup audaspaceintern - */ - - -#include "AUD_DefaultMixer.h" -#ifdef WITH_SAMPLERATE -#include "AUD_SRCResampleReader.h" -#else -#include "AUD_LinearResampleReader.h" -#endif -#include "AUD_ChannelMapperReader.h" -#include "AUD_ChannelMapperFactory.h" - -#include <cstring> - -AUD_DefaultMixer::AUD_DefaultMixer(AUD_DeviceSpecs specs) : - AUD_Mixer(specs) -{ -} - -AUD_IReader* AUD_DefaultMixer::prepare(AUD_IReader* reader) -{ - // hacky for now, until a better channel mapper reader is available - AUD_ChannelMapperFactory cmf(NULL, m_specs); - - AUD_Specs specs = reader->getSpecs(); - - // if channel count is lower in output, rechannel before resampling - if(specs.channels < m_specs.channels) - { - reader = new AUD_ChannelMapperReader(reader, - cmf.getMapping(specs.channels)); - specs.channels = m_specs.channels; - } - - // resample - if(specs.rate != m_specs.rate) -#ifdef WITH_SAMPLERATE - reader = new AUD_SRCResampleReader(reader, m_specs.specs); -#else - reader = new AUD_LinearResampleReader(reader, m_specs.specs); -#endif - - // rechannel - if(specs.channels != m_specs.channels) - reader = new AUD_ChannelMapperReader(reader, - cmf.getMapping(specs.channels)); - - return reader; -} diff --git a/intern/audaspace/intern/AUD_DefaultMixer.h b/intern/audaspace/intern/AUD_DefaultMixer.h deleted file mode 100644 index a347141b5e0..00000000000 --- a/intern/audaspace/intern/AUD_DefaultMixer.h +++ /dev/null @@ -1,59 +0,0 @@ -/* - * $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_DefaultMixer.h - * \ingroup audaspaceintern - */ - - -#ifndef AUD_DEFAULTMIXER -#define AUD_DEFAULTMIXER - -#include "AUD_Mixer.h" - -/** - * This class is able to mix audiosignals of different channel count and sample - * rate and convert it to a specific output format. - * It uses a default ChannelMapperFactory and a SRCResampleFactory for - * the perparation. - */ -class AUD_DefaultMixer : public AUD_Mixer -{ -public: - /** - * Creates the mixer. - */ - AUD_DefaultMixer(AUD_DeviceSpecs specs); - - /** - * This funuction prepares a reader for playback. - * \param reader The reader to prepare. - * \return The reader that should be used for playback. - */ - virtual AUD_IReader* prepare(AUD_IReader* reader); -}; - -#endif //AUD_DEFAULTMIXER diff --git a/intern/audaspace/intern/AUD_JOSResampleReaderCoeff.cpp b/intern/audaspace/intern/AUD_JOSResampleReaderCoeff.cpp index 19ebfc00d25..59c69301a02 100644 --- a/intern/audaspace/intern/AUD_JOSResampleReaderCoeff.cpp +++ b/intern/audaspace/intern/AUD_JOSResampleReaderCoeff.cpp @@ -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 diff --git a/intern/audaspace/intern/AUD_SoftwareDevice.cpp b/intern/audaspace/intern/AUD_SoftwareDevice.cpp index 496ad6992bc..0413c488b5d 100644 --- a/intern/audaspace/intern/AUD_SoftwareDevice.cpp +++ b/intern/audaspace/intern/AUD_SoftwareDevice.cpp @@ -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; } diff --git a/intern/ghost/intern/GHOST_ISystemPaths.cpp b/intern/ghost/intern/GHOST_ISystemPaths.cpp index 8873398a320..1aa043ebc80 100644 --- a/intern/ghost/intern/GHOST_ISystemPaths.cpp +++ b/intern/ghost/intern/GHOST_ISystemPaths.cpp @@ -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 (); diff --git a/intern/ghost/intern/GHOST_Path-api.cpp b/intern/ghost/intern/GHOST_Path-api.cpp index dee66029d19..053eb7d03e8 100644 --- a/intern/ghost/intern/GHOST_Path-api.cpp +++ b/intern/ghost/intern/GHOST_Path-api.cpp @@ -39,7 +39,7 @@ GHOST_TSuccess GHOST_CreateSystemPaths(void) { - return GHOST_ISystemPaths::create();; + return GHOST_ISystemPaths::create(); } GHOST_TSuccess GHOST_DisposeSystemPaths(void) diff --git a/intern/ghost/intern/GHOST_SystemCarbon.cpp b/intern/ghost/intern/GHOST_SystemCarbon.cpp index d5e5fbc7a58..e02e569cc6e 100644 --- a/intern/ghost/intern/GHOST_SystemCarbon.cpp +++ b/intern/ghost/intern/GHOST_SystemCarbon.cpp @@ -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 : diff --git a/intern/ghost/intern/GHOST_WindowWin32.cpp b/intern/ghost/intern/GHOST_WindowWin32.cpp index 0c8c0adf041..d9a495ad0f4 100644 --- a/intern/ghost/intern/GHOST_WindowWin32.cpp +++ b/intern/ghost/intern/GHOST_WindowWin32.cpp @@ -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(); diff --git a/release/scripts/modules/bpy_types.py b/release/scripts/modules/bpy_types.py index e4a0d30efcf..101416f4943 100644 --- a/release/scripts/modules/bpy_types.py +++ b/release/scripts/modules/bpy_types.py @@ -413,7 +413,7 @@ TypeMap = {} class Sound(bpy_types.ID): __slots__ = () - + @property def factory(self): """The aud.Factory object of the sound.""" diff --git a/release/scripts/startup/bl_operators/nla.py b/release/scripts/startup/bl_operators/nla.py index 085cd75f9f9..c764f7d62f1 100644 --- a/release/scripts/startup/bl_operators/nla.py +++ b/release/scripts/startup/bl_operators/nla.py @@ -269,10 +269,8 @@ class BakeAction(Operator): wm = context.window_manager return wm.invoke_props_dialog(self) -################################# - -class ClearUselessActions(bpy.types.Operator): +class ClearUselessActions(Operator): '''Mark actions with no F-Curves for deletion after save+reload of file preserving "action libraries"''' bl_idname = "anim.clear_useless_actions" bl_label = "Clear Useless Actions" diff --git a/release/scripts/startup/bl_operators/object.py b/release/scripts/startup/bl_operators/object.py index 88f863b8e55..6c9f27afaa5 100644 --- a/release/scripts/startup/bl_operators/object.py +++ b/release/scripts/startup/bl_operators/object.py @@ -686,26 +686,30 @@ class ClearAllRestrictRender(Operator): obj.hide_render = False return {'FINISHED'} -class TransformsToDeltasAnim(bpy.types.Operator): + +class TransformsToDeltasAnim(Operator): '''Convert object animation for normal transforms to delta transforms''' bl_idname = "object.anim_transforms_to_deltas" bl_label = "Animated Transforms to Deltas" bl_options = {'REGISTER', 'UNDO'} - + @classmethod def poll(cls, context): obs = context.selected_editable_objects return (obs is not None) - + def execute(self, context): for obj in context.selected_editable_objects: # get animation data adt = obj.animation_data if (adt is None) or (adt.action is None): - self.report({'WARNING'}, "No animation data to convert on object: " + obj.name) + self.report({'WARNING'}, + "No animation data to convert on object: %r" % + obj.name) continue - - # if F-Curve uses standard transform path, just append "delta_" to this path + + # if F-Curve uses standard transform path + # just append "delta_" to this path for fcu in adt.action.fcurves: if fcu.data_path == "location": fcu.data_path = "delta_location" @@ -716,13 +720,14 @@ class TransformsToDeltasAnim(bpy.types.Operator): elif fcu.data_path == "rotation_quaternion": fcu.data_path = "delta_rotation_quaternion" obj.rotation_quaternion.identity() - #elif fcu.data_path == "rotation_axis_angle": # XXX: currently not implemented - # fcu.data_path = "delta_rotation_axis_angle" + # XXX: currently not implemented + # elif fcu.data_path == "rotation_axis_angle": + # fcu.data_path = "delta_rotation_axis_angle" elif fcu.data_path == "scale": fcu.data_path = "delta_scale" - obj.scale = (1, 1, 1) - + obj.scale = 1.0, 1.0, 1.0 + # hack: force animsys flush by changing frame, so that deltas get run context.scene.frame_set(context.scene.frame_current) - + return {'FINISHED'} diff --git a/release/scripts/startup/bl_ui/properties_data_armature.py b/release/scripts/startup/bl_ui/properties_data_armature.py index 9a76ed81530..e17064178b8 100644 --- a/release/scripts/startup/bl_ui/properties_data_armature.py +++ b/release/scripts/startup/bl_ui/properties_data_armature.py @@ -72,8 +72,7 @@ class DATA_PT_skeleton(ArmatureButtonsPanel, Panel): flow.prop(arm, "use_deform_preserve_volume", text="Quaternion") if context.scene.render.engine == "BLENDER_GAME": - col = layout.column() - col.prop(arm, "vert_deformer") + layout.row().prop(arm, "vert_deformer", expand=True) class DATA_PT_display(ArmatureButtonsPanel, Panel): bl_label = "Display" diff --git a/release/scripts/startup/bl_ui/properties_data_speaker.py b/release/scripts/startup/bl_ui/properties_data_speaker.py index fe9f798af0c..657c0fe652a 100644 --- a/release/scripts/startup/bl_ui/properties_data_speaker.py +++ b/release/scripts/startup/bl_ui/properties_data_speaker.py @@ -66,10 +66,7 @@ class DATA_PT_speaker(DataButtonsPanel, bpy.types.Panel): split.template_ID(speaker, "sound", open="sound.open_mono") split.prop(speaker, "muted") - split = layout.split() - - row = split.row() - + row = layout.row() row.prop(speaker, "volume") row.prop(speaker, "pitch") @@ -84,15 +81,14 @@ class DATA_PT_distance(DataButtonsPanel, bpy.types.Panel): speaker = context.speaker split = layout.split() + col = split.column() - col.label("Volume:") col.prop(speaker, "volume_min", text="Minimum") col.prop(speaker, "volume_max", text="Maximum") col.prop(speaker, "attenuation") col = split.column() - col.label("Distance:") col.prop(speaker, "distance_max", text="Maximum") col.prop(speaker, "distance_reference", text="Reference") diff --git a/release/scripts/startup/bl_ui/properties_game.py b/release/scripts/startup/bl_ui/properties_game.py index e3c576e7093..161e4b10cff 100644 --- a/release/scripts/startup/bl_ui/properties_game.py +++ b/release/scripts/startup/bl_ui/properties_game.py @@ -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): diff --git a/release/scripts/startup/bl_ui/properties_object_constraint.py b/release/scripts/startup/bl_ui/properties_object_constraint.py index c74a0000499..05fac2026a0 100644 --- a/release/scripts/startup/bl_ui/properties_object_constraint.py +++ b/release/scripts/startup/bl_ui/properties_object_constraint.py @@ -235,7 +235,6 @@ class ConstraintButtonsPanel(): row.label() def LIMIT_ROTATION(self, context, layout, con): - split = layout.split() col = split.column(align=True) @@ -259,9 +258,7 @@ class ConstraintButtonsPanel(): sub.prop(con, "min_z", text="Min") sub.prop(con, "max_z", text="Max") - row = layout.row() - row.prop(con, "use_transform_limit") - row.label() + layout.prop(con, "use_transform_limit") row = layout.row() row.label(text="Convert:") @@ -481,7 +478,6 @@ class ConstraintButtonsPanel(): row.prop(con, "use_transform_limit") row.label() - def STRETCH_TO(self, context, layout, con): self.target_template(layout, con) diff --git a/release/scripts/startup/bl_ui/properties_render.py b/release/scripts/startup/bl_ui/properties_render.py index c906013e094..395cfc6934e 100644 --- a/release/scripts/startup/bl_ui/properties_render.py +++ b/release/scripts/startup/bl_ui/properties_render.py @@ -592,12 +592,9 @@ class RENDER_PT_encoding(RenderButtonsPanel, Panel): if rd.ffmpeg_format not in {'MP3'}: layout.prop(rd, "ffmpeg_audio_codec", text="Audio Codec") - split = layout.split() - - col = split.column() - col.prop(rd, "ffmpeg_audio_bitrate") - col = split.column() - col.prop(rd, "ffmpeg_audio_volume", slider=True) + row = layout.row() + row.prop(rd, "ffmpeg_audio_bitrate") + row.prop(rd, "ffmpeg_audio_volume", slider=True) class RENDER_PT_bake(RenderButtonsPanel, Panel): diff --git a/release/scripts/startup/bl_ui/properties_scene.py b/release/scripts/startup/bl_ui/properties_scene.py index fd7fc8ed462..66f967bb6e1 100644 --- a/release/scripts/startup/bl_ui/properties_scene.py +++ b/release/scripts/startup/bl_ui/properties_scene.py @@ -59,14 +59,12 @@ class SCENE_PT_audio(SceneButtonsPanel, Panel): split = layout.split() col = split.column() - col.label("Listener:") col.prop(scene, "audio_distance_model", text="") col.prop(scene, "audio_doppler_speed", text="Speed") col.prop(scene, "audio_doppler_factor", text="Doppler") col = split.column() - col.label("Format:") col.prop(rd, "ffmpeg_audio_channels", text="") col.prop(rd, "ffmpeg_audio_mixrate", text="Rate") diff --git a/release/scripts/startup/bl_ui/properties_texture.py b/release/scripts/startup/bl_ui/properties_texture.py index 0172fbcbadd..34f5a948ee7 100644 --- a/release/scripts/startup/bl_ui/properties_texture.py +++ b/release/scripts/startup/bl_ui/properties_texture.py @@ -414,7 +414,7 @@ class TEXTURE_PT_image_sampling(TextureTypePanel, Panel): row = col.row() row.active = tex.use_normal_map row.prop(slot, "normal_map_space", text="") - + row = col.row() row.active = not tex.use_normal_map row.prop(tex, "use_derivative_map") @@ -1029,14 +1029,14 @@ class TEXTURE_PT_influence(TextureSlotPanel, Panel): # only show bump settings if activated but not for normalmap images row = layout.row() - + sub = row.row() sub.active = (tex.use_map_normal or tex.use_map_warp) and not (tex.texture.type == 'IMAGE' and (tex.texture.use_normal_map or tex.texture.use_derivative_map)) sub.prop(tex, "bump_method", text="Method") - # the space setting is supported for: derivmaps + bumpmaps (DEFAULT,BEST_QUALITY), not for normalmaps + # the space setting is supported for: derivmaps + bumpmaps (DEFAULT,BEST_QUALITY), not for normalmaps sub = row.row() - sub.active = (tex.use_map_normal or tex.use_map_warp) and not (tex.texture.type == 'IMAGE' and tex.texture.use_normal_map) and ((tex.bump_method in {'BUMP_DEFAULT', 'BUMP_BEST_QUALITY'}) or (tex.texture.type == 'IMAGE' and tex.texture.use_derivative_map)) + sub.active = (tex.use_map_normal or tex.use_map_warp) and not (tex.texture.type == 'IMAGE' and tex.texture.use_normal_map) and ((tex.bump_method in {'BUMP_DEFAULT', 'BUMP_BEST_QUALITY'}) or (tex.texture.type == 'IMAGE' and tex.texture.use_derivative_map)) sub.prop(tex, "bump_objectspace", text="Space") diff --git a/release/scripts/startup/bl_ui/space_dopesheet.py b/release/scripts/startup/bl_ui/space_dopesheet.py index 5ed79f45fbc..90dcc99e6d7 100644 --- a/release/scripts/startup/bl_ui/space_dopesheet.py +++ b/release/scripts/startup/bl_ui/space_dopesheet.py @@ -36,7 +36,7 @@ def dopesheet_filter(layout, context, genericFiltersOnly=False): if is_nla: row.prop(dopesheet, "show_missing_nla", text="") - + if not genericFiltersOnly: if bpy.data.groups: row = layout.row(align=True) diff --git a/release/scripts/startup/bl_ui/space_nla.py b/release/scripts/startup/bl_ui/space_nla.py index 1d4b7c6828f..ffead81c507 100644 --- a/release/scripts/startup/bl_ui/space_nla.py +++ b/release/scripts/startup/bl_ui/space_nla.py @@ -69,11 +69,11 @@ class NLA_MT_view(Menu): layout.separator() layout.operator("anim.previewrange_set") layout.operator("anim.previewrange_clear") - + layout.separator() layout.operator("nla.view_all") layout.operator("nla.view_selected") - + layout.separator() layout.operator("screen.area_dupli") layout.operator("screen.screen_full_area") diff --git a/release/scripts/startup/bl_ui/space_sequencer.py b/release/scripts/startup/bl_ui/space_sequencer.py index 8592cc2fcc0..36f606da635 100644 --- a/release/scripts/startup/bl_ui/space_sequencer.py +++ b/release/scripts/startup/bl_ui/space_sequencer.py @@ -804,7 +804,6 @@ class SEQUENCER_PT_proxy(SequencerButtonsPanel, Panel): col.prop(strip.proxy, "timecode") - class SEQUENCER_PT_preview(SequencerButtonsPanel_Output, Panel): bl_label = "Scene Preview/Render" bl_space_type = 'SEQUENCE_EDITOR' diff --git a/release/scripts/startup/bl_ui/space_view3d.py b/release/scripts/startup/bl_ui/space_view3d.py index 05ef8c16804..3a88ed6519a 100644 --- a/release/scripts/startup/bl_ui/space_view3d.py +++ b/release/scripts/startup/bl_ui/space_view3d.py @@ -179,9 +179,9 @@ class VIEW3D_MT_transform(Menu): layout.operator("object.randomize_transform") layout.operator("object.align") - + layout.separator() - + layout.operator("object.anim_transforms_to_deltas") @@ -1272,6 +1272,7 @@ class VIEW3D_MT_pose_transform(Menu): layout.operator("pose.user_transforms_clear", text="Reset unkeyed") + class VIEW3D_MT_pose_slide(Menu): bl_label = "In-Betweens" diff --git a/release/scripts/startup/keyingsets_builtins.py b/release/scripts/startup/keyingsets_builtins.py index dcc1afed74b..6b12c95e072 100644 --- a/release/scripts/startup/keyingsets_builtins.py +++ b/release/scripts/startup/keyingsets_builtins.py @@ -32,13 +32,14 @@ in lost (i.e. unkeyed) animation. import bpy import keyingsets_utils +from bpy.types import KeyingSetInfo ############################### # Built-In KeyingSets # Location -class BUILTIN_KSI_Location(bpy.types.KeyingSetInfo): +class BUILTIN_KSI_Location(KeyingSetInfo): bl_label = "Location" # poll - use predefined callback for selected bones/objects @@ -52,7 +53,7 @@ class BUILTIN_KSI_Location(bpy.types.KeyingSetInfo): # Rotation -class BUILTIN_KSI_Rotation(bpy.types.KeyingSetInfo): +class BUILTIN_KSI_Rotation(KeyingSetInfo): bl_label = "Rotation" # poll - use predefined callback for selected bones/objects @@ -66,7 +67,7 @@ class BUILTIN_KSI_Rotation(bpy.types.KeyingSetInfo): # Scale -class BUILTIN_KSI_Scaling(bpy.types.KeyingSetInfo): +class BUILTIN_KSI_Scaling(KeyingSetInfo): bl_label = "Scaling" # poll - use predefined callback for selected bones/objects @@ -82,7 +83,7 @@ class BUILTIN_KSI_Scaling(bpy.types.KeyingSetInfo): # LocRot -class BUILTIN_KSI_LocRot(bpy.types.KeyingSetInfo): +class BUILTIN_KSI_LocRot(KeyingSetInfo): bl_label = "LocRot" # poll - use predefined callback for selected bones/objects @@ -100,7 +101,7 @@ class BUILTIN_KSI_LocRot(bpy.types.KeyingSetInfo): # LocScale -class BUILTIN_KSI_LocScale(bpy.types.KeyingSetInfo): +class BUILTIN_KSI_LocScale(KeyingSetInfo): bl_label = "LocScale" # poll - use predefined callback for selected bones/objects @@ -118,7 +119,7 @@ class BUILTIN_KSI_LocScale(bpy.types.KeyingSetInfo): # LocRotScale -class BUILTIN_KSI_LocRotScale(bpy.types.KeyingSetInfo): +class BUILTIN_KSI_LocRotScale(KeyingSetInfo): bl_label = "LocRotScale" # poll - use predefined callback for selected bones/objects @@ -138,7 +139,7 @@ class BUILTIN_KSI_LocRotScale(bpy.types.KeyingSetInfo): # RotScale -class BUILTIN_KSI_RotScale(bpy.types.KeyingSetInfo): +class BUILTIN_KSI_RotScale(KeyingSetInfo): bl_label = "RotScale" # poll - use predefined callback for selected bones/objects @@ -158,7 +159,7 @@ class BUILTIN_KSI_RotScale(bpy.types.KeyingSetInfo): # Location -class BUILTIN_KSI_VisualLoc(bpy.types.KeyingSetInfo): +class BUILTIN_KSI_VisualLoc(KeyingSetInfo): bl_label = "Visual Location" bl_options = {'INSERTKEY_VISUAL'} @@ -174,7 +175,7 @@ class BUILTIN_KSI_VisualLoc(bpy.types.KeyingSetInfo): # Rotation -class BUILTIN_KSI_VisualRot(bpy.types.KeyingSetInfo): +class BUILTIN_KSI_VisualRot(KeyingSetInfo): bl_label = "Visual Rotation" bl_options = {'INSERTKEY_VISUAL'} @@ -190,7 +191,7 @@ class BUILTIN_KSI_VisualRot(bpy.types.KeyingSetInfo): # VisualLocRot -class BUILTIN_KSI_VisualLocRot(bpy.types.KeyingSetInfo): +class BUILTIN_KSI_VisualLocRot(KeyingSetInfo): bl_label = "Visual LocRot" bl_options = {'INSERTKEY_VISUAL'} @@ -212,7 +213,7 @@ class BUILTIN_KSI_VisualLocRot(bpy.types.KeyingSetInfo): # Available -class BUILTIN_KSI_Available(bpy.types.KeyingSetInfo): +class BUILTIN_KSI_Available(KeyingSetInfo): bl_label = "Available" # poll - selected objects or selected object with animation data @@ -234,7 +235,7 @@ class BUILTIN_KSI_Available(bpy.types.KeyingSetInfo): # All properties that are likely to get animated in a character rig -class BUILTIN_KSI_WholeCharacter(bpy.types.KeyingSetInfo): +class BUILTIN_KSI_WholeCharacter(KeyingSetInfo): bl_label = "Whole Character" # these prefixes should be avoided, as they are not really bones @@ -265,7 +266,7 @@ class BUILTIN_KSI_WholeCharacter(bpy.types.KeyingSetInfo): # loc, rot, scale - only include unlocked ones ksi.doLoc(ks, bone) - if bone.rotation_mode in ('QUATERNION', 'AXIS_ANGLE'): + if bone.rotation_mode in {'QUATERNION', 'AXIS_ANGLE'}: ksi.doRot4d(ks, bone) else: ksi.doRot3d(ks, bone) @@ -365,7 +366,7 @@ class BUILTIN_KSI_WholeCharacter(bpy.types.KeyingSetInfo): # Delta Location -class BUILTIN_KSI_DeltaLocation(bpy.types.KeyingSetInfo): +class BUILTIN_KSI_DeltaLocation(KeyingSetInfo): bl_label = "Delta Location" # poll - selected objects only (and only if active object in object mode) @@ -390,7 +391,7 @@ class BUILTIN_KSI_DeltaLocation(bpy.types.KeyingSetInfo): # Delta Rotation -class BUILTIN_KSI_DeltaRotation(bpy.types.KeyingSetInfo): +class BUILTIN_KSI_DeltaRotation(KeyingSetInfo): bl_label = "Delta Rotation" # poll - selected objects only (and only if active object in object mode) @@ -423,7 +424,7 @@ class BUILTIN_KSI_DeltaRotation(bpy.types.KeyingSetInfo): # Delta Scale -class BUILTIN_KSI_DeltaScale(bpy.types.KeyingSetInfo): +class BUILTIN_KSI_DeltaScale(KeyingSetInfo): bl_label = "Delta Scale" # poll - selected objects only (and only if active object in object mode) diff --git a/source/blender/blenfont/intern/blf.c b/source/blender/blenfont/intern/blf.c index c0e62b1c0c7..fc812d652b3 100644 --- a/source/blender/blenfont/intern/blf.c +++ b/source/blender/blenfont/intern/blf.c @@ -369,28 +369,28 @@ void BLF_position(int fontid, float x, float y, float z) za= 1.0f; } - remainder= x - floor(x); - if (remainder > 0.4 && remainder < 0.6) { - if (remainder < 0.5) - x -= 0.1 * xa; + remainder= x - floorf(x); + if (remainder > 0.4f && remainder < 0.6f) { + if (remainder < 0.5f) + x -= 0.1f * xa; else - x += 0.1 * xa; + x += 0.1f * xa; } - remainder= y - floor(y); - if (remainder > 0.4 && remainder < 0.6) { - if (remainder < 0.5) - y -= 0.1 * ya; + remainder= y - floorf(y); + if (remainder > 0.4f && remainder < 0.6f) { + if (remainder < 0.5f) + y -= 0.1f * ya; else - y += 0.1 * ya; + y += 0.1f * ya; } - remainder= z - floor(z); - if (remainder > 0.4 && remainder < 0.6) { - if (remainder < 0.5) - z -= 0.1 * za; + remainder= z - floorf(z); + if (remainder > 0.4f && remainder < 0.6f) { + if (remainder < 0.5f) + z -= 0.1f * za; else - z += 0.1 * za; + z += 0.1f * za; } font->pos[0]= x; diff --git a/source/blender/blenfont/intern/blf_font.c b/source/blender/blenfont/intern/blf_font.c index 708b3708ab7..fb6505fe935 100644 --- a/source/blender/blenfont/intern/blf_font.c +++ b/source/blender/blenfont/intern/blf_font.c @@ -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; } } } diff --git a/source/blender/blenkernel/BKE_sound.h b/source/blender/blenkernel/BKE_sound.h index e1b6ff02bc4..fac5bf1cfd2 100644 --- a/source/blender/blenkernel/BKE_sound.h +++ b/source/blender/blenkernel/BKE_sound.h @@ -134,8 +134,6 @@ void sound_free_waveform(struct bSound* sound); void sound_read_waveform(struct bSound* sound); -int sound_get_channels(struct bSound* sound); - void sound_update_scene(struct Scene* scene); void* sound_get_factory(void* sound); diff --git a/source/blender/blenkernel/intern/collision.c b/source/blender/blenkernel/intern/collision.c index 1fec977851e..04c5caf138a 100644 --- a/source/blender/blenkernel/intern/collision.c +++ b/source/blender/blenkernel/intern/collision.c @@ -1092,7 +1092,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++; diff --git a/source/blender/blenkernel/intern/particle_system.c b/source/blender/blenkernel/intern/particle_system.c index 62f269d775e..8bb783abb80 100644 --- a/source/blender/blenkernel/intern/particle_system.c +++ b/source/blender/blenkernel/intern/particle_system.c @@ -68,6 +68,7 @@ #include "BLI_listbase.h" #include "BLI_threads.h" #include "BLI_storage.h" /* For _LARGEFILE64_SOURCE; zlib needs this on some systems */ +#include "BLI_string.h" #include "BLI_utildefines.h" #include "BLI_edgehash.h" @@ -104,12 +105,6 @@ #include <zlib.h> #include <string.h> -#ifdef WIN32 -#ifndef snprintf -#define snprintf _snprintf -#endif -#endif - #endif // DISABLE_ELBEEM /************************************************/ @@ -3876,7 +3871,7 @@ static void particles_fluid_step(ParticleSimulationData *sim, int UNUSED(cfra)) gzf = gzopen(filename, "rb"); if (!gzf) { - snprintf(debugStrBuffer,256,"readFsPartData::error - Unable to open file for reading '%s' \n", filename); + BLI_snprintf(debugStrBuffer, sizeof(debugStrBuffer),"readFsPartData::error - Unable to open file for reading '%s' \n", filename); // XXX bad level call elbeemDebugOut(debugStrBuffer); return; } @@ -3937,7 +3932,7 @@ static void particles_fluid_step(ParticleSimulationData *sim, int UNUSED(cfra)) gzclose( gzf ); totpart = psys->totpart = activeParts; - snprintf(debugStrBuffer,256,"readFsPartData::done - particles:%d, active:%d, file:%d, mask:%d \n", psys->totpart,activeParts,fileParts,readMask); + BLI_snprintf(debugStrBuffer,sizeof(debugStrBuffer),"readFsPartData::done - particles:%d, active:%d, file:%d, mask:%d \n", psys->totpart,activeParts,fileParts,readMask); // bad level call // XXX elbeemDebugOut(debugStrBuffer); diff --git a/source/blender/blenkernel/intern/pointcache.c b/source/blender/blenkernel/intern/pointcache.c index 0f0afe30392..a56010a5ccf 100644 --- a/source/blender/blenkernel/intern/pointcache.c +++ b/source/blender/blenkernel/intern/pointcache.c @@ -917,14 +917,14 @@ static int ptcache_path(PTCacheID *pid, char *filename) if (i > 6) file[i-6] = '\0'; - snprintf(filename, MAX_PTCACHE_PATH, "//"PTCACHE_PATH"%s", file); /* add blend file name to pointcache dir */ + BLI_snprintf(filename, MAX_PTCACHE_PATH, "//"PTCACHE_PATH"%s", file); /* add blend file name to pointcache dir */ BLI_path_abs(filename, blendfilename); return BLI_add_slash(filename); /* new strlen() */ } /* use the temp path. this is weak but better then not using point cache at all */ /* btempdir is assumed to exist and ALWAYS has a trailing slash */ - snprintf(filename, MAX_PTCACHE_PATH, "%s"PTCACHE_PATH"%d", btempdir, abs(getpid())); + BLI_snprintf(filename, MAX_PTCACHE_PATH, "%s"PTCACHE_PATH"%d", btempdir, abs(getpid())); return BLI_add_slash(filename); /* new strlen() */ } @@ -948,7 +948,7 @@ static int ptcache_filename(PTCacheID *pid, char *filename, int cfra, short do_p idname = (pid->ob->id.name+2); /* convert chars to hex so they are always a valid filename */ while('\0' != *idname) { - snprintf(newname, MAX_PTCACHE_FILE, "%02X", (char)(*idname++)); + BLI_snprintf(newname, MAX_PTCACHE_FILE, "%02X", (char)(*idname++)); newname+=2; len += 2; } @@ -967,12 +967,12 @@ static int ptcache_filename(PTCacheID *pid, char *filename, int cfra, short do_p if(pid->cache->flag & PTCACHE_EXTERNAL) { if(pid->cache->index >= 0) - snprintf(newname, MAX_PTCACHE_FILE, "_%06d_%02u"PTCACHE_EXT, cfra, pid->stack_index); /* always 6 chars */ + BLI_snprintf(newname, MAX_PTCACHE_FILE, "_%06d_%02u"PTCACHE_EXT, cfra, pid->stack_index); /* always 6 chars */ else - snprintf(newname, MAX_PTCACHE_FILE, "_%06d"PTCACHE_EXT, cfra); /* always 6 chars */ + BLI_snprintf(newname, MAX_PTCACHE_FILE, "_%06d"PTCACHE_EXT, cfra); /* always 6 chars */ } else { - snprintf(newname, MAX_PTCACHE_FILE, "_%06d_%02u"PTCACHE_EXT, cfra, pid->stack_index); /* always 6 chars */ + BLI_snprintf(newname, MAX_PTCACHE_FILE, "_%06d_%02u"PTCACHE_EXT, cfra, pid->stack_index); /* always 6 chars */ } len += 16; } @@ -2002,7 +2002,7 @@ void BKE_ptcache_id_clear(PTCacheID *pid, int mode, unsigned int cfra) if (dir==NULL) return; - snprintf(ext, sizeof(ext), "_%02u"PTCACHE_EXT, pid->stack_index); + BLI_snprintf(ext, sizeof(ext), "_%02u"PTCACHE_EXT, pid->stack_index); while ((de = readdir(dir)) != NULL) { if (strstr(de->d_name, ext)) { /* do we have the right extension?*/ @@ -2204,7 +2204,7 @@ void BKE_ptcache_id_time(PTCacheID *pid, Scene *scene, float cfra, int *startfra if (dir==NULL) return; - snprintf(ext, sizeof(ext), "_%02u"PTCACHE_EXT, pid->stack_index); + BLI_snprintf(ext, sizeof(ext), "_%02u"PTCACHE_EXT, pid->stack_index); while ((de = readdir(dir)) != NULL) { if (strstr(de->d_name, ext)) { /* do we have the right extension?*/ @@ -2904,7 +2904,7 @@ void BKE_ptcache_disk_cache_rename(PTCacheID *pid, char *from, char *to) return; } - snprintf(ext, sizeof(ext), "_%02u"PTCACHE_EXT, pid->stack_index); + BLI_snprintf(ext, sizeof(ext), "_%02u"PTCACHE_EXT, pid->stack_index); /* put new name into cache */ strcpy(pid->cache->name, to); @@ -2960,7 +2960,7 @@ void BKE_ptcache_load_external(PTCacheID *pid) return; if(cache->index >= 0) - snprintf(ext, sizeof(ext), "_%02d"PTCACHE_EXT, cache->index); + BLI_snprintf(ext, sizeof(ext), "_%02d"PTCACHE_EXT, cache->index); else strcpy(ext, PTCACHE_EXT); diff --git a/source/blender/blenkernel/intern/report.c b/source/blender/blenkernel/intern/report.c index f84d98a31b4..4926edaeec2 100644 --- a/source/blender/blenkernel/intern/report.c +++ b/source/blender/blenkernel/intern/report.c @@ -44,12 +44,6 @@ #include <stdio.h> #include <string.h> -#ifdef _WIN32 -#ifndef vsnprintf -#define vsnprintf _vsnprintf -#endif -#endif - static const char *report_type_str(int type) { switch(type) { diff --git a/source/blender/blenkernel/intern/sequencer.c b/source/blender/blenkernel/intern/sequencer.c index 40e02d65323..9ef30bdd49b 100644 --- a/source/blender/blenkernel/intern/sequencer.c +++ b/source/blender/blenkernel/intern/sequencer.c @@ -78,11 +78,6 @@ # include "AUD_C-API.h" #endif -#ifdef WIN32 -#define snprintf _snprintf -#endif - - static ImBuf* seq_render_strip_stack( SeqRenderData context, ListBase *seqbasep, float cfra, int chanshown); @@ -1193,7 +1188,7 @@ static void seq_open_anim_file(Sequence * seq) static int seq_proxy_get_fname(SeqRenderData context, Sequence * seq, int cfra, char * name) { int frameno; - char dir[FILE_MAXDIR]; + char dir[PROXY_MAXFILE]; int render_size = context.preview_render_size; if (!seq->strip->proxy) { @@ -1211,7 +1206,7 @@ static int seq_proxy_get_fname(SeqRenderData context, Sequence * seq, int cfra, if (seq->flag & (SEQ_USE_PROXY_CUSTOM_DIR|SEQ_USE_PROXY_CUSTOM_FILE)) { strcpy(dir, seq->strip->proxy->dir); } else if (seq->type == SEQ_IMAGE) { - snprintf(dir, PROXY_MAXFILE, "%s/BL_proxy", seq->strip->dir); + BLI_snprintf(dir, PROXY_MAXFILE, "%s/BL_proxy", seq->strip->dir); } else { return FALSE; } @@ -1232,14 +1227,14 @@ static int seq_proxy_get_fname(SeqRenderData context, Sequence * seq, int cfra, /* generate a separate proxy directory for each preview size */ if (seq->type == SEQ_IMAGE) { - snprintf(name, PROXY_MAXFILE, "%s/images/%d/%s_proxy", dir, + BLI_snprintf(name, PROXY_MAXFILE, "%s/images/%d/%s_proxy", dir, context.preview_render_size, give_stripelem(seq, cfra)->name); frameno = 1; } else { frameno = (int) give_stripelem_index(seq, cfra) + seq->anim_startofs; - snprintf(name, PROXY_MAXFILE, "%s/proxy_misc/%d/####", dir, + BLI_snprintf(name, PROXY_MAXFILE, "%s/proxy_misc/%d/####", dir, context.preview_render_size); } diff --git a/source/blender/blenkernel/intern/sound.c b/source/blender/blenkernel/intern/sound.c index 985fef974d3..cdb509ab8e1 100644 --- a/source/blender/blenkernel/intern/sound.c +++ b/source/blender/blenkernel/intern/sound.c @@ -641,15 +641,6 @@ void sound_read_waveform(struct bSound* sound) } } -int sound_get_channels(struct bSound* sound) -{ - AUD_SoundInfo info; - - info = AUD_getInfo(sound->playback_handle); - - return info.specs.channels; -} - void sound_update_scene(struct Scene* scene) { Object* ob; @@ -769,6 +760,5 @@ 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; } -int sound_get_channels(struct bSound* UNUSED(sound)) { return 1; } #endif // WITH_AUDASPACE diff --git a/source/blender/blenkernel/intern/unit.c b/source/blender/blenkernel/intern/unit.c index a9792bc44fa..72fe1c19884 100644 --- a/source/blender/blenkernel/intern/unit.c +++ b/source/blender/blenkernel/intern/unit.c @@ -34,6 +34,7 @@ #include "BKE_unit.h" #include "BLI_math.h" +#include "BLI_string.h" #include "BLI_winstuff.h" @@ -344,7 +345,7 @@ static int unit_as_string(char *str, int len_max, double value, int prec, bUnitC /* Convert to a string */ { - len= snprintf(str, len_max, "%.*lf", prec, value_conv); + len= BLI_snprintf(str, len_max, "%.*lf", prec, value_conv); if(len >= len_max) len= len_max; @@ -495,7 +496,7 @@ static int unit_scale_str(char *str, int len_max, char *str_tmp, double scale_pr len_name = strlen(replace_str); len_move= (len - (found_ofs+len_name)) + 1; /* 1+ to copy the string terminator */ - len_num= snprintf(str_tmp, TEMP_STR_SIZE, "*%lg"SEP_STR, unit->scalar/scale_pref); /* # removed later */ + len_num= BLI_snprintf(str_tmp, TEMP_STR_SIZE, "*%lg"SEP_STR, unit->scalar/scale_pref); /* # removed later */ if(len_num > len_max) len_num= len_max; @@ -629,12 +630,12 @@ int bUnit_ReplaceString(char *str, int len_max, char *str_prev, double scale_pre /* add the unit prefix and re-run, use brackets incase there was an expression given */ - if(snprintf(str_tmp, sizeof(str_tmp), "(%s)%s", str, unit->name) < sizeof(str_tmp)) { + if(BLI_snprintf(str_tmp, sizeof(str_tmp), "(%s)%s", str, unit->name) < sizeof(str_tmp)) { strncpy(str, str_tmp, len_max); return bUnit_ReplaceString(str, len_max, NULL, scale_pref, system, type); } else { - /* snprintf would not fit into str_tmp, cant do much in this case + /* BLI_snprintf would not fit into str_tmp, cant do much in this case * check for this because otherwise bUnit_ReplaceString could call its self forever */ return 0; } @@ -705,7 +706,7 @@ void bUnit_ToUnitAltName(char *str, int len_max, char *orig_str, int system, int /* print the alt_name */ if(unit->name_alt) - len_name= snprintf(str, len_max, "%s", unit->name_alt); + len_name= BLI_snprintf(str, len_max, "%s", unit->name_alt); else len_name= 0; diff --git a/source/blender/blenkernel/intern/writeffmpeg.c b/source/blender/blenkernel/intern/writeffmpeg.c index 24e0fe95a1f..13875ff19f7 100644 --- a/source/blender/blenkernel/intern/writeffmpeg.c +++ b/source/blender/blenkernel/intern/writeffmpeg.c @@ -39,10 +39,6 @@ #include <libswscale/swscale.h> #include <libavcodec/opt.h> -#if defined(WIN32) && (!(defined snprintf)) -#define snprintf _snprintf -#endif - #include "MEM_guardedalloc.h" #include "DNA_scene_types.h" @@ -652,7 +648,7 @@ static int start_ffmpeg_impl(struct RenderData *rd, int rectx, int recty, Report fmt->audio_codec = ffmpeg_audio_codec; - snprintf(of->filename, sizeof(of->filename), "%s", name); + BLI_snprintf(of->filename, sizeof(of->filename), "%s", name); /* set the codec to the user's selection */ switch(ffmpeg_type) { case FFMPEG_AVI: diff --git a/source/blender/blenlib/BLI_callbacks.h b/source/blender/blenlib/BLI_callbacks.h index fc5c5a80131..5c3180ba9c5 100644 --- a/source/blender/blenlib/BLI_callbacks.h +++ b/source/blender/blenlib/BLI_callbacks.h @@ -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, diff --git a/source/blender/blenlib/intern/BLI_kdopbvh.c b/source/blender/blenlib/intern/BLI_kdopbvh.c index 527692348e7..dcbe043f0d0 100644 --- a/source/blender/blenlib/intern/BLI_kdopbvh.c +++ b/source/blender/blenlib/intern/BLI_kdopbvh.c @@ -1494,7 +1494,7 @@ static float fast_ray_nearest_hit(const BVHRayCastData *data, const BVHNode *nod float t2z = (bv[data->index[5]] - data->ray.origin[2]) * data->idot_axis[2]; if(t1x > t2y || t2x < t1y || t1x > t2z || t2x < t1z || t1y > t2z || t2y < t1z) return FLT_MAX; - if(t2x < 0.0 || t2y < 0.0 || t2z < 0.0) return FLT_MAX; + if(t2x < 0.0f || t2y < 0.0f || t2z < 0.0f) return FLT_MAX; if(t1x > data->hit.dist || t1y > data->hit.dist || t1z > data->hit.dist) return FLT_MAX; dist = t1x; @@ -1599,11 +1599,11 @@ int BLI_bvhtree_ray_cast(BVHTree *tree, const float *co, const float *dir, float data.ray_dot_axis[i] = INPR( data.ray.direction, KDOP_AXES[i]); data.idot_axis[i] = 1.0f / data.ray_dot_axis[i]; - if(fabs(data.ray_dot_axis[i]) < FLT_EPSILON) + if(fabsf(data.ray_dot_axis[i]) < FLT_EPSILON) { data.ray_dot_axis[i] = 0.0; } - data.index[2*i] = data.idot_axis[i] < 0.0 ? 1 : 0; + data.index[2*i] = data.idot_axis[i] < 0.0f ? 1 : 0; data.index[2*i+1] = 1 - data.index[2*i]; data.index[2*i] += 2*i; data.index[2*i+1] += 2*i; @@ -1654,7 +1654,7 @@ float BLI_bvhtree_bb_raycast(float *bv, float *light_start, float *light_end, fl dist = ray_nearest_hit(&data, bv); - if(dist > 0.0) + if(dist > 0.0f) { VECADDFAC(pos, light_start, data.ray.direction, dist); } diff --git a/source/blender/blenlib/intern/BLI_kdtree.c b/source/blender/blenlib/intern/BLI_kdtree.c index 713bfde3417..c885e8c8a9c 100644 --- a/source/blender/blenlib/intern/BLI_kdtree.c +++ b/source/blender/blenlib/intern/BLI_kdtree.c @@ -187,7 +187,7 @@ int BLI_kdtree_find_nearest(KDTree *tree, float *co, float *nor, KDTreeNearest * cur_dist = node->co[node->d] - co[node->d]; - if(cur_dist<0.0){ + if(cur_dist<0.0f){ cur_dist= -cur_dist*cur_dist; if(-cur_dist<min_dist){ @@ -294,7 +294,7 @@ int BLI_kdtree_find_n_nearest(KDTree *tree, int n, float *co, float *nor, KDTree cur_dist = node->co[node->d] - co[node->d]; - if(cur_dist<0.0){ + if(cur_dist<0.0f){ cur_dist= -cur_dist*cur_dist; if(found<n || -cur_dist<nearest[found-1].dist){ diff --git a/source/blender/blenlib/intern/graph.c b/source/blender/blenlib/intern/graph.c index 51e639d1c75..2e26f4bd9c9 100644 --- a/source/blender/blenlib/intern/graph.c +++ b/source/blender/blenlib/intern/graph.c @@ -714,7 +714,7 @@ static void handleRadialSymmetry(BGraph *graph, BNode *root_node, int depth, flo int dispatch = 0; int last = i - 1; - if (fabs(ring[first].arc->length - ring[i].arc->length) > limit) + if (fabsf(ring[first].arc->length - ring[i].arc->length) > limit) { dispatch = 1; } diff --git a/source/blender/blenlib/intern/math_matrix.c b/source/blender/blenlib/intern/math_matrix.c index 5edf6e28d4c..3c79a77707a 100644 --- a/source/blender/blenlib/intern/math_matrix.c +++ b/source/blender/blenlib/intern/math_matrix.c @@ -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]) diff --git a/source/blender/blenlib/intern/storage.c b/source/blender/blenlib/intern/storage.c index 41eedef8835..67e27063fd0 100644 --- a/source/blender/blenlib/intern/storage.c +++ b/source/blender/blenlib/intern/storage.c @@ -338,7 +338,7 @@ void BLI_adddirstrings(void) if ( pwuser ) { BLI_strncpy(file->owner, pwuser->pw_name, sizeof(file->owner)); } else { - snprintf(file->owner, sizeof(file->owner), "%d", file->s.st_uid); + BLI_snprintf(file->owner, sizeof(file->owner), "%d", file->s.st_uid); } } #endif diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index 3eafa79a19a..54b3bca1111 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -10147,7 +10147,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main) !(seq->flag & SEQ_USE_PROXY_CUSTOM_DIR)) { - snprintf(seq->strip->proxy->dir, + BLI_snprintf(seq->strip->proxy->dir, FILE_MAXDIR, "%s/BL_proxy", seq->strip->dir); } diff --git a/source/blender/blenpluginapi/iff.h b/source/blender/blenpluginapi/iff.h index 77cdf889ea5..d29853f7d15 100644 --- a/source/blender/blenpluginapi/iff.h +++ b/source/blender/blenpluginapi/iff.h @@ -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 */ diff --git a/source/blender/collada/AnimationExporter.h b/source/blender/collada/AnimationExporter.h index 267ad4be887..d277dad8e8c 100644 --- a/source/blender/collada/AnimationExporter.h +++ b/source/blender/collada/AnimationExporter.h @@ -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 +}; diff --git a/source/blender/collada/ArmatureImporter.cpp b/source/blender/collada/ArmatureImporter.cpp index 1e7879b352f..2ec8ae540d2 100644 --- a/source/blender/collada/ArmatureImporter.cpp +++ b/source/blender/collada/ArmatureImporter.cpp @@ -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); diff --git a/source/blender/collada/ExtraHandler.cpp b/source/blender/collada/ExtraHandler.cpp index a60ef8b2ea5..820665ad757 100644 --- a/source/blender/collada/ExtraHandler.cpp +++ b/source/blender/collada/ExtraHandler.cpp @@ -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)); diff --git a/source/blender/editors/animation/anim_channels_defines.c b/source/blender/editors/animation/anim_channels_defines.c index 806af4c0ef5..bdc654ff25a 100644 --- a/source/blender/editors/animation/anim_channels_defines.c +++ b/source/blender/editors/animation/anim_channels_defines.c @@ -1273,7 +1273,7 @@ static int acf_dstex_icon(bAnimListElem *UNUSED(ale)) /* offset for texture expanders */ // FIXME: soon to be obsolete? -static short acf_dstex_offset(bAnimContext *UNUSED(ac), bAnimListElem *ale) +static short acf_dstex_offset(bAnimContext *UNUSED(ac), bAnimListElem *UNUSED(ale)) { return 14; // XXX: simply include this in indention instead? } diff --git a/source/blender/editors/animation/anim_channels_edit.c b/source/blender/editors/animation/anim_channels_edit.c index c9d6f9a6420..d58d51c8e08 100644 --- a/source/blender/editors/animation/anim_channels_edit.c +++ b/source/blender/editors/animation/anim_channels_edit.c @@ -2018,7 +2018,7 @@ static void rename_anim_channels (bAnimContext *ac, int channel_index) ED_region_tag_redraw(ac->ar); } -static int animchannels_rename_invoke (bContext *C, wmOperator *op, wmEvent *evt) +static int animchannels_rename_invoke (bContext *C, wmOperator *UNUSED(op), wmEvent *evt) { bAnimContext ac; ARegion *ar; diff --git a/source/blender/editors/animation/anim_filter.c b/source/blender/editors/animation/anim_filter.c index 0472731dd6d..8010a41ccb3 100644 --- a/source/blender/editors/animation/anim_filter.c +++ b/source/blender/editors/animation/anim_filter.c @@ -990,7 +990,7 @@ static size_t animfilter_fcurves (ListBase *anim_data, bDopeSheet *ads, FCurve * return items; } -static size_t animfilter_act_group (bAnimContext *ac, ListBase *anim_data, bDopeSheet *ads, bAction *act, bActionGroup *agrp, int filter_mode, ID *owner_id) +static size_t animfilter_act_group (bAnimContext *ac, ListBase *anim_data, bDopeSheet *ads, bAction *UNUSED(act), bActionGroup *agrp, int filter_mode, ID *owner_id) { ListBase tmp_data = {NULL, NULL}; size_t tmp_items = 0; diff --git a/source/blender/editors/armature/poseSlide.c b/source/blender/editors/armature/poseSlide.c index 3c15ff52a30..b0ff60455cf 100644 --- a/source/blender/editors/armature/poseSlide.c +++ b/source/blender/editors/armature/poseSlide.c @@ -520,7 +520,7 @@ static void pose_slide_reset (tPoseSlideOp *pso) /* ------------------------------------ */ /* draw percentage indicator in header */ -static void pose_slide_draw_status (bContext *C, tPoseSlideOp *pso) +static void pose_slide_draw_status (tPoseSlideOp *pso) { char statusStr[32]; char mode[32]; @@ -615,7 +615,7 @@ static int pose_slide_invoke_common (bContext *C, wmOperator *op, tPoseSlideOp * WM_cursor_modal(win, BC_EW_SCROLLCURSOR); /* header print */ - pose_slide_draw_status(C, pso); + pose_slide_draw_status(pso); /* add a modal handler for this operator */ WM_event_add_modal_handler(C, op); @@ -672,7 +672,7 @@ static int pose_slide_modal (bContext *C, wmOperator *op, wmEvent *evt) RNA_float_set(op->ptr, "percentage", pso->percentage); /* update percentage indicator in header */ - pose_slide_draw_status(C, pso); + pose_slide_draw_status(pso); /* reset transforms (to avoid accumulation errors) */ pose_slide_reset(pso); diff --git a/source/blender/editors/armature/poseobject.c b/source/blender/editors/armature/poseobject.c index d2f32837d6d..3911be02fe7 100644 --- a/source/blender/editors/armature/poseobject.c +++ b/source/blender/editors/armature/poseobject.c @@ -1611,7 +1611,7 @@ static int compare_agroup(const void *sgrp_a_ptr, const void *sgrp_b_ptr) return strcmp(sgrp_a->agrp->name, sgrp_b->agrp->name); } -static int group_sort_exec(bContext *C, wmOperator *op) +static int group_sort_exec(bContext *C, wmOperator *UNUSED(op)) { Object *ob= CTX_data_pointer_get_type(C, "object", &RNA_Object).data; bPose *pose= (ob) ? ob->pose : NULL; @@ -2275,7 +2275,7 @@ void POSE_OT_quaternions_flip (wmOperatorType *ot) /* ********************************************** */ /* Clear User Transforms */ -static int pose_clear_user_transforms_exec (bContext *C, wmOperator *op) +static int pose_clear_user_transforms_exec (bContext *C, wmOperator *UNUSED(op)) { Scene *scene = CTX_data_scene(C); Object *ob = CTX_data_active_object(C); diff --git a/source/blender/editors/object/object_add.c b/source/blender/editors/object/object_add.c index 838523599c5..45888b1486b 100644 --- a/source/blender/editors/object/object_add.c +++ b/source/blender/editors/object/object_add.c @@ -277,8 +277,10 @@ int ED_object_add_generic_get_opts(bContext *C, wmOperator *op, float *loc, 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); diff --git a/source/blender/editors/object/object_select.c b/source/blender/editors/object/object_select.c index b3c4ffc0ac9..cb1fc7541d0 100644 --- a/source/blender/editors/object/object_select.c +++ b/source/blender/editors/object/object_select.c @@ -600,7 +600,7 @@ static short select_grouped_keyingset(bContext *C, Object *UNUSED(ob)) */ for (ksp = ks->paths.first; ksp; ksp = ksp->next) { /* if id matches, select then stop looping (match found) */ - if (ksp->id == base->object) { + if (ksp->id == (ID *)base->object) { ED_base_object_select(base, BA_SELECT); changed = 1; break; diff --git a/source/blender/editors/physics/physics_fluid.c b/source/blender/editors/physics/physics_fluid.c index 37309f1e07c..bd53de20871 100644 --- a/source/blender/editors/physics/physics_fluid.c +++ b/source/blender/editors/physics/physics_fluid.c @@ -41,12 +41,6 @@ #include <string.h> #include <sys/stat.h> -#ifdef WIN32 /* Windos */ -#ifndef snprintf -#define snprintf _snprintf -#endif -#endif - #include "MEM_guardedalloc.h" /* types */ @@ -155,8 +149,8 @@ static int fluid_is_animated_mesh(FluidsimSettings *fss) #if 0 /* helper function */ void fluidsimGetGeometryObjFilename(Object *ob, char *dst) { //, char *srcname) { - //snprintf(dst,FILE_MAXFILE, "%s_cfgdata_%s.bobj.gz", srcname, ob->id.name); - snprintf(dst,FILE_MAXFILE, "fluidcfgdata_%s.bobj.gz", ob->id.name); + //BLI_snprintf(dst,FILE_MAXFILE, "%s_cfgdata_%s.bobj.gz", srcname, ob->id.name); + BLI_snprintf(dst,FILE_MAXFILE, "fluidcfgdata_%s.bobj.gz", ob->id.name); } #endif @@ -888,7 +882,7 @@ static int fluidsimBake(bContext *C, ReportList *reports, Object *fsDomain) if(getenv(strEnvName)) { int dlevel = atoi(getenv(strEnvName)); elbeemSetDebugLevel(dlevel); - snprintf(debugStrBuffer,256,"fluidsimBake::msg: Debug messages activated due to envvar '%s'\n",strEnvName); + BLI_snprintf(debugStrBuffer,256,"fluidsimBake::msg: Debug messages activated due to envvar '%s'\n",strEnvName); elbeemDebugOut(debugStrBuffer); } @@ -925,7 +919,7 @@ static int fluidsimBake(bContext *C, ReportList *reports, Object *fsDomain) /* rough check of settings... */ if(domainSettings->previewresxyz > domainSettings->resolutionxyz) { - snprintf(debugStrBuffer,256,"fluidsimBake::warning - Preview (%d) >= Resolution (%d)... setting equal.\n", domainSettings->previewresxyz , domainSettings->resolutionxyz); + BLI_snprintf(debugStrBuffer,256,"fluidsimBake::warning - Preview (%d) >= Resolution (%d)... setting equal.\n", domainSettings->previewresxyz , domainSettings->resolutionxyz); elbeemDebugOut(debugStrBuffer); domainSettings->previewresxyz = domainSettings->resolutionxyz; } @@ -945,7 +939,7 @@ static int fluidsimBake(bContext *C, ReportList *reports, Object *fsDomain) } else { gridlevels = domainSettings->maxRefine; } - snprintf(debugStrBuffer,256,"fluidsimBake::msg: Baking %s, refine: %d\n", fsDomain->id.name , gridlevels ); + BLI_snprintf(debugStrBuffer,256,"fluidsimBake::msg: Baking %s, refine: %d\n", fsDomain->id.name , gridlevels ); elbeemDebugOut(debugStrBuffer); @@ -997,7 +991,7 @@ static int fluidsimBake(bContext *C, ReportList *reports, Object *fsDomain) /* ******** init domain object's matrix ******** */ copy_m4_m4(domainMat, fsDomain->obmat); if(!invert_m4_m4(invDomMat, domainMat)) { - snprintf(debugStrBuffer,256,"fluidsimBake::error - Invalid obj matrix?\n"); + BLI_snprintf(debugStrBuffer,256,"fluidsimBake::error - Invalid obj matrix?\n"); elbeemDebugOut(debugStrBuffer); BKE_report(reports, RPT_ERROR, "Invalid object matrix."); diff --git a/source/blender/editors/space_console/space_console.c b/source/blender/editors/space_console/space_console.c index 52c5100900d..c8fa049f5eb 100644 --- a/source/blender/editors/space_console/space_console.c +++ b/source/blender/editors/space_console/space_console.c @@ -169,7 +169,7 @@ static void id_drop_copy(wmDrag *drag, wmDropBox *drop) BLI_strescape(id_esc, id->name+2, sizeof(id_esc)); - snprintf(text, sizeof(text), "bpy.data.%s[\"%s\"]", BKE_idcode_to_name_plural(GS(id->name)), id_esc); + BLI_snprintf(text, sizeof(text), "bpy.data.%s[\"%s\"]", BKE_idcode_to_name_plural(GS(id->name)), id_esc); /* copy drag path to properties */ RNA_string_set(drop->ptr, "text", text); @@ -186,7 +186,7 @@ static int path_drop_poll(bContext *UNUSED(C), wmDrag *drag, wmEvent *UNUSED(eve static void path_drop_copy(wmDrag *drag, wmDropBox *drop) { char pathname[FILE_MAXDIR+FILE_MAXFILE+2]; - snprintf(pathname, sizeof(pathname), "\"%s\"", drag->path); + BLI_snprintf(pathname, sizeof(pathname), "\"%s\"", drag->path); RNA_string_set(drop->ptr, "text", pathname); } diff --git a/source/blender/editors/space_graph/graph_draw.c b/source/blender/editors/space_graph/graph_draw.c index d65297e068d..dc5e71f0406 100644 --- a/source/blender/editors/space_graph/graph_draw.c +++ b/source/blender/editors/space_graph/graph_draw.c @@ -706,7 +706,7 @@ static void draw_fcurve_curve_bezts (bAnimContext *ac, ID *id, FCurve *fcu, View if (fcu->driver) resol= 32; else - resol= (int)(5.0*len_v2v2(bezt->vec[1], prevbezt->vec[1])); + resol= (int)(5.0f*len_v2v2(bezt->vec[1], prevbezt->vec[1])); if (resol < 2) { /* only draw one */ diff --git a/source/blender/editors/space_image/image_ops.c b/source/blender/editors/space_image/image_ops.c index d58b78ff6a7..68f9e4d033e 100644 --- a/source/blender/editors/space_image/image_ops.c +++ b/source/blender/editors/space_image/image_ops.c @@ -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 { diff --git a/source/blender/editors/space_logic/logic_window.c b/source/blender/editors/space_logic/logic_window.c index 882d89fcd33..920e93cc0fc 100644 --- a/source/blender/editors/space_logic/logic_window.c +++ b/source/blender/editors/space_logic/logic_window.c @@ -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); diff --git a/source/blender/editors/space_nla/nla_draw.c b/source/blender/editors/space_nla/nla_draw.c index 0583f328371..0c9c7877ddc 100644 --- a/source/blender/editors/space_nla/nla_draw.c +++ b/source/blender/editors/space_nla/nla_draw.c @@ -468,10 +468,10 @@ static void nla_draw_strip_text (AnimData *adt, NlaTrack *nlt, NlaStrip *strip, /* just print the name and the range */ if (strip->flag & NLASTRIP_FLAG_TEMP_META) { - sprintf(str, "%d) Temp-Meta", index); + BLI_snprintf(str, sizeof(str), "%d) Temp-Meta", index); } else { - sprintf(str, strip->name); + BLI_strncpy(str, strip->name, sizeof(str)); } /* set text color - if colors (see above) are light, draw black text, otherwise draw white */ @@ -514,7 +514,7 @@ static void nla_draw_strip_frames_text(NlaTrack *UNUSED(nlt), NlaStrip *strip, V { const float ytol = 1.0f; /* small offset to vertical positioning of text, for legibility */ const char col[4] = {220, 220, 220, 255}; /* light grey */ - char str[16] = ""; + char str[32] = ""; /* Always draw times above the strip, whereas sequencer drew below + above. @@ -524,11 +524,11 @@ static void nla_draw_strip_frames_text(NlaTrack *UNUSED(nlt), NlaStrip *strip, V * while also preserving some accuracy, since we do use floats */ /* start frame */ - sprintf(str, "%.1f", strip->start); + BLI_snprintf(str, sizeof(str), "%.1f", strip->start); UI_view2d_text_cache_add(v2d, strip->start-1.0f, ymaxc+ytol, str, col); /* end frame */ - sprintf(str, "%.1f", strip->end); + BLI_snprintf(str, sizeof(str), "%.1f", strip->end); UI_view2d_text_cache_add(v2d, strip->end, ymaxc+ytol, str, col); } @@ -730,9 +730,9 @@ static void draw_nla_channel_list_gl (bAnimContext *ac, ListBase *anim_data, Vie special = ICON_ACTION; if (act) - sprintf(name, "%s", act->id.name+2); + BLI_snprintf(name, sizeof(name), "%s", act->id.name+2); else - sprintf(name, "<No Action>"); + BLI_strncpy(name, "<No Action>", sizeof(name)); // draw manually still doDraw= 1; diff --git a/source/blender/editors/space_nla/nla_edit.c b/source/blender/editors/space_nla/nla_edit.c index 0f87be0f807..08026e8a1d2 100644 --- a/source/blender/editors/space_nla/nla_edit.c +++ b/source/blender/editors/space_nla/nla_edit.c @@ -533,7 +533,7 @@ static int nlaedit_add_transition_exec (bContext *C, wmOperator *op) if ELEM(0, (s1->flag & NLASTRIP_FLAG_SELECT), (s2->flag & NLASTRIP_FLAG_SELECT)) continue; /* check if there's space between the two */ - if (IS_EQ(s1->end, s2->start)) + if (IS_EQF(s1->end, s2->start)) continue; /* make sure neither one is a transition * - although this is impossible to create with the standard tools, @@ -613,7 +613,7 @@ void NLA_OT_transition_add (wmOperatorType *ot) /* ******************** Add Sound Clip Operator ***************************** */ /* Add a new sound clip */ -static int nlaedit_add_sound_exec (bContext *C, wmOperator *op) +static int nlaedit_add_sound_exec (bContext *C, wmOperator *UNUSED(op)) { bAnimContext ac; @@ -1013,14 +1013,14 @@ static void nlaedit_split_strip_actclip (AnimData *adt, NlaTrack *nlt, NlaStrip /* strip extents */ len= strip->end - strip->start; - if (IS_EQ(len, 0.0f)) + if (IS_EQF(len, 0.0f)) return; else splitframe= strip->start + (len / 2.0f); /* action range */ len= strip->actend - strip->actstart; - if (IS_EQ(len, 0.0f)) + if (IS_EQF(len, 0.0f)) splitaframe= strip->actend; else splitaframe= strip->actstart + (len / 2.0f); @@ -1858,10 +1858,10 @@ static int nlaedit_snap_exec (bContext *C, wmOperator *op) strip->start= (float)CFRA; break; case NLAEDIT_SNAP_NEAREST_FRAME: /* to nearest frame */ - strip->start= (float)(floor(start+0.5)); + strip->start= floorf(start+0.5f); break; case NLAEDIT_SNAP_NEAREST_SECOND: /* to nearest second */ - strip->start= ((float)floor(start/secf + 0.5f) * secf); + strip->start= floorf(start/secf + 0.5f) * secf; break; case NLAEDIT_SNAP_NEAREST_MARKER: /* to nearest marker */ strip->start= (float)ED_markers_find_nearest_marker_time(ac.markers, start); diff --git a/source/blender/editors/space_outliner/outliner_tools.c b/source/blender/editors/space_outliner/outliner_tools.c index 4525ea9c8d9..3ae158bd275 100644 --- a/source/blender/editors/space_outliner/outliner_tools.c +++ b/source/blender/editors/space_outliner/outliner_tools.c @@ -822,7 +822,7 @@ static void outliner_do_id_set_operation(SpaceOops *soops, int type, ListBase *l /* ------------------------------------------ */ -static void actionset_id_cb(TreeElement *te, TreeStoreElem *tselem, TreeStoreElem *tsep, ID *actId) +static void actionset_id_cb(TreeElement *UNUSED(te), TreeStoreElem *tselem, TreeStoreElem *tsep, ID *actId) { bAction *act = (bAction *)actId; diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c index fbb3aac43fe..2b994a2d0d2 100644 --- a/source/blender/editors/space_view3d/drawobject.c +++ b/source/blender/editors/space_view3d/drawobject.c @@ -1496,7 +1496,7 @@ static void drawcamera(Scene *scene, View3D *v3d, RegionView3D *rv3d, Object *ob } /* flag similar to draw_object() */ -static void drawspeaker(Scene *scene, View3D *v3d, RegionView3D *rv3d, Object *ob, int flag) +static void drawspeaker(Scene *UNUSED(scene), View3D *UNUSED(v3d), RegionView3D *UNUSED(rv3d), Object *UNUSED(ob), int UNUSED(flag)) { //Speaker *spk = ob->data; @@ -1505,34 +1505,29 @@ static void drawspeaker(Scene *scene, View3D *v3d, RegionView3D *rv3d, Object *o glEnable(GL_BLEND); - for(j = 0; j < 3; j++) - { - vec[2] = .25f * j -.125f; + for(j = 0; j < 3; j++) { + vec[2] = 0.25f * j -0.125f; glBegin(GL_LINE_LOOP); - for(i = 0; i < 16; i++) - { - vec[0] = cos(M_PI * i / 8.0f) * (j == 0 ? .5f : .25f); - vec[1] = sin(M_PI * i / 8.0f) * (j == 0 ? .5f : .25f); + for(i = 0; i < 16; i++) { + vec[0] = cosf(M_PI * i / 8.0f) * (j == 0 ? 0.5f : 0.25f); + vec[1] = sinf(M_PI * i / 8.0f) * (j == 0 ? 0.5f : 0.25f); glVertex3fv(vec); } glEnd(); } - for(j = 0; j < 4; j++) - { - vec[0] = (((j + 1) % 2) * (j - 1)) * .5f; - vec[1] = ((j % 2) * (j - 2)) * .5f; + for(j = 0; j < 4; j++) { + vec[0] = (((j + 1) % 2) * (j - 1)) * 0.5f; + vec[1] = ((j % 2) * (j - 2)) * 0.5f; glBegin(GL_LINE_STRIP); - for(i = 0; i < 3; i++) - { - if(i == 1) - { - vec[0] *= .5f; - vec[1] *= .5f; + for(i = 0; i < 3; i++) { + if(i == 1) { + vec[0] *= 0.5f; + vec[1] *= 0.5f; } - vec[2] = .25f * i -.125f; + vec[2] = 0.25f * i -0.125f; glVertex3fv(vec); } glEnd(); diff --git a/source/blender/editors/space_view3d/view3d_edit.c b/source/blender/editors/space_view3d/view3d_edit.c index e9ed5dac3de..19e8d42db2d 100644 --- a/source/blender/editors/space_view3d/view3d_edit.c +++ b/source/blender/editors/space_view3d/view3d_edit.c @@ -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); } } diff --git a/source/blender/gpu/intern/gpu_codegen.c b/source/blender/gpu/intern/gpu_codegen.c index 77498835d57..360f3dbf63f 100644 --- a/source/blender/gpu/intern/gpu_codegen.c +++ b/source/blender/gpu/intern/gpu_codegen.c @@ -59,15 +59,6 @@ #include <string.h> #include <stdarg.h> -#ifdef _WIN32 -#ifndef vsnprintf -#define vsnprintf _vsnprintf -#endif -#ifndef snprintf -#define snprintf _snprintf -#endif -#endif - extern char datatoc_gpu_shader_material_glsl[]; extern char datatoc_gpu_shader_vertex_glsl[]; @@ -168,24 +159,6 @@ struct GPUPass { struct GPUShader *shader; }; -/* Strings utility */ - -static void BLI_dynstr_printf(DynStr *dynstr, const char *format, ...) -{ - va_list args; - int retval; - char str[2048]; - - va_start(args, format); - retval = vsnprintf(str, sizeof(str), format, args); - va_end(args); - - if (retval >= sizeof(str)) - fprintf(stderr, "BLI_dynstr_printf: limit exceeded\n"); - else - BLI_dynstr_append(dynstr, str); -} - /* GLSL code parsing for finding function definitions. * These are stored in a hash for lookup when creating a material. */ @@ -318,7 +291,7 @@ static char *gpu_generate_function_prototyps(GHash *hash) name = BLI_ghashIterator_getValue(ghi); function = BLI_ghashIterator_getValue(ghi); - BLI_dynstr_printf(ds, "void %s(", name); + BLI_dynstr_appendf(ds, "void %s(", name); for(a=0; a<function->totparam; a++) { if(function->paramqual[a] == FUNCTION_QUAL_OUT) BLI_dynstr_append(ds, "out "); @@ -334,7 +307,7 @@ static char *gpu_generate_function_prototyps(GHash *hash) else BLI_dynstr_append(ds, GPU_DATATYPE_STR[function->paramtype[a]]); - //BLI_dynstr_printf(ds, " param%d", a); + //BLI_dynstr_appendf(ds, " param%d", a); if(a != function->totparam-1) BLI_dynstr_append(ds, ", "); @@ -390,42 +363,42 @@ static void codegen_convert_datatype(DynStr *ds, int from, int to, const char *t { char name[1024]; - snprintf(name, sizeof(name), "%s%d", tmp, id); + BLI_snprintf(name, sizeof(name), "%s%d", tmp, id); if (from == to) { BLI_dynstr_append(ds, name); } else if (to == GPU_FLOAT) { if (from == GPU_VEC4) - BLI_dynstr_printf(ds, "dot(%s.rgb, vec3(0.35, 0.45, 0.2))", name); + BLI_dynstr_appendf(ds, "dot(%s.rgb, vec3(0.35, 0.45, 0.2))", name); else if (from == GPU_VEC3) - BLI_dynstr_printf(ds, "dot(%s, vec3(0.33))", name); + BLI_dynstr_appendf(ds, "dot(%s, vec3(0.33))", name); else if (from == GPU_VEC2) - BLI_dynstr_printf(ds, "%s.r", name); + BLI_dynstr_appendf(ds, "%s.r", name); } else if (to == GPU_VEC2) { if (from == GPU_VEC4) - BLI_dynstr_printf(ds, "vec2(dot(%s.rgb, vec3(0.35, 0.45, 0.2)), %s.a)", name, name); + BLI_dynstr_appendf(ds, "vec2(dot(%s.rgb, vec3(0.35, 0.45, 0.2)), %s.a)", name, name); else if (from == GPU_VEC3) - BLI_dynstr_printf(ds, "vec2(dot(%s.rgb, vec3(0.33)), 1.0)", name); + BLI_dynstr_appendf(ds, "vec2(dot(%s.rgb, vec3(0.33)), 1.0)", name); else if (from == GPU_FLOAT) - BLI_dynstr_printf(ds, "vec2(%s, 1.0)", name); + BLI_dynstr_appendf(ds, "vec2(%s, 1.0)", name); } else if (to == GPU_VEC3) { if (from == GPU_VEC4) - BLI_dynstr_printf(ds, "%s.rgb", name); + BLI_dynstr_appendf(ds, "%s.rgb", name); else if (from == GPU_VEC2) - BLI_dynstr_printf(ds, "vec3(%s.r, %s.r, %s.r)", name, name, name); + BLI_dynstr_appendf(ds, "vec3(%s.r, %s.r, %s.r)", name, name, name); else if (from == GPU_FLOAT) - BLI_dynstr_printf(ds, "vec3(%s, %s, %s)", name, name, name); + BLI_dynstr_appendf(ds, "vec3(%s, %s, %s)", name, name, name); } else { if (from == GPU_VEC3) - BLI_dynstr_printf(ds, "vec4(%s, 1.0)", name); + BLI_dynstr_appendf(ds, "vec4(%s, 1.0)", name); else if (from == GPU_VEC2) - BLI_dynstr_printf(ds, "vec4(%s.r, %s.r, %s.r, %s.g)", name, name, name, name); + BLI_dynstr_appendf(ds, "vec4(%s.r, %s.r, %s.r, %s.g)", name, name, name, name); else if (from == GPU_FLOAT) - BLI_dynstr_printf(ds, "vec4(%s, %s, %s, 1.0)", name, name, name); + BLI_dynstr_appendf(ds, "vec4(%s, %s, %s, 1.0)", name, name, name); } } @@ -433,10 +406,10 @@ static void codegen_print_datatype(DynStr *ds, int type, float *data) { int i; - BLI_dynstr_printf(ds, "%s(", GPU_DATATYPE_STR[type]); + BLI_dynstr_appendf(ds, "%s(", GPU_DATATYPE_STR[type]); for(i=0; i<type; i++) { - BLI_dynstr_printf(ds, "%f", data[i]); + BLI_dynstr_appendf(ds, "%f", data[i]); if(i == type-1) BLI_dynstr_append(ds, ")"); else @@ -568,7 +541,7 @@ static void codegen_print_uniforms_functions(DynStr *ds, ListBase *nodes) if ((input->source == GPU_SOURCE_TEX) || (input->source == GPU_SOURCE_TEX_PIXEL)) { /* create exactly one sampler for each texture */ if (codegen_input_has_texture(input) && input->bindtex) - BLI_dynstr_printf(ds, "uniform %s samp%d;\n", + BLI_dynstr_appendf(ds, "uniform %s samp%d;\n", (input->textype == GPU_TEX1D)? "sampler1D": (input->textype == GPU_TEX2D)? "sampler2D": "sampler2DShadow", input->texid); @@ -580,11 +553,11 @@ static void codegen_print_uniforms_functions(DynStr *ds, ListBase *nodes) name = GPU_builtin_name(input->builtin); if(gpu_str_prefix(name, "unf")) { - BLI_dynstr_printf(ds, "uniform %s %s;\n", + BLI_dynstr_appendf(ds, "uniform %s %s;\n", GPU_DATATYPE_STR[input->type], name); } else { - BLI_dynstr_printf(ds, "varying %s %s;\n", + BLI_dynstr_appendf(ds, "varying %s %s;\n", GPU_DATATYPE_STR[input->type], name); } } @@ -592,19 +565,19 @@ static void codegen_print_uniforms_functions(DynStr *ds, ListBase *nodes) else if (input->source == GPU_SOURCE_VEC_UNIFORM) { if(input->dynamicvec) { /* only create uniforms for dynamic vectors */ - BLI_dynstr_printf(ds, "uniform %s unf%d;\n", + BLI_dynstr_appendf(ds, "uniform %s unf%d;\n", GPU_DATATYPE_STR[input->type], input->id); } else { /* for others use const so the compiler can do folding */ - BLI_dynstr_printf(ds, "const %s cons%d = ", + BLI_dynstr_appendf(ds, "const %s cons%d = ", GPU_DATATYPE_STR[input->type], input->id); codegen_print_datatype(ds, input->type, input->vec); BLI_dynstr_append(ds, ";\n"); } } else if (input->source == GPU_SOURCE_ATTRIB && input->attribfirst) { - BLI_dynstr_printf(ds, "varying %s var%d;\n", + BLI_dynstr_appendf(ds, "varying %s var%d;\n", GPU_DATATYPE_STR[input->type], input->attribid); } } @@ -624,8 +597,8 @@ static void codegen_declare_tmps(DynStr *ds, ListBase *nodes) for (input=node->inputs.first; input; input=input->next) { if (input->source == GPU_SOURCE_TEX_PIXEL) { if (codegen_input_has_texture(input) && input->definetex) { - BLI_dynstr_printf(ds, "\tvec4 tex%d = texture2D(", input->texid); - BLI_dynstr_printf(ds, "samp%d, gl_TexCoord[%d].st);\n", + BLI_dynstr_appendf(ds, "\tvec4 tex%d = texture2D(", input->texid); + BLI_dynstr_appendf(ds, "samp%d, gl_TexCoord[%d].st);\n", input->texid, input->texid); } } @@ -633,7 +606,7 @@ static void codegen_declare_tmps(DynStr *ds, ListBase *nodes) /* declare temporary variables for node output storage */ for (output=node->outputs.first; output; output=output->next) - BLI_dynstr_printf(ds, "\t%s tmp%d;\n", + BLI_dynstr_appendf(ds, "\t%s tmp%d;\n", GPU_DATATYPE_STR[output->type], output->id); } @@ -647,13 +620,13 @@ static void codegen_call_functions(DynStr *ds, ListBase *nodes, GPUOutput *final GPUOutput *output; for (node=nodes->first; node; node=node->next) { - BLI_dynstr_printf(ds, "\t%s(", node->name); + BLI_dynstr_appendf(ds, "\t%s(", node->name); for (input=node->inputs.first; input; input=input->next) { if (input->source == GPU_SOURCE_TEX) { - BLI_dynstr_printf(ds, "samp%d", input->texid); + BLI_dynstr_appendf(ds, "samp%d", input->texid); if (input->link) - BLI_dynstr_printf(ds, ", gl_TexCoord[%d].st", input->texid); + BLI_dynstr_appendf(ds, ", gl_TexCoord[%d].st", input->texid); } else if (input->source == GPU_SOURCE_TEX_PIXEL) { if (input->link && input->link->output) @@ -664,21 +637,21 @@ static void codegen_call_functions(DynStr *ds, ListBase *nodes, GPUOutput *final "tex", input->texid); } else if(input->source == GPU_SOURCE_BUILTIN) - BLI_dynstr_printf(ds, "%s", GPU_builtin_name(input->builtin)); + BLI_dynstr_appendf(ds, "%s", GPU_builtin_name(input->builtin)); else if(input->source == GPU_SOURCE_VEC_UNIFORM) { if(input->dynamicvec) - BLI_dynstr_printf(ds, "unf%d", input->id); + BLI_dynstr_appendf(ds, "unf%d", input->id); else - BLI_dynstr_printf(ds, "cons%d", input->id); + BLI_dynstr_appendf(ds, "cons%d", input->id); } else if (input->source == GPU_SOURCE_ATTRIB) - BLI_dynstr_printf(ds, "var%d", input->attribid); + BLI_dynstr_appendf(ds, "var%d", input->attribid); BLI_dynstr_append(ds, ", "); } for (output=node->outputs.first; output; output=output->next) { - BLI_dynstr_printf(ds, "tmp%d", output->id); + BLI_dynstr_appendf(ds, "tmp%d", output->id); if (output->next) BLI_dynstr_append(ds, ", "); } @@ -702,7 +675,7 @@ static char *code_generate_fragment(ListBase *nodes, GPUOutput *output, const ch codegen_print_uniforms_functions(ds, nodes); //if(G.f & G_DEBUG) - // BLI_dynstr_printf(ds, "/* %s */\n", name); + // BLI_dynstr_appendf(ds, "/* %s */\n", name); BLI_dynstr_append(ds, "void main(void)\n"); BLI_dynstr_append(ds, "{\n"); @@ -731,9 +704,9 @@ static char *code_generate_vertex(ListBase *nodes) for (node=nodes->first; node; node=node->next) { for (input=node->inputs.first; input; input=input->next) { if (input->source == GPU_SOURCE_ATTRIB && input->attribfirst) { - BLI_dynstr_printf(ds, "attribute %s att%d;\n", + BLI_dynstr_appendf(ds, "attribute %s att%d;\n", GPU_DATATYPE_STR[input->type], input->attribid); - BLI_dynstr_printf(ds, "varying %s var%d;\n", + BLI_dynstr_appendf(ds, "varying %s var%d;\n", GPU_DATATYPE_STR[input->type], input->attribid); } } @@ -747,11 +720,11 @@ static char *code_generate_vertex(ListBase *nodes) if (input->source == GPU_SOURCE_ATTRIB && input->attribfirst) { if(input->attribtype == CD_TANGENT) /* silly exception */ { - BLI_dynstr_printf(ds, "\tvar%d.xyz = normalize((gl_ModelViewMatrix * vec4(att%d.xyz, 0)).xyz);\n", input->attribid, input->attribid); - BLI_dynstr_printf(ds, "\tvar%d.w = att%d.w;\n", input->attribid, input->attribid); + BLI_dynstr_appendf(ds, "\tvar%d.xyz = normalize((gl_ModelViewMatrix * vec4(att%d.xyz, 0)).xyz);\n", input->attribid, input->attribid); + BLI_dynstr_appendf(ds, "\tvar%d.w = att%d.w;\n", input->attribid, input->attribid); } else - BLI_dynstr_printf(ds, "\tvar%d = att%d;\n", input->attribid, input->attribid); + BLI_dynstr_appendf(ds, "\tvar%d = att%d;\n", input->attribid, input->attribid); } BLI_dynstr_append(ds, "}\n\n"); @@ -799,9 +772,9 @@ static void GPU_nodes_extract_dynamic_inputs(GPUPass *pass, ListBase *nodes) continue; if (input->ima || input->tex) - snprintf(input->shadername, sizeof(input->shadername), "samp%d", input->texid); + BLI_snprintf(input->shadername, sizeof(input->shadername), "samp%d", input->texid); else - snprintf(input->shadername, sizeof(input->shadername), "unf%d", input->id); + BLI_snprintf(input->shadername, sizeof(input->shadername), "unf%d", input->id); /* pass non-dynamic uniforms to opengl */ extract = 0; diff --git a/source/blender/imbuf/CMakeLists.txt b/source/blender/imbuf/CMakeLists.txt index ff13be20d4e..1547d2ee9ce 100644 --- a/source/blender/imbuf/CMakeLists.txt +++ b/source/blender/imbuf/CMakeLists.txt @@ -55,6 +55,8 @@ set(SRC intern/filetype.c intern/filter.c intern/imageprocess.c + intern/indexer.c + intern/indexer_dv.c intern/iris.c intern/jp2.c intern/jpeg.c @@ -73,7 +75,6 @@ set(SRC intern/tiff.c intern/util.c intern/writeimage.c - intern/indexer.c IMB_imbuf.h IMB_imbuf_types.h @@ -82,6 +83,7 @@ set(SRC intern/IMB_anim.h intern/IMB_filetype.h intern/IMB_filter.h + intern/IMB_indexer.h intern/IMB_metadata.h intern/cineon/cin_debug_stuff.h intern/cineon/cineonfile.h diff --git a/source/blender/imbuf/IMB_imbuf.h b/source/blender/imbuf/IMB_imbuf.h index 1fbe8e01fd4..2c926f2d94b 100644 --- a/source/blender/imbuf/IMB_imbuf.h +++ b/source/blender/imbuf/IMB_imbuf.h @@ -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); diff --git a/source/blender/imbuf/intern/indexer_dv.c b/source/blender/imbuf/intern/indexer_dv.c index 0961af10f69..2def0d042b7 100644 --- a/source/blender/imbuf/intern/indexer_dv.c +++ b/source/blender/imbuf/intern/indexer_dv.c @@ -26,6 +26,7 @@ #include "IMB_indexer.h" #include "MEM_guardedalloc.h" +#include "BLI_utildefines.h" #include <time.h> typedef struct indexer_dv_bitstream { @@ -279,7 +280,7 @@ static void fill_gap(indexer_dv_context * This, int isPAL) } static void proc_frame(indexer_dv_context * This, - unsigned char* framebuffer, int isPAL) + unsigned char* UNUSED(framebuffer), int isPAL) { struct tm recDate; time_t t; @@ -329,7 +330,7 @@ static void proc_frame(indexer_dv_context * This, static void indexer_dv_proc_frame(anim_index_builder * idx, unsigned char * buffer, - int data_size, + int UNUSED(data_size), struct anim_index_entry * entry) { int isPAL; diff --git a/source/blender/imbuf/intern/openexr/openexr_api.cpp b/source/blender/imbuf/intern/openexr/openexr_api.cpp index 7b528ed9624..88f6508d356 100644 --- a/source/blender/imbuf/intern/openexr/openexr_api.cpp +++ b/source/blender/imbuf/intern/openexr/openexr_api.cpp @@ -487,7 +487,7 @@ void IMB_exr_add_channel(void *handle, const char *layname, const char *passname } /* only used for writing temp. render results (not image files) */ -void IMB_exr_begin_write(void *handle, const char *filename, int width, int height, int compress) +int IMB_exr_begin_write(void *handle, const char *filename, int width, int height, int compress) { ExrHandle *data= (ExrHandle *)handle; Header header (width, height); @@ -504,8 +504,17 @@ void IMB_exr_begin_write(void *handle, const char *filename, int width, int heig /* header.lineOrder() = DECREASING_Y; this crashes in windows for file read! */ header.insert ("BlenderMultiChannel", StringAttribute ("Blender V2.55.1 and newer")); - - data->ofile = new OutputFile(filename, header); + + /* avoid crash/abort when we dont have permission to write here */ + try { + data->ofile = new OutputFile(filename, header); + } + catch (const std::exception &exc) { + std::cerr << "IMB_exr_begin_write: ERROR: " << exc.what() << std::endl; + data->ofile = NULL; + } + + return (data->ofile != NULL); } void IMB_exrtile_begin_write(void *handle, const char *filename, int mipmap, int width, int height, int tilex, int tiley) diff --git a/source/blender/imbuf/intern/openexr/openexr_multi.h b/source/blender/imbuf/intern/openexr/openexr_multi.h index 3d95bb7c306..58c5e0f2a3e 100644 --- a/source/blender/imbuf/intern/openexr/openexr_multi.h +++ b/source/blender/imbuf/intern/openexr/openexr_multi.h @@ -50,7 +50,7 @@ void * IMB_exr_get_handle (void); void IMB_exr_add_channel (void *handle, const char *layname, const char *passname, int xstride, int ystride, float *rect); int IMB_exr_begin_read (void *handle, const char *filename, int *width, int *height); -void IMB_exr_begin_write (void *handle, const char *filename, int width, int height, int compress); +int IMB_exr_begin_write (void *handle, const char *filename, int width, int height, int compress); void IMB_exrtile_begin_write (void *handle, const char *filename, int mipmap, int width, int height, int tilex, int tiley); void IMB_exr_set_channel (void *handle, const char *layname, const char *passname, int xstride, int ystride, float *rect); @@ -75,7 +75,7 @@ void * IMB_exr_get_handle (void) {return NULL;} void IMB_exr_add_channel (void *handle, const char *layname, const char *channame, int xstride, int ystride, float *rect) { (void)handle; (void)layname; (void)channame; (void)xstride; (void)ystride; (void)rect; } int IMB_exr_begin_read (void *handle, const char *filename, int *width, int *height) { (void)handle; (void)filename; (void)width; (void)height; return 0;} -void IMB_exr_begin_write (void *handle, const char *filename, int width, int height, int compress) { (void)handle; (void)filename; (void)width; (void)height; (void)compress; } +int IMB_exr_begin_write (void *handle, const char *filename, int width, int height, int compress) { (void)handle; (void)filename; (void)width; (void)height; (void)compress; return 0;} void IMB_exrtile_begin_write (void *handle, const char *filename, int mipmap, int width, int height, int tilex, int tiley) { (void)handle; (void)filename; (void)mipmap; (void)width; (void)height; (void)tilex; (void)tiley; } void IMB_exr_set_channel (void *handle, char *layname, const char *channame, int xstride, int ystride, float *rect) { (void)handle; (void)layname; (void)channame; (void)xstride; (void)ystride; (void)rect; } diff --git a/source/blender/imbuf/intern/rectop.c b/source/blender/imbuf/intern/rectop.c index 844478e03cb..db2ae3a5114 100644 --- a/source/blender/imbuf/intern/rectop.c +++ b/source/blender/imbuf/intern/rectop.c @@ -482,7 +482,7 @@ void IMB_rectfill(struct ImBuf *drect, const float col[4]) } -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) { int i, j; float a; /* alpha */ @@ -509,6 +509,8 @@ void buf_rectfill_area(unsigned char *rect, float *rectf, int width, int height, unsigned char *pixel; unsigned char chr=0, chg=0, chb=0; float fr=0, fg=0, fb=0; + + const int alphaint= FTOCHAR(a); if (a == 1.0f) { chr = FTOCHAR(col[0]); @@ -527,10 +529,13 @@ void buf_rectfill_area(unsigned char *rect, float *rectf, int width, int height, pixel[0] = chr; pixel[1] = chg; pixel[2] = chb; + pixel[3] = 255; } else { + int alphatest; pixel[0] = (char)((fr + ((float)pixel[0]*aich))*255.0f); pixel[1] = (char)((fg + ((float)pixel[1]*aich))*255.0f); pixel[2] = (char)((fb + ((float)pixel[2]*aich))*255.0f); + pixel[3] = (char)((alphatest= ((int)pixel[3] + alphaint)) < 255 ? alphatest : 255); } } } @@ -546,10 +551,13 @@ void buf_rectfill_area(unsigned char *rect, float *rectf, int width, int height, pixel[0] = col[0]; pixel[1] = col[1]; pixel[2] = col[2]; + pixel[3] = 1.0f; } else { + float alphatest; pixel[0] = (col[0]*a) + (pixel[0]*ai); pixel[1] = (col[1]*a) + (pixel[1]*ai); pixel[2] = (col[2]*a) + (pixel[2]*ai); + pixel[3] = (alphatest= (pixel[3] + a)) < 1.0f ? alphatest : 1.0f; } } } diff --git a/source/blender/imbuf/intern/writeimage.c b/source/blender/imbuf/intern/writeimage.c index cd660e11f26..b933e6d93ee 100644 --- a/source/blender/imbuf/intern/writeimage.c +++ b/source/blender/imbuf/intern/writeimage.c @@ -55,7 +55,6 @@ short IMB_saveiff(struct ImBuf *ibuf, const char *name, int flags) if(ibuf->rect==NULL && ibuf->rect_float) IMB_rect_from_float(ibuf); } - /* TODO. have const char for image write funcs */ return type->save(ibuf, name, flags); } } diff --git a/source/blender/python/intern/bpy_app_handlers.c b/source/blender/python/intern/bpy_app_handlers.c index 77ba6031da5..eeb2adb3cf2 100644 --- a/source/blender/python/intern/bpy_app_handlers.c +++ b/source/blender/python/intern/bpy_app_handlers.c @@ -42,9 +42,10 @@ static PyTypeObject BlenderAppCbType; static PyStructSequence_Field app_cb_info_fields[]= { {(char *)"render_pre", NULL}, {(char *)"render_post", NULL}, - {(char *)"load_pre", NULL}, + {(char *)"render_stats", NULL}, + {(char *)"load_pre", NULL}, {(char *)"load_post", NULL}, - {(char *)"save_pre", NULL}, + {(char *)"save_pre", NULL}, {(char *)"save_post", NULL}, {NULL} }; diff --git a/source/blender/python/intern/bpy_intern_string.c b/source/blender/python/intern/bpy_intern_string.c index 6fc861b2a0d..7c80653496f 100644 --- a/source/blender/python/intern/bpy_intern_string.c +++ b/source/blender/python/intern/bpy_intern_string.c @@ -40,7 +40,7 @@ PyObject *bpy_intern_str___slots__; void bpy_intern_string_init(void) { bpy_intern_str_register= PyUnicode_FromString("register"); - bpy_intern_str_unregister= PyUnicode_FromString("unregister");; + bpy_intern_str_unregister= PyUnicode_FromString("unregister"); bpy_intern_str_bl_rna= PyUnicode_FromString("bl_rna"); bpy_intern_str_order= PyUnicode_FromString("order"); bpy_intern_str_attr= PyUnicode_FromString("attr"); diff --git a/source/blender/python/intern/bpy_rna.c b/source/blender/python/intern/bpy_rna.c index 4abcbc684e2..e1c38a82142 100644 --- a/source/blender/python/intern/bpy_rna.c +++ b/source/blender/python/intern/bpy_rna.c @@ -1251,7 +1251,7 @@ static PyObject *pyrna_enum_to_py(PointerRNA *ptr, PropertyRNA *prop, int val) #if 0 // gives python decoding errors while generating docs :( char error_str[256]; - snprintf(error_str, sizeof(error_str), "RNA Warning: Current value \"%d\" matches no enum in '%s', '%s', '%s'", val, RNA_struct_identifier(ptr->type), ptr_name, RNA_property_identifier(prop)); + BLI_snprintf(error_str, sizeof(error_str), "RNA Warning: Current value \"%d\" matches no enum in '%s', '%s', '%s'", val, RNA_struct_identifier(ptr->type), ptr_name, RNA_property_identifier(prop)); PyErr_Warn(PyExc_RuntimeWarning, error_str); #endif diff --git a/source/blender/render/extern/include/RE_pipeline.h b/source/blender/render/extern/include/RE_pipeline.h index 0736bed4faf..97ffcd95473 100644 --- a/source/blender/render/extern/include/RE_pipeline.h +++ b/source/blender/render/extern/include/RE_pipeline.h @@ -227,8 +227,8 @@ void RE_SetReports(struct Render *re, struct ReportList *reports); /* main preview render call */ void RE_PreviewRender(struct Render *re, struct Main *bmain, struct Scene *scene); -void RE_ReadRenderResult(struct Scene *scene, struct Scene *scenode); -void RE_WriteRenderResult(RenderResult *rr, const char *filename, int compress); +int RE_ReadRenderResult(struct Scene *scene, struct Scene *scenode); +int RE_WriteRenderResult(struct ReportList *reports, RenderResult *rr, const char *filename, int compress); struct RenderResult *RE_MultilayerConvert(void *exrhandle, int rectx, int recty); extern const float default_envmap_layout[]; diff --git a/source/blender/render/intern/source/pipeline.c b/source/blender/render/intern/source/pipeline.c index 0d5f8c77f6b..24c55332bff 100644 --- a/source/blender/render/intern/source/pipeline.c +++ b/source/blender/render/intern/source/pipeline.c @@ -173,6 +173,9 @@ static void stats_background(void *UNUSED(arg), RenderStats *rs) else fprintf(stdout, "Sce: %s Ve:%d Fa:%d La:%d", rs->scenename, rs->totvert, rs->totface, rs->totlamp); } + + BLI_exec_cb(rs, (ID *)rs, BLI_CB_EVT_RENDER_STATS); + fputc('\n', stdout); fflush(stdout); } @@ -824,11 +827,12 @@ static char *make_pass_name(RenderPass *rpass, int chan) /* filename already made absolute */ /* called from within UI, saves both rendered result as a file-read result */ -void RE_WriteRenderResult(RenderResult *rr, const char *filename, int compress) +int RE_WriteRenderResult(ReportList *reports, RenderResult *rr, const char *filename, int compress) { RenderLayer *rl; RenderPass *rpass; void *exrhandle= IMB_exr_get_handle(); + int success; BLI_make_existing_file(filename); @@ -864,11 +868,20 @@ void RE_WriteRenderResult(RenderResult *rr, const char *filename, int compress) } } } - - IMB_exr_begin_write(exrhandle, filename, rr->rectx, rr->recty, compress); - - IMB_exr_write_channels(exrhandle); + + /* when the filename has no permissions, this can fail */ + if(IMB_exr_begin_write(exrhandle, filename, rr->rectx, rr->recty, compress)) { + IMB_exr_write_channels(exrhandle); + success= TRUE; + } + else { + /* TODO, get the error from openexr's exception */ + BKE_report(reports, RPT_ERROR, "Error Writing Render Result, see console"); + success= FALSE; + } IMB_exr_close(exrhandle); + + return success; } /* callbacks for RE_MultilayerConvert */ @@ -992,9 +1005,10 @@ static int read_render_result_from_file(const char *filename, RenderResult *rr) } /* only for temp buffer files, makes exact copy of render result */ -static void read_render_result(Render *re, int sample) +static int read_render_result(Render *re, int sample) { char str[FILE_MAX]; + int success; BLI_rw_mutex_lock(&re->resultmutex, THREAD_LOCK_WRITE); @@ -1004,10 +1018,18 @@ static void read_render_result(Render *re, int sample) render_unique_exr_name(re, str, sample); printf("read exr tmp file: %s\n", str); - if(!read_render_result_from_file(str, re->result)) + if(read_render_result_from_file(str, re->result)) { + success= TRUE; + } + else { printf("cannot read: %s\n", str); + success= FALSE; + + } BLI_rw_mutex_unlock(&re->resultmutex); + + return success; } /* *************************************************** */ @@ -2981,7 +3003,7 @@ static int do_write_image_or_movie(Render *re, Scene *scene, bMovieHandle *mh, c if(re->r.imtype==R_MULTILAYER) { if(re->result) { - RE_WriteRenderResult(re->result, name, scene->r.quality); + RE_WriteRenderResult(re->reports, re->result, name, scene->r.quality); printf("Saved: %s", name); } } @@ -3198,7 +3220,7 @@ void RE_PreviewRender(Render *re, Main *bmain, Scene *sce) /* note; repeated win/disprect calc... solve that nicer, also in compo */ /* only the temp file! */ -void RE_ReadRenderResult(Scene *scene, Scene *scenode) +int RE_ReadRenderResult(Scene *scene, Scene *scenode) { Render *re; int winx, winy; @@ -3232,7 +3254,7 @@ void RE_ReadRenderResult(Scene *scene, Scene *scenode) RE_InitState(re, NULL, &scene->r, NULL, winx, winy, &disprect); re->scene= scene; - read_render_result(re, 0); + return read_render_result(re, 0); } void RE_set_max_threads(int threads) diff --git a/source/gameengine/Converter/BL_BlenderDataConversion.cpp b/source/gameengine/Converter/BL_BlenderDataConversion.cpp index 38d4e79ca91..b8e53c87fa9 100644 --- a/source/gameengine/Converter/BL_BlenderDataConversion.cpp +++ b/source/gameengine/Converter/BL_BlenderDataConversion.cpp @@ -1483,7 +1483,7 @@ void BL_CreatePhysicsObjectNew(KX_GameObject* gameobj, { objprop.m_gamesoftFlag = OB_BSB_BENDING_CONSTRAINTS | OB_BSB_SHAPE_MATCHING | OB_BSB_AERO_VPOINT; - objprop.m_soft_linStiff = 0.5;; + objprop.m_soft_linStiff = 0.5; objprop.m_soft_angStiff = 1.f; /* angular stiffness 0..1 */ objprop.m_soft_volume= 1.f; /* volume preservation 0..1 */ diff --git a/source/gameengine/Converter/KX_ConvertActuators.cpp b/source/gameengine/Converter/KX_ConvertActuators.cpp index 7b9cba7770b..9621d05b5cc 100644 --- a/source/gameengine/Converter/KX_ConvertActuators.cpp +++ b/source/gameengine/Converter/KX_ConvertActuators.cpp @@ -46,6 +46,7 @@ #ifdef WITH_AUDASPACE # include "AUD_C-API.h" +# include "AUD_ChannelMapperFactory.h" #endif // Actuators @@ -406,7 +407,23 @@ void BL_ConvertActuators(char* maggiename, "\" has no sound datablock." << std::endl; } else + { snd_sound = *reinterpret_cast<AUD_Reference<AUD_IFactory>*>(sound->playback_handle); + + // if sound shall be 3D but isn't mono, we have to make it mono! + if(is3d) + { + AUD_Reference<AUD_IReader> reader = snd_sound->createReader(); + if(reader->getSpecs().channels != AUD_CHANNELS_MONO) + { + AUD_DeviceSpecs specs; + specs.channels = AUD_CHANNELS_MONO; + specs.rate = AUD_RATE_INVALID; + specs.format = AUD_FORMAT_INVALID; + snd_sound = new AUD_ChannelMapperFactory(snd_sound, specs); + } + } + } KX_SoundActuator* tmpsoundact = new KX_SoundActuator(gameobj, snd_sound, diff --git a/source/gameengine/GameLogic/SCA_ISensor.h b/source/gameengine/GameLogic/SCA_ISensor.h index 741448b1096..f90f1e19a67 100644 --- a/source/gameengine/GameLogic/SCA_ISensor.h +++ b/source/gameengine/GameLogic/SCA_ISensor.h @@ -105,7 +105,7 @@ public: }; SCA_ISensor(SCA_IObject* gameobj, - class SCA_EventManager* eventmgr);; + class SCA_EventManager* eventmgr); ~SCA_ISensor(); virtual void ReParent(SCA_IObject* parent); diff --git a/source/gameengine/Ketsji/KX_GameObject.cpp b/source/gameengine/Ketsji/KX_GameObject.cpp index d51e2aa5386..7ced0c0c4d7 100644 --- a/source/gameengine/Ketsji/KX_GameObject.cpp +++ b/source/gameengine/Ketsji/KX_GameObject.cpp @@ -3124,7 +3124,7 @@ KX_PYMETHODDEF_DOC(KX_GameObject, getActionFrame, layer_check(layer, "getActionFrame"); - return PyLong_FromLong(GetActionFrame(layer)); + return PyFloat_FromDouble(GetActionFrame(layer)); } KX_PYMETHODDEF_DOC(KX_GameObject, setActionFrame, diff --git a/source/gameengine/Ketsji/KX_PythonInit.cpp b/source/gameengine/Ketsji/KX_PythonInit.cpp index 06db84feb23..8557ebab0a9 100644 --- a/source/gameengine/Ketsji/KX_PythonInit.cpp +++ b/source/gameengine/Ketsji/KX_PythonInit.cpp @@ -1208,6 +1208,28 @@ static PyObject* gPyGetMaterialType(PyObject*) return PyLong_FromSsize_t(flag); } +static PyObject* gPySetAnisotropicFiltering(PyObject*, PyObject* args) +{ + short level; + + if (!PyArg_ParseTuple(args, "h:setAnisotropicFiltering", &level)) + return NULL; + + if (level != 1 && level != 2 && level != 4 && level != 8 && level != 16) { + PyErr_SetString(PyExc_ValueError, "Rasterizer.setAnisotropicFiltering(level): Expected value of 1, 2, 4, 8, or 16 for value"); + return NULL; + } + + gp_Rasterizer->SetAnisotropicFiltering(level); + + Py_RETURN_NONE; +} + +static PyObject* gPyGetAnisotropicFiltering(PyObject*, PyObject* args) +{ + return PyLong_FromLong(gp_Rasterizer->GetAnisotropicFiltering()); +} + static PyObject* gPyDrawLine(PyObject*, PyObject* args) { PyObject* ob_from; @@ -1272,6 +1294,10 @@ static struct PyMethodDef rasterizer_methods[] = { METH_VARARGS, "set the state of a GLSL material setting"}, {"getGLSLMaterialSetting",(PyCFunction) gPyGetGLSLMaterialSetting, METH_VARARGS, "get the state of a GLSL material setting"}, + {"setAnisotropicFiltering", (PyCFunction) gPySetAnisotropicFiltering, + METH_VARARGS, "set the anisotropic filtering level (must be one of 1, 2, 4, 8, 16)"}, + {"getAnisotropicFiltering", (PyCFunction) gPyGetAnisotropicFiltering, + METH_VARARGS, "get the anisotropic filtering level"}, {"drawLine", (PyCFunction) gPyDrawLine, METH_VARARGS, "draw a line on the screen"}, { NULL, (PyCFunction) NULL, 0, NULL } diff --git a/source/gameengine/Rasterizer/RAS_IRasterizer.h b/source/gameengine/Rasterizer/RAS_IRasterizer.h index 305e2bca756..c46ebf742a0 100644 --- a/source/gameengine/Rasterizer/RAS_IRasterizer.h +++ b/source/gameengine/Rasterizer/RAS_IRasterizer.h @@ -417,6 +417,9 @@ public: virtual void SetBlendingMode(int blendmode)=0; virtual void SetFrontFace(bool ccw)=0; + + virtual void SetAnisotropicFiltering(short level)=0; + virtual short GetAnisotropicFiltering()=0; #ifdef WITH_CXX_GUARDEDALLOC diff --git a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.cpp b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.cpp index 55f36dcd772..98459bf53af 100644 --- a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.cpp +++ b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.cpp @@ -99,12 +99,16 @@ RAS_OpenGLRasterizer::RAS_OpenGLRasterizer(RAS_ICanvas* canvas) hinterlace_mask[i] = (i&1)*0xFFFFFFFF; } hinterlace_mask[32] = 0; + + m_prevafvalue = GPU_get_anisotropic(); } RAS_OpenGLRasterizer::~RAS_OpenGLRasterizer() { + // Restore the previous AF value + GPU_set_anisotropic(m_prevafvalue); } bool RAS_OpenGLRasterizer::Init() @@ -1204,3 +1208,12 @@ void RAS_OpenGLRasterizer::SetFrontFace(bool ccw) m_last_frontface = ccw; } +void RAS_OpenGLRasterizer::SetAnisotropicFiltering(short level) +{ + GPU_set_anisotropic((float)level); +} + +short RAS_OpenGLRasterizer::GetAnisotropicFiltering() +{ + return (short)GPU_get_anisotropic(); +} diff --git a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.h b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.h index 54fab906049..61568df91eb 100644 --- a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.h +++ b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.h @@ -94,6 +94,8 @@ class RAS_OpenGLRasterizer : public RAS_IRasterizer bool m_setfocallength; int m_noOfScanlines; + short m_prevafvalue; + //motion blur int m_motionblur; float m_motionblurvalue; @@ -294,6 +296,9 @@ public: virtual void SetBlendingMode(int blendmode); virtual void SetFrontFace(bool ccw); + virtual void SetAnisotropicFiltering(short level); + virtual short GetAnisotropicFiltering(); + #ifdef WITH_CXX_GUARDEDALLOC public: diff --git a/source/gameengine/VideoTexture/FilterColor.h b/source/gameengine/VideoTexture/FilterColor.h index 2478727a6be..d0536ed2801 100644 --- a/source/gameengine/VideoTexture/FilterColor.h +++ b/source/gameengine/VideoTexture/FilterColor.h @@ -141,7 +141,7 @@ protected: /// calculate one color component unsigned int calcColor (unsigned int val, short idx) { - unsigned int col = VT_C(val,idx);; + unsigned int col = VT_C(val,idx); if (col <= levels[idx][0]) col = 0; else if (col >= levels[idx][1]) col = 0xFF; else col = (((col - levels[idx][0]) << 8) / levels[idx][2]) & 0xFF; diff --git a/source/gameengine/VideoTexture/ImageMix.cpp b/source/gameengine/VideoTexture/ImageMix.cpp index 7a8226aab03..aeef5d1694f 100644 --- a/source/gameengine/VideoTexture/ImageMix.cpp +++ b/source/gameengine/VideoTexture/ImageMix.cpp @@ -135,7 +135,7 @@ PyObject * setWeight (PyImage * self, PyObject * args) if (!getImageMix(self)->setWeight(id, weight)) { // if not set, report error - PyErr_SetString(PyExc_RuntimeError, "Invalid id of source");; + PyErr_SetString(PyExc_RuntimeError, "Invalid id of source"); return NULL; } // return none |