diff options
author | Jason Wilkins <Jason.A.Wilkins@gmail.com> | 2011-05-29 20:17:43 +0400 |
---|---|---|
committer | Jason Wilkins <Jason.A.Wilkins@gmail.com> | 2011-05-29 20:17:43 +0400 |
commit | cdb4eaf2a390469c2dc74ccbffeb620f94c1cb2a (patch) | |
tree | e11a097318a648e82e518e742c63cea11c42715b | |
parent | 820f3b2e507a5efb18091bd12bea4c2008be2ed9 (diff) | |
parent | 11014aa34b26337023f53e75ebdc3432e7e116c2 (diff) |
Merged with trunk: 36951-37000
Never say good-bye, you'll be back :)
70 files changed, 572 insertions, 276 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index b6fd94528f7..7d4484351a6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -88,7 +88,7 @@ option(WITH_INTERNATIONAL "Enable I18N (International fonts and text)" ON) option(WITH_PYTHON "Enable Embedded Python API (only disable for development)" ON) option(WITH_PYTHON_SECURITY "Disables execution of scripts within blend files by default (recommend to leave off)" OFF) mark_as_advanced(WITH_PYTHON) # dont want people disabling this unless they really know what they are doing. -mark_as_advanced(WITH_PYTHON_SECURITY) # some distrobutions see this as a security issue, rather then have them patch it, make a build option. +mark_as_advanced(WITH_PYTHON_SECURITY) # some distrobutions see this as a security issue, rather than have them patch it, make a build option. option(WITH_PYTHON_SAFETY "Enable internal API error checking to track invalid data to prevent crash on access (at the expense of some effeciency, only enable for development)." OFF) option(WITH_PYTHON_MODULE "Enable building as a python module (experemental, only enable for development)" OFF) diff --git a/build_files/cmake/macros.cmake b/build_files/cmake/macros.cmake index 45dc67f9ce6..6e4aaa51a49 100644 --- a/build_files/cmake/macros.cmake +++ b/build_files/cmake/macros.cmake @@ -13,19 +13,13 @@ macro(blender_include_dirs include_directories(${all_incs}) endmacro() -# only MSVC uses SOURCE_GROUP -macro(blender_add_lib_nolist - name - sources - includes) - - # message(STATUS "Configuring library ${name}") - blender_include_dirs("${includes}") - add_library(${name} ${sources}) +macro(blender_source_group + sources) # Group by location on disk source_group("Source Files" FILES CMakeLists.txt) + foreach(SRC ${sources}) get_filename_component(SRC_EXT ${SRC} EXT) if(${SRC_EXT} MATCHES ".h" OR ${SRC_EXT} MATCHES ".hpp") @@ -36,16 +30,26 @@ macro(blender_add_lib_nolist endforeach() endmacro() -# # works fine but having the includes listed is helpful for IDE's (QtCreator/MSVC) -# macro(blender_add_lib_nolist -# name -# sources -# includes) -# -# message(STATUS "Configuring library ${name}") -# include_directories(${includes}) -# add_library(${name} ${sources}) -# endmacro() + +# only MSVC uses SOURCE_GROUP +macro(blender_add_lib_nolist + name + sources + includes) + + # message(STATUS "Configuring library ${name}") + + # include_directories(${includes}) + blender_include_dirs("${includes}") + + add_library(${name} ${sources}) + + # works fine without having the includes + # listed is helpful for IDE's (QtCreator/MSVC) + blender_source_group("${sources}") + +endmacro() + macro(blender_add_lib name @@ -55,9 +59,9 @@ macro(blender_add_lib blender_add_lib_nolist(${name} "${sources}" "${includes}") set_property(GLOBAL APPEND PROPERTY BLENDER_LINK_LIBS ${name}) - endmacro() + macro(SETUP_LIBDIRS) # see "cmake --help-policy CMP0003" if(COMMAND cmake_policy) diff --git a/doc/python_api/sphinx_doc_gen.py b/doc/python_api/sphinx_doc_gen.py index 03c8fe1b4ff..e96b4d363b4 100644 --- a/doc/python_api/sphinx_doc_gen.py +++ b/doc/python_api/sphinx_doc_gen.py @@ -34,7 +34,8 @@ For HTML generation - Generate html docs by running... - sphinx-build doc/python_api/sphinx-in doc/python_api/sphinx-out + cd doc/python_api + sphinx-build sphinx-in sphinx-out assuming that you have sphinx 1.0.7 installed @@ -64,8 +65,9 @@ else: "bpy.props", "bpy.utils", "bpy.context", - # "bpy.types", # supports filtering + "bpy.types", # supports filtering "bpy.ops", # supports filtering + #"bpy_extras", "bge", "aud", "bgl", @@ -204,10 +206,24 @@ def write_indented_lines(ident, fn, text, strip=True): ''' if text is None: return - for l in text.split("\n"): - if strip: - fn(ident + l.strip() + "\n") - else: + + lines = text.split("\n") + + # strip empty lines from the start/end + while lines and not lines[0].strip(): + del lines[0] + while lines and not lines[-1].strip(): + del lines[-1] + + if strip: + ident_strip = 1000 + for l in lines: + if l.strip(): + ident_strip = min(ident_strip, len(l) - len(l.lstrip())) + for l in lines: + fn(ident + l[ident_strip:] + "\n") + else: + for l in lines: fn(ident + l + "\n") @@ -252,7 +268,7 @@ def pyfunc2sphinx(ident, fw, identifier, py_func, is_class=True): fw(ident + ".. %s:: %s%s\n\n" % (func_type, identifier, arg_str)) if py_func.__doc__: - write_indented_lines(ident + " ", fw, py_func.__doc__.strip()) + write_indented_lines(ident + " ", fw, py_func.__doc__) fw("\n") @@ -267,8 +283,10 @@ def py_descr2sphinx(ident, fw, descr, module_name, type_name, identifier): if type(descr) == GetSetDescriptorType: fw(ident + ".. attribute:: %s\n\n" % identifier) write_indented_lines(ident + " ", fw, doc, False) + fw("\n") elif type(descr) in (MethodDescriptorType, ClassMethodDescriptorType): write_indented_lines(ident, fw, doc, False) + fw("\n") else: raise TypeError("type was not GetSetDescriptorType, MethodDescriptorType or ClassMethodDescriptorType") @@ -316,11 +334,17 @@ def pymodule2sphinx(BASEPATH, module_name, module, title): attribute_set = set() filepath = os.path.join(BASEPATH, module_name + ".rst") + module_all = getattr(module, "__all__", None) + module_dir = sorted(dir(module)) + + if module_all: + module_dir = module_all + file = open(filepath, "w") fw = file.write - write_title(fw, title, "=") + write_title(fw, "%s (%s)" % (title, module_name), "=") fw(".. module:: %s\n\n" % module_name) @@ -331,6 +355,35 @@ def pymodule2sphinx(BASEPATH, module_name, module, title): write_example_ref("", fw, module_name) + # write submodules + # we could also scan files but this ensures __all__ is used correctly + if module_all is not None: + submod_name = None + submod = None + submod_ls = [] + for submod_name in module_all: + ns = {} + exec_str = "from %s import %s as submod" % (module.__name__, submod_name) + exec(exec_str, ns, ns) + submod = ns["submod"] + if type(submod) == types.ModuleType: + submod_ls.append((submod_name, submod)) + + del submod_name + del submod + + if submod_ls: + fw(".. toctree::\n") + fw(" :maxdepth: 1\n\n") + + for submod_name, submod in submod_ls: + submod_name_full = "%s.%s" % (module_name, submod_name) + fw(" %s.rst\n\n" % submod_name_full) + + pymodule2sphinx(BASEPATH, submod_name_full, submod, "%s submodule" % module_name) + del submod_ls + # done writing submodules! + # write members of the module # only tested with PyStructs which are not exactly modules for key, descr in sorted(type(module).__dict__.items()): @@ -348,15 +401,15 @@ def pymodule2sphinx(BASEPATH, module_name, module, title): if descr.__doc__: fw(".. data:: %s\n\n" % key) write_indented_lines(" ", fw, descr.__doc__, False) - attribute_set.add(key) fw("\n") + attribute_set.add(key) + del key, descr classes = [] - for attribute in sorted(dir(module)): + for attribute in module_dir: if not attribute.startswith("_"): - if attribute in attribute_set: continue @@ -972,6 +1025,8 @@ def rna2sphinx(BASEPATH): fw(" blf.rst\n\n") if "aud" not in EXCLUDE_MODULES: fw(" aud.rst\n\n") + if "bpy_extras" not in EXCLUDE_MODULES: + fw(" bpy_extras.rst\n\n") # game engine if "bge" not in EXCLUDE_MODULES: @@ -1068,41 +1123,45 @@ def rna2sphinx(BASEPATH): # python modules if "bpy.utils" not in EXCLUDE_MODULES: from bpy import utils as module - pymodule2sphinx(BASEPATH, "bpy.utils", module, "Utilities (bpy.utils)") + pymodule2sphinx(BASEPATH, "bpy.utils", module, "Utilities") if "bpy.path" not in EXCLUDE_MODULES: from bpy import path as module - pymodule2sphinx(BASEPATH, "bpy.path", module, "Path Utilities (bpy.path)") + pymodule2sphinx(BASEPATH, "bpy.path", module, "Path Utilities") + + if "bpy_extras" not in EXCLUDE_MODULES: + import bpy_extras as module + pymodule2sphinx(BASEPATH, "bpy_extras", module, "Extra Utilities") # C modules if "bpy.app" not in EXCLUDE_MODULES: from bpy import app as module - pymodule2sphinx(BASEPATH, "bpy.app", module, "Application Data (bpy.app)") + pymodule2sphinx(BASEPATH, "bpy.app", module, "Application Data") if "bpy.props" not in EXCLUDE_MODULES: from bpy import props as module - pymodule2sphinx(BASEPATH, "bpy.props", module, "Property Definitions (bpy.props)") + pymodule2sphinx(BASEPATH, "bpy.props", module, "Property Definitions") if "mathutils" not in EXCLUDE_MODULES: import mathutils as module - pymodule2sphinx(BASEPATH, "mathutils", module, "Math Types & Utilities (mathutils)") + pymodule2sphinx(BASEPATH, "mathutils", module, "Math Types & Utilities") if "mathutils.geometry" not in EXCLUDE_MODULES: import mathutils.geometry as module - pymodule2sphinx(BASEPATH, "mathutils.geometry", module, "Geometry Utilities (mathutils.geometry)") + pymodule2sphinx(BASEPATH, "mathutils.geometry", module, "Geometry Utilities") if "mathutils.geometry" not in EXCLUDE_MODULES: import blf as module - pymodule2sphinx(BASEPATH, "blf", module, "Font Drawing (blf)") + pymodule2sphinx(BASEPATH, "blf", module, "Font Drawing") # XXX TODO #import bgl as module - #pymodule2sphinx(BASEPATH, "bgl", module, "Blender OpenGl wrapper (bgl)") + #pymodule2sphinx(BASEPATH, "bgl", module, "Blender OpenGl wrapper") #del module if "aud" not in EXCLUDE_MODULES: import aud as module - pymodule2sphinx(BASEPATH, "aud", module, "Audio System (aud)") + pymodule2sphinx(BASEPATH, "aud", module, "Audio System") del module ## game engine diff --git a/extern/bullet2/src/BulletCollision/BroadphaseCollision/btAxisSweep3.h b/extern/bullet2/src/BulletCollision/BroadphaseCollision/btAxisSweep3.h index 07167af3baf..70cf3e4ace8 100644 --- a/extern/bullet2/src/BulletCollision/BroadphaseCollision/btAxisSweep3.h +++ b/extern/bullet2/src/BulletCollision/BroadphaseCollision/btAxisSweep3.h @@ -1026,7 +1026,7 @@ void btAxisSweep3Internal<BP_FP_INT_TYPE>::sortMaxUp(int axis, BP_FP_INT_TYPE ed /// The btAxisSweep3 is an efficient implementation of the 3d axis sweep and prune broadphase. -/// It uses arrays rather then lists for storage of the 3 axis. Also it operates using 16 bit integer coordinates instead of floats. +/// It uses arrays rather than lists for storage of the 3 axis. Also it operates using 16 bit integer coordinates instead of floats. /// For large worlds and many objects, use bt32BitAxisSweep3 or btDbvtBroadphase instead. bt32BitAxisSweep3 has higher precision and allows more then 16384 objects at the cost of more memory and bit of performance. class btAxisSweep3 : public btAxisSweep3Internal<unsigned short int> { @@ -1038,7 +1038,7 @@ public: /// The bt32BitAxisSweep3 allows higher precision quantization and more objects compared to the btAxisSweep3 sweep and prune. /// This comes at the cost of more memory per handle, and a bit slower performance. -/// It uses arrays rather then lists for storage of the 3 axis. +/// It uses arrays rather than lists for storage of the 3 axis. class bt32BitAxisSweep3 : public btAxisSweep3Internal<unsigned int> { public: diff --git a/extern/bullet2/src/BulletCollision/CollisionDispatch/btConvexConvexAlgorithm.cpp b/extern/bullet2/src/BulletCollision/CollisionDispatch/btConvexConvexAlgorithm.cpp index ede1afb2a03..94385fed909 100644 --- a/extern/bullet2/src/BulletCollision/CollisionDispatch/btConvexConvexAlgorithm.cpp +++ b/extern/bullet2/src/BulletCollision/CollisionDispatch/btConvexConvexAlgorithm.cpp @@ -487,7 +487,7 @@ btScalar btConvexConvexAlgorithm::calculateTimeOfImpact(btCollisionObject* col0, { (void)resultOut; (void)dispatchInfo; - ///Rather then checking ALL pairs, only calculate TOI when motion exceeds threshold + ///rather than checking ALL pairs, only calculate TOI when motion exceeds threshold ///Linear motion for one of objects needs to exceed m_ccdSquareMotionThreshold ///col0->m_worldTransform, diff --git a/intern/audaspace/CMakeLists.txt b/intern/audaspace/CMakeLists.txt index 74f483eab05..a2468d0071e 100644 --- a/intern/audaspace/CMakeLists.txt +++ b/intern/audaspace/CMakeLists.txt @@ -26,6 +26,7 @@ set(INC FX SRC ${PTHREADS_INC} ${LIBSAMPLERATE_INC} + ../ffmpeg ) set(SRC diff --git a/intern/audaspace/SConscript b/intern/audaspace/SConscript index ecc94987185..67f859b0e5f 100644 --- a/intern/audaspace/SConscript +++ b/intern/audaspace/SConscript @@ -8,7 +8,7 @@ defs = [] if env['WITH_BF_FFMPEG']: sources += env.Glob('ffmpeg/*.cpp') - incs += ' ffmpeg ' + env['BF_FFMPEG_INC'] + incs += ' ffmpeg #/intern/ffmpeg ' + env['BF_FFMPEG_INC'] defs.append('WITH_FFMPEG') if env['WITH_BF_SDL']: diff --git a/intern/audaspace/ffmpeg/AUD_FFMPEGReader.cpp b/intern/audaspace/ffmpeg/AUD_FFMPEGReader.cpp index e748235e40e..4597432e7d1 100644 --- a/intern/audaspace/ffmpeg/AUD_FFMPEGReader.cpp +++ b/intern/audaspace/ffmpeg/AUD_FFMPEGReader.cpp @@ -39,6 +39,7 @@ extern "C" { #include <libavcodec/avcodec.h> #include <libavformat/avformat.h> +#include "ffmpeg_compat.h" } int AUD_FFMPEGReader::decode(AVPacket* packet, AUD_Buffer& buffer) diff --git a/intern/ffmpeg/ffmpeg_compat.h b/intern/ffmpeg/ffmpeg_compat.h new file mode 100644 index 00000000000..ab819f41ac3 --- /dev/null +++ b/intern/ffmpeg/ffmpeg_compat.h @@ -0,0 +1,133 @@ +#ifndef __ffmpeg_compat_h_included__ +#define __ffmpeg_compat_h_included__ 1 + +/* + * $Id$ + * + * compatibility macros to make every ffmpeg installation appear + * like the most current installation (wrapping some functionality sometimes) + * it also includes all ffmpeg header files at once, no need to do it + * seperately. + * + * Copyright (c) 2011 Peter Schlaile + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + */ + + +#include <libavformat/avformat.h> +#include <libavcodec/avcodec.h> +#include <libavutil/rational.h> + +#if (LIBAVFORMAT_VERSION_MAJOR > 52) || ((LIBAVFORMAT_VERSION_MAJOR >= 52) && (LIBAVFORMAT_VERSION_MINOR >= 101)) +#define FFMPEG_HAVE_PARSE_UTILS 1 +#include <libavutil/parseutils.h> +#endif + +#include <libswscale/swscale.h> +#include <libavcodec/opt.h> + +#if (LIBAVFORMAT_VERSION_MAJOR > 52) || ((LIBAVFORMAT_VERSION_MAJOR >= 52) && (LIBAVFORMAT_VERSION_MINOR >= 105)) +#define FFMPEG_HAVE_AVIO 1 +#endif + +#if (LIBAVCODEC_VERSION_MAJOR > 53) || ((LIBAVCODEC_VERSION_MAJOR == 53) && (LIBAVCODEC_VERSION_MINOR > 1)) || ((LIBAVCODEC_VERSION_MAJOR == 53) && (LIBAVCODEC_VERSION_MINOR == 1) && (LIBAVCODEC_VERSION_MICRO >= 1)) +#define FFMPEG_HAVE_DEFAULT_VAL_UNION 1 +#endif + +#if (LIBAVFORMAT_VERSION_MAJOR > 52) || ((LIBAVFORMAT_VERSION_MAJOR >= 52) && (LIBAVFORMAT_VERSION_MINOR >= 101)) +#define FFMPEG_HAVE_AV_DUMP_FORMAT 1 +#endif + +#if (LIBAVFORMAT_VERSION_MAJOR > 52) || ((LIBAVFORMAT_VERSION_MAJOR >= 52) && (LIBAVFORMAT_VERSION_MINOR >= 45)) +#define FFMPEG_HAVE_AV_GUESS_FORMAT 1 +#endif + +#if (LIBAVCODEC_VERSION_MAJOR > 52) || ((LIBAVCODEC_VERSION_MAJOR >= 52) && (LIBAVCODEC_VERSION_MINOR >= 23)) +#define FFMPEG_HAVE_DECODE_AUDIO3 1 +#define FFMPEG_HAVE_DECODE_VIDEO2 1 +#endif + +#if (LIBAVCODEC_VERSION_MAJOR > 52) || ((LIBAVCODEC_VERSION_MAJOR >= 52) && (LIBAVCODEC_VERSION_MINOR >= 64)) +#define FFMPEG_HAVE_AVMEDIA_TYPES 1 +#endif + +#if ((LIBAVCODEC_VERSION_MAJOR > 52) || (LIBAVCODEC_VERSION_MAJOR >= 52) && (LIBAVCODEC_VERSION_MINOR >= 29)) && \ + ((LIBSWSCALE_VERSION_MAJOR > 0) || (LIBSWSCALE_VERSION_MAJOR >= 0) && (LIBSWSCALE_VERSION_MINOR >= 10)) +#define FFMPEG_SWSCALE_COLOR_SPACE_SUPPORT +#endif + +#ifndef FFMPEG_HAVE_AVIO +#define AVIO_FLAG_WRITE URL_WRONLY +#define avio_open url_fopen +#define avio_tell url_ftell +#define avio_close url_fclose +#endif + +/* there are some version inbetween, which have avio_... functions but no + AVIO_FLAG_... */ +#ifndef AVIO_FLAG_WRITE +#define AVIO_FLAG_WRITE URL_WRONLY +#endif + +#ifndef AV_PKT_FLAG_KEY +#define AV_PKT_FLAG_KEY PKT_FLAG_KEY +#endif + +#ifndef FFMPEG_HAVE_AV_DUMP_FORMAT +#define av_dump_format dump_format +#endif + +#ifndef FFMPEG_HAVE_AV_GUESS_FORMAT +#define av_guess_format guess_format +#endif + +#ifndef FFMPEG_HAVE_PARSE_UTILS +#define av_parse_video_rate av_parse_video_frame_rate +#endif + +#ifdef FFMPEG_HAVE_DEFAULT_VAL_UNION +#define FFMPEG_DEF_OPT_VAL_INT(OPT) OPT->default_val.i64 +#define FFMPEG_DEF_OPT_VAL_DOUBLE(OPT) OPT->default_val.dbl +#else +#define FFMPEG_DEF_OPT_VAL_INT(OPT) OPT->default_val +#define FFMPEG_DEF_OPT_VAL_DOUBLE(OPT) OPT->default_val +#endif + +#ifndef FFMPEG_HAVE_AVMEDIA_TYPES +#define AVMEDIA_TYPE_VIDEO CODEC_TYPE_VIDEO +#define AVMEDIA_TYPE_AUDIO CODEC_TYPE_AUDIO +#endif + +#ifndef FFMPEG_HAVE_DECODE_AUDIO3 +static inline +int avcodec_decode_audio3(AVCodecContext *avctx, int16_t *samples, + int *frame_size_ptr, AVPacket *avpkt) +{ + return avcodec_decode_audio2(avctx, samples, + frame_size_ptr, avpkt->data, + avpkt->size); +} +#endif + +#ifndef FFMPEG_HAVE_DECODE_VIDEO2 +static inline +int avcodec_decode_video2(AVCodecContext *avctx, AVFrame *picture, + int *got_picture_ptr, + AVPacket *avpkt) +{ + return avcodec_decode_video(avctx, picture, got_picture_ptr, + avpkt->data, avpkt->size); +} +#endif + +#endif diff --git a/intern/ghost/intern/GHOST_SystemX11.cpp b/intern/ghost/intern/GHOST_SystemX11.cpp index b44f2b18225..c53bf7de36c 100644 --- a/intern/ghost/intern/GHOST_SystemX11.cpp +++ b/intern/ghost/intern/GHOST_SystemX11.cpp @@ -795,6 +795,7 @@ GHOST_SystemX11::processEvent(XEvent *xe) } default: { +#ifdef WITH_X11_XINPUT if(xe->type == window->GetXTablet().MotionEvent) { XDeviceMotionEvent* data = (XDeviceMotionEvent*)xe; @@ -818,7 +819,7 @@ GHOST_SystemX11::processEvent(XEvent *xe) } else if(xe->type == window->GetXTablet().ProxOutEvent) window->GetXTablet().CommonData.Active= GHOST_kTabletModeNone; - +#endif // WITH_X11_XINPUT break; } } diff --git a/intern/ghost/intern/GHOST_WindowX11.cpp b/intern/ghost/intern/GHOST_WindowX11.cpp index 5dd1042eb6e..8c62b34ffe2 100644 --- a/intern/ghost/intern/GHOST_WindowX11.cpp +++ b/intern/ghost/intern/GHOST_WindowX11.cpp @@ -183,8 +183,11 @@ GHOST_WindowX11( int natom; int glxVersionMajor, glxVersionMinor; // As in GLX major.minor +#ifdef WITH_X11_XINPUT /* initialize incase X11 fails to load */ memset(&m_xtablet, 0, sizeof(m_xtablet)); +#endif + m_visual= NULL; if (!glXQueryVersion(m_display, &glxVersionMajor, &glxVersionMinor)) { diff --git a/intern/ghost/intern/GHOST_WindowX11.h b/intern/ghost/intern/GHOST_WindowX11.h index 96d8ad77d10..2cb269ea919 100644 --- a/intern/ghost/intern/GHOST_WindowX11.h +++ b/intern/ghost/intern/GHOST_WindowX11.h @@ -38,7 +38,9 @@ #include <X11/Xlib.h> #include <GL/glx.h> // For tablets -#include <X11/extensions/XInput.h> +#ifdef WITH_X11_XINPUT +# include <X11/extensions/XInput.h> +#endif #include <map> @@ -190,7 +192,7 @@ public: Window getXWindow( ); - +#ifdef WITH_X11_XINPUT class XTablet { public: @@ -214,6 +216,10 @@ public: const GHOST_TabletData* GetTabletData() { return &m_xtablet.CommonData; } +#else // WITH_X11_XINPUT + const GHOST_TabletData* GetTabletData() + { return NULL; } +#endif // WITH_X11_XINPUT /* * Need this in case that we want start the window @@ -321,7 +327,9 @@ private : getEmptyCursor( ); +#ifdef WITH_X11_XINPUT void initXInputDevices(); +#endif GLXContext m_context; Window m_window; @@ -350,8 +358,10 @@ private : /** Cache of XC_* ID's to XCursor structures */ std::map<unsigned int, Cursor> m_standard_cursors; +#ifdef WITH_X11_XINPUT /* Tablet devices */ XTablet m_xtablet; +#endif void icccmSetState(int state); int icccmGetState() const; diff --git a/release/scripts/modules/bpy_extras/image_utils.py b/release/scripts/modules/bpy_extras/image_utils.py index 39e49ee1f96..a7d0226fa23 100644 --- a/release/scripts/modules/bpy_extras/image_utils.py +++ b/release/scripts/modules/bpy_extras/image_utils.py @@ -18,10 +18,89 @@ # <pep8 compliant> +__all__ = ( + "load_image", +) -def image_load(filepath, dirpath, place_holder=False, recursive=False, convert_callback=None): - import bpy - try: - return bpy.data.images.load(filepath) - except RuntimeError: - return bpy.data.images.new("Untitled", 128, 128) +# limited replacement for BPyImage.comprehensiveImageLoad +def load_image(imagepath, + dirname="", + place_holder=False, + recursive=False, + ncase_cmp=True, + convert_callback=None, + verbose=False, + ): + """ + Return an image from the file path with options to search multiple paths and + return a placeholder if its not found. + + :arg filepath: The image filename + If a path precedes it, this will be searched as well. + :type filepath: string + :arg dirname: is the directory where the image may be located - any file at + the end will be ignored. + :type dirname: string + :arg place_holder: if True a new place holder image will be created. + this is usefull so later you can relink the image to its original data. + :type place_holder: bool + :arg recursive: If True, directories will be recursivly searched. + Be carefull with this if you have files in your root directory because + it may take a long time. + :type recursive: bool + :arg ncase_cmp: on non windows systems, find the correct case for the file. + :type ncase_cmp: bool + :arg convert_callback: a function that takes an existing path and returns a new one. + Use this when loading image formats blender may not support, the CONVERT_CALLBACK + can take the path for a GIF (for example), convert it to a PNG and return the PNG's path. + For formats blender can read, simply return the path that is given. + :type convert_callback: function + :return: an image or None + :rtype: :class:`Image` + """ + import os + + # TODO: recursive + + def _image_load(path): + import bpy + + if convert_callback: + path = convert_callback(path) + + image = bpy.data.images.load(path) + + if verbose: + print(" image loaded '%s'" % path) + + return image + + if verbose: + print("load_image('%s', '%s', ...)" % (imagepath, dirname)) + + if os.path.exists(imagepath): + return _image_load(imagepath) + + variants = [imagepath] + + if dirname: + variants += [os.path.join(dirname, imagepath), os.path.join(dirname, os.path.basename(imagepath))] + + for filepath_test in variants: + if ncase_cmp: + ncase_variants = filepath_test, bpy.path.resolve_ncase(filepath) + else: + ncase_variants = (filepath_test, ) + + for nfilepath in ncase_variants: + if os.path.exists(nfilepath): + return _image_load(nfilepath) + + if place_holder: + image = bpy.data.images.new(os.path.basename(filepath), 128, 128) + # allow the path to be resolved later + image.filepath = imagepath + return image + + # TODO comprehensiveImageLoad also searched in bpy.config.textureDir + return None diff --git a/release/scripts/modules/bpy_extras/io_utils.py b/release/scripts/modules/bpy_extras/io_utils.py index e51309c5d90..c444fd618a8 100644 --- a/release/scripts/modules/bpy_extras/io_utils.py +++ b/release/scripts/modules/bpy_extras/io_utils.py @@ -18,6 +18,19 @@ # <pep8 compliant> +__all__ = ( + "ExportHelper", + "ImportHelper", + "axis_conversion", + "create_derived_objects", + "free_derived_objects", + "unpack_list", + "unpack_face_list", + "path_reference", + "path_reference_copy", + "path_reference_mode", +) + import bpy from bpy.props import StringProperty, BoolProperty, EnumProperty @@ -148,24 +161,6 @@ def axis_conversion(from_forward='Y', from_up='Z', to_forward='Y', to_up='Z'): assert("internal error") -# limited replacement for BPyImage.comprehensiveImageLoad -def load_image(imagepath, dirname): - import os - - if os.path.exists(imagepath): - return bpy.data.images.load(imagepath) - - variants = [imagepath, os.path.join(dirname, imagepath), os.path.join(dirname, os.path.basename(imagepath))] - - for filepath in variants: - for nfilepath in (filepath, bpy.path.resolve_ncase(filepath)): - if os.path.exists(nfilepath): - return bpy.data.images.load(nfilepath) - - # TODO comprehensiveImageLoad also searched in bpy.config.textureDir - return None - - # return a tuple (free, object list), free is True if memory should be freed later with free_derived_objects() def create_derived_objects(scene, ob): if ob.parent and ob.parent.dupli_type != 'NONE': diff --git a/release/scripts/modules/bpy_extras/mesh_utils.py b/release/scripts/modules/bpy_extras/mesh_utils.py index 9ec8ee98e41..b6d8a1fcf16 100644 --- a/release/scripts/modules/bpy_extras/mesh_utils.py +++ b/release/scripts/modules/bpy_extras/mesh_utils.py @@ -18,13 +18,25 @@ # <pep8 compliant> +__all__ = ( + "mesh_linked_faces", + "edge_face_count_dict", + "edge_face_count", + "edge_loops_from_faces", + "edge_loops_from_edges", + "ngon_tesselate", +) def mesh_linked_faces(mesh): - ''' - Splits the mesh into connected parts, - these parts are returned as lists of faces. - used for seperating cubes from other mesh elements in the 1 mesh - ''' + """ + Splits the mesh into connected faces, use this for seperating cubes from + other mesh elements within 1 mesh datablock. + + :arg mesh: the mesh used to group with. + :type mesh: :class:`Mesh` + :return: lists of lists containing faces. + :rtype: list + """ # Build vert face connectivity vert_faces = [[] for i in range(len(mesh.vertices))] @@ -70,6 +82,11 @@ def mesh_linked_faces(mesh): def edge_face_count_dict(mesh): + """ + :return: dict of edge keys with their value set to the number of + faces using each edge. + :rtype: dict + """ face_edge_keys = [face.edge_keys for face in mesh.faces] face_edge_count = {} for face_keys in face_edge_keys: @@ -83,8 +100,13 @@ def edge_face_count_dict(mesh): def edge_face_count(mesh): + """ + :return: list face users for each item in mesh.edges. + :rtype: list + """ edge_face_count_dict = edge_face_count_dict(mesh) - return [edge_face_count_dict.get(ed.key, 0) for ed in mesh.edges] + get = dict.get + return [get(edge_face_count_dict, ed.key, 0) for ed in mesh.edges] def edge_loops_from_faces(mesh, faces=None, seams=()): @@ -93,12 +115,18 @@ def edge_loops_from_faces(mesh, faces=None, seams=()): Takes me.faces or a list of faces and returns the edge loops These edge loops are the edges that sit between quads, so they dont touch - 1 quad, note: not connected will make 2 edge loops, both only containing 2 edges. + 1 quad, note: not connected will make 2 edge loops, + both only containing 2 edges. return a list of edge key lists - [ [(0,1), (4, 8), (3,8)], ...] - - return a list of edge vertex index lists + [[(0, 1), (4, 8), (3, 8)], ...] + + :arg mesh: the mesh used to get edge loops from. + :type mesh: :class:`Mesh` + :arg faces: optional face list to only use some of the meshes faces. + :type faces: :class:`MeshFaces`, sequence or or NoneType + :return: return a list of edge vertex index lists. + :rtype: list """ OTHER_INDEX = 2, 3, 0, 1 # opposite face index @@ -109,7 +137,7 @@ def edge_loops_from_faces(mesh, faces=None, seams=()): edges = {} for f in faces: -# if len(f) == 4: +# if len(f) == 4: if f.vertices_raw[3] != 0: edge_keys = f.edge_keys for i, edkey in enumerate(f.edge_keys): diff --git a/release/scripts/modules/bpy_extras/object_utils.py b/release/scripts/modules/bpy_extras/object_utils.py index 1cf7fc2f4d5..51a8d4b5e23 100644 --- a/release/scripts/modules/bpy_extras/object_utils.py +++ b/release/scripts/modules/bpy_extras/object_utils.py @@ -18,11 +18,27 @@ # <pep8 compliant> +__all__ = ( + "add_object_align_init", + "object_data_add", +) + + import bpy import mathutils def add_object_align_init(context, operator): + """ + Return a matrix using the operator settings and view context. + + :arg context: The context to use. + :type context: :class:`Context` + :arg operator: The operator, checked for location and rotation properties. + :type operator: :class:`Operator` + :return: the matrix from the context and settings. + :rtype: :class:`Matrix` + """ space_data = context.space_data if space_data.type != 'VIEW_3D': space_data = None @@ -64,7 +80,19 @@ def add_object_align_init(context, operator): def object_data_add(context, obdata, operator=None): - + """ + Add an object using the view context and preference to to initialize the + location, rotation and layer. + + :arg context: The context to use. + :type context: :class:`Context` + :arg obdata: the data used for the new object. + :type obdata: valid object data type or None. + :arg operator: The operator, checked for location and rotation properties. + :type operator: :class:`Operator` + :return: the newly created object in the scene. + :rtype: :class:`ObjectBase` + """ scene = context.scene # ugh, could be made nicer diff --git a/release/scripts/modules/bpy_extras/view3d_utils.py b/release/scripts/modules/bpy_extras/view3d_utils.py index ef2e20c4908..45f537ebd2f 100644 --- a/release/scripts/modules/bpy_extras/view3d_utils.py +++ b/release/scripts/modules/bpy_extras/view3d_utils.py @@ -18,6 +18,12 @@ # <pep8 compliant> +__all__ = ( + "region_2d_to_vector_3d", + "region_2d_to_location_3d", + "location_3d_to_region_2d", + "location_3d_to_region_2d", +) def region_2d_to_vector_3d(region, rv3d, coord): """ @@ -28,7 +34,7 @@ def region_2d_to_vector_3d(region, rv3d, coord): :type region: :class:`Region` :arg rv3d: 3D region data, typically bpy.context.space_data.region_3d. :type rv3d: :class:`RegionView3D` - :arg coord: 2d coordinates relative to the region; + :arg coord: 2d coordinates relative to the region: (event.mouse_region_x, event.mouse_region_y) for example. :type coord: 2d vector :return: normalized 3d vector. @@ -44,7 +50,9 @@ def region_2d_to_vector_3d(region, rv3d, coord): -0.5 )) - w = (out[0] * persinv[0][3]) + (out[1] * persinv[1][3]) + (out[2] * persinv[2][3]) + persinv[3][3] + w = (out[0] * persinv[0][3]) + \ + (out[1] * persinv[1][3]) + \ + (out[2] * persinv[2][3]) + persinv[3][3] return ((out * persinv) / w) - rv3d.view_matrix.inverted()[3].xyz else: diff --git a/source/blender/blenkernel/BKE_blender.h b/source/blender/blenkernel/BKE_blender.h index 2a524c188e9..3e282668387 100644 --- a/source/blender/blenkernel/BKE_blender.h +++ b/source/blender/blenkernel/BKE_blender.h @@ -42,7 +42,7 @@ extern "C" { /* these lines are grep'd, watch out for our not-so-awesome regex * and keep comment above the defines. - * Use STRINGIFY() rather then defining with quotes */ + * Use STRINGIFY() rather than defining with quotes */ #define BLENDER_VERSION 257 #define BLENDER_SUBVERSION 2 diff --git a/source/blender/blenkernel/BKE_sequencer.h b/source/blender/blenkernel/BKE_sequencer.h index 94c474c668f..bedd58876bc 100644 --- a/source/blender/blenkernel/BKE_sequencer.h +++ b/source/blender/blenkernel/BKE_sequencer.h @@ -279,7 +279,7 @@ int shuffle_seq_time(ListBase * seqbasep, struct Scene *evil_scene); int seqbase_isolated_sel_check(struct ListBase *seqbase); void free_imbuf_seq(struct Scene *scene, struct ListBase * seqbasep, int check_mem_usage, int keep_file_handles); struct Sequence *seq_dupli_recursive(struct Scene *scene, struct Scene *scene_to, struct Sequence * seq, int dupe_flag); -int seq_swap(struct Sequence *seq_a, struct Sequence *seq_b); +int seq_swap(struct Sequence *seq_a, struct Sequence *seq_b, const char **error_str); void seq_update_sound(struct Scene* scene, struct Sequence *seq); void seq_update_muting(struct Scene* scene, struct Editing *ed); diff --git a/source/blender/blenkernel/CMakeLists.txt b/source/blender/blenkernel/CMakeLists.txt index 2831636361f..44d20b6c651 100644 --- a/source/blender/blenkernel/CMakeLists.txt +++ b/source/blender/blenkernel/CMakeLists.txt @@ -44,6 +44,7 @@ set(INC ../editors/include ../render/extern/include ../../../intern/audaspace/intern + ../../../intern/ffmpeg ../../../intern/bsp/extern ../blenfont ../../../intern/decimation/extern ../../../intern/elbeem/extern diff --git a/source/blender/blenkernel/SConscript b/source/blender/blenkernel/SConscript index ea19b51c044..b5f845acacb 100644 --- a/source/blender/blenkernel/SConscript +++ b/source/blender/blenkernel/SConscript @@ -14,6 +14,7 @@ incs += ' ../gpu #/extern/glew/include' incs += ' #/intern/smoke/extern' incs += ' #/intern/mikktspace' incs += ' #/intern/audaspace/intern' +incs += ' #/intern/ffmpeg' incs += ' ' + env['BF_OPENGL_INC'] incs += ' ' + env['BF_ZLIB_INC'] diff --git a/source/blender/blenkernel/intern/curve.c b/source/blender/blenkernel/intern/curve.c index b104c6c9b30..704af73dd10 100644 --- a/source/blender/blenkernel/intern/curve.c +++ b/source/blender/blenkernel/intern/curve.c @@ -1859,7 +1859,7 @@ static void make_bevel_list_3D_minimum_twist(BevList *bl) * do this by calculating the tilt angle difference, then apply * the rotation gradually over the entire curve * - * note that the split is between last and second last, rather then first/last as youd expect. + * note that the split is between last and second last, rather than first/last as youd expect. * * real order is like this * 0,1,2,3,4 --> 1,2,3,4,0 diff --git a/source/blender/blenkernel/intern/image.c b/source/blender/blenkernel/intern/image.c index f17438c2b00..c48497c45a1 100644 --- a/source/blender/blenkernel/intern/image.c +++ b/source/blender/blenkernel/intern/image.c @@ -1029,7 +1029,7 @@ void BKE_stamp_buf(Scene *scene, Object *camera, unsigned char *rect, float *rec BLF_buffer_col(mono, scene->r.fg_stamp[0], scene->r.fg_stamp[1], scene->r.fg_stamp[2], 1.0); pad= BLF_width_max(mono); - /* use 'h_fixed' rather then 'h', aligns better */ + /* use 'h_fixed' rather than 'h', aligns better */ h_fixed= BLF_height_max(mono); y_ofs = -BLF_descender(mono); diff --git a/source/blender/blenkernel/intern/lattice.c b/source/blender/blenkernel/intern/lattice.c index f0ac7040deb..094214858f9 100644 --- a/source/blender/blenkernel/intern/lattice.c +++ b/source/blender/blenkernel/intern/lattice.c @@ -607,7 +607,7 @@ static int calc_curve_deform(Scene *scene, Object *par, float *co, short axis, C if(cd->no_rot_axis) { /* set by caller */ - /* this is not exactly the same as 2.4x, since the axis is having rotation removed rather then + /* this is not exactly the same as 2.4x, since the axis is having rotation removed rather than * changing the axis before calculating the tilt but serves much the same purpose */ float dir_flat[3]={0,0,0}, q[4]; copy_v3_v3(dir_flat, dir); diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c index 467dad756bc..83a145883d2 100644 --- a/source/blender/blenkernel/intern/object.c +++ b/source/blender/blenkernel/intern/object.c @@ -1766,7 +1766,7 @@ void object_apply_mat4(Object *ob, float mat[][4], const short use_compat, const mul_m4_m4m4(rmat, mat, imat); /* get the parent relative matrix */ object_apply_mat4(ob, rmat, use_compat, FALSE); - /* same as below, use rmat rather then mat */ + /* same as below, use rmat rather than mat */ mat4_to_loc_rot_size(ob->loc, rot, ob->size, rmat); object_mat3_to_rot(ob, rot, use_compat); } diff --git a/source/blender/blenkernel/intern/sequencer.c b/source/blender/blenkernel/intern/sequencer.c index 30abb6278a7..009665f3a1f 100644 --- a/source/blender/blenkernel/intern/sequencer.c +++ b/source/blender/blenkernel/intern/sequencer.c @@ -3207,26 +3207,30 @@ Sequence *seq_metastrip(ListBase * seqbase, Sequence * meta, Sequence *seq) return NULL; } -int seq_swap(Sequence *seq_a, Sequence *seq_b) +int seq_swap(Sequence *seq_a, Sequence *seq_b, const char **error_str) { char name[sizeof(seq_a->name)]; if(seq_a->len != seq_b->len) + *error_str= "Strips must be the same length"; return 0; /* type checking, could be more advanced but disalow sound vs non-sound copy */ if(seq_a->type != seq_b->type) { if(seq_a->type == SEQ_SOUND || seq_b->type == SEQ_SOUND) { + *error_str= "Strips were not compatible"; return 0; } /* disallow effects to swap with non-effects strips */ if((seq_a->type & SEQ_EFFECT) != (seq_b->type & SEQ_EFFECT)) { + *error_str= "Strips were not compatible"; return 0; } if((seq_a->type & SEQ_EFFECT) && (seq_b->type & SEQ_EFFECT)) { if(get_sequence_effect_num_inputs(seq_a->type) != get_sequence_effect_num_inputs(seq_b->type)) { + *error_str= "Strips must have the same number of inputs"; return 0; } } diff --git a/source/blender/blenkernel/intern/text.c b/source/blender/blenkernel/intern/text.c index 40eb86f25be..da329503c9f 100644 --- a/source/blender/blenkernel/intern/text.c +++ b/source/blender/blenkernel/intern/text.c @@ -238,7 +238,7 @@ static void cleanup_textline(TextLine * tl) int reopen_text(Text *text) { FILE *fp; - int i, llen, len, res; + int i, llen, len; unsigned char *buffer; TextLine *tmp; char str[FILE_MAXDIR+FILE_MAXFILE]; @@ -281,7 +281,7 @@ int reopen_text(Text *text) fclose(fp); - res= stat(str, &st); + stat(str, &st); text->mtime= st.st_mtime; text->nlines=0; @@ -334,7 +334,7 @@ Text *add_text(const char *file, const char *relpath) { Main *bmain= G.main; FILE *fp; - int i, llen, len, res; + int i, llen, len; unsigned char *buffer; TextLine *tmp; Text *ta; @@ -374,7 +374,7 @@ Text *add_text(const char *file, const char *relpath) fclose(fp); - res= stat(str, &st); + stat(str, &st); ta->mtime= st.st_mtime; ta->nlines=0; @@ -1236,14 +1236,11 @@ int txt_find_string(Text *text, char *findstr, int wrap, int match_case) { TextLine *tl, *startl; char *s= NULL; - int oldcl, oldsl; if (!text || !text->curl || !text->sell) return 0; txt_order_cursors(text); - oldcl= txt_get_span(text->lines.first, text->curl); - oldsl= txt_get_span(text->lines.first, text->sell); tl= startl= text->sell; if(match_case) s= strstr(&tl->line[text->selc], findstr); @@ -2414,7 +2411,7 @@ static int txt_add_char_intern (Text *text, char add, int replace_tabs) return 1; } - /* insert spaces rather then tabs */ + /* insert spaces rather than tabs */ if (add == '\t' && replace_tabs) { txt_convert_tab_to_spaces(text); return 1; @@ -2512,7 +2509,7 @@ void txt_indent(Text *text) /* hardcoded: TXT_TABSIZE = 4 spaces: */ int spaceslen = TXT_TABSIZE; - /* insert spaces rather then tabs */ + /* insert spaces rather than tabs */ if (text->flags & TXT_TABSTOSPACES){ add = tab_to_spaces; indentlen = spaceslen; @@ -2573,7 +2570,7 @@ void txt_unindent(Text *text) /* hardcoded: TXT_TABSIZE = 4 spaces: */ int spaceslen = TXT_TABSIZE; - /* insert spaces rather then tabs */ + /* insert spaces rather than tabs */ if (text->flags & TXT_TABSTOSPACES){ remove = tab_to_spaces; indent = spaceslen; @@ -2759,7 +2756,7 @@ int setcurr_tab_spaces (Text *text, int space) break; } else if (ch==':') { is_indent = 1; - } else if (ch==']' || ch=='}' || ch=='"' || ch=='\'') { + } else if (ch!=' ' && ch!='\t') { is_indent = 0; } } diff --git a/source/blender/blenkernel/intern/writeffmpeg.c b/source/blender/blenkernel/intern/writeffmpeg.c index 48930ae2eb8..c729565533f 100644 --- a/source/blender/blenkernel/intern/writeffmpeg.c +++ b/source/blender/blenkernel/intern/writeffmpeg.c @@ -61,34 +61,7 @@ #include "IMB_imbuf_types.h" #include "IMB_imbuf.h" -#if (LIBAVFORMAT_VERSION_MAJOR > 52) || ((LIBAVFORMAT_VERSION_MAJOR >= 52) && (LIBAVFORMAT_VERSION_MINOR >= 105)) -#define FFMPEG_HAVE_AVIO 1 -#endif - -#if (LIBAVFORMAT_VERSION_MAJOR > 53) || ((LIBAVFORMAT_VERSION_MAJOR >= 53) && (LIBAVFORMAT_VERSION_MINOR >= 1)) -#define FFMPEG_HAVE_DEFAULT_VAL_UNION 1 -#endif - -#if (LIBAVFORMAT_VERSION_MAJOR > 52) || ((LIBAVFORMAT_VERSION_MAJOR >= 52) && (LIBAVFORMAT_VERSION_MINOR >= 101)) -#define FFMPEG_HAVE_AV_DUMP_FORMAT 1 -#endif - -#ifndef FFMPEG_HAVE_AVIO -#define AVIO_FLAG_WRITE URL_WRONLY -#define avio_open url_fopen -#define avio_tell url_ftell -#define avio_close url_fclose -#endif - -/* make OpenSuSe special "in-between" ffmpeg 0.6.2 version(tm) happy... - Arrrrgh */ -#ifndef AVIO_FLAG_WRITE -#define AVIO_FLAG_WRITE URL_WRONLY -#endif - -#ifndef FFMPEG_HAVE_AV_DUMP_FORMAT -#define av_dump_format dump_format -#endif +#include "ffmpeg_compat.h" extern void do_init_ffmpeg(void); @@ -1080,20 +1053,12 @@ IDProperty *ffmpeg_property_add(RenderData *rd, char * type, int opt_index, int switch (o->type) { case FF_OPT_TYPE_INT: case FF_OPT_TYPE_INT64: -#ifdef FFMPEG_HAVE_DEFAULT_VAL_UNION - val.i = o->default_val.i64; -#else - val.i = o->default_val; -#endif + val.i = FFMPEG_DEF_OPT_VAL_INT(o); idp_type = IDP_INT; break; case FF_OPT_TYPE_DOUBLE: case FF_OPT_TYPE_FLOAT: -#ifdef FFMPEG_HAVE_DEFAULT_VAL_UNION - val.f = o->default_val.dbl; -#else - val.f = o->default_val; -#endif + val.f = FFMPEG_DEF_OPT_VAL_DOUBLE(o); idp_type = IDP_FLOAT; break; case FF_OPT_TYPE_STRING: diff --git a/source/blender/blenlib/intern/path_util.c b/source/blender/blenlib/intern/path_util.c index 5056961c8d6..e0a08d0b890 100644 --- a/source/blender/blenlib/intern/path_util.c +++ b/source/blender/blenlib/intern/path_util.c @@ -736,7 +736,7 @@ int BLI_path_cwd(char *path) * cwd should contain c:\ etc on win32 so the relbase can be NULL * relbase being NULL also prevents // being misunderstood as relative to the current * blend file which isnt a feature we want to use in this case since were dealing - * with a path from the command line, rather then from inside Blender */ + * with a path from the command line, rather than from inside Blender */ char origpath[FILE_MAXDIR + FILE_MAXFILE]; BLI_strncpy(origpath, path, FILE_MAXDIR + FILE_MAXFILE); diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index e18fde5ecbe..2315fa19354 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -9695,7 +9695,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main) nu->radius_interp = 3; /* resolu and resolv are now used differently for surfaces - * rather then using the resolution to define the entire number of divisions, + * rather than using the resolution to define the entire number of divisions, * use it for the number of divisions per segment */ if (nu->pntsv > 1) { @@ -11539,7 +11539,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main) do_version_bone_roll_256(bone); /* fix for objects which have zero dquat's - * since this is multiplied with the quat rather then added */ + * since this is multiplied with the quat rather than added */ for(ob= main->object.first; ob; ob= ob->id.next) { if(is_zero_v4(ob->dquat)) { unit_qt(ob->dquat); diff --git a/source/blender/editors/gpencil/gpencil_edit.c b/source/blender/editors/gpencil/gpencil_edit.c index 42ffefa6bd4..2860d467cef 100644 --- a/source/blender/editors/gpencil/gpencil_edit.c +++ b/source/blender/editors/gpencil/gpencil_edit.c @@ -444,7 +444,6 @@ static void gp_stroke_to_path (bContext *C, bGPDlayer *gpl, bGPDstroke *gps, Cur static int gp_camera_view_subrect(bContext *C, rctf *subrect) { - Scene *scene= CTX_data_scene(C); View3D *v3d= CTX_wm_view3d(C); ARegion *ar= CTX_wm_region(C); @@ -453,6 +452,7 @@ static int gp_camera_view_subrect(bContext *C, rctf *subrect) /* for camera view set the subrect */ if (rv3d->persp == RV3D_CAMOB) { + Scene *scene= CTX_data_scene(C); ED_view3d_calc_camera_border(scene, ar, v3d, rv3d, subrect, -1); /* negative shift */ return 1; } diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c index da479fe7ca3..28a874f78de 100644 --- a/source/blender/editors/interface/interface.c +++ b/source/blender/editors/interface/interface.c @@ -556,7 +556,7 @@ static int ui_but_update_from_old_block(const bContext *C, uiBlock *block, uiBut // but->flag= oldbut->flag; #else /* exception! redalert flag can't be update from old button. - * perhaps it should only copy spesific flags rather then all. */ + * perhaps it should only copy spesific flags rather than all. */ // but->flag= (oldbut->flag & ~UI_BUT_REDALERT) | (but->flag & UI_BUT_REDALERT); #endif // but->active= oldbut->active; diff --git a/source/blender/editors/mesh/editmesh_tools.c b/source/blender/editors/mesh/editmesh_tools.c index dc744c49fae..424d3dd5a38 100644 --- a/source/blender/editors/mesh/editmesh_tools.c +++ b/source/blender/editors/mesh/editmesh_tools.c @@ -5316,7 +5316,7 @@ void MESH_OT_blend_from_shape(wmOperatorType *ot) prop= RNA_def_enum(ot->srna, "shape", shape_items, 0, "Shape", "Shape key to use for blending."); RNA_def_enum_funcs(prop, shape_itemf); RNA_def_float(ot->srna, "blend", 1.0f, -FLT_MAX, FLT_MAX, "Blend", "Blending factor.", -2.0f, 2.0f); - RNA_def_boolean(ot->srna, "add", 0, "Add", "Add rather then blend between shapes."); + RNA_def_boolean(ot->srna, "add", 0, "Add", "Add rather than blend between shapes."); } /************************ Merge Operator *************************/ diff --git a/source/blender/editors/physics/particle_edit.c b/source/blender/editors/physics/particle_edit.c index 653c393a011..c5ab840914e 100644 --- a/source/blender/editors/physics/particle_edit.c +++ b/source/blender/editors/physics/particle_edit.c @@ -373,7 +373,7 @@ static void PE_set_view3d_data(bContext *C, PEData *data) PE_set_data(C, data); view3d_set_viewcontext(C, &data->vc); - /* note, the object argument means the modelview matrix does not account for the objects matrix, use viewmat rather then (obmat * viewmat) */ + /* note, the object argument means the modelview matrix does not account for the objects matrix, use viewmat rather than (obmat * viewmat) */ view3d_get_transformation(data->vc.ar, data->vc.rv3d, NULL, &data->mats); if((data->vc.v3d->drawtype>OB_WIRE) && (data->vc.v3d->flag & V3D_ZBUF_SELECT)) { diff --git a/source/blender/editors/sculpt_paint/SConscript b/source/blender/editors/sculpt_paint/SConscript index f35250d4863..e871e1f4792 100644 --- a/source/blender/editors/sculpt_paint/SConscript +++ b/source/blender/editors/sculpt_paint/SConscript @@ -21,6 +21,7 @@ if env['OURPLATFORM'] == 'linuxcross': if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc'): incs += ' ' + env['BF_PTHREADS_INC'] +env.BlenderLib ( 'bf_editors_sculpt_paint', sources, Split(incs), defines=defs, libtype=['core'], priority=[40] ) if env['WITH_BF_ONSURFACEBRUSH']: defs.append('WITH_ONSURFACEBRUSH') diff --git a/source/blender/editors/sculpt_paint/paint_vertex.c b/source/blender/editors/sculpt_paint/paint_vertex.c index 0380dba7592..0d79fcc2c58 100644 --- a/source/blender/editors/sculpt_paint/paint_vertex.c +++ b/source/blender/editors/sculpt_paint/paint_vertex.c @@ -1038,7 +1038,7 @@ static int weight_sample_group_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -/* TODO, we could make this a menu into OBJECT_OT_vertex_group_set_active rather then its own operator */ +/* TODO, we could make this a menu into OBJECT_OT_vertex_group_set_active rather than its own operator */ void PAINT_OT_weight_sample_group(wmOperatorType *ot) { PropertyRNA *prop= NULL; diff --git a/source/blender/editors/space_node/drawnode.c b/source/blender/editors/space_node/drawnode.c index b5bb635b544..17cfc7d8f95 100644 --- a/source/blender/editors/space_node/drawnode.c +++ b/source/blender/editors/space_node/drawnode.c @@ -862,7 +862,7 @@ static void node_composit_buts_color_spill(uiLayout *layout, bContext *UNUSED(C) uiItemR(col, ptr, "ratio", UI_ITEM_R_SLIDER, NULL, ICON_NONE); uiItemR(col, ptr, "use_unspill", 0, NULL, ICON_NONE); - if (RNA_enum_get(ptr, "use_unspill")== 1) { + if (RNA_boolean_get(ptr, "use_unspill")== 1) { uiItemR(col, ptr, "unspill_red", UI_ITEM_R_SLIDER, NULL, ICON_NONE); uiItemR(col, ptr, "unspill_green", UI_ITEM_R_SLIDER, NULL, ICON_NONE); uiItemR(col, ptr, "unspill_blue", UI_ITEM_R_SLIDER, NULL, ICON_NONE); diff --git a/source/blender/editors/space_sequencer/sequencer_edit.c b/source/blender/editors/space_sequencer/sequencer_edit.c index 4b9f87f67d8..71ed7928bc8 100644 --- a/source/blender/editors/space_sequencer/sequencer_edit.c +++ b/source/blender/editors/space_sequencer/sequencer_edit.c @@ -2719,14 +2719,15 @@ static int sequencer_swap_data_exec(bContext *C, wmOperator *op) Scene *scene= CTX_data_scene(C); Sequence *seq_act; Sequence *seq_other; + const char *error_msg; if(seq_active_pair_get(scene, &seq_act, &seq_other) == 0) { BKE_report(op->reports, RPT_ERROR, "Must select 2 strips"); return OPERATOR_CANCELLED; } - if(seq_swap(seq_act, seq_other) == 0) { - BKE_report(op->reports, RPT_ERROR, "Strips were not compatible"); + if(seq_swap(seq_act, seq_other, &error_msg) == 0) { + BKE_report(op->reports, RPT_ERROR, error_msg); return OPERATOR_CANCELLED; } diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c index bb49a9ea17f..5992437172d 100644 --- a/source/blender/editors/space_view3d/drawobject.c +++ b/source/blender/editors/space_view3d/drawobject.c @@ -2651,7 +2651,7 @@ static void draw_mesh_fancy(Scene *scene, ARegion *ar, View3D *v3d, RegionView3D else if(dt==OB_SOLID) { if(ob==OBACT && ob && ob->mode & OB_MODE_WEIGHT_PAINT) { /* weight paint in solid mode, special case. focus on making the weights clear - * rather then the shading, this is also forced in wire view */ + * rather than the shading, this is also forced in wire view */ GPU_enable_material(0, NULL); dm->drawMappedFaces(dm, wpaint__setSolidDrawOptions, me->mface, 1, GPU_enable_material); diff --git a/source/blender/editors/space_view3d/view3d_edit.c b/source/blender/editors/space_view3d/view3d_edit.c index 4aa3a6a36c4..31aae28dd61 100644 --- a/source/blender/editors/space_view3d/view3d_edit.c +++ b/source/blender/editors/space_view3d/view3d_edit.c @@ -445,7 +445,7 @@ static void viewops_data_create(bContext *C, wmOperator *op, wmEvent *event) sub_v3_v3v3(my_pivot, rv3d->ofs, upvec); negate_v3(my_pivot); /* ofs is flipped */ - /* find a new ofs value that is allong the view axis (rather then the mouse location) */ + /* find a new ofs value that is allong the view axis (rather than the mouse location) */ closest_to_line_v3(dvec, vod->dyn_ofs, my_pivot, my_origin); vod->dist0 = rv3d->dist = len_v3v3(my_pivot, dvec); diff --git a/source/blender/editors/space_view3d/view3d_fly.c b/source/blender/editors/space_view3d/view3d_fly.c index c61aa63f6e7..f785b111c78 100644 --- a/source/blender/editors/space_view3d/view3d_fly.c +++ b/source/blender/editors/space_view3d/view3d_fly.c @@ -477,7 +477,7 @@ static void flyEvent(FlyInfo *fly, wmEvent *event) /* impliment WASD keys */ case FLY_MODAL_DIR_FORWARD: - if (fly->speed < 0.0f) fly->speed= -fly->speed; /* flip speed rather then stopping, game like motion */ + if (fly->speed < 0.0f) fly->speed= -fly->speed; /* flip speed rather than stopping, game like motion */ else if (fly->axis==2) fly->speed += fly->grid; /* increse like mousewheel if were already moving in that difection*/ fly->axis= 2; break; diff --git a/source/blender/editors/space_view3d/view3d_select.c b/source/blender/editors/space_view3d/view3d_select.c index 0940734a8e9..fb3c0a63b7d 100644 --- a/source/blender/editors/space_view3d/view3d_select.c +++ b/source/blender/editors/space_view3d/view3d_select.c @@ -1234,7 +1234,7 @@ static int mouse_select(bContext *C, const int mval[2], short extend, short obce startbase= FIRSTBASE; if(BASACT && BASACT->next) startbase= BASACT->next; - /* This block uses the control key to make the object selected by its center point rather then its contents */ + /* This block uses the control key to make the object selected by its center point rather than its contents */ /* XXX later on, in editmode do not activate */ if(vc.obedit==NULL && obcenter) { diff --git a/source/blender/editors/util/undo.c b/source/blender/editors/util/undo.c index 9ac44f482a1..f4e27a5faf9 100644 --- a/source/blender/editors/util/undo.c +++ b/source/blender/editors/util/undo.c @@ -344,7 +344,7 @@ void ED_OT_redo(wmOperatorType *ot) } -/* ui callbacks should call this rather then calling WM_operator_repeat() themselves */ +/* ui callbacks should call this rather than calling WM_operator_repeat() themselves */ int ED_undo_operator_repeat(bContext *C, struct wmOperator *op) { int ret= 0; diff --git a/source/blender/editors/uvedit/uvedit_ops.c b/source/blender/editors/uvedit/uvedit_ops.c index 1ea2db4c237..66b1e7d412b 100644 --- a/source/blender/editors/uvedit/uvedit_ops.c +++ b/source/blender/editors/uvedit/uvedit_ops.c @@ -1444,7 +1444,7 @@ static int mouse_select(bContext *C, float co[2], int extend, int loop) * remove doubles and could annoying if it joined points when zoomed out. * 'penalty' is in screen pixel space otherwise zooming in on a uv-vert and * shift-selecting can consider an adjacent point close enough to add to - * the selection rather then de-selecting the closest. */ + * the selection rather than de-selecting the closest. */ uvedit_pixel_to_float(sima, limit, 0.05f); uvedit_pixel_to_float(sima, penalty, 5.0f / sima->zoom); diff --git a/source/blender/imbuf/CMakeLists.txt b/source/blender/imbuf/CMakeLists.txt index 6404ae3de75..ed4508053b8 100644 --- a/source/blender/imbuf/CMakeLists.txt +++ b/source/blender/imbuf/CMakeLists.txt @@ -38,6 +38,7 @@ set(INC ../makesdna ../../../intern/memutil ../../../intern/guardedalloc + ../../../intern/ffmpeg ${JPEG_INCLUDE_DIR} ${PNG_INCLUDE_DIR} ${ZLIB_INCLUDE_DIRS} @@ -100,6 +101,9 @@ set(SRC intern/md5.h intern/openexr/openexr_api.h intern/openexr/openexr_multi.h + + # orphan include + ../../../intern/ffmpeg/ffmpeg_compat.h ) if(WITH_IMAGE_OPENEXR) diff --git a/source/blender/imbuf/SConscript b/source/blender/imbuf/SConscript index ecb9a89c274..a80f92b4421 100644 --- a/source/blender/imbuf/SConscript +++ b/source/blender/imbuf/SConscript @@ -5,7 +5,7 @@ sources = env.Glob('intern/*.c') incs = '. ../makesdna #/intern/guardedalloc #/intern/memutil ../blenlib' incs += ' ../avi ../blenkernel ../blenloader' - +incs += ' #/intern/ffmpeg' incs += ' ' + env['BF_JPEG_INC'] incs += ' ' + env['BF_PNG_INC'] diff --git a/source/blender/imbuf/intern/anim_movie.c b/source/blender/imbuf/intern/anim_movie.c index a0051d85c5b..919b0eb0c29 100644 --- a/source/blender/imbuf/intern/anim_movie.c +++ b/source/blender/imbuf/intern/anim_movie.c @@ -97,24 +97,7 @@ #include <libavutil/rational.h> #include <libswscale/swscale.h> -#if LIBAVFORMAT_VERSION_INT < (49 << 16) -#define FFMPEG_OLD_FRAME_RATE 1 -#else -#define FFMPEG_CODEC_IS_POINTER 1 -#endif - -#if (LIBAVCODEC_VERSION_MAJOR >= 52) && (LIBAVCODEC_VERSION_MINOR >= 29) && \ - (LIBSWSCALE_VERSION_MAJOR >= 0) && (LIBSWSCALE_VERSION_MINOR >= 10) -#define FFMPEG_SWSCALE_COLOR_SPACE_SUPPORT -#endif - -#if (LIBAVFORMAT_VERSION_MAJOR > 52) || ((LIBAVFORMAT_VERSION_MAJOR >= 52) && (LIBAVFORMAT_VERSION_MINOR >= 101)) -#define FFMPEG_HAVE_AV_DUMP_FORMAT 1 -#endif - -#ifndef FFMPEG_HAVE_AV_DUMP_FORMAT -#define av_dump_format dump_format -#endif +#include "ffmpeg_compat.h" #endif //WITH_FFMPEG @@ -528,18 +511,6 @@ static ImBuf * avi_fetchibuf (struct anim *anim, int position) { extern void do_init_ffmpeg(void); -#ifdef FFMPEG_CODEC_IS_POINTER -static AVCodecContext* get_codec_from_stream(AVStream* stream) -{ - return stream->codec; -} -#else -static AVCodecContext* get_codec_from_stream(AVStream* stream) -{ - return &stream->codec; -} -#endif - static int startffmpeg(struct anim * anim) { int i, videoStream; @@ -573,7 +544,7 @@ static int startffmpeg(struct anim * anim) { /* Find the first video stream */ videoStream=-1; for(i=0; i<pFormatCtx->nb_streams; i++) - if(get_codec_from_stream(pFormatCtx->streams[i])->codec_type + if(pFormatCtx->streams[i]->codec->codec_type == AVMEDIA_TYPE_VIDEO) { videoStream=i; break; @@ -584,7 +555,7 @@ static int startffmpeg(struct anim * anim) { return -1; } - pCodecCtx = get_codec_from_stream(pFormatCtx->streams[videoStream]); + pCodecCtx = pFormatCtx->streams[videoStream]->codec; /* Find the decoder for the video stream */ pCodec=avcodec_find_decoder(pCodecCtx->codec_id); @@ -600,19 +571,10 @@ static int startffmpeg(struct anim * anim) { return -1; } -#ifdef FFMPEG_OLD_FRAME_RATE - if(pCodecCtx->frame_rate>1000 && pCodecCtx->frame_rate_base==1) - pCodecCtx->frame_rate_base=1000; - - - anim->duration = pFormatCtx->duration * pCodecCtx->frame_rate - / pCodecCtx->frame_rate_base / AV_TIME_BASE; -#else anim->duration = ceil(pFormatCtx->duration * av_q2d(pFormatCtx->streams[videoStream]->r_frame_rate) / AV_TIME_BASE); -#endif anim->params = 0; anim->x = pCodecCtx->width; @@ -866,15 +828,9 @@ static ImBuf * ffmpeg_fetchibuf(struct anim * anim, int position) { #endif if (position != anim->curposition + 1) { -#ifdef FFMPEG_OLD_FRAME_RATE - double frame_rate = - (double) anim->pCodecCtx->frame_rate - / (double) anim->pCodecCtx->frame_rate_base; -#else double frame_rate = av_q2d(anim->pFormatCtx->streams[anim->videoStream] ->r_frame_rate); -#endif double pts_time_base = av_q2d(anim->pFormatCtx->streams[anim->videoStream]->time_base); long long pos; long long st_time = anim->pFormatCtx->start_time; diff --git a/source/blender/imbuf/intern/imageprocess.c b/source/blender/imbuf/intern/imageprocess.c index fa5e951067d..1ac4e4e06cb 100644 --- a/source/blender/imbuf/intern/imageprocess.c +++ b/source/blender/imbuf/intern/imageprocess.c @@ -315,7 +315,7 @@ void bilinear_interpolation_color(struct ImBuf *in, unsigned char *outI, float * /* Note about wrapping, the u/v still needs to be within the image bounds, * just the interpolation is wrapped. - * This the same as bilinear_interpolation_color except it wraps rather then using empty and emptyI */ + * This the same as bilinear_interpolation_color except it wraps rather than using empty and emptyI */ void bilinear_interpolation_color_wrap(struct ImBuf *in, unsigned char *outI, float *outF, float u, float v) { float *row1, *row2, *row3, *row4, a, b; diff --git a/source/blender/imbuf/intern/util.c b/source/blender/imbuf/intern/util.c index 3eed69f4c52..6e5e87d7e5c 100644 --- a/source/blender/imbuf/intern/util.c +++ b/source/blender/imbuf/intern/util.c @@ -63,13 +63,7 @@ #include <libavdevice/avdevice.h> #include <libavutil/log.h> -#if (LIBAVFORMAT_VERSION_MAJOR > 52) || ((LIBAVFORMAT_VERSION_MAJOR >= 52) && (LIBAVFORMAT_VERSION_MINOR >= 101)) -#define FFMPEG_HAVE_AV_DUMP_FORMAT 1 -#endif - -#ifndef FFMPEG_HAVE_AV_DUMP_FORMAT -#define av_dump_format dump_format -#endif +#include "ffmpeg_compat.h" #endif diff --git a/source/blender/makesrna/intern/rna_rna.c b/source/blender/makesrna/intern/rna_rna.c index 8faff2e26a9..84bb624b546 100644 --- a/source/blender/makesrna/intern/rna_rna.c +++ b/source/blender/makesrna/intern/rna_rna.c @@ -341,7 +341,7 @@ int rna_builtin_properties_lookup_string(PointerRNA *ptr, const char *key, Point /* this was used pre 2.5beta0, now ID property access uses python's * getitem style access - * - ob["foo"] rather then ob.foo */ + * - ob["foo"] rather than ob.foo */ #if 0 if(ptr->data) { IDProperty *group, *idp; diff --git a/source/blender/makesrna/intern/rna_sequencer.c b/source/blender/makesrna/intern/rna_sequencer.c index 6d4e9bb476c..8d568cc6b89 100644 --- a/source/blender/makesrna/intern/rna_sequencer.c +++ b/source/blender/makesrna/intern/rna_sequencer.c @@ -452,7 +452,7 @@ static void rna_Sequence_filepath_set(PointerRNA *ptr, const char *value) if(seq->type == SEQ_SOUND && seq->sound) { /* for sound strips we need to update the sound as well. - * arguably, this could load in a new sound rather then modify an existing one. + * arguably, this could load in a new sound rather than modify an existing one. * but while using the sequencer its most likely your not using the sound in the game engine too. */ PointerRNA id_ptr; diff --git a/source/blender/makesrna/intern/rna_sequencer_api.c b/source/blender/makesrna/intern/rna_sequencer_api.c index 4ea6ae9f6a1..bb4569db397 100644 --- a/source/blender/makesrna/intern/rna_sequencer_api.c +++ b/source/blender/makesrna/intern/rna_sequencer_api.c @@ -51,8 +51,10 @@ static void rna_Sequence_swap_internal(Sequence *seq_self, ReportList *reports, Sequence *seq_other) { - if(seq_swap(seq_self, seq_other) == 0) - BKE_report(reports, RPT_ERROR, "both strips must be the same length"); + const char *error_msg; + + if(seq_swap(seq_self, seq_other, &error_msg) == 0) + BKE_report(reports, RPT_ERROR, error_msg); } #else diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c index cee6b7e2b1e..4e0027acfe5 100644 --- a/source/blender/makesrna/intern/rna_userdef.c +++ b/source/blender/makesrna/intern/rna_userdef.c @@ -2042,7 +2042,7 @@ static void rna_def_userdef_view(BlenderRNA *brna) prop= RNA_def_property(srna, "use_camera_lock_parent", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_negative_sdna(prop, NULL, "uiflag", USER_CAM_LOCK_NO_PARENT); - RNA_def_property_ui_text(prop, "Camera Parent Lock", "When the camera is locked to the view and in fly mode, transform the parent rather then the camera"); + RNA_def_property_ui_text(prop, "Camera Parent Lock", "When the camera is locked to the view and in fly mode, transform the parent rather than the camera"); /* view zoom */ prop= RNA_def_property(srna, "use_zoom_to_mouse", PROP_BOOLEAN, PROP_NONE); diff --git a/source/blender/python/generic/IDProp.c b/source/blender/python/generic/IDProp.c index 8330927d920..a807624187a 100644 --- a/source/blender/python/generic/IDProp.c +++ b/source/blender/python/generic/IDProp.c @@ -114,7 +114,7 @@ PyObject *BPy_IDGroup_WrapData( ID *id, IDProperty *prop ) Py_RETURN_NONE; } -#if 0 /* UNUSED, currenly assignment overwrites into new properties, rather then setting in-place */ +#if 0 /* UNUSED, currenly assignment overwrites into new properties, rather than setting in-place */ static int BPy_IDGroup_SetData(BPy_IDProperty *self, IDProperty *prop, PyObject *value) { switch (prop->type) { diff --git a/source/blender/python/generic/bpy_internal_import.c b/source/blender/python/generic/bpy_internal_import.c index 96fe13bf6fc..cb145cc453b 100644 --- a/source/blender/python/generic/bpy_internal_import.c +++ b/source/blender/python/generic/bpy_internal_import.c @@ -34,9 +34,6 @@ #include <Python.h> #include <stddef.h> -#include "compile.h" /* for the PyCodeObject */ -#include "eval.h" /* for PyEval_EvalCode */ - #include "bpy_internal_import.h" #include "MEM_guardedalloc.h" @@ -51,7 +48,6 @@ /* UNUSED */ #include "BKE_text.h" /* txt_to_buf */ #include "BKE_main.h" -#include "BKE_global.h" /* grr, only for G.main->name */ static Main *bpy_import_main= NULL; @@ -97,7 +93,7 @@ void bpy_import_main_set(struct Main *maggie) /* returns a dummy filename for a textblock so we can tell what file a text block comes from */ void bpy_text_filename_get(char *fn, size_t fn_len, Text *text) { - BLI_snprintf(fn, fn_len, "%s%c%s", text->id.lib ? text->id.lib->filepath : G.main->name, SEP, text->id.name+2); + BLI_snprintf(fn, fn_len, "%s%c%s", text->id.lib ? text->id.lib->filepath : bpy_import_main->name, SEP, text->id.name+2); } PyObject *bpy_text_import(Text *text) diff --git a/source/blender/python/generic/bpy_internal_import.h b/source/blender/python/generic/bpy_internal_import.h index 0ef31229f8d..dd1596efe4e 100644 --- a/source/blender/python/generic/bpy_internal_import.h +++ b/source/blender/python/generic/bpy_internal_import.h @@ -59,7 +59,7 @@ void bpy_text_filename_get(char *fn, size_t fn_len, struct Text *text); extern PyMethodDef bpy_import_meth; extern PyMethodDef bpy_reload_meth; -/* The game engine has its own Main struct, if this is set search this rather then G.main */ +/* The game engine has its own Main struct, if this is set search this rather than G.main */ struct Main *bpy_import_main_get(void); void bpy_import_main_set(struct Main *maggie); diff --git a/source/blender/python/intern/bpy_rna.c b/source/blender/python/intern/bpy_rna.c index c4b6e0dfb76..72d391fed32 100644 --- a/source/blender/python/intern/bpy_rna.c +++ b/source/blender/python/intern/bpy_rna.c @@ -3101,7 +3101,7 @@ static PyObject *pyrna_struct_meta_idprop_getattro(PyObject *cls, PyObject *attr * >>> bpy.types.Scene.foo= BoolProperty() * >>> bpy.types.Scene.foo * <bpy_struct, BooleanProperty("foo")> - * ...rather then returning the deferred class register tuple as checked by pyrna_is_deferred_prop() + * ...rather than returning the deferred class register tuple as checked by pyrna_is_deferred_prop() * * Disable for now, this is faking internal behavior in a way thats too tricky to maintain well. */ #if 0 @@ -5517,7 +5517,7 @@ PyObject *BPY_rna_module(void) BPy_StructRNA *pyrna; PointerRNA ptr; - /* for now, return the base RNA type rather then a real module */ + /* for now, return the base RNA type rather than a real module */ RNA_main_pointer_create(G.main, &ptr); pyrna= (BPy_StructRNA *)pyrna_struct_CreatePyObject(&ptr); @@ -5537,7 +5537,7 @@ PyObject *BPY_rna_doc(void) { PointerRNA ptr; - /* for now, return the base RNA type rather then a real module */ + /* for now, return the base RNA type rather than a real module */ RNA_blender_rna_pointer_create(&ptr); return pyrna_struct_CreatePyObject(&ptr); @@ -5882,7 +5882,6 @@ static int bpy_class_validate(PointerRNA *dummyptr, void *py_data, int *have_fun PyObject *py_class= (PyObject*)py_data; PyObject *base_class= RNA_struct_py_type_get(srna); PyObject *item; - PyObject *py_arg_count; int i, flag, arg_count, func_arg_count; const char *py_class_name= ((PyTypeObject *)py_class)->tp_name; // __name__ @@ -5945,9 +5944,7 @@ static int bpy_class_validate(PointerRNA *dummyptr, void *py_data, int *have_fun func_arg_count= rna_function_arg_count(func); if (func_arg_count >= 0) { /* -1 if we dont care*/ - py_arg_count= PyObject_GetAttrString(PyFunction_GET_CODE(item), "co_argcount"); - arg_count= PyLong_AsLong(py_arg_count); - Py_DECREF(py_arg_count); + arg_count= ((PyCodeObject *)PyFunction_GET_CODE(item))->co_argcount; /* note, the number of args we check for and the number of args we give to * @classmethods are different (quirk of python), this is why rna_function_arg_count() doesn't return the value -1*/ diff --git a/source/blender/python/intern/bpy_rna.h b/source/blender/python/intern/bpy_rna.h index 28459677b32..ea8af61c9bf 100644 --- a/source/blender/python/intern/bpy_rna.h +++ b/source/blender/python/intern/bpy_rna.h @@ -44,7 +44,7 @@ /* support for inter references, currently only needed for corner case */ #define USE_PYRNA_STRUCT_REFERENCE -/* use real collection iterators rather then faking with a list */ +/* use real collection iterators rather than faking with a list */ #define USE_PYRNA_ITER #else /* WITH_PYTHON_SAFETY */ diff --git a/source/blender/render/intern/source/shadeinput.c b/source/blender/render/intern/source/shadeinput.c index e575776ec79..77141d9b445 100644 --- a/source/blender/render/intern/source/shadeinput.c +++ b/source/blender/render/intern/source/shadeinput.c @@ -633,14 +633,14 @@ void shade_input_calc_viewco(ShadeInput *shi, float x, float y, float z, float * dxco[0]= fx; dxco[1]= 0.0f; if(shi->facenor[2]!=0.0f) - dxco[2]= (shi->facenor[0]*fx)/shi->facenor[2]; + dxco[2]= -(shi->facenor[0]*fx)/shi->facenor[2]; else dxco[2]= 0.0f; dyco[0]= 0.0f; dyco[1]= fy; if(shi->facenor[2]!=0.0f) - dyco[2]= (shi->facenor[1]*fy)/shi->facenor[2]; + dyco[2]= -(shi->facenor[1]*fy)/shi->facenor[2]; else dyco[2]= 0.0f; diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c index e03d32ee7c8..9038e50320b 100644 --- a/source/blender/windowmanager/intern/wm_operators.c +++ b/source/blender/windowmanager/intern/wm_operators.c @@ -686,7 +686,7 @@ static void operator_enum_search_cb(const struct bContext *C, void *arg_ot, cons RNA_property_enum_items((bContext *)C, &ptr, prop, &item_array, NULL, &do_free); for(item= item_array; item->identifier; item++) { - /* note: need to give the intex rather then the dientifier because the enum can be freed */ + /* note: need to give the intex rather than the dientifier because the enum can be freed */ if(BLI_strcasestr(item->name, str)) if(0==uiSearchItemAdd(items, item->name, SET_INT_IN_POINTER(item->value), 0)) break; @@ -1460,7 +1460,7 @@ static void open_set_load_ui(wmOperator *op) static void open_set_use_scripts(wmOperator *op) { if(!RNA_property_is_set(op->ptr, "use_scripts")) { - /* use G_SCRIPT_AUTOEXEC rather then the userpref because this means if + /* use G_SCRIPT_AUTOEXEC rather than the userpref because this means if * the flag has been disabled from the command line, then opening * from the menu wont enable this setting. */ RNA_boolean_set(op->ptr, "use_scripts", (G.f & G_SCRIPT_AUTOEXEC)); diff --git a/source/creator/creator.c b/source/creator/creator.c index 016c461600c..6e9ecf234fc 100644 --- a/source/creator/creator.c +++ b/source/creator/creator.c @@ -1047,7 +1047,7 @@ static void setupArguments(bContext *C, bArgs *ba, SYS_SystemHandle *syshandle) static char debug_doc[] = "\n\tTurn debugging on\n" "\n\t* Prints every operator call and their arguments" "\n\t* Disables mouse grab (to interact with a debugger in some cases)" - "\n\t* Keeps python sys.stdin rather then setting it to None"; + "\n\t* Keeps python sys.stdin rather than setting it to None"; //BLI_argsAdd(ba, pass, short_arg, long_arg, doc, cb, C); diff --git a/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp b/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp index 59c5888ff35..13f0551d01b 100644 --- a/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp +++ b/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp @@ -250,13 +250,15 @@ extern "C" void StartKetsjiShell(struct bContext *C, struct ARegion *ar, rcti *c // some blender stuff float camzoom; + int draw_letterbox = 0; if(rv3d->persp==RV3D_CAMOB) { if(startscene->gm.framing.type == SCE_GAMEFRAMING_BARS) { /* Letterbox */ camzoom = 1.0f; + draw_letterbox = 1; } else { - camzoom = BKE_screen_view3d_zoom_to_fac(rv3d->camzoom); + camzoom = BKE_screen_view3d_zoom_to_fac(rv3d->camzoom)*4.0f; } } else { @@ -428,12 +430,15 @@ extern "C" void StartKetsjiShell(struct bContext *C, struct ARegion *ar, rcti *c // first check if we want to exit exitrequested = ketsjiengine->GetExitCode(); - // Clear screen to border color - // We do this here since we set the canvas to be within the frames. This means the engine - // itself is unaware of the extra space, so we clear the whole region for it. - glClearColor(scene->gm.framing.col[0], scene->gm.framing.col[1], scene->gm.framing.col[2], 1.0f); - glViewport(ar->winrct.xmin, ar->winrct.ymin, ar->winrct.xmax, ar->winrct.ymax); - glClear(GL_COLOR_BUFFER_BIT); + if(draw_letterbox) { + // Clear screen to border color + // We do this here since we set the canvas to be within the frames. This means the engine + // itself is unaware of the extra space, so we clear the whole region for it. + glClearColor(scene->gm.framing.col[0], scene->gm.framing.col[1], scene->gm.framing.col[2], 1.0f); + glViewport(ar->winrct.xmin, ar->winrct.ymin, + ar->winrct.xmax - ar->winrct.xmin, ar->winrct.ymax - ar->winrct.ymin); + glClear(GL_COLOR_BUFFER_BIT); + } // kick the engine bool render = ketsjiengine->NextFrame(); diff --git a/source/gameengine/Expressions/PyObjectPlus.cpp b/source/gameengine/Expressions/PyObjectPlus.cpp index c340d13b3d4..10906cdae02 100644 --- a/source/gameengine/Expressions/PyObjectPlus.cpp +++ b/source/gameengine/Expressions/PyObjectPlus.cpp @@ -179,7 +179,7 @@ PyObject * PyObjectPlus::py_base_new(PyTypeObject *type, PyObject *args, PyObjec return NULL; } - /* use base_type rather then Py_TYPE(base) because we could already be subtyped */ + /* use base_type rather than Py_TYPE(base) because we could already be subtyped */ if(!PyType_IsSubtype(type, base_type)) { PyErr_Format(PyExc_TypeError, "can't subclass blender game type <%s> from <%s> because it is not a subclass", base_type->tp_name, type->tp_name); return NULL; @@ -1198,14 +1198,13 @@ void PyDebugLine() f_lineno= PyObject_GetAttrString(frame, "f_lineno"); f_code= PyObject_GetAttrString(frame, "f_code"); if (f_lineno && f_code) { - co_filename= PyObject_GetAttrString(f_code, "co_filename"); + co_filename= ((PyCodeObject *)f_code)->co_filename; /* borrow */ if (co_filename) { printf("\t%s:%d\n", _PyUnicode_AsString(co_filename), (int)PyLong_AsSsize_t(f_lineno)); Py_DECREF(f_lineno); Py_DECREF(f_code); - Py_DECREF(co_filename); Py_DECREF(frame); return; } diff --git a/source/gameengine/GameLogic/SCA_PythonController.cpp b/source/gameengine/GameLogic/SCA_PythonController.cpp index d0c1155de96..19ddce13757 100644 --- a/source/gameengine/GameLogic/SCA_PythonController.cpp +++ b/source/gameengine/GameLogic/SCA_PythonController.cpp @@ -357,14 +357,7 @@ bool SCA_PythonController::Import() m_function_argc = 0; /* rare cases this could be a function that isnt defined in python, assume zero args */ if (PyFunction_Check(m_function)) { - PyObject *py_arg_count = PyObject_GetAttrString(PyFunction_GET_CODE(m_function), "co_argcount"); - if(py_arg_count) { - m_function_argc = PyLong_AsLong(py_arg_count); - Py_DECREF(py_arg_count); - } - else { - PyErr_Clear(); /* unlikely to fail but just incase */ - } + m_function_argc= ((PyCodeObject *)PyFunction_GET_CODE(m_function))->co_argcount; } if(m_function_argc > 1) { diff --git a/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp b/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp index 75181b6c330..7a98c7e09b0 100644 --- a/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp +++ b/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp @@ -62,7 +62,8 @@ extern "C" #include "BKE_global.h" #include "BKE_icons.h" #include "BKE_node.h" -#include "BKE_report.h" +#include "BKE_report.h" +#include "BKE_library.h" #include "BLI_blenlib.h" #include "DNA_scene_types.h" #include "DNA_userdef_types.h" @@ -404,6 +405,9 @@ int main(int argc, char** argv) initglobals(); + // We load our own G.main, so free the one that initglobals() gives us + free_main(G.main); + IMB_init(); // Setup builtin font for BLF (mostly copied from creator.c, wm_init_exit.c and interface_style.c) diff --git a/source/gameengine/Ketsji/KX_PyConstraintBinding.cpp b/source/gameengine/Ketsji/KX_PyConstraintBinding.cpp index bf288e1f1ad..12024657149 100644 --- a/source/gameengine/Ketsji/KX_PyConstraintBinding.cpp +++ b/source/gameengine/Ketsji/KX_PyConstraintBinding.cpp @@ -405,8 +405,13 @@ static PyObject* gPyCreateConstraint(PyObject* self, PyObject* args, PyObject* kwds) { - /* FIXME - physicsid is an int being cast to a pointer, should at least use PyCapsule */ - int physicsid=0,physicsid2 = 0,constrainttype=0,extrainfo=0; + /* FIXME - physicsid is a long being cast to a pointer, should at least use PyCapsule */ +#if defined(_WIN64) + __int64 physicsid=0,physicsid2 = 0; +#else + long physicsid=0,physicsid2 = 0; +#endif + int constrainttype=0, extrainfo=0; int len = PyTuple_Size(args); int success = 1; int flag = 0; @@ -414,27 +419,51 @@ static PyObject* gPyCreateConstraint(PyObject* self, float pivotX=1,pivotY=1,pivotZ=1,axisX=0,axisY=0,axisZ=1; if (len == 3) { - success = PyArg_ParseTuple(args,"iii",&physicsid,&physicsid2,&constrainttype); +#if defined(_WIN64) + success = PyArg_ParseTuple(args,"LLi",&physicsid,&physicsid2,&constrainttype); +#else + success = PyArg_ParseTuple(args,"lli",&physicsid,&physicsid2,&constrainttype); +#endif } else if (len ==6) { - success = PyArg_ParseTuple(args,"iiifff",&physicsid,&physicsid2,&constrainttype, +#if defined(_WIN64) + success = PyArg_ParseTuple(args,"LLifff",&physicsid,&physicsid2,&constrainttype, &pivotX,&pivotY,&pivotZ); +#else + success = PyArg_ParseTuple(args,"llifff",&physicsid,&physicsid2,&constrainttype, + &pivotX,&pivotY,&pivotZ); +#endif } else if (len == 9) { - success = PyArg_ParseTuple(args,"iiiffffff",&physicsid,&physicsid2,&constrainttype, +#if defined(_WIN64) + success = PyArg_ParseTuple(args,"LLiffffff",&physicsid,&physicsid2,&constrainttype, &pivotX,&pivotY,&pivotZ,&axisX,&axisY,&axisZ); +#else + success = PyArg_ParseTuple(args,"lliffffff",&physicsid,&physicsid2,&constrainttype, + &pivotX,&pivotY,&pivotZ,&axisX,&axisY,&axisZ); +#endif + } else if (len == 10) { - success = PyArg_ParseTuple(args,"iiiffffffi",&physicsid,&physicsid2,&constrainttype, +#if defined(_WIN64) + success = PyArg_ParseTuple(args,"LLiffffffi",&physicsid,&physicsid2,&constrainttype, &pivotX,&pivotY,&pivotZ,&axisX,&axisY,&axisZ,&flag); +#else + success = PyArg_ParseTuple(args,"lliffffffi",&physicsid,&physicsid2,&constrainttype, + &pivotX,&pivotY,&pivotZ,&axisX,&axisY,&axisZ,&flag); +#endif } else if (len==4) { - success = PyArg_ParseTuple(args,"iiii",&physicsid,&physicsid2,&constrainttype,&extrainfo); +#if defined(_WIN64) + success = PyArg_ParseTuple(args,"LLii",&physicsid,&physicsid2,&constrainttype,&extrainfo); +#else + success = PyArg_ParseTuple(args,"llii",&physicsid,&physicsid2,&constrainttype,&extrainfo); +#endif pivotX=extrainfo; } diff --git a/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp b/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp index 416cef71067..3f0c4cb95a1 100644 --- a/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp +++ b/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp @@ -939,7 +939,7 @@ int CcdPhysicsEnvironment::createUniversalD6Constraint( } else { // TODO: Implement single body case... - //No, we can use a fixed rigidbody in above code, rather then unnecessary duplation of code + //No, we can use a fixed rigidbody in above code, rather than unnecessary duplation of code } @@ -2271,7 +2271,7 @@ PHY_IPhysicsController* CcdPhysicsEnvironment::CreateSphereController(float radi cinfo.m_collisionShape = new btSphereShape(radius); // memory leak! The shape is not deleted by Bullet and we cannot add it to the KX_Scene.m_shapes list cinfo.m_MotionState = 0; cinfo.m_physicsEnv = this; - // declare this object as Dyamic rather then static!! + // declare this object as Dyamic rather than static!! // The reason as it is designed to detect all type of object, including static object // It would cause static-static message to be printed on the console otherwise cinfo.m_collisionFlags |= btCollisionObject::CF_NO_CONTACT_RESPONSE | btCollisionObject::CF_STATIC_OBJECT; diff --git a/source/gameengine/VideoTexture/CMakeLists.txt b/source/gameengine/VideoTexture/CMakeLists.txt index fb10b619f17..b544139d4a7 100644 --- a/source/gameengine/VideoTexture/CMakeLists.txt +++ b/source/gameengine/VideoTexture/CMakeLists.txt @@ -45,6 +45,7 @@ set(INC ../../../intern/string ../../../intern/moto/include ../../../intern/guardedalloc + ../../../intern/ffmpeg ${GLEW_INCLUDE_PATH} ) diff --git a/source/gameengine/VideoTexture/SConscript b/source/gameengine/VideoTexture/SConscript index 5091082e87a..b39a59e4504 100644 --- a/source/gameengine/VideoTexture/SConscript +++ b/source/gameengine/VideoTexture/SConscript @@ -13,6 +13,7 @@ incs += ' #source/blender/editors/include #source/blender/blenlib #source/blende incs += ' #source/blender/makesdna #source/blender/imbuf #source/blender/python #source/blender/python/generic' incs += ' #source/blender/gpu #intern/string #intern/moto/include' incs += ' #intern/guardedalloc #intern/container #extern/glew/include' +incs += ' #intern/ffmpeg' defs = [] if env['OURPLATFORM'] in ('win32-vc', 'win64-vc','win32-mingw'): diff --git a/source/gameengine/VideoTexture/VideoFFmpeg.h b/source/gameengine/VideoTexture/VideoFFmpeg.h index 70c7a840cb8..139b90dc463 100644 --- a/source/gameengine/VideoTexture/VideoFFmpeg.h +++ b/source/gameengine/VideoTexture/VideoFFmpeg.h @@ -31,20 +31,15 @@ http://www.gnu.org/copyleft/lesser.txt. extern "C" { #undef __cplusplus #include <pthread.h> -#include <libavformat/avformat.h> -#include <libavcodec/avcodec.h> -#include <libavutil/rational.h> -#if (LIBAVFORMAT_VERSION_MAJOR > 52) || ((LIBAVFORMAT_VERSION_MAJOR >= 52) && (LIBAVFORMAT_VERSION_MINOR >= 101)) -#include <libavutil/parseutils.h> -#endif -#include <libswscale/swscale.h> + +#include "ffmpeg_compat.h" + #include "DNA_listBase.h" #include "BLI_threads.h" #include "BLI_blenlib.h" #define __cplusplus } - #if LIBAVFORMAT_VERSION_INT < (49 << 16) #define FFMPEG_OLD_FRAME_RATE 1 #else |