diff options
144 files changed, 1460 insertions, 757 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 6eb8b8c0853..d6e6bf06f31 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -642,11 +642,7 @@ elseif(WIN32) set(GETTEXT ${LIBDIR}/gettext) set(GETTEXT_INC ${GETTEXT}/include) set(GETTEXT_LIBPATH ${GETTEXT}/lib) - if(CMAKE_CL_64) - set(GETTEXT_LIB gettext) - else() - set(GETTEXT_LIB gnu_gettext) - endif() + set(GETTEXT_LIB gnu_gettext) endif() if(CMAKE_CL_64) diff --git a/GNUmakefile b/GNUmakefile index 8446541cfae..7da60ce951b 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -126,6 +126,11 @@ help: @echo " * test_pep8 - checks all python script are pep8 which are tagged to use the stricter formatting" @echo " * test_deprecated - checks for deprecation tags in our code which may need to be removed" @echo "" + @echo "Static Source Code Checking (not assosiated with building blender)" + @echo " * check_cppcheck - run blender source through cppcheck (C & C++)" + @echo " * check_splint - run blenders source through splint (C only)" + @echo " * check_sparse - run blenders source through sparse (C only)" + @echo "" # ----------------------------------------------------------------------------- # Packages @@ -176,6 +181,20 @@ project_eclipse: cmake -G"Eclipse CDT4 - Unix Makefiles" -H$(BLENDER_DIR) -B$(BUILD_DIR) +# ----------------------------------------------------------------------------- +# Static Checking +# + +check_cppcheck: + cd $(BUILD_DIR) ; python3 $(BLENDER_DIR)/build_files/cmake/cmake_static_check_cppcheck.py + +check_splint: + cd $(BUILD_DIR) ; python3 $(BLENDER_DIR)/build_files/cmake/cmake_static_check_splint.py + +check_sparse: + cd $(BUILD_DIR) ; python3 $(BLENDER_DIR)/build_files/cmake/cmake_static_check_sparse.py + + clean: $(MAKE) -C $(BUILD_DIR) clean diff --git a/SConstruct b/SConstruct index 2531872af6c..06e6fe3473d 100644 --- a/SConstruct +++ b/SConstruct @@ -645,7 +645,7 @@ else: if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'win64-vc', 'linuxcross'): dllsources = [] - if not env['OURPLATFORM'] in ('win32-mingw', 'win64-vc', 'linuxcross'): + if not env['OURPLATFORM'] in ('win32-mingw', 'linuxcross'): # For MinGW and linuxcross static linking will be used dllsources += ['${LCGDIR}/gettext/lib/gnu_gettext.dll'] diff --git a/build_files/cmake/cmake_static_check_cppcheck.py b/build_files/cmake/cmake_static_check_cppcheck.py new file mode 100644 index 00000000000..f6d46904794 --- /dev/null +++ b/build_files/cmake/cmake_static_check_cppcheck.py @@ -0,0 +1,76 @@ +#!/usr/bin/env python + +# $Id$ +# ***** BEGIN GPL LICENSE BLOCK ***** +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software Foundation, +# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +# +# Contributor(s): Campbell Barton +# +# ***** END GPL LICENSE BLOCK ***** + +# <pep8 compliant> + +import project_source_info +import subprocess +import sys +import os + +CHECKER_IGNORE_PREFIX = [ + "extern", + "intern/moto", + ] + +CHECKER_BIN = "cppcheck" + +CHECKER_ARGS = [ + # not sure why this is needed, but it is. + "-I" + os.path.join(project_source_info.SOURCE_DIR, "extern/glew/include"), + + # "--check-config", # when includes are missing + # "--enable=all", # if you want sixty hundred pedantic suggestions + ] + +def main(): + source_info = project_source_info.build_info(ignore_prefix_list=CHECKER_IGNORE_PREFIX) + + check_commands = [] + for c, inc_dirs, defs in source_info: + cmd = ([CHECKER_BIN] + + CHECKER_ARGS + + [c] + + [("-I%s" % i) for i in inc_dirs] + + [("-D%s" % d) for d in defs] + ) + + check_commands.append((c, cmd)) + + for i, (c, cmd) in enumerate(check_commands): + percent = 100.0 * (i / (len(check_commands)-1)) + percent_str = "[" + ("%.2f]" % percent).rjust(7) + " %:" + + # if percent < 27.9: + # continue + + # let cppcheck finish the line off... + sys.stdout.write("%s " % percent_str) + + sys.stdout.flush() + process = subprocess.Popen(cmd) + process.wait() + + +if __name__ == "__main__": + main() diff --git a/build_files/cmake/cmake_static_check_sparse.py b/build_files/cmake/cmake_static_check_sparse.py new file mode 100644 index 00000000000..9af53ed8008 --- /dev/null +++ b/build_files/cmake/cmake_static_check_sparse.py @@ -0,0 +1,66 @@ +#!/usr/bin/env python + +# $Id$ +# ***** BEGIN GPL LICENSE BLOCK ***** +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software Foundation, +# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +# +# Contributor(s): Campbell Barton +# +# ***** END GPL LICENSE BLOCK ***** + +# <pep8 compliant> + +CHECKER_IGNORE_PREFIX = [ + "extern", + "intern/moto", + ] + +CHECKER_BIN = "sparse" +CHECKER_ARGS = [ + ] + +import project_source_info +import subprocess +import sys + + +def main(): + source_info = project_source_info.build_info(use_cxx=False, ignore_prefix_list=CHECKER_IGNORE_PREFIX) + + check_commands = [] + for c, inc_dirs, defs in source_info: + + cmd = ([CHECKER_BIN] + + CHECKER_ARGS + + [c] + + [("-I%s" % i) for i in inc_dirs] + + [("-D%s" % d) for d in defs] + ) + + check_commands.append((c, cmd)) + + for i, (c, cmd) in enumerate(check_commands): + percent = 100.0 * (i / (len(check_commands) - 1)) + percent_str = "[" + ("%.2f]" % percent).rjust(7) + " %:" + + sys.stdout.write("%s %s\n" % (percent_str, c)) + sys.stdout.flush() + + process = subprocess.Popen(cmd) + process.wait() + +if __name__ == "__main__": + main() diff --git a/build_files/cmake/cmake_static_check_splint.py b/build_files/cmake/cmake_static_check_splint.py new file mode 100644 index 00000000000..7827d3a5120 --- /dev/null +++ b/build_files/cmake/cmake_static_check_splint.py @@ -0,0 +1,94 @@ +#!/usr/bin/env python + +# $Id$ +# ***** BEGIN GPL LICENSE BLOCK ***** +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software Foundation, +# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +# +# Contributor(s): Campbell Barton +# +# ***** END GPL LICENSE BLOCK ***** + +# <pep8 compliant> + +CHECKER_IGNORE_PREFIX = [ + "extern", + "intern/moto", + ] + +CHECKER_BIN = "splint" + +CHECKER_ARGS = [ + "-weak", + "-posix-lib", + "-linelen", "10000", + "+ignorequals", + "+relaxtypes", + "-retvalother", + "+matchanyintegral", + "+longintegral", + "+ignoresigns", + "-nestcomment", + "-predboolothers", + "-ifempty", + "-unrecogcomments", + + # we may want to remove these later + "-type", + "-fixedformalarray", + "-fullinitblock", + "-fcnuse", + "-initallelements", + "-castfcnptr", + # -forcehints, + "-bufferoverflowhigh", # warns a lot about sprintf() + + # re-definitions, rna causes most of these + "-redef", + "-syntax", + ] + + +import project_source_info +import subprocess +import sys + + +def main(): + source_info = project_source_info.build_info(use_cxx=False, ignore_prefix_list=CHECKER_IGNORE_PREFIX) + + check_commands = [] + for c, inc_dirs, defs in source_info: + cmd = ([CHECKER_BIN] + + CHECKER_ARGS + + [c] + + [("-I%s" % i) for i in inc_dirs] + + [("-D%s" % d) for d in defs] + ) + + check_commands.append((c, cmd)) + + for i, (c, cmd) in enumerate(check_commands): + percent = 100.0 * (i / (len(check_commands) - 1)) + percent_str = "[" + ("%.2f]" % percent).rjust(7) + " %:" + + sys.stdout.write("%s %s\n" % (percent_str, c)) + sys.stdout.flush() + + process = subprocess.Popen(cmd) + process.wait() + +if __name__ == "__main__": + main() diff --git a/build_files/cmake/project_source_info.py b/build_files/cmake/project_source_info.py new file mode 100644 index 00000000000..c4b83d20ea5 --- /dev/null +++ b/build_files/cmake/project_source_info.py @@ -0,0 +1,165 @@ +# $Id$ +# ***** BEGIN GPL LICENSE BLOCK ***** +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software Foundation, +# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +# +# Contributor(s): Campbell Barton +# +# ***** END GPL LICENSE BLOCK ***** + +# <pep8 compliant> + +__all__ = ( + "build_info", + "SOURCE_DIR", + ) + +import os +import sys +from os.path import join, dirname, normpath, abspath + +SOURCE_DIR = join(dirname(__file__), "..", "..") +SOURCE_DIR = normpath(SOURCE_DIR) +SOURCE_DIR = abspath(SOURCE_DIR) + + +def is_c_header(filename): + ext = os.path.splitext(filename)[1] + return (ext in (".h", ".hpp", ".hxx")) + + +def is_c_header(filename): + ext = os.path.splitext(filename)[1] + return (ext in (".h", ".hpp", ".hxx")) + + +def is_c(filename): + ext = os.path.splitext(filename)[1] + return (ext in (".c", ".cpp", ".cxx", ".m", ".mm", ".rc")) + + +def is_c_any(filename): + return os.path.s_c(filename) or is_c_header(filename) + + +# copied from project_info.py +CMAKE_DIR = "." + + +def cmake_cache_var(var): + cache_file = open(join(CMAKE_DIR, "CMakeCache.txt")) + lines = [l_strip for l in cache_file for l_strip in (l.strip(),) if l_strip if not l_strip.startswith("//") if not l_strip.startswith("#")] + cache_file.close() + + for l in lines: + if l.split(":")[0] == var: + return l.split("=", 1)[-1] + return None + + +def do_ignore(filepath, ignore_prefix_list): + if ignore_prefix_list is None: + return False + + relpath = os.path.relpath(filepath, SOURCE_DIR) + return any([relpath.startswith(prefix) for prefix in ignore_prefix_list]) + + +def makefile_log(): + import subprocess + # Check blender is not 2.5x until it supports playback again + print("running make with --dry-run ...") + process = subprocess.Popen(["make", "--always-make", "--dry-run", "--keep-going", "VERBOSE=1"], + stdout=subprocess.PIPE, + ) + + while process.poll(): + time.sleep(1) + + out = process.stdout.read() + process.stdout.close() + print("done!", len(out), "bytes") + return out.decode("ascii").split("\n") + + +def build_info(use_c=True, use_cxx=True, ignore_prefix_list=None): + + makelog = makefile_log() + + source = [] + + compilers = [] + if use_c: + compilers.append(cmake_cache_var("CMAKE_C_COMPILER")) + if use_cxx: + compilers.append(cmake_cache_var("CMAKE_CXX_COMPILER")) + + print("compilers:", " ".join(compilers)) + + fake_compiler = "%COMPILER%" + + print("parsing make log ...") + + for line in makelog: + + args = line.split() + + if not any([(c in args) for c in compilers]): + continue + + # join args incase they are not. + args = ' '.join(args) + args = args.replace(" -isystem", " -I") + args = args.replace(" -D ", " -D") + args = args.replace(" -I ", " -I") + + for c in compilers: + args = args.replace(c, fake_compiler) + args = args.split() + # end + + # remove compiler + args[:args.index(fake_compiler) + 1] = [] + + c_files = [f for f in args if is_c(f)] + inc_dirs = [f[2:].strip() for f in args if f.startswith('-I')] + defs = [f[2:].strip() for f in args if f.startswith('-D')] + for c in sorted(c_files): + + if do_ignore(c, ignore_prefix_list): + continue + + source.append((c, inc_dirs, defs)) + + # safety check that our includes are ok + for f in inc_dirs: + if not os.path.exists(f): + raise Exception("%s missing" % f) + + print("done!") + + return source + + +def main(): + if not os.path.exists(join(CMAKE_DIR, "CMakeCache.txt")): + print("This script must run from the cmake build dir") + return + + for s in build_info(): + print(s) + +if __name__ == "__main__": + main() diff --git a/build_files/scons/config/win64-vc-config.py b/build_files/scons/config/win64-vc-config.py index ba9633a6b4c..3e22e9a634f 100644 --- a/build_files/scons/config/win64-vc-config.py +++ b/build_files/scons/config/win64-vc-config.py @@ -100,7 +100,7 @@ WITH_BF_INTERNATIONAL = False BF_GETTEXT = LIBDIR + '/gettext' BF_GETTEXT_INC = '${BF_GETTEXT}/include' -BF_GETTEXT_LIB = 'gettext' +BF_GETTEXT_LIB = 'gnu_gettext' BF_GETTEXT_LIBPATH = '${BF_GETTEXT}/lib' WITH_BF_GAMEENGINE = True diff --git a/doc/python_api/examples/bpy.types.ID.user_clear.1.py b/doc/python_api/examples/bpy.types.ID.user_clear.1.py index 68c35caa7d4..239ed41c66c 100644 --- a/doc/python_api/examples/bpy.types.ID.user_clear.1.py +++ b/doc/python_api/examples/bpy.types.ID.user_clear.1.py @@ -1,6 +1,4 @@ """ -User Clear -++++++++++ This function is for advanced use only, misuse can crash blender since the user count is used to prevent data being removed when it is used. """ diff --git a/doc/python_api/rst/info_tips_and_tricks.rst b/doc/python_api/rst/info_tips_and_tricks.rst index 2bcb1e74c84..f88be5de3a8 100644 --- a/doc/python_api/rst/info_tips_and_tricks.rst +++ b/doc/python_api/rst/info_tips_and_tricks.rst @@ -24,6 +24,14 @@ There are 3 main uses for the terminal, these are: For Linux and OSX users this means starting the terminal first, then running blender from within it. On Windows the terminal can be enabled from the help menu. +Show All Operators +================== + +While blender logs operators in the Info space, this only reports operators with the ``REGISTER`` option enabeld so as not to flood the Info view with calls to ``bpy.ops.view3d.smoothview`` and ``bpy.ops.view3d.zoom``. + +However, for testing it can be useful to see **every** operator called in a terminal, do this by enabling the debug option either by passing the ``--debug`` argument when starting blender or by setting :mod:`bpy.app.debug` to True while blender is running. + + Use an External Editor ====================== diff --git a/doc/python_api/sphinx_doc_gen.py b/doc/python_api/sphinx_doc_gen.py index ac2a498efc2..91248c08406 100644 --- a/doc/python_api/sphinx_doc_gen.py +++ b/doc/python_api/sphinx_doc_gen.py @@ -76,7 +76,7 @@ else: "bpy.props", "bpy.utils", "bpy.context", - "bpy.types", # supports filtering + # "bpy.types", # supports filtering "bpy.ops", # supports filtering "bpy_extras", "bge", @@ -87,7 +87,7 @@ else: "mathutils.geometry", ) - FILTER_BPY_TYPES = ("bpy_struct", "Panel", "ID") # allow + FILTER_BPY_TYPES = ("bpy_struct", "Operator", "ID") # allow FILTER_BPY_OPS = ("import.scene", ) # allow # for quick rebuilds @@ -621,6 +621,30 @@ def pycontext2sphinx(BASEPATH): file.close() +def pyrna_enum2sphinx(prop, use_empty_descriptions=False): + """ write a bullet point list of enum + descrptons + """ + + if use_empty_descriptions: + ok = True + else: + ok = False + for identifier, name, description in prop.enum_items: + if description: + ok = True + break + + if ok: + return "".join(["* ``%s`` %s.\n" % + (identifier, + ", ".join(val for val in (name, description) if val), + ) + for identifier, name, description in prop.enum_items + ]) + else: + return "" + + def pyrna2sphinx(BASEPATH): """ bpy.types and bpy.ops """ @@ -648,8 +672,22 @@ def pyrna2sphinx(BASEPATH): kwargs["collection_id"] = _BPY_PROP_COLLECTION_ID type_descr = prop.get_type_description(**kwargs) - if prop.name or prop.description: - fw(ident + ":%s%s: %s\n" % (id_name, identifier, ", ".join(val for val in (prop.name, prop.description) if val))) + + enum_text = pyrna_enum2sphinx(prop) + + if prop.name or prop.description or enum_text: + fw(ident + ":%s%s:\n\n" % (id_name, identifier)) + + if prop.name or prop.description: + fw(ident + " " + ", ".join(val for val in (prop.name, prop.description) if val) + "\n\n") + + # special exception, cant use genric code here for enums + if enum_text: + write_indented_lines(ident + " ", fw, enum_text) + fw("\n") + del enum_text + # end enum exception + fw(ident + ":%s%s: %s\n" % (id_type, identifier, type_descr)) def write_struct(struct): @@ -727,6 +765,16 @@ def pyrna2sphinx(BASEPATH): fw(" .. attribute:: %s\n\n" % prop.identifier) if prop.description: fw(" %s\n\n" % prop.description) + + # special exception, cant use genric code here for enums + if prop.type == "enum": + enum_text = pyrna_enum2sphinx(prop) + if enum_text: + write_indented_lines(" ", fw, enum_text) + fw("\n") + del enum_text + # end enum exception + fw(" :type: %s\n\n" % type_descr) # python attributes @@ -750,6 +798,7 @@ def pyrna2sphinx(BASEPATH): elif func.return_values: # multiple return values fw(" :return (%s):\n" % ", ".join(prop.identifier for prop in func.return_values)) for prop in func.return_values: + # TODO, pyrna_enum2sphinx for multiple return values... actually dont think we even use this but still!!! type_descr = prop.get_type_description(as_ret=True, class_fmt=":class:`%s`", collection_id=_BPY_PROP_COLLECTION_ID) descr = prop.description if not descr: diff --git a/doc/python_api/sphinx_doc_gen.sh b/doc/python_api/sphinx_doc_gen.sh index ea55fbb3907..307476d9a92 100755 --- a/doc/python_api/sphinx_doc_gen.sh +++ b/doc/python_api/sphinx_doc_gen.sh @@ -9,6 +9,10 @@ # disable for testing DO_UPLOAD=true +DO_EXE_BLENDER=true +DO_OUT_HTML=true +DO_OUT_PDF=true + BLENDER="./blender.bin" SSH_USER="ideasman42" @@ -36,28 +40,39 @@ fi SSH_UPLOAD_FULL=$SSH_UPLOAD/"blender_python_api_"$BLENDER_VERSION -SPHINXBASE=doc/python_api/ +SPHINXBASE=doc/python_api # ---------------------------------------------------------------------------- # Generate reStructuredText (blender/python only) -# dont delete existing docs, now partial updates are used for quick builds. -$BLENDER --background --factory-startup --python $SPHINXBASE/sphinx_doc_gen.py +if $DO_EXE_BLENDER ; then + # dont delete existing docs, now partial updates are used for quick builds. + $BLENDER --background --factory-startup --python $SPHINXBASE/sphinx_doc_gen.py +fi # ---------------------------------------------------------------------------- # Generate HTML (sphinx) -sphinx-build -n -b html $SPHINXBASE/sphinx-in $SPHINXBASE/sphinx-out +if $DO_OUT_HTML ; then + # sphinx-build -n -b html $SPHINXBASE/sphinx-in $SPHINXBASE/sphinx-out + + # annoying bug in sphinx makes it very slow unless we do this. should report. + cd $SPHINXBASE + sphinx-build -n -b html sphinx-in sphinx-out + cd - +fi # ---------------------------------------------------------------------------- # Generate PDF (sphinx/laytex) -sphinx-build -n -b latex $SPHINXBASE/sphinx-in $SPHINXBASE/sphinx-out -make -C $SPHINXBASE/sphinx-out -mv $SPHINXBASE/sphinx-out/contents.pdf $SPHINXBASE/sphinx-out/blender_python_reference_$BLENDER_VERSION.pdf +if $DO_OUT_PDF ; then + sphinx-build -n -b latex $SPHINXBASE/sphinx-in $SPHINXBASE/sphinx-out + make -C $SPHINXBASE/sphinx-out + mv $SPHINXBASE/sphinx-out/contents.pdf $SPHINXBASE/sphinx-out/blender_python_reference_$BLENDER_VERSION.pdf +fi # ---------------------------------------------------------------------------- # Upload to blender servers, comment this section for testing @@ -85,5 +100,5 @@ fi echo "" echo "Finished! view the docs from: " -echo " html:" $SPHINXBASE/sphinx-out/contents.html -echo " pdf:" $SPHINXBASE/sphinx-out/blender_python_reference_$BLENDER_VERSION.pdf +if $DO_OUT_HTML ; then echo " html:" $SPHINXBASE/sphinx-out/contents.html ; fi +if $DO_OUT_PDF ; then echo " pdf:" $SPHINXBASE/sphinx-out/blender_python_reference_$BLENDER_VERSION.pdf ; fi diff --git a/extern/recastnavigation/Recast/Source/RecastMeshDetail.cpp b/extern/recastnavigation/Recast/Source/RecastMeshDetail.cpp index f1d2113a8c7..55ba28ae7cf 100644 --- a/extern/recastnavigation/Recast/Source/RecastMeshDetail.cpp +++ b/extern/recastnavigation/Recast/Source/RecastMeshDetail.cpp @@ -94,31 +94,12 @@ static int circumCircle(const float xp, const float yp, return (drsqr <= rsqr) ? 1 : 0; } -#ifdef FREE_WINDOWS -static float *_mingw_verts; + +static float *_qsort_verts; static int ptcmp(const void *v1, const void *v2) { - const float* p1 = &_mingw_verts[(*(const int*)v1)*3]; - const float* p2 = &_mingw_verts[(*(const int*)v2)*3]; - if (p1[0] < p2[0]) - return -1; - else if (p1[0] > p2[0]) - return 1; - else - return 0; -} -#else -#if defined(_MSC_VER) -static int ptcmp(void* up, const void *v1, const void *v2) -#elif defined(__APPLE__) || defined(__FreeBSD__) -static int ptcmp(void* up, const void *v1, const void *v2) -#else -static int ptcmp(const void *v1, const void *v2, void* up) -#endif -{ - const float* verts = (const float*)up; - const float* p1 = &verts[(*(const int*)v1)*3]; - const float* p2 = &verts[(*(const int*)v2)*3]; + const float* p1 = &_qsort_verts[(*(const int*)v1)*3]; + const float* p2 = &_qsort_verts[(*(const int*)v2)*3]; if (p1[0] < p2[0]) return -1; else if (p1[0] > p2[0]) @@ -126,7 +107,6 @@ static int ptcmp(const void *v1, const void *v2, void* up) else return 0; } -#endif // Based on Paul Bourke's triangulate.c // http://astronomy.swin.edu.au/~pbourke/terrain/triangulate/triangulate.c @@ -136,16 +116,8 @@ static void delaunay(const int nv, float *verts, rcIntArray& idx, rcIntArray& tr idx.resize(nv); for (int i = 0; i < nv; ++i) idx[i] = i; -#if defined(_MSC_VER) - qsort_s(&idx[0], idx.size(), sizeof(int), ptcmp, verts); -#elif defined(__APPLE__) || defined(__FreeBSD__) - qsort_r(&idx[0], idx.size(), sizeof(int), verts, ptcmp); -#elif defined(FREE_WINDOWS) - _mingw_verts = verts; + _qsort_verts = verts; qsort(&idx[0], idx.size(), sizeof(int), ptcmp); -#else - qsort_r(&idx[0], idx.size(), sizeof(int), ptcmp, verts); -#endif // Find the maximum and minimum vertex bounds. // This is to allow calculation of the bounding triangle diff --git a/release/scripts/modules/rna_info.py b/release/scripts/modules/rna_info.py index 943f86adecb..d95c3920cf9 100644 --- a/release/scripts/modules/rna_info.py +++ b/release/scripts/modules/rna_info.py @@ -207,7 +207,7 @@ class InfoPropertyRNA: self.fixed_type = None if self.type == "enum": - self.enum_items[:] = rna_prop.enum_items.keys() + self.enum_items[:] = [(item.identifier, item.name, item.description) for item in rna_prop.enum_items] self.is_enum_flag = rna_prop.is_enum_flag else: self.is_enum_flag = False @@ -264,9 +264,9 @@ class InfoPropertyRNA: type_str += " in [%s, %s]" % (range_str(self.min), range_str(self.max)) elif self.type == "enum": if self.is_enum_flag: - type_str += " set in {%s}" % ", ".join(("'%s'" % s) for s in self.enum_items) + type_str += " set in {%s}" % ", ".join(("'%s'" % s[0]) for s in self.enum_items) else: - type_str += " in [%s]" % ", ".join(("'%s'" % s) for s in self.enum_items) + type_str += " in [%s]" % ", ".join(("'%s'" % s[0]) for s in self.enum_items) if not (as_arg or as_ret): # write default property, ignore function args for this diff --git a/source/blender/blenfont/intern/blf.c b/source/blender/blenfont/intern/blf.c index fc812d652b3..577697de594 100644 --- a/source/blender/blenfont/intern/blf.c +++ b/source/blender/blenfont/intern/blf.c @@ -486,6 +486,13 @@ static void blf_draw__start(FontBLF *font) if (font->flags & BLF_ROTATION) glRotatef(font->angle, 0.0f, 0.0f, 1.0f); + + if(font->shadow || font->blur) + glGetFloatv(GL_CURRENT_COLOR, font->orig_col); + + /* always bind the texture for the first glyph */ + font->tex_bind_state= -1; + } static void blf_draw__end(void) diff --git a/source/blender/blenfont/intern/blf_font.c b/source/blender/blenfont/intern/blf_font.c index 8a71c3de86b..3bec7dd2626 100644 --- a/source/blender/blenfont/intern/blf_font.c +++ b/source/blender/blenfont/intern/blf_font.c @@ -99,9 +99,10 @@ void blf_font_size(FontBLF *font, int size, int dpi) static void blf_font_ensure_ascii_table(FontBLF *font) { + GlyphBLF **glyph_ascii_table= font->glyph_cache->glyph_ascii_table; + /* build ascii on demand */ - if(font->glyph_cache->glyph_ascii_table['0']==NULL) { - GlyphBLF **glyph_ascii_table= font->glyph_cache->glyph_ascii_table; + if(glyph_ascii_table['0']==NULL) { GlyphBLF *g; unsigned int i; for(i=0; i<256; i++) { @@ -125,7 +126,7 @@ static void blf_font_ensure_ascii_table(FontBLF *font) #define BLF_UTF8_NEXT_FAST(font, g, str, i, c, glyph_ascii_table) \ if(((c)= (str)[i]) < 0x80) { \ - g= glyph_ascii_table[c]; \ + g= (glyph_ascii_table)[c]; \ i++; \ } \ else if ((c= blf_utf8_next((unsigned char *)(str), &(i)))) { \ @@ -212,7 +213,7 @@ void blf_font_draw_ascii(FontBLF *font, const char *str, unsigned int len) blf_font_ensure_ascii_table(font); while ((c= *(str++)) && len--) { - g= font->glyph_cache->glyph_ascii_table[c]; + g= glyph_ascii_table[c]; /* if we don't found a glyph, skip it. */ if (!g) @@ -401,7 +402,6 @@ void blf_font_boundbox(FontBLF *font, const char *str, rctf *box) if (!font->glyph_cache) return; - glyph_ascii_table= font->glyph_cache->glyph_ascii_table; box->xmin= 32000.0f; box->xmax= -32000.0f; @@ -415,6 +415,7 @@ void blf_font_boundbox(FontBLF *font, const char *str, rctf *box) g_prev= NULL; blf_font_ensure_ascii_table(font); + glyph_ascii_table= font->glyph_cache->glyph_ascii_table; while (str[i]) { diff --git a/source/blender/blenfont/intern/blf_glyph.c b/source/blender/blenfont/intern/blf_glyph.c index 9b39cb65cba..7a1fa8c80b0 100644 --- a/source/blender/blenfont/intern/blf_glyph.c +++ b/source/blender/blenfont/intern/blf_glyph.c @@ -185,7 +185,7 @@ static void blf_glyph_cache_texture(FontBLF *font, GlyphCacheBLF *gc) memset((void *)buf, 0, tot_mem); glGenTextures(1, &gc->textures[gc->cur_tex]); - glBindTexture(GL_TEXTURE_2D, gc->textures[gc->cur_tex]); + glBindTexture(GL_TEXTURE_2D, (font->tex_bind_state= gc->textures[gc->cur_tex])); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); @@ -326,23 +326,25 @@ static void blf_texture_draw(float uv[2][2], float dx, float y1, float dx1, floa } -static void blf_texture5_draw(float uv[2][2], float x1, float y1, float x2, float y2) +static void blf_texture5_draw(const float shadow_col[4], float uv[2][2], float x1, float y1, float x2, float y2) { - float soft[25]= { - 1/60.0f, 1/60.0f, 2/60.0f, 1/60.0f, 1/60.0f, - 1/60.0f, 3/60.0f, 5/60.0f, 3/60.0f, 1/60.0f, - 2/60.0f, 5/60.0f, 8/60.0f, 5/60.0f, 2/60.0f, - 1/60.0f, 3/60.0f, 5/60.0f, 3/60.0f, 1/60.0f, - 1/60.0f, 1/60.0f, 2/60.0f, 1/60.0f, 1/60.0f}; + float soft[25]= {1/60.0f, 1/60.0f, 2/60.0f, 1/60.0f, 1/60.0f, + 1/60.0f, 3/60.0f, 5/60.0f, 3/60.0f, 1/60.0f, + 2/60.0f, 5/60.0f, 8/60.0f, 5/60.0f, 2/60.0f, + 1/60.0f, 3/60.0f, 5/60.0f, 3/60.0f, 1/60.0f, + 1/60.0f, 1/60.0f, 2/60.0f, 1/60.0f, 1/60.0f}; float color[4], *fp= soft; int dx, dy; - - glGetFloatv(GL_CURRENT_COLOR, color); + + color[0]= shadow_col[0]; + color[1]= shadow_col[1]; + color[2]= shadow_col[2]; for(dx=-2; dx<3; dx++) { for(dy=-2; dy<3; dy++, fp++) { - glColor4f(color[0], color[1], color[2], fp[0]*color[3]); + color[3]= *(fp) * shadow_col[3]; + glColor4fv(color); blf_texture_draw(uv, x1+dx, y1+dy, x2+dx, y2+dy); } } @@ -350,17 +352,23 @@ static void blf_texture5_draw(float uv[2][2], float x1, float y1, float x2, floa glColor4fv(color); } -static void blf_texture3_draw(float uv[2][2], float x1, float y1, float x2, float y2) +static void blf_texture3_draw(const float shadow_col[4], float uv[2][2], float x1, float y1, float x2, float y2) { - float soft[9]= {1/16.0f, 2/16.0f, 1/16.0f, 2/16.0f, 4/16.0f, 2/16.0f, 1/16.0f, 2/16.0f, 1/16.0f}; + float soft[9]= {1/16.0f, 2/16.0f, 1/16.0f, + 2/16.0f,4/16.0f, 2/16.0f, + 1/16.0f, 2/16.0f, 1/16.0f}; + float color[4], *fp= soft; int dx, dy; - - glGetFloatv(GL_CURRENT_COLOR, color); - + + color[0]= shadow_col[0]; + color[1]= shadow_col[1]; + color[2]= shadow_col[2]; + for(dx=-1; dx<2; dx++) { for(dy=-1; dy<2; dy++, fp++) { - glColor4f(color[0], color[1], color[2], fp[0]*color[3]); + color[3]= *(fp) * shadow_col[3]; + glColor4fv(color); blf_texture_draw(uv, x1+dx, y1+dy, x2+dx, y2+dy); } } @@ -370,18 +378,15 @@ static void blf_texture3_draw(float uv[2][2], float x1, float y1, float x2, floa int blf_glyph_render(FontBLF *font, GlyphBLF *g, float x, float y) { - GlyphCacheBLF *gc; - GLint cur_tex; float dx, dx1; float y1, y2; float xo, yo; - float color[4]; if ((!g->width) || (!g->height)) return(1); if (g->build_tex == 0) { - gc= font->glyph_cache; + GlyphCacheBLF *gc= font->glyph_cache; if (font->max_tex_size == -1) glGetIntegerv(GL_MAX_TEXTURE_SIZE, (GLint *)&font->max_tex_size); @@ -453,22 +458,27 @@ int blf_glyph_render(FontBLF *font, GlyphBLF *g, float x, float y) return(0); } - glGetIntegerv(GL_TEXTURE_2D_BINDING_EXT, &cur_tex); - if (cur_tex != g->tex) - glBindTexture(GL_TEXTURE_2D, g->tex); + if (font->tex_bind_state != g->tex) { + glBindTexture(GL_TEXTURE_2D, (font->tex_bind_state= g->tex)); + } if (font->flags & BLF_SHADOW) { - glGetFloatv(GL_CURRENT_COLOR, color); - glColor4fv(font->shadow_col); - - if (font->shadow == 3) - blf_texture3_draw(g->uv, dx, y1, dx1, y2); - else if (font->shadow == 5) - blf_texture5_draw(g->uv, dx, y1, dx1, y2); - else - blf_texture_draw(g->uv, dx, y1, dx1, y2); - glColor4fv(color); + switch(font->shadow) { + case 3: + blf_texture3_draw(font->shadow_col, g->uv, dx, y1, dx1, y2); + break; + case 5: + blf_texture5_draw(font->shadow_col, g->uv, dx, y1, dx1, y2); + break; + default: + glColor4fv(font->shadow_col); + blf_texture_draw(g->uv, dx, y1, dx1, y2); + break; + } + + glColor4fv(font->orig_col); + x= xo; y= yo; @@ -478,12 +488,17 @@ int blf_glyph_render(FontBLF *font, GlyphBLF *g, float x, float y) y2= y + g->pos_y - g->height; } - if (font->blur==3) - blf_texture3_draw(g->uv, dx, y1, dx1, y2); - else if (font->blur==5) - blf_texture5_draw(g->uv, dx, y1, dx1, y2); - else - blf_texture_draw(g->uv, dx, y1, dx1, y2); + switch(font->blur) { + case 3: + blf_texture3_draw(font->orig_col, g->uv, dx, y1, dx1, y2); + break; + case 5: + blf_texture5_draw(font->orig_col, g->uv, dx, y1, dx1, y2); + break; + default: + blf_texture_draw(g->uv, dx, y1, dx1, y2); + break; + } return(1); } diff --git a/source/blender/blenfont/intern/blf_internal_types.h b/source/blender/blenfont/intern/blf_internal_types.h index 9840e6446ef..1450ad39ad8 100644 --- a/source/blender/blenfont/intern/blf_internal_types.h +++ b/source/blender/blenfont/intern/blf_internal_types.h @@ -161,7 +161,10 @@ typedef struct FontBLF { /* shadow color. */ float shadow_col[4]; - + + /* store color here when drawing shadow or blur. */ + float orig_col[4]; + /* Multiplied this matrix with the current one before * draw the text! see blf_draw__start. */ @@ -179,6 +182,9 @@ typedef struct FontBLF { /* max texture size. */ int max_tex_size; + /* current opengl texture bind, avoids calling glGet */ + int tex_bind_state; + /* font options. */ int flags; diff --git a/source/blender/blenkernel/intern/action.c b/source/blender/blenkernel/intern/action.c index 9c2467505cd..73ddcbecf94 100644 --- a/source/blender/blenkernel/intern/action.c +++ b/source/blender/blenkernel/intern/action.c @@ -117,7 +117,7 @@ static void make_localact_apply_cb(ID *id, AnimData *adt, void *mlac_ptr) tMakeLocalActionContext *mlac = (tMakeLocalActionContext *)mlac_ptr; if (adt->action == mlac->act) { - if (id->lib==0) { + if (id->lib == NULL) { adt->action = mlac->actn; id_us_plus(&mlac->actn->id); @@ -524,7 +524,6 @@ void copy_pose (bPose **dst, bPose *src, int copycon) if (copycon) { copy_constraints(&listb, &pchan->constraints, TRUE); // copy_constraints NULLs listb pchan->constraints= listb; - pchan->path= NULL; // XXX remove this line when the new motionpaths are ready... (depreceated code) pchan->mpath= NULL; /* motion paths should not get copied yet... */ } @@ -595,17 +594,12 @@ void free_pose_channels_hash(bPose *pose) void free_pose_channel(bPoseChannel *pchan) { - // XXX this case here will need to be removed when the new motionpaths are ready - if (pchan->path) { - MEM_freeN(pchan->path); - pchan->path= NULL; - } - + if (pchan->mpath) { animviz_free_motionpath(pchan->mpath); pchan->mpath= NULL; } - + free_constraints(&pchan->constraints); if (pchan->prop) { diff --git a/source/blender/blenkernel/intern/anim.c b/source/blender/blenkernel/intern/anim.c index 9ca11db7fce..824bbb8f70d 100644 --- a/source/blender/blenkernel/intern/anim.c +++ b/source/blender/blenkernel/intern/anim.c @@ -1143,11 +1143,11 @@ static void face_duplilist(ListBase *lb, ID *id, Scene *scene, Object *par, floa w= (mv4)? 0.25f: 1.0f/3.0f; if(orco) { - VECADDFAC(dob->orco, dob->orco, orco[mv1], w); - VECADDFAC(dob->orco, dob->orco, orco[mv2], w); - VECADDFAC(dob->orco, dob->orco, orco[mv3], w); + madd_v3_v3v3fl(dob->orco, dob->orco, orco[mv1], w); + madd_v3_v3v3fl(dob->orco, dob->orco, orco[mv2], w); + madd_v3_v3v3fl(dob->orco, dob->orco, orco[mv3], w); if(mv4) - VECADDFAC(dob->orco, dob->orco, orco[mv4], w); + madd_v3_v3v3fl(dob->orco, dob->orco, orco[mv4], w); } if(mtface) { diff --git a/source/blender/blenkernel/intern/armature.c b/source/blender/blenkernel/intern/armature.c index 3a14074d55b..4682c4ceee2 100644 --- a/source/blender/blenkernel/intern/armature.c +++ b/source/blender/blenkernel/intern/armature.c @@ -1483,7 +1483,6 @@ static void pose_proxy_synchronize(Object *ob, Object *from, int layer_protected pchanw.next= pchan->next; pchanw.parent= pchan->parent; pchanw.child= pchan->child; - pchanw.path= NULL; /* this is freed so copy a copy, else undo crashes */ if(pchanw.prop) { diff --git a/source/blender/blenkernel/intern/collision.c b/source/blender/blenkernel/intern/collision.c index e0b7ebe1f44..d8b51973948 100644 --- a/source/blender/blenkernel/intern/collision.c +++ b/source/blender/blenkernel/intern/collision.c @@ -2021,7 +2021,7 @@ static int cloth_collision_moving_edges ( ClothModifierData *clmd, CollisionModi { if(edgecollpair.p21==6 || edgecollpair.p22 == 6) { - printf("dist: %f, sol[k]: %lf, sol2[k]: %lf\n", distance, solution[k], solution2[k]); + printf("dist: %f, sol[k]: %f, sol2[k]: %f\n", distance, solution[k], solution2[k]); printf("a1: %f, a2: %f, b1: %f, b2: %f\n", x1[0], x2[0], x3[0], v1[0]); printf("b21: %d, b22: %d\n", edgecollpair.p21, edgecollpair.p22); } diff --git a/source/blender/blenkernel/intern/constraint.c b/source/blender/blenkernel/intern/constraint.c index 91091d3880f..a59092784dd 100644 --- a/source/blender/blenkernel/intern/constraint.c +++ b/source/blender/blenkernel/intern/constraint.c @@ -2167,7 +2167,7 @@ static void actcon_get_tarmat (bConstraint *con, bConstraintOb *cob, bConstraint if (data->type < 10) { /* extract rotation (is in whatever space target should be in) */ mat4_to_eul(vec, tempmat); - mul_v3_fl(vec, (float)(180.0/M_PI)); /* rad -> deg */ + mul_v3_fl(vec, RAD2DEGF(1.0f)); /* rad -> deg */ axis= data->type; } else if (data->type < 20) { @@ -3325,7 +3325,7 @@ static void transform_evaluate (bConstraint *con, bConstraintOb *cob, ListBase * break; case 1: /* rotation (convert to degrees first) */ mat4_to_eulO(dvec, cob->rotOrder, ct->matrix); - mul_v3_fl(dvec, (float)(180.0/M_PI)); /* rad -> deg */ + mul_v3_fl(dvec, RAD2DEGF(1.0f)); /* rad -> deg */ break; default: /* location */ copy_v3_v3(dvec, ct->matrix[3]); diff --git a/source/blender/blenkernel/intern/curve.c b/source/blender/blenkernel/intern/curve.c index bd70e365f51..794006e6f39 100644 --- a/source/blender/blenkernel/intern/curve.c +++ b/source/blender/blenkernel/intern/curve.c @@ -1924,7 +1924,7 @@ static void make_bevel_list_3D_minimum_twist(BevList *bl) /* flip rotation if needs be */ cross_v3_v3v3(cross_tmp, vec_1, vec_2); normalize_v3(cross_tmp); - if(angle_normalized_v3v3(bevp_first->dir, cross_tmp) < 90.0f/(float)(180.0/M_PI)) + if(angle_normalized_v3v3(bevp_first->dir, cross_tmp) < DEG2RADF(90.0f)) angle = -angle; bevp2= (BevPoint *)(bl+1); diff --git a/source/blender/blenkernel/intern/effect.c b/source/blender/blenkernel/intern/effect.c index 468f39bf731..7fb9f96e0cf 100644 --- a/source/blender/blenkernel/intern/effect.c +++ b/source/blender/blenkernel/intern/effect.c @@ -571,7 +571,7 @@ float effector_falloff(EffectorCache *eff, EffectorData *efd, EffectedPoint *UNU if(falloff == 0.0f) break; - r_fac=saacos(fac/len_v3(efd->vec_to_point))*180.0f/(float)M_PI; + r_fac= RAD2DEGF(saacos(fac/len_v3(efd->vec_to_point))); falloff*= falloff_func_rad(eff->pd, r_fac); break; diff --git a/source/blender/blenkernel/intern/image.c b/source/blender/blenkernel/intern/image.c index 4ce5de78895..002cfdbf41a 100644 --- a/source/blender/blenkernel/intern/image.c +++ b/source/blender/blenkernel/intern/image.c @@ -592,7 +592,7 @@ void BKE_image_print_memlist(void) for(ima= G.main->image.first; ima; ima= ima->id.next) totsize += image_mem_size(ima); - printf("\ntotal image memory len: %.3lf MB\n", (double)totsize/(double)(1024*1024)); + printf("\ntotal image memory len: %.3f MB\n", (double)totsize/(double)(1024*1024)); for(ima= G.main->image.first; ima; ima= ima->id.next) { size= image_mem_size(ima); diff --git a/source/blender/blenkernel/intern/ipo.c b/source/blender/blenkernel/intern/ipo.c index 0d3f3cc5ae4..5acd6c169a0 100644 --- a/source/blender/blenkernel/intern/ipo.c +++ b/source/blender/blenkernel/intern/ipo.c @@ -942,7 +942,7 @@ static char *get_rna_access (int blocktype, int adrcode, char actname[], char co sprintf(buf, "sequence_editor.sequences_all[\"%s\"]", seq->name+2); } else - strcpy(buf, ""); /* empty string */ + buf[0]= '\0'; /* empty string */ BLI_dynstr_append(path, buf); /* need to add dot before property if there was anything precceding this */ diff --git a/source/blender/blenkernel/intern/navmesh_conversion.cpp b/source/blender/blenkernel/intern/navmesh_conversion.cpp index 9b373db59ff..fbc4775cf34 100644 --- a/source/blender/blenkernel/intern/navmesh_conversion.cpp +++ b/source/blender/blenkernel/intern/navmesh_conversion.cpp @@ -290,27 +290,15 @@ struct SortContext const int* trisToFacesMap; }; -#ifdef FREE_WINDOWS -static SortContext *_mingw_context; +/* XXX: not thread-safe, but it's called only from modifiers stack + which isn't threaded. Anyway, better to avoid this in the future */ +static SortContext *_qsort_context; + static int compareByData(const void * a, const void * b) { - return ( _mingw_context->recastData[_mingw_context->trisToFacesMap[*(int*)a]] - - _mingw_context->recastData[_mingw_context->trisToFacesMap[*(int*)b]] ); -} -#else -#if defined(_MSC_VER) -static int compareByData(void* data, const void * a, const void * b) -#elif defined(__APPLE__) || defined(__FreeBSD__) -static int compareByData(void* data, const void * a, const void * b) -#else -static int compareByData(const void * a, const void * b, void* data) -#endif -{ - const SortContext* context = (const SortContext*)data; - return ( context->recastData[context->trisToFacesMap[*(int*)a]] - - context->recastData[context->trisToFacesMap[*(int*)b]] ); + return ( _qsort_context->recastData[_qsort_context->trisToFacesMap[*(int*)a]] - + _qsort_context->recastData[_qsort_context->trisToFacesMap[*(int*)b]] ); } -#endif bool buildNavMeshData(const int nverts, const float* verts, const int ntris, const unsigned short *tris, @@ -333,16 +321,8 @@ bool buildNavMeshData(const int nverts, const float* verts, SortContext context; context.recastData = recastData; context.trisToFacesMap = trisToFacesMap; -#if defined(_MSC_VER) - qsort_s(trisMapping, ntris, sizeof(int), compareByData, &context); -#elif defined(__APPLE__) || defined(__FreeBSD__) - qsort_r(trisMapping, ntris, sizeof(int), &context, compareByData); -#elif defined(FREE_WINDOWS) - _mingw_context = &context; + _qsort_context = &context; qsort(trisMapping, ntris, sizeof(int), compareByData); -#else - qsort_r(trisMapping, ntris, sizeof(int), compareByData, &context); -#endif //search first valid triangle - triangle of convex polygon int validTriStart = -1; for (int i=0; i< ntris; i++) diff --git a/source/blender/blenkernel/intern/node.c b/source/blender/blenkernel/intern/node.c index d40b030c470..89fd3ff9c13 100644 --- a/source/blender/blenkernel/intern/node.c +++ b/source/blender/blenkernel/intern/node.c @@ -1051,9 +1051,9 @@ void ntreeMakeLocal(bNodeTree *ntree) if(ntree->id.lib==NULL) return; if(ntree->id.us==1) { - ntree->id.lib= 0; + ntree->id.lib= NULL; ntree->id.flag= LIB_LOCAL; - new_id(0, (ID *)ntree, 0); + new_id(NULL, (ID *)ntree, NULL); return; } @@ -1069,7 +1069,7 @@ void ntreeMakeLocal(bNodeTree *ntree) if(cd.local && cd.lib==0) { ntree->id.lib= NULL; ntree->id.flag= LIB_LOCAL; - new_id(0, (ID *)ntree, 0); + new_id(NULL, (ID *)ntree, NULL); } else if(cd.local && cd.lib) { /* this is the mixed case, we copy the tree and assign it to local users */ @@ -1438,7 +1438,7 @@ static void ntree_update_link_pointers(bNodeTree *ntree) } } -void ntree_validate_links(bNodeTree *ntree) +static void ntree_validate_links(bNodeTree *ntree) { bNodeTreeType *ntreetype = ntreeGetType(ntree->type); bNodeLink *link; diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c index c2b561b122a..3644b02e7b5 100644 --- a/source/blender/blenkernel/intern/object.c +++ b/source/blender/blenkernel/intern/object.c @@ -418,7 +418,7 @@ void unlink_object(Object *ob) for (ct= targets.first; ct; ct= ct->next) { if (ct->tar == ob) { ct->tar = NULL; - strcpy(ct->subtarget, ""); + ct->subtarget[0]= '\0'; obt->recalc |= OB_RECALC_DATA; } } @@ -448,7 +448,7 @@ void unlink_object(Object *ob) for (ct= targets.first; ct; ct= ct->next) { if (ct->tar == ob) { ct->tar = NULL; - strcpy(ct->subtarget, ""); + ct->subtarget[0]= '\0'; obt->recalc |= OB_RECALC_DATA; } } diff --git a/source/blender/blenkernel/intern/particle.c b/source/blender/blenkernel/intern/particle.c index 60432631492..82a2436a010 100644 --- a/source/blender/blenkernel/intern/particle.c +++ b/source/blender/blenkernel/intern/particle.c @@ -2542,7 +2542,7 @@ static void psys_thread_create_path(ParticleThread *thread, struct ChildParticle normalize_v3(v1); normalize_v3(v2); - d = saacos(dot_v3v3(v1, v2)) * 180.0f/(float)M_PI; + d = RAD2DEGF(saacos(dot_v3v3(v1, v2))); } if(p_max > p_min) diff --git a/source/blender/blenkernel/intern/screen.c b/source/blender/blenkernel/intern/screen.c index 50b3e32278a..ef1b75e5913 100644 --- a/source/blender/blenkernel/intern/screen.c +++ b/source/blender/blenkernel/intern/screen.c @@ -277,8 +277,7 @@ void BKE_area_region_free(SpaceType *st, ARegion *ar) ar->v2d.tab_offset= NULL; } - if(ar) - BLI_freelistN(&ar->panels); + BLI_freelistN(&ar->panels); } /* not area itself */ diff --git a/source/blender/blenkernel/intern/seqeffects.c b/source/blender/blenkernel/intern/seqeffects.c index 43747fde729..e5d74177c91 100644 --- a/source/blender/blenkernel/intern/seqeffects.c +++ b/source/blender/blenkernel/intern/seqeffects.c @@ -2132,7 +2132,7 @@ static void do_transform(Scene *scene, Sequence *seq, float UNUSED(facf0), int x } // Rotate - rotate_radians = ((float)M_PI*transform->rotIni)/180.0f; + rotate_radians = DEG2RADF(transform->rotIni); transform_image(x,y, ibuf1, out, scale_x, scale_y, translate_x, translate_y, rotate_radians, transform->interpolation); } diff --git a/source/blender/blenkernel/intern/unit.c b/source/blender/blenkernel/intern/unit.c index 72fe1c19884..8aeef0d84b1 100644 --- a/source/blender/blenkernel/intern/unit.c +++ b/source/blender/blenkernel/intern/unit.c @@ -345,7 +345,7 @@ static int unit_as_string(char *str, int len_max, double value, int prec, bUnitC /* Convert to a string */ { - len= BLI_snprintf(str, len_max, "%.*lf", prec, value_conv); + len= BLI_snprintf(str, len_max, "%.*f", prec, value_conv); if(len >= len_max) len= len_max; diff --git a/source/blender/blenlib/BLI_string.h b/source/blender/blenlib/BLI_string.h index 4a0c2ab9482..c53ce9dced5 100644 --- a/source/blender/blenlib/BLI_string.h +++ b/source/blender/blenlib/BLI_string.h @@ -139,12 +139,15 @@ size_t BLI_strnlen(const char *str, size_t maxlen); void BLI_timestr(double _time, char *str); /* time var is global */ -int BLI_utf8_invalid_byte(const char *str, int length); -int BLI_utf8_invalid_strip(char *str, int length); - void BLI_ascii_strtolower(char *str, int len); void BLI_ascii_strtoupper(char *str, int len); + +/* string_utf8.c - may move these into their own header some day - campbell */ +char *BLI_strncpy_utf8(char *dst, const char *src, size_t maxncpy); +int BLI_utf8_invalid_byte(const char *str, int length); +int BLI_utf8_invalid_strip(char *str, int length); + #ifdef __cplusplus } #endif diff --git a/source/blender/blenlib/BLI_voxel.h b/source/blender/blenlib/BLI_voxel.h index 41f8bfab729..8dd95a897ae 100644 --- a/source/blender/blenlib/BLI_voxel.h +++ b/source/blender/blenlib/BLI_voxel.h @@ -36,9 +36,9 @@ #define V_I(x, y, z, res) ( (z)*(res)[1]*(res)[0] + (y)*(res)[0] + (x) ) /* all input coordinates must be in bounding box 0.0 - 1.0 */ -float voxel_sample_nearest(float *data, int *res, float *co); -float voxel_sample_trilinear(float *data, int *res, float *co); -float voxel_sample_triquadratic(float *data, int *res, float *co); -float voxel_sample_tricubic(float *data, int *res, float *co, int bspline); +float voxel_sample_nearest(float *data, const int res[3], const float co[3]); +float voxel_sample_trilinear(float *data, const int res[3], const float co[3]); +float voxel_sample_triquadratic(float *data, const int res[3], const float co[3]); +float voxel_sample_tricubic(float *data, const int res[3], const float co[3], int bspline); #endif /* BLI_VOXEL_H */ diff --git a/source/blender/blenlib/CMakeLists.txt b/source/blender/blenlib/CMakeLists.txt index b4fc983008c..aa822731474 100644 --- a/source/blender/blenlib/CMakeLists.txt +++ b/source/blender/blenlib/CMakeLists.txt @@ -80,6 +80,7 @@ set(SRC intern/scanfill.c intern/storage.c intern/string.c + intern/string_utf8.c intern/threads.c intern/time.c intern/uvproject.c diff --git a/source/blender/blenlib/intern/string.c b/source/blender/blenlib/intern/string.c index ae5fa40f3b9..8315161aeda 100644 --- a/source/blender/blenlib/intern/string.c +++ b/source/blender/blenlib/intern/string.c @@ -1,8 +1,4 @@ -/* util.c - * - * various string, file, list operations. - * - * +/* * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** @@ -399,116 +395,6 @@ size_t BLI_strnlen(const char *str, size_t maxlen) return end ? (size_t) (end - str) : maxlen; } -/* from libswish3, originally called u8_isvalid(), - * modified to return the index of the bad character (byte index not utf). - * http://svn.swish-e.org/libswish3/trunk/src/libswish3/utf8.c r3044 - campbell */ - -/* based on the valid_utf8 routine from the PCRE library by Philip Hazel - - length is in bytes, since without knowing whether the string is valid - it's hard to know how many characters there are! */ - -static const char trailingBytesForUTF8[256] = { - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, - 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,3,3,3,3,3,3,3,3,4,4,4,4,5,5,5,5 -}; - -int BLI_utf8_invalid_byte(const char *str, int length) -{ - const unsigned char *p, *pend = (unsigned char*)str + length; - unsigned char c; - int ab; - - for (p = (unsigned char*)str; p < pend; p++) { - c = *p; - if (c < 128) - continue; - if ((c & 0xc0) != 0xc0) - goto utf8_error; - ab = trailingBytesForUTF8[c]; - if (length < ab) - goto utf8_error; - length -= ab; - - p++; - /* Check top bits in the second byte */ - if ((*p & 0xc0) != 0x80) - goto utf8_error; - - /* Check for overlong sequences for each different length */ - switch (ab) { - /* Check for xx00 000x */ - case 1: - if ((c & 0x3e) == 0) goto utf8_error; - continue; /* We know there aren't any more bytes to check */ - - /* Check for 1110 0000, xx0x xxxx */ - case 2: - if (c == 0xe0 && (*p & 0x20) == 0) goto utf8_error; - break; - - /* Check for 1111 0000, xx00 xxxx */ - case 3: - if (c == 0xf0 && (*p & 0x30) == 0) goto utf8_error; - break; - - /* Check for 1111 1000, xx00 0xxx */ - case 4: - if (c == 0xf8 && (*p & 0x38) == 0) goto utf8_error; - break; - - /* Check for leading 0xfe or 0xff, - and then for 1111 1100, xx00 00xx */ - case 5: - if (c == 0xfe || c == 0xff || - (c == 0xfc && (*p & 0x3c) == 0)) goto utf8_error; - break; - } - - /* Check for valid bytes after the 2nd, if any; all must start 10 */ - while (--ab > 0) { - if ((*(p+1) & 0xc0) != 0x80) goto utf8_error; - p++; /* do this after so we get usable offset - campbell */ - } - } - - return -1; - -utf8_error: - - return (int)((char *)p - (char *)str) - 1; -} - -int BLI_utf8_invalid_strip(char *str, int length) -{ - int bad_char, tot= 0; - - while((bad_char= BLI_utf8_invalid_byte(str, length)) != -1) { - str += bad_char; - length -= bad_char; - - if(length == 0) { - /* last character bad, strip it */ - *str= '\0'; - tot++; - break; - } - else { - /* strip, keep looking */ - memmove(str, str + 1, length); - tot++; - } - } - - return tot; -} - void BLI_ascii_strtolower(char *str, int len) { int i; diff --git a/source/blender/blenlib/intern/string_utf8.c b/source/blender/blenlib/intern/string_utf8.c new file mode 100644 index 00000000000..961a41690f7 --- /dev/null +++ b/source/blender/blenlib/intern/string_utf8.c @@ -0,0 +1,185 @@ +/* + * $Id$ + * + * ***** BEGIN GPL LICENSE BLOCK ***** + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * The Original Code is Copyright (C) 2011 Blender Foundation. + * All rights reserved. + * + * Contributor(s): Campbell Barton. + * + * ***** END GPL LICENSE BLOCK ***** + * + */ + + /** \file blender/blenlib/intern/string_utf8.c + * \ingroup bli + */ + +#include <string.h> + +#include "BLI_string.h" + +/* from libswish3, originally called u8_isvalid(), + * modified to return the index of the bad character (byte index not utf). + * http://svn.swish-e.org/libswish3/trunk/src/libswish3/utf8.c r3044 - campbell */ + +/* based on the valid_utf8 routine from the PCRE library by Philip Hazel + + length is in bytes, since without knowing whether the string is valid + it's hard to know how many characters there are! */ + +static const char trailingBytesForUTF8[256] = { + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, + 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,3,3,3,3,3,3,3,3,4,4,4,4,5,5,5,5 +}; + +int BLI_utf8_invalid_byte(const char *str, int length) +{ + const unsigned char *p, *pend = (unsigned char*)str + length; + unsigned char c; + int ab; + + for (p = (unsigned char*)str; p < pend; p++) { + c = *p; + if (c < 128) + continue; + if ((c & 0xc0) != 0xc0) + goto utf8_error; + ab = trailingBytesForUTF8[c]; + if (length < ab) + goto utf8_error; + length -= ab; + + p++; + /* Check top bits in the second byte */ + if ((*p & 0xc0) != 0x80) + goto utf8_error; + + /* Check for overlong sequences for each different length */ + switch (ab) { + /* Check for xx00 000x */ + case 1: + if ((c & 0x3e) == 0) goto utf8_error; + continue; /* We know there aren't any more bytes to check */ + + /* Check for 1110 0000, xx0x xxxx */ + case 2: + if (c == 0xe0 && (*p & 0x20) == 0) goto utf8_error; + break; + + /* Check for 1111 0000, xx00 xxxx */ + case 3: + if (c == 0xf0 && (*p & 0x30) == 0) goto utf8_error; + break; + + /* Check for 1111 1000, xx00 0xxx */ + case 4: + if (c == 0xf8 && (*p & 0x38) == 0) goto utf8_error; + break; + + /* Check for leading 0xfe or 0xff, + and then for 1111 1100, xx00 00xx */ + case 5: + if (c == 0xfe || c == 0xff || + (c == 0xfc && (*p & 0x3c) == 0)) goto utf8_error; + break; + } + + /* Check for valid bytes after the 2nd, if any; all must start 10 */ + while (--ab > 0) { + if ((*(p+1) & 0xc0) != 0x80) goto utf8_error; + p++; /* do this after so we get usable offset - campbell */ + } + } + + return -1; + +utf8_error: + + return (int)((char *)p - (char *)str) - 1; +} + +int BLI_utf8_invalid_strip(char *str, int length) +{ + int bad_char, tot= 0; + + while((bad_char= BLI_utf8_invalid_byte(str, length)) != -1) { + str += bad_char; + length -= bad_char; + + if(length == 0) { + /* last character bad, strip it */ + *str= '\0'; + tot++; + break; + } + else { + /* strip, keep looking */ + memmove(str, str + 1, length); + tot++; + } + } + + return tot; +} + + +/* compatible with BLI_strncpy, but esnure no partial utf8 chars */ + +/* array copied from glib's gutf8.c, + * note: this looks to be at odd's with 'trailingBytesForUTF8', + * need to find out what gives here! - campbell */ +static const size_t utf8_skip_data[256] = { + 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, + 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, + 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, + 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, + 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, + 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, + 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2, + 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,4,4,4,4,4,4,4,4,5,5,5,5,6,6,1,1 +}; + +char *BLI_strncpy_utf8(char *dst, const char *src, size_t maxncpy) +{ + char *dst_r= dst; + size_t utf8_size; + + /* note: currently we dont attempt to deal with invalid utf8 chars */ + + while(*src != '\0' && (utf8_size= utf8_skip_data[*src]) < maxncpy) { + maxncpy -= utf8_size; + switch(utf8_size) { + case 6: *dst ++ = *src ++; + case 5: *dst ++ = *src ++; + case 4: *dst ++ = *src ++; + case 3: *dst ++ = *src ++; + case 2: *dst ++ = *src ++; + case 1: *dst ++ = *src ++; + } + } + *dst= '\0'; + return dst_r; +} + diff --git a/source/blender/blenlib/intern/voxel.c b/source/blender/blenlib/intern/voxel.c index d11386ff606..6d912be71d3 100644 --- a/source/blender/blenlib/intern/voxel.c +++ b/source/blender/blenlib/intern/voxel.c @@ -36,7 +36,7 @@ -BM_INLINE float D(float *data, int *res, int x, int y, int z) +BM_INLINE float D(float *data, const int res[3], int x, int y, int z) { CLAMP(x, 0, res[0]-1); CLAMP(y, 0, res[1]-1); @@ -46,7 +46,7 @@ BM_INLINE float D(float *data, int *res, int x, int y, int z) /* *** nearest neighbour *** */ /* input coordinates must be in bounding box 0.0 - 1.0 */ -float voxel_sample_nearest(float *data, int *res, float *co) +float voxel_sample_nearest(float *data, const int res[3], const float co[3]) { int xi, yi, zi; @@ -71,7 +71,7 @@ BM_INLINE int _clamp(int a, int b, int c) return (a < b) ? b : ((a > c) ? c : a); } -float voxel_sample_trilinear(float *data, int *res, float *co) +float voxel_sample_trilinear(float *data, const int res[3], const float co[3]) { if (data) { @@ -103,7 +103,7 @@ float voxel_sample_trilinear(float *data, int *res, float *co) } -float voxel_sample_triquadratic(float *data, int *res, float *co) +float voxel_sample_triquadratic(float *data, const int res[3], const float co[3]) { if (data) { @@ -133,7 +133,7 @@ float voxel_sample_triquadratic(float *data, int *res, float *co) return 0.f; } -float voxel_sample_tricubic(float *data, int *res, float *co, int bspline) +float voxel_sample_tricubic(float *data, const int res[3], const float co[3], int bspline) { if (data) { diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index 316999df6f6..a5748201d32 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -2142,7 +2142,7 @@ static void lib_verify_nodetree(Main *main, int UNUSED(open)) ntreetype->foreach_nodetree(main, NULL, lib_nodetree_init_types_cb); } for(ntree= main->nodetree.first; ntree; ntree= ntree->id.next) - ntreeInitTypes(ntree); + lib_nodetree_init_types_cb(NULL, NULL, ntree); { int has_old_groups=0; @@ -3967,7 +3967,6 @@ static void direct_link_pose(FileData *fd, bPose *pose) direct_link_motionpath(fd, pchan->mpath); pchan->iktree.first= pchan->iktree.last= NULL; - pchan->path= NULL; /* incase this value changes in future, clamp else we get undefined behavior */ CLAMP(pchan->rotmode, ROT_MODE_MIN, ROT_MODE_MAX); @@ -9232,7 +9231,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main) simasel->prv_w = 96; simasel->flag = 7; /* ??? elubie */ strcpy (simasel->dir, U.textudir); /* TON */ - strcpy (simasel->file, ""); + simasel->file[0]= '\0'; simasel->returnfunc = NULL; simasel->title[0] = 0; @@ -9462,7 +9461,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main) /* clear old targets to avoid problems */ data->tar = NULL; - strcpy(data->subtarget, ""); + data->subtarget[0]= '\0'; } } else if (con->type == CONSTRAINT_TYPE_LOCLIKE) { @@ -9492,7 +9491,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main) /* clear old targets to avoid problems */ data->tar = NULL; - strcpy(data->subtarget, ""); + data->subtarget[0]= '\0'; } } else if (con->type == CONSTRAINT_TYPE_LOCLIKE) { diff --git a/source/blender/collada/AnimationExporter.cpp b/source/blender/collada/AnimationExporter.cpp index 2ea10111bb9..ae568e69936 100644 --- a/source/blender/collada/AnimationExporter.cpp +++ b/source/blender/collada/AnimationExporter.cpp @@ -577,7 +577,7 @@ void AnimationExporter::get_source_values(BezTriple *bezt, COLLADASW::InputSeman case COLLADASW::InputSemantic::OUTPUT: *length = 1; if (rotation) { - values[0] = (bezt->vec[1][1]) * 180.0f/M_PI; + values[0] = RAD2DEGF(bezt->vec[1][1]); } else { values[0] = bezt->vec[1][1]; @@ -593,7 +593,7 @@ void AnimationExporter::get_source_values(BezTriple *bezt, COLLADASW::InputSeman values[1] = 0; } else if (rotation) { - values[1] = (bezt->vec[0][1]) * 180.0f/M_PI; + values[1] = RAD2DEGF(bezt->vec[0][1]); } else { values[1] = bezt->vec[0][1]; } @@ -608,7 +608,7 @@ void AnimationExporter::get_source_values(BezTriple *bezt, COLLADASW::InputSeman values[1] = 0; } else if (rotation) { - values[1] = (bezt->vec[2][1]) * 180.0f/M_PI; + values[1] = RAD2DEGF(bezt->vec[2][1]); } else { values[1] = bezt->vec[2][1]; } @@ -688,7 +688,7 @@ std::string AnimationExporter::create_source_from_array(COLLADASW::InputSemantic // val = convert_time(val); //else if (is_rot) - val *= 180.0f / M_PI; + val = RAD2DEGF(val); source.appendValues(val); } diff --git a/source/blender/collada/AnimationImporter.cpp b/source/blender/collada/AnimationImporter.cpp index 43428f57d4f..a176b6eb4cd 100644 --- a/source/blender/collada/AnimationImporter.cpp +++ b/source/blender/collada/AnimationImporter.cpp @@ -170,9 +170,9 @@ void AnimationImporter::fcurve_deg_to_rad(FCurve *cu) { for (unsigned int i = 0; i < cu->totvert; i++) { // TODO convert handles too - cu->bezt[i].vec[1][1] *= M_PI / 180.0f; - cu->bezt[i].vec[0][1] *= M_PI / 180.0f; - cu->bezt[i].vec[2][1] *= M_PI / 180.0f; + cu->bezt[i].vec[1][1] *= DEG2RADF(1.0f); + cu->bezt[i].vec[0][1] *= DEG2RADF(1.0f); + cu->bezt[i].vec[2][1] *= DEG2RADF(1.0f); } } @@ -741,7 +741,7 @@ void AnimationImporter::apply_matrix_curves( Object * ob, std::vector<FCurve*>& mat4_to_quat(rot, mat); /*for ( int i = 0 ; i < 4 ; i ++ ) { - rot[i] = rot[i] * (180 / M_PI); + rot[i] = RAD2DEGF(rot[i]); }*/ copy_v3_v3(loc, mat[3]); mat4_to_size(scale, mat); diff --git a/source/blender/collada/CameraExporter.cpp b/source/blender/collada/CameraExporter.cpp index 542409072f1..006d4c0ed23 100644 --- a/source/blender/collada/CameraExporter.cpp +++ b/source/blender/collada/CameraExporter.cpp @@ -73,7 +73,7 @@ void CamerasExporter::operator()(Object *ob, Scene *sce) if (cam->type == CAM_PERSP) { COLLADASW::PerspectiveOptic persp(mSW); - persp.setXFov(lens_to_angle(cam->lens)*(180.0f/M_PI),"xfov"); + persp.setXFov(RAD2DEGF(lens_to_angle(cam->lens)), "xfov"); persp.setAspectRatio((float)(sce->r.xsch)/(float)(sce->r.ysch),false,"aspect_ratio"); persp.setZFar(cam->clipend, false , "zfar"); persp.setZNear(cam->clipsta,false , "znear"); diff --git a/source/blender/collada/DocumentImporter.cpp b/source/blender/collada/DocumentImporter.cpp index 366837421e3..2387c9a1465 100644 --- a/source/blender/collada/DocumentImporter.cpp +++ b/source/blender/collada/DocumentImporter.cpp @@ -816,7 +816,7 @@ bool DocumentImporter::writeCamera( const COLLADAFW::Camera* camera ) double aspect = camera->getAspectRatio().getValue(); double xfov = aspect*yfov; // xfov is in degrees, cam->lens is in millimiters - cam->lens = angle_to_lens((float)xfov*(M_PI/180.0f)); + cam->lens = angle_to_lens(DEG2RADF(xfov));; } break; } @@ -837,7 +837,7 @@ bool DocumentImporter::writeCamera( const COLLADAFW::Camera* camera ) { double x = camera->getXFov().getValue(); // x is in degrees, cam->lens is in millimiters - cam->lens = angle_to_lens((float)x*(M_PI/180.0f)); + cam->lens = angle_to_lens(DEG2RADF(x)); } break; } @@ -854,7 +854,7 @@ bool DocumentImporter::writeCamera( const COLLADAFW::Camera* camera ) { double yfov = camera->getYFov().getValue(); // yfov is in degrees, cam->lens is in millimiters - cam->lens = angle_to_lens((float)yfov*(M_PI/180.0f)); + cam->lens = angle_to_lens(DEG2RADF(yfov)); } break; } diff --git a/source/blender/collada/TransformReader.cpp b/source/blender/collada/TransformReader.cpp index 625a0220830..fa14a548850 100644 --- a/source/blender/collada/TransformReader.cpp +++ b/source/blender/collada/TransformReader.cpp @@ -82,8 +82,8 @@ void TransformReader::dae_rotate_to_mat4(COLLADAFW::Transformation *tm, float m[ { COLLADAFW::Rotate *ro = (COLLADAFW::Rotate*)tm; COLLADABU::Math::Vector3& axis = ro->getRotationAxis(); - float angle = (float)(ro->getRotationAngle() * M_PI / 180.0f); - float ax[] = {axis[0], axis[1], axis[2]}; + const float angle = (float)DEG2RAD(ro->getRotationAngle()); + const float ax[] = {axis[0], axis[1], axis[2]}; // float quat[4]; // axis_angle_to_quat(quat, axis, angle); // quat_to_mat4(m, quat); diff --git a/source/blender/collada/TransformWriter.cpp b/source/blender/collada/TransformWriter.cpp index 88ed112c3fe..34d13a2184d 100644 --- a/source/blender/collada/TransformWriter.cpp +++ b/source/blender/collada/TransformWriter.cpp @@ -107,9 +107,9 @@ void TransformWriter::add_transform(COLLADASW::Node& node, float loc[3], float r /*node.addRotateZ("rotationZ", COLLADABU::Math::Utils::radToDegF(rot[2])); node.addRotateY("rotationY", COLLADABU::Math::Utils::radToDegF(rot[1])); node.addRotateX("rotationX", COLLADABU::Math::Utils::radToDegF(rot[0]));*/ - node.addRotateZ("rotationZ", rot[2] * 180.0f/M_PI); - node.addRotateY("rotationY", (rot[1]* 180.0f/M_PI)); - node.addRotateX("rotationX", (rot[0]* 180.0f/M_PI)); + node.addRotateZ("rotationZ", RAD2DEGF(rot[2])); + node.addRotateY("rotationY", RAD2DEGF(rot[1])); + node.addRotateX("rotationX", RAD2DEGF(rot[0])); node.addScale("scale", scale[0], scale[1], scale[2]); } diff --git a/source/blender/editors/animation/anim_draw.c b/source/blender/editors/animation/anim_draw.c index 70974386917..d2b1fcc4abd 100644 --- a/source/blender/editors/animation/anim_draw.c +++ b/source/blender/editors/animation/anim_draw.c @@ -404,9 +404,9 @@ float ANIM_unit_mapping_get_factor (Scene *scene, ID *id, FCurve *fcu, short res /* if the radians flag is not set, default to using degrees which need conversions */ if ((scene) && (scene->unit.system_rotation == USER_UNIT_ROT_RADIANS) == 0) { if (restore) - return M_PI / 180.0; /* degrees to radians */ + return DEG2RADF(1.0f); /* degrees to radians */ else - return 180.0 / M_PI; /* radians to degrees */ + return RAD2DEGF(1.0f); /* radians to degrees */ } } diff --git a/source/blender/editors/animation/anim_filter.c b/source/blender/editors/animation/anim_filter.c index bb710a32794..bd5935c893c 100644 --- a/source/blender/editors/animation/anim_filter.c +++ b/source/blender/editors/animation/anim_filter.c @@ -893,7 +893,7 @@ static size_t skip_fcurve_selected_data (bDopeSheet *ads, FCurve *fcu, ID *owner */ static short skip_fcurve_with_name (bDopeSheet *ads, FCurve *fcu, ID *owner_id) { - bAnimListElem ale_dummy = {0}; + bAnimListElem ale_dummy = {NULL}; bAnimChannelType *acf; /* create a dummy wrapper for the F-Curve */ diff --git a/source/blender/editors/animation/keyframes_edit.c b/source/blender/editors/animation/keyframes_edit.c index 2305848e7b3..fa619e4cf44 100644 --- a/source/blender/editors/animation/keyframes_edit.c +++ b/source/blender/editors/animation/keyframes_edit.c @@ -204,8 +204,8 @@ static short ob_keyframes_loop(KeyframeEditData *ked, bDopeSheet *ads, Object *o int filter; int ret=0; - bAnimListElem dummychan = {0}; - Base dummybase = {0}; + bAnimListElem dummychan = {NULL}; + Base dummybase = {NULL}; if (ob == NULL) return 0; @@ -249,7 +249,7 @@ static short scene_keyframes_loop(KeyframeEditData *ked, bDopeSheet *ads, Scene int filter; int ret=0; - bAnimListElem dummychan = {0}; + bAnimListElem dummychan = {NULL}; if (sce == NULL) return 0; diff --git a/source/blender/editors/armature/editarmature.c b/source/blender/editors/armature/editarmature.c index 80a7e703474..9a6be695555 100644 --- a/source/blender/editors/armature/editarmature.c +++ b/source/blender/editors/armature/editarmature.c @@ -361,7 +361,7 @@ static void fix_bonelist_roll (ListBase *bonelist, ListBase *editbonelist) print_m4("premat", premat); print_m4("postmat", postmat); print_m4("difmat", difmat); - printf ("Roll = %f\n", (-atan2(difmat[2][0], difmat[2][2]) * (180.0/M_PI))); + printf ("Roll = %f\n", RAD2DEGF(-atan2(difmat[2][0], difmat[2][2]))); #endif curBone->roll = (float)-atan2(difmat[2][0], difmat[2][2]); diff --git a/source/blender/editors/armature/poselib.c b/source/blender/editors/armature/poselib.c index 6e64d332cfd..67c93c4c906 100644 --- a/source/blender/editors/armature/poselib.c +++ b/source/blender/editors/armature/poselib.c @@ -1439,9 +1439,7 @@ static void poselib_preview_init_data (bContext *C, wmOperator *op) pld->pose->flag &= ~POSE_DO_UNLOCK; /* clear strings + search */ - strcpy(pld->headerstr, ""); - strcpy(pld->searchstr, ""); - strcpy(pld->searchold, ""); + pld->headerstr[0]= pld->searchstr[0]= pld->searchold[0]= '\0'; pld->search_cursor= 0; } diff --git a/source/blender/editors/curve/curve_ops.c b/source/blender/editors/curve/curve_ops.c index adf4f0fac2e..6b85523ac82 100644 --- a/source/blender/editors/curve/curve_ops.c +++ b/source/blender/editors/curve/curve_ops.c @@ -46,6 +46,7 @@ #include "WM_api.h" #include "WM_types.h" +#include "ED_curve.h" #include "ED_object.h" #include "ED_screen.h" #include "ED_transform.h" diff --git a/source/blender/editors/gpencil/gpencil_paint.c b/source/blender/editors/gpencil/gpencil_paint.c index a23f2064a9e..da3310ae883 100644 --- a/source/blender/editors/gpencil/gpencil_paint.c +++ b/source/blender/editors/gpencil/gpencil_paint.c @@ -1878,7 +1878,7 @@ static int gpencil_draw_modal (bContext *C, wmOperator *op, wmEvent *event) static EnumPropertyItem prop_gpencil_drawmodes[] = { {GP_PAINTMODE_DRAW, "DRAW", 0, "Draw Freehand", ""}, {GP_PAINTMODE_DRAW_STRAIGHT, "DRAW_STRAIGHT", 0, "Draw Straight Lines", ""}, - {GP_PAINTMODE_DRAW_POLY, "DRAW_POLY", 0, "Dtaw Poly Line", ""}, + {GP_PAINTMODE_DRAW_POLY, "DRAW_POLY", 0, "Draw Poly Line", ""}, {GP_PAINTMODE_ERASER, "ERASER", 0, "Eraser", ""}, {0, NULL, 0, NULL, NULL} }; diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c index 0dee7a3813a..abc668d72dd 100644 --- a/source/blender/editors/interface/interface.c +++ b/source/blender/editors/interface/interface.c @@ -58,6 +58,7 @@ #include "UI_interface.h" +#include "IMB_imbuf.h" #include "WM_api.h" #include "WM_types.h" @@ -1894,6 +1895,8 @@ static void ui_free_but(const bContext *C, uiBut *but) if(but->str && but->str != but->strdata) MEM_freeN(but->str); ui_free_link(but->link); + if((but->type == BUT_IMAGE) && but->poin) IMB_freeImBuf((struct ImBuf *)but->poin); + MEM_freeN(but); } diff --git a/source/blender/editors/interface/interface_draw.c b/source/blender/editors/interface/interface_draw.c index 33aeb2df926..a1275e237c1 100644 --- a/source/blender/editors/interface/interface_draw.c +++ b/source/blender/editors/interface/interface_draw.c @@ -461,19 +461,14 @@ void uiEmboss(float x1, float y1, float x2, float y2, int sel) /* ************** SPECIAL BUTTON DRAWING FUNCTIONS ************* */ -void ui_draw_but_IMAGE(ARegion *UNUSED(ar), uiBut *UNUSED(but), uiWidgetColors *UNUSED(wcol), rcti *rect) +void ui_draw_but_IMAGE(ARegion *UNUSED(ar), uiBut *but, uiWidgetColors *UNUSED(wcol), rcti *rect) { #ifdef WITH_HEADLESS (void)rect; #else - extern char datatoc_splash_png[]; - extern int datatoc_splash_png_size; - ImBuf *ibuf; + ImBuf *ibuf= (ImBuf *)but->poin; //GLint scissor[4]; //int w, h; - - /* hardcoded to splash, loading and freeing every draw, eek! */ - ibuf= IMB_ibImageFromMemory((unsigned char*)datatoc_splash_png, datatoc_splash_png_size, IB_rect); if (!ibuf) return; @@ -501,7 +496,6 @@ void ui_draw_but_IMAGE(ARegion *UNUSED(ar), uiBut *UNUSED(but), uiWidgetColors * glScissor(scissor[0], scissor[1], scissor[2], scissor[3]); */ - IMB_freeImBuf(ibuf); #endif } @@ -959,13 +953,13 @@ static float polar_to_y(float center, float diam, float ampli, float angle) return center + diam * ampli * sinf(angle); } -static void vectorscope_draw_target(float centerx, float centery, float diam, float r, float g, float b) +static void vectorscope_draw_target(float centerx, float centery, float diam, const float colf[3]) { float y,u,v; float tangle=0.f, tampli; float dangle, dampli, dangle2, dampli2; - rgb_to_yuv(r,g,b, &y, &u, &v); + rgb_to_yuv(colf[0], colf[1], colf[2], &y, &u, &v); if (u>0 && v>=0) tangle=atanf(v/u); else if (u>0 && v<0) tangle= atanf(v/u) + 2.0f * (float)M_PI; else if (u<0) tangle=atanf(v/u) + (float)M_PI; @@ -975,7 +969,7 @@ static void vectorscope_draw_target(float centerx, float centery, float diam, fl /* small target vary by 2.5 degree and 2.5 IRE unit */ glColor4f(1.0f, 1.0f, 1.0, 0.12f); - dangle= 2.5f*(float)M_PI/180.0f; + dangle= DEG2RADF(2.5f); dampli= 2.5f/200.0f; glBegin(GL_LINE_STRIP); glVertex2f(polar_to_x(centerx,diam,tampli+dampli,tangle+dangle), polar_to_y(centery,diam,tampli+dampli,tangle+dangle)); @@ -986,9 +980,9 @@ static void vectorscope_draw_target(float centerx, float centery, float diam, fl glEnd(); /* big target vary by 10 degree and 20% amplitude */ glColor4f(1.0f, 1.0f, 1.0, 0.12f); - dangle= 10.0f*(float)M_PI/180.0f; + dangle= DEG2RADF(10.0f); dampli= 0.2f*tampli; - dangle2= 5.0f*(float)M_PI/180.0f; + dangle2= DEG2RADF(5.0f); dampli2= 0.5f*dampli; glBegin(GL_LINE_STRIP); glVertex2f(polar_to_x(centerx,diam,tampli+dampli-dampli2,tangle+dangle), polar_to_y(centery,diam,tampli+dampli-dampli2,tangle+dangle)); @@ -1014,13 +1008,13 @@ static void vectorscope_draw_target(float centerx, float centery, float diam, fl void ui_draw_but_VECTORSCOPE(ARegion *ar, uiBut *but, uiWidgetColors *UNUSED(wcol), rcti *recti) { + const float skin_rad= DEG2RADF(123.0f); /* angle in radians of the skin tone line */ Scopes *scopes = (Scopes *)but->poin; rctf rect; int i, j; - int skina= 123; /* angle in degree of the skin tone line */ float w, h, centerx, centery, diam; float alpha; - float colors[6][3]={{.75,0,0},{.75,.75,0},{0,.75,0},{0,.75,.75},{0,0,.75},{.75,0,.75}}; + const float colors[6][3]={{.75,0,0},{.75,.75,0},{0,.75,0},{0,.75,.75},{0,0,.75},{.75,0,.75}}; GLint scissor[4]; rect.xmin = (float)recti->xmin+1; @@ -1056,19 +1050,19 @@ void ui_draw_but_VECTORSCOPE(ARegion *ar, uiBut *but, uiWidgetColors *UNUSED(wco for(j=0; j<5; j++) { glBegin(GL_LINE_STRIP); for(i=0; i<=360; i=i+15) { - float a= i*M_PI/180.0; - float r= (j+1)/10.0f; - glVertex2f( polar_to_x(centerx,diam,r,a), polar_to_y(centery,diam,r,a)); + const float a= DEG2RADF((float)i); + const float r= (j+1)/10.0f; + glVertex2f(polar_to_x(centerx,diam,r,a), polar_to_y(centery,diam,r,a)); } glEnd(); } /* skin tone line */ glColor4f(1.f, 0.4f, 0.f, 0.2f); - fdrawline( polar_to_x(centerx, diam, 0.5f, skina*M_PI/180.0), polar_to_y(centery,diam,0.5,skina*M_PI/180.0), - polar_to_x(centerx, diam, 0.1f, skina*M_PI/180.0), polar_to_y(centery,diam,0.1,skina*M_PI/180.0)); + fdrawline(polar_to_x(centerx, diam, 0.5f, skin_rad), polar_to_y(centery,diam,0.5,skin_rad), + polar_to_x(centerx, diam, 0.1f, skin_rad), polar_to_y(centery,diam,0.1,skin_rad)); /* saturation points */ for(i=0; i<6; i++) - vectorscope_draw_target(centerx, centery, diam, colors[i][0], colors[i][1], colors[i][2]); + vectorscope_draw_target(centerx, centery, diam, colors[i]); if (scopes->ok && scopes->vecscope != NULL) { /* pixel point cloud */ diff --git a/source/blender/editors/interface/interface_regions.c b/source/blender/editors/interface/interface_regions.c index a55ee01202c..f31c16cd020 100644 --- a/source/blender/editors/interface/interface_regions.c +++ b/source/blender/editors/interface/interface_regions.c @@ -1235,7 +1235,7 @@ static void ui_block_position(wmWindow *window, ARegion *butregion, uiBut *but, ysize= block->maxy - block->miny+4; /*aspect/= (float)xsize;*/ /*UNUSED*/ - if(but) { + { int left=0, right=0, top=0, down=0; int winx, winy; // int offscreen; diff --git a/source/blender/editors/object/object_modifier.c b/source/blender/editors/object/object_modifier.c index 8813b0027cd..17f174a5069 100644 --- a/source/blender/editors/object/object_modifier.c +++ b/source/blender/editors/object/object_modifier.c @@ -724,7 +724,7 @@ static int modifier_remove_exec(bContext *C, wmOperator *op) Scene *scene= CTX_data_scene(C); Object *ob = ED_object_active_context(C); ModifierData *md = edit_modifier_property_get(op, ob, 0); - int mode_orig = ob->mode; + int mode_orig = ob ? ob->mode : 0; if(!ob || !md || !ED_object_modifier_remove(op->reports, bmain, scene, ob, md)) return OPERATOR_CANCELLED; diff --git a/source/blender/editors/object/object_navmesh.cpp b/source/blender/editors/object/object_navmesh.cpp index d0768d30236..ae97b40eb49 100644 --- a/source/blender/editors/object/object_navmesh.cpp +++ b/source/blender/editors/object/object_navmesh.cpp @@ -575,7 +575,7 @@ static int findFreeNavPolyIndex(EditMesh* em) else if (indices[i]>freeIdx) break; } - delete indices; + delete [] indices; return freeIdx; } diff --git a/source/blender/editors/sculpt_paint/paint_image.c b/source/blender/editors/sculpt_paint/paint_image.c index ef0f4ace2b8..8992dc81784 100644 --- a/source/blender/editors/sculpt_paint/paint_image.c +++ b/source/blender/editors/sculpt_paint/paint_image.c @@ -717,7 +717,7 @@ static int project_paint_PickColor(const ProjPaintState *ps, float pt[2], float * 1 : occluded 2 : occluded with w[3] weights set (need to know in some cases) */ -static int project_paint_occlude_ptv(float pt[3], float v1[3], float v2[3], float v3[3], float w[3], int is_ortho) +static int project_paint_occlude_ptv(float pt[3], float v1[4], float v2[4], float v3[4], float w[3], int is_ortho) { /* if all are behind us, return false */ if(v1[2] > pt[2] && v2[2] > pt[2] && v3[2] > pt[2]) @@ -749,7 +749,7 @@ static int project_paint_occlude_ptv(float pt[3], float v1[3], float v2[3], floa static int project_paint_occlude_ptv_clip( const ProjPaintState *ps, const MFace *mf, - float pt[3], float v1[3], float v2[3], float v3[3], + float pt[3], float v1[4], float v2[4], float v3[4], const int side ) { float w[3], wco[3]; diff --git a/source/blender/editors/sculpt_paint/paint_stroke.c b/source/blender/editors/sculpt_paint/paint_stroke.c index 9500c7f663c..767001ff163 100644 --- a/source/blender/editors/sculpt_paint/paint_stroke.c +++ b/source/blender/editors/sculpt_paint/paint_stroke.c @@ -447,9 +447,9 @@ static void paint_draw_alpha_overlay(Sculpt *sd, Brush *brush, if(brush->mtex.brush_map_mode == MTEX_MAP_MODE_FIXED) { /* brush rotation */ glTranslatef(0.5, 0.5, 0); - glRotatef((double)((brush->flag & BRUSH_RAKE) ? - sd->last_angle : sd->special_rotation) * (180.0/M_PI), - 0.0, 0.0, 1.0); + glRotatef((double)RAD2DEGF((brush->flag & BRUSH_RAKE) ? + sd->last_angle : sd->special_rotation), + 0.0, 0.0, 1.0); glTranslatef(-0.5f, -0.5f, 0); /* scale based on tablet pressure */ @@ -683,7 +683,7 @@ static void paint_brush_stroke_add_step(bContext *C, wmOperator *op, wmEvent *ev /* TODO: as sculpt and other paint modes are unified, this separation will go away */ if(stroke->vc.obact->sculpt) { - float delta[3]; + float delta[2]; brush_jitter_pos(brush, mouse_in, mouse); @@ -691,13 +691,14 @@ static void paint_brush_stroke_add_step(bContext *C, wmOperator *op, wmEvent *ev brush_jitter_pos isn't written in the best way to be reused here */ if(brush->flag & BRUSH_JITTER_PRESSURE) { - sub_v3_v3v3(delta, mouse, mouse_in); - mul_v3_fl(delta, pressure); - add_v3_v3v3(mouse, mouse_in, delta); + sub_v2_v2v2(delta, mouse, mouse_in); + mul_v2_fl(delta, pressure); + add_v2_v2v2(mouse, mouse_in, delta); } } - else - copy_v3_v3(mouse, mouse_in); + else { + copy_v2_v2(mouse, mouse_in); + } /* TODO: can remove the if statement once all modes have this */ if(stroke->get_location) diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c index 92bc60e8b77..0bdb027a903 100644 --- a/source/blender/editors/sculpt_paint/sculpt.c +++ b/source/blender/editors/sculpt_paint/sculpt.c @@ -2996,7 +2996,7 @@ static void sculpt_update_brush_delta(Sculpt *sd, Object *ob, Brush *brush) copy_v3_v3(cache->true_location, cache->orig_grab_location); sd->draw_anchored = 1; - copy_v3_v3(sd->anchored_initial_mouse, cache->initial_mouse); + copy_v2_v2(sd->anchored_initial_mouse, cache->initial_mouse); sd->anchored_size = cache->pixel_radius; } } diff --git a/source/blender/editors/sound/sound_intern.h b/source/blender/editors/sound/sound_intern.h index b17ef99132f..cde0b3c4479 100644 --- a/source/blender/editors/sound/sound_intern.h +++ b/source/blender/editors/sound/sound_intern.h @@ -36,7 +36,5 @@ struct wmOperatorType; -void SOUND_OT_open(wmOperatorType *ot); - #endif /* ED_SOUND_INTERN_H */ diff --git a/source/blender/editors/sound/sound_ops.c b/source/blender/editors/sound/sound_ops.c index 19cae6aa67d..60d665de94c 100644 --- a/source/blender/editors/sound/sound_ops.c +++ b/source/blender/editors/sound/sound_ops.c @@ -175,7 +175,7 @@ static int open_invoke(bContext *C, wmOperator *op, wmEvent *event) return WM_operator_filesel(C, op, event); } -void SOUND_OT_open(wmOperatorType *ot) +static void SOUND_OT_open(wmOperatorType *ot) { /* identifiers */ ot->name= "Open Sound"; @@ -196,7 +196,7 @@ void SOUND_OT_open(wmOperatorType *ot) RNA_def_boolean(ot->srna, "mono", FALSE, "Mono", "Mixdown the sound to mono."); } -void SOUND_OT_open_mono(wmOperatorType *ot) +static void SOUND_OT_open_mono(wmOperatorType *ot) { /* identifiers */ ot->name= "Open Sound Mono"; @@ -659,7 +659,7 @@ static int update_animation_flags_exec(bContext *C, wmOperator *UNUSED(op)) return OPERATOR_FINISHED; } -void SOUND_OT_update_animation_flags(wmOperatorType *ot) +static void SOUND_OT_update_animation_flags(wmOperatorType *ot) { /* This operator is needed to set a correct state of the sound animation @@ -703,7 +703,7 @@ static int bake_animation_exec(bContext *C, wmOperator *UNUSED(op)) return OPERATOR_FINISHED; } -void SOUND_OT_bake_animation(wmOperatorType *ot) +static void SOUND_OT_bake_animation(wmOperatorType *ot) { /* identifiers */ ot->name= "Update animation cache"; diff --git a/source/blender/editors/space_action/action_edit.c b/source/blender/editors/space_action/action_edit.c index b5dfdcdc668..60662334e20 100644 --- a/source/blender/editors/space_action/action_edit.c +++ b/source/blender/editors/space_action/action_edit.c @@ -535,7 +535,7 @@ void ACTION_OT_paste (wmOperatorType *ot) ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; RNA_def_enum(ot->srna, "offset", keyframe_paste_offset_items, KEYFRAME_PASTE_OFFSET_CFRA_START, "Offset", "Paste time offset of keys"); - RNA_def_enum(ot->srna, "merge", keyframe_paste_merge_items, KEYFRAME_PASTE_MERGE_MIX, "Type", "Method of merking pasted keys and existing"); + RNA_def_enum(ot->srna, "merge", keyframe_paste_merge_items, KEYFRAME_PASTE_MERGE_MIX, "Type", "Method of merging pasted keys and existing"); } /* ******************** Insert Keyframes Operator ************************* */ diff --git a/source/blender/editors/space_action/action_select.c b/source/blender/editors/space_action/action_select.c index aa29e54f436..32594e710a4 100644 --- a/source/blender/editors/space_action/action_select.c +++ b/source/blender/editors/space_action/action_select.c @@ -580,7 +580,7 @@ void ACTION_OT_select_linked (wmOperatorType *ot) /* identifiers */ ot->name = "Select Linked"; ot->idname= "ACTION_OT_select_linked"; - ot->description = "Select keyframes occurring the same F-Curves as selected ones"; + ot->description = "Select keyframes occurring in the same F-Curves as selected ones"; /* api callbacks */ ot->exec= actkeys_select_linked_exec; diff --git a/source/blender/editors/space_console/console_ops.c b/source/blender/editors/space_console/console_ops.c index 4707baa279b..51e2679e8c2 100644 --- a/source/blender/editors/space_console/console_ops.c +++ b/source/blender/editors/space_console/console_ops.c @@ -54,6 +54,14 @@ #include "console_intern.h" +/* so when we type - the view scrolls to the bottom */ +static void console_scroll_bottom(ARegion *ar) +{ + View2D *v2d= &ar->v2d; + v2d->cur.ymin = 0.0; + v2d->cur.ymax =(float)v2d->winy; +} + static void console_textview_update_rect(SpaceConsole *sc, ARegion *ar) { View2D *v2d= &ar->v2d; @@ -339,9 +347,14 @@ static int move_exec(bContext *C, wmOperator *op) } if(done) { - ED_area_tag_redraw(CTX_wm_area(C)); + ScrArea *sa= CTX_wm_area(C); + ARegion *ar= CTX_wm_region(C); + + ED_area_tag_redraw(sa); + console_scroll_bottom(ar); } - + + return OPERATOR_FINISHED; } @@ -391,7 +404,9 @@ static int insert_exec(bContext *C, wmOperator *op) console_textview_update_rect(sc, ar); ED_area_tag_redraw(CTX_wm_area(C)); - + + console_scroll_bottom(ar); + return OPERATOR_FINISHED; } @@ -478,6 +493,8 @@ static int delete_exec(bContext *C, wmOperator *op) console_textview_update_rect(sc, ar); ED_area_tag_redraw(CTX_wm_area(C)); + + console_scroll_bottom(ar); return OPERATOR_FINISHED; } @@ -589,6 +606,8 @@ static int history_cycle_exec(bContext *C, wmOperator *op) console_textview_update_rect(sc, ar); ED_area_tag_redraw(CTX_wm_area(C)); + console_scroll_bottom(ar); + return OPERATOR_FINISHED; } @@ -604,7 +623,7 @@ void CONSOLE_OT_history_cycle(wmOperatorType *ot) ot->poll= ED_operator_console_active; /* properties */ - RNA_def_boolean(ot->srna, "reverse", 0, "Reverse", "reverse cycle history"); + RNA_def_boolean(ot->srna, "reverse", 0, "Reverse", "Reverse cycle history"); } @@ -612,6 +631,7 @@ void CONSOLE_OT_history_cycle(wmOperatorType *ot) static int history_append_exec(bContext *C, wmOperator *op) { SpaceConsole *sc= CTX_wm_space_console(C); + ARegion *ar= CTX_wm_region(C); ScrArea *sa= CTX_wm_area(C); ConsoleLine *ci= console_history_verify(C); char *str= RNA_string_get_alloc(op->ptr, "text", NULL, 0); /* own this text in the new line, dont free */ @@ -637,6 +657,8 @@ static int history_append_exec(bContext *C, wmOperator *op) ED_area_tag_redraw(sa); + console_scroll_bottom(ar); + return OPERATOR_FINISHED; } @@ -825,6 +847,8 @@ static int paste_exec(bContext *C, wmOperator *UNUSED(op)) console_textview_update_rect(sc, ar); ED_area_tag_redraw(CTX_wm_area(C)); + console_scroll_bottom(ar); + return OPERATOR_FINISHED; } diff --git a/source/blender/editors/space_console/space_console.c b/source/blender/editors/space_console/space_console.c index c8fa049f5eb..5a965fc076b 100644 --- a/source/blender/editors/space_console/space_console.c +++ b/source/blender/editors/space_console/space_console.c @@ -138,8 +138,17 @@ static void console_main_area_init(wmWindowManager *wm, ARegion *ar) wmKeyMap *keymap; ListBase *lb; + const int prev_y_min= ar->v2d.cur.ymin; /* so resizing keeps the cursor visible */ + UI_view2d_region_reinit(&ar->v2d, V2D_COMMONVIEW_CUSTOM, ar->winx, ar->winy); + /* always keep the bottom part of the view aligned, less annoying */ + if(prev_y_min != ar->v2d.cur.ymin) { + const float cur_y_range= ar->v2d.cur.ymax - ar->v2d.cur.ymin; + ar->v2d.cur.ymin= prev_y_min; + ar->v2d.cur.ymax= prev_y_min + cur_y_range; + } + /* own keymap */ keymap= WM_keymap_find(wm->defaultconf, "Console", SPACE_CONSOLE, 0); WM_event_add_keymap_handler_bb(&ar->handlers, keymap, &ar->v2d.mask, &ar->winrct); diff --git a/source/blender/editors/space_file/file_ops.c b/source/blender/editors/space_file/file_ops.c index 1b0893e50e0..43d5a5c9b4b 100644 --- a/source/blender/editors/space_file/file_ops.c +++ b/source/blender/editors/space_file/file_ops.c @@ -164,22 +164,26 @@ static FileSelect file_select_do(bContext* C, int selected_idx) SpaceFile *sfile= CTX_wm_space_file(C); FileSelectParams *params = ED_fileselect_get_params(sfile); int numfiles = filelist_numfiles(sfile->files); + struct direntry* file; /* make the selected file active */ - if ( (selected_idx >= 0) && (selected_idx < numfiles)) { - struct direntry* file = filelist_file(sfile->files, selected_idx); + if ( (selected_idx >= 0) && + (selected_idx < numfiles) && + (file= filelist_file(sfile->files, selected_idx))) + { params->active_file = selected_idx; - if(file && S_ISDIR(file->type)) { + if(S_ISDIR(file->type)) { /* the path is too long and we are not going up! */ - if (strcmp(file->relname, "..") && strlen(params->dir) + strlen(file->relname) >= FILE_MAX ) - { + if (strcmp(file->relname, "..") && strlen(params->dir) + strlen(file->relname) >= FILE_MAX ) { // XXX error("Path too long, cannot enter this directory"); - } else { - if (strcmp(file->relname, "..")==0) { - /* avoids /../../ */ - BLI_parent_dir(params->dir); - } else { + } + else { + if (strcmp(file->relname, "..")==0) { + /* avoids /../../ */ + BLI_parent_dir(params->dir); + } + else { BLI_cleanup_dir(G.main->name, params->dir); strcat(params->dir, file->relname); BLI_add_slash(params->dir); @@ -189,8 +193,7 @@ static FileSelect file_select_do(bContext* C, int selected_idx) retval = FILE_SELECT_DIR; } } - else if (file) - { + else { if (file->relname) { BLI_strncpy(params->file, file->relname, FILE_MAXFILE); } diff --git a/source/blender/editors/space_graph/graph_edit.c b/source/blender/editors/space_graph/graph_edit.c index 900aa6f6197..f115fd93c2e 100644 --- a/source/blender/editors/space_graph/graph_edit.c +++ b/source/blender/editors/space_graph/graph_edit.c @@ -763,7 +763,7 @@ void GRAPH_OT_paste (wmOperatorType *ot) ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; RNA_def_enum(ot->srna, "offset", keyframe_paste_offset_items, KEYFRAME_PASTE_OFFSET_CFRA_START, "Offset", "Paste time offset of keys"); - RNA_def_enum(ot->srna, "merge", keyframe_paste_merge_items, KEYFRAME_PASTE_MERGE_MIX, "Type", "Method of merking pasted keys and existing"); + RNA_def_enum(ot->srna, "merge", keyframe_paste_merge_items, KEYFRAME_PASTE_MERGE_MIX, "Type", "Method of merging pasted keys and existing"); } /* ******************** Duplicate Keyframes Operator ************************* */ diff --git a/source/blender/editors/space_graph/graph_select.c b/source/blender/editors/space_graph/graph_select.c index b8c5d79df18..40380db03d4 100644 --- a/source/blender/editors/space_graph/graph_select.c +++ b/source/blender/editors/space_graph/graph_select.c @@ -585,7 +585,7 @@ void GRAPH_OT_select_linked (wmOperatorType *ot) /* identifiers */ ot->name = "Select Linked"; ot->idname= "GRAPH_OT_select_linked"; - ot->description = "Select keyframes occurring the same F-Curves as selected ones"; + ot->description = "Select keyframes occurring in the same F-Curves as selected ones"; /* api callbacks */ ot->exec= graphkeys_select_linked_exec; diff --git a/source/blender/editors/space_node/drawnode.c b/source/blender/editors/space_node/drawnode.c index 9ea1e8ee877..cd521f7e8c7 100644 --- a/source/blender/editors/space_node/drawnode.c +++ b/source/blender/editors/space_node/drawnode.c @@ -97,7 +97,7 @@ static void node_sync_cb(bContext *UNUSED(C), void *snode_v, void *node_v) } } -void node_socket_button_default(const bContext *C, uiBlock *block, +static void node_socket_button_default(const bContext *C, uiBlock *block, bNodeTree *ntree, bNode *node, bNodeSocket *sock, const char *name, int x, int y, int width) { @@ -135,7 +135,7 @@ static uiBlock *socket_component_menu(bContext *C, ARegion *ar, void *args_v) return block; } -void node_socket_button_components(const bContext *C, uiBlock *block, +static void node_socket_button_components(const bContext *C, uiBlock *block, bNodeTree *ntree, bNode *node, bNodeSocket *sock, const char *name, int x, int y, int width) { @@ -157,7 +157,7 @@ void node_socket_button_components(const bContext *C, uiBlock *block, uiDefBlockButN(block, socket_component_menu, args, name, x, y+1, width, NODE_DY-2, ""); } -void node_socket_button_color(const bContext *C, uiBlock *block, +static void node_socket_button_color(const bContext *C, uiBlock *block, bNodeTree *ntree, bNode *node, bNodeSocket *sock, const char *name, int x, int y, int width) { @@ -179,7 +179,7 @@ void node_socket_button_color(const bContext *C, uiBlock *block, /* ****************** BASE DRAW FUNCTIONS FOR NEW OPERATOR NODES ***************** */ -void node_draw_socket_new(bNodeSocket *sock, float size) +static void node_draw_socket_new(bNodeSocket *sock, float size) { float x=sock->locx, y=sock->locy; diff --git a/source/blender/editors/space_outliner/outliner_draw.c b/source/blender/editors/space_outliner/outliner_draw.c index 357730aff39..65ce2e71d8d 100644 --- a/source/blender/editors/space_outliner/outliner_draw.c +++ b/source/blender/editors/space_outliner/outliner_draw.c @@ -1008,6 +1008,10 @@ static void tselem_draw_icon(uiBlock *block, int xmax, float x, float y, TreeSto UI_icon_draw(x, y, ICON_MOD_SOLIDIFY); break; case eModifierType_Screw: UI_icon_draw(x, y, ICON_MOD_SCREW); break; + case eModifierType_WeightVGEdit: + case eModifierType_WeightVGMix: + case eModifierType_WeightVGProximity: + UI_icon_draw(x, y, ICON_MOD_VERTEX_WEIGHT); break; default: UI_icon_draw(x, y, ICON_DOT); break; } diff --git a/source/blender/editors/space_outliner/outliner_edit.c b/source/blender/editors/space_outliner/outliner_edit.c index 05eace0d4ef..6172273f7e1 100644 --- a/source/blender/editors/space_outliner/outliner_edit.c +++ b/source/blender/editors/space_outliner/outliner_edit.c @@ -218,7 +218,7 @@ void OUTLINER_OT_item_openclose(wmOperatorType *ot) /* Rename --------------------------------------------------- */ -void do_item_rename(ARegion *ar, TreeElement *te, TreeStoreElem *tselem, ReportList *reports) +static void do_item_rename(ARegion *ar, TreeElement *te, TreeStoreElem *tselem, ReportList *reports) { /* can't rename rna datablocks entries */ if(ELEM3(tselem->type, TSE_RNA_STRUCT, TSE_RNA_PROPERTY, TSE_RNA_ARRAY_ELEM)) @@ -765,7 +765,7 @@ static void outliner_find_panel(Scene *UNUSED(scene), ARegion *ar, SpaceOops *so } else { /* pop up panel - no previous, or user didn't want search after previous */ - strcpy(name, ""); + name[0]= '\0'; // XXX if (sbutton(name, 0, sizeof(name)-1, "Find: ") && name[0]) { // te= outliner_find_named(soops, &soops->tree, name, flags, NULL, &prevFound); // } diff --git a/source/blender/editors/space_outliner/outliner_tools.c b/source/blender/editors/space_outliner/outliner_tools.c index b2fdd34aab2..efbfbd51fb5 100644 --- a/source/blender/editors/space_outliner/outliner_tools.c +++ b/source/blender/editors/space_outliner/outliner_tools.c @@ -342,7 +342,7 @@ static void singleuser_action_cb(bContext *C, Scene *UNUSED(scene), TreeElement if (id) { IdAdtTemplate *iat = (IdAdtTemplate *)tsep->id; - PointerRNA ptr = {{0}}; + PointerRNA ptr = {{NULL}}; PropertyRNA *prop; RNA_pointer_create(&iat->id, &RNA_AnimData, iat->adt, &ptr); diff --git a/source/blender/editors/space_outliner/outliner_tree.c b/source/blender/editors/space_outliner/outliner_tree.c index 7e9eabc08db..0a1f7a3599d 100644 --- a/source/blender/editors/space_outliner/outliner_tree.c +++ b/source/blender/editors/space_outliner/outliner_tree.c @@ -473,7 +473,7 @@ static void outliner_add_object_contents(SpaceOops *soops, TreeElement *te, Tree ten= outliner_add_element(soops, &tenla->subtree, ob, tenla, TSE_POSE_CHANNEL, a); ten->name= pchan->name; ten->directdata= pchan; - pchan->prev= (bPoseChannel *)ten; + pchan->temp= (void *)ten; if(pchan->constraints.first) { //Object *target; @@ -506,19 +506,13 @@ static void outliner_add_object_contents(SpaceOops *soops, TreeElement *te, Tree pchan= (bPoseChannel *)ten->directdata; if(pchan->parent) { BLI_remlink(&tenla->subtree, ten); - par= (TreeElement *)pchan->parent->prev; + par= (TreeElement *)pchan->parent->temp; BLI_addtail(&par->subtree, ten); ten->parent= par; } } ten= nten; } - /* restore prev pointers */ - pchan= ob->pose->chanbase.first; - if(pchan) pchan->prev= NULL; - for(; pchan; pchan= pchan->next) { - if(pchan->next) pchan->next->prev= pchan; - } } /* Pose Groups */ @@ -775,7 +769,7 @@ static void outliner_add_id_contents(SpaceOops *soops, TreeElement *te, TreeStor ebone->temp= ten; } /* make hierarchy */ - ten= te->subtree.first; + ten= arm->edbo->first ? ((EditBone *)arm->edbo->first)->temp : NULL; while(ten) { TreeElement *nten= ten->next, *par; ebone= (EditBone *)ten->directdata; diff --git a/source/blender/editors/space_sequencer/sequencer_edit.c b/source/blender/editors/space_sequencer/sequencer_edit.c index e7673651546..c3165adaf49 100644 --- a/source/blender/editors/space_sequencer/sequencer_edit.c +++ b/source/blender/editors/space_sequencer/sequencer_edit.c @@ -188,7 +188,7 @@ static void proxy_endjob(void *UNUSED(customdata)) } -void seq_proxy_build_job(const bContext *C, Sequence * seq) +static void seq_proxy_build_job(const bContext *C, Sequence * seq) { wmJob * steve; ProxyJob *pj; diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c index 7a10a7216d9..5bbc6a24761 100644 --- a/source/blender/editors/space_view3d/drawobject.c +++ b/source/blender/editors/space_view3d/drawobject.c @@ -259,7 +259,9 @@ static float cube[8][3] = { /* ----------------- OpenGL Circle Drawing - Tables for Optimised Drawing Speed ------------------ */ /* 32 values of sin function (still same result!) */ -static float sinval[32] = { +#define CIRCLE_RESOL 32 + +static const float sinval[CIRCLE_RESOL] = { 0.00000000, 0.20129852, 0.39435585, @@ -295,7 +297,7 @@ static float sinval[32] = { }; /* 32 values of cos function (still same result!) */ -static float cosval[32] ={ +static const float cosval[CIRCLE_RESOL] = { 1.00000000, 0.97952994, 0.91895781, @@ -613,28 +615,39 @@ static void draw_empty_image(Object *ob) glPopMatrix(); } -void drawcircball(int mode, const float cent[3], float rad, float tmat[][4]) +static void circball_array_fill(float verts[CIRCLE_RESOL][3], const float cent[3], float rad, float tmat[][4]) { - float vec[3], vx[3], vy[3]; - int a, tot=32; + float vx[3], vy[3]; + float *viter= (float *)verts; + unsigned int a; mul_v3_v3fl(vx, tmat[0], rad); mul_v3_v3fl(vy, tmat[1], rad); - glBegin(mode); - for(a=0; a<tot; a++) { - vec[0]= cent[0] + *(sinval+a) * vx[0] + *(cosval+a) * vy[0]; - vec[1]= cent[1] + *(sinval+a) * vx[1] + *(cosval+a) * vy[1]; - vec[2]= cent[2] + *(sinval+a) * vx[2] + *(cosval+a) * vy[2]; - glVertex3fv(vec); + for (a=0; a < CIRCLE_RESOL; a++, viter += 3) { + viter[0]= cent[0] + sinval[a] * vx[0] + cosval[a] * vy[0]; + viter[1]= cent[1] + sinval[a] * vx[1] + cosval[a] * vy[1]; + viter[2]= cent[2] + sinval[a] * vx[2] + cosval[a] * vy[2]; } - glEnd(); +} + +void drawcircball(int mode, const float cent[3], float rad, float tmat[][4]) +{ + float verts[CIRCLE_RESOL][3]; + + circball_array_fill(verts, cent, rad, tmat); + + glEnableClientState(GL_VERTEX_ARRAY); + glVertexPointer(3, GL_FLOAT, 0, verts); + glDrawArrays(mode, 0, CIRCLE_RESOL); + glDisableClientState(GL_VERTEX_ARRAY); } /* circle for object centers, special_color is for library or ob users */ static void drawcentercircle(View3D *v3d, RegionView3D *rv3d, const float co[3], int selstate, int special_color) { const float size= ED_view3d_pixel_size(rv3d, co) * (float)U.obcenter_dia * 0.5f; + float verts[CIRCLE_RESOL][3]; /* using gldepthfunc guarantees that it does write z values, but not checks for it, so centers remain visible independt order of drawing */ if(v3d->zbuf) glDepthFunc(GL_ALWAYS); @@ -650,12 +663,25 @@ static void drawcentercircle(View3D *v3d, RegionView3D *rv3d, const float co[3], else if (selstate == SELECT) UI_ThemeColorShadeAlpha(TH_SELECT, 0, -80); else if (selstate == DESELECT) UI_ThemeColorShadeAlpha(TH_TRANSFORM, 0, -80); } - drawcircball(GL_POLYGON, co, size, rv3d->viewinv); - + + circball_array_fill(verts, co, size, rv3d->viewinv); + + /* enable vertex array */ + glEnableClientState(GL_VERTEX_ARRAY); + glVertexPointer(3, GL_FLOAT, 0, verts); + + /* 1. draw filled, blended polygon */ + glDrawArrays(GL_POLYGON, 0, CIRCLE_RESOL); + + /* 2. draw outline */ UI_ThemeColorShadeAlpha(TH_WIRE, 0, -30); - drawcircball(GL_LINE_LOOP, co, size, rv3d->viewinv); - + glDrawArrays(GL_LINE_LOOP, 0, CIRCLE_RESOL); + + /* finishe up */ + glDisableClientState(GL_VERTEX_ARRAY); + glDisable(GL_BLEND); + if(v3d->zbuf) glDepthFunc(GL_LEQUAL); } @@ -4587,16 +4613,22 @@ static void tekenhandlesN(Nurb *nu, short sel, short hide_handles) { BezTriple *bezt; float *fp; - int basecol; int a; - + if(nu->hide || hide_handles) return; glBegin(GL_LINES); - + if(nu->type == CU_BEZIER) { - if(sel) basecol= TH_HANDLE_SEL_FREE; - else basecol= TH_HANDLE_FREE; + +#define TH_HANDLE_COL_TOT ((TH_HANDLE_SEL_FREE - TH_HANDLE_FREE) + 1) + /* use MIN2 when indexing to ensure newer files dont read outside the array */ + unsigned char handle_cols[TH_HANDLE_COL_TOT][3]; + const int basecol= sel ? TH_HANDLE_SEL_FREE : TH_HANDLE_FREE; + + for (a=0; a < TH_HANDLE_COL_TOT; a++) { + UI_GetThemeColor3ubv(basecol + a, handle_cols[a]); + } bezt= nu->bezt; a= nu->pntsu; @@ -4605,31 +4637,34 @@ static void tekenhandlesN(Nurb *nu, short sel, short hide_handles) if( (bezt->f2 & SELECT)==sel) { fp= bezt->vec[0]; - UI_ThemeColor(basecol + bezt->h1); + glColor3ubv(handle_cols[MIN2(bezt->h1, TH_HANDLE_COL_TOT-1)]); glVertex3fv(fp); glVertex3fv(fp+3); - UI_ThemeColor(basecol + bezt->h2); + glColor3ubv(handle_cols[MIN2(bezt->h2, TH_HANDLE_COL_TOT-1)]); glVertex3fv(fp+3); glVertex3fv(fp+6); } else if( (bezt->f1 & SELECT)==sel) { fp= bezt->vec[0]; - UI_ThemeColor(basecol + bezt->h1); + glColor3ubv(handle_cols[MIN2(bezt->h1, TH_HANDLE_COL_TOT-1)]); glVertex3fv(fp); glVertex3fv(fp+3); } else if( (bezt->f3 & SELECT)==sel) { fp= bezt->vec[1]; - UI_ThemeColor(basecol + bezt->h2); + glColor3ubv(handle_cols[MIN2(bezt->h2, TH_HANDLE_COL_TOT-1)]); glVertex3fv(fp); glVertex3fv(fp+3); } } bezt++; } + +#undef TH_HANDLE_COL_TOT + } glEnd(); } @@ -5097,7 +5132,7 @@ static void curve_draw_speed(Scene *scene, Object *ob) #endif // XXX old animation system stuff -static void draw_textcurs(float textcurs[][2]) +static void draw_textcurs(float textcurs[4][2]) { cpack(0); @@ -5114,12 +5149,13 @@ static void draw_textcurs(float textcurs[][2]) static void drawspiral(const float cent[3], float rad, float tmat[][4], int start) { float vec[3], vx[3], vy[3]; - int a, tot=32; - char inverse=0; - + const float tot_inv= (1.0f / (float)CIRCLE_RESOL); + int a; + char inverse= FALSE; + if (start < 0) { - inverse = 1; - start *= -1; + inverse = TRUE; + start= -start; } mul_v3_v3fl(vx, tmat[0], rad); @@ -5128,31 +5164,31 @@ static void drawspiral(const float cent[3], float rad, float tmat[][4], int star copy_v3_v3(vec, cent); if (inverse==0) { - for(a=0; a<tot; a++) { + for(a=0; a<CIRCLE_RESOL; a++) { if (a+start>31) start=-a + 1; glBegin(GL_LINES); glVertex3fv(vec); - vec[0]= cent[0] + *(sinval+a+start) * (vx[0] * (float)a/(float)tot) + *(cosval+a+start) * (vy[0] * (float)a/(float)tot); - vec[1]= cent[1] + *(sinval+a+start) * (vx[1] * (float)a/(float)tot) + *(cosval+a+start) * (vy[1] * (float)a/(float)tot); - vec[2]= cent[2] + *(sinval+a+start) * (vx[2] * (float)a/(float)tot) + *(cosval+a+start) * (vy[2] * (float)a/(float)tot); + vec[0]= cent[0] + sinval[a+start] * (vx[0] * (float)a * tot_inv) + cosval[a+start] * (vy[0] * (float)a * tot_inv); + vec[1]= cent[1] + sinval[a+start] * (vx[1] * (float)a * tot_inv) + cosval[a+start] * (vy[1] * (float)a * tot_inv); + vec[2]= cent[2] + sinval[a+start] * (vx[2] * (float)a * tot_inv) + cosval[a+start] * (vy[2] * (float)a * tot_inv); glVertex3fv(vec); glEnd(); } } else { a=0; - vec[0]= cent[0] + *(sinval+a+start) * (vx[0] * (float)(-a+31)/(float)tot) + *(cosval+a+start) * (vy[0] * (float)(-a+31)/(float)tot); - vec[1]= cent[1] + *(sinval+a+start) * (vx[1] * (float)(-a+31)/(float)tot) + *(cosval+a+start) * (vy[1] * (float)(-a+31)/(float)tot); - vec[2]= cent[2] + *(sinval+a+start) * (vx[2] * (float)(-a+31)/(float)tot) + *(cosval+a+start) * (vy[2] * (float)(-a+31)/(float)tot); - for(a=0; a<tot; a++) { + vec[0]= cent[0] + sinval[a+start] * (vx[0] * (float)(-a+31) * tot_inv) + cosval[a+start] * (vy[0] * (float)(-a+31) * tot_inv); + vec[1]= cent[1] + sinval[a+start] * (vx[1] * (float)(-a+31) * tot_inv) + cosval[a+start] * (vy[1] * (float)(-a+31) * tot_inv); + vec[2]= cent[2] + sinval[a+start] * (vx[2] * (float)(-a+31) * tot_inv) + cosval[a+start] * (vy[2] * (float)(-a+31) * tot_inv); + for(a=0; a<CIRCLE_RESOL; a++) { if (a+start>31) start=-a + 1; glBegin(GL_LINES); glVertex3fv(vec); - vec[0]= cent[0] + *(sinval+a+start) * (vx[0] * (float)(-a+31)/(float)tot) + *(cosval+a+start) * (vy[0] * (float)(-a+31)/(float)tot); - vec[1]= cent[1] + *(sinval+a+start) * (vx[1] * (float)(-a+31)/(float)tot) + *(cosval+a+start) * (vy[1] * (float)(-a+31)/(float)tot); - vec[2]= cent[2] + *(sinval+a+start) * (vx[2] * (float)(-a+31)/(float)tot) + *(cosval+a+start) * (vy[2] * (float)(-a+31)/(float)tot); + vec[0]= cent[0] + sinval[a+start] * (vx[0] * (float)(-a+31) * tot_inv) + cosval[a+start] * (vy[0] * (float)(-a+31) * tot_inv); + vec[1]= cent[1] + sinval[a+start] * (vx[1] * (float)(-a+31) * tot_inv) + cosval[a+start] * (vy[1] * (float)(-a+31) * tot_inv); + vec[2]= cent[2] + sinval[a+start] * (vx[2] * (float)(-a+31) * tot_inv) + cosval[a+start] * (vy[2] * (float)(-a+31) * tot_inv); glVertex3fv(vec); glEnd(); } @@ -5170,9 +5206,9 @@ static void drawcircle_size(float size) glBegin(GL_LINE_LOOP); /* coordinates are: cos(degrees*11.25)=x, sin(degrees*11.25)=y, 0.0f=z */ - for (degrees=0; degrees<32; degrees++) { - x= *(cosval + degrees); - y= *(sinval + degrees); + for (degrees=0; degrees<CIRCLE_RESOL; degrees++) { + x= cosval[degrees]; + y= sinval[degrees]; glVertex3f(x*size, 0.0f, y*size); } @@ -5440,8 +5476,7 @@ static void draw_forcefield(Scene *scene, Object *ob, RegionView3D *rv3d) unit_m4(tmat); - radius=(pd->flag&PFIELD_USEMAXR)?pd->maxrad:1.0f; - radius*=(float)M_PI/180.0f; + radius= DEG2RADF((pd->flag&PFIELD_USEMAXR) ? pd->maxrad : 1.0f); distance=(pd->flag&PFIELD_USEMAX)?pd->maxdist:0.0f; if(pd->flag & (PFIELD_USEMAX|PFIELD_USEMAXR)){ @@ -5450,8 +5485,7 @@ static void draw_forcefield(Scene *scene, Object *ob, RegionView3D *rv3d) drawcone(vec, distance * sinf(radius),-distance * cosf(radius),tmat); } - radius=(pd->flag&PFIELD_USEMINR)?pd->minrad:1.0f; - radius*=(float)M_PI/180.0f; + radius= DEG2RADF((pd->flag&PFIELD_USEMINR) ? pd->minrad : 1.0f); distance=(pd->flag&PFIELD_USEMIN)?pd->mindist:0.0f; if(pd->flag & (PFIELD_USEMIN|PFIELD_USEMINR)){ diff --git a/source/blender/editors/space_view3d/view3d_buttons.c b/source/blender/editors/space_view3d/view3d_buttons.c index 50c587194b7..6c69e816b30 100644 --- a/source/blender/editors/space_view3d/view3d_buttons.c +++ b/source/blender/editors/space_view3d/view3d_buttons.c @@ -887,9 +887,9 @@ static void v3d_posearmature_buts(uiLayout *layout, Object *ob) quat_to_eul( tfp->ob_eul,pchan->quat); else copy_v3_v3(tfp->ob_eul, pchan->eul); - tfp->ob_eul[0]*= 180.0/M_PI; - tfp->ob_eul[1]*= 180.0/M_PI; - tfp->ob_eul[2]*= 180.0/M_PI; + tfp->ob_eul[0]*= RAD2DEGF(1.0f); + tfp->ob_eul[1]*= RAD2DEGF(1.0f); + tfp->ob_eul[2]*= RAD2DEGF(1.0f); uiDefBut(block, LABEL, 0, "Location:", 0, 240, 100, 20, 0, 0, 0, 0, 0, ""); uiBlockBeginAlign(block); @@ -1097,9 +1097,9 @@ static void do_view3d_region_buttons(bContext *C, void *UNUSED(index), int event if (!pchan) return; /* make a copy to eul[3], to allow TAB on buttons to work */ - eul[0]= (float)M_PI*tfp->ob_eul[0]/180.0f; - eul[1]= (float)M_PI*tfp->ob_eul[1]/180.0f; - eul[2]= (float)M_PI*tfp->ob_eul[2]/180.0f; + eul[0]= DEG2RADF(tfp->ob_eul[0]); + eul[1]= DEG2RADF(tfp->ob_eul[1]); + eul[2]= DEG2RADF(tfp->ob_eul[2]); if (pchan->rotmode == ROT_MODE_AXISANGLE) { float quat[4]; diff --git a/source/blender/editors/space_view3d/view3d_view.c b/source/blender/editors/space_view3d/view3d_view.c index 44ae6837aa2..c7feaebcddc 100644 --- a/source/blender/editors/space_view3d/view3d_view.c +++ b/source/blender/editors/space_view3d/view3d_view.c @@ -525,8 +525,8 @@ void ED_view3d_win_to_segment_clip(ARegion *ar, View3D *v3d, const float mval[2] ED_view3d_win_to_vector(ar, mval, vec); copy_v3_v3(ray_start, rv3d->viewinv[3]); - VECADDFAC(ray_start, rv3d->viewinv[3], vec, v3d->near); - VECADDFAC(ray_end, rv3d->viewinv[3], vec, v3d->far); + madd_v3_v3v3fl(ray_start, rv3d->viewinv[3], vec, v3d->near); + madd_v3_v3v3fl(ray_end, rv3d->viewinv[3], vec, v3d->far); } else { float vec[4]; @@ -537,8 +537,8 @@ void ED_view3d_win_to_segment_clip(ARegion *ar, View3D *v3d, const float mval[2] mul_m4_v4(rv3d->persinv, vec); - VECADDFAC(ray_start, vec, rv3d->viewinv[2], 1000.0f); - VECADDFAC(ray_end, vec, rv3d->viewinv[2], -1000.0f); + madd_v3_v3v3fl(ray_start, vec, rv3d->viewinv[2], 1000.0f); + madd_v3_v3v3fl(ray_end, vec, rv3d->viewinv[2], -1000.0f); } /* clipping */ diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c index 82598e0b5c6..c8b95727304 100644 --- a/source/blender/editors/transform/transform.c +++ b/source/blender/editors/transform/transform.c @@ -3371,10 +3371,10 @@ static void headerTranslation(TransInfo *t, float vec[3], char *str) { if(chainlen) sprintf(autoik, "AutoIK-Len: %d", chainlen); else - strcpy(autoik, ""); + autoik[0]= '\0'; } else - strcpy(autoik, ""); + autoik[0]= '\0'; if (t->con.mode & CON_APPLY) { switch(t->num.idx_max) { diff --git a/source/blender/editors/transform/transform_generics.c b/source/blender/editors/transform/transform_generics.c index b187ca0650c..38776b51c62 100644 --- a/source/blender/editors/transform/transform_generics.c +++ b/source/blender/editors/transform/transform_generics.c @@ -1666,13 +1666,13 @@ void calculatePropRatio(TransInfo *t) strcpy(t->proptext, "(Random)"); break; default: - strcpy(t->proptext, ""); + t->proptext[0]= '\0'; } } else { for(i = 0 ; i < t->total; i++, td++) { td->factor = 1.0; } - strcpy(t->proptext, ""); + t->proptext[0]= '\0'; } } diff --git a/source/blender/editors/uvedit/uvedit_draw.c b/source/blender/editors/uvedit/uvedit_draw.c index 453bea0969b..d5a94c9b56a 100644 --- a/source/blender/editors/uvedit/uvedit_draw.c +++ b/source/blender/editors/uvedit/uvedit_draw.c @@ -275,7 +275,7 @@ static void draw_uvs_stretch(SpaceImage *sima, Scene *scene, EditMesh *em, MTFac VECSUB2D(av4, tf_uv[2], tf_uv[3]); normalize_v2(av4); /* This is the correct angle however we are only comparing angles - * uvang1 = 90-((angle_normalized_v2v2(av1, av2) * 180.0/M_PI)-90);*/ + * uvang1 = 90-((angle_normalized_v2v2(av1, av2) * RAD2DEGF(1.0f))-90);*/ uvang1 = angle_normalized_v2v2(av1, av2); uvang2 = angle_normalized_v2v2(av2, av3); uvang3 = angle_normalized_v2v2(av3, av4); @@ -288,7 +288,7 @@ static void draw_uvs_stretch(SpaceImage *sima, Scene *scene, EditMesh *em, MTFac VECSUB(av4, efa->v3->co, efa->v4->co); normalize_v3(av4); /* This is the correct angle however we are only comparing angles - * ang1 = 90-((angle_normalized_v3v3(av1, av2) * 180.0/M_PI)-90);*/ + * ang1 = 90-((angle_normalized_v3v3(av1, av2) * RAD2DEGF(1.0f))-90);*/ ang1 = angle_normalized_v3v3(av1, av2); ang2 = angle_normalized_v3v3(av2, av3); ang3 = angle_normalized_v3v3(av3, av4); diff --git a/source/blender/gpu/intern/gpu_buffers.c b/source/blender/gpu/intern/gpu_buffers.c index 4d4561e66db..ce3a378ea00 100644 --- a/source/blender/gpu/intern/gpu_buffers.c +++ b/source/blender/gpu/intern/gpu_buffers.c @@ -240,7 +240,7 @@ GPUBuffer *GPU_buffer_alloc(int size) size */ glGenBuffersARB(1, &buf->id); glBindBufferARB(GL_ARRAY_BUFFER_ARB, buf->id); - glBufferDataARB(GL_ARRAY_BUFFER_ARB, size, 0, GL_STATIC_DRAW_ARB); + glBufferDataARB(GL_ARRAY_BUFFER_ARB, size, NULL, GL_STATIC_DRAW_ARB); glBindBufferARB(GL_ARRAY_BUFFER_ARB, 0); } else { @@ -493,7 +493,7 @@ static GPUBuffer *gpu_buffer_setup(DerivedMesh *dm, GPUDrawObject *object, /* nothing to do for legacy mode */ if(dm->drawObject->legacy) - return 0; + return NULL; cur_index_per_mat = MEM_mallocN(sizeof(int)*object->totmaterial, "GPU_buffer_setup.cur_index_per_mat"); @@ -513,7 +513,7 @@ static GPUBuffer *gpu_buffer_setup(DerivedMesh *dm, GPUDrawObject *object, /* bind the buffer and discard previous data, avoids stalling gpu */ glBindBufferARB(target, buffer->id); - glBufferDataARB(target, buffer->size, 0, GL_STATIC_DRAW_ARB); + glBufferDataARB(target, buffer->size, NULL, GL_STATIC_DRAW_ARB); /* attempt to map the buffer */ if(!(varray = glMapBufferARB(target, GL_WRITE_ONLY_ARB))) { diff --git a/source/blender/gpu/intern/gpu_extensions.c b/source/blender/gpu/intern/gpu_extensions.c index fb9f21cde8c..9cd6240d37d 100644 --- a/source/blender/gpu/intern/gpu_extensions.c +++ b/source/blender/gpu/intern/gpu_extensions.c @@ -514,8 +514,7 @@ GPUTexture *GPU_texture_create_3D(int w, int h, int depth, float *fpixels) if (pixels) MEM_freeN(pixels); - if (tex) - GPU_texture_unbind(tex); + GPU_texture_unbind(tex); return tex; } diff --git a/source/blender/imbuf/intern/filter.c b/source/blender/imbuf/intern/filter.c index 2677913caed..3719242aaba 100644 --- a/source/blender/imbuf/intern/filter.c +++ b/source/blender/imbuf/intern/filter.c @@ -518,7 +518,7 @@ void IMB_makemipmap(ImBuf *ibuf, int use_filter) hbuf= ibuf->mipmap[curmap]; hbuf->miplevel= curmap+1; - if(!hbuf || (hbuf->x <= 2 && hbuf->y <= 2)) + if(hbuf->x <= 2 && hbuf->y <= 2) break; curmap++; diff --git a/source/blender/imbuf/intern/indexer.c b/source/blender/imbuf/intern/indexer.c index 3528318ba81..2e45c0eb07a 100644 --- a/source/blender/imbuf/intern/indexer.c +++ b/source/blender/imbuf/intern/indexer.c @@ -159,24 +159,24 @@ struct anim_index * IMB_indexer_open(const char * name) int i; if (!fp) { - return 0; + return NULL; } if (fread(header, 12, 1, fp) != 1) { fclose(fp); - return 0; + return NULL; } header[12] = 0; if (memcmp(header, magic, 8) != 0) { fclose(fp); - return 0; + return NULL; } if (atoi(header+9) != INDEX_FILE_VERSION) { fclose(fp); - return 0; + return NULL; } idx = MEM_callocN( sizeof(struct anim_index), "anim_index"); @@ -916,7 +916,7 @@ static AviMovie * alloc_proxy_output_avi( if (AVI_open_compress (filename, avi, 1, format) != AVI_ERROR_NONE) { MEM_freeN(avi); - return 0; + return NULL; } AVI_set_compress_option (avi, AVI_OPTION_TYPE_MAIN, 0, AVI_OPTION_WIDTH, &x); @@ -1000,7 +1000,7 @@ static void index_rebuild_fallback(struct anim * anim, s_ibuf->rect, x * y * 4); /* note that libavi free's the buffer... */ - s_ibuf->rect = 0; + s_ibuf->rect = NULL; IMB_freeImBuf(s_ibuf); } @@ -1056,14 +1056,14 @@ void IMB_free_indices(struct anim * anim) for (i = 0; i < IMB_PROXY_MAX_SLOT; i++) { if (anim->proxy_anim[i]) { IMB_close_anim(anim->proxy_anim[i]); - anim->proxy_anim[i] = 0; + anim->proxy_anim[i] = NULL; } } for (i = 0; i < IMB_TC_MAX_SLOT; i++) { if (anim->curr_idx[i]) { IMB_indexer_close(anim->curr_idx[i]); - anim->curr_idx[i] = 0; + anim->curr_idx[i] = NULL; } } @@ -1116,7 +1116,7 @@ struct anim_index * IMB_anim_open_index( } if (anim->indices_tried & tc) { - return 0; + return NULL; } get_tc_filename(anim, tc, fname); diff --git a/source/blender/imbuf/intern/iris.c b/source/blender/imbuf/intern/iris.c index adbf3659d3a..c6aaf336fb7 100644 --- a/source/blender/imbuf/intern/iris.c +++ b/source/blender/imbuf/intern/iris.c @@ -515,14 +515,15 @@ struct ImBuf *imb_loadiris(unsigned char *mem, size_t size, int flags) } - ibuf->ftype = IMAGIC; - ibuf->profile = IB_PROFILE_SRGB; - - test_endian_zbuf(ibuf); - if (ibuf) { - if (ibuf->rect) + ibuf->ftype = IMAGIC; + ibuf->profile = IB_PROFILE_SRGB; + + test_endian_zbuf(ibuf); + + if (ibuf->rect) { IMB_convert_rgba_to_abgr(ibuf); + } } return(ibuf); diff --git a/source/blender/imbuf/intern/jp2.c b/source/blender/imbuf/intern/jp2.c index a4eae492a58..af7f098585e 100644 --- a/source/blender/imbuf/intern/jp2.c +++ b/source/blender/imbuf/intern/jp2.c @@ -97,7 +97,7 @@ static void info_callback(const char *msg, void *client_data) { struct ImBuf *imb_jp2_decode(unsigned char *mem, size_t size, int flags) { - struct ImBuf *ibuf = 0; + struct ImBuf *ibuf = NULL; int use_float = 0; /* for precision higher then 8 use float */ long signed_offsets[4]= {0, 0, 0, 0}; @@ -117,7 +117,7 @@ struct ImBuf *imb_jp2_decode(unsigned char *mem, size_t size, int flags) opj_dinfo_t* dinfo = NULL; /* handle to a decompressor */ opj_cio_t *cio = NULL; - if (check_jp2(mem) == 0) return(0); + if (check_jp2(mem) == 0) return(NULL); /* configure the event callbacks (not required) */ memset(&event_mgr, 0, sizeof(opj_event_mgr_t)); diff --git a/source/blender/makesdna/DNA_action_types.h b/source/blender/makesdna/DNA_action_types.h index a820e59779f..492dd34caa6 100644 --- a/source/blender/makesdna/DNA_action_types.h +++ b/source/blender/makesdna/DNA_action_types.h @@ -188,18 +188,13 @@ typedef struct bPoseChannel { char name[32]; /* Channels need longer names than normal blender objects */ short flag; /* dynamic, for detecting transform changes */ - short constflag; /* for quick detecting which constraints affect this channel */ short ikflag; /* settings for IK bones */ - short selectflag; /* copy of bone flag, so you can work with library armatures, not for runtime use */ short protectflag; /* protect channels from being transformed */ short agrp_index; /* index of action-group this bone belongs to (0 = default/no group) */ - -// XXX depreceated.... old animation system (armature only viz) ---- - int pathlen; /* for drawing paths, the amount of frames */ - int pathsf; /* for drawing paths, the start frame number */ - int pathef; /* for drawing paths, the end frame number */ -// XXX end of depreceated code ------------------------------------- - + char constflag; /* for quick detecting which constraints affect this channel */ + char selectflag; /* copy of bone flag, so you can work with library armatures, not for runtime use */ + char pad0[6]; + struct Bone *bone; /* set on read file or rebuild pose */ struct bPoseChannel *parent; /* set on read file or rebuild pose */ struct bPoseChannel *child; /* set on read file or rebuild pose, the 'ik' child, for b-bones */ @@ -233,7 +228,7 @@ typedef struct bPoseChannel { float ikrotweight; /* weight of joint rotation constraint */ float iklinweight; /* weight of joint stretch constraint */ - float *path; /* totpath x 3 x float */ // XXX depreceated... old animation system (armature only viz) + void *temp; /* use for outliner */ } bPoseChannel; diff --git a/source/blender/makesdna/DNA_node_types.h b/source/blender/makesdna/DNA_node_types.h index bac1e3cd8ca..4cfd0b56b70 100644 --- a/source/blender/makesdna/DNA_node_types.h +++ b/source/blender/makesdna/DNA_node_types.h @@ -103,10 +103,11 @@ typedef struct bNodeSocket { #define SOCK_FLOAT 0 #define SOCK_VECTOR 1 #define SOCK_RGBA 2 -#define SOCK_INT 3 +#define SOCK_SHADER 3 #define SOCK_BOOLEAN 4 #define SOCK_MESH 5 -#define NUM_SOCKET_TYPES 6 /* must be last! */ +#define SOCK_INT 6 +#define NUM_SOCKET_TYPES 7 /* must be last! */ /* socket side (input/output) */ #define SOCK_IN 1 @@ -123,6 +124,10 @@ typedef struct bNodeSocket { #define SOCK_DYNAMIC 16 /* group socket should not be exposed */ #define SOCK_INTERNAL 32 + /* socket collapsed in UI */ +#define SOCK_COLLAPSED 64 + /* hide socket value, if it gets auto default */ +#define SOCK_HIDE_VALUE 128 typedef struct bNodePreview { unsigned char *rect; diff --git a/source/blender/makesrna/intern/makesrna.c b/source/blender/makesrna/intern/makesrna.c index bc30210bfbb..23100fa8bd7 100644 --- a/source/blender/makesrna/intern/makesrna.c +++ b/source/blender/makesrna/intern/makesrna.c @@ -522,11 +522,14 @@ static char *rna_def_property_get_func(FILE *f, StructRNA *srna, PropertyRNA *pr fprintf(f, " %s(ptr, value);\n", manualfunc); } else { + const PropertySubType subtype= prop->subtype; + const char *string_copy_func= (subtype==PROP_FILEPATH || subtype==PROP_DIRPATH || subtype==PROP_FILENAME) ? "BLI_strncpy" : "BLI_strncpy_utf8"; + rna_print_data_get(f, dp); if(sprop->maxlength) - fprintf(f, " BLI_strncpy(value, data->%s, %d);\n", dp->dnaname, sprop->maxlength); + fprintf(f, " %s(value, data->%s, %d);\n", string_copy_func, dp->dnaname, sprop->maxlength); else - fprintf(f, " BLI_strncpy(value, data->%s, sizeof(data->%s));\n", dp->dnaname, dp->dnaname); + fprintf(f, " %s(value, data->%s, sizeof(data->%s));\n", string_copy_func, dp->dnaname, dp->dnaname); } fprintf(f, "}\n\n"); break; @@ -734,11 +737,14 @@ static char *rna_def_property_set_func(FILE *f, StructRNA *srna, PropertyRNA *pr fprintf(f, " %s(ptr, value);\n", manualfunc); } else { + const PropertySubType subtype= prop->subtype; + const char *string_copy_func= (subtype==PROP_FILEPATH || subtype==PROP_DIRPATH || subtype==PROP_FILENAME) ? "BLI_strncpy" : "BLI_strncpy_utf8"; + rna_print_data_get(f, dp); if(sprop->maxlength) - fprintf(f, " BLI_strncpy(data->%s, value, %d);\n", dp->dnaname, sprop->maxlength); + fprintf(f, " %s(data->%s, value, %d);\n", string_copy_func, dp->dnaname, sprop->maxlength); else - fprintf(f, " BLI_strncpy(data->%s, value, sizeof(data->%s));\n", dp->dnaname, dp->dnaname); + fprintf(f, " %s(data->%s, value, sizeof(data->%s));\n", string_copy_func, dp->dnaname, dp->dnaname); } fprintf(f, "}\n\n"); break; diff --git a/source/blender/makesrna/intern/rna_ID.c b/source/blender/makesrna/intern/rna_ID.c index 82217cdc3e4..05786cedeac 100644 --- a/source/blender/makesrna/intern/rna_ID.c +++ b/source/blender/makesrna/intern/rna_ID.c @@ -99,7 +99,7 @@ int rna_ID_name_length(PointerRNA *ptr) void rna_ID_name_set(PointerRNA *ptr, const char *value) { ID *id= (ID*)ptr->data; - BLI_strncpy(id->name+2, value, sizeof(id->name)-2); + BLI_strncpy_utf8(id->name+2, value, sizeof(id->name)-2); test_idbutton(id->name+2); } diff --git a/source/blender/makesrna/intern/rna_action.c b/source/blender/makesrna/intern/rna_action.c index 815a9c92968..53e1bf7e6f6 100644 --- a/source/blender/makesrna/intern/rna_action.c +++ b/source/blender/makesrna/intern/rna_action.c @@ -137,7 +137,7 @@ static TimeMarker *rna_Action_pose_markers_new(bAction *act, ReportList *reports TimeMarker *marker = MEM_callocN(sizeof(TimeMarker), "TimeMarker"); marker->flag= 1; marker->frame= 1; - BLI_strncpy(marker->name, name, sizeof(marker->name)); + BLI_strncpy_utf8(marker->name, name, sizeof(marker->name)); BLI_addtail(&act->markers, marker); return marker; } diff --git a/source/blender/makesrna/intern/rna_actuator.c b/source/blender/makesrna/intern/rna_actuator.c index 7356af05dcb..6aff68a9c09 100644 --- a/source/blender/makesrna/intern/rna_actuator.c +++ b/source/blender/makesrna/intern/rna_actuator.c @@ -1931,9 +1931,9 @@ static void rna_def_steering_actuator(BlenderRNA *brna) {1, "X", 0, "X", ""}, {2, "Y", 0, "Y", ""}, {3, "Z", 0, "Z", ""}, - {4, "-X", 0, "-X", ""}, - {5, "-Y", 0, "-Y", ""}, - {6, "-Z", 0, "-Z", ""}, + {4, "NEG_X", 0, "-X", ""}, + {5, "NEG_Y", 0, "-Y", ""}, + {6, "NEG_Z", 0, "-Z", ""}, {0, NULL, 0, NULL, NULL}}; srna= RNA_def_struct(brna, "SteeringActuator", "Actuator"); diff --git a/source/blender/makesrna/intern/rna_animation.c b/source/blender/makesrna/intern/rna_animation.c index 0395a54be8e..2f5f22c52d5 100644 --- a/source/blender/makesrna/intern/rna_animation.c +++ b/source/blender/makesrna/intern/rna_animation.c @@ -252,7 +252,7 @@ static void rna_ksPath_RnaPath_get(PointerRNA *ptr, char *value) if (ksp->rna_path) strcpy(value, ksp->rna_path); else - strcpy(value, ""); + value[0]= '\0'; } static int rna_ksPath_RnaPath_length(PointerRNA *ptr) diff --git a/source/blender/makesrna/intern/rna_armature.c b/source/blender/makesrna/intern/rna_armature.c index e2399b5b57c..4ed5d2a125a 100644 --- a/source/blender/makesrna/intern/rna_armature.c +++ b/source/blender/makesrna/intern/rna_armature.c @@ -253,7 +253,7 @@ static void rna_EditBone_name_set(PointerRNA *ptr, const char *value) char oldname[sizeof(ebone->name)], newname[sizeof(ebone->name)]; /* need to be on the stack */ - BLI_strncpy(newname, value, sizeof(ebone->name)); + BLI_strncpy_utf8(newname, value, sizeof(ebone->name)); BLI_strncpy(oldname, ebone->name, sizeof(ebone->name)); ED_armature_bone_rename(arm, oldname, newname); @@ -266,7 +266,7 @@ static void rna_Bone_name_set(PointerRNA *ptr, const char *value) char oldname[sizeof(bone->name)], newname[sizeof(bone->name)]; /* need to be on the stack */ - BLI_strncpy(newname, value, sizeof(bone->name)); + BLI_strncpy_utf8(newname, value, sizeof(bone->name)); BLI_strncpy(oldname, bone->name, sizeof(bone->name)); ED_armature_bone_rename(arm, oldname, newname); diff --git a/source/blender/makesrna/intern/rna_constraint.c b/source/blender/makesrna/intern/rna_constraint.c index 22d9a19f933..fdbb4f09f93 100644 --- a/source/blender/makesrna/intern/rna_constraint.c +++ b/source/blender/makesrna/intern/rna_constraint.c @@ -170,7 +170,7 @@ static void rna_Constraint_name_set(PointerRNA *ptr, const char *value) BLI_strncpy(oldname, con->name, sizeof(con->name)); /* copy the new name into the name slot */ - BLI_strncpy(con->name, value, sizeof(con->name)); + BLI_strncpy_utf8(con->name, value, sizeof(con->name)); /* make sure name is unique */ if (ptr->id.data) { diff --git a/source/blender/makesrna/intern/rna_fcurve.c b/source/blender/makesrna/intern/rna_fcurve.c index e922a007249..c0c8ac6b88a 100644 --- a/source/blender/makesrna/intern/rna_fcurve.c +++ b/source/blender/makesrna/intern/rna_fcurve.c @@ -215,7 +215,7 @@ static void rna_DriverTarget_RnaPath_get(PointerRNA *ptr, char *value) if (dtar->rna_path) strcpy(value, dtar->rna_path); else - strcpy(value, ""); + value[0]= '\0'; } static int rna_DriverTarget_RnaPath_length(PointerRNA *ptr) @@ -309,7 +309,7 @@ static void rna_FCurve_RnaPath_get(PointerRNA *ptr, char *value) if (fcu->rna_path) strcpy(value, fcu->rna_path); else - strcpy(value, ""); + value[0]= '\0'; } static int rna_FCurve_RnaPath_length(PointerRNA *ptr) diff --git a/source/blender/makesrna/intern/rna_key.c b/source/blender/makesrna/intern/rna_key.c index 3e65eb8665e..ad6f67cddaf 100644 --- a/source/blender/makesrna/intern/rna_key.c +++ b/source/blender/makesrna/intern/rna_key.c @@ -76,7 +76,7 @@ void rna_ShapeKey_name_set(PointerRNA *ptr, const char *value) BLI_strncpy(oldname, kb->name, sizeof(kb->name)); /* copy the new name into the name slot */ - BLI_strncpy(kb->name, value, sizeof(kb->name)); + BLI_strncpy_utf8(kb->name, value, sizeof(kb->name)); /* make sure the name is truly unique */ if (ptr->id.data) { diff --git a/source/blender/makesrna/intern/rna_mesh.c b/source/blender/makesrna/intern/rna_mesh.c index 16817001bf4..2fdb9923ca5 100644 --- a/source/blender/makesrna/intern/rna_mesh.c +++ b/source/blender/makesrna/intern/rna_mesh.c @@ -708,7 +708,7 @@ static void rna_MeshTextureFaceLayer_name_set(PointerRNA *ptr, const char *value Mesh *me= (Mesh*)ptr->id.data; CustomData *fdata= rna_mesh_fdata(me); CustomDataLayer *cdl= (CustomDataLayer*)ptr->data; - BLI_strncpy(cdl->name, value, sizeof(cdl->name)); + BLI_strncpy_utf8(cdl->name, value, sizeof(cdl->name)); CustomData_set_layer_unique_name(fdata, cdl - fdata->layers); } @@ -820,7 +820,7 @@ static void rna_MeshColorLayer_name_set(PointerRNA *ptr, const char *value) Mesh *me= (Mesh*)ptr->id.data; CustomData *fdata= rna_mesh_fdata(me); CustomDataLayer *cdl= (CustomDataLayer*)ptr->data; - BLI_strncpy(cdl->name, value, sizeof(cdl->name)); + BLI_strncpy_utf8(cdl->name, value, sizeof(cdl->name)); CustomData_set_layer_unique_name(fdata, cdl - fdata->layers); } diff --git a/source/blender/makesrna/intern/rna_modifier.c b/source/blender/makesrna/intern/rna_modifier.c index 464f676b7f6..b83f06c633c 100644 --- a/source/blender/makesrna/intern/rna_modifier.c +++ b/source/blender/makesrna/intern/rna_modifier.c @@ -211,7 +211,7 @@ void rna_Modifier_name_set(PointerRNA *ptr, const char *value) BLI_strncpy(oldname, md->name, sizeof(md->name)); /* copy the new name into the name slot */ - BLI_strncpy(md->name, value, sizeof(md->name)); + BLI_strncpy_utf8(md->name, value, sizeof(md->name)); /* make sure the name is truly unique */ if (ptr->id.data) { diff --git a/source/blender/makesrna/intern/rna_nla.c b/source/blender/makesrna/intern/rna_nla.c index ef4adde6fb4..2a234dfaa61 100644 --- a/source/blender/makesrna/intern/rna_nla.c +++ b/source/blender/makesrna/intern/rna_nla.c @@ -59,7 +59,7 @@ static void rna_NlaStrip_name_set(PointerRNA *ptr, const char *value) NlaStrip *data= (NlaStrip *)ptr->data; /* copy the name first */ - BLI_strncpy(data->name, value, sizeof(data->name)); + BLI_strncpy_utf8(data->name, value, sizeof(data->name)); /* validate if there's enough info to do so */ if (ptr->id.data) { diff --git a/source/blender/makesrna/intern/rna_nodetree.c b/source/blender/makesrna/intern/rna_nodetree.c index 0554e4d00ad..61947977fee 100644 --- a/source/blender/makesrna/intern/rna_nodetree.c +++ b/source/blender/makesrna/intern/rna_nodetree.c @@ -361,7 +361,7 @@ static void rna_Node_name_set(PointerRNA *ptr, const char *value) /* make a copy of the old name first */ BLI_strncpy(oldname, node->name, sizeof(node->name)); /* set new name */ - BLI_strncpy(node->name, value, sizeof(node->name)); + BLI_strncpy_utf8(node->name, value, sizeof(node->name)); nodeUniqueName(ntree, node); diff --git a/source/blender/makesrna/intern/rna_object.c b/source/blender/makesrna/intern/rna_object.c index 59f5173f7ef..e777d2df98b 100644 --- a/source/blender/makesrna/intern/rna_object.c +++ b/source/blender/makesrna/intern/rna_object.c @@ -466,7 +466,7 @@ void rna_VertexGroup_name_set(PointerRNA *ptr, const char *value) { Object *ob= (Object *)ptr->id.data; bDeformGroup *dg= (bDeformGroup *)ptr->data; - BLI_strncpy(dg->name, value, sizeof(dg->name)); + BLI_strncpy_utf8(dg->name, value, sizeof(dg->name)); defgroup_unique_name(dg, ob); } @@ -512,7 +512,7 @@ void rna_object_vgroup_name_index_get(PointerRNA *ptr, char *value, int index) dg= BLI_findlink(&ob->defbase, index-1); if(dg) BLI_strncpy(value, dg->name, sizeof(dg->name)); - else BLI_strncpy(value, "", sizeof(dg->name)); + else value[0]= '\0'; } int rna_object_vgroup_name_index_length(PointerRNA *ptr, int index) @@ -535,7 +535,7 @@ void rna_object_vgroup_name_set(PointerRNA *ptr, const char *value, char *result Object *ob= (Object*)ptr->id.data; bDeformGroup *dg= defgroup_find_name(ob, value); if(dg) { - BLI_strncpy(result, value, maxlen); + BLI_strncpy(result, value, maxlen); /* no need for BLI_strncpy_utf8, since this matches an existing group */ return; } @@ -562,7 +562,7 @@ void rna_object_uvlayer_name_set(PointerRNA *ptr, const char *value, char *resul } } - BLI_strncpy(result, "", maxlen); + result[0]= '\0'; } void rna_object_vcollayer_name_set(PointerRNA *ptr, const char *value, char *result, int maxlen) @@ -585,7 +585,7 @@ void rna_object_vcollayer_name_set(PointerRNA *ptr, const char *value, char *res } } - BLI_strncpy(result, "", maxlen); + result[0]= '\0'; } static int rna_Object_active_material_index_get(PointerRNA *ptr) @@ -836,7 +836,7 @@ static void rna_MaterialSlot_name_get(PointerRNA *ptr, char *str) if(ma) strcpy(str, ma->id.name+2); else - strcpy(str, ""); + str[0]= '\0'; } static void rna_MaterialSlot_update(Main *bmain, Scene *scene, PointerRNA *ptr) diff --git a/source/blender/makesrna/intern/rna_pose.c b/source/blender/makesrna/intern/rna_pose.c index 0dd8218d1b9..434634f6b10 100644 --- a/source/blender/makesrna/intern/rna_pose.c +++ b/source/blender/makesrna/intern/rna_pose.c @@ -222,7 +222,7 @@ static void rna_PoseChannel_name_set(PointerRNA *ptr, const char *value) char oldname[sizeof(pchan->name)], newname[sizeof(pchan->name)]; /* need to be on the stack */ - BLI_strncpy(newname, value, sizeof(pchan->name)); + BLI_strncpy_utf8(newname, value, sizeof(pchan->name)); BLI_strncpy(oldname, pchan->name, sizeof(pchan->name)); ED_armature_bone_rename(ob->data, oldname, newname); @@ -411,7 +411,7 @@ static void rna_pose_bgroup_name_index_get(PointerRNA *ptr, char *value, int ind grp= BLI_findlink(&pose->agroups, index-1); if(grp) BLI_strncpy(value, grp->name, sizeof(grp->name)); - else BLI_strncpy(value, "", sizeof(grp->name)); // XXX if invalid pointer, won't this crash? + else value[0]= '\0'; } static int rna_pose_bgroup_name_index_length(PointerRNA *ptr, int index) @@ -451,7 +451,7 @@ static void rna_pose_pgroup_name_set(PointerRNA *ptr, const char *value, char *r } } - BLI_strncpy(result, "", maxlen); + result[0]= '\0'; } #endif diff --git a/source/blender/makesrna/intern/rna_property.c b/source/blender/makesrna/intern/rna_property.c index 9fd5610a577..e2b886b8d38 100644 --- a/source/blender/makesrna/intern/rna_property.c +++ b/source/blender/makesrna/intern/rna_property.c @@ -88,7 +88,7 @@ static void rna_GameProperty_type_set(PointerRNA *ptr, int value) static void rna_GameProperty_name_set(PointerRNA *ptr, const char *value) { bProperty *prop= (bProperty*)(ptr->data); - BLI_strncpy(prop->name, value, sizeof(prop->name)); + BLI_strncpy_utf8(prop->name, value, sizeof(prop->name)); unique_property(NULL, prop, 1); } diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c index 3a0183d70fb..3e7b1692a26 100644 --- a/source/blender/makesrna/intern/rna_scene.c +++ b/source/blender/makesrna/intern/rna_scene.c @@ -737,7 +737,7 @@ static void rna_RenderSettings_engine_set(PointerRNA *ptr, int value) RenderEngineType *type= BLI_findlink(&R_engines, value); if(type) - BLI_strncpy(rd->engine, type->idname, sizeof(rd->engine)); + BLI_strncpy_utf8(rd->engine, type->idname, sizeof(rd->engine)); } static EnumPropertyItem *rna_RenderSettings_engine_itemf(bContext *UNUSED(C), PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop), int *free) @@ -810,7 +810,7 @@ static void rna_SceneRenderLayer_name_set(PointerRNA *ptr, const char *value) Scene *scene= (Scene*)ptr->id.data; SceneRenderLayer *rl= (SceneRenderLayer*)ptr->data; - BLI_strncpy(rl->name, value, sizeof(rl->name)); + BLI_strncpy_utf8(rl->name, value, sizeof(rl->name)); if(scene->nodetree) { bNode *node; @@ -1011,7 +1011,7 @@ static TimeMarker *rna_TimeLine_add(Scene *scene, const char name[]) TimeMarker *marker = MEM_callocN(sizeof(TimeMarker), "TimeMarker"); marker->flag= SELECT; marker->frame= 1; - BLI_strncpy(marker->name, name, sizeof(marker->name)); + BLI_strncpy_utf8(marker->name, name, sizeof(marker->name)); BLI_addtail(&scene->markers, marker); return marker; } @@ -1819,8 +1819,8 @@ static void rna_def_scene_game_data(BlenderRNA *brna) static EnumPropertyItem obstacle_simulation_items[] = { {OBSTSIMULATION_NONE, "NONE", 0, "None", ""}, - {OBSTSIMULATION_TOI_rays, "RVO (rays)", 0, "RVO (rays)", ""}, - {OBSTSIMULATION_TOI_cells, "RVO (cells)", 0, "RVO (cells)", ""}, + {OBSTSIMULATION_TOI_rays, "RVO_RAYS", 0, "RVO (rays)", ""}, + {OBSTSIMULATION_TOI_cells, "RVO_CELLS", 0, "RVO (cells)", ""}, {0, NULL, 0, NULL, NULL}}; srna= RNA_def_struct(brna, "SceneGameData", NULL); diff --git a/source/blender/makesrna/intern/rna_sequencer.c b/source/blender/makesrna/intern/rna_sequencer.c index 627c2274965..79724adf91c 100644 --- a/source/blender/makesrna/intern/rna_sequencer.c +++ b/source/blender/makesrna/intern/rna_sequencer.c @@ -359,7 +359,7 @@ static void rna_Sequence_name_set(PointerRNA *ptr, const char *value) BLI_strncpy(oldname, seq->name+2, sizeof(seq->name)-2); /* copy the new name into the name slot */ - BLI_strncpy(seq->name+2, value, sizeof(seq->name)-2); + BLI_strncpy_utf8(seq->name+2, value, sizeof(seq->name)-2); /* make sure the name is unique */ seqbase_unique_name_recursive(&scene->ed->seqbase, seq); diff --git a/source/blender/makesrna/intern/rna_text.c b/source/blender/makesrna/intern/rna_text.c index 959f9db851b..6a1e93fce41 100644 --- a/source/blender/makesrna/intern/rna_text.c +++ b/source/blender/makesrna/intern/rna_text.c @@ -53,7 +53,7 @@ static void rna_Text_filename_get(PointerRNA *ptr, char *value) if(text->name) strcpy(value, text->name); else - strcpy(value, ""); + value[0]= '\0'; } static int rna_Text_filename_length(PointerRNA *ptr) @@ -88,7 +88,7 @@ static void rna_TextLine_body_get(PointerRNA *ptr, char *value) if(line->line) strcpy(value, line->line); else - strcpy(value, ""); + value[0]= '\0'; } static int rna_TextLine_body_length(PointerRNA *ptr) diff --git a/source/blender/makesrna/intern/rna_texture.c b/source/blender/makesrna/intern/rna_texture.c index 890be76c49a..608a7326d79 100644 --- a/source/blender/makesrna/intern/rna_texture.c +++ b/source/blender/makesrna/intern/rna_texture.c @@ -260,7 +260,7 @@ static void rna_TextureSlot_name_get(PointerRNA *ptr, char *str) if(mtex->tex) strcpy(str, mtex->tex->id.name+2); else - strcpy(str, ""); + str[0]= '\0'; } static int rna_TextureSlot_output_node_get(PointerRNA *ptr) diff --git a/source/blender/makesrna/intern/rna_texture_api.c b/source/blender/makesrna/intern/rna_texture_api.c index 8c63d5da8fd..4941c75c400 100644 --- a/source/blender/makesrna/intern/rna_texture_api.c +++ b/source/blender/makesrna/intern/rna_texture_api.c @@ -68,7 +68,7 @@ void clear_envmap(struct EnvMap *env, bContext *C) } } -void texture_evaluate(struct Tex *tex, float value[3], float color_r[3]) +void texture_evaluate(struct Tex *tex, float value[3], float color_r[4]) { TexResult texres= {0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0, NULL}; multitex_ext(tex, value, NULL, NULL, 1, &texres); diff --git a/source/blender/makesrna/intern/rna_wm.c b/source/blender/makesrna/intern/rna_wm.c index 7ce1e1ab88f..a259f84ff1a 100644 --- a/source/blender/makesrna/intern/rna_wm.c +++ b/source/blender/makesrna/intern/rna_wm.c @@ -348,20 +348,20 @@ EnumPropertyItem keymap_modifiers_items[] = { {0, NULL, 0, NULL, NULL}}; EnumPropertyItem operator_flag_items[] = { - {OPTYPE_REGISTER, "REGISTER", 0, "Register", ""}, - {OPTYPE_UNDO, "UNDO", 0, "Undo", ""}, - {OPTYPE_BLOCKING, "BLOCKING", 0, "Blocking", ""}, - {OPTYPE_MACRO, "MACRO", 0, "Macro", ""}, - {OPTYPE_GRAB_POINTER, "GRAB_POINTER", 0, "Grab Pointer", ""}, - {OPTYPE_PRESET, "PRESET", 0, "Preset", ""}, - {OPTYPE_INTERNAL, "INTERNAL", 0, "Internal", ""}, + {OPTYPE_REGISTER, "REGISTER", 0, "Register", "Display in the info window and support the redo toolbar panel"}, + {OPTYPE_UNDO, "UNDO", 0, "Undo", "Push an undo event (needed for operator redo)"}, + {OPTYPE_BLOCKING, "BLOCKING", 0, "Blocking", "Block anything else from using the cursor"}, + {OPTYPE_MACRO, "MACRO", 0, "Macro", "Use to check if an operator is a macro"}, + {OPTYPE_GRAB_POINTER, "GRAB_POINTER", 0, "Grab Pointer", "Use so the operator grabs the mouse focus, enables wrapping when continuous grab is enabled"}, + {OPTYPE_PRESET, "PRESET", 0, "Preset", "Display a preset button with the operators settings"}, + {OPTYPE_INTERNAL, "INTERNAL", 0, "Internal", "Removes the operator from search results"}, {0, NULL, 0, NULL, NULL}}; EnumPropertyItem operator_return_items[] = { - {OPERATOR_RUNNING_MODAL, "RUNNING_MODAL", 0, "Running Modal", ""}, - {OPERATOR_CANCELLED, "CANCELLED", 0, "Cancelled", ""}, - {OPERATOR_FINISHED, "FINISHED", 0, "Finished", ""}, - {OPERATOR_PASS_THROUGH, "PASS_THROUGH", 0, "Pass Through", ""}, // used as a flag + {OPERATOR_RUNNING_MODAL, "RUNNING_MODAL", 0, "Running Modal", "Keep the operator running with blender"}, + {OPERATOR_CANCELLED, "CANCELLED", 0, "Cancelled", "When no action has been taken, operator exits"}, + {OPERATOR_FINISHED, "FINISHED", 0, "Finished", "When the operator is complete, operator exits"}, + {OPERATOR_PASS_THROUGH, "PASS_THROUGH", 0, "Pass Through", "Do nothing and pass the event on"}, // used as a flag {0, NULL, 0, NULL, NULL}}; /* flag/enum */ diff --git a/source/blender/modifiers/intern/MOD_warp.c b/source/blender/modifiers/intern/MOD_warp.c index c1c3604d598..723e77cc6bb 100644 --- a/source/blender/modifiers/intern/MOD_warp.c +++ b/source/blender/modifiers/intern/MOD_warp.c @@ -232,8 +232,8 @@ static void warpModifier_do(WarpModifierData *wmd, Object *ob, dv = &dvert[i]; if(dv) { - weight = defvert_find_weight(dv, defgrp_index) * wmd->strength; - if(weight <= 0.0f) + weight = defvert_find_weight(dv, defgrp_index) * strength; + if(weight <= 0.0f) /* Should never occure... */ continue; } } diff --git a/source/blender/modifiers/intern/MOD_weightvg_util.c b/source/blender/modifiers/intern/MOD_weightvg_util.c index 98615c70553..128e888ca90 100644 --- a/source/blender/modifiers/intern/MOD_weightvg_util.c +++ b/source/blender/modifiers/intern/MOD_weightvg_util.c @@ -212,7 +212,7 @@ void weightvg_do_mask(int num, const int *indices, float *org_w, const float *ne /* For each weight (vertex), make the mix between org and new weights. */ for (i = 0; i < num; i++) { int idx = indices ? indices[i] : i; - const float f= defvert_find_weight(&dvert[idx], ref_didx) * fact; + const float f = defvert_find_weight(&dvert[idx], ref_didx) * fact; org_w[i] = (new_w[i] * f) + (org_w[i] * (1.0f-f)); /* If that vertex is not in ref vgroup, assume null factor, and hence do nothing! */ } @@ -220,87 +220,107 @@ void weightvg_do_mask(int num, const int *indices, float *org_w, const float *ne else { /* Default "influence" behavior. */ /* For each weight (vertex), make the mix between org and new weights. */ - const float ifact= 1.0f - fact; + const float ifact = 1.0f - fact; for (i = 0; i < num; i++) { org_w[i] = (new_w[i] * fact) + (org_w[i] * ifact); } } } +/* Adds the given vertex to the specified vertex group, with given weight. */ +static void defvert_add_to_group(MDeformVert *dv, int defgrp_idx, const float weight) { + /* TODO, move into deform.c as a generic function. This assumes the vertex + * groups have already been checked, so this has to remain low level. */ + MDeformWeight *newdw; + + newdw = MEM_callocN(sizeof(MDeformWeight)*(dv->totweight+1), "defvert_add_to group, new deformWeight"); + if(dv->dw) { + memcpy(newdw, dv->dw, sizeof(MDeformWeight)*dv->totweight); + MEM_freeN(dv->dw); + } + dv->dw = newdw; + dv->dw[dv->totweight].weight = weight; + dv->dw[dv->totweight].def_nr = defgrp_idx; + dv->totweight++; +} + +/* Removes the given vertex from the vertex group, specified either by its defgrp_idx, + * or directly by its MDeformWeight pointer, if dw is not NULL. + * WARNING: This function frees the given MDeformWeight, do not use it afterward! */ +static void defvert_remove_from_group(MDeformVert *dv, int defgrp_idx, MDeformWeight *dw) { + /* TODO, move this into deform.c as a generic function. */ + MDeformWeight *newdw; + int i; + + /* Get index of removed MDeformWeight. */ + if(dw == NULL) { + dw = dv->dw; + for (i = dv->totweight; i > 0; i--, dw++) { + if (dw->def_nr == defgrp_idx) + break; + } + i--; + } + else { + i = dw - dv->dw; + /* Security check! */ + if(i < 0 || i >= dv->totweight) + return; + } + + dv->totweight--; + /* If there are still other deform weights attached to this vert then remove + * this deform weight, and reshuffle the others. + */ + if(dv->totweight) { + newdw = MEM_mallocN(sizeof(MDeformWeight)*(dv->totweight), "defvert_remove_from_group, new deformWeight"); + if(dv->dw){ + memcpy(newdw, dv->dw, sizeof(MDeformWeight)*i); + memcpy(newdw+i, dv->dw+i+1, sizeof(MDeformWeight)*(dv->totweight-i)); + MEM_freeN(dv->dw); + } + dv->dw = newdw; + } + /* If there are no other deform weights left then just remove this one. */ + else { + MEM_freeN(dv->dw); + dv->dw = NULL; + } +} + + /* Applies weights to given vgroup (defgroup), and optionnaly add/remove vertices from the group. - * If indices is not NULL, it must be a table of same length as weights, mapping to the real - * vertex index (in case the weight table does not cover the whole vertices...). + * If dws is not NULL, it must be an array of MDeformWeight pointers of same length as weights (and + * defgrp_idx can then have any value). + * If indices is not NULL, it must be an array of same length as weights, mapping to the real + * vertex index (in case the weight array does not cover the whole vertices...). */ -void weightvg_update_vg(MDeformVert *dvert, int defgrp_idx, int num, +void weightvg_update_vg(MDeformVert *dvert, int defgrp_idx, MDeformWeight **dws, int num, const int *indices, const float *weights, int do_add, float add_thresh, int do_rem, float rem_thresh) { int i; - for (i = 0; i < num; i++) { - int j; - int add2vg = do_add; + for(i = 0; i < num; i++) { float w = weights[i]; MDeformVert *dv = &dvert[indices ? indices[i] : i]; - MDeformWeight *newdw; + MDeformWeight *dw = dws ? dws[i] : defvert_find_index(dv, defgrp_idx); /* Never allow weights out of [0.0, 1.0] range. */ CLAMP(w, 0.0f, 1.0f); - /* Let's first check to see if this vert is already in the weight group – if so - * let's update it, or remove it if needed. - */ - for (j = 0; j < dv->totweight; j++) { - /* If this weight corresponds to the deform group, update the value or, - * if lower than rem_threshold, remove the vertex from the vgroup. - */ - if (dv->dw[j].def_nr == defgrp_idx) { - /* Remove the vertex from this vgroup if needed. */ - if (do_rem && w < rem_thresh) { - /* TODO, move this into deform.c to make into a generic function */ - - dv->totweight--; - /* If there are still other deform weights attached to this vert then remove - * this deform weight, and reshuffle the others. - */ - if(dv->totweight) { - newdw = MEM_mallocN(sizeof(MDeformWeight)*(dv->totweight), "deformWeight"); - if(dv->dw){ - memcpy(newdw, dv->dw, sizeof(MDeformWeight)*j); - memcpy(newdw+j, dv->dw+j+1, sizeof(MDeformWeight)*(dv->totweight-j)); - MEM_freeN(dv->dw); - } - dv->dw = newdw; - } - /* If there are no other deform weights left then just remove this one. */ - else { - MEM_freeN(dv->dw); - dv->dw = NULL; - } - } - /* Else, just set the new computed weight. */ - else { - dv->dw[j].weight = w; - } - add2vg = FALSE; - break; + /* If the vertex is in this vgroup, remove it if needed, or just update it. */ + if(dw != NULL) { + if(do_rem && w < rem_thresh) { + defvert_remove_from_group(dv, defgrp_idx, dw); } - } - - /* If the vert wasn't in the deform group, add it if needed! - */ - if ((add2vg == TRUE) && w > add_thresh) { - /* TODO, mvoe into deform.c and make into a generic function, this assumes the vertex - * groups have already been checked, so this has to remain low level */ - newdw = MEM_callocN(sizeof(MDeformWeight)*(dv->totweight+1), "WeightVGEdit Modifier, deformWeight"); - if(dv->dw) { - memcpy(newdw, dv->dw, sizeof(MDeformWeight)*dv->totweight); - MEM_freeN(dv->dw); + else { + dw->weight = w; } - dv->dw = newdw; - dv->dw[dv->totweight].weight = w; - dv->dw[dv->totweight].def_nr = defgrp_idx; - dv->totweight++; + } + /* Else, add it if needed! */ + else if(do_add && w > add_thresh) { + defvert_add_to_group(dv, defgrp_idx, w); } } } diff --git a/source/blender/modifiers/intern/MOD_weightvg_util.h b/source/blender/modifiers/intern/MOD_weightvg_util.h index ce3520f1900..a327bdf969b 100644 --- a/source/blender/modifiers/intern/MOD_weightvg_util.h +++ b/source/blender/modifiers/intern/MOD_weightvg_util.h @@ -83,7 +83,7 @@ void weightvg_do_mask(int num, const int *indices, float *org_w, const float *ne * If indices is not NULL, it must be a table of same length as weights, mapping to the real * vertex index (in case the weight table does not cover the whole vertices...). */ -void weightvg_update_vg(MDeformVert *dvert, int defgrp_idx, int num, +void weightvg_update_vg(MDeformVert *dvert, int defgrp_idx, MDeformWeight **dws, int num, const int *indices, const float *weights, int do_add, float add_thresh, int do_rem, float rem_thresh); diff --git a/source/blender/modifiers/intern/MOD_weightvgedit.c b/source/blender/modifiers/intern/MOD_weightvgedit.c index fb6d4dc10e6..233ad8baf0b 100644 --- a/source/blender/modifiers/intern/MOD_weightvgedit.c +++ b/source/blender/modifiers/intern/MOD_weightvgedit.c @@ -187,6 +187,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, DerivedMesh *der Mesh *ob_m = NULL; #endif MDeformVert *dvert = NULL; + MDeformWeight **dw = NULL; float *org_w; /* Array original weights. */ float *new_w; /* Array new weights. */ int numVerts; @@ -257,13 +258,15 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, DerivedMesh *der /* Get org weights, assuming 0.0 for vertices not in given vgroup. */ org_w = MEM_mallocN(sizeof(float) * numVerts, "WeightVGEdit Modifier, org_w"); - new_w = MEM_mallocN(sizeof(float) * numVerts, "WeightVGEdit Modifier, org_w"); + new_w = MEM_mallocN(sizeof(float) * numVerts, "WeightVGEdit Modifier, new_w"); + dw = MEM_mallocN(sizeof(MDeformWeight*) * numVerts, "WeightVGEdit Modifier, dw"); for (i = 0; i < numVerts; i++) { - MDeformWeight *dw= defvert_find_index(&dvert[i], defgrp_idx); - org_w[i] = new_w[i] = wmd->default_weight; - - if(dw) { - org_w[i] = new_w[i] = dw->weight; + dw[i] = defvert_find_index(&dvert[i], defgrp_idx); + if(dw[i]) { + org_w[i] = new_w[i] = dw[i]->weight; + } + else { + org_w[i] = new_w[i] = wmd->default_weight; } } @@ -278,12 +281,13 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, DerivedMesh *der wmd->mask_tex_mapping, wmd->mask_tex_map_obj, wmd->mask_tex_uvlayer_name); /* Update/add/remove from vgroup. */ - weightvg_update_vg(dvert, defgrp_idx, numVerts, NULL, org_w, do_add, wmd->add_threshold, + weightvg_update_vg(dvert, defgrp_idx, dw, numVerts, NULL, org_w, do_add, wmd->add_threshold, do_rem, wmd->rem_threshold); /* Freeing stuff. */ MEM_freeN(org_w); MEM_freeN(new_w); + MEM_freeN(dw); /* Return the vgroup-modified mesh. */ return ret; diff --git a/source/blender/modifiers/intern/MOD_weightvgmix.c b/source/blender/modifiers/intern/MOD_weightvgmix.c index f1422a342eb..283e812e11c 100644 --- a/source/blender/modifiers/intern/MOD_weightvgmix.c +++ b/source/blender/modifiers/intern/MOD_weightvgmix.c @@ -229,13 +229,14 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, DerivedMesh *der Mesh *ob_m = NULL; #endif MDeformVert *dvert = NULL; + MDeformWeight **dw1, **tdw1, **dw2, **tdw2; int numVerts; int defgrp_idx, defgrp_idx2 = -1; float *org_w; float *new_w; int *tidx, *indices = NULL; int numIdx = 0; - int i, j; + int i; char rel_ret = 0; /* Boolean, whether we have to release ret dm or not, when not using it! */ /* Get number of verts. */ @@ -304,78 +305,91 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, DerivedMesh *der /* Find out which vertices to work on. */ tidx = MEM_mallocN(sizeof(int) * numVerts, "WeightVGMix Modifier, tidx"); + tdw1 = MEM_mallocN(sizeof(MDeformWeight*) * numVerts, "WeightVGMix Modifier, tdw1"); + tdw2 = MEM_mallocN(sizeof(MDeformWeight*) * numVerts, "WeightVGMix Modifier, tdw2"); switch (wmd->mix_set) { case MOD_WVG_SET_A: /* All vertices in first vgroup. */ for (i = 0; i < numVerts; i++) { - for (j = 0; j < dvert[i].totweight; j++) { - if(dvert[i].dw[j].def_nr == defgrp_idx) { - tidx[numIdx++] = i; - break; - } + MDeformWeight *dw = defvert_find_index(&dvert[i], defgrp_idx); + if(dw) { + tdw1[numIdx] = dw; + tdw2[numIdx] = defvert_find_index(&dvert[i], defgrp_idx2); + tidx[numIdx++] = i; } } break; case MOD_WVG_SET_B: /* All vertices in second vgroup. */ for (i = 0; i < numVerts; i++) { - for (j = 0; j < dvert[i].totweight; j++) { - if(dvert[i].dw[j].def_nr == defgrp_idx2) { - tidx[numIdx++] = i; - break; - } + MDeformWeight *dw = defvert_find_index(&dvert[i], defgrp_idx2); + if(dw) { + tdw1[numIdx] = defvert_find_index(&dvert[i], defgrp_idx); + tdw2[numIdx] = dw; + tidx[numIdx++] = i; } } break; case MOD_WVG_SET_OR: /* All vertices in one vgroup or the other. */ for (i = 0; i < numVerts; i++) { - for (j = 0; j < dvert[i].totweight; j++) { - if(dvert[i].dw[j].def_nr == defgrp_idx || dvert[i].dw[j].def_nr == defgrp_idx2) { - tidx[numIdx++] = i; - break; - } + MDeformWeight *adw = defvert_find_index(&dvert[i], defgrp_idx); + MDeformWeight *bdw = defvert_find_index(&dvert[i], defgrp_idx2); + if(adw || bdw) { + tdw1[numIdx] = adw; + tdw2[numIdx] = bdw; + tidx[numIdx++] = i; } } break; case MOD_WVG_SET_AND: /* All vertices in both vgroups. */ for (i = 0; i < numVerts; i++) { - int idx1 = FALSE; - int idx2 = FALSE; - for (j = 0; j < dvert[i].totweight; j++) { - if(dvert[i].dw[j].def_nr == defgrp_idx) { - if (idx2 == TRUE) { - tidx[numIdx++] = i; - break; - } - else { - idx1 = TRUE; - } - } - else if(dvert[i].dw[j].def_nr == defgrp_idx2) { - if (idx1 == TRUE) { - tidx[numIdx++] = i; - break; - } - else { - idx2 = TRUE; - } - } + MDeformWeight *adw = defvert_find_index(&dvert[i], defgrp_idx); + MDeformWeight *bdw = defvert_find_index(&dvert[i], defgrp_idx2); + if(adw && bdw) { + tdw1[numIdx] = adw; + tdw2[numIdx] = bdw; + tidx[numIdx++] = i; } } break; case MOD_WVG_SET_ALL: default: - /* Use all vertices, no need to do anything here. */ + /* Use all vertices. */ + for (i = 0; i < numVerts; i++) { + tdw1[i] = defvert_find_index(&dvert[i], defgrp_idx); + tdw2[i] = defvert_find_index(&dvert[i], defgrp_idx2); + } + numIdx = -1; break; } - if (numIdx) { + if(numIdx == 0) { + /* Use no vertices! Hence, return org data. */ + MEM_freeN(tdw1); + MEM_freeN(tdw2); + MEM_freeN(tidx); + if (rel_ret) + ret->release(ret); + return dm; + } + if (numIdx != -1) { indices = MEM_mallocN(sizeof(int) * numIdx, "WeightVGMix Modifier, indices"); memcpy(indices, tidx, sizeof(int) * numIdx); + dw1 = MEM_mallocN(sizeof(MDeformWeight*) * numIdx, "WeightVGMix Modifier, dw1"); + memcpy(dw1, tdw1, sizeof(MDeformWeight*) * numIdx); + MEM_freeN(tdw1); + dw2 = MEM_mallocN(sizeof(MDeformWeight*) * numIdx, "WeightVGMix Modifier, dw2"); + memcpy(dw2, tdw2, sizeof(MDeformWeight*) * numIdx); + MEM_freeN(tdw2); } - else + else { + /* Use all vertices. */ numIdx = numVerts; + /* Just copy MDeformWeight pointers arrays, they will be freed at the end. */ + dw1 = tdw1; + dw2 = tdw2; + } MEM_freeN(tidx); org_w = MEM_mallocN(sizeof(float) * numIdx, "WeightVGMix Modifier, org_w"); @@ -384,27 +398,9 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, DerivedMesh *der /* Mix weights. */ for (i = 0; i < numIdx; i++) { float weight2 = 0.0; - int w1 = FALSE; - int w2 = FALSE; - int idx = indices ? indices[i] : i; - for (j = 0; j < dvert[idx].totweight; j++) { - if(dvert[idx].dw[j].def_nr == defgrp_idx) { - org_w[i] = dvert[idx].dw[j].weight; - w1 = TRUE; - if (w2 == TRUE) - break; - } - else if(dvert[idx].dw[j].def_nr == defgrp_idx2) { - weight2 = dvert[idx].dw[j].weight; - w2 = TRUE; - if (w1 == TRUE) - break; - } - } - if (w1 == FALSE) - org_w[i] = wmd->default_weight_a; - if (w2 == FALSE) - weight2 = wmd->default_weight_b; + org_w[i] = dw1[i] ? dw1[i]->weight : wmd->default_weight_a; + weight2 = dw2[i] ? dw2[i]->weight : wmd->default_weight_b; + new_w[i] = mix_weight(org_w[i], weight2, wmd->mix_mode); } @@ -416,11 +412,13 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, DerivedMesh *der /* Update (add to) vgroup. * XXX Depending on the MOD_WVG_SET_xxx option chosen, we might have to add vertices to vgroup. */ - weightvg_update_vg(dvert, defgrp_idx, numIdx, indices, org_w, TRUE, -FLT_MAX, 0, 0.0f); + weightvg_update_vg(dvert, defgrp_idx, dw1, numIdx, indices, org_w, TRUE, -FLT_MAX, FALSE, 0.0f); /* Freeing stuff. */ MEM_freeN(org_w); MEM_freeN(new_w); + MEM_freeN(dw1); + MEM_freeN(dw2); if (indices) MEM_freeN(indices); diff --git a/source/blender/modifiers/intern/MOD_weightvgproximity.c b/source/blender/modifiers/intern/MOD_weightvgproximity.c index 2daa3f797c3..76be25a2b10 100644 --- a/source/blender/modifiers/intern/MOD_weightvgproximity.c +++ b/source/blender/modifiers/intern/MOD_weightvgproximity.c @@ -344,6 +344,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, DerivedMesh *der Mesh *ob_m = NULL; #endif MDeformVert *dvert = NULL; + MDeformWeight **dw, **tdw; int numVerts; float (*v_cos)[3] = NULL; /* The vertices coordinates. */ Object *obr = NULL; /* Our target object. */ @@ -353,7 +354,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, DerivedMesh *der float *new_w =NULL; int *tidx, *indices = NULL; int numIdx = 0; - int i, j; + int i; char rel_ret = 0; /* Boolean, whether we have to release ret dm or not, when not using it! */ /* Get number of verts. */ @@ -423,22 +424,34 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, DerivedMesh *der */ tidx = MEM_mallocN(sizeof(int) * numVerts, "WeightVGProximity Modifier, tidx"); tw = MEM_mallocN(sizeof(float) * numVerts, "WeightVGProximity Modifier, tw"); + tdw = MEM_mallocN(sizeof(MDeformWeight*) * numVerts, "WeightVGProximity Modifier, tdw"); for (i = 0; i < numVerts; i++) { - for (j = 0; j < dvert[i].totweight; j++) { - if(dvert[i].dw[j].def_nr == defgrp_idx) { - tidx[numIdx] = i; - tw[numIdx++] = dvert[i].dw[j].weight; - break; - } + MDeformWeight *_dw = defvert_find_index(&dvert[i], defgrp_idx); + if(_dw) { + tidx[numIdx] = i; + tw[numIdx] = _dw->weight; + tdw[numIdx++] = _dw; } } + /* If no vertices found, return org data! */ + if(numIdx == 0) { + MEM_freeN(tidx); + MEM_freeN(tw); + MEM_freeN(tdw); + if (rel_ret) + ret->release(ret); + return dm; + } indices = MEM_mallocN(sizeof(int) * numIdx, "WeightVGProximity Modifier, indices"); memcpy(indices, tidx, sizeof(int) * numIdx); org_w = MEM_mallocN(sizeof(float) * numIdx, "WeightVGProximity Modifier, org_w"); new_w = MEM_mallocN(sizeof(float) * numIdx, "WeightVGProximity Modifier, new_w"); memcpy(org_w, tw, sizeof(float) * numIdx); + dw = MEM_mallocN(sizeof(MDeformWeight*) * numIdx, "WeightVGProximity Modifier, dw"); + memcpy(dw, tdw, sizeof(MDeformWeight*) * numIdx); MEM_freeN(tidx); MEM_freeN(tw); + MEM_freeN(tdw); /* Get our vertex coordinates. */ v_cos = MEM_mallocN(sizeof(float[3]) * numIdx, "WeightVGProximity Modifier, v_cos"); @@ -447,7 +460,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, DerivedMesh *der /* Compute wanted distances. */ if (wmd->proximity_mode == MOD_WVG_PROXIMITY_OBJECT) { - float dist = get_ob2ob_distance(ob, obr); + const float dist = get_ob2ob_distance(ob, obr); for(i = 0; i < numIdx; i++) new_w[i] = dist; } @@ -482,8 +495,10 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, DerivedMesh *der target_dm, &loc2trgt); for(i = 0; i < numIdx; i++) { new_w[i] = dists_v ? dists_v[i] : FLT_MAX; - new_w[i] = dists_e ? minf(dists_e[i], new_w[i]) : new_w[i]; - new_w[i] = dists_f ? minf(dists_f[i], new_w[i]) : new_w[i]; + if(dists_e) + new_w[i] = minf(dists_e[i], new_w[i]); + if(dists_f) + new_w[i] = minf(dists_f[i], new_w[i]); } if(dists_v) MEM_freeN(dists_v); if(dists_e) MEM_freeN(dists_e); @@ -508,11 +523,12 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, DerivedMesh *der wmd->mask_tex_mapping, wmd->mask_tex_map_obj, wmd->mask_tex_uvlayer_name); /* Update vgroup. Note we never add nor remove vertices from vgroup here. */ - weightvg_update_vg(dvert, defgrp_idx, numIdx, indices, org_w, 0, 0.0f, 0, 0.0f); + weightvg_update_vg(dvert, defgrp_idx, dw, numIdx, indices, org_w, FALSE, 0.0f, FALSE, 0.0f); /* Freeing stuff. */ MEM_freeN(org_w); MEM_freeN(new_w); + MEM_freeN(dw); MEM_freeN(indices); MEM_freeN(v_cos); diff --git a/source/blender/nodes/composite/node_composite_tree.c b/source/blender/nodes/composite/node_composite_tree.c index 01e46ed3df9..5c58070be9d 100644 --- a/source/blender/nodes/composite/node_composite_tree.c +++ b/source/blender/nodes/composite/node_composite_tree.c @@ -337,7 +337,7 @@ static void *exec_composite_node(void *nodeexec_v) node->typeinfo->newexecfunc(thd->rd, 0, node, nodeexec->data, nsin, nsout); node->exec |= NODE_READY; - return 0; + return NULL; } /* return total of executable nodes, for timecursor */ diff --git a/source/blender/nodes/composite/nodes/node_composite_diffMatte.c b/source/blender/nodes/composite/nodes/node_composite_diffMatte.c index 23bcf57e2bc..9f4af0e0d33 100644 --- a/source/blender/nodes/composite/nodes/node_composite_diffMatte.c +++ b/source/blender/nodes/composite/nodes/node_composite_diffMatte.c @@ -88,9 +88,9 @@ static void do_diff_matte(bNode *node, float *outColor, float *inColor1, float * static void node_composit_exec_diff_matte(void *data, bNode *node, bNodeStack **in, bNodeStack **out) { - CompBuf *outbuf=0; - CompBuf *imbuf1=0; - CompBuf *imbuf2=0; + CompBuf *outbuf= NULL; + CompBuf *imbuf1= NULL; + CompBuf *imbuf2= NULL; NodeChroma *c; /*is anything connected?*/ diff --git a/source/blender/python/generic/py_capi_utils.c b/source/blender/python/generic/py_capi_utils.c index a1571dc028c..d5bd44fc288 100644 --- a/source/blender/python/generic/py_capi_utils.c +++ b/source/blender/python/generic/py_capi_utils.c @@ -208,6 +208,44 @@ PyObject *PyC_Object_GetAttrStringArgs(PyObject *o, Py_ssize_t n, ...) return item; } +/* similar to PyErr_Format(), + * + * implimentation - we cant actually preprend the existing exception, + * because it could have _any_ argiments given to it, so instead we get its + * __str__ output and raise our own exception including it. + */ +PyObject *PyC_Err_Format_Prefix(PyObject *exception_type_prefix, const char *format, ...) +{ + PyObject *error_value_prefix; + va_list args; + + va_start(args, format); + error_value_prefix= PyUnicode_FromFormatV(format, args); /* can fail and be NULL */ + va_end(args); + + if(PyErr_Occurred()) { + PyObject *error_type, *error_value, *error_traceback; + PyErr_Fetch(&error_type, &error_value, &error_traceback); + PyErr_Format(exception_type_prefix, + "%S, %.200s(%S)", + error_value_prefix, + Py_TYPE(error_value)->tp_name, + error_value + ); + } + else { + PyErr_SetObject(exception_type_prefix, + error_value_prefix + ); + } + + Py_XDECREF(error_value_prefix); + + /* dumb to always return NULL but matches PyErr_Format */ + return NULL; +} + + /* returns the exception string as a new PyUnicode object, depends on external traceback module */ #if 0 diff --git a/source/blender/python/generic/py_capi_utils.h b/source/blender/python/generic/py_capi_utils.h index 96c93ab71f8..03a8637710e 100644 --- a/source/blender/python/generic/py_capi_utils.h +++ b/source/blender/python/generic/py_capi_utils.h @@ -34,6 +34,7 @@ void PyC_ObSpit(const char *name, PyObject *var); void PyC_LineSpit(void); PyObject * PyC_ExceptionBuffer(void); PyObject * PyC_Object_GetAttrStringArgs(PyObject *o, Py_ssize_t n, ...); +PyObject * PyC_Err_Format_Prefix(PyObject *exception_type_prefix, const char *format, ...); void PyC_FileAndNum(const char **filename, int *lineno); int PyC_AsArray(void *array, PyObject *value, const int length, const PyTypeObject *type, const short is_double, const char *error_prefix); diff --git a/source/blender/python/intern/bpy_app_handlers.c b/source/blender/python/intern/bpy_app_handlers.c index e7e46160199..b909a0d5f55 100644 --- a/source/blender/python/intern/bpy_app_handlers.c +++ b/source/blender/python/intern/bpy_app_handlers.c @@ -63,7 +63,7 @@ static PyStructSequence_Desc app_cb_info_desc= { #endif */ -static PyObject *py_cb_array[BLI_CB_EVT_TOT]= {0}; +static PyObject *py_cb_array[BLI_CB_EVT_TOT]= {NULL}; static PyObject *make_app_cb_info(void) { @@ -102,7 +102,7 @@ PyObject *BPY_app_handlers_struct(void) /* assign the C callbacks */ if(ret) { - static bCallbackFuncStore funcstore_array[BLI_CB_EVT_TOT]= {{0}}; + static bCallbackFuncStore funcstore_array[BLI_CB_EVT_TOT]= {{NULL}}; bCallbackFuncStore *funcstore; int pos= 0; diff --git a/source/blender/python/intern/bpy_rna.c b/source/blender/python/intern/bpy_rna.c index 4c382efdda3..a63cee4e505 100644 --- a/source/blender/python/intern/bpy_rna.c +++ b/source/blender/python/intern/bpy_rna.c @@ -1525,10 +1525,22 @@ static int pyrna_py_to_prop(PointerRNA *ptr, PropertyRNA *prop, void *data, PyOb #endif // USE_STRING_COERCE if (param==NULL) { - PyErr_Format(PyExc_TypeError, - "%.200s %.200s.%.200s expected a string type, not %.200s", - error_prefix, RNA_struct_identifier(ptr->type), - RNA_property_identifier(prop), Py_TYPE(value)->tp_name); + if(PyUnicode_Check(value)) { + /* there was an error assigning a string type, + * rather than setting a new error, prefix the existing one + */ + PyC_Err_Format_Prefix(PyExc_TypeError, + "%.200s %.200s.%.200s error assigning string", + error_prefix, RNA_struct_identifier(ptr->type), + RNA_property_identifier(prop)); + } + else { + PyErr_Format(PyExc_TypeError, + "%.200s %.200s.%.200s expected a string type, not %.200s", + error_prefix, RNA_struct_identifier(ptr->type), + RNA_property_identifier(prop), Py_TYPE(value)->tp_name); + } + return -1; } else { @@ -6427,14 +6439,11 @@ static int bpy_class_call(bContext *C, PointerRNA *ptr, FunctionRNA *func, Param * no line number since the func has finished calling on error, * re-raise the exception with more info since it would be slow to * create prefix on every call (when there are no errors) */ - if(err == -1 && PyErr_Occurred()) { - PyObject *error_type, *error_value, *error_traceback; - PyErr_Fetch(&error_type, &error_value, &error_traceback); - - PyErr_Format(error_type, - "class %.200s, function %.200s: incompatible return value%S", - RNA_struct_identifier(ptr->type), RNA_function_identifier(func), - error_value); + if(err == -1) { + PyC_Err_Format_Prefix(PyExc_RuntimeError, + "class %.200s, function %.200s: incompatible return value ", + RNA_struct_identifier(ptr->type), RNA_function_identifier(func) + ); } } else if (ret_len > 1) { diff --git a/source/blender/python/intern/gpu.c b/source/blender/python/intern/gpu.c index 334bb1f725a..8fa6a7b0629 100644 --- a/source/blender/python/intern/gpu.c +++ b/source/blender/python/intern/gpu.c @@ -55,6 +55,8 @@ #include "bpy_rna.h" +#include "gpu.h" + #define PY_MODULE_ADD_CONSTANT(module, name) PyModule_AddIntConstant(module, #name, name) PyDoc_STRVAR(M_gpu_doc, diff --git a/source/blender/render/intern/include/voxeldata.h b/source/blender/render/intern/include/voxeldata.h index e9991a2a19c..aa3fd104ecf 100644 --- a/source/blender/render/intern/include/voxeldata.h +++ b/source/blender/render/intern/include/voxeldata.h @@ -45,6 +45,6 @@ typedef struct VoxelDataHeader void make_voxeldata(struct Render *re); void free_voxeldata(struct Render *re); -int voxeldatatex(struct Tex *tex, float *texvec, struct TexResult *texres); +int voxeldatatex(struct Tex *tex, const float texvec[3], struct TexResult *texres); #endif /* VOXELDATA_H */ diff --git a/source/blender/render/intern/raytrace/rayobject_octree.cpp b/source/blender/render/intern/raytrace/rayobject_octree.cpp index e35fcbc2df7..5fa0b836f4f 100644 --- a/source/blender/render/intern/raytrace/rayobject_octree.cpp +++ b/source/blender/render/intern/raytrace/rayobject_octree.cpp @@ -264,7 +264,7 @@ static int face_in_node(RayFace *face, short x, short y, short z, float rtf[][3] return 0; } -static void ocwrite(Octree *oc, RayFace *face, int quad, short x, short y, short z, float rtf[][3]) +static void ocwrite(Octree *oc, RayFace *face, int quad, short x, short y, short z, float rtf[4][3]) { Branch *br; Node *no; diff --git a/source/blender/render/intern/source/convertblender.c b/source/blender/render/intern/source/convertblender.c index c323760296b..ba7af235acc 100644 --- a/source/blender/render/intern/source/convertblender.c +++ b/source/blender/render/intern/source/convertblender.c @@ -822,7 +822,7 @@ static void autosmooth(Render *UNUSED(re), ObjectRen *obr, float mat[][4], int d if(obr->totvert==0) return; asverts= MEM_callocN(sizeof(ASvert)*obr->totvert, "all smooth verts"); - thresh= cosf((float)M_PI*(0.5f+(float)degr)/180.0f ); + thresh= cosf(DEG2RADF((0.5f + (float)degr))); /* step zero: give faces normals of original mesh, if this is provided */ @@ -1488,8 +1488,8 @@ static void particle_normal_ren(short ren_as, ParticleSettings *part, Render *re if(part->draw & PART_DRAW_VEL_LENGTH) mul_v3_fl(vel, len_v3(state->vel)); - VECADDFAC(loc0, loc, vel, -part->draw_line[0]); - VECADDFAC(loc1, loc, vel, part->draw_line[1]); + madd_v3_v3v3fl(loc0, loc, vel, -part->draw_line[0]); + madd_v3_v3v3fl(loc1, loc, vel, part->draw_line[1]); particle_curve(re, obr, dm, ma, sd, loc0, loc1, seed, pa_co); @@ -1717,7 +1717,7 @@ static int render_new_particle_system(Render *re, ObjectRen *obr, ParticleSystem if(part->draw & PART_DRAW_REN_ADAPT) { sd.adapt = 1; sd.adapt_pix = (float)part->adapt_pix; - sd.adapt_angle = cos((float)part->adapt_angle * (float)(M_PI / 180.0)); + sd.adapt_angle = cosf(DEG2RADF((float)part->adapt_angle)); } if(re->r.renderer==R_INTERN && part->draw&PART_DRAW_REN_STRAND) { @@ -1728,7 +1728,7 @@ static int render_new_particle_system(Render *re, ObjectRen *obr, ParticleSystem strandbuf->winx= re->winx; strandbuf->winy= re->winy; strandbuf->maxdepth= 2; - strandbuf->adaptcos= cos((float)part->adapt_angle*(float)(M_PI/180.0)); + strandbuf->adaptcos= cosf(DEG2RADF((float)part->adapt_angle)); strandbuf->overrideuv= sd.override_uv; strandbuf->minwidth= ma->strand_min; diff --git a/source/blender/render/intern/source/envmap.c b/source/blender/render/intern/source/envmap.c index 66a73b47790..e2b3b23b9c9 100644 --- a/source/blender/render/intern/source/envmap.c +++ b/source/blender/render/intern/source/envmap.c @@ -240,8 +240,8 @@ static void envmap_transmatrix(float mat[][4], int part) copy_m4_m4(tmat, mat); eul_to_mat4( rotmat,eul); mul_serie_m4(mat, tmat, rotmat, - 0, 0, 0, - 0, 0, 0); + NULL, NULL, NULL, + NULL, NULL, NULL); } /* ------------------------------------------------------------------------- */ diff --git a/source/blender/render/intern/source/pipeline.c b/source/blender/render/intern/source/pipeline.c index 49e5e7b989d..05bcc32a90a 100644 --- a/source/blender/render/intern/source/pipeline.c +++ b/source/blender/render/intern/source/pipeline.c @@ -1452,10 +1452,12 @@ void RE_test_break_cb(Render *re, void *handle, int (*f)(void *handle)) /* object is considered fully prepared on correct time etc */ /* includes lights */ +#if 0 void RE_AddObject(Render *UNUSED(re), Object *UNUSED(ob)) { } +#endif /* *************************************** */ diff --git a/source/blender/render/intern/source/rendercore.c b/source/blender/render/intern/source/rendercore.c index 16bbe1ca5c2..59a505a3195 100644 --- a/source/blender/render/intern/source/rendercore.c +++ b/source/blender/render/intern/source/rendercore.c @@ -2234,21 +2234,17 @@ static int bake_intersect_tree(RayObject* raytree, Isect* isect, float *start, f maxdist= R.r.bake_maxdist; else maxdist= RE_RAYTRACE_MAXDIST + R.r.bake_biasdist; - + /* 'dir' is always normalized */ - VECADDFAC(isect->start, start, dir, -R.r.bake_biasdist); + madd_v3_v3v3fl(isect->start, start, dir, -R.r.bake_biasdist); - isect->dir[0] = dir[0]*sign; - isect->dir[1] = dir[1]*sign; - isect->dir[2] = dir[2]*sign; + mul_v3_v3fl(isect->dir, dir, sign); isect->dist = maxdist; hit = RE_rayobject_raycast(raytree, isect); if(hit) { - hitco[0] = isect->start[0] + isect->dist*isect->dir[0]; - hitco[1] = isect->start[1] + isect->dist*isect->dir[1]; - hitco[2] = isect->start[2] + isect->dist*isect->dir[2]; + madd_v3_v3v3fl(hitco, isect->start, isect->dir, isect->dist); *dist= isect->dist; } diff --git a/source/blender/render/intern/source/shadeinput.c b/source/blender/render/intern/source/shadeinput.c index 128900d1fd2..d8231c7e7d4 100644 --- a/source/blender/render/intern/source/shadeinput.c +++ b/source/blender/render/intern/source/shadeinput.c @@ -1165,8 +1165,9 @@ void shade_input_set_shade_texco(ShadeInput *shi) shi->vcol[2]= 1.0f; shi->vcol[3]= 1.0f; } - if(tface && tface->tpage) + if(tface->tpage) { render_realtime_texture(shi, tface->tpage); + } } diff --git a/source/blender/render/intern/source/volumetric.c b/source/blender/render/intern/source/volumetric.c index ad6a951adff..608882e7eb7 100644 --- a/source/blender/render/intern/source/volumetric.c +++ b/source/blender/render/intern/source/volumetric.c @@ -186,7 +186,7 @@ static void shade_intersection(ShadeInput *shi, float col_r[4], Isect *is) col_r[3] = shr_new.alpha; } -static void vol_trace_behind(ShadeInput *shi, VlakRen *vlr, const float co[3], float col[3]) +static void vol_trace_behind(ShadeInput *shi, VlakRen *vlr, const float co[3], float col_r[4]) { Isect isect; @@ -204,10 +204,10 @@ static void vol_trace_behind(ShadeInput *shi, VlakRen *vlr, const float co[3], f /* check to see if there's anything behind the volume, otherwise shade the sky */ if(RE_rayobject_raycast(R.raytree, &isect)) { - shade_intersection(shi, col, &isect); + shade_intersection(shi, col_r, &isect); } else { - shadeSkyView(col, co, shi->view, NULL, shi->thread); - shadeSunView(col, shi->view); + shadeSkyView(col_r, co, shi->view, NULL, shi->thread); + shadeSunView(col_r, shi->view); } } @@ -699,7 +699,7 @@ static void volume_trace(struct ShadeInput *shi, struct ShadeResult *shr, int in } else { /* we're tracing through the volume between the camera * and a solid surface, so use that pre-shaded radiance */ - QUATCOPY(col, shr->combined); + copy_v4_v4(col, shr->combined); } /* shade volume from 'camera' to 1st hit point */ diff --git a/source/blender/render/intern/source/voxeldata.c b/source/blender/render/intern/source/voxeldata.c index 2ba346ae4c5..b63ece80119 100644 --- a/source/blender/render/intern/source/voxeldata.c +++ b/source/blender/render/intern/source/voxeldata.c @@ -383,7 +383,7 @@ void make_voxeldata(struct Render *re) } -int voxeldatatex(struct Tex *tex, float *texvec, struct TexResult *texres) +int voxeldatatex(struct Tex *tex, const float texvec[3], struct TexResult *texres) { int retval = TEX_INT; VoxelData *vd = tex->vd; diff --git a/source/blender/render/intern/source/zbuf.c b/source/blender/render/intern/source/zbuf.c index ba922620ee1..ac56304bdcb 100644 --- a/source/blender/render/intern/source/zbuf.c +++ b/source/blender/render/intern/source/zbuf.c @@ -239,7 +239,7 @@ static short cliptestf(float p, float q, float *u1, float *u2) return 1; } -int testclip(const float v[3]) +int testclip(const float v[4]) { float abs4; /* WATCH IT: this function should do the same as cliptestf, otherwise troubles in zbufclip()*/ short c=0; @@ -843,7 +843,7 @@ static void zbufline_onlyZ(ZSpan *zspan, int UNUSED(obi), int UNUSED(zvlnr), flo } -static int clipline(float *v1, float *v2) /* return 0: do not draw */ +static int clipline(float v1[4], float v2[4]) /* return 0: do not draw */ { float dz,dw, u1=0.0, u2=1.0; float dx, dy, v13; @@ -893,7 +893,7 @@ static int clipline(float *v1, float *v2) /* return 0: do not draw */ return 0; } -void hoco_to_zco(ZSpan *zspan, float *zco, float *hoco) +void hoco_to_zco(ZSpan *zspan, float zco[3], const float hoco[4]) { float div; @@ -998,7 +998,7 @@ void zbufclipwire(ZSpan *zspan, int obi, int zvlnr, int ec, float *ho1, float *h } -void zbufsinglewire(ZSpan *zspan, int obi, int zvlnr, float *ho1, float *ho2) +void zbufsinglewire(ZSpan *zspan, int obi, int zvlnr, const float ho1[4], const float ho2[4]) { float f1[4], f2[4]; int c1, c2; @@ -1008,8 +1008,8 @@ void zbufsinglewire(ZSpan *zspan, int obi, int zvlnr, float *ho1, float *ho2) if(c1 | c2) { /* not in the middle */ if(!(c1 & c2)) { /* not out completely */ - QUATCOPY(f1, ho1); - QUATCOPY(f2, ho2); + copy_v4_v4(f1, ho1); + copy_v4_v4(f2, ho2); if(clipline(f1, f2)) { hoco_to_zco(zspan, f1, f1); diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c index 68a4eebf93f..5e4505abaa5 100644 --- a/source/blender/windowmanager/intern/wm_operators.c +++ b/source/blender/windowmanager/intern/wm_operators.c @@ -80,6 +80,7 @@ #include "BIF_glutil.h" /* for paint cursor */ #include "IMB_imbuf_types.h" +#include "IMB_imbuf.h" #include "ED_screen.h" #include "ED_util.h" @@ -1206,6 +1207,9 @@ static int wm_resource_check_prev(void) static uiBlock *wm_block_create_splash(bContext *C, ARegion *ar, void *UNUSED(arg)) { + extern char datatoc_splash_png[]; + extern int datatoc_splash_png_size; + uiBlock *block; uiBut *but; uiLayout *layout, *split, *col; @@ -1214,6 +1218,8 @@ static uiBlock *wm_block_create_splash(bContext *C, ARegion *ar, void *UNUSED(ar int i; MenuType *mt= WM_menutype_find("USERPREF_MT_splash", TRUE); char url[96]; + /* hardcoded to splash, loading and freeing every draw, eek! */ + ImBuf *ibuf= IMB_ibImageFromMemory((unsigned char*)datatoc_splash_png, datatoc_splash_png_size, IB_rect); #ifdef WITH_BUILDINFO int ver_width, rev_width; @@ -1237,7 +1243,7 @@ static uiBlock *wm_block_create_splash(bContext *C, ARegion *ar, void *UNUSED(ar block= uiBeginBlock(C, ar, "_popup", UI_EMBOSS); uiBlockSetFlag(block, UI_BLOCK_KEEP_OPEN); - but= uiDefBut(block, BUT_IMAGE, 0, "", 0, 10, 501, 282, NULL, 0.0, 0.0, 0, 0, ""); + but= uiDefBut(block, BUT_IMAGE, 0, "", 0, 10, 501, 282, ibuf, 0.0, 0.0, 0, 0, ""); /* button owns the imbuf now */ uiButSetFunc(but, wm_block_splash_close, block, NULL); uiBlockSetFunc(block, wm_block_splash_refreshmenu, block, NULL); diff --git a/source/creator/CMakeLists.txt b/source/creator/CMakeLists.txt index b48915ce708..666be16e73e 100644 --- a/source/creator/CMakeLists.txt +++ b/source/creator/CMakeLists.txt @@ -435,12 +435,12 @@ elseif(WIN32) PATTERN ".svn" EXCLUDE ) - if(NOT CMAKE_CL_64) - install( - FILES ${LIBDIR}/gettext/lib/gnu_gettext.dll - DESTINATION ${TARGETDIR} - ) + install( + FILES ${LIBDIR}/gettext/lib/gnu_gettext.dll + DESTINATION ${TARGETDIR} + ) + if(NOT CMAKE_CL_64) install( FILES ${LIBDIR}/iconv/lib/iconv.dll DESTINATION ${TARGETDIR} diff --git a/source/creator/creator.c b/source/creator/creator.c index 264b4fc6208..91c2d74dc26 100644 --- a/source/creator/creator.c +++ b/source/creator/creator.c @@ -560,7 +560,7 @@ static int set_engine(int argc, const char **argv, void *data) RenderData *rd = &scene->r; if(BLI_findstring(&R_engines, argv[1], offsetof(RenderEngineType, idname))) { - BLI_strncpy(rd->engine, argv[1], sizeof(rd->engine)); + BLI_strncpy_utf8(rd->engine, argv[1], sizeof(rd->engine)); } } } diff --git a/source/gameengine/Converter/BL_ArmatureObject.cpp b/source/gameengine/Converter/BL_ArmatureObject.cpp index 684bd3f341e..c5bf28b9b8d 100644 --- a/source/gameengine/Converter/BL_ArmatureObject.cpp +++ b/source/gameengine/Converter/BL_ArmatureObject.cpp @@ -110,7 +110,6 @@ void game_copy_pose(bPose **dst, bPose *src, int copy_constraint) for (pchan=(bPoseChannel*)out->chanbase.first; pchan; pchan=(bPoseChannel*)pchan->next) { pchan->parent= (bPoseChannel*)BLI_ghash_lookup(ghash, pchan->parent); pchan->child= (bPoseChannel*)BLI_ghash_lookup(ghash, pchan->child); - pchan->path= NULL; if (copy_constraint) { ListBase listb; diff --git a/source/gameengine/Ketsji/KX_Dome.cpp b/source/gameengine/Ketsji/KX_Dome.cpp index 00c5e5803a8..f0ea6f15ffe 100644 --- a/source/gameengine/Ketsji/KX_Dome.cpp +++ b/source/gameengine/Ketsji/KX_Dome.cpp @@ -561,7 +561,7 @@ void KX_Dome::CreateMeshDome180(void) int i,j; float uv_ratio = (float)(m_buffersize-1) / m_imagesize; - m_radangle = m_angle * M_PI/180.0;//calculates the radians angle, used for flattening + m_radangle = DEG2RADF(m_angle); //calculates the radians angle, used for flattening //creating faces for the env mapcube 180deg Dome // Top Face - just a triangle diff --git a/source/gameengine/Ketsji/KX_GameObject.cpp b/source/gameengine/Ketsji/KX_GameObject.cpp index ae8d7094015..853b36b54f7 100644 --- a/source/gameengine/Ketsji/KX_GameObject.cpp +++ b/source/gameengine/Ketsji/KX_GameObject.cpp @@ -364,7 +364,9 @@ BL_ActionManager* KX_GameObject::GetActionManager() { // We only want to create an action manager if we need it if (!m_actionManager) - { KX_GetActiveScene()->AddAnimatedObject(this); m_actionManager = new BL_ActionManager(this); + { + KX_GetActiveScene()->AddAnimatedObject(this); + m_actionManager = new BL_ActionManager(this); } return m_actionManager; } diff --git a/source/gameengine/Ketsji/KX_KetsjiEngine.cpp b/source/gameengine/Ketsji/KX_KetsjiEngine.cpp index 65ff06456b4..acd25ace04a 100644 --- a/source/gameengine/Ketsji/KX_KetsjiEngine.cpp +++ b/source/gameengine/Ketsji/KX_KetsjiEngine.cpp @@ -327,6 +327,8 @@ void KX_KetsjiEngine::RenderDome() // do the rendering m_dome->RenderDomeFrame(scene,cam, i); + //render all the font objects for this scene + RenderFonts(scene); } list<class KX_Camera*>* cameras = scene->GetCameras(); @@ -344,6 +346,8 @@ void KX_KetsjiEngine::RenderDome() // do the rendering m_dome->RenderDomeFrame(scene, (*it),i); + //render all the font objects for this scene + RenderFonts(scene); } it++; diff --git a/source/gameengine/Ketsji/KX_Scene.cpp b/source/gameengine/Ketsji/KX_Scene.cpp index bdc30810b9e..7ff4a786387 100644 --- a/source/gameengine/Ketsji/KX_Scene.cpp +++ b/source/gameengine/Ketsji/KX_Scene.cpp @@ -1034,6 +1034,8 @@ int KX_Scene::NewRemoveObject(class CValue* gameobj) ret = newobj->Release(); if (m_euthanasyobjects->RemoveValue(newobj)) ret = newobj->Release(); + if (m_animatedlist->RemoveValue(newobj)) + ret = newobj->Release(); if (newobj == m_active_camera) { @@ -1525,6 +1527,7 @@ void KX_Scene::LogicBeginFrame(double curtime) void KX_Scene::AddAnimatedObject(CValue* gameobj) { + gameobj->AddRef(); m_animatedlist->Add(gameobj); } @@ -1537,7 +1540,7 @@ void KX_Scene::UpdateAnimations(double curtime) { // Update any animations for (int i=0; i<m_animatedlist->GetCount(); ++i) - ((KX_GameObject*)GetObjectList()->GetValue(i))->UpdateActionManager(curtime); + ((KX_GameObject*)m_animatedlist->GetValue(i))->UpdateActionManager(curtime); } void KX_Scene::LogicUpdateFrame(double curtime, bool frame) |