diff options
530 files changed, 8789 insertions, 6908 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 71a52c0c928..3b409a07652 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -226,7 +226,7 @@ if(UNIX AND NOT APPLE) # No way to set py31. remove for now. # find_package(PythonLibs) set(PYTHON /usr) - set(PYTHON_VERSION 3.1) + set(PYTHON_VERSION 3.1 CACHE STRING "") set(PYTHON_INCLUDE_DIRS "${PYTHON}/include/python${PYTHON_VERSION}" CACHE STRING "") mark_as_advanced(PYTHON_INCLUDE_DIRS) # set(PYTHON_BINARY python) # not used yet @@ -547,17 +547,24 @@ elseif(WIN32) endif() if(WITH_IMAGE_OPENEXR) - set(OPENEXR ${LIBDIR}/openexr) - set(OPENEXR_INC ${OPENEXR}/include ${OPENEXR}/include/IlmImf ${OPENEXR}/include/Iex ${OPENEXR}/include/Imath) - set(OPENEXR_LIB Iex Half IlmImf Imath IlmThread) if(MSVC80) - set(OPENEXR_LIBPATH ${OPENEXR}/lib_vs2005) + set(MSVC_LIB _vs2005) + set(MSVC_INC) + elseif(MSVC90) + set(MSVC_LIB _vs2008) + set(MSVC_INC) + elseif(MSVC10) + set(MSVC_LIB _vs2010) + set(MSVC_INC _vs2010) else() - set(OPENEXR_LIBPATH ${OPENEXR}/lib_msvc) - endif() - if(MSVC90) - set(OPENEXR_LIBPATH ${OPENEXR}/lib_vs2008) + set(MSVC_LIB msvc) + set(MSVC_INC) endif() + set(OPENEXR ${LIBDIR}/openexr) + set(OPENEXR_LIB Iex Half IlmImf Imath IlmThread) + set(OPENEXR_LIBPATH ${OPENEXR}/lib${MSVC_LIB}) + set(OPENEXR_INCUDE ${OPENEXR}/include${MSVC_INC}) + set(OPENEXR_INC ${OPENEXR_INCUDE}/ ${OPENEXR_INCUDE}/IlmImf ${OPENEXR_INCUDE}/Iex ${OPENEXR_INCUDE}/Imath) endif() if(WITH_IMAGE_TIFF) diff --git a/GNUmakefile b/GNUmakefile index eb21e0e167a..2abb6846e95 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -28,12 +28,13 @@ # System Vars OS:=$(shell uname -s) -CPU:=$(shell uname -m) +OS_NCASE:=$(shell uname -s | tr '[A-Z]' '[a-z]') +# CPU:=$(shell uname -m) # UNUSED # Source and Build DIR's BLENDER_DIR:=$(shell pwd -P) -BUILD_DIR:=$(shell dirname $(BLENDER_DIR))/build/$(OS)_$(CPU) +BUILD_DIR:=$(shell dirname $(BLENDER_DIR))/build/$(OS_NCASE) # Get the number of cores for threaded build @@ -60,7 +61,7 @@ all: if test ! -f $(BUILD_DIR)/CMakeCache.txt ; then \ mkdir -p $(BUILD_DIR) ; \ cd $(BUILD_DIR) ; \ - cmake $(BLENDER_DIR) ; \ + cmake $(BLENDER_DIR) -DCMAKE_BUILD_TYPE:STRING=Release ; \ fi @echo diff --git a/SConstruct b/SConstruct index 03e61cd06b6..fe60d41c48d 100644 --- a/SConstruct +++ b/SConstruct @@ -489,11 +489,13 @@ if env['OURPLATFORM']!='darwin': dn.remove('.svn') if '_svn' in dn: dn.remove('_svn') - + if '__pycache__' in dn: # py3.2 cache dir + dn.remove('__pycache__') + dir = os.path.join(env['BF_INSTALLDIR'], VERSION) dir += os.sep + os.path.basename(scriptpath) + dp[len(scriptpath):] - - source=[os.path.join(dp, f) for f in df if f[-3:]!='pyc'] + + source=[os.path.join(dp, f) for f in df if not f.endswith(".pyc")] # To ensure empty dirs are created too if len(source)==0: env.Execute(Mkdir(dir)) diff --git a/build_files/package_spec/build_debian.sh b/build_files/package_spec/build_debian.sh new file mode 100755 index 00000000000..8ebcde99ef2 --- /dev/null +++ b/build_files/package_spec/build_debian.sh @@ -0,0 +1,35 @@ +#!/bin/sh +# Builds a debian package from SVN source. +# +# For paralelle builds use: +# DEB_BUILD_OPTIONS="parallel=5" sh build_files/package_spec/build_debian.sh + +# this needs to run in the root dir. +cd $(dirname $0)/../../ +rm -rf debian +cp -a build_files/package_spec/debian . + + +# Get values from blender to use in debian/changelog. +BLENDER_REVISION=$(svnversion) + +blender_srcdir=$PWD +blender_version=$(grep BLENDER_VERSION $blender_srcdir/source/blender/blenkernel/BKE_blender.h | tr -dc 0-9) +blender_subversion=$(grep BLENDER_SUBVERSION $blender_srcdir/source/blender/blenkernel/BKE_blender.h | tr -dc 0-9) +BLENDER_VERSION=$(expr $blender_version / 100).$(expr $blender_version % 100).${blender_subversion} +DEB_VERSION=${BLENDER_VERSION}+svn${BLENDER_REVISION}-bf + +# update debian/changelog +dch -b -v $DEB_VERSION "New upstream SVN snapshot." + + +# run the rules makefile +debian/rules get-orig-source SVN_URL=. +mv *.gz ../ + +# build the package +debuild -i -us -uc -b + + +# remove temp dir +rm -rf debian diff --git a/build_files/package_spec/debian/changelog b/build_files/package_spec/debian/changelog new file mode 100644 index 00000000000..0559bb0c4d8 --- /dev/null +++ b/build_files/package_spec/debian/changelog @@ -0,0 +1,5 @@ +blender (2.56+svn34749-bf) unstable; urgency=low + + * New upstream SVN snapshot. + + -- Dan Eicher <dan@trollwerks.org> Wed, 09 Feb 2011 18:55:24 -0700 diff --git a/build_files/package_spec/debian/compat b/build_files/package_spec/debian/compat new file mode 100644 index 00000000000..7f8f011eb73 --- /dev/null +++ b/build_files/package_spec/debian/compat @@ -0,0 +1 @@ +7 diff --git a/build_files/package_spec/debian/control b/build_files/package_spec/debian/control new file mode 100644 index 00000000000..5d9615faf8b --- /dev/null +++ b/build_files/package_spec/debian/control @@ -0,0 +1,23 @@ +Source: blender +Section: graphics +Priority: extra +Maintainer: Dan Eicher <dan@trollwerks.org> +Build-Depends: debhelper (>= 7.0.50~), cmake, python3, python, libfreetype6-dev, libglu1-mesa-dev, libilmbase-dev, libopenexr-dev, libjpeg62-dev, libopenal-dev, libpng12-dev, libsamplerate0-dev, libsdl-dev, libtiff4-dev, libx11-dev, libxi-dev, zlib1g-dev, python3.1-dev [!hurd-i386 !kfreebsd-amd64 !kfreebsd-i386] +Standards-Version: 3.9.1 +Homepage: http://blender.org/ +Vcs-Browser: http://github.com/eponymous/blender +Vcs-Git: git://github.com/eponymous/blender.git +X-Python3-Version: >= 3.1, << 3.2 + +Package: blender +Architecture: any +Depends: ${shlibs:Depends}, ${python3:Depends}, ${misc:Depends} +Description: Very fast and versatile 3D modeller/renderer + Blender is an integrated 3d suite for modelling, animation, rendering, + post-production, interactive creation and playback (games). Blender has its + own particular user interface, which is implemented entirely in OpenGL and + designed with speed in mind. Python bindings are available for scripting; + import/export features for popular file formats like 3D Studio and Wavefront + Obj are implemented as scripts by the community. Stills, animations, models + for games or other third party engines and interactive content in the form of + a standalone binary and/or a web plug-in are common products of Blender use. diff --git a/build_files/package_spec/debian/copyright b/build_files/package_spec/debian/copyright new file mode 100644 index 00000000000..5758dc3a086 --- /dev/null +++ b/build_files/package_spec/debian/copyright @@ -0,0 +1,92 @@ +This work was packaged for Debian by: + + Dan Eicher <dan@trollwerks.org> on Tue, 08 Feb 2011 21:59:32 -0700 + +It was downloaded from: + + http://blender.org + +Copyright: + + Copyright (C) 2002-2011 Blender Foundation + +License: + + This package 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 package 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, see <http://www.gnu.org/licenses/> + +On Debian systems, the complete text of the GNU General +Public License version 2 can be found in "/usr/share/common-licenses/GPL-2". + +Python: + + PYTHON SOFTWARE FOUNDATION LICENSE VERSION 2 + -------------------------------------------- + + 1. This LICENSE AGREEMENT is between the Python Software Foundation + ("PSF"), and the Individual or Organization ("Licensee") accessing and + otherwise using this software ("Python") in source or binary form and + its associated documentation. + + 2. Subject to the terms and conditions of this License Agreement, PSF + hereby grants Licensee a nonexclusive, royalty-free, world-wide + license to reproduce, analyze, test, perform and/or display publicly, + prepare derivative works, distribute, and otherwise use Python + alone or in any derivative version, provided, however, that PSF's + License Agreement and PSF's notice of copyright, i.e., "Copyright (c) + 2001, 2002, 2003, 2004, 2005, 2006 Python Software Foundation; All Rights + Reserved" are retained in Python alone or in any derivative version + prepared by Licensee. + + 3. In the event Licensee prepares a derivative work that is based on + or incorporates Python or any part thereof, and wants to make + the derivative work available to others as provided herein, then + Licensee hereby agrees to include in any such work a brief summary of + the changes made to Python. + + 4. PSF is making Python available to Licensee on an "AS IS" + basis. PSF MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR + IMPLIED. BY WAY OF EXAMPLE, BUT NOT LIMITATION, PSF MAKES NO AND + DISCLAIMS ANY REPRESENTATION OR WARRANTY OF MERCHANTABILITY OR FITNESS + FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF PYTHON WILL NOT + INFRINGE ANY THIRD PARTY RIGHTS. + + 5. PSF SHALL NOT BE LIABLE TO LICENSEE OR ANY OTHER USERS OF PYTHON + FOR ANY INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES OR LOSS AS + A RESULT OF MODIFYING, DISTRIBUTING, OR OTHERWISE USING PYTHON, + OR ANY DERIVATIVE THEREOF, EVEN IF ADVISED OF THE POSSIBILITY THEREOF. + + 6. This License Agreement will automatically terminate upon a material + breach of its terms and conditions. + + 7. Nothing in this License Agreement shall be deemed to create any + relationship of agency, partnership, or joint venture between PSF and + Licensee. This License Agreement does not grant permission to use PSF + trademarks or trade name in a trademark sense to endorse or promote + products or services of Licensee, or any third party. + + 8. By copying, installing or otherwise using Python, Licensee + agrees to be bound by the terms and conditions of this License + Agreement. + + +The Debian packaging is: + + Copyright (C) 2011 Dan Eicher <dan@trollwerks.org> + +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. + + diff --git a/build_files/package_spec/debian/docs b/build_files/package_spec/debian/docs new file mode 100644 index 00000000000..2cefea03ad4 --- /dev/null +++ b/build_files/package_spec/debian/docs @@ -0,0 +1 @@ +release/text/readme.html diff --git a/build_files/package_spec/debian/menu b/build_files/package_spec/debian/menu new file mode 100644 index 00000000000..b30788d55b5 --- /dev/null +++ b/build_files/package_spec/debian/menu @@ -0,0 +1,4 @@ +?package(blender):needs="X11" section="Applications/Graphics"\ + longtitle="Blender 3D modeler / renderer"\ + icon="/usr/share/pixmaps/blender.svg"\ + title="blender" command="/usr/bin/blender" diff --git a/build_files/package_spec/debian/rules b/build_files/package_spec/debian/rules new file mode 100755 index 00000000000..5844d289d88 --- /dev/null +++ b/build_files/package_spec/debian/rules @@ -0,0 +1,30 @@ +#!/usr/bin/make -f +# -*- makefile -*- + +SVN_URL := https://svn.blender.org/svnroot/bf-blender/trunk/blender +REV := $(shell dpkg-parsechangelog | sed -rne 's,^Version: .*[+~]svn([0-9]+).*,\1,p') +VER := $(shell dpkg-parsechangelog | sed -rne 's,^Version: ([^-]+).*,\1,p') +REL := $(shell dpkg-parsechangelog | sed -rne 's,^Version: ([0-9]+\.[0-9]+).*,\1,p') +TARBALL = blender_$(VER).orig.tar.gz +BLDDIR = debian/cmake + +%: + dh $@ -Scmake -B$(BLDDIR) --parallel --with python3 --without python-support + +override_dh_auto_configure: + # blender spesific CMake options + dh_auto_configure -- \ + -DCMAKE_BUILD_TYPE:STRING=Release \ + -DWITH_PYTHON_INSTALL:BOOL=OFF \ + -DWITH_OPENCOLLADA:BOOL=OFF + +override_dh_python3: + dh_python3 -V 3.1-3.2 /usr/share/blender/$(REL)/scripts + +get-orig-source: + rm -rf get-orig-source $(TARBALL) + mkdir get-orig-source + svn -q export -r $(REV) $(SVN_URL) get-orig-source/blender-$(VER) + GZIP='--best --no-name' tar czf $(TARBALL) -C get-orig-source blender-$(VER) + rm -rf get-orig-source + echo " "$(TARBALL)" created; move it to the right destination to build the package" diff --git a/build_files/package_spec/debian/source/format b/build_files/package_spec/debian/source/format new file mode 100644 index 00000000000..163aaf8d82b --- /dev/null +++ b/build_files/package_spec/debian/source/format @@ -0,0 +1 @@ +3.0 (quilt) diff --git a/build_files/package_spec/debian/watch b/build_files/package_spec/debian/watch new file mode 100644 index 00000000000..25e0a6ddccc --- /dev/null +++ b/build_files/package_spec/debian/watch @@ -0,0 +1,2 @@ +version=3 +http://download.blender.org/source/blender-([0-9.]+[a-z]?)\.tar\.gz diff --git a/build_files/package_spec/pacman/PKGBUILD b/build_files/package_spec/pacman/PKGBUILD index c419ce9096e..4a96580e0c5 100644 --- a/build_files/package_spec/pacman/PKGBUILD +++ b/build_files/package_spec/pacman/PKGBUILD @@ -1,10 +1,11 @@ # Maintainer: Campbell Barton <ideasman42 at gmail dot com> # custom blender vars -blender_srcdir=$srcdir/../../../.. +blender_srcdir=$(dirname $srcdir)"/../../.." +blender_revision=$(svnversion $blender_srcdir) blender_version=$(grep BLENDER_VERSION $blender_srcdir/source/blender/blenkernel/BKE_blender.h | tr -dc 0-9) -blender_subversion=$(grep BLENDER_SUBVERSION $blender_srcdir/source/blender/blenkernel/BKE_blender.h | tr -dc 0-9) -blender_ver_string=$(expr $blender_version / 100).$(expr $blender_version % 100).$blender_subversion +# blender_subversion=$(grep BLENDER_SUBVERSION $blender_srcdir/source/blender/blenkernel/BKE_blender.h | tr -dc 0-9) +blender_ver_string=$(expr $blender_version / 100).$(expr $blender_version % 100)+svn$blender_revision pkgname=blender-beta pkgver=$blender_ver_string @@ -14,7 +15,7 @@ arch=('i686' 'x86_64') url="www.blender.org" license=('GPL') groups=() -depends=('libjpeg' 'libpng' 'openexr' 'python3>=3.1' 'gettext' 'libxi' 'libxmu' 'mesa' 'freetype2' 'openal' 'sdl' 'libsndfile' 'libsamplerate' 'ffmpeg') +depends=('libjpeg' 'libpng' 'openexr' 'python>=3.1' 'gettext' 'libxi' 'libxmu' 'mesa' 'freetype2' 'openal' 'sdl' 'libsndfile' 'libsamplerate' 'ffmpeg') makedepends=('cmake' 'svn') optdepends=() provides=('blender') @@ -45,4 +46,5 @@ build() { package() { cd $srcdir/build make DESTDIR="$pkgdir" install + python -m compileall $pkgdir/usr/share/blender } diff --git a/extern/bullet2/CMakeLists.txt b/extern/bullet2/CMakeLists.txt index a8f8801af70..74f0fc2ab56 100644 --- a/extern/bullet2/CMakeLists.txt +++ b/extern/bullet2/CMakeLists.txt @@ -319,7 +319,7 @@ set(SRC src/btBulletDynamicsCommon.h ) -if(CMAKE_COMPILER_IS_GNUCC) +if(CMAKE_COMPILER_IS_GNUCXX) # needed for gcc 4.6+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fpermissive") endif() diff --git a/intern/ghost/intern/GHOST_WindowX11.cpp b/intern/ghost/intern/GHOST_WindowX11.cpp index 6830db8241c..c9f39bc7c2c 100644 --- a/intern/ghost/intern/GHOST_WindowX11.cpp +++ b/intern/ghost/intern/GHOST_WindowX11.cpp @@ -674,7 +674,7 @@ setTitle( XChangeProperty(m_display, m_window, name, utf8str, 8, PropModeReplace, (const unsigned char*) title.ReadPtr(), - strlen(title.ReadPtr())); + title.Length()); // This should convert to valid x11 string // and getTitle would need matching change diff --git a/intern/guardedalloc/MEM_guardedalloc.h b/intern/guardedalloc/MEM_guardedalloc.h index d712a6ac2d9..2276c5ef0e6 100644 --- a/intern/guardedalloc/MEM_guardedalloc.h +++ b/intern/guardedalloc/MEM_guardedalloc.h @@ -59,13 +59,14 @@ #include "stdio.h" /* needed for FILE* */ #include "BLO_sys_types.h" /* needed for uintptr_t */ -#ifdef __GNUC__ -# define WARN_UNUSED __attribute__((warn_unused_result)) -#else -# define WARN_UNUSED +#ifndef WARN_UNUSED +# ifdef __GNUC__ +# define WARN_UNUSED __attribute__((warn_unused_result)) +# else +# define WARN_UNUSED +# endif #endif - #ifdef __cplusplus extern "C" { #endif diff --git a/intern/guardedalloc/intern/mallocn.c b/intern/guardedalloc/intern/mallocn.c index 83aceb12344..27170439a53 100644 --- a/intern/guardedalloc/intern/mallocn.c +++ b/intern/guardedalloc/intern/mallocn.c @@ -167,12 +167,13 @@ static int malloc_debug_memset= 0; static void print_error(const char *str, ...) { - char buf[1024]; + char buf[512]; va_list ap; va_start(ap, str); - vsprintf(buf, str, ap); + vsnprintf(buf, sizeof(buf), str, ap); va_end(ap); + buf[sizeof(buf) - 1] = '\0'; if (error_callback) error_callback(buf); } diff --git a/intern/smoke/intern/FLUID_3D.cpp b/intern/smoke/intern/FLUID_3D.cpp index 05fbb918d24..27218d2682c 100644 --- a/intern/smoke/intern/FLUID_3D.cpp +++ b/intern/smoke/intern/FLUID_3D.cpp @@ -605,7 +605,7 @@ void FLUID_3D::copyBorderAll(float* field, int zBegin, int zEnd) int zSize = zEnd-zBegin; int _blockTotalCells=_slabSize * zSize; - if ((zBegin==0)) + if (zBegin==0) for (int y = 0; y < _yRes; y++) for (int x = 0; x < _xRes; x++) { @@ -723,7 +723,7 @@ void FLUID_3D::wipeBoundariesSL(int zBegin, int zEnd) const int totalCells = _xRes * _yRes * _zRes; index = 0; - if ((zBegin == 0)) + if (zBegin == 0) for (y = 0; y < _yRes; y++) for (x = 0; x < _xRes; x++, index++) { diff --git a/release/bin/blender-thumbnailer.py b/release/bin/blender-thumbnailer.py index abd85cd3bec..8b93eebdeec 100755 --- a/release/bin/blender-thumbnailer.py +++ b/release/bin/blender-thumbnailer.py @@ -24,27 +24,49 @@ Thumbnailer runs with python 2.6 and 3.x. To run automatically with nautilus: gconftool --type boolean --set /desktop/gnome/thumbnailers/application@x-blender/enable true - gconftool --type string --set /desktop/gnome/thumbnailers/application@x-blender/command "blender-thumbnailer.py %i %o" + gconftool --type string --set /desktop/gnome/thumbnailers/application@x-blender/command "blender-thumbnailer.py %u %o" """ import struct +def open_wrapper_get(): + """ wrap OS spesific read functionality here, fallback to 'open()' + """ + + def open_gio(path, mode): + g_file = gio.File(path).read() + g_file.orig_seek = g_file.seek + + def new_seek(offset, whence=0): + return g_file.orig_seek(offset, [1, 0, 2][whence]) + + g_file.seek = new_seek + return g_file + + try: + import gio + return open_gio + except ImportError: + return open + + def blend_extract_thumb(path): import os + open_wrapper = open_wrapper_get() # def MAKE_ID(tag): ord(tag[0])<<24 | ord(tag[1])<<16 | ord(tag[2])<<8 | ord(tag[3]) REND = 1145980242 # MAKE_ID(b'REND') TEST = 1414743380 # MAKE_ID(b'TEST') - blendfile = open(path, 'rb') + blendfile = open_wrapper(path, 'rb') head = blendfile.read(12) if head[0:2] == b'\x1f\x8b': # gzip magic import gzip blendfile.close() - blendfile = gzip.open(path, 'rb') + blendfile = gzip.GzipFile('', 'rb', 0, open_wrapper(path, 'rb')) head = blendfile.read(12) if not head.startswith(b'BLENDER'): diff --git a/release/scripts/io/netrender/client.py b/release/scripts/io/netrender/client.py index 583a825f909..bc43b8cfbb7 100644 --- a/release/scripts/io/netrender/client.py +++ b/release/scripts/io/netrender/client.py @@ -261,7 +261,7 @@ def requestResult(conn, job_id, frame): class NetworkRenderEngine(bpy.types.RenderEngine): bl_idname = 'NET_RENDER' bl_label = "Network Render" - bl_postprocess = False + bl_use_postprocess = False def render(self, scene): if scene.network_render.mode == "RENDER_CLIENT": self.render_client(scene) diff --git a/release/scripts/io/netrender/ui.py b/release/scripts/io/netrender/ui.py index 0581e054dff..343c60e7865 100644 --- a/release/scripts/io/netrender/ui.py +++ b/release/scripts/io/netrender/ui.py @@ -363,16 +363,21 @@ class RENDER_PT_network_output(NeedValidAddress, NetRenderButtonsPanel, bpy.type draw = properties_render.RENDER_PT_output.draw -class NetRenderSettings(bpy.types.IDPropertyGroup): - pass -class NetRenderSlave(bpy.types.IDPropertyGroup): - pass +def addProperties(): + class NetRenderSettings(bpy.types.IDPropertyGroup): + pass -class NetRenderJob(bpy.types.IDPropertyGroup): - pass + class NetRenderSlave(bpy.types.IDPropertyGroup): + pass + + class NetRenderJob(bpy.types.IDPropertyGroup): + pass + + bpy.utils.register_class(NetRenderSettings) + bpy.utils.register_class(NetRenderSlave) + bpy.utils.register_class(NetRenderJob) -def addProperties(): from bpy.props import PointerProperty, StringProperty, BoolProperty, EnumProperty, IntProperty, CollectionProperty bpy.types.Scene.network_render = PointerProperty(type=NetRenderSettings, name="Network Render", description="Network Render Settings") diff --git a/release/scripts/keyingsets/keyingsets_builtins.py b/release/scripts/keyingsets/keyingsets_builtins.py index 2a6bd682bf7..cff4aecac54 100644 --- a/release/scripts/keyingsets/keyingsets_builtins.py +++ b/release/scripts/keyingsets/keyingsets_builtins.py @@ -352,38 +352,14 @@ class BUILTIN_KSI_WholeCharacter(bpy.types.KeyingSetInfo): # for now, just add all of 'em ksi.addProp(ks, bone, '["%s"]' % (prop)) -############################### - -classes = [ - BUILTIN_KSI_Location, - BUILTIN_KSI_Rotation, - BUILTIN_KSI_Scaling, - - BUILTIN_KSI_LocRot, - BUILTIN_KSI_LocScale, - BUILTIN_KSI_LocRotScale, - BUILTIN_KSI_RotScale, - - BUILTIN_KSI_WholeCharacter, - - BUILTIN_KSI_VisualLoc, - BUILTIN_KSI_VisualRot, - BUILTIN_KSI_VisualLocRot, - - BUILTIN_KSI_Available, -] - def register(): - register = bpy.types.register - for cls in classes: - register(cls) + bpy.utils.register_module(__name__) def unregister(): - unregister = bpy.types.unregister - for cls in classes: - unregister(cls) + bpy.utils.unregister_module(__name__) + if __name__ == "__main__": register() diff --git a/release/scripts/modules/bpy/utils.py b/release/scripts/modules/bpy/utils.py index f83b5ab01e0..e3e93203235 100644 --- a/release/scripts/modules/bpy/utils.py +++ b/release/scripts/modules/bpy/utils.py @@ -23,6 +23,9 @@ This module contains utility functions specific to blender but not assosiated with blenders internal data. """ +from _bpy import register_class +from _bpy import unregister_class + from _bpy import blend_paths from _bpy import script_paths as _bpy_script_paths from _bpy import user_resource as _user_resource @@ -100,9 +103,6 @@ def load_scripts(reload_scripts=False, refresh_scripts=False): import traceback import time - # must be set back to True on exits - _bpy_types._register_immediate = False - t_main = time.time() loaded_modules = set() @@ -112,7 +112,6 @@ def load_scripts(reload_scripts=False, refresh_scripts=False): if reload_scripts: _bpy_types.TypeMap.clear() - _bpy_types.PropertiesMap.clear() # just unload, dont change user defaults, this means we can sync to reload. # note that they will only actually reload of the modification time changes. @@ -121,7 +120,6 @@ def load_scripts(reload_scripts=False, refresh_scripts=False): addon_disable(module_name, default_set=False) def register_module_call(mod): - _bpy_types._register_module(mod.__name__) register = getattr(mod, "register", None) if register: try: @@ -132,7 +130,6 @@ def load_scripts(reload_scripts=False, refresh_scripts=False): print("\nWarning! '%s' has no register function, this is now a requirement for registerable scripts." % mod.__file__) def unregister_module_call(mod): - _bpy_types._unregister_module(mod.__name__) unregister = getattr(mod, "unregister", None) if unregister: try: @@ -199,8 +196,6 @@ def load_scripts(reload_scripts=False, refresh_scripts=False): for mod in modules_from_path(path, loaded_modules): test_register(mod) - _bpy_types._register_immediate = True - # deal with addons seperately addon_reset_all(reload_scripts) @@ -367,12 +362,9 @@ def addon_enable(module_name, default_set=True): import bpy_types as _bpy_types import imp - _bpy_types._register_immediate = False - def handle_error(): import traceback traceback.print_exc() - _bpy_types._register_immediate = True # reload if the mtime changes mod = sys.modules.get(module_name) @@ -402,19 +394,13 @@ def addon_enable(module_name, default_set=True): return None # 2) try register collected modules - try: - _bpy_types._register_module(module_name) - except: - handle_error() - del sys.modules[module_name] - return None + # removed, addons need to handle own registration now. # 3) try run the modules register function try: mod.register() except: handle_error() - _bpy_types._unregister_module(module_name) del sys.modules[module_name] return None @@ -426,8 +412,6 @@ def addon_enable(module_name, default_set=True): ext = _bpy.context.user_preferences.addons.new() ext.module = module_name - _bpy_types._register_immediate = True - mod.__addon_enabled__ = True if _bpy.app.debug: @@ -454,7 +438,6 @@ def addon_disable(module_name, default_set=True): mod.__addon_enabled__ = False try: - _bpy_types._unregister_module(module_name, free=False) # dont free because we may want to enable again. mod.unregister() except: traceback.print_exc() @@ -594,3 +577,54 @@ def user_resource(type, path="", create=False): target_path = "" return target_path + + +def _bpy_module_classes(module, is_registered=False): + typemap_list = _bpy_types.TypeMap.get(module, ()) + i = 0 + while i < len(typemap_list): + cls_weakref, path, line = typemap_list[i] + cls = cls_weakref() + + if cls is None: + del typemap_list[i] + else: + if is_registered == ("bl_rna" in cls.__dict__): + yield (cls, path, line) + i += 1 + + +def register_module(module, verbose=False): + import traceback + if verbose: + print("bpy.utils.register_module(%r): ..." % module) + for cls, path, line in _bpy_module_classes(module, is_registered=False): + if verbose: + print(" %s of %s:%s" % (cls, path, line)) + try: + register_class(cls) + except: + print("bpy.utils.register_module(): failed to registering class '%s.%s'" % (cls.__module__, cls.__name__)) + print("\t", path, "line", line) + traceback.print_exc() + if verbose: + print("done.\n") + if "cls" not in locals(): + raise Exception("register_module(%r): defines no classes" % module) + + +def unregister_module(module, verbose=False): + import traceback + if verbose: + print("bpy.utils.unregister_module(%r): ..." % module) + for cls, path, line in _bpy_module_classes(module, is_registered=True): + if verbose: + print(" %s of %s:%s" % (cls, path, line)) + try: + unregister_class(cls) + except: + print("bpy.utils.unregister_module(): failed to unregistering class '%s.%s'" % (cls.__module__, cls.__name__)) + print("\t", path, "line", line) + traceback.print_exc() + if verbose: + print("done.\n")
\ No newline at end of file diff --git a/release/scripts/modules/bpy_types.py b/release/scripts/modules/bpy_types.py index 1cb30765bf0..4eb712a65cc 100644 --- a/release/scripts/modules/bpy_types.py +++ b/release/scripts/modules/bpy_types.py @@ -550,85 +550,34 @@ class Text(bpy_types.ID): import bpy return tuple(obj for obj in bpy.data.objects if self in [cont.text for cont in obj.game.controllers if cont.type == 'PYTHON']) -import collections - +# values are module: [(cls, path, line), ...] TypeMap = {} -# Properties (IDPropertyGroup) are different from types because they need to be registered -# before adding sub properties to them, so they are registered on definition -# and unregistered on unload -PropertiesMap = {} - -# Using our own loading function we set this to false -# so when running a script directly in the text editor -# registers moduals instantly. -_register_immediate = True - - -def _unregister_module(module, free=True): - for t in TypeMap.get(module, ()): - try: - bpy_types.unregister(t) - except: - import traceback - print("bpy.utils._unregister_module(): Module '%s' failed to unregister class '%s.%s'" % (module, t.__module__, t.__name__)) - traceback.print_exc() - - if free == True and module in TypeMap: - del TypeMap[module] - - for t in PropertiesMap.get(module, ()): - try: - bpy_types.unregister(t) - except: - import traceback - print("bpy.utils._unload_module(): Module '%s' failed to unregister class '%s.%s'" % (module, t.__module__, t.__name__)) - traceback.print_exc() - - if free == True and module in PropertiesMap: - del PropertiesMap[module] - - -def _register_module(module): - for t in TypeMap.get(module, ()): - try: - bpy_types.register(t) - except: - import traceback - import sys - print("bpy.utils._register_module(): '%s' failed to register class '%s.%s'" % (sys.modules[module].__file__, t.__module__, t.__name__)) - traceback.print_exc() class RNAMeta(type): - @classmethod - def _register_immediate(cls): - return _register_immediate - def __new__(cls, name, bases, classdict, **args): result = type.__new__(cls, name, bases, classdict) if bases and bases[0] != StructRNA: + import traceback + import weakref module = result.__module__ - ClassMap = TypeMap - - # Register right away if needed - if cls._register_immediate(): - bpy_types.register(result) - ClassMap = PropertiesMap - # first part of packages only if "." in module: module = module[:module.index(".")] - ClassMap.setdefault(module, []).append(result) + sf = traceback.extract_stack(limit=2)[0] + + TypeMap.setdefault(module, []).append((weakref.ref(result), sf[0], sf[1])) return result -class RNAMetaRegister(RNAMeta, StructMetaIDProp): - @classmethod - def _register_immediate(cls): - return True +import collections + + +class RNAMetaIDProp(RNAMeta, StructMetaIDProp): + pass class OrderedMeta(RNAMeta): @@ -685,7 +634,7 @@ class Macro(StructRNA, metaclass=OrderedMeta): return ops.macro_define(self, opname) -class IDPropertyGroup(StructRNA, metaclass=RNAMetaRegister): +class IDPropertyGroup(StructRNA, metaclass=RNAMetaIDProp): __slots__ = () @@ -693,6 +642,10 @@ class RenderEngine(StructRNA, metaclass=RNAMeta): __slots__ = () +class KeyingSetInfo(StructRNA, metaclass=RNAMeta): + __slots__ = () + + class _GenericUI: __slots__ = () @@ -704,7 +657,12 @@ class _GenericUI: def draw_ls(self, context): for func in draw_ls._draw_funcs: - func(self, context) + # so bad menu functions dont stop the entire menu from drawing. + try: + func(self, context) + except: + import traceback + traceback.print_exc() draw_funcs = draw_ls._draw_funcs = [cls.draw] cls.draw = draw_ls diff --git a/release/scripts/modules/console/__init__.py b/release/scripts/modules/console/__init__.py index efd2ed85acc..97cb14822c4 100644 --- a/release/scripts/modules/console/__init__.py +++ b/release/scripts/modules/console/__init__.py @@ -1,17 +1,22 @@ # Copyright (c) 2009 www.stani.be (GPL license) -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. +# ##### BEGIN GPL LICENSE BLOCK ##### # -# 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 Lesser General Public License for more details. +# 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. # -# You should have received a copy of the GNU Lesser General Public License -# along with this program. If not, see <http://www.gnu.org/licenses/>. +# 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. +# +# ##### END GPL LICENSE BLOCK ##### # <pep8 compliant> diff --git a/release/scripts/modules/console/complete_calltip.py b/release/scripts/modules/console/complete_calltip.py index 322b48d4f65..29187297707 100644 --- a/release/scripts/modules/console/complete_calltip.py +++ b/release/scripts/modules/console/complete_calltip.py @@ -1,17 +1,22 @@ # Copyright (c) 2009 www.stani.be (GPL license) -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. +# ##### BEGIN GPL LICENSE BLOCK ##### # -# 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 Lesser General Public License for more details. +# 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. # -# You should have received a copy of the GNU Lesser General Public License -# along with this program. If not, see <http://www.gnu.org/licenses/>. +# 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. +# +# ##### END GPL LICENSE BLOCK ##### # <pep8-80 compliant> diff --git a/release/scripts/modules/console/complete_import.py b/release/scripts/modules/console/complete_import.py index 4b50cf6deb8..63f15d9cf77 100644 --- a/release/scripts/modules/console/complete_import.py +++ b/release/scripts/modules/console/complete_import.py @@ -1,17 +1,22 @@ # Copyright (c) 2009 Fernando Perez, www.stani.be (GPL license) -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. +# ##### BEGIN GPL LICENSE BLOCK ##### # -# 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 Lesser General Public License for more details. +# 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. # -# You should have received a copy of the GNU Lesser General Public License -# along with this program. If not, see <http://www.gnu.org/licenses/>. +# 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. +# +# ##### END GPL LICENSE BLOCK ##### # Original copyright (see docstring): #***************************************************************************** diff --git a/release/scripts/modules/console/complete_namespace.py b/release/scripts/modules/console/complete_namespace.py index 7a9fd331e49..a31280ebff0 100644 --- a/release/scripts/modules/console/complete_namespace.py +++ b/release/scripts/modules/console/complete_namespace.py @@ -1,17 +1,22 @@ # Copyright (c) 2009 www.stani.be (GPL license) -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. +# ##### BEGIN GPL LICENSE BLOCK ##### # -# 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 Lesser General Public License for more details. +# 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. # -# You should have received a copy of the GNU Lesser General Public License -# along with this program. If not, see <http://www.gnu.org/licenses/>. +# 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. +# +# ##### END GPL LICENSE BLOCK ##### # <pep8-80 compliant> diff --git a/release/scripts/modules/console/intellisense.py b/release/scripts/modules/console/intellisense.py index d76c5d0ad60..9352d7c14e1 100644 --- a/release/scripts/modules/console/intellisense.py +++ b/release/scripts/modules/console/intellisense.py @@ -1,17 +1,22 @@ # Copyright (c) 2009 www.stani.be (GPL license) -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. +# ##### BEGIN GPL LICENSE BLOCK ##### # -# 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 Lesser General Public License for more details. +# 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. # -# You should have received a copy of the GNU Lesser General Public License -# along with this program. If not, see <http://www.gnu.org/licenses/>. +# 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. +# +# ##### END GPL LICENSE BLOCK ##### # <pep8-80 compliant> diff --git a/release/scripts/keyingsets/keyingsets_utils.py b/release/scripts/modules/keyingsets_utils.py index 630ac12dc7b..00ad45cf9bb 100644 --- a/release/scripts/keyingsets/keyingsets_utils.py +++ b/release/scripts/modules/keyingsets_utils.py @@ -1,9 +1,39 @@ +# ##### 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. +# +# ##### END GPL LICENSE BLOCK ##### + +# <pep8 compliant> + # This file defines a set of methods that are useful for various # Relative Keying Set (RKS) related operations, such as: callbacks # for polling, iterator callbacks, and also generate callbacks. # All of these can be used in conjunction with the others. -# <pep8 compliant> +__all__ = [ + "path_add_property", + "RKS_POLL_selected_objects", + "RKS_POLL_selected_bones", + "RKS_POLL_selected_items", + "RKS_ITER_selected_item", + "RKS_GEN_available", + "RKS_GEN_location", + "RKS_GEN_rotation", + "RKS_GEN_scaling", +] import bpy @@ -91,6 +121,7 @@ def RKS_GEN_available(ksi, context, ks, data): # get ID block and based ID path for transform generators +# private function def get_transform_generators_base_info(data): # ID-block for the data id_block = data.id_data @@ -163,21 +194,3 @@ def RKS_GEN_scaling(ksi, context, ks, data): ks.paths.add(id_block, path, group_method='NAMED', group_name=grouping) else: ks.paths.add(id_block, path) - -########################### -# Un-needed stuff which is here to just shut up the warnings... - -classes = [] - - -def register(): - pass - - -def unregister(): - pass - -if __name__ == "__main__": - register() - -########################### diff --git a/release/scripts/op/add_mesh_torus.py b/release/scripts/op/add_mesh_torus.py index 53460ff264d..db4f90f05d1 100644 --- a/release/scripts/op/add_mesh_torus.py +++ b/release/scripts/op/add_mesh_torus.py @@ -142,10 +142,12 @@ def menu_func(self, context): def register(): + bpy.utils.register_class(AddTorus) bpy.types.INFO_MT_mesh_add.append(menu_func) def unregister(): + bpy.utils.unregister_class(AddTorus) bpy.types.INFO_MT_mesh_add.remove(menu_func) if __name__ == "__main__": diff --git a/release/scripts/op/animsys_update.py b/release/scripts/op/animsys_update.py index e5eab045e94..9262ff40a37 100644 --- a/release/scripts/op/animsys_update.py +++ b/release/scripts/op/animsys_update.py @@ -701,4 +701,8 @@ if __name__ == "__main__": def register(): - pass + bpy.utils.register_module(__name__) + + +def unregister(): + bpy.utils.unregister_module(__name__) diff --git a/release/scripts/op/fcurve_euler_filter.py b/release/scripts/op/fcurve_euler_filter.py index 0e7f0b69eca..6332bbe309c 100644 --- a/release/scripts/op/fcurve_euler_filter.py +++ b/release/scripts/op/fcurve_euler_filter.py @@ -78,13 +78,12 @@ class DiscontFilterOp(bpy.types.Operator): main(context) return {'FINISHED'} - def register(): - pass + bpy.utils.register_module(__name__) def unregister(): - pass + bpy.utils.unregister_module(__name__) if __name__ == "__main__": register() diff --git a/release/scripts/op/image.py b/release/scripts/op/image.py index ddd04c4e7c3..e1d471f8254 100644 --- a/release/scripts/op/image.py +++ b/release/scripts/op/image.py @@ -195,11 +195,11 @@ class ProjectApply(bpy.types.Operator): def register(): - pass + bpy.utils.register_module(__name__) def unregister(): - pass + bpy.utils.unregister_module(__name__) if __name__ == "__main__": register() diff --git a/release/scripts/op/mesh.py b/release/scripts/op/mesh.py index 447de04f423..4906fd7fc6c 100644 --- a/release/scripts/op/mesh.py +++ b/release/scripts/op/mesh.py @@ -173,11 +173,11 @@ class MeshMirrorUV(bpy.types.Operator): def register(): - pass + bpy.utils.register_module(__name__) def unregister(): - pass + bpy.utils.unregister_module(__name__) if __name__ == "__main__": register() diff --git a/release/scripts/op/nla.py b/release/scripts/op/nla.py index d47668d68e3..5711fdf12e5 100644 --- a/release/scripts/op/nla.py +++ b/release/scripts/op/nla.py @@ -175,13 +175,11 @@ class BakeAction(bpy.types.Operator): def register(): - pass - # bpy.types.INFO_MT_mesh_add.append(menu_func) + bpy.utils.register_module(__name__) def unregister(): - pass - # bpy.types.INFO_MT_mesh_add.remove(menu_func) + bpy.utils.unregister_module(__name__) if __name__ == "__main__": register() diff --git a/release/scripts/op/object.py b/release/scripts/op/object.py index 8fee6e2166d..92886689972 100644 --- a/release/scripts/op/object.py +++ b/release/scripts/op/object.py @@ -565,11 +565,11 @@ class ClearAllRestrictRender(bpy.types.Operator): def register(): - pass + bpy.utils.register_module(__name__) def unregister(): - pass + bpy.utils.unregister_module(__name__) if __name__ == "__main__": register() diff --git a/release/scripts/op/object_align.py b/release/scripts/op/object_align.py index 8654fb4db3d..d98fe584c1a 100644 --- a/release/scripts/op/object_align.py +++ b/release/scripts/op/object_align.py @@ -287,11 +287,14 @@ def menu_func(self, context): def register(): + bpy.utils.register_module(__name__) bpy.types.VIEW3D_MT_transform.append(menu_func) def unregister(): + bpy.utils.unregister_module(__name__) bpy.types.VIEW3D_MT_transform.remove(menu_func) + if __name__ == "__main__": register() diff --git a/release/scripts/op/object_randomize_transform.py b/release/scripts/op/object_randomize_transform.py index 8b8070f34bc..ee7a5f98b91 100644 --- a/release/scripts/op/object_randomize_transform.py +++ b/release/scripts/op/object_randomize_transform.py @@ -154,11 +154,14 @@ def menu_func(self, context): def register(): + bpy.utils.register_module(__name__) bpy.types.VIEW3D_MT_transform.append(menu_func) def unregister(): + bpy.utils.unregister_module(__name__) bpy.types.VIEW3D_MT_transform.remove(menu_func) + if __name__ == "__main__": register() diff --git a/release/scripts/op/presets.py b/release/scripts/op/presets.py index 36170fb6283..65653aeee3e 100644 --- a/release/scripts/op/presets.py +++ b/release/scripts/op/presets.py @@ -354,11 +354,11 @@ class WM_MT_operator_presets(bpy.types.Menu): def register(): - pass + bpy.utils.register_module(__name__) def unregister(): - pass + bpy.utils.unregister_module(__name__) if __name__ == "__main__": register() diff --git a/release/scripts/op/screen_play_rendered_anim.py b/release/scripts/op/screen_play_rendered_anim.py index 244c3d4b332..579af9b34b3 100644 --- a/release/scripts/op/screen_play_rendered_anim.py +++ b/release/scripts/op/screen_play_rendered_anim.py @@ -147,11 +147,11 @@ class PlayRenderedAnim(bpy.types.Operator): def register(): - pass + bpy.utils.register_module(__name__) def unregister(): - pass + bpy.utils.unregister_module(__name__) if __name__ == "__main__": register() diff --git a/release/scripts/op/sequencer.py b/release/scripts/op/sequencer.py index e34489b335d..de341bef269 100644 --- a/release/scripts/op/sequencer.py +++ b/release/scripts/op/sequencer.py @@ -135,11 +135,11 @@ class SequencerDeinterlaceSelectedMovies(bpy.types.Operator): def register(): - pass + bpy.utils.register_module(__name__) def unregister(): - pass + bpy.utils.unregister_module(__name__) if __name__ == "__main__": diff --git a/release/scripts/op/uv.py b/release/scripts/op/uv.py index 1b6c036b2d2..83282924b5b 100644 --- a/release/scripts/op/uv.py +++ b/release/scripts/op/uv.py @@ -369,10 +369,12 @@ def menu_func(self, context): def register(): + bpy.utils.register_module(__name__) bpy.types.IMAGE_MT_uvs.append(menu_func) def unregister(): + bpy.utils.unregister_module(__name__) bpy.types.IMAGE_MT_uvs.remove(menu_func) if __name__ == "__main__": diff --git a/release/scripts/op/uvcalc_follow_active.py b/release/scripts/op/uvcalc_follow_active.py index 10b40aa4538..12895fae1c5 100644 --- a/release/scripts/op/uvcalc_follow_active.py +++ b/release/scripts/op/uvcalc_follow_active.py @@ -216,7 +216,7 @@ def extend(obj, operator, EXTEND_MODE): if is_editmode: bpy.ops.object.mode_set(mode='EDIT') else: - me.update() + me.update_tag() def main(context, operator): @@ -251,11 +251,14 @@ menu_func = (lambda self, context: self.layout.operator(FollowActiveQuads.bl_idn def register(): + bpy.utils.register_module(__name__) bpy.types.VIEW3D_MT_uv_map.append(menu_func) def unregister(): + bpy.utils.unregister_module(__name__) bpy.types.VIEW3D_MT_uv_map.remove(menu_func) + if __name__ == "__main__": register() diff --git a/release/scripts/op/uvcalc_smart_project.py b/release/scripts/op/uvcalc_smart_project.py index aaa8583b70f..8cdf593f98d 100644 --- a/release/scripts/op/uvcalc_smart_project.py +++ b/release/scripts/op/uvcalc_smart_project.py @@ -1130,10 +1130,12 @@ menu_func = (lambda self, context: self.layout.operator(SmartProject.bl_idname, def register(): + bpy.utils.register_module(__name__) bpy.types.VIEW3D_MT_uv_map.append(menu_func) def unregister(): + bpy.utils.unregister_module(__name__) bpy.types.VIEW3D_MT_uv_map.remove(menu_func) if __name__ == "__main__": diff --git a/release/scripts/op/vertexpaint_dirt.py b/release/scripts/op/vertexpaint_dirt.py index c5bb4450497..d5060e913ae 100644 --- a/release/scripts/op/vertexpaint_dirt.py +++ b/release/scripts/op/vertexpaint_dirt.py @@ -65,7 +65,7 @@ def applyVertexDirt(me, blur_iterations, blur_strength, clamp_dirt, clamp_clean, # get the direction of the vectors between the vertex and it's connected vertices for c in con[i]: - vec += (me.vertices[c].co - co).normalize() + vec += (me.vertices[c].co - co).normalized() # normalize the vector by dividing by the number of connected verts tot_con = len(con[i]) @@ -180,11 +180,11 @@ class VertexPaintDirt(bpy.types.Operator): def register(): - pass + bpy.utils.register_module(__name__) def unregister(): - pass + bpy.utils.unregister_module(__name__) if __name__ == "__main__": register() diff --git a/release/scripts/op/wm.py b/release/scripts/op/wm.py index 38fead4ecf8..cbc9e3cd55f 100644 --- a/release/scripts/op/wm.py +++ b/release/scripts/op/wm.py @@ -816,11 +816,11 @@ class WM_OT_sysinfo(bpy.types.Operator): def register(): - pass + bpy.utils.register_module(__name__) def unregister(): - pass + bpy.utils.unregister_module(__name__) if __name__ == "__main__": register() diff --git a/release/scripts/templates/addon_add_object.py b/release/scripts/templates/addon_add_object.py index 00db3a55291..f4f1185e282 100644 --- a/release/scripts/templates/addon_add_object.py +++ b/release/scripts/templates/addon_add_object.py @@ -65,10 +65,12 @@ def add_object_button(self, context): def register(): + bpy.utils.register_class(OBJECT_OT_add_object) bpy.types.INFO_MT_mesh_add.append(add_object_button) def unregister(): + bpy.utils.unregister_class(OBJECT_OT_add_object) bpy.types.INFO_MT_mesh_add.remove(add_object_button) diff --git a/release/scripts/templates/builtin_keyingset.py b/release/scripts/templates/builtin_keyingset.py index 799f305d8b4..0b808e9cd26 100644 --- a/release/scripts/templates/builtin_keyingset.py +++ b/release/scripts/templates/builtin_keyingset.py @@ -25,5 +25,14 @@ class BUILTIN_KSI_hello(bpy.types.KeyingSetInfo): ks.paths.add(id_block, "show_x_ray", group_method='NONE') -# manually register -bpy.types.register(BUILTIN_KSI_hello) + +def register(): + bpy.utils.register_class(BUILTIN_KSI_hello) + + +def unregister(): + bpy.utils.unregister_class(BUILTIN_KSI_hello) + + +if __name__ == '__main__': + register() diff --git a/release/scripts/templates/operator_export.py b/release/scripts/templates/operator_export.py index 4f950b11d01..5390d32aeff 100644 --- a/release/scripts/templates/operator_export.py +++ b/release/scripts/templates/operator_export.py @@ -48,7 +48,19 @@ class ExportSomeData(bpy.types.Operator, ExportHelper): def menu_func_export(self, context): self.layout.operator(ExportSomeData.bl_idname, text="Text Export Operator") -bpy.types.INFO_MT_file_export.append(menu_func_export) + +def register(): + bpy.utils.register_class(ExportSomeData) + bpy.types.INFO_MT_file_export.append(menu_func_export) + + +def unregister(): + bpy.utils.unregister_class(ExportSomeData) + bpy.types.INFO_MT_file_export.remove(menu_func_export) + if __name__ == "__main__": + register() + + # test call bpy.ops.export.some_data('INVOKE_DEFAULT') diff --git a/release/scripts/templates/operator_mesh_add.py b/release/scripts/templates/operator_mesh_add.py index db614f3a74c..77d172b3068 100644 --- a/release/scripts/templates/operator_mesh_add.py +++ b/release/scripts/templates/operator_mesh_add.py @@ -91,11 +91,16 @@ def menu_func(self, context): def register(): + bpy.utils.register_class(AddBox) bpy.types.INFO_MT_mesh_add.append(menu_func) def unregister(): + bpy.utils.unregister_class(AddBox) bpy.types.INFO_MT_mesh_add.remove(menu_func) if __name__ == "__main__": + register() + + # test call bpy.ops.mesh.primitive_box_add() diff --git a/release/scripts/templates/operator_modal.py b/release/scripts/templates/operator_modal.py index 026b5fd2d16..6eb3843d6a6 100644 --- a/release/scripts/templates/operator_modal.py +++ b/release/scripts/templates/operator_modal.py @@ -35,5 +35,16 @@ class ModalOperator(bpy.types.Operator): return {'CANCELLED'} +def register(): + bpy.utils.register_class(ModalOperator) + + +def unregister(): + bpy.utils.unregister_class(ModalOperator) + + if __name__ == "__main__": + register() + + # test call bpy.ops.object.modal_operator() diff --git a/release/scripts/templates/operator_modal_draw.py b/release/scripts/templates/operator_modal_draw.py index 52259e4b8e7..e7a1f6e4ffe 100644 --- a/release/scripts/templates/operator_modal_draw.py +++ b/release/scripts/templates/operator_modal_draw.py @@ -65,3 +65,14 @@ class ModalDrawOperator(bpy.types.Operator): else: self.report({'WARNING'}, "View3D not found, cannot run operator") return {'CANCELLED'} + + +def register(): + bpy.utils.register_class(ModalDrawOperator) + + +def unregister(): + bpy.utils.unregister_class(ModalDrawOperator) + +if __name__ == "__main__": + register() diff --git a/release/scripts/templates/operator_modal_view3d.py b/release/scripts/templates/operator_modal_view3d.py index eacd335c1da..c494f121017 100644 --- a/release/scripts/templates/operator_modal_view3d.py +++ b/release/scripts/templates/operator_modal_view3d.py @@ -54,3 +54,15 @@ class ViewOperator(bpy.types.Operator): else: self.report({'WARNING'}, "Active space must be a View3d") return {'CANCELLED'} + + +def register(): + bpy.utils.register_class(ViewOperator) + + +def unregister(): + bpy.utils.unregister_class(ViewOperator) + + +if __name__ == "__main__": + register() diff --git a/release/scripts/templates/operator_simple.py b/release/scripts/templates/operator_simple.py index 6a887a70bdc..8348c7a95b1 100644 --- a/release/scripts/templates/operator_simple.py +++ b/release/scripts/templates/operator_simple.py @@ -20,5 +20,16 @@ class SimpleOperator(bpy.types.Operator): return {'FINISHED'} +def register(): + bpy.utils.register_class(SimpleOperator) + + +def unregister(): + bpy.utils.unregister_class(SimpleOperator) + + if __name__ == "__main__": + register() + + # test call bpy.ops.object.simple_operator() diff --git a/release/scripts/templates/operator_uv.py b/release/scripts/templates/operator_uv.py index 73392466aa7..93fec117fa1 100644 --- a/release/scripts/templates/operator_uv.py +++ b/release/scripts/templates/operator_uv.py @@ -41,5 +41,16 @@ class UvOperator(bpy.types.Operator): return {'FINISHED'} +def register(): + bpy.utils.register_class(UvOperator) + + +def unregister(): + bpy.utils.unregister_class(UvOperator) + + if __name__ == "__main__": + register() + + # test call bpy.ops.uv.simple_operator() diff --git a/release/scripts/templates/panel_simple.py b/release/scripts/templates/panel_simple.py index 160bd1ef0bf..ddbd4eb7aa4 100644 --- a/release/scripts/templates/panel_simple.py +++ b/release/scripts/templates/panel_simple.py @@ -19,3 +19,15 @@ class OBJECT_PT_hello(bpy.types.Panel): row.label(text="Active object is: " + obj.name) row = layout.row() row.prop(obj, "name") + + +def register(): + bpy.utils.register_class(OBJECT_PT_hello) + + +def unregister(): + bpy.utils.unregister_class(OBJECT_PT_hello) + + +if __name__ == "__main__": + register() diff --git a/release/scripts/ui/properties_animviz.py b/release/scripts/ui/properties_animviz.py index 87925a9d6f4..5f5684f5c89 100644 --- a/release/scripts/ui/properties_animviz.py +++ b/release/scripts/ui/properties_animviz.py @@ -94,12 +94,13 @@ class OnionSkinButtonsPanel(): # NOTE: # The specialised panel types are derived in their respective UI modules +# dont register these classes since they are only helpers. def register(): - pass + pass # bpy.utils.register_module(__name__) def unregister(): - pass + pass # bpy.utils.unregister_module(__name__) if __name__ == "__main__": register() diff --git a/release/scripts/ui/properties_data_armature.py b/release/scripts/ui/properties_data_armature.py index c3d3c358dbe..6550e1bb1ed 100644 --- a/release/scripts/ui/properties_data_armature.py +++ b/release/scripts/ui/properties_data_armature.py @@ -289,11 +289,11 @@ class DATA_PT_custom_props_arm(ArmatureButtonsPanel, PropertyPanel, bpy.types.Pa def register(): - pass + bpy.utils.register_module(__name__) def unregister(): - pass + bpy.utils.unregister_module(__name__) if __name__ == "__main__": register() diff --git a/release/scripts/ui/properties_data_bone.py b/release/scripts/ui/properties_data_bone.py index 336fc5430c6..feca4fc2502 100644 --- a/release/scripts/ui/properties_data_bone.py +++ b/release/scripts/ui/properties_data_bone.py @@ -370,11 +370,11 @@ class BONE_PT_custom_props(BoneButtonsPanel, PropertyPanel, bpy.types.Panel): def register(): - pass + bpy.utils.register_module(__name__) def unregister(): - pass + bpy.utils.unregister_module(__name__) if __name__ == "__main__": register() diff --git a/release/scripts/ui/properties_data_camera.py b/release/scripts/ui/properties_data_camera.py index 9c4f19b4c51..0f5d4a59bf5 100644 --- a/release/scripts/ui/properties_data_camera.py +++ b/release/scripts/ui/properties_data_camera.py @@ -139,11 +139,11 @@ class DATA_PT_custom_props_camera(CameraButtonsPanel, PropertyPanel, bpy.types.P def register(): - pass + bpy.utils.register_module(__name__) def unregister(): - pass + bpy.utils.unregister_module(__name__) if __name__ == "__main__": register() diff --git a/release/scripts/ui/properties_data_curve.py b/release/scripts/ui/properties_data_curve.py index 85a32236bcc..b26b7140fd2 100644 --- a/release/scripts/ui/properties_data_curve.py +++ b/release/scripts/ui/properties_data_curve.py @@ -396,11 +396,11 @@ class DATA_PT_custom_props_curve(CurveButtonsPanel, PropertyPanel, bpy.types.Pan def register(): - pass + bpy.utils.register_module(__name__) def unregister(): - pass + bpy.utils.unregister_module(__name__) if __name__ == "__main__": register() diff --git a/release/scripts/ui/properties_data_empty.py b/release/scripts/ui/properties_data_empty.py index 9a297eba4af..bb0028efec5 100644 --- a/release/scripts/ui/properties_data_empty.py +++ b/release/scripts/ui/properties_data_empty.py @@ -44,11 +44,11 @@ class DATA_PT_empty(DataButtonsPanel, bpy.types.Panel): def register(): - pass + bpy.utils.register_module(__name__) def unregister(): - pass + bpy.utils.unregister_module(__name__) if __name__ == "__main__": register() diff --git a/release/scripts/ui/properties_data_lamp.py b/release/scripts/ui/properties_data_lamp.py index 9961bf1e77f..55781434763 100644 --- a/release/scripts/ui/properties_data_lamp.py +++ b/release/scripts/ui/properties_data_lamp.py @@ -394,11 +394,11 @@ class DATA_PT_custom_props_lamp(DataButtonsPanel, PropertyPanel, bpy.types.Panel def register(): - pass + bpy.utils.register_module(__name__) def unregister(): - pass + bpy.utils.unregister_module(__name__) if __name__ == "__main__": register() diff --git a/release/scripts/ui/properties_data_lattice.py b/release/scripts/ui/properties_data_lattice.py index ae9e9e6f3a8..6bdb36d3520 100644 --- a/release/scripts/ui/properties_data_lattice.py +++ b/release/scripts/ui/properties_data_lattice.py @@ -89,11 +89,11 @@ class DATA_PT_custom_props_lattice(DataButtonsPanel, PropertyPanel, bpy.types.Pa def register(): - pass + bpy.utils.register_module(__name__) def unregister(): - pass + bpy.utils.unregister_module(__name__) if __name__ == "__main__": register() diff --git a/release/scripts/ui/properties_data_mesh.py b/release/scripts/ui/properties_data_mesh.py index 79e1ba2c6c1..342204d0e78 100644 --- a/release/scripts/ui/properties_data_mesh.py +++ b/release/scripts/ui/properties_data_mesh.py @@ -33,7 +33,7 @@ class MESH_MT_vertex_group_specials(bpy.types.Menu): layout.operator("object.vertex_group_copy_to_linked", icon='LINK_AREA') layout.operator("object.vertex_group_copy_to_selected", icon='LINK_AREA') layout.operator("object.vertex_group_mirror", icon='ARROW_LEFTRIGHT') - layout.operator("object.vertex_group_remove", icon='X', text="Delete All").all=True + layout.operator("object.vertex_group_remove", icon='X', text="Delete All").all = True class MESH_MT_shape_key_specials(bpy.types.Menu): @@ -355,11 +355,11 @@ class DATA_PT_custom_props_mesh(MeshButtonsPanel, PropertyPanel, bpy.types.Panel def register(): - pass + bpy.utils.register_module(__name__) def unregister(): - pass + bpy.utils.unregister_module(__name__) if __name__ == "__main__": register() diff --git a/release/scripts/ui/properties_data_metaball.py b/release/scripts/ui/properties_data_metaball.py index bbe027c5ea4..cf7aa8c08fd 100644 --- a/release/scripts/ui/properties_data_metaball.py +++ b/release/scripts/ui/properties_data_metaball.py @@ -119,11 +119,11 @@ class DATA_PT_custom_props_metaball(DataButtonsPanel, PropertyPanel, bpy.types.P def register(): - pass + bpy.utils.register_module(__name__) def unregister(): - pass + bpy.utils.unregister_module(__name__) if __name__ == "__main__": register() diff --git a/release/scripts/ui/properties_data_modifier.py b/release/scripts/ui/properties_data_modifier.py index b3060e0f337..e93b34fe055 100644 --- a/release/scripts/ui/properties_data_modifier.py +++ b/release/scripts/ui/properties_data_modifier.py @@ -363,7 +363,6 @@ class DATA_PT_modifiers(ModifierButtonsPanel, bpy.types.Panel): col.prop(md, "use_dynamic_bind") def MIRROR(self, layout, ob, md): - layout.prop(md, "merge_threshold") split = layout.split(percentage=0.25) col = split.column() @@ -374,6 +373,7 @@ class DATA_PT_modifiers(ModifierButtonsPanel, bpy.types.Panel): col = split.column() col.label(text="Options:") + col.prop(md, "use_mirror_merge", text="Merge") col.prop(md, "use_clip", text="Clipping") col.prop(md, "use_mirror_vertex_groups", text="Vertex Groups") @@ -383,6 +383,9 @@ class DATA_PT_modifiers(ModifierButtonsPanel, bpy.types.Panel): col.prop(md, "use_mirror_v", text="V") col = layout.column() + + if md.use_mirror_merge == True: + col.prop(md, "merge_threshold") col.label(text="Mirror Object:") col.prop(md, "mirror_object", text="") @@ -698,11 +701,11 @@ class DATA_PT_modifiers(ModifierButtonsPanel, bpy.types.Panel): def register(): - pass + bpy.utils.register_module(__name__) def unregister(): - pass + bpy.utils.unregister_module(__name__) if __name__ == "__main__": register() diff --git a/release/scripts/ui/properties_game.py b/release/scripts/ui/properties_game.py index cb0dbc03912..2717e315ee8 100644 --- a/release/scripts/ui/properties_game.py +++ b/release/scripts/ui/properties_game.py @@ -72,7 +72,6 @@ class PHYSICS_PT_game_physics(PhysicsButtonsPanel, bpy.types.Panel): col = split.column() sub = col.column() - sub.active = (game.physics_type == 'RIGID_BODY') sub.prop(game, "use_anisotropic_friction") subsub = sub.column() subsub.active = game.use_anisotropic_friction @@ -149,6 +148,21 @@ class PHYSICS_PT_game_physics(PhysicsButtonsPanel, bpy.types.Panel): col.prop(game, "use_ghost") col.prop(ob, "hide_render", text="Invisible") + layout.separator() + + split = layout.split() + + col = split.column() + col.label(text="Attributes:") + col.prop(game, "radius") + + col = split.column() + sub = col.column() + sub.prop(game, "use_anisotropic_friction") + subsub = sub.column() + subsub.active = game.use_anisotropic_friction + subsub.prop(game, "friction_coefficients", text="", slider=True) + elif game.physics_type in ('SENSOR', 'INVISIBLE', 'NO_COLLISION', 'OCCLUDE'): layout.prop(ob, "hide_render", text="Invisible") @@ -217,9 +231,7 @@ class RENDER_PT_game_player(RenderButtonsPanel, bpy.types.Panel): gs = context.scene.game_settings - row = layout.row() - row.prop(gs, "show_fullscreen") - row.prop(gs, "show_mouse") + layout.prop(gs, "show_fullscreen") split = layout.split() @@ -330,21 +342,25 @@ class RENDER_PT_game_performance(RenderButtonsPanel, bpy.types.Panel): layout = self.layout gs = context.scene.game_settings + row = layout.row() + row.prop(gs, "use_frame_rate") + row.prop(gs, "use_display_lists") - split = layout.split() - col = split.column() - col.label(text="Show:") - col.prop(gs, "show_debug_properties", text="Debug Properties") - col.prop(gs, "show_framerate_profile", text="Framerate and Profile") - col.prop(gs, "show_physics_visualization", text="Physics Visualization") - col.prop(gs, "use_deprecation_warnings") +class RENDER_PT_game_display(RenderButtonsPanel, bpy.types.Panel): + bl_label = "Display" + COMPAT_ENGINES = {'BLENDER_GAME'} - col = split.column() + def draw(self, context): + layout = self.layout - col.label(text="Render:") - col.prop(gs, "use_frame_rate") - col.prop(gs, "use_display_lists") + gs = context.scene.game_settings + flow = layout.column_flow() + flow.prop(gs, "show_debug_properties", text="Debug Properties") + flow.prop(gs, "show_framerate_profile", text="Framerate and Profile") + flow.prop(gs, "show_physics_visualization", text="Physics Visualization") + flow.prop(gs, "use_deprecation_warnings") + flow.prop(gs, "show_mouse") class RENDER_PT_game_sound(RenderButtonsPanel, bpy.types.Panel): @@ -494,11 +510,11 @@ class WORLD_PT_game_physics(WorldButtonsPanel, bpy.types.Panel): def register(): - pass + bpy.utils.register_module(__name__) def unregister(): - pass + bpy.utils.unregister_module(__name__) if __name__ == "__main__": register() diff --git a/release/scripts/ui/properties_material.py b/release/scripts/ui/properties_material.py index 6bfebc444b9..82c3e840420 100644 --- a/release/scripts/ui/properties_material.py +++ b/release/scripts/ui/properties_material.py @@ -896,11 +896,11 @@ class MATERIAL_PT_custom_props(MaterialButtonsPanel, PropertyPanel, bpy.types.Pa def register(): - pass + bpy.utils.register_module(__name__) def unregister(): - pass + bpy.utils.unregister_module(__name__) if __name__ == "__main__": register() diff --git a/release/scripts/ui/properties_object.py b/release/scripts/ui/properties_object.py index 72ae26c1de2..30380e2d338 100644 --- a/release/scripts/ui/properties_object.py +++ b/release/scripts/ui/properties_object.py @@ -343,11 +343,11 @@ class OBJECT_PT_custom_props(ObjectButtonsPanel, PropertyPanel, bpy.types.Panel) def register(): - pass + bpy.utils.register_module(__name__) def unregister(): - pass + bpy.utils.unregister_module(__name__) if __name__ == "__main__": register() diff --git a/release/scripts/ui/properties_object_constraint.py b/release/scripts/ui/properties_object_constraint.py index 4f1d121b3fc..4b9c2885277 100644 --- a/release/scripts/ui/properties_object_constraint.py +++ b/release/scripts/ui/properties_object_constraint.py @@ -749,11 +749,11 @@ class BONE_PT_constraints(ConstraintButtonsPanel, bpy.types.Panel): def register(): - pass + bpy.utils.register_module(__name__) def unregister(): - pass + bpy.utils.unregister_module(__name__) if __name__ == "__main__": register() diff --git a/release/scripts/ui/properties_particle.py b/release/scripts/ui/properties_particle.py index 596d0381f43..4b470831716 100644 --- a/release/scripts/ui/properties_particle.py +++ b/release/scripts/ui/properties_particle.py @@ -128,6 +128,7 @@ class PARTICLE_PT_context_particles(ParticleButtonsPanel, bpy.types.Panel): row = split.row() row.enabled = particle_panel_enabled(context, psys) row.prop(part, "regrow_hair") + row.prop(part, "use_advanced_hair") row = split.row() row.enabled = particle_panel_enabled(context, psys) row.prop(part, "hair_step") @@ -173,6 +174,10 @@ class PARTICLE_PT_emission(ParticleButtonsPanel, bpy.types.Panel): row.active = part.distribution != 'GRID' row.prop(part, "count") + if part.type == 'HAIR' and not part.use_advanced_hair: + row.prop(part, "hair_length") + return + if part.type != 'HAIR': split = layout.split() @@ -192,6 +197,7 @@ class PARTICLE_PT_emission(ParticleButtonsPanel, bpy.types.Panel): row = layout.row() if part.distribution == 'GRID': row.prop(part, "invert_grid") + row.prop(part, "hexagonal_grid") else: row.prop(part, "use_emit_random") row.prop(part, "use_even_distribution") @@ -303,6 +309,8 @@ class PARTICLE_PT_velocity(ParticleButtonsPanel, bpy.types.Panel): def poll(cls, context): if particle_panel_poll(PARTICLE_PT_velocity, context): psys = context.particle_system + if psys.settings.type == 'HAIR' and not psys.settings.use_advanced_hair: + return False return psys.settings.physics_type != 'BOIDS' and not psys.point_cache.use_external else: return False @@ -351,6 +359,8 @@ class PARTICLE_PT_rotation(ParticleButtonsPanel, bpy.types.Panel): def poll(cls, context): if particle_panel_poll(PARTICLE_PT_rotation, context): psys = context.particle_system + if psys.settings.type == 'HAIR' and not psys.settings.use_advanced_hair: + return False return psys.settings.physics_type != 'BOIDS' and not psys.point_cache.use_external else: return False @@ -393,7 +403,10 @@ class PARTICLE_PT_physics(ParticleButtonsPanel, bpy.types.Panel): @classmethod def poll(cls, context): if particle_panel_poll(PARTICLE_PT_physics, context): - return not context.particle_system.point_cache.use_external + psys = context.particle_system + if psys.settings.type == 'HAIR' and not psys.settings.use_advanced_hair: + return False + return not psys.point_cache.use_external else: return False @@ -809,6 +822,8 @@ class PARTICLE_PT_render(ParticleButtonsPanel, bpy.types.Panel): row.prop(weight, "count") elif part.render_type == 'BILLBOARD': + ob = context.object + sub.label(text="Align:") row = layout.row() @@ -821,21 +836,22 @@ class PARTICLE_PT_render(ParticleButtonsPanel, bpy.types.Panel): col = row.column(align=True) col.label(text="Tilt:") col.prop(part, "billboard_tilt", text="Angle", slider=True) - col.prop(part, "billboard_tilt_random", slider=True) + col.prop(part, "billboard_tilt_random", text="Random", slider=True) col = row.column() col.prop(part, "billboard_offset") - row = layout.row() - row.prop(psys, "billboard_normal_uv") - row = layout.row() - row.prop(psys, "billboard_time_index_uv") - - row = layout.row() - row.label(text="Split uv's:") - row.prop(part, "billboard_uv_split", text="Number of splits") - row = layout.row() - row.prop(psys, "billboard_split_uv") - row = layout.row() + col = layout.column() + col.prop_search(psys, "billboard_normal_uv", ob.data, "uv_textures") + col.prop_search(psys, "billboard_time_index_uv", ob.data, "uv_textures") + + split = layout.split(percentage=0.33) + split.label(text="Split uv's:") + split.prop(part, "billboard_uv_split", text="Number of splits") + col = layout.column() + col.active = part.billboard_uv_split > 1 + col.prop_search(psys, "billboard_split_uv", ob.data, "uv_textures") + + row = col.row() row.label(text="Animate:") row.prop(part, "billboard_animation", text="") row.label(text="Offset:") @@ -1022,7 +1038,7 @@ class PARTICLE_PT_field_weights(ParticleButtonsPanel, bpy.types.Panel): bl_label = "Field Weights" bl_options = {'DEFAULT_CLOSED'} COMPAT_ENGINES = {'BLENDER_RENDER'} - + @classmethod def poll(cls, context): return particle_panel_poll(cls, context) @@ -1032,7 +1048,11 @@ class PARTICLE_PT_field_weights(ParticleButtonsPanel, bpy.types.Panel): effector_weights_ui(self, context, part.effector_weights) if part.type == 'HAIR': - self.layout.prop(part.effector_weights, "apply_to_hair_growing") + row = self.layout.row() + row.prop(part.effector_weights, "apply_to_hair_growing") + row.prop(part, "apply_effector_to_children") + row = self.layout.row() + row.prop(part, "effect_hair", slider=True) class PARTICLE_PT_force_fields(ParticleButtonsPanel, bpy.types.Panel): @@ -1045,12 +1065,16 @@ class PARTICLE_PT_force_fields(ParticleButtonsPanel, bpy.types.Panel): part = context.particle_system.settings - layout.prop(part, "use_self_effect") + row = layout.row() + row.prop(part, "use_self_effect") + row.prop(part, "effector_amount", text="Amount") split = layout.split(percentage=0.2) split.label(text="Type 1:") split.prop(part.force_field_1, "type", text="") basic_force_field_settings_ui(self, context, part.force_field_1) + if part.force_field_1.type != 'NONE': + layout.label(text="Falloff:") basic_force_field_falloff_ui(self, context, part.force_field_1) if part.force_field_1.type != 'NONE': @@ -1060,6 +1084,8 @@ class PARTICLE_PT_force_fields(ParticleButtonsPanel, bpy.types.Panel): split.label(text="Type 2:") split.prop(part.force_field_2, "type", text="") basic_force_field_settings_ui(self, context, part.force_field_2) + if part.force_field_2.type != 'NONE': + layout.label(text="Falloff:") basic_force_field_falloff_ui(self, context, part.force_field_2) @@ -1067,7 +1093,7 @@ class PARTICLE_PT_vertexgroups(ParticleButtonsPanel, bpy.types.Panel): bl_label = "Vertexgroups" bl_options = {'DEFAULT_CLOSED'} COMPAT_ENGINES = {'BLENDER_RENDER'} - + @classmethod def poll(cls, context): return particle_panel_poll(cls, context) @@ -1142,11 +1168,11 @@ class PARTICLE_PT_custom_props(ParticleButtonsPanel, PropertyPanel, bpy.types.Pa def register(): - pass + bpy.utils.register_module(__name__) def unregister(): - pass + bpy.utils.unregister_module(__name__) if __name__ == "__main__": register() diff --git a/release/scripts/ui/properties_physics_cloth.py b/release/scripts/ui/properties_physics_cloth.py index f33804c4c6d..0ac4429c71a 100644 --- a/release/scripts/ui/properties_physics_cloth.py +++ b/release/scripts/ui/properties_physics_cloth.py @@ -217,11 +217,11 @@ class PHYSICS_PT_cloth_field_weights(PhysicButtonsPanel, bpy.types.Panel): def register(): - pass + bpy.utils.register_module(__name__) def unregister(): - pass + bpy.utils.unregister_module(__name__) if __name__ == "__main__": register() diff --git a/release/scripts/ui/properties_physics_common.py b/release/scripts/ui/properties_physics_common.py index ec6ec21fa26..e462bd958f7 100644 --- a/release/scripts/ui/properties_physics_common.py +++ b/release/scripts/ui/properties_physics_common.py @@ -263,27 +263,32 @@ def basic_force_field_falloff_ui(self, context, field): col = split.column() col.prop(field, "z_direction", text="") - col.prop(field, "use_min_distance", text="Use Minimum") - col.prop(field, "use_max_distance", text="Use Maximum") col = split.column() col.prop(field, "falloff_power", text="Power") - sub = col.column() + split = layout.split() + col = split.column() + row = col.row(align=True) + row.prop(field, "use_min_distance", text="") + sub = row.row() sub.active = field.use_min_distance - sub.prop(field, "distance_min", text="Distance") - - sub = col.column() + sub.prop(field, "distance_min", text="Minimum") + + col = split.column() + row = col.row(align=True) + row.prop(field, "use_max_distance", text="") + sub = row.row() sub.active = field.use_max_distance - sub.prop(field, "distance_max", text="Distance") + sub.prop(field, "distance_max", text="Maximum") def register(): - pass + bpy.utils.register_module(__name__) def unregister(): - pass + bpy.utils.unregister_module(__name__) if __name__ == "__main__": register() diff --git a/release/scripts/ui/properties_physics_field.py b/release/scripts/ui/properties_physics_field.py index f46f78ca017..8a697806aa1 100644 --- a/release/scripts/ui/properties_physics_field.py +++ b/release/scripts/ui/properties_physics_field.py @@ -217,11 +217,11 @@ class PHYSICS_PT_collision(PhysicButtonsPanel, bpy.types.Panel): def register(): - pass + bpy.utils.register_module(__name__) def unregister(): - pass + bpy.utils.unregister_module(__name__) if __name__ == "__main__": register() diff --git a/release/scripts/ui/properties_physics_fluid.py b/release/scripts/ui/properties_physics_fluid.py index 88eb926dfa0..6385a535a44 100644 --- a/release/scripts/ui/properties_physics_fluid.py +++ b/release/scripts/ui/properties_physics_fluid.py @@ -42,7 +42,7 @@ class PHYSICS_PT_fluid(PhysicButtonsPanel, bpy.types.Panel): if md: fluid = md.settings - + row = layout.row() if fluid is None: row.label("built without fluids") @@ -282,11 +282,11 @@ class PHYSICS_PT_domain_particles(PhysicButtonsPanel, bpy.types.Panel): def register(): - pass + bpy.utils.register_module(__name__) def unregister(): - pass + bpy.utils.unregister_module(__name__) if __name__ == "__main__": register() diff --git a/release/scripts/ui/properties_physics_smoke.py b/release/scripts/ui/properties_physics_smoke.py index 0ca5f03f832..56ddff292d9 100644 --- a/release/scripts/ui/properties_physics_smoke.py +++ b/release/scripts/ui/properties_physics_smoke.py @@ -205,11 +205,11 @@ class PHYSICS_PT_smoke_field_weights(PhysicButtonsPanel, bpy.types.Panel): def register(): - pass + bpy.utils.register_module(__name__) def unregister(): - pass + bpy.utils.unregister_module(__name__) if __name__ == "__main__": register() diff --git a/release/scripts/ui/properties_physics_softbody.py b/release/scripts/ui/properties_physics_softbody.py index 343b198fa84..7d3fa66ed02 100644 --- a/release/scripts/ui/properties_physics_softbody.py +++ b/release/scripts/ui/properties_physics_softbody.py @@ -262,11 +262,11 @@ class PHYSICS_PT_softbody_field_weights(PhysicButtonsPanel, bpy.types.Panel): def register(): - pass + bpy.utils.register_module(__name__) def unregister(): - pass + bpy.utils.unregister_module(__name__) if __name__ == "__main__": register() diff --git a/release/scripts/ui/properties_render.py b/release/scripts/ui/properties_render.py index 2efffa520d8..e522fdd2dcb 100644 --- a/release/scripts/ui/properties_render.py +++ b/release/scripts/ui/properties_render.py @@ -967,11 +967,11 @@ class RENDER_PT_bake(RenderButtonsPanel, bpy.types.Panel): def register(): - pass + bpy.utils.register_module(__name__) def unregister(): - pass + bpy.utils.unregister_module(__name__) if __name__ == "__main__": register() diff --git a/release/scripts/ui/properties_scene.py b/release/scripts/ui/properties_scene.py index 5085e8d2ab5..d3586c645e6 100644 --- a/release/scripts/ui/properties_scene.py +++ b/release/scripts/ui/properties_scene.py @@ -311,11 +311,11 @@ class ANIM_OT_keying_set_export(bpy.types.Operator): def register(): - pass + bpy.utils.register_module(__name__) def unregister(): - pass + bpy.utils.unregister_module(__name__) if __name__ == "__main__": register() diff --git a/release/scripts/ui/properties_texture.py b/release/scripts/ui/properties_texture.py index bd9f1a3b13f..ac3fc2d0b1d 100644 --- a/release/scripts/ui/properties_texture.py +++ b/release/scripts/ui/properties_texture.py @@ -60,6 +60,12 @@ def context_tex_datablock(context): return idblock idblock = context.brush + if idblock: + return idblock + + if context.particle_system: + idblock = context.particle_system.settings + return idblock @@ -84,7 +90,7 @@ class TEXTURE_PT_context_texture(TextureButtonsPanel, bpy.types.Panel): engine = context.scene.render.engine if not hasattr(context, "texture_slot"): return False - return ((context.material or context.world or context.lamp or context.brush or context.texture) + return ((context.material or context.world or context.lamp or context.brush or context.texture or context.particle_system) and (engine in cls.COMPAT_ENGINES)) def draw(self, context): @@ -99,7 +105,10 @@ class TEXTURE_PT_context_texture(TextureButtonsPanel, bpy.types.Panel): if not isinstance(pin_id, bpy.types.Material): pin_id = None - tex_collection = (pin_id is None) and (node is None) and (not isinstance(idblock, bpy.types.Brush)) + if not space.use_pin_id: + layout.prop(space, "texture_context", expand=True) + + tex_collection = (not space.use_pin_id) and (node is None) and (not isinstance(idblock, bpy.types.Brush)) if tex_collection: row = layout.row() @@ -126,9 +135,6 @@ class TEXTURE_PT_context_texture(TextureButtonsPanel, bpy.types.Panel): col = split.column() - if not space.pin_id: - col.prop(space, "show_brush_texture", text="Brush", toggle=True) - if tex: split = layout.split(percentage=0.2) @@ -983,20 +989,49 @@ class TEXTURE_PT_influence(TextureSlotPanel, bpy.types.Panel): col = split.column() factor_but(col, "use_map_zenith_up", "zenith_up_factor", "Zenith Up") factor_but(col, "use_map_zenith_down", "zenith_down_factor", "Zenith Down") + elif isinstance(idblock, bpy.types.ParticleSettings): + split = layout.split() + + col = split.column() + col.label(text="General:") + factor_but(col, "use_map_time", "time_factor", "Time") + factor_but(col, "use_map_life", "life_factor", "Lifetime") + factor_but(col, "use_map_density", "density_factor", "Density") + factor_but(col, "use_map_size", "size_factor", "Size") - layout.separator() + col = split.column() + col.label(text="Physics:") + factor_but(col, "use_map_velocity", "velocity_factor", "Velocity") + factor_but(col, "use_map_damp", "damp_factor", "Damp") + factor_but(col, "use_map_gravity", "gravity_factor", "Gravity") + factor_but(col, "use_map_field", "field_factor", "Force Fields") + + layout.label(text="Hair:") + + split = layout.split() + + col = split.column() + factor_but(col, "use_map_length", "length_factor", "Length") + factor_but(col, "use_map_clump", "clump_factor", "Clump") + + col = split.column() + factor_but(col, "use_map_kink", "kink_factor", "Kink") + factor_but(col, "use_map_rough", "rough_factor", "Rough") - split = layout.split() + layout.separator() + + if not isinstance(idblock, bpy.types.ParticleSettings): + split = layout.split() - col = split.column() - col.prop(tex, "blend_type", text="Blend") - col.prop(tex, "use_rgb_to_intensity") - # color is used on grayscale textures even when use_rgb_to_intensity is disabled. - col.prop(tex, "color", text="") + col = split.column() + col.prop(tex, "blend_type", text="Blend") + col.prop(tex, "use_rgb_to_intensity") + # color is used on grayscale textures even when use_rgb_to_intensity is disabled. + col.prop(tex, "color", text="") - col = split.column() - col.prop(tex, "invert", text="Negative") - col.prop(tex, "use_stencil") + col = split.column() + col.prop(tex, "invert", text="Negative") + col.prop(tex, "use_stencil") if isinstance(idblock, bpy.types.Material) or isinstance(idblock, bpy.types.World): col.prop(tex, "default_value", text="DVar", slider=True) @@ -1007,7 +1042,7 @@ class TEXTURE_PT_influence(TextureSlotPanel, bpy.types.Panel): row = layout.row() # only show bump settings if activated but not for normalmap images - row.active = tex.use_map_normal and not( tex.texture.type == 'IMAGE' and tex.texture.use_normal_map ) + row.active = tex.use_map_normal and not (tex.texture.type == 'IMAGE' and tex.texture.use_normal_map) col = row.column() col.prop(tex, "bump_method", text="Method") @@ -1024,11 +1059,11 @@ class TEXTURE_PT_custom_props(TextureButtonsPanel, PropertyPanel, bpy.types.Pane def register(): - pass + bpy.utils.register_module(__name__) def unregister(): - pass + bpy.utils.unregister_module(__name__) if __name__ == "__main__": register() diff --git a/release/scripts/ui/properties_world.py b/release/scripts/ui/properties_world.py index 0ab39ce6fdb..fd11f299f34 100644 --- a/release/scripts/ui/properties_world.py +++ b/release/scripts/ui/properties_world.py @@ -268,11 +268,11 @@ class WORLD_PT_custom_props(WorldButtonsPanel, PropertyPanel, bpy.types.Panel): def register(): - pass + bpy.utils.register_module(__name__) def unregister(): - pass + bpy.utils.unregister_module(__name__) if __name__ == "__main__": register() diff --git a/release/scripts/ui/space_console.py b/release/scripts/ui/space_console.py index 99ddeb13651..b3bd886d8c5 100644 --- a/release/scripts/ui/space_console.py +++ b/release/scripts/ui/space_console.py @@ -163,11 +163,11 @@ class ConsoleLanguage(bpy.types.Operator): def register(): - pass + bpy.utils.register_module(__name__) def unregister(): - pass + bpy.utils.unregister_module(__name__) if __name__ == "__main__": register() diff --git a/release/scripts/ui/space_dopesheet.py b/release/scripts/ui/space_dopesheet.py index 5efdaa58abc..9561efe70d3 100644 --- a/release/scripts/ui/space_dopesheet.py +++ b/release/scripts/ui/space_dopesheet.py @@ -245,6 +245,7 @@ class DOPESHEET_MT_channel(bpy.types.Menu): layout.separator() layout.operator("anim.channels_editable_toggle") + layout.operator_menu_enum("action.extrapolation_type", "type", text="Extrapolation Mode") layout.separator() layout.operator("anim.channels_expand") @@ -280,7 +281,6 @@ class DOPESHEET_MT_key(bpy.types.Menu): layout.operator_menu_enum("action.keyframe_type", "type", text="Keyframe Type") layout.operator_menu_enum("action.handle_type", "type", text="Handle Type") layout.operator_menu_enum("action.interpolation_type", "type", text="Interpolation Mode") - layout.operator_menu_enum("action.extrapolation_type", "type", text="Extrapolation Mode") layout.separator() layout.operator("action.clean") @@ -357,11 +357,11 @@ class DOPESHEET_MT_gpencil_frame(bpy.types.Menu): def register(): - pass + bpy.utils.register_module(__name__) def unregister(): - pass + bpy.utils.unregister_module(__name__) if __name__ == "__main__": register() diff --git a/release/scripts/ui/space_filebrowser.py b/release/scripts/ui/space_filebrowser.py index dea306277f1..2d66bb38637 100644 --- a/release/scripts/ui/space_filebrowser.py +++ b/release/scripts/ui/space_filebrowser.py @@ -75,11 +75,11 @@ class FILEBROWSER_HT_header(bpy.types.Header): def register(): - pass + bpy.utils.register_module(__name__) def unregister(): - pass + bpy.utils.unregister_module(__name__) if __name__ == "__main__": register() diff --git a/release/scripts/ui/space_graph.py b/release/scripts/ui/space_graph.py index 51c5ebcfbf8..55c4d4cfd94 100644 --- a/release/scripts/ui/space_graph.py +++ b/release/scripts/ui/space_graph.py @@ -81,6 +81,9 @@ class GRAPH_MT_view(bpy.types.Menu): layout.prop(st, "use_auto_merge_keyframes") layout.separator() + layout.prop(st, "use_fancy_drawing") + + layout.separator() if st.show_handles: layout.operator("graph.handles_view_toggle", icon='CHECKBOX_HLT', text="Show All Handles") else: @@ -239,11 +242,11 @@ class GRAPH_MT_key_transform(bpy.types.Menu): def register(): - pass + bpy.utils.register_module(__name__) def unregister(): - pass + bpy.utils.unregister_module(__name__) if __name__ == "__main__": register() diff --git a/release/scripts/ui/space_image.py b/release/scripts/ui/space_image.py index 464e5bb8cfe..433c12b0620 100644 --- a/release/scripts/ui/space_image.py +++ b/release/scripts/ui/space_image.py @@ -727,11 +727,11 @@ class IMAGE_PT_paint_curve(BrushButtonsPanel, bpy.types.Panel): def register(): - pass + bpy.utils.register_module(__name__) def unregister(): - pass + bpy.utils.unregister_module(__name__) if __name__ == "__main__": register() diff --git a/release/scripts/ui/space_info.py b/release/scripts/ui/space_info.py index 9881cb55692..6c392cb9a3d 100644 --- a/release/scripts/ui/space_info.py +++ b/release/scripts/ui/space_info.py @@ -404,11 +404,11 @@ class HELP_OT_operator_cheat_sheet(bpy.types.Operator): def register(): - pass + bpy.utils.register_module(__name__) def unregister(): - pass + bpy.utils.unregister_module(__name__) if __name__ == "__main__": register() diff --git a/release/scripts/ui/space_logic.py b/release/scripts/ui/space_logic.py index 44c6f5fd684..54dde61e90a 100644 --- a/release/scripts/ui/space_logic.py +++ b/release/scripts/ui/space_logic.py @@ -90,11 +90,11 @@ class LOGIC_MT_view(bpy.types.Menu): def register(): - pass + bpy.utils.register_module(__name__) def unregister(): - pass + bpy.utils.unregister_module(__name__) if __name__ == "__main__": register() diff --git a/release/scripts/ui/space_nla.py b/release/scripts/ui/space_nla.py index 1921e80035d..13afc97f913 100644 --- a/release/scripts/ui/space_nla.py +++ b/release/scripts/ui/space_nla.py @@ -188,11 +188,11 @@ class NLA_MT_edit_transform(bpy.types.Menu): def register(): - pass + bpy.utils.register_module(__name__) def unregister(): - pass + bpy.utils.unregister_module(__name__) if __name__ == "__main__": register() diff --git a/release/scripts/ui/space_node.py b/release/scripts/ui/space_node.py index 31ac25ff41a..aaf14813ee5 100644 --- a/release/scripts/ui/space_node.py +++ b/release/scripts/ui/space_node.py @@ -71,6 +71,7 @@ class NODE_HT_header(bpy.types.Header): if snode.show_backdrop: row = layout.row(align=True) row.prop(snode, "backdrop_channels", text="", expand=True) + layout.prop(snode, "use_auto_render") layout.separator() @@ -165,7 +166,7 @@ class NODE_MT_node(bpy.types.Menu): layout.operator("node.read_fullsamplelayers") -# Node Backdrop options +# Node Backdrop options class NODE_PT_properties(bpy.types.Panel): bl_space_type = 'NODE_EDITOR' bl_region_type = 'UI' @@ -196,11 +197,11 @@ class NODE_PT_properties(bpy.types.Panel): def register(): - pass + bpy.utils.register_module(__name__) def unregister(): - pass + bpy.utils.unregister_module(__name__) if __name__ == "__main__": register() diff --git a/release/scripts/ui/space_outliner.py b/release/scripts/ui/space_outliner.py index 38e749c4a75..219dd1de117 100644 --- a/release/scripts/ui/space_outliner.py +++ b/release/scripts/ui/space_outliner.py @@ -118,11 +118,11 @@ class OUTLINER_MT_edit_datablocks(bpy.types.Menu): def register(): - pass + bpy.utils.register_module(__name__) def unregister(): - pass + bpy.utils.unregister_module(__name__) if __name__ == "__main__": register() diff --git a/release/scripts/ui/space_sequencer.py b/release/scripts/ui/space_sequencer.py index 110cb74d3c5..3ae1e35aaf8 100644 --- a/release/scripts/ui/space_sequencer.py +++ b/release/scripts/ui/space_sequencer.py @@ -831,11 +831,11 @@ class SEQUENCER_PT_view(SequencerButtonsPanel_Output, bpy.types.Panel): def register(): - pass + bpy.utils.register_module(__name__) def unregister(): - pass + bpy.utils.unregister_module(__name__) if __name__ == "__main__": register() diff --git a/release/scripts/ui/space_text.py b/release/scripts/ui/space_text.py index 58f12ba51e4..df5967c9128 100644 --- a/release/scripts/ui/space_text.py +++ b/release/scripts/ui/space_text.py @@ -295,11 +295,11 @@ class TEXT_MT_toolbox(bpy.types.Menu): def register(): - pass + bpy.utils.register_module(__name__) def unregister(): - pass + bpy.utils.unregister_module(__name__) if __name__ == "__main__": register() diff --git a/release/scripts/ui/space_time.py b/release/scripts/ui/space_time.py index c1293e87c85..046274abc89 100644 --- a/release/scripts/ui/space_time.py +++ b/release/scripts/ui/space_time.py @@ -200,11 +200,11 @@ class TIME_MT_autokey(bpy.types.Menu): def register(): - pass + bpy.utils.register_module(__name__) def unregister(): - pass + bpy.utils.unregister_module(__name__) if __name__ == "__main__": register() diff --git a/release/scripts/ui/space_userpref.py b/release/scripts/ui/space_userpref.py index d1e2c581660..c669c6d2139 100644 --- a/release/scripts/ui/space_userpref.py +++ b/release/scripts/ui/space_userpref.py @@ -310,7 +310,6 @@ class USERPREF_PT_edit(bpy.types.Panel): sub = col.column() # sub.active = edit.use_keyframe_insert_auto # incorrect, timeline can enable - sub.prop(edit, "use_keyframe_insert_keyingset", text="Only Insert for Keying Set") sub.prop(edit, "use_keyframe_insert_available", text="Only Insert Available") col.separator() @@ -1177,7 +1176,6 @@ class WM_OT_addon_install(bpy.types.Operator): else: os.remove(f_full) - def execute(self, context): import traceback import zipfile @@ -1224,7 +1222,6 @@ class WM_OT_addon_install(bpy.types.Operator): elif os.path.exists(path_dest): self.report({'WARNING'}, "File already installed to %r\n" % path_dest) return {'CANCELLED'} - #if not compressed file just copy into the addon path try: @@ -1286,11 +1283,11 @@ class WM_OT_addon_expand(bpy.types.Operator): def register(): - pass + bpy.utils.register_module(__name__) def unregister(): - pass + bpy.utils.unregister_module(__name__) if __name__ == "__main__": register() diff --git a/release/scripts/ui/space_userpref_keymap.py b/release/scripts/ui/space_userpref_keymap.py index 316e4e2be10..a78ef1be36f 100644 --- a/release/scripts/ui/space_userpref_keymap.py +++ b/release/scripts/ui/space_userpref_keymap.py @@ -787,11 +787,11 @@ class WM_OT_keyconfig_remove(bpy.types.Operator): def register(): - pass + bpy.utils.register_module(__name__) def unregister(): - pass + bpy.utils.unregister_module(__name__) if __name__ == "__main__": register() diff --git a/release/scripts/ui/space_view3d.py b/release/scripts/ui/space_view3d.py index eafb46b133d..162322a8720 100644 --- a/release/scripts/ui/space_view3d.py +++ b/release/scripts/ui/space_view3d.py @@ -2306,11 +2306,11 @@ class VIEW3D_PT_context_properties(bpy.types.Panel): def register(): - pass + bpy.utils.register_module(__name__) def unregister(): - pass + bpy.utils.unregister_module(__name__) if __name__ == "__main__": register() diff --git a/release/scripts/ui/space_view3d_toolbar.py b/release/scripts/ui/space_view3d_toolbar.py index c3280a67b7e..163e02817a4 100644 --- a/release/scripts/ui/space_view3d_toolbar.py +++ b/release/scripts/ui/space_view3d_toolbar.py @@ -1302,11 +1302,11 @@ class VIEW3D_PT_tools_particlemode(View3DPanel, bpy.types.Panel): def register(): - pass + bpy.utils.register_module(__name__) def unregister(): - pass + bpy.utils.unregister_module(__name__) if __name__ == "__main__": register() diff --git a/source/blender/blenfont/intern/blf_dir.c b/source/blender/blenfont/intern/blf_dir.c index 1eb7597fa54..6bee7b38537 100644 --- a/source/blender/blenfont/intern/blf_dir.c +++ b/source/blender/blenfont/intern/blf_dir.c @@ -125,20 +125,16 @@ char *blf_dir_search(const char *file) { DirBLF *dir; char full_path[FILE_MAXDIR+FILE_MAXFILE]; - char *s; - - dir= global_font_dir.first; - s= NULL; - while (dir) { - BLI_join_dirfile(full_path, dir->path, file); + char *s= NULL; + + for(dir=global_font_dir.first; dir; dir= dir->next) { + BLI_join_dirfile(full_path, sizeof(full_path), dir->path, file); if (BLI_exist(full_path)) { - s= (char *)MEM_mallocN(strlen(full_path)+1,"blf_dir_search"); - strcpy(s, full_path); + s= BLI_strdup(full_path); break; } - dir= dir->next; } - + if (!s) { /* check the current directory, why not ? */ if (BLI_exist(file)) diff --git a/source/blender/blenfont/intern/blf_glyph.c b/source/blender/blenfont/intern/blf_glyph.c index c36496fb542..8d13975b83a 100644 --- a/source/blender/blenfont/intern/blf_glyph.c +++ b/source/blender/blenfont/intern/blf_glyph.c @@ -205,7 +205,7 @@ GlyphBLF *blf_glyph_search(GlyphCacheBLF *gc, unsigned int c) return(NULL); } -GlyphBLF *blf_glyph_add(FontBLF *font, FT_UInt index, unsigned int c) +GlyphBLF *blf_glyph_add(FontBLF *font, unsigned int index, unsigned int c) { FT_GlyphSlot slot; GlyphBLF *g; @@ -220,9 +220,9 @@ GlyphBLF *blf_glyph_add(FontBLF *font, FT_UInt index, unsigned int c) return(g); if (sharp) - err = FT_Load_Glyph(font->face, index, FT_LOAD_TARGET_MONO); + err = FT_Load_Glyph(font->face, (FT_UInt)index, FT_LOAD_TARGET_MONO); else - err = FT_Load_Glyph(font->face, index, FT_LOAD_TARGET_NORMAL | FT_LOAD_NO_HINTING | FT_LOAD_NO_BITMAP); /* Sure about NO_* flags? */ + err = FT_Load_Glyph(font->face, (FT_UInt)index, FT_LOAD_TARGET_NORMAL | FT_LOAD_NO_HINTING | FT_LOAD_NO_BITMAP); /* Sure about NO_* flags? */ if (err) return(NULL); @@ -249,7 +249,7 @@ GlyphBLF *blf_glyph_add(FontBLF *font, FT_UInt index, unsigned int c) g->next= NULL; g->prev= NULL; g->c= c; - g->idx= index; + g->idx= (FT_UInt)index; g->tex= 0; g->build_tex= 0; g->bitmap= NULL; diff --git a/source/blender/blenfont/intern/blf_internal.h b/source/blender/blenfont/intern/blf_internal.h index afe40973269..72d4fc4d54a 100644 --- a/source/blender/blenfont/intern/blf_internal.h +++ b/source/blender/blenfont/intern/blf_internal.h @@ -28,6 +28,11 @@ #ifndef BLF_INTERNAL_H #define BLF_INTERNAL_H +struct FontBLF; +struct GlyphBLF; +struct GlyphCacheBLF; +struct rctf; + unsigned int blf_next_p2(unsigned int x); unsigned int blf_hash(unsigned int val); int blf_utf8_next(unsigned char *buf, int *iindex); @@ -39,30 +44,30 @@ int blf_dir_split(const char *str, char *file, int *size); int blf_font_init(void); void blf_font_exit(void); -FontBLF *blf_font_new(const char *name, const char *filename); -FontBLF *blf_font_new_from_mem(const char *name, unsigned char *mem, int mem_size); -void blf_font_attach_from_mem(FontBLF *font, const unsigned char *mem, int mem_size); +struct FontBLF *blf_font_new(const char *name, const char *filename); +struct FontBLF *blf_font_new_from_mem(const char *name, unsigned char *mem, int mem_size); +void blf_font_attach_from_mem(struct FontBLF *font, const unsigned char *mem, int mem_size); -void blf_font_size(FontBLF *font, int size, int dpi); -void blf_font_draw(FontBLF *font, const char *str, unsigned int len); -void blf_font_draw_ascii(FontBLF *font, const char *str, unsigned int len); -void blf_font_buffer(FontBLF *font, const char *str); -void blf_font_boundbox(FontBLF *font, const char *str, rctf *box); -void blf_font_width_and_height(FontBLF *font, const char *str, float *width, float *height); -float blf_font_width(FontBLF *font, const char *str); -float blf_font_height(FontBLF *font, const char *str); -float blf_font_fixed_width(FontBLF *font); -void blf_font_free(FontBLF *font); +void blf_font_size(struct FontBLF *font, int size, int dpi); +void blf_font_draw(struct FontBLF *font, const char *str, unsigned int len); +void blf_font_draw_ascii(struct FontBLF *font, const char *str, unsigned int len); +void blf_font_buffer(struct FontBLF *font, const char *str); +void blf_font_boundbox(struct FontBLF *font, const char *str, struct rctf *box); +void blf_font_width_and_height(struct FontBLF *font, const char *str, float *width, float *height); +float blf_font_width(struct FontBLF *font, const char *str); +float blf_font_height(struct FontBLF *font, const char *str); +float blf_font_fixed_width(struct FontBLF *font); +void blf_font_free(struct FontBLF *font); -GlyphCacheBLF *blf_glyph_cache_find(FontBLF *font, int size, int dpi); -GlyphCacheBLF *blf_glyph_cache_new(FontBLF *font); -void blf_glyph_cache_clear(FontBLF *font); -void blf_glyph_cache_free(GlyphCacheBLF *gc); +struct GlyphCacheBLF *blf_glyph_cache_find(struct FontBLF *font, int size, int dpi); +struct GlyphCacheBLF *blf_glyph_cache_new(struct FontBLF *font); +void blf_glyph_cache_clear(struct FontBLF *font); +void blf_glyph_cache_free(struct GlyphCacheBLF *gc); -GlyphBLF *blf_glyph_search(GlyphCacheBLF *gc, unsigned int c); -GlyphBLF *blf_glyph_add(FontBLF *font, FT_UInt index, unsigned int c); +struct GlyphBLF *blf_glyph_search(struct GlyphCacheBLF *gc, unsigned int c); +struct GlyphBLF *blf_glyph_add(struct FontBLF *font, unsigned int index, unsigned int c); -void blf_glyph_free(GlyphBLF *g); -int blf_glyph_render(FontBLF *font, GlyphBLF *g, float x, float y); +void blf_glyph_free(struct GlyphBLF *g); +int blf_glyph_render(struct FontBLF *font, struct GlyphBLF *g, float x, float y); #endif /* BLF_INTERNAL_H */ diff --git a/source/blender/blenfont/intern/blf_lang.c b/source/blender/blenfont/intern/blf_lang.c index 8a929e1ebf7..610e8750bc1 100644 --- a/source/blender/blenfont/intern/blf_lang.c +++ b/source/blender/blenfont/intern/blf_lang.c @@ -29,6 +29,8 @@ #include <stdlib.h> #include <string.h> +#include "BLF_api.h" + #ifdef INTERNATIONAL #include <locale.h> @@ -38,11 +40,11 @@ #include "DNA_listBase.h" #include "DNA_vec_types.h" +#include "MEM_guardedalloc.h" - -#include "BLI_blenlib.h" #include "BLI_linklist.h" /* linknode */ #include "BLI_string.h" +#include "BLI_path_util.h" #ifdef __APPLE__ @@ -54,9 +56,9 @@ #define FONT_SIZE_DEFAULT 12 /* locale options. */ -char global_messagepath[1024]; -char global_language[32]; -char global_encoding_name[32]; +static char global_messagepath[1024]; +static char global_language[32]; +static char global_encoding_name[32]; void BLF_lang_init(void) @@ -79,20 +81,14 @@ void BLF_lang_set(const char *str) #else char *locreturn= setlocale(LC_ALL, str); if (locreturn == NULL) { - char *lang; - - lang= (char*)malloc(sizeof(char)*(strlen(str)+7)); - - lang[0]= '\0'; - strcat(lang, str); - strcat(lang, ".UTF-8"); + char *lang= BLI_sprintfN("%s.UTF-8", str); locreturn= setlocale(LC_ALL, lang); if (locreturn == NULL) { printf("could not change language to %s nor %s\n", str, lang); } - free(lang); + MEM_freeN(lang); } setlocale(LC_NUMERIC, "C"); @@ -100,12 +96,12 @@ void BLF_lang_set(const char *str) textdomain(DOMAIN_NAME); bindtextdomain(DOMAIN_NAME, global_messagepath); /* bind_textdomain_codeset(DOMAIN_NAME, global_encoding_name); */ - strcpy(global_language, str); + BLI_strncpy(global_language, str, sizeof(global_language)); } -void BLF_lang_encoding(const char *str) +static void BLF_lang_encoding(const char *str) { - strcpy(global_encoding_name, str); + BLI_strncpy(global_encoding_name, str, sizeof(global_encoding_name)); /* bind_textdomain_codeset(DOMAIN_NAME, encoding_name); */ } @@ -116,13 +112,13 @@ void BLF_lang_init(void) return; } -void BLF_lang_encoding(char *str) +static void BLF_lang_encoding(const char *str) { (void)str; return; } -void BLF_lang_set(char *str) +void BLF_lang_set(const char *str) { (void)str; return; diff --git a/source/blender/blenfont/intern/blf_util.c b/source/blender/blenfont/intern/blf_util.c index 30e6e3fd3f5..9316d47cabe 100644 --- a/source/blender/blenfont/intern/blf_util.c +++ b/source/blender/blenfont/intern/blf_util.c @@ -30,6 +30,7 @@ #include <stdlib.h> #include <string.h> +#include "blf_internal.h" unsigned int blf_next_p2(unsigned int x) { diff --git a/source/blender/blenkernel/BKE_DerivedMesh.h b/source/blender/blenkernel/BKE_DerivedMesh.h index 48127d3cf4c..79e9b11d4db 100644 --- a/source/blender/blenkernel/BKE_DerivedMesh.h +++ b/source/blender/blenkernel/BKE_DerivedMesh.h @@ -481,6 +481,7 @@ DerivedMesh *mesh_create_derived_render(struct Scene *scene, struct Object *ob, DerivedMesh *mesh_create_derived_index_render(struct Scene *scene, struct Object *ob, CustomDataMask dataMask, int index); /* same as above but wont use render settings */ +DerivedMesh *mesh_create_derived(struct Mesh *me, struct Object *ob, float (*vertCos)[3]); DerivedMesh *mesh_create_derived_view(struct Scene *scene, struct Object *ob, CustomDataMask dataMask); DerivedMesh *mesh_create_derived_no_deform(struct Scene *scene, struct Object *ob, @@ -495,12 +496,15 @@ DerivedMesh *mesh_create_derived_no_virtual(struct Scene *scene, struct Object * DerivedMesh *mesh_create_derived_physics(struct Scene *scene, struct Object *ob, float (*vertCos)[3], CustomDataMask dataMask); +DerivedMesh *editmesh_get_derived(struct EditMesh *em, float (*vertexCos)[3]); DerivedMesh *editmesh_get_derived_base(struct Object *, struct EditMesh *em); DerivedMesh *editmesh_get_derived_cage(struct Scene *scene, struct Object *, struct EditMesh *em, CustomDataMask dataMask); DerivedMesh *editmesh_get_derived_cage_and_final(struct Scene *scene, struct Object *, struct EditMesh *em, DerivedMesh **final_r, CustomDataMask dataMask); +float (*editmesh_get_vertex_cos(struct EditMesh *em, int *numVerts_r))[3]; +int editmesh_modifier_is_enabled(struct Scene *scene, struct ModifierData *md, DerivedMesh *dm); void makeDerivedMesh(struct Scene *scene, struct Object *ob, struct EditMesh *em, CustomDataMask dataMask); /* returns an array of deform matrices for crazyspace correction, and the @@ -508,8 +512,9 @@ void makeDerivedMesh(struct Scene *scene, struct Object *ob, struct EditMesh *em int editmesh_get_first_deform_matrices(struct Scene *, struct Object *, struct EditMesh *em, float (**deformmats)[3][3], float (**deformcos)[3]); -/* returns an array of deform matrices for crazyspace correction when sculpting */ -void sculpt_get_deform_matrices(struct Scene *scene, struct Object *ob, +/* returns an array of deform matrices for crazyspace correction when sculpting, + and the number of modifiers left */ +int sculpt_get_deform_matrices(struct Scene *scene, struct Object *ob, float (**deformmats)[3][3], float (**deformcos)[3]); void weight_to_rgb(float input, float *fr, float *fg, float *fb); diff --git a/source/blender/blenkernel/BKE_armature.h b/source/blender/blenkernel/BKE_armature.h index f074f7e7e74..ed2a06b0f33 100644 --- a/source/blender/blenkernel/BKE_armature.h +++ b/source/blender/blenkernel/BKE_armature.h @@ -80,7 +80,7 @@ void free_armature(struct bArmature *arm); void make_local_armature(struct bArmature *arm); struct bArmature *copy_armature(struct bArmature *arm); -int bone_autoside_name (char *name, int strip_number, short axis, float head, float tail); +int bone_autoside_name (char name[32], int strip_number, short axis, float head, float tail); struct Bone *get_named_bone (struct bArmature *arm, const char *name); diff --git a/source/blender/blenkernel/BKE_deform.h b/source/blender/blenkernel/BKE_deform.h index 52051712ff0..eaabc57c781 100644 --- a/source/blender/blenkernel/BKE_deform.h +++ b/source/blender/blenkernel/BKE_deform.h @@ -64,7 +64,7 @@ void defvert_normalize(struct MDeformVert *dvert); /* utility function, note that 32 chars is the maximum string length since its only * used with defgroups currently */ -void flip_side_name(char *name, const char *from_name, int strip_number); +void flip_side_name(char name[32], const char from_name[32], int strip_number); #endif diff --git a/source/blender/blenkernel/BKE_idprop.h b/source/blender/blenkernel/BKE_idprop.h index 701cffc7743..0ca5690e635 100644 --- a/source/blender/blenkernel/BKE_idprop.h +++ b/source/blender/blenkernel/BKE_idprop.h @@ -127,6 +127,8 @@ int IDP_InsertToGroup(struct IDProperty *group, struct IDProperty *previous, void IDP_RemFromGroup(struct IDProperty *group, struct IDProperty *prop); IDProperty *IDP_GetPropertyFromGroup(struct IDProperty *prop, const char *name); +/* same as above but ensure type match */ +IDProperty *IDP_GetPropertyTypeFromGroup(struct IDProperty *prop, const char *name, const char type); /*Get an iterator to iterate over the members of an id property group. Note that this will automatically free the iterator once iteration is complete; diff --git a/source/blender/blenkernel/BKE_key.h b/source/blender/blenkernel/BKE_key.h index 416b89ef36e..d72dce3bf7c 100644 --- a/source/blender/blenkernel/BKE_key.h +++ b/source/blender/blenkernel/BKE_key.h @@ -79,9 +79,11 @@ float (*key_to_vertcos(struct Object *ob, struct KeyBlock *kb))[3]; void vertcos_to_key(struct Object *ob, struct KeyBlock *kb, float (*vertCos)[3]); void offset_to_key(struct Object *ob, struct KeyBlock *kb, float (*ofs)[3]); +/* key.c */ +extern int slurph_opt; + #ifdef __cplusplus }; #endif -#endif - +#endif // BKE_KEY_H diff --git a/source/blender/blenkernel/BKE_mesh.h b/source/blender/blenkernel/BKE_mesh.h index 398e1d8a7f5..02d52e10fa5 100644 --- a/source/blender/blenkernel/BKE_mesh.h +++ b/source/blender/blenkernel/BKE_mesh.h @@ -47,6 +47,8 @@ struct Object; struct MTFace; struct VecNor; struct CustomData; +struct DerivedMesh; +struct Scene; #ifdef __cplusplus extern "C" { @@ -87,7 +89,9 @@ void mesh_get_texspace(struct Mesh *me, float *loc_r, float *rot_r, float *size_ /* if old, it converts mface->edcode to edge drawflags */ void make_edges(struct Mesh *me, int old); + void mesh_strip_loose_faces(struct Mesh *me); +void mesh_strip_loose_edges(struct Mesh *me); /* Calculate vertex and face normals, face normals are returned in *faceNors_r if non-NULL * and vertex normals are stored in actual mverts. @@ -147,9 +151,15 @@ int mesh_center_median(struct Mesh *me, float cent[3]); int mesh_center_bounds(struct Mesh *me, float cent[3]); void mesh_translate(struct Mesh *me, float offset[3], int do_keys); +/* mesh_validate.c */ +int BKE_mesh_validate_arrays(struct Mesh *me, struct MVert *mverts, int totvert, struct MEdge *medges, int totedge, struct MFace *mfaces, int totface, const short do_verbose, const short do_fixes); +int BKE_mesh_validate(struct Mesh *me, int do_verbose); +int BKE_mesh_validate_dm(struct DerivedMesh *dm); + +void BKE_mesh_calc_edges(struct Mesh *mesh, int update); + #ifdef __cplusplus } #endif -#endif - +#endif /* BKE_MESH_H */ diff --git a/source/blender/blenkernel/BKE_multires.h b/source/blender/blenkernel/BKE_multires.h index 23fabce68ba..de895ebce51 100644 --- a/source/blender/blenkernel/BKE_multires.h +++ b/source/blender/blenkernel/BKE_multires.h @@ -84,12 +84,12 @@ void multires_mdisp_smooth_bounds(struct MDisps *disps); void multires_topology_changed(struct Scene *scene, struct Object *ob); /**** interpolation stuff ****/ -void old_mdisps_bilinear(float out[3], float (*disps)[3], int st, float u, float v); -void mdisp_rot_crn_to_face(int S, int corners, int face_side, float x, float y, float *u, float *v); -int mdisp_rot_face_to_crn(int corners, int face_side, float u, float v, float *x, float *y); -void mdisp_apply_weight(int S, int corners, int x, int y, int face_side, float crn_weight[4][2], float *u_r, float *v_r); -void mdisp_flip_disp(int S, int corners, float axis_x[2], float axis_y[2], float disp[3]); +void old_mdisps_bilinear(float out[3], float (*disps)[3], const int st, float u, float v); +void mdisp_rot_crn_to_face(const int S, const int corners, const int face_side, const float x, const float y, float *u, float *v); +int mdisp_rot_face_to_crn(const int corners, const int face_side, const float u, const float v, float *x, float *y); +void mdisp_apply_weight(const int S, const int corners, int x, int y, const int face_side, float crn_weight[4][2], float *u_r, float *v_r); +void mdisp_flip_disp(const int S, const int corners, const float axis_x[2], const float axis_y[2], float disp[3]); void mdisp_join_tris(struct MDisps *dst, struct MDisps *tri1, struct MDisps *tri2); -#endif +#endif // BKE_MULTIRES_H diff --git a/source/blender/blenkernel/BKE_node.h b/source/blender/blenkernel/BKE_node.h index 857150cf873..57d18f58e2d 100644 --- a/source/blender/blenkernel/BKE_node.h +++ b/source/blender/blenkernel/BKE_node.h @@ -87,6 +87,7 @@ typedef struct bNodeType { /* this line is set on startup of blender */ void (*uifunc)(struct uiLayout *, struct bContext *C, struct PointerRNA *ptr); + const char *(*labelfunc)(struct bNode *); void (*initfunc)(struct bNode *); void (*freestoragefunc)(struct bNode *); @@ -135,7 +136,7 @@ void ntreeInitTypes(struct bNodeTree *ntree); void ntreeMakeOwnType(struct bNodeTree *ntree); void ntreeUpdateType(struct bNodeTree *ntree, struct bNodeType *ntype); void ntreeFreeTree(struct bNodeTree *ntree); -struct bNodeTree *ntreeCopyTree(struct bNodeTree *ntree, int internal_select); +struct bNodeTree *ntreeCopyTree(struct bNodeTree *ntree); void ntreeSwitchID(struct bNodeTree *ntree, struct ID *sce_from, struct ID *sce_to); void ntreeMakeLocal(struct bNodeTree *ntree); @@ -193,6 +194,7 @@ void nodeClearActiveID(struct bNodeTree *ntree, short idtype); void NodeTagChanged(struct bNodeTree *ntree, struct bNode *node); int NodeTagIDChanged(struct bNodeTree *ntree, struct ID *id); +void ntreeClearTags(struct bNodeTree *ntree); /* ************** Groups ****************** */ @@ -206,12 +208,24 @@ void nodeCopyGroup(struct bNode *gnode); /* ************** COMMON NODES *************** */ +/* Init a new node type struct with default values and callbacks */ +void node_type_base(struct bNodeType *ntype, int type, const char *name, short nclass, short flag, + struct bNodeSocketType *inputs, struct bNodeSocketType *outputs); +void node_type_size(struct bNodeType *ntype, int width, int minwidth, int maxwidth); +void node_type_init(struct bNodeType *ntype, void (*initfunc)(struct bNode *)); +void node_type_storage(struct bNodeType *ntype, + const char *storagename, + void (*freestoragefunc)(struct bNode *), + void (*copystoragefunc)(struct bNode *, struct bNode *)); +void node_type_exec(struct bNodeType *ntype, void (*execfunc)(void *data, struct bNode *, struct bNodeStack **, struct bNodeStack **)); +void node_type_gpu(struct bNodeType *ntype, int (*gpufunc)(struct GPUMaterial *mat, struct bNode *node, struct GPUNodeStack *in, struct GPUNodeStack *out)); +void node_type_label(struct bNodeType *ntype, const char *(*labelfunc)(struct bNode *)); + #define NODE_GROUP 2 #define NODE_GROUP_MENU 1000 #define NODE_DYNAMIC_MENU 4000 -extern bNodeType node_group_typeinfo; - +void register_node_type_group(ListBase *lb); /* ************** SHADER NODES *************** */ diff --git a/source/blender/blenkernel/BKE_particle.h b/source/blender/blenkernel/BKE_particle.h index 3f7523d5264..bb325420bbe 100644 --- a/source/blender/blenkernel/BKE_particle.h +++ b/source/blender/blenkernel/BKE_particle.h @@ -80,20 +80,10 @@ typedef struct ParticleSimulationData { struct ListBase *colliders; } ParticleSimulationData; -//typedef struct ParticleReactEvent { -// struct ParticleReactEvent *next, *prev; -// int event, pa_num; -// Object *ob; -// struct ParticleSystem *psys; -// struct ParticleKey state; -// -// float time, size; -//}ParticleReactEvent; - typedef struct ParticleTexture{ float ivel; /* used in reset */ float time, life, exist, size; /* used in init */ - float pvel[3]; /* used in physics */ + float damp, gravity, field; /* used in physics */ float length, clump, kink, effector;/* used in path caching */ float rough1, rough2, roughe; /* used in path caching */ } ParticleTexture; @@ -159,6 +149,7 @@ typedef struct ParticleBillboardData int uv[3]; int lock, num; int totnum; + int lifetime; short align, uv_split, anim, split_offset; } ParticleBillboardData; @@ -291,7 +282,7 @@ float psys_get_dietime_from_cache(struct PointCache *cache, int index); void psys_free_pdd(struct ParticleSystem *psys); float *psys_cache_vgroup(struct DerivedMesh *dm, struct ParticleSystem *psys, int vgroup); -void psys_get_texture(struct ParticleSimulationData *sim, struct Material *ma, struct ParticleData *pa, struct ParticleTexture *ptex, int event); +void psys_get_texture(struct ParticleSimulationData *sim, struct ParticleData *pa, struct ParticleTexture *ptex, int event, float cfra); void psys_interpolate_face(struct MVert *mvert, struct MFace *mface, struct MTFace *tface, float (*orcodata)[3], float *uv, float *vec, float *nor, float *utan, float *vtan, float *orco, float *ornor); float psys_particle_value_from_verts(struct DerivedMesh *dm, short from, struct ParticleData *pa, float *values); void psys_get_from_key(struct ParticleKey *key, float *loc, float *vel, float *rot, float *time); diff --git a/source/blender/blenkernel/BKE_scene.h b/source/blender/blenkernel/BKE_scene.h index f75e4020cb9..2337b95dcbc 100644 --- a/source/blender/blenkernel/BKE_scene.h +++ b/source/blender/blenkernel/BKE_scene.h @@ -62,7 +62,7 @@ struct Scene *add_scene(const char *name); struct Base *object_in_scene(struct Object *ob, struct Scene *sce); void set_scene_bg(struct Main *bmain, struct Scene *sce); -struct Scene *set_scene_name(struct Main *bmain, char *name); +struct Scene *set_scene_name(struct Main *bmain, const char *name); struct Scene *copy_scene(struct Scene *sce, int type); void unlink_scene(struct Main *bmain, struct Scene *sce, struct Scene *newsce); diff --git a/source/blender/blenkernel/BKE_texture.h b/source/blender/blenkernel/BKE_texture.h index cbae90f4c38..da9f13e07bc 100644 --- a/source/blender/blenkernel/BKE_texture.h +++ b/source/blender/blenkernel/BKE_texture.h @@ -44,6 +44,7 @@ struct Lamp; struct LampRen; struct Material; struct MTex; +struct ParticleSettings; struct PluginTex; struct PointDensity; struct Tex; @@ -84,6 +85,7 @@ struct Tex *give_current_material_texture(struct Material *ma); struct Tex *give_current_lamp_texture(struct Lamp *la); struct Tex *give_current_world_texture(struct World *world); struct Tex *give_current_brush_texture(struct Brush *br); +struct Tex *give_current_particle_texture(struct ParticleSettings *part); struct bNode *give_current_material_texture_node(struct Material *ma); @@ -94,6 +96,7 @@ void set_current_brush_texture(struct Brush *br, struct Tex *tex); void set_current_world_texture(struct World *wo, struct Tex *tex); void set_current_material_texture(struct Material *ma, struct Tex *tex); void set_current_lamp_texture(struct Lamp *la, struct Tex *tex); +void set_current_particle_texture(struct ParticleSettings *part, struct Tex *tex); struct TexMapping *add_mapping(void); void init_mapping(struct TexMapping *texmap); diff --git a/source/blender/blenkernel/CMakeLists.txt b/source/blender/blenkernel/CMakeLists.txt index 9057820fb65..c7a474c5949 100644 --- a/source/blender/blenkernel/CMakeLists.txt +++ b/source/blender/blenkernel/CMakeLists.txt @@ -107,6 +107,7 @@ set(SRC intern/material.c intern/mball.c intern/mesh.c + intern/mesh_validate.c intern/modifier.c intern/multires.c intern/nla.c diff --git a/source/blender/blenkernel/intern/CCGSubSurf.c b/source/blender/blenkernel/intern/CCGSubSurf.c index 35ba8caedb0..8c265a1f8c9 100644 --- a/source/blender/blenkernel/intern/CCGSubSurf.c +++ b/source/blender/blenkernel/intern/CCGSubSurf.c @@ -397,7 +397,7 @@ static CCGEdge *_vert_findEdgeTo(CCGVert *v, CCGVert *vQ) { (e->v1==v && e->v0==vQ)) return e; } - return 0; + return NULL; } static int _vert_isBoundary(CCGVert *v) { int i; @@ -599,7 +599,7 @@ static CCG_INLINE void *_face_getIFCoEdge(CCGFace *f, CCGEdge *e, int lvl, int e static float *_face_getIFNoEdge(CCGFace *f, CCGEdge *e, int lvl, int eX, int eY, int levels, int dataSize, int normalDataOffset) { return (float*) ((byte*) _face_getIFCoEdge(f, e, lvl, eX, eY, levels, dataSize) + normalDataOffset); } -void _face_calcIFNo(CCGFace *f, int lvl, int S, int x, int y, float *no, int levels, int dataSize) { +static void _face_calcIFNo(CCGFace *f, int lvl, int S, int x, int y, float *no, int levels, int dataSize) { float *a = _face_getIFCo(f, lvl, S, x+0, y+0, levels, dataSize); float *b = _face_getIFCo(f, lvl, S, x+1, y+0, levels, dataSize); float *c = _face_getIFCo(f, lvl, S, x+1, y+1, levels, dataSize); diff --git a/source/blender/blenkernel/intern/DerivedMesh.c b/source/blender/blenkernel/intern/DerivedMesh.c index 658d29f0046..eedc2636991 100644 --- a/source/blender/blenkernel/intern/DerivedMesh.c +++ b/source/blender/blenkernel/intern/DerivedMesh.c @@ -432,7 +432,7 @@ void DM_swap_face_data(DerivedMesh *dm, int index, const int *corner_indices) /// -static DerivedMesh *getMeshDerivedMesh(Mesh *me, Object *ob, float (*vertCos)[3]) +DerivedMesh *mesh_create_derived(Mesh *me, Object *ob, float (*vertCos)[3]) { DerivedMesh *dm = CDDM_from_mesh(me, ob); @@ -1122,8 +1122,7 @@ static void emDM_getVert(DerivedMesh *dm, int index, MVert *vert_r) vert_r->no[1] = ev->no[1] * 32767.0; vert_r->no[2] = ev->no[2] * 32767.0; - /* TODO what to do with vert_r->flag and vert_r->mat_nr? */ - vert_r->mat_nr = 0; + /* TODO what to do with vert_r->flag? */ vert_r->bweight = (unsigned char) (ev->bweight*255.0f); } @@ -1220,8 +1219,7 @@ static void emDM_copyVertArray(DerivedMesh *dm, MVert *vert_r) vert_r->no[1] = ev->no[1] * 32767.0; vert_r->no[2] = ev->no[2] * 32767.0; - /* TODO what to do with vert_r->flag and vert_r->mat_nr? */ - vert_r->mat_nr = 0; + /* TODO what to do with vert_r->flag? */ vert_r->flag = 0; vert_r->bweight = (unsigned char) (ev->bweight*255.0f); } @@ -1332,7 +1330,7 @@ static void emDM_release(DerivedMesh *dm) } } -static DerivedMesh *getEditMeshDerivedMesh(EditMesh *em, float (*vertexCos)[3]) +DerivedMesh *editmesh_get_derived(EditMesh *em, float (*vertexCos)[3]) { EditMeshDerivedMesh *emdm = MEM_callocN(sizeof(*emdm), "emdm"); @@ -1449,11 +1447,11 @@ DerivedMesh *mesh_create_derived_for_modifier(Scene *scene, Object *ob, Modifier float (*deformedVerts)[3] = mesh_getVertexCos(me, &numVerts); mti->deformVerts(md, ob, NULL, deformedVerts, numVerts, 0, 0); - dm = getMeshDerivedMesh(me, ob, deformedVerts); + dm = mesh_create_derived(me, ob, deformedVerts); MEM_freeN(deformedVerts); } else { - DerivedMesh *tdm = getMeshDerivedMesh(me, ob, NULL); + DerivedMesh *tdm = mesh_create_derived(me, ob, NULL); dm = mti->applyModifier(md, ob, tdm, 0, 0); if(tdm != dm) tdm->release(tdm); @@ -1723,12 +1721,6 @@ static void mesh_calc_modifiers(Scene *scene, Object *ob, float (*inputVertexCos if(useDeform < 0 && mti->dependsOnTime && mti->dependsOnTime(md)) continue; if(mti->type == eModifierTypeType_OnlyDeform) { - if(sculpt_mode && !has_multires) - if(!ELEM(md->type, eModifierType_Armature, eModifierType_ShapeKey)) { - modifier_setError(md, "Not supported in sculpt mode."); - continue; - } - if(!deformedVerts) deformedVerts = mesh_getVertexCos(me, &numVerts); @@ -1782,7 +1774,7 @@ static void mesh_calc_modifiers(Scene *scene, Object *ob, float (*inputVertexCos continue; } if(sculpt_mode && (!has_multires || multires_applied)) - if(md->type != eModifierType_Armature || multires_applied) { + if(mti->type != eModifierTypeType_OnlyDeform || multires_applied) { modifier_setError(md, "Not supported in sculpt mode."); continue; } @@ -2005,7 +1997,7 @@ static void mesh_calc_modifiers(Scene *scene, Object *ob, float (*inputVertexCos BLI_linklist_free(datamasks, NULL); } -static float (*editmesh_getVertexCos(EditMesh *em, int *numVerts_r))[3] +float (*editmesh_get_vertex_cos(EditMesh *em, int *numVerts_r))[3] { int i, numVerts = *numVerts_r = BLI_countlist(&em->verts); float (*cos)[3]; @@ -2019,7 +2011,7 @@ static float (*editmesh_getVertexCos(EditMesh *em, int *numVerts_r))[3] return cos; } -static int editmesh_modifier_is_enabled(Scene *scene, ModifierData *md, DerivedMesh *dm) +int editmesh_modifier_is_enabled(Scene *scene, ModifierData *md, DerivedMesh *dm) { ModifierTypeInfo *mti = modifierType_getInfo(md->type); int required_mode = eModifierMode_Realtime | eModifierMode_Editmode; @@ -2048,7 +2040,7 @@ static void editmesh_calc_modifiers(Scene *scene, Object *ob, EditMesh *em, Deri modifiers_clearErrors(ob); if(cage_r && cageIndex == -1) { - *cage_r = getEditMeshDerivedMesh(em, NULL); + *cage_r = editmesh_get_derived(em, NULL); } dm = NULL; @@ -2090,7 +2082,7 @@ static void editmesh_calc_modifiers(Scene *scene, Object *ob, EditMesh *em, Deri MEM_mallocN(sizeof(*deformedVerts) * numVerts, "dfmv"); dm->getVertCos(dm, deformedVerts); } else { - deformedVerts = editmesh_getVertexCos(em, &numVerts); + deformedVerts = editmesh_get_vertex_cos(em, &numVerts); } } @@ -2180,7 +2172,7 @@ static void editmesh_calc_modifiers(Scene *scene, Object *ob, EditMesh *em, Deri *cage_r = dm; } else { *cage_r = - getEditMeshDerivedMesh(em, + editmesh_get_derived(em, deformedVerts ? MEM_dupallocN(deformedVerts) : NULL); } } @@ -2204,7 +2196,7 @@ static void editmesh_calc_modifiers(Scene *scene, Object *ob, EditMesh *em, Deri } else if (!deformedVerts && cage_r && *cage_r) { *final_r = *cage_r; } else { - *final_r = getEditMeshDerivedMesh(em, deformedVerts); + *final_r = editmesh_get_derived(em, deformedVerts); deformedVerts = NULL; } @@ -2427,7 +2419,7 @@ DerivedMesh *editmesh_get_derived_cage(Scene *scene, Object *obedit, EditMesh *e DerivedMesh *editmesh_get_derived_base(Object *UNUSED(obedit), EditMesh *em) { - return getEditMeshDerivedMesh(em, NULL); + return editmesh_get_derived(em, NULL); } @@ -2487,105 +2479,6 @@ float *mesh_get_mapped_verts_nors(Scene *scene, Object *ob) return vertexcosnos; } -/* ********* crazyspace *************** */ - -int editmesh_get_first_deform_matrices(Scene *scene, Object *ob, EditMesh *em, float (**deformmats)[3][3], float (**deformcos)[3]) -{ - ModifierData *md; - DerivedMesh *dm; - int i, a, numleft = 0, numVerts = 0; - int cageIndex = modifiers_getCageIndex(scene, ob, NULL, 1); - float (*defmats)[3][3] = NULL, (*deformedVerts)[3] = NULL; - - modifiers_clearErrors(ob); - - dm = NULL; - md = modifiers_getVirtualModifierList(ob); - - /* compute the deformation matrices and coordinates for the first - modifiers with on cage editing that are enabled and support computing - deform matrices */ - for(i = 0; md && i <= cageIndex; i++, md = md->next) { - ModifierTypeInfo *mti = modifierType_getInfo(md->type); - - if(!editmesh_modifier_is_enabled(scene, md, dm)) - continue; - - if(mti->type==eModifierTypeType_OnlyDeform && mti->deformMatricesEM) { - if(!defmats) { - dm= getEditMeshDerivedMesh(em, NULL); - deformedVerts= editmesh_getVertexCos(em, &numVerts); - defmats= MEM_callocN(sizeof(*defmats)*numVerts, "defmats"); - - for(a=0; a<numVerts; a++) - unit_m3(defmats[a]); - } - - mti->deformMatricesEM(md, ob, em, dm, deformedVerts, defmats, - numVerts); - } - else - break; - } - - for(; md && i <= cageIndex; md = md->next, i++) - if(editmesh_modifier_is_enabled(scene, md, dm) && modifier_isCorrectableDeformed(md)) - numleft++; - - if(dm) - dm->release(dm); - - *deformmats= defmats; - *deformcos= deformedVerts; - - return numleft; -} - -void sculpt_get_deform_matrices(Scene *scene, Object *ob, float (**deformmats)[3][3], float (**deformcos)[3]) -{ - ModifierData *md; - DerivedMesh *dm; - int a, numVerts= 0; - float (*defmats)[3][3]= NULL, (*deformedVerts)[3]= NULL; - MultiresModifierData *mmd= get_multires_modifier(scene, ob, 0); - int has_multires = mmd != NULL && mmd->sculptlvl > 0; - - if(has_multires) { - *deformmats= NULL; - *deformcos= NULL; - return; - } - - dm= NULL; - md= modifiers_getVirtualModifierList(ob); - - for(; md; md= md->next) { - ModifierTypeInfo *mti= modifierType_getInfo(md->type); - - if(!modifier_isEnabled(scene, md, eModifierMode_Realtime)) continue; - - if(mti->type==eModifierTypeType_OnlyDeform && mti->deformMatrices) { - if(!defmats) { - Mesh *me= (Mesh*)ob->data; - dm= getMeshDerivedMesh(me, ob, NULL); - deformedVerts= mesh_getVertexCos(me, &numVerts); - defmats= MEM_callocN(sizeof(*defmats)*numVerts, "defmats"); - - for(a=0; a<numVerts; a++) - unit_m3(defmats[a]); - } - - mti->deformMatrices(md, ob, dm, deformedVerts, defmats, numVerts); - } - } - - if(dm) - dm->release(dm); - - *deformmats= defmats; - *deformcos= deformedVerts; -} - /* ******************* GLSL ******************** */ void DM_add_tangent_layer(DerivedMesh *dm) diff --git a/source/blender/blenkernel/intern/action.c b/source/blender/blenkernel/intern/action.c index 3bfdbdc4fc9..328f2ccdc75 100644 --- a/source/blender/blenkernel/intern/action.c +++ b/source/blender/blenkernel/intern/action.c @@ -93,11 +93,11 @@ void make_local_action(bAction *act) bAction *actn; int local=0, lib=0; - if (act->id.lib==0) return; + if (act->id.lib==NULL) return; if (act->id.us==1) { - act->id.lib= 0; + act->id.lib= NULL; act->id.flag= LIB_LOCAL; - new_id(0, (ID *)act, 0); + new_id(NULL, (ID *)act, NULL); return; } @@ -113,10 +113,10 @@ void make_local_action(bAction *act) #endif if(local && lib==0) { - act->id.lib= 0; + act->id.lib= NULL; act->id.flag= LIB_LOCAL; //make_local_action_channels(act); - new_id(0, (ID *)act, 0); + new_id(NULL, (ID *)act, NULL); } else if(local && lib) { actn= copy_action(act); @@ -1144,7 +1144,7 @@ void what_does_obaction (Scene *UNUSED(scene), Object *ob, Object *workob, bPose animsys_evaluate_action_group(&id_ptr, act, agrp, NULL, cframe); } else { - AnimData adt= {0}; + AnimData adt= {NULL}; /* init animdata, and attach to workob */ workob->adt= &adt; diff --git a/source/blender/blenkernel/intern/anim.c b/source/blender/blenkernel/intern/anim.c index ab1da04e683..8fdfca33efb 100644 --- a/source/blender/blenkernel/intern/anim.c +++ b/source/blender/blenkernel/intern/anim.c @@ -64,6 +64,7 @@ #include "BKE_scene.h" #include "BKE_utildefines.h" #include "BKE_depsgraph.h" +#include "BKE_anim.h" // XXX bad level call... @@ -1159,12 +1160,12 @@ static void face_duplilist(ListBase *lb, ID *id, Scene *scene, Object *par, floa static void new_particle_duplilist(ListBase *lb, ID *id, Scene *scene, Object *par, float par_space_mat[][4], ParticleSystem *psys, int level, int animated) { GroupObject *go; - Object *ob=0, **oblist=0, obcopy, *obcopylist=0; + Object *ob=NULL, **oblist=NULL, obcopy, *obcopylist=NULL; DupliObject *dob; ParticleDupliWeight *dw; ParticleSettings *part; ParticleData *pa; - ChildParticle *cpa=0; + ChildParticle *cpa=NULL; ParticleKey state; ParticleCacheKey *cache; float ctime, pa_time, scale = 1.0f; @@ -1173,18 +1174,23 @@ static void new_particle_duplilist(ListBase *lb, ID *id, Scene *scene, Object *p int a, b, counter, hair = 0; int totpart, totchild, totgroup=0, pa_num; - if(psys==0) return; + int no_draw_flag = PARS_UNEXIST; + + if(psys==NULL) return; /* simple preventing of too deep nested groups */ if(level>MAX_DUPLI_RECUR) return; part=psys->part; - if(part==0) + if(part==NULL) return; if(!psys_check_enabled(par, psys)) return; + + if(G.rendering == 0) + no_draw_flag |= PARS_NO_DISP; ctime = bsystem_time(scene, par, (float)scene->r.cfra, 0.0); @@ -1194,7 +1200,7 @@ static void new_particle_duplilist(ListBase *lb, ID *id, Scene *scene, Object *p BLI_srandom(31415926 + psys->seed); if((psys->renderdata || part->draw_as==PART_DRAW_REND) && ELEM(part->ren_as, PART_DRAW_OB, PART_DRAW_GR)) { - ParticleSimulationData sim= {0}; + ParticleSimulationData sim= {NULL}; sim.scene= scene; sim.ob= par; sim.psys= psys; @@ -1280,7 +1286,7 @@ static void new_particle_duplilist(ListBase *lb, ID *id, Scene *scene, Object *p for(pa=psys->particles,counter=0; a<totpart+totchild; a++,pa++,counter++) { if(a<totpart) { /* handle parent particle */ - if(pa->flag & (PARS_UNEXIST+PARS_NO_DISP)) + if(pa->flag & no_draw_flag) continue; pa_num = pa->num; @@ -1293,7 +1299,7 @@ static void new_particle_duplilist(ListBase *lb, ID *id, Scene *scene, Object *p pa_num = a; pa_time = psys->particles[cpa->parent].time; - size = psys_get_child_size(psys, cpa, ctime, 0); + size = psys_get_child_size(psys, cpa, ctime, NULL); } /* some hair paths might be non-existent so they can't be used for duplication */ @@ -1324,11 +1330,11 @@ static void new_particle_duplilist(ListBase *lb, ID *id, Scene *scene, Object *p /* hair we handle separate and compute transform based on hair keys */ if(a < totpart) { cache = psys->pathcache[a]; - psys_get_dupli_path_transform(&sim, pa, 0, cache, pamat, &scale); + psys_get_dupli_path_transform(&sim, pa, NULL, cache, pamat, &scale); } else { cache = psys->childcache[a-totpart]; - psys_get_dupli_path_transform(&sim, 0, cpa, cache, pamat, &scale); + psys_get_dupli_path_transform(&sim, NULL, cpa, cache, pamat, &scale); } VECCOPY(pamat[3], cache->co); @@ -1444,7 +1450,7 @@ static Object *find_family_object(Object **obar, char *family, char ch) static void font_duplilist(ListBase *lb, Scene *scene, Object *par, int level, int animated) { - Object *ob, *obar[256]= {0}; + Object *ob, *obar[256]= {NULL}; Curve *cu; struct chartrans *ct, *chartransdata; float vec[3], obmat[4][4], pmat[4][4], fsize, xof, yof; @@ -1458,7 +1464,7 @@ static void font_duplilist(ListBase *lb, Scene *scene, Object *par, int level, i /* in par the family name is stored, use this to find the other objects */ chartransdata= BKE_text_to_curve(scene, par, FO_DUPLI); - if(chartransdata==0) return; + if(chartransdata==NULL) return; cu= par->data; slen= strlen(cu->str); diff --git a/source/blender/blenkernel/intern/anim_sys.c b/source/blender/blenkernel/intern/anim_sys.c index fcce85b026e..dead11c692c 100644 --- a/source/blender/blenkernel/intern/anim_sys.c +++ b/source/blender/blenkernel/intern/anim_sys.c @@ -816,7 +816,7 @@ KS_Path *BKE_keyingset_find_path (KeyingSet *ks, ID *id, const char group_name[] eq_id= 0; /* path */ - if ((ksp->rna_path==0) || strcmp(rna_path, ksp->rna_path)) + if ((ksp->rna_path==NULL) || strcmp(rna_path, ksp->rna_path)) eq_path= 0; /* index - need to compare whole-array setting too... */ @@ -1863,7 +1863,7 @@ static void animsys_evaluate_nla (PointerRNA *ptr, AnimData *adt, float ctime) /* if there are strips, evaluate action as per NLA rules */ if ((has_strips) || (adt->actstrip)) { /* make dummy NLA strip, and add that to the stack */ - NlaStrip dummy_strip= {0}; + NlaStrip dummy_strip= {NULL}; ListBase dummy_trackslist; dummy_trackslist.first= dummy_trackslist.last= &dummy_strip; @@ -1922,11 +1922,13 @@ static void animsys_evaluate_nla (PointerRNA *ptr, AnimData *adt, float ctime) /* Clear all overides */ /* Add or get existing Override for given setting */ +#if 0 AnimOverride *BKE_animsys_validate_override (PointerRNA *UNUSED(ptr), char *UNUSED(path), int UNUSED(array_index)) { // FIXME: need to define how to get overrides return NULL; } +#endif /* -------------------- */ diff --git a/source/blender/blenkernel/intern/armature.c b/source/blender/blenkernel/intern/armature.c index 14c4b6f97ab..cc01438fd5d 100644 --- a/source/blender/blenkernel/intern/armature.c +++ b/source/blender/blenkernel/intern/armature.c @@ -136,19 +136,19 @@ void make_local_armature(bArmature *arm) Object *ob; bArmature *newArm; - if (arm->id.lib==0) + if (arm->id.lib==NULL) return; if (arm->id.us==1) { - arm->id.lib= 0; + arm->id.lib= NULL; arm->id.flag= LIB_LOCAL; - new_id(0, (ID*)arm, 0); + new_id(NULL, (ID*)arm, NULL); return; } if(local && lib==0) { - arm->id.lib= 0; + arm->id.lib= NULL; arm->id.flag= LIB_LOCAL; - new_id(0, (ID *)arm, 0); + new_id(NULL, (ID *)arm, NULL); } else if(local && lib) { newArm= copy_armature(arm); @@ -158,7 +158,7 @@ void make_local_armature(bArmature *arm) while(ob) { if(ob->data==arm) { - if(ob->id.lib==0) { + if(ob->id.lib==NULL) { ob->data= newArm; newArm->id.us++; arm->id.us--; @@ -248,16 +248,15 @@ Bone *get_named_bone (bArmature *arm, const char *name) } /* Finds the best possible extension to the name on a particular axis. (For renaming, check for unique names afterwards) - * This assumes that bone names are at most 32 chars long! * strip_number: removes number extensions (TODO: not used) * axis: the axis to name on * head/tail: the head/tail co-ordinate of the bone on the specified axis */ -int bone_autoside_name (char *name, int UNUSED(strip_number), short axis, float head, float tail) +int bone_autoside_name (char name[MAXBONENAME], int UNUSED(strip_number), short axis, float head, float tail) { unsigned int len; - char basename[32]={""}; - char extension[5]={""}; + char basename[MAXBONENAME]= ""; + char extension[5]= ""; len= strlen(name); if (len == 0) return 0; @@ -350,13 +349,13 @@ int bone_autoside_name (char *name, int UNUSED(strip_number), short axis, float } } } - - if ((32 - len) < strlen(extension) + 1) { /* add 1 for the '.' */ + + if ((MAXBONENAME - len) < strlen(extension) + 1) { /* add 1 for the '.' */ strncpy(name, basename, len-strlen(extension)); } - - sprintf(name, "%s.%s", basename, extension); - + + BLI_snprintf(name, MAXBONENAME, "%s.%s", basename, extension); + return 1; } diff --git a/source/blender/blenkernel/intern/blender.c b/source/blender/blenkernel/intern/blender.c index 6e08df0f465..e34b4bef8d4 100644 --- a/source/blender/blenkernel/intern/blender.c +++ b/source/blender/blenkernel/intern/blender.c @@ -88,10 +88,10 @@ Global G; UserDef U; -ListBase WMlist= {NULL, NULL}; +/* ListBase = {NULL, NULL}; */ short ENDIAN_ORDER; -char versionstr[48]= ""; +static char versionstr[48]= ""; /* ********** free ********** */ @@ -124,9 +124,9 @@ void initglobals(void) ENDIAN_ORDER= (((char*)&ENDIAN_ORDER)[0])? L_ENDIAN: B_ENDIAN; if(BLENDER_SUBVERSION) - sprintf(versionstr, "www.blender.org %d.%d", BLENDER_VERSION, BLENDER_SUBVERSION); + BLI_snprintf(versionstr, sizeof(versionstr), "www.blender.org %d.%d", BLENDER_VERSION, BLENDER_SUBVERSION); else - sprintf(versionstr, "www.blender.org %d", BLENDER_VERSION); + BLI_snprintf(versionstr, sizeof(versionstr), "www.blender.org %d", BLENDER_VERSION); #ifdef _WIN32 // FULLSCREEN G.windowstate = G_WINDOWSTATE_USERDEF; @@ -314,7 +314,7 @@ static int handle_subversion_warning(Main *main) char str[128]; - sprintf(str, "File written by newer Blender binary: %d.%d , expect loss of data!", main->minversionfile, main->minsubversionfile); + BLI_snprintf(str, sizeof(str), "File written by newer Blender binary: %d.%d , expect loss of data!", main->minversionfile, main->minsubversionfile); // XXX error(str); } return 1; @@ -350,7 +350,7 @@ int BKE_read_file(bContext *C, const char *dir, ReportList *reports) BlendFileData *bfd; int retval= 1; - if(strstr(dir, BLENDER_STARTUP_FILE)==0) /* dont print user-pref loading */ + if(strstr(dir, BLENDER_STARTUP_FILE)==NULL) /* dont print user-pref loading */ printf("read blend: %s\n", dir); bfd= BLO_read_from_file(dir, reports); @@ -457,7 +457,7 @@ static int read_undosave(bContext *C, UndoElem *uel) success= BKE_read_file_from_memfile(C, &uel->memfile, NULL); /* restore */ - strcpy(G.main->name, mainstr); /* restore */ + BLI_strncpy(G.main->name, mainstr, sizeof(G.main->name)); /* restore */ G.fileflags= fileflags; if(success) { @@ -520,12 +520,12 @@ void BKE_write_undo(bContext *C, const char *name) counter++; counter= counter % U.undosteps; - sprintf(numstr, "%d.blend", counter); + BLI_snprintf(numstr, sizeof(numstr), "%d.blend", counter); BLI_make_file_string("/", tstr, btempdir, numstr); success= BLO_write_file(CTX_data_main(C), tstr, G.fileflags, NULL, NULL); - strcpy(curundo->str, tstr); + BLI_strncpy(curundo->str, tstr, sizeof(curundo->str)); } else { MemFile *prevfile=NULL; diff --git a/source/blender/blenkernel/intern/bmfont.c b/source/blender/blenkernel/intern/bmfont.c index e2a6c04450b..aa0669903c5 100644 --- a/source/blender/blenkernel/intern/bmfont.c +++ b/source/blender/blenkernel/intern/bmfont.c @@ -54,6 +54,7 @@ #include "BKE_global.h" #include "IMB_imbuf_types.h" +#include "BKE_bmfont.h" #include "BKE_bmfont_types.h" void printfGlyph(bmGlyph * glyph) diff --git a/source/blender/blenkernel/intern/boids.c b/source/blender/blenkernel/intern/boids.c index 228827bab68..ae4882b0eca 100644 --- a/source/blender/blenkernel/intern/boids.c +++ b/source/blender/blenkernel/intern/boids.c @@ -1470,7 +1470,7 @@ BoidRule *boid_new_rule(int type) rule->type = type; rule->flag |= BOIDRULE_IN_AIR|BOIDRULE_ON_LAND; - strcpy(rule->name, boidrule_type_items[type-1].name); + BLI_strncpy(rule->name, boidrule_type_items[type-1].name, sizeof(rule->name)); return rule; } diff --git a/source/blender/blenkernel/intern/brush.c b/source/blender/blenkernel/intern/brush.c index b1931ebe0a7..4ad3b8bb3cf 100644 --- a/source/blender/blenkernel/intern/brush.c +++ b/source/blender/blenkernel/intern/brush.c @@ -186,13 +186,13 @@ void make_local_brush(Brush *brush) Scene *scene; int local= 0, lib= 0; - if(brush->id.lib==0) return; + if(brush->id.lib==NULL) return; if(brush->clone.image) { /* special case: ima always local immediately */ - brush->clone.image->id.lib= 0; + brush->clone.image->id.lib= NULL; brush->clone.image->id.flag= LIB_LOCAL; - new_id(0, (ID *)brush->clone.image, 0); + new_id(NULL, (ID *)brush->clone.image, NULL); } for(scene= G.main->scene.first; scene; scene=scene->id.next) @@ -202,9 +202,9 @@ void make_local_brush(Brush *brush) } if(local && lib==0) { - brush->id.lib= 0; + brush->id.lib= NULL; brush->id.flag= LIB_LOCAL; - new_id(0, (ID *)brush, 0); + new_id(NULL, (ID *)brush, NULL); /* enable fake user by default */ if (!(brush->id.flag & LIB_FAKEUSER)) { @@ -219,7 +219,7 @@ void make_local_brush(Brush *brush) for(scene= G.main->scene.first; scene; scene=scene->id.next) if(paint_brush(&scene->toolsettings->imapaint.paint)==brush) - if(scene->id.lib==0) { + if(scene->id.lib==NULL) { paint_brush_set(&scene->toolsettings->imapaint.paint, brushn); brushn->id.us++; brush->id.us--; @@ -227,10 +227,10 @@ void make_local_brush(Brush *brush) } } -void brush_debug_print_state(Brush *br) +static void brush_debug_print_state(Brush *br) { /* create a fake brush and set it to the defaults */ - Brush def= {{0}}; + Brush def= {{NULL}}; brush_set_defaults(&def); #define BR_TEST(field, t) \ @@ -424,7 +424,7 @@ int brush_texture_set_nr(Brush *brush, int nr) id= (ID *)brush->mtex.tex; idtest= (ID*)BLI_findlink(&G.main->tex, nr-1); - if(idtest==0) { /* new tex */ + if(idtest==NULL) { /* new tex */ if(id) idtest= (ID *)copy_texture((Tex *)id); else idtest= (ID *)add_texture("Tex"); idtest->us--; diff --git a/source/blender/blenkernel/intern/cdderivedmesh.c b/source/blender/blenkernel/intern/cdderivedmesh.c index 932be711938..abf2257877b 100644 --- a/source/blender/blenkernel/intern/cdderivedmesh.c +++ b/source/blender/blenkernel/intern/cdderivedmesh.c @@ -729,7 +729,7 @@ static void cdDM_drawFacesTex_common(DerivedMesh *dm, GPU_vertex_setup( dm ); GPU_normal_setup( dm ); GPU_uv_setup( dm ); - if( col != 0 ) { + if( col != NULL ) { /*if( realcol && dm->drawObject->colType == CD_TEXTURE_MCOL ) { col = 0; } else if( mcol && dm->drawObject->colType == CD_MCOL ) { @@ -983,7 +983,7 @@ static void cdDM_drawMappedFacesGLSL(DerivedMesh *dm, int (*setMaterial)(int, vo glShadeModel(GL_SMOOTH); - if( GPU_buffer_legacy(dm) || setDrawOptions != 0 ) { + if( GPU_buffer_legacy(dm) || setDrawOptions != NULL ) { DEBUG_VBO( "Using legacy code. cdDM_drawMappedFacesGLSL\n" ); memset(&attribs, 0, sizeof(attribs)); @@ -1086,8 +1086,8 @@ static void cdDM_drawMappedFacesGLSL(DerivedMesh *dm, int (*setMaterial)(int, vo glEnd(); } else { - GPUBuffer *buffer = 0; - char *varray = 0; + GPUBuffer *buffer = NULL; + char *varray = NULL; int numdata = 0, elementsize = 0, offset; int start = 0, numfaces = 0, prevdraw = 0, curface = 0; int i; @@ -1124,9 +1124,9 @@ static void cdDM_drawMappedFacesGLSL(DerivedMesh *dm, int (*setMaterial)(int, vo if( numdata != 0 ) { - GPU_buffer_free(buffer,0); + GPU_buffer_free(buffer, NULL); - buffer = 0; + buffer = NULL; } } @@ -1164,16 +1164,16 @@ static void cdDM_drawMappedFacesGLSL(DerivedMesh *dm, int (*setMaterial)(int, vo } if( numdata != 0 ) { elementsize = GPU_attrib_element_size( datatypes, numdata ); - buffer = GPU_buffer_alloc( elementsize*dm->drawObject->nelements, 0 ); - if( buffer == 0 ) { + buffer = GPU_buffer_alloc( elementsize*dm->drawObject->nelements, NULL ); + if( buffer == NULL ) { GPU_buffer_unbind(); dm->drawObject->legacy = 1; return; } varray = GPU_buffer_lock_stream(buffer); - if( varray == 0 ) { + if( varray == NULL ) { GPU_buffer_unbind(); - GPU_buffer_free(buffer, 0); + GPU_buffer_free(buffer, NULL); dm->drawObject->legacy = 1; return; } @@ -1312,7 +1312,7 @@ static void cdDM_drawMappedFacesGLSL(DerivedMesh *dm, int (*setMaterial)(int, vo } GPU_buffer_unbind(); } - GPU_buffer_free( buffer, 0 ); + GPU_buffer_free( buffer, NULL ); } glShadeModel(GL_FLAT); @@ -1604,7 +1604,6 @@ DerivedMesh *CDDM_from_editmesh(EditMesh *em, Mesh *UNUSED(me)) mv->no[2] = eve->no[2] * 32767.0; mv->bweight = (unsigned char) (eve->bweight * 255.0f); - mv->mat_nr = 0; mv->flag = 0; *index = i; diff --git a/source/blender/blenkernel/intern/collision.c b/source/blender/blenkernel/intern/collision.c index 8cdfd60b9a7..02b3de83ee1 100644 --- a/source/blender/blenkernel/intern/collision.c +++ b/source/blender/blenkernel/intern/collision.c @@ -164,8 +164,8 @@ Collision modifier code end */ #define mySWAP(a,b) do { double tmp = b ; b = a ; a = tmp ; } while(0) - -int +#if 0 /* UNUSED */ +static int gsl_poly_solve_cubic (double a, double b, double c, double *x0, double *x1, double *x2) { @@ -255,7 +255,7 @@ gsl_poly_solve_cubic (double a, double b, double c, * * copied from GSL */ -int +static int gsl_poly_solve_quadratic (double a, double b, double c, double *x0, double *x1) { @@ -313,7 +313,7 @@ gsl_poly_solve_quadratic (double a, double b, double c, return 0; } } - +#endif /* UNUSED */ diff --git a/source/blender/blenkernel/intern/constraint.c b/source/blender/blenkernel/intern/constraint.c index c61f3ba3683..b3f83019ff1 100644 --- a/source/blender/blenkernel/intern/constraint.c +++ b/source/blender/blenkernel/intern/constraint.c @@ -419,7 +419,7 @@ void constraint_mat_convertspace (Object *ob, bPoseChannel *pchan, float mat[][4 /* ------------ General Target Matrix Tools ---------- */ /* function that sets the given matrix based on given vertex group in mesh */ -static void contarget_get_mesh_mat (Scene *scene, Object *ob, char *substring, float mat[][4]) +static void contarget_get_mesh_mat (Scene *scene, Object *ob, const char *substring, float mat[][4]) { DerivedMesh *dm = NULL; Mesh *me= ob->data; @@ -524,7 +524,7 @@ static void contarget_get_mesh_mat (Scene *scene, Object *ob, char *substring, f } /* function that sets the given matrix based on given vertex group in lattice */ -static void contarget_get_lattice_mat (Object *ob, char *substring, float mat[][4]) +static void contarget_get_lattice_mat (Object *ob, const char *substring, float mat[][4]) { Lattice *lt= (Lattice *)ob->data; @@ -582,7 +582,7 @@ static void contarget_get_lattice_mat (Object *ob, char *substring, float mat[][ /* generic function to get the appropriate matrix for most target cases */ /* The cases where the target can be object data have not been implemented */ -static void constraint_target_to_mat4 (Scene *scene, Object *ob, char *substring, float mat[][4], short from, short to, float headtail) +static void constraint_target_to_mat4 (Scene *scene, Object *ob, const char *substring, float mat[][4], short from, short to, float headtail) { /* Case OBJECT */ if (!strlen(substring)) { @@ -752,7 +752,7 @@ static void default_get_tarmat (bConstraint *con, bConstraintOb *cob, bConstrain bConstraintTarget *ctn = ct->next; \ if (nocopy == 0) { \ datatar= ct->tar; \ - strcpy(datasubtarget, ct->subtarget); \ + BLI_strncpy(datasubtarget, ct->subtarget, sizeof(datasubtarget)); \ con->tarspace= (char)ct->space; \ } \ \ @@ -834,54 +834,71 @@ static void childof_evaluate (bConstraint *con, bConstraintOb *cob, ListBase *ta /* only evaluate if there is a target */ if (VALID_CONS_TARGET(ct)) { - float parmat[4][4], invmat[4][4], tempmat[4][4]; - float loc[3], eul[3], size[3]; - float loco[3], eulo[3], sizo[3]; - - /* get offset (parent-inverse) matrix */ - copy_m4_m4(invmat, data->invmat); - - /* extract components of both matrices */ - copy_v3_v3(loc, ct->matrix[3]); - mat4_to_eulO(eul, ct->rotOrder, ct->matrix); - mat4_to_size(size, ct->matrix); + float parmat[4][4]; - copy_v3_v3(loco, invmat[3]); - mat4_to_eulO(eulo, cob->rotOrder, invmat); - mat4_to_size(sizo, invmat); - - /* disable channels not enabled */ - if (!(data->flag & CHILDOF_LOCX)) loc[0]= loco[0]= 0.0f; - if (!(data->flag & CHILDOF_LOCY)) loc[1]= loco[1]= 0.0f; - if (!(data->flag & CHILDOF_LOCZ)) loc[2]= loco[2]= 0.0f; - if (!(data->flag & CHILDOF_ROTX)) eul[0]= eulo[0]= 0.0f; - if (!(data->flag & CHILDOF_ROTY)) eul[1]= eulo[1]= 0.0f; - if (!(data->flag & CHILDOF_ROTZ)) eul[2]= eulo[2]= 0.0f; - if (!(data->flag & CHILDOF_SIZEX)) size[0]= sizo[0]= 1.0f; - if (!(data->flag & CHILDOF_SIZEY)) size[1]= sizo[1]= 1.0f; - if (!(data->flag & CHILDOF_SIZEZ)) size[2]= sizo[2]= 1.0f; - - /* make new target mat and offset mat */ - loc_eulO_size_to_mat4(ct->matrix, loc, eul, size, ct->rotOrder); - loc_eulO_size_to_mat4(invmat, loco, eulo, sizo, cob->rotOrder); - - /* multiply target (parent matrix) by offset (parent inverse) to get - * the effect of the parent that will be exherted on the owner - */ - mul_m4_m4m4(parmat, invmat, ct->matrix); - - /* now multiply the parent matrix by the owner matrix to get the - * the effect of this constraint (i.e. owner is 'parented' to parent) - */ - copy_m4_m4(tempmat, cob->matrix); - mul_m4_m4m4(cob->matrix, tempmat, parmat); - - /* without this, changes to scale and rotation can change location - * of a parentless bone or a disconnected bone. Even though its set - * to zero above. */ - if (!(data->flag & CHILDOF_LOCX)) cob->matrix[3][0]= tempmat[3][0]; - if (!(data->flag & CHILDOF_LOCY)) cob->matrix[3][1]= tempmat[3][1]; - if (!(data->flag & CHILDOF_LOCZ)) cob->matrix[3][2]= tempmat[3][2]; + /* simple matrix parenting */ + if(data->flag == CHILDOF_ALL) { + + /* multiply target (parent matrix) by offset (parent inverse) to get + * the effect of the parent that will be exherted on the owner + */ + mul_m4_m4m4(parmat, data->invmat, ct->matrix); + + /* now multiply the parent matrix by the owner matrix to get the + * the effect of this constraint (i.e. owner is 'parented' to parent) + */ + mul_m4_m4m4(cob->matrix, cob->matrix, parmat); + } + else { + float invmat[4][4], tempmat[4][4]; + float loc[3], eul[3], size[3]; + float loco[3], eulo[3], sizo[3]; + + /* get offset (parent-inverse) matrix */ + copy_m4_m4(invmat, data->invmat); + + /* extract components of both matrices */ + copy_v3_v3(loc, ct->matrix[3]); + mat4_to_eulO(eul, ct->rotOrder, ct->matrix); + mat4_to_size(size, ct->matrix); + + copy_v3_v3(loco, invmat[3]); + mat4_to_eulO(eulo, cob->rotOrder, invmat); + mat4_to_size(sizo, invmat); + + /* disable channels not enabled */ + if (!(data->flag & CHILDOF_LOCX)) loc[0]= loco[0]= 0.0f; + if (!(data->flag & CHILDOF_LOCY)) loc[1]= loco[1]= 0.0f; + if (!(data->flag & CHILDOF_LOCZ)) loc[2]= loco[2]= 0.0f; + if (!(data->flag & CHILDOF_ROTX)) eul[0]= eulo[0]= 0.0f; + if (!(data->flag & CHILDOF_ROTY)) eul[1]= eulo[1]= 0.0f; + if (!(data->flag & CHILDOF_ROTZ)) eul[2]= eulo[2]= 0.0f; + if (!(data->flag & CHILDOF_SIZEX)) size[0]= sizo[0]= 1.0f; + if (!(data->flag & CHILDOF_SIZEY)) size[1]= sizo[1]= 1.0f; + if (!(data->flag & CHILDOF_SIZEZ)) size[2]= sizo[2]= 1.0f; + + /* make new target mat and offset mat */ + loc_eulO_size_to_mat4(ct->matrix, loc, eul, size, ct->rotOrder); + loc_eulO_size_to_mat4(invmat, loco, eulo, sizo, cob->rotOrder); + + /* multiply target (parent matrix) by offset (parent inverse) to get + * the effect of the parent that will be exherted on the owner + */ + mul_m4_m4m4(parmat, invmat, ct->matrix); + + /* now multiply the parent matrix by the owner matrix to get the + * the effect of this constraint (i.e. owner is 'parented' to parent) + */ + copy_m4_m4(tempmat, cob->matrix); + mul_m4_m4m4(cob->matrix, tempmat, parmat); + + /* without this, changes to scale and rotation can change location + * of a parentless bone or a disconnected bone. Even though its set + * to zero above. */ + if (!(data->flag & CHILDOF_LOCX)) cob->matrix[3][0]= tempmat[3][0]; + if (!(data->flag & CHILDOF_LOCY)) cob->matrix[3][1]= tempmat[3][1]; + if (!(data->flag & CHILDOF_LOCZ)) cob->matrix[3][2]= tempmat[3][2]; + } } } @@ -3452,7 +3469,7 @@ static void shrinkwrap_get_tarmat (bConstraint *con, bConstraintOb *cob, bConstr BVHTreeRayHit hit; BVHTreeNearest nearest; - BVHTreeFromMesh treeData= {0}; + BVHTreeFromMesh treeData= {NULL}; nearest.index = -1; nearest.dist = FLT_MAX; @@ -4131,6 +4148,21 @@ static bConstraint *add_new_constraint (Object *ob, bPoseChannel *pchan, const c constraints_set_active(list, con); } + /* set type+owner specific immutable settings */ + // TODO: does action constraint need anything here - i.e. spaceonce? + switch (type) { + case CONSTRAINT_TYPE_CHILDOF: + { + /* if this constraint is being added to a posechannel, make sure + * the constraint gets evaluated in pose-space */ + if (pchan) { + con->ownspace = CONSTRAINT_SPACE_POSE; + con->flag |= CONSTRAINT_SPACEONCE; + } + } + break; + } + return con; } diff --git a/source/blender/blenkernel/intern/context.c b/source/blender/blenkernel/intern/context.c index 09321ddea81..58a7944f78b 100644 --- a/source/blender/blenkernel/intern/context.c +++ b/source/blender/blenkernel/intern/context.c @@ -85,7 +85,7 @@ struct bContext { /* context */ -bContext *CTX_create() +bContext *CTX_create(void) { bContext *C; @@ -788,7 +788,7 @@ static const char *data_mode_strings[] = { "texturepaint", "particlemode", "objectmode", - 0 + NULL }; const char *CTX_data_mode_string(const bContext *C) { diff --git a/source/blender/blenkernel/intern/curve.c b/source/blender/blenkernel/intern/curve.c index 2678b077b66..5dc62f2c7af 100644 --- a/source/blender/blenkernel/intern/curve.c +++ b/source/blender/blenkernel/intern/curve.c @@ -174,7 +174,7 @@ Curve *copy_curve(Curve *cu) int a; cun= copy_libblock(cu); - cun->nurb.first= cun->nurb.last= 0; + cun->nurb.first= cun->nurb.last= NULL; duplicateNurblist( &(cun->nurb), &(cu->nurb)); cun->mat= MEM_dupallocN(cu->mat); @@ -190,9 +190,9 @@ Curve *copy_curve(Curve *cu) cun->key= copy_key(cu->key); if(cun->key) cun->key->from= (ID *)cun; - cun->disp.first= cun->disp.last= 0; - cun->bev.first= cun->bev.last= 0; - cun->path= 0; + cun->disp.first= cun->disp.last= NULL; + cun->bev.first= cun->bev.last= NULL; + cun->path= NULL; cun->editnurb= NULL; cun->editfont= NULL; @@ -212,7 +212,7 @@ Curve *copy_curve(Curve *cu) void make_local_curve(Curve *cu) { - Object *ob = 0; + Object *ob = NULL; Curve *cun; int local=0, lib=0; @@ -221,7 +221,7 @@ void make_local_curve(Curve *cu) * - mixed: do a copy */ - if(cu->id.lib==0) return; + if(cu->id.lib==NULL) return; if(cu->vfont) cu->vfont->id.lib= NULL; if(cu->vfontb) cu->vfontb->id.lib= NULL; @@ -229,9 +229,9 @@ void make_local_curve(Curve *cu) if(cu->vfontbi) cu->vfontbi->id.lib= NULL; if(cu->id.us==1) { - cu->id.lib= 0; + cu->id.lib= NULL; cu->id.flag= LIB_LOCAL; - new_id(0, (ID *)cu, 0); + new_id(NULL, (ID *)cu, NULL); return; } @@ -245,9 +245,9 @@ void make_local_curve(Curve *cu) } if(local && lib==0) { - cu->id.lib= 0; + cu->id.lib= NULL; cu->id.flag= LIB_LOCAL; - new_id(0, (ID *)cu, 0); + new_id(NULL, (ID *)cu, NULL); } else if(local && lib) { cun= copy_curve(cu); @@ -257,7 +257,7 @@ void make_local_curve(Curve *cu) while(ob) { if(ob->data==cu) { - if(ob->id.lib==0) { + if(ob->id.lib==NULL) { ob->data= cun; cun->id.us++; cu->id.us--; @@ -381,12 +381,12 @@ int count_curveverts_without_handles(ListBase *nurb) void freeNurb(Nurb *nu) { - if(nu==0) return; + if(nu==NULL) return; if(nu->bezt) MEM_freeN(nu->bezt); - nu->bezt= 0; + nu->bezt= NULL; if(nu->bp) MEM_freeN(nu->bp); - nu->bp= 0; + nu->bp= NULL; if(nu->knotsu) MEM_freeN(nu->knotsu); nu->knotsu= NULL; if(nu->knotsv) MEM_freeN(nu->knotsv); @@ -402,7 +402,7 @@ void freeNurblist(ListBase *lb) { Nurb *nu, *next; - if(lb==0) return; + if(lb==NULL) return; nu= lb->first; while(nu) { @@ -410,7 +410,7 @@ void freeNurblist(ListBase *lb) freeNurb(nu); nu= next; } - lb->first= lb->last= 0; + lb->first= lb->last= NULL; } Nurb *duplicateNurb(Nurb *nu) @@ -419,7 +419,7 @@ Nurb *duplicateNurb(Nurb *nu) int len; newnu= (Nurb*)MEM_mallocN(sizeof(Nurb),"duplicateNurb"); - if(newnu==0) return 0; + if(newnu==NULL) return NULL; memcpy(newnu, nu, sizeof(Nurb)); if(nu->bezt) { @@ -615,7 +615,7 @@ static void makecyclicknots(float *knots, short pnts, short order) { int a, b, order2, c; - if(knots==0) return; + if(knots==NULL) return; order2=order-1; @@ -918,7 +918,7 @@ void makeNurbcurve(Nurb *nu, float *coord_array, float *tilt_array, float *radiu if(nu->knotsu==NULL) return; if(nu->orderu>nu->pntsu) return; - if(coord_array==0) return; + if(coord_array==NULL) return; /* allocate and initialize */ len= nu->pntsu; @@ -1269,7 +1269,7 @@ void makebevelcurve(Scene *scene, Object *ob, ListBase *disp, int forRender) dl= bevdisp.first; } else { dl= cu->bevobj->disp.first; - if(dl==0) { + if(dl==NULL) { makeDispListCurveTypes(scene, cu->bevobj, 0); dl= cu->bevobj->disp.first; } @@ -1811,8 +1811,6 @@ static void make_bevel_list_3D_minimum_twist(BevList *bl) int nr; float q[4]; - float cross_tmp[3]; - bevel_list_calc_bisect(bl); bevp2= (BevPoint *)(bl+1); @@ -1829,6 +1827,7 @@ static void make_bevel_list_3D_minimum_twist(BevList *bl) float angle= angle_normalized_v3v3(bevp0->dir, bevp1->dir); if(angle > 0.0f) { /* otherwise we can keep as is */ + float cross_tmp[3]; cross_v3_v3v3(cross_tmp, bevp0->dir, bevp1->dir); axis_angle_to_quat(q, cross_tmp, angle); mul_qt_qtqt(bevp1->quat, q, bevp0->quat); @@ -2426,7 +2425,7 @@ void calchandleNurb(BezTriple *bezt, BezTriple *prev, BezTriple *next, int mode) p2= bezt->vec[1]; - if(prev==0) { + if(prev==NULL) { p3= next->vec[1]; pt[0]= 2*p2[0]- p3[0]; pt[1]= 2*p2[1]- p3[1]; @@ -2435,7 +2434,7 @@ void calchandleNurb(BezTriple *bezt, BezTriple *prev, BezTriple *next, int mode) } else p1= prev->vec[1]; - if(next==0) { + if(next==NULL) { pt[0]= 2*p2[0]- p1[0]; pt[1]= 2*p2[1]- p1[1]; pt[2]= 2*p2[2]- p1[2]; @@ -2616,7 +2615,7 @@ void calchandlesNurb(Nurb *nu) /* first, if needed, set handle flags */ a= nu->pntsu; bezt= nu->bezt; if(nu->flagu & CU_NURB_CYCLIC) prev= bezt+(a-1); - else prev= 0; + else prev= NULL; next= bezt+1; while(a--) { @@ -2624,7 +2623,7 @@ void calchandlesNurb(Nurb *nu) /* first, if needed, set handle flags */ prev= bezt; if(a==1) { if(nu->flagu & CU_NURB_CYCLIC) next= nu->bezt; - else next= 0; + else next= NULL; } else next++; @@ -2683,7 +2682,7 @@ void autocalchandlesNurb(Nurb *nu, int flag) BezTriple *bezt2, *bezt1, *bezt0; int i, align, leftsmall, rightsmall; - if(nu==0 || nu->bezt==0) return; + if(nu==NULL || nu->bezt==NULL) return; bezt2 = nu->bezt; bezt1 = bezt2 + (nu->pntsu-1); diff --git a/source/blender/blenkernel/intern/customdata.c b/source/blender/blenkernel/intern/customdata.c index 94bb771aecd..7788f9f28a2 100644 --- a/source/blender/blenkernel/intern/customdata.c +++ b/source/blender/blenkernel/intern/customdata.c @@ -469,19 +469,19 @@ static void layerInterp_mdisps(void **sources, float *UNUSED(weights), vindex[x] = y; for(i = 0; i < 2; i++) { - float sw[4][4] = {{0}}; + float sw_m4[4][4] = {{0}}; int a = 7 & ~(1 << vindex[i*2] | 1 << vindex[i*2+1]); - sw[0][vindex[i*2+1]] = 1; - sw[1][vindex[i*2]] = 1; + sw_m4[0][vindex[i*2+1]] = 1; + sw_m4[1][vindex[i*2]] = 1; for(x = 0; x < 3; x++) if(a & (1 << x)) - sw[2][x] = 1; + sw_m4[2][x] = 1; tris[i] = *((MDisps*)sources[i]); tris[i].disps = MEM_dupallocN(tris[i].disps); - layerInterp_mdisps(&sources[i], NULL, (float*)sw, 1, &tris[i]); + layerInterp_mdisps(&sources[i], NULL, (float*)sw_m4, 1, &tris[i]); } mdisp_join_tris(d, &tris[0], &tris[1]); @@ -524,8 +524,8 @@ static void layerInterp_mdisps(void **sources, float *UNUSED(weights), mdisp_apply_weight(S, dst_corners, side-1, 0, st, crn_weight, &axis_x[0], &axis_x[1]); mdisp_apply_weight(S, dst_corners, 0, side-1, st, crn_weight, &axis_y[0], &axis_y[1]); - sub_v3_v3(axis_x, base); - sub_v3_v3(axis_y, base); + sub_v2_v2(axis_x, base); + sub_v2_v2(axis_y, base); normalize_v2(axis_x); normalize_v2(axis_y); @@ -803,7 +803,7 @@ static void layerDefault_mcol(void *data, int count) -const LayerTypeInfo LAYERTYPEINFO[CD_NUMTYPES] = { +static const LayerTypeInfo LAYERTYPEINFO[CD_NUMTYPES] = { {sizeof(MVert), "MVert", 1, NULL, NULL, NULL, NULL, NULL, NULL}, {sizeof(MSticky), "MSticky", 1, NULL, NULL, NULL, layerInterp_msticky, NULL, NULL}, @@ -842,7 +842,7 @@ const LayerTypeInfo LAYERTYPEINFO[CD_NUMTYPES] = { {sizeof(float)*3, "", 0, NULL, NULL, NULL, NULL, NULL, NULL} }; -const char *LAYERTYPENAMES[CD_NUMTYPES] = { +static const char *LAYERTYPENAMES[CD_NUMTYPES] = { /* 0-4 */ "CDMVert", "CDMSticky", "CDMDeformVert", "CDMEdge", "CDMFace", /* 5-9 */ "CDMTFace", "CDMCol", "CDOrigIndex", "CDNormal", "CDFlags", /* 10-14 */ "CDMFloatProperty", "CDMIntProperty","CDMStringProperty", "CDOrigSpace", "CDOrco", diff --git a/source/blender/blenkernel/intern/deform.c b/source/blender/blenkernel/intern/deform.c index 937681fcdc3..7967013c2d4 100644 --- a/source/blender/blenkernel/intern/deform.c +++ b/source/blender/blenkernel/intern/deform.c @@ -50,7 +50,7 @@ void defgroup_copy_list (ListBase *outbase, ListBase *inbase) { bDeformGroup *defgroup, *defgroupn; - outbase->first= outbase->last= 0; + outbase->first= outbase->last= NULL; for (defgroup = inbase->first; defgroup; defgroup=defgroup->next){ defgroupn= defgroup_duplicate(defgroup); @@ -335,33 +335,34 @@ void defgroup_unique_name (bDeformGroup *dg, Object *ob) } /* finds the best possible flipped name. For renaming; check for unique names afterwards */ -/* if strip_number: removes number extensions */ -void flip_side_name (char *name, const char *from_name, int strip_number) +/* if strip_number: removes number extensions + * note: dont use sizeof() for 'name' or 'from_name' */ +void flip_side_name (char name[MAX_VGROUP_NAME], const char from_name[MAX_VGROUP_NAME], int strip_number) { int len; - char prefix[sizeof(((bDeformGroup *)NULL)->name)]= {""}; /* The part before the facing */ - char suffix[sizeof(((bDeformGroup *)NULL)->name)]= {""}; /* The part after the facing */ - char replace[sizeof(((bDeformGroup *)NULL)->name)]= {""}; /* The replacement string */ - char number[sizeof(((bDeformGroup *)NULL)->name)]= {""}; /* The number extension string */ + char prefix[MAX_VGROUP_NAME]= ""; /* The part before the facing */ + char suffix[MAX_VGROUP_NAME]= ""; /* The part after the facing */ + char replace[MAX_VGROUP_NAME]= ""; /* The replacement string */ + char number[MAX_VGROUP_NAME]= ""; /* The number extension string */ char *index=NULL; - len= strlen(from_name); + len= BLI_strnlen(from_name, MAX_VGROUP_NAME); if(len<3) return; // we don't do names like .R or .L - strcpy(name, from_name); + BLI_strncpy(name, from_name, MAX_VGROUP_NAME); /* We first check the case with a .### extension, let's find the last period */ if(isdigit(name[len-1])) { index= strrchr(name, '.'); // last occurrence if (index && isdigit(index[1]) ) { // doesnt handle case bone.1abc2 correct..., whatever! if(strip_number==0) - strcpy(number, index); + BLI_strncpy(number, index, sizeof(number)); *index= 0; - len= strlen(name); + len= BLI_strnlen(name, MAX_VGROUP_NAME); } } - strcpy (prefix, name); + BLI_strncpy(prefix, name, sizeof(prefix)); #define IS_SEPARATOR(a) ((a)=='.' || (a)==' ' || (a)=='-' || (a)=='_') @@ -445,7 +446,7 @@ void flip_side_name (char *name, const char *from_name, int strip_number) #undef IS_SEPARATOR - sprintf (name, "%s%s%s%s", prefix, replace, suffix, number); + BLI_snprintf (name, MAX_VGROUP_NAME, "%s%s%s%s", prefix, replace, suffix, number); } float defvert_find_weight(const struct MDeformVert *dvert, const int group_num) diff --git a/source/blender/blenkernel/intern/depsgraph.c b/source/blender/blenkernel/intern/depsgraph.c index cedf4e93247..d102a83d69f 100644 --- a/source/blender/blenkernel/intern/depsgraph.c +++ b/source/blender/blenkernel/intern/depsgraph.c @@ -40,7 +40,9 @@ #include "DNA_group_types.h" #include "DNA_lattice_types.h" #include "DNA_key_types.h" +#include "DNA_material_types.h" #include "DNA_mesh_types.h" +#include "DNA_node_types.h" #include "DNA_scene_types.h" #include "DNA_screen_types.h" #include "DNA_windowmanager_types.h" @@ -54,6 +56,7 @@ #include "BKE_key.h" #include "BKE_library.h" #include "BKE_main.h" +#include "BKE_node.h" #include "BKE_mball.h" #include "BKE_modifier.h" #include "BKE_object.h" @@ -275,7 +278,7 @@ int queue_count(struct DagNodeQueue *queue){ } -DagForest * dag_init() +DagForest *dag_init(void) { DagForest *forest; /* use callocN to init all zero */ @@ -1077,7 +1080,7 @@ void graph_bfs(void) minheight = pos[node->BFS_dist]; itA = node->child; while(itA != NULL) { - if((itA->node->color == DAG_WHITE) ) { + if(itA->node->color == DAG_WHITE) { itA->node->color = DAG_GRAY; itA->node->BFS_dist = node->BFS_dist + 1; itA->node->k = (float) minheight; @@ -1224,7 +1227,7 @@ DagNodeQueue * graph_dfs(void) itA = node->child; while(itA != NULL) { - if((itA->node->color == DAG_WHITE) ) { + if(itA->node->color == DAG_WHITE) { itA->node->DFS_dvtm = time; itA->node->color = DAG_GRAY; @@ -1478,7 +1481,7 @@ struct DagNodeQueue *get_all_childs(struct DagForest *dag, void *ob) itA = node->child; while(itA != NULL) { - if((itA->node->color == DAG_WHITE) ) { + if(itA->node->color == DAG_WHITE) { itA->node->DFS_dvtm = time; itA->node->color = DAG_GRAY; @@ -1512,7 +1515,7 @@ short are_obs_related(struct DagForest *dag, void *ob1, void *ob2) { itA = node->child; while(itA != NULL) { - if((itA->node->ob == ob2) ) { + if(itA->node->ob == ob2) { return itA->node->type; } itA = itA->next; @@ -1684,7 +1687,7 @@ void DAG_scene_sort(Main *bmain, Scene *sce) itA = node->child; while(itA != NULL) { - if((itA->node->color == DAG_WHITE) ) { + if(itA->node->color == DAG_WHITE) { itA->node->DFS_dvtm = time; itA->node->color = DAG_GRAY; @@ -1923,6 +1926,28 @@ static void dag_scene_flush_layers(Scene *sce, int lay) flush_layer_node(sce, itA->node, lasttime); } +static void dag_tag_renderlayers(Scene *sce, unsigned int lay) +{ + if(sce->nodetree) { + bNode *node; + Base *base; + unsigned int lay_changed= 0; + + for(base= sce->base.first; base; base= base->next) + if(base->lay & lay) + if(base->object->recalc) + lay_changed |= base->lay; + + for(node= sce->nodetree->nodes.first; node; node= node->next) { + if(node->id==(ID *)sce) { + SceneRenderLayer *srl= BLI_findlink(&sce->r.layers, node->custom1); + if(srl && (srl->lay & lay_changed)) + NodeTagChanged(sce->nodetree, node); + } + } + } +} + /* flushes all recalc flags in objects down the dependency tree */ void DAG_scene_flush_update(Main *bmain, Scene *sce, unsigned int lay, const short time) { @@ -1967,6 +1992,8 @@ void DAG_scene_flush_update(Main *bmain, Scene *sce, unsigned int lay, const sho } } } + + dag_tag_renderlayers(sce, lay); } static int object_modifiers_use_time(Object *ob) @@ -2349,6 +2376,29 @@ static void dag_id_flush_update(Scene *sce, ID *id) modifiers_foreachIDLink(obt, dag_id_flush_update__isDependentTexture, &data); if (data.is_dependent) obt->recalc |= OB_RECALC_DATA; + + /* particle settings can use the texture as well */ + if(obt->particlesystem.first) { + ParticleSystem *psys = obt->particlesystem.first; + MTex **mtexp, *mtex; + int a; + for(; psys; psys=psys->next) { + mtexp = psys->part->mtex; + for(a=0; a<MAX_MTEX; a++, mtexp++) { + mtex = *mtexp; + if(mtex && mtex->tex == (Tex*)id) { + obt->recalc |= OB_RECALC_DATA; + + if(mtex->mapto & PAMAP_INIT) + psys->recalc |= PSYS_RECALC_RESET; + if(mtex->mapto & PAMAP_CHILD) + psys->recalc |= PSYS_RECALC_CHILD; + + BKE_ptcache_object_reset(sce, obt, PTCACHE_RESET_DEPSGRAPH); + } + } + } + } } } @@ -2596,7 +2646,7 @@ void DAG_pose_sort(Object *ob) itA = node->child; while(itA != NULL) { - if((itA->node->color == DAG_WHITE) ) { + if(itA->node->color == DAG_WHITE) { itA->node->color = DAG_GRAY; push_stack(nqueue,itA->node); skip = 1; diff --git a/source/blender/blenkernel/intern/displist.c b/source/blender/blenkernel/intern/displist.c index 3bb62f817cd..837c3bd8356 100644 --- a/source/blender/blenkernel/intern/displist.c +++ b/source/blender/blenkernel/intern/displist.c @@ -121,7 +121,7 @@ DispList *find_displist(ListBase *lb, int type) dl= dl->next; } - return 0; + return NULL; } int displist_has_faces(ListBase *lb) @@ -930,13 +930,13 @@ void filldisplist(ListBase *dispbase, ListBase *to, int flipnormal) { EditVert *eve, *v1, *vlast; EditFace *efa; - DispList *dlnew=0, *dl; + DispList *dlnew=NULL, *dl; float *f1; int colnr=0, charidx=0, cont=1, tot, a, *index, nextcol= 0; intptr_t totvert; - if(dispbase==0) return; - if(dispbase->first==0) return; + if(dispbase==NULL) return; + if(dispbase->first==NULL) return; while(cont) { cont= 0; @@ -953,7 +953,7 @@ void filldisplist(ListBase *dispbase, ListBase *to, int flipnormal) /* make editverts and edges */ f1= dl->verts; a= dl->nr; - eve= v1= 0; + eve= v1= NULL; while(a--) { vlast= eve; @@ -961,14 +961,14 @@ void filldisplist(ListBase *dispbase, ListBase *to, int flipnormal) eve= BLI_addfillvert(f1); totvert++; - if(vlast==0) v1= eve; + if(vlast==NULL) v1= eve; else { BLI_addfilledge(vlast, eve); } f1+=3; } - if(eve!=0 && v1!=0) { + if(eve!=NULL && v1!=NULL) { BLI_addfilledge(eve, v1); } } else if (colnr<dl->col) { @@ -1058,7 +1058,7 @@ static void bevels_to_filledpoly(Curve *cu, ListBase *dispbase) float *fp, *fp1; int a, dpoly; - front.first= front.last= back.first= back.last= 0; + front.first= front.last= back.first= back.last= NULL; dl= dispbase->first; while(dl) { @@ -1944,7 +1944,7 @@ void imagestodisplist(void) /* this is confusing, there's also min_max_object, appplying the obmat... */ static void boundbox_displist(Object *ob) { - BoundBox *bb=0; + BoundBox *bb=NULL; float min[3], max[3]; DispList *dl; float *vert; @@ -1956,7 +1956,7 @@ static void boundbox_displist(Object *ob) Curve *cu= ob->data; int doit= 0; - if(cu->bb==0) cu->bb= MEM_callocN(sizeof(BoundBox), "boundbox"); + if(cu->bb==NULL) cu->bb= MEM_callocN(sizeof(BoundBox), "boundbox"); bb= cu->bb; dl= ob->disp.first; diff --git a/source/blender/blenkernel/intern/effect.c b/source/blender/blenkernel/intern/effect.c index a79a5fddf00..ddfc58b7491 100644 --- a/source/blender/blenkernel/intern/effect.c +++ b/source/blender/blenkernel/intern/effect.c @@ -166,7 +166,7 @@ PartEff *give_parteff(Object *ob) if(paf->type==EFF_PARTICLE) return paf; paf= paf->next; } - return 0; + return NULL; } void free_effect(Effect *eff) @@ -636,7 +636,7 @@ int get_effector_data(EffectorCache *eff, EffectorData *efd, EffectedPoint *poin if(eff->psys == point->psys && *efd->index == point->index) ; else { - ParticleSimulationData sim= {0}; + ParticleSimulationData sim= {NULL}; sim.scene= eff->scene; sim.ob= eff->ob; sim.psys= eff->psys; @@ -651,11 +651,15 @@ int get_effector_data(EffectorCache *eff, EffectorData *efd, EffectedPoint *poin // eff->flag |= PE_VELOCITY_TO_IMPULSE; //} - VECCOPY(efd->loc, state.co); - VECCOPY(efd->nor, state.vel); - if(real_velocity) { - VECCOPY(efd->vel, state.vel); - } + copy_v3_v3(efd->loc, state.co); + + /* rather than use the velocity use rotated x-axis (defaults to velocity) */ + efd->nor[0] = 1.f; + efd->nor[1] = efd->nor[2] = 0.f; + mul_qt_v3(state.rot, efd->nor); + + if(real_velocity) + copy_v3_v3(efd->vel, state.vel); efd->size = pa->size; } @@ -720,7 +724,7 @@ int get_effector_data(EffectorCache *eff, EffectorData *efd, EffectedPoint *poin return ret; } -static void get_effector_tot(EffectorCache *eff, EffectorData *efd, EffectedPoint *point, int *tot, int *p) +static void get_effector_tot(EffectorCache *eff, EffectorData *efd, EffectedPoint *point, int *tot, int *p, int *step) { if(eff->pd->shape == PFIELD_SHAPE_POINTS) { efd->index = p; @@ -753,6 +757,13 @@ static void get_effector_tot(EffectorCache *eff, EffectorData *efd, EffectedPoin *p= point->index % eff->psys->totpart; *tot= *p + 1; } + + if(eff->psys->part->effector_amount) { + int totpart = eff->psys->totpart; + int amount = eff->psys->part->effector_amount; + + *step = (totpart > amount) ? totpart/amount : 1; + } } else { *p = 0; @@ -770,7 +781,7 @@ static void do_texture_effector(EffectorCache *eff, EffectorData *efd, EffectedP if(!eff->pd->tex) return; - result[0].nor = result[1].nor = result[2].nor = result[3].nor = 0; + result[0].nor = result[1].nor = result[2].nor = result[3].nor = NULL; strength= eff->pd->f_strength * efd->falloff; @@ -834,7 +845,7 @@ static void do_texture_effector(EffectorCache *eff, EffectorData *efd, EffectedP add_v3_v3(total_force, force); } -void do_physical_effector(EffectorCache *eff, EffectorData *efd, EffectedPoint *point, float *total_force) +static void do_physical_effector(EffectorCache *eff, EffectorData *efd, EffectedPoint *point, float *total_force) { PartDeflect *pd = eff->pd; RNG *rng = pd->rng; @@ -990,7 +1001,7 @@ void pdDoEffectors(ListBase *effectors, ListBase *colliders, EffectorWeights *we */ EffectorCache *eff; EffectorData efd; - int p=0, tot = 1; + int p=0, tot = 1, step = 1; /* Cycle through collected objects, get total of (1/(gravity_strength * dist^gravity_power)) */ /* Check for min distance here? (yes would be cool to add that, ton) */ @@ -998,9 +1009,9 @@ void pdDoEffectors(ListBase *effectors, ListBase *colliders, EffectorWeights *we if(effectors) for(eff = effectors->first; eff; eff=eff->next) { /* object effectors were fully checked to be OK to evaluate! */ - get_effector_tot(eff, &efd, point, &tot, &p); + get_effector_tot(eff, &efd, point, &tot, &p, &step); - for(; p<tot; p++) { + for(; p<tot; p+=step) { if(get_effector_data(eff, &efd, point, 0)) { efd.falloff= effector_falloff(eff, &efd, point, weights); diff --git a/source/blender/blenkernel/intern/exotic.c b/source/blender/blenkernel/intern/exotic.c index 641313b564c..e7596001400 100644 --- a/source/blender/blenkernel/intern/exotic.c +++ b/source/blender/blenkernel/intern/exotic.c @@ -364,10 +364,16 @@ static void read_stl_mesh_ascii(Scene *scene, const char *str) * sure we have enough storage for some more faces */ if ( (totface) && ( (totface % 10000) == 0 ) ) { + float *vertdata_old= vertdata; ++numtenthousand; vertdata = realloc(vertdata, numtenthousand*3*30000*sizeof(float)); - if (!vertdata) { STLALLOCERROR; } + if (!vertdata) { + if(vertdata_old) { + free(vertdata_old); + } + STLALLOCERROR; + } } /* Don't read normal, but check line for proper syntax anyway @@ -507,9 +513,6 @@ int BKE_read_exotic(Scene *scene, const char *name) /* ************************ WRITE ************************** */ - -char temp_dir[160]= {0, 0}; - static void write_vert_stl(Object *ob, MVert *verts, int index, FILE *fpSTL) { float vert[3]; @@ -582,7 +585,6 @@ void write_stl(Scene *scene, char *str) BKE_reportf(reports, RPT_ERROR, "Can't open file: %s.", strerror(errno)); return; } - strcpy(temp_dir, str); //XXX waitcursor(1); @@ -868,7 +870,6 @@ void write_dxf(struct Scene *scene, char *str) //XXX error("Can't write file"); return; } - strcpy(temp_dir, str); //XXX waitcursor(1); @@ -1128,7 +1129,7 @@ static void dxf_add_mat (Object *ob, Mesh *me, float color[3], char *layer) ma= G.main->mat.first; while(ma) { - if(ma->mtex[0]==0) { + if(ma->mtex[0]==NULL) { if(color[0]==ma->r && color[1]==ma->g && color[2]==ma->b) { me->mat[0]= ma; ma->id.us++; @@ -1137,7 +1138,7 @@ static void dxf_add_mat (Object *ob, Mesh *me, float color[3], char *layer) } ma= ma->id.next; } - if(ma==0) { + if(ma==NULL) { ma= add_material("ext"); me->mat[0]= ma; ma->r= color[0]; @@ -1646,7 +1647,7 @@ static void dxf_read_arc(Scene *scene, int noob) cent[2]= center[2]; dxf_get_mesh(scene, &me, &ob, noob); - strcpy(oldllay, layname); + BLI_strncpy(oldllay, layname, sizeof(oldllay)); if(ob) VECCOPY(ob->loc, cent); dxf_add_mat (ob, me, color, layname); diff --git a/source/blender/blenkernel/intern/fcurve.c b/source/blender/blenkernel/intern/fcurve.c index ef1ac582c1e..fc5aecb5def 100644 --- a/source/blender/blenkernel/intern/fcurve.c +++ b/source/blender/blenkernel/intern/fcurve.c @@ -1202,7 +1202,7 @@ static float dvar_eval_transChan (ChannelDriver *driver, DriverVar *dvar) /* ......... */ /* Table of Driver Varaiable Type Info Data */ -DriverVarTypeInfo dvar_types[MAX_DVAR_TYPES] = { +static DriverVarTypeInfo dvar_types[MAX_DVAR_TYPES] = { BEGIN_DVAR_TYPEDEF(DVAR_TYPE_SINGLE_PROP) dvar_eval_singleProp, /* eval callback */ 1, /* number of targets used */ @@ -1233,7 +1233,7 @@ DriverVarTypeInfo dvar_types[MAX_DVAR_TYPES] = { }; /* Get driver variable typeinfo */ -DriverVarTypeInfo *get_dvar_typeinfo (int type) +static DriverVarTypeInfo *get_dvar_typeinfo (int type) { /* check if valid type */ if ((type >= 0) && (type < MAX_DVAR_TYPES)) diff --git a/source/blender/blenkernel/intern/font.c b/source/blender/blenkernel/intern/font.c index 1d7ce197cba..bf0427e4fee 100644 --- a/source/blender/blenkernel/intern/font.c +++ b/source/blender/blenkernel/intern/font.c @@ -96,13 +96,14 @@ chtoutf8(unsigned long c, char *o) void wcs2utf8s(char *dst, wchar_t *src) { - char ch[5]; + /* NULL terminator not needed */ + char ch[4]; while(*src) { - memset(ch, 0, 5); + memset(ch, 0, sizeof(ch)); chtoutf8(*src++, ch); - strcat(dst, ch); + dst= strncat(dst, ch, sizeof(ch)); } } @@ -207,7 +208,7 @@ int utf8towchar(wchar_t *w, char *c) /* The vfont code */ void free_vfont(struct VFont *vf) { - if (vf == 0) return; + if (vf == NULL) return; if (vf->data) { while(vf->data->characters.first) @@ -363,14 +364,14 @@ VFont *load_vfont(const char *name) struct TmpFont *tmpfnt; if (strcmp(name, FO_BUILTIN_NAME)==0) { - strcpy(filename, name); + BLI_strncpy(filename, name, sizeof(filename)); pf= get_builtin_packedfile(); is_builtin= 1; } else { char dir[FILE_MAXDIR]; - strcpy(dir, name); + BLI_strncpy(dir, name, sizeof(dir)); BLI_splitdirstring(dir, filename); pf= newPackedFile(NULL, name); @@ -475,7 +476,7 @@ static void build_underline(Curve *cu, float x1, float y1, float x2, float y2, i nu2->flagu = CU_NURB_CYCLIC; bp = (BPoint*)MEM_callocN(4 * sizeof(BPoint),"underline_bp"); - if (bp == 0){ + if (bp == NULL){ MEM_freeN(nu2); return; } @@ -543,10 +544,10 @@ static void buildchar(Curve *cu, unsigned long character, CharInfo *info, float bezt1 = nu1->bezt; if (bezt1){ nu2 =(Nurb*) MEM_mallocN(sizeof(Nurb),"duplichar_nurb"); - if (nu2 == 0) break; + if (nu2 == NULL) break; memcpy(nu2, nu1, sizeof(struct Nurb)); nu2->resolu= cu->resolu; - nu2->bp = 0; + nu2->bp = NULL; nu2->knotsu = nu2->knotsv = NULL; nu2->flag= CU_SMOOTH; nu2->charidx = charidx; @@ -561,7 +562,7 @@ static void buildchar(Curve *cu, unsigned long character, CharInfo *info, float i = nu2->pntsu; bezt2 = (BezTriple*)MEM_mallocN(i * sizeof(BezTriple),"duplichar_bezt2"); - if (bezt2 == 0){ + if (bezt2 == NULL){ MEM_freeN(nu2); break; } @@ -685,14 +686,14 @@ struct chartrans *BKE_text_to_curve(Scene *scene, Object *ob, int mode) /* renark: do calculations including the trailing '\0' of a string because the cursor can be at that location */ - if(ob->type!=OB_FONT) return 0; + if(ob->type!=OB_FONT) return NULL; // Set font data cu= (Curve *) ob->data; vfont= cu->vfont; - if(cu->str == NULL) return 0; - if(vfont == NULL) return 0; + if(cu->str == NULL) return NULL; + if(vfont == NULL) return NULL; // Create unicode string utf8len = utf8slen(cu->str); @@ -722,7 +723,7 @@ struct chartrans *BKE_text_to_curve(Scene *scene, Object *ob, int mode) if(!vfd) { if(mem) MEM_freeN(mem); - return 0; + return NULL; } /* calc offset and rotation of each char */ @@ -786,11 +787,11 @@ struct chartrans *BKE_text_to_curve(Scene *scene, Object *ob, int mode) che= find_vfont_char(vfd, ascii); /* No VFont found */ - if (vfont==0) { + if (vfont==NULL) { if(mem) MEM_freeN(mem); MEM_freeN(chartransdata); - return 0; + return NULL; } if (vfont != oldvfont) { @@ -803,7 +804,7 @@ struct chartrans *BKE_text_to_curve(Scene *scene, Object *ob, int mode) if(mem) MEM_freeN(mem); MEM_freeN(chartransdata); - return 0; + return NULL; } twidth = char_width(cu, che, info); @@ -1218,7 +1219,5 @@ struct chartrans *BKE_text_to_curve(Scene *scene, Object *ob, int mode) MEM_freeN(mem); MEM_freeN(chartransdata); - return 0; + return NULL; } - - diff --git a/source/blender/blenkernel/intern/icons.c b/source/blender/blenkernel/intern/icons.c index 1df272fad30..b575305171a 100644 --- a/source/blender/blenkernel/intern/icons.c +++ b/source/blender/blenkernel/intern/icons.c @@ -106,14 +106,14 @@ void BKE_icons_init(int first_dyn_id) gIcons = BLI_ghash_new(BLI_ghashutil_inthash, BLI_ghashutil_intcmp, "icons_init gh"); } -void BKE_icons_free() +void BKE_icons_free(void) { if(gIcons) - BLI_ghash_free(gIcons, 0, icon_free); + BLI_ghash_free(gIcons, NULL, icon_free); gIcons = NULL; } -struct PreviewImage* BKE_previewimg_create() +struct PreviewImage* BKE_previewimg_create(void) { PreviewImage* prv_img = NULL; int i; @@ -219,7 +219,7 @@ PreviewImage* BKE_previewimg_get(ID *id) void BKE_icon_changed(int id) { - Icon* icon = 0; + Icon* icon = NULL; if (!id || G.background) return; @@ -242,7 +242,7 @@ void BKE_icon_changed(int id) int BKE_icon_getid(struct ID* id) { - Icon* new_icon = 0; + Icon* new_icon = NULL; if (!id || G.background) return 0; @@ -263,8 +263,8 @@ int BKE_icon_getid(struct ID* id) new_icon->type = GS(id->name); /* next two lines make sure image gets created */ - new_icon->drawinfo = 0; - new_icon->drawinfo_free = 0; + new_icon->drawinfo = NULL; + new_icon->drawinfo_free = NULL; BLI_ghash_insert(gIcons, SET_INT_IN_POINTER(id->icon_id), new_icon); @@ -273,13 +273,13 @@ int BKE_icon_getid(struct ID* id) Icon* BKE_icon_get(int icon_id) { - Icon* icon = 0; + Icon* icon = NULL; icon = BLI_ghash_lookup(gIcons, SET_INT_IN_POINTER(icon_id)); if (!icon) { printf("BKE_icon_get: Internal error, no icon for icon ID: %d\n", icon_id); - return 0; + return NULL; } return icon; @@ -287,7 +287,7 @@ Icon* BKE_icon_get(int icon_id) void BKE_icon_set(int icon_id, struct Icon* icon) { - Icon* old_icon = 0; + Icon* old_icon = NULL; old_icon = BLI_ghash_lookup(gIcons, SET_INT_IN_POINTER(icon_id)); @@ -305,6 +305,6 @@ void BKE_icon_delete(struct ID* id) if (!id->icon_id) return; /* no icon defined for library object */ - BLI_ghash_remove(gIcons, SET_INT_IN_POINTER(id->icon_id), 0, icon_free); + BLI_ghash_remove(gIcons, SET_INT_IN_POINTER(id->icon_id), NULL, icon_free); id->icon_id = 0; } diff --git a/source/blender/blenkernel/intern/idcode.c b/source/blender/blenkernel/intern/idcode.c index 0745fd5bdfd..e4086827e5d 100644 --- a/source/blender/blenkernel/intern/idcode.c +++ b/source/blender/blenkernel/intern/idcode.c @@ -33,6 +33,8 @@ #include "DNA_ID.h" +#include "BKE_idcode.h" + typedef struct { unsigned short code; const char *name, *plural; diff --git a/source/blender/blenkernel/intern/idprop.c b/source/blender/blenkernel/intern/idprop.c index 633d3aeafb9..97fbcce1aec 100644 --- a/source/blender/blenkernel/intern/idprop.c +++ b/source/blender/blenkernel/intern/idprop.c @@ -266,7 +266,7 @@ void IDP_FreeArray(IDProperty *prop) return newp; } -IDProperty *IDP_CopyArray(IDProperty *prop) +static IDProperty *IDP_CopyArray(IDProperty *prop) { IDProperty *newp = idp_generic_copy(prop); @@ -328,7 +328,7 @@ IDProperty *IDP_NewString(const char *st, const char *name, int maxlen) return prop; } -IDProperty *IDP_CopyString(IDProperty *prop) +static IDProperty *IDP_CopyString(IDProperty *prop) { IDProperty *newp = idp_generic_copy(prop); @@ -402,7 +402,7 @@ void IDP_UnlinkID(IDProperty *prop) /*-------- Group Functions -------*/ /*checks if a property with the same name as prop exists, and if so replaces it.*/ -IDProperty *IDP_CopyGroup(IDProperty *prop) +static IDProperty *IDP_CopyGroup(IDProperty *prop) { IDProperty *newp = idp_generic_copy(prop), *link; newp->len = prop->len; @@ -535,6 +535,12 @@ IDProperty *IDP_GetPropertyFromGroup(IDProperty *prop, const char *name) return (IDProperty *)BLI_findstring(&prop->data.group, name, offsetof(IDProperty, name)); } +IDProperty *IDP_GetPropertyTypeFromGroup(IDProperty *prop, const char *name, const char type) +{ + IDProperty *idprop= IDP_GetPropertyFromGroup(prop, name); + return (idprop && idprop->type == type) ? idprop : NULL; +} + typedef struct IDPIter { void *next; IDProperty *parent; @@ -705,9 +711,9 @@ IDProperty *IDP_New(int type, IDPropertyTemplate val, const char *name) prop->len = 1; /*NULL string, has len of 1 to account for null byte.*/ } else { int stlen = strlen(st) + 1; - prop->data.pointer = MEM_callocN(stlen, "id property string 2"); + prop->data.pointer = MEM_mallocN(stlen, "id property string 2"); prop->len = prop->totallen = stlen; - strcpy(prop->data.pointer, st); + memcpy(prop->data.pointer, st, stlen); } break; } diff --git a/source/blender/blenkernel/intern/image.c b/source/blender/blenkernel/intern/image.c index 3d69f51851f..64327b2005d 100644 --- a/source/blender/blenkernel/intern/image.c +++ b/source/blender/blenkernel/intern/image.c @@ -100,7 +100,7 @@ static void de_interlace_ng(struct ImBuf *ibuf) /* neogeo fields */ { struct ImBuf * tbuf1, * tbuf2; - if (ibuf == 0) return; + if (ibuf == NULL) return; if (ibuf->flags & IB_fields) return; ibuf->flags |= IB_fields; @@ -128,7 +128,7 @@ static void de_interlace_st(struct ImBuf *ibuf) /* standard fields */ { struct ImBuf * tbuf1, * tbuf2; - if (ibuf == 0) return; + if (ibuf == NULL) return; if (ibuf->flags & IB_fields) return; ibuf->flags |= IB_fields; @@ -514,7 +514,7 @@ static void tag_all_images_time() } #endif -void free_old_images() +void free_old_images(void) { Image *ima; static int lasttime = 0; @@ -873,32 +873,23 @@ static void stampdata(Scene *scene, StampData *stamp_data, int do_prefix) time_t t; if (scene->r.stamp & R_STAMP_FILENAME) { - if (G.relbase_valid) { - if (do_prefix) sprintf(stamp_data->file, "File %s", G.main->name); - else sprintf(stamp_data->file, "%s", G.main->name); - } else { - if (do_prefix) strcpy(stamp_data->file, "File <untitled>"); - else strcpy(stamp_data->file, "<untitled>"); - } + BLI_snprintf(stamp_data->file, sizeof(stamp_data->file), do_prefix ? "File %s":"%s", G.relbase_valid ? G.main->name:"<untitled>"); } else { stamp_data->file[0] = '\0'; } if (scene->r.stamp & R_STAMP_NOTE) { /* Never do prefix for Note */ - sprintf(stamp_data->note, "%s", scene->r.stamp_udata); + BLI_snprintf(stamp_data->note, sizeof(stamp_data->note), "%s", scene->r.stamp_udata); } else { stamp_data->note[0] = '\0'; } if (scene->r.stamp & R_STAMP_DATE) { - - t = time (NULL); - tl = localtime (&t); - sprintf (text, "%04d/%02d/%02d %02d:%02d:%02d", tl->tm_year+1900, tl->tm_mon+1, tl->tm_mday, tl->tm_hour, tl->tm_min, tl->tm_sec); - - if (do_prefix) sprintf(stamp_data->date, "Date %s", text); - else sprintf(stamp_data->date, "%s", text); + t = time(NULL); + tl = localtime(&t); + BLI_snprintf(text, sizeof(text), "%04d/%02d/%02d %02d:%02d:%02d", tl->tm_year+1900, tl->tm_mon+1, tl->tm_mday, tl->tm_hour, tl->tm_min, tl->tm_sec); + BLI_snprintf(stamp_data->date, sizeof(stamp_data->date), do_prefix ? "Date %s":"%s", text); } else { stamp_data->date[0] = '\0'; } @@ -908,9 +899,8 @@ static void stampdata(Scene *scene, StampData *stamp_data, int do_prefix) if (name) strcpy(text, name); else strcpy(text, "<none>"); - - if (do_prefix) sprintf(stamp_data->marker, "Marker %s", text); - else sprintf(stamp_data->marker, "%s", text); + + BLI_snprintf(stamp_data->marker, sizeof(stamp_data->marker), do_prefix ? "Marker %s":"%s", text); } else { stamp_data->marker[0] = '\0'; } @@ -932,12 +922,11 @@ static void stampdata(Scene *scene, StampData *stamp_data, int do_prefix) } if (scene->r.frs_sec < 100) - sprintf (text, "%02d:%02d:%02d.%02d", h, m, s, f); + BLI_snprintf(text, sizeof(text), "%02d:%02d:%02d.%02d", h, m, s, f); else - sprintf (text, "%02d:%02d:%02d.%03d", h, m, s, f); - - if (do_prefix) sprintf(stamp_data->time, "Time %s", text); - else sprintf(stamp_data->time, "%s", text); + BLI_snprintf(text, sizeof(text), "%02d:%02d:%02d.%03d", h, m, s, f); + + BLI_snprintf(stamp_data->time, sizeof(stamp_data->time), do_prefix ? "Time %s":"%s", text); } else { stamp_data->time[0] = '\0'; } @@ -948,39 +937,32 @@ static void stampdata(Scene *scene, StampData *stamp_data, int do_prefix) if(scene->r.efra>9) digits= 1 + (int) log10(scene->r.efra); - - if (do_prefix) sprintf(format, "Frame %%0%di", digits); - else sprintf(format, "%%0%di", digits); - sprintf (stamp_data->frame, format, scene->r.cfra); + + BLI_snprintf(format, sizeof(format), do_prefix ? "Frame %%0%di":"%%0%di", digits); + BLI_snprintf (stamp_data->frame, sizeof(stamp_data->frame), format, scene->r.cfra); } else { stamp_data->frame[0] = '\0'; } if (scene->r.stamp & R_STAMP_CAMERA) { - if (scene->camera) strcpy(text, scene->camera->id.name+2); - else strcpy(text, "<none>"); - - if (do_prefix) sprintf(stamp_data->camera, "Camera %s", text); - else sprintf(stamp_data->camera, "%s", text); + BLI_snprintf(stamp_data->camera, sizeof(stamp_data->camera), do_prefix ? "Camera %s":"%s", scene->camera ? scene->camera->id.name+2 : "<none>"); } else { stamp_data->camera[0] = '\0'; } if (scene->r.stamp & R_STAMP_CAMERALENS) { if (scene->camera && scene->camera->type == OB_CAMERA) { - sprintf(text, "%.2f", ((Camera *)scene->camera->data)->lens); + BLI_snprintf(text, sizeof(text), "%.2f", ((Camera *)scene->camera->data)->lens); } else strcpy(text, "<none>"); - if (do_prefix) sprintf(stamp_data->cameralens, "Lens %s", text); - else sprintf(stamp_data->cameralens, "%s", text); + BLI_snprintf(stamp_data->cameralens, sizeof(stamp_data->cameralens), do_prefix ? "Lens %s":"%s", text); } else { stamp_data->cameralens[0] = '\0'; } if (scene->r.stamp & R_STAMP_SCENE) { - if (do_prefix) sprintf(stamp_data->scene, "Scene %s", scene->id.name+2); - else sprintf(stamp_data->scene, "%s", scene->id.name+2); + BLI_snprintf(stamp_data->scene, sizeof(stamp_data->scene), do_prefix ? "Scene %s":"%s", scene->id.name+2); } else { stamp_data->scene[0] = '\0'; } @@ -990,9 +972,8 @@ static void stampdata(Scene *scene, StampData *stamp_data, int do_prefix) if (seq) strcpy(text, seq->name+2); else strcpy(text, "<none>"); - - if (do_prefix) sprintf(stamp_data->strip, "Strip %s", text); - else sprintf(stamp_data->strip, "%s", text); + + BLI_snprintf(stamp_data->strip, sizeof(stamp_data->strip), do_prefix ? "Strip %s":"%s", text); } else { stamp_data->strip[0] = '\0'; } @@ -1004,8 +985,7 @@ static void stampdata(Scene *scene, StampData *stamp_data, int do_prefix) if (stats && (scene->r.stamp & R_STAMP_RENDERTIME)) { BLI_timestr(stats->lastframetime, text); - if (do_prefix) sprintf(stamp_data->rendertime, "RenderTime %s", text); - else sprintf(stamp_data->rendertime, "%s", text); + BLI_snprintf(stamp_data->rendertime, sizeof(stamp_data->rendertime), do_prefix ? "RenderTime %s":"%s", text); } else { stamp_data->rendertime[0] = '\0'; } @@ -1262,7 +1242,7 @@ int BKE_write_ibuf(Scene *scene, ImBuf *ibuf, const char *name, int imtype, int ibuf->ftype= IMAGIC; } #ifdef WITH_HDR - else if ((imtype==R_RADHDR)) { + else if (imtype==R_RADHDR) { ibuf->ftype= RADHDR; } #endif @@ -1274,11 +1254,11 @@ int BKE_write_ibuf(Scene *scene, ImBuf *ibuf, const char *name, int imtype, int } #ifdef WITH_DDS - else if ((imtype==R_DDS)) { + else if (imtype==R_DDS) { ibuf->ftype= DDS; } #endif - else if ((imtype==R_BMP)) { + else if (imtype==R_BMP) { ibuf->ftype= BMP; } #ifdef WITH_TIFF @@ -1379,7 +1359,7 @@ struct anim *openanim(char *name, int flags) struct ImBuf *ibuf; anim = IMB_open_anim(name, flags); - if (anim == NULL) return(0); + if (anim == NULL) return NULL; ibuf = IMB_anim_absolute(anim, 0); if (ibuf == NULL) { @@ -1388,7 +1368,7 @@ struct anim *openanim(char *name, int flags) else printf("anim file doesn't exist: %s\n", name); IMB_free_anim(anim); - return(0); + return NULL; } IMB_freeImBuf(ibuf); diff --git a/source/blender/blenkernel/intern/image_gen.c b/source/blender/blenkernel/intern/image_gen.c index a2d41920217..c21e347d6d8 100644 --- a/source/blender/blenkernel/intern/image_gen.c +++ b/source/blender/blenkernel/intern/image_gen.c @@ -25,6 +25,8 @@ #include <math.h> #include <stdlib.h> + +#include "BKE_image.h" #include "BLI_math_color.h" #include "BLF_api.h" diff --git a/source/blender/blenkernel/intern/ipo.c b/source/blender/blenkernel/intern/ipo.c index db995fd4f1d..329058b3115 100644 --- a/source/blender/blenkernel/intern/ipo.c +++ b/source/blender/blenkernel/intern/ipo.c @@ -62,7 +62,7 @@ #include "BLI_utildefines.h" - +#include "BKE_ipo.h" #include "BKE_animsys.h" #include "BKE_action.h" #include "BKE_fcurve.h" @@ -709,6 +709,11 @@ static const char *world_adrcodes_to_paths (int adrcode, int *array_index) *array_index= 1; return "stars.color"; case WO_STAR_B: *array_index= 2; return "stars.color"; */ + case WO_STAR_R: + case WO_STAR_G: + case WO_STAR_B: + printf("WARNING: WO_STAR_R/G/B deprecated\n"); + return NULL; case WO_STARDIST: return "stars.min_distance"; @@ -798,7 +803,7 @@ static const char *particle_adrcodes_to_paths (int adrcode, int *array_index) * - array_index - index in property's array (if applicable) to use * - return - the allocated path... */ -static char *get_rna_access (int blocktype, int adrcode, char actname[], char constname[], Sequence * seq, int *array_index) +static char *get_rna_access (int blocktype, int adrcode, char actname[], char constname[], Sequence *seq, int *array_index) { DynStr *path= BLI_dynstr_new(); const char *propname=NULL; @@ -914,8 +919,17 @@ static char *get_rna_access (int blocktype, int adrcode, char actname[], char co sprintf(buf, "pose.bones[\"%s\"].constraints[\"%s\"]", actname, constname); } else if (actname && actname[0]) { - /* Pose-Channel */ - sprintf(buf, "pose.bones[\"%s\"]", actname); + if ((blocktype == ID_OB) && strcmp(actname, "Object")==0) { + /* Actionified "Object" IPO's... no extra path stuff needed */ + } + else if ((blocktype == ID_KE) && strcmp(actname, "Shape")==0) { + /* Actionified "Shape" IPO's - these are forced onto object level via the action container there... */ + strcpy(buf, "data.shape_keys"); + } + else { + /* Pose-Channel */ + sprintf(buf, "pose.bones[\"%s\"]", actname); + } } else if (constname && constname[0]) { /* Constraint in Object */ @@ -923,8 +937,7 @@ static char *get_rna_access (int blocktype, int adrcode, char actname[], char co } else if (seq) { /* Sequence names in Scene */ - sprintf(buf, "sequence_editor.sequences_all[\"%s\"]", - seq->name+2); + sprintf(buf, "sequence_editor.sequences_all[\"%s\"]", seq->name+2); } else strcpy(buf, ""); /* empty string */ @@ -1321,20 +1334,17 @@ static void icu_to_fcurves (ID *id, ListBase *groups, ListBase *list, IpoCurve * } } - /* correct values for sequencer curves, - that were not locked to frame */ - - if (seq && - (seq->flag & SEQ_IPO_FRAME_LOCKED) == 0) { + /* correct values for sequencer curves, that were not locked to frame */ + if (seq && (seq->flag & SEQ_IPO_FRAME_LOCKED) == 0) { double mul= (seq->enddisp-seq->startdisp)/100.0f; double offset= seq->startdisp; dst->vec[0][0] *= mul; dst->vec[0][0] += offset; - + dst->vec[1][0] *= mul; dst->vec[1][0] += offset; - + dst->vec[2][0] *= mul; dst->vec[2][0] += offset; } @@ -1481,7 +1491,7 @@ static void action_to_animato (ID *id, bAction *act, ListBase *groups, ListBase * This assumes that AnimData has been added already. Separation of drivers * from animation data is accomplished here too... */ -static void ipo_to_animdata (ID *id, Ipo *ipo, char actname[], char constname[], Sequence * seq) +static void ipo_to_animdata (ID *id, Ipo *ipo, char actname[], char constname[], Sequence *seq) { AnimData *adt= BKE_animdata_from_id(id); ListBase anim = {NULL, NULL}; @@ -1512,8 +1522,12 @@ static void ipo_to_animdata (ID *id, Ipo *ipo, char actname[], char constname[], if (G.f & G_DEBUG) printf("\thas anim \n"); /* try to get action */ if (adt->action == NULL) { - adt->action= add_empty_action("ConvData_Action"); // XXX we need a better name for this - if (G.f & G_DEBUG) printf("\t\tadded new action \n"); + char nameBuf[MAX_ID_NAME]; + + BLI_snprintf(nameBuf, sizeof(nameBuf), "CDA:%s", ipo->id.name+2); + + adt->action= add_empty_action(nameBuf); + if (G.f & G_DEBUG) printf("\t\tadded new action - '%s' \n", nameBuf); } /* add F-Curves to action */ @@ -1869,7 +1883,7 @@ void do_versions_ipos_to_animato(Main *main) to different DNA variables later (semi-hack (tm) ) */ - switch(seq->type) { + switch (seq->type) { case SEQ_IMAGE: case SEQ_META: case SEQ_SCENE: diff --git a/source/blender/blenkernel/intern/key.c b/source/blender/blenkernel/intern/key.c index a3c8ea0c194..3681dc910cd 100644 --- a/source/blender/blenkernel/intern/key.c +++ b/source/blender/blenkernel/intern/key.c @@ -150,7 +150,7 @@ Key *copy_key(Key *key) Key *keyn; KeyBlock *kbn, *kb; - if(key==0) return 0; + if(key==NULL) return NULL; keyn= copy_libblock(key); @@ -177,10 +177,10 @@ void make_local_key(Key *key) * - only local users: set flag * - mixed: make copy */ - if(key==0) return; + if(key==NULL) return; - key->id.lib= 0; - new_id(0, (ID *)key, 0); + key->id.lib= NULL; + new_id(NULL, (ID *)key, NULL); } /* Sort shape keys and Ipo curves after a change. This assumes that at most @@ -365,14 +365,14 @@ static int setkeys(float fac, ListBase *lb, KeyBlock *k[], float *t, int cycl) /* if(fac<0.0 || fac>1.0) return 1; */ - if(k1->next==0) return 1; + if(k1->next==NULL) return 1; if(cycl) { /* pre-sort */ k[2]= k1->next; k[3]= k[2]->next; - if(k[3]==0) k[3]=k1; + if(k[3]==NULL) k[3]=k1; while(k1) { - if(k1->next==0) k[0]=k1; + if(k1->next==NULL) k[0]=k1; k1=k1->next; } k1= k[1]; @@ -393,13 +393,13 @@ static int setkeys(float fac, ListBase *lb, KeyBlock *k[], float *t, int cycl) k[2]= k1->next; t[2]= k[2]->pos; k[3]= k[2]->next; - if(k[3]==0) k[3]= k[2]; + if(k[3]==NULL) k[3]= k[2]; t[3]= k[3]->pos; k1= k[3]; } while( t[2]<fac ) { /* find correct location */ - if(k1->next==0) { + if(k1->next==NULL) { if(cycl) { k1= firstkey; ofs+= dpos; @@ -1081,7 +1081,7 @@ static void do_mesh_key(Scene *scene, Object *ob, Key *key, char *out, const int for(a=0; a<tot; a+=step, cfra+= delta) { - ctime= bsystem_time(scene, 0, cfra, 0.0); // xxx ugly cruft! + ctime= bsystem_time(scene, NULL, cfra, 0.0); // xxx ugly cruft! #if 0 // XXX old animation system if(calc_ipo_spec(key->ipo, KEY_SPEED, &ctime)==0) { ctime /= 100.0; @@ -1213,7 +1213,7 @@ static void do_curve_key(Scene *scene, Object *ob, Key *key, char *out, const in while (a < estep) { if (remain <= 0) { cfra+= delta; - ctime= bsystem_time(scene, 0, cfra, 0.0f); // XXX old cruft + ctime= bsystem_time(scene, NULL, cfra, 0.0f); // XXX old cruft ctime /= 100.0f; CLAMP(ctime, 0.0f, 1.0f); // XXX for compat, we use this, but this clamping was confusing @@ -1276,7 +1276,7 @@ static void do_latt_key(Scene *scene, Object *ob, Key *key, char *out, const int for(a=0; a<tot; a++, cfra+= delta) { - ctime= bsystem_time(scene, 0, cfra, 0.0); // XXX old cruft + ctime= bsystem_time(scene, NULL, cfra, 0.0); // XXX old cruft #if 0 // XXX old animation system if(calc_ipo_spec(key->ipo, KEY_SPEED, &ctime)==0) { ctime /= 100.0; diff --git a/source/blender/blenkernel/intern/lattice.c b/source/blender/blenkernel/intern/lattice.c index be3ec62374f..bd7fdfebe97 100644 --- a/source/blender/blenkernel/intern/lattice.c +++ b/source/blender/blenkernel/intern/lattice.c @@ -251,11 +251,11 @@ void make_local_lattice(Lattice *lt) * - mixed: make copy */ - if(lt->id.lib==0) return; + if(lt->id.lib==NULL) return; if(lt->id.us==1) { - lt->id.lib= 0; + lt->id.lib= NULL; lt->id.flag= LIB_LOCAL; - new_id(0, (ID *)lt, 0); + new_id(NULL, (ID *)lt, NULL); return; } @@ -269,9 +269,9 @@ void make_local_lattice(Lattice *lt) } if(local && lib==0) { - lt->id.lib= 0; + lt->id.lib= NULL; lt->id.flag= LIB_LOCAL; - new_id(0, (ID *)lt, 0); + new_id(NULL, (ID *)lt, NULL); } else if(local && lib) { ltn= copy_lattice(lt); @@ -281,7 +281,7 @@ void make_local_lattice(Lattice *lt) while(ob) { if(ob->data==lt) { - if(ob->id.lib==0) { + if(ob->id.lib==NULL) { ob->data= ltn; ltn->id.us++; lt->id.us--; diff --git a/source/blender/blenkernel/intern/library.c b/source/blender/blenkernel/intern/library.c index 58167a866a3..28410a7cc0e 100644 --- a/source/blender/blenkernel/intern/library.c +++ b/source/blender/blenkernel/intern/library.c @@ -313,7 +313,7 @@ int id_copy(ID *id, ID **newid, int test) if(!test) *newid= (ID*)copy_action((bAction*)id); return 1; case ID_NT: - if(!test) *newid= (ID*)ntreeCopyTree((bNodeTree*)id, 0); + if(!test) *newid= (ID*)ntreeCopyTree((bNodeTree*)id); return 1; case ID_BR: if(!test) *newid= (ID*)copy_brush((Brush*)id); @@ -426,7 +426,7 @@ ListBase *which_libbase(Main *mainlib, short type) case ID_LS: return &(mainlib->linestyle); } - return 0; + return NULL; } /* Flag all ids in listbase */ @@ -699,7 +699,7 @@ void set_free_windowmanager_cb(void (*func)(bContext *C, wmWindowManager *) ) free_windowmanager_cb= func; } -void animdata_dtar_clear_cb(ID *UNUSED(id), AnimData *adt, void *userdata) +static void animdata_dtar_clear_cb(ID *UNUSED(id), AnimData *adt, void *userdata) { ChannelDriver *driver; FCurve *fcu; @@ -934,7 +934,7 @@ static void IDnames_to_dyn_pupstring(DynStr *pupds, ListBase *lb, ID *link, shor BLI_dynstr_append(pupds, buf); BLI_dynstr_append(pupds, id->name+2); - sprintf(buf, "%%x%d", i+1); + BLI_snprintf(buf, sizeof(buf), "%%x%d", i+1); BLI_dynstr_append(pupds, buf); /* icon */ @@ -945,7 +945,7 @@ static void IDnames_to_dyn_pupstring(DynStr *pupds, ListBase *lb, ID *link, shor case ID_IM: /* fall through */ case ID_WO: /* fall through */ case ID_LA: /* fall through */ - sprintf(buf, "%%i%d", BKE_icon_getid(id) ); + BLI_snprintf(buf, sizeof(buf), "%%i%d", BKE_icon_getid(id) ); BLI_dynstr_append(pupds, buf); break; default: @@ -1021,7 +1021,7 @@ static void sort_alpha_id(ListBase *lb, ID *id) idtest= idtest->next; } /* as last */ - if(idtest==0) { + if(idtest==NULL) { BLI_addtail(lb, id); } } @@ -1142,7 +1142,7 @@ static int check_for_dupid(ListBase *lb, ID *id, char *name) continue; } /* this format specifier is from hell... */ - sprintf(name, "%s.%.3d", left, nr); + BLI_snprintf(name, sizeof(id->name) - 2,"%s.%.3d", left, nr); return 1; } @@ -1203,7 +1203,7 @@ int new_id(ListBase *lb, ID *id, const char *tname) } /* next to indirect usage in read/writefile also in editobject.c scene.c */ -void clear_id_newpoins() +void clear_id_newpoins(void) { ListBase *lbarray[MAX_LIBARRAY]; ID *id; @@ -1213,7 +1213,7 @@ void clear_id_newpoins() while(a--) { id= lbarray[a]->first; while(id) { - id->newid= 0; + id->newid= NULL; id->flag &= ~LIB_NEW; id= id->next; } @@ -1307,7 +1307,7 @@ void tag_main(struct Main *mainvar, const short tag) /* if lib!=NULL, only all from lib local */ void all_local(Library *lib, int untagged_only) { - ListBase *lbarray[MAX_LIBARRAY], tempbase={0, 0}; + ListBase *lbarray[MAX_LIBARRAY], tempbase={NULL, NULL}; ID *id, *idn; int a; @@ -1336,7 +1336,7 @@ void all_local(Library *lib, int untagged_only) image_fix_relative_path((Image *)id); id->lib= NULL; - new_id(lbarray[a], id, 0); /* new_id only does it with double names */ + new_id(lbarray[a], id, NULL); /* new_id only does it with double names */ sort_alpha_id(lbarray[a], id); } } @@ -1348,7 +1348,7 @@ void all_local(Library *lib, int untagged_only) while( (id=tempbase.first) ) { BLI_remlink(&tempbase, id); BLI_addtail(lbarray[a], id); - new_id(lbarray[a], id, 0); + new_id(lbarray[a], id, NULL); } } @@ -1369,7 +1369,7 @@ void test_idbutton(char *name) lb= which_libbase(G.main, GS(name-2) ); - if(lb==0) return; + if(lb==NULL) return; /* search for id */ idtest= BLI_findstring(lb, name, offsetof(ID, name) + 2); diff --git a/source/blender/blenkernel/intern/material.c b/source/blender/blenkernel/intern/material.c index 5ee41246bf9..cd52a38140a 100644 --- a/source/blender/blenkernel/intern/material.c +++ b/source/blender/blenkernel/intern/material.c @@ -224,7 +224,7 @@ Material *copy_material(Material *ma) if (ma->preview) man->preview = BKE_previewimg_copy(ma->preview); if(ma->nodetree) { - man->nodetree= ntreeCopyTree(ma->nodetree, 0); /* 0 == full new tree */ + man->nodetree= ntreeCopyTree(ma->nodetree); /* 0 == full new tree */ } man->gpumaterial.first= man->gpumaterial.last= NULL; @@ -279,11 +279,11 @@ void make_local_material(Material *ma) * - mixed: make copy */ - if(ma->id.lib==0) return; + if(ma->id.lib==NULL) return; if(ma->id.us==1) { - ma->id.lib= 0; + ma->id.lib= NULL; ma->id.flag= LIB_LOCAL; - new_id(0, (ID *)ma, 0); + new_id(NULL, (ID *)ma, NULL); for(a=0; a<MAX_MTEX; a++) { if(ma->mtex[a]) id_lib_extern((ID *)ma->mtex[a]->tex); } @@ -345,14 +345,14 @@ void make_local_material(Material *ma) } if(local && lib==0) { - ma->id.lib= 0; + ma->id.lib= NULL; ma->id.flag= LIB_LOCAL; for(a=0; a<MAX_MTEX; a++) { if(ma->mtex[a]) id_lib_extern((ID *)ma->mtex[a]->tex); } - new_id(0, (ID *)ma, 0); + new_id(NULL, (ID *)ma, NULL); } else if(local && lib) { @@ -365,7 +365,7 @@ void make_local_material(Material *ma) if(ob->mat) { for(a=0; a<ob->totcol; a++) { if(ob->mat[a]==ma) { - if(ob->id.lib==0) { + if(ob->id.lib==NULL) { ob->mat[a]= man; man->id.us++; ma->id.us--; @@ -381,7 +381,7 @@ void make_local_material(Material *ma) if(me->mat) { for(a=0; a<me->totcol; a++) { if(me->mat[a]==ma) { - if(me->id.lib==0) { + if(me->id.lib==NULL) { me->mat[a]= man; man->id.us++; ma->id.us--; @@ -397,7 +397,7 @@ void make_local_material(Material *ma) if(cu->mat) { for(a=0; a<cu->totcol; a++) { if(cu->mat[a]==ma) { - if(cu->id.lib==0) { + if(cu->id.lib==NULL) { cu->mat[a]= man; man->id.us++; ma->id.us--; @@ -413,7 +413,7 @@ void make_local_material(Material *ma) if(mb->mat) { for(a=0; a<mb->totcol; a++) { if(mb->mat[a]==ma) { - if(mb->id.lib==0) { + if(mb->id.lib==NULL) { mb->mat[a]= man; man->id.us++; ma->id.us--; @@ -584,7 +584,7 @@ Material *give_current_material(Object *ob, int act) matarar= give_matarar(ob); if(matarar && *matarar) ma= (*matarar)[act-1]; - else ma= 0; + else ma= NULL; } @@ -594,7 +594,7 @@ Material *give_current_material(Object *ob, int act) ID *material_from(Object *ob, int act) { - if(ob==0) return 0; + if(ob==NULL) return NULL; if(ob->totcol==0) return ob->data; if(act==0) act= 1; @@ -689,7 +689,7 @@ void assign_material(Object *ob, Material *ma, int act) totcolp= give_totcolp(ob); matarar= give_matarar(ob); - if(totcolp==0 || matarar==0) return; + if(totcolp==NULL || matarar==NULL) return; if(act > *totcolp) { matar= MEM_callocN(sizeof(void *)*act, "matarray1"); @@ -783,7 +783,7 @@ int object_add_material_slot(Object *ob) { Material *ma; - if(ob==0) return FALSE; + if(ob==NULL) return FALSE; if(ob->totcol>=MAXMAT) return FALSE; ma= give_current_material(ob, ob->actcol); @@ -965,7 +965,7 @@ int material_in_material(Material *parmat, Material *mat) /* ****************** */ -char colname_array[125][20]= { +static char colname_array[125][20]= { "Black","DarkRed","HalfRed","Red","Red", "DarkGreen","DarkOlive","Brown","Chocolate","OrangeRed", "HalfGreen","GreenOlive","DryOlive","Goldenrod","DarkOrange", @@ -998,7 +998,7 @@ void automatname(Material *ma) int nr, r, g, b; float ref; - if(ma==0) return; + if(ma==NULL) return; if(ma->mode & MA_SHLESS) ref= 1.0; else ref= ma->ref; @@ -1046,7 +1046,7 @@ int object_remove_material_slot(Object *ob) if(*totcolp==0) { MEM_freeN(*matarar); - *matarar= 0; + *matarar= NULL; } actcol= ob->actcol; @@ -1069,7 +1069,7 @@ int object_remove_material_slot(Object *ob) if(obt->totcol==0) { MEM_freeN(obt->mat); MEM_freeN(obt->matbits); - obt->mat= 0; + obt->mat= NULL; obt->matbits= NULL; } } @@ -1350,7 +1350,7 @@ void ramp_blend(int type, float *r, float *g, float *b, float fac, float *col) /* copy/paste buffer, if we had a propper py api that would be better */ Material matcopybuf; -static short matcopied=0; +static short matcopied= 0; void clear_matcopybuf(void) { @@ -1402,7 +1402,7 @@ void copy_matcopybuf(Material *ma) matcopybuf.mtex[a]= MEM_dupallocN(mtex); } } - matcopybuf.nodetree= ntreeCopyTree(ma->nodetree, 0); + matcopybuf.nodetree= ntreeCopyTree(ma->nodetree); matcopybuf.preview= NULL; matcopybuf.gpumaterial.first= matcopybuf.gpumaterial.last= NULL; matcopied= 1; @@ -1447,5 +1447,5 @@ void paste_matcopybuf(Material *ma) } } - ma->nodetree= ntreeCopyTree(matcopybuf.nodetree, 0); + ma->nodetree= ntreeCopyTree(matcopybuf.nodetree); } diff --git a/source/blender/blenkernel/intern/mball.c b/source/blender/blenkernel/intern/mball.c index a22fc165de7..d89bc3cd6f2 100644 --- a/source/blender/blenkernel/intern/mball.c +++ b/source/blender/blenkernel/intern/mball.c @@ -77,7 +77,7 @@ void unlink_mball(MetaBall *mb) for(a=0; a<mb->totcol; a++) { if(mb->mat[a]) mb->mat[a]->id.us--; - mb->mat[a]= 0; + mb->mat[a]= NULL; } } @@ -142,9 +142,9 @@ void make_local_mball(MetaBall *mb) * - mixed: make copy */ - if(mb->id.lib==0) return; + if(mb->id.lib==NULL) return; if(mb->id.us==1) { - mb->id.lib= 0; + mb->id.lib= NULL; mb->id.flag= LIB_LOCAL; return; } @@ -159,7 +159,7 @@ void make_local_mball(MetaBall *mb) } if(local && lib==0) { - mb->id.lib= 0; + mb->id.lib= NULL; mb->id.flag= LIB_LOCAL; } else if(local && lib) { @@ -170,7 +170,7 @@ void make_local_mball(MetaBall *mb) while(ob) { if(ob->data==mb) { - if(ob->id.lib==0) { + if(ob->id.lib==NULL) { ob->data= mbn; mbn->id.us++; mb->id.us--; @@ -242,7 +242,7 @@ void tex_space_mball(Object *ob) float *data, min[3], max[3], loc[3], size[3]; int tot, doit=0; - if(ob->bb==0) ob->bb= MEM_callocN(sizeof(BoundBox), "mb boundbox"); + if(ob->bb==NULL) ob->bb= MEM_callocN(sizeof(BoundBox), "mb boundbox"); bb= ob->bb; /* Weird one, this. */ @@ -372,7 +372,7 @@ void copy_mball_properties(Scene *scene, Object *active_object) BLI_split_name_num(basisname, &basisnr, active_object->id.name+2, '.'); /* XXX recursion check, see scene.c, just too simple code this next_object() */ - if(F_ERROR==next_object(&sce_iter, 0, 0, 0)) + if(F_ERROR==next_object(&sce_iter, 0, NULL, NULL)) return; while(next_object(&sce_iter, 1, &base, &ob)) { @@ -418,7 +418,7 @@ Object *find_basis_mball(Scene *scene, Object *basis) totelem= 0; /* XXX recursion check, see scene.c, just too simple code this next_object() */ - if(F_ERROR==next_object(&sce_iter, 0, 0, 0)) + if(F_ERROR==next_object(&sce_iter, 0, NULL, NULL)) return NULL; while(next_object(&sce_iter, 1, &base, &ob)) { @@ -698,8 +698,8 @@ float metaball(float x, float y, float z) /* ******************************************** */ -int *indices=NULL; -int totindex, curindex; +static int *indices=NULL; +static int totindex, curindex; void accum_mballfaces(int i1, int i2, int i3, int i4) @@ -742,8 +742,8 @@ void *new_pgn_element(int size) */ int blocksize= 16384; static int offs= 0; /* the current free address */ - static struct pgn_elements *cur= 0; - static ListBase lb= {0, 0}; + static struct pgn_elements *cur= NULL; + static ListBase lb= {NULL, NULL}; void *adr; if(size>10000 || size==0) { @@ -925,14 +925,14 @@ void testface(int i, int j, int k, CUBE* old, int bit, int c1, int c2, int c3, i newc.corners[FLIP(c3, bit)] = corn3; newc.corners[FLIP(c4, bit)] = corn4; - if(newc.corners[0]==0) newc.corners[0] = setcorner(p, i, j, k); - if(newc.corners[1]==0) newc.corners[1] = setcorner(p, i, j, k+1); - if(newc.corners[2]==0) newc.corners[2] = setcorner(p, i, j+1, k); - if(newc.corners[3]==0) newc.corners[3] = setcorner(p, i, j+1, k+1); - if(newc.corners[4]==0) newc.corners[4] = setcorner(p, i+1, j, k); - if(newc.corners[5]==0) newc.corners[5] = setcorner(p, i+1, j, k+1); - if(newc.corners[6]==0) newc.corners[6] = setcorner(p, i+1, j+1, k); - if(newc.corners[7]==0) newc.corners[7] = setcorner(p, i+1, j+1, k+1); + if(newc.corners[0]==NULL) newc.corners[0] = setcorner(p, i, j, k); + if(newc.corners[1]==NULL) newc.corners[1] = setcorner(p, i, j, k+1); + if(newc.corners[2]==NULL) newc.corners[2] = setcorner(p, i, j+1, k); + if(newc.corners[3]==NULL) newc.corners[3] = setcorner(p, i, j+1, k+1); + if(newc.corners[4]==NULL) newc.corners[4] = setcorner(p, i+1, j, k); + if(newc.corners[5]==NULL) newc.corners[5] = setcorner(p, i+1, j, k+1); + if(newc.corners[6]==NULL) newc.corners[6] = setcorner(p, i+1, j+1, k); + if(newc.corners[7]==NULL) newc.corners[7] = setcorner(p, i+1, j+1, k+1); p->cubes->cube= newc; } @@ -1031,7 +1031,7 @@ void makecubetable (void) for (c = 0; c < 8; c++) pos[c] = MB_BIT(i, c); for (e = 0; e < 12; e++) if (!done[e] && (pos[corner1[e]] != pos[corner2[e]])) { - INTLIST *ints = 0; + INTLIST *ints = NULL; INTLISTS *lists = (INTLISTS *) MEM_callocN(sizeof(INTLISTS), "mball_intlist"); int start = e, edge = e; @@ -1080,7 +1080,7 @@ void BKE_freecubetable(void) MEM_freeN(lists); lists= nlists; } - cubetable[i]= 0; + cubetable[i]= NULL; } } @@ -1594,7 +1594,7 @@ float init_meta(Scene *scene, Object *ob) /* return totsize */ BLI_split_name_num(obname, &obnr, ob->id.name+2, '.'); /* make main array */ - next_object(&sce_iter, 0, 0, 0); + next_object(&sce_iter, 0, NULL, NULL); while(next_object(&sce_iter, 1, &base, &bob)) { if(bob->type==OB_MBALL) { @@ -2174,7 +2174,7 @@ void metaball_polygonize(Scene *scene, Object *ob, ListBase *dispbase) if(G.moving && mb->flag==MB_UPDATE_FAST) return; curindex= totindex= 0; - indices= 0; + indices= NULL; thresh= mb->thresh; /* total number of MetaElems (totelem) is precomputed in find_basis_mball() function */ @@ -2229,7 +2229,7 @@ void metaball_polygonize(Scene *scene, Object *ob, ListBase *dispbase) mbproc.function = metaball; mbproc.size = width; mbproc.bounds = nr_cubes; - mbproc.cubes= 0; + mbproc.cubes= NULL; mbproc.delta = width/(float)(RES*RES); polygonize(&mbproc, mb); @@ -2251,7 +2251,7 @@ void metaball_polygonize(Scene *scene, Object *ob, ListBase *dispbase) dl->parts= curindex; dl->index= indices; - indices= 0; + indices= NULL; a= mbproc.vertices.count; dl->verts= ve= MEM_mallocN(sizeof(float)*3*a, "mballverts"); diff --git a/source/blender/blenkernel/intern/mesh.c b/source/blender/blenkernel/intern/mesh.c index dc4838366c4..3c56cb4663b 100644 --- a/source/blender/blenkernel/intern/mesh.c +++ b/source/blender/blenkernel/intern/mesh.c @@ -98,11 +98,11 @@ void unlink_mesh(Mesh *me) { int a; - if(me==0) return; + if(me==NULL) return; for(a=0; a<me->totcol; a++) { if(me->mat[a]) me->mat[a]->id.us--; - me->mat[a]= 0; + me->mat[a]= NULL; } if(me->key) { @@ -110,9 +110,9 @@ void unlink_mesh(Mesh *me) if (me->key->id.us == 0 && me->key->ipo ) me->key->ipo->id.us--; } - me->key= 0; + me->key= NULL; - if(me->texcomesh) me->texcomesh= 0; + if(me->texcomesh) me->texcomesh= NULL; } @@ -255,9 +255,9 @@ void make_local_tface(Mesh *me) if(tface->tpage) { ima= tface->tpage; if(ima->id.lib) { - ima->id.lib= 0; + ima->id.lib= NULL; ima->id.flag= LIB_LOCAL; - new_id(0, (ID *)ima, 0); + new_id(NULL, (ID *)ima, NULL); } } } @@ -277,11 +277,11 @@ void make_local_mesh(Mesh *me) * - mixed: make copy */ - if(me->id.lib==0) return; + if(me->id.lib==NULL) return; if(me->id.us==1) { - me->id.lib= 0; + me->id.lib= NULL; me->id.flag= LIB_LOCAL; - new_id(0, (ID *)me, 0); + new_id(NULL, (ID *)me, NULL); if(me->mtface) make_local_tface(me); @@ -298,9 +298,9 @@ void make_local_mesh(Mesh *me) } if(local && lib==0) { - me->id.lib= 0; + me->id.lib= NULL; me->id.flag= LIB_LOCAL; - new_id(0, (ID *)me, 0); + new_id(NULL, (ID *)me, NULL); if(me->mtface) make_local_tface(me); @@ -312,7 +312,7 @@ void make_local_mesh(Mesh *me) ob= bmain->object.first; while(ob) { if( me==get_mesh(ob) ) { - if(ob->id.lib==0) { + if(ob->id.lib==NULL) { set_mesh(ob, men); } } @@ -327,7 +327,7 @@ void boundbox_mesh(Mesh *me, float *loc, float *size) float min[3], max[3]; float mloc[3], msize[3]; - if(me->bb==0) me->bb= MEM_callocN(sizeof(BoundBox), "boundbox"); + if(me->bb==NULL) me->bb= MEM_callocN(sizeof(BoundBox), "boundbox"); bb= me->bb; if (!loc) loc= mloc; @@ -444,7 +444,7 @@ int test_index_face(MFace *mface, CustomData *fdata, int mfindex, int nr) mface->v4= 0; nr--; } - if(mface->v2 && mface->v2==mface->v3) { + if((mface->v2 || mface->v4) && mface->v2==mface->v3) { mface->v3= mface->v4; mface->v4= 0; nr--; @@ -456,6 +456,32 @@ int test_index_face(MFace *mface, CustomData *fdata, int mfindex, int nr) nr--; } + /* check corrupt cases, bowtie geometry, cant handle these because edge data wont exist so just return 0 */ + if(nr==3) { + if( + /* real edges */ + mface->v1==mface->v2 || + mface->v2==mface->v3 || + mface->v3==mface->v1 + ) { + return 0; + } + } + else if(nr==4) { + if( + /* real edges */ + mface->v1==mface->v2 || + mface->v2==mface->v3 || + mface->v3==mface->v4 || + mface->v4==mface->v1 || + /* across the face */ + mface->v1==mface->v3 || + mface->v2==mface->v4 + ) { + return 0; + } + } + /* prevent a zero at wrong index location */ if(nr==3) { if(mface->v3==0) { @@ -486,18 +512,18 @@ int test_index_face(MFace *mface, CustomData *fdata, int mfindex, int nr) Mesh *get_mesh(Object *ob) { - if(ob==0) return 0; + if(ob==NULL) return NULL; if(ob->type==OB_MESH) return ob->data; - else return 0; + else return NULL; } void set_mesh(Object *ob, Mesh *me) { - Mesh *old=0; + Mesh *old=NULL; multires_force_update(ob); - if(ob==0) return; + if(ob==NULL) return; if(ob->type==OB_MESH) { old= ob->data; @@ -678,6 +704,23 @@ void mesh_strip_loose_faces(Mesh *me) me->totface = b; } +void mesh_strip_loose_edges(Mesh *me) +{ + int a,b; + + for (a=b=0; a<me->totedge; a++) { + if (me->medge[a].v1!=me->medge[a].v2) { + if (a!=b) { + memcpy(&me->medge[b],&me->medge[a],sizeof(me->medge[b])); + CustomData_copy_data(&me->edata, &me->edata, a, b, 1); + CustomData_free_elem(&me->edata, a, 1); + } + b++; + } + } + me->totedge = b; +} + void mball_to_mesh(ListBase *lb, Mesh *me) { DispList *dl; @@ -687,7 +730,7 @@ void mball_to_mesh(ListBase *lb, Mesh *me) int a, *index; dl= lb->first; - if(dl==0) return; + if(dl==NULL) return; if(dl->type==DL_INDEX4) { me->totvert= dl->nr; @@ -789,7 +832,7 @@ int nurbs_to_mdata_customdb(Object *ob, ListBase *dispbase, MVert **allvert, int } *allvert= mvert= MEM_callocN(sizeof (MVert) * totvert, "nurbs_init mvert"); - *allface= mface= MEM_callocN(sizeof (MVert) * totvert, "nurbs_init mface"); + *allface= mface= MEM_callocN(sizeof (MVert) * totvlak, "nurbs_init mface"); /* verts and faces */ vertcount= 0; @@ -980,7 +1023,7 @@ void nurbs_to_mesh(Object *ob) tex_space_mesh(me); - cu->mat= 0; + cu->mat= NULL; cu->totcol= 0; if(ob->data) { @@ -1513,7 +1556,10 @@ int mesh_center_median(Mesh *me, float cent[3]) for(mvert= me->mvert; i--; mvert++) { add_v3_v3(cent, mvert->co); } - mul_v3_fl(cent, 1.0f/(float)me->totvert); + /* otherwise we get NAN for 0 verts */ + if(me->totvert) { + mul_v3_fl(cent, 1.0f/(float)me->totvert); + } return (me->totvert != 0); } diff --git a/source/blender/blenkernel/intern/mesh_validate.c b/source/blender/blenkernel/intern/mesh_validate.c new file mode 100644 index 00000000000..e5aacdf2cf9 --- /dev/null +++ b/source/blender/blenkernel/intern/mesh_validate.c @@ -0,0 +1,379 @@ +/** + * $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. + * + * ***** END GPL LICENSE BLOCK ***** + */ + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <limits.h> + +#include "DNA_mesh_types.h" +#include "DNA_meshdata_types.h" + +#include "BLO_sys_types.h" + +#include "BLI_utildefines.h" +#include "BLI_edgehash.h" + +#include "BKE_DerivedMesh.h" + +#include "MEM_guardedalloc.h" + +#include "BKE_mesh.h" + +#define SELECT 1 + +typedef union { + uint32_t verts[2]; + int64_t edval; +} EdgeUUID; + +typedef struct SortFace { +// unsigned int v[4]; + EdgeUUID es[4]; + unsigned int index; +} SortFace; + +static void edge_store_assign(uint32_t verts[2], const uint32_t v1, const uint32_t v2) +{ + if(v1 < v2) { + verts[0]= v1; + verts[1]= v2; + } + else { + verts[0]= v2; + verts[1]= v1; + } +} + +static void edge_store_from_mface_quad(EdgeUUID es[4], MFace *mf) +{ + edge_store_assign(es[0].verts, mf->v1, mf->v2); + edge_store_assign(es[1].verts, mf->v2, mf->v3); + edge_store_assign(es[2].verts, mf->v3, mf->v4); + edge_store_assign(es[3].verts, mf->v4, mf->v1); +} + +static void edge_store_from_mface_tri(EdgeUUID es[3], MFace *mf) +{ + edge_store_assign(es[0].verts, mf->v1, mf->v2); + edge_store_assign(es[1].verts, mf->v2, mf->v3); + edge_store_assign(es[2].verts, mf->v3, mf->v1); + es[3].verts[0] = es[3].verts[1] = UINT_MAX; +} + +static int int64_cmp(const void *v1, const void *v2) +{ + const int64_t x1= *(const int64_t *)v1; + const int64_t x2= *(const int64_t *)v2; + + if( x1 > x2 ) return 1; + else if( x1 < x2 ) return -1; + return 0; +} + +static int search_face_cmp(const void *v1, const void *v2) +{ + const SortFace *sfa= v1, *sfb= v2; + + if (sfa->es[0].edval > sfb->es[0].edval) return 1; + else if (sfa->es[0].edval < sfb->es[0].edval) return -1; + + else if (sfa->es[1].edval > sfb->es[1].edval) return 1; + else if (sfa->es[1].edval < sfb->es[1].edval) return -1; + + else if (sfa->es[2].edval > sfb->es[2].edval) return 1; + else if (sfa->es[2].edval < sfb->es[2].edval) return -1; + + else if (sfa->es[3].edval > sfb->es[3].edval) return 1; + else if (sfa->es[3].edval < sfb->es[3].edval) return -1; + else return 0; + +} + +int BKE_mesh_validate_arrays(Mesh *me, MVert *UNUSED(mverts), int totvert, MEdge *medges, int totedge, MFace *mfaces, int totface, const short do_verbose, const short do_fixes) +{ +# define PRINT if(do_verbose) printf +# define REMOVE_EDGE_TAG(_med) { _med->v2= _med->v1; do_edge_free= 1; } +# define REMOVE_FACE_TAG(_mf) { _mf->v3=0; do_face_free= 1; } + +// MVert *mv; + MEdge *med; + MFace *mf; + MFace *mf_prev; + int i; + + int do_face_free= FALSE; + int do_edge_free= FALSE; + + int do_edge_recalc= FALSE; + + EdgeHash *edge_hash = BLI_edgehash_new(); + + SortFace *sort_faces= MEM_callocN(sizeof(SortFace) * totface, "search faces"); + SortFace *sf; + SortFace *sf_prev; + int totsortface= 0; + + BLI_assert(!(do_fixes && me == NULL)); + + PRINT("ED_mesh_validate: verts(%d), edges(%d), faces(%d)\n", totvert, totedge, totface); + + if(totedge == 0 && totface != 0) { + PRINT(" locical error, %d faces and 0 edges\n", totface); + do_edge_recalc= TRUE; + } + + for(i=0, med= medges; i<totedge; i++, med++) { + int remove= FALSE; + if(med->v1 == med->v2) { + PRINT(" edge %d: has matching verts, both %d\n", i, med->v1); + remove= do_fixes; + } + if(med->v1 >= totvert) { + PRINT(" edge %d: v1 index out of range, %d\n", i, med->v1); + remove= do_fixes; + } + if(med->v2 >= totvert) { + PRINT(" edge %d: v2 index out of range, %d\n", i, med->v2); + remove= do_fixes; + } + + if(BLI_edgehash_haskey(edge_hash, med->v1, med->v2)) { + PRINT(" edge %d: is a duplicate of, %d\n", i, GET_INT_FROM_POINTER(BLI_edgehash_lookup(edge_hash, med->v1, med->v2))); + remove= do_fixes; + } + + if(remove == FALSE){ + BLI_edgehash_insert(edge_hash, med->v1, med->v2, SET_INT_IN_POINTER(i)); + } + else { + REMOVE_EDGE_TAG(med); + } + } + + for(i=0, mf=mfaces, sf=sort_faces; i<totface; i++, mf++) { + int remove= FALSE; + int fidx; + unsigned int fv[4]; + + fidx = mf->v4 ? 3:2; + do { + fv[fidx]= *(&(mf->v1) + fidx); + if(fv[fidx] >= totvert) { + PRINT(" face %d: 'v%d' index out of range, %d\n", i, fidx + 1, fv[fidx]); + remove= do_fixes; + } + } while (fidx--); + + if(remove == FALSE) { + if(mf->v4) { + if(mf->v1 == mf->v2) { PRINT(" face %d: verts invalid, v1/v2 both %d\n", i, mf->v1); remove= do_fixes; } + if(mf->v1 == mf->v3) { PRINT(" face %d: verts invalid, v1/v3 both %d\n", i, mf->v1); remove= do_fixes; } + if(mf->v1 == mf->v4) { PRINT(" face %d: verts invalid, v1/v4 both %d\n", i, mf->v1); remove= do_fixes; } + + if(mf->v2 == mf->v3) { PRINT(" face %d: verts invalid, v2/v3 both %d\n", i, mf->v2); remove= do_fixes; } + if(mf->v2 == mf->v4) { PRINT(" face %d: verts invalid, v2/v4 both %d\n", i, mf->v2); remove= do_fixes; } + + if(mf->v3 == mf->v4) { PRINT(" face %d: verts invalid, v3/v4 both %d\n", i, mf->v3); remove= do_fixes; } + } + else { + if(mf->v1 == mf->v2) { PRINT(" faceT %d: verts invalid, v1/v2 both %d\n", i, mf->v1); remove= do_fixes; } + if(mf->v1 == mf->v3) { PRINT(" faceT %d: verts invalid, v1/v3 both %d\n", i, mf->v1); remove= do_fixes; } + + if(mf->v2 == mf->v3) { PRINT(" faceT %d: verts invalid, v2/v3 both %d\n", i, mf->v2); remove= do_fixes; } + } + + if(remove == FALSE) { + if(totedge) { + if(mf->v4) { + if(!BLI_edgehash_haskey(edge_hash, mf->v1, mf->v2)) { PRINT(" face %d: edge v1/v2 (%d,%d) is missing egde data\n", i, mf->v1, mf->v2); do_edge_recalc= TRUE; } + if(!BLI_edgehash_haskey(edge_hash, mf->v2, mf->v3)) { PRINT(" face %d: edge v2/v3 (%d,%d) is missing egde data\n", i, mf->v2, mf->v3); do_edge_recalc= TRUE; } + if(!BLI_edgehash_haskey(edge_hash, mf->v3, mf->v4)) { PRINT(" face %d: edge v3/v4 (%d,%d) is missing egde data\n", i, mf->v3, mf->v4); do_edge_recalc= TRUE; } + if(!BLI_edgehash_haskey(edge_hash, mf->v4, mf->v1)) { PRINT(" face %d: edge v4/v1 (%d,%d) is missing egde data\n", i, mf->v4, mf->v1); do_edge_recalc= TRUE; } + } + else { + if(!BLI_edgehash_haskey(edge_hash, mf->v1, mf->v2)) { PRINT(" face %d: edge v1/v2 (%d,%d) is missing egde data\n", i, mf->v1, mf->v2); do_edge_recalc= TRUE; } + if(!BLI_edgehash_haskey(edge_hash, mf->v2, mf->v3)) { PRINT(" face %d: edge v2/v3 (%d,%d) is missing egde data\n", i, mf->v2, mf->v3); do_edge_recalc= TRUE; } + if(!BLI_edgehash_haskey(edge_hash, mf->v3, mf->v1)) { PRINT(" face %d: edge v3/v1 (%d,%d) is missing egde data\n", i, mf->v3, mf->v1); do_edge_recalc= TRUE; } + } + } + + sf->index = i; + + if(mf->v4) { + edge_store_from_mface_quad(sf->es, mf); + + qsort(sf->es, 4, sizeof(int64_t), int64_cmp); + } + else { + edge_store_from_mface_tri(sf->es, mf); + qsort(sf->es, 3, sizeof(int64_t), int64_cmp); + } + + totsortface++; + sf++; + } + } + if(remove) { + REMOVE_FACE_TAG(mf); + } + } + + qsort(sort_faces, totsortface, sizeof(SortFace), search_face_cmp); + + sf= sort_faces; + sf_prev= sf; + sf++; + + for(i=1; i<totsortface; i++, sf++) { + int remove= FALSE; + /* on a valid mesh, code below will never run */ + if(memcmp(sf->es, sf_prev->es, sizeof(sf_prev->es)) == 0) { + mf= mfaces + sf->index; + + if(do_verbose) { + mf_prev= mfaces + sf_prev->index; + if(mf->v4) { + PRINT(" face %d & %d: are duplicates (%d,%d,%d,%d) (%d,%d,%d,%d)\n", sf->index, sf_prev->index, mf->v1, mf->v2, mf->v3, mf->v4, mf_prev->v1, mf_prev->v2, mf_prev->v3, mf_prev->v4); + } + else { + PRINT(" face %d & %d: are duplicates (%d,%d,%d) (%d,%d,%d)\n", sf->index, sf_prev->index, mf->v1, mf->v2, mf->v3, mf_prev->v1, mf_prev->v2, mf_prev->v3); + } + } + + remove= do_fixes; + } + else { + sf_prev= sf; + } + + if(remove) { + REMOVE_FACE_TAG(mf); + } + } + + BLI_edgehash_free(edge_hash, NULL); + MEM_freeN(sort_faces); + + PRINT("BKE_mesh_validate: finished\n\n"); + +# undef PRINT +# undef REMOVE_EDGE_TAG +# undef REMOVE_FACE_TAG + + if(me) { + if(do_face_free) { + mesh_strip_loose_faces(me); + } + + if (do_edge_free) { + mesh_strip_loose_edges(me); + } + + if(do_fixes && do_edge_recalc) { + BKE_mesh_calc_edges(me, TRUE); + } + } + + return (do_face_free || do_edge_free || do_edge_recalc); +} + +int BKE_mesh_validate(Mesh *me, int do_verbose) +{ + printf("MESH: %s\n", me->id.name+2); + return BKE_mesh_validate_arrays(me, me->mvert, me->totvert, me->medge, me->totedge, me->mface, me->totface, do_verbose, TRUE); +} + +int BKE_mesh_validate_dm(DerivedMesh *dm) +{ + return BKE_mesh_validate_arrays(NULL, dm->getVertArray(dm), dm->getNumVerts(dm), dm->getEdgeArray(dm), dm->getNumEdges(dm), dm->getFaceArray(dm), dm->getNumFaces(dm), TRUE, FALSE); +} + +void BKE_mesh_calc_edges(Mesh *mesh, int update) +{ + CustomData edata; + EdgeHashIterator *ehi; + MFace *mf = mesh->mface; + MEdge *med, *med_orig; + EdgeHash *eh = BLI_edgehash_new(); + int i, totedge, totface = mesh->totface; + + if(mesh->totedge==0) + update= 0; + + if(update) { + /* assume existing edges are valid + * useful when adding more faces and generating edges from them */ + med= mesh->medge; + for(i= 0; i<mesh->totedge; i++, med++) + BLI_edgehash_insert(eh, med->v1, med->v2, med); + } + + for (i = 0; i < totface; i++, mf++) { + if (!BLI_edgehash_haskey(eh, mf->v1, mf->v2)) + BLI_edgehash_insert(eh, mf->v1, mf->v2, NULL); + if (!BLI_edgehash_haskey(eh, mf->v2, mf->v3)) + BLI_edgehash_insert(eh, mf->v2, mf->v3, NULL); + + if (mf->v4) { + if (!BLI_edgehash_haskey(eh, mf->v3, mf->v4)) + BLI_edgehash_insert(eh, mf->v3, mf->v4, NULL); + if (!BLI_edgehash_haskey(eh, mf->v4, mf->v1)) + BLI_edgehash_insert(eh, mf->v4, mf->v1, NULL); + } else { + if (!BLI_edgehash_haskey(eh, mf->v3, mf->v1)) + BLI_edgehash_insert(eh, mf->v3, mf->v1, NULL); + } + } + + totedge = BLI_edgehash_size(eh); + + /* write new edges into a temporary CustomData */ + memset(&edata, 0, sizeof(edata)); + CustomData_add_layer(&edata, CD_MEDGE, CD_CALLOC, NULL, totedge); + + ehi = BLI_edgehashIterator_new(eh); + med = CustomData_get_layer(&edata, CD_MEDGE); + for(i = 0; !BLI_edgehashIterator_isDone(ehi); + BLI_edgehashIterator_step(ehi), ++i, ++med) { + + if(update && (med_orig=BLI_edgehashIterator_getValue(ehi))) { + *med= *med_orig; /* copy from the original */ + } else { + BLI_edgehashIterator_getKey(ehi, (int*)&med->v1, (int*)&med->v2); + med->flag = ME_EDGEDRAW|ME_EDGERENDER|SELECT; /* select for newly created meshes which are selected [#25595] */ + } + } + BLI_edgehashIterator_free(ehi); + + /* free old CustomData and assign new one */ + CustomData_free(&mesh->edata, mesh->totedge); + mesh->edata = edata; + mesh->totedge = totedge; + + mesh->medge = CustomData_get_layer(&mesh->edata, CD_MEDGE); + + BLI_edgehash_free(eh, NULL); +} diff --git a/source/blender/blenkernel/intern/modifier.c b/source/blender/blenkernel/intern/modifier.c index 03091b9b0a4..db0c649d290 100644 --- a/source/blender/blenkernel/intern/modifier.c +++ b/source/blender/blenkernel/intern/modifier.c @@ -57,7 +57,7 @@ ModifierTypeInfo *modifierType_getInfo(ModifierType type) { - static ModifierTypeInfo *types[NUM_MODIFIER_TYPES]; + static ModifierTypeInfo *types[NUM_MODIFIER_TYPES]= {NULL}; static int types_init = 1; if (types_init) { @@ -220,12 +220,13 @@ int modifier_sameTopology(ModifierData *md) void modifier_setError(ModifierData *md, const char *format, ...) { - char buffer[2048]; + char buffer[512]; va_list ap; va_start(ap, format); - vsprintf(buffer, format, ap); + vsnprintf(buffer, sizeof(buffer), format, ap); va_end(ap); + buffer[sizeof(buffer) - 1]= '\0'; if (md->error) MEM_freeN(md->error); diff --git a/source/blender/blenkernel/intern/multires.c b/source/blender/blenkernel/intern/multires.c index 2a3052d10c9..29726ccbc99 100644 --- a/source/blender/blenkernel/intern/multires.c +++ b/source/blender/blenkernel/intern/multires.c @@ -449,7 +449,7 @@ void multiresModifier_del_levels(MultiresModifierData *mmd, Object *ob, int dire static DerivedMesh *multires_dm_create_local(Object *ob, DerivedMesh *dm, int lvl, int totlvl, int simple) { - MultiresModifierData mmd= {{0}}; + MultiresModifierData mmd= {{NULL}}; mmd.lvl = lvl; mmd.sculptlvl = lvl; @@ -462,7 +462,7 @@ static DerivedMesh *multires_dm_create_local(Object *ob, DerivedMesh *dm, int lv static DerivedMesh *subsurf_dm_create_local(Object *UNUSED(ob), DerivedMesh *dm, int lvl, int simple, int optimal) { - SubsurfModifierData smd= {{0}}; + SubsurfModifierData smd= {{NULL}}; smd.levels = smd.renderLevels = lvl; smd.flags |= eSubsurfModifierFlag_SubsurfUv; @@ -596,7 +596,7 @@ void multiresModifier_base_apply(MultiresModifierData *mmd, Object *ob) dispdm->release(dispdm); } -void multires_subdivide(MultiresModifierData *mmd, Object *ob, int totlvl, int updateblock, int simple) +static void multires_subdivide(MultiresModifierData *mmd, Object *ob, int totlvl, int updateblock, int simple) { Mesh *me = ob->data; MDisps *mdisps; @@ -962,7 +962,7 @@ DerivedMesh *multires_dm_create_from_derived(MultiresModifierData *mmd, int loca ***************************/ /* Adapted from sculptmode.c */ -void old_mdisps_bilinear(float out[3], float (*disps)[3], int st, float u, float v) +void old_mdisps_bilinear(float out[3], float (*disps)[3], const int st, float u, float v) { int x, y, x2, y2; const int st_max = st - 1; @@ -1591,7 +1591,7 @@ static void multires_sync_levels(Scene *scene, Object *ob, Object *to_ob) else multires_subdivide(mmd, ob, to_mmd->totlvl, 0, mmd->simple); } -void multires_apply_smat(Scene *scene, Object *ob, float smat[3][3]) +static void multires_apply_smat(Scene *scene, Object *ob, float smat[3][3]) { DerivedMesh *dm= NULL, *cddm= NULL, *subdm= NULL; DMGridData **gridData, **subGridData; @@ -1965,7 +1965,7 @@ static void face_to_crn_interp(float u, float v, float v1[2], float v2[2], float *x = maxf(x1, x2); } -void mdisp_rot_crn_to_face(int S, int corners, int face_side, float x, float y, float *u, float *v) +void mdisp_rot_crn_to_face(const int S, const int corners, const int face_side, const float x, const float y, float *u, float *v) { float offset = face_side*0.5f - 0.5f; @@ -1992,9 +1992,9 @@ void mdisp_rot_crn_to_face(int S, int corners, int face_side, float x, float y, } } -int mdisp_rot_face_to_crn(int corners, int face_side, float u, float v, float *x, float *y) +int mdisp_rot_face_to_crn(const int corners, const int face_side, const float u, const float v, float *x, float *y) { - float offset = face_side*0.5f - 0.5f; + const float offset = face_side*0.5f - 0.5f; int S = 0; if (corners == 4) { @@ -2037,7 +2037,7 @@ int mdisp_rot_face_to_crn(int corners, int face_side, float u, float v, float *x return S; } -void mdisp_apply_weight(int S, int corners, int x, int y, int face_side, +void mdisp_apply_weight(const int S, const int corners, int x, int y, const int face_side, float crn_weight[4][2], float *u_r, float *v_r) { float u, v, xl, yl; @@ -2071,7 +2071,7 @@ void mdisp_apply_weight(int S, int corners, int x, int y, int face_side, *v_r = mid3[1]; } -void mdisp_flip_disp(int S, int corners, float axis_x[2], float axis_y[2], float disp[3]) +void mdisp_flip_disp(const int S, const int corners, const float axis_x[2], const float axis_y[2], float disp[3]) { float crn_x[2], crn_y[2]; float vx[2], vy[2], coord[2]; diff --git a/source/blender/blenkernel/intern/nla.c b/source/blender/blenkernel/intern/nla.c index 6db03909aa3..da0f3f8a448 100644 --- a/source/blender/blenkernel/intern/nla.c +++ b/source/blender/blenkernel/intern/nla.c @@ -1320,7 +1320,7 @@ static void nlastrip_get_endpoint_overlaps (NlaStrip *strip, NlaTrack *track, fl } /* Determine auto-blending for the given strip */ -void BKE_nlastrip_validate_autoblends (NlaTrack *nlt, NlaStrip *nls) +static void BKE_nlastrip_validate_autoblends (NlaTrack *nlt, NlaStrip *nls) { float *ps=NULL, *pe=NULL; float *ns=NULL, *ne=NULL; @@ -1576,7 +1576,7 @@ void BKE_nla_tweakmode_exit (AnimData *adt) /* Baking Tools ------------------------------------------- */ -void BKE_nla_bake (Scene *scene, ID *UNUSED(id), AnimData *adt, int UNUSED(flag)) +static void BKE_nla_bake (Scene *scene, ID *UNUSED(id), AnimData *adt, int UNUSED(flag)) { /* verify that data is valid diff --git a/source/blender/blenkernel/intern/node.c b/source/blender/blenkernel/intern/node.c index 85c82dbf9bc..057d90dc8bb 100644 --- a/source/blender/blenkernel/intern/node.c +++ b/source/blender/blenkernel/intern/node.c @@ -43,6 +43,7 @@ #include "BKE_animsys.h" #include "BKE_action.h" #include "BKE_fcurve.h" +#include "BKE_node.h" #include "BKE_utildefines.h" #include "PIL_time.h" @@ -264,22 +265,23 @@ void ntreeVerifyTypes(bNodeTree *ntree) /* ************** Group stuff ********** */ -bNodeType node_group_typeinfo= { - /* next,prev */ NULL, NULL, - /* type code */ NODE_GROUP, - /* name */ "Group", - /* width+range */ 120, 60, 200, - /* class+opts */ NODE_CLASS_GROUP, NODE_OPTIONS, - /* input sock */ NULL, - /* output sock */ NULL, - /* storage */ "", - /* execfunc */ NULL, - /* butfunc */ NULL, - /* initfunc */ NULL, - /* freestoragefunc */ NULL, - /* copystoragefunc */ NULL, - /* id */ NULL -}; +/* XXX group typeinfo struct is used directly in ntreeMakeOwnType, needs cleanup */ +static bNodeType ntype_group; + +/* groups display their internal tree name as label */ +static const char *group_label(bNode *node) +{ + return node->id->name+2; +} + +void register_node_type_group(ListBase *lb) +{ + node_type_base(&ntype_group, NODE_GROUP, "Group", NODE_CLASS_GROUP, NODE_OPTIONS, NULL, NULL); + node_type_size(&ntype_group, 120, 60, 200); + node_type_label(&ntype_group, group_label); + + nodeRegisterType(lb, &ntype_group); +} /* tag internal sockets */ static void group_tag_internal_sockets(bNodeTree *ngroup) @@ -379,7 +381,7 @@ void ntreeMakeOwnType(bNodeTree *ngroup) /* make own type struct */ ngroup->owntype= MEM_callocN(sizeof(bNodeType), "group type"); - *ngroup->owntype= node_group_typeinfo; /* copy data, for init */ + *ngroup->owntype= ntype_group; /* copy data, for init */ /* input type arrays */ if(totin) { @@ -824,7 +826,7 @@ int nodeGroupUnGroup(bNodeTree *ntree, bNode *gnode) * - all of wgroup's nodes are transferred across to their new home * - ngroup (i.e. the source NodeTree) is left unscathed */ - wgroup= ntreeCopyTree(ngroup, 0); + wgroup= ntreeCopyTree(ngroup); /* add the nodes into the ntree */ for(node= wgroup->nodes.first; node; node= nextn) { @@ -924,7 +926,7 @@ void nodeCopyGroup(bNode *gnode) bNodeSocket *sock; gnode->id->us--; - gnode->id= (ID *)ntreeCopyTree((bNodeTree *)gnode->id, 0); + gnode->id= (ID *)ntreeCopyTree((bNodeTree *)gnode->id); /* new_sock was set in nodeCopyNode */ for(sock=gnode->inputs.first; sock; sock=sock->next) @@ -1189,12 +1191,11 @@ bNodeTree *ntreeAddTree(const char *name, int type, const short is_group) } /* Warning: this function gets called during some rather unexpected times - * - internal_select is only 1 when used for duplicating selected nodes (i.e. Shift-D duplicate operator) * - this gets called when executing compositing updates (for threaded previews) * - when the nodetree datablock needs to be copied (i.e. when users get copied) * - for scene duplication use ntreeSwapID() after so we dont have stale pointers. */ -bNodeTree *ntreeCopyTree(bNodeTree *ntree, int internal_select) +bNodeTree *ntreeCopyTree(bNodeTree *ntree) { bNodeTree *newtree; bNode *node, *nnode, *last; @@ -1204,34 +1205,26 @@ bNodeTree *ntreeCopyTree(bNodeTree *ntree, int internal_select) if(ntree==NULL) return NULL; - if(internal_select==0) { - /* is ntree part of library? */ - for(newtree=G.main->nodetree.first; newtree; newtree= newtree->id.next) - if(newtree==ntree) break; - if(newtree) { - newtree= copy_libblock(ntree); - } else { - newtree= MEM_dupallocN(ntree); - copy_libblock_data(&newtree->id, &ntree->id, TRUE); /* copy animdata and ID props */ - } - newtree->nodes.first= newtree->nodes.last= NULL; - newtree->links.first= newtree->links.last= NULL; + /* is ntree part of library? */ + for(newtree=G.main->nodetree.first; newtree; newtree= newtree->id.next) + if(newtree==ntree) break; + if(newtree) { + newtree= copy_libblock(ntree); + } else { + newtree= MEM_dupallocN(ntree); + copy_libblock_data(&newtree->id, &ntree->id, TRUE); /* copy animdata and ID props */ } - else - newtree= ntree; + newtree->nodes.first= newtree->nodes.last= NULL; + newtree->links.first= newtree->links.last= NULL; - last= ntree->nodes.last; + last = ntree->nodes.last; for(node= ntree->nodes.first; node; node= node->next) { - node->new_node= NULL; - if(internal_select==0 || (node->flag & NODE_SELECT)) { - nnode= nodeCopyNode(newtree, node, internal_select); /* sets node->new */ - if(internal_select) { - node->flag &= ~(NODE_SELECT|NODE_ACTIVE); - nnode->flag |= NODE_SELECT; - } - } - if(node==last) break; + nnode= nodeCopyNode(newtree, node, 0); /* sets node->new */ + + /* make sure we don't copy new nodes again! */ + if (node==last) + break; } /* check for copying links */ @@ -1255,15 +1248,14 @@ bNodeTree *ntreeCopyTree(bNodeTree *ntree, int internal_select) } /* own type definition for group usage */ - if(internal_select==0) { - if(ntree->owntype) { - newtree->owntype= MEM_dupallocN(ntree->owntype); - if(ntree->owntype->inputs) - newtree->owntype->inputs= MEM_dupallocN(ntree->owntype->inputs); - if(ntree->owntype->outputs) - newtree->owntype->outputs= MEM_dupallocN(ntree->owntype->outputs); - } + if(ntree->owntype) { + newtree->owntype= MEM_dupallocN(ntree->owntype); + if(ntree->owntype->inputs) + newtree->owntype->inputs= MEM_dupallocN(ntree->owntype->inputs); + if(ntree->owntype->outputs) + newtree->owntype->outputs= MEM_dupallocN(ntree->owntype->outputs); } + /* weird this is required... there seem to be link pointers wrong still? */ /* anyhoo, doing this solves crashes on copying entire tree (copy scene) and delete nodes */ ntreeSolveOrder(newtree); @@ -1507,9 +1499,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; } @@ -1567,11 +1559,11 @@ void ntreeMakeLocal(bNodeTree *ntree) if(local && 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(local && lib) { /* this is the mixed case, we copy the tree and assign it to local users */ - bNodeTree *newtree= ntreeCopyTree(ntree, 0); + bNodeTree *newtree= ntreeCopyTree(ntree); newtree->id.us= 0; @@ -2445,7 +2437,7 @@ static void *exec_composite_node(void *node_v) } node->exec |= NODE_READY; - return 0; + return NULL; } /* return total of executable nodes, for timecursor */ @@ -2739,7 +2731,7 @@ bNodeTree *ntreeLocalize(bNodeTree *ntree) } /* node copy func */ - ltree= ntreeCopyTree(ntree, 0); + ltree= ntreeCopyTree(ntree); if(adt) { AnimData *ladt= BKE_animdata_from_id(<ree->id); @@ -3181,10 +3173,7 @@ int ntreeCompositTagAnimated(bNodeTree *ntree) NodeTagChanged(ntree, node); tagged= 1; } - else if(node->type==CMP_NODE_R_LAYERS) { - NodeTagChanged(ntree, node); - tagged= 1; - } + /* here was tag render layer, but this is called after a render, so re-composites fail */ else if(node->type==NODE_GROUP) { if( ntreeCompositTagAnimated((bNodeTree *)node->id) ) { NodeTagChanged(ntree, node); @@ -3209,6 +3198,21 @@ void ntreeCompositTagGenerators(bNodeTree *ntree) } } +/* XXX after render animation system gets a refresh, this call allows composite to end clean */ +void ntreeClearTags(bNodeTree *ntree) +{ + bNode *node; + + if(ntree==NULL) return; + + for(node= ntree->nodes.first; node; node= node->next) { + node->need_exec= 0; + if(node->type==NODE_GROUP) + ntreeClearTags((bNodeTree *)node->id); + } +} + + int ntreeTexTagAnimated(bNodeTree *ntree) { bNode *node; @@ -3232,6 +3236,62 @@ int ntreeTexTagAnimated(bNodeTree *ntree) /* ************* node definition init ********** */ +void node_type_base(bNodeType *ntype, int type, const char *name, short nclass, short flag, + struct bNodeSocketType *inputs, struct bNodeSocketType *outputs) +{ + memset(ntype, 0, sizeof(bNodeType)); + + ntype->type = type; + ntype->name = name; + ntype->nclass = nclass; + ntype->flag = flag; + + ntype->inputs = inputs; + ntype->outputs = outputs; + + /* default size values */ + ntype->width = 140; + ntype->minwidth = 100; + ntype->maxwidth = 320; +} + +void node_type_init(bNodeType *ntype, void (*initfunc)(struct bNode *)) +{ + ntype->initfunc = initfunc; +} + +void node_type_size(struct bNodeType *ntype, int width, int minwidth, int maxwidth) +{ + ntype->width = width; + ntype->minwidth = minwidth; + ntype->maxwidth = maxwidth; +} + +void node_type_storage(bNodeType *ntype, const char *storagename, void (*freestoragefunc)(struct bNode *), void (*copystoragefunc)(struct bNode *, struct bNode *)) +{ + if (storagename) + strncpy(ntype->storagename, storagename, sizeof(ntype->storagename)); + else + ntype->storagename[0] = '\0'; + ntype->copystoragefunc = copystoragefunc; + ntype->freestoragefunc = freestoragefunc; +} + +void node_type_exec(struct bNodeType *ntype, void (*execfunc)(void *data, struct bNode *, struct bNodeStack **, struct bNodeStack **)) +{ + ntype->execfunc = execfunc; +} + +void node_type_gpu(struct bNodeType *ntype, int (*gpufunc)(struct GPUMaterial *mat, struct bNode *node, struct GPUNodeStack *in, struct GPUNodeStack *out)) +{ + ntype->gpufunc = gpufunc; +} + +void node_type_label(struct bNodeType *ntype, const char *(*labelfunc)(struct bNode *)) +{ + ntype->labelfunc = labelfunc; +} + static bNodeType *is_nodetype_registered(ListBase *typelist, int type, ID *id) { bNodeType *ntype= typelist->first; @@ -3257,147 +3317,150 @@ void nodeRegisterType(ListBase *typelist, const bNodeType *ntype) static void registerCompositNodes(ListBase *ntypelist) { - nodeRegisterType(ntypelist, &node_group_typeinfo); - nodeRegisterType(ntypelist, &cmp_node_rlayers); - nodeRegisterType(ntypelist, &cmp_node_image); - nodeRegisterType(ntypelist, &cmp_node_texture); - nodeRegisterType(ntypelist, &cmp_node_value); - nodeRegisterType(ntypelist, &cmp_node_rgb); - nodeRegisterType(ntypelist, &cmp_node_curve_time); - - nodeRegisterType(ntypelist, &cmp_node_composite); - nodeRegisterType(ntypelist, &cmp_node_viewer); - nodeRegisterType(ntypelist, &cmp_node_splitviewer); - nodeRegisterType(ntypelist, &cmp_node_output_file); - nodeRegisterType(ntypelist, &cmp_node_view_levels); - - nodeRegisterType(ntypelist, &cmp_node_curve_rgb); - nodeRegisterType(ntypelist, &cmp_node_mix_rgb); - nodeRegisterType(ntypelist, &cmp_node_hue_sat); - nodeRegisterType(ntypelist, &cmp_node_brightcontrast); - nodeRegisterType(ntypelist, &cmp_node_gamma); - nodeRegisterType(ntypelist, &cmp_node_invert); - nodeRegisterType(ntypelist, &cmp_node_alphaover); - nodeRegisterType(ntypelist, &cmp_node_zcombine); - nodeRegisterType(ntypelist, &cmp_node_colorbalance); - nodeRegisterType(ntypelist, &cmp_node_huecorrect); - - nodeRegisterType(ntypelist, &cmp_node_normal); - nodeRegisterType(ntypelist, &cmp_node_curve_vec); - nodeRegisterType(ntypelist, &cmp_node_map_value); - nodeRegisterType(ntypelist, &cmp_node_normalize); - - nodeRegisterType(ntypelist, &cmp_node_filter); - nodeRegisterType(ntypelist, &cmp_node_blur); - nodeRegisterType(ntypelist, &cmp_node_dblur); - nodeRegisterType(ntypelist, &cmp_node_bilateralblur); - nodeRegisterType(ntypelist, &cmp_node_vecblur); - nodeRegisterType(ntypelist, &cmp_node_dilateerode); - nodeRegisterType(ntypelist, &cmp_node_defocus); - - nodeRegisterType(ntypelist, &cmp_node_valtorgb); - nodeRegisterType(ntypelist, &cmp_node_rgbtobw); - nodeRegisterType(ntypelist, &cmp_node_setalpha); - nodeRegisterType(ntypelist, &cmp_node_idmask); - nodeRegisterType(ntypelist, &cmp_node_math); - nodeRegisterType(ntypelist, &cmp_node_seprgba); - nodeRegisterType(ntypelist, &cmp_node_combrgba); - nodeRegisterType(ntypelist, &cmp_node_sephsva); - nodeRegisterType(ntypelist, &cmp_node_combhsva); - nodeRegisterType(ntypelist, &cmp_node_sepyuva); - nodeRegisterType(ntypelist, &cmp_node_combyuva); - nodeRegisterType(ntypelist, &cmp_node_sepycca); - nodeRegisterType(ntypelist, &cmp_node_combycca); - nodeRegisterType(ntypelist, &cmp_node_premulkey); - - nodeRegisterType(ntypelist, &cmp_node_diff_matte); - nodeRegisterType(ntypelist, &cmp_node_distance_matte); - nodeRegisterType(ntypelist, &cmp_node_chroma_matte); - nodeRegisterType(ntypelist, &cmp_node_color_matte); - nodeRegisterType(ntypelist, &cmp_node_channel_matte); - nodeRegisterType(ntypelist, &cmp_node_color_spill); - nodeRegisterType(ntypelist, &cmp_node_luma_matte); - - nodeRegisterType(ntypelist, &cmp_node_translate); - nodeRegisterType(ntypelist, &cmp_node_rotate); - nodeRegisterType(ntypelist, &cmp_node_scale); - nodeRegisterType(ntypelist, &cmp_node_flip); - nodeRegisterType(ntypelist, &cmp_node_crop); - nodeRegisterType(ntypelist, &cmp_node_displace); - nodeRegisterType(ntypelist, &cmp_node_mapuv); - nodeRegisterType(ntypelist, &cmp_node_glare); - nodeRegisterType(ntypelist, &cmp_node_tonemap); - nodeRegisterType(ntypelist, &cmp_node_lensdist); + register_node_type_group(ntypelist); + + register_node_type_cmp_rlayers(ntypelist); + register_node_type_cmp_image(ntypelist); + register_node_type_cmp_texture(ntypelist); + register_node_type_cmp_value(ntypelist); + register_node_type_cmp_rgb(ntypelist); + register_node_type_cmp_curve_time(ntypelist); + + register_node_type_cmp_composite(ntypelist); + register_node_type_cmp_viewer(ntypelist); + register_node_type_cmp_splitviewer(ntypelist); + register_node_type_cmp_output_file(ntypelist); + register_node_type_cmp_view_levels(ntypelist); + + register_node_type_cmp_curve_rgb(ntypelist); + register_node_type_cmp_mix_rgb(ntypelist); + register_node_type_cmp_hue_sat(ntypelist); + register_node_type_cmp_brightcontrast(ntypelist); + register_node_type_cmp_gamma(ntypelist); + register_node_type_cmp_invert(ntypelist); + register_node_type_cmp_alphaover(ntypelist); + register_node_type_cmp_zcombine(ntypelist); + register_node_type_cmp_colorbalance(ntypelist); + register_node_type_cmp_huecorrect(ntypelist); + + register_node_type_cmp_normal(ntypelist); + register_node_type_cmp_curve_vec(ntypelist); + register_node_type_cmp_map_value(ntypelist); + register_node_type_cmp_normalize(ntypelist); + + register_node_type_cmp_filter(ntypelist); + register_node_type_cmp_blur(ntypelist); + register_node_type_cmp_dblur(ntypelist); + register_node_type_cmp_bilateralblur(ntypelist); + register_node_type_cmp_vecblur(ntypelist); + register_node_type_cmp_dilateerode(ntypelist); + register_node_type_cmp_defocus(ntypelist); + + register_node_type_cmp_valtorgb(ntypelist); + register_node_type_cmp_rgbtobw(ntypelist); + register_node_type_cmp_setalpha(ntypelist); + register_node_type_cmp_idmask(ntypelist); + register_node_type_cmp_math(ntypelist); + register_node_type_cmp_seprgba(ntypelist); + register_node_type_cmp_combrgba(ntypelist); + register_node_type_cmp_sephsva(ntypelist); + register_node_type_cmp_combhsva(ntypelist); + register_node_type_cmp_sepyuva(ntypelist); + register_node_type_cmp_combyuva(ntypelist); + register_node_type_cmp_sepycca(ntypelist); + register_node_type_cmp_combycca(ntypelist); + register_node_type_cmp_premulkey(ntypelist); + + register_node_type_cmp_diff_matte(ntypelist); + register_node_type_cmp_distance_matte(ntypelist); + register_node_type_cmp_chroma_matte(ntypelist); + register_node_type_cmp_color_matte(ntypelist); + register_node_type_cmp_channel_matte(ntypelist); + register_node_type_cmp_color_spill(ntypelist); + register_node_type_cmp_luma_matte(ntypelist); + + register_node_type_cmp_translate(ntypelist); + register_node_type_cmp_rotate(ntypelist); + register_node_type_cmp_scale(ntypelist); + register_node_type_cmp_flip(ntypelist); + register_node_type_cmp_crop(ntypelist); + register_node_type_cmp_displace(ntypelist); + register_node_type_cmp_mapuv(ntypelist); + register_node_type_cmp_glare(ntypelist); + register_node_type_cmp_tonemap(ntypelist); + register_node_type_cmp_lensdist(ntypelist); } static void registerShaderNodes(ListBase *ntypelist) { - nodeRegisterType(ntypelist, &node_group_typeinfo); - nodeRegisterType(ntypelist, &sh_node_output); - nodeRegisterType(ntypelist, &sh_node_mix_rgb); - nodeRegisterType(ntypelist, &sh_node_valtorgb); - nodeRegisterType(ntypelist, &sh_node_rgbtobw); - nodeRegisterType(ntypelist, &sh_node_normal); - nodeRegisterType(ntypelist, &sh_node_geom); - nodeRegisterType(ntypelist, &sh_node_mapping); - nodeRegisterType(ntypelist, &sh_node_curve_vec); - nodeRegisterType(ntypelist, &sh_node_curve_rgb); - nodeRegisterType(ntypelist, &sh_node_math); - nodeRegisterType(ntypelist, &sh_node_vect_math); - nodeRegisterType(ntypelist, &sh_node_squeeze); - nodeRegisterType(ntypelist, &sh_node_camera); - nodeRegisterType(ntypelist, &sh_node_material); - nodeRegisterType(ntypelist, &sh_node_material_ext); - nodeRegisterType(ntypelist, &sh_node_value); - nodeRegisterType(ntypelist, &sh_node_rgb); - nodeRegisterType(ntypelist, &sh_node_texture); - nodeRegisterType(ntypelist, &node_dynamic_typeinfo); - nodeRegisterType(ntypelist, &sh_node_invert); - nodeRegisterType(ntypelist, &sh_node_seprgb); - nodeRegisterType(ntypelist, &sh_node_combrgb); - nodeRegisterType(ntypelist, &sh_node_hue_sat); + register_node_type_group(ntypelist); + + register_node_type_sh_output(ntypelist); + register_node_type_sh_mix_rgb(ntypelist); + register_node_type_sh_valtorgb(ntypelist); + register_node_type_sh_rgbtobw(ntypelist); + register_node_type_sh_normal(ntypelist); + register_node_type_sh_geom(ntypelist); + register_node_type_sh_mapping(ntypelist); + register_node_type_sh_curve_vec(ntypelist); + register_node_type_sh_curve_rgb(ntypelist); + register_node_type_sh_math(ntypelist); + register_node_type_sh_vect_math(ntypelist); + register_node_type_sh_squeeze(ntypelist); + register_node_type_sh_camera(ntypelist); + register_node_type_sh_material(ntypelist); + register_node_type_sh_material_ext(ntypelist); + register_node_type_sh_value(ntypelist); + register_node_type_sh_rgb(ntypelist); + register_node_type_sh_texture(ntypelist); + register_node_type_sh_dynamic(ntypelist); + register_node_type_sh_invert(ntypelist); + register_node_type_sh_seprgb(ntypelist); + register_node_type_sh_combrgb(ntypelist); + register_node_type_sh_hue_sat(ntypelist); } static void registerTextureNodes(ListBase *ntypelist) { - nodeRegisterType(ntypelist, &node_group_typeinfo); - nodeRegisterType(ntypelist, &tex_node_math); - nodeRegisterType(ntypelist, &tex_node_mix_rgb); - nodeRegisterType(ntypelist, &tex_node_valtorgb); - nodeRegisterType(ntypelist, &tex_node_rgbtobw); - nodeRegisterType(ntypelist, &tex_node_valtonor); - nodeRegisterType(ntypelist, &tex_node_curve_rgb); - nodeRegisterType(ntypelist, &tex_node_curve_time); - nodeRegisterType(ntypelist, &tex_node_invert); - nodeRegisterType(ntypelist, &tex_node_hue_sat); - nodeRegisterType(ntypelist, &tex_node_coord); - nodeRegisterType(ntypelist, &tex_node_distance); - nodeRegisterType(ntypelist, &tex_node_compose); - nodeRegisterType(ntypelist, &tex_node_decompose); - - nodeRegisterType(ntypelist, &tex_node_output); - nodeRegisterType(ntypelist, &tex_node_viewer); - - nodeRegisterType(ntypelist, &tex_node_checker); - nodeRegisterType(ntypelist, &tex_node_texture); - nodeRegisterType(ntypelist, &tex_node_bricks); - nodeRegisterType(ntypelist, &tex_node_image); - - nodeRegisterType(ntypelist, &tex_node_rotate); - nodeRegisterType(ntypelist, &tex_node_translate); - nodeRegisterType(ntypelist, &tex_node_scale); - nodeRegisterType(ntypelist, &tex_node_at); - - nodeRegisterType(ntypelist, &tex_node_proc_voronoi); - nodeRegisterType(ntypelist, &tex_node_proc_blend); - nodeRegisterType(ntypelist, &tex_node_proc_magic); - nodeRegisterType(ntypelist, &tex_node_proc_marble); - nodeRegisterType(ntypelist, &tex_node_proc_clouds); - nodeRegisterType(ntypelist, &tex_node_proc_wood); - nodeRegisterType(ntypelist, &tex_node_proc_musgrave); - nodeRegisterType(ntypelist, &tex_node_proc_noise); - nodeRegisterType(ntypelist, &tex_node_proc_stucci); - nodeRegisterType(ntypelist, &tex_node_proc_distnoise); + register_node_type_group(ntypelist); + + register_node_type_tex_math(ntypelist); + register_node_type_tex_mix_rgb(ntypelist); + register_node_type_tex_valtorgb(ntypelist); + register_node_type_tex_rgbtobw(ntypelist); + register_node_type_tex_valtonor(ntypelist); + register_node_type_tex_curve_rgb(ntypelist); + register_node_type_tex_curve_time(ntypelist); + register_node_type_tex_invert(ntypelist); + register_node_type_tex_hue_sat(ntypelist); + register_node_type_tex_coord(ntypelist); + register_node_type_tex_distance(ntypelist); + register_node_type_tex_compose(ntypelist); + register_node_type_tex_decompose(ntypelist); + + register_node_type_tex_output(ntypelist); + register_node_type_tex_viewer(ntypelist); + + register_node_type_tex_checker(ntypelist); + register_node_type_tex_texture(ntypelist); + register_node_type_tex_bricks(ntypelist); + register_node_type_tex_image(ntypelist); + + register_node_type_tex_rotate(ntypelist); + register_node_type_tex_translate(ntypelist); + register_node_type_tex_scale(ntypelist); + register_node_type_tex_at(ntypelist); + + register_node_type_tex_proc_voronoi(ntypelist); + register_node_type_tex_proc_blend(ntypelist); + register_node_type_tex_proc_magic(ntypelist); + register_node_type_tex_proc_marble(ntypelist); + register_node_type_tex_proc_clouds(ntypelist); + register_node_type_tex_proc_wood(ntypelist); + register_node_type_tex_proc_musgrave(ntypelist); + register_node_type_tex_proc_noise(ntypelist); + register_node_type_tex_proc_stucci(ntypelist); + register_node_type_tex_proc_distnoise(ntypelist); } static void remove_dynamic_typeinfos(ListBase *list) diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c index 860ced6de0b..684f1531114 100644 --- a/source/blender/blenkernel/intern/object.c +++ b/source/blender/blenkernel/intern/object.c @@ -275,7 +275,7 @@ void free_object(Object *ob) else if(ob->type==OB_CURVE) unlink_curve(ob->data); else if(ob->type==OB_MBALL) unlink_mball(ob->data); } - ob->data= 0; + ob->data= NULL; } for(a=0; a<ob->totcol; a++) { @@ -283,12 +283,12 @@ void free_object(Object *ob) } if(ob->mat) MEM_freeN(ob->mat); if(ob->matbits) MEM_freeN(ob->matbits); - ob->mat= 0; - ob->matbits= 0; + ob->mat= NULL; + ob->matbits= NULL; if(ob->bb) MEM_freeN(ob->bb); - ob->bb= 0; + ob->bb= NULL; if(ob->path) free_path(ob->path); - ob->path= 0; + ob->path= NULL; if(ob->adt) BKE_free_animdata((ID *)ob); if(ob->poselib) ob->poselib->id.us--; if(ob->gpd) ((ID *)ob->gpd)->us--; @@ -749,11 +749,11 @@ void make_local_camera(Camera *cam) * - mixed: make copy */ - if(cam->id.lib==0) return; + if(cam->id.lib==NULL) return; if(cam->id.us==1) { - cam->id.lib= 0; + cam->id.lib= NULL; cam->id.flag= LIB_LOCAL; - new_id(0, (ID *)cam, 0); + new_id(NULL, (ID *)cam, NULL); return; } @@ -767,9 +767,9 @@ void make_local_camera(Camera *cam) } if(local && lib==0) { - cam->id.lib= 0; + cam->id.lib= NULL; cam->id.flag= LIB_LOCAL; - new_id(0, (ID *)cam, 0); + new_id(NULL, (ID *)cam, NULL); } else if(local && lib) { camn= copy_camera(cam); @@ -779,7 +779,7 @@ void make_local_camera(Camera *cam) while(ob) { if(ob->data==cam) { - if(ob->id.lib==0) { + if(ob->id.lib==NULL) { ob->data= camn; camn->id.us++; cam->id.us--; @@ -898,11 +898,11 @@ void make_local_lamp(Lamp *la) * - mixed: make copy */ - if(la->id.lib==0) return; + if(la->id.lib==NULL) return; if(la->id.us==1) { - la->id.lib= 0; + la->id.lib= NULL; la->id.flag= LIB_LOCAL; - new_id(0, (ID *)la, 0); + new_id(NULL, (ID *)la, NULL); return; } @@ -916,9 +916,9 @@ void make_local_lamp(Lamp *la) } if(local && lib==0) { - la->id.lib= 0; + la->id.lib= NULL; la->id.flag= LIB_LOCAL; - new_id(0, (ID *)la, 0); + new_id(NULL, (ID *)la, NULL); } else if(local && lib) { lan= copy_lamp(la); @@ -928,7 +928,7 @@ void make_local_lamp(Lamp *la) while(ob) { if(ob->data==la) { - if(ob->id.lib==0) { + if(ob->id.lib==NULL) { ob->data= lan; lan->id.us++; la->id.us--; @@ -1088,7 +1088,7 @@ Object *add_object(struct Scene *scene, int type) Base *base; char name[32]; - strcpy(name, get_obdata_defname(type)); + BLI_strncpy(name, get_obdata_defname(type), sizeof(name)); ob = add_only_object(type, name); ob->data= add_obdata_from_type(type); @@ -1137,7 +1137,7 @@ BulletSoftBody *copy_bulletsoftbody(BulletSoftBody *bsb) return bsbn; } -ParticleSystem *copy_particlesystem(ParticleSystem *psys) +static ParticleSystem *copy_particlesystem(ParticleSystem *psys) { ParticleSystem *psysn; ParticleData *pa; @@ -2272,7 +2272,7 @@ void what_does_parent(Scene *scene, Object *ob, Object *workob) where_is_object(scene, workob); } -BoundBox *unit_boundbox() +BoundBox *unit_boundbox(void) { BoundBox *bb; float min[3] = {-1.0f,-1.0f,-1.0f}, max[3] = {-1.0f,-1.0f,-1.0f}; diff --git a/source/blender/blenkernel/intern/packedFile.c b/source/blender/blenkernel/intern/packedFile.c index 12ebaf7578a..1fc0a2259fb 100644 --- a/source/blender/blenkernel/intern/packedFile.c +++ b/source/blender/blenkernel/intern/packedFile.c @@ -459,7 +459,7 @@ int unpackVFont(ReportList *reports, VFont *vfont, int how) if (newname != NULL) { ret_value = RET_OK; freePackedFile(vfont->packedfile); - vfont->packedfile = 0; + vfont->packedfile = NULL; strcpy(vfont->name, newname); MEM_freeN(newname); } @@ -485,7 +485,7 @@ int unpackSound(Main *bmain, ReportList *reports, bSound *sound, int how) MEM_freeN(newname); freePackedFile(sound->packedfile); - sound->packedfile = 0; + sound->packedfile = NULL; sound_load(bmain, sound); diff --git a/source/blender/blenkernel/intern/particle.c b/source/blender/blenkernel/intern/particle.c index f6b97dcb78e..d1d5c13c3dd 100644 --- a/source/blender/blenkernel/intern/particle.c +++ b/source/blender/blenkernel/intern/particle.c @@ -77,8 +77,6 @@ #include "RE_render_ext.h" -static void get_cpa_texture(DerivedMesh *dm, Material *ma, int face_index, - float *fuv, float *orco, ParticleTexture *ptex, int event); static void get_child_modifier_parameters(ParticleSettings *part, ParticleThreadContext *ctx, ChildParticle *cpa, short cpa_from, int cpa_num, float *cpa_fuv, float *orco, ParticleTexture *ptex); static void do_child_modifiers(ParticleSimulationData *sim, @@ -159,21 +157,21 @@ static void psys_free_path_cache_buffers(ParticleCacheKey **cache, ListBase *buf ParticleSystem *psys_get_current(Object *ob) { ParticleSystem *psys; - if(ob==0) return 0; + if(ob==NULL) return NULL; for(psys=ob->particlesystem.first; psys; psys=psys->next){ if(psys->flag & PSYS_CURRENT) return psys; } - return 0; + return NULL; } short psys_get_current_num(Object *ob) { ParticleSystem *psys; short i; - if(ob==0) return 0; + if(ob==NULL) return 0; for(psys=ob->particlesystem.first, i=0; psys; psys=psys->next, i++) if(psys->flag & PSYS_CURRENT) @@ -186,7 +184,7 @@ void psys_set_current_num(Object *ob, int index) ParticleSystem *psys; short i; - if(ob==0) return; + if(ob==NULL) return; for(psys=ob->particlesystem.first, i=0; psys; psys=psys->next, i++) { if(i == index) @@ -211,7 +209,7 @@ Object *psys_find_object(Scene *scene, ParticleSystem *psys) } Object *psys_get_lattice(ParticleSimulationData *sim) { - Object *lattice=0; + Object *lattice=NULL; if(psys_in_edit_mode(sim->scene, sim->psys)==0){ @@ -225,7 +223,7 @@ Object *psys_get_lattice(ParticleSimulationData *sim) } } if(lattice) - init_latt_deform(lattice,0); + init_latt_deform(lattice, NULL); } return lattice; @@ -360,7 +358,7 @@ int psys_uses_gravity(ParticleSimulationData *sim) /************************************************/ /* Freeing stuff */ /************************************************/ -void fluid_free_settings(SPHFluidSettings *fluid) +static void fluid_free_settings(SPHFluidSettings *fluid) { if(fluid) MEM_freeN(fluid); @@ -368,6 +366,8 @@ void fluid_free_settings(SPHFluidSettings *fluid) void psys_free_settings(ParticleSettings *part) { + MTex *mtex; + int a; BKE_free_animdata(&part->id); free_partdeflect(part->pd); free_partdeflect(part->pd2); @@ -379,6 +379,12 @@ void psys_free_settings(ParticleSettings *part) boid_free_settings(part->boids); fluid_free_settings(part->fluid); + + for(a=0; a<MAX_MTEX; a++) { + mtex= part->mtex[a]; + if(mtex && mtex->tex) mtex->tex->id.us--; + if(mtex) MEM_freeN(mtex); + } } void free_hair(Object *UNUSED(ob), ParticleSystem *psys, int dynamics) @@ -461,7 +467,7 @@ void psys_free_children(ParticleSystem *psys) { if(psys->child) { MEM_freeN(psys->child); - psys->child=0; + psys->child= NULL; psys->totchild=0; } @@ -531,7 +537,7 @@ void psys_free(Object *ob, ParticleSystem * psys) if(psys->child){ MEM_freeN(psys->child); - psys->child = 0; + psys->child = NULL; psys->totchild = 0; } @@ -552,7 +558,7 @@ void psys_free(Object *ob, ParticleSystem * psys) if(psys->part){ psys->part->id.us--; - psys->part=0; + psys->part=NULL; } BKE_ptcache_free_list(&psys->ptcaches); @@ -2246,12 +2252,13 @@ static void do_path_effectors(ParticleSimulationData *sim, int i, ParticleCacheK normalize_v3(force); - VECADDFAC(ca->co, (ca-1)->co, force, *length); - - if(k < steps) { + if(k < steps) sub_v3_v3v3(vec, (ca+1)->co, ca->co); + + madd_v3_v3v3fl(ca->co, (ca-1)->co, force, *length); + + if(k < steps) *length = len_v3(vec); - } } static int check_path_length(int k, ParticleCacheKey *keys, ParticleCacheKey *state, float max_length, float *cur_length, float length, float *dvec) { @@ -2859,11 +2866,12 @@ void psys_cache_paths(ParticleSimulationData *sim, float cfra) Material *ma; ParticleInterpolationData pind; + ParticleTexture ptex; PARTICLE_P; float birthtime = 0.0, dietime = 0.0; - float t, time = 0.0, dfra = 1.0, frs_sec = sim->scene->r.frs_sec; + float t, time = 0.0, dfra = 1.0 /* , frs_sec = sim->scene->r.frs_sec*/ /*UNUSED*/; float col[4] = {0.5f, 0.5f, 0.5f, 1.0f}; float prev_tangent[3] = {0.0f, 0.0f, 0.0f}, hairmat[4][4]; float rotmat[3][3]; @@ -2908,8 +2916,8 @@ void psys_cache_paths(ParticleSimulationData *sim, float cfra) /*---first main loop: create all actual particles' paths---*/ LOOP_SHOWN_PARTICLES { if(!psys->totchild) { - BLI_srandom(psys->seed + p); - pa_length = 1.0f - part->randlength * BLI_frand(); + psys_get_texture(sim, pa, &ptex, PAMAP_LENGTH, 0.f); + pa_length = ptex.length * (1.0f - part->randlength * PSYS_FRAND(psys->seed + p)); if(vg_length) pa_length *= psys_particle_value_from_verts(psmd->dm,part->from,pa,vg_length); } @@ -3472,7 +3480,7 @@ static void default_particle_settings(ParticleSettings *part) part->bb_uv_split=1; part->bb_align=PART_BB_VIEW; part->bb_split_offset=PART_BB_OFF_LINEAR; - part->flag=PART_EDISTR|PART_TRAND; + part->flag=PART_EDISTR|PART_TRAND|PART_HIDE_ADVANCED_HAIR; part->sta= 1.0; part->end= 200.0; @@ -3498,8 +3506,6 @@ static void default_particle_settings(ParticleSettings *part) part->normfac= 1.0f; - part->reactshape=1.0f; - part->mass=1.0; part->size=0.05; part->childsize=1.0; @@ -3673,82 +3679,128 @@ static int get_particle_uv(DerivedMesh *dm, ParticleData *pa, int face_index, fl return 1; } -static void get_cpa_texture(DerivedMesh *dm, Material *ma, int face_index, float *fw, float *orco, ParticleTexture *ptex, int event) +#define SET_PARTICLE_TEXTURE(type, pvalue, texfac) if((event & mtex->mapto) & type) {pvalue = texture_value_blend(def, pvalue, value, texfac, blend);} +#define CLAMP_PARTICLE_TEXTURE_POS(type, pvalue) if(event & type) { if(pvalue < 0.f) pvalue = 1.f+pvalue; CLAMP(pvalue, 0.0, 1.0); } +#define CLAMP_PARTICLE_TEXTURE_POSNEG(type, pvalue) if(event & type) { CLAMP(pvalue, -1.0, 1.0); } + +static void get_cpa_texture(DerivedMesh *dm, ParticleSystem *psys, ParticleSettings *part, ParticleData *par, int child_index, int face_index, float *fw, float *orco, ParticleTexture *ptex, int event, float cfra) { - MTex *mtex; - int m,setvars=0; - float value, rgba[4], texco[3]; + MTex *mtex, **mtexp = part->mtex; + int m; + float value, rgba[4], texvec[3]; - if(ma) for(m=0; m<MAX_MTEX; m++){ - mtex=ma->mtex[m]; - if(mtex && (ma->septex & (1<<m))==0 && mtex->pmapto){ + ptex->ivel = ptex->life = ptex->exist = ptex->size = ptex->damp = + ptex->gravity = ptex->field = ptex->time = ptex->clump = ptex->kink = + ptex->effector = ptex->rough1 = ptex->rough2 = ptex->roughe = 1.f; + + ptex->length= 1.0f - part->randlength * PSYS_FRAND(child_index + 26); + ptex->length*= part->clength_thres < PSYS_FRAND(child_index + 27) ? part->clength : 1.0f; + + for(m=0; m<MAX_MTEX; m++, mtexp++){ + mtex = *mtexp; + if(mtex && mtex->mapto){ float def=mtex->def_var; short blend=mtex->blendtype; + short texco = mtex->texco; - if((mtex->texco & TEXCO_UV) && fw) { - if(!get_particle_uv(dm, NULL, face_index, fw, mtex->uvname, texco)) - VECCOPY(texco,orco); - } - else - VECCOPY(texco,orco); + if(ELEM(texco, TEXCO_UV, TEXCO_ORCO) && (ELEM(part->from, PART_FROM_FACE, PART_FROM_VOLUME) == 0 || part->distr == PART_DISTR_GRID)) + texco = TEXCO_GLOB; - externtex(mtex, texco, &value, rgba, rgba+1, rgba+2, rgba+3, 0); - if((event & mtex->pmapto) & MAP_PA_TIME){ - if((setvars&MAP_PA_TIME)==0){ - ptex->time=0.0; - setvars|=MAP_PA_TIME; - } - ptex->time= texture_value_blend(mtex->def_var,ptex->time,value,mtex->timefac,blend); + switch(texco) { + case TEXCO_GLOB: + copy_v3_v3(texvec, par->state.co); + break; + case TEXCO_OBJECT: + copy_v3_v3(texvec, par->state.co); + if(mtex->object) + mul_m4_v3(mtex->object->imat, texvec); + break; + case TEXCO_UV: + if(fw && get_particle_uv(dm, NULL, face_index, fw, mtex->uvname, texvec)) + break; + /* no break, failed to get uv's, so let's try orco's */ + case TEXCO_ORCO: + copy_v3_v3(texvec, orco); + break; + case TEXCO_PARTICLE: + /* texture coordinates in range [-1,1] */ + texvec[0] = 2.f * (cfra - par->time)/(par->dietime-par->time) - 1.f; + texvec[1] = 0.f; + texvec[2] = 0.f; + break; } - if((event & mtex->pmapto) & MAP_PA_LENGTH) - ptex->length= texture_value_blend(def,ptex->length,value,mtex->lengthfac,blend); - if((event & mtex->pmapto) & MAP_PA_CLUMP) - ptex->clump= texture_value_blend(def,ptex->clump,value,mtex->clumpfac,blend); - if((event & mtex->pmapto) & MAP_PA_KINK) - ptex->kink= texture_value_blend(def,ptex->kink,value,mtex->kinkfac,blend); - if((event & mtex->pmapto) & MAP_PA_ROUGH) + + externtex(mtex, texvec, &value, rgba, rgba+1, rgba+2, rgba+3, 0); + + if((event & mtex->mapto) & PAMAP_ROUGH) ptex->rough1= ptex->rough2= ptex->roughe= texture_value_blend(def,ptex->rough1,value,mtex->roughfac,blend); - if((event & mtex->pmapto) & MAP_PA_DENS) - ptex->exist= texture_value_blend(def,ptex->exist,value,mtex->padensfac,blend); + + SET_PARTICLE_TEXTURE(PAMAP_LENGTH, ptex->length, mtex->lengthfac); + SET_PARTICLE_TEXTURE(PAMAP_CLUMP, ptex->clump, mtex->clumpfac); + SET_PARTICLE_TEXTURE(PAMAP_KINK, ptex->kink, mtex->kinkfac); + SET_PARTICLE_TEXTURE(PAMAP_DENS, ptex->exist, mtex->padensfac); } } - if(event & MAP_PA_TIME) { CLAMP(ptex->time,0.0,1.0); } - if(event & MAP_PA_LENGTH) { CLAMP(ptex->length,0.0,1.0); } - if(event & MAP_PA_CLUMP) { CLAMP(ptex->clump,0.0,1.0); } - if(event & MAP_PA_KINK) { CLAMP(ptex->kink,0.0,1.0); } - if(event & MAP_PA_ROUGH) { - CLAMP(ptex->rough1,0.0,1.0); - CLAMP(ptex->rough2,0.0,1.0); - CLAMP(ptex->roughe,0.0,1.0); - } - if(event & MAP_PA_DENS) { CLAMP(ptex->exist,0.0,1.0); } + + CLAMP_PARTICLE_TEXTURE_POS(PAMAP_LENGTH, ptex->length); + CLAMP_PARTICLE_TEXTURE_POS(PAMAP_CLUMP, ptex->clump); + CLAMP_PARTICLE_TEXTURE_POS(PAMAP_KINK, ptex->kink); + CLAMP_PARTICLE_TEXTURE_POS(PAMAP_ROUGH, ptex->rough1); + CLAMP_PARTICLE_TEXTURE_POS(PAMAP_DENS, ptex->exist); } -void psys_get_texture(ParticleSimulationData *sim, Material *ma, ParticleData *pa, ParticleTexture *ptex, int event) +void psys_get_texture(ParticleSimulationData *sim, ParticleData *pa, ParticleTexture *ptex, int event, float cfra) { + ParticleSettings *part = sim->psys->part; + MTex **mtexp = part->mtex; MTex *mtex; int m; - float value, rgba[4], co[3], texco[3]; + float value, rgba[4], co[3], texvec[3]; int setvars=0; - if(ma) for(m=0; m<MAX_MTEX; m++){ - mtex=ma->mtex[m]; - if(mtex && (ma->septex & (1<<m))==0 && mtex->pmapto){ + /* initialize ptex */ + ptex->ivel = ptex->life = ptex->exist = ptex->size = ptex->damp = + ptex->gravity = ptex->field = ptex->length = ptex->clump = ptex->kink = + ptex->effector = ptex->rough1 = ptex->rough2 = ptex->roughe = 1.f; + + ptex->time = (float)(pa - sim->psys->particles)/(float)sim->psys->totpart; + + for(m=0; m<MAX_MTEX; m++, mtexp++){ + mtex = *mtexp; + if(mtex && mtex->mapto){ float def=mtex->def_var; short blend=mtex->blendtype; + short texco = mtex->texco; - if((mtex->texco & TEXCO_UV) && ELEM(sim->psys->part->from, PART_FROM_FACE, PART_FROM_VOLUME)) { - if(!get_particle_uv(sim->psmd->dm, pa, 0, pa->fuv, mtex->uvname, texco)) { - /* failed to get uv's, let's try orco's */ - psys_particle_on_emitter(sim->psmd,sim->psys->part->from,pa->num,pa->num_dmcache,pa->fuv,pa->foffset,co,0,0,0,texco, 0); - } - } - else { - psys_particle_on_emitter(sim->psmd,sim->psys->part->from,pa->num,pa->num_dmcache,pa->fuv,pa->foffset,co,0,0,0,texco, 0); + if(ELEM(texco, TEXCO_UV, TEXCO_ORCO) && (ELEM(part->from, PART_FROM_FACE, PART_FROM_VOLUME) == 0 || part->distr == PART_DISTR_GRID)) + texco = TEXCO_GLOB; + + switch(texco) { + case TEXCO_GLOB: + copy_v3_v3(texvec, pa->state.co); + break; + case TEXCO_OBJECT: + copy_v3_v3(texvec, pa->state.co); + if(mtex->object) + mul_m4_v3(mtex->object->imat, texvec); + break; + case TEXCO_UV: + if(get_particle_uv(sim->psmd->dm, pa, 0, pa->fuv, mtex->uvname, texvec)) + break; + /* no break, failed to get uv's, so let's try orco's */ + case TEXCO_ORCO: + psys_particle_on_emitter(sim->psmd,sim->psys->part->from,pa->num,pa->num_dmcache,pa->fuv,pa->foffset,co,0,0,0,texvec, 0); + break; + case TEXCO_PARTICLE: + /* texture coordinates in range [-1,1] */ + texvec[0] = 2.f * (cfra - pa->time)/(pa->dietime-pa->time) - 1.f; + texvec[1] = 0.f; + texvec[2] = 0.f; + break; } - externtex(mtex, texco, &value, rgba, rgba+1, rgba+2, rgba+3, 0); + externtex(mtex, texvec, &value, rgba, rgba+1, rgba+2, rgba+3, 0); - if((event & mtex->pmapto) & MAP_PA_TIME){ + if((event & mtex->mapto) & PAMAP_TIME) { /* the first time has to set the base value for time regardless of blend mode */ if((setvars&MAP_PA_TIME)==0){ int flip= (mtex->timefac < 0.0f); @@ -3760,32 +3812,26 @@ void psys_get_texture(ParticleSimulationData *sim, Material *ma, ParticleData *p else ptex->time= texture_value_blend(def,ptex->time,value,mtex->timefac,blend); } - if((event & mtex->pmapto) & MAP_PA_LIFE) - ptex->life= texture_value_blend(def,ptex->life,value,mtex->lifefac,blend); - if((event & mtex->pmapto) & MAP_PA_DENS) - ptex->exist= texture_value_blend(def,ptex->exist,value,mtex->padensfac,blend); - if((event & mtex->pmapto) & MAP_PA_SIZE) - ptex->size= texture_value_blend(def,ptex->size,value,mtex->sizefac,blend); - if((event & mtex->pmapto) & MAP_PA_IVEL) - ptex->ivel= texture_value_blend(def,ptex->ivel,value,mtex->ivelfac,blend); - if((event & mtex->pmapto) & MAP_PA_PVEL) - texture_rgb_blend(ptex->pvel,rgba,ptex->pvel,value,mtex->pvelfac,blend); - if((event & mtex->pmapto) & MAP_PA_LENGTH) - ptex->length= texture_value_blend(def,ptex->length,value,mtex->lengthfac,blend); - if((event & mtex->pmapto) & MAP_PA_CLUMP) - ptex->clump= texture_value_blend(def,ptex->clump,value,mtex->clumpfac,blend); - if((event & mtex->pmapto) & MAP_PA_KINK) - ptex->kink= texture_value_blend(def,ptex->kink,value,mtex->kinkfac,blend); - } - } - if(event & MAP_PA_TIME) { CLAMP(ptex->time,0.0,1.0); } - if(event & MAP_PA_LIFE) { CLAMP(ptex->life,0.0,1.0); } - if(event & MAP_PA_DENS) { CLAMP(ptex->exist,0.0,1.0); } - if(event & MAP_PA_SIZE) { CLAMP(ptex->size,0.0,1.0); } - if(event & MAP_PA_IVEL) { CLAMP(ptex->ivel,0.0,1.0); } - if(event & MAP_PA_LENGTH) { CLAMP(ptex->length,0.0,1.0); } - if(event & MAP_PA_CLUMP) { CLAMP(ptex->clump,0.0,1.0); } - if(event & MAP_PA_KINK) { CLAMP(ptex->kink,0.0,1.0); } + SET_PARTICLE_TEXTURE(PAMAP_LIFE, ptex->life, mtex->lifefac) + SET_PARTICLE_TEXTURE(PAMAP_DENS, ptex->exist, mtex->padensfac) + SET_PARTICLE_TEXTURE(PAMAP_SIZE, ptex->size, mtex->sizefac) + SET_PARTICLE_TEXTURE(PAMAP_IVEL, ptex->ivel, mtex->ivelfac) + SET_PARTICLE_TEXTURE(PAMAP_FIELD, ptex->field, mtex->fieldfac) + SET_PARTICLE_TEXTURE(PAMAP_GRAVITY, ptex->gravity, mtex->gravityfac) + SET_PARTICLE_TEXTURE(PAMAP_DAMP, ptex->damp, mtex->dampfac) + SET_PARTICLE_TEXTURE(PAMAP_LENGTH, ptex->length, mtex->lengthfac) + } + } + + CLAMP_PARTICLE_TEXTURE_POS(PAMAP_TIME, ptex->time) + CLAMP_PARTICLE_TEXTURE_POS(PAMAP_LIFE, ptex->life) + CLAMP_PARTICLE_TEXTURE_POS(PAMAP_DENS, ptex->exist) + CLAMP_PARTICLE_TEXTURE_POS(PAMAP_SIZE, ptex->size) + CLAMP_PARTICLE_TEXTURE_POSNEG(PAMAP_IVEL, ptex->ivel) + CLAMP_PARTICLE_TEXTURE_POSNEG(PAMAP_FIELD, ptex->field) + CLAMP_PARTICLE_TEXTURE_POSNEG(PAMAP_GRAVITY, ptex->gravity) + CLAMP_PARTICLE_TEXTURE_POS(PAMAP_DAMP, ptex->damp) + CLAMP_PARTICLE_TEXTURE_POS(PAMAP_LENGTH, ptex->length) } /************************************************/ /* Particle State */ @@ -3828,28 +3874,8 @@ float psys_get_child_size(ParticleSystem *psys, ChildParticle *cpa, float UNUSED ParticleSettings *part = psys->part; float size; // time XXX - if(part->childtype==PART_CHILD_FACES){ + if(part->childtype==PART_CHILD_FACES) size=part->size; - -#if 0 // XXX old animation system - if((part->flag&PART_ABS_TIME)==0 && part->ipo){ - IpoCurve *icu; - - if(pa_time) - time=*pa_time; - else - time=psys_get_child_time(psys,cpa,cfra,NULL,NULL); - - /* correction for lifetime */ - calc_ipo(part->ipo, 100*time); - - for(icu = part->ipo->curve.first; icu; icu=icu->next) { - if(icu->adrcode == PART_SIZE) - size = icu->curval; - } - } -#endif // XXX old animation system - } else size=psys->particles[cpa->parent].size; @@ -3865,19 +3891,7 @@ static void get_child_modifier_parameters(ParticleSettings *part, ParticleThread ParticleSystem *psys = ctx->sim.psys; int i = cpa - psys->child; - ptex->length= 1.0f - part->randlength * PSYS_FRAND(i + 26); - ptex->clump=1.0; - ptex->kink=1.0; - ptex->rough1= 1.0; - ptex->rough2= 1.0; - ptex->roughe= 1.0; - ptex->exist= 1.0; - ptex->effector= 1.0; - - ptex->length*= part->clength_thres < PSYS_FRAND(i + 27) ? part->clength : 1.0f; - - get_cpa_texture(ctx->dm,ctx->ma,cpa_num,cpa_fuv,orco,ptex, - MAP_PA_DENS|MAP_PA_LENGTH|MAP_PA_CLUMP|MAP_PA_KINK|MAP_PA_ROUGH); + get_cpa_texture(ctx->dm, psys, part, psys->particles + cpa->pa[0], i, cpa_num, cpa_fuv, orco, ptex, PAMAP_DENS|PAMAP_CHILD, psys->cfra); if(ptex->exist < PSYS_FRAND(i + 24)) diff --git a/source/blender/blenkernel/intern/particle_system.c b/source/blender/blenkernel/intern/particle_system.c index 4d3a908edb0..65bd4f110b4 100644 --- a/source/blender/blenkernel/intern/particle_system.c +++ b/source/blender/blenkernel/intern/particle_system.c @@ -120,7 +120,8 @@ static int particles_are_dynamic(ParticleSystem *psys) { else return ELEM3(psys->part->phystype, PART_PHYS_NEWTON, PART_PHYS_BOIDS, PART_PHYS_FLUID); } -int psys_get_current_display_percentage(ParticleSystem *psys) + +static int psys_get_current_display_percentage(ParticleSystem *psys) { ParticleSettings *part=psys->part; @@ -173,7 +174,7 @@ void psys_reset(ParticleSystem *psys, int mode) /* reset children */ if(psys->child) { MEM_freeN(psys->child); - psys->child= 0; + psys->child= NULL; } psys->totchild= 0; @@ -277,7 +278,7 @@ static void realloc_particles(ParticleSimulationData *sim, int new_totpart) if(psys->child) { MEM_freeN(psys->child); - psys->child=0; + psys->child=NULL; psys->totchild=0; } } @@ -312,7 +313,7 @@ static void alloc_child_particles(ParticleSystem *psys, int tot) } MEM_freeN(psys->child); - psys->child=0; + psys->child=NULL; psys->totchild=0; } @@ -401,7 +402,7 @@ void psys_calc_dmcache(Object *ob, DerivedMesh *dm, ParticleSystem *psys) static void distribute_particles_in_grid(DerivedMesh *dm, ParticleSystem *psys) { - ParticleData *pa=0; + ParticleData *pa=NULL; float min[3], max[3], delta[3], d; MVert *mv, *mvert = dm->getVertDataArray(dm,0); int totvert=dm->getNumVerts(dm), from=psys->part->from; @@ -410,8 +411,8 @@ static void distribute_particles_in_grid(DerivedMesh *dm, ParticleSystem *psys) mv=mvert; /* find bounding box of dm */ - VECCOPY(min,mv->co); - VECCOPY(max,mv->co); + copy_v3_v3(min, mv->co); + copy_v3_v3(max, mv->co); mv++; for(i=1; i<totvert; i++, mv++){ @@ -427,13 +428,13 @@ static void distribute_particles_in_grid(DerivedMesh *dm, ParticleSystem *psys) VECSUB(delta,max,min); /* determine major axis */ - axis = (delta[0]>=delta[1])?0:((delta[1]>=delta[2])?1:2); - + axis = (delta[0]>=delta[1]) ? 0 : ((delta[1]>=delta[2]) ? 1 : 2); + d = delta[axis]/(float)res; - size[axis]=res; - size[(axis+1)%3]=(int)ceil(delta[(axis+1)%3]/d); - size[(axis+2)%3]=(int)ceil(delta[(axis+2)%3]/d); + size[axis] = res; + size[(axis+1)%3] = (int)ceil(delta[(axis+1)%3]/d); + size[(axis+2)%3] = (int)ceil(delta[(axis+2)%3]/d); /* float errors grrr.. */ size[(axis+1)%3] = MIN2(size[(axis+1)%3],res); @@ -451,11 +452,11 @@ static void distribute_particles_in_grid(DerivedMesh *dm, ParticleSystem *psys) for(i=0,p=0,pa=psys->particles; i<res; i++){ for(j=0; j<res; j++){ for(k=0; k<res; k++,p++,pa++){ - pa->fuv[0]=min[0]+(float)i*d; - pa->fuv[1]=min[1]+(float)j*d; - pa->fuv[2]=min[2]+(float)k*d; + pa->fuv[0] = min[0] + (float)i*d; + pa->fuv[1] = min[1] + (float)j*d; + pa->fuv[2] = min[2] + (float)k*d; pa->flag |= PARS_UNEXIST; - pa->hair_index=0; /* abused in volume calculation */ + pa->hair_index = 0; /* abused in volume calculation */ } } } @@ -466,9 +467,9 @@ static void distribute_particles_in_grid(DerivedMesh *dm, ParticleSystem *psys) pa=psys->particles; - min[0]-=d/2.0f; - min[1]-=d/2.0f; - min[2]-=d/2.0f; + min[0] -= d/2.0f; + min[1] -= d/2.0f; + min[2] -= d/2.0f; for(i=0,mv=mvert; i<totvert; i++,mv++){ sub_v3_v3v3(vec,mv->co,min); @@ -500,20 +501,20 @@ static void distribute_particles_in_grid(DerivedMesh *dm, ParticleSystem *psys) for(a2=0; a2<size[(a+2)%3]; a2++){ mface= mface_array; - pa=psys->particles + a1*a1mul + a2*a2mul; - VECCOPY(co1,pa->fuv); - co1[a]-= d < delta[a] ? d/2.f : delta[a]/2.f; - VECCOPY(co2,co1); - co2[a]+=delta[a] + 0.001f*d; - co1[a]-=0.001f*d; + pa = psys->particles + a1*a1mul + a2*a2mul; + copy_v3_v3(co1, pa->fuv); + co1[a] -= d < delta[a] ? d/2.f : delta[a]/2.f; + copy_v3_v3(co2, co1); + co2[a] += delta[a] + 0.001f*d; + co1[a] -= 0.001f*d; /* lets intersect the faces */ for(i=0; i<totface; i++,mface++){ - VECCOPY(v1,mvert[mface->v1].co); - VECCOPY(v2,mvert[mface->v2].co); - VECCOPY(v3,mvert[mface->v3].co); + copy_v3_v3(v1, mvert[mface->v1].co); + copy_v3_v3(v2, mvert[mface->v2].co); + copy_v3_v3(v3, mvert[mface->v3].co); - if(isect_axial_line_tri_v3(a,co1, co2, v2, v3, v1, &lambda)){ + if(isect_axial_line_tri_v3(a, co1, co2, v2, v3, v1, &lambda)){ if(from==PART_FROM_FACE) (pa+(int)(lambda*size[a])*a0mul)->flag &= ~PARS_UNEXIST; else /* store number of intersections */ @@ -521,9 +522,9 @@ static void distribute_particles_in_grid(DerivedMesh *dm, ParticleSystem *psys) } if(mface->v4){ - VECCOPY(v4,mvert[mface->v4].co); + copy_v3_v3(v4, mvert[mface->v4].co); - if(isect_axial_line_tri_v3(a,co1, co2, v4, v1, v3, &lambda)){ + if(isect_axial_line_tri_v3(a, co1, co2, v4, v1, v3, &lambda)){ if(from==PART_FROM_FACE) (pa+(int)(lambda*size[a])*a0mul)->flag &= ~PARS_UNEXIST; else @@ -548,6 +549,22 @@ static void distribute_particles_in_grid(DerivedMesh *dm, ParticleSystem *psys) } } + if(psys->part->flag & PART_GRID_HEXAGONAL) { + for(i=0,p=0,pa=psys->particles; i<res; i++){ + for(j=0; j<res; j++){ + for(k=0; k<res; k++,p++,pa++){ + if(j%2) + pa->fuv[0] += d/2.f; + + if(k%2) { + pa->fuv[0] += d/2.f; + pa->fuv[1] += d/2.f; + } + } + } + } + } + if(psys->part->flag & PART_GRID_INVERT){ for(i=0; i<size[0]; i++){ for(j=0; j<size[1]; j++){ @@ -1519,62 +1536,37 @@ void psys_threads_free(ParticleThread *threads) /* set particle parameters that don't change during particle's life */ void initialize_particle(ParticleSimulationData *sim, ParticleData *pa, int p) { - ParticleSettings *part = sim->psys->part; + ParticleSystem *psys = sim->psys; + ParticleSettings *part = psys->part; ParticleTexture ptex; - Material *ma=0; - //IpoCurve *icu=0; // XXX old animation system - int totpart; - - totpart=sim->psys->totpart; - - ptex.life=ptex.size=ptex.exist=ptex.length=1.0; - ptex.time=(float)p/(float)totpart; - - BLI_srandom(sim->psys->seed + p + 125); - if(part->from!=PART_FROM_PARTICLE && part->type!=PART_FLUID){ - ma=give_current_material(sim->ob,part->omat); + pa->flag &= ~PARS_UNEXIST; - /* TODO: needs some work to make most blendtypes generally usefull */ - psys_get_texture(sim,ma,pa,&ptex,MAP_PA_INIT); - } - - if(part->type==PART_HAIR) - pa->time= 0.0f; - //else if(part->type==PART_REACTOR && (part->flag&PART_REACT_STA_END)==0) - // pa->time= 300000.0f; /* max frame */ - else{ - //icu=find_ipocurve(psys->part->ipo,PART_EMIT_TIME); - //if(icu){ - // calc_icu(icu,100*ptex.time); - // ptex.time=icu->curval; - //} - - pa->time= part->sta + (part->end - part->sta)*ptex.time; - } - - if(part->type!=PART_HAIR && part->distr!=PART_DISTR_GRID && part->from != PART_FROM_VERT){ - if(ptex.exist < BLI_frand()) + if(part->from != PART_FROM_PARTICLE && part->type != PART_FLUID) { + psys_get_texture(sim, pa, &ptex, PAMAP_INIT, 0.f); + + if(ptex.exist < PSYS_FRAND(p+125)) pa->flag |= PARS_UNEXIST; - else - pa->flag &= ~PARS_UNEXIST; + + pa->time = (part->type == PART_HAIR) ? 0.f : part->sta + (part->end - part->sta)*ptex.time; } - pa->hair_index=0; + pa->hair_index = 0; /* we can't reset to -1 anymore since we've figured out correct index in distribute_particles */ /* usage other than straight after distribute has to handle this index by itself - jahka*/ //pa->num_dmcache = DMCACHE_NOTFOUND; /* assume we dont have a derived mesh face */ } static void initialize_all_particles(ParticleSimulationData *sim) { - //IpoCurve *icu=0; // XXX old animation system ParticleSystem *psys = sim->psys; PARTICLE_P; psys->totunexist = 0; LOOP_PARTICLES { - initialize_particle(sim, pa, p); + if((pa->flag & PARS_UNEXIST)==0) + initialize_particle(sim, pa, p); + if(pa->flag & PARS_UNEXIST) psys->totunexist++; } @@ -1616,60 +1608,6 @@ static void initialize_all_particles(ParticleSimulationData *sim) } } - - if(psys->part->type != PART_FLUID) { -#if 0 // XXX old animation system - icu=find_ipocurve(psys->part->ipo,PART_EMIT_FREQ); - if(icu){ - float time=psys->part->sta, end=psys->part->end; - float v1, v2, a=0.0f, t1,t2, d; - - p=0; - pa=psys->particles; - - - calc_icu(icu,time); - v1=icu->curval; - if(v1<0.0f) v1=0.0f; - - calc_icu(icu,time+1.0f); - v2=icu->curval; - if(v2<0.0f) v2=0.0f; - - for(p=0, pa=psys->particles; p<totpart && time<end; p++, pa++){ - while(a+0.5f*(v1+v2) < (float)(p+1) && time<end){ - a+=0.5f*(v1+v2); - v1=v2; - time++; - calc_icu(icu,time+1.0f); - v2=icu->curval; - } - if(time<end){ - if(v1==v2){ - pa->time=time+((float)(p+1)-a)/v1; - } - else{ - d=(float)sqrt(v1*v1-2.0f*(v2-v1)*(a-(float)(p+1))); - t1=(-v1+d)/(v2-v1); - t2=(-v1-d)/(v2-v1); - - /* the root between 0-1 is the correct one */ - if(t1>0.0f && t1<=1.0f) - pa->time=time+t1; - else - pa->time=time+t2; - } - } - - pa->dietime = pa->time+pa->lifetime; - pa->flag &= ~PARS_UNEXIST; - } - for(; p<totpart; p++, pa++){ - pa->flag |= PARS_UNEXIST; - } - } -#endif // XXX old animation system - } } /* sets particle to the emitter surface with initial velocity & rotation */ void reset_particle(ParticleSimulationData *sim, ParticleData *pa, float dtime, float cfra) @@ -1678,35 +1616,14 @@ void reset_particle(ParticleSimulationData *sim, ParticleData *pa, float dtime, ParticleSystem *psys = sim->psys; ParticleSettings *part; ParticleTexture ptex; - ParticleKey state; - //IpoCurve *icu=0; // XXX old animation system float fac, phasefac, nor[3]={0,0,0},loc[3],vel[3]={0.0,0.0,0.0},rot[4],q2[4]; float r_vel[3],r_ave[3],r_rot[4],vec[3],p_vel[3]={0.0,0.0,0.0}; float x_vec[3]={1.0,0.0,0.0}, utan[3]={0.0,1.0,0.0}, vtan[3]={0.0,0.0,1.0}, rot_vec[3]={0.0,0.0,0.0}; - float q_phase[4], r_phase; + float q_phase[4]; int p = pa - psys->particles; part=psys->part; - - ptex.ivel=1.0; - ptex.life=1.0; - - /* we need to get every random even if they're not used so that they don't effect eachother */ - r_vel[0] = 2.0f * (PSYS_FRAND(p + 10) - 0.5f); - r_vel[1] = 2.0f * (PSYS_FRAND(p + 11) - 0.5f); - r_vel[2] = 2.0f * (PSYS_FRAND(p + 12) - 0.5f); - - r_ave[0] = 2.0f * (PSYS_FRAND(p + 13) - 0.5f); - r_ave[1] = 2.0f * (PSYS_FRAND(p + 14) - 0.5f); - r_ave[2] = 2.0f * (PSYS_FRAND(p + 15) - 0.5f); - - r_rot[0] = 2.0f * (PSYS_FRAND(p + 16) - 0.5f); - r_rot[1] = 2.0f * (PSYS_FRAND(p + 17) - 0.5f); - r_rot[2] = 2.0f * (PSYS_FRAND(p + 18) - 0.5f); - r_rot[3] = 2.0f * (PSYS_FRAND(p + 19) - 0.5f); - normalize_qt(r_rot); - - r_phase = PSYS_FRAND(p + 20); +#if 0 /* deprecated code */ if(part->from==PART_FROM_PARTICLE){ float speed; ParticleSimulationData tsim= {0}; @@ -1733,79 +1650,93 @@ void reset_particle(ParticleSimulationData *sim, ParticleData *pa, float dtime, VECCOPY(pa->fuv, loc); /* abusing pa->fuv (not used for "from particle") for storing emit location */ } else{ - /* get precise emitter matrix if particle is born */ - if(part->type!=PART_HAIR && pa->time < cfra && pa->time >= sim->psys->cfra) { - /* we have to force RECALC_ANIM here since where_is_objec_time only does drivers */ - BKE_animsys_evaluate_animdata(&sim->ob->id, sim->ob->adt, pa->time, ADT_RECALC_ANIM); - where_is_object_time(sim->scene, sim->ob, pa->time); - } +#endif + /* get precise emitter matrix if particle is born */ + if(part->type!=PART_HAIR && pa->time < cfra && pa->time >= sim->psys->cfra) { + /* we have to force RECALC_ANIM here since where_is_objec_time only does drivers */ + BKE_animsys_evaluate_animdata(&sim->ob->id, sim->ob->adt, pa->time, ADT_RECALC_ANIM); + where_is_object_time(sim->scene, sim->ob, pa->time); + } - /* get birth location from object */ - if(part->tanfac!=0.0) - psys_particle_on_emitter(sim->psmd, part->from,pa->num, pa->num_dmcache, pa->fuv,pa->foffset,loc,nor,utan,vtan,0,0); - else - psys_particle_on_emitter(sim->psmd, part->from,pa->num, pa->num_dmcache, pa->fuv,pa->foffset,loc,nor,0,0,0,0); + /* get birth location from object */ + if(part->tanfac != 0.f) + psys_particle_on_emitter(sim->psmd, part->from,pa->num, pa->num_dmcache, pa->fuv,pa->foffset,loc,nor,utan,vtan,0,0); + else + psys_particle_on_emitter(sim->psmd, part->from,pa->num, pa->num_dmcache, pa->fuv,pa->foffset,loc,nor,0,0,0,0); - /* get possible textural influence */ - psys_get_texture(sim, give_current_material(sim->ob,part->omat), pa, &ptex, MAP_PA_IVEL|MAP_PA_LIFE); + /* get possible textural influence */ + psys_get_texture(sim, pa, &ptex, PAMAP_IVEL|PAMAP_LIFE, cfra); - //if(vg_vel && pa->num != -1) - // ptex.ivel*=psys_particle_value_from_verts(sim->psmd->dm,part->from,pa,vg_vel); - - /* particles live in global space so */ - /* let's convert: */ - /* -location */ - mul_m4_v3(ob->obmat,loc); + /* particles live in global space so */ + /* let's convert: */ + /* -location */ + mul_m4_v3(ob->obmat, loc); - /* -normal */ - mul_mat3_m4_v3(ob->obmat,nor); - normalize_v3(nor); - - /* -tangent */ - if(part->tanfac!=0.0){ - //float phase=vg_rot?2.0f*(psys_particle_value_from_verts(sim->psmd->dm,part->from,pa,vg_rot)-0.5f):0.0f; - float phase=0.0f; - mul_v3_fl(vtan,-(float)cos(M_PI*(part->tanphase+phase))); - fac=-(float)sin(M_PI*(part->tanphase+phase)); - VECADDFAC(vtan,vtan,utan,fac); - - mul_mat3_m4_v3(ob->obmat,vtan); - - VECCOPY(utan,nor); - mul_v3_fl(utan,dot_v3v3(vtan,nor)); - VECSUB(vtan,vtan,utan); + /* -normal */ + mul_mat3_m4_v3(ob->obmat, nor); + normalize_v3(nor); + + /* -tangent */ + if(part->tanfac!=0.0){ + //float phase=vg_rot?2.0f*(psys_particle_value_from_verts(sim->psmd->dm,part->from,pa,vg_rot)-0.5f):0.0f; + float phase=0.0f; + mul_v3_fl(vtan,-(float)cos(M_PI*(part->tanphase+phase))); + fac=-(float)sin(M_PI*(part->tanphase+phase)); + VECADDFAC(vtan,vtan,utan,fac); + + mul_mat3_m4_v3(ob->obmat,vtan); + + VECCOPY(utan,nor); + mul_v3_fl(utan,dot_v3v3(vtan,nor)); + VECSUB(vtan,vtan,utan); - normalize_v3(vtan); - } + normalize_v3(vtan); + } - /* -velocity */ - if(part->randfac!=0.0){ - mul_mat3_m4_v3(ob->obmat,r_vel); - normalize_v3(r_vel); - } + /* -velocity */ + if(part->randfac!=0.0){ + r_vel[0] = 2.0f * (PSYS_FRAND(p + 10) - 0.5f); + r_vel[1] = 2.0f * (PSYS_FRAND(p + 11) - 0.5f); + r_vel[2] = 2.0f * (PSYS_FRAND(p + 12) - 0.5f); - /* -angular velocity */ - if(part->avemode==PART_AVE_RAND){ - mul_mat3_m4_v3(ob->obmat,r_ave); - normalize_v3(r_ave); - } + mul_mat3_m4_v3(ob->obmat, r_vel); + normalize_v3(r_vel); + } + + /* -angular velocity */ + if(part->avemode==PART_AVE_RAND){ + r_ave[0] = 2.0f * (PSYS_FRAND(p + 13) - 0.5f); + r_ave[1] = 2.0f * (PSYS_FRAND(p + 14) - 0.5f); + r_ave[2] = 2.0f * (PSYS_FRAND(p + 15) - 0.5f); + + mul_mat3_m4_v3(ob->obmat,r_ave); + normalize_v3(r_ave); + } - /* -rotation */ - if(part->randrotfac != 0.0f){ - mat4_to_quat(rot,ob->obmat); - mul_qt_qtqt(r_rot,r_rot,rot); - } + /* -rotation */ + if(part->randrotfac != 0.0f){ + r_rot[0] = 2.0f * (PSYS_FRAND(p + 16) - 0.5f); + r_rot[1] = 2.0f * (PSYS_FRAND(p + 17) - 0.5f); + r_rot[2] = 2.0f * (PSYS_FRAND(p + 18) - 0.5f); + r_rot[3] = 2.0f * (PSYS_FRAND(p + 19) - 0.5f); + normalize_qt(r_rot); + + mat4_to_quat(rot,ob->obmat); + mul_qt_qtqt(r_rot,r_rot,rot); + } +#if 0 } +#endif if(part->phystype==PART_PHYS_BOIDS && pa->boid) { BoidParticle *bpa = pa->boid; float dvec[3], q[4], mat[3][3]; - VECCOPY(pa->state.co,loc); + copy_v3_v3(pa->state.co,loc); /* boids don't get any initial velocity */ - pa->state.vel[0]=pa->state.vel[1]=pa->state.vel[2]=0.0f; + zero_v3(pa->state.vel); /* boids store direction in ave */ if(fabs(nor[2])==1.0f) { @@ -1844,66 +1775,56 @@ void reset_particle(ParticleSimulationData *sim, ParticleData *pa, float dtime, /* -velocity from: */ /* *reactions */ - if(dtime>0.0f){ - VECSUB(vel,pa->state.vel,pa->prev_state.vel); + if(dtime > 0.f){ + sub_v3_v3v3(vel, pa->state.vel, pa->prev_state.vel); } /* *emitter velocity */ - if(dtime!=0.0 && part->obfac!=0.0){ - VECSUB(vel,loc,pa->state.co); - mul_v3_fl(vel,part->obfac/dtime); + if(dtime != 0.f && part->obfac != 0.f){ + sub_v3_v3v3(vel, loc, pa->state.co); + mul_v3_fl(vel, part->obfac/dtime); } /* *emitter normal */ - if(part->normfac!=0.0) - VECADDFAC(vel,vel,nor,part->normfac); + if(part->normfac != 0.f) + madd_v3_v3fl(vel, nor, part->normfac); /* *emitter tangent */ - if(sim->psmd && part->tanfac!=0.0) - VECADDFAC(vel,vel,vtan,part->tanfac); - //VECADDFAC(vel,vel,vtan,part->tanfac*(vg_tan?psys_particle_value_from_verts(sim->psmd->dm,part->from,pa,vg_tan):1.0f)); + if(sim->psmd && part->tanfac != 0.f) + madd_v3_v3fl(vel, vtan, part->tanfac); /* *emitter object orientation */ - if(part->ob_vel[0]!=0.0) { + if(part->ob_vel[0] != 0.f) { normalize_v3_v3(vec, ob->obmat[0]); - VECADDFAC(vel, vel, vec, part->ob_vel[0]); + madd_v3_v3fl(vel, vec, part->ob_vel[0]); } - if(part->ob_vel[1]!=0.0) { + if(part->ob_vel[1] != 0.f) { normalize_v3_v3(vec, ob->obmat[1]); - VECADDFAC(vel, vel, vec, part->ob_vel[1]); + madd_v3_v3fl(vel, vec, part->ob_vel[1]); } - if(part->ob_vel[2]!=0.0) { + if(part->ob_vel[2] != 0.f) { normalize_v3_v3(vec, ob->obmat[2]); - VECADDFAC(vel, vel, vec, part->ob_vel[2]); + madd_v3_v3fl(vel, vec, part->ob_vel[2]); } /* *texture */ /* TODO */ /* *random */ - if(part->randfac!=0.0) - VECADDFAC(vel,vel,r_vel,part->randfac); + if(part->randfac != 0.f) + madd_v3_v3fl(vel, r_vel, part->randfac); /* *particle */ - if(part->partfac!=0.0) - VECADDFAC(vel,vel,p_vel,part->partfac); - - //icu=find_ipocurve(psys->part->ipo,PART_EMIT_VEL); - //if(icu){ - // calc_icu(icu,100*((pa->time-part->sta)/(part->end-part->sta))); - // ptex.ivel*=icu->curval; - //} - - mul_v3_fl(vel,ptex.ivel); + if(part->partfac != 0.f) + madd_v3_v3fl(vel, p_vel, part->partfac); - VECCOPY(pa->state.vel,vel); + mul_v3_v3fl(pa->state.vel, vel, ptex.ivel); /* -location from emitter */ - VECCOPY(pa->state.co,loc); + copy_v3_v3(pa->state.co,loc); /* -rotation */ - pa->state.rot[0]=1.0; - pa->state.rot[1]=pa->state.rot[2]=pa->state.rot[3]=0.0; + unit_qt(pa->state.rot); if(part->rotmode){ /* create vector into which rotation is aligned */ @@ -1939,7 +1860,7 @@ void reset_particle(ParticleSimulationData *sim, ParticleData *pa, float dtime, /* rotation phase */ phasefac = part->phasefac; if(part->randphasefac != 0.0f) - phasefac += part->randphasefac * r_phase; + phasefac += part->randphasefac * PSYS_FRAND(p + 20); axis_angle_to_quat( q_phase,x_vec, phasefac*(float)M_PI); /* combine base rotation & phase */ @@ -1948,25 +1869,19 @@ void reset_particle(ParticleSimulationData *sim, ParticleData *pa, float dtime, /* -angular velocity */ - pa->state.ave[0] = pa->state.ave[1] = pa->state.ave[2] = 0.0; + zero_v3(pa->state.ave); if(part->avemode){ switch(part->avemode){ case PART_AVE_SPIN: - VECCOPY(pa->state.ave,vel); + copy_v3_v3(pa->state.ave, vel); break; case PART_AVE_RAND: - VECCOPY(pa->state.ave,r_ave); + copy_v3_v3(pa->state.ave, r_ave); break; } normalize_v3(pa->state.ave); mul_v3_fl(pa->state.ave,part->avefac); - - //icu=find_ipocurve(psys->part->ipo,PART_EMIT_AVE); - //if(icu){ - // calc_icu(icu,100*((pa->time-part->sta)/(part->end-part->sta))); - // mul_v3_fl(pa->state.ave,icu->curval); - //} } } @@ -1975,7 +1890,7 @@ void reset_particle(ParticleSimulationData *sim, ParticleData *pa, float dtime, pa->lifetime = 100.0f; } else{ - pa->lifetime = part->lifetime*ptex.life; + pa->lifetime = part->lifetime * ptex.life; if(part->randlife != 0.0) pa->lifetime *= 1.0f - part->randlife * PSYS_FRAND(p + 21); @@ -2002,15 +1917,9 @@ static void reset_all_particles(ParticleSimulationData *sim, float dtime, float { ParticleData *pa; int p, totpart=sim->psys->totpart; - //float *vg_vel=psys_cache_vgroup(sim->psmd->dm,sim->psys,PSYS_VG_VEL); - //float *vg_tan=psys_cache_vgroup(sim->psmd->dm,sim->psys,PSYS_VG_TAN); - //float *vg_rot=psys_cache_vgroup(sim->psmd->dm,sim->psys,PSYS_VG_ROT); for(p=from, pa=sim->psys->particles+from; p<totpart; p++, pa++) reset_particle(sim, pa, dtime, cfra); - - //if(vg_vel) - // MEM_freeN(vg_vel); } /************************************************/ /* Particle targets */ @@ -2542,6 +2451,9 @@ static void apply_particle_forces(ParticleSimulationData *sim, int p, float dfra float force[3],impulse[3],dx[4][3],dv[4][3],oldpos[3]; float dtime=dfra*timestep, time, pa_mass=part->mass, fac /*, fra=sim->psys->cfra*/; int i, steps=1; + ParticleTexture ptex; + + psys_get_texture(sim, pa, &ptex, PAMAP_PHYSICS, cfra); /* maintain angular velocity */ VECCOPY(pa->state.ave,pa->prev_state.ave); @@ -2575,6 +2487,9 @@ static void apply_particle_forces(ParticleSimulationData *sim, int p, float dfra if(part->type != PART_HAIR || part->effector_weights->flag & EFF_WEIGHT_DO_HAIR) pdDoEffectors(sim->psys->effectors, sim->colliders, part->effector_weights, &epoint, force, impulse); + mul_v3_fl(force, ptex.field); + mul_v3_fl(impulse, ptex.field); + /* calculate air-particle interaction */ if(part->dragfac!=0.0f){ fac=-part->dragfac*pa->size*pa->size*len_v3(states[i].vel); @@ -2595,10 +2510,7 @@ static void apply_particle_forces(ParticleSimulationData *sim, int p, float dfra if(psys_uses_gravity(sim) /* normal gravity is too strong for hair so it's disabled by default */ && (part->type != PART_HAIR || part->effector_weights->flag & EFF_WEIGHT_DO_HAIR)) { - float gravity[3]; - VECCOPY(gravity, sim->scene->physics_settings.gravity); - mul_v3_fl(gravity, part->effector_weights->global_gravity); - VECADD(force,force,gravity); + madd_v3_v3fl(force, sim->scene->physics_settings.gravity, part->effector_weights->global_gravity * ptex.gravity); } /* calculate next state */ @@ -2679,8 +2591,8 @@ static void apply_particle_forces(ParticleSimulationData *sim, int p, float dfra } /* damp affects final velocity */ - if(part->dampfac!=0.0) - mul_v3_fl(pa->state.vel,1.0f-part->dampfac); + if(part->dampfac != 0.f) + mul_v3_fl(pa->state.vel, 1.f - part->dampfac * ptex.damp); VECCOPY(pa->state.ave, states->ave); @@ -3471,6 +3383,7 @@ static void dynamics_step(ParticleSimulationData *sim, float cfra) ParticleSystem *psys = sim->psys; ParticleSettings *part=psys->part; BoidBrainData bbd; + ParticleTexture ptex; PARTICLE_P; float timestep; /* frame & time changes */ @@ -3485,7 +3398,8 @@ static void dynamics_step(ParticleSimulationData *sim, float cfra) if(dfra<0.0){ LOOP_EXISTING_PARTICLES { - pa->size = part->size; + psys_get_texture(sim, pa, &ptex, PAMAP_SIZE, cfra); + pa->size = part->size*ptex.size; if(part->randsize > 0.0) pa->size *= 1.0f - part->randsize * PSYS_FRAND(p + 1); @@ -3538,7 +3452,9 @@ static void dynamics_step(ParticleSimulationData *sim, float cfra) LOOP_SHOWN_PARTICLES { copy_particle_key(&pa->prev_state,&pa->state,1); - pa->size = part->size; + psys_get_texture(sim, pa, &ptex, PAMAP_SIZE, cfra); + + pa->size = part->size*ptex.size; if(part->randsize > 0.0) pa->size *= 1.0f - part->randsize * PSYS_FRAND(p + 1); @@ -3685,6 +3601,7 @@ static void cached_step(ParticleSimulationData *sim, float cfra) { ParticleSystem *psys = sim->psys; ParticleSettings *part = psys->part; + ParticleTexture ptex; PARTICLE_P; float disp, dietime; @@ -3695,7 +3612,8 @@ static void cached_step(ParticleSimulationData *sim, float cfra) disp= (float)psys_get_current_display_percentage(psys)/100.0f; LOOP_PARTICLES { - pa->size = part->size; + psys_get_texture(sim, pa, &ptex, PAMAP_SIZE, cfra); + pa->size = part->size*ptex.size; if(part->randsize > 0.0) pa->size *= 1.0f - part->randsize * PSYS_FRAND(p + 1); @@ -3744,8 +3662,6 @@ static void particles_fluid_step(ParticleSimulationData *sim, int UNUSED(cfra)) FluidsimSettings *fss= fluidmd->fss; ParticleSettings *part = psys->part; ParticleData *pa=NULL; - const char *suffix = "fluidsurface_particles_####"; - const char *suffix2 = ".gz"; char filename[256]; char debugStrBuffer[256]; int curFrame = sim->scene->r.cfra -1; // warning - sync with derived mesh fsmesh loading @@ -3755,14 +3671,13 @@ static void particles_fluid_step(ParticleSimulationData *sim, int UNUSED(cfra)) // XXX if(ob==G.obedit) // off... // return; - + // ok, start loading - strcpy(filename, fss->surfdataPath); - strcat(filename, suffix); + BLI_snprintf(filename, sizeof(filename), "%sfluidsurface_particles_####.gz", fss->surfdataPath); + BLI_path_abs(filename, G.main->name); BLI_path_frame(filename, curFrame, 0); // fixed #frame-no - strcat(filename, suffix2); - + gzf = gzopen(filename, "rb"); if (!gzf) { snprintf(debugStrBuffer,256,"readFsPartData::error - Unable to open file for reading '%s' \n", filename); diff --git a/source/blender/blenkernel/intern/pointcache.c b/source/blender/blenkernel/intern/pointcache.c index 65bf055886e..c2ec463c708 100644 --- a/source/blender/blenkernel/intern/pointcache.c +++ b/source/blender/blenkernel/intern/pointcache.c @@ -1992,7 +1992,7 @@ void BKE_ptcache_id_clear(PTCacheID *pid, int mode, unsigned int cfra) if (strncmp(filename, de->d_name, len ) == 0) { /* do we have the right prefix */ if (mode == PTCACHE_CLEAR_ALL) { pid->cache->last_exact = MIN2(pid->cache->startframe, 0); - BLI_join_dirfile(path_full, path, de->d_name); + BLI_join_dirfile(path_full, sizeof(path_full), path, de->d_name); BLI_delete(path_full, 0, 0); } else { /* read the number of the file */ @@ -2006,7 +2006,7 @@ void BKE_ptcache_id_clear(PTCacheID *pid, int mode, unsigned int cfra) if((mode==PTCACHE_CLEAR_BEFORE && frame < cfra) || (mode==PTCACHE_CLEAR_AFTER && frame > cfra) ) { - BLI_join_dirfile(path_full, path, de->d_name); + BLI_join_dirfile(path_full, sizeof(path_full), path, de->d_name); BLI_delete(path_full, 0, 0); if(pid->cache->cached_frames && frame >=sta && frame <= end) pid->cache->cached_frames[frame-sta] = 0; @@ -2354,7 +2354,7 @@ void BKE_ptcache_remove(void) if( strcmp(de->d_name, ".")==0 || strcmp(de->d_name, "..")==0) { /* do nothing */ } else if (strstr(de->d_name, PTCACHE_EXT)) { /* do we have the right extension?*/ - BLI_join_dirfile(path_full, path, de->d_name); + BLI_join_dirfile(path_full, sizeof(path_full), path, de->d_name); BLI_delete(path_full, 0, 0); } else { rmdir = 0; /* unknown file, dont remove the dir */ @@ -2390,7 +2390,7 @@ void BKE_ptcache_set_continue_physics(Main *bmain, Scene *scene, int enable) } } -int BKE_ptcache_get_continue_physics() +int BKE_ptcache_get_continue_physics(void) { return CONTINUE_PHYSICS; } @@ -2856,13 +2856,14 @@ void BKE_ptcache_disk_cache_rename(PTCacheID *pid, char *from, char *to) BLI_strncpy(num, de->d_name + (strlen(de->d_name) - 15), sizeof(num)); frame = atoi(num); - BLI_join_dirfile(old_path_full, path, de->d_name); + BLI_join_dirfile(old_path_full, sizeof(old_path_full), path, de->d_name); ptcache_filename(pid, new_path_full, frame, 1, 1); BLI_rename(old_path_full, new_path_full); } } } } + closedir(dir); strcpy(pid->cache->name, old_name); } @@ -2929,8 +2930,10 @@ void BKE_ptcache_load_external(PTCacheID *pid) cache->endframe = end; cache->totpoint = 0; + if(pid->type == PTCACHE_TYPE_SMOKE_DOMAIN) + ; /*necessary info in every file*/ /* read totpoint from info file (frame 0) */ - if(info) { + else if(info) { pf= ptcache_file_open(pid, PTCACHE_FILE_READ, 0); if(pf) { diff --git a/source/blender/blenkernel/intern/property.c b/source/blender/blenkernel/intern/property.c index dd57fef50c5..e907b628242 100644 --- a/source/blender/blenkernel/intern/property.c +++ b/source/blender/blenkernel/intern/property.c @@ -43,6 +43,8 @@ #include "BLI_blenlib.h" +#include "BKE_property.h" + void free_property(bProperty *prop) { @@ -93,7 +95,7 @@ void init_property(bProperty *prop) /* also use when property changes type */ if(prop->poin && prop->poin != &prop->data) MEM_freeN(prop->poin); - prop->poin= 0; + prop->poin= NULL; prop->data= 0; diff --git a/source/blender/blenkernel/intern/sca.c b/source/blender/blenkernel/intern/sca.c index 12f82d041f9..c8ef834fbbb 100644 --- a/source/blender/blenkernel/intern/sca.c +++ b/source/blender/blenkernel/intern/sca.c @@ -86,7 +86,7 @@ void copy_sensors(ListBase *lbn, ListBase *lbo) { bSensor *sens, *sensn; - lbn->first= lbn->last= 0; + lbn->first= lbn->last= NULL; sens= lbo->first; while(sens) { sensn= copy_sensor(sens); @@ -253,7 +253,7 @@ void copy_controllers(ListBase *lbn, ListBase *lbo) { bController *cont, *contn; - lbn->first= lbn->last= 0; + lbn->first= lbn->last= NULL; cont= lbo->first; while(cont) { contn= copy_controller(cont); @@ -267,7 +267,7 @@ void init_controller(bController *cont) /* also use when controller changes type, leave actuators... */ if(cont->data) MEM_freeN(cont->data); - cont->data= 0; + cont->data= NULL; switch(cont->type) { case CONT_EXPRESSION: @@ -375,7 +375,7 @@ void copy_actuators(ListBase *lbn, ListBase *lbo) { bActuator *act, *actn; - lbn->first= lbn->last= 0; + lbn->first= lbn->last= NULL; act= lbo->first; while(act) { actn= copy_actuator(act); @@ -393,7 +393,7 @@ void init_actuator(bActuator *act) bSoundActuator *sa; if(act->data) MEM_freeN(act->data); - act->data= 0; + act->data= NULL; switch(act->type) { case ACT_ACTION: @@ -512,7 +512,7 @@ void clear_sca_new_poins_ob(Object *ob) } } -void clear_sca_new_poins() +void clear_sca_new_poins(void) { Object *ob; @@ -595,7 +595,7 @@ void set_sca_new_poins_ob(Object *ob) } -void set_sca_new_poins() +void set_sca_new_poins(void) { Object *ob; diff --git a/source/blender/blenkernel/intern/scene.c b/source/blender/blenkernel/intern/scene.c index 3c58b97a0c0..84869fde206 100644 --- a/source/blender/blenkernel/intern/scene.c +++ b/source/blender/blenkernel/intern/scene.c @@ -173,7 +173,7 @@ Scene *copy_scene(Scene *sce, int type) BKE_keyingsets_copy(&(scen->keyingsets), &(sce->keyingsets)); if(sce->nodetree) { - scen->nodetree= ntreeCopyTree(sce->nodetree, 0); /* copies actions */ + scen->nodetree= ntreeCopyTree(sce->nodetree); /* copies actions */ ntreeSwitchID(scen->nodetree, &sce->id, &scen->id); } @@ -588,7 +588,7 @@ void set_scene_bg(Main *bmain, Scene *scene) } /* called from creator.c */ -Scene *set_scene_name(Main *bmain, char *name) +Scene *set_scene_name(Main *bmain, const char *name) { Scene *sce= (Scene *)find_id("SC", name); if(sce) { @@ -952,27 +952,68 @@ float BKE_curframe(Scene *scene) return ctime; } +/* drivers support/hacks + * - this method is called from scene_update_tagged_recursive(), so gets included in viewport + render + * - these are always run since the depsgraph can't handle non-object data + * - these happen after objects are all done so that we can read in their final transform values, + * though this means that objects can't refer to scene info for guidance... + */ +static void scene_update_drivers(Main *UNUSED(bmain), Scene *scene) +{ + float ctime = BKE_curframe(scene); + + /* scene itself */ + if (scene->adt && scene->adt->drivers.first) { + BKE_animsys_evaluate_animdata(&scene->id, scene->adt, ctime, ADT_RECALC_DRIVERS); + } + + /* world */ + // TODO: what about world textures? but then those have nodes too... + if (scene->world) { + ID *wid = (ID *)scene->world; + AnimData *adt= BKE_animdata_from_id(wid); + + if (adt && adt->drivers.first) + BKE_animsys_evaluate_animdata(wid, adt, ctime, ADT_RECALC_DRIVERS); + } + + /* nodes */ + if (scene->nodetree) { + ID *nid = (ID *)scene->nodetree; + AnimData *adt= BKE_animdata_from_id(nid); + + if (adt && adt->drivers.first) + BKE_animsys_evaluate_animdata(nid, adt, ctime, ADT_RECALC_DRIVERS); + } +} + static void scene_update_tagged_recursive(Main *bmain, Scene *scene, Scene *scene_parent) { Base *base; + + scene->customdata_mask= scene_parent->customdata_mask; /* sets first, we allow per definition current scene to have dependencies on sets, but not the other way around. */ - if(scene->set) + if (scene->set) scene_update_tagged_recursive(bmain, scene->set, scene_parent); - - for(base= scene->base.first; base; base= base->next) { + + /* scene objects */ + for (base= scene->base.first; base; base= base->next) { Object *ob= base->object; - + object_handle_update(scene_parent, ob); - + if(ob->dup_group && (ob->transflag & OB_DUPLIGROUP)) group_handle_recalc_and_update(scene_parent, ob, ob->dup_group); /* always update layer, so that animating layers works */ base->lay= ob->lay; } + + /* scene drivers... */ + scene_update_drivers(bmain, scene); } /* this is called in main loop, doing tagged updates before redraw */ @@ -989,14 +1030,14 @@ void scene_update_tagged(Main *bmain, Scene *scene) /* recalc scene animation data here (for sequencer) */ { - float ctime = BKE_curframe(scene); AnimData *adt= BKE_animdata_from_id(&scene->id); - - if(adt && (adt->recalc & ADT_RECALC_ANIM)) + float ctime = BKE_curframe(scene); + + if (adt && (adt->recalc & ADT_RECALC_ANIM)) BKE_animsys_evaluate_animdata(&scene->id, adt, ctime, 0); } - - if(scene->physics_settings.quick_cache_step) + + if (scene->physics_settings.quick_cache_step) BKE_ptcache_quick_cache_all(bmain, scene); /* in the future this should handle updates for all datablocks, not diff --git a/source/blender/blenkernel/intern/screen.c b/source/blender/blenkernel/intern/screen.c index 6f1d32898f9..58900e603e3 100644 --- a/source/blender/blenkernel/intern/screen.c +++ b/source/blender/blenkernel/intern/screen.c @@ -109,7 +109,7 @@ ARegionType *BKE_regiontype_from_id(SpaceType *st, int regionid) } -const ListBase *BKE_spacetypes_list() +const ListBase *BKE_spacetypes_list(void) { return &spacetypes; } diff --git a/source/blender/blenkernel/intern/seqcache.c b/source/blender/blenkernel/intern/seqcache.c index 78cd4bb51fe..1c40ef020be 100644 --- a/source/blender/blenkernel/intern/seqcache.c +++ b/source/blender/blenkernel/intern/seqcache.c @@ -54,10 +54,10 @@ typedef struct seqCacheEntry MEM_CacheLimiterHandleC * c_handle; } seqCacheEntry; -static GHash * hash = 0; -static MEM_CacheLimiterC * limitor = 0; -static struct BLI_mempool * entrypool = 0; -static struct BLI_mempool * keypool = 0; +static GHash * hash = NULL; +static MEM_CacheLimiterC * limitor = NULL; +static struct BLI_mempool * entrypool = NULL; +static struct BLI_mempool * keypool = NULL; static int ibufs_in = 0; static int ibufs_rem = 0; @@ -119,8 +119,8 @@ static void HashValFree(void *val) ibufs_rem++; } - e->ibuf = 0; - e->c_handle = 0; + e->ibuf = NULL; + e->c_handle = NULL; BLI_mempool_free(entrypool, e); } @@ -135,12 +135,12 @@ static void IMB_seq_cache_destructor(void * p) IMB_freeImBuf(e->ibuf); ibufs_rem++; - e->ibuf = 0; - e->c_handle = 0; + e->ibuf = NULL; + e->c_handle = NULL; } } -void seq_stripelem_cache_init() +void seq_stripelem_cache_init(void) { hash = BLI_ghash_new(HashHash, HashCmp, "seq stripelem cache hash"); limitor = new_MEM_CacheLimiter( IMB_seq_cache_destructor ); @@ -149,7 +149,7 @@ void seq_stripelem_cache_init() keypool = BLI_mempool_create(sizeof(seqCacheKey), 64, 64, 0); } -void seq_stripelem_cache_destruct() +void seq_stripelem_cache_destruct(void) { if (!entrypool) { return; @@ -160,7 +160,7 @@ void seq_stripelem_cache_destruct() BLI_mempool_destroy(keypool); } -void seq_stripelem_cache_cleanup() +void seq_stripelem_cache_cleanup(void) { if (!entrypool) { seq_stripelem_cache_init(); @@ -185,7 +185,7 @@ struct ImBuf * seq_stripelem_cache_get( seqCacheEntry * e; if (!seq) { - return 0; + return NULL; } if (!entrypool) { @@ -205,7 +205,7 @@ struct ImBuf * seq_stripelem_cache_get( MEM_CacheLimiter_touch(e->c_handle); return e->ibuf; } - return 0; + return NULL; } void seq_stripelem_cache_put( @@ -239,7 +239,7 @@ void seq_stripelem_cache_put( e = (seqCacheEntry*) BLI_mempool_alloc(entrypool); e->ibuf = i; - e->c_handle = 0; + e->c_handle = NULL; BLI_ghash_remove(hash, key, HashKeyFree, HashValFree); BLI_ghash_insert(hash, key, e); diff --git a/source/blender/blenkernel/intern/seqeffects.c b/source/blender/blenkernel/intern/seqeffects.c index 11075fe402e..da90ce4a715 100644 --- a/source/blender/blenkernel/intern/seqeffects.c +++ b/source/blender/blenkernel/intern/seqeffects.c @@ -125,12 +125,12 @@ static void open_plugin_seq(PluginSeq *pis, const char *seqname) char *cp; /* to be sure: (is tested for) */ - pis->doit= 0; - pis->pname= 0; - pis->varstr= 0; - pis->cfra= 0; + pis->doit= NULL; + pis->pname= NULL; + pis->varstr= NULL; + pis->cfra= NULL; pis->version= 0; - pis->instance_private_data = 0; + pis->instance_private_data = NULL; /* clear the error list */ PIL_dynlib_get_error_as_string(NULL); @@ -142,12 +142,12 @@ static void open_plugin_seq(PluginSeq *pis, const char *seqname) pis->handle= PIL_dynlib_open(pis->name); if(test_dlerr(pis->name, pis->name)) return; - if (pis->handle != 0) { + if (pis->handle != NULL) { /* find the address of the version function */ version= (int (*)(void))PIL_dynlib_find_symbol(pis->handle, "plugin_seq_getversion"); if (test_dlerr(pis->name, "plugin_seq_getversion")) return; - if (version != 0) { + if (version != NULL) { pis->version= version(); if (pis->version >= 2 && pis->version <= 6) { int (*info_func)(PluginInfo *); @@ -201,11 +201,11 @@ static PluginSeq *add_plugin_seq(const char *str, const char *seqname) strncpy(pis->name, str, FILE_MAXDIR+FILE_MAXFILE); open_plugin_seq(pis, seqname); - if(pis->doit==0) { - if(pis->handle==0) error("no plugin: %s", str); + if(pis->doit==NULL) { + if(pis->handle==NULL) error("no plugin: %s", str); else error("in plugin: %s", str); MEM_freeN(pis); - return 0; + return NULL; } /* default values */ @@ -222,7 +222,7 @@ static PluginSeq *add_plugin_seq(const char *str, const char *seqname) static void free_plugin_seq(PluginSeq *pis) { - if(pis==0) return; + if(pis==NULL) return; /* no PIL_dynlib_close: same plugin can be opened multiple times with 1 handle */ @@ -270,7 +270,7 @@ static void copy_plugin(Sequence * dst, Sequence * src) static ImBuf * IMB_cast_away_list(ImBuf * i) { if (!i) { - return 0; + return NULL; } return (ImBuf*) (((void**) i) + 2); } @@ -383,7 +383,7 @@ static int do_plugin_early_out(struct Sequence *UNUSED(seq), static void free_plugin(struct Sequence * seq) { free_plugin_seq(seq->plugin); - seq->plugin = 0; + seq->plugin = NULL; } /* ********************************************************************** @@ -554,7 +554,7 @@ static struct ImBuf * do_alphaover_effect( ALPHA UNDER ********************************************************************** */ -void do_alphaunder_effect_byte( +static void do_alphaunder_effect_byte( float facf0, float facf1, int x, int y, char *rect1, char *rect2, char *out) { @@ -726,7 +726,7 @@ static struct ImBuf* do_alphaunder_effect( CROSS ********************************************************************** */ -void do_cross_effect_byte(float facf0, float facf1, int x, int y, +static void do_cross_effect_byte(float facf0, float facf1, int x, int y, char *rect1, char *rect2, char *out) { @@ -774,7 +774,7 @@ void do_cross_effect_byte(float facf0, float facf1, int x, int y, } } -void do_cross_effect_float(float facf0, float facf1, int x, int y, +static void do_cross_effect_float(float facf0, float facf1, int x, int y, float *rect1, float *rect2, float *out) { float fac1, fac2, fac3, fac4; @@ -1864,7 +1864,7 @@ static int num_inputs_wipe(void) static void free_wipe_effect(Sequence *seq) { if(seq->effectdata)MEM_freeN(seq->effectdata); - seq->effectdata = 0; + seq->effectdata = NULL; } static void copy_wipe_effect(Sequence *dst, Sequence *src) @@ -2048,7 +2048,7 @@ static int num_inputs_transform(void) static void free_transform_effect(Sequence *seq) { if(seq->effectdata)MEM_freeN(seq->effectdata); - seq->effectdata = 0; + seq->effectdata = NULL; } static void copy_transform_effect(Sequence *dst, Sequence *src) @@ -2617,7 +2617,7 @@ static int num_inputs_glow(void) static void free_glow_effect(Sequence *seq) { if(seq->effectdata)MEM_freeN(seq->effectdata); - seq->effectdata = 0; + seq->effectdata = NULL; } static void copy_glow_effect(Sequence *dst, Sequence *src) @@ -2704,7 +2704,7 @@ static int num_inputs_color(void) static void free_solid_color(Sequence *seq) { if(seq->effectdata)MEM_freeN(seq->effectdata); - seq->effectdata = 0; + seq->effectdata = NULL; } static void copy_solid_color(Sequence *dst, Sequence *src) @@ -2827,21 +2827,21 @@ static struct ImBuf * do_multicam( ListBase * seqbasep; if (seq->multicam_source == 0 || seq->multicam_source >= seq->machine) { - return 0; + return NULL; } ed = context.scene->ed; if (!ed) { - return 0; + return NULL; } seqbasep = seq_seqbase(&ed->seqbase, seq); if (!seqbasep) { - return 0; + return NULL; } i = give_ibuf_seqbase(context, cfra, seq->multicam_source, seqbasep); if (!i) { - return 0; + return NULL; } if (input_have_to_preprocess(context, seq, cfra)) { @@ -2867,7 +2867,7 @@ static void init_speed_effect(Sequence *seq) v = (SpeedControlVars *)seq->effectdata; v->globalSpeed = 1.0; - v->frameMap = 0; + v->frameMap = NULL; v->flags |= SEQ_SPEED_INTEGRATE; /* should be default behavior */ v->length = 0; } @@ -2876,7 +2876,7 @@ static void load_speed_effect(Sequence * seq) { SpeedControlVars * v = (SpeedControlVars *)seq->effectdata; - v->frameMap = 0; + v->frameMap = NULL; v->length = 0; } @@ -2890,7 +2890,7 @@ static void free_speed_effect(Sequence *seq) SpeedControlVars * v = (SpeedControlVars *)seq->effectdata; if(v->frameMap) MEM_freeN(v->frameMap); if(seq->effectdata) MEM_freeN(seq->effectdata); - seq->effectdata = 0; + seq->effectdata = NULL; } static void copy_speed_effect(Sequence *dst, Sequence *src) @@ -2898,7 +2898,7 @@ static void copy_speed_effect(Sequence *dst, Sequence *src) SpeedControlVars * v; dst->effectdata = MEM_dupallocN(src->effectdata); v = (SpeedControlVars *)dst->effectdata; - v->frameMap = 0; + v->frameMap = NULL; v->length = 0; } @@ -3260,7 +3260,7 @@ static struct SeqEffectHandle get_sequence_effect_impl(int seq_type) struct SeqEffectHandle get_sequence_effect(Sequence * seq) { - struct SeqEffectHandle rval= {0}; + struct SeqEffectHandle rval= {NULL}; if (seq->type & SEQ_EFFECT) { rval = get_sequence_effect_impl(seq->type); @@ -3275,7 +3275,7 @@ struct SeqEffectHandle get_sequence_effect(Sequence * seq) struct SeqEffectHandle get_sequence_blend(Sequence * seq) { - struct SeqEffectHandle rval= {0}; + struct SeqEffectHandle rval= {NULL}; if (seq->blend_mode != 0) { rval = get_sequence_effect_impl(seq->blend_mode); diff --git a/source/blender/blenkernel/intern/sequencer.c b/source/blender/blenkernel/intern/sequencer.c index 6aca23b8011..9537931faec 100644 --- a/source/blender/blenkernel/intern/sequencer.c +++ b/source/blender/blenkernel/intern/sequencer.c @@ -135,7 +135,7 @@ static void free_proxy_seq(Sequence *seq) { if (seq->strip && seq->strip->proxy && seq->strip->proxy->anim) { IMB_free_anim(seq->strip->proxy->anim); - seq->strip->proxy->anim = 0; + seq->strip->proxy->anim = NULL; } } @@ -429,7 +429,7 @@ void seq_end(SeqIterator *iter) * in metastrips!) ********************************************************************** */ - +#if 0 /* UNUSED */ static void do_seq_count(ListBase *seqbase, int *totseq) { Sequence *seq; @@ -456,7 +456,7 @@ static void do_build_seqar(ListBase *seqbase, Sequence ***seqar, int depth) } } -void build_seqar(ListBase *seqbase, Sequence ***seqar, int *totseq) +static void build_seqar(ListBase *seqbase, Sequence ***seqar, int *totseq) { Sequence **tseqar; @@ -473,6 +473,7 @@ void build_seqar(ListBase *seqbase, Sequence ***seqar, int *totseq) do_build_seqar(seqbase, seqar, 0); *seqar= tseqar; } +#endif /* UNUSED */ static void do_seq_count_cb(ListBase *seqbase, int *totseq, int (*test_func)(Sequence * seq)) @@ -664,7 +665,7 @@ void reload_sequence_new_file(Scene *scene, Sequence * seq, int lock_range) new_tstripdata(seq); if (ELEM3(seq->type, SEQ_SCENE, SEQ_META, SEQ_IMAGE)==0) { - BLI_join_dirfile(str, seq->strip->dir, seq->strip->stripdata->name); + BLI_join_dirfile(str, sizeof(str), seq->strip->dir, seq->strip->stripdata->name); BLI_path_abs(str, G.main->name); } @@ -762,8 +763,8 @@ void sort_seq(Scene *scene) if(ed==NULL) return; - seqbase.first= seqbase.last= 0; - effbase.first= effbase.last= 0; + seqbase.first= seqbase.last= NULL; + effbase.first= effbase.last= NULL; while( (seq= ed->seqbasep->first) ) { BLI_remlink(ed->seqbasep, seq); @@ -777,7 +778,7 @@ void sort_seq(Scene *scene) } seqt= seqt->next; } - if(seqt==0) BLI_addtail(&effbase, seq); + if(seqt==NULL) BLI_addtail(&effbase, seq); } else { seqt= seqbase.first; @@ -788,7 +789,7 @@ void sort_seq(Scene *scene) } seqt= seqt->next; } - if(seqt==0) BLI_addtail(&seqbase, seq); + if(seqt==NULL) BLI_addtail(&seqbase, seq); } } @@ -933,7 +934,7 @@ static void make_black_ibuf(ImBuf *ibuf) float *rect_float; int tot; - if(ibuf==0 || (ibuf->rect==0 && ibuf->rect_float==0)) return; + if(ibuf==NULL || (ibuf->rect==NULL && ibuf->rect_float==NULL)) return; tot= ibuf->x*ibuf->y; @@ -1024,7 +1025,7 @@ StripElem *give_stripelem(Sequence *seq, int cfra) if(seq->type != SEQ_MOVIE) { /* movie use the first */ int nr = (int) give_stripelem_index(seq, cfra); - if (nr == -1 || se == 0) return 0; + if (nr == -1 || se == NULL) return NULL; se += nr + seq->anim_startofs; } @@ -1076,7 +1077,7 @@ static int get_shown_sequences( ListBase * seqbasep, int cfra, int chanshown, Se if(evaluate_seq_frame_gen(seq_arr, seqbasep, cfra)) { if (b > 0) { - if (seq_arr[b] == 0) { + if (seq_arr[b] == NULL) { return 0; } } else { @@ -1134,7 +1135,7 @@ static int seq_proxy_get_fname(SeqRenderData context, Sequence * seq, int cfra, } if (seq->flag & SEQ_USE_PROXY_CUSTOM_FILE) { - BLI_join_dirfile(name, dir, seq->strip->proxy->file); + BLI_join_dirfile(name, FILE_MAX, dir, seq->strip->proxy->file); /* XXX, not real length */ BLI_path_abs(name, G.main->name); return TRUE; @@ -1173,38 +1174,38 @@ static struct ImBuf * seq_proxy_fetch(SeqRenderData context, Sequence * seq, int char name[PROXY_MAXFILE]; if (!(seq->flag & SEQ_USE_PROXY)) { - return 0; + return NULL; } /* rendering at 100% ? No real sense in proxy-ing, right? */ if (context.preview_render_size == 100) { - return 0; + return NULL; } if (seq->flag & SEQ_USE_PROXY_CUSTOM_FILE) { int frameno = (int) give_stripelem_index(seq, cfra) + seq->anim_startofs; if (seq->strip->proxy->anim == NULL) { if (seq_proxy_get_fname(context, seq, cfra, name)==0) { - return 0; + return NULL; } seq->strip->proxy->anim = openanim(name, IB_rect); } if (seq->strip->proxy->anim==NULL) { - return 0; + return NULL; } return IMB_anim_absolute(seq->strip->proxy->anim, frameno); } if (seq_proxy_get_fname(context, seq, cfra, name) == 0) { - return 0; + return NULL; } if (BLI_exists(name)) { return IMB_loadiffname(name, IB_rect); } else { - return 0; + return NULL; } } @@ -1659,7 +1660,7 @@ static ImBuf * input_preprocess( } if(seq->flag & SEQ_MAKE_PREMUL) { - if(ibuf->depth == 32 && ibuf->zbuf == 0) { + if(ibuf->depth == 32 && ibuf->zbuf == NULL) { IMB_premultiply_alpha(ibuf); } } @@ -1678,8 +1679,8 @@ static ImBuf * input_preprocess( static ImBuf * copy_from_ibuf_still(SeqRenderData context, Sequence * seq, float nr) { - ImBuf * rval = 0; - ImBuf * ibuf = 0; + ImBuf * rval = NULL; + ImBuf * ibuf = NULL; if (nr == 0) { ibuf = seq_stripelem_cache_get( @@ -1828,7 +1829,7 @@ static ImBuf* seq_render_effect_strip_impl( static ImBuf * seq_render_scene_strip_impl( SeqRenderData context, Sequence * seq, float nr) { - ImBuf * ibuf = 0; + ImBuf * ibuf = NULL; float frame= seq->sfra + nr + seq->anim_startofs; float oldcfra; Object *oldcamera; @@ -2043,7 +2044,7 @@ static ImBuf * seq_render_strip(SeqRenderData context, Sequence * seq, float cfr StripElem * s_elem = give_stripelem(seq, cfra); if (s_elem) { - BLI_join_dirfile(name, seq->strip->dir, s_elem->name); + BLI_join_dirfile(name, sizeof(name), seq->strip->dir, s_elem->name); BLI_path_abs(name, G.main->name); } @@ -2065,8 +2066,8 @@ static ImBuf * seq_render_strip(SeqRenderData context, Sequence * seq, float cfr } case SEQ_MOVIE: { - if(seq->anim==0) { - BLI_join_dirfile(name, seq->strip->dir, seq->strip->stripdata->name); + if(seq->anim==NULL) { + BLI_join_dirfile(name, sizeof(name), seq->strip->dir, seq->strip->stripdata->name); BLI_path_abs(name, G.main->name); seq->anim = openanim(name, IB_rect | @@ -2248,11 +2249,11 @@ static ImBuf* seq_render_strip_stack( if (swap_input) { out = sh.execute(context, seq, cfra, facf, facf, - ibuf2, ibuf1, 0); + ibuf2, ibuf1, NULL); } else { out = sh.execute(context, seq, cfra, facf, facf, - ibuf1, ibuf2, 0); + ibuf1, ibuf2, NULL); } IMB_freeImBuf(ibuf1); @@ -2641,7 +2642,7 @@ ImBuf *give_ibuf_seq_threaded(SeqRenderData context, float cfra, int chanshown) } } - return e ? e->ibuf : 0; + return e ? e->ibuf : NULL; } /* Functions to free imbuf and anim data on changes */ @@ -2650,7 +2651,7 @@ static void free_anim_seq(Sequence *seq) { if(seq->anim) { IMB_free_anim(seq->anim); - seq->anim = 0; + seq->anim = NULL; } } @@ -3541,7 +3542,7 @@ static Sequence *seq_dupli(struct Scene *scene, struct Scene *scene_to, Sequence if (seq->strip->proxy) { seqn->strip->proxy = MEM_dupallocN(seq->strip->proxy); - seqn->strip->proxy->anim = 0; + seqn->strip->proxy->anim = NULL; } if (seq->strip->color_balance) { @@ -3550,19 +3551,19 @@ static Sequence *seq_dupli(struct Scene *scene, struct Scene *scene_to, Sequence } if(seq->type==SEQ_META) { - seqn->strip->stripdata = 0; + seqn->strip->stripdata = NULL; - seqn->seqbase.first= seqn->seqbase.last= 0; + seqn->seqbase.first= seqn->seqbase.last= NULL; /* WATCH OUT!!! - This metastrip is not recursively duplicated here - do this after!!! */ /* - seq_dupli_recursive(&seq->seqbase,&seqn->seqbase);*/ } else if(seq->type == SEQ_SCENE) { - seqn->strip->stripdata = 0; + seqn->strip->stripdata = NULL; if(seq->scene_sound) seqn->scene_sound = sound_scene_add_scene_sound(sce_audio, seqn, seq->startdisp, seq->enddisp, seq->startofs + seq->anim_startofs); } else if(seq->type == SEQ_MOVIE) { seqn->strip->stripdata = MEM_dupallocN(seq->strip->stripdata); - seqn->anim= 0; + seqn->anim= NULL; } else if(seq->type == SEQ_SOUND) { seqn->strip->stripdata = MEM_dupallocN(seq->strip->stripdata); @@ -3585,7 +3586,7 @@ static Sequence *seq_dupli(struct Scene *scene, struct Scene *scene_to, Sequence sh.copy(seq, seqn); } - seqn->strip->stripdata = 0; + seqn->strip->stripdata = NULL; } else { fprintf(stderr, "Aiiiiekkk! sequence type not " @@ -3620,7 +3621,7 @@ Sequence * seq_dupli_recursive(struct Scene *scene, struct Scene *scene_to, Sequ void seqbase_dupli_recursive(Scene *scene, Scene *scene_to, ListBase *nseqbase, ListBase *seqbase, int dupe_flag) { Sequence *seq; - Sequence *seqn = 0; + Sequence *seqn = NULL; Sequence *last_seq = seq_active_get(scene); for(seq= seqbase->first; seq; seq= seq->next) { diff --git a/source/blender/blenkernel/intern/shrinkwrap.c b/source/blender/blenkernel/intern/shrinkwrap.c index 753e31d565b..29c29fb5158 100644 --- a/source/blender/blenkernel/intern/shrinkwrap.c +++ b/source/blender/blenkernel/intern/shrinkwrap.c @@ -102,7 +102,7 @@ void space_transform_from_matrixs(SpaceTransform *data, float local[4][4], float { float itarget[4][4]; invert_m4_m4(itarget, target); - mul_serie_m4(data->local2target, itarget, local, 0, 0, 0, 0, 0, 0); + mul_serie_m4(data->local2target, itarget, local, NULL, NULL, NULL, NULL, NULL, NULL); invert_m4_m4(data->target2local, data->local2target); } @@ -378,13 +378,10 @@ static void shrinkwrap_calc_normal_projection(ShrinkwrapCalcData *calc) normal_projection_project_vertex(0, tmp_co, tmp_no, &local2aux, auxData.tree, &hit, auxData.raycast_callback, &auxData); normal_projection_project_vertex(calc->smd->shrinkOpts, tmp_co, tmp_no, &calc->local2target, treeData.tree, &hit, treeData.raycast_callback, &treeData); - - if(hit.index != -1) - madd_v3_v3v3fl(hit.co, hit.co, tmp_no, -calc->keepDist); } //Project over negative direction of axis - if(use_normal & MOD_SHRINKWRAP_PROJECT_ALLOW_NEG_DIR) + if(use_normal & MOD_SHRINKWRAP_PROJECT_ALLOW_NEG_DIR && hit.index == -1) { float inv_no[3]; negate_v3_v3(inv_no, tmp_no); @@ -393,14 +390,12 @@ static void shrinkwrap_calc_normal_projection(ShrinkwrapCalcData *calc) normal_projection_project_vertex(0, tmp_co, inv_no, &local2aux, auxData.tree, &hit, auxData.raycast_callback, &auxData); normal_projection_project_vertex(calc->smd->shrinkOpts, tmp_co, inv_no, &calc->local2target, treeData.tree, &hit, treeData.raycast_callback, &treeData); - - if(hit.index != -1) - madd_v3_v3v3fl(hit.co, hit.co, tmp_no, calc->keepDist); } if(hit.index != -1) { + madd_v3_v3v3fl(hit.co, hit.co, tmp_no, calc->keepDist); interp_v3_v3v3(co, co, hit.co, weight); } } diff --git a/source/blender/blenkernel/intern/sketch.c b/source/blender/blenkernel/intern/sketch.c index 06c6e0f197a..1d5f9b4c463 100644 --- a/source/blender/blenkernel/intern/sketch.c +++ b/source/blender/blenkernel/intern/sketch.c @@ -54,7 +54,7 @@ void freeSketch(SK_Sketch *sketch) MEM_freeN(sketch); } -SK_Sketch* createSketch() +SK_Sketch* createSketch(void) { SK_Sketch *sketch; @@ -102,7 +102,7 @@ void sk_freeStroke(SK_Stroke *stk) MEM_freeN(stk); } -SK_Stroke* sk_createStroke() +SK_Stroke* sk_createStroke(void) { SK_Stroke *stk; diff --git a/source/blender/blenkernel/intern/softbody.c b/source/blender/blenkernel/intern/softbody.c index 3ba18fee615..ca8df76311d 100644 --- a/source/blender/blenkernel/intern/softbody.c +++ b/source/blender/blenkernel/intern/softbody.c @@ -161,7 +161,7 @@ typedef struct SB_thread_context { #define BFF_CLOSEVERT 2 /* collider vertex repulses face */ -float SoftHeunTol = 1.0f; /* humm .. this should be calculated from sb parameters and sizes */ +static float SoftHeunTol = 1.0f; /* humm .. this should be calculated from sb parameters and sizes */ /* local prototypes */ static void free_softbody_intern(SoftBody *sb); @@ -261,7 +261,7 @@ float operations still /* just an ID here to reduce the prob for killing objects ** ob->sumohandle points to we should not kill :) */ -const int CCD_SAVETY = 190561; +static const int CCD_SAVETY = 190561; typedef struct ccdf_minmax{ float minx,miny,minz,maxx,maxy,maxz; @@ -549,7 +549,7 @@ static void ccd_build_deflector_hash(Scene *scene, Object *vertexowner, GHash *h } /*+++ only with deflecting set */ - if(ob->pd && ob->pd->deflect && BLI_ghash_lookup(hash, ob) == 0) { + if(ob->pd && ob->pd->deflect && BLI_ghash_lookup(hash, ob) == NULL) { DerivedMesh *dm= NULL; if(ob->softflag & OB_SB_COLLFINAL) /* so maybe someone wants overkill to collide with subsurfed */ @@ -698,12 +698,12 @@ static void add_2nd_order_roller(Object *ob,float UNUSED(stiffness), int *counte bs = sb->bspring + bp->springs[b-1]; /*nasty thing here that springs have two ends so here we have to make sure we examine the other */ - if (( v0 == bs->v1) ){ + if (v0 == bs->v1){ bpo =sb->bpoint+bs->v2; notthis = bs->v2; } else { - if (( v0 == bs->v2) ){ + if (v0 == bs->v2){ bpo =sb->bpoint+bs->v1; notthis = bs->v1; } @@ -1647,9 +1647,7 @@ static void scan_for_ext_spring_forces(Scene *scene, Object *ob, float timenow) ListBase *do_effector = NULL; do_effector = pdInitEffectors(scene, ob, NULL, sb->effector_weights); - if (sb){ - _scan_for_ext_spring_forces(scene, ob, timenow, 0, sb->totspring, do_effector); - } + _scan_for_ext_spring_forces(scene, ob, timenow, 0, sb->totspring, do_effector); pdEndEffectors(&do_effector); } @@ -1657,7 +1655,7 @@ static void *exec_scan_for_ext_spring_forces(void *data) { SB_thread_context *pctx = (SB_thread_context*)data; _scan_for_ext_spring_forces(pctx->scene, pctx->ob, pctx->timenow, pctx->ifirst, pctx->ilast, pctx->do_effector); - return 0; + return NULL; } static void sb_sfesf_threads_run(Scene *scene, struct Object *ob, float timenow,int totsprings,int *UNUSED(ptr_to_break_func(void))) @@ -2384,7 +2382,7 @@ static void *exec_softbody_calc_forces(void *data) { SB_thread_context *pctx = (SB_thread_context*)data; _softbody_calc_forces_slice_in_a_thread(pctx->scene, pctx->ob, pctx->forcetime, pctx->timenow, pctx->ifirst, pctx->ilast, NULL, pctx->do_effector,pctx->do_deflector,pctx->fieldfactor,pctx->windfactor); - return 0; + return NULL; } static void sb_cf_threads_run(Scene *scene, Object *ob, float forcetime, float timenow,int totpoint,int *UNUSED(ptr_to_break_func(void)),struct ListBase *do_effector,int do_deflector,float fieldfactor, float windfactor) @@ -3824,7 +3822,7 @@ void SB_estimate_transform(Object *ob,float lloc[3],float lrot[3][3],float lscal { BodyPoint *bp; ReferenceVert *rp; - SoftBody *sb = 0; + SoftBody *sb = NULL; float (*opos)[3]; float (*rpos)[3]; float com[3],rcom[3]; diff --git a/source/blender/blenkernel/intern/sound.c b/source/blender/blenkernel/intern/sound.c index 3dc2221e0c8..be6c4d22f9c 100644 --- a/source/blender/blenkernel/intern/sound.c +++ b/source/blender/blenkernel/intern/sound.c @@ -74,7 +74,7 @@ void sound_force_device(int device) force_device = device; } -void sound_init_once() +void sound_init_once(void) { AUD_initOnce(); } @@ -115,7 +115,7 @@ void sound_init(struct Main *bmain) #endif } -void sound_exit() +void sound_exit(void) { AUD_exit(); } @@ -382,7 +382,7 @@ void sound_move_scene_sound(struct Scene *scene, void* handle, int startframe, i AUD_moveSequencer(scene->sound_scene, handle, startframe / FPS, endframe / FPS, frameskip / FPS); } -void sound_start_play_scene(struct Scene *scene) +static void sound_start_play_scene(struct Scene *scene) { scene->sound_scene_handle = AUD_play(scene->sound_scene, 1); AUD_setLoop(scene->sound_scene_handle, -1); diff --git a/source/blender/blenkernel/intern/suggestions.c b/source/blender/blenkernel/intern/suggestions.c index 7d39203cefc..7ec6d84d285 100644 --- a/source/blender/blenkernel/intern/suggestions.c +++ b/source/blender/blenkernel/intern/suggestions.c @@ -77,7 +77,7 @@ static void txttl_free_docs(void) { /* General tool functions */ /**************************/ -void free_texttools() { +void free_texttools(void) { txttl_free_suggest(); txttl_free_docs(); } @@ -88,7 +88,7 @@ void texttool_text_set_active(Text *text) { activeToolText = text; } -void texttool_text_clear() { +void texttool_text_clear(void) { free_texttools(); activeToolText = NULL; } @@ -191,15 +191,15 @@ void texttool_suggest_prefix(const char *prefix) { } } -void texttool_suggest_clear() { +void texttool_suggest_clear(void) { txttl_free_suggest(); } -SuggItem *texttool_suggest_first() { +SuggItem *texttool_suggest_first(void) { return suggestions.firstmatch; } -SuggItem *texttool_suggest_last() { +SuggItem *texttool_suggest_last(void) { return suggestions.lastmatch; } @@ -207,11 +207,11 @@ void texttool_suggest_select(SuggItem *sel) { suggestions.selected = sel; } -SuggItem *texttool_suggest_selected() { +SuggItem *texttool_suggest_selected(void) { return suggestions.selected; } -int *texttool_suggest_top() { +int *texttool_suggest_top(void) { return &suggestions.top; } @@ -243,10 +243,10 @@ void texttool_docs_show(const char *docs) { documentation[len] = '\0'; } -char *texttool_docs_get() { +char *texttool_docs_get(void) { return documentation; } -void texttool_docs_clear() { +void texttool_docs_clear(void) { txttl_free_docs(); } diff --git a/source/blender/blenkernel/intern/texture.c b/source/blender/blenkernel/intern/texture.c index de08a3b1813..c22b1d32849 100644 --- a/source/blender/blenkernel/intern/texture.c +++ b/source/blender/blenkernel/intern/texture.c @@ -51,6 +51,7 @@ #include "DNA_brush_types.h" #include "DNA_node_types.h" #include "DNA_color_types.h" +#include "DNA_particle_types.h" #include "IMB_imbuf.h" @@ -92,14 +93,14 @@ void open_plugin_tex(PluginTex *pit) int (*version)(void); /* init all the happy variables */ - pit->doit= 0; - pit->pname= 0; - pit->stnames= 0; - pit->varstr= 0; - pit->result= 0; - pit->cfra= 0; + pit->doit= NULL; + pit->pname= NULL; + pit->stnames= NULL; + pit->varstr= NULL; + pit->result= NULL; + pit->cfra= NULL; pit->version= 0; - pit->instance_init= 0; + pit->instance_init= NULL; /* clear the error list */ PIL_dynlib_get_error_as_string(NULL); @@ -112,12 +113,12 @@ void open_plugin_tex(PluginTex *pit) pit->handle= PIL_dynlib_open(pit->name); if(test_dlerr(pit->name, pit->name)) return; - if (pit->handle != 0) { + if (pit->handle != NULL) { /* find the address of the version function */ version= (int (*)(void)) PIL_dynlib_find_symbol(pit->handle, "plugin_tex_getversion"); if (test_dlerr(pit->name, "plugin_tex_getversion")) return; - if (version != 0) { + if (version != NULL) { pit->version= version(); if( pit->version >= 2 && pit->version <=6) { int (*info_func)(PluginInfo *); @@ -167,8 +168,8 @@ PluginTex *add_plugin_tex(char *str) strcpy(pit->name, str); open_plugin_tex(pit); - if(pit->doit==0) { - if(pit->handle==0) {;} //XXX error("no plugin: %s", str); + if(pit->doit==NULL) { + if(pit->handle==NULL) {;} //XXX error("no plugin: %s", str); else {;} //XXX error("in plugin: %s", str); MEM_freeN(pit); return NULL; @@ -192,7 +193,7 @@ PluginTex *add_plugin_tex(char *str) void free_plugin_tex(PluginTex *pit) { - if(pit==0) return; + if(pit==NULL) return; /* no PIL_dynlib_close: same plugin can be opened multiple times, 1 handle */ MEM_freeN(pit); @@ -618,7 +619,7 @@ void default_mtex(MTex *mtex) { mtex->texco= TEXCO_ORCO; mtex->mapto= MAP_COL; - mtex->object= 0; + mtex->object= NULL; mtex->projx= PROJ_X; mtex->projy= PROJ_Y; mtex->projz= PROJ_Z; @@ -629,7 +630,7 @@ void default_mtex(MTex *mtex) mtex->size[0]= 1.0; mtex->size[1]= 1.0; mtex->size[2]= 1.0; - mtex->tex= 0; + mtex->tex= NULL; mtex->texflag= MTEX_3TAP_BUMP | MTEX_BUMP_OBJECTSPACE; mtex->colormodel= 0; mtex->r= 1.0; @@ -671,14 +672,16 @@ void default_mtex(MTex *mtex) mtex->lifefac= 1.0f; mtex->sizefac= 1.0f; mtex->ivelfac= 1.0f; - mtex->pvelfac= 1.0f; + mtex->dampfac= 1.0f; + mtex->gravityfac= 1.0f; + mtex->fieldfac= 1.0f; mtex->normapspace= MTEX_NSPACE_TANGENT; } /* ------------------------------------------------------------------------- */ -MTex *add_mtex() +MTex *add_mtex(void) { MTex *mtex; @@ -740,7 +743,7 @@ Tex *copy_texture(Tex *tex) texn= copy_libblock(tex); if(texn->type==TEX_IMAGE) id_us_plus((ID *)texn->ima); - else texn->ima= 0; + else texn->ima= NULL; #if 0 // XXX old animation system id_us_plus((ID *)texn->ipo); @@ -760,7 +763,7 @@ Tex *copy_texture(Tex *tex) if(tex->nodetree) { ntreeEndExecTree(tex->nodetree); - texn->nodetree= ntreeCopyTree(tex->nodetree, 0); /* 0 == full new tree */ + texn->nodetree= ntreeCopyTree(tex->nodetree); /* 0 == full new tree */ } return texn; @@ -776,6 +779,7 @@ void make_local_texture(Tex *tex) World *wrld; Lamp *la; Brush *br; + ParticleSettings *pa; int a, local=0, lib=0; /* - only lib users: do nothing @@ -783,19 +787,19 @@ void make_local_texture(Tex *tex) * - mixed: make copy */ - if(tex->id.lib==0) return; + if(tex->id.lib==NULL) return; /* special case: ima always local immediately */ if(tex->ima) { - tex->ima->id.lib= 0; + tex->ima->id.lib= NULL; tex->ima->id.flag= LIB_LOCAL; - new_id(0, (ID *)tex->ima, 0); + new_id(NULL, (ID *)tex->ima, NULL); } if(tex->id.us==1) { - tex->id.lib= 0; + tex->id.lib= NULL; tex->id.flag= LIB_LOCAL; - new_id(0, (ID *)tex, 0); + new_id(NULL, (ID *)tex, NULL); return; } @@ -838,11 +842,21 @@ void make_local_texture(Tex *tex) } br= br->id.next; } + pa= bmain->particle.first; + while(pa) { + for(a=0; a<MAX_MTEX; a++) { + if(pa->mtex[a] && pa->mtex[a]->tex==tex) { + if(pa->id.lib) lib= 1; + else local= 1; + } + } + pa= pa->id.next; + } if(local && lib==0) { - tex->id.lib= 0; + tex->id.lib= NULL; tex->id.flag= LIB_LOCAL; - new_id(0, (ID *)tex, 0); + new_id(NULL, (ID *)tex, NULL); } else if(local && lib) { texn= copy_texture(tex); @@ -852,7 +866,7 @@ void make_local_texture(Tex *tex) while(ma) { for(a=0; a<MAX_MTEX; a++) { if(ma->mtex[a] && ma->mtex[a]->tex==tex) { - if(ma->id.lib==0) { + if(ma->id.lib==NULL) { ma->mtex[a]->tex= texn; texn->id.us++; tex->id.us--; @@ -865,7 +879,7 @@ void make_local_texture(Tex *tex) while(la) { for(a=0; a<MAX_MTEX; a++) { if(la->mtex[a] && la->mtex[a]->tex==tex) { - if(la->id.lib==0) { + if(la->id.lib==NULL) { la->mtex[a]->tex= texn; texn->id.us++; tex->id.us--; @@ -878,7 +892,7 @@ void make_local_texture(Tex *tex) while(wrld) { for(a=0; a<MAX_MTEX; a++) { if(wrld->mtex[a] && wrld->mtex[a]->tex==tex) { - if(wrld->id.lib==0) { + if(wrld->id.lib==NULL) { wrld->mtex[a]->tex= texn; texn->id.us++; tex->id.us--; @@ -890,7 +904,7 @@ void make_local_texture(Tex *tex) br= bmain->brush.first; while(br) { if(br->mtex.tex==tex) { - if(br->id.lib==0) { + if(br->id.lib==NULL) { br->mtex.tex= texn; texn->id.us++; tex->id.us--; @@ -898,6 +912,19 @@ void make_local_texture(Tex *tex) } br= br->id.next; } + pa= bmain->particle.first; + while(pa) { + for(a=0; a<MAX_MTEX; a++) { + if(pa->mtex[a] && pa->mtex[a]->tex==tex) { + if(pa->id.lib==NULL) { + pa->mtex[a]->tex= texn; + texn->id.us++; + tex->id.us--; + } + } + } + pa= pa->id.next; + } } } @@ -940,8 +967,8 @@ Tex *give_current_object_texture(Object *ob) Material *ma; Tex *tex= NULL; - if(ob==0) return 0; - if(ob->totcol==0 && !(ob->type==OB_LAMP)) return 0; + if(ob==NULL) return NULL; + if(ob->totcol==0 && !(ob->type==OB_LAMP)) return NULL; if(ob->type==OB_LAMP) { tex= give_current_lamp_texture(ob->data); @@ -1048,6 +1075,10 @@ int give_active_mtex(ID *id, MTex ***mtex_ar, short *act) *mtex_ar= ((Lamp *)id)->mtex; if(act) *act= (((Lamp *)id)->texact); break; + case ID_PA: + *mtex_ar= ((ParticleSettings *)id)->mtex; + if(act) *act= (((ParticleSettings *)id)->texact); + break; default: *mtex_ar = NULL; if(act) *act= 0; @@ -1072,6 +1103,9 @@ void set_active_mtex(ID *id, short act) case ID_LA: ((Lamp *)id)->texact= act; break; + case ID_PA: + ((ParticleSettings *)id)->texact= act; + break; } } @@ -1121,7 +1155,7 @@ Tex *give_current_world_texture(World *world) MTex *mtex= NULL; Tex *tex= NULL; - if(!world) return 0; + if(!world) return NULL; mtex= world->mtex[(int)(world->texact)]; if(mtex) tex= mtex->tex; @@ -1167,6 +1201,42 @@ void set_current_brush_texture(Brush *br, Tex *newtex) } } +Tex *give_current_particle_texture(ParticleSettings *part) +{ + MTex *mtex= NULL; + Tex *tex= NULL; + + if(!part) return NULL; + + mtex= part->mtex[(int)(part->texact)]; + if(mtex) tex= mtex->tex; + + return tex; +} + +void set_current_particle_texture(ParticleSettings *part, Tex *newtex) +{ + int act= part->texact; + + if(part->mtex[act] && part->mtex[act]->tex) + id_us_min(&part->mtex[act]->tex->id); + + if(newtex) { + if(!part->mtex[act]) { + part->mtex[act]= add_mtex(); + part->mtex[act]->texco= TEXCO_ORCO; + part->mtex[act]->blendtype= MTEX_MUL; + } + + part->mtex[act]->tex= newtex; + id_us_plus(&newtex->id); + } + else if(part->mtex[act]) { + MEM_freeN(part->mtex[act]); + part->mtex[act]= NULL; + } +} + /* ------------------------------------------------------------------------- */ EnvMap *BKE_add_envmap(void) diff --git a/source/blender/blenkernel/intern/unit.c b/source/blender/blenkernel/intern/unit.c index 1b04589c1f2..c3a34e1942f 100644 --- a/source/blender/blenkernel/intern/unit.c +++ b/source/blender/blenkernel/intern/unit.c @@ -264,10 +264,10 @@ static struct bUnitCollection buNaturalRotCollection = {buNaturalRotDef, 0, 0, s #define UNIT_SYSTEM_TOT (((sizeof(bUnitSystems) / 9) / sizeof(void *)) - 1) static struct bUnitCollection *bUnitSystems[][9] = { - {0, 0, 0, 0, 0, &buNaturalRotCollection, &buNaturalTimeCollecton, 0, 0}, - {0, &buMetricLenCollecton, &buMetricAreaCollecton, &buMetricVolCollecton, &buMetricMassCollecton, &buNaturalRotCollection, &buNaturalTimeCollecton, &buMetricVelCollecton, &buMetricAclCollecton}, /* metric */ - {0, &buImperialLenCollecton, &buImperialAreaCollecton, &buImperialVolCollecton, &buImperialMassCollecton, &buNaturalRotCollection, &buNaturalTimeCollecton, &buImperialVelCollecton, &buImperialAclCollecton}, /* imperial */ - {0, 0, 0, 0, 0, 0, 0, 0, 0} + {NULL, NULL, NULL, NULL, NULL, &buNaturalRotCollection, &buNaturalTimeCollecton, NULL, NULL}, + {NULL, &buMetricLenCollecton, &buMetricAreaCollecton, &buMetricVolCollecton, &buMetricMassCollecton, &buNaturalRotCollection, &buNaturalTimeCollecton, &buMetricVelCollecton, &buMetricAclCollecton}, /* metric */ + {NULL, &buImperialLenCollecton, &buImperialAreaCollecton, &buImperialVolCollecton, &buImperialMassCollecton, &buNaturalRotCollection, &buNaturalTimeCollecton, &buImperialVelCollecton, &buImperialAclCollecton}, /* imperial */ + {NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL} }; diff --git a/source/blender/blenkernel/intern/world.c b/source/blender/blenkernel/intern/world.c index a86b039e918..5412e44f0eb 100644 --- a/source/blender/blenkernel/intern/world.c +++ b/source/blender/blenkernel/intern/world.c @@ -38,6 +38,7 @@ #include "DNA_scene_types.h" #include "DNA_texture_types.h" +#include "BKE_world.h" #include "BKE_library.h" #include "BKE_animsys.h" #include "BKE_global.h" @@ -136,11 +137,11 @@ void make_local_world(World *wrld) * - mixed: make copy */ - if(wrld->id.lib==0) return; + if(wrld->id.lib==NULL) return; if(wrld->id.us==1) { - wrld->id.lib= 0; + wrld->id.lib= NULL; wrld->id.flag= LIB_LOCAL; - new_id(0, (ID *)wrld, 0); + new_id(NULL, (ID *)wrld, NULL); return; } @@ -156,7 +157,7 @@ void make_local_world(World *wrld) if(local && lib==0) { wrld->id.lib= 0; wrld->id.flag= LIB_LOCAL; - new_id(0, (ID *)wrld, 0); + new_id(NULL, (ID *)wrld, NULL); } else if(local && lib) { wrldn= copy_world(wrld); @@ -165,7 +166,7 @@ void make_local_world(World *wrld) sce= bmain->scene.first; while(sce) { if(sce->world==wrld) { - if(sce->id.lib==0) { + if(sce->id.lib==NULL) { sce->world= wrldn; wrldn->id.us++; wrld->id.us--; diff --git a/source/blender/blenlib/BLI_boxpack2d.h b/source/blender/blenlib/BLI_boxpack2d.h index a83e4c28882..008af55e1d0 100644 --- a/source/blender/blenlib/BLI_boxpack2d.h +++ b/source/blender/blenlib/BLI_boxpack2d.h @@ -41,5 +41,5 @@ typedef struct boxPack { struct boxVert *v[4]; } boxPack; -void boxPack2D(boxPack *boxarray, int len, float *tot_width, float *tot_height); +void boxPack2D(boxPack *boxarray, const int len, float *tot_width, float *tot_height); diff --git a/source/blender/blenlib/BLI_ghash.h b/source/blender/blenlib/BLI_ghash.h index 46c0f767b5f..a9fc5662657 100644 --- a/source/blender/blenlib/BLI_ghash.h +++ b/source/blender/blenlib/BLI_ghash.h @@ -228,7 +228,7 @@ BM_INLINE int BLI_ghash_remove (GHash *gh, void *key, GHashKeyFreeFP keyfreefp, { unsigned int hash= gh->hashfp(key)%gh->nbuckets; Entry *e; - Entry *p = 0; + Entry *p = NULL; for (e= gh->buckets[hash]; e; e= e->next) { if (gh->cmpfp(key, e->key)==0) { diff --git a/source/blender/blenlib/BLI_math_vector.h b/source/blender/blenlib/BLI_math_vector.h index 16b8ff8e472..dcb9311baa0 100644 --- a/source/blender/blenlib/BLI_math_vector.h +++ b/source/blender/blenlib/BLI_math_vector.h @@ -85,6 +85,7 @@ MINLINE void madd_v4_v4fl(float r[4], const float a[4], float f); MINLINE void negate_v3(float r[3]); MINLINE void negate_v3_v3(float r[3], const float a[3]); MINLINE void negate_v4(float r[4]); +MINLINE void negate_v4_v4(float r[4], const float a[3]); MINLINE float dot_v2v2(const float a[2], const float b[2]); MINLINE float dot_v3v3(const float a[3], const float b[3]); diff --git a/source/blender/blenlib/BLI_path_util.h b/source/blender/blenlib/BLI_path_util.h index 85286d15acb..fd710c59e2f 100644 --- a/source/blender/blenlib/BLI_path_util.h +++ b/source/blender/blenlib/BLI_path_util.h @@ -103,7 +103,7 @@ void BLI_make_file_string(const char *relabase, char *string, const char *dir, void BLI_make_exist(char *dir); void BLI_make_existing_file(const char *name); void BLI_split_dirfile(const char *string, char *dir, char *file); -void BLI_join_dirfile(char *string, const char *dir, const char *file); +void BLI_join_dirfile(char *string, const int maxlen, const char *dir, const char *file); char *BLI_path_basename(char *path); int BKE_rebase_path(char *abs, int abs_size, char *rel, int rel_size, const char *base_dir, const char *src_dir, const char *dest_dir); char *BLI_last_slash(const char *string); @@ -181,7 +181,7 @@ void BLI_char_switch(char *string, char from, char to); * @param fullname The full path and full name of the executable * @param name The name of the executable (usually argv[0]) to be checked */ -void BLI_where_am_i(char *fullname, const char *name); +void BLI_where_am_i(char *fullname, const int maxlen, const char *name); char *get_install_dir(void); /** @@ -192,7 +192,7 @@ char *get_install_dir(void); * * @param fullname The full path to the temp directory */ -void BLI_where_is_temp(char *fullname, int usertemp); +void BLI_where_is_temp(char *fullname, const int maxlen, int usertemp); #ifdef WITH_ICONV diff --git a/source/blender/blenlib/BLI_storage.h b/source/blender/blenlib/BLI_storage.h index 0996b19a854..702112f5fec 100644 --- a/source/blender/blenlib/BLI_storage.h +++ b/source/blender/blenlib/BLI_storage.h @@ -44,7 +44,7 @@ int BLI_compare(struct direntry *entry1, struct direntry *entry2); size_t BLI_filesize(int file); size_t BLI_filepathsize(const char *path); double BLI_diskfree(const char *dir); -char *BLI_getwdN(const char *dir); +char *BLI_getwdN(char *dir, const int maxncpy); unsigned int BLI_getdir(const char *dirname, struct direntry **filelist); /** diff --git a/source/blender/blenlib/BLI_string.h b/source/blender/blenlib/BLI_string.h index 01ad70c31fb..1427a6c651a 100644 --- a/source/blender/blenlib/BLI_string.h +++ b/source/blender/blenlib/BLI_string.h @@ -74,7 +74,7 @@ char *BLI_strdupcat(const char *str1, const char *str2); * the size of dst) * @retval Returns dst */ -char *BLI_strncpy(char *dst, const char *src, int maxncpy); +char *BLI_strncpy(char *dst, const char *src, const int maxncpy); /* Makes a copy of the text within the "" that appear after some text 'blahblah' * i.e. for string 'pose["apples"]' with prefix 'pose[', it should grab "apples" diff --git a/source/blender/blenlib/BLI_utildefines.h b/source/blender/blenlib/BLI_utildefines.h index ccda9c17d43..140b424bf8f 100644 --- a/source/blender/blenlib/BLI_utildefines.h +++ b/source/blender/blenlib/BLI_utildefines.h @@ -169,6 +169,11 @@ # define UNUSED(x) UNUSED_ ## x #endif +#ifdef __GNUC__ +# define WARN_UNUSED __attribute__((warn_unused_result)) +#else +# define WARN_UNUSED +#endif /*little macro so inline keyword works*/ #if defined(_MSC_VER) diff --git a/source/blender/blenlib/intern/BLI_args.c b/source/blender/blenlib/intern/BLI_args.c index ff41f76a1f9..4a62e9d26fd 100644 --- a/source/blender/blenlib/intern/BLI_args.c +++ b/source/blender/blenlib/intern/BLI_args.c @@ -39,7 +39,7 @@ #include "BLI_args.h" #include "BLI_ghash.h" -char NO_DOCS[] = "NO DOCUMENTATION SPECIFIED"; +static char NO_DOCS[] = "NO DOCUMENTATION SPECIFIED"; struct bArgDoc; typedef struct bArgDoc { diff --git a/source/blender/blenlib/intern/BLI_ghash.c b/source/blender/blenlib/intern/BLI_ghash.c index a8ca828aa66..541b9ea0ae8 100644 --- a/source/blender/blenlib/intern/BLI_ghash.c +++ b/source/blender/blenlib/intern/BLI_ghash.c @@ -90,7 +90,7 @@ void BLI_ghash_free(GHash *gh, GHashKeyFreeFP keyfreefp, GHashValFreeFP valfreef MEM_freeN(gh->buckets); BLI_mempool_destroy(gh->entrypool); - gh->buckets = 0; + gh->buckets = NULL; gh->nentries = 0; gh->nbuckets = 0; MEM_freeN(gh); diff --git a/source/blender/blenlib/intern/BLI_heap.c b/source/blender/blenlib/intern/BLI_heap.c index f6616ecb06b..7d77e85bfe1 100644 --- a/source/blender/blenlib/intern/BLI_heap.c +++ b/source/blender/blenlib/intern/BLI_heap.c @@ -64,7 +64,7 @@ struct Heap { /***/ -Heap *BLI_heap_new() +Heap *BLI_heap_new(void) { Heap *heap = (Heap*)MEM_callocN(sizeof(Heap), "BLIHeap"); heap->bufsize = 1; diff --git a/source/blender/blenlib/intern/BLI_kdopbvh.c b/source/blender/blenlib/intern/BLI_kdopbvh.c index 4673462f58b..d85950ce22d 100644 --- a/source/blender/blenlib/intern/BLI_kdopbvh.c +++ b/source/blender/blenlib/intern/BLI_kdopbvh.c @@ -161,7 +161,7 @@ static float KDOP_AXES[13][3] = heap[parent] = element; \ } -int ADJUST_MEMORY(void *local_memblock, void **memblock, int new_size, int *max_size, int size_per_item) +static int ADJUST_MEMORY(void *local_memblock, void **memblock, int new_size, int *max_size, int size_per_item) { int new_max_size = *max_size * 2; void *new_memblock = NULL; @@ -1137,11 +1137,11 @@ BVHTreeOverlap *BLI_bvhtree_overlap(BVHTree *tree1, BVHTree *tree2, unsigned int // check for compatibility of both trees (can't compare 14-DOP with 18-DOP) if((tree1->axis != tree2->axis) && (tree1->axis == 14 || tree2->axis == 14) && (tree1->axis == 18 || tree2->axis == 18)) - return 0; + return NULL; // fast check root nodes for collision before doing big splitting + traversal if(!tree_overlap(tree1->nodes[tree1->totleaf], tree2->nodes[tree2->totleaf], MIN2(tree1->start_axis, tree2->start_axis), MIN2(tree1->stop_axis, tree2->stop_axis))) - return 0; + return NULL; data = MEM_callocN(sizeof(BVHOverlapData *)* tree1->tree_type, "BVHOverlapData_star"); diff --git a/source/blender/blenlib/intern/BLI_kdtree.c b/source/blender/blenlib/intern/BLI_kdtree.c index 0d541c1fe37..8902c580493 100644 --- a/source/blender/blenlib/intern/BLI_kdtree.c +++ b/source/blender/blenlib/intern/BLI_kdtree.c @@ -255,7 +255,7 @@ static void add_nearest(KDTreeNearest *ptn, int *found, int n, int index, float /* finds the nearest n entries in tree to specified coordinates */ int BLI_kdtree_find_n_nearest(KDTree *tree, int n, float *co, float *nor, KDTreeNearest *nearest) { - KDTreeNode *root, *node=0; + KDTreeNode *root, *node= NULL; KDTreeNode **stack, *defaultstack[100]; float cur_dist; int i, totstack, cur=0, found=0; @@ -370,7 +370,7 @@ static void add_in_range(KDTreeNearest **ptn, int found, int *totfoundstack, int } int BLI_kdtree_range_search(KDTree *tree, float range, float *co, float *nor, KDTreeNearest **nearest) { - KDTreeNode *root, *node=0; + KDTreeNode *root, *node= NULL; KDTreeNode **stack, *defaultstack[100]; KDTreeNearest *foundstack=NULL; float range2 = range*range, dist2; diff --git a/source/blender/blenlib/intern/boxpack2d.c b/source/blender/blenlib/intern/boxpack2d.c index b20a42f5cf8..643dcb6efca 100644 --- a/source/blender/blenlib/intern/boxpack2d.c +++ b/source/blender/blenlib/intern/boxpack2d.c @@ -100,12 +100,10 @@ typedef struct boxVert { /* qsort function - sort largest to smallest */ static int box_areasort(const void *p1, const void *p2) { - const boxPack *b1=p1, *b2=p2; - float a1, a2; + const boxPack *b1= p1, *b2= p2; + const float a1= BOXAREA(b1); + const float a2= BOXAREA(b2); - a1 = BOXAREA(b1); - a2 = BOXAREA(b2); - if ( a1 < a2 ) return 1; else if ( a1 > a2 ) return -1; return 0; @@ -149,7 +147,7 @@ static int vertex_sort(const void *p1, const void *p2) * len - the number of boxes in the array. * tot_width and tot_height are set so you can normalize the data. * */ -void boxPack2D(boxPack *boxarray, int len, float *tot_width, float *tot_height) +void boxPack2D(boxPack *boxarray, const int len, float *tot_width, float *tot_height) { boxVert *vert; /* the current vert */ int box_index, verts_pack_len, i, j, k, isect; diff --git a/source/blender/blenlib/intern/bpath.c b/source/blender/blenlib/intern/bpath.c index c930bd903b4..8d316f6df78 100644 --- a/source/blender/blenlib/intern/bpath.c +++ b/source/blender/blenlib/intern/bpath.c @@ -156,7 +156,7 @@ void BLI_bpathIterator_init(struct BPathIterator **bpi_pt, Main *bmain, const ch BLI_bpathIterator_step(bpi); } -void BLI_bpathIterator_alloc(struct BPathIterator **bpi) { +static void BLI_bpathIterator_alloc(struct BPathIterator **bpi) { *bpi= MEM_mallocN(sizeof(BPathIterator), "BLI_bpathIterator_alloc"); } @@ -861,7 +861,7 @@ static int findFileRecursive(char *filename_new, const char *dirname, const char dir= opendir(dirname); - if (dir==0) + if (dir==NULL) return 0; if (*filesize == -1) @@ -872,7 +872,7 @@ static int findFileRecursive(char *filename_new, const char *dirname, const char if (strcmp(".", de->d_name)==0 || strcmp("..", de->d_name)==0) continue; - BLI_join_dirfile(path, dirname, de->d_name); + BLI_join_dirfile(path, sizeof(path), dirname, de->d_name); if (stat(path, &status) != 0) continue; /* cant stat, dont bother with this file, could print debug info here */ diff --git a/source/blender/blenlib/intern/fileops.c b/source/blender/blenlib/intern/fileops.c index 462e3ed9d01..5ee652264c0 100644 --- a/source/blender/blenlib/intern/fileops.c +++ b/source/blender/blenlib/intern/fileops.c @@ -271,7 +271,7 @@ int BLI_rename(const char *from, const char *to) { * timer, and... We implement a callback mechanism. The system will * have to initialise the callback before the functions will work! * */ -static char str[MAXPATHLEN+12]; +static char str[12 + (MAXPATHLEN * 2)]; int BLI_delete(const char *file, int dir, int recursive) { @@ -280,34 +280,34 @@ int BLI_delete(const char *file, int dir, int recursive) } else { if (recursive) { - sprintf(str, "/bin/rm -rf \"%s\"", file); + BLI_snprintf(str, sizeof(str), "/bin/rm -rf \"%s\"", file); return system(str); } else if (dir) { - sprintf(str, "/bin/rmdir \"%s\"", file); + BLI_snprintf(str, sizeof(str), "/bin/rmdir \"%s\"", file); return system(str); } else { - return remove(file); //sprintf(str, "/bin/rm -f \"%s\"", file); + return remove(file); //BLI_snprintf(str, sizeof(str), "/bin/rm -f \"%s\"", file); } } return -1; } int BLI_move(const char *file, const char *to) { - sprintf(str, "/bin/mv -f \"%s\" \"%s\"", file, to); + BLI_snprintf(str, sizeof(str), "/bin/mv -f \"%s\" \"%s\"", file, to); return system(str); } int BLI_copy_fileops(const char *file, const char *to) { - sprintf(str, "/bin/cp -rf \"%s\" \"%s\"", file, to); + BLI_snprintf(str, sizeof(str), "/bin/cp -rf \"%s\" \"%s\"", file, to); return system(str); } int BLI_link(const char *file, const char *to) { - sprintf(str, "/bin/ln -f \"%s\" \"%s\"", file, to); + BLI_snprintf(str, sizeof(str), "/bin/ln -f \"%s\" \"%s\"", file, to); return system(str); } diff --git a/source/blender/blenlib/intern/freetypefont.c b/source/blender/blenlib/intern/freetypefont.c index 482ca1c01e5..b34dbb2d5fd 100644 --- a/source/blender/blenlib/intern/freetypefont.c +++ b/source/blender/blenlib/intern/freetypefont.c @@ -367,7 +367,7 @@ static VFontData *objfnt_to_ftvfontdata(PackedFile * pf) // No charmap found from the ttf so we need to figure it out if(glyph_index == 0) { - FT_CharMap found = 0; + FT_CharMap found = NULL; FT_CharMap charmap; int n; @@ -477,7 +477,7 @@ VFontData *BLI_vfontdata_from_freetypefont(PackedFile *pf) err = FT_Init_FreeType( &library); if(err) { //XXX error("Failed to load the Freetype font library"); - return 0; + return NULL; } success = check_freetypefont(pf); diff --git a/source/blender/blenlib/intern/graph.c b/source/blender/blenlib/intern/graph.c index e187595aa11..0137826df64 100644 --- a/source/blender/blenlib/intern/graph.c +++ b/source/blender/blenlib/intern/graph.c @@ -296,7 +296,7 @@ BNode * BLI_FindNodeByPosition(BGraph *graph, float *p, float limit) } /************************************* SUBGRAPH DETECTION **********************************************/ -void flagSubgraph(BNode *node, int subgraph) +static void flagSubgraph(BNode *node, int subgraph) { if (node->subgraph_index == 0) { @@ -425,7 +425,7 @@ BArc * BLI_findConnectedArc(BGraph *graph, BArc *arc, BNode *v) /*********************************** GRAPH AS TREE FUNCTIONS *******************************************/ -int subtreeShape(BNode *node, BArc *rootArc, int include_root) +static int subtreeShape(BNode *node, BArc *rootArc, int include_root) { int depth = 0; diff --git a/source/blender/blenlib/intern/listbase.c b/source/blender/blenlib/intern/listbase.c index b8b0b5b6eda..975479a3875 100644 --- a/source/blender/blenlib/intern/listbase.c +++ b/source/blender/blenlib/intern/listbase.c @@ -48,9 +48,9 @@ /* Ripped this from blender.c */ void BLI_movelisttolist(ListBase *dst, ListBase *src) { - if (src->first==0) return; + if (src->first==NULL) return; - if (dst->first==0) { + if (dst->first==NULL) { dst->first= src->first; dst->last= src->last; } @@ -59,7 +59,7 @@ void BLI_movelisttolist(ListBase *dst, ListBase *src) ((Link *)src->first)->prev= dst->last; dst->last= src->last; } - src->first= src->last= 0; + src->first= src->last= NULL; } void BLI_addhead(ListBase *listbase, void *vlink) @@ -89,7 +89,7 @@ void BLI_addtail(ListBase *listbase, void *vlink) link->prev = listbase->last; if (listbase->last) ((Link *)listbase->last)->next = link; - if (listbase->first == 0) listbase->first = link; + if (listbase->first == NULL) listbase->first = link; listbase->last = link; } @@ -152,7 +152,7 @@ void BLI_insertlink(ListBase *listbase, void *vprevlink, void *vnewlink) /* insert before first element */ if (prevlink == NULL) { newlink->next= listbase->first; - newlink->prev= 0; + newlink->prev= NULL; newlink->next->prev= newlink; listbase->first= newlink; return; @@ -251,7 +251,7 @@ void BLI_insertlinkbefore(ListBase *listbase, void *vnextlink, void *vnewlink) /* insert at end of list */ if (nextlink == NULL) { newlink->prev= listbase->last; - newlink->next= 0; + newlink->next= NULL; ((Link *)listbase->last)->next= newlink; listbase->last= newlink; return; @@ -422,7 +422,7 @@ void BLI_duplicatelist(ListBase *dst, const ListBase *src) /* in this order, to ensure it works if dst == src */ src_link= src->first; - dst->first= dst->last= 0; + dst->first= dst->last= NULL; while(src_link) { dst_link= MEM_dupallocN(src_link); diff --git a/source/blender/blenlib/intern/math_geom.c b/source/blender/blenlib/intern/math_geom.c index d7a71f8567c..bb5b3a21770 100644 --- a/source/blender/blenlib/intern/math_geom.c +++ b/source/blender/blenlib/intern/math_geom.c @@ -2080,7 +2080,7 @@ pointers may be NULL if not needed */ /* can't believe there is none in math utils */ -float _det_m3(float m2[3][3]) +static float _det_m3(float m2[3][3]) { float det = 0.f; if (m2){ diff --git a/source/blender/blenlib/intern/math_matrix.c b/source/blender/blenlib/intern/math_matrix.c index 75134358c31..413ac57dea5 100644 --- a/source/blender/blenlib/intern/math_matrix.c +++ b/source/blender/blenlib/intern/math_matrix.c @@ -242,7 +242,7 @@ void mul_serie_m3(float answ[][3], { float temp[3][3]; - if(m1==0 || m2==0) return; + if(m1==NULL || m2==NULL) return; mul_m3_m3m3(answ, m2, m1); if(m3) { @@ -275,7 +275,7 @@ void mul_serie_m4(float answ[][4], float m1[][4], { float temp[4][4]; - if(m1==0 || m2==0) return; + if(m1==NULL || m2==NULL) return; mul_m4_m4m4(answ, m2, m1); if(m3) { @@ -1708,5 +1708,5 @@ void pseudoinverse_m4_m4(float Ainv[4][4], float A[4][4], float epsilon) transpose_m4(V); - mul_serie_m4(Ainv, U, Wm, V, 0, 0, 0, 0, 0); + mul_serie_m4(Ainv, U, Wm, V, NULL, NULL, NULL, NULL, NULL); } diff --git a/source/blender/blenlib/intern/math_rotation.c b/source/blender/blenlib/intern/math_rotation.c index 2038121e3f2..291e7babdbb 100644 --- a/source/blender/blenlib/intern/math_rotation.c +++ b/source/blender/blenlib/intern/math_rotation.c @@ -1431,7 +1431,7 @@ void mat4_to_dquat(DualQuat *dq,float basemat[][4], float mat[][4]) mul_m4_m4m4(S, baseRS, baseRinv); /* set scaling part */ - mul_serie_m4(dq->scale, basemat, S, baseinv, 0, 0, 0, 0, 0); + mul_serie_m4(dq->scale, basemat, S, baseinv, NULL, NULL, NULL, NULL, NULL); dq->scale_weight= 1.0f; } else { diff --git a/source/blender/blenlib/intern/math_vector_inline.c b/source/blender/blenlib/intern/math_vector_inline.c index ae1b443bc56..2f808e5d74e 100644 --- a/source/blender/blenlib/intern/math_vector_inline.c +++ b/source/blender/blenlib/intern/math_vector_inline.c @@ -290,6 +290,14 @@ MINLINE void negate_v4(float r[4]) r[3]= -r[3]; } +MINLINE void negate_v4_v4(float r[4], const float a[4]) +{ + r[0]= -a[0]; + r[1]= -a[1]; + r[2]= -a[2]; + r[3]= -a[3]; +} + MINLINE float dot_v2v2(const float a[2], const float b[2]) { return a[0]*b[0] + a[1]*b[1]; diff --git a/source/blender/blenlib/intern/path_util.c b/source/blender/blenlib/intern/path_util.c index aa5a775c746..1a930e7ff7e 100644 --- a/source/blender/blenlib/intern/path_util.c +++ b/source/blender/blenlib/intern/path_util.c @@ -459,7 +459,7 @@ void BLI_path_rel(char *file, const char *relfile) char *p= temp; char *q= file; - while ((*p == *q)) { + while (*p == *q) { ++p; ++q; /* dont search beyond the end of the string * in the rare case they match */ @@ -752,8 +752,8 @@ int BLI_path_cwd(char *path) #endif if (wasrelative==1) { - char cwd[FILE_MAXDIR + FILE_MAXFILE]; - BLI_getwdN(cwd); /* incase the full path to the blend isnt used */ + char cwd[FILE_MAXDIR + FILE_MAXFILE]= ""; + BLI_getwdN(cwd, sizeof(cwd)); /* incase the full path to the blend isnt used */ if (cwd[0] == '\0') { printf( "Could not get the current working directory - $PWD for an unknown reason."); @@ -861,7 +861,7 @@ static int test_path(char *targetpath, const char *path_base, const char *path_s { char tmppath[FILE_MAX]; - if(path_sep) BLI_join_dirfile(tmppath, path_base, path_sep); + if(path_sep) BLI_join_dirfile(tmppath, sizeof(tmppath), path_base, path_sep); else BLI_strncpy(tmppath, path_base, sizeof(tmppath)); BLI_make_file_string("/", targetpath, tmppath, folder_name); @@ -905,9 +905,9 @@ static int get_path_local(char *targetpath, const char *folder_name, const char #endif if (subfolder_name) { - BLI_join_dirfile(relfolder, folder_name, subfolder_name); + BLI_join_dirfile(relfolder, sizeof(relfolder), folder_name, subfolder_name); } else { - BLI_strncpy(relfolder, folder_name, FILE_MAX); + BLI_strncpy(relfolder, folder_name, sizeof(relfolder)); } /* use argv[0] (bprogname) to get the path to the executable */ @@ -973,15 +973,18 @@ static int get_path_system(char *targetpath, const char *folder_name, const char BLI_split_dirfile(bprogname, bprogdir, NULL); if (subfolder_name) { - BLI_join_dirfile(relfolder, folder_name, subfolder_name); + BLI_join_dirfile(relfolder, sizeof(relfolder), folder_name, subfolder_name); } else { - BLI_strncpy(relfolder, folder_name, FILE_MAX); + BLI_strncpy(relfolder, folder_name, sizeof(relfolder)); } /* try CWD/release/folder_name */ - if(test_path(targetpath, BLI_getwdN(cwd), "release", relfolder)) - return 1; - + if(BLI_getwdN(cwd, sizeof(cwd))) { + if(test_path(targetpath, cwd, "release", relfolder)) { + return 1; + } + } + /* try EXECUTABLE_DIR/release/folder_name */ if(test_path(targetpath, bprogdir, "release", relfolder)) return 1; @@ -1420,12 +1423,12 @@ void BLI_split_dirfile(const char *string, char *dir, char *file) } /* simple appending of filename to dir, does not check for valid path! */ -void BLI_join_dirfile(char *string, const char *dir, const char *file) +void BLI_join_dirfile(char *string, const int maxlen, const char *dir, const char *file) { int sl_dir; if(string != dir) /* compare pointers */ - BLI_strncpy(string, dir, FILE_MAX); + BLI_strncpy(string, dir, maxlen); if (!file) return; @@ -1433,7 +1436,7 @@ void BLI_join_dirfile(char *string, const char *dir, const char *file) sl_dir= BLI_add_slash(string); if (sl_dir <FILE_MAX) { - BLI_strncpy(string + sl_dir, file, FILE_MAX-sl_dir); + BLI_strncpy(string + sl_dir, file, maxlen - sl_dir); } } @@ -1508,21 +1511,21 @@ int BKE_rebase_path(char *abs, int abs_size, char *rel, int rel_size, const char /* if image is _in_ current .blend file directory */ if (!strcmp(dir, blend_dir)) { - BLI_join_dirfile(dest_path, dest_dir, base); + BLI_join_dirfile(dest_path, sizeof(dest_path), dest_dir, base); } /* "below" */ else { /* rel = image_path_dir - blend_dir */ BLI_strncpy(rel_dir, dir + len, sizeof(rel_dir)); - BLI_join_dirfile(dest_path, dest_dir, rel_dir); - BLI_join_dirfile(dest_path, dest_path, base); + BLI_join_dirfile(dest_path, sizeof(dest_path), dest_dir, rel_dir); + BLI_join_dirfile(dest_path, sizeof(dest_path), dest_path, base); } } /* image is out of current directory */ else { - BLI_join_dirfile(dest_path, dest_dir, base); + BLI_join_dirfile(dest_path, sizeof(dest_path), dest_dir, base); } if (abs) @@ -1645,17 +1648,16 @@ static int add_win32_extension(char *name) return (retval); } -void BLI_where_am_i(char *fullname, const char *name) +/* filename must be FILE_MAX length minimum */ +void BLI_where_am_i(char *fullname, const int maxlen, const char *name) { char filename[FILE_MAXDIR+FILE_MAXFILE]; char *path = NULL, *temp; - + #ifdef _WIN32 const char *separator = ";"; - char slash = '\\'; #else const char *separator = ":"; - char slash = '/'; #endif @@ -1663,36 +1665,37 @@ void BLI_where_am_i(char *fullname, const char *name) /* linux uses binreloc since argv[0] is not relyable, call br_init( NULL ) first */ path = br_find_exe( NULL ); if (path) { - BLI_strncpy(fullname, path, FILE_MAXDIR+FILE_MAXFILE); + BLI_strncpy(fullname, path, maxlen); free(path); return; } #endif #ifdef _WIN32 - if(GetModuleFileName(0, fullname, FILE_MAXDIR+FILE_MAXFILE)) { - GetShortPathName(fullname, fullname, FILE_MAXDIR+FILE_MAXFILE); + if(GetModuleFileName(0, fullname, maxlen)) { + GetShortPathName(fullname, fullname, maxlen); return; } #endif /* unix and non linux */ - if (name && fullname && strlen(name)) { - strcpy(fullname, name); + if (name && name[0]) { + BLI_strncpy(fullname, name, maxlen); if (name[0] == '.') { - // relative path, prepend cwd - BLI_getwdN(fullname); - + char wdir[FILE_MAX]= ""; + BLI_getwdN(wdir, sizeof(wdir)); /* backup cwd to restore after */ + // not needed but avoids annoying /./ in name - if(name && name[0]=='.' && name[1]==slash) - BLI_join_dirfile(fullname, fullname, name+2); + if(name[1]==SEP) + BLI_join_dirfile(fullname, maxlen, wdir, name+2); else - BLI_join_dirfile(fullname, fullname, name); - - add_win32_extension(fullname); - } else if (BLI_last_slash(name)) { + BLI_join_dirfile(fullname, maxlen, wdir, name); + + add_win32_extension(fullname); /* XXX, doesnt respect length */ + } + else if (BLI_last_slash(name)) { // full path - strcpy(fullname, name); + BLI_strncpy(fullname, name, maxlen); add_win32_extension(fullname); } else { // search for binary in $PATH @@ -1707,9 +1710,9 @@ void BLI_where_am_i(char *fullname, const char *name) } else { strncpy(filename, path, sizeof(filename)); } - BLI_join_dirfile(fullname, fullname, name); + BLI_join_dirfile(fullname, maxlen, fullname, name); if (add_win32_extension(filename)) { - strcpy(fullname, filename); + BLI_strncpy(fullname, filename, maxlen); break; } } while (temp); @@ -1727,7 +1730,7 @@ void BLI_where_am_i(char *fullname, const char *name) // spaces and double-quotes. There's another solution to this // with spawnv(P_WAIT, bprogname, argv) instead of system() but // that's even uglier - GetShortPathName(fullname, fullname, FILE_MAXDIR+FILE_MAXFILE); + GetShortPathName(fullname, fullname, maxlen); #if defined(DEBUG) printf("Shortname = '%s'\n", fullname); #endif @@ -1735,12 +1738,12 @@ void BLI_where_am_i(char *fullname, const char *name) } } -void BLI_where_is_temp(char *fullname, int usertemp) +void BLI_where_is_temp(char *fullname, int maxlen, int usertemp) { fullname[0] = '\0'; if (usertemp && BLI_is_dir(U.tempdir)) { - strcpy(fullname, U.tempdir); + BLI_strncpy(fullname, U.tempdir, maxlen); } @@ -1748,7 +1751,7 @@ void BLI_where_is_temp(char *fullname, int usertemp) if (fullname[0] == '\0') { char *tmp = getenv("TEMP"); /* Windows */ if (tmp && BLI_is_dir(tmp)) { - strcpy(fullname, tmp); + BLI_strncpy(fullname, tmp, maxlen); } } #else @@ -1756,25 +1759,27 @@ void BLI_where_is_temp(char *fullname, int usertemp) if (fullname[0] == '\0') { char *tmp = getenv("TMP"); if (tmp && BLI_is_dir(tmp)) { - strcpy(fullname, tmp); + BLI_strncpy(fullname, tmp, maxlen); } } if (fullname[0] == '\0') { char *tmp = getenv("TMPDIR"); if (tmp && BLI_is_dir(tmp)) { - strcpy(fullname, tmp); + BLI_strncpy(fullname, tmp, maxlen); } } #endif if (fullname[0] == '\0') { - strcpy(fullname, "/tmp/"); + BLI_strncpy(fullname, "/tmp/", maxlen); } else { /* add a trailing slash if needed */ BLI_add_slash(fullname); #ifdef WIN32 - strcpy(U.tempdir, fullname); /* also set user pref to show %TEMP%. /tmp/ is just plain confusing for Windows users. */ + if(U.tempdir != fullname) { + BLI_strncpy(U.tempdir, fullname, maxlen); /* also set user pref to show %TEMP%. /tmp/ is just plain confusing for Windows users. */ + } #endif } } diff --git a/source/blender/blenlib/intern/storage.c b/source/blender/blenlib/intern/storage.c index e407df7e9a1..c2605a15ad8 100644 --- a/source/blender/blenlib/intern/storage.c +++ b/source/blender/blenlib/intern/storage.c @@ -89,6 +89,7 @@ #include "BLI_listbase.h" #include "BLI_linklist.h" +#include "BLI_storage.h" #include "BLI_storage_types.h" #include "BLI_string.h" @@ -102,21 +103,16 @@ static struct ListBase dirbase_={ 0,0}; static struct ListBase *dirbase = &dirbase_; - -char *BLI_getwdN(char *dir) +/* can return NULL when the size is not big enough */ +char *BLI_getwdN(char *dir, const int maxncpy) { - char *pwd; - - if (dir) { - pwd = getenv("PWD"); - if (pwd){ - strcpy(dir, pwd); - return(dir); - } - /* 160 is FILE_MAXDIR in filesel.c */ - return( getcwd(dir, 160) ); + const char *pwd= getenv("PWD"); + if (pwd){ + BLI_strncpy(dir, pwd, maxncpy); + return dir; } - return(0); + + return getcwd(dir, maxncpy); } @@ -477,7 +473,7 @@ int BLI_is_dir(const char *file) { return S_ISDIR(BLI_exist(file)); } -LinkNode *BLI_read_file_as_lines(char *name) +LinkNode *BLI_read_file_as_lines(const char *name) { FILE *fp= fopen(name, "r"); LinkNode *lines= NULL; diff --git a/source/blender/blenlib/intern/string.c b/source/blender/blenlib/intern/string.c index 6afc34ba630..d6331d6eeb8 100644 --- a/source/blender/blenlib/intern/string.c +++ b/source/blender/blenlib/intern/string.c @@ -66,7 +66,7 @@ char *BLI_strdupcat(const char *str1, const char *str2) return n; } -char *BLI_strncpy(char *dst, const char *src, int maxncpy) { +char *BLI_strncpy(char *dst, const char *src, const int maxncpy) { int srclen= strlen(src); int cpylen= (srclen>(maxncpy-1))?(maxncpy-1):srclen; diff --git a/source/blender/blenlib/intern/threads.c b/source/blender/blenlib/intern/threads.c index eb2057220fe..3d06f157780 100644 --- a/source/blender/blenlib/intern/threads.c +++ b/source/blender/blenlib/intern/threads.c @@ -520,7 +520,7 @@ struct ThreadQueue { int nowait; }; -ThreadQueue *BLI_thread_queue_init() +ThreadQueue *BLI_thread_queue_init(void) { ThreadQueue *queue; diff --git a/source/blender/blenloader/BLO_readfile.h b/source/blender/blenloader/BLO_readfile.h index 798892d452a..94983791289 100644 --- a/source/blender/blenloader/BLO_readfile.h +++ b/source/blender/blenloader/BLO_readfile.h @@ -200,7 +200,7 @@ int BLO_has_bfile_extension(char *str); int BLO_is_a_library(const char *path, char *dir, char *group); struct Main* BLO_library_append_begin(const struct bContext *C, BlendHandle** bh, char *dir); -void BLO_library_append_named_part(const struct bContext *C, struct Main *mainl, BlendHandle** bh, char *name, int idcode, short flag); +void BLO_library_append_named_part(const struct bContext *C, struct Main *mainl, BlendHandle** bh, const char *name, int idcode, short flag); void BLO_library_append_end(const struct bContext *C, struct Main *mainl, BlendHandle** bh, int idcode, short flag); /* deprecated */ diff --git a/source/blender/blenloader/BLO_writefile.h b/source/blender/blenloader/BLO_writefile.h index 5758eca6076..127607232e1 100644 --- a/source/blender/blenloader/BLO_writefile.h +++ b/source/blender/blenloader/BLO_writefile.h @@ -37,7 +37,7 @@ struct ReportList; extern int BLO_write_file(struct Main *mainvar, char *dir, int write_flags, struct ReportList *reports, int *thumb); extern int BLO_write_file_mem(struct Main *mainvar, struct MemFile *compare, struct MemFile *current, int write_flags); -extern int BLO_write_runtime(struct Main *mainvar, char *file, char *exename, struct ReportList *reports); +extern int BLO_write_runtime(struct Main *mainvar, const char *file, char *exename, struct ReportList *reports); #define BLEN_THUMB_SIZE 128 diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index cc3225c0742..3ba7d56d8f7 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -423,7 +423,7 @@ static void split_libdata(ListBase *lb, Main *first) } mainvar= mainvar->next; } - if(mainvar==0) printf("error split_libdata\n"); + if(mainvar==NULL) printf("error split_libdata\n"); } id= idnext; } @@ -590,7 +590,7 @@ static void bh8_from_bh4(BHead *bhead, BHead4 *bhead4) static BHeadN *get_bhead(FileData *fd) { - BHeadN *new_bhead = 0; + BHeadN *new_bhead = NULL; int readsize; if (fd) { @@ -655,7 +655,7 @@ static BHeadN *get_bhead(FileData *fd) if ( ! fd->eof) { new_bhead = MEM_mallocN(sizeof(BHeadN) + bhead.len, "new_bhead"); if (new_bhead) { - new_bhead->next = new_bhead->prev = 0; + new_bhead->next = new_bhead->prev = NULL; new_bhead->bhead = bhead; readsize = fd->read(fd, new_bhead + 1, bhead.len); @@ -663,7 +663,7 @@ static BHeadN *get_bhead(FileData *fd) if (readsize != bhead.len) { fd->eof = 1; MEM_freeN(new_bhead); - new_bhead = 0; + new_bhead = NULL; } } else { fd->eof = 1; @@ -685,13 +685,13 @@ static BHeadN *get_bhead(FileData *fd) BHead *blo_firstbhead(FileData *fd) { BHeadN *new_bhead; - BHead *bhead = 0; + BHead *bhead = NULL; // Rewind the file // Read in a new block if necessary new_bhead = fd->listbase.first; - if (new_bhead == 0) { + if (new_bhead == NULL) { new_bhead = get_bhead(fd); } @@ -722,7 +722,7 @@ BHead *blo_nextbhead(FileData *fd, BHead *thisblock) // get the next BHeadN. If it doesn't exist we read in the next one new_bhead = new_bhead->next; - if (new_bhead == 0) { + if (new_bhead == NULL) { new_bhead = get_bhead(fd); } } @@ -945,7 +945,7 @@ FileData *blo_openblenderfile(const char *name, ReportList *reports) errno= 0; gzfile= gzopen(name, "rb"); - if (gzfile == Z_NULL) { + if (gzfile == (gzFile)Z_NULL) { BKE_reportf(reports, RPT_ERROR, "Unable to open \"%s\": %s.", name, errno ? strerror(errno) : "Unknown erro reading file"); return NULL; } else { @@ -1008,7 +1008,7 @@ void blo_freefiledata(FileData *fd) if (fd->buffer && !(fd->flags & FD_FLAGS_NOT_MY_BUFFER)) { MEM_freeN(fd->buffer); - fd->buffer = 0; + fd->buffer = NULL; } // Free all BHeadN data blocks @@ -1062,7 +1062,7 @@ int BLO_is_a_library(const char *path, char *dir, char *group) /* Find the last slash */ fd= BLI_last_slash(dir); - if(fd==0) return 0; + if(fd==NULL) return 0; *fd= 0; if(BLO_has_bfile_extension(fd+1)) { /* the last part of the dir is a .blend file, no group follows */ @@ -1311,7 +1311,7 @@ static void link_glob_list(FileData *fd, ListBase *lb) /* for glob data */ Link *ln, *prev; void *poin; - if(lb->first==0) return; + if(lb->first==NULL) return; poin= newdataadr(fd, lb->first); if(lb->first) { oldnewmap_insert(fd->globmap, lb->first, poin, 0); @@ -1319,7 +1319,7 @@ static void link_glob_list(FileData *fd, ListBase *lb) /* for glob data */ lb->first= poin; ln= lb->first; - prev= 0; + prev= NULL; while(ln) { poin= newdataadr(fd, ln->next); if(ln->next) { @@ -1460,7 +1460,7 @@ static void IDP_DirectLinkGroup(IDProperty *prop, int switch_endian, FileData *f } } -void IDP_DirectLinkProperty(IDProperty *prop, int switch_endian, FileData *fd) +static void IDP_DirectLinkProperty(IDProperty *prop, int switch_endian, FileData *fd) { switch (prop->type) { case IDP_GROUP: @@ -1497,7 +1497,7 @@ void IDP_DirectLinkProperty(IDProperty *prop, int switch_endian, FileData *fd) } /*stub function*/ -void IDP_LibLinkProperty(IDProperty *UNUSED(prop), int UNUSED(switch_endian), FileData *UNUSED(fd)) +static void IDP_LibLinkProperty(IDProperty *UNUSED(prop), int UNUSED(switch_endian), FileData *UNUSED(fd)) { } @@ -2756,7 +2756,7 @@ static void direct_link_curve(FileData *fd, Curve *cu) if(cu->vfont == NULL) link_list(fd, &(cu->nurb)); else { - cu->nurb.first=cu->nurb.last= 0; + cu->nurb.first=cu->nurb.last= NULL; tb= MEM_callocN(MAXTEXTBOX*sizeof(TextBox), "TextBoxread"); if (cu->tb) { @@ -2830,7 +2830,7 @@ static void direct_link_texture(FileData *fd, Tex *tex) tex->plugin= newdataadr(fd, tex->plugin); if(tex->plugin) { - tex->plugin->handle= 0; + tex->plugin->handle= NULL; open_plugin_tex(tex->plugin); /* initialize data for this instance, if an initialization * function exists. @@ -2982,9 +2982,8 @@ static void direct_link_pointcache(FileData *fd, PointCache *cache) static void direct_link_pointcache_list(FileData *fd, ListBase *ptcaches, PointCache **ocache, int force_disk) { - PointCache *cache= NULL; - if(ptcaches->first) { + PointCache *cache= NULL; link_list(fd, ptcaches); for(cache=ptcaches->first; cache; cache=cache->next) { direct_link_pointcache(fd, cache); @@ -3002,14 +3001,14 @@ static void direct_link_pointcache_list(FileData *fd, ListBase *ptcaches, PointC direct_link_pointcache(fd, *ocache); if(force_disk) { (*ocache)->flag |= PTCACHE_DISK_CACHE; - cache->step = 1; + (*ocache)->step = 1; } ptcaches->first = ptcaches->last = *ocache; } } -void lib_link_partdeflect(FileData *fd, ID *id, PartDeflect *pd) +static void lib_link_partdeflect(FileData *fd, ID *id, PartDeflect *pd) { if(pd && pd->tex) pd->tex=newlibadr_us(fd, id->lib, pd->tex); @@ -3019,6 +3018,8 @@ static void lib_link_particlesettings(FileData *fd, Main *main) { ParticleSettings *part; ParticleDupliWeight *dw; + MTex *mtex; + int a; part= main->particle.first; while(part) { @@ -3064,6 +3065,15 @@ static void lib_link_particlesettings(FileData *fd, Main *main) } } } + + for(a=0; a<MAX_MTEX; a++) { + mtex= part->mtex[a]; + if(mtex) { + mtex->tex = newlibadr_us(fd, part->id.lib, mtex->tex); + mtex->object = newlibadr(fd, part->id.lib, mtex->object); + } + } + part->id.flag -= LIB_NEEDLINK; } part= part->id.next; @@ -3077,6 +3087,7 @@ static void direct_link_partdeflect(PartDeflect *pd) static void direct_link_particlesettings(FileData *fd, ParticleSettings *part) { + int a; part->adt= newdataadr(fd, part->adt); part->pd= newdataadr(fd, part->pd); part->pd2= newdataadr(fd, part->pd2); @@ -3104,6 +3115,9 @@ static void direct_link_particlesettings(FileData *fd, ParticleSettings *part) link_list(fd, &state->actions); } } + for(a=0; a<MAX_MTEX; a++) { + part->mtex[a]= newdataadr(fd, part->mtex[a]); + } } static void lib_link_particlesystems(FileData *fd, Object *ob, ID *id, ListBase *particles) @@ -3800,7 +3814,7 @@ static void direct_link_modifiers(FileData *fd, ListBase *lb) if (md->type==eModifierType_Subsurf) { SubsurfModifierData *smd = (SubsurfModifierData*) md; - smd->emCache = smd->mCache = 0; + smd->emCache = smd->mCache = NULL; } else if (md->type==eModifierType_Armature) { ArmatureModifierData *amd = (ArmatureModifierData*) md; @@ -3835,7 +3849,7 @@ static void direct_link_modifiers(FileData *fd, ListBase *lb) fluidmd->fss= newdataadr(fd, fluidmd->fss); fluidmd->fss->fmd= fluidmd; - fluidmd->fss->meshSurfNormals = 0; + fluidmd->fss->meshSurfNormals = NULL; } else if (md->type==eModifierType_Smoke) { SmokeModifierData *smd = (SmokeModifierData*) md; @@ -3946,7 +3960,7 @@ static void direct_link_modifiers(FileData *fd, ListBase *lb) } else if (md->type==eModifierType_Explode) { ExplodeModifierData *psmd = (ExplodeModifierData*) md; - psmd->facepa=0; + psmd->facepa=NULL; } else if (md->type==eModifierType_MeshDeform) { MeshDeformModifierData *mmd = (MeshDeformModifierData*) md; @@ -4113,7 +4127,7 @@ static void direct_link_object(FileData *fd, Object *ob) prop= ob->prop.first; while(prop) { prop->poin= newdataadr(fd, prop->poin); - if(prop->poin==0) prop->poin= &prop->data; + if(prop->poin==NULL) prop->poin= &prop->data; prop= prop->next; } @@ -4261,7 +4275,7 @@ static void lib_link_scene(FileData *fd, Main *main) BKE_reportf(fd->reports, RPT_ERROR, "LIB ERROR: Object lost from scene:'%s\'\n", sce->id.name+2); if(G.background==0) printf("LIB ERROR: base removed from scene:'%s\'\n", sce->id.name+2); BLI_remlink(&sce->base, base); - if(base==sce->basact) sce->basact= 0; + if(base==sce->basact) sce->basact= NULL; MEM_freeN(base); } } @@ -4284,7 +4298,7 @@ static void lib_link_scene(FileData *fd, Main *main) seq->scene_sound = sound_add_scene_sound(sce, seq, seq->startdisp, seq->enddisp, seq->startofs + seq->anim_startofs); } } - seq->anim= 0; + seq->anim= NULL; } SEQ_END @@ -4349,7 +4363,7 @@ static void direct_link_scene(FileData *fd, Scene *sce) sce->theDag = NULL; sce->dagisvalid = 0; sce->obedit= NULL; - sce->stats= 0; + sce->stats= NULL; sce->fps_info= NULL; sound_create_scene(sce); @@ -4392,7 +4406,7 @@ static void direct_link_scene(FileData *fd, Scene *sce) seq->seq2= newdataadr(fd, seq->seq2); seq->seq3= newdataadr(fd, seq->seq3); /* a patch: after introduction of effects with 3 input strips */ - if(seq->seq3==0) seq->seq3= seq->seq2; + if(seq->seq3==NULL) seq->seq3= seq->seq2; seq->plugin= newdataadr(fd, seq->plugin); seq->effectdata= newdataadr(fd, seq->effectdata); @@ -4416,32 +4430,32 @@ static void direct_link_scene(FileData *fd, Scene *sce) seq->strip->stripdata = newdataadr( fd, seq->strip->stripdata); } else { - seq->strip->stripdata = 0; + seq->strip->stripdata = NULL; } if (seq->flag & SEQ_USE_CROP) { seq->strip->crop = newdataadr( fd, seq->strip->crop); } else { - seq->strip->crop = 0; + seq->strip->crop = NULL; } if (seq->flag & SEQ_USE_TRANSFORM) { seq->strip->transform = newdataadr( fd, seq->strip->transform); } else { - seq->strip->transform = 0; + seq->strip->transform = NULL; } if (seq->flag & SEQ_USE_PROXY) { seq->strip->proxy = newdataadr( fd, seq->strip->proxy); - seq->strip->proxy->anim = 0; + seq->strip->proxy->anim = NULL; } else { - seq->strip->proxy = 0; + seq->strip->proxy = NULL; } if (seq->flag & SEQ_USE_COLOR_BALANCE) { seq->strip->color_balance = newdataadr( fd, seq->strip->color_balance); } else { - seq->strip->color_balance = 0; + seq->strip->color_balance = NULL; } if (seq->strip->color_balance) { // seq->strip->color_balance->gui = 0; // XXX - peter, is this relevant in 2.5? @@ -6505,6 +6519,8 @@ static void area_add_window_regions(ScrArea *sa, SpaceLink *sl, ListBase *lb) } case SPACE_ACTION: { + SpaceAction *saction= (SpaceAction *)sl; + /* we totally reinit the view for the Action Editor, as some old instances had some weird cruft set */ ar->v2d.tot.xmin= -20.0f; ar->v2d.tot.ymin= (float)(-sa->winy)/3.0f; @@ -6514,10 +6530,10 @@ static void area_add_window_regions(ScrArea *sa, SpaceLink *sl, ListBase *lb) ar->v2d.cur= ar->v2d.tot; ar->v2d.min[0]= 0.0f; - ar->v2d.min[1]= 0.0f; + ar->v2d.min[1]= 0.0f; ar->v2d.max[0]= MAXFRAMEF; - ar->v2d.max[1]= FLT_MAX; + ar->v2d.max[1]= FLT_MAX; ar->v2d.minzoom= 0.01f; ar->v2d.maxzoom= 50; @@ -6526,6 +6542,13 @@ static void area_add_window_regions(ScrArea *sa, SpaceLink *sl, ListBase *lb) ar->v2d.keepzoom= V2D_LOCKZOOM_Y; ar->v2d.align= V2D_ALIGN_NO_POS_Y; ar->v2d.flag = V2D_VIEWSYNC_AREA_VERTICAL; + + /* for old files with ShapeKey editors open + an action set, clear the action as + * it doesn't make sense in the new system (i.e. violates concept that ShapeKey edit + * only shows ShapeKey-rooted actions only) + */ + if (saction->mode == SACTCONT_SHAPEKEY) + saction->action = NULL; break; } case SPACE_SEQ: @@ -6718,7 +6741,6 @@ static void do_version_mtex_factor_2_50(MTex **mtex_array, short idtype) mtex->lifefac= (neg & MAP_PA_LIFE)? -varfac: varfac; mtex->sizefac= (neg & MAP_PA_SIZE)? -varfac: varfac; mtex->ivelfac= (neg & MAP_PA_IVEL)? -varfac: varfac; - mtex->pvelfac= (neg & MAP_PA_PVEL)? -varfac: varfac; mtex->shadowfac= (neg & LAMAP_SHAD)? -colfac: colfac; @@ -9988,7 +10010,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main) if(seq->type == SEQ_HD_SOUND) { char str[FILE_MAX]; - BLI_join_dirfile(str, seq->strip->dir, seq->strip->stripdata->name); + BLI_join_dirfile(str, sizeof(str), seq->strip->dir, seq->strip->stripdata->name); BLI_path_abs(str, G.main->name); seq->sound = sound_new_file(main, str); } @@ -12674,7 +12696,7 @@ static void give_base_to_groups(Main *mainvar, Scene *scene) } } -static void append_named_part(const bContext *C, Main *mainl, FileData *fd, char *name, int idcode, short flag) +static void append_named_part(const bContext *C, Main *mainl, FileData *fd, const char *name, int idcode, short flag) { Scene *scene= CTX_data_scene(C); Object *ob; @@ -12740,7 +12762,7 @@ static void append_named_part(const bContext *C, Main *mainl, FileData *fd, char } } -void BLO_library_append_named_part(const bContext *C, Main *mainl, BlendHandle** bh, char *name, int idcode, short flag) +void BLO_library_append_named_part(const bContext *C, Main *mainl, BlendHandle** bh, const char *name, int idcode, short flag) { FileData *fd= (FileData*)(*bh); append_named_part(C, mainl, fd, name, idcode, flag); @@ -12918,7 +12940,7 @@ void BLO_library_append_end(const bContext *C, struct Main *mainl, BlendHandle** /* tentatively removed, Python should be able to use the split functions too: */ /* BLO_library_append_begin, BLO_library_append_end, BLO_library_append_named_part */ #if 0 -void BLO_script_library_append(BlendHandle **bh, char *dir, char *name, +void BLO_script_library_append(BlendHandle **bh, char *dir, const char *name, int idcode, short flag, Main *mainvar, Scene *scene, ReportList *reports) { FileData *fd= (FileData*)(*bh); diff --git a/source/blender/blenloader/intern/writefile.c b/source/blender/blenloader/intern/writefile.c index 63a83258692..c2893f8d732 100644 --- a/source/blender/blenloader/intern/writefile.c +++ b/source/blender/blenloader/intern/writefile.c @@ -215,8 +215,6 @@ static void writedata_free(WriteData *wd) /***/ -int mywfile; - /** * Low level WRITE(2) wrapper that buffers data * @param adr Pointer to new chunk of data @@ -344,7 +342,7 @@ static void writedata(WriteData *wd, int filecode, int len, void *adr) /* do not { BHead bh; - if(adr==0) return; + if(adr==NULL) return; if(len==0) return; len+= 3; @@ -824,6 +822,7 @@ static void write_particlesettings(WriteData *wd, ListBase *idbase) { ParticleSettings *part; ParticleDupliWeight *dw; + int a; part= idbase->first; while(part) { @@ -851,6 +850,10 @@ static void write_particlesettings(WriteData *wd, ListBase *idbase) if(part->fluid && part->phystype == PART_PHYS_FLUID){ writestruct(wd, DATA, "SPHFluidSettings", 1, part->fluid); } + + for(a=0; a<MAX_MTEX; a++) { + if(part->mtex[a]) writestruct(wd, DATA, "MTex", 1, part->mtex[a]); + } } part= part->id.next; } @@ -1292,7 +1295,7 @@ static void write_objects(WriteData *wd, ListBase *idbase) if (ob->type == OB_ARMATURE) { bArmature *arm = ob->data; if (arm && ob->pose && arm->act_bone) { - strcpy(ob->pose->proxy_act_bone, arm->act_bone->name); + BLI_strncpy(ob->pose->proxy_act_bone, arm->act_bone->name, sizeof(ob->pose->proxy_act_bone)); } } @@ -2741,29 +2744,20 @@ int BLO_write_file_mem(Main *mainvar, MemFile *compare, MemFile *current, int wr /* Runtime writing */ -#ifdef WIN32 -#define PATHSEPERATOR "\\" -#else -#define PATHSEPERATOR "/" -#endif - static char *get_runtime_path(char *exename) { char *installpath= get_install_dir(); if (!installpath) { return NULL; - } else { - char *path= MEM_mallocN(strlen(installpath)+strlen(PATHSEPERATOR)+strlen(exename)+1, "runtimepath"); + } + else { + char *path= BLI_sprintfN("%s%c%s", installpath, SEP, exename); if (path == NULL) { MEM_freeN(installpath); return NULL; } - strcpy(path, installpath); - strcat(path, PATHSEPERATOR); - strcat(path, exename); - MEM_freeN(installpath); return path; @@ -2772,7 +2766,7 @@ static char *get_runtime_path(char *exename) { #ifdef __APPLE__ -static int recursive_copy_runtime(char *outname, char *exename, ReportList *reports) +static int recursive_copy_runtime(const char *outname, char *exename, ReportList *reports) { char *runtime = get_runtime_path(exename); char command[2 * (FILE_MAXDIR+FILE_MAXFILE) + 32]; @@ -2808,7 +2802,7 @@ cleanup: return !error; } -int BLO_write_runtime(Main *mainvar, char *file, char *exename, ReportList *reports) +int BLO_write_runtime(Main *mainvar, const char *file, char *exename, ReportList *reports) { char gamename[FILE_MAXDIR+FILE_MAXFILE]; int outfd = -1, error= 0; @@ -2822,8 +2816,7 @@ int BLO_write_runtime(Main *mainvar, char *file, char *exename, ReportList *repo goto cleanup; } - strcpy(gamename, file); - strcat(gamename, "/Contents/Resources/game.blend"); + BLI_snprintf(gamename, sizeof(gamename), "%s/Contents/Resources/game.blend", file); //printf("gamename %s\n", gamename); outfd= open(gamename, O_BINARY|O_WRONLY|O_CREAT|O_TRUNC, 0777); if (outfd != -1) { @@ -2897,7 +2890,7 @@ static int handle_write_msb_int(int handle, int i) return (write(handle, buf, 4)==4); } -int BLO_write_runtime(Main *mainvar, char *file, char *exename, ReportList *reports) +int BLO_write_runtime(Main *mainvar, const char *file, char *exename, ReportList *reports) { int outfd= open(file, O_BINARY|O_WRONLY|O_CREAT|O_TRUNC, 0777); int datastart, error= 0; diff --git a/source/blender/collada/AnimationImporter.cpp b/source/blender/collada/AnimationImporter.cpp index d462042b3f6..836c1fae5df 100644 --- a/source/blender/collada/AnimationImporter.cpp +++ b/source/blender/collada/AnimationImporter.cpp @@ -22,6 +22,9 @@ * ***** END GPL LICENSE BLOCK ***** */ +/* COLLADABU_ASSERT, may be able to remove later */ +#include "COLLADABUPlatform.h" + #include "DNA_armature_types.h" #include "ED_keyframing.h" diff --git a/source/blender/collada/ArmatureImporter.cpp b/source/blender/collada/ArmatureImporter.cpp index 0dae0b6b9cb..e78c1950d33 100644 --- a/source/blender/collada/ArmatureImporter.cpp +++ b/source/blender/collada/ArmatureImporter.cpp @@ -22,6 +22,9 @@ * ***** END GPL LICENSE BLOCK ***** */ +/* COLLADABU_ASSERT, may be able to remove later */ +#include "COLLADABUPlatform.h" + #include <algorithm> #include "COLLADAFWUniqueId.h" diff --git a/source/blender/collada/CMakeLists.txt b/source/blender/collada/CMakeLists.txt index 3a2c085335b..ce204013f3d 100644 --- a/source/blender/collada/CMakeLists.txt +++ b/source/blender/collada/CMakeLists.txt @@ -99,4 +99,9 @@ if(WITH_BUILDINFO) add_definitions(-DNAN_BUILDINFO) endif() +if(CMAKE_COMPILER_IS_GNUCXX) + # COLLADAFWArray.h gives error with gcc 4.5 + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fpermissive") +endif() + blender_add_lib(bf_collada "${SRC}" "${INC}") diff --git a/source/blender/collada/DocumentImporter.cpp b/source/blender/collada/DocumentImporter.cpp index fef1285ae52..2267cf747b1 100644 --- a/source/blender/collada/DocumentImporter.cpp +++ b/source/blender/collada/DocumentImporter.cpp @@ -840,7 +840,7 @@ private: char full_path[FILE_MAX]; BLI_split_dirfile(filename, dir, NULL); - BLI_join_dirfile(full_path, dir, filepath.c_str()); + BLI_join_dirfile(full_path, sizeof(full_path), dir, filepath.c_str()); Image *ima = BKE_add_image_file(full_path); if (!ima) { fprintf(stderr, "Cannot create image. \n"); diff --git a/source/blender/collada/MeshImporter.cpp b/source/blender/collada/MeshImporter.cpp index 5faaf123bc7..b42adc03785 100644 --- a/source/blender/collada/MeshImporter.cpp +++ b/source/blender/collada/MeshImporter.cpp @@ -28,6 +28,9 @@ #include <iostream> #endif +/* COLLADABU_ASSERT, may be able to remove later */ +#include "COLLADABUPlatform.h" + #include "COLLADAFWMeshPrimitive.h" #include "COLLADAFWMeshVertexData.h" #include "COLLADAFWPolygons.h" diff --git a/source/blender/collada/SkinInfo.cpp b/source/blender/collada/SkinInfo.cpp index 8d342daf486..4c6713736fb 100644 --- a/source/blender/collada/SkinInfo.cpp +++ b/source/blender/collada/SkinInfo.cpp @@ -28,6 +28,9 @@ #include <stdint.h> #endif +/* COLLADABU_ASSERT, may be able to remove later */ +#include "COLLADABUPlatform.h" + #include "BKE_object.h" #include "DNA_armature_types.h" #include "DNA_modifier_types.h" diff --git a/source/blender/collada/TransformReader.cpp b/source/blender/collada/TransformReader.cpp index 814fda58e3c..10481fcafbe 100644 --- a/source/blender/collada/TransformReader.cpp +++ b/source/blender/collada/TransformReader.cpp @@ -21,6 +21,8 @@ * * ***** END GPL LICENSE BLOCK ***** */ +/* COLLADABU_ASSERT, may be able to remove later */ +#include "COLLADABUPlatform.h" #include "TransformReader.h" diff --git a/source/blender/collada/collada.cpp b/source/blender/collada/collada.cpp index d040e99c4b9..241b63eeade 100644 --- a/source/blender/collada/collada.cpp +++ b/source/blender/collada/collada.cpp @@ -22,6 +22,9 @@ * ***** END GPL LICENSE BLOCK ***** */ +/* COLLADABU_ASSERT, may be able to remove later */ +#include "COLLADABUPlatform.h" + #include "DocumentExporter.h" #include "DocumentImporter.h" diff --git a/source/blender/collada/collada_internal.cpp b/source/blender/collada/collada_internal.cpp index 4943aa96546..80c8a470888 100644 --- a/source/blender/collada/collada_internal.cpp +++ b/source/blender/collada/collada_internal.cpp @@ -22,6 +22,7 @@ * ***** END GPL LICENSE BLOCK ***** */ +/* COLLADABU_ASSERT, may be able to remove later */ #include "collada_internal.h" UnitConverter::UnitConverter() : unit(), up_axis(COLLADAFW::FileInfo::Z_UP) {} diff --git a/source/blender/collada/collada_utils.cpp b/source/blender/collada/collada_utils.cpp index b6451c58a01..c61f8cda349 100644 --- a/source/blender/collada/collada_utils.cpp +++ b/source/blender/collada/collada_utils.cpp @@ -22,6 +22,9 @@ * ***** END GPL LICENSE BLOCK ***** */ +/* COLLADABU_ASSERT, may be able to remove later */ +#include "COLLADABUPlatform.h" + #include "COLLADAFWGeometry.h" #include "COLLADAFWMeshPrimitive.h" #include "COLLADAFWMeshVertexData.h" diff --git a/source/blender/editors/animation/anim_channels_defines.c b/source/blender/editors/animation/anim_channels_defines.c index 14babe7ce00..e59acacdcf0 100644 --- a/source/blender/editors/animation/anim_channels_defines.c +++ b/source/blender/editors/animation/anim_channels_defines.c @@ -465,7 +465,7 @@ static void *acf_summary_setting_ptr(bAnimListElem *ale, int setting, short *typ else { /* can't return anything useful - unsupported */ *type= 0; - return 0; + return NULL; } } @@ -566,7 +566,7 @@ static void *acf_scene_setting_ptr(bAnimListElem *ale, int setting, short *type) return NULL; default: /* unsupported */ - return 0; + return NULL; } } @@ -710,7 +710,7 @@ static void *acf_object_setting_ptr(bAnimListElem *ale, int setting, short *type return NULL; default: /* unsupported */ - return 0; + return NULL; } } @@ -991,13 +991,13 @@ static void *acf_fillactd_setting_ptr(bAnimListElem *ale, int setting, short *ty GET_ACF_FLAG_PTR(adt->flag); } else - return 0; + return NULL; case ACHANNEL_SETTING_EXPAND: /* expanded */ GET_ACF_FLAG_PTR(act->flag); default: /* unsupported */ - return 0; + return NULL; } } @@ -1075,7 +1075,7 @@ static void *acf_filldrivers_setting_ptr(bAnimListElem *ale, int setting, short GET_ACF_FLAG_PTR(adt->flag); default: /* unsupported */ - return 0; + return NULL; } } @@ -2641,7 +2641,7 @@ static bAnimChannelType *animchannelTypeInfo[ANIMTYPE_NUM_TYPES]; static short ACF_INIT= 1; /* when non-zero, the list needs to be updated */ /* Initialise type info definitions */ -void ANIM_init_channel_typeinfo_data (void) +static void ANIM_init_channel_typeinfo_data (void) { int type= 0; diff --git a/source/blender/editors/animation/anim_channels_edit.c b/source/blender/editors/animation/anim_channels_edit.c index a4de5923715..338873c2a80 100644 --- a/source/blender/editors/animation/anim_channels_edit.c +++ b/source/blender/editors/animation/anim_channels_edit.c @@ -529,7 +529,7 @@ void ANIM_fcurve_delete_from_animdata (bAnimContext *ac, AnimData *adt, FCurve * /* ****************** Operator Utilities ********************************** */ /* poll callback for being in an Animation Editor channels list region */ -int animedit_poll_channels_active (bContext *C) +static int animedit_poll_channels_active (bContext *C) { ScrArea *sa= CTX_wm_area(C); @@ -545,7 +545,7 @@ int animedit_poll_channels_active (bContext *C) } /* poll callback for Animation Editor channels list region + not in NLA-tweakmode for NLA */ -int animedit_poll_channels_nla_tweakmode_off (bContext *C) +static int animedit_poll_channels_nla_tweakmode_off (bContext *C) { ScrArea *sa= CTX_wm_area(C); Scene *scene = CTX_data_scene(C); @@ -579,7 +579,7 @@ enum { }; /* defines for rearranging channels */ -EnumPropertyItem prop_animchannel_rearrange_types[] = { +static EnumPropertyItem prop_animchannel_rearrange_types[] = { {REARRANGE_ANIMCHAN_TOP, "TOP", 0, "To Top", ""}, {REARRANGE_ANIMCHAN_UP, "UP", 0, "Up", ""}, {REARRANGE_ANIMCHAN_DOWN, "DOWN", 0, "Down", ""}, @@ -587,57 +587,46 @@ EnumPropertyItem prop_animchannel_rearrange_types[] = { {0, NULL, 0, NULL, NULL} }; -/* Rearrange Utilities --------------------------------------------- */ +/* Reordering "Islands" Defines ----------------------------------- */ -/* checks if a channel should be considered for moving */ -static short rearrange_animchannel_is_ok (Link *channel, short type) -{ - if (type == ANIMTYPE_GROUP) { - bActionGroup *agrp= (bActionGroup *)channel; - - if (SEL_AGRP(agrp) && !(agrp->flag & AGRP_MOVED)) - return 1; - } - else if (type == ANIMTYPE_FCURVE) { - FCurve *fcu= (FCurve *)channel; - - // FIXME: F-Curve visibility is difficult... needs special filtering tests these days... - if (SEL_FCU(fcu) && !(fcu->flag & FCURVE_TAGGED)) - return 1; - } - else if (type == ANIMTYPE_NLATRACK) { - NlaTrack *nlt = (NlaTrack *)channel; - - if (SEL_NLT(nlt) && !(nlt->flag & NLASTRIP_FLAG_EDIT_TOUCHED)) - return 1; - } +/* Island definition - just a listbase container */ +typedef struct tReorderChannelIsland { + struct tReorderChannelIsland *next, *prev; - return 0; -} + ListBase channels; /* channels within this region with the same state */ + int flag; /* eReorderIslandFlag */ +} tReorderChannelIsland; + +/* flags for channel reordering islands */ +typedef enum eReorderIslandFlag { + REORDER_ISLAND_SELECTED = (1<<0), /* island is selected */ + REORDER_ISLAND_UNTOUCHABLE = (1<<1), /* island should be ignored */ + REORDER_ISLAND_MOVED = (1<<2) /* island has already been moved */ +} eReorderIslandFlag; + -/* checks if another channel can be placed after the given one */ -static short rearrange_animchannel_after_ok (Link *channel, short type) +/* Rearrange Methods --------------------------------------------- */ + +static short rearrange_island_ok (tReorderChannelIsland *island) { - if (type == ANIMTYPE_GROUP) { - bActionGroup *agrp= (bActionGroup *)channel; - - if (agrp->flag & AGRP_TEMP) - return 0; - } + /* island must not be untouchable */ + if (island->flag & REORDER_ISLAND_UNTOUCHABLE) + return 0; - return 1; + /* island should be selected to be moved */ + return (island->flag & REORDER_ISLAND_SELECTED) && !(island->flag & REORDER_ISLAND_MOVED); } -/* Rearrange Methods --------------------------------------------- */ +/* ............................. */ -static short rearrange_animchannel_top (ListBase *list, Link *channel, short type) +static short rearrange_island_top (ListBase *list, tReorderChannelIsland *island) { - if (rearrange_animchannel_is_ok(channel, type)) { - /* take it out off the chain keep data */ - BLI_remlink(list, channel); + if (rearrange_island_ok(island)) { + /* remove from current position */ + BLI_remlink(list, island); /* make it first element */ - BLI_insertlinkbefore(list, list->first, channel); + BLI_insertlinkbefore(list, list->first, island); return 1; } @@ -645,17 +634,18 @@ static short rearrange_animchannel_top (ListBase *list, Link *channel, short typ return 0; } -static short rearrange_animchannel_up (ListBase *list, Link *channel, short type) +static short rearrange_island_up (ListBase *list, tReorderChannelIsland *island) { - if (rearrange_animchannel_is_ok(channel, type)) { - Link *prev= channel->prev; + if (rearrange_island_ok(island)) { + /* moving up = moving before the previous island, otherwise we're in the same place */ + tReorderChannelIsland *prev= island->prev; if (prev) { - /* take it out off the chain keep data */ - BLI_remlink(list, channel); + /* remove from current position */ + BLI_remlink(list, island); /* push it up */ - BLI_insertlinkbefore(list, prev, channel); + BLI_insertlinkbefore(list, prev, island); return 1; } @@ -664,110 +654,200 @@ static short rearrange_animchannel_up (ListBase *list, Link *channel, short type return 0; } -static short rearrange_animchannel_down (ListBase *list, Link *channel, short type) +static short rearrange_island_down (ListBase *list, tReorderChannelIsland *island) { - if (rearrange_animchannel_is_ok(channel, type)) { - Link *next = (channel->next) ? channel->next->next : NULL; + if (rearrange_island_ok(island)) { + /* moving down = moving after the next island, otherwise we're in the same place */ + tReorderChannelIsland *next = island->next; if (next) { - /* take it out off the chain keep data */ - BLI_remlink(list, channel); - - /* move it down */ - BLI_insertlinkbefore(list, next, channel); - - return 1; - } - else if (rearrange_animchannel_after_ok(list->last, type)) { - /* take it out off the chain keep data */ - BLI_remlink(list, channel); - - /* add at end */ - BLI_addtail(list, channel); - - return 1; - } - else { - /* take it out off the chain keep data */ - BLI_remlink(list, channel); - - /* add just before end */ - BLI_insertlinkbefore(list, list->last, channel); - - return 1; + /* can only move past if next is not untouchable (i.e. nothing can go after it) */ + if ((next->flag & REORDER_ISLAND_UNTOUCHABLE)==0) { + /* remove from current position */ + BLI_remlink(list, island); + + /* push it down */ + BLI_insertlinkafter(list, next, island); + + return 1; + } } + /* else: no next channel, so we're at the bottom already, so can't move */ } return 0; } -static short rearrange_animchannel_bottom (ListBase *list, Link *channel, short type) +static short rearrange_island_bottom (ListBase *list, tReorderChannelIsland *island) { - if (rearrange_animchannel_is_ok(channel, type)) { - if (rearrange_animchannel_after_ok(list->last, type)) { - /* take it out off the chain keep data */ - BLI_remlink(list, channel); - - /* add at end */ - BLI_addtail(list, channel); + if (rearrange_island_ok(island)) { + tReorderChannelIsland *last = list->last; + + /* remove island from current position */ + BLI_remlink(list, island); + + /* add before or after the last channel? */ + if ((last->flag & REORDER_ISLAND_UNTOUCHABLE)==0) { + /* can add after it */ + BLI_addtail(list, island); + } + else { + /* can at most go just before it, since last cannot be moved */ + BLI_insertlinkbefore(list, last, island); - return 1; } + + return 1; } return 0; } -/* Generic Stuff ---------------------------------------------------------- */ +/* ............................. */ /* typedef for channel rearranging function * < list: list that channels belong to - * < channel: channel to be moved - * < type: type of channel (eAnim_ChannelType) + * < island: island to be moved * > return[0]: whether operation was a success */ -typedef short (*AnimChanRearrangeFp)(ListBase *list, Link *channel, short type); +typedef short (*AnimChanRearrangeFp)(ListBase *list, tReorderChannelIsland *island); /* get rearranging function, given 'rearrange' mode */ static AnimChanRearrangeFp rearrange_get_mode_func (short mode) { switch (mode) { case REARRANGE_ANIMCHAN_TOP: - return rearrange_animchannel_top; + return rearrange_island_top; case REARRANGE_ANIMCHAN_UP: - return rearrange_animchannel_up; + return rearrange_island_up; case REARRANGE_ANIMCHAN_DOWN: - return rearrange_animchannel_down; + return rearrange_island_down; case REARRANGE_ANIMCHAN_BOTTOM: - return rearrange_animchannel_bottom; + return rearrange_island_bottom; default: return NULL; } } -/* ........ */ - -/* These iteration helpers (ideally should be inlined, but probably not necessary) */ +/* Rearrange Islands Generics ------------------------------------- */ -static Link *rearrange_iter_first (ListBase *list, short mode) +/* add channel into list of islands */ +static void rearrange_animchannel_add_to_islands (ListBase *islands, ListBase *srcList, Link *channel, short type) { - return (mode > 0) ? list->first : list->last; + tReorderChannelIsland *island = islands->last; /* always try to add to last island if possible */ + short is_sel=0, is_untouchable=0; + + /* get flags - selected and untouchable from the channel */ + switch (type) { + case ANIMTYPE_GROUP: + { + bActionGroup *agrp= (bActionGroup *)channel; + + is_sel= SEL_AGRP(agrp); + is_untouchable= (agrp->flag & AGRP_TEMP) != 0; + } + break; + case ANIMTYPE_FCURVE: + { + FCurve *fcu= (FCurve *)channel; + + is_sel= SEL_FCU(fcu); + } + break; + case ANIMTYPE_NLATRACK: + { + NlaTrack *nlt= (NlaTrack *)channel; + + is_sel= SEL_NLT(nlt); + } + break; + + default: + printf("rearrange_animchannel_add_to_islands(): don't know how to handle channels of type %d\n", type); + return; + } + + /* do we need to add to a new island? */ + if ((island == NULL) || /* 1) no islands yet */ + ((island->flag & REORDER_ISLAND_SELECTED) == 0) || /* 2) unselected islands have single channels only - to allow up/down movement */ + (is_sel == 0)) /* 3) if channel is unselected, stop existing island (it was either wrong sel status, or full already) */ + { + /* create a new island now */ + island = MEM_callocN(sizeof(tReorderChannelIsland), "tReorderChannelIsland"); + BLI_addtail(islands, island); + + if (is_sel) + island->flag |= REORDER_ISLAND_SELECTED; + if (is_untouchable) + island->flag |= REORDER_ISLAND_UNTOUCHABLE; + } + + /* add channel to island - need to remove it from its existing list first though */ + BLI_remlink(srcList, channel); + BLI_addtail(&island->channels, channel); } -static Link *rearrange_iter_next (Link *item, short mode) +/* flatten islands out into a single list again */ +static void rearrange_animchannel_flatten_islands (ListBase *islands, ListBase *srcList) { - return (mode > 0) ? item->next : item->prev; + tReorderChannelIsland *island, *isn=NULL; + + /* make sure srcList is empty now */ + BLI_assert(srcList->first == NULL); + + /* go through merging islands */ + for (island = islands->first; island; island = isn) { + isn = island->next; + + /* merge island channels back to main list, then delete the island */ + BLI_movelisttolist(srcList, &island->channels); + BLI_freelinkN(islands, island); + } } -/* ........ */ +/* ............................. */ -/* Clear 'tag' on all F-Curves */ -static void rearrange_clear_fcurve_tags (ListBase *list) +/* performing rearranging of channels using islands */ +static short rearrange_animchannel_islands (ListBase *list, AnimChanRearrangeFp rearrange_func, short mode, short type) { - FCurve *fcu; + ListBase islands = {NULL, NULL}; + Link *channel, *chanNext=NULL; + short done = 0; - for (fcu = list->first; fcu; fcu = fcu->next) - fcu->flag &= ~FCURVE_TAGGED; + /* don't waste effort on an empty list */ + if (list->first == NULL) + return 0; + + /* group channels into islands */ + for (channel = list->first; channel; channel = chanNext) { + chanNext = channel->next; + rearrange_animchannel_add_to_islands(&islands, list, channel, type); + } + + /* perform moving of selected islands now, but only if there is more than one of 'em so that something will happen + * - scanning of the list is performed in the opposite direction to the direction we're moving things, so that we + * shouldn't need to encounter items we've moved already + */ + if (islands.first != islands.last) { + tReorderChannelIsland *first = (mode > 0) ? islands.last : islands.first; + tReorderChannelIsland *island, *isn=NULL; + + for (island = first; island; island = isn) { + isn = (mode > 0) ? island->prev : island->next; + + /* perform rearranging */ + if (rearrange_func(&islands, island)) { + island->flag |= REORDER_ISLAND_MOVED; + done = 1; + } + } + } + + /* ungroup islands */ + rearrange_animchannel_flatten_islands(&islands, list); + + /* did we do anything? */ + return done; } /* NLA Specific Stuff ----------------------------------------------------- */ @@ -778,8 +858,6 @@ static void rearrange_clear_fcurve_tags (ListBase *list) */ static void rearrange_nla_channels (bAnimContext *UNUSED(ac), AnimData *adt, short mode) { - NlaTrack *nlt, *track; - AnimChanRearrangeFp rearrange_func; /* hack: invert mode so that functions will work in right order */ @@ -794,23 +872,8 @@ static void rearrange_nla_channels (bAnimContext *UNUSED(ac), AnimData *adt, sho //if (EXPANDED_DRVD(adt) == 0) // return; - /* clear "moved" flag from all tracks */ - for (nlt= adt->nla_tracks.first; nlt; nlt= nlt->next) - nlt->flag &= ~NLASTRIP_FLAG_EDIT_TOUCHED; - - /* reorder all selected tracks */ - for (nlt= (NlaTrack *)rearrange_iter_first(&adt->nla_tracks, mode); nlt; nlt= track) { - /* Get next channel to consider */ - track= (NlaTrack *)rearrange_iter_next((Link *)nlt, mode); - - /* Try to do channel */ - if (rearrange_func(&adt->nla_tracks, (Link *)nlt, ANIMTYPE_NLATRACK)) - nlt->flag |= NLASTRIP_FLAG_EDIT_TOUCHED; - } - - /* clear "moved" flag from all tracks */ - for (nlt= adt->nla_tracks.first; nlt; nlt= nlt->next) - nlt->flag &= ~NLASTRIP_FLAG_EDIT_TOUCHED; + /* perform rearranging on tracks list */ + rearrange_animchannel_islands(&adt->nla_tracks, rearrange_func, mode, ANIMTYPE_NLATRACK); } /* Drivers Specific Stuff ------------------------------------------------- */ @@ -820,8 +883,6 @@ static void rearrange_nla_channels (bAnimContext *UNUSED(ac), AnimData *adt, sho */ static void rearrange_driver_channels (bAnimContext *UNUSED(ac), AnimData *adt, short mode) { - FCurve *fcu, *fcun; - /* get rearranging function */ AnimChanRearrangeFp rearrange_func = rearrange_get_mode_func(mode); @@ -832,19 +893,8 @@ static void rearrange_driver_channels (bAnimContext *UNUSED(ac), AnimData *adt, if (EXPANDED_DRVD(adt) == 0) return; - rearrange_clear_fcurve_tags(&adt->drivers); - - /* reorder all selected driver F-Curves */ - for (fcu= (FCurve *)rearrange_iter_first(&adt->drivers, mode); fcu; fcu= fcun) { - /* Get next channel to consider */ - fcun= (FCurve *)rearrange_iter_next((Link *)fcu, mode); - - /* Try to do channel */ - if (rearrange_func(&adt->drivers, (Link *)fcu, ANIMTYPE_FCURVE)) - fcu->flag |= FCURVE_TAGGED; - } - - rearrange_clear_fcurve_tags(&adt->drivers); + /* perform rearranging on drivers list (drivers are really just F-Curves) */ + rearrange_animchannel_islands(&adt->drivers, rearrange_func, mode, ANIMTYPE_FCURVE); } /* Action Specific Stuff ------------------------------------------------- */ @@ -858,9 +908,6 @@ static void split_groups_action_temp (bAction *act, bActionGroup *tgrp) if (act == NULL) return; - /* clear "moved" flag from all FCurves */ - rearrange_clear_fcurve_tags(&act->curves); - /* Separate F-Curves into lists per group */ for (agrp= act->groups.first; agrp; agrp= agrp->next) { if (agrp->channels.first) { @@ -921,9 +968,6 @@ static void join_groups_action_temp (bAction *act) break; } } - - /* clear "moved" flag from all fcurve's */ - rearrange_clear_fcurve_tags(&act->curves); } /* Change the order of anim-channels within action @@ -931,10 +975,8 @@ static void join_groups_action_temp (bAction *act) */ static void rearrange_action_channels (bAnimContext *ac, bAction *act, short mode) { - bActionGroup *agrp, *grp; bActionGroup tgrp; - FCurve *fcu, *fcun; - short do_channels = 1; + short do_channels; /* get rearranging function */ AnimChanRearrangeFp rearrange_func = rearrange_get_mode_func(mode); @@ -942,36 +984,22 @@ static void rearrange_action_channels (bAnimContext *ac, bAction *act, short mod if (rearrange_func == NULL) return; - /* make sure we're only operating with groups */ + /* make sure we're only operating with groups (vs a mixture of groups+curves) */ split_groups_action_temp(act, &tgrp); - /* rearrange groups first (and then, only consider channels if the groups weren't moved) */ - for (agrp= (bActionGroup *)rearrange_iter_first(&act->groups, mode); agrp; agrp= grp) { - /* Get next group to consider */ - grp= (bActionGroup *)rearrange_iter_next((Link *)agrp, mode); - - /* try to do group first */ - if (rearrange_func(&act->groups, (Link *)agrp, ANIMTYPE_GROUP)) { - do_channels= 0; - agrp->flag |= AGRP_MOVED; - } - } + /* rearrange groups first + * - the group's channels will only get considered if nothing happened when rearranging the groups + * i.e. the rearrange function returned 0 + */ + do_channels = rearrange_animchannel_islands(&act->groups, rearrange_func, mode, ANIMTYPE_GROUP) == 0; if (do_channels) { - for (agrp= (bActionGroup *)rearrange_iter_first(&act->groups, mode); agrp; agrp= grp) { - /* Get next group to consider */ - grp= (bActionGroup *)rearrange_iter_next((Link *)agrp, mode); - + bActionGroup *agrp; + + for (agrp= act->groups.first; agrp; agrp= agrp->next) { /* only consider F-Curves if they're visible (group expanded) */ if (EXPANDED_AGRP(agrp)) { - for (fcu= (FCurve *)rearrange_iter_first(&agrp->channels, mode); fcu; fcu= fcun) { - /* Get next channel to consider */ - fcun= (FCurve *)rearrange_iter_next((Link *)fcu, mode); - - /* Try to do channel */ - if (rearrange_func(&agrp->channels, (Link *)fcu, ANIMTYPE_FCURVE)) - fcu->flag |= FCURVE_TAGGED; - } + rearrange_animchannel_islands(&agrp->channels, rearrange_func, mode, ANIMTYPE_FCURVE); } } } @@ -1026,7 +1054,7 @@ static int animchannels_rearrange_exec(bContext *C, wmOperator *op) // FIXME: actions should only be considered once! if (adt->action) rearrange_action_channels(&ac, adt->action, mode); - else + else if (G.f & G_DEBUG) printf("animdata has no action\n"); break; } @@ -1041,7 +1069,7 @@ static int animchannels_rearrange_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -void ANIM_OT_channels_move (wmOperatorType *ot) +static void ANIM_OT_channels_move (wmOperatorType *ot) { /* identifiers */ ot->name= "Move Channels"; @@ -1056,7 +1084,7 @@ void ANIM_OT_channels_move (wmOperatorType *ot) ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; /* props */ - RNA_def_enum(ot->srna, "direction", prop_animchannel_rearrange_types, REARRANGE_ANIMCHAN_DOWN, "Direction", ""); + ot->prop= RNA_def_enum(ot->srna, "direction", prop_animchannel_rearrange_types, REARRANGE_ANIMCHAN_DOWN, "Direction", ""); } /* ******************** Delete Channel Operator *********************** */ @@ -1144,7 +1172,7 @@ static int animchannels_delete_exec(bContext *C, wmOperator *UNUSED(op)) return OPERATOR_FINISHED; } -void ANIM_OT_channels_delete (wmOperatorType *ot) +static void ANIM_OT_channels_delete (wmOperatorType *ot) { /* identifiers */ ot->name= "Delete Channels"; @@ -1221,7 +1249,7 @@ static int animchannels_visibility_set_exec(bContext *C, wmOperator *UNUSED(op)) return OPERATOR_FINISHED; } -void ANIM_OT_channels_visibility_set (wmOperatorType *ot) +static void ANIM_OT_channels_visibility_set (wmOperatorType *ot) { /* identifiers */ ot->name= "Set Visibility"; @@ -1294,7 +1322,7 @@ static int animchannels_visibility_toggle_exec(bContext *C, wmOperator *UNUSED(o return OPERATOR_FINISHED; } -void ANIM_OT_channels_visibility_toggle (wmOperatorType *ot) +static void ANIM_OT_channels_visibility_toggle (wmOperatorType *ot) { /* identifiers */ ot->name= "Toggle Visibility"; @@ -1312,7 +1340,7 @@ void ANIM_OT_channels_visibility_toggle (wmOperatorType *ot) /* ********************** Set Flags Operator *********************** */ /* defines for setting animation-channel flags */ -EnumPropertyItem prop_animchannel_setflag_types[] = { +static EnumPropertyItem prop_animchannel_setflag_types[] = { {ACHANNEL_SETFLAG_TOGGLE, "TOGGLE", 0, "Toggle", ""}, {ACHANNEL_SETFLAG_CLEAR, "DISABLE", 0, "Disable", ""}, {ACHANNEL_SETFLAG_ADD, "ENABLE", 0, "Enable", ""}, @@ -1322,7 +1350,7 @@ EnumPropertyItem prop_animchannel_setflag_types[] = { /* defines for set animation-channel settings */ // TODO: could add some more types, but those are really quite dependent on the mode... -EnumPropertyItem prop_animchannel_settings_types[] = { +static EnumPropertyItem prop_animchannel_settings_types[] = { {ACHANNEL_SETTING_PROTECT, "PROTECT", 0, "Protect", ""}, {ACHANNEL_SETTING_MUTE, "MUTE", 0, "Mute", ""}, {0, NULL, 0, NULL, NULL} @@ -1426,7 +1454,7 @@ static int animchannels_setflag_exec(bContext *C, wmOperator *op) } -void ANIM_OT_channels_setting_enable (wmOperatorType *ot) +static void ANIM_OT_channels_setting_enable (wmOperatorType *ot) { /* identifiers */ ot->name= "Enable Channel Setting"; @@ -1448,7 +1476,7 @@ void ANIM_OT_channels_setting_enable (wmOperatorType *ot) ot->prop= RNA_def_enum(ot->srna, "type", prop_animchannel_settings_types, 0, "Type", ""); } -void ANIM_OT_channels_setting_disable (wmOperatorType *ot) +static void ANIM_OT_channels_setting_disable (wmOperatorType *ot) { /* identifiers */ ot->name= "Disable Channel Setting"; @@ -1470,7 +1498,7 @@ void ANIM_OT_channels_setting_disable (wmOperatorType *ot) ot->prop= RNA_def_enum(ot->srna, "type", prop_animchannel_settings_types, 0, "Type", ""); } -void ANIM_OT_channels_setting_invert (wmOperatorType *ot) +static void ANIM_OT_channels_setting_invert (wmOperatorType *ot) { /* identifiers */ ot->name= "Invert Channel Setting"; @@ -1492,7 +1520,7 @@ void ANIM_OT_channels_setting_invert (wmOperatorType *ot) ot->prop= RNA_def_enum(ot->srna, "type", prop_animchannel_settings_types, 0, "Type", ""); } -void ANIM_OT_channels_setting_toggle (wmOperatorType *ot) +static void ANIM_OT_channels_setting_toggle (wmOperatorType *ot) { /* identifiers */ ot->name= "Toggle Channel Setting"; @@ -1514,7 +1542,7 @@ void ANIM_OT_channels_setting_toggle (wmOperatorType *ot) ot->prop= RNA_def_enum(ot->srna, "type", prop_animchannel_settings_types, 0, "Type", ""); } -void ANIM_OT_channels_editable_toggle (wmOperatorType *ot) +static void ANIM_OT_channels_editable_toggle (wmOperatorType *ot) { /* identifiers */ ot->name= "Toggle Channel Editability"; @@ -1559,7 +1587,7 @@ static int animchannels_expand_exec (bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -void ANIM_OT_channels_expand (wmOperatorType *ot) +static void ANIM_OT_channels_expand (wmOperatorType *ot) { /* identifiers */ ot->name= "Expand Channels"; @@ -1601,7 +1629,7 @@ static int animchannels_collapse_exec (bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -void ANIM_OT_channels_collapse (wmOperatorType *ot) +static void ANIM_OT_channels_collapse (wmOperatorType *ot) { /* identifiers */ ot->name= "Collapse Channels"; @@ -1668,7 +1696,7 @@ static int animchannels_enable_exec (bContext *C, wmOperator *UNUSED(op)) return OPERATOR_FINISHED; } -void ANIM_OT_channels_fcurves_enable (wmOperatorType *ot) +static void ANIM_OT_channels_fcurves_enable (wmOperatorType *ot) { /* identifiers */ ot->name= "Revive Disabled F-Curves"; @@ -1705,7 +1733,7 @@ static int animchannels_deselectall_exec (bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -void ANIM_OT_channels_select_all_toggle (wmOperatorType *ot) +static void ANIM_OT_channels_select_all_toggle (wmOperatorType *ot) { /* identifiers */ ot->name= "Select All"; @@ -1830,7 +1858,7 @@ static int animchannels_borderselect_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -void ANIM_OT_channels_select_border(wmOperatorType *ot) +static void ANIM_OT_channels_select_border(wmOperatorType *ot) { /* identifiers */ ot->name= "Border Select"; @@ -2152,7 +2180,7 @@ static int animchannels_mouseclick_invoke(bContext *C, wmOperator *op, wmEvent * return OPERATOR_FINISHED; } -void ANIM_OT_channels_click (wmOperatorType *ot) +static void ANIM_OT_channels_click (wmOperatorType *ot) { /* identifiers */ ot->name= "Mouse Click on Channels"; diff --git a/source/blender/editors/animation/anim_draw.c b/source/blender/editors/animation/anim_draw.c index dd27de883b3..8a165b9c71b 100644 --- a/source/blender/editors/animation/anim_draw.c +++ b/source/blender/editors/animation/anim_draw.c @@ -232,7 +232,7 @@ void ANIM_draw_cfra (const bContext *C, View2D *v2d, short flag) /* Draw dark green line if slow-parenting/time-offset is enabled */ if (flag & DRAWCFRA_SHOW_TIMEOFS) { - Object *ob= (scene->basact) ? (scene->basact->object) : 0; + Object *ob= OBACT; if(ob) { float timeoffset= give_timeoffset(ob); // XXX ob->ipoflag is depreceated! @@ -352,7 +352,7 @@ static short bezt_nlamapping_apply(KeyframeEditData *ked, BezTriple *bezt) */ void ANIM_nla_mapping_apply_fcurve (AnimData *adt, FCurve *fcu, short restore, short only_keys) { - KeyframeEditData ked= {{0}}; + KeyframeEditData ked= {{NULL}}; KeyframeEditFunc map_cb; /* init edit data diff --git a/source/blender/editors/animation/anim_filter.c b/source/blender/editors/animation/anim_filter.c index c63b2ea8a20..8ab677f0f42 100644 --- a/source/blender/editors/animation/anim_filter.c +++ b/source/blender/editors/animation/anim_filter.c @@ -428,7 +428,7 @@ short ANIM_animdata_get_context (const bContext *C, bAnimContext *ac) /* this function allocates memory for a new bAnimListElem struct for the * provided animation channel-data. */ -bAnimListElem *make_new_animlistelem (void *data, short datatype, void *owner, short ownertype, ID *owner_id) +static bAnimListElem *make_new_animlistelem (void *data, short datatype, void *owner, short ownertype, ID *owner_id) { bAnimListElem *ale= NULL; diff --git a/source/blender/editors/animation/anim_ipo_utils.c b/source/blender/editors/animation/anim_ipo_utils.c index 3e2212c15bb..023fd7e4efe 100644 --- a/source/blender/editors/animation/anim_ipo_utils.c +++ b/source/blender/editors/animation/anim_ipo_utils.c @@ -41,10 +41,10 @@ #include "DNA_anim_types.h" - - #include "RNA_access.h" +#include "ED_anim_api.h" + /* ----------------------- Getter functions ----------------------- */ /* Write into "name" buffer, the name of the property (retrieved using RNA from the curve's settings), diff --git a/source/blender/editors/animation/anim_markers.c b/source/blender/editors/animation/anim_markers.c index 58dc5008959..5708c584964 100644 --- a/source/blender/editors/animation/anim_markers.c +++ b/source/blender/editors/animation/anim_markers.c @@ -205,7 +205,7 @@ void ED_markers_get_minmax (ListBase *markers, short sel, float *first, float *l /* --------------------------------- */ /* Adds a marker to list of cfra elems */ -void add_marker_to_cfra_elem(ListBase *lb, TimeMarker *marker, short only_sel) +static void add_marker_to_cfra_elem(ListBase *lb, TimeMarker *marker, short only_sel) { CfraElem *ce, *cen; @@ -264,6 +264,29 @@ TimeMarker *ED_markers_get_first_selected(ListBase *markers) return NULL; } +/* --------------------------------- */ + +/* Print debugging prints of list of markers + * BSI's: do NOT make static or put in if-defs as "unused code". That's too much trouble when we need to use for quick debuggging! + */ +static void debug_markers_print_list(ListBase *markers) +{ + TimeMarker *marker; + + if (markers == NULL) { + printf("No markers list to print debug for\n"); + return; + } + + printf("List of markers follows: -----\n"); + + for (marker = markers->first; marker; marker = marker->next) { + printf("\t'%s' on %d at %p with %d\n", marker->name, marker->frame, marker, marker->flag); + } + + printf("End of list ------------------\n"); +} + /* ************* Marker Drawing ************ */ /* function to draw markers */ @@ -496,7 +519,7 @@ static int ed_marker_add(bContext *C, wmOperator *UNUSED(op)) marker = MEM_callocN(sizeof(TimeMarker), "TimeMarker"); marker->flag= SELECT; marker->frame= frame; - sprintf(marker->name, "F_%02d", frame); // XXX - temp code only + BLI_snprintf(marker->name, sizeof(marker->name), "F_%02d", frame); // XXX - temp code only BLI_addtail(markers, marker); WM_event_add_notifier(C, NC_SCENE|ND_MARKERS, NULL); @@ -724,19 +747,19 @@ static int ed_marker_move_modal(bContext *C, wmOperator *op, wmEvent *evt) if (ELEM(mm->slink->spacetype, SPACE_TIME, SPACE_SOUND)) { SpaceTime *stime= (SpaceTime *)mm->slink; if (stime->flag & TIME_DRAWFRAMES) - sprintf(str, "Marker %d offset %d", selmarker->frame, offs); + BLI_snprintf(str, sizeof(str), "Marker %d offset %d", selmarker->frame, offs); else - sprintf(str, "Marker %.2f offset %.2f", FRA2TIME(selmarker->frame), FRA2TIME(offs)); + BLI_snprintf(str, sizeof(str), "Marker %.2f offset %.2f", FRA2TIME(selmarker->frame), FRA2TIME(offs)); } else if (mm->slink->spacetype == SPACE_ACTION) { SpaceAction *saction= (SpaceAction *)mm->slink; if (saction->flag & SACTION_DRAWTIME) - sprintf(str, "Marker %.2f offset %.2f", FRA2TIME(selmarker->frame), FRA2TIME(offs)); + BLI_snprintf(str, sizeof(str), "Marker %.2f offset %.2f", FRA2TIME(selmarker->frame), FRA2TIME(offs)); else - sprintf(str, "Marker %.2f offset %.2f", (double)(selmarker->frame), (double)(offs)); + BLI_snprintf(str, sizeof(str), "Marker %.2f offset %.2f", (double)(selmarker->frame), (double)(offs)); } else { - sprintf(str, "Marker %.2f offset %.2f", (double)(selmarker->frame), (double)(offs)); + BLI_snprintf(str, sizeof(str), "Marker %.2f offset %.2f", (double)(selmarker->frame), (double)(offs)); } } else { @@ -744,19 +767,19 @@ static int ed_marker_move_modal(bContext *C, wmOperator *op, wmEvent *evt) if (ELEM(mm->slink->spacetype, SPACE_TIME, SPACE_SOUND)) { SpaceTime *stime= (SpaceTime *)mm->slink; if (stime->flag & TIME_DRAWFRAMES) - sprintf(str, "Marker offset %d ", offs); + BLI_snprintf(str, sizeof(str), "Marker offset %d ", offs); else - sprintf(str, "Marker offset %.2f ", FRA2TIME(offs)); + BLI_snprintf(str, sizeof(str), "Marker offset %.2f ", FRA2TIME(offs)); } else if (mm->slink->spacetype == SPACE_ACTION) { SpaceAction *saction= (SpaceAction *)mm->slink; if (saction->flag & SACTION_DRAWTIME) - sprintf(str, "Marker offset %.2f ", FRA2TIME(offs)); + BLI_snprintf(str, sizeof(str), "Marker offset %.2f ", FRA2TIME(offs)); else - sprintf(str, "Marker offset %.2f ", (double)(offs)); + BLI_snprintf(str, sizeof(str), "Marker offset %.2f ", (double)(offs)); } else { - sprintf(str, "Marker offset %.2f ", (double)(offs)); + BLI_snprintf(str, sizeof(str), "Marker offset %.2f ", (double)(offs)); } } @@ -779,7 +802,7 @@ static int ed_marker_move_modal(bContext *C, wmOperator *op, wmEvent *evt) ed_marker_move_apply(op); // ed_marker_header_update(C, op, str, (int)vec[0]); // strcat(str, str_tx); - sprintf(str, "Marker offset %s", str_tx); + BLI_snprintf(str, sizeof(str), "Marker offset %s", str_tx); ED_area_headerprint(CTX_wm_area(C), str); WM_event_add_notifier(C, NC_SCENE|ND_MARKERS, NULL); @@ -868,6 +891,7 @@ static void ed_marker_duplicate_apply(bContext *C) #endif /* new marker is added to the begining of list */ + // FIXME: bad ordering! BLI_addhead(markers, newmarker); } } @@ -996,8 +1020,8 @@ static int ed_marker_select(bContext *C, wmEvent *evt, int extend, int camera) WM_event_add_notifier(C, NC_SCENE|ND_MARKERS, NULL); WM_event_add_notifier(C, NC_ANIMATION|ND_MARKERS, NULL); - /* allowing tweaks */ - return OPERATOR_PASS_THROUGH; + /* allowing tweaks, but needs OPERATOR_FINISHED, otherwise renaming fails... [#25987] */ + return OPERATOR_FINISHED|OPERATOR_PASS_THROUGH; } static int ed_marker_select_invoke(bContext *C, wmOperator *op, wmEvent *evt) diff --git a/source/blender/editors/animation/anim_ops.c b/source/blender/editors/animation/anim_ops.c index 6b0fa30b096..a641b3d1db4 100644 --- a/source/blender/editors/animation/anim_ops.c +++ b/source/blender/editors/animation/anim_ops.c @@ -47,6 +47,7 @@ #include "WM_api.h" #include "WM_types.h" +#include "ED_anim_api.h" #include "ED_screen.h" #include "anim_intern.h" @@ -153,7 +154,7 @@ static int change_frame_modal(bContext *C, wmOperator *op, wmEvent *event) return OPERATOR_RUNNING_MODAL; } -void ANIM_OT_change_frame(wmOperatorType *ot) +static void ANIM_OT_change_frame(wmOperatorType *ot) { /* identifiers */ ot->name= "Change frame"; @@ -208,7 +209,7 @@ static int previewrange_define_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -void ANIM_OT_previewrange_set(wmOperatorType *ot) +static void ANIM_OT_previewrange_set(wmOperatorType *ot) { /* identifiers */ ot->name= "Set Preview Range"; @@ -255,7 +256,7 @@ static int previewrange_clear_exec(bContext *C, wmOperator *UNUSED(op)) return OPERATOR_FINISHED; } -void ANIM_OT_previewrange_clear(wmOperatorType *ot) +static void ANIM_OT_previewrange_clear(wmOperatorType *ot) { /* identifiers */ ot->name= "Clear Preview Range"; @@ -323,7 +324,7 @@ static int toggle_time_exec(bContext *C, wmOperator *UNUSED(op)) return OPERATOR_FINISHED; } -void ANIM_OT_time_toggle(wmOperatorType *ot) +static void ANIM_OT_time_toggle(wmOperatorType *ot) { /* identifiers */ ot->name= "Toggle Frames/Seconds"; diff --git a/source/blender/editors/animation/drivers.c b/source/blender/editors/animation/drivers.c index 8d74e7b1b59..ede2e243e4a 100644 --- a/source/blender/editors/animation/drivers.c +++ b/source/blender/editors/animation/drivers.c @@ -60,6 +60,11 @@ #include "RNA_access.h" #include "RNA_define.h" +#include "anim_intern.h" + +/* called by WM */ +void free_anim_drivers_copybuf (void); + /* ************************************************** */ /* Animation Data Validation */ @@ -70,7 +75,7 @@ * 1 - add new Driver FCurve, * -1 - add new Driver FCurve without driver stuff (for pasting) */ -FCurve *verify_driver_fcurve (ID *id, const char rna_path[], const int array_index, short add) +static FCurve *verify_driver_fcurve (ID *id, const char rna_path[], const int array_index, short add) { AnimData *adt; FCurve *fcu; @@ -475,7 +480,7 @@ static char *get_driver_path_hack (bContext *C, PointerRNA *ptr, PropertyRNA *pr static int add_driver_button_exec (bContext *C, wmOperator *op) { - PointerRNA ptr= {{0}}; + PointerRNA ptr= {{NULL}}; PropertyRNA *prop= NULL; short success= 0; int index, all= RNA_boolean_get(op->ptr, "all"); @@ -531,7 +536,7 @@ void ANIM_OT_driver_button_add (wmOperatorType *ot) static int remove_driver_button_exec (bContext *C, wmOperator *op) { - PointerRNA ptr= {{0}}; + PointerRNA ptr= {{NULL}}; PropertyRNA *prop= NULL; short success= 0; int index, all= RNA_boolean_get(op->ptr, "all"); @@ -583,7 +588,7 @@ void ANIM_OT_driver_button_remove (wmOperatorType *ot) static int copy_driver_button_exec (bContext *C, wmOperator *op) { - PointerRNA ptr= {{0}}; + PointerRNA ptr= {{NULL}}; PropertyRNA *prop= NULL; short success= 0; int index; @@ -627,7 +632,7 @@ void ANIM_OT_copy_driver_button (wmOperatorType *ot) static int paste_driver_button_exec (bContext *C, wmOperator *op) { - PointerRNA ptr= {{0}}; + PointerRNA ptr= {{NULL}}; PropertyRNA *prop= NULL; short success= 0; int index; diff --git a/source/blender/editors/animation/keyframing.c b/source/blender/editors/animation/keyframing.c index d535481d154..67be382e600 100644 --- a/source/blender/editors/animation/keyframing.c +++ b/source/blender/editors/animation/keyframing.c @@ -50,6 +50,7 @@ #include "BKE_animsys.h" #include "BKE_action.h" +#include "BKE_armature.h" #include "BKE_constraint.h" #include "BKE_depsgraph.h" #include "BKE_fcurve.h" @@ -642,51 +643,48 @@ static float visualkey_get_value (PointerRNA *ptr, PropertyRNA *prop, int array_ if (strstr(identifier, "location")) { return ob->obmat[3][array_index]; } - else if (strstr(identifier, "rotation")) { + else if (strstr(identifier, "rotation_euler")) { float eul[3]; - mat4_to_eul( eul,ob->obmat); + mat4_to_eulO(eul, ob->rotmode, ob->obmat); return eul[array_index]; } + // FIXME: other types of rotation don't work } } else if (ptr->type == &RNA_PoseBone) { - Object *ob= (Object *)ptr->id.data; /* we assume that this is always set, and is an object */ bPoseChannel *pchan= (bPoseChannel *)ptr->data; - float tmat[4][4]; + bPoseChannel tchan; - /* Although it is not strictly required for this particular space conversion, - * arg1 must not be null, as there is a null check for the other conversions to - * be safe. Therefore, the active object is passed here, and in many cases, this - * will be what owns the pose-channel that is getting this anyway. + /* make a copy of pchan so that we can apply and decompose its chan_mat, thus getting the + * rest-pose to pose-mode transform that got stored there at the end of posing calculations + * for B-Bone deforms to use + * - it should be safe to just make a local copy like this, since we're not doing anything with the copied pointers */ - copy_m4_m4(tmat, pchan->pose_mat); - constraint_mat_convertspace(ob, pchan, tmat, CONSTRAINT_SPACE_POSE, CONSTRAINT_SPACE_LOCAL); + memcpy(&tchan, pchan, sizeof(bPoseChannel)); + pchan_apply_mat4(&tchan, pchan->chan_mat, TRUE); /* Loc, Rot/Quat keyframes are supported... */ if (strstr(identifier, "location")) { /* only use for non-connected bones */ if ((pchan->bone->parent) && !(pchan->bone->flag & BONE_CONNECTED)) - return tmat[3][array_index]; + return tchan.loc[array_index]; else if (pchan->bone->parent == NULL) - return tmat[3][array_index]; + return tchan.loc[array_index]; } else if (strstr(identifier, "rotation_euler")) { - float eul[3]; - - /* euler-rotation test before standard rotation, as standard rotation does quats */ - mat4_to_eulO( eul, pchan->rotmode,tmat); - return eul[array_index]; + return tchan.eul[array_index]; } else if (strstr(identifier, "rotation_quaternion")) { - float trimat[3][3], quat[4]; - - copy_m3_m4(trimat, tmat); - mat3_to_quat_is_ok( quat,trimat); - - return quat[array_index]; + return tchan.quat[array_index]; + } + else if (strstr(identifier, "rotation_axisangle")) { + /* w = 0, x,y,z = 1,2,3 */ + if (array_index == 0) + return tchan.rotAngle; + else + return tchan.rotAxis[array_index - 1]; } - // TODO: axis-angle... } /* as the function hasn't returned yet, read value from system in the default way */ @@ -1369,7 +1367,7 @@ static int insert_key_button_exec (bContext *C, wmOperator *op) { Main *bmain= CTX_data_main(C); Scene *scene= CTX_data_scene(C); - PointerRNA ptr= {{0}}; + PointerRNA ptr= {{NULL}}; PropertyRNA *prop= NULL; char *path; float cfra= (float)CFRA; // XXX for now, don't bother about all the yucky offset crap @@ -1458,7 +1456,7 @@ static int delete_key_button_exec (bContext *C, wmOperator *op) { Main *bmain= CTX_data_main(C); Scene *scene= CTX_data_scene(C); - PointerRNA ptr= {{0}}; + PointerRNA ptr= {{NULL}}; PropertyRNA *prop= NULL; char *path; float cfra= (float)CFRA; // XXX for now, don't bother about all the yucky offset crap diff --git a/source/blender/editors/animation/keyingsets.c b/source/blender/editors/animation/keyingsets.c index 2df7d21e907..40c2f3c3797 100644 --- a/source/blender/editors/animation/keyingsets.c +++ b/source/blender/editors/animation/keyingsets.c @@ -288,7 +288,7 @@ static int add_keyingset_button_exec (bContext *C, wmOperator *op) Scene *scene= CTX_data_scene(C); KeyingSet *ks = NULL; PropertyRNA *prop= NULL; - PointerRNA ptr= {{0}}; + PointerRNA ptr= {{NULL}}; char *path = NULL; short success= 0; int index=0, pflag=0; @@ -388,7 +388,7 @@ static int remove_keyingset_button_exec (bContext *C, wmOperator *op) Scene *scene= CTX_data_scene(C); KeyingSet *ks = NULL; PropertyRNA *prop= NULL; - PointerRNA ptr= {{0}}; + PointerRNA ptr= {{NULL}}; char *path = NULL; short success= 0; int index=0; diff --git a/source/blender/editors/armature/editarmature.c b/source/blender/editors/armature/editarmature.c index 4fc5064cef0..94c1edd90d5 100644 --- a/source/blender/editors/armature/editarmature.c +++ b/source/blender/editors/armature/editarmature.c @@ -716,7 +716,6 @@ void POSE_OT_armature_apply (wmOperatorType *ot) /* set the current pose as the restpose */ static int pose_visual_transform_apply_exec (bContext *C, wmOperator *UNUSED(op)) { - Scene *scene= CTX_data_scene(C); Object *ob= ED_object_pose_armature(CTX_data_active_object(C)); // must be active object, not edit-object /* don't check if editmode (should be done by caller) */ @@ -729,24 +728,18 @@ static int pose_visual_transform_apply_exec (bContext *C, wmOperator *UNUSED(op) * at once are to be predictable*/ CTX_DATA_BEGIN(C, bPoseChannel *, pchan, selected_pose_bones) { - float delta_mat[4][4], imat[4][4], mat[4][4]; - - where_is_pose_bone(scene, ob, pchan, CFRA, 1); - - copy_m4_m4(mat, pchan->pose_mat); - - /* calculate pchan->pose_mat without loc/size/rot & constraints applied */ - where_is_pose_bone(scene, ob, pchan, CFRA, 0); - invert_m4_m4(imat, pchan->pose_mat); - mul_m4_m4m4(delta_mat, mat, imat); - + float delta_mat[4][4]; + + /* chan_mat already contains the delta transform from rest pose to pose-mode pose + * as that is baked into there so that B-Bones will work. Once we've set this as the + * new raw-transform components, don't recalc the poses yet, otherwise IK result will + * change, thus changing the result we may be trying to record. + */ + copy_m4_m4(delta_mat, pchan->chan_mat); pchan_apply_mat4(pchan, delta_mat, TRUE); - - where_is_pose_bone(scene, ob, pchan, CFRA, 1); } CTX_DATA_END; - - // ob->pose->flag |= (POSE_LOCKED|POSE_DO_UNLOCK); + DAG_id_tag_update(&ob->id, OB_RECALC_DATA); /* note, notifier might evolve */ @@ -2205,10 +2198,8 @@ static int armature_calc_roll_exec(bContext *C, wmOperator *op) mul_m3_v3(imat, vec); } else if (type==5) { - bArmature *arm= ob->data; - EditBone *ebone= (EditBone *)arm->act_edbone; float mat[3][3], nor[3]; - + ebone= (EditBone *)arm->act_edbone; if(ebone==NULL) { BKE_report(op->reports, RPT_ERROR, "No active bone set"); return OPERATOR_CANCELLED; @@ -4721,7 +4712,7 @@ static void envelope_bone_weighting(Object *ob, Mesh *mesh, float (*verts)[3], i } } -void add_verts_to_dgroups(ReportList *reports, Scene *scene, Object *ob, Object *par, int heat, int mirror) +static void add_verts_to_dgroups(ReportList *reports, Scene *scene, Object *ob, Object *par, int heat, int mirror) { /* This functions implements the automatic computation of vertex group * weights, either through envelopes or using a heat equilibrium. @@ -5441,13 +5432,11 @@ static int bone_unique_check(void *arg, const char *name) return get_named_bone((bArmature *)arg, name) != NULL; } -void unique_bone_name(bArmature *arm, char *name) +static void unique_bone_name(bArmature *arm, char *name) { BLI_uniquename_cb(bone_unique_check, (void *)arm, "Bone", '.', name, sizeof(((Bone *)NULL)->name)); } - -#define MAXBONENAME 32 /* helper call for armature_bone_rename */ static void constraint_bone_name_fix(Object *ob, ListBase *conlist, char *oldname, char *newname) { diff --git a/source/blender/editors/armature/editarmature_retarget.c b/source/blender/editors/armature/editarmature_retarget.c index cabf81ea85e..ee0ed8252c3 100644 --- a/source/blender/editors/armature/editarmature_retarget.c +++ b/source/blender/editors/armature/editarmature_retarget.c @@ -112,7 +112,7 @@ float rollBoneByQuat(EditBone *bone, float old_up_axis[3], float qrot[4]); /*********************************** EDITBONE UTILS ****************************************************/ -int countEditBoneChildren(ListBase *list, EditBone *parent) +static int countEditBoneChildren(ListBase *list, EditBone *parent) { EditBone *ebone; int count = 0; @@ -128,7 +128,7 @@ int countEditBoneChildren(ListBase *list, EditBone *parent) return count; } -EditBone* nextEditBoneChild(ListBase *list, EditBone *parent, int n) +static EditBone* nextEditBoneChild(ListBase *list, EditBone *parent, int n) { EditBone *ebone; @@ -147,7 +147,7 @@ EditBone* nextEditBoneChild(ListBase *list, EditBone *parent, int n) return NULL; } -void getEditBoneRollUpAxis(EditBone *bone, float roll, float up_axis[3]) +static void getEditBoneRollUpAxis(EditBone *bone, float roll, float up_axis[3]) { float mat[3][3], nor[3]; @@ -195,7 +195,7 @@ float rollBoneByQuatAligned(EditBone *bone, float old_up_axis[3], float qrot[4], } } -float rollBoneByQuatJoint(RigEdge *edge, RigEdge *previous, float qrot[4], float qroll[4], float up_axis[3]) +static float rollBoneByQuatJoint(RigEdge *edge, RigEdge *previous, float qrot[4], float qroll[4], float up_axis[3]) { if (previous == NULL) { @@ -257,7 +257,7 @@ float rollBoneByQuat(EditBone *bone, float old_up_axis[3], float qrot[4]) /************************************ DESTRUCTORS ******************************************************/ -void RIG_freeRigArc(BArc *arc) +static void RIG_freeRigArc(BArc *arc) { BLI_freelistN(&((RigArc*)arc)->edges); } diff --git a/source/blender/editors/armature/poselib.c b/source/blender/editors/armature/poselib.c index d5994e24cd6..9c7911715b4 100644 --- a/source/blender/editors/armature/poselib.c +++ b/source/blender/editors/armature/poselib.c @@ -882,91 +882,90 @@ static void poselib_preview_apply (bContext *C, wmOperator *op) */ static void poselib_preview_get_next (tPoseLib_PreviewData *pld, int step) { - /* check if we no longer have search-string, but don't have any marker */ - if (pld->marker == NULL) { - if ((step) && (pld->searchstr[0] == 0)) - pld->marker= pld->act->markers.first; - } - - /* the following operations assume that there is a starting point and direction */ - if ((pld->marker) && (step)) { - /* search-string dictates a special approach */ - if (pld->searchstr[0]) { - TimeMarker *marker; - LinkData *ld, *ldn, *ldc; + /* stop if not going anywhere, as we assume that there is a direction to move in */ + if (step == 0) + return; + + /* search-string dictates a special approach */ + if (pld->searchstr[0]) { + TimeMarker *marker; + LinkData *ld, *ldn, *ldc; + + /* free and rebuild if needed (i.e. if search-str changed) */ + if (strcmp(pld->searchstr, pld->searchold)) { + /* free list of temporary search matches */ + BLI_freelistN(&pld->searchp); - /* free and rebuild if needed (i.e. if search-str changed) */ - if (strcmp(pld->searchstr, pld->searchold)) { - /* free list of temporary search matches */ - BLI_freelistN(&pld->searchp); - - /* generate a new list of search matches */ - for (marker= pld->act->markers.first; marker; marker= marker->next) { - /* does the name partially match? - * - don't worry about case, to make it easier for users to quickly input a name (or - * part of one), which is the whole point of this feature - */ - if (BLI_strcasestr(marker->name, pld->searchstr)) { - /* make link-data to store reference to it */ - ld= MEM_callocN(sizeof(LinkData), "PoseMatch"); - ld->data= marker; - BLI_addtail(&pld->searchp, ld); - } + /* generate a new list of search matches */ + for (marker= pld->act->markers.first; marker; marker= marker->next) { + /* does the name partially match? + * - don't worry about case, to make it easier for users to quickly input a name (or + * part of one), which is the whole point of this feature + */ + if (BLI_strcasestr(marker->name, pld->searchstr)) { + /* make link-data to store reference to it */ + ld= MEM_callocN(sizeof(LinkData), "PoseMatch"); + ld->data= marker; + BLI_addtail(&pld->searchp, ld); } - - /* set current marker to NULL (so that we start from first) */ - pld->marker= NULL; - } - - /* check if any matches */ - if (pld->searchp.first == NULL) { - pld->marker= NULL; - return; } - /* find first match */ - for (ldc= pld->searchp.first; ldc; ldc= ldc->next) { - if (ldc->data == pld->marker) - break; - } - if (ldc == NULL) - ldc= pld->searchp.first; - - /* Loop through the matches in a cyclic fashion, incrementing/decrementing step as appropriate - * until step == 0. At this point, marker should be the correct marker. - */ - if (step > 0) { - for (ld=ldc; ld && step; ld=ldn, step--) - ldn= (ld->next) ? ld->next : pld->searchp.first; - } - else { - for (ld=ldc; ld && step; ld=ldn, step++) - ldn= (ld->prev) ? ld->prev : pld->searchp.last; - } + /* set current marker to NULL (so that we start from first) */ + pld->marker= NULL; + } + + /* check if any matches */ + if (pld->searchp.first == NULL) { + pld->marker= NULL; + return; + } + + /* find first match */ + for (ldc= pld->searchp.first; ldc; ldc= ldc->next) { + if (ldc->data == pld->marker) + break; + } + if (ldc == NULL) + ldc= pld->searchp.first; - /* set marker */ - if (ld) - pld->marker= ld->data; + /* Loop through the matches in a cyclic fashion, incrementing/decrementing step as appropriate + * until step == 0. At this point, marker should be the correct marker. + */ + if (step > 0) { + for (ld=ldc; ld && step; ld=ldn, step--) + ldn= (ld->next) ? ld->next : pld->searchp.first; } else { - TimeMarker *marker, *next; - - /* Loop through the markers in a cyclic fashion, incrementing/decrementing step as appropriate - * until step == 0. At this point, marker should be the correct marker. - */ - if (step > 0) { - for (marker=pld->marker; marker && step; marker=next, step--) - next= (marker->next) ? marker->next : pld->act->markers.first; - } - else { - for (marker=pld->marker; marker && step; marker=next, step++) - next= (marker->prev) ? marker->prev : pld->act->markers.last; - } - - /* it should be fairly impossible for marker to be NULL */ - if (marker) - pld->marker= marker; + for (ld=ldc; ld && step; ld=ldn, step++) + ldn= (ld->prev) ? ld->prev : pld->searchp.last; } + + /* set marker */ + if (ld) + pld->marker= ld->data; + } + else { + TimeMarker *marker, *next; + + /* if no marker, because we just ended searching, then set that to the start of the list */ + if (pld->marker == NULL) + pld->marker= pld->act->markers.first; + + /* Loop through the markers in a cyclic fashion, incrementing/decrementing step as appropriate + * until step == 0. At this point, marker should be the correct marker. + */ + if (step > 0) { + for (marker=pld->marker; marker && step; marker=next, step--) + next= (marker->next) ? marker->next : pld->act->markers.first; + } + else { + for (marker=pld->marker; marker && step; marker=next, step++) + next= (marker->prev) ? marker->prev : pld->act->markers.last; + } + + /* it should be fairly impossible for marker to be NULL */ + if (marker) + pld->marker= marker; } } @@ -1037,6 +1036,12 @@ static int poselib_preview_handle_event (bContext *UNUSED(C), wmOperator *op, wm tPoseLib_PreviewData *pld= op->customdata; int ret = OPERATOR_RUNNING_MODAL; + /* only accept 'press' event, and ignore 'release', so that we don't get double actions */ + if (ELEM(event->val, KM_PRESS, KM_NOTHING) == 0) { + //printf("PoseLib: skipping event with type '%s' and val %d\n", WM_key_event_string(event->type), event->val); + return ret; + } + /* backup stuff that needs to occur before every operation * - make a copy of searchstr, so that we know if cache needs to be rebuilt */ @@ -1065,18 +1070,16 @@ static int poselib_preview_handle_event (bContext *UNUSED(C), wmOperator *op, wm */ case PAD0: case PAD1: case PAD2: case PAD3: case PAD4: case PAD5: case PAD6: case PAD7: case PAD8: case PAD9: - case PADPLUSKEY: case PADMINUS: case MIDDLEMOUSE: + case PADPLUSKEY: case PADMINUS: + case MIDDLEMOUSE: case MOUSEMOVE: //pld->redraw= PL_PREVIEW_REDRAWHEADER; - ret |= OPERATOR_PASS_THROUGH; + ret = OPERATOR_PASS_THROUGH; break; /* quicky compare to original */ case TABKEY: - /* only respond to one event */ - if (event->val == 0) { - pld->flag &= ~PL_PREVIEW_SHOWORIGINAL; - pld->redraw= PL_PREVIEW_REDRAWALL; - } + pld->flag &= ~PL_PREVIEW_SHOWORIGINAL; + pld->redraw= PL_PREVIEW_REDRAWALL; break; } @@ -1103,11 +1106,8 @@ static int poselib_preview_handle_event (bContext *UNUSED(C), wmOperator *op, wm /* toggle between original pose and poselib pose*/ case TABKEY: - /* only respond to one event */ - if (event->val == 0) { - pld->flag |= PL_PREVIEW_SHOWORIGINAL; - pld->redraw= PL_PREVIEW_REDRAWALL; - } + pld->flag |= PL_PREVIEW_SHOWORIGINAL; + pld->redraw= PL_PREVIEW_REDRAWALL; break; /* change to previous pose (cyclic) */ @@ -1200,9 +1200,9 @@ static int poselib_preview_handle_event (bContext *UNUSED(C), wmOperator *op, wm /* we add pass through here, so that the operators responsible for these can still run, * even though we still maintain control (as RUNNING_MODAL flag is still set too) */ - case MIDDLEMOUSE: + case MIDDLEMOUSE: case MOUSEMOVE: //pld->redraw= PL_PREVIEW_REDRAWHEADER; - ret |= OPERATOR_PASS_THROUGH; + ret = OPERATOR_PASS_THROUGH; break; /* view manipulation, or searching */ @@ -1216,7 +1216,7 @@ static int poselib_preview_handle_event (bContext *UNUSED(C), wmOperator *op, wm else { /* view manipulation (see above) */ //pld->redraw= PL_PREVIEW_REDRAWHEADER; - ret |= OPERATOR_PASS_THROUGH; + ret = OPERATOR_PASS_THROUGH; } break; diff --git a/source/blender/editors/armature/reeb.c b/source/blender/editors/armature/reeb.c index 29ba72ce604..38e23a3d456 100644 --- a/source/blender/editors/armature/reeb.c +++ b/source/blender/editors/armature/reeb.c @@ -205,7 +205,7 @@ void REEB_freeGraph(ReebGraph *rg) MEM_freeN(rg); } -ReebGraph * newReebGraph() +ReebGraph * newReebGraph(void) { ReebGraph *rg; rg = MEM_callocN(sizeof(ReebGraph), "reeb graph"); diff --git a/source/blender/editors/curve/editcurve.c b/source/blender/editors/curve/editcurve.c index 0949e3d6214..0f6b88554e1 100644 --- a/source/blender/editors/curve/editcurve.c +++ b/source/blender/editors/curve/editcurve.c @@ -1122,14 +1122,13 @@ static void curve_rename_fcurves(Object *obedit, ListBase *orig_curves) /* remove pathes for removed control points need this to make further step with copying non-cv related curves copying not touching cv's f-cruves */ - fcu= orig_curves->first; for(fcu= orig_curves->first; fcu; fcu= next) { next= fcu->next; if(!strncmp(fcu->rna_path, "splines", 7)) { char *ch= strchr(fcu->rna_path, '.'); - if (ch && (!strncmp(ch, ".bezier_points", 14) || !strncmp(ch, ".points", 8))) + if (ch && (!strncmp(ch, ".bezier_points", 14) || !strncmp(ch, ".points", 7))) fcurve_remove(ad, orig_curves, fcu); } } @@ -4404,8 +4403,20 @@ static int addvert_Nurb(bContext *C, short mode, float location[3]) findselectedNurbvert(&editnurb->nurbs, &nu, &bezt, &bp); if ((nu == NULL) || (nu->type==CU_BEZIER && bezt==NULL) || (nu->type!=CU_BEZIER && bp==NULL)) { - if(cu->actnu >= 0 && mode!='e') { - nu= BLI_findlink(&editnurb->nurbs, cu->actnu); + if(mode!='e') { + if(cu->actnu >= 0) nu= BLI_findlink(&editnurb->nurbs, cu->actnu); + else { + /* no selected sement -- create new one which is BEZIER tpye + type couldn't be determined from Curve bt could be changed + in the future, so shouldn't make much headache */ + + nu= MEM_callocN(sizeof(Nurb), "addvert_Nurb nu"); + nu->type= CU_BEZIER; + nu->resolu= cu->resolu; + nu->flag |= CU_SMOOTH; + + BLI_addtail(&editnurb->nurbs, nu); + } if(nu->type==CU_BEZIER) { newbezt= (BezTriple*)MEM_callocN(sizeof(BezTriple), "addvert_Nurb"); @@ -5616,6 +5627,7 @@ static int delete_exec(bContext *C, wmOperator *op) BezTriple *bezt, *bezt1, *bezt2; BPoint *bp, *bp1, *bp2; int a, cut= 0, type= RNA_enum_get(op->ptr, "type"); + int nuindex= 0; if(obedit->type==OB_SURF) { if(type==0) { @@ -5650,6 +5662,9 @@ static int delete_exec(bContext *C, wmOperator *op) bezt++; } if(a==0) { + if(cu->actnu == nuindex) + cu->actnu= -1; + BLI_remlink(nubase, nu); keyIndex_delNurb(editnurb, nu); freeNurb(nu); nu= NULL; @@ -5667,6 +5682,9 @@ static int delete_exec(bContext *C, wmOperator *op) bp++; } if(a==0) { + if(cu->actnu == nuindex) + cu->actnu= -1; + BLI_remlink(nubase, nu); keyIndex_delNurb(editnurb, nu); freeNurb(nu); nu= NULL; @@ -5682,6 +5700,7 @@ static int delete_exec(bContext *C, wmOperator *op) } */ nu= next; + nuindex++; } /* 2nd loop, delete small pieces: just for curves */ nu= nubase->first; @@ -5755,6 +5774,7 @@ static int delete_exec(bContext *C, wmOperator *op) bezt1= bezt2= NULL; bp1= bp2= NULL; nu1= NULL; + nuindex= 0; for(nu= nubase->first; nu; nu= nu->next) { next= nu->next; if(nu->type == CU_BEZIER) { @@ -5811,10 +5831,14 @@ static int delete_exec(bContext *C, wmOperator *op) } } if(nu1) break; + nuindex++; } if(nu1) { if(bezt1) { if(nu1->pntsu==2) { /* remove completely */ + if(cu->actnu == nuindex) + cu->actnu= -1; + BLI_remlink(nubase, nu); freeNurb(nu); nu = NULL; } @@ -5858,6 +5882,9 @@ static int delete_exec(bContext *C, wmOperator *op) } else if(bp1) { if(nu1->pntsu==2) { /* remove completely */ + if(cu->actnu == nuindex) + cu->actnu= -1; + BLI_remlink(nubase, nu); freeNurb(nu); nu= NULL; } @@ -5892,6 +5919,7 @@ static int delete_exec(bContext *C, wmOperator *op) } } else if(type==2) { + cu->actnu= -1; keyIndex_delNurbList(editnurb, nubase); freeNurblist(nubase); } diff --git a/source/blender/editors/gpencil/gpencil_buttons.c b/source/blender/editors/gpencil/gpencil_buttons.c index 96bc4259661..7590b2558f0 100644 --- a/source/blender/editors/gpencil/gpencil_buttons.c +++ b/source/blender/editors/gpencil/gpencil_buttons.c @@ -141,7 +141,7 @@ static void gp_drawui_layer (uiLayout *layout, bGPdata *gpd, bGPDlayer *gpl) uiItemL(subrow, name, ICON_NULL); /* delete button (only if hidden but not locked!) */ - if ((gpl->flag & GP_LAYER_HIDE) & !(gpl->flag & GP_LAYER_LOCKED)) { + if ((gpl->flag & GP_LAYER_HIDE) && !(gpl->flag & GP_LAYER_LOCKED)) { /* right-align ............................... */ subrow= uiLayoutRow(row, 1); uiLayoutSetAlignment(subrow, UI_LAYOUT_ALIGN_RIGHT); diff --git a/source/blender/editors/include/ED_mesh.h b/source/blender/editors/include/ED_mesh.h index 386bbc0a236..057e5d3bf88 100644 --- a/source/blender/editors/include/ED_mesh.h +++ b/source/blender/editors/include/ED_mesh.h @@ -51,6 +51,9 @@ struct MDeformWeight; struct MDeformVert; struct Scene; struct Mesh; +struct MFace; +struct MEdge; +struct MVert; struct MCol; struct UvVertMap; struct UvMapVert; @@ -194,7 +197,7 @@ int paintface_minmax(struct Object *ob, float *min, float *max); struct bDeformGroup *ED_vgroup_add(struct Object *ob); struct bDeformGroup *ED_vgroup_add_name(struct Object *ob, const char *name); void ED_vgroup_delete(struct Object *ob, struct bDeformGroup *defgroup); -void ED_vgroup_select_by_name(struct Object *ob, char *name); +void ED_vgroup_select_by_name(struct Object *ob, const char *name); void ED_vgroup_data_create(struct ID *id); int ED_vgroup_give_array(struct ID *id, struct MDeformVert **dvert_arr, int *dvert_tot); int ED_vgroup_copy_array(struct Object *ob, struct Object *ob_from); diff --git a/source/blender/editors/include/ED_types.h b/source/blender/editors/include/ED_types.h index 1887a97e635..a0d1e0d65ec 100644 --- a/source/blender/editors/include/ED_types.h +++ b/source/blender/editors/include/ED_types.h @@ -40,8 +40,8 @@ #define YIC 20 /* proposal = put scene pointers on function calls? */ -#define BASACT (scene->basact) -#define OBACT (BASACT? BASACT->object: 0) +// #define BASACT (scene->basact) +// #define OBACT (BASACT? BASACT->object: NULL) diff --git a/source/blender/editors/include/ED_util.h b/source/blender/editors/include/ED_util.h index 1cbf1d0e998..473d889c731 100644 --- a/source/blender/editors/include/ED_util.h +++ b/source/blender/editors/include/ED_util.h @@ -28,12 +28,15 @@ #ifndef ED_UTIL_H #define ED_UTIL_H +struct Scene; struct Object; struct bContext; struct ARegion; struct uiBlock; struct wmOperator; struct wmOperatorType; +struct EditMesh; +struct Mesh; /* ed_util.c */ @@ -73,6 +76,15 @@ void undo_editmode_menu (struct bContext *C); void undo_editmode_clear (void); void undo_editmode_step (struct bContext *C, int step); +/* crazyspace.c */ +float *crazyspace_get_mapped_editverts(struct Scene *scene, struct Object *obedit); +void crazyspace_set_quats_editmesh(struct EditMesh *em, float *origcos, float *mappedcos, float *quats); +void crazyspace_set_quats_mesh(struct Mesh *me, float *origcos, float *mappedcos, float *quats); +int editmesh_get_first_deform_matrices(struct Scene *scene, struct Object *ob, struct EditMesh *em, float (**deformmats)[3][3], float (**deformcos)[3]); +int sculpt_get_first_deform_matrices(struct Scene *scene, struct Object *ob, float (**deformmats)[3][3], float (**deformcos)[3]); +void crazyspace_build_sculpt(struct Scene *scene, struct Object *ob, float (**deformmats)[3][3], float (**deformcos)[3]); + + /* ************** XXX OLD CRUFT WARNING ************* */ void apply_keyb_grid(int shift, int ctrl, float *val, float fac1, float fac2, float fac3, int invert); diff --git a/source/blender/editors/include/UI_interface.h b/source/blender/editors/include/UI_interface.h index b9ded28b613..76c9e765188 100644 --- a/source/blender/editors/include/UI_interface.h +++ b/source/blender/editors/include/UI_interface.h @@ -760,6 +760,10 @@ void uiStyleFontDrawRotated(struct uiFontStyle *fs, struct rcti *rect, const cha int UI_GetStringWidth(const char *str); // XXX temp void UI_DrawString(float x, float y, const char *str); // XXX temp +void UI_DrawTriIcon(float x, float y, char dir); + +/* linker workaround ack! */ +void UI_template_fix_linking(void); #endif /* UI_INTERFACE_H */ diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c index 52e9ae6894e..cb7c8c34f1c 100644 --- a/source/blender/editors/interface/interface.c +++ b/source/blender/editors/interface/interface.c @@ -80,17 +80,17 @@ static void ui_free_but(const bContext *C, uiBut *but); /* ************* translation ************** */ -int ui_translate_buttons() +int ui_translate_buttons(void) { return (U.transopts & USER_TR_BUTTONS); } -int ui_translate_menus() +int ui_translate_menus(void) { return (U.transopts & USER_TR_MENUS); } -int ui_translate_tooltips() +int ui_translate_tooltips(void) { return (U.transopts & USER_TR_TOOLTIPS); } @@ -660,11 +660,11 @@ static void ui_menu_block_set_keyaccels(uiBlock *block) } -void ui_menu_block_set_keymaps(const bContext *C, uiBlock *block) +static void ui_menu_block_set_keymaps(const bContext *C, uiBlock *block) { uiBut *but; IDProperty *prop; - char buf[512], *butstr; + char buf[512]; /* only do it before bounding */ if(block->minx != block->maxx) @@ -675,15 +675,10 @@ void ui_menu_block_set_keymaps(const bContext *C, uiBlock *block) prop= (but->opptr)? but->opptr->data: NULL; if(WM_key_event_operator_string(C, but->optype->idname, but->opcontext, prop, buf, sizeof(buf))) { - butstr= MEM_mallocN(strlen(but->str)+strlen(buf)+2, "menu_block_set_keymaps"); - strcpy(butstr, but->str); - strcat(butstr, "|"); - strcat(butstr, buf); - + char *butstr_orig= BLI_strdup(but->str); + BLI_snprintf(but->strdata, sizeof(but->strdata), "%s|%s", butstr_orig, buf); + MEM_freeN(butstr_orig); but->str= but->strdata; - BLI_strncpy(but->str, butstr, sizeof(but->strdata)); - MEM_freeN(butstr); - ui_check_but(but); } } @@ -924,7 +919,7 @@ static int uibut_contains_pt(uiBut *UNUSED(but), short *UNUSED(mval)) } -uiBut *ui_get_valid_link_button(uiBlock *block, uiBut *but, short *mval) +static uiBut *ui_get_valid_link_button(uiBlock *block, uiBut *but, short *mval) { uiBut *bt; @@ -2162,8 +2157,7 @@ void ui_check_but(uiBut *but) ui_get_but_string(but, str, UI_MAX_DRAW_STR-strlen(but->str)); - strcpy(but->drawstr, but->str); - strcat(but->drawstr, str); + BLI_snprintf(but->drawstr, sizeof(but->drawstr), "%s%s", but->str, str); } break; diff --git a/source/blender/editors/interface/interface_draw.c b/source/blender/editors/interface/interface_draw.c index 4ea0c01d15c..f16d633de6f 100644 --- a/source/blender/editors/interface/interface_draw.c +++ b/source/blender/editors/interface/interface_draw.c @@ -381,7 +381,7 @@ void uiRoundRect(float minx, float miny, float maxx, float maxy, float rad) } /* plain fake antialiased unfilled round rectangle */ -void uiRoundRectFakeAA(float minx, float miny, float maxx, float maxy, float rad, float asp) +static void uiRoundRectFakeAA(float minx, float miny, float maxx, float maxy, float rad, float asp) { float color[4], alpha; float raddiff; @@ -553,8 +553,6 @@ static void ui_draw_but_CHARTAB(uiBut *but) /* Set the font, in case it is not FO_BUILTIN_NAME font */ if(G.selfont && strcmp(G.selfont->name, FO_BUILTIN_NAME)) { - char tmpStr[256]; - // Is the font file packed, if so then use the packed file if(G.selfont->packedfile) { @@ -563,9 +561,10 @@ static void ui_draw_but_CHARTAB(uiBut *but) } else { + char tmpStr[256]; int err; - strcpy(tmpStr, G.selfont->name); + BLI_strncpy(tmpStr, G.selfont->name, sizeof(tmpStr)); BLI_path_abs(tmpStr, G.main->name); err = FTF_SetFont((unsigned char *)tmpStr, 0, 14.0); } @@ -716,7 +715,7 @@ static void draw_scope_end(rctf *rect, GLint *scissor) uiDrawBox(GL_LINE_LOOP, rect->xmin-1, rect->ymin, rect->xmax+1, rect->ymax+1, 3.0f); } -void histogram_draw_one(float r, float g, float b, float alpha, float x, float y, float w, float h, float *data, int res) +static void histogram_draw_one(float r, float g, float b, float alpha, float x, float y, float w, float h, float *data, int res) { int i; @@ -962,17 +961,17 @@ void ui_draw_but_WAVEFORM(ARegion *ar, uiBut *but, uiWidgetColors *UNUSED(wcol), draw_scope_end(&rect, scissor); } -float polar_to_x(float center, float diam, float ampli, float angle) +static float polar_to_x(float center, float diam, float ampli, float angle) { return center + diam * ampli * cosf(angle); } -float polar_to_y(float center, float diam, float ampli, float angle) +static float polar_to_y(float center, float diam, float ampli, float angle) { return center + diam * ampli * sinf(angle); } -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, float r, float g, float b) { float y,u,v; float tangle=0.f, tampli; diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c index b802098ff10..92b4e622d7e 100644 --- a/source/blender/editors/interface/interface_handlers.c +++ b/source/blender/editors/interface/interface_handlers.c @@ -3968,35 +3968,31 @@ static void but_shortcut_name_func(bContext *C, void *arg1, int UNUSED(event)) uiBut *but = (uiBut *)arg1; if (but->optype) { - char buf[512], *butstr, *cpoin; + char buf[512], *cpoin; IDProperty *prop= (but->opptr)? but->opptr->data: NULL; /* complex code to change name of button */ if(WM_key_event_operator_string(C, but->optype->idname, but->opcontext, prop, buf, sizeof(buf))) { wmKeyMap *km= NULL; + char *butstr_orig; - butstr= MEM_mallocN(strlen(but->str)+strlen(buf)+2, "menu_block_set_keymaps"); - // XXX but->str changed... should not, remove the hotkey from it cpoin= strchr(but->str, '|'); if(cpoin) *cpoin= 0; - - strcpy(butstr, but->str); - strcat(butstr, "|"); - strcat(butstr, buf); - + + butstr_orig= BLI_strdup(but->str); + BLI_snprintf(but->strdata, sizeof(but->strdata), "%s|%s", butstr_orig, buf); + MEM_freeN(butstr_orig); but->str= but->strdata; - BLI_strncpy(but->str, butstr, sizeof(but->strdata)); - MEM_freeN(butstr); - + ui_check_but(but); - + /* set the keymap editable else the key wont save */ WM_key_event_operator_id(C, but->optype->idname, but->opcontext, prop, 1, &km); WM_keymap_copy_to_user(km); - - } else { + } + else { /* shortcut was removed */ cpoin= strchr(but->str, '|'); if(cpoin) *cpoin= 0; @@ -4684,19 +4680,21 @@ static void button_timers_tooltip_remove(bContext *C, uiBut *but) uiHandleButtonData *data; data= but->active; + if(data) { - if(data->tooltiptimer) { - WM_event_remove_timer(data->wm, data->window, data->tooltiptimer); - data->tooltiptimer= NULL; - } - if(data->tooltip) { - ui_tooltip_free(C, data->tooltip); - data->tooltip= NULL; - } + if(data->tooltiptimer) { + WM_event_remove_timer(data->wm, data->window, data->tooltiptimer); + data->tooltiptimer= NULL; + } + if(data->tooltip) { + ui_tooltip_free(C, data->tooltip); + data->tooltip= NULL; + } - if(data->autoopentimer) { - WM_event_remove_timer(data->wm, data->window, data->autoopentimer); - data->autoopentimer= NULL; + if(data->autoopentimer) { + WM_event_remove_timer(data->wm, data->window, data->autoopentimer); + data->autoopentimer= NULL; + } } } @@ -5469,7 +5467,7 @@ static int ui_mouse_motion_towards_check(uiBlock *block, uiPopupBlockHandle *men return menu->dotowards; } -int ui_handle_menu_event(bContext *C, wmEvent *event, uiPopupBlockHandle *menu, int UNUSED(topmenu)) +static int ui_handle_menu_event(bContext *C, wmEvent *event, uiPopupBlockHandle *menu, int UNUSED(topmenu)) { ARegion *ar; uiBlock *block; diff --git a/source/blender/editors/interface/interface_icons.c b/source/blender/editors/interface/interface_icons.c index 788de41202d..5ea74cbf40a 100644 --- a/source/blender/editors/interface/interface_icons.c +++ b/source/blender/editors/interface/interface_icons.c @@ -614,7 +614,7 @@ static void init_iconfile_list(struct ListBase *list) /* since BLI_getdir changes the current working directory, restore it back to old value afterwards */ - if(!BLI_getwdN(olddir)) + if(!BLI_getwdN(olddir, sizeof(olddir))) restoredir = 0; totfile = BLI_getdir(icondirstr, &dir); if (restoredir && !chdir(olddir)) {} /* fix warning about checking return value */ @@ -705,7 +705,7 @@ ListBase *UI_iconfile_list(void) } -void UI_icons_free() +void UI_icons_free(void) { if(icongltex.id) { glDeleteTextures(1, &icongltex.id); diff --git a/source/blender/editors/interface/interface_intern.h b/source/blender/editors/interface/interface_intern.h index 7dde0a73d56..154a263cd7b 100644 --- a/source/blender/editors/interface/interface_intern.h +++ b/source/blender/editors/interface/interface_intern.h @@ -472,8 +472,8 @@ extern void ui_draw_but(const struct bContext *C, ARegion *ar, struct uiStyle *s struct ThemeUI; void ui_widget_color_init(struct ThemeUI *tui); -void ui_draw_menu_item(struct uiFontStyle *fstyle, rcti *rect, char *name, int iconid, int state); -void ui_draw_preview_item(struct uiFontStyle *fstyle, rcti *rect, char *name, int iconid, int state); +void ui_draw_menu_item(struct uiFontStyle *fstyle, rcti *rect, const char *name, int iconid, int state); +void ui_draw_preview_item(struct uiFontStyle *fstyle, rcti *rect, const char *name, int iconid, int state); /* interface_style.c */ void uiStyleInit(void); diff --git a/source/blender/editors/interface/interface_layout.c b/source/blender/editors/interface/interface_layout.c index 18bee084f40..330c81fbcb2 100644 --- a/source/blender/editors/interface/interface_layout.c +++ b/source/blender/editors/interface/interface_layout.c @@ -1114,7 +1114,7 @@ typedef struct CollItemSearch { int iconid; } CollItemSearch; -int sort_search_items_list(void *a, void *b) +static int sort_search_items_list(void *a, void *b) { CollItemSearch *cis1 = (CollItemSearch *)a; CollItemSearch *cis2 = (CollItemSearch *)b; @@ -2576,8 +2576,7 @@ void uiBlockLayoutResolve(uiBlock *block, int *x, int *y) /* XXX silly trick, interface_templates.c doesn't get linked * because it's not used by other files in this module? */ { - void ui_template_fix_linking(void); - ui_template_fix_linking(); + UI_template_fix_linking(); } } diff --git a/source/blender/editors/interface/interface_ops.c b/source/blender/editors/interface/interface_ops.c index 95c52d20c37..9734150ab5c 100644 --- a/source/blender/editors/interface/interface_ops.c +++ b/source/blender/editors/interface/interface_ops.c @@ -177,7 +177,7 @@ static int eyedropper_poll(bContext *C) else return 1; } -void UI_OT_eyedropper(wmOperatorType *ot) +static void UI_OT_eyedropper(wmOperatorType *ot) { /* identifiers */ ot->name= "Eyedropper"; @@ -207,7 +207,7 @@ static int reset_default_theme_exec(bContext *C, wmOperator *UNUSED(op)) return OPERATOR_FINISHED; } -void UI_OT_reset_default_theme(wmOperatorType *ot) +static void UI_OT_reset_default_theme(wmOperatorType *ot) { /* identifiers */ ot->name= "Reset to Default Theme"; @@ -247,7 +247,7 @@ static int copy_data_path_button_exec(bContext *C, wmOperator *UNUSED(op)) return (success)? OPERATOR_FINISHED: OPERATOR_CANCELLED; } -void UI_OT_copy_data_path_button(wmOperatorType *ot) +static void UI_OT_copy_data_path_button(wmOperatorType *ot) { /* identifiers */ ot->name= "Copy Data Path"; @@ -297,7 +297,7 @@ static int reset_default_button_exec(bContext *C, wmOperator *op) return (success)? OPERATOR_FINISHED: OPERATOR_CANCELLED; } -void UI_OT_reset_default_button(wmOperatorType *ot) +static void UI_OT_reset_default_button(wmOperatorType *ot) { /* identifiers */ ot->name= "Reset to Default Value"; @@ -389,7 +389,7 @@ static int copy_to_selected_button_exec(bContext *C, wmOperator *op) return (success)? OPERATOR_FINISHED: OPERATOR_CANCELLED; } -void UI_OT_copy_to_selected_button(wmOperatorType *ot) +static void UI_OT_copy_to_selected_button(wmOperatorType *ot) { /* identifiers */ ot->name= "Copy To Selected"; @@ -439,7 +439,7 @@ static int reports_to_text_exec(bContext *C, wmOperator *UNUSED(op)) return OPERATOR_FINISHED; } -void UI_OT_reports_to_textblock(wmOperatorType *ot) +static void UI_OT_reports_to_textblock(wmOperatorType *ot) { /* identifiers */ ot->name= "Reports to Text Block"; diff --git a/source/blender/editors/interface/interface_panel.c b/source/blender/editors/interface/interface_panel.c index db4af4c11e5..93b5305fd12 100644 --- a/source/blender/editors/interface/interface_panel.c +++ b/source/blender/editors/interface/interface_panel.c @@ -309,7 +309,7 @@ static void ui_offset_panel_block(uiBlock *block) /**************************** drawing *******************************/ /* extern used by previewrender */ -void uiPanelPush(uiBlock *block) +static void uiPanelPush(uiBlock *block) { glPushMatrix(); @@ -317,14 +317,14 @@ void uiPanelPush(uiBlock *block) glTranslatef((float)block->panel->ofsx, (float)block->panel->ofsy, 0.0); } -void uiPanelPop(uiBlock *UNUSED(block)) +static void uiPanelPop(uiBlock *UNUSED(block)) { glPopMatrix(); } /* triangle 'icon' for panel header */ /* NOTE - this seems to be only used for hiding nodes now */ -void ui_draw_tria_icon(float x, float y, char dir) +void UI_DrawTriIcon(float x, float y, char dir) { if(dir=='h') { ui_draw_anti_tria( x-3,y-5, x-3,y+5, x+7,y ); @@ -335,7 +335,7 @@ void ui_draw_tria_icon(float x, float y, char dir) } /* triangle 'icon' inside rect */ -void ui_draw_tria_rect(rctf *rect, char dir) +static void ui_draw_tria_rect(rctf *rect, char dir) { if(dir=='h') { float half= 0.5f*(rect->ymax - rect->ymin); @@ -347,7 +347,7 @@ void ui_draw_tria_rect(rctf *rect, char dir) } } -void ui_draw_anti_x(float x1, float y1, float x2, float y2) +static void ui_draw_anti_x(float x1, float y1, float x2, float y2) { /* set antialias line */ @@ -655,7 +655,7 @@ static int compare_panel(const void *a1, const void *a2) /* this doesnt draw */ /* returns 1 when it did something */ -int uiAlignPanelStep(ScrArea *sa, ARegion *ar, float fac, int drag) +static int uiAlignPanelStep(ScrArea *sa, ARegion *ar, float fac, int drag) { uiStyle *style= U.uistyles.first; Panel *pa; diff --git a/source/blender/editors/interface/interface_regions.c b/source/blender/editors/interface/interface_regions.c index e8a383dbe15..31523685527 100644 --- a/source/blender/editors/interface/interface_regions.c +++ b/source/blender/editors/interface/interface_regions.c @@ -130,7 +130,7 @@ static void menudata_add_item(MenuData *md, const char *str, int retval, int ico md->nitems++; } -void menudata_free(MenuData *md) +static void menudata_free(MenuData *md) { MEM_freeN(md->instr); if (md->items) @@ -151,7 +151,7 @@ void menudata_free(MenuData *md) * @param str String to be parsed. * @retval new menudata structure, free with menudata_free() */ -MenuData *decompose_menu_string(char *str) +static MenuData *decompose_menu_string(char *str) { char *instr= BLI_strdup(str); MenuData *md= menudata_new(instr); @@ -272,7 +272,7 @@ int ui_step_name_menu(uiBut *but, int step) /******************** Creating Temporary regions ******************/ -ARegion *ui_add_temporary_region(bScreen *sc) +static ARegion *ui_add_temporary_region(bScreen *sc) { ARegion *ar; @@ -285,7 +285,7 @@ ARegion *ui_add_temporary_region(bScreen *sc) return ar; } -void ui_remove_temporary_region(bContext *C, bScreen *sc, ARegion *ar) +static void ui_remove_temporary_region(bContext *C, bScreen *sc, ARegion *ar) { if(CTX_wm_window(C)) wm_draw_region_clear(CTX_wm_window(C), ar); @@ -1620,7 +1620,7 @@ void ui_set_but_hsv(uiBut *but) } /* also used by small picker, be careful with name checks below... */ -void ui_update_block_buts_rgb(uiBlock *block, float *rgb) +static void ui_update_block_buts_rgb(uiBlock *block, float *rgb) { uiBut *bt; float *hsv= ui_block_hsv_get(block); @@ -2295,7 +2295,8 @@ static void vconfirm_opname(bContext *C, const char *opname, const char *title, s= buf; if (title) s+= sprintf(s, "%s%%t|", title); - vsprintf(s, itemfmt, ap); + vsnprintf(s, sizeof(buf) - (s - buf), itemfmt, ap); + buf[sizeof(buf) - 1]= '\0'; handle= ui_popup_menu_create(C, NULL, NULL, NULL, NULL, buf); diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c index 5e6847cf00d..b27f041ef30 100644 --- a/source/blender/editors/interface/interface_templates.c +++ b/source/blender/editors/interface/interface_templates.c @@ -59,7 +59,7 @@ #include "BLF_api.h" -void ui_template_fix_linking(void) +void UI_template_fix_linking(void) { } @@ -876,7 +876,7 @@ uiLayout *uiTemplateModifier(uiLayout *layout, bContext *C, PointerRNA *ptr) #define REMAKEIPO 8 #define B_DIFF 9 -void do_constraint_panels(bContext *C, void *ob_pt, int event) +static void do_constraint_panels(bContext *C, void *ob_pt, int event) { Main *bmain= CTX_data_main(C); Scene *scene= CTX_data_scene(C); diff --git a/source/blender/editors/interface/interface_widgets.c b/source/blender/editors/interface/interface_widgets.c index b62108136be..e3c465dd4c8 100644 --- a/source/blender/editors/interface/interface_widgets.c +++ b/source/blender/editors/interface/interface_widgets.c @@ -1698,7 +1698,7 @@ void ui_hsvcircle_vals_from_pos(float *valrad, float *valdist, rcti *rect, float *valrad= atan2(mx, my)/(2.0f*M_PI) + 0.5f; } -void ui_draw_but_HSVCIRCLE(uiBut *but, uiWidgetColors *wcol, rcti *rect) +static void ui_draw_but_HSVCIRCLE(uiBut *but, uiWidgetColors *wcol, rcti *rect) { /* gouraud triangle fan */ float radstep, ang= 0.0f; @@ -3080,7 +3080,7 @@ void ui_draw_search_back(uiStyle *UNUSED(style), uiBlock *block, rcti *rect) /* helper call to draw a menu item without button */ /* state: UI_ACTIVE or 0 */ -void ui_draw_menu_item(uiFontStyle *fstyle, rcti *rect, char *name, int iconid, int state) +void ui_draw_menu_item(uiFontStyle *fstyle, rcti *rect, const char *name, int iconid, int state) { uiWidgetType *wt= widget_type(UI_WTYPE_MENU_ITEM); rcti _rect= *rect; @@ -3126,7 +3126,7 @@ void ui_draw_menu_item(uiFontStyle *fstyle, rcti *rect, char *name, int iconid, } } -void ui_draw_preview_item(uiFontStyle *fstyle, rcti *rect, char *name, int iconid, int state) +void ui_draw_preview_item(uiFontStyle *fstyle, rcti *rect, const char *name, int iconid, int state) { rcti trect = *rect; diff --git a/source/blender/editors/interface/resources.c b/source/blender/editors/interface/resources.c index 52e9a395c4e..9ab45ae648b 100644 --- a/source/blender/editors/interface/resources.c +++ b/source/blender/editors/interface/resources.c @@ -1004,10 +1004,8 @@ void init_userdef_do_versions(void) U.tb_rightmouse= 5; } if(U.mixbufsize==0) U.mixbufsize= 2048; - if (BLI_streq(U.tempdir, "/")) { - char *tmp= getenv("TEMP"); - - strcpy(U.tempdir, tmp?tmp:"/tmp/"); + if (strcmp(U.tempdir, "/") == 0) { + BLI_where_is_temp(U.tempdir, sizeof(U.tempdir), FALSE); } if (U.autokey_mode == 0) { /* 'add/replace' but not on */ diff --git a/source/blender/editors/interface/view2d_ops.c b/source/blender/editors/interface/view2d_ops.c index fcc72cba321..92e0d0011f4 100644 --- a/source/blender/editors/interface/view2d_ops.c +++ b/source/blender/editors/interface/view2d_ops.c @@ -280,7 +280,7 @@ static int view_pan_cancel(bContext *UNUSED(C), wmOperator *op) return OPERATOR_CANCELLED; } -void VIEW2D_OT_pan(wmOperatorType *ot) +static void VIEW2D_OT_pan(wmOperatorType *ot) { /* identifiers */ ot->name= "Pan View"; @@ -330,7 +330,7 @@ static int view_scrollright_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -void VIEW2D_OT_scroll_right(wmOperatorType *ot) +static void VIEW2D_OT_scroll_right(wmOperatorType *ot) { /* identifiers */ ot->name= "Scroll Right"; @@ -374,7 +374,7 @@ static int view_scrollleft_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -void VIEW2D_OT_scroll_left(wmOperatorType *ot) +static void VIEW2D_OT_scroll_left(wmOperatorType *ot) { /* identifiers */ ot->name= "Scroll Left"; @@ -422,7 +422,7 @@ static int view_scrolldown_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -void VIEW2D_OT_scroll_down(wmOperatorType *ot) +static void VIEW2D_OT_scroll_down(wmOperatorType *ot) { /* identifiers */ ot->name= "Scroll Down"; @@ -472,7 +472,7 @@ static int view_scrollup_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -void VIEW2D_OT_scroll_up(wmOperatorType *ot) +static void VIEW2D_OT_scroll_up(wmOperatorType *ot) { /* identifiers */ ot->name= "Scroll Up"; @@ -699,7 +699,7 @@ static int view_zoomin_invoke(bContext *C, wmOperator *op, wmEvent *event) return view_zoomin_exec(C, op); } -void VIEW2D_OT_zoom_in(wmOperatorType *ot) +static void VIEW2D_OT_zoom_in(wmOperatorType *ot) { /* identifiers */ ot->name= "Zoom In"; @@ -756,7 +756,7 @@ static int view_zoomout_invoke(bContext *C, wmOperator *op, wmEvent *event) return view_zoomout_exec(C, op); } -void VIEW2D_OT_zoom_out(wmOperatorType *ot) +static void VIEW2D_OT_zoom_out(wmOperatorType *ot) { /* identifiers */ ot->name= "Zoom Out"; @@ -1040,7 +1040,7 @@ static int view_zoomdrag_modal(bContext *C, wmOperator *op, wmEvent *event) return OPERATOR_RUNNING_MODAL; } -void VIEW2D_OT_zoom(wmOperatorType *ot) +static void VIEW2D_OT_zoom(wmOperatorType *ot) { /* identifiers */ ot->name= "Zoom View"; @@ -1140,7 +1140,7 @@ static int view_borderzoom_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -void VIEW2D_OT_zoom_border(wmOperatorType *ot) +static void VIEW2D_OT_zoom_border(wmOperatorType *ot) { /* identifiers */ ot->name= "Zoom to Border"; @@ -1537,7 +1537,7 @@ static int scroller_activate_invoke(bContext *C, wmOperator *op, wmEvent *event) } /* LMB-Drag in Scrollers - not repeatable operator! */ -void VIEW2D_OT_scroller_activate(wmOperatorType *ot) +static void VIEW2D_OT_scroller_activate(wmOperatorType *ot) { /* identifiers */ ot->name= "Scroller Activate"; @@ -1603,7 +1603,7 @@ static int reset_exec(bContext *C, wmOperator *UNUSED(op)) return OPERATOR_FINISHED; } -void VIEW2D_OT_reset(wmOperatorType *ot) +static void VIEW2D_OT_reset(wmOperatorType *ot) { /* identifiers */ ot->name= "Reset View"; diff --git a/source/blender/editors/mesh/editmesh.c b/source/blender/editors/mesh/editmesh.c index d1efb60b618..9376a21b23d 100644 --- a/source/blender/editors/mesh/editmesh.c +++ b/source/blender/editors/mesh/editmesh.c @@ -989,8 +989,6 @@ void load_editMesh(Scene *scene, Object *obedit) while(eve) { VECCOPY(mvert->co, eve->co); - mvert->mat_nr= 32767; /* what was this for, halos? */ - /* vertex normal */ VECCOPY(nor, eve->no); mul_v3_fl(nor, 32767.0); @@ -1063,20 +1061,6 @@ void load_editMesh(Scene *scene, Object *obedit) if(efa->f & 1) mface->flag |= ME_FACE_SEL; else mface->flag &= ~ME_FACE_SEL; } - - /* mat_nr in vertex */ - if(me->totcol>1) { - mvert= me->mvert+mface->v1; - if(mvert->mat_nr == (char)32767) mvert->mat_nr= mface->mat_nr; - mvert= me->mvert+mface->v2; - if(mvert->mat_nr == (char)32767) mvert->mat_nr= mface->mat_nr; - mvert= me->mvert+mface->v3; - if(mvert->mat_nr == (char)32767) mvert->mat_nr= mface->mat_nr; - if(mface->v4) { - mvert= me->mvert+mface->v4; - if(mvert->mat_nr == (char)32767) mvert->mat_nr= mface->mat_nr; - } - } /* watch: efa->e1->f2==0 means loose edge */ @@ -1197,7 +1181,9 @@ void load_editMesh(Scene *scene, Object *obedit) eve= em->verts.first; mvert = me->mvert; while(eve) { - VECSUB(ofs[i], mvert->co, oldverts[eve->keyindex].co); + if(eve->keyindex>=0) + VECSUB(ofs[i], mvert->co, oldverts[eve->keyindex].co); + eve= eve->next; i++; mvert++; diff --git a/source/blender/editors/mesh/editmesh_loop.c b/source/blender/editors/mesh/editmesh_loop.c index 4ffd458d66c..451c341817b 100644 --- a/source/blender/editors/mesh/editmesh_loop.c +++ b/source/blender/editors/mesh/editmesh_loop.c @@ -220,9 +220,8 @@ void CutEdgeloop(Object *obedit, wmOperator *op, EditMesh *em, int numcuts) dist= 50; nearest = findnearestedge(&vc, &dist); // returns actual distance in dist // scrarea_do_windraw(curarea); // after findnearestedge, backbuf! - - sprintf(msg,"Number of Cuts: %d (S)mooth: ",numcuts); - strcat(msg, smooth ? "on":"off"); + + BLI_snprintf(msg, sizeof(msg),"Number of Cuts: %d (S)mooth: %s", numcuts, smooth ? "on":"off"); // headerprint(msg); /* Need to figure preview */ diff --git a/source/blender/editors/mesh/editmesh_mods.c b/source/blender/editors/mesh/editmesh_mods.c index 6488dc17fb4..64bd9695ac9 100644 --- a/source/blender/editors/mesh/editmesh_mods.c +++ b/source/blender/editors/mesh/editmesh_mods.c @@ -4435,6 +4435,7 @@ static int mesh_noise_exec(bContext *C, wmOperator *op) ma= give_current_material(obedit, obedit->actcol); if(ma==0 || ma->mtex[0]==0 || ma->mtex[0]->tex==0) { + BKE_report(op->reports, RPT_WARNING, "Mesh has no material or texture assigned."); return OPERATOR_FINISHED; } tex= give_current_material_texture(ma); diff --git a/source/blender/editors/mesh/editmesh_tools.c b/source/blender/editors/mesh/editmesh_tools.c index 9e6f8f7f078..090a9aa358f 100644 --- a/source/blender/editors/mesh/editmesh_tools.c +++ b/source/blender/editors/mesh/editmesh_tools.c @@ -5984,7 +5984,6 @@ static int select_vertex_path_exec(bContext *C, wmOperator *op) EditMesh *em= BKE_mesh_get_editmesh((Mesh *)obedit->data); EditVert *eve, *s, *t; EditEdge *eed; - EditSelection *ese; PathEdge *newpe, *currpe; PathNode *currpn; PathNode *Q; @@ -5995,17 +5994,24 @@ static int select_vertex_path_exec(bContext *C, wmOperator *op) Heap *heap; /*binary heap for sorting pointers to PathNodes based upon a 'cost'*/ s = t = NULL; + for(eve=em->verts.first; eve; eve=eve->next) { + if(eve->f&SELECT) { + if(s == NULL) s= eve; + else if(t == NULL) t= eve; + else { + /* more than two vertices are selected, + show warning message and cancel operator */ + s = t = NULL; + break; + } - ese = ((EditSelection*)em->selected.last); - if(ese && ese->type == EDITVERT && ese->prev && ese->prev->type == EDITVERT) { - t = (EditVert*)ese->data; - s = (EditVert*)ese->prev->data; + } /*need to find out if t is actually reachable by s....*/ - for(eve=em->verts.first; eve; eve=eve->next){ - eve->f1 = 0; - } + eve->f1 = 0; + } + if(s != NULL && t != NULL) { s->f1 = 1; unbalanced = 1; diff --git a/source/blender/editors/mesh/mesh_data.c b/source/blender/editors/mesh/mesh_data.c index 5f03edb38a2..cfd1b006ece 100644 --- a/source/blender/editors/mesh/mesh_data.c +++ b/source/blender/editors/mesh/mesh_data.c @@ -546,77 +546,10 @@ void MESH_OT_sticky_remove(wmOperatorType *ot) /************************** Add Geometry Layers *************************/ -static void mesh_calc_edges(Mesh *mesh, int update) -{ - CustomData edata; - EdgeHashIterator *ehi; - MFace *mf = mesh->mface; - MEdge *med, *med_orig; - EdgeHash *eh = BLI_edgehash_new(); - int i, totedge, totface = mesh->totface; - - if(mesh->totedge==0) - update= 0; - - if(update) { - /* assume existing edges are valid - * useful when adding more faces and generating edges from them */ - med= mesh->medge; - for(i= 0; i<mesh->totedge; i++, med++) - BLI_edgehash_insert(eh, med->v1, med->v2, med); - } - - for (i = 0; i < totface; i++, mf++) { - if (!BLI_edgehash_haskey(eh, mf->v1, mf->v2)) - BLI_edgehash_insert(eh, mf->v1, mf->v2, NULL); - if (!BLI_edgehash_haskey(eh, mf->v2, mf->v3)) - BLI_edgehash_insert(eh, mf->v2, mf->v3, NULL); - - if (mf->v4) { - if (!BLI_edgehash_haskey(eh, mf->v3, mf->v4)) - BLI_edgehash_insert(eh, mf->v3, mf->v4, NULL); - if (!BLI_edgehash_haskey(eh, mf->v4, mf->v1)) - BLI_edgehash_insert(eh, mf->v4, mf->v1, NULL); - } else { - if (!BLI_edgehash_haskey(eh, mf->v3, mf->v1)) - BLI_edgehash_insert(eh, mf->v3, mf->v1, NULL); - } - } - - totedge = BLI_edgehash_size(eh); - - /* write new edges into a temporary CustomData */ - memset(&edata, 0, sizeof(edata)); - CustomData_add_layer(&edata, CD_MEDGE, CD_CALLOC, NULL, totedge); - - ehi = BLI_edgehashIterator_new(eh); - med = CustomData_get_layer(&edata, CD_MEDGE); - for(i = 0; !BLI_edgehashIterator_isDone(ehi); - BLI_edgehashIterator_step(ehi), ++i, ++med) { - - if(update && (med_orig=BLI_edgehashIterator_getValue(ehi))) { - *med= *med_orig; /* copy from the original */ - } else { - BLI_edgehashIterator_getKey(ehi, (int*)&med->v1, (int*)&med->v2); - med->flag = ME_EDGEDRAW|ME_EDGERENDER|SELECT; /* select for newly created meshes which are selected [#25595] */ - } - } - BLI_edgehashIterator_free(ehi); - - /* free old CustomData and assign new one */ - CustomData_free(&mesh->edata, mesh->totedge); - mesh->edata = edata; - mesh->totedge = totedge; - - mesh->medge = CustomData_get_layer(&mesh->edata, CD_MEDGE); - - BLI_edgehash_free(eh, NULL); -} - void ED_mesh_update(Mesh *mesh, bContext *C, int calc_edges) { if(calc_edges || (mesh->totface && mesh->totedge == 0)) - mesh_calc_edges(mesh, calc_edges); + BKE_mesh_calc_edges(mesh, calc_edges); mesh_calc_normals(mesh->mvert, mesh->totvert, mesh->mface, mesh->totface, NULL); diff --git a/source/blender/editors/object/object_add.c b/source/blender/editors/object/object_add.c index eee17bc78ef..08a31923cda 100644 --- a/source/blender/editors/object/object_add.c +++ b/source/blender/editors/object/object_add.c @@ -404,6 +404,8 @@ static Object *effector_add_type(bContext *C, wmOperator *op, int type) ob->pd= object_add_collision_fields(type); + DAG_scene_sort(CTX_data_main(C), CTX_data_scene(C)); + return ob; } @@ -1114,6 +1116,15 @@ static int convert_exec(bContext *C, wmOperator *op) base->flag &= ~SELECT; ob->flag &= ~SELECT; } + + /* obdata already modified */ + if(!IS_TAGGED(ob->data)) { + /* When 2 objects with linked data are selected, converting both + * would keep modifiers on all but the converted object [#26003] */ + if(ob->type == OB_MESH) { + object_free_modifiers(ob); /* after derivedmesh calls! */ + } + } } else if (ob->type==OB_MESH && target == OB_CURVE) { ob->flag |= OB_DONE; diff --git a/source/blender/editors/object/object_constraint.c b/source/blender/editors/object/object_constraint.c index f695f112bc0..f3346bf200c 100644 --- a/source/blender/editors/object/object_constraint.c +++ b/source/blender/editors/object/object_constraint.c @@ -405,11 +405,26 @@ static void test_constraints (Object *owner, bPoseChannel *pchan) for (ct= targets.first; ct; ct= ct->next) { /* general validity checks (for those constraints that need this) */ if (exist_object(ct->tar) == 0) { + /* object doesn't exist, but constraint requires target */ ct->tar = NULL; curcon->flag |= CONSTRAINT_DISABLE; } else if (ct->tar == owner) { - if (!get_named_bone(get_armature(owner), ct->subtarget)) { + if (type == CONSTRAINT_OBTYPE_BONE) { + if (!get_named_bone(get_armature(owner), ct->subtarget)) { + /* bone must exist in armature... */ + // TODO: clear subtarget? + curcon->flag |= CONSTRAINT_DISABLE; + } + else if (strcmp(pchan->name, ct->subtarget) == 0) { + /* cannot target self */ + ct->subtarget[0] = '\0'; + curcon->flag |= CONSTRAINT_DISABLE; + } + } + else { + /* cannot use self as target */ + ct->tar = NULL; curcon->flag |= CONSTRAINT_DISABLE; } } @@ -1257,12 +1272,12 @@ static int constraint_add_exec(bContext *C, wmOperator *op, Object *ob, ListBase bPoseChannel *pchan; bConstraint *con; - if(list == &ob->constraints) { + if (list == &ob->constraints) { pchan= NULL; } else { pchan= get_active_posechannel(ob); - + /* ensure not to confuse object/pose adding */ if (pchan == NULL) { BKE_report(op->reports, RPT_ERROR, "No active pose bone to add a constraint to."); @@ -1312,19 +1327,7 @@ static int constraint_add_exec(bContext *C, wmOperator *op, Object *ob, ListBase } /* do type-specific tweaking to the constraint settings */ - // TODO: does action constraint need anything here - i.e. spaceonce? switch (type) { - case CONSTRAINT_TYPE_CHILDOF: - { - /* if this constraint is being added to a posechannel, make sure - * the constraint gets evaluated in pose-space */ - if (pchan) { - con->ownspace = CONSTRAINT_SPACE_POSE; - con->flag |= CONSTRAINT_SPACEONCE; - } - } - break; - case CONSTRAINT_TYPE_PYTHON: // FIXME: this code is not really valid anymore { #ifdef WITH_PYTHON diff --git a/source/blender/editors/object/object_edit.c b/source/blender/editors/object/object_edit.c index 0acdc8b61fe..bb83827b2cb 100644 --- a/source/blender/editors/object/object_edit.c +++ b/source/blender/editors/object/object_edit.c @@ -587,7 +587,7 @@ void OBJECT_OT_posemode_toggle(wmOperatorType *ot) ot->poll= ED_operator_object_active_editable; /* flag */ - ot->flag= OPTYPE_REGISTER; + ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; } /* *********************** */ @@ -744,9 +744,9 @@ void special_editmenu(Scene *scene, View3D *v3d) MTFace *tface; MFace *mface; int a; - - if(me==0 || me->mtface==0) return; - + + if(me==NULL || me->mtface==NULL) return; + nr= pupmenu("Specials%t|Set Tex%x1| Shared%x2| Light%x3| Invisible%x4| Collision%x5| TwoSide%x6|Clr Tex%x7| Shared%x8| Light%x9| Invisible%x10| Collision%x11| TwoSide%x12"); tface= me->mtface; @@ -768,7 +768,7 @@ void special_editmenu(Scene *scene, View3D *v3d) tface->mode |= TF_TWOSIDE; break; case 7: tface->mode &= ~TF_TEX; - tface->tpage= 0; + tface->tpage= NULL; break; case 8: tface->mode &= ~TF_SHAREDCOL; break; @@ -788,7 +788,7 @@ void special_editmenu(Scene *scene, View3D *v3d) else if(ob->mode & OB_MODE_VERTEX_PAINT) { Mesh *me= get_mesh(ob); - if(me==0 || (me->mcol==NULL && me->mtface==NULL) ) return; + if(me==NULL || (me->mcol==NULL && me->mtface==NULL) ) return; nr= pupmenu("Specials%t|Shared VertexCol%x1"); if(nr==1) { diff --git a/source/blender/editors/object/object_relations.c b/source/blender/editors/object/object_relations.c index b2edd786d50..0f8e5cec21b 100644 --- a/source/blender/editors/object/object_relations.c +++ b/source/blender/editors/object/object_relations.c @@ -1377,6 +1377,11 @@ void single_object_users(Scene *scene, View3D *v3d, int flag) for(base= FIRSTBASE; base; base= base->next) { ob= base->object; + /* newid may still have some trash from Outliner tree building, + * so clear that first to avoid errors [#26002] + */ + ob->id.newid = NULL; + if( (base->flag & flag)==flag ) { if(ob->id.lib==NULL && ob->id.us>1) { /* base gets copy of object */ diff --git a/source/blender/editors/object/object_transform.c b/source/blender/editors/object/object_transform.c index 024e3e8a020..355f1c153cf 100644 --- a/source/blender/editors/object/object_transform.c +++ b/source/blender/editors/object/object_transform.c @@ -744,7 +744,9 @@ static int object_origin_set_exec(bContext *C, wmOperator *op) total++; add_v3_v3(cent, eve->co); } - mul_v3_fl(cent, 1.0f/(float)total); + if(total) { + mul_v3_fl(cent, 1.0f/(float)total); + } } else { for(eve= em->verts.first; eve; eve= eve->next) { @@ -753,13 +755,15 @@ static int object_origin_set_exec(bContext *C, wmOperator *op) mid_v3_v3v3(cent, min, max); } - for(eve= em->verts.first; eve; eve= eve->next) { - sub_v3_v3(eve->co, cent); - } + if(!is_zero_v3(cent)) { + for(eve= em->verts.first; eve; eve= eve->next) { + sub_v3_v3(eve->co, cent); + } - recalc_editnormals(em); - tot_change++; - DAG_id_tag_update(&obedit->id, OB_RECALC_DATA); + recalc_editnormals(em); + tot_change++; + DAG_id_tag_update(&obedit->id, OB_RECALC_DATA); + } BKE_mesh_end_editmesh(me, em); } } diff --git a/source/blender/editors/object/object_vgroup.c b/source/blender/editors/object/object_vgroup.c index bd7983004eb..c673ea0fd2d 100644 --- a/source/blender/editors/object/object_vgroup.c +++ b/source/blender/editors/object/object_vgroup.c @@ -550,7 +550,7 @@ float ED_vgroup_vert_weight(Object *ob, bDeformGroup *dg, int vertnum) return get_vert_def_nr(ob, def_nr, vertnum); } -void ED_vgroup_select_by_name(Object *ob, char *name) +void ED_vgroup_select_by_name(Object *ob, const char *name) { /* note: ob->actdef==0 signals on painting to create a new one, if a bone in posemode is selected */ ob->actdef= defgroup_name_index(ob, name) + 1; } diff --git a/source/blender/editors/physics/physics_fluid.c b/source/blender/editors/physics/physics_fluid.c index 4e08dd49703..608c0f70c3e 100644 --- a/source/blender/editors/physics/physics_fluid.c +++ b/source/blender/editors/physics/physics_fluid.c @@ -641,10 +641,10 @@ static int fluid_init_filepaths(Object *fsDomain, char *targetDir, char *targetF strncpy(targetDir, domainSettings->surfdataPath, FILE_MAXDIR); strncpy(newSurfdataPath, domainSettings->surfdataPath, FILE_MAXDIR); BLI_path_abs(targetDir, G.main->name); // fixed #frame-no - - strcpy(targetFile, targetDir); - strcat(targetFile, suffixConfig); - strcat(targetFile,".tmp"); // dont overwrite/delete original file + + // .tmp: dont overwrite/delete original file + BLI_snprintf(targetFile, sizeof(targetFile), "%s%s.tmp", targetDir, suffixConfig); + // make sure all directories exist // as the bobjs use the same dir, this only needs to be checked // for the cfg output @@ -664,19 +664,13 @@ static int fluid_init_filepaths(Object *fsDomain, char *targetDir, char *targetF char blendFile[FILE_MAXDIR+FILE_MAXFILE]; // invalid dir, reset to current/previous - strcpy(blendDir, G.main->name); + BLI_strncpy(blendDir, G.main->name, sizeof(blendDir)); BLI_splitdirstring(blendDir, blendFile); - if(BLI_strnlen(blendFile, 7) > 6){ - int len = strlen(blendFile); - if( (blendFile[len-6]=='.')&& (blendFile[len-5]=='b')&& (blendFile[len-4]=='l')&& - (blendFile[len-3]=='e')&& (blendFile[len-2]=='n')&& (blendFile[len-1]=='d') ){ - blendFile[len-6] = '\0'; - } - } - // todo... strip .blend ? - snprintf(newSurfdataPath,FILE_MAXFILE+FILE_MAXDIR,"//fluidsimdata/%s_%s_", blendFile, fsDomain->id.name); + BLI_replace_extension(blendFile, sizeof(blendFile), ""); /* strip .blend */ + + BLI_snprintf(newSurfdataPath, sizeof(newSurfdataPath) ,"//fluidsimdata/%s_%s_", blendFile, fsDomain->id.name); - snprintf(debugStrBuffer,256,"fluidsimBake::error - warning resetting output dir to '%s'\n", newSurfdataPath); + BLI_snprintf(debugStrBuffer, sizeof(debugStrBuffer), "fluidsimBake::error - warning resetting output dir to '%s'\n", newSurfdataPath); elbeemDebugOut(debugStrBuffer); outStringsChanged=1; } @@ -686,14 +680,14 @@ static int fluid_init_filepaths(Object *fsDomain, char *targetDir, char *targetF if(outStringsChanged) { char dispmsg[FILE_MAXDIR+FILE_MAXFILE+256]; int selection=0; - strcpy(dispmsg,"Output settings set to: '"); + BLI_strncpy(dispmsg,"Output settings set to: '", sizeof(dispmsg)); strcat(dispmsg, newSurfdataPath); strcat(dispmsg, "'%t|Continue with changed settings%x1|Discard and abort%x0"); // ask user if thats what he/she wants... selection = pupmenu(dispmsg); if(selection<1) return 0; // 0 from menu, or -1 aborted - strcpy(targetDir, newSurfdataPath); + BLI_strncpy(targetDir, newSurfdataPath, sizeof(targetDir)); strncpy(domainSettings->surfdataPath, newSurfdataPath, FILE_MAXDIR); BLI_path_abs(targetDir, G.main->name); // fixed #frame-no } @@ -957,9 +951,8 @@ int fluidsimBake(bContext *C, ReportList *reports, Object *fsDomain) } /* ******** start writing / exporting ******** */ - strcpy(targetFile, targetDir); - strcat(targetFile, suffixConfig); - strcat(targetFile,".tmp"); // dont overwrite/delete original file + // use .tmp, dont overwrite/delete original file + BLI_snprintf(targetFile, sizeof(targetFile), "%s%s.tmp", targetDir, suffixConfig); // make sure these directories exist as well if(outStringsChanged) { @@ -987,8 +980,8 @@ int fluidsimBake(bContext *C, ReportList *reports, Object *fsDomain) fsset->aniFrameTime = channels->aniFrameTime; fsset->noOfFrames = noFrames; // is otherwise subtracted in parser - strcpy(targetFile, targetDir); - strcat(targetFile, suffixSurface); + BLI_snprintf(targetFile, sizeof(targetFile), "%s%s", targetDir, suffixSurface); + // defaults for compressibility and adaptive grids fsset->gstar = domainSettings->gstar; fsset->maxRefine = domainSettings->maxRefine; // check <-> gridlevels @@ -997,7 +990,7 @@ int fluidsimBake(bContext *C, ReportList *reports, Object *fsDomain) fsset->surfaceSmoothing = domainSettings->surfaceSmoothing; fsset->surfaceSubdivs = domainSettings->surfaceSubdivs; fsset->farFieldSize = domainSettings->farFieldSize; - strcpy( fsset->outputPath, targetFile); + BLI_strncpy(fsset->outputPath, targetFile, sizeof(fsset->outputPath)); // domain channels fsset->channelSizeFrameTime = diff --git a/source/blender/editors/render/render_internal.c b/source/blender/editors/render/render_internal.c index 96994ab1df4..341f56667fa 100644 --- a/source/blender/editors/render/render_internal.c +++ b/source/blender/editors/render/render_internal.c @@ -594,7 +594,14 @@ static void render_endjob(void *rjv) free_main(rj->main); /* else the frame will not update for the original value */ - ED_update_for_newframe(G.main, rj->scene, rj->win->screen, 1); + if(!(rj->scene->r.scemode & R_NO_FRAME_UPDATE)) + ED_update_for_newframe(G.main, rj->scene, rj->win->screen, 1); + + /* XXX above function sets all tags in nodes */ + ntreeClearTags(rj->scene->nodetree); + + /* potentially set by caller */ + rj->scene->r.scemode &= ~R_NO_FRAME_UPDATE; if(rj->srl) { NodeTagIDChanged(rj->scene->nodetree, &rj->scene->id); @@ -648,6 +655,7 @@ static int screen_render_invoke(bContext *C, wmOperator *op, wmEvent *event) wmJob *steve; RenderJob *rj; Image *ima; + int jobflag; const short is_animation= RNA_boolean_get(op->ptr, "animation"); const short is_write_still= RNA_boolean_get(op->ptr, "write_still"); @@ -701,6 +709,8 @@ static int screen_render_invoke(bContext *C, wmOperator *op, wmEvent *event) /* ensure at least 1 area shows result */ screen_set_image_output(C, event->x, event->y); + jobflag= WM_JOB_EXCL_RENDER|WM_JOB_PRIORITY|WM_JOB_PROGRESS; + /* single layer re-render */ if(RNA_property_is_set(op->ptr, "layer")) { SceneRenderLayer *rl; @@ -712,11 +722,12 @@ static int screen_render_invoke(bContext *C, wmOperator *op, wmEvent *event) scn = (Scene *)BLI_findstring(&mainp->scene, scene_name, offsetof(ID, name) + 2); rl = (SceneRenderLayer *)BLI_findstring(&scene->r.layers, rl_name, offsetof(SceneRenderLayer, name)); - + if (scn && rl) { scene = scn; srl = rl; } + jobflag |= WM_JOB_SUSPEND; } /* job custom data */ @@ -733,7 +744,7 @@ static int screen_render_invoke(bContext *C, wmOperator *op, wmEvent *event) rj->reports= op->reports; /* setup job */ - steve= WM_jobs_get(CTX_wm_manager(C), CTX_wm_window(C), scene, "Render", WM_JOB_EXCL_RENDER|WM_JOB_PRIORITY|WM_JOB_PROGRESS); + steve= WM_jobs_get(CTX_wm_manager(C), CTX_wm_window(C), scene, "Render", jobflag); WM_jobs_customdata(steve, rj, render_freejob); WM_jobs_timer(steve, 0.2, NC_SCENE|ND_RENDER_RESULT, 0); WM_jobs_callbacks(steve, render_startjob, NULL, NULL, render_endjob); diff --git a/source/blender/editors/render/render_shading.c b/source/blender/editors/render/render_shading.c index 5126ba27de8..852f006aa9a 100644 --- a/source/blender/editors/render/render_shading.c +++ b/source/blender/editors/render/render_shading.c @@ -34,6 +34,7 @@ #include "DNA_material_types.h" #include "DNA_node_types.h" #include "DNA_object_types.h" +#include "DNA_particle_types.h" #include "DNA_scene_types.h" #include "DNA_space_types.h" #include "DNA_world_types.h" @@ -1254,6 +1255,7 @@ static int texture_slot_move(bContext *C, wmOperator *op) } } + DAG_id_tag_update(id, 0); WM_event_add_notifier(C, NC_TEXTURE, CTX_data_scene(C)); } @@ -1572,6 +1574,9 @@ void copy_mtex_copybuf(ID *id) mtex= &(((World *)id)->mtex[(int)((World *)id)->texact]); // mtex= wrld->mtex[(int)wrld->texact]; // TODO break; + case ID_PA: + mtex= &(((ParticleSettings *)id)->mtex[(int)((ParticleSettings *)id)->texact]); + break; } if(mtex && *mtex) { @@ -1602,6 +1607,9 @@ void paste_mtex_copybuf(ID *id) mtex= &(((World *)id)->mtex[(int)((World *)id)->texact]); // mtex= wrld->mtex[(int)wrld->texact]; // TODO break; + case ID_PA: + mtex= &(((ParticleSettings *)id)->mtex[(int)((ParticleSettings *)id)->texact]); + break; } if(mtex) { @@ -1666,6 +1674,7 @@ static int paste_mtex_exec(bContext *C, wmOperator *UNUSED(op)) Material *ma= CTX_data_pointer_get_type(C, "material", &RNA_Material).data; Lamp *la= CTX_data_pointer_get_type(C, "lamp", &RNA_Lamp).data; World *wo= CTX_data_pointer_get_type(C, "world", &RNA_World).data; + ParticleSystem *psys= CTX_data_pointer_get_type(C, "particle_system", &RNA_ParticleSystem).data; if (ma) id = &ma->id; @@ -1673,6 +1682,8 @@ static int paste_mtex_exec(bContext *C, wmOperator *UNUSED(op)) id = &la->id; else if (wo) id = &wo->id; + else if (psys) + id = &psys->part->id; if (id==NULL) return OPERATOR_CANCELLED; diff --git a/source/blender/editors/screen/area.c b/source/blender/editors/screen/area.c index 5ea5fe06c46..4784f19012e 100644 --- a/source/blender/editors/screen/area.c +++ b/source/blender/editors/screen/area.c @@ -164,27 +164,22 @@ void ED_area_overdraw_flush(ScrArea *sa, ARegion *ar) static void area_draw_azone(short x1, short y1, short x2, short y2) { - float xmin = x1; - float xmax = x2-2; - float ymin = y1-1; - float ymax = y2-3; - - float dx= 0.3f*(xmax-xmin); - float dy= 0.3f*(ymax-ymin); + int dx= floor(0.3f*(x2-x1)); + int dy= floor(0.3f*(y2-y1)); glColor4ub(255, 255, 255, 180); - fdrawline(xmin, ymax, xmax, ymin); + fdrawline(x1, y2, x2, y1); glColor4ub(255, 255, 255, 130); - fdrawline(xmin, ymax-dy, xmax-dx, ymin); + fdrawline(x1, y2-dy, x2-dx, y1); glColor4ub(255, 255, 255, 80); - fdrawline(xmin, ymax-2*dy, xmax-2*dx, ymin); + fdrawline(x1, y2-2*dy, x2-2*dx, y1); glColor4ub(0, 0, 0, 210); - fdrawline(xmin, ymax+1, xmax+1, ymin); + fdrawline(x1, y2+1, x2+1, y1); glColor4ub(0, 0, 0, 180); - fdrawline(xmin, ymax-dy+1, xmax-dx+1, ymin); + fdrawline(x1, y2-dy+1, x2-dx+1, y1); glColor4ub(0, 0, 0, 150); - fdrawline(xmin, ymax-2*dy+1, xmax-2*dx+1, ymin); + fdrawline(x1, y2-2*dy+1, x2-2*dx+1, y1); } @@ -451,7 +446,6 @@ void ED_area_headerprint(ScrArea *sa, const char *str) /* ************************************************************ */ -#define AZONESPOT 12 static void area_azone_initialize(ScrArea *sa) { AZone *az; @@ -465,8 +459,8 @@ static void area_azone_initialize(ScrArea *sa) az->type= AZONE_AREA; az->x1= sa->totrct.xmin; az->y1= sa->totrct.ymin; - az->x2= sa->totrct.xmin + AZONESPOT-1; - az->y2= sa->totrct.ymin + AZONESPOT-1; + az->x2= sa->totrct.xmin + AZONESPOT; + az->y2= sa->totrct.ymin + AZONESPOT; BLI_init_rcti(&az->rect, az->x1, az->x2, az->y1, az->y2); az= (AZone *)MEM_callocN(sizeof(AZone), "actionzone"); @@ -474,13 +468,13 @@ static void area_azone_initialize(ScrArea *sa) az->type= AZONE_AREA; az->x1= sa->totrct.xmax+1; az->y1= sa->totrct.ymax+1; - az->x2= sa->totrct.xmax-AZONESPOT+1; - az->y2= sa->totrct.ymax-AZONESPOT+1; + az->x2= sa->totrct.xmax-AZONESPOT; + az->y2= sa->totrct.ymax-AZONESPOT; BLI_init_rcti(&az->rect, az->x1, az->x2, az->y1, az->y2); } #define AZONEPAD_EDGE 4 -#define AZONEPAD_ICON 8 +#define AZONEPAD_ICON 9 static void region_azone_edge(AZone *az, ARegion *ar) { switch(az->edge) { diff --git a/source/blender/editors/screen/glutil.c b/source/blender/editors/screen/glutil.c index 9b3a51805e9..a39039b254f 100644 --- a/source/blender/editors/screen/glutil.c +++ b/source/blender/editors/screen/glutil.c @@ -765,7 +765,7 @@ void bglBegin(int mode) } } -int bglPointHack() { +int bglPointHack(void) { float value[4]; int pointhack_px; glGetFloatv(GL_POINT_SIZE_RANGE, value); diff --git a/source/blender/editors/screen/screen_intern.h b/source/blender/editors/screen/screen_intern.h index 87b397382a3..ee448e70779 100644 --- a/source/blender/editors/screen/screen_intern.h +++ b/source/blender/editors/screen/screen_intern.h @@ -32,6 +32,8 @@ struct wmWindow; struct Scene; +#define AZONESPOT 12 + /* area.c */ void area_copy_data (ScrArea *sa1, ScrArea *sa2, int swap_space); diff --git a/source/blender/editors/screen/screen_ops.c b/source/blender/editors/screen/screen_ops.c index b6c92982560..9267f4d4e80 100644 --- a/source/blender/editors/screen/screen_ops.c +++ b/source/blender/editors/screen/screen_ops.c @@ -474,7 +474,10 @@ AZone *is_in_area_actionzone(ScrArea *sa, int x, int y) for(az= sa->actionzones.first; az; az= az->next) { if(BLI_in_rcti(&az->rect, x, y)) { if(az->type == AZONE_AREA) { - if(isect_point_tri_v2_int(az->x1, az->y1, az->x2, az->y2, x, y)) + /* no triangle intersect but a hotspot circle based on corner */ + int radius= (x-az->x1)*(x-az->x1) + (y-az->y1)*(y-az->y1); + + if(radius <= AZONESPOT*AZONESPOT) break; } else if(az->type == AZONE_REGION) { diff --git a/source/blender/editors/sculpt_paint/paint_image.c b/source/blender/editors/sculpt_paint/paint_image.c index ba73c488c46..6a8d5043c43 100644 --- a/source/blender/editors/sculpt_paint/paint_image.c +++ b/source/blender/editors/sculpt_paint/paint_image.c @@ -5452,10 +5452,10 @@ static int texture_paint_camera_project_exec(bContext *C, wmOperator *op) idgroup= IDP_GetProperties(&image->id, 0); if(idgroup) { - view_data= IDP_GetPropertyFromGroup(idgroup, PROJ_VIEW_DATA_ID); + view_data= IDP_GetPropertyTypeFromGroup(idgroup, PROJ_VIEW_DATA_ID, IDP_ARRAY); /* type check to make sure its ok */ - if(view_data->len != PROJ_VIEW_DATA_SIZE || view_data->type != IDP_ARRAY || view_data->subtype != IDP_FLOAT) { + if(view_data->len != PROJ_VIEW_DATA_SIZE || view_data->subtype != IDP_FLOAT) { BKE_report(op->reports, RPT_ERROR, "Image project data invalid."); return OPERATOR_CANCELLED; } diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c index 0fb3bc34d5b..69e42d87148 100644 --- a/source/blender/editors/sculpt_paint/sculpt.c +++ b/source/blender/editors/sculpt_paint/sculpt.c @@ -64,8 +64,11 @@ #include "WM_api.h" #include "WM_types.h" + +#include "ED_sculpt.h" #include "ED_screen.h" #include "ED_view3d.h" +#include "ED_util.h" /* for crazyspace correction */ #include "paint_intern.h" #include "sculpt_intern.h" @@ -169,7 +172,7 @@ int sculpt_modifiers_active(Scene *scene, Object *ob) if(!modifier_isEnabled(scene, md, eModifierMode_Realtime)) continue; if(md->type==eModifierType_ShapeKey) continue; - if(mti->type==eModifierTypeType_OnlyDeform && mti->deformMatrices) + if(mti->type==eModifierTypeType_OnlyDeform) return 1; } @@ -1256,7 +1259,7 @@ static void do_pinch_brush(Sculpt *sd, SculptSession *ss, PBVHNode **nodes, int if(vd.mvert) vd.mvert->flag |= ME_VERT_PBVH_UPDATE; - } + } } BLI_pbvh_vertex_iter_end; } @@ -2353,17 +2356,36 @@ static void do_brush_action(Sculpt *sd, SculptSession *ss, Brush *brush) } } +/* flush displacement from deformed PBVH vertex to original mesh */ +static void sculpt_flush_pbvhvert_deform(SculptSession *ss, PBVHVertexIter *vd) +{ + Object *ob= ss->ob; + Mesh *me= ob->data; + float disp[3], newco[3]; + int index= vd->vert_indices[vd->i]; + + sub_v3_v3v3(disp, vd->co, ss->deform_cos[index]); + mul_m3_v3(ss->deform_imats[index], disp); + add_v3_v3v3(newco, disp, ss->orig_cos[index]); + + copy_v3_v3(ss->deform_cos[index], vd->co); + copy_v3_v3(ss->orig_cos[index], newco); + + if(!ss->kb) + copy_v3_v3(me->mvert[index].co, newco); +} + static void sculpt_combine_proxies(Sculpt *sd, SculptSession *ss) { Brush *brush= paint_brush(&sd->paint); PBVHNode** nodes; - int use_orco, totnode, n; + int totnode, n; BLI_pbvh_gather_proxies(ss->pbvh, &nodes, &totnode); if(!ELEM(brush->sculpt_tool, SCULPT_TOOL_SMOOTH, SCULPT_TOOL_LAYER)) { /* these brushes start from original coordinates */ - use_orco = (ELEM3(brush->sculpt_tool, SCULPT_TOOL_GRAB, + const int use_orco = (ELEM3(brush->sculpt_tool, SCULPT_TOOL_GRAB, SCULPT_TOOL_ROTATE, SCULPT_TOOL_THUMB)); #pragma omp parallel for schedule(guided) if (sd->flags & SCULPT_USE_OPENMP) @@ -2391,6 +2413,9 @@ static void sculpt_combine_proxies(Sculpt *sd, SculptSession *ss) add_v3_v3(val, proxies[p].co[vd.i]); sculpt_clip(sd, ss, vd.co, val); + + if(ss->modifiers_active) + sculpt_flush_pbvhvert_deform(ss, &vd); } BLI_pbvh_vertex_iter_end; @@ -2421,38 +2446,17 @@ static void sculpt_update_keyblock(SculptSession *ss) } /* flush displacement from deformed PBVH to original layer */ -static void sculpt_flush_deformation(SculptSession *ss) +static void sculpt_flush_stroke_deform(SculptSession *ss) { - float (*vertCos)[3]; - - vertCos= BLI_pbvh_get_vertCos(ss->pbvh); - - if (vertCos) { + if(!ss->kb) { Object *ob= ss->ob; Mesh *me= (Mesh*)ob->data; - MVert *mvert= me->mvert; - int a; - - for(a = 0; a < me->totvert; ++a, ++mvert) { - float disp[3], newco[3]; - sub_v3_v3v3(disp, vertCos[a], ss->deform_cos[a]); - mul_m3_v3(ss->deform_imats[a], disp); - add_v3_v3v3(newco, disp, ss->orig_cos[a]); - - copy_v3_v3(ss->deform_cos[a], vertCos[a]); - copy_v3_v3(ss->orig_cos[a], newco); - - if(!ss->kb) - copy_v3_v3(mvert->co, newco); - } - - if(ss->kb) - sculpt_update_keyblock(ss); + /* Modifiers could depend on mesh normals, so we should update them/ + Note, then if sculpting happens on locked key, normals should be re-calculated + after applying coords from keyblock on base mesh */ mesh_calc_normals(me->mvert, me->totvert, me->mface, me->totface, NULL); - - MEM_freeN(vertCos); - } + } else sculpt_update_keyblock(ss); } //static int max_overlap_count(Sculpt *sd) @@ -2564,7 +2568,7 @@ static void do_symmetrical_brush_actions(Sculpt *sd, SculptSession *ss) sculpt_fix_noise_tear(sd, ss); if (ss->modifiers_active) - sculpt_flush_deformation(ss); + sculpt_flush_stroke_deform(ss); cache->first_time= 0; } @@ -2641,7 +2645,7 @@ void sculpt_update_mesh_elements(Scene *scene, Object *ob, int need_fmap) if(ss->kb) ss->orig_cos = key_to_vertcos(ob, ss->kb); else ss->orig_cos = mesh_getVertexCos(ob->data, NULL); - sculpt_get_deform_matrices(scene, ob, &ss->deform_imats, &ss->deform_cos); + crazyspace_build_sculpt(scene, ob, &ss->deform_imats, &ss->deform_cos); BLI_pbvh_apply_vertCos(ss->pbvh, ss->deform_cos); for(a = 0; a < ((Mesh*)ob->data)->totvert; ++a) diff --git a/source/blender/editors/sculpt_paint/sculpt_undo.c b/source/blender/editors/sculpt_paint/sculpt_undo.c index d136fdaf6e0..d88d7a5ac49 100644 --- a/source/blender/editors/sculpt_paint/sculpt_undo.c +++ b/source/blender/editors/sculpt_paint/sculpt_undo.c @@ -49,6 +49,7 @@ #include "BKE_multires.h" #include "BKE_paint.h" #include "BKE_key.h" +#include "BKE_mesh.h" #include "WM_api.h" #include "WM_types.h" @@ -184,6 +185,9 @@ static void sculpt_undo_restore(bContext *C, ListBase *lb) tag_update= ((Mesh*)ob->data)->id.us > 1; if(ss->modifiers_active) { + Mesh *me= ob->data; + mesh_calc_normals(me->mvert, me->totvert, me->mface, me->totface, NULL); + sculpt_free_deformMats(ss); tag_update|= 1; } diff --git a/source/blender/editors/sound/sound_ops.c b/source/blender/editors/sound/sound_ops.c index 004fb33f0dd..30edc659fcb 100644 --- a/source/blender/editors/sound/sound_ops.c +++ b/source/blender/editors/sound/sound_ops.c @@ -209,7 +209,7 @@ void SOUND_OT_pack(wmOperatorType *ot) static int sound_unpack_exec(bContext *C, wmOperator *op) { int method= RNA_enum_get(op->ptr, "method"); - bSound* sound; + bSound* sound= NULL; /* find the suppplied image by name */ if (RNA_property_is_set(op->ptr, "id")) { diff --git a/source/blender/editors/space_buttons/buttons_context.c b/source/blender/editors/space_buttons/buttons_context.c index b0b1c23cbc0..ee8b67a146a 100644 --- a/source/blender/editors/space_buttons/buttons_context.c +++ b/source/blender/editors/space_buttons/buttons_context.c @@ -66,6 +66,7 @@ typedef struct ButsContextPath { PointerRNA ptr[8]; int len; int flag; + int tex_ctx; } ButsContextPath; static int set_pointer_type(ButsContextPath *path, bContextDataResult *result, StructRNA *type) @@ -359,6 +360,7 @@ static int buttons_context_path_texture(ButsContextPath *path) Lamp *la; Brush *br; World *wo; + ParticleSystem *psys; Tex *tex; PointerRNA *ptr= &path->ptr[path->len-1]; int orig_len = path->len; @@ -368,7 +370,7 @@ static int buttons_context_path_texture(ButsContextPath *path) return 1; } /* try brush */ - if((path->flag & SB_BRUSH_TEX) && buttons_context_path_brush(path)) { + if((path->tex_ctx == SB_TEXC_BRUSH) && buttons_context_path_brush(path)) { br= path->ptr[path->len-1].data; if(br) { @@ -380,7 +382,7 @@ static int buttons_context_path_texture(ButsContextPath *path) } } /* try world */ - if((path->flag & SB_WORLD_TEX) && buttons_context_path_world(path)) { + if((path->tex_ctx == SB_TEXC_WORLD) && buttons_context_path_world(path)) { wo= path->ptr[path->len-1].data; if(wo && GS(wo->id.name)==ID_WO) { @@ -391,6 +393,18 @@ static int buttons_context_path_texture(ButsContextPath *path) return 1; } } + /* try particles */ + if((path->tex_ctx == SB_TEXC_PARTICLES) && buttons_context_path_particle(path)) { + psys= path->ptr[path->len-1].data; + + if(psys && psys->part && GS(psys->part->id.name)==ID_PA) { + tex= give_current_particle_texture(psys->part); + + RNA_id_pointer_create(&tex->id, &path->ptr[path->len]); + path->len++; + return 1; + } + } /* try material */ if(buttons_context_path_material(path)) { ma= path->ptr[path->len-1].data; @@ -442,6 +456,7 @@ static int buttons_context_path(const bContext *C, ButsContextPath *path, int ma memset(path, 0, sizeof(*path)); path->flag= flag; + path->tex_ctx = sbuts->texture_context; /* if some ID datablock is pinned, set the root pointer */ if(sbuts->pinid) { @@ -534,13 +549,12 @@ void buttons_context_compute(const bContext *C, SpaceButs *sbuts) { ButsContextPath *path; PointerRNA *ptr; - int a, pflag, flag= 0; + int a, pflag= 0, flag= 0; if(!sbuts->path) sbuts->path= MEM_callocN(sizeof(ButsContextPath), "ButsContextPath"); path= sbuts->path; - pflag= (sbuts->flag & (SB_WORLD_TEX|SB_BRUSH_TEX)); /* for each context, see if we can compute a valid path to it, if * this is the case, we know we have to display the button */ @@ -732,6 +746,12 @@ int buttons_context(const bContext *C, const char *member, bContextDataResult *r if(br) CTX_data_pointer_set(result, &br->id, &RNA_BrushTextureSlot, &br->mtex); } + else if((ptr=get_pointer_type(path, &RNA_ParticleSystem))) { + ParticleSettings *part= ((ParticleSystem *)ptr->data)->part; + + if(part) + CTX_data_pointer_set(result, &part->id, &RNA_ParticleSettingsTextureSlot, part->mtex[(int)part->texact]); + } return 1; } diff --git a/source/blender/editors/space_buttons/buttons_header.c b/source/blender/editors/space_buttons/buttons_header.c index bd1674aa307..bfc5a27883d 100644 --- a/source/blender/editors/space_buttons/buttons_header.c +++ b/source/blender/editors/space_buttons/buttons_header.c @@ -38,7 +38,7 @@ #include "ED_screen.h" #include "ED_types.h" - +#include "DNA_object_types.h" #include "UI_interface.h" #include "UI_resources.h" @@ -50,6 +50,28 @@ #define B_CONTEXT_SWITCH 101 #define B_BUTSPREVIEW 102 +static void set_texture_context(bContext *C, SpaceButs *sbuts) +{ + switch(sbuts->mainb) { + case BCONTEXT_MATERIAL: + sbuts->texture_context = SB_TEXC_MAT_OR_LAMP; + break; + case BCONTEXT_DATA: + { + Object *ob = CTX_data_active_object(C); + if(ob && ob->type==OB_LAMP) + sbuts->texture_context = SB_TEXC_MAT_OR_LAMP; + break; + } + case BCONTEXT_WORLD: + sbuts->texture_context = SB_TEXC_WORLD; + break; + case BCONTEXT_PARTICLE: + sbuts->texture_context = SB_TEXC_PARTICLES; + break; + } +} + static void do_buttons_buttons(bContext *C, void *UNUSED(arg), int event) { SpaceButs *sbuts= CTX_wm_space_buts(C); @@ -62,11 +84,7 @@ static void do_buttons_buttons(bContext *C, void *UNUSED(arg), int event) case B_BUTSPREVIEW: ED_area_tag_redraw(CTX_wm_area(C)); - /* silly exception */ - if(sbuts->mainb == BCONTEXT_WORLD) - sbuts->flag |= SB_WORLD_TEX; - else if(sbuts->mainb != BCONTEXT_TEXTURE) - sbuts->flag &= ~SB_WORLD_TEX; + set_texture_context(C, sbuts); sbuts->preview= 1; break; diff --git a/source/blender/editors/space_buttons/space_buttons.c b/source/blender/editors/space_buttons/space_buttons.c index b33231f190c..61485987cc9 100644 --- a/source/blender/editors/space_buttons/space_buttons.c +++ b/source/blender/editors/space_buttons/space_buttons.c @@ -281,6 +281,7 @@ static void buttons_area_listener(ScrArea *sa, wmNotifier *wmn) case ND_PARTICLE: if (wmn->action == NA_EDITED) buttons_area_redraw(sa, BCONTEXT_PARTICLE); + sbuts->preview= 1; break; case ND_DRAW: buttons_area_redraw(sa, BCONTEXT_OBJECT); diff --git a/source/blender/editors/space_console/console_draw.c b/source/blender/editors/space_console/console_draw.c index 2d4501e6005..ba9993cfe60 100644 --- a/source/blender/editors/space_console/console_draw.c +++ b/source/blender/editors/space_console/console_draw.c @@ -188,7 +188,7 @@ static int console_textview_line_color(struct TextViewContext *tvc, unsigned cha static int console_textview_main__internal(struct SpaceConsole *sc, struct ARegion *ar, int draw, int mval[2], void **mouse_pick, int *pos_pick) { - ConsoleLine cl_dummy= {0}; + ConsoleLine cl_dummy= {NULL}; int ret= 0; View2D *v2d= &ar->v2d; diff --git a/source/blender/editors/space_file/file_ops.c b/source/blender/editors/space_file/file_ops.c index 55dc19d9bb9..fea50f1f2aa 100644 --- a/source/blender/editors/space_file/file_ops.c +++ b/source/blender/editors/space_file/file_ops.c @@ -541,7 +541,7 @@ void FILE_OT_cancel(struct wmOperatorType *ot) void file_sfile_to_operator(wmOperator *op, SpaceFile *sfile, char *filepath) { - BLI_join_dirfile(filepath, sfile->params->dir, sfile->params->file); + BLI_join_dirfile(filepath, FILE_MAX, sfile->params->dir, sfile->params->file); /* XXX, not real length */ if(RNA_struct_find_property(op->ptr, "relative_path")) { if(RNA_boolean_get(op->ptr, "relative_path")) { BLI_path_rel(filepath, G.main->name); @@ -639,7 +639,7 @@ int file_draw_check_exists(SpaceFile *sfile) if(RNA_struct_find_property(sfile->op->ptr, "check_existing")) { if(RNA_boolean_get(sfile->op->ptr, "check_existing")) { char filepath[FILE_MAX]; - BLI_join_dirfile(filepath, sfile->params->dir, sfile->params->file); + BLI_join_dirfile(filepath, sizeof(filepath), sfile->params->dir, sfile->params->file); if(BLI_exists(filepath) && !BLI_is_dir(filepath)) { return TRUE; } @@ -929,13 +929,13 @@ static int new_folder_path(const char* parent, char *folder, char *name) int len = 0; BLI_strncpy(name, "New Folder", FILE_MAXFILE); - BLI_join_dirfile(folder, parent, name); + BLI_join_dirfile(folder, FILE_MAX, parent, name); /* XXX, not real length */ /* check whether folder with the name already exists, in this case add number to the name. Check length of generated name to avoid crazy case of huge number of folders each named 'New Folder (x)' */ while (BLI_exists(folder) && (len<FILE_MAXFILE)) { len = BLI_snprintf(name, FILE_MAXFILE, "New Folder(%d)", i); - BLI_join_dirfile(folder, parent, name); + BLI_join_dirfile(folder, FILE_MAX, parent, name); /* XXX, not real length */ i++; } @@ -1017,8 +1017,8 @@ static void file_expand_directory(bContext *C) if(sfile->params) { if ( sfile->params->dir[0] == '~' ) { char tmpstr[sizeof(sfile->params->dir)-1]; - strncpy(tmpstr, sfile->params->dir+1, sizeof(tmpstr)); - BLI_join_dirfile(sfile->params->dir, BLI_getDefaultDocumentFolder(), tmpstr); + BLI_strncpy(tmpstr, sfile->params->dir+1, sizeof(tmpstr)); + BLI_join_dirfile(sfile->params->dir, sizeof(sfile->params->dir), BLI_getDefaultDocumentFolder(), tmpstr); } #ifdef WIN32 diff --git a/source/blender/editors/space_file/filelist.c b/source/blender/editors/space_file/filelist.c index ec4733c171c..b92b95e2efd 100644 --- a/source/blender/editors/space_file/filelist.c +++ b/source/blender/editors/space_file/filelist.c @@ -395,7 +395,7 @@ void filelist_free_icons(void) } //-----------------FOLDERLIST (previous/next) --------------// -struct ListBase* folderlist_new() +struct ListBase* folderlist_new(void) { ListBase* p = MEM_callocN( sizeof(ListBase), "folderlist" ); return p; @@ -833,13 +833,13 @@ void filelist_setfiletypes(struct FileList* filelist) static void filelist_read_dir(struct FileList* filelist) { - char wdir[FILE_MAX]; + char wdir[FILE_MAX]= ""; if (!filelist) return; filelist->fidx = 0; filelist->filelist = 0; - BLI_getwdN(wdir); + BLI_getwdN(wdir, sizeof(wdir)); /* backup cwd to restore after */ BLI_cleanup_dir(G.main->name, filelist->dir); filelist->numfiles = BLI_getdir(filelist->dir, &(filelist->filelist)); diff --git a/source/blender/editors/space_file/filesel.c b/source/blender/editors/space_file/filesel.c index 939a8450cb6..9092e639542 100644 --- a/source/blender/editors/space_file/filesel.c +++ b/source/blender/editors/space_file/filesel.c @@ -347,7 +347,7 @@ float file_string_width(const char* str) return BLF_width(style->widget.uifont_id, str); } -float file_font_pointsize() +float file_font_pointsize(void) { #if 0 float s; @@ -555,7 +555,7 @@ void autocomplete_directory(struct bContext *C, char *str, void *UNUSED(arg_v)) char path[FILE_MAX]; struct stat status; - BLI_join_dirfile(path, dirname, de->d_name); + BLI_join_dirfile(path, sizeof(path), dirname, de->d_name); if (stat(path, &status) == 0) { if (S_ISDIR(status.st_mode)) { /* is subdir */ diff --git a/source/blender/editors/space_graph/graph_draw.c b/source/blender/editors/space_graph/graph_draw.c index b2e9f93685e..901ede9fff7 100644 --- a/source/blender/editors/space_graph/graph_draw.c +++ b/source/blender/editors/space_graph/graph_draw.c @@ -138,7 +138,7 @@ static void draw_fcurve_modifier_controls_envelope (FModifier *fcm, View2D *v2d) /* Points ---------------- */ /* helper func - draw keyframe vertices only for an F-Curve */ -static void draw_fcurve_vertices_keyframes (FCurve *fcu, View2D *v2d, short edit, short sel) +static void draw_fcurve_vertices_keyframes (FCurve *fcu, SpaceIpo *UNUSED(sipo), View2D *v2d, short edit, short sel) { BezTriple *bezt= fcu->bezt; const float fac= 0.05f * (v2d->cur.xmax - v2d->cur.xmin); @@ -210,7 +210,7 @@ static void draw_fcurve_handle_control (float x, float y, float xscale, float ys } /* helper func - draw handle vertices only for an F-Curve (if it is not protected) */ -static void draw_fcurve_vertices_handles (FCurve *fcu, View2D *v2d, short sel, short sel_handle_only) +static void draw_fcurve_vertices_handles (FCurve *fcu, SpaceIpo *sipo, View2D *v2d, short sel, short sel_handle_only) { BezTriple *bezt= fcu->bezt; BezTriple *prevbezt = NULL; @@ -226,7 +226,7 @@ static void draw_fcurve_vertices_handles (FCurve *fcu, View2D *v2d, short sel, s else UI_ThemeColor(TH_HANDLE_VERTEX); /* anti-aliased lines for more consistent appearance */ - glEnable(GL_LINE_SMOOTH); + if ((sipo->flag & SIPO_BEAUTYDRAW_OFF)==0) glEnable(GL_LINE_SMOOTH); glEnable(GL_BLEND); for (i=0; i < fcu->totvert; i++, prevbezt=bezt, bezt++) { @@ -251,7 +251,7 @@ static void draw_fcurve_vertices_handles (FCurve *fcu, View2D *v2d, short sel, s } } - glDisable(GL_LINE_SMOOTH); + if ((sipo->flag & SIPO_BEAUTYDRAW_OFF)==0) glDisable(GL_LINE_SMOOTH); glDisable(GL_BLEND); } @@ -275,7 +275,7 @@ static void set_fcurve_vertex_color (FCurve *fcu, short sel) } -static void draw_fcurve_vertices (ARegion *ar, FCurve *fcu, short do_handles, short sel_handle_only) +static void draw_fcurve_vertices (SpaceIpo *sipo, ARegion *ar, FCurve *fcu, short do_handles, short sel_handle_only) { View2D *v2d= &ar->v2d; @@ -292,18 +292,18 @@ static void draw_fcurve_vertices (ARegion *ar, FCurve *fcu, short do_handles, sh if (do_handles) { set_fcurve_vertex_color(fcu, 0); - draw_fcurve_vertices_handles(fcu, v2d, 0, sel_handle_only); + draw_fcurve_vertices_handles(fcu, sipo, v2d, 0, sel_handle_only); set_fcurve_vertex_color(fcu, 1); - draw_fcurve_vertices_handles(fcu, v2d, 1, sel_handle_only); + draw_fcurve_vertices_handles(fcu, sipo, v2d, 1, sel_handle_only); } /* draw keyframes over the handles */ set_fcurve_vertex_color(fcu, 0); - draw_fcurve_vertices_keyframes(fcu, v2d, !(fcu->flag & FCURVE_PROTECTED), 0); + draw_fcurve_vertices_keyframes(fcu, sipo, v2d, !(fcu->flag & FCURVE_PROTECTED), 0); set_fcurve_vertex_color(fcu, 1); - draw_fcurve_vertices_keyframes(fcu, v2d, !(fcu->flag & FCURVE_PROTECTED), 1); + draw_fcurve_vertices_keyframes(fcu, sipo, v2d, !(fcu->flag & FCURVE_PROTECTED), 1); glPointSize(1.0f); } @@ -407,7 +407,7 @@ static void draw_fcurve_handles (SpaceIpo *sipo, FCurve *fcu) UI_GetThemeColor3ubv(basecol + bezt->h2, col); col[3]= drawFCurveFade(fcu) * 255; glColor4ubv((GLubyte *)col); - + glVertex2fv(fp); glVertex2fv(fp+3); } } @@ -456,7 +456,7 @@ static void draw_fcurve_sample_control (float x, float y, float xscale, float ys } /* helper func - draw keyframe vertices only for an F-Curve */ -static void draw_fcurve_samples (ARegion *ar, FCurve *fcu) +static void draw_fcurve_samples (SpaceIpo *sipo, ARegion *ar, FCurve *fcu) { FPoint *first, *last; float hsize, xscale, yscale; @@ -476,14 +476,14 @@ static void draw_fcurve_samples (ARegion *ar, FCurve *fcu) /* draw */ if (first && last) { /* anti-aliased lines for more consistent appearance */ - glEnable(GL_LINE_SMOOTH); + if ((sipo->flag & SIPO_BEAUTYDRAW_OFF)==0) glEnable(GL_LINE_SMOOTH); glEnable(GL_BLEND); draw_fcurve_sample_control(first->vec[0], first->vec[1], xscale, yscale, hsize); draw_fcurve_sample_control(last->vec[0], last->vec[1], xscale, yscale, hsize); glDisable(GL_BLEND); - glDisable(GL_LINE_SMOOTH); + if ((sipo->flag & SIPO_BEAUTYDRAW_OFF)==0) glDisable(GL_LINE_SMOOTH); } } @@ -794,7 +794,7 @@ void graph_draw_ghost_curves (bAnimContext *ac, SpaceIpo *sipo, ARegion *ar) glLineWidth(3.0f); /* anti-aliased lines for less jagged appearance */ - glEnable(GL_LINE_SMOOTH); + if ((sipo->flag & SIPO_BEAUTYDRAW_OFF)==0) glEnable(GL_LINE_SMOOTH); glEnable(GL_BLEND); /* the ghost curves are simply sampled F-Curves stored in sipo->ghostCurves */ @@ -813,7 +813,7 @@ void graph_draw_ghost_curves (bAnimContext *ac, SpaceIpo *sipo, ARegion *ar) setlinestyle(0); glLineWidth(1.0f); - glDisable(GL_LINE_SMOOTH); + if ((sipo->flag & SIPO_BEAUTYDRAW_OFF)==0) glDisable(GL_LINE_SMOOTH); glDisable(GL_BLEND); } @@ -871,7 +871,7 @@ void graph_draw_curves (bAnimContext *ac, SpaceIpo *sipo, ARegion *ar, View2DGri } /* anti-aliased lines for less jagged appearance */ - glEnable(GL_LINE_SMOOTH); + if ((sipo->flag & SIPO_BEAUTYDRAW_OFF)==0) glEnable(GL_LINE_SMOOTH); glEnable(GL_BLEND); /* draw F-Curve */ @@ -892,7 +892,7 @@ void graph_draw_curves (bAnimContext *ac, SpaceIpo *sipo, ARegion *ar, View2DGri /* restore settings */ setlinestyle(0); - glDisable(GL_LINE_SMOOTH); + if ((sipo->flag & SIPO_BEAUTYDRAW_OFF)==0) glDisable(GL_LINE_SMOOTH); glDisable(GL_BLEND); } @@ -924,11 +924,11 @@ void graph_draw_curves (bAnimContext *ac, SpaceIpo *sipo, ARegion *ar, View2DGri glDisable(GL_BLEND); } - draw_fcurve_vertices(ar, fcu, do_handles, sipo->flag&SIPO_SELVHANDLESONLY); + draw_fcurve_vertices(sipo, ar, fcu, do_handles, (sipo->flag & SIPO_SELVHANDLESONLY)); } else { /* samples: only draw two indicators at either end as indicators */ - draw_fcurve_samples(ar, fcu); + draw_fcurve_samples(sipo, ar, fcu); } /* unapply unit mapping */ diff --git a/source/blender/editors/space_image/image_draw.c b/source/blender/editors/space_image/image_draw.c index 3932caeeba6..0dcfa9e3bcc 100644 --- a/source/blender/editors/space_image/image_draw.c +++ b/source/blender/editors/space_image/image_draw.c @@ -41,6 +41,7 @@ #include "PIL_time.h" #include "BLI_threads.h" +#include "BLI_string.h" #include "BLI_utildefines.h" #include "IMB_imbuf.h" @@ -129,26 +130,27 @@ static void draw_render_info(Scene *scene, Image *ima, ARegion *ar) void draw_image_info(ARegion *ar, int channels, int x, int y, char *cp, float *fp, int *zp, float *zpf) { char str[256]; - int ofs; - - ofs= sprintf(str, "X: %4d Y: %4d ", x, y); + int ofs= 0; + + ofs += BLI_snprintf(str, sizeof(str)-ofs, "X: %4d Y: %4d ", x, y); if(cp) - ofs+= sprintf(str+ofs, "| R: %3d G: %3d B: %3d A: %3d ", cp[0], cp[1], cp[2], cp[3]); + ofs+= BLI_snprintf(str, sizeof(str)-ofs, "| R: %3d G: %3d B: %3d A: %3d ", cp[0], cp[1], cp[2], cp[3]); if(fp) { if(channels==4) - ofs+= sprintf(str+ofs, "| R: %.3f G: %.3f B: %.3f A: %.3f ", fp[0], fp[1], fp[2], fp[3]); + ofs+= BLI_snprintf(str, sizeof(str)-ofs, "| R: %.3f G: %.3f B: %.3f A: %.3f ", fp[0], fp[1], fp[2], fp[3]); else if(channels==1) - ofs+= sprintf(str+ofs, "| Val: %.3f ", fp[0]); + ofs+= BLI_snprintf(str, sizeof(str)-ofs, "| Val: %.3f ", fp[0]); else if(channels==3) - ofs+= sprintf(str+ofs, "| R: %.3f G: %.3f B: %.3f ", fp[0], fp[1], fp[2]); + ofs+= BLI_snprintf(str, sizeof(str)-ofs, "| R: %.3f G: %.3f B: %.3f ", fp[0], fp[1], fp[2]); } if(zp) - ofs+= sprintf(str+ofs, "| Z: %.4f ", 0.5+0.5*(((float)*zp)/(float)0x7fffffff)); + ofs+= BLI_snprintf(str, sizeof(str)-ofs, "| Z: %.4f ", 0.5+0.5*(((float)*zp)/(float)0x7fffffff)); if(zpf) - ofs+= sprintf(str+ofs, "| Z: %.3f ", *zpf); - + ofs+= BLI_snprintf(str, sizeof(str)-ofs, "| Z: %.3f ", *zpf); + (void)ofs; + glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA); glEnable(GL_BLEND); diff --git a/source/blender/editors/space_info/info_report.c b/source/blender/editors/space_info/info_report.c index 46c4c8c2dfe..ce0bc6864c8 100644 --- a/source/blender/editors/space_info/info_report.c +++ b/source/blender/editors/space_info/info_report.c @@ -128,6 +128,9 @@ static int select_report_pick_invoke(bContext *C, wmOperator *op, wmEvent *event ReportList *reports= CTX_wm_reports(C); Report *report; + /* uses opengl */ + wmSubWindowSet(CTX_wm_window(C), ar->swinid); + report= info_text_pick(sinfo, ar, reports, event->mval[1]); RNA_int_set(op->ptr, "report_index", BLI_findindex(&reports->list, report)); diff --git a/source/blender/editors/space_info/info_stats.c b/source/blender/editors/space_info/info_stats.c index cf3607e8fba..aa5a00e1642 100644 --- a/source/blender/editors/space_info/info_stats.c +++ b/source/blender/editors/space_info/info_stats.c @@ -368,9 +368,9 @@ static void stats_string(Scene *scene) mmap_in_use= MEM_get_mapped_memory_in_use(); /* get memory statistics */ - s= memstr + sprintf(memstr, " | Mem:%.2fM", ((mem_in_use-mmap_in_use)>>10)/1024.0); + s= memstr + sprintf(memstr, " | Mem:%.2fM", (double)((mem_in_use-mmap_in_use)>>10)/1024.0); if(mmap_in_use) - sprintf(s, " (%.2fM)", ((mmap_in_use)>>10)/1024.0); + sprintf(s, " (%.2fM)", (double)((mmap_in_use)>>10)/1024.0); s= stats->infostr; diff --git a/source/blender/editors/space_logic/logic_window.c b/source/blender/editors/space_logic/logic_window.c index 93ae75d9928..ae533e80610 100644 --- a/source/blender/editors/space_logic/logic_window.c +++ b/source/blender/editors/space_logic/logic_window.c @@ -47,6 +47,7 @@ #include "BLI_blenlib.h" #include "BLI_utildefines.h" +#include "BKE_action.h" #include "BKE_context.h" #include "BKE_global.h" #include "BKE_library.h" @@ -1079,6 +1080,20 @@ static void draw_default_sensor_header(bSensor *sens, "Invert the level (output) of this sensor"); } +static void get_armature_bone_constraint(Object *ob, const char *posechannel, const char *constraint_name, bConstraint **constraint) +{ + /* check that bone exist in the active object */ + if (ob->type == OB_ARMATURE && ob->pose) { + bPoseChannel *pchan= get_pose_channel(ob->pose, posechannel); + if(pchan) { + bConstraint *con= BLI_findstring(&pchan->constraints, constraint_name, offsetof(bConstraint, name)); + if(con) { + *constraint= con; + } + } + } + /* didn't find any */ +} static void check_armature_bone_constraint(Object *ob, char *posechannel, char *constraint) { /* check that bone exist in the active object */ @@ -2015,8 +2030,8 @@ static short draw_actuatorbuttons(Main *bmain, Object *ob, bActuator *act, uiBlo } else { - uiDefButI(block, NUM, 0, "Sta: ",xco+10, yco-44, (width-20)/2, 19, &aa->sta, 1.0, MAXFRAMEF, 0, 0, "Start frame"); - uiDefButI(block, NUM, 0, "End: ",xco+10+(width-20)/2, yco-44, (width-20)/2, 19, &aa->end, 1.0, MAXFRAMEF, 0, 0, "End frame"); + uiDefButF(block, NUM, 0, "Sta: ",xco+10, yco-44, (width-20)/2, 19, &aa->sta, 1.0, MAXFRAMEF, 0, 0, "Start frame"); + uiDefButF(block, NUM, 0, "End: ",xco+10+(width-20)/2, yco-44, (width-20)/2, 19, &aa->end, 1.0, MAXFRAMEF, 0, 0, "End frame"); } uiDefButS(block, NUM, 0, "Blendin: ", xco+10, yco-64, (width-20)/2, 19, &aa->blendin, 0.0, 32767, 0.0, 0.0, "Number of frames of motion blending"); @@ -2077,11 +2092,11 @@ static short draw_actuatorbuttons(Main *bmain, Object *ob, bActuator *act, uiBlo "Use this property to define the Ipo position"); } else { - uiDefButI(block, NUM, 0, + uiDefButF(block, NUM, 0, "Sta", xco+10, yco-44, (width-80)/2, 19, &ia->sta, 1.0, MAXFRAMEF, 0, 0, "Start frame"); - uiDefButI(block, NUM, 0, + uiDefButF(block, NUM, 0, "End", xco+10+(width-80)/2, yco-44, (width-80)/2, 19, &ia->end, 1.0, MAXFRAMEF, 0, 0, "End frame"); @@ -3692,6 +3707,7 @@ static void draw_actuator_armature(uiLayout *layout, PointerRNA *ptr) bActuator *act = (bActuator*)ptr->data; bArmatureActuator *aa = (bArmatureActuator *) act->data; Object *ob = (Object *)ptr->id.data; + bConstraint *constraint = NULL; PointerRNA pose_ptr, pchan_ptr; PropertyRNA *bones_prop = NULL; @@ -3729,7 +3745,12 @@ static void draw_actuator_armature(uiLayout *layout, PointerRNA *ptr) } uiItemR(layout, ptr, "target", 0, NULL, ICON_NULL); - uiItemR(layout, ptr, "secondary_target", 0, NULL, ICON_NULL); + + /* show second target only if the constraint supports it */ + get_armature_bone_constraint(ob, aa->posechannel, aa->constraint, &constraint); + if (constraint && constraint->type == CONSTRAINT_TYPE_KINEMATIC) { + uiItemR(layout, ptr, "secondary_target", 0, NULL, ICON_NULL); + } break; case ACT_ARM_SETWEIGHT: if (ob->pose) { diff --git a/source/blender/editors/space_node/drawnode.c b/source/blender/editors/space_node/drawnode.c index aea35e193b8..e1577309afa 100644 --- a/source/blender/editors/space_node/drawnode.c +++ b/source/blender/editors/space_node/drawnode.c @@ -78,11 +78,6 @@ /* ****************** BUTTON CALLBACKS FOR ALL TREES ***************** */ -void node_buts_group(uiLayout *layout, bContext *C, PointerRNA *ptr) -{ - uiTemplateIDBrowse(layout, C, ptr, "node_tree", NULL, NULL, ""); -} - static void node_buts_value(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) { PointerRNA sockptr; @@ -543,7 +538,7 @@ static void node_composit_buts_renderlayers(uiLayout *layout, bContext *C, Point static void node_composit_buts_blur(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) { - uiLayout *col; + uiLayout *col, *row; col= uiLayoutColumn(layout, 0); @@ -554,12 +549,18 @@ static void node_composit_buts_blur(uiLayout *layout, bContext *UNUSED(C), Point } uiItemR(col, ptr, "use_relative", 0, NULL, ICON_NULL); - col= uiLayoutColumn(layout, 1); + if (RNA_boolean_get(ptr, "use_relative")) { + uiItemL(col, "Aspect Correction", 0); + row= uiLayoutRow(layout, 1); + uiItemR(row, ptr, "aspect_correction", UI_ITEM_R_EXPAND, NULL, 0); + + col= uiLayoutColumn(layout, 1); uiItemR(col, ptr, "factor_x", 0, "X", ICON_NULL); uiItemR(col, ptr, "factor_y", 0, "Y", ICON_NULL); } else { + col= uiLayoutColumn(layout, 1); uiItemR(col, ptr, "size_x", 0, "X", ICON_NULL); uiItemR(col, ptr, "size_y", 0, "Y", ICON_NULL); } diff --git a/source/blender/editors/space_node/node_draw.c b/source/blender/editors/space_node/node_draw.c index de0616f791e..b8a205d6eb1 100644 --- a/source/blender/editors/space_node/node_draw.c +++ b/source/blender/editors/space_node/node_draw.c @@ -45,6 +45,7 @@ #include "BKE_context.h" #include "BKE_depsgraph.h" #include "BKE_main.h" +#include "BKE_node.h" #include "BIF_gl.h" #include "BIF_glutil.h" @@ -68,7 +69,6 @@ // XXX interface.h extern void ui_dropshadow(rctf *rct, float radius, float aspect, int select); -extern void ui_draw_tria_icon(float x, float y, char dir); void ED_node_changed_update(ID *id, bNode *node) { @@ -264,10 +264,6 @@ static void node_update(const bContext *C, bNodeTree *ntree, bNode *node) BLI_unlock_thread(LOCK_PREVIEW); } - /* XXX ugly hack, typeinfo for group is generated */ - if(node->type == NODE_GROUP) - node->typeinfo->uifunc= node_buts_group; - /* buttons rect? */ if((node->flag & NODE_OPTIONS) && node->typeinfo->uifunc) { dy-= NODE_DYS/2; @@ -713,7 +709,7 @@ static void node_draw_basis(const bContext *C, ARegion *ar, SpaceNode *snode, bN UI_ThemeColorBlendShade(TH_TEXT, color_id, 0.4f, 10); /* open/close entirely? */ - ui_draw_tria_icon(rct->xmin+10.0f, rct->ymax-NODE_DY/2.0f, 'v'); + UI_DrawTriIcon(rct->xmin+10.0f, rct->ymax-NODE_DY/2.0f, 'v'); /* this isn't doing anything for the label, so commenting out if(node->flag & SELECT) @@ -721,11 +717,10 @@ static void node_draw_basis(const bContext *C, ARegion *ar, SpaceNode *snode, bN else UI_ThemeColor(TH_TEXT); */ - if(node->flag & NODE_CUSTOM_NAME) - BLI_strncpy(showname, node->name, sizeof(showname)); + if (node->typeinfo->labelfunc) + BLI_strncpy(showname, node->typeinfo->labelfunc(node), sizeof(showname)); else - /* todo: auto name display for node types */ - BLI_strncpy(showname, node->name, sizeof(showname)); + BLI_strncpy(showname, node->typeinfo->name, sizeof(showname)); //if(node->flag & NODE_MUTED) // sprintf(showname, "[%s]", showname); @@ -882,7 +877,7 @@ static void node_draw_hidden(const bContext *C, ARegion *ar, SpaceNode *snode, b UI_ThemeColorBlendShade(TH_TEXT, color_id, 0.4f, 10); /* open entirely icon */ - ui_draw_tria_icon(rct->xmin+10.0f, centy, 'h'); + UI_DrawTriIcon(rct->xmin+10.0f, centy, 'h'); /* disable lines */ if(node->flag & NODE_MUTED) @@ -894,14 +889,11 @@ static void node_draw_hidden(const bContext *C, ARegion *ar, SpaceNode *snode, b UI_ThemeColor(TH_TEXT); if(node->miniwidth>0.0f) { - - - if(node->flag & NODE_CUSTOM_NAME) - BLI_strncpy(showname, node->name, sizeof(showname)); + if (node->typeinfo->labelfunc) + BLI_strncpy(showname, node->typeinfo->labelfunc(node), sizeof(showname)); else - /* todo: auto name display */ - BLI_strncpy(showname, node->name, sizeof(showname)); - + BLI_strncpy(showname, node->typeinfo->name, sizeof(showname)); + //if(node->flag & NODE_MUTED) // sprintf(showname, "[%s]", showname); @@ -1012,18 +1004,19 @@ static void node_draw_group_links(View2D *v2d, SpaceNode *snode, bNode *gnode) } /* groups are, on creation, centered around 0,0 */ -static void node_draw_group(const bContext *C, ARegion *ar, SpaceNode *snode, bNode *gnode) +static void node_draw_group(const bContext *C, ARegion *ar, SpaceNode *snode, bNodeTree *ntree, bNode *gnode) { bNodeTree *ngroup= (bNodeTree *)gnode->id; bNodeSocket *sock; rctf rect= gnode->totr; - char showname[128]; + uiLayout *layout; + PointerRNA ptr; /* backdrop header */ glEnable(GL_BLEND); uiSetRoundBox(3); UI_ThemeColorShadeAlpha(TH_NODE_GROUP, 0, -70); - uiDrawBox(GL_POLYGON, rect.xmin, rect.ymax, rect.xmax, rect.ymax+NODE_DY, BASIS_RAD); + uiDrawBox(GL_POLYGON, rect.xmin, rect.ymax, rect.xmax, rect.ymax+26, BASIS_RAD); /* backdrop body */ UI_ThemeColorShadeAlpha(TH_BACK, -8, -70); @@ -1034,21 +1027,19 @@ static void node_draw_group(const bContext *C, ARegion *ar, SpaceNode *snode, bN uiSetRoundBox(15); glColor4ub(200, 200, 200, 140); glEnable( GL_LINE_SMOOTH ); - uiDrawBox(GL_LINE_LOOP, rect.xmin, rect.ymin, rect.xmax, rect.ymax+NODE_DY, BASIS_RAD); + uiDrawBox(GL_LINE_LOOP, rect.xmin, rect.ymin, rect.xmax, rect.ymax+26, BASIS_RAD); glDisable( GL_LINE_SMOOTH ); glDisable(GL_BLEND); /* backdrop title */ UI_ThemeColor(TH_TEXT_HI); - if (gnode->flag & NODE_CUSTOM_NAME) - BLI_strncpy(showname, gnode->name, sizeof(showname)); - else - BLI_strncpy(showname, ngroup->id.name+2, sizeof(showname)); - + layout = uiBlockLayout(gnode->block, UI_LAYOUT_VERTICAL, UI_LAYOUT_PANEL, (short)(rect.xmin+15), (short)(rect.ymax+23), + MIN2((int)(rect.xmax - rect.xmin-18.0f), 140), 20, U.uistyles.first); + RNA_pointer_create(&ntree->id, &RNA_Node, gnode, &ptr); + uiTemplateIDBrowse(layout, (bContext*)C, &ptr, "node_tree", NULL, NULL, NULL); + uiBlockLayoutResolve(gnode->block, NULL, NULL); - uiDefBut(gnode->block, LABEL, 0, showname, (short)(rect.xmin+15), (short)(rect.ymax), - (int)(rect.xmax - rect.xmin-18.0f), NODE_DY, NULL, 0, 0, 0, 0, ""); uiEndBlock(C, gnode->block); uiDrawBlock(C, gnode->block); gnode->block= NULL; @@ -1128,7 +1119,7 @@ void drawnodespace(const bContext *C, ARegion *ar, View2D *v2d) /* active group */ for(node= snode->nodetree->nodes.first; node; node= node->next) { if(node->flag & NODE_GROUP_EDIT) - node_draw_group(C, ar, snode, node); + node_draw_group(C, ar, snode, snode->nodetree, node); } } diff --git a/source/blender/editors/space_node/node_edit.c b/source/blender/editors/space_node/node_edit.c index 834f3483871..624630b9846 100644 --- a/source/blender/editors/space_node/node_edit.c +++ b/source/blender/editors/space_node/node_edit.c @@ -1693,27 +1693,36 @@ bNode *node_add_node(SpaceNode *snode, Scene *scene, int type, float locx, float static int node_duplicate_exec(bContext *C, wmOperator *UNUSED(op)) { SpaceNode *snode= CTX_wm_space_node(C); - bNode *node; + bNodeTree *ntree= snode->edittree; + bNode *node, *newnode, *last; ED_preview_kill_jobs(C); - - /* simple id user adjustment, node internal functions dont touch this - * but operators and readfile.c do. */ - for(node= snode->edittree->nodes.first; node; node= node->next) { + + last = ntree->nodes.last; + for(node= ntree->nodes.first; node; node= node->next) { if(node->flag & SELECT) { - id_us_plus(node->id); + newnode = nodeCopyNode(ntree, node, 1); + + /* deselect old node, select the copy instead */ + node->flag &= ~(NODE_SELECT|NODE_ACTIVE); + newnode->flag |= NODE_SELECT; + + if(newnode->id) { + /* simple id user adjustment, node internal functions dont touch this + * but operators and readfile.c do. */ + id_us_plus(newnode->id); + /* to ensure redraws or rerenders happen */ + ED_node_changed_update(snode->id, newnode); + } } + + /* make sure we don't copy new nodes again! */ + if (node==last) + break; } - - ntreeCopyTree(snode->edittree, 1); /* 1 == internally selected nodes */ - /* to ensure redraws or rerenders happen */ - for(node= snode->edittree->nodes.first; node; node= node->next) - if(node->flag & SELECT) - if(node->id) - ED_node_changed_update(snode->id, node); + ntreeSolveOrder(ntree); - ntreeSolveOrder(snode->edittree); node_tree_verify_groups(snode->nodetree); snode_notify(C, snode); @@ -2158,6 +2167,54 @@ void NODE_OT_read_fullsamplelayers(wmOperatorType *ot) ot->flag= 0; } +int node_render_changed_exec(bContext *C, wmOperator *UNUSED(op)) +{ + Scene *sce= CTX_data_scene(C); + bNode *node; + + for(node= sce->nodetree->nodes.first; node; node= node->next) { + if(node->id==(ID *)sce && node->need_exec) { + break; + } + } + if(node) { + SceneRenderLayer *srl= BLI_findlink(&sce->r.layers, node->custom1); + + if(srl) { + PointerRNA op_ptr; + + WM_operator_properties_create(&op_ptr, "RENDER_OT_render"); + RNA_string_set(&op_ptr, "layer", srl->name); + RNA_string_set(&op_ptr, "scene", sce->id.name+2); + + /* to keep keypositions */ + sce->r.scemode |= R_NO_FRAME_UPDATE; + + WM_operator_name_call(C, "RENDER_OT_render", WM_OP_INVOKE_DEFAULT, &op_ptr); + + WM_operator_properties_free(&op_ptr); + + return OPERATOR_FINISHED; + } + + } + return OPERATOR_CANCELLED; +} + +void NODE_OT_render_changed(wmOperatorType *ot) +{ + + ot->name= "Render Changed Layer"; + ot->idname= "NODE_OT_render_changed"; + + ot->exec= node_render_changed_exec; + + ot->poll= composite_node_active; + + /* flags */ + ot->flag= 0; +} + /* ****************** Make Group operator ******************* */ diff --git a/source/blender/editors/space_node/node_intern.h b/source/blender/editors/space_node/node_intern.h index 66bf9310db8..831e157deef 100644 --- a/source/blender/editors/space_node/node_intern.h +++ b/source/blender/editors/space_node/node_intern.h @@ -73,8 +73,6 @@ int node_link_bezier_points(View2D *v2d, SpaceNode *snode, bNodeLink *link, floa void draw_nodespace_back_pix(ARegion *ar, SpaceNode *snode, int color_manage); void draw_nodespace_color_info(ARegion *ar, int channels, int x, int y, char *cp, float *fp); -void node_buts_group(struct uiLayout *layout, struct bContext *C, struct PointerRNA *ptr); - /* node_edit.c */ void node_tree_from_ID(ID *id, bNodeTree **ntree, bNodeTree **edittree, int *treetype); void snode_notify(bContext *C, SpaceNode *snode); @@ -92,7 +90,7 @@ void node_tree_verify_groups(bNodeTree *nodetree); void snode_autoconnect(SpaceNode *snode, int allow_multiple, int replace); int node_has_hidden_sockets(bNode *node); void node_set_hidden_sockets(SpaceNode *snode, bNode *node, int set); - +int node_render_changed_exec(bContext *, wmOperator *); void NODE_OT_duplicate(struct wmOperatorType *ot); void NODE_OT_delete(struct wmOperatorType *ot); @@ -115,6 +113,7 @@ void NODE_OT_show_cyclic_dependencies(struct wmOperatorType *ot); void NODE_OT_link_viewer(struct wmOperatorType *ot); void NODE_OT_read_fullsamplelayers(struct wmOperatorType *ot); void NODE_OT_read_renderlayers(struct wmOperatorType *ot); +void NODE_OT_render_changed(struct wmOperatorType *ot); void NODE_OT_backimage_move(struct wmOperatorType *ot); void NODE_OT_backimage_zoom(struct wmOperatorType *ot); diff --git a/source/blender/editors/space_node/node_ops.c b/source/blender/editors/space_node/node_ops.c index 781682c9185..db5c493dcd9 100644 --- a/source/blender/editors/space_node/node_ops.c +++ b/source/blender/editors/space_node/node_ops.c @@ -78,6 +78,7 @@ void node_operatortypes(void) WM_operatortype_append(NODE_OT_read_renderlayers); WM_operatortype_append(NODE_OT_read_fullsamplelayers); + WM_operatortype_append(NODE_OT_render_changed); WM_operatortype_append(NODE_OT_backimage_move); WM_operatortype_append(NODE_OT_backimage_zoom); @@ -170,6 +171,8 @@ void node_keymap(struct wmKeyConfig *keyconf) WM_keymap_add_item(keymap, "NODE_OT_read_renderlayers", RKEY, KM_PRESS, KM_CTRL, 0); WM_keymap_add_item(keymap, "NODE_OT_read_fullsamplelayers", RKEY, KM_PRESS, KM_SHIFT, 0); + WM_keymap_add_item(keymap, "NODE_OT_render_changed", ZKEY, KM_PRESS, 0, 0); + transform_keymap_for_space(keyconf, keymap, SPACE_NODE); } diff --git a/source/blender/editors/space_node/space_node.c b/source/blender/editors/space_node/space_node.c index eb8c34fe8bd..1ac745b8c0e 100644 --- a/source/blender/editors/space_node/space_node.c +++ b/source/blender/editors/space_node/space_node.c @@ -98,6 +98,9 @@ static SpaceLink *node_new(const bContext *UNUSED(C)) snode= MEM_callocN(sizeof(SpaceNode), "initnode"); snode->spacetype= SPACE_NODE; + /* backdrop */ + snode->zoom = 1.0f; + /* header */ ar= MEM_callocN(sizeof(ARegion), "header for node"); @@ -172,13 +175,21 @@ static void node_area_listener(ScrArea *sa, wmNotifier *wmn) case ND_FRAME: ED_area_tag_refresh(sa); break; + case ND_TRANSFORM_DONE: + if(type==NTREE_COMPOSIT) { + if(snode->flag & SNODE_AUTO_RENDER) { + snode->recalc= 1; + ED_area_tag_refresh(sa); + } + } + break; } break; case NC_WM: if(wmn->data==ND_FILEREAD) ED_area_tag_refresh(sa); break; - + /* future: add ID checks? */ case NC_MATERIAL: if(type==NTREE_SHADER) { @@ -212,7 +223,7 @@ static void node_area_listener(ScrArea *sa, wmNotifier *wmn) case NC_IMAGE: if (wmn->action == NA_EDITED) { - if(snode->treetype==NTREE_COMPOSIT) { + if(type==NTREE_COMPOSIT) { Scene *scene= wmn->window->screen->scene; /* note that NodeTagIDChanged is alredy called by BKE_image_signal() on all @@ -241,8 +252,15 @@ static void node_area_refresh(const struct bContext *C, struct ScrArea *sa) } else if(snode->treetype==NTREE_COMPOSIT) { Scene *scene= (Scene *)snode->id; - if(scene->use_nodes) - snode_composite_job(C, sa); + if(scene->use_nodes) { + /* recalc is set on 3d view changes for auto compo */ + if(snode->recalc) { + snode->recalc= 0; + node_render_changed_exec((struct bContext*)C, NULL); + } + else + snode_composite_job(C, sa); + } } else if(snode->treetype==NTREE_TEXTURE) { Tex *tex= (Tex *)snode->id; diff --git a/source/blender/editors/space_outliner/outliner.c b/source/blender/editors/space_outliner/outliner.c index b0fe529a4c6..53aea610d42 100644 --- a/source/blender/editors/space_outliner/outliner.c +++ b/source/blender/editors/space_outliner/outliner.c @@ -1244,7 +1244,7 @@ void add_seq_dup(SpaceOops *soops, Sequence *seq, TreeElement *te, short index) } } -static int outliner_filter_has_name(TreeElement *te, char *name, int flags) +static int outliner_filter_has_name(TreeElement *te, const char *name, int flags) { #if 0 int found= 0; @@ -2109,6 +2109,16 @@ static int tree_element_active_lamp(bContext *UNUSED(C), Scene *scene, SpaceOops return 0; } +static int tree_element_active_camera(bContext *UNUSED(C), Scene *scene, SpaceOops *soops, TreeElement *te, int set) +{ + Object *ob= (Object *)outliner_search_back(soops, te, ID_OB); + + if(set) + return 0; + + return scene->camera == ob; +} + static int tree_element_active_world(bContext *C, Scene *scene, SpaceOops *soops, TreeElement *te, int set) { TreeElement *tep; @@ -2343,6 +2353,8 @@ static int tree_element_active(bContext *C, Scene *scene, SpaceOops *soops, Tree return tree_element_active_texture(C, scene, soops, te, set); case ID_TXT: return tree_element_active_text(C, scene, soops, te, set); + case ID_CA: + return tree_element_active_camera(C, scene, soops, te, set); } return 0; } diff --git a/source/blender/editors/space_script/script_header.c b/source/blender/editors/space_script/script_header.c index 545be69af54..35f3ad0596f 100644 --- a/source/blender/editors/space_script/script_header.c +++ b/source/blender/editors/space_script/script_header.c @@ -78,10 +78,10 @@ static uiBlock *dummy_viewmenu(bContext *C, ARegion *ar, void *UNUSED(arg)) return block; } -static void do_script_buttons(bContext *UNUSED(C), void *UNUSED(arg), int event) +static void do_script_buttons(bContext *UNUSED(C), void *UNUSED(arg), int UNUSED(event)) { - switch(event) { - } + //switch(event) { + //} } diff --git a/source/blender/editors/space_sequencer/sequencer_add.c b/source/blender/editors/space_sequencer/sequencer_add.c index c1e01e2ac53..24142e0b898 100644 --- a/source/blender/editors/space_sequencer/sequencer_add.c +++ b/source/blender/editors/space_sequencer/sequencer_add.c @@ -315,7 +315,7 @@ static int sequencer_add_generic_strip_exec(bContext *C, wmOperator *op, SeqLoad RNA_BEGIN(op->ptr, itemptr, "files") { RNA_string_get(&itemptr, "name", file_only); - BLI_join_dirfile(seq_load.path, dir_only, file_only); + BLI_join_dirfile(seq_load.path, sizeof(seq_load.path), dir_only, file_only); seq= seq_load_func(C, ed->seqbasep, &seq_load); } diff --git a/source/blender/editors/space_sequencer/sequencer_edit.c b/source/blender/editors/space_sequencer/sequencer_edit.c index 47dff6face4..505b38147f7 100644 --- a/source/blender/editors/space_sequencer/sequencer_edit.c +++ b/source/blender/editors/space_sequencer/sequencer_edit.c @@ -1060,8 +1060,7 @@ void seq_remap_paths(Scene *scene) BLI_strncpy(stripped, seq->strip->dir + strlen(from), FILE_MAX); /* new path */ - BLI_strncpy(seq->strip->dir, to, FILE_MAX); - strcat(seq->strip->dir, stripped); + BLI_snprintf(seq->strip->dir, sizeof(seq->strip->dir), "%s%s", to, stripped); printf("new %s\n", seq->strip->dir); } } diff --git a/source/blender/editors/space_text/text_draw.c b/source/blender/editors/space_text/text_draw.c index eb69374b5b7..6f9ad138bac 100644 --- a/source/blender/editors/space_text/text_draw.c +++ b/source/blender/editors/space_text/text_draw.c @@ -89,7 +89,7 @@ static int text_font_draw_character(SpaceText *st, int x, int y, char c) return st->cwidth; } -int text_font_width(SpaceText *UNUSED(st), char *str) +int text_font_width(SpaceText *UNUSED(st), const char *str) { return BLF_width(mono, str); } @@ -124,7 +124,7 @@ static void flatten_string_append(FlattenString *fs, char c, int accum) fs->pos++; } -int flatten_string(SpaceText *st, FlattenString *fs, char *in) +int flatten_string(SpaceText *st, FlattenString *fs, const char *in) { int r = 0, i = 0; @@ -645,7 +645,7 @@ void wrap_offset_in_line(SpaceText *st, ARegion *ar, TextLine *linein, int cursi } } -int text_get_char_pos(SpaceText *st, char *line, int cur) +int text_get_char_pos(SpaceText *st, const char *line, int cur) { int a=0, i; @@ -961,7 +961,7 @@ int text_get_visible_lines_no(SpaceText *st, int lineno) return drawcache->line_height[lineno]; } -int text_get_visible_lines(SpaceText *st, ARegion *ar, char *str) +int text_get_visible_lines(SpaceText *st, ARegion *ar, const char *str) { int i, j, start, end, max, lines, chars; char ch; diff --git a/source/blender/editors/space_text/text_intern.h b/source/blender/editors/space_text/text_intern.h index cc957141ed2..5f6b2e05ba7 100644 --- a/source/blender/editors/space_text/text_intern.h +++ b/source/blender/editors/space_text/text_intern.h @@ -45,7 +45,7 @@ struct wmWindowManager; void draw_text_main(struct SpaceText *st, struct ARegion *ar); int text_font_width_character(struct SpaceText *st); -int text_font_width(struct SpaceText *st, char *str); +int text_font_width(struct SpaceText *st, const char *str); void text_update_line_edited(struct TextLine *line); void text_update_edited(struct Text *text); @@ -79,13 +79,13 @@ typedef struct FlattenString { int pos, len; } FlattenString; -int flatten_string(struct SpaceText *st, FlattenString *fs, char *in); +int flatten_string(struct SpaceText *st, FlattenString *fs, const char *in); void flatten_string_free(FlattenString *fs); int wrap_width(struct SpaceText *st, struct ARegion *ar); void wrap_offset(struct SpaceText *st, struct ARegion *ar, struct TextLine *linein, int cursin, int *offl, int *offc); void wrap_offset_in_line(struct SpaceText *st, struct ARegion *ar, struct TextLine *linep, int cursin, int *offl, int *offc); -int text_get_char_pos(struct SpaceText *st, char *line, int cur); +int text_get_char_pos(struct SpaceText *st, const char *line, int cur); void text_drawcache_tag_update(struct SpaceText *st, int full); void text_free_caches(struct SpaceText *st); @@ -95,7 +95,7 @@ int text_file_modified(struct Text *text); int text_do_suggest_select(struct SpaceText *st, struct ARegion *ar); void text_pop_suggest_list(void); -int text_get_visible_lines(struct SpaceText *st, struct ARegion *ar, char *str); +int text_get_visible_lines(struct SpaceText *st, struct ARegion *ar, const char *str); int text_get_span_wrap(struct SpaceText *st, struct ARegion *ar, struct TextLine *from, struct TextLine *to); int text_get_total_lines(struct SpaceText *st, struct ARegion *ar); diff --git a/source/blender/editors/space_text/text_ops.c b/source/blender/editors/space_text/text_ops.c index efb0b173559..bfec734dad6 100644 --- a/source/blender/editors/space_text/text_ops.c +++ b/source/blender/editors/space_text/text_ops.c @@ -124,7 +124,6 @@ static int text_region_edit_poll(bContext *C) return 1; } - /********************** updates *********************/ void text_update_line_edited(TextLine *line) @@ -342,6 +341,12 @@ void TEXT_OT_reload(wmOperatorType *ot) /******************* delete operator *********************/ +static int text_unlink_poll(bContext *C) +{ + /* it should be possible to unlink texts if they're lib-linked in... */ + return CTX_data_edit_text(C) != NULL; +} + static int unlink_exec(bContext *C, wmOperator *UNUSED(op)) { Main *bmain= CTX_data_main(C); @@ -381,7 +386,7 @@ void TEXT_OT_unlink(wmOperatorType *ot) /* api callbacks */ ot->exec= unlink_exec; ot->invoke= WM_operator_confirm; - ot->poll= text_edit_poll; + ot->poll= text_unlink_poll; /* flags */ ot->flag= OPTYPE_UNDO; @@ -2019,6 +2024,12 @@ typedef struct TextScroll { int zone; } TextScroll; +static int text_scroll_poll(bContext *C) +{ + /* it should be possible to still scroll linked texts to read them, even if they can't be edited... */ + return CTX_data_edit_text(C) != NULL; +} + static int scroll_exec(bContext *C, wmOperator *op) { SpaceText *st= CTX_wm_space_text(C); @@ -2183,7 +2194,7 @@ void TEXT_OT_scroll(wmOperatorType *ot) ot->invoke= scroll_invoke; ot->modal= scroll_modal; ot->cancel= scroll_cancel; - ot->poll= text_space_edit_poll; + ot->poll= text_scroll_poll; /* flags */ ot->flag= OPTYPE_BLOCKING|OPTYPE_GRAB_POINTER; @@ -2194,6 +2205,22 @@ void TEXT_OT_scroll(wmOperatorType *ot) /******************** scroll bar operator *******************/ +static int text_region_scroll_poll(bContext *C) +{ + /* same as text_region_edit_poll except it works on libdata too */ + SpaceText *st= CTX_wm_space_text(C); + Text *text= CTX_data_edit_text(C); + ARegion *ar= CTX_wm_region(C); + + if(!st || !text) + return 0; + + if(!ar || ar->regiontype != RGN_TYPE_WINDOW) + return 0; + + return 1; +} + static int scroll_bar_invoke(bContext *C, wmOperator *op, wmEvent *event) { SpaceText *st= CTX_wm_space_text(C); @@ -2249,7 +2276,7 @@ void TEXT_OT_scroll_bar(wmOperatorType *ot) ot->invoke= scroll_bar_invoke; ot->modal= scroll_modal; ot->cancel= scroll_cancel; - ot->poll= text_region_edit_poll; + ot->poll= text_region_scroll_poll; /* flags */ ot->flag= OPTYPE_BLOCKING; diff --git a/source/blender/editors/space_text/text_python.c b/source/blender/editors/space_text/text_python.c index 1c75e6f65ca..e6f201e4147 100644 --- a/source/blender/editors/space_text/text_python.c +++ b/source/blender/editors/space_text/text_python.c @@ -98,7 +98,7 @@ int text_do_suggest_select(SpaceText *st, ARegion *ar) return 1; } -void text_pop_suggest_list() +void text_pop_suggest_list(void) { SuggItem *item, *sel; int *top, i; diff --git a/source/blender/editors/space_view3d/drawmesh.c b/source/blender/editors/space_view3d/drawmesh.c index caac8d1d9fe..5c2adc10d85 100644 --- a/source/blender/editors/space_view3d/drawmesh.c +++ b/source/blender/editors/space_view3d/drawmesh.c @@ -340,7 +340,7 @@ static int set_draw_settings_cached(int clearcache, int textured, MTFace *texfac /* Icky globals, fix with userdata parameter */ -struct TextureDrawState { +static struct TextureDrawState { Object *ob; int islit, istex; int color_profile; diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c index 8724f2f9def..c90c301b6d1 100644 --- a/source/blender/editors/space_view3d/drawobject.c +++ b/source/blender/editors/space_view3d/drawobject.c @@ -573,7 +573,7 @@ typedef struct ViewCachedString { /* str is allocated past the end */ } ViewCachedString; -void view3d_cached_text_draw_begin() +void view3d_cached_text_draw_begin(void) { ListBase *strings= &CachedText[CachedTextLevel]; strings->first= strings->last= NULL; @@ -4070,8 +4070,14 @@ static void draw_new_particle_system(Scene *scene, View3D *v3d, RegionView3D *rv psys->lattice= NULL; } - if( (base->flag & OB_FROMDUPLI) && (ob->flag & OB_FROMGROUP) ) + if(pdd) { + /* drop references to stack memory */ + pdd->ma_r= pdd->ma_g= pdd->ma_b= NULL; + } + + if( (base->flag & OB_FROMDUPLI) && (ob->flag & OB_FROMGROUP) ) { glLoadMatrixf(rv3d->viewmat); + } } static void draw_update_ptcache_edit(Scene *scene, Object *ob, PTCacheEdit *edit) @@ -5362,7 +5368,7 @@ static void draw_bb_quadric(BoundBox *bb, short type) static void draw_bounding_volume(Scene *scene, Object *ob) { - BoundBox *bb=0; + BoundBox *bb= NULL; if(ob->type==OB_MESH) { bb= mesh_get_bb(ob); @@ -5373,7 +5379,7 @@ static void draw_bounding_volume(Scene *scene, Object *ob) else if(ob->type==OB_MBALL) { if(is_basis_mball(ob)) { bb= ob->bb; - if(bb==0) { + if(bb==NULL) { makeDispListMBall(scene, ob); bb= ob->bb; } @@ -5384,7 +5390,7 @@ static void draw_bounding_volume(Scene *scene, Object *ob) return; } - if(bb==0) return; + if(bb==NULL) return; if(ob->boundtype==OB_BOUND_BOX) draw_box(bb->vec); else draw_bb_quadric(bb, ob->boundtype); @@ -5552,8 +5558,7 @@ static void draw_hooks(Object *ob) } } -//<rcruiz> -void drawRBpivot(bRigidBodyJointConstraint *data) +static void drawRBpivot(bRigidBodyJointConstraint *data) { int axis; float mat[4][4]; diff --git a/source/blender/editors/space_view3d/drawvolume.c b/source/blender/editors/space_view3d/drawvolume.c index 0f6e0bdc834..1479dc950c9 100644 --- a/source/blender/editors/space_view3d/drawvolume.c +++ b/source/blender/editors/space_view3d/drawvolume.c @@ -126,7 +126,7 @@ static double tval() struct GPUTexture; -int intersect_edges(float *points, float a, float b, float c, float d, float edges[12][2][3]) +static int intersect_edges(float *points, float a, float b, float c, float d, float edges[12][2][3]) { int i; float t; diff --git a/source/blender/editors/space_view3d/space_view3d.c b/source/blender/editors/space_view3d/space_view3d.c index 9ec68d62364..f7ccebda6ae 100644 --- a/source/blender/editors/space_view3d/space_view3d.c +++ b/source/blender/editors/space_view3d/space_view3d.c @@ -43,6 +43,7 @@ #include "BKE_context.h" #include "BKE_screen.h" +#include "ED_space_api.h" #include "ED_screen.h" #include "ED_object.h" @@ -910,7 +911,7 @@ static void view3d_props_area_listener(ARegion *ar, wmNotifier *wmn) } /*area (not region) level listener*/ -void space_view3d_listener(struct ScrArea *sa, struct wmNotifier *wmn) +static void space_view3d_listener(struct ScrArea *sa, struct wmNotifier *wmn) { View3D *v3d = sa->spacedata.first; diff --git a/source/blender/editors/space_view3d/view3d_buttons.c b/source/blender/editors/space_view3d/view3d_buttons.c index 53a4981661f..cefe0254ae4 100644 --- a/source/blender/editors/space_view3d/view3d_buttons.c +++ b/source/blender/editors/space_view3d/view3d_buttons.c @@ -709,7 +709,7 @@ static void do_view3d_vgroup_buttons(bContext *C, void *UNUSED(arg), int event) WM_event_add_notifier(C, NC_GEOM|ND_DATA, ob->data); } -int view3d_panel_vgroup_poll(const bContext *C, PanelType *UNUSED(pt)) +static int view3d_panel_vgroup_poll(const bContext *C, PanelType *UNUSED(pt)) { Scene *scene= CTX_data_scene(C); Object *ob= OBACT; @@ -925,7 +925,7 @@ static void v3d_posearmature_buts(uiLayout *layout, Object *ob) } /* assumes armature editmode */ -void validate_editbonebutton_cb(bContext *C, void *bonev, void *namev) +static void validate_editbonebutton_cb(bContext *C, void *bonev, void *namev) { EditBone *eBone= bonev; char oldname[sizeof(eBone->name)], newname[sizeof(eBone->name)]; @@ -1199,12 +1199,12 @@ static void do_view3d_region_buttons(bContext *C, void *UNUSED(index), int event WM_event_add_notifier(C, NC_SPACE|ND_SPACE_VIEW3D, ob); } -void removeTransformOrientation_func(bContext *C, void *target, void *UNUSED(arg)) +static void removeTransformOrientation_func(bContext *C, void *target, void *UNUSED(arg)) { BIF_removeTransformOrientation(C, (TransformOrientation *) target); } -void selectTransformOrientation_func(bContext *C, void *target, void *UNUSED(arg)) +static void selectTransformOrientation_func(bContext *C, void *target, void *UNUSED(arg)) { BIF_selectTransformOrientation(C, (TransformOrientation *) target); } diff --git a/source/blender/editors/space_view3d/view3d_draw.c b/source/blender/editors/space_view3d/view3d_draw.c index 52f4697bad1..58adb9aad43 100644 --- a/source/blender/editors/space_view3d/view3d_draw.c +++ b/source/blender/editors/space_view3d/view3d_draw.c @@ -917,7 +917,7 @@ void view3d_calc_camera_border(Scene *scene, ARegion *ar, RegionView3D *rv3d, Vi } } -void view3d_set_1_to_1_viewborder(Scene *scene, ARegion *ar) +static void view3d_set_1_to_1_viewborder(Scene *scene, ARegion *ar) { RegionView3D *rv3d= ar->regiondata; float size[2]; diff --git a/source/blender/editors/space_view3d/view3d_edit.c b/source/blender/editors/space_view3d/view3d_edit.c index bc9c41f3add..76bd590bd3c 100644 --- a/source/blender/editors/space_view3d/view3d_edit.c +++ b/source/blender/editors/space_view3d/view3d_edit.c @@ -2777,7 +2777,7 @@ int view_autodist_depth_segment(struct ARegion *ar, short mval_sta[2], short mva // those are still not ok -float ndof_axis_scale[6] = { +static float ndof_axis_scale[6] = { +0.01, // Tx +0.01, // Tz +0.01, // Ty @@ -2786,7 +2786,7 @@ float ndof_axis_scale[6] = { +0.0015 // Ry }; -void filterNDOFvalues(float *sbval) +static void filterNDOFvalues(float *sbval) { int i=0; float max = 0.0; @@ -2799,6 +2799,7 @@ void filterNDOFvalues(float *sbval) sbval[i]=0.0; } +#if 0 // statics for controlling rv3d->dist corrections. // viewmoveNDOF zeros and adjusts rv3d->ofs. // viewmove restores based on dz_flag state. @@ -3139,6 +3140,7 @@ void viewmoveNDOF(Scene *scene, ARegion *ar, View3D *v3d, int UNUSED(mode)) */ // XXX scrarea_do_windraw(curarea); } +#endif // if 0, unused NDof code /* give a 4x4 matrix from a perspective view, only needs viewquat, ofs and dist * basically the same as... diff --git a/source/blender/editors/space_view3d/view3d_header.c b/source/blender/editors/space_view3d/view3d_header.c index a481fdb59f6..2ee4f7a9e55 100644 --- a/source/blender/editors/space_view3d/view3d_header.c +++ b/source/blender/editors/space_view3d/view3d_header.c @@ -137,7 +137,7 @@ static void handle_view3d_lock(bContext *C) } } -static int layers_exec(bContext *C, wmOperator *op) +static int view3d_layers_exec(bContext *C, wmOperator *op) { Main *bmain= CTX_data_main(C); Scene *scene= CTX_data_scene(C); @@ -210,7 +210,7 @@ static int layers_exec(bContext *C, wmOperator *op) /* applies shift and alt, lazy coding or ok? :) */ /* the local per-keymap-entry keymap will solve it */ -static int layers_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int view3d_layers_invoke(bContext *C, wmOperator *op, wmEvent *event) { if(event->ctrl || event->oskey) return OPERATOR_PASS_THROUGH; @@ -222,12 +222,12 @@ static int layers_invoke(bContext *C, wmOperator *op, wmEvent *event) int nr= RNA_int_get(op->ptr, "nr") + 10; RNA_int_set(op->ptr, "nr", nr); } - layers_exec(C, op); + view3d_layers_exec(C, op); return OPERATOR_FINISHED; } -int layers_poll(bContext *C) +static int view3d_layers_poll(bContext *C) { return (ED_operator_view3d_active(C) && CTX_wm_view3d(C)->localvd==NULL); } @@ -240,9 +240,9 @@ void VIEW3D_OT_layers(wmOperatorType *ot) ot->idname= "VIEW3D_OT_layers"; /* api callbacks */ - ot->invoke= layers_invoke; - ot->exec= layers_exec; - ot->poll= layers_poll; + ot->invoke= view3d_layers_invoke; + ot->exec= view3d_layers_exec; + ot->poll= view3d_layers_poll; /* flags */ ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; diff --git a/source/blender/editors/space_view3d/view3d_select.c b/source/blender/editors/space_view3d/view3d_select.c index f85bdc437f3..70d77f4e489 100644 --- a/source/blender/editors/space_view3d/view3d_select.c +++ b/source/blender/editors/space_view3d/view3d_select.c @@ -137,7 +137,7 @@ void view3d_get_transformation(ARegion *ar, RegionView3D *rv3d, Object *ob, bglM /* local prototypes */ -void EM_backbuf_checkAndSelectVerts(EditMesh *em, int select) +static void EM_backbuf_checkAndSelectVerts(EditMesh *em, int select) { EditVert *eve; int index= em_wireoffs; @@ -151,7 +151,7 @@ void EM_backbuf_checkAndSelectVerts(EditMesh *em, int select) } } -void EM_backbuf_checkAndSelectEdges(EditMesh *em, int select) +static void EM_backbuf_checkAndSelectEdges(EditMesh *em, int select) { EditEdge *eed; int index= em_solidoffs; @@ -165,7 +165,7 @@ void EM_backbuf_checkAndSelectEdges(EditMesh *em, int select) } } -void EM_backbuf_checkAndSelectFaces(EditMesh *em, int select) +static void EM_backbuf_checkAndSelectFaces(EditMesh *em, int select) { EditFace *efa; int index= 1; @@ -179,7 +179,7 @@ void EM_backbuf_checkAndSelectFaces(EditMesh *em, int select) } } -void EM_backbuf_checkAndSelectTFaces(Mesh *me, int select) +static void EM_backbuf_checkAndSelectTFaces(Mesh *me, int select) { MFace *mface = me->mface; int a; diff --git a/source/blender/editors/space_view3d/view3d_view.c b/source/blender/editors/space_view3d/view3d_view.c index 7ed85cacc1e..04f9f2d11d4 100644 --- a/source/blender/editors/space_view3d/view3d_view.c +++ b/source/blender/editors/space_view3d/view3d_view.c @@ -427,7 +427,7 @@ static int view3d_setcameratoview_exec(bContext *C, wmOperator *UNUSED(op)) } -int view3d_setcameratoview_poll(bContext *C) +static int view3d_setcameratoview_poll(bContext *C) { View3D *v3d = CTX_wm_view3d(C); RegionView3D *rv3d= CTX_wm_region_view3d(C); @@ -1734,7 +1734,7 @@ extern void StartKetsjiShell(struct bContext *C, struct ARegion *ar, rcti *cam_f #endif // WITH_GAMEENGINE -int game_engine_poll(bContext *C) +static int game_engine_poll(bContext *C) { /* we need a context and area to launch BGE it's a temporary solution to avoid crash at load time diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c index ee54a892ec4..e95361c0d91 100644 --- a/source/blender/editors/transform/transform.c +++ b/source/blender/editors/transform/transform.c @@ -338,7 +338,7 @@ static void viewRedrawForce(const bContext *C, TransInfo *t) } } -static void viewRedrawPost(TransInfo *t) +static void viewRedrawPost(bContext *C, TransInfo *t) { ED_area_headerprint(t->sa, NULL); @@ -346,6 +346,10 @@ static void viewRedrawPost(TransInfo *t) /* if autokeying is enabled, send notifiers that keyframes were added */ if (IS_AUTOKEY_ON(t->scene)) WM_main_add_notifier(NC_ANIMATION|ND_KEYFRAME|NA_EDITED, NULL); + + /* XXX temp, first hack to get auto-render in compositor work (ton) */ + WM_event_add_notifier(C, NC_SCENE|ND_TRANSFORM_DONE, CTX_data_scene(C)); + } #if 0 // TRANSFORM_FIX_ME @@ -372,7 +376,7 @@ static void viewRedrawPost(TransInfo *t) /* ************************** TRANSFORMATIONS **************************** */ -void BIF_selectOrientation() { +void BIF_selectOrientation(void) { #if 0 // TRANSFORM_FIX_ME short val; char *str_menu = BIF_menustringTransformOrientation("Orientation"); @@ -1366,7 +1370,7 @@ static void drawHelpline(bContext *UNUSED(C), int x, int y, void *customdata) } } -void drawTransformView(const struct bContext *C, struct ARegion *UNUSED(ar), void *arg) +static void drawTransformView(const struct bContext *C, struct ARegion *UNUSED(ar), void *arg) { TransInfo *t = arg; @@ -1375,7 +1379,7 @@ void drawTransformView(const struct bContext *C, struct ARegion *UNUSED(ar), voi drawSnapping(C, t); } -void drawTransformPixel(const struct bContext *UNUSED(C), struct ARegion *UNUSED(ar), void *UNUSED(arg)) +static void drawTransformPixel(const struct bContext *UNUSED(C), struct ARegion *UNUSED(ar), void *UNUSED(arg)) { // TransInfo *t = arg; // @@ -1817,7 +1821,7 @@ int transformEnd(bContext *C, TransInfo *t) postTrans(C, t); /* send events out for redraws */ - viewRedrawPost(t); + viewRedrawPost(C, t); /* Undo as last, certainly after special_trans_update! */ @@ -2521,6 +2525,7 @@ void initResize(TransInfo *t) static void headerResize(TransInfo *t, float vec[3], char *str) { char tvec[60]; + char *spos= str; if (hasNumInput(&t->num)) { outputNumInput(&(t->num), tvec); } @@ -2533,24 +2538,27 @@ static void headerResize(TransInfo *t, float vec[3], char *str) { if (t->con.mode & CON_APPLY) { switch(t->num.idx_max) { case 0: - sprintf(str, "Scale: %s%s %s", &tvec[0], t->con.text, t->proptext); + spos += sprintf(spos, "Scale: %s%s %s", &tvec[0], t->con.text, t->proptext); break; case 1: - sprintf(str, "Scale: %s : %s%s %s", &tvec[0], &tvec[20], t->con.text, t->proptext); + spos += sprintf(spos, "Scale: %s : %s%s %s", &tvec[0], &tvec[20], t->con.text, t->proptext); break; case 2: - sprintf(str, "Scale: %s : %s : %s%s %s", &tvec[0], &tvec[20], &tvec[40], t->con.text, t->proptext); + spos += sprintf(spos, "Scale: %s : %s : %s%s %s", &tvec[0], &tvec[20], &tvec[40], t->con.text, t->proptext); } } else { if (t->flag & T_2D_EDIT) - sprintf(str, "Scale X: %s Y: %s%s %s", &tvec[0], &tvec[20], t->con.text, t->proptext); + spos += sprintf(spos, "Scale X: %s Y: %s%s %s", &tvec[0], &tvec[20], t->con.text, t->proptext); else - sprintf(str, "Scale X: %s Y: %s Z: %s%s %s", &tvec[0], &tvec[20], &tvec[40], t->con.text, t->proptext); + spos += sprintf(spos, "Scale X: %s Y: %s Z: %s%s %s", &tvec[0], &tvec[20], &tvec[40], t->con.text, t->proptext); } - if (t->flag & (T_PROP_EDIT|T_PROP_CONNECTED)) - sprintf(str, "%s Proportional size: %.2f", str, t->prop_size); + if (t->flag & (T_PROP_EDIT|T_PROP_CONNECTED)) { + spos += sprintf(spos, " Proportional size: %.2f", t->prop_size); + } + + (void)spos; } #define SIGN(a) (a<-FLT_EPSILON?1:a>FLT_EPSILON?2:3) @@ -2917,7 +2925,7 @@ static void ElementRotation(TransInfo *t, TransData *td, float mat[3][3], short if(td->flag & TD_USEQUAT) { - mul_serie_m3(fmat, td->mtx, mat, td->smtx, 0, 0, 0, 0, 0); + mul_serie_m3(fmat, td->mtx, mat, td->smtx, NULL, NULL, NULL, NULL, NULL); mat3_to_quat( quat,fmat); // Actual transform if(td->ext->quat){ @@ -2984,7 +2992,7 @@ static void ElementRotation(TransInfo *t, TransData *td, float mat[3][3], short if ((t->flag & T_V3D_ALIGN)==0) { // align mode doesn't rotate objects itself /* euler or quaternion/axis-angle? */ if (td->ext->rotOrder == ROT_MODE_QUAT) { - mul_serie_m3(fmat, td->mtx, mat, td->smtx, 0, 0, 0, 0, 0); + mul_serie_m3(fmat, td->mtx, mat, td->smtx, NULL, NULL, NULL, NULL, NULL); mat3_to_quat( quat,fmat); // Actual transform @@ -2999,7 +3007,7 @@ static void ElementRotation(TransInfo *t, TransData *td, float mat[3][3], short axis_angle_to_quat(iquat, td->ext->irotAxis, td->ext->irotAngle); - mul_serie_m3(fmat, td->mtx, mat, td->smtx, 0, 0, 0, 0, 0); + mul_serie_m3(fmat, td->mtx, mat, td->smtx, NULL, NULL, NULL, NULL, NULL); mat3_to_quat( quat,fmat); // Actual transform mul_qt_qtqt(tquat, quat, iquat); @@ -3054,7 +3062,7 @@ static void ElementRotation(TransInfo *t, TransData *td, float mat[3][3], short if ((t->flag & T_V3D_ALIGN)==0) { // align mode doesn't rotate objects itself /* euler or quaternion? */ if ((td->ext->rotOrder == ROT_MODE_QUAT) || (td->flag & TD_USEQUAT)) { - mul_serie_m3(fmat, td->mtx, mat, td->smtx, 0, 0, 0, 0, 0); + mul_serie_m3(fmat, td->mtx, mat, td->smtx, NULL, NULL, NULL, NULL, NULL); mat3_to_quat( quat,fmat); // Actual transform mul_qt_qtqt(td->ext->quat, quat, td->ext->iquat); @@ -3067,7 +3075,7 @@ static void ElementRotation(TransInfo *t, TransData *td, float mat[3][3], short axis_angle_to_quat(iquat, td->ext->irotAxis, td->ext->irotAngle); - mul_serie_m3(fmat, td->mtx, mat, td->smtx, 0, 0, 0, 0, 0); + mul_serie_m3(fmat, td->mtx, mat, td->smtx, NULL, NULL, NULL, NULL, NULL); mat3_to_quat( quat,fmat); // Actual transform mul_qt_qtqt(tquat, quat, iquat); diff --git a/source/blender/editors/transform/transform_conversions.c b/source/blender/editors/transform/transform_conversions.c index 86da5e0a4b5..bbadce5369d 100644 --- a/source/blender/editors/transform/transform_conversions.c +++ b/source/blender/editors/transform/transform_conversions.c @@ -85,6 +85,7 @@ #include "ED_types.h" #include "ED_uvedit.h" #include "ED_curve.h" /* for ED_curve_editnurbs */ +#include "ED_util.h" /* for crazyspace correction */ #include "UI_view2d.h" @@ -573,16 +574,16 @@ static void add_pose_transdata(TransInfo *t, bPoseChannel *pchan, Object *ob, Tr if (constraints_list_needinv(t, &pchan->constraints)) { copy_m3_m4(tmat, pchan->constinv); invert_m3_m3(cmat, tmat); - mul_serie_m3(td->mtx, bmat, pmat, omat, cmat, 0,0,0,0); // dang mulserie swaps args + mul_serie_m3(td->mtx, bmat, pmat, omat, cmat, NULL,NULL,NULL,NULL); // dang mulserie swaps args } else - mul_serie_m3(td->mtx, bmat, pmat, omat, 0,0,0,0,0); // dang mulserie swaps args + mul_serie_m3(td->mtx, bmat, pmat, omat, NULL,NULL,NULL,NULL,NULL); // dang mulserie swaps args } else { if (constraints_list_needinv(t, &pchan->constraints)) { copy_m3_m4(tmat, pchan->constinv); invert_m3_m3(cmat, tmat); - mul_serie_m3(td->mtx, bmat, omat, cmat, 0,0,0,0,0); // dang mulserie swaps args + mul_serie_m3(td->mtx, bmat, omat, cmat, NULL,NULL,NULL,NULL,NULL); // dang mulserie swaps args } else mul_m3_m3m3(td->mtx, omat, bmat); // Mat3MulMat3 has swapped args! @@ -1940,147 +1941,6 @@ static void VertsToTransData(TransInfo *t, TransData *td, EditMesh *em, EditVert } } -/* *********************** CrazySpace correction. Now without doing subsurf optimal ****************** */ - -static void make_vertexcos__mapFunc(void *userData, int index, float *co, float *UNUSED(no_f), short *UNUSED(no_s)) -{ - float *vec = userData; - - vec+= 3*index; - VECCOPY(vec, co); -} - -static int modifiers_disable_subsurf_temporary(Object *ob) -{ - ModifierData *md; - int disabled = 0; - - for(md=ob->modifiers.first; md; md=md->next) - if(md->type==eModifierType_Subsurf) - if(md->mode & eModifierMode_OnCage) { - md->mode ^= eModifierMode_DisableTemporary; - disabled= 1; - } - - return disabled; -} - -/* disable subsurf temporal, get mapped cos, and enable it */ -static float *get_crazy_mapped_editverts(TransInfo *t) -{ - Mesh *me= t->obedit->data; - DerivedMesh *dm; - float *vertexcos; - - /* disable subsurf temporal, get mapped cos, and enable it */ - if(modifiers_disable_subsurf_temporary(t->obedit)) { - /* need to make new derivemesh */ - makeDerivedMesh(t->scene, t->obedit, me->edit_mesh, CD_MASK_BAREMESH); - } - - /* now get the cage */ - dm= editmesh_get_derived_cage(t->scene, t->obedit, me->edit_mesh, CD_MASK_BAREMESH); - - vertexcos= MEM_mallocN(3*sizeof(float)*me->edit_mesh->totvert, "vertexcos map"); - dm->foreachMappedVert(dm, make_vertexcos__mapFunc, vertexcos); - - dm->release(dm); - - /* set back the flag, no new cage needs to be built, transform does it */ - modifiers_disable_subsurf_temporary(t->obedit); - - return vertexcos; -} - -#define TAN_MAKE_VEC(a, b, c) a[0]= b[0] + 0.2f*(b[0]-c[0]); a[1]= b[1] + 0.2f*(b[1]-c[1]); a[2]= b[2] + 0.2f*(b[2]-c[2]) -static void set_crazy_vertex_quat(float *quat, float *v1, float *v2, float *v3, float *def1, float *def2, float *def3) -{ - float vecu[3], vecv[3]; - float q1[4], q2[4]; - - TAN_MAKE_VEC(vecu, v1, v2); - TAN_MAKE_VEC(vecv, v1, v3); - tri_to_quat( q1,v1, vecu, vecv); - - TAN_MAKE_VEC(vecu, def1, def2); - TAN_MAKE_VEC(vecv, def1, def3); - tri_to_quat( q2,def1, vecu, vecv); - - sub_qt_qtqt(quat, q2, q1); -} -#undef TAN_MAKE_VEC - -static void set_crazyspace_quats(EditMesh *em, float *origcos, float *mappedcos, float *quats) -{ - EditVert *eve, *prev; - EditFace *efa; - float *v1, *v2, *v3, *v4, *co1, *co2, *co3, *co4; - intptr_t index= 0; - - /* two abused locations in vertices */ - for(eve= em->verts.first; eve; eve= eve->next, index++) { - eve->tmp.p = NULL; - eve->prev= (EditVert *)index; - } - - /* first store two sets of tangent vectors in vertices, we derive it just from the face-edges */ - for(efa= em->faces.first; efa; efa= efa->next) { - - /* retrieve mapped coordinates */ - v1= mappedcos + 3*(intptr_t)(efa->v1->prev); - v2= mappedcos + 3*(intptr_t)(efa->v2->prev); - v3= mappedcos + 3*(intptr_t)(efa->v3->prev); - - co1= (origcos)? origcos + 3*(intptr_t)(efa->v1->prev): efa->v1->co; - co2= (origcos)? origcos + 3*(intptr_t)(efa->v2->prev): efa->v2->co; - co3= (origcos)? origcos + 3*(intptr_t)(efa->v3->prev): efa->v3->co; - - if(efa->v2->tmp.p==NULL && efa->v2->f1) { - set_crazy_vertex_quat(quats, co2, co3, co1, v2, v3, v1); - efa->v2->tmp.p= (void*)quats; - quats+= 4; - } - - if(efa->v4) { - v4= mappedcos + 3*(intptr_t)(efa->v4->prev); - co4= (origcos)? origcos + 3*(intptr_t)(efa->v4->prev): efa->v4->co; - - if(efa->v1->tmp.p==NULL && efa->v1->f1) { - set_crazy_vertex_quat(quats, co1, co2, co4, v1, v2, v4); - efa->v1->tmp.p= (void*)quats; - quats+= 4; - } - if(efa->v3->tmp.p==NULL && efa->v3->f1) { - set_crazy_vertex_quat(quats, co3, co4, co2, v3, v4, v2); - efa->v3->tmp.p= (void*)quats; - quats+= 4; - } - if(efa->v4->tmp.p==NULL && efa->v4->f1) { - set_crazy_vertex_quat(quats, co4, co1, co3, v4, v1, v3); - efa->v4->tmp.p= (void*)quats; - quats+= 4; - } - } - else { - if(efa->v1->tmp.p==NULL && efa->v1->f1) { - set_crazy_vertex_quat(quats, co1, co2, co3, v1, v2, v3); - efa->v1->tmp.p= (void*)quats; - quats+= 4; - } - if(efa->v3->tmp.p==NULL && efa->v3->f1) { - set_crazy_vertex_quat(quats, co3, co1, co2, v3, v1, v2); - efa->v3->tmp.p= (void*)quats; - quats+= 4; - } - } - } - - /* restore abused prev pointer */ - for(prev= NULL, eve= em->verts.first; eve; prev= eve, eve= eve->next) - eve->prev= prev; - -} - void createTransBMeshVerts(TransInfo *t, BME_Mesh *bm, BME_TransData_Head *td) { BME_Vert *v; BME_TransData *vtd; @@ -2200,9 +2060,9 @@ static void createTransEditVerts(bContext *C, TransInfo *t) correction with quats, relative to the coordinates after the modifiers that support deform matrices (defcos) */ if(totleft > 0) { - mappedcos= get_crazy_mapped_editverts(t); + mappedcos= crazyspace_get_mapped_editverts(t->scene, t->obedit); quats= MEM_mallocN( (t->total)*sizeof(float)*4, "crazy quats"); - set_crazyspace_quats(em, (float*)defcos, mappedcos, quats); + crazyspace_set_quats_editmesh(em, (float*)defcos, mappedcos, quats); if(mappedcos) MEM_freeN(mappedcos); } diff --git a/source/blender/editors/transform/transform_snap.c b/source/blender/editors/transform/transform_snap.c index 089f192cdc8..93403ea5817 100644 --- a/source/blender/editors/transform/transform_snap.c +++ b/source/blender/editors/transform/transform_snap.c @@ -106,17 +106,19 @@ float ResizeBetween(TransInfo *t, float p1[3], float p2[3]); /****************** IMPLEMENTATIONS *********************/ +#if 0 int BIF_snappingSupported(Object *obedit) { int status = 0; - if (obedit == NULL || ELEM3(obedit->type, OB_MESH, OB_ARMATURE, OB_CURVE)) /* only support object mesh, armature, curves */ + if (obedit == NULL || ELEM4(obedit->type, OB_MESH, OB_ARMATURE, OB_CURVE, OB_LATTICE)) /* only support object mesh, armature, curves */ { status = 1; } return status; } +#endif int validSnap(TransInfo *t) { @@ -374,7 +376,7 @@ void initSnappingMode(TransInfo *t) /* Edit mode */ if (t->tsnap.applySnap != NULL && // A snapping function actually exist - (obedit != NULL && ELEM3(obedit->type, OB_MESH, OB_ARMATURE, OB_CURVE)) ) // Temporary limited to edit mode meshes, armature, curves + (obedit != NULL && ELEM4(obedit->type, OB_MESH, OB_ARMATURE, OB_CURVE, OB_LATTICE)) ) // Temporary limited to edit mode meshes, armature, curves { /* editmode meshes now supported */ if ((obedit->type != OB_MESH) && ((t->flag & T_PROP_EDIT) || t->tsnap.project)) /* also exclude edit for project, for now */ diff --git a/source/blender/editors/util/CMakeLists.txt b/source/blender/editors/util/CMakeLists.txt index a2e0525cb0e..38c0dd7f0ba 100644 --- a/source/blender/editors/util/CMakeLists.txt +++ b/source/blender/editors/util/CMakeLists.txt @@ -34,6 +34,7 @@ set(SRC editmode_undo.c numinput.c undo.c + crazyspace.c util_intern.h # general includes diff --git a/source/blender/editors/util/crazyspace.c b/source/blender/editors/util/crazyspace.c new file mode 100644 index 00000000000..8b03f1826e4 --- /dev/null +++ b/source/blender/editors/util/crazyspace.c @@ -0,0 +1,394 @@ +/** + * $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) 2005 Blender Foundation. + * All rights reserved. + * + * + * Contributor(s): Blender Foundation, + * Sergey Sharybin + * + * ***** END GPL LICENSE BLOCK ***** + */ + +#include "MEM_guardedalloc.h" + +#include "DNA_scene_types.h" +#include "DNA_object_types.h" +#include "DNA_modifier_types.h" +#include "DNA_meshdata_types.h" + +#include "BKE_DerivedMesh.h" +#include "BKE_modifier.h" +#include "BKE_multires.h" +#include "BKE_mesh.h" + +#include "BLI_utildefines.h" +#include "BLI_math.h" +#include "BLI_editVert.h" + +#define TAN_MAKE_VEC(a, b, c) a[0]= b[0] + 0.2f*(b[0]-c[0]); a[1]= b[1] + 0.2f*(b[1]-c[1]); a[2]= b[2] + 0.2f*(b[2]-c[2]) +static void set_crazy_vertex_quat(float *quat, float *v1, float *v2, float *v3, float *def1, float *def2, float *def3) +{ + float vecu[3], vecv[3]; + float q1[4], q2[4]; + + TAN_MAKE_VEC(vecu, v1, v2); + TAN_MAKE_VEC(vecv, v1, v3); + tri_to_quat( q1,v1, vecu, vecv); + + TAN_MAKE_VEC(vecu, def1, def2); + TAN_MAKE_VEC(vecv, def1, def3); + tri_to_quat( q2,def1, vecu, vecv); + + sub_qt_qtqt(quat, q2, q1); +} +#undef TAN_MAKE_VEC + +static void make_vertexcos__mapFunc(void *userData, int index, float *co, float *UNUSED(no_f), short *UNUSED(no_s)) +{ + float *vec = userData; + + vec+= 3*index; + VECCOPY(vec, co); +} + +static int modifiers_disable_subsurf_temporary(Object *ob) +{ + ModifierData *md; + int disabled = 0; + + for(md=ob->modifiers.first; md; md=md->next) + if(md->type==eModifierType_Subsurf) + if(md->mode & eModifierMode_OnCage) { + md->mode ^= eModifierMode_DisableTemporary; + disabled= 1; + } + + return disabled; +} + +/* disable subsurf temporal, get mapped cos, and enable it */ +float *crazyspace_get_mapped_editverts(Scene *scene, Object *obedit) +{ + Mesh *me= obedit->data; + DerivedMesh *dm; + float *vertexcos; + + /* disable subsurf temporal, get mapped cos, and enable it */ + if(modifiers_disable_subsurf_temporary(obedit)) { + /* need to make new derivemesh */ + makeDerivedMesh(scene, obedit, me->edit_mesh, CD_MASK_BAREMESH); + } + + /* now get the cage */ + dm= editmesh_get_derived_cage(scene, obedit, me->edit_mesh, CD_MASK_BAREMESH); + + vertexcos= MEM_mallocN(3*sizeof(float)*me->edit_mesh->totvert, "vertexcos map"); + dm->foreachMappedVert(dm, make_vertexcos__mapFunc, vertexcos); + + dm->release(dm); + + /* set back the flag, no new cage needs to be built, transform does it */ + modifiers_disable_subsurf_temporary(obedit); + + return vertexcos; +} + +void crazyspace_set_quats_editmesh(EditMesh *em, float *origcos, float *mappedcos, float *quats) +{ + EditVert *eve, *prev; + EditFace *efa; + float *v1, *v2, *v3, *v4, *co1, *co2, *co3, *co4; + intptr_t index= 0; + + /* two abused locations in vertices */ + for(eve= em->verts.first; eve; eve= eve->next, index++) { + eve->tmp.p = NULL; + eve->prev= (EditVert *)index; + } + + /* first store two sets of tangent vectors in vertices, we derive it just from the face-edges */ + for(efa= em->faces.first; efa; efa= efa->next) { + + /* retrieve mapped coordinates */ + v1= mappedcos + 3*(intptr_t)(efa->v1->prev); + v2= mappedcos + 3*(intptr_t)(efa->v2->prev); + v3= mappedcos + 3*(intptr_t)(efa->v3->prev); + + co1= (origcos)? origcos + 3*(intptr_t)(efa->v1->prev): efa->v1->co; + co2= (origcos)? origcos + 3*(intptr_t)(efa->v2->prev): efa->v2->co; + co3= (origcos)? origcos + 3*(intptr_t)(efa->v3->prev): efa->v3->co; + + if(efa->v2->tmp.p==NULL && efa->v2->f1) { + set_crazy_vertex_quat(quats, co2, co3, co1, v2, v3, v1); + efa->v2->tmp.p= (void*)quats; + quats+= 4; + } + + if(efa->v4) { + v4= mappedcos + 3*(intptr_t)(efa->v4->prev); + co4= (origcos)? origcos + 3*(intptr_t)(efa->v4->prev): efa->v4->co; + + if(efa->v1->tmp.p==NULL && efa->v1->f1) { + set_crazy_vertex_quat(quats, co1, co2, co4, v1, v2, v4); + efa->v1->tmp.p= (void*)quats; + quats+= 4; + } + if(efa->v3->tmp.p==NULL && efa->v3->f1) { + set_crazy_vertex_quat(quats, co3, co4, co2, v3, v4, v2); + efa->v3->tmp.p= (void*)quats; + quats+= 4; + } + if(efa->v4->tmp.p==NULL && efa->v4->f1) { + set_crazy_vertex_quat(quats, co4, co1, co3, v4, v1, v3); + efa->v4->tmp.p= (void*)quats; + quats+= 4; + } + } + else { + if(efa->v1->tmp.p==NULL && efa->v1->f1) { + set_crazy_vertex_quat(quats, co1, co2, co3, v1, v2, v3); + efa->v1->tmp.p= (void*)quats; + quats+= 4; + } + if(efa->v3->tmp.p==NULL && efa->v3->f1) { + set_crazy_vertex_quat(quats, co3, co1, co2, v3, v1, v2); + efa->v3->tmp.p= (void*)quats; + quats+= 4; + } + } + } + + /* restore abused prev pointer */ + for(prev= NULL, eve= em->verts.first; eve; prev= eve, eve= eve->next) + eve->prev= prev; + +} + +void crazyspace_set_quats_mesh(Mesh *me, float *origcos, float *mappedcos, float *quats) +{ + int i; + MVert *mvert; + MFace *mface; + float *v1, *v2, *v3, *v4, *co1, *co2, *co3, *co4; + + mvert= me->mvert; + for(i=0; i<me->totvert; i++, mvert++) + mvert->flag&= ~ME_VERT_TMP_TAG; + + /* first store two sets of tangent vectors in vertices, we derive it just from the face-edges */ + mvert= me->mvert; + mface= me->mface; + for(i=0; i<me->totface; i++, mface++) { + + /* retrieve mapped coordinates */ + v1= mappedcos + 3*mface->v1; + v2= mappedcos + 3*mface->v2; + v3= mappedcos + 3*mface->v3; + + co1= (origcos)? origcos + 3*mface->v1: mvert[mface->v1].co; + co2= (origcos)? origcos + 3*mface->v2: mvert[mface->v2].co; + co3= (origcos)? origcos + 3*mface->v3: mvert[mface->v3].co; + + if((mvert[mface->v2].flag&ME_VERT_TMP_TAG)==0) { + set_crazy_vertex_quat(&quats[mface->v2*4], co2, co3, co1, v2, v3, v1); + mvert[mface->v2].flag|= ME_VERT_TMP_TAG; + } + + if(mface->v4) { + v4= mappedcos + 3*mface->v4; + co4= (origcos)? origcos + 3*mface->v4: mvert[mface->v4].co; + + if((mvert[mface->v1].flag&ME_VERT_TMP_TAG)==0) { + set_crazy_vertex_quat(&quats[mface->v1*4], co1, co2, co4, v1, v2, v4); + mvert[mface->v1].flag|= ME_VERT_TMP_TAG; + } + if((mvert[mface->v3].flag&ME_VERT_TMP_TAG)==0) { + set_crazy_vertex_quat(&quats[mface->v3*4], co3, co4, co2, v3, v4, v2); + mvert[mface->v3].flag|= ME_VERT_TMP_TAG; + } + if((mvert[mface->v4].flag&ME_VERT_TMP_TAG)==0) { + set_crazy_vertex_quat(&quats[mface->v4*4], co4, co1, co3, v4, v1, v3); + mvert[mface->v4].flag|= ME_VERT_TMP_TAG; + } + } + else { + if((mvert[mface->v1].flag&ME_VERT_TMP_TAG)==0) { + set_crazy_vertex_quat(&quats[mface->v1*4], co1, co2, co3, v1, v2, v3); + mvert[mface->v1].flag|= ME_VERT_TMP_TAG; + } + if((mvert[mface->v3].flag&ME_VERT_TMP_TAG)==0) { + set_crazy_vertex_quat(&quats[mface->v3*4], co3, co1, co2, v3, v1, v2); + mvert[mface->v3].flag|= ME_VERT_TMP_TAG; + } + } + } +} + +int editmesh_get_first_deform_matrices(Scene *scene, Object *ob, EditMesh *em, float (**deformmats)[3][3], float (**deformcos)[3]) +{ + ModifierData *md; + DerivedMesh *dm; + int i, a, numleft = 0, numVerts = 0; + int cageIndex = modifiers_getCageIndex(scene, ob, NULL, 1); + float (*defmats)[3][3] = NULL, (*deformedVerts)[3] = NULL; + + modifiers_clearErrors(ob); + + dm = NULL; + md = modifiers_getVirtualModifierList(ob); + + /* compute the deformation matrices and coordinates for the first + modifiers with on cage editing that are enabled and support computing + deform matrices */ + for(i = 0; md && i <= cageIndex; i++, md = md->next) { + ModifierTypeInfo *mti = modifierType_getInfo(md->type); + + if(!editmesh_modifier_is_enabled(scene, md, dm)) + continue; + + if(mti->type==eModifierTypeType_OnlyDeform && mti->deformMatricesEM) { + if(!defmats) { + dm= editmesh_get_derived(em, NULL); + deformedVerts= editmesh_get_vertex_cos(em, &numVerts); + defmats= MEM_callocN(sizeof(*defmats)*numVerts, "defmats"); + + for(a=0; a<numVerts; a++) + unit_m3(defmats[a]); + } + + mti->deformMatricesEM(md, ob, em, dm, deformedVerts, defmats, + numVerts); + } + else + break; + } + + for(; md && i <= cageIndex; md = md->next, i++) + if(editmesh_modifier_is_enabled(scene, md, dm) && modifier_isCorrectableDeformed(md)) + numleft++; + + if(dm) + dm->release(dm); + + *deformmats= defmats; + *deformcos= deformedVerts; + + return numleft; +} + +int sculpt_get_first_deform_matrices(Scene *scene, Object *ob, float (**deformmats)[3][3], float (**deformcos)[3]) +{ + ModifierData *md; + DerivedMesh *dm; + int a, numVerts= 0; + float (*defmats)[3][3]= NULL, (*deformedVerts)[3]= NULL; + MultiresModifierData *mmd= get_multires_modifier(scene, ob, 0); + int has_multires = mmd != NULL && mmd->sculptlvl > 0; + int numleft= 0; + + if(has_multires) { + *deformmats= NULL; + *deformcos= NULL; + return numleft; + } + + dm= NULL; + md= modifiers_getVirtualModifierList(ob); + + for(; md; md= md->next) { + ModifierTypeInfo *mti= modifierType_getInfo(md->type); + + if(!modifier_isEnabled(scene, md, eModifierMode_Realtime)) continue; + + if(mti->type==eModifierTypeType_OnlyDeform) { + if(!defmats) { + Mesh *me= (Mesh*)ob->data; + dm= mesh_create_derived(me, ob, NULL); + deformedVerts= mesh_getVertexCos(me, &numVerts); + defmats= MEM_callocN(sizeof(*defmats)*numVerts, "defmats"); + + for(a=0; a<numVerts; a++) + unit_m3(defmats[a]); + } + + if(mti->deformMatrices) mti->deformMatrices(md, ob, dm, deformedVerts, defmats, numVerts); + else break; + } + } + + for(; md; md= md->next) { + ModifierTypeInfo *mti= modifierType_getInfo(md->type); + + if(!modifier_isEnabled(scene, md, eModifierMode_Realtime)) continue; + + if(mti->type==eModifierTypeType_OnlyDeform) + numleft++; + } + + if(dm) + dm->release(dm); + + *deformmats= defmats; + *deformcos= deformedVerts; + + return numleft; +} + +void crazyspace_build_sculpt(Scene *scene, Object *ob, float (**deformmats)[3][3], float (**deformcos)[3]) +{ + int totleft= sculpt_get_first_deform_matrices(scene, ob, deformmats, deformcos); + + if(totleft) { + /* there are deformation modifier which doesn't support deformation matricies + calculation. Need additional crazyspace correction */ + + float (*deformedVerts)[3]= *deformcos; + float (*origVerts)[3]= MEM_dupallocN(deformedVerts); + float *quats= NULL; + int i; + ModifierData *md= modifiers_getVirtualModifierList(ob); + Mesh *me= (Mesh*)ob->data; + + for(; md; md= md->next) { + ModifierTypeInfo *mti= modifierType_getInfo(md->type); + + if(!modifier_isEnabled(scene, md, eModifierMode_Realtime)) continue; + + if(mti->type==eModifierTypeType_OnlyDeform) + mti->deformVerts(md, ob, NULL, deformedVerts, me->totvert, 0, 0); + } + + quats= MEM_mallocN(me->totvert*sizeof(float)*4, "crazy quats"); + + crazyspace_set_quats_mesh(me, (float*)origVerts, (float*)deformedVerts, quats); + + for(i=0; i<me->totvert; i++) { + float qmat[3][3], tmat[3][3]; + + quat_to_mat3(qmat, &quats[i*4]); + mul_m3_m3m3(tmat, qmat, (*deformmats)[i]); + copy_m3_m3((*deformmats)[i], tmat); + } + + MEM_freeN(origVerts); + MEM_freeN(quats); + } +} diff --git a/source/blender/editors/uvedit/uvedit_parametrizer.c b/source/blender/editors/uvedit/uvedit_parametrizer.c index dc5e17b5fae..981332c8fbf 100644 --- a/source/blender/editors/uvedit/uvedit_parametrizer.c +++ b/source/blender/editors/uvedit/uvedit_parametrizer.c @@ -4042,7 +4042,7 @@ static void p_smooth(PChart *chart) /* Exported */ -ParamHandle *param_construct_begin() +ParamHandle *param_construct_begin(void) { PHandle *handle = MEM_callocN(sizeof*handle, "PHandle"); handle->construction_chart = p_chart_new(handle); diff --git a/source/blender/gpu/intern/gpu_buffers.c b/source/blender/gpu/intern/gpu_buffers.c index eae5ca1b4b9..53e3ad09a6f 100644 --- a/source/blender/gpu/intern/gpu_buffers.c +++ b/source/blender/gpu/intern/gpu_buffers.c @@ -60,12 +60,12 @@ #define MAX_GPU_ATTRIB_DATA 32 /* -1 - undefined, 0 - vertex arrays, 1 - VBOs */ -int useVBOs = -1; -GPUBufferPool *globalPool = 0; -int GLStates = 0; -GPUAttrib attribData[MAX_GPU_ATTRIB_DATA] = { { -1, 0, 0 } }; +static int useVBOs = -1; +static GPUBufferPool *globalPool = 0; +static int GLStates = 0; +static GPUAttrib attribData[MAX_GPU_ATTRIB_DATA] = { { -1, 0, 0 } }; -GPUBufferPool *GPU_buffer_pool_new() +GPUBufferPool *GPU_buffer_pool_new(void) { GPUBufferPool *pool; @@ -89,7 +89,7 @@ GPUBufferPool *GPU_buffer_pool_new() return pool; } -void GPU_buffer_pool_remove( int index, GPUBufferPool *pool ) +static void GPU_buffer_pool_remove( int index, GPUBufferPool *pool ) { int i; @@ -108,7 +108,7 @@ void GPU_buffer_pool_remove( int index, GPUBufferPool *pool ) pool->size--; } -void GPU_buffer_pool_delete_last( GPUBufferPool *pool ) +static void GPU_buffer_pool_delete_last( GPUBufferPool *pool ) { int last; @@ -773,7 +773,7 @@ void GPU_free_buffers(void *buffers_v) } } -GPUBuffer *GPU_buffer_setup( DerivedMesh *dm, GPUDrawObject *object, int size, GLenum target, void *user, void (*copy_f)(DerivedMesh *, float *, int *, int *, void *) ) +static GPUBuffer *GPU_buffer_setup( DerivedMesh *dm, GPUDrawObject *object, int size, GLenum target, void *user, void (*copy_f)(DerivedMesh *, float *, int *, int *, void *) ) { GPUBuffer *buffer; float *varray; @@ -855,7 +855,7 @@ GPUBuffer *GPU_buffer_setup( DerivedMesh *dm, GPUDrawObject *object, int size, G return buffer; } -void GPU_buffer_copy_vertex(DerivedMesh *dm, float *varray, int *index, int *redir, void *UNUSED(user)) +static void GPU_buffer_copy_vertex(DerivedMesh *dm, float *varray, int *index, int *redir, void *UNUSED(user)) { int start; int i, j, numfaces; @@ -897,14 +897,14 @@ void GPU_buffer_copy_vertex(DerivedMesh *dm, float *varray, int *index, int *red } } -GPUBuffer *GPU_buffer_vertex( DerivedMesh *dm ) +static GPUBuffer *GPU_buffer_vertex( DerivedMesh *dm ) { DEBUG_VBO("GPU_buffer_vertex\n"); return GPU_buffer_setup( dm, dm->drawObject, sizeof(float)*3*(dm->drawObject->nelements+dm->drawObject->nlooseverts), GL_ARRAY_BUFFER_ARB, 0, GPU_buffer_copy_vertex); } -void GPU_buffer_copy_normal(DerivedMesh *dm, float *varray, int *index, int *redir, void *UNUSED(user)) +static void GPU_buffer_copy_normal(DerivedMesh *dm, float *varray, int *index, int *redir, void *UNUSED(user)) { int i, numfaces; int start; @@ -963,14 +963,14 @@ void GPU_buffer_copy_normal(DerivedMesh *dm, float *varray, int *index, int *red } } -GPUBuffer *GPU_buffer_normal( DerivedMesh *dm ) +static GPUBuffer *GPU_buffer_normal( DerivedMesh *dm ) { DEBUG_VBO("GPU_buffer_normal\n"); return GPU_buffer_setup( dm, dm->drawObject, sizeof(float)*3*dm->drawObject->nelements, GL_ARRAY_BUFFER_ARB, 0, GPU_buffer_copy_normal); } -void GPU_buffer_copy_uv(DerivedMesh *dm, float *varray, int *index, int *redir, void *UNUSED(user)) +static void GPU_buffer_copy_uv(DerivedMesh *dm, float *varray, int *index, int *redir, void *UNUSED(user)) { int start; int i, numfaces; @@ -1010,7 +1010,7 @@ void GPU_buffer_copy_uv(DerivedMesh *dm, float *varray, int *index, int *redir, } } -GPUBuffer *GPU_buffer_uv( DerivedMesh *dm ) +static GPUBuffer *GPU_buffer_uv( DerivedMesh *dm ) { DEBUG_VBO("GPU_buffer_uv\n"); if( DM_get_face_data_layer(dm, CD_MTFACE) != 0 ) /* was sizeof(float)*2 but caused buffer overrun */ @@ -1019,7 +1019,7 @@ GPUBuffer *GPU_buffer_uv( DerivedMesh *dm ) return 0; } -void GPU_buffer_copy_color3( DerivedMesh *dm, float *varray_, int *index, int *redir, void *user ) +static void GPU_buffer_copy_color3( DerivedMesh *dm, float *varray_, int *index, int *redir, void *user ) { int i, numfaces; unsigned char *varray = (unsigned char *)varray_; @@ -1049,7 +1049,7 @@ void GPU_buffer_copy_color3( DerivedMesh *dm, float *varray_, int *index, int *r } } -void GPU_buffer_copy_color4( DerivedMesh *dm, float *varray_, int *index, int *redir, void *user ) +static void GPU_buffer_copy_color4( DerivedMesh *dm, float *varray_, int *index, int *redir, void *user ) { int i, numfaces; unsigned char *varray = (unsigned char *)varray_; @@ -1079,7 +1079,7 @@ void GPU_buffer_copy_color4( DerivedMesh *dm, float *varray_, int *index, int *r } } -GPUBuffer *GPU_buffer_color( DerivedMesh *dm ) +static GPUBuffer *GPU_buffer_color( DerivedMesh *dm ) { unsigned char *colors; int i, numfaces; @@ -1112,7 +1112,7 @@ GPUBuffer *GPU_buffer_color( DerivedMesh *dm ) return result; } -void GPU_buffer_copy_edge(DerivedMesh *dm, float *varray, int *UNUSED(index), int *UNUSED(redir), void *UNUSED(user)) +static void GPU_buffer_copy_edge(DerivedMesh *dm, float *varray, int *UNUSED(index), int *UNUSED(redir), void *UNUSED(user)) { int i; @@ -1131,14 +1131,14 @@ void GPU_buffer_copy_edge(DerivedMesh *dm, float *varray, int *UNUSED(index), in } } -GPUBuffer *GPU_buffer_edge( DerivedMesh *dm ) +static GPUBuffer *GPU_buffer_edge( DerivedMesh *dm ) { DEBUG_VBO("GPU_buffer_edge\n"); return GPU_buffer_setup( dm, dm->drawObject, sizeof(int)*2*dm->drawObject->nedges, GL_ELEMENT_ARRAY_BUFFER_ARB, 0, GPU_buffer_copy_edge); } -void GPU_buffer_copy_uvedge(DerivedMesh *dm, float *varray, int *UNUSED(index), int *UNUSED(redir), void *UNUSED(user)) +static void GPU_buffer_copy_uvedge(DerivedMesh *dm, float *varray, int *UNUSED(index), int *UNUSED(redir), void *UNUSED(user)) { MTFace *tf = DM_get_face_data_layer(dm, CD_MTFACE); int i, j=0; @@ -1175,7 +1175,7 @@ void GPU_buffer_copy_uvedge(DerivedMesh *dm, float *varray, int *UNUSED(index), } } -GPUBuffer *GPU_buffer_uvedge( DerivedMesh *dm ) +static GPUBuffer *GPU_buffer_uvedge( DerivedMesh *dm ) { DEBUG_VBO("GPU_buffer_uvedge\n"); /* logic here: @@ -1514,7 +1514,7 @@ void GPU_interleaved_attrib_setup( GPUBuffer *buffer, GPUAttrib data[], int numd } -void GPU_buffer_unbind() +void GPU_buffer_unbind(void) { int i; DEBUG_VBO("GPU_buffer_unbind\n"); diff --git a/source/blender/gpu/intern/gpu_codegen.c b/source/blender/gpu/intern/gpu_codegen.c index 9f0bbda91bb..8fc96b34933 100644 --- a/source/blender/gpu/intern/gpu_codegen.c +++ b/source/blender/gpu/intern/gpu_codegen.c @@ -766,7 +766,7 @@ GPUShader *GPU_pass_shader(GPUPass *pass) return pass->shader; } -void GPU_nodes_extract_dynamic_inputs(GPUPass *pass, ListBase *nodes) +static void GPU_nodes_extract_dynamic_inputs(GPUPass *pass, ListBase *nodes) { GPUShader *shader = pass->shader; GPUNode *node; @@ -882,7 +882,7 @@ void GPU_pass_unbind(GPUPass *pass) /* Node Link Functions */ -GPUNodeLink *GPU_node_link_create(int type) +static GPUNodeLink *GPU_node_link_create(int type) { GPUNodeLink *link = MEM_callocN(sizeof(GPUNodeLink), "GPUNodeLink"); link->type = type; @@ -891,7 +891,7 @@ GPUNodeLink *GPU_node_link_create(int type) return link; } -void GPU_node_link_free(GPUNodeLink *link) +static void GPU_node_link_free(GPUNodeLink *link) { link->users--; @@ -907,7 +907,7 @@ void GPU_node_link_free(GPUNodeLink *link) /* Node Functions */ -GPUNode *GPU_node_begin(const char *name) +static GPUNode *GPU_node_begin(const char *name) { GPUNode *node = MEM_callocN(sizeof(GPUNode), "GPUNode"); @@ -916,7 +916,7 @@ GPUNode *GPU_node_begin(const char *name) return node; } -void GPU_node_end(GPUNode *UNUSED(node)) +static void GPU_node_end(GPUNode *UNUSED(node)) { /* empty */ } @@ -1055,7 +1055,7 @@ static void GPU_node_output(GPUNode *node, int type, const char *UNUSED(name), G BLI_addtail(&node->outputs, output); } -void GPU_inputs_free(ListBase *inputs) +static void GPU_inputs_free(ListBase *inputs) { GPUInput *input; @@ -1069,7 +1069,7 @@ void GPU_inputs_free(ListBase *inputs) BLI_freelistN(inputs); } -void GPU_node_free(GPUNode *node) +static void GPU_node_free(GPUNode *node) { GPUOutput *output; @@ -1085,7 +1085,7 @@ void GPU_node_free(GPUNode *node) MEM_freeN(node); } -void GPU_nodes_free(ListBase *nodes) +static void GPU_nodes_free(ListBase *nodes) { GPUNode *node; @@ -1098,7 +1098,7 @@ void GPU_nodes_free(ListBase *nodes) /* vertex attributes */ -void gpu_nodes_get_vertex_attributes(ListBase *nodes, GPUVertexAttribs *attribs) +static void gpu_nodes_get_vertex_attributes(ListBase *nodes, GPUVertexAttribs *attribs) { GPUNode *node; GPUInput *input; @@ -1134,7 +1134,7 @@ void gpu_nodes_get_vertex_attributes(ListBase *nodes, GPUVertexAttribs *attribs) } } -void gpu_nodes_get_builtin_flag(ListBase *nodes, int *builtin) +static void gpu_nodes_get_builtin_flag(ListBase *nodes, int *builtin) { GPUNode *node; GPUInput *input; @@ -1352,7 +1352,7 @@ int GPU_link_changed(GPUNodeLink *link) /* Pass create/free */ -void gpu_nodes_tag(GPUNodeLink *link) +static void gpu_nodes_tag(GPUNodeLink *link) { GPUNode *node; GPUInput *input; @@ -1370,7 +1370,7 @@ void gpu_nodes_tag(GPUNodeLink *link) gpu_nodes_tag(input->link); } -void gpu_nodes_prune(ListBase *nodes, GPUNodeLink *outlink) +static void gpu_nodes_prune(ListBase *nodes, GPUNodeLink *outlink) { GPUNode *node, *next; diff --git a/source/blender/gpu/intern/gpu_draw.c b/source/blender/gpu/intern/gpu_draw.c index dedcab91e06..e948da2f1ec 100644 --- a/source/blender/gpu/intern/gpu_draw.c +++ b/source/blender/gpu/intern/gpu_draw.c @@ -930,7 +930,7 @@ static void gpu_material_to_fixed(GPUMaterialFixed *smat, const Material *bmat, } } -Material *gpu_active_node_material(Material *ma) +static Material *gpu_active_node_material(Material *ma) { if(ma && ma->use_nodes && ma->nodetree) { bNode *node= nodeGetActiveID(ma->nodetree, ID_MA); diff --git a/source/blender/gpu/intern/gpu_extensions.c b/source/blender/gpu/intern/gpu_extensions.c index bff4287bd75..c0c3cc128af 100644 --- a/source/blender/gpu/intern/gpu_extensions.c +++ b/source/blender/gpu/intern/gpu_extensions.c @@ -82,12 +82,12 @@ int GPU_type_matches(GPUDeviceType device, GPUOSType os, GPUDriverType driver) /* GPU Extensions */ -void GPU_extensions_disable() +void GPU_extensions_disable(void) { GG.extdisabled = 1; } -void GPU_extensions_init() +void GPU_extensions_init(void) { GLint r, g, b; const char *vendor, *renderer; @@ -183,12 +183,12 @@ void GPU_extensions_init() #endif } -int GPU_glsl_support() +int GPU_glsl_support(void) { return !GG.extdisabled && GG.glslsupport; } -int GPU_non_power_of_two_support() +int GPU_non_power_of_two_support(void) { /* Exception for buggy ATI/Apple driver in Mac OS X 10.5/10.6, * they claim to support this but can cause system freeze */ @@ -201,7 +201,7 @@ int GPU_non_power_of_two_support() return GLEW_ARB_texture_non_power_of_two; } -int GPU_color_depth() +int GPU_color_depth(void) { return GG.colordepth; } @@ -680,7 +680,7 @@ struct GPUFrameBuffer { GPUTexture *depthtex; }; -GPUFrameBuffer *GPU_framebuffer_create() +GPUFrameBuffer *GPU_framebuffer_create(void) { GPUFrameBuffer *fb; @@ -825,7 +825,7 @@ void GPU_framebuffer_free(GPUFrameBuffer *fb) MEM_freeN(fb); } -void GPU_framebuffer_restore() +void GPU_framebuffer_restore(void) { if (GG.currentfb != 0) { glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0); diff --git a/source/blender/gpu/intern/gpu_material.c b/source/blender/gpu/intern/gpu_material.c index c57499890ee..cb28d0dbe47 100644 --- a/source/blender/gpu/intern/gpu_material.c +++ b/source/blender/gpu/intern/gpu_material.c @@ -596,7 +596,7 @@ static void do_specular_ramp(GPUShadeInput *shi, GPUNodeLink *is, GPUNodeLink *t } } -void add_user_list(ListBase *list, void *data) +static void add_user_list(ListBase *list, void *data) { LinkData *link = MEM_callocN(sizeof(LinkData), "GPULinkData"); link->data = data; @@ -892,6 +892,8 @@ static void do_material_tex(GPUShadeInput *shi) char *lastuvname = NULL; float one = 1.0f, norfac, ofs[3]; int tex_nr, rgbnor, talpha; + int init_done = 0, iBumpSpacePrev; + GPUNodeLink *vNorg, *vNacc, *fPrevMagnitude; GPU_link(mat, "set_value", GPU_uniform(&one), &stencil); @@ -1055,12 +1057,13 @@ static void do_material_tex(GPUShadeInput *shi) } else if( mtex->texflag & (MTEX_3TAP_BUMP|MTEX_5TAP_BUMP)) { /* ntap bumpmap image */ + int iBumpSpace; float hScale = 0.1f; // compatibility adjustment factor for all bumpspace types float hScaleTex = 13.0f; // factor for scaling texspace bumps GPUNodeLink *surf_pos = GPU_builtin(GPU_VIEW_POSITION); - GPUNodeLink *vR1, *vR2, *fDet; - GPUNodeLink *dBs, *dBt, *vN; + GPUNodeLink *vR1, *vR2; + GPUNodeLink *dBs, *dBt, *fDet; if( mtex->texflag & MTEX_BUMP_TEXTURESPACE ) hScale = hScaleTex; @@ -1070,15 +1073,49 @@ static void do_material_tex(GPUShadeInput *shi) if(GPU_link_changed(stencil)) GPU_link(mat, "math_multiply", tnorfac, stencil, &tnorfac); + if( !init_done ) { + // copy shi->vn to vNorg and vNacc, set magnitude to 1 + GPU_link(mat, "mtex_bump_normals_init", shi->vn, &vNorg, &vNacc, &fPrevMagnitude); + iBumpSpacePrev = 0; + init_done = 1; + } + + // find current bump space if( mtex->texflag & MTEX_BUMP_OBJECTSPACE ) - GPU_link( mat, "mtex_bump_init_objspace", - surf_pos, shi->vn, - GPU_builtin(GPU_VIEW_MATRIX), GPU_builtin(GPU_INVERSE_VIEW_MATRIX), GPU_builtin(GPU_OBJECT_MATRIX), GPU_builtin(GPU_INVERSE_OBJECT_MATRIX), - &vR1, &vR2, &fDet, &vN ); + iBumpSpace = 1; + else if( mtex->texflag & MTEX_BUMP_TEXTURESPACE ) + iBumpSpace = 2; else - GPU_link( mat, "mtex_bump_init_viewspace", - surf_pos, shi->vn, - &vR1, &vR2, &fDet, &vN ); + iBumpSpace = 4; // ViewSpace + + // re-initialize if bump space changed + if( iBumpSpacePrev != iBumpSpace ) { + + if( mtex->texflag & MTEX_BUMP_OBJECTSPACE ) + GPU_link( mat, "mtex_bump_init_objspace", + surf_pos, vNorg, + GPU_builtin(GPU_VIEW_MATRIX), GPU_builtin(GPU_INVERSE_VIEW_MATRIX), GPU_builtin(GPU_OBJECT_MATRIX), GPU_builtin(GPU_INVERSE_OBJECT_MATRIX), + fPrevMagnitude, vNacc, + &fPrevMagnitude, &vNacc, + &vR1, &vR2, &fDet ); + + else if( mtex->texflag & MTEX_BUMP_TEXTURESPACE ) + GPU_link( mat, "mtex_bump_init_texturespace", + surf_pos, vNorg, + fPrevMagnitude, vNacc, + &fPrevMagnitude, &vNacc, + &vR1, &vR2, &fDet ); + + else + GPU_link( mat, "mtex_bump_init_viewspace", + surf_pos, vNorg, + fPrevMagnitude, vNacc, + &fPrevMagnitude, &vNacc, + &vR1, &vR2, &fDet ); + + iBumpSpacePrev = iBumpSpace; + } + if( mtex->texflag & MTEX_3TAP_BUMP ) GPU_link( mat, "mtex_bump_tap3", @@ -1089,19 +1126,23 @@ static void do_material_tex(GPUShadeInput *shi) texco, GPU_image(tex->ima, &tex->iuser), tnorfac, &dBs, &dBt ); + if( mtex->texflag & MTEX_BUMP_TEXTURESPACE ) { float ima_x= 512.0f, ima_y= 512.f; // prevent calling textureSize, glsl 1.3 only ImBuf *ibuf= BKE_image_get_ibuf(tex->ima, &tex->iuser); - if(ibuf) - ima_x= ibuf->x; ima_y= ibuf->y; + if(ibuf) { + ima_x= ibuf->x; + ima_y= ibuf->y; + } GPU_link( mat, "mtex_bump_apply_texspace", - fDet, dBs, dBt, vR1, vR2, vN, GPU_image(tex->ima, &tex->iuser), texco, - GPU_uniform(&ima_x), GPU_uniform(&ima_y), &shi->vn ); + fDet, dBs, dBt, vR1, vR2, + GPU_image(tex->ima, &tex->iuser), texco, GPU_uniform(&ima_x), GPU_uniform(&ima_y), vNacc, + &vNacc, &shi->vn ); } else GPU_link( mat, "mtex_bump_apply", - fDet, dBs, dBt, vR1, vR2, vN, - &shi->vn ); + fDet, dBs, dBt, vR1, vR2, vNacc, + &vNacc, &shi->vn ); } } @@ -1307,7 +1348,7 @@ void GPU_shaderesult_set(GPUShadeInput *shi, GPUShadeResult *shr) GPU_link(mat, "linearrgb_to_srgb", shr->combined, &shr->combined); } -GPUNodeLink *GPU_blender_material(GPUMaterial *mat, Material *ma) +static GPUNodeLink *GPU_blender_material(GPUMaterial *mat, Material *ma) { GPUShadeInput shi; GPUShadeResult shr; diff --git a/source/blender/gpu/intern/gpu_shader_material.glsl b/source/blender/gpu/intern/gpu_shader_material.glsl index 6c2b2e68a2c..6dec6a5e982 100644 --- a/source/blender/gpu/intern/gpu_shader_material.glsl +++ b/source/blender/gpu/intern/gpu_shader_material.glsl @@ -1102,16 +1102,11 @@ void mtex_normal(vec3 texco, sampler2D ima, out vec3 normal) normal = 2.0*(vec3(color.r, -color.g, color.b) - vec3(0.5, -0.5, 0.5)); } -void mtex_bump_init_viewspace( vec3 surf_pos, vec3 surf_norm, - out vec3 vR1, out vec3 vR2, out float fDet, out vec3 vN ) +void mtex_bump_normals_init( vec3 vN, out vec3 vNorg, out vec3 vNacc, out float fPrevMagnitude ) { - vec3 vSigmaS = dFdx( surf_pos ); - vec3 vSigmaT = dFdy( surf_pos ); - vN = surf_norm; /* normalized interpolated vertex normal */ - - vR1 = cross( vSigmaT , vN ); - vR2 = cross( vN , vSigmaS ) ; - fDet = dot ( vSigmaS , vR1 ); + vNorg = vN; + vNacc = vN; + fPrevMagnitude = 1.0; } /** helper method to extract the upper left 3x3 matrix from a 4x4 matrix */ @@ -1125,25 +1120,66 @@ mat3 to_mat3(mat4 m4) } void mtex_bump_init_objspace( vec3 surf_pos, vec3 surf_norm, - mat4 mView, mat4 mViewInv, mat4 mObj, mat4 mObjInv, - out vec3 vR1, out vec3 vR2, out float fDet, out vec3 vN ) + mat4 mView, mat4 mViewInv, mat4 mObj, mat4 mObjInv, + float fPrevMagnitude_in, vec3 vNacc_in, + out float fPrevMagnitude_out, out vec3 vNacc_out, + out vec3 vR1, out vec3 vR2, out float fDet ) { mat3 obj2view = to_mat3(mView * mObj); mat3 view2obj = to_mat3(mObjInv * mViewInv); vec3 vSigmaS = view2obj * dFdx( surf_pos ); vec3 vSigmaT = view2obj * dFdy( surf_pos ); - vN = normalize( surf_norm * obj2view ); + vec3 vN = normalize( surf_norm * obj2view ); - vR1 = cross( vSigmaT , vN ); - vR2 = cross( vN , vSigmaS ) ; - fDet = dot ( vSigmaS , vR1 ); + vR1 = cross( vSigmaT, vN ); + vR2 = cross( vN, vSigmaS ) ; + fDet = dot ( vSigmaS, vR1 ); - /* transform back */ + /* pretransform vNacc (in mtex_bump_apply) using the inverse transposed */ vR1 = vR1 * view2obj; vR2 = vR2 * view2obj; vN = vN * view2obj; + + float fMagnitude = abs(fDet) * length(vN); + vNacc_out = vNacc_in * (fMagnitude / fPrevMagnitude_in); + fPrevMagnitude_out = fMagnitude; +} + +void mtex_bump_init_texturespace( vec3 surf_pos, vec3 surf_norm, + float fPrevMagnitude_in, vec3 vNacc_in, + out float fPrevMagnitude_out, out vec3 vNacc_out, + out vec3 vR1, out vec3 vR2, out float fDet ) +{ + vec3 vSigmaS = dFdx( surf_pos ); + vec3 vSigmaT = dFdy( surf_pos ); + vec3 vN = surf_norm; /* normalized interpolated vertex normal */ + + vR1 = normalize( cross( vSigmaT, vN ) ); + vR2 = normalize( cross( vN, vSigmaS ) ); + fDet = sign( dot(vSigmaS, vR1) ); + + float fMagnitude = abs(fDet); + vNacc_out = vNacc_in * (fMagnitude / fPrevMagnitude_in); + fPrevMagnitude_out = fMagnitude; +} +void mtex_bump_init_viewspace( vec3 surf_pos, vec3 surf_norm, + float fPrevMagnitude_in, vec3 vNacc_in, + out float fPrevMagnitude_out, out vec3 vNacc_out, + out vec3 vR1, out vec3 vR2, out float fDet ) +{ + vec3 vSigmaS = dFdx( surf_pos ); + vec3 vSigmaT = dFdy( surf_pos ); + vec3 vN = surf_norm; /* normalized interpolated vertex normal */ + + vR1 = cross( vSigmaT, vN ); + vR2 = cross( vN, vSigmaS ) ; + fDet = dot ( vSigmaS, vR1 ); + + float fMagnitude = abs(fDet); + vNacc_out = vNacc_in * (fMagnitude / fPrevMagnitude_in); + fPrevMagnitude_out = fMagnitude; } void mtex_bump_tap3( vec3 texco, sampler2D ima, float hScale, @@ -1185,25 +1221,28 @@ void mtex_bump_tap5( vec3 texco, sampler2D ima, float hScale, dBt = hScale * (Hu - Hd); } -void mtex_bump_apply( float fDet, float dBs, float dBt, vec3 vR1, vec3 vR2, vec3 vN, - out vec3 perturbed_norm ) +void mtex_bump_apply( float fDet, float dBs, float dBt, vec3 vR1, vec3 vR2, vec3 vNacc_in, + out vec3 vNacc_out, out vec3 perturbed_norm ) { vec3 vSurfGrad = sign(fDet) * ( dBs * vR1 + dBt * vR2 ); - perturbed_norm = normalize( abs(fDet) * vN - vSurfGrad ); + vNacc_out = vNacc_in - vSurfGrad; + perturbed_norm = normalize( vNacc_out ); } -void mtex_bump_apply_texspace( float fDet, float dBs, float dBt, vec3 vR1, vec3 vR2, vec3 vN, - sampler2D ima, vec3 texco, float ima_x, float ima_y, out vec3 perturbed_norm ) +void mtex_bump_apply_texspace( float fDet, float dBs, float dBt, vec3 vR1, vec3 vR2, + sampler2D ima, vec3 texco, float ima_x, float ima_y, vec3 vNacc_in, + out vec3 vNacc_out, out vec3 perturbed_norm ) { vec2 TexDx = dFdx(texco.xy); vec2 TexDy = dFdy(texco.xy); vec3 vSurfGrad = sign(fDet) * ( - dBs / length( vec2(ima_x*TexDx.x, ima_y*TexDx.y) ) * normalize(vR1) + - dBt / length( vec2(ima_x*TexDy.x, ima_y*TexDy.y) ) * normalize(vR2) ); - perturbed_norm = normalize( vN - vSurfGrad ); - + dBs / length( vec2(ima_x*TexDx.x, ima_y*TexDx.y) ) * vR1 + + dBt / length( vec2(ima_x*TexDy.x, ima_y*TexDy.y) ) * vR2 ); + + vNacc_out = vNacc_in - vSurfGrad; + perturbed_norm = normalize( vNacc_out ); } void mtex_negate_texnormal(vec3 normal, out vec3 outnormal) diff --git a/source/blender/gpu/intern/gpu_shader_material.glsl.c b/source/blender/gpu/intern/gpu_shader_material.glsl.c index 36cf4dd3497..742e57fbbff 100644 --- a/source/blender/gpu/intern/gpu_shader_material.glsl.c +++ b/source/blender/gpu/intern/gpu_shader_material.glsl.c @@ -1,822 +1,863 @@ /* DataToC output of file <gpu_shader_material_glsl> */ -int datatoc_gpu_shader_material_glsl_size= 37417; +int datatoc_gpu_shader_material_glsl_size= 38724; char datatoc_gpu_shader_material_glsl[]= { - 10,102,108,111, 97,116, 32,101,120, -112, 95, 98,108,101,110,100,101,114, 40,102,108,111, 97,116, 32,102, 41, 10,123, 10, 9,114,101,116,117,114,110, 32,112,111,119, - 40, 50, 46, 55, 49, 56, 50, 56, 49, 56, 50, 56, 52, 54, 44, 32,102, 41, 59, 10,125, 10, 10,118,111,105,100, 32,114,103, 98, 95, -116,111, 95,104,115,118, 40,118,101, 99, 52, 32,114,103, 98, 44, 32,111,117,116, 32,118,101, 99, 52, 32,111,117,116, 99,111,108, - 41, 10,123, 10, 9,102,108,111, 97,116, 32, 99,109, 97,120, 44, 32, 99,109,105,110, 44, 32,104, 44, 32,115, 44, 32,118, 44, 32, - 99,100,101,108,116, 97, 59, 10, 9,118,101, 99, 51, 32, 99, 59, 10, 10, 9, 99,109, 97,120, 32, 61, 32,109, 97,120, 40,114,103, - 98, 91, 48, 93, 44, 32,109, 97,120, 40,114,103, 98, 91, 49, 93, 44, 32,114,103, 98, 91, 50, 93, 41, 41, 59, 10, 9, 99,109,105, -110, 32, 61, 32,109,105,110, 40,114,103, 98, 91, 48, 93, 44, 32,109,105,110, 40,114,103, 98, 91, 49, 93, 44, 32,114,103, 98, 91, - 50, 93, 41, 41, 59, 10, 9, 99,100,101,108,116, 97, 32, 61, 32, 99,109, 97,120, 45, 99,109,105,110, 59, 10, 10, 9,118, 32, 61, - 32, 99,109, 97,120, 59, 10, 9,105,102, 32, 40, 99,109, 97,120, 33, 61, 48, 46, 48, 41, 10, 9, 9,115, 32, 61, 32, 99,100,101, -108,116, 97, 47, 99,109, 97,120, 59, 10, 9,101,108,115,101, 32,123, 10, 9, 9,115, 32, 61, 32, 48, 46, 48, 59, 10, 9, 9,104, - 32, 61, 32, 48, 46, 48, 59, 10, 9,125, 10, 10, 9,105,102, 32, 40,115, 32, 61, 61, 32, 48, 46, 48, 41, 32,123, 10, 9, 9,104, - 32, 61, 32, 48, 46, 48, 59, 10, 9,125, 10, 9,101,108,115,101, 32,123, 10, 9, 9, 99, 32, 61, 32, 40,118,101, 99, 51, 40, 99, -109, 97,120, 44, 32, 99,109, 97,120, 44, 32, 99,109, 97,120, 41, 32, 45, 32,114,103, 98, 46,120,121,122, 41, 47, 99,100,101,108, -116, 97, 59, 10, 10, 9, 9,105,102, 32, 40,114,103, 98, 46,120, 61, 61, 99,109, 97,120, 41, 32,104, 32, 61, 32, 99, 91, 50, 93, - 32, 45, 32, 99, 91, 49, 93, 59, 10, 9, 9,101,108,115,101, 32,105,102, 32, 40,114,103, 98, 46,121, 61, 61, 99,109, 97,120, 41, - 32,104, 32, 61, 32, 50, 46, 48, 32, 43, 32, 99, 91, 48, 93, 32, 45, 32, 32, 99, 91, 50, 93, 59, 10, 9, 9,101,108,115,101, 32, -104, 32, 61, 32, 52, 46, 48, 32, 43, 32, 99, 91, 49, 93, 32, 45, 32, 99, 91, 48, 93, 59, 10, 10, 9, 9,104, 32, 47, 61, 32, 54, - 46, 48, 59, 10, 10, 9, 9,105,102, 32, 40,104, 60, 48, 46, 48, 41, 10, 9, 9, 9,104, 32, 43, 61, 32, 49, 46, 48, 59, 10, 9, -125, 10, 10, 9,111,117,116, 99,111,108, 32, 61, 32,118,101, 99, 52, 40,104, 44, 32,115, 44, 32,118, 44, 32,114,103, 98, 46,119, - 41, 59, 10,125, 10, 10,118,111,105,100, 32,104,115,118, 95,116,111, 95,114,103, 98, 40,118,101, 99, 52, 32,104,115,118, 44, 32, -111,117,116, 32,118,101, 99, 52, 32,111,117,116, 99,111,108, 41, 10,123, 10, 9,102,108,111, 97,116, 32,105, 44, 32,102, 44, 32, -112, 44, 32,113, 44, 32,116, 44, 32,104, 44, 32,115, 44, 32,118, 59, 10, 9,118,101, 99, 51, 32,114,103, 98, 59, 10, 10, 9,104, - 32, 61, 32,104,115,118, 91, 48, 93, 59, 10, 9,115, 32, 61, 32,104,115,118, 91, 49, 93, 59, 10, 9,118, 32, 61, 32,104,115,118, - 91, 50, 93, 59, 10, 10, 9,105,102, 40,115, 61, 61, 48, 46, 48, 41, 32,123, 10, 9, 9,114,103, 98, 32, 61, 32,118,101, 99, 51, - 40,118, 44, 32,118, 44, 32,118, 41, 59, 10, 9,125, 10, 9,101,108,115,101, 32,123, 10, 9, 9,105,102, 40,104, 61, 61, 49, 46, - 48, 41, 10, 9, 9, 9,104, 32, 61, 32, 48, 46, 48, 59, 10, 9, 9, 10, 9, 9,104, 32, 42, 61, 32, 54, 46, 48, 59, 10, 9, 9, -105, 32, 61, 32,102,108,111,111,114, 40,104, 41, 59, 10, 9, 9,102, 32, 61, 32,104, 32, 45, 32,105, 59, 10, 9, 9,114,103, 98, - 32, 61, 32,118,101, 99, 51, 40,102, 44, 32,102, 44, 32,102, 41, 59, 10, 9, 9,112, 32, 61, 32,118, 42, 40, 49, 46, 48, 45,115, - 41, 59, 10, 9, 9,113, 32, 61, 32,118, 42, 40, 49, 46, 48, 45, 40,115, 42,102, 41, 41, 59, 10, 9, 9,116, 32, 61, 32,118, 42, - 40, 49, 46, 48, 45, 40,115, 42, 40, 49, 46, 48, 45,102, 41, 41, 41, 59, 10, 9, 9, 10, 9, 9,105,102, 32, 40,105, 32, 61, 61, - 32, 48, 46, 48, 41, 32,114,103, 98, 32, 61, 32,118,101, 99, 51, 40,118, 44, 32,116, 44, 32,112, 41, 59, 10, 9, 9,101,108,115, -101, 32,105,102, 32, 40,105, 32, 61, 61, 32, 49, 46, 48, 41, 32,114,103, 98, 32, 61, 32,118,101, 99, 51, 40,113, 44, 32,118, 44, - 32,112, 41, 59, 10, 9, 9,101,108,115,101, 32,105,102, 32, 40,105, 32, 61, 61, 32, 50, 46, 48, 41, 32,114,103, 98, 32, 61, 32, -118,101, 99, 51, 40,112, 44, 32,118, 44, 32,116, 41, 59, 10, 9, 9,101,108,115,101, 32,105,102, 32, 40,105, 32, 61, 61, 32, 51, - 46, 48, 41, 32,114,103, 98, 32, 61, 32,118,101, 99, 51, 40,112, 44, 32,113, 44, 32,118, 41, 59, 10, 9, 9,101,108,115,101, 32, -105,102, 32, 40,105, 32, 61, 61, 32, 52, 46, 48, 41, 32,114,103, 98, 32, 61, 32,118,101, 99, 51, 40,116, 44, 32,112, 44, 32,118, - 41, 59, 10, 9, 9,101,108,115,101, 32,114,103, 98, 32, 61, 32,118,101, 99, 51, 40,118, 44, 32,112, 44, 32,113, 41, 59, 10, 9, -125, 10, 10, 9,111,117,116, 99,111,108, 32, 61, 32,118,101, 99, 52, 40,114,103, 98, 44, 32,104,115,118, 46,119, 41, 59, 10,125, - 10, 10,102,108,111, 97,116, 32,115,114,103, 98, 95,116,111, 95,108,105,110,101, 97,114,114,103, 98, 40,102,108,111, 97,116, 32, - 99, 41, 10,123, 10, 9,105,102, 40, 99, 32, 60, 32, 48, 46, 48, 52, 48, 52, 53, 41, 10, 9, 9,114,101,116,117,114,110, 32, 40, - 99, 32, 60, 32, 48, 46, 48, 41, 63, 32, 48, 46, 48, 58, 32, 99, 32, 42, 32, 40, 49, 46, 48, 47, 49, 50, 46, 57, 50, 41, 59, 10, - 9,101,108,115,101, 10, 9, 9,114,101,116,117,114,110, 32,112,111,119, 40, 40, 99, 32, 43, 32, 48, 46, 48, 53, 53, 41, 42, 40, - 49, 46, 48, 47, 49, 46, 48, 53, 53, 41, 44, 32, 50, 46, 52, 41, 59, 10,125, 10, 10,102,108,111, 97,116, 32,108,105,110,101, 97, -114,114,103, 98, 95,116,111, 95,115,114,103, 98, 40,102,108,111, 97,116, 32, 99, 41, 10,123, 10, 9,105,102, 40, 99, 32, 60, 32, - 48, 46, 48, 48, 51, 49, 51, 48, 56, 41, 10, 9, 9,114,101,116,117,114,110, 32, 40, 99, 32, 60, 32, 48, 46, 48, 41, 63, 32, 48, - 46, 48, 58, 32, 99, 32, 42, 32, 49, 50, 46, 57, 50, 59, 10, 9,101,108,115,101, 10, 9, 9,114,101,116,117,114,110, 32, 49, 46, - 48, 53, 53, 32, 42, 32,112,111,119, 40, 99, 44, 32, 49, 46, 48, 47, 50, 46, 52, 41, 32, 45, 32, 48, 46, 48, 53, 53, 59, 10,125, - 10, 10,118,111,105,100, 32,115,114,103, 98, 95,116,111, 95,108,105,110,101, 97,114,114,103, 98, 40,118,101, 99, 52, 32, 99,111, -108, 95,102,114,111,109, 44, 32,111,117,116, 32,118,101, 99, 52, 32, 99,111,108, 95,116,111, 41, 10,123, 10, 9, 99,111,108, 95, -116,111, 46,114, 32, 61, 32,115,114,103, 98, 95,116,111, 95,108,105,110,101, 97,114,114,103, 98, 40, 99,111,108, 95,102,114,111, -109, 46,114, 41, 59, 10, 9, 99,111,108, 95,116,111, 46,103, 32, 61, 32,115,114,103, 98, 95,116,111, 95,108,105,110,101, 97,114, -114,103, 98, 40, 99,111,108, 95,102,114,111,109, 46,103, 41, 59, 10, 9, 99,111,108, 95,116,111, 46, 98, 32, 61, 32,115,114,103, - 98, 95,116,111, 95,108,105,110,101, 97,114,114,103, 98, 40, 99,111,108, 95,102,114,111,109, 46, 98, 41, 59, 10, 9, 99,111,108, - 95,116,111, 46, 97, 32, 61, 32, 99,111,108, 95,102,114,111,109, 46, 97, 59, 10,125, 10, 10,118,111,105,100, 32,108,105,110,101, - 97,114,114,103, 98, 95,116,111, 95,115,114,103, 98, 40,118,101, 99, 52, 32, 99,111,108, 95,102,114,111,109, 44, 32,111,117,116, - 32,118,101, 99, 52, 32, 99,111,108, 95,116,111, 41, 10,123, 10, 9, 99,111,108, 95,116,111, 46,114, 32, 61, 32,108,105,110,101, - 97,114,114,103, 98, 95,116,111, 95,115,114,103, 98, 40, 99,111,108, 95,102,114,111,109, 46,114, 41, 59, 10, 9, 99,111,108, 95, -116,111, 46,103, 32, 61, 32,108,105,110,101, 97,114,114,103, 98, 95,116,111, 95,115,114,103, 98, 40, 99,111,108, 95,102,114,111, -109, 46,103, 41, 59, 10, 9, 99,111,108, 95,116,111, 46, 98, 32, 61, 32,108,105,110,101, 97,114,114,103, 98, 95,116,111, 95,115, -114,103, 98, 40, 99,111,108, 95,102,114,111,109, 46, 98, 41, 59, 10, 9, 99,111,108, 95,116,111, 46, 97, 32, 61, 32, 99,111,108, - 95,102,114,111,109, 46, 97, 59, 10,125, 10, 10, 35,100,101,102,105,110,101, 32, 77, 95, 80, 73, 32, 51, 46, 49, 52, 49, 53, 57, - 50, 54, 53, 51, 53, 56, 57, 55, 57, 51, 50, 51, 56, 52, 54, 10, 10, 47, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 32, 83, 72, - 65, 68, 69, 82, 32, 78, 79, 68, 69, 83, 32, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 47, 10, 10,118,111,105, -100, 32,118, 99,111,108, 95, 97,116,116,114,105, 98,117,116,101, 40,118,101, 99, 52, 32, 97,116,116,118, 99,111,108, 44, 32,111, -117,116, 32,118,101, 99, 52, 32,118, 99,111,108, 41, 10,123, 10, 9,118, 99,111,108, 32, 61, 32,118,101, 99, 52, 40, 97,116,116, -118, 99,111,108, 46,120, 47, 50, 53, 53, 46, 48, 44, 32, 97,116,116,118, 99,111,108, 46,121, 47, 50, 53, 53, 46, 48, 44, 32, 97, -116,116,118, 99,111,108, 46,122, 47, 50, 53, 53, 46, 48, 44, 32, 49, 46, 48, 41, 59, 10,125, 10, 10,118,111,105,100, 32,117,118, - 95, 97,116,116,114,105, 98,117,116,101, 40,118,101, 99, 50, 32, 97,116,116,117,118, 44, 32,111,117,116, 32,118,101, 99, 51, 32, -117,118, 41, 10,123, 10, 9,117,118, 32, 61, 32,118,101, 99, 51, 40, 97,116,116,117,118, 42, 50, 46, 48, 32, 45, 32,118,101, 99, - 50, 40, 49, 46, 48, 44, 32, 49, 46, 48, 41, 44, 32, 48, 46, 48, 41, 59, 10,125, 10, 10,118,111,105,100, 32,103,101,111,109, 40, -118,101, 99, 51, 32, 99,111, 44, 32,118,101, 99, 51, 32,110,111,114, 44, 32,109, 97,116, 52, 32,118,105,101,119,105,110,118,109, - 97,116, 44, 32,118,101, 99, 51, 32, 97,116,116,111,114, 99,111, 44, 32,118,101, 99, 50, 32, 97,116,116,117,118, 44, 32,118,101, - 99, 52, 32, 97,116,116,118, 99,111,108, 44, 32,111,117,116, 32,118,101, 99, 51, 32,103,108,111, 98, 97,108, 44, 32,111,117,116, - 32,118,101, 99, 51, 32,108,111, 99, 97,108, 44, 32,111,117,116, 32,118,101, 99, 51, 32,118,105,101,119, 44, 32,111,117,116, 32, -118,101, 99, 51, 32,111,114, 99,111, 44, 32,111,117,116, 32,118,101, 99, 51, 32,117,118, 44, 32,111,117,116, 32,118,101, 99, 51, - 32,110,111,114,109, 97,108, 44, 32,111,117,116, 32,118,101, 99, 52, 32,118, 99,111,108, 44, 32,111,117,116, 32,102,108,111, 97, -116, 32,102,114,111,110,116, 98, 97, 99,107, 41, 10,123, 10, 9,108,111, 99, 97,108, 32, 61, 32, 99,111, 59, 10, 9,118,105,101, -119, 32, 61, 32,110,111,114,109, 97,108,105,122,101, 40,108,111, 99, 97,108, 41, 59, 10, 9,103,108,111, 98, 97,108, 32, 61, 32, - 40,118,105,101,119,105,110,118,109, 97,116, 42,118,101, 99, 52, 40,108,111, 99, 97,108, 44, 32, 49, 46, 48, 41, 41, 46,120,121, -122, 59, 10, 9,111,114, 99,111, 32, 61, 32, 97,116,116,111,114, 99,111, 59, 10, 9,117,118, 95, 97,116,116,114,105, 98,117,116, -101, 40, 97,116,116,117,118, 44, 32,117,118, 41, 59, 10, 9,110,111,114,109, 97,108, 32, 61, 32, 45,110,111,114,109, 97,108,105, -122,101, 40,110,111,114, 41, 59, 9, 47, 42, 32, 98,108,101,110,100,101,114, 32,114,101,110,100,101,114, 32,110,111,114,109, 97, -108, 32,105,115, 32,110,101,103, 97,116,101,100, 32, 42, 47, 10, 9,118, 99,111,108, 95, 97,116,116,114,105, 98,117,116,101, 40, - 97,116,116,118, 99,111,108, 44, 32,118, 99,111,108, 41, 59, 10, 9,102,114,111,110,116, 98, 97, 99,107, 32, 61, 32, 49, 46, 48, - 59, 10,125, 10, 10,118,111,105,100, 32,109, 97,112,112,105,110,103, 40,118,101, 99, 51, 32,118,101, 99, 44, 32,109, 97,116, 52, - 32,109, 97,116, 44, 32,118,101, 99, 51, 32,109,105,110,118,101, 99, 44, 32,118,101, 99, 51, 32,109, 97,120,118,101, 99, 44, 32, -102,108,111, 97,116, 32,100,111,109,105,110, 44, 32,102,108,111, 97,116, 32,100,111,109, 97,120, 44, 32,111,117,116, 32,118,101, - 99, 51, 32,111,117,116,118,101, 99, 41, 10,123, 10, 9,111,117,116,118,101, 99, 32, 61, 32, 40,109, 97,116, 32, 42, 32,118,101, - 99, 52, 40,118,101, 99, 44, 32, 49, 46, 48, 41, 41, 46,120,121,122, 59, 10, 9,105,102, 40,100,111,109,105,110, 32, 61, 61, 32, - 49, 46, 48, 41, 10, 9, 9,111,117,116,118,101, 99, 32, 61, 32,109, 97,120, 40,111,117,116,118,101, 99, 44, 32,109,105,110,118, -101, 99, 41, 59, 10, 9,105,102, 40,100,111,109, 97,120, 32, 61, 61, 32, 49, 46, 48, 41, 10, 9, 9,111,117,116,118,101, 99, 32, - 61, 32,109,105,110, 40,111,117,116,118,101, 99, 44, 32,109, 97,120,118,101, 99, 41, 59, 10,125, 10, 10,118,111,105,100, 32, 99, - 97,109,101,114, 97, 40,118,101, 99, 51, 32, 99,111, 44, 32,111,117,116, 32,118,101, 99, 51, 32,111,117,116,118,105,101,119, 44, - 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,100,101,112,116,104, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111, -117,116,100,105,115,116, 41, 10,123, 10, 9,111,117,116,100,101,112,116,104, 32, 61, 32, 97, 98,115, 40, 99,111, 46,122, 41, 59, - 10, 9,111,117,116,100,105,115,116, 32, 61, 32,108,101,110,103,116,104, 40, 99,111, 41, 59, 10, 9,111,117,116,118,105,101,119, - 32, 61, 32,110,111,114,109, 97,108,105,122,101, 40, 99,111, 41, 59, 10,125, 10, 10,118,111,105,100, 32,109, 97,116,104, 95, 97, -100,100, 40,102,108,111, 97,116, 32,118, 97,108, 49, 44, 32,102,108,111, 97,116, 32,118, 97,108, 50, 44, 32,111,117,116, 32,102, -108,111, 97,116, 32,111,117,116,118, 97,108, 41, 10,123, 10, 9,111,117,116,118, 97,108, 32, 61, 32,118, 97,108, 49, 32, 43, 32, -118, 97,108, 50, 59, 10,125, 10, 10,118,111,105,100, 32,109, 97,116,104, 95,115,117, 98,116,114, 97, 99,116, 40,102,108,111, 97, -116, 32,118, 97,108, 49, 44, 32,102,108,111, 97,116, 32,118, 97,108, 50, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117, -116,118, 97,108, 41, 10,123, 10, 9,111,117,116,118, 97,108, 32, 61, 32,118, 97,108, 49, 32, 45, 32,118, 97,108, 50, 59, 10,125, - 10, 10,118,111,105,100, 32,109, 97,116,104, 95,109,117,108,116,105,112,108,121, 40,102,108,111, 97,116, 32,118, 97,108, 49, 44, - 32,102,108,111, 97,116, 32,118, 97,108, 50, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, 10,123, - 10, 9,111,117,116,118, 97,108, 32, 61, 32,118, 97,108, 49, 32, 42, 32,118, 97,108, 50, 59, 10,125, 10, 10,118,111,105,100, 32, -109, 97,116,104, 95,100,105,118,105,100,101, 40,102,108,111, 97,116, 32,118, 97,108, 49, 44, 32,102,108,111, 97,116, 32,118, 97, -108, 50, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, 10,123, 10, 9,105,102, 32, 40,118, 97,108, - 50, 32, 61, 61, 32, 48, 46, 48, 41, 10, 9, 9,111,117,116,118, 97,108, 32, 61, 32, 48, 46, 48, 59, 10, 9,101,108,115,101, 10, - 9, 9,111,117,116,118, 97,108, 32, 61, 32,118, 97,108, 49, 32, 47, 32,118, 97,108, 50, 59, 10,125, 10, 10,118,111,105,100, 32, -109, 97,116,104, 95,115,105,110,101, 40,102,108,111, 97,116, 32,118, 97,108, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111, -117,116,118, 97,108, 41, 10,123, 10, 9,111,117,116,118, 97,108, 32, 61, 32,115,105,110, 40,118, 97,108, 41, 59, 10,125, 10, 10, -118,111,105,100, 32,109, 97,116,104, 95, 99,111,115,105,110,101, 40,102,108,111, 97,116, 32,118, 97,108, 44, 32,111,117,116, 32, -102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, 10,123, 10, 9,111,117,116,118, 97,108, 32, 61, 32, 99,111,115, 40,118, 97, -108, 41, 59, 10,125, 10, 10,118,111,105,100, 32,109, 97,116,104, 95,116, 97,110,103,101,110,116, 40,102,108,111, 97,116, 32,118, - 97,108, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, 10,123, 10, 9,111,117,116,118, 97,108, 32, - 61, 32,116, 97,110, 40,118, 97,108, 41, 59, 10,125, 10, 10,118,111,105,100, 32,109, 97,116,104, 95, 97,115,105,110, 40,102,108, -111, 97,116, 32,118, 97,108, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, 10,123, 10, 9,105,102, - 32, 40,118, 97,108, 32, 60, 61, 32, 49, 46, 48, 32, 38, 38, 32,118, 97,108, 32, 62, 61, 32, 45, 49, 46, 48, 41, 10, 9, 9,111, -117,116,118, 97,108, 32, 61, 32, 97,115,105,110, 40,118, 97,108, 41, 59, 10, 9,101,108,115,101, 10, 9, 9,111,117,116,118, 97, -108, 32, 61, 32, 48, 46, 48, 59, 10,125, 10, 10,118,111,105,100, 32,109, 97,116,104, 95, 97, 99,111,115, 40,102,108,111, 97,116, - 32,118, 97,108, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, 10,123, 10, 9,105,102, 32, 40,118, - 97,108, 32, 60, 61, 32, 49, 46, 48, 32, 38, 38, 32,118, 97,108, 32, 62, 61, 32, 45, 49, 46, 48, 41, 10, 9, 9,111,117,116,118, - 97,108, 32, 61, 32, 97, 99,111,115, 40,118, 97,108, 41, 59, 10, 9,101,108,115,101, 10, 9, 9,111,117,116,118, 97,108, 32, 61, - 32, 48, 46, 48, 59, 10,125, 10, 10,118,111,105,100, 32,109, 97,116,104, 95, 97,116, 97,110, 40,102,108,111, 97,116, 32,118, 97, -108, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, 10,123, 10, 9,111,117,116,118, 97,108, 32, 61, - 32, 97,116, 97,110, 40,118, 97,108, 41, 59, 10,125, 10, 10,118,111,105,100, 32,109, 97,116,104, 95,112,111,119, 40,102,108,111, - 97,116, 32,118, 97,108, 49, 44, 32,102,108,111, 97,116, 32,118, 97,108, 50, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111, -117,116,118, 97,108, 41, 10,123, 10, 9,105,102, 32, 40,118, 97,108, 49, 32, 62, 61, 32, 48, 46, 48, 41, 10, 9, 9,111,117,116, -118, 97,108, 32, 61, 32,112,111,119, 40,118, 97,108, 49, 44, 32,118, 97,108, 50, 41, 59, 10, 9,101,108,115,101, 10, 9, 9,111, -117,116,118, 97,108, 32, 61, 32, 48, 46, 48, 59, 10,125, 10, 10,118,111,105,100, 32,109, 97,116,104, 95,108,111,103, 40,102,108, -111, 97,116, 32,118, 97,108, 49, 44, 32,102,108,111, 97,116, 32,118, 97,108, 50, 44, 32,111,117,116, 32,102,108,111, 97,116, 32, -111,117,116,118, 97,108, 41, 10,123, 10, 9,105,102, 40,118, 97,108, 49, 32, 62, 32, 48, 46, 48, 32, 32, 38, 38, 32,118, 97,108, - 50, 32, 62, 32, 48, 46, 48, 41, 10, 9, 9,111,117,116,118, 97,108, 61, 32,108,111,103, 50, 40,118, 97,108, 49, 41, 32, 47, 32, -108,111,103, 50, 40,118, 97,108, 50, 41, 59, 10, 9,101,108,115,101, 10, 9, 9,111,117,116,118, 97,108, 61, 32, 48, 46, 48, 59, - 10,125, 10, 10,118,111,105,100, 32,109, 97,116,104, 95,109, 97,120, 40,102,108,111, 97,116, 32,118, 97,108, 49, 44, 32,102,108, -111, 97,116, 32,118, 97,108, 50, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, 10,123, 10, 9,111, -117,116,118, 97,108, 32, 61, 32,109, 97,120, 40,118, 97,108, 49, 44, 32,118, 97,108, 50, 41, 59, 10,125, 10, 10,118,111,105,100, - 32,109, 97,116,104, 95,109,105,110, 40,102,108,111, 97,116, 32,118, 97,108, 49, 44, 32,102,108,111, 97,116, 32,118, 97,108, 50, - 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, 10,123, 10, 9,111,117,116,118, 97,108, 32, 61, 32, -109,105,110, 40,118, 97,108, 49, 44, 32,118, 97,108, 50, 41, 59, 10,125, 10, 10,118,111,105,100, 32,109, 97,116,104, 95,114,111, -117,110,100, 40,102,108,111, 97,116, 32,118, 97,108, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, - 10,123, 10, 9,111,117,116,118, 97,108, 61, 32,102,108,111,111,114, 40,118, 97,108, 32, 43, 32, 48, 46, 53, 41, 59, 10,125, 10, - 10,118,111,105,100, 32,109, 97,116,104, 95,108,101,115,115, 95,116,104, 97,110, 40,102,108,111, 97,116, 32,118, 97,108, 49, 44, - 32,102,108,111, 97,116, 32,118, 97,108, 50, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, 10,123, - 10, 9,105,102, 40,118, 97,108, 49, 32, 60, 32,118, 97,108, 50, 41, 10, 9, 9,111,117,116,118, 97,108, 32, 61, 32, 49, 46, 48, - 59, 10, 9,101,108,115,101, 10, 9, 9,111,117,116,118, 97,108, 32, 61, 32, 48, 46, 48, 59, 10,125, 10, 10,118,111,105,100, 32, -109, 97,116,104, 95,103,114,101, 97,116,101,114, 95,116,104, 97,110, 40,102,108,111, 97,116, 32,118, 97,108, 49, 44, 32,102,108, -111, 97,116, 32,118, 97,108, 50, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, 10,123, 10, 9,105, -102, 40,118, 97,108, 49, 32, 62, 32,118, 97,108, 50, 41, 10, 9, 9,111,117,116,118, 97,108, 32, 61, 32, 49, 46, 48, 59, 10, 9, -101,108,115,101, 10, 9, 9,111,117,116,118, 97,108, 32, 61, 32, 48, 46, 48, 59, 10,125, 10, 10,118,111,105,100, 32,115,113,117, -101,101,122,101, 40,102,108,111, 97,116, 32,118, 97,108, 44, 32,102,108,111, 97,116, 32,119,105,100,116,104, 44, 32,102,108,111, - 97,116, 32, 99,101,110,116,101,114, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, 10,123, 10, 9, -111,117,116,118, 97,108, 32, 61, 32, 49, 46, 48, 47, 40, 49, 46, 48, 32, 43, 32,112,111,119, 40, 50, 46, 55, 49, 56, 50, 56, 49, - 56, 51, 44, 32, 45, 40, 40,118, 97,108, 45, 99,101,110,116,101,114, 41, 42,119,105,100,116,104, 41, 41, 41, 59, 10,125, 10, 10, -118,111,105,100, 32,118,101, 99, 95,109, 97,116,104, 95, 97,100,100, 40,118,101, 99, 51, 32,118, 49, 44, 32,118,101, 99, 51, 32, -118, 50, 44, 32,111,117,116, 32,118,101, 99, 51, 32,111,117,116,118,101, 99, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111, -117,116,118, 97,108, 41, 10,123, 10, 9,111,117,116,118,101, 99, 32, 61, 32,118, 49, 32, 43, 32,118, 50, 59, 10, 9,111,117,116, -118, 97,108, 32, 61, 32, 40, 97, 98,115, 40,111,117,116,118,101, 99, 91, 48, 93, 41, 32, 43, 32, 97, 98,115, 40,111,117,116,118, -101, 99, 91, 49, 93, 41, 32, 43, 32, 97, 98,115, 40,111,117,116,118,101, 99, 91, 50, 93, 41, 41, 47, 51, 46, 48, 59, 10,125, 10, - 10,118,111,105,100, 32,118,101, 99, 95,109, 97,116,104, 95,115,117, 98, 40,118,101, 99, 51, 32,118, 49, 44, 32,118,101, 99, 51, - 32,118, 50, 44, 32,111,117,116, 32,118,101, 99, 51, 32,111,117,116,118,101, 99, 44, 32,111,117,116, 32,102,108,111, 97,116, 32, -111,117,116,118, 97,108, 41, 10,123, 10, 9,111,117,116,118,101, 99, 32, 61, 32,118, 49, 32, 45, 32,118, 50, 59, 10, 9,111,117, -116,118, 97,108, 32, 61, 32, 40, 97, 98,115, 40,111,117,116,118,101, 99, 91, 48, 93, 41, 32, 43, 32, 97, 98,115, 40,111,117,116, -118,101, 99, 91, 49, 93, 41, 32, 43, 32, 97, 98,115, 40,111,117,116,118,101, 99, 91, 50, 93, 41, 41, 47, 51, 46, 48, 59, 10,125, - 10, 10,118,111,105,100, 32,118,101, 99, 95,109, 97,116,104, 95, 97,118,101,114, 97,103,101, 40,118,101, 99, 51, 32,118, 49, 44, + 10,102,108,111, + 97,116, 32,101,120,112, 95, 98,108,101,110,100,101,114, 40,102,108,111, 97,116, 32,102, 41, 10,123, 10, 9,114,101,116,117,114, +110, 32,112,111,119, 40, 50, 46, 55, 49, 56, 50, 56, 49, 56, 50, 56, 52, 54, 44, 32,102, 41, 59, 10,125, 10, 10,118,111,105,100, + 32,114,103, 98, 95,116,111, 95,104,115,118, 40,118,101, 99, 52, 32,114,103, 98, 44, 32,111,117,116, 32,118,101, 99, 52, 32,111, +117,116, 99,111,108, 41, 10,123, 10, 9,102,108,111, 97,116, 32, 99,109, 97,120, 44, 32, 99,109,105,110, 44, 32,104, 44, 32,115, + 44, 32,118, 44, 32, 99,100,101,108,116, 97, 59, 10, 9,118,101, 99, 51, 32, 99, 59, 10, 10, 9, 99,109, 97,120, 32, 61, 32,109, + 97,120, 40,114,103, 98, 91, 48, 93, 44, 32,109, 97,120, 40,114,103, 98, 91, 49, 93, 44, 32,114,103, 98, 91, 50, 93, 41, 41, 59, + 10, 9, 99,109,105,110, 32, 61, 32,109,105,110, 40,114,103, 98, 91, 48, 93, 44, 32,109,105,110, 40,114,103, 98, 91, 49, 93, 44, + 32,114,103, 98, 91, 50, 93, 41, 41, 59, 10, 9, 99,100,101,108,116, 97, 32, 61, 32, 99,109, 97,120, 45, 99,109,105,110, 59, 10, + 10, 9,118, 32, 61, 32, 99,109, 97,120, 59, 10, 9,105,102, 32, 40, 99,109, 97,120, 33, 61, 48, 46, 48, 41, 10, 9, 9,115, 32, + 61, 32, 99,100,101,108,116, 97, 47, 99,109, 97,120, 59, 10, 9,101,108,115,101, 32,123, 10, 9, 9,115, 32, 61, 32, 48, 46, 48, + 59, 10, 9, 9,104, 32, 61, 32, 48, 46, 48, 59, 10, 9,125, 10, 10, 9,105,102, 32, 40,115, 32, 61, 61, 32, 48, 46, 48, 41, 32, +123, 10, 9, 9,104, 32, 61, 32, 48, 46, 48, 59, 10, 9,125, 10, 9,101,108,115,101, 32,123, 10, 9, 9, 99, 32, 61, 32, 40,118, +101, 99, 51, 40, 99,109, 97,120, 44, 32, 99,109, 97,120, 44, 32, 99,109, 97,120, 41, 32, 45, 32,114,103, 98, 46,120,121,122, 41, + 47, 99,100,101,108,116, 97, 59, 10, 10, 9, 9,105,102, 32, 40,114,103, 98, 46,120, 61, 61, 99,109, 97,120, 41, 32,104, 32, 61, + 32, 99, 91, 50, 93, 32, 45, 32, 99, 91, 49, 93, 59, 10, 9, 9,101,108,115,101, 32,105,102, 32, 40,114,103, 98, 46,121, 61, 61, + 99,109, 97,120, 41, 32,104, 32, 61, 32, 50, 46, 48, 32, 43, 32, 99, 91, 48, 93, 32, 45, 32, 32, 99, 91, 50, 93, 59, 10, 9, 9, +101,108,115,101, 32,104, 32, 61, 32, 52, 46, 48, 32, 43, 32, 99, 91, 49, 93, 32, 45, 32, 99, 91, 48, 93, 59, 10, 10, 9, 9,104, + 32, 47, 61, 32, 54, 46, 48, 59, 10, 10, 9, 9,105,102, 32, 40,104, 60, 48, 46, 48, 41, 10, 9, 9, 9,104, 32, 43, 61, 32, 49, + 46, 48, 59, 10, 9,125, 10, 10, 9,111,117,116, 99,111,108, 32, 61, 32,118,101, 99, 52, 40,104, 44, 32,115, 44, 32,118, 44, 32, +114,103, 98, 46,119, 41, 59, 10,125, 10, 10,118,111,105,100, 32,104,115,118, 95,116,111, 95,114,103, 98, 40,118,101, 99, 52, 32, +104,115,118, 44, 32,111,117,116, 32,118,101, 99, 52, 32,111,117,116, 99,111,108, 41, 10,123, 10, 9,102,108,111, 97,116, 32,105, + 44, 32,102, 44, 32,112, 44, 32,113, 44, 32,116, 44, 32,104, 44, 32,115, 44, 32,118, 59, 10, 9,118,101, 99, 51, 32,114,103, 98, + 59, 10, 10, 9,104, 32, 61, 32,104,115,118, 91, 48, 93, 59, 10, 9,115, 32, 61, 32,104,115,118, 91, 49, 93, 59, 10, 9,118, 32, + 61, 32,104,115,118, 91, 50, 93, 59, 10, 10, 9,105,102, 40,115, 61, 61, 48, 46, 48, 41, 32,123, 10, 9, 9,114,103, 98, 32, 61, + 32,118,101, 99, 51, 40,118, 44, 32,118, 44, 32,118, 41, 59, 10, 9,125, 10, 9,101,108,115,101, 32,123, 10, 9, 9,105,102, 40, +104, 61, 61, 49, 46, 48, 41, 10, 9, 9, 9,104, 32, 61, 32, 48, 46, 48, 59, 10, 9, 9, 10, 9, 9,104, 32, 42, 61, 32, 54, 46, + 48, 59, 10, 9, 9,105, 32, 61, 32,102,108,111,111,114, 40,104, 41, 59, 10, 9, 9,102, 32, 61, 32,104, 32, 45, 32,105, 59, 10, + 9, 9,114,103, 98, 32, 61, 32,118,101, 99, 51, 40,102, 44, 32,102, 44, 32,102, 41, 59, 10, 9, 9,112, 32, 61, 32,118, 42, 40, + 49, 46, 48, 45,115, 41, 59, 10, 9, 9,113, 32, 61, 32,118, 42, 40, 49, 46, 48, 45, 40,115, 42,102, 41, 41, 59, 10, 9, 9,116, + 32, 61, 32,118, 42, 40, 49, 46, 48, 45, 40,115, 42, 40, 49, 46, 48, 45,102, 41, 41, 41, 59, 10, 9, 9, 10, 9, 9,105,102, 32, + 40,105, 32, 61, 61, 32, 48, 46, 48, 41, 32,114,103, 98, 32, 61, 32,118,101, 99, 51, 40,118, 44, 32,116, 44, 32,112, 41, 59, 10, + 9, 9,101,108,115,101, 32,105,102, 32, 40,105, 32, 61, 61, 32, 49, 46, 48, 41, 32,114,103, 98, 32, 61, 32,118,101, 99, 51, 40, +113, 44, 32,118, 44, 32,112, 41, 59, 10, 9, 9,101,108,115,101, 32,105,102, 32, 40,105, 32, 61, 61, 32, 50, 46, 48, 41, 32,114, +103, 98, 32, 61, 32,118,101, 99, 51, 40,112, 44, 32,118, 44, 32,116, 41, 59, 10, 9, 9,101,108,115,101, 32,105,102, 32, 40,105, + 32, 61, 61, 32, 51, 46, 48, 41, 32,114,103, 98, 32, 61, 32,118,101, 99, 51, 40,112, 44, 32,113, 44, 32,118, 41, 59, 10, 9, 9, +101,108,115,101, 32,105,102, 32, 40,105, 32, 61, 61, 32, 52, 46, 48, 41, 32,114,103, 98, 32, 61, 32,118,101, 99, 51, 40,116, 44, + 32,112, 44, 32,118, 41, 59, 10, 9, 9,101,108,115,101, 32,114,103, 98, 32, 61, 32,118,101, 99, 51, 40,118, 44, 32,112, 44, 32, +113, 41, 59, 10, 9,125, 10, 10, 9,111,117,116, 99,111,108, 32, 61, 32,118,101, 99, 52, 40,114,103, 98, 44, 32,104,115,118, 46, +119, 41, 59, 10,125, 10, 10,102,108,111, 97,116, 32,115,114,103, 98, 95,116,111, 95,108,105,110,101, 97,114,114,103, 98, 40,102, +108,111, 97,116, 32, 99, 41, 10,123, 10, 9,105,102, 40, 99, 32, 60, 32, 48, 46, 48, 52, 48, 52, 53, 41, 10, 9, 9,114,101,116, +117,114,110, 32, 40, 99, 32, 60, 32, 48, 46, 48, 41, 63, 32, 48, 46, 48, 58, 32, 99, 32, 42, 32, 40, 49, 46, 48, 47, 49, 50, 46, + 57, 50, 41, 59, 10, 9,101,108,115,101, 10, 9, 9,114,101,116,117,114,110, 32,112,111,119, 40, 40, 99, 32, 43, 32, 48, 46, 48, + 53, 53, 41, 42, 40, 49, 46, 48, 47, 49, 46, 48, 53, 53, 41, 44, 32, 50, 46, 52, 41, 59, 10,125, 10, 10,102,108,111, 97,116, 32, +108,105,110,101, 97,114,114,103, 98, 95,116,111, 95,115,114,103, 98, 40,102,108,111, 97,116, 32, 99, 41, 10,123, 10, 9,105,102, + 40, 99, 32, 60, 32, 48, 46, 48, 48, 51, 49, 51, 48, 56, 41, 10, 9, 9,114,101,116,117,114,110, 32, 40, 99, 32, 60, 32, 48, 46, + 48, 41, 63, 32, 48, 46, 48, 58, 32, 99, 32, 42, 32, 49, 50, 46, 57, 50, 59, 10, 9,101,108,115,101, 10, 9, 9,114,101,116,117, +114,110, 32, 49, 46, 48, 53, 53, 32, 42, 32,112,111,119, 40, 99, 44, 32, 49, 46, 48, 47, 50, 46, 52, 41, 32, 45, 32, 48, 46, 48, + 53, 53, 59, 10,125, 10, 10,118,111,105,100, 32,115,114,103, 98, 95,116,111, 95,108,105,110,101, 97,114,114,103, 98, 40,118,101, + 99, 52, 32, 99,111,108, 95,102,114,111,109, 44, 32,111,117,116, 32,118,101, 99, 52, 32, 99,111,108, 95,116,111, 41, 10,123, 10, + 9, 99,111,108, 95,116,111, 46,114, 32, 61, 32,115,114,103, 98, 95,116,111, 95,108,105,110,101, 97,114,114,103, 98, 40, 99,111, +108, 95,102,114,111,109, 46,114, 41, 59, 10, 9, 99,111,108, 95,116,111, 46,103, 32, 61, 32,115,114,103, 98, 95,116,111, 95,108, +105,110,101, 97,114,114,103, 98, 40, 99,111,108, 95,102,114,111,109, 46,103, 41, 59, 10, 9, 99,111,108, 95,116,111, 46, 98, 32, + 61, 32,115,114,103, 98, 95,116,111, 95,108,105,110,101, 97,114,114,103, 98, 40, 99,111,108, 95,102,114,111,109, 46, 98, 41, 59, + 10, 9, 99,111,108, 95,116,111, 46, 97, 32, 61, 32, 99,111,108, 95,102,114,111,109, 46, 97, 59, 10,125, 10, 10,118,111,105,100, + 32,108,105,110,101, 97,114,114,103, 98, 95,116,111, 95,115,114,103, 98, 40,118,101, 99, 52, 32, 99,111,108, 95,102,114,111,109, + 44, 32,111,117,116, 32,118,101, 99, 52, 32, 99,111,108, 95,116,111, 41, 10,123, 10, 9, 99,111,108, 95,116,111, 46,114, 32, 61, + 32,108,105,110,101, 97,114,114,103, 98, 95,116,111, 95,115,114,103, 98, 40, 99,111,108, 95,102,114,111,109, 46,114, 41, 59, 10, + 9, 99,111,108, 95,116,111, 46,103, 32, 61, 32,108,105,110,101, 97,114,114,103, 98, 95,116,111, 95,115,114,103, 98, 40, 99,111, +108, 95,102,114,111,109, 46,103, 41, 59, 10, 9, 99,111,108, 95,116,111, 46, 98, 32, 61, 32,108,105,110,101, 97,114,114,103, 98, + 95,116,111, 95,115,114,103, 98, 40, 99,111,108, 95,102,114,111,109, 46, 98, 41, 59, 10, 9, 99,111,108, 95,116,111, 46, 97, 32, + 61, 32, 99,111,108, 95,102,114,111,109, 46, 97, 59, 10,125, 10, 10, 35,100,101,102,105,110,101, 32, 77, 95, 80, 73, 32, 51, 46, + 49, 52, 49, 53, 57, 50, 54, 53, 51, 53, 56, 57, 55, 57, 51, 50, 51, 56, 52, 54, 10, 10, 47, 42, 42, 42, 42, 42, 42, 42, 42, 42, + 42, 42, 32, 83, 72, 65, 68, 69, 82, 32, 78, 79, 68, 69, 83, 32, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 47, + 10, 10,118,111,105,100, 32,118, 99,111,108, 95, 97,116,116,114,105, 98,117,116,101, 40,118,101, 99, 52, 32, 97,116,116,118, 99, +111,108, 44, 32,111,117,116, 32,118,101, 99, 52, 32,118, 99,111,108, 41, 10,123, 10, 9,118, 99,111,108, 32, 61, 32,118,101, 99, + 52, 40, 97,116,116,118, 99,111,108, 46,120, 47, 50, 53, 53, 46, 48, 44, 32, 97,116,116,118, 99,111,108, 46,121, 47, 50, 53, 53, + 46, 48, 44, 32, 97,116,116,118, 99,111,108, 46,122, 47, 50, 53, 53, 46, 48, 44, 32, 49, 46, 48, 41, 59, 10,125, 10, 10,118,111, +105,100, 32,117,118, 95, 97,116,116,114,105, 98,117,116,101, 40,118,101, 99, 50, 32, 97,116,116,117,118, 44, 32,111,117,116, 32, +118,101, 99, 51, 32,117,118, 41, 10,123, 10, 9,117,118, 32, 61, 32,118,101, 99, 51, 40, 97,116,116,117,118, 42, 50, 46, 48, 32, + 45, 32,118,101, 99, 50, 40, 49, 46, 48, 44, 32, 49, 46, 48, 41, 44, 32, 48, 46, 48, 41, 59, 10,125, 10, 10,118,111,105,100, 32, +103,101,111,109, 40,118,101, 99, 51, 32, 99,111, 44, 32,118,101, 99, 51, 32,110,111,114, 44, 32,109, 97,116, 52, 32,118,105,101, +119,105,110,118,109, 97,116, 44, 32,118,101, 99, 51, 32, 97,116,116,111,114, 99,111, 44, 32,118,101, 99, 50, 32, 97,116,116,117, +118, 44, 32,118,101, 99, 52, 32, 97,116,116,118, 99,111,108, 44, 32,111,117,116, 32,118,101, 99, 51, 32,103,108,111, 98, 97,108, + 44, 32,111,117,116, 32,118,101, 99, 51, 32,108,111, 99, 97,108, 44, 32,111,117,116, 32,118,101, 99, 51, 32,118,105,101,119, 44, + 32,111,117,116, 32,118,101, 99, 51, 32,111,114, 99,111, 44, 32,111,117,116, 32,118,101, 99, 51, 32,117,118, 44, 32,111,117,116, + 32,118,101, 99, 51, 32,110,111,114,109, 97,108, 44, 32,111,117,116, 32,118,101, 99, 52, 32,118, 99,111,108, 44, 32,111,117,116, + 32,102,108,111, 97,116, 32,102,114,111,110,116, 98, 97, 99,107, 41, 10,123, 10, 9,108,111, 99, 97,108, 32, 61, 32, 99,111, 59, + 10, 9,118,105,101,119, 32, 61, 32,110,111,114,109, 97,108,105,122,101, 40,108,111, 99, 97,108, 41, 59, 10, 9,103,108,111, 98, + 97,108, 32, 61, 32, 40,118,105,101,119,105,110,118,109, 97,116, 42,118,101, 99, 52, 40,108,111, 99, 97,108, 44, 32, 49, 46, 48, + 41, 41, 46,120,121,122, 59, 10, 9,111,114, 99,111, 32, 61, 32, 97,116,116,111,114, 99,111, 59, 10, 9,117,118, 95, 97,116,116, +114,105, 98,117,116,101, 40, 97,116,116,117,118, 44, 32,117,118, 41, 59, 10, 9,110,111,114,109, 97,108, 32, 61, 32, 45,110,111, +114,109, 97,108,105,122,101, 40,110,111,114, 41, 59, 9, 47, 42, 32, 98,108,101,110,100,101,114, 32,114,101,110,100,101,114, 32, +110,111,114,109, 97,108, 32,105,115, 32,110,101,103, 97,116,101,100, 32, 42, 47, 10, 9,118, 99,111,108, 95, 97,116,116,114,105, + 98,117,116,101, 40, 97,116,116,118, 99,111,108, 44, 32,118, 99,111,108, 41, 59, 10, 9,102,114,111,110,116, 98, 97, 99,107, 32, + 61, 32, 49, 46, 48, 59, 10,125, 10, 10,118,111,105,100, 32,109, 97,112,112,105,110,103, 40,118,101, 99, 51, 32,118,101, 99, 44, + 32,109, 97,116, 52, 32,109, 97,116, 44, 32,118,101, 99, 51, 32,109,105,110,118,101, 99, 44, 32,118,101, 99, 51, 32,109, 97,120, +118,101, 99, 44, 32,102,108,111, 97,116, 32,100,111,109,105,110, 44, 32,102,108,111, 97,116, 32,100,111,109, 97,120, 44, 32,111, +117,116, 32,118,101, 99, 51, 32,111,117,116,118,101, 99, 41, 10,123, 10, 9,111,117,116,118,101, 99, 32, 61, 32, 40,109, 97,116, + 32, 42, 32,118,101, 99, 52, 40,118,101, 99, 44, 32, 49, 46, 48, 41, 41, 46,120,121,122, 59, 10, 9,105,102, 40,100,111,109,105, +110, 32, 61, 61, 32, 49, 46, 48, 41, 10, 9, 9,111,117,116,118,101, 99, 32, 61, 32,109, 97,120, 40,111,117,116,118,101, 99, 44, + 32,109,105,110,118,101, 99, 41, 59, 10, 9,105,102, 40,100,111,109, 97,120, 32, 61, 61, 32, 49, 46, 48, 41, 10, 9, 9,111,117, +116,118,101, 99, 32, 61, 32,109,105,110, 40,111,117,116,118,101, 99, 44, 32,109, 97,120,118,101, 99, 41, 59, 10,125, 10, 10,118, +111,105,100, 32, 99, 97,109,101,114, 97, 40,118,101, 99, 51, 32, 99,111, 44, 32,111,117,116, 32,118,101, 99, 51, 32,111,117,116, +118,105,101,119, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,100,101,112,116,104, 44, 32,111,117,116, 32,102,108, +111, 97,116, 32,111,117,116,100,105,115,116, 41, 10,123, 10, 9,111,117,116,100,101,112,116,104, 32, 61, 32, 97, 98,115, 40, 99, +111, 46,122, 41, 59, 10, 9,111,117,116,100,105,115,116, 32, 61, 32,108,101,110,103,116,104, 40, 99,111, 41, 59, 10, 9,111,117, +116,118,105,101,119, 32, 61, 32,110,111,114,109, 97,108,105,122,101, 40, 99,111, 41, 59, 10,125, 10, 10,118,111,105,100, 32,109, + 97,116,104, 95, 97,100,100, 40,102,108,111, 97,116, 32,118, 97,108, 49, 44, 32,102,108,111, 97,116, 32,118, 97,108, 50, 44, 32, +111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, 10,123, 10, 9,111,117,116,118, 97,108, 32, 61, 32,118, 97, +108, 49, 32, 43, 32,118, 97,108, 50, 59, 10,125, 10, 10,118,111,105,100, 32,109, 97,116,104, 95,115,117, 98,116,114, 97, 99,116, + 40,102,108,111, 97,116, 32,118, 97,108, 49, 44, 32,102,108,111, 97,116, 32,118, 97,108, 50, 44, 32,111,117,116, 32,102,108,111, + 97,116, 32,111,117,116,118, 97,108, 41, 10,123, 10, 9,111,117,116,118, 97,108, 32, 61, 32,118, 97,108, 49, 32, 45, 32,118, 97, +108, 50, 59, 10,125, 10, 10,118,111,105,100, 32,109, 97,116,104, 95,109,117,108,116,105,112,108,121, 40,102,108,111, 97,116, 32, +118, 97,108, 49, 44, 32,102,108,111, 97,116, 32,118, 97,108, 50, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, + 97,108, 41, 10,123, 10, 9,111,117,116,118, 97,108, 32, 61, 32,118, 97,108, 49, 32, 42, 32,118, 97,108, 50, 59, 10,125, 10, 10, +118,111,105,100, 32,109, 97,116,104, 95,100,105,118,105,100,101, 40,102,108,111, 97,116, 32,118, 97,108, 49, 44, 32,102,108,111, + 97,116, 32,118, 97,108, 50, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, 10,123, 10, 9,105,102, + 32, 40,118, 97,108, 50, 32, 61, 61, 32, 48, 46, 48, 41, 10, 9, 9,111,117,116,118, 97,108, 32, 61, 32, 48, 46, 48, 59, 10, 9, +101,108,115,101, 10, 9, 9,111,117,116,118, 97,108, 32, 61, 32,118, 97,108, 49, 32, 47, 32,118, 97,108, 50, 59, 10,125, 10, 10, +118,111,105,100, 32,109, 97,116,104, 95,115,105,110,101, 40,102,108,111, 97,116, 32,118, 97,108, 44, 32,111,117,116, 32,102,108, +111, 97,116, 32,111,117,116,118, 97,108, 41, 10,123, 10, 9,111,117,116,118, 97,108, 32, 61, 32,115,105,110, 40,118, 97,108, 41, + 59, 10,125, 10, 10,118,111,105,100, 32,109, 97,116,104, 95, 99,111,115,105,110,101, 40,102,108,111, 97,116, 32,118, 97,108, 44, + 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, 10,123, 10, 9,111,117,116,118, 97,108, 32, 61, 32, 99, +111,115, 40,118, 97,108, 41, 59, 10,125, 10, 10,118,111,105,100, 32,109, 97,116,104, 95,116, 97,110,103,101,110,116, 40,102,108, +111, 97,116, 32,118, 97,108, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, 10,123, 10, 9,111,117, +116,118, 97,108, 32, 61, 32,116, 97,110, 40,118, 97,108, 41, 59, 10,125, 10, 10,118,111,105,100, 32,109, 97,116,104, 95, 97,115, +105,110, 40,102,108,111, 97,116, 32,118, 97,108, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, 10, +123, 10, 9,105,102, 32, 40,118, 97,108, 32, 60, 61, 32, 49, 46, 48, 32, 38, 38, 32,118, 97,108, 32, 62, 61, 32, 45, 49, 46, 48, + 41, 10, 9, 9,111,117,116,118, 97,108, 32, 61, 32, 97,115,105,110, 40,118, 97,108, 41, 59, 10, 9,101,108,115,101, 10, 9, 9, +111,117,116,118, 97,108, 32, 61, 32, 48, 46, 48, 59, 10,125, 10, 10,118,111,105,100, 32,109, 97,116,104, 95, 97, 99,111,115, 40, +102,108,111, 97,116, 32,118, 97,108, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, 10,123, 10, 9, +105,102, 32, 40,118, 97,108, 32, 60, 61, 32, 49, 46, 48, 32, 38, 38, 32,118, 97,108, 32, 62, 61, 32, 45, 49, 46, 48, 41, 10, 9, + 9,111,117,116,118, 97,108, 32, 61, 32, 97, 99,111,115, 40,118, 97,108, 41, 59, 10, 9,101,108,115,101, 10, 9, 9,111,117,116, +118, 97,108, 32, 61, 32, 48, 46, 48, 59, 10,125, 10, 10,118,111,105,100, 32,109, 97,116,104, 95, 97,116, 97,110, 40,102,108,111, + 97,116, 32,118, 97,108, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, 10,123, 10, 9,111,117,116, +118, 97,108, 32, 61, 32, 97,116, 97,110, 40,118, 97,108, 41, 59, 10,125, 10, 10,118,111,105,100, 32,109, 97,116,104, 95,112,111, +119, 40,102,108,111, 97,116, 32,118, 97,108, 49, 44, 32,102,108,111, 97,116, 32,118, 97,108, 50, 44, 32,111,117,116, 32,102,108, +111, 97,116, 32,111,117,116,118, 97,108, 41, 10,123, 10, 9,105,102, 32, 40,118, 97,108, 49, 32, 62, 61, 32, 48, 46, 48, 41, 10, + 9, 9,111,117,116,118, 97,108, 32, 61, 32,112,111,119, 40,118, 97,108, 49, 44, 32,118, 97,108, 50, 41, 59, 10, 9,101,108,115, +101, 10, 9, 9,111,117,116,118, 97,108, 32, 61, 32, 48, 46, 48, 59, 10,125, 10, 10,118,111,105,100, 32,109, 97,116,104, 95,108, +111,103, 40,102,108,111, 97,116, 32,118, 97,108, 49, 44, 32,102,108,111, 97,116, 32,118, 97,108, 50, 44, 32,111,117,116, 32,102, +108,111, 97,116, 32,111,117,116,118, 97,108, 41, 10,123, 10, 9,105,102, 40,118, 97,108, 49, 32, 62, 32, 48, 46, 48, 32, 32, 38, + 38, 32,118, 97,108, 50, 32, 62, 32, 48, 46, 48, 41, 10, 9, 9,111,117,116,118, 97,108, 61, 32,108,111,103, 50, 40,118, 97,108, + 49, 41, 32, 47, 32,108,111,103, 50, 40,118, 97,108, 50, 41, 59, 10, 9,101,108,115,101, 10, 9, 9,111,117,116,118, 97,108, 61, + 32, 48, 46, 48, 59, 10,125, 10, 10,118,111,105,100, 32,109, 97,116,104, 95,109, 97,120, 40,102,108,111, 97,116, 32,118, 97,108, + 49, 44, 32,102,108,111, 97,116, 32,118, 97,108, 50, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, + 10,123, 10, 9,111,117,116,118, 97,108, 32, 61, 32,109, 97,120, 40,118, 97,108, 49, 44, 32,118, 97,108, 50, 41, 59, 10,125, 10, + 10,118,111,105,100, 32,109, 97,116,104, 95,109,105,110, 40,102,108,111, 97,116, 32,118, 97,108, 49, 44, 32,102,108,111, 97,116, + 32,118, 97,108, 50, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, 10,123, 10, 9,111,117,116,118, + 97,108, 32, 61, 32,109,105,110, 40,118, 97,108, 49, 44, 32,118, 97,108, 50, 41, 59, 10,125, 10, 10,118,111,105,100, 32,109, 97, +116,104, 95,114,111,117,110,100, 40,102,108,111, 97,116, 32,118, 97,108, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117, +116,118, 97,108, 41, 10,123, 10, 9,111,117,116,118, 97,108, 61, 32,102,108,111,111,114, 40,118, 97,108, 32, 43, 32, 48, 46, 53, + 41, 59, 10,125, 10, 10,118,111,105,100, 32,109, 97,116,104, 95,108,101,115,115, 95,116,104, 97,110, 40,102,108,111, 97,116, 32, +118, 97,108, 49, 44, 32,102,108,111, 97,116, 32,118, 97,108, 50, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, + 97,108, 41, 10,123, 10, 9,105,102, 40,118, 97,108, 49, 32, 60, 32,118, 97,108, 50, 41, 10, 9, 9,111,117,116,118, 97,108, 32, + 61, 32, 49, 46, 48, 59, 10, 9,101,108,115,101, 10, 9, 9,111,117,116,118, 97,108, 32, 61, 32, 48, 46, 48, 59, 10,125, 10, 10, +118,111,105,100, 32,109, 97,116,104, 95,103,114,101, 97,116,101,114, 95,116,104, 97,110, 40,102,108,111, 97,116, 32,118, 97,108, + 49, 44, 32,102,108,111, 97,116, 32,118, 97,108, 50, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, + 10,123, 10, 9,105,102, 40,118, 97,108, 49, 32, 62, 32,118, 97,108, 50, 41, 10, 9, 9,111,117,116,118, 97,108, 32, 61, 32, 49, + 46, 48, 59, 10, 9,101,108,115,101, 10, 9, 9,111,117,116,118, 97,108, 32, 61, 32, 48, 46, 48, 59, 10,125, 10, 10,118,111,105, +100, 32,115,113,117,101,101,122,101, 40,102,108,111, 97,116, 32,118, 97,108, 44, 32,102,108,111, 97,116, 32,119,105,100,116,104, + 44, 32,102,108,111, 97,116, 32, 99,101,110,116,101,114, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, + 41, 10,123, 10, 9,111,117,116,118, 97,108, 32, 61, 32, 49, 46, 48, 47, 40, 49, 46, 48, 32, 43, 32,112,111,119, 40, 50, 46, 55, + 49, 56, 50, 56, 49, 56, 51, 44, 32, 45, 40, 40,118, 97,108, 45, 99,101,110,116,101,114, 41, 42,119,105,100,116,104, 41, 41, 41, + 59, 10,125, 10, 10,118,111,105,100, 32,118,101, 99, 95,109, 97,116,104, 95, 97,100,100, 40,118,101, 99, 51, 32,118, 49, 44, 32, +118,101, 99, 51, 32,118, 50, 44, 32,111,117,116, 32,118,101, 99, 51, 32,111,117,116,118,101, 99, 44, 32,111,117,116, 32,102,108, +111, 97,116, 32,111,117,116,118, 97,108, 41, 10,123, 10, 9,111,117,116,118,101, 99, 32, 61, 32,118, 49, 32, 43, 32,118, 50, 59, + 10, 9,111,117,116,118, 97,108, 32, 61, 32, 40, 97, 98,115, 40,111,117,116,118,101, 99, 91, 48, 93, 41, 32, 43, 32, 97, 98,115, + 40,111,117,116,118,101, 99, 91, 49, 93, 41, 32, 43, 32, 97, 98,115, 40,111,117,116,118,101, 99, 91, 50, 93, 41, 41, 47, 51, 46, + 48, 59, 10,125, 10, 10,118,111,105,100, 32,118,101, 99, 95,109, 97,116,104, 95,115,117, 98, 40,118,101, 99, 51, 32,118, 49, 44, 32,118,101, 99, 51, 32,118, 50, 44, 32,111,117,116, 32,118,101, 99, 51, 32,111,117,116,118,101, 99, 44, 32,111,117,116, 32,102, -108,111, 97,116, 32,111,117,116,118, 97,108, 41, 10,123, 10, 9,111,117,116,118,101, 99, 32, 61, 32,118, 49, 32, 43, 32,118, 50, - 59, 10, 9,111,117,116,118, 97,108, 32, 61, 32,108,101,110,103,116,104, 40,111,117,116,118,101, 99, 41, 59, 10, 9,111,117,116, -118,101, 99, 32, 61, 32,110,111,114,109, 97,108,105,122,101, 40,111,117,116,118,101, 99, 41, 59, 10,125, 10, 10,118,111,105,100, - 32,118,101, 99, 95,109, 97,116,104, 95,100,111,116, 40,118,101, 99, 51, 32,118, 49, 44, 32,118,101, 99, 51, 32,118, 50, 44, 32, -111,117,116, 32,118,101, 99, 51, 32,111,117,116,118,101, 99, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97, -108, 41, 10,123, 10, 9,111,117,116,118,101, 99, 32, 61, 32,118,101, 99, 51, 40, 48, 44, 32, 48, 44, 32, 48, 41, 59, 10, 9,111, -117,116,118, 97,108, 32, 61, 32,100,111,116, 40,118, 49, 44, 32,118, 50, 41, 59, 10,125, 10, 10,118,111,105,100, 32,118,101, 99, - 95,109, 97,116,104, 95, 99,114,111,115,115, 40,118,101, 99, 51, 32,118, 49, 44, 32,118,101, 99, 51, 32,118, 50, 44, 32,111,117, +108,111, 97,116, 32,111,117,116,118, 97,108, 41, 10,123, 10, 9,111,117,116,118,101, 99, 32, 61, 32,118, 49, 32, 45, 32,118, 50, + 59, 10, 9,111,117,116,118, 97,108, 32, 61, 32, 40, 97, 98,115, 40,111,117,116,118,101, 99, 91, 48, 93, 41, 32, 43, 32, 97, 98, +115, 40,111,117,116,118,101, 99, 91, 49, 93, 41, 32, 43, 32, 97, 98,115, 40,111,117,116,118,101, 99, 91, 50, 93, 41, 41, 47, 51, + 46, 48, 59, 10,125, 10, 10,118,111,105,100, 32,118,101, 99, 95,109, 97,116,104, 95, 97,118,101,114, 97,103,101, 40,118,101, 99, + 51, 32,118, 49, 44, 32,118,101, 99, 51, 32,118, 50, 44, 32,111,117,116, 32,118,101, 99, 51, 32,111,117,116,118,101, 99, 44, 32, +111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, 10,123, 10, 9,111,117,116,118,101, 99, 32, 61, 32,118, 49, + 32, 43, 32,118, 50, 59, 10, 9,111,117,116,118, 97,108, 32, 61, 32,108,101,110,103,116,104, 40,111,117,116,118,101, 99, 41, 59, + 10, 9,111,117,116,118,101, 99, 32, 61, 32,110,111,114,109, 97,108,105,122,101, 40,111,117,116,118,101, 99, 41, 59, 10,125, 10, + 10,118,111,105,100, 32,118,101, 99, 95,109, 97,116,104, 95,100,111,116, 40,118,101, 99, 51, 32,118, 49, 44, 32,118,101, 99, 51, + 32,118, 50, 44, 32,111,117,116, 32,118,101, 99, 51, 32,111,117,116,118,101, 99, 44, 32,111,117,116, 32,102,108,111, 97,116, 32, +111,117,116,118, 97,108, 41, 10,123, 10, 9,111,117,116,118,101, 99, 32, 61, 32,118,101, 99, 51, 40, 48, 44, 32, 48, 44, 32, 48, + 41, 59, 10, 9,111,117,116,118, 97,108, 32, 61, 32,100,111,116, 40,118, 49, 44, 32,118, 50, 41, 59, 10,125, 10, 10,118,111,105, +100, 32,118,101, 99, 95,109, 97,116,104, 95, 99,114,111,115,115, 40,118,101, 99, 51, 32,118, 49, 44, 32,118,101, 99, 51, 32,118, + 50, 44, 32,111,117,116, 32,118,101, 99, 51, 32,111,117,116,118,101, 99, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117, +116,118, 97,108, 41, 10,123, 10, 9,111,117,116,118,101, 99, 32, 61, 32, 99,114,111,115,115, 40,118, 49, 44, 32,118, 50, 41, 59, + 10, 9,111,117,116,118, 97,108, 32, 61, 32,108,101,110,103,116,104, 40,111,117,116,118,101, 99, 41, 59, 10,125, 10, 10,118,111, +105,100, 32,118,101, 99, 95,109, 97,116,104, 95,110,111,114,109, 97,108,105,122,101, 40,118,101, 99, 51, 32,118, 44, 32,111,117, 116, 32,118,101, 99, 51, 32,111,117,116,118,101, 99, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, - 10,123, 10, 9,111,117,116,118,101, 99, 32, 61, 32, 99,114,111,115,115, 40,118, 49, 44, 32,118, 50, 41, 59, 10, 9,111,117,116, -118, 97,108, 32, 61, 32,108,101,110,103,116,104, 40,111,117,116,118,101, 99, 41, 59, 10,125, 10, 10,118,111,105,100, 32,118,101, - 99, 95,109, 97,116,104, 95,110,111,114,109, 97,108,105,122,101, 40,118,101, 99, 51, 32,118, 44, 32,111,117,116, 32,118,101, 99, - 51, 32,111,117,116,118,101, 99, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, 10,123, 10, 9,111, -117,116,118, 97,108, 32, 61, 32,108,101,110,103,116,104, 40,118, 41, 59, 10, 9,111,117,116,118,101, 99, 32, 61, 32,110,111,114, -109, 97,108,105,122,101, 40,118, 41, 59, 10,125, 10, 10,118,111,105,100, 32,118,101, 99, 95,109, 97,116,104, 95,110,101,103, 97, -116,101, 40,118,101, 99, 51, 32,118, 44, 32,111,117,116, 32,118,101, 99, 51, 32,111,117,116,118, 41, 10,123, 10, 9,111,117,116, -118, 32, 61, 32, 45,118, 59, 10,125, 10, 10,118,111,105,100, 32,110,111,114,109, 97,108, 40,118,101, 99, 51, 32,100,105,114, 44, - 32,118,101, 99, 51, 32,110,111,114, 44, 32,111,117,116, 32,118,101, 99, 51, 32,111,117,116,110,111,114, 44, 32,111,117,116, 32, -102,108,111, 97,116, 32,111,117,116,100,111,116, 41, 10,123, 10, 9,111,117,116,110,111,114, 32, 61, 32,100,105,114, 59, 10, 9, -111,117,116,100,111,116, 32, 61, 32, 45,100,111,116, 40,100,105,114, 44, 32,110,111,114, 41, 59, 10,125, 10, 10,118,111,105,100, - 32, 99,117,114,118,101,115, 95,118,101, 99, 40,102,108,111, 97,116, 32,102, 97, 99, 44, 32,118,101, 99, 51, 32,118,101, 99, 44, - 32,115, 97,109,112,108,101,114, 49, 68, 32, 99,117,114,118,101,109, 97,112, 44, 32,111,117,116, 32,118,101, 99, 51, 32,111,117, -116,118,101, 99, 41, 10,123, 10, 9,111,117,116,118,101, 99, 46,120, 32, 61, 32,116,101,120,116,117,114,101, 49, 68, 40, 99,117, -114,118,101,109, 97,112, 44, 32, 40,118,101, 99, 46,120, 32, 43, 32, 49, 46, 48, 41, 42, 48, 46, 53, 41, 46,120, 59, 10, 9,111, -117,116,118,101, 99, 46,121, 32, 61, 32,116,101,120,116,117,114,101, 49, 68, 40, 99,117,114,118,101,109, 97,112, 44, 32, 40,118, -101, 99, 46,121, 32, 43, 32, 49, 46, 48, 41, 42, 48, 46, 53, 41, 46,121, 59, 10, 9,111,117,116,118,101, 99, 46,122, 32, 61, 32, -116,101,120,116,117,114,101, 49, 68, 40, 99,117,114,118,101,109, 97,112, 44, 32, 40,118,101, 99, 46,122, 32, 43, 32, 49, 46, 48, - 41, 42, 48, 46, 53, 41, 46,122, 59, 10, 10, 9,105,102, 32, 40,102, 97, 99, 32, 33, 61, 32, 49, 46, 48, 41, 10, 9, 9,111,117, -116,118,101, 99, 32, 61, 32, 40,111,117,116,118,101, 99, 42,102, 97, 99, 41, 32, 43, 32, 40,118,101, 99, 42, 40, 49, 46, 48, 45, -102, 97, 99, 41, 41, 59, 10, 10,125, 10, 10,118,111,105,100, 32, 99,117,114,118,101,115, 95,114,103, 98, 40,102,108,111, 97,116, - 32,102, 97, 99, 44, 32,118,101, 99, 52, 32, 99,111,108, 44, 32,115, 97,109,112,108,101,114, 49, 68, 32, 99,117,114,118,101,109, - 97,112, 44, 32,111,117,116, 32,118,101, 99, 52, 32,111,117,116, 99,111,108, 41, 10,123, 10, 9,111,117,116, 99,111,108, 46,114, - 32, 61, 32,116,101,120,116,117,114,101, 49, 68, 40, 99,117,114,118,101,109, 97,112, 44, 32,116,101,120,116,117,114,101, 49, 68, - 40, 99,117,114,118,101,109, 97,112, 44, 32, 99,111,108, 46,114, 41, 46, 97, 41, 46,114, 59, 10, 9,111,117,116, 99,111,108, 46, -103, 32, 61, 32,116,101,120,116,117,114,101, 49, 68, 40, 99,117,114,118,101,109, 97,112, 44, 32,116,101,120,116,117,114,101, 49, - 68, 40, 99,117,114,118,101,109, 97,112, 44, 32, 99,111,108, 46,103, 41, 46, 97, 41, 46,103, 59, 10, 9,111,117,116, 99,111,108, - 46, 98, 32, 61, 32,116,101,120,116,117,114,101, 49, 68, 40, 99,117,114,118,101,109, 97,112, 44, 32,116,101,120,116,117,114,101, - 49, 68, 40, 99,117,114,118,101,109, 97,112, 44, 32, 99,111,108, 46, 98, 41, 46, 97, 41, 46, 98, 59, 10, 10, 9,105,102, 32, 40, -102, 97, 99, 32, 33, 61, 32, 49, 46, 48, 41, 10, 9, 9,111,117,116, 99,111,108, 32, 61, 32, 40,111,117,116, 99,111,108, 42,102, - 97, 99, 41, 32, 43, 32, 40, 99,111,108, 42, 40, 49, 46, 48, 45,102, 97, 99, 41, 41, 59, 10, 10, 9,111,117,116, 99,111,108, 46, - 97, 32, 61, 32, 99,111,108, 46, 97, 59, 10,125, 10, 10,118,111,105,100, 32,115,101,116, 95,118, 97,108,117,101, 40,102,108,111, - 97,116, 32,118, 97,108, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, 10,123, 10, 9,111,117,116, -118, 97,108, 32, 61, 32,118, 97,108, 59, 10,125, 10, 10,118,111,105,100, 32,115,101,116, 95,114,103, 98, 40,118,101, 99, 51, 32, - 99,111,108, 44, 32,111,117,116, 32,118,101, 99, 51, 32,111,117,116, 99,111,108, 41, 10,123, 10, 9,111,117,116, 99,111,108, 32, - 61, 32, 99,111,108, 59, 10,125, 10, 10,118,111,105,100, 32,115,101,116, 95,114,103, 98, 97, 40,118,101, 99, 52, 32, 99,111,108, - 44, 32,111,117,116, 32,118,101, 99, 52, 32,111,117,116, 99,111,108, 41, 10,123, 10, 9,111,117,116, 99,111,108, 32, 61, 32, 99, -111,108, 59, 10,125, 10, 10,118,111,105,100, 32,115,101,116, 95,118, 97,108,117,101, 95,122,101,114,111, 40,111,117,116, 32,102, -108,111, 97,116, 32,111,117,116,118, 97,108, 41, 10,123, 10, 9,111,117,116,118, 97,108, 32, 61, 32, 48, 46, 48, 59, 10,125, 10, - 10,118,111,105,100, 32,115,101,116, 95,118, 97,108,117,101, 95,111,110,101, 40,111,117,116, 32,102,108,111, 97,116, 32,111,117, -116,118, 97,108, 41, 10,123, 10, 9,111,117,116,118, 97,108, 32, 61, 32, 49, 46, 48, 59, 10,125, 10, 10,118,111,105,100, 32,115, -101,116, 95,114,103, 98, 95,122,101,114,111, 40,111,117,116, 32,118,101, 99, 51, 32,111,117,116,118, 97,108, 41, 10,123, 10, 9, -111,117,116,118, 97,108, 32, 61, 32,118,101, 99, 51, 40, 48, 46, 48, 41, 59, 10,125, 10, 10,118,111,105,100, 32,115,101,116, 95, -114,103, 98, 97, 95,122,101,114,111, 40,111,117,116, 32,118,101, 99, 52, 32,111,117,116,118, 97,108, 41, 10,123, 10, 9,111,117, -116,118, 97,108, 32, 61, 32,118,101, 99, 52, 40, 48, 46, 48, 41, 59, 10,125, 10, 10,118,111,105,100, 32,109,105,120, 95, 98,108, -101,110,100, 40,102,108,111, 97,116, 32,102, 97, 99, 44, 32,118,101, 99, 52, 32, 99,111,108, 49, 44, 32,118,101, 99, 52, 32, 99, -111,108, 50, 44, 32,111,117,116, 32,118,101, 99, 52, 32,111,117,116, 99,111,108, 41, 10,123, 10, 9,102, 97, 99, 32, 61, 32, 99, -108, 97,109,112, 40,102, 97, 99, 44, 32, 48, 46, 48, 44, 32, 49, 46, 48, 41, 59, 10, 9,111,117,116, 99,111,108, 32, 61, 32,109, -105,120, 40, 99,111,108, 49, 44, 32, 99,111,108, 50, 44, 32,102, 97, 99, 41, 59, 10, 9,111,117,116, 99,111,108, 46, 97, 32, 61, - 32, 99,111,108, 49, 46, 97, 59, 10,125, 10, 10,118,111,105,100, 32,109,105,120, 95, 97,100,100, 40,102,108,111, 97,116, 32,102, - 97, 99, 44, 32,118,101, 99, 52, 32, 99,111,108, 49, 44, 32,118,101, 99, 52, 32, 99,111,108, 50, 44, 32,111,117,116, 32,118,101, - 99, 52, 32,111,117,116, 99,111,108, 41, 10,123, 10, 9,102, 97, 99, 32, 61, 32, 99,108, 97,109,112, 40,102, 97, 99, 44, 32, 48, - 46, 48, 44, 32, 49, 46, 48, 41, 59, 10, 9,111,117,116, 99,111,108, 32, 61, 32,109,105,120, 40, 99,111,108, 49, 44, 32, 99,111, -108, 49, 32, 43, 32, 99,111,108, 50, 44, 32,102, 97, 99, 41, 59, 10, 9,111,117,116, 99,111,108, 46, 97, 32, 61, 32, 99,111,108, - 49, 46, 97, 59, 10,125, 10, 10,118,111,105,100, 32,109,105,120, 95,109,117,108,116, 40,102,108,111, 97,116, 32,102, 97, 99, 44, - 32,118,101, 99, 52, 32, 99,111,108, 49, 44, 32,118,101, 99, 52, 32, 99,111,108, 50, 44, 32,111,117,116, 32,118,101, 99, 52, 32, -111,117,116, 99,111,108, 41, 10,123, 10, 9,102, 97, 99, 32, 61, 32, 99,108, 97,109,112, 40,102, 97, 99, 44, 32, 48, 46, 48, 44, - 32, 49, 46, 48, 41, 59, 10, 9,111,117,116, 99,111,108, 32, 61, 32,109,105,120, 40, 99,111,108, 49, 44, 32, 99,111,108, 49, 32, - 42, 32, 99,111,108, 50, 44, 32,102, 97, 99, 41, 59, 10, 9,111,117,116, 99,111,108, 46, 97, 32, 61, 32, 99,111,108, 49, 46, 97, - 59, 10,125, 10, 10,118,111,105,100, 32,109,105,120, 95,115, 99,114,101,101,110, 40,102,108,111, 97,116, 32,102, 97, 99, 44, 32, + 10,123, 10, 9,111,117,116,118, 97,108, 32, 61, 32,108,101,110,103,116,104, 40,118, 41, 59, 10, 9,111,117,116,118,101, 99, 32, + 61, 32,110,111,114,109, 97,108,105,122,101, 40,118, 41, 59, 10,125, 10, 10,118,111,105,100, 32,118,101, 99, 95,109, 97,116,104, + 95,110,101,103, 97,116,101, 40,118,101, 99, 51, 32,118, 44, 32,111,117,116, 32,118,101, 99, 51, 32,111,117,116,118, 41, 10,123, + 10, 9,111,117,116,118, 32, 61, 32, 45,118, 59, 10,125, 10, 10,118,111,105,100, 32,110,111,114,109, 97,108, 40,118,101, 99, 51, + 32,100,105,114, 44, 32,118,101, 99, 51, 32,110,111,114, 44, 32,111,117,116, 32,118,101, 99, 51, 32,111,117,116,110,111,114, 44, + 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,100,111,116, 41, 10,123, 10, 9,111,117,116,110,111,114, 32, 61, 32,100, +105,114, 59, 10, 9,111,117,116,100,111,116, 32, 61, 32, 45,100,111,116, 40,100,105,114, 44, 32,110,111,114, 41, 59, 10,125, 10, + 10,118,111,105,100, 32, 99,117,114,118,101,115, 95,118,101, 99, 40,102,108,111, 97,116, 32,102, 97, 99, 44, 32,118,101, 99, 51, + 32,118,101, 99, 44, 32,115, 97,109,112,108,101,114, 49, 68, 32, 99,117,114,118,101,109, 97,112, 44, 32,111,117,116, 32,118,101, + 99, 51, 32,111,117,116,118,101, 99, 41, 10,123, 10, 9,111,117,116,118,101, 99, 46,120, 32, 61, 32,116,101,120,116,117,114,101, + 49, 68, 40, 99,117,114,118,101,109, 97,112, 44, 32, 40,118,101, 99, 46,120, 32, 43, 32, 49, 46, 48, 41, 42, 48, 46, 53, 41, 46, +120, 59, 10, 9,111,117,116,118,101, 99, 46,121, 32, 61, 32,116,101,120,116,117,114,101, 49, 68, 40, 99,117,114,118,101,109, 97, +112, 44, 32, 40,118,101, 99, 46,121, 32, 43, 32, 49, 46, 48, 41, 42, 48, 46, 53, 41, 46,121, 59, 10, 9,111,117,116,118,101, 99, + 46,122, 32, 61, 32,116,101,120,116,117,114,101, 49, 68, 40, 99,117,114,118,101,109, 97,112, 44, 32, 40,118,101, 99, 46,122, 32, + 43, 32, 49, 46, 48, 41, 42, 48, 46, 53, 41, 46,122, 59, 10, 10, 9,105,102, 32, 40,102, 97, 99, 32, 33, 61, 32, 49, 46, 48, 41, + 10, 9, 9,111,117,116,118,101, 99, 32, 61, 32, 40,111,117,116,118,101, 99, 42,102, 97, 99, 41, 32, 43, 32, 40,118,101, 99, 42, + 40, 49, 46, 48, 45,102, 97, 99, 41, 41, 59, 10, 10,125, 10, 10,118,111,105,100, 32, 99,117,114,118,101,115, 95,114,103, 98, 40, +102,108,111, 97,116, 32,102, 97, 99, 44, 32,118,101, 99, 52, 32, 99,111,108, 44, 32,115, 97,109,112,108,101,114, 49, 68, 32, 99, +117,114,118,101,109, 97,112, 44, 32,111,117,116, 32,118,101, 99, 52, 32,111,117,116, 99,111,108, 41, 10,123, 10, 9,111,117,116, + 99,111,108, 46,114, 32, 61, 32,116,101,120,116,117,114,101, 49, 68, 40, 99,117,114,118,101,109, 97,112, 44, 32,116,101,120,116, +117,114,101, 49, 68, 40, 99,117,114,118,101,109, 97,112, 44, 32, 99,111,108, 46,114, 41, 46, 97, 41, 46,114, 59, 10, 9,111,117, +116, 99,111,108, 46,103, 32, 61, 32,116,101,120,116,117,114,101, 49, 68, 40, 99,117,114,118,101,109, 97,112, 44, 32,116,101,120, +116,117,114,101, 49, 68, 40, 99,117,114,118,101,109, 97,112, 44, 32, 99,111,108, 46,103, 41, 46, 97, 41, 46,103, 59, 10, 9,111, +117,116, 99,111,108, 46, 98, 32, 61, 32,116,101,120,116,117,114,101, 49, 68, 40, 99,117,114,118,101,109, 97,112, 44, 32,116,101, +120,116,117,114,101, 49, 68, 40, 99,117,114,118,101,109, 97,112, 44, 32, 99,111,108, 46, 98, 41, 46, 97, 41, 46, 98, 59, 10, 10, + 9,105,102, 32, 40,102, 97, 99, 32, 33, 61, 32, 49, 46, 48, 41, 10, 9, 9,111,117,116, 99,111,108, 32, 61, 32, 40,111,117,116, + 99,111,108, 42,102, 97, 99, 41, 32, 43, 32, 40, 99,111,108, 42, 40, 49, 46, 48, 45,102, 97, 99, 41, 41, 59, 10, 10, 9,111,117, +116, 99,111,108, 46, 97, 32, 61, 32, 99,111,108, 46, 97, 59, 10,125, 10, 10,118,111,105,100, 32,115,101,116, 95,118, 97,108,117, +101, 40,102,108,111, 97,116, 32,118, 97,108, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, 10,123, + 10, 9,111,117,116,118, 97,108, 32, 61, 32,118, 97,108, 59, 10,125, 10, 10,118,111,105,100, 32,115,101,116, 95,114,103, 98, 40, +118,101, 99, 51, 32, 99,111,108, 44, 32,111,117,116, 32,118,101, 99, 51, 32,111,117,116, 99,111,108, 41, 10,123, 10, 9,111,117, +116, 99,111,108, 32, 61, 32, 99,111,108, 59, 10,125, 10, 10,118,111,105,100, 32,115,101,116, 95,114,103, 98, 97, 40,118,101, 99, + 52, 32, 99,111,108, 44, 32,111,117,116, 32,118,101, 99, 52, 32,111,117,116, 99,111,108, 41, 10,123, 10, 9,111,117,116, 99,111, +108, 32, 61, 32, 99,111,108, 59, 10,125, 10, 10,118,111,105,100, 32,115,101,116, 95,118, 97,108,117,101, 95,122,101,114,111, 40, +111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, 10,123, 10, 9,111,117,116,118, 97,108, 32, 61, 32, 48, 46, + 48, 59, 10,125, 10, 10,118,111,105,100, 32,115,101,116, 95,118, 97,108,117,101, 95,111,110,101, 40,111,117,116, 32,102,108,111, + 97,116, 32,111,117,116,118, 97,108, 41, 10,123, 10, 9,111,117,116,118, 97,108, 32, 61, 32, 49, 46, 48, 59, 10,125, 10, 10,118, +111,105,100, 32,115,101,116, 95,114,103, 98, 95,122,101,114,111, 40,111,117,116, 32,118,101, 99, 51, 32,111,117,116,118, 97,108, + 41, 10,123, 10, 9,111,117,116,118, 97,108, 32, 61, 32,118,101, 99, 51, 40, 48, 46, 48, 41, 59, 10,125, 10, 10,118,111,105,100, + 32,115,101,116, 95,114,103, 98, 97, 95,122,101,114,111, 40,111,117,116, 32,118,101, 99, 52, 32,111,117,116,118, 97,108, 41, 10, +123, 10, 9,111,117,116,118, 97,108, 32, 61, 32,118,101, 99, 52, 40, 48, 46, 48, 41, 59, 10,125, 10, 10,118,111,105,100, 32,109, +105,120, 95, 98,108,101,110,100, 40,102,108,111, 97,116, 32,102, 97, 99, 44, 32,118,101, 99, 52, 32, 99,111,108, 49, 44, 32,118, +101, 99, 52, 32, 99,111,108, 50, 44, 32,111,117,116, 32,118,101, 99, 52, 32,111,117,116, 99,111,108, 41, 10,123, 10, 9,102, 97, + 99, 32, 61, 32, 99,108, 97,109,112, 40,102, 97, 99, 44, 32, 48, 46, 48, 44, 32, 49, 46, 48, 41, 59, 10, 9,111,117,116, 99,111, +108, 32, 61, 32,109,105,120, 40, 99,111,108, 49, 44, 32, 99,111,108, 50, 44, 32,102, 97, 99, 41, 59, 10, 9,111,117,116, 99,111, +108, 46, 97, 32, 61, 32, 99,111,108, 49, 46, 97, 59, 10,125, 10, 10,118,111,105,100, 32,109,105,120, 95, 97,100,100, 40,102,108, +111, 97,116, 32,102, 97, 99, 44, 32,118,101, 99, 52, 32, 99,111,108, 49, 44, 32,118,101, 99, 52, 32, 99,111,108, 50, 44, 32,111, +117,116, 32,118,101, 99, 52, 32,111,117,116, 99,111,108, 41, 10,123, 10, 9,102, 97, 99, 32, 61, 32, 99,108, 97,109,112, 40,102, + 97, 99, 44, 32, 48, 46, 48, 44, 32, 49, 46, 48, 41, 59, 10, 9,111,117,116, 99,111,108, 32, 61, 32,109,105,120, 40, 99,111,108, + 49, 44, 32, 99,111,108, 49, 32, 43, 32, 99,111,108, 50, 44, 32,102, 97, 99, 41, 59, 10, 9,111,117,116, 99,111,108, 46, 97, 32, + 61, 32, 99,111,108, 49, 46, 97, 59, 10,125, 10, 10,118,111,105,100, 32,109,105,120, 95,109,117,108,116, 40,102,108,111, 97,116, + 32,102, 97, 99, 44, 32,118,101, 99, 52, 32, 99,111,108, 49, 44, 32,118,101, 99, 52, 32, 99,111,108, 50, 44, 32,111,117,116, 32, +118,101, 99, 52, 32,111,117,116, 99,111,108, 41, 10,123, 10, 9,102, 97, 99, 32, 61, 32, 99,108, 97,109,112, 40,102, 97, 99, 44, + 32, 48, 46, 48, 44, 32, 49, 46, 48, 41, 59, 10, 9,111,117,116, 99,111,108, 32, 61, 32,109,105,120, 40, 99,111,108, 49, 44, 32, + 99,111,108, 49, 32, 42, 32, 99,111,108, 50, 44, 32,102, 97, 99, 41, 59, 10, 9,111,117,116, 99,111,108, 46, 97, 32, 61, 32, 99, +111,108, 49, 46, 97, 59, 10,125, 10, 10,118,111,105,100, 32,109,105,120, 95,115, 99,114,101,101,110, 40,102,108,111, 97,116, 32, +102, 97, 99, 44, 32,118,101, 99, 52, 32, 99,111,108, 49, 44, 32,118,101, 99, 52, 32, 99,111,108, 50, 44, 32,111,117,116, 32,118, +101, 99, 52, 32,111,117,116, 99,111,108, 41, 10,123, 10, 9,102, 97, 99, 32, 61, 32, 99,108, 97,109,112, 40,102, 97, 99, 44, 32, + 48, 46, 48, 44, 32, 49, 46, 48, 41, 59, 10, 9,102,108,111, 97,116, 32,102, 97, 99,109, 32, 61, 32, 49, 46, 48, 32, 45, 32,102, + 97, 99, 59, 10, 10, 9,111,117,116, 99,111,108, 32, 61, 32,118,101, 99, 52, 40, 49, 46, 48, 41, 32, 45, 32, 40,118,101, 99, 52, + 40,102, 97, 99,109, 41, 32, 43, 32,102, 97, 99, 42, 40,118,101, 99, 52, 40, 49, 46, 48, 41, 32, 45, 32, 99,111,108, 50, 41, 41, + 42, 40,118,101, 99, 52, 40, 49, 46, 48, 41, 32, 45, 32, 99,111,108, 49, 41, 59, 10, 9,111,117,116, 99,111,108, 46, 97, 32, 61, + 32, 99,111,108, 49, 46, 97, 59, 10,125, 10, 10,118,111,105,100, 32,109,105,120, 95,111,118,101,114,108, 97,121, 40,102,108,111, + 97,116, 32,102, 97, 99, 44, 32,118,101, 99, 52, 32, 99,111,108, 49, 44, 32,118,101, 99, 52, 32, 99,111,108, 50, 44, 32,111,117, +116, 32,118,101, 99, 52, 32,111,117,116, 99,111,108, 41, 10,123, 10, 9,102, 97, 99, 32, 61, 32, 99,108, 97,109,112, 40,102, 97, + 99, 44, 32, 48, 46, 48, 44, 32, 49, 46, 48, 41, 59, 10, 9,102,108,111, 97,116, 32,102, 97, 99,109, 32, 61, 32, 49, 46, 48, 32, + 45, 32,102, 97, 99, 59, 10, 10, 9,111,117,116, 99,111,108, 32, 61, 32, 99,111,108, 49, 59, 10, 10, 9,105,102, 40,111,117,116, + 99,111,108, 46,114, 32, 60, 32, 48, 46, 53, 41, 10, 9, 9,111,117,116, 99,111,108, 46,114, 32, 42, 61, 32,102, 97, 99,109, 32, + 43, 32, 50, 46, 48, 42,102, 97, 99, 42, 99,111,108, 50, 46,114, 59, 10, 9,101,108,115,101, 10, 9, 9,111,117,116, 99,111,108, + 46,114, 32, 61, 32, 49, 46, 48, 32, 45, 32, 40,102, 97, 99,109, 32, 43, 32, 50, 46, 48, 42,102, 97, 99, 42, 40, 49, 46, 48, 32, + 45, 32, 99,111,108, 50, 46,114, 41, 41, 42, 40, 49, 46, 48, 32, 45, 32,111,117,116, 99,111,108, 46,114, 41, 59, 10, 10, 9,105, +102, 40,111,117,116, 99,111,108, 46,103, 32, 60, 32, 48, 46, 53, 41, 10, 9, 9,111,117,116, 99,111,108, 46,103, 32, 42, 61, 32, +102, 97, 99,109, 32, 43, 32, 50, 46, 48, 42,102, 97, 99, 42, 99,111,108, 50, 46,103, 59, 10, 9,101,108,115,101, 10, 9, 9,111, +117,116, 99,111,108, 46,103, 32, 61, 32, 49, 46, 48, 32, 45, 32, 40,102, 97, 99,109, 32, 43, 32, 50, 46, 48, 42,102, 97, 99, 42, + 40, 49, 46, 48, 32, 45, 32, 99,111,108, 50, 46,103, 41, 41, 42, 40, 49, 46, 48, 32, 45, 32,111,117,116, 99,111,108, 46,103, 41, + 59, 10, 10, 9,105,102, 40,111,117,116, 99,111,108, 46, 98, 32, 60, 32, 48, 46, 53, 41, 10, 9, 9,111,117,116, 99,111,108, 46, + 98, 32, 42, 61, 32,102, 97, 99,109, 32, 43, 32, 50, 46, 48, 42,102, 97, 99, 42, 99,111,108, 50, 46, 98, 59, 10, 9,101,108,115, +101, 10, 9, 9,111,117,116, 99,111,108, 46, 98, 32, 61, 32, 49, 46, 48, 32, 45, 32, 40,102, 97, 99,109, 32, 43, 32, 50, 46, 48, + 42,102, 97, 99, 42, 40, 49, 46, 48, 32, 45, 32, 99,111,108, 50, 46, 98, 41, 41, 42, 40, 49, 46, 48, 32, 45, 32,111,117,116, 99, +111,108, 46, 98, 41, 59, 10,125, 10, 10,118,111,105,100, 32,109,105,120, 95,115,117, 98, 40,102,108,111, 97,116, 32,102, 97, 99, + 44, 32,118,101, 99, 52, 32, 99,111,108, 49, 44, 32,118,101, 99, 52, 32, 99,111,108, 50, 44, 32,111,117,116, 32,118,101, 99, 52, + 32,111,117,116, 99,111,108, 41, 10,123, 10, 9,102, 97, 99, 32, 61, 32, 99,108, 97,109,112, 40,102, 97, 99, 44, 32, 48, 46, 48, + 44, 32, 49, 46, 48, 41, 59, 10, 9,111,117,116, 99,111,108, 32, 61, 32,109,105,120, 40, 99,111,108, 49, 44, 32, 99,111,108, 49, + 32, 45, 32, 99,111,108, 50, 44, 32,102, 97, 99, 41, 59, 10, 9,111,117,116, 99,111,108, 46, 97, 32, 61, 32, 99,111,108, 49, 46, + 97, 59, 10,125, 10, 10,118,111,105,100, 32,109,105,120, 95,100,105,118, 40,102,108,111, 97,116, 32,102, 97, 99, 44, 32,118,101, + 99, 52, 32, 99,111,108, 49, 44, 32,118,101, 99, 52, 32, 99,111,108, 50, 44, 32,111,117,116, 32,118,101, 99, 52, 32,111,117,116, + 99,111,108, 41, 10,123, 10, 9,102, 97, 99, 32, 61, 32, 99,108, 97,109,112, 40,102, 97, 99, 44, 32, 48, 46, 48, 44, 32, 49, 46, + 48, 41, 59, 10, 9,102,108,111, 97,116, 32,102, 97, 99,109, 32, 61, 32, 49, 46, 48, 32, 45, 32,102, 97, 99, 59, 10, 10, 9,111, +117,116, 99,111,108, 32, 61, 32, 99,111,108, 49, 59, 10, 10, 9,105,102, 40, 99,111,108, 50, 46,114, 32, 33, 61, 32, 48, 46, 48, + 41, 32,111,117,116, 99,111,108, 46,114, 32, 61, 32,102, 97, 99,109, 42,111,117,116, 99,111,108, 46,114, 32, 43, 32,102, 97, 99, + 42,111,117,116, 99,111,108, 46,114, 47, 99,111,108, 50, 46,114, 59, 10, 9,105,102, 40, 99,111,108, 50, 46,103, 32, 33, 61, 32, + 48, 46, 48, 41, 32,111,117,116, 99,111,108, 46,103, 32, 61, 32,102, 97, 99,109, 42,111,117,116, 99,111,108, 46,103, 32, 43, 32, +102, 97, 99, 42,111,117,116, 99,111,108, 46,103, 47, 99,111,108, 50, 46,103, 59, 10, 9,105,102, 40, 99,111,108, 50, 46, 98, 32, + 33, 61, 32, 48, 46, 48, 41, 32,111,117,116, 99,111,108, 46, 98, 32, 61, 32,102, 97, 99,109, 42,111,117,116, 99,111,108, 46, 98, + 32, 43, 32,102, 97, 99, 42,111,117,116, 99,111,108, 46, 98, 47, 99,111,108, 50, 46, 98, 59, 10,125, 10, 10,118,111,105,100, 32, +109,105,120, 95,100,105,102,102, 40,102,108,111, 97,116, 32,102, 97, 99, 44, 32,118,101, 99, 52, 32, 99,111,108, 49, 44, 32,118, +101, 99, 52, 32, 99,111,108, 50, 44, 32,111,117,116, 32,118,101, 99, 52, 32,111,117,116, 99,111,108, 41, 10,123, 10, 9,102, 97, + 99, 32, 61, 32, 99,108, 97,109,112, 40,102, 97, 99, 44, 32, 48, 46, 48, 44, 32, 49, 46, 48, 41, 59, 10, 9,111,117,116, 99,111, +108, 32, 61, 32,109,105,120, 40, 99,111,108, 49, 44, 32, 97, 98,115, 40, 99,111,108, 49, 32, 45, 32, 99,111,108, 50, 41, 44, 32, +102, 97, 99, 41, 59, 10, 9,111,117,116, 99,111,108, 46, 97, 32, 61, 32, 99,111,108, 49, 46, 97, 59, 10,125, 10, 10,118,111,105, +100, 32,109,105,120, 95,100, 97,114,107, 40,102,108,111, 97,116, 32,102, 97, 99, 44, 32,118,101, 99, 52, 32, 99,111,108, 49, 44, + 32,118,101, 99, 52, 32, 99,111,108, 50, 44, 32,111,117,116, 32,118,101, 99, 52, 32,111,117,116, 99,111,108, 41, 10,123, 10, 9, +102, 97, 99, 32, 61, 32, 99,108, 97,109,112, 40,102, 97, 99, 44, 32, 48, 46, 48, 44, 32, 49, 46, 48, 41, 59, 10, 9,111,117,116, + 99,111,108, 46,114,103, 98, 32, 61, 32,109,105,110, 40, 99,111,108, 49, 46,114,103, 98, 44, 32, 99,111,108, 50, 46,114,103, 98, + 42,102, 97, 99, 41, 59, 10, 9,111,117,116, 99,111,108, 46, 97, 32, 61, 32, 99,111,108, 49, 46, 97, 59, 10,125, 10, 10,118,111, +105,100, 32,109,105,120, 95,108,105,103,104,116, 40,102,108,111, 97,116, 32,102, 97, 99, 44, 32,118,101, 99, 52, 32, 99,111,108, + 49, 44, 32,118,101, 99, 52, 32, 99,111,108, 50, 44, 32,111,117,116, 32,118,101, 99, 52, 32,111,117,116, 99,111,108, 41, 10,123, + 10, 9,102, 97, 99, 32, 61, 32, 99,108, 97,109,112, 40,102, 97, 99, 44, 32, 48, 46, 48, 44, 32, 49, 46, 48, 41, 59, 10, 9,111, +117,116, 99,111,108, 46,114,103, 98, 32, 61, 32,109, 97,120, 40, 99,111,108, 49, 46,114,103, 98, 44, 32, 99,111,108, 50, 46,114, +103, 98, 42,102, 97, 99, 41, 59, 10, 9,111,117,116, 99,111,108, 46, 97, 32, 61, 32, 99,111,108, 49, 46, 97, 59, 10,125, 10, 10, +118,111,105,100, 32,109,105,120, 95,100,111,100,103,101, 40,102,108,111, 97,116, 32,102, 97, 99, 44, 32,118,101, 99, 52, 32, 99, +111,108, 49, 44, 32,118,101, 99, 52, 32, 99,111,108, 50, 44, 32,111,117,116, 32,118,101, 99, 52, 32,111,117,116, 99,111,108, 41, + 10,123, 10, 9,102, 97, 99, 32, 61, 32, 99,108, 97,109,112, 40,102, 97, 99, 44, 32, 48, 46, 48, 44, 32, 49, 46, 48, 41, 59, 10, + 9,111,117,116, 99,111,108, 32, 61, 32, 99,111,108, 49, 59, 10, 10, 9,105,102, 40,111,117,116, 99,111,108, 46,114, 32, 33, 61, + 32, 48, 46, 48, 41, 32,123, 10, 9, 9,102,108,111, 97,116, 32,116,109,112, 32, 61, 32, 49, 46, 48, 32, 45, 32,102, 97, 99, 42, + 99,111,108, 50, 46,114, 59, 10, 9, 9,105,102, 40,116,109,112, 32, 60, 61, 32, 48, 46, 48, 41, 10, 9, 9, 9,111,117,116, 99, +111,108, 46,114, 32, 61, 32, 49, 46, 48, 59, 10, 9, 9,101,108,115,101, 32,105,102, 40, 40,116,109,112, 32, 61, 32,111,117,116, + 99,111,108, 46,114, 47,116,109,112, 41, 32, 62, 32, 49, 46, 48, 41, 10, 9, 9, 9,111,117,116, 99,111,108, 46,114, 32, 61, 32, + 49, 46, 48, 59, 10, 9, 9,101,108,115,101, 10, 9, 9, 9,111,117,116, 99,111,108, 46,114, 32, 61, 32,116,109,112, 59, 10, 9, +125, 10, 9,105,102, 40,111,117,116, 99,111,108, 46,103, 32, 33, 61, 32, 48, 46, 48, 41, 32,123, 10, 9, 9,102,108,111, 97,116, + 32,116,109,112, 32, 61, 32, 49, 46, 48, 32, 45, 32,102, 97, 99, 42, 99,111,108, 50, 46,103, 59, 10, 9, 9,105,102, 40,116,109, +112, 32, 60, 61, 32, 48, 46, 48, 41, 10, 9, 9, 9,111,117,116, 99,111,108, 46,103, 32, 61, 32, 49, 46, 48, 59, 10, 9, 9,101, +108,115,101, 32,105,102, 40, 40,116,109,112, 32, 61, 32,111,117,116, 99,111,108, 46,103, 47,116,109,112, 41, 32, 62, 32, 49, 46, + 48, 41, 10, 9, 9, 9,111,117,116, 99,111,108, 46,103, 32, 61, 32, 49, 46, 48, 59, 10, 9, 9,101,108,115,101, 10, 9, 9, 9, +111,117,116, 99,111,108, 46,103, 32, 61, 32,116,109,112, 59, 10, 9,125, 10, 9,105,102, 40,111,117,116, 99,111,108, 46, 98, 32, + 33, 61, 32, 48, 46, 48, 41, 32,123, 10, 9, 9,102,108,111, 97,116, 32,116,109,112, 32, 61, 32, 49, 46, 48, 32, 45, 32,102, 97, + 99, 42, 99,111,108, 50, 46, 98, 59, 10, 9, 9,105,102, 40,116,109,112, 32, 60, 61, 32, 48, 46, 48, 41, 10, 9, 9, 9,111,117, +116, 99,111,108, 46, 98, 32, 61, 32, 49, 46, 48, 59, 10, 9, 9,101,108,115,101, 32,105,102, 40, 40,116,109,112, 32, 61, 32,111, +117,116, 99,111,108, 46, 98, 47,116,109,112, 41, 32, 62, 32, 49, 46, 48, 41, 10, 9, 9, 9,111,117,116, 99,111,108, 46, 98, 32, + 61, 32, 49, 46, 48, 59, 10, 9, 9,101,108,115,101, 10, 9, 9, 9,111,117,116, 99,111,108, 46, 98, 32, 61, 32,116,109,112, 59, + 10, 9,125, 10,125, 10, 10,118,111,105,100, 32,109,105,120, 95, 98,117,114,110, 40,102,108,111, 97,116, 32,102, 97, 99, 44, 32, 118,101, 99, 52, 32, 99,111,108, 49, 44, 32,118,101, 99, 52, 32, 99,111,108, 50, 44, 32,111,117,116, 32,118,101, 99, 52, 32,111, 117,116, 99,111,108, 41, 10,123, 10, 9,102, 97, 99, 32, 61, 32, 99,108, 97,109,112, 40,102, 97, 99, 44, 32, 48, 46, 48, 44, 32, - 49, 46, 48, 41, 59, 10, 9,102,108,111, 97,116, 32,102, 97, 99,109, 32, 61, 32, 49, 46, 48, 32, 45, 32,102, 97, 99, 59, 10, 10, - 9,111,117,116, 99,111,108, 32, 61, 32,118,101, 99, 52, 40, 49, 46, 48, 41, 32, 45, 32, 40,118,101, 99, 52, 40,102, 97, 99,109, - 41, 32, 43, 32,102, 97, 99, 42, 40,118,101, 99, 52, 40, 49, 46, 48, 41, 32, 45, 32, 99,111,108, 50, 41, 41, 42, 40,118,101, 99, - 52, 40, 49, 46, 48, 41, 32, 45, 32, 99,111,108, 49, 41, 59, 10, 9,111,117,116, 99,111,108, 46, 97, 32, 61, 32, 99,111,108, 49, - 46, 97, 59, 10,125, 10, 10,118,111,105,100, 32,109,105,120, 95,111,118,101,114,108, 97,121, 40,102,108,111, 97,116, 32,102, 97, - 99, 44, 32,118,101, 99, 52, 32, 99,111,108, 49, 44, 32,118,101, 99, 52, 32, 99,111,108, 50, 44, 32,111,117,116, 32,118,101, 99, - 52, 32,111,117,116, 99,111,108, 41, 10,123, 10, 9,102, 97, 99, 32, 61, 32, 99,108, 97,109,112, 40,102, 97, 99, 44, 32, 48, 46, - 48, 44, 32, 49, 46, 48, 41, 59, 10, 9,102,108,111, 97,116, 32,102, 97, 99,109, 32, 61, 32, 49, 46, 48, 32, 45, 32,102, 97, 99, - 59, 10, 10, 9,111,117,116, 99,111,108, 32, 61, 32, 99,111,108, 49, 59, 10, 10, 9,105,102, 40,111,117,116, 99,111,108, 46,114, - 32, 60, 32, 48, 46, 53, 41, 10, 9, 9,111,117,116, 99,111,108, 46,114, 32, 42, 61, 32,102, 97, 99,109, 32, 43, 32, 50, 46, 48, - 42,102, 97, 99, 42, 99,111,108, 50, 46,114, 59, 10, 9,101,108,115,101, 10, 9, 9,111,117,116, 99,111,108, 46,114, 32, 61, 32, - 49, 46, 48, 32, 45, 32, 40,102, 97, 99,109, 32, 43, 32, 50, 46, 48, 42,102, 97, 99, 42, 40, 49, 46, 48, 32, 45, 32, 99,111,108, - 50, 46,114, 41, 41, 42, 40, 49, 46, 48, 32, 45, 32,111,117,116, 99,111,108, 46,114, 41, 59, 10, 10, 9,105,102, 40,111,117,116, - 99,111,108, 46,103, 32, 60, 32, 48, 46, 53, 41, 10, 9, 9,111,117,116, 99,111,108, 46,103, 32, 42, 61, 32,102, 97, 99,109, 32, - 43, 32, 50, 46, 48, 42,102, 97, 99, 42, 99,111,108, 50, 46,103, 59, 10, 9,101,108,115,101, 10, 9, 9,111,117,116, 99,111,108, - 46,103, 32, 61, 32, 49, 46, 48, 32, 45, 32, 40,102, 97, 99,109, 32, 43, 32, 50, 46, 48, 42,102, 97, 99, 42, 40, 49, 46, 48, 32, - 45, 32, 99,111,108, 50, 46,103, 41, 41, 42, 40, 49, 46, 48, 32, 45, 32,111,117,116, 99,111,108, 46,103, 41, 59, 10, 10, 9,105, -102, 40,111,117,116, 99,111,108, 46, 98, 32, 60, 32, 48, 46, 53, 41, 10, 9, 9,111,117,116, 99,111,108, 46, 98, 32, 42, 61, 32, -102, 97, 99,109, 32, 43, 32, 50, 46, 48, 42,102, 97, 99, 42, 99,111,108, 50, 46, 98, 59, 10, 9,101,108,115,101, 10, 9, 9,111, -117,116, 99,111,108, 46, 98, 32, 61, 32, 49, 46, 48, 32, 45, 32, 40,102, 97, 99,109, 32, 43, 32, 50, 46, 48, 42,102, 97, 99, 42, - 40, 49, 46, 48, 32, 45, 32, 99,111,108, 50, 46, 98, 41, 41, 42, 40, 49, 46, 48, 32, 45, 32,111,117,116, 99,111,108, 46, 98, 41, - 59, 10,125, 10, 10,118,111,105,100, 32,109,105,120, 95,115,117, 98, 40,102,108,111, 97,116, 32,102, 97, 99, 44, 32,118,101, 99, - 52, 32, 99,111,108, 49, 44, 32,118,101, 99, 52, 32, 99,111,108, 50, 44, 32,111,117,116, 32,118,101, 99, 52, 32,111,117,116, 99, -111,108, 41, 10,123, 10, 9,102, 97, 99, 32, 61, 32, 99,108, 97,109,112, 40,102, 97, 99, 44, 32, 48, 46, 48, 44, 32, 49, 46, 48, - 41, 59, 10, 9,111,117,116, 99,111,108, 32, 61, 32,109,105,120, 40, 99,111,108, 49, 44, 32, 99,111,108, 49, 32, 45, 32, 99,111, -108, 50, 44, 32,102, 97, 99, 41, 59, 10, 9,111,117,116, 99,111,108, 46, 97, 32, 61, 32, 99,111,108, 49, 46, 97, 59, 10,125, 10, - 10,118,111,105,100, 32,109,105,120, 95,100,105,118, 40,102,108,111, 97,116, 32,102, 97, 99, 44, 32,118,101, 99, 52, 32, 99,111, -108, 49, 44, 32,118,101, 99, 52, 32, 99,111,108, 50, 44, 32,111,117,116, 32,118,101, 99, 52, 32,111,117,116, 99,111,108, 41, 10, -123, 10, 9,102, 97, 99, 32, 61, 32, 99,108, 97,109,112, 40,102, 97, 99, 44, 32, 48, 46, 48, 44, 32, 49, 46, 48, 41, 59, 10, 9, -102,108,111, 97,116, 32,102, 97, 99,109, 32, 61, 32, 49, 46, 48, 32, 45, 32,102, 97, 99, 59, 10, 10, 9,111,117,116, 99,111,108, - 32, 61, 32, 99,111,108, 49, 59, 10, 10, 9,105,102, 40, 99,111,108, 50, 46,114, 32, 33, 61, 32, 48, 46, 48, 41, 32,111,117,116, - 99,111,108, 46,114, 32, 61, 32,102, 97, 99,109, 42,111,117,116, 99,111,108, 46,114, 32, 43, 32,102, 97, 99, 42,111,117,116, 99, -111,108, 46,114, 47, 99,111,108, 50, 46,114, 59, 10, 9,105,102, 40, 99,111,108, 50, 46,103, 32, 33, 61, 32, 48, 46, 48, 41, 32, -111,117,116, 99,111,108, 46,103, 32, 61, 32,102, 97, 99,109, 42,111,117,116, 99,111,108, 46,103, 32, 43, 32,102, 97, 99, 42,111, -117,116, 99,111,108, 46,103, 47, 99,111,108, 50, 46,103, 59, 10, 9,105,102, 40, 99,111,108, 50, 46, 98, 32, 33, 61, 32, 48, 46, - 48, 41, 32,111,117,116, 99,111,108, 46, 98, 32, 61, 32,102, 97, 99,109, 42,111,117,116, 99,111,108, 46, 98, 32, 43, 32,102, 97, - 99, 42,111,117,116, 99,111,108, 46, 98, 47, 99,111,108, 50, 46, 98, 59, 10,125, 10, 10,118,111,105,100, 32,109,105,120, 95,100, -105,102,102, 40,102,108,111, 97,116, 32,102, 97, 99, 44, 32,118,101, 99, 52, 32, 99,111,108, 49, 44, 32,118,101, 99, 52, 32, 99, -111,108, 50, 44, 32,111,117,116, 32,118,101, 99, 52, 32,111,117,116, 99,111,108, 41, 10,123, 10, 9,102, 97, 99, 32, 61, 32, 99, -108, 97,109,112, 40,102, 97, 99, 44, 32, 48, 46, 48, 44, 32, 49, 46, 48, 41, 59, 10, 9,111,117,116, 99,111,108, 32, 61, 32,109, -105,120, 40, 99,111,108, 49, 44, 32, 97, 98,115, 40, 99,111,108, 49, 32, 45, 32, 99,111,108, 50, 41, 44, 32,102, 97, 99, 41, 59, - 10, 9,111,117,116, 99,111,108, 46, 97, 32, 61, 32, 99,111,108, 49, 46, 97, 59, 10,125, 10, 10,118,111,105,100, 32,109,105,120, - 95,100, 97,114,107, 40,102,108,111, 97,116, 32,102, 97, 99, 44, 32,118,101, 99, 52, 32, 99,111,108, 49, 44, 32,118,101, 99, 52, - 32, 99,111,108, 50, 44, 32,111,117,116, 32,118,101, 99, 52, 32,111,117,116, 99,111,108, 41, 10,123, 10, 9,102, 97, 99, 32, 61, - 32, 99,108, 97,109,112, 40,102, 97, 99, 44, 32, 48, 46, 48, 44, 32, 49, 46, 48, 41, 59, 10, 9,111,117,116, 99,111,108, 46,114, -103, 98, 32, 61, 32,109,105,110, 40, 99,111,108, 49, 46,114,103, 98, 44, 32, 99,111,108, 50, 46,114,103, 98, 42,102, 97, 99, 41, - 59, 10, 9,111,117,116, 99,111,108, 46, 97, 32, 61, 32, 99,111,108, 49, 46, 97, 59, 10,125, 10, 10,118,111,105,100, 32,109,105, -120, 95,108,105,103,104,116, 40,102,108,111, 97,116, 32,102, 97, 99, 44, 32,118,101, 99, 52, 32, 99,111,108, 49, 44, 32,118,101, - 99, 52, 32, 99,111,108, 50, 44, 32,111,117,116, 32,118,101, 99, 52, 32,111,117,116, 99,111,108, 41, 10,123, 10, 9,102, 97, 99, - 32, 61, 32, 99,108, 97,109,112, 40,102, 97, 99, 44, 32, 48, 46, 48, 44, 32, 49, 46, 48, 41, 59, 10, 9,111,117,116, 99,111,108, - 46,114,103, 98, 32, 61, 32,109, 97,120, 40, 99,111,108, 49, 46,114,103, 98, 44, 32, 99,111,108, 50, 46,114,103, 98, 42,102, 97, - 99, 41, 59, 10, 9,111,117,116, 99,111,108, 46, 97, 32, 61, 32, 99,111,108, 49, 46, 97, 59, 10,125, 10, 10,118,111,105,100, 32, -109,105,120, 95,100,111,100,103,101, 40,102,108,111, 97,116, 32,102, 97, 99, 44, 32,118,101, 99, 52, 32, 99,111,108, 49, 44, 32, -118,101, 99, 52, 32, 99,111,108, 50, 44, 32,111,117,116, 32,118,101, 99, 52, 32,111,117,116, 99,111,108, 41, 10,123, 10, 9,102, - 97, 99, 32, 61, 32, 99,108, 97,109,112, 40,102, 97, 99, 44, 32, 48, 46, 48, 44, 32, 49, 46, 48, 41, 59, 10, 9,111,117,116, 99, -111,108, 32, 61, 32, 99,111,108, 49, 59, 10, 10, 9,105,102, 40,111,117,116, 99,111,108, 46,114, 32, 33, 61, 32, 48, 46, 48, 41, - 32,123, 10, 9, 9,102,108,111, 97,116, 32,116,109,112, 32, 61, 32, 49, 46, 48, 32, 45, 32,102, 97, 99, 42, 99,111,108, 50, 46, -114, 59, 10, 9, 9,105,102, 40,116,109,112, 32, 60, 61, 32, 48, 46, 48, 41, 10, 9, 9, 9,111,117,116, 99,111,108, 46,114, 32, - 61, 32, 49, 46, 48, 59, 10, 9, 9,101,108,115,101, 32,105,102, 40, 40,116,109,112, 32, 61, 32,111,117,116, 99,111,108, 46,114, - 47,116,109,112, 41, 32, 62, 32, 49, 46, 48, 41, 10, 9, 9, 9,111,117,116, 99,111,108, 46,114, 32, 61, 32, 49, 46, 48, 59, 10, - 9, 9,101,108,115,101, 10, 9, 9, 9,111,117,116, 99,111,108, 46,114, 32, 61, 32,116,109,112, 59, 10, 9,125, 10, 9,105,102, - 40,111,117,116, 99,111,108, 46,103, 32, 33, 61, 32, 48, 46, 48, 41, 32,123, 10, 9, 9,102,108,111, 97,116, 32,116,109,112, 32, - 61, 32, 49, 46, 48, 32, 45, 32,102, 97, 99, 42, 99,111,108, 50, 46,103, 59, 10, 9, 9,105,102, 40,116,109,112, 32, 60, 61, 32, - 48, 46, 48, 41, 10, 9, 9, 9,111,117,116, 99,111,108, 46,103, 32, 61, 32, 49, 46, 48, 59, 10, 9, 9,101,108,115,101, 32,105, -102, 40, 40,116,109,112, 32, 61, 32,111,117,116, 99,111,108, 46,103, 47,116,109,112, 41, 32, 62, 32, 49, 46, 48, 41, 10, 9, 9, - 9,111,117,116, 99,111,108, 46,103, 32, 61, 32, 49, 46, 48, 59, 10, 9, 9,101,108,115,101, 10, 9, 9, 9,111,117,116, 99,111, -108, 46,103, 32, 61, 32,116,109,112, 59, 10, 9,125, 10, 9,105,102, 40,111,117,116, 99,111,108, 46, 98, 32, 33, 61, 32, 48, 46, - 48, 41, 32,123, 10, 9, 9,102,108,111, 97,116, 32,116,109,112, 32, 61, 32, 49, 46, 48, 32, 45, 32,102, 97, 99, 42, 99,111,108, - 50, 46, 98, 59, 10, 9, 9,105,102, 40,116,109,112, 32, 60, 61, 32, 48, 46, 48, 41, 10, 9, 9, 9,111,117,116, 99,111,108, 46, - 98, 32, 61, 32, 49, 46, 48, 59, 10, 9, 9,101,108,115,101, 32,105,102, 40, 40,116,109,112, 32, 61, 32,111,117,116, 99,111,108, - 46, 98, 47,116,109,112, 41, 32, 62, 32, 49, 46, 48, 41, 10, 9, 9, 9,111,117,116, 99,111,108, 46, 98, 32, 61, 32, 49, 46, 48, - 59, 10, 9, 9,101,108,115,101, 10, 9, 9, 9,111,117,116, 99,111,108, 46, 98, 32, 61, 32,116,109,112, 59, 10, 9,125, 10,125, - 10, 10,118,111,105,100, 32,109,105,120, 95, 98,117,114,110, 40,102,108,111, 97,116, 32,102, 97, 99, 44, 32,118,101, 99, 52, 32, - 99,111,108, 49, 44, 32,118,101, 99, 52, 32, 99,111,108, 50, 44, 32,111,117,116, 32,118,101, 99, 52, 32,111,117,116, 99,111,108, - 41, 10,123, 10, 9,102, 97, 99, 32, 61, 32, 99,108, 97,109,112, 40,102, 97, 99, 44, 32, 48, 46, 48, 44, 32, 49, 46, 48, 41, 59, - 10, 9,102,108,111, 97,116, 32,116,109,112, 44, 32,102, 97, 99,109, 32, 61, 32, 49, 46, 48, 32, 45, 32,102, 97, 99, 59, 10, 10, - 9,111,117,116, 99,111,108, 32, 61, 32, 99,111,108, 49, 59, 10, 10, 9,116,109,112, 32, 61, 32,102, 97, 99,109, 32, 43, 32,102, - 97, 99, 42, 99,111,108, 50, 46,114, 59, 10, 9,105,102, 40,116,109,112, 32, 60, 61, 32, 48, 46, 48, 41, 10, 9, 9,111,117,116, - 99,111,108, 46,114, 32, 61, 32, 48, 46, 48, 59, 10, 9,101,108,115,101, 32,105,102, 40, 40,116,109,112, 32, 61, 32, 40, 49, 46, - 48, 32, 45, 32, 40, 49, 46, 48, 32, 45, 32,111,117,116, 99,111,108, 46,114, 41, 47,116,109,112, 41, 41, 32, 60, 32, 48, 46, 48, - 41, 10, 9, 9,111,117,116, 99,111,108, 46,114, 32, 61, 32, 48, 46, 48, 59, 10, 9,101,108,115,101, 32,105,102, 40,116,109,112, - 32, 62, 32, 49, 46, 48, 41, 10, 9, 9,111,117,116, 99,111,108, 46,114, 32, 61, 32, 49, 46, 48, 59, 10, 9,101,108,115,101, 10, - 9, 9,111,117,116, 99,111,108, 46,114, 32, 61, 32,116,109,112, 59, 10, 10, 9,116,109,112, 32, 61, 32,102, 97, 99,109, 32, 43, - 32,102, 97, 99, 42, 99,111,108, 50, 46,103, 59, 10, 9,105,102, 40,116,109,112, 32, 60, 61, 32, 48, 46, 48, 41, 10, 9, 9,111, -117,116, 99,111,108, 46,103, 32, 61, 32, 48, 46, 48, 59, 10, 9,101,108,115,101, 32,105,102, 40, 40,116,109,112, 32, 61, 32, 40, - 49, 46, 48, 32, 45, 32, 40, 49, 46, 48, 32, 45, 32,111,117,116, 99,111,108, 46,103, 41, 47,116,109,112, 41, 41, 32, 60, 32, 48, - 46, 48, 41, 10, 9, 9,111,117,116, 99,111,108, 46,103, 32, 61, 32, 48, 46, 48, 59, 10, 9,101,108,115,101, 32,105,102, 40,116, -109,112, 32, 62, 32, 49, 46, 48, 41, 10, 9, 9,111,117,116, 99,111,108, 46,103, 32, 61, 32, 49, 46, 48, 59, 10, 9,101,108,115, -101, 10, 9, 9,111,117,116, 99,111,108, 46,103, 32, 61, 32,116,109,112, 59, 10, 10, 9,116,109,112, 32, 61, 32,102, 97, 99,109, - 32, 43, 32,102, 97, 99, 42, 99,111,108, 50, 46, 98, 59, 10, 9,105,102, 40,116,109,112, 32, 60, 61, 32, 48, 46, 48, 41, 10, 9, - 9,111,117,116, 99,111,108, 46, 98, 32, 61, 32, 48, 46, 48, 59, 10, 9,101,108,115,101, 32,105,102, 40, 40,116,109,112, 32, 61, - 32, 40, 49, 46, 48, 32, 45, 32, 40, 49, 46, 48, 32, 45, 32,111,117,116, 99,111,108, 46, 98, 41, 47,116,109,112, 41, 41, 32, 60, - 32, 48, 46, 48, 41, 10, 9, 9,111,117,116, 99,111,108, 46, 98, 32, 61, 32, 48, 46, 48, 59, 10, 9,101,108,115,101, 32,105,102, - 40,116,109,112, 32, 62, 32, 49, 46, 48, 41, 10, 9, 9,111,117,116, 99,111,108, 46, 98, 32, 61, 32, 49, 46, 48, 59, 10, 9,101, -108,115,101, 10, 9, 9,111,117,116, 99,111,108, 46, 98, 32, 61, 32,116,109,112, 59, 10,125, 10, 10,118,111,105,100, 32,109,105, -120, 95,104,117,101, 40,102,108,111, 97,116, 32,102, 97, 99, 44, 32,118,101, 99, 52, 32, 99,111,108, 49, 44, 32,118,101, 99, 52, - 32, 99,111,108, 50, 44, 32,111,117,116, 32,118,101, 99, 52, 32,111,117,116, 99,111,108, 41, 10,123, 10, 9,102, 97, 99, 32, 61, - 32, 99,108, 97,109,112, 40,102, 97, 99, 44, 32, 48, 46, 48, 44, 32, 49, 46, 48, 41, 59, 10, 9,102,108,111, 97,116, 32,102, 97, - 99,109, 32, 61, 32, 49, 46, 48, 32, 45, 32,102, 97, 99, 59, 10, 10, 9,111,117,116, 99,111,108, 32, 61, 32, 99,111,108, 49, 59, - 10, 10, 9,118,101, 99, 52, 32,104,115,118, 44, 32,104,115,118, 50, 44, 32,116,109,112, 59, 10, 9,114,103, 98, 95,116,111, 95, -104,115,118, 40, 99,111,108, 50, 44, 32,104,115,118, 50, 41, 59, 10, 10, 9,105,102, 40,104,115,118, 50, 46,121, 32, 33, 61, 32, - 48, 46, 48, 41, 32,123, 10, 9, 9,114,103, 98, 95,116,111, 95,104,115,118, 40,111,117,116, 99,111,108, 44, 32,104,115,118, 41, - 59, 10, 9, 9,104,115,118, 46,120, 32, 61, 32,104,115,118, 50, 46,120, 59, 10, 9, 9,104,115,118, 95,116,111, 95,114,103, 98, - 40,104,115,118, 44, 32,116,109,112, 41, 59, 32, 10, 10, 9, 9,111,117,116, 99,111,108, 32, 61, 32,109,105,120, 40,111,117,116, - 99,111,108, 44, 32,116,109,112, 44, 32,102, 97, 99, 41, 59, 10, 9, 9,111,117,116, 99,111,108, 46, 97, 32, 61, 32, 99,111,108, - 49, 46, 97, 59, 10, 9,125, 10,125, 10, 10,118,111,105,100, 32,109,105,120, 95,115, 97,116, 40,102,108,111, 97,116, 32,102, 97, - 99, 44, 32,118,101, 99, 52, 32, 99,111,108, 49, 44, 32,118,101, 99, 52, 32, 99,111,108, 50, 44, 32,111,117,116, 32,118,101, 99, - 52, 32,111,117,116, 99,111,108, 41, 10,123, 10, 9,102, 97, 99, 32, 61, 32, 99,108, 97,109,112, 40,102, 97, 99, 44, 32, 48, 46, - 48, 44, 32, 49, 46, 48, 41, 59, 10, 9,102,108,111, 97,116, 32,102, 97, 99,109, 32, 61, 32, 49, 46, 48, 32, 45, 32,102, 97, 99, - 59, 10, 10, 9,111,117,116, 99,111,108, 32, 61, 32, 99,111,108, 49, 59, 10, 10, 9,118,101, 99, 52, 32,104,115,118, 44, 32,104, -115,118, 50, 59, 10, 9,114,103, 98, 95,116,111, 95,104,115,118, 40,111,117,116, 99,111,108, 44, 32,104,115,118, 41, 59, 10, 10, - 9,105,102, 40,104,115,118, 46,121, 32, 33, 61, 32, 48, 46, 48, 41, 32,123, 10, 9, 9,114,103, 98, 95,116,111, 95,104,115,118, - 40, 99,111,108, 50, 44, 32,104,115,118, 50, 41, 59, 10, 10, 9, 9,104,115,118, 46,121, 32, 61, 32,102, 97, 99,109, 42,104,115, -118, 46,121, 32, 43, 32,102, 97, 99, 42,104,115,118, 50, 46,121, 59, 10, 9, 9,104,115,118, 95,116,111, 95,114,103, 98, 40,104, -115,118, 44, 32,111,117,116, 99,111,108, 41, 59, 10, 9,125, 10,125, 10, 10,118,111,105,100, 32,109,105,120, 95,118, 97,108, 40, -102,108,111, 97,116, 32,102, 97, 99, 44, 32,118,101, 99, 52, 32, 99,111,108, 49, 44, 32,118,101, 99, 52, 32, 99,111,108, 50, 44, - 32,111,117,116, 32,118,101, 99, 52, 32,111,117,116, 99,111,108, 41, 10,123, 10, 9,102, 97, 99, 32, 61, 32, 99,108, 97,109,112, - 40,102, 97, 99, 44, 32, 48, 46, 48, 44, 32, 49, 46, 48, 41, 59, 10, 9,102,108,111, 97,116, 32,102, 97, 99,109, 32, 61, 32, 49, - 46, 48, 32, 45, 32,102, 97, 99, 59, 10, 10, 9,118,101, 99, 52, 32,104,115,118, 44, 32,104,115,118, 50, 59, 10, 9,114,103, 98, - 95,116,111, 95,104,115,118, 40, 99,111,108, 49, 44, 32,104,115,118, 41, 59, 10, 9,114,103, 98, 95,116,111, 95,104,115,118, 40, - 99,111,108, 50, 44, 32,104,115,118, 50, 41, 59, 10, 10, 9,104,115,118, 46,122, 32, 61, 32,102, 97, 99,109, 42,104,115,118, 46, -122, 32, 43, 32,102, 97, 99, 42,104,115,118, 50, 46,122, 59, 10, 9,104,115,118, 95,116,111, 95,114,103, 98, 40,104,115,118, 44, - 32,111,117,116, 99,111,108, 41, 59, 10,125, 10, 10,118,111,105,100, 32,109,105,120, 95, 99,111,108,111,114, 40,102,108,111, 97, -116, 32,102, 97, 99, 44, 32,118,101, 99, 52, 32, 99,111,108, 49, 44, 32,118,101, 99, 52, 32, 99,111,108, 50, 44, 32,111,117,116, - 32,118,101, 99, 52, 32,111,117,116, 99,111,108, 41, 10,123, 10, 9,102, 97, 99, 32, 61, 32, 99,108, 97,109,112, 40,102, 97, 99, - 44, 32, 48, 46, 48, 44, 32, 49, 46, 48, 41, 59, 10, 9,102,108,111, 97,116, 32,102, 97, 99,109, 32, 61, 32, 49, 46, 48, 32, 45, - 32,102, 97, 99, 59, 10, 10, 9,111,117,116, 99,111,108, 32, 61, 32, 99,111,108, 49, 59, 10, 10, 9,118,101, 99, 52, 32,104,115, -118, 44, 32,104,115,118, 50, 44, 32,116,109,112, 59, 10, 9,114,103, 98, 95,116,111, 95,104,115,118, 40, 99,111,108, 50, 44, 32, -104,115,118, 50, 41, 59, 10, 10, 9,105,102, 40,104,115,118, 50, 46,121, 32, 33, 61, 32, 48, 46, 48, 41, 32,123, 10, 9, 9,114, -103, 98, 95,116,111, 95,104,115,118, 40,111,117,116, 99,111,108, 44, 32,104,115,118, 41, 59, 10, 9, 9,104,115,118, 46,120, 32, - 61, 32,104,115,118, 50, 46,120, 59, 10, 9, 9,104,115,118, 46,121, 32, 61, 32,104,115,118, 50, 46,121, 59, 10, 9, 9,104,115, -118, 95,116,111, 95,114,103, 98, 40,104,115,118, 44, 32,116,109,112, 41, 59, 32, 10, 10, 9, 9,111,117,116, 99,111,108, 32, 61, - 32,109,105,120, 40,111,117,116, 99,111,108, 44, 32,116,109,112, 44, 32,102, 97, 99, 41, 59, 10, 9, 9,111,117,116, 99,111,108, - 46, 97, 32, 61, 32, 99,111,108, 49, 46, 97, 59, 10, 9,125, 10,125, 10, 10,118,111,105,100, 32,109,105,120, 95,115,111,102,116, + 49, 46, 48, 41, 59, 10, 9,102,108,111, 97,116, 32,116,109,112, 44, 32,102, 97, 99,109, 32, 61, 32, 49, 46, 48, 32, 45, 32,102, + 97, 99, 59, 10, 10, 9,111,117,116, 99,111,108, 32, 61, 32, 99,111,108, 49, 59, 10, 10, 9,116,109,112, 32, 61, 32,102, 97, 99, +109, 32, 43, 32,102, 97, 99, 42, 99,111,108, 50, 46,114, 59, 10, 9,105,102, 40,116,109,112, 32, 60, 61, 32, 48, 46, 48, 41, 10, + 9, 9,111,117,116, 99,111,108, 46,114, 32, 61, 32, 48, 46, 48, 59, 10, 9,101,108,115,101, 32,105,102, 40, 40,116,109,112, 32, + 61, 32, 40, 49, 46, 48, 32, 45, 32, 40, 49, 46, 48, 32, 45, 32,111,117,116, 99,111,108, 46,114, 41, 47,116,109,112, 41, 41, 32, + 60, 32, 48, 46, 48, 41, 10, 9, 9,111,117,116, 99,111,108, 46,114, 32, 61, 32, 48, 46, 48, 59, 10, 9,101,108,115,101, 32,105, +102, 40,116,109,112, 32, 62, 32, 49, 46, 48, 41, 10, 9, 9,111,117,116, 99,111,108, 46,114, 32, 61, 32, 49, 46, 48, 59, 10, 9, +101,108,115,101, 10, 9, 9,111,117,116, 99,111,108, 46,114, 32, 61, 32,116,109,112, 59, 10, 10, 9,116,109,112, 32, 61, 32,102, + 97, 99,109, 32, 43, 32,102, 97, 99, 42, 99,111,108, 50, 46,103, 59, 10, 9,105,102, 40,116,109,112, 32, 60, 61, 32, 48, 46, 48, + 41, 10, 9, 9,111,117,116, 99,111,108, 46,103, 32, 61, 32, 48, 46, 48, 59, 10, 9,101,108,115,101, 32,105,102, 40, 40,116,109, +112, 32, 61, 32, 40, 49, 46, 48, 32, 45, 32, 40, 49, 46, 48, 32, 45, 32,111,117,116, 99,111,108, 46,103, 41, 47,116,109,112, 41, + 41, 32, 60, 32, 48, 46, 48, 41, 10, 9, 9,111,117,116, 99,111,108, 46,103, 32, 61, 32, 48, 46, 48, 59, 10, 9,101,108,115,101, + 32,105,102, 40,116,109,112, 32, 62, 32, 49, 46, 48, 41, 10, 9, 9,111,117,116, 99,111,108, 46,103, 32, 61, 32, 49, 46, 48, 59, + 10, 9,101,108,115,101, 10, 9, 9,111,117,116, 99,111,108, 46,103, 32, 61, 32,116,109,112, 59, 10, 10, 9,116,109,112, 32, 61, + 32,102, 97, 99,109, 32, 43, 32,102, 97, 99, 42, 99,111,108, 50, 46, 98, 59, 10, 9,105,102, 40,116,109,112, 32, 60, 61, 32, 48, + 46, 48, 41, 10, 9, 9,111,117,116, 99,111,108, 46, 98, 32, 61, 32, 48, 46, 48, 59, 10, 9,101,108,115,101, 32,105,102, 40, 40, +116,109,112, 32, 61, 32, 40, 49, 46, 48, 32, 45, 32, 40, 49, 46, 48, 32, 45, 32,111,117,116, 99,111,108, 46, 98, 41, 47,116,109, +112, 41, 41, 32, 60, 32, 48, 46, 48, 41, 10, 9, 9,111,117,116, 99,111,108, 46, 98, 32, 61, 32, 48, 46, 48, 59, 10, 9,101,108, +115,101, 32,105,102, 40,116,109,112, 32, 62, 32, 49, 46, 48, 41, 10, 9, 9,111,117,116, 99,111,108, 46, 98, 32, 61, 32, 49, 46, + 48, 59, 10, 9,101,108,115,101, 10, 9, 9,111,117,116, 99,111,108, 46, 98, 32, 61, 32,116,109,112, 59, 10,125, 10, 10,118,111, +105,100, 32,109,105,120, 95,104,117,101, 40,102,108,111, 97,116, 32,102, 97, 99, 44, 32,118,101, 99, 52, 32, 99,111,108, 49, 44, + 32,118,101, 99, 52, 32, 99,111,108, 50, 44, 32,111,117,116, 32,118,101, 99, 52, 32,111,117,116, 99,111,108, 41, 10,123, 10, 9, +102, 97, 99, 32, 61, 32, 99,108, 97,109,112, 40,102, 97, 99, 44, 32, 48, 46, 48, 44, 32, 49, 46, 48, 41, 59, 10, 9,102,108,111, + 97,116, 32,102, 97, 99,109, 32, 61, 32, 49, 46, 48, 32, 45, 32,102, 97, 99, 59, 10, 10, 9,111,117,116, 99,111,108, 32, 61, 32, + 99,111,108, 49, 59, 10, 10, 9,118,101, 99, 52, 32,104,115,118, 44, 32,104,115,118, 50, 44, 32,116,109,112, 59, 10, 9,114,103, + 98, 95,116,111, 95,104,115,118, 40, 99,111,108, 50, 44, 32,104,115,118, 50, 41, 59, 10, 10, 9,105,102, 40,104,115,118, 50, 46, +121, 32, 33, 61, 32, 48, 46, 48, 41, 32,123, 10, 9, 9,114,103, 98, 95,116,111, 95,104,115,118, 40,111,117,116, 99,111,108, 44, + 32,104,115,118, 41, 59, 10, 9, 9,104,115,118, 46,120, 32, 61, 32,104,115,118, 50, 46,120, 59, 10, 9, 9,104,115,118, 95,116, +111, 95,114,103, 98, 40,104,115,118, 44, 32,116,109,112, 41, 59, 32, 10, 10, 9, 9,111,117,116, 99,111,108, 32, 61, 32,109,105, +120, 40,111,117,116, 99,111,108, 44, 32,116,109,112, 44, 32,102, 97, 99, 41, 59, 10, 9, 9,111,117,116, 99,111,108, 46, 97, 32, + 61, 32, 99,111,108, 49, 46, 97, 59, 10, 9,125, 10,125, 10, 10,118,111,105,100, 32,109,105,120, 95,115, 97,116, 40,102,108,111, + 97,116, 32,102, 97, 99, 44, 32,118,101, 99, 52, 32, 99,111,108, 49, 44, 32,118,101, 99, 52, 32, 99,111,108, 50, 44, 32,111,117, +116, 32,118,101, 99, 52, 32,111,117,116, 99,111,108, 41, 10,123, 10, 9,102, 97, 99, 32, 61, 32, 99,108, 97,109,112, 40,102, 97, + 99, 44, 32, 48, 46, 48, 44, 32, 49, 46, 48, 41, 59, 10, 9,102,108,111, 97,116, 32,102, 97, 99,109, 32, 61, 32, 49, 46, 48, 32, + 45, 32,102, 97, 99, 59, 10, 10, 9,111,117,116, 99,111,108, 32, 61, 32, 99,111,108, 49, 59, 10, 10, 9,118,101, 99, 52, 32,104, +115,118, 44, 32,104,115,118, 50, 59, 10, 9,114,103, 98, 95,116,111, 95,104,115,118, 40,111,117,116, 99,111,108, 44, 32,104,115, +118, 41, 59, 10, 10, 9,105,102, 40,104,115,118, 46,121, 32, 33, 61, 32, 48, 46, 48, 41, 32,123, 10, 9, 9,114,103, 98, 95,116, +111, 95,104,115,118, 40, 99,111,108, 50, 44, 32,104,115,118, 50, 41, 59, 10, 10, 9, 9,104,115,118, 46,121, 32, 61, 32,102, 97, + 99,109, 42,104,115,118, 46,121, 32, 43, 32,102, 97, 99, 42,104,115,118, 50, 46,121, 59, 10, 9, 9,104,115,118, 95,116,111, 95, +114,103, 98, 40,104,115,118, 44, 32,111,117,116, 99,111,108, 41, 59, 10, 9,125, 10,125, 10, 10,118,111,105,100, 32,109,105,120, + 95,118, 97,108, 40,102,108,111, 97,116, 32,102, 97, 99, 44, 32,118,101, 99, 52, 32, 99,111,108, 49, 44, 32,118,101, 99, 52, 32, + 99,111,108, 50, 44, 32,111,117,116, 32,118,101, 99, 52, 32,111,117,116, 99,111,108, 41, 10,123, 10, 9,102, 97, 99, 32, 61, 32, + 99,108, 97,109,112, 40,102, 97, 99, 44, 32, 48, 46, 48, 44, 32, 49, 46, 48, 41, 59, 10, 9,102,108,111, 97,116, 32,102, 97, 99, +109, 32, 61, 32, 49, 46, 48, 32, 45, 32,102, 97, 99, 59, 10, 10, 9,118,101, 99, 52, 32,104,115,118, 44, 32,104,115,118, 50, 59, + 10, 9,114,103, 98, 95,116,111, 95,104,115,118, 40, 99,111,108, 49, 44, 32,104,115,118, 41, 59, 10, 9,114,103, 98, 95,116,111, + 95,104,115,118, 40, 99,111,108, 50, 44, 32,104,115,118, 50, 41, 59, 10, 10, 9,104,115,118, 46,122, 32, 61, 32,102, 97, 99,109, + 42,104,115,118, 46,122, 32, 43, 32,102, 97, 99, 42,104,115,118, 50, 46,122, 59, 10, 9,104,115,118, 95,116,111, 95,114,103, 98, + 40,104,115,118, 44, 32,111,117,116, 99,111,108, 41, 59, 10,125, 10, 10,118,111,105,100, 32,109,105,120, 95, 99,111,108,111,114, 40,102,108,111, 97,116, 32,102, 97, 99, 44, 32,118,101, 99, 52, 32, 99,111,108, 49, 44, 32,118,101, 99, 52, 32, 99,111,108, 50, 44, 32,111,117,116, 32,118,101, 99, 52, 32,111,117,116, 99,111,108, 41, 10,123, 10, 9,102, 97, 99, 32, 61, 32, 99,108, 97,109, 112, 40,102, 97, 99, 44, 32, 48, 46, 48, 44, 32, 49, 46, 48, 41, 59, 10, 9,102,108,111, 97,116, 32,102, 97, 99,109, 32, 61, 32, - 49, 46, 48, 32, 45, 32,102, 97, 99, 59, 10, 10, 9,118,101, 99, 52, 32,111,110,101, 61, 32,118,101, 99, 52, 40, 49, 46, 48, 41, - 59, 10, 9,118,101, 99, 52, 32,115, 99,114, 61, 32,111,110,101, 32, 45, 32, 40,111,110,101, 32, 45, 32, 99,111,108, 50, 41, 42, - 40,111,110,101, 32, 45, 32, 99,111,108, 49, 41, 59, 10, 9,111,117,116, 99,111,108, 32, 61, 32,102, 97, 99,109, 42, 99,111,108, - 49, 32, 43, 32,102, 97, 99, 42, 40, 40,111,110,101, 32, 45, 32, 99,111,108, 49, 41, 42, 99,111,108, 50, 42, 99,111,108, 49, 32, - 43, 32, 99,111,108, 49, 42,115, 99,114, 41, 59, 10,125, 10, 10,118,111,105,100, 32,109,105,120, 95,108,105,110,101, 97,114, 40, -102,108,111, 97,116, 32,102, 97, 99, 44, 32,118,101, 99, 52, 32, 99,111,108, 49, 44, 32,118,101, 99, 52, 32, 99,111,108, 50, 44, - 32,111,117,116, 32,118,101, 99, 52, 32,111,117,116, 99,111,108, 41, 10,123, 10, 9,102, 97, 99, 32, 61, 32, 99,108, 97,109,112, - 40,102, 97, 99, 44, 32, 48, 46, 48, 44, 32, 49, 46, 48, 41, 59, 10, 10, 9,111,117,116, 99,111,108, 32, 61, 32, 99,111,108, 49, - 59, 10, 10, 9,105,102, 40, 99,111,108, 50, 46,114, 32, 62, 32, 48, 46, 53, 41, 10, 9, 9,111,117,116, 99,111,108, 46,114, 61, - 32, 99,111,108, 49, 46,114, 32, 43, 32,102, 97, 99, 42, 40, 50, 46, 48, 42, 40, 99,111,108, 50, 46,114, 32, 45, 32, 48, 46, 53, - 41, 41, 59, 10, 9,101,108,115,101, 10, 9, 9,111,117,116, 99,111,108, 46,114, 61, 32, 99,111,108, 49, 46,114, 32, 43, 32,102, - 97, 99, 42, 40, 50, 46, 48, 42, 40, 99,111,108, 50, 46,114, 41, 32, 45, 32, 49, 46, 48, 41, 59, 10, 10, 9,105,102, 40, 99,111, -108, 50, 46,103, 32, 62, 32, 48, 46, 53, 41, 10, 9, 9,111,117,116, 99,111,108, 46,103, 61, 32, 99,111,108, 49, 46,103, 32, 43, - 32,102, 97, 99, 42, 40, 50, 46, 48, 42, 40, 99,111,108, 50, 46,103, 32, 45, 32, 48, 46, 53, 41, 41, 59, 10, 9,101,108,115,101, - 10, 9, 9,111,117,116, 99,111,108, 46,103, 61, 32, 99,111,108, 49, 46,103, 32, 43, 32,102, 97, 99, 42, 40, 50, 46, 48, 42, 40, - 99,111,108, 50, 46,103, 41, 32, 45, 32, 49, 46, 48, 41, 59, 10, 10, 9,105,102, 40, 99,111,108, 50, 46, 98, 32, 62, 32, 48, 46, - 53, 41, 10, 9, 9,111,117,116, 99,111,108, 46, 98, 61, 32, 99,111,108, 49, 46, 98, 32, 43, 32,102, 97, 99, 42, 40, 50, 46, 48, - 42, 40, 99,111,108, 50, 46, 98, 32, 45, 32, 48, 46, 53, 41, 41, 59, 10, 9,101,108,115,101, 10, 9, 9,111,117,116, 99,111,108, - 46, 98, 61, 32, 99,111,108, 49, 46, 98, 32, 43, 32,102, 97, 99, 42, 40, 50, 46, 48, 42, 40, 99,111,108, 50, 46, 98, 41, 32, 45, - 32, 49, 46, 48, 41, 59, 10,125, 10, 10,118,111,105,100, 32,118, 97,108,116,111,114,103, 98, 40,102,108,111, 97,116, 32,102, 97, - 99, 44, 32,115, 97,109,112,108,101,114, 49, 68, 32, 99,111,108,111,114,109, 97,112, 44, 32,111,117,116, 32,118,101, 99, 52, 32, -111,117,116, 99,111,108, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116, 97,108,112,104, 97, 41, 10,123, 10, 9,111, -117,116, 99,111,108, 32, 61, 32,116,101,120,116,117,114,101, 49, 68, 40, 99,111,108,111,114,109, 97,112, 44, 32,102, 97, 99, 41, - 59, 10, 9,111,117,116, 97,108,112,104, 97, 32, 61, 32,111,117,116, 99,111,108, 46, 97, 59, 10,125, 10, 10,118,111,105,100, 32, -114,103, 98,116,111, 98,119, 40,118,101, 99, 52, 32, 99,111,108,111,114, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117, -116,118, 97,108, 41, 32, 32, 10,123, 10, 9,111,117,116,118, 97,108, 32, 61, 32, 99,111,108,111,114, 46,114, 42, 48, 46, 51, 53, - 32, 43, 32, 99,111,108,111,114, 46,103, 42, 48, 46, 52, 53, 32, 43, 32, 99,111,108,111,114, 46, 98, 42, 48, 46, 50, 59, 32, 47, - 42, 32,107,101,101,112, 32,116,104,101,115,101, 32,102, 97, 99,116,111,114,115, 32,105,110, 32,115,121,110, 99, 32,119,105,116, -104, 32,116,101,120,116,117,114,101, 46,104, 58, 82, 71, 66, 84, 79, 66, 87, 32, 42, 47, 10,125, 10, 10,118,111,105,100, 32,105, -110,118,101,114,116, 40,102,108,111, 97,116, 32,102, 97, 99, 44, 32,118,101, 99, 52, 32, 99,111,108, 44, 32,111,117,116, 32,118, -101, 99, 52, 32,111,117,116, 99,111,108, 41, 10,123, 10, 9,111,117,116, 99,111,108, 46,120,121,122, 32, 61, 32,109,105,120, 40, - 99,111,108, 46,120,121,122, 44, 32,118,101, 99, 51, 40, 49, 46, 48, 44, 32, 49, 46, 48, 44, 32, 49, 46, 48, 41, 32, 45, 32, 99, -111,108, 46,120,121,122, 44, 32,102, 97, 99, 41, 59, 10, 9,111,117,116, 99,111,108, 46,119, 32, 61, 32, 99,111,108, 46,119, 59, - 10,125, 10, 10,118,111,105,100, 32,104,117,101, 95,115, 97,116, 40,102,108,111, 97,116, 32,104,117,101, 44, 32,102,108,111, 97, -116, 32,115, 97,116, 44, 32,102,108,111, 97,116, 32,118, 97,108,117,101, 44, 32,102,108,111, 97,116, 32,102, 97, 99, 44, 32,118, -101, 99, 52, 32, 99,111,108, 44, 32,111,117,116, 32,118,101, 99, 52, 32,111,117,116, 99,111,108, 41, 10,123, 10, 9,118,101, 99, - 52, 32,104,115,118, 59, 10, 10, 9,114,103, 98, 95,116,111, 95,104,115,118, 40, 99,111,108, 44, 32,104,115,118, 41, 59, 10, 10, - 9,104,115,118, 91, 48, 93, 32, 43, 61, 32, 40,104,117,101, 32, 45, 32, 48, 46, 53, 41, 59, 10, 9,105,102, 40,104,115,118, 91, - 48, 93, 62, 49, 46, 48, 41, 32,104,115,118, 91, 48, 93, 45, 61, 49, 46, 48, 59, 32,101,108,115,101, 32,105,102, 40,104,115,118, - 91, 48, 93, 60, 48, 46, 48, 41, 32,104,115,118, 91, 48, 93, 43, 61, 32, 49, 46, 48, 59, 10, 9,104,115,118, 91, 49, 93, 32, 42, - 61, 32,115, 97,116, 59, 10, 9,105,102, 40,104,115,118, 91, 49, 93, 62, 49, 46, 48, 41, 32,104,115,118, 91, 49, 93, 61, 32, 49, - 46, 48, 59, 32,101,108,115,101, 32,105,102, 40,104,115,118, 91, 49, 93, 60, 48, 46, 48, 41, 32,104,115,118, 91, 49, 93, 61, 32, - 48, 46, 48, 59, 10, 9,104,115,118, 91, 50, 93, 32, 42, 61, 32,118, 97,108,117,101, 59, 10, 9,105,102, 40,104,115,118, 91, 50, - 93, 62, 49, 46, 48, 41, 32,104,115,118, 91, 50, 93, 61, 32, 49, 46, 48, 59, 32,101,108,115,101, 32,105,102, 40,104,115,118, 91, - 50, 93, 60, 48, 46, 48, 41, 32,104,115,118, 91, 50, 93, 61, 32, 48, 46, 48, 59, 10, 10, 9,104,115,118, 95,116,111, 95,114,103, - 98, 40,104,115,118, 44, 32,111,117,116, 99,111,108, 41, 59, 10, 10, 9,111,117,116, 99,111,108, 32, 61, 32,109,105,120, 40, 99, -111,108, 44, 32,111,117,116, 99,111,108, 44, 32,102, 97, 99, 41, 59, 10,125, 10, 10,118,111,105,100, 32,115,101,112, 97,114, 97, -116,101, 95,114,103, 98, 40,118,101, 99, 52, 32, 99,111,108, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,114, 44, 32,111,117, -116, 32,102,108,111, 97,116, 32,103, 44, 32,111,117,116, 32,102,108,111, 97,116, 32, 98, 41, 10,123, 10, 9,114, 32, 61, 32, 99, -111,108, 46,114, 59, 10, 9,103, 32, 61, 32, 99,111,108, 46,103, 59, 10, 9, 98, 32, 61, 32, 99,111,108, 46, 98, 59, 10,125, 10, - 10,118,111,105,100, 32, 99,111,109, 98,105,110,101, 95,114,103, 98, 40,102,108,111, 97,116, 32,114, 44, 32,102,108,111, 97,116, - 32,103, 44, 32,102,108,111, 97,116, 32, 98, 44, 32,111,117,116, 32,118,101, 99, 52, 32, 99,111,108, 41, 10,123, 10, 9, 99,111, -108, 32, 61, 32,118,101, 99, 52, 40,114, 44, 32,103, 44, 32, 98, 44, 32, 49, 46, 48, 41, 59, 10,125, 10, 10,118,111,105,100, 32, -111,117,116,112,117,116, 95,110,111,100,101, 40,118,101, 99, 52, 32,114,103, 98, 44, 32,102,108,111, 97,116, 32, 97,108,112,104, - 97, 44, 32,111,117,116, 32,118,101, 99, 52, 32,111,117,116,114,103, 98, 41, 10,123, 10, 9,111,117,116,114,103, 98, 32, 61, 32, -118,101, 99, 52, 40,114,103, 98, 46,114,103, 98, 44, 32, 97,108,112,104, 97, 41, 59, 10,125, 10, 10, 47, 42, 42, 42, 42, 42, 42, - 42, 42, 42, 42, 42, 32, 84, 69, 88, 84, 85, 82, 69, 83, 32, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 47, 10, - 10,118,111,105,100, 32,116,101,120,116,117,114,101, 95,102,108,105,112, 95, 98,108,101,110,100, 40,118,101, 99, 51, 32,118,101, - 99, 44, 32,111,117,116, 32,118,101, 99, 51, 32,111,117,116,118,101, 99, 41, 10,123, 10, 9,111,117,116,118,101, 99, 32, 61, 32, -118,101, 99, 46,121,120,122, 59, 10,125, 10, 10,118,111,105,100, 32,116,101,120,116,117,114,101, 95, 98,108,101,110,100, 95,108, -105,110, 40,118,101, 99, 51, 32,118,101, 99, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, 10,123, - 10, 9,111,117,116,118, 97,108, 32, 61, 32, 40, 49, 46, 48, 43,118,101, 99, 46,120, 41, 47, 50, 46, 48, 59, 10,125, 10, 10,118, -111,105,100, 32,116,101,120,116,117,114,101, 95, 98,108,101,110,100, 95,113,117, 97,100, 40,118,101, 99, 51, 32,118,101, 99, 44, - 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, 10,123, 10, 9,111,117,116,118, 97,108, 32, 61, 32,109, - 97,120, 40, 40, 49, 46, 48, 43,118,101, 99, 46,120, 41, 47, 50, 46, 48, 44, 32, 48, 46, 48, 41, 59, 10, 9,111,117,116,118, 97, -108, 32, 42, 61, 32,111,117,116,118, 97,108, 59, 10,125, 10, 10,118,111,105,100, 32,116,101,120,116,117,114,101, 95,119,111,111, -100, 95,115,105,110, 40,118,101, 99, 51, 32,118,101, 99, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,118, 97,108,117,101, 44, - 32,111,117,116, 32,118,101, 99, 52, 32, 99,111,108,111,114, 44, 32,111,117,116, 32,118,101, 99, 51, 32,110,111,114,109, 97,108, - 41, 10,123, 10, 9,102,108,111, 97,116, 32, 97, 32, 61, 32,115,113,114,116, 40,118,101, 99, 46,120, 42,118,101, 99, 46,120, 32, - 43, 32,118,101, 99, 46,121, 42,118,101, 99, 46,121, 32, 43, 32,118,101, 99, 46,122, 42,118,101, 99, 46,122, 41, 42, 50, 48, 46, - 48, 59, 10, 9,102,108,111, 97,116, 32,119,105, 32, 61, 32, 48, 46, 53, 32, 43, 32, 48, 46, 53, 42,115,105,110, 40, 97, 41, 59, - 10, 10, 9,118, 97,108,117,101, 32, 61, 32,119,105, 59, 10, 9, 99,111,108,111,114, 32, 61, 32,118,101, 99, 52, 40,119,105, 44, - 32,119,105, 44, 32,119,105, 44, 32, 49, 46, 48, 41, 59, 10, 9,110,111,114,109, 97,108, 32, 61, 32,118,101, 99, 51, 40, 48, 46, - 48, 44, 32, 48, 46, 48, 44, 32, 48, 46, 48, 41, 59, 10,125, 10, 10,118,111,105,100, 32,116,101,120,116,117,114,101, 95,105,109, - 97,103,101, 40,118,101, 99, 51, 32,118,101, 99, 44, 32,115, 97,109,112,108,101,114, 50, 68, 32,105,109, 97, 44, 32,111,117,116, - 32,102,108,111, 97,116, 32,118, 97,108,117,101, 44, 32,111,117,116, 32,118,101, 99, 52, 32, 99,111,108,111,114, 44, 32,111,117, -116, 32,118,101, 99, 51, 32,110,111,114,109, 97,108, 41, 10,123, 10, 9, 99,111,108,111,114, 32, 61, 32,116,101,120,116,117,114, -101, 50, 68, 40,105,109, 97, 44, 32, 40,118,101, 99, 46,120,121, 32, 43, 32,118,101, 99, 50, 40, 49, 46, 48, 44, 32, 49, 46, 48, - 41, 41, 42, 48, 46, 53, 41, 59, 10, 9,118, 97,108,117,101, 32, 61, 32, 49, 46, 48, 59, 10, 10, 9,110,111,114,109, 97,108, 46, -120, 32, 61, 32, 50, 46, 48, 42, 40, 99,111,108,111,114, 46,114, 32, 45, 32, 48, 46, 53, 41, 59, 10, 9,110,111,114,109, 97,108, - 46,121, 32, 61, 32, 50, 46, 48, 42, 40, 48, 46, 53, 32, 45, 32, 99,111,108,111,114, 46,103, 41, 59, 10, 9,110,111,114,109, 97, -108, 46,122, 32, 61, 32, 50, 46, 48, 42, 40, 99,111,108,111,114, 46, 98, 32, 45, 32, 48, 46, 53, 41, 59, 10,125, 10, 10, 47, 42, - 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 32, 77, 84, 69, 88, 32, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, - 42, 42, 42, 47, 10, 10,118,111,105,100, 32,116,101,120, 99,111, 95,111,114, 99,111, 40,118,101, 99, 51, 32, 97,116,116,111,114, - 99,111, 44, 32,111,117,116, 32,118,101, 99, 51, 32,111,114, 99,111, 41, 10,123, 10, 9,111,114, 99,111, 32, 61, 32, 97,116,116, -111,114, 99,111, 59, 10,125, 10, 10,118,111,105,100, 32,116,101,120, 99,111, 95,117,118, 40,118,101, 99, 50, 32, 97,116,116,117, -118, 44, 32,111,117,116, 32,118,101, 99, 51, 32,117,118, 41, 10,123, 10, 9, 47, 42, 32,100,105,115, 97, 98,108,101,100, 32,102, -111,114, 32,110,111,119, 44, 32,119,111,114,107,115, 32,116,111,103,101,116,104,101,114, 32,119,105,116,104, 32,108,101, 97,118, -105,110,103, 32,111,117,116, 32,109,116,101,120, 95, 50,100, 95,109, 97,112,112,105,110,103, 10, 9, 32, 32, 32,117,118, 32, 61, - 32,118,101, 99, 51, 40, 97,116,116,117,118, 42, 50, 46, 48, 32, 45, 32,118,101, 99, 50, 40, 49, 46, 48, 44, 32, 49, 46, 48, 41, - 44, 32, 48, 46, 48, 41, 59, 32, 42, 47, 10, 9,117,118, 32, 61, 32,118,101, 99, 51, 40, 97,116,116,117,118, 44, 32, 48, 46, 48, - 41, 59, 10,125, 10, 10,118,111,105,100, 32,116,101,120, 99,111, 95,110,111,114,109, 40,118,101, 99, 51, 32,110,111,114,109, 97, -108, 44, 32,111,117,116, 32,118,101, 99, 51, 32,111,117,116,110,111,114,109, 97,108, 41, 10,123, 10, 9, 47, 42, 32, 99,111,114, -114,101,115,112,111,110,100,115, 32,116,111, 32,115,104,105, 45, 62,111,114,110, 44, 32,119,104,105, 99,104, 32,105,115, 32,110, -101,103, 97,116,101,100, 32,115,111, 32, 99, 97,110, 99,101,108,115, 10, 9, 32, 32, 32,111,117,116, 32, 98,108,101,110,100,101, -114, 32,110,111,114,109, 97,108, 32,110,101,103, 97,116,105,111,110, 32, 42, 47, 10, 9,111,117,116,110,111,114,109, 97,108, 32, - 61, 32,110,111,114,109, 97,108,105,122,101, 40,110,111,114,109, 97,108, 41, 59, 10,125, 10, 10,118,111,105,100, 32,116,101,120, - 99,111, 95,116, 97,110,103,101,110,116, 40,118,101, 99, 51, 32,116, 97,110,103,101,110,116, 44, 32,111,117,116, 32,118,101, 99, - 51, 32,111,117,116,116, 97,110,103,101,110,116, 41, 10,123, 10, 9,111,117,116,116, 97,110,103,101,110,116, 32, 61, 32,110,111, -114,109, 97,108,105,122,101, 40,116, 97,110,103,101,110,116, 41, 59, 10,125, 10, 10,118,111,105,100, 32,116,101,120, 99,111, 95, -103,108,111, 98, 97,108, 40,109, 97,116, 52, 32,118,105,101,119,105,110,118,109, 97,116, 44, 32,118,101, 99, 51, 32, 99,111, 44, - 32,111,117,116, 32,118,101, 99, 51, 32,103,108,111, 98, 97,108, 41, 10,123, 10, 9,103,108,111, 98, 97,108, 32, 61, 32, 40,118, -105,101,119,105,110,118,109, 97,116, 42,118,101, 99, 52, 40, 99,111, 44, 32, 49, 46, 48, 41, 41, 46,120,121,122, 59, 10,125, 10, - 10,118,111,105,100, 32,116,101,120, 99,111, 95,111, 98,106,101, 99,116, 40,109, 97,116, 52, 32,118,105,101,119,105,110,118,109, - 97,116, 44, 32,109, 97,116, 52, 32,111, 98,105,110,118,109, 97,116, 44, 32,118,101, 99, 51, 32, 99,111, 44, 32,111,117,116, 32, -118,101, 99, 51, 32,111, 98,106,101, 99,116, 41, 10,123, 10, 9,111, 98,106,101, 99,116, 32, 61, 32, 40,111, 98,105,110,118,109, - 97,116, 42, 40,118,105,101,119,105,110,118,109, 97,116, 42,118,101, 99, 52, 40, 99,111, 44, 32, 49, 46, 48, 41, 41, 41, 46,120, -121,122, 59, 10,125, 10, 10,118,111,105,100, 32,116,101,120, 99,111, 95,114,101,102,108, 40,118,101, 99, 51, 32,118,110, 44, 32, -118,101, 99, 51, 32,118,105,101,119, 44, 32,111,117,116, 32,118,101, 99, 51, 32,114,101,102, 41, 10,123, 10, 9,114,101,102, 32, - 61, 32,118,105,101,119, 32, 45, 32, 50, 46, 48, 42,100,111,116, 40,118,110, 44, 32,118,105,101,119, 41, 42,118,110, 59, 10,125, - 10, 10,118,111,105,100, 32,115,104, 97,100,101, 95,110,111,114,109, 40,118,101, 99, 51, 32,110,111,114,109, 97,108, 44, 32,111, -117,116, 32,118,101, 99, 51, 32,111,117,116,110,111,114,109, 97,108, 41, 10,123, 10, 9, 47, 42, 32, 98,108,101,110,100,101,114, - 32,114,101,110,100,101,114, 32,110,111,114,109, 97,108, 32,105,115, 32,110,101,103, 97,116,101,100, 32, 42, 47, 10, 9,111,117, -116,110,111,114,109, 97,108, 32, 61, 32, 45,110,111,114,109, 97,108,105,122,101, 40,110,111,114,109, 97,108, 41, 59, 10,125, 10, - 10,118,111,105,100, 32,109,116,101,120, 95,114,103, 98, 95, 98,108,101,110,100, 40,118,101, 99, 51, 32,111,117,116, 99,111,108, - 44, 32,118,101, 99, 51, 32,116,101,120, 99,111,108, 44, 32,102,108,111, 97,116, 32,102, 97, 99,116, 44, 32,102,108,111, 97,116, - 32,102, 97, 99,103, 44, 32,111,117,116, 32,118,101, 99, 51, 32,105,110, 99,111,108, 41, 10,123, 10, 9,102,108,111, 97,116, 32, -102, 97, 99,109, 59, 10, 10, 9,102, 97, 99,116, 32, 42, 61, 32,102, 97, 99,103, 59, 10, 9,102, 97, 99,109, 32, 61, 32, 49, 46, - 48, 45,102, 97, 99,116, 59, 10, 10, 9,105,110, 99,111,108, 32, 61, 32,102, 97, 99,116, 42,116,101,120, 99,111,108, 32, 43, 32, -102, 97, 99,109, 42,111,117,116, 99,111,108, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95,114,103, 98, 95,109,117, -108, 40,118,101, 99, 51, 32,111,117,116, 99,111,108, 44, 32,118,101, 99, 51, 32,116,101,120, 99,111,108, 44, 32,102,108,111, 97, -116, 32,102, 97, 99,116, 44, 32,102,108,111, 97,116, 32,102, 97, 99,103, 44, 32,111,117,116, 32,118,101, 99, 51, 32,105,110, 99, -111,108, 41, 10,123, 10, 9,102,108,111, 97,116, 32,102, 97, 99,109, 59, 10, 10, 9,102, 97, 99,116, 32, 42, 61, 32,102, 97, 99, -103, 59, 10, 9,102, 97, 99,109, 32, 61, 32, 49, 46, 48, 45,102, 97, 99,103, 59, 10, 10, 9,105,110, 99,111,108, 32, 61, 32, 40, -102, 97, 99,109, 32, 43, 32,102, 97, 99,116, 42,116,101,120, 99,111,108, 41, 42,111,117,116, 99,111,108, 59, 10,125, 10, 10,118, -111,105,100, 32,109,116,101,120, 95,114,103, 98, 95,115, 99,114,101,101,110, 40,118,101, 99, 51, 32,111,117,116, 99,111,108, 44, - 32,118,101, 99, 51, 32,116,101,120, 99,111,108, 44, 32,102,108,111, 97,116, 32,102, 97, 99,116, 44, 32,102,108,111, 97,116, 32, -102, 97, 99,103, 44, 32,111,117,116, 32,118,101, 99, 51, 32,105,110, 99,111,108, 41, 10,123, 10, 9,102,108,111, 97,116, 32,102, - 97, 99,109, 59, 10, 10, 9,102, 97, 99,116, 32, 42, 61, 32,102, 97, 99,103, 59, 10, 9,102, 97, 99,109, 32, 61, 32, 49, 46, 48, - 45,102, 97, 99,103, 59, 10, 10, 9,105,110, 99,111,108, 32, 61, 32,118,101, 99, 51, 40, 49, 46, 48, 41, 32, 45, 32, 40,118,101, - 99, 51, 40,102, 97, 99,109, 41, 32, 43, 32,102, 97, 99,116, 42, 40,118,101, 99, 51, 40, 49, 46, 48, 41, 32, 45, 32,116,101,120, - 99,111,108, 41, 41, 42, 40,118,101, 99, 51, 40, 49, 46, 48, 41, 32, 45, 32,111,117,116, 99,111,108, 41, 59, 10,125, 10, 10,118, -111,105,100, 32,109,116,101,120, 95,114,103, 98, 95,111,118,101,114,108, 97,121, 40,118,101, 99, 51, 32,111,117,116, 99,111,108, + 49, 46, 48, 32, 45, 32,102, 97, 99, 59, 10, 10, 9,111,117,116, 99,111,108, 32, 61, 32, 99,111,108, 49, 59, 10, 10, 9,118,101, + 99, 52, 32,104,115,118, 44, 32,104,115,118, 50, 44, 32,116,109,112, 59, 10, 9,114,103, 98, 95,116,111, 95,104,115,118, 40, 99, +111,108, 50, 44, 32,104,115,118, 50, 41, 59, 10, 10, 9,105,102, 40,104,115,118, 50, 46,121, 32, 33, 61, 32, 48, 46, 48, 41, 32, +123, 10, 9, 9,114,103, 98, 95,116,111, 95,104,115,118, 40,111,117,116, 99,111,108, 44, 32,104,115,118, 41, 59, 10, 9, 9,104, +115,118, 46,120, 32, 61, 32,104,115,118, 50, 46,120, 59, 10, 9, 9,104,115,118, 46,121, 32, 61, 32,104,115,118, 50, 46,121, 59, + 10, 9, 9,104,115,118, 95,116,111, 95,114,103, 98, 40,104,115,118, 44, 32,116,109,112, 41, 59, 32, 10, 10, 9, 9,111,117,116, + 99,111,108, 32, 61, 32,109,105,120, 40,111,117,116, 99,111,108, 44, 32,116,109,112, 44, 32,102, 97, 99, 41, 59, 10, 9, 9,111, +117,116, 99,111,108, 46, 97, 32, 61, 32, 99,111,108, 49, 46, 97, 59, 10, 9,125, 10,125, 10, 10,118,111,105,100, 32,109,105,120, + 95,115,111,102,116, 40,102,108,111, 97,116, 32,102, 97, 99, 44, 32,118,101, 99, 52, 32, 99,111,108, 49, 44, 32,118,101, 99, 52, + 32, 99,111,108, 50, 44, 32,111,117,116, 32,118,101, 99, 52, 32,111,117,116, 99,111,108, 41, 10,123, 10, 9,102, 97, 99, 32, 61, + 32, 99,108, 97,109,112, 40,102, 97, 99, 44, 32, 48, 46, 48, 44, 32, 49, 46, 48, 41, 59, 10, 9,102,108,111, 97,116, 32,102, 97, + 99,109, 32, 61, 32, 49, 46, 48, 32, 45, 32,102, 97, 99, 59, 10, 10, 9,118,101, 99, 52, 32,111,110,101, 61, 32,118,101, 99, 52, + 40, 49, 46, 48, 41, 59, 10, 9,118,101, 99, 52, 32,115, 99,114, 61, 32,111,110,101, 32, 45, 32, 40,111,110,101, 32, 45, 32, 99, +111,108, 50, 41, 42, 40,111,110,101, 32, 45, 32, 99,111,108, 49, 41, 59, 10, 9,111,117,116, 99,111,108, 32, 61, 32,102, 97, 99, +109, 42, 99,111,108, 49, 32, 43, 32,102, 97, 99, 42, 40, 40,111,110,101, 32, 45, 32, 99,111,108, 49, 41, 42, 99,111,108, 50, 42, + 99,111,108, 49, 32, 43, 32, 99,111,108, 49, 42,115, 99,114, 41, 59, 10,125, 10, 10,118,111,105,100, 32,109,105,120, 95,108,105, +110,101, 97,114, 40,102,108,111, 97,116, 32,102, 97, 99, 44, 32,118,101, 99, 52, 32, 99,111,108, 49, 44, 32,118,101, 99, 52, 32, + 99,111,108, 50, 44, 32,111,117,116, 32,118,101, 99, 52, 32,111,117,116, 99,111,108, 41, 10,123, 10, 9,102, 97, 99, 32, 61, 32, + 99,108, 97,109,112, 40,102, 97, 99, 44, 32, 48, 46, 48, 44, 32, 49, 46, 48, 41, 59, 10, 10, 9,111,117,116, 99,111,108, 32, 61, + 32, 99,111,108, 49, 59, 10, 10, 9,105,102, 40, 99,111,108, 50, 46,114, 32, 62, 32, 48, 46, 53, 41, 10, 9, 9,111,117,116, 99, +111,108, 46,114, 61, 32, 99,111,108, 49, 46,114, 32, 43, 32,102, 97, 99, 42, 40, 50, 46, 48, 42, 40, 99,111,108, 50, 46,114, 32, + 45, 32, 48, 46, 53, 41, 41, 59, 10, 9,101,108,115,101, 10, 9, 9,111,117,116, 99,111,108, 46,114, 61, 32, 99,111,108, 49, 46, +114, 32, 43, 32,102, 97, 99, 42, 40, 50, 46, 48, 42, 40, 99,111,108, 50, 46,114, 41, 32, 45, 32, 49, 46, 48, 41, 59, 10, 10, 9, +105,102, 40, 99,111,108, 50, 46,103, 32, 62, 32, 48, 46, 53, 41, 10, 9, 9,111,117,116, 99,111,108, 46,103, 61, 32, 99,111,108, + 49, 46,103, 32, 43, 32,102, 97, 99, 42, 40, 50, 46, 48, 42, 40, 99,111,108, 50, 46,103, 32, 45, 32, 48, 46, 53, 41, 41, 59, 10, + 9,101,108,115,101, 10, 9, 9,111,117,116, 99,111,108, 46,103, 61, 32, 99,111,108, 49, 46,103, 32, 43, 32,102, 97, 99, 42, 40, + 50, 46, 48, 42, 40, 99,111,108, 50, 46,103, 41, 32, 45, 32, 49, 46, 48, 41, 59, 10, 10, 9,105,102, 40, 99,111,108, 50, 46, 98, + 32, 62, 32, 48, 46, 53, 41, 10, 9, 9,111,117,116, 99,111,108, 46, 98, 61, 32, 99,111,108, 49, 46, 98, 32, 43, 32,102, 97, 99, + 42, 40, 50, 46, 48, 42, 40, 99,111,108, 50, 46, 98, 32, 45, 32, 48, 46, 53, 41, 41, 59, 10, 9,101,108,115,101, 10, 9, 9,111, +117,116, 99,111,108, 46, 98, 61, 32, 99,111,108, 49, 46, 98, 32, 43, 32,102, 97, 99, 42, 40, 50, 46, 48, 42, 40, 99,111,108, 50, + 46, 98, 41, 32, 45, 32, 49, 46, 48, 41, 59, 10,125, 10, 10,118,111,105,100, 32,118, 97,108,116,111,114,103, 98, 40,102,108,111, + 97,116, 32,102, 97, 99, 44, 32,115, 97,109,112,108,101,114, 49, 68, 32, 99,111,108,111,114,109, 97,112, 44, 32,111,117,116, 32, +118,101, 99, 52, 32,111,117,116, 99,111,108, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116, 97,108,112,104, 97, 41, + 10,123, 10, 9,111,117,116, 99,111,108, 32, 61, 32,116,101,120,116,117,114,101, 49, 68, 40, 99,111,108,111,114,109, 97,112, 44, + 32,102, 97, 99, 41, 59, 10, 9,111,117,116, 97,108,112,104, 97, 32, 61, 32,111,117,116, 99,111,108, 46, 97, 59, 10,125, 10, 10, +118,111,105,100, 32,114,103, 98,116,111, 98,119, 40,118,101, 99, 52, 32, 99,111,108,111,114, 44, 32,111,117,116, 32,102,108,111, + 97,116, 32,111,117,116,118, 97,108, 41, 32, 32, 10,123, 10, 9,111,117,116,118, 97,108, 32, 61, 32, 99,111,108,111,114, 46,114, + 42, 48, 46, 51, 53, 32, 43, 32, 99,111,108,111,114, 46,103, 42, 48, 46, 52, 53, 32, 43, 32, 99,111,108,111,114, 46, 98, 42, 48, + 46, 50, 59, 32, 47, 42, 32,107,101,101,112, 32,116,104,101,115,101, 32,102, 97, 99,116,111,114,115, 32,105,110, 32,115,121,110, + 99, 32,119,105,116,104, 32,116,101,120,116,117,114,101, 46,104, 58, 82, 71, 66, 84, 79, 66, 87, 32, 42, 47, 10,125, 10, 10,118, +111,105,100, 32,105,110,118,101,114,116, 40,102,108,111, 97,116, 32,102, 97, 99, 44, 32,118,101, 99, 52, 32, 99,111,108, 44, 32, +111,117,116, 32,118,101, 99, 52, 32,111,117,116, 99,111,108, 41, 10,123, 10, 9,111,117,116, 99,111,108, 46,120,121,122, 32, 61, + 32,109,105,120, 40, 99,111,108, 46,120,121,122, 44, 32,118,101, 99, 51, 40, 49, 46, 48, 44, 32, 49, 46, 48, 44, 32, 49, 46, 48, + 41, 32, 45, 32, 99,111,108, 46,120,121,122, 44, 32,102, 97, 99, 41, 59, 10, 9,111,117,116, 99,111,108, 46,119, 32, 61, 32, 99, +111,108, 46,119, 59, 10,125, 10, 10,118,111,105,100, 32,104,117,101, 95,115, 97,116, 40,102,108,111, 97,116, 32,104,117,101, 44, + 32,102,108,111, 97,116, 32,115, 97,116, 44, 32,102,108,111, 97,116, 32,118, 97,108,117,101, 44, 32,102,108,111, 97,116, 32,102, + 97, 99, 44, 32,118,101, 99, 52, 32, 99,111,108, 44, 32,111,117,116, 32,118,101, 99, 52, 32,111,117,116, 99,111,108, 41, 10,123, + 10, 9,118,101, 99, 52, 32,104,115,118, 59, 10, 10, 9,114,103, 98, 95,116,111, 95,104,115,118, 40, 99,111,108, 44, 32,104,115, +118, 41, 59, 10, 10, 9,104,115,118, 91, 48, 93, 32, 43, 61, 32, 40,104,117,101, 32, 45, 32, 48, 46, 53, 41, 59, 10, 9,105,102, + 40,104,115,118, 91, 48, 93, 62, 49, 46, 48, 41, 32,104,115,118, 91, 48, 93, 45, 61, 49, 46, 48, 59, 32,101,108,115,101, 32,105, +102, 40,104,115,118, 91, 48, 93, 60, 48, 46, 48, 41, 32,104,115,118, 91, 48, 93, 43, 61, 32, 49, 46, 48, 59, 10, 9,104,115,118, + 91, 49, 93, 32, 42, 61, 32,115, 97,116, 59, 10, 9,105,102, 40,104,115,118, 91, 49, 93, 62, 49, 46, 48, 41, 32,104,115,118, 91, + 49, 93, 61, 32, 49, 46, 48, 59, 32,101,108,115,101, 32,105,102, 40,104,115,118, 91, 49, 93, 60, 48, 46, 48, 41, 32,104,115,118, + 91, 49, 93, 61, 32, 48, 46, 48, 59, 10, 9,104,115,118, 91, 50, 93, 32, 42, 61, 32,118, 97,108,117,101, 59, 10, 9,105,102, 40, +104,115,118, 91, 50, 93, 62, 49, 46, 48, 41, 32,104,115,118, 91, 50, 93, 61, 32, 49, 46, 48, 59, 32,101,108,115,101, 32,105,102, + 40,104,115,118, 91, 50, 93, 60, 48, 46, 48, 41, 32,104,115,118, 91, 50, 93, 61, 32, 48, 46, 48, 59, 10, 10, 9,104,115,118, 95, +116,111, 95,114,103, 98, 40,104,115,118, 44, 32,111,117,116, 99,111,108, 41, 59, 10, 10, 9,111,117,116, 99,111,108, 32, 61, 32, +109,105,120, 40, 99,111,108, 44, 32,111,117,116, 99,111,108, 44, 32,102, 97, 99, 41, 59, 10,125, 10, 10,118,111,105,100, 32,115, +101,112, 97,114, 97,116,101, 95,114,103, 98, 40,118,101, 99, 52, 32, 99,111,108, 44, 32,111,117,116, 32,102,108,111, 97,116, 32, +114, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,103, 44, 32,111,117,116, 32,102,108,111, 97,116, 32, 98, 41, 10,123, 10, 9, +114, 32, 61, 32, 99,111,108, 46,114, 59, 10, 9,103, 32, 61, 32, 99,111,108, 46,103, 59, 10, 9, 98, 32, 61, 32, 99,111,108, 46, + 98, 59, 10,125, 10, 10,118,111,105,100, 32, 99,111,109, 98,105,110,101, 95,114,103, 98, 40,102,108,111, 97,116, 32,114, 44, 32, +102,108,111, 97,116, 32,103, 44, 32,102,108,111, 97,116, 32, 98, 44, 32,111,117,116, 32,118,101, 99, 52, 32, 99,111,108, 41, 10, +123, 10, 9, 99,111,108, 32, 61, 32,118,101, 99, 52, 40,114, 44, 32,103, 44, 32, 98, 44, 32, 49, 46, 48, 41, 59, 10,125, 10, 10, +118,111,105,100, 32,111,117,116,112,117,116, 95,110,111,100,101, 40,118,101, 99, 52, 32,114,103, 98, 44, 32,102,108,111, 97,116, + 32, 97,108,112,104, 97, 44, 32,111,117,116, 32,118,101, 99, 52, 32,111,117,116,114,103, 98, 41, 10,123, 10, 9,111,117,116,114, +103, 98, 32, 61, 32,118,101, 99, 52, 40,114,103, 98, 46,114,103, 98, 44, 32, 97,108,112,104, 97, 41, 59, 10,125, 10, 10, 47, 42, + 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 32, 84, 69, 88, 84, 85, 82, 69, 83, 32, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, + 42, 42, 42, 47, 10, 10,118,111,105,100, 32,116,101,120,116,117,114,101, 95,102,108,105,112, 95, 98,108,101,110,100, 40,118,101, + 99, 51, 32,118,101, 99, 44, 32,111,117,116, 32,118,101, 99, 51, 32,111,117,116,118,101, 99, 41, 10,123, 10, 9,111,117,116,118, +101, 99, 32, 61, 32,118,101, 99, 46,121,120,122, 59, 10,125, 10, 10,118,111,105,100, 32,116,101,120,116,117,114,101, 95, 98,108, +101,110,100, 95,108,105,110, 40,118,101, 99, 51, 32,118,101, 99, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, + 97,108, 41, 10,123, 10, 9,111,117,116,118, 97,108, 32, 61, 32, 40, 49, 46, 48, 43,118,101, 99, 46,120, 41, 47, 50, 46, 48, 59, + 10,125, 10, 10,118,111,105,100, 32,116,101,120,116,117,114,101, 95, 98,108,101,110,100, 95,113,117, 97,100, 40,118,101, 99, 51, + 32,118,101, 99, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, 10,123, 10, 9,111,117,116,118, 97, +108, 32, 61, 32,109, 97,120, 40, 40, 49, 46, 48, 43,118,101, 99, 46,120, 41, 47, 50, 46, 48, 44, 32, 48, 46, 48, 41, 59, 10, 9, +111,117,116,118, 97,108, 32, 42, 61, 32,111,117,116,118, 97,108, 59, 10,125, 10, 10,118,111,105,100, 32,116,101,120,116,117,114, +101, 95,119,111,111,100, 95,115,105,110, 40,118,101, 99, 51, 32,118,101, 99, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,118, + 97,108,117,101, 44, 32,111,117,116, 32,118,101, 99, 52, 32, 99,111,108,111,114, 44, 32,111,117,116, 32,118,101, 99, 51, 32,110, +111,114,109, 97,108, 41, 10,123, 10, 9,102,108,111, 97,116, 32, 97, 32, 61, 32,115,113,114,116, 40,118,101, 99, 46,120, 42,118, +101, 99, 46,120, 32, 43, 32,118,101, 99, 46,121, 42,118,101, 99, 46,121, 32, 43, 32,118,101, 99, 46,122, 42,118,101, 99, 46,122, + 41, 42, 50, 48, 46, 48, 59, 10, 9,102,108,111, 97,116, 32,119,105, 32, 61, 32, 48, 46, 53, 32, 43, 32, 48, 46, 53, 42,115,105, +110, 40, 97, 41, 59, 10, 10, 9,118, 97,108,117,101, 32, 61, 32,119,105, 59, 10, 9, 99,111,108,111,114, 32, 61, 32,118,101, 99, + 52, 40,119,105, 44, 32,119,105, 44, 32,119,105, 44, 32, 49, 46, 48, 41, 59, 10, 9,110,111,114,109, 97,108, 32, 61, 32,118,101, + 99, 51, 40, 48, 46, 48, 44, 32, 48, 46, 48, 44, 32, 48, 46, 48, 41, 59, 10,125, 10, 10,118,111,105,100, 32,116,101,120,116,117, +114,101, 95,105,109, 97,103,101, 40,118,101, 99, 51, 32,118,101, 99, 44, 32,115, 97,109,112,108,101,114, 50, 68, 32,105,109, 97, + 44, 32,111,117,116, 32,102,108,111, 97,116, 32,118, 97,108,117,101, 44, 32,111,117,116, 32,118,101, 99, 52, 32, 99,111,108,111, +114, 44, 32,111,117,116, 32,118,101, 99, 51, 32,110,111,114,109, 97,108, 41, 10,123, 10, 9, 99,111,108,111,114, 32, 61, 32,116, +101,120,116,117,114,101, 50, 68, 40,105,109, 97, 44, 32, 40,118,101, 99, 46,120,121, 32, 43, 32,118,101, 99, 50, 40, 49, 46, 48, + 44, 32, 49, 46, 48, 41, 41, 42, 48, 46, 53, 41, 59, 10, 9,118, 97,108,117,101, 32, 61, 32, 49, 46, 48, 59, 10, 10, 9,110,111, +114,109, 97,108, 46,120, 32, 61, 32, 50, 46, 48, 42, 40, 99,111,108,111,114, 46,114, 32, 45, 32, 48, 46, 53, 41, 59, 10, 9,110, +111,114,109, 97,108, 46,121, 32, 61, 32, 50, 46, 48, 42, 40, 48, 46, 53, 32, 45, 32, 99,111,108,111,114, 46,103, 41, 59, 10, 9, +110,111,114,109, 97,108, 46,122, 32, 61, 32, 50, 46, 48, 42, 40, 99,111,108,111,114, 46, 98, 32, 45, 32, 48, 46, 53, 41, 59, 10, +125, 10, 10, 47, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 32, 77, 84, 69, 88, 32, 42, 42, 42, 42, 42, 42, 42, 42, 42, + 42, 42, 42, 42, 42, 42, 42, 42, 47, 10, 10,118,111,105,100, 32,116,101,120, 99,111, 95,111,114, 99,111, 40,118,101, 99, 51, 32, + 97,116,116,111,114, 99,111, 44, 32,111,117,116, 32,118,101, 99, 51, 32,111,114, 99,111, 41, 10,123, 10, 9,111,114, 99,111, 32, + 61, 32, 97,116,116,111,114, 99,111, 59, 10,125, 10, 10,118,111,105,100, 32,116,101,120, 99,111, 95,117,118, 40,118,101, 99, 50, + 32, 97,116,116,117,118, 44, 32,111,117,116, 32,118,101, 99, 51, 32,117,118, 41, 10,123, 10, 9, 47, 42, 32,100,105,115, 97, 98, +108,101,100, 32,102,111,114, 32,110,111,119, 44, 32,119,111,114,107,115, 32,116,111,103,101,116,104,101,114, 32,119,105,116,104, + 32,108,101, 97,118,105,110,103, 32,111,117,116, 32,109,116,101,120, 95, 50,100, 95,109, 97,112,112,105,110,103, 10, 9, 32, 32, + 32,117,118, 32, 61, 32,118,101, 99, 51, 40, 97,116,116,117,118, 42, 50, 46, 48, 32, 45, 32,118,101, 99, 50, 40, 49, 46, 48, 44, + 32, 49, 46, 48, 41, 44, 32, 48, 46, 48, 41, 59, 32, 42, 47, 10, 9,117,118, 32, 61, 32,118,101, 99, 51, 40, 97,116,116,117,118, + 44, 32, 48, 46, 48, 41, 59, 10,125, 10, 10,118,111,105,100, 32,116,101,120, 99,111, 95,110,111,114,109, 40,118,101, 99, 51, 32, +110,111,114,109, 97,108, 44, 32,111,117,116, 32,118,101, 99, 51, 32,111,117,116,110,111,114,109, 97,108, 41, 10,123, 10, 9, 47, + 42, 32, 99,111,114,114,101,115,112,111,110,100,115, 32,116,111, 32,115,104,105, 45, 62,111,114,110, 44, 32,119,104,105, 99,104, + 32,105,115, 32,110,101,103, 97,116,101,100, 32,115,111, 32, 99, 97,110, 99,101,108,115, 10, 9, 32, 32, 32,111,117,116, 32, 98, +108,101,110,100,101,114, 32,110,111,114,109, 97,108, 32,110,101,103, 97,116,105,111,110, 32, 42, 47, 10, 9,111,117,116,110,111, +114,109, 97,108, 32, 61, 32,110,111,114,109, 97,108,105,122,101, 40,110,111,114,109, 97,108, 41, 59, 10,125, 10, 10,118,111,105, +100, 32,116,101,120, 99,111, 95,116, 97,110,103,101,110,116, 40,118,101, 99, 51, 32,116, 97,110,103,101,110,116, 44, 32,111,117, +116, 32,118,101, 99, 51, 32,111,117,116,116, 97,110,103,101,110,116, 41, 10,123, 10, 9,111,117,116,116, 97,110,103,101,110,116, + 32, 61, 32,110,111,114,109, 97,108,105,122,101, 40,116, 97,110,103,101,110,116, 41, 59, 10,125, 10, 10,118,111,105,100, 32,116, +101,120, 99,111, 95,103,108,111, 98, 97,108, 40,109, 97,116, 52, 32,118,105,101,119,105,110,118,109, 97,116, 44, 32,118,101, 99, + 51, 32, 99,111, 44, 32,111,117,116, 32,118,101, 99, 51, 32,103,108,111, 98, 97,108, 41, 10,123, 10, 9,103,108,111, 98, 97,108, + 32, 61, 32, 40,118,105,101,119,105,110,118,109, 97,116, 42,118,101, 99, 52, 40, 99,111, 44, 32, 49, 46, 48, 41, 41, 46,120,121, +122, 59, 10,125, 10, 10,118,111,105,100, 32,116,101,120, 99,111, 95,111, 98,106,101, 99,116, 40,109, 97,116, 52, 32,118,105,101, +119,105,110,118,109, 97,116, 44, 32,109, 97,116, 52, 32,111, 98,105,110,118,109, 97,116, 44, 32,118,101, 99, 51, 32, 99,111, 44, + 32,111,117,116, 32,118,101, 99, 51, 32,111, 98,106,101, 99,116, 41, 10,123, 10, 9,111, 98,106,101, 99,116, 32, 61, 32, 40,111, + 98,105,110,118,109, 97,116, 42, 40,118,105,101,119,105,110,118,109, 97,116, 42,118,101, 99, 52, 40, 99,111, 44, 32, 49, 46, 48, + 41, 41, 41, 46,120,121,122, 59, 10,125, 10, 10,118,111,105,100, 32,116,101,120, 99,111, 95,114,101,102,108, 40,118,101, 99, 51, + 32,118,110, 44, 32,118,101, 99, 51, 32,118,105,101,119, 44, 32,111,117,116, 32,118,101, 99, 51, 32,114,101,102, 41, 10,123, 10, + 9,114,101,102, 32, 61, 32,118,105,101,119, 32, 45, 32, 50, 46, 48, 42,100,111,116, 40,118,110, 44, 32,118,105,101,119, 41, 42, +118,110, 59, 10,125, 10, 10,118,111,105,100, 32,115,104, 97,100,101, 95,110,111,114,109, 40,118,101, 99, 51, 32,110,111,114,109, + 97,108, 44, 32,111,117,116, 32,118,101, 99, 51, 32,111,117,116,110,111,114,109, 97,108, 41, 10,123, 10, 9, 47, 42, 32, 98,108, +101,110,100,101,114, 32,114,101,110,100,101,114, 32,110,111,114,109, 97,108, 32,105,115, 32,110,101,103, 97,116,101,100, 32, 42, + 47, 10, 9,111,117,116,110,111,114,109, 97,108, 32, 61, 32, 45,110,111,114,109, 97,108,105,122,101, 40,110,111,114,109, 97,108, + 41, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95,114,103, 98, 95, 98,108,101,110,100, 40,118,101, 99, 51, 32,111, +117,116, 99,111,108, 44, 32,118,101, 99, 51, 32,116,101,120, 99,111,108, 44, 32,102,108,111, 97,116, 32,102, 97, 99,116, 44, 32, +102,108,111, 97,116, 32,102, 97, 99,103, 44, 32,111,117,116, 32,118,101, 99, 51, 32,105,110, 99,111,108, 41, 10,123, 10, 9,102, +108,111, 97,116, 32,102, 97, 99,109, 59, 10, 10, 9,102, 97, 99,116, 32, 42, 61, 32,102, 97, 99,103, 59, 10, 9,102, 97, 99,109, + 32, 61, 32, 49, 46, 48, 45,102, 97, 99,116, 59, 10, 10, 9,105,110, 99,111,108, 32, 61, 32,102, 97, 99,116, 42,116,101,120, 99, +111,108, 32, 43, 32,102, 97, 99,109, 42,111,117,116, 99,111,108, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95,114, +103, 98, 95,109,117,108, 40,118,101, 99, 51, 32,111,117,116, 99,111,108, 44, 32,118,101, 99, 51, 32,116,101,120, 99,111,108, 44, + 32,102,108,111, 97,116, 32,102, 97, 99,116, 44, 32,102,108,111, 97,116, 32,102, 97, 99,103, 44, 32,111,117,116, 32,118,101, 99, + 51, 32,105,110, 99,111,108, 41, 10,123, 10, 9,102,108,111, 97,116, 32,102, 97, 99,109, 59, 10, 10, 9,102, 97, 99,116, 32, 42, + 61, 32,102, 97, 99,103, 59, 10, 9,102, 97, 99,109, 32, 61, 32, 49, 46, 48, 45,102, 97, 99,103, 59, 10, 10, 9,105,110, 99,111, +108, 32, 61, 32, 40,102, 97, 99,109, 32, 43, 32,102, 97, 99,116, 42,116,101,120, 99,111,108, 41, 42,111,117,116, 99,111,108, 59, + 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95,114,103, 98, 95,115, 99,114,101,101,110, 40,118,101, 99, 51, 32,111,117, +116, 99,111,108, 44, 32,118,101, 99, 51, 32,116,101,120, 99,111,108, 44, 32,102,108,111, 97,116, 32,102, 97, 99,116, 44, 32,102, +108,111, 97,116, 32,102, 97, 99,103, 44, 32,111,117,116, 32,118,101, 99, 51, 32,105,110, 99,111,108, 41, 10,123, 10, 9,102,108, +111, 97,116, 32,102, 97, 99,109, 59, 10, 10, 9,102, 97, 99,116, 32, 42, 61, 32,102, 97, 99,103, 59, 10, 9,102, 97, 99,109, 32, + 61, 32, 49, 46, 48, 45,102, 97, 99,103, 59, 10, 10, 9,105,110, 99,111,108, 32, 61, 32,118,101, 99, 51, 40, 49, 46, 48, 41, 32, + 45, 32, 40,118,101, 99, 51, 40,102, 97, 99,109, 41, 32, 43, 32,102, 97, 99,116, 42, 40,118,101, 99, 51, 40, 49, 46, 48, 41, 32, + 45, 32,116,101,120, 99,111,108, 41, 41, 42, 40,118,101, 99, 51, 40, 49, 46, 48, 41, 32, 45, 32,111,117,116, 99,111,108, 41, 59, + 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95,114,103, 98, 95,111,118,101,114,108, 97,121, 40,118,101, 99, 51, 32,111, +117,116, 99,111,108, 44, 32,118,101, 99, 51, 32,116,101,120, 99,111,108, 44, 32,102,108,111, 97,116, 32,102, 97, 99,116, 44, 32, +102,108,111, 97,116, 32,102, 97, 99,103, 44, 32,111,117,116, 32,118,101, 99, 51, 32,105,110, 99,111,108, 41, 10,123, 10, 9,102, +108,111, 97,116, 32,102, 97, 99,109, 59, 10, 10, 9,102, 97, 99,116, 32, 42, 61, 32,102, 97, 99,103, 59, 10, 9,102, 97, 99,109, + 32, 61, 32, 49, 46, 48, 45,102, 97, 99,103, 59, 10, 10, 9,105,102, 40,111,117,116, 99,111,108, 46,114, 32, 60, 32, 48, 46, 53, + 41, 10, 9, 9,105,110, 99,111,108, 46,114, 32, 61, 32,111,117,116, 99,111,108, 46,114, 42, 40,102, 97, 99,109, 32, 43, 32, 50, + 46, 48, 42,102, 97, 99,116, 42,116,101,120, 99,111,108, 46,114, 41, 59, 10, 9,101,108,115,101, 10, 9, 9,105,110, 99,111,108, + 46,114, 32, 61, 32, 49, 46, 48, 32, 45, 32, 40,102, 97, 99,109, 32, 43, 32, 50, 46, 48, 42,102, 97, 99,116, 42, 40, 49, 46, 48, + 32, 45, 32,116,101,120, 99,111,108, 46,114, 41, 41, 42, 40, 49, 46, 48, 32, 45, 32,111,117,116, 99,111,108, 46,114, 41, 59, 10, + 10, 9,105,102, 40,111,117,116, 99,111,108, 46,103, 32, 60, 32, 48, 46, 53, 41, 10, 9, 9,105,110, 99,111,108, 46,103, 32, 61, + 32,111,117,116, 99,111,108, 46,103, 42, 40,102, 97, 99,109, 32, 43, 32, 50, 46, 48, 42,102, 97, 99,116, 42,116,101,120, 99,111, +108, 46,103, 41, 59, 10, 9,101,108,115,101, 10, 9, 9,105,110, 99,111,108, 46,103, 32, 61, 32, 49, 46, 48, 32, 45, 32, 40,102, + 97, 99,109, 32, 43, 32, 50, 46, 48, 42,102, 97, 99,116, 42, 40, 49, 46, 48, 32, 45, 32,116,101,120, 99,111,108, 46,103, 41, 41, + 42, 40, 49, 46, 48, 32, 45, 32,111,117,116, 99,111,108, 46,103, 41, 59, 10, 10, 9,105,102, 40,111,117,116, 99,111,108, 46, 98, + 32, 60, 32, 48, 46, 53, 41, 10, 9, 9,105,110, 99,111,108, 46, 98, 32, 61, 32,111,117,116, 99,111,108, 46, 98, 42, 40,102, 97, + 99,109, 32, 43, 32, 50, 46, 48, 42,102, 97, 99,116, 42,116,101,120, 99,111,108, 46, 98, 41, 59, 10, 9,101,108,115,101, 10, 9, + 9,105,110, 99,111,108, 46, 98, 32, 61, 32, 49, 46, 48, 32, 45, 32, 40,102, 97, 99,109, 32, 43, 32, 50, 46, 48, 42,102, 97, 99, +116, 42, 40, 49, 46, 48, 32, 45, 32,116,101,120, 99,111,108, 46, 98, 41, 41, 42, 40, 49, 46, 48, 32, 45, 32,111,117,116, 99,111, +108, 46, 98, 41, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95,114,103, 98, 95,115,117, 98, 40,118,101, 99, 51, 32, +111,117,116, 99,111,108, 44, 32,118,101, 99, 51, 32,116,101,120, 99,111,108, 44, 32,102,108,111, 97,116, 32,102, 97, 99,116, 44, + 32,102,108,111, 97,116, 32,102, 97, 99,103, 44, 32,111,117,116, 32,118,101, 99, 51, 32,105,110, 99,111,108, 41, 10,123, 10, 9, +105,110, 99,111,108, 32, 61, 32, 45,102, 97, 99,116, 42,102, 97, 99,103, 42,116,101,120, 99,111,108, 32, 43, 32,111,117,116, 99, +111,108, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95,114,103, 98, 95, 97,100,100, 40,118,101, 99, 51, 32,111,117, +116, 99,111,108, 44, 32,118,101, 99, 51, 32,116,101,120, 99,111,108, 44, 32,102,108,111, 97,116, 32,102, 97, 99,116, 44, 32,102, +108,111, 97,116, 32,102, 97, 99,103, 44, 32,111,117,116, 32,118,101, 99, 51, 32,105,110, 99,111,108, 41, 10,123, 10, 9,105,110, + 99,111,108, 32, 61, 32,102, 97, 99,116, 42,102, 97, 99,103, 42,116,101,120, 99,111,108, 32, 43, 32,111,117,116, 99,111,108, 59, + 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95,114,103, 98, 95,100,105,118, 40,118,101, 99, 51, 32,111,117,116, 99,111, +108, 44, 32,118,101, 99, 51, 32,116,101,120, 99,111,108, 44, 32,102,108,111, 97,116, 32,102, 97, 99,116, 44, 32,102,108,111, 97, +116, 32,102, 97, 99,103, 44, 32,111,117,116, 32,118,101, 99, 51, 32,105,110, 99,111,108, 41, 10,123, 10, 9,102,108,111, 97,116, + 32,102, 97, 99,109, 59, 10, 10, 9,102, 97, 99,116, 32, 42, 61, 32,102, 97, 99,103, 59, 10, 9,102, 97, 99,109, 32, 61, 32, 49, + 46, 48, 45,102, 97, 99,116, 59, 10, 10, 9,105,102, 40,116,101,120, 99,111,108, 46,114, 32, 33, 61, 32, 48, 46, 48, 41, 32,105, +110, 99,111,108, 46,114, 32, 61, 32,102, 97, 99,109, 42,111,117,116, 99,111,108, 46,114, 32, 43, 32,102, 97, 99,116, 42,111,117, +116, 99,111,108, 46,114, 47,116,101,120, 99,111,108, 46,114, 59, 10, 9,105,102, 40,116,101,120, 99,111,108, 46,103, 32, 33, 61, + 32, 48, 46, 48, 41, 32,105,110, 99,111,108, 46,103, 32, 61, 32,102, 97, 99,109, 42,111,117,116, 99,111,108, 46,103, 32, 43, 32, +102, 97, 99,116, 42,111,117,116, 99,111,108, 46,103, 47,116,101,120, 99,111,108, 46,103, 59, 10, 9,105,102, 40,116,101,120, 99, +111,108, 46, 98, 32, 33, 61, 32, 48, 46, 48, 41, 32,105,110, 99,111,108, 46, 98, 32, 61, 32,102, 97, 99,109, 42,111,117,116, 99, +111,108, 46, 98, 32, 43, 32,102, 97, 99,116, 42,111,117,116, 99,111,108, 46, 98, 47,116,101,120, 99,111,108, 46, 98, 59, 10,125, + 10, 10,118,111,105,100, 32,109,116,101,120, 95,114,103, 98, 95,100,105,102,102, 40,118,101, 99, 51, 32,111,117,116, 99,111,108, 44, 32,118,101, 99, 51, 32,116,101,120, 99,111,108, 44, 32,102,108,111, 97,116, 32,102, 97, 99,116, 44, 32,102,108,111, 97,116, 32,102, 97, 99,103, 44, 32,111,117,116, 32,118,101, 99, 51, 32,105,110, 99,111,108, 41, 10,123, 10, 9,102,108,111, 97,116, 32, 102, 97, 99,109, 59, 10, 10, 9,102, 97, 99,116, 32, 42, 61, 32,102, 97, 99,103, 59, 10, 9,102, 97, 99,109, 32, 61, 32, 49, 46, - 48, 45,102, 97, 99,103, 59, 10, 10, 9,105,102, 40,111,117,116, 99,111,108, 46,114, 32, 60, 32, 48, 46, 53, 41, 10, 9, 9,105, -110, 99,111,108, 46,114, 32, 61, 32,111,117,116, 99,111,108, 46,114, 42, 40,102, 97, 99,109, 32, 43, 32, 50, 46, 48, 42,102, 97, - 99,116, 42,116,101,120, 99,111,108, 46,114, 41, 59, 10, 9,101,108,115,101, 10, 9, 9,105,110, 99,111,108, 46,114, 32, 61, 32, - 49, 46, 48, 32, 45, 32, 40,102, 97, 99,109, 32, 43, 32, 50, 46, 48, 42,102, 97, 99,116, 42, 40, 49, 46, 48, 32, 45, 32,116,101, -120, 99,111,108, 46,114, 41, 41, 42, 40, 49, 46, 48, 32, 45, 32,111,117,116, 99,111,108, 46,114, 41, 59, 10, 10, 9,105,102, 40, -111,117,116, 99,111,108, 46,103, 32, 60, 32, 48, 46, 53, 41, 10, 9, 9,105,110, 99,111,108, 46,103, 32, 61, 32,111,117,116, 99, -111,108, 46,103, 42, 40,102, 97, 99,109, 32, 43, 32, 50, 46, 48, 42,102, 97, 99,116, 42,116,101,120, 99,111,108, 46,103, 41, 59, - 10, 9,101,108,115,101, 10, 9, 9,105,110, 99,111,108, 46,103, 32, 61, 32, 49, 46, 48, 32, 45, 32, 40,102, 97, 99,109, 32, 43, - 32, 50, 46, 48, 42,102, 97, 99,116, 42, 40, 49, 46, 48, 32, 45, 32,116,101,120, 99,111,108, 46,103, 41, 41, 42, 40, 49, 46, 48, - 32, 45, 32,111,117,116, 99,111,108, 46,103, 41, 59, 10, 10, 9,105,102, 40,111,117,116, 99,111,108, 46, 98, 32, 60, 32, 48, 46, - 53, 41, 10, 9, 9,105,110, 99,111,108, 46, 98, 32, 61, 32,111,117,116, 99,111,108, 46, 98, 42, 40,102, 97, 99,109, 32, 43, 32, - 50, 46, 48, 42,102, 97, 99,116, 42,116,101,120, 99,111,108, 46, 98, 41, 59, 10, 9,101,108,115,101, 10, 9, 9,105,110, 99,111, -108, 46, 98, 32, 61, 32, 49, 46, 48, 32, 45, 32, 40,102, 97, 99,109, 32, 43, 32, 50, 46, 48, 42,102, 97, 99,116, 42, 40, 49, 46, - 48, 32, 45, 32,116,101,120, 99,111,108, 46, 98, 41, 41, 42, 40, 49, 46, 48, 32, 45, 32,111,117,116, 99,111,108, 46, 98, 41, 59, - 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95,114,103, 98, 95,115,117, 98, 40,118,101, 99, 51, 32,111,117,116, 99,111, -108, 44, 32,118,101, 99, 51, 32,116,101,120, 99,111,108, 44, 32,102,108,111, 97,116, 32,102, 97, 99,116, 44, 32,102,108,111, 97, -116, 32,102, 97, 99,103, 44, 32,111,117,116, 32,118,101, 99, 51, 32,105,110, 99,111,108, 41, 10,123, 10, 9,105,110, 99,111,108, - 32, 61, 32, 45,102, 97, 99,116, 42,102, 97, 99,103, 42,116,101,120, 99,111,108, 32, 43, 32,111,117,116, 99,111,108, 59, 10,125, - 10, 10,118,111,105,100, 32,109,116,101,120, 95,114,103, 98, 95, 97,100,100, 40,118,101, 99, 51, 32,111,117,116, 99,111,108, 44, - 32,118,101, 99, 51, 32,116,101,120, 99,111,108, 44, 32,102,108,111, 97,116, 32,102, 97, 99,116, 44, 32,102,108,111, 97,116, 32, -102, 97, 99,103, 44, 32,111,117,116, 32,118,101, 99, 51, 32,105,110, 99,111,108, 41, 10,123, 10, 9,105,110, 99,111,108, 32, 61, - 32,102, 97, 99,116, 42,102, 97, 99,103, 42,116,101,120, 99,111,108, 32, 43, 32,111,117,116, 99,111,108, 59, 10,125, 10, 10,118, -111,105,100, 32,109,116,101,120, 95,114,103, 98, 95,100,105,118, 40,118,101, 99, 51, 32,111,117,116, 99,111,108, 44, 32,118,101, + 48, 45,102, 97, 99,116, 59, 10, 10, 9,105,110, 99,111,108, 32, 61, 32,102, 97, 99,109, 42,111,117,116, 99,111,108, 32, 43, 32, +102, 97, 99,116, 42, 97, 98,115, 40,116,101,120, 99,111,108, 32, 45, 32,111,117,116, 99,111,108, 41, 59, 10,125, 10, 10,118,111, +105,100, 32,109,116,101,120, 95,114,103, 98, 95,100, 97,114,107, 40,118,101, 99, 51, 32,111,117,116, 99,111,108, 44, 32,118,101, 99, 51, 32,116,101,120, 99,111,108, 44, 32,102,108,111, 97,116, 32,102, 97, 99,116, 44, 32,102,108,111, 97,116, 32,102, 97, 99, 103, 44, 32,111,117,116, 32,118,101, 99, 51, 32,105,110, 99,111,108, 41, 10,123, 10, 9,102,108,111, 97,116, 32,102, 97, 99,109, - 59, 10, 10, 9,102, 97, 99,116, 32, 42, 61, 32,102, 97, 99,103, 59, 10, 9,102, 97, 99,109, 32, 61, 32, 49, 46, 48, 45,102, 97, - 99,116, 59, 10, 10, 9,105,102, 40,116,101,120, 99,111,108, 46,114, 32, 33, 61, 32, 48, 46, 48, 41, 32,105,110, 99,111,108, 46, -114, 32, 61, 32,102, 97, 99,109, 42,111,117,116, 99,111,108, 46,114, 32, 43, 32,102, 97, 99,116, 42,111,117,116, 99,111,108, 46, -114, 47,116,101,120, 99,111,108, 46,114, 59, 10, 9,105,102, 40,116,101,120, 99,111,108, 46,103, 32, 33, 61, 32, 48, 46, 48, 41, - 32,105,110, 99,111,108, 46,103, 32, 61, 32,102, 97, 99,109, 42,111,117,116, 99,111,108, 46,103, 32, 43, 32,102, 97, 99,116, 42, -111,117,116, 99,111,108, 46,103, 47,116,101,120, 99,111,108, 46,103, 59, 10, 9,105,102, 40,116,101,120, 99,111,108, 46, 98, 32, - 33, 61, 32, 48, 46, 48, 41, 32,105,110, 99,111,108, 46, 98, 32, 61, 32,102, 97, 99,109, 42,111,117,116, 99,111,108, 46, 98, 32, - 43, 32,102, 97, 99,116, 42,111,117,116, 99,111,108, 46, 98, 47,116,101,120, 99,111,108, 46, 98, 59, 10,125, 10, 10,118,111,105, -100, 32,109,116,101,120, 95,114,103, 98, 95,100,105,102,102, 40,118,101, 99, 51, 32,111,117,116, 99,111,108, 44, 32,118,101, 99, - 51, 32,116,101,120, 99,111,108, 44, 32,102,108,111, 97,116, 32,102, 97, 99,116, 44, 32,102,108,111, 97,116, 32,102, 97, 99,103, - 44, 32,111,117,116, 32,118,101, 99, 51, 32,105,110, 99,111,108, 41, 10,123, 10, 9,102,108,111, 97,116, 32,102, 97, 99,109, 59, - 10, 10, 9,102, 97, 99,116, 32, 42, 61, 32,102, 97, 99,103, 59, 10, 9,102, 97, 99,109, 32, 61, 32, 49, 46, 48, 45,102, 97, 99, -116, 59, 10, 10, 9,105,110, 99,111,108, 32, 61, 32,102, 97, 99,109, 42,111,117,116, 99,111,108, 32, 43, 32,102, 97, 99,116, 42, - 97, 98,115, 40,116,101,120, 99,111,108, 32, 45, 32,111,117,116, 99,111,108, 41, 59, 10,125, 10, 10,118,111,105,100, 32,109,116, -101,120, 95,114,103, 98, 95,100, 97,114,107, 40,118,101, 99, 51, 32,111,117,116, 99,111,108, 44, 32,118,101, 99, 51, 32,116,101, -120, 99,111,108, 44, 32,102,108,111, 97,116, 32,102, 97, 99,116, 44, 32,102,108,111, 97,116, 32,102, 97, 99,103, 44, 32,111,117, -116, 32,118,101, 99, 51, 32,105,110, 99,111,108, 41, 10,123, 10, 9,102,108,111, 97,116, 32,102, 97, 99,109, 44, 32, 99,111,108, - 59, 10, 10, 9,102, 97, 99,116, 32, 42, 61, 32,102, 97, 99,103, 59, 10, 9,102, 97, 99,109, 32, 61, 32, 49, 46, 48, 45,102, 97, - 99,116, 59, 10, 10, 9, 99,111,108, 32, 61, 32,102, 97, 99,116, 42,116,101,120, 99,111,108, 46,114, 59, 10, 9,105,102, 40, 99, -111,108, 32, 60, 32,111,117,116, 99,111,108, 46,114, 41, 32,105,110, 99,111,108, 46,114, 32, 61, 32, 99,111,108, 59, 32,101,108, -115,101, 32,105,110, 99,111,108, 46,114, 32, 61, 32,111,117,116, 99,111,108, 46,114, 59, 10, 9, 99,111,108, 32, 61, 32,102, 97, - 99,116, 42,116,101,120, 99,111,108, 46,103, 59, 10, 9,105,102, 40, 99,111,108, 32, 60, 32,111,117,116, 99,111,108, 46,103, 41, - 32,105,110, 99,111,108, 46,103, 32, 61, 32, 99,111,108, 59, 32,101,108,115,101, 32,105,110, 99,111,108, 46,103, 32, 61, 32,111, -117,116, 99,111,108, 46,103, 59, 10, 9, 99,111,108, 32, 61, 32,102, 97, 99,116, 42,116,101,120, 99,111,108, 46, 98, 59, 10, 9, -105,102, 40, 99,111,108, 32, 60, 32,111,117,116, 99,111,108, 46, 98, 41, 32,105,110, 99,111,108, 46, 98, 32, 61, 32, 99,111,108, - 59, 32,101,108,115,101, 32,105,110, 99,111,108, 46, 98, 32, 61, 32,111,117,116, 99,111,108, 46, 98, 59, 10,125, 10, 10,118,111, -105,100, 32,109,116,101,120, 95,114,103, 98, 95,108,105,103,104,116, 40,118,101, 99, 51, 32,111,117,116, 99,111,108, 44, 32,118, -101, 99, 51, 32,116,101,120, 99,111,108, 44, 32,102,108,111, 97,116, 32,102, 97, 99,116, 44, 32,102,108,111, 97,116, 32,102, 97, - 99,103, 44, 32,111,117,116, 32,118,101, 99, 51, 32,105,110, 99,111,108, 41, 10,123, 10, 9,102,108,111, 97,116, 32,102, 97, 99, -109, 44, 32, 99,111,108, 59, 10, 10, 9,102, 97, 99,116, 32, 42, 61, 32,102, 97, 99,103, 59, 10, 9,102, 97, 99,109, 32, 61, 32, - 49, 46, 48, 45,102, 97, 99,116, 59, 10, 10, 9, 99,111,108, 32, 61, 32,102, 97, 99,116, 42,116,101,120, 99,111,108, 46,114, 59, - 10, 9,105,102, 40, 99,111,108, 32, 62, 32,111,117,116, 99,111,108, 46,114, 41, 32,105,110, 99,111,108, 46,114, 32, 61, 32, 99, -111,108, 59, 32,101,108,115,101, 32,105,110, 99,111,108, 46,114, 32, 61, 32,111,117,116, 99,111,108, 46,114, 59, 10, 9, 99,111, -108, 32, 61, 32,102, 97, 99,116, 42,116,101,120, 99,111,108, 46,103, 59, 10, 9,105,102, 40, 99,111,108, 32, 62, 32,111,117,116, - 99,111,108, 46,103, 41, 32,105,110, 99,111,108, 46,103, 32, 61, 32, 99,111,108, 59, 32,101,108,115,101, 32,105,110, 99,111,108, - 46,103, 32, 61, 32,111,117,116, 99,111,108, 46,103, 59, 10, 9, 99,111,108, 32, 61, 32,102, 97, 99,116, 42,116,101,120, 99,111, -108, 46, 98, 59, 10, 9,105,102, 40, 99,111,108, 32, 62, 32,111,117,116, 99,111,108, 46, 98, 41, 32,105,110, 99,111,108, 46, 98, - 32, 61, 32, 99,111,108, 59, 32,101,108,115,101, 32,105,110, 99,111,108, 46, 98, 32, 61, 32,111,117,116, 99,111,108, 46, 98, 59, - 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95,114,103, 98, 95,104,117,101, 40,118,101, 99, 51, 32,111,117,116, 99,111, + 44, 32, 99,111,108, 59, 10, 10, 9,102, 97, 99,116, 32, 42, 61, 32,102, 97, 99,103, 59, 10, 9,102, 97, 99,109, 32, 61, 32, 49, + 46, 48, 45,102, 97, 99,116, 59, 10, 10, 9, 99,111,108, 32, 61, 32,102, 97, 99,116, 42,116,101,120, 99,111,108, 46,114, 59, 10, + 9,105,102, 40, 99,111,108, 32, 60, 32,111,117,116, 99,111,108, 46,114, 41, 32,105,110, 99,111,108, 46,114, 32, 61, 32, 99,111, +108, 59, 32,101,108,115,101, 32,105,110, 99,111,108, 46,114, 32, 61, 32,111,117,116, 99,111,108, 46,114, 59, 10, 9, 99,111,108, + 32, 61, 32,102, 97, 99,116, 42,116,101,120, 99,111,108, 46,103, 59, 10, 9,105,102, 40, 99,111,108, 32, 60, 32,111,117,116, 99, +111,108, 46,103, 41, 32,105,110, 99,111,108, 46,103, 32, 61, 32, 99,111,108, 59, 32,101,108,115,101, 32,105,110, 99,111,108, 46, +103, 32, 61, 32,111,117,116, 99,111,108, 46,103, 59, 10, 9, 99,111,108, 32, 61, 32,102, 97, 99,116, 42,116,101,120, 99,111,108, + 46, 98, 59, 10, 9,105,102, 40, 99,111,108, 32, 60, 32,111,117,116, 99,111,108, 46, 98, 41, 32,105,110, 99,111,108, 46, 98, 32, + 61, 32, 99,111,108, 59, 32,101,108,115,101, 32,105,110, 99,111,108, 46, 98, 32, 61, 32,111,117,116, 99,111,108, 46, 98, 59, 10, +125, 10, 10,118,111,105,100, 32,109,116,101,120, 95,114,103, 98, 95,108,105,103,104,116, 40,118,101, 99, 51, 32,111,117,116, 99, +111,108, 44, 32,118,101, 99, 51, 32,116,101,120, 99,111,108, 44, 32,102,108,111, 97,116, 32,102, 97, 99,116, 44, 32,102,108,111, + 97,116, 32,102, 97, 99,103, 44, 32,111,117,116, 32,118,101, 99, 51, 32,105,110, 99,111,108, 41, 10,123, 10, 9,102,108,111, 97, +116, 32,102, 97, 99,109, 44, 32, 99,111,108, 59, 10, 10, 9,102, 97, 99,116, 32, 42, 61, 32,102, 97, 99,103, 59, 10, 9,102, 97, + 99,109, 32, 61, 32, 49, 46, 48, 45,102, 97, 99,116, 59, 10, 10, 9, 99,111,108, 32, 61, 32,102, 97, 99,116, 42,116,101,120, 99, +111,108, 46,114, 59, 10, 9,105,102, 40, 99,111,108, 32, 62, 32,111,117,116, 99,111,108, 46,114, 41, 32,105,110, 99,111,108, 46, +114, 32, 61, 32, 99,111,108, 59, 32,101,108,115,101, 32,105,110, 99,111,108, 46,114, 32, 61, 32,111,117,116, 99,111,108, 46,114, + 59, 10, 9, 99,111,108, 32, 61, 32,102, 97, 99,116, 42,116,101,120, 99,111,108, 46,103, 59, 10, 9,105,102, 40, 99,111,108, 32, + 62, 32,111,117,116, 99,111,108, 46,103, 41, 32,105,110, 99,111,108, 46,103, 32, 61, 32, 99,111,108, 59, 32,101,108,115,101, 32, +105,110, 99,111,108, 46,103, 32, 61, 32,111,117,116, 99,111,108, 46,103, 59, 10, 9, 99,111,108, 32, 61, 32,102, 97, 99,116, 42, +116,101,120, 99,111,108, 46, 98, 59, 10, 9,105,102, 40, 99,111,108, 32, 62, 32,111,117,116, 99,111,108, 46, 98, 41, 32,105,110, + 99,111,108, 46, 98, 32, 61, 32, 99,111,108, 59, 32,101,108,115,101, 32,105,110, 99,111,108, 46, 98, 32, 61, 32,111,117,116, 99, +111,108, 46, 98, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95,114,103, 98, 95,104,117,101, 40,118,101, 99, 51, 32, +111,117,116, 99,111,108, 44, 32,118,101, 99, 51, 32,116,101,120, 99,111,108, 44, 32,102,108,111, 97,116, 32,102, 97, 99,116, 44, + 32,102,108,111, 97,116, 32,102, 97, 99,103, 44, 32,111,117,116, 32,118,101, 99, 51, 32,105,110, 99,111,108, 41, 10,123, 10, 9, +118,101, 99, 52, 32, 99,111,108, 59, 10, 10, 9,109,105,120, 95,104,117,101, 40,102, 97, 99,116, 42,102, 97, 99,103, 44, 32,118, +101, 99, 52, 40,111,117,116, 99,111,108, 44, 32, 49, 46, 48, 41, 44, 32,118,101, 99, 52, 40,116,101,120, 99,111,108, 44, 32, 49, + 46, 48, 41, 44, 32, 99,111,108, 41, 59, 10, 9,105,110, 99,111,108, 46,114,103, 98, 32, 61, 32, 99,111,108, 46,114,103, 98, 59, + 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95,114,103, 98, 95,115, 97,116, 40,118,101, 99, 51, 32,111,117,116, 99,111, 108, 44, 32,118,101, 99, 51, 32,116,101,120, 99,111,108, 44, 32,102,108,111, 97,116, 32,102, 97, 99,116, 44, 32,102,108,111, 97, 116, 32,102, 97, 99,103, 44, 32,111,117,116, 32,118,101, 99, 51, 32,105,110, 99,111,108, 41, 10,123, 10, 9,118,101, 99, 52, 32, - 99,111,108, 59, 10, 10, 9,109,105,120, 95,104,117,101, 40,102, 97, 99,116, 42,102, 97, 99,103, 44, 32,118,101, 99, 52, 40,111, + 99,111,108, 59, 10, 10, 9,109,105,120, 95,115, 97,116, 40,102, 97, 99,116, 42,102, 97, 99,103, 44, 32,118,101, 99, 52, 40,111, 117,116, 99,111,108, 44, 32, 49, 46, 48, 41, 44, 32,118,101, 99, 52, 40,116,101,120, 99,111,108, 44, 32, 49, 46, 48, 41, 44, 32, 99,111,108, 41, 59, 10, 9,105,110, 99,111,108, 46,114,103, 98, 32, 61, 32, 99,111,108, 46,114,103, 98, 59, 10,125, 10, 10,118, -111,105,100, 32,109,116,101,120, 95,114,103, 98, 95,115, 97,116, 40,118,101, 99, 51, 32,111,117,116, 99,111,108, 44, 32,118,101, +111,105,100, 32,109,116,101,120, 95,114,103, 98, 95,118, 97,108, 40,118,101, 99, 51, 32,111,117,116, 99,111,108, 44, 32,118,101, 99, 51, 32,116,101,120, 99,111,108, 44, 32,102,108,111, 97,116, 32,102, 97, 99,116, 44, 32,102,108,111, 97,116, 32,102, 97, 99, 103, 44, 32,111,117,116, 32,118,101, 99, 51, 32,105,110, 99,111,108, 41, 10,123, 10, 9,118,101, 99, 52, 32, 99,111,108, 59, 10, - 10, 9,109,105,120, 95,115, 97,116, 40,102, 97, 99,116, 42,102, 97, 99,103, 44, 32,118,101, 99, 52, 40,111,117,116, 99,111,108, + 10, 9,109,105,120, 95,118, 97,108, 40,102, 97, 99,116, 42,102, 97, 99,103, 44, 32,118,101, 99, 52, 40,111,117,116, 99,111,108, 44, 32, 49, 46, 48, 41, 44, 32,118,101, 99, 52, 40,116,101,120, 99,111,108, 44, 32, 49, 46, 48, 41, 44, 32, 99,111,108, 41, 59, 10, 9,105,110, 99,111,108, 46,114,103, 98, 32, 61, 32, 99,111,108, 46,114,103, 98, 59, 10,125, 10, 10,118,111,105,100, 32,109, -116,101,120, 95,114,103, 98, 95,118, 97,108, 40,118,101, 99, 51, 32,111,117,116, 99,111,108, 44, 32,118,101, 99, 51, 32,116,101, -120, 99,111,108, 44, 32,102,108,111, 97,116, 32,102, 97, 99,116, 44, 32,102,108,111, 97,116, 32,102, 97, 99,103, 44, 32,111,117, -116, 32,118,101, 99, 51, 32,105,110, 99,111,108, 41, 10,123, 10, 9,118,101, 99, 52, 32, 99,111,108, 59, 10, 10, 9,109,105,120, - 95,118, 97,108, 40,102, 97, 99,116, 42,102, 97, 99,103, 44, 32,118,101, 99, 52, 40,111,117,116, 99,111,108, 44, 32, 49, 46, 48, - 41, 44, 32,118,101, 99, 52, 40,116,101,120, 99,111,108, 44, 32, 49, 46, 48, 41, 44, 32, 99,111,108, 41, 59, 10, 9,105,110, 99, -111,108, 46,114,103, 98, 32, 61, 32, 99,111,108, 46,114,103, 98, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95,114, -103, 98, 95, 99,111,108,111,114, 40,118,101, 99, 51, 32,111,117,116, 99,111,108, 44, 32,118,101, 99, 51, 32,116,101,120, 99,111, -108, 44, 32,102,108,111, 97,116, 32,102, 97, 99,116, 44, 32,102,108,111, 97,116, 32,102, 97, 99,103, 44, 32,111,117,116, 32,118, -101, 99, 51, 32,105,110, 99,111,108, 41, 10,123, 10, 9,118,101, 99, 52, 32, 99,111,108, 59, 10, 10, 9,109,105,120, 95, 99,111, -108,111,114, 40,102, 97, 99,116, 42,102, 97, 99,103, 44, 32,118,101, 99, 52, 40,111,117,116, 99,111,108, 44, 32, 49, 46, 48, 41, - 44, 32,118,101, 99, 52, 40,116,101,120, 99,111,108, 44, 32, 49, 46, 48, 41, 44, 32, 99,111,108, 41, 59, 10, 9,105,110, 99,111, -108, 46,114,103, 98, 32, 61, 32, 99,111,108, 46,114,103, 98, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95,118, 97, -108,117,101, 95,118, 97,114,115, 40,105,110,111,117,116, 32,102,108,111, 97,116, 32,102, 97, 99,116, 44, 32,102,108,111, 97,116, - 32,102, 97, 99,103, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,102, 97, 99,109, 41, 10,123, 10, 9,102, 97, 99,116, 32, 42, - 61, 32, 97, 98,115, 40,102, 97, 99,103, 41, 59, 10, 9,102, 97, 99,109, 32, 61, 32, 49, 46, 48, 45,102, 97, 99,116, 59, 10, 10, - 9,105,102, 40,102, 97, 99,103, 32, 60, 32, 48, 46, 48, 41, 32,123, 10, 9, 9,102,108,111, 97,116, 32,116,109,112, 32, 61, 32, -102, 97, 99,116, 59, 10, 9, 9,102, 97, 99,116, 32, 61, 32,102, 97, 99,109, 59, 10, 9, 9,102, 97, 99,109, 32, 61, 32,116,109, -112, 59, 10, 9,125, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95,118, 97,108,117,101, 95, 98,108,101,110,100, 40,102, -108,111, 97,116, 32,111,117,116, 99,111,108, 44, 32,102,108,111, 97,116, 32,116,101,120, 99,111,108, 44, 32,102,108,111, 97,116, - 32,102, 97, 99,116, 44, 32,102,108,111, 97,116, 32,102, 97, 99,103, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,105,110, 99, -111,108, 41, 10,123, 10, 9,102,108,111, 97,116, 32,102, 97, 99,109, 59, 10, 9,109,116,101,120, 95,118, 97,108,117,101, 95,118, - 97,114,115, 40,102, 97, 99,116, 44, 32,102, 97, 99,103, 44, 32,102, 97, 99,109, 41, 59, 10, 10, 9,105,110, 99,111,108, 32, 61, - 32,102, 97, 99,116, 42,116,101,120, 99,111,108, 32, 43, 32,102, 97, 99,109, 42,111,117,116, 99,111,108, 59, 10,125, 10, 10,118, -111,105,100, 32,109,116,101,120, 95,118, 97,108,117,101, 95,109,117,108, 40,102,108,111, 97,116, 32,111,117,116, 99,111,108, 44, - 32,102,108,111, 97,116, 32,116,101,120, 99,111,108, 44, 32,102,108,111, 97,116, 32,102, 97, 99,116, 44, 32,102,108,111, 97,116, - 32,102, 97, 99,103, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,105,110, 99,111,108, 41, 10,123, 10, 9,102,108,111, 97,116, - 32,102, 97, 99,109, 59, 10, 9,109,116,101,120, 95,118, 97,108,117,101, 95,118, 97,114,115, 40,102, 97, 99,116, 44, 32,102, 97, - 99,103, 44, 32,102, 97, 99,109, 41, 59, 10, 10, 9,102, 97, 99,109, 32, 61, 32, 49, 46, 48, 32, 45, 32,102, 97, 99,103, 59, 10, - 9,105,110, 99,111,108, 32, 61, 32, 40,102, 97, 99,109, 32, 43, 32,102, 97, 99,116, 42,116,101,120, 99,111,108, 41, 42,111,117, -116, 99,111,108, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95,118, 97,108,117,101, 95,115, 99,114,101,101,110, 40, -102,108,111, 97,116, 32,111,117,116, 99,111,108, 44, 32,102,108,111, 97,116, 32,116,101,120, 99,111,108, 44, 32,102,108,111, 97, -116, 32,102, 97, 99,116, 44, 32,102,108,111, 97,116, 32,102, 97, 99,103, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,105,110, - 99,111,108, 41, 10,123, 10, 9,102,108,111, 97,116, 32,102, 97, 99,109, 59, 10, 9,109,116,101,120, 95,118, 97,108,117,101, 95, -118, 97,114,115, 40,102, 97, 99,116, 44, 32,102, 97, 99,103, 44, 32,102, 97, 99,109, 41, 59, 10, 10, 9,102, 97, 99,109, 32, 61, - 32, 49, 46, 48, 32, 45, 32,102, 97, 99,103, 59, 10, 9,105,110, 99,111,108, 32, 61, 32, 49, 46, 48, 32, 45, 32, 40,102, 97, 99, -109, 32, 43, 32,102, 97, 99,116, 42, 40, 49, 46, 48, 32, 45, 32,116,101,120, 99,111,108, 41, 41, 42, 40, 49, 46, 48, 32, 45, 32, -111,117,116, 99,111,108, 41, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95,118, 97,108,117,101, 95,115,117, 98, 40, -102,108,111, 97,116, 32,111,117,116, 99,111,108, 44, 32,102,108,111, 97,116, 32,116,101,120, 99,111,108, 44, 32,102,108,111, 97, -116, 32,102, 97, 99,116, 44, 32,102,108,111, 97,116, 32,102, 97, 99,103, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,105,110, - 99,111,108, 41, 10,123, 10, 9,102,108,111, 97,116, 32,102, 97, 99,109, 59, 10, 9,109,116,101,120, 95,118, 97,108,117,101, 95, -118, 97,114,115, 40,102, 97, 99,116, 44, 32,102, 97, 99,103, 44, 32,102, 97, 99,109, 41, 59, 10, 10, 9,102, 97, 99,116, 32, 61, - 32, 45,102, 97, 99,116, 59, 10, 9,105,110, 99,111,108, 32, 61, 32,102, 97, 99,116, 42,116,101,120, 99,111,108, 32, 43, 32,111, -117,116, 99,111,108, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95,118, 97,108,117,101, 95, 97,100,100, 40,102,108, -111, 97,116, 32,111,117,116, 99,111,108, 44, 32,102,108,111, 97,116, 32,116,101,120, 99,111,108, 44, 32,102,108,111, 97,116, 32, -102, 97, 99,116, 44, 32,102,108,111, 97,116, 32,102, 97, 99,103, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,105,110, 99,111, -108, 41, 10,123, 10, 9,102,108,111, 97,116, 32,102, 97, 99,109, 59, 10, 9,109,116,101,120, 95,118, 97,108,117,101, 95,118, 97, -114,115, 40,102, 97, 99,116, 44, 32,102, 97, 99,103, 44, 32,102, 97, 99,109, 41, 59, 10, 10, 9,102, 97, 99,116, 32, 61, 32,102, - 97, 99,116, 59, 10, 9,105,110, 99,111,108, 32, 61, 32,102, 97, 99,116, 42,116,101,120, 99,111,108, 32, 43, 32,111,117,116, 99, -111,108, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95,118, 97,108,117,101, 95,100,105,118, 40,102,108,111, 97,116, - 32,111,117,116, 99,111,108, 44, 32,102,108,111, 97,116, 32,116,101,120, 99,111,108, 44, 32,102,108,111, 97,116, 32,102, 97, 99, -116, 44, 32,102,108,111, 97,116, 32,102, 97, 99,103, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,105,110, 99,111,108, 41, 10, -123, 10, 9,102,108,111, 97,116, 32,102, 97, 99,109, 59, 10, 9,109,116,101,120, 95,118, 97,108,117,101, 95,118, 97,114,115, 40, -102, 97, 99,116, 44, 32,102, 97, 99,103, 44, 32,102, 97, 99,109, 41, 59, 10, 10, 9,105,102, 40,116,101,120, 99,111,108, 32, 33, - 61, 32, 48, 46, 48, 41, 10, 9, 9,105,110, 99,111,108, 32, 61, 32,102, 97, 99,109, 42,111,117,116, 99,111,108, 32, 43, 32,102, - 97, 99,116, 42,111,117,116, 99,111,108, 47,116,101,120, 99,111,108, 59, 10, 9,101,108,115,101, 10, 9, 9,105,110, 99,111,108, - 32, 61, 32, 48, 46, 48, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95,118, 97,108,117,101, 95,100,105,102,102, 40, +116,101,120, 95,114,103, 98, 95, 99,111,108,111,114, 40,118,101, 99, 51, 32,111,117,116, 99,111,108, 44, 32,118,101, 99, 51, 32, +116,101,120, 99,111,108, 44, 32,102,108,111, 97,116, 32,102, 97, 99,116, 44, 32,102,108,111, 97,116, 32,102, 97, 99,103, 44, 32, +111,117,116, 32,118,101, 99, 51, 32,105,110, 99,111,108, 41, 10,123, 10, 9,118,101, 99, 52, 32, 99,111,108, 59, 10, 10, 9,109, +105,120, 95, 99,111,108,111,114, 40,102, 97, 99,116, 42,102, 97, 99,103, 44, 32,118,101, 99, 52, 40,111,117,116, 99,111,108, 44, + 32, 49, 46, 48, 41, 44, 32,118,101, 99, 52, 40,116,101,120, 99,111,108, 44, 32, 49, 46, 48, 41, 44, 32, 99,111,108, 41, 59, 10, + 9,105,110, 99,111,108, 46,114,103, 98, 32, 61, 32, 99,111,108, 46,114,103, 98, 59, 10,125, 10, 10,118,111,105,100, 32,109,116, +101,120, 95,118, 97,108,117,101, 95,118, 97,114,115, 40,105,110,111,117,116, 32,102,108,111, 97,116, 32,102, 97, 99,116, 44, 32, +102,108,111, 97,116, 32,102, 97, 99,103, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,102, 97, 99,109, 41, 10,123, 10, 9,102, + 97, 99,116, 32, 42, 61, 32, 97, 98,115, 40,102, 97, 99,103, 41, 59, 10, 9,102, 97, 99,109, 32, 61, 32, 49, 46, 48, 45,102, 97, + 99,116, 59, 10, 10, 9,105,102, 40,102, 97, 99,103, 32, 60, 32, 48, 46, 48, 41, 32,123, 10, 9, 9,102,108,111, 97,116, 32,116, +109,112, 32, 61, 32,102, 97, 99,116, 59, 10, 9, 9,102, 97, 99,116, 32, 61, 32,102, 97, 99,109, 59, 10, 9, 9,102, 97, 99,109, + 32, 61, 32,116,109,112, 59, 10, 9,125, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95,118, 97,108,117,101, 95, 98,108, +101,110,100, 40,102,108,111, 97,116, 32,111,117,116, 99,111,108, 44, 32,102,108,111, 97,116, 32,116,101,120, 99,111,108, 44, 32, +102,108,111, 97,116, 32,102, 97, 99,116, 44, 32,102,108,111, 97,116, 32,102, 97, 99,103, 44, 32,111,117,116, 32,102,108,111, 97, +116, 32,105,110, 99,111,108, 41, 10,123, 10, 9,102,108,111, 97,116, 32,102, 97, 99,109, 59, 10, 9,109,116,101,120, 95,118, 97, +108,117,101, 95,118, 97,114,115, 40,102, 97, 99,116, 44, 32,102, 97, 99,103, 44, 32,102, 97, 99,109, 41, 59, 10, 10, 9,105,110, + 99,111,108, 32, 61, 32,102, 97, 99,116, 42,116,101,120, 99,111,108, 32, 43, 32,102, 97, 99,109, 42,111,117,116, 99,111,108, 59, + 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95,118, 97,108,117,101, 95,109,117,108, 40,102,108,111, 97,116, 32,111,117, +116, 99,111,108, 44, 32,102,108,111, 97,116, 32,116,101,120, 99,111,108, 44, 32,102,108,111, 97,116, 32,102, 97, 99,116, 44, 32, +102,108,111, 97,116, 32,102, 97, 99,103, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,105,110, 99,111,108, 41, 10,123, 10, 9, +102,108,111, 97,116, 32,102, 97, 99,109, 59, 10, 9,109,116,101,120, 95,118, 97,108,117,101, 95,118, 97,114,115, 40,102, 97, 99, +116, 44, 32,102, 97, 99,103, 44, 32,102, 97, 99,109, 41, 59, 10, 10, 9,102, 97, 99,109, 32, 61, 32, 49, 46, 48, 32, 45, 32,102, + 97, 99,103, 59, 10, 9,105,110, 99,111,108, 32, 61, 32, 40,102, 97, 99,109, 32, 43, 32,102, 97, 99,116, 42,116,101,120, 99,111, +108, 41, 42,111,117,116, 99,111,108, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95,118, 97,108,117,101, 95,115, 99, +114,101,101,110, 40,102,108,111, 97,116, 32,111,117,116, 99,111,108, 44, 32,102,108,111, 97,116, 32,116,101,120, 99,111,108, 44, + 32,102,108,111, 97,116, 32,102, 97, 99,116, 44, 32,102,108,111, 97,116, 32,102, 97, 99,103, 44, 32,111,117,116, 32,102,108,111, + 97,116, 32,105,110, 99,111,108, 41, 10,123, 10, 9,102,108,111, 97,116, 32,102, 97, 99,109, 59, 10, 9,109,116,101,120, 95,118, + 97,108,117,101, 95,118, 97,114,115, 40,102, 97, 99,116, 44, 32,102, 97, 99,103, 44, 32,102, 97, 99,109, 41, 59, 10, 10, 9,102, + 97, 99,109, 32, 61, 32, 49, 46, 48, 32, 45, 32,102, 97, 99,103, 59, 10, 9,105,110, 99,111,108, 32, 61, 32, 49, 46, 48, 32, 45, + 32, 40,102, 97, 99,109, 32, 43, 32,102, 97, 99,116, 42, 40, 49, 46, 48, 32, 45, 32,116,101,120, 99,111,108, 41, 41, 42, 40, 49, + 46, 48, 32, 45, 32,111,117,116, 99,111,108, 41, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95,118, 97,108,117,101, + 95,115,117, 98, 40,102,108,111, 97,116, 32,111,117,116, 99,111,108, 44, 32,102,108,111, 97,116, 32,116,101,120, 99,111,108, 44, + 32,102,108,111, 97,116, 32,102, 97, 99,116, 44, 32,102,108,111, 97,116, 32,102, 97, 99,103, 44, 32,111,117,116, 32,102,108,111, + 97,116, 32,105,110, 99,111,108, 41, 10,123, 10, 9,102,108,111, 97,116, 32,102, 97, 99,109, 59, 10, 9,109,116,101,120, 95,118, + 97,108,117,101, 95,118, 97,114,115, 40,102, 97, 99,116, 44, 32,102, 97, 99,103, 44, 32,102, 97, 99,109, 41, 59, 10, 10, 9,102, + 97, 99,116, 32, 61, 32, 45,102, 97, 99,116, 59, 10, 9,105,110, 99,111,108, 32, 61, 32,102, 97, 99,116, 42,116,101,120, 99,111, +108, 32, 43, 32,111,117,116, 99,111,108, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95,118, 97,108,117,101, 95, 97, +100,100, 40,102,108,111, 97,116, 32,111,117,116, 99,111,108, 44, 32,102,108,111, 97,116, 32,116,101,120, 99,111,108, 44, 32,102, +108,111, 97,116, 32,102, 97, 99,116, 44, 32,102,108,111, 97,116, 32,102, 97, 99,103, 44, 32,111,117,116, 32,102,108,111, 97,116, + 32,105,110, 99,111,108, 41, 10,123, 10, 9,102,108,111, 97,116, 32,102, 97, 99,109, 59, 10, 9,109,116,101,120, 95,118, 97,108, +117,101, 95,118, 97,114,115, 40,102, 97, 99,116, 44, 32,102, 97, 99,103, 44, 32,102, 97, 99,109, 41, 59, 10, 10, 9,102, 97, 99, +116, 32, 61, 32,102, 97, 99,116, 59, 10, 9,105,110, 99,111,108, 32, 61, 32,102, 97, 99,116, 42,116,101,120, 99,111,108, 32, 43, + 32,111,117,116, 99,111,108, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95,118, 97,108,117,101, 95,100,105,118, 40, 102,108,111, 97,116, 32,111,117,116, 99,111,108, 44, 32,102,108,111, 97,116, 32,116,101,120, 99,111,108, 44, 32,102,108,111, 97, 116, 32,102, 97, 99,116, 44, 32,102,108,111, 97,116, 32,102, 97, 99,103, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,105,110, 99,111,108, 41, 10,123, 10, 9,102,108,111, 97,116, 32,102, 97, 99,109, 59, 10, 9,109,116,101,120, 95,118, 97,108,117,101, 95, -118, 97,114,115, 40,102, 97, 99,116, 44, 32,102, 97, 99,103, 44, 32,102, 97, 99,109, 41, 59, 10, 10, 9,105,110, 99,111,108, 32, - 61, 32,102, 97, 99,109, 42,111,117,116, 99,111,108, 32, 43, 32,102, 97, 99,116, 42, 97, 98,115, 40,116,101,120, 99,111,108, 32, - 45, 32,111,117,116, 99,111,108, 41, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95,118, 97,108,117,101, 95,100, 97, -114,107, 40,102,108,111, 97,116, 32,111,117,116, 99,111,108, 44, 32,102,108,111, 97,116, 32,116,101,120, 99,111,108, 44, 32,102, -108,111, 97,116, 32,102, 97, 99,116, 44, 32,102,108,111, 97,116, 32,102, 97, 99,103, 44, 32,111,117,116, 32,102,108,111, 97,116, - 32,105,110, 99,111,108, 41, 10,123, 10, 9,102,108,111, 97,116, 32,102, 97, 99,109, 59, 10, 9,109,116,101,120, 95,118, 97,108, -117,101, 95,118, 97,114,115, 40,102, 97, 99,116, 44, 32,102, 97, 99,103, 44, 32,102, 97, 99,109, 41, 59, 10, 10, 9,102,108,111, - 97,116, 32, 99,111,108, 32, 61, 32,102, 97, 99,116, 42,116,101,120, 99,111,108, 59, 10, 9,105,102, 40, 99,111,108, 32, 60, 32, -111,117,116, 99,111,108, 41, 32,105,110, 99,111,108, 32, 61, 32, 99,111,108, 59, 32,101,108,115,101, 32,105,110, 99,111,108, 32, - 61, 32,111,117,116, 99,111,108, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95,118, 97,108,117,101, 95,108,105,103, -104,116, 40,102,108,111, 97,116, 32,111,117,116, 99,111,108, 44, 32,102,108,111, 97,116, 32,116,101,120, 99,111,108, 44, 32,102, -108,111, 97,116, 32,102, 97, 99,116, 44, 32,102,108,111, 97,116, 32,102, 97, 99,103, 44, 32,111,117,116, 32,102,108,111, 97,116, - 32,105,110, 99,111,108, 41, 10,123, 10, 9,102,108,111, 97,116, 32,102, 97, 99,109, 59, 10, 9,109,116,101,120, 95,118, 97,108, -117,101, 95,118, 97,114,115, 40,102, 97, 99,116, 44, 32,102, 97, 99,103, 44, 32,102, 97, 99,109, 41, 59, 10, 10, 9,102,108,111, - 97,116, 32, 99,111,108, 32, 61, 32,102, 97, 99,116, 42,116,101,120, 99,111,108, 59, 10, 9,105,102, 40, 99,111,108, 32, 62, 32, -111,117,116, 99,111,108, 41, 32,105,110, 99,111,108, 32, 61, 32, 99,111,108, 59, 32,101,108,115,101, 32,105,110, 99,111,108, 32, - 61, 32,111,117,116, 99,111,108, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95,118, 97,108,117,101, 95, 99,108, 97, -109,112, 95,112,111,115,105,116,105,118,101, 40,102,108,111, 97,116, 32,102, 97, 99, 44, 32,111,117,116, 32,102,108,111, 97,116, - 32,111,117,116,102, 97, 99, 41, 10,123, 10, 9,111,117,116,102, 97, 99, 32, 61, 32,109, 97,120, 40,102, 97, 99, 44, 32, 48, 46, - 48, 41, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95,118, 97,108,117,101, 95, 99,108, 97,109,112, 40,102,108,111, - 97,116, 32,102, 97, 99, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,102, 97, 99, 41, 10,123, 10, 9,111,117,116, -102, 97, 99, 32, 61, 32, 99,108, 97,109,112, 40,102, 97, 99, 44, 32, 48, 46, 48, 44, 32, 49, 46, 48, 41, 59, 10,125, 10, 10,118, -111,105,100, 32,109,116,101,120, 95,104, 97,114, 95,100,105,118,105,100,101, 40,102,108,111, 97,116, 32,104, 97,114, 44, 32,111, -117,116, 32,102,108,111, 97,116, 32,111,117,116,104, 97,114, 41, 10,123, 10, 9,111,117,116,104, 97,114, 32, 61, 32,104, 97,114, - 47, 49, 50, 56, 46, 48, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95,104, 97,114, 95,109,117,108,116,105,112,108, -121, 95, 99,108, 97,109,112, 40,102,108,111, 97,116, 32,104, 97,114, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116, -104, 97,114, 41, 10,123, 10, 9,104, 97,114, 32, 42, 61, 32, 49, 50, 56, 46, 48, 59, 10, 10, 9,105,102, 40,104, 97,114, 32, 60, - 32, 49, 46, 48, 41, 32,111,117,116,104, 97,114, 32, 61, 32, 49, 46, 48, 59, 10, 9,101,108,115,101, 32,105,102, 40,104, 97,114, - 32, 62, 32, 53, 49, 49, 46, 48, 41, 32,111,117,116,104, 97,114, 32, 61, 32, 53, 49, 49, 46, 48, 59, 10, 9,101,108,115,101, 32, -111,117,116,104, 97,114, 32, 61, 32,104, 97,114, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95, 97,108,112,104, 97, - 95,102,114,111,109, 95, 99,111,108, 40,118,101, 99, 52, 32, 99,111,108, 44, 32,111,117,116, 32,102,108,111, 97,116, 32, 97,108, -112,104, 97, 41, 10,123, 10, 9, 97,108,112,104, 97, 32, 61, 32, 99,111,108, 46, 97, 59, 10,125, 10, 10,118,111,105,100, 32,109, -116,101,120, 95, 97,108,112,104, 97, 95,116,111, 95, 99,111,108, 40,118,101, 99, 52, 32, 99,111,108, 44, 32,102,108,111, 97,116, - 32, 97,108,112,104, 97, 44, 32,111,117,116, 32,118,101, 99, 52, 32,111,117,116, 99,111,108, 41, 10,123, 10, 9,111,117,116, 99, -111,108, 32, 61, 32,118,101, 99, 52, 40, 99,111,108, 46,114,103, 98, 44, 32, 97,108,112,104, 97, 41, 59, 10,125, 10, 10,118,111, -105,100, 32,109,116,101,120, 95,114,103, 98,116,111,105,110,116, 40,118,101, 99, 52, 32,114,103, 98, 44, 32,111,117,116, 32,102, -108,111, 97,116, 32,105,110,116,101,110,115,105,116,121, 41, 10,123, 10, 9,105,110,116,101,110,115,105,116,121, 32, 61, 32,100, -111,116, 40,118,101, 99, 51, 40, 48, 46, 51, 53, 44, 32, 48, 46, 52, 53, 44, 32, 48, 46, 50, 41, 44, 32,114,103, 98, 46,114,103, - 98, 41, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95,118, 97,108,117,101, 95,105,110,118,101,114,116, 40,102,108, -111, 97,116, 32,105,110,118, 97,108,117,101, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108,117,101, 41, - 10,123, 10, 9,111,117,116,118, 97,108,117,101, 32, 61, 32, 49, 46, 48, 32, 45, 32,105,110,118, 97,108,117,101, 59, 10,125, 10, - 10,118,111,105,100, 32,109,116,101,120, 95,114,103, 98, 95,105,110,118,101,114,116, 40,118,101, 99, 52, 32,105,110,114,103, 98, - 44, 32,111,117,116, 32,118,101, 99, 52, 32,111,117,116,114,103, 98, 41, 10,123, 10, 9,111,117,116,114,103, 98, 32, 61, 32,118, -101, 99, 52, 40,118,101, 99, 51, 40, 49, 46, 48, 41, 32, 45, 32,105,110,114,103, 98, 46,114,103, 98, 44, 32,105,110,114,103, 98, - 46, 97, 41, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95,118, 97,108,117,101, 95,115,116,101,110, 99,105,108, 40, -102,108,111, 97,116, 32,115,116,101,110, 99,105,108, 44, 32,102,108,111, 97,116, 32,105,110,116,101,110,115,105,116,121, 44, 32, -111,117,116, 32,102,108,111, 97,116, 32,111,117,116,115,116,101,110, 99,105,108, 44, 32,111,117,116, 32,102,108,111, 97,116, 32, -111,117,116,105,110,116,101,110,115,105,116,121, 41, 10,123, 10, 9,102,108,111, 97,116, 32,102, 97, 99,116, 32, 61, 32,105,110, -116,101,110,115,105,116,121, 59, 10, 9,111,117,116,105,110,116,101,110,115,105,116,121, 32, 61, 32,105,110,116,101,110,115,105, -116,121, 42,115,116,101,110, 99,105,108, 59, 10, 9,111,117,116,115,116,101,110, 99,105,108, 32, 61, 32,115,116,101,110, 99,105, -108, 42,102, 97, 99,116, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95,114,103, 98, 95,115,116,101,110, 99,105,108, - 40,102,108,111, 97,116, 32,115,116,101,110, 99,105,108, 44, 32,118,101, 99, 52, 32,114,103, 98, 44, 32,111,117,116, 32,102,108, -111, 97,116, 32,111,117,116,115,116,101,110, 99,105,108, 44, 32,111,117,116, 32,118,101, 99, 52, 32,111,117,116,114,103, 98, 41, - 10,123, 10, 9,102,108,111, 97,116, 32,102, 97, 99,116, 32, 61, 32,114,103, 98, 46, 97, 59, 10, 9,111,117,116,114,103, 98, 32, - 61, 32,118,101, 99, 52, 40,114,103, 98, 46,114,103, 98, 44, 32,114,103, 98, 46, 97, 42,115,116,101,110, 99,105,108, 41, 59, 10, - 9,111,117,116,115,116,101,110, 99,105,108, 32, 61, 32,115,116,101,110, 99,105,108, 42,102, 97, 99,116, 59, 10,125, 10, 10,118, -111,105,100, 32,109,116,101,120, 95,109, 97,112,112,105,110,103, 95,111,102,115, 40,118,101, 99, 51, 32,116,101,120, 99,111, 44, - 32,118,101, 99, 51, 32,111,102,115, 44, 32,111,117,116, 32,118,101, 99, 51, 32,111,117,116,116,101,120, 99,111, 41, 10,123, 10, - 9,111,117,116,116,101,120, 99,111, 32, 61, 32,116,101,120, 99,111, 32, 43, 32,111,102,115, 59, 10,125, 10, 10,118,111,105,100, - 32,109,116,101,120, 95,109, 97,112,112,105,110,103, 95,115,105,122,101, 40,118,101, 99, 51, 32,116,101,120, 99,111, 44, 32,118, -101, 99, 51, 32,115,105,122,101, 44, 32,111,117,116, 32,118,101, 99, 51, 32,111,117,116,116,101,120, 99,111, 41, 10,123, 10, 9, -111,117,116,116,101,120, 99,111, 32, 61, 32,115,105,122,101, 42,116,101,120, 99,111, 59, 10,125, 10, 10,118,111,105,100, 32,109, -116,101,120, 95, 50,100, 95,109, 97,112,112,105,110,103, 40,118,101, 99, 51, 32,118,101, 99, 44, 32,111,117,116, 32,118,101, 99, - 51, 32,111,117,116,118,101, 99, 41, 10,123, 10, 9,111,117,116,118,101, 99, 32, 61, 32,118,101, 99, 51, 40,118,101, 99, 46,120, -121, 42, 48, 46, 53, 32, 43, 32,118,101, 99, 50, 40, 48, 46, 53, 44, 32, 48, 46, 53, 41, 44, 32,118,101, 99, 46,122, 41, 59, 10, -125, 10, 10,118,111,105,100, 32,109,116,101,120, 95,105,109, 97,103,101, 40,118,101, 99, 51, 32,116,101,120, 99,111, 44, 32,115, - 97,109,112,108,101,114, 50, 68, 32,105,109, 97, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,118, 97,108,117,101, 44, 32,111, -117,116, 32,118,101, 99, 52, 32, 99,111,108,111,114, 41, 10,123, 10, 9, 99,111,108,111,114, 32, 61, 32,116,101,120,116,117,114, -101, 50, 68, 40,105,109, 97, 44, 32,116,101,120, 99,111, 46,120,121, 41, 59, 10, 9,118, 97,108,117,101, 32, 61, 32, 49, 46, 48, - 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95,110,111,114,109, 97,108, 40,118,101, 99, 51, 32,116,101,120, 99,111, - 44, 32,115, 97,109,112,108,101,114, 50, 68, 32,105,109, 97, 44, 32,111,117,116, 32,118,101, 99, 51, 32,110,111,114,109, 97,108, - 41, 10,123, 10, 32, 32, 32, 32,118,101, 99, 52, 32, 99,111,108,111,114, 32, 61, 32,116,101,120,116,117,114,101, 50, 68, 40,105, -109, 97, 44, 32,116,101,120, 99,111, 46,120,121, 41, 59, 10, 9,110,111,114,109, 97,108, 32, 61, 32, 50, 46, 48, 42, 40,118,101, - 99, 51, 40, 99,111,108,111,114, 46,114, 44, 32, 45, 99,111,108,111,114, 46,103, 44, 32, 99,111,108,111,114, 46, 98, 41, 32, 45, - 32,118,101, 99, 51, 40, 48, 46, 53, 44, 32, 45, 48, 46, 53, 44, 32, 48, 46, 53, 41, 41, 59, 10,125, 10, 10,118,111,105,100, 32, -109,116,101,120, 95, 98,117,109,112, 95,105,110,105,116, 95,118,105,101,119,115,112, 97, 99,101, 40, 32,118,101, 99, 51, 32,115, -117,114,102, 95,112,111,115, 44, 32,118,101, 99, 51, 32,115,117,114,102, 95,110,111,114,109, 44, 10, 32, 32, 32, 32, 32, 32, 32, - 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,111,117,116, 32,118,101, 99, 51, 32,118, 82, 49, 44, 32,111,117,116, 32, -118,101, 99, 51, 32,118, 82, 50, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,102, 68,101,116, 44, 32,111,117,116, 32,118,101, - 99, 51, 32,118, 78, 32, 41, 32, 10,123, 10, 9,118,101, 99, 51, 32,118, 83,105,103,109, 97, 83, 32, 61, 32,100, 70,100,120, 40, - 32,115,117,114,102, 95,112,111,115, 32, 41, 59, 10, 9,118,101, 99, 51, 32,118, 83,105,103,109, 97, 84, 32, 61, 32,100, 70,100, -121, 40, 32,115,117,114,102, 95,112,111,115, 32, 41, 59, 10, 9,118, 78, 32, 61, 32,115,117,114,102, 95,110,111,114,109, 59, 32, - 47, 42, 32,110,111,114,109, 97,108,105,122,101,100, 32,105,110,116,101,114,112,111,108, 97,116,101,100, 32,118,101,114,116,101, -120, 32,110,111,114,109, 97,108, 32, 42, 47, 10, 9, 10, 9,118, 82, 49, 32, 61, 32, 99,114,111,115,115, 40, 32,118, 83,105,103, -109, 97, 84, 32, 44, 32,118, 78, 32, 41, 59, 10, 9,118, 82, 50, 32, 61, 32, 99,114,111,115,115, 40, 32,118, 78, 32, 44, 32,118, - 83,105,103,109, 97, 83, 32, 41, 32, 59, 10, 9,102, 68,101,116, 32, 61, 32,100,111,116, 32, 40, 32,118, 83,105,103,109, 97, 83, - 32, 44, 32,118, 82, 49, 32, 41, 59, 10,125, 10, 10, 47, 42, 42, 32,104,101,108,112,101,114, 32,109,101,116,104,111,100, 32,116, -111, 32,101,120,116,114, 97, 99,116, 32,116,104,101, 32,117,112,112,101,114, 32,108,101,102,116, 32, 51,120, 51, 32,109, 97,116, -114,105,120, 32,102,114,111,109, 32, 97, 32, 52,120, 52, 32,109, 97,116,114,105,120, 32, 42, 47, 10,109, 97,116, 51, 32,116,111, - 95,109, 97,116, 51, 40,109, 97,116, 52, 32,109, 52, 41, 10,123, 10, 9,109, 97,116, 51, 32,109, 51, 59, 10, 9,109, 51, 91, 48, - 93, 32, 61, 32,109, 52, 91, 48, 93, 46,120,121,122, 59, 10, 9,109, 51, 91, 49, 93, 32, 61, 32,109, 52, 91, 49, 93, 46,120,121, -122, 59, 10, 9,109, 51, 91, 50, 93, 32, 61, 32,109, 52, 91, 50, 93, 46,120,121,122, 59, 10, 9,114,101,116,117,114,110, 32,109, - 51, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95, 98,117,109,112, 95,105,110,105,116, 95,111, 98,106,115,112, 97, - 99,101, 40, 32,118,101, 99, 51, 32,115,117,114,102, 95,112,111,115, 44, 32,118,101, 99, 51, 32,115,117,114,102, 95,110,111,114, -109, 44, 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, - 32,109, 97,116, 52, 32,109, 86,105,101,119, 44, 32,109, 97,116, 52, 32,109, 86,105,101,119, 73,110,118, 44, 32,109, 97,116, 52, - 32,109, 79, 98,106, 44, 32,109, 97,116, 52, 32,109, 79, 98,106, 73,110,118, 44, 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, - 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,111,117,116, 32,118,101, 99, 51, 32,118, 82, 49, 44, - 32,111,117,116, 32,118,101, 99, 51, 32,118, 82, 50, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,102, 68,101,116, 44, 32,111, -117,116, 32,118,101, 99, 51, 32,118, 78, 32, 41, 32, 10,123, 10, 9,109, 97,116, 51, 32,111, 98,106, 50,118,105,101,119, 32, 61, - 32,116,111, 95,109, 97,116, 51, 40,109, 86,105,101,119, 32, 42, 32,109, 79, 98,106, 41, 59, 10, 9,109, 97,116, 51, 32,118,105, -101,119, 50,111, 98,106, 32, 61, 32,116,111, 95,109, 97,116, 51, 40,109, 79, 98,106, 73,110,118, 32, 42, 32,109, 86,105,101,119, - 73,110,118, 41, 59, 10, 9, 10, 9,118,101, 99, 51, 32,118, 83,105,103,109, 97, 83, 32, 61, 32,118,105,101,119, 50,111, 98,106, - 32, 42, 32,100, 70,100,120, 40, 32,115,117,114,102, 95,112,111,115, 32, 41, 59, 10, 9,118,101, 99, 51, 32,118, 83,105,103,109, - 97, 84, 32, 61, 32,118,105,101,119, 50,111, 98,106, 32, 42, 32,100, 70,100,121, 40, 32,115,117,114,102, 95,112,111,115, 32, 41, - 59, 10, 9,118, 78, 32, 61, 32,110,111,114,109, 97,108,105,122,101, 40, 32,115,117,114,102, 95,110,111,114,109, 32, 42, 32,111, - 98,106, 50,118,105,101,119, 32, 41, 59, 10, 10, 9,118, 82, 49, 32, 61, 32, 99,114,111,115,115, 40, 32,118, 83,105,103,109, 97, - 84, 32, 44, 32,118, 78, 32, 41, 59, 10, 9,118, 82, 50, 32, 61, 32, 99,114,111,115,115, 40, 32,118, 78, 32, 44, 32,118, 83,105, -103,109, 97, 83, 32, 41, 32, 59, 10, 9,102, 68,101,116, 32, 61, 32,100,111,116, 32, 40, 32,118, 83,105,103,109, 97, 83, 32, 44, - 32,118, 82, 49, 32, 41, 59, 10, 9, 10, 9, 9, 47, 42, 32,116,114, 97,110,115,102,111,114,109, 32, 98, 97, 99,107, 32, 42, 47, - 10, 9,118, 82, 49, 32, 61, 32,118, 82, 49, 32, 42, 32,118,105,101,119, 50,111, 98,106, 59, 10, 9,118, 82, 50, 32, 61, 32,118, - 82, 50, 32, 42, 32,118,105,101,119, 50,111, 98,106, 59, 10, 9,118, 78, 32, 61, 32,118, 78, 32, 42, 32,118,105,101,119, 50,111, - 98,106, 59, 10, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95, 98,117,109,112, 95,116, 97,112, 51, 40, 32,118,101, 99, - 51, 32,116,101,120, 99,111, 44, 32,115, 97,109,112,108,101,114, 50, 68, 32,105,109, 97, 44, 32,102,108,111, 97,116, 32,104, 83, - 99, 97,108,101, 44, 32, 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,111,117,116, 32, -102,108,111, 97,116, 32,100, 66,115, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,100, 66,116, 32, 41, 32, 10,123, 10, 9,118, -101, 99, 50, 32, 83, 84,108,108, 32, 61, 32,116,101,120, 99,111, 46,120,121, 59, 10, 9,118,101, 99, 50, 32, 83, 84,108,114, 32, - 61, 32,116,101,120, 99,111, 46,120,121, 32, 43, 32,100, 70,100,120, 40,116,101,120, 99,111, 46,120,121, 41, 32, 59, 10, 9,118, -101, 99, 50, 32, 83, 84,117,108, 32, 61, 32,116,101,120, 99,111, 46,120,121, 32, 43, 32,100, 70,100,121, 40,116,101,120, 99,111, - 46,120,121, 41, 32, 59, 10, 9, 10, 9,102,108,111, 97,116, 32, 72,108,108, 44, 72,108,114, 44, 72,117,108, 59, 10, 9,114,103, - 98,116,111, 98,119, 40, 32,116,101,120,116,117,114,101, 50, 68, 40,105,109, 97, 44, 32, 83, 84,108,108, 41, 44, 32, 72,108,108, - 32, 41, 59, 10, 9,114,103, 98,116,111, 98,119, 40, 32,116,101,120,116,117,114,101, 50, 68, 40,105,109, 97, 44, 32, 83, 84,108, -114, 41, 44, 32, 72,108,114, 32, 41, 59, 10, 9,114,103, 98,116,111, 98,119, 40, 32,116,101,120,116,117,114,101, 50, 68, 40,105, -109, 97, 44, 32, 83, 84,117,108, 41, 44, 32, 72,117,108, 32, 41, 59, 10, 9, 10, 9,100, 66,115, 32, 61, 32,104, 83, 99, 97,108, -101, 32, 42, 32, 40, 72,108,114, 32, 45, 32, 72,108,108, 41, 59, 10, 9,100, 66,116, 32, 61, 32,104, 83, 99, 97,108,101, 32, 42, - 32, 40, 72,117,108, 32, 45, 32, 72,108,108, 41, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95, 98,117,109,112, 95, -116, 97,112, 53, 40, 32,118,101, 99, 51, 32,116,101,120, 99,111, 44, 32,115, 97,109,112,108,101,114, 50, 68, 32,105,109, 97, 44, - 32,102,108,111, 97,116, 32,104, 83, 99, 97,108,101, 44, 32, 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, - 32, 32, 32, 32, 32,111,117,116, 32,102,108,111, 97,116, 32,100, 66,115, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,100, 66, -116, 32, 41, 32, 10,123, 10, 9,118,101, 99, 50, 32, 84,101,120, 68,120, 32, 61, 32,100, 70,100,120, 40,116,101,120, 99,111, 46, -120,121, 41, 59, 10, 9,118,101, 99, 50, 32, 84,101,120, 68,121, 32, 61, 32,100, 70,100,121, 40,116,101,120, 99,111, 46,120,121, - 41, 59, 10, 10, 9,118,101, 99, 50, 32, 83, 84, 99, 32, 61, 32,116,101,120, 99,111, 46,120,121, 59, 10, 9,118,101, 99, 50, 32, - 83, 84,108, 32, 61, 32,116,101,120, 99,111, 46,120,121, 32, 45, 32, 48, 46, 53, 32, 42, 32, 84,101,120, 68,120, 32, 59, 10, 9, -118,101, 99, 50, 32, 83, 84,114, 32, 61, 32,116,101,120, 99,111, 46,120,121, 32, 43, 32, 48, 46, 53, 32, 42, 32, 84,101,120, 68, -120, 32, 59, 10, 9,118,101, 99, 50, 32, 83, 84,100, 32, 61, 32,116,101,120, 99,111, 46,120,121, 32, 45, 32, 48, 46, 53, 32, 42, - 32, 84,101,120, 68,121, 32, 59, 10, 9,118,101, 99, 50, 32, 83, 84,117, 32, 61, 32,116,101,120, 99,111, 46,120,121, 32, 43, 32, - 48, 46, 53, 32, 42, 32, 84,101,120, 68,121, 32, 59, 10, 9, 10, 9,102,108,111, 97,116, 32, 72, 99, 44, 72,108, 44, 72,114, 44, - 72,100, 44, 72,117, 59, 10, 9,114,103, 98,116,111, 98,119, 40, 32,116,101,120,116,117,114,101, 50, 68, 40,105,109, 97, 44, 32, - 83, 84, 99, 41, 44, 32, 72, 99, 32, 41, 59, 10, 9,114,103, 98,116,111, 98,119, 40, 32,116,101,120,116,117,114,101, 50, 68, 40, -105,109, 97, 44, 32, 83, 84,108, 41, 44, 32, 72,108, 32, 41, 59, 10, 9,114,103, 98,116,111, 98,119, 40, 32,116,101,120,116,117, -114,101, 50, 68, 40,105,109, 97, 44, 32, 83, 84,114, 41, 44, 32, 72,114, 32, 41, 59, 10, 9,114,103, 98,116,111, 98,119, 40, 32, -116,101,120,116,117,114,101, 50, 68, 40,105,109, 97, 44, 32, 83, 84,100, 41, 44, 32, 72,100, 32, 41, 59, 10, 9,114,103, 98,116, -111, 98,119, 40, 32,116,101,120,116,117,114,101, 50, 68, 40,105,109, 97, 44, 32, 83, 84,117, 41, 44, 32, 72,117, 32, 41, 59, 10, - 9, 10, 9,100, 66,115, 32, 61, 32,104, 83, 99, 97,108,101, 32, 42, 32, 40, 72,114, 32, 45, 32, 72,108, 41, 59, 10, 9,100, 66, -116, 32, 61, 32,104, 83, 99, 97,108,101, 32, 42, 32, 40, 72,117, 32, 45, 32, 72,100, 41, 59, 10,125, 10, 10,118,111,105,100, 32, -109,116,101,120, 95, 98,117,109,112, 95, 97,112,112,108,121, 40, 32,102,108,111, 97,116, 32,102, 68,101,116, 44, 32,102,108,111, - 97,116, 32,100, 66,115, 44, 32,102,108,111, 97,116, 32,100, 66,116, 44, 32,118,101, 99, 51, 32,118, 82, 49, 44, 32,118,101, 99, - 51, 32,118, 82, 50, 44, 32,118,101, 99, 51, 32,118, 78, 44, 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, - 32, 32, 32, 32, 32, 32,111,117,116, 32,118,101, 99, 51, 32,112,101,114,116,117,114, 98,101,100, 95,110,111,114,109, 32, 41, 32, - 10,123, 10, 9,118,101, 99, 51, 32,118, 83,117,114,102, 71,114, 97,100, 32, 61, 32,115,105,103,110, 40,102, 68,101,116, 41, 32, - 42, 32, 40, 32,100, 66,115, 32, 42, 32,118, 82, 49, 32, 43, 32,100, 66,116, 32, 42, 32,118, 82, 50, 32, 41, 59, 10, 9,112,101, -114,116,117,114, 98,101,100, 95,110,111,114,109, 32, 61, 32,110,111,114,109, 97,108,105,122,101, 40, 32, 97, 98,115, 40,102, 68, -101,116, 41, 32, 42, 32,118, 78, 32, 45, 32,118, 83,117,114,102, 71,114, 97,100, 32, 41, 59, 10, 9, 10,125, 10, 10,118,111,105, -100, 32,109,116,101,120, 95, 98,117,109,112, 95, 97,112,112,108,121, 95,116,101,120,115,112, 97, 99,101, 40, 32,102,108,111, 97, -116, 32,102, 68,101,116, 44, 32,102,108,111, 97,116, 32,100, 66,115, 44, 32,102,108,111, 97,116, 32,100, 66,116, 44, 32,118,101, - 99, 51, 32,118, 82, 49, 44, 32,118,101, 99, 51, 32,118, 82, 50, 44, 32,118,101, 99, 51, 32,118, 78, 44, 10, 32, 32, 32, 32, 32, - 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,115, 97,109,112,108,101, -114, 50, 68, 32,105,109, 97, 44, 32,118,101, 99, 51, 32,116,101,120, 99,111, 44, 32,102,108,111, 97,116, 32,105,109, 97, 95,120, - 44, 32,102,108,111, 97,116, 32,105,109, 97, 95,121, 44, 32,111,117,116, 32,118,101, 99, 51, 32,112,101,114,116,117,114, 98,101, -100, 95,110,111,114,109, 32, 41, 32, 10,123, 10, 9,118,101, 99, 50, 32, 84,101,120, 68,120, 32, 61, 32,100, 70,100,120, 40,116, -101,120, 99,111, 46,120,121, 41, 59, 10, 9,118,101, 99, 50, 32, 84,101,120, 68,121, 32, 61, 32,100, 70,100,121, 40,116,101,120, - 99,111, 46,120,121, 41, 59, 10, 10, 9,118,101, 99, 51, 32,118, 83,117,114,102, 71,114, 97,100, 32, 61, 32,115,105,103,110, 40, -102, 68,101,116, 41, 32, 42, 32, 40, 32, 10, 9, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,100, 66,115, 32, 47, 32,108,101, -110,103,116,104, 40, 32,118,101, 99, 50, 40,105,109, 97, 95,120, 42, 84,101,120, 68,120, 46,120, 44, 32,105,109, 97, 95,121, 42, - 84,101,120, 68,120, 46,121, 41, 32, 41, 32, 42, 32,110,111,114,109, 97,108,105,122,101, 40,118, 82, 49, 41, 32, 43, 32, 10, 9, - 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,100, 66,116, 32, 47, 32,108,101,110,103,116,104, 40, 32,118,101, 99, 50, 40,105, -109, 97, 95,120, 42, 84,101,120, 68,121, 46,120, 44, 32,105,109, 97, 95,121, 42, 84,101,120, 68,121, 46,121, 41, 32, 41, 32, 42, - 32,110,111,114,109, 97,108,105,122,101, 40,118, 82, 50, 41, 32, 41, 59, 10, 9,112,101,114,116,117,114, 98,101,100, 95,110,111, -114,109, 32, 61, 32,110,111,114,109, 97,108,105,122,101, 40, 32,118, 78, 32, 45, 32,118, 83,117,114,102, 71,114, 97,100, 32, 41, - 59, 10, 9, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95,110,101,103, 97,116,101, 95,116,101,120,110,111,114,109, 97, +118, 97,114,115, 40,102, 97, 99,116, 44, 32,102, 97, 99,103, 44, 32,102, 97, 99,109, 41, 59, 10, 10, 9,105,102, 40,116,101,120, + 99,111,108, 32, 33, 61, 32, 48, 46, 48, 41, 10, 9, 9,105,110, 99,111,108, 32, 61, 32,102, 97, 99,109, 42,111,117,116, 99,111, +108, 32, 43, 32,102, 97, 99,116, 42,111,117,116, 99,111,108, 47,116,101,120, 99,111,108, 59, 10, 9,101,108,115,101, 10, 9, 9, +105,110, 99,111,108, 32, 61, 32, 48, 46, 48, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95,118, 97,108,117,101, 95, +100,105,102,102, 40,102,108,111, 97,116, 32,111,117,116, 99,111,108, 44, 32,102,108,111, 97,116, 32,116,101,120, 99,111,108, 44, + 32,102,108,111, 97,116, 32,102, 97, 99,116, 44, 32,102,108,111, 97,116, 32,102, 97, 99,103, 44, 32,111,117,116, 32,102,108,111, + 97,116, 32,105,110, 99,111,108, 41, 10,123, 10, 9,102,108,111, 97,116, 32,102, 97, 99,109, 59, 10, 9,109,116,101,120, 95,118, + 97,108,117,101, 95,118, 97,114,115, 40,102, 97, 99,116, 44, 32,102, 97, 99,103, 44, 32,102, 97, 99,109, 41, 59, 10, 10, 9,105, +110, 99,111,108, 32, 61, 32,102, 97, 99,109, 42,111,117,116, 99,111,108, 32, 43, 32,102, 97, 99,116, 42, 97, 98,115, 40,116,101, +120, 99,111,108, 32, 45, 32,111,117,116, 99,111,108, 41, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95,118, 97,108, +117,101, 95,100, 97,114,107, 40,102,108,111, 97,116, 32,111,117,116, 99,111,108, 44, 32,102,108,111, 97,116, 32,116,101,120, 99, +111,108, 44, 32,102,108,111, 97,116, 32,102, 97, 99,116, 44, 32,102,108,111, 97,116, 32,102, 97, 99,103, 44, 32,111,117,116, 32, +102,108,111, 97,116, 32,105,110, 99,111,108, 41, 10,123, 10, 9,102,108,111, 97,116, 32,102, 97, 99,109, 59, 10, 9,109,116,101, +120, 95,118, 97,108,117,101, 95,118, 97,114,115, 40,102, 97, 99,116, 44, 32,102, 97, 99,103, 44, 32,102, 97, 99,109, 41, 59, 10, + 10, 9,102,108,111, 97,116, 32, 99,111,108, 32, 61, 32,102, 97, 99,116, 42,116,101,120, 99,111,108, 59, 10, 9,105,102, 40, 99, +111,108, 32, 60, 32,111,117,116, 99,111,108, 41, 32,105,110, 99,111,108, 32, 61, 32, 99,111,108, 59, 32,101,108,115,101, 32,105, +110, 99,111,108, 32, 61, 32,111,117,116, 99,111,108, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95,118, 97,108,117, +101, 95,108,105,103,104,116, 40,102,108,111, 97,116, 32,111,117,116, 99,111,108, 44, 32,102,108,111, 97,116, 32,116,101,120, 99, +111,108, 44, 32,102,108,111, 97,116, 32,102, 97, 99,116, 44, 32,102,108,111, 97,116, 32,102, 97, 99,103, 44, 32,111,117,116, 32, +102,108,111, 97,116, 32,105,110, 99,111,108, 41, 10,123, 10, 9,102,108,111, 97,116, 32,102, 97, 99,109, 59, 10, 9,109,116,101, +120, 95,118, 97,108,117,101, 95,118, 97,114,115, 40,102, 97, 99,116, 44, 32,102, 97, 99,103, 44, 32,102, 97, 99,109, 41, 59, 10, + 10, 9,102,108,111, 97,116, 32, 99,111,108, 32, 61, 32,102, 97, 99,116, 42,116,101,120, 99,111,108, 59, 10, 9,105,102, 40, 99, +111,108, 32, 62, 32,111,117,116, 99,111,108, 41, 32,105,110, 99,111,108, 32, 61, 32, 99,111,108, 59, 32,101,108,115,101, 32,105, +110, 99,111,108, 32, 61, 32,111,117,116, 99,111,108, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95,118, 97,108,117, +101, 95, 99,108, 97,109,112, 95,112,111,115,105,116,105,118,101, 40,102,108,111, 97,116, 32,102, 97, 99, 44, 32,111,117,116, 32, +102,108,111, 97,116, 32,111,117,116,102, 97, 99, 41, 10,123, 10, 9,111,117,116,102, 97, 99, 32, 61, 32,109, 97,120, 40,102, 97, + 99, 44, 32, 48, 46, 48, 41, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95,118, 97,108,117,101, 95, 99,108, 97,109, +112, 40,102,108,111, 97,116, 32,102, 97, 99, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,102, 97, 99, 41, 10,123, + 10, 9,111,117,116,102, 97, 99, 32, 61, 32, 99,108, 97,109,112, 40,102, 97, 99, 44, 32, 48, 46, 48, 44, 32, 49, 46, 48, 41, 59, + 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95,104, 97,114, 95,100,105,118,105,100,101, 40,102,108,111, 97,116, 32,104, + 97,114, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,104, 97,114, 41, 10,123, 10, 9,111,117,116,104, 97,114, 32, + 61, 32,104, 97,114, 47, 49, 50, 56, 46, 48, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95,104, 97,114, 95,109,117, +108,116,105,112,108,121, 95, 99,108, 97,109,112, 40,102,108,111, 97,116, 32,104, 97,114, 44, 32,111,117,116, 32,102,108,111, 97, +116, 32,111,117,116,104, 97,114, 41, 10,123, 10, 9,104, 97,114, 32, 42, 61, 32, 49, 50, 56, 46, 48, 59, 10, 10, 9,105,102, 40, +104, 97,114, 32, 60, 32, 49, 46, 48, 41, 32,111,117,116,104, 97,114, 32, 61, 32, 49, 46, 48, 59, 10, 9,101,108,115,101, 32,105, +102, 40,104, 97,114, 32, 62, 32, 53, 49, 49, 46, 48, 41, 32,111,117,116,104, 97,114, 32, 61, 32, 53, 49, 49, 46, 48, 59, 10, 9, +101,108,115,101, 32,111,117,116,104, 97,114, 32, 61, 32,104, 97,114, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95, + 97,108,112,104, 97, 95,102,114,111,109, 95, 99,111,108, 40,118,101, 99, 52, 32, 99,111,108, 44, 32,111,117,116, 32,102,108,111, + 97,116, 32, 97,108,112,104, 97, 41, 10,123, 10, 9, 97,108,112,104, 97, 32, 61, 32, 99,111,108, 46, 97, 59, 10,125, 10, 10,118, +111,105,100, 32,109,116,101,120, 95, 97,108,112,104, 97, 95,116,111, 95, 99,111,108, 40,118,101, 99, 52, 32, 99,111,108, 44, 32, +102,108,111, 97,116, 32, 97,108,112,104, 97, 44, 32,111,117,116, 32,118,101, 99, 52, 32,111,117,116, 99,111,108, 41, 10,123, 10, + 9,111,117,116, 99,111,108, 32, 61, 32,118,101, 99, 52, 40, 99,111,108, 46,114,103, 98, 44, 32, 97,108,112,104, 97, 41, 59, 10, +125, 10, 10,118,111,105,100, 32,109,116,101,120, 95,114,103, 98,116,111,105,110,116, 40,118,101, 99, 52, 32,114,103, 98, 44, 32, +111,117,116, 32,102,108,111, 97,116, 32,105,110,116,101,110,115,105,116,121, 41, 10,123, 10, 9,105,110,116,101,110,115,105,116, +121, 32, 61, 32,100,111,116, 40,118,101, 99, 51, 40, 48, 46, 51, 53, 44, 32, 48, 46, 52, 53, 44, 32, 48, 46, 50, 41, 44, 32,114, +103, 98, 46,114,103, 98, 41, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95,118, 97,108,117,101, 95,105,110,118,101, +114,116, 40,102,108,111, 97,116, 32,105,110,118, 97,108,117,101, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, + 97,108,117,101, 41, 10,123, 10, 9,111,117,116,118, 97,108,117,101, 32, 61, 32, 49, 46, 48, 32, 45, 32,105,110,118, 97,108,117, +101, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95,114,103, 98, 95,105,110,118,101,114,116, 40,118,101, 99, 52, 32, +105,110,114,103, 98, 44, 32,111,117,116, 32,118,101, 99, 52, 32,111,117,116,114,103, 98, 41, 10,123, 10, 9,111,117,116,114,103, + 98, 32, 61, 32,118,101, 99, 52, 40,118,101, 99, 51, 40, 49, 46, 48, 41, 32, 45, 32,105,110,114,103, 98, 46,114,103, 98, 44, 32, +105,110,114,103, 98, 46, 97, 41, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95,118, 97,108,117,101, 95,115,116,101, +110, 99,105,108, 40,102,108,111, 97,116, 32,115,116,101,110, 99,105,108, 44, 32,102,108,111, 97,116, 32,105,110,116,101,110,115, +105,116,121, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,115,116,101,110, 99,105,108, 44, 32,111,117,116, 32,102, +108,111, 97,116, 32,111,117,116,105,110,116,101,110,115,105,116,121, 41, 10,123, 10, 9,102,108,111, 97,116, 32,102, 97, 99,116, + 32, 61, 32,105,110,116,101,110,115,105,116,121, 59, 10, 9,111,117,116,105,110,116,101,110,115,105,116,121, 32, 61, 32,105,110, +116,101,110,115,105,116,121, 42,115,116,101,110, 99,105,108, 59, 10, 9,111,117,116,115,116,101,110, 99,105,108, 32, 61, 32,115, +116,101,110, 99,105,108, 42,102, 97, 99,116, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95,114,103, 98, 95,115,116, +101,110, 99,105,108, 40,102,108,111, 97,116, 32,115,116,101,110, 99,105,108, 44, 32,118,101, 99, 52, 32,114,103, 98, 44, 32,111, +117,116, 32,102,108,111, 97,116, 32,111,117,116,115,116,101,110, 99,105,108, 44, 32,111,117,116, 32,118,101, 99, 52, 32,111,117, +116,114,103, 98, 41, 10,123, 10, 9,102,108,111, 97,116, 32,102, 97, 99,116, 32, 61, 32,114,103, 98, 46, 97, 59, 10, 9,111,117, +116,114,103, 98, 32, 61, 32,118,101, 99, 52, 40,114,103, 98, 46,114,103, 98, 44, 32,114,103, 98, 46, 97, 42,115,116,101,110, 99, +105,108, 41, 59, 10, 9,111,117,116,115,116,101,110, 99,105,108, 32, 61, 32,115,116,101,110, 99,105,108, 42,102, 97, 99,116, 59, + 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95,109, 97,112,112,105,110,103, 95,111,102,115, 40,118,101, 99, 51, 32,116, +101,120, 99,111, 44, 32,118,101, 99, 51, 32,111,102,115, 44, 32,111,117,116, 32,118,101, 99, 51, 32,111,117,116,116,101,120, 99, +111, 41, 10,123, 10, 9,111,117,116,116,101,120, 99,111, 32, 61, 32,116,101,120, 99,111, 32, 43, 32,111,102,115, 59, 10,125, 10, + 10,118,111,105,100, 32,109,116,101,120, 95,109, 97,112,112,105,110,103, 95,115,105,122,101, 40,118,101, 99, 51, 32,116,101,120, + 99,111, 44, 32,118,101, 99, 51, 32,115,105,122,101, 44, 32,111,117,116, 32,118,101, 99, 51, 32,111,117,116,116,101,120, 99,111, + 41, 10,123, 10, 9,111,117,116,116,101,120, 99,111, 32, 61, 32,115,105,122,101, 42,116,101,120, 99,111, 59, 10,125, 10, 10,118, +111,105,100, 32,109,116,101,120, 95, 50,100, 95,109, 97,112,112,105,110,103, 40,118,101, 99, 51, 32,118,101, 99, 44, 32,111,117, +116, 32,118,101, 99, 51, 32,111,117,116,118,101, 99, 41, 10,123, 10, 9,111,117,116,118,101, 99, 32, 61, 32,118,101, 99, 51, 40, +118,101, 99, 46,120,121, 42, 48, 46, 53, 32, 43, 32,118,101, 99, 50, 40, 48, 46, 53, 44, 32, 48, 46, 53, 41, 44, 32,118,101, 99, + 46,122, 41, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95,105,109, 97,103,101, 40,118,101, 99, 51, 32,116,101,120, + 99,111, 44, 32,115, 97,109,112,108,101,114, 50, 68, 32,105,109, 97, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,118, 97,108, +117,101, 44, 32,111,117,116, 32,118,101, 99, 52, 32, 99,111,108,111,114, 41, 10,123, 10, 9, 99,111,108,111,114, 32, 61, 32,116, +101,120,116,117,114,101, 50, 68, 40,105,109, 97, 44, 32,116,101,120, 99,111, 46,120,121, 41, 59, 10, 9,118, 97,108,117,101, 32, + 61, 32, 49, 46, 48, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95,110,111,114,109, 97,108, 40,118,101, 99, 51, 32, +116,101,120, 99,111, 44, 32,115, 97,109,112,108,101,114, 50, 68, 32,105,109, 97, 44, 32,111,117,116, 32,118,101, 99, 51, 32,110, +111,114,109, 97,108, 41, 10,123, 10, 32, 32, 32, 32,118,101, 99, 52, 32, 99,111,108,111,114, 32, 61, 32,116,101,120,116,117,114, +101, 50, 68, 40,105,109, 97, 44, 32,116,101,120, 99,111, 46,120,121, 41, 59, 10, 9,110,111,114,109, 97,108, 32, 61, 32, 50, 46, + 48, 42, 40,118,101, 99, 51, 40, 99,111,108,111,114, 46,114, 44, 32, 45, 99,111,108,111,114, 46,103, 44, 32, 99,111,108,111,114, + 46, 98, 41, 32, 45, 32,118,101, 99, 51, 40, 48, 46, 53, 44, 32, 45, 48, 46, 53, 44, 32, 48, 46, 53, 41, 41, 59, 10,125, 10, 10, +118,111,105,100, 32,109,116,101,120, 95, 98,117,109,112, 95,110,111,114,109, 97,108,115, 95,105,110,105,116, 40, 32,118,101, 99, + 51, 32,118, 78, 44, 32,111,117,116, 32,118,101, 99, 51, 32,118, 78,111,114,103, 44, 32,111,117,116, 32,118,101, 99, 51, 32,118, + 78, 97, 99, 99, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,102, 80,114,101,118, 77, 97,103,110,105,116,117,100,101, 32, 41, + 10,123, 10, 9,118, 78,111,114,103, 32, 61, 32,118, 78, 59, 10, 9,118, 78, 97, 99, 99, 32, 61, 32,118, 78, 59, 10, 9,102, 80, +114,101,118, 77, 97,103,110,105,116,117,100,101, 32, 61, 32, 49, 46, 48, 59, 10,125, 10, 10, 47, 42, 42, 32,104,101,108,112,101, +114, 32,109,101,116,104,111,100, 32,116,111, 32,101,120,116,114, 97, 99,116, 32,116,104,101, 32,117,112,112,101,114, 32,108,101, +102,116, 32, 51,120, 51, 32,109, 97,116,114,105,120, 32,102,114,111,109, 32, 97, 32, 52,120, 52, 32,109, 97,116,114,105,120, 32, + 42, 47, 10,109, 97,116, 51, 32,116,111, 95,109, 97,116, 51, 40,109, 97,116, 52, 32,109, 52, 41, 10,123, 10, 9,109, 97,116, 51, + 32,109, 51, 59, 10, 9,109, 51, 91, 48, 93, 32, 61, 32,109, 52, 91, 48, 93, 46,120,121,122, 59, 10, 9,109, 51, 91, 49, 93, 32, + 61, 32,109, 52, 91, 49, 93, 46,120,121,122, 59, 10, 9,109, 51, 91, 50, 93, 32, 61, 32,109, 52, 91, 50, 93, 46,120,121,122, 59, + 10, 9,114,101,116,117,114,110, 32,109, 51, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95, 98,117,109,112, 95,105, +110,105,116, 95,111, 98,106,115,112, 97, 99,101, 40, 32,118,101, 99, 51, 32,115,117,114,102, 95,112,111,115, 44, 32,118,101, 99, + 51, 32,115,117,114,102, 95,110,111,114,109, 44, 10, 9, 9, 9, 9, 9, 9, 9, 32, 32,109, 97,116, 52, 32,109, 86,105,101,119, + 44, 32,109, 97,116, 52, 32,109, 86,105,101,119, 73,110,118, 44, 32,109, 97,116, 52, 32,109, 79, 98,106, 44, 32,109, 97,116, 52, + 32,109, 79, 98,106, 73,110,118, 44, 32, 10, 9, 9, 9, 9, 9, 9, 9, 32, 32,102,108,111, 97,116, 32,102, 80,114,101,118, 77, + 97,103,110,105,116,117,100,101, 95,105,110, 44, 32,118,101, 99, 51, 32,118, 78, 97, 99, 99, 95,105,110, 44, 10, 9, 9, 9, 9, + 9, 9, 9, 32, 32,111,117,116, 32,102,108,111, 97,116, 32,102, 80,114,101,118, 77, 97,103,110,105,116,117,100,101, 95,111,117, +116, 44, 32,111,117,116, 32,118,101, 99, 51, 32,118, 78, 97, 99, 99, 95,111,117,116, 44, 32, 10, 9, 9, 9, 9, 9, 9, 9, 32, + 32,111,117,116, 32,118,101, 99, 51, 32,118, 82, 49, 44, 32,111,117,116, 32,118,101, 99, 51, 32,118, 82, 50, 44, 32,111,117,116, + 32,102,108,111, 97,116, 32,102, 68,101,116, 32, 41, 32, 10,123, 10, 9,109, 97,116, 51, 32,111, 98,106, 50,118,105,101,119, 32, + 61, 32,116,111, 95,109, 97,116, 51, 40,109, 86,105,101,119, 32, 42, 32,109, 79, 98,106, 41, 59, 10, 9,109, 97,116, 51, 32,118, +105,101,119, 50,111, 98,106, 32, 61, 32,116,111, 95,109, 97,116, 51, 40,109, 79, 98,106, 73,110,118, 32, 42, 32,109, 86,105,101, +119, 73,110,118, 41, 59, 10, 9, 10, 9,118,101, 99, 51, 32,118, 83,105,103,109, 97, 83, 32, 61, 32,118,105,101,119, 50,111, 98, +106, 32, 42, 32,100, 70,100,120, 40, 32,115,117,114,102, 95,112,111,115, 32, 41, 59, 10, 9,118,101, 99, 51, 32,118, 83,105,103, +109, 97, 84, 32, 61, 32,118,105,101,119, 50,111, 98,106, 32, 42, 32,100, 70,100,121, 40, 32,115,117,114,102, 95,112,111,115, 32, + 41, 59, 10, 9,118,101, 99, 51, 32,118, 78, 32, 61, 32,110,111,114,109, 97,108,105,122,101, 40, 32,115,117,114,102, 95,110,111, +114,109, 32, 42, 32,111, 98,106, 50,118,105,101,119, 32, 41, 59, 10, 10, 9,118, 82, 49, 32, 61, 32, 99,114,111,115,115, 40, 32, +118, 83,105,103,109, 97, 84, 44, 32,118, 78, 32, 41, 59, 10, 9,118, 82, 50, 32, 61, 32, 99,114,111,115,115, 40, 32,118, 78, 44, + 32,118, 83,105,103,109, 97, 83, 32, 41, 32, 59, 10, 9,102, 68,101,116, 32, 61, 32,100,111,116, 32, 40, 32,118, 83,105,103,109, + 97, 83, 44, 32,118, 82, 49, 32, 41, 59, 10, 9, 10, 9, 47, 42, 32,112,114,101,116,114, 97,110,115,102,111,114,109, 32,118, 78, + 97, 99, 99, 32, 40,105,110, 32,109,116,101,120, 95, 98,117,109,112, 95, 97,112,112,108,121, 41, 32,117,115,105,110,103, 32,116, +104,101, 32,105,110,118,101,114,115,101, 32,116,114, 97,110,115,112,111,115,101,100, 32, 42, 47, 10, 9,118, 82, 49, 32, 61, 32, +118, 82, 49, 32, 42, 32,118,105,101,119, 50,111, 98,106, 59, 10, 9,118, 82, 50, 32, 61, 32,118, 82, 50, 32, 42, 32,118,105,101, +119, 50,111, 98,106, 59, 10, 9,118, 78, 32, 61, 32,118, 78, 32, 42, 32,118,105,101,119, 50,111, 98,106, 59, 10, 9, 10, 9,102, +108,111, 97,116, 32,102, 77, 97,103,110,105,116,117,100,101, 32, 61, 32, 97, 98,115, 40,102, 68,101,116, 41, 32, 42, 32,108,101, +110,103,116,104, 40,118, 78, 41, 59, 10, 9,118, 78, 97, 99, 99, 95,111,117,116, 32, 61, 32,118, 78, 97, 99, 99, 95,105,110, 32, + 42, 32, 40,102, 77, 97,103,110,105,116,117,100,101, 32, 47, 32,102, 80,114,101,118, 77, 97,103,110,105,116,117,100,101, 95,105, +110, 41, 59, 10, 9,102, 80,114,101,118, 77, 97,103,110,105,116,117,100,101, 95,111,117,116, 32, 61, 32,102, 77, 97,103,110,105, +116,117,100,101, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95, 98,117,109,112, 95,105,110,105,116, 95,116,101,120, +116,117,114,101,115,112, 97, 99,101, 40, 32,118,101, 99, 51, 32,115,117,114,102, 95,112,111,115, 44, 32,118,101, 99, 51, 32,115, +117,114,102, 95,110,111,114,109, 44, 32, 10, 9, 9, 9, 9, 9, 9, 9, 9, 32, 32,102,108,111, 97,116, 32,102, 80,114,101,118, + 77, 97,103,110,105,116,117,100,101, 95,105,110, 44, 32,118,101, 99, 51, 32,118, 78, 97, 99, 99, 95,105,110, 44, 10, 9, 9, 9, + 9, 9, 9, 9, 9, 32, 32,111,117,116, 32,102,108,111, 97,116, 32,102, 80,114,101,118, 77, 97,103,110,105,116,117,100,101, 95, +111,117,116, 44, 32,111,117,116, 32,118,101, 99, 51, 32,118, 78, 97, 99, 99, 95,111,117,116, 44, 32, 10, 9, 9, 9, 9, 9, 9, + 9, 9, 32, 32,111,117,116, 32,118,101, 99, 51, 32,118, 82, 49, 44, 32,111,117,116, 32,118,101, 99, 51, 32,118, 82, 50, 44, 32, +111,117,116, 32,102,108,111, 97,116, 32,102, 68,101,116, 32, 41, 32, 10,123, 10, 9,118,101, 99, 51, 32,118, 83,105,103,109, 97, + 83, 32, 61, 32,100, 70,100,120, 40, 32,115,117,114,102, 95,112,111,115, 32, 41, 59, 10, 9,118,101, 99, 51, 32,118, 83,105,103, +109, 97, 84, 32, 61, 32,100, 70,100,121, 40, 32,115,117,114,102, 95,112,111,115, 32, 41, 59, 10, 9,118,101, 99, 51, 32,118, 78, + 32, 61, 32,115,117,114,102, 95,110,111,114,109, 59, 32, 47, 42, 32,110,111,114,109, 97,108,105,122,101,100, 32,105,110,116,101, +114,112,111,108, 97,116,101,100, 32,118,101,114,116,101,120, 32,110,111,114,109, 97,108, 32, 42, 47, 10, 9, 10, 9,118, 82, 49, + 32, 61, 32,110,111,114,109, 97,108,105,122,101, 40, 32, 99,114,111,115,115, 40, 32,118, 83,105,103,109, 97, 84, 44, 32,118, 78, + 32, 41, 32, 41, 59, 10, 9,118, 82, 50, 32, 61, 32,110,111,114,109, 97,108,105,122,101, 40, 32, 99,114,111,115,115, 40, 32,118, + 78, 44, 32,118, 83,105,103,109, 97, 83, 32, 41, 32, 41, 59, 10, 9,102, 68,101,116, 32, 61, 32,115,105,103,110, 40, 32,100,111, +116, 40,118, 83,105,103,109, 97, 83, 44, 32,118, 82, 49, 41, 32, 41, 59, 10, 9, 10, 9,102,108,111, 97,116, 32,102, 77, 97,103, +110,105,116,117,100,101, 32, 61, 32, 97, 98,115, 40,102, 68,101,116, 41, 59, 10, 9,118, 78, 97, 99, 99, 95,111,117,116, 32, 61, + 32,118, 78, 97, 99, 99, 95,105,110, 32, 42, 32, 40,102, 77, 97,103,110,105,116,117,100,101, 32, 47, 32,102, 80,114,101,118, 77, + 97,103,110,105,116,117,100,101, 95,105,110, 41, 59, 10, 9,102, 80,114,101,118, 77, 97,103,110,105,116,117,100,101, 95,111,117, +116, 32, 61, 32,102, 77, 97,103,110,105,116,117,100,101, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95, 98,117,109, +112, 95,105,110,105,116, 95,118,105,101,119,115,112, 97, 99,101, 40, 32,118,101, 99, 51, 32,115,117,114,102, 95,112,111,115, 44, + 32,118,101, 99, 51, 32,115,117,114,102, 95,110,111,114,109, 44, 32, 10, 9, 9, 9, 9, 9, 9, 9, 32, 32, 32,102,108,111, 97, +116, 32,102, 80,114,101,118, 77, 97,103,110,105,116,117,100,101, 95,105,110, 44, 32,118,101, 99, 51, 32,118, 78, 97, 99, 99, 95, +105,110, 44, 10, 9, 9, 9, 9, 9, 9, 9, 32, 32, 32,111,117,116, 32,102,108,111, 97,116, 32,102, 80,114,101,118, 77, 97,103, +110,105,116,117,100,101, 95,111,117,116, 44, 32,111,117,116, 32,118,101, 99, 51, 32,118, 78, 97, 99, 99, 95,111,117,116, 44, 32, + 10, 9, 9, 9, 9, 9, 9, 9, 32, 32, 32,111,117,116, 32,118,101, 99, 51, 32,118, 82, 49, 44, 32,111,117,116, 32,118,101, 99, + 51, 32,118, 82, 50, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,102, 68,101,116, 32, 41, 32, 10,123, 10, 9,118,101, 99, 51, + 32,118, 83,105,103,109, 97, 83, 32, 61, 32,100, 70,100,120, 40, 32,115,117,114,102, 95,112,111,115, 32, 41, 59, 10, 9,118,101, + 99, 51, 32,118, 83,105,103,109, 97, 84, 32, 61, 32,100, 70,100,121, 40, 32,115,117,114,102, 95,112,111,115, 32, 41, 59, 10, 9, +118,101, 99, 51, 32,118, 78, 32, 61, 32,115,117,114,102, 95,110,111,114,109, 59, 32, 47, 42, 32,110,111,114,109, 97,108,105,122, +101,100, 32,105,110,116,101,114,112,111,108, 97,116,101,100, 32,118,101,114,116,101,120, 32,110,111,114,109, 97,108, 32, 42, 47, + 10, 9, 10, 9,118, 82, 49, 32, 61, 32, 99,114,111,115,115, 40, 32,118, 83,105,103,109, 97, 84, 44, 32,118, 78, 32, 41, 59, 10, + 9,118, 82, 50, 32, 61, 32, 99,114,111,115,115, 40, 32,118, 78, 44, 32,118, 83,105,103,109, 97, 83, 32, 41, 32, 59, 10, 9,102, + 68,101,116, 32, 61, 32,100,111,116, 32, 40, 32,118, 83,105,103,109, 97, 83, 44, 32,118, 82, 49, 32, 41, 59, 10, 9, 10, 9,102, +108,111, 97,116, 32,102, 77, 97,103,110,105,116,117,100,101, 32, 61, 32, 97, 98,115, 40,102, 68,101,116, 41, 59, 10, 9,118, 78, + 97, 99, 99, 95,111,117,116, 32, 61, 32,118, 78, 97, 99, 99, 95,105,110, 32, 42, 32, 40,102, 77, 97,103,110,105,116,117,100,101, + 32, 47, 32,102, 80,114,101,118, 77, 97,103,110,105,116,117,100,101, 95,105,110, 41, 59, 10, 9,102, 80,114,101,118, 77, 97,103, +110,105,116,117,100,101, 95,111,117,116, 32, 61, 32,102, 77, 97,103,110,105,116,117,100,101, 59, 10,125, 10, 10,118,111,105,100, + 32,109,116,101,120, 95, 98,117,109,112, 95,116, 97,112, 51, 40, 32,118,101, 99, 51, 32,116,101,120, 99,111, 44, 32,115, 97,109, +112,108,101,114, 50, 68, 32,105,109, 97, 44, 32,102,108,111, 97,116, 32,104, 83, 99, 97,108,101, 44, 32, 10, 32, 32, 32, 32, 32, + 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,111,117,116, 32,102,108,111, 97,116, 32,100, 66,115, 44, 32,111, +117,116, 32,102,108,111, 97,116, 32,100, 66,116, 32, 41, 32, 10,123, 10, 9,118,101, 99, 50, 32, 83, 84,108,108, 32, 61, 32,116, +101,120, 99,111, 46,120,121, 59, 10, 9,118,101, 99, 50, 32, 83, 84,108,114, 32, 61, 32,116,101,120, 99,111, 46,120,121, 32, 43, + 32,100, 70,100,120, 40,116,101,120, 99,111, 46,120,121, 41, 32, 59, 10, 9,118,101, 99, 50, 32, 83, 84,117,108, 32, 61, 32,116, +101,120, 99,111, 46,120,121, 32, 43, 32,100, 70,100,121, 40,116,101,120, 99,111, 46,120,121, 41, 32, 59, 10, 9, 10, 9,102,108, +111, 97,116, 32, 72,108,108, 44, 72,108,114, 44, 72,117,108, 59, 10, 9,114,103, 98,116,111, 98,119, 40, 32,116,101,120,116,117, +114,101, 50, 68, 40,105,109, 97, 44, 32, 83, 84,108,108, 41, 44, 32, 72,108,108, 32, 41, 59, 10, 9,114,103, 98,116,111, 98,119, + 40, 32,116,101,120,116,117,114,101, 50, 68, 40,105,109, 97, 44, 32, 83, 84,108,114, 41, 44, 32, 72,108,114, 32, 41, 59, 10, 9, +114,103, 98,116,111, 98,119, 40, 32,116,101,120,116,117,114,101, 50, 68, 40,105,109, 97, 44, 32, 83, 84,117,108, 41, 44, 32, 72, +117,108, 32, 41, 59, 10, 9, 10, 9,100, 66,115, 32, 61, 32,104, 83, 99, 97,108,101, 32, 42, 32, 40, 72,108,114, 32, 45, 32, 72, +108,108, 41, 59, 10, 9,100, 66,116, 32, 61, 32,104, 83, 99, 97,108,101, 32, 42, 32, 40, 72,117,108, 32, 45, 32, 72,108,108, 41, + 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95, 98,117,109,112, 95,116, 97,112, 53, 40, 32,118,101, 99, 51, 32,116, +101,120, 99,111, 44, 32,115, 97,109,112,108,101,114, 50, 68, 32,105,109, 97, 44, 32,102,108,111, 97,116, 32,104, 83, 99, 97,108, +101, 44, 32, 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,111,117,116, 32,102,108,111, + 97,116, 32,100, 66,115, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,100, 66,116, 32, 41, 32, 10,123, 10, 9,118,101, 99, 50, + 32, 84,101,120, 68,120, 32, 61, 32,100, 70,100,120, 40,116,101,120, 99,111, 46,120,121, 41, 59, 10, 9,118,101, 99, 50, 32, 84, +101,120, 68,121, 32, 61, 32,100, 70,100,121, 40,116,101,120, 99,111, 46,120,121, 41, 59, 10, 10, 9,118,101, 99, 50, 32, 83, 84, + 99, 32, 61, 32,116,101,120, 99,111, 46,120,121, 59, 10, 9,118,101, 99, 50, 32, 83, 84,108, 32, 61, 32,116,101,120, 99,111, 46, +120,121, 32, 45, 32, 48, 46, 53, 32, 42, 32, 84,101,120, 68,120, 32, 59, 10, 9,118,101, 99, 50, 32, 83, 84,114, 32, 61, 32,116, +101,120, 99,111, 46,120,121, 32, 43, 32, 48, 46, 53, 32, 42, 32, 84,101,120, 68,120, 32, 59, 10, 9,118,101, 99, 50, 32, 83, 84, +100, 32, 61, 32,116,101,120, 99,111, 46,120,121, 32, 45, 32, 48, 46, 53, 32, 42, 32, 84,101,120, 68,121, 32, 59, 10, 9,118,101, + 99, 50, 32, 83, 84,117, 32, 61, 32,116,101,120, 99,111, 46,120,121, 32, 43, 32, 48, 46, 53, 32, 42, 32, 84,101,120, 68,121, 32, + 59, 10, 9, 10, 9,102,108,111, 97,116, 32, 72, 99, 44, 72,108, 44, 72,114, 44, 72,100, 44, 72,117, 59, 10, 9,114,103, 98,116, +111, 98,119, 40, 32,116,101,120,116,117,114,101, 50, 68, 40,105,109, 97, 44, 32, 83, 84, 99, 41, 44, 32, 72, 99, 32, 41, 59, 10, + 9,114,103, 98,116,111, 98,119, 40, 32,116,101,120,116,117,114,101, 50, 68, 40,105,109, 97, 44, 32, 83, 84,108, 41, 44, 32, 72, +108, 32, 41, 59, 10, 9,114,103, 98,116,111, 98,119, 40, 32,116,101,120,116,117,114,101, 50, 68, 40,105,109, 97, 44, 32, 83, 84, +114, 41, 44, 32, 72,114, 32, 41, 59, 10, 9,114,103, 98,116,111, 98,119, 40, 32,116,101,120,116,117,114,101, 50, 68, 40,105,109, + 97, 44, 32, 83, 84,100, 41, 44, 32, 72,100, 32, 41, 59, 10, 9,114,103, 98,116,111, 98,119, 40, 32,116,101,120,116,117,114,101, + 50, 68, 40,105,109, 97, 44, 32, 83, 84,117, 41, 44, 32, 72,117, 32, 41, 59, 10, 9, 10, 9,100, 66,115, 32, 61, 32,104, 83, 99, + 97,108,101, 32, 42, 32, 40, 72,114, 32, 45, 32, 72,108, 41, 59, 10, 9,100, 66,116, 32, 61, 32,104, 83, 99, 97,108,101, 32, 42, + 32, 40, 72,117, 32, 45, 32, 72,100, 41, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95, 98,117,109,112, 95, 97,112, +112,108,121, 40, 32,102,108,111, 97,116, 32,102, 68,101,116, 44, 32,102,108,111, 97,116, 32,100, 66,115, 44, 32,102,108,111, 97, +116, 32,100, 66,116, 44, 32,118,101, 99, 51, 32,118, 82, 49, 44, 32,118,101, 99, 51, 32,118, 82, 50, 44, 32,118,101, 99, 51, 32, +118, 78, 97, 99, 99, 95,105,110, 44, 10, 9, 9, 9, 9, 9, 32, 32,111,117,116, 32,118,101, 99, 51, 32,118, 78, 97, 99, 99, 95, +111,117,116, 44, 32,111,117,116, 32,118,101, 99, 51, 32,112,101,114,116,117,114, 98,101,100, 95,110,111,114,109, 32, 41, 32, 10, +123, 10, 9,118,101, 99, 51, 32,118, 83,117,114,102, 71,114, 97,100, 32, 61, 32,115,105,103,110, 40,102, 68,101,116, 41, 32, 42, + 32, 40, 32,100, 66,115, 32, 42, 32,118, 82, 49, 32, 43, 32,100, 66,116, 32, 42, 32,118, 82, 50, 32, 41, 59, 10, 9, 10, 9,118, + 78, 97, 99, 99, 95,111,117,116, 32, 61, 32,118, 78, 97, 99, 99, 95,105,110, 32, 45, 32,118, 83,117,114,102, 71,114, 97,100, 59, + 10, 9,112,101,114,116,117,114, 98,101,100, 95,110,111,114,109, 32, 61, 32,110,111,114,109, 97,108,105,122,101, 40, 32,118, 78, + 97, 99, 99, 95,111,117,116, 32, 41, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95, 98,117,109,112, 95, 97,112,112, +108,121, 95,116,101,120,115,112, 97, 99,101, 40, 32,102,108,111, 97,116, 32,102, 68,101,116, 44, 32,102,108,111, 97,116, 32,100, + 66,115, 44, 32,102,108,111, 97,116, 32,100, 66,116, 44, 32,118,101, 99, 51, 32,118, 82, 49, 44, 32,118,101, 99, 51, 32,118, 82, + 50, 44, 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, + 32, 32,115, 97,109,112,108,101,114, 50, 68, 32,105,109, 97, 44, 32,118,101, 99, 51, 32,116,101,120, 99,111, 44, 32,102,108,111, + 97,116, 32,105,109, 97, 95,120, 44, 32,102,108,111, 97,116, 32,105,109, 97, 95,121, 44, 32,118,101, 99, 51, 32,118, 78, 97, 99, + 99, 95,105,110, 44, 10, 9, 9, 9, 9, 9, 9, 9, 32, 32, 32,111,117,116, 32,118,101, 99, 51, 32,118, 78, 97, 99, 99, 95,111, +117,116, 44, 32,111,117,116, 32,118,101, 99, 51, 32,112,101,114,116,117,114, 98,101,100, 95,110,111,114,109, 32, 41, 32, 10,123, + 10, 9,118,101, 99, 50, 32, 84,101,120, 68,120, 32, 61, 32,100, 70,100,120, 40,116,101,120, 99,111, 46,120,121, 41, 59, 10, 9, +118,101, 99, 50, 32, 84,101,120, 68,121, 32, 61, 32,100, 70,100,121, 40,116,101,120, 99,111, 46,120,121, 41, 59, 10, 10, 9,118, +101, 99, 51, 32,118, 83,117,114,102, 71,114, 97,100, 32, 61, 32,115,105,103,110, 40,102, 68,101,116, 41, 32, 42, 32, 40, 32, 10, + 9, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,100, 66,115, 32, 47, 32,108,101,110,103,116,104, 40, 32,118,101, 99, 50, 40, +105,109, 97, 95,120, 42, 84,101,120, 68,120, 46,120, 44, 32,105,109, 97, 95,121, 42, 84,101,120, 68,120, 46,121, 41, 32, 41, 32, + 42, 32,118, 82, 49, 32, 43, 32, 10, 9, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,100, 66,116, 32, 47, 32,108,101,110,103, +116,104, 40, 32,118,101, 99, 50, 40,105,109, 97, 95,120, 42, 84,101,120, 68,121, 46,120, 44, 32,105,109, 97, 95,121, 42, 84,101, +120, 68,121, 46,121, 41, 32, 41, 32, 42, 32,118, 82, 50, 32, 41, 59, 10, 9, 9, 9, 9, 10, 9,118, 78, 97, 99, 99, 95,111,117, +116, 32, 61, 32,118, 78, 97, 99, 99, 95,105,110, 32, 45, 32,118, 83,117,114,102, 71,114, 97,100, 59, 10, 9,112,101,114,116,117, +114, 98,101,100, 95,110,111,114,109, 32, 61, 32,110,111,114,109, 97,108,105,122,101, 40, 32,118, 78, 97, 99, 99, 95,111,117,116, + 32, 41, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95,110,101,103, 97,116,101, 95,116,101,120,110,111,114,109, 97, 108, 40,118,101, 99, 51, 32,110,111,114,109, 97,108, 44, 32,111,117,116, 32,118,101, 99, 51, 32,111,117,116,110,111,114,109, 97, 108, 41, 10,123, 10, 9,111,117,116,110,111,114,109, 97,108, 32, 61, 32,118,101, 99, 51, 40, 45,110,111,114,109, 97,108, 46,120, 44, 32, 45,110,111,114,109, 97,108, 46,121, 44, 32,110,111,114,109, 97,108, 46,122, 41, 59, 10,125, 10, 10,118,111,105,100, 32, diff --git a/source/blender/imbuf/IMB_thumbs.h b/source/blender/imbuf/IMB_thumbs.h index cae6edaefee..02f8e1567bf 100644 --- a/source/blender/imbuf/IMB_thumbs.h +++ b/source/blender/imbuf/IMB_thumbs.h @@ -75,6 +75,9 @@ void IMB_thumb_makedirs(void); ImBuf *IMB_loadblend_thumb(const char *path); void IMB_overlayblend_thumb(unsigned int *thumb, int width, int height, float aspect); +#ifdef __cplusplus +} +#endif /* __cplusplus */ #endif /* _IMB_THUMBS_H */ diff --git a/source/blender/imbuf/intern/allocimbuf.c b/source/blender/imbuf/intern/allocimbuf.c index fa823169966..99b3c3a58d6 100644 --- a/source/blender/imbuf/intern/allocimbuf.c +++ b/source/blender/imbuf/intern/allocimbuf.c @@ -299,8 +299,12 @@ short imb_addrectImBuf(ImBuf *ibuf) int size; if(ibuf==NULL) return FALSE; - imb_freerectImBuf(ibuf); - + + /* don't call imb_freerectImBuf, it frees mipmaps, this call is used only too give float buffers display */ + if(ibuf->rect && (ibuf->mall & IB_rect)) + MEM_freeN(ibuf->rect); + ibuf->rect= NULL; + size = ibuf->x*ibuf->y; size = size*sizeof(unsigned int); @@ -454,7 +458,7 @@ static MEM_CacheLimiterC **get_imbuf_cache_limiter(void) return &c; } -void IMB_free_cache_limiter() +void IMB_free_cache_limiter(void) { delete_MEM_CacheLimiter(*get_imbuf_cache_limiter()); *get_imbuf_cache_limiter() = 0; diff --git a/source/blender/imbuf/intern/jp2.c b/source/blender/imbuf/intern/jp2.c index c0f54898119..6f04740c778 100644 --- a/source/blender/imbuf/intern/jp2.c +++ b/source/blender/imbuf/intern/jp2.c @@ -69,21 +69,21 @@ int imb_is_a_jp2(unsigned char *buf) /** sample error callback expecting a FILE* client object */ -void error_callback(const char *msg, void *client_data) { +static void error_callback(const char *msg, void *client_data) { FILE *stream = (FILE*)client_data; fprintf(stream, "[ERROR] %s", msg); } /** sample warning callback expecting a FILE* client object */ -void warning_callback(const char *msg, void *client_data) { +static void warning_callback(const char *msg, void *client_data) { FILE *stream = (FILE*)client_data; fprintf(stream, "[WARNING] %s", msg); } /** sample debug callback expecting no client object */ -void info_callback(const char *msg, void *client_data) { +static void info_callback(const char *msg, void *client_data) { (void)client_data; fprintf(stdout, "[INFO] %s", msg); } @@ -322,7 +322,7 @@ static int initialise_4K_poc(opj_poc_t *POC, int numres){ return 2; } -void cinema_parameters(opj_cparameters_t *parameters){ +static void cinema_parameters(opj_cparameters_t *parameters){ parameters->tile_size_on = false; parameters->cp_tdx=1; parameters->cp_tdy=1; @@ -355,7 +355,7 @@ void cinema_parameters(opj_cparameters_t *parameters){ } -void cinema_setup_encoder(opj_cparameters_t *parameters,opj_image_t *image, img_fol_t *img_fol){ +static void cinema_setup_encoder(opj_cparameters_t *parameters,opj_image_t *image, img_fol_t *img_fol){ int i; float temp_rate; diff --git a/source/blender/imbuf/intern/thumbs.c b/source/blender/imbuf/intern/thumbs.c index 8abc2e89952..c0fd6584d6f 100644 --- a/source/blender/imbuf/intern/thumbs.c +++ b/source/blender/imbuf/intern/thumbs.c @@ -122,7 +122,7 @@ static const char hex[17] = "0123456789abcdef"; /* Note: This escape function works on file: URIs, but if you want to * escape something else, please read RFC-2396 */ -void escape_uri_string (const char *string, char* escaped_string, int len,UnsafeCharacterSet mask) +static void escape_uri_string (const char *string, char* escaped_string, int len,UnsafeCharacterSet mask) { #define ACCEPTABLE(a) ((a)>=32 && (a)<128 && (acceptable[(a)-32] & use_mask)) @@ -148,7 +148,7 @@ void escape_uri_string (const char *string, char* escaped_string, int len,Unsafe *q = '\0'; } -void to_hex_char(char* hexbytes, const unsigned char* bytes, int len) +static void to_hex_char(char* hexbytes, const unsigned char* bytes, int len) { const unsigned char *p; char *q; @@ -202,7 +202,7 @@ static int uri_from_filename( const char *path, char *uri ) return 1; } -static void thumbname_from_uri(const char* uri, char* thumb) +static void thumbname_from_uri(const char* uri, char* thumb, const int thumb_len) { char hexdigest[33]; unsigned char digest[16]; @@ -211,24 +211,24 @@ static void thumbname_from_uri(const char* uri, char* thumb) hexdigest[0] = '\0'; to_hex_char(hexdigest, digest, 16); hexdigest[32] = '\0'; - sprintf(thumb, "%s.png", hexdigest); + BLI_snprintf(thumb, thumb_len, "%s.png", hexdigest); } -static int thumbpath_from_uri(const char* uri, char* path, ThumbSize size) +static int thumbpath_from_uri(const char* uri, char* path, const int path_len, ThumbSize size) { char tmppath[FILE_MAX]; int rv = 0; if (get_thumb_dir(tmppath, size)) { char thumb[40]; - thumbname_from_uri(uri, thumb); - BLI_snprintf(path, FILE_MAX, "%s%s", tmppath, thumb); + thumbname_from_uri(uri, thumb, sizeof(thumb)); + BLI_snprintf(path, path_len, "%s%s", tmppath, thumb); rv = 1; } return rv; } -void IMB_thumb_makedirs() +void IMB_thumb_makedirs(void) { char tpath[FILE_MAX]; if (get_thumb_dir(tpath, THB_NORMAL)) { @@ -271,7 +271,7 @@ ImBuf* IMB_thumb_create(const char* path, ThumbSize size, ThumbSource source, Im } uri_from_filename(path, uri); - thumbname_from_uri(uri, thumb); + thumbname_from_uri(uri, thumb, sizeof(thumb)); if (get_thumb_dir(tdir, size)) { BLI_snprintf(tpath, FILE_MAX, "%s%s", tdir, thumb); thumb[8] = '\0'; /* shorten for tempname, not needed anymore */ @@ -297,9 +297,9 @@ ImBuf* IMB_thumb_create(const char* path, ThumbSize size, ThumbSource source, Im if (img != NULL) { stat(path, &info); - sprintf(mtime, "%ld", info.st_mtime); - sprintf(cwidth, "%d", img->x); - sprintf(cheight, "%d", img->y); + BLI_snprintf(mtime, sizeof(mtime), "%ld", info.st_mtime); + BLI_snprintf(cwidth, sizeof(cwidth), "%d", img->x); + BLI_snprintf(cheight, sizeof(cheight), "%d", img->y); } } else if (THB_SOURCE_MOVIE == source) { struct anim * anim = NULL; @@ -315,7 +315,7 @@ ImBuf* IMB_thumb_create(const char* path, ThumbSize size, ThumbSource source, Im IMB_free_anim(anim); } stat(path, &info); - sprintf(mtime, "%ld", info.st_mtime); + BLI_snprintf(mtime, sizeof(mtime), "%ld", info.st_mtime); } if (!img) return 0; @@ -332,7 +332,7 @@ ImBuf* IMB_thumb_create(const char* path, ThumbSize size, ThumbSource source, Im IMB_scaleImBuf(img, ex, ey); } - sprintf(desc, "Thumbnail for %s", uri); + BLI_snprintf(desc, sizeof(desc), "Thumbnail for %s", uri); IMB_metadata_change_field(img, "Description", desc); IMB_metadata_change_field(img, "Software", "Blender"); IMB_metadata_change_field(img, "Thumb::URI", uri); @@ -365,7 +365,7 @@ ImBuf* IMB_thumb_read(const char* path, ThumbSize size) if (!uri_from_filename(path,uri)) { return NULL; } - if (thumbpath_from_uri(uri, thumb, size)) { + if (thumbpath_from_uri(uri, thumb, sizeof(thumb), size)) { img = IMB_loadiffname(thumb, IB_rect | IB_metadata); } @@ -381,7 +381,7 @@ void IMB_thumb_delete(const char* path, ThumbSize size) if (!uri_from_filename(path ,uri)) { return; } - if (thumbpath_from_uri(uri, thumb, size)) { + if (thumbpath_from_uri(uri, thumb, sizeof(thumb), size)) { if (strncmp(path, thumb, strlen(thumb)) == 0) { return; } @@ -406,14 +406,14 @@ ImBuf* IMB_thumb_manage(const char* path, ThumbSize size, ThumbSource source) if (!uri_from_filename(path,uri)) { return NULL; } - if (thumbpath_from_uri(uri, thumb, THB_FAIL)) { + if (thumbpath_from_uri(uri, thumb, sizeof(thumb), THB_FAIL)) { /* failure thumb exists, don't try recreating */ if (BLI_exists(thumb)) { return NULL; } } - if (thumbpath_from_uri(uri, thumb, size)) { + if (thumbpath_from_uri(uri, thumb, sizeof(thumb), size)) { if (strncmp(path, thumb, strlen(thumb)) == 0) { img = IMB_loadiffname(path, IB_rect); } else { diff --git a/source/blender/makesdna/DNA_actuator_types.h b/source/blender/makesdna/DNA_actuator_types.h index 077c62943e0..20fdb5eee41 100644 --- a/source/blender/makesdna/DNA_actuator_types.h +++ b/source/blender/makesdna/DNA_actuator_types.h @@ -48,7 +48,7 @@ typedef struct bAddObjectActuator { typedef struct bActionActuator { struct bAction *act; /* Pointer to action */ short type, flag; /* Playback type */ // not in use - int sta, end; /* Start & End frames */ + float sta, end; /* Start & End frames */ char name[32]; /* For property-driven playback */ char frameProp[32]; /* Set this property to the actions current frame */ short blendin; /* Number of frames of blending */ @@ -119,7 +119,7 @@ typedef struct bObjectActuator { typedef struct bIpoActuator { short flag, type; - int sta, end; + float sta, end; char name[32]; char frameProp[32]; /* Set this property to the actions current frame */ diff --git a/source/blender/makesdna/DNA_armature_types.h b/source/blender/makesdna/DNA_armature_types.h index 89c2d69b8be..68375615614 100644 --- a/source/blender/makesdna/DNA_armature_types.h +++ b/source/blender/makesdna/DNA_armature_types.h @@ -189,4 +189,6 @@ typedef enum eBone_Flag { BONE_NO_LOCAL_LOCATION = (1<<22) /* bone location is in armature space */ } eBone_Flag; +#define MAXBONENAME 32 + #endif diff --git a/source/blender/makesdna/DNA_constraint_types.h b/source/blender/makesdna/DNA_constraint_types.h index f9d6a70db48..275ffd93ae5 100644 --- a/source/blender/makesdna/DNA_constraint_types.h +++ b/source/blender/makesdna/DNA_constraint_types.h @@ -699,7 +699,8 @@ typedef enum eChildOf_Flags { CHILDOF_ROTZ = (1<<5), CHILDOF_SIZEX = (1<<6), CHILDOF_SIZEY = (1<<7), - CHILDOF_SIZEZ = (1<<8) + CHILDOF_SIZEZ = (1<<8), + CHILDOF_ALL = 511 } eChildOf_Flags; /* Pivot Constraint */ diff --git a/source/blender/makesdna/DNA_meshdata_types.h b/source/blender/makesdna/DNA_meshdata_types.h index 450c56b0dec..9761eda5de7 100644 --- a/source/blender/makesdna/DNA_meshdata_types.h +++ b/source/blender/makesdna/DNA_meshdata_types.h @@ -61,8 +61,7 @@ typedef struct MDeformVert { typedef struct MVert { float co[3]; short no[3]; - short mat_nr; - char flag, bweight, pad[2]; + char flag, bweight; } MVert; /* at the moment alpha is abused for vertex painting diff --git a/source/blender/makesdna/DNA_modifier_types.h b/source/blender/makesdna/DNA_modifier_types.h index 914a980cd79..b5bcd20a759 100644 --- a/source/blender/makesdna/DNA_modifier_types.h +++ b/source/blender/makesdna/DNA_modifier_types.h @@ -235,6 +235,7 @@ typedef struct MirrorModifierData { #define MOD_MIR_AXIS_Y (1<<4) #define MOD_MIR_AXIS_Z (1<<5) #define MOD_MIR_VGROUP (1<<6) +#define MOD_MIR_NO_MERGE (1<<7) typedef struct EdgeSplitModifierData { ModifierData modifier; diff --git a/source/blender/makesdna/DNA_node_types.h b/source/blender/makesdna/DNA_node_types.h index fe422bfa689..5fbbf4338c4 100644 --- a/source/blender/makesdna/DNA_node_types.h +++ b/source/blender/makesdna/DNA_node_types.h @@ -149,7 +149,7 @@ typedef struct bNode { #define NODE_TEST 256 /* composite: don't do node but pass on buffer(s) */ #define NODE_MUTED 512 -#define NODE_CUSTOM_NAME 1024 +#define NODE_CUSTOM_NAME 1024 /* deprecated! */ typedef struct bNodeLink { struct bNodeLink *next, *prev; @@ -216,12 +216,11 @@ typedef struct NodeImageAnim { typedef struct NodeBlurData { short sizex, sizey; - short samples, maxspeed, minspeed, relative; + short samples, maxspeed, minspeed, relative, aspect; + short curved; float fac, percentx, percenty; short filtertype; char bokeh, gamma; - short curved; - short pad; int image_in_width, image_in_height; /* needed for absolute/relative conversions */ } NodeBlurData; @@ -336,4 +335,8 @@ typedef struct TexNodeOutput { #define CMP_NODE_CHANNEL_MATTE_CS_YUV 3 #define CMP_NODE_CHANNEL_MATTE_CS_YCC 4 +#define CMP_NODE_BLUR_ASPECT_NONE 0 +#define CMP_NODE_BLUR_ASPECT_Y 1 +#define CMP_NODE_BLUR_ASPECT_X 2 + #endif diff --git a/source/blender/makesdna/DNA_particle_types.h b/source/blender/makesdna/DNA_particle_types.h index a3a44976fcd..d4590315c45 100644 --- a/source/blender/makesdna/DNA_particle_types.h +++ b/source/blender/makesdna/DNA_particle_types.h @@ -142,7 +142,7 @@ typedef struct ParticleSettings { struct EffectorWeights *effector_weights; int flag; - short type, from, distr; + short type, from, distr, texact; /* physics modes */ short phystype, rotmode, avemode, reactevent; short draw, draw_as, draw_size, childtype; @@ -155,7 +155,7 @@ typedef struct ParticleSettings { short adapt_angle, adapt_pix; short disp, omat, interpolation, rotfrom, integrator; - short kink, kink_axis; + short kink, kink_axis, rt2; /* billboards */ short bb_align, bb_uv_split, bb_anim, bb_split_offset; @@ -169,14 +169,14 @@ typedef struct ParticleSettings { /* general values */ float sta, end, lifetime, randlife; float timetweak, jitfac, eff_hair, grid_rand; - int totpart, userjit, grid_res, rt; + int totpart, userjit, grid_res, effector_amount; /* initial velocity factors */ float normfac, obfac, randfac, partfac, tanfac, tanphase, reactfac; float ob_vel[3]; float avefac, phasefac, randrotfac, randphasefac; /* physical properties */ - float mass, size, randsize, reactshape; + float mass, size, randsize; /* global physical properties */ float acc[3], dragfac, brownfac, dampfac; /* length */ @@ -208,6 +208,8 @@ typedef struct ParticleSettings { /* keyed particles */ int keyed_loops; + struct MTex *mtex[18]; /* MAX_MTEX */ + struct Group *dup_group; struct ListBase dupliweights; struct Group *eff_group; // deprecated @@ -304,7 +306,7 @@ typedef struct ParticleSystem{ /* note, make sure all (runtime) are NULL's in #define PART_ROT_DYN (1<<14) /* dynamic rotation */ #define PART_SIZEMASS (1<<16) -//#define PART_HAIR_GRAVITY (1<<15) +#define PART_HIDE_ADVANCED_HAIR (1<<15) //#define PART_ABS_TIME (1<<17) //#define PART_GLOB_TIME (1<<18) @@ -313,10 +315,10 @@ typedef struct ParticleSystem{ /* note, make sure all (runtime) are NULL's in //#define PART_BRANCHING (1<<20) //#define PART_ANIM_BRANCHING (1<<21) -//#define PART_SYMM_BRANCHING (1<<24) #define PART_HAIR_BSPLINE 1024 +#define PART_GRID_HEXAGONAL (1<<24) #define PART_GRID_INVERT (1<<26) #define PART_CHILD_EFFECT (1<<27) @@ -388,10 +390,9 @@ typedef struct ParticleSystem{ /* note, make sure all (runtime) are NULL's in /* part->bb_anim */ #define PART_BB_ANIM_NONE 0 -#define PART_BB_ANIM_TIME 1 +#define PART_BB_ANIM_AGE 1 #define PART_BB_ANIM_ANGLE 2 -#define PART_BB_ANIM_OFF_TIME 3 -#define PART_BB_ANIM_OFF_ANGLE 4 +#define PART_BB_ANIM_FRAME 3 /* part->bb_split_offset */ #define PART_BB_OFF_NONE 0 @@ -508,4 +509,25 @@ typedef struct ParticleSystem{ /* note, make sure all (runtime) are NULL's in #define PTARGET_MODE_FRIEND 1 #define PTARGET_MODE_ENEMY 2 +/* mapto */ +/* init */ +#define PAMAP_INIT 15 +#define PAMAP_TIME (1<<0) /* emission time */ +#define PAMAP_LIFE (1<<1) /* life time */ +#define PAMAP_DENS (1<<2) /* density */ +#define PAMAP_SIZE (1<<3) /* physical size */ +/* reset */ +#define PAMAP_IVEL (1<<5) /* initial velocity */ +/* physics */ +#define PAMAP_PHYSICS 3136 +#define PAMAP_FIELD (1<<6) /* force fields */ +#define PAMAP_GRAVITY (1<<10) +#define PAMAP_DAMP (1<<11) +/* children */ +#define PAMAP_CHILD 912 +#define PAMAP_CLUMP (1<<7) +#define PAMAP_KINK (1<<8) +#define PAMAP_ROUGH (1<<9) +#define PAMAP_LENGTH (1<<4) + #endif diff --git a/source/blender/makesdna/DNA_scene_types.h b/source/blender/makesdna/DNA_scene_types.h index 97b22cb9324..3ea0cfc9c21 100644 --- a/source/blender/makesdna/DNA_scene_types.h +++ b/source/blender/makesdna/DNA_scene_types.h @@ -929,7 +929,7 @@ typedef struct Scene { #define R_COMP_FREE 0x0800 #define R_NO_IMAGE_LOAD 0x1000 #define R_NO_TEX 0x2000 -/*#define R_STAMP_INFO 0x4000 deprecated */ +#define R_NO_FRAME_UPDATE 0x4000 #define R_FULL_SAMPLE 0x8000 /* #define R_DEPRECATED 0x10000 */ /* #define R_RECURS_PROTECTION 0x20000 */ @@ -1048,7 +1048,7 @@ typedef struct Scene { #define FIRSTBASE scene->base.first #define LASTBASE scene->base.last #define BASACT (scene->basact) -#define OBACT (BASACT? BASACT->object: 0) +#define OBACT (BASACT? BASACT->object: NULL) #define ID_NEW(a) if( (a) && (a)->id.newid ) (a)= (void *)(a)->id.newid #define ID_NEW_US(a) if( (a)->id.newid) {(a)= (void *)(a)->id.newid; (a)->id.us++;} diff --git a/source/blender/makesdna/DNA_space_types.h b/source/blender/makesdna/DNA_space_types.h index 49a4df043fb..6cb7a186ca0 100644 --- a/source/blender/makesdna/DNA_space_types.h +++ b/source/blender/makesdna/DNA_space_types.h @@ -135,7 +135,8 @@ typedef struct SpaceButs { short mainb, mainbo, mainbuser; /* context tabs */ short re_align, align; /* align for panels */ short preview; /* preview is signal to refresh */ - char flag, pad[3]; + short texture_context; /* texture context selector (material, world, brush)*/ + char flag, pad; void *path; /* runtime */ int pathflag, dataicon; /* runtime */ @@ -396,8 +397,9 @@ typedef struct SpaceNode { float mx, my; /* mousepos for drawing socketless link */ struct bNodeTree *nodetree, *edittree; - int treetype; /* treetype: as same nodetree->type */ - short texfrom, pad; /* texfrom object, world or brush */ + int treetype; /* treetype: as same nodetree->type */ + short texfrom; /* texfrom object, world or brush */ + short recalc; /* currently on 0/1, for auto compo */ struct bGPdata *gpd; /* grease-pencil data */ } SpaceNode; @@ -407,6 +409,7 @@ typedef struct SpaceNode { #define SNODE_DISPGP 4 #define SNODE_USE_ALPHA 8 #define SNODE_SHOW_ALPHA 16 +#define SNODE_AUTO_RENDER 32 /* snode->texfrom */ #define SNODE_TEX_OBJECT 0 @@ -625,10 +628,16 @@ typedef struct SpaceSound { /* sbuts->flag */ #define SB_PRV_OSA 1 #define SB_PIN_CONTEXT 2 -#define SB_WORLD_TEX 4 -#define SB_BRUSH_TEX 8 +//#define SB_WORLD_TEX 4 //not used anymore +//#define SB_BRUSH_TEX 8 //not used anymore #define SB_SHADING_CONTEXT 16 +/* sbuts->texture_context */ +#define SB_TEXC_MAT_OR_LAMP 0 +#define SB_TEXC_WORLD 1 +#define SB_TEXC_BRUSH 2 +#define SB_TEXC_PARTICLES 3 + /* sbuts->align */ #define BUT_FREE 0 #define BUT_HORIZONTAL 1 @@ -787,6 +796,8 @@ enum FileSortTypeE { #define SIPO_TEMP_NEEDCHANSYNC (1<<10) /* don't perform realtime updates */ #define SIPO_NOREALTIMEUPDATES (1<<11) + /* don't draw curves with AA ("beauty-draw") for performance */ +#define SIPO_BEAUTYDRAW_OFF (1<<12) /* SpaceIpo->mode (Graph Editor Mode) */ enum { diff --git a/source/blender/makesdna/DNA_texture_types.h b/source/blender/makesdna/DNA_texture_types.h index 41eebca821c..c345eb34133 100644 --- a/source/blender/makesdna/DNA_texture_types.h +++ b/source/blender/makesdna/DNA_texture_types.h @@ -77,9 +77,9 @@ typedef struct MTex { float densfac, scatterfac, reflfac; /* particles */ - float timefac, lengthfac, clumpfac; - float kinkfac, roughfac, padensfac; - float lifefac, sizefac, ivelfac, pvelfac; + float timefac, lengthfac, clumpfac, dampfac; + float kinkfac, roughfac, padensfac, gravityfac; + float lifefac, sizefac, ivelfac, fieldfac; /* lamp */ float shadowfac; diff --git a/source/blender/makesdna/intern/makesdna.c b/source/blender/makesdna/intern/makesdna.c index 5023725c1a3..54deefb1f2d 100644 --- a/source/blender/makesdna/intern/makesdna.c +++ b/source/blender/makesdna/intern/makesdna.c @@ -271,7 +271,7 @@ int add_name(char *str) additional_slen_offset = 0; - if((str[0]==0) /* || (str[1]==0) */) return -1; + if(str[0]==0 /* || (str[1]==0) */) return -1; if (str[0] == '(' && str[1] == '*') { /* we handle function pointer and special array cases here, e.g. @@ -283,7 +283,6 @@ int add_name(char *str) if (debugSDNA > 3) printf("\t\t\t\t*** Function pointer or multidim array pointer found\n"); /* functionpointer: transform the type (sometimes) */ i = 0; - j = 0; while (str[i] != ')') { buf[i] = str[i]; diff --git a/source/blender/makesrna/RNA_access.h b/source/blender/makesrna/RNA_access.h index 180b3d5ab47..1df6ce21328 100644 --- a/source/blender/makesrna/RNA_access.h +++ b/source/blender/makesrna/RNA_access.h @@ -371,6 +371,7 @@ extern StructRNA RNA_ParticleHairKey; extern StructRNA RNA_ParticleInstanceModifier; extern StructRNA RNA_ParticleKey; extern StructRNA RNA_ParticleSettings; +extern StructRNA RNA_ParticleSettingsTextureSlot; extern StructRNA RNA_SPHFluidSettings; extern StructRNA RNA_ParticleSystem; extern StructRNA RNA_ParticleSystemModifier; diff --git a/source/blender/makesrna/RNA_enum_types.h b/source/blender/makesrna/RNA_enum_types.h index fa35b8fac15..bc20ef710eb 100644 --- a/source/blender/makesrna/RNA_enum_types.h +++ b/source/blender/makesrna/RNA_enum_types.h @@ -96,6 +96,11 @@ extern EnumPropertyItem property_unit_items[]; extern EnumPropertyItem viewport_shade_items[]; +extern EnumPropertyItem node_blend_type_items[]; +extern EnumPropertyItem node_math_items[]; +extern EnumPropertyItem node_vec_math_items[]; +extern EnumPropertyItem node_filter_items[]; + extern EnumPropertyItem linestyle_color_modifier_type_items[]; extern EnumPropertyItem linestyle_alpha_modifier_type_items[]; extern EnumPropertyItem linestyle_thickness_modifier_type_items[]; diff --git a/source/blender/makesrna/intern/makesrna.c b/source/blender/makesrna/intern/makesrna.c index 1dcb917bc1d..36ae67d4091 100644 --- a/source/blender/makesrna/intern/makesrna.c +++ b/source/blender/makesrna/intern/makesrna.c @@ -1679,7 +1679,7 @@ static void rna_def_function_funcs(FILE *f, StructDefRNA *dsrna, FunctionDefRNA dfunc->gencall= funcname; } -static void rna_auto_types() +static void rna_auto_types(void) { StructDefRNA *ds; PropertyDefRNA *dp; diff --git a/source/blender/makesrna/intern/rna_ID.c b/source/blender/makesrna/intern/rna_ID.c index ab8cd570813..f914d14d451 100644 --- a/source/blender/makesrna/intern/rna_ID.c +++ b/source/blender/makesrna/intern/rna_ID.c @@ -253,7 +253,7 @@ ID *rna_ID_copy(ID *id) return NULL; } -static void rna_ID_update(ID *id, ReportList *reports, int flag) +static void rna_ID_update_tag(ID *id, ReportList *reports, int flag) { /* XXX, new function for this! */ /*if (ob->type == OB_FONT) { @@ -481,7 +481,7 @@ static void rna_def_ID(BlenderRNA *brna) func= RNA_def_function(srna, "animation_data_clear", "BKE_free_animdata"); RNA_def_function_ui_description(func, "Clear animation on this this ID."); - func= RNA_def_function(srna, "update", "rna_ID_update"); + func= RNA_def_function(srna, "update_tag", "rna_ID_update_tag"); RNA_def_function_flag(func, FUNC_USE_REPORTS); RNA_def_function_ui_description(func, "Tag the id to update its display data."); RNA_def_enum_flag(func, "refresh", update_flag_items, 0, "", "Type of updates to perform."); diff --git a/source/blender/makesrna/intern/rna_access.c b/source/blender/makesrna/intern/rna_access.c index 6c09b349d9b..8e24f9724d6 100644 --- a/source/blender/makesrna/intern/rna_access.c +++ b/source/blender/makesrna/intern/rna_access.c @@ -61,7 +61,7 @@ const PointerRNA PointerRNA_NULL= {{0}}; /* Init/Exit */ -void RNA_init() +void RNA_init(void) { StructRNA *srna; PropertyRNA *prop; @@ -77,7 +77,7 @@ void RNA_init() } } -void RNA_exit() +void RNA_exit(void) { StructRNA *srna; @@ -235,8 +235,9 @@ IDProperty *rna_idproperty_ui(PropertyRNA *prop) } } - if (idprop) - return IDP_GetPropertyFromGroup(idprop, ((IDProperty *)prop)->name); + if (idprop) { + return IDP_GetPropertyTypeFromGroup(idprop, ((IDProperty *)prop)->name, IDP_GROUP); + } return NULL; } @@ -447,11 +448,10 @@ static const char *rna_ensure_property_description(PropertyRNA *prop) /* attempt to get the local ID values */ IDProperty *idp_ui= rna_idproperty_ui(prop); - if(idp_ui) { /* TODO, type checking on ID props */ - - IDProperty *item= IDP_GetPropertyFromGroup(idp_ui, "description"); + if(idp_ui) { + IDProperty *item= IDP_GetPropertyTypeFromGroup(idp_ui, "description", IDP_STRING); if(item) - return (char *)item->data.pointer ; + return IDP_String(item); } return ((IDProperty*)prop)->name; /* XXX - not correct */ @@ -803,14 +803,15 @@ void RNA_property_int_range(PointerRNA *ptr, PropertyRNA *prop, int *hardmin, in if(prop->magic != RNA_MAGIC) { /* attempt to get the local ID values */ IDProperty *idp_ui= rna_idproperty_ui(prop); - IDProperty *item; - if(idp_ui) { /* TODO, type checking on ID props */ - item= IDP_GetPropertyFromGroup(idp_ui, "min"); - *hardmin= item ? item->data.val : INT_MIN; + if(idp_ui) { + IDProperty *item; - item= IDP_GetPropertyFromGroup(idp_ui, "max"); - *hardmax= item ? item->data.val : INT_MAX; + item= IDP_GetPropertyTypeFromGroup(idp_ui, "min", IDP_INT); + *hardmin= item ? IDP_Int(item) : INT_MIN; + + item= IDP_GetPropertyTypeFromGroup(idp_ui, "max", IDP_INT); + *hardmax= item ? IDP_Int(item) : INT_MAX; return; } @@ -833,17 +834,18 @@ void RNA_property_int_ui_range(PointerRNA *ptr, PropertyRNA *prop, int *softmin, if(prop->magic != RNA_MAGIC) { /* attempt to get the local ID values */ IDProperty *idp_ui= rna_idproperty_ui(prop); - IDProperty *item; - if(idp_ui) { /* TODO, type checking on ID props */ - item= IDP_GetPropertyFromGroup(idp_ui, "soft_min"); - *softmin= item ? item->data.val : INT_MIN; + if(idp_ui) { + IDProperty *item; - item= IDP_GetPropertyFromGroup(idp_ui, "soft_max"); - *softmax= item ? item->data.val : INT_MAX; + item= IDP_GetPropertyTypeFromGroup(idp_ui, "soft_min", IDP_INT); + *softmin= item ? IDP_Int(item) : INT_MIN; - item= IDP_GetPropertyFromGroup(idp_ui, "step"); - *step= item ? item->data.val : 1; + item= IDP_GetPropertyTypeFromGroup(idp_ui, "soft_max", IDP_INT); + *softmax= item ? IDP_Int(item) : INT_MAX; + + item= IDP_GetPropertyTypeFromGroup(idp_ui, "step", IDP_INT); + *step= item ? IDP_Int(item) : 1; return; } @@ -869,14 +871,15 @@ void RNA_property_float_range(PointerRNA *ptr, PropertyRNA *prop, float *hardmin if(prop->magic != RNA_MAGIC) { /* attempt to get the local ID values */ IDProperty *idp_ui= rna_idproperty_ui(prop); - IDProperty *item; - if(idp_ui) { /* TODO, type checking on ID props */ - item= IDP_GetPropertyFromGroup(idp_ui, "min"); - *hardmin= item ? *(double*)&item->data.val : FLT_MIN; + if(idp_ui) { + IDProperty *item; + + item= IDP_GetPropertyTypeFromGroup(idp_ui, "min", IDP_DOUBLE); + *hardmin= item ? IDP_Double(item) : FLT_MIN; - item= IDP_GetPropertyFromGroup(idp_ui, "max"); - *hardmax= item ? *(double*)&item->data.val : FLT_MAX; + item= IDP_GetPropertyTypeFromGroup(idp_ui, "max", IDP_DOUBLE); + *hardmax= item ? IDP_Double(item) : FLT_MAX; return; } @@ -899,20 +902,21 @@ void RNA_property_float_ui_range(PointerRNA *ptr, PropertyRNA *prop, float *soft if(prop->magic != RNA_MAGIC) { /* attempt to get the local ID values */ IDProperty *idp_ui= rna_idproperty_ui(prop); - IDProperty *item; - if(idp_ui) { /* TODO, type checking on ID props */ - item= IDP_GetPropertyFromGroup(idp_ui, "soft_min"); - *softmin= item ? *(double*)&item->data.val : FLT_MIN; + if(idp_ui) { + IDProperty *item; + + item= IDP_GetPropertyTypeFromGroup(idp_ui, "soft_min", IDP_DOUBLE); + *softmin= item ? IDP_Double(item) : FLT_MIN; - item= IDP_GetPropertyFromGroup(idp_ui, "soft_max"); - *softmax= item ? *(double*)&item->data.val : FLT_MAX; + item= IDP_GetPropertyTypeFromGroup(idp_ui, "soft_max", IDP_DOUBLE); + *softmax= item ? IDP_Double(item) : FLT_MAX; - item= IDP_GetPropertyFromGroup(idp_ui, "step"); - *step= item ? *(double*)&item->data.val : 1.0f; + item= IDP_GetPropertyTypeFromGroup(idp_ui, "step", IDP_DOUBLE); + *step= item ? IDP_Double(item) : 1.0f; - item= IDP_GetPropertyFromGroup(idp_ui, "precision"); - *precision= item ? *(double*)&item->data.val : 3.0f; + item= IDP_GetPropertyTypeFromGroup(idp_ui, "precision", IDP_DOUBLE); + *precision= item ? IDP_Double(item) : 3.0f; return; } @@ -3241,7 +3245,7 @@ char *RNA_path_append(const char *path, PointerRNA *ptr, PropertyRNA *prop, int BLI_dynstr_append(dynstr, "\""); } else { - sprintf(appendstr, "%d", intkey); + BLI_snprintf(appendstr, sizeof(appendstr), "%d", intkey); BLI_dynstr_append(dynstr, appendstr); } diff --git a/source/blender/makesrna/intern/rna_actuator.c b/source/blender/makesrna/intern/rna_actuator.c index 46230815178..0fe8483dfac 100644 --- a/source/blender/makesrna/intern/rna_actuator.c +++ b/source/blender/makesrna/intern/rna_actuator.c @@ -565,7 +565,7 @@ static void rna_def_action_actuator(BlenderRNA *brna) prop= RNA_def_property(srna, "play_mode", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "type"); RNA_def_property_enum_items(prop, prop_type_items); - RNA_def_property_ui_text(prop, "Action type", "Action playback type"); + RNA_def_property_ui_text(prop, "Action Type", "Action playback type"); RNA_def_property_update(prop, NC_LOGIC, NULL); prop= RNA_def_property(srna, "action", PROP_POINTER, PROP_NONE); @@ -587,16 +587,16 @@ static void rna_def_action_actuator(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Property", "Use this property to define the Action position"); RNA_def_property_update(prop, NC_LOGIC, NULL); - prop= RNA_def_property(srna, "frame_start", PROP_INT, PROP_NONE); - RNA_def_property_int_sdna(prop, NULL, "sta"); - RNA_def_property_range(prop, 0, MAXFRAME); - RNA_def_property_ui_text(prop, "Start frame", ""); + prop= RNA_def_property(srna, "frame_start", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_sdna(prop, NULL, "sta"); + RNA_def_property_ui_range(prop, 0.0, MAXFRAME, 100, 2); + RNA_def_property_ui_text(prop, "Start Frame", ""); RNA_def_property_update(prop, NC_LOGIC, NULL); - prop= RNA_def_property(srna, "frame_end", PROP_INT, PROP_NONE); - RNA_def_property_int_sdna(prop, NULL, "end"); - RNA_def_property_range(prop, 0, MAXFRAME); - RNA_def_property_ui_text(prop, "End frame", ""); + prop= RNA_def_property(srna, "frame_end", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_sdna(prop, NULL, "end"); + RNA_def_property_ui_range(prop, 0.0, MAXFRAME, 100, 2); + RNA_def_property_ui_text(prop, "End Frame", ""); RNA_def_property_update(prop, NC_LOGIC, NULL); prop= RNA_def_property(srna, "frame_blend_in", PROP_INT, PROP_NONE); @@ -834,15 +834,15 @@ static void rna_def_fcurve_actuator(BlenderRNA *brna) RNA_def_property_ui_text(prop, "F-Curve Type", "Specify the way you want to play the animation"); RNA_def_property_update(prop, NC_LOGIC, NULL); - prop= RNA_def_property(srna, "frame_start", PROP_INT, PROP_NONE); - RNA_def_property_int_sdna(prop, NULL, "sta"); - RNA_def_property_ui_range(prop, 1, MAXFRAME, 1, 1); + prop= RNA_def_property(srna, "frame_start", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_sdna(prop, NULL, "sta"); + RNA_def_property_ui_range(prop, 1.0, MAXFRAME, 100, 2); RNA_def_property_ui_text(prop, "Start Frame", ""); RNA_def_property_update(prop, NC_SCENE, NULL); - prop= RNA_def_property(srna, "frame_end", PROP_INT, PROP_NONE); - RNA_def_property_int_sdna(prop, NULL, "end"); - RNA_def_property_ui_range(prop, 1, MAXFRAME, 1, 1); + prop= RNA_def_property(srna, "frame_end", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_sdna(prop, NULL, "end"); + RNA_def_property_ui_range(prop, 1.0, MAXFRAME, 100, 2); RNA_def_property_ui_text(prop, "End Frame", ""); RNA_def_property_update(prop, NC_LOGIC, NULL); @@ -1191,7 +1191,7 @@ static void rna_def_constraint_actuator(BlenderRNA *brna) prop= RNA_def_property(srna, "damping_rotation", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "rotdamp"); RNA_def_property_ui_range(prop, 0, 100, 1, 1); - RNA_def_property_ui_text(prop, "rotDamp", "Use a different damping for orientation"); + RNA_def_property_ui_text(prop, "RotDamp", "Use a different damping for orientation"); RNA_def_property_update(prop, NC_LOGIC, NULL); /* ACT_CONST_TYPE_ORI */ @@ -1399,8 +1399,8 @@ static void rna_def_scene_actuator(BlenderRNA *brna) {ACT_SCENE_RESTART, "RESTART", 0, "Restart", ""}, {ACT_SCENE_SET, "SET", 0, "Set Scene", ""}, {ACT_SCENE_CAMERA, "CAMERA", 0, "Set Camera", ""}, - {ACT_SCENE_ADD_FRONT, "ADDFRONT", 0, "Add OverlayScene", ""}, - {ACT_SCENE_ADD_BACK, "ADDBACK", 0, "Add BackgroundScene", ""}, + {ACT_SCENE_ADD_FRONT, "ADDFRONT", 0, "Add Overlay Scene", ""}, + {ACT_SCENE_ADD_BACK, "ADDBACK", 0, "Add Background Scene", ""}, {ACT_SCENE_REMOVE, "REMOVE", 0, "Remove Scene", ""}, {ACT_SCENE_SUSPEND, "SUSPEND", 0, "Suspend Scene", ""}, {ACT_SCENE_RESUME, "RESUME", 0, "Resume Scene", ""}, @@ -1490,7 +1490,7 @@ static void rna_def_random_actuator(BlenderRNA *brna) /* ACT_RANDOM_BOOL_CONST */ prop= RNA_def_property(srna, "use_always_true", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "int_arg_1", 1); - RNA_def_property_ui_text(prop, "Always true", "Always false or always true"); + RNA_def_property_ui_text(prop, "Always True", "Always false or always true"); RNA_def_property_update(prop, NC_LOGIC, NULL); /* ACT_RANDOM_BOOL_UNIFORM */ @@ -1567,7 +1567,7 @@ static void rna_def_random_actuator(BlenderRNA *brna) prop= RNA_def_property(srna, "half_life_time", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "float_arg_1"); RNA_def_property_range(prop, -1000.0, 1000.0); - RNA_def_property_ui_text(prop, "Half-life time", "Negative exponential dropoff"); + RNA_def_property_ui_text(prop, "Half-Life Time", "Negative exponential dropoff"); RNA_def_property_update(prop, NC_LOGIC, NULL); } @@ -1608,7 +1608,7 @@ static void rna_def_message_actuator(BlenderRNA *brna) /* ACT_MESG_PROP */ prop= RNA_def_property(srna, "body_property", PROP_STRING, PROP_NONE); RNA_def_property_string_sdna(prop, NULL, "body"); - RNA_def_property_ui_text(prop, "Propname", "The message body will be set by the Property Value"); + RNA_def_property_ui_text(prop, "Prop Name", "The message body will be set by the Property Value"); RNA_def_property_update(prop, NC_LOGIC, NULL); } @@ -1618,14 +1618,14 @@ static void rna_def_game_actuator(BlenderRNA *brna) PropertyRNA *prop; static EnumPropertyItem prop_type_items[] ={ -// {ACT_GAME_LOAD, "LOAD", 0, "Load game", ""}, -// {ACT_GAME_START, "START", 0, "Start loaded game", ""}, +// {ACT_GAME_LOAD, "LOAD", 0, "Load Game", ""}, +// {ACT_GAME_START, "START", 0, "Start Loaded Game", ""}, // keeping the load/start hacky for compatibility with 2.49 // ideally we could use ACT_GAME_START again and do a do_version() - {ACT_GAME_LOAD, "START", 0, "Start new game", ""}, - {ACT_GAME_RESTART, "RESTART", 0, "Restart this game", ""}, - {ACT_GAME_QUIT, "QUIT", 0, "Quit this game", ""}, + {ACT_GAME_LOAD, "START", 0, "Start Game From File", ""}, + {ACT_GAME_RESTART, "RESTART", 0, "Restart Game", ""}, + {ACT_GAME_QUIT, "QUIT", 0, "Quit Game", ""}, {ACT_GAME_SAVECFG, "SAVECFG", 0, "Save bge.logic.globalDict", ""}, {ACT_GAME_LOADCFG, "LOADCFG", 0, "Load bge.logic.globalDict", ""}, {0, NULL, 0, NULL, NULL}}; @@ -1697,13 +1697,13 @@ static void rna_def_twodfilter_actuator(BlenderRNA *brna) {0, NULL, 0, NULL, NULL}}; srna= RNA_def_struct(brna, "Filter2DActuator", "Actuator"); - RNA_def_struct_ui_text(srna, "2D Filter Actuator", "Actuator to .."); + RNA_def_struct_ui_text(srna, "Filter 2D Actuator", "Actuator to apply screen graphic effects"); RNA_def_struct_sdna_from(srna, "bTwoDFilterActuator", "data"); prop= RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "type"); RNA_def_property_enum_items(prop, prop_type_items); - RNA_def_property_ui_text(prop, "2D Filter Type", ""); + RNA_def_property_ui_text(prop, "Filter 2D Type", ""); RNA_def_property_update(prop, NC_LOGIC, NULL); prop= RNA_def_property(srna, "glsl_shader", PROP_POINTER, PROP_NONE); @@ -1794,7 +1794,7 @@ static void rna_def_shape_action_actuator(BlenderRNA *brna) prop= RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "type"); RNA_def_property_enum_items(prop, prop_type_items); - RNA_def_property_ui_text(prop, "Action type", "Action playback type"); + RNA_def_property_ui_text(prop, "Action Type", "Action playback type"); RNA_def_property_update(prop, NC_LOGIC, NULL); prop= RNA_def_property(srna, "action", PROP_POINTER, PROP_NONE); @@ -1816,16 +1816,16 @@ static void rna_def_shape_action_actuator(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Property", "Use this property to define the Action position"); RNA_def_property_update(prop, NC_LOGIC, NULL); - prop= RNA_def_property(srna, "frame_start", PROP_INT, PROP_NONE); - RNA_def_property_int_sdna(prop, NULL, "sta"); - RNA_def_property_range(prop, 0, MAXFRAME); - RNA_def_property_ui_text(prop, "Start frame", ""); + prop= RNA_def_property(srna, "frame_start", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_sdna(prop, NULL, "sta"); + RNA_def_property_ui_range(prop, 0.0, MAXFRAME, 100, 2); + RNA_def_property_ui_text(prop, "Start Frame", ""); RNA_def_property_update(prop, NC_LOGIC, NULL); - prop= RNA_def_property(srna, "frame_end", PROP_INT, PROP_NONE); - RNA_def_property_int_sdna(prop, NULL, "end"); - RNA_def_property_range(prop, 0, MAXFRAME); - RNA_def_property_ui_text(prop, "End frame", ""); + prop= RNA_def_property(srna, "frame_end", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_sdna(prop, NULL, "end"); + RNA_def_property_ui_range(prop, 0.0, MAXFRAME, 100, 2); + RNA_def_property_ui_text(prop, "End Frame", ""); RNA_def_property_update(prop, NC_LOGIC, NULL); prop= RNA_def_property(srna, "frame_blend_in", PROP_INT, PROP_NONE); @@ -1925,7 +1925,7 @@ static void rna_def_armature_actuator(BlenderRNA *brna) RNA_def_property_pointer_sdna(prop, NULL, "subtarget"); RNA_def_property_struct_type(prop, "Object"); RNA_def_property_flag(prop, PROP_EDITABLE); - RNA_def_property_ui_text(prop, "Secondary Target", "Set weight of this constraint"); + RNA_def_property_ui_text(prop, "Secondary Target", "Set this object as the secondary target of the constraint (only IK polar target at the moment)"); RNA_def_property_update(prop, NC_LOGIC, NULL); prop= RNA_def_property(srna, "weight", PROP_FLOAT, PROP_NONE); diff --git a/source/blender/makesrna/intern/rna_define.c b/source/blender/makesrna/intern/rna_define.c index 454ed7cee71..975858099c5 100644 --- a/source/blender/makesrna/intern/rna_define.c +++ b/source/blender/makesrna/intern/rna_define.c @@ -412,7 +412,7 @@ static int rna_validate_identifier(const char *identifier, char *error, int prop /* Blender Data Definition */ -BlenderRNA *RNA_create() +BlenderRNA *RNA_create(void) { BlenderRNA *brna; diff --git a/source/blender/makesrna/intern/rna_fluidsim.c b/source/blender/makesrna/intern/rna_fluidsim.c index 81b4b75aa03..55045a927bc 100644 --- a/source/blender/makesrna/intern/rna_fluidsim.c +++ b/source/blender/makesrna/intern/rna_fluidsim.c @@ -85,14 +85,12 @@ static int fluidsim_find_lastframe(FluidsimSettings *fss) char targetDir[FILE_MAXFILE+FILE_MAXDIR], targetFile[FILE_MAXFILE+FILE_MAXDIR]; int curFrame = 1; - strncpy(targetDir, fss->surfdataPath, FILE_MAXDIR); - strcat(targetDir,"fluidsurface_final_####"); + BLI_snprintf(targetDir, sizeof(targetDir), "%sfluidsurface_final_####.bobj.gz", fss->surfdataPath); BLI_path_abs(targetDir, G.main->name); do { - strcpy(targetFile,targetDir); + BLI_strncpy(targetFile, targetDir, sizeof(targetFile)); BLI_path_frame(targetFile, curFrame++, 0); - strcat(targetFile, ".bobj.gz"); } while(BLI_exist(targetFile)); return curFrame - 1; diff --git a/source/blender/makesrna/intern/rna_mesh_api.c b/source/blender/makesrna/intern/rna_mesh_api.c index eaf18920c85..3090f8512e0 100644 --- a/source/blender/makesrna/intern/rna_mesh_api.c +++ b/source/blender/makesrna/intern/rna_mesh_api.c @@ -33,6 +33,7 @@ #include "BLO_sys_types.h" +#include "BKE_mesh.h" #include "ED_mesh.h" #ifdef RNA_RUNTIME @@ -56,6 +57,12 @@ void RNA_api_mesh(StructRNA *srna) func= RNA_def_function(srna, "update", "ED_mesh_update"); RNA_def_boolean(func, "calc_edges", 0, "Calculate Edges", "Force recalculation of edges."); RNA_def_function_flag(func, FUNC_USE_CONTEXT); + + func= RNA_def_function(srna, "validate", "BKE_mesh_validate"); + RNA_def_function_ui_description(func, "validate geometry, return True when the mesh has had invalid geometry corrected/removed."); + parm= RNA_def_boolean(func, "verbose", 0, "Verbose", "Output information about the errors found"); + parm= RNA_def_boolean(func, "result", 0, "Result", ""); + RNA_def_function_return(func, parm); } #endif diff --git a/source/blender/makesrna/intern/rna_modifier.c b/source/blender/makesrna/intern/rna_modifier.c index 33a6856db73..01e6d57f2c6 100644 --- a/source/blender/makesrna/intern/rna_modifier.c +++ b/source/blender/makesrna/intern/rna_modifier.c @@ -776,6 +776,11 @@ static void rna_def_modifier_mirror(BlenderRNA *brna) RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_MIR_VGROUP); RNA_def_property_ui_text(prop, "Mirror Vertex Groups", "Mirror vertex groups (e.g. .R->.L)"); RNA_def_property_update(prop, 0, "rna_Modifier_update"); + + prop= RNA_def_property(srna, "use_mirror_merge", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", MOD_MIR_NO_MERGE); + RNA_def_property_ui_text(prop, "Merge Verticies", "Merge vertices within the merge threshold"); + RNA_def_property_update(prop, 0, "rna_Modifier_update"); prop= RNA_def_property(srna, "use_mirror_u", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_MIR_MIRROR_U); @@ -1900,11 +1905,11 @@ static void rna_def_modifier_shrinkwrap(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Vertex Group", "Vertex group name"); RNA_def_property_string_funcs(prop, NULL, NULL, "rna_ShrinkwrapModifier_vgroup_set"); RNA_def_property_update(prop, 0, "rna_Modifier_update"); - + prop= RNA_def_property(srna, "offset", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "keepDist"); - RNA_def_property_range(prop, 0, FLT_MAX); - RNA_def_property_ui_range(prop, 0, 100, 1, 2); + RNA_def_property_range(prop, -FLT_MAX, FLT_MAX); + RNA_def_property_ui_range(prop, -100, 100, 1, 2); RNA_def_property_ui_text(prop, "Offset", "Distance to keep from the target"); RNA_def_property_update(prop, 0, "rna_Modifier_update"); diff --git a/source/blender/makesrna/intern/rna_nodetree.c b/source/blender/makesrna/intern/rna_nodetree.c index 5c962145c55..98739874db8 100644 --- a/source/blender/makesrna/intern/rna_nodetree.c +++ b/source/blender/makesrna/intern/rna_nodetree.c @@ -47,6 +47,66 @@ #include "MEM_guardedalloc.h" +EnumPropertyItem node_blend_type_items[] = { +{ 0, "MIX", 0, "Mix", ""}, +{ 1, "ADD", 0, "Add", ""}, +{ 3, "SUBTRACT", 0, "Subtract", ""}, +{ 2, "MULTIPLY", 0, "Multiply", ""}, +{ 4, "SCREEN", 0, "Screen", ""}, +{ 9, "OVERLAY", 0, "Overlay", ""}, +{ 5, "DIVIDE", 0, "Divide", ""}, +{ 6, "DIFFERENCE", 0, "Difference", ""}, +{ 7, "DARKEN", 0, "Darken", ""}, +{ 8, "LIGHTEN", 0, "Lighten", ""}, +{10, "DODGE", 0, "Dodge", ""}, +{11, "BURN", 0, "Burn", ""}, +{15, "COLOR", 0, "Color", ""}, +{14, "VALUE", 0, "Value", ""}, +{13, "SATURATION", 0, "Saturation", ""}, +{12, "HUE", 0, "Hue", ""}, +{16, "SOFT_LIGHT", 0, "Soft Light", ""}, +{17, "LINEAR_LIGHT", 0, "Linear Light",""}, +{0, NULL, 0, NULL, NULL}}; + +EnumPropertyItem node_math_items[] = { +{ 0, "ADD", 0, "Add", ""}, +{ 1, "SUBTRACT", 0, "Subtract", ""}, +{ 2, "MULTIPLY", 0, "Multiply", ""}, +{ 3, "DIVIDE", 0, "Divide", ""}, +{ 4, "SINE", 0, "Sine", ""}, +{ 5, "COSINE", 0, "Cosine", ""}, +{ 6, "TANGENT", 0, "Tangent", ""}, +{ 7, "ARCSINE", 0, "Arcsine", ""}, +{ 8, "ARCCOSINE", 0, "Arccosine", ""}, +{ 9, "ARCTANGENT", 0, "Arctangent", ""}, +{10, "POWER", 0, "Power", ""}, +{11, "LOGARITHM", 0, "Logarithm", ""}, +{12, "MINIMUM", 0, "Minimum", ""}, +{13, "MAXIMUM", 0, "Maximum", ""}, +{14, "ROUND", 0, "Round", ""}, +{15, "LESS_THAN", 0, "Less Than", ""}, +{16, "GREATER_THAN", 0, "Greater Than", ""}, +{0, NULL, 0, NULL, NULL}}; + +EnumPropertyItem node_vec_math_items[] = { +{0, "ADD", 0, "Add", ""}, +{1, "SUBTRACT", 0, "Subtract", ""}, +{2, "AVERAGE", 0, "Average", ""}, +{3, "DOT_PRODUCT", 0, "Dot Product", ""}, +{4, "CROSS_PRODUCT", 0, "Cross Product", ""}, +{5, "NORMALIZE", 0, "Normalize", ""}, +{0, NULL, 0, NULL, NULL}}; + +EnumPropertyItem node_filter_items[] = { +{0, "SOFTEN", 0, "Soften", ""}, +{1, "SHARPEN", 0, "Sharpen", ""}, +{2, "LAPLACE", 0, "Laplace", ""}, +{3, "SOBEL", 0, "Sobel", ""}, +{4, "PREWITT", 0, "Prewitt", ""}, +{5, "KIRSCH", 0, "Kirsch", ""}, +{6, "SHADOW", 0, "Shadow", ""}, +{0, NULL, 0, NULL, NULL}}; + #ifdef RNA_RUNTIME #include "BLI_linklist.h" @@ -230,7 +290,6 @@ static void rna_Node_name_set(PointerRNA *ptr, const char *value) BLI_strncpy(node->name, value, sizeof(node->name)); nodeUniqueName(ntree, node); - node->flag |= NODE_CUSTOM_NAME; /* fix all the animation data which may link to this */ BKE_all_animdata_fix_paths_rename("nodes", oldname, node->name); @@ -567,72 +626,12 @@ static EnumPropertyItem prop_tri_channel_items[] = { { 3, "B", 0, "B", ""}, {0, NULL, 0, NULL, NULL}}; -static EnumPropertyItem node_blend_type_items[] = { -{ 0, "MIX", 0, "Mix", ""}, -{ 1, "ADD", 0, "Add", ""}, -{ 3, "SUBTRACT", 0, "Subtract", ""}, -{ 2, "MULTIPLY", 0, "Multiply", ""}, -{ 4, "SCREEN", 0, "Screen", ""}, -{ 9, "OVERLAY", 0, "Overlay", ""}, -{ 5, "DIVIDE", 0, "Divide", ""}, -{ 6, "DIFFERENCE", 0, "Difference", ""}, -{ 7, "DARKEN", 0, "Darken", ""}, -{ 8, "LIGHTEN", 0, "Lighten", ""}, -{10, "DODGE", 0, "Dodge", ""}, -{11, "BURN", 0, "Burn", ""}, -{15, "COLOR", 0, "Color", ""}, -{14, "VALUE", 0, "Value", ""}, -{13, "SATURATION", 0, "Saturation", ""}, -{12, "HUE", 0, "Hue", ""}, -{16, "SOFT_LIGHT", 0, "Soft Light", ""}, -{17, "LINEAR_LIGHT", 0, "Linear Light",""}, -{0, NULL, 0, NULL, NULL}}; - static EnumPropertyItem node_flip_items[] = { {0, "X", 0, "Flip X", ""}, {1, "Y", 0, "Flip Y", ""}, {2, "XY", 0, "Flip X & Y", ""}, {0, NULL, 0, NULL, NULL}}; -static EnumPropertyItem node_math_items[] = { -{ 0, "ADD", 0, "Add", ""}, -{ 1, "SUBTRACT", 0, "Subtract", ""}, -{ 2, "MULTIPLY", 0, "Multiply", ""}, -{ 3, "DIVIDE", 0, "Divide", ""}, -{ 4, "SINE", 0, "Sine", ""}, -{ 5, "COSINE", 0, "Cosine", ""}, -{ 6, "TANGENT", 0, "Tangent", ""}, -{ 7, "ARCSINE", 0, "Arcsine", ""}, -{ 8, "ARCCOSINE", 0, "Arccosine", ""}, -{ 9, "ARCTANGENT", 0, "Arctangent", ""}, -{10, "POWER", 0, "Power", ""}, -{11, "LOGARITHM", 0, "Logarithm", ""}, -{12, "MINIMUM", 0, "Minimum", ""}, -{13, "MAXIMUM", 0, "Maximum", ""}, -{14, "ROUND", 0, "Round", ""}, -{15, "LESS_THAN", 0, "Less Than", ""}, -{16, "GREATER_THAN", 0, "Greater Than", ""}, -{0, NULL, 0, NULL, NULL}}; - -static EnumPropertyItem node_vec_math_items[] = { -{0, "ADD", 0, "Add", ""}, -{1, "SUBTRACT", 0, "Subtract", ""}, -{2, "AVERAGE", 0, "Average", ""}, -{3, "DOT_PRODUCT", 0, "Dot Product", ""}, -{4, "CROSS_PRODUCT", 0, "Cross Product", ""}, -{5, "NORMALIZE", 0, "Normalize", ""}, -{0, NULL, 0, NULL, NULL}}; - -static EnumPropertyItem node_filter_items[] = { -{0, "SOFTEN", 0, "Soften", ""}, -{1, "SHARPEN", 0, "Sharpen", ""}, -{2, "LAPLACE", 0, "Laplace", ""}, -{3, "SOBEL", 0, "Sobel", ""}, -{4, "PREWITT", 0, "Prewitt", ""}, -{5, "KIRSCH", 0, "Kirsch", ""}, -{6, "SHADOW", 0, "Shadow", ""}, -{0, NULL, 0, NULL, NULL}}; - static EnumPropertyItem node_ycc_items[] = { { 0, "ITUBT601", 0, "ITU 601", ""}, { 1, "ITUBT709", 0, "ITU 709", ""}, @@ -916,7 +915,7 @@ static void def_sh_mapping(StructRNA *srna) RNA_def_property_ui_range(prop, -10.f, 10.f, 0.1f, 2); RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_mapping_update"); - prop= RNA_def_property(srna, "rotation", PROP_FLOAT, PROP_EULER); + prop= RNA_def_property(srna, "rotation", PROP_FLOAT, PROP_XYZ); /* Not PROP_EUL, this is already in degrees, not radians */ RNA_def_property_float_sdna(prop, NULL, "rot"); RNA_def_property_ui_text(prop, "Rotation", "Rotation offset for the input coordinate"); RNA_def_property_ui_range(prop, -360.f, 360.f, 1.f, 2); @@ -1030,6 +1029,12 @@ static void def_cmp_blur(StructRNA *srna) {R_FILTER_MITCH, "MITCH", 0, "Mitch", ""}, {0, NULL, 0, NULL, NULL}}; + static EnumPropertyItem aspect_correction_type_items[] = { + {CMP_NODE_BLUR_ASPECT_NONE, "NONE", 0, "None", ""}, + {CMP_NODE_BLUR_ASPECT_Y, "Y", 0, "Y", ""}, + {CMP_NODE_BLUR_ASPECT_X, "X", 0, "X", ""}, + {0, NULL, 0, NULL, NULL}}; + RNA_def_struct_sdna_from(srna, "NodeBlurData", "storage"); prop = RNA_def_property(srna, "size_x", PROP_INT, PROP_NONE); @@ -1049,21 +1054,27 @@ static void def_cmp_blur(StructRNA *srna) RNA_def_property_ui_text(prop, "Relative", "Use relative (percent) values to define blur radius"); RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); + prop = RNA_def_property(srna, "aspect_correction", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_sdna(prop, NULL, "aspect"); + RNA_def_property_enum_items(prop, aspect_correction_type_items); + RNA_def_property_ui_text(prop, "Aspect Correction", "Type of aspect correction to use"); + RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); + prop = RNA_def_property(srna, "factor", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "fac"); RNA_def_property_range(prop, 0.0f, 2.0f); RNA_def_property_ui_text(prop, "Factor", ""); RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); - prop = RNA_def_property(srna, "factor_x", PROP_FLOAT, PROP_NONE); + prop = RNA_def_property(srna, "factor_x", PROP_FLOAT, PROP_PERCENTAGE); RNA_def_property_float_sdna(prop, NULL, "percentx"); - RNA_def_property_range(prop, 0.0f, 1.0f); + RNA_def_property_range(prop, 0.0f, 100.0f); RNA_def_property_ui_text(prop, "Relative Size X", ""); RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); - prop = RNA_def_property(srna, "factor_y", PROP_FLOAT, PROP_NONE); + prop = RNA_def_property(srna, "factor_y", PROP_FLOAT, PROP_PERCENTAGE); RNA_def_property_float_sdna(prop, NULL, "percenty"); - RNA_def_property_range(prop, 0.0f, 1.0f); + RNA_def_property_range(prop, 0.0f, 100.0f); RNA_def_property_ui_text(prop, "Relative Size Y", ""); RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); diff --git a/source/blender/makesrna/intern/rna_object.c b/source/blender/makesrna/intern/rna_object.c index 2196da32aa3..ccaa6eb111a 100644 --- a/source/blender/makesrna/intern/rna_object.c +++ b/source/blender/makesrna/intern/rna_object.c @@ -1838,7 +1838,7 @@ static void rna_def_object(BlenderRNA *brna) prop= RNA_def_property(srna, "material_slots", PROP_COLLECTION, PROP_NONE); RNA_def_property_collection_sdna(prop, NULL, "mat", "totcol"); RNA_def_property_struct_type(prop, "MaterialSlot"); - RNA_def_property_collection_funcs(prop, NULL, NULL, NULL, "rna_iterator_array_get", 0, 0, 0); /* don't dereference pointer! */ + RNA_def_property_collection_funcs(prop, NULL, NULL, NULL, "rna_iterator_array_get", NULL, NULL, NULL); /* don't dereference pointer! */ RNA_def_property_ui_text(prop, "Material Slots", "Material slots in the object"); prop= RNA_def_property(srna, "active_material", PROP_POINTER, PROP_NONE); diff --git a/source/blender/makesrna/intern/rna_object_api.c b/source/blender/makesrna/intern/rna_object_api.c index 468a97f5269..ac4b86b4036 100644 --- a/source/blender/makesrna/intern/rna_object_api.c +++ b/source/blender/makesrna/intern/rna_object_api.c @@ -235,6 +235,50 @@ static Mesh *rna_Object_create_mesh(Object *ob, ReportList *reports, Scene *sce, return tmpmesh; } +/* mostly a copy from convertblender.c */ +static void dupli_render_particle_set(Scene *scene, Object *ob, int level, int enable) +{ + /* ugly function, but we need to set particle systems to their render + * settings before calling object_duplilist, to get render level duplis */ + Group *group; + GroupObject *go; + ParticleSystem *psys; + DerivedMesh *dm; + float mat[4][4]; + + unit_m4(mat); + + if(level >= MAX_DUPLI_RECUR) + return; + + if(ob->transflag & OB_DUPLIPARTS) { + for(psys=ob->particlesystem.first; psys; psys=psys->next) { + if(ELEM(psys->part->ren_as, PART_DRAW_OB, PART_DRAW_GR)) { + if(enable) + psys_render_set(ob, psys, mat, mat, 1, 1, 0.f); + else + psys_render_restore(ob, psys); + } + } + + if(level == 0 && enable) { + /* this is to make sure we get render level duplis in groups: + * the derivedmesh must be created before init_render_mesh, + * since object_duplilist does dupliparticles before that */ + dm = mesh_create_derived_render(scene, ob, CD_MASK_BAREMESH|CD_MASK_MTFACE|CD_MASK_MCOL); + dm->release(dm); + + for(psys=ob->particlesystem.first; psys; psys=psys->next) + psys_get_modifier(ob, psys)->flag &= ~eParticleSystemFlag_psys_updated; + } + } + + if(ob->dup_group==NULL) return; + group= ob->dup_group; + + for(go= group->gobject.first; go; go= go->next) + dupli_render_particle_set(scene, go->ob, level+1, enable); +} /* When no longer needed, duplilist should be freed with Object.free_duplilist */ static void rna_Object_create_duplilist(Object *ob, ReportList *reports, Scene *sce) { @@ -250,9 +294,11 @@ static void rna_Object_create_duplilist(Object *ob, ReportList *reports, Scene * free_object_duplilist(ob->duplilist); ob->duplilist= NULL; } - + if(G.rendering) + dupli_render_particle_set(sce, ob, 0, 1); ob->duplilist= object_duplilist(sce, ob); - + if(G.rendering) + dupli_render_particle_set(sce, ob, 0, 0); /* ob->duplilist should now be freed with Object.free_duplilist */ } diff --git a/source/blender/makesrna/intern/rna_particle.c b/source/blender/makesrna/intern/rna_particle.c index 82e2eb96002..c1514e2f32e 100644 --- a/source/blender/makesrna/intern/rna_particle.c +++ b/source/blender/makesrna/intern/rna_particle.c @@ -31,6 +31,7 @@ #include "rna_internal.h" +#include "DNA_material_types.h" #include "DNA_modifier_types.h" #include "DNA_cloth_types.h" #include "DNA_particle_types.h" @@ -38,6 +39,7 @@ #include "DNA_object_types.h" #include "DNA_scene_types.h" #include "DNA_boid_types.h" +#include "DNA_texture_types.h" #include "WM_types.h" #include "WM_api.h" @@ -106,6 +108,7 @@ EnumPropertyItem part_hair_ren_as_items[] = { #include "BKE_modifier.h" #include "BKE_particle.h" #include "BKE_pointcache.h" +#include "BKE_texture.h" /* use for object space hair get/set */ static void rna_ParticleHairKey_location_object_info(PointerRNA *ptr, ParticleSystemModifierData **psmd_pt, ParticleData **pa_pt) @@ -387,6 +390,18 @@ static void rna_PartSettings_end_set(struct PointerRNA *ptr, float value) settings->end = value; } +static void rna_PartSetting_hairlength_set(struct PointerRNA *ptr, float value) +{ + ParticleSettings *settings = (ParticleSettings*)ptr->data; + settings->normfac = value / 4.f; +} + +static float rna_PartSetting_hairlength_get(struct PointerRNA *ptr) +{ + ParticleSettings *settings = (ParticleSettings*)ptr->data; + return settings->normfac * 4.f; +} + static void rna_PartSetting_linelentail_set(struct PointerRNA *ptr, float value) { ParticleSettings *settings = (ParticleSettings*)ptr->data; @@ -741,6 +756,28 @@ static char *rna_ParticleSystem_path(PointerRNA *ptr) return BLI_sprintfN("particle_systems[\"%s\"]", psys->name); } +static void rna_ParticleSettings_mtex_begin(CollectionPropertyIterator *iter, PointerRNA *ptr) +{ + ParticleSettings *part= (ParticleSettings*)ptr->data; + rna_iterator_array_begin(iter, (void*)part->mtex, sizeof(MTex*), MAX_MTEX, 0, NULL); +} + +static PointerRNA rna_ParticleSettings_active_texture_get(PointerRNA *ptr) +{ + ParticleSettings *part= (ParticleSettings*)ptr->data; + Tex *tex; + + tex= give_current_particle_texture(part); + return rna_pointer_inherit_refine(ptr, &RNA_Texture, tex); +} + +static void rna_ParticleSettings_active_texture_set(PointerRNA *ptr, PointerRNA value) +{ + ParticleSettings *part= (ParticleSettings*)ptr->data; + + set_current_particle_texture(part, value.data); +} + /* irritating string functions for each index :/ */ static void rna_ParticleVGroup_name_get_0(PointerRNA *ptr, char *value) { psys_vg_name_get__internal(ptr, value, 0); } static void rna_ParticleVGroup_name_get_1(PointerRNA *ptr, char *value) { psys_vg_name_get__internal(ptr, value, 1); } @@ -1083,6 +1120,230 @@ static void rna_def_fluid_settings(BlenderRNA *brna) } +static void rna_def_particle_settings_mtex(BlenderRNA *brna) +{ + StructRNA *srna; + PropertyRNA *prop; + + static EnumPropertyItem texco_items[] = { + {TEXCO_GLOB, "GLOBAL", 0, "Global", "Uses global coordinates for the texture coordinates"}, + {TEXCO_OBJECT, "OBJECT", 0, "Object", "Uses linked object's coordinates for texture coordinates"}, + {TEXCO_UV, "UV", 0, "UV", "Uses UV coordinates for texture coordinates"}, + {TEXCO_ORCO, "ORCO", 0, "Generated", "Uses the original undeformed coordinates of the object"}, + {TEXCO_STRAND, "STRAND", 0, "Strand / Particle", "Uses normalized strand texture coordinate (1D) or particle age (X) and trail position (Y)"}, + {0, NULL, 0, NULL, NULL}}; + + static EnumPropertyItem prop_mapping_items[] = { + {MTEX_FLAT, "FLAT", 0, "Flat", "Maps X and Y coordinates directly"}, + {MTEX_CUBE, "CUBE", 0, "Cube", "Maps using the normal vector"}, + {MTEX_TUBE, "TUBE", 0, "Tube", "Maps with Z as central axis"}, + {MTEX_SPHERE, "SPHERE", 0, "Sphere", "Maps with Z as central axis"}, + {0, NULL, 0, NULL, NULL}}; + + static EnumPropertyItem prop_x_mapping_items[] = { + {0, "NONE", 0, "None", ""}, + {1, "X", 0, "X", ""}, + {2, "Y", 0, "Y", ""}, + {3, "Z", 0, "Z", ""}, + {0, NULL, 0, NULL, NULL}}; + + static EnumPropertyItem prop_y_mapping_items[] = { + {0, "NONE", 0, "None", ""}, + {1, "X", 0, "X", ""}, + {2, "Y", 0, "Y", ""}, + {3, "Z", 0, "Z", ""}, + {0, NULL, 0, NULL, NULL}}; + + static EnumPropertyItem prop_z_mapping_items[] = { + {0, "NONE", 0, "None", ""}, + {1, "X", 0, "X", ""}, + {2, "Y", 0, "Y", ""}, + {3, "Z", 0, "Z", ""}, + {0, NULL, 0, NULL, NULL}}; + + srna= RNA_def_struct(brna, "ParticleSettingsTextureSlot", "TextureSlot"); + RNA_def_struct_sdna(srna, "MTex"); + RNA_def_struct_ui_text(srna, "Particle Settings Texture Slot", "Texture slot for textures in a Particle Settings datablock"); + + prop= RNA_def_property(srna, "texture_coords", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_sdna(prop, NULL, "texco"); + RNA_def_property_enum_items(prop, texco_items); + RNA_def_property_ui_text(prop, "Texture Coordinates", "Texture coordinates used to map the texture onto the background"); + RNA_def_property_update(prop, 0, "rna_Particle_reset"); + + prop= RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE); + RNA_def_property_pointer_sdna(prop, NULL, "object"); + RNA_def_property_struct_type(prop, "Object"); + RNA_def_property_flag(prop, PROP_EDITABLE); + RNA_def_property_ui_text(prop, "Object", "Object to use for mapping with Object texture coordinates"); + RNA_def_property_update(prop, 0, "rna_Particle_reset"); + + prop= RNA_def_property(srna, "uv_layer", PROP_STRING, PROP_NONE); + RNA_def_property_string_sdna(prop, NULL, "uvname"); + RNA_def_property_ui_text(prop, "UV Layer", "UV layer to use for mapping with UV texture coordinates"); + RNA_def_property_update(prop, 0, "rna_Particle_reset"); + + prop= RNA_def_property(srna, "mapping_x", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_sdna(prop, NULL, "projx"); + RNA_def_property_enum_items(prop, prop_x_mapping_items); + RNA_def_property_ui_text(prop, "X Mapping", ""); + RNA_def_property_update(prop, 0, "rna_Particle_reset"); + + prop= RNA_def_property(srna, "mapping_y", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_sdna(prop, NULL, "projy"); + RNA_def_property_enum_items(prop, prop_y_mapping_items); + RNA_def_property_ui_text(prop, "Y Mapping", ""); + RNA_def_property_update(prop, 0, "rna_Particle_reset"); + + prop= RNA_def_property(srna, "mapping_z", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_sdna(prop, NULL, "projz"); + RNA_def_property_enum_items(prop, prop_z_mapping_items); + RNA_def_property_ui_text(prop, "Z Mapping", ""); + RNA_def_property_update(prop, 0, "rna_Particle_reset"); + + prop= RNA_def_property(srna, "mapping", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_items(prop, prop_mapping_items); + RNA_def_property_ui_text(prop, "Mapping", ""); + RNA_def_property_update(prop, 0, "rna_Particle_reset"); + + /* map to */ + prop= RNA_def_property(srna, "use_map_time", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "mapto", PAMAP_TIME); + RNA_def_property_ui_text(prop, "Emission Time", "Affect the emission time of the particles"); + RNA_def_property_update(prop, 0, "rna_Particle_reset"); + + prop= RNA_def_property(srna, "use_map_life", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "mapto", PAMAP_LIFE); + RNA_def_property_ui_text(prop, "Life Time", "Affect the life time of the particles"); + RNA_def_property_update(prop, 0, "rna_Particle_reset"); + + prop= RNA_def_property(srna, "use_map_density", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "mapto", PAMAP_DENS); + RNA_def_property_ui_text(prop, "Density", "Affect the density of the particles"); + RNA_def_property_update(prop, 0, "rna_Particle_reset"); + + prop= RNA_def_property(srna, "use_map_size", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "mapto", PAMAP_SIZE); + RNA_def_property_ui_text(prop, "Size", "Affect the particle size"); + RNA_def_property_update(prop, 0, "rna_Particle_reset"); + + prop= RNA_def_property(srna, "use_map_velocity", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "mapto", PAMAP_IVEL); + RNA_def_property_ui_text(prop, "Initial Velocity", "Affect the particle initial velocity"); + RNA_def_property_update(prop, 0, "rna_Particle_reset"); + + prop= RNA_def_property(srna, "use_map_field", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "mapto", PAMAP_FIELD); + RNA_def_property_ui_text(prop, "Force Field", "Affect the particle force fields"); + RNA_def_property_update(prop, 0, "rna_Particle_reset"); + + prop= RNA_def_property(srna, "use_map_gravity", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "mapto", PAMAP_GRAVITY); + RNA_def_property_ui_text(prop, "Gravity", "Affect the particle gravity"); + RNA_def_property_update(prop, 0, "rna_Particle_reset"); + + prop= RNA_def_property(srna, "use_map_damp", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "mapto", PAMAP_DAMP); + RNA_def_property_ui_text(prop, "Damp", "Affect the particle velocity damping"); + RNA_def_property_update(prop, 0, "rna_Particle_redo_child"); + + prop= RNA_def_property(srna, "use_map_clump", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "mapto", PAMAP_CLUMP); + RNA_def_property_ui_text(prop, "Clump", "Affect the child clumping"); + RNA_def_property_update(prop, 0, "rna_Particle_reset"); + + prop= RNA_def_property(srna, "use_map_kink", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "mapto", PAMAP_KINK); + RNA_def_property_ui_text(prop, "Kink", "Affect the child kink"); + RNA_def_property_update(prop, 0, "rna_Particle_redo_child"); + + prop= RNA_def_property(srna, "use_map_rough", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "mapto", PAMAP_ROUGH); + RNA_def_property_ui_text(prop, "Rough", "Affect the child rough"); + RNA_def_property_update(prop, 0, "rna_Particle_redo_child"); + + prop= RNA_def_property(srna, "use_map_length", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "mapto", PAMAP_LENGTH); + RNA_def_property_ui_text(prop, "Length", "Affect the child hair length"); + RNA_def_property_update(prop, 0, "rna_Particle_redo_child"); + + + /* influence factors */ + prop= RNA_def_property(srna, "time_factor", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_sdna(prop, NULL, "timefac"); + RNA_def_property_ui_range(prop, 0, 1, 10, 3); + RNA_def_property_ui_text(prop, "Emission Time Factor", "Amount texture affects particle emission time"); + RNA_def_property_update(prop, 0, "rna_Particle_reset"); + + prop= RNA_def_property(srna, "life_factor", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_sdna(prop, NULL, "lifefac"); + RNA_def_property_ui_range(prop, 0, 1, 10, 3); + RNA_def_property_ui_text(prop, "Life Time Factor", "Amount texture affects particle life time"); + RNA_def_property_update(prop, 0, "rna_Particle_reset"); + + prop= RNA_def_property(srna, "density_factor", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_sdna(prop, NULL, "padensfac"); + RNA_def_property_ui_range(prop, 0, 1, 10, 3); + RNA_def_property_ui_text(prop, "Density Factor", "Amount texture affects particle density"); + RNA_def_property_update(prop, 0, "rna_Particle_reset"); + + prop= RNA_def_property(srna, "size_factor", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_sdna(prop, NULL, "sizefac"); + RNA_def_property_ui_range(prop, 0, 1, 10, 3); + RNA_def_property_ui_text(prop, "Size Factor", "Amount texture affects physical particle size"); + RNA_def_property_update(prop, 0, "rna_Particle_reset"); + + prop= RNA_def_property(srna, "velocity_factor", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_sdna(prop, NULL, "ivelfac"); + RNA_def_property_ui_range(prop, 0, 1, 10, 3); + RNA_def_property_ui_text(prop, "Velocity Factor", "Amount texture affects particle initial velocity"); + RNA_def_property_update(prop, 0, "rna_Particle_reset"); + + + prop= RNA_def_property(srna, "field_factor", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_sdna(prop, NULL, "fieldfac"); + RNA_def_property_ui_range(prop, 0, 1, 10, 3); + RNA_def_property_ui_text(prop, "Field Factor", "Amount texture affects particle force fields"); + RNA_def_property_update(prop, 0, "rna_Particle_reset"); + + prop= RNA_def_property(srna, "gravity_factor", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_sdna(prop, NULL, "gravityfac"); + RNA_def_property_ui_range(prop, 0, 1, 10, 3); + RNA_def_property_ui_text(prop, "Gravity Factor", "Amount texture affects particle gravity"); + RNA_def_property_update(prop, 0, "rna_Particle_reset"); + + prop= RNA_def_property(srna, "damp_factor", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_sdna(prop, NULL, "dampfac"); + RNA_def_property_ui_range(prop, 0, 1, 10, 3); + RNA_def_property_ui_text(prop, "Damp Factor", "Amount texture affects particle damping"); + RNA_def_property_update(prop, 0, "rna_Particle_reset"); + + + prop= RNA_def_property(srna, "length_factor", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_sdna(prop, NULL, "lengthfac"); + RNA_def_property_ui_range(prop, 0, 1, 10, 3); + RNA_def_property_ui_text(prop, "Length Factor", "Amount texture affects child hair length"); + RNA_def_property_update(prop, 0, "rna_Particle_redo_child"); + + prop= RNA_def_property(srna, "clump_factor", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_sdna(prop, NULL, "clumpfac"); + RNA_def_property_ui_range(prop, 0, 1, 10, 3); + RNA_def_property_ui_text(prop, "Clump Factor", "Amount texture affects child clump"); + RNA_def_property_update(prop, 0, "rna_Particle_redo_child"); + + prop= RNA_def_property(srna, "kink_factor", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_sdna(prop, NULL, "kinkfac"); + RNA_def_property_ui_range(prop, 0, 1, 10, 3); + RNA_def_property_ui_text(prop, "Kink Factor", "Amount texture affects child kink"); + RNA_def_property_update(prop, 0, "rna_Particle_redo_child"); + + prop= RNA_def_property(srna, "rough_factor", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_sdna(prop, NULL, "roughfac"); + RNA_def_property_ui_range(prop, 0, 1, 10, 3); + RNA_def_property_ui_text(prop, "Rough Factor", "Amount texture affects child roughness"); + RNA_def_property_update(prop, 0, "rna_Particle_redo_child"); +} + static void rna_def_particle_settings(BlenderRNA *brna) { StructRNA *srna; @@ -1189,10 +1450,9 @@ static void rna_def_particle_settings(BlenderRNA *brna) static EnumPropertyItem bb_anim_items[] = { {PART_BB_ANIM_NONE, "NONE", 0, "None", ""}, - {PART_BB_ANIM_TIME, "TIME", 0, "Time", ""}, + {PART_BB_ANIM_AGE, "AGE", 0, "Age", ""}, + {PART_BB_ANIM_FRAME, "FRAME", 0, "Frame", ""}, {PART_BB_ANIM_ANGLE, "ANGLE", 0, "Angle", ""}, - //{PART_BB_ANIM_OFF_TIME, "OFF_TIME", 0, "off_time", ""}, - //{PART_BB_ANIM_OFF_ANGLE, "OFF_ANGLE", 0, "off_angle", ""}, {0, NULL, 0, NULL, NULL} }; @@ -1207,6 +1467,9 @@ static void rna_def_particle_settings(BlenderRNA *brna) RNA_def_struct_ui_text(srna, "Particle Settings", "Particle settings, reusable by multiple particle systems"); RNA_def_struct_ui_icon(srna, ICON_PARTICLE_DATA); + rna_def_mtex_common(brna, srna, "rna_ParticleSettings_mtex_begin", "rna_ParticleSettings_active_texture_get", + "rna_ParticleSettings_active_texture_set", "ParticleSettingsTextureSlot", "ParticleSettingsTextureSlots", "rna_Particle_reset"); + /* fluid particle type can't be checked from the type value in rna as it's not shown in the menu */ prop= RNA_def_property(srna, "is_fluid", PROP_BOOLEAN, PROP_NONE); RNA_def_property_clear_flag(prop, PROP_EDITABLE); @@ -1277,6 +1540,12 @@ static void rna_def_particle_settings(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Mass from Size", "Multiply mass by particle size"); RNA_def_property_update(prop, 0, "rna_Particle_reset"); + prop= RNA_def_property(srna, "use_advanced_hair", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", PART_HIDE_ADVANCED_HAIR); + RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); + RNA_def_property_ui_text(prop, "Advanced", "Use full physics calculations for growing hair"); + RNA_def_property_update(prop, 0, "rna_Particle_reset"); + prop= RNA_def_property(srna, "lock_boids_to_surface", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_BOIDS_2D); RNA_def_property_ui_text(prop, "Boids 2D", "Constrain boids to a surface"); @@ -1292,9 +1561,14 @@ static void rna_def_particle_settings(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Invert Grid", "Invert what is considered object and what is not"); RNA_def_property_update(prop, 0, "rna_Particle_reset"); + prop= RNA_def_property(srna, "hexagonal_grid", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_GRID_HEXAGONAL); + RNA_def_property_ui_text(prop, "Hexagonal Grid", "Create the grid in a hexagonal pattern"); + RNA_def_property_update(prop, 0, "rna_Particle_reset"); + prop= RNA_def_property(srna, "apply_effector_to_children", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_CHILD_EFFECT); - RNA_def_property_ui_text(prop, "Children", "Apply effectors to children"); + RNA_def_property_ui_text(prop, "Effect Children", "Apply effectors to children"); RNA_def_property_update(prop, 0, "rna_Particle_redo"); prop= RNA_def_property(srna, "create_long_hair_children", PROP_BOOLEAN, PROP_NONE); @@ -1695,6 +1969,13 @@ static void rna_def_particle_settings(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Grid Randomness", "Add random offset to the grid locations"); RNA_def_property_update(prop, 0, "rna_Particle_reset"); + prop= RNA_def_property(srna, "effector_amount", PROP_INT, PROP_UNSIGNED); + /* in theory PROP_ANIMATABLE perhaps should be cleared, but animating this can give some interesting results! */ + RNA_def_property_range(prop, 0, 10000); /* 10000 effectors will bel SLOW, but who knows */ + RNA_def_property_ui_range(prop, 0, 100, 1, 0); + RNA_def_property_ui_text(prop, "Effector Amount", "How many particles are effectors (0 is all particles)"); + RNA_def_property_update(prop, 0, "rna_Particle_reset"); + /* initial velocity factors */ prop= RNA_def_property(srna, "normal_factor", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "normfac");//optional if prop names are the same @@ -1776,6 +2057,13 @@ static void rna_def_particle_settings(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Random Phase", "Randomize rotation phase"); RNA_def_property_update(prop, 0, "rna_Particle_reset"); + prop= RNA_def_property(srna, "hair_length", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_funcs(prop, "rna_PartSetting_hairlength_get", "rna_PartSetting_hairlength_set", NULL); + RNA_def_property_range(prop, 0.0f, 1000.0f); + RNA_def_property_ui_range(prop, 0.0f, 10.0f, 1, 3); + RNA_def_property_ui_text(prop, "Hair Length", "Length of the hair"); + RNA_def_property_update(prop, 0, "rna_Particle_reset"); + /* physical properties */ prop= RNA_def_property(srna, "mass", PROP_FLOAT, PROP_NONE); RNA_def_property_range(prop, 0.001f, 100000.0f); @@ -1796,12 +2084,6 @@ static void rna_def_particle_settings(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Random Size", "Give the particle size a random variation"); RNA_def_property_update(prop, 0, "rna_Particle_reset"); - prop= RNA_def_property(srna, "reaction_shape", PROP_FLOAT, PROP_NONE); - RNA_def_property_float_sdna(prop, NULL, "reactshape"); - RNA_def_property_range(prop, 0.0f, 10.0f); - RNA_def_property_ui_text(prop, "Shape", "Power of reaction strength dependence on distance to target"); - RNA_def_property_update(prop, 0, "rna_Particle_reset"); - /* global physical properties */ prop= RNA_def_property(srna, "drag_factor", PROP_FLOAT, PROP_NONE); @@ -2462,6 +2744,7 @@ void RNA_def_particle(BlenderRNA *brna) rna_def_particle(brna); rna_def_particle_dupliweight(brna); rna_def_particle_system(brna); + rna_def_particle_settings_mtex(brna); rna_def_particle_settings(brna); } diff --git a/source/blender/makesrna/intern/rna_render.c b/source/blender/makesrna/intern/rna_render.c index 6344ddca06e..b889d0082f8 100644 --- a/source/blender/makesrna/intern/rna_render.c +++ b/source/blender/makesrna/intern/rna_render.c @@ -54,7 +54,7 @@ static RenderEngineType internal_game_type = { ListBase R_engines = {NULL, NULL}; -void RE_engines_init() +void RE_engines_init(void) { BLI_addtail(&R_engines, &internal_render_type); #ifdef WITH_GAMEENGINE @@ -62,7 +62,7 @@ void RE_engines_init() #endif } -void RE_engines_exit() +void RE_engines_exit(void) { RenderEngineType *type, *next; @@ -334,7 +334,9 @@ static void rna_def_render_layer(BlenderRNA *brna) RNA_def_function_flag(func, FUNC_USE_REPORTS); prop= RNA_def_string(func, "filename", "", 0, "Filename", "Filename to load into this render tile, must be no smaller then the renderlayer"); RNA_def_property_flag(prop, PROP_REQUIRED); - + prop= RNA_def_int(func, "x", 0, 0, INT_MAX, "Offset X", "Offset the position to copy from if the image is larger then the render layer", 0, INT_MAX); + prop= RNA_def_int(func, "y", 0, 0, INT_MAX, "Offset Y", "Offset the position to copy from if the image is larger then the render layer", 0, INT_MAX); + RNA_define_verify_sdna(0); rna_def_render_layer_common(srna, 0); diff --git a/source/blender/makesrna/intern/rna_sensor.c b/source/blender/makesrna/intern/rna_sensor.c index 7073923b05e..e0a9c17193c 100644 --- a/source/blender/makesrna/intern/rna_sensor.c +++ b/source/blender/makesrna/intern/rna_sensor.c @@ -507,12 +507,12 @@ static void rna_def_armature_sensor(BlenderRNA *brna) prop= RNA_def_property(srna, "bone", PROP_STRING, PROP_NONE); RNA_def_property_string_sdna(prop, NULL, "posechannel"); - RNA_def_property_ui_text(prop, "Bone name", "Identify the bone to check value from"); + RNA_def_property_ui_text(prop, "Bone Name", "Identify the bone to check value from"); RNA_def_property_update(prop, NC_LOGIC, "rna_Sensor_Armature_update"); prop= RNA_def_property(srna, "constraint", PROP_STRING, PROP_NONE); RNA_def_property_string_sdna(prop, NULL, "constraint"); - RNA_def_property_ui_text(prop, "Constraint name", "Identify the bone constraint to check value from"); + RNA_def_property_ui_text(prop, "Constraint Name", "Identify the bone constraint to check value from"); RNA_def_property_update(prop, NC_LOGIC, "rna_Sensor_Armature_update"); prop= RNA_def_property(srna, "value", PROP_FLOAT, PROP_NONE); diff --git a/source/blender/makesrna/intern/rna_sequencer.c b/source/blender/makesrna/intern/rna_sequencer.c index 233ffd06188..d3d36bff012 100644 --- a/source/blender/makesrna/intern/rna_sequencer.c +++ b/source/blender/makesrna/intern/rna_sequencer.c @@ -446,7 +446,7 @@ static void rna_Sequence_filepath_get(PointerRNA *ptr, char *value) Sequence *seq= (Sequence*)(ptr->data); char path[FILE_MAX]; - BLI_join_dirfile(path, seq->strip->dir, seq->strip->stripdata->name); + BLI_join_dirfile(path, sizeof(path), seq->strip->dir, seq->strip->stripdata->name); BLI_strncpy(value, path, strlen(path)+1); } @@ -455,7 +455,7 @@ static int rna_Sequence_filepath_length(PointerRNA *ptr) Sequence *seq= (Sequence*)(ptr->data); char path[FILE_MAX]; - BLI_join_dirfile(path, seq->strip->dir, seq->strip->stripdata->name); + BLI_join_dirfile(path, sizeof(path), seq->strip->dir, seq->strip->stripdata->name); return strlen(path)+1; } @@ -474,7 +474,7 @@ static void rna_Sequence_proxy_filepath_get(PointerRNA *ptr, char *value) StripProxy *proxy= (StripProxy*)(ptr->data); char path[FILE_MAX]; - BLI_join_dirfile(path, proxy->dir, proxy->file); + BLI_join_dirfile(path, sizeof(path), proxy->dir, proxy->file); BLI_strncpy(value, path, strlen(path)+1); } @@ -483,7 +483,7 @@ static int rna_Sequence_proxy_filepath_length(PointerRNA *ptr) StripProxy *proxy= (StripProxy*)(ptr->data); char path[FILE_MAX]; - BLI_join_dirfile(path, proxy->dir, proxy->file); + BLI_join_dirfile(path, sizeof(path), proxy->dir, proxy->file); return strlen(path)+1; } diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c index 45622f500df..e122f99776d 100644 --- a/source/blender/makesrna/intern/rna_space.c +++ b/source/blender/makesrna/intern/rna_space.c @@ -742,6 +742,59 @@ static void rna_BackgroundImage_opacity_set(PointerRNA *ptr, float value) bgpic->blend = 1.0f - value; } +static EnumPropertyItem *rna_SpaceProperties_texture_context_itemf(bContext *C, PointerRNA *ptr, int *free) +{ + Scene *scene = CTX_data_scene(C); + Object *ob = CTX_data_active_object(C); + EnumPropertyItem *item= NULL; + EnumPropertyItem tmp= {0, "", 0, "", ""}; + int totitem= 0; + + if(ob) { + if(ob->type == OB_LAMP) { + tmp.value = SB_TEXC_MAT_OR_LAMP; + tmp.description = "Show Lamp Textures"; + tmp.identifier = "LAMP"; + tmp.icon = ICON_LAMP_POINT; + RNA_enum_item_add(&item, &totitem, &tmp); + } + else if(ob->totcol) { + tmp.value = SB_TEXC_MAT_OR_LAMP; + tmp.description = "Show Material Textures"; + tmp.identifier = "MATERIAL"; + tmp.icon = ICON_MATERIAL; + RNA_enum_item_add(&item, &totitem, &tmp); + } + + if(ob->particlesystem.first) { + tmp.value = SB_TEXC_PARTICLES; + tmp.description = "Show Particle Textures"; + tmp.identifier = "PARTICLE"; + tmp.icon = ICON_PARTICLES; + RNA_enum_item_add(&item, &totitem, &tmp); + } + } + + if(scene && scene->world) { + tmp.value = SB_TEXC_WORLD; + tmp.description = "Show World Textures"; + tmp.identifier = "WORLD"; + tmp.icon = ICON_WORLD; + RNA_enum_item_add(&item, &totitem, &tmp); + } + + tmp.value = SB_TEXC_BRUSH; + tmp.description = "Show Brush Textures"; + tmp.identifier = "BRUSH"; + tmp.icon = ICON_BRUSH_DATA; + RNA_enum_item_add(&item, &totitem, &tmp); + + RNA_enum_item_end(&item, &totitem); + *free = 1; + + return item; +} + #else static void rna_def_space(BlenderRNA *brna) @@ -1323,6 +1376,10 @@ static void rna_def_space_buttons(BlenderRNA *brna) {BUT_HORIZONTAL, "HORIZONTAL", 0, "Horizontal", ""}, {BUT_VERTICAL, "VERTICAL", 0, "Vertical", ""}, {0, NULL, 0, NULL, NULL}}; + + static EnumPropertyItem buttons_texture_context_items[] = { + {SB_TEXC_MAT_OR_LAMP, "MATERIAL", ICON_MATERIAL, "Material", "Material"}, + {0, NULL, 0, NULL, NULL}}; //actually populated dynamically trough a function srna= RNA_def_struct(brna, "SpaceProperties", "Space"); RNA_def_struct_sdna(srna, "SpaceButs"); @@ -1342,9 +1399,10 @@ static void rna_def_space_buttons(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Align", "Arrangement of the panels"); RNA_def_property_update(prop, NC_SPACE|ND_SPACE_PROPERTIES, NULL); - prop= RNA_def_property(srna, "show_brush_texture", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "flag", SB_BRUSH_TEX); - RNA_def_property_ui_text(prop, "Brush Texture", "Show brush textures"); + prop= RNA_def_property(srna, "texture_context", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_items(prop, buttons_texture_context_items); + RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_SpaceProperties_texture_context_itemf"); + RNA_def_property_ui_text(prop, "Texture Context", "Type of texture data to display and edit"); RNA_def_property_update(prop, NC_SPACE|ND_SPACE_PROPERTIES, NULL); /* pinned data */ @@ -1819,6 +1877,11 @@ static void rna_def_space_graph(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Only Selected Keyframes Handles", "Only show and edit handles of selected keyframes"); RNA_def_property_update(prop, NC_SPACE|ND_SPACE_GRAPH, NULL); + prop= RNA_def_property(srna, "use_fancy_drawing", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", SIPO_BEAUTYDRAW_OFF); + RNA_def_property_ui_text(prop, "Use Fancy Drawing", "Draw F-Curves using Anti-Aliasing and other fancy effects. Disable for better performance"); + RNA_def_property_update(prop, NC_SPACE|ND_SPACE_GRAPH, NULL); + /* editing */ prop= RNA_def_property(srna, "use_auto_merge_keyframes", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", SIPO_NOTRANSKEYCULL); @@ -2263,8 +2326,14 @@ static void rna_def_space_node(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Backdrop", "Use active Viewer Node output as backdrop for compositing nodes"); RNA_def_property_update(prop, NC_SPACE|ND_SPACE_NODE_VIEW, NULL); + prop= RNA_def_property(srna, "use_auto_render", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flag", SNODE_AUTO_RENDER); + RNA_def_property_ui_text(prop, "Auto Render", "Re-render and composite changed layer on 3D edits"); + RNA_def_property_update(prop, NC_SPACE|ND_SPACE_NODE_VIEW, NULL); + prop= RNA_def_property(srna, "backdrop_zoom", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "zoom"); + RNA_def_property_float_default(prop, 1.0f); RNA_def_property_range(prop, 0.01f, FLT_MAX); RNA_def_property_ui_range(prop, 0.01, 100, 1, 2); RNA_def_property_ui_text(prop, "Backdrop Zoom", "Backdrop zoom factor"); diff --git a/source/blender/makesrna/intern/rna_texture.c b/source/blender/makesrna/intern/rna_texture.c index 7c83676113d..9f6014fdbc2 100644 --- a/source/blender/makesrna/intern/rna_texture.c +++ b/source/blender/makesrna/intern/rna_texture.c @@ -185,6 +185,20 @@ void rna_TextureSlot_update(Main *bmain, Scene *scene, PointerRNA *ptr) case ID_BR: WM_main_add_notifier(NC_BRUSH, id); break; + case ID_PA: + { + MTex *mtex= ptr->data; + int recalc = OB_RECALC_DATA; + + if(mtex->mapto & PAMAP_INIT) + recalc |= PSYS_RECALC_RESET; + if(mtex->mapto & PAMAP_CHILD) + recalc |= PSYS_RECALC_CHILD; + + DAG_id_tag_update(id, recalc); + WM_main_add_notifier(NC_OBJECT|ND_PARTICLE|NA_EDITED, NULL); + break; + } } } diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c index e080b735048..b2b38bc38be 100644 --- a/source/blender/makesrna/intern/rna_userdef.c +++ b/source/blender/makesrna/intern/rna_userdef.c @@ -255,7 +255,7 @@ static void rna_userdef_addon_remove(bAddon *bext) static void rna_userdef_temp_update(Main *bmain, Scene *scene, PointerRNA *ptr) { extern char btempdir[]; - BLI_where_is_temp(btempdir, 1); + BLI_where_is_temp(btempdir, FILE_MAX, 1); } static void rna_userdef_text_update(Main *bmain, Scene *scene, PointerRNA *ptr) diff --git a/source/blender/modifiers/intern/MOD_array.c b/source/blender/modifiers/intern/MOD_array.c index 1fdfe6c192c..6c729c8519f 100644 --- a/source/blender/modifiers/intern/MOD_array.c +++ b/source/blender/modifiers/intern/MOD_array.c @@ -51,6 +51,8 @@ #include "depsgraph_private.h" +#include "MOD_util.h" + static void initData(ModifierData *md) { ArrayModifierData *amd = (ArrayModifierData*) md; @@ -546,12 +548,10 @@ static DerivedMesh *arrayModifier_doArray(ArrayModifierData *amd, if (inMF.v4) mf2->v4 = calc_mapping(indexMap, inMF.v4, j); - test_index_face_maxvert(mf2, &result->faceData, numFaces, inMF.v4?4:3, numVerts); numFaces++; /* if the face has fewer than 3 vertices, don't create it */ - if(mf2->v3 == 0 || (mf2->v1 && (mf2->v1 == mf2->v3 || mf2->v1 == - mf2->v4))) { + if(test_index_face_maxvert(mf2, &result->faceData, numFaces-1, inMF.v4?4:3, numVerts) < 3) { numFaces--; DM_free_face_data(result, numFaces, 1); } diff --git a/source/blender/modifiers/intern/MOD_bevel.c b/source/blender/modifiers/intern/MOD_bevel.c index effc376943e..09e5016cb2b 100644 --- a/source/blender/modifiers/intern/MOD_bevel.c +++ b/source/blender/modifiers/intern/MOD_bevel.c @@ -38,6 +38,8 @@ #include "BKE_modifier.h" #include "BKE_particle.h" +#include "MOD_util.h" + static void initData(ModifierData *md) { diff --git a/source/blender/modifiers/intern/MOD_boolean.c b/source/blender/modifiers/intern/MOD_boolean.c index c40d6cfb79e..3aa5bff5f61 100644 --- a/source/blender/modifiers/intern/MOD_boolean.c +++ b/source/blender/modifiers/intern/MOD_boolean.c @@ -41,6 +41,7 @@ #include "depsgraph_private.h" #include "MOD_boolean_util.h" +#include "MOD_util.h" static void copyData(ModifierData *md, ModifierData *target) diff --git a/source/blender/modifiers/intern/MOD_boolean_util.c b/source/blender/modifiers/intern/MOD_boolean_util.c index 900a94487e5..8cd032a48c4 100644 --- a/source/blender/modifiers/intern/MOD_boolean_util.c +++ b/source/blender/modifiers/intern/MOD_boolean_util.c @@ -48,6 +48,8 @@ #include "CSG_BooleanOps.h" +#include "MOD_boolean_util.h" + /** * Here's the vertex iterator structure used to walk through * the blender vertex structure. @@ -451,7 +453,7 @@ static void FreeMeshDescriptors( FaceIt_Destruct(face_it); } -DerivedMesh *NewBooleanDerivedMesh_intern( +static DerivedMesh *NewBooleanDerivedMesh_intern( DerivedMesh *dm, struct Object *ob, DerivedMesh *dm_select, struct Object *ob_select, int int_op_type, Material **mat, int *totmat) { diff --git a/source/blender/modifiers/intern/MOD_build.c b/source/blender/modifiers/intern/MOD_build.c index 704caf0aff8..3bf1fa401f9 100644 --- a/source/blender/modifiers/intern/MOD_build.c +++ b/source/blender/modifiers/intern/MOD_build.c @@ -46,6 +46,7 @@ #include "BKE_particle.h" #include "BKE_scene.h" +#include "MOD_util.h" static void initData(ModifierData *md) { diff --git a/source/blender/modifiers/intern/MOD_cloth.c b/source/blender/modifiers/intern/MOD_cloth.c index 1cb46c0992f..bb1fc67ef8b 100644 --- a/source/blender/modifiers/intern/MOD_cloth.c +++ b/source/blender/modifiers/intern/MOD_cloth.c @@ -47,6 +47,7 @@ #include "depsgraph_private.h" +#include "MOD_util.h" static void initData(ModifierData *md) { diff --git a/source/blender/modifiers/intern/MOD_collision.c b/source/blender/modifiers/intern/MOD_collision.c index 8decb460d6a..106e8b3957a 100644 --- a/source/blender/modifiers/intern/MOD_collision.c +++ b/source/blender/modifiers/intern/MOD_collision.c @@ -48,6 +48,7 @@ #include "BKE_pointcache.h" #include "BKE_scene.h" +#include "MOD_util.h" static void initData(ModifierData *md) { @@ -110,8 +111,6 @@ static void deformVerts(ModifierData *md, Object *ob, { CollisionModifierData *collmd = (CollisionModifierData*) md; DerivedMesh *dm = NULL; - float current_time = 0; - unsigned int numverts = 0, i = 0; MVert *tempVert = NULL; /* if possible use/create DerivedMesh */ @@ -126,6 +125,9 @@ static void deformVerts(ModifierData *md, Object *ob, if(dm) { + float current_time = 0; + unsigned int numverts = 0; + CDDM_apply_vert_coords(dm, vertexCos); CDDM_calc_normals(dm); @@ -137,7 +139,9 @@ static void deformVerts(ModifierData *md, Object *ob, numverts = dm->getNumVerts ( dm ); if((current_time > collmd->time)|| (BKE_ptcache_get_continue_physics())) - { + { + unsigned int i; + // check if mesh has changed if(collmd->x && (numverts != collmd->numverts)) freeData((ModifierData *)collmd); diff --git a/source/blender/modifiers/intern/MOD_curve.c b/source/blender/modifiers/intern/MOD_curve.c index c4e41941acc..d458d026c61 100644 --- a/source/blender/modifiers/intern/MOD_curve.c +++ b/source/blender/modifiers/intern/MOD_curve.c @@ -44,6 +44,7 @@ #include "depsgraph_private.h" +#include "MOD_util.h" static void initData(ModifierData *md) { diff --git a/source/blender/modifiers/intern/MOD_decimate.c b/source/blender/modifiers/intern/MOD_decimate.c index 2f1723cf9bb..e90a6ea2ac4 100644 --- a/source/blender/modifiers/intern/MOD_decimate.c +++ b/source/blender/modifiers/intern/MOD_decimate.c @@ -47,6 +47,8 @@ #include "LOD_decimation.h" #endif +#include "MOD_util.h" + static void initData(ModifierData *md) { DecimateModifierData *dmd = (DecimateModifierData*) md; diff --git a/source/blender/modifiers/intern/MOD_edgesplit.c b/source/blender/modifiers/intern/MOD_edgesplit.c index 56138552000..22b7e72adfc 100644 --- a/source/blender/modifiers/intern/MOD_edgesplit.c +++ b/source/blender/modifiers/intern/MOD_edgesplit.c @@ -48,6 +48,7 @@ #include "MEM_guardedalloc.h" +#include "MOD_util.h" #if 0 #define EDGESPLIT_DEBUG_3 diff --git a/source/blender/modifiers/intern/MOD_explode.c b/source/blender/modifiers/intern/MOD_explode.c index a0765b56808..67476a33a00 100644 --- a/source/blender/modifiers/intern/MOD_explode.c +++ b/source/blender/modifiers/intern/MOD_explode.c @@ -51,6 +51,7 @@ #include "MEM_guardedalloc.h" +#include "MOD_util.h" static void initData(ModifierData *md) { @@ -128,11 +129,10 @@ static void createFacepa(ExplodeModifierData *emd, /* set protected verts */ if(emd->vgroup){ MDeformVert *dvert = dm->getVertDataArray(dm, CD_MDEFORMVERT); - float val; if(dvert){ - int defgrp_index= emd->vgroup-1; + const int defgrp_index= emd->vgroup-1; for(i=0; i<totvert; i++, dvert++){ - val = BLI_frand(); + float val = BLI_frand(); val = (1.0f-emd->protect)*val + emd->protect*0.5f; if(val < defvert_find_weight(dvert, defgrp_index)) vertpa[i] = -1; diff --git a/source/blender/modifiers/intern/MOD_fluidsim.c b/source/blender/modifiers/intern/MOD_fluidsim.c index 19111b0cafc..9a1635e3dad 100644 --- a/source/blender/modifiers/intern/MOD_fluidsim.c +++ b/source/blender/modifiers/intern/MOD_fluidsim.c @@ -42,6 +42,7 @@ #include "depsgraph_private.h" +#include "MOD_util.h" #include "MOD_fluidsim_util.h" #include "MEM_guardedalloc.h" diff --git a/source/blender/modifiers/intern/MOD_fluidsim_util.c b/source/blender/modifiers/intern/MOD_fluidsim_util.c index eb556e31aba..fdf3209b500 100644 --- a/source/blender/modifiers/intern/MOD_fluidsim_util.c +++ b/source/blender/modifiers/intern/MOD_fluidsim_util.c @@ -45,11 +45,13 @@ #include "BLI_utildefines.h" #include "BKE_main.h" +#include "BKE_fluidsim.h" /* ensure definitions here match */ #include "BKE_cdderivedmesh.h" #include "BKE_mesh.h" #include "BKE_utildefines.h" #include "BKE_global.h" /* G.main->name only */ +#include "MOD_fluidsim_util.h" #include "MOD_modifiertypes.h" #include "MEM_guardedalloc.h" @@ -167,7 +169,7 @@ void fluidsim_free(FluidsimModifierData *fluidmd) #ifndef DISABLE_ELBEEM /* read .bobj.gz file into a fluidsimDerivedMesh struct */ -DerivedMesh *fluidsim_read_obj(char *filename) +static DerivedMesh *fluidsim_read_obj(const char *filename) { int wri = 0,i; int gotBytes; @@ -379,7 +381,7 @@ void fluid_estimate_memory(Object *ob, FluidsimSettings *fss, char *value) /* read zipped fluidsim velocities into the co's of the fluidsimsettings normals struct */ -void fluidsim_read_vel_cache(FluidsimModifierData *fluidmd, DerivedMesh *dm, char *filename) +static void fluidsim_read_vel_cache(FluidsimModifierData *fluidmd, DerivedMesh *dm, char *filename) { int wri, i, j; float wrf; @@ -442,7 +444,7 @@ void fluidsim_read_vel_cache(FluidsimModifierData *fluidmd, DerivedMesh *dm, cha gzclose(gzf); } -DerivedMesh *fluidsim_read_cache(DerivedMesh *orgdm, FluidsimModifierData *fluidmd, int framenr, int useRenderParams) +static DerivedMesh *fluidsim_read_cache(DerivedMesh *orgdm, FluidsimModifierData *fluidmd, int framenr, int useRenderParams) { int displaymode = 0; int curFrame = framenr - 1 /*scene->r.sfra*/; /* start with 0 at start frame */ @@ -459,7 +461,7 @@ DerivedMesh *fluidsim_read_cache(DerivedMesh *orgdm, FluidsimModifierData *fluid displaymode = fss->renderDisplayMode; } - strncpy(targetDir, fss->surfdataPath, FILE_MAXDIR); + BLI_strncpy(targetDir, fss->surfdataPath, sizeof(targetDir)); // use preview or final mesh? if(displaymode==1) @@ -479,8 +481,7 @@ DerivedMesh *fluidsim_read_cache(DerivedMesh *orgdm, FluidsimModifierData *fluid BLI_path_abs(targetDir, G.main->name); BLI_path_frame(targetDir, curFrame, 0); // fixed #frame-no - strcpy(targetFile,targetDir); - strcat(targetFile, ".bobj.gz"); + BLI_snprintf(targetFile, sizeof(targetFile), "%s.bobj.gz", targetDir); dm = fluidsim_read_obj(targetFile); @@ -538,7 +539,7 @@ DerivedMesh *fluidsim_read_cache(DerivedMesh *orgdm, FluidsimModifierData *fluid DerivedMesh *fluidsimModifier_do(FluidsimModifierData *fluidmd, Scene *scene, Object *UNUSED(ob), DerivedMesh *dm, - int useRenderParams) + int useRenderParams, int UNUSED(isFinalCalc)) { #ifndef DISABLE_ELBEEM DerivedMesh *result = NULL; diff --git a/source/blender/modifiers/intern/MOD_fluidsim_util.h b/source/blender/modifiers/intern/MOD_fluidsim_util.h index a06c74cb8dd..522cf379435 100644 --- a/source/blender/modifiers/intern/MOD_fluidsim_util.h +++ b/source/blender/modifiers/intern/MOD_fluidsim_util.h @@ -42,6 +42,6 @@ void fluidsim_free(struct FluidsimModifierData *fluidmd); struct DerivedMesh *fluidsimModifier_do(struct FluidsimModifierData *fluidmd, struct Scene *scene, struct Object *ob, struct DerivedMesh *dm, int useRenderParams, int isFinalCalc); - + #endif diff --git a/source/blender/modifiers/intern/MOD_hook.c b/source/blender/modifiers/intern/MOD_hook.c index 79493d2c549..cbd88f32409 100644 --- a/source/blender/modifiers/intern/MOD_hook.c +++ b/source/blender/modifiers/intern/MOD_hook.c @@ -46,6 +46,7 @@ #include "depsgraph_private.h" #include "MEM_guardedalloc.h" +#include "MOD_util.h" static void initData(ModifierData *md) { diff --git a/source/blender/modifiers/intern/MOD_mask.c b/source/blender/modifiers/intern/MOD_mask.c index b2f2c86c46d..19d9c7c9dd8 100644 --- a/source/blender/modifiers/intern/MOD_mask.c +++ b/source/blender/modifiers/intern/MOD_mask.c @@ -47,13 +47,14 @@ #include "depsgraph_private.h" +#include "MOD_util.h" static void copyData(ModifierData *md, ModifierData *target) { MaskModifierData *mmd = (MaskModifierData*) md; MaskModifierData *tmmd = (MaskModifierData*) target; - strcpy(tmmd->vgroup, mmd->vgroup); + BLI_strncpy(tmmd->vgroup, mmd->vgroup, sizeof(tmmd->vgroup)); tmmd->flag = mmd->flag; } diff --git a/source/blender/modifiers/intern/MOD_mirror.c b/source/blender/modifiers/intern/MOD_mirror.c index 9546bf1300b..007d8eb5197 100644 --- a/source/blender/modifiers/intern/MOD_mirror.c +++ b/source/blender/modifiers/intern/MOD_mirror.c @@ -45,6 +45,8 @@ #include "MEM_guardedalloc.h" #include "depsgraph_private.h" +#include "MOD_util.h" + static void initData(ModifierData *md) { MirrorModifierData *mmd = (MirrorModifierData*) md; @@ -142,7 +144,11 @@ static DerivedMesh *doMirrorOnAxis(MirrorModifierData *mmd, if (mmd->mirror_ob) { mul_m4_v3(mtx, co); } - isShared = ABS(co[axis])<=tolerance; + + if(mmd->flag & MOD_MIR_NO_MERGE) + isShared = 0; + else + isShared = ABS(co[axis])<=tolerance; /* Because the topology result (# of vertices) must be the same if * the mesh data is overridden by vertex cos, have to calc sharedness @@ -154,8 +160,8 @@ static DerivedMesh *doMirrorOnAxis(MirrorModifierData *mmd, indexMap[i][0] = numVerts - 1; indexMap[i][1] = !isShared; - - if(isShared) { + // + if(isShared ) { co[axis] = 0; if (mmd->mirror_ob) { mul_m4_v3(imtx, co); diff --git a/source/blender/modifiers/intern/MOD_multires.c b/source/blender/modifiers/intern/MOD_multires.c index 10b135aaa77..3b2c552bb9f 100644 --- a/source/blender/modifiers/intern/MOD_multires.c +++ b/source/blender/modifiers/intern/MOD_multires.c @@ -40,6 +40,8 @@ #include "DNA_mesh_types.h" +#include "MOD_util.h" + static void initData(ModifierData *md) { MultiresModifierData *mmd = (MultiresModifierData*)md; diff --git a/source/blender/modifiers/intern/MOD_particleinstance.c b/source/blender/modifiers/intern/MOD_particleinstance.c index c36581d9317..739d7aa0e6d 100644 --- a/source/blender/modifiers/intern/MOD_particleinstance.c +++ b/source/blender/modifiers/intern/MOD_particleinstance.c @@ -45,6 +45,7 @@ #include "BKE_particle.h" #include "BKE_pointcache.h" +#include "MOD_util.h" #include "depsgraph_private.h" diff --git a/source/blender/modifiers/intern/MOD_screw.c b/source/blender/modifiers/intern/MOD_screw.c index 7e8fad2801e..7bbb07eb658 100644 --- a/source/blender/modifiers/intern/MOD_screw.c +++ b/source/blender/modifiers/intern/MOD_screw.c @@ -433,15 +433,15 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, /* find the first vert */ vc= vert_connect; for (i=0; i < totvert; i++, vc++) { - int v_best=-1, ed_loop_closed=0; /* vert and vert new */ - int ed_loop_flip= 0; /* compiler complains if not initialized, but it should be initialized below */ - float fl= -1.0f; - ScrewVertIter lt_iter; - /* Now do search for connected verts, order all edges and flip them * so resulting faces are flipped the right way */ vc_tot_linked= 0; /* count the number of linked verts for this loop */ if (vc->flag == 0) { + int v_best=-1, ed_loop_closed=0; /* vert and vert new */ + ScrewVertIter lt_iter; + int ed_loop_flip= 0; /* compiler complains if not initialized, but it should be initialized below */ + float fl= -1.0f; + /*printf("Loop on connected vert: %i\n", i);*/ for(j=0; j<2; j++) { diff --git a/source/blender/modifiers/intern/MOD_shapekey.c b/source/blender/modifiers/intern/MOD_shapekey.c index e03783e8eeb..a2fd83b8bcb 100644 --- a/source/blender/modifiers/intern/MOD_shapekey.c +++ b/source/blender/modifiers/intern/MOD_shapekey.c @@ -70,11 +70,12 @@ static void deformMatrices(ModifierData *md, Object *ob, DerivedMesh *derivedDat Key *key= ob_get_key(ob); KeyBlock *kb= ob_get_keyblock(ob); float scale[3][3]; - int a; (void)vertexCos; /* unused */ if(kb && kb->totelem==numVerts && kb!=key->refkey) { + int a; + if(ob->shapeflag & OB_SHAPE_LOCK) scale_m3_fl(scale, 1); else scale_m3_fl(scale, kb->curval); @@ -107,11 +108,11 @@ static void deformMatricesEM(ModifierData *UNUSED(md), Object *ob, Key *key= ob_get_key(ob); KeyBlock *kb= ob_get_keyblock(ob); float scale[3][3]; - int a; (void)vertexCos; /* unused */ if(kb && kb->totelem==numVerts && kb!=key->refkey) { + int a; scale_m3_fl(scale, kb->curval); for(a=0; a<numVerts; a++) @@ -127,20 +128,20 @@ ModifierTypeInfo modifierType_ShapeKey = { /* flags */ eModifierTypeFlag_AcceptsCVs | eModifierTypeFlag_SupportsEditmode, - /* copyData */ 0, + /* copyData */ NULL, /* deformVerts */ deformVerts, /* deformMatrices */ deformMatrices, /* deformVertsEM */ deformVertsEM, /* deformMatricesEM */ deformMatricesEM, - /* applyModifier */ 0, - /* applyModifierEM */ 0, - /* initData */ 0, - /* requiredDataMask */ 0, - /* freeData */ 0, - /* isDisabled */ 0, - /* updateDepgraph */ 0, - /* dependsOnTime */ 0, - /* dependsOnNormals */ 0, - /* foreachObjectLink */ 0, - /* foreachIDLink */ 0, + /* applyModifier */ NULL, + /* applyModifierEM */ NULL, + /* initData */ NULL, + /* requiredDataMask */ NULL, + /* freeData */ NULL, + /* isDisabled */ NULL, + /* updateDepgraph */ NULL, + /* dependsOnTime */ NULL, + /* dependsOnNormals */ NULL, + /* foreachObjectLink */ NULL, + /* foreachIDLink */ NULL }; diff --git a/source/blender/modifiers/intern/MOD_shrinkwrap.c b/source/blender/modifiers/intern/MOD_shrinkwrap.c index 56a5b4b8577..c7f15a94bf2 100644 --- a/source/blender/modifiers/intern/MOD_shrinkwrap.c +++ b/source/blender/modifiers/intern/MOD_shrinkwrap.c @@ -32,9 +32,9 @@ #include <string.h> +#include "BLI_string.h" #include "BLI_utildefines.h" - #include "BKE_cdderivedmesh.h" #include "BKE_modifier.h" #include "BKE_shrinkwrap.h" @@ -65,7 +65,7 @@ static void copyData(ModifierData *md, ModifierData *target) tsmd->target = smd->target; tsmd->auxTarget = smd->auxTarget; - strcpy(tsmd->vgroup_name, smd->vgroup_name); + BLI_strncpy(tsmd->vgroup_name, smd->vgroup_name, sizeof(tsmd->vgroup_name)); tsmd->keepDist = smd->keepDist; tsmd->shrinkType= smd->shrinkType; diff --git a/source/blender/modifiers/intern/MOD_simpledeform.c b/source/blender/modifiers/intern/MOD_simpledeform.c index 1c3e40a4193..9add0e9a67d 100644 --- a/source/blender/modifiers/intern/MOD_simpledeform.c +++ b/source/blender/modifiers/intern/MOD_simpledeform.c @@ -34,6 +34,7 @@ #include "DNA_object_types.h" #include "BLI_math.h" +#include "BLI_string.h" #include "BLI_utildefines.h" #include "BKE_cdderivedmesh.h" @@ -147,7 +148,7 @@ static void simpleDeform_bend(const float factor, const float dcut[3], float *co /* simple deform modifier */ -void SimpleDeformModifier_do(SimpleDeformModifierData *smd, struct Object *ob, struct DerivedMesh *dm, float (*vertexCos)[3], int numVerts) +static void SimpleDeformModifier_do(SimpleDeformModifierData *smd, struct Object *ob, struct DerivedMesh *dm, float (*vertexCos)[3], int numVerts) { static const float lock_axis[2] = {0.0f, 0.0f}; @@ -288,7 +289,7 @@ static void copyData(ModifierData *md, ModifierData *target) tsmd->originOpts= smd->originOpts; tsmd->factor= smd->factor; memcpy(tsmd->limit, smd->limit, sizeof(tsmd->limit)); - strcpy(tsmd->vgroup_name, smd->vgroup_name); + BLI_strncpy(tsmd->vgroup_name, smd->vgroup_name, sizeof(tsmd->vgroup_name)); } static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md) diff --git a/source/blender/modifiers/intern/MOD_surface.c b/source/blender/modifiers/intern/MOD_surface.c index 8d6f6954e18..b5d25d8e146 100644 --- a/source/blender/modifiers/intern/MOD_surface.c +++ b/source/blender/modifiers/intern/MOD_surface.c @@ -91,7 +91,6 @@ static void deformVerts(ModifierData *md, Object *ob, int UNUSED(isFinalCalc)) { SurfaceModifierData *surmd = (SurfaceModifierData*) md; - unsigned int numverts = 0, i = 0; if(surmd->dm) surmd->dm->release(surmd->dm); @@ -108,6 +107,7 @@ static void deformVerts(ModifierData *md, Object *ob, if(surmd->dm) { + unsigned int numverts = 0, i = 0; int init = 0; float *vec; MVert *x, *v; diff --git a/source/blender/modifiers/intern/MOD_util.c b/source/blender/modifiers/intern/MOD_util.c index 036ae276a7b..8ea717469a3 100644 --- a/source/blender/modifiers/intern/MOD_util.c +++ b/source/blender/modifiers/intern/MOD_util.c @@ -148,7 +148,6 @@ DerivedMesh *get_dm(Object *ob, struct EditMesh *em, DerivedMesh *dm, float (*ve /* only called by BKE_modifier.h/modifier.c */ void modifier_type_init(ModifierTypeInfo *types[]) { - memset(types, 0, sizeof(types)); #define INIT_TYPE(typeName) (types[eModifierType_##typeName] = &modifierType_##typeName) INIT_TYPE(None); INIT_TYPE(Curve); diff --git a/source/blender/modifiers/intern/MOD_util.h b/source/blender/modifiers/intern/MOD_util.h index 0ba35ad23e6..a4d63c6d168 100644 --- a/source/blender/modifiers/intern/MOD_util.h +++ b/source/blender/modifiers/intern/MOD_util.h @@ -28,6 +28,9 @@ #ifndef MOD_UTIL_H #define MOD_UTIL_H +/* so modifier types match their defines */ +#include "MOD_modifiertypes.h" + struct Tex; struct TexResult; struct CustomData; diff --git a/source/blender/nodes/CMP_node.h b/source/blender/nodes/CMP_node.h index c2bc4d026ef..4cbb5599797 100644 --- a/source/blender/nodes/CMP_node.h +++ b/source/blender/nodes/CMP_node.h @@ -3,21 +3,21 @@ * * ***** BEGIN GPL LICENSE BLOCK ***** * - * This program is free software; you can redistribute it and/or + * This program is free software(ListBase *lb); 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 + * as published by the Free Software Foundation(ListBase *lb); either version 2 * of the License, or (at your option) any later version. The Blender * Foundation also sells licenses for use in proprietary software under * the Blender License. See http://www.blender.org/BL/ for information * about this. * * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of + * but WITHOUT ANY WARRANTY(ListBase *lb); 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, + * along with this program(ListBase *lb); 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) 2005 Blender Foundation. @@ -38,76 +38,76 @@ /* ****************** types array for all composite nodes ****************** */ -extern bNodeType cmp_node_rlayers; -extern bNodeType cmp_node_image; -extern bNodeType cmp_node_texture; -extern bNodeType cmp_node_value; -extern bNodeType cmp_node_rgb; -extern bNodeType cmp_node_curve_time; +void register_node_type_cmp_rlayers(ListBase *lb); +void register_node_type_cmp_image(ListBase *lb); +void register_node_type_cmp_texture(ListBase *lb); +void register_node_type_cmp_value(ListBase *lb); +void register_node_type_cmp_rgb(ListBase *lb); +void register_node_type_cmp_curve_time(ListBase *lb); -extern bNodeType cmp_node_composite; -extern bNodeType cmp_node_viewer; -extern bNodeType cmp_node_splitviewer; -extern bNodeType cmp_node_output_file; -extern bNodeType cmp_node_view_levels; +void register_node_type_cmp_composite(ListBase *lb); +void register_node_type_cmp_viewer(ListBase *lb); +void register_node_type_cmp_splitviewer(ListBase *lb); +void register_node_type_cmp_output_file(ListBase *lb); +void register_node_type_cmp_view_levels(ListBase *lb); -extern bNodeType cmp_node_curve_rgb; -extern bNodeType cmp_node_mix_rgb; -extern bNodeType cmp_node_hue_sat; -extern bNodeType cmp_node_brightcontrast; -extern bNodeType cmp_node_gamma; -extern bNodeType cmp_node_invert; -extern bNodeType cmp_node_alphaover; -extern bNodeType cmp_node_zcombine; -extern bNodeType cmp_node_colorbalance; -extern bNodeType cmp_node_huecorrect; +void register_node_type_cmp_curve_rgb(ListBase *lb); +void register_node_type_cmp_mix_rgb(ListBase *lb); +void register_node_type_cmp_hue_sat(ListBase *lb); +void register_node_type_cmp_brightcontrast(ListBase *lb); +void register_node_type_cmp_gamma(ListBase *lb); +void register_node_type_cmp_invert(ListBase *lb); +void register_node_type_cmp_alphaover(ListBase *lb); +void register_node_type_cmp_zcombine(ListBase *lb); +void register_node_type_cmp_colorbalance(ListBase *lb); +void register_node_type_cmp_huecorrect(ListBase *lb); -extern bNodeType cmp_node_normal; -extern bNodeType cmp_node_curve_vec; -extern bNodeType cmp_node_map_value; -extern bNodeType cmp_node_normalize; +void register_node_type_cmp_normal(ListBase *lb); +void register_node_type_cmp_curve_vec(ListBase *lb); +void register_node_type_cmp_map_value(ListBase *lb); +void register_node_type_cmp_normalize(ListBase *lb); -extern bNodeType cmp_node_filter; -extern bNodeType cmp_node_blur; -extern bNodeType cmp_node_dblur; -extern bNodeType cmp_node_bilateralblur; -extern bNodeType cmp_node_vecblur; -extern bNodeType cmp_node_dilateerode; -extern bNodeType cmp_node_defocus; +void register_node_type_cmp_filter(ListBase *lb); +void register_node_type_cmp_blur(ListBase *lb); +void register_node_type_cmp_dblur(ListBase *lb); +void register_node_type_cmp_bilateralblur(ListBase *lb); +void register_node_type_cmp_vecblur(ListBase *lb); +void register_node_type_cmp_dilateerode(ListBase *lb); +void register_node_type_cmp_defocus(ListBase *lb); -extern bNodeType cmp_node_valtorgb; -extern bNodeType cmp_node_rgbtobw; -extern bNodeType cmp_node_setalpha; -extern bNodeType cmp_node_idmask; -extern bNodeType cmp_node_math; -extern bNodeType cmp_node_seprgba; -extern bNodeType cmp_node_combrgba; -extern bNodeType cmp_node_sephsva; -extern bNodeType cmp_node_combhsva; -extern bNodeType cmp_node_sepyuva; -extern bNodeType cmp_node_combyuva; -extern bNodeType cmp_node_sepycca; -extern bNodeType cmp_node_combycca; -extern bNodeType cmp_node_premulkey; +void register_node_type_cmp_valtorgb(ListBase *lb); +void register_node_type_cmp_rgbtobw(ListBase *lb); +void register_node_type_cmp_setalpha(ListBase *lb); +void register_node_type_cmp_idmask(ListBase *lb); +void register_node_type_cmp_math(ListBase *lb); +void register_node_type_cmp_seprgba(ListBase *lb); +void register_node_type_cmp_combrgba(ListBase *lb); +void register_node_type_cmp_sephsva(ListBase *lb); +void register_node_type_cmp_combhsva(ListBase *lb); +void register_node_type_cmp_sepyuva(ListBase *lb); +void register_node_type_cmp_combyuva(ListBase *lb); +void register_node_type_cmp_sepycca(ListBase *lb); +void register_node_type_cmp_combycca(ListBase *lb); +void register_node_type_cmp_premulkey(ListBase *lb); -extern bNodeType cmp_node_diff_matte; -extern bNodeType cmp_node_distance_matte; -extern bNodeType cmp_node_chroma_matte; -extern bNodeType cmp_node_color_matte; -extern bNodeType cmp_node_channel_matte; -extern bNodeType cmp_node_color_spill; -extern bNodeType cmp_node_luma_matte; +void register_node_type_cmp_diff_matte(ListBase *lb); +void register_node_type_cmp_distance_matte(ListBase *lb); +void register_node_type_cmp_chroma_matte(ListBase *lb); +void register_node_type_cmp_color_matte(ListBase *lb); +void register_node_type_cmp_channel_matte(ListBase *lb); +void register_node_type_cmp_color_spill(ListBase *lb); +void register_node_type_cmp_luma_matte(ListBase *lb); -extern bNodeType cmp_node_translate; -extern bNodeType cmp_node_rotate; -extern bNodeType cmp_node_scale; -extern bNodeType cmp_node_flip; -extern bNodeType cmp_node_crop; -extern bNodeType cmp_node_displace; -extern bNodeType cmp_node_mapuv; +void register_node_type_cmp_translate(ListBase *lb); +void register_node_type_cmp_rotate(ListBase *lb); +void register_node_type_cmp_scale(ListBase *lb); +void register_node_type_cmp_flip(ListBase *lb); +void register_node_type_cmp_crop(ListBase *lb); +void register_node_type_cmp_displace(ListBase *lb); +void register_node_type_cmp_mapuv(ListBase *lb); -extern bNodeType cmp_node_glare; -extern bNodeType cmp_node_tonemap; -extern bNodeType cmp_node_lensdist; +void register_node_type_cmp_glare(ListBase *lb); +void register_node_type_cmp_tonemap(ListBase *lb); +void register_node_type_cmp_lensdist(ListBase *lb); #endif diff --git a/source/blender/nodes/SHD_node.h b/source/blender/nodes/SHD_node.h index 80cd0c2e73c..20a7aa083ec 100644 --- a/source/blender/nodes/SHD_node.h +++ b/source/blender/nodes/SHD_node.h @@ -39,29 +39,29 @@ /* the type definitions array */ /* ****************** types array for all shaders ****************** */ -extern bNodeType sh_node_output; -extern bNodeType sh_node_material; -extern bNodeType sh_node_camera; -extern bNodeType sh_node_value; -extern bNodeType sh_node_rgb; -extern bNodeType sh_node_mix_rgb; -extern bNodeType sh_node_valtorgb; -extern bNodeType sh_node_rgbtobw; -extern bNodeType sh_node_texture; -extern bNodeType sh_node_normal; -extern bNodeType sh_node_geom; -extern bNodeType sh_node_mapping; -extern bNodeType sh_node_curve_vec; -extern bNodeType sh_node_curve_rgb; -extern bNodeType sh_node_math; -extern bNodeType sh_node_vect_math; -extern bNodeType sh_node_squeeze; -extern bNodeType node_dynamic_typeinfo; -extern bNodeType sh_node_material_ext; -extern bNodeType sh_node_invert; -extern bNodeType sh_node_seprgb; -extern bNodeType sh_node_combrgb; -extern bNodeType sh_node_hue_sat; +void register_node_type_sh_output(ListBase *lb); +void register_node_type_sh_material(ListBase *lb); +void register_node_type_sh_camera(ListBase *lb); +void register_node_type_sh_value(ListBase *lb); +void register_node_type_sh_rgb(ListBase *lb); +void register_node_type_sh_mix_rgb(ListBase *lb); +void register_node_type_sh_valtorgb(ListBase *lb); +void register_node_type_sh_rgbtobw(ListBase *lb); +void register_node_type_sh_texture(ListBase *lb); +void register_node_type_sh_normal(ListBase *lb); +void register_node_type_sh_geom(ListBase *lb); +void register_node_type_sh_mapping(ListBase *lb); +void register_node_type_sh_curve_vec(ListBase *lb); +void register_node_type_sh_curve_rgb(ListBase *lb); +void register_node_type_sh_math(ListBase *lb); +void register_node_type_sh_vect_math(ListBase *lb); +void register_node_type_sh_squeeze(ListBase *lb); +void register_node_type_sh_dynamic(ListBase *lb); +void register_node_type_sh_material_ext(ListBase *lb); +void register_node_type_sh_invert(ListBase *lb); +void register_node_type_sh_seprgb(ListBase *lb); +void register_node_type_sh_combrgb(ListBase *lb); +void register_node_type_sh_hue_sat(ListBase *lb); #endif diff --git a/source/blender/nodes/TEX_node.h b/source/blender/nodes/TEX_node.h index 1bbca09ac8f..b741c654b15 100644 --- a/source/blender/nodes/TEX_node.h +++ b/source/blender/nodes/TEX_node.h @@ -38,41 +38,41 @@ /* ****************** types array for all texture nodes ****************** */ -extern bNodeType tex_node_math; -extern bNodeType tex_node_mix_rgb; -extern bNodeType tex_node_valtorgb; -extern bNodeType tex_node_valtonor; -extern bNodeType tex_node_rgbtobw; -extern bNodeType tex_node_output; -extern bNodeType tex_node_viewer; -extern bNodeType tex_node_checker; -extern bNodeType tex_node_texture; -extern bNodeType tex_node_bricks; -extern bNodeType tex_node_image; -extern bNodeType tex_node_curve_rgb; -extern bNodeType tex_node_curve_time; -extern bNodeType tex_node_invert; -extern bNodeType tex_node_hue_sat; -extern bNodeType tex_node_coord; -extern bNodeType tex_node_distance; +void register_node_type_tex_math(ListBase *lb); +void register_node_type_tex_mix_rgb(ListBase *lb); +void register_node_type_tex_valtorgb(ListBase *lb); +void register_node_type_tex_valtonor(ListBase *lb); +void register_node_type_tex_rgbtobw(ListBase *lb); +void register_node_type_tex_output(ListBase *lb); +void register_node_type_tex_viewer(ListBase *lb); +void register_node_type_tex_checker(ListBase *lb); +void register_node_type_tex_texture(ListBase *lb); +void register_node_type_tex_bricks(ListBase *lb); +void register_node_type_tex_image(ListBase *lb); +void register_node_type_tex_curve_rgb(ListBase *lb); +void register_node_type_tex_curve_time(ListBase *lb); +void register_node_type_tex_invert(ListBase *lb); +void register_node_type_tex_hue_sat(ListBase *lb); +void register_node_type_tex_coord(ListBase *lb); +void register_node_type_tex_distance(ListBase *lb); -extern bNodeType tex_node_rotate; -extern bNodeType tex_node_translate; -extern bNodeType tex_node_scale; -extern bNodeType tex_node_at; +void register_node_type_tex_rotate(ListBase *lb); +void register_node_type_tex_translate(ListBase *lb); +void register_node_type_tex_scale(ListBase *lb); +void register_node_type_tex_at(ListBase *lb); -extern bNodeType tex_node_compose; -extern bNodeType tex_node_decompose; +void register_node_type_tex_compose(ListBase *lb); +void register_node_type_tex_decompose(ListBase *lb); -extern bNodeType tex_node_proc_voronoi; -extern bNodeType tex_node_proc_blend; -extern bNodeType tex_node_proc_magic; -extern bNodeType tex_node_proc_marble; -extern bNodeType tex_node_proc_clouds; -extern bNodeType tex_node_proc_wood; -extern bNodeType tex_node_proc_musgrave; -extern bNodeType tex_node_proc_noise; -extern bNodeType tex_node_proc_stucci; -extern bNodeType tex_node_proc_distnoise; +void register_node_type_tex_proc_voronoi(ListBase *lb); +void register_node_type_tex_proc_blend(ListBase *lb); +void register_node_type_tex_proc_magic(ListBase *lb); +void register_node_type_tex_proc_marble(ListBase *lb); +void register_node_type_tex_proc_clouds(ListBase *lb); +void register_node_type_tex_proc_wood(ListBase *lb); +void register_node_type_tex_proc_musgrave(ListBase *lb); +void register_node_type_tex_proc_noise(ListBase *lb); +void register_node_type_tex_proc_stucci(ListBase *lb); +void register_node_type_tex_proc_distnoise(ListBase *lb); #endif diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_alphaOver.c b/source/blender/nodes/intern/CMP_nodes/CMP_alphaOver.c index 3f6bd989477..e8cfc8533d1 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_alphaOver.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_alphaOver.c @@ -140,22 +140,19 @@ static void node_alphaover_init(bNode* node) node->storage= MEM_callocN(sizeof(NodeTwoFloats), "NodeTwoFloats"); } -bNodeType cmp_node_alphaover= { - /* *next,*prev */ NULL, NULL, - /* type code */ CMP_NODE_ALPHAOVER, - /* name */ "AlphaOver", - /* width+range */ 80, 40, 120, - /* class+opts */ NODE_CLASS_OP_COLOR, NODE_OPTIONS, - /* input sock */ cmp_node_alphaover_in, - /* output sock */ cmp_node_alphaover_out, - /* storage */ "NodeTwoFloats", - /* execfunc */ node_composit_exec_alphaover, - /* butfunc */ NULL, - /* initfunc */ node_alphaover_init, - /* freestoragefunc */ node_free_standard_storage, - /* copystoragefunc */ node_copy_standard_storage, - /* id */ NULL - -}; +void register_node_type_cmp_alphaover(ListBase *lb) +{ + static bNodeType ntype; + + node_type_base(&ntype, CMP_NODE_ALPHAOVER, "AlphaOver", NODE_CLASS_OP_COLOR, NODE_OPTIONS, + cmp_node_alphaover_in, cmp_node_alphaover_out); + node_type_size(&ntype, 80, 40, 120); + node_type_init(&ntype, node_alphaover_init); + node_type_storage(&ntype, "NodeTwoFloats", node_free_standard_storage, node_copy_standard_storage); + node_type_exec(&ntype, node_composit_exec_alphaover); + + nodeRegisterType(lb, &ntype); +} + diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_bilateralblur.c b/source/blender/nodes/intern/CMP_nodes/CMP_bilateralblur.c index 404f0aefb3c..efa044158a2 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_bilateralblur.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_bilateralblur.c @@ -250,20 +250,17 @@ static void node_composit_init_bilateralblur(bNode* node) nbbd->sigma_space= 5.0; } -bNodeType cmp_node_bilateralblur= { - /* *next,*prev */ NULL, NULL, - /* type code */ CMP_NODE_BILATERALBLUR, - /* name */ "Bilateral Blur", - /* width+range */ 150, 120, 200, - /* class+opts */ NODE_CLASS_OP_FILTER, NODE_OPTIONS, - /* input sock */ cmp_node_bilateralblur_in, - /* output sock */ cmp_node_bilateralblur_out, - /* storage */ "NodeBilateralBlurData", - /* execfunc */ node_composit_exec_bilateralblur, - /* butfunc */ NULL, - /* initfunc */ node_composit_init_bilateralblur, - /* freestoragefunc */ node_free_standard_storage, - /* copystoragefunc */ node_copy_standard_storage, - /* id */ NULL - -}; +void register_node_type_cmp_bilateralblur(ListBase *lb) +{ + static bNodeType ntype; + + node_type_base(&ntype, CMP_NODE_BILATERALBLUR, "Bilateral Blur", NODE_CLASS_OP_FILTER, NODE_OPTIONS, + cmp_node_bilateralblur_in, cmp_node_bilateralblur_out); + node_type_size(&ntype, 150, 120, 200); + node_type_init(&ntype, node_composit_init_bilateralblur); + node_type_storage(&ntype, "NodeBilateralBlurData", node_free_standard_storage, node_copy_standard_storage); + node_type_exec(&ntype, node_composit_exec_bilateralblur); + + nodeRegisterType(lb, &ntype); +} + diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_blur.c b/source/blender/nodes/intern/CMP_nodes/CMP_blur.c index f367e7b473d..238ac87d101 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_blur.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_blur.c @@ -578,8 +578,18 @@ static void node_composit_exec_blur(void *data, bNode *node, bNodeStack **in, bN if(out[0]->hasoutput==0) return; if(nbd->relative) { - nbd->sizex= (int)(nbd->percentx*nbd->image_in_width); - nbd->sizey= (int)(nbd->percenty*nbd->image_in_height); + if (nbd->aspect==CMP_NODE_BLUR_ASPECT_NONE) { + nbd->sizex= (int)(nbd->percentx*0.01f*nbd->image_in_width); + nbd->sizey= (int)(nbd->percenty*0.01f*nbd->image_in_height); + } + else if (nbd->aspect==CMP_NODE_BLUR_ASPECT_Y) { + nbd->sizex= (int)(nbd->percentx*0.01f*nbd->image_in_width); + nbd->sizey= (int)(nbd->percenty*0.01f*nbd->image_in_width); + } + else if (nbd->aspect==CMP_NODE_BLUR_ASPECT_X) { + nbd->sizex= (int)(nbd->percentx*0.01f*nbd->image_in_height); + nbd->sizey= (int)(nbd->percenty*0.01f*nbd->image_in_height); + } } if (nbd->sizex==0 && nbd->sizey==0) { @@ -588,9 +598,8 @@ static void node_composit_exec_blur(void *data, bNode *node, bNodeStack **in, bN } else if (nbd->filtertype == R_FILTER_FAST_GAUSS) { CompBuf *new, *img = in[0]->data; - /*from eeshlo's original patch, removed to fit in with the existing blur node */ - /*const float sx = in[1]->vec[0], sy = in[2]->vec[0];*/ - const float sx = ((float)nbd->sizex)/2.0f, sy = ((float)nbd->sizey)/2.0f; + // TODO: can this be mapped with reference, too? + const float sx = ((float)nbd->sizex*in[1]->vec[0])/2.0f, sy = ((float)nbd->sizey*in[1]->vec[0])/2.0f; int c; if ((img==NULL) || (out[0]->hasoutput==0)) return; @@ -704,21 +713,19 @@ static void node_composit_init_blur(bNode* node) node->storage= MEM_callocN(sizeof(NodeBlurData), "node blur data"); } -bNodeType cmp_node_blur= { - /* *next,*prev */ NULL, NULL, - /* type code */ CMP_NODE_BLUR, - /* name */ "Blur", - /* width+range */ 120, 80, 200, - /* class+opts */ NODE_CLASS_OP_FILTER, NODE_PREVIEW|NODE_OPTIONS, - /* input sock */ cmp_node_blur_in, - /* output sock */ cmp_node_blur_out, - /* storage */ "NodeBlurData", - /* execfunc */ node_composit_exec_blur, - /* butfunc */ NULL, - /* initfunc */ node_composit_init_blur, - /* freestoragefunc */ node_free_standard_storage, - /* copystoragefunc */ node_copy_standard_storage, - /* id */ NULL -}; +void register_node_type_cmp_blur(ListBase *lb) +{ + static bNodeType ntype; + + node_type_base(&ntype, CMP_NODE_BLUR, "Blur", NODE_CLASS_OP_FILTER, NODE_PREVIEW|NODE_OPTIONS, + cmp_node_blur_in, cmp_node_blur_out); + node_type_size(&ntype, 120, 80, 200); + node_type_init(&ntype, node_composit_init_blur); + node_type_storage(&ntype, "NodeBlurData", node_free_standard_storage, node_copy_standard_storage); + node_type_exec(&ntype, node_composit_exec_blur); + + nodeRegisterType(lb, &ntype); +} + diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_brightness.c b/source/blender/nodes/intern/CMP_nodes/CMP_brightness.c index 6b0d6ff45a0..f2f7636e96b 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_brightness.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_brightness.c @@ -91,20 +91,15 @@ static void node_composit_exec_brightcontrast(void *UNUSED(data), bNode *node, b } } -bNodeType cmp_node_brightcontrast= { - /* *next,*prev */ NULL, NULL, - /* type code */ CMP_NODE_BRIGHTCONTRAST, - /* name */ "Bright/Contrast", - /* width+range */ 140, 100, 320, - /* class+opts */ NODE_CLASS_OP_COLOR, NODE_OPTIONS, - /* input sock */ cmp_node_brightcontrast_in, - /* output sock */ cmp_node_brightcontrast_out, - /* storage */ "", - /* execfunc */ node_composit_exec_brightcontrast, - /* butfunc */ NULL, - /* initfunc */ NULL, - /* freestoragefunc */ NULL, - /* copysotragefunc */ NULL, - /* id */ NULL -}; +void register_node_type_cmp_brightcontrast(ListBase *lb) +{ + static bNodeType ntype; + + node_type_base(&ntype, CMP_NODE_BRIGHTCONTRAST, "Bright/Contrast", NODE_CLASS_OP_COLOR, NODE_OPTIONS, + cmp_node_brightcontrast_in, cmp_node_brightcontrast_out); + node_type_size(&ntype, 140, 100, 320); + node_type_exec(&ntype, node_composit_exec_brightcontrast); + + nodeRegisterType(lb, &ntype); +} diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_channelMatte.c b/source/blender/nodes/intern/CMP_nodes/CMP_channelMatte.c index 182c339132e..044ed6d069b 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_channelMatte.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_channelMatte.c @@ -197,19 +197,17 @@ static void node_composit_init_channel_matte(bNode *node) node->custom2= 2; /* Green Channel */ } -bNodeType cmp_node_channel_matte={ - /* *next,*prev */ NULL, NULL, - /* type code */ CMP_NODE_CHANNEL_MATTE, - /* name */ "Channel Key", - /* width+range */ 200, 80, 250, - /* class+opts */ NODE_CLASS_MATTE, NODE_PREVIEW|NODE_OPTIONS, - /* input sock */ cmp_node_channel_matte_in, - /* output sock */ cmp_node_channel_matte_out, - /* storage */ "NodeChroma", - /* execfunc */ node_composit_exec_channel_matte, - /* butfunc */ NULL, - /* initfunc */ node_composit_init_channel_matte, - /* freestoragefunc */ node_free_standard_storage, - /* copystoragefunc */ node_copy_standard_storage, - /* id */ NULL -}; +void register_node_type_cmp_channel_matte(ListBase *lb) +{ + static bNodeType ntype; + + node_type_base(&ntype, CMP_NODE_CHANNEL_MATTE, "Channel Key", NODE_CLASS_MATTE, NODE_PREVIEW|NODE_OPTIONS, + cmp_node_channel_matte_in, cmp_node_channel_matte_out); + node_type_size(&ntype, 200, 80, 250); + node_type_init(&ntype, node_composit_init_channel_matte); + node_type_storage(&ntype, "NodeChroma", node_free_standard_storage, node_copy_standard_storage); + node_type_exec(&ntype, node_composit_exec_channel_matte); + + nodeRegisterType(lb, &ntype); +} + diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_chromaMatte.c b/source/blender/nodes/intern/CMP_nodes/CMP_chromaMatte.c index d102afbbd16..eba2d55187e 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_chromaMatte.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_chromaMatte.c @@ -184,21 +184,19 @@ static void node_composit_init_chroma_matte(bNode *node) c->fstrength= 1.0f; }; -bNodeType cmp_node_chroma_matte={ - /* *next,*prev */ NULL, NULL, - /* type code */ CMP_NODE_CHROMA_MATTE, - /* name */ "Chroma Key", - /* width+range */ 200, 80, 300, - /* class+opts */ NODE_CLASS_MATTE, NODE_PREVIEW|NODE_OPTIONS, - /* input sock */ cmp_node_chroma_in, - /* output sock */ cmp_node_chroma_out, - /* storage */ "NodeChroma", - /* execfunc */ node_composit_exec_chroma_matte, - /* butfunc */ NULL, - /* initfunc */ node_composit_init_chroma_matte, - /* freestoragefunc */ node_free_standard_storage, - /* copystoragefunc */ node_copy_standard_storage, - /* id */ NULL -}; +void register_node_type_cmp_chroma_matte(ListBase *lb) +{ + static bNodeType ntype; + + node_type_base(&ntype, CMP_NODE_CHROMA_MATTE, "Chroma Key", NODE_CLASS_MATTE, NODE_PREVIEW|NODE_OPTIONS, + cmp_node_chroma_in, cmp_node_chroma_out); + node_type_size(&ntype, 200, 80, 300); + node_type_init(&ntype, node_composit_init_chroma_matte); + node_type_storage(&ntype, "NodeChroma", node_free_standard_storage, node_copy_standard_storage); + node_type_exec(&ntype, node_composit_exec_chroma_matte); + + nodeRegisterType(lb, &ntype); +} + diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_colorMatte.c b/source/blender/nodes/intern/CMP_nodes/CMP_colorMatte.c index 8d5f4688657..57063465ac2 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_colorMatte.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_colorMatte.c @@ -112,21 +112,19 @@ static void node_composit_init_color_matte(bNode *node) c->fstrength= 1.0f; }; -bNodeType cmp_node_color_matte={ - /* *next,*prev */ NULL, NULL, - /* type code */ CMP_NODE_COLOR_MATTE, - /* name */ "Color Key", - /* width+range */ 200, 80, 300, - /* class+opts */ NODE_CLASS_MATTE, NODE_PREVIEW|NODE_OPTIONS, - /* input sock */ cmp_node_color_in, - /* output sock */ cmp_node_color_out, - /* storage */ "NodeChroma", - /* execfunc */ node_composit_exec_color_matte, - /* butfunc */ NULL, - /* initfunc */ node_composit_init_color_matte, - /* freestoragefunc */ node_free_standard_storage, - /* copystoragefunc */ node_copy_standard_storage, - /* id */ NULL -}; +void register_node_type_cmp_color_matte(ListBase *lb) +{ + static bNodeType ntype; + + node_type_base(&ntype, CMP_NODE_COLOR_MATTE, "Color Key", NODE_CLASS_MATTE, NODE_PREVIEW|NODE_OPTIONS, + cmp_node_color_in, cmp_node_color_out); + node_type_size(&ntype, 200, 80, 300); + node_type_init(&ntype, node_composit_init_color_matte); + node_type_storage(&ntype, "NodeChroma", node_free_standard_storage, node_copy_standard_storage); + node_type_exec(&ntype, node_composit_exec_color_matte); + + nodeRegisterType(lb, &ntype); +} + diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_colorSpill.c b/source/blender/nodes/intern/CMP_nodes/CMP_colorSpill.c index 408bda02ee4..e4b9ead504b 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_colorSpill.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_colorSpill.c @@ -322,19 +322,16 @@ static void node_composit_init_color_spill(bNode *node) ncs->unspill=0; /* do not use unspill */ } -bNodeType cmp_node_color_spill={ - /* *next,*prev */ NULL, NULL, - /* type code */ CMP_NODE_COLOR_SPILL, - /* name */ "Color Spill", - /* width+range */ 140, 80, 200, - /* class+opts */ NODE_CLASS_MATTE, NODE_OPTIONS, - /* input sock */ cmp_node_color_spill_in, - /* output sock */ cmp_node_color_spill_out, - /* storage */ "NodeColorspill", - /* execfunc */ node_composit_exec_color_spill, - /* butfunc */ NULL, - /* initfunc */ node_composit_init_color_spill, - /* freestoragefunc */ node_free_standard_storage, - /* copystoragefunc */ node_copy_standard_storage, -}; - +void register_node_type_cmp_color_spill(ListBase *lb) +{ + static bNodeType ntype; + + node_type_base(&ntype, CMP_NODE_COLOR_SPILL, "Color Spill", NODE_CLASS_MATTE, NODE_OPTIONS, + cmp_node_color_spill_in, cmp_node_color_spill_out); + node_type_size(&ntype, 140, 80, 200); + node_type_init(&ntype, node_composit_init_color_spill); + node_type_storage(&ntype, "NodeColorspill", node_free_standard_storage, node_copy_standard_storage); + node_type_exec(&ntype, node_composit_exec_color_spill); + + nodeRegisterType(lb, &ntype); +} diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_colorbalance.c b/source/blender/nodes/intern/CMP_nodes/CMP_colorbalance.c index c8e0108a5c8..2596037065f 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_colorbalance.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_colorbalance.c @@ -179,20 +179,18 @@ static void node_composit_init_colorbalance(bNode *node) n->gain[0] = n->gain[1] = n->gain[2] = 1.0f; } -bNodeType cmp_node_colorbalance={ - /* *next,*prev */ NULL, NULL, - /* type code */ CMP_NODE_COLORBALANCE, - /* name */ "Color Balance", - /* width+range */ 400, 200, 400, - /* class+opts */ NODE_CLASS_OP_COLOR, NODE_OPTIONS, - /* input sock */ cmp_node_colorbalance_in, - /* output sock */ cmp_node_colorbalance_out, - /* storage */ "NodeColorBalance", - /* execfunc */ node_composit_exec_colorbalance, - /* butfunc */ NULL, - /* initfunc */ node_composit_init_colorbalance, - /* freestoragefunc */ node_free_standard_storage, - /* copystoragefunc */ node_copy_standard_storage, - /* id */ NULL -}; +void register_node_type_cmp_colorbalance(ListBase *lb) +{ + static bNodeType ntype; + + node_type_base(&ntype, CMP_NODE_COLORBALANCE, "Color Balance", NODE_CLASS_OP_COLOR, NODE_OPTIONS, + cmp_node_colorbalance_in, cmp_node_colorbalance_out); + node_type_size(&ntype, 400, 200, 400); + node_type_init(&ntype, node_composit_init_colorbalance); + node_type_storage(&ntype, "NodeColorBalance", node_free_standard_storage, node_copy_standard_storage); + node_type_exec(&ntype, node_composit_exec_colorbalance); + + nodeRegisterType(lb, &ntype); +} + diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_composite.c b/source/blender/nodes/intern/CMP_nodes/CMP_composite.c index ffb090f3a94..1bbcb0f7527 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_composite.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_composite.c @@ -94,19 +94,15 @@ static void node_composit_exec_composite(void *data, bNode *node, bNodeStack **i generate_preview(data, node, in[0]->data); } -bNodeType cmp_node_composite= { - /* *next,*prev */ NULL, NULL, - /* type code */ CMP_NODE_COMPOSITE, - /* name */ "Composite", - /* width+range */ 80, 60, 200, - /* class+opts */ NODE_CLASS_OUTPUT, NODE_PREVIEW, - /* input sock */ cmp_node_composite_in, - /* output sock */ NULL, - /* storage */ "", - /* execfunc */ node_composit_exec_composite, - /* butfunc */ NULL, - /* initfunc */ NULL, - /* freestoragefunc */ NULL, - /* copystoragefunc */ NULL, - /* id */ NULL -}; +void register_node_type_cmp_composite(ListBase *lb) +{ + static bNodeType ntype; + + node_type_base(&ntype, CMP_NODE_COMPOSITE, "Composite", NODE_CLASS_OUTPUT, NODE_PREVIEW, + cmp_node_composite_in, NULL); + node_type_size(&ntype, 80, 60, 200); + node_type_exec(&ntype, node_composit_exec_composite); + + nodeRegisterType(lb, &ntype); +} + diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_crop.c b/source/blender/nodes/intern/CMP_nodes/CMP_crop.c index 7ecfe40f739..b8d24fc1b14 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_crop.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_crop.c @@ -108,19 +108,17 @@ static void node_composit_init_crop(bNode* node) nxy->y2= 0; } -bNodeType cmp_node_crop= { - /* *next,*prev */ NULL, NULL, - /* type code */ CMP_NODE_CROP, - /* name */ "Crop", - /* width+range */ 140, 100, 320, - /* class+opts */ NODE_CLASS_DISTORT, NODE_OPTIONS, - /* input sock */ cmp_node_crop_in, - /* output sock */ cmp_node_crop_out, - /* storage */ "NodeTwoXYs", - /* execfunc */ node_composit_exec_crop, - /* butfunc */ NULL, - /* initfunc */ node_composit_init_crop, - /* freestoragefunc */ node_free_standard_storage, - /* copystoragefunc */ node_copy_standard_storage, - /* id */ NULL -}; +void register_node_type_cmp_crop(ListBase *lb) +{ + static bNodeType ntype; + + node_type_base(&ntype, CMP_NODE_CROP, "Crop", NODE_CLASS_DISTORT, NODE_OPTIONS, + cmp_node_crop_in, cmp_node_crop_out); + node_type_size(&ntype, 140, 100, 320); + node_type_init(&ntype, node_composit_init_crop); + node_type_storage(&ntype, "NodeTwoXYs", node_free_standard_storage, node_copy_standard_storage); + node_type_exec(&ntype, node_composit_exec_crop); + + nodeRegisterType(lb, &ntype); +} + diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_curves.c b/source/blender/nodes/intern/CMP_nodes/CMP_curves.c index 1a88e9541c6..2252bc2d181 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_curves.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_curves.c @@ -59,22 +59,20 @@ static void node_composit_init_curves_time(bNode* node) node->storage= curvemapping_add(1, 0.0f, 0.0f, 1.0f, 1.0f); } -bNodeType cmp_node_curve_time= { - /* *next,*prev */ NULL, NULL, - /* type code */ CMP_NODE_TIME, - /* name */ "Time", - /* width+range */ 140, 100, 320, - /* class+opts */ NODE_CLASS_INPUT, NODE_OPTIONS, - /* input sock */ NULL, - /* output sock */ cmp_node_time_out, - /* storage */ "CurveMapping", - /* execfunc */ node_composit_exec_curves_time, - /* butfunc */ NULL, - /* initfunc */ node_composit_init_curves_time, - /* freestoragefunc */ node_free_curves, - /* copystoragefunc */ node_copy_curves, - /* id */ NULL -}; +void register_node_type_cmp_curve_time(ListBase *lb) +{ + static bNodeType ntype; + + node_type_base(&ntype, CMP_NODE_TIME, "Time", NODE_CLASS_INPUT, NODE_OPTIONS, + NULL, cmp_node_time_out); + node_type_size(&ntype, 140, 100, 320); + node_type_init(&ntype, node_composit_init_curves_time); + node_type_storage(&ntype, "CurveMapping", node_free_curves, node_copy_curves); + node_type_exec(&ntype, node_composit_exec_curves_time); + + nodeRegisterType(lb, &ntype); +} + @@ -102,23 +100,20 @@ static void node_composit_init_curve_vec(bNode* node) node->storage= curvemapping_add(3, -1.0f, -1.0f, 1.0f, 1.0f); }; -bNodeType cmp_node_curve_vec= { - /* *next,*prev */ NULL, NULL, - /* type code */ CMP_NODE_CURVE_VEC, - /* name */ "Vector Curves", - /* width+range */ 200, 140, 320, - /* class+opts */ NODE_CLASS_OP_VECTOR, NODE_OPTIONS, - /* input sock */ cmp_node_curve_vec_in, - /* output sock */ cmp_node_curve_vec_out, - /* storage */ "CurveMapping", - /* execfunc */ node_composit_exec_curve_vec, - /* butfunc */ NULL, - /* initfunc */ node_composit_init_curve_vec, - /* freestoragefunc */ node_free_curves, - /* copystoragefunc */ node_copy_curves, - /* id */ NULL - -}; +void register_node_type_cmp_curve_vec(ListBase *lb) +{ + static bNodeType ntype; + + node_type_base(&ntype, CMP_NODE_CURVE_VEC, "Vector Curves", NODE_CLASS_OP_VECTOR, NODE_OPTIONS, + cmp_node_curve_vec_in, cmp_node_curve_vec_out); + node_type_size(&ntype, 200, 140, 320); + node_type_init(&ntype, node_composit_init_curve_vec); + node_type_storage(&ntype, "CurveMapping", node_free_curves, node_copy_curves); + node_type_exec(&ntype, node_composit_exec_curve_vec); + + nodeRegisterType(lb, &ntype); +} + /* **************** CURVE RGB ******************** */ static bNodeSocketType cmp_node_curve_rgb_in[]= { @@ -192,20 +187,18 @@ static void node_composit_init_curve_rgb(bNode* node) node->storage= curvemapping_add(4, 0.0f, 0.0f, 1.0f, 1.0f); }; -bNodeType cmp_node_curve_rgb= { - /* *next,*prev */ NULL, NULL, - /* type code */ CMP_NODE_CURVE_RGB, - /* name */ "RGB Curves", - /* width+range */ 200, 140, 320, - /* class+opts */ NODE_CLASS_OP_COLOR, NODE_OPTIONS, - /* input sock */ cmp_node_curve_rgb_in, - /* output sock */ cmp_node_curve_rgb_out, - /* storage */ "CurveMapping", - /* execfunc */ node_composit_exec_curve_rgb, - /* butfunc */ NULL, - /* initfunc */ node_composit_init_curve_rgb, - /* freestoragefunc */ node_free_curves, - /* copystoragefunc */ node_copy_curves, - /* id */ NULL -}; +void register_node_type_cmp_curve_rgb(ListBase *lb) +{ + static bNodeType ntype; + + node_type_base(&ntype, CMP_NODE_CURVE_RGB, "RGB Curves", NODE_CLASS_OP_COLOR, NODE_OPTIONS, + cmp_node_curve_rgb_in, cmp_node_curve_rgb_out); + node_type_size(&ntype, 200, 140, 320); + node_type_init(&ntype, node_composit_init_curve_rgb); + node_type_storage(&ntype, "CurveMapping", node_free_curves, node_copy_curves); + node_type_exec(&ntype, node_composit_exec_curve_rgb); + + nodeRegisterType(lb, &ntype); +} + diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_defocus.c b/source/blender/nodes/intern/CMP_nodes/CMP_defocus.c index d3fd7c8bcad..7f5d5df9d6f 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_defocus.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_defocus.c @@ -869,21 +869,19 @@ static void node_composit_init_defocus(bNode* node) node->storage = nbd; } -bNodeType cmp_node_defocus = { - /* *next,*prev */ NULL, NULL, - /* type code */ CMP_NODE_DEFOCUS, - /* name */ "Defocus", - /* width+range */ 150, 120, 200, - /* class+opts */ NODE_CLASS_OP_FILTER, NODE_OPTIONS, - /* input sock */ cmp_node_defocus_in, - /* output sock */ cmp_node_defocus_out, - /* storage */ "NodeDefocus", - /* execfunc */ node_composit_exec_defocus, - /* butfunc */ NULL, - /* initfunc */ node_composit_init_defocus, - /* freestoragefunc */ node_free_standard_storage, - /* copystoragefunc */ node_copy_standard_storage, - /* id */ NULL -}; +void register_node_type_cmp_defocus(ListBase *lb) +{ + static bNodeType ntype; + + node_type_base(&ntype, CMP_NODE_DEFOCUS, "Defocus", NODE_CLASS_OP_FILTER, NODE_OPTIONS, + cmp_node_defocus_in, cmp_node_defocus_out); + node_type_size(&ntype, 150, 120, 200); + node_type_init(&ntype, node_composit_init_defocus); + node_type_storage(&ntype, "NodeDefocus", node_free_standard_storage, node_copy_standard_storage); + node_type_exec(&ntype, node_composit_exec_defocus); + + nodeRegisterType(lb, &ntype); +} + diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_diffMatte.c b/source/blender/nodes/intern/CMP_nodes/CMP_diffMatte.c index 0735a369d12..73046d70011 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_diffMatte.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_diffMatte.c @@ -128,21 +128,19 @@ static void node_composit_init_diff_matte(bNode *node) c->t2= 0.1f; } -bNodeType cmp_node_diff_matte={ - /* *next,*prev */ NULL, NULL, - /* type code */ CMP_NODE_DIFF_MATTE, - /* name */ "Difference Key", - /* width+range */ 200, 80, 250, - /* class+opts */ NODE_CLASS_MATTE, NODE_PREVIEW|NODE_OPTIONS, - /* input sock */ cmp_node_diff_matte_in, - /* output sock */ cmp_node_diff_matte_out, - /* storage */ "NodeChroma", - /* execfunc */ node_composit_exec_diff_matte, - /* butfunc */ NULL, - /* initfunc */ node_composit_init_diff_matte, - /* freestoragefunc */ node_free_standard_storage, - /* copystoragefunc */ node_copy_standard_storage, - /* id */ NULL -}; +void register_node_type_cmp_diff_matte(ListBase *lb) +{ + static bNodeType ntype; + + node_type_base(&ntype, CMP_NODE_DIFF_MATTE, "Difference Key", NODE_CLASS_MATTE, NODE_PREVIEW|NODE_OPTIONS, + cmp_node_diff_matte_in, cmp_node_diff_matte_out); + node_type_size(&ntype, 200, 80, 250); + node_type_init(&ntype, node_composit_init_diff_matte); + node_type_storage(&ntype, "NodeChroma", node_free_standard_storage, node_copy_standard_storage); + node_type_exec(&ntype, node_composit_exec_diff_matte); + + nodeRegisterType(lb, &ntype); +} + diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_dilate.c b/source/blender/nodes/intern/CMP_nodes/CMP_dilate.c index 71990b7403a..3ceaecfed43 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_dilate.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_dilate.c @@ -143,21 +143,16 @@ static void node_composit_exec_dilateerode(void *UNUSED(data), bNode *node, bNod } } -bNodeType cmp_node_dilateerode= { - /* *next,*prev */ NULL, NULL, - /* type code */ CMP_NODE_DILATEERODE, - /* name */ "Dilate/Erode", - /* width+range */ 130, 100, 320, - /* class+opts */ NODE_CLASS_OP_FILTER, NODE_OPTIONS, - /* input sock */ cmp_node_dilateerode_in, - /* output sock */ cmp_node_dilateerode_out, - /* storage */ "", - /* execfunc */ node_composit_exec_dilateerode, - /* butfunc */ NULL, - /* initfunc */ NULL, - /* freestoragefunc */ NULL, - /* copystoragefunc */ NULL, - /* id */ NULL -}; +void register_node_type_cmp_dilateerode(ListBase *lb) +{ + static bNodeType ntype; + + node_type_base(&ntype, CMP_NODE_DILATEERODE, "Dilate/Erode", NODE_CLASS_OP_FILTER, NODE_OPTIONS, + cmp_node_dilateerode_in, cmp_node_dilateerode_out); + node_type_size(&ntype, 130, 100, 320); + node_type_exec(&ntype, node_composit_exec_dilateerode); + + nodeRegisterType(lb, &ntype); +} diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_directionalblur.c b/source/blender/nodes/intern/CMP_nodes/CMP_directionalblur.c index 42bf48b9128..533a8b1324b 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_directionalblur.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_directionalblur.c @@ -125,19 +125,17 @@ static void node_composit_init_dblur(bNode* node) ndbd->center_y= 0.5; } -bNodeType cmp_node_dblur = { - /* *next,*prev */ NULL, NULL, - /* type code */ CMP_NODE_DBLUR, - /* name */ "Directional Blur", - /* width+range */ 150, 120, 200, - /* class+opts */ NODE_CLASS_OP_FILTER, NODE_OPTIONS, - /* input sock */ cmp_node_dblur_in, - /* output sock */ cmp_node_dblur_out, - /* storage */ "NodeDBlurData", - /* execfunc */ node_composit_exec_dblur, - /* butfunc */ NULL, - /* initfunc */ node_composit_init_dblur, - /* freestoragefunc */ node_free_standard_storage, - /* copystoragefunc */ node_copy_standard_storage, - /* id */ NULL -}; +void register_node_type_cmp_dblur(ListBase *lb) +{ + static bNodeType ntype; + + node_type_base(&ntype, CMP_NODE_DBLUR, "Directional Blur", NODE_CLASS_OP_FILTER, NODE_OPTIONS, + cmp_node_dblur_in, cmp_node_dblur_out); + node_type_size(&ntype, 150, 120, 200); + node_type_init(&ntype, node_composit_init_dblur); + node_type_storage(&ntype, "NodeDBlurData", node_free_standard_storage, node_copy_standard_storage); + node_type_exec(&ntype, node_composit_exec_dblur); + + nodeRegisterType(lb, &ntype); +} + diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_displace.c b/source/blender/nodes/intern/CMP_nodes/CMP_displace.c index 1ce545e2ca8..7871efc30b7 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_displace.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_displace.c @@ -171,20 +171,16 @@ static void node_composit_exec_displace(void *UNUSED(data), bNode *UNUSED(node), } } -bNodeType cmp_node_displace= { - /* *next,*prev */ NULL, NULL, - /* type code */ CMP_NODE_DISPLACE, - /* name */ "Displace", - /* width+range */ 140, 100, 320, - /* class+opts */ NODE_CLASS_DISTORT, NODE_OPTIONS, - /* input sock */ cmp_node_displace_in, - /* output sock */ cmp_node_displace_out, - /* storage */ "", - /* execfunc */ node_composit_exec_displace, - /* butfunc */ NULL, - /* initfunc */ NULL, - /* freestoragefunc */ NULL, - /* copystoragefunc */ NULL, - /* id */ NULL -}; +void register_node_type_cmp_displace(ListBase *lb) +{ + static bNodeType ntype; + + node_type_base(&ntype, CMP_NODE_DISPLACE, "Displace", NODE_CLASS_DISTORT, NODE_OPTIONS, + cmp_node_displace_in, cmp_node_displace_out); + node_type_size(&ntype, 140, 100, 320); + node_type_exec(&ntype, node_composit_exec_displace); + + nodeRegisterType(lb, &ntype); +} + diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_distanceMatte.c b/source/blender/nodes/intern/CMP_nodes/CMP_distanceMatte.c index e0e595fc8f6..406f9e829c1 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_distanceMatte.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_distanceMatte.c @@ -125,21 +125,19 @@ static void node_composit_init_distance_matte(bNode *node) c->t2= 0.1f; } -bNodeType cmp_node_distance_matte={ - /* *next,*prev */ NULL, NULL, - /* type code */ CMP_NODE_DIST_MATTE, - /* name */ "Distance Key", - /* width+range */ 200, 80, 250, - /* class+opts */ NODE_CLASS_MATTE, NODE_PREVIEW|NODE_OPTIONS, - /* input sock */ cmp_node_distance_matte_in, - /* output sock */ cmp_node_distance_matte_out, - /* storage */ "NodeChroma", - /* execfunc */ node_composit_exec_distance_matte, - /* butfunc */ NULL, - /* initfunc */ node_composit_init_distance_matte, - /* freestoragefunc */ node_free_standard_storage, - /* copystoragefunc */ node_copy_standard_storage, - /* id */ NULL -}; +void register_node_type_cmp_distance_matte(ListBase *lb) +{ + static bNodeType ntype; + + node_type_base(&ntype, CMP_NODE_DIST_MATTE, "Distance Key", NODE_CLASS_MATTE, NODE_PREVIEW|NODE_OPTIONS, + cmp_node_distance_matte_in, cmp_node_distance_matte_out); + node_type_size(&ntype, 200, 80, 250); + node_type_init(&ntype, node_composit_init_distance_matte); + node_type_storage(&ntype, "NodeChroma", node_free_standard_storage, node_copy_standard_storage); + node_type_exec(&ntype, node_composit_exec_distance_matte); + + nodeRegisterType(lb, &ntype); +} + diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_filter.c b/source/blender/nodes/intern/CMP_nodes/CMP_filter.c index 8f9a988c4c2..52b0fb008aa 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_filter.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_filter.c @@ -217,22 +217,18 @@ static void node_composit_exec_filter(void *data, bNode *node, bNodeStack **in, } -bNodeType cmp_node_filter= { - /* *next,*prev */ NULL, NULL, - /* type code */ CMP_NODE_FILTER, - /* name */ "Filter", - /* width+range */ 80, 40, 120, - /* class+opts */ NODE_CLASS_OP_FILTER, NODE_PREVIEW|NODE_OPTIONS, - /* input sock */ cmp_node_filter_in, - /* output sock */ cmp_node_filter_out, - /* storage */ "", - /* execfunc */ node_composit_exec_filter, - /* butfunc */ NULL, - /* initfunc */ NULL, - /* freestoragefunc */ NULL, - /* copystoragefunc */ NULL, - /* id */ NULL - -}; +void register_node_type_cmp_filter(ListBase *lb) +{ + static bNodeType ntype; + + node_type_base(&ntype, CMP_NODE_FILTER, "Filter", NODE_CLASS_OP_FILTER, NODE_PREVIEW|NODE_OPTIONS, + cmp_node_filter_in, cmp_node_filter_out); + node_type_size(&ntype, 80, 40, 120); + node_type_label(&ntype, node_filter_label); + node_type_exec(&ntype, node_composit_exec_filter); + + nodeRegisterType(lb, &ntype); +} + diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_flip.c b/source/blender/nodes/intern/CMP_nodes/CMP_flip.c index 33a17f890d8..b0058765136 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_flip.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_flip.c @@ -85,21 +85,17 @@ static void node_composit_exec_flip(void *UNUSED(data), bNode *node, bNodeStack } } -bNodeType cmp_node_flip= { - /* *next,*prev */ NULL, NULL, - /* type code */ CMP_NODE_FLIP, - /* name */ "Flip", - /* width+range */ 140, 100, 320, - /* class+opts */ NODE_CLASS_DISTORT, NODE_OPTIONS, - /* input sock */ cmp_node_flip_in, - /* output sock */ cmp_node_flip_out, - /* storage */ "", - /* execfunc */ node_composit_exec_flip, - /* butfunc */ NULL, - /* initfunc */ NULL, - /* freestoragefunc */ NULL, - /* copystoragefunc */ NULL, - /* id */ NULL -}; +void register_node_type_cmp_flip(ListBase *lb) +{ + static bNodeType ntype; + + node_type_base(&ntype, CMP_NODE_FLIP, "Flip", NODE_CLASS_DISTORT, NODE_OPTIONS, + cmp_node_flip_in, cmp_node_flip_out); + node_type_size(&ntype, 140, 100, 320); + node_type_exec(&ntype, node_composit_exec_flip); + + nodeRegisterType(lb, &ntype); +} + diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_gamma.c b/source/blender/nodes/intern/CMP_nodes/CMP_gamma.c index 2e3162b0c30..98af5bff2ec 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_gamma.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_gamma.c @@ -72,21 +72,14 @@ static void node_composit_exec_gamma(void *UNUSED(data), bNode *node, bNodeStack } } -bNodeType cmp_node_gamma= { - /* *next,*prev */ NULL, NULL, - /* type code */ CMP_NODE_GAMMA, - /* name */ "Gamma", - /* width+range */ 140, 100, 320, - /* class+opts */ NODE_CLASS_OP_COLOR, NODE_OPTIONS, - /* input sock */ cmp_node_gamma_in, - /* output sock */ cmp_node_gamma_out, - /* storage */ "", - /* execfunc */ node_composit_exec_gamma, - /* butfunc */ NULL, - /* initfunc */ NULL, - /* freestoragefunc */ NULL, - /* copysotragefunc */ NULL, - /* id */ NULL -}; - - +void register_node_type_cmp_gamma(ListBase *lb) +{ + static bNodeType ntype; + + node_type_base(&ntype, CMP_NODE_GAMMA, "Gamma", NODE_CLASS_OP_COLOR, NODE_OPTIONS, + cmp_node_gamma_in, cmp_node_gamma_out); + node_type_size(&ntype, 140, 100, 320); + node_type_exec(&ntype, node_composit_exec_gamma); + + nodeRegisterType(lb, &ntype); +} diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_glare.c b/source/blender/nodes/intern/CMP_nodes/CMP_glare.c index d4968caee0f..1d7471680d0 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_glare.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_glare.c @@ -484,19 +484,17 @@ static void node_composit_init_glare(bNode* node) node->storage = ndg; } -bNodeType cmp_node_glare = { - /* *next,*prev */ NULL, NULL, - /* type code */ CMP_NODE_GLARE, - /* name */ "Glare", - /* width+range */ 150, 120, 200, - /* class+opts */ NODE_CLASS_OP_FILTER, NODE_OPTIONS, - /* input sock */ cmp_node_glare_in, - /* output sock */ cmp_node_glare_out, - /* storage */ "NodeGlare", - /* execfunc */ node_composit_exec_glare, - /* butfunc */ NULL, - /* initfunc */ node_composit_init_glare, - /* freestoragefunc */ node_free_standard_storage, - /* copystoragefunc */ node_copy_standard_storage, - /* id */ NULL -}; +void register_node_type_cmp_glare(ListBase *lb) +{ + static bNodeType ntype; + + node_type_base(&ntype, CMP_NODE_GLARE, "Glare", NODE_CLASS_OP_FILTER, NODE_OPTIONS, + cmp_node_glare_in, cmp_node_glare_out); + node_type_size(&ntype, 150, 120, 200); + node_type_init(&ntype, node_composit_init_glare); + node_type_storage(&ntype, "NodeGlare", node_free_standard_storage, node_copy_standard_storage); + node_type_exec(&ntype, node_composit_exec_glare); + + nodeRegisterType(lb, &ntype); +} + diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_hueSatVal.c b/source/blender/nodes/intern/CMP_nodes/CMP_hueSatVal.c index e8ce3e20f11..412ed5e6fa5 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_hueSatVal.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_hueSatVal.c @@ -99,22 +99,19 @@ static void node_composit_init_hue_sat(bNode* node) nhs->val= 1.0f; } -bNodeType cmp_node_hue_sat= { - /* *next,*prev */ NULL, NULL, - /* type code */ CMP_NODE_HUE_SAT, - /* name */ "Hue Saturation Value", - /* width+range */ 150, 80, 250, - /* class+opts */ NODE_CLASS_OP_COLOR, NODE_OPTIONS, - /* input sock */ cmp_node_hue_sat_in, - /* output sock */ cmp_node_hue_sat_out, - /* storage */ "NodeHueSat", - /* execfunc */ node_composit_exec_hue_sat, - /* butfunc */ NULL, - /* initfunc */ node_composit_init_hue_sat, - /* freestoragefunc */ node_free_standard_storage, - /* copystoragefunc */ node_copy_standard_storage, - /* id */ NULL - -}; +void register_node_type_cmp_hue_sat(ListBase *lb) +{ + static bNodeType ntype; + + node_type_base(&ntype, CMP_NODE_HUE_SAT, "Hue Saturation Value", NODE_CLASS_OP_COLOR, NODE_OPTIONS, + cmp_node_hue_sat_in, cmp_node_hue_sat_out); + node_type_size(&ntype, 150, 80, 250); + node_type_init(&ntype, node_composit_init_hue_sat); + node_type_storage(&ntype, "NodeHueSat", node_free_standard_storage, node_copy_standard_storage); + node_type_exec(&ntype, node_composit_exec_hue_sat); + + nodeRegisterType(lb, &ntype); +} + diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_huecorrect.c b/source/blender/nodes/intern/CMP_nodes/CMP_huecorrect.c index ac009ccb69d..54503d23550 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_huecorrect.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_huecorrect.c @@ -148,20 +148,18 @@ static void node_composit_init_huecorrect(bNode* node) cumapping->cur = 1; } -bNodeType cmp_node_huecorrect= { - /* *next,*prev */ NULL, NULL, - /* type code */ CMP_NODE_HUECORRECT, - /* name */ "Hue Correct", - /* width+range */ 320, 140, 400, - /* class+opts */ NODE_CLASS_OP_COLOR, NODE_OPTIONS, - /* input sock */ cmp_node_huecorrect_in, - /* output sock */ cmp_node_huecorrect_out, - /* storage */ "CurveMapping", - /* execfunc */ node_composit_exec_huecorrect, - /* butfunc */ NULL, - /* initfunc */ node_composit_init_huecorrect, - /* freestoragefunc */ node_free_curves, - /* copystoragefunc */ node_copy_curves, - /* id */ NULL -}; +void register_node_type_cmp_huecorrect(ListBase *lb) +{ + static bNodeType ntype; + + node_type_base(&ntype, CMP_NODE_HUECORRECT, "Hue Correct", NODE_CLASS_OP_COLOR, NODE_OPTIONS, + cmp_node_huecorrect_in, cmp_node_huecorrect_out); + node_type_size(&ntype, 320, 140, 400); + node_type_init(&ntype, node_composit_init_huecorrect); + node_type_storage(&ntype, "CurveMapping", node_free_curves, node_copy_curves); + node_type_exec(&ntype, node_composit_exec_huecorrect); + + nodeRegisterType(lb, &ntype); +} + diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_idMask.c b/source/blender/nodes/intern/CMP_nodes/CMP_idMask.c index 9b088cb3f55..8b422012cec 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_idMask.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_idMask.c @@ -104,21 +104,17 @@ static void node_composit_exec_idmask(void *data, bNode *node, bNodeStack **in, } -bNodeType cmp_node_idmask= { - /* *next,*prev */ NULL, NULL, - /* type code */ CMP_NODE_ID_MASK, - /* name */ "ID Mask", - /* width+range */ 140, 100, 320, - /* class+opts */ NODE_CLASS_CONVERTOR, NODE_OPTIONS, - /* input sock */ cmp_node_idmask_in, - /* output sock */ cmp_node_idmask_out, - /* storage */ "", - /* execfunc */ node_composit_exec_idmask, - /* butfunc */ NULL, - /* initfunc */ NULL, - /* freestoragefunc */ NULL, - /* copystoragefunc */ NULL, - /* id */ NULL -}; +void register_node_type_cmp_idmask(ListBase *lb) +{ + static bNodeType ntype; + + node_type_base(&ntype, CMP_NODE_ID_MASK, "ID Mask", NODE_CLASS_CONVERTOR, NODE_OPTIONS, + cmp_node_idmask_in, cmp_node_idmask_out); + node_type_size(&ntype, 140, 100, 320); + node_type_exec(&ntype, node_composit_exec_idmask); + + nodeRegisterType(lb, &ntype); +} + diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_image.c b/source/blender/nodes/intern/CMP_nodes/CMP_image.c index dcf9a059c83..d5176bf6816 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_image.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_image.c @@ -177,7 +177,7 @@ static CompBuf *compbuf_multilayer_get(RenderData *rd, RenderLayer *rl, Image *i return NULL; }; -void outputs_multilayer_get(RenderData *rd, RenderLayer *rl, bNodeStack **out, Image *ima, ImageUser *iuser) +static void outputs_multilayer_get(RenderData *rd, RenderLayer *rl, bNodeStack **out, Image *ima, ImageUser *iuser) { if(out[RRES_OUT_Z]->hasoutput) out[RRES_OUT_Z]->data= compbuf_multilayer_get(rd, rl, ima, iuser, SCE_PASS_Z); @@ -297,22 +297,20 @@ static void node_composit_init_image(bNode* node) iuser->ok= 1; } -bNodeType cmp_node_image= { - /* *next,*prev */ NULL, NULL, - /* type code */ CMP_NODE_IMAGE, - /* name */ "Image", - /* width+range */ 120, 80, 300, - /* class+opts */ NODE_CLASS_INPUT, NODE_PREVIEW|NODE_OPTIONS, - /* input sock */ NULL, - /* output sock */ cmp_node_rlayers_out, - /* storage */ "ImageUser", - /* execfunc */ node_composit_exec_image, - /* butfunc */ NULL, - /* initfunc */ node_composit_init_image, - /* freestoragefunc */ node_free_standard_storage, - /* copystoragefunc */ node_copy_standard_storage, - /* id */ NULL -}; +void register_node_type_cmp_image(ListBase *lb) +{ + static bNodeType ntype; + + node_type_base(&ntype, CMP_NODE_IMAGE, "Image", NODE_CLASS_INPUT, NODE_PREVIEW|NODE_OPTIONS, + NULL, cmp_node_rlayers_out); + node_type_size(&ntype, 120, 80, 300); + node_type_init(&ntype, node_composit_init_image); + node_type_storage(&ntype, "ImageUser", node_free_standard_storage, node_copy_standard_storage); + node_type_exec(&ntype, node_composit_exec_image); + + nodeRegisterType(lb, &ntype); +} + /* **************** RENDER RESULT ******************** */ @@ -428,22 +426,17 @@ static void node_composit_exec_rlayers(void *data, bNode *node, bNodeStack **UNU }; -bNodeType cmp_node_rlayers= { - /* *next,*prev */ NULL, NULL, - /* type code */ CMP_NODE_R_LAYERS, - /* name */ "Render Layers", - /* width+range */ 150, 100, 300, - /* class+opts */ NODE_CLASS_INPUT, NODE_PREVIEW|NODE_OPTIONS, - /* input sock */ NULL, - /* output sock */ cmp_node_rlayers_out, - /* storage */ "", - /* execfunc */ node_composit_exec_rlayers, - /* butfunc */ NULL, - /* initfunc */ NULL, - /* freestoragefunc */ NULL, - /* copystoragefunc */ NULL, - /* id */ NULL +void register_node_type_cmp_rlayers(ListBase *lb) +{ + static bNodeType ntype; + + node_type_base(&ntype, CMP_NODE_R_LAYERS, "Render Layers", NODE_CLASS_INPUT, NODE_PREVIEW|NODE_OPTIONS, + NULL, cmp_node_rlayers_out); + node_type_size(&ntype, 150, 100, 300); + node_type_exec(&ntype, node_composit_exec_rlayers); + + nodeRegisterType(lb, &ntype); +} -}; diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_invert.c b/source/blender/nodes/intern/CMP_nodes/CMP_invert.c index 7ea146c7d4d..a60edd5ac7d 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_invert.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_invert.c @@ -115,20 +115,16 @@ static void node_composit_init_invert(bNode *node) } /* custom1 = mix type */ -bNodeType cmp_node_invert= { - /* *next,*prev */ NULL, NULL, - /* type code */ CMP_NODE_INVERT, - /* name */ "Invert", - /* width+range */ 120, 120, 140, - /* class+opts */ NODE_CLASS_OP_COLOR, NODE_OPTIONS, - /* input sock */ cmp_node_invert_in, - /* output sock */ cmp_node_invert_out, - /* storage */ "", - /* execfunc */ node_composit_exec_invert, - /* butfunc */ NULL, - /* initfunc */ node_composit_init_invert, - /* freestoragefunc */ NULL, - /* copystoragefunc */ NULL, - /* id */ NULL - -}; +void register_node_type_cmp_invert(ListBase *lb) +{ + static bNodeType ntype; + + node_type_base(&ntype, CMP_NODE_INVERT, "Invert", NODE_CLASS_OP_COLOR, NODE_OPTIONS, + cmp_node_invert_in, cmp_node_invert_out); + node_type_size(&ntype, 120, 120, 140); + node_type_init(&ntype, node_composit_init_invert); + node_type_exec(&ntype, node_composit_exec_invert); + + nodeRegisterType(lb, &ntype); +} + diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_lensdist.c b/source/blender/nodes/intern/CMP_nodes/CMP_lensdist.c index b6e1fffcce8..159bc859450 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_lensdist.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_lensdist.c @@ -174,19 +174,17 @@ static void node_composit_init_lensdist(bNode* node) } -bNodeType cmp_node_lensdist = { - /* *next,*prev */ NULL, NULL, - /* type code */ CMP_NODE_LENSDIST, - /* name */ "Lens Distortion", - /* width+range */ 150, 120, 200, - /* class+opts */ NODE_CLASS_DISTORT, NODE_OPTIONS, - /* input sock */ cmp_node_lensdist_in, - /* output sock */ cmp_node_lensdist_out, - /* storage */ "NodeLensDist", - /* execfunc */ node_composit_exec_lensdist, - /* butfunc */ NULL, - /* initfunc */ node_composit_init_lensdist, - /* freestoragefunc */ node_free_standard_storage, - /* copystoragefunc */ node_copy_standard_storage, - /* id */ NULL -}; +void register_node_type_cmp_lensdist(ListBase *lb) +{ + static bNodeType ntype; + + node_type_base(&ntype, CMP_NODE_LENSDIST, "Lens Distortion", NODE_CLASS_DISTORT, NODE_OPTIONS, + cmp_node_lensdist_in, cmp_node_lensdist_out); + node_type_size(&ntype, 150, 120, 200); + node_type_init(&ntype, node_composit_init_lensdist); + node_type_storage(&ntype, "NodeLensDist", node_free_standard_storage, node_copy_standard_storage); + node_type_exec(&ntype, node_composit_exec_lensdist); + + nodeRegisterType(lb, &ntype); +} + diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_levels.c b/source/blender/nodes/intern/CMP_nodes/CMP_levels.c index f4934b4b57b..71170d1633e 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_levels.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_levels.c @@ -328,21 +328,18 @@ static void node_composit_init_view_levels(bNode* node) node->custom1=1; /*All channels*/ } -bNodeType cmp_node_view_levels= { - /* *next,*prev */ NULL, NULL, - /* type code */ CMP_NODE_VIEW_LEVELS, - /* name */ "Levels", - /* widthrange */ 140, 100, 320, - /* classopts */ NODE_CLASS_OUTPUT, NODE_OPTIONS|NODE_PREVIEW, - /* input sock */ cmp_node_view_levels_in, - /* output sock */ cmp_node_view_levels_out, - /* storage */ "ImageUser", - /* execfunc */ node_composit_exec_view_levels, - /* butfunc */ NULL, - /* initfunc */ node_composit_init_view_levels, - /* freestoragefunc */ NULL, - /* copystoragefunc */ NULL, - /* id */ NULL - -}; +void register_node_type_cmp_view_levels(ListBase *lb) +{ + static bNodeType ntype; + + node_type_base(&ntype, CMP_NODE_VIEW_LEVELS, "Levels", NODE_CLASS_OUTPUT, NODE_OPTIONS|NODE_PREVIEW, + cmp_node_view_levels_in, cmp_node_view_levels_out); + node_type_size(&ntype, 140, 100, 320); + node_type_init(&ntype, node_composit_init_view_levels); + node_type_storage(&ntype, "ImageUser", NULL, NULL); + node_type_exec(&ntype, node_composit_exec_view_levels); + + nodeRegisterType(lb, &ntype); +} + diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_lummaMatte.c b/source/blender/nodes/intern/CMP_nodes/CMP_lummaMatte.c index af198fba699..91edb48415b 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_lummaMatte.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_lummaMatte.c @@ -103,20 +103,18 @@ static void node_composit_init_luma_matte(bNode *node) c->t2= 0.0f; }; -bNodeType cmp_node_luma_matte={ - /* *next,*prev */ NULL, NULL, - /* type code */ CMP_NODE_LUMA_MATTE, - /* name */ "Luminance Key", - /* width+range */ 200, 80, 250, - /* class+opts */ NODE_CLASS_MATTE, NODE_PREVIEW|NODE_OPTIONS, - /* input sock */ cmp_node_luma_matte_in, - /* output sock */ cmp_node_luma_matte_out, - /* storage */ "NodeChroma", - /* execfunc */ node_composit_exec_luma_matte, - /* butfunc */ NULL, - /* initfunc */ node_composit_init_luma_matte, - /* freestoragefunc */ node_free_standard_storage, - /* copystoragefunc */ node_copy_standard_storage, - /* id */ NULL -}; +void register_node_type_cmp_luma_matte(ListBase *lb) +{ + static bNodeType ntype; + + node_type_base(&ntype, CMP_NODE_LUMA_MATTE, "Luminance Key", NODE_CLASS_MATTE, NODE_PREVIEW|NODE_OPTIONS, + cmp_node_luma_matte_in, cmp_node_luma_matte_out); + node_type_size(&ntype, 200, 80, 250); + node_type_init(&ntype, node_composit_init_luma_matte); + node_type_storage(&ntype, "NodeChroma", node_free_standard_storage, node_copy_standard_storage); + node_type_exec(&ntype, node_composit_exec_luma_matte); + + nodeRegisterType(lb, &ntype); +} + diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_mapUV.c b/source/blender/nodes/intern/CMP_nodes/CMP_mapUV.c index c605a661556..f0e0aec37b9 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_mapUV.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_mapUV.c @@ -159,21 +159,17 @@ static void node_composit_exec_mapuv(void *UNUSED(data), bNode *node, bNodeStack } } -bNodeType cmp_node_mapuv= { - /* *next,*prev */ NULL, NULL, - /* type code */ CMP_NODE_MAP_UV, - /* name */ "Map UV", - /* width+range */ 140, 100, 320, - /* class+opts */ NODE_CLASS_DISTORT, NODE_OPTIONS, - /* input sock */ cmp_node_mapuv_in, - /* output sock */ cmp_node_mapuv_out, - /* storage */ "", - /* execfunc */ node_composit_exec_mapuv, - /* butfunc */ NULL, - /* initfunc */ NULL, - /* freestoragefunc */ NULL, - /* copystoragefunc */ NULL, - /* id */ NULL -}; +void register_node_type_cmp_mapuv(ListBase *lb) +{ + static bNodeType ntype; + + node_type_base(&ntype, CMP_NODE_MAP_UV, "Map UV", NODE_CLASS_DISTORT, NODE_OPTIONS, + cmp_node_mapuv_in, cmp_node_mapuv_out); + node_type_size(&ntype, 140, 100, 320); + node_type_exec(&ntype, node_composit_exec_mapuv); + + nodeRegisterType(lb, &ntype); +} + diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_mapValue.c b/source/blender/nodes/intern/CMP_nodes/CMP_mapValue.c index 92709025a84..550e4a2e870 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_mapValue.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_mapValue.c @@ -79,23 +79,20 @@ static void node_composit_init_map_value(bNode* node) node->storage= add_mapping(); } -bNodeType cmp_node_map_value= { - /* *next,*prev */ NULL, NULL, - /* type code */ CMP_NODE_MAP_VALUE, - /* name */ "Map Value", - /* width+range */ 100, 60, 150, - /* class+opts */ NODE_CLASS_OP_VECTOR, NODE_OPTIONS, - /* input sock */ cmp_node_map_value_in, - /* output sock */ cmp_node_map_value_out, - /* storage */ "TexMapping", - /* execfunc */ node_composit_exec_map_value, - /* butfunc */ NULL, - /* initfunc */ node_composit_init_map_value, - /* freestoragefunc */ node_free_standard_storage, - /* copystoragefunc */ node_copy_standard_storage, - /* id */ NULL - -}; +void register_node_type_cmp_map_value(ListBase *lb) +{ + static bNodeType ntype; + + node_type_base(&ntype, CMP_NODE_MAP_VALUE, "Map Value", NODE_CLASS_OP_VECTOR, NODE_OPTIONS, + cmp_node_map_value_in, cmp_node_map_value_out); + node_type_size(&ntype, 100, 60, 150); + node_type_init(&ntype, node_composit_init_map_value); + node_type_storage(&ntype, "TexMapping", node_free_standard_storage, node_copy_standard_storage); + node_type_exec(&ntype, node_composit_exec_map_value); + + nodeRegisterType(lb, &ntype); +} + diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_math.c b/source/blender/nodes/intern/CMP_nodes/CMP_math.c index 98bbbf6c752..7a8dadafb86 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_math.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_math.c @@ -29,7 +29,6 @@ #include "../CMP_util.h" - /* **************** SCALAR MATH ******************** */ static bNodeSocketType cmp_node_math_in[]= { { SOCK_VALUE, 1, "Value", 0.5f, 0.5f, 0.5f, 1.0f, -10000.0f, 10000.0f}, @@ -181,22 +180,19 @@ static void node_composit_exec_math(void *UNUSED(data), bNode *node, bNodeStack out[0]->data= stackbuf; } -bNodeType cmp_node_math= { - /* *next,*prev */ NULL, NULL, - /* type code */ CMP_NODE_MATH, - /* name */ "Math", - /* width+range */ 120, 110, 160, - /* class+opts */ NODE_CLASS_CONVERTOR, NODE_OPTIONS, - /* input sock */ cmp_node_math_in, - /* output sock */ cmp_node_math_out, - /* storage */ "", - /* execfunc */ node_composit_exec_math, - /* butfunc */ NULL, - /* initfunc */ NULL, - /* freestoragefunc */ NULL, - /* copystoragefunc */ NULL, - /* id */ NULL -}; +void register_node_type_cmp_math(ListBase *lb) +{ + static bNodeType ntype; + + node_type_base(&ntype, CMP_NODE_MATH, "Math", NODE_CLASS_CONVERTOR, NODE_OPTIONS, + cmp_node_math_in, cmp_node_math_out); + node_type_size(&ntype, 120, 110, 160); + node_type_label(&ntype, node_math_label); + node_type_exec(&ntype, node_composit_exec_math); + + nodeRegisterType(lb, &ntype); +} + diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_mixrgb.c b/source/blender/nodes/intern/CMP_nodes/CMP_mixrgb.c index 34d6713d9e3..91b8eb8b752 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_mixrgb.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_mixrgb.c @@ -79,20 +79,16 @@ static void node_composit_exec_mix_rgb(void *data, bNode *node, bNodeStack **in, } /* custom1 = mix type */ -bNodeType cmp_node_mix_rgb= { - /* *next,*prev */ NULL, NULL, - /* type code */ CMP_NODE_MIX_RGB, - /* name */ "Mix", - /* width+range */ 110, 60, 120, - /* class+opts */ NODE_CLASS_OP_COLOR, NODE_PREVIEW|NODE_OPTIONS, - /* input sock */ cmp_node_mix_rgb_in, - /* output sock */ cmp_node_mix_rgb_out, - /* storage */ "", - /* execfunc */ node_composit_exec_mix_rgb, - /* butfunc */ NULL, - /* initfunc */ NULL, - /* freestoragefunc */ NULL, - /* copystoragefunc */ NULL, - /* id */ NULL - -}; +void register_node_type_cmp_mix_rgb(ListBase *lb) +{ + static bNodeType ntype; + + node_type_base(&ntype, CMP_NODE_MIX_RGB, "Mix", NODE_CLASS_OP_COLOR, NODE_PREVIEW|NODE_OPTIONS, + cmp_node_mix_rgb_in, cmp_node_mix_rgb_out); + node_type_size(&ntype, 110, 60, 120); + node_type_label(&ntype, node_blend_label); + node_type_exec(&ntype, node_composit_exec_mix_rgb); + + nodeRegisterType(lb, &ntype); +} + diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_normal.c b/source/blender/nodes/intern/CMP_nodes/CMP_normal.c index 04162956ac3..5b218f4d486 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_normal.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_normal.c @@ -77,21 +77,16 @@ static void node_composit_exec_normal(void *UNUSED(data), bNode *node, bNodeStac } -bNodeType cmp_node_normal= { - /* *next,*prev */ NULL, NULL, - /* type code */ CMP_NODE_NORMAL, - /* name */ "Normal", - /* width+range */ 100, 60, 200, - /* class+opts */ NODE_CLASS_OP_VECTOR, NODE_OPTIONS, - /* input sock */ cmp_node_normal_in, - /* output sock */ cmp_node_normal_out, - /* storage */ "", - /* execfunc */ node_composit_exec_normal, - /* butfunc */ NULL, - /* initfunc */ NULL, - /* freestoragefunc */ NULL, - /* copystoragefunc */ NULL, - /* id */ NULL - -}; +void register_node_type_cmp_normal(ListBase *lb) +{ + static bNodeType ntype; + + node_type_base(&ntype, CMP_NODE_NORMAL, "Normal", NODE_CLASS_OP_VECTOR, NODE_OPTIONS, + cmp_node_normal_in, cmp_node_normal_out); + node_type_size(&ntype, 100, 60, 200); + node_type_exec(&ntype, node_composit_exec_normal); + + nodeRegisterType(lb, &ntype); +} + diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_normalize.c b/source/blender/nodes/intern/CMP_nodes/CMP_normalize.c index 07a11cdc997..1c92eb6519e 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_normalize.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_normalize.c @@ -98,19 +98,15 @@ static void node_composit_exec_normalize(void *UNUSED(data), bNode *node, bNodeS } } -bNodeType cmp_node_normalize= { - /* *next, *prev*/ NULL, NULL, - /* type code */ CMP_NODE_NORMALIZE, - /* name */ "Normalize", - /* width+range */ 100, 60, 150, - /* class+opts */ NODE_CLASS_OP_VECTOR, NODE_OPTIONS, - /* input sock */ cmp_node_normalize_in, - /* output sock */ cmp_node_normalize_out, - /* storage */ "TexMapping", - /* execfunc */ node_composit_exec_normalize, - /* butfunc */ NULL, - /* initfunc */ NULL, - /* freestoragefunc */ NULL, - /* copystoragefunc */ NULL, - /* id */ NULL -}; +void register_node_type_cmp_normalize(ListBase *lb) +{ + static bNodeType ntype; + + node_type_base(&ntype, CMP_NODE_NORMALIZE, "Normalize", NODE_CLASS_OP_VECTOR, NODE_OPTIONS, + cmp_node_normalize_in, cmp_node_normalize_out); + node_type_size(&ntype, 100, 60, 150); + node_type_exec(&ntype, node_composit_exec_normalize); + node_type_storage(&ntype, "TexMapping", NULL, NULL); + + nodeRegisterType(lb, &ntype); +} diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_outputFile.c b/source/blender/nodes/intern/CMP_nodes/CMP_outputFile.c index 0129c1bb03d..701a3910be9 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_outputFile.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_outputFile.c @@ -104,22 +104,19 @@ static void node_composit_init_output_file(bNode *node) } } -bNodeType cmp_node_output_file= { - /* *next,*prev */ NULL, NULL, - /* type code */ CMP_NODE_OUTPUT_FILE, - /* name */ "File Output", - /* width+range */ 140, 80, 300, - /* class+opts */ NODE_CLASS_OUTPUT, NODE_PREVIEW|NODE_OPTIONS, - /* input sock */ cmp_node_output_file_in, - /* output sock */ NULL, - /* storage */ "NodeImageFile", - /* execfunc */ node_composit_exec_output_file, - /* butfunc */ NULL, - /* initfunc */ node_composit_init_output_file, - /* freestoragefunc */ node_free_standard_storage, - /* copystoragefunc */ node_copy_standard_storage, - /* id */ NULL - -}; +void register_node_type_cmp_output_file(ListBase *lb) +{ + static bNodeType ntype; + + node_type_base(&ntype, CMP_NODE_OUTPUT_FILE, "File Output", NODE_CLASS_OUTPUT, NODE_PREVIEW|NODE_OPTIONS, + cmp_node_output_file_in, NULL); + node_type_size(&ntype, 140, 80, 300); + node_type_init(&ntype, node_composit_init_output_file); + node_type_storage(&ntype, "NodeImageFile", node_free_standard_storage, node_copy_standard_storage); + node_type_exec(&ntype, node_composit_exec_output_file); + + nodeRegisterType(lb, &ntype); +} + diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_premulkey.c b/source/blender/nodes/intern/CMP_nodes/CMP_premulkey.c index 1aa2e338f94..d64a2cee453 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_premulkey.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_premulkey.c @@ -58,20 +58,16 @@ static void node_composit_exec_premulkey(void *UNUSED(data), bNode *node, bNodeS } } -bNodeType cmp_node_premulkey= { - /* *next,*prev */ NULL, NULL, - /* type code */ CMP_NODE_PREMULKEY, - /* name */ "Alpha Convert", - /* width+range */ 140, 100, 320, - /* class+opts */ NODE_CLASS_CONVERTOR, NODE_OPTIONS, - /* input sock */ cmp_node_premulkey_in, - /* output sock */ cmp_node_premulkey_out, - /* storage */ "", - /* execfunc */ node_composit_exec_premulkey, - /* butfunc */ NULL, - /* initfunc */ NULL, - /* freestoragefunc */ NULL, - /* copysotragefunc */ NULL, - /* id */ NULL -}; +void register_node_type_cmp_premulkey(ListBase *lb) +{ + static bNodeType ntype; + + node_type_base(&ntype, CMP_NODE_PREMULKEY, "Alpha Convert", NODE_CLASS_CONVERTOR, NODE_OPTIONS, + cmp_node_premulkey_in, cmp_node_premulkey_out); + node_type_size(&ntype, 140, 100, 320); + node_type_exec(&ntype, node_composit_exec_premulkey); + + nodeRegisterType(lb, &ntype); +} + diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_rgb.c b/source/blender/nodes/intern/CMP_nodes/CMP_rgb.c index 5fbed05ac8d..975d9cae219 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_rgb.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_rgb.c @@ -43,22 +43,17 @@ static void node_composit_exec_rgb(void *UNUSED(data), bNode *node, bNodeStack * VECCOPY(out[0]->vec, sock->ns.vec); } -bNodeType cmp_node_rgb= { - /* *next,*prev */ NULL, NULL, - /* type code */ CMP_NODE_RGB, - /* name */ "RGB", - /* width+range */ 140, 80, 140, - /* class+opts */ NODE_CLASS_INPUT, NODE_OPTIONS, - /* input sock */ NULL, - /* output sock */ cmp_node_rgb_out, - /* storage */ "", - /* execfunc */ node_composit_exec_rgb, - /* butfunc */ NULL, - /* initfunc */ NULL, - /* freestoragefunc */ NULL, - /* copystoragefunc */ NULL, - /* id */ NULL - -}; +void register_node_type_cmp_rgb(ListBase *lb) +{ + static bNodeType ntype; + + node_type_base(&ntype, CMP_NODE_RGB, "RGB", NODE_CLASS_INPUT, NODE_OPTIONS, + NULL, cmp_node_rgb_out); + node_type_size(&ntype, 140, 80, 140); + node_type_exec(&ntype, node_composit_exec_rgb); + + nodeRegisterType(lb, &ntype); +} + diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_rotate.c b/source/blender/nodes/intern/CMP_nodes/CMP_rotate.c index 8fed6972c20..ff8a2460efc 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_rotate.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_rotate.c @@ -120,19 +120,16 @@ static void node_composit_init_rotate(bNode *node) node->custom1= 1; /* Bilinear Filter*/ } -bNodeType cmp_node_rotate= { - /* *next,*prev */ NULL, NULL, - /* type code */ CMP_NODE_ROTATE, - /* name */ "Rotate", - /* width+range */ 140, 100, 320, - /* class+opts */ NODE_CLASS_DISTORT, NODE_OPTIONS, - /* input sock */ cmp_node_rotate_in, - /* output sock */ cmp_node_rotate_out, - /* storage */ "", - /* execfunc */ node_composit_exec_rotate, - /* butfunc */ NULL, - /* initfunc */ node_composit_init_rotate, - /* freestoragefunc */ NULL, - /* copystoragefunc */ NULL, - /* id */ NULL -}; +void register_node_type_cmp_rotate(ListBase *lb) +{ + static bNodeType ntype; + + node_type_base(&ntype, CMP_NODE_ROTATE, "Rotate", NODE_CLASS_DISTORT, NODE_OPTIONS, + cmp_node_rotate_in, cmp_node_rotate_out); + node_type_size(&ntype, 140, 100, 320); + node_type_init(&ntype, node_composit_init_rotate); + node_type_exec(&ntype, node_composit_exec_rotate); + + nodeRegisterType(lb, &ntype); +} + diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_scale.c b/source/blender/nodes/intern/CMP_nodes/CMP_scale.c index 40785f3bc77..a524f4cb29b 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_scale.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_scale.c @@ -109,22 +109,18 @@ static void node_composit_exec_scale(void *data, bNode *node, bNodeStack **in, b } }; -bNodeType cmp_node_scale= { - /* *next,*prev */ NULL, NULL, - /* type code */ CMP_NODE_SCALE, - /* name */ "Scale", - /* width+range */ 140, 100, 320, - /* class+opts */ NODE_CLASS_DISTORT, NODE_OPTIONS, - /* input sock */ cmp_node_scale_in, - /* output sock */ cmp_node_scale_out, - /* storage */ "", - /* execfunc */ node_composit_exec_scale, - /* butfunc */ NULL, - /* initfunc */ NULL, - /* freestoragefunc */ NULL, - /* copystoragefunc */ NULL, - /* id */ NULL -}; +void register_node_type_cmp_scale(ListBase *lb) +{ + static bNodeType ntype; + + node_type_base(&ntype, CMP_NODE_SCALE, "Scale", NODE_CLASS_DISTORT, NODE_OPTIONS, + cmp_node_scale_in, cmp_node_scale_out); + node_type_size(&ntype, 140, 100, 320); + node_type_exec(&ntype, node_composit_exec_scale); + + nodeRegisterType(lb, &ntype); +} + diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_sepcombHSVA.c b/source/blender/nodes/intern/CMP_nodes/CMP_sepcombHSVA.c index ef8723fd4e9..040a88bc37b 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_sepcombHSVA.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_sepcombHSVA.c @@ -96,23 +96,18 @@ static void node_composit_exec_sephsva(void *UNUSED(data), bNode *node, bNodeSta } } -bNodeType cmp_node_sephsva= { - /* *next,*prev */ NULL, NULL, - /* type code */ CMP_NODE_SEPHSVA, - /* name */ "Separate HSVA", - /* width+range */ 80, 40, 140, - /* class+opts */ NODE_CLASS_CONVERTOR, 0, - /* input sock */ cmp_node_sephsva_in, - /* output sock */ cmp_node_sephsva_out, - /* storage */ "", - /* execfunc */ node_composit_exec_sephsva, - /* butfunc */ NULL, - /* initfunc */ NULL, - /* freestoragefunc */ NULL, - /* copystoragefunc */ NULL, - /* id */ NULL - -}; +void register_node_type_cmp_sephsva(ListBase *lb) +{ + static bNodeType ntype; + + node_type_base(&ntype, CMP_NODE_SEPHSVA, "Separate HSVA", NODE_CLASS_CONVERTOR, 0, + cmp_node_sephsva_in, cmp_node_sephsva_out); + node_type_size(&ntype, 80, 40, 140); + node_type_exec(&ntype, node_composit_exec_sephsva); + + nodeRegisterType(lb, &ntype); +} + /* **************** COMBINE HSVA ******************** */ static bNodeSocketType cmp_node_combhsva_in[]= { @@ -171,21 +166,17 @@ static void node_composit_exec_combhsva(void *UNUSED(data), bNode *node, bNodeSt } } -bNodeType cmp_node_combhsva= { - /* *next,*prev */ NULL, NULL, - /* type code */ CMP_NODE_COMBHSVA, - /* name */ "Combine HSVA", - /* width+range */ 80, 40, 140, - /* class+opts */ NODE_CLASS_CONVERTOR, NODE_OPTIONS, - /* input sock */ cmp_node_combhsva_in, - /* output sock */ cmp_node_combhsva_out, - /* storage */ "", - /* execfunc */ node_composit_exec_combhsva, - /* butfunc */ NULL, - /* initfunc */ NULL, - /* freestoragefunc */ NULL, - /* copystoragefunc */ NULL, - /* id */ NULL -}; +void register_node_type_cmp_combhsva(ListBase *lb) +{ + static bNodeType ntype; + + node_type_base(&ntype, CMP_NODE_COMBHSVA, "Combine HSVA", NODE_CLASS_CONVERTOR, NODE_OPTIONS, + cmp_node_combhsva_in, cmp_node_combhsva_out); + node_type_size(&ntype, 80, 40, 140); + node_type_exec(&ntype, node_composit_exec_combhsva); + + nodeRegisterType(lb, &ntype); +} + diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_sepcombRGBA.c b/source/blender/nodes/intern/CMP_nodes/CMP_sepcombRGBA.c index 36603785bb3..1062344db39 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_sepcombRGBA.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_sepcombRGBA.c @@ -74,23 +74,18 @@ static void node_composit_exec_seprgba(void *UNUSED(data), bNode *UNUSED(node), } } -bNodeType cmp_node_seprgba= { - /* *next,*prev */ NULL, NULL, - /* type code */ CMP_NODE_SEPRGBA, - /* name */ "Separate RGBA", - /* width+range */ 80, 40, 140, - /* class+opts */ NODE_CLASS_CONVERTOR, 0, - /* input sock */ cmp_node_seprgba_in, - /* output sock */ cmp_node_seprgba_out, - /* storage */ "", - /* execfunc */ node_composit_exec_seprgba, - /* butfunc */ NULL, - /* initfunc */ NULL, - /* freestoragefunc */ NULL, - /* copystoragefunc */ NULL, - /* id */ NULL - -}; +void register_node_type_cmp_seprgba(ListBase *lb) +{ + static bNodeType ntype; + + node_type_base(&ntype, CMP_NODE_SEPRGBA, "Separate RGBA", NODE_CLASS_CONVERTOR, 0, + cmp_node_seprgba_in, cmp_node_seprgba_out); + node_type_size(&ntype, 80, 40, 140); + node_type_exec(&ntype, node_composit_exec_seprgba); + + nodeRegisterType(lb, &ntype); +} + /* **************** COMBINE RGBA ******************** */ @@ -147,21 +142,16 @@ static void node_composit_exec_combrgba(void *UNUSED(data), bNode *node, bNodeSt } } -bNodeType cmp_node_combrgba= { - /* *next,*prev */ NULL, NULL, - /* type code */ CMP_NODE_COMBRGBA, - /* name */ "Combine RGBA", - /* width+range */ 80, 40, 140, - /* class+opts */ NODE_CLASS_CONVERTOR, NODE_OPTIONS, - /* input sock */ cmp_node_combrgba_in, - /* output sock */ cmp_node_combrgba_out, - /* storage */ "", - /* execfunc */ node_composit_exec_combrgba, - /* butfunc */ NULL, - /* initfunc */ NULL, - /* freestoragefunc */ NULL, - /* copystoragefunc */ NULL, - /* id */ NULL - -}; +void register_node_type_cmp_combrgba(ListBase *lb) +{ + static bNodeType ntype; + + node_type_base(&ntype, CMP_NODE_COMBRGBA, "Combine RGBA", NODE_CLASS_CONVERTOR, NODE_OPTIONS, + cmp_node_combrgba_in, cmp_node_combrgba_out); + node_type_size(&ntype, 80, 40, 140); + node_type_exec(&ntype, node_composit_exec_combrgba); + + nodeRegisterType(lb, &ntype); +} + diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_sepcombYCCA.c b/source/blender/nodes/intern/CMP_nodes/CMP_sepcombYCCA.c index 895d7799796..364457fc5fa 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_sepcombYCCA.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_sepcombYCCA.c @@ -145,22 +145,18 @@ static void node_composit_exec_sepycca(void *UNUSED(data), bNode *node, bNodeSta } } -bNodeType cmp_node_sepycca= { - /* *next,*prev */ NULL, NULL, - /* type code */ CMP_NODE_SEPYCCA, - /* name */ "Separate YCbCrA", - /* width+range */ 80, 40, 140, - /* class+opts */ NODE_CLASS_CONVERTOR, NODE_OPTIONS, - /* input sock */ cmp_node_sepycca_in, - /* output sock */ cmp_node_sepycca_out, - /* storage */ "", - /* execfunc */ node_composit_exec_sepycca, - /* butfunc */ NULL, - /* initfunc */ NULL, - /* freestoragefunc */ NULL, - /* copystoragefunc */ NULL, - /* id */ NULL -}; +void register_node_type_cmp_sepycca(ListBase *lb) +{ + static bNodeType ntype; + + node_type_base(&ntype, CMP_NODE_SEPYCCA, "Separate YCbCrA", NODE_CLASS_CONVERTOR, NODE_OPTIONS, + cmp_node_sepycca_in, cmp_node_sepycca_out); + node_type_size(&ntype, 80, 40, 140); + node_type_exec(&ntype, node_composit_exec_sepycca); + + nodeRegisterType(lb, &ntype); +} + /* **************** COMBINE YCCA ******************** */ @@ -296,21 +292,17 @@ static void node_composit_exec_combycca(void *UNUSED(data), bNode *node, bNodeSt } } -bNodeType cmp_node_combycca= { - /* *next,*prev */ NULL, NULL, - /* type code */ CMP_NODE_COMBYCCA, - /* name */ "Combine YCbCrA", - /* width+range */ 80, 40, 140, - /* class+opts */ NODE_CLASS_CONVERTOR, NODE_OPTIONS, - /* input sock */ cmp_node_combycca_in, - /* output sock */ cmp_node_combycca_out, - /* storage */ "", - /* execfunc */ node_composit_exec_combycca, - /* butfunc */ NULL, - /* initfunc */ NULL, - /* freestoragefunc */ NULL, - /* copystoragefunc */ NULL, - /* id */ NULL -}; +void register_node_type_cmp_combycca(ListBase *lb) +{ + static bNodeType ntype; + + node_type_base(&ntype, CMP_NODE_COMBYCCA, "Combine YCbCrA", NODE_CLASS_CONVERTOR, NODE_OPTIONS, + cmp_node_combycca_in, cmp_node_combycca_out); + node_type_size(&ntype, 80, 40, 140); + node_type_exec(&ntype, node_composit_exec_combycca); + + nodeRegisterType(lb, &ntype); +} + diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_sepcombYUVA.c b/source/blender/nodes/intern/CMP_nodes/CMP_sepcombYUVA.c index 333a4a2596e..99a625042df 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_sepcombYUVA.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_sepcombYUVA.c @@ -96,22 +96,18 @@ static void node_composit_exec_sepyuva(void *UNUSED(data), bNode *node, bNodeSta } } -bNodeType cmp_node_sepyuva= { - /* *next,*prev */ NULL, NULL, - /* type code */ CMP_NODE_SEPYUVA, - /* name */ "Separate YUVA", - /* width+range */ 80, 40, 140, - /* class+opts */ NODE_CLASS_CONVERTOR, 0, - /* input sock */ cmp_node_sepyuva_in, - /* output sock */ cmp_node_sepyuva_out, - /* storage */ "", - /* execfunc */ node_composit_exec_sepyuva, - /* butfunc */ NULL, - /* initfunc */ NULL, - /* freestoragefunc */ NULL, - /* copystoragefunc */ NULL, - /* id */ NULL -}; +void register_node_type_cmp_sepyuva(ListBase *lb) +{ + static bNodeType ntype; + + node_type_base(&ntype, CMP_NODE_SEPYUVA, "Separate YUVA", NODE_CLASS_CONVERTOR, 0, + cmp_node_sepyuva_in, cmp_node_sepyuva_out); + node_type_size(&ntype, 80, 40, 140); + node_type_exec(&ntype, node_composit_exec_sepyuva); + + nodeRegisterType(lb, &ntype); +} + /* **************** COMBINE YUVA ******************** */ @@ -171,20 +167,16 @@ static void node_composit_exec_combyuva(void *UNUSED(data), bNode *node, bNodeSt } } -bNodeType cmp_node_combyuva= { - /* *next,*prev */ NULL, NULL, - /* type code */ CMP_NODE_COMBYUVA, - /* name */ "Combine YUVA", - /* width+range */ 80, 40, 140, - /* class+opts */ NODE_CLASS_CONVERTOR, NODE_OPTIONS, - /* input sock */ cmp_node_combyuva_in, - /* output sock */ cmp_node_combyuva_out, - /* storage */ "", - /* execfunc */ node_composit_exec_combyuva, - /* butfunc */ NULL, - /* initfunc */ NULL, - /* freestoragefunc */ NULL, - /* copystoragefunc */ NULL, - /* id */ NULL -}; +void register_node_type_cmp_combyuva(ListBase *lb) +{ + static bNodeType ntype; + + node_type_base(&ntype, CMP_NODE_COMBYUVA, "Combine YUVA", NODE_CLASS_CONVERTOR, NODE_OPTIONS, + cmp_node_combyuva_in, cmp_node_combyuva_out); + node_type_size(&ntype, 80, 40, 140); + node_type_exec(&ntype, node_composit_exec_combyuva); + + nodeRegisterType(lb, &ntype); +} + diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_setalpha.c b/source/blender/nodes/intern/CMP_nodes/CMP_setalpha.c index f4c5603ce49..106203ded7a 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_setalpha.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_setalpha.c @@ -70,20 +70,15 @@ static void node_composit_exec_setalpha(void *UNUSED(data), bNode *node, bNodeSt } } -bNodeType cmp_node_setalpha= { - /* *next,*prev */ NULL, NULL, - /* type code */ CMP_NODE_SETALPHA, - /* name */ "Set Alpha", - /* width+range */ 120, 40, 140, - /* class+opts */ NODE_CLASS_CONVERTOR, NODE_OPTIONS, - /* input sock */ cmp_node_setalpha_in, - /* output sock */ cmp_node_setalpha_out, - /* storage */ "", - /* execfunc */ node_composit_exec_setalpha, - /* butfunc */ NULL, - /* initfunc */ NULL, - /* freestoragefunc */ NULL, - /* copystoragefunc */ NULL, - /* id */ NULL - -}; +void register_node_type_cmp_setalpha(ListBase *lb) +{ + static bNodeType ntype; + + node_type_base(&ntype, CMP_NODE_SETALPHA, "Set Alpha", NODE_CLASS_CONVERTOR, NODE_OPTIONS, + cmp_node_setalpha_in, cmp_node_setalpha_out); + node_type_size(&ntype, 120, 40, 140); + node_type_exec(&ntype, node_composit_exec_setalpha); + + nodeRegisterType(lb, &ntype); +} + diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_splitViewer.c b/source/blender/nodes/intern/CMP_nodes/CMP_splitViewer.c index efb8c12fa84..1bb0cdfcd10 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_splitViewer.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_splitViewer.c @@ -146,22 +146,20 @@ static void node_composit_init_splitviewer(bNode* node) node->custom1= 50; /* default 50% split */ } -bNodeType cmp_node_splitviewer= { - /* *next,*prev */ NULL, NULL, - /* type code */ CMP_NODE_SPLITVIEWER, - /* name */ "SplitViewer", - /* width+range */ 140, 100, 320, - /* class+opts */ NODE_CLASS_OUTPUT, NODE_PREVIEW|NODE_OPTIONS, - /* input sock */ cmp_node_splitviewer_in, - /* output sock */ NULL, - /* storage */ "ImageUser", - /* execfunc */ node_composit_exec_splitviewer, - /* butfunc */ NULL, - /* initfunc */ node_composit_init_splitviewer, - /* freestoragefunc */ node_free_standard_storage, - /* copystoragefunc */ node_copy_standard_storage, - /* id */ NULL -}; +void register_node_type_cmp_splitviewer(ListBase *lb) +{ + static bNodeType ntype; + + node_type_base(&ntype, CMP_NODE_SPLITVIEWER, "SplitViewer", NODE_CLASS_OUTPUT, NODE_PREVIEW|NODE_OPTIONS, + cmp_node_splitviewer_in, NULL); + node_type_size(&ntype, 140, 100, 320); + node_type_init(&ntype, node_composit_init_splitviewer); + node_type_storage(&ntype, "ImageUser", node_free_standard_storage, node_copy_standard_storage); + node_type_exec(&ntype, node_composit_exec_splitviewer); + + nodeRegisterType(lb, &ntype); +} + diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_texture.c b/source/blender/nodes/intern/CMP_nodes/CMP_texture.c index b2510917ba1..63a43352b2a 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_texture.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_texture.c @@ -139,22 +139,17 @@ static void node_composit_exec_texture(void *data, bNode *node, bNodeStack **in, } } -bNodeType cmp_node_texture= { - /* *next,*prev */ NULL, NULL, - /* type code */ CMP_NODE_TEXTURE, - /* name */ "Texture", - /* width+range */ 120, 80, 240, - /* class+opts */ NODE_CLASS_INPUT, NODE_OPTIONS|NODE_PREVIEW, - /* input sock */ cmp_node_texture_in, - /* output sock */ cmp_node_texture_out, - /* storage */ "", - /* execfunc */ node_composit_exec_texture, - /* butfunc */ NULL, - /* initfunc */ NULL, - /* freestoragefunc */ NULL, - /* copystoragefunc */ NULL, - /* id */ NULL - -}; +void register_node_type_cmp_texture(ListBase *lb) +{ + static bNodeType ntype; + + node_type_base(&ntype, CMP_NODE_TEXTURE, "Texture", NODE_CLASS_INPUT, NODE_OPTIONS|NODE_PREVIEW, + cmp_node_texture_in, cmp_node_texture_out); + node_type_size(&ntype, 120, 80, 240); + node_type_exec(&ntype, node_composit_exec_texture); + + nodeRegisterType(lb, &ntype); +} + diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_tonemap.c b/source/blender/nodes/intern/CMP_nodes/CMP_tonemap.c index 49031e1625a..d58f0e827c2 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_tonemap.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_tonemap.c @@ -158,19 +158,17 @@ static void node_composit_init_tonemap(bNode* node) node->storage = ntm; } -bNodeType cmp_node_tonemap = { - /* *next,*prev */ NULL, NULL, - /* type code */ CMP_NODE_TONEMAP, - /* name */ "Tonemap", - /* width+range */ 150, 120, 200, - /* class+opts */ NODE_CLASS_OP_COLOR, NODE_OPTIONS, - /* input sock */ cmp_node_tonemap_in, - /* output sock */ cmp_node_tonemap_out, - /* storage */ "NodeTonemap", - /* execfunc */ node_composit_exec_tonemap, - /* butfunc */ NULL, - /* initfunc */ node_composit_init_tonemap, - /* freestoragefunc */ node_free_standard_storage, - /* copystoragefunc */ node_copy_standard_storage, - /* id */ NULL -}; +void register_node_type_cmp_tonemap(ListBase *lb) +{ + static bNodeType ntype; + + node_type_base(&ntype, CMP_NODE_TONEMAP, "Tonemap", NODE_CLASS_OP_COLOR, NODE_OPTIONS, + cmp_node_tonemap_in, cmp_node_tonemap_out); + node_type_size(&ntype, 150, 120, 200); + node_type_init(&ntype, node_composit_init_tonemap); + node_type_storage(&ntype, "NodeTonemap", node_free_standard_storage, node_copy_standard_storage); + node_type_exec(&ntype, node_composit_exec_tonemap); + + nodeRegisterType(lb, &ntype); +} + diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_translate.c b/source/blender/nodes/intern/CMP_nodes/CMP_translate.c index 0d8ad41d2dd..cad4d79b75c 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_translate.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_translate.c @@ -56,20 +56,16 @@ static void node_composit_exec_translate(void *UNUSED(data), bNode *UNUSED(node) } } -bNodeType cmp_node_translate= { - /* *next,*prev */ NULL, NULL, - /* type code */ CMP_NODE_TRANSLATE, - /* name */ "Translate", - /* width+range */ 140, 100, 320, - /* class+opts */ NODE_CLASS_DISTORT, NODE_OPTIONS, - /* input sock */ cmp_node_translate_in, - /* output sock */ cmp_node_translate_out, - /* storage */ "", - /* execfunc */ node_composit_exec_translate, - /* butfunc */ NULL, - /* initfunc */ NULL, - /* freestoragefunc */ NULL, - /* copystoragefunc */ NULL, - /* id */ NULL -}; +void register_node_type_cmp_translate(ListBase *lb) +{ + static bNodeType ntype; + + node_type_base(&ntype, CMP_NODE_TRANSLATE, "Translate", NODE_CLASS_DISTORT, NODE_OPTIONS, + cmp_node_translate_in, cmp_node_translate_out); + node_type_size(&ntype, 140, 100, 320); + node_type_exec(&ntype, node_composit_exec_translate); + + nodeRegisterType(lb, &ntype); +} + diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_valToRgb.c b/source/blender/nodes/intern/CMP_nodes/CMP_valToRgb.c index 7e0ecbcb888..2000e411f8c 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_valToRgb.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_valToRgb.c @@ -80,23 +80,20 @@ static void node_composit_init_valtorgb(bNode* node) node->storage= add_colorband(1); } -bNodeType cmp_node_valtorgb= { - /* *next,*prev */ NULL, NULL, - /* type code */ CMP_NODE_VALTORGB, - /* name */ "ColorRamp", - /* width+range */ 240, 200, 300, - /* class+opts */ NODE_CLASS_CONVERTOR, NODE_OPTIONS, - /* input sock */ cmp_node_valtorgb_in, - /* output sock */ cmp_node_valtorgb_out, - /* storage */ "ColorBand", - /* execfunc */ node_composit_exec_valtorgb, - /* butfunc */ NULL, - /* initfunc */ node_composit_init_valtorgb, - /* freestoragefunc */ node_free_standard_storage, - /* copystoragefunc */ node_copy_standard_storage, - /* id */ NULL - -}; +void register_node_type_cmp_valtorgb(ListBase *lb) +{ + static bNodeType ntype; + + node_type_base(&ntype, CMP_NODE_VALTORGB, "ColorRamp", NODE_CLASS_CONVERTOR, NODE_OPTIONS, + cmp_node_valtorgb_in, cmp_node_valtorgb_out); + node_type_size(&ntype, 240, 200, 300); + node_type_init(&ntype, node_composit_init_valtorgb); + node_type_storage(&ntype, "ColorBand", node_free_standard_storage, node_copy_standard_storage); + node_type_exec(&ntype, node_composit_exec_valtorgb); + + nodeRegisterType(lb, &ntype); +} + /* **************** RGBTOBW ******************** */ @@ -137,21 +134,14 @@ static void node_composit_exec_rgbtobw(void *UNUSED(data), bNode *node, bNodeSta } } -bNodeType cmp_node_rgbtobw= { - /* *next,*prev */ NULL, NULL, - /* type code */ CMP_NODE_RGBTOBW, - /* name */ "RGB to BW", - /* width+range */ 80, 40, 120, - /* class+opts */ NODE_CLASS_CONVERTOR, 0, - /* input sock */ cmp_node_rgbtobw_in, - /* output sock */ cmp_node_rgbtobw_out, - /* storage */ "", - /* execfunc */ node_composit_exec_rgbtobw, - /* butfunc */ NULL, - /* freestoragefunc */ NULL, - /* copystoragefunc */ NULL, - /* id */ NULL +void register_node_type_cmp_rgbtobw(ListBase *lb) +{ + static bNodeType ntype; -}; - - + node_type_base(&ntype, CMP_NODE_RGBTOBW, "RGB to BW", NODE_CLASS_CONVERTOR, 0, + cmp_node_rgbtobw_in, cmp_node_rgbtobw_out); + node_type_size(&ntype, 80, 40, 120); + node_type_exec(&ntype, node_composit_exec_rgbtobw); + + nodeRegisterType(lb, &ntype); +} diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_value.c b/source/blender/nodes/intern/CMP_nodes/CMP_value.c index a37742c77e9..787c9135898 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_value.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_value.c @@ -42,20 +42,16 @@ static void node_composit_exec_value(void *UNUSED(data), bNode *node, bNodeStack out[0]->vec[0]= sock->ns.vec[0]; } -bNodeType cmp_node_value= { - /* *next,*prev */ NULL, NULL, - /* type code */ CMP_NODE_VALUE, - /* name */ "Value", - /* width+range */ 80, 40, 120, - /* class+opts */ NODE_CLASS_INPUT, NODE_OPTIONS, - /* input sock */ NULL, - /* output sock */ cmp_node_value_out, - /* storage */ "", - /* execfunc */ node_composit_exec_value, - /* butfunc */ NULL, - /* initfunc */ NULL, - /* freestoragefunc */ NULL, - /* copystoragefunc */ NULL, - /* id */ NULL -}; +void register_node_type_cmp_value(ListBase *lb) +{ + static bNodeType ntype; + + node_type_base(&ntype, CMP_NODE_VALUE, "Value", NODE_CLASS_INPUT, NODE_OPTIONS, + NULL, cmp_node_value_out); + node_type_size(&ntype, 80, 40, 120); + node_type_exec(&ntype, node_composit_exec_value); + + nodeRegisterType(lb, &ntype); +} + diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_vecBlur.c b/source/blender/nodes/intern/CMP_nodes/CMP_vecBlur.c index 9ea626e39d6..71c8c48db7a 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_vecBlur.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_vecBlur.c @@ -91,20 +91,18 @@ static void node_composit_init_vecblur(bNode* node) }; /* custom1: itterations, custom2: maxspeed (0 = nolimit) */ -bNodeType cmp_node_vecblur= { - /* next, prev */ NULL, NULL, - /* type code */ CMP_NODE_VECBLUR, - /* name */ "Vector Blur", - /* width+range */ 120, 80, 200, - /* class+opts */ NODE_CLASS_OP_FILTER, NODE_OPTIONS, - /* input sock */ cmp_node_vecblur_in, - /* output sock */ cmp_node_vecblur_out, - /* storage */ "NodeBlurData", - /* execfunc */ node_composit_exec_vecblur, - /* butfunc */ NULL, - /* initfunc */ node_composit_init_vecblur, - /* freestoragefunc */ node_free_standard_storage, - /* copystoragefunc */ node_copy_standard_storage, - /* id */ NULL -}; +void register_node_type_cmp_vecblur(ListBase *lb) +{ + static bNodeType ntype; + + node_type_base(&ntype, CMP_NODE_VECBLUR, "Vector Blur", NODE_CLASS_OP_FILTER, NODE_OPTIONS, + cmp_node_vecblur_in, cmp_node_vecblur_out); + node_type_size(&ntype, 120, 80, 200); + node_type_init(&ntype, node_composit_init_vecblur); + node_type_storage(&ntype, "NodeBlurData", node_free_standard_storage, node_copy_standard_storage); + node_type_exec(&ntype, node_composit_exec_vecblur); + + nodeRegisterType(lb, &ntype); +} + diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_viewer.c b/source/blender/nodes/intern/CMP_nodes/CMP_viewer.c index 24d8a9eb09e..f23a82e1dc2 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_viewer.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_viewer.c @@ -128,21 +128,18 @@ static void node_composit_init_viewer(bNode* node) iuser->ok= 1; } -bNodeType cmp_node_viewer= { - /* *next,*prev */ NULL, NULL, - /* type code */ CMP_NODE_VIEWER, - /* name */ "Viewer", - /* width+range */ 80, 60, 200, - /* class+opts */ NODE_CLASS_OUTPUT, NODE_PREVIEW, - /* input sock */ cmp_node_viewer_in, - /* output sock */ NULL, - /* storage */ "ImageUser", - /* execfunc */ node_composit_exec_viewer, - /* butfunc */ NULL, - /* initfunc */ node_composit_init_viewer, - /* freestoragefunc */ node_free_standard_storage, - /* copystoragefunc */ node_copy_standard_storage, - /* id */ NULL - -}; +void register_node_type_cmp_viewer(ListBase *lb) +{ + static bNodeType ntype; + + node_type_base(&ntype, CMP_NODE_VIEWER, "Viewer", NODE_CLASS_OUTPUT, NODE_PREVIEW, + cmp_node_viewer_in, NULL); + node_type_size(&ntype, 80, 60, 200); + node_type_init(&ntype, node_composit_init_viewer); + node_type_storage(&ntype, "ImageUser", node_free_standard_storage, node_copy_standard_storage); + node_type_exec(&ntype, node_composit_exec_viewer); + + nodeRegisterType(lb, &ntype); +} + diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_zcombine.c b/source/blender/nodes/intern/CMP_nodes/CMP_zcombine.c index 17d88543698..675eae74a53 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_zcombine.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_zcombine.c @@ -219,20 +219,15 @@ static void node_composit_exec_zcombine(void *data, bNode *node, bNodeStack **in } -bNodeType cmp_node_zcombine= { - /* *next,*prev */ NULL, NULL, - /* type code */ CMP_NODE_ZCOMBINE, - /* name */ "Z Combine", - /* width+range */ 80, 40, 120, - /* class+opts */ NODE_CLASS_OP_COLOR, NODE_OPTIONS, - /* input sock */ cmp_node_zcombine_in, - /* output sock */ cmp_node_zcombine_out, - /* storage */ "", - /* execfunc */ node_composit_exec_zcombine, - /* butfunc */ NULL, - /* initfunc */ NULL, - /* freestoragefunc */ NULL, - /* copystoragefunc */ NULL, - /* id */ NULL - -}; +void register_node_type_cmp_zcombine(ListBase *lb) +{ + static bNodeType ntype; + + node_type_base(&ntype, CMP_NODE_ZCOMBINE, "Z Combine", NODE_CLASS_OP_COLOR, NODE_OPTIONS, + cmp_node_zcombine_in, cmp_node_zcombine_out); + node_type_size(&ntype, 80, 40, 120); + node_type_exec(&ntype, node_composit_exec_zcombine); + + nodeRegisterType(lb, &ntype); +} + diff --git a/source/blender/nodes/intern/CMP_util.h b/source/blender/nodes/intern/CMP_util.h index df583767f76..efb711ab416 100644 --- a/source/blender/nodes/intern/CMP_util.h +++ b/source/blender/nodes/intern/CMP_util.h @@ -59,6 +59,7 @@ #include "BKE_image.h" #include "BKE_main.h" #include "BKE_material.h" +#include "BKE_node.h" #include "BKE_texture.h" #include "BKE_library.h" diff --git a/source/blender/nodes/intern/SHD_nodes/SHD_camera.c b/source/blender/nodes/intern/SHD_nodes/SHD_camera.c index 869b1d1e54c..82c060ed1d6 100644 --- a/source/blender/nodes/intern/SHD_nodes/SHD_camera.c +++ b/source/blender/nodes/intern/SHD_nodes/SHD_camera.c @@ -54,21 +54,18 @@ static int gpu_shader_camera(GPUMaterial *mat, bNode *UNUSED(node), GPUNodeStack return GPU_stack_link(mat, "camera", in, out, GPU_builtin(GPU_VIEW_POSITION)); } -bNodeType sh_node_camera= { - /* *next,*prev */ NULL, NULL, - /* type code */ SH_NODE_CAMERA, - /* name */ "Camera Data", - /* width+range */ 95, 95, 120, - /* class+opts */ NODE_CLASS_INPUT, 0, - /* input sock */ NULL, - /* output sock */ sh_node_camera_out, - /* storage */ "node_camera", - /* execfunc */ node_shader_exec_camera, - /* butfunc */ NULL, - /* initfunc */ NULL, - /* freestoragefunc */ NULL, - /* copystoragefunc */ NULL, - /* id */ NULL, NULL, NULL, - /* gpufunc */ gpu_shader_camera -}; +void register_node_type_sh_camera(ListBase *lb) +{ + static bNodeType ntype; + + node_type_base(&ntype, SH_NODE_CAMERA, "Camera Data", NODE_CLASS_INPUT, 0, + NULL, sh_node_camera_out); + node_type_size(&ntype, 95, 95, 120); + node_type_storage(&ntype, "node_camera", NULL, NULL); + node_type_exec(&ntype, node_shader_exec_camera); + node_type_gpu(&ntype, gpu_shader_camera); + + nodeRegisterType(lb, &ntype); +} + diff --git a/source/blender/nodes/intern/SHD_nodes/SHD_curves.c b/source/blender/nodes/intern/SHD_nodes/SHD_curves.c index 56aaa4fe8a7..405c455501c 100644 --- a/source/blender/nodes/intern/SHD_nodes/SHD_curves.c +++ b/source/blender/nodes/intern/SHD_nodes/SHD_curves.c @@ -66,24 +66,21 @@ static int gpu_shader_curve_vec(GPUMaterial *mat, bNode *node, GPUNodeStack *in, return GPU_stack_link(mat, "curves_vec", in, out, GPU_texture(size, array)); } -bNodeType sh_node_curve_vec= { - /* *next,*prev */ NULL, NULL, - /* type code */ SH_NODE_CURVE_VEC, - /* name */ "Vector Curves", - /* width+range */ 200, 140, 320, - /* class+opts */ NODE_CLASS_OP_VECTOR, NODE_OPTIONS, - /* input sock */ sh_node_curve_vec_in, - /* output sock */ sh_node_curve_vec_out, - /* storage */ "CurveMapping", - /* execfunc */ node_shader_exec_curve_vec, - /* butfunc */ NULL, - /* initfunc */ node_shader_init_curve_vec, - /* freestoragefunc */ node_free_curves, - /* copystoragefunc */ node_copy_curves, - /* id */ NULL, NULL, NULL, - /* gpufunc */ gpu_shader_curve_vec - -}; +void register_node_type_sh_curve_vec(ListBase *lb) +{ + static bNodeType ntype; + + node_type_base(&ntype, SH_NODE_CURVE_VEC, "Vector Curves", NODE_CLASS_OP_VECTOR, NODE_OPTIONS, + sh_node_curve_vec_in, sh_node_curve_vec_out); + node_type_size(&ntype, 200, 140, 320); + node_type_init(&ntype, node_shader_init_curve_vec); + node_type_storage(&ntype, "CurveMapping", node_free_curves, node_copy_curves); + node_type_exec(&ntype, node_shader_exec_curve_vec); + node_type_gpu(&ntype, gpu_shader_curve_vec); + + nodeRegisterType(lb, &ntype); +} + /* **************** CURVE RGB ******************** */ static bNodeSocketType sh_node_curve_rgb_in[]= { @@ -123,21 +120,18 @@ static int gpu_shader_curve_rgb(GPUMaterial *mat, bNode *node, GPUNodeStack *in, return GPU_stack_link(mat, "curves_rgb", in, out, GPU_texture(size, array)); } -bNodeType sh_node_curve_rgb= { - /* *next,*prev */ NULL, NULL, - /* type code */ SH_NODE_CURVE_RGB, - /* name */ "RGB Curves", - /* width+range */ 200, 140, 320, - /* class+opts */ NODE_CLASS_OP_COLOR, NODE_OPTIONS, - /* input sock */ sh_node_curve_rgb_in, - /* output sock */ sh_node_curve_rgb_out, - /* storage */ "CurveMapping", - /* execfunc */ node_shader_exec_curve_rgb, - /* butfunc */ NULL, - /* initfunc */ node_shader_init_curve_rgb, - /* freestoragefunc */ node_free_curves, - /* copystoragefunc */ node_copy_curves, - /* id */ NULL, NULL, NULL, - /* gpufunc */ gpu_shader_curve_rgb -}; +void register_node_type_sh_curve_rgb(ListBase *lb) +{ + static bNodeType ntype; + + node_type_base(&ntype, SH_NODE_CURVE_RGB, "RGB Curves", NODE_CLASS_OP_COLOR, NODE_OPTIONS, + sh_node_curve_rgb_in, sh_node_curve_rgb_out); + node_type_size(&ntype, 200, 140, 320); + node_type_init(&ntype, node_shader_init_curve_rgb); + node_type_storage(&ntype, "CurveMapping", node_free_curves, node_copy_curves); + node_type_exec(&ntype, node_shader_exec_curve_rgb); + node_type_gpu(&ntype, gpu_shader_curve_rgb); + + nodeRegisterType(lb, &ntype); +} diff --git a/source/blender/nodes/intern/SHD_nodes/SHD_dynamic.c b/source/blender/nodes/intern/SHD_nodes/SHD_dynamic.c index 7975c081880..315655d68bf 100644 --- a/source/blender/nodes/intern/SHD_nodes/SHD_dynamic.c +++ b/source/blender/nodes/intern/SHD_nodes/SHD_dynamic.c @@ -758,26 +758,29 @@ static void node_dynamic_exec_cb(void *data, bNode *node, bNodeStack **in, bNode #endif } -bNodeType node_dynamic_typeinfo = { - /* next, prev */ NULL, NULL, - /* type code */ NODE_DYNAMIC, - /* name */ "Dynamic", - /* width+range */ 150, 60, 300, - /* class+opts */ NODE_CLASS_OP_DYNAMIC, NODE_OPTIONS, - /* input sock */ NULL, - /* output sock */ NULL, - /* storage */ "NodeScriptDict", - /* execfunc */ node_dynamic_exec_cb, - /* butfunc */ NULL, - /* initfunc */ node_dynamic_init_cb, - /* freefunc */ node_dynamic_free_storage_cb, - /* copyfunc */ node_dynamic_copy_cb, - /* id */ NULL -}; +void register_node_type_sh_dynamic(ListBase *lb) +{ + static bNodeType ntype; + + node_type_base(&ntype, SH_NODE_DYNAMIC, "Dynamic", NODE_CLASS_OP_DYNAMIC, NODE_OPTIONS, NULL, NULL); + node_type_size(&ntype, 150, 60, 300); + node_type_init(&ntype, node_dynamic_init_cb); + node_type_storage(&ntype, "NodeScriptDict", node_dynamic_free_storage_cb, node_dynamic_copy_cb); + node_type_exec(&ntype, node_dynamic_exec_cb); + + nodeRegisterType(lb, &ntype); +} #else -bNodeType node_dynamic_typeinfo = {NULL}; +void register_node_type_sh_dynamic(ListBase *lb) +{ + static bNodeType ntype; + + node_type_base(&ntype, 0, "", 0, 0, NULL, NULL); + + nodeRegisterType(lb, &ntype); +} #endif diff --git a/source/blender/nodes/intern/SHD_nodes/SHD_geom.c b/source/blender/nodes/intern/SHD_nodes/SHD_geom.c index a27918df275..32fe457c2d8 100644 --- a/source/blender/nodes/intern/SHD_nodes/SHD_geom.c +++ b/source/blender/nodes/intern/SHD_nodes/SHD_geom.c @@ -131,21 +131,18 @@ static int gpu_shader_geom(GPUMaterial *mat, bNode *node, GPUNodeStack *in, GPUN } /* node type definition */ -bNodeType sh_node_geom= { - /* *next,*prev */ NULL, NULL, - /* type code */ SH_NODE_GEOMETRY, - /* name */ "Geometry", - /* width+range */ 120, 80, 160, - /* class+opts */ NODE_CLASS_INPUT, NODE_OPTIONS, - /* input sock */ NULL, - /* output sock */ sh_node_geom_out, - /* storage */ "NodeGeometry", - /* execfunc */ node_shader_exec_geom, - /* butfunc */ NULL, - /* initfunc */ node_shader_init_geometry, - /* freestoragefunc */ node_free_standard_storage, - /* copystoragefunc */ node_copy_standard_storage, - /* id */ NULL, NULL, NULL, - /* gpufunc */ gpu_shader_geom - -}; +void register_node_type_sh_geom(ListBase *lb) +{ + static bNodeType ntype; + + node_type_base(&ntype, SH_NODE_GEOMETRY, "Geometry", NODE_CLASS_INPUT, NODE_OPTIONS, + NULL, sh_node_geom_out); + node_type_size(&ntype, 120, 80, 160); + node_type_init(&ntype, node_shader_init_geometry); + node_type_storage(&ntype, "NodeGeometry", node_free_standard_storage, node_copy_standard_storage); + node_type_exec(&ntype, node_shader_exec_geom); + node_type_gpu(&ntype, gpu_shader_geom); + + nodeRegisterType(lb, &ntype); +} + diff --git a/source/blender/nodes/intern/SHD_nodes/SHD_hueSatVal.c b/source/blender/nodes/intern/SHD_nodes/SHD_hueSatVal.c index 5c95577e32d..6fd8ece8ec9 100644 --- a/source/blender/nodes/intern/SHD_nodes/SHD_hueSatVal.c +++ b/source/blender/nodes/intern/SHD_nodes/SHD_hueSatVal.c @@ -77,23 +77,18 @@ static int gpu_shader_hue_sat(GPUMaterial *mat, bNode *UNUSED(node), GPUNodeStac return GPU_stack_link(mat, "hue_sat", in, out); } -bNodeType sh_node_hue_sat= { - /* *next,*prev */ NULL, NULL, - /* type code */ SH_NODE_HUE_SAT, - /* name */ "Hue Saturation Value", - /* width+range */ 150, 80, 250, - /* class+opts */ NODE_CLASS_OP_COLOR, NODE_OPTIONS, - /* input sock */ sh_node_hue_sat_in, - /* output sock */ sh_node_hue_sat_out, - /* storage */ "", - /* execfunc */ node_shader_exec_hue_sat, - /* butfunc */ NULL, - /* initfunc */ NULL, - /* freestoragefunc */ NULL, - /* copystoragefunc */ NULL, - /* id */ NULL, NULL, NULL, - /* gpufunc */ gpu_shader_hue_sat - -}; +void register_node_type_sh_hue_sat(ListBase *lb) +{ + static bNodeType ntype; + + node_type_base(&ntype, SH_NODE_HUE_SAT, "Hue Saturation Value", NODE_CLASS_OP_COLOR, NODE_OPTIONS, + sh_node_hue_sat_in, sh_node_hue_sat_out); + node_type_size(&ntype, 150, 80, 250); + node_type_exec(&ntype, node_shader_exec_hue_sat); + node_type_gpu(&ntype, gpu_shader_hue_sat); + + nodeRegisterType(lb, &ntype); +} + diff --git a/source/blender/nodes/intern/SHD_nodes/SHD_invert.c b/source/blender/nodes/intern/SHD_nodes/SHD_invert.c index 73fccf7cd0b..9929afd0bc1 100644 --- a/source/blender/nodes/intern/SHD_nodes/SHD_invert.c +++ b/source/blender/nodes/intern/SHD_nodes/SHD_invert.c @@ -69,21 +69,17 @@ static int gpu_shader_invert(GPUMaterial *mat, bNode *UNUSED(node), GPUNodeStack return GPU_stack_link(mat, "invert", in, out); } -bNodeType sh_node_invert= { - /* *next,*prev */ NULL, NULL, - /* type code */ SH_NODE_INVERT, - /* name */ "Invert", - /* width+range */ 90, 80, 100, - /* class+opts */ NODE_CLASS_OP_COLOR, NODE_OPTIONS, - /* input sock */ sh_node_invert_in, - /* output sock */ sh_node_invert_out, - /* storage */ "", - /* execfunc */ node_shader_exec_invert, - /* butfunc */ NULL, - /* initfunc */ NULL, - /* freestoragefunc */ NULL, - /* copystoragefunc */ NULL, - /* id */ NULL, NULL, NULL, - /* gpufunc */ gpu_shader_invert -}; +void register_node_type_sh_invert(ListBase *lb) +{ + static bNodeType ntype; + + node_type_base(&ntype, SH_NODE_INVERT, "Invert", NODE_CLASS_OP_COLOR, NODE_OPTIONS, + sh_node_invert_in, sh_node_invert_out); + node_type_size(&ntype, 90, 80, 100); + node_type_exec(&ntype, node_shader_exec_invert); + node_type_gpu(&ntype, gpu_shader_invert); + + nodeRegisterType(lb, &ntype); +} + diff --git a/source/blender/nodes/intern/SHD_nodes/SHD_mapping.c b/source/blender/nodes/intern/SHD_nodes/SHD_mapping.c index f01ed3d7ab8..f11200cfc7e 100644 --- a/source/blender/nodes/intern/SHD_nodes/SHD_mapping.c +++ b/source/blender/nodes/intern/SHD_nodes/SHD_mapping.c @@ -83,22 +83,17 @@ static int gpu_shader_mapping(GPUMaterial *mat, bNode *node, GPUNodeStack *in, G return GPU_stack_link(mat, "mapping", in, out, tmat, tmin, tmax, tdomin, tdomax); } -bNodeType sh_node_mapping= { - /* *next,*prev */ NULL, NULL, - /* type code */ SH_NODE_MAPPING, - /* name */ "Mapping", - /* width+range */ 240, 160, 320, - /* class+opts */ NODE_CLASS_OP_VECTOR, NODE_OPTIONS, - /* input sock */ sh_node_mapping_in, - /* output sock */ sh_node_mapping_out, - /* storage */ "TexMapping", - /* execfunc */ node_shader_exec_mapping, - /* butfunc */ NULL, - /* initfunc */ node_shader_init_mapping, - /* freestoragefunc */ node_free_standard_storage, - /* copystoragefunc */ node_copy_standard_storage, - /* id */ NULL, NULL, NULL, - /* gpufunc */ gpu_shader_mapping +void register_node_type_sh_mapping(ListBase *lb) +{ + static bNodeType ntype; -}; - + node_type_base(&ntype, SH_NODE_MAPPING, "Mapping", NODE_CLASS_OP_VECTOR, NODE_OPTIONS, + sh_node_mapping_in, sh_node_mapping_out); + node_type_size(&ntype, 240, 160, 320); + node_type_init(&ntype, node_shader_init_mapping); + node_type_storage(&ntype, "TexMapping", node_free_standard_storage, node_copy_standard_storage); + node_type_exec(&ntype, node_shader_exec_mapping); + node_type_gpu(&ntype, gpu_shader_mapping); + + nodeRegisterType(lb, &ntype); +} diff --git a/source/blender/nodes/intern/SHD_nodes/SHD_material.c b/source/blender/nodes/intern/SHD_nodes/SHD_material.c index 3481e7d793e..4984a1ca821 100644 --- a/source/blender/nodes/intern/SHD_nodes/SHD_material.c +++ b/source/blender/nodes/intern/SHD_nodes/SHD_material.c @@ -267,39 +267,33 @@ static int gpu_shader_material(GPUMaterial *mat, bNode *node, GPUNodeStack *in, return 0; } -bNodeType sh_node_material= { - /* *next,*prev */ NULL, NULL, - /* type code */ SH_NODE_MATERIAL, - /* name */ "Material", - /* width+range */ 120, 80, 240, - /* class+opts */ NODE_CLASS_INPUT, NODE_OPTIONS|NODE_PREVIEW, - /* input sock */ sh_node_material_in, - /* output sock */ sh_node_material_out, - /* storage */ "", - /* execfunc */ node_shader_exec_material, - /* butfunc */ NULL, - /* initfunc */ node_shader_init_material, - /* freestoragefunc */ NULL, - /* copystoragefunc */ NULL, - /* id */ NULL, NULL, NULL, - /* gpufunc */ gpu_shader_material -}; +void register_node_type_sh_material(ListBase *lb) +{ + static bNodeType ntype; + + node_type_base(&ntype, SH_NODE_MATERIAL, "Material", NODE_CLASS_INPUT, NODE_OPTIONS|NODE_PREVIEW, + sh_node_material_in, sh_node_material_out); + node_type_size(&ntype, 120, 80, 240); + node_type_init(&ntype, node_shader_init_material); + node_type_exec(&ntype, node_shader_exec_material); + node_type_gpu(&ntype, gpu_shader_material); + + nodeRegisterType(lb, &ntype); +} + + +void register_node_type_sh_material_ext(ListBase *lb) +{ + static bNodeType ntype; + + node_type_base(&ntype, SH_NODE_MATERIAL_EXT, "Extended Material", NODE_CLASS_INPUT, NODE_OPTIONS|NODE_PREVIEW, + sh_node_material_ext_in, sh_node_material_ext_out); + node_type_size(&ntype, 120, 80, 240); + node_type_init(&ntype, node_shader_init_material); + node_type_exec(&ntype, node_shader_exec_material); + node_type_gpu(&ntype, gpu_shader_material); + + nodeRegisterType(lb, &ntype); +} -bNodeType sh_node_material_ext= { - /* *next,*prev */ NULL, NULL, - /* type code */ SH_NODE_MATERIAL_EXT, - /* name */ "Extended Material", - /* width+range */ 120, 80, 240, - /* class+opts */ NODE_CLASS_INPUT, NODE_OPTIONS|NODE_PREVIEW, - /* input sock */ sh_node_material_ext_in, - /* output sock */ sh_node_material_ext_out, - /* storage */ "", - /* execfunc */ node_shader_exec_material, - /* butfunc */ NULL, - /* initfunc */ node_shader_init_material, - /* freestoragefunc */ NULL, - /* copystoragefunc */ NULL, - /* id */ NULL, NULL, NULL, - /* gpufunc */ gpu_shader_material -}; diff --git a/source/blender/nodes/intern/SHD_nodes/SHD_math.c b/source/blender/nodes/intern/SHD_nodes/SHD_math.c index 4ca11fb29e3..ba2ee6d066a 100644 --- a/source/blender/nodes/intern/SHD_nodes/SHD_math.c +++ b/source/blender/nodes/intern/SHD_nodes/SHD_math.c @@ -30,7 +30,6 @@ #include "../SHD_util.h" - /* **************** SCALAR MATH ******************** */ static bNodeSocketType sh_node_math_in[]= { { SOCK_VALUE, 1, "Value", 0.5f, 0.5f, 0.5f, 1.0f, -100.0f, 100.0f}, @@ -234,21 +233,19 @@ static int gpu_shader_math(GPUMaterial *mat, bNode *node, GPUNodeStack *in, GPUN return 1; } -bNodeType sh_node_math= { - /* *next,*prev */ NULL, NULL, - /* type code */ SH_NODE_MATH, - /* name */ "Math", - /* width+range */ 120, 110, 160, - /* class+opts */ NODE_CLASS_CONVERTOR, NODE_OPTIONS, - /* input sock */ sh_node_math_in, - /* output sock */ sh_node_math_out, - /* storage */ "node_math", - /* execfunc */ node_shader_exec_math, - /* butfunc */ NULL, - /* initfunc */ NULL, - /* freestoragefunc */ NULL, - /* copystoragefunc */ NULL, - /* id */ NULL, NULL, NULL, - /* gpufunc */ gpu_shader_math -}; +void register_node_type_sh_math(ListBase *lb) +{ + static bNodeType ntype; + + node_type_base(&ntype, SH_NODE_MATH, "Math", NODE_CLASS_CONVERTOR, NODE_OPTIONS, + sh_node_math_in, sh_node_math_out); + node_type_size(&ntype, 120, 110, 160); + node_type_label(&ntype, node_math_label); + node_type_storage(&ntype, "node_math", NULL, NULL); + node_type_exec(&ntype, node_shader_exec_math); + node_type_gpu(&ntype, gpu_shader_math); + + nodeRegisterType(lb, &ntype); +} + diff --git a/source/blender/nodes/intern/SHD_nodes/SHD_mixRgb.c b/source/blender/nodes/intern/SHD_nodes/SHD_mixRgb.c index 4975c6b9b59..eac3c60655a 100644 --- a/source/blender/nodes/intern/SHD_nodes/SHD_mixRgb.c +++ b/source/blender/nodes/intern/SHD_nodes/SHD_mixRgb.c @@ -29,7 +29,6 @@ #include "../SHD_util.h" - /* **************** MIX RGB ******************** */ static bNodeSocketType sh_node_mix_rgb_in[]= { { SOCK_VALUE, 1, "Fac", 0.5f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, @@ -71,21 +70,17 @@ static int gpu_shader_mix_rgb(GPUMaterial *mat, bNode *node, GPUNodeStack *in, G } -bNodeType sh_node_mix_rgb= { - /* *next,*prev */ NULL, NULL, - /* type code */ SH_NODE_MIX_RGB, - /* name */ "Mix", - /* width+range */ 100, 60, 150, - /* class+opts */ NODE_CLASS_OP_COLOR, NODE_OPTIONS, - /* input sock */ sh_node_mix_rgb_in, - /* output sock */ sh_node_mix_rgb_out, - /* storage */ "", - /* execfunc */ node_shader_exec_mix_rgb, - /* butfunc */ NULL, - /* initfunc */ NULL, - /* freestoragefunc */ NULL, - /* copystoragefunc */ NULL, - /* id */ NULL, NULL, NULL, - /* gpufunc */ gpu_shader_mix_rgb - -}; +void register_node_type_sh_mix_rgb(ListBase *lb) +{ + static bNodeType ntype; + + node_type_base(&ntype, SH_NODE_MIX_RGB, "Mix", NODE_CLASS_OP_COLOR, NODE_OPTIONS, + sh_node_mix_rgb_in, sh_node_mix_rgb_out); + node_type_size(&ntype, 100, 60, 150); + node_type_label(&ntype, node_blend_label); + node_type_exec(&ntype, node_shader_exec_mix_rgb); + node_type_gpu(&ntype, gpu_shader_mix_rgb); + + nodeRegisterType(lb, &ntype); +} + diff --git a/source/blender/nodes/intern/SHD_nodes/SHD_normal.c b/source/blender/nodes/intern/SHD_nodes/SHD_normal.c index 8054f184cea..ccbf80edeb7 100644 --- a/source/blender/nodes/intern/SHD_nodes/SHD_normal.c +++ b/source/blender/nodes/intern/SHD_nodes/SHD_normal.c @@ -65,21 +65,14 @@ static int gpu_shader_normal(GPUMaterial *mat, bNode *node, GPUNodeStack *in, GP return GPU_stack_link(mat, "normal", in, out, vec); } -bNodeType sh_node_normal= { - /* *next,*prev */ NULL, NULL, - /* type code */ SH_NODE_NORMAL, - /* name */ "Normal", - /* width+range */ 100, 60, 200, - /* class+opts */ NODE_CLASS_OP_VECTOR, NODE_OPTIONS, - /* input sock */ sh_node_normal_in, - /* output sock */ sh_node_normal_out, - /* storage */ "", - /* execfunc */ node_shader_exec_normal, - /* butfunc */ NULL, - /* initfunc */ NULL, - /* freestoragefunc */ NULL, - /* copystoragefunc */ NULL, - /* id */ NULL, NULL, NULL, - /* gpufunc */ gpu_shader_normal -}; - +void register_node_type_sh_normal(ListBase *lb) +{ + static bNodeType ntype; + + node_type_base(&ntype, SH_NODE_NORMAL, "Normal", NODE_CLASS_OP_VECTOR, NODE_OPTIONS, + sh_node_normal_in, sh_node_normal_out); + node_type_exec(&ntype, node_shader_exec_normal); + node_type_gpu(&ntype, gpu_shader_normal); + + nodeRegisterType(lb, &ntype); +} diff --git a/source/blender/nodes/intern/SHD_nodes/SHD_output.c b/source/blender/nodes/intern/SHD_nodes/SHD_output.c index 4395716e599..d61e9def144 100644 --- a/source/blender/nodes/intern/SHD_nodes/SHD_output.c +++ b/source/blender/nodes/intern/SHD_nodes/SHD_output.c @@ -75,22 +75,17 @@ static int gpu_shader_output(GPUMaterial *mat, bNode *UNUSED(node), GPUNodeStack return 1; } -bNodeType sh_node_output= { - /* *next,*prev */ NULL, NULL, - /* type code */ SH_NODE_OUTPUT, - /* name */ "Output", - /* width+range */ 80, 60, 200, - /* class+opts */ NODE_CLASS_OUTPUT, NODE_PREVIEW, - /* input sock */ sh_node_output_in, - /* output sock */ NULL, - /* storage */ "", - /* execfunc */ node_shader_exec_output, - /* butfunc */ NULL, - /* initfunc */ NULL, - /* freestoragefunc */ NULL, - /* copystoragefunc */ NULL, - /* id */ NULL, NULL, NULL, - /* gpufunc */ gpu_shader_output - -}; +void register_node_type_sh_output(ListBase *lb) +{ + static bNodeType ntype; + + node_type_base(&ntype, SH_NODE_OUTPUT, "Output", NODE_CLASS_OUTPUT, NODE_PREVIEW, + sh_node_output_in, NULL); + node_type_size(&ntype, 80, 60, 200); + node_type_exec(&ntype, node_shader_exec_output); + node_type_gpu(&ntype, gpu_shader_output); + + nodeRegisterType(lb, &ntype); +} + diff --git a/source/blender/nodes/intern/SHD_nodes/SHD_rgb.c b/source/blender/nodes/intern/SHD_nodes/SHD_rgb.c index 600518962ab..109147c7d45 100644 --- a/source/blender/nodes/intern/SHD_nodes/SHD_rgb.c +++ b/source/blender/nodes/intern/SHD_nodes/SHD_rgb.c @@ -50,21 +50,16 @@ static int gpu_shader_rgb(GPUMaterial *mat, bNode *node, GPUNodeStack *in, GPUNo return GPU_stack_link(mat, "set_rgba", in, out, vec); } -bNodeType sh_node_rgb= { - /* *next,*prev */ NULL, NULL, - /* type code */ SH_NODE_RGB, - /* name */ "RGB", - /* width+range */ 140, 80, 140, - /* class+opts */ NODE_CLASS_INPUT, NODE_OPTIONS, - /* input sock */ NULL, - /* output sock */ sh_node_rgb_out, - /* storage */ "", - /* execfunc */ node_shader_exec_rgb, - /* butfunc */ NULL, - /* initfunc */ NULL, - /* freestoragefunc */ NULL, - /* copystoragefunc */ NULL, - /* id */ NULL, NULL, NULL, - /* gpufunc */ gpu_shader_rgb - -}; +void register_node_type_sh_rgb(ListBase *lb) +{ + static bNodeType ntype; + + node_type_base(&ntype, SH_NODE_RGB, "RGB", NODE_CLASS_INPUT, NODE_OPTIONS, + NULL, sh_node_rgb_out); + node_type_size(&ntype, 140, 80, 140); + node_type_exec(&ntype, node_shader_exec_rgb); + node_type_gpu(&ntype, gpu_shader_rgb); + + nodeRegisterType(lb, &ntype); +} + diff --git a/source/blender/nodes/intern/SHD_nodes/SHD_sepcombRGB.c b/source/blender/nodes/intern/SHD_nodes/SHD_sepcombRGB.c index 1de200c7b1c..da4c7f70022 100644 --- a/source/blender/nodes/intern/SHD_nodes/SHD_sepcombRGB.c +++ b/source/blender/nodes/intern/SHD_nodes/SHD_sepcombRGB.c @@ -53,24 +53,19 @@ static int gpu_shader_seprgb(GPUMaterial *mat, bNode *UNUSED(node), GPUNodeStack return GPU_stack_link(mat, "separate_rgb", in, out); } -bNodeType sh_node_seprgb= { - /* *next,*prev */ NULL, NULL, - /* type code */ SH_NODE_SEPRGB, - /* name */ "Separate RGB", - /* width+range */ 80, 40, 140, - /* class+opts */ NODE_CLASS_CONVERTOR, 0, - /* input sock */ sh_node_seprgb_in, - /* output sock */ sh_node_seprgb_out, - /* storage */ "", - /* execfunc */ node_shader_exec_seprgb, - /* butfunc */ NULL, - /* initfunc */ NULL, - /* freestoragefunc */ NULL, - /* copystoragefunc */ NULL, - /* id */ NULL, NULL, NULL, - /* gpufunc */ gpu_shader_seprgb - -}; +void register_node_type_sh_seprgb(ListBase *lb) +{ + static bNodeType ntype; + + node_type_base(&ntype, SH_NODE_SEPRGB, "Separate RGB", NODE_CLASS_CONVERTOR, 0, + sh_node_seprgb_in, sh_node_seprgb_out); + node_type_size(&ntype, 80, 40, 140); + node_type_exec(&ntype, node_shader_exec_seprgb); + node_type_gpu(&ntype, gpu_shader_seprgb); + + nodeRegisterType(lb, &ntype); +} + /* **************** COMBINE RGB ******************** */ @@ -97,21 +92,16 @@ static int gpu_shader_combrgb(GPUMaterial *mat, bNode *UNUSED(node), GPUNodeStac return GPU_stack_link(mat, "combine_rgb", in, out); } -bNodeType sh_node_combrgb= { - /* *next,*prev */ NULL, NULL, - /* type code */ SH_NODE_COMBRGB, - /* name */ "Combine RGB", - /* width+range */ 80, 40, 140, - /* class+opts */ NODE_CLASS_CONVERTOR, NODE_OPTIONS, - /* input sock */ sh_node_combrgb_in, - /* output sock */ sh_node_combrgb_out, - /* storage */ "", - /* execfunc */ node_shader_exec_combrgb, - /* butfunc */ NULL, - /* initfunc */ NULL, - /* freestoragefunc */ NULL, - /* copystoragefunc */ NULL, - /* id */ NULL, NULL, NULL, - /* gpufunc */ gpu_shader_combrgb - -}; +void register_node_type_sh_combrgb(ListBase *lb) +{ + static bNodeType ntype; + + node_type_base(&ntype, SH_NODE_COMBRGB, "Combine RGB", NODE_CLASS_CONVERTOR, NODE_OPTIONS, + sh_node_combrgb_in, sh_node_combrgb_out); + node_type_size(&ntype, 80, 40, 140); + node_type_exec(&ntype, node_shader_exec_combrgb); + node_type_gpu(&ntype, gpu_shader_combrgb); + + nodeRegisterType(lb, &ntype); +} + diff --git a/source/blender/nodes/intern/SHD_nodes/SHD_squeeze.c b/source/blender/nodes/intern/SHD_nodes/SHD_squeeze.c index 06b06affaa0..ff6e3913d19 100644 --- a/source/blender/nodes/intern/SHD_nodes/SHD_squeeze.c +++ b/source/blender/nodes/intern/SHD_nodes/SHD_squeeze.c @@ -59,21 +59,18 @@ static int gpu_shader_squeeze(GPUMaterial *mat, bNode *UNUSED(node), GPUNodeStac return GPU_stack_link(mat, "squeeze", in, out); } -bNodeType sh_node_squeeze= { - /* *next,*prev */ NULL, NULL, - /* type code */ SH_NODE_SQUEEZE, - /* name */ "Squeeze Value", - /* width+range */ 120, 110, 160, - /* class+opts */ NODE_CLASS_CONVERTOR, NODE_OPTIONS, - /* input sock */ sh_node_squeeze_in, - /* output sock */ sh_node_squeeze_out, - /* storage */ "node_squeeze", - /* execfunc */ node_shader_exec_squeeze, - /* butfunc */ NULL, - /* initfunc */ NULL, - /* freestoragefunc */ NULL, - /* copystoragefunc */ NULL, - /* id */ NULL, NULL, NULL, - /* gpufunc */ gpu_shader_squeeze -}; +void register_node_type_sh_squeeze(ListBase *lb) +{ + static bNodeType ntype; + + node_type_base(&ntype, SH_NODE_SQUEEZE, "Squeeze Value", NODE_CLASS_CONVERTOR, NODE_OPTIONS, + sh_node_squeeze_in, sh_node_squeeze_out); + node_type_size(&ntype, 120, 110, 160); + node_type_storage(&ntype, "node_squeeze", NULL, NULL); + node_type_exec(&ntype, node_shader_exec_squeeze); + node_type_gpu(&ntype, gpu_shader_squeeze); + + nodeRegisterType(lb, &ntype); +} + diff --git a/source/blender/nodes/intern/SHD_nodes/SHD_texture.c b/source/blender/nodes/intern/SHD_nodes/SHD_texture.c index ee73fac4c7e..ec36dd8043e 100644 --- a/source/blender/nodes/intern/SHD_nodes/SHD_texture.c +++ b/source/blender/nodes/intern/SHD_nodes/SHD_texture.c @@ -128,22 +128,17 @@ static int gpu_shader_texture(GPUMaterial *mat, bNode *node, GPUNodeStack *in, G return 0; } -bNodeType sh_node_texture= { - /* *next,*prev */ NULL, NULL, - /* type code */ SH_NODE_TEXTURE, - /* name */ "Texture", - /* width+range */ 120, 80, 240, - /* class+opts */ NODE_CLASS_INPUT, NODE_OPTIONS|NODE_PREVIEW, - /* input sock */ sh_node_texture_in, - /* output sock */ sh_node_texture_out, - /* storage */ "", - /* execfunc */ node_shader_exec_texture, - /* butfunc */ NULL, - /* initfunc */ NULL, - /* freestoragefunc */ NULL, - /* copystoragefunc */ NULL, - /* id */ NULL, NULL, NULL, - /* gpufunc */ gpu_shader_texture - -}; +void register_node_type_sh_texture(ListBase *lb) +{ + static bNodeType ntype; + + node_type_base(&ntype, SH_NODE_TEXTURE, "Texture", NODE_CLASS_INPUT, NODE_OPTIONS|NODE_PREVIEW, + sh_node_texture_in, sh_node_texture_out); + node_type_size(&ntype, 120, 80, 240); + node_type_exec(&ntype, node_shader_exec_texture); + node_type_gpu(&ntype, gpu_shader_texture); + + nodeRegisterType(lb, &ntype); +} + diff --git a/source/blender/nodes/intern/SHD_nodes/SHD_valToRgb.c b/source/blender/nodes/intern/SHD_nodes/SHD_valToRgb.c index 1e5b9cf935e..8603ec018d6 100644 --- a/source/blender/nodes/intern/SHD_nodes/SHD_valToRgb.c +++ b/source/blender/nodes/intern/SHD_nodes/SHD_valToRgb.c @@ -68,24 +68,21 @@ static int gpu_shader_valtorgb(GPUMaterial *mat, bNode *node, GPUNodeStack *in, return GPU_stack_link(mat, "valtorgb", in, out, GPU_texture(size, array)); } -bNodeType sh_node_valtorgb= { - /* *next,*prev */ NULL, NULL, - /* type code */ SH_NODE_VALTORGB, - /* name */ "ColorRamp", - /* width+range */ 240, 200, 300, - /* class+opts */ NODE_CLASS_CONVERTOR, NODE_OPTIONS, - /* input sock */ sh_node_valtorgb_in, - /* output sock */ sh_node_valtorgb_out, - /* storage */ "ColorBand", - /* execfunc */ node_shader_exec_valtorgb, - /* butfunc */ NULL, - /* initfunc */ node_shader_init_valtorgb, - /* freestoragefunc */ node_free_standard_storage, - /* copystoragefunc */ node_copy_standard_storage, - /* id */ NULL, NULL, NULL, - /* gpufunc */ gpu_shader_valtorgb - -}; +void register_node_type_sh_valtorgb(ListBase *lb) +{ + static bNodeType ntype; + + node_type_base(&ntype, SH_NODE_VALTORGB, "ColorRamp", NODE_CLASS_CONVERTOR, NODE_OPTIONS, + sh_node_valtorgb_in, sh_node_valtorgb_out); + node_type_size(&ntype, 240, 200, 300); + node_type_init(&ntype, node_shader_init_valtorgb); + node_type_storage(&ntype, "ColorBand", node_free_standard_storage, node_copy_standard_storage); + node_type_exec(&ntype, node_shader_exec_valtorgb); + node_type_gpu(&ntype, gpu_shader_valtorgb); + + nodeRegisterType(lb, &ntype); +} + /* **************** RGBTOBW ******************** */ static bNodeSocketType sh_node_rgbtobw_in[]= { @@ -111,22 +108,17 @@ static int gpu_shader_rgbtobw(GPUMaterial *mat, bNode *UNUSED(node), GPUNodeStac return GPU_stack_link(mat, "rgbtobw", in, out); } -bNodeType sh_node_rgbtobw= { - /* *next,*prev */ NULL, NULL, - /* type code */ SH_NODE_RGBTOBW, - /* name */ "RGB to BW", - /* width+range */ 80, 40, 120, - /* class+opts */ NODE_CLASS_CONVERTOR, 0, - /* input sock */ sh_node_rgbtobw_in, - /* output sock */ sh_node_rgbtobw_out, - /* storage */ "", - /* execfunc */ node_shader_exec_rgbtobw, - /* butfunc */ NULL, - /* initfunc */ NULL, - /* freestoragefunc */ NULL, - /* copystoragefunc */ NULL, - /* id */ NULL, NULL, NULL, - /* gpufunc */ gpu_shader_rgbtobw +void register_node_type_sh_rgbtobw(ListBase *lb) +{ + static bNodeType ntype; + + node_type_base(&ntype, SH_NODE_RGBTOBW, "RGB to BW", NODE_CLASS_CONVERTOR, 0, + sh_node_rgbtobw_in, sh_node_rgbtobw_out); + node_type_size(&ntype, 80, 40, 120); + node_type_exec(&ntype, node_shader_exec_rgbtobw); + node_type_gpu(&ntype, gpu_shader_rgbtobw); + + nodeRegisterType(lb, &ntype); +} -}; diff --git a/source/blender/nodes/intern/SHD_nodes/SHD_value.c b/source/blender/nodes/intern/SHD_nodes/SHD_value.c index f78480bd794..21c58419d9b 100644 --- a/source/blender/nodes/intern/SHD_nodes/SHD_value.c +++ b/source/blender/nodes/intern/SHD_nodes/SHD_value.c @@ -50,22 +50,17 @@ static int gpu_shader_value(GPUMaterial *mat, bNode *node, GPUNodeStack *in, GPU return GPU_stack_link(mat, "set_value", in, out, vec); } -bNodeType sh_node_value= { - /* *next,*prev */ NULL, NULL, - /* type code */ SH_NODE_VALUE, - /* name */ "Value", - /* width+range */ 80, 50, 120, - /* class+opts */ NODE_CLASS_INPUT, NODE_OPTIONS, - /* input sock */ NULL, - /* output sock */ sh_node_value_out, - /* storage */ "", - /* execfunc */ node_shader_exec_value, - /* butfunc */ NULL, - /* initfunc */ NULL, - /* freestoragefunc */ NULL, - /* copystoragefunc */ NULL, - /* id */ NULL, NULL, NULL, - /* gpufunc */ gpu_shader_value - -}; +void register_node_type_sh_value(ListBase *lb) +{ + static bNodeType ntype; + + node_type_base(&ntype, SH_NODE_VALUE, "Value", NODE_CLASS_INPUT, NODE_OPTIONS, + NULL, sh_node_value_out); + node_type_size(&ntype, 80, 50, 120); + node_type_exec(&ntype, node_shader_exec_value); + node_type_gpu(&ntype, gpu_shader_value); + + nodeRegisterType(lb, &ntype); +} + diff --git a/source/blender/nodes/intern/SHD_nodes/SHD_vectMath.c b/source/blender/nodes/intern/SHD_nodes/SHD_vectMath.c index 602cd3fe65a..a85022cffab 100644 --- a/source/blender/nodes/intern/SHD_nodes/SHD_vectMath.c +++ b/source/blender/nodes/intern/SHD_nodes/SHD_vectMath.c @@ -127,21 +127,19 @@ static int gpu_shader_vect_math(GPUMaterial *mat, bNode *node, GPUNodeStack *in, return 1; } -bNodeType sh_node_vect_math= { - /* *next,*prev */ NULL, NULL, - /* type code */ SH_NODE_VECT_MATH, - /* name */ "Vector Math", - /* width+range */ 80, 75, 140, - /* class+opts */ NODE_CLASS_CONVERTOR, NODE_OPTIONS, - /* input sock */ sh_node_vect_math_in, - /* output sock */ sh_node_vect_math_out, - /* storage */ "node_vect_math", - /* execfunc */ node_shader_exec_vect_math, - /* butfunc */ NULL, - /* initfunc */ NULL, - /* freestoragefunc */ NULL, - /* copystoragefunc */ NULL, - /* id */ NULL, NULL, NULL, - /* gpufunc */ gpu_shader_vect_math -}; +void register_node_type_sh_vect_math(ListBase *lb) +{ + static bNodeType ntype; + + node_type_base(&ntype, SH_NODE_VECT_MATH, "Vector Math", NODE_CLASS_CONVERTOR, NODE_OPTIONS, + sh_node_vect_math_in, sh_node_vect_math_out); + node_type_size(&ntype, 80, 75, 140); + node_type_label(&ntype, node_vect_math_label); + node_type_storage(&ntype, "node_vect_math", NULL, NULL); + node_type_exec(&ntype, node_shader_exec_vect_math); + node_type_gpu(&ntype, gpu_shader_vect_math); + + nodeRegisterType(lb, &ntype); +} + diff --git a/source/blender/nodes/intern/SHD_util.h b/source/blender/nodes/intern/SHD_util.h index 147291e380a..4134c160f16 100644 --- a/source/blender/nodes/intern/SHD_util.h +++ b/source/blender/nodes/intern/SHD_util.h @@ -51,6 +51,7 @@ #include "BKE_image.h" #include "BKE_main.h" #include "BKE_material.h" +#include "BKE_node.h" #include "BKE_texture.h" #include "BKE_library.h" diff --git a/source/blender/nodes/intern/TEX_nodes/TEX_at.c b/source/blender/nodes/intern/TEX_nodes/TEX_at.c index 1ca293acb5b..75fa1e4378d 100644 --- a/source/blender/nodes/intern/TEX_nodes/TEX_at.c +++ b/source/blender/nodes/intern/TEX_nodes/TEX_at.c @@ -53,20 +53,14 @@ static void exec(void *data, bNode *node, bNodeStack **in, bNodeStack **out) tex_output(node, in, out[0], &colorfn, data); } -bNodeType tex_node_at = { - /* *next,*prev */ NULL, NULL, - /* type code */ TEX_NODE_AT, - /* name */ "At", - /* width+range */ 100, 60, 150, - /* class+opts */ NODE_CLASS_DISTORT, 0, - /* input sock */ inputs, - /* output sock */ outputs, - /* storage */ "", - /* execfunc */ exec, - /* butfunc */ NULL, - /* initfunc */ NULL, - /* freestoragefunc */ NULL, - /* copystoragefunc */ NULL, - /* id */ NULL +void register_node_type_tex_at(ListBase *lb) +{ + static bNodeType ntype; -}; + node_type_base(&ntype, TEX_NODE_AT, "At", NODE_CLASS_DISTORT, 0, + inputs, outputs); + node_type_size(&ntype, 140, 100, 320); + node_type_exec(&ntype, exec); + + nodeRegisterType(lb, &ntype); +} diff --git a/source/blender/nodes/intern/TEX_nodes/TEX_bricks.c b/source/blender/nodes/intern/TEX_nodes/TEX_bricks.c index 9d26621e08c..7a32b6342aa 100644 --- a/source/blender/nodes/intern/TEX_nodes/TEX_bricks.c +++ b/source/blender/nodes/intern/TEX_nodes/TEX_bricks.c @@ -112,20 +112,15 @@ static void exec(void *data, bNode *node, bNodeStack **in, bNodeStack **out) tex_output(node, in, out[0], &colorfn, data); } -bNodeType tex_node_bricks= { - /* *next,*prev */ NULL, NULL, - /* type code */ TEX_NODE_BRICKS, - /* name */ "Bricks", - /* width+range */ 150, 60, 150, - /* class+opts */ NODE_CLASS_PATTERN, NODE_OPTIONS | NODE_PREVIEW, - /* input sock */ inputs, - /* output sock */ outputs, - /* storage */ "", - /* execfunc */ exec, - /* butfunc */ NULL, - /* initfunc */ init, - /* freestoragefunc */ NULL, - /* copystoragefunc */ NULL, - /* id */ NULL +void register_node_type_tex_bricks(ListBase *lb) +{ + static bNodeType ntype; -}; + node_type_base(&ntype, TEX_NODE_BRICKS, "Bricks", NODE_CLASS_PATTERN, NODE_PREVIEW|NODE_OPTIONS, + inputs, outputs); + node_type_size(&ntype, 150, 60, 150); + node_type_init(&ntype, init); + node_type_exec(&ntype, exec); + + nodeRegisterType(lb, &ntype); +} diff --git a/source/blender/nodes/intern/TEX_nodes/TEX_checker.c b/source/blender/nodes/intern/TEX_nodes/TEX_checker.c index 64b70455a19..25cfd4412f5 100644 --- a/source/blender/nodes/intern/TEX_nodes/TEX_checker.c +++ b/source/blender/nodes/intern/TEX_nodes/TEX_checker.c @@ -64,20 +64,14 @@ static void exec(void *data, bNode *node, bNodeStack **in, bNodeStack **out) tex_output(node, in, out[0], &colorfn, data); } -bNodeType tex_node_checker= { - /* *next,*prev */ NULL, NULL, - /* type code */ TEX_NODE_CHECKER, - /* name */ "Checker", - /* width+range */ 100, 60, 150, - /* class+opts */ NODE_CLASS_PATTERN, NODE_OPTIONS | NODE_PREVIEW, - /* input sock */ inputs, - /* output sock */ outputs, - /* storage */ "", - /* execfunc */ exec, - /* butfunc */ NULL, - /* initfunc */ NULL, - /* freestoragefunc */ NULL, - /* copystoragefunc */ NULL, - /* id */ NULL +void register_node_type_tex_checker(ListBase *lb) +{ + static bNodeType ntype; -}; + node_type_base(&ntype, TEX_NODE_CHECKER, "Checker", NODE_CLASS_PATTERN, NODE_PREVIEW|NODE_OPTIONS, + inputs, outputs); + node_type_size(&ntype, 100, 60, 150); + node_type_exec(&ntype, exec); + + nodeRegisterType(lb, &ntype); +} diff --git a/source/blender/nodes/intern/TEX_nodes/TEX_compose.c b/source/blender/nodes/intern/TEX_nodes/TEX_compose.c index f05e1e987da..3b933927c5e 100644 --- a/source/blender/nodes/intern/TEX_nodes/TEX_compose.c +++ b/source/blender/nodes/intern/TEX_nodes/TEX_compose.c @@ -52,20 +52,14 @@ static void exec(void *data, bNode *node, bNodeStack **in, bNodeStack **out) tex_output(node, in, out[0], &colorfn, data); } -bNodeType tex_node_compose= { - /* *next,*prev */ NULL, NULL, - /* type code */ TEX_NODE_COMPOSE, - /* name */ "Compose RGBA", - /* width+range */ 100, 60, 150, - /* class+opts */ NODE_CLASS_OP_COLOR, 0, - /* input sock */ inputs, - /* output sock */ outputs, - /* storage */ "", - /* execfunc */ exec, - /* butfunc */ NULL, - /* initfunc */ NULL, - /* freestoragefunc */ NULL, - /* copystoragefunc */ NULL, - /* id */ NULL +void register_node_type_tex_compose(ListBase *lb) +{ + static bNodeType ntype; -}; + node_type_base(&ntype, TEX_NODE_COMPOSE, "Compose RGBA", NODE_CLASS_OP_COLOR, 0, + inputs, outputs); + node_type_size(&ntype, 100, 60, 150); + node_type_exec(&ntype, exec); + + nodeRegisterType(lb, &ntype); +} diff --git a/source/blender/nodes/intern/TEX_nodes/TEX_coord.c b/source/blender/nodes/intern/TEX_nodes/TEX_coord.c index 4ad32bc872e..5311dbc2360 100644 --- a/source/blender/nodes/intern/TEX_nodes/TEX_coord.c +++ b/source/blender/nodes/intern/TEX_nodes/TEX_coord.c @@ -45,20 +45,15 @@ static void exec(void *data, bNode *node, bNodeStack **in, bNodeStack **out) tex_output(node, in, out[0], &vectorfn, data); } -bNodeType tex_node_coord= { - /* *next,*prev */ NULL, NULL, - /* type code */ TEX_NODE_COORD, - /* name */ "Coordinates", - /* width+range */ 120, 110, 160, - /* class+opts */ NODE_CLASS_INPUT, NODE_OPTIONS, - /* input sock */ NULL, - /* output sock */ outputs, - /* storage */ "node_coord", - /* execfunc */ exec, - /* butfunc */ NULL, - /* initfunc */ NULL, - /* freestoragefunc */ NULL, - /* copystoragefunc */ NULL, - /* id */ NULL -}; - +void register_node_type_tex_coord(ListBase *lb) +{ + static bNodeType ntype; + + node_type_base(&ntype, TEX_NODE_COORD, "Coordinates", NODE_CLASS_INPUT, NODE_OPTIONS, + NULL, outputs); + node_type_size(&ntype, 120, 110, 160); + node_type_storage(&ntype, "node_coord", NULL, NULL); + node_type_exec(&ntype, exec); + + nodeRegisterType(lb, &ntype); +} diff --git a/source/blender/nodes/intern/TEX_nodes/TEX_curves.c b/source/blender/nodes/intern/TEX_nodes/TEX_curves.c index 0fca0aa30ad..e4ea39b8591 100644 --- a/source/blender/nodes/intern/TEX_nodes/TEX_curves.c +++ b/source/blender/nodes/intern/TEX_nodes/TEX_curves.c @@ -61,22 +61,19 @@ static void time_init(bNode* node) node->storage= curvemapping_add(1, 0.0f, 0.0f, 1.0f, 1.0f); } -bNodeType tex_node_curve_time= { - /* *next,*prev */ NULL, NULL, - /* type code */ TEX_NODE_CURVE_TIME, - /* name */ "Time", - /* width+range */ 140, 100, 320, - /* class+opts */ NODE_CLASS_INPUT, NODE_OPTIONS, - /* input sock */ NULL, - /* output sock */ time_outputs, - /* storage */ "CurveMapping", - /* execfunc */ time_exec, - /* butfunc */ NULL, - /* initfunc */ time_init, - /* freestoragefunc */ node_free_curves, - /* copystoragefunc */ node_copy_curves, - /* id */ NULL -}; +void register_node_type_tex_curve_time(ListBase *lb) +{ + static bNodeType ntype; + + node_type_base(&ntype, TEX_NODE_CURVE_TIME, "Time", NODE_CLASS_INPUT, NODE_OPTIONS, + NULL, time_outputs); + node_type_size(&ntype, 140, 100, 320); + node_type_init(&ntype, time_init); + node_type_storage(&ntype, "CurveMapping", node_free_curves, node_copy_curves); + node_type_exec(&ntype, time_exec); + + nodeRegisterType(lb, &ntype); +} /* **************** CURVE RGB ******************** */ static bNodeSocketType rgb_inputs[]= { @@ -108,20 +105,17 @@ static void rgb_init(bNode *node) node->storage= curvemapping_add(4, 0.0f, 0.0f, 1.0f, 1.0f); } -bNodeType tex_node_curve_rgb= { - /* *next,*prev */ NULL, NULL, - /* type code */ TEX_NODE_CURVE_RGB, - /* name */ "RGB Curves", - /* width+range */ 200, 140, 320, - /* class+opts */ NODE_CLASS_OP_COLOR, NODE_OPTIONS, - /* input sock */ rgb_inputs, - /* output sock */ rgb_outputs, - /* storage */ "CurveMapping", - /* execfunc */ rgb_exec, - /* butfunc */ NULL, - /* initfunc */ rgb_init, - /* freestoragefunc */ node_free_curves, - /* copystoragefunc */ node_copy_curves, - /* id */ NULL -}; +void register_node_type_tex_curve_rgb(ListBase *lb) +{ + static bNodeType ntype; + + node_type_base(&ntype, TEX_NODE_CURVE_RGB, "RGB Curves", NODE_CLASS_OP_COLOR, NODE_OPTIONS, + rgb_inputs, rgb_outputs); + node_type_size(&ntype, 200, 140, 320); + node_type_init(&ntype, rgb_init); + node_type_storage(&ntype, "CurveMapping", node_free_curves, node_copy_curves); + node_type_exec(&ntype, rgb_exec); + + nodeRegisterType(lb, &ntype); +} diff --git a/source/blender/nodes/intern/TEX_nodes/TEX_decompose.c b/source/blender/nodes/intern/TEX_nodes/TEX_decompose.c index 13768aaa868..c66e26321b6 100644 --- a/source/blender/nodes/intern/TEX_nodes/TEX_decompose.c +++ b/source/blender/nodes/intern/TEX_nodes/TEX_decompose.c @@ -73,20 +73,14 @@ static void exec(void *data, bNode *node, bNodeStack **in, bNodeStack **out) tex_output(node, in, out[3], &valuefn_a, data); } -bNodeType tex_node_decompose= { - /* *next,*prev */ NULL, NULL, - /* type code */ TEX_NODE_DECOMPOSE, - /* name */ "Decompose RGBA", - /* width+range */ 100, 60, 150, - /* class+opts */ NODE_CLASS_OP_COLOR, 0, - /* input sock */ inputs, - /* output sock */ outputs, - /* storage */ "", - /* execfunc */ exec, - /* butfunc */ NULL, - /* initfunc */ NULL, - /* freestoragefunc */ NULL, - /* copystoragefunc */ NULL, - /* id */ NULL +void register_node_type_tex_decompose(ListBase *lb) +{ + static bNodeType ntype; -}; + node_type_base(&ntype, TEX_NODE_DECOMPOSE, "Decompose RGBA", NODE_CLASS_OP_COLOR, 0, + inputs, outputs); + node_type_size(&ntype, 100, 60, 150); + node_type_exec(&ntype, exec); + + nodeRegisterType(lb, &ntype); +} diff --git a/source/blender/nodes/intern/TEX_nodes/TEX_distance.c b/source/blender/nodes/intern/TEX_nodes/TEX_distance.c index 5d624205f43..887fbd1be90 100644 --- a/source/blender/nodes/intern/TEX_nodes/TEX_distance.c +++ b/source/blender/nodes/intern/TEX_nodes/TEX_distance.c @@ -56,21 +56,15 @@ static void exec(void *data, bNode *node, bNodeStack **in, bNodeStack **out) tex_output(node, in, out[0], &valuefn, data); } -bNodeType tex_node_distance= { - /* *next,*prev */ NULL, NULL, - /* type code */ TEX_NODE_DISTANCE, - /* name */ "Distance", - /* width+range */ 120, 110, 160, - /* class+opts */ NODE_CLASS_CONVERTOR, NODE_OPTIONS, - /* input sock */ inputs, - /* output sock */ outputs, - /* storage */ "node_distance", - /* execfunc */ exec, - /* butfunc */ NULL, - /* initfunc */ NULL, - /* freestoragefunc */ NULL, - /* copystoragefunc */ NULL, - /* id */ NULL -}; - - +void register_node_type_tex_distance(ListBase *lb) +{ + static bNodeType ntype; + + node_type_base(&ntype, TEX_NODE_DISTANCE, "Distance", NODE_CLASS_CONVERTOR, NODE_OPTIONS, + inputs, outputs); + node_type_size(&ntype, 120, 110, 160); + node_type_storage(&ntype, "node_distance", NULL, NULL); + node_type_exec(&ntype, exec); + + nodeRegisterType(lb, &ntype); +} diff --git a/source/blender/nodes/intern/TEX_nodes/TEX_hueSatVal.c b/source/blender/nodes/intern/TEX_nodes/TEX_hueSatVal.c index 2ccde083823..66a98b70fd4 100644 --- a/source/blender/nodes/intern/TEX_nodes/TEX_hueSatVal.c +++ b/source/blender/nodes/intern/TEX_nodes/TEX_hueSatVal.c @@ -87,22 +87,14 @@ static void exec(void *data, bNode *node, bNodeStack **in, bNodeStack **out) tex_output(node, in, out[0], &colorfn, data); } -bNodeType tex_node_hue_sat= { - /* *next,*prev */ NULL, NULL, - /* type code */ TEX_NODE_HUE_SAT, - /* name */ "Hue Saturation Value", - /* width+range */ 150, 80, 250, - /* class+opts */ NODE_CLASS_OP_COLOR, NODE_OPTIONS, - /* input sock */ inputs, - /* output sock */ outputs, - /* storage */ "", - /* execfunc */ exec, - /* butfunc */ NULL, - /* initfunc */ NULL, - /* freestoragefunc */ NULL, - /* copystoragefunc */ NULL, - /* id */ NULL +void register_node_type_tex_hue_sat(ListBase *lb) +{ + static bNodeType ntype; -}; - - + node_type_base(&ntype, TEX_NODE_HUE_SAT, "Hue Saturation Value", NODE_CLASS_OP_COLOR, NODE_OPTIONS, + inputs, outputs); + node_type_size(&ntype, 150, 80, 250); + node_type_exec(&ntype, exec); + + nodeRegisterType(lb, &ntype); +} diff --git a/source/blender/nodes/intern/TEX_nodes/TEX_image.c b/source/blender/nodes/intern/TEX_nodes/TEX_image.c index 7c680b4c25a..a870d1d31fe 100644 --- a/source/blender/nodes/intern/TEX_nodes/TEX_image.c +++ b/source/blender/nodes/intern/TEX_nodes/TEX_image.c @@ -91,20 +91,16 @@ static void init(bNode* node) iuser->ok= 1; } -bNodeType tex_node_image= { - /* *next,*prev */ NULL, NULL, - /* type code */ TEX_NODE_IMAGE, - /* name */ "Image", - /* width+range */ 120, 80, 300, - /* class+opts */ NODE_CLASS_INPUT, NODE_PREVIEW|NODE_OPTIONS, - /* input sock */ NULL, - /* output sock */ outputs, - /* storage */ "ImageUser", - /* execfunc */ exec, - /* butfunc */ NULL, - /* initfunc */ init, - /* freestoragefunc */ node_free_standard_storage, - /* copystoragefunc */ node_copy_standard_storage, - /* id */ NULL -}; - +void register_node_type_tex_image(ListBase *lb) +{ + static bNodeType ntype; + + node_type_base(&ntype, TEX_NODE_IMAGE, "Image", NODE_CLASS_INPUT, NODE_PREVIEW|NODE_OPTIONS, + NULL, outputs); + node_type_size(&ntype, 120, 80, 300); + node_type_init(&ntype, init); + node_type_storage(&ntype, "ImageUser", node_free_standard_storage, node_copy_standard_storage); + node_type_exec(&ntype, exec); + + nodeRegisterType(lb, &ntype); +} diff --git a/source/blender/nodes/intern/TEX_nodes/TEX_invert.c b/source/blender/nodes/intern/TEX_nodes/TEX_invert.c index 421082aeb34..d6d66abd863 100644 --- a/source/blender/nodes/intern/TEX_nodes/TEX_invert.c +++ b/source/blender/nodes/intern/TEX_nodes/TEX_invert.c @@ -58,20 +58,15 @@ static void exec(void *data, bNode *node, bNodeStack **in, bNodeStack **out) tex_output(node, in, out[0], &colorfn, data); } -bNodeType tex_node_invert= { - /* *next,*prev */ NULL, NULL, - /* type code */ TEX_NODE_INVERT, - /* name */ "Invert", - /* width+range */ 90, 80, 100, - /* class+opts */ NODE_CLASS_OP_COLOR, NODE_OPTIONS, - /* input sock */ inputs, - /* output sock */ outputs, - /* storage */ "", - /* execfunc */ exec, - /* butfunc */ NULL, - /* initfunc */ NULL, - /* freestoragefunc */ NULL, - /* copystoragefunc */ NULL, - /* id */ NULL -}; +void register_node_type_tex_invert(ListBase *lb) +{ + static bNodeType ntype; + + node_type_base(&ntype, TEX_NODE_INVERT, "Invert", NODE_CLASS_OP_COLOR, NODE_OPTIONS, + inputs, outputs); + node_type_size(&ntype, 90, 80, 100); + node_type_exec(&ntype, exec); + + nodeRegisterType(lb, &ntype); +} diff --git a/source/blender/nodes/intern/TEX_nodes/TEX_math.c b/source/blender/nodes/intern/TEX_nodes/TEX_math.c index a17c295eb7f..7e1c54b6e47 100644 --- a/source/blender/nodes/intern/TEX_nodes/TEX_math.c +++ b/source/blender/nodes/intern/TEX_nodes/TEX_math.c @@ -174,20 +174,17 @@ static void exec(void *data, bNode *node, bNodeStack **in, bNodeStack **out) tex_output(node, in, out[0], &valuefn, data); } -bNodeType tex_node_math= { - /* *next,*prev */ NULL, NULL, - /* type code */ TEX_NODE_MATH, - /* name */ "Math", - /* width+range */ 120, 110, 160, - /* class+opts */ NODE_CLASS_CONVERTOR, NODE_OPTIONS, - /* input sock */ inputs, - /* output sock */ outputs, - /* storage */ "node_math", - /* execfunc */ exec, - /* butfunc */ NULL, - /* initfunc */ NULL, - /* freestoragefunc */ NULL, - /* copystoragefunc */ NULL, - /* id */ NULL -}; +void register_node_type_tex_math(ListBase *lb) +{ + static bNodeType ntype; + + node_type_base(&ntype, TEX_NODE_MATH, "Math", NODE_CLASS_CONVERTOR, NODE_OPTIONS, + inputs, outputs); + node_type_size(&ntype, 120, 110, 160); + node_type_label(&ntype, node_math_label); + node_type_storage(&ntype, "node_math", NULL, NULL); + node_type_exec(&ntype, exec); + + nodeRegisterType(lb, &ntype); +} diff --git a/source/blender/nodes/intern/TEX_nodes/TEX_mixRgb.c b/source/blender/nodes/intern/TEX_nodes/TEX_mixRgb.c index c709d58b8ba..152288fcac8 100644 --- a/source/blender/nodes/intern/TEX_nodes/TEX_mixRgb.c +++ b/source/blender/nodes/intern/TEX_nodes/TEX_mixRgb.c @@ -28,7 +28,6 @@ #include "../TEX_util.h" - /* **************** MIX RGB ******************** */ static bNodeSocketType inputs[]= { { SOCK_VALUE, 1, "Factor", 0.5f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f }, @@ -60,20 +59,15 @@ static void exec(void *data, bNode *node, bNodeStack **in, bNodeStack **out) tex_output(node, in, out[0], &colorfn, data); } -bNodeType tex_node_mix_rgb= { - /* *next,*prev */ NULL, NULL, - /* type code */ TEX_NODE_MIX_RGB, - /* name */ "Mix", - /* width+range */ 100, 60, 150, - /* class+opts */ NODE_CLASS_OP_COLOR, NODE_OPTIONS, - /* input sock */ inputs, - /* output sock */ outputs, - /* storage */ "", - /* execfunc */ exec, - /* butfunc */ NULL, - /* initfunc */ NULL, - /* freestoragefunc */ NULL, - /* copystoragefunc */ NULL, - /* id */ NULL +void register_node_type_tex_mix_rgb(ListBase *lb) +{ + static bNodeType ntype; -}; + node_type_base(&ntype, TEX_NODE_MIX_RGB, "Mix", NODE_CLASS_OP_COLOR, NODE_OPTIONS, + inputs, outputs); + node_type_size(&ntype, 100, 60, 150); + node_type_label(&ntype, node_blend_label); + node_type_exec(&ntype, exec); + + nodeRegisterType(lb, &ntype); +} diff --git a/source/blender/nodes/intern/TEX_nodes/TEX_output.c b/source/blender/nodes/intern/TEX_nodes/TEX_output.c index 1be2e8f1c56..b10cfa543a1 100644 --- a/source/blender/nodes/intern/TEX_nodes/TEX_output.c +++ b/source/blender/nodes/intern/TEX_nodes/TEX_output.c @@ -152,20 +152,16 @@ static void copy(bNode *orig, bNode *new) assign_index(new); } -bNodeType tex_node_output= { - /* *next,*prev */ NULL, NULL, - /* type code */ TEX_NODE_OUTPUT, - /* name */ "Output", - /* width+range */ 150, 60, 200, - /* class+opts */ NODE_CLASS_OUTPUT, NODE_PREVIEW | NODE_OPTIONS, - /* input sock */ inputs, - /* output sock */ NULL, - /* storage */ "TexNodeOutput", - /* execfunc */ exec, - /* butfunc */ NULL, - /* initfunc */ init, - /* freestoragefunc */ node_free_standard_storage, - /* copystoragefunc */ copy, - /* id */ NULL -}; - +void register_node_type_tex_output(ListBase *lb) +{ + static bNodeType ntype; + + node_type_base(&ntype, TEX_NODE_OUTPUT, "Output", NODE_CLASS_OUTPUT, NODE_PREVIEW|NODE_OPTIONS, + inputs, NULL); + node_type_size(&ntype, 150, 60, 200); + node_type_init(&ntype, init); + node_type_storage(&ntype, "TexNodeOutput", node_free_standard_storage, copy); + node_type_exec(&ntype, exec); + + nodeRegisterType(lb, &ntype); +} diff --git a/source/blender/nodes/intern/TEX_nodes/TEX_proc.c b/source/blender/nodes/intern/TEX_nodes/TEX_proc.c index a4a608e777c..bba25ea7bd2 100644 --- a/source/blender/nodes/intern/TEX_nodes/TEX_proc.c +++ b/source/blender/nodes/intern/TEX_nodes/TEX_proc.c @@ -290,21 +290,29 @@ static void init(bNode *node) /* Node type definitions */ #define TexDef(TEXTYPE, outputs, name, Name) \ - { NULL, NULL, TEX_NODE_PROC+TEXTYPE, Name, 140,80,140, NODE_CLASS_TEXTURE, \ - NODE_OPTIONS | NODE_PREVIEW, name##_inputs, outputs, "Tex", name##_exec, NULL, init, \ - node_free_standard_storage, node_copy_standard_storage, NULL } +void register_node_type_tex_proc_##name(ListBase *lb) \ +{ \ + static bNodeType ntype; \ + \ + node_type_base(&ntype, TEX_NODE_PROC+TEXTYPE, Name, NODE_CLASS_TEXTURE, NODE_PREVIEW|NODE_OPTIONS, name##_inputs, outputs); \ + node_type_size(&ntype, 140, 80, 140); \ + node_type_init(&ntype, init); \ + node_type_storage(&ntype, "Tex", node_free_standard_storage, node_copy_standard_storage); \ + node_type_exec(&ntype, name##_exec); \ + \ + nodeRegisterType(lb, &ntype); \ +} #define C outputs_color_only #define CV outputs_both -bNodeType tex_node_proc_voronoi = TexDef(TEX_VORONOI, CV, voronoi, "Voronoi" ); -bNodeType tex_node_proc_blend = TexDef(TEX_BLEND, C, blend, "Blend" ); -bNodeType tex_node_proc_magic = TexDef(TEX_MAGIC, C, magic, "Magic" ); -bNodeType tex_node_proc_marble = TexDef(TEX_MARBLE, CV, marble, "Marble" ); -bNodeType tex_node_proc_clouds = TexDef(TEX_CLOUDS, CV, clouds, "Clouds" ); -bNodeType tex_node_proc_wood = TexDef(TEX_WOOD, CV, wood, "Wood" ); -bNodeType tex_node_proc_musgrave = TexDef(TEX_MUSGRAVE, CV, musgrave, "Musgrave" ); -bNodeType tex_node_proc_noise = TexDef(TEX_NOISE, C, noise, "Noise" ); -bNodeType tex_node_proc_stucci = TexDef(TEX_STUCCI, CV, stucci, "Stucci" ); -bNodeType tex_node_proc_distnoise = TexDef(TEX_DISTNOISE, CV, distnoise, "Distorted Noise" ); - +TexDef(TEX_VORONOI, CV, voronoi, "Voronoi" ); +TexDef(TEX_BLEND, C, blend, "Blend" ); +TexDef(TEX_MAGIC, C, magic, "Magic" ); +TexDef(TEX_MARBLE, CV, marble, "Marble" ); +TexDef(TEX_CLOUDS, CV, clouds, "Clouds" ); +TexDef(TEX_WOOD, CV, wood, "Wood" ); +TexDef(TEX_MUSGRAVE, CV, musgrave, "Musgrave" ); +TexDef(TEX_NOISE, C, noise, "Noise" ); +TexDef(TEX_STUCCI, CV, stucci, "Stucci" ); +TexDef(TEX_DISTNOISE, CV, distnoise, "Distorted Noise" ); diff --git a/source/blender/nodes/intern/TEX_nodes/TEX_rotate.c b/source/blender/nodes/intern/TEX_nodes/TEX_rotate.c index 88ed5382a6a..92a9fa26311 100644 --- a/source/blender/nodes/intern/TEX_nodes/TEX_rotate.c +++ b/source/blender/nodes/intern/TEX_nodes/TEX_rotate.c @@ -90,20 +90,14 @@ static void exec(void *data, bNode *node, bNodeStack **in, bNodeStack **out) tex_output(node, in, out[0], &colorfn, data); } -bNodeType tex_node_rotate= { - /* *next,*prev */ NULL, NULL, - /* type code */ TEX_NODE_ROTATE, - /* name */ "Rotate", - /* width+range */ 90, 80, 100, - /* class+opts */ NODE_CLASS_DISTORT, NODE_OPTIONS, - /* input sock */ inputs, - /* output sock */ outputs, - /* storage */ "", - /* execfunc */ exec, - /* butfunc */ NULL, - /* initfunc */ NULL, - /* freestoragefunc */ NULL, - /* copystoragefunc */ NULL, - /* id */ NULL -}; - +void register_node_type_tex_rotate(ListBase *lb) +{ + static bNodeType ntype; + + node_type_base(&ntype, TEX_NODE_ROTATE, "Rotate", NODE_CLASS_DISTORT, NODE_OPTIONS, + inputs, outputs); + node_type_size(&ntype, 140, 100, 320); + node_type_exec(&ntype, exec); + + nodeRegisterType(lb, &ntype); +} diff --git a/source/blender/nodes/intern/TEX_nodes/TEX_scale.c b/source/blender/nodes/intern/TEX_nodes/TEX_scale.c index 8045c1ca07a..65ae744531b 100644 --- a/source/blender/nodes/intern/TEX_nodes/TEX_scale.c +++ b/source/blender/nodes/intern/TEX_nodes/TEX_scale.c @@ -64,20 +64,14 @@ static void exec(void *data, bNode *node, bNodeStack **in, bNodeStack **out) tex_output(node, in, out[0], &colorfn, data); } -bNodeType tex_node_scale = { - /* *next,*prev */ NULL, NULL, - /* type code */ TEX_NODE_SCALE, - /* name */ "Scale", - /* width+range */ 90, 80, 100, - /* class+opts */ NODE_CLASS_DISTORT, NODE_OPTIONS, - /* input sock */ inputs, - /* output sock */ outputs, - /* storage */ "", - /* execfunc */ exec, - /* butfunc */ NULL, - /* initfunc */ NULL, - /* freestoragefunc */ NULL, - /* copystoragefunc */ NULL, - /* id */ NULL -}; - +void register_node_type_tex_scale(ListBase *lb) +{ + static bNodeType ntype; + + node_type_base(&ntype, TEX_NODE_SCALE, "Scale", NODE_CLASS_DISTORT, NODE_OPTIONS, + inputs, outputs); + node_type_size(&ntype, 90, 80, 100); + node_type_exec(&ntype, exec); + + nodeRegisterType(lb, &ntype); +} diff --git a/source/blender/nodes/intern/TEX_nodes/TEX_texture.c b/source/blender/nodes/intern/TEX_nodes/TEX_texture.c index c01caa022e5..2bbd08a4c1f 100644 --- a/source/blender/nodes/intern/TEX_nodes/TEX_texture.c +++ b/source/blender/nodes/intern/TEX_nodes/TEX_texture.c @@ -83,21 +83,14 @@ static void exec(void *data, bNode *node, bNodeStack **in, bNodeStack **out) tex_output(node, in, out[0], &colorfn, data); } -bNodeType tex_node_texture= { - /* *next,*prev */ NULL, NULL, - /* type code */ TEX_NODE_TEXTURE, - /* name */ "Texture", - /* width+range */ 120, 80, 240, - /* class+opts */ NODE_CLASS_INPUT, NODE_OPTIONS|NODE_PREVIEW, - /* input sock */ inputs, - /* output sock */ outputs, - /* storage */ "", - /* execfunc */ exec, - /* butfunc */ NULL, - /* initfunc */ NULL, - /* freestoragefunc */ NULL, - /* copystoragefunc */ NULL, - /* id */ NULL +void register_node_type_tex_texture(ListBase *lb) +{ + static bNodeType ntype; -}; - + node_type_base(&ntype, TEX_NODE_TEXTURE, "Texture", NODE_CLASS_INPUT, NODE_PREVIEW|NODE_OPTIONS, + inputs, outputs); + node_type_size(&ntype, 120, 80, 240); + node_type_exec(&ntype, exec); + + nodeRegisterType(lb, &ntype); +} diff --git a/source/blender/nodes/intern/TEX_nodes/TEX_translate.c b/source/blender/nodes/intern/TEX_nodes/TEX_translate.c index a9d7fbcf3da..a570386bcda 100644 --- a/source/blender/nodes/intern/TEX_nodes/TEX_translate.c +++ b/source/blender/nodes/intern/TEX_nodes/TEX_translate.c @@ -59,20 +59,14 @@ static void exec(void *data, bNode *node, bNodeStack **in, bNodeStack **out) tex_output(node, in, out[0], &colorfn, data); } -bNodeType tex_node_translate = { - /* *next,*prev */ NULL, NULL, - /* type code */ TEX_NODE_TRANSLATE, - /* name */ "Translate", - /* width+range */ 90, 80, 100, - /* class+opts */ NODE_CLASS_DISTORT, NODE_OPTIONS, - /* input sock */ inputs, - /* output sock */ outputs, - /* storage */ "", - /* execfunc */ exec, - /* butfunc */ NULL, - /* initfunc */ NULL, - /* freestoragefunc */ NULL, - /* copystoragefunc */ NULL, - /* id */ NULL -}; - +void register_node_type_tex_translate(ListBase *lb) +{ + static bNodeType ntype; + + node_type_base(&ntype, TEX_NODE_TRANSLATE, "Translate", NODE_CLASS_DISTORT, NODE_OPTIONS, + inputs, outputs); + node_type_size(&ntype, 90, 80, 100); + node_type_exec(&ntype, exec); + + nodeRegisterType(lb, &ntype); +} diff --git a/source/blender/nodes/intern/TEX_nodes/TEX_valToNor.c b/source/blender/nodes/intern/TEX_nodes/TEX_valToNor.c index c71d442cef3..67fb068870c 100644 --- a/source/blender/nodes/intern/TEX_nodes/TEX_valToNor.c +++ b/source/blender/nodes/intern/TEX_nodes/TEX_valToNor.c @@ -75,20 +75,14 @@ static void exec(void *data, bNode *node, bNodeStack **in, bNodeStack **out) tex_output(node, in, out[0], &normalfn, data); } -bNodeType tex_node_valtonor = { - /* *next,*prev */ NULL, NULL, - /* type code */ TEX_NODE_VALTONOR, - /* name */ "Value to Normal", - /* width+range */ 90, 80, 100, - /* class+opts */ NODE_CLASS_CONVERTOR, NODE_OPTIONS, - /* input sock */ inputs, - /* output sock */ outputs, - /* storage */ "", - /* execfunc */ exec, - /* butfunc */ NULL, - /* initfunc */ NULL, - /* freestoragefunc */ NULL, - /* copystoragefunc */ NULL, - /* id */ NULL -}; - +void register_node_type_tex_valtonor(ListBase *lb) +{ + static bNodeType ntype; + + node_type_base(&ntype, TEX_NODE_VALTONOR, "Value to Normal", NODE_CLASS_CONVERTOR, NODE_OPTIONS, + inputs, outputs); + node_type_size(&ntype, 90, 80, 100); + node_type_exec(&ntype, exec); + + nodeRegisterType(lb, &ntype); +} diff --git a/source/blender/nodes/intern/TEX_nodes/TEX_valToRgb.c b/source/blender/nodes/intern/TEX_nodes/TEX_valToRgb.c index fcaa9550efa..f23baffb0ee 100644 --- a/source/blender/nodes/intern/TEX_nodes/TEX_valToRgb.c +++ b/source/blender/nodes/intern/TEX_nodes/TEX_valToRgb.c @@ -58,23 +58,19 @@ static void valtorgb_init(bNode *node) node->storage = add_colorband(1); } -bNodeType tex_node_valtorgb= { - /* *next,*prev */ NULL, NULL, - /* type code */ TEX_NODE_VALTORGB, - /* name */ "ColorRamp", - /* width+range */ 240, 200, 300, - /* class+opts */ NODE_CLASS_CONVERTOR, NODE_OPTIONS, - /* input sock */ valtorgb_in, - /* output sock */ valtorgb_out, - /* storage */ "ColorBand", - /* execfunc */ valtorgb_exec, - /* butfunc */ NULL, - /* initfunc */ valtorgb_init, - /* freestoragefunc */ node_free_standard_storage, - /* copystoragefunc */ node_copy_standard_storage, - /* id */ NULL +void register_node_type_tex_valtorgb(ListBase *lb) +{ + static bNodeType ntype; -}; + node_type_base(&ntype, TEX_NODE_VALTORGB, "ColorRamp", NODE_CLASS_CONVERTOR, NODE_OPTIONS, + valtorgb_in, valtorgb_out); + node_type_size(&ntype, 240, 200, 300); + node_type_init(&ntype, valtorgb_init); + node_type_storage(&ntype, "ColorBand", node_free_standard_storage, node_copy_standard_storage); + node_type_exec(&ntype, valtorgb_exec); + + nodeRegisterType(lb, &ntype); +} /* **************** RGBTOBW ******************** */ static bNodeSocketType rgbtobw_in[]= { @@ -100,21 +96,15 @@ static void rgbtobw_exec(void *data, bNode *node, bNodeStack **in, bNodeStack ** tex_output(node, in, out[0], &rgbtobw_valuefn, data); } -bNodeType tex_node_rgbtobw= { - /* *next,*prev */ NULL, NULL, - /* type code */ TEX_NODE_RGBTOBW, - /* name */ "RGB to BW", - /* width+range */ 80, 40, 120, - /* class+opts */ NODE_CLASS_CONVERTOR, 0, - /* input sock */ rgbtobw_in, - /* output sock */ rgbtobw_out, - /* storage */ "", - /* execfunc */ rgbtobw_exec, - /* butfunc */ NULL, - /* initfunc */ NULL, - /* freestoragefunc */ NULL, - /* copystoragefunc */ NULL, - /* id */ NULL - -}; +void register_node_type_tex_rgbtobw(ListBase *lb) +{ + static bNodeType ntype; + + node_type_base(&ntype, TEX_NODE_RGBTOBW, "RGB to BW", NODE_CLASS_CONVERTOR, 0, + rgbtobw_in, rgbtobw_out); + node_type_size(&ntype, 80, 40, 120); + node_type_exec(&ntype, rgbtobw_exec); + + nodeRegisterType(lb, &ntype); +} diff --git a/source/blender/nodes/intern/TEX_nodes/TEX_viewer.c b/source/blender/nodes/intern/TEX_nodes/TEX_viewer.c index 75fe6945261..5dbfc2561b5 100644 --- a/source/blender/nodes/intern/TEX_nodes/TEX_viewer.c +++ b/source/blender/nodes/intern/TEX_nodes/TEX_viewer.c @@ -51,20 +51,14 @@ static void exec(void *data, bNode *node, bNodeStack **in, bNodeStack **UNUSED(o } } -bNodeType tex_node_viewer = { - /* *next,*prev */ NULL, NULL, - /* type code */ TEX_NODE_VIEWER, - /* name */ "Viewer", - /* width+range */ 100, 60, 150, - /* class+opts */ NODE_CLASS_OUTPUT, NODE_PREVIEW, - /* input sock */ inputs, - /* output sock */ outputs, - /* storage */ "", - /* execfunc */ exec, - /* butfunc */ NULL, - /* initfunc */ NULL, - /* freestoragefunc */ NULL, - /* copystoragefunc */ NULL, - /* id */ NULL +void register_node_type_tex_viewer(ListBase *lb) +{ + static bNodeType ntype; -}; + node_type_base(&ntype, TEX_NODE_VIEWER, "Viewer", NODE_CLASS_OUTPUT, NODE_PREVIEW, + inputs, outputs); + node_type_size(&ntype, 100, 60, 150); + node_type_exec(&ntype, exec); + + nodeRegisterType(lb, &ntype); +} diff --git a/source/blender/nodes/intern/TEX_util.h b/source/blender/nodes/intern/TEX_util.h index 38edfabd346..4caee223a1e 100644 --- a/source/blender/nodes/intern/TEX_util.h +++ b/source/blender/nodes/intern/TEX_util.h @@ -50,6 +50,7 @@ #include "BKE_image.h" #include "BKE_main.h" #include "BKE_material.h" +#include "BKE_node.h" #include "BKE_texture.h" #include "BKE_library.h" diff --git a/source/blender/nodes/intern/node_util.c b/source/blender/nodes/intern/node_util.c index 746b8a37f5b..baf0fc17bf7 100644 --- a/source/blender/nodes/intern/node_util.c +++ b/source/blender/nodes/intern/node_util.c @@ -30,6 +30,9 @@ #include "CMP_util.h" #include "SHD_util.h" +#include "RNA_access.h" +#include "RNA_enum_types.h" + void node_free_curves(bNode *node) { curvemapping_free(node->storage); @@ -50,3 +53,30 @@ void node_copy_standard_storage(bNode *orig_node, bNode *new_node) new_node->storage= MEM_dupallocN(orig_node->storage); } +const char *node_blend_label(bNode *node) +{ + const char *name; + RNA_enum_name(node_blend_type_items, node->custom1, &name); + return name; +} + +const char *node_math_label(bNode *node) +{ + const char *name; + RNA_enum_name(node_math_items, node->custom1, &name); + return name; +} + +const char *node_vect_math_label(bNode *node) +{ + const char *name; + RNA_enum_name(node_vec_math_items, node->custom1, &name); + return name; +} + +const char *node_filter_label(bNode *node) +{ + const char *name; + RNA_enum_name(node_filter_items, node->custom1, &name); + return name; +} diff --git a/source/blender/nodes/intern/node_util.h b/source/blender/nodes/intern/node_util.h index 0326459ac68..c41ce3025ba 100644 --- a/source/blender/nodes/intern/node_util.h +++ b/source/blender/nodes/intern/node_util.h @@ -38,6 +38,11 @@ extern void node_free_standard_storage(struct bNode *node); extern void node_copy_curves(struct bNode *orig_node, struct bNode *new_node); extern void node_copy_standard_storage(struct bNode *orig_node, struct bNode *new_node); +const char *node_blend_label(struct bNode *node); +const char *node_math_label(struct bNode *node); +const char *node_vect_math_label(struct bNode *node); +const char *node_filter_label(struct bNode *node); + #endif // this is needed for inlining behaviour diff --git a/source/blender/python/generic/IDProp.c b/source/blender/python/generic/IDProp.c index 9e4aa88354d..ad0c96afa17 100644 --- a/source/blender/python/generic/IDProp.c +++ b/source/blender/python/generic/IDProp.c @@ -49,7 +49,7 @@ extern PyTypeObject IDGroup_Iter_Type; /*********************** ID Property Main Wrapper Stuff ***************/ -PyObject *IDGroup_repr( BPy_IDProperty *self ) +static PyObject *IDGroup_repr( BPy_IDProperty *self ) { return PyUnicode_FromFormat( "<bpy ID property from \"%s\">", self->id->name); } @@ -113,7 +113,7 @@ PyObject *BPy_IDGroup_WrapData( ID *id, IDProperty *prop ) Py_RETURN_NONE; } -int BPy_IDGroup_SetData(BPy_IDProperty *self, IDProperty *prop, PyObject *value) +static int BPy_IDGroup_SetData(BPy_IDProperty *self, IDProperty *prop, PyObject *value) { switch (prop->type) { case IDP_STRING: @@ -182,7 +182,7 @@ int BPy_IDGroup_SetData(BPy_IDProperty *self, IDProperty *prop, PyObject *value) return 0; } -PyObject *BPy_IDGroup_GetName(BPy_IDProperty *self, void *UNUSED(closure)) +static PyObject *BPy_IDGroup_GetName(BPy_IDProperty *self, void *UNUSED(closure)) { return PyUnicode_FromString(self->prop->name); } @@ -201,7 +201,7 @@ static int BPy_IDGroup_SetName(BPy_IDProperty *self, PyObject *value, void *UNUS return -1; } - strcpy(self->prop->name, st); + BLI_strncpy(self->prop->name, st, sizeof(self->prop->name)); return 0; } @@ -726,7 +726,7 @@ static PyObject *BPy_IDGroup_ConvertToPy(BPy_IDProperty *self) /* Matches python dict.get(key, [default]) */ -PyObject* BPy_IDGroup_Get(BPy_IDProperty *self, PyObject *args) +static PyObject* BPy_IDGroup_Get(BPy_IDProperty *self, PyObject *args) { IDProperty *idprop; char *key; @@ -763,23 +763,23 @@ static struct PyMethodDef BPy_IDGroup_methods[] = { "idprop.get(k[,d]) -> idprop[k] if k in idprop, else d. d defaults to None"}, {"convert_to_pyobject", (PyCFunction)BPy_IDGroup_ConvertToPy, METH_NOARGS, "return a purely python version of the group"}, - {0, NULL, 0, NULL} + {NULL, NULL, 0, NULL} }; static PySequenceMethods BPy_IDGroup_Seq = { - (lenfunc) BPy_IDGroup_Map_Len, /* lenfunc sq_length */ - 0, /* binaryfunc sq_concat */ - 0, /* ssizeargfunc sq_repeat */ - 0, /* ssizeargfunc sq_item */ /* TODO - setting this will allow PySequence_Check to return True */ - 0, /* intintargfunc ***was_sq_slice*** */ - 0, /* intobjargproc sq_ass_item */ - 0, /* ssizeobjargproc ***was_sq_ass_slice*** */ + (lenfunc) BPy_IDGroup_Map_Len, /* lenfunc sq_length */ + NULL, /* binaryfunc sq_concat */ + NULL, /* ssizeargfunc sq_repeat */ + NULL, /* ssizeargfunc sq_item */ /* TODO - setting this will allow PySequence_Check to return True */ + NULL, /* intintargfunc ***was_sq_slice*** */ + NULL, /* intobjargproc sq_ass_item */ + NULL, /* ssizeobjargproc ***was_sq_ass_slice*** */ (objobjproc) BPy_IDGroup_Contains, /* objobjproc sq_contains */ - 0, /* binaryfunc sq_inplace_concat */ - 0, /* ssizeargfunc sq_inplace_repeat */ + NULL, /* binaryfunc sq_inplace_concat */ + NULL, /* ssizeargfunc sq_inplace_repeat */ }; -PyMappingMethods BPy_IDGroup_Mapping = { +static PyMappingMethods BPy_IDGroup_Mapping = { (lenfunc)BPy_IDGroup_Map_Len, /*inquiry mp_length */ (binaryfunc)BPy_IDGroup_Map_GetItem, /*binaryfunc mp_subscript */ (objobjargproc)BPy_IDGroup_Map_SetItem, /*objobjargproc mp_ass_subscript */ @@ -890,7 +890,7 @@ static PyObject *BPy_IDArray_ConvertToPy(BPy_IDArray *self) static PyMethodDef BPy_IDArray_methods[] = { {"convert_to_pyobject", (PyCFunction)BPy_IDArray_ConvertToPy, METH_NOARGS, "return a purely python version of the group"}, - {0, NULL, 0, NULL} + {NULL, NULL, 0, NULL} }; static int BPy_IDArray_Len(BPy_IDArray *self) @@ -964,16 +964,16 @@ static int BPy_IDArray_SetItem(BPy_IDArray *self, int index, PyObject *value) static PySequenceMethods BPy_IDArray_Seq = { (lenfunc) BPy_IDArray_Len, /* inquiry sq_length */ - 0, /* binaryfunc sq_concat */ - 0, /* intargfunc sq_repeat */ + NULL, /* binaryfunc sq_concat */ + NULL, /* intargfunc sq_repeat */ (ssizeargfunc)BPy_IDArray_GetItem, /* intargfunc sq_item */ - 0, /* intintargfunc sq_slice */ - (ssizeobjargproc)BPy_IDArray_SetItem, /* intobjargproc sq_ass_item */ - 0, /* intintobjargproc sq_ass_slice */ - 0, /* objobjproc sq_contains */ + NULL, /* intintargfunc sq_slice */ + (ssizeobjargproc)BPy_IDArray_SetItem,/* intobjargproc sq_ass_item */ + NULL, /* intintobjargproc sq_ass_slice */ + NULL, /* objobjproc sq_contains */ /* Added in release 2.0 */ - 0, /* binaryfunc sq_inplace_concat */ - 0, /* intargfunc sq_inplace_repeat */ + NULL, /* binaryfunc sq_inplace_concat */ + NULL, /* intargfunc sq_inplace_repeat */ }; PyTypeObject IDArray_Type = { diff --git a/source/blender/python/generic/bgl.c b/source/blender/python/generic/bgl.c index 474259fe0e3..2b15a6f4826 100644 --- a/source/blender/python/generic/bgl.c +++ b/source/blender/python/generic/bgl.c @@ -94,9 +94,9 @@ PyTypeObject BGL_bufferType = { ( printfunc ) 0, /*tp_print */ ( getattrfunc ) Buffer_getattr, /*tp_getattr */ ( setattrfunc ) 0, /*tp_setattr */ - 0, /*tp_compare */ + NULL, /*tp_compare */ ( reprfunc ) Buffer_repr, /*tp_repr */ - 0, /*tp_as_number */ + NULL, /*tp_as_number */ &Buffer_SeqMethods, /*tp_as_sequence */ }; @@ -1124,13 +1124,13 @@ static struct PyMethodDef BGL_methods[] = { static struct PyModuleDef BGL_module_def = { PyModuleDef_HEAD_INIT, "bgl", /* m_name */ - 0, /* m_doc */ + NULL, /* m_doc */ 0, /* m_size */ BGL_methods, /* m_methods */ - 0, /* m_reload */ - 0, /* m_traverse */ - 0, /* m_clear */ - 0, /* m_free */ + NULL, /* m_reload */ + NULL, /* m_traverse */ + NULL, /* m_clear */ + NULL, /* m_free */ }; diff --git a/source/blender/python/generic/blf_py_api.c b/source/blender/python/generic/blf_py_api.c index 0c0bf1a680d..01fa402bd6f 100644 --- a/source/blender/python/generic/blf_py_api.c +++ b/source/blender/python/generic/blf_py_api.c @@ -362,7 +362,7 @@ static PyObject *py_blf_load(PyObject *UNUSED(self), PyObject *args) } /*----------------------------MODULE INIT-------------------------*/ -struct PyMethodDef BLF_methods[] = { +static PyMethodDef BLF_methods[] = { {"aspect", (PyCFunction) py_blf_aspect, METH_VARARGS, py_blf_aspect_doc}, {"blur", (PyCFunction) py_blf_blur, METH_VARARGS, py_blf_blur_doc}, {"clipping", (PyCFunction) py_blf_clipping, METH_VARARGS, py_blf_clipping_doc}, @@ -388,10 +388,10 @@ static struct PyModuleDef BLF_module_def = { BLF_doc, /* m_doc */ 0, /* m_size */ BLF_methods, /* m_methods */ - 0, /* m_reload */ - 0, /* m_traverse */ - 0, /* m_clear */ - 0, /* m_free */ + NULL, /* m_reload */ + NULL, /* m_traverse */ + NULL, /* m_clear */ + NULL, /* m_free */ }; PyObject *BPyInit_blf(void) diff --git a/source/blender/python/generic/bpy_internal_import.c b/source/blender/python/generic/bpy_internal_import.c index a1b99e12e94..f68f499a28c 100644 --- a/source/blender/python/generic/bpy_internal_import.c +++ b/source/blender/python/generic/bpy_internal_import.c @@ -212,7 +212,7 @@ static PyObject *blender_import(PyObject *UNUSED(self), PyObject *args, PyObjec PyObject *newmodule; //PyObject_Print(args, stderr, 0); - static const char *kwlist[] = {"name", "globals", "locals", "fromlist", "level", 0}; + static const char *kwlist[] = {"name", "globals", "locals", "fromlist", "level", NULL}; if( !PyArg_ParseTupleAndKeywords(args, kw, "s|OOOi:bpy_import_meth", (char **)kwlist, &name, &globals, &locals, &fromlist, &level) ) diff --git a/source/blender/python/generic/mathutils.c b/source/blender/python/generic/mathutils.c index b3bff5cf67f..f56ac6c61bf 100644 --- a/source/blender/python/generic/mathutils.c +++ b/source/blender/python/generic/mathutils.c @@ -191,7 +191,7 @@ int mathutils_any_to_rotmat(float rmat[3][3], PyObject *value, const char *error if(!BaseMath_ReadCallback((BaseMathObject *)value)) { return -1; } - else if(((MatrixObject *)value)->colSize < 3 || ((MatrixObject *)value)->rowSize < 3) { + else if(((MatrixObject *)value)->col_size < 3 || ((MatrixObject *)value)->row_size < 3) { PyErr_Format(PyExc_ValueError, "%.200s: matrix must have minimum 3x3 dimensions", error_prefix); return -1; } @@ -247,7 +247,7 @@ int EXPP_VectorsAreEqual(float *vecA, float *vecB, int size, int floatSteps) /* Mathutils Callbacks */ /* for mathutils internal use only, eventually should re-alloc but to start with we only have a few users */ -Mathutils_Callback *mathutils_callbacks[8] = {NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}; +static Mathutils_Callback *mathutils_callbacks[8] = {NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}; int Mathutils_RegisterCallback(Mathutils_Callback *cb) { @@ -334,7 +334,7 @@ void BaseMathObject_dealloc(BaseMathObject * self) } /*----------------------------MODULE INIT-------------------------*/ -struct PyMethodDef M_Mathutils_methods[] = { +static struct PyMethodDef M_Mathutils_methods[] = { {NULL, NULL, 0, NULL} }; @@ -344,10 +344,10 @@ static struct PyModuleDef M_Mathutils_module_def = { M_Mathutils_doc, /* m_doc */ 0, /* m_size */ M_Mathutils_methods, /* m_methods */ - 0, /* m_reload */ - 0, /* m_traverse */ - 0, /* m_clear */ - 0, /* m_free */ + NULL, /* m_reload */ + NULL, /* m_traverse */ + NULL, /* m_clear */ + NULL, /* m_free */ }; PyMODINIT_FUNC BPyInit_mathutils(void) diff --git a/source/blender/python/generic/mathutils_color.c b/source/blender/python/generic/mathutils_color.c index af4742e74c6..f7e62242703 100644 --- a/source/blender/python/generic/mathutils_color.c +++ b/source/blender/python/generic/mathutils_color.c @@ -457,51 +457,51 @@ static char color_doc[] = ; PyTypeObject color_Type = { PyVarObject_HEAD_INIT(NULL, 0) - "mathutils.Color", //tp_name + "mathutils.Color", //tp_name sizeof(ColorObject), //tp_basicsize 0, //tp_itemsize (destructor)BaseMathObject_dealloc, //tp_dealloc - 0, //tp_print - 0, //tp_getattr - 0, //tp_setattr - 0, //tp_compare + NULL, //tp_print + NULL, //tp_getattr + NULL, //tp_setattr + NULL, //tp_compare (reprfunc) Color_repr, //tp_repr - 0, //tp_as_number + NULL, //tp_as_number &Color_SeqMethods, //tp_as_sequence &Color_AsMapping, //tp_as_mapping - 0, //tp_hash - 0, //tp_call - 0, //tp_str - 0, //tp_getattro - 0, //tp_setattro - 0, //tp_as_buffer + NULL, //tp_hash + NULL, //tp_call + NULL, //tp_str + NULL, //tp_getattro + NULL, //tp_setattro + NULL, //tp_as_buffer Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, //tp_flags color_doc, //tp_doc - 0, //tp_traverse - 0, //tp_clear + NULL, //tp_traverse + NULL, //tp_clear (richcmpfunc)Color_richcmpr, //tp_richcompare 0, //tp_weaklistoffset - 0, //tp_iter - 0, //tp_iternext + NULL, //tp_iter + NULL, //tp_iternext Color_methods, //tp_methods - 0, //tp_members + NULL, //tp_members Color_getseters, //tp_getset - 0, //tp_base - 0, //tp_dict - 0, //tp_descr_get - 0, //tp_descr_set + NULL, //tp_base + NULL, //tp_dict + NULL, //tp_descr_get + NULL, //tp_descr_set 0, //tp_dictoffset - 0, //tp_init - 0, //tp_alloc + NULL, //tp_init + NULL, //tp_alloc Color_new, //tp_new - 0, //tp_free - 0, //tp_is_gc - 0, //tp_bases - 0, //tp_mro - 0, //tp_cache - 0, //tp_subclasses - 0, //tp_weaklist - 0 //tp_del + NULL, //tp_free + NULL, //tp_is_gc + NULL, //tp_bases + NULL, //tp_mro + NULL, //tp_cache + NULL, //tp_subclasses + NULL, //tp_weaklist + NULL //tp_del }; //------------------------newColorObject (internal)------------- //creates a new color object diff --git a/source/blender/python/generic/mathutils_euler.c b/source/blender/python/generic/mathutils_euler.c index 8792b154ca6..b6040274065 100644 --- a/source/blender/python/generic/mathutils_euler.c +++ b/source/blender/python/generic/mathutils_euler.c @@ -593,51 +593,51 @@ static char euler_doc[] = ; PyTypeObject euler_Type = { PyVarObject_HEAD_INIT(NULL, 0) - "mathutils.Euler", //tp_name + "mathutils.Euler", //tp_name sizeof(EulerObject), //tp_basicsize 0, //tp_itemsize (destructor)BaseMathObject_dealloc, //tp_dealloc - 0, //tp_print - 0, //tp_getattr - 0, //tp_setattr - 0, //tp_compare + NULL, //tp_print + NULL, //tp_getattr + NULL, //tp_setattr + NULL, //tp_compare (reprfunc) Euler_repr, //tp_repr - 0, //tp_as_number + NULL, //tp_as_number &Euler_SeqMethods, //tp_as_sequence &Euler_AsMapping, //tp_as_mapping - 0, //tp_hash - 0, //tp_call - 0, //tp_str - 0, //tp_getattro - 0, //tp_setattro - 0, //tp_as_buffer + NULL, //tp_hash + NULL, //tp_call + NULL, //tp_str + NULL, //tp_getattro + NULL, //tp_setattro + NULL, //tp_as_buffer Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, //tp_flags euler_doc, //tp_doc - 0, //tp_traverse - 0, //tp_clear + NULL, //tp_traverse + NULL, //tp_clear (richcmpfunc)Euler_richcmpr, //tp_richcompare 0, //tp_weaklistoffset - 0, //tp_iter - 0, //tp_iternext + NULL, //tp_iter + NULL, //tp_iternext Euler_methods, //tp_methods - 0, //tp_members + NULL, //tp_members Euler_getseters, //tp_getset - 0, //tp_base - 0, //tp_dict - 0, //tp_descr_get - 0, //tp_descr_set + NULL, //tp_base + NULL, //tp_dict + NULL, //tp_descr_get + NULL, //tp_descr_set 0, //tp_dictoffset - 0, //tp_init - 0, //tp_alloc + NULL, //tp_init + NULL, //tp_alloc Euler_new, //tp_new - 0, //tp_free - 0, //tp_is_gc - 0, //tp_bases - 0, //tp_mro - 0, //tp_cache - 0, //tp_subclasses - 0, //tp_weaklist - 0 //tp_del + NULL, //tp_free + NULL, //tp_is_gc + NULL, //tp_bases + NULL, //tp_mro + NULL, //tp_cache + NULL, //tp_subclasses + NULL, //tp_weaklist + NULL //tp_del }; //------------------------newEulerObject (internal)------------- //creates a new euler object diff --git a/source/blender/python/generic/mathutils_geometry.c b/source/blender/python/generic/mathutils_geometry.c index 4a1993b00ef..d1e9a2452f3 100644 --- a/source/blender/python/generic/mathutils_geometry.c +++ b/source/blender/python/generic/mathutils_geometry.c @@ -844,7 +844,7 @@ static PyObject *M_Geometry_barycentric_transform(PyObject *UNUSED(self), PyObje return newVectorObject(vec, 3, Py_NEW, NULL); } -struct PyMethodDef M_Geometry_methods[]= { +static PyMethodDef M_Geometry_methods[]= { {"intersect_ray_tri", (PyCFunction) M_Geometry_intersect_ray_tri, METH_VARARGS, M_Geometry_intersect_ray_tri_doc}, {"intersect_point_line", (PyCFunction) M_Geometry_intersect_point_line, METH_VARARGS, M_Geometry_intersect_point_line_doc}, {"intersect_point_tri_2d", (PyCFunction) M_Geometry_intersect_point_tri_2d, METH_VARARGS, M_Geometry_intersect_point_tri_2d_doc}, @@ -866,10 +866,10 @@ static struct PyModuleDef M_Geometry_module_def= { M_Geometry_doc, /* m_doc */ 0, /* m_size */ M_Geometry_methods, /* m_methods */ - 0, /* m_reload */ - 0, /* m_traverse */ - 0, /* m_clear */ - 0, /* m_free */ + NULL, /* m_reload */ + NULL, /* m_traverse */ + NULL, /* m_clear */ + NULL, /* m_free */ }; /*----------------------------MODULE INIT-------------------------*/ diff --git a/source/blender/python/generic/mathutils_matrix.c b/source/blender/python/generic/mathutils_matrix.c index ac30ddcf7f9..1da8141eef1 100644 --- a/source/blender/python/generic/mathutils_matrix.c +++ b/source/blender/python/generic/mathutils_matrix.c @@ -31,21 +31,9 @@ #include "BLI_blenlib.h" #include "BLI_utildefines.h" -#define MATRIX_APPLY_TO_COPY(matrix_meth_noargs, _self) \ - MatrixObject *ret= (MatrixObject *)Matrix_copy(_self); \ - PyObject *ret_dummy= matrix_meth_noargs(ret); \ - if(ret_dummy) { \ - Py_DECREF(ret_dummy); \ - return (PyObject *)ret; \ - } \ - else { /* error */ \ - Py_DECREF(ret); \ - return NULL; \ - } \ - - static PyObject *Matrix_copy(MatrixObject *self); static int Matrix_ass_slice(MatrixObject *self, int begin, int end, PyObject *value); +static PyObject *matrix__apply_to_copy(PyNoArgsFunction matrix_func, MatrixObject *self); /* matrix vector callbacks */ int mathutils_matrix_vector_cb_index= -1; @@ -64,7 +52,7 @@ static int mathutils_matrix_vector_get(BaseMathObject *bmo, int subtype) if(!BaseMath_ReadCallback(self)) return 0; - for(i=0; i < self->colSize; i++) + for(i=0; i < self->col_size; i++) bmo->data[i]= self->matrix[subtype][i]; return 1; @@ -78,7 +66,7 @@ static int mathutils_matrix_vector_set(BaseMathObject *bmo, int subtype) if(!BaseMath_ReadCallback(self)) return 0; - for(i=0; i < self->colSize; i++) + for(i=0; i < self->col_size; i++) self->matrix[subtype][i]= bmo->data[i]; (void)BaseMath_WriteCallback(self); @@ -161,6 +149,20 @@ static PyObject *Matrix_new(PyTypeObject *type, PyObject *args, PyObject *kwds) return NULL; } +static PyObject *matrix__apply_to_copy(PyNoArgsFunction matrix_func, MatrixObject *self) +{ + PyObject *ret= Matrix_copy(self); + PyObject *ret_dummy= matrix_func(ret); + if(ret_dummy) { + Py_DECREF(ret_dummy); + return (PyObject *)ret; + } + else { /* error */ + Py_DECREF(ret); + return NULL; + } +} + /* when a matrix is 4x4 size but initialized as a 3x3, re-assign values for 4x4 */ static void matrix_3x3_as_4x4(float mat[16]) { @@ -332,7 +334,7 @@ static PyObject *C_Matrix_Scale(PyObject *cls, PyObject *args) float mat[16] = {0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}; - if(!PyArg_ParseTuple(args, "fi|O!:Matrix.Scale", &factor, &matSize, &vec)) { + if(!PyArg_ParseTuple(args, "fi|O:Matrix.Scale", &factor, &matSize, &vec)) { return NULL; } if(matSize != 2 && matSize != 3 && matSize != 4) { @@ -598,10 +600,10 @@ void matrix_as_3x3(float mat[3][3], MatrixObject *self) /* assumes rowsize == colsize is checked and the read callback has run */ static float matrix_determinant_internal(MatrixObject *self) { - if(self->rowSize == 2) { + if(self->row_size == 2) { return determinant_m2(self->matrix[0][0], self->matrix[0][1], self->matrix[1][0], self->matrix[1][1]); - } else if(self->rowSize == 3) { + } else if(self->row_size == 3) { return determinant_m3(self->matrix[0][0], self->matrix[0][1], self->matrix[0][2], self->matrix[1][0], self->matrix[1][1], self->matrix[1][2], @@ -630,11 +632,11 @@ static PyObject *Matrix_to_quaternion(MatrixObject *self) return NULL; /*must be 3-4 cols, 3-4 rows, square matrix*/ - if((self->colSize < 3) || (self->rowSize < 3) || (self->colSize != self->rowSize)) { + if((self->col_size < 3) || (self->row_size < 3) || (self->col_size != self->row_size)) { PyErr_SetString(PyExc_AttributeError, "Matrix.to_quat(): inappropriate matrix size - expects 3x3 or 4x4 matrix"); return NULL; } - if(self->colSize == 3){ + if(self->col_size == 3){ mat3_to_quat( quat,(float (*)[3])self->contigPtr); }else{ mat4_to_quat( quat,(float (*)[4])self->contigPtr); @@ -680,9 +682,9 @@ static PyObject *Matrix_to_euler(MatrixObject *self, PyObject *args) } /*must be 3-4 cols, 3-4 rows, square matrix*/ - if(self->colSize ==3 && self->rowSize ==3) { + if(self->col_size ==3 && self->row_size ==3) { mat= (float (*)[3])self->contigPtr; - }else if (self->colSize ==4 && self->rowSize ==4) { + }else if (self->col_size ==4 && self->row_size ==4) { copy_m3_m4(tmat, (float (*)[4])self->contigPtr); mat= tmat; }else { @@ -737,9 +739,9 @@ static PyObject *Matrix_resize_4x4(MatrixObject *self) self->matrix[x] = self->contigPtr + (x * 4); } /*move data to new spot in array + clean*/ - for(blank_rows = (4 - self->rowSize); blank_rows > 0; blank_rows--){ + for(blank_rows = (4 - self->row_size); blank_rows > 0; blank_rows--){ for(x = 0; x < 4; x++){ - index = (4 * (self->rowSize + (blank_rows - 1))) + x; + index = (4 * (self->row_size + (blank_rows - 1))) + x; if (index == 10 || index == 15){ self->contigPtr[index] = 1.0f; }else{ @@ -747,11 +749,11 @@ static PyObject *Matrix_resize_4x4(MatrixObject *self) } } } - for(x = 1; x <= self->rowSize; x++){ - first_row_elem = (self->colSize * (self->rowSize - x)); - curr_pos = (first_row_elem + (self->colSize -1)); - new_pos = (4 * (self->rowSize - x )) + (curr_pos - first_row_elem); - for(blank_columns = (4 - self->colSize); blank_columns > 0; blank_columns--){ + for(x = 1; x <= self->row_size; x++){ + first_row_elem = (self->col_size * (self->row_size - x)); + curr_pos = (first_row_elem + (self->col_size -1)); + new_pos = (4 * (self->row_size - x )) + (curr_pos - first_row_elem); + for(blank_columns = (4 - self->col_size); blank_columns > 0; blank_columns--){ self->contigPtr[new_pos + blank_columns] = 0.0f; } for(curr_pos = curr_pos; curr_pos >= first_row_elem; curr_pos--){ @@ -759,8 +761,8 @@ static PyObject *Matrix_resize_4x4(MatrixObject *self) new_pos--; } } - self->rowSize = 4; - self->colSize = 4; + self->row_size = 4; + self->col_size = 4; Py_RETURN_NONE; } @@ -778,10 +780,10 @@ static PyObject *Matrix_to_4x4(MatrixObject *self) if(!BaseMath_ReadCallback(self)) return NULL; - if(self->colSize==4 && self->rowSize==4) { + if(self->col_size==4 && self->row_size==4) { return (PyObject *)newMatrixObject(self->contigPtr, 4, 4, Py_NEW, Py_TYPE(self)); } - else if(self->colSize==3 && self->rowSize==3) { + else if(self->col_size==3 && self->row_size==3) { float mat[4][4]; copy_m4_m3(mat, (float (*)[3])self->contigPtr); return (PyObject *)newMatrixObject((float *)mat, 4, 4, Py_NEW, Py_TYPE(self)); @@ -807,7 +809,7 @@ static PyObject *Matrix_to_3x3(MatrixObject *self) if(!BaseMath_ReadCallback(self)) return NULL; - if((self->colSize < 3) || (self->rowSize < 3)) { + if((self->col_size < 3) || (self->row_size < 3)) { PyErr_SetString(PyExc_AttributeError, "Matrix.to_3x3(): inappropriate matrix size"); return NULL; } @@ -830,7 +832,7 @@ static PyObject *Matrix_to_translation(MatrixObject *self) if(!BaseMath_ReadCallback(self)) return NULL; - if((self->colSize < 3) || self->rowSize < 4){ + if((self->col_size < 3) || self->row_size < 4){ PyErr_SetString(PyExc_AttributeError, "Matrix.to_translation(): inappropriate matrix size"); return NULL; } @@ -858,7 +860,7 @@ static PyObject *Matrix_to_scale(MatrixObject *self) return NULL; /*must be 3-4 cols, 3-4 rows, square matrix*/ - if((self->colSize < 3) || (self->rowSize < 3)) { + if((self->col_size < 3) || (self->row_size < 3)) { PyErr_SetString(PyExc_AttributeError, "Matrix.to_scale(): inappropriate matrix size, 3x3 minimum size"); return NULL; } @@ -877,9 +879,6 @@ static char Matrix_invert_doc[] = "\n" " Set the matrix to its inverse.\n" "\n" -" :return: an instance of itself.\n" -" :rtype: :class:`Matrix`\n" -"\n" " .. note:: :exc:`ValueError` exception is raised.\n" "\n" " .. seealso:: <http://en.wikipedia.org/wiki/Inverse_matrix>\n" @@ -895,7 +894,7 @@ static PyObject *Matrix_invert(MatrixObject *self) if(!BaseMath_ReadCallback(self)) return NULL; - if(self->rowSize != self->colSize){ + if(self->row_size != self->col_size){ PyErr_SetString(PyExc_AttributeError, "Matrix.invert(ed): only square matrices are supported"); return NULL; } @@ -905,23 +904,23 @@ static PyObject *Matrix_invert(MatrixObject *self) if(det != 0) { /*calculate the classical adjoint*/ - if(self->rowSize == 2) { + if(self->row_size == 2) { mat[0] = self->matrix[1][1]; mat[1] = -self->matrix[0][1]; mat[2] = -self->matrix[1][0]; mat[3] = self->matrix[0][0]; - } else if(self->rowSize == 3) { + } else if(self->row_size == 3) { adjoint_m3_m3((float (*)[3]) mat,(float (*)[3])self->contigPtr); - } else if(self->rowSize == 4) { + } else if(self->row_size == 4) { adjoint_m4_m4((float (*)[4]) mat, (float (*)[4])self->contigPtr); } /*divide by determinate*/ - for(x = 0; x < (self->rowSize * self->colSize); x++) { + for(x = 0; x < (self->row_size * self->col_size); x++) { mat[x] /= det; } /*set values*/ - for(x = 0; x < self->rowSize; x++) { - for(y = 0; y < self->colSize; y++) { + for(x = 0; x < self->row_size; x++) { + for(y = 0; y < self->col_size; y++) { self->matrix[x][y] = mat[z]; z++; } @@ -938,7 +937,7 @@ static PyObject *Matrix_invert(MatrixObject *self) } static char Matrix_inverted_doc[] = -".. method:: invert()\n" +".. method:: inverted()\n" "\n" " Return an inverted copy of the matrix.\n" "\n" @@ -949,7 +948,7 @@ static char Matrix_inverted_doc[] = ; static PyObject *Matrix_inverted(MatrixObject *self) { - MATRIX_APPLY_TO_COPY(Matrix_invert, self); + return matrix__apply_to_copy((PyNoArgsFunction)Matrix_invert, self); } static char Matrix_rotate_doc[] = @@ -972,7 +971,7 @@ static PyObject *Matrix_rotate(MatrixObject *self, PyObject *value) if(mathutils_any_to_rotmat(other_rmat, value, "matrix.rotate(value)") == -1) return NULL; - if(self->colSize != 3 || self->rowSize != 3) { + if(self->col_size != 3 || self->row_size != 3) { PyErr_SetString(PyExc_ValueError, "Matrix must have 3x3 dimensions"); return NULL; } @@ -1003,7 +1002,7 @@ static PyObject *Matrix_decompose(MatrixObject *self) float quat[4]; float size[3]; - if(self->colSize != 4 || self->rowSize != 4) { + if(self->col_size != 4 || self->row_size != 4) { PyErr_SetString(PyExc_AttributeError, "Matrix.decompose(): inappropriate matrix size - expects 4x4 matrix"); return NULL; } @@ -1044,7 +1043,7 @@ static PyObject *Matrix_lerp(MatrixObject *self, PyObject *args) if(!PyArg_ParseTuple(args, "O!f:lerp", &matrix_Type, &mat2, &fac)) return NULL; - if(self->rowSize != mat2->rowSize || self->colSize != mat2->colSize) { + if(self->row_size != mat2->row_size || self->col_size != mat2->col_size) { PyErr_SetString(PyExc_AttributeError, "matrix.lerp(): expects both matrix objects of the same dimensions"); return NULL; } @@ -1053,10 +1052,10 @@ static PyObject *Matrix_lerp(MatrixObject *self, PyObject *args) return NULL; /* TODO, different sized matrix */ - if(self->rowSize==4 && self->colSize==4) { + if(self->row_size==4 && self->col_size==4) { blend_m4_m4m4((float (*)[4])mat, (float (*)[4])self->contigPtr, (float (*)[4])mat2->contigPtr, fac); } - else if (self->rowSize==3 && self->colSize==3) { + else if (self->row_size==3 && self->col_size==3) { blend_m3_m3m3((float (*)[3])mat, (float (*)[3])self->contigPtr, (float (*)[3])mat2->contigPtr, fac); } else { @@ -1064,7 +1063,7 @@ static PyObject *Matrix_lerp(MatrixObject *self, PyObject *args) return NULL; } - return (PyObject*)newMatrixObject(mat, self->rowSize, self->colSize, Py_NEW, Py_TYPE(self)); + return (PyObject*)newMatrixObject(mat, self->row_size, self->col_size, Py_NEW, Py_TYPE(self)); } /*---------------------------Matrix.determinant() ----------------*/ @@ -1083,7 +1082,7 @@ static PyObject *Matrix_determinant(MatrixObject *self) if(!BaseMath_ReadCallback(self)) return NULL; - if(self->rowSize != self->colSize){ + if(self->row_size != self->col_size){ PyErr_SetString(PyExc_AttributeError, "Matrix.determinant: only square matrices are supported"); return NULL; } @@ -1105,16 +1104,16 @@ static PyObject *Matrix_transpose(MatrixObject *self) if(!BaseMath_ReadCallback(self)) return NULL; - if(self->rowSize != self->colSize){ + if(self->row_size != self->col_size){ PyErr_SetString(PyExc_AttributeError, "Matrix.transpose(d): only square matrices are supported"); return NULL; } - if(self->rowSize == 2) { + if(self->row_size == 2) { t = self->matrix[1][0]; self->matrix[1][0] = self->matrix[0][1]; self->matrix[0][1] = t; - } else if(self->rowSize == 3) { + } else if(self->row_size == 3) { transpose_m3((float (*)[3])self->contigPtr); } else { transpose_m4((float (*)[4])self->contigPtr); @@ -1134,7 +1133,7 @@ static char Matrix_transposed_doc[] = ; static PyObject *Matrix_transposed(MatrixObject *self) { - MATRIX_APPLY_TO_COPY(Matrix_transpose, self); + return matrix__apply_to_copy((PyNoArgsFunction)Matrix_transpose, self); } /*---------------------------Matrix.zero() -----------------------*/ @@ -1148,7 +1147,7 @@ static char Matrix_zero_doc[] = ; static PyObject *Matrix_zero(MatrixObject *self) { - fill_vn(self->contigPtr, self->rowSize * self->colSize, 0.0f); + fill_vn(self->contigPtr, self->row_size * self->col_size, 0.0f); if(!BaseMath_WriteCallback(self)) return NULL; @@ -1170,17 +1169,17 @@ static PyObject *Matrix_identity(MatrixObject *self) if(!BaseMath_ReadCallback(self)) return NULL; - if(self->rowSize != self->colSize){ + if(self->row_size != self->col_size){ PyErr_SetString(PyExc_AttributeError, "Matrix.identity: only square matrices are supported"); return NULL; } - if(self->rowSize == 2) { + if(self->row_size == 2) { self->matrix[0][0] = 1.0f; self->matrix[0][1] = 0.0f; self->matrix[1][0] = 0.0f; self->matrix[1][1] = 1.0f; - } else if(self->rowSize == 3) { + } else if(self->row_size == 3) { unit_m3((float (*)[3])self->contigPtr); } else { unit_m4((float (*)[4])self->contigPtr); @@ -1206,7 +1205,7 @@ static PyObject *Matrix_copy(MatrixObject *self) if(!BaseMath_ReadCallback(self)) return NULL; - return (PyObject*)newMatrixObject((float (*))self->contigPtr, self->rowSize, self->colSize, Py_NEW, Py_TYPE(self)); + return (PyObject*)newMatrixObject((float (*))self->contigPtr, self->row_size, self->col_size, Py_NEW, Py_TYPE(self)); } /*----------------------------print object (internal)-------------*/ @@ -1214,18 +1213,18 @@ static PyObject *Matrix_copy(MatrixObject *self) static PyObject *Matrix_repr(MatrixObject *self) { int x, y; - PyObject *rows[MATRIX_MAX_DIM]= {0}; + PyObject *rows[MATRIX_MAX_DIM]= {NULL}; if(!BaseMath_ReadCallback(self)) return NULL; - for(x = 0; x < self->rowSize; x++){ - rows[x]= PyTuple_New(self->colSize); - for(y = 0; y < self->colSize; y++) { + for(x = 0; x < self->row_size; x++){ + rows[x]= PyTuple_New(self->col_size); + for(y = 0; y < self->col_size; y++) { PyTuple_SET_ITEM(rows[x], y, PyFloat_FromDouble(self->matrix[x][y])); } } - switch(self->rowSize) { + switch(self->row_size) { case 2: return PyUnicode_FromFormat("Matrix(%R,\n" " %R)", rows[0], rows[1]); @@ -1255,9 +1254,9 @@ static PyObject* Matrix_richcmpr(PyObject *a, PyObject *b, int op) if(!BaseMath_ReadCallback(matA) || !BaseMath_ReadCallback(matB)) return NULL; - ok= ( (matA->colSize == matB->colSize) && - (matA->rowSize == matB->rowSize) && - EXPP_VectorsAreEqual(matA->contigPtr, matB->contigPtr, (matA->rowSize * matA->colSize), 1) + ok= ( (matA->col_size == matB->col_size) && + (matA->row_size == matB->row_size) && + EXPP_VectorsAreEqual(matA->contigPtr, matB->contigPtr, (matA->row_size * matA->col_size), 1) ) ? 0 : -1; } @@ -1287,7 +1286,7 @@ static PyObject* Matrix_richcmpr(PyObject *a, PyObject *b, int op) sequence length*/ static int Matrix_len(MatrixObject *self) { - return (self->rowSize); + return (self->row_size); } /*----------------------------object[]--------------------------- sequence accessor (get) @@ -1297,11 +1296,11 @@ static PyObject *Matrix_item(MatrixObject *self, int i) if(!BaseMath_ReadCallback(self)) return NULL; - if(i < 0 || i >= self->rowSize) { + if(i < 0 || i >= self->row_size) { PyErr_SetString(PyExc_IndexError, "matrix[attribute]: array index out of range"); return NULL; } - return newVectorObject_cb((PyObject *)self, self->colSize, mathutils_matrix_vector_cb_index, i); + return newVectorObject_cb((PyObject *)self, self->col_size, mathutils_matrix_vector_cb_index, i); } /*----------------------------object[]------------------------- sequence accessor (set) */ @@ -1312,16 +1311,16 @@ static int Matrix_ass_item(MatrixObject *self, int i, PyObject *value) if(!BaseMath_ReadCallback(self)) return -1; - if(i >= self->rowSize || i < 0){ + if(i >= self->row_size || i < 0){ PyErr_SetString(PyExc_TypeError, "matrix[attribute] = x: bad column"); return -1; } - if(mathutils_array_parse(vec, self->colSize, self->colSize, value, "matrix[i] = value assignment") < 0) { + if(mathutils_array_parse(vec, self->col_size, self->col_size, value, "matrix[i] = value assignment") < 0) { return -1; } - memcpy(self->matrix[i], vec, self->colSize *sizeof(float)); + memcpy(self->matrix[i], vec, self->col_size *sizeof(float)); (void)BaseMath_WriteCallback(self); return 0; @@ -1338,14 +1337,14 @@ static PyObject *Matrix_slice(MatrixObject *self, int begin, int end) if(!BaseMath_ReadCallback(self)) return NULL; - CLAMP(begin, 0, self->rowSize); - CLAMP(end, 0, self->rowSize); + CLAMP(begin, 0, self->row_size); + CLAMP(end, 0, self->row_size); begin= MIN2(begin,end); tuple= PyTuple_New(end - begin); for(count= begin; count < end; count++) { PyTuple_SET_ITEM(tuple, count - begin, - newVectorObject_cb((PyObject *)self, self->colSize, mathutils_matrix_vector_cb_index, count)); + newVectorObject_cb((PyObject *)self, self->col_size, mathutils_matrix_vector_cb_index, count)); } @@ -1360,8 +1359,8 @@ static int Matrix_ass_slice(MatrixObject *self, int begin, int end, PyObject *va if(!BaseMath_ReadCallback(self)) return -1; - CLAMP(begin, 0, self->rowSize); - CLAMP(end, 0, self->rowSize); + CLAMP(begin, 0, self->row_size); + CLAMP(end, 0, self->row_size); begin = MIN2(begin,end); /* non list/tuple cases */ @@ -1385,7 +1384,7 @@ static int Matrix_ass_slice(MatrixObject *self, int begin, int end, PyObject *va /*parse each sub sequence*/ PyObject *item= PySequence_Fast_GET_ITEM(value_fast, i); - if(mathutils_array_parse(&mat[i * self->colSize], self->colSize, self->colSize, item, "matrix[begin:end] = value assignment") < 0) { + if(mathutils_array_parse(&mat[i * self->col_size], self->col_size, self->col_size, item, "matrix[begin:end] = value assignment") < 0) { return -1; } } @@ -1393,7 +1392,7 @@ static int Matrix_ass_slice(MatrixObject *self, int begin, int end, PyObject *va Py_DECREF(value_fast); /*parsed well - now set in matrix*/ - memcpy(self->contigPtr + (begin * self->colSize), mat, sizeof(float) * (size * self->colSize)); + memcpy(self->contigPtr + (begin * self->col_size), mat, sizeof(float) * (size * self->col_size)); (void)BaseMath_WriteCallback(self); return 0; @@ -1417,14 +1416,14 @@ static PyObject *Matrix_add(PyObject *m1, PyObject *m2) if(!BaseMath_ReadCallback(mat1) || !BaseMath_ReadCallback(mat2)) return NULL; - if(mat1->rowSize != mat2->rowSize || mat1->colSize != mat2->colSize){ + if(mat1->row_size != mat2->row_size || mat1->col_size != mat2->col_size){ PyErr_SetString(PyExc_AttributeError, "Matrix addition: matrices must have the same dimensions for this operation"); return NULL; } - add_vn_vnvn(mat, mat1->contigPtr, mat2->contigPtr, mat1->rowSize * mat1->colSize); + add_vn_vnvn(mat, mat1->contigPtr, mat2->contigPtr, mat1->row_size * mat1->col_size); - return newMatrixObject(mat, mat1->rowSize, mat1->colSize, Py_NEW, Py_TYPE(mat1)); + return newMatrixObject(mat, mat1->row_size, mat1->col_size, Py_NEW, Py_TYPE(mat1)); } /*------------------------obj - obj------------------------------ subtraction*/ @@ -1444,22 +1443,22 @@ static PyObject *Matrix_sub(PyObject *m1, PyObject *m2) if(!BaseMath_ReadCallback(mat1) || !BaseMath_ReadCallback(mat2)) return NULL; - if(mat1->rowSize != mat2->rowSize || mat1->colSize != mat2->colSize){ + if(mat1->row_size != mat2->row_size || mat1->col_size != mat2->col_size){ PyErr_SetString(PyExc_AttributeError, "Matrix addition: matrices must have the same dimensions for this operation"); return NULL; } - sub_vn_vnvn(mat, mat1->contigPtr, mat2->contigPtr, mat1->rowSize * mat1->colSize); + sub_vn_vnvn(mat, mat1->contigPtr, mat2->contigPtr, mat1->row_size * mat1->col_size); - return newMatrixObject(mat, mat1->rowSize, mat1->colSize, Py_NEW, Py_TYPE(mat1)); + return newMatrixObject(mat, mat1->row_size, mat1->col_size, Py_NEW, Py_TYPE(mat1)); } /*------------------------obj * obj------------------------------ mulplication*/ static PyObject *matrix_mul_float(MatrixObject *mat, const float scalar) { float tmat[16]; - mul_vn_vn_fl(tmat, mat->contigPtr, mat->rowSize * mat->colSize, scalar); - return newMatrixObject(tmat, mat->rowSize, mat->colSize, Py_NEW, Py_TYPE(mat)); + mul_vn_vn_fl(tmat, mat->contigPtr, mat->row_size * mat->col_size, scalar); + return newMatrixObject(tmat, mat->row_size, mat->col_size, Py_NEW, Py_TYPE(mat)); } static PyObject *Matrix_mul(PyObject * m1, PyObject * m2) @@ -1480,7 +1479,7 @@ static PyObject *Matrix_mul(PyObject * m1, PyObject * m2) } if(mat1 && mat2) { /*MATRIX * MATRIX*/ - if(mat1->rowSize != mat2->colSize){ + if(mat1->row_size != mat2->col_size){ PyErr_SetString(PyExc_AttributeError,"Matrix multiplication: matrix A rowsize must equal matrix B colsize"); return NULL; } @@ -1492,17 +1491,17 @@ static PyObject *Matrix_mul(PyObject * m1, PyObject * m2) double dot = 0.0f; int x, y, z; - for(x = 0; x < mat2->rowSize; x++) { - for(y = 0; y < mat1->colSize; y++) { - for(z = 0; z < mat1->rowSize; z++) { + for(x = 0; x < mat2->row_size; x++) { + for(y = 0; y < mat1->col_size; y++) { + for(z = 0; z < mat1->row_size; z++) { dot += (mat1->matrix[z][y] * mat2->matrix[x][z]); } - mat[((x * mat1->colSize) + y)] = (float)dot; + mat[((x * mat1->col_size) + y)] = (float)dot; dot = 0.0f; } } - return newMatrixObject(mat, mat2->rowSize, mat1->colSize, Py_NEW, Py_TYPE(mat1)); + return newMatrixObject(mat, mat2->row_size, mat1->col_size, Py_NEW, Py_TYPE(mat1)); } } else if(mat2) { @@ -1553,12 +1552,12 @@ static PyObject *Matrix_subscript(MatrixObject* self, PyObject* item) if (i == -1 && PyErr_Occurred()) return NULL; if (i < 0) - i += self->rowSize; + i += self->row_size; return Matrix_item(self, i); } else if (PySlice_Check(item)) { Py_ssize_t start, stop, step, slicelength; - if (PySlice_GetIndicesEx((void *)item, self->rowSize, &start, &stop, &step, &slicelength) < 0) + if (PySlice_GetIndicesEx((void *)item, self->row_size, &start, &stop, &step, &slicelength) < 0) return NULL; if (slicelength <= 0) { @@ -1585,13 +1584,13 @@ static int Matrix_ass_subscript(MatrixObject* self, PyObject* item, PyObject* va if (i == -1 && PyErr_Occurred()) return -1; if (i < 0) - i += self->rowSize; + i += self->row_size; return Matrix_ass_item(self, i, value); } else if (PySlice_Check(item)) { Py_ssize_t start, stop, step, slicelength; - if (PySlice_GetIndicesEx((void *)item, self->rowSize, &start, &stop, &step, &slicelength) < 0) + if (PySlice_GetIndicesEx((void *)item, self->row_size, &start, &stop, &step, &slicelength) < 0) return -1; if (step == 1) @@ -1618,47 +1617,47 @@ static PyNumberMethods Matrix_NumMethods = { (binaryfunc) Matrix_add, /*nb_add*/ (binaryfunc) Matrix_sub, /*nb_subtract*/ (binaryfunc) Matrix_mul, /*nb_multiply*/ - 0, /*nb_remainder*/ - 0, /*nb_divmod*/ - 0, /*nb_power*/ + NULL, /*nb_remainder*/ + NULL, /*nb_divmod*/ + NULL, /*nb_power*/ (unaryfunc) 0, /*nb_negative*/ (unaryfunc) 0, /*tp_positive*/ (unaryfunc) 0, /*tp_absolute*/ (inquiry) 0, /*tp_bool*/ (unaryfunc) Matrix_inv, /*nb_invert*/ - 0, /*nb_lshift*/ + NULL, /*nb_lshift*/ (binaryfunc)0, /*nb_rshift*/ - 0, /*nb_and*/ - 0, /*nb_xor*/ - 0, /*nb_or*/ - 0, /*nb_int*/ - 0, /*nb_reserved*/ - 0, /*nb_float*/ - 0, /* nb_inplace_add */ - 0, /* nb_inplace_subtract */ - 0, /* nb_inplace_multiply */ - 0, /* nb_inplace_remainder */ - 0, /* nb_inplace_power */ - 0, /* nb_inplace_lshift */ - 0, /* nb_inplace_rshift */ - 0, /* nb_inplace_and */ - 0, /* nb_inplace_xor */ - 0, /* nb_inplace_or */ - 0, /* nb_floor_divide */ - 0, /* nb_true_divide */ - 0, /* nb_inplace_floor_divide */ - 0, /* nb_inplace_true_divide */ - 0, /* nb_index */ + NULL, /*nb_and*/ + NULL, /*nb_xor*/ + NULL, /*nb_or*/ + NULL, /*nb_int*/ + NULL, /*nb_reserved*/ + NULL, /*nb_float*/ + NULL, /* nb_inplace_add */ + NULL, /* nb_inplace_subtract */ + NULL, /* nb_inplace_multiply */ + NULL, /* nb_inplace_remainder */ + NULL, /* nb_inplace_power */ + NULL, /* nb_inplace_lshift */ + NULL, /* nb_inplace_rshift */ + NULL, /* nb_inplace_and */ + NULL, /* nb_inplace_xor */ + NULL, /* nb_inplace_or */ + NULL, /* nb_floor_divide */ + NULL, /* nb_true_divide */ + NULL, /* nb_inplace_floor_divide */ + NULL, /* nb_inplace_true_divide */ + NULL, /* nb_index */ }; static PyObject *Matrix_getRowSize(MatrixObject *self, void *UNUSED(closure)) { - return PyLong_FromLong((long) self->rowSize); + return PyLong_FromLong((long) self->row_size); } static PyObject *Matrix_getColSize(MatrixObject *self, void *UNUSED(closure)) { - return PyLong_FromLong((long) self->colSize); + return PyLong_FromLong((long) self->col_size); } static PyObject *Matrix_getMedianScale(MatrixObject *self, void *UNUSED(closure)) @@ -1669,7 +1668,7 @@ static PyObject *Matrix_getMedianScale(MatrixObject *self, void *UNUSED(closure) return NULL; /*must be 3-4 cols, 3-4 rows, square matrix*/ - if((self->colSize < 3) || (self->rowSize < 3)) { + if((self->col_size < 3) || (self->row_size < 3)) { PyErr_SetString(PyExc_AttributeError, "Matrix.median_scale: inappropriate matrix size, 3x3 minimum"); return NULL; } @@ -1685,9 +1684,9 @@ static PyObject *Matrix_getIsNegative(MatrixObject *self, void *UNUSED(closure)) return NULL; /*must be 3-4 cols, 3-4 rows, square matrix*/ - if(self->colSize == 4 && self->rowSize == 4) + if(self->col_size == 4 && self->row_size == 4) return PyBool_FromLong(is_negative_m4((float (*)[4])self->contigPtr)); - else if(self->colSize == 3 && self->rowSize == 3) + else if(self->col_size == 3 && self->row_size == 3) return PyBool_FromLong(is_negative_m3((float (*)[3])self->contigPtr)); else { PyErr_SetString(PyExc_AttributeError, "Matrix.is_negative: inappropriate matrix size - expects 3x3 or 4x4 matrix"); @@ -1756,51 +1755,51 @@ static char matrix_doc[] = ; PyTypeObject matrix_Type = { PyVarObject_HEAD_INIT(NULL, 0) - "mathutils.Matrix", /*tp_name*/ - sizeof(MatrixObject), /*tp_basicsize*/ - 0, /*tp_itemsize*/ - (destructor)BaseMathObject_dealloc, /*tp_dealloc*/ - 0, /*tp_print*/ - 0, /*tp_getattr*/ - 0, /*tp_setattr*/ - 0, /*tp_compare*/ - (reprfunc) Matrix_repr, /*tp_repr*/ - &Matrix_NumMethods, /*tp_as_number*/ - &Matrix_SeqMethods, /*tp_as_sequence*/ - &Matrix_AsMapping, /*tp_as_mapping*/ - 0, /*tp_hash*/ - 0, /*tp_call*/ - 0, /*tp_str*/ - 0, /*tp_getattro*/ - 0, /*tp_setattro*/ - 0, /*tp_as_buffer*/ + "mathutils.Matrix", /*tp_name*/ + sizeof(MatrixObject), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + (destructor)BaseMathObject_dealloc, /*tp_dealloc*/ + NULL, /*tp_print*/ + NULL, /*tp_getattr*/ + NULL, /*tp_setattr*/ + NULL, /*tp_compare*/ + (reprfunc) Matrix_repr, /*tp_repr*/ + &Matrix_NumMethods, /*tp_as_number*/ + &Matrix_SeqMethods, /*tp_as_sequence*/ + &Matrix_AsMapping, /*tp_as_mapping*/ + NULL, /*tp_hash*/ + NULL, /*tp_call*/ + NULL, /*tp_str*/ + NULL, /*tp_getattro*/ + NULL, /*tp_setattro*/ + NULL, /*tp_as_buffer*/ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /*tp_flags*/ - matrix_doc, /*tp_doc*/ - 0, /*tp_traverse*/ - 0, /*tp_clear*/ - (richcmpfunc)Matrix_richcmpr, /*tp_richcompare*/ - 0, /*tp_weaklistoffset*/ - 0, /*tp_iter*/ - 0, /*tp_iternext*/ - Matrix_methods, /*tp_methods*/ - 0, /*tp_members*/ - Matrix_getseters, /*tp_getset*/ - 0, /*tp_base*/ - 0, /*tp_dict*/ - 0, /*tp_descr_get*/ - 0, /*tp_descr_set*/ - 0, /*tp_dictoffset*/ - 0, /*tp_init*/ - 0, /*tp_alloc*/ - Matrix_new, /*tp_new*/ - 0, /*tp_free*/ - 0, /*tp_is_gc*/ - 0, /*tp_bases*/ - 0, /*tp_mro*/ - 0, /*tp_cache*/ - 0, /*tp_subclasses*/ - 0, /*tp_weaklist*/ - 0 /*tp_del*/ + matrix_doc, /*tp_doc*/ + NULL, /*tp_traverse*/ + NULL, /*tp_clear*/ + (richcmpfunc)Matrix_richcmpr, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + NULL, /*tp_iter*/ + NULL, /*tp_iternext*/ + Matrix_methods, /*tp_methods*/ + NULL, /*tp_members*/ + Matrix_getseters, /*tp_getset*/ + NULL, /*tp_base*/ + NULL, /*tp_dict*/ + NULL, /*tp_descr_get*/ + NULL, /*tp_descr_set*/ + 0, /*tp_dictoffset*/ + NULL, /*tp_init*/ + NULL, /*tp_alloc*/ + Matrix_new, /*tp_new*/ + NULL, /*tp_free*/ + NULL, /*tp_is_gc*/ + NULL, /*tp_bases*/ + NULL, /*tp_mro*/ + NULL, /*tp_cache*/ + NULL, /*tp_subclasses*/ + NULL, /*tp_weaklist*/ + NULL /*tp_del*/ }; /*------------------------newMatrixObject (internal)------------- @@ -1833,8 +1832,8 @@ PyObject *newMatrixObject(float *mat, const unsigned short rowSize, const unsign if(base_type) self = (MatrixObject *)base_type->tp_alloc(base_type, 0); else self = PyObject_NEW(MatrixObject, &matrix_Type); - self->rowSize = rowSize; - self->colSize = colSize; + self->row_size = rowSize; + self->col_size = colSize; /* init callbacks as NULL */ self->cb_user= NULL; diff --git a/source/blender/python/generic/mathutils_matrix.h b/source/blender/python/generic/mathutils_matrix.h index 125846e1ddd..7b980222048 100644 --- a/source/blender/python/generic/mathutils_matrix.h +++ b/source/blender/python/generic/mathutils_matrix.h @@ -39,8 +39,8 @@ extern PyTypeObject matrix_Type; typedef struct { BASE_MATH_MEMBERS(contigPtr) float *matrix[MATRIX_MAX_DIM]; /* ptr to the contigPtr (accessor) */ - unsigned short rowSize; - unsigned short colSize; + unsigned short row_size; + unsigned short col_size; } MatrixObject; /*struct data contains a pointer to the actual data that the @@ -49,8 +49,8 @@ be stored in py_data) or be a wrapper for data allocated through blender (stored in blend_data). This is an either/or struct not both*/ /*prototypes*/ -PyObject *newMatrixObject(float *mat, const unsigned short rowSize, const unsigned short colSize, int type, PyTypeObject *base_type); -PyObject *newMatrixObject_cb(PyObject *user, int rowSize, int colSize, int cb_type, int cb_subtype); +PyObject *newMatrixObject(float *mat, const unsigned short row_size, const unsigned short col_size, int type, PyTypeObject *base_type); +PyObject *newMatrixObject_cb(PyObject *user, int row_size, int col_size, int cb_type, int cb_subtype); extern int mathutils_matrix_vector_cb_index; extern struct Mathutils_Callback mathutils_matrix_vector_cb; diff --git a/source/blender/python/generic/mathutils_quat.c b/source/blender/python/generic/mathutils_quat.c index 56757ae5d2d..e577d808091 100644 --- a/source/blender/python/generic/mathutils_quat.c +++ b/source/blender/python/generic/mathutils_quat.c @@ -33,18 +33,7 @@ #define QUAT_SIZE 4 -#define QUAT_APPLY_TO_COPY(quat_meth_noargs, _self) \ - QuaternionObject *ret= (QuaternionObject *)Quaternion_copy(_self); \ - PyObject *ret_dummy= quat_meth_noargs(ret); \ - if(ret_dummy) { \ - Py_DECREF(ret_dummy); \ - return (PyObject *)ret; \ - } \ - else { /* error */ \ - Py_DECREF(ret); \ - return NULL; \ - } \ - +static PyObject *quat__apply_to_copy(PyNoArgsFunction quat_func, QuaternionObject *self); static PyObject *Quaternion_copy(QuaternionObject *self); //-----------------------------METHODS------------------------------ @@ -313,7 +302,7 @@ static char Quaternion_normalized_doc[] = ; static PyObject *Quaternion_normalized(QuaternionObject *self) { - QUAT_APPLY_TO_COPY(Quaternion_normalize, self); + return quat__apply_to_copy((PyNoArgsFunction)Quaternion_normalize, self); } //----------------------------Quaternion.invert()------------------ @@ -342,7 +331,7 @@ static char Quaternion_inverted_doc[] = ; static PyObject *Quaternion_inverted(QuaternionObject *self) { - QUAT_APPLY_TO_COPY(Quaternion_invert, self); + return quat__apply_to_copy((PyNoArgsFunction)Quaternion_invert, self); } //----------------------------Quaternion.identity()----------------- @@ -409,7 +398,7 @@ static char Quaternion_conjugated_doc[] = ; static PyObject *Quaternion_conjugated(QuaternionObject *self) { - QUAT_APPLY_TO_COPY(Quaternion_conjugate, self); + return quat__apply_to_copy((PyNoArgsFunction)Quaternion_conjugate, self); } //----------------------------Quaternion.copy()---------------- @@ -744,6 +733,20 @@ static PyObject *Quaternion_mul(PyObject *q1, PyObject *q2) return NULL; } +/* -obj + returns the negative of this object*/ +static PyObject *Quaternion_neg(QuaternionObject *self) +{ + float tquat[QUAT_SIZE]; + + if(!BaseMath_ReadCallback(self)) + return NULL; + + negate_v4_v4(tquat, self->quat); + return newQuaternionObject(tquat, Py_NEW, Py_TYPE(self)); +} + + //-----------------PROTOCOL DECLARATIONS-------------------------- static PySequenceMethods Quaternion_SeqMethods = { (lenfunc) Quaternion_len, /* sq_length */ @@ -768,37 +771,37 @@ static PyNumberMethods Quaternion_NumMethods = { (binaryfunc) Quaternion_add, /*nb_add*/ (binaryfunc) Quaternion_sub, /*nb_subtract*/ (binaryfunc) Quaternion_mul, /*nb_multiply*/ - 0, /*nb_remainder*/ - 0, /*nb_divmod*/ - 0, /*nb_power*/ - (unaryfunc) 0, /*nb_negative*/ + NULL, /*nb_remainder*/ + NULL, /*nb_divmod*/ + NULL, /*nb_power*/ + (unaryfunc) Quaternion_neg, /*nb_negative*/ (unaryfunc) 0, /*tp_positive*/ (unaryfunc) 0, /*tp_absolute*/ (inquiry) 0, /*tp_bool*/ (unaryfunc) 0, /*nb_invert*/ - 0, /*nb_lshift*/ + NULL, /*nb_lshift*/ (binaryfunc)0, /*nb_rshift*/ - 0, /*nb_and*/ - 0, /*nb_xor*/ - 0, /*nb_or*/ - 0, /*nb_int*/ - 0, /*nb_reserved*/ - 0, /*nb_float*/ - 0, /* nb_inplace_add */ - 0, /* nb_inplace_subtract */ - 0, /* nb_inplace_multiply */ - 0, /* nb_inplace_remainder */ - 0, /* nb_inplace_power */ - 0, /* nb_inplace_lshift */ - 0, /* nb_inplace_rshift */ - 0, /* nb_inplace_and */ - 0, /* nb_inplace_xor */ - 0, /* nb_inplace_or */ - 0, /* nb_floor_divide */ - 0, /* nb_true_divide */ - 0, /* nb_inplace_floor_divide */ - 0, /* nb_inplace_true_divide */ - 0, /* nb_index */ + NULL, /*nb_and*/ + NULL, /*nb_xor*/ + NULL, /*nb_or*/ + NULL, /*nb_int*/ + NULL, /*nb_reserved*/ + NULL, /*nb_float*/ + NULL, /* nb_inplace_add */ + NULL, /* nb_inplace_subtract */ + NULL, /* nb_inplace_multiply */ + NULL, /* nb_inplace_remainder */ + NULL, /* nb_inplace_power */ + NULL, /* nb_inplace_lshift */ + NULL, /* nb_inplace_rshift */ + NULL, /* nb_inplace_and */ + NULL, /* nb_inplace_xor */ + NULL, /* nb_inplace_or */ + NULL, /* nb_floor_divide */ + NULL, /* nb_true_divide */ + NULL, /* nb_inplace_floor_divide */ + NULL, /* nb_inplace_true_divide */ + NULL, /* nb_index */ }; static PyObject *Quaternion_getAxis( QuaternionObject *self, void *type ) @@ -953,6 +956,19 @@ static PyObject *Quaternion_new(PyTypeObject *type, PyObject *args, PyObject *kw return newQuaternionObject(quat, Py_NEW, type); } +static PyObject *quat__apply_to_copy(PyNoArgsFunction quat_func, QuaternionObject *self) +{ + PyObject *ret= Quaternion_copy(self); + PyObject *ret_dummy= quat_func(ret); + if(ret_dummy) { + Py_DECREF(ret_dummy); + return (PyObject *)ret; + } + else { /* error */ + Py_DECREF(ret); + return NULL; + } +} //-----------------------METHOD DEFINITIONS ---------------------- static struct PyMethodDef Quaternion_methods[] = { @@ -1012,47 +1028,47 @@ PyTypeObject quaternion_Type = { sizeof(QuaternionObject), //tp_basicsize 0, //tp_itemsize (destructor)BaseMathObject_dealloc, //tp_dealloc - 0, //tp_print - 0, //tp_getattr - 0, //tp_setattr - 0, //tp_compare + NULL, //tp_print + NULL, //tp_getattr + NULL, //tp_setattr + NULL, //tp_compare (reprfunc) Quaternion_repr, //tp_repr &Quaternion_NumMethods, //tp_as_number &Quaternion_SeqMethods, //tp_as_sequence &Quaternion_AsMapping, //tp_as_mapping - 0, //tp_hash - 0, //tp_call - 0, //tp_str - 0, //tp_getattro - 0, //tp_setattro - 0, //tp_as_buffer + NULL, //tp_hash + NULL, //tp_call + NULL, //tp_str + NULL, //tp_getattro + NULL, //tp_setattro + NULL, //tp_as_buffer Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, //tp_flags quaternion_doc, //tp_doc - 0, //tp_traverse - 0, //tp_clear + NULL, //tp_traverse + NULL, //tp_clear (richcmpfunc)Quaternion_richcmpr, //tp_richcompare 0, //tp_weaklistoffset - 0, //tp_iter - 0, //tp_iternext + NULL, //tp_iter + NULL, //tp_iternext Quaternion_methods, //tp_methods - 0, //tp_members + NULL, //tp_members Quaternion_getseters, //tp_getset - 0, //tp_base - 0, //tp_dict - 0, //tp_descr_get - 0, //tp_descr_set + NULL, //tp_base + NULL, //tp_dict + NULL, //tp_descr_get + NULL, //tp_descr_set 0, //tp_dictoffset - 0, //tp_init - 0, //tp_alloc + NULL, //tp_init + NULL, //tp_alloc Quaternion_new, //tp_new - 0, //tp_free - 0, //tp_is_gc - 0, //tp_bases - 0, //tp_mro - 0, //tp_cache - 0, //tp_subclasses - 0, //tp_weaklist - 0 //tp_del + NULL, //tp_free + NULL, //tp_is_gc + NULL, //tp_bases + NULL, //tp_mro + NULL, //tp_cache + NULL, //tp_subclasses + NULL, //tp_weaklist + NULL, //tp_del }; //------------------------newQuaternionObject (internal)------------- //creates a new quaternion object diff --git a/source/blender/python/generic/mathutils_vector.c b/source/blender/python/generic/mathutils_vector.c index da0da6ddba6..0da5fe983ad 100644 --- a/source/blender/python/generic/mathutils_vector.c +++ b/source/blender/python/generic/mathutils_vector.c @@ -19,7 +19,7 @@ * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. * All rights reserved. * - * + * * Contributor(s): Willian P. Germano, Joseph Gilbert, Ken Hughes, Alex Fraser, Campbell Barton * * ***** END GPL LICENSE BLOCK ***** @@ -33,18 +33,6 @@ #define MAX_DIMENSIONS 4 -#define VEC_APPLY_TO_COPY(vec_meth_noargs, _self) \ - VectorObject *ret= (VectorObject *)Vector_copy(_self); \ - PyObject *ret_dummy= vec_meth_noargs(ret); \ - if(ret_dummy) { \ - Py_DECREF(ret_dummy); \ - return (PyObject *)ret; \ - } \ - else { /* error */ \ - Py_DECREF(ret); \ - return NULL; \ - } \ - /* Swizzle axes get packed into a single value that is used as a closure. Each axis uses SWIZZLE_BITS_PER_AXIS bits. The first bit (SWIZZLE_VALID_AXIS) is used as a sentinel: if it is unset, the axis is not valid. */ @@ -77,6 +65,20 @@ static PyObject *Vector_new(PyTypeObject *type, PyObject *args, PyObject *UNUSED return newVectorObject(vec, size, Py_NEW, type); } +static PyObject *vec__apply_to_copy(PyNoArgsFunction vec_func, VectorObject *self) +{ + PyObject *ret= Vector_copy(self); + PyObject *ret_dummy= vec_func(ret); + if(ret_dummy) { + Py_DECREF(ret_dummy); + return (PyObject *)ret; + } + else { /* error */ + Py_DECREF(ret); + return NULL; + } +} + /*-----------------------------METHODS---------------------------- */ static char Vector_zero_doc[] = ".. method:: zero()\n" @@ -107,7 +109,7 @@ static PyObject *Vector_normalize(VectorObject *self) if(!BaseMath_ReadCallback(self)) return NULL; - + for(i = 0; i < self->size; i++) { norm += self->vec[i] * self->vec[i]; } @@ -115,7 +117,7 @@ static PyObject *Vector_normalize(VectorObject *self) for(i = 0; i < self->size; i++) { self->vec[i] /= norm; } - + (void)BaseMath_WriteCallback(self); Py_RETURN_NONE; } @@ -129,7 +131,7 @@ static char Vector_normalized_doc[] = ; static PyObject *Vector_normalized(VectorObject *self) { - VEC_APPLY_TO_COPY(Vector_normalize, self); + return vec__apply_to_copy((PyNoArgsFunction)Vector_normalize, self); } static char Vector_resize_2d_doc[] = @@ -150,13 +152,13 @@ static PyObject *Vector_resize_2d(VectorObject *self) PyErr_SetString(PyExc_TypeError, "vector.resize_2d(): cannot resize a vector that has an owner"); return NULL; } - + self->vec = PyMem_Realloc(self->vec, (sizeof(float) * 2)); if(self->vec == NULL) { PyErr_SetString(PyExc_MemoryError, "vector.resize_2d(): problem allocating pointer space"); return NULL; } - + self->size = 2; Py_RETURN_NONE; } @@ -179,16 +181,16 @@ static PyObject *Vector_resize_3d(VectorObject *self) PyErr_SetString(PyExc_TypeError, "vector.resize_3d(): cannot resize a vector that has an owner"); return NULL; } - + self->vec = PyMem_Realloc(self->vec, (sizeof(float) * 3)); if(self->vec == NULL) { PyErr_SetString(PyExc_MemoryError, "vector.resize_3d(): problem allocating pointer space"); return NULL; } - + if(self->size == 2) self->vec[2] = 0.0f; - + self->size = 3; Py_RETURN_NONE; } @@ -211,7 +213,7 @@ static PyObject *Vector_resize_4d(VectorObject *self) PyErr_SetString(PyExc_TypeError, "vector.resize_4d(): cannot resize a vector that has an owner"); return NULL; } - + self->vec = PyMem_Realloc(self->vec, (sizeof(float) * 4)); if(self->vec == NULL) { PyErr_SetString(PyExc_MemoryError, "vector.resize_4d(): problem allocating pointer space"); @@ -356,7 +358,7 @@ static PyObject *Vector_to_track_quat(VectorObject *self, PyObject *args ) PyErr_SetString(PyExc_TypeError, "only for 3D vectors"); return NULL; } - + if(!BaseMath_ReadCallback(self)) return NULL; @@ -435,7 +437,7 @@ static PyObject *Vector_to_track_quat(VectorObject *self, PyObject *args ) } /* - flip vector around, since vectoquat expect a vector from target to tracking object + flip vector around, since vectoquat expect a vector from target to tracking object and the python function expects the inverse (a vector to the target). */ negate_v3_v3(vec, self->vec); @@ -465,10 +467,10 @@ static PyObject *Vector_reflect(VectorObject *self, PyObject *value) float mirror[3], vec[3]; float reflect[3] = {0.0f}; float tvec[MAX_DIMENSIONS]; - + if(!BaseMath_ReadCallback(self)) return NULL; - + if((value_size= mathutils_array_parse(tvec, 2, 4, value, "vector.reflect(other), invalid 'other' arg")) == -1) return NULL; @@ -476,7 +478,7 @@ static PyObject *Vector_reflect(VectorObject *self, PyObject *value) mirror[1] = tvec[1]; if (value_size > 2) mirror[2] = tvec[2]; else mirror[2] = 0.0; - + vec[0] = self->vec[0]; vec[1] = self->vec[1]; if (self->size > 2) vec[2] = self->vec[2]; @@ -545,7 +547,7 @@ static PyObject *Vector_dot(VectorObject *self, PyObject *value) return PyFloat_FromDouble(dot); } -static char Vector_angle_doc[] = +static char Vector_angle_doc[] = ".. function:: angle(other, fallback)\n" "\n" " Return the angle between two vectors.\n" @@ -567,7 +569,7 @@ static PyObject *Vector_angle(VectorObject *self, PyObject *args) double dot = 0.0f, test_v1 = 0.0f, test_v2 = 0.0f; int x; PyObject *fallback= NULL; - + if(!PyArg_ParseTuple(args, "O|O:angle", &value, &fallback)) return NULL; @@ -757,7 +759,7 @@ static PyObject *Vector_copy(VectorObject *self) { if(!BaseMath_ReadCallback(self)) return NULL; - + return newVectorObject(self->vec, self->size, Py_NEW, Py_TYPE(self)); } @@ -792,7 +794,7 @@ static PyObject *Vector_item(VectorObject *self, int i) if(!BaseMath_ReadIndexCallback(self, i)) return NULL; - + return PyFloat_FromDouble(self->vec[i]); } /* sequence accessor (set): vector[index] = value */ @@ -811,7 +813,7 @@ static int Vector_ass_item(VectorObject *self, int i, PyObject * ob) return -1; } self->vec[i] = scalar; - + if(!BaseMath_WriteIndexCallback(self, i)) return -1; return 0; @@ -825,7 +827,7 @@ static PyObject *Vector_slice(VectorObject *self, int begin, int end) if(!BaseMath_ReadCallback(self)) return NULL; - + CLAMP(begin, 0, self->size); if (end<0) end= self->size+end+1; CLAMP(end, 0, self->size); @@ -906,12 +908,12 @@ static PyObject *Vector_iadd(PyObject * v1, PyObject * v2) } vec1 = (VectorObject*)v1; vec2 = (VectorObject*)v2; - + if(vec1->size != vec2->size) { PyErr_SetString(PyExc_AttributeError, "Vector addition: vectors must have the same dimensions for this operation"); return NULL; } - + if(!BaseMath_ReadCallback(vec1) || !BaseMath_ReadCallback(vec2)) return NULL; @@ -934,10 +936,10 @@ static PyObject *Vector_sub(PyObject * v1, PyObject * v2) } vec1 = (VectorObject*)v1; vec2 = (VectorObject*)v2; - + if(!BaseMath_ReadCallback(vec1) || !BaseMath_ReadCallback(vec2)) return NULL; - + if(vec1->size != vec2->size) { PyErr_SetString(PyExc_AttributeError, "Vector subtraction: vectors must have the same dimensions for this operation"); return NULL; @@ -959,12 +961,12 @@ static PyObject *Vector_isub(PyObject * v1, PyObject * v2) } vec1 = (VectorObject*)v1; vec2 = (VectorObject*)v2; - + if(vec1->size != vec2->size) { PyErr_SetString(PyExc_AttributeError, "Vector subtraction: vectors must have the same dimensions for this operation"); return NULL; } - + if(!BaseMath_ReadCallback(vec1) || !BaseMath_ReadCallback(vec2)) return NULL; @@ -992,9 +994,9 @@ static int column_vector_multiplication(float rvec[MAX_DIMENSIONS], VectorObject float vec_cpy[MAX_DIMENSIONS]; double dot = 0.0f; int x, y, z = 0; - - if(mat->rowSize != vec->size){ - if(mat->rowSize == 4 && vec->size == 3) { + + if(mat->row_size != vec->size){ + if(mat->row_size == 4 && vec->size == 3) { vec_cpy[3] = 1.0f; } else { @@ -1007,14 +1009,14 @@ static int column_vector_multiplication(float rvec[MAX_DIMENSIONS], VectorObject rvec[3] = 1.0f; - for(x = 0; x < mat->colSize; x++) { - for(y = 0; y < mat->rowSize; y++) { + for(x = 0; x < mat->col_size; x++) { + for(y = 0; y < mat->row_size; y++) { dot += mat->matrix[y][x] * vec_cpy[y]; } rvec[z++] = (float)dot; dot = 0.0f; } - + return 0; } @@ -1029,7 +1031,7 @@ static PyObject *Vector_mul(PyObject * v1, PyObject * v2) { VectorObject *vec1 = NULL, *vec2 = NULL; float scalar; - + if VectorObject_Check(v1) { vec1= (VectorObject *)v1; if(!BaseMath_ReadCallback(vec1)) @@ -1040,18 +1042,18 @@ static PyObject *Vector_mul(PyObject * v1, PyObject * v2) if(!BaseMath_ReadCallback(vec2)) return NULL; } - - + + /* make sure v1 is always the vector */ if (vec1 && vec2 ) { int i; double dot = 0.0f; - + if(vec1->size != vec2->size) { PyErr_SetString(PyExc_AttributeError, "Vector multiplication: vectors must have the same dimensions for this operation"); return NULL; } - + /*dot product*/ for(i = 0; i < vec1->size; i++) { dot += vec1->vec[i] * vec2->vec[i]; @@ -1108,17 +1110,17 @@ static PyObject *Vector_imul(PyObject * v1, PyObject * v2) { VectorObject *vec = (VectorObject *)v1; float scalar; - + if(!BaseMath_ReadCallback(vec)) return NULL; - + /* only support vec*=float and vec*=mat vec*=vec result is a float so that wont work */ if (MatrixObject_Check(v2)) { float rvec[MAX_DIMENSIONS]; if(!BaseMath_ReadCallback((MatrixObject *)v2)) return NULL; - + if(column_vector_multiplication(rvec, vec, (MatrixObject*)v2) == -1) return NULL; @@ -1145,7 +1147,7 @@ static PyObject *Vector_imul(PyObject * v1, PyObject * v2) PyErr_SetString(PyExc_TypeError, "Vector multiplication: arguments not acceptable for this operation"); return NULL; } - + (void)BaseMath_WriteCallback(vec); Py_INCREF( v1 ); return v1; @@ -1157,13 +1159,13 @@ static PyObject *Vector_div(PyObject * v1, PyObject * v2) int i; float vec[4], scalar; VectorObject *vec1 = NULL; - + if(!VectorObject_Check(v1)) { /* not a vector */ PyErr_SetString(PyExc_TypeError, "Vector division: Vector must be divided by a float"); return NULL; } vec1 = (VectorObject*)v1; /* vector */ - + if(!BaseMath_ReadCallback(vec1)) return NULL; @@ -1171,12 +1173,12 @@ static PyObject *Vector_div(PyObject * v1, PyObject * v2) PyErr_SetString(PyExc_TypeError, "Vector division: Vector must be divided by a float"); return NULL; } - + if(scalar==0.0) { PyErr_SetString(PyExc_ZeroDivisionError, "Vector division: divide by zero error"); return NULL; } - + for(i = 0; i < vec1->size; i++) { vec[i] = vec1->vec[i] / scalar; } @@ -1189,7 +1191,7 @@ static PyObject *Vector_idiv(PyObject * v1, PyObject * v2) int i; float scalar; VectorObject *vec1 = (VectorObject*)v1; - + if(!BaseMath_ReadCallback(vec1)) return NULL; @@ -1205,9 +1207,9 @@ static PyObject *Vector_idiv(PyObject * v1, PyObject * v2) for(i = 0; i < vec1->size; i++) { vec1->vec[i] /= scalar; } - + (void)BaseMath_WriteCallback(vec1); - + Py_INCREF( v1 ); return v1; } @@ -1217,10 +1219,10 @@ static PyObject *Vector_idiv(PyObject * v1, PyObject * v2) static PyObject *Vector_neg(VectorObject *self) { float tvec[MAX_DIMENSIONS]; - + if(!BaseMath_ReadCallback(self)) return NULL; - + negate_vn_vn(tvec, self->vec, self->size); return newVectorObject(tvec, self->size, Py_NEW, Py_TYPE(self)); } @@ -1263,7 +1265,7 @@ static PyObject* Vector_richcmpr(PyObject *objectA, PyObject *objectB, int compa if(!BaseMath_ReadCallback(vecA) || !BaseMath_ReadCallback(vecB)) return NULL; - + if (vecA->size != vecB->size){ if (comparison_type == Py_NE){ Py_RETURN_TRUE; @@ -1325,8 +1327,8 @@ static PyObject* Vector_richcmpr(PyObject *objectA, PyObject *objectB, int compa /*-----------------PROTCOL DECLARATIONS--------------------------*/ static PySequenceMethods Vector_SeqMethods = { (lenfunc) Vector_len, /* sq_length */ - (binaryfunc) 0, /* sq_concat */ - (ssizeargfunc) 0, /* sq_repeat */ + (binaryfunc) NULL, /* sq_concat */ + (ssizeargfunc) NULL, /* sq_repeat */ (ssizeargfunc) Vector_item, /* sq_item */ NULL, /* py3 deprecated slice func */ (ssizeobjargproc) Vector_ass_item, /* sq_ass_item */ @@ -1406,40 +1408,40 @@ static PyMappingMethods Vector_AsMapping = { static PyNumberMethods Vector_NumMethods = { - (binaryfunc) Vector_add, /*nb_add*/ - (binaryfunc) Vector_sub, /*nb_subtract*/ - (binaryfunc) Vector_mul, /*nb_multiply*/ - 0, /*nb_remainder*/ - 0, /*nb_divmod*/ - 0, /*nb_power*/ - (unaryfunc) Vector_neg, /*nb_negative*/ - (unaryfunc) 0, /*tp_positive*/ - (unaryfunc) 0, /*tp_absolute*/ - (inquiry) 0, /*tp_bool*/ - (unaryfunc) 0, /*nb_invert*/ - 0, /*nb_lshift*/ - (binaryfunc)0, /*nb_rshift*/ - 0, /*nb_and*/ - 0, /*nb_xor*/ - 0, /*nb_or*/ - 0, /*nb_int*/ - 0, /*nb_reserved*/ - 0, /*nb_float*/ - Vector_iadd, /* nb_inplace_add */ - Vector_isub, /* nb_inplace_subtract */ - Vector_imul, /* nb_inplace_multiply */ - 0, /* nb_inplace_remainder */ - 0, /* nb_inplace_power */ - 0, /* nb_inplace_lshift */ - 0, /* nb_inplace_rshift */ - 0, /* nb_inplace_and */ - 0, /* nb_inplace_xor */ - 0, /* nb_inplace_or */ - 0, /* nb_floor_divide */ - Vector_div, /* nb_true_divide */ - 0, /* nb_inplace_floor_divide */ - Vector_idiv, /* nb_inplace_true_divide */ - 0, /* nb_index */ + (binaryfunc) Vector_add, /*nb_add*/ + (binaryfunc) Vector_sub, /*nb_subtract*/ + (binaryfunc) Vector_mul, /*nb_multiply*/ + NULL, /*nb_remainder*/ + NULL, /*nb_divmod*/ + NULL, /*nb_power*/ + (unaryfunc) Vector_neg, /*nb_negative*/ + (unaryfunc) NULL, /*tp_positive*/ + (unaryfunc) NULL, /*tp_absolute*/ + (inquiry) NULL, /*tp_bool*/ + (unaryfunc) NULL, /*nb_invert*/ + NULL, /*nb_lshift*/ + (binaryfunc)NULL, /*nb_rshift*/ + NULL, /*nb_and*/ + NULL, /*nb_xor*/ + NULL, /*nb_or*/ + NULL, /*nb_int*/ + NULL, /*nb_reserved*/ + NULL, /*nb_float*/ + Vector_iadd, /* nb_inplace_add */ + Vector_isub, /* nb_inplace_subtract */ + Vector_imul, /* nb_inplace_multiply */ + NULL, /* nb_inplace_remainder */ + NULL, /* nb_inplace_power */ + NULL, /* nb_inplace_lshift */ + NULL, /* nb_inplace_rshift */ + NULL, /* nb_inplace_and */ + NULL, /* nb_inplace_xor */ + NULL, /* nb_inplace_or */ + NULL, /* nb_floor_divide */ + Vector_div, /* nb_true_divide */ + NULL, /* nb_inplace_floor_divide */ + Vector_idiv, /* nb_inplace_true_divide */ + NULL, /* nb_index */ }; /*------------------PY_OBECT DEFINITION--------------------------*/ @@ -1447,7 +1449,7 @@ static PyNumberMethods Vector_NumMethods = { /* * vector axis, vector.x/y/z/w */ - + static PyObject *Vector_getAxis(VectorObject *self, void *type) { return Vector_item(self, GET_INT_FROM_POINTER(type)); @@ -1463,10 +1465,10 @@ static PyObject *Vector_getLength(VectorObject *self, void *UNUSED(closure)) { double dot = 0.0f; int i; - + if(!BaseMath_ReadCallback(self)) return NULL; - + for(i = 0; i < self->size; i++){ dot += (self->vec[i] * self->vec[i]); } @@ -1477,7 +1479,7 @@ static int Vector_setLength(VectorObject *self, PyObject *value) { double dot = 0.0f, param; int i; - + if(!BaseMath_ReadCallback(self)) return -1; @@ -1485,7 +1487,7 @@ static int Vector_setLength(VectorObject *self, PyObject *value) PyErr_SetString(PyExc_TypeError, "length must be set to a number"); return -1; } - + if (param < 0.0f) { PyErr_SetString(PyExc_TypeError, "cannot set a vectors length to a negative value"); return -1; @@ -1494,27 +1496,27 @@ static int Vector_setLength(VectorObject *self, PyObject *value) fill_vn(self->vec, self->size, 0.0f); return 0; } - + for(i = 0; i < self->size; i++){ dot += (self->vec[i] * self->vec[i]); } if (!dot) /* cant sqrt zero */ return 0; - + dot = sqrt(dot); - + if (dot==param) return 0; - + dot= dot/param; - + for(i = 0; i < self->size; i++){ self->vec[i]= self->vec[i] / (float)dot; } - + (void)BaseMath_WriteCallback(self); /* checked already */ - + return 0; } @@ -1527,10 +1529,10 @@ static PyObject *Vector_getSwizzle(VectorObject *self, void *closure) size_t axis_from; float vec[MAX_DIMENSIONS]; unsigned int swizzleClosure; - + if(!BaseMath_ReadCallback(self)) return NULL; - + /* Unpack the axes from the closure into an array. */ axis_to = 0; swizzleClosure = GET_INT_FROM_POINTER(closure); @@ -1546,7 +1548,7 @@ static PyObject *Vector_getSwizzle(VectorObject *self, void *closure) swizzleClosure = swizzleClosure >> SWIZZLE_BITS_PER_AXIS; axis_to++; } - + return newVectorObject(vec, axis_to, Py_NEW, Py_TYPE(self)); } @@ -1569,13 +1571,13 @@ static int Vector_setSwizzle(VectorObject *self, PyObject * value, void *closure size_t axis_to; unsigned int swizzleClosure; - + float tvec[MAX_DIMENSIONS]; float vec_assign[MAX_DIMENSIONS]; - + if(!BaseMath_ReadCallback(self)) return -1; - + /* Check that the closure can be used with this vector: even 2D vectors have swizzles defined for axes z and w, but they would be invalid. */ swizzleClosure = GET_INT_FROM_POINTER(closure); @@ -1621,7 +1623,7 @@ static int Vector_setSwizzle(VectorObject *self, PyObject * value, void *closure memcpy(self->vec, tvec, axis_from * sizeof(float)); /* continue with BaseMathObject_WriteCallback at the end */ - + if(!BaseMath_WriteCallback(self)) return -1; else @@ -1640,7 +1642,7 @@ static PyGetSetDef Vector_getseters[] = { {(char *)"magnitude", (getter)Vector_getLength, (setter)Vector_setLength, (char *)"Vector Length.\n\n:type: float", NULL}, {(char *)"is_wrapped", (getter)BaseMathObject_getWrapped, (setter)NULL, (char *)BaseMathObject_Wrapped_doc, NULL}, {(char *)"owner", (getter)BaseMathObject_getOwner, (setter)NULL, (char *)BaseMathObject_Owner_doc, NULL}, - + /* autogenerated swizzle attrs, see python script below */ {(char *)"xx", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS)))}, // 36 {(char *)"xxx", (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, // 292 diff --git a/source/blender/python/generic/noise.c b/source/blender/python/generic/noise.c index f266a666274..36147493dc5 100644 --- a/source/blender/python/generic/noise.c +++ b/source/blender/python/generic/noise.c @@ -649,12 +649,12 @@ static struct PyModuleDef noise_module_def = { PyModuleDef_HEAD_INIT, "noise", /* m_name */ Noise__doc__, /* m_doc */ - 0, /* m_size */ + 0, /* m_size */ NoiseMethods, /* m_methods */ - 0, /* m_reload */ - 0, /* m_traverse */ - 0, /* m_clear */ - 0, /* m_free */ + NULL, /* m_reload */ + NULL, /* m_traverse */ + NULL, /* m_clear */ + NULL, /* m_free */ }; PyObject *BPyInit_noise(void) @@ -677,7 +677,7 @@ PyObject *BPyInit_noise(void) {(char *)"VORONOI_F2F1", NULL}, {(char *)"VORONOI_CRACKLE", NULL}, {(char *)"CELLNOISE", NULL}, - {0} + {NULL} }; static PyStructSequence_Desc noise_types_info_desc = { @@ -723,7 +723,7 @@ PyObject *BPyInit_noise(void) {(char *)"MINKOVSKY_HALF", NULL}, {(char *)"MINKOVSKY_FOUR", NULL}, {(char *)"MINKOVSKY", NULL}, - {0} + {NULL} }; static PyStructSequence_Desc noise_types_info_desc = { diff --git a/source/blender/python/intern/bpy.c b/source/blender/python/intern/bpy.c index be5c9a8f1e0..c315e1e2427 100644 --- a/source/blender/python/intern/bpy.c +++ b/source/blender/python/intern/bpy.c @@ -27,6 +27,7 @@ #define WITH_PYTHON /* for AUD_PyInit.h, possibly others */ +#include "bpy.h" #include "bpy_util.h" #include "bpy_rna.h" #include "bpy_app.h" @@ -60,7 +61,7 @@ static char bpy_script_paths_doc[] = " :return: (system, user) strings will be empty when not found.\n" " :rtype: tuple of strigs\n"; -PyObject *bpy_script_paths(PyObject *UNUSED(self)) +static PyObject *bpy_script_paths(PyObject *UNUSED(self)) { PyObject *ret= PyTuple_New(2); char *path; @@ -230,6 +231,10 @@ void BPy_init_modules( void ) PyModule_AddObject(mod, meth_bpy_blend_paths.ml_name, (PyObject *)PyCFunction_New(&meth_bpy_blend_paths, NULL)); PyModule_AddObject(mod, meth_bpy_user_resource.ml_name, (PyObject *)PyCFunction_New(&meth_bpy_user_resource, NULL)); + /* register funcs (bpy_rna.c) */ + PyModule_AddObject(mod, meth_bpy_register_class.ml_name, (PyObject *)PyCFunction_New(&meth_bpy_register_class, NULL)); + PyModule_AddObject(mod, meth_bpy_unregister_class.ml_name, (PyObject *)PyCFunction_New(&meth_bpy_unregister_class, NULL)); + /* add our own modules dir, this is a python package */ bpy_import_test("bpy"); } diff --git a/source/blender/python/intern/bpy_app.c b/source/blender/python/intern/bpy_app.c index 0f6fd3f6415..422563776f4 100644 --- a/source/blender/python/intern/bpy_app.c +++ b/source/blender/python/intern/bpy_app.c @@ -64,7 +64,7 @@ static PyStructSequence_Field app_info_fields[] = { {(char *)"build_cxxflags", (char *)"C++ compiler flags"}, {(char *)"build_linkflags", (char *)"Binary linking flags"}, {(char *)"build_system", (char *)"Build system used"}, - {0} + {NULL} }; static PyStructSequence_Desc app_info_desc = { @@ -192,7 +192,7 @@ static PyObject *bpy_app_driver_dict_get(PyObject *UNUSED(self), void *UNUSED(cl } -PyGetSetDef bpy_app_getsets[]= { +static PyGetSetDef bpy_app_getsets[]= { {(char *)"debug", bpy_app_debug_get, bpy_app_debug_set, (char *)"Boolean, set when blender is running in debug mode (started with -d)", NULL}, {(char *)"debug_value", bpy_app_debug_value_get, bpy_app_debug_value_set, (char *)"Int, number which can be set to non-zero values for testing purposes.", NULL}, {(char *)"tempdir", bpy_app_tempdir_get, NULL, (char *)"String, the temp directory used by blender (read-only)", NULL}, diff --git a/source/blender/python/intern/bpy_interface.c b/source/blender/python/intern/bpy_interface.c index 776f2da8507..cf47e40c2ed 100644 --- a/source/blender/python/intern/bpy_interface.c +++ b/source/blender/python/intern/bpy_interface.c @@ -151,7 +151,7 @@ void BPY_modules_update(bContext *C) } /* must be called before Py_Initialize */ -void BPY_python_start_path(void) +static void bpy_python_start_path(void) { char *py_path_bundle= BLI_get_folder(BLENDER_PYTHON, NULL); @@ -228,7 +228,12 @@ void BPY_python_start( int argc, char **argv ) /* builtin modules */ PyImport_ExtendInittab(bpy_internal_modules); - BPY_python_start_path(); /* allow to use our own included python */ + bpy_python_start_path(); /* allow to use our own included python */ + + /* Python 3.2 now looks for '2.56/python/include/python3.2d/pyconfig.h' to parse + * from the 'sysconfig' module which is used by 'site', so for now disable site. + * alternatively we could copy the file. */ + Py_NoSiteFlag= 1; Py_Initialize( ); diff --git a/source/blender/python/intern/bpy_props.c b/source/blender/python/intern/bpy_props.c index 80aeaedf940..7ed5db6e6dc 100644 --- a/source/blender/python/intern/bpy_props.c +++ b/source/blender/python/intern/bpy_props.c @@ -37,19 +37,19 @@ #include "../generic/py_capi_utils.h" -EnumPropertyItem property_flag_items[] = { +static EnumPropertyItem property_flag_items[] = { {PROP_HIDDEN, "HIDDEN", 0, "Hidden", ""}, {PROP_ANIMATABLE, "ANIMATABLE", 0, "Animateable", ""}, {0, NULL, 0, NULL, NULL}}; -EnumPropertyItem property_flag_enum_items[] = { +static EnumPropertyItem property_flag_enum_items[] = { {PROP_HIDDEN, "HIDDEN", 0, "Hidden", ""}, {PROP_ANIMATABLE, "ANIMATABLE", 0, "Animateable", ""}, {PROP_ENUM_FLAG, "ENUM_FLAG", 0, "Enum Flag", ""}, {0, NULL, 0, NULL, NULL}}; /* subtypes */ -EnumPropertyItem property_subtype_string_items[] = { +static EnumPropertyItem property_subtype_string_items[] = { {PROP_FILEPATH, "FILE_PATH", 0, "File Path", ""}, {PROP_DIRPATH, "DIR_PATH", 0, "Directory Path", ""}, {PROP_FILENAME, "FILENAME", 0, "Filename", ""}, @@ -57,7 +57,7 @@ EnumPropertyItem property_subtype_string_items[] = { {PROP_NONE, "NONE", 0, "None", ""}, {0, NULL, 0, NULL, NULL}}; -EnumPropertyItem property_subtype_number_items[] = { +static EnumPropertyItem property_subtype_number_items[] = { {PROP_UNSIGNED, "UNSIGNED", 0, "Unsigned", ""}, {PROP_PERCENTAGE, "PERCENTAGE", 0, "Percentage", ""}, {PROP_FACTOR, "FACTOR", 0, "Factor", ""}, @@ -68,7 +68,7 @@ EnumPropertyItem property_subtype_number_items[] = { {PROP_NONE, "NONE", 0, "None", ""}, {0, NULL, 0, NULL, NULL}}; -EnumPropertyItem property_subtype_array_items[] = { +static EnumPropertyItem property_subtype_array_items[] = { {PROP_COLOR, "COLOR", 0, "Color", ""}, {PROP_TRANSLATION, "TRANSLATION", 0, "Translation", ""}, {PROP_DIRECTION, "DIRECTION", 0, "Direction", ""}, @@ -639,7 +639,7 @@ static char BPy_EnumProperty_doc[] = " :type default: string or set\n" " :arg options: Enumerator in ['HIDDEN', 'ANIMATABLE', 'ENUM_FLAG'].\n" " :type options: set\n" -" :arg items: The items that make up this enumerator.\n" +" :arg items: sequence of enum items formatted: [(identifier, name, description), ...] where the identifier is used for python access and other values are used for the interface.\n" " :type items: sequence of string triplets"; static PyObject *BPy_EnumProperty(PyObject *self, PyObject *args, PyObject *kw) { diff --git a/source/blender/python/intern/bpy_rna.c b/source/blender/python/intern/bpy_rna.c index bbffbbf3b9e..b5460edbd3a 100644 --- a/source/blender/python/intern/bpy_rna.c +++ b/source/blender/python/intern/bpy_rna.c @@ -73,11 +73,11 @@ static int rna_id_write_error(PointerRNA *ptr, PyObject *key) const char *pyname; if(key && PyUnicode_Check(key)) pyname= _PyUnicode_AsString(key); else pyname= "<UNKNOWN>"; - + /* make a nice string error */ BLI_assert(idtype != NULL); PyErr_Format(PyExc_RuntimeError, "Writing to ID classes in this context is not allowed: %.200s, %.200s datablock, error setting %.200s.%.200s", id->name+2, idtype, RNA_struct_identifier(ptr->type), pyname); - + return TRUE; } } @@ -129,16 +129,16 @@ static int mathutils_rna_vector_get(BaseMathObject *bmo, int subtype) BPy_PropertyRNA *self= (BPy_PropertyRNA *)bmo->cb_user; if(self->prop==NULL) return 0; - + RNA_property_float_get_array(&self->ptr, self->prop, bmo->data); - + /* Euler order exception */ if(subtype==MATHUTILS_CB_SUBTYPE_EUL) { EulerObject *eul= (EulerObject *)bmo; PropertyRNA *prop_eul_order= NULL; eul->order= pyrna_rotation_euler_order_get(&self->ptr, &prop_eul_order, eul->order); } - + return 1; } @@ -195,7 +195,7 @@ static int mathutils_rna_vector_get_index(BaseMathObject *bmo, int UNUSED(subtyp if(self->prop==NULL) return 0; - + bmo->data[index]= RNA_property_float_get_index(&self->ptr, self->prop, index); return 1; } @@ -206,13 +206,13 @@ static int mathutils_rna_vector_set_index(BaseMathObject *bmo, int UNUSED(subtyp if(self->prop==NULL) return 0; - + #ifdef USE_PEDANTIC_WRITE if(rna_disallow_writes && rna_id_write_error(&self->ptr, NULL)) { return 0; } #endif // USE_PEDANTIC_WRITE - + if (!RNA_property_editable_flag(&self->ptr, self->prop)) { PyErr_Format(PyExc_AttributeError, "bpy_prop \"%.200s.%.200s\" is read-only", RNA_struct_identifier(self->ptr.type), RNA_property_identifier(self->prop)); return 0; @@ -228,7 +228,7 @@ static int mathutils_rna_vector_set_index(BaseMathObject *bmo, int UNUSED(subtyp return 1; } -Mathutils_Callback mathutils_rna_array_cb = { +static Mathutils_Callback mathutils_rna_array_cb = { (BaseMathCheckFunc) mathutils_rna_generic_check, (BaseMathGetFunc) mathutils_rna_vector_get, (BaseMathSetFunc) mathutils_rna_vector_set, @@ -254,7 +254,7 @@ static int mathutils_rna_matrix_get(BaseMathObject *bmo, int UNUSED(subtype)) static int mathutils_rna_matrix_set(BaseMathObject *bmo, int UNUSED(subtype)) { BPy_PropertyRNA *self= (BPy_PropertyRNA *)bmo->cb_user; - + if(self->prop==NULL) return 0; @@ -268,7 +268,7 @@ static int mathutils_rna_matrix_set(BaseMathObject *bmo, int UNUSED(subtype)) PyErr_Format(PyExc_AttributeError, "bpy_prop \"%.200s.%.200s\" is read-only", RNA_struct_identifier(self->ptr.type), RNA_property_identifier(self->prop)); return 0; } - + /* can ignore clamping here */ RNA_property_float_set_array(&self->ptr, self->prop, bmo->data); @@ -278,7 +278,7 @@ static int mathutils_rna_matrix_set(BaseMathObject *bmo, int UNUSED(subtype)) return 1; } -Mathutils_Callback mathutils_rna_matrix_cb = { +static Mathutils_Callback mathutils_rna_matrix_cb = { mathutils_rna_generic_check, mathutils_rna_matrix_get, mathutils_rna_matrix_set, @@ -534,7 +534,7 @@ static PyObject *pyrna_struct_repr(BPy_StructRNA *self) ID *id= self->ptr.id.data; if(id == NULL) return pyrna_struct_str(self); /* fallback */ - + if(RNA_struct_is_ID(self->ptr.type)) { return PyUnicode_FromFormat( "bpy.data.%s[\"%s\"]", BKE_idcode_to_name_plural(GS(id->name)), id->name+2); } @@ -549,7 +549,7 @@ static PyObject *pyrna_struct_repr(BPy_StructRNA *self) else { /* cant find, print something sane */ ret= PyUnicode_FromFormat( "bpy.data.%s[\"%s\"]...%s", BKE_idcode_to_name_plural(GS(id->name)), id->name+2, RNA_struct_identifier(self->ptr.type)); } - + return ret; } } @@ -604,10 +604,10 @@ static PyObject *pyrna_prop_repr(BPy_PropertyRNA *self) ID *id= self->ptr.id.data; PyObject *ret; const char *path; - + if(id == NULL) return pyrna_prop_str(self); /* fallback */ - + path= RNA_path_from_ID_to_property(&self->ptr, self->prop); if(path) { ret= PyUnicode_FromFormat( "bpy.data.%s[\"%s\"].%s", BKE_idcode_to_name_plural(GS(id->name)), id->name+2, path); @@ -616,7 +616,7 @@ static PyObject *pyrna_prop_repr(BPy_PropertyRNA *self) else { /* cant find, print something sane */ ret= PyUnicode_FromFormat( "bpy.data.%s[\"%s\"]...%s", BKE_idcode_to_name_plural(GS(id->name)), id->name+2, RNA_property_identifier(self->prop)); } - + return ret; } @@ -627,7 +627,7 @@ static long pyrna_struct_hash( BPy_StructRNA *self ) /* from python's meth_hash v3.1.2 */ static long pyrna_prop_hash(BPy_PropertyRNA *self) -{ +{ long x,y; if (self->ptr.data == NULL) x = 0; @@ -664,7 +664,7 @@ static const char *pyrna_enum_as_string(PointerRNA *ptr, PropertyRNA *prop) EnumPropertyItem *item; const char *result; int free= FALSE; - + RNA_property_enum_items(BPy_GetContext(), ptr, prop, &item, NULL, &free); if(item) { result= BPy_enum_as_string(item); @@ -672,10 +672,10 @@ static const char *pyrna_enum_as_string(PointerRNA *ptr, PropertyRNA *prop) else { result= ""; } - + if(free) MEM_freeN(item); - + return result; } @@ -848,7 +848,7 @@ PyObject * pyrna_prop_to_py(PointerRNA *ptr, PropertyRNA *prop) if (RNA_property_array_check(ptr, prop)) { return pyrna_py_from_array(ptr, prop); } - + /* see if we can coorce into a python type - PropertyType */ switch (type) { case PROP_BOOLEAN: @@ -904,7 +904,7 @@ PyObject * pyrna_prop_to_py(PointerRNA *ptr, PropertyRNA *prop) ret = NULL; break; } - + return ret; } @@ -972,22 +972,22 @@ static PyObject *pyrna_func_to_py(BPy_DummyPointerRNA *pyrna, FunctionRNA *func) static PyMethodDef func_meth = {"<generic rna function>", (PyCFunction)pyrna_func_call, METH_VARARGS|METH_KEYWORDS, "python rna function"}; PyObject *self; PyObject *ret; - + if(func==NULL) { PyErr_Format(PyExc_RuntimeError, "%.200s: type attempted to get NULL function", RNA_struct_identifier(pyrna->ptr.type)); return NULL; } self= PyTuple_New(2); - + PyTuple_SET_ITEM(self, 0, (PyObject *)pyrna); Py_INCREF(pyrna); PyTuple_SET_ITEM(self, 1, PyCapsule_New((void *)func, NULL, NULL)); - + ret= PyCFunction_New(&func_meth, self); Py_DECREF(self); - + return ret; } @@ -997,7 +997,7 @@ static int pyrna_py_to_prop(PointerRNA *ptr, PropertyRNA *prop, void *data, PyOb { /* XXX hard limits should be checked here */ int type = RNA_property_type(prop); - + if (RNA_property_array_check(ptr, prop)) { @@ -1025,7 +1025,7 @@ static int pyrna_py_to_prop(PointerRNA *ptr, PropertyRNA *prop, void *data, PyOb } else { /* Normal Property (not an array) */ - + /* see if we can coorce into a python type - PropertyType */ switch (type) { case PROP_BOOLEAN: @@ -1038,7 +1038,7 @@ static int pyrna_py_to_prop(PointerRNA *ptr, PropertyRNA *prop, void *data, PyOb param = PyObject_IsTrue( value ); else param = PyLong_AsLong( value ); - + if(param < 0) { PyErr_Format(PyExc_TypeError, "%.200s %.200s.%.200s expected True/False or 0/1", error_prefix, RNA_struct_identifier(ptr->type), RNA_property_identifier(prop)); return -1; @@ -1138,13 +1138,13 @@ static int pyrna_py_to_prop(PointerRNA *ptr, PropertyRNA *prop, void *data, PyOb if(data) *((int*)data)= val; else RNA_property_enum_set(ptr, prop, val); - + break; } case PROP_POINTER: { PyObject *value_new= NULL; - + StructRNA *ptype= RNA_property_pointer_type(ptr, prop); int flag = RNA_property_flag(prop); @@ -1152,10 +1152,10 @@ static int pyrna_py_to_prop(PointerRNA *ptr, PropertyRNA *prop, void *data, PyOb * layout.prop(self, "filepath") * ... which infact should be * layout.prop(self.properties, "filepath") - * + * * we need to do this trick. * if the prop is not an operator type and the pyobject is an operator, use its properties in place of its self. - * + * * this is so bad that its almost a good reason to do away with fake 'self.properties -> self' class mixing * if this causes problems in the future it should be removed. */ @@ -1221,7 +1221,7 @@ static int pyrna_py_to_prop(PointerRNA *ptr, PropertyRNA *prop, void *data, PyOb else { /* data==NULL, assign to RNA */ if(value == Py_None) { - PointerRNA valueptr= {{0}}; + PointerRNA valueptr= {{NULL}}; RNA_property_pointer_set(ptr, prop, valueptr); } else if(RNA_struct_is_a(param->ptr.type, ptype)) { @@ -1234,7 +1234,7 @@ static int pyrna_py_to_prop(PointerRNA *ptr, PropertyRNA *prop, void *data, PyOb Py_XDECREF(value_new); return -1; } } - + if(raise_error) { PointerRNA tmp; RNA_pointer_create(NULL, ptype, NULL, &tmp); @@ -1242,7 +1242,7 @@ static int pyrna_py_to_prop(PointerRNA *ptr, PropertyRNA *prop, void *data, PyOb Py_XDECREF(value_new); return -1; } } - + Py_XDECREF(value_new); break; @@ -1256,7 +1256,7 @@ static int pyrna_py_to_prop(PointerRNA *ptr, PropertyRNA *prop, void *data, PyOb CollectionPointerLink *link; lb= (data)? (ListBase*)data: NULL; - + /* convert a sequence of dict's into a collection */ if(!PySequence_Check(value)) { PyErr_Format(PyExc_TypeError, "%.200s %.200s.%.200s expected a sequence for an RNA collection, found a '%.200s' instead", error_prefix, RNA_struct_identifier(ptr->type), RNA_property_identifier(prop), Py_TYPE(value)->tp_name); @@ -1299,7 +1299,7 @@ static int pyrna_py_to_prop(PointerRNA *ptr, PropertyRNA *prop, void *data, PyOb } Py_DECREF(item); } - + break; } default: @@ -1343,7 +1343,7 @@ static int pyrna_py_to_prop_array_index(BPy_PropertyArrayRNA *self, int index, P case PROP_BOOLEAN: { int param = PyLong_AsLong( value ); - + if( param < 0 || param > 1) { PyErr_SetString(PyExc_TypeError, "expected True/False or 0/1"); ret = -1; @@ -1541,7 +1541,7 @@ static PyObject *pyrna_prop_array_subscript_slice(BPy_PropertyArrayRNA *self, Po if(length > PYRNA_STACK_ARRAY) { values= PyMem_MALLOC(sizeof(float) * length); } else { values= values_stack; } RNA_property_float_get_array(ptr, prop, values); - + for(count=start; count<stop; count++) PyTuple_SET_ITEM(tuple, count-start, PyFloat_FromDouble(values[count])); @@ -1731,7 +1731,7 @@ static int prop_subscript_ass_array_slice(PointerRNA *ptr, PropertyRNA *prop, in else { values= values_stack; } if(start != 0 || stop != length) /* partial assignment? - need to get the array */ RNA_property_float_get_array(ptr, prop, values); - + for(count=start; count<stop; count++) { fval = PyFloat_AsDouble(PySequence_Fast_GET_ITEM(value, count-start)); CLAMP(fval, min, max); @@ -1751,7 +1751,7 @@ static int prop_subscript_ass_array_slice(PointerRNA *ptr, PropertyRNA *prop, in if(start != 0 || stop != length) /* partial assignment? - need to get the array */ RNA_property_boolean_get_array(ptr, prop, values); - + for(count=start; count<stop; count++) values[count] = PyLong_AsLong(PySequence_Fast_GET_ITEM(value, count-start)); @@ -1789,11 +1789,11 @@ static int prop_subscript_ass_array_slice(PointerRNA *ptr, PropertyRNA *prop, in } Py_DECREF(value); - + if(values_alloc) { PyMem_FREE(values_alloc); } - + return ret; } @@ -1940,10 +1940,10 @@ static int pyrna_struct_contains(BPy_StructRNA *self, PyObject *value) } group= RNA_struct_idprops(&self->ptr, 0); - + if(!group) return 0; - + return IDP_GetPropertyFromGroup(group, name) ? 1:0; } @@ -2131,12 +2131,12 @@ static int pyrna_struct_anim_args_parse(PointerRNA *ptr, const char *error_prefi const int is_idbase= RNA_struct_is_ID(ptr->type); PropertyRNA *prop; PointerRNA r_ptr; - + if (ptr->data==NULL) { PyErr_Format(PyExc_TypeError, "%.200s this struct has no data, can't be animated", error_prefix); return -1; } - + /* full paths can only be given from ID base */ if(is_idbase) { int r_index= -1; @@ -2152,10 +2152,10 @@ static int pyrna_struct_anim_args_parse(PointerRNA *ptr, const char *error_prefi return -1; } } - else { + else { prop = RNA_struct_find_property(ptr, path); r_ptr= *ptr; - } + } if (prop==NULL) { PyErr_Format(PyExc_TypeError, "%.200s property \"%s\" not found", error_prefix, path); @@ -2183,13 +2183,13 @@ static int pyrna_struct_anim_args_parse(PointerRNA *ptr, const char *error_prefi return -1; } } - + if(is_idbase) { *path_full= BLI_strdup(path); } else { *path_full= RNA_path_from_ID_to_property(&r_ptr, prop); - + if (*path_full==NULL) { PyErr_Format(PyExc_TypeError, "%.200s could not make path to \"%s\"", error_prefix, path); return -1; @@ -2210,9 +2210,9 @@ static int pyrna_struct_keyframe_parse(PointerRNA *ptr, PyObject *args, PyObject if (!PyArg_ParseTupleAndKeywords(args, kw, parse_str, (char **)kwlist, &path, index, cfra, group_name)) return -1; - if(pyrna_struct_anim_args_parse(ptr, error_prefix, path, path_full, index) < 0) + if(pyrna_struct_anim_args_parse(ptr, error_prefix, path, path_full, index) < 0) return -1; - + if(*cfra==FLT_MAX) *cfra= CTX_data_scene(BPy_GetContext())->r.cfra; @@ -2444,7 +2444,7 @@ static PyObject *pyrna_struct_is_property_set(BPy_StructRNA *self, PyObject *arg /* double property lookup, could speed up */ /* return PyBool_FromLong(RNA_property_is_set(&self->ptr, name)); */ if(RNA_property_flag(prop) & PROP_IDPROPERTY) { - IDProperty *group= RNA_struct_idprops(&self->ptr, 0); + IDProperty *group= RNA_struct_idprops(&self->ptr, 0); if(group) { ret= IDP_GetPropertyFromGroup(group, name) ? 1:0; } @@ -2455,7 +2455,7 @@ static PyObject *pyrna_struct_is_property_set(BPy_StructRNA *self, PyObject *arg else { ret= 1; } - + return PyBool_FromLong(ret); } @@ -2740,7 +2740,7 @@ static PyObject *pyrna_struct_getattro( BPy_StructRNA *self, PyObject *pyname ) PyObject *ret; PropertyRNA *prop; FunctionRNA *func; - + if(name == NULL) { PyErr_SetString(PyExc_AttributeError, "bpy_struct: __getattr__ must be a string"); ret = NULL; @@ -2790,9 +2790,9 @@ static PyObject *pyrna_struct_getattro( BPy_StructRNA *self, PyObject *pyname ) { CollectionPointerLink *link; PyObject *linkptr; - + ret = PyList_New(0); - + for(link=newlb.first; link; link=link->next) { linkptr= pyrna_struct_CreatePyObject(&link->ptr); PyList_Append(ret, linkptr); @@ -2834,7 +2834,7 @@ static PyObject *pyrna_struct_getattro( BPy_StructRNA *self, PyObject *pyname ) /* The error raised here will be displayed */ ret = PyObject_GenericGetAttr((PyObject *)self, pyname); } - + return ret; } @@ -2895,7 +2895,7 @@ static int pyrna_struct_meta_idprop_setattro(PyObject *cls, PyObject *attr, PyOb } /* srna_from_self may set an error */ - PyErr_Clear(); + PyErr_Clear(); return PyType_Type.tp_setattro(cls, attr, value); } @@ -2931,7 +2931,7 @@ static int pyrna_struct_meta_idprop_setattro(PyObject *cls, PyObject *attr, PyOb /* fallback to standard py, delattr/setattr */ return PyType_Type.tp_setattro(cls, attr, value); } - + static int pyrna_struct_setattro( BPy_StructRNA *self, PyObject *pyname, PyObject *value ) { const char *name = _PyUnicode_AsString(pyname); @@ -3178,7 +3178,7 @@ static PyObject *pyrna_prop_collection_keys(BPy_PropertyRNA *self) } } RNA_PROP_END; - + return ret; } @@ -3211,7 +3211,7 @@ static PyObject *pyrna_prop_collection_items(BPy_PropertyRNA *self) } } RNA_PROP_END; - + return ret; } @@ -3278,13 +3278,13 @@ static PyObject *pyrna_struct_as_pointer(BPy_StructRNA *self) static PyObject *pyrna_prop_collection_get(BPy_PropertyRNA *self, PyObject *args) { PointerRNA newptr; - + const char *key; PyObject* def = Py_None; if (!PyArg_ParseTuple(args, "s|O:get", &key, &def)) return NULL; - + if(RNA_property_collection_lookup_string(&self->ptr, self->prop, key, &newptr)) return pyrna_struct_CreatePyObject(&newptr); @@ -3572,14 +3572,14 @@ static PyObject *pyrna_prop_collection_foreach_set(BPy_PropertyRNA *self, PyObj /* A bit of a kludge, make a list out of a collection or array, * then return the lists iter function, not especially fast but convenient for now */ -PyObject *pyrna_prop_array_iter(BPy_PropertyArrayRNA *self) +static PyObject *pyrna_prop_array_iter(BPy_PropertyArrayRNA *self) { /* Try get values from a collection */ PyObject *ret; PyObject *iter= NULL; int len= pyrna_prop_array_length(self); ret = pyrna_prop_array_subscript_slice(self, &self->ptr, self->prop, 0, len, len); - + /* we know this is a list so no need to PyIter_Check * otherwise it could be NULL (unlikely) if conversion failed */ if(ret) { @@ -3590,13 +3590,13 @@ PyObject *pyrna_prop_array_iter(BPy_PropertyArrayRNA *self) return iter; } -PyObject *pyrna_prop_collection_iter(BPy_PropertyRNA *self) +static PyObject *pyrna_prop_collection_iter(BPy_PropertyRNA *self) { /* Try get values from a collection */ PyObject *ret; PyObject *iter= NULL; ret= pyrna_prop_collection_values(self); - + /* we know this is a list so no need to PyIter_Check * otherwise it could be NULL (unlikely) if conversion failed */ if(ret) { @@ -3607,6 +3607,11 @@ PyObject *pyrna_prop_collection_iter(BPy_PropertyRNA *self) return iter; } +static PyObject *pyrna_struct_is_registered(PyObject *cls) +{ + return PyBool_FromLong(PyDict_GetItemString((((PyTypeObject *)cls)->tp_dict), "bl_rna") != NULL); +} + static struct PyMethodDef pyrna_struct_methods[] = { /* only for PointerRNA's with ID'props */ @@ -3632,6 +3637,9 @@ static struct PyMethodDef pyrna_struct_methods[] = { /* experemental */ {"callback_add", (PyCFunction)pyrna_callback_add, METH_VARARGS, NULL}, {"callback_remove", (PyCFunction)pyrna_callback_remove, METH_VARARGS, NULL}, + + /* class method */ + {"is_registered", (PyCFunction) pyrna_struct_is_registered, METH_NOARGS | METH_CLASS, NULL}, {NULL, NULL, 0, NULL} }; @@ -3652,7 +3660,7 @@ static struct PyMethodDef pyrna_prop_collection_methods[] = { {"keys", (PyCFunction)pyrna_prop_collection_keys, METH_NOARGS, NULL}, {"items", (PyCFunction)pyrna_prop_collection_items, METH_NOARGS,NULL}, {"values", (PyCFunction)pyrna_prop_collection_values, METH_NOARGS, NULL}, - + {"get", (PyCFunction)pyrna_prop_collection_get, METH_VARARGS, NULL}, {NULL, NULL, 0, NULL} }; @@ -3669,7 +3677,7 @@ static struct PyMethodDef pyrna_prop_collection_idprop_methods[] = { static PyObject * pyrna_struct_new(PyTypeObject *type, PyObject *args, PyObject *UNUSED(kwds)) { BPy_StructRNA *base; - + if (!PyArg_ParseTuple(args, "O!:bpy_struct.__new__", &pyrna_struct_Type, &base)) return NULL; @@ -3692,10 +3700,10 @@ static PyObject * pyrna_struct_new(PyTypeObject *type, PyObject *args, PyObject static PyObject * pyrna_prop_new(PyTypeObject *type, PyObject *args, PyObject *UNUSED(kwds)) { BPy_PropertyRNA *base; - + if (!PyArg_ParseTuple(args, "O!:bpy_prop.__new__", &pyrna_prop_Type, &base)) return NULL; - + if (type == Py_TYPE(base)) { Py_INCREF(base); return (PyObject *)base; @@ -3711,7 +3719,7 @@ static PyObject * pyrna_prop_new(PyTypeObject *type, PyObject *args, PyObject *U } } -PyObject *pyrna_param_to_py(PointerRNA *ptr, PropertyRNA *prop, void *data) +static PyObject *pyrna_param_to_py(PointerRNA *ptr, PropertyRNA *prop, void *data) { PyObject *ret; int type = RNA_property_type(prop); @@ -3897,12 +3905,12 @@ static PyObject * pyrna_func_call(PyObject *self, PyObject *args, PyObject *kw) PyErr_SetString(PyExc_RuntimeError, "rna functions internal rna pointer is NULL, this is a bug. aborting"); return NULL; } - + if(self_func==NULL) { PyErr_Format(PyExc_RuntimeError, "%.200s.<unknown>(): rna function internal function is NULL, this is a bug. aborting", RNA_struct_identifier(self_ptr->type)); return NULL; } - + /* include the ID pointer for pyrna_param_to_py() so we can include the * ID pointer on return values, this only works when returned values have * the same ID as the functions. */ @@ -3983,7 +3991,7 @@ static PyObject * pyrna_func_call(PyObject *self, PyObject *args, PyObject *kw) break; } } - + RNA_parameter_list_end(&iter); /* Check if we gave args that dont exist in the function @@ -4467,7 +4475,7 @@ PyTypeObject pyrna_prop_collection_Type = { }; /* only for add/remove/move methods */ -PyTypeObject pyrna_prop_collection_idprop_Type = { +static PyTypeObject pyrna_prop_collection_idprop_Type = { PyVarObject_HEAD_INIT(NULL, 0) "bpy_prop_collection_idprop", /* tp_name */ sizeof( BPy_PropertyRNA ), /* tp_basicsize */ @@ -4886,10 +4894,6 @@ static PyObject *pyrna_basetype_getattro( BPy_BaseTypeRNA *self, PyObject *pynam PyErr_SetString(PyExc_AttributeError, "bpy.types: __getattr__ must be a string"); ret = NULL; } - else if(strcmp(name, "register")==0) { - /* this is called so often, make an exception and save a full lookup on all types */ - ret= PyObject_GenericGetAttr((PyObject *)self, pyname); - } else if (RNA_property_collection_lookup_string(&self->ptr, self->prop, name, &newptr)) { ret= pyrna_struct_Subtype(&newptr); if (ret==NULL) { @@ -4909,33 +4913,35 @@ static PyObject *pyrna_basetype_getattro( BPy_BaseTypeRNA *self, PyObject *pynam } static PyObject *pyrna_basetype_dir(BPy_BaseTypeRNA *self); -static PyObject *pyrna_basetype_register(PyObject *self, PyObject *py_class); -static PyObject *pyrna_basetype_unregister(PyObject *self, PyObject *py_class); +static PyObject *pyrna_register_class(PyObject *self, PyObject *py_class); +static PyObject *pyrna_unregister_class(PyObject *self, PyObject *py_class); static struct PyMethodDef pyrna_basetype_methods[] = { {"__dir__", (PyCFunction)pyrna_basetype_dir, METH_NOARGS, ""}, - {"register", (PyCFunction)pyrna_basetype_register, METH_O, ""}, - {"unregister", (PyCFunction)pyrna_basetype_unregister, METH_O, ""}, {NULL, NULL, 0, NULL} }; static PyObject *pyrna_basetype_dir(BPy_BaseTypeRNA *self) { - PyObject *list, *name; + PyObject *list; +#if 0 + PyObject *name; PyMethodDef *meth; - +#endif + list= pyrna_prop_collection_keys(self); /* like calling structs.keys(), avoids looping here */ +#if 0 /* for now only contains __dir__ */ for(meth=pyrna_basetype_methods; meth->ml_name; meth++) { name = PyUnicode_FromString(meth->ml_name); PyList_Append(list, name); Py_DECREF(name); } - +#endif return list; } -PyTypeObject pyrna_basetype_Type = BLANK_PYTHON_TYPE; +static PyTypeObject pyrna_basetype_Type = BLANK_PYTHON_TYPE; PyObject *BPY_rna_types(void) { @@ -5632,8 +5638,16 @@ void pyrna_free_types(void) * the decref. This is not so bad because the leak only happens when re-registering (hold F8) * - Should still be fixed - Campbell * */ - -static PyObject *pyrna_basetype_register(PyObject *UNUSED(self), PyObject *py_class) +static char pyrna_register_class_doc[] = +".. method:: register_class(cls)\n" +"\n" +" Register a subclass of a blender type in (:class:`Panel`, :class:`Menu`, :class:`Header`, :class:`Operator`, :class:`KeyingSetInfo`, :class:`RenderEngine`).\n" +"\n" +" .. note:: :exc:`ValueError` exception is raised if the class is not a subclass of a registerable blender class.\n" +"\n" +; +PyMethodDef meth_bpy_register_class = {"register_class", pyrna_register_class, METH_O, pyrna_register_class_doc}; +static PyObject *pyrna_register_class(PyObject *UNUSED(self), PyObject *py_class) { bContext *C= NULL; ReportList reports; @@ -5643,19 +5657,19 @@ static PyObject *pyrna_basetype_register(PyObject *UNUSED(self), PyObject *py_cl const char *identifier; if(PyDict_GetItemString(((PyTypeObject*)py_class)->tp_dict, "bl_rna")) { - PyErr_SetString(PyExc_AttributeError, "bpy.types.register(...): already registered as a subclass"); + PyErr_SetString(PyExc_AttributeError, "register_class(...): already registered as a subclass"); return NULL; } /* warning: gets parent classes srna, only for the register function */ - srna= pyrna_struct_as_srna(py_class, 1, "bpy.types.register(...):"); + srna= pyrna_struct_as_srna(py_class, 1, "register_class(...):"); if(srna==NULL) return NULL; /* fails in cases, cant use this check but would like to :| */ /* if(RNA_struct_py_type_get(srna)) { - PyErr_Format(PyExc_ValueError, "bpy.types.register(...): %.200s's parent class %.200s is alredy registered, this is not allowed", ((PyTypeObject*)py_class)->tp_name, RNA_struct_identifier(srna)); + PyErr_Format(PyExc_ValueError, "register_class(...): %.200s's parent class %.200s is alredy registered, this is not allowed", ((PyTypeObject*)py_class)->tp_name, RNA_struct_identifier(srna)); return NULL; } */ @@ -5664,7 +5678,7 @@ static PyObject *pyrna_basetype_register(PyObject *UNUSED(self), PyObject *py_cl reg= RNA_struct_register(srna); if(!reg) { - PyErr_Format(PyExc_ValueError, "bpy.types.register(...): expected a subclass of a registerable rna type (%.200s does not support registration)", RNA_struct_identifier(srna)); + PyErr_Format(PyExc_ValueError, "register_class(...): expected a subclass of a registerable rna type (%.200s does not support registration)", RNA_struct_identifier(srna)); return NULL; } @@ -5729,7 +5743,13 @@ static int pyrna_srna_contains_pointer_prop_srna(StructRNA *srna_props, StructRN return 0; } -static PyObject *pyrna_basetype_unregister(PyObject *UNUSED(self), PyObject *py_class) +static char pyrna_unregister_class_doc[] = +".. method:: unregister_class(cls)\n" +"\n" +" Unload the python class from blender.\n" +; +PyMethodDef meth_bpy_unregister_class = {"unregister_class", pyrna_unregister_class, METH_O, pyrna_unregister_class_doc}; +static PyObject *pyrna_unregister_class(PyObject *UNUSED(self), PyObject *py_class) { bContext *C= NULL; StructUnregisterFunc unreg; @@ -5737,11 +5757,11 @@ static PyObject *pyrna_basetype_unregister(PyObject *UNUSED(self), PyObject *py_ /*if(PyDict_GetItemString(((PyTypeObject*)py_class)->tp_dict, "bl_rna")==NULL) { PWM_cursor_wait(0); - PyErr_SetString(PyExc_ValueError, "bpy.types.unregister(): not a registered as a subclass"); + PyErr_SetString(PyExc_ValueError, "unregister_class(): not a registered as a subclass"); return NULL; }*/ - srna= pyrna_struct_as_srna(py_class, 0, "bpy.types.unregister(...):"); + srna= pyrna_struct_as_srna(py_class, 0, "unregister_class(...):"); if(srna==NULL) return NULL; @@ -5749,7 +5769,7 @@ static PyObject *pyrna_basetype_unregister(PyObject *UNUSED(self), PyObject *py_ unreg= RNA_struct_unregister(srna); if(!unreg) { - PyErr_SetString(PyExc_ValueError, "bpy.types.unregister(...): expected a Type subclassed from a registerable rna type (no unregister supported)"); + PyErr_SetString(PyExc_ValueError, "unregister_class(...): expected a Type subclassed from a registerable rna type (no unregister supported)"); return NULL; } @@ -5776,7 +5796,7 @@ static PyObject *pyrna_basetype_unregister(PyObject *UNUSED(self), PyObject *py_ RNA_PROP_END; if(prop_identifier) { - PyErr_Format(PyExc_SystemError, "bpy.types.unregister(...): Cant unregister %s because %s.%s pointer property is using this", RNA_struct_identifier(srna), RNA_struct_identifier(srna_iter), prop_identifier); + PyErr_Format(PyExc_SystemError, "unregister_class(...): Cant unregister %s because %s.%s pointer property is using this", RNA_struct_identifier(srna), RNA_struct_identifier(srna_iter), prop_identifier); return NULL; } } diff --git a/source/blender/python/intern/bpy_rna.h b/source/blender/python/intern/bpy_rna.h index 31954eb6828..bbcc85581b2 100644 --- a/source/blender/python/intern/bpy_rna.h +++ b/source/blender/python/intern/bpy_rna.h @@ -112,4 +112,8 @@ int pyrna_write_check(void); void BPY_modules_update(struct bContext *C); //XXX temp solution +/* bpy.utils.(un)register_class */ +extern PyMethodDef meth_bpy_register_class; +extern PyMethodDef meth_bpy_unregister_class; + #endif diff --git a/source/blender/python/intern/bpy_rna_callback.c b/source/blender/python/intern/bpy_rna_callback.c index 6d4cc035ece..28b540ba418 100644 --- a/source/blender/python/intern/bpy_rna_callback.c +++ b/source/blender/python/intern/bpy_rna_callback.c @@ -24,6 +24,7 @@ #include "bpy_rna.h" +#include "bpy_rna_callback.h" #include "bpy_util.h" #include "BLI_utildefines.h" @@ -37,7 +38,7 @@ #define RNA_CAPSULE_ID "RNA_HANDLE" #define RNA_CAPSULE_ID_INVALID "RNA_HANDLE_REMOVED" -void cb_region_draw(const bContext *C, ARegion *UNUSED(ar), void *customdata) +static void cb_region_draw(const bContext *C, ARegion *UNUSED(ar), void *customdata) { PyObject *cb_func, *cb_args, *result; PyGILState_STATE gilstate; diff --git a/source/blender/python/intern/bpy_rna_callback.h b/source/blender/python/intern/bpy_rna_callback.h index d846b388c25..955ea8305f0 100644 --- a/source/blender/python/intern/bpy_rna_callback.h +++ b/source/blender/python/intern/bpy_rna_callback.h @@ -25,5 +25,5 @@ struct BPy_StructRNA; struct PyObject; -struct PyObject *pyrna_callback_add(struct BPy_StructRNA *self, struct PyObject *args); -struct PyObject *pyrna_callback_remove(struct BPy_StructRNA *self, struct PyObject *args); +PyObject *pyrna_callback_add(BPy_StructRNA *self, PyObject *args); +PyObject *pyrna_callback_remove(BPy_StructRNA *self, PyObject *args); diff --git a/source/blender/python/intern/bpy_util.c b/source/blender/python/intern/bpy_util.c index fb5b2a0d399..8ea5e646482 100644 --- a/source/blender/python/intern/bpy_util.c +++ b/source/blender/python/intern/bpy_util.c @@ -30,7 +30,7 @@ #include "../generic/py_capi_utils.h" -bContext* __py_context = NULL; +static bContext* __py_context = NULL; bContext* BPy_GetContext(void) { return __py_context; } void BPy_SetContext(bContext *C) { __py_context= C; } diff --git a/source/blender/python/intern/bpy_util.h b/source/blender/python/intern/bpy_util.h index c958082903e..e89c8212e1b 100644 --- a/source/blender/python/intern/bpy_util.h +++ b/source/blender/python/intern/bpy_util.h @@ -54,7 +54,7 @@ int BPY_class_validate(const char *class_type, PyObject *class, PyObject *base_c char *BPy_enum_as_string(struct EnumPropertyItem *item); -#define BLANK_PYTHON_TYPE {PyVarObject_HEAD_INIT(NULL, 0) 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0} +#define BLANK_PYTHON_TYPE {PyVarObject_HEAD_INIT(NULL, 0) NULL} /* error reporting */ short BPy_reports_to_error(struct ReportList *reports, const short clear); diff --git a/source/blender/render/extern/include/RE_pipeline.h b/source/blender/render/extern/include/RE_pipeline.h index 50b23f65401..63d986026d2 100644 --- a/source/blender/render/extern/include/RE_pipeline.h +++ b/source/blender/render/extern/include/RE_pipeline.h @@ -288,7 +288,7 @@ typedef struct RenderEngine { ListBase fullresult; } RenderEngine; -void RE_layer_load_from_file(RenderLayer *layer, struct ReportList *reports, const char *filename); +void RE_layer_load_from_file(RenderLayer *layer, struct ReportList *reports, const char *filename, int x, int y); void RE_result_load_from_file(RenderResult *result, struct ReportList *reports, const char *filename); struct RenderResult *RE_engine_begin_result(RenderEngine *engine, int x, int y, int w, int h); diff --git a/source/blender/render/intern/source/convertblender.c b/source/blender/render/intern/source/convertblender.c index 14f80986ba3..72bec0cb596 100644 --- a/source/blender/render/intern/source/convertblender.c +++ b/source/blender/render/intern/source/convertblender.c @@ -1269,6 +1269,7 @@ static void particle_billboard(Render *re, ObjectRen *obr, Material *ma, Particl VlakRen *vlr; MTFace *mtf; float xvec[3], yvec[3], zvec[3], bb_center[3]; + int totsplit = bb->uv_split * bb->uv_split; float uvx = 0.0f, uvy = 0.0f, uvdx = 1.0f, uvdy = 1.0f, time = 0.0f; vlr= RE_findOrAddVlak(obr, obr->totvlak++); @@ -1306,49 +1307,46 @@ static void particle_billboard(Render *re, ObjectRen *obr, Material *ma, Particl if(bb->uv_split > 1){ uvdx = uvdy = 1.0f / (float)bb->uv_split; - if(bb->anim == PART_BB_ANIM_TIME) { - if(bb->split_offset == PART_BB_OFF_NONE) - time = bb->time; - else if(bb->split_offset == PART_BB_OFF_LINEAR) - time = (float)fmod(bb->time + (float)bb->num / (float)(bb->uv_split * bb->uv_split), 1.0f); - else /* split_offset==PART_BB_OFF_RANDOM */ - time = (float)fmod(bb->time + bb->random, 1.0f); + if(ELEM(bb->anim, PART_BB_ANIM_AGE, PART_BB_ANIM_FRAME)) { + if(bb->anim == PART_BB_ANIM_FRAME) + time = ((int)(bb->time * bb->lifetime) % totsplit)/(float)totsplit; + else + time = bb->time; } else if(bb->anim == PART_BB_ANIM_ANGLE) { if(bb->align == PART_BB_VIEW) { time = (float)fmod((bb->tilt + 1.0f) / 2.0f, 1.0); } - else{ + else { float axis1[3] = {0.0f,0.0f,0.0f}; float axis2[3] = {0.0f,0.0f,0.0f}; + axis1[(bb->align + 1) % 3] = 1.0f; axis2[(bb->align + 2) % 3] = 1.0f; + if(bb->lock == 0) { zvec[bb->align] = 0.0f; normalize_v3(zvec); } + time = saacos(dot_v3v3(zvec, axis1)) / (float)M_PI; + if(dot_v3v3(zvec, axis2) < 0.0f) time = 1.0f - time / 2.0f; else - time = time / 2.0f; + time /= 2.0f; } - if(bb->split_offset == PART_BB_OFF_LINEAR) - time = (float)fmod(bb->time + (float)bb->num / (float)(bb->uv_split * bb->uv_split), 1.0f); - else if(bb->split_offset == PART_BB_OFF_RANDOM) - time = (float)fmod(bb->time + bb->random, 1.0f); - } - else{ - if(bb->split_offset == PART_BB_OFF_NONE) - time = 0.0f; - else if(bb->split_offset == PART_BB_OFF_LINEAR) - time = (float)fmod((float)bb->num /(float)(bb->uv_split * bb->uv_split) , 1.0f); - else /* split_offset==PART_BB_OFF_RANDOM */ - time = bb->random; } + + if(bb->split_offset == PART_BB_OFF_LINEAR) + time = (float)fmod(time + (float)bb->num / (float)totsplit, 1.0f); + else if(bb->split_offset==PART_BB_OFF_RANDOM) + time = (float)fmod(time + bb->random, 1.0f); + uvx = uvdx * floor((float)(bb->uv_split * bb->uv_split) * (float)fmod((double)time, (double)uvdx)); uvy = uvdy * floor((1.0f - time) * (float)bb->uv_split); + if(fmod(time, 1.0f / bb->uv_split) == 0.0f) uvy -= uvdy; } @@ -1989,6 +1987,7 @@ static int render_new_particle_system(Render *re, ObjectRen *obr, ParticleSystem bb.tilt = part->bb_tilt * (1.0f - part->bb_rand_tilt * r_tilt); bb.time = pa_time; bb.num = a; + bb.lifetime = pa_dietime-pa_birthtime; } particle_normal_ren(part->ren_as, part, re, obr, psmd->dm, ma, &sd, &bb, &state, seed, hasize, pa_co); @@ -4882,7 +4881,6 @@ static void database_init_objects(Render *re, unsigned int renderlay, int nolamp /* used to be 'rotate scene' */ void RE_Database_FromScene(Render *re, Main *bmain, Scene *scene, unsigned int lay, int use_camera_view) { - extern int slurph_opt; /* key.c */ Scene *sce; float mat[4][4]; float amb[3]; @@ -4911,7 +4909,7 @@ void RE_Database_FromScene(Render *re, Main *bmain, Scene *scene, unsigned int l lay &= 0xFF000000; /* applies changes fully */ - if((re->r.scemode & R_PREVIEWBUTS)==0) + if((re->r.scemode & (R_NO_FRAME_UPDATE|R_PREVIEWBUTS))==0) scene_update_for_newframe(re->main, re->scene, lay); /* if no camera, viewmat should have been set! */ @@ -5045,7 +5043,6 @@ void RE_DataBase_GetView(Render *re, float mat[][4]) static void database_fromscene_vectors(Render *re, Scene *scene, unsigned int lay, int timeoffset) { - extern int slurph_opt; /* key.c */ float mat[4][4]; re->scene= scene; diff --git a/source/blender/render/intern/source/pipeline.c b/source/blender/render/intern/source/pipeline.c index 1ec37dd7b1c..363b7ab4765 100644 --- a/source/blender/render/intern/source/pipeline.c +++ b/source/blender/render/intern/source/pipeline.c @@ -143,7 +143,6 @@ static int default_break(void *UNUSED(arg)) {return G.afbreek == 1;} static void stats_background(void *UNUSED(arg), RenderStats *rs) { - char str[400], *spos= str; uintptr_t mem_in_use, mmap_in_use, peak_memory; float megs_used_memory, mmap_used_memory, megs_peak_memory; @@ -155,24 +154,24 @@ static void stats_background(void *UNUSED(arg), RenderStats *rs) mmap_used_memory= (mmap_in_use)/(1024.0*1024.0); megs_peak_memory = (peak_memory)/(1024.0*1024.0); - spos+= sprintf(spos, "Fra:%d Mem:%.2fM (%.2fM, peak %.2fM) ", rs->cfra, + fprintf(stdout, "Fra:%d Mem:%.2fM (%.2fM, peak %.2fM) ", rs->cfra, megs_used_memory, mmap_used_memory, megs_peak_memory); - + if(rs->curfield) - spos+= sprintf(spos, "Field %d ", rs->curfield); + fprintf(stdout, "Field %d ", rs->curfield); if(rs->curblur) - spos+= sprintf(spos, "Blur %d ", rs->curblur); - + fprintf(stdout, "Blur %d ", rs->curblur); + if(rs->infostr) { - spos+= sprintf(spos, "| %s", rs->infostr); + fprintf(stdout, "| %s", rs->infostr); } else { if(rs->tothalo) - spos+= sprintf(spos, "Sce: %s Ve:%d Fa:%d Ha:%d La:%d", rs->scenename, rs->totvert, rs->totface, rs->tothalo, rs->totlamp); - else - spos+= sprintf(spos, "Sce: %s Ve:%d Fa:%d La:%d", rs->scenename, rs->totvert, rs->totface, rs->totlamp); + fprintf(stdout, "Sce: %s Ve:%d Fa:%d Ha:%d La:%d", rs->scenename, rs->totvert, rs->totface, rs->tothalo, rs->totlamp); + else + fprintf(stdout, "Sce: %s Ve:%d Fa:%d La:%d", rs->scenename, rs->totvert, rs->totface, rs->totlamp); } - printf("%s\n", str); + fflush(stdout); } void RE_FreeRenderResult(RenderResult *res) @@ -462,9 +461,9 @@ static void scene_unique_exr_name(Scene *scene, char *str, int sample) BLI_splitdirstring(di, fi); if(sample==0) - sprintf(name, "%s_%s.exr", fi, scene->id.name+2); + BLI_snprintf(name, sizeof(name), "%s_%s.exr", fi, scene->id.name+2); else - sprintf(name, "%s_%s%d.exr", fi, scene->id.name+2, sample); + BLI_snprintf(name, sizeof(name), "%s_%s%d.exr", fi, scene->id.name+2, sample); BLI_make_file_string("/", str, btempdir, name); } @@ -579,7 +578,7 @@ static RenderResult *new_render_result(Render *re, rcti *partrct, int crop, int rl= MEM_callocN(sizeof(RenderLayer), "new render layer"); BLI_addtail(&rr->layers, rl); - strcpy(rl->name, srl->name); + BLI_strncpy(rl->name, srl->name, sizeof(rl->name)); rl->lay= srl->lay; rl->lay_zmask= srl->lay_zmask; rl->layflag= srl->layflag; @@ -927,7 +926,7 @@ static void renderresult_add_names(RenderResult *rr) for(rl= rr->layers.first; rl; rl= rl->next) for(rpass= rl->passes.first; rpass; rpass= rpass->next) - strcpy(rpass->name, get_pass_name(rpass->passtype, -1)); + BLI_strncpy(rpass->name, get_pass_name(rpass->passtype, -1), sizeof(rpass->name)); } /* called for reading temp files, and for external engines */ @@ -1603,7 +1602,7 @@ static void print_part_stats(Render *re, RenderPart *pa) { char str[64]; - sprintf(str, "%s, Part %d-%d", re->scene->id.name+2, pa->nr, re->i.totpart); + BLI_snprintf(str, sizeof(str), "%s, Part %d-%d", re->scene->id.name+2, pa->nr, re->i.totpart); re->i.infostr= str; re->stats_draw(re->sdh, &re->i); re->i.infostr= NULL; @@ -2061,7 +2060,7 @@ static void load_backbuffer(Render *re) ImBuf *ibuf; char name[256]; - strcpy(name, re->r.backbuf); + BLI_strncpy(name, re->r.backbuf, sizeof(name)); BLI_path_abs(name, re->main->name); BLI_path_frame(name, re->r.cfra, 0); @@ -3363,7 +3362,7 @@ void RE_engine_update_stats(RenderEngine *engine, const char *stats, const char /* loads in image into a result, size must match * x/y offsets are only used on a partial copy when dimensions dont match */ -void RE_layer_load_from_file(RenderLayer *layer, ReportList *reports, const char *filename) +void RE_layer_load_from_file(RenderLayer *layer, ReportList *reports, const char *filename, int x, int y) { ImBuf *ibuf = IMB_loadiffname(filename, IB_rect); @@ -3374,7 +3373,7 @@ void RE_layer_load_from_file(RenderLayer *layer, ReportList *reports, const char memcpy(layer->rectf, ibuf->rect_float, sizeof(float)*4*layer->rectx*layer->recty); } else { - if ((ibuf->x >= layer->rectx) && (ibuf->y >= layer->recty)) { + if ((ibuf->x - x >= layer->rectx) && (ibuf->y - y >= layer->recty)) { ImBuf *ibuf_clip; if(ibuf->rect_float==NULL) @@ -3382,7 +3381,7 @@ void RE_layer_load_from_file(RenderLayer *layer, ReportList *reports, const char ibuf_clip = IMB_allocImBuf(layer->rectx, layer->recty, 32, IB_rectfloat); if(ibuf_clip) { - IMB_rectcpy(ibuf_clip, ibuf, 0,0, 0,0, layer->rectx, layer->recty); + IMB_rectcpy(ibuf_clip, ibuf, 0,0, x,y, layer->rectx, layer->recty); memcpy(layer->rectf, ibuf_clip->rect_float, sizeof(float)*4*layer->rectx*layer->recty); IMB_freeImBuf(ibuf_clip); diff --git a/source/blender/render/intern/source/render_texture.c b/source/blender/render/intern/source/render_texture.c index a62c4bd8e74..62e684e79e2 100644 --- a/source/blender/render/intern/source/render_texture.c +++ b/source/blender/render/intern/source/render_texture.c @@ -83,7 +83,7 @@ extern struct Render R; -void init_render_texture(Render *re, Tex *tex) +static void init_render_texture(Render *re, Tex *tex) { int cfra= re->scene->r.cfra; @@ -137,7 +137,7 @@ void init_render_textures(Render *re) } } -void end_render_texture(Tex *tex) +static void end_render_texture(Tex *tex) { if(tex && tex->use_nodes && tex->nodetree) ntreeEndExecTree(tex->nodetree); @@ -759,12 +759,12 @@ static int plugintex(Tex *tex, float *texvec, float *dxt, float *dyt, int osatex if(osatex) rgbnor= ((TexDoitold)pit->doit)(tex->stype, pit->data, texvec, dxt, dyt); else rgbnor= ((TexDoitold)pit->doit)(tex->stype, - pit->data, texvec, 0, 0); + pit->data, texvec, NULL, NULL); } else { if(osatex) rgbnor= ((TexDoit)pit->doit)(tex->stype, pit->data, texvec, dxt, dyt, result); else rgbnor= ((TexDoit)pit->doit)(tex->stype, - pit->data, texvec, 0, 0, result); + pit->data, texvec, NULL, NULL, result); } if (pit->version < 6) { @@ -1879,12 +1879,14 @@ static int compatible_bump_compute(CompatibleBump *compat_bump, ShadeInput *shi, /* Improved bump code from later in 2.5 development cycle */ typedef struct NTapBump { - int nunvdone; - + int init_done; + int iPrevBumpSpace; // 0: uninitialized, 1: objectspace, 2: texturespace, 4: viewspace // bumpmapping + float vNorg[3]; // backup copy of shi->vn float vNacc[3]; // original surface normal minus the surface gradient of every bump map which is encountered float vR1[3], vR2[3]; // cross products (sigma_y, original_normal), (original_normal, sigma_x) float sgn_det; // sign of the determinant of the matrix {sigma_x, sigma_y, original_normal} + float fPrevMagnitude; // copy of previous magnitude, used for multiple bumps in different spaces } NTapBump; static void ntap_bump_init(NTapBump *ntap_bump) @@ -1897,22 +1899,32 @@ static int ntap_bump_compute(NTapBump *ntap_bump, ShadeInput *shi, MTex *mtex, T TexResult ttexr = {0, 0, 0, 0, 0, texres->talpha, NULL}; // temp TexResult const int fromrgb = ((tex->type == TEX_IMAGE) || ((tex->flag & TEX_COLORBAND)!=0)); - float Hscale = 0.1f * Tnor*mtex->norfac; // factor 0.1 proved to look like the previous bump code + float Hscale = Tnor*mtex->norfac; // 2 channels for 2D texture and 3 for 3D textures. const int nr_channels = (mtex->texco == TEXCO_UV)? 2 : 3; - int c, rgbnor; + int c, rgbnor, iBumpSpace; float dHdx, dHdy; // disable internal bump eval in sampler, save pointer float *nvec = texres->nor; texres->nor = NULL; - // TODO: solve this Hscale issue more elegantly. - if( mtex->texflag & MTEX_BUMP_TEXTURESPACE ) + if( mtex->texflag & MTEX_BUMP_TEXTURESPACE ) { if(tex->ima) - Hscale *= 130.0f; - + Hscale *= 13.0f; // appears to be a sensible default value + } else + Hscale *= 0.1f; // factor 0.1 proved to look like the previous bump code + + if( !ntap_bump->init_done ) { + VECCOPY(ntap_bump->vNacc, shi->vn); + VECCOPY(ntap_bump->vNorg, shi->vn); + ntap_bump->fPrevMagnitude = 1.0f; + ntap_bump->iPrevBumpSpace = 0; + + ntap_bump->init_done = 1; + } + if(!(mtex->texflag & MTEX_5TAP_BUMP)) { // compute height derivatives with respect to output image pixel coordinates x and y float STll[3], STlr[3], STul[3]; @@ -1998,17 +2010,25 @@ static int ntap_bump_compute(NTapBump *ntap_bump, ShadeInput *shi, MTex *mtex, T [Mik10] Mikkelsen M. S.: Bump Mapping Unparametrized Surfaces on the GPU. -> http://jbit.net/~sparky/sfgrad_bump/mm_sfgrad_bump.pdf */ - if(!ntap_bump->nunvdone) { + if( mtex->texflag & MTEX_BUMP_OBJECTSPACE ) + iBumpSpace = 1; + else if( mtex->texflag & MTEX_BUMP_TEXTURESPACE ) + iBumpSpace = 2; + else + iBumpSpace = 4; // ViewSpace + + if( ntap_bump->iPrevBumpSpace != iBumpSpace ) { + // initialize normal perturbation vectors int xyz; - float fDet, abs_fDet; + float fDet, abs_fDet, fMagnitude; // object2view and inverted matrix float obj2view[3][3], view2obj[3][3], tmp[4][4]; // local copies of derivatives and normal float dPdx[3], dPdy[3], vN[3]; VECCOPY(dPdx, shi->dxco); VECCOPY(dPdy, shi->dyco); - VECCOPY(vN, shi->vn); + VECCOPY(vN, ntap_bump->vNorg); if( mtex->texflag & MTEX_BUMP_OBJECTSPACE ) { // TODO: these calculations happen for every pixel! @@ -2040,17 +2060,21 @@ static int ntap_bump_compute(NTapBump *ntap_bump, ShadeInput *shi, MTex *mtex, T } } - for(xyz=0; xyz<3; xyz++) - ntap_bump->vNacc[xyz] = abs_fDet * vN[xyz]; - + fMagnitude = abs_fDet; if( mtex->texflag & MTEX_BUMP_OBJECTSPACE ) { // pre do transform of texres->nor by the inverse transposed of obj2view - mul_transposed_m3_v3( view2obj, ntap_bump->vNacc ); + mul_transposed_m3_v3( view2obj, vN ); mul_transposed_m3_v3( view2obj, ntap_bump->vR1 ); mul_transposed_m3_v3( view2obj, ntap_bump->vR2 ); + + fMagnitude *= len_v3(vN); } - - ntap_bump->nunvdone= 1; + + for(xyz=0; xyz<3; xyz++) + ntap_bump->vNacc[xyz] *= fMagnitude / ntap_bump->fPrevMagnitude; + + ntap_bump->fPrevMagnitude = fMagnitude; + ntap_bump->iPrevBumpSpace = iBumpSpace; } if( mtex->texflag & MTEX_BUMP_TEXTURESPACE ) { @@ -2080,6 +2104,8 @@ static int ntap_bump_compute(NTapBump *ntap_bump, ShadeInput *shi, MTex *mtex, T void do_material_tex(ShadeInput *shi) { + CompatibleBump compat_bump; + NTapBump ntap_bump; MTex *mtex; Tex *tex; TexResult texres= {0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0, NULL}; @@ -2087,9 +2113,6 @@ void do_material_tex(ShadeInput *shi) float fact, facm, factt, facmm, stencilTin=1.0; float texvec[3], dxt[3], dyt[3], tempvec[3], norvec[3], warpvec[3]={0.0f, 0.0f, 0.0f}, Tnor=1.0; int tex_nr, rgbnor= 0, warpdone=0; - - CompatibleBump compat_bump; - NTapBump ntap_bump; int use_compat_bump, use_ntap_bump; compatible_bump_init(&compat_bump); @@ -2113,11 +2136,16 @@ void do_material_tex(ShadeInput *shi) use_ntap_bump= (mtex->texflag & (MTEX_3TAP_BUMP|MTEX_5TAP_BUMP)); /* XXX texture node trees don't work for this yet */ - /* it also needs derivatives */ - if((tex->nodetree && tex->use_nodes) || shi->osatex==0) { + if(tex->nodetree && tex->use_nodes) { use_compat_bump = 0; use_ntap_bump = 0; } + + /* case displacement mapping */ + if(shi->osatex==0 && use_ntap_bump) { + use_ntap_bump = 0; + use_compat_bump = 1; + } /* which coords */ if(mtex->texco==TEXCO_ORCO) { diff --git a/source/blender/render/intern/source/shadeinput.c b/source/blender/render/intern/source/shadeinput.c index 07f09deaf60..98a90427aac 100644 --- a/source/blender/render/intern/source/shadeinput.c +++ b/source/blender/render/intern/source/shadeinput.c @@ -430,10 +430,10 @@ void shade_input_set_strand_texco(ShadeInput *shi, StrandRen *strand, StrandVert mul_m4_v3(R.viewinv, shi->gl); if(shi->osatex) { - VECCOPY(shi->dxgl, shi->dxco); - mul_m3_v3(R.imat, shi->dxco); - VECCOPY(shi->dygl, shi->dyco); - mul_m3_v3(R.imat, shi->dyco); + VECCOPY(shi->dxgl, shi->dxco); + mul_mat3_m4_v3(R.viewinv, shi->dxgl); + VECCOPY(shi->dygl, shi->dyco); + mul_mat3_m4_v3(R.viewinv, shi->dygl); } } @@ -1012,13 +1012,10 @@ void shade_input_set_shade_texco(ShadeInput *shi) VECCOPY(shi->gl, shi->co); mul_m4_v3(R.viewinv, shi->gl); if(shi->osatex) { - VECCOPY(shi->dxgl, shi->dxco); - // TXF: bug was here, but probably should be in convertblender.c, R.imat only valid if there is a world - //mul_m3_v3(R.imat, shi->dxco); - mul_mat3_m4_v3(R.viewinv, shi->dxco); - VECCOPY(shi->dygl, shi->dyco); - //mul_m3_v3(R.imat, shi->dyco); - mul_mat3_m4_v3(R.viewinv, shi->dyco); + VECCOPY(shi->dxgl, shi->dxco); + mul_mat3_m4_v3(R.viewinv, shi->dxgl); + VECCOPY(shi->dygl, shi->dyco); + mul_mat3_m4_v3(R.viewinv, shi->dygl); } } diff --git a/source/blender/render/intern/source/strand.c b/source/blender/render/intern/source/strand.c index 099bf76f40b..4e728c3e59e 100644 --- a/source/blender/render/intern/source/strand.c +++ b/source/blender/render/intern/source/strand.c @@ -314,7 +314,7 @@ struct StrandShadeCache { MemArena *memarena; }; -StrandShadeCache *strand_shade_cache_create() +StrandShadeCache *strand_shade_cache_create(void) { StrandShadeCache *cache; diff --git a/source/blender/render/intern/source/volume_precache.c b/source/blender/render/intern/source/volume_precache.c index 609e647637f..ddb3d68fcc7 100644 --- a/source/blender/render/intern/source/volume_precache.c +++ b/source/blender/render/intern/source/volume_precache.c @@ -397,7 +397,7 @@ void multiple_scattering_diffusion(Render *re, VolumePrecache *vp, Material *ma) /* Displays progress every second */ if(time-lasttime>1.0f) { char str[64]; - sprintf(str, "Simulating multiple scattering: %d%%", (int)(100.0f * (c / total))); + BLI_snprintf(str, sizeof(str), "Simulating multiple scattering: %d%%", (int)(100.0f * (c / total))); re->i.infostr= str; re->stats_draw(re->sdh, &re->i); re->i.infostr= NULL; @@ -742,7 +742,7 @@ void vol_precache_objectinstance_threads(Render *re, ObjectInstanceRen *obi, Mat time= PIL_check_seconds_timer(); if(time-lasttime>1.0f) { char str[64]; - sprintf(str, "Precaching volume: %d%%", (int)(100.0f * ((float)counter / (float)totparts))); + BLI_snprintf(str, sizeof(str), "Precaching volume: %d%%", (int)(100.0f * ((float)counter / (float)totparts))); re->i.infostr= str; re->stats_draw(re->sdh, &re->i); re->i.infostr= NULL; diff --git a/source/blender/windowmanager/WM_types.h b/source/blender/windowmanager/WM_types.h index 728e5f1a800..8590534df30 100644 --- a/source/blender/windowmanager/WM_types.h +++ b/source/blender/windowmanager/WM_types.h @@ -193,6 +193,7 @@ typedef struct wmNotifier { #define ND_TOOLSETTINGS (15<<16) #define ND_LAYER (16<<16) #define ND_FRAME_RANGE (17<<16) +#define ND_TRANSFORM_DONE (18<<16) #define ND_WORLD (92<<16) #define ND_LAYER_CONTENT (101<<16) diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c index 3c312a0c2b3..3de7b569af4 100644 --- a/source/blender/windowmanager/intern/wm_event_system.c +++ b/source/blender/windowmanager/intern/wm_event_system.c @@ -645,7 +645,7 @@ static void wm_region_mouse_co(bContext *C, wmEvent *event) } } -int wm_operator_invoke(bContext *C, wmOperatorType *ot, wmEvent *event, PointerRNA *properties, ReportList *reports, short poll_only) +static int wm_operator_invoke(bContext *C, wmOperatorType *ot, wmEvent *event, PointerRNA *properties, ReportList *reports, short poll_only) { wmWindowManager *wm= CTX_wm_manager(C); int retval= OPERATOR_PASS_THROUGH; @@ -1934,7 +1934,7 @@ void WM_event_add_fileselect(bContext *C, wmOperator *op) } /* lets not expose struct outside wm? */ -void WM_event_set_handler_flag(wmEventHandler *handler, int flag) +static void WM_event_set_handler_flag(wmEventHandler *handler, int flag) { handler->flag= flag; } @@ -2083,7 +2083,7 @@ void WM_event_remove_area_handler(ListBase *handlers, void *area) } } -void WM_event_remove_handler(ListBase *handlers, wmEventHandler *handler) +static void WM_event_remove_handler(ListBase *handlers, wmEventHandler *handler) { BLI_remlink(handlers, handler); wm_event_free_handler(handler); diff --git a/source/blender/windowmanager/intern/wm_files.c b/source/blender/windowmanager/intern/wm_files.c index 644320b0566..31873160944 100644 --- a/source/blender/windowmanager/intern/wm_files.c +++ b/source/blender/windowmanager/intern/wm_files.c @@ -259,7 +259,7 @@ static void wm_init_userdef(bContext *C) /* set the python auto-execute setting from user prefs */ /* disabled by default, unless explicitly enabled in the command line */ if ((U.flag & USER_SCRIPT_AUTOEXEC_DISABLE) == 0) G.f |= G_SCRIPT_AUTOEXEC; - if(U.tempdir[0]) BLI_where_is_temp(btempdir, 1); + if(U.tempdir[0]) BLI_where_is_temp(btempdir, FILE_MAX, 1); } void WM_read_file(bContext *C, const char *name, ReportList *reports) @@ -469,10 +469,7 @@ void read_history(void) if (line[0] && BLI_exists(line)) { recent = (RecentFile*)MEM_mallocN(sizeof(RecentFile),"RecentFile"); BLI_addtail(&(G.recent_files), recent); - recent->filepath = (char*)MEM_mallocN(sizeof(char)*(strlen(line)+1), "name of file"); - recent->filepath[0] = '\0'; - - strcpy(recent->filepath, line); + recent->filepath = BLI_strdup(line); num++; } } @@ -505,7 +502,7 @@ static void write_history(void) recent = (RecentFile*)MEM_mallocN(sizeof(RecentFile),"RecentFile"); recent->filepath = (char*)MEM_mallocN(sizeof(char)*(strlen(G.main->name)+1), "name of file"); recent->filepath[0] = '\0'; - strcpy(recent->filepath, G.main->name); + BLI_strncpy(recent->filepath, G.main->name, sizeof(recent->filepath)); BLI_addhead(&(G.recent_files), recent); /* write current file to recent-files.txt */ fprintf(fp, "%s\n", recent->filepath); @@ -543,18 +540,18 @@ static void do_history(char *name, ReportList *reports) if(strlen(name)<2) return; while(hisnr > 1) { - sprintf(tempname1, "%s%d", name, hisnr-1); - sprintf(tempname2, "%s%d", name, hisnr); + BLI_snprintf(tempname1, sizeof(tempname1), "%s%d", name, hisnr-1); + BLI_snprintf(tempname2, sizeof(tempname2), "%s%d", name, hisnr); if(BLI_rename(tempname1, tempname2)) BKE_report(reports, RPT_ERROR, "Unable to make version backup"); hisnr--; } - + /* is needed when hisnr==1 */ - sprintf(tempname1, "%s%d", name, hisnr); - + BLI_snprintf(tempname1, sizeof(tempname1), "%s%d", name, hisnr); + if(BLI_rename(name, tempname1)) BKE_report(reports, RPT_ERROR, "Unable to make version backup"); } @@ -671,7 +668,7 @@ int WM_write_file(bContext *C, const char *target, int fileflags, ReportList *re if (BLO_write_file(CTX_data_main(C), di, fileflags, reports, thumb)) { if(!copy) { G.relbase_valid = 1; - strcpy(G.main->name, di); /* is guaranteed current file */ + BLI_strncpy(G.main->name, di, sizeof(G.main->name)); /* is guaranteed current file */ G.save_over = 1; /* disable untitled.blend convention */ } @@ -744,8 +741,8 @@ void wm_autosave_location(char *filename) char *savedir; #endif - sprintf(pidstr, "%d.blend", abs(getpid())); - + BLI_snprintf(pidstr, sizeof(pidstr), "%d.blend", abs(getpid())); + #ifdef WIN32 /* XXX Need to investigate how to handle default location of '/tmp/' * This is a relative directory on Windows, and it may be diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c index 36e770db91a..534aab94ada 100644 --- a/source/blender/windowmanager/intern/wm_operators.c +++ b/source/blender/windowmanager/intern/wm_operators.c @@ -83,6 +83,7 @@ #include "RNA_access.h" #include "RNA_define.h" +#include "RNA_enum_types.h" #include "UI_interface.h" #include "UI_resources.h" @@ -219,7 +220,7 @@ static int wm_macro_exec(bContext *C, wmOperator *op) return wm_macro_end(op, retval); } -int wm_macro_invoke_internal(bContext *C, wmOperator *op, wmEvent *event, wmOperator *opm) +static int wm_macro_invoke_internal(bContext *C, wmOperator *op, wmEvent *event, wmOperator *opm) { int retval= OPERATOR_FINISHED; @@ -914,7 +915,7 @@ static void dialog_exec_cb(bContext *C, void *arg1, void *arg2) uiPupBlockClose(C, block); } -void dialog_check_cb(bContext *C, void *op_ptr, void *UNUSED(arg)) +static void dialog_check_cb(bContext *C, void *op_ptr, void *UNUSED(arg)) { wmOperator *op= op_ptr; if(op->type->check) { @@ -1076,7 +1077,7 @@ static uiBlock *wm_block_create_splash(bContext *C, ARegion *ar, void *arg_unuse /* XXX: hack to refresh splash screen with updated prest menu name, * since popup blocks don't get regenerated like panels do */ -void wm_block_splash_refreshmenu (bContext *UNUSED(C), void *UNUSED(arg_block), void *UNUSED(arg)) +static void wm_block_splash_refreshmenu (bContext *UNUSED(C), void *UNUSED(arg_block), void *UNUSED(arg)) { /* ugh, causes crashes in other buttons, disabling for now until * a better fix @@ -2620,7 +2621,7 @@ void WM_OT_straightline_gesture(wmOperatorType *ot) /* *********************** radial control ****************** */ -const int WM_RADIAL_CONTROL_DISPLAY_SIZE = 200; +static const int WM_RADIAL_CONTROL_DISPLAY_SIZE = 200; typedef struct wmRadialControl { int mode; diff --git a/source/blender/windowmanager/intern/wm_window.c b/source/blender/windowmanager/intern/wm_window.c index db427ea68d1..1022cff5062 100644 --- a/source/blender/windowmanager/intern/wm_window.c +++ b/source/blender/windowmanager/intern/wm_window.c @@ -69,7 +69,7 @@ #include "GPU_extensions.h" /* the global to talk to ghost */ -GHOST_SystemHandle g_system= NULL; +static GHOST_SystemHandle g_system= NULL; /* set by commandline */ static int prefsizx= 0, prefsizy= 0, prefstax= 0, prefstay= 0, initialstate= GHOST_kWindowStateNormal; @@ -273,12 +273,7 @@ void wm_window_title(wmWindowManager *wm, wmWindow *win) /* this is set to 1 if you don't have startup.blend open */ if(G.save_over && G.main->name[0]) { char str[sizeof(G.main->name) + 12]; - - if(wm->file_saved) - sprintf(str, "Blender [%s]", G.main->name); - else - sprintf(str, "Blender* [%s]", G.main->name); - + BLI_snprintf(str, sizeof(str), "Blender%s [%s]", wm->file_saved ? "":"*", G.main->name); GHOST_SetTitle(win->ghostwin, str); } else @@ -1160,12 +1155,12 @@ void WM_setprefsize(int stax, int stay, int sizx, int sizy) } /* for borderless and border windows set from command-line */ -void WM_setinitialstate_fullscreen() +void WM_setinitialstate_fullscreen(void) { initialstate= GHOST_kWindowStateFullScreen; } -void WM_setinitialstate_normal() +void WM_setinitialstate_normal(void) { initialstate= GHOST_kWindowStateNormal; } diff --git a/source/blender/windowmanager/wm_window.h b/source/blender/windowmanager/wm_window.h index b0aec50e228..9c82f276acf 100644 --- a/source/blender/windowmanager/wm_window.h +++ b/source/blender/windowmanager/wm_window.h @@ -55,7 +55,6 @@ void wm_window_set_size (wmWindow *win, int width, int height); void wm_window_get_size (wmWindow *win, int *width_r, int *height_r); void wm_window_get_size_ghost (wmWindow *win, int *width_r, int *height_r); void wm_window_get_position (wmWindow *win, int *posx_r, int *posy_r); -void wm_window_set_title (wmWindow *win, char *title); void wm_window_swap_buffers (wmWindow *win); void wm_get_cursor_position (wmWindow *win, int *x, int *y); diff --git a/source/creator/CMakeLists.txt b/source/creator/CMakeLists.txt index a1f894ed63b..fc0f97b184d 100644 --- a/source/creator/CMakeLists.txt +++ b/source/creator/CMakeLists.txt @@ -242,6 +242,7 @@ if(WITH_INSTALL) DESTINATION ${CMAKE_INSTALL_PREFIX}/share/blender/${BLENDER_VERSION}/scripts PATTERN ".svn" EXCLUDE PATTERN "*.pyc" EXCLUDE + PATTERN "__pycache__" EXCLUDE ) install( DIRECTORY ${CMAKE_SOURCE_DIR}/release/datafiles/brushicons/ diff --git a/source/creator/creator.c b/source/creator/creator.c index 23fc8f0d6c7..ae5fa2a2e0a 100644 --- a/source/creator/creator.c +++ b/source/creator/creator.c @@ -140,8 +140,8 @@ static int print_version(int argc, char **argv, void *data); extern int pluginapi_force_ref(void); /* from blenpluginapi:pluginapi.c */ -char bprogname[FILE_MAXDIR+FILE_MAXFILE]; /* from blenpluginapi:pluginapi.c */ -char btempdir[FILE_MAXDIR+FILE_MAXFILE]; +char bprogname[FILE_MAX]; /* from blenpluginapi:pluginapi.c */ +char btempdir[FILE_MAX]; #define BLEND_VERSION_STRING_FMT "Blender %d.%02d (sub %d) Build\n", BLENDER_VERSION/100, BLENDER_VERSION%100, BLENDER_SUBVERSION @@ -934,9 +934,10 @@ static int set_addons(int argc, char **argv, void *data) /* workaround for scripts not getting a bpy.context.scene, causes internal errors elsewhere */ if (argc > 1) { #ifdef WITH_PYTHON - char *str= malloc(strlen(argv[1]) + 100); + const int slen= strlen(argv[1]) + 10; + char *str= malloc(slen); bContext *C= data; - sprintf(str, "[__import__('bpy').utils.addon_enable(i) for i in '%s'.split(',')]", argv[1]); + BLI_snprintf(str, slen, "[__import__('bpy').utils.addon_enable(i) for i in '%s'.split(',')]", argv[1]); BPY_CTX_SETUP(BPY_string_exec(C, str)); free(str); #else @@ -1009,7 +1010,7 @@ static int load_file(int UNUSED(argc), char **argv, void *data) return 0; } -void setupArguments(bContext *C, bArgs *ba, SYS_SystemHandle *syshandle) +static void setupArguments(bContext *C, bArgs *ba, SYS_SystemHandle *syshandle) { static char output_doc[] = "<path>" "\n\tSet the render path and file name." @@ -1146,7 +1147,7 @@ int main(int argc, char **argv) // copy path to executable in bprogname. playanim and creting runtimes // need this. - BLI_where_am_i(bprogname, argv[0]); + BLI_where_am_i(bprogname, sizeof(bprogname), argv[0]); #ifdef BUILD_DATE strip_quotes(build_date); @@ -1213,7 +1214,7 @@ int main(int argc, char **argv) WM_init(C, argc, argv); /* this is properly initialized with user defs, but this is default */ - BLI_where_is_temp( btempdir, 1 ); /* call after loading the startup.blend so we can read U.tempdir */ + BLI_where_is_temp(btempdir, FILE_MAX, 1); /* call after loading the startup.blend so we can read U.tempdir */ #ifndef DISABLE_SDL BLI_setenv("SDL_VIDEODRIVER", "dummy"); @@ -1224,7 +1225,7 @@ int main(int argc, char **argv) WM_init(C, argc, argv); - BLI_where_is_temp( btempdir, 0 ); /* call after loading the startup.blend so we can read U.tempdir */ + BLI_where_is_temp(btempdir, FILE_MAX, 0); /* call after loading the startup.blend so we can read U.tempdir */ } #ifdef WITH_PYTHON /** diff --git a/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp b/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp index a3dc9a588c9..d1039d5c01c 100644 --- a/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp +++ b/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp @@ -108,7 +108,7 @@ extern char datatoc_bfont_ttf[]; const int kMinWindowWidth = 100; const int kMinWindowHeight = 100; -char bprogname[FILE_MAXDIR+FILE_MAXFILE]; +char bprogname[FILE_MAX]; #ifdef WIN32 typedef enum @@ -362,7 +362,7 @@ int main(int argc, char** argv) signal (SIGFPE, SIG_IGN); #endif /* __alpha__ */ #endif /* __linux__ */ - BLI_where_am_i(bprogname, argv[0]); + BLI_where_am_i(bprogname, sizeof(bprogname), argv[0]); #ifdef __APPLE__ // Can't use Carbon right now because of double defined type ID (In Carbon.h and DNA_ID.h, sigh) /* diff --git a/source/gameengine/Ketsji/KX_IpoActuator.cpp b/source/gameengine/Ketsji/KX_IpoActuator.cpp index 7bc85f5f262..d6ff1ee822e 100644 --- a/source/gameengine/Ketsji/KX_IpoActuator.cpp +++ b/source/gameengine/Ketsji/KX_IpoActuator.cpp @@ -456,16 +456,16 @@ PyAttributeDef KX_IpoActuator::Attributes[] = { PyObject* KX_IpoActuator::pyattr_get_frame_start(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef) { KX_IpoActuator* self= static_cast<KX_IpoActuator*>(self_v); - return PyLong_FromDouble(self->m_startframe); + return PyFloat_FromDouble(self->m_startframe); } int KX_IpoActuator::pyattr_set_frame_start(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value) { KX_IpoActuator* self= static_cast<KX_IpoActuator*>(self_v); - float param = PyLong_AsDouble(value); + float param = PyFloat_AsDouble(value); if (PyErr_Occurred()) { - PyErr_SetString(PyExc_AttributeError, "frameStart = integer: KX_IpoActuator, expected an integer value"); + PyErr_SetString(PyExc_AttributeError, "frameStart = float: KX_IpoActuator, expected a float value"); return PY_SET_ATTR_FAIL; } @@ -477,16 +477,16 @@ int KX_IpoActuator::pyattr_set_frame_start(void *self_v, const KX_PYATTRIBUTE_DE PyObject* KX_IpoActuator::pyattr_get_frame_end(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef) { KX_IpoActuator* self= static_cast<KX_IpoActuator*>(self_v); - return PyLong_FromDouble(self->m_endframe); + return PyFloat_FromDouble(self->m_endframe); } int KX_IpoActuator::pyattr_set_frame_end(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value) { KX_IpoActuator* self= static_cast<KX_IpoActuator*>(self_v); - float param = PyLong_AsDouble(value); + float param = PyFloat_AsDouble(value); if (PyErr_Occurred()) { - PyErr_SetString(PyExc_AttributeError, "frameEnd = integer: KX_IpoActuator, expected an integer value"); + PyErr_SetString(PyExc_AttributeError, "frameEnd = float: KX_IpoActuator, expected a float value"); return PY_SET_ATTR_FAIL; } diff --git a/source/gameengine/Ketsji/KX_Scene.cpp b/source/gameengine/Ketsji/KX_Scene.cpp index 1db174d72be..87cb46e65a9 100644 --- a/source/gameengine/Ketsji/KX_Scene.cpp +++ b/source/gameengine/Ketsji/KX_Scene.cpp @@ -2119,8 +2119,7 @@ PyObject* KX_Scene::pyattr_get_drawing_callback_pre(void *self_v, const KX_PYATT if(self->m_draw_call_pre==NULL) self->m_draw_call_pre= PyList_New(0); - else - Py_INCREF(self->m_draw_call_pre); + Py_INCREF(self->m_draw_call_pre); return self->m_draw_call_pre; } @@ -2130,8 +2129,7 @@ PyObject* KX_Scene::pyattr_get_drawing_callback_post(void *self_v, const KX_PYAT if(self->m_draw_call_post==NULL) self->m_draw_call_post= PyList_New(0); - else - Py_INCREF(self->m_draw_call_post); + Py_INCREF(self->m_draw_call_post); return self->m_draw_call_post; } diff --git a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.cpp b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.cpp index c2859394176..135b9e6f4be 100644 --- a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.cpp +++ b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.cpp @@ -742,6 +742,8 @@ static int CheckMaterialDM(int matnr, void *attribs) memcpy(gattribs, ¤t_gpu_attribs, sizeof(GPUVertexAttribs)); return 1; } + +/* static int CheckTexfaceDM(void *mcol, int index) { @@ -769,6 +771,7 @@ static int CheckTexfaceDM(void *mcol, int index) } return 0; } +*/ static int CheckTexDM(MTFace *tface, MCol *mcol, int matnr) { @@ -811,7 +814,7 @@ void RAS_OpenGLRasterizer::IndexPrimitivesInternal(RAS_MeshSlot& ms, bool multi) current_ms = &ms; current_mesh = ms.m_mesh; current_wireframe = wireframe; - MCol *mcol = (MCol*)ms.m_pDerivedMesh->getFaceDataArray(ms.m_pDerivedMesh, CD_MCOL); + // MCol *mcol = (MCol*)ms.m_pDerivedMesh->getFaceDataArray(ms.m_pDerivedMesh, CD_MCOL); /* UNUSED */ // handle two-side if (current_polymat->GetDrawingMode() & RAS_IRasterizer::KX_TWOSIDE) diff --git a/source/tests/CMakeLists.txt b/source/tests/CMakeLists.txt index a3d75e0376a..27b4ea7a6bd 100644 --- a/source/tests/CMakeLists.txt +++ b/source/tests/CMakeLists.txt @@ -221,7 +221,7 @@ add_test(export_3ds_all_objects ${EXECUTABLE_OUTPUT_PATH}/blender ${GENERIC_ARGS --python ${CMAKE_CURRENT_LIST_DIR}/bl_test.py -- --run={'FINISHED'}&bpy.ops.export_scene.autodesk_3ds\(filepath='${TEST_OUT_DIR}/export_3ds_all_objects.3ds',use_selection=False\) --md5_source=${TEST_OUT_DIR}/export_3ds_all_objects.3ds - --md5=1523ca2e31cf7d781c7de1e17bd14520 --md5_method=FILE + --md5=87349a4699f1006e8194fb0ac05ac9c8 --md5_method=FILE ) @@ -249,5 +249,5 @@ add_test(export_fbx_all_objects ${EXECUTABLE_OUTPUT_PATH}/blender ${GENERIC_ARGS --python ${CMAKE_CURRENT_LIST_DIR}/bl_test.py -- --run={'FINISHED'}&bpy.ops.export_scene.fbx\(filepath='${TEST_OUT_DIR}/export_fbx_all_objects.fbx',use_selection=False,use_metadata=False\) --md5_source=${TEST_OUT_DIR}/export_fbx_all_objects.fbx - --md5=1b829a528f9bdfc054f5d70f455855ad --md5_method=FILE + --md5=be69cf0baf51dcf43f579183310cb383 --md5_method=FILE ) |