diff options
author | Tamito Kajiyama <rd6t-kjym@asahi-net.or.jp> | 2010-10-19 00:40:43 +0400 |
---|---|---|
committer | Tamito Kajiyama <rd6t-kjym@asahi-net.or.jp> | 2010-10-19 00:40:43 +0400 |
commit | 894daa01be1ba5b2f128b1e779d9a38c4c4e7700 (patch) | |
tree | e03309f3c35c2108fe8ac817336106b23e2301c2 | |
parent | 90b69a13a7f7b829c2eb314d1fd1efd56fd0a487 (diff) | |
parent | bf09c851a97aba67b19a5fc85a91d874e28d1df1 (diff) |
Merged changes in the trunk up to revision 32565.
676 files changed, 7643 insertions, 5451 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 3ace8a771c5..39ef55f351f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -66,7 +66,6 @@ GET_BLENDER_VERSION() # Blender internal features OPTION(WITH_INTERNATIONAL "Enable I18N (International fonts and text)" ON) -OPTION(WITH_LCMS "Enable color correction with lcms" OFF) OPTION(WITH_PYTHON "Enable Embedded Python API" ON) OPTION(WITH_BUILDINFO "Include extra build details" ON) OPTION(WITH_FLUID "Enable Elbeem (Fluid Simulation)" ON) @@ -126,12 +125,11 @@ IF(APPLE) OPTION(WITH_LIBS10.5 "Use 10.5 libs (needed for 64bit builds)" OFF) ENDIF(APPLE) -IF(NOT WITH_BULLET AND WITH_GAMEENGINE) - MESSAGE("WARNING: WITH_GAMEENGINE needs WITH_BULLET") -ENDIF(NOT WITH_BULLET AND WITH_GAMEENGINE) +# only for developers who want to make this functional +# OPTION(WITH_LCMS "Enable color correction with lcms" OFF) IF(NOT WITH_GAMEENGINE AND WITH_PLAYER) - MESSAGE("WARNING: WITH_PLAYER needs WITH_GAMEENGINE") + MESSAGE(FATAL_ERROR "WITH_PLAYER needs WITH_GAMEENGINE") ENDIF(NOT WITH_GAMEENGINE AND WITH_PLAYER) IF(NOT WITH_INSTALL AND WITH_PYTHON_INSTALL) @@ -149,7 +147,7 @@ TEST_SSE_SUPPORT() # On Macs: # cmake -D PYTHON_INC=/System/Library/Frameworks/Python.framework/Versions/3.1/include/python3.1 -D PYTHON_LIBPATH=/System/Library/Frameworks/Python.framework/Versions/3.1/lib/python3.1/config -G Xcode ../blender # -# When changing any of this remember to update the notes in doc/blender-cmake.txt +# When changing any of this remember to update the notes in doc/build_systems/cmake.txt #----------------------------------------------------------------------------- #Platform specifics @@ -315,12 +313,12 @@ IF(UNIX AND NOT APPLE) SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fopenmp") ENDIF(WITH_OPENMP) - SET(PLATFORM_CFLAGS "-pipe -fPIC -funsigned-char -fno-strict-aliasing") SET(PLATFORM_LINKFLAGS "-pthread") # Better warnings + # note: -Wunused-parameter is added below for all GCC compilers SET(C_WARNINGS "-Wall -Wno-char-subscripts -Wpointer-arith -Wcast-align -Wdeclaration-after-statement -Wno-unknown-pragmas") SET(CXX_WARNINGS "-Wall -Wno-invalid-offsetof -Wno-sign-compare") @@ -332,12 +330,12 @@ IF(WIN32) # this file is included anyway when building under Windows with cl.exe # INCLUDE(${CMAKE_ROOT}/Modules/Platform/Windows-cl.cmake) - + SET(LIBDIR ${CMAKE_SOURCE_DIR}/../lib/windows) # Setup 64bit and 64bit windows systems IF(CMAKE_CL_64) - message("64 bit compiler detected.") + MESSAGE("64 bit compiler detected.") SET(LIBDIR ${CMAKE_SOURCE_DIR}/../lib/win64) ENDIF(CMAKE_CL_64) @@ -487,7 +485,7 @@ IF(WIN32) SET(LCMS_LIBPATH ${LCMS}/lib) SET(LCMS_LIB lcms) ENDIF(WITH_LCMS) - + IF(WITH_FFMPEG) SET(FFMPEG ${LIBDIR}/ffmpeg) SET(FFMPEG_INC ${FFMPEG}/include ${FFMPEG}/include/msvc) @@ -538,7 +536,7 @@ IF(WIN32) ELSE(CMAKE_CL_64) SET(PLATFORM_LINKFLAGS "/NODEFAULTLIB:libc.lib ") ENDIF(CMAKE_CL_64) - + SET(CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG} /NODEFAULTLIB:libcmt.lib;libc.lib ") ELSE(MSVC) # MINGW @@ -554,17 +552,6 @@ IF(WIN32) SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -D_DEBUG") SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -D_DEBUG") - - SET(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -DNDEBUG") - SET(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -DNDEBUG") - - SET(CMAKE_CXX_FLAGS_MINSIZEREL "${CMAKE_CXX_FLAGS_MINSIZEREL} -DNDEBUG") - SET(CMAKE_C_FLAGS_MINSIZEREL "${CMAKE_C_FLAGS_MINSIZEREL} -DNDEBUG") - - SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} -DNDEBUG") - SET(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO} -DNDEBUG") - - IF(WITH_OPENMP) SET(LLIBS "${LLIBS} -lgomp") SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fopenmp") @@ -922,6 +909,26 @@ INCLUDE_DIRECTORIES(${OPENGL_INCLUDE_DIR}) #----------------------------------------------------------------------------- # Extra compile flags + +IF((NOT WIN32) AND (NOT MSVC)) + # used for internal debug checks + SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DDEBUG") + SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DDEBUG") + + # assert() checks for this. + SET(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -DNDEBUG") + SET(CMAKE_CXX_FLAGS_MINSIZEREL "${CMAKE_CXX_FLAGS_MINSIZEREL} -DNDEBUG") + SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} -DNDEBUG") + + SET(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -DNDEBUG") + SET(CMAKE_C_FLAGS_MINSIZEREL "${CMAKE_C_FLAGS_MINSIZEREL} -DNDEBUG") + SET(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO} -DNDEBUG") +ENDIF((NOT WIN32) AND (NOT MSVC)) + +IF(CMAKE_COMPILER_IS_GNUCC) + SET(C_WARNINGS "${C_WARNINGS} -Wunused-parameter -Werror=declaration-after-statement -Werror=implicit-function-declaration -Werror=return-type") +ENDIF(CMAKE_COMPILER_IS_GNUCC) + SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${PLATFORM_CFLAGS} ${C_WARNINGS}") SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${PLATFORM_CFLAGS} ${CXX_WARNINGS}") @@ -933,9 +940,9 @@ ENDIF(WITH_CXX_GUARDEDALLOC) #----------------------------------------------------------------------------- # Libraries FILE(WRITE ${CMAKE_BINARY_DIR}/cmake_blender_libs.txt "") +ADD_SUBDIRECTORY(source) ADD_SUBDIRECTORY(intern) ADD_SUBDIRECTORY(extern) -ADD_SUBDIRECTORY(source) #----------------------------------------------------------------------------- @@ -2,7 +2,7 @@ Blender uses the GNU General Public License, which describes the rights to distribute or change the code. Please read this file for the full license. -doc/GPL-license.txt +doc/license/GPL-license.txt Apart from the GNU GPL, Blender is not available under other licenses. diff --git a/build_files/scons/config/darwin-config.py b/build_files/scons/config/darwin-config.py index 1423e8fb392..f23d4a6390b 100644 --- a/build_files/scons/config/darwin-config.py +++ b/build_files/scons/config/darwin-config.py @@ -340,7 +340,7 @@ BF_PROFILE_LINKFLAGS = ['-pg'] BF_PROFILE = False BF_DEBUG = False -BF_DEBUG_CCFLAGS = ['-g'] +BF_DEBUG_CCFLAGS = ['-g', '-DDEBUG'] ############################################################################# ################### Output directories ################## diff --git a/build_files/scons/config/freebsd7-config.py b/build_files/scons/config/freebsd7-config.py index 5678b4bda0a..afc71d01c94 100644 --- a/build_files/scons/config/freebsd7-config.py +++ b/build_files/scons/config/freebsd7-config.py @@ -204,7 +204,7 @@ BF_PROFILE_CCFLAGS = ['-pg','-g'] BF_PROFILE_LINKFLAGS = ['-pg'] BF_DEBUG = False -BF_DEBUG_CCFLAGS = ['-g'] +BF_DEBUG_CCFLAGS = ['-g', '-DDEBUG'] BF_BUILDDIR = '../build/freebsd7' BF_INSTALLDIR='../install/freebsd7' diff --git a/build_files/scons/config/freebsd8-config.py b/build_files/scons/config/freebsd8-config.py index bc09e87d59f..d11618b6293 100644 --- a/build_files/scons/config/freebsd8-config.py +++ b/build_files/scons/config/freebsd8-config.py @@ -204,7 +204,7 @@ BF_PROFILE_CCFLAGS = ['-pg','-g'] BF_PROFILE_LINKFLAGS = ['-pg'] BF_DEBUG = False -BF_DEBUG_CCFLAGS = ['-g'] +BF_DEBUG_CCFLAGS = ['-g', '-DDEBUG'] BF_BUILDDIR = '../build/freebsd8' BF_INSTALLDIR='../install/freebsd8' diff --git a/build_files/scons/config/freebsd9-config.py b/build_files/scons/config/freebsd9-config.py index 3fb4ebe7cd6..2aadbf0f960 100644 --- a/build_files/scons/config/freebsd9-config.py +++ b/build_files/scons/config/freebsd9-config.py @@ -204,7 +204,7 @@ BF_PROFILE_CCFLAGS = ['-pg','-g'] BF_PROFILE_LINKFLAGS = ['-pg'] BF_DEBUG = False -BF_DEBUG_CCFLAGS = ['-g'] +BF_DEBUG_CCFLAGS = ['-g', '-DDEBUG'] BF_BUILDDIR = '../build/freebsd9' BF_INSTALLDIR='../install/freebsd9' diff --git a/build_files/scons/config/linux2-config.py b/build_files/scons/config/linux2-config.py index a9c74d692d7..fd0364f9ce9 100644 --- a/build_files/scons/config/linux2-config.py +++ b/build_files/scons/config/linux2-config.py @@ -204,7 +204,7 @@ REL_CCFLAGS = ['-O2'] ##ARFLAGS = ruv ##ARFLAGSQUIET = ru ## -C_WARN = ['-Wno-char-subscripts', '-Wdeclaration-after-statement'] +C_WARN = ['-Wno-char-subscripts', '-Wdeclaration-after-statement', '-Wunused-parameter', '-Werror=declaration-after-statement', '-Werror=implicit-function-declaration', '-Werror=return-type'] CC_WARN = ['-Wall'] CXX_WARN = ['-Wno-invalid-offsetof', '-Wno-sign-compare'] @@ -220,7 +220,7 @@ BF_PROFILE_CCFLAGS = ['-pg','-g'] BF_PROFILE_LINKFLAGS = ['-pg'] BF_DEBUG = False -BF_DEBUG_CCFLAGS = ['-g'] +BF_DEBUG_CCFLAGS = ['-g', '-DDEBUG'] BF_BUILDDIR = '../build/linux2' BF_INSTALLDIR='../install/linux2' diff --git a/build_files/scons/config/linuxcross-config.py b/build_files/scons/config/linuxcross-config.py index 1650201f8c6..263cfd89a8b 100644 --- a/build_files/scons/config/linuxcross-config.py +++ b/build_files/scons/config/linuxcross-config.py @@ -185,7 +185,7 @@ CC_WARN = [ '-Wall' ] LLIBS = [ '-ldxguid', '-lgdi32', '-lmsvcrt', '-lwinmm', '-lmingw32', '-lm', '-lws2_32', '-lz', '-lstdc++', '-luuid', '-lole32'] #'-lutil', '-lc', '-lm', '-ldl', '-lpthread' ] BF_DEBUG = False -BF_DEBUG_CCFLAGS = ['-g'] +BF_DEBUG_CCFLAGS = ['-g', '-DDEBUG'] BF_PROFILE = False BF_PROFILE_CCFLAGS = ['-pg','-g'] diff --git a/build_files/scons/config/openbsd3-config.py b/build_files/scons/config/openbsd3-config.py index 0ef9ba5d0a4..65c2a1a2585 100644 --- a/build_files/scons/config/openbsd3-config.py +++ b/build_files/scons/config/openbsd3-config.py @@ -147,7 +147,7 @@ BF_PROFILE_CCFLAGS = ['-pg','-g'] BF_PROFILE_LINKFLAGS = ['-pg'] BF_DEBUG = False -BF_DEBUG_CCFLAGS = ['-g'] +BF_DEBUG_CCFLAGS = ['-g', '-DDEBUG'] BF_BUILDDIR='../build/openbsd3' BF_INSTALLDIR='../install/openbsd3' diff --git a/build_files/scons/config/sunos5-config.py b/build_files/scons/config/sunos5-config.py index a0713735a5b..168fb4271a8 100644 --- a/build_files/scons/config/sunos5-config.py +++ b/build_files/scons/config/sunos5-config.py @@ -161,7 +161,7 @@ BF_PROFILE_LINKFLAGS = ['-pg'] BF_PROFILE = False BF_DEBUG = False -BF_DEBUG_CCFLAGS = [] +BF_DEBUG_CCFLAGS = ['-DDEBUG'] BF_BUILDDIR = '../build/sunos5' BF_INSTALLDIR='../install/sunos5' diff --git a/build_files/scons/config/win32-mingw-config.py b/build_files/scons/config/win32-mingw-config.py index f8b67781172..7189522809e 100644 --- a/build_files/scons/config/win32-mingw-config.py +++ b/build_files/scons/config/win32-mingw-config.py @@ -176,7 +176,7 @@ CC_WARN = [ '-Wall' ] LLIBS = ['-lshell32', '-lshfolder', '-lgdi32', '-lmsvcrt', '-lwinmm', '-lmingw32', '-lm', '-lws2_32', '-lz', '-lstdc++','-lole32','-luuid'] BF_DEBUG = False -BF_DEBUG_CCFLAGS= ['-g'] +BF_DEBUG_CCFLAGS= ['-g', '-DDEBUG'] BF_PROFILE_CCFLAGS = ['-pg', '-g'] BF_PROFILE_LINKFLAGS = ['-pg'] diff --git a/doc/README.windows-gcc b/doc/build_systems/README.windows-gcc index 78018eabbc0..78018eabbc0 100644 --- a/doc/README.windows-gcc +++ b/doc/build_systems/README.windows-gcc diff --git a/doc/blender-cmake.txt b/doc/build_systems/cmake.txt index a49ff629b5b..a49ff629b5b 100644 --- a/doc/blender-cmake.txt +++ b/doc/build_systems/cmake.txt diff --git a/doc/blender-scons-dev.txt b/doc/build_systems/scons-dev.txt index d13ea7c036f..d13ea7c036f 100644 --- a/doc/blender-scons-dev.txt +++ b/doc/build_systems/scons-dev.txt diff --git a/doc/blender-scons.txt b/doc/build_systems/scons.txt index 016ba39fd09..b4d9a905885 100644 --- a/doc/blender-scons.txt +++ b/doc/build_systems/scons.txt @@ -20,7 +20,7 @@ $Id$ with the patch to get started. This document describes the usage of the new SCons scripts. The - inner workings are described in blender-scons-dev.txt. + inner workings are described in scons-dev.txt. Building Blender ---------------- diff --git a/doc/blender-guardedalloc.txt b/doc/guides/blender-guardedalloc.txt index 44a9722a4e4..44a9722a4e4 100644 --- a/doc/blender-guardedalloc.txt +++ b/doc/guides/blender-guardedalloc.txt diff --git a/doc/interface_API.txt b/doc/guides/interface_API.txt index c98794444e6..c98794444e6 100644 --- a/doc/interface_API.txt +++ b/doc/guides/interface_API.txt diff --git a/doc/guides/python-dev-guide.txt b/doc/guides/python-dev-guide.txt new file mode 100644 index 00000000000..75c9ccb57e5 --- /dev/null +++ b/doc/guides/python-dev-guide.txt @@ -0,0 +1,170 @@ +Simple Blender Python Developer's Guide +--------------------------------------- + +This is an outline for a future guide yet to be written. It is meant for +programmers wanting to understand and maybe help with the embedding of Python +inside Blender. + +I - Introduction + +We could praise Python here for its many qualities, but it's probably better +to just give some links: + +The main site is at www.python.org , with documentation at www.python.org/doc/ + +Also worth of mention: it's an interpreted language and is available for +many different systems. The download includes the interpreter, many modules +(think libs), good documentation and some programs / examples. If you use +linux, there's a high chance you already have Python installed, just try +"man python". + +The reason for embedding a language environment inside Blender is to give +users the ability to access the program's internal data and functionality. +This can be used to import / export (from / to other 2d / 3d formats) or +change the data (to create new objects procedurally, among many other +interesting possibilities). Script writers (Blender Python programmers) can +also expand Blender in new ways, adding new features on-the-fly, without having +to recompile it. It is usually much easier and faster to write scripts in +Python than to code the equivalent in C. + +II - Reference material: + +There are two important texts for us in the documentation that comes +with Python ( docs also available online at www.python.org ): + +- Extending and Embedding (tutorial for C/C++ programmers) + +and specially + +- Python/C API. + +You can read the first one to get a feel for how things are done +(reference counting is probably the most important part), but the second +doc is a must. Specially useful as a fast reference is its Index, at letter +P, where all commands are. + +Specially useful commands are Py_BuildValue and the family of parsing +functions, PyArg_Parse* (PyArg_Parse(), PyArg_ParseTuple(), +PyArg_ParseTupleAndKeywords()). Py_BuildValue is usually the best way to make +Python Objects (the 'variables' that the Python Interpreter understands) +out of C ones. The PyArg_Parse* functions do the opposite, they parse +Python Objects to C variables. + +So, understand PyArg_Parse* functions, Py_BuildValue and reference +counting. The first doc has a good discussion about them. + +- C knowledge is also necessary, of course, use your favorite resource. + +- The Blender 2.25 API documentation ( www.blender.org ) is, along with +the source, our basic API ref. + +III - Directories + +The previous Blender Python API's are spread in blender/intern/python +and the C part of the current one, bpython, is at +blender/source/blender/bpython/, specially in intern/. The current +solution is a Python wrapper on top of this bpython one, at +blender/intern/python/modules/Blender/ + +Note: since it's in Python, they needed the freeze Python utility, a +process/program that creates stand-alone executables out of Python +source files -- that is, it packs together an interpreter, the needed +modules and the source of a Python program so that users of this program +don't need to have the Python interpreter already installed in their +machines to run the program -- Blender, in this case. + +The new implementation is pure C, so we won't need to "freeze" it. + +Another important dir for starters is blender/source/blender/makesdna, +where the headers with Blender structs lie. + +IV - Experimental Python + +The new implementation, currently referred to as experimental python - +exppython - was started by Michel Selten. He chose to solve the mess in +Blender Python by starting over from scratch, in C, but keeping API +compatibility with the current 2.25 API used by Blender. + +It is in blender/source/blender/python , more specifically inside +api2_2x/ + +To make it clear, exppython is the new implementation being worked on. It +will possibly become the de-facto implementation in Blender 2.28, the next +Blender version. Currently, Blender still comes with the same implementation +found in the 2.25 version of the program. So we call that the 2.25 +implementation, or bpython. + +BPython had plenty of "macro magic", lot's of complicate #define's, etc., +since a lot of the embedding work is quite repetitive. But that makes it +much harder for newbies to jump in and learn, so the new files in exppython +avoid that. + +This means: Blender, Object, Camera, Lamp, Image, Text, Window modules +(the files have the same names, ending obviously with .c and .h) + +To speed things up, some independent parts of bpython are being +integrated directly into exppython. That already happened with Draw and +BGL, both taken from opy_draw.c in the bpython/intern dir. The same is +happening with NMesh (Mesh is written in Python and imports NMesh to +extend / change its functionality). + +For a good example of dexterity with macros (cheers to the NaN +programmer(s)!), look at BGL.[ch], the OpenGL API wrapper. The defines +are in the header. + +Besides keeping compatibility with the 2.25 API, there are already some +additions to exppython: + +- some modules have access to more variables than 2.25 had; +- there are more method functions and the access is safer; +- the file selector (or file browser, if you prefer) is back: + It's now in the Window module, along with an image selector, too. +- there are totally new modules, unavailable in 2.25: + Fellow new developers joining our team are contributing new modules + that have been requested by the community for a long time. + + +V - Coding + +The Camera module is a good reference, since it is like most others, in +terms of programming, but is smaller and simple. It's in Camera.c and +Camera.h . To have it working, it was also necessary to include a line to +the end of Blender.c (registering it as a Blender submodule) and another to +modules.h (declaring its init and CreateObject method) + +Currently, one of our conventions is to prepend M_ to module functions, +doc strings, etc. and C_ to the new types we had to create for Python, +like C_Camera, C_Lamp, etc. + +If you look at Camera.[ch], you'll find code for creating the Camera +module and the Camera "type", with all its methods and access policies. +It's really a new type defined in Python, like PyInt or PyFloat, +PyString, etc. In practice, it's a "thin" (because it doesn't make +copies of the variables) wrapper for the Blender Camera Data Object. + +A note about Blender: objects in Blender share a common base, the +Object, whose attributes are things like the matrix, the location, the +rotation, the size, etc. A Camera is actually an Object of type Camera +(which means that its "data" field points to a Camera Data obj) and a +Camera Data object, which is the specific camera part of the object +(attributes like lens, clip start, etc.). Same for other objects, like +Lamp, Mesh, etc. + +That's why C_Camera is a wrapper for the Blender Camera **Data** +object. The full wrapper is Object("Camera") linked with +Camera("camera_name"). + +How to write a new module for a simple object? Use Camera.[ch] as +templates, check the specifics of your object in the makesdna dir +(for example, the camera one is DNA_camera_types.h) and make the +necessary changes. + +If you want to help exppython and in the process possibly learn more about +embedding, the Python/C API and Blender internals, there's this mailing list: + +Bf-python mailing list +Bf-python@blender.org +http://www.blender.org/mailman/listinfo/bf-python + +There you can ask what hasn't been done yet, get help, make suggestions for +new features we should consider, send bug reports, etc. diff --git a/doc/BL-license.txt b/doc/license/BL-license.txt index 3f079767198..3f079767198 100644 --- a/doc/BL-license.txt +++ b/doc/license/BL-license.txt diff --git a/doc/GPL-license.txt b/doc/license/GPL-license.txt index 8860b2a8afa..8860b2a8afa 100644 --- a/doc/GPL-license.txt +++ b/doc/license/GPL-license.txt diff --git a/doc/bf-members.txt b/doc/license/bf-members.txt index 41aad8b7264..41aad8b7264 100644 --- a/doc/bf-members.txt +++ b/doc/license/bf-members.txt diff --git a/doc/blender.1 b/doc/manpage/blender.1 index dd5e60ff900..dd5e60ff900 100644 --- a/doc/blender.1 +++ b/doc/manpage/blender.1 diff --git a/doc/blender.1.py b/doc/manpage/blender.1.py index 086c99e70e5..805de1f24a1 100644 --- a/doc/blender.1.py +++ b/doc/manpage/blender.1.py @@ -44,7 +44,7 @@ def man_format(data): return data -blender_bin = os.path.join(os.path.dirname(__file__), "../blender") +blender_bin = os.path.join(os.path.dirname(__file__), "../../blender") blender_help = subprocess.Popen([blender_bin, "--help"], stdout=subprocess.PIPE).communicate()[0].decode() diff --git a/doc/python_api/blender-org/layout.html b/doc/python_api/blender-org/layout.html new file mode 100644 index 00000000000..a37ed730c22 --- /dev/null +++ b/doc/python_api/blender-org/layout.html @@ -0,0 +1,201 @@ +{%- block doctype -%} +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +{%- endblock %} +{%- set script_files = script_files + [pathto("_static/jquery.sidebar.js", 1)] %} +{%- set reldelim1 = reldelim1 is not defined and ' »' or reldelim1 %} +{%- set reldelim2 = reldelim2 is not defined and ' •' or reldelim2 %} + +{%- macro relbar() %} + <div class="subnav boxheader"> + <ul class="noprint"><li><a href="http://www.blender.org/development/coding-guides/">Coding Guides</a></li><li>•</li><li><a href="http://www.blender.org/development/report-a-bug/">Report a Bug</a></li><li>•</li><li><a href="http://www.blender.org/development/submit-a-patch/">Submit a Patch</a></li><li>•</li><li><a href="http://www.blender.org/development/release-logs/">Release Logs</a></li><li>•</li><li><a href="http://www.blender.org/development/current-projects/">Current Projects</a></li><li>•</li><li><a href="http://www.blender.org/development/architecture/">Architecture</a></li><li>•</li><li><a href="http://www.blender.org/development/building-blender/">Building Blender</a></li><li>•</li><li class="subnav-active"><a href="http://www.blender.org/documentation/250PythonDoc/contents.html">PyAPI</a></li><li>•</li><li><a href="http://wiki.blender.org/index.php/Main_Page">Wiki</a></li></ul> + </div> + <div class="related subnav"> + <h3>{{ _('Navigation') }}</h3> + <ul> + {%- for rellink in rellinks %} + <li class="right"> + <a href="{{ pathto(rellink[0]) }}" title="{{ rellink[1]|striptags }}" + {{ accesskey(rellink[2]) }}>{{ rellink[3] }}</a> + {%- if not loop.first %}{{ reldelim2 }}{% endif %}</li> + {%- endfor %} + {%- block rootrellink %} + <li><a href="{{ pathto(master_doc) }}">{{ shorttitle|e }}</a>{{ reldelim1 }}</li> + {%- endblock %} + {%- for parent in parents %} + <li><a href="{{ parent.link|e }}" {% if loop.last %}{{ accesskey("U") }}{% endif %}>{{ parent.title }}</a>{{ reldelim1 }}</li> + {%- endfor %} + {%- block relbaritems %} {% endblock %} + </ul> + </div> +{%- endmacro %} + +{%- macro sidebar() %} + {%- if not embedded %}{% if not theme_nosidebar|tobool %} + <div class="sphinxsidebar"> + <div class="sphinxsidebarwrapper"> + {%- block sidebarlogo %} + {%- if logo %} + <p class="logo"><a href="{{ pathto(master_doc) }}"> + <img class="logo" src="{{ pathto('_static/' + logo, 1) }}" alt="Logo"/> + </a></p> + {%- endif %} + {%- endblock %} + {%- block sidebartoc %} + {%- if display_toc %} + <h3><a href="{{ pathto(master_doc) }}">{{ _('Table Of Contents') }}</a></h3> + {{ toc }} + {%- endif %} + {%- endblock %} + {%- block sidebarrel %} + {%- if prev %} + <h4>{{ _('Previous topic') }}</h4> + <p class="topless"><a href="{{ prev.link|e }}" + title="{{ _('previous chapter') }}">{{ prev.title }}</a></p> + {%- endif %} + {%- if next %} + <h4>{{ _('Next topic') }}</h4> + <p class="topless"><a href="{{ next.link|e }}" + title="{{ _('next chapter') }}">{{ next.title }}</a></p> + {%- endif %} + {%- endblock %} + {%- block sidebarsourcelink %} + {%- if show_source and has_source and sourcename %} + <h3>{{ _('This Page') }}</h3> + <ul class="this-page-menu"> + <li><a href="{{ pathto('_sources/' + sourcename, true)|e }}" + rel="nofollow">{{ _('Show Source') }}</a></li> + </ul> + {%- endif %} + {%- endblock %} + {%- if customsidebar %} + {% include customsidebar %} + {%- endif %} + {%- block sidebarsearch %} + {%- if pagename != "search" %} + <div id="searchbox" style="display: none"> + <h3>{{ _('Quick search') }}</h3> + <form class="search" action="{{ pathto('search') }}" method="get"> + <input type="text" name="q" size="18" /> + <input type="submit" value="{{ _('Go') }}" /> + <input type="hidden" name="check_keywords" value="yes" /> + <input type="hidden" name="area" value="default" /> + </form> + <p class="searchtip"> + {{ _('Enter search terms or a module, class or function name.') }} + </p> + </div> + <script type="text/javascript">$('#searchbox').show(0);</script> + {%- endif %} + {%- endblock %} + </div> + </div> + {%- endif %}{% endif %} +{%- endmacro %} + +<html xmlns="http://www.w3.org/1999/xhtml"> + <head> + <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> + {{ metatags }} + {%- if not embedded and docstitle %} + {%- set titlesuffix = " — "|safe + docstitle|e %} + {%- else %} + {%- set titlesuffix = "" %} + {%- endif %} + <title>{{ title|striptags }}{{ titlesuffix }}</title> + <link rel="stylesheet" href="{{ pathto('_static/' + style, 1) }}" type="text/css" /> + <link rel="stylesheet" href="{{ pathto('_static/pygments.css', 1) }}" type="text/css" /> + {%- if not embedded %} + <script type="text/javascript"> + var DOCUMENTATION_OPTIONS = { + URL_ROOT: '{{ pathto("", 1) }}', + VERSION: '{{ release|e }}', + COLLAPSE_MODINDEX: false, + FILE_SUFFIX: '{{ file_suffix }}', + HAS_SOURCE: {{ has_source|lower }} + }; + </script> + {%- for scriptfile in script_files %} + <script type="text/javascript" src="{{ pathto(scriptfile, 1) }}"></script> + {%- endfor %} + {%- if use_opensearch %} + <link rel="search" type="application/opensearchdescription+xml" + title="{% trans docstitle=docstitle|e %}Search within {{ docstitle }}{% endtrans %}" + href="{{ pathto('_static/opensearch.xml', 1) }}"/> + {%- endif %} + {%- if favicon %} + <link rel="shortcut icon" href="{{ pathto('_static/' + favicon, 1) }}"/> + {%- endif %} + {%- endif %} +{%- block linktags %} + {%- if hasdoc('about') %} + <link rel="author" title="{{ _('About these documents') }}" href="{{ pathto('about') }}" /> + {%- endif %} + {%- if hasdoc('genindex') %} + <link rel="index" title="{{ _('Index') }}" href="{{ pathto('genindex') }}" /> + {%- endif %} + {%- if hasdoc('search') %} + <link rel="search" title="{{ _('Search') }}" href="{{ pathto('search') }}" /> + {%- endif %} + {%- if hasdoc('copyright') %} + <link rel="copyright" title="{{ _('Copyright') }}" href="{{ pathto('copyright') }}" /> + {%- endif %} + <link rel="top" title="{{ docstitle|e }}" href="{{ pathto('index') }}" /> + {%- if parents %} + <link rel="up" title="{{ parents[-1].title|striptags }}" href="{{ parents[-1].link|e }}" /> + {%- endif %} + {%- if next %} + <link rel="next" title="{{ next.title|striptags }}" href="{{ next.link|e }}" /> + {%- endif %} + {%- if prev %} + <link rel="prev" title="{{ prev.title|striptags }}" href="{{ prev.link|e }}" /> + {%- endif %} +{%- endblock %} +{%- block extrahead %} {% endblock %} + </head> + <body> +{%- block header %} +<div class="noprint" id="navcontainer"><a href="http://www.blender.org/"><img width="140" height="50" title="blender.org home page" alt="blender.org home page" src="http://www.blender.org/fileadmin/site/_gfx/nav-home.png"></a><a href="http://www.blender.org/features-gallery/"><img width="140" height="50" title="Features & Gallery" alt="Features & Gallery" src="http://www.blender.org/fileadmin/site/_gfx/nav-features.png"></a><a href="http://www.blender.org/download/get-blender/"><img width="140" height="50" title="Download" alt="Download" src="http://www.blender.org/fileadmin/site/_gfx/nav-download.png"></a><a href="http://www.blender.org/education-help/"><img width="140" height="50" title="Tutorials & Help" alt="Tutorials & Help" src="http://www.blender.org/fileadmin/site/_gfx/nav-help.png"></a><a href="http://www.blender.org/community/user-community/"><img width="140" height="50" title="Community" alt="Community" src="http://www.blender.org/fileadmin/site/_gfx/nav-community.png"></a><a href="http://www.blender.org/development/"><img width="140" height="50" title="Development" alt="Development" src="http://www.blender.org/fileadmin/site/_gfx/nav-development-on.png"></a><a href="http://www.blender.org/e-shop/"><img width="140" height="50" title="e-Shop" alt="e-Shop" src="http://www.blender.org/fileadmin/site/_gfx/nav-eshop.png"></a></div> +{% endblock %} + + <div class="document"> + <div id="pageheader"></div> +{%- block relbar1 %}{{ relbar() }}{% endblock %} + +{%- block sidebar1 %} {# possible location for sidebar #} {% endblock %} + +{%- block document %} + <div class="documentwrapper"> + {%- if not embedded %}{% if not theme_nosidebar|tobool %} + <div class="bodywrapper"> + {%- endif %}{% endif %} + <div class="body"> + {% block body %} {% endblock %} + </div> + {%- if not embedded %}{% if not theme_nosidebar|tobool %} + </div> + {%- endif %}{% endif %} + </div> +{%- endblock %} + +{%- block sidebar2 %}{{ sidebar() }}{% endblock %} + <div class="clearer"></div> + +{%- block footer %} + <div class="footer"> + {%- if hasdoc('copyright') %} + {% trans path=pathto('copyright'), copyright=copyright|e %}© <a href="{{ path }}">Copyright</a> {{ copyright }}.{% endtrans %} + {%- else %} + {% trans copyright=copyright|e %}© Copyright {{ copyright }}.{% endtrans %} + {%- endif %} + {%- if last_updated %} + {% trans last_updated=last_updated|e %}Last updated on {{ last_updated }}.{% endtrans %} + {%- endif %} + {%- if show_sphinx %} + {% trans sphinx_version=sphinx_version|e %}Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> {{ sphinx_version }}.{% endtrans %} + {%- endif %} + </div><b class="round"><b id="r1"></b><b id="r2"></b><b id="r3"></b><b id="r4"></b></b> +{%- endblock %} + </div> + </body> +</html> diff --git a/doc/python_api/blender-org/page.html b/doc/python_api/blender-org/page.html new file mode 100644 index 00000000000..17a93016533 --- /dev/null +++ b/doc/python_api/blender-org/page.html @@ -0,0 +1,4 @@ +{% extends "layout.html" %} +{% block body %} + {{ body }} +{% endblock %} diff --git a/doc/python_api/blender-org/static/bg.png b/doc/python_api/blender-org/static/bg.png Binary files differnew file mode 100644 index 00000000000..5393d4aa58f --- /dev/null +++ b/doc/python_api/blender-org/static/bg.png diff --git a/doc/python_api/blender-org/static/default.css_t b/doc/python_api/blender-org/static/default.css_t new file mode 100644 index 00000000000..6f3f25d8a6a --- /dev/null +++ b/doc/python_api/blender-org/static/default.css_t @@ -0,0 +1,654 @@ +/** + * Sphinx stylesheet -- default theme + * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + */ + +@import url("basic.css"); + +/* -- page layout ----------------------------------------------------------- */ + +#navcontainer { + height: 50px; + margin: 0 auto; + position: relative; + width: 980px; +} + +#navcontainer img { + width: 140px; + height: 50px; +} + +#pageheader { + background-image:url("bg.png"); + height:80px; + position:relative; +} + +body { + font-family: {{ theme_bodyfont }}; + font-size: 12px; + line-height: 145%; + background-color: {{ theme_footerbgcolor }}; + color: {{ theme_textcolor }}; + min-width: 980px; + margin: 0; + padding: 0; +} + +div.document { + margin:20px auto 0; + position:relative; + text-align:left; + width:980px; +/* background-color: {{ theme_sidebarbgcolor }};*/ +} + +div.documentwrapper { + float: left; + width: 100%; + background-color: {{ theme_bgcolor }}; + border-color: {{ theme_bordercolor }}; + border-style:solid; + border-width:0 1px; + margin:0 auto; + min-height:30em; + padding:35px; +/* position:relative;*/ + text-align:left; + width:908px; + +} + +div.bodywrapper { + margin: 0 0 0 230px; +} + +div.body { + background-color: {{ theme_bgcolor }}; + color: {{ theme_textcolor }}; + padding: 0; + width: 640px; +} + +{%- if theme_rightsidebar|tobool %} +div.bodywrapper { + margin: 0 230px 0 0; +} +{%- endif %} + +div.footer { + background: #292929; + border-left: 1px solid #363636; + border-right: 1px solid #363636; + color: #ffffff; +/* width: 100%;*/ + margin: 0 auto; + padding: 20px 20px 15px 35px; + text-align: center; + font-size: 75%; +} + +div.footer+.round b { + display: block; + background: #292929; + width: auto; +} + +div.footer+.round #r1 { + border-left: 1px solid #363636; + border-right: 1px solid #363636; + height: 2px; + margin: 0 1px; +} + +div.footer+.round #r2 { + border-left: 1px solid #363636; + border-right: 1px solid #363636; + height: 1px; + margin: 0 2px; +} + +div.footer+.round #r3 { + border-left: 1px solid #363636; + border-right: 1px solid #363636; + height: 1px; + margin: 0 3px; +} + +div.footer+.round #r4 { + border-bottom: 1px solid #363636; + height: 0px; + margin: 0 5px; +} + +div.footer a { + color: {{ theme_footertextcolor }}; + text-decoration: underline; +} + +.boxheader { + background-color:#3E4D5E; +} + +.subnav { + height:auto !important; + min-height:15px; + padding:9px 0px 9px 37px; + position:relative; +} + +div.related { + width:auto; + font-size:100%; + font-weight:400; + background-color: {{ theme_relbarbgcolor }}; + line-height: 145%; + color: {{ theme_relbartextcolor }}; +} + +div.related li { + font-size:0.9em; +} + +div.related li.right { + margin: 0; + word-spacing: 3px; +} + +div.subnav li { + display:inline; + list-style-type:none; + margin:0; + padding:0 7px 0 0; +} + +div.subnav ul { + display:inline; + margin:0; + padding:0; +} + +.subnav a { + font-weight: bold; + color: #fff; +} + +.subnav li.subnav-active a { + color:#F39410; +} + +div.related a { + color: {{ theme_relbarlinkcolor }}; +} + +div.related a:active { + color: {{ theme_relbaractlinkcolor }}; +} + +div.sphinxsidebar { + width: 280px; + font-size: 100%; + {%- if theme_stickysidebar|tobool %} +/* top: 30px;*/ + margin: 0; + position: absolute; + overflow: auto; + height: 100%; + {%- endif %} + {%- if theme_rightsidebar|tobool %} + float: right; + {%- if theme_stickysidebar|tobool %} + right: 0; + {%- endif %} + {%- endif %} +} + +div.sphinxsidebarwrapper { + width: inherit; + padding: 0; + position: absolute; + margin-top: 35px; + font-size: 8pt; +} + +div.sphinxsidebarwrapper.fixed { + position:fixed; + top:10px; + margin-top: 0; +} + +{%- if theme_stickysidebar|tobool %} +/* this is nice, but it it leads to hidden headings when jumping + to an anchor */ +/* +div.related { + position: fixed; +} + +div.documentwrapper { + margin-top: 30px; +} +*/ +{%- endif %} + +div.sphinxsidebar h3 { + font-family: {{ theme_headfont }}; + color: {{ theme_sidebartextcolor }}; + font-size: 12px; + font-weight: bold; + background: #3E4D5E url("rnd.png") no-repeat top left; + height: 16px; + margin: 0; + padding: 10px 5px 10px 18px; +} + +div.sphinxsidebar h3 a { + color: {{ theme_sidebartextcolor }}; +} + +div.sphinxsidebar h4 { + font-family: {{ theme_headfont }}; + color: {{ theme_sidebartextcolor }}; + background: #3E4D5E url("rnd.png") no-repeat top left; + height: 16px; + font-size: 12px; + font-weight: bold; + margin: 0; + padding: 10px 5px 10px 18px; +} + +div.sphinxsidebar form { + margin: 0; + padding: 10px; + background-color: #292929; + {%- if theme_rightsidebar|tobool %} + border-right: 1px solid {{ theme_bordercolor }}; + {%- endif %} +} + +div.sphinxsidebar p { + background-color: #292929; + padding: 5px 10px 10px 10px; + color: {{ theme_sidebartextcolor }}; + {%- if theme_rightsidebar|tobool %} + border-right: 1px solid {{ theme_bordercolor }}; + {%- endif %} + margin-top: 0; +} + +div.sphinxsidebar p.topless { + margin-bottom: 25px; +} + +div.sphinxsidebar ul { + background-color: #292929; + margin: 0; + padding: 0; + color: {{ theme_sidebartextcolor }}; +} + +div.sphinxsidebar > div > ul { + margin-bottom: 25px; + padding:10px; +} + +div.sphinxsidebar a { + color: {{ theme_sidebarlinkcolor }}; +} + +div.sphinxsidebar input { + border: 1px solid {{ theme_sidebarlinkcolor }}; + font-family: sans-serif; + font-size: 1em; +} + +/* -- body styles ----------------------------------------------------------- */ + +a { + color: {{ theme_linkcolor }}; + text-decoration: none; +} + +a:hover { + text-decoration: underline; +} + +/*div.body h1,*/ +div.body h2, +div.body h3, +div.body h4, +div.body h5, +div.body h6 { + font-family: {{ theme_headfont }}; + background-color: {{ theme_headbgcolor }}; + font-weight: bold; + color: {{ theme_headtextcolor }}; +/* border-bottom: 1px solid #ccc;*/ + margin: 20px -20px 10px -20px; + padding: 3px 0 3px 10px; +} + +div.body h1 { margin-top: 0; font-size: 200%; + color:#FFFAE0; + font-family:"Helvetica","Arial",sans-serif; + font-size:34px; + font-weight:normal; + left:32px; + line-height:26px; + margin-top:0; + position:absolute; + top:36px; +} +div.body h2 { font-size: 160%; } +div.body h3 { font-size: 140%; } +div.body h4 { font-size: 120%; } +div.body h5 { font-size: 110%; } +div.body h6 { font-size: 100%; } + +a.headerlink { + color: {{ theme_headlinkcolor }}; + font-size: 0.8em; + padding: 0 4px 0 4px; + text-decoration: none; +} + +h1:hover > a.headerlink { + display:none; +} + +a.headerlink:hover { + background-color: {{ theme_headlinkcolor }}; + color: white; +} + +div.body p, div.body dd, div.body li { + text-align: justify; + line-height: 130%; +} + +div.note, div.seealso, div.topic, div.warning { + color:white; +} + +div.admonition p.admonition-title + p { + display: inline; +} + +div.note { + background-color: #555; + border: 1px solid #ddd; +} + +div.seealso { + background-color: #525241; + border: 1px solid #ff6; +} + +div.topic { + background-color: #eee; +} + +div.warning { + background-color: #B64444; + border: 1px solid #990606; +} + +p.admonition-title { + display: inline; +} + +p.admonition-title:after { + content: ":"; +} + +dl div.admonition { + border:medium none; + margin:0; + padding:2px 5px 2px 0; +} + +dl.class > dd > div.warning p.admonition-title, +dl.class > dd > div.note p.admonition-title { + display:none; +} + +dl.class > dd > div.admonition.warning p, +dl.class > dd > div.admonition.note p { + margin:0; +} + +dl.class > dd > div.admonition.warning, +dl.class > dd > div.admonition.note { + margin-bottom:12px; +} + +dl div.admonition.note p.admonition-title, dl div.admonition.warning p.admonition-title { + color:inherit; +} + +dl div.admonition.warning p { + font-weight:bold; + line-height:150%; +} + +dl div.admonition.warning p * { + font-weight:normal; +} + +dl div.admonition p.admonition-title { + color:#555555; + display:block; + float:left; + margin:0; + padding-right:12px; + text-align:right; + width:90px; +} + +dl div.admonition p.admonition-title+p, dl div.admonition p { + display:block; + margin:0 0 0 102px; +} + +dl div.note { + background:none; + color:#E8E481; +} + +dl div.warning { + background:none; + color:#FC3030; +} + +dl div.seealso { + background:none; +} + +dl div.admonition.seealso p+p { + color:#222; +} + +dl div.seealso a { + margin-left:-1.3ex; +} + +div.admonition.warning pre { + background: #0F0704; + color: #fc3030; +} + +div.admonition pre { + margin: 6px 0; + overflow: visible; + white-space: pre-wrap; +} + +pre { + padding: 10px; + background-color: #000; + color: #fff; + line-height: normal; + border: 0 solid white; +} + +dl.function>dt, dl.method>dt { + text-indent:-118px; + padding-left: 118px; +} + +dl.function>dt em, dl.method>dt em { + color: #97b9cf; +} + +dl.function>dd em, dl.method>dd em { + color: #97b9cf; + font-weight:bold; +} + +dl.function table.field-list tr:first-child td.field-body, dl.method table.field-list tr:first-child td.field-body { + color: #728c96; +} + +dl.function>dt em:before, dl.method>dt em:before { + content: " "; + display: block; +} + +dl.function>dd>p,dl.method>dd>p,dl.attribute>dd>p, +dl[class]>dd>ol,dl[class]>dd>ul { + color: #999; +} + +dl.data>dt { + color:#08C659; +} + +dl.data>dd>p { + color:#069643; +} + +dl.class>dt { + color: #82a3c7; +} + +dl.class>dd>p,dl.class>dd>ol,dl.class>dd>ul { + color: #637b96; +} + +dl.function>dt,dl.method>dt,dl.attribute>dt { + color: #fcb100; +} + +dl.function>dd>p,dl.method>dd>p,dl.attribute>dd>p, +dl.function>dd>p+ol,dl.method>dd>p+ol,dl.attribute>dd>p+ol, +dl.function>dd>p+ul,dl.method>dd>p+ul,dl.attribute>dd>p+ul { + color: #cb8f00; +} + +dl.function>dd>p, dl.method>dd>p, dl.attribute>dd>p { + margin: 0 0 3px 102px; +} + +dl.function>dd>p:first-child:before, dl.method>dd>p:first-child:before, dl.attribute>dd>p:first-child:before { + content:"Description:"; + color:#555; + font-weight:bold; + font-style:normal; + width:90px; + display:inline-block; + margin-left:-102px; + text-align:right; + padding-right:12px; +} + +dt:target, .highlight { + color: #444; + background: #333; +} + +.highlight { + background: #E2C788; +} + +h1 .highlight { + color:inherit; + background:inherit; +} + +dl { + margin-bottom: 25px; +} + +dd { + margin: 3px 0 10px 15px; +} + +.field-body tt.literal { + font-weight: normal; +} + +tt { + background-color: #444; + padding: 0 1px 0 1px; + font-size: 0.95em; +} + +.warning tt { + background: #cc6262; +} + +.note tt { + background: #444; +} + +dl .warning tt { + background:#0F0704; + display:block; +} + +dl .note tt { + background:#2C2A1B; +} + +table.indextable tr.cap { + background-color: transparent; +} + +col.field-name { + width:90px; +} + +dd table { + margin-bottom: 0; +} + +table.field-list th { + color:#555; + padding:0; + text-align:right; +} + +table.field-list td.field-body { + color:#999999; + padding-left:12px; +} + +table.field-list td.field-body ul.first { + padding-left:0; + list-style:none; + margin-left:0; +} + +dl.function>dd>ol, dl.method>dd>ol, dl.attribute>dd>ol, +dl.function>dd>ul, dl.method>dd>ul, dl.attribute>dd>ul, +dl.function>dd>div[class|="highlight"], dl.method>dd>div[class|="highlight"], +dl.attribute>dd>div[class|="highlight"] { + margin-left:102px; +} + +dl.function>dd>ol, dl.method>dd>ol, dl.attribute>dd>ol, +dl.function>dd>ul, dl.method>dd>ul, dl.attribute>dd>ul, +dl.class>dd>ol, dl.class>dd>ul { + padding-left:20px; +} diff --git a/doc/python_api/blender-org/static/favicon.ico b/doc/python_api/blender-org/static/favicon.ico Binary files differnew file mode 100644 index 00000000000..f125d24dcb6 --- /dev/null +++ b/doc/python_api/blender-org/static/favicon.ico diff --git a/doc/python_api/blender-org/static/jquery.sidebar.js b/doc/python_api/blender-org/static/jquery.sidebar.js new file mode 100644 index 00000000000..c22c61f2409 --- /dev/null +++ b/doc/python_api/blender-org/static/jquery.sidebar.js @@ -0,0 +1,26 @@ +$(document).ready(function () { + var top = $('.sphinxsidebarwrapper').offset().top - parseFloat($('.sphinxsidebarwrapper').css ('marginTop').replace(/auto/, 0)); + var colheight = parseFloat($('.sphinxsidebarwrapper').css('height').replace(/auto/, 0)); + + +$(window).scroll(function (event) { + // what the y position of the scroll is + var y = $(this).scrollTop(); + + // whether that's below the form + if (y >= top) { + //colheight is checked and according to its vaule the scrolling + //is triggered or not + if (colheight <= window.innerHeight) { + // if so, ad the fixed class + $('.sphinxsidebarwrapper').addClass('fixed'); + } else { + // otherwise remove it + $('.sphinxsidebarwrapper').removeClass('fixed'); + } + } else { + // otherwise remove it + $('.sphinxsidebarwrapper').removeClass('fixed'); + } +}); +}); diff --git a/doc/python_api/blender-org/static/pygments.css b/doc/python_api/blender-org/static/pygments.css new file mode 100644 index 00000000000..d67231e84ab --- /dev/null +++ b/doc/python_api/blender-org/static/pygments.css @@ -0,0 +1,61 @@ +.hll { background-color: #ffffcc } +.c { color: #7f7f7f; font-style: italic } /* Comment */ +.err { border: 1px solid #FF0000 } /* Error */ +.k { color: #0088ff; font-weight: bold } /* Keyword */ +.o { color: #993399 } /* Operator */ +.cm { color: #7f7f7f; font-style: italic } /* Comment.Multiline */ +.cp { color: #007020 } /* Comment.Preproc */ +.c1 { color: #408090; font-style: italic } /* Comment.Single */ +.cs { color: #408090; background-color: #fff0f0 } /* Comment.Special */ +.gd { color: #A00000 } /* Generic.Deleted */ +.ge { font-style: italic } /* Generic.Emph */ +.gr { color: #FF0000 } /* Generic.Error */ +.gh { color: #000080; font-weight: bold } /* Generic.Heading */ +.gi { color: #00A000 } /* Generic.Inserted */ +.go { color: #303030 } /* Generic.Output */ +.gp { color: #c65d09; font-weight: bold } /* Generic.Prompt */ +.gs { font-weight: bold } /* Generic.Strong */ +.gu { color: #800080; font-weight: bold } /* Generic.Subheading */ +.gt { color: #0040D0 } /* Generic.Traceback */ +.kc { color: #007020; font-weight: bold } /* Keyword.Constant */ +.kd { color: #007020; font-weight: bold } /* Keyword.Declaration */ +.kn { color: #FFFF32; font-weight: bold } /* Keyword.Namespace */ +.kp { color: #007020 } /* Keyword.Pseudo */ +.kr { color: #FFFF32; font-weight: bold } /* Keyword.Reserved */ +.kt { color: #902000 } /* Keyword.Type */ +.m { color: #00BAFF } /* Literal.Number */ +.s { color: #B7C274 } /* Literal.String */ +.na { color: #4070a0 } /* Name.Attribute */ +.nb { color: #007020 } /* Name.Builtin */ +.nc { color: #0e84b5; font-weight: bold } /* Name.Class */ +.no { color: #60add5 } /* Name.Constant */ +.nd { color: #555555; font-weight: bold } /* Name.Decorator */ +.ni { color: #d55537; font-weight: bold } /* Name.Entity */ +.ne { color: #007020 } /* Name.Exception */ +.nf { color: #06287e } /* Name.Function */ +.nl { color: #002070; font-weight: bold } /* Name.Label */ +.nn { color: #0e84b5; font-weight: bold } /* Name.Namespace */ +.nt { color: #062873; font-weight: bold } /* Name.Tag */ +.nv { color: #bb60d5 } /* Name.Variable */ +.ow { color: #007020; font-weight: bold } /* Operator.Word */ +.w { color: #bbbbbb } /* Text.Whitespace */ +.mf { color: #00BAFF } /* Literal.Number.Float */ +.mh { color: #00BAFF } /* Literal.Number.Hex */ +.mi { color: #00BAFF } /* Literal.Number.Integer */ +.mo { color: #00BAFF } /* Literal.Number.Oct */ +.sb { color: #B7C274 } /* Literal.String.Backtick */ +.sc { color: #B7C274 } /* Literal.String.Char */ +.sd { color: #B7C274; font-style: italic } /* Literal.String.Doc */ +.s2 { color: #B7C274 } /* Literal.String.Double */ +.se { color: #B7C274; font-weight: bold } /* Literal.String.Escape */ +.sh { color: #B7C274 } /* Literal.String.Heredoc */ +.si { color: #70a0d0; font-style: italic } /* Literal.String.Interpol */ +.sx { color: #c65d09 } /* Literal.String.Other */ +.sr { color: #235388 } /* Literal.String.Regex */ +.s1 { color: #4070a0 } /* Literal.String.Single */ +.ss { color: #517918 } /* Literal.String.Symbol */ +.bp { color: #007020 } /* Name.Builtin.Pseudo */ +.vc { color: #bb60d5 } /* Name.Variable.Class */ +.vg { color: #bb60d5 } /* Name.Variable.Global */ +.vi { color: #bb60d5 } /* Name.Variable.Instance */ +.il { color: #00BAFF } /* Literal.Number.Integer.Long */ diff --git a/doc/python_api/blender-org/static/rnd.png b/doc/python_api/blender-org/static/rnd.png Binary files differnew file mode 100644 index 00000000000..95bc613c731 --- /dev/null +++ b/doc/python_api/blender-org/static/rnd.png diff --git a/doc/python_api/blender-org/static/rndbl.png b/doc/python_api/blender-org/static/rndbl.png Binary files differnew file mode 100644 index 00000000000..976161642fd --- /dev/null +++ b/doc/python_api/blender-org/static/rndbl.png diff --git a/doc/python_api/blender-org/static/rndbr.png b/doc/python_api/blender-org/static/rndbr.png Binary files differnew file mode 100644 index 00000000000..de94512ccc6 --- /dev/null +++ b/doc/python_api/blender-org/static/rndbr.png diff --git a/doc/python_api/blender-org/theme.conf b/doc/python_api/blender-org/theme.conf new file mode 100644 index 00000000000..a4356fd2690 --- /dev/null +++ b/doc/python_api/blender-org/theme.conf @@ -0,0 +1,30 @@ +[theme] +inherit = basic +stylesheet = default.css +pygments_style = sphinx + +[options] +rightsidebar = true +stickysidebar = true + +footerbgcolor = #000000 +footertextcolor = #ffffff +sidebarbgcolor = #1c4e63 +sidebartextcolor = #ffffff +sidebarlinkcolor = #97b9cf +relbarbgcolor = #2C3845 +relbartextcolor = #D3E0E9 +relbarlinkcolor = #D3E0E9 +relbaractlinkcolor = #f39410 +bgcolor = #232323 +bordercolor = #363636 +textcolor = #ffffff +headbgcolor = #232323 +headtextcolor = #ffffff +headlinkcolor = #97b9cf +linkcolor = #97b9cf +codebgcolor = #eeffcc +codetextcolor = #333333 + +bodyfont = "Lucida Grande","Lucida Sans Unicode","Lucida Sans","Lucida",Verdana,sans-serif +headfont = "Lucida Grande","Lucida Sans Unicode","Lucida Sans","Lucida",Verdana,sans-serif diff --git a/source/blender/python/doc/epy/BGL.py b/doc/python_api/epy/BGL.py index ce148dc72ba..ce148dc72ba 100644 --- a/source/blender/python/doc/epy/BGL.py +++ b/doc/python_api/epy/BGL.py diff --git a/source/blender/python/doc/epy/Geometry.py b/doc/python_api/epy/Geometry.py index d0c4dfdfd8d..d0c4dfdfd8d 100644 --- a/source/blender/python/doc/epy/Geometry.py +++ b/doc/python_api/epy/Geometry.py diff --git a/source/blender/python/doc/epy/IDProp.py b/doc/python_api/epy/IDProp.py index 1fc26d7f65b..1fc26d7f65b 100644 --- a/source/blender/python/doc/epy/IDProp.py +++ b/doc/python_api/epy/IDProp.py diff --git a/source/blender/python/doc/epy/Mathutils.py b/doc/python_api/epy/Mathutils.py index 17a227f729a..17a227f729a 100644 --- a/source/blender/python/doc/epy/Mathutils.py +++ b/doc/python_api/epy/Mathutils.py diff --git a/source/blender/python/doc/epy/testbgl.py b/doc/python_api/epy/testbgl.py index e895d01df69..e895d01df69 100644 --- a/source/blender/python/doc/epy/testbgl.py +++ b/doc/python_api/epy/testbgl.py diff --git a/source/blender/python/doc/examples/bpy.data.py b/doc/python_api/examples/bpy.data.py index fc1145a523f..fc1145a523f 100644 --- a/source/blender/python/doc/examples/bpy.data.py +++ b/doc/python_api/examples/bpy.data.py diff --git a/source/blender/python/doc/examples/mathutils.Euler.py b/doc/python_api/examples/mathutils.Euler.py index bc7702c1d53..bc7702c1d53 100644 --- a/source/blender/python/doc/examples/mathutils.Euler.py +++ b/doc/python_api/examples/mathutils.Euler.py diff --git a/source/blender/python/doc/examples/mathutils.Matrix.py b/doc/python_api/examples/mathutils.Matrix.py index bc7702c1d53..bc7702c1d53 100644 --- a/source/blender/python/doc/examples/mathutils.Matrix.py +++ b/doc/python_api/examples/mathutils.Matrix.py diff --git a/source/blender/python/doc/examples/mathutils.Quaternion.py b/doc/python_api/examples/mathutils.Quaternion.py index bc7702c1d53..bc7702c1d53 100644 --- a/source/blender/python/doc/examples/mathutils.Quaternion.py +++ b/doc/python_api/examples/mathutils.Quaternion.py diff --git a/source/blender/python/doc/examples/mathutils.Vector.py b/doc/python_api/examples/mathutils.Vector.py index fb00e8aead6..fb00e8aead6 100644 --- a/source/blender/python/doc/examples/mathutils.Vector.py +++ b/doc/python_api/examples/mathutils.Vector.py diff --git a/source/blender/python/doc/examples/mathutils.py b/doc/python_api/examples/mathutils.py index 02f69515f21..02f69515f21 100644 --- a/source/blender/python/doc/examples/mathutils.py +++ b/doc/python_api/examples/mathutils.py diff --git a/source/gameengine/PyDoc/bge.events.rst b/doc/python_api/rst/bge.events.rst index 7215902a828..7215902a828 100644 --- a/source/gameengine/PyDoc/bge.events.rst +++ b/doc/python_api/rst/bge.events.rst diff --git a/source/gameengine/PyDoc/bge.logic.rst b/doc/python_api/rst/bge.logic.rst index d3261f5747b..d3261f5747b 100644 --- a/source/gameengine/PyDoc/bge.logic.rst +++ b/doc/python_api/rst/bge.logic.rst diff --git a/source/gameengine/PyDoc/bge.render.rst b/doc/python_api/rst/bge.render.rst index 9f17455601b..9f17455601b 100644 --- a/source/gameengine/PyDoc/bge.render.rst +++ b/doc/python_api/rst/bge.render.rst diff --git a/source/gameengine/PyDoc/bge.types.rst b/doc/python_api/rst/bge.types.rst index 6dc5488af32..6dc5488af32 100644 --- a/source/gameengine/PyDoc/bge.types.rst +++ b/doc/python_api/rst/bge.types.rst diff --git a/source/blender/python/doc/sphinx_doc_gen.py b/doc/python_api/sphinx_doc_gen.py index 0ced9da2d70..7a78816a2db 100644 --- a/source/blender/python/doc/sphinx_doc_gen.py +++ b/doc/python_api/sphinx_doc_gen.py @@ -19,20 +19,29 @@ # #**** END GPL LICENSE BLOCK #**** script_help_msg = ''' -Usage, -run this script from blenders root path once you have compiled blender - ./blender.bin -b -P /b/source/blender/python/doc/sphinx_doc_gen.py +Usage: -This will generate python files in "./source/blender/python/doc/sphinx-in" -Generate html docs by running... - - sphinx-build source/blender/python/doc/sphinx-in source/blender/python/doc/sphinx-out +For HTML generation +------------------- +- Run this script from blenders root path once you have compiled blender + + ./blender.bin -b -P doc/python_api/sphinx_doc_gen.py + This will generate python files in doc/python_api/sphinx-in/, + assuming that ./blender.bin is or links to the blender executable +- Generate html docs by running... + + sphinx-build doc/python_api/sphinx-in doc/python_api/sphinx-out + + assuming that you have sphinx 0.6.7 installed + For PDF generation +------------------ +- After you have built doc/python_api/sphinx-in (see above), run: - sphinx-build -b latex source/blender/python/doc/sphinx-in source/blender/python/doc/sphinx-out - cd source/blender/python/doc/sphinx-out + sphinx-build -b latex doc/python_api/sphinx-in doc/python_api/sphinx-out + cd doc/python_api/sphinx-out make ''' @@ -48,7 +57,6 @@ reload(rna_info) ClassMethodDescriptorType = type(dict.__dict__['fromkeys']) MethodDescriptorType = type(dict.get) GetSetDescriptorType = type(int.real) -StaticMethodType = type(staticmethod(lambda: None)) EXAMPLE_SET = set() EXAMPLE_SET_USED = set() @@ -283,12 +291,6 @@ def pymodule2sphinx(BASEPATH, module_name, module, title): if type(descr) == GetSetDescriptorType: py_descr2sphinx(" ", fw, descr, module_name, type_name, key) - for key, descr in descr_items: - if type(descr) == StaticMethodType: - descr = getattr(value, key) - write_indented_lines(" ", fw, descr.__doc__ or "Undocumented", False) - fw("\n") - fw("\n\n") file.close() @@ -393,7 +395,6 @@ def rna2sphinx(BASEPATH): fw(" mathutils.rst\n\n") - fw(" Freestyle.rst\n\n") fw(" blf.rst\n\n") fw(" aud.rst\n\n") @@ -475,10 +476,6 @@ def rna2sphinx(BASEPATH): pymodule2sphinx(BASEPATH, "mathutils", module, "Math Types & Utilities (mathutils)") del module - import Freestyle as module - pymodule2sphinx(BASEPATH, "Freestyle", module, "Freestyle Operators & Rules (Freestyle)") - del module - import blf as module pymodule2sphinx(BASEPATH, "blf", module, "Font Drawing (blf)") del module @@ -487,13 +484,13 @@ def rna2sphinx(BASEPATH): pymodule2sphinx(BASEPATH, "aud", module, "Audio System (aud)") del module - # game engine + ## game engine import shutil # copy2 keeps time/date stamps - shutil.copy2(os.path.join(BASEPATH, "../../../../gameengine/PyDoc/bge.types.rst"), BASEPATH) - shutil.copy2(os.path.join(BASEPATH, "../../../../gameengine/PyDoc/bge.logic.rst"), BASEPATH) - shutil.copy2(os.path.join(BASEPATH, "../../../../gameengine/PyDoc/bge.render.rst"), BASEPATH) - shutil.copy2(os.path.join(BASEPATH, "../../../../gameengine/PyDoc/bge.events.rst"), BASEPATH) + shutil.copy2(os.path.join(BASEPATH,"..","rst","bge.types.rst"), BASEPATH) + shutil.copy2(os.path.join(BASEPATH,"..","rst","bge.logic.rst"), BASEPATH) + shutil.copy2(os.path.join(BASEPATH,"..","rst","bge.render.rst"), BASEPATH) + shutil.copy2(os.path.join(BASEPATH,"..","rst","bge.events.rst"), BASEPATH) if 0: @@ -806,9 +803,10 @@ def main(): else: import shutil - path_in = 'source/blender/python/doc/sphinx-in' - path_out = 'source/blender/python/doc/sphinx-out' - path_examples = 'source/blender/python/doc/examples' + script_dir = os.path.dirname(__file__) + path_in = os.path.join(script_dir,'sphinx-in') + path_out = os.path.join(script_dir,'sphinx-out') + path_examples = os.path.join(script_dir,'examples') # only for partial updates path_in_tmp = path_in + "-tmp" diff --git a/source/blender/python/doc/sphinx_doc_gen.sh b/doc/python_api/sphinx_doc_gen.sh index 607803d16d5..49a2e4869d8 100755 --- a/source/blender/python/doc/sphinx_doc_gen.sh +++ b/doc/python_api/sphinx_doc_gen.sh @@ -10,7 +10,7 @@ SSH_UPLOAD="/data/www/vhosts/www.blender.org/documentation" # blender_python_api # sed string from hell, 'Blender 2.53 (sub 1) Build' --> '2_53_1' # "_".join(str(v) for v in bpy.app.version) # custom blender vars -blender_srcdir=$(dirname $0)/../../../../ +blender_srcdir=$(dirname $0)/../../ 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 @@ -18,18 +18,20 @@ BLENDER_VERSION=$(expr $blender_version / 100)_$(expr $blender_version % 100)_$b BLENDER_VERSION=`$BLENDER --version | cut -f2-4 -d" " | sed 's/(//g' | sed 's/)//g' | sed 's/ sub /./g' | sed 's/\./_/g'` SSH_UPLOAD_FULL=$SSH_UPLOAD/"blender_python_api_"$BLENDER_VERSION +SPHINXBASE=doc/python_api/ + # dont delete existing docs, now partial updates are used for quick builds. -$BLENDER --background --python ./source/blender/python/doc/sphinx_doc_gen.py +$BLENDER --background --python $SPHINXBASE/sphinx_doc_gen.py # html -sphinx-build source/blender/python/doc/sphinx-in source/blender/python/doc/sphinx-out -cp source/blender/python/doc/sphinx-out/contents.html source/blender/python/doc/sphinx-out/index.html +sphinx-build $SPHINXBASE/sphinx-in $SPHINXBASE/sphinx-out +cp $SPHINXBASE/sphinx-out/contents.html $SPHINXBASE/sphinx-out/index.html ssh ideasman42@emo.blender.org 'rm -rf '$SSH_UPLOAD_FULL'/*' -rsync --progress -avze "ssh -p 22" /b/source/blender/python/doc/sphinx-out/* $SSH_HOST:$SSH_UPLOAD_FULL/ +rsync --progress -avze "ssh -p 22" $SPHINXBASE/sphinx-out/* $SSH_HOST:$SSH_UPLOAD_FULL/ # pdf -sphinx-build -b latex source/blender/python/doc/sphinx-in source/blender/python/doc/sphinx-out -cd source/blender/python/doc/sphinx-out +sphinx-build -b latex $SPHINXBASE/sphinx-in $SPHINXBASE/sphinx-out +cd $SPHINXBASE/sphinx-out make -cd ../../../../../ -rsync --progress -avze "ssh -p 22" source/blender/python/doc/sphinx-out/contents.pdf $SSH_HOST:$SSH_UPLOAD_FULL/blender_python_reference_$BLENDER_VERSION.pdf +cd - +rsync --progress -avze "ssh -p 22" $SPHINXBASE/sphinx-out/contents.pdf $SSH_HOST:$SSH_UPLOAD_FULL/blender_python_reference_$BLENDER_VERSION.pdf diff --git a/extern/CMakeLists.txt b/extern/CMakeLists.txt index b15c8a31c73..61acff4cfe4 100644 --- a/extern/CMakeLists.txt +++ b/extern/CMakeLists.txt @@ -24,6 +24,9 @@ # # ***** END GPL LICENSE BLOCK ***** +# Otherwise we get warnings here that we cant fix in external projects +STRING(REGEX REPLACE "-Wunused-parameter" "" CMAKE_C_FLAGS ${CMAKE_C_FLAGS}) + IF(WITH_BULLET) ADD_SUBDIRECTORY(bullet2) ENDIF(WITH_BULLET) diff --git a/intern/audaspace/ffmpeg/AUD_FFMPEGReader.cpp b/intern/audaspace/ffmpeg/AUD_FFMPEGReader.cpp index 623e99d5edc..09fdb31e938 100644 --- a/intern/audaspace/ffmpeg/AUD_FFMPEGReader.cpp +++ b/intern/audaspace/ffmpeg/AUD_FFMPEGReader.cpp @@ -246,13 +246,23 @@ void AUD_FFMPEGReader::seek(int position) { if(position >= 0) { + uint64_t st_time = m_formatCtx->streams[m_stream]->start_time; + double time_base = + av_q2d(m_formatCtx->streams[m_stream]->time_base); + uint64_t seek_pos = position / time_base / m_specs.rate; + + if (seek_pos < 0) { + seek_pos = 0; + } + + if (st_time != AV_NOPTS_VALUE) { + seek_pos += st_time; + } + + // a value < 0 tells us that seeking failed - if(av_seek_frame(m_formatCtx, - -1, - (uint64_t)(((uint64_t)position * - (uint64_t)AV_TIME_BASE) / - (uint64_t)m_specs.rate), - AVSEEK_FLAG_BACKWARD | AVSEEK_FLAG_ANY) >= 0) + if(av_seek_frame(m_formatCtx, m_stream, seek_pos, + AVSEEK_FLAG_BACKWARD | AVSEEK_FLAG_ANY) >= 0) { avcodec_flush_buffers(m_codecCtx); m_position = position; @@ -273,9 +283,8 @@ void AUD_FFMPEGReader::seek(int position) if(packet.pts != AV_NOPTS_VALUE) { // calculate real position, and read to frame! - m_position = packet.pts * - av_q2d(m_formatCtx->streams[m_stream]->time_base) * - m_specs.rate; + m_position = (packet.pts - + ((st_time != AV_NOPTS_VALUE) ? st_time : 0)) * time_base * m_specs.rate; if(m_position < position) { diff --git a/intern/boolop/intern/BOP_Interface.cpp b/intern/boolop/intern/BOP_Interface.cpp index 99116b7d87d..ff15751b797 100644 --- a/intern/boolop/intern/BOP_Interface.cpp +++ b/intern/boolop/intern/BOP_Interface.cpp @@ -80,7 +80,7 @@ BoolOpState BOP_performBooleanOperation(BoolOpType opType, CSG_FaceIteratorDescriptor obBFaces, CSG_VertexIteratorDescriptor obBVertices) { - #ifdef DEBUG + #ifdef BOP_DEBUG cout << "BEGIN BOP_performBooleanOperation" << endl; #endif @@ -118,7 +118,7 @@ BoolOpState BOP_performBooleanOperation(BoolOpType opType, // Invert the output mesh if is required *outputMesh = BOP_exportMesh(&meshC, invertMeshC); - #ifdef DEBUG + #ifdef BOP_DEBUG cout << "END BOP_performBooleanOperation" << endl; #endif @@ -141,7 +141,7 @@ BoolOpState BOP_intersectionBoolOp(BOP_Mesh* meshC, bool invertMeshA, bool invertMeshB) { - #ifdef DEBUG + #ifdef BOP_DEBUG BOP_Chrono chrono; float t = 0.0f; float c = 0.0f; @@ -156,7 +156,7 @@ BoolOpState BOP_intersectionBoolOp(BOP_Mesh* meshC, BOP_BSPTree bspB; bspB.addMesh(meshC, *facesB); - #ifdef DEBUG + #ifdef BOP_DEBUG c = chrono.stamp(); t += c; cout << "Create BSP " << c << endl; #endif @@ -172,7 +172,7 @@ BoolOpState BOP_intersectionBoolOp(BOP_Mesh* meshC, if ((0.25*facesB->size()) > bspA.getDeep()) BOP_meshFilter(meshC, facesB, &bspA); - #ifdef DEBUG + #ifdef BOP_DEBUG c = chrono.stamp(); t += c; cout << "mesh Filter " << c << endl; #endif @@ -180,7 +180,7 @@ BoolOpState BOP_intersectionBoolOp(BOP_Mesh* meshC, // Face 2 Face BOP_Face2Face(meshC,facesA,facesB); - #ifdef DEBUG + #ifdef BOP_DEBUG c = chrono.stamp(); t += c; cout << "Face2Face " << c << endl; #endif @@ -189,7 +189,7 @@ BoolOpState BOP_intersectionBoolOp(BOP_Mesh* meshC, BOP_meshClassify(meshC,facesA,&bspB); BOP_meshClassify(meshC,facesB,&bspA); - #ifdef DEBUG + #ifdef BOP_DEBUG c = chrono.stamp(); t += c; cout << "Classification " << c << endl; #endif @@ -197,7 +197,7 @@ BoolOpState BOP_intersectionBoolOp(BOP_Mesh* meshC, // Process overlapped faces BOP_removeOverlappedFaces(meshC,facesA,facesB); - #ifdef DEBUG + #ifdef BOP_DEBUG c = chrono.stamp(); t += c; cout << "Remove overlap " << c << endl; #endif @@ -205,7 +205,7 @@ BoolOpState BOP_intersectionBoolOp(BOP_Mesh* meshC, // Sew two meshes BOP_sew(meshC,facesA,facesB); - #ifdef DEBUG + #ifdef BOP_DEBUG c = chrono.stamp(); t += c; cout << "Sew " << c << endl; #endif @@ -238,7 +238,7 @@ BoolOpState BOP_intersectionBoolOp(BOP_Mesh* meshC, #endif #endif - #ifdef DEBUG + #ifdef BOP_DEBUG c = chrono.stamp(); t += c; cout << "Merge faces " << c << endl; cout << "Total " << t << endl; diff --git a/intern/boolop/intern/BOP_Merge2.cpp b/intern/boolop/intern/BOP_Merge2.cpp index ad9f832ef01..2ef8b5b30b7 100644 --- a/intern/boolop/intern/BOP_Merge2.cpp +++ b/intern/boolop/intern/BOP_Merge2.cpp @@ -70,7 +70,7 @@ void dumpmesh ( BOP_Mesh *m, bool force ) } if( nonmanifold ) cout << nonmanifold << " edges detected" << endl; -#ifdef DEBUG +#ifdef BOP_DEBUG cout << "---------------------------" << endl; BOP_Edges edges = m->getEdges(); @@ -130,7 +130,7 @@ void BOP_Merge2::mergeFaces(BOP_Mesh *m, BOP_Index v) { m_mesh = m; -#ifdef DEBUG +#ifdef BOP_DEBUG cout << "##############################" << endl; #endif cleanup( ); @@ -147,7 +147,7 @@ void BOP_Merge2::mergeFaces(BOP_Mesh *m, BOP_Index v) // ... and merge new faces if( cont ) cont = mergeFaces(); -#ifdef DEBUG +#ifdef BOP_DEBUG cout << "called mergeFaces " << cont << endl; #endif // ... until the merge is not succesful @@ -186,7 +186,7 @@ void clean_nonmanifold( BOP_Mesh *m ) unsigned short facecount = 0; bool found = false; BOP_Indexs vertList; -#ifdef DEBUG +#ifdef BOP_DEBUG cout << " first edge is " << (*it) << endl; #endif vertList.push_back(first); @@ -214,7 +214,7 @@ void clean_nonmanifold( BOP_Mesh *m ) edge = NULL; } if( !edge ) break; -#ifdef DEBUG +#ifdef BOP_DEBUG cout << " next edge is " << edge << endl; #endif tmpface = m->getFace(edge->getFaces().front()); @@ -231,7 +231,7 @@ void clean_nonmanifold( BOP_Mesh *m ) } if(found) { edge = *it; -#ifdef DEBUG +#ifdef BOP_DEBUG cout << " --> found a loop" << endl; #endif if( vertList.size() == 3 ) { @@ -241,7 +241,7 @@ void clean_nonmanifold( BOP_Mesh *m ) BOP_Face4 *face = (BOP_Face4 *)m->getFace(edge->getFaces().front()); face->getNeighbours(first,last,next,last); } else { -#ifdef DEBUG +#ifdef BOP_DEBUG cout << "loop has " << vertList.size() << "verts"; #endif continue; @@ -253,7 +253,7 @@ void clean_nonmanifold( BOP_Mesh *m ) BOP_Face3 *f = new BOP_Face3(next,first,last, oface1->getPlane(),oface1->getOriginalFace()); m->addFace( f ); -#ifdef DEBUG +#ifdef BOP_DEBUG cout << " face is backward: " << f << endl; #endif @@ -261,7 +261,7 @@ void clean_nonmanifold( BOP_Mesh *m ) BOP_Face3 *f = new BOP_Face3(last,first,next, oface1->getPlane(),oface1->getOriginalFace()); m->addFace( f ); -#ifdef DEBUG +#ifdef BOP_DEBUG cout << " face is forward: " << f << endl; #endif } @@ -366,7 +366,7 @@ bool BOP_Merge2::mergeFaces(BOP_Indexs &mergeVertices) BOP_LFaces facesByOriginalFace; BOP_Index v = mergeVertices[i]; BOP_Vertex *vert = m_mesh->getVertex(v); -#ifdef DEBUG +#ifdef BOP_DEBUG cout << "i = " << i << ", v = " << v << ", vert = " << vert << endl; if (v==48) cout << "found vert 48" << endl; @@ -381,7 +381,7 @@ bool BOP_Merge2::mergeFaces(BOP_Indexs &mergeVertices) vert->setTAG(BROKEN); break; case 2: { -#ifdef DEBUG +#ifdef BOP_DEBUG cout << "size of fBOF = " << facesByOriginalFace.size() << endl; #endif BOP_Faces ff = facesByOriginalFace.front(); @@ -391,7 +391,7 @@ bool BOP_Merge2::mergeFaces(BOP_Indexs &mergeVertices) // look for two edges adjacent to v which contain both ofaces BOP_Indexs edges = vert->getEdges(); -#ifdef DEBUG +#ifdef BOP_DEBUG cout << " ff has " << ff.size() << " faces" << endl; cout << " fb has " << fb.size() << " faces" << endl; cout << " v has " << edges.size() << " edges" << endl; @@ -400,14 +400,14 @@ bool BOP_Merge2::mergeFaces(BOP_Indexs &mergeVertices) ++it ) { BOP_Edge *edge = m_mesh->getEdge(*it); BOP_Indexs faces = edge->getFaces(); -#ifdef DEBUG +#ifdef BOP_DEBUG cout << " " << edge << " has " << edge->getFaces().size() << " faces" << endl; #endif if( faces.size() == 2 ) { BOP_Face *f0 = m_mesh->getFace(faces[0]); BOP_Face *f1 = m_mesh->getFace(faces[1]); if( f0->getOriginalFace() != f1->getOriginalFace() ) { -#ifdef DEBUG +#ifdef BOP_DEBUG cout << " " << f0 << endl; cout << " " << f1 << endl; #endif @@ -416,14 +416,14 @@ bool BOP_Merge2::mergeFaces(BOP_Indexs &mergeVertices) } } if(ecount == 2) { -#ifdef DEBUG +#ifdef BOP_DEBUG cout << " edge indexes are " << eindexs[0]; cout << " and " << eindexs[1] << endl; #endif BOP_Edge *edge = m_mesh->getEdge(eindexs[0]); BOP_Index N = edge->getVertex1(); if(N == v) N = edge->getVertex2(); -#ifdef DEBUG +#ifdef BOP_DEBUG cout << " ## OK, replace "<<v<<" with "<<N << endl; #endif mergeVertex(ff , v, N ); @@ -437,7 +437,7 @@ bool BOP_Merge2::mergeFaces(BOP_Indexs &mergeVertices) } didMerge = true; } -#ifdef DEBUG +#ifdef BOP_DEBUG else { cout << " HUH: ecount was " << ecount << endl; } @@ -461,7 +461,7 @@ void BOP_Merge2::mergeVertex(BOP_Faces &faces, BOP_Index v1, BOP_Index v2) else mergeVertex((BOP_Face4 *) *face, v1, v2); (*face)->setTAG(BROKEN); -#ifdef DEBUG +#ifdef BOP_DEBUG cout << " breaking " << (*face) << endl; #endif } @@ -506,7 +506,7 @@ void BOP_Merge2::mergeVertex(BOP_Face3 *face, BOP_Index v1, BOP_Index v2) if( prev != v2 && next != v2 ) { m_mesh->addFace( new BOP_Face3(prev,v2,next, face->getPlane(),face->getOriginalFace()) ); -#ifdef DEBUG +#ifdef BOP_DEBUG cout << "mv3: add " << prev << "," << v2 << "," << next << endl; } else { cout << "mv3: vertex already in tri: doing nothing" << endl; @@ -524,7 +524,7 @@ void BOP_Merge2::mergeVertex(BOP_Face4 *face, BOP_Index v1, BOP_Index v2) if( prev == v2 || next == v2 ) { m_mesh->addFace( new BOP_Face3(prev,next,opp, face->getPlane(),face->getOriginalFace()) ); -#ifdef DEBUG +#ifdef BOP_DEBUG cout << "mv4a: add " << prev << "," << next << "," << opp << endl; #endif } @@ -532,7 +532,7 @@ void BOP_Merge2::mergeVertex(BOP_Face4 *face, BOP_Index v1, BOP_Index v2) else { m_mesh->addFace( new BOP_Face4(prev,v2,next,opp, face->getPlane(),face->getOriginalFace()) ); -#ifdef DEBUG +#ifdef BOP_DEBUG cout << "mv4b: add "<<prev<<","<<v2<<","<<next<<","<<opp<<endl; #endif } @@ -570,7 +570,7 @@ bool BOP_Merge2::createQuads() // Set triangles to BROKEN deleteFace(m_mesh, *faceI); deleteFace(m_mesh, *faceJ); -#ifdef DEBUG +#ifdef BOP_DEBUG cout << "createQuad: del " << *faceI << endl; cout << "createQuad: del " << *faceJ << endl; cout << "createQuad: add " << faceK << endl; @@ -602,7 +602,7 @@ bool BOP_Merge2::createQuads() // Set triangles to BROKEN deleteFace(m_mesh, *faceI); deleteFace(m_mesh, *faceJ); -#ifdef DEBUG +#ifdef BOP_DEBUG cout << "createQuad: del " << *faceI << endl; cout << "createQuad: del " << *faceJ << endl; cout << "createQuad: add " << faceK << endl; diff --git a/intern/ghost/intern/GHOST_Debug.h b/intern/ghost/intern/GHOST_Debug.h index d402aed63db..927ecfc88a5 100644 --- a/intern/ghost/intern/GHOST_Debug.h +++ b/intern/ghost/intern/GHOST_Debug.h @@ -35,10 +35,10 @@ #define _GHOST_DEBUG_H_ #if defined(WIN32) && !defined(FREE_WINDOWS) - #ifdef _DEBUG + #ifdef DEBUG #pragma warning (disable:4786) // suppress stl-MSVC debug info warning // #define GHOST_DEBUG - #endif // _DEBUG + #endif // DEBUG #endif // WIN32 #ifdef BF_GHOST_DEBUG diff --git a/intern/ghost/intern/GHOST_SystemCocoa.mm b/intern/ghost/intern/GHOST_SystemCocoa.mm index 97cfcf1006c..80356c19c9b 100644 --- a/intern/ghost/intern/GHOST_SystemCocoa.mm +++ b/intern/ghost/intern/GHOST_SystemCocoa.mm @@ -1163,7 +1163,7 @@ GHOST_TSuccess GHOST_SystemCocoa::handleDraggingEvent(GHOST_TEventType eventType NSEnumerator *enumerator; NSImageRep *representation; - ibuf = IMB_allocImBuf (imgSize.width , imgSize.height, 32, IB_rect, 0); + ibuf = IMB_allocImBuf (imgSize.width , imgSize.height, 32, IB_rect); if (!ibuf) { [droppedImg release]; return GHOST_kFailure; diff --git a/intern/ghost/intern/GHOST_SystemWin32.cpp b/intern/ghost/intern/GHOST_SystemWin32.cpp index 62559953195..da333ce4f08 100644 --- a/intern/ghost/intern/GHOST_SystemWin32.cpp +++ b/intern/ghost/intern/GHOST_SystemWin32.cpp @@ -34,6 +34,8 @@ * @date May 7, 2001 */ +#include <iostream> + #include "GHOST_SystemWin32.h" #include "GHOST_EventDragnDrop.h" @@ -136,14 +138,15 @@ GHOST_SystemWin32::GHOST_SystemWin32() -: m_hasPerformanceCounter(false), m_freq(0), m_start(0), - m_separateLeftRight(false), - m_separateLeftRightInitialized(false) +: m_hasPerformanceCounter(false), m_freq(0), m_start(0) { m_displayManager = new GHOST_DisplayManagerWin32 (); GHOST_ASSERT(m_displayManager, "GHOST_SystemWin32::GHOST_SystemWin32(): m_displayManager==0\n"); m_displayManager->initialize(); + // Check if current keyboard layout uses AltGr + this->keyboardAltGr(); + // Require COM for GHOST_DropTargetWin32 created in GHOST_WindowWin32. OleInitialize(0); } @@ -287,43 +290,24 @@ GHOST_TSuccess GHOST_SystemWin32::setCursorPosition(GHOST_TInt32 x, GHOST_TInt32 GHOST_TSuccess GHOST_SystemWin32::getModifierKeys(GHOST_ModifierKeys& keys) const { - if (m_separateLeftRight && m_separateLeftRightInitialized) { - bool down = HIBYTE(::GetKeyState(VK_LSHIFT)) != 0; - keys.set(GHOST_kModifierKeyLeftShift, down); - down = HIBYTE(::GetKeyState(VK_RSHIFT)) != 0; - keys.set(GHOST_kModifierKeyRightShift, down); - down = HIBYTE(::GetKeyState(VK_LMENU)) != 0; - keys.set(GHOST_kModifierKeyLeftAlt, down); - down = HIBYTE(::GetKeyState(VK_RMENU)) != 0; - keys.set(GHOST_kModifierKeyRightAlt, down); - down = HIBYTE(::GetKeyState(VK_LCONTROL)) != 0; - keys.set(GHOST_kModifierKeyLeftControl, down); - down = HIBYTE(::GetKeyState(VK_RCONTROL)) != 0; - keys.set(GHOST_kModifierKeyRightControl, down); - bool lwindown = HIBYTE(::GetKeyState(VK_LWIN)) != 0; - bool rwindown = HIBYTE(::GetKeyState(VK_RWIN)) != 0; - if(lwindown || rwindown) - keys.set(GHOST_kModifierKeyOS, true); - else - keys.set(GHOST_kModifierKeyOS, false); - } - else { - bool down = HIBYTE(::GetKeyState(VK_SHIFT)) != 0; - keys.set(GHOST_kModifierKeyLeftShift, down); - keys.set(GHOST_kModifierKeyRightShift, down); - down = HIBYTE(::GetKeyState(VK_MENU)) != 0; - keys.set(GHOST_kModifierKeyLeftAlt, down); - keys.set(GHOST_kModifierKeyRightAlt, down); - down = HIBYTE(::GetKeyState(VK_CONTROL)) != 0; - keys.set(GHOST_kModifierKeyLeftControl, down); - keys.set(GHOST_kModifierKeyRightControl, down); - bool lwindown = HIBYTE(::GetKeyState(VK_LWIN)) != 0; - bool rwindown = HIBYTE(::GetKeyState(VK_RWIN)) != 0; - if(lwindown || rwindown) - keys.set(GHOST_kModifierKeyOS, true); - else - keys.set(GHOST_kModifierKeyOS, false); - } + bool down = HIBYTE(::GetKeyState(VK_SHIFT)) != 0; + keys.set(GHOST_kModifierKeyLeftShift, down); + keys.set(GHOST_kModifierKeyRightShift, down); + + down = HIBYTE(::GetKeyState(VK_MENU)) != 0; + keys.set(GHOST_kModifierKeyLeftAlt, down); + keys.set(GHOST_kModifierKeyRightAlt, down); + + down = HIBYTE(::GetKeyState(VK_CONTROL)) != 0; + keys.set(GHOST_kModifierKeyLeftControl, down); + keys.set(GHOST_kModifierKeyRightControl, down); + + bool lwindown = HIBYTE(::GetKeyState(VK_LWIN)) != 0; + bool rwindown = HIBYTE(::GetKeyState(VK_RWIN)) != 0; + if(lwindown || rwindown) + keys.set(GHOST_kModifierKeyOS, true); + else + keys.set(GHOST_kModifierKeyOS, false); return GHOST_kSuccess; } @@ -386,7 +370,7 @@ GHOST_TSuccess GHOST_SystemWin32::init() wc.hbrBackground= (HBRUSH)::GetStockObject(BLACK_BRUSH); wc.lpszMenuName = 0; wc.lpszClassName= GHOST_WindowWin32::getWindowClassName(); - + // Use RegisterClassEx for setting small icon if (::RegisterClass(&wc) == 0) { success = GHOST_kFailure; @@ -402,10 +386,14 @@ GHOST_TSuccess GHOST_SystemWin32::exit() } -GHOST_TKey GHOST_SystemWin32::convertKey(WPARAM wParam, LPARAM lParam) const +GHOST_TKey GHOST_SystemWin32::convertKey(GHOST_IWindow *window, WPARAM wParam, LPARAM lParam) const { - GHOST_TKey key; bool isExtended = (lParam&(1<<24))?true:false; + + GHOST_TKey key; + GHOST_ModifierKeys oldModifiers, newModifiers; + ((GHOST_SystemWin32*)getSystem())->retrieveModifierKeys(oldModifiers); + ((GHOST_SystemWin32*)getSystem())->getModifierKeys(newModifiers); if ((wParam >= '0') && (wParam <= '9')) { // VK_0 thru VK_9 are the same as ASCII '0' thru '9' (0x30 - 0x39) @@ -469,55 +457,62 @@ GHOST_TKey GHOST_SystemWin32::convertKey(WPARAM wParam, LPARAM lParam) const case VK_QUOTE: key = GHOST_kKeyQuote; break; case VK_GR_LESS: key = GHOST_kKeyGrLess; break; - // Process these keys separately because we need to distinguish right from left modifier keys case VK_SHIFT: + { + bool lchanged = oldModifiers.get(GHOST_kModifierKeyLeftShift) != newModifiers.get(GHOST_kModifierKeyLeftShift); + if(lchanged) { + key = GHOST_kKeyLeftShift; + } else { + key = GHOST_kKeyRightShift; + } + } + break; case VK_CONTROL: + { + bool lchanged = oldModifiers.get(GHOST_kModifierKeyLeftControl) != newModifiers.get(GHOST_kModifierKeyLeftControl); + if(lchanged) { + key = GHOST_kKeyLeftControl; + } else { + key = GHOST_kKeyRightControl; + } + } + break; case VK_MENU: - - // Ignore these keys - case VK_NUMLOCK: - case VK_SCROLL: - case VK_CAPITAL: + { + if(m_hasAltGr && isExtended) { + // We have here an extended RAlt, which is AltGr. The keyboard driver on Windows sends before this a LControl, so + // to be able to input characters created with AltGr (normal on German, French, Finnish and other keyboards) we + // push an extra LControl up event. This ensures we don't have a 'hanging' ctrl event in Blender windowmanager + // when typing in Text editor or Console. + GHOST_Event *extra = new GHOST_EventKey(getSystem()->getMilliSeconds(), GHOST_kEventKeyUp, window, GHOST_kKeyLeftControl, '\0'); + ((GHOST_SystemWin32*)getSystem())->pushEvent(extra); + newModifiers.set(GHOST_kModifierKeyRightControl, false); + newModifiers.set(GHOST_kModifierKeyLeftControl, false); + } + bool lchanged = oldModifiers.get(GHOST_kModifierKeyLeftAlt) != newModifiers.get(GHOST_kModifierKeyLeftAlt); + if(lchanged) { + key = GHOST_kKeyLeftAlt; + } else { + key = GHOST_kKeyRightAlt; + } + } + break; + case VK_LWIN: + case VK_RWIN: + key = GHOST_kKeyOS; + break; + case VK_NUMLOCK: key = GHOST_kKeyNumLock; break; + case VK_SCROLL: key = GHOST_kKeyScrollLock; break; + case VK_CAPITAL: key = GHOST_kKeyCapsLock; break; default: key = GHOST_kKeyUnknown; break; } } - return key; -} - - -void GHOST_SystemWin32::processModifierKeys(GHOST_IWindow *window) -{ - GHOST_ModifierKeys oldModifiers, newModifiers; - // Retrieve old state of the modifier keys - ((GHOST_SystemWin32*)getSystem())->retrieveModifierKeys(oldModifiers); - // Retrieve current state of the modifier keys - ((GHOST_SystemWin32*)getSystem())->getModifierKeys(newModifiers); - - // Compare the old and the new - if (!newModifiers.equals(oldModifiers)) { - // Create events for the masks that changed - for (int i = 0; i < GHOST_kModifierKeyNumMasks; i++) { - if (newModifiers.get((GHOST_TModifierKeyMask)i) != oldModifiers.get((GHOST_TModifierKeyMask)i)) { - // Convert the mask to a key code - GHOST_TKey key = GHOST_ModifierKeys::getModifierKeyCode((GHOST_TModifierKeyMask)i); - bool keyDown = newModifiers.get((GHOST_TModifierKeyMask)i); - GHOST_EventKey* event; - if (key != GHOST_kKeyUnknown) { - // Create an event - event = new GHOST_EventKey(getSystem()->getMilliSeconds(), keyDown ? GHOST_kEventKeyDown: GHOST_kEventKeyUp, window, key); - pushEvent(event); - } - } - } - } - - // Store new modifier keys state ((GHOST_SystemWin32*)getSystem())->storeModifierKeys(newModifiers); + return key; } - GHOST_EventButton* GHOST_SystemWin32::processButtonEvent(GHOST_TEventType type, GHOST_IWindow *window, GHOST_TButtonMask mask) { return new GHOST_EventButton (getSystem()->getMilliSeconds(), type, window, mask); @@ -594,7 +589,7 @@ GHOST_EventWheel* GHOST_SystemWin32::processWheelEvent(GHOST_IWindow *window, WP GHOST_EventKey* GHOST_SystemWin32::processKeyEvent(GHOST_IWindow *window, bool keyDown, WPARAM wParam, LPARAM lParam) { - GHOST_TKey key = ((GHOST_SystemWin32*)getSystem())->convertKey(wParam, lParam); + GHOST_TKey key = ((GHOST_SystemWin32*)getSystem())->convertKey(window, wParam, lParam); GHOST_EventKey* event; if (key != GHOST_kKeyUnknown) { MSG keyMsg; @@ -603,6 +598,7 @@ GHOST_EventKey* GHOST_SystemWin32::processKeyEvent(GHOST_IWindow *window, bool k /* Eat any character related messages */ if (::PeekMessage(&keyMsg, NULL, WM_CHAR, WM_SYSDEADCHAR, PM_REMOVE)) { ascii = (char) keyMsg.wParam; + } event = new GHOST_EventKey(getSystem()->getMilliSeconds(), keyDown ? GHOST_kEventKeyDown: GHOST_kEventKeyUp, window, key, ascii); @@ -651,89 +647,30 @@ LRESULT WINAPI GHOST_SystemWin32::s_wndProc(HWND hwnd, UINT msg, WPARAM wParam, GHOST_WindowWin32* window = (GHOST_WindowWin32*)::GetWindowLong(hwnd, GWL_USERDATA); if (window) { switch (msg) { + // we need to check if new key layout has AltGr + case WM_INPUTLANGCHANGE: + system->keyboardAltGr(); + break; //////////////////////////////////////////////////////////////////////// // Keyboard events, processed //////////////////////////////////////////////////////////////////////// case WM_KEYDOWN: - /* The WM_KEYDOWN message is posted to the window with the keyboard focus when a - * nonsystem key is pressed. A nonsystem key is a key that is pressed when the alt - * key is not pressed. - */ case WM_SYSKEYDOWN: - /* The WM_SYSKEYDOWN message is posted to the window with the keyboard focus when - * the user presses the F10 key (which activates the menu bar) or holds down the - * alt key and then presses another key. It also occurs when no window currently - * has the keyboard focus; in this case, the WM_SYSKEYDOWN message is sent to the - * active window. The window that receives the message can distinguish between these - * two contexts by checking the context code in the lKeyData parameter. - */ - switch (wParam) { - case VK_SHIFT: - case VK_CONTROL: - case VK_MENU: - case VK_LWIN: - case VK_RWIN: - if (!system->m_separateLeftRightInitialized) { - // Check whether this system supports separate left and right keys - switch (wParam) { - case VK_SHIFT: - system->m_separateLeftRight = - (HIBYTE(::GetKeyState(VK_LSHIFT)) != 0) || - (HIBYTE(::GetKeyState(VK_RSHIFT)) != 0) ? - true : false; - break; - case VK_CONTROL: - system->m_separateLeftRight = - (HIBYTE(::GetKeyState(VK_LCONTROL)) != 0) || - (HIBYTE(::GetKeyState(VK_RCONTROL)) != 0) ? - true : false; - break; - case VK_MENU: - system->m_separateLeftRight = - (HIBYTE(::GetKeyState(VK_LMENU)) != 0) || - (HIBYTE(::GetKeyState(VK_RMENU)) != 0) ? - true : false; - break; - case VK_LWIN: - case VK_RWIN: - system->m_separateLeftRight = true; - break; - } - system->m_separateLeftRightInitialized = true; - } - system->processModifierKeys(window); - // Bypass call to DefWindowProc - return 0; - default: - event = processKeyEvent(window, true, wParam, lParam); - if (!event) { - GHOST_PRINT("GHOST_SystemWin32::wndProc: key event ") - GHOST_PRINT(msg) - GHOST_PRINT(" key ignored\n") - } - break; - } + event = processKeyEvent(window, true, wParam, lParam); + if (!event) { + GHOST_PRINT("GHOST_SystemWin32::wndProc: key event ") + GHOST_PRINT(msg) + GHOST_PRINT(" key ignored\n") + } break; case WM_KEYUP: case WM_SYSKEYUP: - switch (wParam) { - case VK_SHIFT: - case VK_CONTROL: - case VK_MENU: - case VK_LWIN: - case VK_RWIN: - system->processModifierKeys(window); - // Bypass call to DefWindowProc - return 0; - default: - event = processKeyEvent(window, false, wParam, lParam); - if (!event) { - GHOST_PRINT("GHOST_SystemWin32::wndProc: key event ") - GHOST_PRINT(msg) - GHOST_PRINT(" key ignored\n") - } - break; + event = processKeyEvent(window, false, wParam, lParam); + if (!event) { + GHOST_PRINT("GHOST_SystemWin32::wndProc: key event ") + GHOST_PRINT(msg) + GHOST_PRINT(" key ignored\n") } break; diff --git a/intern/ghost/intern/GHOST_SystemWin32.h b/intern/ghost/intern/GHOST_SystemWin32.h index 35b8debf6b4..3cd1deefda0 100644 --- a/intern/ghost/intern/GHOST_SystemWin32.h +++ b/intern/ghost/intern/GHOST_SystemWin32.h @@ -239,7 +239,7 @@ protected: * @param lParam The lParam from the wndproc * @return The GHOST key (GHOST_kKeyUnknown if no match). */ - virtual GHOST_TKey convertKey(WPARAM wParam, LPARAM lParam) const; + virtual GHOST_TKey convertKey(GHOST_IWindow *window, WPARAM wParam, LPARAM lParam) const; /** * Creates modifier key event(s) and updates the key data stored locally (m_modifierKeys). @@ -248,7 +248,7 @@ protected: * events generated for both keys. * @param window The window receiving the event (the active window). */ - void processModifierKeys(GHOST_IWindow *window); + GHOST_EventKey* processModifierKeys(GHOST_IWindow *window); /** * Creates mouse button event. @@ -310,6 +310,11 @@ protected: * @param keys The new state of the modifier keys. */ inline virtual void storeModifierKeys(const GHOST_ModifierKeys& keys); + + /** + * Check current key layout for AltGr + */ + inline virtual void keyboardAltGr(); /** * Windows call back routine for our window class. @@ -324,11 +329,8 @@ protected: __int64 m_freq; /** High frequency timer variable. */ __int64 m_start; - /** Stores the capability of this system to distinguish left and right modifier keys. */ - bool m_separateLeftRight; - /** Stores the initialization state of the member m_leftRightDistinguishable. */ - bool m_separateLeftRightInitialized; - + /** AltGr on current keyboard layout. */ + bool m_hasAltGr; }; inline void GHOST_SystemWin32::retrieveModifierKeys(GHOST_ModifierKeys& keys) const @@ -341,5 +343,22 @@ inline void GHOST_SystemWin32::storeModifierKeys(const GHOST_ModifierKeys& keys) m_modifierKeys = keys; } +inline void GHOST_SystemWin32::keyboardAltGr() +{ + HKL keylayout = GetKeyboardLayout(0); // get keylayout for current thread + int i; + SHORT s; + for(m_hasAltGr = false, i = 32; i < 256; ++i) { + s = VkKeyScanEx((char)i, keylayout); + // s == -1 means no key that translates passed char code + // high byte contains shift state. bit 2 ctrl pressed, bit 4 alt pressed + // if both are pressed, we have AltGr keycombo on keylayout + if(s!=-1 && (s & 0x600) == 0x600) { + m_hasAltGr = true; + break; + } + } +} + #endif // _GHOST_SYSTEM_WIN32_H_ diff --git a/intern/guardedalloc/MEM_guardedalloc.h b/intern/guardedalloc/MEM_guardedalloc.h index 6b78b0b6bdc..dfb8b2db1b1 100644 --- a/intern/guardedalloc/MEM_guardedalloc.h +++ b/intern/guardedalloc/MEM_guardedalloc.h @@ -150,6 +150,10 @@ extern "C" { /*get the peak memory usage in bytes, including mmap allocations*/ uintptr_t MEM_get_peak_memory(void); +#ifndef NDEBUG +const char *MEM_name_ptr(void *vmemh); +#endif + #ifdef __cplusplus } #endif diff --git a/intern/guardedalloc/intern/mallocn.c b/intern/guardedalloc/intern/mallocn.c index 09f2d33a674..b213a1c3744 100644 --- a/intern/guardedalloc/intern/mallocn.c +++ b/intern/guardedalloc/intern/mallocn.c @@ -856,4 +856,18 @@ int MEM_get_memory_blocks_in_use(void) return _totblock; } +#ifndef NDEBUG +const char *MEM_name_ptr(void *vmemh) +{ + if (vmemh) { + MemHead *memh= vmemh; + memh--; + return memh->name; + } + else { + return "MEM_name_ptr(NULL)"; + } +} +#endif + /* eof */ diff --git a/intern/iksolver/intern/IK_Solver.cpp b/intern/iksolver/intern/IK_Solver.cpp index 1add6f638cf..beb82f08ed4 100644 --- a/intern/iksolver/intern/IK_Solver.cpp +++ b/intern/iksolver/intern/IK_Solver.cpp @@ -45,6 +45,7 @@ public: std::list<IK_QTask*> tasks; }; +// FIXME: locks still result in small "residual" changes to the locked axes... IK_QSegment *CreateSegment(int flag, bool translate) { int ndof = 0; diff --git a/intern/moto/include/MT_assert.h b/intern/moto/include/MT_assert.h index cc6f980efb4..a0e97e6ad34 100644 --- a/intern/moto/include/MT_assert.h +++ b/intern/moto/include/MT_assert.h @@ -48,7 +48,7 @@ MT_CDECL int MT_QueryAssert(const char *file, int line, const char *predicate, int *do_assert); -#ifdef NDEBUG +#if !defined(DEBUG) #define MT_assert(predicate) ((void)0) #define BREAKPOINT() ((void)0) #else @@ -93,7 +93,7 @@ abort(); } #endif /* windows */ -#endif /* NDEBUG */ +#endif /* !defined(DEBUG) */ #endif diff --git a/intern/opennl/superlu/ssp_defs.h b/intern/opennl/superlu/ssp_defs.h index 61b324e74d8..7828a47d260 100644 --- a/intern/opennl/superlu/ssp_defs.h +++ b/intern/opennl/superlu/ssp_defs.h @@ -228,7 +228,7 @@ extern void check_tempv(int, float *); extern int print_int_vec(char *what, int n, int *vec); extern int sp_symetree(int *acolst, int *acolend, int *arow, int n, int *parent); - +extern void sprint_lu_col(char *msg, int jcol, int pivrow, int *xprune, GlobalLU_t *Glu); // added to build with debug for blender - campbell #ifdef __cplusplus } #endif diff --git a/release/scripts/io/netrender/slave.py b/release/scripts/io/netrender/slave.py index 526bd0b254f..8629a38c04a 100644 --- a/release/scripts/io/netrender/slave.py +++ b/release/scripts/io/netrender/slave.py @@ -32,8 +32,13 @@ BLENDER_PATH = sys.argv[0] CANCEL_POLL_SPEED = 2 MAX_TIMEOUT = 10 INCREMENT_TIMEOUT = 1 +try: + system = platform.system() +except UnicodeDecodeError: + import sys + system = sys.platform -if platform.system() == 'Windows' and platform.version() >= '5': # Error mode is only available on Win2k or higher, that's version 5 +if system in ('Windows', 'win32') and platform.version() >= '5': # Error mode is only available on Win2k or higher, that's version 5 import ctypes def SetErrorMode(): val = ctypes.windll.kernel32.SetErrorMode(0x0002) diff --git a/release/scripts/modules/animsys_refactor.py b/release/scripts/modules/animsys_refactor.py index 8cc91873b0e..bd16a02268a 100644 --- a/release/scripts/modules/animsys_refactor.py +++ b/release/scripts/modules/animsys_refactor.py @@ -111,6 +111,7 @@ def classes_recursive(base_type, clss=None): def find_path_new(id_data, data_path, rna_update_dict, rna_update_from_map): + # note!, id_data can be ID type or a node tree # ignore ID props for now if data_path.startswith("["): return data_path @@ -156,36 +157,43 @@ def update_data_paths(rna_update): rna_update_from_map.setdefault(ren_from, []).append(ren_to) for id_data in id_iter(): - anim_data = getattr(id_data, "animation_data", None) - if anim_data is None: - continue - - for fcurve in anim_data.drivers: - for var in fcurve.driver.variables: - if var.type == 'SINGLE_PROP': - for tar in var.targets: - id_data_other = tar.id - data_path = tar.data_path - - if id_data_other and data_path: - data_path_new = find_path_new(id_data_other, data_path, rna_update_dict, rna_update_from_map) - # print(data_path_new) - if data_path_new != data_path: - if not IS_TESTING: - tar.data_path = data_path_new - print("driver (%s): %s -> %s" % (id_data_other.name, data_path, data_path_new)) + + # check node-trees too + anim_data_ls = [(id_data, getattr(id_data, "animation_data", None))] + node_tree = getattr(id_data, "node_tree", None) + if node_tree: + anim_data_ls.append((node_tree, node_tree.animation_data)) + + for anim_data_base, anim_data in anim_data_ls: + if anim_data is None: + continue + + for fcurve in anim_data.drivers: + for var in fcurve.driver.variables: + if var.type == 'SINGLE_PROP': + for tar in var.targets: + id_data_other = tar.id + data_path = tar.data_path + + if id_data_other and data_path: + data_path_new = find_path_new(id_data_other, data_path, rna_update_dict, rna_update_from_map) + # print(data_path_new) + if data_path_new != data_path: + if not IS_TESTING: + tar.data_path = data_path_new + print("driver (%s): %s -> %s" % (id_data_other.name, data_path, data_path_new)) + - - for action in anim_data_actions(anim_data): - for fcu in action.fcurves: - data_path = fcu.data_path - data_path_new = find_path_new(id_data, data_path, rna_update_dict, rna_update_from_map) - # print(data_path_new) - if data_path_new != data_path: - if not IS_TESTING: - fcu.data_path = data_path_new - print("fcurve (%s): %s -> %s" % (id_data.name, data_path, data_path_new)) + for action in anim_data_actions(anim_data): + for fcu in action.fcurves: + data_path = fcu.data_path + data_path_new = find_path_new(anim_data_base, data_path, rna_update_dict, rna_update_from_map) + # print(data_path_new) + if data_path_new != data_path: + if not IS_TESTING: + fcu.data_path = data_path_new + print("fcurve (%s): %s -> %s" % (id_data.name, data_path, data_path_new)) if __name__ == "__main__": diff --git a/release/scripts/modules/bpy_types.py b/release/scripts/modules/bpy_types.py index 261165d8830..6ecb8a2e207 100644 --- a/release/scripts/modules/bpy_types.py +++ b/release/scripts/modules/bpy_types.py @@ -258,15 +258,15 @@ class _GenericBone: return bones -class PoseBone(StructRNA, _GenericBone): +class PoseBone(StructRNA, _GenericBone, metaclass=StructMetaIDProp): __slots__ = () -class Bone(StructRNA, _GenericBone): +class Bone(StructRNA, _GenericBone, metaclass=StructMetaIDProp): __slots__ = () -class EditBone(StructRNA, _GenericBone): +class EditBone(StructRNA, _GenericBone, metaclass=StructMetaIDProp): __slots__ = () def align_orientation(self, other): diff --git a/release/scripts/modules/console/intellisense.py b/release/scripts/modules/console/intellisense.py index 0f9acf9b6a9..d76c5d0ad60 100644 --- a/release/scripts/modules/console/intellisense.py +++ b/release/scripts/modules/console/intellisense.py @@ -75,10 +75,10 @@ def complete(line, cursor, namespace, private=True): # unquoted word -> module or attribute completion word = re_unquoted_word.group(1) if RE_MODULE.match(line): - import complete_import + from . import complete_import matches = complete_import.complete(line) else: - import complete_namespace + from . import complete_namespace matches = complete_namespace.complete(word, namespace, private) else: # for now we don't have completers for strings @@ -112,7 +112,7 @@ def expand(line, cursor, namespace, private=True): 'abs(number) -> number\\nReturn the absolute value of the argument.' """ if line[:cursor].strip().endswith('('): - import complete_calltip + from . import complete_calltip matches, word, scrollback = complete_calltip.complete(line, cursor, namespace) no_calltip = False diff --git a/release/scripts/modules/rigify/__init__.py b/release/scripts/modules/rigify/__init__.py index 98d9bb235a2..c4f18d51519 100644 --- a/release/scripts/modules/rigify/__init__.py +++ b/release/scripts/modules/rigify/__init__.py @@ -534,7 +534,11 @@ def generate_test_all(context, GRAPH=False): new_objects = rigify.generate_test(context) if GRAPH: - base_name = os.path.splitext(bpy.data.filepath)[0] + if(bpy.data.filepath): + base_name = os.path.splitext(bpy.data.filepath)[0] + else: + import tempfile + base_name = tempfile.mktemp(prefix=bpy.app.tempdir) for obj, obj_new in new_objects: for obj in (obj, obj_new): fn = base_name + "-" + bpy.path.clean_name(obj.name) diff --git a/release/scripts/modules/rna_info.py b/release/scripts/modules/rna_info.py index 4282889c51a..e0298d30aa2 100644 --- a/release/scripts/modules/rna_info.py +++ b/release/scripts/modules/rna_info.py @@ -152,7 +152,7 @@ class InfoStructRNA: functions.append((identifier, attr)) return functions - def __repr__(self): + def __str__(self): txt = "" txt += self.identifier @@ -285,7 +285,7 @@ class InfoPropertyRNA: return type_str - def __repr__(self): + def __str__(self): txt = '' txt += ' * ' + self.identifier + ': ' + self.description @@ -319,7 +319,7 @@ class InfoFunctionRNA: self.return_values = tuple(self.return_values) - def __repr__(self): + def __str__(self): txt = '' txt += ' * ' + self.identifier + '(' diff --git a/release/scripts/modules/sys_info.py b/release/scripts/modules/sys_info.py new file mode 100644 index 00000000000..b6f429141bf --- /dev/null +++ b/release/scripts/modules/sys_info.py @@ -0,0 +1,103 @@ +# ##### 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> + +# classes for extracting info from blenders internal classes + +import bpy +import bgl + +import sys + +def cutPoint(text, length): + "Returns position of the last space found before 'length' chars" + l = length + c = text[l] + while c != ' ': + l -= 1 + if l == 0: return length # no space found + c = text[l] + return l + +def textWrap(text, length = 70): + lines = [] + while len(text) > 70: + cpt = cutPoint(text, length) + line, text = text[:cpt], text[cpt + 1:] + lines.append(line) + lines.append(text) + return lines + +def write_sysinfo(op): + output_filename = "system-info.txt" + warnings = 0 + notices = 0 + + if output_filename in bpy.data.texts.keys(): + output = bpy.data.texts[output_filename] + output.clear() + else: + output = bpy.data.texts.new(name=output_filename) + + header = '= Blender {} System Information =\n'.format(bpy.app.version_string) + lilies = '{}\n\n'.format(len(header)*'=') + firstlilies = '{}\n'.format(len(header)*'=') + output.write(firstlilies) + output.write(header) + output.write(lilies) + + # build info + output.write('\nBlender:\n') + output.write(lilies) + output.write('version {}, revision {}. {}\n'.format(bpy.app.version_string, bpy.app.build_revision, bpy.app.build_type)) + output.write('build date: {}, {}\n'.format(bpy.app.build_date, bpy.app.build_time)) + output.write('platform: {}\n'.format(bpy.app.build_platform)) + output.write('binary path: {}\n\n'.format(bpy.app.binary_path)) + + # python info + output.write('\nPython:\n') + output.write(lilies) + output.write('version: {}\n'.format(sys.version)) + output.write('paths:\n') + for p in sys.path: + output.write('\t{}\n'.format(p)) + + output.write('\nDirectories:\n') + output.write(lilies) + output.write('scripts: {}\n'.format(bpy.utils.script_paths())) + output.write('user scripts: {}\n'.format(bpy.utils.user_script_path())) + output.write('datafiles: {}\n'.format(bpy.utils.user_resource('DATAFILES'))) + output.write('config: {}\n'.format(bpy.utils.user_resource('CONFIG'))) + output.write('scripts : {}\n'.format(bpy.utils.user_resource('SCRIPTS'))) + output.write('autosave: {}\n'.format(bpy.utils.user_resource('AUTOSAVE'))) + output.write('tempdir: {}\n'.format(bpy.app.tempdir)) + + output.write('\nOpenGL\n') + output.write(lilies) + output.write('renderer:\t{}\n'.format(bgl.glGetString(bgl.GL_RENDERER))) + output.write('vendor:\t\t{}\n'.format(bgl.glGetString(bgl.GL_VENDOR))) + output.write('version:\t{}\n'.format(bgl.glGetString(bgl.GL_VERSION))) + output.write('extensions:\n') + + glext = bgl.glGetString(bgl.GL_EXTENSIONS) + glext = textWrap(glext, 70) + for l in glext: + output.write('\t\t{}\n'.format(l)) + + op.report({'INFO'}, "System information generated in 'system-info.txt'") diff --git a/release/scripts/op/image.py b/release/scripts/op/image.py index b897e7955a0..ddd04c4e7c3 100644 --- a/release/scripts/op/image.py +++ b/release/scripts/op/image.py @@ -32,13 +32,17 @@ class EditExternally(bpy.types.Operator): def _editor_guess(self, context): import platform - system = platform.system() + try: + system = platform.system() + except UnicodeDecodeError: + import sys + system = sys.platform image_editor = context.user_preferences.filepaths.image_editor # use image editor in the preferences when available. if not image_editor: - if system == 'Windows': + if system in ('Windows', 'win32'): image_editor = ["start"] # not tested! elif system == 'Darwin': image_editor = ["open"] @@ -84,7 +88,7 @@ class EditExternally(bpy.types.Operator): class SaveDirty(bpy.types.Operator): - '''Select object matching a naming pattern''' + """Save all modified textures""" bl_idname = "image.save_dirty" bl_label = "Save Dirty" bl_options = {'REGISTER', 'UNDO'} @@ -105,7 +109,7 @@ class SaveDirty(bpy.types.Operator): class ProjectEdit(bpy.types.Operator): - '''Select object matching a naming pattern''' + """Edit a snapshot if the viewport in an external image editor""" bl_idname = "image.project_edit" bl_label = "Project Edit" bl_options = {'REGISTER'} @@ -170,7 +174,7 @@ class ProjectEdit(bpy.types.Operator): class ProjectApply(bpy.types.Operator): - '''Select object matching a naming pattern''' + """Project edited image back onto the object""" bl_idname = "image.project_apply" bl_label = "Project Apply" bl_options = {'REGISTER'} diff --git a/release/scripts/op/io_scene_obj/export_obj.py b/release/scripts/op/io_scene_obj/export_obj.py index abdb07c1a8e..3fd91615bb6 100644 --- a/release/scripts/op/io_scene_obj/export_obj.py +++ b/release/scripts/op/io_scene_obj/export_obj.py @@ -750,7 +750,7 @@ def _write(context, filepath, # Export an animation? if EXPORT_ANIMATION: - scene_frames = range(scene.frame_start, context.frame_end + 1) # Up to and including the end frame. + scene_frames = range(scene.frame_start, scene.frame_end + 1) # Up to and including the end frame. else: scene_frames = [orig_frame] # Dont export an animation. @@ -803,7 +803,7 @@ Currently the exporter lacks these features: def save(operator, context, filepath="", use_triangles=False, - use_edges=False, + use_edges=True, use_normals=False, use_hq_normals=False, use_uvs=True, diff --git a/release/scripts/op/screen_play_rendered_anim.py b/release/scripts/op/screen_play_rendered_anim.py index 53421642129..244c3d4b332 100644 --- a/release/scripts/op/screen_play_rendered_anim.py +++ b/release/scripts/op/screen_play_rendered_anim.py @@ -30,14 +30,18 @@ import os def guess_player_path(preset): import platform - system = platform.system() + try: + system = platform.system() + except UnicodeDecodeError: + import sys + system = sys.platform if preset == 'BLENDER24': player_path = "blender" if system == 'Darwin': test_path = "/Applications/blender 2.49.app/Contents/MacOS/blender" - elif system == 'Windows': + elif system in ('Windows', 'win32'): test_path = "/Program Files/Blender Foundation/Blender/blender.exe" if os.path.exists(test_path): diff --git a/release/scripts/op/uv.py b/release/scripts/op/uv.py index d01ef070d87..8fea37ef420 100644 --- a/release/scripts/op/uv.py +++ b/release/scripts/op/uv.py @@ -235,7 +235,7 @@ def write_png(fw, mesh_source, image_width, image_height, face_iter): class ExportUVLayout(bpy.types.Operator): - '''Export the Mesh as SVG''' + """Export UV layout to file""" bl_idname = "uv.export_layout" bl_label = "Export UV Layout" @@ -251,7 +251,7 @@ class ExportUVLayout(bpy.types.Operator): name="Format", description="File format to export the UV layout to", default='PNG') - size = IntVectorProperty(size=2, default=(1024, 1024), min=8, max=32768) + size = IntVectorProperty(size=2, default=(1024, 1024), min=8, max=32768, description="Dimensions of the exported file") @classmethod def poll(cls, context): diff --git a/release/scripts/op/wm.py b/release/scripts/op/wm.py index 60a963804a6..4ce10233a9b 100644 --- a/release/scripts/op/wm.py +++ b/release/scripts/op/wm.py @@ -779,6 +779,15 @@ class WM_OT_keyconfig_activate(bpy.types.Operator): bpy.utils.keyconfig_set(self.filepath) return {'FINISHED'} +class WM_OT_sysinfo(bpy.types.Operator): + '''Generate System Info''' + bl_idname = "wm.sysinfo" + bl_label = "System Info" + + def execute(self, context): + import sys_info + sys_info.write_sysinfo(self) + return {'FINISHED'} def register(): pass diff --git a/release/scripts/presets/render/HDV_1080p.py b/release/scripts/presets/render/HDV_1080p.py index 7637648e53a..3ba32135c1d 100644 --- a/release/scripts/presets/render/HDV_1080p.py +++ b/release/scripts/presets/render/HDV_1080p.py @@ -5,4 +5,4 @@ bpy.context.scene.render.resolution_percentage = 100 bpy.context.scene.render.pixel_aspect_x = 4 bpy.context.scene.render.pixel_aspect_y = 3 bpy.context.scene.render.fps = 24 -bpy.context.scene.render.fps_base = 1 +bpy.context.scene.render.fps_base = 1.001 diff --git a/release/scripts/presets/render/HDV_NTSC_1080p.py b/release/scripts/presets/render/HDV_NTSC_1080p.py new file mode 100644 index 00000000000..2dfa1e0fd1e --- /dev/null +++ b/release/scripts/presets/render/HDV_NTSC_1080p.py @@ -0,0 +1,8 @@ +import bpy +bpy.context.scene.render.resolution_x = 1440 +bpy.context.scene.render.resolution_y = 1080 +bpy.context.scene.render.resolution_percentage = 100 +bpy.context.scene.render.pixel_aspect_x = 4 +bpy.context.scene.render.pixel_aspect_y = 3 +bpy.context.scene.render.fps = 30 +bpy.context.scene.render.fps_base = 1.001 diff --git a/release/scripts/presets/render/HDV_PAL_1080p.py b/release/scripts/presets/render/HDV_PAL_1080p.py new file mode 100644 index 00000000000..d8b1c707607 --- /dev/null +++ b/release/scripts/presets/render/HDV_PAL_1080p.py @@ -0,0 +1,8 @@ +import bpy +bpy.context.scene.render.resolution_x = 1440 +bpy.context.scene.render.resolution_y = 1080 +bpy.context.scene.render.resolution_percentage = 100 +bpy.context.scene.render.pixel_aspect_x = 4 +bpy.context.scene.render.pixel_aspect_y = 3 +bpy.context.scene.render.fps = 25 +bpy.context.scene.render.fps_base = 1 diff --git a/release/scripts/templates/gamelogic.py b/release/scripts/templates/gamelogic.py index 21a901c091b..0a419955b81 100644 --- a/release/scripts/templates/gamelogic.py +++ b/release/scripts/templates/gamelogic.py @@ -1,10 +1,7 @@ # This script must be assigned to a python controller # where it can access the object that owns it and the sensors/actuators that it connects to. -# GameLogic has been added to the global namespace no need to import - -# for keyboard event comparison -# import GameKeys +import bge # support for Vector(), Matrix() types and advanced functions like Matrix.Scale(...) and Matrix.Rotation(...) # import mathutils @@ -13,7 +10,7 @@ # import Rasterizer def main(): - cont = GameLogic.getCurrentController() + cont = bge.logic.getCurrentController() # The KX_GameObject that owns this controller. own = cont.owner @@ -57,7 +54,7 @@ def main(): # Loop through all other objects in the scene - sce = GameLogic.getCurrentScene() + sce = bge.logic.getCurrentScene() print('Scene Objects:', sce.name) for ob in sce.objects: print(' ', ob.name, ob.worldPosition) diff --git a/release/scripts/templates/gamelogic_basic.py b/release/scripts/templates/gamelogic_basic.py index 5e7d19672fe..c5578a0add9 100644 --- a/release/scripts/templates/gamelogic_basic.py +++ b/release/scripts/templates/gamelogic_basic.py @@ -1,7 +1,8 @@ +import bge def main(): - cont = GameLogic.getCurrentController() + cont = bge.logic.getCurrentController() own = cont.owner sens = cont.sensors['mySensor'] diff --git a/release/scripts/templates/gamelogic_module.py b/release/scripts/templates/gamelogic_module.py index 5a61a3592dc..70bd4d9b45b 100644 --- a/release/scripts/templates/gamelogic_module.py +++ b/release/scripts/templates/gamelogic_module.py @@ -5,7 +5,7 @@ # * External text modules are supported as long as they are at # the same location as the blendfile or one of its libraries. -import GameLogic +import bge # variables defined here will only be set once when the # module is first imported. Set object spesific vars @@ -23,4 +23,4 @@ def main(cont): else: cont.deactivate(actu) -# dont call main(GameLogic.getCurrentController()), the py controller will +# dont call main(bge.logic.getCurrentController()), the py controller will diff --git a/release/scripts/ui/properties_data_armature_rigify.py b/release/scripts/ui/properties_data_armature_rigify.py index f7961821277..6453ea9e038 100644 --- a/release/scripts/ui/properties_data_armature_rigify.py +++ b/release/scripts/ui/properties_data_armature_rigify.py @@ -211,14 +211,23 @@ class Graph(bpy.types.Operator): import bpy reload(graphviz_export) obj = bpy.context.object - path = os.path.splitext(bpy.data.filepath)[0] + "-" + bpy.path.clean_name(obj.name) + if(bpy.data.filepath): + path = os.path.splitext(bpy.data.filepath)[0] + "-" + bpy.path.clean_name(obj.name) + else: + import tempfile + path = tempfile.mktemp(prefix=bpy.app.tempdir) + "-" + bpy.path.clean_name(obj.name) path_dot = path + ".dot" path_png = path + ".png" saved = graphviz_export.graph_armature(bpy.context.object, path_dot, CONSTRAINTS=False, DRIVERS=False) if saved: # if we seriously want this working everywhere we'll need some new approach - os.system("dot -Tpng %s > %s; gnome-open %s &" % (path_dot, path_png, path_png)) + os.system("dot -Tpng %r > %r" % (path_dot, path_png)) + if not os.path.exists(path_png) or os.stat(path_png)[6] == 0: + self.report('ERROR', "Graphvis could not create %r check graphviz is installed" % path_png) + return {'CANCELLED'} + + bpy.ops.image.external_edit(filepath=path_png) #os.system("python /b/xdot.py '%s' &" % path_dot) return {'FINISHED'} diff --git a/release/scripts/ui/properties_data_mesh.py b/release/scripts/ui/properties_data_mesh.py index 38364139147..ebe34d1fe11 100644 --- a/release/scripts/ui/properties_data_mesh.py +++ b/release/scripts/ui/properties_data_mesh.py @@ -182,7 +182,7 @@ class DATA_PT_shape_keys(MeshButtonsPanel, bpy.types.Panel): enable_edit = ob.mode != 'EDIT' enable_edit_value = False - if ob.show_shape_key is False: + if ob.show_only_shape_key is False: if enable_edit or (ob.type == 'MESH' and ob.use_shape_key_edit_mode): enable_edit_value = True @@ -218,7 +218,7 @@ class DATA_PT_shape_keys(MeshButtonsPanel, bpy.types.Panel): sub = row.row(align=True) subsub = sub.row(align=True) subsub.active = enable_edit_value - subsub.prop(ob, "show_shape_key", text="") + subsub.prop(ob, "show_only_shape_key", text="") subsub.prop(kb, "mute", text="") sub.prop(ob, "use_shape_key_edit_mode", text="") diff --git a/release/scripts/ui/properties_object.py b/release/scripts/ui/properties_object.py index 65f1cc2d929..2532a99b402 100644 --- a/release/scripts/ui/properties_object.py +++ b/release/scripts/ui/properties_object.py @@ -68,6 +68,31 @@ class OBJECT_PT_transform(ObjectButtonsPanel, bpy.types.Panel): row.column().prop(ob, "scale") layout.prop(ob, "rotation_mode") + +class OBJECT_PT_delta_transform(ObjectButtonsPanel, bpy.types.Panel): + bl_label = "Delta Transform" + bl_options = {'DEFAULT_CLOSED'} + + def draw(self, context): + layout = self.layout + + ob = context.object + + row = layout.row() + + row.column().prop(ob, "delta_location") + if ob.rotation_mode == 'QUATERNION': + row.column().prop(ob, "delta_rotation_quaternion", text="Rotation") + elif ob.rotation_mode == 'AXIS_ANGLE': + #row.column().label(text="Rotation") + #row.column().prop(pchan, "delta_rotation_angle", text="Angle") + #row.column().prop(pchan, "delta_rotation_axis", text="Axis") + #row.column().prop(ob, "delta_rotation_axis_angle", text="Rotation") + row.column().label(ob, text="Not for Axis-Angle") + else: + row.column().prop(ob, "delta_rotation_euler", text="Rotation") + + row.column().prop(ob, "delta_scale") class OBJECT_PT_transform_locks(ObjectButtonsPanel, bpy.types.Panel): diff --git a/release/scripts/ui/properties_render.py b/release/scripts/ui/properties_render.py index e940f454aaf..7e5848d0aa0 100644 --- a/release/scripts/ui/properties_render.py +++ b/release/scripts/ui/properties_render.py @@ -84,10 +84,11 @@ class RENDER_PT_layers(RenderButtonsPanel, bpy.types.Panel): col.operator("scene.render_layer_add", icon='ZOOMIN', text="") col.operator("scene.render_layer_remove", icon='ZOOMOUT', text="") + row = layout.row() rl = rd.layers.active - if rl: - layout.prop(rl, "name") + row.prop(rl, "name") + row.prop(rd, "use_single_layer", text="", icon_only=True) split = layout.split() diff --git a/release/scripts/ui/space_info.py b/release/scripts/ui/space_info.py index bd33153d017..b0e8dbab0b3 100644 --- a/release/scripts/ui/space_info.py +++ b/release/scripts/ui/space_info.py @@ -119,7 +119,7 @@ class INFO_MT_file(bpy.types.Menu): layout.separator() layout.operator_context = 'EXEC_AREA' - layout.operator("wm.exit_blender", text="Quit", icon='QUIT') + layout.operator("wm.quit_blender", text="Quit", icon='QUIT') class INFO_MT_file_import(bpy.types.Menu): @@ -219,6 +219,18 @@ class INFO_MT_surface_add(bpy.types.Menu): layout.operator("surface.primitive_nurbs_surface_sphere_add", icon='SURFACE_NSPHERE', text="NURBS Sphere") layout.operator("surface.primitive_nurbs_surface_torus_add", icon='SURFACE_NTORUS', text="NURBS Torus") +class INFO_MT_curve_handle_type_set(bpy.types.Menu): + bl_idname = "INFO_MT_curve_handle_type_set" + bl_label = "Handle Type" + + def draw(self, context): + layout = self.layout + layout.operator_context = 'INVOKE_REGION_WIN' + layout.operator("curve.handle_type_set", text="Automatic").type = "AUTOMATIC" + layout.operator("curve.handle_type_set", text="Vector").type = "VECTOR" + layout.operator("curve.handle_type_set", text="Align").type = "ALIGN" + layout.operator("curve.handle_type_set", text="Free Align").type = "FREE_ALIGN" + class INFO_MT_armature_add(bpy.types.Menu): bl_idname = "INFO_MT_armature_add" @@ -333,6 +345,7 @@ class INFO_MT_help(bpy.types.Menu): layout.separator() layout.operator("wm.url_open", text="Python API Reference", icon='URL').url = "http://www.blender.org/documentation/blender_python_api_%s/contents.html" % "_".join(str(v) for v in bpy.app.version) layout.operator("help.operator_cheat_sheet", icon='TEXT') + layout.operator("wm.sysinfo", icon='TEXT') layout.separator() layout.operator("anim.update_data_paths", text="FCurve/Driver 2.54 fix", icon='HELP') layout.separator() diff --git a/release/scripts/ui/space_view3d.py b/release/scripts/ui/space_view3d.py index 5bd809fea7e..f7238364142 100644 --- a/release/scripts/ui/space_view3d.py +++ b/release/scripts/ui/space_view3d.py @@ -1394,82 +1394,35 @@ class VIEW3D_MT_edit_mesh_select_mode(bpy.types.Menu): class VIEW3D_MT_edit_mesh_extrude(bpy.types.Menu): bl_label = "Extrude" + _extrude_funcs = { \ + "VERT": lambda layout: layout.operator("mesh.extrude_vertices_move", text="Vertices Only"), + "EDGE": lambda layout: layout.operator("mesh.extrude_edges_move", text="Edges Only"), + "FACE": lambda layout: layout.operator("mesh.extrude_faces_move", text="Individual Faces"), + "REGION": lambda layout: layout.operator("view3d.edit_mesh_extrude_move_normal", text="Region"), + } + @staticmethod def extrude_options(context): mesh = context.object.data select_mode = context.tool_settings.mesh_select_mode - totface = mesh.total_face_sel - totedge = mesh.total_edge_sel - totvert = mesh.total_vert_sel - - # the following is dependent on selection modes - # we don't really want that -# if select_mode[0]: # vert -# if totvert == 0: -# return () -# elif totvert == 1: -# return (3,) -# elif totedge == 0: -# return (3,) -# elif totface == 0: -# return (2, 3) -# elif totface == 1: -# return (0, 2, 3) -# else: -# return (0, 1, 2, 3) -# elif select_mode[1]: # edge -# if totedge == 0: -# return () -# elif totedge == 1: -# return (2,) -# elif totface == 0: -# return (2,) -# elif totface == 1: -# return (0, 2) -# else: -# return (0, 1, 2) -# elif select_mode[2]: # face -# if totface == 0: -# return () -# elif totface == 1: -# return (0,) -# else: -# return (0, 1) - - if totvert == 0: - return () - elif totedge == 0: - return (0, 3) - elif totface == 0: - return (0, 2, 3) - else: - return (0, 1, 2, 3) + menu = [] + if mesh.total_face_sel: + menu += ["REGION", "FACE"] + if mesh.total_edge_sel and (select_mode[0] or select_mode[1]): + menu += ["EDGE"] + if mesh.total_vert_sel and select_mode[0]: + menu += ["VERT"] # should never get here - return () + return menu def draw(self, context): layout = self.layout layout.operator_context = 'INVOKE_REGION_WIN' - def region_menu(): - layout.operator("view3d.edit_mesh_extrude_move_normal", text="Region") - - def face_menu(): - layout.operator("mesh.extrude_faces_move", text="Individual Faces") - - def edge_menu(): - layout.operator("mesh.extrude_edges_move", text="Edges Only") - - def vert_menu(): - layout.operator("mesh.extrude_vertices_move", text="Vertices Only") - - menu_funcs = region_menu, face_menu, edge_menu, vert_menu - - for i in self.extrude_options(context): - func = menu_funcs[i] - func() + for menu_id in self.extrude_options(context): + self._extrude_funcs[menu_id](layout) class VIEW3D_OT_edit_mesh_extrude_individual_move(bpy.types.Operator): @@ -1903,7 +1856,7 @@ class VIEW3D_MT_edit_armature(bpy.types.Menu): layout.separator() - layout.operator("armature.subdivide_multi", text="Subdivide") + layout.operator("armature.subdivide", text="Subdivide") layout.operator("armature.switch_direction", text="Switch Direction") layout.separator() @@ -1937,7 +1890,7 @@ class VIEW3D_MT_armature_specials(bpy.types.Menu): layout.operator_context = 'INVOKE_REGION_WIN' - layout.operator("armature.subdivide_multi", text="Subdivide") + layout.operator("armature.subdivide", text="Subdivide") layout.operator("armature.switch_direction", text="Switch Direction") layout.separator() diff --git a/release/scripts/ui/space_view3d_toolbar.py b/release/scripts/ui/space_view3d_toolbar.py index a6f3f7e34c2..d2c6300eddc 100644 --- a/release/scripts/ui/space_view3d_toolbar.py +++ b/release/scripts/ui/space_view3d_toolbar.py @@ -311,7 +311,7 @@ class VIEW3D_PT_tools_armatureedit(View3DPanel, bpy.types.Panel): col = layout.column(align=True) col.label(text="Modeling:") col.operator("armature.extrude_move") - col.operator("armature.subdivide_multi", text="Subdivide") + col.operator("armature.subdivide", text="Subdivide") col = layout.column(align=True) col.label(text="Repeat:") diff --git a/source/blender/CMakeLists.txt b/source/blender/CMakeLists.txt index b6a20384b75..3ee9d680eb9 100644 --- a/source/blender/CMakeLists.txt +++ b/source/blender/CMakeLists.txt @@ -24,23 +24,23 @@ # # ***** END GPL LICENSE BLOCK ***** -ADD_SUBDIRECTORY(windowmanager) ADD_SUBDIRECTORY(editors) -ADD_SUBDIRECTORY(avi) -ADD_SUBDIRECTORY(nodes) +ADD_SUBDIRECTORY(windowmanager) ADD_SUBDIRECTORY(blenkernel) -ADD_SUBDIRECTORY(modifiers) ADD_SUBDIRECTORY(blenlib) +ADD_SUBDIRECTORY(render) +ADD_SUBDIRECTORY(blenfont) ADD_SUBDIRECTORY(blenloader) +ADD_SUBDIRECTORY(readblenfile) ADD_SUBDIRECTORY(blenpluginapi) -ADD_SUBDIRECTORY(imbuf) +ADD_SUBDIRECTORY(ikplugin) ADD_SUBDIRECTORY(gpu) +ADD_SUBDIRECTORY(imbuf) +ADD_SUBDIRECTORY(avi) +ADD_SUBDIRECTORY(nodes) +ADD_SUBDIRECTORY(modifiers) ADD_SUBDIRECTORY(makesdna) ADD_SUBDIRECTORY(makesrna) -ADD_SUBDIRECTORY(readblenfile) -ADD_SUBDIRECTORY(render) -ADD_SUBDIRECTORY(blenfont) -ADD_SUBDIRECTORY(ikplugin) ADD_SUBDIRECTORY(freestyle) IF(WITH_IMAGE_OPENEXR) diff --git a/source/blender/avi/intern/avirgb.c b/source/blender/avi/intern/avirgb.c index f7acbf238b5..c7d411b2fc6 100644 --- a/source/blender/avi/intern/avirgb.c +++ b/source/blender/avi/intern/avirgb.c @@ -51,6 +51,8 @@ void *avi_converter_from_avi_rgb (AviMovie *movie, int stream, unsigned char *bu unsigned char *buf; AviBitmapInfoHeader *bi; short bits= 32; + + (void)size; /* unused */ bi= (AviBitmapInfoHeader *) movie->streams[stream].sf; if (bi) bits= bi->BitCount; @@ -120,6 +122,8 @@ void *avi_converter_to_avi_rgb (AviMovie *movie, int stream, unsigned char *buff int y, x, i, rowstride; unsigned char *buf; + (void)stream; /* unused */ + *size= movie->header->Height * movie->header->Width * 3; if (movie->header->Width%2) *size+= movie->header->Height; diff --git a/source/blender/avi/intern/endian.c b/source/blender/avi/intern/endian.c index 282e26b3ee8..137c664568c 100644 --- a/source/blender/avi/intern/endian.c +++ b/source/blender/avi/intern/endian.c @@ -206,6 +206,8 @@ void awrite (AviMovie *movie, void *datain, int block, int size, FILE *fp, int t MEM_freeN (data); #else /* WORDS_BIGENDIAN */ + (void)movie; /* unused */ + (void)type; /* unused */ fwrite (datain, block, size, fp); #endif /* WORDS_BIGENDIAN */ } diff --git a/source/blender/avi/intern/mjpeg.c b/source/blender/avi/intern/mjpeg.c index fd7e8aaef83..e8c96476fd1 100644 --- a/source/blender/avi/intern/mjpeg.c +++ b/source/blender/avi/intern/mjpeg.c @@ -144,6 +144,8 @@ static int Decode_JPEG(unsigned char *inBuffer, unsigned char *outBuffer, unsign unsigned int y; struct jpeg_decompress_struct dinfo; struct jpeg_error_mgr jerr; + + (void)width; /* unused */ numbytes= 0; @@ -324,7 +326,9 @@ static void check_and_compress_jpeg(int quality, unsigned char *outbuf, unsigned void *avi_converter_from_mjpeg (AviMovie *movie, int stream, unsigned char *buffer, int *size) { int deint; unsigned char *buf; - + + (void)stream; /* unused */ + buf= MEM_mallocN (movie->header->Height * movie->header->Width * 3, "avi.avi_converter_from_mjpeg 1"); deint= check_and_decode_jpeg(buffer, buf, movie->header->Width, movie->header->Height, *size); @@ -374,10 +378,11 @@ void *avi_converter_to_mjpeg (AviMovie *movie, int stream, unsigned char *buffer /* Compression from memory */ static void jpegmemdestmgr_init_destination(j_compress_ptr cinfo) { - ; + (void)cinfo; /* unused */ } static boolean jpegmemdestmgr_empty_output_buffer(j_compress_ptr cinfo) { + (void)cinfo; /* unused */ return TRUE; } @@ -403,7 +408,7 @@ static void jpegmemdestmgr_build(j_compress_ptr cinfo, unsigned char *buffer, in /* Decompression from memory */ static void jpegmemsrcmgr_init_source(j_decompress_ptr dinfo) { - ; + (void)dinfo; } static boolean jpegmemsrcmgr_fill_input_buffer(j_decompress_ptr dinfo) { diff --git a/source/blender/avi/intern/options.c b/source/blender/avi/intern/options.c index 15ec40ade8c..bec7060e118 100644 --- a/source/blender/avi/intern/options.c +++ b/source/blender/avi/intern/options.c @@ -41,6 +41,8 @@ AviError AVI_set_compress_option (AviMovie *movie, int option_type, int stream, AviOption option, void *opt_data) { int i; + (void)stream; /* unused */ + if (movie->header->TotalFrames != 0) /* Can't change params after we have already started writing frames */ return AVI_ERROR_OPTION; diff --git a/source/blender/avi/intern/rgb32.c b/source/blender/avi/intern/rgb32.c index 68e3ce4d1d2..f66f57924df 100644 --- a/source/blender/avi/intern/rgb32.c +++ b/source/blender/avi/intern/rgb32.c @@ -41,6 +41,8 @@ void *avi_converter_from_rgb32 (AviMovie *movie, int stream, unsigned char *buff int y, x, rowstridea, rowstrideb; unsigned char *buf; + (void)stream; /* unused */ + buf = MEM_mallocN (movie->header->Height * movie->header->Width * 3, "fromrgb32buf"); *size = movie->header->Height * movie->header->Width * 3; @@ -65,6 +67,8 @@ void *avi_converter_to_rgb32 (AviMovie *movie, int stream, unsigned char *buffer unsigned char *buf; unsigned char *to, *from; + (void)stream; /* unused */ + buf= MEM_mallocN (movie->header->Height * movie->header->Width * 4, "torgb32buf"); *size= movie->header->Height * movie->header->Width * 4; diff --git a/source/blender/blenfont/intern/blf_lang.c b/source/blender/blenfont/intern/blf_lang.c index 7054d955faf..21bf73b56d9 100644 --- a/source/blender/blenfont/intern/blf_lang.c +++ b/source/blender/blenfont/intern/blf_lang.c @@ -118,11 +118,13 @@ void BLF_lang_init(void) void BLF_lang_encoding(char *str) { + (void)str; return; } void BLF_lang_set(char *str) { + (void)str; return; } diff --git a/source/blender/blenkernel/BKE_blender.h b/source/blender/blenkernel/BKE_blender.h index cd9f3971540..70badbc96e8 100644 --- a/source/blender/blenkernel/BKE_blender.h +++ b/source/blender/blenkernel/BKE_blender.h @@ -50,8 +50,8 @@ struct Main; #define BLENDER_MINVERSION 250 #define BLENDER_MINSUBVERSION 0 -int BKE_read_file(struct bContext *C, char *dir, void *type_r, struct ReportList *reports); -int BKE_read_file_from_memory(struct bContext *C, char* filebuf, int filelength, void *type_r, struct ReportList *reports); +int BKE_read_file(struct bContext *C, char *dir, struct ReportList *reports); +int BKE_read_file_from_memory(struct bContext *C, char* filebuf, int filelength, struct ReportList *reports); int BKE_read_file_from_memfile(struct bContext *C, struct MemFile *memfile, struct ReportList *reports); void free_blender(void); diff --git a/source/blender/blenkernel/BKE_cloth.h b/source/blender/blenkernel/BKE_cloth.h index 034bedbb07d..e9f0304e645 100644 --- a/source/blender/blenkernel/BKE_cloth.h +++ b/source/blender/blenkernel/BKE_cloth.h @@ -220,7 +220,7 @@ void clmdSetInterruptCallBack ( int ( *f ) ( void ) ); // needed for modifier.c void cloth_free_modifier_extern ( struct ClothModifierData *clmd ); -void cloth_free_modifier ( struct Object *ob, struct ClothModifierData *clmd ); +void cloth_free_modifier ( struct ClothModifierData *clmd ); void cloth_init ( struct ClothModifierData *clmd ); struct DerivedMesh *clothModifier_do ( struct ClothModifierData *clmd, struct Scene *scene, struct Object *ob, struct DerivedMesh *dm, int useRenderParams, int isFinalCalc ); diff --git a/source/blender/blenkernel/BKE_global.h b/source/blender/blenkernel/BKE_global.h index 6a602339e11..76fb5605d77 100644 --- a/source/blender/blenkernel/BKE_global.h +++ b/source/blender/blenkernel/BKE_global.h @@ -52,9 +52,9 @@ typedef struct Global { struct Main *main; /* strings: lastsaved */ - char ima[256], sce[256], lib[256]; + char ima[256], lib[256]; - /* flag: if != 0 G.sce contains valid relative base path */ + /* flag: if != 0 G.main->name contains valid relative base path */ int relbase_valid; /* strings of recent opend files */ diff --git a/source/blender/blenkernel/BKE_image.h b/source/blender/blenkernel/BKE_image.h index 0a07e6d482c..b0cb3f32d37 100644 --- a/source/blender/blenkernel/BKE_image.h +++ b/source/blender/blenkernel/BKE_image.h @@ -112,7 +112,7 @@ struct ImBuf *BKE_image_acquire_ibuf(struct Image *ima, struct ImageUser *iuser, void BKE_image_release_ibuf(struct Image *ima, void *lock); /* returns existing Image when filename/type is same (frame optional) */ -struct Image *BKE_add_image_file(const char *name, int frame); +struct Image *BKE_add_image_file(const char *name); /* adds image, adds ibuf, generates color or pattern */ struct Image *BKE_add_image_size(unsigned int width, unsigned int height, char *name, int depth, int floatbuf, short uvtestgrid, float color[4]); diff --git a/source/blender/blenkernel/BKE_mesh.h b/source/blender/blenkernel/BKE_mesh.h index e80c266ff70..7e1ab138acc 100644 --- a/source/blender/blenkernel/BKE_mesh.h +++ b/source/blender/blenkernel/BKE_mesh.h @@ -132,8 +132,8 @@ void create_vert_edge_map(ListBase **map, IndexNode **mem, const struct MEdge *m /* Partial Mesh Visibility */ struct PartialVisibility *mesh_pmv_copy(struct PartialVisibility *); void mesh_pmv_free(struct PartialVisibility *); -void mesh_pmv_revert(struct Object *ob, struct Mesh *me); -void mesh_pmv_off(struct Object *ob, struct Mesh *me); +void mesh_pmv_revert(struct Mesh *me); +void mesh_pmv_off(struct Mesh *me); /* functions for making menu's from customdata layers */ int mesh_layers_menu_charlen(struct CustomData *data, int type); /* use this to work out how many chars to allocate */ diff --git a/source/blender/blenkernel/BKE_modifier.h b/source/blender/blenkernel/BKE_modifier.h index 51120a61e69..0225a402fb8 100644 --- a/source/blender/blenkernel/BKE_modifier.h +++ b/source/blender/blenkernel/BKE_modifier.h @@ -315,7 +315,7 @@ int modifiers_isParticleEnabled(struct Object *ob); struct Object *modifiers_isDeformedByArmature(struct Object *ob); struct Object *modifiers_isDeformedByLattice(struct Object *ob); int modifiers_usesArmature(struct Object *ob, struct bArmature *arm); -int modifiers_isCorrectableDeformed(struct Scene *scene, struct Object *ob); +int modifiers_isCorrectableDeformed(struct Object *ob); void modifier_freeTemporaryData(struct ModifierData *md); int modifiers_indexInObject(struct Object *ob, struct ModifierData *md); diff --git a/source/blender/blenkernel/BKE_object.h b/source/blender/blenkernel/BKE_object.h index 2a7ba4f98c9..7451d43a578 100644 --- a/source/blender/blenkernel/BKE_object.h +++ b/source/blender/blenkernel/BKE_object.h @@ -71,7 +71,7 @@ void object_free_modifiers(struct Object *ob); void object_make_proxy(struct Object *ob, struct Object *target, struct Object *gob); void object_copy_proxy_drivers(struct Object *ob, struct Object *target); -void unlink_object(struct Scene *scene, struct Object *ob); +void unlink_object(struct Object *ob); int exist_object(struct Object *obtest); void *add_camera(char *name); struct Camera *copy_camera(struct Camera *cam); diff --git a/source/blender/blenkernel/BKE_scene.h b/source/blender/blenkernel/BKE_scene.h index 8d5ebb64cf0..8a49e432ebd 100644 --- a/source/blender/blenkernel/BKE_scene.h +++ b/source/blender/blenkernel/BKE_scene.h @@ -64,7 +64,7 @@ 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 *copy_scene(struct Main *bmain, struct Scene *sce, int type); +struct Scene *copy_scene(struct Scene *sce, int type); void unlink_scene(struct Main *bmain, struct Scene *sce, struct Scene *newsce); int next_object(struct Scene **scene, int val, struct Base **base, struct Object **ob); diff --git a/source/blender/blenkernel/BKE_sequencer.h b/source/blender/blenkernel/BKE_sequencer.h index 252c9fee8f7..8cf541ae03a 100644 --- a/source/blender/blenkernel/BKE_sequencer.h +++ b/source/blender/blenkernel/BKE_sequencer.h @@ -156,7 +156,7 @@ void give_ibuf_prefetch_request(int rectx, int recty, int cfra, int chanshown, i void calc_sequence(struct Scene *scene, struct Sequence *seq); void calc_sequence_disp(struct Scene *scene, struct Sequence *seq); void new_tstripdata(struct Sequence *seq); -void reload_sequence_new_file(struct Main *bmain, struct Scene *scene, struct Sequence * seq, int lock_range); +void reload_sequence_new_file(struct Scene *scene, struct Sequence * seq, int lock_range); void sort_seq(struct Scene *scene); void build_seqar_cb(struct ListBase *seqbase, struct Sequence ***seqar, int *totseq, int (*test_func)(struct Sequence * seq)); diff --git a/source/blender/blenkernel/BKE_utildefines.h b/source/blender/blenkernel/BKE_utildefines.h index 5a6a151afee..33ab6c36b74 100644 --- a/source/blender/blenkernel/BKE_utildefines.h +++ b/source/blender/blenkernel/BKE_utildefines.h @@ -44,6 +44,14 @@ #define STRINGIFY_ARG(x) #x #define STRINGIFY(x) STRINGIFY_ARG(x) + + +#ifdef __GNUC__ +# define UNUSED(x) UNUSED_ ## x __attribute__((__unused__)) +#else +# define UNUSED(x) x +#endif + /* these values need to be hardcoded in structs, dna does not recognize defines */ /* also defined in DNA_space_types.h */ #ifndef FILE_MAXDIR diff --git a/source/blender/blenkernel/SConscript b/source/blender/blenkernel/SConscript index 0345ef26c9a..52530c94f27 100644 --- a/source/blender/blenkernel/SConscript +++ b/source/blender/blenkernel/SConscript @@ -25,7 +25,7 @@ else: incs += ' ../python' incs += ' ' + env['BF_PYTHON_INC'] if env['BF_DEBUG']: - defs.append('_DEBUG') + defs.append('DEBUG') if env['WITH_BF_QUICKTIME']: incs += ' ../quicktime' diff --git a/source/blender/blenkernel/intern/BME_tools.c b/source/blender/blenkernel/intern/BME_tools.c index 7d9c9a431f8..444bc10d562 100644 --- a/source/blender/blenkernel/intern/BME_tools.c +++ b/source/blender/blenkernel/intern/BME_tools.c @@ -107,7 +107,7 @@ float *BME_new_transdata_float(BME_TransData_Head *td) { return BLI_memarena_alloc(td->ma, sizeof(float)); } -static int BME_is_nonmanifold_vert(BME_Mesh *bm, BME_Vert *v) { +static int BME_is_nonmanifold_vert(BME_Mesh *UNUSED(bm), BME_Vert *v) { BME_Edge *e, *oe; BME_Loop *l; int len, count, flag; @@ -217,7 +217,7 @@ static void BME_data_interp_from_verts(BME_Mesh *bm, BME_Vert *v1, BME_Vert *v2, #endif -static void BME_data_facevert_edgesplit(BME_Mesh *bm, BME_Vert *v1, BME_Vert *v2, BME_Vert *v, BME_Edge *e1, float fac){ +static void BME_data_facevert_edgesplit(BME_Mesh *bm, BME_Vert *v1, BME_Vert *UNUSED(v2), BME_Vert *v, BME_Edge *e1, float fac){ void *src[2]; float w[2]; BME_Loop *l=NULL, *v1loop = NULL, *vloop = NULL, *v2loop = NULL; @@ -356,7 +356,7 @@ static int BME_bevel_get_vec(float *vec, BME_Vert *v1, BME_Vert *v2, BME_TransDa * vec2 is the direction of projection (pointing away from vec1) * up_vec is used for orientation (expected to be normalized) * returns the length of the projected vector that lies along vec1 */ -static float BME_bevel_project_vec(float *vec1, float *vec2, float *up_vec, int is_forward, BME_TransData_Head *td) { +static float BME_bevel_project_vec(float *vec1, float *vec2, float *up_vec, int is_forward, BME_TransData_Head *UNUSED(td)) { float factor, vec3[3], tmp[3],c1,c2; cross_v3_v3v3(tmp,vec1,vec2); @@ -582,7 +582,7 @@ static float BME_bevel_set_max(BME_Vert *v1, BME_Vert *v2, float value, BME_Tran return max; } -static BME_Vert *BME_bevel_wire(BME_Mesh *bm, BME_Vert *v, float value, int res, int options, BME_TransData_Head *td) { +static BME_Vert *BME_bevel_wire(BME_Mesh *bm, BME_Vert *v, float value, int res, int UNUSED(options), BME_TransData_Head *td) { BME_Vert *ov1, *ov2, *v1, *v2; ov1 = BME_edge_getothervert(v->edge, v); @@ -607,7 +607,7 @@ static BME_Vert *BME_bevel_wire(BME_Mesh *bm, BME_Vert *v, float value, int res, return v1; } -static BME_Loop *BME_bevel_edge(BME_Mesh *bm, BME_Loop *l, float value, int options, float *up_vec, BME_TransData_Head *td) { +static BME_Loop *BME_bevel_edge(BME_Mesh *bm, BME_Loop *l, float value, int UNUSED(options), float *up_vec, BME_TransData_Head *td) { BME_Vert *v1, *v2, *kv; BME_Loop *kl=NULL, *nl; BME_Edge *e; @@ -708,7 +708,7 @@ static BME_Loop *BME_bevel_edge(BME_Mesh *bm, BME_Loop *l, float value, int opti return l; } -static BME_Loop *BME_bevel_vert(BME_Mesh *bm, BME_Loop *l, float value, int options, float *up_vec, BME_TransData_Head *td) { +static BME_Loop *BME_bevel_vert(BME_Mesh *bm, BME_Loop *l, float value, int UNUSED(options), float *up_vec, BME_TransData_Head *td) { BME_Vert *v1, *v2; BME_Poly *f; @@ -859,7 +859,7 @@ static void BME_bevel_add_vweight(BME_TransData_Head *td, BME_Mesh *bm, BME_Vert } } -static float BME_bevel_get_angle(BME_Mesh *bm, BME_Edge *e, BME_Vert *v) { +static float BME_bevel_get_angle(BME_Mesh *UNUSED(bm), BME_Edge *e, BME_Vert *v) { BME_Vert *v1, *v2; BME_Loop *l1, *l2; float vec1[3], vec2[3], vec3[3], vec4[3]; @@ -918,7 +918,7 @@ static int BME_face_sharededges(BME_Poly *f1, BME_Poly *f2){ * Returns - * A BME_Mesh pointer to the BMesh passed as a parameter. */ -static BME_Mesh *BME_bevel_initialize(BME_Mesh *bm, int options, int defgrp_index, float angle, BME_TransData_Head *td) { +static BME_Mesh *BME_bevel_initialize(BME_Mesh *bm, int options, int UNUSED(defgrp_index), float angle, BME_TransData_Head *td) { BME_Vert *v; BME_Edge *e; BME_Poly *f; @@ -1162,7 +1162,7 @@ static void bmesh_dissolve_disk(BME_Mesh *bm, BME_Vert *v){ //BME_JEKV(bm,v->edge,v); } } -static BME_Mesh *BME_bevel_mesh(BME_Mesh *bm, float value, int res, int options, int defgrp_index, BME_TransData_Head *td) { +static BME_Mesh *BME_bevel_mesh(BME_Mesh *bm, float value, int res, int options, int UNUSED(defgrp_index), BME_TransData_Head *td) { BME_Vert *v, *nv; BME_Edge *e, *oe; BME_Loop *l, *l2; diff --git a/source/blender/blenkernel/intern/CCGSubSurf.c b/source/blender/blenkernel/intern/CCGSubSurf.c index bbd68fb797b..1cd5ae381c4 100644 --- a/source/blender/blenkernel/intern/CCGSubSurf.c +++ b/source/blender/blenkernel/intern/CCGSubSurf.c @@ -15,6 +15,13 @@ #define CCG_INLINE inline #endif +/* copied from BKE_utildefines.h ugh */ +#ifdef __GNUC__ +# define UNUSED(x) UNUSED_ ## x __attribute__((__unused__)) +#else +# define UNUSED(x) x +#endif + /* used for normalize_v3 in BLI_math_vector * float.h's FLT_EPSILON causes trouble with subsurf normals - campbell */ #define EPSILON (1.0e-35f) @@ -185,13 +192,13 @@ static int _ehashIterator_isStopped(EHashIterator *ehi) { /***/ -static void *_stdAllocator_alloc(CCGAllocatorHDL a, int numBytes) { +static void *_stdAllocator_alloc(CCGAllocatorHDL UNUSED(a), int numBytes) { return malloc(numBytes); } -static void *_stdAllocator_realloc(CCGAllocatorHDL a, void *ptr, int newSize, int oldSize) { +static void *_stdAllocator_realloc(CCGAllocatorHDL UNUSED(a), void *ptr, int newSize, int UNUSED(oldSize)) { return realloc(ptr, newSize); } -static void _stdAllocator_free(CCGAllocatorHDL a, void *ptr) { +static void _stdAllocator_free(CCGAllocatorHDL UNUSED(a), void *ptr) { free(ptr); } @@ -2601,7 +2608,7 @@ float ccgSubSurf_getEdgeCrease(CCGEdge *e) { /* Face accessors */ -CCGFaceHDL ccgSubSurf_getFaceFaceHandle(CCGSubSurf *ss, CCGFace *f) { +CCGFaceHDL ccgSubSurf_getFaceFaceHandle(CCGSubSurf *UNUSED(ss), CCGFace *f) { return f->fHDL; } int ccgSubSurf_getFaceAge(CCGSubSurf *ss, CCGFace *f) { @@ -2619,14 +2626,14 @@ void *ccgSubSurf_getFaceUserData(CCGSubSurf *ss, CCGFace *f) { int ccgSubSurf_getFaceNumVerts(CCGFace *f) { return f->numVerts; } -CCGVert *ccgSubSurf_getFaceVert(CCGSubSurf *ss, CCGFace *f, int index) { +CCGVert *ccgSubSurf_getFaceVert(CCGSubSurf *UNUSED(ss), CCGFace *f, int index) { if (index<0 || index>=f->numVerts) { return NULL; } else { return FACE_getVerts(f)[index]; } } -CCGEdge *ccgSubSurf_getFaceEdge(CCGSubSurf *ss, CCGFace *f, int index) { +CCGEdge *ccgSubSurf_getFaceEdge(CCGSubSurf *UNUSED(ss), CCGFace *f, int index) { if (index<0 || index>=f->numVerts) { return NULL; } else { diff --git a/source/blender/blenkernel/intern/DerivedMesh.c b/source/blender/blenkernel/intern/DerivedMesh.c index eb5d77bb9b0..2e8922dec1b 100644 --- a/source/blender/blenkernel/intern/DerivedMesh.c +++ b/source/blender/blenkernel/intern/DerivedMesh.c @@ -517,7 +517,7 @@ static void emDM_drawMappedEdges(DerivedMesh *dm, int (*setDrawOptions)(void *us glEnd(); } } -static void emDM_drawEdges(DerivedMesh *dm, int drawLooseEdges, int drawAllEdges) +static void emDM_drawEdges(DerivedMesh *dm, int UNUSED(drawLooseEdges), int UNUSED(drawAllEdges)) { emDM_drawMappedEdges(dm, NULL, NULL); } @@ -628,11 +628,13 @@ static void emDM_foreachMappedFaceCenter(DerivedMesh *dm, void (*func)(void *use } /* note, material function is ignored for now. */ -static void emDM_drawMappedFaces(DerivedMesh *dm, int (*setDrawOptions)(void *userData, int index, int *drawSmooth_r), void *userData, int useColors, int (*setMaterial)(int, void *attribs)) +static void emDM_drawMappedFaces(DerivedMesh *dm, int (*setDrawOptions)(void *userData, int index, int *drawSmooth_r), void *userData, int UNUSED(useColors), int (*setMaterial)(int, void *attribs)) { EditMeshDerivedMesh *emdm= (EditMeshDerivedMesh*) dm; EditFace *efa; int i, draw; + + (void)setMaterial; /* unused */ if (emdm->vertexCos) { EditVert *eve; @@ -1326,8 +1328,7 @@ static void emDM_release(DerivedMesh *dm) } } -static DerivedMesh *getEditMeshDerivedMesh(EditMesh *em, Object *ob, - float (*vertexCos)[3]) +static DerivedMesh *getEditMeshDerivedMesh(EditMesh *em, float (*vertexCos)[3]) { EditMeshDerivedMesh *emdm = MEM_callocN(sizeof(*emdm), "emdm"); @@ -2023,7 +2024,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, ob, NULL); + *cage_r = getEditMeshDerivedMesh(em, NULL); } dm = NULL; @@ -2156,7 +2157,7 @@ static void editmesh_calc_modifiers(Scene *scene, Object *ob, EditMesh *em, Deri *cage_r = dm; } else { *cage_r = - getEditMeshDerivedMesh(em, ob, + getEditMeshDerivedMesh(em, deformedVerts ? MEM_dupallocN(deformedVerts) : NULL); } } @@ -2180,7 +2181,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, ob, deformedVerts); + *final_r = getEditMeshDerivedMesh(em, deformedVerts); deformedVerts = NULL; } @@ -2237,7 +2238,7 @@ static void mesh_build_data(Scene *scene, Object *ob, CustomDataMask dataMask) Object *obact = scene->basact?scene->basact->object:NULL; int editing = paint_facesel_test(ob); /* weight paint and face select need original indicies because of selection buffer drawing */ - int needMapping = (ob==obact) && (editing || (ob->mode & (OB_MODE_WEIGHT_PAINT|OB_MODE_VERTEX_PAINT)) || editing); + int needMapping = (ob==obact) && (editing || (ob->mode & (OB_MODE_WEIGHT_PAINT|OB_MODE_VERTEX_PAINT))); clear_mesh_caches(ob); @@ -2396,9 +2397,9 @@ DerivedMesh *editmesh_get_derived_cage(Scene *scene, Object *obedit, EditMesh *e return em->derivedCage; } -DerivedMesh *editmesh_get_derived_base(Object *obedit, EditMesh *em) +DerivedMesh *editmesh_get_derived_base(Object *UNUSED(obedit), EditMesh *em) { - return getEditMeshDerivedMesh(em, obedit, NULL); + return getEditMeshDerivedMesh(em, NULL); } @@ -2484,7 +2485,7 @@ int editmesh_get_first_deform_matrices(Scene *scene, Object *ob, EditMesh *em, f if(mti->type==eModifierTypeType_OnlyDeform && mti->deformMatricesEM) { if(!defmats) { - dm= getEditMeshDerivedMesh(em, ob, NULL); + dm= getEditMeshDerivedMesh(em, NULL); deformedVerts= editmesh_getVertexCos(em, &numVerts); defmats= MEM_callocN(sizeof(*defmats)*numVerts, "defmats"); diff --git a/source/blender/blenkernel/intern/action.c b/source/blender/blenkernel/intern/action.c index 90a3a6ce664..5a96575452b 100644 --- a/source/blender/blenkernel/intern/action.c +++ b/source/blender/blenkernel/intern/action.c @@ -1091,7 +1091,7 @@ void copy_pose_result(bPose *to, bPose *from) /* For the calculation of the effects of an Action at the given frame on an object * This is currently only used for the Action Constraint */ -void what_does_obaction (Scene *scene, Object *ob, Object *workob, bPose *pose, bAction *act, char groupname[], float cframe) +void what_does_obaction (Scene *UNUSED(scene), Object *ob, Object *workob, bPose *pose, bAction *act, char groupname[], float cframe) { bActionGroup *agrp= action_groups_find_named(act, groupname); diff --git a/source/blender/blenkernel/intern/anim.c b/source/blender/blenkernel/intern/anim.c index b2feb01352e..7b52d9c586a 100644 --- a/source/blender/blenkernel/intern/anim.c +++ b/source/blender/blenkernel/intern/anim.c @@ -1138,7 +1138,7 @@ static void face_duplilist(ListBase *lb, ID *id, Scene *scene, Object *par, floa dm->release(dm); } -static void new_particle_duplilist(ListBase *lb, ID *id, Scene *scene, Object *par, float par_space_mat[][4], ParticleSystem *psys, int level, int animated) +static void new_particle_duplilist(ListBase *lb, ID *UNUSED(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; diff --git a/source/blender/blenkernel/intern/anim_sys.c b/source/blender/blenkernel/intern/anim_sys.c index e58526cae0f..6ace4a64773 100644 --- a/source/blender/blenkernel/intern/anim_sys.c +++ b/source/blender/blenkernel/intern/anim_sys.c @@ -570,7 +570,7 @@ void BKE_all_animdata_fix_paths_rename (char *prefix, char *oldName, char *newNa /* Find the first path that matches the given criteria */ // TODO: do we want some method to perform partial matches too? -KS_Path *BKE_keyingset_find_path (KeyingSet *ks, ID *id, const char group_name[], const char rna_path[], int array_index, int group_mode) +KS_Path *BKE_keyingset_find_path (KeyingSet *ks, ID *id, const char group_name[], const char rna_path[], int array_index, int UNUSED(group_mode)) { KS_Path *ksp; @@ -772,7 +772,7 @@ void BKE_keyingsets_free (ListBase *list) * - path: original path string (as stored in F-Curve data) * - dst: destination string to write data to */ -static short animsys_remap_path (AnimMapper *remap, char *path, char **dst) +static short animsys_remap_path (AnimMapper *UNUSED(remap), char *path, char **dst) { /* is there a valid remapping table to use? */ //if (remap) { @@ -1612,7 +1612,7 @@ static void animsys_evaluate_nla (PointerRNA *ptr, AnimData *adt, float ctime) /* 1. get the stack of strips to evaluate at current time (influence calculated here) */ for (nlt=adt->nla_tracks.first; nlt; nlt=nlt->next, track_index++) { - /* if tweaking is on and this strip is the tweaking track, stop on this one */ + /* stop here if tweaking is on and this strip is the tweaking track (it will be the first one that's 'disabled')... */ if ((adt->flag & ADT_NLA_EDIT_ON) && (nlt->flag & NLATRACK_DISABLED)) break; @@ -1639,22 +1639,30 @@ static void animsys_evaluate_nla (PointerRNA *ptr, AnimData *adt, float ctime) */ if ((adt->action) && !(adt->flag & ADT_NLA_SOLO_TRACK)) { /* if there are strips, evaluate action as per NLA rules */ - if (has_strips) { + if ((has_strips) || (adt->actstrip)) { /* make dummy NLA strip, and add that to the stack */ memset(&dummy_strip, 0, sizeof(NlaStrip)); dummy_trackslist.first= dummy_trackslist.last= &dummy_strip; - dummy_strip.act= adt->action; - dummy_strip.remap= adt->remap; - - /* action range is calculated taking F-Modifiers into account (which making new strips doesn't do due to the troublesome nature of that) */ - calc_action_range(dummy_strip.act, &dummy_strip.actstart, &dummy_strip.actend, 1); - dummy_strip.start = dummy_strip.actstart; - dummy_strip.end = (IS_EQ(dummy_strip.actstart, dummy_strip.actend)) ? (dummy_strip.actstart + 1.0f): (dummy_strip.actend); - - dummy_strip.blendmode= adt->act_blendmode; - dummy_strip.extendmode= adt->act_extendmode; - dummy_strip.influence= adt->act_influence; + if ((nlt) && !(adt->flag & ADT_NLA_EDIT_NOMAP)) { + /* edit active action in-place according to its active strip, so copy the data */ + memcpy(&dummy_strip, adt->actstrip, sizeof(NlaStrip)); + dummy_strip.next = dummy_strip.prev = NULL; + } + else { + /* set settings of dummy NLA strip from AnimData settings */ + dummy_strip.act= adt->action; + dummy_strip.remap= adt->remap; + + /* action range is calculated taking F-Modifiers into account (which making new strips doesn't do due to the troublesome nature of that) */ + calc_action_range(dummy_strip.act, &dummy_strip.actstart, &dummy_strip.actend, 1); + dummy_strip.start = dummy_strip.actstart; + dummy_strip.end = (IS_EQ(dummy_strip.actstart, dummy_strip.actend)) ? (dummy_strip.actstart + 1.0f): (dummy_strip.actend); + + dummy_strip.blendmode= adt->act_blendmode; + dummy_strip.extendmode= adt->act_extendmode; + dummy_strip.influence= adt->act_influence; + } /* add this to our list of evaluation strips */ nlastrips_ctime_get_strip(&estrips, &dummy_trackslist, -1, ctime); @@ -1690,7 +1698,7 @@ static void animsys_evaluate_nla (PointerRNA *ptr, AnimData *adt, float ctime) /* Clear all overides */ /* Add or get existing Override for given setting */ -AnimOverride *BKE_animsys_validate_override (PointerRNA *ptr, char *path, int array_index) +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; @@ -1699,7 +1707,7 @@ AnimOverride *BKE_animsys_validate_override (PointerRNA *ptr, char *path, int ar /* -------------------- */ /* Evaluate Overrides */ -static void animsys_evaluate_overrides (PointerRNA *ptr, AnimData *adt, float ctime) +static void animsys_evaluate_overrides (PointerRNA *ptr, AnimData *adt) { AnimOverride *aor; @@ -1798,7 +1806,7 @@ void BKE_animsys_evaluate_animdata (ID *id, AnimData *adt, float ctime, short re * - Overrides are cleared upon frame change and/or keyframing * - It is best that we execute this everytime, so that no errors are likely to occur. */ - animsys_evaluate_overrides(&id_ptr, adt, ctime); + animsys_evaluate_overrides(&id_ptr, adt); /* clear recalc flag now */ adt->recalc= 0; diff --git a/source/blender/blenkernel/intern/armature.c b/source/blender/blenkernel/intern/armature.c index 2e760f53155..f0c39e6373e 100644 --- a/source/blender/blenkernel/intern/armature.c +++ b/source/blender/blenkernel/intern/armature.c @@ -252,7 +252,7 @@ Bone *get_named_bone (bArmature *arm, const char *name) * 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 strip_number, short axis, float head, float tail) +int bone_autoside_name (char *name, int UNUSED(strip_number), short axis, float head, float tail) { unsigned int len; char basename[32]={""}; @@ -1057,7 +1057,7 @@ void armature_deform_verts(Object *armOb, Object *target, DerivedMesh *dm, /* ************ END Armature Deform ******************* */ -void get_objectspace_bone_matrix (struct Bone* bone, float M_accumulatedMatrix[][4], int root, int posed) +void get_objectspace_bone_matrix (struct Bone* bone, float M_accumulatedMatrix[][4], int UNUSED(root), int UNUSED(posed)) { copy_m4_m4(M_accumulatedMatrix, bone->arm_mat); } @@ -1616,7 +1616,7 @@ typedef struct tSplineIK_Tree { /* ----------- */ /* Tag the bones in the chain formed by the given bone for IK */ -static void splineik_init_tree_from_pchan(Scene *scene, Object *ob, bPoseChannel *pchan_tip) +static void splineik_init_tree_from_pchan(Scene *scene, Object *UNUSED(ob), bPoseChannel *pchan_tip) { bPoseChannel *pchan, *pchanRoot=NULL; bPoseChannel *pchanChain[255]; @@ -1785,7 +1785,7 @@ static void splineik_init_tree_from_pchan(Scene *scene, Object *ob, bPoseChannel } /* Tag which bones are members of Spline IK chains */ -static void splineik_init_tree(Scene *scene, Object *ob, float ctime) +static void splineik_init_tree(Scene *scene, Object *ob, float UNUSED(ctime)) { bPoseChannel *pchan; @@ -2239,13 +2239,28 @@ void where_is_pose_bone(Scene *scene, Object *ob, bPoseChannel *pchan, float cti offs_bone[3][1]+= parbone->length; /* Compose the matrix for this bone */ - if(bone->flag & BONE_HINGE) { // uses restposition rotation, but actual position + if((bone->flag & BONE_HINGE) && (bone->flag & BONE_NO_SCALE)) { // uses restposition rotation, but actual position float tmat[4][4]; - /* the rotation of the parent restposition */ copy_m4_m4(tmat, parbone->arm_mat); mul_serie_m4(pchan->pose_mat, tmat, offs_bone, pchan->chan_mat, NULL, NULL, NULL, NULL, NULL); } + else if(bone->flag & BONE_HINGE) { // same as above but apply parent scale + float tmat[4][4]; + + /* apply the parent matrix scale */ + float tsmat[4][4], tscale[3]; + + /* the rotation of the parent restposition */ + copy_m4_m4(tmat, parbone->arm_mat); + + /* extract the scale of the parent matrix */ + mat4_to_size(tscale, parchan->pose_mat); + size_to_mat4(tsmat, tscale); + mul_m4_m4m4(tmat, tmat, tsmat); + + mul_serie_m4(pchan->pose_mat, tmat, offs_bone, pchan->chan_mat, NULL, NULL, NULL, NULL, NULL); + } else if(bone->flag & BONE_NO_SCALE) { float orthmat[4][4]; diff --git a/source/blender/blenkernel/intern/blender.c b/source/blender/blenkernel/intern/blender.c index d120b42a286..72d194e4d79 100644 --- a/source/blender/blenkernel/intern/blender.c +++ b/source/blender/blenkernel/intern/blender.c @@ -309,8 +309,8 @@ static void setup_app_data(bContext *C, BlendFileData *bfd, char *filename) #endif /* these are the same at times, should never copy to the same location */ - if(G.sce != filename) - BLI_strncpy(G.sce, filename, FILE_MAX); + if(G.main->name != filename) + BLI_strncpy(G.main->name, filename, FILE_MAX); BLI_strncpy(G.main->name, filename, FILE_MAX); /* is guaranteed current file */ @@ -365,7 +365,7 @@ void BKE_userdef_free(void) 2: OK, and with new user settings */ -int BKE_read_file(bContext *C, char *dir, void *unused, ReportList *reports) +int BKE_read_file(bContext *C, char *dir, ReportList *reports) { BlendFileData *bfd; int retval= 1; @@ -392,7 +392,7 @@ int BKE_read_file(bContext *C, char *dir, void *unused, ReportList *reports) return (bfd?retval:0); } -int BKE_read_file_from_memory(bContext *C, char* filebuf, int filelength, void *unused, ReportList *reports) +int BKE_read_file_from_memory(bContext *C, char* filebuf, int filelength, ReportList *reports) { BlendFileData *bfd; @@ -410,7 +410,7 @@ int BKE_read_file_from_memfile(bContext *C, MemFile *memfile, ReportList *report { BlendFileData *bfd; - bfd= BLO_read_from_memfile(CTX_data_main(C), G.sce, memfile, reports); + bfd= BLO_read_from_memfile(CTX_data_main(C), G.main->name, memfile, reports); if (bfd) setup_app_data(C, bfd, "<memory1>"); else @@ -460,26 +460,23 @@ static UndoElem *curundo= NULL; static int read_undosave(bContext *C, UndoElem *uel) { - char scestr[FILE_MAXDIR+FILE_MAXFILE]; /* we should eventually just use G.main->name */ char mainstr[FILE_MAXDIR+FILE_MAXFILE]; int success=0, fileflags; /* This is needed so undoing/redoing doesnt crash with threaded previews going */ WM_jobs_stop_all(CTX_wm_manager(C)); - - strcpy(scestr, G.sce); /* temporal store */ + strcpy(mainstr, G.main->name); /* temporal store */ fileflags= G.fileflags; G.fileflags |= G_FILE_NO_UI; if(UNDO_DISK) - success= BKE_read_file(C, uel->str, NULL, NULL); + success= BKE_read_file(C, uel->str, NULL); else success= BKE_read_file_from_memfile(C, &uel->memfile, NULL); /* restore */ - strcpy(G.sce, scestr); /* restore */ strcpy(G.main->name, mainstr); /* restore */ G.fileflags= fileflags; @@ -554,7 +551,7 @@ void BKE_write_undo(bContext *C, char *name) if(curundo->prev) prevfile= &(curundo->prev->memfile); memused= MEM_get_memory_in_use(); - success= BLO_write_file_mem(CTX_data_main(C), prevfile, &curundo->memfile, G.fileflags, NULL); + success= BLO_write_file_mem(CTX_data_main(C), prevfile, &curundo->memfile, G.fileflags); curundo->undosize= MEM_get_memory_in_use() - memused; } @@ -720,7 +717,7 @@ void BKE_undo_save_quit(void) Main *BKE_undo_get_main(Scene **scene) { Main *mainp= NULL; - BlendFileData *bfd= BLO_read_from_memfile(G.main, G.sce, &curundo->memfile, NULL); + BlendFileData *bfd= BLO_read_from_memfile(G.main, G.main->name, &curundo->memfile, NULL); if(bfd) { mainp= bfd->main; diff --git a/source/blender/blenkernel/intern/boids.c b/source/blender/blenkernel/intern/boids.c index 69a42e52247..943cf20720e 100644 --- a/source/blender/blenkernel/intern/boids.c +++ b/source/blender/blenkernel/intern/boids.c @@ -58,7 +58,7 @@ typedef struct BoidValues { static int apply_boid_rule(BoidBrainData *bbd, BoidRule *rule, BoidValues *val, ParticleData *pa, float fuzziness); -static int rule_none(BoidRule *rule, BoidBrainData *data, BoidValues *val, ParticleData *pa) +static int rule_none(BoidRule *UNUSED(rule), BoidBrainData *UNUSED(data), BoidValues *UNUSED(val), ParticleData *UNUSED(pa)) { return 0; } @@ -344,7 +344,7 @@ static int rule_avoid_collision(BoidRule *rule, BoidBrainData *bbd, BoidValues * return ret; } -static int rule_separate(BoidRule *rule, BoidBrainData *bbd, BoidValues *val, ParticleData *pa) +static int rule_separate(BoidRule *UNUSED(rule), BoidBrainData *bbd, BoidValues *val, ParticleData *pa) { KDTreeNearest *ptn = NULL; ParticleTarget *pt; @@ -384,7 +384,7 @@ static int rule_separate(BoidRule *rule, BoidBrainData *bbd, BoidValues *val, Pa } return ret; } -static int rule_flock(BoidRule *rule, BoidBrainData *bbd, BoidValues *val, ParticleData *pa) +static int rule_flock(BoidRule *UNUSED(rule), BoidBrainData *bbd, BoidValues *UNUSED(val), ParticleData *pa) { KDTreeNearest ptn[11]; float vec[3] = {0.0f, 0.0f, 0.0f}, loc[3] = {0.0f, 0.0f, 0.0f}; @@ -823,7 +823,7 @@ static Object *boid_find_ground(BoidBrainData *bbd, ParticleData *pa, float *gro return NULL; } } -static int boid_rule_applies(ParticleData *pa, BoidSettings *boids, BoidRule *rule) +static int boid_rule_applies(ParticleData *pa, BoidSettings *UNUSED(boids), BoidRule *rule) { BoidParticle *bpa = pa->boid; diff --git a/source/blender/blenkernel/intern/brush.c b/source/blender/blenkernel/intern/brush.c index c67db9382f3..d894aef4ac5 100644 --- a/source/blender/blenkernel/intern/brush.c +++ b/source/blender/blenkernel/intern/brush.c @@ -530,7 +530,7 @@ void brush_imbuf_new(Brush *brush, short flt, short texfall, int bufsize, ImBuf if (*outbuf) ibuf= *outbuf; else - ibuf= IMB_allocImBuf(bufsize, bufsize, 32, imbflag, 0); + ibuf= IMB_allocImBuf(bufsize, bufsize, 32, imbflag); if (flt) { for (y=0; y < ibuf->y; y++) { @@ -796,11 +796,11 @@ static void brush_painter_fixed_tex_partial_update(BrushPainter *painter, float imbflag= (cache->flt)? IB_rectfloat: IB_rect; if (!cache->ibuf) - cache->ibuf= IMB_allocImBuf(diameter, diameter, 32, imbflag, 0); + cache->ibuf= IMB_allocImBuf(diameter, diameter, 32, imbflag); ibuf= cache->ibuf; oldtexibuf= cache->texibuf; - cache->texibuf= IMB_allocImBuf(diameter, diameter, 32, imbflag, 0); + cache->texibuf= IMB_allocImBuf(diameter, diameter, 32, imbflag); if (oldtexibuf) { srcx= srcy= 0; diff --git a/source/blender/blenkernel/intern/bvhutils.c b/source/blender/blenkernel/intern/bvhutils.c index 1b7257519b1..671bcb36680 100644 --- a/source/blender/blenkernel/intern/bvhutils.c +++ b/source/blender/blenkernel/intern/bvhutils.c @@ -42,7 +42,7 @@ /* Math stuff for ray casting on mesh faces and for nearest surface */ -static float ray_tri_intersection(const BVHTreeRay *ray, const float m_dist, const float *v0, const float *v1, const float *v2) +static float ray_tri_intersection(const BVHTreeRay *ray, const float UNUSED(m_dist), const float *v0, const float *v1, const float *v2) { float dist; diff --git a/source/blender/blenkernel/intern/cdderivedmesh.c b/source/blender/blenkernel/intern/cdderivedmesh.c index b9ca7bfafe3..eb895d62f17 100644 --- a/source/blender/blenkernel/intern/cdderivedmesh.c +++ b/source/blender/blenkernel/intern/cdderivedmesh.c @@ -418,7 +418,7 @@ static void cdDM_drawLooseEdges(DerivedMesh *dm) static void cdDM_drawFacesSolid(DerivedMesh *dm, float (*partial_redraw_planes)[4], - int fast, int (*setMaterial)(int, void *attribs)) + int UNUSED(fast), int (*setMaterial)(int, void *attribs)) { CDDerivedMesh *cddm = (CDDerivedMesh*) dm; MVert *mvert = cddm->mvert; @@ -1489,7 +1489,7 @@ DerivedMesh *CDDM_new(int numVerts, int numEdges, int numFaces) return dm; } -DerivedMesh *CDDM_from_mesh(Mesh *mesh, Object *ob) +DerivedMesh *CDDM_from_mesh(Mesh *mesh, Object *UNUSED(ob)) { CDDerivedMesh *cddm = cdDM_create("CDDM_from_mesh dm"); DerivedMesh *dm = &cddm->dm; @@ -1518,7 +1518,7 @@ DerivedMesh *CDDM_from_mesh(Mesh *mesh, Object *ob) return dm; } -DerivedMesh *CDDM_from_editmesh(EditMesh *em, Mesh *me) +DerivedMesh *CDDM_from_editmesh(EditMesh *em, Mesh *UNUSED(me)) { DerivedMesh *dm = CDDM_new(BLI_countlist(&em->verts), BLI_countlist(&em->edges), diff --git a/source/blender/blenkernel/intern/cloth.c b/source/blender/blenkernel/intern/cloth.c index be1552a882d..e7e94c407f1 100644 --- a/source/blender/blenkernel/intern/cloth.c +++ b/source/blender/blenkernel/intern/cloth.c @@ -87,7 +87,7 @@ static CM_SOLVER_DEF solvers [] = /* Prototypes for internal functions. */ static void cloth_to_object (Object *ob, ClothModifierData *clmd, DerivedMesh *dm); -static void cloth_from_mesh ( Object *ob, ClothModifierData *clmd, DerivedMesh *dm ); +static void cloth_from_mesh ( ClothModifierData *clmd, DerivedMesh *dm ); static int cloth_from_object(Object *ob, ClothModifierData *clmd, DerivedMesh *dm, float framenr, int first); static int cloth_build_springs ( ClothModifierData *clmd, DerivedMesh *dm ); static void cloth_apply_vgroup ( ClothModifierData *clmd, DerivedMesh *dm ); @@ -423,7 +423,7 @@ static int do_step_cloth(Object *ob, ClothModifierData *clmd, DerivedMesh *resul /************************************************ * clothModifier_do - main simulation function ************************************************/ -DerivedMesh *clothModifier_do(ClothModifierData *clmd, Scene *scene, Object *ob, DerivedMesh *dm, int useRenderParams, int isFinalCalc) +DerivedMesh *clothModifier_do(ClothModifierData *clmd, Scene *scene, Object *ob, DerivedMesh *dm, int UNUSED(useRenderParams), int UNUSED(isFinalCalc)) { DerivedMesh *result; PointCache *cache; @@ -446,7 +446,9 @@ DerivedMesh *clothModifier_do(ClothModifierData *clmd, Scene *scene, Object *ob, return dm; } - if(clmd->sim_parms->reset || (framenr == (startframe - clmd->sim_parms->preroll) && clmd->sim_parms->preroll != 0)) + if(clmd->sim_parms->reset + || (framenr == (startframe - clmd->sim_parms->preroll) && clmd->sim_parms->preroll != 0) + || (clmd->clothObject && result->getNumVerts(result) != clmd->clothObject->numverts)) { clmd->sim_parms->reset = 0; cache->flag |= PTCACHE_OUTDATED; @@ -457,17 +459,6 @@ DerivedMesh *clothModifier_do(ClothModifierData *clmd, Scene *scene, Object *ob, return result; } - /* verify we still have the same number of vertices, if not do nothing. - * note that this should only happen if the number of vertices changes - * during an animation due to a preceding modifier, this should not - * happen because of object changes! */ - if(clmd->clothObject) { - if(result->getNumVerts(result) != clmd->clothObject->numverts) { - BKE_ptcache_invalidate(cache); - return result; - } - } - // unused in the moment, calculated separately in implicit.c clmd->sim_parms->dt = clmd->sim_parms->timescale / clmd->sim_parms->stepsPerFrame; @@ -555,7 +546,7 @@ DerivedMesh *clothModifier_do(ClothModifierData *clmd, Scene *scene, Object *ob, } /* frees all */ -void cloth_free_modifier ( Object *ob, ClothModifierData *clmd ) +void cloth_free_modifier(ClothModifierData *clmd ) { Cloth *cloth = NULL; @@ -813,7 +804,7 @@ static void cloth_apply_vgroup ( ClothModifierData *clmd, DerivedMesh *dm ) } } -static int cloth_from_object(Object *ob, ClothModifierData *clmd, DerivedMesh *dm, float framenr, int first) +static int cloth_from_object(Object *ob, ClothModifierData *clmd, DerivedMesh *dm, float UNUSED(framenr), int first) { int i = 0; MVert *mvert = NULL; @@ -826,7 +817,7 @@ static int cloth_from_object(Object *ob, ClothModifierData *clmd, DerivedMesh *d // If we have a clothObject, free it. if ( clmd->clothObject != NULL ) { - cloth_free_modifier ( ob, clmd ); + cloth_free_modifier ( clmd ); if(G.rt > 0) printf("cloth_free_modifier cloth_from_object\n"); } @@ -850,7 +841,7 @@ static int cloth_from_object(Object *ob, ClothModifierData *clmd, DerivedMesh *d if ( !dm ) return 0; - cloth_from_mesh ( ob, clmd, dm ); + cloth_from_mesh ( clmd, dm ); // create springs clmd->clothObject->springs = NULL; @@ -906,7 +897,7 @@ static int cloth_from_object(Object *ob, ClothModifierData *clmd, DerivedMesh *d if ( !cloth_build_springs ( clmd, dm ) ) { - cloth_free_modifier ( ob, clmd ); + cloth_free_modifier ( clmd ); modifier_setError ( & ( clmd->modifier ), "Can't build springs." ); printf("cloth_free_modifier cloth_build_springs\n"); return 0; @@ -940,7 +931,7 @@ static int cloth_from_object(Object *ob, ClothModifierData *clmd, DerivedMesh *d return 1; } -static void cloth_from_mesh ( Object *ob, ClothModifierData *clmd, DerivedMesh *dm ) +static void cloth_from_mesh ( ClothModifierData *clmd, DerivedMesh *dm ) { unsigned int numverts = dm->getNumVerts ( dm ); unsigned int numfaces = dm->getNumFaces ( dm ); @@ -952,7 +943,7 @@ static void cloth_from_mesh ( Object *ob, ClothModifierData *clmd, DerivedMesh * clmd->clothObject->verts = MEM_callocN ( sizeof ( ClothVertex ) * clmd->clothObject->numverts, "clothVertex" ); if ( clmd->clothObject->verts == NULL ) { - cloth_free_modifier ( ob, clmd ); + cloth_free_modifier ( clmd ); modifier_setError ( & ( clmd->modifier ), "Out of memory on allocating clmd->clothObject->verts." ); printf("cloth_free_modifier clmd->clothObject->verts\n"); return; @@ -963,7 +954,7 @@ static void cloth_from_mesh ( Object *ob, ClothModifierData *clmd, DerivedMesh * clmd->clothObject->mfaces = MEM_callocN ( sizeof ( MFace ) * clmd->clothObject->numfaces, "clothMFaces" ); if ( clmd->clothObject->mfaces == NULL ) { - cloth_free_modifier ( ob, clmd ); + cloth_free_modifier ( clmd ); modifier_setError ( & ( clmd->modifier ), "Out of memory on allocating clmd->clothObject->mfaces." ); printf("cloth_free_modifier clmd->clothObject->mfaces\n"); return; @@ -1015,7 +1006,7 @@ int cloth_add_spring ( ClothModifierData *clmd, unsigned int indexA, unsigned in return 0; } -static void cloth_free_errorsprings(Cloth *cloth, EdgeHash *edgehash, LinkNode **edgelist) +static void cloth_free_errorsprings(Cloth *cloth, EdgeHash *UNUSED(edgehash), LinkNode **edgelist) { unsigned int i = 0; diff --git a/source/blender/blenkernel/intern/collision.c b/source/blender/blenkernel/intern/collision.c index af12d23b2c2..5c9cc441b95 100644 --- a/source/blender/blenkernel/intern/collision.c +++ b/source/blender/blenkernel/intern/collision.c @@ -79,7 +79,7 @@ void collision_move_object ( CollisionModifierData *collmd, float step, float pr bvhtree_update_from_mvert ( collmd->bvhtree, collmd->mfaces, collmd->numfaces, collmd->current_x, collmd->current_xnew, collmd->numverts, 1 ); } -BVHTree *bvhtree_build_from_mvert ( MFace *mfaces, unsigned int numfaces, MVert *x, unsigned int numverts, float epsilon ) +BVHTree *bvhtree_build_from_mvert ( MFace *mfaces, unsigned int numfaces, MVert *x, unsigned int UNUSED(numverts), float epsilon ) { BVHTree *tree; float co[12]; @@ -106,7 +106,7 @@ BVHTree *bvhtree_build_from_mvert ( MFace *mfaces, unsigned int numfaces, MVert return tree; } -void bvhtree_update_from_mvert ( BVHTree * bvhtree, MFace *faces, int numfaces, MVert *x, MVert *xnew, int numverts, int moving ) +void bvhtree_update_from_mvert ( BVHTree * bvhtree, MFace *faces, int numfaces, MVert *x, MVert *xnew, int UNUSED(numverts), int moving ) { int i; MFace *mfaces = faces; diff --git a/source/blender/blenkernel/intern/colortools.c b/source/blender/blenkernel/intern/colortools.c index 90ffa39c88f..83ed65a1bf2 100644 --- a/source/blender/blenkernel/intern/colortools.c +++ b/source/blender/blenkernel/intern/colortools.c @@ -53,7 +53,7 @@ #include "IMB_imbuf_types.h" -void floatbuf_to_srgb_byte(float *rectf, unsigned char *rectc, int x1, int x2, int y1, int y2, int w) +void floatbuf_to_srgb_byte(float *rectf, unsigned char *rectc, int x1, int x2, int y1, int y2, int UNUSED(w)) { int x, y; float *rf= rectf; @@ -74,7 +74,7 @@ void floatbuf_to_srgb_byte(float *rectf, unsigned char *rectc, int x1, int x2, i } } -void floatbuf_to_byte(float *rectf, unsigned char *rectc, int x1, int x2, int y1, int y2, int w) +void floatbuf_to_byte(float *rectf, unsigned char *rectc, int x1, int x2, int y1, int y2, int UNUSED(w)) { int x, y; float *rf= rectf; @@ -356,7 +356,7 @@ void curvemap_sethandle(CurveMap *cuma, int type) /* *********************** Making the tables and display ************** */ /* reduced copy of garbled calchandleNurb() code in curve.c */ -static void calchandle_curvemap(BezTriple *bezt, BezTriple *prev, BezTriple *next, int mode) +static void calchandle_curvemap(BezTriple *bezt, BezTriple *prev, BezTriple *next, int UNUSED(mode)) { float *p1,*p2,*p3,pt[3]; float dx1,dy1, dx,dy, vx,vy, len,len1,len2; @@ -830,6 +830,10 @@ void colorcorrection_do_ibuf(ImBuf *ibuf, const char *profile) cmsCloseProfile(proofingProfile); } } +#else + /* unused */ + (void)ibuf; + (void)profile; #endif } diff --git a/source/blender/blenkernel/intern/constraint.c b/source/blender/blenkernel/intern/constraint.c index 3df395244f4..5dad01a126f 100644 --- a/source/blender/blenkernel/intern/constraint.c +++ b/source/blender/blenkernel/intern/constraint.c @@ -655,7 +655,7 @@ static bConstraintTypeInfo CTI_CONSTRNAME = { /* This function should be used for the get_target_matrix member of all * constraints that are not picky about what happens to their target matrix. */ -static void default_get_tarmat (bConstraint *con, bConstraintOb *cob, bConstraintTarget *ct, float ctime) +static void default_get_tarmat (bConstraint *con, bConstraintOb *cob, bConstraintTarget *ct, float UNUSED(ctime)) { if (VALID_CONS_TARGET(ct)) constraint_target_to_mat4(cob->scene, ct->tar, ct->subtarget, ct->matrix, CONSTRAINT_SPACE_WORLD, ct->space, con->headtail); @@ -1107,7 +1107,7 @@ static void kinematic_flush_tars (bConstraint *con, ListBase *list, short nocopy } } -static void kinematic_get_tarmat (bConstraint *con, bConstraintOb *cob, bConstraintTarget *ct, float ctime) +static void kinematic_get_tarmat (bConstraint *con, bConstraintOb *cob, bConstraintTarget *ct, float UNUSED(ctime)) { bKinematicConstraint *data= con->data; @@ -1195,7 +1195,7 @@ static void followpath_flush_tars (bConstraint *con, ListBase *list, short nocop } } -static void followpath_get_tarmat (bConstraint *con, bConstraintOb *cob, bConstraintTarget *ct, float ctime) +static void followpath_get_tarmat (bConstraint *con, bConstraintOb *cob, bConstraintTarget *ct, float UNUSED(ctime)) { bFollowPathConstraint *data= con->data; @@ -1330,7 +1330,7 @@ static bConstraintTypeInfo CTI_FOLLOWPATH = { /* --------- Limit Location --------- */ -static void loclimit_evaluate (bConstraint *con, bConstraintOb *cob, ListBase *targets) +static void loclimit_evaluate (bConstraint *con, bConstraintOb *cob, ListBase *UNUSED(targets)) { bLocLimitConstraint *data = con->data; @@ -1378,7 +1378,7 @@ static bConstraintTypeInfo CTI_LOCLIMIT = { /* -------- Limit Rotation --------- */ -static void rotlimit_evaluate (bConstraint *con, bConstraintOb *cob, ListBase *targets) +static void rotlimit_evaluate (bConstraint *con, bConstraintOb *cob, ListBase *UNUSED(targets)) { bRotLimitConstraint *data = con->data; float loc[3]; @@ -1437,7 +1437,7 @@ static bConstraintTypeInfo CTI_ROTLIMIT = { /* --------- Limit Scaling --------- */ -static void sizelimit_evaluate (bConstraint *con, bConstraintOb *cob, ListBase *targets) +static void sizelimit_evaluate (bConstraint *con, bConstraintOb *cob, ListBase *UNUSED(targets)) { bSizeLimitConstraint *data = con->data; float obsize[3], size[3]; @@ -1831,7 +1831,7 @@ static void translike_flush_tars (bConstraint *con, ListBase *list, short nocopy } } -static void translike_evaluate (bConstraint *con, bConstraintOb *cob, ListBase *targets) +static void translike_evaluate (bConstraint *UNUSED(con), bConstraintOb *cob, ListBase *targets) { bConstraintTarget *ct= targets->first; @@ -1867,7 +1867,7 @@ static void samevolume_new_data (void *cdata) data->volume = 1.0f; } -static void samevolume_evaluate (bConstraint *con, bConstraintOb *cob, ListBase *targets) +static void samevolume_evaluate (bConstraint *con, bConstraintOb *cob, ListBase *UNUSED(targets)) { bSameVolumeConstraint *data= con->data; @@ -1981,7 +1981,7 @@ static void pycon_id_looper (bConstraint *con, ConstraintIDFunc func, void *user } /* Whether this approach is maintained remains to be seen (aligorith) */ -static void pycon_get_tarmat (bConstraint *con, bConstraintOb *cob, bConstraintTarget *ct, float ctime) +static void pycon_get_tarmat (bConstraint *con, bConstraintOb *cob, bConstraintTarget *ct, float UNUSED(ctime)) { #ifndef DISABLE_PYTHON bPythonConstraint *data= con->data; @@ -2105,7 +2105,7 @@ static void actcon_flush_tars (bConstraint *con, ListBase *list, short nocopy) } } -static void actcon_get_tarmat (bConstraint *con, bConstraintOb *cob, bConstraintTarget *ct, float ctime) +static void actcon_get_tarmat (bConstraint *con, bConstraintOb *cob, bConstraintTarget *ct, float UNUSED(ctime)) { extern void chan_calc_mat(bPoseChannel *chan); bActionConstraint *data = con->data; @@ -2196,7 +2196,7 @@ static void actcon_get_tarmat (bConstraint *con, bConstraintOb *cob, bConstraint } } -static void actcon_evaluate (bConstraint *con, bConstraintOb *cob, ListBase *targets) +static void actcon_evaluate (bConstraint *UNUSED(con), bConstraintOb *cob, ListBase *targets) { bConstraintTarget *ct= targets->first; @@ -3076,7 +3076,7 @@ static void clampto_flush_tars (bConstraint *con, ListBase *list, short nocopy) } } -static void clampto_get_tarmat (bConstraint *con, bConstraintOb *cob, bConstraintTarget *ct, float ctime) +static void clampto_get_tarmat (bConstraint *UNUSED(con), bConstraintOb *cob, bConstraintTarget *ct, float UNUSED(ctime)) { if (VALID_CONS_TARGET(ct)) { Curve *cu= ct->tar->data; @@ -3410,7 +3410,7 @@ static void shrinkwrap_flush_tars (bConstraint *con, ListBase *list, short nocop } -static void shrinkwrap_get_tarmat (bConstraint *con, bConstraintOb *cob, bConstraintTarget *ct, float ctime) +static void shrinkwrap_get_tarmat (bConstraint *con, bConstraintOb *cob, bConstraintTarget *ct, float UNUSED(ctime)) { bShrinkwrapConstraint *scon = (bShrinkwrapConstraint *) con->data; @@ -3513,7 +3513,7 @@ static void shrinkwrap_get_tarmat (bConstraint *con, bConstraintOb *cob, bConstr } } -static void shrinkwrap_evaluate (bConstraint *con, bConstraintOb *cob, ListBase *targets) +static void shrinkwrap_evaluate (bConstraint *UNUSED(con), bConstraintOb *cob, ListBase *targets) { bConstraintTarget *ct= targets->first; @@ -3729,7 +3729,7 @@ static void splineik_flush_tars (bConstraint *con, ListBase *list, short nocopy) } } -static void splineik_get_tarmat (bConstraint *con, bConstraintOb *cob, bConstraintTarget *ct, float ctime) +static void splineik_get_tarmat (bConstraint *UNUSED(con), bConstraintOb *cob, bConstraintTarget *ct, float UNUSED(ctime)) { if (VALID_CONS_TARGET(ct)) { Curve *cu= ct->tar->data; @@ -4161,7 +4161,7 @@ void id_loop_constraints (ListBase *conlist, ConstraintIDFunc func, void *userda /* ......... */ /* helper for copy_constraints(), to be used for making sure that ID's are valid */ -static void con_extern_cb(bConstraint *con, ID **idpoin, void *userdata) +static void con_extern_cb(bConstraint *UNUSED(con), ID **idpoin, void *UNUSED(userData)) { if (*idpoin && (*idpoin)->lib) id_lib_extern(*idpoin); diff --git a/source/blender/blenkernel/intern/curve.c b/source/blender/blenkernel/intern/curve.c index 9578b5185af..a7dd80bff4d 100644 --- a/source/blender/blenkernel/intern/curve.c +++ b/source/blender/blenkernel/intern/curve.c @@ -2951,7 +2951,7 @@ void switchdirectionNurb(Nurb *nu) } -float (*curve_getVertexCos(Curve *cu, ListBase *lb, int *numVerts_r))[3] +float (*curve_getVertexCos(Curve *UNUSED(cu), ListBase *lb, int *numVerts_r))[3] { int i, numVerts = *numVerts_r = count_curveverts(lb); float *co, (*cos)[3] = MEM_mallocN(sizeof(*cos)*numVerts, "cu_vcos"); @@ -2979,7 +2979,7 @@ float (*curve_getVertexCos(Curve *cu, ListBase *lb, int *numVerts_r))[3] return cos; } -void curve_applyVertexCos(Curve *cu, ListBase *lb, float (*vertexCos)[3]) +void curve_applyVertexCos(Curve *UNUSED(cu), ListBase *lb, float (*vertexCos)[3]) { float *co = vertexCos[0]; Nurb *nu; @@ -3004,7 +3004,7 @@ void curve_applyVertexCos(Curve *cu, ListBase *lb, float (*vertexCos)[3]) } } -float (*curve_getKeyVertexCos(Curve *cu, ListBase *lb, float *key))[3] +float (*curve_getKeyVertexCos(Curve *UNUSED(cu), ListBase *lb, float *key))[3] { int i, numVerts = count_curveverts(lb); float *co, (*cos)[3] = MEM_mallocN(sizeof(*cos)*numVerts, "cu_vcos"); @@ -3035,7 +3035,7 @@ float (*curve_getKeyVertexCos(Curve *cu, ListBase *lb, float *key))[3] return cos; } -void curve_applyKeyVertexTilts(Curve *cu, ListBase *lb, float *key) +void curve_applyKeyVertexTilts(Curve *UNUSED(cu), ListBase *lb, float *key) { Nurb *nu; int i; diff --git a/source/blender/blenkernel/intern/customdata.c b/source/blender/blenkernel/intern/customdata.c index 1f867a615b2..9c4f0d790ca 100644 --- a/source/blender/blenkernel/intern/customdata.c +++ b/source/blender/blenkernel/intern/customdata.c @@ -48,6 +48,7 @@ #include "BKE_customdata.h" #include "BKE_customdata_file.h" #include "BKE_global.h" +#include "BKE_main.h" #include "BKE_utildefines.h" /* number of layers to add when growing a CustomData object */ @@ -145,7 +146,7 @@ static void linklist_free_simple(void *link) } static void layerInterp_mdeformvert(void **sources, float *weights, - float *sub_weights, int count, void *dest) + float *UNUSED(sub_weights), int count, void *dest) { MDeformVert *dvert = dest; LinkNode *dest_dw = NULL; /* a list of lists of MDeformWeight pointers */ @@ -203,7 +204,7 @@ static void layerInterp_mdeformvert(void **sources, float *weights, static void layerInterp_msticky(void **sources, float *weights, - float *sub_weights, int count, void *dest) + float *UNUSED(sub_weights), int count, void *dest) { float co[2], w; MSticky *mst; @@ -442,8 +443,15 @@ static void mdisps_bilinear(float out[3], float (*disps)[3], int st, float u, fl static int mdisp_corners(MDisps *s) { - /* silly trick because we don't get it from callback */ - return (s->totdisp % (3*3) == 0)? 3: 4; + int lvl= 13; + + while(lvl > 0) { + int side = (1 << (lvl-1)) + 1; + if ((s->totdisp % (side*side)) == 0) return s->totdisp / (side*side); + lvl--; + } + + return 0; } static void layerSwap_mdisps(void *data, const int *ci) @@ -452,24 +460,33 @@ static void layerSwap_mdisps(void *data, const int *ci) float (*d)[3] = NULL; int corners, cornersize, S; - /* this function is untested .. */ if(s->disps) { - corners = mdisp_corners(s); - cornersize = s->totdisp/corners; + int nverts= (ci[1] == 3) ? 4 : 3; /* silly way to know vertex count of face */ + corners= mdisp_corners(s); + cornersize= s->totdisp/corners; + + if(corners!=nverts) { + /* happens when face changed vertex count in edit mode + if it happened, just forgot displacement */ - d = MEM_callocN(sizeof(float) * 3 * s->totdisp, "mdisps swap"); + MEM_freeN(s->disps); + s->disps= NULL; + s->totdisp= 0; /* flag to update totdisp */ + return; + } + + d= MEM_callocN(sizeof(float) * 3 * s->totdisp, "mdisps swap"); for(S = 0; S < corners; S++) memcpy(d + cornersize*S, s->disps + cornersize*ci[S], cornersize*3*sizeof(float)); - if(s->disps) - MEM_freeN(s->disps); - s->disps = d; + MEM_freeN(s->disps); + s->disps= d; } } -static void layerInterp_mdisps(void **sources, float *weights, float *sub_weights, - int count, void *dest) +static void layerInterp_mdisps(void **UNUSED(sources), float *UNUSED(weights), + float *UNUSED(sub_weights), int UNUSED(count), void *dest) { MDisps *d = dest; int i; @@ -547,7 +564,7 @@ static void layerCopy_mdisps(const void *source, void *dest, int count) } } -static void layerFree_mdisps(void *data, int count, int size) +static void layerFree_mdisps(void *data, int count, int UNUSED(size)) { int i; MDisps *d = data; @@ -593,7 +610,7 @@ static int layerWrite_mdisps(CDataFile *cdf, void *data, int count) return 1; } -static size_t layerFilesize_mdisps(CDataFile *cdf, void *data, int count) +static size_t layerFilesize_mdisps(CDataFile *UNUSED(cdf), void *data, int count) { MDisps *d = data; size_t size = 0; @@ -2327,13 +2344,13 @@ int CustomData_verify_versions(struct CustomData *data, int index) static void customdata_external_filename(char filename[FILE_MAX], ID *id, CustomDataExternal *external) { - char *path = (id->lib)? id->lib->filepath: G.sce; + char *path = (id->lib)? id->lib->filepath: G.main->name; BLI_strncpy(filename, external->filename, FILE_MAX); BLI_path_abs(filename, path); } -void CustomData_external_reload(CustomData *data, ID *id, CustomDataMask mask, int totelem) +void CustomData_external_reload(CustomData *data, ID *UNUSED(id), CustomDataMask mask, int totelem) { CustomDataLayer *layer; const LayerTypeInfo *typeInfo; @@ -2503,7 +2520,7 @@ void CustomData_external_write(CustomData *data, ID *id, CustomDataMask mask, in cdf_free(cdf); } -void CustomData_external_add(CustomData *data, ID *id, int type, int totelem, const char *filename) +void CustomData_external_add(CustomData *data, ID *UNUSED(id), int type, int UNUSED(totelem), const char *filename) { CustomDataExternal *external= data->external; CustomDataLayer *layer; diff --git a/source/blender/blenkernel/intern/customdata_file.c b/source/blender/blenkernel/intern/customdata_file.c index 65a0d731beb..5954ac1b022 100644 --- a/source/blender/blenkernel/intern/customdata_file.c +++ b/source/blender/blenkernel/intern/customdata_file.c @@ -379,7 +379,7 @@ int cdf_write_open(CDataFile *cdf, char *filename) return 1; } -int cdf_write_layer(CDataFile *cdf, CDataFileLayer *blay) +int cdf_write_layer(CDataFile *UNUSED(cdf), CDataFileLayer *UNUSED(blay)) { return 1; } diff --git a/source/blender/blenkernel/intern/depsgraph.c b/source/blender/blenkernel/intern/depsgraph.c index 382c0690ae3..d95b7010993 100644 --- a/source/blender/blenkernel/intern/depsgraph.c +++ b/source/blender/blenkernel/intern/depsgraph.c @@ -846,7 +846,7 @@ DagNode * dag_get_sub_node (DagForest *forest,void * fob) return node; } -static void dag_add_parent_relation(DagForest *forest, DagNode *fob1, DagNode *fob2, short rel, char *name) +static void dag_add_parent_relation(DagForest *UNUSED(forest), DagNode *fob1, DagNode *fob2, short rel, char *name) { DagAdjList *itA = fob2->parent; @@ -2280,7 +2280,7 @@ void DAG_on_load_update(Main *bmain) } } -static void dag_id_flush_update__isDependentTexture(void *userData, Object *ob, ID **idpoin) +static void dag_id_flush_update__isDependentTexture(void *userData, Object *UNUSED(ob), ID **idpoin) { struct { ID *id; int is_dependent; } *data = userData; diff --git a/source/blender/blenkernel/intern/displist.c b/source/blender/blenkernel/intern/displist.c index d0336d9f786..d1830cb8243 100644 --- a/source/blender/blenkernel/intern/displist.c +++ b/source/blender/blenkernel/intern/displist.c @@ -289,7 +289,7 @@ static void init_fastshade_shadeinput(Render *re) shi.combinedflag= -1; } -static Render *fastshade_get_render(Scene *scene) +static Render *fastshade_get_render(Scene *UNUSED(scene)) { // XXX 2.5: this crashes combined with previewrender // due to global R so disabled for now @@ -979,7 +979,7 @@ void filldisplist(ListBase *dispbase, ListBase *to, int flipnormal) dl= dl->next; } - if(totvert && BLI_edgefill(0, 0)) { // XXX (obedit && obedit->actcol)?(obedit->actcol-1):0)) { + if(totvert && BLI_edgefill(0)) { // XXX (obedit && obedit->actcol)?(obedit->actcol-1):0)) { /* count faces */ tot= 0; @@ -1117,7 +1117,7 @@ static void bevels_to_filledpoly(Curve *cu, ListBase *dispbase) } -static void curve_to_filledpoly(Curve *cu, ListBase *nurb, ListBase *dispbase) +static void curve_to_filledpoly(Curve *cu, ListBase *UNUSED(nurb), ListBase *dispbase) { if(cu->flag & CU_3D) return; diff --git a/source/blender/blenkernel/intern/effect.c b/source/blender/blenkernel/intern/effect.c index 4860e7d8eed..70e814ef956 100644 --- a/source/blender/blenkernel/intern/effect.c +++ b/source/blender/blenkernel/intern/effect.c @@ -264,6 +264,9 @@ static void add_object_to_effectors(ListBase **effectors, Scene *scene, Effector eff = new_effector_cache(scene, ob, NULL, ob->pd); + /* make sure imat is up to date */ + invert_m4_m4(ob->imat, ob->obmat); + BLI_addtail(*effectors, eff); } static void add_particles_to_effectors(ListBase **effectors, Scene *scene, EffectorWeights *weights, Object *ob, ParticleSystem *psys, ParticleSystem *psys_src) @@ -410,7 +413,7 @@ void pd_point_from_soft(Scene *scene, float *loc, float *vel, int index, Effecte /************************************************/ // triangle - ray callback function -static void eff_tri_ray_hit(void *userdata, int index, const BVHTreeRay *ray, BVHTreeRayHit *hit) +static void eff_tri_ray_hit(void *UNUSED(userData), int UNUSED(index), const BVHTreeRay *UNUSED(ray), BVHTreeRayHit *hit) { // whenever we hit a bounding box, we don't check further hit->dist = -1; @@ -515,7 +518,7 @@ static float falloff_func_rad(PartDeflect *pd, float fac) return falloff_func(fac, pd->flag&PFIELD_USEMINR, pd->minrad, pd->flag&PFIELD_USEMAXR, pd->maxrad, pd->f_power_r); } -float effector_falloff(EffectorCache *eff, EffectorData *efd, EffectedPoint *point, EffectorWeights *weights) +float effector_falloff(EffectorCache *eff, EffectorData *efd, EffectedPoint *UNUSED(point), EffectorWeights *weights) { float temp[3]; float falloff = weights ? weights->weight[0] * weights->weight[eff->pd->forcefield] : 1.0f; @@ -774,7 +777,7 @@ static void do_texture_effector(EffectorCache *eff, EffectorData *efd, EffectedP } if(eff->pd->flag & PFIELD_TEX_OBJECT) { - mul_m4_v3(eff->ob->obmat, tex_co); + mul_m4_v3(eff->ob->imat, tex_co); } hasrgb = multitex_ext(eff->pd->tex, tex_co, NULL,NULL, 0, result); diff --git a/source/blender/blenkernel/intern/exotic.c b/source/blender/blenkernel/intern/exotic.c index 9dac409226b..c5431005b18 100644 --- a/source/blender/blenkernel/intern/exotic.c +++ b/source/blender/blenkernel/intern/exotic.c @@ -557,7 +557,7 @@ static int write_derivedmesh_stl(FILE *fpSTL, Object *ob, DerivedMesh *dm) return numfacets; } -static int write_object_stl(FILE *fpSTL, Scene *scene, Object *ob, Mesh *me) +static int write_object_stl(FILE *fpSTL, Scene *scene, Object *ob) { int numfacets = 0; DerivedMesh *dm = mesh_get_derived_final(scene, ob, CD_MASK_BAREMESH); @@ -572,7 +572,6 @@ static int write_object_stl(FILE *fpSTL, Scene *scene, Object *ob, Mesh *me) void write_stl(Scene *scene, char *str) { Object *ob; - Mesh *me; Base *base; FILE *fpSTL; int numfacets = 0; @@ -605,9 +604,8 @@ void write_stl(Scene *scene, char *str) if (base->flag & SELECT) { ob = base->object; if (ob->type == OB_MESH) { - me = ob->data; - if (me) - numfacets += write_object_stl(fpSTL, scene, ob, me); + if(ob->data) + numfacets += write_object_stl(fpSTL, scene, ob); } } base= base->next; @@ -978,7 +976,7 @@ static int all_digits(char *str) return 1; } -static int dxf_get_layer_col(char *layer) +static int dxf_get_layer_col(char *UNUSED(layer)) { return 1; } @@ -1016,8 +1014,8 @@ static void myfgets(char *str, int len, FILE *fp) /* three types of enters, \n \r and \r\n */ if(c == '\n') break; if(c=='\r') { - c= getc(dxf_fp); // read the linefeed from stream - if(c != 10) ungetc(c, dxf_fp); // put back, if it's not one... + c= getc(fp); // read the linefeed from stream + if(c != 10) ungetc(c, fp); // put back, if it's not one... break; } } diff --git a/source/blender/blenkernel/intern/fcurve.c b/source/blender/blenkernel/intern/fcurve.c index 43f01199b69..1575f69209f 100644 --- a/source/blender/blenkernel/intern/fcurve.c +++ b/source/blender/blenkernel/intern/fcurve.c @@ -556,7 +556,7 @@ void bezt_add_to_cfra_elem (ListBase *lb, BezTriple *bezt) /* Basic sampling callback which acts as a wrapper for evaluate_fcurve() * 'data' arg here is unneeded here... */ -float fcurve_samplingcb_evalcurve (FCurve *fcu, void *data, float evaltime) +float fcurve_samplingcb_evalcurve (FCurve *fcu, void *UNUSED(data), float evaltime) { /* assume any interference from drivers on the curve is intended... */ return evaluate_fcurve(fcu, evaltime); @@ -1331,7 +1331,7 @@ float driver_get_variable_value (ChannelDriver *driver, DriverVar *dvar) * - "evaltime" is the frame at which F-Curve is being evaluated * - has to return a float value */ -static float evaluate_driver (ChannelDriver *driver, float evaltime) +static float evaluate_driver (ChannelDriver *driver, float UNUSED(evaltime)) { DriverVar *dvar; diff --git a/source/blender/blenkernel/intern/fmodifier.c b/source/blender/blenkernel/intern/fmodifier.c index 5a10f93ac72..6660442b14a 100644 --- a/source/blender/blenkernel/intern/fmodifier.c +++ b/source/blender/blenkernel/intern/fmodifier.c @@ -190,7 +190,7 @@ static void fcm_generator_verify (FModifier *fcm) } } -static void fcm_generator_evaluate (FCurve *fcu, FModifier *fcm, float *cvalue, float evaltime) +static void fcm_generator_evaluate (FCurve *UNUSED(fcu), FModifier *fcm, float *cvalue, float evaltime) { FMod_Generator *data= (FMod_Generator *)fcm->data; @@ -303,7 +303,7 @@ static double sinc (double x) return sin(M_PI * x) / (M_PI * x); } -static void fcm_fn_generator_evaluate (FCurve *fcu, FModifier *fcm, float *cvalue, float evaltime) +static void fcm_fn_generator_evaluate (FCurve *UNUSED(fcu), FModifier *fcm, float *cvalue, float evaltime) { FMod_FunctionGenerator *data= (FMod_FunctionGenerator *)fcm->data; double arg= data->phase_multiplier*evaltime + data->phase_offset; @@ -432,7 +432,7 @@ static void fcm_envelope_verify (FModifier *fcm) } } -static void fcm_envelope_evaluate (FCurve *fcu, FModifier *fcm, float *cvalue, float evaltime) +static void fcm_envelope_evaluate (FCurve *UNUSED(fcu), FModifier *fcm, float *cvalue, float evaltime) { FMod_Envelope *env= (FMod_Envelope *)fcm->data; FCM_EnvelopeData *fed, *prevfed, *lastfed; @@ -524,7 +524,7 @@ static void fcm_cycles_new_data (void *mdata) data->before_mode= data->after_mode= FCM_EXTRAPOLATE_CYCLIC; } -static float fcm_cycles_time (FCurve *fcu, FModifier *fcm, float cvalue, float evaltime) +static float fcm_cycles_time (FCurve *fcu, FModifier *fcm, float UNUSED(cvalue), float evaltime) { FMod_Cycles *data= (FMod_Cycles *)fcm->data; float prevkey[2], lastkey[2], cycyofs=0.0f; @@ -664,7 +664,7 @@ static float fcm_cycles_time (FCurve *fcu, FModifier *fcm, float cvalue, float e return evaltime; } -static void fcm_cycles_evaluate (FCurve *fcu, FModifier *fcm, float *cvalue, float evaltime) +static void fcm_cycles_evaluate (FCurve *UNUSED(fcu), FModifier *fcm, float *cvalue, float UNUSED(evaltime)) { tFCMED_Cycles *edata= (tFCMED_Cycles *)fcm->edata; @@ -708,7 +708,7 @@ static void fcm_noise_new_data (void *mdata) data->modification = FCM_NOISE_MODIF_REPLACE; } -static void fcm_noise_evaluate (FCurve *fcu, FModifier *fcm, float *cvalue, float evaltime) +static void fcm_noise_evaluate (FCurve *UNUSED(fcu), FModifier *fcm, float *cvalue, float evaltime) { FMod_Noise *data= (FMod_Noise *)fcm->data; float noise; @@ -800,7 +800,7 @@ static void fcm_python_copy (FModifier *fcm, FModifier *src) pymod->prop = IDP_CopyProperty(opymod->prop); } -static void fcm_python_evaluate (FCurve *fcu, FModifier *fcm, float *cvalue, float evaltime) +static void fcm_python_evaluate (FCurve *UNUSED(fcu), FModifier *UNUSED(fcm), float *UNUSED(cvalue), float UNUSED(evaltime)) { #ifndef DISABLE_PYTHON //FMod_Python *data= (FMod_Python *)fcm->data; @@ -829,7 +829,7 @@ static FModifierTypeInfo FMI_PYTHON = { /* Limits F-Curve Modifier --------------------------- */ -static float fcm_limits_time (FCurve *fcu, FModifier *fcm, float cvalue, float evaltime) +static float fcm_limits_time (FCurve *UNUSED(fcu), FModifier *fcm, float UNUSED(cvalue), float evaltime) { FMod_Limits *data= (FMod_Limits *)fcm->data; @@ -843,7 +843,7 @@ static float fcm_limits_time (FCurve *fcu, FModifier *fcm, float cvalue, float e return evaltime; } -static void fcm_limits_evaluate (FCurve *fcu, FModifier *fcm, float *cvalue, float evaltime) +static void fcm_limits_evaluate (FCurve *UNUSED(fcu), FModifier *fcm, float *cvalue, float UNUSED(evaltime)) { FMod_Limits *data= (FMod_Limits *)fcm->data; @@ -880,7 +880,7 @@ static void fcm_stepped_new_data (void *mdata) data->step_size = 2.0f; } -static float fcm_stepped_time (FCurve *fcu, FModifier *fcm, float cvalue, float evaltime) +static float fcm_stepped_time (FCurve *UNUSED(fcu), FModifier *fcm, float UNUSED(cvalue), float evaltime) { FMod_Stepped *data= (FMod_Stepped *)fcm->data; int snapblock; diff --git a/source/blender/blenkernel/intern/group.c b/source/blender/blenkernel/intern/group.c index bdf203119c3..5a031d62fcb 100644 --- a/source/blender/blenkernel/intern/group.c +++ b/source/blender/blenkernel/intern/group.c @@ -42,6 +42,7 @@ #include "BLI_blenlib.h" +#include "BKE_utildefines.h" #include "BKE_global.h" #include "BKE_group.h" #include "BKE_library.h" @@ -327,7 +328,7 @@ static void group_replaces_nla(Object *parent, Object *target, char mode) you can draw everything, leaves tags in objects to signal it needs further updating */ /* note: does not work for derivedmesh and render... it recreates all again in convertblender.c */ -void group_handle_recalc_and_update(Scene *scene, Object *parent, Group *group) +void group_handle_recalc_and_update(Scene *scene, Object *UNUSED(parent), Group *group) { GroupObject *go; diff --git a/source/blender/blenkernel/intern/image.c b/source/blender/blenkernel/intern/image.c index 6dd1d4280ec..09622b2acfe 100644 --- a/source/blender/blenkernel/intern/image.c +++ b/source/blender/blenkernel/intern/image.c @@ -103,8 +103,8 @@ static void de_interlace_ng(struct ImBuf *ibuf) /* neogeo fields */ if (ibuf->rect) { /* make copies */ - tbuf1 = IMB_allocImBuf(ibuf->x, (short)(ibuf->y >> 1), (unsigned char)32, (int)IB_rect, (unsigned char)0); - tbuf2 = IMB_allocImBuf(ibuf->x, (short)(ibuf->y >> 1), (unsigned char)32, (int)IB_rect, (unsigned char)0); + tbuf1 = IMB_allocImBuf(ibuf->x, (short)(ibuf->y >> 1), (unsigned char)32, (int)IB_rect); + tbuf2 = IMB_allocImBuf(ibuf->x, (short)(ibuf->y >> 1), (unsigned char)32, (int)IB_rect); ibuf->x *= 2; @@ -131,8 +131,8 @@ static void de_interlace_st(struct ImBuf *ibuf) /* standard fields */ if (ibuf->rect) { /* make copies */ - tbuf1 = IMB_allocImBuf(ibuf->x, (short)(ibuf->y >> 1), (unsigned char)32, IB_rect, 0); - tbuf2 = IMB_allocImBuf(ibuf->x, (short)(ibuf->y >> 1), (unsigned char)32, IB_rect, 0); + tbuf1 = IMB_allocImBuf(ibuf->x, (short)(ibuf->y >> 1), (unsigned char)32, IB_rect); + tbuf2 = IMB_allocImBuf(ibuf->x, (short)(ibuf->y >> 1), (unsigned char)32, IB_rect); ibuf->x *= 2; @@ -330,7 +330,7 @@ void BKE_image_merge(Image *dest, Image *source) /* otherwise creates new. */ /* does not load ibuf itself */ /* pass on optional frame for #name images */ -Image *BKE_add_image_file(const char *name, int frame) +Image *BKE_add_image_file(const char *name) { Image *ima; int file, len; @@ -338,7 +338,7 @@ Image *BKE_add_image_file(const char *name, int frame) char str[FILE_MAX], strtest[FILE_MAX]; BLI_strncpy(str, name, sizeof(str)); - BLI_path_abs(str, G.sce); + BLI_path_abs(str, G.main->name); /* exists? */ file= open(str, O_BINARY|O_RDONLY); @@ -349,7 +349,7 @@ Image *BKE_add_image_file(const char *name, int frame) for(ima= G.main->image.first; ima; ima= ima->id.next) { if(ima->source!=IMA_SRC_VIEWER && ima->source!=IMA_SRC_GENERATED) { BLI_strncpy(strtest, ima->name, sizeof(ima->name)); - BLI_path_abs(strtest, G.sce); + BLI_path_abs(strtest, G.main->name); if( strcmp(strtest, str)==0 ) { if(ima->anim==NULL || ima->id.us==0) { @@ -389,15 +389,15 @@ static ImBuf *add_ibuf_size(unsigned int width, unsigned int height, char *name, float *rect_float= NULL; if (floatbuf) { - ibuf= IMB_allocImBuf(width, height, depth, IB_rectfloat, 0); + ibuf= IMB_allocImBuf(width, height, depth, IB_rectfloat); rect_float= (float*)ibuf->rect_float; } else { - ibuf= IMB_allocImBuf(width, height, depth, IB_rect, 0); + ibuf= IMB_allocImBuf(width, height, depth, IB_rect); rect= (unsigned char*)ibuf->rect; } - strcpy(ibuf->name, "//Untitled"); + BLI_strncpy(ibuf->name, name, sizeof(ibuf->name)); ibuf->userflags |= IB_BITMAPDIRTY; switch(uvtestgrid) { @@ -861,8 +861,8 @@ static void stampdata(Scene *scene, StampData *stamp_data, int do_prefix) if (scene->r.stamp & R_STAMP_FILENAME) { if (G.relbase_valid) { - if (do_prefix) sprintf(stamp_data->file, "File %s", G.sce); - else sprintf(stamp_data->file, "%s", G.sce); + 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>"); @@ -1161,7 +1161,7 @@ void BKE_stamp_buf(Scene *scene, unsigned char *rect, float *rectf, int width, i } if (stamp_data.strip[0]) { - BLF_width_and_height(mono, stamp_data.scene, &w, &h); h= h_fixed; + BLF_width_and_height(mono, stamp_data.strip, &w, &h); h= h_fixed; /* Top right corner, with an extra space because blenfont is too strict! */ x= width - w - pad; @@ -1202,7 +1202,8 @@ void BKE_stamp_info(Scene *scene, struct ImBuf *ibuf) int BKE_write_ibuf(Scene *scene, ImBuf *ibuf, char *name, int imtype, int subimtype, int quality) { int ok; - + (void)subimtype; /* quies unused warnings */ + if(imtype==0) { /* pass */ } @@ -1310,7 +1311,7 @@ void BKE_makepicstring(char *string, char *base, int frame, int imtype, int use_ { if (string==NULL) return; BLI_strncpy(string, base, FILE_MAX - 10); /* weak assumption */ - BLI_path_abs(string, G.sce); + BLI_path_abs(string, G.main->name); BLI_path_frame(string, frame, 4); if(use_ext) @@ -1608,7 +1609,7 @@ static ImBuf *image_load_sequence_file(Image *ima, ImageUser *iuser, int frame) if(ima->id.lib) BLI_path_abs(name, ima->id.lib->filepath); else - BLI_path_abs(name, G.sce); + BLI_path_abs(name, G.main->name); flag= IB_rect|IB_multilayer; if(ima->flag & IMA_DO_PREMUL) @@ -1680,11 +1681,12 @@ static ImBuf *image_load_sequence_multilayer(Image *ima, ImageUser *iuser, int f if(rpass) { // printf("load from pass %s\n", rpass->name); /* since we free render results, we copy the rect */ - ibuf= IMB_allocImBuf(ima->rr->rectx, ima->rr->recty, 32, 0, 0); + ibuf= IMB_allocImBuf(ima->rr->rectx, ima->rr->recty, 32, 0); ibuf->rect_float= MEM_dupallocN(rpass->rect); ibuf->flags |= IB_rectfloat; ibuf->mall= IB_rectfloat; ibuf->channels= rpass->channels; + ibuf->profile = IB_PROFILE_LINEAR_RGB; image_initialize_after_load(ima, ibuf); image_assign_ibuf(ima, ibuf, iuser?iuser->multi_index:0, frame); @@ -1715,7 +1717,7 @@ static ImBuf *image_load_movie_file(Image *ima, ImageUser *iuser, int frame) if(ima->id.lib) BLI_path_abs(str, ima->id.lib->filepath); else - BLI_path_abs(str, G.sce); + BLI_path_abs(str, G.main->name); ima->anim = openanim(str, IB_rect); @@ -1776,7 +1778,7 @@ static ImBuf *image_load_image_file(Image *ima, ImageUser *iuser, int cfra) if(ima->id.lib) BLI_path_abs(str, ima->id.lib->filepath); else - BLI_path_abs(str, G.sce); + BLI_path_abs(str, G.main->name); /* read ibuf */ ibuf = IMB_loadiffname(str, flag); @@ -1829,7 +1831,7 @@ static ImBuf *image_get_ibuf_multilayer(Image *ima, ImageUser *iuser) RenderPass *rpass= BKE_image_multilayer_index(ima->rr, iuser); if(rpass) { - ibuf= IMB_allocImBuf(ima->rr->rectx, ima->rr->recty, 32, 0, 0); + ibuf= IMB_allocImBuf(ima->rr->rectx, ima->rr->recty, 32, 0); image_initialize_after_load(ima, ibuf); @@ -1936,7 +1938,7 @@ static ImBuf *image_get_render_result(Image *ima, ImageUser *iuser, void **lock_ /* make ibuf if needed, and initialize it */ if(ibuf==NULL) { - ibuf= IMB_allocImBuf(rres.rectx, rres.recty, 32, 0, 0); + ibuf= IMB_allocImBuf(rres.rectx, rres.recty, 32, 0); image_assign_ibuf(ima, ibuf, IMA_NO_INDEX, 0); } @@ -2146,7 +2148,7 @@ ImBuf *BKE_image_acquire_ibuf(Image *ima, ImageUser *iuser, void **lock_r) if(!ibuf) { /* Composite Viewer, all handled in compositor */ /* fake ibuf, will be filled in compositor */ - ibuf= IMB_allocImBuf(256, 256, 32, IB_rect, 0); + ibuf= IMB_allocImBuf(256, 256, 32, IB_rect); image_assign_ibuf(ima, ibuf, 0, frame); } } diff --git a/source/blender/blenkernel/intern/implicit.c b/source/blender/blenkernel/intern/implicit.c index 158f964a846..e0077ec7d26 100644 --- a/source/blender/blenkernel/intern/implicit.c +++ b/source/blender/blenkernel/intern/implicit.c @@ -726,7 +726,7 @@ typedef struct Implicit_Data fmatrix3x3 *A, *dFdV, *dFdX, *S, *P, *Pinv, *bigI, *M; } Implicit_Data; -int implicit_init (Object *ob, ClothModifierData *clmd) +int implicit_init (Object *UNUSED(ob), ClothModifierData *clmd) { unsigned int i = 0; unsigned int pinned = 0; @@ -1218,7 +1218,7 @@ DO_INLINE void dfdx_damp(float to[3][3], float dir[3],float length,const float } -DO_INLINE void cloth_calc_spring_force(ClothModifierData *clmd, ClothSpring *s, lfVector *lF, lfVector *X, lfVector *V, fmatrix3x3 *dFdV, fmatrix3x3 *dFdX, float time) +DO_INLINE void cloth_calc_spring_force(ClothModifierData *clmd, ClothSpring *s, lfVector *UNUSED(lF), lfVector *X, lfVector *V, fmatrix3x3 *UNUSED(dFdV), fmatrix3x3 *UNUSED(dFdX), float time) { Cloth *cloth = clmd->clothObject; ClothVertex *verts = cloth->verts; @@ -1353,7 +1353,7 @@ DO_INLINE void cloth_calc_spring_force(ClothModifierData *clmd, ClothSpring *s, } } -DO_INLINE void cloth_apply_spring_force(ClothModifierData *clmd, ClothSpring *s, lfVector *lF, lfVector *X, lfVector *V, fmatrix3x3 *dFdV, fmatrix3x3 *dFdX) +DO_INLINE void cloth_apply_spring_force(ClothModifierData *UNUSED(clmd), ClothSpring *s, lfVector *lF, lfVector *UNUSED(X), lfVector *UNUSED(V), fmatrix3x3 *dFdV, fmatrix3x3 *dFdX) { if(s->flags & CLOTH_SPRING_FLAG_NEEDED) { @@ -1555,7 +1555,7 @@ static void hair_velocity_smoothing(ClothModifierData *clmd, lfVector *lF, lfVec free_collider_cache(&colliders); } -static void cloth_calc_force(ClothModifierData *clmd, float frame, lfVector *lF, lfVector *lX, lfVector *lV, fmatrix3x3 *dFdV, fmatrix3x3 *dFdX, ListBase *effectors, float time, fmatrix3x3 *M) +static void cloth_calc_force(ClothModifierData *clmd, float UNUSED(frame), lfVector *lF, lfVector *lX, lfVector *lV, fmatrix3x3 *dFdV, fmatrix3x3 *dFdX, ListBase *effectors, float time, fmatrix3x3 *M) { /* Collect forces and derivatives: F,dFdX,dFdV */ Cloth *cloth = clmd->clothObject; @@ -1708,7 +1708,7 @@ static void cloth_calc_force(ClothModifierData *clmd, float frame, lfVector *lF, // printf("\n"); } -static void simulate_implicit_euler(lfVector *Vnew, lfVector *lX, lfVector *lV, lfVector *lF, fmatrix3x3 *dFdV, fmatrix3x3 *dFdX, float dt, fmatrix3x3 *A, lfVector *B, lfVector *dV, fmatrix3x3 *S, lfVector *z, lfVector *olddV, fmatrix3x3 *P, fmatrix3x3 *Pinv, fmatrix3x3 *M, fmatrix3x3 *bigI) +static void simulate_implicit_euler(lfVector *Vnew, lfVector *UNUSED(lX), lfVector *lV, lfVector *lF, fmatrix3x3 *dFdV, fmatrix3x3 *dFdX, float dt, fmatrix3x3 *A, lfVector *B, lfVector *dV, fmatrix3x3 *S, lfVector *z, lfVector *olddV, fmatrix3x3 *UNUSED(P), fmatrix3x3 *UNUSED(Pinv), fmatrix3x3 *M, fmatrix3x3 *UNUSED(bigI)) { unsigned int numverts = dFdV[0].vcount; diff --git a/source/blender/blenkernel/intern/ipo.c b/source/blender/blenkernel/intern/ipo.c index 5c0c0fbf0c1..846592f0f2f 100644 --- a/source/blender/blenkernel/intern/ipo.c +++ b/source/blender/blenkernel/intern/ipo.c @@ -317,7 +317,7 @@ static char *constraint_adrcodes_to_paths (int adrcode, int *array_index) * NOTE: as we don't have access to the keyblock where the data comes from (for now), * we'll just use numerical indicies for now... */ -static char *shapekey_adrcodes_to_paths (int adrcode, int *array_index) +static char *shapekey_adrcodes_to_paths (int adrcode, int *UNUSED(array_index)) { static char buf[128]; @@ -331,7 +331,7 @@ static char *shapekey_adrcodes_to_paths (int adrcode, int *array_index) } /* MTex (Texture Slot) types */ -static char *mtex_adrcodes_to_paths (int adrcode, int *array_index) +static char *mtex_adrcodes_to_paths (int adrcode, int *UNUSED(array_index)) { char *base=NULL, *prop=NULL; static char buf[128]; diff --git a/source/blender/blenkernel/intern/key.c b/source/blender/blenkernel/intern/key.c index 708403ab1f7..aa9d0b4f57c 100644 --- a/source/blender/blenkernel/intern/key.c +++ b/source/blender/blenkernel/intern/key.c @@ -1163,7 +1163,7 @@ static void do_cu_key(Curve *cu, Key *key, KeyBlock *actkb, KeyBlock **k, float } } -static void do_rel_cu_key(Curve *cu, Key *key, KeyBlock *actkb, float ctime, char *out, int tot) +static void do_rel_cu_key(Curve *cu, Key *key, KeyBlock *actkb, float UNUSED(ctime), char *out, int tot) { Nurb *nu; int a, step; @@ -1657,7 +1657,7 @@ void curve_to_key(Curve *cu, KeyBlock *kb, ListBase *nurb) } } -void key_to_curve(KeyBlock *kb, Curve *cu, ListBase *nurb) +void key_to_curve(KeyBlock *kb, Curve *UNUSED(cu), ListBase *nurb) { Nurb *nu; BezTriple *bezt; diff --git a/source/blender/blenkernel/intern/library.c b/source/blender/blenkernel/intern/library.c index 5bf41c00bc3..b18c2da8437 100644 --- a/source/blender/blenkernel/intern/library.c +++ b/source/blender/blenkernel/intern/library.c @@ -71,6 +71,7 @@ #include "BLI_blenlib.h" #include "BLI_dynstr.h" +#include "BKE_utildefines.h" #include "BKE_animsys.h" #include "BKE_context.h" #include "BKE_library.h" @@ -341,7 +342,7 @@ int id_unlink(ID *id, int test) break; case ID_OB: if(test) return 1; - unlink_object(NULL, (Object*)id); + unlink_object((Object*)id); break; } @@ -679,7 +680,7 @@ void *copy_libblock(void *rt) return idn; } -static void free_library(Library *lib) +static void free_library(Library *UNUSED(lib)) { /* no freeing needed for libraries yet */ } @@ -691,7 +692,7 @@ void set_free_windowmanager_cb(void (*func)(bContext *C, wmWindowManager *) ) free_windowmanager_cb= func; } -void animdata_dtar_clear_cb(ID *id, AnimData *adt, void *userdata) +void animdata_dtar_clear_cb(ID *UNUSED(id), AnimData *adt, void *userdata) { ChannelDriver *driver; FCurve *fcu; @@ -835,7 +836,7 @@ void free_libblock_us(ListBase *lb, void *idv) /* test users */ else printf("ERROR block %s users %d\n", id->name, id->us); } if(id->us==0) { - if( GS(id->name)==ID_OB ) unlink_object(NULL, (Object *)id); + if( GS(id->name)==ID_OB ) unlink_object((Object *)id); free_libblock(lb, id); } @@ -1247,7 +1248,7 @@ static void image_fix_relative_path(Image *ima) if(ima->id.lib==NULL) return; if(strncmp(ima->name, "//", 2)==0) { BLI_path_abs(ima->name, ima->id.lib->filepath); - BLI_path_rel(ima->name, G.sce); + BLI_path_rel(ima->name, G.main->name); } } diff --git a/source/blender/blenkernel/intern/mesh.c b/source/blender/blenkernel/intern/mesh.c index 6f1cdefbcad..faefbdacb45 100644 --- a/source/blender/blenkernel/intern/mesh.c +++ b/source/blender/blenkernel/intern/mesh.c @@ -71,7 +71,7 @@ EditMesh *BKE_mesh_get_editmesh(Mesh *me) return me->edit_mesh; } -void BKE_mesh_end_editmesh(Mesh *me, EditMesh *em) +void BKE_mesh_end_editmesh(Mesh *UNUSED(me), EditMesh *UNUSED(em)) { } @@ -561,7 +561,7 @@ static void mfaces_strip_loose(MFace *mface, int *totface) } /* Create edges based on known verts and faces */ -static void make_edges_mdata(MVert *allvert, MFace *allface, int totvert, int totface, +static void make_edges_mdata(MVert *UNUSED(allvert), MFace *allface, int UNUSED(totvert), int totface, int old, MEdge **alledge, int *_totedge) { MFace *mface; @@ -1221,7 +1221,7 @@ void mesh_set_smooth_flag(Object *meshOb, int enableSmooth) void mesh_calc_normals(MVert *mverts, int numVerts, MFace *mfaces, int numFaces, float **faceNors_r) { float (*tnorms)[3]= MEM_callocN(numVerts*sizeof(*tnorms), "tnorms"); - float *fnors= MEM_mallocN(sizeof(*fnors)*3*numFaces, "meshnormals"); + float *fnors= MEM_callocN(sizeof(*fnors)*3*numFaces, "meshnormals"); int i; for (i=0; i<numFaces; i++) { @@ -1441,7 +1441,7 @@ void mesh_pmv_free(PartialVisibility *pv) MEM_freeN(pv); } -void mesh_pmv_revert(Object *ob, Mesh *me) +void mesh_pmv_revert(Mesh *me) { if(me->pv) { unsigned i; @@ -1480,10 +1480,10 @@ void mesh_pmv_revert(Object *ob, Mesh *me) } } -void mesh_pmv_off(Object *ob, Mesh *me) +void mesh_pmv_off(Mesh *me) { - if(ob && me->pv) { - mesh_pmv_revert(ob, me); + if(me->pv) { + mesh_pmv_revert(me); MEM_freeN(me->pv); me->pv= NULL; } diff --git a/source/blender/blenkernel/intern/modifier.c b/source/blender/blenkernel/intern/modifier.c index d7c95a007e5..dc2992662c9 100644 --- a/source/blender/blenkernel/intern/modifier.c +++ b/source/blender/blenkernel/intern/modifier.c @@ -59,7 +59,7 @@ ModifierTypeInfo *modifierType_getInfo(ModifierType type) static int types_init = 1; if (types_init) { - modifier_type_init(types, type); /* MOD_utils.c */ + modifier_type_init(types); /* MOD_utils.c */ types_init= 0; } @@ -492,7 +492,7 @@ int modifier_isCorrectableDeformed(ModifierData *md) return 0; } -int modifiers_isCorrectableDeformed(struct Scene *scene, Object *ob) +int modifiers_isCorrectableDeformed(Object *ob) { ModifierData *md = modifiers_getVirtualModifierList(ob); diff --git a/source/blender/blenkernel/intern/multires.c b/source/blender/blenkernel/intern/multires.c index 57f568e6094..b0ab947d478 100644 --- a/source/blender/blenkernel/intern/multires.c +++ b/source/blender/blenkernel/intern/multires.c @@ -456,7 +456,7 @@ static DerivedMesh *multires_dm_create_local(Object *ob, DerivedMesh *dm, int lv return multires_dm_create_from_derived(&mmd, 1, dm, ob, 0, 0); } -static DerivedMesh *subsurf_dm_create_local(Object *ob, DerivedMesh *dm, int lvl, int simple, int optimal) +static DerivedMesh *subsurf_dm_create_local(Object *UNUSED(ob), DerivedMesh *dm, int lvl, int simple, int optimal) { SubsurfModifierData smd; @@ -780,7 +780,7 @@ void multires_stitch_grids(Object *ob) } DerivedMesh *multires_dm_create_from_derived(MultiresModifierData *mmd, int local_mmd, DerivedMesh *dm, Object *ob, - int useRenderParams, int isFinalCalc) + int useRenderParams, int UNUSED(isFinalCalc)) { Mesh *me= ob->data; DerivedMesh *result; @@ -874,7 +874,7 @@ static void old_mdisps_bilinear(float out[3], float (*disps)[3], int st, float u add_v3_v3v3(out, d2[0], d2[1]); } -static void old_mdisps_rotate(int S, int newside, int oldside, int x, int y, float *u, float *v) +static void old_mdisps_rotate(int S, int UNUSED(newside), int oldside, int x, int y, float *u, float *v) { float offset = oldside*0.5f - 0.5f; diff --git a/source/blender/blenkernel/intern/nla.c b/source/blender/blenkernel/intern/nla.c index b053d615756..67c3e746a63 100644 --- a/source/blender/blenkernel/intern/nla.c +++ b/source/blender/blenkernel/intern/nla.c @@ -1585,7 +1585,7 @@ void BKE_nla_tweakmode_exit (AnimData *adt) /* Baking Tools ------------------------------------------- */ -void BKE_nla_bake (Scene *scene, ID *id, AnimData *adt, int flag) +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/object.c b/source/blender/blenkernel/intern/object.c index 0c437db335b..5237335e8ca 100644 --- a/source/blender/blenkernel/intern/object.c +++ b/source/blender/blenkernel/intern/object.c @@ -320,7 +320,7 @@ static void unlink_object__unlinkModifierLinks(void *userData, Object *ob, Objec } } -void unlink_object(Scene *scene, Object *ob) +void unlink_object(Object *ob) { Main *bmain= G.main; Object *obt; @@ -1264,6 +1264,17 @@ static void copy_object_pose(Object *obn, Object *ob) } } +static void copy_object_transform(Object *ob_tar, Object *ob_src) +{ + copy_v3_v3(ob_tar->loc, ob_src->loc); + copy_v3_v3(ob_tar->rot, ob_src->rot); + copy_v3_v3(ob_tar->quat, ob_src->quat); + copy_v3_v3(ob_tar->rotAxis, ob_src->rotAxis); + ob_tar->rotAngle= ob_src->rotAngle; + ob_tar->rotmode= ob_src->rotmode; + copy_v3_v3(ob_tar->size, ob_src->size); +} + Object *copy_object(Object *ob) { Object *obn; @@ -1530,23 +1541,23 @@ void object_make_proxy(Object *ob, Object *target, Object *gob) ob->recalc= target->recalc= OB_RECALC_ALL; - /* copy transform */ + /* copy transform + * - gob means this proxy comes from a group, just apply the matrix + * so the object wont move from its dupli-transform. + * + * - no gob means this is being made from a linked object, + * this is closer to making a copy of the object - in-place. */ if(gob) { - VECCOPY(ob->loc, gob->loc); - VECCOPY(ob->rot, gob->rot); - VECCOPY(ob->size, gob->size); - - group_tag_recalc(gob->dup_group); + ob->rotmode= target->rotmode; + mul_m4_m4m4(ob->obmat, target->obmat, gob->obmat); + object_apply_mat4(ob, ob->obmat); } else { - VECCOPY(ob->loc, target->loc); - VECCOPY(ob->rot, target->rot); - VECCOPY(ob->size, target->size); + copy_object_transform(ob, target); + ob->parent= target->parent; /* libdata */ + copy_m4_m4(ob->parentinv, target->parentinv); } - ob->parent= target->parent; /* libdata */ - copy_m4_m4(ob->parentinv, target->parentinv); - /* copy animdata stuff - drivers only for now... */ object_copy_proxy_drivers(ob, target); @@ -1606,7 +1617,7 @@ void disable_speed_curve(int val) // XXX THIS CRUFT NEEDS SERIOUS RECODING ASAP! /* ob can be NULL */ -float bsystem_time(struct Scene *scene, Object *ob, float cfra, float ofs) +float bsystem_time(struct Scene *scene, Object *UNUSED(ob), float cfra, float ofs) { /* returns float ( see BKE_curframe in scene.c) */ cfra += scene->r.subframe; @@ -1635,7 +1646,7 @@ void object_scale_to_mat3(Object *ob, float mat[][3]) size_to_mat3( mat,vec); } -// TODO: this should take rotation orders into account later... + void object_rot_to_mat3(Object *ob, float mat[][3]) { float rmat[3][3], dmat[3][3]; @@ -1664,7 +1675,6 @@ void object_rot_to_mat3(Object *ob, float mat[][3]) } /* combine these rotations */ - // XXX is this correct? if errors, change the order of multiplication... mul_m3_m3m3(mat, dmat, rmat); } @@ -1688,29 +1698,28 @@ void object_mat3_to_rot(Object *ob, float mat[][3], int use_compat) /* see pchan_apply_mat4() for the equivalent 'pchan' function */ void object_apply_mat4(Object *ob, float mat[][4]) { - float mat3[3][3], tmat[3][3], imat[3][3]; + float mat3[3][3]; /* obmat -> 3x3 */ + float mat3_n[3][3]; /* obmat -> normalized, 3x3 */ + float imat3_n[3][3]; /* obmat -> normalized & inverted, 3x3 */ /* location */ copy_v3_v3(ob->loc, mat[3]); /* rotation */ copy_m3_m4(mat3, mat); - object_mat3_to_rot(ob, mat3, 0); - + /* so scale doesnt interfear with rotation [#24291] */ + normalize_m3_m3(mat3_n, (const float(*)[3])mat3); + + object_mat3_to_rot(ob, mat3_n, 0); + /* scale */ -#if 0 - /* works fine except for neg scales */ - mat4_to_size(ob->size, mat); -#else - /* this is more complicated but works for negative scales */ - object_rot_to_mat3(ob, tmat); - invert_m3_m3(imat, tmat); - mul_m3_m3m3(tmat, imat, mat3); - - ob->size[0]= tmat[0][0]; - ob->size[1]= tmat[1][1]; - ob->size[2]= tmat[2][2]; -#endif + /* note: mat4_to_size(ob->size, mat) fails for negative scale */ + invert_m3_m3(imat3_n, mat3_n); + mul_m3_m3m3(mat3, imat3_n, mat3); + + ob->size[0]= mat3[0][0]; + ob->size[1]= mat3[1][1]; + ob->size[2]= mat3[2][2]; } void object_to_mat3(Object *ob, float mat[][3]) /* no parent */ @@ -1743,7 +1752,7 @@ int enable_cu_speed= 1; static void ob_parcurve(Scene *scene, Object *ob, Object *par, float mat[][4]) { Curve *cu; - float q[4], vec[4], dir[3], quat[4], radius, x1, ctime; + float vec[4], dir[3], quat[4], radius, ctime; float timeoffs = 0.0, sf_orig = 0.0; unit_m4(mat); @@ -1795,6 +1804,7 @@ static void ob_parcurve(Scene *scene, Object *ob, Object *par, float mat[][4]) if(cu->flag & CU_FOLLOW) { #if 0 + float x1, q[4]; vec_to_quat( quat,dir, ob->trackflag, ob->upflag); /* the tilt */ diff --git a/source/blender/blenkernel/intern/packedFile.c b/source/blender/blenkernel/intern/packedFile.c index 919a724d1ec..33f1949c5ac 100644 --- a/source/blender/blenkernel/intern/packedFile.c +++ b/source/blender/blenkernel/intern/packedFile.c @@ -179,7 +179,7 @@ PackedFile *newPackedFile(ReportList *reports, char *filename) // convert relative filenames to absolute filenames strcpy(name, filename); - BLI_path_abs(name, G.sce); + BLI_path_abs(name, G.main->name); // open the file // and create a PackedFile structure @@ -214,10 +214,17 @@ void packAll(Main *bmain, ReportList *reports) Image *ima; VFont *vf; bSound *sound; - - for(ima=bmain->image.first; ima; ima=ima->id.next) - if(ima->packedfile == NULL && ima->id.lib==NULL && ELEM3(ima->source, IMA_SRC_FILE, IMA_SRC_SEQUENCE, IMA_SRC_MOVIE)) - ima->packedfile = newPackedFile(reports, ima->name); + + for(ima=bmain->image.first; ima; ima=ima->id.next) { + if(ima->packedfile == NULL && ima->id.lib==NULL) { + if(ima->source==IMA_SRC_FILE) { + ima->packedfile = newPackedFile(reports, ima->name); + } + else if(ELEM(ima->source, IMA_SRC_SEQUENCE, IMA_SRC_MOVIE)) { + BKE_reportf(reports, RPT_WARNING, "Image '%s' skipped, movies and image sequences not supported.", ima->id.name+2); + } + } + } for(vf=bmain->vfont.first; vf; vf=vf->id.next) if(vf->packedfile == NULL && vf->id.lib==NULL && strcmp(vf->name, "<builtin>") != 0) @@ -267,7 +274,7 @@ int writePackedFile(ReportList *reports, char *filename, PackedFile *pf, int gui if (guimode) {} //XXX waitcursor(1); strcpy(name, filename); - BLI_path_abs(name, G.sce); + BLI_path_abs(name, G.main->name); if (BLI_exists(name)) { for (number = 1; number <= 999; number++) { @@ -332,7 +339,7 @@ int checkPackedFile(char *filename, PackedFile *pf) char name[FILE_MAXDIR + FILE_MAXFILE]; strcpy(name, filename); - BLI_path_abs(name, G.sce); + BLI_path_abs(name, G.main->name); if (stat(name, &st)) { ret_val = PF_NOFILE; diff --git a/source/blender/blenkernel/intern/paint.c b/source/blender/blenkernel/intern/paint.c index ffb99c10c40..116ed3c8ef2 100644 --- a/source/blender/blenkernel/intern/paint.c +++ b/source/blender/blenkernel/intern/paint.c @@ -31,6 +31,7 @@ #include "DNA_scene_types.h" #include "DNA_brush_types.h" +#include "BKE_utildefines.h" #include "BKE_brush.h" #include "BKE_library.h" #include "BKE_paint.h" @@ -100,7 +101,7 @@ void paint_init(Paint *p, const char col[3]) p->flags |= PAINT_SHOW_BRUSH; } -void free_paint(Paint *paint) +void free_paint(Paint *UNUSED(paint)) { /* nothing */ } diff --git a/source/blender/blenkernel/intern/particle.c b/source/blender/blenkernel/intern/particle.c index 723ff7faed3..624587338c9 100644 --- a/source/blender/blenkernel/intern/particle.c +++ b/source/blender/blenkernel/intern/particle.c @@ -380,7 +380,7 @@ void psys_free_settings(ParticleSettings *part) fluid_free_settings(part->fluid); } -void free_hair(Object *ob, ParticleSystem *psys, int dynamics) +void free_hair(Object *UNUSED(ob), ParticleSystem *psys, int dynamics) { PARTICLE_P; @@ -402,9 +402,10 @@ void free_hair(Object *ob, ParticleSystem *psys, int dynamics) modifier_free((ModifierData*)psys->clmd); psys->clmd = NULL; + psys->pointcache = BKE_ptcache_add(&psys->ptcaches); } else { - cloth_free_modifier(ob, psys->clmd); + cloth_free_modifier(psys->clmd); } } @@ -1051,7 +1052,7 @@ typedef struct ParticleInterpolationData { } ParticleInterpolationData; /* Assumes pointcache->mem_cache exists, so for disk cached particles call psys_make_temp_pointcache() before use */ /* It uses ParticleInterpolationData->pm to store the current memory cache frame so it's thread safe. */ -static void get_pointcache_keys_for_time(Object *ob, PointCache *cache, PTCacheMem **cur, int index, float t, ParticleKey *key1, ParticleKey *key2) +static void get_pointcache_keys_for_time(Object *UNUSED(ob), PointCache *cache, PTCacheMem **cur, int index, float t, ParticleKey *key1, ParticleKey *key2) { static PTCacheMem *pm = NULL; @@ -1646,7 +1647,7 @@ int psys_particle_dm_face_lookup(Object *ob, DerivedMesh *dm, int index, float * return DMCACHE_NOTFOUND; } -static int psys_map_index_on_dm(DerivedMesh *dm, int from, int index, int index_dmcache, float *fw, float foffset, int *mapindex, float *mapfw) +static int psys_map_index_on_dm(DerivedMesh *dm, int from, int index, int index_dmcache, float *fw, float UNUSED(foffset), int *mapindex, float *mapfw) { if(index < 0) return 0; @@ -1802,7 +1803,7 @@ ParticleSystemModifierData *psys_get_modifier(Object *ob, ParticleSystem *psys) /* Particles on a shape */ /************************************************/ /* ready for future use */ -static void psys_particle_on_shape(int distr, int index, float *fuv, float *vec, float *nor, float *utan, float *vtan, float *orco, float *ornor) +static void psys_particle_on_shape(int UNUSED(distr), int UNUSED(index), float *UNUSED(fuv), float *vec, float *nor, float *utan, float *vtan, float *orco, float *ornor) { /* TODO */ float zerovec[3]={0.0f,0.0f,0.0f}; @@ -2184,7 +2185,7 @@ static void do_rough_end(float *loc, float mat[4][4], float t, float fac, float VECADDFAC(state->co,state->co,mat[0],rough[0]); VECADDFAC(state->co,state->co,mat[1],rough[1]); } -static void do_path_effectors(ParticleSimulationData *sim, int i, ParticleCacheKey *ca, int k, int steps, float *rootco, float effector, float dfra, float cfra, float *length, float *vec) +static void do_path_effectors(ParticleSimulationData *sim, int i, ParticleCacheKey *ca, int k, int steps, float *UNUSED(rootco), float effector, float UNUSED(dfra), float UNUSED(cfra), float *length, float *vec) { float force[3] = {0.0f,0.0f,0.0f}; ParticleKey eff_key; @@ -3338,7 +3339,7 @@ static void psys_face_mat(Object *ob, DerivedMesh *dm, ParticleData *pa, float m triatomat(v[0], v[1], v[2], (osface)? osface->uv: NULL, mat); } -void psys_mat_hair_to_object(Object *ob, DerivedMesh *dm, short from, ParticleData *pa, float hairmat[][4]) +void psys_mat_hair_to_object(Object *UNUSED(ob), DerivedMesh *dm, short from, ParticleData *pa, float hairmat[][4]) { float vec[3]; @@ -3817,7 +3818,7 @@ float psys_get_child_time(ParticleSystem *psys, ChildParticle *cpa, float cfra, return (cfra-time)/life; } -float psys_get_child_size(ParticleSystem *psys, ChildParticle *cpa, float cfra, float *pa_time) +float psys_get_child_size(ParticleSystem *psys, ChildParticle *cpa, float UNUSED(cfra), float *UNUSED(pa_time)) { ParticleSettings *part = psys->part; float size; // time XXX @@ -4248,7 +4249,7 @@ int psys_get_particle_state(ParticleSimulationData *sim, int p, ParticleKey *sta } } -void psys_get_dupli_texture(Object *ob, ParticleSettings *part, ParticleSystemModifierData *psmd, ParticleData *pa, ChildParticle *cpa, float *uv, float *orco) +void psys_get_dupli_texture(Object *UNUSED(ob), ParticleSettings *part, ParticleSystemModifierData *psmd, ParticleData *pa, ChildParticle *cpa, float *uv, float *orco) { MFace *mface; MTFace *mtface; diff --git a/source/blender/blenkernel/intern/particle_system.c b/source/blender/blenkernel/intern/particle_system.c index 47a220dcefb..71ec1114848 100644 --- a/source/blender/blenkernel/intern/particle_system.c +++ b/source/blender/blenkernel/intern/particle_system.c @@ -63,6 +63,7 @@ #include "BLI_listbase.h" #include "BLI_threads.h" +#include "BKE_main.h" #include "BKE_animsys.h" #include "BKE_boids.h" #include "BKE_cdderivedmesh.h" @@ -1437,7 +1438,7 @@ static void distribute_particles_on_dm(ParticleSimulationData *sim, int from) } /* ready for future use, to emit particles without geometry */ -static void distribute_particles_on_shape(ParticleSimulationData *sim, int from) +static void distribute_particles_on_shape(ParticleSimulationData *sim, int UNUSED(from)) { ParticleSystem *psys = sim->psys; PARTICLE_P; @@ -2289,7 +2290,7 @@ static void psys_update_effectors(ParticleSimulationData *sim) In theory, there could be unlimited implementation of SPH simulators **************************************************/ -void particle_fluidsim(ParticleSystem *psys, ParticleData *pa, ParticleSettings *part, ParticleSimulationData *sim, float dfra, float cfra, float mass){ +void particle_fluidsim(ParticleSystem *psys, ParticleData *pa, ParticleSettings *part, ParticleSimulationData *sim, float dfra, float UNUSED(cfra), float mass){ /**************************************************************************************************************** * This code uses in some parts adapted algorithms from the pseduo code as outlined in the Research paper * Titled: Particle-based Viscoelastic Fluid Simulation. @@ -3284,7 +3285,7 @@ static void hair_step(ParticleSimulationData *sim, float cfra) psys_calc_dmcache(sim->ob, sim->psmd->dm, psys); if(psys->clmd) - cloth_free_modifier(sim->ob, psys->clmd); + cloth_free_modifier(psys->clmd); } /* dynamics with cloth simulation */ @@ -3298,7 +3299,7 @@ static void hair_step(ParticleSimulationData *sim, float cfra) psys->flag |= PSYS_HAIR_UPDATED; } -static void save_hair(ParticleSimulationData *sim, float cfra){ +static void save_hair(ParticleSimulationData *sim, float UNUSED(cfra)){ Object *ob = sim->ob; ParticleSystem *psys = sim->psys; HairKey *key, *root; @@ -3574,7 +3575,7 @@ static void cached_step(ParticleSimulationData *sim, float cfra) } } -static void particles_fluid_step(ParticleSimulationData *sim, int cfra) +static void particles_fluid_step(ParticleSimulationData *sim, int UNUSED(cfra)) { ParticleSystem *psys = sim->psys; if(psys->particles){ @@ -3607,7 +3608,7 @@ static void particles_fluid_step(ParticleSimulationData *sim, int cfra) // ok, start loading strcpy(filename, fss->surfdataPath); strcat(filename, suffix); - BLI_path_abs(filename, G.sce); + BLI_path_abs(filename, G.main->name); BLI_path_frame(filename, curFrame, 0); // fixed #frame-no strcat(filename, suffix2); @@ -3682,7 +3683,7 @@ static void particles_fluid_step(ParticleSimulationData *sim, int cfra) #endif // DISABLE_ELBEEM } -static int emit_particles(ParticleSimulationData *sim, PTCacheID *pid, float cfra) +static int emit_particles(ParticleSimulationData *sim, PTCacheID *pid, float UNUSED(cfra)) { ParticleSystem *psys = sim->psys; ParticleSettings *part = psys->part; @@ -4016,8 +4017,13 @@ void particle_system_update(Scene *scene, Object *ob, ParticleSystem *psys) switch(part->type) { case PART_HAIR: { + /* nothing to do so bail out early */ + if(psys->totpart == 0 && part->totpart == 0) { + psys_free_path_cache(psys, NULL); + free_hair(ob, psys, 0); + } /* (re-)create hair */ - if(hair_needs_recalc(psys)) { + else if(hair_needs_recalc(psys)) { float hcfra=0.0f; int i, recalc = psys->recalc; diff --git a/source/blender/blenkernel/intern/pointcache.c b/source/blender/blenkernel/intern/pointcache.c index a15e66ed843..37d2b103ef0 100644 --- a/source/blender/blenkernel/intern/pointcache.c +++ b/source/blender/blenkernel/intern/pointcache.c @@ -132,7 +132,7 @@ static int ptcache_write_basic_header(PTCacheFile *pf) return 1; } /* Softbody functions */ -static int ptcache_write_softbody(int index, void *soft_v, void **data, int cfra) +static int ptcache_write_softbody(int index, void *soft_v, void **data, int UNUSED(cfra)) { SoftBody *soft= soft_v; BodyPoint *bp = soft->bpoint + index; @@ -142,7 +142,7 @@ static int ptcache_write_softbody(int index, void *soft_v, void **data, int cfra return 1; } -static void ptcache_read_softbody(int index, void *soft_v, void **data, float frs_sec, float cfra, float *old_data) +static void ptcache_read_softbody(int index, void *soft_v, void **data, float UNUSED(frs_sec), float UNUSED(cfra), float *old_data) { SoftBody *soft= soft_v; BodyPoint *bp = soft->bpoint + index; @@ -156,7 +156,7 @@ static void ptcache_read_softbody(int index, void *soft_v, void **data, float fr PTCACHE_DATA_TO(data, BPHYS_DATA_VELOCITY, 0, bp->vec); } } -static void ptcache_interpolate_softbody(int index, void *soft_v, void **data, float frs_sec, float cfra, float cfra1, float cfra2, float *old_data) +static void ptcache_interpolate_softbody(int index, void *soft_v, void **data, float UNUSED(frs_sec), float cfra, float cfra1, float cfra2, float *old_data) { SoftBody *soft= soft_v; BodyPoint *bp = soft->bpoint + index; @@ -188,7 +188,7 @@ static void ptcache_interpolate_softbody(int index, void *soft_v, void **data, f VECCOPY(bp->pos, keys->co); VECCOPY(bp->vec, keys->vel); } -static int ptcache_totpoint_softbody(void *soft_v, int cfra) +static int ptcache_totpoint_softbody(void *soft_v, int UNUSED(cfra)) { SoftBody *soft= soft_v; return soft->totpoint; @@ -348,7 +348,7 @@ static void ptcache_interpolate_particle(int index, void *psys_v, void **data, f pa->state.time = cfra; } -static int ptcache_totpoint_particle(void *psys_v, int cfra) +static int ptcache_totpoint_particle(void *psys_v, int UNUSED(cfra)) { ParticleSystem *psys = psys_v; return psys->totpart; @@ -493,7 +493,7 @@ static int ptcache_totwrite_particle(void *psys_v, int cfra) //} // /* Cloth functions */ -static int ptcache_write_cloth(int index, void *cloth_v, void **data, int cfra) +static int ptcache_write_cloth(int index, void *cloth_v, void **data, int UNUSED(cfra)) { ClothModifierData *clmd= cloth_v; Cloth *cloth= clmd->clothObject; @@ -505,7 +505,7 @@ static int ptcache_write_cloth(int index, void *cloth_v, void **data, int cfra) return 1; } -static void ptcache_read_cloth(int index, void *cloth_v, void **data, float frs_sec, float cfra, float *old_data) +static void ptcache_read_cloth(int index, void *cloth_v, void **data, float UNUSED(frs_sec), float UNUSED(cfra), float *old_data) { ClothModifierData *clmd= cloth_v; Cloth *cloth= clmd->clothObject; @@ -522,7 +522,7 @@ static void ptcache_read_cloth(int index, void *cloth_v, void **data, float frs_ PTCACHE_DATA_TO(data, BPHYS_DATA_XCONST, 0, vert->xconst); } } -static void ptcache_interpolate_cloth(int index, void *cloth_v, void **data, float frs_sec, float cfra, float cfra1, float cfra2, float *old_data) +static void ptcache_interpolate_cloth(int index, void *cloth_v, void **data, float UNUSED(frs_sec), float cfra, float cfra1, float cfra2, float *old_data) { ClothModifierData *clmd= cloth_v; Cloth *cloth= clmd->clothObject; @@ -558,7 +558,7 @@ static void ptcache_interpolate_cloth(int index, void *cloth_v, void **data, flo /* should vert->xconst be interpolated somehow too? - jahka */ } -static int ptcache_totpoint_cloth(void *cloth_v, int cfra) +static int ptcache_totpoint_cloth(void *cloth_v, int UNUSED(cfra)) { ClothModifierData *clmd= cloth_v; return clmd->clothObject ? clmd->clothObject->numverts : 0; @@ -635,7 +635,7 @@ void BKE_ptcache_id_from_particles(PTCacheID *pid, Object *ob, ParticleSystem *p } /* Smoke functions */ -static int ptcache_totpoint_smoke(void *smoke_v, int cfra) +static int ptcache_totpoint_smoke(void *smoke_v, int UNUSED(cfra)) { SmokeModifierData *smd= (SmokeModifierData *)smoke_v; SmokeDomainSettings *sds = smd->domain; @@ -648,7 +648,7 @@ static int ptcache_totpoint_smoke(void *smoke_v, int cfra) } /* Smoke functions */ -static int ptcache_totpoint_smoke_turbulence(void *smoke_v, int cfra) +static int ptcache_totpoint_smoke_turbulence(void *smoke_v, int UNUSED(cfra)) { SmokeModifierData *smd= (SmokeModifierData *)smoke_v; SmokeDomainSettings *sds = smd->domain; @@ -671,6 +671,8 @@ static int ptcache_compress_write(PTCacheFile *pf, unsigned char *in, unsigned i unsigned char *props = MEM_callocN(16*sizeof(char), "tmp"); size_t sizeOfIt = 5; + (void)mode; /* unused when building w/o compression */ + #ifdef WITH_LZO out_len= LZO_OUT_LEN(in_len); if(mode == 1) { @@ -1083,7 +1085,7 @@ void BKE_ptcache_ids_from_object(ListBase *lb, Object *ob, Scene *scene, int dup static int ptcache_path(PTCacheID *pid, char *filename) { Library *lib= (pid->ob)? pid->ob->id.lib: NULL; - const char *blendfilename= (lib && (pid->cache->flag & PTCACHE_IGNORE_LIBPATH)==0) ? lib->filepath: G.sce; + const char *blendfilename= (lib && (pid->cache->flag & PTCACHE_IGNORE_LIBPATH)==0) ? lib->filepath: G.main->name; size_t i; if(pid->cache->flag & PTCACHE_EXTERNAL) { @@ -2220,7 +2222,7 @@ int BKE_ptcache_id_reset(Scene *scene, PTCacheID *pid, int mode) cache->flag &= ~PTCACHE_REDO_NEEDED; if(pid->type == PTCACHE_TYPE_CLOTH) - cloth_free_modifier(pid->ob, pid->calldata); + cloth_free_modifier(pid->calldata); else if(pid->type == PTCACHE_TYPE_SOFTBODY) sbFreeSimulation(pid->calldata); else if(pid->type == PTCACHE_TYPE_PARTICLES) @@ -2993,13 +2995,17 @@ void BKE_ptcache_update_info(PTCacheID *pid) void BKE_ptcache_validate(PointCache *cache, int framenr) { - cache->flag |= PTCACHE_SIMULATION_VALID; - cache->simframe = framenr; + if(cache) { + cache->flag |= PTCACHE_SIMULATION_VALID; + cache->simframe = framenr; + } } void BKE_ptcache_invalidate(PointCache *cache) { - cache->flag &= ~PTCACHE_SIMULATION_VALID; - cache->simframe = 0; - cache->last_exact = MIN2(cache->startframe, 0); + if(cache) { + cache->flag &= ~PTCACHE_SIMULATION_VALID; + cache->simframe = 0; + cache->last_exact = MIN2(cache->startframe, 0); + } } diff --git a/source/blender/blenkernel/intern/scene.c b/source/blender/blenkernel/intern/scene.c index 328f0955271..027ec5e4052 100644 --- a/source/blender/blenkernel/intern/scene.c +++ b/source/blender/blenkernel/intern/scene.c @@ -108,7 +108,7 @@ void free_qtcodecdata(QuicktimeCodecData *qcd) } } -Scene *copy_scene(Main *bmain, Scene *sce, int type) +Scene *copy_scene(Scene *sce, int type) { Scene *scen; ToolSettings *ts; @@ -573,11 +573,11 @@ Scene *set_scene_name(Main *bmain, char *name) Scene *sce= (Scene *)find_id("SC", name); if(sce) { set_scene_bg(bmain, sce); - printf("Scene switch: '%s' in file: '%s'\n", name, G.sce); + printf("Scene switch: '%s' in file: '%s'\n", name, G.main->name); return sce; } - printf("Can't find scene: '%s' in file: '%s'\n", name, G.sce); + printf("Can't find scene: '%s' in file: '%s'\n", name, G.main->name); return NULL; } diff --git a/source/blender/blenkernel/intern/seqeffects.c b/source/blender/blenkernel/intern/seqeffects.c index 7b428661c6d..6477c6b4f75 100644 --- a/source/blender/blenkernel/intern/seqeffects.c +++ b/source/blender/blenkernel/intern/seqeffects.c @@ -53,7 +53,7 @@ #include "RNA_access.h" /* **** XXX **** */ -static void error(const char *error, ...) {} +static void error(const char *UNUSED(error), ...) {} #define INT 96 #define FLO 128 @@ -77,15 +77,15 @@ static struct ImBuf * prepare_effect_imbufs( if (!ibuf1 && !ibuf2 && !ibuf3) { /* hmmm, global float option ? */ - out = IMB_allocImBuf((short)x, (short)y, 32, IB_rect, 0); + out = IMB_allocImBuf((short)x, (short)y, 32, IB_rect); } else if ((ibuf1 && ibuf1->rect_float) || (ibuf2 && ibuf2->rect_float) || (ibuf3 && ibuf3->rect_float)) { /* if any inputs are rectfloat, output is float too */ - out = IMB_allocImBuf((short)x, (short)y, 32, IB_rectfloat, 0); + out = IMB_allocImBuf((short)x, (short)y, 32, IB_rectfloat); } else { - out = IMB_allocImBuf((short)x, (short)y, 32, IB_rect, 0); + out = IMB_allocImBuf((short)x, (short)y, 32, IB_rect); } if (ibuf1 && !ibuf1->rect_float && out->rect_float) { @@ -273,9 +273,9 @@ static ImBuf * IMB_cast_away_list(ImBuf * i) } static struct ImBuf * do_plugin_effect( - Main *bmain, Scene *scene, Sequence *seq, float cfra, + Main *UNUSED(bmain), Scene *UNUSED(scene), Sequence *seq, float cfra, float facf0, float facf1, int x, int y, - int preview_render_size, + int UNUSED(preview_render_size), struct ImBuf *ibuf1, struct ImBuf *ibuf2, struct ImBuf *ibuf3) { @@ -370,8 +370,8 @@ static struct ImBuf * do_plugin_effect( return out; } -static int do_plugin_early_out(struct Sequence *seq, - float facf0, float facf1) +static int do_plugin_early_out(struct Sequence *UNUSED(seq), + float UNUSED(facf0), float UNUSED(facf1)) { return 0; } @@ -524,9 +524,9 @@ static void do_alphaover_effect_float(float facf0, float facf1, int x, int y, } static struct ImBuf * do_alphaover_effect( - Main *bmain, Scene *scene, Sequence *seq, float cfra, + Main *UNUSED(bmain), Scene *UNUSED(scene), Sequence *UNUSED(seq), float UNUSED(cfra), float facf0, float facf1, int x, int y, - int preview_render_size, + int UNUSED(preview_render_size), struct ImBuf *ibuf1, struct ImBuf *ibuf2, struct ImBuf *ibuf3) { @@ -696,9 +696,9 @@ static void do_alphaunder_effect_float(float facf0, float facf1, int x, int y, } static struct ImBuf* do_alphaunder_effect( - Main *bmain, Scene *scene, Sequence *seq, float cfra, + Main *UNUSED(bmain), Scene *UNUSED(scene), Sequence *UNUSED(seq), float UNUSED(cfra), float facf0, float facf1, int x, int y, - int preview_render_size, + int UNUSED(preview_render_size), struct ImBuf *ibuf1, struct ImBuf *ibuf2, struct ImBuf *ibuf3) { @@ -821,9 +821,9 @@ void do_cross_effect_float(float facf0, float facf1, int x, int y, /* carefull: also used by speed effect! */ static struct ImBuf* do_cross_effect( - Main *bmain, Scene *scene, Sequence *seq, float cfra, + Main *UNUSED(bmain), Scene *UNUSED(scene), Sequence *UNUSED(seq), float UNUSED(cfra), float facf0, float facf1, int x, int y, - int preview_render_size, + int UNUSED(preview_render_size), struct ImBuf *ibuf1, struct ImBuf *ibuf2, struct ImBuf *ibuf3) { @@ -976,19 +976,19 @@ static void build_gammatabs() } } -static void init_gammacross(Sequence * seq) +static void init_gammacross(Sequence * UNUSED(seq)) { } -static void load_gammacross(Sequence * seq) +static void load_gammacross(Sequence * UNUSED(seq)) { } -static void free_gammacross(Sequence * seq) +static void free_gammacross(Sequence * UNUSED(seq)) { } -static void do_gammacross_effect_byte(float facf0, float facf1, +static void do_gammacross_effect_byte(float facf0, float UNUSED(facf1), int x, int y, unsigned char *rect1, unsigned char *rect2, @@ -1044,7 +1044,7 @@ static void do_gammacross_effect_byte(float facf0, float facf1, } -static void do_gammacross_effect_float(float facf0, float facf1, +static void do_gammacross_effect_float(float facf0, float UNUSED(facf1), int x, int y, float *rect1, float *rect2, float *out) @@ -1088,9 +1088,9 @@ static void do_gammacross_effect_float(float facf0, float facf1, } static struct ImBuf * do_gammacross_effect( - Main *bmain, Scene *scene, Sequence *seq, float cfra, + Main *UNUSED(bmain), Scene *UNUSED(scene), Sequence *UNUSED(seq), float UNUSED(cfra), float facf0, float facf1, int x, int y, - int preview_render_size, + int UNUSED(preview_render_size), struct ImBuf *ibuf1, struct ImBuf *ibuf2, struct ImBuf *ibuf3) { @@ -1206,9 +1206,9 @@ static void do_add_effect_float(float facf0, float facf1, int x, int y, } } -static struct ImBuf * do_add_effect(Main *bmain, Scene *scene, Sequence *seq, float cfra, +static struct ImBuf * do_add_effect(Main *UNUSED(bmain), Scene *UNUSED(scene), Sequence *UNUSED(seq), float UNUSED(cfra), float facf0, float facf1, int x, int y, - int preview_render_size, + int UNUSED(preview_render_size), struct ImBuf *ibuf1, struct ImBuf *ibuf2, struct ImBuf *ibuf3) { @@ -1323,9 +1323,9 @@ static void do_sub_effect_float(float facf0, float facf1, int x, int y, } static struct ImBuf * do_sub_effect( - Main *bmain, Scene *scene, Sequence *seq, float cfra, + Main *UNUSED(bmain), Scene *UNUSED(scene), Sequence *UNUSED(seq), float UNUSED(cfra), float facf0, float facf1, int x, int y, - int preview_render_size, + int UNUSED(preview_render_size), struct ImBuf *ibuf1, struct ImBuf *ibuf2, struct ImBuf *ibuf3) { @@ -1537,9 +1537,9 @@ static void do_mul_effect_float(float facf0, float facf1, int x, int y, } static struct ImBuf * do_mul_effect( - Main *bmain, Scene *scene, Sequence *seq, float cfra, + Main *UNUSED(bmain), Scene *UNUSED(scene), Sequence *UNUSED(seq), float UNUSED(cfra), float facf0, float facf1, int x, int y, - int preview_render_size, + int UNUSED(preview_render_size), struct ImBuf *ibuf1, struct ImBuf *ibuf2, struct ImBuf *ibuf3) { @@ -1876,7 +1876,7 @@ static void copy_wipe_effect(Sequence *dst, Sequence *src) dst->effectdata = MEM_dupallocN(src->effectdata); } -static void do_wipe_effect_byte(Sequence *seq, float facf0, float facf1, +static void do_wipe_effect_byte(Sequence *seq, float facf0, float UNUSED(facf1), int x, int y, unsigned char *rect1, unsigned char *rect2, unsigned char *out) @@ -1934,7 +1934,7 @@ static void do_wipe_effect_byte(Sequence *seq, float facf0, float facf1, } } -static void do_wipe_effect_float(Sequence *seq, float facf0, float facf1, +static void do_wipe_effect_float(Sequence *seq, float facf0, float UNUSED(facf1), int x, int y, float *rect1, float *rect2, float *out) @@ -1993,9 +1993,9 @@ static void do_wipe_effect_float(Sequence *seq, float facf0, float facf1, } static struct ImBuf * do_wipe_effect( - Main *bmain, Scene *scene, Sequence *seq, float cfra, + Main *UNUSED(bmain), Scene *UNUSED(scene), Sequence *seq, float UNUSED(cfra), float facf0, float facf1, int x, int y, - int preview_render_size, + int UNUSED(preview_render_size), struct ImBuf *ibuf1, struct ImBuf *ibuf2, struct ImBuf *ibuf3) { @@ -2111,7 +2111,7 @@ static void transform_image(int x, int y, struct ImBuf *ibuf1, struct ImBuf *out } } -static void do_transform(Scene *scene, Sequence *seq, float facf0, int x, int y, +static void do_transform(Scene *scene, Sequence *seq, float UNUSED(facf0), int x, int y, struct ImBuf *ibuf1,struct ImBuf *out) { TransformVars *transform = (TransformVars *)seq->effectdata; @@ -2144,9 +2144,9 @@ static void do_transform(Scene *scene, Sequence *seq, float facf0, int x, int y, static struct ImBuf * do_transform_effect( - Main *bmain, Scene *scene, Sequence *seq,float cfra, - float facf0, float facf1, int x, int y, - int preview_render_size, + Main *UNUSED(bmain), Scene *scene, Sequence *seq,float UNUSED(cfra), + float facf0, float UNUSED(facf1), int x, int y, + int UNUSED(preview_render_size), struct ImBuf *ibuf1, struct ImBuf *ibuf2, struct ImBuf *ibuf3) { @@ -2631,9 +2631,9 @@ static void copy_glow_effect(Sequence *dst, Sequence *src) } //void do_glow_effect(Cast *cast, float facf0, float facf1, int xo, int yo, ImBuf *ibuf1, ImBuf *ibuf2, ImBuf *outbuf, ImBuf *use) -static void do_glow_effect_byte(Sequence *seq, float facf0, float facf1, +static void do_glow_effect_byte(Sequence *seq, float facf0, float UNUSED(facf1), int x, int y, char *rect1, - char *rect2, char *out) + char *UNUSED(rect2), char *out) { unsigned char *outbuf=(unsigned char *)out; unsigned char *inbuf=(unsigned char *)rect1; @@ -2646,9 +2646,9 @@ static void do_glow_effect_byte(Sequence *seq, float facf0, float facf1, RVAddBitmaps_byte (inbuf , outbuf, outbuf, x, y); } -static void do_glow_effect_float(Sequence *seq, float facf0, float facf1, +static void do_glow_effect_float(Sequence *seq, float facf0, float UNUSED(facf1), int x, int y, - float *rect1, float *rect2, float *out) + float *rect1, float *UNUSED(rect2), float *out) { float *outbuf = out; float *inbuf = rect1; @@ -2662,9 +2662,9 @@ static void do_glow_effect_float(Sequence *seq, float facf0, float facf1, } static struct ImBuf * do_glow_effect( - Main *bmain, Scene *scene, Sequence *seq, float cfra, + Main *UNUSED(bmain), Scene *UNUSED(scene), Sequence *seq, float UNUSED(cfra), float facf0, float facf1, int x, int y, - int preview_render_size, + int UNUSED(preview_render_size), struct ImBuf *ibuf1, struct ImBuf *ibuf2, struct ImBuf *ibuf3) { @@ -2716,16 +2716,16 @@ static void copy_solid_color(Sequence *dst, Sequence *src) dst->effectdata = MEM_dupallocN(src->effectdata); } -static int early_out_color(struct Sequence *seq, - float facf0, float facf1) +static int early_out_color(struct Sequence *UNUSED(seq), + float UNUSED(facf0), float UNUSED(facf1)) { return -1; } static struct ImBuf * do_solid_color( - Main *bmain, Scene *scene, Sequence *seq, float cfra, + Main *UNUSED(bmain), Scene *UNUSED(scene), Sequence *seq, float UNUSED(cfra), float facf0, float facf1, int x, int y, - int preview_render_size, + int UNUSED(preview_render_size), struct ImBuf *ibuf1, struct ImBuf *ibuf2, struct ImBuf *ibuf3) { @@ -2813,17 +2813,17 @@ static int num_inputs_multicam() return 0; } -static int early_out_multicam(struct Sequence *seq, float facf0, float facf1) +static int early_out_multicam(struct Sequence *UNUSED(seq), float UNUSED(facf0), float UNUSED(facf1)) { return -1; } static struct ImBuf * do_multicam( Main *bmain, Scene *scene, Sequence *seq, float cfra, - float facf0, float facf1, int x, int y, + float UNUSED(facf0), float UNUSED(facf1), int x, int y, int preview_render_size, - struct ImBuf *ibuf1, struct ImBuf *ibuf2, - struct ImBuf *ibuf3) + struct ImBuf *UNUSED(ibuf1), struct ImBuf *UNUSED(ibuf2), + struct ImBuf *UNUSED(ibuf3)) { struct ImBuf * i; struct ImBuf * out; @@ -2907,14 +2907,14 @@ static void copy_speed_effect(Sequence *dst, Sequence *src) v->length = 0; } -static int early_out_speed(struct Sequence *seq, - float facf0, float facf1) +static int early_out_speed(struct Sequence *UNUSED(seq), + float UNUSED(facf0), float UNUSED(facf1)) { return 1; } static void store_icu_yrange_speed(struct Sequence * seq, - short adrcode, float * ymin, float * ymax) + short UNUSED(adrcode), float * ymin, float * ymax) { SpeedControlVars * v = (SpeedControlVars *)seq->effectdata; @@ -3039,22 +3039,22 @@ static void do_speed_effect(Sequence * seq,int cfra, ********************************************************************** */ -static void init_noop(struct Sequence *seq) +static void init_noop(struct Sequence *UNUSED(seq)) { } -static void load_noop(struct Sequence *seq) +static void load_noop(struct Sequence *UNUSED(seq)) { } -static void init_plugin_noop(struct Sequence *seq, const char * fname) +static void init_plugin_noop(struct Sequence *UNUSED(seq), const char *UNUSED(fname)) { } -static void free_noop(struct Sequence *seq) +static void free_noop(struct Sequence *UNUSED(seq)) { } @@ -3064,13 +3064,13 @@ static int num_inputs_default() return 2; } -static int early_out_noop(struct Sequence *seq, - float facf0, float facf1) +static int early_out_noop(struct Sequence *UNUSED(seq), + float UNUSED(facf0), float UNUSED(facf1)) { return 0; } -static int early_out_fade(struct Sequence *seq, +static int early_out_fade(struct Sequence *UNUSED(seq), float facf0, float facf1) { if (facf0 == 0.0 && facf1 == 0.0) { @@ -3081,7 +3081,7 @@ static int early_out_fade(struct Sequence *seq, return 0; } -static int early_out_mul_input2(struct Sequence *seq, +static int early_out_mul_input2(struct Sequence *UNUSED(seq), float facf0, float facf1) { if (facf0 == 0.0 && facf1 == 0.0) { @@ -3090,13 +3090,13 @@ static int early_out_mul_input2(struct Sequence *seq, return 0; } -static void store_icu_yrange_noop(struct Sequence * seq, - short adrcode, float * ymin, float * ymax) +static void store_icu_yrange_noop(struct Sequence * UNUSED(seq), + short UNUSED(adrcode), float *UNUSED(ymin), float *UNUSED(ymax)) { /* defaults are fine */ } -static void get_default_fac_noop(struct Sequence *seq, float cfra, +static void get_default_fac_noop(struct Sequence *UNUSED(seq), float UNUSED(cfra), float * facf0, float * facf1) { *facf0 = *facf1 = 1.0; @@ -3111,10 +3111,10 @@ static void get_default_fac_fade(struct Sequence *seq, float cfra, *facf1 /= seq->len; } -static struct ImBuf * do_overdrop_effect(Main *bmain, Scene *scene, Sequence *seq, float cfra, +static struct ImBuf * do_overdrop_effect(Main *UNUSED(bmain), Scene *UNUSED(scene), Sequence *UNUSED(seq), float UNUSED(cfra), float facf0, float facf1, int x, int y, - int preview_render_size, + int UNUSED(preview_render_size), struct ImBuf * ibuf1, struct ImBuf * ibuf2, struct ImBuf * ibuf3) diff --git a/source/blender/blenkernel/intern/sequencer.c b/source/blender/blenkernel/intern/sequencer.c index 8c496fea3b0..21b7cfd010c 100644 --- a/source/blender/blenkernel/intern/sequencer.c +++ b/source/blender/blenkernel/intern/sequencer.c @@ -554,7 +554,7 @@ void calc_sequence(Scene *scene, Sequence *seq) } /* note: caller should run calc_sequence(scene, seq) after */ -void reload_sequence_new_file(Main *bmain, Scene *scene, Sequence * seq, int lock_range) +void reload_sequence_new_file(Scene *scene, Sequence * seq, int lock_range) { char str[FILE_MAXDIR+FILE_MAXFILE]; int prev_startdisp, prev_enddisp; @@ -579,7 +579,7 @@ void reload_sequence_new_file(Main *bmain, Scene *scene, Sequence * seq, int loc if (seq->type != SEQ_SCENE && seq->type != SEQ_META && seq->type != SEQ_IMAGE) { BLI_join_dirfile(str, seq->strip->dir, seq->strip->stripdata->name); - BLI_path_abs(str, G.sce); + BLI_path_abs(str, G.main->name); } if (seq->type == SEQ_IMAGE) { @@ -621,7 +621,7 @@ void reload_sequence_new_file(Main *bmain, Scene *scene, Sequence * seq, int loc seq->strip->len = seq->len; } else if (seq->type == SEQ_SCENE) { /* 'seq->scenenr' should be replaced with something more reliable */ - Scene * sce = bmain->scene.first; + Scene * sce = G.main->scene.first; int nr = 1; while(sce) { @@ -1005,7 +1005,7 @@ static int get_shown_sequences( ListBase * seqbasep, int cfra, int chanshown, Se } } - for (;b <= chanshown; b++) { + for (;b <= chanshown && b >= 0; b++) { if (video_seq_is_rendered(seq_arr[b])) { seq_arr_out[cnt++] = seq_arr[b]; } @@ -1021,7 +1021,7 @@ static int get_shown_sequences( ListBase * seqbasep, int cfra, int chanshown, Se #define PROXY_MAXFILE (2*FILE_MAXDIR+FILE_MAXFILE) -static int seq_proxy_get_fname(Scene *scene, Sequence * seq, int cfra, char * name, int render_size) +static int seq_proxy_get_fname(Scene *UNUSED(scene), Sequence * seq, int cfra, char * name, int render_size) { int frameno; char dir[FILE_MAXDIR]; @@ -1044,7 +1044,7 @@ static int seq_proxy_get_fname(Scene *scene, Sequence * seq, int cfra, char * na if (seq->flag & SEQ_USE_PROXY_CUSTOM_FILE) { BLI_join_dirfile(name, dir, seq->strip->proxy->file); - BLI_path_abs(name, G.sce); + BLI_path_abs(name, G.main->name); return TRUE; } @@ -1071,7 +1071,7 @@ static int seq_proxy_get_fname(Scene *scene, Sequence * seq, int cfra, char * na render_size); } - BLI_path_abs(name, G.sce); + BLI_path_abs(name, G.main->name); BLI_path_frame(name, frameno, 0); @@ -1444,7 +1444,7 @@ static void color_balance(Sequence * seq, ImBuf* ibuf, float mul) */ int input_have_to_preprocess( - Scene *scene, Sequence * seq, float cfra, int seqrectx, int seqrecty) + Scene *UNUSED(scene), Sequence * seq, float UNUSED(cfra), int UNUSED(seqrectx), int UNUSED(seqrecty)) { float mul; @@ -1476,7 +1476,7 @@ int input_have_to_preprocess( } static ImBuf * input_preprocess( - Scene *scene, Sequence *seq, float cfra, int seqrectx, int seqrecty, + Scene *scene, Sequence *seq, float UNUSED(cfra), int seqrectx, int seqrecty, ImBuf * ibuf) { float mul; @@ -1521,9 +1521,9 @@ static ImBuf * input_preprocess( ImBuf * i; if (ibuf->rect_float) { - i = IMB_allocImBuf(dx, dy,32, IB_rectfloat, 0); + i = IMB_allocImBuf(dx, dy,32, IB_rectfloat); } else { - i = IMB_allocImBuf(dx, dy,32, IB_rect, 0); + i = IMB_allocImBuf(dx, dy,32, IB_rect); } IMB_rectcpy(i, ibuf, @@ -1787,7 +1787,7 @@ finish: if (!out) { out = IMB_allocImBuf( - (short)seqrectx, (short)seqrecty, 32, IB_rect, 0); + (short)seqrectx, (short)seqrecty, 32, IB_rect); } return out; @@ -1878,7 +1878,7 @@ static ImBuf * seq_render_scene_strip_impl( RE_AcquireResultImage(re, &rres); if(rres.rectf) { - ibuf= IMB_allocImBuf(rres.rectx, rres.recty, 32, IB_rectfloat, 0); + ibuf= IMB_allocImBuf(rres.rectx, rres.recty, 32, IB_rectfloat); memcpy(ibuf->rect_float, rres.rectf, 4*sizeof(float)*rres.rectx*rres.recty); if(rres.rectz) { addzbuffloatImBuf(ibuf); @@ -1890,7 +1890,7 @@ static ImBuf * seq_render_scene_strip_impl( IMB_convert_profile(ibuf, IB_PROFILE_SRGB); } else if (rres.rect32) { - ibuf= IMB_allocImBuf(rres.rectx, rres.recty, 32, IB_rect, 0); + ibuf= IMB_allocImBuf(rres.rectx, rres.recty, 32, IB_rect); memcpy(ibuf->rect, rres.rect32, 4*rres.rectx*rres.recty); } @@ -2002,7 +2002,7 @@ static ImBuf * seq_render_strip(Main *bmain, Scene *scene, Sequence * seq, float if(ibuf == 0 && s_elem) { BLI_join_dirfile(name, seq->strip->dir, s_elem->name); - BLI_path_abs(name, G.sce); + BLI_path_abs(name, G.main->name); ibuf = seq_proxy_fetch(scene, seq, cfra, render_size); } @@ -2038,7 +2038,7 @@ static ImBuf * seq_render_strip(Main *bmain, Scene *scene, Sequence * seq, float BLI_join_dirfile(name, seq->strip->dir, seq->strip->stripdata->name); - BLI_path_abs(name, G.sce); + BLI_path_abs(name, G.main->name); seq->anim = openanim( name, IB_rect | @@ -2079,7 +2079,7 @@ static ImBuf * seq_render_strip(Main *bmain, Scene *scene, Sequence * seq, float if (!ibuf) { ibuf = IMB_allocImBuf( - (short)seqrectx, (short)seqrecty, 32, IB_rect, 0); + (short)seqrectx, (short)seqrecty, 32, IB_rect); } if (ibuf->x != seqrectx || ibuf->y != seqrecty) { @@ -2213,7 +2213,7 @@ static ImBuf* seq_render_strip_stack( if (i == 0) { out = IMB_allocImBuf( (short)seqrectx, (short)seqrecty, - 32, IB_rect, 0); + 32, IB_rect); } break; case 0: @@ -3492,7 +3492,7 @@ Sequence *sequencer_add_movie_strip(bContext *C, ListBase *seqbasep, SeqLoadInfo struct anim *an; BLI_strncpy(path, seq_load->path, sizeof(path)); - BLI_path_abs(path, G.sce); + BLI_path_abs(path, G.main->name); an = openanim(path, IB_rect); diff --git a/source/blender/blenkernel/intern/smoke.c b/source/blender/blenkernel/intern/smoke.c index 965ce9801d7..d1eed94d330 100644 --- a/source/blender/blenkernel/intern/smoke.c +++ b/source/blender/blenkernel/intern/smoke.c @@ -435,7 +435,7 @@ static void fill_scs_points(Object *ob, DerivedMesh *dm, SmokeCollSettings *scs) } /*! init triangle divisions */ -void calcTriangleDivs(Object *ob, MVert *verts, int numverts, MFace *faces, int numfaces, int numtris, int **tridivs, float cell_len) +void calcTriangleDivs(Object *ob, MVert *verts, int UNUSED(numverts), MFace *faces, int numfaces, int numtris, int **tridivs, float cell_len) { // mTriangleDivs1.resize( faces.size() ); // mTriangleDivs2.resize( faces.size() ); @@ -1270,7 +1270,7 @@ static void smoke_calc_domain(Scene *scene, Object *ob, SmokeModifierData *smd) } } } -void smokeModifier_do(SmokeModifierData *smd, Scene *scene, Object *ob, DerivedMesh *dm, int useRenderParams, int isFinalCalc) +void smokeModifier_do(SmokeModifierData *smd, Scene *scene, Object *ob, DerivedMesh *dm, int UNUSED(useRenderParams), int UNUSED(isFinalCalc)) { if((smd->type & MOD_SMOKE_TYPE_FLOW)) { diff --git a/source/blender/blenkernel/intern/softbody.c b/source/blender/blenkernel/intern/softbody.c index 98a50eee146..978b3c9864f 100644 --- a/source/blender/blenkernel/intern/softbody.c +++ b/source/blender/blenkernel/intern/softbody.c @@ -171,7 +171,7 @@ static void Vec3PlusStVec(float *v, float s, float *v1); /*physical unit of force is [kg * m / sec^2]*/ -static float sb_grav_force_scale(Object *ob) +static float sb_grav_force_scale(Object *UNUSED(ob)) /* since unit of g is [m/sec^2] and F = mass * g we rescale unit mass of node to 1 gramm put it to a function here, so we can add user options later without touching simulation code */ @@ -179,7 +179,7 @@ static float sb_grav_force_scale(Object *ob) return (0.001f); } -static float sb_fric_force_scale(Object *ob) +static float sb_fric_force_scale(Object *UNUSED(ob)) /* rescaling unit of drag [1 / sec] to somehow reasonable put it to a function here, so we can add user options later without touching simulation code */ @@ -678,7 +678,7 @@ static void add_mesh_quad_diag_springs(Object *ob) } } -static void add_2nd_order_roller(Object *ob,float stiffness,int *counter, int addsprings) +static void add_2nd_order_roller(Object *ob,float UNUSED(stiffness), int *counter, int addsprings) { /*assume we have a softbody*/ SoftBody *sb= ob->soft; /* is supposed to be there */ @@ -1029,7 +1029,7 @@ static int query_external_colliders(Scene *scene, Object *me) /* +++ the aabb "force" section*/ -static int sb_detect_aabb_collisionCached( float force[3], unsigned int par_layer,struct Object *vertexowner,float time) +static int sb_detect_aabb_collisionCached( float UNUSED(force[3]), unsigned int UNUSED(par_layer),struct Object *vertexowner,float UNUSED(time)) { Object *ob; SoftBody *sb=vertexowner->soft; @@ -1094,7 +1094,7 @@ static int sb_detect_aabb_collisionCached( float force[3], unsigned int par_laye /* +++ the face external section*/ static int sb_detect_face_pointCached(float face_v1[3],float face_v2[3],float face_v3[3],float *damp, - float force[3], unsigned int par_layer,struct Object *vertexowner,float time) + float force[3], unsigned int UNUSED(par_layer),struct Object *vertexowner,float time) { Object *ob; GHash *hash; @@ -1192,7 +1192,7 @@ static int sb_detect_face_pointCached(float face_v1[3],float face_v2[3],float fa static int sb_detect_face_collisionCached(float face_v1[3],float face_v2[3],float face_v3[3],float *damp, - float force[3], unsigned int par_layer,struct Object *vertexowner,float time) + float force[3], unsigned int UNUSED(par_layer),struct Object *vertexowner,float time) { Object *ob; GHash *hash; @@ -1418,7 +1418,7 @@ static void scan_for_ext_face_forces(Object *ob,float timenow) /* +++ the spring external section*/ static int sb_detect_edge_collisionCached(float edge_v1[3],float edge_v2[3],float *damp, - float force[3], unsigned int par_layer,struct Object *vertexowner,float time) + float force[3], unsigned int UNUSED(par_layer),struct Object *vertexowner,float time) { Object *ob; GHash *hash; @@ -1659,7 +1659,7 @@ static void *exec_scan_for_ext_spring_forces(void *data) return 0; } -static void sb_sfesf_threads_run(Scene *scene, struct Object *ob, float timenow,int totsprings,int *ptr_to_break_func()) +static void sb_sfesf_threads_run(Scene *scene, struct Object *ob, float timenow,int totsprings,int *UNUSED(ptr_to_break_func())) { ListBase *do_effector = NULL; ListBase threads; @@ -1749,7 +1749,7 @@ static int choose_winner(float*w, float* pos,float*a,float*b,float*c,float*ca,fl static int sb_detect_vertex_collisionCached(float opco[3], float facenormal[3], float *damp, - float force[3], unsigned int par_layer,struct Object *vertexowner, + float force[3], unsigned int UNUSED(par_layer), struct Object *vertexowner, float time,float vel[3], float *intrusion) { Object *ob= NULL; @@ -2084,7 +2084,7 @@ static void dfdv_goal(int ia, int ic,float factor) for(i=0;i<3;i++) nlMatrixAdd(ia+i,ic+i,factor); } */ -static void sb_spring_force(Object *ob,int bpi,BodySpring *bs,float iks,float forcetime,int nl_flags) +static void sb_spring_force(Object *ob,int bpi,BodySpring *bs,float iks,float UNUSED(forcetime), int nl_flags) { SoftBody *sb= ob->soft; /* is supposed to be there */ BodyPoint *bp1,*bp2; @@ -2175,7 +2175,7 @@ static void sb_spring_force(Object *ob,int bpi,BodySpring *bs,float iks,float fo /* since this is definitely the most CPU consuming task here .. try to spread it */ /* core function _softbody_calc_forces_slice_in_a_thread */ /* result is int to be able to flag user break */ -static int _softbody_calc_forces_slice_in_a_thread(Scene *scene, Object *ob, float forcetime, float timenow,int ifirst,int ilast,int *ptr_to_break_func(),ListBase *do_effector,int do_deflector,float fieldfactor, float windfactor) +static int _softbody_calc_forces_slice_in_a_thread(Scene *scene, Object *ob, float forcetime, float timenow,int ifirst,int ilast,int *UNUSED(ptr_to_break_func()),ListBase *do_effector,int do_deflector,float fieldfactor, float windfactor) { float iks; int bb,do_selfcollision,do_springcollision,do_aero; @@ -2386,7 +2386,7 @@ static void *exec_softbody_calc_forces(void *data) return 0; } -static void sb_cf_threads_run(Scene *scene, Object *ob, float forcetime, float timenow,int totpoint,int *ptr_to_break_func(),struct ListBase *do_effector,int do_deflector,float fieldfactor, float windfactor) +static void sb_cf_threads_run(Scene *scene, Object *ob, float forcetime, float timenow,int totpoint,int *UNUSED(ptr_to_break_func()),struct ListBase *do_effector,int do_deflector,float fieldfactor, float windfactor) { ListBase threads; SB_thread_context *sb_threads; @@ -2444,7 +2444,7 @@ static void sb_cf_threads_run(Scene *scene, Object *ob, float forcetime, float t MEM_freeN(sb_threads); } -static void softbody_calc_forcesEx(Scene *scene, Object *ob, float forcetime, float timenow, int nl_flags) +static void softbody_calc_forcesEx(Scene *scene, Object *ob, float forcetime, float timenow, int UNUSED(nl_flags)) { /* rule we never alter free variables :bp->vec bp->pos in here ! * this will ruin adaptive stepsize AKA heun! (BM) diff --git a/source/blender/blenkernel/intern/sound.c b/source/blender/blenkernel/intern/sound.c index 5e95b19b64f..cc941c81131 100644 --- a/source/blender/blenkernel/intern/sound.c +++ b/source/blender/blenkernel/intern/sound.c @@ -110,6 +110,8 @@ void sound_init(struct Main *bmain) #ifdef WITH_JACK AUD_setSyncCallback(sound_sync_callback, bmain); +#else + (void)bmain; /* unused */ #endif } @@ -129,7 +131,7 @@ struct bSound* sound_new_file(struct Main *bmain, char* filename) strcpy(str, filename); - path = /*bmain ? bmain->name :*/ G.sce; + path = /*bmain ? bmain->name :*/ G.main->name; BLI_path_abs(str, path); @@ -234,7 +236,7 @@ void sound_delete_cache(struct bSound* sound) } } -void sound_load(struct Main *bmain, struct bSound* sound) +void sound_load(struct Main *UNUSED(bmain), struct bSound* sound) { if(sound) { @@ -264,7 +266,8 @@ void sound_load(struct Main *bmain, struct bSound* sound) if(sound->id.lib) path = sound->id.lib->filepath; else - path = /*bmain ? bmain->name :*/ G.sce; + // XXX this should be fixed! + path = /*bmain ? bmain->name :*/ G.main->name; BLI_path_abs(fullpath, path); diff --git a/source/blender/blenkernel/intern/subsurf_ccg.c b/source/blender/blenkernel/intern/subsurf_ccg.c index 6323e1e3c79..26bd981db4a 100644 --- a/source/blender/blenkernel/intern/subsurf_ccg.c +++ b/source/blender/blenkernel/intern/subsurf_ccg.c @@ -83,13 +83,13 @@ static void *arena_realloc(CCGAllocatorHDL a, void *ptr, int newSize, int oldSiz } return p2; } -static void arena_free(CCGAllocatorHDL a, void *ptr) { +static void arena_free(CCGAllocatorHDL UNUSED(a), void *UNUSED(ptr)) { } static void arena_release(CCGAllocatorHDL a) { BLI_memarena_free(a); } -static CCGSubSurf *_getSubSurf(CCGSubSurf *prevSS, int subdivLevels, int useAging, int useArena, int useFlatSubdiv) { +static CCGSubSurf *_getSubSurf(CCGSubSurf *prevSS, int subdivLevels, int useAging, int useArena, int UNUSED(useFlatSubdiv)) { CCGMeshIFC ifc; CCGSubSurf *ccgSS; @@ -1146,7 +1146,7 @@ static void ccgDM_drawVerts(DerivedMesh *dm) { ccgFaceIterator_free(fi); glEnd(); } -static void ccgDM_drawEdges(DerivedMesh *dm, int drawLooseEdges, int drawAllEdges) { +static void ccgDM_drawEdges(DerivedMesh *dm, int drawLooseEdges, int UNUSED(drawAllEdges)) { CCGDerivedMesh *ccgdm = (CCGDerivedMesh*) dm; CCGSubSurf *ss = ccgdm->ss; CCGEdgeIterator *ei = ccgSubSurf_getEdgeIterator(ss); @@ -1514,7 +1514,7 @@ static void ccgDM_drawFacesGLSL(DerivedMesh *dm, int (*setMaterial)(int, void *a dm->drawMappedFacesGLSL(dm, setMaterial, NULL, NULL); } -static void ccgDM_drawFacesColored(DerivedMesh *dm, int useTwoSided, unsigned char *col1, unsigned char *col2) { +static void ccgDM_drawFacesColored(DerivedMesh *dm, int UNUSED(useTwoSided), unsigned char *col1, unsigned char *col2) { CCGDerivedMesh *ccgdm = (CCGDerivedMesh*) dm; CCGSubSurf *ss = ccgdm->ss; CCGFaceIterator *fi = ccgSubSurf_getFaceIterator(ss); diff --git a/source/blender/blenkernel/intern/text.c b/source/blender/blenkernel/intern/text.c index 19bc853276a..bb1a1a88a09 100644 --- a/source/blender/blenkernel/intern/text.c +++ b/source/blender/blenkernel/intern/text.c @@ -241,7 +241,7 @@ int reopen_text(Text *text) if (!text || !text->name) return 0; BLI_strncpy(str, text->name, FILE_MAXDIR+FILE_MAXFILE); - BLI_path_abs(str, G.sce); + BLI_path_abs(str, G.main->name); fp= fopen(str, "r"); if(fp==NULL) return 0; diff --git a/source/blender/blenkernel/intern/writeavi.c b/source/blender/blenkernel/intern/writeavi.c index 00614ef0f4f..de708f216fd 100644 --- a/source/blender/blenkernel/intern/writeavi.c +++ b/source/blender/blenkernel/intern/writeavi.c @@ -40,6 +40,7 @@ #include "BLI_blenlib.h" #include "BKE_global.h" +#include "BKE_main.h" #include "BKE_report.h" #include "BKE_utildefines.h" #include "BKE_writeavi.h" @@ -119,7 +120,7 @@ static void filepath_avi (char *string, RenderData *rd) if (string==NULL) return; strcpy(string, rd->pic); - BLI_path_abs(string, G.sce); + BLI_path_abs(string, G.main->name); BLI_make_existing_file(string); @@ -137,6 +138,8 @@ static int start_avi(Scene *scene, RenderData *rd, int rectx, int recty, ReportL int quality; double framerate; + (void)scene; /* unused */ + filepath_avi(name, rd); sframe = (rd->sfra); @@ -175,7 +178,7 @@ static int start_avi(Scene *scene, RenderData *rd, int rectx, int recty, ReportL return 1; } -static int append_avi(RenderData *rd, int frame, int *pixels, int rectx, int recty, ReportList *reports) +static int append_avi(RenderData *UNUSED(rd), int frame, int *pixels, int rectx, int recty, ReportList *UNUSED(reports)) { unsigned int *rt1, *rt2, *rectot; int x, y; diff --git a/source/blender/blenkernel/intern/writeffmpeg.c b/source/blender/blenkernel/intern/writeffmpeg.c index 473c10d6ced..aae26da02dd 100644 --- a/source/blender/blenkernel/intern/writeffmpeg.c +++ b/source/blender/blenkernel/intern/writeffmpeg.c @@ -19,7 +19,7 @@ #include <string.h> #include <stdio.h> -#if defined(_WIN32) && defined(_DEBUG) && !defined(__MINGW32__) && !defined(__CYGWIN__) +#if defined(_WIN32) && defined(DEBUG) && !defined(__MINGW32__) && !defined(__CYGWIN__) /* This does not seem necessary or present on MSVC 8, but may be needed in earlier versions? */ #if _MSC_VER < 1400 #include <stdint.h> @@ -857,7 +857,7 @@ void filepath_ffmpeg(char* string, RenderData* rd) { if (!string || !exts) return; strcpy(string, rd->pic); - BLI_path_abs(string, G.sce); + BLI_path_abs(string, G.main->name); BLI_make_existing_file(string); diff --git a/source/blender/blenkernel/intern/writeframeserver.c b/source/blender/blenkernel/intern/writeframeserver.c index b0c05c31fa1..bbc441f3622 100644 --- a/source/blender/blenkernel/intern/writeframeserver.c +++ b/source/blender/blenkernel/intern/writeframeserver.c @@ -47,6 +47,7 @@ #include "DNA_userdef_types.h" +#include "BKE_utildefines.h" #include "BKE_global.h" #include "BKE_report.h" @@ -96,10 +97,12 @@ static int closesocket(int fd) } #endif -int start_frameserver(struct Scene *scene, RenderData *rd, int rectx, int recty, ReportList *reports) +int start_frameserver(struct Scene *scene, RenderData *UNUSED(rd), int rectx, int recty, ReportList *reports) { struct sockaddr_in addr; int arg = 1; + + (void)scene; /* unused */ if (!startup_socket_system()) { BKE_report(reports, RPT_ERROR, "Can't startup socket system"); @@ -243,7 +246,7 @@ static int handle_request(RenderData *rd, char * req) return -1; } -int frameserver_loop(RenderData *rd, ReportList *reports) +int frameserver_loop(RenderData *rd, ReportList *UNUSED(reports)) { fd_set readfds; struct timeval tv; @@ -350,7 +353,7 @@ static void serve_ppm(int *pixels, int rectx, int recty) connsock = -1; } -int append_frameserver(RenderData *rd, int frame, int *pixels, int rectx, int recty, ReportList *reports) +int append_frameserver(RenderData *UNUSED(rd), int frame, int *pixels, int rectx, int recty, ReportList *UNUSED(reports)) { fprintf(stderr, "Serving frame: %d\n", frame); if (write_ppm) { diff --git a/source/blender/blenlib/BLI_bpath.h b/source/blender/blenlib/BLI_bpath.h index 72489a171b9..34b9e282061 100644 --- a/source/blender/blenlib/BLI_bpath.h +++ b/source/blender/blenlib/BLI_bpath.h @@ -50,7 +50,7 @@ struct BPathIterator { void (*setpath_callback)(struct BPathIterator *, char *); void (*getpath_callback)(struct BPathIterator *, char *); - char* base_path; /* base path, the directry the blend file is in - normally G.sce */ + char* base_path; /* base path, the directry the blend file is in - normally G.main->name */ /* only for seq data */ struct BPathIteratorSeqData seqdata; diff --git a/source/blender/blenlib/BLI_math_base.h b/source/blender/blenlib/BLI_math_base.h index 48ad46282c2..77266e2e9d8 100644 --- a/source/blender/blenlib/BLI_math_base.h +++ b/source/blender/blenlib/BLI_math_base.h @@ -70,6 +70,11 @@ extern "C" { #define M_LN10 2.30258509299404568402 #endif +/* non-standard defines, used in some places */ +#ifndef MAXFLOAT +#define MAXFLOAT ((float)3.40282347e+38) +#endif + #ifndef sqrtf #define sqrtf(a) ((float)sqrt(a)) #endif diff --git a/source/blender/blenlib/BLI_math_color.h b/source/blender/blenlib/BLI_math_color.h index 2f40520e59a..2095c40b5aa 100644 --- a/source/blender/blenlib/BLI_math_color.h +++ b/source/blender/blenlib/BLI_math_color.h @@ -61,6 +61,7 @@ void cpack_to_rgb(unsigned int col, float *r, float *g, float *b); void rgb_to_yuv(float r, float g, float b, float *ly, float *lu, float *lv); void rgb_to_ycc(float r, float g, float b, float *ly, float *lcb, float *lcr, int colorspace); void rgb_to_hsv(float r, float g, float b, float *lh, float *ls, float *lv); +void rgb_to_hsv_compat(float r, float g, float b, float *lh, float *ls, float *lv); unsigned int rgb_to_cpack(float r, float g, float b); unsigned int hsv_to_cpack(float h, float s, float v); diff --git a/source/blender/blenlib/BLI_math_matrix.h b/source/blender/blenlib/BLI_math_matrix.h index 77ebcb24975..6b3d8bf9d0b 100644 --- a/source/blender/blenlib/BLI_math_matrix.h +++ b/source/blender/blenlib/BLI_math_matrix.h @@ -102,7 +102,9 @@ void transpose_m3(float R[3][3]); void transpose_m4(float R[4][4]); void normalize_m3(float R[3][3]); +void normalize_m3_m3(float R[3][3], const float A[3][3]); void normalize_m4(float R[4][4]); +void normalize_m4_m4(float R[4][4], const float A[4][4]); void orthogonalize_m3(float R[3][3], int axis); void orthogonalize_m4(float R[4][4], int axis); diff --git a/source/blender/blenlib/BLI_math_vector.h b/source/blender/blenlib/BLI_math_vector.h index b160097a33d..5c17ac6b639 100644 --- a/source/blender/blenlib/BLI_math_vector.h +++ b/source/blender/blenlib/BLI_math_vector.h @@ -129,6 +129,8 @@ MINLINE int compare_len_v3v3(float a[3], float b[3], float limit); MINLINE int compare_v4v4(float a[4], float b[4], float limit); MINLINE int equals_v4v4(float a[4], float b[4]); +MINLINE float line_point_side_v2(const float l1[2], const float l2[2], const float pt[2]); + /********************************** Angles ***********************************/ /* - angle with 2 arguments is angle between vector */ /* - angle with 3 arguments is angle between 3 points at the middle point */ diff --git a/source/blender/blenlib/BLI_scanfill.h b/source/blender/blenlib/BLI_scanfill.h index 0ae40c0b83d..bae5375f757 100644 --- a/source/blender/blenlib/BLI_scanfill.h +++ b/source/blender/blenlib/BLI_scanfill.h @@ -50,7 +50,7 @@ extern "C" { /* scanfill.c: used in displist only... */ struct EditVert *BLI_addfillvert(float *vec); struct EditEdge *BLI_addfilledge(struct EditVert *v1, struct EditVert *v2); -int BLI_edgefill(int mode, int mat_nr); +int BLI_edgefill(int mat_nr); void BLI_end_edgefill(void); /* These callbacks are needed to make the lib finction properly */ diff --git a/source/blender/blenlib/intern/BLI_kdtree.c b/source/blender/blenlib/intern/BLI_kdtree.c index cf94a0c9ffe..0d541c1fe37 100644 --- a/source/blender/blenlib/intern/BLI_kdtree.c +++ b/source/blender/blenlib/intern/BLI_kdtree.c @@ -132,6 +132,7 @@ void BLI_kdtree_balance(KDTree *tree) static float squared_distance(float *v2, float *v1, float *n1, float *n2) { float d[3], dist; + (void)n1; /* unused */ d[0]= v2[0]-v1[0]; d[1]= v2[1]-v1[1]; diff --git a/source/blender/blenlib/intern/bpath.c b/source/blender/blenlib/intern/bpath.c index cf7eb873409..862df4103a7 100644 --- a/source/blender/blenlib/intern/bpath.c +++ b/source/blender/blenlib/intern/bpath.c @@ -92,7 +92,7 @@ void BLI_bpathIterator_init( struct BPathIterator *bpi, char *base_path ) { bpi->seqdata.seqar = NULL; bpi->seqdata.scene = NULL; - bpi->base_path= base_path ? base_path : G.sce; + bpi->base_path= base_path ? base_path : G.main->name; BLI_bpathIterator_step(bpi); } diff --git a/source/blender/blenlib/intern/dynlib.c b/source/blender/blenlib/intern/dynlib.c index 55d6ce7a241..a674f38cec6 100644 --- a/source/blender/blenlib/intern/dynlib.c +++ b/source/blender/blenlib/intern/dynlib.c @@ -122,6 +122,7 @@ void *PIL_dynlib_find_symbol(PILdynlib* lib, char *symname) { } char *PIL_dynlib_get_error_as_string(PILdynlib* lib) { + (void)lib; /* unused */ return dlerror(); } diff --git a/source/blender/blenlib/intern/math_color.c b/source/blender/blenlib/intern/math_color.c index f0ef8b2c93d..c481744156a 100644 --- a/source/blender/blenlib/intern/math_color.c +++ b/source/blender/blenlib/intern/math_color.c @@ -177,13 +177,16 @@ void ycc_to_rgb(float y, float cb, float cr, float *lr, float *lg, float *lb, in void hex_to_rgb(char *hexcol, float *r, float *g, float *b) { unsigned int ri, gi, bi; - + if (hexcol[0] == '#') hexcol++; - - if (sscanf(hexcol, "%02x%02x%02x", &ri, &gi, &bi)) { + + if (sscanf(hexcol, "%02x%02x%02x", &ri, &gi, &bi)==3) { *r = ri / 255.0f; *g = gi / 255.0f; *b = bi / 255.0f; + CLAMP(*r, 0.0f, 1.0f); + CLAMP(*g, 0.0f, 1.0f); + CLAMP(*b, 0.0f, 1.0f); } } @@ -232,6 +235,26 @@ void rgb_to_hsv(float r, float g, float b, float *lh, float *ls, float *lv) *lv = v; } +void rgb_to_hsv_compat(float r, float g, float b, float *lh, float *ls, float *lv) +{ + float orig_h= *lh; + float orig_s= *ls; + + rgb_to_hsv(r, g, b, lh, ls, lv); + + if(*lv <= 0.0f) { + *lh= orig_h; + *ls= orig_s; + } + else if (*ls <= 0.0f) { + *lh= orig_h; + } + + if(*lh==0.0f && orig_h >= 1.0f) { + *lh= 1.0f; + } +} + /*http://brucelindbloom.com/index.html?Eqn_RGB_XYZ_Matrix.html */ void xyz_to_rgb(float xc, float yc, float zc, float *r, float *g, float *b, int colorspace) diff --git a/source/blender/blenlib/intern/math_geom.c b/source/blender/blenlib/intern/math_geom.c index 2aec707b4ea..c2e765388c8 100644 --- a/source/blender/blenlib/intern/math_geom.c +++ b/source/blender/blenlib/intern/math_geom.c @@ -336,20 +336,19 @@ static short IsectLLPt2Df(float x0,float y0,float x1,float y1, return 1; } // end Intersect_Lines -#define SIDE_OF_LINE(pa,pb,pp) ((pa[0]-pp[0])*(pb[1]-pp[1]))-((pb[0]-pp[0])*(pa[1]-pp[1])) /* point in tri */ -// XXX was called IsectPT2Df + int isect_point_tri_v2(float pt[2], float v1[2], float v2[2], float v3[2]) { - if (SIDE_OF_LINE(v1,v2,pt)>=0.0) { - if (SIDE_OF_LINE(v2,v3,pt)>=0.0) { - if (SIDE_OF_LINE(v3,v1,pt)>=0.0) { + if (line_point_side_v2(v1,v2,pt)>=0.0) { + if (line_point_side_v2(v2,v3,pt)>=0.0) { + if (line_point_side_v2(v3,v1,pt)>=0.0) { return 1; } } } else { - if (! (SIDE_OF_LINE(v2,v3,pt)>=0.0)) { - if (! (SIDE_OF_LINE(v3,v1,pt)>=0.0)) { + if (! (line_point_side_v2(v2,v3,pt)>=0.0)) { + if (! (line_point_side_v2(v3,v1,pt)>=0.0)) { return -1; } } @@ -360,18 +359,18 @@ int isect_point_tri_v2(float pt[2], float v1[2], float v2[2], float v3[2]) /* point in quad - only convex quads */ int isect_point_quad_v2(float pt[2], float v1[2], float v2[2], float v3[2], float v4[2]) { - if (SIDE_OF_LINE(v1,v2,pt)>=0.0) { - if (SIDE_OF_LINE(v2,v3,pt)>=0.0) { - if (SIDE_OF_LINE(v3,v4,pt)>=0.0) { - if (SIDE_OF_LINE(v4,v1,pt)>=0.0) { + if (line_point_side_v2(v1,v2,pt)>=0.0) { + if (line_point_side_v2(v2,v3,pt)>=0.0) { + if (line_point_side_v2(v3,v4,pt)>=0.0) { + if (line_point_side_v2(v4,v1,pt)>=0.0) { return 1; } } } } else { - if (! (SIDE_OF_LINE(v2,v3,pt)>=0.0)) { - if (! (SIDE_OF_LINE(v3,v4,pt)>=0.0)) { - if (! (SIDE_OF_LINE(v4,v1,pt)>=0.0)) { + if (! (line_point_side_v2(v2,v3,pt)>=0.0)) { + if (! (line_point_side_v2(v3,v4,pt)>=0.0)) { + if (! (line_point_side_v2(v4,v1,pt)>=0.0)) { return -1; } } diff --git a/source/blender/blenlib/intern/math_matrix.c b/source/blender/blenlib/intern/math_matrix.c index 3b5ffa2d442..9bbd0fc64ac 100644 --- a/source/blender/blenlib/intern/math_matrix.c +++ b/source/blender/blenlib/intern/math_matrix.c @@ -750,6 +750,14 @@ void normalize_m3(float mat[][3]) normalize_v3(mat[2]); } +void normalize_m3_m3(float rmat[][3], const float mat[][3]) +{ + normalize_v3_v3(rmat[0], mat[0]); + normalize_v3_v3(rmat[1], mat[1]); + normalize_v3_v3(rmat[2], mat[2]); +} + + void normalize_m4(float mat[][4]) { float len; @@ -762,6 +770,18 @@ void normalize_m4(float mat[][4]) if(len!=0.0) mat[2][3]/= len; } +void normalize_m4_m4(float rmat[][4], const float mat[][4]) +{ + float len; + + len= normalize_v3_v3(rmat[0], mat[0]); + if(len!=0.0) rmat[0][3]= mat[0][3] / len; + len= normalize_v3_v3(rmat[1], mat[1]); + if(len!=0.0) rmat[1][3]= mat[1][3] / len; + len= normalize_v3_v3(rmat[2], mat[2]); + if(len!=0.0) rmat[2][3]= mat[2][3] / len;; +} + void adjoint_m3_m3(float m1[][3], float m[][3]) { m1[0][0]=m[1][1]*m[2][2]-m[1][2]*m[2][1]; diff --git a/source/blender/blenlib/intern/math_vector_inline.c b/source/blender/blenlib/intern/math_vector_inline.c index 2f75fcead79..a45356f0bde 100644 --- a/source/blender/blenlib/intern/math_vector_inline.c +++ b/source/blender/blenlib/intern/math_vector_inline.c @@ -454,5 +454,11 @@ MINLINE int compare_v4v4(float *v1, float *v2, float limit) return 0; } +MINLINE float line_point_side_v2(const float *l1, const float *l2, const float *pt) +{ + return ((l1[0]-pt[0]) * (l2[1]-pt[1])) - + ((l2[0]-pt[0]) * (l1[1]-pt[1])); +} + #endif /* BLI_MATH_VECTOR_INLINE */ diff --git a/source/blender/blenlib/intern/noise.c b/source/blender/blenlib/intern/noise.c index 141e5438bc9..801130eebc8 100644 --- a/source/blender/blenlib/intern/noise.c +++ b/source/blender/blenlib/intern/noise.c @@ -1052,15 +1052,17 @@ float BLI_hnoisep(float noisesize, float x, float y, float z) /* Camberra omitted, didn't seem useful */ /* distance squared */ -static float dist_Squared(float x, float y, float z, float e) { return (x*x + y*y + z*z); } +static float dist_Squared(float x, float y, float z, float e) { (void)e; return (x*x + y*y + z*z); } /* real distance */ -static float dist_Real(float x, float y, float z, float e) { return sqrt(x*x + y*y + z*z); } +static float dist_Real(float x, float y, float z, float e) { (void)e; return sqrt(x*x + y*y + z*z); } /* manhattan/taxicab/cityblock distance */ -static float dist_Manhattan(float x, float y, float z, float e) { return (fabs(x) + fabs(y) + fabs(z)); } +static float dist_Manhattan(float x, float y, float z, float e) { (void)e; return (fabs(x) + fabs(y) + fabs(z)); } /* Chebychev */ static float dist_Chebychev(float x, float y, float z, float e) { float t; + (void)e; + x = fabs(x); y = fabs(y); z = fabs(z); @@ -1072,12 +1074,14 @@ static float dist_Chebychev(float x, float y, float z, float e) static float dist_MinkovskyH(float x, float y, float z, float e) { float d = sqrt(fabs(x)) + sqrt(fabs(y)) + sqrt(fabs(z)); + (void)e; return (d*d); } /* minkovsky preset exponent 4 */ static float dist_Minkovsky4(float x, float y, float z, float e) { + (void)e; x *= x; y *= y; z *= z; diff --git a/source/blender/blenlib/intern/path_util.c b/source/blender/blenlib/intern/path_util.c index 23972c64ee1..61b525d50af 100644 --- a/source/blender/blenlib/intern/path_util.c +++ b/source/blender/blenlib/intern/path_util.c @@ -1607,7 +1607,7 @@ void BLI_where_am_i(char *fullname, const char *name) } while (temp); } } -#ifndef NDEBUG +#if defined(DEBUG) if (strcmp(name, fullname)) { printf("guessing '%s' == '%s'\n", name, fullname); } @@ -1620,7 +1620,7 @@ void BLI_where_am_i(char *fullname, const char *name) // with spawnv(P_WAIT, bprogname, argv) instead of system() but // that's even uglier GetShortPathName(fullname, fullname, FILE_MAXDIR+FILE_MAXFILE); -#ifndef NDEBUG +#if defined(DEBUG) printf("Shortname = '%s'\n", fullname); #endif #endif diff --git a/source/blender/blenlib/intern/pbvh.c b/source/blender/blenlib/intern/pbvh.c index bd721871f0a..9d126a4a931 100644 --- a/source/blender/blenlib/intern/pbvh.c +++ b/source/blender/blenlib/intern/pbvh.c @@ -1399,7 +1399,7 @@ int BLI_pbvh_node_raycast(PBVH *bvh, PBVHNode *node, float (*origco)[3], //#include <GL/glew.h> -void BLI_pbvh_node_draw(PBVHNode *node, void *data) +void BLI_pbvh_node_draw(PBVHNode *node, void *UNUSED(data)) { #if 0 /* XXX: Just some quick code to show leaf nodes in different colors */ diff --git a/source/blender/blenlib/intern/scanfill.c b/source/blender/blenlib/intern/scanfill.c index 7896ebdd263..85af307be16 100644 --- a/source/blender/blenlib/intern/scanfill.c +++ b/source/blender/blenlib/intern/scanfill.c @@ -747,7 +747,7 @@ static void scanfill(PolyFill *pf, int mat_nr) -int BLI_edgefill(int mode, int mat_nr) +int BLI_edgefill(int mat_nr) { /* - fill works with its own lists, so create that first (no faces!) diff --git a/source/blender/blenlib/intern/threads.c b/source/blender/blenlib/intern/threads.c index 726ed817f8b..eb2057220fe 100644 --- a/source/blender/blenlib/intern/threads.c +++ b/source/blender/blenlib/intern/threads.c @@ -442,6 +442,8 @@ ThreadedWorker *BLI_create_worker(void *(*do_thread)(void *), int tot, int sleep { ThreadedWorker *worker; + (void)sleep_time; /* unused */ + worker = MEM_callocN(sizeof(ThreadedWorker), "threadedworker"); if (tot > RE_MAX_THREAD) diff --git a/source/blender/blenloader/BLO_writefile.h b/source/blender/blenloader/BLO_writefile.h index 182c582cc0f..5758eca6076 100644 --- a/source/blender/blenloader/BLO_writefile.h +++ b/source/blender/blenloader/BLO_writefile.h @@ -36,8 +36,7 @@ struct Main; 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, struct ReportList *reports); +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); #define BLEN_THUMB_SIZE 128 diff --git a/source/blender/blenloader/intern/readblenentry.c b/source/blender/blenloader/intern/readblenentry.c index b637d538b91..c892e8457ca 100644 --- a/source/blender/blenloader/intern/readblenentry.c +++ b/source/blender/blenloader/intern/readblenentry.c @@ -284,7 +284,7 @@ BlendFileData *BLO_read_from_memfile(Main *oldmain, const char *filename, MemFil strcpy(fd->relabase, filename); /* clear ob->proxy_from pointers in old main */ - blo_clear_proxy_pointers_from_lib(fd, oldmain); + blo_clear_proxy_pointers_from_lib(oldmain); /* separate libraries from old main */ blo_split_main(&mainlist, oldmain); diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index 0d401298420..04304339385 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -705,7 +705,7 @@ BHead *blo_firstbhead(FileData *fd) return(bhead); } -BHead *blo_prevbhead(FileData *fd, BHead *thisblock) +BHead *blo_prevbhead(FileData *UNUSED(fd), BHead *thisblock) { BHeadN *bheadn= (BHeadN *) (((char *) thisblock) - GET_INT_FROM_POINTER( &((BHeadN*)0)->bhead) ); BHeadN *prev= bheadn->prev; @@ -1156,7 +1156,7 @@ static void change_idid_adr(ListBase *mainlist, FileData *basefd, void *old, voi * to clear that pointer before reading the undo memfile since * the object might be removed, it is set again in reading * if the local object still exists */ -void blo_clear_proxy_pointers_from_lib(FileData *fd, Main *oldmain) +void blo_clear_proxy_pointers_from_lib(Main *oldmain) { Object *ob= oldmain->object.first; @@ -1385,8 +1385,8 @@ static void test_pointer_array(FileData *fd, void **mat) /* ************ READ ID Properties *************** */ -void IDP_DirectLinkProperty(IDProperty *prop, int switch_endian, FileData *fd); -void IDP_LibLinkProperty(IDProperty *prop, int switch_endian, FileData *fd); +static void IDP_DirectLinkProperty(IDProperty *prop, int switch_endian, FileData *fd); +static void IDP_LibLinkProperty(IDProperty *prop, int switch_endian, FileData *fd); static void IDP_DirectLinkIDPArray(IDProperty *prop, int switch_endian, FileData *fd) { @@ -1443,7 +1443,7 @@ static void IDP_DirectLinkArray(IDProperty *prop, int switch_endian, FileData *f } } -static void IDP_DirectLinkString(IDProperty *prop, int switch_endian, FileData *fd) +static void IDP_DirectLinkString(IDProperty *prop, FileData *fd) { /*since we didn't save the extra string buffer, set totallen to len.*/ prop->totallen = prop->len; @@ -1470,7 +1470,7 @@ void IDP_DirectLinkProperty(IDProperty *prop, int switch_endian, FileData *fd) IDP_DirectLinkGroup(prop, switch_endian, fd); break; case IDP_STRING: - IDP_DirectLinkString(prop, switch_endian, fd); + IDP_DirectLinkString(prop, fd); break; case IDP_ARRAY: IDP_DirectLinkArray(prop, switch_endian, fd); @@ -1500,7 +1500,7 @@ void IDP_DirectLinkProperty(IDProperty *prop, int switch_endian, FileData *fd) } /*stub function*/ -void IDP_LibLinkProperty(IDProperty *prop, int switch_endian, FileData *fd) +void IDP_LibLinkProperty(IDProperty *UNUSED(prop), int UNUSED(switch_endian), FileData *UNUSED(fd)) { } @@ -1553,7 +1553,7 @@ static void direct_link_brush(FileData *fd, Brush *brush) brush->icon_imbuf= NULL; } -static void direct_link_script(FileData *fd, Script *script) +static void direct_link_script(FileData *UNUSED(fd), Script *script) { script->id.us = 1; SCRIPT_SET_NULL(script) @@ -2031,7 +2031,7 @@ static void lib_link_nodetree(FileData *fd, Main *main) /* verify types for nodes and groups, all data has to be read */ /* open = 0: appending/linking, open = 1: open new file (need to clean out dynamic * typedefs*/ -static void lib_verify_nodetree(Main *main, int open) +static void lib_verify_nodetree(Main *main, int UNUSED(open)) { Scene *sce; Material *ma; @@ -2140,7 +2140,7 @@ typedef struct tConstraintLinkData { ID *id; } tConstraintLinkData; /* callback function used to relink constraint ID-links */ -static void lib_link_constraint_cb(bConstraint *con, ID **idpoin, void *userdata) +static void lib_link_constraint_cb(bConstraint *UNUSED(con), ID **idpoin, void *userdata) { tConstraintLinkData *cld= (tConstraintLinkData *)userdata; *idpoin = newlibadr(cld->fd, cld->id->lib, *idpoin); @@ -2535,7 +2535,7 @@ static void direct_link_world(FileData *fd, World *wrld) /* ************ READ VFONT ***************** */ -static void lib_link_vfont(FileData *fd, Main *main) +static void lib_link_vfont(FileData *UNUSED(fd), Main *main) { VFont *vf; @@ -2556,7 +2556,7 @@ static void direct_link_vfont(FileData *fd, VFont *vf) /* ************ READ TEXT ****************** */ -static void lib_link_text(FileData *fd, Main *main) +static void lib_link_text(FileData *UNUSED(fd), Main *main) { Text *text; @@ -4659,6 +4659,7 @@ static void lib_link_screen(FileData *fd, Main *main) SpaceText *st= (SpaceText *)sl; st->text= newlibadr(fd, sc->id.lib, st->text); + st->drawcache= NULL; } else if(sl->spacetype==SPACE_SCRIPT) { @@ -4890,6 +4891,8 @@ void lib_link_screen_restore(Main *newmain, bScreen *curscreen, Scene *curscene) st->text= restore_pointer_by_name(newmain, (ID *)st->text, 1); if(st->text==NULL) st->text= newmain->text.first; + + st->drawcache= NULL; } else if(sl->spacetype==SPACE_SCRIPT) { SpaceScript *scpt= (SpaceScript *)sl; @@ -5271,7 +5274,7 @@ static void direct_link_library(FileData *fd, Library *lib, Main *main) lib->parent= NULL; } -static void lib_link_library(FileData *fd, Main *main) +static void lib_link_library(FileData *UNUSED(fd), Main *main) { Library *lib; for(lib= main->library.first; lib; lib= lib->id.next) { @@ -6619,7 +6622,7 @@ static void do_version_mtex_factor_2_50(MTex **mtex_array, short idtype) } } -static void do_version_mdef_250(FileData *fd, Library *lib, Main *main) +static void do_version_mdef_250(Main *main) { Object *ob; ModifierData *md; @@ -9853,7 +9856,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main) { char str[FILE_MAX]; BLI_join_dirfile(str, seq->strip->dir, seq->strip->stripdata->name); - BLI_path_abs(str, G.sce); + BLI_path_abs(str, G.main->name); seq->sound = sound_new_file(main, str); } /* don't know, if anybody used that @@ -11045,7 +11048,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main) } } - do_version_mdef_250(fd, lib, main); + do_version_mdef_250(main); /* parent type to modifier */ for(ob = main->object.first; ob; ob = ob->id.next) { @@ -11438,7 +11441,7 @@ BlendFileData *blo_read_file_internal(FileData *fd, const char *filename) lib_link_all(fd, bfd->main); //do_versions_after_linking(fd, NULL, bfd->main); // XXX: not here (or even in this function at all)! this causes crashes on many files - Aligorith (July 04, 2010) - lib_verify_nodetree(bfd->main, 1); + lib_verify_nodetree(bfd->main, TRUE); fix_relpaths_library(fd->relabase, bfd->main); /* make all relative paths, relative to the open blend file */ link_global(fd, bfd); /* as last */ @@ -11923,7 +11926,7 @@ typedef struct tConstraintExpandData { Main *mainvar; } tConstraintExpandData; /* callback function used to expand constraint ID-links */ -static void expand_constraint_cb(bConstraint *con, ID **idpoin, void *userdata) +static void expand_constraint_cb(bConstraint *UNUSED(con), ID **idpoin, void *userdata) { tConstraintExpandData *ced= (tConstraintExpandData *)userdata; expand_doit(ced->fd, ced->mainvar, *idpoin); @@ -12539,7 +12542,7 @@ static Main* library_append_begin(const bContext *C, FileData **fd, char *dir) blo_split_main(&(*fd)->mainlist, mainvar); /* which one do we need? */ - mainl = blo_find_main(*fd, &(*fd)->mainlist, dir, G.sce); + mainl = blo_find_main(*fd, &(*fd)->mainlist, dir, G.main->name); /* needed for do_version */ mainl->versionfile= (*fd)->fileversion; @@ -12623,7 +12626,7 @@ static void library_append_end(const bContext *C, Main *mainl, FileData **fd, in BLI_strncpy(curlib->name, curlib->filepath, sizeof(curlib->name)); /* uses current .blend file as reference */ - BLI_path_rel(curlib->name, G.sce); + BLI_path_rel(curlib->name, G.main->name); } blo_join_main(&(*fd)->mainlist); @@ -12631,8 +12634,8 @@ static void library_append_end(const bContext *C, Main *mainl, FileData **fd, in mainl= NULL; /* blo_join_main free's mainl, cant use anymore */ lib_link_all(*fd, mainvar); - lib_verify_nodetree(mainvar, 0); - fix_relpaths_library(G.sce, mainvar); /* make all relative paths, relative to the open blend file */ + lib_verify_nodetree(mainvar, FALSE); + fix_relpaths_library(G.main->name, mainvar); /* make all relative paths, relative to the open blend file */ /* give a base to loose objects. If group append, do it for objects too */ if(scene) { @@ -12748,7 +12751,7 @@ static void read_libraries(FileData *basefd, ListBase *mainlist) while(fd==NULL) { char newlib_path[240] = { 0 }; printf("Missing library...'\n"); - printf(" current file: %s\n", G.sce); + printf(" current file: %s\n", G.main->name); printf(" absolute lib: %s\n", mainptr->curlib->filepath); printf(" relative lib: %s\n", mainptr->curlib->name); printf(" enter a new path:\n"); @@ -12756,7 +12759,7 @@ static void read_libraries(FileData *basefd, ListBase *mainlist) if(scanf("%s", newlib_path) > 0) { strcpy(mainptr->curlib->name, newlib_path); strcpy(mainptr->curlib->filepath, newlib_path); - cleanup_path(G.sce, mainptr->curlib->filepath); + cleanup_path(G.main->name, mainptr->curlib->filepath); fd= blo_openblenderfile(mainptr->curlib->filepath, basefd->reports); diff --git a/source/blender/blenloader/intern/readfile.h b/source/blender/blenloader/intern/readfile.h index 8e391fa438e..ed89e93d66a 100644 --- a/source/blender/blenloader/intern/readfile.h +++ b/source/blender/blenloader/intern/readfile.h @@ -114,7 +114,7 @@ FileData *blo_openblenderfile(char *name, struct ReportList *reports); FileData *blo_openblendermemory(void *buffer, int buffersize, struct ReportList *reports); FileData *blo_openblendermemfile(struct MemFile *memfile, struct ReportList *reports); -void blo_clear_proxy_pointers_from_lib(FileData *fd, Main *oldmain); +void blo_clear_proxy_pointers_from_lib(Main *oldmain); void blo_make_image_pointer_map(FileData *fd, Main *oldmain); void blo_end_image_pointer_map(FileData *fd, Main *oldmain); void blo_add_library_pointer_map(ListBase *mainlist, FileData *fd); diff --git a/source/blender/blenloader/intern/writefile.c b/source/blender/blenloader/intern/writefile.c index 9d94b639f73..55d83fea970 100644 --- a/source/blender/blenloader/intern/writefile.c +++ b/source/blender/blenloader/intern/writefile.c @@ -2610,14 +2610,14 @@ int BLO_write_file(Main *mainvar, char *dir, int write_flags, ReportList *report if(strcmp(dir1, dir2)==0) write_flags &= ~G_FILE_RELATIVE_REMAP; else - makeFilesAbsolute(G.sce, NULL); + makeFilesAbsolute(G.main->name, NULL); } - BLI_make_file_string(G.sce, userfilename, BLI_get_folder_create(BLENDER_USER_CONFIG, NULL), BLENDER_STARTUP_FILE); + BLI_make_file_string(G.main->name, userfilename, BLI_get_folder_create(BLENDER_USER_CONFIG, NULL), BLENDER_STARTUP_FILE); write_user_block= BLI_streq(dir, userfilename); if(write_flags & G_FILE_RELATIVE_REMAP) - makeFilesRelative(dir, NULL); /* note, making relative to something OTHER then G.sce */ + makeFilesRelative(dir, NULL); /* note, making relative to something OTHER then G.main->name */ /* actual file writing */ err= write_file_handle(mainvar, file, NULL,NULL, write_user_block, write_flags, thumb); @@ -2669,7 +2669,7 @@ int BLO_write_file(Main *mainvar, char *dir, int write_flags, ReportList *report } /* return: success (1) */ -int BLO_write_file_mem(Main *mainvar, MemFile *compare, MemFile *current, int write_flags, ReportList *reports) +int BLO_write_file_mem(Main *mainvar, MemFile *compare, MemFile *current, int write_flags) { int err; diff --git a/source/blender/blenpluginapi/iff.h b/source/blender/blenpluginapi/iff.h index b8628b00575..668d14508ec 100644 --- a/source/blender/blenpluginapi/iff.h +++ b/source/blender/blenpluginapi/iff.h @@ -81,7 +81,7 @@ typedef struct ImBuf { int refcounter; /* reference counter for multiple users */ } ImBuf; -LIBIMPORT struct ImBuf *allocImBuf(short,short,uchar,uint,uchar); +LIBIMPORT struct ImBuf *allocImBuf(short,short,uchar,uint); LIBIMPORT struct ImBuf *dupImBuf(struct ImBuf *); LIBIMPORT void freeImBuf(struct ImBuf*); diff --git a/source/blender/blenpluginapi/intern/pluginapi.c b/source/blender/blenpluginapi/intern/pluginapi.c index 9e739f7927d..a12488ae868 100644 --- a/source/blender/blenpluginapi/intern/pluginapi.c +++ b/source/blender/blenpluginapi/intern/pluginapi.c @@ -101,10 +101,9 @@ LIBEXPORT void freeT(void *vmemh) LIBEXPORT struct ImBuf *allocImBuf(short x, short y, uchar d, - uint flags, - uchar bitmap) + uint flags) { - return IMB_allocImBuf(x, y, d, flags, bitmap); + return IMB_allocImBuf(x, y, d, flags); } diff --git a/source/blender/collada/CameraExporter.cpp b/source/blender/collada/CameraExporter.cpp index c3a6cda8b3c..d5e2a7e116c 100644 --- a/source/blender/collada/CameraExporter.cpp +++ b/source/blender/collada/CameraExporter.cpp @@ -68,7 +68,7 @@ void CamerasExporter::operator()(Object *ob, Scene *sce) if (cam->type == CAM_PERSP) { COLLADASW::PerspectiveOptic persp(mSW); persp.setXFov(lens_to_angle(cam->lens)*(180.0f/M_PI)); - persp.setAspectRatio(1.0); + persp.setAspectRatio((float)(sce->r.xsch)/(float)(sce->r.ysch)); persp.setZFar(cam->clipend); persp.setZNear(cam->clipsta); COLLADASW::Camera ccam(mSW, &persp, cam_id, cam_name); @@ -77,7 +77,7 @@ void CamerasExporter::operator()(Object *ob, Scene *sce) else { COLLADASW::OrthographicOptic ortho(mSW); ortho.setXMag(cam->ortho_scale); - ortho.setAspectRatio(1.0); + ortho.setAspectRatio((float)(sce->r.xsch)/(float)(sce->r.ysch)); ortho.setZFar(cam->clipend); ortho.setZNear(cam->clipsta); COLLADASW::Camera ccam(mSW, &ortho, cam_id, cam_name); diff --git a/source/blender/collada/DocumentExporter.cpp b/source/blender/collada/DocumentExporter.cpp index cbcb3984018..9062bd4ba9f 100644 --- a/source/blender/collada/DocumentExporter.cpp +++ b/source/blender/collada/DocumentExporter.cpp @@ -69,6 +69,8 @@ extern char build_rev[]; #include "BLI_string.h" #include "BLI_listbase.h" +#include "RNA_access.h" + #include "COLLADASWAsset.h" #include "COLLADASWLibraryVisualScenes.h" #include "COLLADASWNode.h" @@ -901,19 +903,66 @@ protected: void DocumentExporter::exportCurrentScene(Scene *sce, const char* filename) { + PointerRNA sceneptr, unit_settings; + PropertyRNA *system, *scale; + clear_global_id_map(); COLLADABU::NativeString native_filename = COLLADABU::NativeString(std::string(filename)); COLLADASW::StreamWriter sw(native_filename); - // open <Collada> + // open <collada> sw.startDocument(); // <asset> COLLADASW::Asset asset(&sw); - // XXX ask blender devs about this? - asset.setUnit("decimetre", 0.1); + + RNA_id_pointer_create(&(sce->id), &sceneptr); + unit_settings = RNA_pointer_get(&sceneptr, "unit_settings"); + system = RNA_struct_find_property(&unit_settings, "system"); + //scale = RNA_struct_find_property(&unit_settings, "scale_length"); + + std::string unitname = "meter"; + float linearmeasure = 1.0f; + + linearmeasure = RNA_float_get(&unit_settings, "scale_length"); + + switch(RNA_property_enum_get(&unit_settings, system)) { + case USER_UNIT_NONE: + case USER_UNIT_METRIC: + if(linearmeasure == 0.001f) { + unitname = "millimeter"; + } + else if(linearmeasure == 0.01f) { + unitname = "centimeter"; + } + else if(linearmeasure == 0.1f) { + unitname = "decimeter"; + } + else if(linearmeasure == 1.0f) { + unitname = "meter"; + } + else if(linearmeasure == 1000.0f) { + unitname = "kilometer"; + } + break; + case USER_UNIT_IMPERIAL: + if(linearmeasure == 0.0254f) { + unitname = "inch"; + } + else if(linearmeasure == 0.3048f) { + unitname = "foot"; + } + else if(linearmeasure == 0.9144f) { + unitname = "yard"; + } + break; + default: + break; + } + + asset.setUnit(unitname, linearmeasure); asset.setUpAxisType(COLLADASW::Asset::Z_UP); // TODO: need an Author field in userpref if(strlen(U.author) > 0) { diff --git a/source/blender/collada/DocumentImporter.cpp b/source/blender/collada/DocumentImporter.cpp index a406845c8a2..bc5653c8c45 100644 --- a/source/blender/collada/DocumentImporter.cpp +++ b/source/blender/collada/DocumentImporter.cpp @@ -29,9 +29,6 @@ #include <map> #include <algorithm> // sort() -#include <math.h> -#include <float.h> - #include "COLLADAFWRoot.h" #include "COLLADAFWIWriter.h" #include "COLLADAFWStableHeaders.h" @@ -67,6 +64,7 @@ #include "BKE_image.h" #include "BLI_listbase.h" +#include "BLI_math.h" #include "BLI_string.h" #include "DNA_camera_types.h" @@ -809,7 +807,7 @@ public: BLI_split_dirfile(filename, dir, NULL); BLI_join_dirfile(full_path, dir, filepath.c_str()); - Image *ima = BKE_add_image_file(full_path, 0); + Image *ima = BKE_add_image_file(full_path); if (!ima) { fprintf(stderr, "Cannot create image. \n"); return true; @@ -841,6 +839,38 @@ public: lamp->g = col.getGreen(); lamp->b = col.getBlue(); } + float constatt = light->getConstantAttenuation().getValue(); + float linatt = light->getLinearAttenuation().getValue(); + float quadatt = light->getQuadraticAttenuation().getValue(); + float d = 25.0f; + float att1 = 0.0f; + float att2 = 0.0f; + + float e = 1.0f/constatt; + + /* NOTE: We assume for now that inv square is used for quadratic light + * and inv linear for linear light. Exported blender lin/quad weighted + * most likely will result in wrong import. */ + /* quadratic light */ + if(IS_EQ(linatt, 0.0f) && quadatt > 0.0f) { + //quadatt = att2/(d*d*(e*2)); + float invquadatt = 1.0f/quadatt; + float d2 = invquadatt / (2 * e); + d = sqrtf(d2); + } + // linear light + else if(IS_EQ(quadatt, 0.0f) && linatt > 0.0f) { + //linatt = att1/(d*e); + float invlinatt = 1.0f/linatt; + d = invlinatt / e; + } else { + printf("no linear nor quad light, using defaults for attenuation, import will be incorrect: Lamp %s\n", lamp->id.name); + att2 = 1.0f; + } + + lamp->dist = d; + lamp->energy = e; + COLLADAFW::Light::LightType type = light->getLightType(); switch(type) { case COLLADAFW::Light::AMBIENT_LIGHT: @@ -851,9 +881,9 @@ public: case COLLADAFW::Light::SPOT_LIGHT: { lamp->type = LA_SPOT; - lamp->falloff_type = LA_FALLOFF_SLIDERS; - lamp->att1 = light->getLinearAttenuation().getValue(); - lamp->att2 = light->getQuadraticAttenuation().getValue(); + lamp->falloff_type = LA_FALLOFF_INVSQUARE; + lamp->att1 = att1; + lamp->att2 = att2; lamp->spotsize = light->getFallOffAngle().getValue(); lamp->spotblend = light->getFallOffExponent().getValue(); } @@ -866,8 +896,9 @@ public: case COLLADAFW::Light::POINT_LIGHT: { lamp->type = LA_LOCAL; - lamp->att1 = light->getLinearAttenuation().getValue(); - lamp->att2 = light->getQuadraticAttenuation().getValue(); + lamp->falloff_type = LA_FALLOFF_INVSQUARE; + lamp->att1 = att1; + lamp->att2 = att2; } break; case COLLADAFW::Light::UNDEFINED: diff --git a/source/blender/collada/ImageExporter.cpp b/source/blender/collada/ImageExporter.cpp index ce40846ba59..3194b2269ea 100644 --- a/source/blender/collada/ImageExporter.cpp +++ b/source/blender/collada/ImageExporter.cpp @@ -32,6 +32,7 @@ #include "DNA_texture_types.h" #include "BKE_global.h" +#include "BKE_main.h" #include "BKE_utildefines.h" #include "BLI_fileops.h" #include "BLI_path_util.h" @@ -66,13 +67,13 @@ void ImagesExporter::operator()(Material *ma, Object *ob) BLI_split_dirfile(mfilename, dir, NULL); - BKE_rebase_path(abs, sizeof(abs), rel, sizeof(rel), G.sce, image->name, dir); + BKE_rebase_path(abs, sizeof(abs), rel, sizeof(rel), G.main->name, image->name, dir); if (abs[0] != '\0') { // make absolute source path BLI_strncpy(src, image->name, sizeof(src)); - BLI_path_abs(src, G.sce); + BLI_path_abs(src, G.main->name); // make dest directory if it doesn't exist BLI_make_existing_file(abs); diff --git a/source/blender/collada/LightExporter.cpp b/source/blender/collada/LightExporter.cpp index 7327b309889..5786c682d6a 100644 --- a/source/blender/collada/LightExporter.cpp +++ b/source/blender/collada/LightExporter.cpp @@ -30,6 +30,8 @@ #include "DNA_lamp_types.h" +#include "BLI_math.h" + #include "LightExporter.h" #include "collada_internal.h" @@ -48,6 +50,7 @@ void forEachLampObjectInScene(Scene *sce, Functor &f) } LightsExporter::LightsExporter(COLLADASW::StreamWriter *sw): COLLADASW::LibraryLights(sw){} + void LightsExporter::exportLights(Scene *sce) { openLibrary(); @@ -62,18 +65,45 @@ void LightsExporter::operator()(Object *ob) std::string la_id(get_light_id(ob)); std::string la_name(id_name(la)); COLLADASW::Color col(la->r, la->g, la->b); - float e = la->energy; + float att1, att2; + float e, d, constatt, linatt, quadatt; + att1 = att2 = 0.0f; + + if(la->falloff_type==LA_FALLOFF_INVLINEAR) { + att1 = 1.0f; + att2 = 0.0f; + } + else if(la->falloff_type==LA_FALLOFF_INVSQUARE) { + att1 = 0.0f; + att2 = 1.0f; + } + else if(la->falloff_type==LA_FALLOFF_SLIDERS) { + att1 = la->att1; + att2 = la->att2; + } + + e = la->energy; + d = la->dist; + + constatt = linatt = quadatt = MAXFLOAT; + if(e > 0.0f) { + constatt = 1.0f/e; + linatt = att1/(d*e); + quadatt = att2/(d*d*(e*2)); + } // sun if (la->type == LA_SUN) { COLLADASW::DirectionalLight cla(mSW, la_id, la_name, e); cla.setColor(col); + cla.setConstantAttenuation(constatt); addLight(cla); } // hemi else if (la->type == LA_HEMI) { COLLADASW::AmbientLight cla(mSW, la_id, la_name, e); cla.setColor(col); + cla.setConstantAttenuation(constatt); addLight(cla); } // spot @@ -82,16 +112,18 @@ void LightsExporter::operator()(Object *ob) cla.setColor(col); cla.setFallOffAngle(la->spotsize); cla.setFallOffExponent(la->spotblend); - cla.setLinearAttenuation(la->att1); - cla.setQuadraticAttenuation(la->att2); + cla.setConstantAttenuation(constatt); + cla.setLinearAttenuation(linatt); + cla.setQuadraticAttenuation(quadatt); addLight(cla); } // lamp else if (la->type == LA_LOCAL) { COLLADASW::PointLight cla(mSW, la_id, la_name, e); cla.setColor(col); - cla.setLinearAttenuation(la->att1); - cla.setQuadraticAttenuation(la->att2); + cla.setConstantAttenuation(constatt); + cla.setLinearAttenuation(linatt); + cla.setQuadraticAttenuation(quadatt); addLight(cla); } // area lamp is not supported @@ -99,8 +131,9 @@ void LightsExporter::operator()(Object *ob) else { COLLADASW::PointLight cla(mSW, la_id, la_name, e); cla.setColor(col); - cla.setLinearAttenuation(la->att1); - cla.setQuadraticAttenuation(la->att2); + cla.setConstantAttenuation(constatt); + cla.setLinearAttenuation(linatt); + cla.setQuadraticAttenuation(quadatt); addLight(cla); } } diff --git a/source/blender/editors/animation/anim_channels_defines.c b/source/blender/editors/animation/anim_channels_defines.c index dbd13e9188f..a471879540c 100644 --- a/source/blender/editors/animation/anim_channels_defines.c +++ b/source/blender/editors/animation/anim_channels_defines.c @@ -90,7 +90,7 @@ /* Draw Backdrop ---------------------------------- */ /* get backdrop color for top-level widgets (Scene and Object only) */ -static void acf_generic_root_color(bAnimContext *ac, bAnimListElem *ale, float *color) +static void acf_generic_root_color(bAnimContext *UNUSED(ac), bAnimListElem *UNUSED(ale), float *color) { /* darker blue for top-level widgets */ UI_GetThemeColor3fv(TH_DOPESHEET_CHANNELOB, color); @@ -116,7 +116,7 @@ static void acf_generic_root_backdrop(bAnimContext *ac, bAnimListElem *ale, floa /* get backdrop color for data expanders under top-level Scene/Object */ -static void acf_generic_dataexpand_color(bAnimContext *ac, bAnimListElem *ale, float *color) +static void acf_generic_dataexpand_color(bAnimContext *UNUSED(ac), bAnimListElem *UNUSED(ale), float *color) { /* lighter color than top-level widget */ UI_GetThemeColor3fv(TH_DOPESHEET_CHANNELSUBOB, color); @@ -203,11 +203,11 @@ static void acf_generic_channel_backdrop(bAnimContext *ac, bAnimListElem *ale, f /* Indention + Offset ------------------------------------------- */ /* indention level is always the value in the name */ -static short acf_generic_indention_0(bAnimContext *ac, bAnimListElem *ale) +static short acf_generic_indention_0(bAnimContext *UNUSED(ac), bAnimListElem *UNUSED(ale)) { return 0; } -static short acf_generic_indention_1(bAnimContext *ac, bAnimListElem *ale) +static short acf_generic_indention_1(bAnimContext *UNUSED(ac), bAnimListElem *UNUSED(ale)) { return 1; } @@ -219,7 +219,7 @@ static short acf_generic_indention_2(bAnimContext *ac, bAnimListElem *ale) #endif /* indention which varies with the grouping status */ -static short acf_generic_indention_flexible(bAnimContext *ac, bAnimListElem *ale) +static short acf_generic_indention_flexible(bAnimContext *UNUSED(ac), bAnimListElem *ale) { short indent= 0; @@ -353,7 +353,7 @@ static void *acf_generic_dsexpand_setting_ptr(bAnimListElem *ale, int setting, s } /* check if some setting exists for this object-based data-expander (datablock only) */ -static short acf_generic_dataexpand_setting_valid(bAnimContext *ac, bAnimListElem *ale, int setting) +static short acf_generic_dataexpand_setting_valid(bAnimContext *ac, bAnimListElem *UNUSED(ale), int setting) { switch (setting) { /* expand is always supported */ @@ -376,7 +376,7 @@ static short acf_generic_dataexpand_setting_valid(bAnimContext *ac, bAnimListEle /* Animation Summary ----------------------------------- */ /* get backdrop color for summary widget */ -static void acf_summary_color(bAnimContext *ac, bAnimListElem *ale, float *color) +static void acf_summary_color(bAnimContext *UNUSED(ac), bAnimListElem *UNUSED(ale), float *color) { // FIXME: hardcoded color - same as the 'action' line in NLA // reddish color @@ -405,27 +405,27 @@ static void acf_summary_backdrop(bAnimContext *ac, bAnimListElem *ale, float ymi } /* name for summary entries */ -static void acf_summary_name(bAnimListElem *ale, char *name) +static void acf_summary_name(bAnimListElem *UNUSED(ale), char *name) { if (name) strcpy(name, "DopeSheet Summary"); } // TODO: this is really a temp icon I think -static int acf_summary_icon(bAnimListElem *ale) +static int acf_summary_icon(bAnimListElem *UNUSED(ale)) { return ICON_BORDERMOVE; } /* check if some setting exists for this channel */ -static short acf_summary_setting_valid(bAnimContext *ac, bAnimListElem *ale, int setting) +static short acf_summary_setting_valid(bAnimContext *UNUSED(ac), bAnimListElem *UNUSED(ale), int setting) { /* only expanded is supported, as it is used for hiding all stuff which the summary covers */ return (setting == ACHANNEL_SETTING_EXPAND); } /* get the appropriate flag(s) for the setting when it is valid */ -static int acf_summary_setting_flag(bAnimContext *ac, int setting, short *neg) +static int acf_summary_setting_flag(bAnimContext *UNUSED(ac), int setting, short *neg) { if (setting == ACHANNEL_SETTING_EXPAND) { /* expanded */ @@ -482,13 +482,13 @@ static bAnimChannelType ACF_SUMMARY = /* Scene ------------------------------------------- */ // TODO: just get this from RNA? -static int acf_scene_icon(bAnimListElem *ale) +static int acf_scene_icon(bAnimListElem *UNUSED(ale)) { return ICON_SCENE_DATA; } /* check if some setting exists for this channel */ -static short acf_scene_setting_valid(bAnimContext *ac, bAnimListElem *ale, int setting) +static short acf_scene_setting_valid(bAnimContext *ac, bAnimListElem *UNUSED(ale), int setting) { switch (setting) { /* muted only in NLA */ @@ -510,7 +510,7 @@ static short acf_scene_setting_valid(bAnimContext *ac, bAnimListElem *ale, int s } /* get the appropriate flag(s) for the setting when it is valid */ -static int acf_scene_setting_flag(bAnimContext *ac, int setting, short *neg) +static int acf_scene_setting_flag(bAnimContext *UNUSED(ac), int setting, short *neg) { /* clear extra return data first */ *neg= 0; @@ -653,7 +653,7 @@ static short acf_object_setting_valid(bAnimContext *ac, bAnimListElem *ale, int } /* get the appropriate flag(s) for the setting when it is valid */ -static int acf_object_setting_flag(bAnimContext *ac, int setting, short *neg) +static int acf_object_setting_flag(bAnimContext *UNUSED(ac), int setting, short *neg) { /* clear extra return data first */ *neg= 0; @@ -727,7 +727,7 @@ static bAnimChannelType ACF_OBJECT = /* Group ------------------------------------------- */ /* get backdrop color for group widget */ -static void acf_group_color(bAnimContext *ac, bAnimListElem *ale, float *color) +static void acf_group_color(bAnimContext *UNUSED(ac), bAnimListElem *ale, float *color) { /* highlight only for action group channels */ if (ale->flag & AGRP_ACTIVE) @@ -765,7 +765,7 @@ static void acf_group_name(bAnimListElem *ale, char *name) } /* check if some setting exists for this channel */ -static short acf_group_setting_valid(bAnimContext *ac, bAnimListElem *ale, int setting) +static short acf_group_setting_valid(bAnimContext *ac, bAnimListElem *UNUSED(ale), int setting) { /* for now, all settings are supported, though some are only conditionally */ switch (setting) { @@ -815,7 +815,7 @@ static int acf_group_setting_flag(bAnimContext *ac, int setting, short *neg) } /* get pointer to the setting */ -static void *acf_group_setting_ptr(bAnimListElem *ale, int setting, short *type) +static void *acf_group_setting_ptr(bAnimListElem *ale, int UNUSED(setting), short *type) { bActionGroup *agrp= (bActionGroup *)ale->data; @@ -876,7 +876,7 @@ static short acf_fcurve_setting_valid(bAnimContext *ac, bAnimListElem *ale, int } /* get the appropriate flag(s) for the setting when it is valid */ -static int acf_fcurve_setting_flag(bAnimContext *ac, int setting, short *neg) +static int acf_fcurve_setting_flag(bAnimContext *UNUSED(ac), int setting, short *neg) { /* clear extra return data first */ *neg= 0; @@ -901,7 +901,7 @@ static int acf_fcurve_setting_flag(bAnimContext *ac, int setting, short *neg) } /* get pointer to the setting */ -static void *acf_fcurve_setting_ptr(bAnimListElem *ale, int setting, short *type) +static void *acf_fcurve_setting_ptr(bAnimListElem *ale, int UNUSED(setting), short *type) { FCurve *fcu= (FCurve *)ale->data; @@ -930,13 +930,13 @@ static bAnimChannelType ACF_FCURVE = /* Object Action Expander ------------------------------------------- */ // TODO: just get this from RNA? -static int acf_fillactd_icon(bAnimListElem *ale) +static int acf_fillactd_icon(bAnimListElem *UNUSED(ale)) { return ICON_ACTION; } /* check if some setting exists for this channel */ -static short acf_fillactd_setting_valid(bAnimContext *ac, bAnimListElem *ale, int setting) +static short acf_fillactd_setting_valid(bAnimContext *UNUSED(ac), bAnimListElem *UNUSED(ale), int setting) { switch (setting) { /* only select and expand supported */ @@ -950,7 +950,7 @@ static short acf_fillactd_setting_valid(bAnimContext *ac, bAnimListElem *ale, in } /* get the appropriate flag(s) for the setting when it is valid */ -static int acf_fillactd_setting_flag(bAnimContext *ac, int setting, short *neg) +static int acf_fillactd_setting_flag(bAnimContext *UNUSED(ac), int setting, short *neg) { /* clear extra return data first */ *neg= 0; @@ -1014,19 +1014,19 @@ static bAnimChannelType ACF_FILLACTD = /* Drivers Expander ------------------------------------------- */ // TODO: just get this from RNA? -static int acf_filldrivers_icon(bAnimListElem *ale) +static int acf_filldrivers_icon(bAnimListElem *UNUSED(ale)) { return ICON_ANIM_DATA; } -static void acf_filldrivers_name(bAnimListElem *ale, char *name) +static void acf_filldrivers_name(bAnimListElem *UNUSED(ale), char *name) { strcpy(name, "Drivers"); } /* check if some setting exists for this channel */ // TODO: this could be made more generic -static short acf_filldrivers_setting_valid(bAnimContext *ac, bAnimListElem *ale, int setting) +static short acf_filldrivers_setting_valid(bAnimContext *UNUSED(ac), bAnimListElem *UNUSED(ale), int setting) { switch (setting) { /* only expand supported */ @@ -1039,7 +1039,7 @@ static short acf_filldrivers_setting_valid(bAnimContext *ac, bAnimListElem *ale, } /* get the appropriate flag(s) for the setting when it is valid */ -static int acf_filldrivers_setting_flag(bAnimContext *ac, int setting, short *neg) +static int acf_filldrivers_setting_flag(bAnimContext *UNUSED(ac), int setting, short *neg) { /* clear extra return data first */ *neg= 0; @@ -1092,18 +1092,18 @@ static bAnimChannelType ACF_FILLDRIVERS = /* Materials Expander ------------------------------------------- */ // TODO: just get this from RNA? -static int acf_fillmatd_icon(bAnimListElem *ale) +static int acf_fillmatd_icon(bAnimListElem *UNUSED(ale)) { return ICON_MATERIAL_DATA; } -static void acf_fillmatd_name(bAnimListElem *ale, char *name) +static void acf_fillmatd_name(bAnimListElem *UNUSED(ale), char *name) { strcpy(name, "Materials"); } /* get the appropriate flag(s) for the setting when it is valid */ -static int acf_fillmatd_setting_flag(bAnimContext *ac, int setting, short *neg) +static int acf_fillmatd_setting_flag(bAnimContext *UNUSED(ac), int setting, short *neg) { /* clear extra return data first */ *neg= 0; @@ -1138,18 +1138,18 @@ static bAnimChannelType ACF_FILLMATD= /* Particles Expander ------------------------------------------- */ // TODO: just get this from RNA? -static int acf_fillpartd_icon(bAnimListElem *ale) +static int acf_fillpartd_icon(bAnimListElem *UNUSED(ale)) { return ICON_PARTICLE_DATA; } -static void acf_fillpartd_name(bAnimListElem *ale, char *name) +static void acf_fillpartd_name(bAnimListElem *UNUSED(ale), char *name) { strcpy(name, "Particles"); } /* get the appropriate flag(s) for the setting when it is valid */ -static int acf_fillpartd_setting_flag(bAnimContext *ac, int setting, short *neg) +static int acf_fillpartd_setting_flag(bAnimContext *UNUSED(ac), int setting, short *neg) { /* clear extra return data first */ *neg= 0; @@ -1206,12 +1206,12 @@ static short acf_filltexd_offset(bAnimContext *ac, bAnimListElem *ale) } // TODO: just get this from RNA? -static int acf_filltexd_icon(bAnimListElem *ale) +static int acf_filltexd_icon(bAnimListElem *UNUSED(ale)) { return ICON_TEXTURE_DATA; } -static void acf_filltexd_name(bAnimListElem *ale, char *name) +static void acf_filltexd_name(bAnimListElem *UNUSED(ale), char *name) { strcpy(name, "Textures"); } @@ -1254,7 +1254,7 @@ static void *acf_filltexd_setting_ptr(bAnimListElem *ale, int setting, short *ty } /* get the appropriate flag(s) for the setting when it is valid */ -static int acf_filltexd_setting_flag(bAnimContext *ac, int setting, short *neg) +static int acf_filltexd_setting_flag(bAnimContext *UNUSED(ac), int setting, short *neg) { /* clear extra return data first */ *neg= 0; @@ -1290,19 +1290,19 @@ static bAnimChannelType ACF_FILLTEXD= /* Material Expander ------------------------------------------- */ // TODO: just get this from RNA? -static int acf_dsmat_icon(bAnimListElem *ale) +static int acf_dsmat_icon(bAnimListElem *UNUSED(ale)) { return ICON_MATERIAL_DATA; } /* offset for material expanders */ -static short acf_dsmat_offset(bAnimContext *ac, bAnimListElem *ale) +static short acf_dsmat_offset(bAnimContext *UNUSED(ac), bAnimListElem *UNUSED(ale)) { return 21; } /* get the appropriate flag(s) for the setting when it is valid */ -static int acf_dsmat_setting_flag(bAnimContext *ac, int setting, short *neg) +static int acf_dsmat_setting_flag(bAnimContext *UNUSED(ac), int setting, short *neg) { /* clear extra return data first */ *neg= 0; @@ -1372,13 +1372,13 @@ static bAnimChannelType ACF_DSMAT= /* Lamp Expander ------------------------------------------- */ // TODO: just get this from RNA? -static int acf_dslam_icon(bAnimListElem *ale) +static int acf_dslam_icon(bAnimListElem *UNUSED(ale)) { return ICON_LAMP_DATA; } /* get the appropriate flag(s) for the setting when it is valid */ -static int acf_dslam_setting_flag(bAnimContext *ac, int setting, short *neg) +static int acf_dslam_setting_flag(bAnimContext *UNUSED(ac), int setting, short *neg) { /* clear extra return data first */ *neg= 0; @@ -1448,13 +1448,13 @@ static bAnimChannelType ACF_DSLAM= /* Texture Expander ------------------------------------------- */ // TODO: just get this from RNA? -static int acf_dstex_icon(bAnimListElem *ale) +static int acf_dstex_icon(bAnimListElem *UNUSED(ale)) { return ICON_TEXTURE_DATA; } /* offset for texture expanders */ -static short acf_dstex_offset(bAnimContext *ac, bAnimListElem *ale) +static short acf_dstex_offset(bAnimContext *UNUSED(ac), bAnimListElem *ale) { short offset = 21; @@ -1473,7 +1473,7 @@ static short acf_dstex_offset(bAnimContext *ac, bAnimListElem *ale) } /* get the appropriate flag(s) for the setting when it is valid */ -static int acf_dstex_setting_flag(bAnimContext *ac, int setting, short *neg) +static int acf_dstex_setting_flag(bAnimContext *UNUSED(ac), int setting, short *neg) { /* clear extra return data first */ *neg= 0; @@ -1543,13 +1543,13 @@ static bAnimChannelType ACF_DSTEX= /* Camera Expander ------------------------------------------- */ // TODO: just get this from RNA? -static int acf_dscam_icon(bAnimListElem *ale) +static int acf_dscam_icon(bAnimListElem *UNUSED(ale)) { return ICON_CAMERA_DATA; } /* get the appropriate flag(s) for the setting when it is valid */ -static int acf_dscam_setting_flag(bAnimContext *ac, int setting, short *neg) +static int acf_dscam_setting_flag(bAnimContext *UNUSED(ac), int setting, short *neg) { /* clear extra return data first */ *neg= 0; @@ -1635,7 +1635,7 @@ static int acf_dscur_icon(bAnimListElem *ale) } /* get the appropriate flag(s) for the setting when it is valid */ -static int acf_dscur_setting_flag(bAnimContext *ac, int setting, short *neg) +static int acf_dscur_setting_flag(bAnimContext *UNUSED(ac), int setting, short *neg) { /* clear extra return data first */ *neg= 0; @@ -1705,13 +1705,13 @@ static bAnimChannelType ACF_DSCUR= /* Shape Key Expander ------------------------------------------- */ // TODO: just get this from RNA? -static int acf_dsskey_icon(bAnimListElem *ale) +static int acf_dsskey_icon(bAnimListElem *UNUSED(ale)) { return ICON_SHAPEKEY_DATA; } /* get the appropriate flag(s) for the setting when it is valid */ -static int acf_dsskey_setting_flag(bAnimContext *ac, int setting, short *neg) +static int acf_dsskey_setting_flag(bAnimContext *UNUSED(ac), int setting, short *neg) { /* clear extra return data first */ *neg= 0; @@ -1781,13 +1781,13 @@ static bAnimChannelType ACF_DSSKEY= /* World Expander ------------------------------------------- */ // TODO: just get this from RNA? -static int acf_dswor_icon(bAnimListElem *ale) +static int acf_dswor_icon(bAnimListElem *UNUSED(ale)) { return ICON_WORLD_DATA; } /* get the appropriate flag(s) for the setting when it is valid */ -static int acf_dswor_setting_flag(bAnimContext *ac, int setting, short *neg) +static int acf_dswor_setting_flag(bAnimContext *UNUSED(ac), int setting, short *neg) { /* clear extra return data first */ *neg= 0; @@ -1857,13 +1857,13 @@ static bAnimChannelType ACF_DSWOR= /* Particle Expander ------------------------------------------- */ // TODO: just get this from RNA? -static int acf_dspart_icon(bAnimListElem *ale) +static int acf_dspart_icon(bAnimListElem *UNUSED(ale)) { return ICON_PARTICLE_DATA; } /* get the appropriate flag(s) for the setting when it is valid */ -static int acf_dspart_setting_flag(bAnimContext *ac, int setting, short *neg) +static int acf_dspart_setting_flag(bAnimContext *UNUSED(ac), int setting, short *neg) { /* clear extra return data first */ *neg= 0; @@ -1933,13 +1933,13 @@ static bAnimChannelType ACF_DSPART= /* MetaBall Expander ------------------------------------------- */ // TODO: just get this from RNA? -static int acf_dsmball_icon(bAnimListElem *ale) +static int acf_dsmball_icon(bAnimListElem *UNUSED(ale)) { return ICON_META_DATA; } /* get the appropriate flag(s) for the setting when it is valid */ -static int acf_dsmball_setting_flag(bAnimContext *ac, int setting, short *neg) +static int acf_dsmball_setting_flag(bAnimContext *UNUSED(ac), int setting, short *neg) { /* clear extra return data first */ *neg= 0; @@ -2009,13 +2009,13 @@ static bAnimChannelType ACF_DSMBALL= /* Armature Expander ------------------------------------------- */ // TODO: just get this from RNA? -static int acf_dsarm_icon(bAnimListElem *ale) +static int acf_dsarm_icon(bAnimListElem *UNUSED(ale)) { return ICON_ARMATURE_DATA; } /* get the appropriate flag(s) for the setting when it is valid */ -static int acf_dsarm_setting_flag(bAnimContext *ac, int setting, short *neg) +static int acf_dsarm_setting_flag(bAnimContext *UNUSED(ac), int setting, short *neg) { /* clear extra return data first */ *neg= 0; @@ -2085,13 +2085,13 @@ static bAnimChannelType ACF_DSARM= /* NodeTree Expander ------------------------------------------- */ // TODO: just get this from RNA? -static int acf_dsntree_icon(bAnimListElem *ale) +static int acf_dsntree_icon(bAnimListElem *UNUSED(ale)) { return ICON_NODETREE; } /* get the appropriate flag(s) for the setting when it is valid */ -static int acf_dsntree_setting_flag(bAnimContext *ac, int setting, short *neg) +static int acf_dsntree_setting_flag(bAnimContext *UNUSED(ac), int setting, short *neg) { /* clear extra return data first */ *neg= 0; @@ -2237,13 +2237,13 @@ static bAnimChannelType ACF_DSLINESTYLE= /* Mesh Expander ------------------------------------------- */ // TODO: just get this from RNA? -static int acf_dsmesh_icon(bAnimListElem *ale) +static int acf_dsmesh_icon(bAnimListElem *UNUSED(ale)) { return ICON_MESH_DATA; } /* get the appropriate flag(s) for the setting when it is valid */ -static int acf_dsmesh_setting_flag(bAnimContext *ac, int setting, short *neg) +static int acf_dsmesh_setting_flag(bAnimContext *UNUSED(ac), int setting, short *neg) { /* clear extra return data first */ *neg= 0; @@ -2328,7 +2328,7 @@ static void acf_shapekey_name(bAnimListElem *ale, char *name) } /* check if some setting exists for this channel */ -static short acf_shapekey_setting_valid(bAnimContext *ac, bAnimListElem *ale, int setting) +static short acf_shapekey_setting_valid(bAnimContext *UNUSED(ac), bAnimListElem *UNUSED(ale), int setting) { switch (setting) { case ACHANNEL_SETTING_SELECT: /* selected */ @@ -2343,7 +2343,7 @@ static short acf_shapekey_setting_valid(bAnimContext *ac, bAnimListElem *ale, in } /* get the appropriate flag(s) for the setting when it is valid */ -static int acf_shapekey_setting_flag(bAnimContext *ac, int setting, short *neg) +static int acf_shapekey_setting_flag(bAnimContext *UNUSED(ac), int setting, short *neg) { /* clear extra return data first */ *neg= 0; @@ -2929,7 +2929,7 @@ void ANIM_channel_draw (bAnimContext *ac, bAnimListElem *ale, float yminc, float /* ------------------ */ /* callback for (normal) widget settings - send notifiers */ -static void achannel_setting_widget_cb(bContext *C, void *poin, void *poin2) +static void achannel_setting_widget_cb(bContext *C, void *UNUSED(arg1), void *UNUSED(arg2)) { WM_event_add_notifier(C, NC_ANIMATION|ND_ANIMCHAN|NA_EDITED, NULL); } diff --git a/source/blender/editors/animation/anim_channels_edit.c b/source/blender/editors/animation/anim_channels_edit.c index a40beeaa0f8..9464f6b2768 100644 --- a/source/blender/editors/animation/anim_channels_edit.c +++ b/source/blender/editors/animation/anim_channels_edit.c @@ -924,7 +924,7 @@ void ANIM_OT_channels_move_bottom (wmOperatorType *ot) /* ******************** Delete Channel Operator *********************** */ -static int animchannels_delete_exec(bContext *C, wmOperator *op) +static int animchannels_delete_exec(bContext *C, wmOperator *UNUSED(op)) { bAnimContext ac; ListBase anim_data = {NULL, NULL}; @@ -1025,7 +1025,7 @@ void ANIM_OT_channels_delete (wmOperatorType *ot) /* ******************** Set Channel Visibility Operator *********************** */ /* NOTE: this operator is only valid in the Graph Editor channels region */ -static int animchannels_visibility_set_exec(bContext *C, wmOperator *op) +static int animchannels_visibility_set_exec(bContext *C, wmOperator *UNUSED(op)) { bAnimContext ac; ListBase anim_data = {NULL, NULL}; @@ -1103,7 +1103,7 @@ void ANIM_OT_channels_visibility_set (wmOperatorType *ot) /* ******************** Toggle Channel Visibility Operator *********************** */ /* NOTE: this operator is only valid in the Graph Editor channels region */ -static int animchannels_visibility_toggle_exec(bContext *C, wmOperator *op) +static int animchannels_visibility_toggle_exec(bContext *C, wmOperator *UNUSED(op)) { bAnimContext ac; ListBase anim_data = {NULL, NULL}; @@ -1630,7 +1630,7 @@ void ANIM_OT_channels_select_border(wmOperatorType *ot) /* ******************** Mouse-Click Operator *********************** */ /* Handle selection changes due to clicking on channels. Settings will get caught by UI code... */ -static int mouse_anim_channels (bAnimContext *ac, float x, int channel_index, short selectmode) +static int mouse_anim_channels (bAnimContext *ac, float UNUSED(x), int channel_index, short selectmode) { ListBase anim_data = {NULL, NULL}; bAnimListElem *ale; diff --git a/source/blender/editors/animation/anim_deps.c b/source/blender/editors/animation/anim_deps.c index 5312e97c604..ed23e72b328 100644 --- a/source/blender/editors/animation/anim_deps.c +++ b/source/blender/editors/animation/anim_deps.c @@ -96,7 +96,7 @@ void ANIM_list_elem_update(Scene *scene, bAnimListElem *ale) /* tags the given ID block for refreshes (if applicable) due to * Animation Editor editing */ -void ANIM_id_update(Scene *scene, ID *id) +void ANIM_id_update(Scene *UNUSED(scene), ID *id) { if (id) { AnimData *adt= BKE_animdata_from_id(id); @@ -121,7 +121,7 @@ void ANIM_id_update(Scene *scene, ID *id) */ /* perform syncing updates for Action Groups */ -static void animchan_sync_group (bAnimContext *ac, bAnimListElem *ale) +static void animchan_sync_group (bAnimContext *UNUSED(ac), bAnimListElem *ale) { bActionGroup *agrp= (bActionGroup *)ale->data; ID *owner_id= ale->id; @@ -154,7 +154,7 @@ static void animchan_sync_group (bAnimContext *ac, bAnimListElem *ale) } /* perform syncing updates for F-Curves */ -static void animchan_sync_fcurve (bAnimContext *ac, bAnimListElem *ale) +static void animchan_sync_fcurve (bAnimContext *UNUSED(ac), bAnimListElem *ale) { FCurve *fcu= (FCurve *)ale->data; ID *owner_id= ale->id; diff --git a/source/blender/editors/animation/anim_draw.c b/source/blender/editors/animation/anim_draw.c index b564780f6c0..373ad5472ab 100644 --- a/source/blender/editors/animation/anim_draw.c +++ b/source/blender/editors/animation/anim_draw.c @@ -256,7 +256,7 @@ void ANIM_draw_cfra (const bContext *C, View2D *v2d, short flag) /* Draw current frame number in a little box */ if (flag & DRAWCFRA_SHOW_NUMBOX) { - UI_view2d_view_orthoSpecial(C, v2d, 1); + UI_view2d_view_orthoSpecial(CTX_wm_region(C), v2d, 1); draw_cfra_number(scene, v2d, vec[0], (flag & DRAWCFRA_UNIT_SECONDS)); } } diff --git a/source/blender/editors/animation/anim_filter.c b/source/blender/editors/animation/anim_filter.c index c768020a0ff..4647d2a5a2e 100644 --- a/source/blender/editors/animation/anim_filter.c +++ b/source/blender/editors/animation/anim_filter.c @@ -92,7 +92,7 @@ /* Get shapekey data being edited (for Action Editor -> ShapeKey mode) */ /* Note: there's a similar function in key.c (ob_get_key) */ -Key *actedit_get_shapekeys (bAnimContext *ac, SpaceAction *saction) +static Key *actedit_get_shapekeys (bAnimContext *ac) { Scene *scene= ac->scene; Object *ob; @@ -154,7 +154,7 @@ static short actedit_get_context (bAnimContext *ac, SpaceAction *saction) case SACTCONT_SHAPEKEY: /* 'ShapeKey Editor' */ ac->datatype= ANIMCONT_SHAPEKEY; - ac->data= actedit_get_shapekeys(ac, saction); + ac->data= actedit_get_shapekeys(ac); ac->mode= saction->mode; return 1; @@ -1079,7 +1079,7 @@ static int animdata_filter_action (bAnimContext *ac, ListBase *anim_data, bDopeS * - for normal filtering (i.e. for editing), we only need the NLA-tracks but they can be in 'normal' evaluation * order, i.e. first to last. Otherwise, some tools may get screwed up. */ -static int animdata_filter_nla (bAnimContext *ac, ListBase *anim_data, bDopeSheet *ads, AnimData *adt, int filter_mode, void *owner, short ownertype, ID *owner_id) +static int animdata_filter_nla (bAnimContext *UNUSED(ac), ListBase *anim_data, bDopeSheet *UNUSED(ads), AnimData *adt, int filter_mode, void *owner, short ownertype, ID *owner_id) { bAnimListElem *ale; NlaTrack *nlt; diff --git a/source/blender/editors/animation/anim_markers.c b/source/blender/editors/animation/anim_markers.c index 5c4d231fd3a..055ee1c3392 100644 --- a/source/blender/editors/animation/anim_markers.c +++ b/source/blender/editors/animation/anim_markers.c @@ -336,7 +336,7 @@ void draw_markers_time(const bContext *C, int flag) /* ************************** add markers *************************** */ /* add TimeMarker at curent frame */ -static int ed_marker_add(bContext *C, wmOperator *op) +static int ed_marker_add(bContext *C, wmOperator *UNUSED(op)) { ListBase *markers= context_get_markers(C); TimeMarker *marker; @@ -489,7 +489,7 @@ static int ed_marker_move_invoke(bContext *C, wmOperator *op, wmEvent *evt) } /* note, init has to be called succesfully */ -static void ed_marker_move_apply(bContext *C, wmOperator *op) +static void ed_marker_move_apply(wmOperator *op) { MarkerMove *mm= op->customdata; TimeMarker *marker; @@ -508,7 +508,7 @@ static void ed_marker_move_apply(bContext *C, wmOperator *op) static void ed_marker_move_cancel(bContext *C, wmOperator *op) { RNA_int_set(op->ptr, "frames", 0); - ed_marker_move_apply(C, op); + ed_marker_move_apply(op); ed_marker_move_exit(C, op); WM_event_add_notifier(C, NC_SCENE|ND_MARKERS, NULL); @@ -565,7 +565,7 @@ static int ed_marker_move_modal(bContext *C, wmOperator *op, wmEvent *evt) offs= (int)fac; RNA_int_set(op->ptr, "frames", offs); - ed_marker_move_apply(C, op); + ed_marker_move_apply(op); /* cruft below is for header print */ for (a=0, marker= mm->markers->first; marker; marker= marker->next) { @@ -632,7 +632,7 @@ static int ed_marker_move_modal(bContext *C, wmOperator *op, wmEvent *evt) outputNumInput(&mm->num, str_tx); RNA_int_set(op->ptr, "frames", vec[0]); - ed_marker_move_apply(C, op); + 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); @@ -649,7 +649,7 @@ static int ed_marker_move_modal(bContext *C, wmOperator *op, wmEvent *evt) static int ed_marker_move_exec(bContext *C, wmOperator *op) { if(ed_marker_move_init(C, op)) { - ed_marker_move_apply(C, op); + ed_marker_move_apply(op); ed_marker_move_exit(C, op); return OPERATOR_FINISHED; } @@ -697,7 +697,7 @@ callbacks: /* duplicate selected TimeMarkers */ -static void ed_marker_duplicate_apply(bContext *C, wmOperator *op) +static void ed_marker_duplicate_apply(bContext *C) { ListBase *markers= context_get_markers(C); TimeMarker *marker, *newmarker; @@ -731,7 +731,7 @@ static void ed_marker_duplicate_apply(bContext *C, wmOperator *op) static int ed_marker_duplicate_exec(bContext *C, wmOperator *op) { - ed_marker_duplicate_apply(C, op); + ed_marker_duplicate_apply(C); ed_marker_move_exec(C, op); /* assumes frs delta set */ return OPERATOR_FINISHED; @@ -740,7 +740,7 @@ static int ed_marker_duplicate_exec(bContext *C, wmOperator *op) static int ed_marker_duplicate_invoke(bContext *C, wmOperator *op, wmEvent *evt) { - ed_marker_duplicate_apply(C, op); + ed_marker_duplicate_apply(C); return ed_marker_move_invoke(C, op, evt); } @@ -1033,7 +1033,7 @@ static void MARKER_OT_select_all(wmOperatorType *ot) /* ******************************* remove marker ***************** */ /* remove selected TimeMarkers */ -static int ed_marker_delete_exec(bContext *C, wmOperator *op) +static int ed_marker_delete_exec(bContext *C, wmOperator *UNUSED(op)) { ListBase *markers= context_get_markers(C); TimeMarker *marker, *nmarker; @@ -1130,7 +1130,7 @@ static void MARKER_OT_make_links_scene(wmOperatorType *ot) /* ******************************* camera bind marker ***************** */ /* remove selected TimeMarkers */ -static int ed_marker_camera_bind_exec(bContext *C, wmOperator *op) +static int ed_marker_camera_bind_exec(bContext *C, wmOperator *UNUSED(op)) { Scene *scene= CTX_data_scene(C); ListBase *markers= context_get_markers(C); diff --git a/source/blender/editors/animation/anim_ops.c b/source/blender/editors/animation/anim_ops.c index 9b9c9435518..a80ea3e12bf 100644 --- a/source/blender/editors/animation/anim_ops.c +++ b/source/blender/editors/animation/anim_ops.c @@ -233,7 +233,7 @@ void ANIM_OT_previewrange_set(wmOperatorType *ot) /* ****************** clear preview range operator ****************************/ -static int previewrange_clear_exec(bContext *C, wmOperator *op) +static int previewrange_clear_exec(bContext *C, wmOperator *UNUSED(op)) { Scene *scene= CTX_data_scene(C); ScrArea *curarea= CTX_wm_area(C); @@ -269,7 +269,7 @@ void ANIM_OT_previewrange_clear(wmOperatorType *ot) /* ****************** time display toggle operator ****************************/ -static int toggle_time_exec(bContext *C, wmOperator *op) +static int toggle_time_exec(bContext *C, wmOperator *UNUSED(op)) { ScrArea *curarea= CTX_wm_area(C); diff --git a/source/blender/editors/animation/drivers.c b/source/blender/editors/animation/drivers.c index 898d7db89fc..6ace48dd301 100644 --- a/source/blender/editors/animation/drivers.c +++ b/source/blender/editors/animation/drivers.c @@ -115,7 +115,7 @@ FCurve *verify_driver_fcurve (ID *id, const char rna_path[], const int array_ind /* Main Driver Management API calls: * Add a new driver for the specified property on the given ID block */ -short ANIM_add_driver (ID *id, const char rna_path[], int array_index, short flag, int type) +short ANIM_add_driver (ID *id, const char rna_path[], int array_index, short UNUSED(flag), int type) { PointerRNA id_ptr, ptr; PropertyRNA *prop; @@ -193,7 +193,7 @@ short ANIM_add_driver (ID *id, const char rna_path[], int array_index, short fla /* Main Driver Management API calls: * Remove the driver for the specified property on the given ID block (if available) */ -short ANIM_remove_driver (struct ID *id, const char rna_path[], int array_index, short flag) +short ANIM_remove_driver (struct ID *id, const char rna_path[], int array_index, short UNUSED(flag)) { AnimData *adt; FCurve *fcu; @@ -262,7 +262,7 @@ short ANIM_driver_can_paste (void) /* Main Driver Management API calls: * Make a copy of the driver for the specified property on the given ID block */ -short ANIM_copy_driver (ID *id, const char rna_path[], int array_index, short flag) +short ANIM_copy_driver (ID *id, const char rna_path[], int array_index, short UNUSED(flag)) { PointerRNA id_ptr, ptr; PropertyRNA *prop; @@ -307,7 +307,7 @@ short ANIM_copy_driver (ID *id, const char rna_path[], int array_index, short fl * Add a new driver for the specified property on the given ID block or replace an existing one * with the driver + driver-curve data from the buffer */ -short ANIM_paste_driver (ID *id, const char rna_path[], int array_index, short flag) +short ANIM_paste_driver (ID *id, const char rna_path[], int array_index, short UNUSED(flag)) { PointerRNA id_ptr, ptr; PropertyRNA *prop; @@ -472,7 +472,7 @@ void ANIM_OT_driver_button_remove (wmOperatorType *ot) /* Copy Driver Button Operator ------------------------ */ -static int copy_driver_button_exec (bContext *C, wmOperator *op) +static int copy_driver_button_exec (bContext *C, wmOperator *UNUSED(op)) { PointerRNA ptr; PropertyRNA *prop= NULL; @@ -518,7 +518,7 @@ void ANIM_OT_copy_driver_button (wmOperatorType *ot) /* Paste Driver Button Operator ------------------------ */ -static int paste_driver_button_exec (bContext *C, wmOperator *op) +static int paste_driver_button_exec (bContext *C, wmOperator *UNUSED(op)) { PointerRNA ptr; PropertyRNA *prop= NULL; diff --git a/source/blender/editors/animation/fmodifier_ui.c b/source/blender/editors/animation/fmodifier_ui.c index 35e6cb66d45..2b8d0f35b9a 100644 --- a/source/blender/editors/animation/fmodifier_ui.c +++ b/source/blender/editors/animation/fmodifier_ui.c @@ -74,7 +74,7 @@ } /* callback to verify modifier data */ -static void validate_fmodifier_cb (bContext *C, void *fcm_v, void *dummy) +static void validate_fmodifier_cb (bContext *UNUSED(C), void *fcm_v, void *UNUSED(arg)) { FModifier *fcm= (FModifier *)fcm_v; FModifierTypeInfo *fmi= fmodifier_get_typeinfo(fcm); @@ -215,7 +215,7 @@ static void draw_modifier__generator(uiLayout *layout, ID *id, FModifier *fcm, s /* --------------- */ /* draw settings for generator modifier */ -static void draw_modifier__fn_generator(uiLayout *layout, ID *id, FModifier *fcm, short width) +static void draw_modifier__fn_generator(uiLayout *layout, ID *id, FModifier *fcm, short UNUSED(width)) { uiLayout *col; PointerRNA ptr; @@ -238,7 +238,7 @@ static void draw_modifier__fn_generator(uiLayout *layout, ID *id, FModifier *fcm /* --------------- */ /* draw settings for cycles modifier */ -static void draw_modifier__cycles(uiLayout *layout, ID *id, FModifier *fcm, short width) +static void draw_modifier__cycles(uiLayout *layout, ID *id, FModifier *fcm, short UNUSED(width)) { uiLayout *split, *col; PointerRNA ptr; @@ -267,7 +267,7 @@ static void draw_modifier__cycles(uiLayout *layout, ID *id, FModifier *fcm, shor /* --------------- */ /* draw settings for noise modifier */ -static void draw_modifier__noise(uiLayout *layout, ID *id, FModifier *fcm, short width) +static void draw_modifier__noise(uiLayout *layout, ID *id, FModifier *fcm, short UNUSED(width)) { uiLayout *split, *col; PointerRNA ptr; @@ -374,7 +374,7 @@ static int binarysearch_fcm_envelopedata_index (FCM_EnvelopeData array[], float /* callback to add new envelope data point */ // TODO: should we have a separate file for things like this? -static void fmod_envelope_addpoint_cb (bContext *C, void *fcm_dv, void *dummy) +static void fmod_envelope_addpoint_cb (bContext *C, void *fcm_dv, void *UNUSED(arg)) { Scene *scene= CTX_data_scene(C); FMod_Envelope *env= (FMod_Envelope *)fcm_dv; @@ -426,7 +426,7 @@ static void fmod_envelope_addpoint_cb (bContext *C, void *fcm_dv, void *dummy) /* callback to remove envelope data point */ // TODO: should we have a separate file for things like this? -static void fmod_envelope_deletepoint_cb (bContext *C, void *fcm_dv, void *ind_v) +static void fmod_envelope_deletepoint_cb (bContext *UNUSED(C), void *fcm_dv, void *ind_v) { FMod_Envelope *env= (FMod_Envelope *)fcm_dv; FCM_EnvelopeData *fedn; @@ -454,7 +454,7 @@ static void fmod_envelope_deletepoint_cb (bContext *C, void *fcm_dv, void *ind_v } /* draw settings for envelope modifier */ -static void draw_modifier__envelope(uiLayout *layout, ID *id, FModifier *fcm, short width) +static void draw_modifier__envelope(uiLayout *layout, ID *id, FModifier *fcm, short UNUSED(width)) { FMod_Envelope *env= (FMod_Envelope *)fcm->data; FCM_EnvelopeData *fed; @@ -509,7 +509,7 @@ static void draw_modifier__envelope(uiLayout *layout, ID *id, FModifier *fcm, sh /* --------------- */ /* draw settings for limits modifier */ -static void draw_modifier__limits(uiLayout *layout, ID *id, FModifier *fcm, short width) +static void draw_modifier__limits(uiLayout *layout, ID *id, FModifier *fcm, short UNUSED(width)) { uiLayout *split, *col, *row; PointerRNA ptr; @@ -557,7 +557,7 @@ static void draw_modifier__limits(uiLayout *layout, ID *id, FModifier *fcm, shor /* --------------- */ /* draw settings for stepped interpolation modifier */ -static void draw_modifier__stepped(uiLayout *layout, ID *id, FModifier *fcm, short width) +static void draw_modifier__stepped(uiLayout *layout, ID *id, FModifier *fcm, short UNUSED(width)) { uiLayout *col, *subcol; PointerRNA ptr; diff --git a/source/blender/editors/animation/keyframes_draw.c b/source/blender/editors/animation/keyframes_draw.c index 545b8462d4c..0a20ff931bc 100644 --- a/source/blender/editors/animation/keyframes_draw.c +++ b/source/blender/editors/animation/keyframes_draw.c @@ -656,7 +656,7 @@ void draw_gpl_channel(View2D *v2d, bDopeSheet *ads, bGPDlayer *gpl, float ypos) BLI_dlrbTree_init(&keys); - gpl_to_keylist(ads, gpl, &keys, NULL); + gpl_to_keylist(ads, gpl, &keys); BLI_dlrbTree_linkedlist_sync(&keys); @@ -916,7 +916,7 @@ void action_to_keylist(AnimData *adt, bAction *act, DLRBT_Tree *keys, DLRBT_Tree } -void gpl_to_keylist(bDopeSheet *ads, bGPDlayer *gpl, DLRBT_Tree *keys, DLRBT_Tree *blocks) +void gpl_to_keylist(bDopeSheet *UNUSED(ads), bGPDlayer *gpl, DLRBT_Tree *keys) { bGPDframe *gpf; ActKeyColumn *ak; diff --git a/source/blender/editors/animation/keyframes_edit.c b/source/blender/editors/animation/keyframes_edit.c index 03bb8da529f..a1c02f922f2 100644 --- a/source/blender/editors/animation/keyframes_edit.c +++ b/source/blender/editors/animation/keyframes_edit.c @@ -388,7 +388,7 @@ static short scene_keyframes_loop(KeyframeEditData *ked, Scene *sce, KeyframeEdi } /* This function is used to loop over the keyframe data in a DopeSheet summary */ -static short summary_keyframes_loop(KeyframeEditData *ked, bAnimContext *ac, KeyframeEditFunc key_ok, KeyframeEditFunc key_cb, FcuEditFunc fcu_cb, int filterflag) +static short summary_keyframes_loop(KeyframeEditData *ked, bAnimContext *ac, KeyframeEditFunc key_ok, KeyframeEditFunc key_cb, FcuEditFunc fcu_cb, int UNUSED(filterflag)) { ListBase anim_data = {NULL, NULL}; bAnimListElem *ale; @@ -560,7 +560,7 @@ static short ok_bezier_framerange(KeyframeEditData *ked, BezTriple *bezt) return ok; } -static short ok_bezier_selected(KeyframeEditData *ked, BezTriple *bezt) +static short ok_bezier_selected(KeyframeEditData *UNUSED(ked), BezTriple *bezt) { /* this macro checks all beztriple handles for selection... * only one of the verts has to be selected for this to be ok... @@ -696,7 +696,7 @@ void bezt_remap_times(KeyframeEditData *ked, BezTriple *bezt) /* Transform */ /* snaps the keyframe to the nearest frame */ -static short snap_bezier_nearest(KeyframeEditData *ked, BezTriple *bezt) +static short snap_bezier_nearest(KeyframeEditData *UNUSED(ked), BezTriple *bezt) { if (bezt->f2 & SELECT) bezt->vec[1][0]= (float)(floor(bezt->vec[1][0]+0.5)); @@ -732,7 +732,7 @@ static short snap_bezier_nearmarker(KeyframeEditData *ked, BezTriple *bezt) } /* make the handles have the same value as the key */ -static short snap_bezier_horizontal(KeyframeEditData *ked, BezTriple *bezt) +static short snap_bezier_horizontal(KeyframeEditData *UNUSED(ked), BezTriple *bezt) { if (bezt->f2 & SELECT) { bezt->vec[0][1]= bezt->vec[2][1]= bezt->vec[1][1]; @@ -787,7 +787,7 @@ static short mirror_bezier_cframe(KeyframeEditData *ked, BezTriple *bezt) return 0; } -static short mirror_bezier_yaxis(KeyframeEditData *ked, BezTriple *bezt) +static short mirror_bezier_yaxis(KeyframeEditData *UNUSED(ked), BezTriple *bezt) { float diff; @@ -799,7 +799,7 @@ static short mirror_bezier_yaxis(KeyframeEditData *ked, BezTriple *bezt) return 0; } -static short mirror_bezier_xaxis(KeyframeEditData *ked, BezTriple *bezt) +static short mirror_bezier_xaxis(KeyframeEditData *UNUSED(ked), BezTriple *bezt) { float diff; @@ -860,7 +860,7 @@ KeyframeEditFunc ANIM_editkeyframes_mirror(short type) /* Settings */ /* Sets the selected bezier handles to type 'auto' */ -static short set_bezier_auto(KeyframeEditData *ked, BezTriple *bezt) +static short set_bezier_auto(KeyframeEditData *UNUSED(ked), BezTriple *bezt) { if((bezt->f1 & SELECT) || (bezt->f3 & SELECT)) { if (bezt->f1 & SELECT) bezt->h1= HD_AUTO; /* the secret code for auto */ @@ -878,7 +878,7 @@ static short set_bezier_auto(KeyframeEditData *ked, BezTriple *bezt) } /* Sets the selected bezier handles to type 'vector' */ -static short set_bezier_vector(KeyframeEditData *ked, BezTriple *bezt) +static short set_bezier_vector(KeyframeEditData *UNUSED(ked), BezTriple *bezt) { if ((bezt->f1 & SELECT) || (bezt->f3 & SELECT)) { if (bezt->f1 & SELECT) bezt->h1= HD_VECT; @@ -898,7 +898,7 @@ static short set_bezier_vector(KeyframeEditData *ked, BezTriple *bezt) /* Queries if the handle should be set to 'free' or 'align' */ // NOTE: this was used for the 'toggle free/align' option // currently this isn't used, but may be restored later -static short bezier_isfree(KeyframeEditData *ked, BezTriple *bezt) +static short bezier_isfree(KeyframeEditData *UNUSED(ked), BezTriple *bezt) { if ((bezt->f1 & SELECT) && (bezt->h1)) return 1; if ((bezt->f3 & SELECT) && (bezt->h2)) return 1; @@ -906,7 +906,7 @@ static short bezier_isfree(KeyframeEditData *ked, BezTriple *bezt) } /* Sets selected bezier handles to type 'align' */ -static short set_bezier_align(KeyframeEditData *ked, BezTriple *bezt) +static short set_bezier_align(KeyframeEditData *UNUSED(ked), BezTriple *bezt) { if (bezt->f1 & SELECT) bezt->h1= HD_ALIGN; if (bezt->f3 & SELECT) bezt->h2= HD_ALIGN; @@ -914,7 +914,7 @@ static short set_bezier_align(KeyframeEditData *ked, BezTriple *bezt) } /* Sets selected bezier handles to type 'free' */ -static short set_bezier_free(KeyframeEditData *ked, BezTriple *bezt) +static short set_bezier_free(KeyframeEditData *UNUSED(ked), BezTriple *bezt) { if (bezt->f1 & SELECT) bezt->h1= HD_FREE; if (bezt->f3 & SELECT) bezt->h2= HD_FREE; @@ -944,21 +944,21 @@ KeyframeEditFunc ANIM_editkeyframes_handles(short code) /* ------- */ -static short set_bezt_constant(KeyframeEditData *ked, BezTriple *bezt) +static short set_bezt_constant(KeyframeEditData *UNUSED(ked), BezTriple *bezt) { if (bezt->f2 & SELECT) bezt->ipo= BEZT_IPO_CONST; return 0; } -static short set_bezt_linear(KeyframeEditData *ked, BezTriple *bezt) +static short set_bezt_linear(KeyframeEditData *UNUSED(ked), BezTriple *bezt) { if (bezt->f2 & SELECT) bezt->ipo= BEZT_IPO_LIN; return 0; } -static short set_bezt_bezier(KeyframeEditData *ked, BezTriple *bezt) +static short set_bezt_bezier(KeyframeEditData *UNUSED(ked), BezTriple *bezt) { if (bezt->f2 & SELECT) bezt->ipo= BEZT_IPO_BEZ; @@ -981,21 +981,21 @@ KeyframeEditFunc ANIM_editkeyframes_ipo(short code) /* ------- */ -static short set_keytype_keyframe(KeyframeEditData *ked, BezTriple *bezt) +static short set_keytype_keyframe(KeyframeEditData *UNUSED(ked), BezTriple *bezt) { if (bezt->f2 & SELECT) BEZKEYTYPE(bezt)= BEZT_KEYTYPE_KEYFRAME; return 0; } -static short set_keytype_breakdown(KeyframeEditData *ked, BezTriple *bezt) +static short set_keytype_breakdown(KeyframeEditData *UNUSED(ked), BezTriple *bezt) { if (bezt->f2 & SELECT) BEZKEYTYPE(bezt)= BEZT_KEYTYPE_BREAKDOWN; return 0; } -static short set_keytype_extreme(KeyframeEditData *ked, BezTriple *bezt) +static short set_keytype_extreme(KeyframeEditData *UNUSED(ked), BezTriple *bezt) { if (bezt->f2 & SELECT) BEZKEYTYPE(bezt)= BEZT_KEYTYPE_EXTREME; @@ -1057,7 +1057,7 @@ static short select_bezier_subtract(KeyframeEditData *ked, BezTriple *bezt) return 0; } -static short select_bezier_invert(KeyframeEditData *ked, BezTriple *bezt) +static short select_bezier_invert(KeyframeEditData *UNUSED(ked), BezTriple *bezt) { /* Invert the selection for the whole bezier triple */ bezt->f2 ^= SELECT; diff --git a/source/blender/editors/animation/keyframes_general.c b/source/blender/editors/animation/keyframes_general.c index befcc0a71cb..68e38d04620 100644 --- a/source/blender/editors/animation/keyframes_general.c +++ b/source/blender/editors/animation/keyframes_general.c @@ -486,7 +486,7 @@ void free_anim_copybuf (void) /* ------------------- */ /* This function adds data to the keyframes copy/paste buffer, freeing existing data first */ -short copy_animedit_keys (bAnimContext *ac, ListBase *anim_data) +short copy_animedit_keys (bAnimContext *UNUSED(ac), ListBase *anim_data) { bAnimListElem *ale; diff --git a/source/blender/editors/animation/keyframing.c b/source/blender/editors/animation/keyframing.c index e92065eea91..ddd692d26ea 100644 --- a/source/blender/editors/animation/keyframing.c +++ b/source/blender/editors/animation/keyframing.c @@ -917,7 +917,7 @@ short insert_keyframe (ID *id, bAction *act, const char group[], const char rna_ * The flag argument is used for special settings that alter the behaviour of * the keyframe deletion. These include the quick refresh options. */ -short delete_keyframe (ID *id, bAction *act, const char group[], const char rna_path[], int array_index, float cfra, short flag) +short delete_keyframe (ID *id, bAction *act, const char group[], const char rna_path[], int array_index, float cfra, short UNUSED(flag)) { AnimData *adt= BKE_animdata_from_id(id); PointerRNA id_ptr, ptr; @@ -1146,7 +1146,7 @@ void ANIM_OT_keyframe_insert (wmOperatorType *ot) * then calls the menu if necessary before */ -static int insert_key_menu_invoke (bContext *C, wmOperator *op, wmEvent *event) +static int insert_key_menu_invoke (bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { Scene *scene= CTX_data_scene(C); diff --git a/source/blender/editors/animation/keyingsets.c b/source/blender/editors/animation/keyingsets.c index 77e0c84d2f3..57617651823 100644 --- a/source/blender/editors/animation/keyingsets.c +++ b/source/blender/editors/animation/keyingsets.c @@ -107,7 +107,7 @@ static int keyingset_poll_activePath_edit (bContext *C) /* Add a Default (Empty) Keying Set ------------------------- */ -static int add_default_keyingset_exec (bContext *C, wmOperator *op) +static int add_default_keyingset_exec (bContext *C, wmOperator *UNUSED(op)) { Scene *scene= CTX_data_scene(C); short flag=0, keyingflag=0; @@ -464,7 +464,7 @@ void ANIM_OT_keyingset_button_remove (wmOperatorType *ot) /* Change Active KeyingSet Operator ------------------------ */ /* This operator checks if a menu should be shown for choosing the KeyingSet to make the active one */ -static int keyingset_active_menu_invoke (bContext *C, wmOperator *op, wmEvent *event) +static int keyingset_active_menu_invoke (bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { /* call the menu, which will call this operator again, hence the cancelled */ ANIM_keying_sets_menu_setup(C, op->type->name, "ANIM_OT_keying_set_active_set"); @@ -558,7 +558,7 @@ KeyingSet *ANIM_builtin_keyingset_get_named (KeyingSet *prevKS, const char name[ /* --------------- */ /* Add the given KeyingSetInfo to the list of type infos, and create an appropriate builtin set too */ -void ANIM_keyingset_info_register (const bContext *C, KeyingSetInfo *ksi) +void ANIM_keyingset_info_register (KeyingSetInfo *ksi) { KeyingSet *ks; diff --git a/source/blender/editors/armature/armature_intern.h b/source/blender/editors/armature/armature_intern.h index 2d28d3cb9e5..acbfec125e0 100644 --- a/source/blender/editors/armature/armature_intern.h +++ b/source/blender/editors/armature/armature_intern.h @@ -51,9 +51,7 @@ void ARMATURE_OT_align(struct wmOperatorType *ot); void ARMATURE_OT_calculate_roll(struct wmOperatorType *ot); void ARMATURE_OT_switch_direction(struct wmOperatorType *ot); -void ARMATURE_OT_subdivs(struct wmOperatorType *ot); -void ARMATURE_OT_subdivide_simple(struct wmOperatorType *ot); -void ARMATURE_OT_subdivide_multi(struct wmOperatorType *ot); +void ARMATURE_OT_subdivide(struct wmOperatorType *ot); void ARMATURE_OT_parent_set(struct wmOperatorType *ot); void ARMATURE_OT_parent_clear(struct wmOperatorType *ot); diff --git a/source/blender/editors/armature/armature_ops.c b/source/blender/editors/armature/armature_ops.c index 78b0b2e5e0d..ff4accfd066 100644 --- a/source/blender/editors/armature/armature_ops.c +++ b/source/blender/editors/armature/armature_ops.c @@ -57,9 +57,7 @@ void ED_operatortypes_armature(void) WM_operatortype_append(ARMATURE_OT_align); WM_operatortype_append(ARMATURE_OT_calculate_roll); WM_operatortype_append(ARMATURE_OT_switch_direction); - WM_operatortype_append(ARMATURE_OT_subdivs); - WM_operatortype_append(ARMATURE_OT_subdivide_simple); - WM_operatortype_append(ARMATURE_OT_subdivide_multi); + WM_operatortype_append(ARMATURE_OT_subdivide); WM_operatortype_append(ARMATURE_OT_parent_set); WM_operatortype_append(ARMATURE_OT_parent_clear); diff --git a/source/blender/editors/armature/editarmature.c b/source/blender/editors/armature/editarmature.c index 26a89c4de02..c8c0a4e6980 100644 --- a/source/blender/editors/armature/editarmature.c +++ b/source/blender/editors/armature/editarmature.c @@ -655,7 +655,7 @@ void POSE_OT_armature_apply (wmOperatorType *ot) /* set the current pose as the restpose */ -static int pose_visual_transform_apply_exec (bContext *C, wmOperator *op) +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 @@ -817,7 +817,7 @@ static void joined_armature_fix_links(Object *tarArm, Object *srcArm, bPoseChann } /* join armature exec is exported for use in object->join objects operator... */ -int join_armature_exec(bContext *C, wmOperator *op) +int join_armature_exec(bContext *C, wmOperator *UNUSED(op)) { Main *bmain= CTX_data_main(C); Scene *scene= CTX_data_scene(C); @@ -1075,7 +1075,7 @@ static void separated_armature_fix_links(Object *origArm, Object *newArm) * sel: remove selected bones from the armature, otherwise the unselected bones are removed * (ob is not in editmode) */ -static void separate_armature_bones (Scene *scene, Object *ob, short sel) +static void separate_armature_bones(Object *ob, short sel) { bArmature *arm= (bArmature *)ob->data; bPoseChannel *pchan, *pchann; @@ -1127,7 +1127,7 @@ static void separate_armature_bones (Scene *scene, Object *ob, short sel) } /* separate selected bones into their armature */ -static int separate_armature_exec (bContext *C, wmOperator *op) +static int separate_armature_exec (bContext *C, wmOperator *UNUSED(op)) { Main *bmain= CTX_data_main(C); Scene *scene= CTX_data_scene(C); @@ -1176,8 +1176,8 @@ static int separate_armature_exec (bContext *C, wmOperator *op) /* 3) remove bones that shouldn't still be around on both armatures */ - separate_armature_bones(scene, oldob, 1); - separate_armature_bones(scene, newob, 0); + separate_armature_bones(oldob, 1); + separate_armature_bones(newob, 0); /* 4) fix links before depsgraph flushes */ // err... or after? @@ -1787,7 +1787,7 @@ EditBone *ED_armature_bone_get_mirrored(ListBase *edbo, EditBone *ebo) /* previously delete_armature */ /* only editmode! */ -static int armature_delete_selected_exec(bContext *C, wmOperator *op) +static int armature_delete_selected_exec(bContext *C, wmOperator *UNUSED(op)) { bArmature *arm; EditBone *curBone, *next; @@ -2087,7 +2087,7 @@ float ED_rollBoneToVector(EditBone *bone, float new_up_axis[3]) /* Set roll value for given bone -> Z-Axis Point up (original method) */ -static void auto_align_ebone_zaxisup(Scene *scene, View3D *v3d, EditBone *ebone) +static void auto_align_ebone_zaxisup(Scene *UNUSED(scene), View3D *UNUSED(v3d), EditBone *ebone) { float delta[3], curmat[3][3]; float xaxis[3]={1.0f, 0.0f, 0.0f}, yaxis[3], zaxis[3]={0.0f, 0.0f, 1.0f}; @@ -2377,7 +2377,7 @@ void add_primitive_bone(Scene *scene, View3D *v3d, RegionView3D *rv3d) /* previously addvert_armature */ /* the ctrl-click method */ -static int armature_click_extrude_exec(bContext *C, wmOperator *op) +static int armature_click_extrude_exec(bContext *C, wmOperator *UNUSED(op)) { View3D *v3d; bArmature *arm; @@ -2691,7 +2691,7 @@ EditBone *duplicateEditBone(EditBone *curBone, char *name, ListBase *editbones, } /* previously adduplicate_armature */ -static int armature_duplicate_selected_exec(bContext *C, wmOperator *op) +static int armature_duplicate_selected_exec(bContext *C, wmOperator *UNUSED(op)) { bArmature *arm; EditBone *eBone = NULL; @@ -3262,7 +3262,7 @@ void ARMATURE_OT_merge (wmOperatorType *ot) /* ************** END Add/Remove stuff in editmode ************ */ /* *************** Tools in editmode *********** */ -static int armature_hide_exec(bContext *C, wmOperator *op) +static int armature_hide_exec(bContext *C, wmOperator *UNUSED(op)) { Object *obedit= CTX_data_edit_object(C); bArmature *arm= obedit->data; @@ -3302,7 +3302,7 @@ void ARMATURE_OT_hide(wmOperatorType *ot) ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; } -static int armature_reveal_exec(bContext *C, wmOperator *op) +static int armature_reveal_exec(bContext *C, wmOperator *UNUSED(op)) { Object *obedit= CTX_data_edit_object(C); bArmature *arm= obedit->data; @@ -3632,10 +3632,7 @@ static int armature_subdivide_exec(bContext *C, wmOperator *op) int numcuts, i; /* there may not be a number_cuts property defined (for 'simple' subdivide) */ - if (RNA_property_is_set(op->ptr, "number_cuts")) - numcuts= RNA_int_get(op->ptr, "number_cuts"); - else - numcuts= 1; + numcuts= RNA_int_get(op->ptr, "number_cuts"); /* loop over all editable bones */ // XXX the old code did this in reverse order though! @@ -3690,26 +3687,11 @@ static int armature_subdivide_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } - -void ARMATURE_OT_subdivide_simple(wmOperatorType *ot) -{ - /* identifiers */ - ot->name= "Subdivide Simple"; - ot->idname= "ARMATURE_OT_subdivide_simple"; - - /* api callbacks */ - ot->exec = armature_subdivide_exec; - ot->poll = ED_operator_editarmature; - - /* flags */ - ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; -} - -void ARMATURE_OT_subdivide_multi(wmOperatorType *ot) +void ARMATURE_OT_subdivide(wmOperatorType *ot) { /* identifiers */ ot->name= "Subdivide Multi"; - ot->idname= "ARMATURE_OT_subdivide_multi"; + ot->idname= "ARMATURE_OT_subdivide"; /* api callbacks */ ot->exec = armature_subdivide_exec; @@ -3719,65 +3701,7 @@ void ARMATURE_OT_subdivide_multi(wmOperatorType *ot) ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; /* Properties */ - RNA_def_int(ot->srna, "number_cuts", 2, 1, INT_MAX, "Number of Cuts", "", 1, 10); -} - - - -static int armature_subdivs_invoke(bContext *C, wmOperator *op, wmEvent *event) -{ - uiPopupMenu *pup; - uiLayout *layout; - - pup= uiPupMenuBegin(C, "Subdivision Type", 0); - layout= uiPupMenuLayout(pup); - uiItemsEnumO(layout, "ARMATURE_OT_subdivs", "type"); - uiPupMenuEnd(C, pup); - - return OPERATOR_CANCELLED; -} - -static int armature_subdivs_exec(bContext *C, wmOperator *op) -{ - switch (RNA_int_get(op->ptr, "type")) - { - case 0: /* simple */ - RNA_int_set(op->ptr, "number_cuts", 1); - armature_subdivide_exec(C, op); - break; - case 1: /* multi */ - armature_subdivide_exec(C, op); - break; - } - - return OPERATOR_FINISHED; -} - -void ARMATURE_OT_subdivs(wmOperatorType *ot) -{ - static EnumPropertyItem type_items[]= { - {0, "SIMPLE", 0, "Simple", ""}, - {1, "MULTI", 0, "Multi", ""}, - {0, NULL, 0, NULL, NULL}}; - - /* identifiers */ - ot->name= "subdivs"; - ot->idname= "ARMATURE_OT_subdivs"; - - /* api callbacks */ - ot->invoke= armature_subdivs_invoke; - ot->exec= armature_subdivs_exec; - - ot->poll= ED_operator_editarmature; - - /* flags */ - ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; - - /* props */ - RNA_def_enum(ot->srna, "type", type_items, 0, "Type", ""); - - /* this is temp, the ops are different, but they are called from subdivs, so all the possible props should be here as well*/ - RNA_def_int(ot->srna, "number_cuts", 2, 1, INT_MAX, "Number of Cuts", "", 1, 10); + RNA_def_int(ot->srna, "number_cuts", 1, 1, INT_MAX, "Number of Cuts", "", 1, 10); } /* ----------- */ @@ -3788,7 +3712,7 @@ void ARMATURE_OT_subdivs(wmOperatorType *ot) * this to be done easily. */ -static int armature_switch_direction_exec(bContext *C, wmOperator *op) +static int armature_switch_direction_exec(bContext *C, wmOperator *UNUSED(op)) { Object *ob= CTX_data_edit_object(C); bArmature *arm= (bArmature *)ob->data; @@ -4009,7 +3933,7 @@ static int armature_parent_set_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -static int armature_parent_set_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int armature_parent_set_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent *UNUSED(event)) { EditBone *actbone = CTX_data_active_bone(C); uiPopupMenu *pup= uiPupMenuBegin(C, "Make Parent ", 0); @@ -4106,7 +4030,7 @@ void ARMATURE_OT_parent_clear(wmOperatorType *ot) /* **************** Selections ******************/ -static int armature_select_inverse_exec(bContext *C, wmOperator *op) +static int armature_select_inverse_exec(bContext *C, wmOperator *UNUSED(op)) { /* Set the flags */ CTX_DATA_BEGIN(C, EditBone *, ebone, visible_bones) { @@ -4552,7 +4476,7 @@ void ED_pose_deselectall (Object *ob, int test) arm->act_bone= NULL; } -static int bone_skinnable(Object *ob, Bone *bone, void *datap) +static int bone_skinnable_cb(Object *ob, Bone *bone, void *datap) { /* Bones that are deforming * are regarded to be "skinnable" and are eligible for @@ -4601,7 +4525,7 @@ static int bone_skinnable(Object *ob, Bone *bone, void *datap) return 0; } -static int ED_vgroup_add_unique_bone(Object *ob, Bone *bone, void *data) +static int vgroup_add_unique_bone_cb(Object *ob, Bone *bone, void *UNUSED(ptr)) { /* This group creates a vertex group to ob that has the * same name as bone (provided the bone is skinnable). @@ -4616,7 +4540,7 @@ static int ED_vgroup_add_unique_bone(Object *ob, Bone *bone, void *data) return 0; } -static int dgroup_skinnable(Object *ob, Bone *bone, void *datap) +static int dgroup_skinnable_cb(Object *ob, Bone *bone, void *datap) { /* Bones that are deforming * are regarded to be "skinnable" and are eligible for @@ -4672,7 +4596,7 @@ static int dgroup_skinnable(Object *ob, Bone *bone, void *datap) return 0; } -static void add_vgroups__mapFunc(void *userData, int index, float *co, float *no_f, short *no_s) +static void add_vgroups__mapFunc(void *userData, int index, float *co, float *UNUSED(no_f), short *UNUSED(no_s)) { /* DerivedMesh mapFunc for getting final coords in weight paint mode */ @@ -4723,7 +4647,7 @@ static void envelope_bone_weighting(Object *ob, Mesh *mesh, float (*verts)[3], i } } -void add_verts_to_dgroups(Scene *scene, Object *ob, Object *par, int heat, int mirror) +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. @@ -4755,7 +4679,7 @@ void add_verts_to_dgroups(Scene *scene, Object *ob, Object *par, int heat, int m looper_data.list= NULL; /* count the number of skinnable bones */ - numbones = bone_looper(ob, arm->bonebase.first, &looper_data, bone_skinnable); + numbones = bone_looper(ob, arm->bonebase.first, &looper_data, bone_skinnable_cb); if (numbones == 0) return; @@ -4764,7 +4688,7 @@ void add_verts_to_dgroups(Scene *scene, Object *ob, Object *par, int heat, int m * and fill it with all of the skinnable bones */ bonelist = MEM_callocN(numbones*sizeof(Bone *), "bonelist"); looper_data.list= bonelist; - bone_looper(ob, arm->bonebase.first, &looper_data, bone_skinnable); + bone_looper(ob, arm->bonebase.first, &looper_data, bone_skinnable_cb); /* create an array of pointers to the deform groups that * coorespond to the skinnable bones (creating them @@ -4773,7 +4697,7 @@ void add_verts_to_dgroups(Scene *scene, Object *ob, Object *par, int heat, int m dgroupflip = MEM_callocN(numbones*sizeof(bDeformGroup *), "dgroupflip"); looper_data.list= dgrouplist; - bone_looper(ob, arm->bonebase.first, &looper_data, dgroup_skinnable); + bone_looper(ob, arm->bonebase.first, &looper_data, dgroup_skinnable_cb); /* create an array of root and tip positions transformed into * global coords */ @@ -4870,14 +4794,22 @@ void add_verts_to_dgroups(Scene *scene, Object *ob, Object *par, int heat, int m /* compute the weights based on gathered vertices and bones */ if (heat) { + const char *error= NULL; heat_bone_weighting(ob, mesh, verts, numbones, dgrouplist, dgroupflip, - root, tip, selected); + root, tip, selected, &error); + + if(error) { + BKE_report(reports, RPT_WARNING, error); + } } else { envelope_bone_weighting(ob, mesh, verts, numbones, bonelist, dgrouplist, dgroupflip, root, tip, selected, mat4_to_scale(par->obmat)); } - + + /* only generated in some cases but can call anyway */ + mesh_octree_table(ob, NULL, NULL, 'e'); + /* free the memory allocated */ MEM_freeN(bonelist); MEM_freeN(dgrouplist); @@ -4888,7 +4820,7 @@ void add_verts_to_dgroups(Scene *scene, Object *ob, Object *par, int heat, int m MEM_freeN(verts); } -void create_vgroups_from_armature(Scene *scene, Object *ob, Object *par, int mode, int mirror) +void create_vgroups_from_armature(ReportList *reports, Scene *scene, Object *ob, Object *par, int mode, int mirror) { /* Lets try to create some vertex groups * based on the bones of the parent armature. @@ -4899,7 +4831,7 @@ void create_vgroups_from_armature(Scene *scene, Object *ob, Object *par, int mod /* Traverse the bone list, trying to create empty vertex * groups cooresponding to the bone. */ - bone_looper(ob, arm->bonebase.first, NULL, ED_vgroup_add_unique_bone); + bone_looper(ob, arm->bonebase.first, NULL, vgroup_add_unique_bone_cb); if (ob->type == OB_MESH) ED_vgroup_data_create(ob->data); @@ -4909,12 +4841,12 @@ void create_vgroups_from_armature(Scene *scene, Object *ob, Object *par, int mod * that are populated with the vertices for which the * bone is closest. */ - add_verts_to_dgroups(scene, ob, par, (mode == ARM_GROUPS_AUTO), mirror); + add_verts_to_dgroups(reports, scene, ob, par, (mode == ARM_GROUPS_AUTO), mirror); } } /* ************* Clear Pose *****************************/ -static int pose_clear_scale_exec(bContext *C, wmOperator *op) +static int pose_clear_scale_exec(bContext *C, wmOperator *UNUSED(op)) { Scene *scene= CTX_data_scene(C); Object *ob= ED_object_pose_armature(CTX_data_active_object(C)); @@ -4956,7 +4888,7 @@ static int pose_clear_scale_exec(bContext *C, wmOperator *op) /* now recalculate paths */ if ((ob->pose->avs.path_bakeflag & MOTIONPATH_BAKE_HAS_PATHS)) - ED_pose_recalculate_paths(C, scene, ob); + ED_pose_recalculate_paths(scene, ob); } DAG_id_flush_update(&ob->id, OB_RECALC_DATA); @@ -4982,7 +4914,7 @@ void POSE_OT_scale_clear(wmOperatorType *ot) ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; } -static int pose_clear_loc_exec(bContext *C, wmOperator *op) +static int pose_clear_loc_exec(bContext *C, wmOperator *UNUSED(op)) { Scene *scene= CTX_data_scene(C); Object *ob= ED_object_pose_armature(CTX_data_active_object(C)); @@ -5025,7 +4957,7 @@ static int pose_clear_loc_exec(bContext *C, wmOperator *op) /* now recalculate paths */ if ((ob->pose->avs.path_bakeflag & MOTIONPATH_BAKE_HAS_PATHS)) - ED_pose_recalculate_paths(C, scene, ob); + ED_pose_recalculate_paths(scene, ob); } DAG_id_flush_update(&ob->id, OB_RECALC_DATA); @@ -5051,7 +4983,7 @@ void POSE_OT_loc_clear(wmOperatorType *ot) ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; } -static int pose_clear_rot_exec(bContext *C, wmOperator *op) +static int pose_clear_rot_exec(bContext *C, wmOperator *UNUSED(op)) { Scene *scene= CTX_data_scene(C); Object *ob= ED_object_pose_armature(CTX_data_active_object(C)); @@ -5178,7 +5110,7 @@ static int pose_clear_rot_exec(bContext *C, wmOperator *op) /* now recalculate paths */ if ((ob->pose->avs.path_bakeflag & MOTIONPATH_BAKE_HAS_PATHS)) - ED_pose_recalculate_paths(C, scene, ob); + ED_pose_recalculate_paths(scene, ob); } DAG_id_flush_update(&ob->id, OB_RECALC_DATA); @@ -5207,7 +5139,7 @@ void POSE_OT_rot_clear(wmOperatorType *ot) /* ***************** selections ********************** */ -static int pose_select_inverse_exec(bContext *C, wmOperator *op) +static int pose_select_inverse_exec(bContext *C, wmOperator *UNUSED(op)) { /* Set the flags */ @@ -5304,7 +5236,7 @@ void POSE_OT_select_all(wmOperatorType *ot) WM_operator_properties_select_all(ot); } -static int pose_select_parent_exec(bContext *C, wmOperator *op) +static int pose_select_parent_exec(bContext *C, wmOperator *UNUSED(op)) { Object *ob= ED_object_pose_armature(CTX_data_active_object(C)); bPoseChannel *pchan,*parent; @@ -5348,7 +5280,7 @@ void POSE_OT_select_parent(wmOperatorType *ot) /* ************* hide/unhide pose bones ******************* */ -static int hide_selected_pose_bone(Object *ob, Bone *bone, void *ptr) +static int hide_selected_pose_bone_cb(Object *ob, Bone *bone, void *UNUSED(ptr)) { bArmature *arm= ob->data; @@ -5363,7 +5295,7 @@ static int hide_selected_pose_bone(Object *ob, Bone *bone, void *ptr) return 0; } -static int hide_unselected_pose_bone(Object *ob, Bone *bone, void *ptr) +static int hide_unselected_pose_bone_cb(Object *ob, Bone *bone, void *UNUSED(ptr)) { bArmature *arm= ob->data; @@ -5385,11 +5317,9 @@ static int pose_hide_exec(bContext *C, wmOperator *op) bArmature *arm= ob->data; if(RNA_boolean_get(op->ptr, "unselected")) - bone_looper(ob, arm->bonebase.first, NULL, - hide_unselected_pose_bone); + bone_looper(ob, arm->bonebase.first, NULL, hide_unselected_pose_bone_cb); else - bone_looper(ob, arm->bonebase.first, NULL, - hide_selected_pose_bone); + bone_looper(ob, arm->bonebase.first, NULL, hide_selected_pose_bone_cb); /* note, notifier might evolve */ WM_event_add_notifier(C, NC_OBJECT|ND_BONE_SELECT, ob); @@ -5414,7 +5344,7 @@ void POSE_OT_hide(wmOperatorType *ot) RNA_def_boolean(ot->srna, "unselected", 0, "Unselected", ""); } -static int show_pose_bone(Object *ob, Bone *bone, void *ptr) +static int show_pose_bone_cb(Object *ob, Bone *bone, void *UNUSED(ptr)) { bArmature *arm= ob->data; @@ -5429,12 +5359,12 @@ static int show_pose_bone(Object *ob, Bone *bone, void *ptr) } /* active object is armature in posemode, poll checked */ -static int pose_reveal_exec(bContext *C, wmOperator *op) +static int pose_reveal_exec(bContext *C, wmOperator *UNUSED(op)) { Object *ob= ED_object_pose_armature(CTX_data_active_object(C)); bArmature *arm= ob->data; - bone_looper(ob, arm->bonebase.first, NULL, show_pose_bone); + bone_looper(ob, arm->bonebase.first, NULL, show_pose_bone_cb); /* note, notifier might evolve */ WM_event_add_notifier(C, NC_OBJECT|ND_BONE_SELECT, ob); @@ -5626,7 +5556,7 @@ void ED_armature_bone_rename(bArmature *arm, char *oldnamep, char *newnamep) } -static int armature_flip_names_exec (bContext *C, wmOperator *op) +static int armature_flip_names_exec (bContext *C, wmOperator *UNUSED(op)) { Object *ob= CTX_data_edit_object(C); bArmature *arm; diff --git a/source/blender/editors/armature/editarmature_generate.c b/source/blender/editors/armature/editarmature_generate.c index 1c9024f6f91..6eda622ead8 100644 --- a/source/blender/editors/armature/editarmature_generate.c +++ b/source/blender/editors/armature/editarmature_generate.c @@ -46,7 +46,7 @@ #include "armature_intern.h" #include "BIF_generate.h" -void setBoneRollFromNormal(EditBone *bone, float *no, float invmat[][4], float tmat[][3]) +void setBoneRollFromNormal(EditBone *bone, float *no, float UNUSED(invmat[][4]), float tmat[][3]) { if (no != NULL && !is_zero_v3(no)) { @@ -118,7 +118,7 @@ float calcArcCorrelation(BArcIterator *iter, int start, int end, float v0[3], fl } } -int nextFixedSubdivision(ToolSettings *toolsettings, BArcIterator *iter, int start, int end, float head[3], float p[3]) +int nextFixedSubdivision(ToolSettings *toolsettings, BArcIterator *iter, int start, int end, float UNUSED(head[3]), float p[3]) { static float stroke_length = 0; static float current_length; @@ -277,7 +277,7 @@ int nextLengthSubdivision(ToolSettings *toolsettings, BArcIterator *iter, int st return -1; } -EditBone * subdivideArcBy(ToolSettings *toolsettings, bArmature *arm, ListBase *editbones, BArcIterator *iter, float invmat[][4], float tmat[][3], NextSubdivisionFunc next_subdividion) +EditBone * subdivideArcBy(ToolSettings *toolsettings, bArmature *arm, ListBase *UNUSED(editbones), BArcIterator *iter, float invmat[][4], float tmat[][3], NextSubdivisionFunc next_subdividion) { EditBone *lastBone = NULL; EditBone *child = NULL; diff --git a/source/blender/editors/armature/editarmature_retarget.c b/source/blender/editors/armature/editarmature_retarget.c index 637c6076314..e80f1494d8c 100644 --- a/source/blender/editors/armature/editarmature_retarget.c +++ b/source/blender/editors/armature/editarmature_retarget.c @@ -374,7 +374,7 @@ static RigNode *newRigNodeHead(RigGraph *rg, RigArc *arc, float p[3]) return node; } -static void addRigNodeHead(RigGraph *rg, RigArc *arc, RigNode *node) +static void addRigNodeHead(RigGraph *UNUSED(rg), RigArc *arc, RigNode *node) { node->degree++; @@ -1784,7 +1784,7 @@ static void repositionTailControl(RigGraph *rigg, RigControl *ctrl) finalizeControl(rigg, ctrl, 1); /* resize will be recalculated anyway so we don't need it */ } -static void repositionControl(RigGraph *rigg, RigControl *ctrl, float head[3], float tail[3], float qrot[4], float resize) +static void repositionControl(RigGraph *rigg, RigControl *ctrl, float head[3], float UNUSED(tail[3]), float qrot[4], float resize) { float parent_offset[3], tail_offset[3]; @@ -2051,7 +2051,7 @@ static float calcCostLengthDistance(BArcIterator *iter, float **vec_cache, RigEd } #endif -static float calcCostAngleLengthDistance(BArcIterator *iter, float **vec_cache, RigEdge *edge, float *vec0, float *vec1, float *vec2, int i1, int i2, float angle_weight, float length_weight, float distance_weight) +static float calcCostAngleLengthDistance(BArcIterator *iter, float **UNUSED(vec_cache), RigEdge *edge, float *vec0, float *vec1, float *vec2, int i1, int i2, float angle_weight, float length_weight, float distance_weight) { float vec_second[3], vec_first[3]; float length2; diff --git a/source/blender/editors/armature/editarmature_sketch.c b/source/blender/editors/armature/editarmature_sketch.c index 241301b8ee1..93bddb3834b 100644 --- a/source/blender/editors/armature/editarmature_sketch.c +++ b/source/blender/editors/armature/editarmature_sketch.c @@ -184,7 +184,7 @@ void BIF_makeListTemplates(const bContext *C) } } -char *BIF_listTemplates(const bContext *C) +char *BIF_listTemplates(const bContext *UNUSED(C)) { GHashIterator ghi; char menu_header[] = "Template%t|None%x0|"; @@ -309,7 +309,7 @@ char * BIF_nameBoneTemplate(const bContext *C) return RIG_nameBone(rg, 0, index); } -void BIF_freeTemplates(bContext *C) +void BIF_freeTemplates(bContext *UNUSED(C)) { if (TEMPLATES_MENU != NULL) { @@ -1029,7 +1029,7 @@ void sk_projectDrawPoint(bContext *C, float vec[3], SK_Stroke *stk, SK_DrawData sub_v3_v3v3(vec, fp, dvec); } -int sk_getStrokeDrawPoint(bContext *C, SK_Point *pt, SK_Sketch *sketch, SK_Stroke *stk, SK_DrawData *dd) +int sk_getStrokeDrawPoint(bContext *C, SK_Point *pt, SK_Sketch *UNUSED(sketch), SK_Stroke *stk, SK_DrawData *dd) { pt->type = dd->type; pt->mode = PT_PROJECT; @@ -1773,7 +1773,7 @@ int sk_getSegments(SK_Stroke *segments, SK_Stroke *gesture) return segments->nb_points - 1; } -int sk_detectCutGesture(bContext *C, SK_Gesture *gest, SK_Sketch *sketch) +int sk_detectCutGesture(bContext *UNUSED(C), SK_Gesture *gest, SK_Sketch *UNUSED(sketch)) { if (gest->nb_segments == 1 && gest->nb_intersections == 1) { @@ -1783,7 +1783,7 @@ int sk_detectCutGesture(bContext *C, SK_Gesture *gest, SK_Sketch *sketch) return 0; } -void sk_applyCutGesture(bContext *C, SK_Gesture *gest, SK_Sketch *sketch) +void sk_applyCutGesture(bContext *UNUSED(C), SK_Gesture *gest, SK_Sketch *UNUSED(sketch)) { SK_Intersection *isect; @@ -1800,7 +1800,7 @@ void sk_applyCutGesture(bContext *C, SK_Gesture *gest, SK_Sketch *sketch) } } -int sk_detectTrimGesture(bContext *C, SK_Gesture *gest, SK_Sketch *sketch) +int sk_detectTrimGesture(bContext *UNUSED(C), SK_Gesture *gest, SK_Sketch *UNUSED(sketch)) { if (gest->nb_segments == 2 && gest->nb_intersections == 1 && gest->nb_self_intersections == 0) { @@ -1821,7 +1821,7 @@ int sk_detectTrimGesture(bContext *C, SK_Gesture *gest, SK_Sketch *sketch) return 0; } -void sk_applyTrimGesture(bContext *C, SK_Gesture *gest, SK_Sketch *sketch) +void sk_applyTrimGesture(bContext *UNUSED(C), SK_Gesture *gest, SK_Sketch *UNUSED(sketch)) { SK_Intersection *isect; float trim_dir[3]; @@ -1856,7 +1856,7 @@ void sk_applyTrimGesture(bContext *C, SK_Gesture *gest, SK_Sketch *sketch) } } -int sk_detectCommandGesture(bContext *C, SK_Gesture *gest, SK_Sketch *sketch) +int sk_detectCommandGesture(bContext *UNUSED(C), SK_Gesture *gest, SK_Sketch *UNUSED(sketch)) { if (gest->nb_segments > 2 && gest->nb_intersections == 2 && gest->nb_self_intersections == 1) { @@ -1883,7 +1883,7 @@ int sk_detectCommandGesture(bContext *C, SK_Gesture *gest, SK_Sketch *sketch) return 0; } -void sk_applyCommandGesture(bContext *C, SK_Gesture *gest, SK_Sketch *sketch) +void sk_applyCommandGesture(bContext *UNUSED(C), SK_Gesture *gest, SK_Sketch *UNUSED(sketch)) { SK_Intersection *isect; int command = 1; @@ -1918,7 +1918,7 @@ void sk_applyCommandGesture(bContext *C, SK_Gesture *gest, SK_Sketch *sketch) } } -int sk_detectDeleteGesture(bContext *C, SK_Gesture *gest, SK_Sketch *sketch) +int sk_detectDeleteGesture(bContext *UNUSED(C), SK_Gesture *gest, SK_Sketch *UNUSED(sketch)) { if (gest->nb_segments == 2 && gest->nb_intersections == 2) { @@ -1939,7 +1939,7 @@ int sk_detectDeleteGesture(bContext *C, SK_Gesture *gest, SK_Sketch *sketch) return 0; } -void sk_applyDeleteGesture(bContext *C, SK_Gesture *gest, SK_Sketch *sketch) +void sk_applyDeleteGesture(bContext *UNUSED(C), SK_Gesture *gest, SK_Sketch *sketch) { SK_Intersection *isect; @@ -1955,7 +1955,7 @@ void sk_applyDeleteGesture(bContext *C, SK_Gesture *gest, SK_Sketch *sketch) } } -int sk_detectMergeGesture(bContext *C, SK_Gesture *gest, SK_Sketch *sketch) +int sk_detectMergeGesture(bContext *C, SK_Gesture *gest, SK_Sketch *UNUSED(sketch)) { ARegion *ar = CTX_wm_region(C); if (gest->nb_segments > 2 && gest->nb_intersections == 2) @@ -2003,7 +2003,7 @@ int sk_detectMergeGesture(bContext *C, SK_Gesture *gest, SK_Sketch *sketch) return 0; } -void sk_applyMergeGesture(bContext *C, SK_Gesture *gest, SK_Sketch *sketch) +void sk_applyMergeGesture(bContext *UNUSED(C), SK_Gesture *gest, SK_Sketch *UNUSED(sketch)) { SK_Intersection *isect; @@ -2034,7 +2034,7 @@ void sk_applyMergeGesture(bContext *C, SK_Gesture *gest, SK_Sketch *sketch) } } -int sk_detectReverseGesture(bContext *C, SK_Gesture *gest, SK_Sketch *sketch) +int sk_detectReverseGesture(bContext *UNUSED(C), SK_Gesture *gest, SK_Sketch *UNUSED(sketch)) { if (gest->nb_segments > 2 && gest->nb_intersections == 2 && gest->nb_self_intersections == 0) { @@ -2076,7 +2076,7 @@ int sk_detectReverseGesture(bContext *C, SK_Gesture *gest, SK_Sketch *sketch) return 0; } -void sk_applyReverseGesture(bContext *C, SK_Gesture *gest, SK_Sketch *sketch) +void sk_applyReverseGesture(bContext *UNUSED(C), SK_Gesture *gest, SK_Sketch *UNUSED(sketch)) { SK_Intersection *isect; @@ -2093,7 +2093,7 @@ void sk_applyReverseGesture(bContext *C, SK_Gesture *gest, SK_Sketch *sketch) } } -int sk_detectConvertGesture(bContext *C, SK_Gesture *gest, SK_Sketch *sketch) +int sk_detectConvertGesture(bContext *UNUSED(C), SK_Gesture *gest, SK_Sketch *UNUSED(sketch)) { if (gest->nb_segments == 3 && gest->nb_self_intersections == 1) { @@ -2102,7 +2102,7 @@ int sk_detectConvertGesture(bContext *C, SK_Gesture *gest, SK_Sketch *sketch) return 0; } -void sk_applyConvertGesture(bContext *C, SK_Gesture *gest, SK_Sketch *sketch) +void sk_applyConvertGesture(bContext *C, SK_Gesture *UNUSED(gest), SK_Sketch *sketch) { sk_convert(C, sketch); } @@ -2215,7 +2215,7 @@ void sk_queueRedrawSketch(SK_Sketch *sketch) } } -void sk_drawSketch(Scene *scene, View3D *v3d, SK_Sketch *sketch, int with_names) +void sk_drawSketch(Scene *scene, View3D *UNUSED(v3d), SK_Sketch *sketch, int with_names) { ToolSettings *ts= scene->toolsettings; SK_Stroke *stk; @@ -2452,7 +2452,7 @@ void BDR_drawSketch(const bContext *C) } } -static int sketch_delete(bContext *C, wmOperator *op, wmEvent *event) +static int sketch_delete(bContext *C, wmOperator *UNUSED(op), wmEvent *UNUSED(event)) { SK_Sketch *sketch = contextSketch(C, 0); if (sketch) @@ -2558,7 +2558,7 @@ SK_Sketch* viewcontextSketch(ViewContext *vc, int create) return sketch; } -static int sketch_convert(bContext *C, wmOperator *op, wmEvent *event) +static int sketch_convert(bContext *C, wmOperator *UNUSED(op), wmEvent *UNUSED(event)) { SK_Sketch *sketch = contextSketch(C, 0); if (sketch != NULL) @@ -2569,7 +2569,7 @@ static int sketch_convert(bContext *C, wmOperator *op, wmEvent *event) return OPERATOR_FINISHED; } -static int sketch_cancel(bContext *C, wmOperator *op, wmEvent *event) +static int sketch_cancel(bContext *C, wmOperator *UNUSED(op), wmEvent *UNUSED(event)) { SK_Sketch *sketch = contextSketch(C, 0); if (sketch != NULL) @@ -2581,7 +2581,7 @@ static int sketch_cancel(bContext *C, wmOperator *op, wmEvent *event) return OPERATOR_PASS_THROUGH; } -static int sketch_finish(bContext *C, wmOperator *op, wmEvent *event) +static int sketch_finish(bContext *C, wmOperator *UNUSED(op), wmEvent *UNUSED(event)) { SK_Sketch *sketch = contextSketch(C, 0); if (sketch != NULL) @@ -2595,7 +2595,7 @@ static int sketch_finish(bContext *C, wmOperator *op, wmEvent *event) return OPERATOR_PASS_THROUGH; } -static int sketch_select(bContext *C, wmOperator *op, wmEvent *event) +static int sketch_select(bContext *C, wmOperator *UNUSED(op), wmEvent *event) { SK_Sketch *sketch = contextSketch(C, 0); if (sketch) diff --git a/source/blender/editors/armature/meshlaplacian.c b/source/blender/editors/armature/meshlaplacian.c index 84b02b4796a..f193defc129 100644 --- a/source/blender/editors/armature/meshlaplacian.c +++ b/source/blender/editors/armature/meshlaplacian.c @@ -61,8 +61,8 @@ /* ************* XXX *************** */ -static void waitcursor(int val) {} -static void progress_bar(int dummy_val, const char *dummy) {} +static void waitcursor(int UNUSED(val)) {} +static void progress_bar(int UNUSED(dummy_val), const char *UNUSED(dummy)) {} static void start_progress_bar() {} static void end_progress_bar() {} static void error(char *str) { printf("error: %s\n", str); } @@ -362,7 +362,7 @@ void laplacian_begin_solve(LaplacianSystem *sys, int index) } } -void laplacian_add_right_hand_side(LaplacianSystem *sys, int v, float value) +void laplacian_add_right_hand_side(LaplacianSystem *UNUSED(sys), int v, float value) { nlRightHandSideAdd(0, v, value); } @@ -398,7 +398,7 @@ typedef struct BVHCallbackUserData { LaplacianSystem *sys; } BVHCallbackUserData; -static void bvh_callback(void *userdata, int index, const BVHTreeRay *ray, BVHTreeRayHit *hit) +static void bvh_callback(void *userdata, int index, const BVHTreeRay *UNUSED(ray), BVHTreeRayHit *hit) { BVHCallbackUserData *data = (struct BVHCallbackUserData*)userdata; MFace *mf = data->sys->heat.mface + index; @@ -642,13 +642,15 @@ static float heat_limit_weight(float weight) return weight; } -void heat_bone_weighting(Object *ob, Mesh *me, float (*verts)[3], int numsource, bDeformGroup **dgrouplist, bDeformGroup **dgroupflip, float (*root)[3], float (*tip)[3], int *selected) +void heat_bone_weighting(Object *ob, Mesh *me, float (*verts)[3], int numsource, bDeformGroup **dgrouplist, bDeformGroup **dgroupflip, float (*root)[3], float (*tip)[3], int *selected, const char **err_str) { LaplacianSystem *sys; MFace *mface; float solution, weight; int *vertsflipped = NULL, *mask= NULL; int a, totface, j, bbone, firstsegment, lastsegment, thrownerror = 0; + + *err_str= NULL; /* count triangles and create mask */ if(me->editflag & ME_EDIT_PAINT_MASK) @@ -760,8 +762,7 @@ void heat_bone_weighting(Object *ob, Mesh *me, float (*verts)[3], int numsource, } } else if(!thrownerror) { - error("Bone Heat Weighting:" - " failed to find solution for one or more bones"); + *err_str= "Bone Heat Weighting: failed to find solution for one or more bones"; thrownerror= 1; break; } @@ -1400,7 +1401,7 @@ static void meshdeform_bind_floodfill(MeshDeformBind *mdb) MEM_freeN(stack); } -static float meshdeform_boundary_phi(MeshDeformBind *mdb, MDefBoundIsect *isect, int cagevert) +static float meshdeform_boundary_phi(MeshDeformBind *UNUSED(mdb), MDefBoundIsect *isect, int cagevert) { int a; @@ -1411,7 +1412,7 @@ static float meshdeform_boundary_phi(MeshDeformBind *mdb, MDefBoundIsect *isect, return 0.0f; } -static float meshdeform_interp_w(MeshDeformBind *mdb, float *gridvec, float *vec, int cagevert) +static float meshdeform_interp_w(MeshDeformBind *mdb, float *gridvec, float *UNUSED(vec), int UNUSED(cagevert)) { float dvec[3], ivec[3], wx, wy, wz, result=0.0f; float weight, totweight= 0.0f; @@ -1562,7 +1563,7 @@ static void meshdeform_matrix_add_semibound_phi(MeshDeformBind *mdb, int x, int } } -static void meshdeform_matrix_add_exterior_phi(MeshDeformBind *mdb, int x, int y, int z, int cagevert) +static void meshdeform_matrix_add_exterior_phi(MeshDeformBind *mdb, int x, int y, int z, int UNUSED(cagevert)) { float phi, totweight; int i, a, acenter; @@ -1711,7 +1712,7 @@ static void meshdeform_matrix_solve(MeshDeformBind *mdb) nlDeleteContext(context); } -static void harmonic_coordinates_bind(Scene *scene, MeshDeformModifierData *mmd, MeshDeformBind *mdb) +static void harmonic_coordinates_bind(Scene *UNUSED(scene), MeshDeformModifierData *mmd, MeshDeformBind *mdb) { MDefBindInfluence *inf; MDefInfluence *mdinf; diff --git a/source/blender/editors/armature/meshlaplacian.h b/source/blender/editors/armature/meshlaplacian.h index 640eb33c945..cba43043e8d 100644 --- a/source/blender/editors/armature/meshlaplacian.h +++ b/source/blender/editors/armature/meshlaplacian.h @@ -66,7 +66,7 @@ float laplacian_system_get_solution(int v); void heat_bone_weighting(struct Object *ob, struct Mesh *me, float (*verts)[3], int numbones, struct bDeformGroup **dgrouplist, struct bDeformGroup **dgroupflip, float (*root)[3], float (*tip)[3], - int *selected); + int *selected, const char **error); #ifdef RIGID_DEFORM /* As-Rigid-As-Possible Deformation */ diff --git a/source/blender/editors/armature/poseSlide.c b/source/blender/editors/armature/poseSlide.c index 482d97811a3..7b2ec9891f4 100644 --- a/source/blender/editors/armature/poseSlide.c +++ b/source/blender/editors/armature/poseSlide.c @@ -157,7 +157,7 @@ static int pose_slide_init (bContext *C, wmOperator *op, short mode) } /* exiting the operator - free data */ -static void pose_slide_exit (bContext *C, wmOperator *op) +static void pose_slide_exit(wmOperator *op) { tPoseSlideOp *pso= op->customdata; @@ -376,7 +376,7 @@ static void pose_slide_apply_quat (tPoseSlideOp *pso, tPChanFCurveLink *pfl) } /* apply() - perform the pose sliding based on weighting various poses */ -static void pose_slide_apply (bContext *C, wmOperator *op, tPoseSlideOp *pso) +static void pose_slide_apply(bContext *C, tPoseSlideOp *pso) { tPChanFCurveLink *pfl; @@ -434,7 +434,7 @@ static void pose_slide_autoKeyframe (bContext *C, tPoseSlideOp *pso) } /* reset changes made to current pose */ -static void pose_slide_reset (bContext *C, tPoseSlideOp *pso) +static void pose_slide_reset (tPoseSlideOp *pso) { /* wrapper around the generic call, so that custom stuff can be added later */ poseAnim_mapping_reset(&pso->pfLinks); @@ -501,7 +501,7 @@ static int pose_slide_invoke_common (bContext *C, wmOperator *op, tPoseSlideOp * /* initial apply for operator... */ // TODO: need to calculate percentage for initial round too... - pose_slide_apply(C, op, pso); + pose_slide_apply(C, pso); /* depsgraph updates + redraws */ pose_slide_refresh(C, pso); @@ -528,7 +528,7 @@ static int pose_slide_modal (bContext *C, wmOperator *op, wmEvent *evt) /* insert keyframes as required... */ pose_slide_autoKeyframe(C, pso); - pose_slide_exit(C, op); + pose_slide_exit(op); /* done! */ return OPERATOR_FINISHED; @@ -541,13 +541,13 @@ static int pose_slide_modal (bContext *C, wmOperator *op, wmEvent *evt) WM_cursor_restore(win); /* reset transforms back to original state */ - pose_slide_reset(C, pso); + pose_slide_reset(pso); /* depsgraph updates + redraws */ pose_slide_refresh(C, pso); /* clean up temp data */ - pose_slide_exit(C, op); + pose_slide_exit(op); /* cancelled! */ return OPERATOR_CANCELLED; @@ -562,10 +562,10 @@ static int pose_slide_modal (bContext *C, wmOperator *op, wmEvent *evt) RNA_float_set(op->ptr, "percentage", pso->percentage); /* reset transforms (to avoid accumulation errors) */ - pose_slide_reset(C, pso); + pose_slide_reset(pso); /* apply... */ - pose_slide_apply(C, op, pso); + pose_slide_apply(C, pso); } break; @@ -579,10 +579,10 @@ static int pose_slide_modal (bContext *C, wmOperator *op, wmEvent *evt) } /* common code for cancel() */ -static int pose_slide_cancel (bContext *C, wmOperator *op) +static int pose_slide_cancel (bContext *UNUSED(C), wmOperator *op) { /* cleanup and done */ - pose_slide_exit(C, op); + pose_slide_exit(op); return OPERATOR_CANCELLED; } @@ -590,13 +590,13 @@ static int pose_slide_cancel (bContext *C, wmOperator *op) static int pose_slide_exec_common (bContext *C, wmOperator *op, tPoseSlideOp *pso) { /* settings should have been set up ok for applying, so just apply! */ - pose_slide_apply(C, op, pso); + pose_slide_apply(C, pso); /* insert keyframes if needed */ pose_slide_autoKeyframe(C, pso); /* cleanup and done */ - pose_slide_exit(C, op); + pose_slide_exit(op); return OPERATOR_FINISHED; } @@ -612,13 +612,13 @@ static void pose_slide_opdef_properties (wmOperatorType *ot) /* ------------------------------------ */ /* invoke() - for 'push' mode */ -static int pose_slide_push_invoke (bContext *C, wmOperator *op, wmEvent *evt) +static int pose_slide_push_invoke (bContext *C, wmOperator *op, wmEvent *UNUSED(evt)) { tPoseSlideOp *pso; /* initialise data */ if (pose_slide_init(C, op, POSESLIDE_PUSH) == 0) { - pose_slide_exit(C, op); + pose_slide_exit(op); return OPERATOR_CANCELLED; } else @@ -635,7 +635,7 @@ static int pose_slide_push_exec (bContext *C, wmOperator *op) /* initialise data (from RNA-props) */ if (pose_slide_init(C, op, POSESLIDE_PUSH) == 0) { - pose_slide_exit(C, op); + pose_slide_exit(op); return OPERATOR_CANCELLED; } else @@ -669,13 +669,13 @@ void POSE_OT_push (wmOperatorType *ot) /* ........................ */ /* invoke() - for 'relax' mode */ -static int pose_slide_relax_invoke (bContext *C, wmOperator *op, wmEvent *evt) +static int pose_slide_relax_invoke (bContext *C, wmOperator *op, wmEvent *UNUSED(evt)) { tPoseSlideOp *pso; /* initialise data */ if (pose_slide_init(C, op, POSESLIDE_RELAX) == 0) { - pose_slide_exit(C, op); + pose_slide_exit(op); return OPERATOR_CANCELLED; } else @@ -692,7 +692,7 @@ static int pose_slide_relax_exec (bContext *C, wmOperator *op) /* initialise data (from RNA-props) */ if (pose_slide_init(C, op, POSESLIDE_RELAX) == 0) { - pose_slide_exit(C, op); + pose_slide_exit(op); return OPERATOR_CANCELLED; } else @@ -726,13 +726,13 @@ void POSE_OT_relax (wmOperatorType *ot) /* ........................ */ /* invoke() - for 'breakdown' mode */ -static int pose_slide_breakdown_invoke (bContext *C, wmOperator *op, wmEvent *evt) +static int pose_slide_breakdown_invoke (bContext *C, wmOperator *op, wmEvent *UNUSED(evt)) { tPoseSlideOp *pso; /* initialise data */ if (pose_slide_init(C, op, POSESLIDE_BREAKDOWN) == 0) { - pose_slide_exit(C, op); + pose_slide_exit(op); return OPERATOR_CANCELLED; } else @@ -749,7 +749,7 @@ static int pose_slide_breakdown_exec (bContext *C, wmOperator *op) /* initialise data (from RNA-props) */ if (pose_slide_init(C, op, POSESLIDE_BREAKDOWN) == 0) { - pose_slide_exit(C, op); + pose_slide_exit(op); return OPERATOR_CANCELLED; } else diff --git a/source/blender/editors/armature/poselib.c b/source/blender/editors/armature/poselib.c index 9292c92294b..a595396b15d 100644 --- a/source/blender/editors/armature/poselib.c +++ b/source/blender/editors/armature/poselib.c @@ -268,7 +268,7 @@ static KeyingSet *poselib_ks_locrotscale = NULL; /* the only keyingset we'll ne /* ----- */ -static void poselib_add_menu_invoke__replacemenu (bContext *C, uiLayout *layout, void *arg) +static void poselib_add_menu_invoke__replacemenu (bContext *C, uiLayout *layout, void *UNUSED(arg)) { Object *ob= ED_object_pose_armature(CTX_data_active_object(C)); bAction *act= ob->poselib; @@ -290,7 +290,7 @@ static void poselib_add_menu_invoke__replacemenu (bContext *C, uiLayout *layout, } } -static int poselib_add_menu_invoke (bContext *C, wmOperator *op, wmEvent *evt) +static int poselib_add_menu_invoke (bContext *C, wmOperator *op, wmEvent *UNUSED(evt)) { Scene *scene= CTX_data_scene(C); Object *ob= ED_object_pose_armature(CTX_data_active_object(C)); @@ -402,7 +402,7 @@ void POSELIB_OT_pose_add (wmOperatorType *ot) /* ----- */ -static EnumPropertyItem *poselib_stored_pose_itemf(bContext *C, PointerRNA *ptr, int *free) +static EnumPropertyItem *poselib_stored_pose_itemf(bContext *C, PointerRNA *UNUSED(ptr), int *free) { Object *ob= ED_object_pose_armature(CTX_data_active_object(C)); bAction *act= (ob) ? ob->poselib : NULL; @@ -1034,7 +1034,7 @@ static void poselib_preview_handle_search (tPoseLib_PreviewData *pld, unsigned s } /* handle events for poselib_preview_poses */ -static int poselib_preview_handle_event (bContext *C, wmOperator *op, wmEvent *event) +static int poselib_preview_handle_event (bContext *UNUSED(C), wmOperator *op, wmEvent *event) { tPoseLib_PreviewData *pld= op->customdata; int ret = OPERATOR_RUNNING_MODAL; @@ -1411,7 +1411,7 @@ static int poselib_preview_modal (bContext *C, wmOperator *op, wmEvent *event) } /* Modal Operator init */ -static int poselib_preview_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int poselib_preview_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { tPoseLib_PreviewData *pld; diff --git a/source/blender/editors/armature/poseobject.c b/source/blender/editors/armature/poseobject.c index 4aff2f1e915..ecb34609b2d 100644 --- a/source/blender/editors/armature/poseobject.c +++ b/source/blender/editors/armature/poseobject.c @@ -71,9 +71,9 @@ #include "armature_intern.h" /* ************* XXX *************** */ -static int pupmenu(const char *dummy) {return 0;} -static void error(const char *dummy) {}; -static void BIF_undo_push(const char *dummy) {} +static int pupmenu(const char *UNUSED(dummy)) {return 0;} +static void error(const char *UNUSED(dummy)) {}; +static void BIF_undo_push(const char *UNUSED(dummy)) {} /* ************* XXX *************** */ @@ -226,7 +226,7 @@ int ED_pose_channel_in_IK_chain(Object *ob, bPoseChannel *pchan) * * To be called from various tools that do incremental updates */ -void ED_pose_recalculate_paths(bContext *C, Scene *scene, Object *ob) +void ED_pose_recalculate_paths(Scene *scene, Object *ob) { ListBase targets = {NULL, NULL}; @@ -242,7 +242,7 @@ void ED_pose_recalculate_paths(bContext *C, Scene *scene, Object *ob) /* For the object with pose/action: create path curves for selected bones * This recalculates the WHOLE path within the pchan->pathsf and pchan->pathef range */ -static int pose_calculate_paths_exec (bContext *C, wmOperator *op) +static int pose_calculate_paths_exec (bContext *C, wmOperator *UNUSED(op)) { ScrArea *sa= CTX_wm_area(C); Scene *scene= CTX_data_scene(C); @@ -267,7 +267,7 @@ static int pose_calculate_paths_exec (bContext *C, wmOperator *op) /* calculate the bones that now have motionpaths... */ // TODO: only make for the selected bones? - ED_pose_recalculate_paths(C, scene, ob); + ED_pose_recalculate_paths(scene, ob); /* notifiers for updates */ WM_event_add_notifier(C, NC_OBJECT|ND_POSE, ob); @@ -319,7 +319,7 @@ void ED_pose_clear_paths(Object *ob) } /* operator callback for this */ -static int pose_clear_paths_exec (bContext *C, wmOperator *op) +static int pose_clear_paths_exec (bContext *C, wmOperator *UNUSED(op)) { ScrArea *sa= CTX_wm_area(C); Object *ob; @@ -360,7 +360,7 @@ void POSE_OT_paths_clear (wmOperatorType *ot) /* ******************* Select Constraint Target Operator ************* */ -static int pose_select_constraint_target_exec(bContext *C, wmOperator *op) +static int pose_select_constraint_target_exec(bContext *C, wmOperator *UNUSED(op)) { Object *ob= ED_object_pose_armature(CTX_data_active_object(C)); bArmature *arm= ob->data; @@ -1100,7 +1100,7 @@ void POSE_OT_paste (wmOperatorType *ot) /* ********************************************** */ -static int pose_group_add_exec (bContext *C, wmOperator *op) +static int pose_group_add_exec (bContext *C, wmOperator *UNUSED(op)) { ScrArea *sa= CTX_wm_area(C); Object *ob; @@ -1140,7 +1140,7 @@ void POSE_OT_group_add (wmOperatorType *ot) } -static int pose_group_remove_exec (bContext *C, wmOperator *op) +static int pose_group_remove_exec (bContext *C, wmOperator *UNUSED(op)) { ScrArea *sa= CTX_wm_area(C); Object *ob; @@ -1182,7 +1182,7 @@ void POSE_OT_group_remove (wmOperatorType *ot) /* ------------ */ /* invoke callback which presents a list of bone-groups for the user to choose from */ -static int pose_groups_menu_invoke (bContext *C, wmOperator *op, wmEvent *evt) +static int pose_groups_menu_invoke (bContext *C, wmOperator *op, wmEvent *UNUSED(evt)) { ScrArea *sa= CTX_wm_area(C); Object *ob; @@ -1300,7 +1300,7 @@ void POSE_OT_group_assign (wmOperatorType *ot) } -static int pose_group_unassign_exec (bContext *C, wmOperator *op) +static int pose_group_unassign_exec (bContext *C, wmOperator *UNUSED(op)) { ScrArea *sa= CTX_wm_area(C); Object *ob; @@ -1375,7 +1375,7 @@ static void pose_group_select(bContext *C, Object *ob, int select) CTX_DATA_END; } -static int pose_group_select_exec (bContext *C, wmOperator *op) +static int pose_group_select_exec (bContext *C, wmOperator *UNUSED(op)) { ScrArea *sa= CTX_wm_area(C); Object *ob; @@ -1413,7 +1413,7 @@ void POSE_OT_group_select (wmOperatorType *ot) ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO; } -static int pose_group_deselect_exec (bContext *C, wmOperator *op) +static int pose_group_deselect_exec (bContext *C, wmOperator *UNUSED(op)) { ScrArea *sa= CTX_wm_area(C); Object *ob; @@ -1453,7 +1453,7 @@ void POSE_OT_group_deselect (wmOperatorType *ot) /* ********************************************** */ -static int pose_flip_names_exec (bContext *C, wmOperator *op) +static int pose_flip_names_exec (bContext *C, wmOperator *UNUSED(op)) { Object *ob= ED_object_pose_armature(CTX_data_active_object(C)); bArmature *arm; @@ -1827,7 +1827,7 @@ void ARMATURE_OT_bone_layers (wmOperatorType *ot) /* ********************************************** */ -static int pose_flip_quats_exec (bContext *C, wmOperator *op) +static int pose_flip_quats_exec (bContext *C, wmOperator *UNUSED(op)) { Scene *scene= CTX_data_scene(C); Object *ob= ED_object_pose_armature(CTX_data_active_object(C)); @@ -1895,9 +1895,9 @@ void POSE_OT_quaternions_flip (wmOperatorType *ot) /* ********************************************** */ /* context: active channel */ +#if 0 void pose_special_editmenu(Scene *scene) { -#if 0 Object *obedit= scene->obedit; // XXX context Object *ob= OBACT; short nr; @@ -1920,7 +1920,7 @@ void pose_special_editmenu(Scene *scene) pose_clear_paths(ob); } else if(nr==5) { - pose_clear_user_transforms(scene, ob); + pose_clear_user_transforms(ob); } else if(nr==6) { pose_relax(); @@ -1928,11 +1928,11 @@ void pose_special_editmenu(Scene *scene) else if(ELEM3(nr, 7, 8, 9)) { pose_autoside_names(nr-7); } -#endif } + /* Restore selected pose-bones to 'action'-defined pose */ -void pose_clear_user_transforms(Scene *scene, Object *ob) +static void pose_clear_user_transforms(Object *ob) { bArmature *arm= ob->data; bPoseChannel *pchan; @@ -1964,3 +1964,4 @@ void pose_clear_user_transforms(Scene *scene, Object *ob) BIF_undo_push("Clear User Transform"); } +#endif diff --git a/source/blender/editors/armature/reeb.c b/source/blender/editors/armature/reeb.c index 9602d80575a..5af1658a83f 100644 --- a/source/blender/editors/armature/reeb.c +++ b/source/blender/editors/armature/reeb.c @@ -442,7 +442,7 @@ void flipArc(ReebArc *arc) } #ifdef DEBUG_REEB_NODE -void NodeDegreeDecrement(ReebGraph *rg, ReebNode *node) +void NodeDegreeDecrement(ReebGraph *UNUSED(rg), ReebNode *node) { node->degree--; @@ -452,7 +452,7 @@ void NodeDegreeDecrement(ReebGraph *rg, ReebNode *node) // } } -void NodeDegreeIncrement(ReebGraph *rg, ReebNode *node) +void NodeDegreeIncrement(ReebGraph *UNUSED(rg), ReebNode *node) { // if (node->degree == 0) // { @@ -523,7 +523,7 @@ void verifyNodeDegree(ReebGraph *rg) #endif } -void verifyBucketsArc(ReebGraph *rg, ReebArc *arc) +void verifyBucketsArc(ReebGraph *UNUSED(rg), ReebArc *arc) { ReebNode *head = (ReebNode*)arc->head; ReebNode *tail = (ReebNode*)arc->tail; @@ -1692,7 +1692,7 @@ int filterInternalExternalReebGraph(ReebGraph *rg, float threshold_internal, flo return value; } -int filterCyclesReebGraph(ReebGraph *rg, float distance_threshold) +int filterCyclesReebGraph(ReebGraph *rg, float UNUSED(distance_threshold)) { ReebArc *arc1, *arc2; ReebArc *next2; @@ -1723,7 +1723,7 @@ int filterCyclesReebGraph(ReebGraph *rg, float distance_threshold) return filtered; } -int filterSmartReebGraph(ReebGraph *rg, float threshold) +int filterSmartReebGraph(ReebGraph *UNUSED(rg), float UNUSED(threshold)) { int value = 0; #if 0 //XXX @@ -2180,7 +2180,7 @@ void addFacetoArc(ReebArc *arc, EditFace *efa) BLI_ghash_insert(arc->faces, efa, efa); } -void mergeArcFaces(ReebGraph *rg, ReebArc *aDst, ReebArc *aSrc) +void mergeArcFaces(ReebGraph *UNUSED(rg), ReebArc *aDst, ReebArc *aSrc) { GHashIterator ghi; diff --git a/source/blender/editors/curve/curve_ops.c b/source/blender/editors/curve/curve_ops.c index 4558827c619..80582c7f1b0 100644 --- a/source/blender/editors/curve/curve_ops.c +++ b/source/blender/editors/curve/curve_ops.c @@ -194,6 +194,7 @@ void ED_keymap_curve(wmKeyConfig *keyconf) keymap->poll= ED_operator_editsurfcurve; WM_keymap_add_menu(keymap, "INFO_MT_edit_curve_add", AKEY, KM_PRESS, KM_SHIFT, 0); + WM_keymap_add_menu(keymap, "INFO_MT_curve_handle_type_set", VKEY, KM_PRESS, 0, 0); WM_keymap_add_item(keymap, "CURVE_OT_vertex_add", LEFTMOUSE, KM_CLICK, KM_CTRL, 0); WM_keymap_add_item(keymap, "CURVE_OT_select_all", AKEY, KM_PRESS, 0, 0); @@ -214,9 +215,6 @@ void ED_keymap_curve(wmKeyConfig *keyconf) WM_keymap_add_item(keymap, "CURVE_OT_tilt_clear", TKEY, KM_PRESS, KM_ALT, 0); WM_keymap_add_item(keymap, "TRANSFORM_OT_tilt", TKEY, KM_PRESS, KM_CTRL, 0); RNA_enum_set(WM_keymap_add_item(keymap, "TRANSFORM_OT_transform", SKEY, KM_PRESS, KM_ALT, 0)->ptr, "mode", TFM_CURVE_SHRINKFATTEN); - RNA_enum_set(WM_keymap_add_item(keymap, "CURVE_OT_handle_type_set", HKEY, KM_PRESS, KM_SHIFT, 0)->ptr, "type", 1); - RNA_enum_set(WM_keymap_add_item(keymap, "CURVE_OT_handle_type_set", HKEY, KM_PRESS, 0, 0)->ptr, "type", 3); - RNA_enum_set(WM_keymap_add_item(keymap, "CURVE_OT_handle_type_set", VKEY, KM_PRESS, 0, 0)->ptr, "type", 2); WM_keymap_add_item(keymap, "CURVE_OT_reveal", HKEY, KM_PRESS, KM_ALT, 0); WM_keymap_add_item(keymap, "CURVE_OT_hide", HKEY, KM_PRESS, KM_ALT|KM_CTRL, 0); diff --git a/source/blender/editors/curve/editcurve.c b/source/blender/editors/curve/editcurve.c index 4c869d25869..97379cc110c 100644 --- a/source/blender/editors/curve/editcurve.c +++ b/source/blender/editors/curve/editcurve.c @@ -1343,7 +1343,7 @@ static void weightflagNurb(ListBase *editnurb, short flag, float w) } } -static int deleteflagNurb(bContext *C, wmOperator *op, int flag) +static int deleteflagNurb(bContext *C, wmOperator *UNUSED(op), int flag) { Object *obedit= CTX_data_edit_object(C); Curve *cu= obedit->data; @@ -1765,7 +1765,7 @@ static void adduplicateflagNurb(Object *obedit, short flag) /**************** switch direction operator ***************/ -static int switch_direction_exec(bContext *C, wmOperator *op) +static int switch_direction_exec(bContext *C, wmOperator *UNUSED(op)) { Object *obedit= CTX_data_edit_object(C); Curve *cu= (Curve*)obedit->data; @@ -1902,7 +1902,7 @@ void CURVE_OT_radius_set(wmOperatorType *ot) /********************* smooth operator ********************/ -static int smooth_exec(bContext *C, wmOperator *op) +static int smooth_exec(bContext *C, wmOperator *UNUSED(op)) { Object *obedit= CTX_data_edit_object(C); ListBase *editnurb= curve_get_editcurve(obedit); @@ -1974,7 +1974,7 @@ void CURVE_OT_smooth(wmOperatorType *ot) /**************** smooth curve radius operator *************/ /* TODO, make smoothing distance based */ -static int smooth_radius_exec(bContext *C, wmOperator *op) +static int smooth_radius_exec(bContext *C, wmOperator *UNUSED(op)) { Object *obedit= CTX_data_edit_object(C); ListBase *editnurb= curve_get_editcurve(obedit); @@ -2265,7 +2265,7 @@ void selectend_nurb(Object *obedit, short selfirst, short doswap, short selstatu } } -static int de_select_first_exec(bContext *C, wmOperator *op) +static int de_select_first_exec(bContext *C, wmOperator *UNUSED(op)) { Object *obedit= CTX_data_edit_object(C); @@ -2289,7 +2289,7 @@ void CURVE_OT_de_select_first(wmOperatorType *ot) ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; } -static int de_select_last_exec(bContext *C, wmOperator *op) +static int de_select_last_exec(bContext *C, wmOperator *UNUSED(op)) { Object *obedit= CTX_data_edit_object(C); @@ -2470,7 +2470,7 @@ void CURVE_OT_hide(wmOperatorType *ot) /********************** reveal operator *********************/ -static int reveal_exec(bContext *C, wmOperator *op) +static int reveal_exec(bContext *C, wmOperator *UNUSED(op)) { Object *obedit= CTX_data_edit_object(C); ListBase *editnurb= curve_get_editcurve(obedit); @@ -2527,7 +2527,7 @@ void CURVE_OT_reveal(wmOperatorType *ot) /********************** select invert operator *********************/ -static int select_inverse_exec(bContext *C, wmOperator *op) +static int select_inverse_exec(bContext *C, wmOperator *UNUSED(op)) { Object *obedit= CTX_data_edit_object(C); Curve *cu= obedit->data; @@ -4071,7 +4071,7 @@ static int spin_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -static int spin_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int spin_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { Scene *scene = CTX_data_scene(C); View3D *v3d = CTX_wm_view3d(C); @@ -4271,7 +4271,7 @@ void CURVE_OT_vertex_add(wmOperatorType *ot) /***************** extrude operator **********************/ -static int extrude_exec(bContext *C, wmOperator *op) +static int extrude_exec(bContext *C, wmOperator *UNUSED(op)) { Object *obedit= CTX_data_edit_object(C); Curve *cu= obedit->data; @@ -4296,7 +4296,7 @@ static int extrude_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -static int extrude_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int extrude_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { if(extrude_exec(C, op) == OPERATOR_FINISHED) { RNA_int_set(op->ptr, "mode", TFM_TRANSLATION); @@ -4406,7 +4406,7 @@ static int toggle_cyclic_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -static int toggle_cyclic_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int toggle_cyclic_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { Object *obedit= CTX_data_edit_object(C); ListBase *editnurb= curve_get_editcurve(obedit); @@ -4531,7 +4531,7 @@ void CURVE_OT_select_linked(wmOperatorType *ot) /***************** select row operator **********************/ -static int select_row_exec(bContext *C, wmOperator *op) +static int select_row_exec(bContext *C, wmOperator *UNUSED(op)) { Object *obedit= CTX_data_edit_object(C); Curve *cu= obedit->data; @@ -4606,7 +4606,7 @@ void CURVE_OT_select_row(wmOperatorType *ot) /***************** select next operator **********************/ -static int select_next_exec(bContext *C, wmOperator *op) +static int select_next_exec(bContext *C, wmOperator *UNUSED(op)) { Object *obedit= CTX_data_edit_object(C); ListBase *editnurb= curve_get_editcurve(obedit); @@ -4633,7 +4633,7 @@ void CURVE_OT_select_next(wmOperatorType *ot) /***************** select previous operator **********************/ -static int select_previous_exec(bContext *C, wmOperator *op) +static int select_previous_exec(bContext *C, wmOperator *UNUSED(op)) { Object *obedit= CTX_data_edit_object(C); ListBase *editnurb= curve_get_editcurve(obedit); @@ -4660,7 +4660,7 @@ void CURVE_OT_select_previous(wmOperatorType *ot) /***************** select more operator **********************/ -static int select_more_exec(bContext *C, wmOperator *op) +static int select_more_exec(bContext *C, wmOperator *UNUSED(op)) { Object *obedit= CTX_data_edit_object(C); ListBase *editnurb= curve_get_editcurve(obedit); @@ -4748,7 +4748,7 @@ void CURVE_OT_select_more(wmOperatorType *ot) /******************** select less operator *****************/ /* basic method: deselect if control point doesn't have all neighbours selected */ -static int select_less_exec(bContext *C, wmOperator *op) +static int select_less_exec(bContext *C, wmOperator *UNUSED(op)) { Object *obedit= CTX_data_edit_object(C); ListBase *editnurb= curve_get_editcurve(obedit); @@ -5099,7 +5099,7 @@ void CURVE_OT_select_nth(wmOperatorType *ot) /********************** add duplicate operator *********************/ -static int duplicate_exec(bContext *C, wmOperator *op) +static int duplicate_exec(bContext *C, wmOperator *UNUSED(op)) { Object *obedit= CTX_data_edit_object(C); @@ -5109,7 +5109,7 @@ static int duplicate_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -static int duplicate_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int duplicate_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { duplicate_exec(C, op); @@ -5432,7 +5432,7 @@ static int delete_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -static int delete_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int delete_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { Object *obedit= CTX_data_edit_object(C); uiPopupMenu *pup; @@ -5534,7 +5534,7 @@ void CURVE_OT_shade_flat(wmOperatorType *ot) /************** join operator, to be used externally? ****************/ -int join_curve_exec(bContext *C, wmOperator *op) +int join_curve_exec(bContext *C, wmOperator *UNUSED(op)) { Main *bmain= CTX_data_main(C); Scene *scene= CTX_data_scene(C); @@ -5620,6 +5620,7 @@ Nurb *add_nurbs_primitive(bContext *C, float mat[4][4], int type, int newname) Nurb *nu = NULL; BezTriple *bezt; BPoint *bp; + Curve *cu= (Curve*)obedit->data; float vec[3]; float fac, grid; int a, b, cutype, stype; @@ -5641,13 +5642,13 @@ Nurb *add_nurbs_primitive(bContext *C, float mat[4][4], int type, int newname) if (stype!=CU_PRIM_TUBE && stype!=CU_PRIM_DONUT) { nu = (Nurb*)MEM_callocN(sizeof(Nurb), "addNurbprim"); nu->type= cutype; - nu->resolu= 4; - nu->resolv= 4; + nu->resolu= cu->resolu; + nu->resolv= cu->resolv; } switch(stype) { case CU_PRIM_CURVE: /* curve */ - nu->resolu= 12; /* set as 4 above */ + nu->resolu= cu->resolu; if(newname) { rename_id((ID *)obedit, "Curve"); rename_id((ID *)obedit->data, "Curve"); @@ -5724,7 +5725,7 @@ Nurb *add_nurbs_primitive(bContext *C, float mat[4][4], int type, int newname) nu->pntsv= 1; nu->orderu= 5; nu->flagu= CU_NURB_ENDPOINT; /* endpoint */ - nu->resolu= 8; + nu->resolu= cu->resolu; nu->bp= callocstructN(BPoint, 5, "addNurbprim3"); bp= nu->bp; @@ -5753,7 +5754,7 @@ Nurb *add_nurbs_primitive(bContext *C, float mat[4][4], int type, int newname) break; case CU_PRIM_CIRCLE: /* circle */ - nu->resolu= 12; /* set as 4 above */ + nu->resolu= cu->resolu; if(newname) { rename_id((ID *)obedit, "CurveCircle"); rename_id((ID *)obedit->data, "CurveCircle"); @@ -5870,7 +5871,7 @@ Nurb *add_nurbs_primitive(bContext *C, float mat[4][4], int type, int newname) } nu= add_nurbs_primitive(C, mat, CU_NURBS|CU_PRIM_CIRCLE, 0); /* circle */ - nu->resolu= 4; + nu->resolu= cu->resolu; nu->flag= CU_SMOOTH; BLI_addtail(editnurb, nu); /* temporal for extrude and translate */ vec[0]=vec[1]= 0.0; @@ -5913,8 +5914,8 @@ Nurb *add_nurbs_primitive(bContext *C, float mat[4][4], int type, int newname) nu->pntsu= 5; nu->pntsv= 1; nu->orderu= 3; - nu->resolu= 4; - nu->resolv= 4; + nu->resolu= cu->resolu; + nu->resolv= cu->resolv; nu->flag= CU_SMOOTH; nu->bp= callocstructN(BPoint, 5, "addNurbprim6"); nu->flagu= 0; @@ -5962,8 +5963,8 @@ Nurb *add_nurbs_primitive(bContext *C, float mat[4][4], int type, int newname) xzproj= 1; nu= add_nurbs_primitive(C, mat, CU_NURBS|CU_PRIM_CIRCLE, 0); /* circle */ xzproj= 0; - nu->resolu= 4; - nu->resolv= 4; + nu->resolu= cu->resolu; + nu->resolv= cu->resolv; nu->flag= CU_SMOOTH; BLI_addtail(editnurb, nu); /* temporal for spin */ @@ -6308,7 +6309,7 @@ void SURFACE_OT_primitive_nurbs_surface_torus_add(wmOperatorType *ot) /***************** clear tilt operator ********************/ -static int clear_tilt_exec(bContext *C, wmOperator *op) +static int clear_tilt_exec(bContext *C, wmOperator *UNUSED(op)) { Object *obedit= CTX_data_edit_object(C); Curve *cu= obedit->data; diff --git a/source/blender/editors/curve/editfont.c b/source/blender/editors/curve/editfont.c index ae79c0b0053..44a664b5f30 100644 --- a/source/blender/editors/curve/editfont.c +++ b/source/blender/editors/curve/editfont.c @@ -271,7 +271,7 @@ static void text_update_edited(bContext *C, Scene *scene, Object *obedit, int re /********************** insert lorem operator *********************/ -static int insert_lorem_exec(bContext *C, wmOperator *op) +static int insert_lorem_exec(bContext *C, wmOperator *UNUSED(op)) { Object *obedit= CTX_data_edit_object(C); char *p, *p2; @@ -383,7 +383,7 @@ static int paste_file_exec(bContext *C, wmOperator *op) return retval; } -static int paste_file_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int paste_file_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { if(RNA_property_is_set(op->ptr, "filepath")) return paste_file_exec(C, op); @@ -414,7 +414,7 @@ void FONT_OT_file_paste(wmOperatorType *ot) /******************* paste buffer operator ********************/ -static int paste_buffer_exec(bContext *C, wmOperator *op) +static int paste_buffer_exec(bContext *C, wmOperator *UNUSED(op)) { char *filename; @@ -714,7 +714,7 @@ static void copy_selection(Object *obedit) } } -static int copy_text_exec(bContext *C, wmOperator *op) +static int copy_text_exec(bContext *C, wmOperator *UNUSED(op)) { Object *obedit= CTX_data_edit_object(C); @@ -737,7 +737,7 @@ void FONT_OT_text_copy(wmOperatorType *ot) /******************* cut text operator ********************/ -static int cut_text_exec(bContext *C, wmOperator *op) +static int cut_text_exec(bContext *C, wmOperator *UNUSED(op)) { Scene *scene= CTX_data_scene(C); Object *obedit= CTX_data_edit_object(C); @@ -1367,7 +1367,7 @@ static int textbox_poll(bContext *C) return 1; } -static int textbox_add_exec(bContext *C, wmOperator *op) +static int textbox_add_exec(bContext *C, wmOperator *UNUSED(op)) { Object *obedit= CTX_data_active_object(C); Curve *cu= obedit->data; @@ -1585,7 +1585,7 @@ void FONT_OT_case_set(wmOperatorType *ot) /********************** toggle case operator *********************/ -static int toggle_case_exec(bContext *C, wmOperator *op) +static int toggle_case_exec(bContext *C, wmOperator *UNUSED(op)) { Object *obedit= CTX_data_edit_object(C); Curve *cu= obedit->data; @@ -1633,7 +1633,7 @@ static void open_init(bContext *C, wmOperator *op) uiIDContextProperty(C, &pprop->ptr, &pprop->prop); } -static int open_cancel(bContext *C, wmOperator *op) +static int open_cancel(bContext *UNUSED(C), wmOperator *op) { MEM_freeN(op->customdata); op->customdata= NULL; @@ -1686,7 +1686,7 @@ static int open_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -static int open_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int open_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { Object *ob = CTX_data_active_object(C); Curve *cu; diff --git a/source/blender/editors/gpencil/drawgpencil.c b/source/blender/editors/gpencil/drawgpencil.c index e6a1f58096a..e19f774412b 100644 --- a/source/blender/editors/gpencil/drawgpencil.c +++ b/source/blender/editors/gpencil/drawgpencil.c @@ -199,7 +199,7 @@ static void gp_draw_stroke_point (bGPDspoint *points, short thickness, short sfl } /* draw a given stroke in 3d (i.e. in 3d-space), using simple ogl lines */ -static void gp_draw_stroke_3d (bGPDspoint *points, int totpoints, short thickness, short dflag, short sflag, short debug, int winx, int winy) +static void gp_draw_stroke_3d (bGPDspoint *points, int totpoints, short thickness, short debug) { bGPDspoint *pt; float oldpressure = 0.0f; @@ -501,7 +501,7 @@ static void gp_draw_strokes (bGPDframe *gpf, int offsx, int offsy, int winx, int if (gps->totpoints == 1) gp_draw_stroke_point(gps->points, lthick, gps->flag, offsx, offsy, winx, winy); else if (dflag & GP_DRAWDATA_ONLY3D) - gp_draw_stroke_3d(gps->points, gps->totpoints, lthick, dflag, gps->flag, debug, winx, winy); + gp_draw_stroke_3d(gps->points, gps->totpoints, lthick, debug); else if (gps->totpoints > 1) gp_draw_stroke(gps->points, gps->totpoints, lthick, dflag, gps->flag, debug, offsx, offsy, winx, winy); } diff --git a/source/blender/editors/gpencil/gpencil_paint.c b/source/blender/editors/gpencil/gpencil_paint.c index 083a90efb25..75156571cf4 100644 --- a/source/blender/editors/gpencil/gpencil_paint.c +++ b/source/blender/editors/gpencil/gpencil_paint.c @@ -662,7 +662,7 @@ static short gp_stroke_eraser_splitdel (bGPDframe *gpf, bGPDstroke *gps, int i) } /* eraser tool - check if part of stroke occurs within last segment drawn by eraser */ -static short gp_stroke_eraser_strokeinside (int mval[], int mvalo[], short rad, short x0, short y0, short x1, short y1) +static short gp_stroke_eraser_strokeinside (int mval[], int UNUSED(mvalo[]), short rad, short x0, short y0, short x1, short y1) { /* simple within-radius check for now */ if (edge_inside_circle(mval[0], mval[1], rad, x0, y0, x1, y1)) @@ -1250,7 +1250,7 @@ static int gpencil_draw_cancel (bContext *C, wmOperator *op) /* ------------------------------- */ /* create a new stroke point at the point indicated by the painting context */ -static void gpencil_draw_apply (bContext *C, wmOperator *op, tGPsdata *p) +static void gpencil_draw_apply (wmOperator *op, tGPsdata *p) { /* handle drawing/erasing -> test for erasing first */ if (p->paintmode == GP_PAINTMODE_ERASER) { @@ -1294,7 +1294,7 @@ static void gpencil_draw_apply (bContext *C, wmOperator *op, tGPsdata *p) } /* handle draw event */ -static void gpencil_draw_apply_event (bContext *C, wmOperator *op, wmEvent *event) +static void gpencil_draw_apply_event (wmOperator *op, wmEvent *event) { tGPsdata *p= op->customdata; ARegion *ar= p->ar; @@ -1343,7 +1343,7 @@ static void gpencil_draw_apply_event (bContext *C, wmOperator *op, wmEvent *even RNA_float_set(&itemptr, "pressure", p->pressure); /* apply the current latest drawing point */ - gpencil_draw_apply(C, op, p); + gpencil_draw_apply(op, p); /* force refresh */ ED_region_tag_redraw(p->ar); /* just active area for now, since doing whole screen is too slow */ @@ -1394,7 +1394,7 @@ static int gpencil_draw_exec (bContext *C, wmOperator *op) } /* apply this data as necessary now (as per usual) */ - gpencil_draw_apply(C, op, p); + gpencil_draw_apply(op, p); } RNA_END; @@ -1456,7 +1456,7 @@ static int gpencil_draw_invoke (bContext *C, wmOperator *op, wmEvent *event) p->status= GP_STATUS_PAINTING; /* handle the initial drawing - i.e. for just doing a simple dot */ - gpencil_draw_apply_event(C, op, event); + gpencil_draw_apply_event(op, event); } else { /* toolbar invoked - don't start drawing yet... */ @@ -1516,7 +1516,7 @@ static int gpencil_draw_modal (bContext *C, wmOperator *op, wmEvent *event) if (p->status == GP_STATUS_PAINTING) { /* handle drawing event */ //printf("\t\tGP - add point\n"); - gpencil_draw_apply_event(C, op, event); + gpencil_draw_apply_event(op, event); /* finish painting operation if anything went wrong just now */ if (p->status == GP_STATUS_ERROR) { diff --git a/source/blender/editors/include/ED_armature.h b/source/blender/editors/include/ED_armature.h index 809b86d65f3..32fe10783a7 100644 --- a/source/blender/editors/include/ED_armature.h +++ b/source/blender/editors/include/ED_armature.h @@ -42,6 +42,7 @@ struct ListBase; struct MeshDeformModifierData; struct Object; struct RegionView3D; +struct ReportList; struct Scene; struct SK_Sketch; struct View3D; @@ -132,7 +133,7 @@ void ED_armature_apply_transform(struct Object *ob, float mat[4][4]); #define ARM_GROUPS_ENVELOPE 2 #define ARM_GROUPS_AUTO 3 -void create_vgroups_from_armature(struct Scene *scene, struct Object *ob, struct Object *par, int mode, int mirror); +void create_vgroups_from_armature(struct ReportList *reports, struct Scene *scene, struct Object *ob, struct Object *par, int mode, int mirror); void auto_align_armature(struct Scene *scene, struct View3D *v3d, short mode); void unique_editbone_name(struct ListBase *ebones, char *name, EditBone *bone); /* if bone is already in list, pass it as param to ignore it */ @@ -146,7 +147,7 @@ void ED_armature_exit_posemode(struct bContext *C, struct Base *base); void ED_armature_enter_posemode(struct bContext *C, struct Base *base); int ED_pose_channel_in_IK_chain(struct Object *ob, struct bPoseChannel *pchan); void ED_pose_deselectall(struct Object *ob, int test); -void ED_pose_recalculate_paths(struct bContext *C, struct Scene *scene, struct Object *ob); +void ED_pose_recalculate_paths(struct Scene *scene, struct Object *ob); /* sketch */ diff --git a/source/blender/editors/include/ED_keyframes_draw.h b/source/blender/editors/include/ED_keyframes_draw.h index 78a645d6b50..ec74ea6123b 100644 --- a/source/blender/editors/include/ED_keyframes_draw.h +++ b/source/blender/editors/include/ED_keyframes_draw.h @@ -136,7 +136,7 @@ void scene_to_keylist(struct bDopeSheet *ads, struct Scene *sce, struct DLRBT_Tr void summary_to_keylist(struct bAnimContext *ac, struct DLRBT_Tree *keys, struct DLRBT_Tree *blocks); /* Grease Pencil Layer */ // XXX not restored -void gpl_to_keylist(struct bDopeSheet *ads, struct bGPDlayer *gpl, struct DLRBT_Tree *keys, struct DLRBT_Tree *blocks); +void gpl_to_keylist(struct bDopeSheet *ads, struct bGPDlayer *gpl, struct DLRBT_Tree *keys); /* ActKeyColumn API ---------------- */ /* Comparator callback used for ActKeyColumns and cframe float-value pointer */ diff --git a/source/blender/editors/include/ED_keyframing.h b/source/blender/editors/include/ED_keyframing.h index b3aac489852..2650005a489 100644 --- a/source/blender/editors/include/ED_keyframing.h +++ b/source/blender/editors/include/ED_keyframing.h @@ -183,7 +183,7 @@ struct KeyingSet *ANIM_builtin_keyingset_get_named(struct KeyingSet *prevKS, con KeyingSetInfo *ANIM_keyingset_info_find_named(const char name[]); /* for RNA type registrations... */ -void ANIM_keyingset_info_register(const struct bContext *C, KeyingSetInfo *ksi); +void ANIM_keyingset_info_register(KeyingSetInfo *ksi); void ANIM_keyingset_info_unregister(const struct bContext *C, KeyingSetInfo *ksi); /* cleanup on exit */ diff --git a/source/blender/editors/include/ED_mesh.h b/source/blender/editors/include/ED_mesh.h index c4477ee5a8e..22779fbba0b 100644 --- a/source/blender/editors/include/ED_mesh.h +++ b/source/blender/editors/include/ED_mesh.h @@ -159,6 +159,8 @@ void EM_solidify(struct EditMesh *em, float dist); int EM_deselect_nth(struct EditMesh *em, int nth); +void EM_project_snap_verts(struct bContext *C, struct ARegion *ar, struct Object *obedit, struct EditMesh *em); + /* editmesh_mods.c */ extern unsigned int em_vertoffs, em_solidoffs, em_wireoffs; @@ -223,7 +225,7 @@ void ED_mesh_calc_normals(struct Mesh *me); void ED_mesh_material_link(struct Mesh *me, struct Material *ma); void ED_mesh_update(struct Mesh *mesh, struct bContext *C, int calc_edges); -int ED_mesh_uv_texture_add(struct bContext *C, struct Scene *scene, struct Object *ob, struct Mesh *me, const char *name, int active_set); +int ED_mesh_uv_texture_add(struct bContext *C, struct Mesh *me, const char *name, int active_set); int ED_mesh_uv_texture_remove(struct bContext *C, struct Object *ob, struct Mesh *me); int ED_mesh_color_add(struct bContext *C, struct Scene *scene, struct Object *ob, struct Mesh *me, const char *name, int active_set); int ED_mesh_color_remove(struct bContext *C, struct Object *ob, struct Mesh *me); diff --git a/source/blender/editors/include/ED_node.h b/source/blender/editors/include/ED_node.h index 6e42b772bef..d287066828f 100644 --- a/source/blender/editors/include/ED_node.h +++ b/source/blender/editors/include/ED_node.h @@ -40,7 +40,7 @@ void ED_init_node_butfuncs(void); /* node_draw.c */ void ED_node_changed_update(struct ID *id, struct bNode *node); -void ED_node_generic_update(struct Main *bmain, struct Scene *scene, struct bNodeTree *ntree, struct bNode *node); +void ED_node_generic_update(struct Main *bmain, struct bNodeTree *ntree, struct bNode *node); /* node_edit.c */ void ED_node_shader_default(struct Material *ma); diff --git a/source/blender/editors/include/ED_object.h b/source/blender/editors/include/ED_object.h index 64e72a5e2fa..63af7c5abd3 100644 --- a/source/blender/editors/include/ED_object.h +++ b/source/blender/editors/include/ED_object.h @@ -109,7 +109,7 @@ int object_is_libdata(struct Object *ob); int object_data_is_libdata(struct Object *ob); /* object motion paths */ -void ED_objects_clear_paths(struct bContext *C, struct Scene *scene); +void ED_objects_clear_paths(struct bContext *C); void ED_objects_recalculate_paths(struct bContext *C, struct Scene *scene); /* constraints */ diff --git a/source/blender/editors/include/ED_screen.h b/source/blender/editors/include/ED_screen.h index 7059e607218..62243a0e53e 100644 --- a/source/blender/editors/include/ED_screen.h +++ b/source/blender/editors/include/ED_screen.h @@ -69,7 +69,7 @@ void ED_spacetypes_keymap(struct wmKeyConfig *keyconf); int ED_area_header_switchbutton(const struct bContext *C, struct uiBlock *block, int yco); int ED_area_header_standardbuttons(const struct bContext *C, struct uiBlock *block, int yco); void ED_area_overdraw(struct bContext *C); -void ED_area_overdraw_flush(struct bContext *C, struct ScrArea *sa, struct ARegion *ar); +void ED_area_overdraw_flush(struct ScrArea *sa, struct ARegion *ar); /* areas */ diff --git a/source/blender/editors/include/ED_screen_types.h b/source/blender/editors/include/ED_screen_types.h index c5abd5465d7..18d6a1a48cc 100644 --- a/source/blender/editors/include/ED_screen_types.h +++ b/source/blender/editors/include/ED_screen_types.h @@ -38,6 +38,7 @@ typedef struct ScreenAnimData { short refresh; short flag; /* flags for playback */ int sfra; /* frame that playback was started from */ + int nextfra; /* next frame to go to (when ANIMPLAY_FLAG_USE_NEXT_FRAME is set) */ } ScreenAnimData; /* for animplayer */ @@ -50,6 +51,8 @@ enum { ANIMPLAY_FLAG_SYNC = (1<<2), /* don't drop frames (and ignore SCE_FRAME_DROP flag) */ ANIMPLAY_FLAG_NO_SYNC = (1<<3), + /* use nextfra at next timer update */ + ANIMPLAY_FLAG_USE_NEXT_FRAME, }; /* ----------------------------------------------------- */ diff --git a/source/blender/editors/include/ED_types.h b/source/blender/editors/include/ED_types.h index 96a5d5857fa..1887a97e635 100644 --- a/source/blender/editors/include/ED_types.h +++ b/source/blender/editors/include/ED_types.h @@ -35,11 +35,6 @@ #define SELECT 1 #define ACTIVE 2 -/* nonstandard define, sometimes in math.h */ -#ifndef MAXFLOAT -#define MAXFLOAT ((float)3.40282347e+38) -#endif - /* buttons */ #define XIC 20 #define YIC 20 diff --git a/source/blender/editors/include/ED_uvedit.h b/source/blender/editors/include/ED_uvedit.h index 1710a8439d1..737d124b494 100644 --- a/source/blender/editors/include/ED_uvedit.h +++ b/source/blender/editors/include/ED_uvedit.h @@ -41,7 +41,6 @@ void ED_operatortypes_uvedit(void); void ED_keymap_uvedit(struct wmKeyConfig *keyconf); void ED_uvedit_assign_image(struct Scene *scene, struct Object *obedit, struct Image *ima, struct Image *previma); -void ED_uvedit_set_tile(struct bContext *C, struct Scene *scene, struct Object *obedit, struct Image *ima, int curtile, int dotile); int ED_uvedit_minmax(struct Scene *scene, struct Image *ima, struct Object *obedit, float *min, float *max); int ED_uvedit_test_silent(struct Object *obedit); diff --git a/source/blender/editors/include/UI_interface.h b/source/blender/editors/include/UI_interface.h index 4689153c9f5..2a1527b670d 100644 --- a/source/blender/editors/include/UI_interface.h +++ b/source/blender/editors/include/UI_interface.h @@ -492,7 +492,7 @@ uiBut *uiDefSearchBut(uiBlock *block, void *arg, int retval, int icon, int maxle void uiBlockPickerButtons(struct uiBlock *block, float *col, float *hsv, float *old, char *hexcol, char mode, short retval); uiBut *uiDefAutoButR(uiBlock *block, struct PointerRNA *ptr, struct PropertyRNA *prop, int index, char *name, int icon, int x1, int y1, int x2, int y2); -void uiDefAutoButsRNA(const struct bContext *C, uiLayout *layout, struct PointerRNA *ptr, int columns); +void uiDefAutoButsRNA(uiLayout *layout, struct PointerRNA *ptr, int columns); /* Links * @@ -680,17 +680,17 @@ void uiTemplateIDBrowse(uiLayout *layout, struct bContext *C, struct PointerRNA char *newop, char *openop, char *unlinkop); void uiTemplateIDPreview(uiLayout *layout, struct bContext *C, struct PointerRNA *ptr, char *propname, char *newop, char *openop, char *unlinkop, int rows, int cols); -void uiTemplateAnyID(uiLayout *layout, struct bContext *C, struct PointerRNA *ptr, char *propname, +void uiTemplateAnyID(uiLayout *layout, struct PointerRNA *ptr, char *propname, char *proptypename, char *text); -void uiTemplatePathBuilder(uiLayout *layout, struct bContext *C, struct PointerRNA *ptr, char *propname, +void uiTemplatePathBuilder(uiLayout *layout, struct PointerRNA *ptr, char *propname, struct PointerRNA *root_ptr, char *text); uiLayout *uiTemplateModifier(uiLayout *layout, struct bContext *C, struct PointerRNA *ptr); uiLayout *uiTemplateConstraint(uiLayout *layout, struct PointerRNA *ptr); void uiTemplatePreview(uiLayout *layout, struct ID *id, struct ID *parent, struct MTex *slot); void uiTemplateColorRamp(uiLayout *layout, struct PointerRNA *ptr, char *propname, int expand); -void uiTemplateHistogram(uiLayout *layout, struct PointerRNA *ptr, char *propname, int expand); -void uiTemplateWaveform(uiLayout *layout, struct PointerRNA *ptr, char *propname, int expand); -void uiTemplateVectorscope(uiLayout *layout, struct PointerRNA *ptr, char *propname, int expand); +void uiTemplateHistogram(uiLayout *layout, struct PointerRNA *ptr, char *propname); +void uiTemplateWaveform(uiLayout *layout, struct PointerRNA *ptr, char *propname); +void uiTemplateVectorscope(uiLayout *layout, struct PointerRNA *ptr, char *propname); void uiTemplateCurveMapping(uiLayout *layout, struct PointerRNA *ptr, char *propname, int type, int levels, int brush); void uiTemplateColorWheel(uiLayout *layout, struct PointerRNA *ptr, char *propname, int value_slider, int lock, int lock_luminosity, int cubic); void uiTemplateLayers(uiLayout *layout, struct PointerRNA *ptr, char *propname, diff --git a/source/blender/editors/include/UI_view2d.h b/source/blender/editors/include/UI_view2d.h index bf4a3de9cc6..9afa7dd012a 100644 --- a/source/blender/editors/include/UI_view2d.h +++ b/source/blender/editors/include/UI_view2d.h @@ -156,14 +156,14 @@ void UI_view2d_totRect_set_resize(struct View2D *v2d, int width, int height, int int UI_view2d_tab_set(struct View2D *v2d, int tab); /* view matrix operations */ -void UI_view2d_view_ortho(const struct bContext *C, struct View2D *v2d); -void UI_view2d_view_orthoSpecial(const struct bContext *C, struct View2D *v2d, short xaxis); +void UI_view2d_view_ortho(struct View2D *v2d); +void UI_view2d_view_orthoSpecial(struct ARegion *ar, struct View2D *v2d, short xaxis); void UI_view2d_view_restore(const struct bContext *C); /* grid drawing */ -View2DGrid *UI_view2d_grid_calc(const struct bContext *C, struct View2D *v2d, short xunits, short xclamp, short yunits, short yclamp, int winx, int winy); -void UI_view2d_grid_draw(const struct bContext *C, struct View2D *v2d, View2DGrid *grid, int flag); -void UI_view2d_constant_grid_draw(const struct bContext *C, struct View2D *v2d); +View2DGrid *UI_view2d_grid_calc(struct Scene *scene, struct View2D *v2d, short xunits, short xclamp, short yunits, short yclamp, int winx, int winy); +void UI_view2d_grid_draw(struct View2D *v2d, View2DGrid *grid, int flag); +void UI_view2d_constant_grid_draw(struct View2D *v2d); void UI_view2d_grid_size(View2DGrid *grid, float *r_dx, float *r_dy); void UI_view2d_grid_free(View2DGrid *grid); diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c index f4866237f46..f65b10eaaea 100644 --- a/source/blender/editors/interface/interface.c +++ b/source/blender/editors/interface/interface.c @@ -67,7 +67,7 @@ #define MENU_SEP_HEIGHT 6 /* - * a full doc with API notes can be found in bf-blender/blender/doc/interface_API.txt + * a full doc with API notes can be found in bf-blender/trunk/blender/doc/guides/interface_API.txt * * uiBlahBlah() external function * ui_blah_blah() internal function @@ -441,7 +441,7 @@ void uiCenteredBoundsBlock(uiBlock *block, int addval) /* link line drawing is not part of buttons or theme.. so we stick with it here */ -static void ui_draw_linkline(uiBut *but, uiLinkLine *line) +static void ui_draw_linkline(uiLinkLine *line) { rcti rect; @@ -470,7 +470,7 @@ static void ui_draw_links(uiBlock *block) if(but->type==LINK && but->link) { line= but->link->lines.first; while(line) { - ui_draw_linkline(but, line); + ui_draw_linkline(line); line= line->next; } } @@ -748,7 +748,7 @@ void uiDrawBlock(const bContext *C, uiBlock *block) if(block->flag & UI_BLOCK_LOOP) ui_draw_menu_back(&style, block, &rect); else if(block->panel) - ui_draw_aligned_panel(ar, &style, block, &rect); + ui_draw_aligned_panel(&style, block, &rect); /* widgets */ for(but= block->buttons.first; but; but= but->next) { @@ -835,7 +835,7 @@ static void ui_is_but_sel(uiBut *but) /* XXX 2.50 no links supported yet */ -static int uibut_contains_pt(uiBut *but, short *mval) +static int uibut_contains_pt(uiBut *UNUSED(but), short *UNUSED(mval)) { return 0; @@ -1093,12 +1093,12 @@ static void ui_do_active_linklines(uiBlock *block, short *mval) if(line==act) { if((line->flag & UI_SELECT)==0) { line->flag |= UI_SELECT; - ui_draw_linkline(but, line); + ui_draw_linkline(line); } } else if(line->flag & UI_SELECT) { line->flag &= ~UI_SELECT; - ui_draw_linkline(but, line); + ui_draw_linkline(line); } line= line->next; } @@ -2136,11 +2136,6 @@ void ui_check_but(uiBut *but) case HSVCUBE: case HSVCIRCLE: - { - float rgb[3]; - ui_get_but_vectorf(but, rgb); - rgb_to_hsv(rgb[0], rgb[1], rgb[2], but->hsv, but->hsv+1, but->hsv+2); - } break; default: strncpy(but->drawstr, but->str, UI_MAX_DRAW_STR); @@ -2187,7 +2182,7 @@ int ui_but_can_align(uiBut *but) return !ELEM3(but->type, LABEL, OPTION, OPTIONN); } -static void ui_block_do_align_but(uiBlock *block, uiBut *first, int nr) +static void ui_block_do_align_but(uiBut *first, int nr) { uiBut *prev, *but=NULL, *next; int flag= 0, cols=0, rows=0; @@ -2321,7 +2316,7 @@ void ui_block_do_align(uiBlock *block) for(but=block->buttons.first; but;) { if(but->alignnr) { nr= but->alignnr; - ui_block_do_align_but(block, but, nr); + ui_block_do_align_but(but, nr); /* skip with same number */ for(; but && but->alignnr == nr; but=but->next); diff --git a/source/blender/editors/interface/interface_draw.c b/source/blender/editors/interface/interface_draw.c index cf6970dc59f..81b04fea062 100644 --- a/source/blender/editors/interface/interface_draw.c +++ b/source/blender/editors/interface/interface_draw.c @@ -460,7 +460,7 @@ void uiEmboss(float x1, float y1, float x2, float y2, int sel) /* ************** SPECIAL BUTTON DRAWING FUNCTIONS ************* */ -void ui_draw_but_IMAGE(ARegion *ar, uiBut *but, uiWidgetColors *wcol, rcti *rect) +void ui_draw_but_IMAGE(ARegion *UNUSED(ar), uiBut *UNUSED(but), uiWidgetColors *UNUSED(wcol), rcti *rect) { extern char datatoc_splash_png[]; extern int datatoc_splash_png_size; @@ -564,7 +564,7 @@ static void ui_draw_but_CHARTAB(uiBut *but) int err; strcpy(tmpStr, G.selfont->name); - BLI_path_abs(tmpStr, G.sce); + BLI_path_abs(tmpStr, G.main->name); err = FTF_SetFont((unsigned char *)tmpStr, 0, 14.0); } } @@ -747,7 +747,7 @@ void histogram_draw_one(float r, float g, float b, float alpha, float x, float y glDisable(GL_LINE_SMOOTH); } -void ui_draw_but_HISTOGRAM(ARegion *ar, uiBut *but, uiWidgetColors *wcol, rcti *recti) +void ui_draw_but_HISTOGRAM(ARegion *ar, uiBut *but, uiWidgetColors *UNUSED(wcol), rcti *recti) { Histogram *hist = (Histogram *)but->poin; int res = hist->x_resolution; @@ -800,7 +800,7 @@ void ui_draw_but_HISTOGRAM(ARegion *ar, uiBut *but, uiWidgetColors *wcol, rcti * draw_scope_end(&rect, scissor); } -void ui_draw_but_WAVEFORM(ARegion *ar, uiBut *but, uiWidgetColors *wcol, rcti *recti) +void ui_draw_but_WAVEFORM(ARegion *ar, uiBut *but, uiWidgetColors *UNUSED(wcol), rcti *recti) { Scopes *scopes = (Scopes *)but->poin; rctf rect; @@ -1023,7 +1023,7 @@ void vectorscope_draw_target(float centerx, float centery, float diam, float r, glEnd(); } -void ui_draw_but_VECTORSCOPE(ARegion *ar, uiBut *but, uiWidgetColors *wcol, rcti *recti) +void ui_draw_but_VECTORSCOPE(ARegion *ar, uiBut *but, uiWidgetColors *UNUSED(wcol), rcti *recti) { Scopes *scopes = (Scopes *)but->poin; rctf rect; @@ -1105,7 +1105,7 @@ void ui_draw_but_VECTORSCOPE(ARegion *ar, uiBut *but, uiWidgetColors *wcol, rcti glDisable(GL_BLEND); } -void ui_draw_but_COLORBAND(uiBut *but, uiWidgetColors *wcol, rcti *rect) +void ui_draw_but_COLORBAND(uiBut *but, uiWidgetColors *UNUSED(wcol), rcti *rect) { ColorBand *coba; CBData *cbd; @@ -1404,7 +1404,7 @@ void ui_draw_but_CURVE(ARegion *ar, uiBut *but, uiWidgetColors *wcol, rcti *rect if (but->a1 != -1) { if (but->a1 == UI_GRAD_H) { rcti grid; - float col[3]; + float col[3]= {0.0f, 0.0f, 0.0f}; /* dummy arg */ grid.xmin = rect->xmin + zoomx*(-offsx); grid.xmax = rect->xmax + zoomx*(-offsx); diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c index 6d8c368db3f..ab8fda85ff2 100644 --- a/source/blender/editors/interface/interface_handlers.c +++ b/source/blender/editors/interface/interface_handlers.c @@ -429,7 +429,7 @@ static void ui_apply_but_BLOCK(bContext *C, uiBut *but, uiHandleButtonData *data data->applied= 1; } -static void ui_apply_but_TOG(bContext *C, uiBlock *block, uiBut *but, uiHandleButtonData *data) +static void ui_apply_but_TOG(bContext *C, uiBut *but, uiHandleButtonData *data) { double value; int w, lvalue, push; @@ -896,7 +896,7 @@ static void ui_apply_button(bContext *C, uiBlock *block, uiBut *but, uiHandleBut case BUT_TOGDUAL: case OPTION: case OPTIONN: - ui_apply_but_TOG(C, block, but, data); + ui_apply_but_TOG(C, but, data); break; case ROW: case LISTROW: @@ -2830,17 +2830,18 @@ static int ui_do_but_BLOCK(bContext *C, uiBut *but, uiHandleButtonData *data, wm } else if(but->type==COL) { if( ELEM(event->type, WHEELDOWNMOUSE, WHEELUPMOUSE) && event->alt) { + float *hsv= ui_block_hsv_get(but->block); float col[3]; ui_get_but_vectorf(but, col); - rgb_to_hsv(col[0], col[1], col[2], but->hsv, but->hsv+1, but->hsv+2); + rgb_to_hsv_compat(col[0], col[1], col[2], hsv, hsv+1, hsv+2); if(event->type==WHEELDOWNMOUSE) - but->hsv[2]= CLAMPIS(but->hsv[2]-0.05f, 0.0f, 1.0f); + hsv[2]= CLAMPIS(hsv[2]-0.05f, 0.0f, 1.0f); else - but->hsv[2]= CLAMPIS(but->hsv[2]+0.05f, 0.0f, 1.0f); + hsv[2]= CLAMPIS(hsv[2]+0.05f, 0.0f, 1.0f); - hsv_to_rgb(but->hsv[0], but->hsv[1], but->hsv[2], data->vec, data->vec+1, data->vec+2); + hsv_to_rgb(hsv[0], hsv[1], hsv[2], data->vec, data->vec+1, data->vec+2); ui_set_but_vectorf(but, data->vec); button_activate_state(C, but, BUTTON_STATE_EXIT); @@ -2970,7 +2971,8 @@ static int ui_do_but_NORMAL(bContext *C, uiBlock *block, uiBut *but, uiHandleBut static int ui_numedit_but_HSVCUBE(uiBut *but, uiHandleButtonData *data, int mx, int my) { - float rgb[3], hsv[3]; + float rgb[3]; + float *hsv= ui_block_hsv_get(but->block); float x, y; int changed= 1; int color_profile = but->block->color_profile; @@ -2979,10 +2981,11 @@ static int ui_numedit_but_HSVCUBE(uiBut *but, uiHandleButtonData *data, int mx, if (RNA_property_subtype(but->rnaprop) == PROP_COLOR_GAMMA) color_profile = BLI_PR_NONE; } - + ui_get_but_vectorf(but, rgb); - rgb_to_hsv(rgb[0], rgb[1], rgb[2], hsv, hsv+1, hsv+2); - + + rgb_to_hsv_compat(rgb[0], rgb[1], rgb[2], hsv, hsv+1, hsv+2); + /* relative position within box */ x= ((float)mx-but->x1)/(but->x2-but->x1); y= ((float)my-but->y1)/(but->y2-but->y1); @@ -3059,21 +3062,22 @@ static int ui_do_but_HSVCUBE(bContext *C, uiBlock *block, uiBut *but, uiHandleBu } else if (event->type == ZEROKEY && event->val == KM_PRESS) { if (but->a1==9){ - float rgb[3], hsv[3], def_hsv[3]; - float *def; int len; /* reset only value */ len= RNA_property_array_length(&but->rnapoin, but->rnaprop); if (len >= 3) { + float rgb[3], def_hsv[3]; + float *def; + float *hsv= ui_block_hsv_get(but->block); def= MEM_callocN(sizeof(float)*len, "reset_defaults - float"); RNA_property_float_get_default_array(&but->rnapoin, but->rnaprop, def); rgb_to_hsv(def[0], def[1], def[2], def_hsv, def_hsv+1, def_hsv+2); ui_get_but_vectorf(but, rgb); - rgb_to_hsv(rgb[0], rgb[1], rgb[2], hsv, hsv+1, hsv+2); + rgb_to_hsv_compat(rgb[0], rgb[1], rgb[2], hsv, hsv+1, hsv+2); hsv_to_rgb(hsv[0], hsv[1], def_hsv[2], rgb, rgb+1, rgb+2); ui_set_but_vectorf(but, rgb); @@ -3111,13 +3115,15 @@ static int ui_numedit_but_HSVCIRCLE(uiBut *but, uiHandleButtonData *data, int mx { rcti rect; int changed= 1; - float rgb[3], hsv[3]; + float rgb[3]; + float hsv[3]; rect.xmin= but->x1; rect.xmax= but->x2; rect.ymin= but->y1; rect.ymax= but->y2; ui_get_but_vectorf(but, rgb); - rgb_to_hsv(rgb[0], rgb[1], rgb[2], hsv, hsv+1, hsv+2); + copy_v3_v3(hsv, ui_block_hsv_get(but->block)); + rgb_to_hsv_compat(rgb[0], rgb[1], rgb[2], hsv, hsv+1, hsv+2); /* exception, when using color wheel in 'locked' value state: * allow choosing a hue for black values, by giving a tiny increment */ @@ -3176,21 +3182,22 @@ static int ui_do_but_HSVCIRCLE(bContext *C, uiBlock *block, uiBut *but, uiHandle return WM_UI_HANDLER_BREAK; } else if (event->type == ZEROKEY && event->val == KM_PRESS) { - float rgb[3], hsv[3], def_hsv[3]; - float *def; int len; /* reset only saturation */ len= RNA_property_array_length(&but->rnapoin, but->rnaprop); if (len >= 3) { + float rgb[3], def_hsv[3]; + float *def; + float *hsv= ui_block_hsv_get(but->block); def= MEM_callocN(sizeof(float)*len, "reset_defaults - float"); RNA_property_float_get_default_array(&but->rnapoin, but->rnaprop, def); rgb_to_hsv(def[0], def[1], def[2], def_hsv, def_hsv+1, def_hsv+2); ui_get_but_vectorf(but, rgb); - rgb_to_hsv(rgb[0], rgb[1], rgb[2], hsv, hsv+1, hsv+2); + rgb_to_hsv_compat(rgb[0], rgb[1], rgb[2], hsv, hsv+1, hsv+2); hsv_to_rgb(hsv[0], def_hsv[1], hsv[2], rgb, rgb+1, rgb+2); ui_set_but_vectorf(but, rgb); @@ -3210,12 +3217,14 @@ static int ui_do_but_HSVCIRCLE(bContext *C, uiBlock *block, uiBut *but, uiHandle } /* XXX hardcoded keymap check.... */ else if(event->type == WHEELDOWNMOUSE) { - but->hsv[2]= CLAMPIS(but->hsv[2]-0.05f, 0.0f, 1.0f); + float *hsv= ui_block_hsv_get(but->block); + hsv[2]= CLAMPIS(hsv[2]-0.05f, 0.0f, 1.0f); ui_set_but_hsv(but); // converts to rgb ui_numedit_apply(C, block, but, data); } else if(event->type == WHEELUPMOUSE) { - but->hsv[2]= CLAMPIS(but->hsv[2]+0.05f, 0.0f, 1.0f); + float *hsv= ui_block_hsv_get(but->block); + hsv[2]= CLAMPIS(hsv[2]+0.05f, 0.0f, 1.0f); ui_set_but_hsv(but); // converts to rgb ui_numedit_apply(C, block, but, data); } @@ -3558,7 +3567,7 @@ static int ui_do_but_CURVE(bContext *C, uiBlock *block, uiBut *but, uiHandleButt return WM_UI_HANDLER_CONTINUE; } -static int in_scope_resize_zone(uiBut *but, int x, int y) +static int in_scope_resize_zone(uiBut *but, int UNUSED(x), int y) { // bottom corner return (x > but->x2 - SCOPE_RESIZE_PAD) && (y < but->y1 + SCOPE_RESIZE_PAD); return (y < but->y1 + SCOPE_RESIZE_PAD); @@ -3797,7 +3806,7 @@ static int ui_do_but_VECTORSCOPE(bContext *C, uiBlock *block, uiBut *but, uiHand } #ifdef INTERNATIONAL -static int ui_do_but_CHARTAB(bContext *C, uiBlock *block, uiBut *but, uiHandleButtonData *data, wmEvent *event) +static int ui_do_but_CHARTAB(bContext *UNUSED(C), uiBlock *UNUSED(block), uiBut *UNUSED(but), uiHandleButtonData *UNUSED(data), wmEvent *UNUSED(event)) { /* XXX 2.50 bad global and state access */ #if 0 @@ -3935,18 +3944,19 @@ static int ui_do_but_LINK(bContext *C, uiBut *but, uiHandleButtonData *data, wmE return WM_UI_HANDLER_CONTINUE; } -static void but_shortcut_name_func(bContext *C, void *arg1, int event) +static void but_shortcut_name_func(bContext *C, void *arg1, int UNUSED(event)) { uiBut *but = (uiBut *)arg1; - - char buf[512], *butstr, *cpoin; - + if (but->optype) { + char buf[512], *butstr, *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; + butstr= MEM_mallocN(strlen(but->str)+strlen(buf)+2, "menu_block_set_keymaps"); // XXX but->str changed... should not, remove the hotkey from it @@ -3962,6 +3972,11 @@ static void but_shortcut_name_func(bContext *C, void *arg1, int event) 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 { /* shortcut was removed */ cpoin= strchr(but->str, '|'); @@ -4024,7 +4039,7 @@ static uiBlock *menu_add_shortcut(bContext *C, ARegion *ar, void *arg) uiBlockSetHandleFunc(block, but_shortcut_name_func, but); uiBlockSetFlag(block, UI_BLOCK_RET_1); uiBlockSetDirection(block, UI_CENTER); - + layout= uiBlockLayout(block, UI_LAYOUT_VERTICAL, UI_LAYOUT_PANEL, 0, 0, 200, 20, style); uiItemR(layout, &ptr, "type", UI_ITEM_R_FULL_EVENT|UI_ITEM_R_IMMEDIATE, "", 0); @@ -4035,14 +4050,14 @@ static uiBlock *menu_add_shortcut(bContext *C, ARegion *ar, void *arg) return block; } -static void popup_change_shortcut_func(bContext *C, void *arg1, void *arg2) +static void popup_change_shortcut_func(bContext *C, void *arg1, void *UNUSED(arg2)) { uiBut *but = (uiBut *)arg1; button_timers_tooltip_remove(C, but); uiPupBlock(C, menu_change_shortcut, but); } -static void remove_shortcut_func(bContext *C, void *arg1, void *arg2) +static void remove_shortcut_func(bContext *C, void *arg1, void *UNUSED(arg2)) { uiBut *but = (uiBut *)arg1; wmKeyMap *km; @@ -4056,7 +4071,7 @@ static void remove_shortcut_func(bContext *C, void *arg1, void *arg2) but_shortcut_name_func(C, but, 0); } -static void popup_add_shortcut_func(bContext *C, void *arg1, void *arg2) +static void popup_add_shortcut_func(bContext *C, void *arg1, void *UNUSED(arg2)) { uiBut *but = (uiBut *)arg1; button_timers_tooltip_remove(C, but); @@ -4266,7 +4281,7 @@ static int ui_do_button(bContext *C, uiBlock *block, uiBut *but, wmEvent *event) if(but->flag & UI_BUT_DISABLED) return WM_UI_HANDLER_CONTINUE; - if(data->state == BUTTON_STATE_HIGHLIGHT) { + if(data->state == BUTTON_STATE_HIGHLIGHT && event->prevval != KM_PRESS) { /* check prevval because of modal operators [#24016] */ /* handle copy-paste */ if(ELEM(event->type, CKEY, VKEY) && event->val==KM_PRESS && (event->ctrl || event->oskey)) { ui_but_copy_paste(C, but, data, (event->type == CKEY)? 'c': 'v'); @@ -4564,7 +4579,7 @@ static int ui_mouse_inside_button(ARegion *ar, uiBut *but, int x, int y) return 1; } -static uiBut *ui_but_find_mouse_over(wmWindow *win, ARegion *ar, int x, int y) +static uiBut *ui_but_find_mouse_over(ARegion *ar, int x, int y) { uiBlock *block; uiBut *but, *butover= NULL; @@ -4596,7 +4611,7 @@ static uiBut *ui_but_find_mouse_over(wmWindow *win, ARegion *ar, int x, int y) return butover; } -static uiBut *ui_list_find_mouse_over(wmWindow *win, ARegion *ar, int x, int y) +static uiBut *ui_list_find_mouse_over(ARegion *ar, int x, int y) { uiBlock *block; uiBut *but; @@ -5017,11 +5032,10 @@ static uiBut *uit_but_find_open_event(ARegion *ar, wmEvent *event) static int ui_handle_button_over(bContext *C, wmEvent *event, ARegion *ar) { - wmWindow *win= CTX_wm_window(C); uiBut *but; if(event->type == MOUSEMOVE) { - but= ui_but_find_mouse_over(win, ar, event->x, event->y); + but= ui_but_find_mouse_over(ar, event->x, event->y); if(but) button_activate_init(C, ar, but, BUTTON_ACTIVATE_OVER); } @@ -5099,7 +5113,7 @@ static int ui_handle_button_event(bContext *C, wmEvent *event, uiBut *but) data->cancel= 1; button_activate_state(C, but, BUTTON_STATE_EXIT); } - else if(ui_but_find_mouse_over(data->window, ar, event->x, event->y) != but) { + else if(ui_but_find_mouse_over(ar, event->x, event->y) != but) { data->cancel= 1; button_activate_state(C, but, BUTTON_STATE_EXIT); } @@ -5197,7 +5211,7 @@ static int ui_handle_button_event(bContext *C, wmEvent *event, uiBut *but) else if(data->state == BUTTON_STATE_MENU_OPEN) { switch(event->type) { case MOUSEMOVE: { - uiBut *bt= ui_but_find_mouse_over(data->window, ar, event->x, event->y); + uiBut *bt= ui_but_find_mouse_over(ar, event->x, event->y); if(bt && bt->active != data) { if(but->type != COL) /* exception */ @@ -5232,8 +5246,7 @@ static int ui_handle_button_event(bContext *C, wmEvent *event, uiBut *but) static int ui_handle_list_event(bContext *C, wmEvent *event, ARegion *ar) { - wmWindow *win= CTX_wm_window(C); - uiBut *but= ui_list_find_mouse_over(win, ar, event->x, event->y); + uiBut *but= ui_list_find_mouse_over(ar, event->x, event->y); int retval= WM_UI_HANDLER_CONTINUE; int value, min, max; @@ -5420,7 +5433,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 topmenu) +int ui_handle_menu_event(bContext *C, wmEvent *event, uiPopupBlockHandle *menu, int UNUSED(topmenu)) { ARegion *ar; uiBlock *block; @@ -5526,16 +5539,20 @@ int ui_handle_menu_event(bContext *C, wmEvent *event, uiPopupBlockHandle *menu, ((ELEM(event->type, UPARROWKEY, WHEELUPMOUSE)) && (block->direction & UI_RIGHT)) || ((ELEM(event->type, DOWNARROWKEY, WHEELDOWNMOUSE)) && (block->direction & UI_TOP)) ) { - if(ui_but_first(block)->type & BUT) + if((bt= ui_but_first(block)) && (bt->type & BUT)) { bt= ui_but_last(block); - else - bt= ui_but_first(block); + } + else { + /* keep ui_but_first() */ + } } else { - if(ui_but_first(block)->type & BUT) - bt= ui_but_first(block); - else + if((bt= ui_but_first(block)) && (bt->type & BUT)) { + /* keep ui_but_first() */ + } + else { bt= ui_but_last(block); + } } if(bt) @@ -5780,7 +5797,7 @@ static int ui_handle_menus_recursive(bContext *C, wmEvent *event, uiPopupBlockHa /* *************** UI event handlers **************** */ -static int ui_handler_region(bContext *C, wmEvent *event, void *userdata) +static int ui_handler_region(bContext *C, wmEvent *event, void *UNUSED(userdata)) { ARegion *ar; uiBut *but; @@ -5818,7 +5835,7 @@ static int ui_handler_region(bContext *C, wmEvent *event, void *userdata) return retval; } -static void ui_handler_remove_region(bContext *C, void *userdata) +static void ui_handler_remove_region(bContext *C, void *UNUSED(userdata)) { bScreen *sc; ARegion *ar; @@ -5838,7 +5855,7 @@ static void ui_handler_remove_region(bContext *C, void *userdata) ui_apply_but_funcs_after(C); } -static int ui_handler_region_menu(bContext *C, wmEvent *event, void *userdata) +static int ui_handler_region_menu(bContext *C, wmEvent *event, void *UNUSED(userdata)) { ARegion *ar; uiBut *but; diff --git a/source/blender/editors/interface/interface_icons.c b/source/blender/editors/interface/interface_icons.c index 3fa53b73015..0ade3e6199f 100644 --- a/source/blender/editors/interface/interface_icons.c +++ b/source/blender/editors/interface/interface_icons.c @@ -28,6 +28,7 @@ #include <math.h> #include <stdlib.h> #include <string.h> +#include <assert.h> #ifndef WIN32 #include <unistd.h> @@ -331,7 +332,7 @@ static void vicon_editmode_hlt_draw(int x, int y, int w, int h, float alpha) viconutil_draw_points(pts, 3, 1); } -static void vicon_editmode_dehlt_draw(int x, int y, int w, int h, float alpha) +static void vicon_editmode_dehlt_draw(int x, int y, int w, int h, float UNUSED(alpha)) { GLint pts[3][2]; @@ -346,7 +347,7 @@ static void vicon_editmode_dehlt_draw(int x, int y, int w, int h, float alpha) viconutil_draw_points(pts, 3, 1); } -static void vicon_disclosure_tri_right_draw(int x, int y, int w, int h, float alpha) +static void vicon_disclosure_tri_right_draw(int x, int y, int w, int UNUSED(h), float alpha) { GLint pts[3][2]; int cx = x+w/2; @@ -371,7 +372,7 @@ static void vicon_disclosure_tri_right_draw(int x, int y, int w, int h, float al viconutil_draw_lineloop_smooth(pts, 3); } -static void vicon_small_tri_right_draw(int x, int y, int w, int h, float alpha) +static void vicon_small_tri_right_draw(int x, int y, int w, int UNUSED(h), float alpha) { GLint pts[3][2]; int cx = x+w/2-4; @@ -393,7 +394,7 @@ static void vicon_small_tri_right_draw(int x, int y, int w, int h, float alpha) glShadeModel(GL_FLAT); } -static void vicon_disclosure_tri_down_draw(int x, int y, int w, int h, float alpha) +static void vicon_disclosure_tri_down_draw(int x, int y, int w, int UNUSED(h), float alpha) { GLint pts[3][2]; int cx = x+w/2; @@ -418,7 +419,7 @@ static void vicon_disclosure_tri_down_draw(int x, int y, int w, int h, float alp viconutil_draw_lineloop_smooth(pts, 3); } -static void vicon_move_up_draw(int x, int y, int w, int h, float alpha) +static void vicon_move_up_draw(int x, int y, int w, int h, float UNUSED(alpha)) { int d=-2; @@ -436,7 +437,7 @@ static void vicon_move_up_draw(int x, int y, int w, int h, float alpha) glDisable(GL_LINE_SMOOTH); } -static void vicon_move_down_draw(int x, int y, int w, int h, float alpha) +static void vicon_move_down_draw(int x, int y, int w, int h, float UNUSED(alpha)) { int d=2; @@ -843,8 +844,17 @@ static void icon_set_image(bContext *C, ID *id, PreviewImage* prv_img, int miple prv_img->w[miplevel], prv_img->h[miplevel]); } -static void icon_draw_rect(float x, float y, int w, int h, float aspect, int rw, int rh, unsigned int *rect, float alpha, float *rgb) +static void icon_draw_rect(float x, float y, int w, int h, float UNUSED(aspect), int rw, int rh, unsigned int *rect, float alpha, float *rgb, short is_preview) { + ImBuf *ima= NULL; + + /* sanity check */ + if(w<=0 || h<=0 || w>2000 || h>2000) { + printf("icon_draw_rect: icons are %i x %i pixels?\n", w, h); + assert(!"invalid icon size"); + return; + } + /* modulate color */ if(alpha != 1.0f) glPixelTransferf(GL_ALPHA_SCALE, alpha); @@ -854,35 +864,27 @@ static void icon_draw_rect(float x, float y, int w, int h, float aspect, int rw, glPixelTransferf(GL_GREEN_SCALE, rgb[1]); glPixelTransferf(GL_BLUE_SCALE, rgb[2]); } - - /* draw */ - if((w<1 || h<1)) { - // XXX - TODO 2.5 verify whether this case can happen - if (G.f & G_DEBUG) - printf("what the heck! - icons are %i x %i pixels?\n", w, h); - } - /* rect contains image in 'rendersize', we only scale if needed */ - else if(rw!=w && rh!=h) { - if(w>2000 || h>2000) { /* something has gone wrong! */ - if (G.f & G_DEBUG) - printf("insane icon size w=%d h=%d\n",w,h); - } - else { - ImBuf *ima; - /* first allocate imbuf for scaling and copy preview into it */ - ima = IMB_allocImBuf(rw, rh, 32, IB_rect, 0); - memcpy(ima->rect, rect, rw*rh*sizeof(unsigned int)); - - /* scale it */ - IMB_scaleImBuf(ima, w, h); - glaDrawPixelsSafe(x, y, w, h, w, GL_RGBA, GL_UNSIGNED_BYTE, ima->rect); - - IMB_freeImBuf(ima); - } + /* rect contains image in 'rendersize', we only scale if needed */ + if(rw!=w && rh!=h) { + /* first allocate imbuf for scaling and copy preview into it */ + ima = IMB_allocImBuf(rw, rh, 32, IB_rect); + memcpy(ima->rect, rect, rw*rh*sizeof(unsigned int)); + IMB_scaleImBuf(ima, w, h); /* scale it */ + rect= ima->rect; } - else + + /* draw */ + if(is_preview) { glaDrawPixelsSafe(x, y, w, h, w, GL_RGBA, GL_UNSIGNED_BYTE, rect); + } + else { + glRasterPos2f(x, y); + glDrawPixels(w, h, GL_RGBA, GL_UNSIGNED_BYTE, rect); + } + + if(ima) + IMB_freeImBuf(ima); /* restore color */ if(alpha != 0.0f) @@ -895,7 +897,7 @@ static void icon_draw_rect(float x, float y, int w, int h, float aspect, int rw, } } -static void icon_draw_texture(float x, float y, float w, float h, int ix, int iy, int iw, int ih, float alpha, float *rgb) +static void icon_draw_texture(float x, float y, float w, float h, int ix, int iy, int UNUSED(iw), int ih, float alpha, float *rgb) { float x1, x2, y1, y2; @@ -938,7 +940,7 @@ static int preview_size(int miplevel) return 0; } -static void icon_draw_size(float x, float y, int icon_id, float aspect, float alpha, float *rgb, int miplevel, int draw_size, int nocreate) +static void icon_draw_size(float x, float y, int icon_id, float aspect, float alpha, float *rgb, int miplevel, int draw_size, int UNUSED(nocreate), int is_preview) { Icon *icon = NULL; DrawInfo *di = NULL; @@ -981,7 +983,7 @@ static void icon_draw_size(float x, float y, int icon_id, float aspect, float al if(!iimg->rect) return; /* something has gone wrong! */ - icon_draw_rect(x, y, w, h, aspect, iimg->w, iimg->h, iimg->rect, alpha, rgb); + icon_draw_rect(x, y, w, h, aspect, iimg->w, iimg->h, iimg->rect, alpha, rgb, is_preview); } else if(di->type == ICON_TYPE_PREVIEW) { PreviewImage* pi = BKE_previewimg_get((ID*)icon->obj); @@ -992,7 +994,7 @@ static void icon_draw_size(float x, float y, int icon_id, float aspect, float al /* preview images use premul alpha ... */ glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA); - icon_draw_rect(x, y, w, h, aspect, pi->w[miplevel], pi->h[miplevel], pi->rect[miplevel], 1.0f, NULL); + icon_draw_rect(x, y, w, h, aspect, pi->w[miplevel], pi->h[miplevel], pi->rect[miplevel], 1.0f, NULL, is_preview); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); } } @@ -1082,7 +1084,7 @@ int ui_id_icon_get(bContext *C, ID *id, int preview) static void icon_draw_mipmap(float x, float y, int icon_id, float aspect, float alpha, int miplevel, int nocreate) { int draw_size = preview_size(miplevel); - icon_draw_size(x, y, icon_id, aspect, alpha, NULL, miplevel, draw_size, nocreate); + icon_draw_size(x, y, icon_id, aspect, alpha, NULL, miplevel, draw_size, nocreate, FALSE); } void UI_icon_draw_aspect(float x, float y, int icon_id, float aspect, float alpha) @@ -1093,7 +1095,7 @@ void UI_icon_draw_aspect(float x, float y, int icon_id, float aspect, float alph void UI_icon_draw_aspect_color(float x, float y, int icon_id, float aspect, float *rgb) { int draw_size = preview_size(PREVIEW_MIPMAP_ZERO); - icon_draw_size(x, y, icon_id, aspect, 1.0f, rgb, PREVIEW_MIPMAP_ZERO, draw_size, 0); + icon_draw_size(x, y, icon_id, aspect, 1.0f, rgb, PREVIEW_MIPMAP_ZERO, draw_size, FALSE, FALSE); } void UI_icon_draw(float x, float y, int icon_id) @@ -1103,7 +1105,7 @@ void UI_icon_draw(float x, float y, int icon_id) void UI_icon_draw_size(float x, float y, int size, int icon_id, float alpha) { - icon_draw_size(x, y, icon_id, 1.0f, alpha, NULL, 0, size, 1); + icon_draw_size(x, y, icon_id, 1.0f, alpha, NULL, PREVIEW_MIPMAP_ZERO, size, TRUE, FALSE); } void UI_icon_draw_preview(float x, float y, int icon_id) @@ -1118,6 +1120,6 @@ void UI_icon_draw_preview_aspect(float x, float y, int icon_id, float aspect) void UI_icon_draw_preview_aspect_size(float x, float y, int icon_id, float aspect, int size) { - icon_draw_size(x, y, icon_id, aspect, 1.0f, NULL, PREVIEW_MIPMAP_LARGE, size, 0); + icon_draw_size(x, y, icon_id, aspect, 1.0f, NULL, PREVIEW_MIPMAP_LARGE, size, FALSE, TRUE); } diff --git a/source/blender/editors/interface/interface_intern.h b/source/blender/editors/interface/interface_intern.h index eb28df54b13..7a0f69fc838 100644 --- a/source/blender/editors/interface/interface_intern.h +++ b/source/blender/editors/interface/interface_intern.h @@ -171,8 +171,9 @@ struct uiBut { char *poin; float hardmin, hardmax, softmin, softmax; - float a1, a2, hsv[3]; // hsv is temp memory for hsv buttons + float a1, a2; float aspect; + char col[4]; uiButHandleFunc func; void *func_arg1; @@ -302,15 +303,16 @@ struct uiBlock { short auto_open; double auto_open_last; - char active; // to keep blocks while drawing and free them afterwards - char tooltipdisabled; // to avoid tooltip after click - short lock; char *lockstr; + + char lock; + char active; // to keep blocks while drawing and free them afterwards + char tooltipdisabled; // to avoid tooltip after click + char endblock; // uiEndBlock done? float xofs, yofs; // offset to parent button int dobounds, mx, my; // for doing delayed int bounds, minbounds; // for doing delayed - int endblock; // uiEndBlock done? rctf safety; // pulldowns, to detect outside, can differ per case how it is created ListBase saferct; // uiSafetyRct list @@ -319,9 +321,10 @@ struct uiBlock { int puphash; // popup menu hash for memory - int color_profile; // color profile for correcting linear colors for display - void *evil_C; // XXX hack for dynamic operator enums + + float _hsv[3]; // XXX, only access via ui_block_hsv_get() + char color_profile; // color profile for correcting linear colors for display }; typedef struct uiSafetyRct { @@ -408,6 +411,8 @@ void ui_tooltip_free(struct bContext *C, struct ARegion *ar); uiBut *ui_popup_menu_memory(uiBlock *block, uiBut *but); +float *ui_block_hsv_get(uiBlock *block); + /* searchbox for string button */ ARegion *ui_searchbox_create(struct bContext *C, struct ARegion *butregion, uiBut *but); int ui_searchbox_inside(struct ARegion *ar, int x, int y); @@ -436,12 +441,12 @@ void autocomplete_end(struct AutoComplete *autocpl, char *autoname); /* interface_panel.c */ extern int ui_handler_panel_region(struct bContext *C, struct wmEvent *event); -extern void ui_draw_aligned_panel(struct ARegion *ar, struct uiStyle *style, uiBlock *block, rcti *rect); +extern void ui_draw_aligned_panel(struct uiStyle *style, uiBlock *block, rcti *rect); /* interface_draw.c */ extern void ui_dropshadow(rctf *rct, float radius, float aspect, int select); -void ui_draw_gradient(rcti *rect, float *rgb, int type, float alpha); +void ui_draw_gradient(rcti *rect, float *hsv, int type, float alpha); void ui_draw_but_HISTOGRAM(ARegion *ar, uiBut *but, struct uiWidgetColors *wcol, rcti *rect); void ui_draw_but_WAVEFORM(ARegion *ar, uiBut *but, struct uiWidgetColors *wcol, rcti *rect); diff --git a/source/blender/editors/interface/interface_layout.c b/source/blender/editors/interface/interface_layout.c index 45b38a8c9a9..f729124e405 100644 --- a/source/blender/editors/interface/interface_layout.c +++ b/source/blender/editors/interface/interface_layout.c @@ -434,7 +434,7 @@ static void ui_item_array(uiLayout *layout, uiBlock *block, char *name, int icon uiBlockSetCurLayout(block, layout); } -static void ui_item_enum_expand(uiLayout *layout, uiBlock *block, PointerRNA *ptr, PropertyRNA *prop, char *uiname, int x, int y, int w, int h, int icon_only) +static void ui_item_enum_expand(uiLayout *layout, uiBlock *block, PointerRNA *ptr, PropertyRNA *prop, char *uiname, int h, int icon_only) { uiBut *but; EnumPropertyItem *item; @@ -472,7 +472,7 @@ static void ui_item_enum_expand(uiLayout *layout, uiBlock *block, PointerRNA *pt } /* callback for keymap item change button */ -static void ui_keymap_but_cb(bContext *C, void *but_v, void *key_v) +static void ui_keymap_but_cb(bContext *UNUSED(C), void *but_v, void *UNUSED(key_v)) { uiBut *but= but_v; @@ -956,7 +956,7 @@ void uiItemFullR(uiLayout *layout, PointerRNA *ptr, PropertyRNA *prop, int index } /* expanded enum */ else if(type == PROP_ENUM && (expand || RNA_property_flag(prop) & PROP_ENUM_FLAG)) - ui_item_enum_expand(layout, block, ptr, prop, name, 0, 0, w, h, icon_only); + ui_item_enum_expand(layout, block, ptr, prop, name, h, icon_only); /* property with separate label */ else if(type == PROP_ENUM || type == PROP_STRING || type == PROP_POINTER) { but= ui_item_with_label(layout, block, name, icon, ptr, prop, index, 0, 0, w, h, flag); @@ -1026,7 +1026,7 @@ void uiItemEnumR_string(uiLayout *layout, struct PointerRNA *ptr, char *propname for(a=0; item[a].identifier; a++) { if(item[a].value == ivalue) { - uiItemFullR(layout, ptr, prop, RNA_ENUM_VALUE, ivalue, 0, (char*)item[a].name, item[a].icon); + uiItemFullR(layout, ptr, prop, RNA_ENUM_VALUE, ivalue, 0, name ? name : (char*)item[a].name, icon ? icon : item[a].icon); break; } } @@ -1324,7 +1324,7 @@ static void ui_item_menu(uiLayout *layout, char *name, int icon, uiMenuCreateFun } } -void uiItemM(uiLayout *layout, bContext *C, char *menuname, char *name, int icon) +void uiItemM(uiLayout *layout, bContext *UNUSED(C), char *menuname, char *name, int icon) { MenuType *mt; @@ -1434,7 +1434,7 @@ typedef struct MenuItemLevel { PointerRNA rnapoin; } MenuItemLevel; -static void menu_item_enum_opname_menu(bContext *C, uiLayout *layout, void *arg) +static void menu_item_enum_opname_menu(bContext *UNUSED(C), uiLayout *layout, void *arg) { MenuItemLevel *lvl= (MenuItemLevel*)(((uiBut*)arg)->func_argN); @@ -1465,7 +1465,7 @@ void uiItemMenuEnumO(uiLayout *layout, char *opname, char *propname, char *name, ui_item_menu(layout, name, icon, menu_item_enum_opname_menu, NULL, lvl); } -static void menu_item_enum_rna_menu(bContext *C, uiLayout *layout, void *arg) +static void menu_item_enum_rna_menu(bContext *UNUSED(C), uiLayout *layout, void *arg) { MenuItemLevel *lvl= (MenuItemLevel*)(((uiBut*)arg)->func_argN); @@ -1674,7 +1674,7 @@ static void ui_litem_layout_column(uiLayout *litem) } /* root layout */ -static void ui_litem_estimate_root(uiLayout *litem) +static void ui_litem_estimate_root(uiLayout *UNUSED(litem)) { /* nothing to do */ } diff --git a/source/blender/editors/interface/interface_ops.c b/source/blender/editors/interface/interface_ops.c index bcde54f473a..10458a763e6 100644 --- a/source/blender/editors/interface/interface_ops.c +++ b/source/blender/editors/interface/interface_ops.c @@ -134,7 +134,7 @@ static int eyedropper_modal(bContext *C, wmOperator *op, wmEvent *event) } /* Modal Operator init */ -static int eyedropper_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int eyedropper_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { /* init */ if (eyedropper_init(C, op)) { @@ -195,7 +195,7 @@ void UI_OT_eyedropper(wmOperatorType *ot) /* Reset Default Theme ------------------------ */ -static int reset_default_theme_exec(bContext *C, wmOperator *op) +static int reset_default_theme_exec(bContext *C, wmOperator *UNUSED(op)) { ui_theme_init_default(); WM_event_add_notifier(C, NC_WINDOW, NULL); @@ -219,7 +219,7 @@ void UI_OT_reset_default_theme(wmOperatorType *ot) /* Copy Data Path Operator ------------------------ */ -static int copy_data_path_button_exec(bContext *C, wmOperator *op) +static int copy_data_path_button_exec(bContext *C, wmOperator *UNUSED(op)) { PointerRNA ptr; PropertyRNA *prop; diff --git a/source/blender/editors/interface/interface_panel.c b/source/blender/editors/interface/interface_panel.c index 9d22f3c5212..d6cb8161916 100644 --- a/source/blender/editors/interface/interface_panel.c +++ b/source/blender/editors/interface/interface_panel.c @@ -25,7 +25,7 @@ * ***** END GPL LICENSE BLOCK ***** */ -/* a full doc with API notes can be found in bf-blender/blender/doc/interface_API.txt */ +/* a full doc with API notes can be found in bf-blender/trunk/blender/doc/guides/interface_API.txt */ #include <math.h> #include <stdlib.h> @@ -316,7 +316,7 @@ void uiPanelPush(uiBlock *block) glTranslatef((float)block->panel->ofsx, (float)block->panel->ofsy, 0.0); } -void uiPanelPop(uiBlock *block) +void uiPanelPop(uiBlock *UNUSED(block)) { glPopMatrix(); } @@ -425,7 +425,7 @@ static void ui_draw_panel_dragwidget(rctf *rect) } -static void ui_draw_aligned_panel_header(ARegion *ar, uiStyle *style, uiBlock *block, rcti *rect, char dir) +static void ui_draw_aligned_panel_header(uiStyle *style, uiBlock *block, rcti *rect, char dir) { Panel *panel= block->panel; rcti hrect; @@ -468,7 +468,7 @@ static void rectf_scale(rctf *rect, float scale) } /* panel integrated in buttonswindow, tool/property lists etc */ -void ui_draw_aligned_panel(ARegion *ar, uiStyle *style, uiBlock *block, rcti *rect) +void ui_draw_aligned_panel(uiStyle *style, uiBlock *block, rcti *rect) { Panel *panel= block->panel; rcti headrect; @@ -499,7 +499,7 @@ void ui_draw_aligned_panel(ARegion *ar, uiStyle *style, uiBlock *block, rcti *re /* horizontal title */ if(!(panel->flag & PNL_CLOSEDX)) { - ui_draw_aligned_panel_header(ar, style, block, &headrect, 'h'); + ui_draw_aligned_panel_header(style, block, &headrect, 'h'); /* itemrect smaller */ itemrect.xmax= headrect.xmax - 5.0f/block->aspect; @@ -518,7 +518,7 @@ void ui_draw_aligned_panel(ARegion *ar, uiStyle *style, uiBlock *block, rcti *re } else if(panel->flag & PNL_CLOSEDX) { /* draw vertical title */ - ui_draw_aligned_panel_header(ar, style, block, &headrect, 'v'); + ui_draw_aligned_panel_header(style, block, &headrect, 'v'); } /* an open panel */ else { @@ -772,7 +772,7 @@ static void ui_do_animate(const bContext *C, Panel *panel) } } -void uiBeginPanels(const bContext *C, ARegion *ar) +void uiBeginPanels(const bContext *UNUSED(C), ARegion *ar) { Panel *pa; diff --git a/source/blender/editors/interface/interface_regions.c b/source/blender/editors/interface/interface_regions.c index a0f852239c4..5f8d604817a 100644 --- a/source/blender/editors/interface/interface_regions.c +++ b/source/blender/editors/interface/interface_regions.c @@ -306,7 +306,7 @@ typedef struct uiTooltipData { int toth, spaceh, lineh; } uiTooltipData; -static void ui_tooltip_region_draw(const bContext *C, ARegion *ar) +static void ui_tooltip_region_draw_cb(const bContext *UNUSED(C), ARegion *ar) { uiTooltipData *data= ar->regiondata; rcti bbox= data->bbox; @@ -328,7 +328,7 @@ static void ui_tooltip_region_draw(const bContext *C, ARegion *ar) } } -static void ui_tooltip_region_free(ARegion *ar) +static void ui_tooltip_region_free_cb(ARegion *ar) { uiTooltipData *data; @@ -455,8 +455,8 @@ ARegion *ui_tooltip_create(bContext *C, ARegion *butregion, uiBut *but) ar= ui_add_temporary_region(CTX_wm_screen(C)); memset(&type, 0, sizeof(ARegionType)); - type.draw= ui_tooltip_region_draw; - type.free= ui_tooltip_region_free; + type.draw= ui_tooltip_region_draw_cb; + type.free= ui_tooltip_region_free_cb; ar->type= &type; /* set font, get bb */ @@ -832,7 +832,7 @@ void ui_searchbox_autocomplete(bContext *C, ARegion *ar, uiBut *but, char *str) } } -static void ui_searchbox_region_draw(const bContext *C, ARegion *ar) +static void ui_searchbox_region_draw_cb(const bContext *UNUSED(C), ARegion *ar) { uiSearchboxData *data= ar->regiondata; @@ -840,7 +840,7 @@ static void ui_searchbox_region_draw(const bContext *C, ARegion *ar) wmOrtho2(-0.01f, ar->winx-0.01f, -0.01f, ar->winy-0.01f); if(!data->noback) - ui_draw_search_back(U.uistyles.first, NULL, &data->bbox); + ui_draw_search_back(NULL, NULL, &data->bbox); /* style not used yet */ /* draw text */ if(data->items.totitem) { @@ -899,7 +899,7 @@ static void ui_searchbox_region_draw(const bContext *C, ARegion *ar) } } -static void ui_searchbox_region_free(ARegion *ar) +static void ui_searchbox_region_free_cb(ARegion *ar) { uiSearchboxData *data= ar->regiondata; int a; @@ -931,8 +931,8 @@ ARegion *ui_searchbox_create(bContext *C, ARegion *butregion, uiBut *but) ar= ui_add_temporary_region(CTX_wm_screen(C)); memset(&type, 0, sizeof(ARegionType)); - type.draw= ui_searchbox_region_draw; - type.free= ui_searchbox_region_free; + type.draw= ui_searchbox_region_draw_cb; + type.free= ui_searchbox_region_free_cb; ar->type= &type; /* create searchbox data */ @@ -1418,7 +1418,7 @@ void ui_popup_block_free(bContext *C, uiPopupBlockHandle *handle) /***************************** Menu Button ***************************/ -static void ui_block_func_MENUSTR(bContext *C, uiLayout *layout, void *arg_str) +static void ui_block_func_MENUSTR(bContext *UNUSED(C), uiLayout *layout, void *arg_str) { uiBlock *block= uiLayoutGetBlock(layout); uiPopupBlockHandle *handle= block->handle; @@ -1500,7 +1500,7 @@ static void ui_block_func_MENUSTR(bContext *C, uiLayout *layout, void *arg_str) menudata_free(md); } -void ui_block_func_ICONROW(bContext *C, uiLayout *layout, void *arg_but) +void ui_block_func_ICONROW(bContext *UNUSED(C), uiLayout *layout, void *arg_but) { uiBlock *block= uiLayoutGetBlock(layout); uiPopupBlockHandle *handle= block->handle; @@ -1514,7 +1514,7 @@ void ui_block_func_ICONROW(bContext *C, uiLayout *layout, void *arg_but) &handle->retvalue, (float)a, 0.0, 0, 0, ""); } -void ui_block_func_ICONTEXTROW(bContext *C, uiLayout *layout, void *arg_but) +void ui_block_func_ICONTEXTROW(bContext *UNUSED(C), uiLayout *layout, void *arg_but) { uiBlock *block= uiLayoutGetBlock(layout); uiPopupBlockHandle *handle= block->handle; @@ -1571,27 +1571,22 @@ static void ui_warp_pointer(short x, short y) void ui_set_but_hsv(uiBut *but) { float col[3]; + float *hsv= ui_block_hsv_get(but->block); - hsv_to_rgb(but->hsv[0], but->hsv[1], but->hsv[2], col, col+1, col+2); + hsv_to_rgb(hsv[0], hsv[1], hsv[2], col, col+1, col+2); ui_set_but_vectorf(but, col); } /* also used by small picker, be careful with name checks below... */ -void ui_update_block_buts_rgb(uiBlock *block, float *rgb, float *rhsv) +void ui_update_block_buts_rgb(uiBlock *block, float *rgb) { uiBut *bt; - float hsv[3]; + float *hsv= ui_block_hsv_get(block); /* this is to keep the H and S value when V is equal to zero * and we are working in HSV mode, of course! */ - if (rhsv) { - hsv[0]= rhsv[0]; - hsv[1]= rhsv[1]; - hsv[2]= rhsv[2]; - } - else - rgb_to_hsv(rgb[0], rgb[1], rgb[2], hsv, hsv+1, hsv+2); + rgb_to_hsv_compat(rgb[0], rgb[1], rgb[2], hsv, hsv+1, hsv+2); // this updates button strings, is hackish... but button pointers are on stack of caller function for(bt= block->buttons.first; bt; bt= bt->next) { @@ -1647,7 +1642,7 @@ void ui_update_block_buts_rgb(uiBlock *block, float *rgb, float *rhsv) } } -static void do_picker_rna_cb(bContext *C, void *bt1, void *unused) +static void do_picker_rna_cb(bContext *UNUSED(C), void *bt1, void *UNUSED(arg)) { uiBut *but= (uiBut *)bt1; uiPopupBlockHandle *popup= but->block->handle; @@ -1657,29 +1652,29 @@ static void do_picker_rna_cb(bContext *C, void *bt1, void *unused) if (prop) { RNA_property_float_get_array(&ptr, prop, rgb); - ui_update_block_buts_rgb(but->block, rgb, NULL); + ui_update_block_buts_rgb(but->block, rgb); } if(popup) popup->menuretval= UI_RETURN_UPDATE; } -static void do_hsv_rna_cb(bContext *C, void *bt1, void *hsv_arg) +static void do_hsv_rna_cb(bContext *UNUSED(C), void *bt1, void *UNUSED(arg)) { uiBut *but= (uiBut *)bt1; uiPopupBlockHandle *popup= but->block->handle; - float *hsv = (float *)hsv_arg; float rgb[3]; + float *hsv= ui_block_hsv_get(but->block); hsv_to_rgb(hsv[0], hsv[1], hsv[2], rgb, rgb+1, rgb+2); - ui_update_block_buts_rgb(but->block, rgb, hsv); + ui_update_block_buts_rgb(but->block, rgb); if(popup) popup->menuretval= UI_RETURN_UPDATE; } -static void do_hex_rna_cb(bContext *C, void *bt1, void *hexcl) +static void do_hex_rna_cb(bContext *UNUSED(C), void *bt1, void *hexcl) { uiBut *but= (uiBut *)bt1; uiPopupBlockHandle *popup= but->block->handle; @@ -1694,13 +1689,13 @@ static void do_hex_rna_cb(bContext *C, void *bt1, void *hexcl) srgb_to_linearrgb_v3_v3(rgb, rgb); } - ui_update_block_buts_rgb(but->block, rgb, NULL); + ui_update_block_buts_rgb(but->block, rgb); if(popup) popup->menuretval= UI_RETURN_UPDATE; } -static void close_popup_cb(bContext *C, void *bt1, void *arg) +static void close_popup_cb(bContext *UNUSED(C), void *bt1, void *UNUSED(arg)) { uiBut *but= (uiBut *)bt1; uiPopupBlockHandle *popup= but->block->handle; @@ -1740,7 +1735,7 @@ static void picker_new_hide_reveal(uiBlock *block, short colormode) } } -static void do_picker_new_mode_cb(bContext *C, void *bt1, void *colv) +static void do_picker_new_mode_cb(bContext *UNUSED(C), void *bt1, void *UNUSED(arg)) { uiBut *bt= bt1; short colormode= ui_get_but_val(bt); @@ -1794,11 +1789,13 @@ static void uiBlockPicker(uiBlock *block, float *rgb, PointerRNA *ptr, PropertyR uiBut *bt; int width, butwidth; static char tip[50]; - static float hsv[3]; static char hexcol[128]; float rgb_gamma[3]; float min, max, step, precision; const char *propname = RNA_property_identifier(prop); + float *hsv= ui_block_hsv_get(block); + + ui_block_hsv_get(block); width= PICKER_TOTAL_W; butwidth = width - UI_UNIT_X - 10; @@ -1818,7 +1815,6 @@ static void uiBlockPicker(uiBlock *block, float *rgb, PointerRNA *ptr, PropertyR RNA_property_float_ui_range(ptr, prop, &min, &max, &step, &precision); RNA_property_float_get_array(ptr, prop, rgb); - rgb_to_hsv(rgb[0], rgb[1], rgb[2], hsv, hsv+1, hsv+2); switch (U.color_picker_type) { case USER_CP_CIRCLE: @@ -1838,11 +1834,11 @@ static void uiBlockPicker(uiBlock *block, float *rgb, PointerRNA *ptr, PropertyR /* mode */ uiBlockBeginAlign(block); bt= uiDefButS(block, ROW, 0, "RGB", 0, -30, width/3, UI_UNIT_Y, &colormode, 0.0, 0.0, 0, 0, ""); - uiButSetFunc(bt, do_picker_new_mode_cb, bt, rgb); + uiButSetFunc(bt, do_picker_new_mode_cb, bt, NULL); bt= uiDefButS(block, ROW, 0, "HSV", width/3, -30, width/3, UI_UNIT_Y, &colormode, 0.0, 1.0, 0, 0, ""); - uiButSetFunc(bt, do_picker_new_mode_cb, bt, hsv); + uiButSetFunc(bt, do_picker_new_mode_cb, bt, NULL); bt= uiDefButS(block, ROW, 0, "Hex", 2*width/3, -30, width/3, UI_UNIT_Y, &colormode, 0.0, 2.0, 0, 0, ""); - uiButSetFunc(bt, do_picker_new_mode_cb, bt, hexcol); + uiButSetFunc(bt, do_picker_new_mode_cb, bt, NULL); uiBlockEndAlign(block); bt= uiDefIconButO(block, BUT, "UI_OT_eyedropper", WM_OP_INVOKE_DEFAULT, ICON_EYEDROPPER, butwidth+10, -60, UI_UNIT_X, UI_UNIT_Y, NULL); @@ -1878,19 +1874,19 @@ static void uiBlockPicker(uiBlock *block, float *rgb, PointerRNA *ptr, PropertyR rgb[3]= 1.0f; } - rgb_to_hsv(rgb[0], rgb[1], rgb[2], hsv, hsv+1, hsv+2); - sprintf(hexcol, "%02X%02X%02X", FTOCHAR(rgb_gamma[0]), FTOCHAR(rgb_gamma[1]), FTOCHAR(rgb_gamma[2])); bt= uiDefBut(block, TEX, 0, "Hex: ", 0, -60, butwidth, UI_UNIT_Y, hexcol, 0, 8, 0, 0, "Hex triplet for color (#RRGGBB)"); uiButSetFunc(bt, do_hex_rna_cb, bt, hexcol); uiDefBut(block, LABEL, 0, "(Gamma Corrected)", 0, -80, butwidth, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 0, ""); + rgb_to_hsv(rgb[0], rgb[1], rgb[2], hsv, hsv+1, hsv+2); + picker_new_hide_reveal(block, colormode); } -static int ui_picker_small_wheel(const bContext *C, uiBlock *block, wmEvent *event) +static int ui_picker_small_wheel_cb(const bContext *UNUSED(C), uiBlock *block, wmEvent *event) { float add= 0.0f; @@ -1906,16 +1902,17 @@ static int ui_picker_small_wheel(const bContext *C, uiBlock *block, wmEvent *eve if(but->type==HSVCUBE && but->active==NULL) { uiPopupBlockHandle *popup= block->handle; float col[3]; + float *hsv= ui_block_hsv_get(block); ui_get_but_vectorf(but, col); - rgb_to_hsv(col[0], col[1], col[2], but->hsv, but->hsv+1, but->hsv+2); - but->hsv[2]= CLAMPIS(but->hsv[2]+add, 0.0f, 1.0f); - hsv_to_rgb(but->hsv[0], but->hsv[1], but->hsv[2], col, col+1, col+2); + rgb_to_hsv_compat(col[0], col[1], col[2], hsv, hsv+1, hsv+2); + hsv[2]= CLAMPIS(hsv[2]+add, 0.0f, 1.0f); + hsv_to_rgb(hsv[0], hsv[1], hsv[2], col, col+1, col+2); ui_set_but_vectorf(but, col); - ui_update_block_buts_rgb(block, col, NULL); + ui_update_block_buts_rgb(block, col); if(popup) popup->menuretval= UI_RETURN_UPDATE; @@ -1942,12 +1939,13 @@ uiBlock *ui_block_func_COL(bContext *C, uiPopupBlockHandle *handle, void *arg_bu uiBlockSetFlag(block, UI_BLOCK_MOVEMOUSE_QUIT); VECCOPY(handle->retvec, but->editvec); - + uiBlockPicker(block, handle->retvec, &but->rnapoin, but->rnaprop); + block->flag= UI_BLOCK_LOOP|UI_BLOCK_REDRAW|UI_BLOCK_KEEP_OPEN; uiBoundsBlock(block, 10); - block->block_event_func= ui_picker_small_wheel; + block->block_event_func= ui_picker_small_wheel_cb; /* and lets go */ block->direction= UI_TOP; @@ -2438,3 +2436,7 @@ void uiPupBlockClose(bContext *C, uiBlock *block) } } +float *ui_block_hsv_get(uiBlock *block) +{ + return block->_hsv; +} diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c index 390c576fe94..e4837920c3e 100644 --- a/source/blender/editors/interface/interface_templates.c +++ b/source/blender/editors/interface/interface_templates.c @@ -491,7 +491,7 @@ void uiTemplateIDPreview(uiLayout *layout, bContext *C, PointerRNA *ptr, char *p * - propname: property identifier for property that ID-pointer gets stored to * - proptypename: property identifier for property used to determine the type of ID-pointer that can be used */ -void uiTemplateAnyID(uiLayout *layout, bContext *C, PointerRNA *ptr, char *propname, char *proptypename, char *text) +void uiTemplateAnyID(uiLayout *layout, PointerRNA *ptr, char *propname, char *proptypename, char *text) { PropertyRNA *propID, *propType; uiLayout *row; @@ -536,7 +536,7 @@ void uiTemplateAnyID(uiLayout *layout, bContext *C, PointerRNA *ptr, char *propn * - propname: property identifier for property that path gets stored to * - root_ptr: struct that path gets built from */ -void uiTemplatePathBuilder(uiLayout *layout, bContext *C, PointerRNA *ptr, char *propname, PointerRNA *root_ptr, char *text) +void uiTemplatePathBuilder(uiLayout *layout, PointerRNA *ptr, char *propname, PointerRNA *UNUSED(root_ptr), char *text) { PropertyRNA *propPath; uiLayout *row; @@ -817,7 +817,7 @@ uiLayout *uiTemplateModifier(uiLayout *layout, bContext *C, PointerRNA *ptr) #define REMAKEIPO 8 #define B_DIFF 9 -void do_constraint_panels(bContext *C, void *arg, int event) +void do_constraint_panels(bContext *C, void *UNUSED(arg), int event) { Main *bmain= CTX_data_main(C); Scene *scene= CTX_data_scene(C); @@ -853,7 +853,7 @@ void do_constraint_panels(bContext *C, void *arg, int event) // XXX allqueue(REDRAWBUTSEDIT, 0); } -static void constraint_active_func(bContext *C, void *ob_v, void *con_v) +static void constraint_active_func(bContext *UNUSED(C), void *ob_v, void *con_v) { ED_object_constraint_set_active(ob_v, con_v); } @@ -1142,7 +1142,7 @@ typedef struct RNAUpdateCb { PropertyRNA *prop; } RNAUpdateCb; -static void rna_update_cb(bContext *C, void *arg_cb, void *arg_unused) +static void rna_update_cb(bContext *C, void *arg_cb, void *UNUSED(arg)) { RNAUpdateCb *cb= (RNAUpdateCb*)arg_cb; @@ -1319,7 +1319,7 @@ void uiTemplateColorRamp(uiLayout *layout, PointerRNA *ptr, char *propname, int /********************* Histogram Template ************************/ -void uiTemplateHistogram(uiLayout *layout, PointerRNA *ptr, char *propname, int expand) +void uiTemplateHistogram(uiLayout *layout, PointerRNA *ptr, char *propname) { PropertyRNA *prop= RNA_struct_find_property(ptr, propname); PointerRNA cptr; @@ -1358,7 +1358,7 @@ void uiTemplateHistogram(uiLayout *layout, PointerRNA *ptr, char *propname, int /********************* Waveform Template ************************/ -void uiTemplateWaveform(uiLayout *layout, PointerRNA *ptr, char *propname, int expand) +void uiTemplateWaveform(uiLayout *layout, PointerRNA *ptr, char *propname) { PropertyRNA *prop= RNA_struct_find_property(ptr, propname); PointerRNA cptr; @@ -1394,7 +1394,7 @@ void uiTemplateWaveform(uiLayout *layout, PointerRNA *ptr, char *propname, int e /********************* Vectorscope Template ************************/ -void uiTemplateVectorscope(uiLayout *layout, PointerRNA *ptr, char *propname, int expand) +void uiTemplateVectorscope(uiLayout *layout, PointerRNA *ptr, char *propname) { PropertyRNA *prop= RNA_struct_find_property(ptr, propname); PointerRNA cptr; @@ -1432,7 +1432,7 @@ void uiTemplateVectorscope(uiLayout *layout, PointerRNA *ptr, char *propname, in /********************* CurveMapping Template ************************/ -static void curvemap_buttons_zoom_in(bContext *C, void *cumap_v, void *unused) +static void curvemap_buttons_zoom_in(bContext *C, void *cumap_v, void *UNUSED(arg)) { CurveMapping *cumap = cumap_v; float d; @@ -1450,7 +1450,7 @@ static void curvemap_buttons_zoom_in(bContext *C, void *cumap_v, void *unused) ED_region_tag_redraw(CTX_wm_region(C)); } -static void curvemap_buttons_zoom_out(bContext *C, void *cumap_v, void *unused) +static void curvemap_buttons_zoom_out(bContext *C, void *cumap_v, void *UNUSED(unused)) { CurveMapping *cumap = cumap_v; float d, d1; @@ -1487,7 +1487,7 @@ static void curvemap_buttons_zoom_out(bContext *C, void *cumap_v, void *unused) ED_region_tag_redraw(CTX_wm_region(C)); } -static void curvemap_buttons_setclip(bContext *C, void *cumap_v, void *unused) +static void curvemap_buttons_setclip(bContext *UNUSED(C), void *cumap_v, void *UNUSED(arg)) { CurveMapping *cumap = cumap_v; @@ -1607,7 +1607,7 @@ static uiBlock *curvemap_brush_tools_func(bContext *C, struct ARegion *ar, void return block; } -static void curvemap_buttons_redraw(bContext *C, void *arg1, void *arg2) +static void curvemap_buttons_redraw(bContext *C, void *UNUSED(arg1), void *UNUSED(arg2)) { ED_region_tag_redraw(CTX_wm_region(C)); } @@ -2200,7 +2200,7 @@ void uiTemplateList(uiLayout *layout, bContext *C, PointerRNA *ptr, char *propna /************************* Operator Search Template **************************/ -static void operator_call_cb(bContext *C, void *arg1, void *arg2) +static void operator_call_cb(bContext *C, void *UNUSED(arg1), void *arg2) { wmOperatorType *ot= arg2; @@ -2208,7 +2208,7 @@ static void operator_call_cb(bContext *C, void *arg1, void *arg2) WM_operator_name_call(C, ot->idname, WM_OP_INVOKE_DEFAULT, NULL); } -static void operator_search_cb(const bContext *C, void *arg, char *str, uiSearchItems *items) +static void operator_search_cb(const bContext *C, void *UNUSED(arg), char *str, uiSearchItems *items) { wmOperatorType *ot = WM_operatortype_first(); @@ -2255,7 +2255,7 @@ void uiTemplateOperatorSearch(uiLayout *layout) #define B_STOPANIM 3 #define B_STOPCOMPO 4 -static void do_running_jobs(bContext *C, void *arg, int event) +static void do_running_jobs(bContext *C, void *UNUSED(arg), int event) { switch(event) { case B_STOPRENDER: @@ -2327,7 +2327,6 @@ void uiTemplateReportsBanner(uiLayout *layout, bContext *C) uiBut *but; uiStyle *style= U.uistyles.first; int width; - float hsv[3]; /* if the report display has timed out, don't show */ if (!reports->reporttimer) return; @@ -2338,8 +2337,6 @@ void uiTemplateReportsBanner(uiLayout *layout, bContext *C) abs = uiLayoutAbsolute(layout, 0); block= uiLayoutGetBlock(abs); - - rgb_to_hsv(rti->col[0], rti->col[1], rti->col[2], hsv+0, hsv+1, hsv+2); width = BLF_width(style->widget.uifont_id, report->message); width = MIN2(rti->widthfac*width, width); @@ -2348,11 +2345,16 @@ void uiTemplateReportsBanner(uiLayout *layout, bContext *C) /* make a box around the report to make it stand out */ uiBlockBeginAlign(block); but= uiDefBut(block, ROUNDBOX, 0, "", 0, 0, UI_UNIT_X+10, UI_UNIT_Y, NULL, 0.0f, 0.0f, 0, 0, ""); - copy_v3_v3(but->hsv, hsv); /* set the report's bg colour in but->hsv - ROUNDBOX feature */ - + /* set the report's bg colour in but->col - ROUNDBOX feature */ + but->col[0]= FTOCHAR(rti->col[0]); + but->col[1]= FTOCHAR(rti->col[1]); + but->col[2]= FTOCHAR(rti->col[2]); + but->col[3]= 255; + but= uiDefBut(block, ROUNDBOX, 0, "", UI_UNIT_X+10, 0, UI_UNIT_X+width, UI_UNIT_Y, NULL, 0.0f, 0.0f, 0, 0, ""); - but->hsv[0] = but->hsv[1] = 0.0; /* set a greyscale bg colour in but->hsv - ROUNDBOX feature */ - but->hsv[2] = rti->greyscale; + but->col[0]= but->col[1]= but->col[2]= FTOCHAR(rti->greyscale); + but->col[3]= 255; + uiBlockEndAlign(block); diff --git a/source/blender/editors/interface/interface_utils.c b/source/blender/editors/interface/interface_utils.c index 37278340275..6d8aa89afb0 100644 --- a/source/blender/editors/interface/interface_utils.c +++ b/source/blender/editors/interface/interface_utils.c @@ -131,7 +131,7 @@ uiBut *uiDefAutoButR(uiBlock *block, PointerRNA *ptr, PropertyRNA *prop, int ind return but; } -void uiDefAutoButsRNA(const bContext *C, uiLayout *layout, PointerRNA *ptr, int columns) +void uiDefAutoButsRNA(uiLayout *layout, PointerRNA *ptr, int columns) { uiLayout *split, *col; int flag; diff --git a/source/blender/editors/interface/interface_widgets.c b/source/blender/editors/interface/interface_widgets.c index 134ab70e4ca..ed7284bf264 100644 --- a/source/blender/editors/interface/interface_widgets.c +++ b/source/blender/editors/interface/interface_widgets.c @@ -27,6 +27,7 @@ #include <math.h> #include <stdlib.h> #include <string.h> +#include <assert.h> #include "DNA_screen_types.h" @@ -744,7 +745,7 @@ static void widgetbase_draw(uiWidgetBase *wtb, uiWidgetColors *wcol) #define PREVIEW_PAD 4 -static void widget_draw_preview(BIFIconID icon, float aspect, float alpha, rcti *rect) +static void widget_draw_preview(BIFIconID icon, float aspect, float UNUSED(alpha), rcti *rect) { int w, h, x, y, size; @@ -1492,7 +1493,7 @@ static void widget_state_label(uiWidgetType *wt, int state) } -static void widget_state_nothing(uiWidgetType *wt, int state) +static void widget_state_nothing(uiWidgetType *wt, int UNUSED(state)) { wt->wcol= *(wt->wcol_theme); } @@ -1646,7 +1647,7 @@ void ui_draw_but_HSVCIRCLE(uiBut *but, uiWidgetColors *wcol, rcti *rect) /* gouraud triangle fan */ float radstep, ang= 0.0f; float centx, centy, radius; - float rgb[3], hsv[3], hsvo[3], col[3], colcent[3]; + float rgb[3], hsvo[3], hsv[3], col[3], colcent[3]; int a, tot= 32; int color_profile = but->block->color_profile; @@ -1664,7 +1665,8 @@ void ui_draw_but_HSVCIRCLE(uiBut *but, uiWidgetColors *wcol, rcti *rect) /* color */ ui_get_but_vectorf(but, rgb); - rgb_to_hsv(rgb[0], rgb[1], rgb[2], hsv, hsv+1, hsv+2); + copy_v3_v3(hsv, ui_block_hsv_get(but->block)); + rgb_to_hsv_compat(rgb[0], rgb[1], rgb[2], hsv, hsv+1, hsv+2); copy_v3_v3(hsvo, hsv); /* exception: if 'lock' is set @@ -1724,16 +1726,14 @@ void ui_draw_but_HSVCIRCLE(uiBut *but, uiWidgetColors *wcol, rcti *rect) /* ************ custom buttons, old stuff ************** */ /* draws in resolution of 20x4 colors */ -void ui_draw_gradient(rcti *rect, float *rgb, int type, float alpha) +void ui_draw_gradient(rcti *rect, float *hsv, int type, float alpha) { int a; - float h, s, v; + float h= hsv[0], s= hsv[1], v= hsv[0]; float dx, dy, sx1, sx2, sy; float col0[4][3]; // left half, rect bottom to top float col1[4][3]; // right half, rect bottom to top - - rgb_to_hsv(rgb[0], rgb[1], rgb[2], &h, &s, &v); - + /* draw series of gouraud rects */ glShadeModel(GL_SMOOTH); @@ -1774,6 +1774,12 @@ void ui_draw_gradient(rcti *rect, float *rgb, int type, float alpha) VECCOPY(col1[1], col1[2]); VECCOPY(col1[3], col1[2]); break; + default: + assert(!"invalid 'type' argument"); + hsv_to_rgb(1.0, 1.0, 1.0, &col1[2][0], &col1[2][1], &col1[2][2]); + VECCOPY(col1[0], col1[2]); + VECCOPY(col1[1], col1[2]); + VECCOPY(col1[3], col1[2]); } /* old below */ @@ -1858,11 +1864,21 @@ static void ui_draw_but_HSVCUBE(uiBut *but, rcti *rect) { float rgb[3], h,s,v; float x=0.0f, y=0.0f; + float *hsv= ui_block_hsv_get(but->block); + float hsvn[3]; + + h= hsv[0]; + s= hsv[1]; + v= hsv[2]; ui_get_but_vectorf(but, rgb); - rgb_to_hsv(rgb[0], rgb[1], rgb[2], &h, &s, &v); + rgb_to_hsv_compat(rgb[0], rgb[1], rgb[2], &h, &s, &v); + + hsvn[0]= h; + hsvn[1]= s; + hsvn[2]= v; - ui_draw_gradient(rect, rgb, but->a1, 1.f); + ui_draw_gradient(rect, hsvn, but->a1, 1.f); switch((int)but->a1) { case UI_GRAD_SV: @@ -1940,7 +1956,7 @@ static void ui_draw_but_HSV_v(uiBut *but, rcti *rect) /* ************ separator, for menus etc ***************** */ -static void ui_draw_separator(uiBut *but, rcti *rect, uiWidgetColors *wcol) +static void ui_draw_separator(rcti *rect, uiWidgetColors *wcol) { int y = rect->ymin + (rect->ymax - rect->ymin)/2 - 1; unsigned char col[4]; @@ -2112,7 +2128,7 @@ void uiWidgetScrollDraw(uiWidgetColors *wcol, rcti *rect, rcti *slider, int stat } } -static void widget_scroll(uiBut *but, uiWidgetColors *wcol, rcti *rect, int state, int roundboxalign) +static void widget_scroll(uiBut *but, uiWidgetColors *wcol, rcti *rect, int state, int UNUSED(roundboxalign)) { rcti rect1; double value; @@ -2173,7 +2189,7 @@ static void widget_scroll(uiBut *but, uiWidgetColors *wcol, rcti *rect, int stat uiWidgetScrollDraw(wcol, rect, &rect1, state); } -static void widget_progressbar(uiBut *but, uiWidgetColors *wcol, rcti *rect, int state, int roundboxalign) +static void widget_progressbar(uiBut *but, uiWidgetColors *wcol, rcti *rect, int UNUSED(state), int UNUSED(roundboxalign)) { rcti rect_prog = *rect, rect_bar = *rect; float value = but->a1; @@ -2199,7 +2215,7 @@ static void widget_progressbar(uiBut *but, uiWidgetColors *wcol, rcti *rect, int rect->xmin -= 6; } -static void widget_link(uiBut *but, uiWidgetColors *wcol, rcti *rect, int state, int roundboxalign) +static void widget_link(uiBut *but, uiWidgetColors *UNUSED(wcol), rcti *rect, int UNUSED(state), int UNUSED(roundboxalign)) { if(but->flag & UI_SELECT) { @@ -2353,7 +2369,7 @@ static void widget_textbut(uiWidgetColors *wcol, rcti *rect, int state, int roun } -static void widget_menubut(uiWidgetColors *wcol, rcti *rect, int state, int roundboxalign) +static void widget_menubut(uiWidgetColors *wcol, rcti *rect, int UNUSED(state), int roundboxalign) { uiWidgetBase wtb; @@ -2371,7 +2387,7 @@ static void widget_menubut(uiWidgetColors *wcol, rcti *rect, int state, int roun rect->xmax -= (rect->ymax-rect->ymin); } -static void widget_menuiconbut(uiWidgetColors *wcol, rcti *rect, int state, int roundboxalign) +static void widget_menuiconbut(uiWidgetColors *wcol, rcti *rect, int UNUSED(state), int roundboxalign) { uiWidgetBase wtb; @@ -2384,7 +2400,7 @@ static void widget_menuiconbut(uiWidgetColors *wcol, rcti *rect, int state, int widgetbase_draw(&wtb, wcol); } -static void widget_pulldownbut(uiWidgetColors *wcol, rcti *rect, int state, int roundboxalign) +static void widget_pulldownbut(uiWidgetColors *wcol, rcti *rect, int state, int UNUSED(roundboxalign)) { if(state & UI_ACTIVE) { uiWidgetBase wtb; @@ -2399,7 +2415,7 @@ static void widget_pulldownbut(uiWidgetColors *wcol, rcti *rect, int state, int } } -static void widget_menu_itembut(uiWidgetColors *wcol, rcti *rect, int state, int roundboxalign) +static void widget_menu_itembut(uiWidgetColors *wcol, rcti *rect, int UNUSED(state), int UNUSED(roundboxalign)) { uiWidgetBase wtb; @@ -2412,7 +2428,7 @@ static void widget_menu_itembut(uiWidgetColors *wcol, rcti *rect, int state, int widgetbase_draw(&wtb, wcol); } -static void widget_list_itembut(uiWidgetColors *wcol, rcti *rect, int state, int roundboxalign) +static void widget_list_itembut(uiWidgetColors *wcol, rcti *rect, int UNUSED(state), int UNUSED(roundboxalign)) { uiWidgetBase wtb; @@ -2425,7 +2441,7 @@ static void widget_list_itembut(uiWidgetColors *wcol, rcti *rect, int state, int widgetbase_draw(&wtb, wcol); } -static void widget_optionbut(uiWidgetColors *wcol, rcti *rect, int state, int roundboxalign) +static void widget_optionbut(uiWidgetColors *wcol, rcti *rect, int state, int UNUSED(roundboxalign)) { uiWidgetBase wtb; rcti recttemp= *rect; @@ -2458,7 +2474,7 @@ static void widget_optionbut(uiWidgetColors *wcol, rcti *rect, int state, int ro } -static void widget_radiobut(uiWidgetColors *wcol, rcti *rect, int state, int roundboxalign) +static void widget_radiobut(uiWidgetColors *wcol, rcti *rect, int UNUSED(state), int roundboxalign) { uiWidgetBase wtb; @@ -2471,7 +2487,7 @@ static void widget_radiobut(uiWidgetColors *wcol, rcti *rect, int state, int rou } -static void widget_box(uiBut *but, uiWidgetColors *wcol, rcti *rect, int state, int roundboxalign) +static void widget_box(uiBut *but, uiWidgetColors *wcol, rcti *rect, int UNUSED(state), int roundboxalign) { uiWidgetBase wtb; char old_col[3]; @@ -2481,12 +2497,10 @@ static void widget_box(uiBut *but, uiWidgetColors *wcol, rcti *rect, int state, VECCOPY(old_col, wcol->inner); /* abuse but->hsv - if it's non-zero, use this colour as the box's background */ - if ((but->hsv[0] != 0.0) || (but->hsv[1] != 0.0) || (but->hsv[2] != 0.0)) { - float rgb[3]; - hsv_to_rgb(but->hsv[0], but->hsv[1], but->hsv[2], rgb+0, rgb+1, rgb+2); - wcol->inner[0] = rgb[0] * 255; - wcol->inner[1] = rgb[1] * 255; - wcol->inner[2] = rgb[2] * 255; + if (but->col[3]) { + wcol->inner[0] = but->col[0]; + wcol->inner[1] = but->col[1]; + wcol->inner[2] = but->col[2]; } /* half rounded */ @@ -2501,7 +2515,7 @@ static void widget_box(uiBut *but, uiWidgetColors *wcol, rcti *rect, int state, VECCOPY(wcol->inner, old_col); } -static void widget_but(uiWidgetColors *wcol, rcti *rect, int state, int roundboxalign) +static void widget_but(uiWidgetColors *wcol, rcti *rect, int UNUSED(state), int roundboxalign) { uiWidgetBase wtb; @@ -2514,7 +2528,7 @@ static void widget_but(uiWidgetColors *wcol, rcti *rect, int state, int roundbox } -static void widget_roundbut(uiWidgetColors *wcol, rcti *rect, int state, int roundboxalign) +static void widget_roundbut(uiWidgetColors *wcol, rcti *rect, int UNUSED(state), int roundboxalign) { uiWidgetBase wtb; float rad= 5.0f; //0.5f*(rect->ymax - rect->ymin); @@ -2779,7 +2793,7 @@ void ui_draw_but(const bContext *C, ARegion *ar, uiStyle *style, uiBut *but, rct widget_draw_text_icon(&style->widgetlabel, &tui->wcol_menu_back, but, rect); break; case SEPR: - ui_draw_separator(but, rect, &tui->wcol_menu_item); + ui_draw_separator(rect, &tui->wcol_menu_item); break; default: @@ -2965,7 +2979,7 @@ void ui_draw_but(const bContext *C, ARegion *ar, uiStyle *style, uiBut *but, rct } } -void ui_draw_menu_back(uiStyle *style, uiBlock *block, rcti *rect) +void ui_draw_menu_back(uiStyle *UNUSED(style), uiBlock *block, rcti *rect) { uiWidgetType *wt= widget_type(UI_WTYPE_MENU_BACK); @@ -2977,7 +2991,7 @@ void ui_draw_menu_back(uiStyle *style, uiBlock *block, rcti *rect) } -void ui_draw_search_back(uiStyle *style, uiBlock *block, rcti *rect) +void ui_draw_search_back(uiStyle *UNUSED(style), uiBlock *block, rcti *rect) { uiWidgetType *wt= widget_type(UI_WTYPE_BOX); diff --git a/source/blender/editors/interface/view2d.c b/source/blender/editors/interface/view2d.c index 14ec7c6d0d6..a17d578fc06 100644 --- a/source/blender/editors/interface/view2d.c +++ b/source/blender/editors/interface/view2d.c @@ -967,7 +967,7 @@ static void view2d_map_cur_using_mask(View2D *v2d, rctf *curmasked) } /* Set view matrices to use 'cur' rect as viewing frame for View2D drawing */ -void UI_view2d_view_ortho(const bContext *C, View2D *v2d) +void UI_view2d_view_ortho(View2D *v2d) { rctf curmasked; float xofs, yofs; @@ -997,9 +997,8 @@ void UI_view2d_view_ortho(const bContext *C, View2D *v2d) /* Set view matrices to only use one axis of 'cur' only * - xaxis = if non-zero, only use cur x-axis, otherwise use cur-yaxis (mostly this will be used for x) */ -void UI_view2d_view_orthoSpecial(const bContext *C, View2D *v2d, short xaxis) +void UI_view2d_view_orthoSpecial(ARegion *ar, View2D *v2d, short xaxis) { - ARegion *ar= CTX_wm_region(C); rctf curmasked; float xofs, yofs; @@ -1098,12 +1097,12 @@ static void step_to_grid(float *step, int *power, int unit) * * - xunits,yunits = V2D_UNIT_* grid steps in seconds or frames * - xclamp,yclamp = V2D_CLAMP_* only show whole-number intervals - * - winx = width of region we're drawing to + * - winx = width of region we're drawing to, note: not used but keeping for completeness. * - winy = height of region we're drawing into */ -View2DGrid *UI_view2d_grid_calc(const bContext *C, View2D *v2d, short xunits, short xclamp, short yunits, short yclamp, int winx, int winy) +View2DGrid *UI_view2d_grid_calc(Scene *scene, View2D *v2d, short xunits, short xclamp, short yunits, short yclamp, int UNUSED(winx), int winy) { - Scene *scene= CTX_data_scene(C); + View2DGrid *grid; float space, pixels, seconddiv; int secondgrid; @@ -1174,7 +1173,7 @@ View2DGrid *UI_view2d_grid_calc(const bContext *C, View2D *v2d, short xunits, sh } /* Draw gridlines in the given 2d-region */ -void UI_view2d_grid_draw(const bContext *C, View2D *v2d, View2DGrid *grid, int flag) +void UI_view2d_grid_draw(View2D *v2d, View2DGrid *grid, int flag) { float vec1[2], vec2[2]; int a, step; @@ -1283,7 +1282,7 @@ void UI_view2d_grid_draw(const bContext *C, View2D *v2d, View2DGrid *grid, int f } /* Draw a constant grid in given 2d-region */ -void UI_view2d_constant_grid_draw(const bContext *C, View2D *v2d) +void UI_view2d_constant_grid_draw(View2D *v2d) { float start, step= 25.0f; @@ -1481,7 +1480,7 @@ View2DScrollers *UI_view2d_scrollers_calc(const bContext *C, View2D *v2d, short scrollers->yclamp= yclamp; scrollers->yunits= yunits; - scrollers->grid= UI_view2d_grid_calc(C, v2d, xunits, xclamp, yunits, yclamp, (hor.xmax - hor.xmin), (vert.ymax - vert.ymin)); + scrollers->grid= UI_view2d_grid_calc(CTX_data_scene(C), v2d, xunits, xclamp, yunits, yclamp, (hor.xmax - hor.xmin), (vert.ymax - vert.ymin)); } /* return scrollers */ @@ -1489,7 +1488,7 @@ View2DScrollers *UI_view2d_scrollers_calc(const bContext *C, View2D *v2d, short } /* Print scale marking along a time scrollbar */ -static void scroll_printstr(View2DScrollers *scrollers, Scene *scene, float x, float y, float val, int power, short unit, char dir) +static void scroll_printstr(Scene *scene, float x, float y, float val, int power, short unit, char dir) { int len; char str[32]; @@ -1614,16 +1613,16 @@ void UI_view2d_scrollers_draw(const bContext *C, View2D *v2d, View2DScrollers *v switch (vs->xunits) { case V2D_UNIT_FRAMES: /* frames (as whole numbers)*/ - scroll_printstr(vs, scene, fac, h, val, grid->powerx, V2D_UNIT_FRAMES, 'h'); + scroll_printstr(scene, fac, h, val, grid->powerx, V2D_UNIT_FRAMES, 'h'); break; case V2D_UNIT_FRAMESCALE: /* frames (not always as whole numbers) */ - scroll_printstr(vs, scene, fac, h, val, grid->powerx, V2D_UNIT_FRAMESCALE, 'h'); + scroll_printstr(scene, fac, h, val, grid->powerx, V2D_UNIT_FRAMESCALE, 'h'); break; case V2D_UNIT_SECONDS: /* seconds */ fac2= val/(float)FPS; - scroll_printstr(vs, scene, fac, h, fac2, grid->powerx, V2D_UNIT_SECONDS, 'h'); + scroll_printstr(scene, fac, h, fac2, grid->powerx, V2D_UNIT_SECONDS, 'h'); break; case V2D_UNIT_SECONDSSEQ: /* seconds with special calculations (only used for sequencer only) */ @@ -1634,13 +1633,13 @@ void UI_view2d_scrollers_draw(const bContext *C, View2D *v2d, View2DScrollers *v time= (float)floor(fac2); fac2= fac2-time; - scroll_printstr(vs, scene, fac, h, time+(float)FPS*fac2/100.0f, grid->powerx, V2D_UNIT_SECONDSSEQ, 'h'); + scroll_printstr(scene, fac, h, time+(float)FPS*fac2/100.0f, grid->powerx, V2D_UNIT_SECONDSSEQ, 'h'); } break; case V2D_UNIT_DEGREES: /* Graph Editor for rotation Drivers */ /* HACK: although we're drawing horizontal, we make this draw as 'vertical', just to get degree signs */ - scroll_printstr(vs, scene, fac, h, val, grid->powerx, V2D_UNIT_DEGREES, 'v'); + scroll_printstr(scene, fac, h, val, grid->powerx, V2D_UNIT_DEGREES, 'v'); break; } } @@ -1719,7 +1718,7 @@ void UI_view2d_scrollers_draw(const bContext *C, View2D *v2d, View2DScrollers *v if(fac < vert.ymin+10) continue; - scroll_printstr(vs, scene, (float)(vert.xmax)-2.0f, fac, val, grid->powery, vs->yunits, 'v'); + scroll_printstr(scene, (float)(vert.xmax)-2.0f, fac, val, grid->powery, vs->yunits, 'v'); } BLF_disable_default(BLF_ROTATION); diff --git a/source/blender/editors/interface/view2d_ops.c b/source/blender/editors/interface/view2d_ops.c index e10f0f20938..48523ec1a5a 100644 --- a/source/blender/editors/interface/view2d_ops.c +++ b/source/blender/editors/interface/view2d_ops.c @@ -119,7 +119,7 @@ static int view_pan_init(bContext *C, wmOperator *op) } /* apply transform to view (i.e. adjust 'cur' rect) */ -static void view_pan_apply(bContext *C, wmOperator *op) +static void view_pan_apply(wmOperator *op) { v2dViewPanData *vpd= op->customdata; View2D *v2d= vpd->v2d; @@ -156,7 +156,7 @@ static void view_pan_apply(bContext *C, wmOperator *op) } /* cleanup temp customdata */ -static void view_pan_exit(bContext *C, wmOperator *op) +static void view_pan_exit(wmOperator *op) { if (op->customdata) { MEM_freeN(op->customdata); @@ -172,8 +172,8 @@ static int view_pan_exec(bContext *C, wmOperator *op) if (!view_pan_init(C, op)) return OPERATOR_CANCELLED; - view_pan_apply(C, op); - view_pan_exit(C, op); + view_pan_apply(op); + view_pan_exit(op); return OPERATOR_FINISHED; } @@ -199,8 +199,8 @@ static int view_pan_invoke(bContext *C, wmOperator *op, wmEvent *event) RNA_int_set(op->ptr, "deltax", event->prevx - event->x); RNA_int_set(op->ptr, "deltay", event->prevy - event->y); - view_pan_apply(C, op); - view_pan_exit(C, op); + view_pan_apply(op); + view_pan_exit(op); return OPERATOR_FINISHED; } @@ -236,7 +236,7 @@ static int view_pan_modal(bContext *C, wmOperator *op, wmEvent *event) vpd->lastx= event->x; vpd->lasty= event->y; - view_pan_apply(C, op); + view_pan_apply(op); } break; @@ -247,7 +247,7 @@ static int view_pan_modal(bContext *C, wmOperator *op, wmEvent *event) RNA_int_set(op->ptr, "deltax", (vpd->startx - vpd->lastx)); RNA_int_set(op->ptr, "deltay", (vpd->starty - vpd->lasty)); - view_pan_exit(C, op); + view_pan_exit(op); WM_cursor_restore(CTX_wm_window(C)); WM_operator_name_call(C, "VIEW2D_OT_zoom", WM_OP_INVOKE_DEFAULT, NULL); @@ -260,7 +260,7 @@ static int view_pan_modal(bContext *C, wmOperator *op, wmEvent *event) RNA_int_set(op->ptr, "deltax", (vpd->startx - vpd->lastx)); RNA_int_set(op->ptr, "deltay", (vpd->starty - vpd->lasty)); - view_pan_exit(C, op); + view_pan_exit(op); WM_cursor_restore(CTX_wm_window(C)); return OPERATOR_FINISHED; @@ -271,9 +271,9 @@ static int view_pan_modal(bContext *C, wmOperator *op, wmEvent *event) return OPERATOR_RUNNING_MODAL; } -static int view_pan_cancel(bContext *C, wmOperator *op) +static int view_pan_cancel(bContext *UNUSED(C), wmOperator *op) { - view_pan_exit(C, op); + view_pan_exit(op); return OPERATOR_CANCELLED; } @@ -312,7 +312,7 @@ static int view_scrollright_exec(bContext *C, wmOperator *op) /* also, check if can pan in horizontal axis */ vpd= op->customdata; if (vpd->v2d->keepofs & V2D_LOCKOFS_X) { - view_pan_exit(C, op); + view_pan_exit(op); return OPERATOR_PASS_THROUGH; } @@ -321,8 +321,8 @@ static int view_scrollright_exec(bContext *C, wmOperator *op) RNA_int_set(op->ptr, "deltay", 0); /* apply movement, then we're done */ - view_pan_apply(C, op); - view_pan_exit(C, op); + view_pan_apply(op); + view_pan_exit(op); return OPERATOR_FINISHED; } @@ -356,7 +356,7 @@ static int view_scrollleft_exec(bContext *C, wmOperator *op) /* also, check if can pan in horizontal axis */ vpd= op->customdata; if (vpd->v2d->keepofs & V2D_LOCKOFS_X) { - view_pan_exit(C, op); + view_pan_exit(op); return OPERATOR_PASS_THROUGH; } @@ -365,8 +365,8 @@ static int view_scrollleft_exec(bContext *C, wmOperator *op) RNA_int_set(op->ptr, "deltay", 0); /* apply movement, then we're done */ - view_pan_apply(C, op); - view_pan_exit(C, op); + view_pan_apply(op); + view_pan_exit(op); return OPERATOR_FINISHED; } @@ -399,7 +399,7 @@ static int view_scrolldown_exec(bContext *C, wmOperator *op) /* also, check if can pan in vertical axis */ vpd= op->customdata; if (vpd->v2d->keepofs & V2D_LOCKOFS_Y) { - view_pan_exit(C, op); + view_pan_exit(op); return OPERATOR_PASS_THROUGH; } @@ -408,8 +408,8 @@ static int view_scrolldown_exec(bContext *C, wmOperator *op) RNA_int_set(op->ptr, "deltay", -40); /* apply movement, then we're done */ - view_pan_apply(C, op); - view_pan_exit(C, op); + view_pan_apply(op); + view_pan_exit(op); return OPERATOR_FINISHED; } @@ -443,7 +443,7 @@ static int view_scrollup_exec(bContext *C, wmOperator *op) /* also, check if can pan in vertical axis */ vpd= op->customdata; if (vpd->v2d->keepofs & V2D_LOCKOFS_Y) { - view_pan_exit(C, op); + view_pan_exit(op); return OPERATOR_PASS_THROUGH; } @@ -452,8 +452,8 @@ static int view_scrollup_exec(bContext *C, wmOperator *op) RNA_int_set(op->ptr, "deltay", 40); /* apply movement, then we're done */ - view_pan_apply(C, op); - view_pan_exit(C, op); + view_pan_apply(op); + view_pan_exit(op); return OPERATOR_FINISHED; } @@ -632,7 +632,7 @@ static void view_zoomstep_apply(bContext *C, wmOperator *op) /* --------------- Individual Operators ------------------- */ /* cleanup temp customdata */ -static void view_zoomstep_exit(bContext *C, wmOperator *op) +static void view_zoomstep_exit(wmOperator *op) { if (op->customdata) { MEM_freeN(op->customdata); @@ -654,7 +654,7 @@ static int view_zoomin_exec(bContext *C, wmOperator *op) /* apply movement, then we're done */ view_zoomstep_apply(C, op); - view_zoomstep_exit(C, op); + view_zoomstep_exit(op); return OPERATOR_FINISHED; } @@ -711,7 +711,7 @@ static int view_zoomout_exec(bContext *C, wmOperator *op) /* apply movement, then we're done */ view_zoomstep_apply(C, op); - view_zoomstep_exit(C, op); + view_zoomstep_exit(op); return OPERATOR_FINISHED; } @@ -823,7 +823,7 @@ static void view_zoomdrag_apply(bContext *C, wmOperator *op) } /* cleanup temp customdata */ -static void view_zoomdrag_exit(bContext *C, wmOperator *op) +static void view_zoomdrag_exit(wmOperator *op) { if (op->customdata) { MEM_freeN(op->customdata); @@ -838,7 +838,7 @@ static int view_zoomdrag_exec(bContext *C, wmOperator *op) return OPERATOR_PASS_THROUGH; view_zoomdrag_apply(C, op); - view_zoomdrag_exit(C, op); + view_zoomdrag_exit(op); return OPERATOR_FINISHED; } @@ -873,7 +873,7 @@ static int view_zoomdrag_invoke(bContext *C, wmOperator *op, wmEvent *event) RNA_float_set(op->ptr, "deltay", dy); view_zoomdrag_apply(C, op); - view_zoomdrag_exit(C, op); + view_zoomdrag_exit(op); return OPERATOR_FINISHED; } @@ -985,7 +985,7 @@ static int view_zoomdrag_modal(bContext *C, wmOperator *op, wmEvent *event) RNA_float_set(op->ptr, "deltay", 0); /* free customdata */ - view_zoomdrag_exit(C, op); + view_zoomdrag_exit(op); WM_cursor_restore(CTX_wm_window(C)); return OPERATOR_FINISHED; @@ -1512,7 +1512,7 @@ void VIEW2D_OT_scroller_activate(wmOperatorType *ot) /* ********************************************************* */ /* RESET */ -static int reset_exec(bContext *C, wmOperator *op) +static int reset_exec(bContext *C, wmOperator *UNUSED(op)) { uiStyle *style= U.uistyles.first; ARegion *ar= CTX_wm_region(C); diff --git a/source/blender/editors/mesh/editface.c b/source/blender/editors/mesh/editface.c index fc92598591a..e33e24a75ce 100644 --- a/source/blender/editors/mesh/editface.c +++ b/source/blender/editors/mesh/editface.c @@ -68,7 +68,7 @@ #include "mesh_intern.h" /* ***************** XXX **************** */ -static int pupmenu(const char *dummy) {return 0;} +static int pupmenu(const char *UNUSED(dummy)) {return 0;} /* ***************** XXX **************** */ @@ -343,7 +343,7 @@ void select_linked_tfaces_with_seams(int mode, Mesh *me, unsigned int index) // object_tface_flags_changed(OBACT, 0); } -void select_linked_tfaces(bContext *C, Object *ob, short mval[2], int mode) +void select_linked_tfaces(bContext *UNUSED(C), Object *ob, short UNUSED(mval[2]), int mode) { Mesh *me; unsigned int index=0; @@ -464,7 +464,7 @@ int minmax_tface(Object *ob, float *min, float *max) #define ME_SEAM_DONE 2 /* reuse this flag */ -static float edgetag_cut_cost(EditMesh *em, int e1, int e2, int vert) +static float edgetag_cut_cost(int e1, int e2, int vert) { EditVert *v = EM_get_vert_for_index(vert); EditEdge *eed1 = EM_get_edge_for_index(e1), *eed2 = EM_get_edge_for_index(e2); @@ -483,7 +483,7 @@ static float edgetag_cut_cost(EditMesh *em, int e1, int e2, int vert) return cost; } -static void edgetag_add_adjacent(EditMesh *em, Heap *heap, int mednum, int vertnum, int *nedges, int *edges, int *prevedge, float *cost) +static void edgetag_add_adjacent(Heap *heap, int mednum, int vertnum, int *nedges, int *edges, int *prevedge, float *cost) { int startadj, endadj = nedges[vertnum+1]; @@ -495,7 +495,7 @@ static void edgetag_add_adjacent(EditMesh *em, Heap *heap, int mednum, int vertn if (eedadj->f2 & ME_SEAM_DONE) continue; - newcost = cost[mednum] + edgetag_cut_cost(em, mednum, adjnum, vertnum); + newcost = cost[mednum] + edgetag_cut_cost(mednum, adjnum, vertnum); if (cost[adjnum] > newcost) { cost[adjnum] = newcost; @@ -621,8 +621,8 @@ int edgetag_shortest_path(Scene *scene, EditMesh *em, EditEdge *source, EditEdge eed->f2 |= ME_SEAM_DONE; - edgetag_add_adjacent(em, heap, mednum, eed->v1->tmp.l, nedges, edges, prevedge, cost); - edgetag_add_adjacent(em, heap, mednum, eed->v2->tmp.l, nedges, edges, prevedge, cost); + edgetag_add_adjacent(heap, mednum, eed->v1->tmp.l, nedges, edges, prevedge, cost); + edgetag_add_adjacent(heap, mednum, eed->v2->tmp.l, nedges, edges, prevedge, cost); } @@ -819,7 +819,7 @@ void face_borderselect(struct bContext *C, Object *ob, rcti *rect, int select, i view3d_validate_backbuf(&vc); - ibuf = IMB_allocImBuf(sx,sy,32,IB_rect,0); + ibuf = IMB_allocImBuf(sx,sy,32,IB_rect); rt = ibuf->rect; glReadPixels(rect->xmin+vc.ar->winrct.xmin, rect->ymin+vc.ar->winrct.ymin, sx, sy, GL_RGBA, GL_UNSIGNED_BYTE, ibuf->rect); if(ENDIAN_ORDER==B_ENDIAN) IMB_convert_rgba_to_abgr(ibuf); diff --git a/source/blender/editors/mesh/editmesh.c b/source/blender/editors/mesh/editmesh.c index ff2fad3f551..80df034552d 100644 --- a/source/blender/editors/mesh/editmesh.c +++ b/source/blender/editors/mesh/editmesh.c @@ -78,8 +78,8 @@ editmesh.c: */ /* XXX */ -static void BIF_undo_push(const char *dummy) {} -static void error(const char *dummy) {} +static void BIF_undo_push(const char *UNUSED(arg)) {} +static void error(const char *UNUSED(arg)) {} /* ***************** HASH ********************* */ @@ -91,7 +91,7 @@ static void error(const char *dummy) {} /* ************ ADD / REMOVE / FIND ****************** */ -static void *calloc_em(EditMesh *em, size_t size, size_t nr) +static void *calloc_em(EditMesh *UNUSED(em), size_t size, size_t nr) { return calloc(size, nr); } @@ -447,19 +447,19 @@ int editface_containsEdge(EditFace *efa, EditEdge *eed) /* ************************ stuct EditMesh manipulation ***************************** */ /* fake callocs for fastmalloc below */ -static void *calloc_fastvert(EditMesh *em, size_t size, size_t nr) +static void *calloc_fastvert(EditMesh *em, size_t UNUSED(size), size_t UNUSED(nr)) { EditVert *eve= em->curvert++; eve->fast= 1; return eve; } -static void *calloc_fastedge(EditMesh *em, size_t size, size_t nr) +static void *calloc_fastedge(EditMesh *em, size_t UNUSED(size), size_t UNUSED(nr)) { EditEdge *eed= em->curedge++; eed->fast= 1; return eed; } -static void *calloc_fastface(EditMesh *em, size_t size, size_t nr) +static void *calloc_fastface(EditMesh *em, size_t UNUSED(size), size_t UNUSED(nr)) { EditFace *efa= em->curface++; efa->fast= 1; diff --git a/source/blender/editors/mesh/editmesh_add.c b/source/blender/editors/mesh/editmesh_add.c index 7dac8a465fa..89991015419 100644 --- a/source/blender/editors/mesh/editmesh_add.c +++ b/source/blender/editors/mesh/editmesh_add.c @@ -110,57 +110,95 @@ static short icoface[20][3] = { static int dupli_extrude_cursor(bContext *C, wmOperator *op, wmEvent *event) { ViewContext vc; - EditVert *eve, *v1; + EditVert *eve; float min[3], max[3]; int done= 0; - + short use_proj; +printf("%d\n", event->val); em_setup_viewcontext(C, &vc); + + use_proj= (vc.scene->toolsettings->snap_flag & SCE_SNAP) && (vc.scene->toolsettings->snap_mode==SCE_SNAP_MODE_FACE); + + invert_m4_m4(vc.obedit->imat, vc.obedit->obmat); INIT_MINMAX(min, max); - for(v1= vc.em->verts.first;v1; v1=v1->next) { - if(v1->f & SELECT) { - DO_MINMAX(v1->co, min, max); + for(eve= vc.em->verts.first; eve; eve= eve->next) { + if(eve->f & SELECT) { + DO_MINMAX(eve->co, min, max); done= 1; } } /* call extrude? */ if(done) { + short rot_src= RNA_boolean_get(op->ptr, "rotate_source"); EditEdge *eed; float vec[3], cent[3], mat[3][3]; float nor[3]= {0.0, 0.0, 0.0}; - /* check for edges that are half selected, use for rotation */ + /* 2D normal calc */ + float mval_f[2]= {(float)event->mval[0], (float)event->mval[1]}; + done= 0; + + /* calculate the normal for selected edges */ for(eed= vc.em->edges.first; eed; eed= eed->next) { - if( (eed->v1->f & SELECT)+(eed->v2->f & SELECT) == SELECT ) { - if(eed->v1->f & SELECT) sub_v3_v3v3(vec, eed->v1->co, eed->v2->co); - else sub_v3_v3v3(vec, eed->v2->co, eed->v1->co); - add_v3_v3(nor, vec); + if(eed->f & SELECT) { + float co1[3], co2[3]; + mul_v3_m4v3(co1, vc.obedit->obmat, eed->v1->co); + mul_v3_m4v3(co2, vc.obedit->obmat, eed->v2->co); + project_float_noclip(vc.ar, co1, co1); + project_float_noclip(vc.ar, co2, co2); + + /* 2D rotate by 90d while adding. + * (x, y) = (y, -x) + * + * accumulate the screenspace normal in 2D, + * with screenspace edge length weighting the result. */ + if(line_point_side_v2(co1, co2, mval_f) >= 0.0f) { + nor[0] += (co1[1] - co2[1]); + nor[1] += -(co1[0] - co2[0]); + } + else { + nor[0] += (co2[1] - co1[1]); + nor[1] += -(co2[0] - co1[0]); + } done= 1; } } - if(done) normalize_v3(nor); + + if(done) { + float view_vec[3], cross[3]; + + /* convert the 2D nomal into 3D */ + mul_mat3_m4_v3(vc.rv3d->viewinv, nor); /* worldspace */ + mul_mat3_m4_v3(vc.obedit->imat, nor); /* local space */ + + /* correct the normal to be aligned on the view plane */ + copy_v3_v3(view_vec, vc.rv3d->viewinv[2]); + mul_mat3_m4_v3(vc.obedit->imat, view_vec); + cross_v3_v3v3(cross, nor, view_vec); + cross_v3_v3v3(nor, view_vec, cross); + normalize_v3(nor); + } /* center */ - add_v3_v3v3(cent, min, max); - mul_v3_fl(cent, 0.5f); - VECCOPY(min, cent); + mid_v3_v3v3(cent, min, max); + copy_v3_v3(min, cent); mul_m4_v3(vc.obedit->obmat, min); // view space view3d_get_view_aligned_coordinate(&vc, min, event->mval); - invert_m4_m4(vc.obedit->imat, vc.obedit->obmat); mul_m4_v3(vc.obedit->imat, min); // back in object space - sub_v3_v3v3(min, min, cent); + sub_v3_v3(min, cent); /* calculate rotation */ unit_m3(mat); if(done) { float dot; - VECCOPY(vec, min); + copy_v3_v3(vec, min); normalize_v3(vec); dot= INPR(vec, nor); @@ -170,16 +208,26 @@ static int dupli_extrude_cursor(bContext *C, wmOperator *op, wmEvent *event) cross_v3_v3v3(cross, nor, vec); normalize_v3(cross); dot= 0.5f*saacos(dot); + + /* halve the rotation if its applied twice */ + if(rot_src) dot *= 0.5f; + si= (float)sin(dot); q1[0]= (float)cos(dot); q1[1]= cross[0]*si; q1[2]= cross[1]*si; - q1[3]= cross[2]*si; - + q1[3]= cross[2]*si; quat_to_mat3( mat,q1); } } + if(rot_src) { + rotateflag(vc.em, SELECT, cent, mat); + /* also project the source, for retopo workflow */ + if(use_proj) + EM_project_snap_verts(C, vc.ar, vc.obedit, vc.em); + } + extrudeflag(vc.obedit, vc.em, SELECT, nor, 0); rotateflag(vc.em, SELECT, cent, mat); translateflag(vc.em, SELECT, min); @@ -190,7 +238,7 @@ static int dupli_extrude_cursor(bContext *C, wmOperator *op, wmEvent *event) float mat[3][3],imat[3][3]; float *curs= give_cursor(vc.scene, vc.v3d); - VECCOPY(min, curs); + copy_v3_v3(min, curs); view3d_get_view_aligned_coordinate(&vc, min, event->mval); eve= addvertlist(vc.em, 0, NULL); @@ -198,14 +246,16 @@ static int dupli_extrude_cursor(bContext *C, wmOperator *op, wmEvent *event) copy_m3_m4(mat, vc.obedit->obmat); invert_m3_m3(imat, mat); - VECCOPY(eve->co, min); + copy_v3_v3(eve->co, min); mul_m3_v3(imat, eve->co); sub_v3_v3v3(eve->co, eve->co, vc.obedit->obmat[3]); eve->f= SELECT; } - - //retopo_do_all(); + + if(use_proj) + EM_project_snap_verts(C, vc.ar, vc.obedit, vc.em); + WM_event_add_notifier(C, NC_GEOM|ND_DATA, vc.obedit->data); DAG_id_flush_update(vc.obedit->data, OB_RECALC_DATA); @@ -225,6 +275,8 @@ void MESH_OT_dupli_extrude_cursor(wmOperatorType *ot) /* flags */ ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; + + RNA_def_boolean(ot->srna, "rotate_source", 1, "Rotate Source", "Rotate initial selection giving better shape"); } @@ -997,15 +1049,13 @@ static void make_prim(Object *obedit, int type, float mat[4][4], int tot, int se /* one segment first: the X axis */ phi = (2*dia)/(float)(tot-1); phid = (2*dia)/(float)(seg-1); - for(a=0;a<tot;a++) { + for(a=tot-1;a>=0;a--) { vec[0] = (phi*a) - dia; vec[1]= - dia; vec[2]= 0.0f; eve= addvertlist(em, vec, NULL); eve->f= 1+2+4; - if (a) { - addedgelist(em, eve->prev, eve, NULL); - } + addedgelist(em, eve->prev, eve, NULL); } /* extrude and translate */ vec[0]= vec[2]= 0.0; @@ -1657,7 +1707,7 @@ void MESH_OT_primitive_ico_sphere_add(wmOperatorType *ot) /****************** add duplicate operator ***************/ -static int mesh_duplicate_exec(bContext *C, wmOperator *op) +static int mesh_duplicate_exec(bContext *C, wmOperator *UNUSED(op)) { Object *ob= CTX_data_edit_object(C); EditMesh *em= BKE_mesh_get_editmesh(ob->data); @@ -1672,7 +1722,7 @@ static int mesh_duplicate_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -static int mesh_duplicate_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int mesh_duplicate_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { WM_cursor_wait(1); mesh_duplicate_exec(C, op); diff --git a/source/blender/editors/mesh/editmesh_lib.c b/source/blender/editors/mesh/editmesh_lib.c index d34cca0d358..b632cb2a842 100644 --- a/source/blender/editors/mesh/editmesh_lib.c +++ b/source/blender/editors/mesh/editmesh_lib.c @@ -58,6 +58,7 @@ editmesh_lib: generic (no UI, no menus) operations/evaluators for editmesh data #include "ED_mesh.h" #include "ED_screen.h" #include "ED_view3d.h" +#include "ED_transform.h" #include "mesh_intern.h" @@ -214,7 +215,7 @@ static int EM_check_selection(EditMesh *em, void *data) return 0; } -void EM_remove_selection(EditMesh *em, void *data, int type) +void EM_remove_selection(EditMesh *em, void *data, int UNUSED(type)) { EditSelection *ese; for(ese=em->selected.first; ese; ese = ese->next){ @@ -1050,7 +1051,7 @@ static void set_edge_directions_f2(EditMesh *em, int val) /* individual face extrude */ /* will use vertex normals for extrusion directions, so *nor is unaffected */ -short extrudeflag_face_indiv(EditMesh *em, short flag, float *nor) +short extrudeflag_face_indiv(EditMesh *em, short UNUSED(flag), float *UNUSED(nor)) { EditVert *eve, *v1, *v2, *v3, *v4; EditEdge *eed; @@ -1204,7 +1205,7 @@ short extrudeflag_edges_indiv(EditMesh *em, short flag, float *nor) } /* extrudes individual vertices */ -short extrudeflag_verts_indiv(EditMesh *em, short flag, float *nor) +short extrudeflag_verts_indiv(EditMesh *em, short flag, float *UNUSED(nor)) { EditVert *eve; @@ -1230,7 +1231,7 @@ short extrudeflag_verts_indiv(EditMesh *em, short flag, float *nor) /* this is actually a recode of extrudeflag(), using proper edge/face select */ /* hurms, doesnt use 'flag' yet, but its not called by primitive making stuff anyway */ -static short extrudeflag_edge(Object *obedit, EditMesh *em, short flag, float *nor, int all) +static short extrudeflag_edge(Object *obedit, EditMesh *em, short UNUSED(flag), float *nor, int all) { /* all select edges/faces: extrude */ /* old select is cleared, in new ones it is set */ @@ -2765,3 +2766,18 @@ int EM_deselect_nth(EditMesh *em, int nth) return 0; } +void EM_project_snap_verts(bContext *C, ARegion *ar, Object *obedit, EditMesh *em) +{ + EditVert *eve; + for(eve= em->verts.first;eve; eve=eve->next) { + if(eve->f & SELECT) { + float mval[2], vec[3], no_dummy[3]; + int dist_dummy; + mul_v3_m4v3(vec, obedit->obmat, eve->co); + project_float_noclip(ar, vec, mval); + if(snapObjectsContext(C, mval, &dist_dummy, vec, no_dummy, SNAP_NOT_OBEDIT)) { + mul_v3_m4v3(eve->co, obedit->imat, vec); + } + } + } +} diff --git a/source/blender/editors/mesh/editmesh_loop.c b/source/blender/editors/mesh/editmesh_loop.c index 682fbca5072..7595e0d2fe1 100644 --- a/source/blender/editors/mesh/editmesh_loop.c +++ b/source/blender/editors/mesh/editmesh_loop.c @@ -69,9 +69,9 @@ editmesh_loop: tools with own drawing subloops, select, knife, subdiv #include "mesh_intern.h" /* **** XXX ******** */ -static void BIF_undo_push(const char *dummy) {} +static void BIF_undo_push(const char *UNUSED(arg)) {} static void BIF_undo() {} -static void error(const char *dummy) {} +static void error(const char *UNUSED(arg)) {} static int qtest() {return 0;} /* **** XXX ******** */ diff --git a/source/blender/editors/mesh/editmesh_mods.c b/source/blender/editors/mesh/editmesh_mods.c index 164e8980b83..ab01a773020 100644 --- a/source/blender/editors/mesh/editmesh_mods.c +++ b/source/blender/editors/mesh/editmesh_mods.c @@ -83,8 +83,8 @@ editmesh_mods.c, UI level access, no geometry changes #include "BLO_sys_types.h" // for intptr_t support /* XXX */ -static void waitcursor(int val) {} -static int pupmenu(const char *dummy) {return 0;} +static void waitcursor(int UNUSED(val)) {} +static int pupmenu(const char *UNUSED(arg)) {return 0;} /* ****************************** MIRROR **************** */ @@ -475,7 +475,7 @@ static float labda_PdistVL2Dfl( float *v1, float *v2, float *v3) } /* note; uses v3d, so needs active 3d window */ -static void findnearestedge__doClosest(void *userData, EditEdge *eed, int x0, int y0, int x1, int y1, int index) +static void findnearestedge__doClosest(void *userData, EditEdge *eed, int x0, int y0, int x1, int y1, int UNUSED(index)) { struct { ViewContext vc; float mval[2]; int dist; EditEdge *closest; } *data = userData; float v1[2], v2[2]; @@ -544,7 +544,7 @@ EditEdge *findnearestedge(ViewContext *vc, int *dist) } } -static void findnearestface__getDistance(void *userData, EditFace *efa, int x, int y, int index) +static void findnearestface__getDistance(void *userData, EditFace *efa, int x, int y, int UNUSED(index)) { struct { short mval[2]; int dist; EditFace *toFace; } *data = userData; @@ -1252,7 +1252,7 @@ static int select_similar_exec(bContext *C, wmOperator *op) return similar_face_select_exec(C, op); } -static EnumPropertyItem *select_similar_type_itemf(bContext *C, PointerRNA *ptr, int *free) +static EnumPropertyItem *select_similar_type_itemf(bContext *C, PointerRNA *UNUSED(ptr), int *free) { Object *obedit= CTX_data_edit_object(C); EnumPropertyItem *item= NULL; @@ -2207,7 +2207,7 @@ static void mouse_mesh_shortest_path(bContext *C, short mval[2]) } -static int mesh_shortest_path_select_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int mesh_shortest_path_select_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent *event) { view3d_operator_needs_opengl(C); @@ -2618,7 +2618,7 @@ static int select_linked_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -static int select_linked_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int select_linked_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { linked_limit_default(C, op); return select_linked_exec(C, op); @@ -2815,7 +2815,7 @@ void EM_reveal_mesh(EditMesh *em) // DAG_id_flush_update(obedit->data, OB_RECALC_DATA); } -static int reveal_mesh_exec(bContext *C, wmOperator *op) +static int reveal_mesh_exec(bContext *C, wmOperator *UNUSED(op)) { Object *obedit= CTX_data_edit_object(C); EditMesh *em= BKE_mesh_get_editmesh(((Mesh *)obedit->data)); @@ -3360,7 +3360,7 @@ void EM_select_swap(EditMesh *em) /* exported for UV */ } -static int select_inverse_mesh_exec(bContext *C, wmOperator *op) +static int select_inverse_mesh_exec(bContext *C, wmOperator *UNUSED(op)) { Object *obedit= CTX_data_edit_object(C); EditMesh *em= BKE_mesh_get_editmesh(((Mesh *)obedit->data)); @@ -3493,7 +3493,7 @@ void EM_select_more(EditMesh *em) } } -static int select_more(bContext *C, wmOperator *op) +static int select_more(bContext *C, wmOperator *UNUSED(op)) { Object *obedit= CTX_data_edit_object(C); EditMesh *em= BKE_mesh_get_editmesh(((Mesh *)obedit->data)) ; @@ -3584,7 +3584,7 @@ void EM_select_less(EditMesh *em) } } -static int select_less(bContext *C, wmOperator *op) +static int select_less(bContext *C, wmOperator *UNUSED(op)) { Object *obedit= CTX_data_edit_object(C); EditMesh *em= BKE_mesh_get_editmesh(((Mesh *)obedit->data)); @@ -4490,7 +4490,7 @@ void flipface(EditMesh *em, EditFace *efa) } -static int flip_normals(bContext *C, wmOperator *op) +static int flip_normals(bContext *C, wmOperator *UNUSED(op)) { Object *obedit= CTX_data_edit_object(C); EditMesh *em= BKE_mesh_get_editmesh(((Mesh *)obedit->data)); diff --git a/source/blender/editors/mesh/editmesh_tools.c b/source/blender/editors/mesh/editmesh_tools.c index eadf0ca120f..66090f14fff 100644 --- a/source/blender/editors/mesh/editmesh_tools.c +++ b/source/blender/editors/mesh/editmesh_tools.c @@ -80,7 +80,7 @@ editmesh_tool.c: UI called tools for editmesh, geometry changes here, otherwise #include "mesh_intern.h" /* XXX */ -static void waitcursor(int val) {} +static void waitcursor(int UNUSED(val)) {} #define add_numbut(a, b, c, d, e, f, g) {} /* XXX */ @@ -511,7 +511,7 @@ void MESH_OT_remove_doubles(wmOperatorType *ot) // XXX is this needed? /* called from buttons */ -static void xsortvert_flag__doSetX(void *userData, EditVert *eve, int x, int y, int index) +static void xsortvert_flag__doSetX(void *userData, EditVert *UNUSED(eve), int x, int UNUSED(y), int index) { xvertsort *sortblock = userData; @@ -616,7 +616,7 @@ void hashvert_flag(EditMesh *em, int flag) } /* generic extern called extruder */ -void extrude_mesh(Scene *scene, Object *obedit, EditMesh *em, wmOperator *op, short type) +static void extrude_mesh(Object *obedit, EditMesh *em, wmOperator *op, short type) { float nor[3]= {0.0, 0.0, 0.0}; short transmode= 0; @@ -664,13 +664,12 @@ void extrude_mesh(Scene *scene, Object *obedit, EditMesh *em, wmOperator *op, sh } // XXX should be a menu item -static int mesh_extrude_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int mesh_extrude_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { - Scene *scene= CTX_data_scene(C); Object *obedit= CTX_data_edit_object(C); EditMesh *em= BKE_mesh_get_editmesh((Mesh *)obedit->data); - extrude_mesh(scene, obedit, em, op, RNA_int_get(op->ptr, "type")); + extrude_mesh(obedit, em, op, RNA_int_get(op->ptr, "type")); BKE_mesh_end_editmesh(obedit->data, em); @@ -683,11 +682,10 @@ static int mesh_extrude_invoke(bContext *C, wmOperator *op, wmEvent *event) /* extrude without transform */ static int mesh_extrude_exec(bContext *C, wmOperator *op) { - Scene *scene= CTX_data_scene(C); Object *obedit= CTX_data_edit_object(C); EditMesh *em= BKE_mesh_get_editmesh(obedit->data); - extrude_mesh(scene, obedit, em, op, RNA_int_get(op->ptr, "type")); + extrude_mesh(obedit, em, op, RNA_int_get(op->ptr, "type")); DAG_id_flush_update(obedit->data, OB_RECALC_DATA); WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data); @@ -704,7 +702,7 @@ EnumPropertyItem extrude_items[] = { {0, NULL, 0, NULL, NULL}}; -static EnumPropertyItem *extrude_itemf(bContext *C, PointerRNA *ptr, int *free) +static EnumPropertyItem *extrude_itemf(bContext *C, PointerRNA *UNUSED(ptr), int *free) { EnumPropertyItem *item= NULL; Object *obedit= CTX_data_edit_object(C); @@ -796,7 +794,7 @@ void MESH_OT_extrude(wmOperatorType *ot) ot->prop= prop; } -static int split_mesh(bContext *C, wmOperator *op) +static int split_mesh(bContext *C, wmOperator *UNUSED(op)) { Object *obedit= CTX_data_edit_object(C); EditMesh *em= BKE_mesh_get_editmesh((Mesh *)obedit->data); @@ -1000,7 +998,7 @@ static int spin_mesh_exec(bContext *C, wmOperator *op) } /* get center and axis, in global coords */ -static int spin_mesh_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int spin_mesh_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { Scene *scene = CTX_data_scene(C); View3D *v3d = CTX_wm_view3d(C); @@ -1108,7 +1106,7 @@ static int screw_mesh_exec(bContext *C, wmOperator *op) } /* get center and axis, in global coords */ -static int screw_mesh_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int screw_mesh_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { Scene *scene = CTX_data_scene(C); View3D *v3d = CTX_wm_view3d(C); @@ -1189,7 +1187,7 @@ static void erase_vertices(EditMesh *em, ListBase *l) } } -void delete_mesh(Object *obedit, EditMesh *em, wmOperator *op, int event) +static void delete_mesh(EditMesh *em, wmOperator *op, int event) { EditFace *efa, *nextvl; EditVert *eve,*nextve; @@ -1347,7 +1345,7 @@ static int delete_mesh_exec(bContext *C, wmOperator *op) if(type==6) return WM_operator_name_call(C, "MESH_OT_delete_edgeloop", WM_OP_EXEC_DEFAULT, NULL); - delete_mesh(obedit, em, op, type); + delete_mesh(em, op, type); DAG_id_flush_update(obedit->data, OB_RECALC_DATA); WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data); @@ -4703,7 +4701,7 @@ useless: } #endif // END OF XXX -int EdgeLoopDelete(EditMesh *em, wmOperator *op) +int EdgeLoopDelete(EditMesh *UNUSED(em), wmOperator *UNUSED(op)) { #if 0 //XXX won't work with new edgeslide @@ -5185,7 +5183,7 @@ static int blend_from_shape_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -static EnumPropertyItem *shape_itemf(bContext *C, PointerRNA *ptr, int *free) +static EnumPropertyItem *shape_itemf(bContext *C, PointerRNA *UNUSED(ptr), int *free) { Object *obedit= CTX_data_edit_object(C); Mesh *me= (obedit) ? obedit->data : NULL; @@ -5884,7 +5882,7 @@ static EnumPropertyItem merge_type_items[]= { {5, "COLLAPSE", 0, "Collapse", ""}, {0, NULL, 0, NULL, NULL}}; -static EnumPropertyItem *merge_type_itemf(bContext *C, PointerRNA *ptr, int *free) +static EnumPropertyItem *merge_type_itemf(bContext *C, PointerRNA *UNUSED(ptr), int *free) { Object *obedit= CTX_data_edit_object(C); EnumPropertyItem *item= NULL; @@ -6144,7 +6142,7 @@ void MESH_OT_select_vertex_path(wmOperatorType *ot) /********************** Region/Loop Operators *************************/ -static int region_to_loop(bContext *C, wmOperator *op) +static int region_to_loop(bContext *C, wmOperator *UNUSED(op)) { Object *obedit= CTX_data_edit_object(C); EditMesh *em= BKE_mesh_get_editmesh((Mesh *)obedit->data); @@ -6325,7 +6323,7 @@ static int loop_bisect(EditMesh *em, Collection *edgecollection){ else return(2); } -static int loop_to_region(bContext *C, wmOperator *op) +static int loop_to_region(bContext *C, wmOperator *UNUSED(op)) { Object *obedit= CTX_data_edit_object(C); EditMesh *em= BKE_mesh_get_editmesh((Mesh *)obedit->data); @@ -7003,7 +7001,7 @@ static void fill_mesh(EditMesh *em) } } - if(BLI_edgefill(0, em->mat_nr)) { + if(BLI_edgefill(em->mat_nr)) { efa= fillfacebase.first; while(efa) { /* normals default pointing up */ @@ -7022,7 +7020,7 @@ static void fill_mesh(EditMesh *em) } -static int fill_mesh_exec(bContext *C, wmOperator *op) +static int fill_mesh_exec(bContext *C, wmOperator *UNUSED(op)) { Object *obedit= CTX_data_edit_object(C); EditMesh *em= BKE_mesh_get_editmesh((Mesh *)obedit->data); @@ -7053,7 +7051,7 @@ void MESH_OT_fill(wmOperatorType *ot) ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; } -static int beautify_fill_exec(bContext *C, wmOperator *op) +static int beautify_fill_exec(bContext *C, wmOperator *UNUSED(op)) { Object *obedit= CTX_data_edit_object(C); EditMesh *em= BKE_mesh_get_editmesh((Mesh *)obedit->data); @@ -7263,7 +7261,7 @@ void MESH_OT_sort_faces(wmOperatorType *ot) /********************** Quad/Tri Operators *************************/ -static int quads_convert_to_tris_exec(bContext *C, wmOperator *op) +static int quads_convert_to_tris_exec(bContext *C, wmOperator *UNUSED(op)) { Object *obedit= CTX_data_edit_object(C); EditMesh *em= BKE_mesh_get_editmesh((Mesh *)obedit->data); @@ -7292,7 +7290,7 @@ void MESH_OT_quads_convert_to_tris(wmOperatorType *ot) ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; } -static int tris_convert_to_quads_exec(bContext *C, wmOperator *op) +static int tris_convert_to_quads_exec(bContext *C, wmOperator *UNUSED(op)) { Object *obedit= CTX_data_edit_object(C); EditMesh *em= BKE_mesh_get_editmesh((Mesh *)obedit->data); @@ -7321,7 +7319,7 @@ void MESH_OT_tris_convert_to_quads(wmOperatorType *ot) ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; } -static int edge_flip_exec(bContext *C, wmOperator *op) +static int edge_flip_exec(bContext *C, wmOperator *UNUSED(op)) { Object *obedit= CTX_data_edit_object(C); EditMesh *em= BKE_mesh_get_editmesh((Mesh *)obedit->data); @@ -7366,7 +7364,7 @@ static void mesh_set_smooth_faces(EditMesh *em, short smooth) } } -static int mesh_faces_shade_smooth_exec(bContext *C, wmOperator *op) +static int mesh_faces_shade_smooth_exec(bContext *C, wmOperator *UNUSED(op)) { Object *obedit= CTX_data_edit_object(C); EditMesh *em= BKE_mesh_get_editmesh((Mesh *)obedit->data); @@ -7396,7 +7394,7 @@ void MESH_OT_faces_shade_smooth(wmOperatorType *ot) ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; } -static int mesh_faces_shade_flat_exec(bContext *C, wmOperator *op) +static int mesh_faces_shade_flat_exec(bContext *C, wmOperator *UNUSED(op)) { Object *obedit= CTX_data_edit_object(C); EditMesh *em= BKE_mesh_get_editmesh((Mesh *)obedit->data); diff --git a/source/blender/editors/mesh/loopcut.c b/source/blender/editors/mesh/loopcut.c index 13538a6f218..ac65a3c21d3 100644 --- a/source/blender/editors/mesh/loopcut.c +++ b/source/blender/editors/mesh/loopcut.c @@ -94,7 +94,7 @@ typedef struct tringselOpData { } tringselOpData; /* modal loop selection drawing callback */ -static void ringsel_draw(const bContext *C, ARegion *ar, void *arg) +static void ringsel_draw(const bContext *UNUSED(C), ARegion *UNUSED(ar), void *arg) { int i; tringselOpData *lcd = arg; @@ -248,7 +248,7 @@ static void edgering_sel(tringselOpData *lcd, int previewlines, int select) lcd->totedge = tot; } -static void ringsel_find_edge(tringselOpData *lcd, const bContext *C, ARegion *ar, int cuts) +static void ringsel_find_edge(tringselOpData *lcd, int cuts) { if (lcd->eed) { edgering_sel(lcd, cuts, 0); @@ -293,7 +293,7 @@ static void ringsel_finish(bContext *C, wmOperator *op) } /* called when modal loop selection is done... */ -static void ringsel_exit (bContext *C, wmOperator *op) +static void ringsel_exit(wmOperator *op) { tringselOpData *lcd= op->customdata; @@ -332,10 +332,10 @@ static int ringsel_init (bContext *C, wmOperator *op, int do_cut) return 1; } -static int ringcut_cancel (bContext *C, wmOperator *op) +static int ringcut_cancel (bContext *UNUSED(C), wmOperator *op) { /* this is just a wrapper around exit() */ - ringsel_exit(C, op); + ringsel_exit(op); return OPERATOR_CANCELLED; } @@ -353,7 +353,7 @@ static int ringsel_invoke (bContext *C, wmOperator *op, wmEvent *evt) lcd = op->customdata; if (lcd->em->selectmode == SCE_SELECT_FACE) { - ringsel_exit(C, op); + ringsel_exit(op); WM_operator_name_call(C, "MESH_OT_loop_select", WM_OP_INVOKE_REGION_WIN, NULL); return OPERATOR_CANCELLED; } @@ -363,15 +363,15 @@ static int ringsel_invoke (bContext *C, wmOperator *op, wmEvent *evt) edge = findnearestedge(&lcd->vc, &dist); if(!edge) { - ringsel_exit(C, op); + ringsel_exit(op); return OPERATOR_CANCELLED; } lcd->eed = edge; - ringsel_find_edge(lcd, C, lcd->ar, 1); + ringsel_find_edge(lcd, 1); ringsel_finish(C, op); - ringsel_exit(C, op); + ringsel_exit(op); return OPERATOR_FINISHED; } @@ -397,7 +397,7 @@ static int ringcut_invoke (bContext *C, wmOperator *op, wmEvent *evt) edge = findnearestedge(&lcd->vc, &dist); if (edge != lcd->eed) { lcd->eed = edge; - ringsel_find_edge(lcd, C, lcd->ar, 1); + ringsel_find_edge(lcd, 1); } return OPERATOR_RUNNING_MODAL; @@ -418,7 +418,7 @@ static int ringcut_modal (bContext *C, wmOperator *op, wmEvent *event) ED_region_tag_redraw(lcd->ar); ringsel_finish(C, op); - ringsel_exit(C, op); + ringsel_exit(op); return OPERATOR_FINISHED; } @@ -441,7 +441,7 @@ static int ringcut_modal (bContext *C, wmOperator *op, wmEvent *event) if (event->val == KM_PRESS) { cuts++; RNA_int_set(op->ptr, "number_cuts",cuts); - ringsel_find_edge(lcd, C, lcd->ar, cuts); + ringsel_find_edge(lcd, cuts); ED_region_tag_redraw(lcd->ar); } @@ -451,7 +451,7 @@ static int ringcut_modal (bContext *C, wmOperator *op, wmEvent *event) if (event->val == KM_PRESS) { cuts=MAX2(cuts-1,1); RNA_int_set(op->ptr,"number_cuts",cuts); - ringsel_find_edge(lcd, C, lcd->ar,cuts); + ringsel_find_edge(lcd, cuts); ED_region_tag_redraw(lcd->ar); } @@ -466,7 +466,7 @@ static int ringcut_modal (bContext *C, wmOperator *op, wmEvent *event) if (edge != lcd->eed) { lcd->eed = edge; - ringsel_find_edge(lcd, C, lcd->ar, cuts); + ringsel_find_edge(lcd, cuts); } ED_region_tag_redraw(lcd->ar); diff --git a/source/blender/editors/mesh/mesh_data.c b/source/blender/editors/mesh/mesh_data.c index d1c6ff4c4ae..080151a8dca 100644 --- a/source/blender/editors/mesh/mesh_data.c +++ b/source/blender/editors/mesh/mesh_data.c @@ -157,7 +157,7 @@ static void delete_customdata_layer(bContext *C, Object *ob, CustomDataLayer *la } } -int ED_mesh_uv_texture_add(bContext *C, Scene *scene, Object *ob, Mesh *me, const char *name, int active_set) +int ED_mesh_uv_texture_add(bContext *C, Mesh *me, const char *name, int active_set) { EditMesh *em; int layernum; @@ -286,13 +286,12 @@ static int layers_poll(bContext *C) return (ob && !ob->id.lib && ob->type==OB_MESH && data && !data->lib); } -static int uv_texture_add_exec(bContext *C, wmOperator *op) +static int uv_texture_add_exec(bContext *C, wmOperator *UNUSED(op)) { - Scene *scene= CTX_data_scene(C); Object *ob= CTX_data_pointer_get_type(C, "object", &RNA_Object).data; Mesh *me= ob->data; - if(!ED_mesh_uv_texture_add(C, scene, ob, me, NULL, TRUE)) + if(!ED_mesh_uv_texture_add(C, me, NULL, TRUE)) return OPERATOR_CANCELLED; return OPERATOR_FINISHED; @@ -334,8 +333,7 @@ static int drop_named_image_invoke(bContext *C, wmOperator *op, wmEvent *event) char path[FILE_MAX]; RNA_string_get(op->ptr, "filepath", path); - ima= BKE_add_image_file(path, - scene ? scene->r.cfra : 1); + ima= BKE_add_image_file(path); } else { RNA_string_get(op->ptr, "name", name); @@ -392,7 +390,7 @@ void MESH_OT_drop_named_image(wmOperatorType *ot) RNA_def_string(ot->srna, "filepath", "Path", FILE_MAX, "Filepath", "Path to image file"); } -static int uv_texture_remove_exec(bContext *C, wmOperator *op) +static int uv_texture_remove_exec(bContext *C, wmOperator *UNUSED(op)) { Object *ob= CTX_data_pointer_get_type(C, "object", &RNA_Object).data; Mesh *me= ob->data; @@ -420,7 +418,7 @@ void MESH_OT_uv_texture_remove(wmOperatorType *ot) /*********************** vertex color operators ************************/ -static int vertex_color_add_exec(bContext *C, wmOperator *op) +static int vertex_color_add_exec(bContext *C, wmOperator *UNUSED(op)) { Scene *scene= CTX_data_scene(C); Object *ob= CTX_data_pointer_get_type(C, "object", &RNA_Object).data; @@ -447,7 +445,7 @@ void MESH_OT_vertex_color_add(wmOperatorType *ot) ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; } -static int vertex_color_remove_exec(bContext *C, wmOperator *op) +static int vertex_color_remove_exec(bContext *C, wmOperator *UNUSED(op)) { Object *ob= CTX_data_pointer_get_type(C, "object", &RNA_Object).data; Mesh *me= ob->data; @@ -475,7 +473,7 @@ void MESH_OT_vertex_color_remove(wmOperatorType *ot) /*********************** sticky operators ************************/ -static int sticky_add_exec(bContext *C, wmOperator *op) +static int sticky_add_exec(bContext *C, wmOperator *UNUSED(op)) { Scene *scene= CTX_data_scene(C); View3D *v3d= CTX_wm_view3d(C); @@ -508,7 +506,7 @@ void MESH_OT_sticky_add(wmOperatorType *ot) ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; } -static int sticky_remove_exec(bContext *C, wmOperator *op) +static int sticky_remove_exec(bContext *C, wmOperator *UNUSED(op)) { Object *ob= CTX_data_pointer_get_type(C, "object", &RNA_Object).data; Mesh *me= ob->data; diff --git a/source/blender/editors/mesh/mesh_ops.c b/source/blender/editors/mesh/mesh_ops.c index fa055a385f3..2ff7095cfea 100644 --- a/source/blender/editors/mesh/mesh_ops.c +++ b/source/blender/editors/mesh/mesh_ops.c @@ -262,7 +262,7 @@ void ED_keymap_mesh(wmKeyConfig *keyconf) WM_keymap_add_item(keymap, "MESH_OT_normals_make_consistent", NKEY, KM_PRESS, KM_CTRL, 0); RNA_boolean_set(WM_keymap_add_item(keymap, "MESH_OT_normals_make_consistent", NKEY, KM_PRESS, KM_SHIFT|KM_CTRL, 0)->ptr, "inside", 1); - WM_keymap_add_item(keymap, "view3d.edit_mesh_extrude_move_normal", EKEY, KM_PRESS, 0, 0); + WM_keymap_add_item(keymap, "VIEW3D_OT_edit_mesh_extrude_move_normal", EKEY, KM_PRESS, 0, 0); /* python operator */ WM_keymap_add_item(keymap, "VIEW3D_OT_edit_mesh_extrude_individual_move", EKEY, KM_PRESS, KM_SHIFT, 0); WM_keymap_add_menu(keymap, "VIEW3D_MT_edit_mesh_extrude", EKEY, KM_PRESS, KM_ALT, 0); @@ -292,7 +292,8 @@ void ED_keymap_mesh(wmKeyConfig *keyconf) /* use KM_CLICK because same key is used for tweaks */ WM_keymap_add_item(keymap, "MESH_OT_dupli_extrude_cursor", ACTIONMOUSE, KM_CLICK, KM_CTRL, 0); - + RNA_boolean_set(WM_keymap_add_item(keymap, "MESH_OT_dupli_extrude_cursor", ACTIONMOUSE, KM_CLICK, KM_SHIFT|KM_CTRL, 0)->ptr, "rotate_source", 0); + WM_keymap_add_item(keymap, "MESH_OT_delete", XKEY, KM_PRESS, 0, 0); WM_keymap_add_item(keymap, "MESH_OT_delete", DELKEY, KM_PRESS, 0, 0); diff --git a/source/blender/editors/mesh/meshtools.c b/source/blender/editors/mesh/meshtools.c index e8c787b168f..d8b34311e76 100644 --- a/source/blender/editors/mesh/meshtools.c +++ b/source/blender/editors/mesh/meshtools.c @@ -84,7 +84,7 @@ /* join selected meshes into the active mesh, context sensitive return 0 if no join is made (error) and 1 of the join is done */ -int join_mesh_exec(bContext *C, wmOperator *op) +int join_mesh_exec(bContext *C, wmOperator *UNUSED(op)) { Main *bmain= CTX_data_main(C); Scene *scene= CTX_data_scene(C); @@ -1104,14 +1104,14 @@ static EditVert *editmesh_get_x_mirror_vert_topo(Object *ob, struct EditMesh *em if(poinval != -1) return (EditVert *)(poinval); return NULL; -} +} EditVert *editmesh_get_x_mirror_vert(Object *ob, struct EditMesh *em, EditVert *eve, float *co, int index) { if (((Mesh *)ob->data)->editflag & ME_EDIT_MIRROR_TOPO) { return editmesh_get_x_mirror_vert_topo(ob, em, eve, index); } else { - return editmesh_get_x_mirror_vert_spacial(ob, em, eve->co); + return editmesh_get_x_mirror_vert_spacial(ob, em, co); } } diff --git a/source/blender/editors/metaball/mball_edit.c b/source/blender/editors/metaball/mball_edit.c index 80cea4eea1c..ec727d7d82b 100644 --- a/source/blender/editors/metaball/mball_edit.c +++ b/source/blender/editors/metaball/mball_edit.c @@ -84,12 +84,12 @@ void make_editMball(Object *obedit) /* This function is called, when MetaBall Object switched from * edit mode to object mode. List od MetaElements is copied * from object->data->edit_elems to object->data->elems. */ -void load_editMball(Object *obedit) +void load_editMball(Object *UNUSED(obedit)) { } /* Add metaelem primitive to metaball object (which is in edit mode) */ -MetaElem *add_metaball_primitive(bContext *C, float mat[4][4], int type, int newname) +MetaElem *add_metaball_primitive(bContext *C, float mat[4][4], int type, int UNUSED(newname)) { Object *obedit= CTX_data_edit_object(C); MetaBall *mball = (MetaBall*)obedit->data; @@ -177,7 +177,7 @@ void MBALL_OT_select_all(wmOperatorType *ot) /***************************** Select inverse operator *****************************/ /* Invert metaball selection */ -static int select_inverse_metaelems_exec(bContext *C, wmOperator *op) +static int select_inverse_metaelems_exec(bContext *C, wmOperator *UNUSED(op)) { Object *obedit= CTX_data_edit_object(C); MetaBall *mb = (MetaBall*)obedit->data; @@ -266,7 +266,7 @@ void MBALL_OT_select_random_metaelems(struct wmOperatorType *ot) /***************************** Duplicate operator *****************************/ /* Duplicate selected MetaElements */ -static int duplicate_metaelems_exec(bContext *C, wmOperator *op) +static int duplicate_metaelems_exec(bContext *C, wmOperator *UNUSED(op)) { Object *obedit= CTX_data_edit_object(C); MetaBall *mb = (MetaBall*)obedit->data; @@ -290,7 +290,7 @@ static int duplicate_metaelems_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -static int duplicate_metaelems_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int duplicate_metaelems_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { int retv= duplicate_metaelems_exec(C, op); @@ -325,7 +325,7 @@ void MBALL_OT_duplicate_metaelems(wmOperatorType *ot) /***************************** Delete operator *****************************/ /* Delete all selected MetaElems (not MetaBall) */ -static int delete_metaelems_exec(bContext *C, wmOperator *op) +static int delete_metaelems_exec(bContext *C, wmOperator *UNUSED(op)) { Object *obedit= CTX_data_edit_object(C); MetaBall *mb= (MetaBall*)obedit->data; @@ -420,7 +420,7 @@ void MBALL_OT_hide_metaelems(wmOperatorType *ot) /***************************** Unhide operator *****************************/ /* Unhide all edited MetaElems */ -static int reveal_metaelems_exec(bContext *C, wmOperator *op) +static int reveal_metaelems_exec(bContext *C, wmOperator *UNUSED(op)) { Object *obedit= CTX_data_edit_object(C); MetaBall *mb= (MetaBall*)obedit->data; diff --git a/source/blender/editors/object/object_add.c b/source/blender/editors/object/object_add.c index 3ae1941035d..56af4ce1b1c 100644 --- a/source/blender/editors/object/object_add.c +++ b/source/blender/editors/object/object_add.c @@ -161,11 +161,6 @@ float ED_object_new_primitive_matrix(bContext *C, Object *obedit, float *loc, fl /********************* Add Object Operator ********************/ -void add_object_draw(Scene *scene, View3D *v3d, int type) /* for toolbox or menus, only non-editmode stuff */ -{ - /* keep here to get things compile, remove later */ -} - void ED_object_add_generic_props(wmOperatorType *ot, int do_editmode) { PropertyRNA *prop; @@ -218,7 +213,7 @@ static void object_add_generic_invoke_options(bContext *C, wmOperator *op) } } -int ED_object_add_generic_invoke(bContext *C, wmOperator *op, wmEvent *event) +int ED_object_add_generic_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { object_add_generic_invoke_options(C, op); return op->type->exec(C, op); @@ -363,11 +358,6 @@ static EnumPropertyItem field_type_items[] = { {PFIELD_DRAG, "DRAG", ICON_FORCE_DRAG, "Drag", ""}, {0, NULL, 0, NULL, NULL}}; -void add_effector_draw(Scene *scene, View3D *v3d, int type) /* for toolbox or menus, only non-editmode stuff */ -{ - /* keep here to get things compile, remove later */ -} - /* for effector add primitive operators */ static Object *effector_add_type(bContext *C, wmOperator *op, int type) { @@ -537,7 +527,7 @@ static int object_metaball_add_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -static int object_metaball_add_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int object_metaball_add_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { Object *obedit= CTX_data_edit_object(C); uiPopupMenu *pup; @@ -805,7 +795,7 @@ void ED_base_object_free_and_unlink(Main *bmain, Scene *scene, Base *base) MEM_freeN(base); } -static int object_delete_exec(bContext *C, wmOperator *op) +static int object_delete_exec(bContext *C, wmOperator *UNUSED(op)) { Main *bmain= CTX_data_main(C); Scene *scene= CTX_data_scene(C); @@ -817,6 +807,10 @@ static int object_delete_exec(bContext *C, wmOperator *op) CTX_DATA_BEGIN(C, Base*, base, selected_bases) { if(base->object->type==OB_LAMP) islamp= 1; + + /* deselect object -- it could be used in other scenes */ + base->object->flag &= ~SELECT; + /* remove from current scene only */ ED_base_object_free_and_unlink(bmain, scene, base); } @@ -851,7 +845,7 @@ void OBJECT_OT_delete(wmOperatorType *ot) /**************************** Copy Utilities ******************************/ -static void copy_object__forwardModifierLinks(void *userData, Object *ob, +static void copy_object__forwardModifierLinks(void *UNUSED(userData), Object *UNUSED(ob), ID **idpoin) { /* this is copied from ID_NEW; it might be better to have a macro */ @@ -1001,7 +995,7 @@ static void make_object_duplilist_real(bContext *C, Scene *scene, Base *base) base->object->transflag &= ~OB_DUPLI; } -static int object_duplicates_make_real_exec(bContext *C, wmOperator *op) +static int object_duplicates_make_real_exec(bContext *C, wmOperator *UNUSED(op)) { Main *bmain= CTX_data_main(C); Scene *scene= CTX_data_scene(C); diff --git a/source/blender/editors/object/object_bake.c b/source/blender/editors/object/object_bake.c index f81e73faf73..0c28d4a608b 100644 --- a/source/blender/editors/object/object_bake.c +++ b/source/blender/editors/object/object_bake.c @@ -69,7 +69,7 @@ /* ****************** render BAKING ********************** */ /* threaded break test */ -static int thread_break(void *unused) +static int thread_break(void *UNUSED(arg)) { return G.afbreek; } @@ -241,7 +241,7 @@ static void bake_freejob(void *bkv) } /* catch esc */ -static int objects_bake_render_modal(bContext *C, wmOperator *op, wmEvent *event) +static int objects_bake_render_modal(bContext *C, wmOperator *UNUSED(op), wmEvent *event) { /* no running blender, remove handler and pass through */ if(0==WM_jobs_test(CTX_wm_manager(C), CTX_data_scene(C))) @@ -256,7 +256,7 @@ static int objects_bake_render_modal(bContext *C, wmOperator *op, wmEvent *event return OPERATOR_PASS_THROUGH; } -static int objects_bake_render_invoke(bContext *C, wmOperator *op, wmEvent *_event) +static int objects_bake_render_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(_event)) { Scene *scene= CTX_data_scene(C); diff --git a/source/blender/editors/object/object_constraint.c b/source/blender/editors/object/object_constraint.c index fd3c8b165c0..02c88d4149b 100644 --- a/source/blender/editors/object/object_constraint.c +++ b/source/blender/editors/object/object_constraint.c @@ -511,7 +511,7 @@ static int edit_constraint_invoke_properties(bContext *C, wmOperator *op) return 0; } -static bConstraint *edit_constraint_property_get(bContext *C, wmOperator *op, Object *ob, int type) +static bConstraint *edit_constraint_property_get(wmOperator *op, Object *ob, int type) { char constraint_name[32]; int owner = RNA_enum_get(op->ptr, "owner"); @@ -547,7 +547,7 @@ static bConstraint *edit_constraint_property_get(bContext *C, wmOperator *op, Ob static int stretchto_reset_exec (bContext *C, wmOperator *op) { Object *ob = ED_object_active_context(C); - bConstraint *con = edit_constraint_property_get(C, op, ob, CONSTRAINT_TYPE_STRETCHTO); + bConstraint *con = edit_constraint_property_get(op, ob, CONSTRAINT_TYPE_STRETCHTO); bStretchToConstraint *data= (con) ? (bStretchToConstraint *)con->data : NULL; /* despite 3 layers of checks, we may still not be able to find a constraint */ @@ -562,7 +562,7 @@ static int stretchto_reset_exec (bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -static int stretchto_reset_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int stretchto_reset_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { if (edit_constraint_invoke_properties(C, op)) return stretchto_reset_exec(C, op); @@ -590,7 +590,7 @@ void CONSTRAINT_OT_stretchto_reset (wmOperatorType *ot) static int limitdistance_reset_exec (bContext *C, wmOperator *op) { Object *ob = ED_object_active_context(C); - bConstraint *con = edit_constraint_property_get(C, op, ob, CONSTRAINT_TYPE_DISTLIMIT); + bConstraint *con = edit_constraint_property_get(op, ob, CONSTRAINT_TYPE_DISTLIMIT); bDistLimitConstraint *data= (con) ? (bDistLimitConstraint *)con->data : NULL; /* despite 3 layers of checks, we may still not be able to find a constraint */ @@ -605,7 +605,7 @@ static int limitdistance_reset_exec (bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -static int limitdistance_reset_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int limitdistance_reset_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { if (edit_constraint_invoke_properties(C, op)) return limitdistance_reset_exec(C, op); @@ -636,7 +636,7 @@ static int childof_set_inverse_exec (bContext *C, wmOperator *op) { Scene *scene= CTX_data_scene(C); Object *ob = ED_object_active_context(C); - bConstraint *con = edit_constraint_property_get(C, op, ob, CONSTRAINT_TYPE_CHILDOF); + bConstraint *con = edit_constraint_property_get(op, ob, CONSTRAINT_TYPE_CHILDOF); bChildOfConstraint *data= (con) ? (bChildOfConstraint *)con->data : NULL; bPoseChannel *pchan= NULL; @@ -692,7 +692,7 @@ static int childof_set_inverse_exec (bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -static int childof_set_inverse_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int childof_set_inverse_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { if (edit_constraint_invoke_properties(C, op)) return childof_set_inverse_exec(C, op); @@ -720,7 +720,7 @@ void CONSTRAINT_OT_childof_set_inverse (wmOperatorType *ot) static int childof_clear_inverse_exec (bContext *C, wmOperator *op) { Object *ob = ED_object_active_context(C); - bConstraint *con = edit_constraint_property_get(C, op, ob, CONSTRAINT_TYPE_CHILDOF); + bConstraint *con = edit_constraint_property_get(op, ob, CONSTRAINT_TYPE_CHILDOF); bChildOfConstraint *data= (con) ? (bChildOfConstraint *)con->data : NULL; /* simply clear the matrix */ @@ -731,7 +731,7 @@ static int childof_clear_inverse_exec (bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -static int childof_clear_inverse_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int childof_clear_inverse_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { if (edit_constraint_invoke_properties(C, op)) return childof_clear_inverse_exec(C, op); @@ -794,7 +794,7 @@ static int constraint_poll(bContext *C) return (ptr.id.data && ptr.data); } -static int constraint_delete_exec (bContext *C, wmOperator *op) +static int constraint_delete_exec (bContext *C, wmOperator *UNUSED(op)) { PointerRNA ptr= CTX_data_pointer_get_type(C, "constraint", &RNA_Constraint); Object *ob= ptr.id.data; @@ -837,7 +837,7 @@ void CONSTRAINT_OT_delete (wmOperatorType *ot) static int constraint_move_down_exec (bContext *C, wmOperator *op) { Object *ob = ED_object_active_context(C); - bConstraint *con = edit_constraint_property_get(C, op, ob, 0); + bConstraint *con = edit_constraint_property_get(op, ob, 0); if (con && con->next) { ListBase *conlist= get_constraint_lb(ob, con, NULL); @@ -855,7 +855,7 @@ static int constraint_move_down_exec (bContext *C, wmOperator *op) return OPERATOR_CANCELLED; } -static int constraint_move_down_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int constraint_move_down_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { if (edit_constraint_invoke_properties(C, op)) return constraint_move_down_exec(C, op); @@ -885,7 +885,7 @@ void CONSTRAINT_OT_move_down (wmOperatorType *ot) static int constraint_move_up_exec (bContext *C, wmOperator *op) { Object *ob = ED_object_active_context(C); - bConstraint *con = edit_constraint_property_get(C, op, ob, 0); + bConstraint *con = edit_constraint_property_get(op, ob, 0); if (con && con->prev) { ListBase *conlist= get_constraint_lb(ob, con, NULL); @@ -903,7 +903,7 @@ static int constraint_move_up_exec (bContext *C, wmOperator *op) return OPERATOR_CANCELLED; } -static int constraint_move_up_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int constraint_move_up_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { if (edit_constraint_invoke_properties(C, op)) return constraint_move_up_exec(C, op); @@ -932,7 +932,7 @@ void CONSTRAINT_OT_move_up (wmOperatorType *ot) /************************ remove constraint operators *********************/ -static int pose_constraints_clear_exec(bContext *C, wmOperator *op) +static int pose_constraints_clear_exec(bContext *C, wmOperator *UNUSED(op)) { Main *bmain= CTX_data_main(C); Scene *scene= CTX_data_scene(C); @@ -969,7 +969,7 @@ void POSE_OT_constraints_clear(wmOperatorType *ot) } -static int object_constraints_clear_exec(bContext *C, wmOperator *op) +static int object_constraints_clear_exec(bContext *C, wmOperator *UNUSED(op)) { Main *bmain= CTX_data_main(C); Scene *scene= CTX_data_scene(C); @@ -1047,7 +1047,7 @@ void POSE_OT_constraints_copy(wmOperatorType *ot) ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; } -static int object_constraint_copy_exec(bContext *C, wmOperator *op) +static int object_constraint_copy_exec(bContext *C, wmOperator *UNUSED(op)) { Main *bmain= CTX_data_main(C); Scene *scene = CTX_data_scene(C); @@ -1466,7 +1466,7 @@ void POSE_OT_constraint_add_with_targets(wmOperatorType *ot) // TODO: should these be here, or back in editors/armature/poseobject.c again? /* present menu with options + validation for targets to use */ -static int pose_ik_add_invoke(bContext *C, wmOperator *op, wmEvent *evt) +static int pose_ik_add_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(evt)) { Object *ob= ED_object_pose_armature(CTX_data_active_object(C)); bPoseChannel *pchan= get_active_posechannel(ob); @@ -1550,7 +1550,7 @@ void POSE_OT_ik_add(wmOperatorType *ot) /* ------------------ */ /* remove IK constraints from selected bones */ -static int pose_ik_clear_exec(bContext *C, wmOperator *op) +static int pose_ik_clear_exec(bContext *C, wmOperator *UNUSED(op)) { Object *ob= ED_object_pose_armature(CTX_data_active_object(C)); diff --git a/source/blender/editors/object/object_edit.c b/source/blender/editors/object/object_edit.c index b7f05a2e332..32e49ce3f71 100644 --- a/source/blender/editors/object/object_edit.c +++ b/source/blender/editors/object/object_edit.c @@ -97,9 +97,9 @@ #include "object_intern.h" // own include /* ************* XXX **************** */ -static void error(const char *dummy) {} -static void waitcursor(int val) {} -static int pupmenu(const char *msg) {return 0;} +static void error(const char *UNUSED(arg)) {} +static void waitcursor(int UNUSED(val)) {} +static int pupmenu(const char *UNUSED(msg)) {return 0;} /* port over here */ static bContext *C; @@ -120,7 +120,7 @@ Object *ED_object_active_context(bContext *C) /* ********* clear/set restrict view *********/ -static int object_hide_view_clear_exec(bContext *C, wmOperator *op) +static int object_hide_view_clear_exec(bContext *C, wmOperator *UNUSED(op)) { Main *bmain= CTX_data_main(C); ScrArea *sa= CTX_wm_area(C); @@ -219,7 +219,7 @@ void OBJECT_OT_hide_view_set(wmOperatorType *ot) } /* 99% same as above except no need for scene refreshing (TODO, update render preview) */ -static int object_hide_render_clear_exec(bContext *C, wmOperator *op) +static int object_hide_render_clear_exec(bContext *C, wmOperator *UNUSED(op)) { short changed= 0; @@ -433,7 +433,7 @@ void ED_object_enter_editmode(bContext *C, int flag) if(ob->type==OB_MESH) { Mesh *me= ob->data; - if(me->pv) mesh_pmv_off(ob, me); + if(me->pv) mesh_pmv_off(me); ok= 1; scene->obedit= ob; // context sees this @@ -506,7 +506,7 @@ void ED_object_enter_editmode(bContext *C, int flag) if(flag & EM_WAITCURSOR) waitcursor(0); } -static int editmode_toggle_exec(bContext *C, wmOperator *op) +static int editmode_toggle_exec(bContext *C, wmOperator *UNUSED(op)) { if(!CTX_data_edit_object(C)) ED_object_enter_editmode(C, EM_WAITCURSOR); @@ -549,7 +549,7 @@ void OBJECT_OT_editmode_toggle(wmOperatorType *ot) /* *************************** */ -static int posemode_exec(bContext *C, wmOperator *op) +static int posemode_exec(bContext *C, wmOperator *UNUSED(op)) { Base *base= CTX_data_active_base(C); @@ -1525,7 +1525,7 @@ void ED_objects_recalculate_paths(bContext *C, Scene *scene) /* For the object with pose/action: create path curves for selected bones * This recalculates the WHOLE path within the pchan->pathsf and pchan->pathef range */ -static int object_calculate_paths_exec (bContext *C, wmOperator *op) +static int object_calculate_paths_exec (bContext *C, wmOperator *UNUSED(op)) { Scene *scene= CTX_data_scene(C); @@ -1565,7 +1565,7 @@ void OBJECT_OT_paths_calculate (wmOperatorType *ot) /* --------- */ /* for the object with pose/action: clear path curves for selected bones only */ -void ED_objects_clear_paths(bContext *C, Scene *scene) +void ED_objects_clear_paths(bContext *C) { /* loop over objects in scene */ CTX_DATA_BEGIN(C, Object*, ob, selected_editable_objects) @@ -1580,12 +1580,10 @@ void ED_objects_clear_paths(bContext *C, Scene *scene) } /* operator callback for this */ -static int object_clear_paths_exec (bContext *C, wmOperator *op) -{ - Scene *scene= CTX_data_scene(C); - +static int object_clear_paths_exec (bContext *C, wmOperator *UNUSED(op)) +{ /* use the backend function for this */ - ED_objects_clear_paths(C, scene); + ED_objects_clear_paths(C); /* notifiers for updates */ WM_event_add_notifier(C, NC_OBJECT|ND_POSE, NULL); @@ -1838,7 +1836,7 @@ void rand_timeoffs(Scene *scene, View3D *v3d) } -static EnumPropertyItem *object_mode_set_itemsf(bContext *C, PointerRNA *ptr, int *free) +static EnumPropertyItem *object_mode_set_itemsf(bContext *C, PointerRNA *UNUSED(ptr), int *free) { EnumPropertyItem *input = object_mode_items; EnumPropertyItem *item= NULL; @@ -1890,7 +1888,7 @@ static const char *object_mode_op_string(int mode) /* checks the mode to be set is compatible with the object * should be made into a generic function */ -static int object_mode_set_compat(bContext *C, wmOperator *op, Object *ob) +static int object_mode_set_compat(bContext *UNUSED(C), wmOperator *op, Object *ob) { ObjectMode mode = RNA_enum_get(op->ptr, "mode"); @@ -1999,7 +1997,7 @@ void ED_object_toggle_modes(bContext *C, int mode) /************************ Game Properties ***********************/ -static int game_property_new(bContext *C, wmOperator *op) +static int game_property_new(bContext *C, wmOperator *UNUSED(op)) { Object *ob= CTX_data_active_object(C); bProperty *prop; @@ -2082,7 +2080,7 @@ static EnumPropertyItem game_properties_copy_operations[] ={ static EnumPropertyItem gameprops_items[]= { {0, NULL, 0, NULL, NULL}}; -static EnumPropertyItem *gameprops_itemf(bContext *C, PointerRNA *ptr, int *free) +static EnumPropertyItem *gameprops_itemf(bContext *C, PointerRNA *UNUSED(ptr), int *free) { Object *ob= ED_object_active_context(C); EnumPropertyItem tmp = {0, "", 0, "", ""}; @@ -2164,7 +2162,7 @@ void OBJECT_OT_game_property_copy(wmOperatorType *ot) ot->prop=prop; } -static int game_property_clear_exec(bContext *C, wmOperator *op) +static int game_property_clear_exec(bContext *C, wmOperator *UNUSED(op)) { CTX_DATA_BEGIN(C, Object*, ob_iter, selected_editable_objects) { free_properties(&ob_iter->prop); @@ -2190,7 +2188,7 @@ void OBJECT_OT_game_property_clear(wmOperatorType *ot) /************************ Copy Logic Bricks ***********************/ -static int logicbricks_copy_exec(bContext *C, wmOperator *op) +static int logicbricks_copy_exec(bContext *C, wmOperator *UNUSED(op)) { Object *ob=ED_object_active_context(C); diff --git a/source/blender/editors/object/object_group.c b/source/blender/editors/object/object_group.c index f000485466f..99e27d8a286 100644 --- a/source/blender/editors/object/object_group.c +++ b/source/blender/editors/object/object_group.c @@ -149,7 +149,7 @@ void GROUP_OT_objects_remove_active(wmOperatorType *ot) ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; } -static int group_objects_remove_exec(bContext *C, wmOperator *op) +static int group_objects_remove_exec(bContext *C, wmOperator *UNUSED(op)) { Main *bmain= CTX_data_main(C); Scene *scene= CTX_data_scene(C); @@ -224,7 +224,7 @@ void GROUP_OT_create(wmOperatorType *ot) /****************** properties window operators *********************/ -static int group_add_exec(bContext *C, wmOperator *op) +static int group_add_exec(bContext *C, wmOperator *UNUSED(op)) { Scene *scene= CTX_data_scene(C); Object *ob= CTX_data_pointer_get_type(C, "object", &RNA_Object).data; @@ -293,7 +293,7 @@ void OBJECT_OT_group_link(wmOperatorType *ot) ot->prop= prop; } -static int group_remove_exec(bContext *C, wmOperator *op) +static int group_remove_exec(bContext *C, wmOperator *UNUSED(op)) { Scene *scene= CTX_data_scene(C); Object *ob= CTX_data_pointer_get_type(C, "object", &RNA_Object).data; diff --git a/source/blender/editors/object/object_hook.c b/source/blender/editors/object/object_hook.c index 75e22d5356f..3c3e7f1df76 100644 --- a/source/blender/editors/object/object_hook.c +++ b/source/blender/editors/object/object_hook.c @@ -504,7 +504,7 @@ void OBJECT_OT_hook_add_selobj(wmOperatorType *ot) ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; } -static int object_add_hook_newob_exec(bContext *C, wmOperator *op) +static int object_add_hook_newob_exec(bContext *C, wmOperator *UNUSED(op)) { Main *bmain= CTX_data_main(C); Scene *scene= CTX_data_scene(C); @@ -557,7 +557,7 @@ static int object_hook_remove_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -static EnumPropertyItem *hook_mod_itemf(bContext *C, PointerRNA *ptr, int *free) +static EnumPropertyItem *hook_mod_itemf(bContext *C, PointerRNA *UNUSED(ptr), int *free) { Object *ob = CTX_data_edit_object(C); EnumPropertyItem tmp = {0, "", 0, "", ""}; diff --git a/source/blender/editors/object/object_lattice.c b/source/blender/editors/object/object_lattice.c index 9f82a1209cf..708aa38d3ea 100644 --- a/source/blender/editors/object/object_lattice.c +++ b/source/blender/editors/object/object_lattice.c @@ -259,7 +259,7 @@ int make_regular_poll(bContext *C) return (ob && ob->type==OB_LATTICE); } -int make_regular_exec(bContext *C, wmOperator *op) +int make_regular_exec(bContext *C, wmOperator *UNUSED(op)) { Object *ob= CTX_data_edit_object(C); Lattice *lt; diff --git a/source/blender/editors/object/object_modifier.c b/source/blender/editors/object/object_modifier.c index aac5129c6a9..c273b375a06 100644 --- a/source/blender/editors/object/object_modifier.c +++ b/source/blender/editors/object/object_modifier.c @@ -250,7 +250,7 @@ int ED_object_modifier_move_down(ReportList *reports, Object *ob, ModifierData * return 1; } -int ED_object_modifier_convert(ReportList *reports, Main *bmain, Scene *scene, Object *ob, ModifierData *md) +int ED_object_modifier_convert(ReportList *UNUSED(reports), Main *bmain, Scene *scene, Object *ob, ModifierData *md) { Object *obn; ParticleSystem *psys; @@ -365,7 +365,7 @@ static int modifier_apply_shape(ReportList *reports, Scene *scene, Object *ob, M BKE_report(reports, RPT_ERROR, "Only deforming modifiers can be applied to Shapes"); return 0; } - mesh_pmv_off(ob, me); + mesh_pmv_off(me); dm = mesh_create_derived_for_modifier(scene, ob, md); if (!dm) { @@ -413,7 +413,7 @@ static int modifier_apply_obdata(ReportList *reports, Scene *scene, Object *ob, return 0; } - mesh_pmv_off(ob, me); + mesh_pmv_off(me); /* Multires: ensure that recent sculpting is applied */ if(md->type == eModifierType_Multires) @@ -511,7 +511,7 @@ int ED_object_modifier_apply(ReportList *reports, Scene *scene, Object *ob, Modi return 1; } -int ED_object_modifier_copy(ReportList *reports, Object *ob, ModifierData *md) +int ED_object_modifier_copy(ReportList *UNUSED(reports), Object *ob, ModifierData *md) { ModifierData *nmd; @@ -540,7 +540,7 @@ static int modifier_add_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -static EnumPropertyItem *modifier_add_itemf(bContext *C, PointerRNA *ptr, int *free) +static EnumPropertyItem *modifier_add_itemf(bContext *C, PointerRNA *UNUSED(ptr), int *free) { Object *ob= ED_object_active_context(C); EnumPropertyItem *item= NULL, *md_item; @@ -636,7 +636,7 @@ static int edit_modifier_invoke_properties(bContext *C, wmOperator *op) return 0; } -static ModifierData *edit_modifier_property_get(bContext *C, wmOperator *op, Object *ob, int type) +static ModifierData *edit_modifier_property_get(wmOperator *op, Object *ob, int type) { char modifier_name[32]; ModifierData *md; @@ -657,7 +657,7 @@ static int modifier_remove_exec(bContext *C, wmOperator *op) Main *bmain= CTX_data_main(C); Scene *scene= CTX_data_scene(C); Object *ob = ED_object_active_context(C); - ModifierData *md = edit_modifier_property_get(C, op, ob, 0); + ModifierData *md = edit_modifier_property_get(op, ob, 0); if(!ob || !md || !ED_object_modifier_remove(op->reports, bmain, scene, ob, md)) return OPERATOR_CANCELLED; @@ -667,7 +667,7 @@ static int modifier_remove_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -static int modifier_remove_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int modifier_remove_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { if (edit_modifier_invoke_properties(C, op)) return modifier_remove_exec(C, op); @@ -695,7 +695,7 @@ void OBJECT_OT_modifier_remove(wmOperatorType *ot) static int modifier_move_up_exec(bContext *C, wmOperator *op) { Object *ob = ED_object_active_context(C); - ModifierData *md = edit_modifier_property_get(C, op, ob, 0); + ModifierData *md = edit_modifier_property_get(op, ob, 0); if(!ob || !md || !ED_object_modifier_move_up(op->reports, ob, md)) return OPERATOR_CANCELLED; @@ -706,7 +706,7 @@ static int modifier_move_up_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -static int modifier_move_up_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int modifier_move_up_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { if (edit_modifier_invoke_properties(C, op)) return modifier_move_up_exec(C, op); @@ -734,7 +734,7 @@ void OBJECT_OT_modifier_move_up(wmOperatorType *ot) static int modifier_move_down_exec(bContext *C, wmOperator *op) { Object *ob = ED_object_active_context(C); - ModifierData *md = edit_modifier_property_get(C, op, ob, 0); + ModifierData *md = edit_modifier_property_get(op, ob, 0); if(!ob || !md || !ED_object_modifier_move_down(op->reports, ob, md)) return OPERATOR_CANCELLED; @@ -745,7 +745,7 @@ static int modifier_move_down_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -static int modifier_move_down_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int modifier_move_down_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { if (edit_modifier_invoke_properties(C, op)) return modifier_move_down_exec(C, op); @@ -774,7 +774,7 @@ static int modifier_apply_exec(bContext *C, wmOperator *op) { Scene *scene= CTX_data_scene(C); Object *ob = ED_object_active_context(C); - ModifierData *md = edit_modifier_property_get(C, op, ob, 0); + ModifierData *md = edit_modifier_property_get(op, ob, 0); int apply_as= RNA_enum_get(op->ptr, "apply_as"); if(!ob || !md || !ED_object_modifier_apply(op->reports, scene, ob, md, apply_as)) { @@ -787,7 +787,7 @@ static int modifier_apply_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -static int modifier_apply_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int modifier_apply_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { if (edit_modifier_invoke_properties(C, op)) return modifier_apply_exec(C, op); @@ -824,7 +824,7 @@ static int modifier_convert_exec(bContext *C, wmOperator *op) Main *bmain= CTX_data_main(C); Scene *scene= CTX_data_scene(C); Object *ob = ED_object_active_context(C); - ModifierData *md = edit_modifier_property_get(C, op, ob, 0); + ModifierData *md = edit_modifier_property_get(op, ob, 0); if(!ob || !md || !ED_object_modifier_convert(op->reports, bmain, scene, ob, md)) return OPERATOR_CANCELLED; @@ -835,7 +835,7 @@ static int modifier_convert_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -static int modifier_convert_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int modifier_convert_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { if (edit_modifier_invoke_properties(C, op)) return modifier_convert_exec(C, op); @@ -863,7 +863,7 @@ void OBJECT_OT_modifier_convert(wmOperatorType *ot) static int modifier_copy_exec(bContext *C, wmOperator *op) { Object *ob = ED_object_active_context(C); - ModifierData *md = edit_modifier_property_get(C, op, ob, 0); + ModifierData *md = edit_modifier_property_get(op, ob, 0); if(!ob || !md || !ED_object_modifier_copy(op->reports, ob, md)) return OPERATOR_CANCELLED; @@ -874,7 +874,7 @@ static int modifier_copy_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -static int modifier_copy_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int modifier_copy_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { if (edit_modifier_invoke_properties(C, op)) return modifier_copy_exec(C, op); @@ -907,7 +907,7 @@ static int multires_poll(bContext *C) static int multires_higher_levels_delete_exec(bContext *C, wmOperator *op) { Object *ob = ED_object_active_context(C); - MultiresModifierData *mmd = (MultiresModifierData *)edit_modifier_property_get(C, op, ob, eModifierType_Multires); + MultiresModifierData *mmd = (MultiresModifierData *)edit_modifier_property_get(op, ob, eModifierType_Multires); if (!mmd) return OPERATOR_CANCELLED; @@ -919,7 +919,7 @@ static int multires_higher_levels_delete_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -static int multires_higher_levels_delete_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int multires_higher_levels_delete_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { if (edit_modifier_invoke_properties(C, op)) return multires_higher_levels_delete_exec(C, op); @@ -946,7 +946,7 @@ void OBJECT_OT_multires_higher_levels_delete(wmOperatorType *ot) static int multires_subdivide_exec(bContext *C, wmOperator *op) { Object *ob = ED_object_active_context(C); - MultiresModifierData *mmd = (MultiresModifierData *)edit_modifier_property_get(C, op, ob, eModifierType_Multires); + MultiresModifierData *mmd = (MultiresModifierData *)edit_modifier_property_get(op, ob, eModifierType_Multires); if (!mmd) return OPERATOR_CANCELLED; @@ -959,7 +959,7 @@ static int multires_subdivide_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -static int multires_subdivide_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int multires_subdivide_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { if (edit_modifier_invoke_properties(C, op)) return multires_subdivide_exec(C, op); @@ -988,7 +988,7 @@ static int multires_reshape_exec(bContext *C, wmOperator *op) { Object *ob= ED_object_active_context(C), *secondob= NULL; Scene *scene= CTX_data_scene(C); - MultiresModifierData *mmd = (MultiresModifierData *)edit_modifier_property_get(C, op, ob, eModifierType_Multires); + MultiresModifierData *mmd = (MultiresModifierData *)edit_modifier_property_get(op, ob, eModifierType_Multires); if (!mmd) return OPERATOR_CANCELLED; @@ -1017,7 +1017,7 @@ static int multires_reshape_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -static int multires_reshape_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int multires_reshape_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { if (edit_modifier_invoke_properties(C, op)) return multires_reshape_exec(C, op); @@ -1058,7 +1058,7 @@ static int multires_external_save_exec(bContext *C, wmOperator *op) RNA_string_get(op->ptr, "filepath", path); if(relative) - BLI_path_rel(path, G.sce); + BLI_path_rel(path, G.main->name); CustomData_external_add(&me->fdata, &me->id, CD_MDISPS, me->totface, path); CustomData_external_write(&me->fdata, &me->id, CD_MASK_MESH, me->totface, 0); @@ -1066,7 +1066,7 @@ static int multires_external_save_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -static int multires_external_save_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int multires_external_save_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { Object *ob = ED_object_active_context(C); MultiresModifierData *mmd; @@ -1076,7 +1076,7 @@ static int multires_external_save_invoke(bContext *C, wmOperator *op, wmEvent *e if (!edit_modifier_invoke_properties(C, op)) return OPERATOR_CANCELLED; - mmd = (MultiresModifierData *)edit_modifier_property_get(C, op, ob, eModifierType_Multires); + mmd = (MultiresModifierData *)edit_modifier_property_get(op, ob, eModifierType_Multires); if (!mmd) return OPERATOR_CANCELLED; @@ -1120,7 +1120,7 @@ void OBJECT_OT_multires_external_save(wmOperatorType *ot) /****************** multires pack operator *********************/ -static int multires_external_pack_exec(bContext *C, wmOperator *op) +static int multires_external_pack_exec(bContext *C, wmOperator *UNUSED(op)) { Object *ob = ED_object_active_context(C); Mesh *me= ob->data; @@ -1158,7 +1158,7 @@ static int meshdeform_bind_exec(bContext *C, wmOperator *op) { Scene *scene= CTX_data_scene(C); Object *ob = ED_object_active_context(C); - MeshDeformModifierData *mmd = (MeshDeformModifierData *)edit_modifier_property_get(C, op, ob, eModifierType_MeshDeform); + MeshDeformModifierData *mmd = (MeshDeformModifierData *)edit_modifier_property_get(op, ob, eModifierType_MeshDeform); if (!mmd) return OPERATOR_CANCELLED; @@ -1210,7 +1210,7 @@ static int meshdeform_bind_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -static int meshdeform_bind_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int meshdeform_bind_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { if (edit_modifier_invoke_properties(C, op)) return meshdeform_bind_exec(C, op); @@ -1245,7 +1245,7 @@ static int explode_poll(bContext *C) static int explode_refresh_exec(bContext *C, wmOperator *op) { Object *ob = ED_object_active_context(C); - ExplodeModifierData *emd = (ExplodeModifierData *)edit_modifier_property_get(C, op, ob, eModifierType_Explode); + ExplodeModifierData *emd = (ExplodeModifierData *)edit_modifier_property_get(op, ob, eModifierType_Explode); if (!emd) return OPERATOR_CANCELLED; @@ -1258,7 +1258,7 @@ static int explode_refresh_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -static int explode_refresh_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int explode_refresh_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { if (edit_modifier_invoke_properties(C, op)) return explode_refresh_exec(C, op); diff --git a/source/blender/editors/object/object_ops.c b/source/blender/editors/object/object_ops.c index 6e9e8eeb5e5..221d1211930 100644 --- a/source/blender/editors/object/object_ops.c +++ b/source/blender/editors/object/object_ops.c @@ -378,7 +378,7 @@ void ED_keymap_object(wmKeyConfig *keyconf) ED_object_generic_keymap(keyconf, keymap, 2); } -void ED_object_generic_keymap(struct wmKeyConfig *keyconf, struct wmKeyMap *keymap, int do_pet) +void ED_object_generic_keymap(struct wmKeyConfig *UNUSED(keyconf), struct wmKeyMap *keymap, int do_pet) { wmKeyMapItem *kmi; diff --git a/source/blender/editors/object/object_relations.c b/source/blender/editors/object/object_relations.c index 11175958fba..14f88c6d99e 100644 --- a/source/blender/editors/object/object_relations.c +++ b/source/blender/editors/object/object_relations.c @@ -353,7 +353,7 @@ static int make_proxy_exec (bContext *C, wmOperator *op) } /* Generic itemf's for operators that take library args */ -static EnumPropertyItem *proxy_group_object_itemf(bContext *C, PointerRNA *ptr, int *free) +static EnumPropertyItem *proxy_group_object_itemf(bContext *C, PointerRNA *UNUSED(ptr), int *free) { EnumPropertyItem *item= NULL, item_tmp; int totitem= 0; @@ -641,11 +641,11 @@ static int parent_set_exec(bContext *C, wmOperator *op) } else if(pararm && ob->type==OB_MESH && par->type == OB_ARMATURE) { if(partype == PAR_ARMATURE_NAME) - create_vgroups_from_armature(scene, ob, par, ARM_GROUPS_NAME, 0); + create_vgroups_from_armature(op->reports, scene, ob, par, ARM_GROUPS_NAME, 0); else if(partype == PAR_ARMATURE_ENVELOPE) - create_vgroups_from_armature(scene, ob, par, ARM_GROUPS_ENVELOPE, 0); + create_vgroups_from_armature(op->reports, scene, ob, par, ARM_GROUPS_ENVELOPE, 0); else if(partype == PAR_ARMATURE_AUTO) - create_vgroups_from_armature(scene, ob, par, ARM_GROUPS_AUTO, 0); + create_vgroups_from_armature(op->reports, scene, ob, par, ARM_GROUPS_AUTO, 0); /* get corrected inverse */ ob->partype= PAROBJECT; @@ -672,7 +672,7 @@ static int parent_set_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -static int parent_set_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int parent_set_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent *UNUSED(event)) { Object *ob= CTX_data_active_object(C); uiPopupMenu *pup= uiPupMenuBegin(C, "Set Parent To", 0); @@ -779,7 +779,7 @@ void OBJECT_OT_parent_no_inverse_set(wmOperatorType *ot) /************************ Clear Slow Parent Operator *********************/ -static int object_slow_parent_clear_exec(bContext *C, wmOperator *op) +static int object_slow_parent_clear_exec(bContext *C, wmOperator *UNUSED(op)) { Main *bmain= CTX_data_main(C); Scene *scene= CTX_data_scene(C); @@ -821,7 +821,7 @@ void OBJECT_OT_slow_parent_clear(wmOperatorType *ot) /********************** Make Slow Parent Operator *********************/ -static int object_slow_parent_set_exec(bContext *C, wmOperator *op) +static int object_slow_parent_set_exec(bContext *C, wmOperator *UNUSED(op)) { Main *bmain= CTX_data_main(C); Scene *scene= CTX_data_scene(C); @@ -1140,7 +1140,7 @@ void OBJECT_OT_move_to_layer(wmOperatorType *ot) /************************** Link to Scene Operator *****************************/ -void link_to_scene(Main *bmain, unsigned short nr) +void link_to_scene(Main *UNUSED(bmain), unsigned short UNUSED(nr)) { #if 0 Scene *sce= (Scene*) BLI_findlink(&bmain->scene, G.curscreen->scenenr-1); @@ -1344,7 +1344,7 @@ void OBJECT_OT_make_links_data(wmOperatorType *ot) /**************************** Make Single User ********************************/ -static void single_object_users__forwardModifierLinks(void *userData, Object *ob, Object **obpoin) +static void single_object_users__forwardModifierLinks(void *UNUSED(userData), Object *UNUSED(ob), Object **obpoin) { ID_NEW(*obpoin); } @@ -1538,7 +1538,7 @@ void single_obdata_users(Main *bmain, Scene *scene, int flag) } } -void single_ipo_users(Scene *scene, int flag) +void single_ipo_users(Scene *UNUSED(scene), int UNUSED(flag)) { #if 0 // XXX old animation system Object *ob; diff --git a/source/blender/editors/object/object_select.c b/source/blender/editors/object/object_select.c index 20346ab080e..a3c65851d3a 100644 --- a/source/blender/editors/object/object_select.c +++ b/source/blender/editors/object/object_select.c @@ -679,7 +679,7 @@ void OBJECT_OT_select_by_layer(wmOperatorType *ot) /************************** Select Inverse *************************/ -static int object_select_inverse_exec(bContext *C, wmOperator *op) +static int object_select_inverse_exec(bContext *C, wmOperator *UNUSED(op)) { CTX_DATA_BEGIN(C, Base*, base, visible_bases) { if (base->flag & SELECT) diff --git a/source/blender/editors/object/object_shapekey.c b/source/blender/editors/object/object_shapekey.c index 7b1ab933e28..0aefb09ee9e 100644 --- a/source/blender/editors/object/object_shapekey.c +++ b/source/blender/editors/object/object_shapekey.c @@ -53,6 +53,7 @@ #include "BKE_library.h" #include "BKE_main.h" #include "BKE_object.h" +#include "BKE_curve.h" #include "BLO_sys_types.h" // for intptr_t support @@ -100,8 +101,25 @@ static int ED_object_shape_key_remove(bContext *C, Object *ob) BLI_remlink(&key->block, kb); key->totkey--; - if(key->refkey== kb) + if(key->refkey== kb) { key->refkey= key->block.first; + + if(key->refkey) { + /* apply new basis key on original data */ + switch(ob->type) { + case OB_MESH: + key_to_mesh(key->refkey, ob->data); + break; + case OB_CURVE: + case OB_SURF: + key_to_curve(key->refkey, ob->data, BKE_curve_nurbs(ob->data)); + break; + case OB_LATTICE: + key_to_latt(key->refkey, ob->data); + break; + } + } + } if(kb->data) MEM_freeN(kb->data); MEM_freeN(kb); @@ -143,7 +161,7 @@ static int ED_object_shape_key_remove(bContext *C, Object *ob) return 1; } -static int ED_object_shape_key_mirror(bContext *C, Scene *scene, Object *ob) +static int object_shape_key_mirror(bContext *C, Object *ob) { KeyBlock *kb; Key *key; @@ -249,7 +267,7 @@ void OBJECT_OT_shape_key_add(wmOperatorType *ot) RNA_def_boolean(ot->srna, "from_mix", 1, "From Mix", "Create the new shape key from the existing mix of keys."); } -static int shape_key_remove_exec(bContext *C, wmOperator *op) +static int shape_key_remove_exec(bContext *C, wmOperator *UNUSED(op)) { Object *ob= CTX_data_pointer_get_type(C, "object", &RNA_Object).data; @@ -274,7 +292,7 @@ void OBJECT_OT_shape_key_remove(wmOperatorType *ot) ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; } -static int shape_key_clear_exec(bContext *C, wmOperator *op) +static int shape_key_clear_exec(bContext *C, wmOperator *UNUSED(op)) { Object *ob= CTX_data_pointer_get_type(C, "object", &RNA_Object).data; Key *key= ob_get_key(ob); @@ -307,12 +325,11 @@ void OBJECT_OT_shape_key_clear(wmOperatorType *ot) ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; } -static int shape_key_mirror_exec(bContext *C, wmOperator *op) +static int shape_key_mirror_exec(bContext *C, wmOperator *UNUSED(op)) { - Scene *scene= CTX_data_scene(C); Object *ob= CTX_data_pointer_get_type(C, "object", &RNA_Object).data; - if(!ED_object_shape_key_mirror(C, scene, ob)) + if(!object_shape_key_mirror(C, ob)) return OPERATOR_CANCELLED; return OPERATOR_FINISHED; diff --git a/source/blender/editors/object/object_transform.c b/source/blender/editors/object/object_transform.c index d4644847a5c..66c5ab4ec4b 100644 --- a/source/blender/editors/object/object_transform.c +++ b/source/blender/editors/object/object_transform.c @@ -64,7 +64,7 @@ /*************************** Clear Transformation ****************************/ -static int object_location_clear_exec(bContext *C, wmOperator *op) +static int object_location_clear_exec(bContext *C, wmOperator *UNUSED(op)) { Main *bmain = CTX_data_main(C); Scene *scene = CTX_data_scene(C); @@ -125,7 +125,7 @@ void OBJECT_OT_location_clear(wmOperatorType *ot) ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; } -static int object_rotation_clear_exec(bContext *C, wmOperator *op) +static int object_rotation_clear_exec(bContext *C, wmOperator *UNUSED(op)) { Main *bmain= CTX_data_main(C); Scene *scene= CTX_data_scene(C); @@ -270,7 +270,7 @@ void OBJECT_OT_rotation_clear(wmOperatorType *ot) ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; } -static int object_scale_clear_exec(bContext *C, wmOperator *op) +static int object_scale_clear_exec(bContext *C, wmOperator *UNUSED(op)) { Main *bmain= CTX_data_main(C); Scene *scene= CTX_data_scene(C); @@ -336,7 +336,7 @@ void OBJECT_OT_scale_clear(wmOperatorType *ot) ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; } -static int object_origin_clear_exec(bContext *C, wmOperator *op) +static int object_origin_clear_exec(bContext *C, wmOperator *UNUSED(op)) { Main *bmain= CTX_data_main(C); float *v1, *v3, mat[3][3]; @@ -457,8 +457,18 @@ static int apply_objects_internal(bContext *C, ReportList *reports, int apply_lo object_to_mat3(ob, rsmat); else if(apply_scale) object_scale_to_mat3(ob, rsmat); - else if(apply_rot) + else if(apply_rot) { + float tmat[3][3], timat[3][3]; + + /* simple rotation matrix */ object_rot_to_mat3(ob, rsmat); + + /* correct for scale, note mul_m3_m3m3 has swapped args! */ + object_scale_to_mat3(ob, tmat); + invert_m3_m3(timat, tmat); + mul_m3_m3m3(rsmat, timat, rsmat); + mul_m3_m3m3(rsmat, rsmat, tmat); + } else unit_m3(rsmat); @@ -557,7 +567,7 @@ static int apply_objects_internal(bContext *C, ReportList *reports, int apply_lo return OPERATOR_FINISHED; } -static int visual_transform_apply_exec(bContext *C, wmOperator *op) +static int visual_transform_apply_exec(bContext *C, wmOperator *UNUSED(op)) { Scene *scene= CTX_data_scene(C); int change = 0; diff --git a/source/blender/editors/object/object_vgroup.c b/source/blender/editors/object/object_vgroup.c index 76af8feda82..015fab05828 100644 --- a/source/blender/editors/object/object_vgroup.c +++ b/source/blender/editors/object/object_vgroup.c @@ -1438,7 +1438,7 @@ static int vertex_group_poll_edit(bContext *C) return vgroup_object_in_edit_mode(ob); } -static int vertex_group_add_exec(bContext *C, wmOperator *op) +static int vertex_group_add_exec(bContext *C, wmOperator *UNUSED(op)) { Object *ob= CTX_data_pointer_get_type(C, "object", &RNA_Object).data; @@ -1561,7 +1561,7 @@ void OBJECT_OT_vertex_group_remove_from(wmOperatorType *ot) RNA_def_boolean(ot->srna, "all", 0, "All", "Remove from all vertex groups."); } -static int vertex_group_select_exec(bContext *C, wmOperator *op) +static int vertex_group_select_exec(bContext *C, wmOperator *UNUSED(op)) { Object *ob= CTX_data_edit_object(C); @@ -1588,7 +1588,7 @@ void OBJECT_OT_vertex_group_select(wmOperatorType *ot) ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; } -static int vertex_group_deselect_exec(bContext *C, wmOperator *op) +static int vertex_group_deselect_exec(bContext *C, wmOperator *UNUSED(op)) { Object *ob= CTX_data_edit_object(C); @@ -1612,7 +1612,7 @@ void OBJECT_OT_vertex_group_deselect(wmOperatorType *ot) ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; } -static int vertex_group_copy_exec(bContext *C, wmOperator *op) +static int vertex_group_copy_exec(bContext *C, wmOperator *UNUSED(op)) { Object *ob= CTX_data_pointer_get_type(C, "object", &RNA_Object).data; @@ -1671,7 +1671,7 @@ void OBJECT_OT_vertex_group_levels(wmOperatorType *ot) RNA_def_float(ot->srna, "gain", 1.f, 0.f, FLT_MAX, "Gain", "Value to multiply weights by.", 0.0f, 10.f); } -static int vertex_group_normalize_exec(bContext *C, wmOperator *op) +static int vertex_group_normalize_exec(bContext *C, wmOperator *UNUSED(op)) { Object *ob= CTX_data_pointer_get_type(C, "object", &RNA_Object).data; @@ -1760,7 +1760,7 @@ void OBJECT_OT_vertex_group_invert(wmOperatorType *ot) } -static int vertex_group_blend_exec(bContext *C, wmOperator *op) +static int vertex_group_blend_exec(bContext *C, wmOperator *UNUSED(op)) { Object *ob= CTX_data_pointer_get_type(C, "object", &RNA_Object).data; @@ -1860,7 +1860,7 @@ void OBJECT_OT_vertex_group_mirror(wmOperatorType *ot) } -static int vertex_group_copy_to_linked_exec(bContext *C, wmOperator *op) +static int vertex_group_copy_to_linked_exec(bContext *C, wmOperator *UNUSED(op)) { Scene *scene= CTX_data_scene(C); Object *ob= CTX_data_pointer_get_type(C, "object", &RNA_Object).data; @@ -1901,7 +1901,7 @@ void OBJECT_OT_vertex_group_copy_to_linked(wmOperatorType *ot) ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; } -static int vertex_group_copy_to_selected_exec(bContext *C, wmOperator *op) +static int vertex_group_copy_to_selected_exec(bContext *C, wmOperator *UNUSED(op)) { Object *obact= CTX_data_pointer_get_type(C, "object", &RNA_Object).data; @@ -1947,7 +1947,7 @@ static int set_active_group_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -static EnumPropertyItem *vgroup_itemf(bContext *C, PointerRNA *ptr, int *free) +static EnumPropertyItem *vgroup_itemf(bContext *C, PointerRNA *UNUSED(ptr), int *free) { Object *ob= CTX_data_pointer_get_type(C, "object", &RNA_Object).data; EnumPropertyItem tmp = {0, "", 0, "", ""}; diff --git a/source/blender/editors/physics/particle_boids.c b/source/blender/editors/physics/particle_boids.c index a18890881a8..0ba76bbe34c 100644 --- a/source/blender/editors/physics/particle_boids.c +++ b/source/blender/editors/physics/particle_boids.c @@ -98,7 +98,7 @@ void BOID_OT_rule_add(wmOperatorType *ot) ot->prop= RNA_def_enum(ot->srna, "type", boidrule_type_items, 0, "Type", ""); } -static int rule_del_exec(bContext *C, wmOperator *op) +static int rule_del_exec(bContext *C, wmOperator *UNUSED(op)) { Main *bmain = CTX_data_main(C); Scene *scene = CTX_data_scene(C); @@ -149,7 +149,7 @@ void BOID_OT_rule_del(wmOperatorType *ot) } /************************ move up/down boid rule operators *********************/ -static int rule_move_up_exec(bContext *C, wmOperator *op) +static int rule_move_up_exec(bContext *C, wmOperator *UNUSED(op)) { PointerRNA ptr = CTX_data_pointer_get_type(C, "particle_system", &RNA_ParticleSystem); ParticleSystem *psys= ptr.data; @@ -187,7 +187,7 @@ void BOID_OT_rule_move_up(wmOperatorType *ot) ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; } -static int rule_move_down_exec(bContext *C, wmOperator *op) +static int rule_move_down_exec(bContext *C, wmOperator *UNUSED(op)) { PointerRNA ptr = CTX_data_pointer_get_type(C, "particle_system", &RNA_ParticleSystem); ParticleSystem *psys= ptr.data; @@ -227,7 +227,7 @@ void BOID_OT_rule_move_down(wmOperatorType *ot) /************************ add/del boid state operators *********************/ -static int state_add_exec(bContext *C, wmOperator *op) +static int state_add_exec(bContext *C, wmOperator *UNUSED(op)) { PointerRNA ptr = CTX_data_pointer_get_type(C, "particle_system", &RNA_ParticleSystem); ParticleSystem *psys= ptr.data; @@ -266,7 +266,7 @@ void BOID_OT_state_add(wmOperatorType *ot) /* flags */ ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; } -static int state_del_exec(bContext *C, wmOperator *op) +static int state_del_exec(bContext *C, wmOperator *UNUSED(op)) { Main *bmain = CTX_data_main(C); Scene *scene = CTX_data_scene(C); @@ -322,7 +322,7 @@ void BOID_OT_state_del(wmOperatorType *ot) } /************************ move up/down boid state operators *********************/ -static int state_move_up_exec(bContext *C, wmOperator *op) +static int state_move_up_exec(bContext *C, wmOperator *UNUSED(op)) { PointerRNA ptr = CTX_data_pointer_get_type(C, "particle_system", &RNA_ParticleSystem); ParticleSystem *psys= ptr.data; @@ -359,7 +359,7 @@ void BOID_OT_state_move_up(wmOperatorType *ot) ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; } -static int state_move_down_exec(bContext *C, wmOperator *op) +static int state_move_down_exec(bContext *C, wmOperator *UNUSED(op)) { PointerRNA ptr = CTX_data_pointer_get_type(C, "particle_system", &RNA_ParticleSystem); ParticleSystem *psys= ptr.data; diff --git a/source/blender/editors/physics/particle_edit.c b/source/blender/editors/physics/particle_edit.c index 132533fc123..57867fdc441 100644 --- a/source/blender/editors/physics/particle_edit.c +++ b/source/blender/editors/physics/particle_edit.c @@ -1125,7 +1125,7 @@ static void update_world_cos(Object *ob, PTCacheEdit *edit) } } } -static void update_velocities(Object *ob, PTCacheEdit *edit) +static void update_velocities(PTCacheEdit *edit) { /*TODO: get frs_sec properly */ float vec1[3], vec2[3], frs_sec, dfra; @@ -1208,7 +1208,7 @@ void PE_update_object(Scene *scene, Object *ob, int useflag) if(edit->psys) update_world_cos(ob, edit); if(pset->flag & PE_AUTO_VELOCITY) - update_velocities(ob, edit); + update_velocities(edit); PE_hide_keys_time(scene, edit, CFRA); /* regenerate path caches */ @@ -1243,7 +1243,7 @@ static void select_key(PEData *data, int point_index, int key_index) point->flag |= PEP_EDIT_RECALC; } -static void select_keys(PEData *data, int point_index, int key_index) +static void select_keys(PEData *data, int point_index, int UNUSED(key_index)) { PTCacheEdit *edit = data->edit; PTCacheEditPoint *point = edit->points + point_index; @@ -1387,7 +1387,7 @@ static void select_root(PEData *data, int point_index) data->edit->points[point_index].flag |= PEP_EDIT_RECALC; /* redraw selection only */ } -static int select_roots_exec(bContext *C, wmOperator *op) +static int select_roots_exec(bContext *C, wmOperator *UNUSED(op)) { PEData data; @@ -1427,7 +1427,7 @@ static void select_tip(PEData *data, int point_index) point->flag |= PEP_EDIT_RECALC; /* redraw selection only */ } -static int select_tips_exec(bContext *C, wmOperator *op) +static int select_tips_exec(bContext *C, wmOperator *UNUSED(op)) { PEData data; @@ -1690,7 +1690,7 @@ void PARTICLE_OT_hide(wmOperatorType *ot) /*************************** reveal operator **************************/ -static int reveal_exec(bContext *C, wmOperator *op) +static int reveal_exec(bContext *C, wmOperator *UNUSED(op)) { Object *ob= CTX_data_active_object(C); Scene *scene= CTX_data_scene(C); @@ -1758,7 +1758,7 @@ static void select_less_keys(PEData *data, int point_index) } } -static int select_less_exec(bContext *C, wmOperator *op) +static int select_less_exec(bContext *C, wmOperator *UNUSED(op)) { PEData data; @@ -1819,7 +1819,7 @@ static void select_more_keys(PEData *data, int point_index) } } -static int select_more_exec(bContext *C, wmOperator *op) +static int select_more_exec(bContext *C, wmOperator *UNUSED(op)) { PEData data; @@ -1846,7 +1846,7 @@ void PARTICLE_OT_select_more(wmOperatorType *ot) ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; } -static int select_inverse_exec(bContext *C, wmOperator *op) +static int select_inverse_exec(bContext *C, wmOperator *UNUSED(op)) { PEData data; PTCacheEdit *edit; @@ -2022,7 +2022,7 @@ static void rekey_particle_to_time(Scene *scene, Object *ob, int pa_index, float /************************* utilities **************************/ -static int remove_tagged_particles(Scene *scene, Object *ob, ParticleSystem *psys, int mirror) +static int remove_tagged_particles(Object *ob, ParticleSystem *psys, int mirror) { PTCacheEdit *edit = psys->edit; ParticleData *pa, *npa=0, *new_pars=0; @@ -2092,7 +2092,7 @@ static int remove_tagged_particles(Scene *scene, Object *ob, ParticleSystem *psy return removed; } -static void remove_tagged_keys(Scene *scene, Object *ob, ParticleSystem *psys) +static void remove_tagged_keys(Object *ob, ParticleSystem *psys) { PTCacheEdit *edit= psys->edit; ParticleData *pa; @@ -2123,7 +2123,7 @@ static void remove_tagged_keys(Scene *scene, Object *ob, ParticleSystem *psys) if(new_totkey < 2) point->flag |= PEP_TAG; } - remove_tagged_particles(scene, ob, psys, pe_x_mirror(ob)); + remove_tagged_particles(ob, psys, pe_x_mirror(ob)); LOOP_POINTS { pa = psys->particles + p; @@ -2260,7 +2260,7 @@ static void subdivide_particle(PEData *data, int pa_index) pa->flag &= ~PARS_REKEY; } -static int subdivide_exec(bContext *C, wmOperator *op) +static int subdivide_exec(bContext *C, wmOperator *UNUSED(op)) { PEData data; @@ -2347,7 +2347,7 @@ static int remove_doubles_exec(bContext *C, wmOperator *op) BLI_kdtree_free(tree); /* remove tagged particles - don't do mirror here! */ - remove_tagged_particles(scene, ob, psys, 0); + remove_tagged_particles(ob, psys, 0); totremoved += removed; } while(removed); @@ -2430,7 +2430,7 @@ void PARTICLE_OT_weight_set(wmOperatorType *ot) /************************ cursor drawing *******************************/ -static void brush_drawcursor(bContext *C, int x, int y, void *customdata) +static void brush_drawcursor(bContext *C, int x, int y, void *UNUSED(customdata)) { ParticleEditSettings *pset= PE_settings(CTX_data_scene(C)); ParticleBrushData *brush; @@ -2574,12 +2574,12 @@ static int delete_exec(bContext *C, wmOperator *op) if(type == DEL_KEY) { foreach_selected_key(&data, set_delete_particle_key); - remove_tagged_keys(data.scene, data.ob, data.edit->psys); + remove_tagged_keys(data.ob, data.edit->psys); recalc_lengths(data.edit); } else if(type == DEL_PARTICLE) { foreach_selected_point(&data, set_delete_particle); - remove_tagged_particles(data.scene, data.ob, data.edit->psys, pe_x_mirror(data.ob)); + remove_tagged_particles(data.ob, data.edit->psys, pe_x_mirror(data.ob)); recalc_lengths(data.edit); } @@ -2734,7 +2734,7 @@ static void PE_mirror_x(Scene *scene, Object *ob, int tagged) MEM_freeN(mirrorfaces); } -static int mirror_exec(bContext *C, wmOperator *op) +static int mirror_exec(bContext *C, wmOperator *UNUSED(op)) { Scene *scene= CTX_data_scene(C); Object *ob= CTX_data_active_object(C); @@ -2765,7 +2765,7 @@ void PARTICLE_OT_mirror(wmOperatorType *ot) /************************* brush edit callbacks ********************/ -static void brush_comb(PEData *data, float mat[][4], float imat[][4], int point_index, int key_index, PTCacheEditKey *key) +static void brush_comb(PEData *data, float UNUSED(mat[][4]), float imat[][4], int point_index, int key_index, PTCacheEditKey *key) { ParticleEditSettings *pset= PE_settings(data->scene); float cvec[3], fac; @@ -3034,7 +3034,7 @@ static void brush_puff(PEData *data, int point_index) } -static void brush_weight(PEData *data, float mat[][4], float imat[][4], int point_index, int key_index, PTCacheEditKey *key) +static void brush_weight(PEData *data, float UNUSED(mat[][4]), float UNUSED(imat[][4]), int point_index, int key_index, PTCacheEditKey *UNUSED(key)) { /* roots have full weight allways */ if(key_index) { @@ -3048,7 +3048,7 @@ static void brush_weight(PEData *data, float mat[][4], float imat[][4], int poin } } -static void brush_smooth_get(PEData *data, float mat[][4], float imat[][4], int point_index, int key_index, PTCacheEditKey *key) +static void brush_smooth_get(PEData *data, float mat[][4], float UNUSED(imat[][4]), int UNUSED(point_index), int key_index, PTCacheEditKey *key) { if(key_index) { float dvec[3]; @@ -3060,7 +3060,7 @@ static void brush_smooth_get(PEData *data, float mat[][4], float imat[][4], int } } -static void brush_smooth_do(PEData *data, float mat[][4], float imat[][4], int point_index, int key_index, PTCacheEditKey *key) +static void brush_smooth_do(PEData *data, float UNUSED(mat[][4]), float imat[][4], int point_index, int key_index, PTCacheEditKey *key) { float vec[3], dvec[3]; @@ -3401,7 +3401,7 @@ static void brush_edit_apply(bContext *C, wmOperator *op, PointerRNA *itemptr) else foreach_point(&data, brush_cut); - removed= remove_tagged_particles(scene, ob, edit->psys, pe_x_mirror(ob)); + removed= remove_tagged_particles(ob, edit->psys, pe_x_mirror(ob)); if(pset->flag & PE_KEEP_LENGTHS) recalc_lengths(edit); } @@ -3538,7 +3538,7 @@ static void brush_edit_apply(bContext *C, wmOperator *op, PointerRNA *itemptr) pset->flag |= lock_root; } -static void brush_edit_exit(bContext *C, wmOperator *op) +static void brush_edit_exit(wmOperator *op) { BrushEdit *bedit= op->customdata; @@ -3555,7 +3555,7 @@ static int brush_edit_exec(bContext *C, wmOperator *op) } RNA_END; - brush_edit_exit(C, op); + brush_edit_exit(op); return OPERATOR_FINISHED; } @@ -3597,7 +3597,7 @@ static int brush_edit_modal(bContext *C, wmOperator *op, wmEvent *event) case LEFTMOUSE: case MIDDLEMOUSE: case RIGHTMOUSE: // XXX hardcoded - brush_edit_exit(C, op); + brush_edit_exit(op); return OPERATOR_FINISHED; case MOUSEMOVE: brush_edit_apply_event(C, op, event); @@ -3607,9 +3607,9 @@ static int brush_edit_modal(bContext *C, wmOperator *op, wmEvent *event) return OPERATOR_RUNNING_MODAL; } -static int brush_edit_cancel(bContext *C, wmOperator *op) +static int brush_edit_cancel(bContext *UNUSED(C), wmOperator *op) { - brush_edit_exit(C, op); + brush_edit_exit(op); return OPERATOR_CANCELLED; } @@ -4084,7 +4084,7 @@ static int particle_edit_toggle_poll(bContext *C) return (ob->particlesystem.first || modifiers_findByType(ob, eModifierType_Cloth) || modifiers_findByType(ob, eModifierType_Softbody)); } -static int particle_edit_toggle_exec(bContext *C, wmOperator *op) +static int particle_edit_toggle_exec(bContext *C, wmOperator *UNUSED(op)) { Scene *scene= CTX_data_scene(C); Object *ob= CTX_data_active_object(C); @@ -4130,7 +4130,7 @@ void PARTICLE_OT_particle_edit_toggle(wmOperatorType *ot) /************************ set editable operator ************************/ -static int clear_edited_exec(bContext *C, wmOperator *op) +static int clear_edited_exec(bContext *C, wmOperator *UNUSED(op)) { Object *ob= CTX_data_active_object(C); ParticleSystem *psys = psys_get_current(ob); diff --git a/source/blender/editors/physics/particle_object.c b/source/blender/editors/physics/particle_object.c index e364a881601..428d8ce6b82 100644 --- a/source/blender/editors/physics/particle_object.c +++ b/source/blender/editors/physics/particle_object.c @@ -60,7 +60,7 @@ /********************** particle system slot operators *********************/ -static int particle_system_add_exec(bContext *C, wmOperator *op) +static int particle_system_add_exec(bContext *C, wmOperator *UNUSED(op)) { Object *ob= CTX_data_pointer_get_type(C, "object", &RNA_Object).data; Scene *scene = CTX_data_scene(C); @@ -91,7 +91,7 @@ void OBJECT_OT_particle_system_add(wmOperatorType *ot) ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; } -static int particle_system_remove_exec(bContext *C, wmOperator *op) +static int particle_system_remove_exec(bContext *C, wmOperator *UNUSED(op)) { Object *ob= CTX_data_pointer_get_type(C, "object", &RNA_Object).data; Scene *scene = CTX_data_scene(C); @@ -138,7 +138,7 @@ static int psys_poll(bContext *C) return (ptr.data != NULL); } -static int new_particle_settings_exec(bContext *C, wmOperator *op) +static int new_particle_settings_exec(bContext *C, wmOperator *UNUSED(op)) { Scene *scene = CTX_data_scene(C); Main *bmain= CTX_data_main(C); @@ -191,7 +191,7 @@ void PARTICLE_OT_new(wmOperatorType *ot) /********************** keyed particle target operators *********************/ -static int new_particle_target_exec(bContext *C, wmOperator *op) +static int new_particle_target_exec(bContext *C, wmOperator *UNUSED(op)) { Main *bmain = CTX_data_main(C); Scene *scene = CTX_data_scene(C); @@ -237,7 +237,7 @@ void PARTICLE_OT_new_target(wmOperatorType *ot) ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; } -static int remove_particle_target_exec(bContext *C, wmOperator *op) +static int remove_particle_target_exec(bContext *C, wmOperator *UNUSED(op)) { Main *bmain = CTX_data_main(C); Scene *scene = CTX_data_scene(C); @@ -288,7 +288,7 @@ void PARTICLE_OT_target_remove(wmOperatorType *ot) /************************ move up particle target operator *********************/ -static int target_move_up_exec(bContext *C, wmOperator *op) +static int target_move_up_exec(bContext *C, wmOperator *UNUSED(op)) { PointerRNA ptr = CTX_data_pointer_get_type(C, "particle_system", &RNA_ParticleSystem); ParticleSystem *psys= ptr.data; @@ -327,7 +327,7 @@ void PARTICLE_OT_target_move_up(wmOperatorType *ot) /************************ move down particle target operator *********************/ -static int target_move_down_exec(bContext *C, wmOperator *op) +static int target_move_down_exec(bContext *C, wmOperator *UNUSED(op)) { PointerRNA ptr = CTX_data_pointer_get_type(C, "particle_system", &RNA_ParticleSystem); ParticleSystem *psys= ptr.data; @@ -365,7 +365,7 @@ void PARTICLE_OT_target_move_down(wmOperatorType *ot) /************************ move up particle dupliweight operator *********************/ -static int dupliob_move_up_exec(bContext *C, wmOperator *op) +static int dupliob_move_up_exec(bContext *C, wmOperator *UNUSED(op)) { PointerRNA ptr = CTX_data_pointer_get_type(C, "particle_system", &RNA_ParticleSystem); ParticleSystem *psys= ptr.data; @@ -403,7 +403,7 @@ void PARTICLE_OT_dupliob_move_up(wmOperatorType *ot) /********************** particle dupliweight operators *********************/ -static int copy_particle_dupliob_exec(bContext *C, wmOperator *op) +static int copy_particle_dupliob_exec(bContext *C, wmOperator *UNUSED(op)) { PointerRNA ptr = CTX_data_pointer_get_type(C, "particle_system", &RNA_ParticleSystem); ParticleSystem *psys= ptr.data; @@ -442,7 +442,7 @@ void PARTICLE_OT_dupliob_copy(wmOperatorType *ot) ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; } -static int remove_particle_dupliob_exec(bContext *C, wmOperator *op) +static int remove_particle_dupliob_exec(bContext *C, wmOperator *UNUSED(op)) { PointerRNA ptr = CTX_data_pointer_get_type(C, "particle_system", &RNA_ParticleSystem); ParticleSystem *psys= ptr.data; @@ -487,7 +487,7 @@ void PARTICLE_OT_dupliob_remove(wmOperatorType *ot) /************************ move down particle dupliweight operator *********************/ -static int dupliob_move_down_exec(bContext *C, wmOperator *op) +static int dupliob_move_down_exec(bContext *C, wmOperator *UNUSED(op)) { PointerRNA ptr = CTX_data_pointer_get_type(C, "particle_system", &RNA_ParticleSystem); ParticleSystem *psys= ptr.data; diff --git a/source/blender/editors/physics/physics_fluid.c b/source/blender/editors/physics/physics_fluid.c index f411f92d395..b1c373e7a91 100644 --- a/source/blender/editors/physics/physics_fluid.c +++ b/source/blender/editors/physics/physics_fluid.c @@ -342,7 +342,7 @@ static void free_all_fluidobject_channels(ListBase *fobjects) } } -static void fluid_init_all_channels(bContext *C, Object *fsDomain, FluidsimSettings *domainSettings, FluidAnimChannels *channels, ListBase *fobjects) +static void fluid_init_all_channels(bContext *C, Object *UNUSED(fsDomain), FluidsimSettings *domainSettings, FluidAnimChannels *channels, ListBase *fobjects) { Scene *scene = CTX_data_scene(C); Base *base; @@ -639,7 +639,7 @@ static int fluid_init_filepaths(Object *fsDomain, char *targetDir, char *targetF // prepare names... strncpy(targetDir, domainSettings->surfdataPath, FILE_MAXDIR); strncpy(newSurfdataPath, domainSettings->surfdataPath, FILE_MAXDIR); - BLI_path_abs(targetDir, G.sce); // fixed #frame-no + BLI_path_abs(targetDir, G.main->name); // fixed #frame-no strcpy(targetFile, targetDir); strcat(targetFile, suffixConfig); @@ -663,7 +663,7 @@ 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.sce); + strcpy(blendDir, G.main->name); BLI_splitdirstring(blendDir, blendFile); if(strlen(blendFile)>6){ int len = strlen(blendFile); @@ -694,7 +694,7 @@ static int fluid_init_filepaths(Object *fsDomain, char *targetDir, char *targetF if(selection<1) return 0; // 0 from menu, or -1 aborted strcpy(targetDir, newSurfdataPath); strncpy(domainSettings->surfdataPath, newSurfdataPath, FILE_MAXDIR); - BLI_path_abs(targetDir, G.sce); // fixed #frame-no + BLI_path_abs(targetDir, G.main->name); // fixed #frame-no } #endif return outStringsChanged; @@ -720,7 +720,7 @@ static void fluidbake_free(void *customdata) } /* called by fluidbake, only to check job 'stop' value */ -static int fluidbake_breakjob(void *customdata) +static int fluidbake_breakjob(void *UNUSED(customdata)) { //FluidBakeJob *fb= (FluidBakeJob *)customdata; //return *(fb->stop); @@ -1047,7 +1047,7 @@ int fluidsimBake(bContext *C, ReportList *reports, Object *fsDomain) return 1; } -void fluidsimFreeBake(Object *ob) +void fluidsimFreeBake(Object *UNUSED(ob)) { /* not implemented yet */ } @@ -1056,27 +1056,27 @@ void fluidsimFreeBake(Object *ob) /* compile dummy functions for disabled fluid sim */ -FluidsimSettings *fluidsimSettingsNew(Object *srcob) +FluidsimSettings *fluidsimSettingsNew(Object *UNUSED(srcob)) { return NULL; } -void fluidsimSettingsFree(FluidsimSettings *fss) +void fluidsimSettingsFree(FluidsimSettings *UNUSED(fss)) { } -FluidsimSettings* fluidsimSettingsCopy(FluidsimSettings *fss) +FluidsimSettings* fluidsimSettingsCopy(FluidsimSettings *UNUSED(fss)) { return NULL; } /* only compile dummy functions */ -int fluidsimBake(bContext *C, ReportList *reports, Object *ob) +int fluidsimBake(bContext *UNUSED(C), ReportList *UNUSED(reports), Object *UNUSED(ob)) { return 0; } -void fluidsimFreeBake(Object *ob) +void fluidsimFreeBake(Object *UNUSED(ob)) { } diff --git a/source/blender/editors/physics/physics_pointcache.c b/source/blender/editors/physics/physics_pointcache.c index 35f86a49aa7..9e39862cf5d 100644 --- a/source/blender/editors/physics/physics_pointcache.c +++ b/source/blender/editors/physics/physics_pointcache.c @@ -56,7 +56,7 @@ #include "physics_intern.h" -static int cache_break_test(void *cbd) { +static int cache_break_test(void *UNUSED(cbd)) { return G.afbreek==1; } static int ptcache_bake_all_poll(bContext *C) @@ -75,13 +75,13 @@ static int ptcache_poll(bContext *C) return (ptr.data && ptr.id.data); } -void bake_console_progress(void *arg, int nr) +void bake_console_progress(void *UNUSED(arg), int nr) { printf("\rbake: %3i%%", nr); fflush(stdout); } -void bake_console_progress_end(void *arg) +void bake_console_progress_end(void *UNUSED(arg)) { printf("\n"); } @@ -120,7 +120,7 @@ static int ptcache_bake_all_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -static int ptcache_free_bake_all_exec(bContext *C, wmOperator *op) +static int ptcache_free_bake_all_exec(bContext *C, wmOperator *UNUSED(op)) { Scene *scene= CTX_data_scene(C); Base *base; @@ -221,7 +221,7 @@ static int ptcache_bake_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -static int ptcache_free_bake_exec(bContext *C, wmOperator *op) +static int ptcache_free_bake_exec(bContext *C, wmOperator *UNUSED(op)) { PointerRNA ptr= CTX_data_pointer_get_type(C, "point_cache", &RNA_PointCache); PointCache *cache= ptr.data; @@ -241,7 +241,7 @@ static int ptcache_free_bake_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -static int ptcache_bake_from_cache_exec(bContext *C, wmOperator *op) +static int ptcache_bake_from_cache_exec(bContext *C, wmOperator *UNUSED(op)) { PointerRNA ptr= CTX_data_pointer_get_type(C, "point_cache", &RNA_PointCache); PointCache *cache= ptr.data; @@ -295,7 +295,7 @@ void PTCACHE_OT_bake_from_cache(wmOperatorType *ot) ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; } -static int ptcache_add_new_exec(bContext *C, wmOperator *op) +static int ptcache_add_new_exec(bContext *C, wmOperator *UNUSED(op)) { Scene *scene = CTX_data_scene(C); PointerRNA ptr= CTX_data_pointer_get_type(C, "point_cache", &RNA_PointCache); @@ -320,7 +320,7 @@ static int ptcache_add_new_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -static int ptcache_remove_exec(bContext *C, wmOperator *op) +static int ptcache_remove_exec(bContext *C, wmOperator *UNUSED(op)) { PointerRNA ptr= CTX_data_pointer_get_type(C, "point_cache", &RNA_PointCache); Scene *scene= CTX_data_scene(C); diff --git a/source/blender/editors/render/render_internal.c b/source/blender/editors/render/render_internal.c index 083202e5a03..7f34e6fa333 100644 --- a/source/blender/editors/render/render_internal.c +++ b/source/blender/editors/render/render_internal.c @@ -596,7 +596,7 @@ static int render_breakjob(void *rjv) } /* catch esc */ -static int screen_render_modal(bContext *C, wmOperator *op, wmEvent *event) +static int screen_render_modal(bContext *C, wmOperator *UNUSED(op), wmEvent *event) { /* no running blender, remove handler and pass through */ if(0==WM_jobs_test(CTX_wm_manager(C), CTX_data_scene(C))) { @@ -763,7 +763,7 @@ void RENDER_OT_render(wmOperatorType *ot) /* *********************** cancel render viewer *************** */ -static int render_view_cancel_exec(bContext *C, wmOperator *unused) +static int render_view_cancel_exec(bContext *C, wmOperator *UNUSED(unused)) { wmWindow *win= CTX_wm_window(C); ScrArea *sa= CTX_wm_area(C); @@ -810,7 +810,7 @@ void RENDER_OT_view_cancel(struct wmOperatorType *ot) /* *********************** show render viewer *************** */ -static int render_view_show_invoke(bContext *C, wmOperator *unused, wmEvent *event) +static int render_view_show_invoke(bContext *C, wmOperator *UNUSED(unused), wmEvent *event) { ScrArea *sa= find_area_showing_r_result(C); diff --git a/source/blender/editors/render/render_preview.c b/source/blender/editors/render/render_preview.c index 71bee8c5b08..0e8587e4642 100644 --- a/source/blender/editors/render/render_preview.c +++ b/source/blender/editors/render/render_preview.c @@ -111,7 +111,7 @@ ImBuf* get_brush_icon(Brush *brush) // first use the path directly to try and load the file BLI_strncpy(path, brush->icon_filepath, sizeof(brush->icon_filepath)); - BLI_path_abs(path, G.sce); + BLI_path_abs(path, G.main->name); brush->icon_imbuf= IMB_loadiffname(path, flags); @@ -121,7 +121,7 @@ ImBuf* get_brush_icon(Brush *brush) path[0]= 0; - BLI_make_file_string(G.sce, path, folder, brush->icon_filepath); + BLI_make_file_string(G.main->name, path, folder, brush->icon_filepath); if (path[0]) brush->icon_imbuf= IMB_loadiffname(path, flags); @@ -190,7 +190,7 @@ void draw_tex_crop(Tex *tex) } /* temporal abuse; if id_code is -1 it only does texture.... solve! */ -void BIF_preview_changed(short id_code) +void BIF_preview_changed(short UNUSED(id_code)) { #if 0 ScrArea *sa; @@ -571,7 +571,7 @@ void ED_preview_draw(const bContext *C, void *idp, void *parentp, void *slotp, r /* ******************************** Icon Preview **************************** */ -void ED_preview_icon_draw(const bContext *C, void *idp, void *arg1, void *arg2, rcti *rect) +void ED_preview_icon_draw(const bContext *UNUSED(C), void *UNUSED(idp), void *UNUSED(arg1), void *UNUSED(arg2), rcti *UNUSED(rect)) { } @@ -603,7 +603,7 @@ void view3d_previewrender_progress(RenderResult *rr, volatile rcti *renrect) } -void BIF_view3d_previewrender_signal(ScrArea *sa, short signal) +void BIF_view3d_previewrender_signal(ScrArea *UNUSED(sa), short UNUSED(signal)) { #if 0 View3D *v3d= sa->spacedata.first; @@ -625,7 +625,7 @@ void BIF_view3d_previewrender_signal(ScrArea *sa, short signal) #endif } -void BIF_view3d_previewrender_free(View3D *v3d) +void BIF_view3d_previewrender_free(View3D *UNUSED(v3d)) { #if 0 if(v3d->ri) { @@ -683,7 +683,7 @@ static int view3d_previewrender_get_rects(ScrArea *sa, rctf *viewplane, RenderIn } /* called before a panel gets moved/scaled, makes sure we can see through */ -void BIF_view3d_previewrender_clear(ScrArea *sa) +void BIF_view3d_previewrender_clear(ScrArea *UNUSED(sa)) { #if 0 View3D *v3d= sa->spacedata.first; @@ -844,7 +844,7 @@ void BIF_view3d_previewrender(Main *bmain, Scene *scene, ScrArea *sa) } /* in panel space! */ -static void view3d_previewdraw_rect(ScrArea *sa, uiBlock *block, RenderInfo *ri) +static void view3d_previewdraw_rect(ScrArea *UNUSED(sa), uiBlock *UNUSED(block), RenderInfo *ri) { // rctf dispf; @@ -887,7 +887,7 @@ void BIF_view3d_previewdraw(struct ScrArea *sa, struct uiBlock *block) /* **************************** new shader preview system ****************** */ /* inside thread, called by renderer, sets job update value */ -static void shader_preview_draw(void *spv, RenderResult *rr, volatile struct rcti *rect) +static void shader_preview_draw(void *spv, RenderResult *UNUSED(rr), volatile struct rcti *UNUSED(rect)) { ShaderPreview *sp= spv; @@ -903,7 +903,7 @@ static int shader_preview_break(void *spv) } /* outside thread, called before redraw notifiers, it moves finished preview over */ -static void shader_preview_updatejob(void *spv) +static void shader_preview_updatejob(void *UNUSED(spv)) { // ShaderPreview *sp= spv; @@ -1141,7 +1141,7 @@ static void icon_preview_startjob(void *customdata, short *stop, short *do_updat /* use same function for icon & shader, so the job manager does not run two of them at the same time. */ -static void common_preview_startjob(void *customdata, short *stop, short *do_update, float *progress) +static void common_preview_startjob(void *customdata, short *stop, short *do_update, float *UNUSED(progress)) { ShaderPreview *sp= customdata; diff --git a/source/blender/editors/render/render_shading.c b/source/blender/editors/render/render_shading.c index af09ddd8858..e56d8fc1124 100644 --- a/source/blender/editors/render/render_shading.c +++ b/source/blender/editors/render/render_shading.c @@ -120,7 +120,7 @@ static int nodes_use_tex(bNodeTree *ntree, Tex *tex) return 0; } -static void material_changed(Main *bmain, Material *ma) +static void material_changed(Main *UNUSED(bmain), Material *ma) { /* icons */ BKE_icon_changed(BKE_icon_getid(&ma->id)); @@ -212,7 +212,7 @@ static void image_changed(Main *bmain, Image *ima) texture_changed(bmain, tex); } -static void scene_changed(Main *bmain, Scene *sce) +static void scene_changed(Main *bmain, Scene *UNUSED(scene)) { Object *ob; Material *ma; @@ -258,7 +258,7 @@ void ED_render_id_flush_update(Main *bmain, ID *id) /********************** material slot operators *********************/ -static int material_slot_add_exec(bContext *C, wmOperator *op) +static int material_slot_add_exec(bContext *C, wmOperator *UNUSED(op)) { Object *ob= CTX_data_pointer_get_type(C, "object", &RNA_Object).data; @@ -293,6 +293,12 @@ static int material_slot_remove_exec(bContext *C, wmOperator *op) if(!ob) return OPERATOR_CANCELLED; + /* Removing material slots in edit mode screws things up, see bug #21822.*/ + if(ob == CTX_data_edit_object(C)) { + BKE_report(op->reports, RPT_ERROR, "Unable to remove material slot in edit mode."); + return OPERATOR_CANCELLED; + } + object_remove_material_slot(ob); WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, ob); WM_event_add_notifier(C, NC_OBJECT|ND_OB_SHADING, ob); @@ -314,7 +320,7 @@ void OBJECT_OT_material_slot_remove(wmOperatorType *ot) ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; } -static int material_slot_assign_exec(bContext *C, wmOperator *op) +static int material_slot_assign_exec(bContext *C, wmOperator *UNUSED(op)) { Object *ob= CTX_data_pointer_get_type(C, "object", &RNA_Object).data; @@ -438,7 +444,7 @@ static int material_slot_de_select(bContext *C, int select) return OPERATOR_FINISHED; } -static int material_slot_select_exec(bContext *C, wmOperator *op) +static int material_slot_select_exec(bContext *C, wmOperator *UNUSED(op)) { return material_slot_de_select(C, 1); } @@ -457,7 +463,7 @@ void OBJECT_OT_material_slot_select(wmOperatorType *ot) ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; } -static int material_slot_deselect_exec(bContext *C, wmOperator *op) +static int material_slot_deselect_exec(bContext *C, wmOperator *UNUSED(op)) { return material_slot_de_select(C, 0); } @@ -477,7 +483,7 @@ void OBJECT_OT_material_slot_deselect(wmOperatorType *ot) } -static int material_slot_copy_exec(bContext *C, wmOperator *op) +static int material_slot_copy_exec(bContext *C, wmOperator *UNUSED(op)) { Object *ob= CTX_data_pointer_get_type(C, "object", &RNA_Object).data; Material ***matar; @@ -518,7 +524,7 @@ void OBJECT_OT_material_slot_copy(wmOperatorType *ot) /********************** new material operator *********************/ -static int new_material_exec(bContext *C, wmOperator *op) +static int new_material_exec(bContext *C, wmOperator *UNUSED(op)) { Material *ma= CTX_data_pointer_get_type(C, "material", &RNA_Material).data; PointerRNA ptr, idptr; @@ -564,7 +570,7 @@ void MATERIAL_OT_new(wmOperatorType *ot) /********************** new texture operator *********************/ -static int new_texture_exec(bContext *C, wmOperator *op) +static int new_texture_exec(bContext *C, wmOperator *UNUSED(op)) { Tex *tex= CTX_data_pointer_get_type(C, "texture", &RNA_Texture).data; PointerRNA ptr, idptr; @@ -610,7 +616,7 @@ void TEXTURE_OT_new(wmOperatorType *ot) /********************** new world operator *********************/ -static int new_world_exec(bContext *C, wmOperator *op) +static int new_world_exec(bContext *C, wmOperator *UNUSED(op)) { World *wo= CTX_data_pointer_get_type(C, "world", &RNA_World).data; PointerRNA ptr, idptr; @@ -656,7 +662,7 @@ void WORLD_OT_new(wmOperatorType *ot) /********************** render layer operators *********************/ -static int render_layer_add_exec(bContext *C, wmOperator *op) +static int render_layer_add_exec(bContext *C, wmOperator *UNUSED(op)) { Scene *scene= CTX_data_scene(C); @@ -682,7 +688,7 @@ void SCENE_OT_render_layer_add(wmOperatorType *ot) ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; } -static int render_layer_remove_exec(bContext *C, wmOperator *op) +static int render_layer_remove_exec(bContext *C, wmOperator *UNUSED(op)) { Scene *scene= CTX_data_scene(C); SceneRenderLayer *rl; @@ -1321,7 +1327,7 @@ static int save_envmap(wmOperator *op, Scene *scene, EnvMap *env, char *str, int dx= env->cube[1]->x; if (env->type == ENV_CUBE) { - ibuf = IMB_allocImBuf(3*dx, 2*dx, 24, IB_rectfloat, 0); + ibuf = IMB_allocImBuf(3*dx, 2*dx, 24, IB_rectfloat); IMB_rectcpy(ibuf, env->cube[0], 0, 0, 0, 0, dx, dx); IMB_rectcpy(ibuf, env->cube[1], dx, 0, 0, 0, dx, dx); @@ -1331,7 +1337,7 @@ static int save_envmap(wmOperator *op, Scene *scene, EnvMap *env, char *str, int IMB_rectcpy(ibuf, env->cube[5], 2*dx, dx, 0, 0, dx, dx); } else if (env->type == ENV_PLANE) { - ibuf = IMB_allocImBuf(dx, dx, 24, IB_rectfloat, 0); + ibuf = IMB_allocImBuf(dx, dx, 24, IB_rectfloat); IMB_rectcpy(ibuf, env->cube[1], 0, 0, 0, 0, dx, dx); } @@ -1339,7 +1345,7 @@ static int save_envmap(wmOperator *op, Scene *scene, EnvMap *env, char *str, int ibuf->profile = IB_PROFILE_LINEAR_RGB; /* to save, we first get absolute path */ - BLI_path_abs(str, G.sce); + BLI_path_abs(str, G.main->name); if (BKE_write_ibuf(scene, ibuf, str, imtype, scene->r.subimtype, scene->r.quality)) { retval = OPERATOR_FINISHED; @@ -1350,7 +1356,7 @@ static int save_envmap(wmOperator *op, Scene *scene, EnvMap *env, char *str, int } /* in case we were saving with relative paths, change back again */ if(relative) - BLI_path_rel(str, G.sce); + BLI_path_rel(str, G.main->name); IMB_freeImBuf(ibuf); ibuf = NULL; @@ -1383,7 +1389,7 @@ static int envmap_save_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -static int envmap_save_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int envmap_save_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { //Scene *scene= CTX_data_scene(C); @@ -1395,7 +1401,7 @@ static int envmap_save_invoke(bContext *C, wmOperator *op, wmEvent *event) //RNA_enum_set(op->ptr, "file_type", scene->r.imtype); - RNA_string_set(op->ptr, "filepath", G.sce); + RNA_string_set(op->ptr, "filepath", G.main->name); WM_event_add_fileselect(C, op); return OPERATOR_RUNNING_MODAL; @@ -1435,7 +1441,7 @@ void TEXTURE_OT_envmap_save(wmOperatorType *ot) WM_operator_properties_filesel(ot, FOLDERFILE|IMAGEFILE|MOVIEFILE, FILE_SPECIAL, FILE_SAVE, WM_FILESEL_FILEPATH|WM_FILESEL_RELPATH); } -static int envmap_clear_exec(bContext *C, wmOperator *op) +static int envmap_clear_exec(bContext *C, wmOperator *UNUSED(op)) { Tex *tex= CTX_data_pointer_get_type(C, "texture", &RNA_Texture).data; @@ -1475,7 +1481,7 @@ void TEXTURE_OT_envmap_clear(wmOperatorType *ot) ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; } -static int envmap_clear_all_exec(bContext *C, wmOperator *op) +static int envmap_clear_all_exec(bContext *C, wmOperator *UNUSED(op)) { Main *bmain = CTX_data_main(C); Tex *tex; @@ -1507,7 +1513,7 @@ void TEXTURE_OT_envmap_clear_all(wmOperatorType *ot) /********************** material operators *********************/ /* material copy/paste */ -static int copy_material_exec(bContext *C, wmOperator *op) +static int copy_material_exec(bContext *C, wmOperator *UNUSED(op)) { Material *ma= CTX_data_pointer_get_type(C, "material", &RNA_Material).data; @@ -1535,7 +1541,7 @@ void MATERIAL_OT_copy(wmOperatorType *ot) ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; } -static int paste_material_exec(bContext *C, wmOperator *op) +static int paste_material_exec(bContext *C, wmOperator *UNUSED(op)) { Material *ma= CTX_data_pointer_get_type(C, "material", &RNA_Material).data; @@ -1635,7 +1641,7 @@ void paste_mtex_copybuf(ID *id) } -static int copy_mtex_exec(bContext *C, wmOperator *op) +static int copy_mtex_exec(bContext *C, wmOperator *UNUSED(op)) { ID *id= CTX_data_pointer_get_type(C, "texture_slot", &RNA_TextureSlot).id.data; @@ -1674,7 +1680,7 @@ void TEXTURE_OT_slot_copy(wmOperatorType *ot) ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; } -static int paste_mtex_exec(bContext *C, wmOperator *op) +static int paste_mtex_exec(bContext *C, wmOperator *UNUSED(op)) { ID *id= CTX_data_pointer_get_type(C, "texture_slot", &RNA_TextureSlot).id.data; diff --git a/source/blender/editors/screen/area.c b/source/blender/editors/screen/area.c index 7f5485ae8b6..ae1388fb7f2 100644 --- a/source/blender/editors/screen/area.c +++ b/source/blender/editors/screen/area.c @@ -144,7 +144,7 @@ void ED_area_do_refresh(bContext *C, ScrArea *sa) /* based on screen region draw tags, set draw tags in azones, and future region tabs etc */ /* only exported for WM */ -void ED_area_overdraw_flush(bContext *C, ScrArea *sa, ARegion *ar) +void ED_area_overdraw_flush(ScrArea *sa, ARegion *ar) { AZone *az; @@ -187,7 +187,7 @@ static void area_draw_azone(short x1, short y1, short x2, short y2) } -static void region_draw_azone(ScrArea *sa, AZone *az) +static void region_draw_azone(AZone *az) { GLUquadricObj *qobj = NULL; short midx = az->x1 + (az->x2 - az->x1)/2; @@ -247,7 +247,7 @@ void ED_area_overdraw(bContext *C) if(az->type==AZONE_AREA) { area_draw_azone(az->x1, az->y1, az->x2, az->y2); } else if(az->type==AZONE_REGION) { - region_draw_azone(sa, az); + region_draw_azone(az); } az->do_draw= 0; @@ -817,7 +817,7 @@ static void area_calc_totrct(ScrArea *sa, int sizex, int sizey) /* used for area initialize below */ -static void region_subwindow(wmWindowManager *wm, wmWindow *win, ARegion *ar) +static void region_subwindow(wmWindow *win, ARegion *ar) { if(ar->flag & (RGN_FLAG_HIDDEN|RGN_FLAG_TOO_SMALL)) { if(ar->swinid) @@ -908,7 +908,7 @@ void ED_area_initialize(wmWindowManager *wm, wmWindow *win, ScrArea *sa) /* region windows, default and own handlers */ for(ar= sa->regionbase.first; ar; ar= ar->next) { - region_subwindow(wm, win, ar); + region_subwindow(win, ar); if(ar->swinid) { /* default region handlers */ @@ -931,7 +931,7 @@ void ED_region_init(bContext *C, ARegion *ar) // ARegionType *at= ar->type; /* refresh can be called before window opened */ - region_subwindow(CTX_wm_manager(C), CTX_wm_window(C), ar); + region_subwindow(CTX_wm_window(C), ar); ar->winx= ar->winrct.xmax - ar->winrct.xmin + 1; ar->winy= ar->winrct.ymax - ar->winrct.ymin + 1; @@ -1156,7 +1156,7 @@ static char *editortype_pup(void) ); } -static void spacefunc(struct bContext *C, void *arg1, void *arg2) +static void spacefunc(struct bContext *C, void *UNUSED(arg1), void *UNUSED(arg2)) { ED_area_newspace(C, CTX_wm_area(C), CTX_wm_area(C)->butspacetype); ED_area_tag_redraw(CTX_wm_area(C)); @@ -1244,7 +1244,7 @@ void ED_region_panels(const bContext *C, ARegion *ar, int vertical, char *contex uiBeginPanels(C, ar); /* set view2d view matrix for scrolling (without scrollers) */ - UI_view2d_view_ortho(C, v2d); + UI_view2d_view_ortho(v2d); for(pt= ar->type->paneltypes.first; pt; pt= pt->next) { /* verify context */ @@ -1365,7 +1365,7 @@ void ED_region_panels(const bContext *C, ARegion *ar, int vertical, char *contex UI_view2d_totRect_set(v2d, x+V2D_SCROLL_WIDTH, y+V2D_SCROLL_HEIGHT); /* set the view */ - UI_view2d_view_ortho(C, v2d); + UI_view2d_view_ortho(v2d); /* this does the actual drawing! */ uiEndPanels(C, ar); @@ -1414,7 +1414,7 @@ void ED_region_header(const bContext *C, ARegion *ar) glClear(GL_COLOR_BUFFER_BIT); /* set view2d view matrix for scrolling (without scrollers) */ - UI_view2d_view_ortho(C, &ar->v2d); + UI_view2d_view_ortho(&ar->v2d); xco= maxco= 8; yco= HEADERY-3; diff --git a/source/blender/editors/screen/glutil.c b/source/blender/editors/screen/glutil.c index 06da91c3e37..a6c4c77e468 100644 --- a/source/blender/editors/screen/glutil.c +++ b/source/blender/editors/screen/glutil.c @@ -527,7 +527,8 @@ void glaDrawPixelsTex(float x, float y, int img_w, int img_h, int format, void * glaDrawPixelsTexScaled(x, y, img_w, img_h, format, rect, 1.0f, 1.0f); } -void glaDrawPixelsSafe_to32(float fx, float fy, int img_w, int img_h, int row_w, float *rectf, int gamma_correct) +/* row_w is unused but kept for completeness */ +void glaDrawPixelsSafe_to32(float fx, float fy, int img_w, int img_h, int UNUSED(row_w), float *rectf, int gamma_correct) { unsigned char *rect32; diff --git a/source/blender/editors/screen/screen_edit.c b/source/blender/editors/screen/screen_edit.c index 32e82571609..9d178a57465 100644 --- a/source/blender/editors/screen/screen_edit.c +++ b/source/blender/editors/screen/screen_edit.c @@ -309,7 +309,7 @@ static void screen_delarea(bContext *C, bScreen *sc, ScrArea *sa) /* return 0: no split possible */ /* else return (integer) screencoordinate split point */ -static short testsplitpoint(wmWindow *win, ScrArea *sa, char dir, float fac) +static short testsplitpoint(ScrArea *sa, char dir, float fac) { short x, y; @@ -345,7 +345,7 @@ static short testsplitpoint(wmWindow *win, ScrArea *sa, char dir, float fac) } } -ScrArea *area_split(wmWindow *win, bScreen *sc, ScrArea *sa, char dir, float fac) +ScrArea *area_split(bScreen *sc, ScrArea *sa, char dir, float fac) { ScrArea *newa=NULL; ScrVert *sv1, *sv2; @@ -353,7 +353,7 @@ ScrArea *area_split(wmWindow *win, bScreen *sc, ScrArea *sa, char dir, float fac if(sa==NULL) return NULL; - split= testsplitpoint(win, sa, dir, fac); + split= testsplitpoint(sa, dir, fac); if(split==0) return NULL; if(dir=='h') { @@ -484,7 +484,7 @@ static void screen_copy(bScreen *to, bScreen *from) /* with sa as center, sb is located at: 0=W, 1=N, 2=E, 3=S */ /* -1 = not valid check */ /* used with join operator */ -int area_getorientation(bScreen *screen, ScrArea *sa, ScrArea *sb) +int area_getorientation(ScrArea *sa, ScrArea *sb) { ScrVert *sav1, *sav2, *sav3, *sav4; ScrVert *sbv1, *sbv2, *sbv3, *sbv4; @@ -523,7 +523,7 @@ int screen_area_join(bContext *C, bScreen* scr, ScrArea *sa1, ScrArea *sa2) { int dir; - dir = area_getorientation(scr, sa1, sa2); + dir = area_getorientation(sa1, sa2); /*printf("dir is : %i \n", dir);*/ if (dir < 0) @@ -861,7 +861,7 @@ static void scrarea_draw_shape_dark(ScrArea *sa, char dir) } /* draw screen area ligher with arrow shape ("eraser" of previous dark shape) */ -static void scrarea_draw_shape_light(ScrArea *sa, char dir) +static void scrarea_draw_shape_light(ScrArea *sa, char UNUSED(dir)) { glBlendFunc(GL_DST_COLOR, GL_SRC_ALPHA); glEnable(GL_BLEND); @@ -993,7 +993,7 @@ void ED_screen_draw(wmWindow *win) /* blended join arrow */ if (sa1 && sa2) { - dir = area_getorientation(win->screen, sa1, sa2); + dir = area_getorientation(sa1, sa2); if (dir >= 0) { switch(dir) { case 0: /* W */ @@ -1613,7 +1613,7 @@ ScrArea *ED_screen_full_toggle(bContext *C, wmWindow *win, ScrArea *sa) oldscreen->animtimer= NULL; /* returns the top small area */ - newa= area_split(win, sc, (ScrArea *)sc->areabase.first, 'h', 0.99f); + newa= area_split(sc, (ScrArea *)sc->areabase.first, 'h', 0.99f); ED_area_newspace(C, newa, SPACE_INFO); /* use random area when we have no active one, e.g. when the @@ -1739,7 +1739,7 @@ void ED_screen_animation_timer_update(bScreen *screen, int redraws, int refresh) } /* results in fully updated anim system */ -void ED_update_for_newframe(const bContext *C, int mute) +void ED_update_for_newframe(const bContext *C, int UNUSED(mute)) { Main *bmain= CTX_data_main(C); bScreen *screen= CTX_wm_screen(C); diff --git a/source/blender/editors/screen/screen_intern.h b/source/blender/editors/screen/screen_intern.h index 79789b1876e..b20daf9a0c8 100644 --- a/source/blender/editors/screen/screen_intern.h +++ b/source/blender/editors/screen/screen_intern.h @@ -37,9 +37,9 @@ void area_copy_data (ScrArea *sa1, ScrArea *sa2, int swap_space); /* screen_edit.c */ ScrEdge *screen_findedge(bScreen *sc, ScrVert *v1, ScrVert *v2); -ScrArea *area_split(wmWindow *win, bScreen *sc, ScrArea *sa, char dir, float fac); +ScrArea *area_split(bScreen *sc, ScrArea *sa, char dir, float fac); int screen_area_join(bContext *C, bScreen* scr, ScrArea *sa1, ScrArea *sa2); -int area_getorientation(bScreen *screen, ScrArea *sa, ScrArea *sb); +int area_getorientation(ScrArea *sa, ScrArea *sb); void select_connected_scredge(bScreen *sc, ScrEdge *edge); void removenotused_scrverts(bScreen *sc); diff --git a/source/blender/editors/screen/screen_ops.c b/source/blender/editors/screen/screen_ops.c index 613c8bc0178..5a6acd24c5f 100644 --- a/source/blender/editors/screen/screen_ops.c +++ b/source/blender/editors/screen/screen_ops.c @@ -262,11 +262,16 @@ int ED_operator_editarmature(bContext *C) int ED_operator_posemode(bContext *C) { Object *obact= CTX_data_active_object(C); - Object *obedit= CTX_data_edit_object(C); - - if ((obact != obedit) && ED_object_pose_armature(obact)) - return 1; - + + if ((obact != CTX_data_edit_object(C))) { + Object *obpose; + if((obpose= ED_object_pose_armature(obact))) { + if((obact == obpose) || (obact->mode & OB_MODE_WEIGHT_PAINT)) { + return 1; + } + } + } + return 0; } @@ -438,7 +443,7 @@ AZone *is_in_area_actionzone(ScrArea *sa, int x, int y) } -static void actionzone_exit(bContext *C, wmOperator *op) +static void actionzone_exit(wmOperator *op) { if(op->customdata) MEM_freeN(op->customdata); @@ -484,7 +489,7 @@ static int actionzone_invoke(bContext *C, wmOperator *op, wmEvent *event) /* region azone directly reacts on mouse clicks */ if(sad->az->type==AZONE_REGION) { actionzone_apply(C, op, AZONE_REGION); - actionzone_exit(C, op); + actionzone_exit(op); return OPERATOR_FINISHED; } else { @@ -524,16 +529,16 @@ static int actionzone_modal(bContext *C, wmOperator *op, wmEvent *event) sad->sa2= screen_areahascursor(CTX_wm_screen(C), event->x, event->y); /* apply sends event */ actionzone_apply(C, op, sad->az->type); - actionzone_exit(C, op); + actionzone_exit(op); return OPERATOR_FINISHED; } break; case ESCKEY: - actionzone_exit(C, op); + actionzone_exit(op); return OPERATOR_CANCELLED; case LEFTMOUSE: - actionzone_exit(C, op); + actionzone_exit(op); return OPERATOR_CANCELLED; } @@ -584,7 +589,7 @@ typedef struct sAreaSwapData { ScrArea *sa1, *sa2; } sAreaSwapData; -static int area_swap_init(bContext *C, wmOperator *op, wmEvent *event) +static int area_swap_init(wmOperator *op, wmEvent *event) { sAreaSwapData *sd= NULL; sActionzoneData *sad= event->customdata; @@ -618,7 +623,7 @@ static int area_swap_cancel(bContext *C, wmOperator *op) static int area_swap_invoke(bContext *C, wmOperator *op, wmEvent *event) { - if(!area_swap_init(C, op, event)) + if(!area_swap_init(op, event)) return OPERATOR_PASS_THROUGH; /* add modal handler */ @@ -704,7 +709,7 @@ static int area_dupli_invoke(bContext *C, wmOperator *op, wmEvent *event) /* poll() checks area context, but we don't accept full-area windows */ if(sc->full != SCREENNORMAL) { if(event->type==EVT_ACTIONZONE_AREA) - actionzone_exit(C, op); + actionzone_exit(op); return OPERATOR_CANCELLED; } @@ -726,7 +731,7 @@ static int area_dupli_invoke(bContext *C, wmOperator *op, wmEvent *event) WM_event_add_notifier(C, NC_SCREEN|NA_EDITED, NULL); if(event->type==EVT_ACTIONZONE_AREA) - actionzone_exit(C, op); + actionzone_exit(op); return OPERATOR_FINISHED; } @@ -1120,7 +1125,7 @@ static int area_split_apply(bContext *C, wmOperator *op) fac= RNA_float_get(op->ptr, "factor"); dir= RNA_enum_get(op->ptr, "direction"); - sd->narea= area_split(CTX_wm_window(C), sc, sd->sarea, dir, fac); + sd->narea= area_split(sc, sd->sarea, dir, fac); if(sd->narea) { ScrVert *sv; @@ -1553,15 +1558,32 @@ static void SCREEN_OT_frame_offset(wmOperatorType *ot) static int frame_jump_exec(bContext *C, wmOperator *op) { Scene *scene= CTX_data_scene(C); - - if (RNA_boolean_get(op->ptr, "end")) - CFRA= PEFRA; - else - CFRA= PSFRA; - - sound_seek_scene(C); + wmTimer *animtimer= CTX_wm_screen(C)->animtimer; - WM_event_add_notifier(C, NC_SCENE|ND_FRAME, scene); + /* Don't change CFRA directly if animtimer is running as this can cause + * first/last frame not to be actually shown (bad since for example physics + * simulations aren't reset properly). + */ + if(animtimer) { + ScreenAnimData *sad = animtimer->customdata; + + sad->flag |= ANIMPLAY_FLAG_USE_NEXT_FRAME; + + if (RNA_boolean_get(op->ptr, "end")) + sad->nextfra= PEFRA; + else + sad->nextfra= PSFRA; + } + else { + if (RNA_boolean_get(op->ptr, "end")) + CFRA= PEFRA; + else + CFRA= PSFRA; + + sound_seek_scene(C); + + WM_event_add_notifier(C, NC_SCENE|ND_FRAME, scene); + } return OPERATOR_FINISHED; } @@ -1719,7 +1741,7 @@ static void SCREEN_OT_screen_set(wmOperatorType *ot) /* function to be called outside UI context, or for redo */ -static int screen_full_area_exec(bContext *C, wmOperator *op) +static int screen_full_area_exec(bContext *C, wmOperator *UNUSED(op)) { ED_screen_full_toggle(C, CTX_wm_window(C), CTX_wm_area(C)); return OPERATOR_FINISHED; @@ -1926,7 +1948,7 @@ static int area_join_modal(bContext *C, wmOperator *op, wmEvent *event) if (sa) { if (jd->sa1 != sa) { - dir = area_getorientation(sc, jd->sa1, sa); + dir = area_getorientation(jd->sa1, sa); if (dir >= 0) { if (jd->sa2) jd->sa2->flag &= ~AREA_FLAG_DRAWJOINTO; jd->sa2 = sa; @@ -1937,7 +1959,7 @@ static int area_join_modal(bContext *C, wmOperator *op, wmEvent *event) we check if area has common border with the one marked for removal in this case we can swap areas. */ - dir = area_getorientation(sc, sa, jd->sa2); + dir = area_getorientation(sa, jd->sa2); if (dir >= 0) { if (jd->sa1) jd->sa1->flag &= ~AREA_FLAG_DRAWJOINFROM; if (jd->sa2) jd->sa2->flag &= ~AREA_FLAG_DRAWJOINTO; @@ -1963,13 +1985,13 @@ static int area_join_modal(bContext *C, wmOperator *op, wmEvent *event) jd->sa2 = sa; if (jd->sa1) jd->sa1->flag |= AREA_FLAG_DRAWJOINFROM; if (jd->sa2) jd->sa2->flag |= AREA_FLAG_DRAWJOINTO; - dir = area_getorientation(sc, jd->sa1, jd->sa2); + dir = area_getorientation(jd->sa1, jd->sa2); if (dir < 0) { printf("oops, didn't expect that!\n"); } } else { - dir = area_getorientation(sc, jd->sa1, sa); + dir = area_getorientation(jd->sa1, sa); if (dir >= 0) { if (jd->sa2) jd->sa2->flag &= ~AREA_FLAG_DRAWJOINTO; jd->sa2 = sa; @@ -2026,7 +2048,7 @@ static void SCREEN_OT_area_join(wmOperatorType *ot) /* ************** repeat last operator ***************************** */ -static int repeat_last_exec(bContext *C, wmOperator *op) +static int repeat_last_exec(bContext *C, wmOperator *UNUSED(op)) { wmOperator *lastop= CTX_wm_manager(C)->operators.last; @@ -2050,7 +2072,7 @@ static void SCREEN_OT_repeat_last(wmOperatorType *ot) } -static int repeat_history_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int repeat_history_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { wmWindowManager *wm= CTX_wm_manager(C); wmOperator *lastop; @@ -2107,7 +2129,7 @@ static void SCREEN_OT_repeat_history(wmOperatorType *ot) /* ********************** redo operator ***************************** */ -static int redo_last_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int redo_last_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent *UNUSED(event)) { wmWindowManager *wm= CTX_wm_manager(C); wmOperator *lastop; @@ -2235,7 +2257,7 @@ static void SCREEN_OT_region_quadview(wmOperatorType *ot) /* ************** region flip operator ***************************** */ /* flip a region alignment */ -static int region_flip_exec(bContext *C, wmOperator *op) +static int region_flip_exec(bContext *C, wmOperator *UNUSED(op)) { ARegion *ar= CTX_wm_region(C); @@ -2273,7 +2295,7 @@ static void SCREEN_OT_region_flip(wmOperatorType *ot) /* ************** header flip operator ***************************** */ /* flip a header region alignment */ -static int header_flip_exec(bContext *C, wmOperator *op) +static int header_flip_exec(bContext *C, wmOperator *UNUSED(op)) { ARegion *ar= CTX_wm_region(C); @@ -2327,7 +2349,7 @@ static void SCREEN_OT_header_flip(wmOperatorType *ot) /* ************** header tools operator ***************************** */ -static int header_toolbox_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int header_toolbox_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent *UNUSED(event)) { ScrArea *sa= CTX_wm_area(C); ARegion *ar= CTX_wm_region(C); @@ -2441,7 +2463,7 @@ static int match_region_with_redraws(int spacetype, int regiontype, int redraws) return 0; } -static int screen_animation_step(bContext *C, wmOperator *op, wmEvent *event) +static int screen_animation_step(bContext *C, wmOperator *UNUSED(op), wmEvent *event) { bScreen *screen= CTX_wm_screen(C); @@ -2513,6 +2535,13 @@ static int screen_animation_step(bContext *C, wmOperator *op, wmEvent *event) } } } + + /* next frame overriden by user action (pressed jump to first/last frame) */ + if(sad->flag & ANIMPLAY_FLAG_USE_NEXT_FRAME) { + scene->r.cfra = sad->nextfra; + sad->flag &= ~ANIMPLAY_FLAG_USE_NEXT_FRAME; + sad->flag |= ANIMPLAY_FLAG_JUMPED; + } if (sad->flag & ANIMPLAY_FLAG_JUMPED) sound_seek_scene(C); @@ -2643,7 +2672,7 @@ static void SCREEN_OT_animation_play(wmOperatorType *ot) RNA_def_boolean(ot->srna, "sync", 0, "Sync", "Drop frames to maintain framerate"); } -static int screen_animation_cancel_exec(bContext *C, wmOperator *op) +static int screen_animation_cancel_exec(bContext *C, wmOperator *UNUSED(op)) { bScreen *screen= CTX_wm_screen(C); @@ -2771,7 +2800,7 @@ static void SCREEN_OT_back_to_previous(struct wmOperatorType *ot) /* *********** show user pref window ****** */ -static int userpref_show_invoke(bContext *C, wmOperator *unused, wmEvent *event) +static int userpref_show_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent *event) { ScrArea *sa; rcti rect; @@ -2810,7 +2839,7 @@ static void SCREEN_OT_userpref_show(struct wmOperatorType *ot) /********************* new screen operator *********************/ -static int screen_new_exec(bContext *C, wmOperator *op) +static int screen_new_exec(bContext *C, wmOperator *UNUSED(op)) { wmWindow *win= CTX_wm_window(C); bScreen *sc= CTX_wm_screen(C); @@ -2837,7 +2866,7 @@ void SCREEN_OT_new(wmOperatorType *ot) /********************* delete screen operator *********************/ -static int screen_delete_exec(bContext *C, wmOperator *op) +static int screen_delete_exec(bContext *C, wmOperator *UNUSED(op)) { bScreen *sc= CTX_wm_screen(C); @@ -2868,7 +2897,7 @@ static int scene_new_exec(bContext *C, wmOperator *op) Main *bmain= CTX_data_main(C); int type= RNA_enum_get(op->ptr, "type"); - newscene= copy_scene(bmain, scene, type); + newscene= copy_scene(scene, type); /* these can't be handled in blenkernel curently, so do them here */ if(type == SCE_COPY_LINK_DATA) @@ -2908,7 +2937,7 @@ void SCENE_OT_new(wmOperatorType *ot) /********************* delete scene operator *********************/ -static int scene_delete_exec(bContext *C, wmOperator *op) +static int scene_delete_exec(bContext *C, wmOperator *UNUSED(op)) { Scene *scene= CTX_data_scene(C); diff --git a/source/blender/editors/screen/screendump.c b/source/blender/editors/screen/screendump.c index 56efa0a5a83..082c9f2f721 100644 --- a/source/blender/editors/screen/screendump.c +++ b/source/blender/editors/screen/screendump.c @@ -42,6 +42,7 @@ #include "BKE_context.h" #include "BKE_global.h" +#include "BKE_main.h" #include "BKE_image.h" #include "BKE_report.h" #include "BKE_writeavi.h" @@ -77,14 +78,14 @@ static int screenshot_exec(bContext *C, wmOperator *op) RNA_string_get(op->ptr, "filepath", path); strcpy(G.ima, path); - BLI_path_abs(path, G.sce); + BLI_path_abs(path, G.main->name); /* BKE_add_image_extension() checks for if extension was already set */ if(scene->r.scemode & R_EXTENSION) if(strlen(path)<FILE_MAXDIR+FILE_MAXFILE-5) BKE_add_image_extension(path, scene->r.imtype); - ibuf= IMB_allocImBuf(scd->dumpsx, scd->dumpsy, 24, 0, 0); + ibuf= IMB_allocImBuf(scd->dumpsx, scd->dumpsy, 24, 0); ibuf->rect= scd->dumprect; BKE_write_ibuf(scene, ibuf, path, scene->r.imtype, scene->r.subimtype, scene->r.quality); @@ -132,7 +133,7 @@ static unsigned int *screenshot(bContext *C, int *dumpsx, int *dumpsy, int fscre } -static int screenshot_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int screenshot_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { unsigned int *dumprect; int dumpsx, dumpsy; @@ -214,7 +215,7 @@ static void screenshot_updatejob(void *sjv) /* only this runs inside thread */ -static void screenshot_startjob(void *sjv, short *stop, short *do_update, float *progress) +static void screenshot_startjob(void *sjv, short *stop, short *do_update, float *UNUSED(progress)) { ScreenshotJob *sj= sjv; RenderData rd= sj->scene->r; @@ -251,7 +252,7 @@ static void screenshot_startjob(void *sjv, short *stop, short *do_update, float break; } else { - ImBuf *ibuf= IMB_allocImBuf(sj->dumpsx, sj->dumpsy, rd.planes, 0, 0); + ImBuf *ibuf= IMB_allocImBuf(sj->dumpsx, sj->dumpsy, rd.planes, 0); char name[FILE_MAXDIR+FILE_MAXFILE]; int ok; diff --git a/source/blender/editors/sculpt_paint/paint_image.c b/source/blender/editors/sculpt_paint/paint_image.c index 6e921b57d9d..71754c3589a 100644 --- a/source/blender/editors/sculpt_paint/paint_image.c +++ b/source/blender/editors/sculpt_paint/paint_image.c @@ -383,7 +383,7 @@ static void *image_undo_push_tile(Image *ima, ImBuf *ibuf, ImBuf **tmpibuf, int return tile->rect; if (*tmpibuf==NULL) - *tmpibuf = IMB_allocImBuf(IMAPAINT_TILE_SIZE, IMAPAINT_TILE_SIZE, 32, IB_rectfloat|IB_rect, 0); + *tmpibuf = IMB_allocImBuf(IMAPAINT_TILE_SIZE, IMAPAINT_TILE_SIZE, 32, IB_rectfloat|IB_rect); tile= MEM_callocN(sizeof(UndoImageTile), "UndoImageTile"); strcpy(tile->idname, ima->id.name); @@ -410,7 +410,7 @@ static void image_undo_restore(bContext *C, ListBase *lb) UndoImageTile *tile; tmpibuf= IMB_allocImBuf(IMAPAINT_TILE_SIZE, IMAPAINT_TILE_SIZE, 32, - IB_rectfloat|IB_rect, 0); + IB_rectfloat|IB_rect); for(tile=lb->first; tile; tile=tile->next) { /* find image based on name, pointer becomes invalid with global undo */ @@ -473,8 +473,6 @@ static int project_bucket_offset_safe(const ProjPaintState *ps, const float proj } } -#define SIDE_OF_LINE(pa, pb, pp) ((pa[0]-pp[0])*(pb[1]-pp[1]))-((pb[0]-pp[0])*(pa[1]-pp[1])) - /* still use 2D X,Y space but this works for verts transformed by a perspective matrix, using their 4th component as a weight */ static void barycentric_weights_v2_persp(float v1[4], float v2[4], float v3[4], float co[2], float w[3]) { @@ -1689,7 +1687,7 @@ static float Vec2Lenf_nosqrt_other(const float *v1, const float v2_1, const floa /* note, use a squared value so we can use Vec2Lenf_nosqrt * be sure that you have done a bounds check first or this may fail */ /* only give bucket_bounds as an arg because we need it elsewhere */ -static int project_bucket_isect_circle(const int bucket_x, const int bucket_y, const float cent[2], const float radius_squared, rctf *bucket_bounds) +static int project_bucket_isect_circle(const float cent[2], const float radius_squared, rctf *bucket_bounds) { /* Would normally to a simple intersection test, however we know the bounds of these 2 already intersect @@ -1852,7 +1850,7 @@ static void project_bucket_clip_face( { int inside_bucket_flag = 0; int inside_face_flag = 0; - const int flip = ((SIDE_OF_LINE(v1coSS, v2coSS, v3coSS) > 0.0f) != (SIDE_OF_LINE(uv1co, uv2co, uv3co) > 0.0f)); + const int flip = ((line_point_side_v2(v1coSS, v2coSS, v3coSS) > 0.0f) != (line_point_side_v2(uv1co, uv2co, uv3co) > 0.0f)); float bucket_bounds_ss[4][2]; @@ -2134,15 +2132,15 @@ if __name__ == '__main__': /* checks if pt is inside a convex 2D polyline, the polyline must be ordered rotating clockwise - * otherwise it would have to test for mixed (SIDE_OF_LINE > 0.0f) cases */ + * otherwise it would have to test for mixed (line_point_side_v2 > 0.0f) cases */ int IsectPoly2Df(const float pt[2], float uv[][2], const int tot) { int i; - if (SIDE_OF_LINE(uv[tot-1], uv[0], pt) < 0.0f) + if (line_point_side_v2(uv[tot-1], uv[0], pt) < 0.0f) return 0; for (i=1; i<tot; i++) { - if (SIDE_OF_LINE(uv[i-1], uv[i], pt) < 0.0f) + if (line_point_side_v2(uv[i-1], uv[i], pt) < 0.0f) return 0; } @@ -2152,10 +2150,10 @@ int IsectPoly2Df(const float pt[2], float uv[][2], const int tot) static int IsectPoly2Df_twoside(const float pt[2], float uv[][2], const int tot) { int i; - int side = (SIDE_OF_LINE(uv[tot-1], uv[0], pt) > 0.0f); + int side = (line_point_side_v2(uv[tot-1], uv[0], pt) > 0.0f); for (i=1; i<tot; i++) { - if ((SIDE_OF_LINE(uv[i-1], uv[i], pt) > 0.0f) != side) + if ((line_point_side_v2(uv[i-1], uv[i], pt) > 0.0f) != side) return 0; } @@ -2652,7 +2650,7 @@ static void project_bucket_init(const ProjPaintState *ps, const int thread_index * calculated when it might not be needed later, (at the moment at least) * obviously it shouldn't have bugs though */ -static int project_bucket_face_isect(ProjPaintState *ps, float min[2], float max[2], int bucket_x, int bucket_y, int bucket_index, const MFace *mf) +static int project_bucket_face_isect(ProjPaintState *ps, int bucket_x, int bucket_y, const MFace *mf) { /* TODO - replace this with a tricker method that uses sideofline for all screenCoords's edges against the closest bucket corner */ rctf bucket_bounds; @@ -2712,11 +2710,11 @@ static int project_bucket_face_isect(ProjPaintState *ps, float min[2], float max /* Add faces to the bucket but dont initialize its pixels * TODO - when painting occluded, sort the faces on their min-Z and only add faces that faces that are not occluded */ -static void project_paint_delayed_face_init(ProjPaintState *ps, const MFace *mf, const MTFace *tf, const int face_index) +static void project_paint_delayed_face_init(ProjPaintState *ps, const MFace *mf, const int face_index) { float min[2], max[2], *vCoSS; int bucketMin[2], bucketMax[2]; /* for ps->bucketRect indexing */ - int fidx, bucket_x, bucket_y, bucket_index; + int fidx, bucket_x, bucket_y; int has_x_isect = -1, has_isect = 0; /* for early loop exit */ MemArena *arena = ps->arena_mt[0]; /* just use the first thread arena since threading has not started yet */ @@ -2733,10 +2731,8 @@ static void project_paint_delayed_face_init(ProjPaintState *ps, const MFace *mf, for (bucket_y = bucketMin[1]; bucket_y < bucketMax[1]; bucket_y++) { has_x_isect = 0; for (bucket_x = bucketMin[0]; bucket_x < bucketMax[0]; bucket_x++) { - - bucket_index = bucket_x + (bucket_y * ps->buckets_x); - - if (project_bucket_face_isect(ps, min, max, bucket_x, bucket_y, bucket_index, mf)) { + if (project_bucket_face_isect(ps, bucket_x, bucket_y, mf)) { + int bucket_index= bucket_x + (bucket_y * ps->buckets_x); BLI_linklist_prepend_arena( &ps->bucketFaces[ bucket_index ], SET_INT_IN_POINTER(face_index), /* cast to a pointer to shut up the compiler */ @@ -3194,7 +3190,7 @@ static void project_paint_begin(ProjPaintState *ps) } } else { - if (SIDE_OF_LINE(v1coSS, v2coSS, v3coSS) < 0.0f) { + if (line_point_side_v2(v1coSS, v2coSS, v3coSS) < 0.0f) { continue; } @@ -3217,7 +3213,7 @@ static void project_paint_begin(ProjPaintState *ps) if (image_index != -1) { /* Initialize the faces screen pixels */ /* Add this to a list to initialize later */ - project_paint_delayed_face_init(ps, mf, tf, face_index); + project_paint_delayed_face_init(ps, mf, face_index); } } } @@ -3500,7 +3496,7 @@ static int project_bucket_iter_next(ProjPaintState *ps, int *bucket_index, rctf project_bucket_bounds(ps, ps->context_bucket_x, ps->context_bucket_y, bucket_bounds); if ( (ps->source != PROJ_SRC_VIEW) || - project_bucket_isect_circle(ps->context_bucket_x, ps->context_bucket_y, mval, (float)(diameter*diameter), bucket_bounds) + project_bucket_isect_circle(mval, (float)(diameter*diameter), bucket_bounds) ) { *bucket_index = ps->context_bucket_x + (ps->context_bucket_y * ps->buckets_x); ps->context_bucket_x++; @@ -3569,7 +3565,7 @@ static void blend_color_mix_accum(unsigned char *cp, const unsigned char *cp1, c cp[3]= alpha > 255 ? 255 : alpha; } -static void do_projectpaint_clone(ProjPaintState *ps, ProjPixel *projPixel, float *rgba, float alpha, float mask) +static void do_projectpaint_clone(ProjPaintState *ps, ProjPixel *projPixel, float alpha, float mask) { if (ps->is_airbrush==0 && mask < 1.0f) { projPixel->newColor.uint = IMB_blend_color(projPixel->newColor.uint, ((ProjPixelClone*)projPixel)->clonepx.uint, (int)(alpha*255), ps->blend); @@ -3580,7 +3576,7 @@ static void do_projectpaint_clone(ProjPaintState *ps, ProjPixel *projPixel, floa } } -static void do_projectpaint_clone_f(ProjPaintState *ps, ProjPixel *projPixel, float *rgba, float alpha, float mask) +static void do_projectpaint_clone_f(ProjPaintState *ps, ProjPixel *projPixel, float alpha, float mask) { if (ps->is_airbrush==0 && mask < 1.0f) { IMB_blend_color_float(projPixel->newColor.f, projPixel->newColor.f, ((ProjPixelClone *)projPixel)->clonepx.f, alpha, ps->blend); @@ -3597,7 +3593,7 @@ static void do_projectpaint_clone_f(ProjPaintState *ps, ProjPixel *projPixel, fl * accumulation of color greater then 'projPixel->mask' however in the case of smear its not * really that important to be correct as it is with clone and painting */ -static void do_projectpaint_smear(ProjPaintState *ps, ProjPixel *projPixel, float *rgba, float alpha, float mask, MemArena *smearArena, LinkNode **smearPixels, float co[2]) +static void do_projectpaint_smear(ProjPaintState *ps, ProjPixel *projPixel, float alpha, float mask, MemArena *smearArena, LinkNode **smearPixels, float co[2]) { unsigned char rgba_ub[4]; @@ -3608,7 +3604,7 @@ static void do_projectpaint_smear(ProjPaintState *ps, ProjPixel *projPixel, floa BLI_linklist_prepend_arena(smearPixels, (void *)projPixel, smearArena); } -static void do_projectpaint_smear_f(ProjPaintState *ps, ProjPixel *projPixel, float *rgba, float alpha, float mask, MemArena *smearArena, LinkNode **smearPixels_f, float co[2]) +static void do_projectpaint_smear_f(ProjPaintState *ps, ProjPixel *projPixel, float alpha, float mask, MemArena *smearArena, LinkNode **smearPixels_f, float co[2]) { unsigned char rgba_ub[4]; unsigned char rgba_smear[4]; @@ -3757,6 +3753,7 @@ static void *do_projectpaint_thread(void *ph_v) if (falloff > 0.0f) { if (ps->is_texbrush) { + /* note, for clone and smear, we only use the alpha, could be a special function */ brush_sample_tex(ps->brush, projPixel->projCoSS, rgba, thread_index); alpha = rgba[3]; } else { @@ -3808,20 +3805,20 @@ static void *do_projectpaint_thread(void *ph_v) case PAINT_TOOL_CLONE: if (is_floatbuf) { if (((ProjPixelClone *)projPixel)->clonepx.f[3]) { - do_projectpaint_clone_f(ps, projPixel, rgba, alpha, mask); + do_projectpaint_clone_f(ps, projPixel, alpha, mask); /* rgba isnt used for cloning, only alpha */ } } else { if (((ProjPixelClone*)projPixel)->clonepx.ch[3]) { - do_projectpaint_clone(ps, projPixel, rgba, alpha, mask); + do_projectpaint_clone(ps, projPixel, alpha, mask); /* rgba isnt used for cloning, only alpha */ } } break; case PAINT_TOOL_SMEAR: sub_v2_v2v2(co, projPixel->projCoSS, pos_ofs); - if (is_floatbuf) do_projectpaint_smear_f(ps, projPixel, rgba, alpha, mask, smearArena, &smearPixels_f, co); - else do_projectpaint_smear(ps, projPixel, rgba, alpha, mask, smearArena, &smearPixels, co); + if (is_floatbuf) do_projectpaint_smear_f(ps, projPixel, alpha, mask, smearArena, &smearPixels_f, co); + else do_projectpaint_smear(ps, projPixel, alpha, mask, smearArena, &smearPixels, co); break; default: if (is_floatbuf) do_projectpaint_draw_f(ps, projPixel, rgba, alpha, mask); @@ -3861,7 +3858,7 @@ static void *do_projectpaint_thread(void *ph_v) return NULL; } -static int project_paint_op(void *state, ImBuf *ibufb, float *lastpos, float *pos) +static int project_paint_op(void *state, ImBuf *UNUSED(ibufb), float *lastpos, float *pos) { /* First unpack args from the struct */ ProjPaintState *ps = (ProjPaintState *)state; @@ -3928,7 +3925,7 @@ static int project_paint_op(void *state, ImBuf *ibufb, float *lastpos, float *po } -static int project_paint_sub_stroke(ProjPaintState *ps, BrushPainter *painter, int *prevmval_i, int *mval_i, double time, float pressure) +static int project_paint_sub_stroke(ProjPaintState *ps, BrushPainter *painter, int *UNUSED(prevmval_i), int *mval_i, double time, float pressure) { /* Use mouse coords as floats for projection painting */ @@ -4194,7 +4191,7 @@ static ImBuf *imapaint_lift_clone(ImBuf *ibuf, ImBuf *ibufb, int *pos) /* note: allocImbuf returns zero'd memory, so regions outside image will have zero alpha, and hence not be blended onto the image */ int w=ibufb->x, h=ibufb->y, destx=0, desty=0, srcx=pos[0], srcy=pos[1]; - ImBuf *clonebuf= IMB_allocImBuf(w, h, ibufb->depth, ibufb->flags, 0); + ImBuf *clonebuf= IMB_allocImBuf(w, h, ibufb->depth, ibufb->flags); IMB_rectclip(clonebuf, ibuf, &destx, &desty, &srcx, &srcy, &w, &h); IMB_rectblend(clonebuf, ibuf, destx, desty, srcx, srcy, w, h, @@ -4387,7 +4384,7 @@ static int imapaint_paint_stroke(ViewContext *vc, ImagePaintState *s, BrushPaint ibuf= BKE_image_get_ibuf(newimage, s->sima? &s->sima->iuser: NULL); if(ibuf && ibuf->rect) - imapaint_pick_uv(s->scene, s->ob, s->me, newfaceindex, mval, newuv); + imapaint_pick_uv(s->scene, s->ob, newfaceindex, mval, newuv); else { newimage = NULL; newuv[0] = newuv[1] = 0.0f; @@ -4398,8 +4395,8 @@ static int imapaint_paint_stroke(ViewContext *vc, ImagePaintState *s, BrushPaint /* see if stroke is broken, and if so finish painting in old position */ if (s->image) { - imapaint_pick_uv(s->scene, s->ob, s->me, s->faceindex, mval, fwuv); - imapaint_pick_uv(s->scene, s->ob, s->me, newfaceindex, prevmval, bkuv); + imapaint_pick_uv(s->scene, s->ob, s->faceindex, mval, fwuv); + imapaint_pick_uv(s->scene, s->ob, newfaceindex, prevmval, bkuv); if (newimage == s->image) breakstroke= texpaint_break_stroke(s->uv, fwuv, bkuv, newuv); @@ -4410,7 +4407,7 @@ static int imapaint_paint_stroke(ViewContext *vc, ImagePaintState *s, BrushPaint fwuv[0]= fwuv[1]= 0.0f; if (breakstroke) { - imapaint_pick_uv(s->scene, s->ob, s->me, s->faceindex, mval, fwuv); + imapaint_pick_uv(s->scene, s->ob, s->faceindex, mval, fwuv); redraw |= imapaint_paint_sub_stroke(s, painter, s->image, texpaint, fwuv, time, 1, pressure); imapaint_clear_partial_redraw(); @@ -4923,7 +4920,7 @@ static int get_imapaint_zoom(bContext *C, float *zoomx, float *zoomy) /************************ cursor drawing *******************************/ -static void brush_drawcursor(bContext *C, int x, int y, void *customdata) +static void brush_drawcursor(bContext *C, int x, int y, void *UNUSED(customdata)) { Brush *brush= image_paint_brush(C); Paint *paint= paint_get_active(CTX_data_scene(C)); @@ -4989,10 +4986,10 @@ static int paint_radial_control_exec(bContext *C, wmOperator *op) Brush *brush = paint_brush(&CTX_data_scene(C)->toolsettings->imapaint.paint); float zoom; int ret; - char str[256]; + char str[64]; get_imapaint_zoom(C, &zoom, &zoom); ret = brush_radial_control_exec(op, brush, 1.0f / zoom); - WM_radial_control_string(op, str, 256); + WM_radial_control_string(op, str, sizeof(str)); WM_event_add_notifier(C, NC_BRUSH|NA_EDITED, brush); @@ -5087,7 +5084,7 @@ static int grab_clone_modal(bContext *C, wmOperator *op, wmEvent *event) return OPERATOR_RUNNING_MODAL; } -static int grab_clone_cancel(bContext *C, wmOperator *op) +static int grab_clone_cancel(bContext *UNUSED(C), wmOperator *op) { MEM_freeN(op->customdata); return OPERATOR_CANCELLED; @@ -5336,8 +5333,8 @@ static int texture_paint_radial_control_exec(bContext *C, wmOperator *op) { Brush *brush = paint_brush(&CTX_data_scene(C)->toolsettings->imapaint.paint); int ret = brush_radial_control_exec(op, brush, 1); - char str[256]; - WM_radial_control_string(op, str, 256); + char str[64]; + WM_radial_control_string(op, str, sizeof(str)); WM_event_add_notifier(C, NC_BRUSH|NA_EDITED, brush); diff --git a/source/blender/editors/sculpt_paint/paint_intern.h b/source/blender/editors/sculpt_paint/paint_intern.h index 3ed314095ef..6232a8f2de1 100644 --- a/source/blender/editors/sculpt_paint/paint_intern.h +++ b/source/blender/editors/sculpt_paint/paint_intern.h @@ -99,7 +99,7 @@ void PAINT_OT_image_from_view(struct wmOperatorType *ot); /* paint_utils.c */ int imapaint_pick_face(struct ViewContext *vc, struct Mesh *me, int *mval, unsigned int *index); -void imapaint_pick_uv(struct Scene *scene, struct Object *ob, struct Mesh *mesh, unsigned int faceindex, int *xy, float *uv); +void imapaint_pick_uv(struct Scene *scene, struct Object *ob, unsigned int faceindex, int *xy, float *uv); void paint_sample_color(struct Scene *scene, struct ARegion *ar, int x, int y); void BRUSH_OT_curve_preset(struct wmOperatorType *ot); diff --git a/source/blender/editors/sculpt_paint/paint_ops.c b/source/blender/editors/sculpt_paint/paint_ops.c index b5cadb9c484..2e0338b370e 100644 --- a/source/blender/editors/sculpt_paint/paint_ops.c +++ b/source/blender/editors/sculpt_paint/paint_ops.c @@ -42,7 +42,7 @@ //#include <stdio.h> /* Brush operators */ -static int brush_add_exec(bContext *C, wmOperator *op) +static int brush_add_exec(bContext *C, wmOperator *UNUSED(op)) { /*int type = RNA_enum_get(op->ptr, "type");*/ Paint *paint = paint_get_active(CTX_data_scene(C)); @@ -129,7 +129,7 @@ void BRUSH_OT_scale_size(wmOperatorType *ot) RNA_def_float(ot->srna, "scalar", 1, 0, 2, "Scalar", "Factor to scale brush size by", 0, 2); } -static int vertex_color_set_exec(bContext *C, wmOperator *op) +static int vertex_color_set_exec(bContext *C, wmOperator *UNUSED(op)) { Scene *scene = CTX_data_scene(C); Object *obact = CTX_data_active_object(C); @@ -154,7 +154,7 @@ void PAINT_OT_vertex_color_set(wmOperatorType *ot) ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; } -static int brush_reset_exec(bContext *C, wmOperator *op) +static int brush_reset_exec(bContext *C, wmOperator *UNUSED(op)) { Paint *paint = paint_get_active(CTX_data_scene(C)); struct Brush *brush = paint_brush(paint); @@ -290,7 +290,7 @@ static void ed_keymap_paint_brush_switch(wmKeyMap *keymap, const char *path) RNA_int_set(kmi->ptr, "value", 19); } -static void ed_keymap_paint_brush_size(wmKeyMap *keymap, const char *path) +static void ed_keymap_paint_brush_size(wmKeyMap *keymap, const char *UNUSED(path)) { wmKeyMapItem *kmi; diff --git a/source/blender/editors/sculpt_paint/paint_stroke.c b/source/blender/editors/sculpt_paint/paint_stroke.c index 6d58731d79c..ea99844bfac 100644 --- a/source/blender/editors/sculpt_paint/paint_stroke.c +++ b/source/blender/editors/sculpt_paint/paint_stroke.c @@ -253,7 +253,7 @@ static void make_snap(Snapshot* snap, Brush* brush, ViewContext* vc) snap->winy = vc->ar->winy; } -int load_tex(Sculpt *sd, Brush* br, ViewContext* vc) +static int load_tex(Sculpt *sd, Brush* br, ViewContext* vc) { static GLuint overlay_texture = 0; static int init = 0; @@ -268,8 +268,12 @@ int load_tex(Sculpt *sd, Brush* br, ViewContext* vc) int j; int refresh; +#ifndef _OPENMP + (void)sd; /* quied unused warning */ +#endif + if (br->mtex.brush_map_mode == MTEX_MAP_MODE_TILED && !br->mtex.tex) return 0; - + refresh = !overlay_texture || (br->mtex.tex && diff --git a/source/blender/editors/sculpt_paint/paint_undo.c b/source/blender/editors/sculpt_paint/paint_undo.c index c2f82b8e2e0..643e2cd6915 100644 --- a/source/blender/editors/sculpt_paint/paint_undo.c +++ b/source/blender/editors/sculpt_paint/paint_undo.c @@ -31,6 +31,7 @@ #include "BLI_listbase.h" +#include "BKE_utildefines.h" #include "BKE_context.h" #include "BKE_global.h" @@ -62,13 +63,13 @@ static UndoStack MeshUndoStack = {UNDO_PAINT_MESH, {NULL, NULL}, NULL}; /* Generic */ -static void undo_restore(bContext *C, UndoStack *stack, UndoElem *uel) +static void undo_restore(bContext *C, UndoStack *UNUSED(stack), UndoElem *uel) { if(uel && uel->restore) uel->restore(C, &uel->elems); } -static void undo_elem_free(UndoStack *stack, UndoElem *uel) +static void undo_elem_free(UndoStack *UNUSED(stack), UndoElem *uel) { if(uel && uel->free) { uel->free(&uel->elems); diff --git a/source/blender/editors/sculpt_paint/paint_utils.c b/source/blender/editors/sculpt_paint/paint_utils.c index 0098b8ca12c..e3a486a0fee 100644 --- a/source/blender/editors/sculpt_paint/paint_utils.c +++ b/source/blender/editors/sculpt_paint/paint_utils.c @@ -88,7 +88,7 @@ static void imapaint_tri_weights(Object *ob, float *v1, float *v2, float *v3, fl } /* compute uv coordinates of mouse in face */ -void imapaint_pick_uv(Scene *scene, Object *ob, Mesh *mesh, unsigned int faceindex, int *xy, float *uv) +void imapaint_pick_uv(Scene *scene, Object *ob, unsigned int faceindex, int *xy, float *uv) { DerivedMesh *dm = mesh_get_derived_final(scene, ob, CD_MASK_BAREMESH); int *index = dm->getFaceDataArray(dm, CD_ORIGINDEX); @@ -233,7 +233,7 @@ void BRUSH_OT_curve_preset(wmOperatorType *ot) /* face-select ops */ -static int paint_select_linked_exec(bContext *C, wmOperator *op) +static int paint_select_linked_exec(bContext *C, wmOperator *UNUSED(op)) { select_linked_tfaces(C, CTX_data_active_object(C), NULL, 2); ED_region_tag_redraw(CTX_wm_region(C)); diff --git a/source/blender/editors/sculpt_paint/paint_vertex.c b/source/blender/editors/sculpt_paint/paint_vertex.c index 399ba535e57..3c25d861d2f 100644 --- a/source/blender/editors/sculpt_paint/paint_vertex.c +++ b/source/blender/editors/sculpt_paint/paint_vertex.c @@ -852,7 +852,7 @@ static void wpaint_blend(VPaint *wp, MDeformWeight *dw, MDeformWeight *uw, float /* else */ /* sets wp->weight to the closest weight value to vertex */ /* note: we cant sample frontbuf, weight colors are interpolated too unpredictable */ -void sample_wpaint(Scene *scene, ARegion *ar, View3D *v3d, int mode) +void sample_wpaint(Scene *scene, ARegion *ar, View3D *UNUSED(v3d), int mode) { ViewContext vc; ToolSettings *ts= scene->toolsettings; @@ -1061,7 +1061,7 @@ static void do_weight_paint_vertex(VPaint *wp, Object *ob, int index, /* *************** set wpaint operator ****************** */ -static int set_wpaint(bContext *C, wmOperator *op) /* toggle */ +static int set_wpaint(bContext *C, wmOperator *UNUSED(op)) /* toggle */ { Object *ob= CTX_data_active_object(C); Scene *scene= CTX_data_scene(C); @@ -1256,7 +1256,7 @@ struct WPaintData { char *vgroup_validmap; /*stores if vgroups tie to deforming bones or not*/ }; -static char *wpaint_make_validmap(Mesh *me, Object *ob) +static char *wpaint_make_validmap(Object *ob) { bDeformGroup *dg; ModifierData *md; @@ -1314,7 +1314,7 @@ static char *wpaint_make_validmap(Mesh *me, Object *ob) return validmap; } -static int wpaint_stroke_test_start(bContext *C, wmOperator *op, wmEvent *event) +static int wpaint_stroke_test_start(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { Scene *scene= CTX_data_scene(C); struct PaintStroke *stroke = op->customdata; @@ -1344,7 +1344,7 @@ static int wpaint_stroke_test_start(bContext *C, wmOperator *op, wmEvent *event) vgroups affect deform bones*/ wpd->auto_normalize = ts->auto_normalize; if (wpd->auto_normalize) - wpd->vgroup_validmap = wpaint_make_validmap(me, ob); + wpd->vgroup_validmap = wpaint_make_validmap(ob); // if(qual & LR_CTRLKEY) { // sample_wpaint(scene, ar, v3d, 0); @@ -1663,7 +1663,7 @@ void PAINT_OT_weight_paint(wmOperatorType *ot) RNA_def_collection_runtime(ot->srna, "stroke", &RNA_OperatorStrokeElement, "Stroke", ""); } -static int weight_paint_set_exec(bContext *C, wmOperator *op) +static int weight_paint_set_exec(bContext *C, wmOperator *UNUSED(op)) { struct Scene *scene= CTX_data_scene(C); Object *obact = CTX_data_active_object(C); @@ -1780,7 +1780,7 @@ typedef struct VPaintData { float vpimat[3][3]; } VPaintData; -static int vpaint_stroke_test_start(bContext *C, struct wmOperator *op, wmEvent *event) +static int vpaint_stroke_test_start(bContext *C, struct wmOperator *op, wmEvent *UNUSED(event)) { ToolSettings *ts= CTX_data_tool_settings(C); struct PaintStroke *stroke = op->customdata; @@ -1817,7 +1817,7 @@ static int vpaint_stroke_test_start(bContext *C, struct wmOperator *op, wmEvent return 1; } -static void vpaint_paint_face(VPaint *vp, VPaintData *vpd, Object *ob, int index, float mval[2], float pressure, int flip) +static void vpaint_paint_face(VPaint *vp, VPaintData *vpd, Object *ob, int index, float mval[2], float pressure, int UNUSED(flip)) { ViewContext *vc = &vpd->vc; Brush *brush = paint_brush(&vp->paint); @@ -1971,7 +1971,7 @@ static int weight_from_bones_exec(bContext *C, wmOperator *op) Mesh *me= ob->data; int type= RNA_enum_get(op->ptr, "type"); - create_vgroups_from_armature(scene, ob, armob, type, (me->editflag & ME_EDIT_MIRROR_X)); + create_vgroups_from_armature(op->reports, scene, ob, armob, type, (me->editflag & ME_EDIT_MIRROR_X)); DAG_id_flush_update(&me->id, OB_RECALC_DATA); WM_event_add_notifier(C, NC_GEOM|ND_DATA, me); diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c index 2e192a08ca5..505e37d95f6 100644 --- a/source/blender/editors/sculpt_paint/sculpt.c +++ b/source/blender/editors/sculpt_paint/sculpt.c @@ -867,6 +867,8 @@ static void calc_area_normal(Sculpt *sd, SculptSession *ss, float an[3], PBVHNod float out_flip[3] = {0.0f, 0.0f, 0.0f}; + (void)sd; /* unused w/o openmp */ + zero_v3(an); #pragma omp parallel for schedule(guided) if (sd->flags & SCULPT_USE_OPENMP) @@ -1667,6 +1669,8 @@ static void calc_flatten_center(Sculpt *sd, SculptSession *ss, PBVHNode **nodes, float count = 0; + (void)sd; /* unused w/o openmp */ + zero_v3(fc); #pragma omp parallel for schedule(guided) if (sd->flags & SCULPT_USE_OPENMP) @@ -1721,6 +1725,8 @@ static void calc_area_normal_and_flatten_center(Sculpt *sd, SculptSession *ss, P // fc float count = 0; + (void)sd; /* unused w/o openmp */ + // an zero_v3(an); @@ -2534,8 +2540,10 @@ static void sculpt_combine_proxies(Sculpt *sd, SculptSession *ss) /* Flip all the editdata across the axis/axes specified by symm. Used to calculate multiple modifications to the mesh when symmetry is enabled. */ -static void calc_brushdata_symm(Sculpt *sd, StrokeCache *cache, const char symm, const char axis, const float angle, const float feather) +static void calc_brushdata_symm(Sculpt *sd, StrokeCache *cache, const char symm, const char axis, const float angle, const float UNUSED(feather)) { + (void)sd; /* unused */ + flip_coord(cache->location, cache->true_location, symm); flip_coord(cache->grab_delta_symmetry, cache->grab_delta, symm); flip_coord(cache->view_normal, cache->true_view_normal, symm); diff --git a/source/blender/editors/sound/sound_ops.c b/source/blender/editors/sound/sound_ops.c index fe1fe3266bc..18f35502f8b 100644 --- a/source/blender/editors/sound/sound_ops.c +++ b/source/blender/editors/sound/sound_ops.c @@ -280,7 +280,7 @@ static int unpack_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -static int unpack_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int unpack_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { Editing* ed = CTX_data_scene(C)->ed; bSound* sound; diff --git a/source/blender/editors/space_action/action_draw.c b/source/blender/editors/space_action/action_draw.c index d2067790b2f..ce9a96af38c 100644 --- a/source/blender/editors/space_action/action_draw.c +++ b/source/blender/editors/space_action/action_draw.c @@ -63,7 +63,7 @@ /* Channel List */ /* left hand part */ -void draw_channel_names(bContext *C, bAnimContext *ac, SpaceAction *saction, ARegion *ar) +void draw_channel_names(bContext *C, bAnimContext *ac, ARegion *ar) { ListBase anim_data = {NULL, NULL}; bAnimListElem *ale; @@ -90,8 +90,8 @@ void draw_channel_names(bContext *C, bAnimContext *ac, SpaceAction *saction, ARe */ v2d->tot.ymin= (float)(-height); } - /* need to do a view-sync here, so that the keys area doesn't jump around */ - UI_view2d_sync(NULL, ac->sa, v2d, V2D_VIEWSYNC_AREA_VERTICAL); + /* need to do a view-sync here, so that the keys area doesn't jump around (it must copy this) */ + UI_view2d_sync(NULL, ac->sa, v2d, V2D_LOCK_COPY); /* loop through channels, and set up drawing depending on their type */ { /* first pass: just the standard GL-drawing for backdrop + text */ diff --git a/source/blender/editors/space_action/action_edit.c b/source/blender/editors/space_action/action_edit.c index 916b0032f17..b0704e76138 100644 --- a/source/blender/editors/space_action/action_edit.c +++ b/source/blender/editors/space_action/action_edit.c @@ -70,7 +70,7 @@ /* ******************** New Action Operator *********************** */ -static int act_new_exec(bContext *C, wmOperator *op) +static int act_new_exec(bContext *C, wmOperator *UNUSED(op)) { bAction *action; PointerRNA ptr, idptr; @@ -173,7 +173,7 @@ static void get_keyframe_extents (bAnimContext *ac, float *min, float *max) /* ****************** Automatic Preview-Range Operator ****************** */ -static int actkeys_previewrange_exec(bContext *C, wmOperator *op) +static int actkeys_previewrange_exec(bContext *C, wmOperator *UNUSED(op)) { bAnimContext ac; Scene *scene; @@ -217,7 +217,7 @@ void ACTION_OT_previewrange_set (wmOperatorType *ot) /* ****************** View-All Operator ****************** */ -static int actkeys_viewall_exec(bContext *C, wmOperator *op) +static int actkeys_viewall_exec(bContext *C, wmOperator *UNUSED(op)) { bAnimContext ac; View2D *v2d; @@ -521,7 +521,7 @@ static void duplicate_action_keys (bAnimContext *ac) /* ------------------- */ -static int actkeys_duplicate_exec(bContext *C, wmOperator *op) +static int actkeys_duplicate_exec(bContext *C, wmOperator *UNUSED(op)) { bAnimContext ac; @@ -541,7 +541,7 @@ static int actkeys_duplicate_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; // xxx - start transform } -static int actkeys_duplicate_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int actkeys_duplicate_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { actkeys_duplicate_exec(C, op); @@ -608,7 +608,7 @@ static void delete_action_keys (bAnimContext *ac) /* ------------------- */ -static int actkeys_delete_exec(bContext *C, wmOperator *op) +static int actkeys_delete_exec(bContext *C, wmOperator *UNUSED(op)) { bAnimContext ac; @@ -734,7 +734,7 @@ static void sample_action_keys (bAnimContext *ac) /* ------------------- */ -static int actkeys_sample_exec(bContext *C, wmOperator *op) +static int actkeys_sample_exec(bContext *C, wmOperator *UNUSED(op)) { bAnimContext ac; @@ -791,7 +791,7 @@ static void setexpo_action_keys(bAnimContext *ac, short mode) int filter; /* filter data */ - filter= (ANIMFILTER_VISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_CURVESONLY | ANIMFILTER_NODUPLIS); + filter= (ANIMFILTER_VISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_SEL | ANIMFILTER_CURVESONLY | ANIMFILTER_NODUPLIS); ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype); /* loop through setting mode per F-Curve */ @@ -1096,7 +1096,7 @@ void ACTION_OT_keyframe_type (wmOperatorType *ot) /* ***************** Jump to Selected Frames Operator *********************** */ /* snap current-frame indicator to 'average time' of selected keyframe */ -static int actkeys_framejump_exec(bContext *C, wmOperator *op) +static int actkeys_framejump_exec(bContext *C, wmOperator *UNUSED(op)) { bAnimContext ac; ListBase anim_data= {NULL, NULL}; diff --git a/source/blender/editors/space_action/action_intern.h b/source/blender/editors/space_action/action_intern.h index b02e95ac138..cc363b76479 100644 --- a/source/blender/editors/space_action/action_intern.h +++ b/source/blender/editors/space_action/action_intern.h @@ -41,7 +41,7 @@ struct bAnimListElem; /* ***************************************** */ /* action_draw.c */ -void draw_channel_names(struct bContext *C, struct bAnimContext *ac, struct SpaceAction *saction, struct ARegion *ar); +void draw_channel_names(struct bContext *C, struct bAnimContext *ac, struct ARegion *ar); void draw_channel_strips(struct bAnimContext *ac, struct SpaceAction *saction, struct ARegion *ar); struct ActKeysInc *init_aki_data(struct bAnimContext *ac, struct bAnimListElem *ale); diff --git a/source/blender/editors/space_action/action_select.c b/source/blender/editors/space_action/action_select.c index b2c47194384..11b6123dbbb 100644 --- a/source/blender/editors/space_action/action_select.c +++ b/source/blender/editors/space_action/action_select.c @@ -551,7 +551,7 @@ void ACTION_OT_select_column (wmOperatorType *ot) /* ******************** Select Linked Operator *********************** */ -static int actkeys_select_linked_exec (bContext *C, wmOperator *op) +static int actkeys_select_linked_exec (bContext *C, wmOperator *UNUSED(op)) { bAnimContext ac; @@ -650,7 +650,7 @@ static void select_moreless_action_keys (bAnimContext *ac, short mode) /* ----------------- */ -static int actkeys_select_more_exec (bContext *C, wmOperator *op) +static int actkeys_select_more_exec (bContext *C, wmOperator *UNUSED(op)) { bAnimContext ac; @@ -684,7 +684,7 @@ void ACTION_OT_select_more (wmOperatorType *ot) /* ----------------- */ -static int actkeys_select_less_exec (bContext *C, wmOperator *op) +static int actkeys_select_less_exec (bContext *C, wmOperator *UNUSED(op)) { bAnimContext ac; @@ -990,7 +990,7 @@ static void mouse_action_keys (bAnimContext *ac, int mval[2], short select_mode, } else if (ale->type == ANIMTYPE_GPLAYER) { struct bGPDlayer *gpl= (struct bGPDlayer *)ale->data; - gpl_to_keylist(ads, gpl, &anim_keys, NULL); + gpl_to_keylist(ads, gpl, &anim_keys); } /* loop through keyframes, finding one that was within the range clicked on */ diff --git a/source/blender/editors/space_action/space_action.c b/source/blender/editors/space_action/space_action.c index 7b96618d923..bb3b40fbf9b 100644 --- a/source/blender/editors/space_action/space_action.c +++ b/source/blender/editors/space_action/space_action.c @@ -101,16 +101,17 @@ static SpaceLink *action_new(const bContext *C) 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; ar->v2d.scroll = (V2D_SCROLL_BOTTOM|V2D_SCROLL_SCALE_HORIZONTAL); ar->v2d.scroll |= (V2D_SCROLL_RIGHT); ar->v2d.keepzoom= V2D_LOCKZOOM_Y; + ar->v2d.keepofs= V2D_KEEPOFS_Y; ar->v2d.align= V2D_ALIGN_NO_POS_Y; ar->v2d.flag = V2D_VIEWSYNC_AREA_VERTICAL; @@ -118,7 +119,7 @@ static SpaceLink *action_new(const bContext *C) } /* not spacelink itself */ -static void action_free(SpaceLink *sl) +static void action_free(SpaceLink *UNUSED(sl)) { // SpaceAction *saction= (SpaceAction*) sl; @@ -126,7 +127,7 @@ static void action_free(SpaceLink *sl) /* spacetype; init callback */ -static void action_init(struct wmWindowManager *wm, ScrArea *sa) +static void action_init(struct wmWindowManager *UNUSED(wm), ScrArea *sa) { SpaceAction *saction = sa->spacedata.first; saction->flag |= SACTION_TEMP_NEEDCHANSYNC; @@ -169,12 +170,12 @@ static void action_main_area_draw(const bContext *C, ARegion *ar) UI_ThemeClearColor(TH_BACK); glClear(GL_COLOR_BUFFER_BIT); - UI_view2d_view_ortho(C, v2d); + UI_view2d_view_ortho(v2d); /* time grid */ unit= (saction->flag & SACTION_DRAWTIME)? V2D_UNIT_SECONDS : V2D_UNIT_FRAMES; - grid= UI_view2d_grid_calc(C, v2d, unit, V2D_GRID_CLAMP, V2D_ARG_DUMMY, V2D_ARG_DUMMY, ar->winx, ar->winy); - UI_view2d_grid_draw(C, v2d, grid, V2D_GRIDLINES_ALL); + grid= UI_view2d_grid_calc(CTX_data_scene(C), v2d, unit, V2D_GRID_CLAMP, V2D_ARG_DUMMY, V2D_ARG_DUMMY, ar->winx, ar->winy); + UI_view2d_grid_draw(v2d, grid, V2D_GRIDLINES_ALL); UI_view2d_grid_free(grid); /* data */ @@ -188,11 +189,11 @@ static void action_main_area_draw(const bContext *C, ARegion *ar) ANIM_draw_cfra(C, v2d, flag); /* markers */ - UI_view2d_view_orthoSpecial(C, v2d, 1); + UI_view2d_view_orthoSpecial(ar, v2d, 1); draw_markers_time(C, 0); /* preview range */ - UI_view2d_view_ortho(C, v2d); + UI_view2d_view_ortho(v2d); ANIM_draw_previewrange(C, v2d); /* reset view matrix */ @@ -219,7 +220,6 @@ static void action_channel_area_init(wmWindowManager *wm, ARegion *ar) static void action_channel_area_draw(const bContext *C, ARegion *ar) { /* draw entirely, view changes should be handled here */ - SpaceAction *saction= CTX_wm_space_action(C); bAnimContext ac; View2D *v2d= &ar->v2d; View2DScrollers *scrollers; @@ -228,11 +228,11 @@ static void action_channel_area_draw(const bContext *C, ARegion *ar) UI_ThemeClearColor(TH_BACK); glClear(GL_COLOR_BUFFER_BIT); - UI_view2d_view_ortho(C, v2d); + UI_view2d_view_ortho(v2d); /* data */ if (ANIM_animdata_get_context(C, &ac)) { - draw_channel_names((bContext *)C, &ac, saction, ar); + draw_channel_names((bContext *)C, &ac, ar); } /* reset view matrix */ @@ -246,7 +246,7 @@ static void action_channel_area_draw(const bContext *C, ARegion *ar) /* add handlers, stuff you only do once or on area/region changes */ -static void action_header_area_init(wmWindowManager *wm, ARegion *ar) +static void action_header_area_init(wmWindowManager *UNUSED(wm), ARegion *ar) { ED_region_header_init(ar); } @@ -417,7 +417,7 @@ static void action_header_area_listener(ARegion *ar, wmNotifier *wmn) static void action_refresh(const bContext *C, ScrArea *sa) { - SpaceAction *saction= CTX_wm_space_action(C); + SpaceAction *saction= (SpaceAction *)sa->spacedata.first; /* update the state of the animchannels in response to changes from the data they represent * NOTE: the temp flag is used to indicate when this needs to be done, and will be cleared once handled diff --git a/source/blender/editors/space_api/spacetypes.c b/source/blender/editors/space_api/spacetypes.c index 2140c59da67..0d0d3713723 100644 --- a/source/blender/editors/space_api/spacetypes.c +++ b/source/blender/editors/space_api/spacetypes.c @@ -30,6 +30,7 @@ #include "DNA_object_types.h" #include "DNA_windowmanager_types.h" +#include "BKE_utildefines.h" #include "BKE_context.h" #include "BKE_screen.h" @@ -224,19 +225,19 @@ void ED_region_draw_cb_draw(const bContext *C, ARegion *ar, int type) /* ********************* space template *********************** */ /* allocate and init some vars */ -static SpaceLink *xxx_new(const bContext *C) +static SpaceLink *xxx_new(const bContext *UNUSED(C)) { return NULL; } /* not spacelink itself */ -static void xxx_free(SpaceLink *sl) +static void xxx_free(SpaceLink *UNUSED(sl)) { } /* spacetype; init callback for usage, should be redoable */ -static void xxx_init(wmWindowManager *wm, ScrArea *sa) +static void xxx_init(wmWindowManager *UNUSED(wm), ScrArea *UNUSED(sa)) { /* link area to SpaceXXX struct */ @@ -246,7 +247,7 @@ static void xxx_init(wmWindowManager *wm, ScrArea *sa) /* add types to regions */ } -static SpaceLink *xxx_duplicate(SpaceLink *sl) +static SpaceLink *xxx_duplicate(SpaceLink *UNUSED(sl)) { return NULL; @@ -257,7 +258,7 @@ static void xxx_operatortypes(void) /* register operator types for this space */ } -static void xxx_keymap(wmKeyConfig *keyconf) +static void xxx_keymap(wmKeyConfig *UNUSED(keyconf)) { /* add default items to keymap */ } diff --git a/source/blender/editors/space_buttons/buttons_context.c b/source/blender/editors/space_buttons/buttons_context.c index 343237dee5e..2d16bb6bc81 100644 --- a/source/blender/editors/space_buttons/buttons_context.c +++ b/source/blender/editors/space_buttons/buttons_context.c @@ -323,7 +323,7 @@ static int buttons_context_path_particle(ButsContextPath *path) return 0; } -static int buttons_context_path_brush(const bContext *C, ButsContextPath *path) +static int buttons_context_path_brush(ButsContextPath *path) { Scene *scene; Brush *br= NULL; @@ -352,7 +352,7 @@ static int buttons_context_path_brush(const bContext *C, ButsContextPath *path) return 0; } -static int buttons_context_path_texture(const bContext *C, ButsContextPath *path) +static int buttons_context_path_texture(ButsContextPath *path) { Material *ma; Lamp *la; @@ -367,7 +367,7 @@ static int buttons_context_path_texture(const bContext *C, ButsContextPath *path return 1; } /* try brush */ - if((path->flag & SB_BRUSH_TEX) && buttons_context_path_brush(C, path)) { + if((path->flag & SB_BRUSH_TEX) && buttons_context_path_brush(path)) { br= path->ptr[path->len-1].data; if(br) { @@ -416,7 +416,7 @@ static int buttons_context_path_texture(const bContext *C, ButsContextPath *path } /* try brushes again in case of no material, lamp, etc */ path->len = orig_len; - if(buttons_context_path_brush(C, path)) { + if(buttons_context_path_brush(path)) { br= path->ptr[path->len-1].data; if(br) { @@ -485,7 +485,7 @@ static int buttons_context_path(const bContext *C, ButsContextPath *path, int ma found= buttons_context_path_material(path); break; case BCONTEXT_TEXTURE: - found= buttons_context_path_texture(C, path); + found= buttons_context_path_texture(path); break; case BCONTEXT_BONE: found= buttons_context_path_bone(path); @@ -515,7 +515,7 @@ static int buttons_shading_context(const bContext *C, int mainb) return 0; } -static int buttons_shading_new_context(const bContext *C, int flag, int mainb) +static int buttons_shading_new_context(const bContext *C, int flag) { Object *ob= CTX_data_active_object(C); @@ -568,7 +568,7 @@ void buttons_context_compute(const bContext *C, SpaceButs *sbuts) if((flag & (1 << sbuts->mainb)) == 0) { if(sbuts->flag & SB_SHADING_CONTEXT) { /* try to keep showing shading related buttons */ - sbuts->mainb= buttons_shading_new_context(C, flag, sbuts->mainb); + sbuts->mainb= buttons_shading_new_context(C, flag); } else if(flag & BCONTEXT_OBJECT) { sbuts->mainb= BCONTEXT_OBJECT; @@ -821,7 +821,7 @@ int buttons_context(const bContext *C, const char *member, bContextDataResult *r /************************* Drawing the Path ************************/ -static void pin_cb(bContext *C, void *arg1, void *arg2) +static void pin_cb(bContext *C, void *UNUSED(arg1), void *UNUSED(arg2)) { SpaceButs *sbuts= CTX_wm_space_buts(C); diff --git a/source/blender/editors/space_buttons/buttons_header.c b/source/blender/editors/space_buttons/buttons_header.c index ab756b638fa..9071d9f27d9 100644 --- a/source/blender/editors/space_buttons/buttons_header.c +++ b/source/blender/editors/space_buttons/buttons_header.c @@ -33,6 +33,7 @@ #include "BLI_blenlib.h" +#include "BKE_utildefines.h" #include "BKE_context.h" #include "ED_screen.h" @@ -50,7 +51,7 @@ #define B_CONTEXT_SWITCH 101 #define B_BUTSPREVIEW 102 -static void do_buttons_buttons(bContext *C, void *arg, int event) +static void do_buttons_buttons(bContext *C, void *UNUSED(arg), int event) { SpaceButs *sbuts= CTX_wm_space_buts(C); diff --git a/source/blender/editors/space_buttons/buttons_ops.c b/source/blender/editors/space_buttons/buttons_ops.c index c1803dde805..e72446366fe 100644 --- a/source/blender/editors/space_buttons/buttons_ops.c +++ b/source/blender/editors/space_buttons/buttons_ops.c @@ -39,6 +39,7 @@ #include "BKE_context.h" #include "BKE_global.h" +#include "BKE_main.h" #include "WM_api.h" #include "WM_types.h" @@ -53,7 +54,7 @@ /********************** toolbox operator *********************/ -static int toolbox_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int toolbox_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent *UNUSED(event)) { bScreen *sc= CTX_wm_screen(C); SpaceButs *sbuts= CTX_wm_space_buts(C); @@ -104,7 +105,7 @@ static int file_browse_exec(bContext *C, wmOperator *op) /* add slash for directories, important for some properties */ if(RNA_property_subtype(fbo->prop) == PROP_DIRPATH) { id = fbo->ptr.id.data; - base = (id && id->lib)? id->lib->filepath: G.sce; + base = (id && id->lib)? id->lib->filepath: G.main->name; BLI_strncpy(path, str, FILE_MAX); BLI_path_abs(path, base); @@ -123,7 +124,7 @@ static int file_browse_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -static int file_browse_cancel(bContext *C, wmOperator *op) +static int file_browse_cancel(bContext *UNUSED(C), wmOperator *op) { MEM_freeN(op->customdata); op->customdata= NULL; diff --git a/source/blender/editors/space_buttons/space_buttons.c b/source/blender/editors/space_buttons/space_buttons.c index fcd66c43321..44138119f7a 100644 --- a/source/blender/editors/space_buttons/space_buttons.c +++ b/source/blender/editors/space_buttons/space_buttons.c @@ -55,7 +55,7 @@ /* ******************** default callbacks for buttons space ***************** */ -static SpaceLink *buttons_new(const bContext *C) +static SpaceLink *buttons_new(const bContext *UNUSED(C)) { ARegion *ar; SpaceButs *sbuts; @@ -103,7 +103,7 @@ static void buttons_free(SpaceLink *sl) } /* spacetype; init callback */ -static void buttons_init(struct wmWindowManager *wm, ScrArea *sa) +static void buttons_init(struct wmWindowManager *UNUSED(wm), ScrArea *sa) { SpaceButs *sbuts= sa->spacedata.first; @@ -191,7 +191,7 @@ void buttons_keymap(struct wmKeyConfig *keyconf) } /* add handlers, stuff you only do once or on area/region changes */ -static void buttons_header_area_init(wmWindowManager *wm, ARegion *ar) +static void buttons_header_area_init(wmWindowManager *UNUSED(wm), ARegion *ar) { UI_view2d_region_reinit(&ar->v2d, V2D_COMMONVIEW_HEADER, ar->winx, ar->winy); } @@ -203,7 +203,7 @@ static void buttons_header_area_draw(const bContext *C, ARegion *ar) glClear(GL_COLOR_BUFFER_BIT); /* set view2d view matrix for scrolling (without scrollers) */ - UI_view2d_view_ortho(C, &ar->v2d); + UI_view2d_view_ortho(&ar->v2d); buttons_header_buttons(C, ar); diff --git a/source/blender/editors/space_console/console_draw.c b/source/blender/editors/space_console/console_draw.c index d5ffb34b3a2..edbb539e836 100644 --- a/source/blender/editors/space_console/console_draw.c +++ b/source/blender/editors/space_console/console_draw.c @@ -133,7 +133,7 @@ typedef struct ConsoleDrawContext { int draw; } ConsoleDrawContext; -static void console_draw_sel(int sel[2], int xy[2], int str_len_draw, int cwidth, int console_width, int lheight) +static void console_draw_sel(int sel[2], int xy[2], int str_len_draw, int cwidth, int lheight) { if(sel[0] <= str_len_draw && sel[1] >= 0) { int sta = MAX2(sel[0], 0); @@ -222,7 +222,7 @@ static int console_draw_string(ConsoleDrawContext *cdc, char *str, int str_len, if(cdc->sel[0] != cdc->sel[1]) { STEP_SEL(-initial_offset); // glColor4ub(255, 0, 0, 96); // debug - console_draw_sel(cdc->sel, cdc->xy, str_len % cdc->console_width, cdc->cwidth, cdc->console_width, cdc->lheight); + console_draw_sel(cdc->sel, cdc->xy, str_len % cdc->console_width, cdc->cwidth, cdc->lheight); STEP_SEL(cdc->console_width); glColor3ubv(fg); } @@ -240,7 +240,7 @@ static int console_draw_string(ConsoleDrawContext *cdc, char *str, int str_len, if(cdc->sel[0] != cdc->sel[1]) { // glColor4ub(0, 255, 0, 96); // debug - console_draw_sel(cdc->sel, cdc->xy, cdc->console_width, cdc->cwidth, cdc->console_width, cdc->lheight); + console_draw_sel(cdc->sel, cdc->xy, cdc->console_width, cdc->cwidth, cdc->lheight); STEP_SEL(cdc->console_width); glColor3ubv(fg); } @@ -272,7 +272,7 @@ static int console_draw_string(ConsoleDrawContext *cdc, char *str, int str_len, if(cdc->sel[0] != cdc->sel[1]) { int isel[2]= {str_len - cdc->sel[1], str_len - cdc->sel[0]}; // glColor4ub(255, 255, 0, 96); // debug - console_draw_sel(isel, cdc->xy, str_len, cdc->cwidth, cdc->console_width, cdc->lheight); + console_draw_sel(isel, cdc->xy, str_len, cdc->cwidth, cdc->lheight); STEP_SEL(-(str_len + 1)); } diff --git a/source/blender/editors/space_console/console_intern.h b/source/blender/editors/space_console/console_intern.h index 0e2c35bcf83..1a48dd408bd 100644 --- a/source/blender/editors/space_console/console_intern.h +++ b/source/blender/editors/space_console/console_intern.h @@ -47,8 +47,8 @@ void console_scrollback_prompt_end(struct SpaceConsole *sc, ConsoleLine *cl_dumm /* console_ops.c */ void console_history_free(SpaceConsole *sc, ConsoleLine *cl); void console_scrollback_free(SpaceConsole *sc, ConsoleLine *cl); -ConsoleLine *console_history_add_str(const struct bContext *C, char *str, int own); -ConsoleLine *console_scrollback_add_str(const struct bContext *C, char *str, int own); +ConsoleLine *console_history_add_str(struct SpaceConsole *sc, char *str, int own); +ConsoleLine *console_scrollback_add_str(struct SpaceConsole *sc, char *str, int own); ConsoleLine *console_history_verify(const struct bContext *C); diff --git a/source/blender/editors/space_console/console_ops.c b/source/blender/editors/space_console/console_ops.c index 4e50b589bc6..2b419b0a833 100644 --- a/source/blender/editors/space_console/console_ops.c +++ b/source/blender/editors/space_console/console_ops.c @@ -194,7 +194,7 @@ static ConsoleLine *console_scrollback_add(const bContext *C, ConsoleLine *from) } #endif -static ConsoleLine *console_lb_add_str__internal(ListBase *lb, const bContext *C, char *str, int own) +static ConsoleLine *console_lb_add_str__internal(ListBase *lb, char *str, int own) { ConsoleLine *ci= MEM_callocN(sizeof(ConsoleLine), "ConsoleLine Add"); if(own) ci->line= str; @@ -205,14 +205,13 @@ static ConsoleLine *console_lb_add_str__internal(ListBase *lb, const bContext *C BLI_addtail(lb, ci); return ci; } -ConsoleLine *console_history_add_str(const bContext *C, char *str, int own) +ConsoleLine *console_history_add_str(SpaceConsole *sc, char *str, int own) { - return console_lb_add_str__internal(&CTX_wm_space_console(C)->history, C, str, own); + return console_lb_add_str__internal(&sc->history, str, own); } -ConsoleLine *console_scrollback_add_str(const bContext *C, char *str, int own) +ConsoleLine *console_scrollback_add_str(SpaceConsole *sc, char *str, int own) { - SpaceConsole *sc= CTX_wm_space_console(C); - ConsoleLine *ci= console_lb_add_str__internal(&sc->scrollback, C, str, own); + ConsoleLine *ci= console_lb_add_str__internal(&sc->scrollback, str, own); console_select_offset(sc, ci->len + 1); return ci; } @@ -406,9 +405,8 @@ static int insert_invoke(bContext *C, wmOperator *op, wmEvent *event) // if(!RNA_property_is_set(op->ptr, "text")) { /* always set from keymap XXX */ if(!RNA_string_length(op->ptr, "text")) { char str[2] = {event->ascii, '\0'}; - /* if alt/ctrl/super are pressed pass through */ - if(event->alt || event->ctrl || event->oskey) + if(event->ctrl || event->oskey) return OPERATOR_PASS_THROUGH; RNA_string_set(op->ptr, "text", str); @@ -628,7 +626,7 @@ static int history_append_exec(bContext *C, wmOperator *op) } } - ci= console_history_add_str(C, str, 1); /* own the string */ + ci= console_history_add_str(sc, str, 1); /* own the string */ console_select_offset(sc, ci->len - prev_len); console_line_cursor_set(ci, cursor); @@ -664,7 +662,7 @@ static int scrollback_append_exec(bContext *C, wmOperator *op) char *str= RNA_string_get_alloc(op->ptr, "text", NULL, 0); /* own this text in the new line, dont free */ int type= RNA_enum_get(op->ptr, "type"); - ci= console_scrollback_add_str(C, str, 1); /* own the string */ + ci= console_scrollback_add_str(sc, str, 1); /* own the string */ ci->type= type; console_scrollback_limit(sc); @@ -699,7 +697,7 @@ void CONSOLE_OT_scrollback_append(wmOperatorType *ot) } -static int copy_exec(bContext *C, wmOperator *op) +static int copy_exec(bContext *C, wmOperator *UNUSED(op)) { SpaceConsole *sc= CTX_wm_space_console(C); int buf_len; @@ -780,7 +778,7 @@ void CONSOLE_OT_copy(wmOperatorType *ot) /* properties */ } -static int paste_exec(bContext *C, wmOperator *op) +static int paste_exec(bContext *C, wmOperator *UNUSED(op)) { SpaceConsole *sc= CTX_wm_space_console(C); ConsoleLine *ci= console_history_verify(C); @@ -835,7 +833,8 @@ typedef struct SetConsoleCursor { int sel_init; } SetConsoleCursor; -static void set_cursor_to_pos(SpaceConsole *sc, ARegion *ar, SetConsoleCursor *scu, int mval[2], int sel) +// TODO, cursor placement without selection +static void set_cursor_to_pos(SpaceConsole *sc, ARegion *ar, SetConsoleCursor *scu, int mval[2], int UNUSED(sel)) { int pos; pos= console_char_pick(sc, ar, NULL, mval); @@ -870,7 +869,7 @@ static void console_modal_select_apply(bContext *C, wmOperator *op, wmEvent *eve ED_area_tag_redraw(CTX_wm_area(C)); } -static void set_cursor_exit(bContext *C, wmOperator *op) +static void set_cursor_exit(bContext *UNUSED(C), wmOperator *op) { // SpaceConsole *sc= CTX_wm_space_console(C); SetConsoleCursor *scu= op->customdata; diff --git a/source/blender/editors/space_console/console_report.c b/source/blender/editors/space_console/console_report.c index 51bffa5b981..6483177a045 100644 --- a/source/blender/editors/space_console/console_report.c +++ b/source/blender/editors/space_console/console_report.c @@ -72,7 +72,7 @@ static int console_report_poll(bContext *C) return 1; } -static int report_replay_exec(bContext *C, wmOperator *op) +static int report_replay_exec(bContext *C, wmOperator *UNUSED(op)) { SpaceConsole *sc= CTX_wm_space_console(C); ReportList *reports= CTX_wm_reports(C); @@ -83,7 +83,7 @@ static int report_replay_exec(bContext *C, wmOperator *op) for(report=reports->list.last; report; report=report->prev) { if((report->type & report_mask) && (report->type & RPT_OPERATOR_ALL) && (report->flag & SELECT)) { - console_history_add_str(C, report->message, 0); + console_history_add_str(sc, report->message, 0); WM_operator_name_call(C, "CONSOLE_OT_execute", WM_OP_EXEC_DEFAULT, NULL); ED_area_tag_redraw(CTX_wm_area(C)); @@ -165,7 +165,7 @@ void CONSOLE_OT_select_pick(wmOperatorType *ot) -static int report_select_all_toggle_exec(bContext *C, wmOperator *op) +static int report_select_all_toggle_exec(bContext *C, wmOperator *UNUSED(op)) { SpaceConsole *sc= CTX_wm_space_console(C); ReportList *reports= CTX_wm_reports(C); @@ -314,7 +314,7 @@ void CONSOLE_OT_select_border(wmOperatorType *ot) -static int report_delete_exec(bContext *C, wmOperator *op) +static int report_delete_exec(bContext *C, wmOperator *UNUSED(op)) { SpaceConsole *sc= CTX_wm_space_console(C); ReportList *reports= CTX_wm_reports(C); @@ -359,7 +359,7 @@ void CONSOLE_OT_report_delete(wmOperatorType *ot) } -static int report_copy_exec(bContext *C, wmOperator *op) +static int report_copy_exec(bContext *C, wmOperator *UNUSED(op)) { SpaceConsole *sc= CTX_wm_space_console(C); ReportList *reports= CTX_wm_reports(C); diff --git a/source/blender/editors/space_console/space_console.c b/source/blender/editors/space_console/space_console.c index c30897bbb87..70263788b13 100644 --- a/source/blender/editors/space_console/space_console.c +++ b/source/blender/editors/space_console/space_console.c @@ -67,7 +67,7 @@ static void console_update_rect(const bContext *C, ARegion *ar) /* ******************** default callbacks for console space ***************** */ -static SpaceLink *console_new(const bContext *C) +static SpaceLink *console_new(const bContext *UNUSED(C)) { ARegion *ar; SpaceConsole *sconsole; @@ -121,7 +121,7 @@ static void console_free(SpaceLink *sl) /* spacetype; init callback */ -static void console_init(struct wmWindowManager *wm, ScrArea *sa) +static void console_init(struct wmWindowManager *UNUSED(wm), ScrArea *UNUSED(sa)) { } @@ -162,7 +162,7 @@ static void console_main_area_init(wmWindowManager *wm, ARegion *ar) /* ************* dropboxes ************* */ -static int id_drop_poll(bContext *C, wmDrag *drag, wmEvent *event) +static int id_drop_poll(bContext *C, wmDrag *drag, wmEvent *UNUSED(event)) { SpaceConsole *sc= CTX_wm_space_console(C); if(sc->type==CONSOLE_TYPE_PYTHON) @@ -182,7 +182,7 @@ static void id_drop_copy(wmDrag *drag, wmDropBox *drop) RNA_string_set(drop->ptr, "text", text); } -static int path_drop_poll(bContext *C, wmDrag *drag, wmEvent *event) +static int path_drop_poll(bContext *C, wmDrag *drag, wmEvent *UNUSED(event)) { SpaceConsole *sc= CTX_wm_space_console(C); if(sc->type==CONSOLE_TYPE_PYTHON) @@ -227,7 +227,7 @@ static void console_main_area_draw(const bContext *C, ARegion *ar) console_update_rect(C, ar); /* worlks best with no view2d matrix set */ - UI_view2d_view_ortho(C, v2d); + UI_view2d_view_ortho(v2d); /* data... */ @@ -361,7 +361,7 @@ void console_keymap(struct wmKeyConfig *keyconf) /****************** header region ******************/ /* add handlers, stuff you only do once or on area/region changes */ -static void console_header_area_init(wmWindowManager *wm, ARegion *ar) +static void console_header_area_init(wmWindowManager *UNUSED(wm), ARegion *ar) { ED_region_header_init(ar); } diff --git a/source/blender/editors/space_file/file_draw.c b/source/blender/editors/space_file/file_draw.c index 0f627bda3dc..65415d382ec 100644 --- a/source/blender/editors/space_file/file_draw.c +++ b/source/blender/editors/space_file/file_draw.c @@ -40,6 +40,7 @@ #include "BKE_context.h" #include "BKE_global.h" +#include "BKE_main.h" #include "BLF_api.h" @@ -79,7 +80,7 @@ enum { } eFile_ButEvents; -static void do_file_buttons(bContext *C, void *arg, int event) +static void do_file_buttons(bContext *C, void *UNUSED(arg), int event) { switch(event) { case B_FS_FILENAME: @@ -433,7 +434,7 @@ static void file_draw_preview(uiBlock *block, struct direntry *file, int sx, int } } -static void renamebutton_cb(bContext *C, void *arg1, char *oldname) +static void renamebutton_cb(bContext *C, void *UNUSED(arg1), char *oldname) { char newname[FILE_MAX+12]; char orgname[FILE_MAX+12]; @@ -445,9 +446,9 @@ static void renamebutton_cb(bContext *C, void *arg1, char *oldname) struct direntry *file = (struct direntry *)arg1; #endif - BLI_make_file_string(G.sce, orgname, sfile->params->dir, oldname); + BLI_make_file_string(G.main->name, orgname, sfile->params->dir, oldname); BLI_strncpy(filename, sfile->params->renameedit, sizeof(filename)); - BLI_make_file_string(G.sce, newname, sfile->params->dir, filename); + BLI_make_file_string(G.main->name, newname, sfile->params->dir, filename); if( strcmp(orgname, newname) != 0 ) { if (!BLI_exists(newname)) { diff --git a/source/blender/editors/space_file/file_ops.c b/source/blender/editors/space_file/file_ops.c index e9764a2d36a..1af8e9d14be 100644 --- a/source/blender/editors/space_file/file_ops.c +++ b/source/blender/editors/space_file/file_ops.c @@ -30,6 +30,7 @@ #include "BKE_screen.h" #include "BKE_global.h" #include "BKE_report.h" +#include "BKE_main.h" #include "BLI_blenlib.h" #include "BLI_storage_types.h" @@ -190,7 +191,7 @@ static FileSelect file_select(bContext* C, const rcti* rect, short selecting, sh /* avoids /../../ */ BLI_parent_dir(params->dir); } else { - BLI_cleanup_dir(G.sce, params->dir); + BLI_cleanup_dir(G.main->name, params->dir); strcat(params->dir, file->relname); BLI_add_slash(params->dir); } @@ -304,7 +305,7 @@ void FILE_OT_select(wmOperatorType *ot) RNA_def_boolean(ot->srna, "fill", 0, "Fill", "Select everything beginning with the last selection."); } -static int file_select_all_exec(bContext *C, wmOperator *op) +static int file_select_all_exec(bContext *C, wmOperator *UNUSED(op)) { ScrArea *sa= CTX_wm_area(C); SpaceFile *sfile= CTX_wm_space_file(C); @@ -361,7 +362,7 @@ static int bookmark_select_exec(bContext *C, wmOperator *op) RNA_string_get(op->ptr, "dir", entry); BLI_strncpy(params->dir, entry, sizeof(params->dir)); - BLI_cleanup_dir(G.sce, params->dir); + BLI_cleanup_dir(G.main->name, params->dir); file_change_dir(C, 1); WM_event_add_notifier(C, NC_SPACE|ND_SPACE_FILE_LIST, NULL); @@ -384,7 +385,7 @@ void FILE_OT_select_bookmark(wmOperatorType *ot) RNA_def_string(ot->srna, "dir", "", 256, "Dir", ""); } -static int bookmark_add_exec(bContext *C, wmOperator *op) +static int bookmark_add_exec(bContext *C, wmOperator *UNUSED(op)) { ScrArea *sa= CTX_wm_area(C); SpaceFile *sfile= CTX_wm_space_file(C); @@ -479,7 +480,7 @@ int file_hilight_set(SpaceFile *sfile, ARegion *ar, int mx, int my) return (params->active_file != origfile); } -static int file_highlight_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int file_highlight_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent *event) { ARegion *ar= CTX_wm_region(C); SpaceFile *sfile= CTX_wm_space_file(C); @@ -504,7 +505,7 @@ void FILE_OT_highlight(struct wmOperatorType *ot) ot->poll= ED_operator_file_active; } -int file_cancel_exec(bContext *C, wmOperator *unused) +int file_cancel_exec(bContext *C, wmOperator *UNUSED(unused)) { SpaceFile *sfile= CTX_wm_space_file(C); wmOperator *op = sfile->op; @@ -544,7 +545,7 @@ void file_sfile_to_operator(wmOperator *op, SpaceFile *sfile, char *filepath) BLI_join_dirfile(filepath, sfile->params->dir, sfile->params->file); if(RNA_struct_find_property(op->ptr, "relative_path")) { if(RNA_boolean_get(op->ptr, "relative_path")) { - BLI_path_rel(filepath, G.sce); + BLI_path_rel(filepath, G.main->name); } } @@ -613,7 +614,7 @@ void file_operator_to_sfile(SpaceFile *sfile, wmOperator *op) /* XXX, files and dirs updates missing, not really so important though */ } -void file_draw_check_cb(bContext *C, void *dummy1, void *dummy2) +void file_draw_check_cb(bContext *C, void *UNUSED(arg1), void *UNUSED(arg2)) { SpaceFile *sfile= CTX_wm_space_file(C); wmOperator *op= sfile->op; @@ -680,7 +681,7 @@ int file_exec(bContext *C, wmOperator *exec_op) file_sfile_to_operator(op, sfile, filepath); fsmenu_insert_entry(fsmenu_get(), FS_CATEGORY_RECENT, sfile->params->dir,0, 1); - BLI_make_file_string(G.sce, filepath, BLI_get_folder_create(BLENDER_USER_CONFIG, NULL), BLENDER_BOOKMARK_FILE); + BLI_make_file_string(G.main->name, filepath, BLI_get_folder_create(BLENDER_USER_CONFIG, NULL), BLENDER_BOOKMARK_FILE); fsmenu_write_file(fsmenu_get(), filepath); WM_event_fileselect_event(C, op, EVT_FILESELECT_EXEC); @@ -704,14 +705,14 @@ void FILE_OT_execute(struct wmOperatorType *ot) } -int file_parent_exec(bContext *C, wmOperator *unused) +int file_parent_exec(bContext *C, wmOperator *UNUSED(unused)) { SpaceFile *sfile= CTX_wm_space_file(C); if(sfile->params) { if (BLI_has_parent(sfile->params->dir)) { BLI_parent_dir(sfile->params->dir); - BLI_cleanup_dir(G.sce, sfile->params->dir); + BLI_cleanup_dir(G.main->name, sfile->params->dir); file_change_dir(C, 0); WM_event_add_notifier(C, NC_SPACE|ND_SPACE_FILE_LIST, NULL); } @@ -735,7 +736,7 @@ void FILE_OT_parent(struct wmOperatorType *ot) } -int file_refresh_exec(bContext *C, wmOperator *unused) +int file_refresh_exec(bContext *C, wmOperator *UNUSED(unused)) { SpaceFile *sfile= CTX_wm_space_file(C); @@ -759,7 +760,7 @@ void FILE_OT_previous(struct wmOperatorType *ot) ot->poll= ED_operator_file_active; /* <- important, handler is on window level */ } -int file_previous_exec(bContext *C, wmOperator *unused) +int file_previous_exec(bContext *C, wmOperator *UNUSED(unused)) { SpaceFile *sfile= CTX_wm_space_file(C); @@ -790,7 +791,7 @@ void FILE_OT_next(struct wmOperatorType *ot) ot->poll= ED_operator_file_active; /* <- important, handler is on window level */ } -int file_next_exec(bContext *C, wmOperator *unused) +int file_next_exec(bContext *C, wmOperator *UNUSED(unused)) { SpaceFile *sfile= CTX_wm_space_file(C); if(sfile->params) { @@ -812,7 +813,7 @@ int file_next_exec(bContext *C, wmOperator *unused) /* only meant for timer usage */ -static int file_smoothscroll_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int file_smoothscroll_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent *event) { ScrArea *sa = CTX_wm_area(C); SpaceFile *sfile= CTX_wm_space_file(C); @@ -995,7 +996,7 @@ void FILE_OT_directory_new(struct wmOperatorType *ot) ot->poll= ED_operator_file_active; /* <- important, handler is on window level */ } -int file_directory_exec(bContext *C, wmOperator *unused) +int file_directory_exec(bContext *C, wmOperator *UNUSED(unused)) { SpaceFile *sfile= CTX_wm_space_file(C); @@ -1010,7 +1011,7 @@ int file_directory_exec(bContext *C, wmOperator *unused) if (sfile->params->dir[0] == '\0') get_default_root(sfile->params->dir); #endif - BLI_cleanup_dir(G.sce, sfile->params->dir); + BLI_cleanup_dir(G.main->name, sfile->params->dir); BLI_add_slash(sfile->params->dir); file_change_dir(C, 1); @@ -1021,7 +1022,7 @@ int file_directory_exec(bContext *C, wmOperator *unused) return OPERATOR_FINISHED; } -int file_filename_exec(bContext *C, wmOperator *unused) +int file_filename_exec(bContext *C, wmOperator *UNUSED(unused)) { SpaceFile *sfile= CTX_wm_space_file(C); @@ -1049,7 +1050,7 @@ void FILE_OT_refresh(struct wmOperatorType *ot) ot->poll= ED_operator_file_active; /* <- important, handler is on window level */ } -int file_hidedot_exec(bContext *C, wmOperator *unused) +int file_hidedot_exec(bContext *C, wmOperator *UNUSED(unused)) { SpaceFile *sfile= CTX_wm_space_file(C); @@ -1102,7 +1103,7 @@ struct ARegion *file_buttons_region(struct ScrArea *sa) return arnew; } -int file_bookmark_toggle_exec(bContext *C, wmOperator *unused) +int file_bookmark_toggle_exec(bContext *C, wmOperator *UNUSED(unused)) { ScrArea *sa= CTX_wm_area(C); ARegion *ar= file_buttons_region(sa); @@ -1158,7 +1159,7 @@ void FILE_OT_filenum(struct wmOperatorType *ot) RNA_def_int(ot->srna, "increment", 1, 0, 100, "Increment", "", 0,100); } -int file_rename_exec(bContext *C, wmOperator *op) +int file_rename_exec(bContext *C, wmOperator *UNUSED(op)) { ScrArea *sa= CTX_wm_area(C); SpaceFile *sfile= (SpaceFile*)CTX_wm_space_data(C); @@ -1232,7 +1233,7 @@ int file_delete_poll(bContext *C) return poll; } -int file_delete_exec(bContext *C, wmOperator *op) +int file_delete_exec(bContext *C, wmOperator *UNUSED(op)) { char str[FILE_MAX]; SpaceFile *sfile= CTX_wm_space_file(C); @@ -1240,7 +1241,7 @@ int file_delete_exec(bContext *C, wmOperator *op) file = filelist_file(sfile->files, sfile->params->active_file); - BLI_make_file_string(G.sce, str, sfile->params->dir, file->relname); + BLI_make_file_string(G.main->name, str, sfile->params->dir, file->relname); BLI_delete(str, 0, 0); ED_fileselect_clear(C, sfile); WM_event_add_notifier(C, NC_SPACE|ND_SPACE_FILE_LIST, NULL); diff --git a/source/blender/editors/space_file/file_panels.c b/source/blender/editors/space_file/file_panels.c index 33d740e18a6..9096b9eed27 100644 --- a/source/blender/editors/space_file/file_panels.c +++ b/source/blender/editors/space_file/file_panels.c @@ -49,7 +49,7 @@ #include <string.h> -static void file_panel_cb(bContext *C, void *arg_entry, void *arg_unused) +static void file_panel_cb(bContext *C, void *arg_entry, void *UNUSED(arg_v)) { PointerRNA ptr; char *entry= (char*)arg_entry; @@ -151,7 +151,7 @@ static void file_panel_recent(const bContext *C, Panel *pa) } -static int file_panel_operator_poll(const bContext *C, PanelType *pt) +static int file_panel_operator_poll(const bContext *C, PanelType *UNUSED(pt)) { SpaceFile *sfile= CTX_wm_space_file(C); return (sfile && sfile->op); diff --git a/source/blender/editors/space_file/filelist.c b/source/blender/editors/space_file/filelist.c index eba0df9f963..43d5d54805d 100644 --- a/source/blender/editors/space_file/filelist.c +++ b/source/blender/editors/space_file/filelist.c @@ -295,7 +295,7 @@ static int is_hidden_file(const char* filename, short hide_dot) return is_hidden; } -static int is_filtered_file(struct direntry* file, const char* dir, unsigned int filter, short hide_dot) +static int is_filtered_file(struct direntry* file, const char* UNUSED(dir), unsigned int filter, short hide_dot) { int is_filtered=0; if (filter) { @@ -324,7 +324,7 @@ static int is_filtered_lib(struct direntry* file, const char* dir, unsigned int return is_filtered; } -static int is_filtered_main(struct direntry* file, const char* dir, unsigned int filter, short hide_dot) +static int is_filtered_main(struct direntry* file, const char* UNUSED(dir), unsigned int UNUSED(filter), short hide_dot) { return !is_hidden_file(file->relname, hide_dot); } @@ -371,7 +371,7 @@ void filelist_init_icons() for (x=0; x<SPECIAL_IMG_COLS; x++) { int tile = SPECIAL_IMG_COLS*y + x; if (tile < SPECIAL_IMG_MAX) { - ibuf = IMB_allocImBuf(SPECIAL_IMG_SIZE, SPECIAL_IMG_SIZE, 32, IB_rect, 0); + ibuf = IMB_allocImBuf(SPECIAL_IMG_SIZE, SPECIAL_IMG_SIZE, 32, IB_rect); for (k=0; k<SPECIAL_IMG_SIZE; k++) { memcpy(&ibuf->rect[k*SPECIAL_IMG_SIZE], &bbuf->rect[(k+y*SPECIAL_IMG_SIZE)*SPECIAL_IMG_SIZE*SPECIAL_IMG_COLS+x*SPECIAL_IMG_SIZE], SPECIAL_IMG_SIZE*sizeof(int)); } @@ -730,7 +730,7 @@ static void filelist_read_dir(struct FileList* filelist) BLI_getwdN(wdir); - BLI_cleanup_dir(G.sce, filelist->dir); + BLI_cleanup_dir(G.main->name, filelist->dir); filelist->numfiles = BLI_getdir(filelist->dir, &(filelist->filelist)); if(!chdir(wdir)) {} /* fix warning about not checking return value */ @@ -747,7 +747,7 @@ static void filelist_read_main(struct FileList* filelist) static void filelist_read_library(struct FileList* filelist) { if (!filelist) return; - BLI_cleanup_dir(G.sce, filelist->dir); + BLI_cleanup_dir(G.main->name, filelist->dir); filelist_from_library(filelist); if(!filelist->libfiledata) { int num; @@ -912,7 +912,7 @@ void filelist_from_library(struct FileList* filelist) return; } - BLI_strncpy(filename, G.sce, sizeof(filename)); // G.sce = last file loaded, for UI + BLI_strncpy(filename, G.main->name, sizeof(filename)); /* there we go */ /* for the time being only read filedata when libfiledata==0 */ @@ -965,7 +965,7 @@ void filelist_from_library(struct FileList* filelist) /* first allocate imbuf for copying preview into it */ if (w > 0 && h > 0 && rect) { - ima = IMB_allocImBuf(w, h, 32, IB_rect, 0); + ima = IMB_allocImBuf(w, h, 32, IB_rect); memcpy(ima->rect, rect, w*h*sizeof(unsigned int)); filelist->filelist[i + 1].image = ima; filelist->filelist[i + 1].flags = IMAGEFILE; @@ -979,7 +979,7 @@ void filelist_from_library(struct FileList* filelist) filelist_sort(filelist, FILE_SORT_ALPHA); - BLI_strncpy(G.sce, filename, sizeof(filename)); // prevent G.sce to change + BLI_strncpy(G.main->name, filename, sizeof(filename)); // prevent G.main->name to change filelist->filter = 0; filelist_filter(filelist); @@ -1145,7 +1145,7 @@ static void thumbnail_joblist_free(ThumbnailJob *tj) BLI_freelistN(&tj->loadimages); } -static void thumbnails_startjob(void *tjv, short *stop, short *do_update, float *progress) +static void thumbnails_startjob(void *tjv, short *stop, short *do_update, float *UNUSED(progress)) { ThumbnailJob *tj= tjv; FileImage* limg = tj->loadimages.first; diff --git a/source/blender/editors/space_file/filesel.c b/source/blender/editors/space_file/filesel.c index 7192870bcc8..8ad3ef08e85 100644 --- a/source/blender/editors/space_file/filesel.c +++ b/source/blender/editors/space_file/filesel.c @@ -64,6 +64,7 @@ #include "BKE_context.h" #include "BKE_global.h" +#include "BKE_main.h" #include "BLF_api.h" @@ -104,7 +105,7 @@ short ED_fileselect_set_params(SpaceFile *sfile) if (!sfile->params) { sfile->params= MEM_callocN(sizeof(FileSelectParams), "fileselparams"); /* set path to most recently opened .blend */ - BLI_split_dirfile(G.sce, sfile->params->dir, sfile->params->file); + BLI_split_dirfile(G.main->name, sfile->params->dir, sfile->params->file); sfile->params->filter_glob[0] = '\0'; } @@ -142,8 +143,8 @@ short ED_fileselect_set_params(SpaceFile *sfile) } if(params->dir[0]) { - BLI_cleanup_dir(G.sce, params->dir); - BLI_path_abs(params->dir, G.sce); + BLI_cleanup_dir(G.main->name, params->dir); + BLI_path_abs(params->dir, G.main->name); } params->filter = 0; @@ -463,7 +464,7 @@ int file_select_match(struct SpaceFile *sfile, const char *pattern) return match; } -void autocomplete_directory(struct bContext *C, char *str, void *arg_v) +void autocomplete_directory(struct bContext *C, char *str, void *UNUSED(arg_v)) { SpaceFile *sfile= CTX_wm_space_file(C); @@ -510,7 +511,7 @@ void autocomplete_directory(struct bContext *C, char *str, void *arg_v) } } -void autocomplete_file(struct bContext *C, char *str, void *arg_v) +void autocomplete_file(struct bContext *C, char *str, void *UNUSED(arg_v)) { SpaceFile *sfile= CTX_wm_space_file(C); diff --git a/source/blender/editors/space_file/space_file.c b/source/blender/editors/space_file/space_file.c index 0cd721964bd..92244165dc1 100644 --- a/source/blender/editors/space_file/space_file.c +++ b/source/blender/editors/space_file/space_file.c @@ -66,7 +66,7 @@ /* ******************** default callbacks for file space ***************** */ -static SpaceLink *file_new(const bContext *C) +static SpaceLink *file_new(const bContext *UNUSED(C)) { ARegion *ar; SpaceFile *sfile; @@ -143,7 +143,7 @@ static void file_free(SpaceLink *sl) /* spacetype; init callback, area size changes, screen set, etc */ -static void file_init(struct wmWindowManager *wm, ScrArea *sa) +static void file_init(struct wmWindowManager *UNUSED(wm), ScrArea *sa) { SpaceFile *sfile= (SpaceFile*)sa->spacedata.first; //printf("file_init\n"); @@ -178,7 +178,7 @@ static SpaceLink *file_duplicate(SpaceLink *sl) return (SpaceLink *)sfilen; } -static void file_refresh(const bContext *C, ScrArea *sa) +static void file_refresh(const bContext *C, ScrArea *UNUSED(sa)) { SpaceFile *sfile= CTX_wm_space_file(C); FileSelectParams *params = ED_fileselect_get_params(sfile); @@ -335,7 +335,7 @@ static void file_main_area_draw(const bContext *C, ARegion *ar) file_calc_previews(C, ar); /* set view */ - UI_view2d_view_ortho(C, v2d); + UI_view2d_view_ortho(v2d); /* on first read, find active file */ if (params->active_file == -1) { @@ -457,7 +457,7 @@ static void file_channel_area_draw(const bContext *C, ARegion *ar) ED_region_panels(C, ar, 1, NULL, -1); } -static void file_channel_area_listener(ARegion *ar, wmNotifier *wmn) +static void file_channel_area_listener(ARegion *UNUSED(ar), wmNotifier *wmn) { /* context changes */ switch(wmn->category) { @@ -505,7 +505,7 @@ static void file_ui_area_draw(const bContext *C, ARegion *ar) glClear(GL_COLOR_BUFFER_BIT); /* set view2d view matrix for scrolling (without scrollers) */ - UI_view2d_view_ortho(C, &ar->v2d); + UI_view2d_view_ortho(&ar->v2d); file_draw_buttons(C, ar); diff --git a/source/blender/editors/space_file/writeimage.c b/source/blender/editors/space_file/writeimage.c index b69bfdc0231..750cf98727a 100644 --- a/source/blender/editors/space_file/writeimage.c +++ b/source/blender/editors/space_file/writeimage.c @@ -41,6 +41,7 @@ #include "BKE_context.h" #include "BKE_global.h" +#include "BKE_main.h" #include "BKE_image.h" #include "RE_pipeline.h" @@ -48,10 +49,10 @@ #include "file_intern.h" /* XXX */ -static void error(const char *dummy) {} -static void waitcursor(int val) {} -static void activate_fileselect(int d1, char *d2, char *d3, void *d4) {} -static int saveover(const char *dummy) {return 0;} +static void error(const char *UNUSED(dummy)) {} +static void waitcursor(int UNUSED(val)) {} +static void activate_fileselect(int UNUSED(d1), char *UNUSED(d2), char *UNUSED(d3), void *UNUSED(d4)) {} +static int saveover(const char *UNUSED(dummy)) {return 0;} /* XXX */ @@ -75,7 +76,7 @@ static void save_rendered_image_cb_real(char *name, int confirm) BKE_add_image_extension(name, scene->r.imtype); strcpy(str, name); - BLI_path_abs(str, G.sce); + BLI_path_abs(str, G.main->name); if (confirm) overwrite = saveover(str); @@ -99,7 +100,7 @@ static void save_rendered_image_cb_real(char *name, int confirm) waitcursor(1); /* from screen.c */ - ibuf= IMB_allocImBuf(rres.rectx, rres.recty, scene->r.planes, 0, 0); + ibuf= IMB_allocImBuf(rres.rectx, rres.recty, scene->r.planes, 0); ibuf->rect= (unsigned int *)rres.rect32; ibuf->rect_float= rres.rectf; ibuf->zbuf_float= rres.rectz; @@ -218,7 +219,7 @@ void BIF_save_rendered_image_fs(Scene *scene) char dir[FILE_MAXDIR * 2], str[FILE_MAXFILE * 2]; if(G.ima[0]==0) { - strcpy(dir, G.sce); + strcpy(dir, G.main->name); BLI_splitdirstring(dir, str); strcpy(G.ima, dir); } diff --git a/source/blender/editors/space_graph/graph_buttons.c b/source/blender/editors/space_graph/graph_buttons.c index f4567255b91..dd3672b656a 100644 --- a/source/blender/editors/space_graph/graph_buttons.c +++ b/source/blender/editors/space_graph/graph_buttons.c @@ -76,7 +76,7 @@ /* -------------- */ -static void do_graph_region_buttons(bContext *C, void *arg, int event) +static void do_graph_region_buttons(bContext *UNUSED(C), void *UNUSED(arg), int event) { //Scene *scene= CTX_data_scene(C); @@ -116,7 +116,7 @@ static int graph_panel_context(const bContext *C, bAnimListElem **ale, FCurve ** return 1; } -static int graph_panel_poll(const bContext *C, PanelType *pt) +static int graph_panel_poll(const bContext *C, PanelType *UNUSED(pt)) { return graph_panel_context(C, NULL, NULL); } @@ -288,7 +288,7 @@ static void graph_panel_key_properties(const bContext *C, Panel *pa) #define B_IPO_DEPCHANGE 10 -static void do_graph_region_driver_buttons(bContext *C, void *arg, int event) +static void do_graph_region_driver_buttons(bContext *C, void *UNUSED(arg), int event) { Main *bmain= CTX_data_main(C); Scene *scene= CTX_data_scene(C); @@ -310,7 +310,7 @@ static void do_graph_region_driver_buttons(bContext *C, void *arg, int event) } /* callback to remove the active driver */ -static void driver_remove_cb (bContext *C, void *ale_v, void *dummy_v) +static void driver_remove_cb (bContext *UNUSED(C), void *ale_v, void *UNUSED(arg)) { bAnimListElem *ale= (bAnimListElem *)ale_v; ID *id= ale->id; @@ -325,7 +325,7 @@ static void driver_remove_cb (bContext *C, void *ale_v, void *dummy_v) } /* callback to add a target variable to the active driver */ -static void driver_add_var_cb (bContext *C, void *driver_v, void *dummy_v) +static void driver_add_var_cb (bContext *UNUSED(C), void *driver_v, void *UNUSED(arg)) { ChannelDriver *driver= (ChannelDriver *)driver_v; @@ -334,7 +334,7 @@ static void driver_add_var_cb (bContext *C, void *driver_v, void *dummy_v) } /* callback to remove target variable from active driver */ -static void driver_delete_var_cb (bContext *C, void *driver_v, void *dvar_v) +static void driver_delete_var_cb (bContext *UNUSED(C), void *driver_v, void *dvar_v) { ChannelDriver *driver= (ChannelDriver *)driver_v; DriverVar *dvar= (DriverVar *)dvar_v; @@ -344,7 +344,7 @@ static void driver_delete_var_cb (bContext *C, void *driver_v, void *dvar_v) } /* callback to reset the driver's flags */ -static void driver_update_flags_cb (bContext *C, void *fcu_v, void *dummy_v) +static void driver_update_flags_cb (bContext *UNUSED(C), void *fcu_v, void *UNUSED(arg)) { FCurve *fcu= (FCurve *)fcu_v; ChannelDriver *driver= fcu->driver; @@ -355,7 +355,7 @@ static void driver_update_flags_cb (bContext *C, void *fcu_v, void *dummy_v) } /* drivers panel poll */ -static int graph_panel_drivers_poll(const bContext *C, PanelType *pt) +static int graph_panel_drivers_poll(const bContext *C, PanelType *UNUSED(pt)) { SpaceIpo *sipo= CTX_wm_space_graph(C); @@ -365,9 +365,8 @@ static int graph_panel_drivers_poll(const bContext *C, PanelType *pt) return graph_panel_context(C, NULL, NULL); } - /* settings for 'single property' driver variable type */ -static void graph_panel_driverVar__singleProp(const bContext *C, uiLayout *layout, ID *id, DriverVar *dvar) +static void graph_panel_driverVar__singleProp(uiLayout *layout, ID *id, DriverVar *dvar) { DriverTarget *dtar= &dvar->targets[0]; PointerRNA dtar_ptr; @@ -379,7 +378,7 @@ static void graph_panel_driverVar__singleProp(const bContext *C, uiLayout *layou /* Target ID */ row= uiLayoutRow(layout, 0); - uiTemplateAnyID(row, (bContext *)C, &dtar_ptr, "id", "id_type", "Prop:"); + uiTemplateAnyID(row, &dtar_ptr, "id", "id_type", "Prop:"); /* Target Property */ // TODO: make this less technical... @@ -392,12 +391,12 @@ static void graph_panel_driverVar__singleProp(const bContext *C, uiLayout *layou col= uiLayoutColumn(layout, 1); block= uiLayoutGetBlock(col); /* rna path */ - uiTemplatePathBuilder(col, (bContext *)C, &dtar_ptr, "data_path", &root_ptr, "Path"); + uiTemplatePathBuilder(col, &dtar_ptr, "data_path", &root_ptr, "Path"); } } /* settings for 'rotation difference' driver variable type */ -static void graph_panel_driverVar__rotDiff(const bContext *C, uiLayout *layout, ID *id, DriverVar *dvar) +static void graph_panel_driverVar__rotDiff(uiLayout *layout, ID *id, DriverVar *dvar) { DriverTarget *dtar= &dvar->targets[0]; DriverTarget *dtar2= &dvar->targets[1]; @@ -412,7 +411,7 @@ static void graph_panel_driverVar__rotDiff(const bContext *C, uiLayout *layout, /* Bone 1 */ col= uiLayoutColumn(layout, 1); - uiTemplateAnyID(col, (bContext *)C, &dtar_ptr, "id", "id_type", "Bone 1:"); + uiTemplateAnyID(col, &dtar_ptr, "id", "id_type", "Bone 1:"); if (dtar->id && ob1->pose) { PointerRNA tar_ptr; @@ -422,7 +421,7 @@ static void graph_panel_driverVar__rotDiff(const bContext *C, uiLayout *layout, } col= uiLayoutColumn(layout, 1); - uiTemplateAnyID(col, (bContext *)C, &dtar2_ptr, "id", "id_type", "Bone 2:"); + uiTemplateAnyID(col, &dtar2_ptr, "id", "id_type", "Bone 2:"); if (dtar2->id && ob2->pose) { PointerRNA tar_ptr; @@ -433,7 +432,7 @@ static void graph_panel_driverVar__rotDiff(const bContext *C, uiLayout *layout, } /* settings for 'location difference' driver variable type */ -static void graph_panel_driverVar__locDiff(const bContext *C, uiLayout *layout, ID *id, DriverVar *dvar) +static void graph_panel_driverVar__locDiff(uiLayout *layout, ID *id, DriverVar *dvar) { DriverTarget *dtar= &dvar->targets[0]; DriverTarget *dtar2= &dvar->targets[1]; @@ -448,7 +447,7 @@ static void graph_panel_driverVar__locDiff(const bContext *C, uiLayout *layout, /* Bone 1 */ col= uiLayoutColumn(layout, 1); - uiTemplateAnyID(col, (bContext *)C, &dtar_ptr, "id", "id_type", "Ob/Bone 1:"); + uiTemplateAnyID(col, &dtar_ptr, "id", "id_type", "Ob/Bone 1:"); if (dtar->id && ob1->pose) { PointerRNA tar_ptr; @@ -460,7 +459,7 @@ static void graph_panel_driverVar__locDiff(const bContext *C, uiLayout *layout, uiItemR(col, &dtar_ptr, "use_local_space_transform", 0, NULL, 0); col= uiLayoutColumn(layout, 1); - uiTemplateAnyID(col, (bContext *)C, &dtar2_ptr, "id", "id_type", "Ob/Bone 2:"); + uiTemplateAnyID(col, &dtar2_ptr, "id", "id_type", "Ob/Bone 2:"); if (dtar2->id && ob2->pose) { PointerRNA tar_ptr; @@ -473,7 +472,7 @@ static void graph_panel_driverVar__locDiff(const bContext *C, uiLayout *layout, } /* settings for 'transform channel' driver variable type */ -static void graph_panel_driverVar__transChan(const bContext *C, uiLayout *layout, ID *id, DriverVar *dvar) +static void graph_panel_driverVar__transChan(uiLayout *layout, ID *id, DriverVar *dvar) { DriverTarget *dtar= &dvar->targets[0]; Object *ob = (Object *)dtar->id; @@ -485,7 +484,7 @@ static void graph_panel_driverVar__transChan(const bContext *C, uiLayout *layout /* properties */ col= uiLayoutColumn(layout, 1); - uiTemplateAnyID(col, (bContext *)C, &dtar_ptr, "id", "id_type", "Ob/Bone:"); + uiTemplateAnyID(col, &dtar_ptr, "id", "id_type", "Ob/Bone:"); if (dtar->id && ob->pose) { PointerRNA tar_ptr; @@ -606,16 +605,16 @@ static void graph_panel_drivers(const bContext *C, Panel *pa) /* controls to draw depends on the type of variable */ switch (dvar->type) { case DVAR_TYPE_SINGLE_PROP: /* single property */ - graph_panel_driverVar__singleProp(C, box, ale->id, dvar); + graph_panel_driverVar__singleProp(box, ale->id, dvar); break; case DVAR_TYPE_ROT_DIFF: /* rotational difference */ - graph_panel_driverVar__rotDiff(C, box, ale->id, dvar); + graph_panel_driverVar__rotDiff(box, ale->id, dvar); break; case DVAR_TYPE_LOC_DIFF: /* location difference */ - graph_panel_driverVar__locDiff(C, box, ale->id, dvar); + graph_panel_driverVar__locDiff(box, ale->id, dvar); break; case DVAR_TYPE_TRANSFORM_CHAN: /* transform channel */ - graph_panel_driverVar__transChan(C, box, ale->id, dvar); + graph_panel_driverVar__transChan(box, ale->id, dvar); break; } @@ -642,7 +641,7 @@ static void graph_panel_drivers(const bContext *C, Panel *pa) #define B_FMODIFIER_REDRAW 20 -static void do_graph_region_modifier_buttons(bContext *C, void *arg, int event) +static void do_graph_region_modifier_buttons(bContext *C, void *UNUSED(arg), int event) { switch (event) { case B_REDR: @@ -733,7 +732,7 @@ void graph_buttons_register(ARegionType *art) BLI_addtail(&art->paneltypes, pt); } -static int graph_properties(bContext *C, wmOperator *op) +static int graph_properties(bContext *C, wmOperator *UNUSED(op)) { ScrArea *sa= CTX_wm_area(C); ARegion *ar= graph_has_buttons_region(sa); diff --git a/source/blender/editors/space_graph/graph_draw.c b/source/blender/editors/space_graph/graph_draw.c index f780a6c31ee..01a8ba4797c 100644 --- a/source/blender/editors/space_graph/graph_draw.c +++ b/source/blender/editors/space_graph/graph_draw.c @@ -87,7 +87,7 @@ /* Envelope -------------- */ // TODO: draw a shaded poly showing the region of influence too!!! -static void draw_fcurve_modifier_controls_envelope (FCurve *fcu, FModifier *fcm, View2D *v2d) +static void draw_fcurve_modifier_controls_envelope (FModifier *fcm, View2D *v2d) { FMod_Envelope *env= (FMod_Envelope *)fcm->data; FCM_EnvelopeData *fed; @@ -137,7 +137,7 @@ static void draw_fcurve_modifier_controls_envelope (FCurve *fcu, FModifier *fcm, /* Points ---------------- */ /* helper func - draw keyframe vertices only for an F-Curve */ -static void draw_fcurve_vertices_keyframes (bAnimContext *ac, FCurve *fcu, View2D *v2d, short edit, short sel) +static void draw_fcurve_vertices_keyframes (FCurve *fcu, View2D *v2d, short edit, short sel) { BezTriple *bezt= fcu->bezt; const float fac= 0.05f * (v2d->cur.xmax - v2d->cur.xmin); @@ -209,7 +209,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 (bAnimContext *ac, SpaceIpo *sipo, FCurve *fcu, View2D *v2d, short sel) +static void draw_fcurve_vertices_handles (FCurve *fcu, View2D *v2d, short sel, short sel_handle_only) { BezTriple *bezt= fcu->bezt; BezTriple *prevbezt = NULL; @@ -237,7 +237,7 @@ static void draw_fcurve_vertices_handles (bAnimContext *ac, SpaceIpo *sipo, FCur * Also, need to take into account whether the keyframe was selected * if a Graph Editor option to only show handles of selected keys is on. */ - if ( !(sipo->flag & SIPO_SELVHANDLESONLY) || BEZSELECTED(bezt) ) { + if ( !sel_handle_only || BEZSELECTED(bezt) ) { if ( (!prevbezt && (bezt->ipo==BEZT_IPO_BEZ)) || (prevbezt && (prevbezt->ipo==BEZT_IPO_BEZ)) ) { if ((bezt->f1 & SELECT) == sel)/* && v2d->cur.xmin < bezt->vec[0][0] < v2d->cur.xmax)*/ draw_fcurve_handle_control(bezt->vec[0][0], bezt->vec[0][1], xscale, yscale, hsize); @@ -255,7 +255,7 @@ static void draw_fcurve_vertices_handles (bAnimContext *ac, SpaceIpo *sipo, FCur } /* helper func - set color to draw F-Curve data with */ -static void set_fcurve_vertex_color (SpaceIpo *sipo, FCurve *fcu, short sel) +static void set_fcurve_vertex_color (FCurve *fcu, short sel) { /* Fade the 'intensity' of the vertices based on the selection of the curves too */ int alphaOffset= (int)((drawFCurveFade(fcu) - 1.0f) * 255); @@ -274,7 +274,7 @@ static void set_fcurve_vertex_color (SpaceIpo *sipo, FCurve *fcu, short sel) } -static void draw_fcurve_vertices (bAnimContext *ac, SpaceIpo *sipo, ARegion *ar, FCurve *fcu, int do_handles) +static void draw_fcurve_vertices (ARegion *ar, FCurve *fcu, short do_handles, short sel_handle_only) { View2D *v2d= &ar->v2d; @@ -290,19 +290,19 @@ static void draw_fcurve_vertices (bAnimContext *ac, SpaceIpo *sipo, ARegion *ar, /* draw the two handles first (if they're shown, the curve doesn't have just a single keyframe, and the curve is being edited) */ if (do_handles) { - set_fcurve_vertex_color(sipo, fcu, 0); - draw_fcurve_vertices_handles(ac, sipo, fcu, v2d, 0); + set_fcurve_vertex_color(fcu, 0); + draw_fcurve_vertices_handles(fcu, v2d, 0, sel_handle_only); - set_fcurve_vertex_color(sipo, fcu, 1); - draw_fcurve_vertices_handles(ac, sipo, fcu, v2d, 1); + set_fcurve_vertex_color(fcu, 1); + draw_fcurve_vertices_handles(fcu, v2d, 1, sel_handle_only); } /* draw keyframes over the handles */ - set_fcurve_vertex_color(sipo, fcu, 0); - draw_fcurve_vertices_keyframes(ac, fcu, v2d, !(fcu->flag & FCURVE_PROTECTED), 0); + set_fcurve_vertex_color(fcu, 0); + draw_fcurve_vertices_keyframes(fcu, v2d, !(fcu->flag & FCURVE_PROTECTED), 0); - set_fcurve_vertex_color(sipo, fcu, 1); - draw_fcurve_vertices_keyframes(ac, fcu, v2d, !(fcu->flag & FCURVE_PROTECTED), 1); + set_fcurve_vertex_color(fcu, 1); + draw_fcurve_vertices_keyframes(fcu, v2d, !(fcu->flag & FCURVE_PROTECTED), 1); glPointSize(1.0f); } @@ -329,7 +329,7 @@ static int draw_fcurve_handles_check(SpaceIpo *sipo, FCurve *fcu) /* draw lines for F-Curve handles only (this is only done in EditMode) * note: draw_fcurve_handles_check must be checked before running this. */ -static void draw_fcurve_handles (bAnimContext *ac, SpaceIpo *sipo, ARegion *ar, FCurve *fcu) +static void draw_fcurve_handles (SpaceIpo *sipo, FCurve *fcu) { int sel, b; @@ -455,7 +455,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 (bAnimContext *ac, SpaceIpo *sipo, ARegion *ar, FCurve *fcu) +static void draw_fcurve_samples (ARegion *ar, FCurve *fcu) { FPoint *first, *last; float hsize, xscale, yscale; @@ -489,7 +489,7 @@ static void draw_fcurve_samples (bAnimContext *ac, SpaceIpo *sipo, ARegion *ar, /* Curve ---------------- */ /* helper func - just draw the F-Curve by sampling the visible region (for drawing curves with modifiers) */ -static void draw_fcurve_curve (bAnimContext *ac, ID *id, FCurve *fcu, SpaceIpo *sipo, View2D *v2d, View2DGrid *grid) +static void draw_fcurve_curve (bAnimContext *ac, ID *id, FCurve *fcu, View2D *v2d, View2DGrid *grid) { ChannelDriver *driver; float samplefreq, ctime; @@ -627,7 +627,7 @@ static void draw_fcurve_curve_samples (bAnimContext *ac, ID *id, FCurve *fcu, Vi } /* helper func - draw one repeat of an F-Curve */ -static void draw_fcurve_curve_bezts (bAnimContext *ac, ID *id, FCurve *fcu, View2D *v2d, View2DGrid *grid) +static void draw_fcurve_curve_bezts (bAnimContext *ac, ID *id, FCurve *fcu, View2D *v2d) { BezTriple *prevbezt= fcu->bezt; BezTriple *bezt= prevbezt+1; @@ -784,7 +784,7 @@ static void draw_fcurve_curve_bezts (bAnimContext *ac, ID *id, FCurve *fcu, View /* Draw the 'ghost' F-Curves (i.e. snapshots of the curve) * NOTE: unit mapping has already been applied to the values, so do not try and apply again */ -void graph_draw_ghost_curves (bAnimContext *ac, SpaceIpo *sipo, ARegion *ar, View2DGrid *grid) +void graph_draw_ghost_curves (bAnimContext *ac, SpaceIpo *sipo, ARegion *ar) { FCurve *fcu; @@ -878,12 +878,12 @@ void graph_draw_curves (bAnimContext *ac, SpaceIpo *sipo, ARegion *ar, View2DGri /* draw a curve affected by modifiers or only allowed to have integer values * by sampling it at various small-intervals over the visible region */ - draw_fcurve_curve(ac, ale->id, fcu, sipo, &ar->v2d, grid); + draw_fcurve_curve(ac, ale->id, fcu, &ar->v2d, grid); } else if ( ((fcu->bezt) || (fcu->fpt)) && (fcu->totvert) ) { /* just draw curve based on defined data (i.e. no modifiers) */ if (fcu->bezt) - draw_fcurve_curve_bezts(ac, ale->id, fcu, &ar->v2d, grid); + draw_fcurve_curve_bezts(ac, ale->id, fcu, &ar->v2d); else if (fcu->fpt) draw_fcurve_curve_samples(ac, ale->id, fcu, &ar->v2d); } @@ -904,7 +904,7 @@ void graph_draw_curves (bAnimContext *ac, SpaceIpo *sipo, ARegion *ar, View2DGri if ((fcu->flag & FCURVE_ACTIVE) && (fcm)) { switch (fcm->type) { case FMODIFIER_TYPE_ENVELOPE: /* envelope */ - draw_fcurve_modifier_controls_envelope(fcu, fcm, &ar->v2d); + draw_fcurve_modifier_controls_envelope(fcm, &ar->v2d); break; } } @@ -919,15 +919,15 @@ void graph_draw_curves (bAnimContext *ac, SpaceIpo *sipo, ARegion *ar, View2DGri if (do_handles) { /* only draw handles/vertices on keyframes */ glEnable(GL_BLEND); - draw_fcurve_handles(ac, sipo, ar, fcu); + draw_fcurve_handles(sipo, fcu); glDisable(GL_BLEND); } - draw_fcurve_vertices(ac, sipo, ar, fcu, do_handles); + draw_fcurve_vertices(ar, fcu, do_handles, sipo->flag&SIPO_SELVHANDLESONLY); } else { /* samples: only draw two indicators at either end as indicators */ - draw_fcurve_samples(ac, sipo, ar, fcu); + draw_fcurve_samples(ar, fcu); } /* unapply unit mapping */ @@ -948,7 +948,7 @@ void graph_draw_curves (bAnimContext *ac, SpaceIpo *sipo, ARegion *ar, View2DGri /* Channel List */ /* left hand part */ -void graph_draw_channel_names(bContext *C, bAnimContext *ac, SpaceIpo *sipo, ARegion *ar) +void graph_draw_channel_names(bContext *C, bAnimContext *ac, ARegion *ar) { ListBase anim_data = {NULL, NULL}; bAnimListElem *ale; diff --git a/source/blender/editors/space_graph/graph_edit.c b/source/blender/editors/space_graph/graph_edit.c index 5c692ba1112..e1d1e4194d5 100644 --- a/source/blender/editors/space_graph/graph_edit.c +++ b/source/blender/editors/space_graph/graph_edit.c @@ -140,7 +140,7 @@ void get_graph_keyframe_extents (bAnimContext *ac, float *xmin, float *xmax, flo /* ****************** Automatic Preview-Range Operator ****************** */ -static int graphkeys_previewrange_exec(bContext *C, wmOperator *op) +static int graphkeys_previewrange_exec(bContext *C, wmOperator *UNUSED(op)) { bAnimContext ac; Scene *scene; @@ -183,7 +183,7 @@ void GRAPH_OT_previewrange_set (wmOperatorType *ot) /* ****************** View-All Operator ****************** */ -static int graphkeys_viewall_exec(bContext *C, wmOperator *op) +static int graphkeys_viewall_exec(bContext *C, wmOperator *UNUSED(op)) { bAnimContext ac; View2D *v2d; @@ -305,7 +305,7 @@ static void create_ghost_curves (bAnimContext *ac, int start, int end) /* ------------------- */ -static int graphkeys_create_ghostcurves_exec(bContext *C, wmOperator *op) +static int graphkeys_create_ghostcurves_exec(bContext *C, wmOperator *UNUSED(op)) { bAnimContext ac; View2D *v2d; @@ -349,7 +349,7 @@ void GRAPH_OT_ghost_curves_create (wmOperatorType *ot) /* ******************** Clear Ghost-Curves Operator *********************** */ /* This operator clears the 'ghost curves' for the active Graph Editor */ -static int graphkeys_clear_ghostcurves_exec(bContext *C, wmOperator *op) +static int graphkeys_clear_ghostcurves_exec(bContext *C, wmOperator *UNUSED(op)) { bAnimContext ac; SpaceIpo *sipo; @@ -719,7 +719,7 @@ static void duplicate_graph_keys (bAnimContext *ac) /* ------------------- */ -static int graphkeys_duplicate_exec(bContext *C, wmOperator *op) +static int graphkeys_duplicate_exec(bContext *C, wmOperator *UNUSED(op)) { bAnimContext ac; @@ -739,7 +739,7 @@ static int graphkeys_duplicate_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -static int graphkeys_duplicate_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int graphkeys_duplicate_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { graphkeys_duplicate_exec(C, op); @@ -799,7 +799,7 @@ static void delete_graph_keys (bAnimContext *ac) /* ------------------- */ -static int graphkeys_delete_exec(bContext *C, wmOperator *op) +static int graphkeys_delete_exec(bContext *C, wmOperator *UNUSED(op)) { bAnimContext ac; @@ -935,7 +935,7 @@ static void bake_graph_curves (bAnimContext *ac, int start, int end) /* ------------------- */ -static int graphkeys_bake_exec(bContext *C, wmOperator *op) +static int graphkeys_bake_exec(bContext *C, wmOperator *UNUSED(op)) { bAnimContext ac; Scene *scene= NULL; @@ -1001,7 +1001,7 @@ typedef struct tSoundBakeInfo { /* Sampling callback used to determine the value from the sound to * save in the F-Curve at the specified frame */ -static float fcurve_samplingcb_sound (FCurve *fcu, void *data, float evaltime) +static float fcurve_samplingcb_sound (FCurve *UNUSED(fcu), void *data, float evaltime) { tSoundBakeInfo *sbi= (tSoundBakeInfo *)data; @@ -1149,7 +1149,7 @@ static void sample_graph_keys (bAnimContext *ac) /* ------------------- */ -static int graphkeys_sample_exec(bContext *C, wmOperator *op) +static int graphkeys_sample_exec(bContext *C, wmOperator *UNUSED(op)) { bAnimContext ac; @@ -1205,7 +1205,7 @@ static void setexpo_graph_keys(bAnimContext *ac, short mode) int filter; /* filter data */ - filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVEVISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_CURVESONLY | ANIMFILTER_NODUPLIS); + filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVEVISIBLE | ANIMFILTER_SEL | ANIMFILTER_FOREDIT | ANIMFILTER_CURVESONLY | ANIMFILTER_NODUPLIS); ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype); /* loop through setting mode per F-Curve */ @@ -1530,7 +1530,7 @@ void GRAPH_OT_euler_filter (wmOperatorType *ot) /* ***************** Jump to Selected Frames Operator *********************** */ /* snap current-frame indicator to 'average time' of selected keyframe */ -static int graphkeys_framejump_exec(bContext *C, wmOperator *op) +static int graphkeys_framejump_exec(bContext *C, wmOperator *UNUSED(op)) { bAnimContext ac; ListBase anim_data= {NULL, NULL}; @@ -1835,7 +1835,7 @@ void GRAPH_OT_mirror (wmOperatorType *ot) /* ******************** Smooth Keyframes Operator *********************** */ -static int graphkeys_smooth_exec(bContext *C, wmOperator *op) +static int graphkeys_smooth_exec(bContext *C, wmOperator *UNUSED(op)) { bAnimContext ac; ListBase anim_data = {NULL, NULL}; @@ -1890,7 +1890,7 @@ void GRAPH_OT_smooth (wmOperatorType *ot) /* ******************** Add F-Modifier Operator *********************** */ /* present a special customised popup menu for this, with some filtering */ -static int graph_fmodifier_add_invoke (bContext *C, wmOperator *op, wmEvent *event) +static int graph_fmodifier_add_invoke (bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { uiPopupMenu *pup; uiLayout *layout; diff --git a/source/blender/editors/space_graph/graph_intern.h b/source/blender/editors/space_graph/graph_intern.h index a637ed15fcd..560dabbb634 100644 --- a/source/blender/editors/space_graph/graph_intern.h +++ b/source/blender/editors/space_graph/graph_intern.h @@ -48,10 +48,10 @@ struct ARegion *graph_has_buttons_region(struct ScrArea *sa); /* ***************************************** */ /* graph_draw.c */ -void graph_draw_channel_names(struct bContext *C, struct bAnimContext *ac, struct SpaceIpo *sipo, struct ARegion *ar); +void graph_draw_channel_names(struct bContext *C, struct bAnimContext *ac, struct ARegion *ar); void graph_draw_curves(struct bAnimContext *ac, struct SpaceIpo *sipo, struct ARegion *ar, struct View2DGrid *grid, short sel); -void graph_draw_ghost_curves(struct bAnimContext *ac, struct SpaceIpo *sipo, struct ARegion *ar, struct View2DGrid *grid); +void graph_draw_ghost_curves(struct bAnimContext *ac, struct SpaceIpo *sipo, struct ARegion *ar); /* ***************************************** */ /* graph_header.c */ diff --git a/source/blender/editors/space_graph/graph_ops.c b/source/blender/editors/space_graph/graph_ops.c index 0069e6e0675..b4ca1b8c901 100644 --- a/source/blender/editors/space_graph/graph_ops.c +++ b/source/blender/editors/space_graph/graph_ops.c @@ -181,7 +181,7 @@ void GRAPH_OT_cursor_set(wmOperatorType *ot) /* Toggle Handles ----------------------------------------------------------------- */ -static int view_toggle_handles_exec (bContext *C, wmOperator *op) +static int view_toggle_handles_exec (bContext *C, wmOperator *UNUSED(op)) { SpaceIpo *sipo= CTX_wm_space_graph(C); ARegion *ar= CTX_wm_region(C); diff --git a/source/blender/editors/space_graph/graph_select.c b/source/blender/editors/space_graph/graph_select.c index cdc8166f2d6..0aa0a87dbac 100644 --- a/source/blender/editors/space_graph/graph_select.c +++ b/source/blender/editors/space_graph/graph_select.c @@ -539,7 +539,7 @@ void GRAPH_OT_select_column (wmOperatorType *ot) /* ******************** Select Linked Operator *********************** */ -static int graphkeys_select_linked_exec (bContext *C, wmOperator *op) +static int graphkeys_select_linked_exec (bContext *C, wmOperator *UNUSED(op)) { bAnimContext ac; @@ -638,7 +638,7 @@ static void select_moreless_graph_keys (bAnimContext *ac, short mode) /* ----------------- */ -static int graphkeys_select_more_exec (bContext *C, wmOperator *op) +static int graphkeys_select_more_exec (bContext *C, wmOperator *UNUSED(op)) { bAnimContext ac; @@ -672,7 +672,7 @@ void GRAPH_OT_select_more (wmOperatorType *ot) /* ----------------- */ -static int graphkeys_select_less_exec (bContext *C, wmOperator *op) +static int graphkeys_select_less_exec (bContext *C, wmOperator *UNUSED(op)) { bAnimContext ac; @@ -886,7 +886,7 @@ static void get_nearest_fcurve_verts_list (bAnimContext *ac, int mval[2], ListBa } /* helper for find_nearest_fcurve_vert() - get the best match to use */ -static tNearestVertInfo *get_best_nearest_fcurve_vert (bAnimContext *ac, ListBase *matches) +static tNearestVertInfo *get_best_nearest_fcurve_vert (ListBase *matches) { tNearestVertInfo *nvi = NULL; short found = 0; @@ -941,7 +941,7 @@ static tNearestVertInfo *find_nearest_fcurve_vert (bAnimContext *ac, int mval[2] get_nearest_fcurve_verts_list(ac, mval, &matches); /* step 2: find the best vert */ - nvi= get_best_nearest_fcurve_vert(ac, &matches); + nvi= get_best_nearest_fcurve_vert(&matches); BLI_freelistN(&matches); diff --git a/source/blender/editors/space_graph/space_graph.c b/source/blender/editors/space_graph/space_graph.c index ca372d74da6..ff2d233ccdb 100644 --- a/source/blender/editors/space_graph/space_graph.c +++ b/source/blender/editors/space_graph/space_graph.c @@ -175,7 +175,7 @@ static void graph_free(SpaceLink *sl) /* spacetype; init callback */ -static void graph_init(struct wmWindowManager *wm, ScrArea *sa) +static void graph_init(struct wmWindowManager *UNUSED(wm), ScrArea *sa) { SpaceIpo *sipo= (SpaceIpo *)sa->spacedata.first; @@ -229,17 +229,17 @@ static void graph_main_area_draw(const bContext *C, ARegion *ar) glClearColor(col[0], col[1], col[2], 0.0); glClear(GL_COLOR_BUFFER_BIT); - UI_view2d_view_ortho(C, v2d); + UI_view2d_view_ortho(v2d); /* grid */ unitx= (sipo->flag & SIPO_DRAWTIME)? V2D_UNIT_SECONDS : V2D_UNIT_FRAMESCALE; - grid= UI_view2d_grid_calc(C, v2d, unitx, V2D_GRID_NOCLAMP, unity, V2D_GRID_NOCLAMP, ar->winx, ar->winy); - UI_view2d_grid_draw(C, v2d, grid, V2D_GRIDLINES_ALL); + grid= UI_view2d_grid_calc(CTX_data_scene(C), v2d, unitx, V2D_GRID_NOCLAMP, unity, V2D_GRID_NOCLAMP, ar->winx, ar->winy); + UI_view2d_grid_draw(v2d, grid, V2D_GRIDLINES_ALL); /* draw data */ if (ANIM_animdata_get_context(C, &ac)) { /* draw ghost curves */ - graph_draw_ghost_curves(&ac, sipo, ar, grid); + graph_draw_ghost_curves(&ac, sipo, ar); /* draw curves twice - unselected, then selected, so that the are fewer occlusion problems */ graph_draw_curves(&ac, sipo, ar, grid, 0); @@ -282,11 +282,11 @@ static void graph_main_area_draw(const bContext *C, ARegion *ar) ANIM_draw_cfra(C, v2d, flag); /* markers */ - UI_view2d_view_orthoSpecial(C, v2d, 1); + UI_view2d_view_orthoSpecial(ar, v2d, 1); draw_markers_time(C, 0); /* preview range */ - UI_view2d_view_ortho(C, v2d); + UI_view2d_view_ortho(v2d); ANIM_draw_previewrange(C, v2d); /* reset view matrix */ @@ -314,7 +314,6 @@ static void graph_channel_area_init(wmWindowManager *wm, ARegion *ar) static void graph_channel_area_draw(const bContext *C, ARegion *ar) { - SpaceIpo *sipo= CTX_wm_space_graph(C); bAnimContext ac; View2D *v2d= &ar->v2d; View2DScrollers *scrollers; @@ -325,11 +324,11 @@ static void graph_channel_area_draw(const bContext *C, ARegion *ar) glClearColor(col[0], col[1], col[2], 0.0); glClear(GL_COLOR_BUFFER_BIT); - UI_view2d_view_ortho(C, v2d); + UI_view2d_view_ortho(v2d); /* draw channels */ if (ANIM_animdata_get_context(C, &ac)) { - graph_draw_channel_names((bContext*)C, &ac, sipo, ar); + graph_draw_channel_names((bContext*)C, &ac, ar); } /* reset view matrix */ @@ -342,7 +341,7 @@ static void graph_channel_area_draw(const bContext *C, ARegion *ar) } /* add handlers, stuff you only do once or on area/region changes */ -static void graph_header_area_init(wmWindowManager *wm, ARegion *ar) +static void graph_header_area_init(wmWindowManager *UNUSED(wm), ARegion *ar) { ED_region_header_init(ar); } diff --git a/source/blender/editors/space_image/CMakeLists.txt b/source/blender/editors/space_image/CMakeLists.txt index d47f5a9820e..750c4b324d6 100644 --- a/source/blender/editors/space_image/CMakeLists.txt +++ b/source/blender/editors/space_image/CMakeLists.txt @@ -41,6 +41,10 @@ IF(WITH_IMAGE_TIFF) ADD_DEFINITIONS(-DWITH_TIFF) ENDIF(WITH_IMAGE_TIFF) +IF(WITH_IMAGE_CINEON) + ADD_DEFINITIONS(-DWITH_CINEON) +ENDIF(WITH_IMAGE_CINEON) + IF(WITH_LCMS) SET(INC ${INC} ${LCMS_INCLUDE_DIR}) ADD_DEFINITIONS(-DWITH_LCMS) diff --git a/source/blender/editors/space_image/SConscript b/source/blender/editors/space_image/SConscript index c7c31352185..15a7aeb828f 100644 --- a/source/blender/editors/space_image/SConscript +++ b/source/blender/editors/space_image/SConscript @@ -16,6 +16,8 @@ if env['WITH_BF_OPENEXR']: defs.append('WITH_OPENEXR') if env['WITH_BF_TIFF']: defs.append('WITH_TIFF') +if env['WITH_BF_CINEON']: + defs.append('WITH_CINEON') if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc'): incs += ' ' + env['BF_PTHREADS_INC'] diff --git a/source/blender/editors/space_image/image_buttons.c b/source/blender/editors/space_image/image_buttons.c index 840d4943c56..bbc8925a152 100644 --- a/source/blender/editors/space_image/image_buttons.c +++ b/source/blender/editors/space_image/image_buttons.c @@ -97,7 +97,7 @@ static void image_editvertex_buts(const bContext *C, uiBlock *block); -static void do_image_panel_events(bContext *C, void *arg, int event) +static void do_image_panel_events(bContext *C, void *UNUSED(arg), int event) { SpaceImage *sima= CTX_wm_space_image(C); @@ -300,7 +300,7 @@ static void image_editvertex_buts(const bContext *C, uiBlock *block) /* is used for both read and write... */ -static int image_panel_poll(const bContext *C, PanelType *pt) +static int image_panel_poll(const bContext *C, PanelType *UNUSED(pt)) { SpaceImage *sima= CTX_wm_space_image(C); ImBuf *ibuf; @@ -493,7 +493,8 @@ static char *slot_menu() return str; } -static char *layer_menu(RenderResult *rr, short *curlay) +/* TODO, curlay should be removed? */ +static char *layer_menu(RenderResult *rr, short *UNUSED(curlay)) { RenderLayer *rl; int len= 64 + 32*BLI_countlist(&rr->layers); @@ -739,7 +740,7 @@ typedef struct RNAUpdateCb { ImageUser *iuser; } RNAUpdateCb; -static void rna_update_cb(bContext *C, void *arg_cb, void *arg_unused) +static void rna_update_cb(bContext *C, void *arg_cb, void *UNUSED(arg)) { RNAUpdateCb *cb= (RNAUpdateCb*)arg_cb; @@ -951,7 +952,7 @@ void uiTemplateImageLayers(uiLayout *layout, bContext *C, Image *ima, ImageUser } } -static int image_panel_uv_poll(const bContext *C, PanelType *pt) +static int image_panel_uv_poll(const bContext *C, PanelType *UNUSED(pt)) { Object *obedit= CTX_data_edit_object(C); return ED_uvedit_test(obedit); @@ -996,7 +997,7 @@ void image_buttons_register(ARegionType *art) BLI_addtail(&art->paneltypes, pt); } -static int image_properties(bContext *C, wmOperator *op) +static int image_properties(bContext *C, wmOperator *UNUSED(op)) { ScrArea *sa= CTX_wm_area(C); ARegion *ar= image_has_buttons_region(sa); @@ -1019,7 +1020,7 @@ void IMAGE_OT_properties(wmOperatorType *ot) ot->flag= 0; } -static int image_scopes(bContext *C, wmOperator *op) +static int image_scopes(bContext *C, wmOperator *UNUSED(op)) { ScrArea *sa= CTX_wm_area(C); ARegion *ar= image_has_scope_region(sa); diff --git a/source/blender/editors/space_image/image_draw.c b/source/blender/editors/space_image/image_draw.c index f29d1bc033f..48524d2728f 100644 --- a/source/blender/editors/space_image/image_draw.c +++ b/source/blender/editors/space_image/image_draw.c @@ -70,7 +70,7 @@ #define HEADER_HEIGHT 18 -static void image_verify_buffer_float(SpaceImage *sima, Image *ima, ImBuf *ibuf, int color_manage) +static void image_verify_buffer_float(Image *ima, ImBuf *ibuf, int color_manage) { /* detect if we need to redo the curve map. ibuf->rect is zero for compositor and render results after change @@ -367,7 +367,7 @@ static void draw_image_buffer(SpaceImage *sima, ARegion *ar, Scene *scene, Image } #ifdef WITH_LCMS else if(sima->flag & SI_COLOR_CORRECTION) { - image_verify_buffer_float(sima, ima, ibuf, color_manage); + image_verify_buffer_float(ima, ibuf, color_manage); if(sima_draw_colorcorrected_pixels(x, y, ibuf)==0) { unsigned char col1[3]= {100, 0, 100}, col2[3]= {160, 0, 160}; /* pink says 'warning' in blender land */ @@ -387,7 +387,7 @@ static void draw_image_buffer(SpaceImage *sima, ARegion *ar, Scene *scene, Image /* we don't draw floats buffers directly but * convert them, and optionally apply curves */ - image_verify_buffer_float(sima, ima, ibuf, color_manage); + image_verify_buffer_float(ima, ibuf, color_manage); if(ibuf->rect) glaDrawPixelsSafe(x, y, ibuf->x, ibuf->y, ibuf->x, GL_RGBA, GL_UNSIGNED_BYTE, ibuf->rect); @@ -440,7 +440,7 @@ static void draw_image_buffer_tiled(SpaceImage *sima, ARegion *ar, Scene *scene, sima->curtile = ima->xrep*ima->yrep - 1; /* create char buffer from float if needed */ - image_verify_buffer_float(sima, ima, ibuf, color_manage); + image_verify_buffer_float(ima, ibuf, color_manage); /* retrieve part of image buffer */ dx= ibuf->x/ima->xrep; @@ -579,7 +579,7 @@ static unsigned char *get_alpha_clone_image(Scene *scene, int *width, int *heigh return rect; } -static void draw_image_paint_helpers(SpaceImage *sima, ARegion *ar, Scene *scene, float zoomx, float zoomy) +static void draw_image_paint_helpers(ARegion *ar, Scene *scene, float zoomx, float zoomy) { Brush *brush; int x, y, w, h; @@ -658,7 +658,7 @@ void draw_image_main(SpaceImage *sima, ARegion *ar, Scene *scene) draw_image_buffer(sima, ar, scene, ima, ibuf, 0.0f, 0.0f, zoomx, zoomy); /* paint helpers */ - draw_image_paint_helpers(sima, ar, scene, zoomx, zoomy); + draw_image_paint_helpers(ar, scene, zoomx, zoomy); /* XXX integrate this code */ diff --git a/source/blender/editors/space_image/image_header.c b/source/blender/editors/space_image/image_header.c index 7ecb2565e72..498b3b80bd5 100644 --- a/source/blender/editors/space_image/image_header.c +++ b/source/blender/editors/space_image/image_header.c @@ -53,7 +53,7 @@ /********************** toolbox operator *********************/ -static int toolbox_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int toolbox_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent *UNUSED(event)) { SpaceImage *sima= CTX_wm_space_image(C); Object *obedit= CTX_data_edit_object(C); diff --git a/source/blender/editors/space_image/image_ops.c b/source/blender/editors/space_image/image_ops.c index 0bcc2439756..429ba64ed0f 100644 --- a/source/blender/editors/space_image/image_ops.c +++ b/source/blender/editors/space_image/image_ops.c @@ -133,7 +133,7 @@ static int space_image_file_exists_poll(bContext *C) ibuf= ED_space_image_acquire_buffer(sima, &lock); if(ibuf) { BLI_strncpy(name, ibuf->name, FILE_MAX); - BLI_path_abs(name, G.sce); + BLI_path_abs(name, G.main->name); poll= (BLI_exists(name) && BLI_is_writable(name)); } ED_space_image_release_buffer(sima, lock); @@ -432,7 +432,7 @@ void IMAGE_OT_view_zoom(wmOperatorType *ot) * Default behavior is to reset the position of the image and set the zoom to 1 * If the image will not fit within the window rectangle, the zoom is adjusted */ -static int view_all_exec(bContext *C, wmOperator *op) +static int view_all_exec(bContext *C, wmOperator *UNUSED(op)) { SpaceImage *sima; ARegion *ar; @@ -486,7 +486,7 @@ void IMAGE_OT_view_all(wmOperatorType *ot) /********************** view selected operator *********************/ -static int view_selected_exec(bContext *C, wmOperator *op) +static int view_selected_exec(bContext *C, wmOperator *UNUSED(op)) { SpaceImage *sima; ARegion *ar; @@ -543,7 +543,7 @@ void IMAGE_OT_view_selected(wmOperatorType *ot) /********************** view zoom in/out operator *********************/ -static int view_zoom_in_exec(bContext *C, wmOperator *op) +static int view_zoom_in_exec(bContext *C, wmOperator *UNUSED(op)) { SpaceImage *sima= CTX_wm_space_image(C); ARegion *ar= CTX_wm_region(C); @@ -566,7 +566,7 @@ void IMAGE_OT_view_zoom_in(wmOperatorType *ot) ot->poll= space_image_main_area_poll; } -static int view_zoom_out_exec(bContext *C, wmOperator *op) +static int view_zoom_out_exec(bContext *C, wmOperator *UNUSED(op)) { SpaceImage *sima= CTX_wm_space_image(C); ARegion *ar= CTX_wm_region(C); @@ -679,7 +679,7 @@ static void open_init(bContext *C, wmOperator *op) uiIDContextProperty(C, &pprop->ptr, &pprop->prop); } -static int open_cancel(bContext *C, wmOperator *op) +static int open_cancel(bContext *UNUSED(C), wmOperator *op) { MEM_freeN(op->customdata); op->customdata= NULL; @@ -701,7 +701,7 @@ static int open_exec(bContext *C, wmOperator *op) errno= 0; - ima= BKE_add_image_file(str, scene ? scene->r.cfra : 1); + ima= BKE_add_image_file(str); if(!ima) { if(op->customdata) MEM_freeN(op->customdata); @@ -736,7 +736,7 @@ static int open_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -static int open_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int open_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { SpaceImage *sima= CTX_wm_space_image(C); char *path=U.textudir; @@ -806,7 +806,7 @@ static int replace_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -static int replace_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int replace_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { SpaceImage *sima= CTX_wm_space_image(C); @@ -856,7 +856,7 @@ static void save_image_doit(bContext *C, SpaceImage *sima, Scene *scene, wmOpera int relative= (RNA_struct_find_property(op->ptr, "relative_path") && RNA_boolean_get(op->ptr, "relative_path")); int save_copy= (RNA_struct_find_property(op->ptr, "copy") && RNA_boolean_get(op->ptr, "copy")); - BLI_path_abs(path, G.sce); + BLI_path_abs(path, G.main->name); if(scene->r.scemode & R_EXTENSION) { BKE_add_image_extension(path, sima->imtypenr); @@ -876,7 +876,7 @@ static void save_image_doit(bContext *C, SpaceImage *sima, Scene *scene, wmOpera RE_WriteRenderResult(rr, path, scene->r.quality); if(relative) - BLI_path_rel(path, G.sce); /* only after saving */ + BLI_path_rel(path, G.main->name); /* only after saving */ if(!save_copy) { if(do_newpath) { @@ -896,7 +896,7 @@ static void save_image_doit(bContext *C, SpaceImage *sima, Scene *scene, wmOpera else if (BKE_write_ibuf(scene, ibuf, path, sima->imtypenr, scene->r.subimtype, scene->r.quality)) { if(relative) - BLI_path_rel(path, G.sce); /* only after saving */ + BLI_path_rel(path, G.main->name); /* only after saving */ if(!save_copy) { if(do_newpath) { @@ -961,7 +961,7 @@ static int save_as_exec(bContext *C, wmOperator *op) } -static int save_as_check(bContext *C, wmOperator *op) +static int save_as_check(bContext *UNUSED(C), wmOperator *op) { char filepath[FILE_MAX]; RNA_string_get(op->ptr, "filepath", filepath); @@ -972,7 +972,7 @@ static int save_as_check(bContext *C, wmOperator *op) return FALSE; } -static int save_as_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int save_as_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { SpaceImage *sima= CTX_wm_space_image(C); Image *ima = ED_space_image(sima); @@ -1071,7 +1071,7 @@ static int save_exec(bContext *C, wmOperator *op) if(name[0]==0) BLI_strncpy(name, G.ima, FILE_MAX); else - BLI_path_abs(name, G.sce); + BLI_path_abs(name, G.main->name); if(BLI_exists(name) && BLI_is_writable(name)) { rr= BKE_image_acquire_renderresult(scene, ima); @@ -1157,7 +1157,7 @@ static int save_sequence_exec(bContext *C, wmOperator *op) char name[FILE_MAX]; BLI_strncpy(name, ibuf->name, sizeof(name)); - BLI_path_abs(name, G.sce); + BLI_path_abs(name, G.main->name); if(0 == IMB_saveiff(ibuf, name, IB_rect | IB_zbuf | IB_zbuffloat)) { BKE_reportf(op->reports, RPT_ERROR, "Could not write image %s.", name); @@ -1188,7 +1188,7 @@ void IMAGE_OT_save_sequence(wmOperatorType *ot) /******************** reload image operator ********************/ -static int reload_exec(bContext *C, wmOperator *op) +static int reload_exec(bContext *C, wmOperator *UNUSED(op)) { Image *ima= CTX_data_edit_image(C); SpaceImage *sima= CTX_wm_space_image(C); @@ -1347,7 +1347,7 @@ static int pack_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -static int pack_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int pack_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { Image *ima= CTX_data_edit_image(C); ImBuf *ibuf= BKE_image_get_ibuf(ima, NULL); @@ -1507,7 +1507,7 @@ static int unpack_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -static int unpack_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int unpack_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { Image *ima= CTX_data_edit_image(C); @@ -1570,7 +1570,7 @@ typedef struct ImageSampleInfo { int draw; } ImageSampleInfo; -static void sample_draw(const bContext *C, ARegion *ar, void *arg_info) +static void sample_draw(const bContext *UNUSED(C), ARegion *ar, void *arg_info) { ImageSampleInfo *info= arg_info; @@ -1985,7 +1985,7 @@ static int record_composite_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -static int record_composite_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int record_composite_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { RecordCompositeData *rcd= op->customdata; @@ -2052,7 +2052,7 @@ static int cycle_render_slot_poll(bContext *C) return (ima && ima->type == IMA_TYPE_R_RESULT); } -static int cycle_render_slot_exec(bContext *C, wmOperator *op) +static int cycle_render_slot_exec(bContext *C, wmOperator *UNUSED(op)) { Image *ima= CTX_data_edit_image(C); int a, slot, cur= ima->render_slot; diff --git a/source/blender/editors/space_image/image_render.c b/source/blender/editors/space_image/image_render.c index be9d60a5adb..5fa0a2de202 100644 --- a/source/blender/editors/space_image/image_render.c +++ b/source/blender/editors/space_image/image_render.c @@ -149,7 +149,7 @@ void imagewindow_toggle_render(bContext *C) } /* NOTE: called while render, so no malloc allowed! */ -static void imagewindow_renderinfo_cb(void *handle, RenderStats *rs) +static void imagewindow_renderinfo_cb(void *UNUSED(handle), RenderStats *UNUSED(rs)) { if(image_area) { // XXX BIF_make_render_text(rs); diff --git a/source/blender/editors/space_image/space_image.c b/source/blender/editors/space_image/space_image.c index 66e27993532..d77d153a324 100644 --- a/source/blender/editors/space_image/space_image.c +++ b/source/blender/editors/space_image/space_image.c @@ -369,7 +369,7 @@ ARegion *image_has_scope_region(ScrArea *sa) /* ******************** default callbacks for image space ***************** */ -static SpaceLink *image_new(const bContext *C) +static SpaceLink *image_new(const bContext *UNUSED(C)) { ARegion *ar; SpaceImage *simage; @@ -429,7 +429,7 @@ static void image_free(SpaceLink *sl) /* spacetype; init callback, add handlers */ -static void image_init(struct wmWindowManager *wm, ScrArea *sa) +static void image_init(struct wmWindowManager *UNUSED(wm), ScrArea *sa) { ListBase *lb= WM_dropboxmap_find("Image", SPACE_IMAGE, 0); @@ -485,6 +485,7 @@ void image_operatortypes(void) void image_keymap(struct wmKeyConfig *keyconf) { wmKeyMap *keymap= WM_keymap_find(keyconf, "Image Generic", SPACE_IMAGE, 0); + wmKeyMapItem *kmi; WM_keymap_add_item(keymap, "IMAGE_OT_new", NKEY, KM_PRESS, KM_ALT, 0); WM_keymap_add_item(keymap, "IMAGE_OT_open", OKEY, KM_PRESS, KM_ALT, 0); @@ -524,10 +525,15 @@ void image_keymap(struct wmKeyConfig *keyconf) RNA_enum_set(WM_keymap_add_item(keymap, "IMAGE_OT_curves_point_set", ACTIONMOUSE, KM_PRESS, KM_SHIFT, 0)->ptr, "point", 1); WM_keymap_add_item(keymap, "IMAGE_OT_toolbox", SPACEKEY, KM_PRESS, 0, 0); + + /* toggle editmode is handy to have while UV unwrapping */ + kmi= WM_keymap_add_item(keymap, "OBJECT_OT_mode_set", TABKEY, KM_PRESS, 0, 0); + RNA_enum_set(kmi->ptr, "mode", OB_MODE_EDIT); + RNA_boolean_set(kmi->ptr, "toggle", 1); } /* dropboxes */ -static int image_drop_poll(bContext *C, wmDrag *drag, wmEvent *event) +static int image_drop_poll(bContext *UNUSED(C), wmDrag *drag, wmEvent *UNUSED(event)) { if(drag->type==WM_DRAG_PATH) if(ELEM3(drag->icon, 0, ICON_FILE_IMAGE, ICON_FILE_BLANK)) /* rule might not work? */ @@ -551,7 +557,7 @@ static void image_dropboxes(void) -static void image_refresh(const bContext *C, ScrArea *sa) +static void image_refresh(const bContext *C, ScrArea *UNUSED(sa)) { SpaceImage *sima= CTX_wm_space_image(C); Object *obedit= CTX_data_edit_object(C); @@ -762,7 +768,7 @@ static void image_main_area_draw(const bContext *C, ARegion *ar) draw_image_main(sima, ar, scene); /* and uvs in 0.0-1.0 space */ - UI_view2d_view_ortho(C, v2d); + UI_view2d_view_ortho(v2d); draw_uvedit_main(sima, ar, scene, obedit); ED_region_draw_cb_draw(C, ar, REGION_DRAW_POST_VIEW); @@ -878,7 +884,7 @@ static void image_scope_area_listener(ARegion *ar, wmNotifier *wmn) /************************* header region **************************/ /* add handlers, stuff you only do once or on area/region changes */ -static void image_header_area_init(wmWindowManager *wm, ARegion *ar) +static void image_header_area_init(wmWindowManager *UNUSED(wm), ARegion *ar) { ED_region_header_init(ar); } diff --git a/source/blender/editors/space_info/info_ops.c b/source/blender/editors/space_info/info_ops.c index 51767d3e006..aeb32cda6bd 100644 --- a/source/blender/editors/space_info/info_ops.c +++ b/source/blender/editors/space_info/info_ops.c @@ -73,7 +73,7 @@ static int pack_all_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -static int pack_all_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int pack_all_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { Main *bmain= CTX_data_main(C); Image *ima; @@ -133,7 +133,7 @@ static int unpack_all_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -static int unpack_all_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int unpack_all_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { Main *bmain= CTX_data_main(C); uiPopupMenu *pup; @@ -184,14 +184,14 @@ void FILE_OT_unpack_all(wmOperatorType *ot) /********************* make paths relative operator *********************/ -static int make_paths_relative_exec(bContext *C, wmOperator *op) +static int make_paths_relative_exec(bContext *UNUSED(C), wmOperator *op) { if(!G.relbase_valid) { BKE_report(op->reports, RPT_WARNING, "Can't set relative paths with an unsaved blend file."); return OPERATOR_CANCELLED; } - makeFilesRelative(G.sce, op->reports); + makeFilesRelative(G.main->name, op->reports); return OPERATOR_FINISHED; } @@ -211,14 +211,14 @@ void FILE_OT_make_paths_relative(wmOperatorType *ot) /********************* make paths absolute operator *********************/ -static int make_paths_absolute_exec(bContext *C, wmOperator *op) +static int make_paths_absolute_exec(bContext *UNUSED(C), wmOperator *op) { if(!G.relbase_valid) { BKE_report(op->reports, RPT_WARNING, "Can't set absolute paths with an unsaved blend file."); return OPERATOR_CANCELLED; } - makeFilesAbsolute(G.sce, op->reports); + makeFilesAbsolute(G.main->name, op->reports); return OPERATOR_FINISHED; } @@ -237,14 +237,14 @@ void FILE_OT_make_paths_absolute(wmOperatorType *ot) /********************* report missing files operator *********************/ -static int report_missing_files_exec(bContext *C, wmOperator *op) +static int report_missing_files_exec(bContext *UNUSED(C), wmOperator *op) { char txtname[24]; /* text block name */ txtname[0] = '\0'; /* run the missing file check */ - checkMissingFiles(G.sce, op->reports); + checkMissingFiles(G.main->name, op->reports); return OPERATOR_FINISHED; } @@ -264,18 +264,18 @@ void FILE_OT_report_missing_files(wmOperatorType *ot) /********************* find missing files operator *********************/ -static int find_missing_files_exec(bContext *C, wmOperator *op) +static int find_missing_files_exec(bContext *UNUSED(C), wmOperator *op) { char *path; path= RNA_string_get_alloc(op->ptr, "filepath", NULL, 0); - findMissingFiles(path, G.sce); + findMissingFiles(path, G.main->name); MEM_freeN(path); return OPERATOR_FINISHED; } -static int find_missing_files_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int find_missing_files_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { /* XXX file open button text "Find Missing Files" */ WM_event_add_fileselect(C, op); @@ -313,7 +313,7 @@ void FILE_OT_find_missing_files(wmOperatorType *ot) #define ERROR_TIMEOUT 10.0 #define ERROR_COLOR_TIMEOUT 6.0 #define COLLAPSE_TIMEOUT 0.2 -static int update_reports_display_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int update_reports_display_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent *event) { wmWindowManager *wm= CTX_wm_manager(C); ReportList *reports= CTX_wm_reports(C); diff --git a/source/blender/editors/space_info/space_info.c b/source/blender/editors/space_info/space_info.c index b47c8e8d189..5173621d9c1 100644 --- a/source/blender/editors/space_info/space_info.c +++ b/source/blender/editors/space_info/space_info.c @@ -55,7 +55,7 @@ /* ******************** default callbacks for info space ***************** */ -static SpaceLink *info_new(const bContext *C) +static SpaceLink *info_new(const bContext *UNUSED(C)) { ARegion *ar; SpaceInfo *sinfo; @@ -80,7 +80,7 @@ static SpaceLink *info_new(const bContext *C) } /* not spacelink itself */ -static void info_free(SpaceLink *sl) +static void info_free(SpaceLink *UNUSED(sl)) { // SpaceInfo *sinfo= (SpaceInfo*) sl; @@ -88,7 +88,7 @@ static void info_free(SpaceLink *sl) /* spacetype; init callback */ -static void info_init(struct wmWindowManager *wm, ScrArea *sa) +static void info_init(struct wmWindowManager *UNUSED(wm), ScrArea *UNUSED(sa)) { } @@ -105,11 +105,11 @@ static SpaceLink *info_duplicate(SpaceLink *sl) /* add handlers, stuff you only do once or on area/region changes */ -static void info_main_area_init(wmWindowManager *wm, ARegion *ar) +static void info_main_area_init(wmWindowManager *UNUSED(wm), ARegion *UNUSED(ar)) { } -static void info_main_area_draw(const bContext *C, ARegion *ar) +static void info_main_area_draw(const bContext *UNUSED(C), ARegion *UNUSED(ar)) { /* clear and setup matrix */ @@ -137,7 +137,7 @@ void info_keymap(struct wmKeyConfig *keyconf) } /* add handlers, stuff you only do once or on area/region changes */ -static void info_header_area_init(wmWindowManager *wm, ARegion *ar) +static void info_header_area_init(wmWindowManager *UNUSED(wm), ARegion *ar) { ED_region_header_init(ar); } @@ -147,7 +147,7 @@ static void info_header_area_draw(const bContext *C, ARegion *ar) ED_region_header(C, ar); } -static void info_main_area_listener(ARegion *ar, wmNotifier *wmn) +static void info_main_area_listener(ARegion *UNUSED(ar), wmNotifier *UNUSED(wmn)) { /* context changes */ } @@ -179,7 +179,7 @@ static void info_header_listener(ARegion *ar, wmNotifier *wmn) } -static void recent_files_menu(const bContext *C, Menu *menu) +static void recent_files_menu_draw(const bContext *UNUSED(C), Menu *menu) { struct RecentFile *recent; uiLayout *layout= menu->layout; @@ -200,7 +200,7 @@ void recent_files_menu_register() mt= MEM_callocN(sizeof(MenuType), "spacetype info menu recent files"); strcpy(mt->idname, "INFO_MT_file_open_recent"); strcpy(mt->label, "Open Recent..."); - mt->draw= recent_files_menu; + mt->draw= recent_files_menu_draw; WM_menutype_add(mt); } diff --git a/source/blender/editors/space_logic/logic_buttons.c b/source/blender/editors/space_logic/logic_buttons.c index d8dfd8cb52d..e41627ad0a4 100644 --- a/source/blender/editors/space_logic/logic_buttons.c +++ b/source/blender/editors/space_logic/logic_buttons.c @@ -83,7 +83,7 @@ static void logic_panel_view_properties(const bContext *C, Panel *pa) } #endif -void logic_buttons_register(ARegionType *art) +void logic_buttons_register(ARegionType *UNUSED(art)) { #if 0 PanelType *pt; @@ -103,7 +103,7 @@ void logic_buttons_register(ARegionType *art) } -static int logic_properties(bContext *C, wmOperator *op) +static int logic_properties(bContext *C, wmOperator *UNUSED(op)) { ScrArea *sa= CTX_wm_area(C); ARegion *ar= logic_has_buttons_region(sa); diff --git a/source/blender/editors/space_logic/logic_ops.c b/source/blender/editors/space_logic/logic_ops.c index 4641fd2ce61..5c498a59884 100644 --- a/source/blender/editors/space_logic/logic_ops.c +++ b/source/blender/editors/space_logic/logic_ops.c @@ -238,7 +238,7 @@ static int sensor_remove_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } - static int sensor_remove_invoke(bContext *C, wmOperator *op, wmEvent *event) + static int sensor_remove_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { if (edit_sensor_invoke_properties(C, op)) return sensor_remove_exec(C, op); @@ -341,7 +341,7 @@ static int controller_remove_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } - static int controller_remove_invoke(bContext *C, wmOperator *op, wmEvent *event) + static int controller_remove_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { if (edit_controller_invoke_properties(C, op)) return controller_remove_exec(C, op); @@ -455,7 +455,7 @@ static int actuator_remove_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -static int actuator_remove_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int actuator_remove_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { if (edit_actuator_invoke_properties(C, op)) return actuator_remove_exec(C, op); @@ -562,7 +562,7 @@ static int sensor_move_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -static int sensor_move_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int sensor_move_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { if (edit_sensor_invoke_properties(C, op)) { return sensor_move_exec(C, op); @@ -607,7 +607,7 @@ static int controller_move_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -static int controller_move_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int controller_move_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { if (edit_controller_invoke_properties(C, op)) { return controller_move_exec(C, op); @@ -652,7 +652,7 @@ static int actuator_move_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -static int actuator_move_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int actuator_move_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { if (edit_actuator_invoke_properties(C, op)) { return actuator_move_exec(C, op); diff --git a/source/blender/editors/space_logic/logic_window.c b/source/blender/editors/space_logic/logic_window.c index 148bcf1459f..c8d6e960132 100644 --- a/source/blender/editors/space_logic/logic_window.c +++ b/source/blender/editors/space_logic/logic_window.c @@ -182,7 +182,7 @@ void make_unique_prop_names(bContext *C, char *str) MEM_freeN(names); } -static void make_unique_prop_names_cb(bContext *C, void *strv, void *redraw_view3d_flagv) +static void make_unique_prop_names_cb(bContext *C, void *strv, void *UNUSED(redraw_view3d_flagv)) { char *str= strv; // int redraw_view3d_flag= GET_INT_FROM_POINTER(redraw_view3d_flagv); @@ -354,7 +354,7 @@ static void old_sca_move_actuator(bContext *C, void *datav, void *move_up) } } -void do_logic_buts(bContext *C, void *arg, int event) +void do_logic_buts(bContext *C, void *UNUSED(arg), int event) { Main *bmain= CTX_data_main(C); bSensor *sens; @@ -964,7 +964,7 @@ static void set_col_sensor(int type, int medium) } -static void verify_logicbutton_func(bContext *C, void *data1, void *data2) +static void verify_logicbutton_func(bContext *UNUSED(C), void *data1, void *data2) { bSensor *sens= (bSensor*)data1; @@ -1017,7 +1017,7 @@ static void test_scenepoin_but(struct bContext *C, char *name, ID **idpp) id_us_plus(*idpp); } -static void test_keyboard_event(struct bContext *C, void *arg_ks, void *arg_unused) +static void test_keyboard_event(struct bContext *UNUSED(C), void *arg_ks, void *UNUSED(arg)) { bKeyboardSensor *ks= (bKeyboardSensor*)arg_ks; @@ -1116,7 +1116,7 @@ static void check_armature_sensor(bContext *C, void *arg1_but, void *arg2_sens) check_armature_bone_constraint(ob, sens->posechannel, sens->constraint); } -static short draw_sensorbuttons(Object *ob, bSensor *sens, uiBlock *block, short xco, short yco, short width,char* objectname) +static short draw_sensorbuttons(Object *ob, bSensor *sens, uiBlock *block, short xco, short yco, short width) { bNearSensor *ns = NULL; bTouchSensor *ts = NULL; @@ -1734,7 +1734,7 @@ static void set_col_actuator(int item, int medium) } -static void change_object_actuator(bContext *C, void *act, void *arg) +static void change_object_actuator(bContext *UNUSED(C), void *act, void *UNUSED(arg)) { bObjectActuator *oa = act; @@ -1758,7 +1758,7 @@ static void change_object_actuator(bContext *C, void *act, void *arg) } } -static void change_ipo_actuator(bContext *C, void *arg1_but, void *arg2_ia) +static void change_ipo_actuator(bContext *UNUSED(C), void *arg1_but, void *arg2_ia) { bIpoActuator *ia = arg2_ia; uiBut *but = arg1_but; @@ -1770,7 +1770,7 @@ static void change_ipo_actuator(bContext *C, void *arg1_but, void *arg2_ia) but->retval = B_REDR; } -void update_object_actuator_PID(bContext *C, void *act, void *arg) +void update_object_actuator_PID(bContext *UNUSED(C), void *act, void *UNUSED(arg)) { bObjectActuator *oa = act; oa->forcerot[0] = 60.0f*oa->forcerot[1]; @@ -2920,7 +2920,7 @@ static short draw_actuatorbuttons(Main *bmain, Object *ob, bActuator *act, uiBlo return yco-4; } -static void do_sensor_menu(bContext *C, void *arg, int event) +static void do_sensor_menu(bContext *C, void *UNUSED(arg), int event) { SpaceLogic *slogic= CTX_wm_space_logic(C); ID **idar; @@ -2949,7 +2949,7 @@ static void do_sensor_menu(bContext *C, void *arg, int event) if(idar) MEM_freeN(idar); } -static uiBlock *sensor_menu(bContext *C, ARegion *ar, void *arg_unused) +static uiBlock *sensor_menu(bContext *C, ARegion *ar, void *UNUSED(arg)) { uiBlock *block; int yco=0; @@ -2969,7 +2969,7 @@ static uiBlock *sensor_menu(bContext *C, ARegion *ar, void *arg_unused) return block; } -static void do_controller_menu(bContext *C, void *arg, int event) +static void do_controller_menu(bContext *C, void *UNUSED(arg), int event) { SpaceLogic *slogic= CTX_wm_space_logic(C); ID **idar; @@ -2998,7 +2998,7 @@ static void do_controller_menu(bContext *C, void *arg, int event) if(idar) MEM_freeN(idar); } -static uiBlock *controller_menu(bContext *C, ARegion *ar, void *arg_unused) +static uiBlock *controller_menu(bContext *C, ARegion *ar, void *UNUSED(arg)) { uiBlock *block; int yco=0; @@ -3018,7 +3018,7 @@ static uiBlock *controller_menu(bContext *C, ARegion *ar, void *arg_unused) return block; } -static void do_actuator_menu(bContext *C, void *arg, int event) +static void do_actuator_menu(bContext *C, void *UNUSED(arg), int event) { SpaceLogic *slogic= CTX_wm_space_logic(C); ID **idar; @@ -3047,7 +3047,7 @@ static void do_actuator_menu(bContext *C, void *arg, int event) if(idar) MEM_freeN(idar); } -static uiBlock *actuator_menu(bContext *C, ARegion *ar, void *arg_unused) +static uiBlock *actuator_menu(bContext *C, ARegion *ar, void *UNUSED(arg)) { uiBlock *block; int xco=0; @@ -3069,7 +3069,7 @@ static uiBlock *actuator_menu(bContext *C, ARegion *ar, void *arg_unused) -static void check_controller_state_mask(bContext *C, void *arg1_but, void *arg2_mask) +static void check_controller_state_mask(bContext *UNUSED(C), void *arg1_but, void *arg2_mask) { unsigned int *cont_mask = arg2_mask; uiBut *but = arg1_but; @@ -3122,7 +3122,7 @@ static uiBlock *controller_state_mask_menu(bContext *C, ARegion *ar, void *arg_c return block; } -static void do_object_state_menu(bContext *C, void *arg, int event) +static void do_object_state_menu(bContext *UNUSED(C), void *arg, int event) { Object *ob = arg; @@ -3579,7 +3579,7 @@ static void draw_controller_python(uiLayout *layout, PointerRNA *ptr) } } -static void draw_controller_state(uiLayout *layout, PointerRNA *ptr) +static void draw_controller_state(uiLayout *UNUSED(layout), PointerRNA *UNUSED(ptr)) { } @@ -4955,7 +4955,7 @@ void logic_buttons(bContext *C, ARegion *ar) uiButSetFunc(but, make_unique_prop_names_cb, sens->name, (void*) 0); sens->otype= sens->type; - yco= draw_sensorbuttons(ob, sens, block, xco, yco, width,ob->id.name); + yco= draw_sensorbuttons(ob, sens, block, xco, yco, width); if(yco-6 < ycoo) ycoo= (yco+ycoo-20)/2; } else { diff --git a/source/blender/editors/space_logic/space_logic.c b/source/blender/editors/space_logic/space_logic.c index 01af324334b..9a3cac02c50 100644 --- a/source/blender/editors/space_logic/space_logic.c +++ b/source/blender/editors/space_logic/space_logic.c @@ -82,7 +82,7 @@ ARegion *logic_has_buttons_region(ScrArea *sa) /* ******************** default callbacks for image space ***************** */ -static SpaceLink *logic_new(const bContext *C) +static SpaceLink *logic_new(const bContext *UNUSED(C)) { ARegion *ar; SpaceLogic *slogic; @@ -145,7 +145,7 @@ static SpaceLink *logic_new(const bContext *C) } /* not spacelink itself */ -static void logic_free(SpaceLink *sl) +static void logic_free(SpaceLink *UNUSED(sl)) { // Spacelogic *slogic= (SpaceLogic*) sl; @@ -156,7 +156,7 @@ static void logic_free(SpaceLink *sl) /* spacetype; init callback */ -static void logic_init(struct wmWindowManager *wm, ScrArea *sa) +static void logic_init(struct wmWindowManager *UNUSED(wm), ScrArea *UNUSED(sa)) { } @@ -183,7 +183,7 @@ void logic_keymap(struct wmKeyConfig *keyconf) WM_keymap_add_menu(keymap, "LOGIC_MT_logicbricks_add", AKEY, KM_PRESS, KM_SHIFT, 0); } -static void logic_refresh(const bContext *C, ScrArea *sa) +static void logic_refresh(const bContext *UNUSED(C), ScrArea *UNUSED(sa)) { // SpaceLogic *slogic= CTX_wm_space_logic(C); // Object *obedit= CTX_data_edit_object(C); @@ -217,11 +217,9 @@ static void logic_listener(ARegion *ar, wmNotifier *wmn) } } -static int logic_context(const bContext *C, const char *member, bContextDataResult *result) +static int logic_context(const bContext *UNUSED(C), const char *UNUSED(member), bContextDataResult *UNUSED(result)) { // SpaceLogic *slogic= CTX_wm_space_logic(C); - - return 0; } @@ -251,7 +249,7 @@ static void logic_main_area_draw(const bContext *C, ARegion *ar) UI_ThemeClearColor(TH_BACK); glClear(GL_COLOR_BUFFER_BIT); - UI_view2d_view_ortho(C, v2d); + UI_view2d_view_ortho(v2d); logic_buttons((bContext *)C, ar); @@ -287,7 +285,7 @@ static void logic_buttons_area_draw(const bContext *C, ARegion *ar) /************************* header region **************************/ /* add handlers, stuff you only do once or on area/region changes */ -static void logic_header_area_init(wmWindowManager *wm, ARegion *ar) +static void logic_header_area_init(wmWindowManager *UNUSED(wm), ARegion *ar) { ED_region_header_init(ar); } diff --git a/source/blender/editors/space_nla/nla_buttons.c b/source/blender/editors/space_nla/nla_buttons.c index 2b394405155..72a970f83e5 100644 --- a/source/blender/editors/space_nla/nla_buttons.c +++ b/source/blender/editors/space_nla/nla_buttons.c @@ -66,7 +66,7 @@ /* -------------- */ -static void do_nla_region_buttons(bContext *C, void *arg, int event) +static void do_nla_region_buttons(bContext *C, void *UNUSED(arg), int event) { //Scene *scene= CTX_data_scene(C); @@ -173,25 +173,25 @@ static int nla_panel_poll(const bContext *C, PanelType *pt) } #endif -static int nla_animdata_panel_poll(const bContext *C, PanelType *pt) +static int nla_animdata_panel_poll(const bContext *C, PanelType *UNUSED(pt)) { PointerRNA ptr; return (nla_panel_context(C, &ptr, NULL, NULL) && (ptr.data != NULL)); } -static int nla_track_panel_poll(const bContext *C, PanelType *pt) +static int nla_track_panel_poll(const bContext *C, PanelType *UNUSED(pt)) { PointerRNA ptr; return (nla_panel_context(C, NULL, &ptr, NULL) && (ptr.data != NULL)); } -static int nla_strip_panel_poll(const bContext *C, PanelType *pt) +static int nla_strip_panel_poll(const bContext *C, PanelType *UNUSED(pt)) { PointerRNA ptr; return (nla_panel_context(C, NULL, NULL, &ptr) && (ptr.data != NULL)); } -static int nla_strip_actclip_panel_poll(const bContext *C, PanelType *pt) +static int nla_strip_actclip_panel_poll(const bContext *C, PanelType *UNUSED(pt)) { PointerRNA ptr; NlaStrip *strip; @@ -478,7 +478,7 @@ void nla_buttons_register(ARegionType *art) BLI_addtail(&art->paneltypes, pt); } -static int nla_properties(bContext *C, wmOperator *op) +static int nla_properties(bContext *C, wmOperator *UNUSED(op)) { ScrArea *sa= CTX_wm_area(C); ARegion *ar= nla_has_buttons_region(sa); diff --git a/source/blender/editors/space_nla/nla_channels.c b/source/blender/editors/space_nla/nla_channels.c index d60551dac2e..ca2e3e6b6d5 100644 --- a/source/blender/editors/space_nla/nla_channels.c +++ b/source/blender/editors/space_nla/nla_channels.c @@ -434,7 +434,7 @@ void NLA_OT_tracks_add (wmOperatorType *ot) /* ******************** Delete Tracks Operator ***************************** */ /* Delete selected NLA Tracks */ -static int nlaedit_delete_tracks_exec (bContext *C, wmOperator *op) +static int nlaedit_delete_tracks_exec (bContext *C, wmOperator *UNUSED(op)) { bAnimContext ac; diff --git a/source/blender/editors/space_nla/nla_draw.c b/source/blender/editors/space_nla/nla_draw.c index ef9c46c8042..98550b7e452 100644 --- a/source/blender/editors/space_nla/nla_draw.c +++ b/source/blender/editors/space_nla/nla_draw.c @@ -219,7 +219,7 @@ static void nla_strip_get_color_inside (AnimData *adt, NlaStrip *strip, float co } /* helper call for drawing influence/time control curves for a given NLA-strip */ -static void nla_draw_strip_curves (NlaStrip *strip, View2D *v2d, float yminc, float ymaxc) +static void nla_draw_strip_curves (NlaStrip *strip, float yminc, float ymaxc) { const float yheight = ymaxc - yminc; @@ -280,7 +280,7 @@ static void nla_draw_strip_curves (NlaStrip *strip, View2D *v2d, float yminc, fl } /* main call for drawing a single NLA-strip */ -static void nla_draw_strip (SpaceNla *snla, AnimData *adt, NlaTrack *nlt, NlaStrip *strip, View2D *v2d, float yminc, float ymaxc) +static void nla_draw_strip (SpaceNla *snla, AnimData *adt, NlaTrack *UNUSED(nlt), NlaStrip *strip, View2D *v2d, float yminc, float ymaxc) { float color[3]; @@ -351,7 +351,7 @@ static void nla_draw_strip (SpaceNla *snla, AnimData *adt, NlaTrack *nlt, NlaStr * - only if user hasn't hidden them... */ if ((snla->flag & SNLA_NOSTRIPCURVES) == 0) - nla_draw_strip_curves(strip, v2d, yminc, ymaxc); + nla_draw_strip_curves(strip, yminc, ymaxc); /* draw strip outline * - color used here is to indicate active vs non-active @@ -414,7 +414,7 @@ static void nla_draw_strip (SpaceNla *snla, AnimData *adt, NlaTrack *nlt, NlaStr } /* add the relevant text to the cache of text-strings to draw in pixelspace */ -static void nla_draw_strip_text (NlaTrack *nlt, NlaStrip *strip, int index, View2D *v2d, float yminc, float ymaxc) +static void nla_draw_strip_text (NlaTrack *UNUSED(nlt), NlaStrip *strip, int UNUSED(index), View2D *v2d, float yminc, float ymaxc) { char str[256], dir[3]; rctf rect; @@ -477,8 +477,6 @@ void draw_nla_main_data (bAnimContext *ac, SpaceNla *snla, ARegion *ar) * (NOTE: this is ok here, the configuration is pretty straightforward) */ v2d->tot.ymin= (float)(-height); - /* need to do a view-sync here, so that the strips area doesn't jump around */ - UI_view2d_sync(NULL, ac->sa, v2d, V2D_VIEWSYNC_AREA_VERTICAL); /* loop through channels, and set up drawing depending on their type */ y= (float)(-NLACHANNEL_HEIGHT); @@ -812,7 +810,7 @@ static void draw_nla_channel_list_gl (bAnimContext *ac, ListBase *anim_data, Vie } } -void draw_nla_channel_list (bContext *C, bAnimContext *ac, SpaceNla *snla, ARegion *ar) +void draw_nla_channel_list (bContext *C, bAnimContext *ac, ARegion *ar) { ListBase anim_data = {NULL, NULL}; bAnimListElem *ale; @@ -837,6 +835,8 @@ void draw_nla_channel_list (bContext *C, bAnimContext *ac, SpaceNla *snla, ARegi * (NOTE: this is ok here, the configuration is pretty straightforward) */ v2d->tot.ymin= (float)(-height); + /* need to do a view-sync here, so that the keys area doesn't jump around (it must copy this) */ + UI_view2d_sync(NULL, ac->sa, v2d, V2D_LOCK_COPY); /* draw channels */ { /* first pass: backdrops + oldstyle drawing */ diff --git a/source/blender/editors/space_nla/nla_edit.c b/source/blender/editors/space_nla/nla_edit.c index 247987cda9f..e13a229fdd1 100644 --- a/source/blender/editors/space_nla/nla_edit.c +++ b/source/blender/editors/space_nla/nla_edit.c @@ -457,7 +457,7 @@ void NLA_OT_transition_add (wmOperatorType *ot) /* Add new meta-strips incorporating the selected strips */ /* add the specified action as new strip */ -static int nlaedit_add_meta_exec (bContext *C, wmOperator *op) +static int nlaedit_add_meta_exec (bContext *C, wmOperator *UNUSED(op)) { bAnimContext ac; @@ -518,7 +518,7 @@ void NLA_OT_meta_add (wmOperatorType *ot) /* ******************** Remove Meta-Strip Operator ***************************** */ /* Separate out the strips held by the selected meta-strips */ -static int nlaedit_remove_meta_exec (bContext *C, wmOperator *op) +static int nlaedit_remove_meta_exec (bContext *C, wmOperator *UNUSED(op)) { bAnimContext ac; @@ -572,7 +572,7 @@ void NLA_OT_meta_remove (wmOperatorType *ot) * the originals were housed in. */ -static int nlaedit_duplicate_exec (bContext *C, wmOperator *op) +static int nlaedit_duplicate_exec (bContext *C, wmOperator *UNUSED(op)) { bAnimContext ac; @@ -645,7 +645,7 @@ static int nlaedit_duplicate_exec (bContext *C, wmOperator *op) return OPERATOR_CANCELLED; } -static int nlaedit_duplicate_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int nlaedit_duplicate_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { nlaedit_duplicate_exec(C, op); @@ -677,7 +677,7 @@ void NLA_OT_duplicate (wmOperatorType *ot) /* ******************** Delete Strips Operator ***************************** */ /* Deletes the selected NLA-Strips */ -static int nlaedit_delete_exec (bContext *C, wmOperator *op) +static int nlaedit_delete_exec (bContext *C, wmOperator *UNUSED(op)) { bAnimContext ac; @@ -810,7 +810,7 @@ static void nlaedit_split_strip_actclip (AnimData *adt, NlaTrack *nlt, NlaStrip } /* split a given Meta strip */ -static void nlaedit_split_strip_meta (AnimData *adt, NlaTrack *nlt, NlaStrip *strip) +static void nlaedit_split_strip_meta (NlaTrack *nlt, NlaStrip *strip) { /* simply ungroup it for now... */ BKE_nlastrips_clear_metastrip(&nlt->strips, strip); @@ -818,7 +818,7 @@ static void nlaedit_split_strip_meta (AnimData *adt, NlaTrack *nlt, NlaStrip *st /* ----- */ -static int nlaedit_split_exec (bContext *C, wmOperator *op) +static int nlaedit_split_exec (bContext *C, wmOperator *UNUSED(op)) { bAnimContext ac; @@ -852,7 +852,7 @@ static int nlaedit_split_exec (bContext *C, wmOperator *op) break; case NLASTRIP_TYPE_META: /* meta-strips need special handling */ - nlaedit_split_strip_meta(adt, nlt, strip); + nlaedit_split_strip_meta(nlt, strip); break; default: /* for things like Transitions, do not split! */ @@ -893,7 +893,7 @@ void NLA_OT_split (wmOperatorType *ot) /* ******************** Bake Strips Operator ***************************** */ /* Bakes the NLA Strips for the active AnimData blocks */ -static int nlaedit_bake_exec (bContext *C, wmOperator *op) +static int nlaedit_bake_exec (bContext *C, wmOperator *UNUSED(op)) { bAnimContext ac; @@ -949,7 +949,7 @@ void NLA_OT_bake (wmOperatorType *ot) /* ******************** Toggle Muting Operator ************************** */ /* Toggles whether strips are muted or not */ -static int nlaedit_toggle_mute_exec (bContext *C, wmOperator *op) +static int nlaedit_toggle_mute_exec (bContext *C, wmOperator *UNUSED(op)) { bAnimContext ac; @@ -1008,7 +1008,7 @@ void NLA_OT_mute_toggle (wmOperatorType *ot) /* ******************** Move Strips Up Operator ************************** */ /* Tries to move the selected strips into the track above if possible. */ -static int nlaedit_move_up_exec (bContext *C, wmOperator *op) +static int nlaedit_move_up_exec (bContext *C, wmOperator *UNUSED(op)) { bAnimContext ac; @@ -1082,7 +1082,7 @@ void NLA_OT_move_up (wmOperatorType *ot) /* ******************** Move Strips Down Operator ************************** */ /* Tries to move the selected strips into the track above if possible. */ -static int nlaedit_move_down_exec (bContext *C, wmOperator *op) +static int nlaedit_move_down_exec (bContext *C, wmOperator *UNUSED(op)) { bAnimContext ac; @@ -1250,7 +1250,7 @@ static short bezt_apply_nlamapping (KeyframeEditData *ked, BezTriple *bezt) return 0; } -static int nlaedit_apply_scale_exec (bContext *C, wmOperator *op) +static int nlaedit_apply_scale_exec (bContext *C, wmOperator *UNUSED(op)) { bAnimContext ac; @@ -1333,7 +1333,7 @@ void NLA_OT_apply_scale (wmOperatorType *ot) /* ******************** Clear Scale Operator ***************************** */ /* Reset the scaling of the selected strips to 1.0f */ -static int nlaedit_clear_scale_exec (bContext *C, wmOperator *op) +static int nlaedit_clear_scale_exec (bContext *C, wmOperator *UNUSED(op)) { bAnimContext ac; @@ -1544,7 +1544,7 @@ void NLA_OT_snap (wmOperatorType *ot) /* ******************** Add F-Modifier Operator *********************** */ /* present a special customised popup menu for this, with some filtering */ -static int nla_fmodifier_add_invoke (bContext *C, wmOperator *op, wmEvent *event) +static int nla_fmodifier_add_invoke (bContext *C, wmOperator *UNUSED(op), wmEvent *UNUSED(event)) { uiPopupMenu *pup; uiLayout *layout; diff --git a/source/blender/editors/space_nla/nla_intern.h b/source/blender/editors/space_nla/nla_intern.h index 7570969158b..6906a151936 100644 --- a/source/blender/editors/space_nla/nla_intern.h +++ b/source/blender/editors/space_nla/nla_intern.h @@ -45,7 +45,7 @@ void NLA_OT_properties(wmOperatorType *ot); /* nla_draw.c */ void draw_nla_main_data(bAnimContext *ac, SpaceNla *snla, ARegion *ar); -void draw_nla_channel_list(bContext *C, bAnimContext *ac, SpaceNla *snla, ARegion *ar); +void draw_nla_channel_list(bContext *C, bAnimContext *ac, ARegion *ar); /* **************************************** */ /* nla_header.c */ diff --git a/source/blender/editors/space_nla/nla_ops.c b/source/blender/editors/space_nla/nla_ops.c index 85a169f2bb0..13380cd17f7 100644 --- a/source/blender/editors/space_nla/nla_ops.c +++ b/source/blender/editors/space_nla/nla_ops.c @@ -156,7 +156,7 @@ void nla_operatortypes(void) /* ************************** registration - keymaps **********************************/ -static void nla_keymap_channels (wmKeyConfig *keyconf, wmKeyMap *keymap) +static void nla_keymap_channels(wmKeyMap *keymap) { /* NLA-specific (different to standard channels keymap) -------------------------- */ /* selection */ @@ -287,7 +287,7 @@ void nla_keymap(wmKeyConfig *keyconf) * However, those operations which involve clicking on channels and/or the placement of them in the view are implemented here instead */ keymap= WM_keymap_find(keyconf, "NLA Channels", SPACE_NLA, 0); - nla_keymap_channels(keyconf, keymap); + nla_keymap_channels(keymap); /* data */ keymap= WM_keymap_find(keyconf, "NLA Editor", SPACE_NLA, 0); diff --git a/source/blender/editors/space_nla/space_nla.c b/source/blender/editors/space_nla/space_nla.c index 92c5ef6c410..25c53687597 100644 --- a/source/blender/editors/space_nla/space_nla.c +++ b/source/blender/editors/space_nla/space_nla.c @@ -148,16 +148,17 @@ static SpaceLink *nla_new(const bContext *C) 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]= 10000.0f; + ar->v2d.max[1]= 10000.0f; ar->v2d.minzoom= 0.01f; ar->v2d.maxzoom= 50; ar->v2d.scroll = (V2D_SCROLL_BOTTOM|V2D_SCROLL_SCALE_HORIZONTAL); ar->v2d.scroll |= (V2D_SCROLL_RIGHT); ar->v2d.keepzoom= V2D_LOCKZOOM_Y; + ar->v2d.keepofs= V2D_KEEPOFS_Y; ar->v2d.align= V2D_ALIGN_NO_POS_Y; ar->v2d.flag = V2D_VIEWSYNC_AREA_VERTICAL; @@ -177,7 +178,7 @@ static void nla_free(SpaceLink *sl) /* spacetype; init callback */ -static void nla_init(struct wmWindowManager *wm, ScrArea *sa) +static void nla_init(struct wmWindowManager *UNUSED(wm), ScrArea *sa) { SpaceNla *snla= (SpaceNla *)sa->spacedata.first; @@ -218,7 +219,6 @@ static void nla_channel_area_init(wmWindowManager *wm, ARegion *ar) /* draw entirely, view changes should be handled here */ static void nla_channel_area_draw(const bContext *C, ARegion *ar) { - SpaceNla *snla= CTX_wm_space_nla(C); bAnimContext ac; View2D *v2d= &ar->v2d; View2DScrollers *scrollers; @@ -227,11 +227,11 @@ static void nla_channel_area_draw(const bContext *C, ARegion *ar) UI_ThemeClearColor(TH_BACK); glClear(GL_COLOR_BUFFER_BIT); - UI_view2d_view_ortho(C, v2d); + UI_view2d_view_ortho(v2d); /* data */ if (ANIM_animdata_get_context(C, &ac)) { - draw_nla_channel_list((bContext *)C, &ac, snla, ar); + draw_nla_channel_list((bContext *)C, &ac, ar); } /* reset view matrix */ @@ -272,12 +272,12 @@ static void nla_main_area_draw(const bContext *C, ARegion *ar) UI_ThemeClearColor(TH_BACK); glClear(GL_COLOR_BUFFER_BIT); - UI_view2d_view_ortho(C, v2d); + UI_view2d_view_ortho(v2d); /* time grid */ unit= (snla->flag & SNLA_DRAWTIME)? V2D_UNIT_SECONDS : V2D_UNIT_FRAMES; - grid= UI_view2d_grid_calc(C, v2d, unit, V2D_GRID_CLAMP, V2D_ARG_DUMMY, V2D_ARG_DUMMY, ar->winx, ar->winy); - UI_view2d_grid_draw(C, v2d, grid, V2D_GRIDLINES_ALL); + grid= UI_view2d_grid_calc(CTX_data_scene(C), v2d, unit, V2D_GRID_CLAMP, V2D_ARG_DUMMY, V2D_ARG_DUMMY, ar->winx, ar->winy); + UI_view2d_grid_draw(v2d, grid, V2D_GRIDLINES_ALL); UI_view2d_grid_free(grid); /* data */ @@ -289,7 +289,7 @@ static void nla_main_area_draw(const bContext *C, ARegion *ar) UI_view2d_text_cache_draw(ar); } - UI_view2d_view_ortho(C, v2d); + UI_view2d_view_ortho(v2d); /* current frame */ if (snla->flag & SNLA_DRAWTIME) flag |= DRAWCFRA_UNIT_SECONDS; @@ -297,11 +297,11 @@ static void nla_main_area_draw(const bContext *C, ARegion *ar) ANIM_draw_cfra(C, v2d, flag); /* markers */ - UI_view2d_view_orthoSpecial(C, v2d, 1); + UI_view2d_view_orthoSpecial(ar, v2d, 1); draw_markers_time(C, 0); /* preview range */ - UI_view2d_view_ortho(C, v2d); + UI_view2d_view_ortho(v2d); ANIM_draw_previewrange(C, v2d); /* reset view matrix */ @@ -315,7 +315,7 @@ static void nla_main_area_draw(const bContext *C, ARegion *ar) /* add handlers, stuff you only do once or on area/region changes */ -static void nla_header_area_init(wmWindowManager *wm, ARegion *ar) +static void nla_header_area_init(wmWindowManager *UNUSED(wm), ARegion *ar) { ED_region_header_init(ar); } diff --git a/source/blender/editors/space_node/drawnode.c b/source/blender/editors/space_node/drawnode.c index 5e0926da216..78ae82c57b0 100644 --- a/source/blender/editors/space_node/drawnode.c +++ b/source/blender/editors/space_node/drawnode.c @@ -77,7 +77,7 @@ 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 *C, PointerRNA *ptr) +static void node_buts_value(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) { PointerRNA sockptr; PropertyRNA *prop; @@ -89,7 +89,7 @@ static void node_buts_value(uiLayout *layout, bContext *C, PointerRNA *ptr) uiItemR(layout, &sockptr, "default_value", 0, "", 0); } -static void node_buts_rgb(uiLayout *layout, bContext *C, PointerRNA *ptr) +static void node_buts_rgb(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) { uiLayout *col; PointerRNA sockptr; @@ -104,7 +104,7 @@ static void node_buts_rgb(uiLayout *layout, bContext *C, PointerRNA *ptr) uiItemR(col, &sockptr, "default_value", 0, "", 0); } -static void node_buts_mix_rgb(uiLayout *layout, bContext *C, PointerRNA *ptr) +static void node_buts_mix_rgb(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) { uiLayout *row; @@ -116,7 +116,7 @@ static void node_buts_mix_rgb(uiLayout *layout, bContext *C, PointerRNA *ptr) uiItemR(row, ptr, "use_alpha", 0, "", ICON_IMAGE_RGB_ALPHA); } -static void node_buts_time(uiLayout *layout, bContext *C, PointerRNA *ptr) +static void node_buts_time(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) { uiLayout *row; #if 0 @@ -138,12 +138,12 @@ static void node_buts_time(uiLayout *layout, bContext *C, PointerRNA *ptr) uiItemR(row, ptr, "frame_end", 0, "End", 0); } -static void node_buts_colorramp(uiLayout *layout, bContext *C, PointerRNA *ptr) +static void node_buts_colorramp(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) { uiTemplateColorRamp(layout, ptr, "color_ramp", 0); } -static void node_buts_curvevec(uiLayout *layout, bContext *C, PointerRNA *ptr) +static void node_buts_curvevec(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) { uiTemplateCurveMapping(layout, ptr, "mapping", 'v', 0, 0); } @@ -154,7 +154,7 @@ void node_curvemap_sample(float *col) _sample_col= col; } -static void node_buts_curvecol(uiLayout *layout, bContext *C, PointerRNA *ptr) +static void node_buts_curvecol(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) { bNode *node= ptr->data; CurveMapping *cumap= node->storage; @@ -169,7 +169,7 @@ static void node_buts_curvecol(uiLayout *layout, bContext *C, PointerRNA *ptr) uiTemplateCurveMapping(layout, ptr, "mapping", 'c', 0, 0); } -static void node_buts_normal(uiLayout *layout, bContext *C, PointerRNA *ptr) +static void node_buts_normal(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) { uiBlock *block= uiLayoutAbsoluteBlock(layout); bNode *node= ptr->data; @@ -212,7 +212,7 @@ static void node_browse_tex_cb(bContext *C, void *ntree_v, void *node_v) node->menunr= 0; } #endif -static void node_dynamic_update_cb(bContext *C, void *ntree_v, void *node_v) +static void node_dynamic_update_cb(bContext *C, void *UNUSED(ntree_v), void *node_v) { Main *bmain= CTX_data_main(C); Material *ma; @@ -244,7 +244,7 @@ static void node_dynamic_update_cb(bContext *C, void *ntree_v, void *node_v) // XXX BIF_preview_changed(ID_MA); } -static void node_buts_texture(uiLayout *layout, bContext *C, PointerRNA *ptr) +static void node_buts_texture(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) { bNode *node= ptr->data; @@ -263,7 +263,7 @@ static void node_buts_texture(uiLayout *layout, bContext *C, PointerRNA *ptr) } } -static void node_buts_math(uiLayout *layout, bContext *C, PointerRNA *ptr) +static void node_buts_math(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) { uiItemR(layout, ptr, "operation", 0, "", 0); } @@ -312,7 +312,7 @@ static void node_shader_buts_material(uiLayout *layout, bContext *C, PointerRNA uiItemR(col, ptr, "invert_normal", 0, NULL, 0); } -static void node_shader_buts_mapping(uiLayout *layout, bContext *C, PointerRNA *ptr) +static void node_shader_buts_mapping(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) { uiLayout *row; @@ -338,7 +338,7 @@ static void node_shader_buts_mapping(uiLayout *layout, bContext *C, PointerRNA * } -static void node_shader_buts_vect_math(uiLayout *layout, bContext *C, PointerRNA *ptr) +static void node_shader_buts_vect_math(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) { uiItemR(layout, ptr, "operation", 0, "", 0); } @@ -524,7 +524,7 @@ static void node_composit_buts_renderlayers(uiLayout *layout, bContext *C, Point } -static void node_composit_buts_blur(uiLayout *layout, bContext *C, PointerRNA *ptr) +static void node_composit_buts_blur(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) { uiLayout *col; @@ -548,7 +548,7 @@ static void node_composit_buts_blur(uiLayout *layout, bContext *C, PointerRNA *p } } -static void node_composit_buts_dblur(uiLayout *layout, bContext *C, PointerRNA *ptr) +static void node_composit_buts_dblur(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) { uiLayout *col; @@ -572,7 +572,7 @@ static void node_composit_buts_dblur(uiLayout *layout, bContext *C, PointerRNA * uiItemR(layout, ptr, "zoom", 0, NULL, 0); } -static void node_composit_buts_bilateralblur(uiLayout *layout, bContext *C, PointerRNA *ptr) +static void node_composit_buts_bilateralblur(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) { uiLayout *col; @@ -582,7 +582,7 @@ static void node_composit_buts_bilateralblur(uiLayout *layout, bContext *C, Poin uiItemR(col, ptr, "sigma_space", 0, NULL, 0); } -static void node_composit_buts_defocus(uiLayout *layout, bContext *C, PointerRNA *ptr) +static void node_composit_buts_defocus(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) { uiLayout *sub, *col; @@ -614,7 +614,7 @@ static void node_composit_buts_defocus(uiLayout *layout, bContext *C, PointerRNA } /* qdn: glare node */ -static void node_composit_buts_glare(uiLayout *layout, bContext *C, PointerRNA *ptr) +static void node_composit_buts_glare(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) { uiItemR(layout, ptr, "glare_type", 0, "", 0); uiItemR(layout, ptr, "quality", 0, "", 0); @@ -644,7 +644,7 @@ static void node_composit_buts_glare(uiLayout *layout, bContext *C, PointerRNA * } } -static void node_composit_buts_tonemap(uiLayout *layout, bContext *C, PointerRNA *ptr) +static void node_composit_buts_tonemap(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) { uiLayout *col; @@ -663,7 +663,7 @@ static void node_composit_buts_tonemap(uiLayout *layout, bContext *C, PointerRNA } } -static void node_composit_buts_lensdist(uiLayout *layout, bContext *C, PointerRNA *ptr) +static void node_composit_buts_lensdist(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) { uiLayout *col; @@ -676,7 +676,7 @@ static void node_composit_buts_lensdist(uiLayout *layout, bContext *C, PointerRN uiItemR(col, ptr, "use_fit", 0, NULL, 0); } -static void node_composit_buts_vecblur(uiLayout *layout, bContext *C, PointerRNA *ptr) +static void node_composit_buts_vecblur(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) { uiLayout *col; @@ -692,17 +692,17 @@ static void node_composit_buts_vecblur(uiLayout *layout, bContext *C, PointerRNA uiItemR(layout, ptr, "use_curved", 0, NULL, 0); } -static void node_composit_buts_filter(uiLayout *layout, bContext *C, PointerRNA *ptr) +static void node_composit_buts_filter(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) { uiItemR(layout, ptr, "filter_type", 0, "", 0); } -static void node_composit_buts_flip(uiLayout *layout, bContext *C, PointerRNA *ptr) +static void node_composit_buts_flip(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) { uiItemR(layout, ptr, "axis", 0, "", 0); } -static void node_composit_buts_crop(uiLayout *layout, bContext *C, PointerRNA *ptr) +static void node_composit_buts_crop(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) { uiLayout *col; @@ -723,7 +723,7 @@ static void node_composit_buts_crop(uiLayout *layout, bContext *C, PointerRNA *p } } -static void node_composit_buts_splitviewer(uiLayout *layout, bContext *C, PointerRNA *ptr) +static void node_composit_buts_splitviewer(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) { uiLayout *row, *col; @@ -733,7 +733,7 @@ static void node_composit_buts_splitviewer(uiLayout *layout, bContext *C, Pointe uiItemR(col, ptr, "factor", 0, NULL, 0); } -static void node_composit_buts_map_value(uiLayout *layout, bContext *C, PointerRNA *ptr) +static void node_composit_buts_map_value(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) { uiLayout *sub, *col; @@ -754,7 +754,7 @@ static void node_composit_buts_map_value(uiLayout *layout, bContext *C, PointerR uiItemR(sub, ptr, "max", 0, "", 0); } -static void node_composit_buts_alphaover(uiLayout *layout, bContext *C, PointerRNA *ptr) +static void node_composit_buts_alphaover(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) { uiLayout *col; @@ -763,7 +763,7 @@ static void node_composit_buts_alphaover(uiLayout *layout, bContext *C, PointerR uiItemR(col, ptr, "premul", 0, NULL, 0); } -static void node_composit_buts_hue_sat(uiLayout *layout, bContext *C, PointerRNA *ptr) +static void node_composit_buts_hue_sat(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) { uiLayout *col; @@ -773,12 +773,12 @@ static void node_composit_buts_hue_sat(uiLayout *layout, bContext *C, PointerRNA uiItemR(col, ptr, "color_value", UI_ITEM_R_SLIDER, NULL, 0); } -static void node_composit_buts_dilateerode(uiLayout *layout, bContext *C, PointerRNA *ptr) +static void node_composit_buts_dilateerode(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) { uiItemR(layout, ptr, "distance", 0, NULL, 0); } -static void node_composit_buts_diff_matte(uiLayout *layout, bContext *C, PointerRNA *ptr) +static void node_composit_buts_diff_matte(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) { uiLayout *col; @@ -787,7 +787,7 @@ static void node_composit_buts_diff_matte(uiLayout *layout, bContext *C, Pointer uiItemR(col, ptr, "falloff", UI_ITEM_R_SLIDER, NULL, 0); } -static void node_composit_buts_distance_matte(uiLayout *layout, bContext *C, PointerRNA *ptr) +static void node_composit_buts_distance_matte(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) { uiLayout *col; @@ -796,7 +796,7 @@ static void node_composit_buts_distance_matte(uiLayout *layout, bContext *C, Poi uiItemR(col, ptr, "falloff", UI_ITEM_R_SLIDER, NULL, 0); } -static void node_composit_buts_color_spill(uiLayout *layout, bContext *C, PointerRNA *ptr) +static void node_composit_buts_color_spill(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) { uiLayout *row, *col; @@ -822,7 +822,7 @@ static void node_composit_buts_color_spill(uiLayout *layout, bContext *C, Pointe } } -static void node_composit_buts_chroma_matte(uiLayout *layout, bContext *C, PointerRNA *ptr) +static void node_composit_buts_chroma_matte(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) { uiLayout *col; @@ -836,7 +836,7 @@ static void node_composit_buts_chroma_matte(uiLayout *layout, bContext *C, Point /*uiItemR(col, ptr, "shadow_adjust", UI_ITEM_R_SLIDER, NULL, 0); Removed for now*/ } -static void node_composit_buts_color_matte(uiLayout *layout, bContext *C, PointerRNA *ptr) +static void node_composit_buts_color_matte(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) { uiLayout *col; @@ -846,7 +846,7 @@ static void node_composit_buts_color_matte(uiLayout *layout, bContext *C, Pointe uiItemR(col, ptr, "color_value", UI_ITEM_R_SLIDER, NULL, 0); } -static void node_composit_buts_channel_matte(uiLayout *layout, bContext *C, PointerRNA *ptr) +static void node_composit_buts_channel_matte(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) { uiLayout *col, *row; @@ -872,7 +872,7 @@ static void node_composit_buts_channel_matte(uiLayout *layout, bContext *C, Poin uiItemR(col, ptr, "limit_min", UI_ITEM_R_SLIDER, NULL, 0); } -static void node_composit_buts_luma_matte(uiLayout *layout, bContext *C, PointerRNA *ptr) +static void node_composit_buts_luma_matte(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) { uiLayout *col; @@ -881,17 +881,17 @@ static void node_composit_buts_luma_matte(uiLayout *layout, bContext *C, Pointer uiItemR(col, ptr, "limit_min", UI_ITEM_R_SLIDER, NULL, 0); } -static void node_composit_buts_map_uv(uiLayout *layout, bContext *C, PointerRNA *ptr) +static void node_composit_buts_map_uv(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) { uiItemR(layout, ptr, "alpha", 0, NULL, 0); } -static void node_composit_buts_id_mask(uiLayout *layout, bContext *C, PointerRNA *ptr) +static void node_composit_buts_id_mask(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) { uiItemR(layout, ptr, "index", 0, NULL, 0); } -static void node_composit_buts_file_output(uiLayout *layout, bContext *C, PointerRNA *ptr) +static void node_composit_buts_file_output(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) { uiLayout *col, *row; @@ -916,17 +916,17 @@ static void node_composit_buts_file_output(uiLayout *layout, bContext *C, Pointe uiItemR(row, ptr, "frame_end", 0, "End", 0); } -static void node_composit_buts_scale(uiLayout *layout, bContext *C, PointerRNA *ptr) +static void node_composit_buts_scale(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) { uiItemR(layout, ptr, "space", 0, "", 0); } -static void node_composit_buts_rotate(uiLayout *layout, bContext *C, PointerRNA *ptr) +static void node_composit_buts_rotate(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) { uiItemR(layout, ptr, "filter_type", 0, "", 0); } -static void node_composit_buts_invert(uiLayout *layout, bContext *C, PointerRNA *ptr) +static void node_composit_buts_invert(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) { uiLayout *col; @@ -935,17 +935,17 @@ static void node_composit_buts_invert(uiLayout *layout, bContext *C, PointerRNA uiItemR(col, ptr, "invert_alpha", 0, NULL, 0); } -static void node_composit_buts_premulkey(uiLayout *layout, bContext *C, PointerRNA *ptr) +static void node_composit_buts_premulkey(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) { uiItemR(layout, ptr, "mapping", 0, "", 0); } -static void node_composit_buts_view_levels(uiLayout *layout, bContext *C, PointerRNA *ptr) +static void node_composit_buts_view_levels(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) { uiItemR(layout, ptr, "channel", UI_ITEM_R_EXPAND, NULL, 0); } -static void node_composit_buts_colorbalance(uiLayout *layout, bContext *C, PointerRNA *ptr) +static void node_composit_buts_colorbalance(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) { uiLayout *split, *col, *row; @@ -990,7 +990,7 @@ static void node_composit_buts_colorbalance(uiLayout *layout, bContext *C, Point } -static void node_composit_buts_huecorrect(uiLayout *layout, bContext *C, PointerRNA *ptr) +static void node_composit_buts_huecorrect(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) { uiTemplateCurveMapping(layout, ptr, "mapping", 'h', 0, 0); } @@ -1143,7 +1143,7 @@ static void node_composit_set_butfunc(bNodeType *ntype) /* ****************** BUTTON CALLBACKS FOR TEXTURE NODES ***************** */ -static void node_texture_buts_bricks(uiLayout *layout, bContext *C, PointerRNA *ptr) +static void node_texture_buts_bricks(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) { uiLayout *col; @@ -1156,7 +1156,7 @@ static void node_texture_buts_bricks(uiLayout *layout, bContext *C, PointerRNA * uiItemR(col, ptr, "squash_frequency", 0, "Frequency", 0); } -static void node_texture_buts_proc(uiLayout *layout, bContext *C, PointerRNA *ptr) +static void node_texture_buts_proc(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) { PointerRNA tex_ptr; bNode *node= ptr->data; @@ -1215,7 +1215,7 @@ static void node_texture_buts_image(uiLayout *layout, bContext *C, PointerRNA *p uiTemplateID(layout, C, ptr, "image", NULL, "IMAGE_OT_open", NULL); } -static void node_texture_buts_output(uiLayout *layout, bContext *C, PointerRNA *ptr) +static void node_texture_buts_output(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) { uiItemR(layout, ptr, "filepath", 0, "", 0); } diff --git a/source/blender/editors/space_node/node_buttons.c b/source/blender/editors/space_node/node_buttons.c index 11319d817c7..954018bfd4f 100644 --- a/source/blender/editors/space_node/node_buttons.c +++ b/source/blender/editors/space_node/node_buttons.c @@ -63,7 +63,7 @@ #define B_NOP 1 #define B_REDR 2 -static void do_node_region_buttons(bContext *C, void *arg, int event) +static void do_node_region_buttons(bContext *C, void *UNUSED(arg), int event) { //SpaceNode *snode= CTX_wm_space_node(C); @@ -75,7 +75,7 @@ static void do_node_region_buttons(bContext *C, void *arg, int event) } /* poll callback for active node */ -static int active_node_poll(const bContext *C, PanelType *pt) +static int active_node_poll(const bContext *C, PanelType *UNUSED(pt)) { SpaceNode *snode= CTX_wm_space_node(C); @@ -135,7 +135,7 @@ void node_buttons_register(ARegionType *art) BLI_addtail(&art->paneltypes, pt); } -static int node_properties(bContext *C, wmOperator *op) +static int node_properties(bContext *C, wmOperator *UNUSED(op)) { ScrArea *sa= CTX_wm_area(C); ARegion *ar= node_has_buttons_region(sa); diff --git a/source/blender/editors/space_node/node_draw.c b/source/blender/editors/space_node/node_draw.c index dfc63e032d9..a81d6e3b0ce 100644 --- a/source/blender/editors/space_node/node_draw.c +++ b/source/blender/editors/space_node/node_draw.c @@ -111,7 +111,7 @@ static int has_nodetree(bNodeTree *ntree, bNodeTree *lookup) return 0; } -void ED_node_generic_update(Main *bmain, Scene *scene, bNodeTree *ntree, bNode *node) +void ED_node_generic_update(Main *bmain, bNodeTree *ntree, bNode *node) { Material *ma; Tex *tex; @@ -309,7 +309,7 @@ static void node_update(const bContext *C, bNodeTree *ntree, bNode *node) } /* based on settings in node, sets drawing rect info. each redraw! */ -static void node_update_hidden(const bContext *C, bNode *node) +static void node_update_hidden(bNode *node) { bNodeSocket *nsock; float rad, drad, hiddenrad= HIDDEN_RAD; @@ -392,7 +392,7 @@ static void node_update_group(const bContext *C, bNodeTree *ntree, bNode *gnode) node->locy+= gnode->locy; if(node->flag & NODE_HIDDEN) - node_update_hidden(C, node); + node_update_hidden(node); else node_update(C, ntree, node); node->locx-= gnode->locx; @@ -483,7 +483,7 @@ static void node_draw_mute_line(View2D *v2d, SpaceNode *snode, bNode *node) /* nice AA filled circle */ /* this might have some more generic use */ -static void circle_draw(float x, float y, float size, int type, int col[3]) +static void circle_draw(float x, float y, float size, int col[3]) { /* 16 values of sin function */ static float si[16] = { @@ -538,11 +538,11 @@ static void socket_circle_draw(bNodeSocket *sock, float size) else { col[0]= 100; col[1]= 200; col[2]= 100; } - - circle_draw(sock->locx, sock->locy, size, sock->type, col); + + circle_draw(sock->locx, sock->locy, size, col); } -static void node_sync_cb(bContext *C, void *snode_v, void *node_v) +static void node_sync_cb(bContext *UNUSED(C), void *snode_v, void *node_v) { SpaceNode *snode= snode_v; @@ -1066,7 +1066,7 @@ void drawnodespace(const bContext *C, ARegion *ar, View2D *v2d) UI_ThemeClearColor(TH_BACK); glClear(GL_COLOR_BUFFER_BIT); - UI_view2d_view_ortho(C, v2d); + UI_view2d_view_ortho(v2d); //uiFreeBlocksWin(&sa->uiblocks, sa->win); @@ -1078,7 +1078,7 @@ void drawnodespace(const bContext *C, ARegion *ar, View2D *v2d) snode->aspect= (v2d->cur.xmax - v2d->cur.xmin)/((float)ar->winx); // XXX snode->curfont= uiSetCurFont_ext(snode->aspect); - UI_view2d_constant_grid_draw(C, v2d); + UI_view2d_constant_grid_draw(v2d); /* backdrop */ draw_nodespace_back_pix(ar, snode, color_manage); @@ -1103,7 +1103,7 @@ void drawnodespace(const bContext *C, ARegion *ar, View2D *v2d) if(node->flag & NODE_GROUP_EDIT) node_update_group(C, snode->nodetree, node); else if(node->flag & NODE_HIDDEN) - node_update_hidden(C, node); + node_update_hidden(node); else node_update(C, snode->nodetree, node); } diff --git a/source/blender/editors/space_node/node_edit.c b/source/blender/editors/space_node/node_edit.c index 968391f271e..b8bfed2b75e 100644 --- a/source/blender/editors/space_node/node_edit.c +++ b/source/blender/editors/space_node/node_edit.c @@ -98,7 +98,7 @@ static int compo_breakjob(void *cjv) } /* called by compo, wmJob sends notifier */ -static void compo_redrawjob(void *cjv, char *str) +static void compo_redrawjob(void *cjv, char *UNUSED(str)) { CompoJob *cj= cjv; @@ -541,7 +541,7 @@ void snode_make_group_editable(SpaceNode *snode, bNode *gnode) ntreeSolveOrder(snode->nodetree); } -static int node_group_edit_exec(bContext *C, wmOperator *op) +static int node_group_edit_exec(bContext *C, wmOperator *UNUSED(op)) { SpaceNode *snode = CTX_wm_space_node(C); bNode *gnode; @@ -556,7 +556,7 @@ static int node_group_edit_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -static int node_group_edit_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int node_group_edit_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { SpaceNode *snode = CTX_wm_space_node(C); bNode *gnode; @@ -1100,7 +1100,7 @@ static void node_link_viewer(SpaceNode *snode, bNode *tonode) } -static int node_active_link_viewer(bContext *C, wmOperator *op) +static int node_active_link_viewer(bContext *C, wmOperator *UNUSED(op)) { SpaceNode *snode= CTX_wm_space_node(C); bNode *node; @@ -1472,12 +1472,21 @@ bNode *node_add_node(SpaceNode *snode, Scene *scene, int type, float locx, float /* ****************** Duplicate *********************** */ -static int node_duplicate_exec(bContext *C, wmOperator *op) +static int node_duplicate_exec(bContext *C, wmOperator *UNUSED(op)) { SpaceNode *snode= CTX_wm_space_node(C); + bNode *node; 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) { + if(node->flag & SELECT) { + id_us_plus(node->id); + } + } + ntreeCopyTree(snode->edittree, 1); /* 1 == internally selected nodes */ ntreeSolveOrder(snode->edittree); @@ -1851,7 +1860,7 @@ void NODE_OT_links_cut(wmOperatorType *ot) // XXX some code needing updating to operators... /* goes over all scenes, reads render layers */ -static int node_read_renderlayers_exec(bContext *C, wmOperator *op) +static int node_read_renderlayers_exec(bContext *C, wmOperator *UNUSED(op)) { Main *bmain= CTX_data_main(C); SpaceNode *snode= CTX_wm_space_node(C); @@ -1893,7 +1902,7 @@ void NODE_OT_read_renderlayers(wmOperatorType *ot) ot->flag= 0; } -static int node_read_fullsamplelayers_exec(bContext *C, wmOperator *op) +static int node_read_fullsamplelayers_exec(bContext *C, wmOperator *UNUSED(op)) { SpaceNode *snode= CTX_wm_space_node(C); Scene *curscene= CTX_data_scene(C); @@ -2015,7 +2024,7 @@ static void node_flag_toggle_exec(SpaceNode *snode, int toggle_flag) } } -static int node_hide_exec(bContext *C, wmOperator *op) +static int node_hide_exec(bContext *C, wmOperator *UNUSED(op)) { SpaceNode *snode= CTX_wm_space_node(C); @@ -2045,7 +2054,7 @@ void NODE_OT_hide_toggle(wmOperatorType *ot) ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; } -static int node_preview_exec(bContext *C, wmOperator *op) +static int node_preview_exec(bContext *C, wmOperator *UNUSED(op)) { SpaceNode *snode= CTX_wm_space_node(C); @@ -2077,7 +2086,7 @@ void NODE_OT_preview_toggle(wmOperatorType *ot) ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; } -static int node_socket_toggle_exec(bContext *C, wmOperator *op) +static int node_socket_toggle_exec(bContext *C, wmOperator *UNUSED(op)) { SpaceNode *snode= CTX_wm_space_node(C); bNode *node; @@ -2128,7 +2137,7 @@ void NODE_OT_hide_socket_toggle(wmOperatorType *ot) /* ****************** Mute operator *********************** */ -static int node_mute_exec(bContext *C, wmOperator *op) +static int node_mute_exec(bContext *C, wmOperator *UNUSED(op)) { SpaceNode *snode= CTX_wm_space_node(C); bNode *node; @@ -2170,7 +2179,7 @@ void NODE_OT_mute_toggle(wmOperatorType *ot) /* ****************** Delete operator ******************* */ -static int node_delete_exec(bContext *C, wmOperator *op) +static int node_delete_exec(bContext *C, wmOperator *UNUSED(op)) { SpaceNode *snode= CTX_wm_space_node(C); bNode *node, *next; @@ -2211,7 +2220,7 @@ void NODE_OT_delete(wmOperatorType *ot) /* ****************** Show Cyclic Dependencies Operator ******************* */ -static int node_show_cycles_exec(bContext *C, wmOperator *op) +static int node_show_cycles_exec(bContext *C, wmOperator *UNUSED(op)) { SpaceNode *snode= CTX_wm_space_node(C); @@ -2255,7 +2264,7 @@ static int node_add_file_exec(bContext *C, wmOperator *op) errno= 0; - ima= BKE_add_image_file(path, scene ? scene->r.cfra : 1); + ima= BKE_add_image_file(path); if(!ima) { BKE_reportf(op->reports, RPT_ERROR, "Can't read: \"%s\", %s.", path, errno ? strerror(errno) : "Unsupported image format"); diff --git a/source/blender/editors/space_node/node_header.c b/source/blender/editors/space_node/node_header.c index 0711ef66497..64e4bc4cbc8 100644 --- a/source/blender/editors/space_node/node_header.c +++ b/source/blender/editors/space_node/node_header.c @@ -55,7 +55,7 @@ /* ************************ add menu *********************** */ -static void do_node_add(bContext *C, void *arg, int event) +static void do_node_add(bContext *C, void *UNUSED(arg), int event) { SpaceNode *snode= CTX_wm_space_node(C); bNode *node; @@ -202,7 +202,7 @@ static void node_menu_add(const bContext *C, Menu *menu) } } -void node_menus_register(ARegionType *art) +void node_menus_register(void) { MenuType *mt; diff --git a/source/blender/editors/space_node/node_intern.h b/source/blender/editors/space_node/node_intern.h index 77fda0627e7..cba491deb01 100644 --- a/source/blender/editors/space_node/node_intern.h +++ b/source/blender/editors/space_node/node_intern.h @@ -41,7 +41,7 @@ ARegion *node_has_buttons_region(ScrArea *sa); /* node_header.c */ void node_header_buttons(const bContext *C, ARegion *ar); -void node_menus_register(struct ARegionType *art); +void node_menus_register(void); /* node_draw.c */ void drawnodespace(const bContext *C, ARegion *ar, View2D *v2d); diff --git a/source/blender/editors/space_node/node_select.c b/source/blender/editors/space_node/node_select.c index ec08cdf07ac..402e1b2d1cd 100644 --- a/source/blender/editors/space_node/node_select.c +++ b/source/blender/editors/space_node/node_select.c @@ -241,7 +241,7 @@ void NODE_OT_select_border(wmOperatorType *ot) /* ****** Select/Deselect All ****** */ -static int node_select_all_exec(bContext *C, wmOperator *op) +static int node_select_all_exec(bContext *C, wmOperator *UNUSED(op)) { SpaceNode *snode = CTX_wm_space_node(C); bNode *first = snode->edittree->nodes.first; @@ -282,7 +282,7 @@ void NODE_OT_select_all(wmOperatorType *ot) /* ****** Select Linked To ****** */ -static int node_select_linked_to_exec(bContext *C, wmOperator *op) +static int node_select_linked_to_exec(bContext *C, wmOperator *UNUSED(op)) { SpaceNode *snode = CTX_wm_space_node(C); bNodeLink *link; @@ -322,7 +322,7 @@ void NODE_OT_select_linked_to(wmOperatorType *ot) /* ****** Select Linked From ****** */ -static int node_select_linked_from_exec(bContext *C, wmOperator *op) +static int node_select_linked_from_exec(bContext *C, wmOperator *UNUSED(op)) { SpaceNode *snode = CTX_wm_space_node(C); bNodeLink *link; @@ -362,7 +362,7 @@ void NODE_OT_select_linked_from(wmOperatorType *ot) /* ****** Select Same Type ****** */ -static int node_select_same_type_exec(bContext *C, wmOperator *op) +static int node_select_same_type_exec(bContext *C, wmOperator *UNUSED(op)) { SpaceNode *snode = CTX_wm_space_node(C); @@ -388,7 +388,7 @@ void NODE_OT_select_same_type(wmOperatorType *ot) /* ****** Select The Next/Prev Node Of The Same Type ****** */ -static int node_select_same_type_next_exec(bContext *C, wmOperator *op) +static int node_select_same_type_next_exec(bContext *C, wmOperator *UNUSED(op)) { SpaceNode *snode = CTX_wm_space_node(C); @@ -412,7 +412,7 @@ void NODE_OT_select_same_type_next(wmOperatorType *ot) ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO; } -static int node_select_same_type_prev_exec(bContext *C, wmOperator *op) +static int node_select_same_type_prev_exec(bContext *C, wmOperator *UNUSED(op)) { SpaceNode *snode = CTX_wm_space_node(C); diff --git a/source/blender/editors/space_node/node_state.c b/source/blender/editors/space_node/node_state.c index b4f09f960d6..48801d4369d 100644 --- a/source/blender/editors/space_node/node_state.c +++ b/source/blender/editors/space_node/node_state.c @@ -140,7 +140,7 @@ static int do_header_node(SpaceNode *snode, bNode *node, float mx, float my) return 0; } -static int do_header_hidden_node(SpaceNode *snode, bNode *node, float mx, float my) +static int do_header_hidden_node(bNode *node, float mx, float my) { rctf totr= node->totr; @@ -164,7 +164,7 @@ static int node_toggle_visibility(SpaceNode *snode, ARegion *ar, short *mval) for(next_node(snode->edittree); (node=next_node(NULL));) { if(node->flag & NODE_HIDDEN) { - if(do_header_hidden_node(snode, node, mx, my)) { + if(do_header_hidden_node(node, mx, my)) { ED_region_tag_redraw(ar); return 1; } @@ -227,7 +227,7 @@ void NODE_OT_visibility_toggle(wmOperatorType *ot) /* **************** View All Operator ************** */ -static void snode_home(ScrArea *sa, ARegion *ar, SpaceNode* snode) +static void snode_home(ScrArea *UNUSED(sa), ARegion *ar, SpaceNode* snode) { bNode *node; rctf *cur, *tot; @@ -278,7 +278,7 @@ static void snode_home(ScrArea *sa, ARegion *ar, SpaceNode* snode) UI_view2d_curRect_validate(&ar->v2d); } -static int node_view_all_exec(bContext *C, wmOperator *op) +static int node_view_all_exec(bContext *C, wmOperator *UNUSED(op)) { ScrArea *sa= CTX_wm_area(C); ARegion *ar= CTX_wm_region(C); diff --git a/source/blender/editors/space_node/space_node.c b/source/blender/editors/space_node/space_node.c index c94fcb52e38..d38e2af734b 100644 --- a/source/blender/editors/space_node/space_node.c +++ b/source/blender/editors/space_node/space_node.c @@ -89,7 +89,7 @@ ARegion *node_has_buttons_region(ScrArea *sa) /* ******************** default callbacks for node space ***************** */ -static SpaceLink *node_new(const bContext *C) +static SpaceLink *node_new(const bContext *UNUSED(C)) { ARegion *ar; SpaceNode *snode; @@ -145,14 +145,14 @@ static SpaceLink *node_new(const bContext *C) } /* not spacelink itself */ -static void node_free(SpaceLink *sl) +static void node_free(SpaceLink *UNUSED(sl)) { } /* spacetype; init callback */ -static void node_init(struct wmWindowManager *wm, ScrArea *sa) +static void node_init(struct wmWindowManager *UNUSED(wm), ScrArea *UNUSED(sa)) { } @@ -306,7 +306,7 @@ static void node_main_area_draw(const bContext *C, ARegion *ar) /* ************* dropboxes ************* */ -static int node_drop_poll(bContext *C, wmDrag *drag, wmEvent *event) +static int node_drop_poll(bContext *UNUSED(C), wmDrag *drag, wmEvent *UNUSED(event)) { if(drag->type==WM_DRAG_ID) { ID *id= (ID *)drag->poin; @@ -345,7 +345,7 @@ static void node_dropboxes(void) /* add handlers, stuff you only do once or on area/region changes */ -static void node_header_area_init(wmWindowManager *wm, ARegion *ar) +static void node_header_area_init(wmWindowManager *UNUSED(wm), ARegion *ar) { ED_region_header_init(ar); } @@ -452,7 +452,7 @@ void ED_spacetype_node(void) BLI_addhead(&st->regiontypes, art); - node_menus_register(art); + node_menus_register(); /* regions: listview/buttons */ art= MEM_callocN(sizeof(ARegionType), "spacetype node region"); diff --git a/source/blender/editors/space_outliner/outliner.c b/source/blender/editors/space_outliner/outliner.c index d80291e199b..60431f0e36d 100644 --- a/source/blender/editors/space_outliner/outliner.c +++ b/source/blender/editors/space_outliner/outliner.c @@ -120,7 +120,7 @@ /* ************* XXX **************** */ -static void error(const char *dummy, ...) {} +static void error(const char *UNUSED(arg), ...) {} /* ********************************** */ @@ -1556,7 +1556,7 @@ static void outliner_set_flag(SpaceOops *soops, ListBase *lb, short flag, short /* same check needed for both object operation and restrict column button func * return 0 when in edit mode (cannot restrict view or select) * otherwise return 1 */ -static int common_restrict_check(bContext *C, Scene *scene, Object *ob) +static int common_restrict_check(bContext *C, Object *ob) { /* Don't allow hide an object in edit mode, * check the bug #22153 and #21609, #23977 @@ -1575,13 +1575,13 @@ static int common_restrict_check(bContext *C, Scene *scene, Object *ob) return 1; } -void object_toggle_visibility_cb(bContext *C, Scene *scene, TreeElement *te, TreeStoreElem *tsep, TreeStoreElem *tselem) +void object_toggle_visibility_cb(bContext *C, Scene *scene, TreeElement *te, TreeStoreElem *UNUSED(tsep), TreeStoreElem *tselem) { Base *base= (Base *)te->directdata; Object *ob = (Object *)tselem->id; /* add check for edit mode */ - if(!common_restrict_check(C, scene, ob)) return; + if(!common_restrict_check(C, ob)) return; if(base || (base= object_in_scene(ob, scene))) { if((base->object->restrictflag ^= OB_RESTRICT_VIEW)) { @@ -1590,7 +1590,7 @@ void object_toggle_visibility_cb(bContext *C, Scene *scene, TreeElement *te, Tre } } -static int outliner_toggle_visibility_exec(bContext *C, wmOperator *op) +static int outliner_toggle_visibility_exec(bContext *C, wmOperator *UNUSED(op)) { SpaceOops *soops= CTX_wm_space_outliner(C); Scene *scene= CTX_data_scene(C); @@ -1620,7 +1620,7 @@ void OUTLINER_OT_visibility_toggle(wmOperatorType *ot) /* --- */ -static void object_toggle_selectability_cb(bContext *C, Scene *scene, TreeElement *te, TreeStoreElem *tsep, TreeStoreElem *tselem) +static void object_toggle_selectability_cb(bContext *UNUSED(C), Scene *scene, TreeElement *te, TreeStoreElem *UNUSED(tsep), TreeStoreElem *tselem) { Base *base= (Base *)te->directdata; @@ -1630,7 +1630,7 @@ static void object_toggle_selectability_cb(bContext *C, Scene *scene, TreeElemen } } -static int outliner_toggle_selectability_exec(bContext *C, wmOperator *op) +static int outliner_toggle_selectability_exec(bContext *C, wmOperator *UNUSED(op)) { SpaceOops *soops= CTX_wm_space_outliner(C); Scene *scene= CTX_data_scene(C); @@ -1658,7 +1658,7 @@ void OUTLINER_OT_selectability_toggle(wmOperatorType *ot) ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; } -void object_toggle_renderability_cb(bContext *C, Scene *scene, TreeElement *te, TreeStoreElem *tsep, TreeStoreElem *tselem) +void object_toggle_renderability_cb(bContext *UNUSED(C), Scene *scene, TreeElement *te, TreeStoreElem *UNUSED(tsep), TreeStoreElem *tselem) { Base *base= (Base *)te->directdata; @@ -1668,7 +1668,7 @@ void object_toggle_renderability_cb(bContext *C, Scene *scene, TreeElement *te, } } -static int outliner_toggle_renderability_exec(bContext *C, wmOperator *op) +static int outliner_toggle_renderability_exec(bContext *C, wmOperator *UNUSED(op)) { SpaceOops *soops= CTX_wm_space_outliner(C); Scene *scene= CTX_data_scene(C); @@ -1697,7 +1697,7 @@ void OUTLINER_OT_renderability_toggle(wmOperatorType *ot) /* --- */ -static int outliner_toggle_expanded_exec(bContext *C, wmOperator *op) +static int outliner_toggle_expanded_exec(bContext *C, wmOperator *UNUSED(op)) { SpaceOops *soops= CTX_wm_space_outliner(C); ARegion *ar= CTX_wm_region(C); @@ -1728,7 +1728,7 @@ void OUTLINER_OT_expanded_toggle(wmOperatorType *ot) /* --- */ -static int outliner_toggle_selected_exec(bContext *C, wmOperator *op) +static int outliner_toggle_selected_exec(bContext *C, wmOperator *UNUSED(op)) { SpaceOops *soops= CTX_wm_space_outliner(C); ARegion *ar= CTX_wm_region(C); @@ -1820,6 +1820,8 @@ void OUTLINER_OT_show_one_level(wmOperatorType *ot) RNA_def_boolean(ot->srna, "open", 1, "Open", "Expand all entries one level deep."); } +/* This is not used anywhere at the moment */ +#if 0 /* return 1 when levels were opened */ static int outliner_open_back(SpaceOops *soops, TreeElement *te) { @@ -1836,8 +1838,6 @@ static int outliner_open_back(SpaceOops *soops, TreeElement *te) return retval; } -/* This is not used anywhere at the moment */ -#if 0 static void outliner_open_reveal(SpaceOops *soops, ListBase *lb, TreeElement *teFind, int *found) { TreeElement *te; @@ -1863,7 +1863,7 @@ static void outliner_open_reveal(SpaceOops *soops, ListBase *lb, TreeElement *te #endif // XXX just use View2D ops for this? -void outliner_page_up_down(Scene *scene, ARegion *ar, SpaceOops *soops, int up) +void outliner_page_up_down(Scene *UNUSED(scene), ARegion *ar, SpaceOops *soops, int up) { int dy= ar->v2d.mask.ymax-ar->v2d.mask.ymin; @@ -2056,7 +2056,7 @@ static int tree_element_active_texture(bContext *C, Scene *scene, SpaceOops *soo } -static int tree_element_active_lamp(bContext *C, Scene *scene, SpaceOops *soops, TreeElement *te, int set) +static int tree_element_active_lamp(bContext *UNUSED(C), Scene *scene, SpaceOops *soops, TreeElement *te, int set) { Object *ob; @@ -2204,7 +2204,7 @@ static int tree_element_active_bone(bContext *C, Scene *scene, TreeElement *te, /* ebones only draw in editmode armature */ -static int tree_element_active_ebone(bContext *C, Scene *scene, TreeElement *te, TreeStoreElem *tselem, int set) +static int tree_element_active_ebone(bContext *C, Scene *scene, TreeElement *te, TreeStoreElem *UNUSED(tselem), int set) { EditBone *ebone= te->directdata; @@ -2229,7 +2229,7 @@ static int tree_element_active_ebone(bContext *C, Scene *scene, TreeElement *te, return 0; } -static int tree_element_active_modifier(bContext *C, TreeElement *te, TreeStoreElem *tselem, int set) +static int tree_element_active_modifier(bContext *C, TreeElement *UNUSED(te), TreeStoreElem *tselem, int set) { if(set) { Object *ob= (Object *)tselem->id; @@ -2242,7 +2242,7 @@ static int tree_element_active_modifier(bContext *C, TreeElement *te, TreeStoreE return 0; } -static int tree_element_active_psys(bContext *C, Scene *scene, TreeElement *te, TreeStoreElem *tselem, int set) +static int tree_element_active_psys(bContext *C, Scene *UNUSED(scene), TreeElement *UNUSED(te), TreeStoreElem *tselem, int set) { if(set) { Object *ob= (Object *)tselem->id; @@ -2255,7 +2255,7 @@ static int tree_element_active_psys(bContext *C, Scene *scene, TreeElement *te, return 0; } -static int tree_element_active_constraint(bContext *C, TreeElement *te, TreeStoreElem *tselem, int set) +static int tree_element_active_constraint(bContext *C, TreeElement *UNUSED(te), TreeStoreElem *tselem, int set) { if(set) { Object *ob= (Object *)tselem->id; @@ -2267,7 +2267,7 @@ static int tree_element_active_constraint(bContext *C, TreeElement *te, TreeStor return 0; } -static int tree_element_active_text(bContext *C, Scene *scene, SpaceOops *soops, TreeElement *te, int set) +static int tree_element_active_text(bContext *UNUSED(C), Scene *UNUSED(scene), SpaceOops *UNUSED(soops), TreeElement *UNUSED(te), int UNUSED(set)) { // XXX removed return 0; @@ -2292,7 +2292,7 @@ static int tree_element_active(bContext *C, Scene *scene, SpaceOops *soops, Tree return 0; } -static int tree_element_active_pose(bContext *C, Scene *scene, TreeElement *te, TreeStoreElem *tselem, int set) +static int tree_element_active_pose(bContext *C, Scene *scene, TreeElement *UNUSED(te), TreeStoreElem *tselem, int set) { Object *ob= (Object *)tselem->id; Base *base= object_in_scene(ob, scene); @@ -2312,7 +2312,7 @@ static int tree_element_active_pose(bContext *C, Scene *scene, TreeElement *te, return 0; } -static int tree_element_active_sequence(bContext *C, TreeElement *te, TreeStoreElem *tselem, int set) +static int tree_element_active_sequence(TreeElement *te, TreeStoreElem *UNUSED(tselem), int set) { Sequence *seq= (Sequence*) te->directdata; @@ -2326,7 +2326,7 @@ static int tree_element_active_sequence(bContext *C, TreeElement *te, TreeStoreE return(0); } -static int tree_element_active_sequence_dup(bContext *C, Scene *scene, TreeElement *te, TreeStoreElem *tselem, int set) +static int tree_element_active_sequence_dup(Scene *scene, TreeElement *te, TreeStoreElem *UNUSED(tselem), int set) { Sequence *seq, *p; Editing *ed= seq_give_editing(scene, FALSE); @@ -2353,7 +2353,7 @@ static int tree_element_active_sequence_dup(bContext *C, Scene *scene, TreeEleme return(0); } -static int tree_element_active_keymap_item(bContext *C, TreeElement *te, TreeStoreElem *tselem, int set) +static int tree_element_active_keymap_item(bContext *UNUSED(C), TreeElement *te, TreeStoreElem *UNUSED(tselem), int set) { wmKeyMapItem *kmi= te->directdata; @@ -2398,9 +2398,9 @@ static int tree_element_type_active(bContext *C, Scene *scene, SpaceOops *soops, case TSE_POSEGRP: return tree_element_active_posegroup(C, scene, te, tselem, set); case TSE_SEQUENCE: - return tree_element_active_sequence(C, te, tselem, set); + return tree_element_active_sequence(te, tselem, set); case TSE_SEQUENCE_DUP: - return tree_element_active_sequence_dup(C, scene, te, tselem, set); + return tree_element_active_sequence_dup(scene, te, tselem, set); case TSE_KEYMAP_ITEM: return tree_element_active_keymap_item(C, te, tselem, set); @@ -2660,7 +2660,7 @@ static int do_outliner_item_rename(bContext *C, ARegion *ar, SpaceOops *soops, T return 0; } -static int outliner_item_rename(bContext *C, wmOperator *op, wmEvent *event) +static int outliner_item_rename(bContext *C, wmOperator *UNUSED(op), wmEvent *event) { ARegion *ar= CTX_wm_region(C); SpaceOops *soops= CTX_wm_space_outliner(C); @@ -2687,39 +2687,6 @@ void OUTLINER_OT_item_rename(wmOperatorType *ot) ot->poll= ED_operator_outliner_active; } - - -/* recursive helper for function below */ -static void outliner_set_coordinates_element(SpaceOops *soops, TreeElement *te, int startx, int *starty) -{ - TreeStoreElem *tselem= TREESTORE(te); - - /* store coord and continue, we need coordinates for elements outside view too */ - te->xs= (float)startx; - te->ys= (float)(*starty); - *starty-= OL_H; - - if((tselem->flag & TSE_CLOSED)==0) { - TreeElement *ten; - for(ten= te->subtree.first; ten; ten= ten->next) { - outliner_set_coordinates_element(soops, ten, startx+OL_X, starty); - } - } - -} - -/* to retrieve coordinates with redrawing the entire tree */ -static void outliner_set_coordinates(ARegion *ar, SpaceOops *soops) -{ - TreeElement *te; - int starty= (int)(ar->v2d.tot.ymax)-OL_H; - int startx= 0; - - for(te= soops->tree.first; te; te= te->next) { - outliner_set_coordinates_element(soops, te, startx, &starty); - } -} - static TreeElement *outliner_find_id(SpaceOops *soops, ListBase *lb, ID *id) { TreeElement *te, *tes; @@ -2739,7 +2706,7 @@ static TreeElement *outliner_find_id(SpaceOops *soops, ListBase *lb, ID *id) return NULL; } -static int outliner_show_active_exec(bContext *C, wmOperator *op) +static int outliner_show_active_exec(bContext *C, wmOperator *UNUSED(op)) { SpaceOops *so= CTX_wm_space_outliner(C); Scene *scene= CTX_data_scene(C); @@ -2789,6 +2756,66 @@ void OUTLINER_OT_show_active(wmOperatorType *ot) ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; } +/* tse is not in the treestore, we use its contents to find a match */ +static TreeElement *outliner_find_tse(SpaceOops *soops, TreeStoreElem *tse) +{ + TreeStore *ts= soops->treestore; + TreeStoreElem *tselem; + int a; + + if(tse->id==NULL) return NULL; + + /* check if 'tse' is in treestore */ + tselem= ts->data; + for(a=0; a<ts->usedelem; a++, tselem++) { + if((tse->type==0 && tselem->type==0) || (tselem->type==tse->type && tselem->nr==tse->nr)) { + if(tselem->id==tse->id) { + break; + } + } + } + if(tselem) + return outliner_find_tree_element(&soops->tree, a); + + return NULL; +} + + +/* Called to find an item based on name. + */ +#if 0 + +/* recursive helper for function below */ +static void outliner_set_coordinates_element(SpaceOops *soops, TreeElement *te, int startx, int *starty) +{ + TreeStoreElem *tselem= TREESTORE(te); + + /* store coord and continue, we need coordinates for elements outside view too */ + te->xs= (float)startx; + te->ys= (float)(*starty); + *starty-= OL_H; + + if((tselem->flag & TSE_CLOSED)==0) { + TreeElement *ten; + for(ten= te->subtree.first; ten; ten= ten->next) { + outliner_set_coordinates_element(soops, ten, startx+OL_X, starty); + } + } + +} + +/* to retrieve coordinates with redrawing the entire tree */ +static void outliner_set_coordinates(ARegion *ar, SpaceOops *soops) +{ + TreeElement *te; + int starty= (int)(ar->v2d.tot.ymax)-OL_H; + int startx= 0; + + for(te= soops->tree.first; te; te= te->next) { + outliner_set_coordinates_element(soops, te, startx, &starty); + } +} + /* find next element that has this name */ static TreeElement *outliner_find_named(SpaceOops *soops, ListBase *lb, char *name, int flags, TreeElement *prev, int *prevFound) { @@ -2818,34 +2845,7 @@ static TreeElement *outliner_find_named(SpaceOops *soops, ListBase *lb, char *na return NULL; } -/* tse is not in the treestore, we use its contents to find a match */ -static TreeElement *outliner_find_tse(SpaceOops *soops, TreeStoreElem *tse) -{ - TreeStore *ts= soops->treestore; - TreeStoreElem *tselem; - int a; - - if(tse->id==NULL) return NULL; - - /* check if 'tse' is in treestore */ - tselem= ts->data; - for(a=0; a<ts->usedelem; a++, tselem++) { - if((tse->type==0 && tselem->type==0) || (tselem->type==tse->type && tselem->nr==tse->nr)) { - if(tselem->id==tse->id) { - break; - } - } - } - if(tselem) - return outliner_find_tree_element(&soops->tree, a); - - return NULL; -} - - -/* Called to find an item based on name. - */ -void outliner_find_panel(Scene *scene, ARegion *ar, SpaceOops *soops, int again, int flags) +static void outliner_find_panel(Scene *UNUSED(scene), ARegion *ar, SpaceOops *soops, int again, int flags) { TreeElement *te= NULL; TreeElement *last_find; @@ -2917,6 +2917,7 @@ void outliner_find_panel(Scene *scene, ARegion *ar, SpaceOops *soops, int again, error("Not found: %s", name); } } +#endif /* helper function for tree_element_shwo_hierarchy() - recursively checks whether subtrees have any objects*/ static int subtree_has_objects(SpaceOops *soops, ListBase *lb) @@ -2959,7 +2960,7 @@ static void tree_element_show_hierarchy(Scene *scene, SpaceOops *soops, ListBase } /* show entire object level hierarchy */ -static int outliner_show_hierarchy_exec(bContext *C, wmOperator *op) +static int outliner_show_hierarchy_exec(bContext *C, wmOperator *UNUSED(op)) { SpaceOops *soops= CTX_wm_space_outliner(C); ARegion *ar= CTX_wm_region(C); @@ -3077,7 +3078,7 @@ static void set_operation_types(SpaceOops *soops, ListBase *lb, } } -static void unlink_material_cb(bContext *C, Scene *scene, TreeElement *te, TreeStoreElem *tsep, TreeStoreElem *tselem) +static void unlink_material_cb(bContext *UNUSED(C), Scene *UNUSED(scene), TreeElement *te, TreeStoreElem *tsep, TreeStoreElem *UNUSED(tselem)) { Material **matar=NULL; int a, totcol=0; @@ -3111,7 +3112,7 @@ static void unlink_material_cb(bContext *C, Scene *scene, TreeElement *te, TreeS } } -static void unlink_texture_cb(bContext *C, Scene *scene, TreeElement *te, TreeStoreElem *tsep, TreeStoreElem *tselem) +static void unlink_texture_cb(bContext *UNUSED(C), Scene *UNUSED(scene), TreeElement *te, TreeStoreElem *tsep, TreeStoreElem *UNUSED(tselem)) { MTex **mtex= NULL; int a; @@ -3140,7 +3141,7 @@ static void unlink_texture_cb(bContext *C, Scene *scene, TreeElement *te, TreeSt } } -static void unlink_group_cb(bContext *C, Scene *scene, TreeElement *te, TreeStoreElem *tsep, TreeStoreElem *tselem) +static void unlink_group_cb(bContext *UNUSED(C), Scene *UNUSED(scene), TreeElement *UNUSED(te), TreeStoreElem *tsep, TreeStoreElem *tselem) { Group *group= (Group *)tselem->id; @@ -3177,7 +3178,7 @@ static void outliner_do_libdata_operation(bContext *C, Scene *scene, SpaceOops * /* */ -static void object_select_cb(bContext *C, Scene *scene, TreeElement *te, TreeStoreElem *tsep, TreeStoreElem *tselem) +static void object_select_cb(bContext *UNUSED(C), Scene *scene, TreeElement *te, TreeStoreElem *UNUSED(tsep), TreeStoreElem *tselem) { Base *base= (Base *)te->directdata; @@ -3188,7 +3189,7 @@ static void object_select_cb(bContext *C, Scene *scene, TreeElement *te, TreeSto } } -static void object_deselect_cb(bContext *C, Scene *scene, TreeElement *te, TreeStoreElem *tsep, TreeStoreElem *tselem) +static void object_deselect_cb(bContext *UNUSED(C), Scene *scene, TreeElement *te, TreeStoreElem *UNUSED(tsep), TreeStoreElem *tselem) { Base *base= (Base *)te->directdata; @@ -3199,7 +3200,7 @@ static void object_deselect_cb(bContext *C, Scene *scene, TreeElement *te, TreeS } } -static void object_delete_cb(bContext *C, Scene *scene, TreeElement *te, TreeStoreElem *tsep, TreeStoreElem *tselem) +static void object_delete_cb(bContext *C, Scene *scene, TreeElement *te, TreeStoreElem *UNUSED(tsep), TreeStoreElem *tselem) { Base *base= (Base *)te->directdata; @@ -3217,7 +3218,7 @@ static void object_delete_cb(bContext *C, Scene *scene, TreeElement *te, TreeSto } -static void id_local_cb(bContext *C, Scene *scene, TreeElement *te, TreeStoreElem *tsep, TreeStoreElem *tselem) +static void id_local_cb(bContext *UNUSED(C), Scene *UNUSED(scene), TreeElement *UNUSED(te), TreeStoreElem *UNUSED(tsep), TreeStoreElem *tselem) { if(tselem->id->lib && (tselem->id->flag & LIB_EXTERN)) { tselem->id->lib= NULL; @@ -3226,7 +3227,7 @@ static void id_local_cb(bContext *C, Scene *scene, TreeElement *te, TreeStoreEle } } -static void group_linkobs2scene_cb(bContext *C, Scene *scene, TreeElement *te, TreeStoreElem *tsep, TreeStoreElem *tselem) +static void group_linkobs2scene_cb(bContext *UNUSED(C), Scene *scene, TreeElement *UNUSED(te), TreeStoreElem *UNUSED(tsep), TreeStoreElem *tselem) { Group *group= (Group *)tselem->id; GroupObject *gob; @@ -3279,7 +3280,7 @@ static void outliner_do_object_operation(bContext *C, Scene *scene_act, SpaceOop /* ******************************************** */ -static void pchan_cb(int event, TreeElement *te, TreeStoreElem *tselem) +static void pchan_cb(int event, TreeElement *te, TreeStoreElem *UNUSED(tselem)) { bPoseChannel *pchan= (bPoseChannel *)te->directdata; @@ -3295,7 +3296,7 @@ static void pchan_cb(int event, TreeElement *te, TreeStoreElem *tselem) pchan->bone->flag &= ~BONE_HIDDEN_P; } -static void bone_cb(int event, TreeElement *te, TreeStoreElem *tselem) +static void bone_cb(int event, TreeElement *te, TreeStoreElem *UNUSED(tselem)) { Bone *bone= (Bone *)te->directdata; @@ -3311,7 +3312,7 @@ static void bone_cb(int event, TreeElement *te, TreeStoreElem *tselem) bone->flag &= ~BONE_HIDDEN_P; } -static void ebone_cb(int event, TreeElement *te, TreeStoreElem *tselem) +static void ebone_cb(int event, TreeElement *te, TreeStoreElem *UNUSED(tselem)) { EditBone *ebone= (EditBone *)te->directdata; @@ -3327,7 +3328,7 @@ static void ebone_cb(int event, TreeElement *te, TreeStoreElem *tselem) ebone->flag &= ~BONE_HIDDEN_A; } -static void sequence_cb(int event, TreeElement *te, TreeStoreElem *tselem) +static void sequence_cb(int event, TreeElement *UNUSED(te), TreeStoreElem *UNUSED(tselem)) { // Sequence *seq= (Sequence*) te->directdata; if(event==1) { @@ -3354,7 +3355,7 @@ static void outliner_do_data_operation(SpaceOops *soops, int type, int event, Li } } -void outliner_del(bContext *C, Scene *scene, ARegion *ar, SpaceOops *soops) +void outliner_del(bContext *C, Scene *scene, ARegion *UNUSED(ar), SpaceOops *soops) { if(soops->outlinevis==SO_SEQUENCE) @@ -3714,7 +3715,7 @@ static int do_outliner_operation_event(bContext *C, Scene *scene, ARegion *ar, S } -static int outliner_operation(bContext *C, wmOperator *op, wmEvent *event) +static int outliner_operation(bContext *C, wmOperator *UNUSED(op), wmEvent *event) { Scene *scene= CTX_data_scene(C); ARegion *ar= CTX_wm_region(C); @@ -3764,7 +3765,7 @@ static int ed_operator_outliner_datablocks_active(bContext *C) * this function does not do that yet */ static void tree_element_to_path(SpaceOops *soops, TreeElement *te, TreeStoreElem *tselem, - ID **id, char **path, int *array_index, short *flag, short *groupmode) + ID **id, char **path, int *array_index, short *flag, short *UNUSED(groupmode)) { ListBase hierarchy = {NULL, NULL}; LinkData *ld; @@ -3980,7 +3981,7 @@ static void do_outliner_drivers_editop(SpaceOops *soops, ListBase *tree, short m /* Add Operator ---------------------------------- */ -static int outliner_drivers_addsel_exec(bContext *C, wmOperator *op) +static int outliner_drivers_addsel_exec(bContext *C, wmOperator *UNUSED(op)) { SpaceOops *soutliner= CTX_wm_space_outliner(C); @@ -4015,7 +4016,7 @@ void OUTLINER_OT_drivers_add_selected(wmOperatorType *ot) /* Remove Operator ---------------------------------- */ -static int outliner_drivers_deletesel_exec(bContext *C, wmOperator *op) +static int outliner_drivers_deletesel_exec(bContext *C, wmOperator *UNUSED(op)) { SpaceOops *soutliner= CTX_wm_space_outliner(C); @@ -4190,7 +4191,7 @@ void OUTLINER_OT_keyingset_add_selected(wmOperatorType *ot) /* Remove Operator ---------------------------------- */ -static int outliner_keyingset_removeitems_exec(bContext *C, wmOperator *op) +static int outliner_keyingset_removeitems_exec(bContext *C, wmOperator *UNUSED(op)) { SpaceOops *soutliner= CTX_wm_space_outliner(C); Scene *scene= CTX_data_scene(C); @@ -4811,7 +4812,7 @@ static void outliner_draw_tree(bContext *C, uiBlock *block, Scene *scene, ARegio } -static void outliner_back(ARegion *ar, SpaceOops *soops) +static void outliner_back(ARegion *ar) { int ystart; @@ -4825,7 +4826,7 @@ static void outliner_back(ARegion *ar, SpaceOops *soops) } } -static void outliner_draw_restrictcols(ARegion *ar, SpaceOops *soops) +static void outliner_draw_restrictcols(ARegion *ar) { int ystart; @@ -4868,7 +4869,7 @@ static void restrictbutton_view_cb(bContext *C, void *poin, void *poin2) Scene *scene = (Scene *)poin; Object *ob = (Object *)poin2; - if(!common_restrict_check(C, scene, ob)) return; + if(!common_restrict_check(C, ob)) return; /* deselect objects that are invisible */ if (ob->restrictflag & OB_RESTRICT_VIEW) { @@ -4885,7 +4886,7 @@ static void restrictbutton_sel_cb(bContext *C, void *poin, void *poin2) Scene *scene = (Scene *)poin; Object *ob = (Object *)poin2; - if(!common_restrict_check(C, scene, ob)) return; + if(!common_restrict_check(C, ob)) return; /* if select restriction has just been turned on */ if (ob->restrictflag & OB_RESTRICT_SELECT) { @@ -4897,17 +4898,17 @@ static void restrictbutton_sel_cb(bContext *C, void *poin, void *poin2) } -static void restrictbutton_rend_cb(bContext *C, void *poin, void *poin2) +static void restrictbutton_rend_cb(bContext *C, void *poin, void *UNUSED(poin2)) { WM_event_add_notifier(C, NC_SCENE|ND_OB_RENDER, poin); } -static void restrictbutton_r_lay_cb(bContext *C, void *poin, void *poin2) +static void restrictbutton_r_lay_cb(bContext *C, void *poin, void *UNUSED(poin2)) { WM_event_add_notifier(C, NC_SCENE|ND_RENDER_OPTIONS, poin); } -static void restrictbutton_modifier_cb(bContext *C, void *poin, void *poin2) +static void restrictbutton_modifier_cb(bContext *C, void *UNUSED(poin), void *poin2) { Object *ob = (Object *)poin2; @@ -4916,7 +4917,7 @@ static void restrictbutton_modifier_cb(bContext *C, void *poin, void *poin2) WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, ob); } -static void restrictbutton_bone_cb(bContext *C, void *poin, void *poin2) +static void restrictbutton_bone_cb(bContext *C, void *UNUSED(poin), void *poin2) { Bone *bone= (Bone *)poin2; if(bone && (bone->flag & BONE_HIDDEN_P)) @@ -4924,7 +4925,7 @@ static void restrictbutton_bone_cb(bContext *C, void *poin, void *poin2) WM_event_add_notifier(C, NC_OBJECT|ND_POSE, NULL); } -static void restrictbutton_ebone_cb(bContext *C, void *poin, void *poin2) +static void restrictbutton_ebone_cb(bContext *C, void *UNUSED(poin), void *poin2) { EditBone *ebone= (EditBone *)poin2; if(ebone && (ebone->flag & BONE_HIDDEN_A)) @@ -4956,7 +4957,7 @@ static int group_select_flag(Group *gr) return 0; } -static void restrictbutton_gr_restrict_flag(bContext *C, void *poin, void *poin2, int flag) +static void restrictbutton_gr_restrict_flag(void *poin, void *poin2, int flag) { Scene *scene = (Scene *)poin; GroupObject *gob; @@ -4984,17 +4985,17 @@ static void restrictbutton_gr_restrict_flag(bContext *C, void *poin, void *poin2 static void restrictbutton_gr_restrict_view(bContext *C, void *poin, void *poin2) { - restrictbutton_gr_restrict_flag(C, poin, poin2, OB_RESTRICT_VIEW); + restrictbutton_gr_restrict_flag(poin, poin2, OB_RESTRICT_VIEW); WM_event_add_notifier(C, NC_GROUP, NULL); } static void restrictbutton_gr_restrict_select(bContext *C, void *poin, void *poin2) { - restrictbutton_gr_restrict_flag(C, poin, poin2, OB_RESTRICT_SELECT); + restrictbutton_gr_restrict_flag(poin, poin2, OB_RESTRICT_SELECT); WM_event_add_notifier(C, NC_GROUP, NULL); } static void restrictbutton_gr_restrict_render(bContext *C, void *poin, void *poin2) { - restrictbutton_gr_restrict_flag(C, poin, poin2, OB_RESTRICT_RENDER); + restrictbutton_gr_restrict_flag(poin, poin2, OB_RESTRICT_RENDER); WM_event_add_notifier(C, NC_GROUP, NULL); } @@ -5029,7 +5030,7 @@ static void namebutton_cb(bContext *C, void *tsep, char *oldname) if (te->idcode == ID_LI) { char expanded[FILE_MAXDIR + FILE_MAXFILE]; BLI_strncpy(expanded, ((Library *)tselem->id)->name, FILE_MAXDIR + FILE_MAXFILE); - BLI_path_abs(expanded, G.sce); + BLI_path_abs(expanded, G.main->name); if (!BLI_exists(expanded)) { error("This path does not exist, correct this before saving"); } @@ -5240,7 +5241,7 @@ static void outliner_draw_restrictbuts(uiBlock *block, Scene *scene, ARegion *ar } } -static void outliner_draw_rnacols(ARegion *ar, SpaceOops *soops, int sizex) +static void outliner_draw_rnacols(ARegion *ar, int sizex) { View2D *v2d= &ar->v2d; @@ -5292,7 +5293,7 @@ static void outliner_draw_rnabuts(uiBlock *block, Scene *scene, ARegion *ar, Spa } } -static void operator_call_cb(struct bContext *C, void *arg_kmi, void *arg2) +static void operator_call_cb(struct bContext *UNUSED(C), void *arg_kmi, void *arg2) { wmOperatorType *ot= arg2; wmKeyMapItem *kmi= arg_kmi; @@ -5301,7 +5302,7 @@ static void operator_call_cb(struct bContext *C, void *arg_kmi, void *arg2) BLI_strncpy(kmi->idname, ot->idname, OP_MAX_TYPENAME); } -static void operator_search_cb(const struct bContext *C, void *arg_kmi, char *str, uiSearchItems *items) +static void operator_search_cb(const struct bContext *UNUSED(C), void *UNUSED(arg_kmi), char *str, uiSearchItems *items) { wmOperatorType *ot = WM_operatortype_first(); @@ -5452,7 +5453,7 @@ static char *keymap_tweak_dir_menu(void) } -static void keymap_type_cb(bContext *C, void *kmi_v, void *unused_v) +static void keymap_type_cb(bContext *C, void *kmi_v, void *UNUSED(arg_v)) { wmKeyMapItem *kmi= kmi_v; short maptype= keymap_menu_type(kmi->type); @@ -5654,16 +5655,16 @@ void draw_outliner(const bContext *C) UI_view2d_totRect_set(v2d, sizex, sizey); /* set matrix for 2d-view controls */ - UI_view2d_view_ortho(C, v2d); + UI_view2d_view_ortho(v2d); /* draw outliner stuff (background, hierachy lines and names) */ - outliner_back(ar, soops); + outliner_back(ar); block= uiBeginBlock(C, ar, "outliner buttons", UI_EMBOSS); outliner_draw_tree((bContext *)C, block, scene, ar, soops); if(ELEM(soops->outlinevis, SO_DATABLOCKS, SO_USERDEF)) { /* draw rna buttons */ - outliner_draw_rnacols(ar, soops, sizex_rna); + outliner_draw_rnacols(ar, sizex_rna); outliner_draw_rnabuts(block, scene, ar, soops, sizex_rna, &soops->tree); } else if(soops->outlinevis == SO_KEYMAP) { @@ -5671,7 +5672,7 @@ void draw_outliner(const bContext *C) } else if (!(soops->flag & SO_HIDE_RESTRICTCOLS)) { /* draw restriction columns */ - outliner_draw_restrictcols(ar, soops); + outliner_draw_restrictcols(ar); outliner_draw_restrictbuts(block, scene, ar, soops, &soops->tree); } diff --git a/source/blender/editors/space_outliner/space_outliner.c b/source/blender/editors/space_outliner/space_outliner.c index f0f9ac945ef..f31910d8289 100644 --- a/source/blender/editors/space_outliner/space_outliner.c +++ b/source/blender/editors/space_outliner/space_outliner.c @@ -84,11 +84,11 @@ static void outliner_main_area_draw(const bContext *C, ARegion *ar) } -static void outliner_main_area_free(ARegion *ar) +static void outliner_main_area_free(ARegion *UNUSED(ar)) { + } - static void outliner_main_area_listener(ARegion *ar, wmNotifier *wmn) { /* context changes */ @@ -104,6 +104,7 @@ static void outliner_main_area_listener(ARegion *ar, wmNotifier *wmn) case ND_FRAME: case ND_RENDER_OPTIONS: case ND_LAYER: + case ND_WORLD: ED_region_tag_redraw(ar); break; } @@ -162,6 +163,14 @@ static void outliner_main_area_listener(ARegion *ar, wmNotifier *wmn) case NC_TEXTURE: ED_region_tag_redraw(ar); break; + case NC_GEOM: + switch(wmn->data) { + case ND_DATA: + /* needed for vertex groups only, no special notifier atm so use NC_GEOM|ND_DATA */ + ED_region_tag_redraw(ar); + break; + } + break; } } @@ -170,7 +179,7 @@ static void outliner_main_area_listener(ARegion *ar, wmNotifier *wmn) /* ************************ header outliner area region *********************** */ /* add handlers, stuff you only do once or on area/region changes */ -static void outliner_header_area_init(wmWindowManager *wm, ARegion *ar) +static void outliner_header_area_init(wmWindowManager *UNUSED(wm), ARegion *ar) { ED_region_header_init(ar); } @@ -180,7 +189,7 @@ static void outliner_header_area_draw(const bContext *C, ARegion *ar) ED_region_header(C, ar); } -static void outliner_header_area_free(ARegion *ar) +static void outliner_header_area_free(ARegion *UNUSED(ar)) { } @@ -201,7 +210,7 @@ static void outliner_header_area_listener(ARegion *ar, wmNotifier *wmn) /* ******************** default callbacks for outliner space ***************** */ -static SpaceLink *outliner_new(const bContext *C) +static SpaceLink *outliner_new(const bContext *UNUSED(C)) { ARegion *ar; SpaceOops *soutliner; @@ -245,7 +254,7 @@ static void outliner_free(SpaceLink *sl) } /* spacetype; init callback */ -static void outliner_init(wmWindowManager *wm, ScrArea *sa) +static void outliner_init(wmWindowManager *UNUSED(wm), ScrArea *UNUSED(sa)) { } diff --git a/source/blender/editors/space_script/script_edit.c b/source/blender/editors/space_script/script_edit.c index 610fecaa543..7e3b14ca04a 100644 --- a/source/blender/editors/space_script/script_edit.c +++ b/source/blender/editors/space_script/script_edit.c @@ -80,7 +80,7 @@ void SCRIPT_OT_python_file_run(wmOperatorType *ot) } -static int script_reload_exec(bContext *C, wmOperator *op) +static int script_reload_exec(bContext *C, wmOperator *UNUSED(op)) { #ifndef DISABLE_PYTHON /* TODO, this crashes on netrender and keying sets, need to look into why diff --git a/source/blender/editors/space_script/script_header.c b/source/blender/editors/space_script/script_header.c index 6e65d458451..1159139eff5 100644 --- a/source/blender/editors/space_script/script_header.c +++ b/source/blender/editors/space_script/script_header.c @@ -32,7 +32,7 @@ #include "BLI_blenlib.h" - +#include "BKE_utildefines.h" #include "BKE_context.h" #include "ED_screen.h" @@ -50,12 +50,12 @@ /* ************************ header area region *********************** */ -static void do_viewmenu(bContext *C, void *arg, int event) +static void do_viewmenu(bContext *UNUSED(C), void *UNUSED(arg), int UNUSED(event)) { } -static uiBlock *dummy_viewmenu(bContext *C, ARegion *ar, void *arg_unused) +static uiBlock *dummy_viewmenu(bContext *C, ARegion *ar, void *UNUSED(arg)) { ScrArea *curarea= CTX_wm_area(C); uiBlock *block; @@ -81,7 +81,7 @@ static uiBlock *dummy_viewmenu(bContext *C, ARegion *ar, void *arg_unused) return block; } -static void do_script_buttons(bContext *C, void *arg, int event) +static void do_script_buttons(bContext *UNUSED(C), void *UNUSED(arg), int event) { switch(event) { } diff --git a/source/blender/editors/space_script/space_script.c b/source/blender/editors/space_script/space_script.c index f93ddc6efbe..66f630bb5b3 100644 --- a/source/blender/editors/space_script/space_script.c +++ b/source/blender/editors/space_script/space_script.c @@ -61,7 +61,7 @@ /* ******************** default callbacks for script space ***************** */ -static SpaceLink *script_new(const bContext *C) +static SpaceLink *script_new(const bContext *UNUSED(C)) { ARegion *ar; SpaceScript *sscript; @@ -107,7 +107,7 @@ static void script_free(SpaceLink *sl) /* spacetype; init callback */ -static void script_init(struct wmWindowManager *wm, ScrArea *sa) +static void script_init(struct wmWindowManager *UNUSED(wm), ScrArea *UNUSED(sa)) { } @@ -145,7 +145,7 @@ static void script_main_area_draw(const bContext *C, ARegion *ar) UI_ThemeClearColor(TH_BACK); glClear(GL_COLOR_BUFFER_BIT); - UI_view2d_view_ortho(C, v2d); + UI_view2d_view_ortho(v2d); /* data... */ // BPY_run_python_script(C, "/root/blender-svn/blender25/test.py", NULL); @@ -164,7 +164,7 @@ static void script_main_area_draw(const bContext *C, ARegion *ar) } /* add handlers, stuff you only do once or on area/region changes */ -static void script_header_area_init(wmWindowManager *wm, ARegion *ar) +static void script_header_area_init(wmWindowManager *UNUSED(wm), ARegion *ar) { ED_region_header_init(ar); } @@ -174,7 +174,7 @@ static void script_header_area_draw(const bContext *C, ARegion *ar) ED_region_header(C, ar); } -static void script_main_area_listener(ARegion *ar, wmNotifier *wmn) +static void script_main_area_listener(ARegion *UNUSED(ar), wmNotifier *UNUSED(wmn)) { /* context changes */ // XXX - Todo, need the ScriptSpace accessible to get the python script to run. diff --git a/source/blender/editors/space_sequencer/sequencer_add.c b/source/blender/editors/space_sequencer/sequencer_add.c index b9db18f7850..5f0693dc43c 100644 --- a/source/blender/editors/space_sequencer/sequencer_add.c +++ b/source/blender/editors/space_sequencer/sequencer_add.c @@ -101,7 +101,7 @@ static void sequencer_generic_invoke_path__internal(bContext *C, wmOperator *op, if(last_seq && last_seq->strip && SEQ_HAS_PATH(last_seq)) { char path[sizeof(last_seq->strip->dir)]; BLI_strncpy(path, last_seq->strip->dir, sizeof(path)); - BLI_path_abs(path, G.sce); + BLI_path_abs(path, G.main->name); RNA_string_set(op->ptr, identifier, path); } } @@ -152,7 +152,7 @@ static void seq_load_operator_info(SeqLoadInfo *seq_load, wmOperator *op) } if((is_file != -1) && relative) - BLI_path_rel(seq_load->path, G.sce); + BLI_path_rel(seq_load->path, G.main->name); if (RNA_struct_find_property(op->ptr, "frame_end")) { diff --git a/source/blender/editors/space_sequencer/sequencer_buttons.c b/source/blender/editors/space_sequencer/sequencer_buttons.c index 4394e334614..aa0686bc9bb 100644 --- a/source/blender/editors/space_sequencer/sequencer_buttons.c +++ b/source/blender/editors/space_sequencer/sequencer_buttons.c @@ -47,13 +47,13 @@ #include "sequencer_intern.h" -static void do_sequencer_panel_events(bContext *C, void *arg, int event) +static void do_sequencer_panel_events(bContext *UNUSED(C), void *UNUSED(arg), int UNUSED(event)) { } -static void sequencer_panel_view_properties(const bContext *C, Panel *pa) +static void sequencer_panel_view_properties(const bContext *UNUSED(C), Panel *pa) { uiBlock *block; @@ -63,7 +63,7 @@ static void sequencer_panel_view_properties(const bContext *C, Panel *pa) } -static void sequencer_panel_properties(const bContext *C, Panel *pa) +static void sequencer_panel_properties(const bContext *UNUSED(C), Panel *pa) { uiBlock *block; @@ -92,7 +92,7 @@ void sequencer_buttons_register(ARegionType *art) /* **************** operator to open/close properties view ************* */ -static int sequencer_properties(bContext *C, wmOperator *op) +static int sequencer_properties(bContext *C, wmOperator *UNUSED(op)) { ScrArea *sa= CTX_wm_area(C); ARegion *ar= sequencer_has_buttons_region(sa); diff --git a/source/blender/editors/space_sequencer/sequencer_draw.c b/source/blender/editors/space_sequencer/sequencer_draw.c index 7c6fd83c6aa..c4ae658ce37 100644 --- a/source/blender/editors/space_sequencer/sequencer_draw.c +++ b/source/blender/editors/space_sequencer/sequencer_draw.c @@ -357,7 +357,7 @@ static void draw_seq_handle(View2D *v2d, Sequence *seq, float pixelx, short dire } } -static void draw_seq_extensions(Scene *scene, ARegion *ar, SpaceSeq *sseq, Sequence *seq) +static void draw_seq_extensions(Scene *scene, ARegion *ar, Sequence *seq) { float x1, x2, y1, y2, pixely, a; char col[3], blendcol[3]; @@ -586,7 +586,7 @@ Draw a sequence strip, bounds check already made ARegion is currently only used to get the windows width in pixels so wave file sample drawing precision is zoom adjusted */ -static void draw_seq_strip(Scene *scene, ARegion *ar, SpaceSeq *sseq, Sequence *seq, int outline_tint, float pixelx) +static void draw_seq_strip(Scene *scene, ARegion *ar, Sequence *seq, int outline_tint, float pixelx) { View2D *v2d= &ar->v2d; float x1, x2, y1, y2; @@ -616,7 +616,7 @@ static void draw_seq_strip(Scene *scene, ARegion *ar, SpaceSeq *sseq, Sequence * /* draw additional info and controls */ if (!is_single_image) - draw_seq_extensions(scene, ar, sseq, seq); + draw_seq_extensions(scene, ar, seq); draw_seq_handle(v2d, seq, pixelx, SEQ_LEFTHANDLE); draw_seq_handle(v2d, seq, pixelx, SEQ_RIGHTHANDLE); @@ -772,7 +772,7 @@ void draw_image_seq(const bContext* C, Scene *scene, ARegion *ar, SpaceSeq *sseq } /* setting up the view - actual drawing starts here */ - UI_view2d_view_ortho(C, v2d); + UI_view2d_view_ortho(v2d); last_texid= glaGetOneInteger(GL_TEXTURE_2D); glEnable(GL_TEXTURE_2D); @@ -866,7 +866,7 @@ void draw_image_seq(const bContext* C, Scene *scene, ARegion *ar, SpaceSeq *sseq UI_view2d_view_restore(C); } -void drawprefetchseqspace(Scene *scene, ARegion *ar, SpaceSeq *sseq) +void drawprefetchseqspace(Scene *scene, ARegion *UNUSED(ar), SpaceSeq *sseq) { int rectx, recty; int render_size = sseq->render_size; @@ -936,7 +936,6 @@ static void draw_seq_backdrop(View2D *v2d) static void draw_seq_strips(const bContext *C, Editing *ed, ARegion *ar) { Scene *scene= CTX_data_scene(C); - SpaceSeq *sseq= CTX_wm_space_seq(C); View2D *v2d= &ar->v2d; Sequence *last_seq = seq_active_get(scene); int sel = 0, j; @@ -958,7 +957,7 @@ static void draw_seq_strips(const bContext *C, Editing *ed, ARegion *ar) else if (seq->machine > v2d->cur.ymax) continue; /* strip passed all tests unscathed... so draw it now */ - draw_seq_strip(scene, ar, sseq, seq, outline_tint, pixelx); + draw_seq_strip(scene, ar, seq, outline_tint, pixelx); } /* draw selected next time round */ @@ -967,14 +966,11 @@ static void draw_seq_strips(const bContext *C, Editing *ed, ARegion *ar) /* draw the last selected last (i.e. 'active' in other parts of Blender), removes some overlapping error */ if (last_seq) - draw_seq_strip(scene, ar, sseq, last_seq, 120, pixelx); + draw_seq_strip(scene, ar, last_seq, 120, pixelx); } -static void seq_draw_sfra_efra(const bContext *C, SpaceSeq *sseq, ARegion *ar) -{ - View2D *v2d= UI_view2d_fromcontext(C); - Scene *scene= CTX_data_scene(C); - +static void seq_draw_sfra_efra(Scene *scene, View2D *v2d) +{ glEnable(GL_BLEND); /* draw darkened area outside of active timeline @@ -1016,7 +1012,7 @@ void draw_timeline_seq(const bContext *C, ARegion *ar) glClearColor(col[0], col[1], col[2], 0.0); glClear(GL_COLOR_BUFFER_BIT); - UI_view2d_view_ortho(C, v2d); + UI_view2d_view_ortho(v2d); /* calculate extents of sequencer strips/data @@ -1029,9 +1025,9 @@ void draw_timeline_seq(const bContext *C, ARegion *ar) draw_seq_backdrop(v2d); /* regular grid-pattern over the rest of the view (i.e. frame grid lines) */ - UI_view2d_constant_grid_draw(C, v2d); + UI_view2d_constant_grid_draw(v2d); - seq_draw_sfra_efra(C, sseq, ar); + seq_draw_sfra_efra(scene, v2d); /* sequence strips (if there is data available to be drawn) */ if (ed) { @@ -1043,17 +1039,17 @@ void draw_timeline_seq(const bContext *C, ARegion *ar) } /* current frame */ - UI_view2d_view_ortho(C, v2d); + UI_view2d_view_ortho(v2d); if ((sseq->flag & SEQ_DRAWFRAMES)==0) flag |= DRAWCFRA_UNIT_SECONDS; if ((sseq->flag & SEQ_NO_DRAW_CFRANUM)==0) flag |= DRAWCFRA_SHOW_NUMBOX; ANIM_draw_cfra(C, v2d, flag); /* markers */ - UI_view2d_view_orthoSpecial(C, v2d, 1); + UI_view2d_view_orthoSpecial(ar, v2d, 1); draw_markers_time(C, DRAW_MARKERS_LINES); /* preview range */ - UI_view2d_view_ortho(C, v2d); + UI_view2d_view_ortho(v2d); ANIM_draw_previewrange(C, v2d); /* overlap playhead */ diff --git a/source/blender/editors/space_sequencer/sequencer_edit.c b/source/blender/editors/space_sequencer/sequencer_edit.c index d96b8a27c99..35f27953633 100644 --- a/source/blender/editors/space_sequencer/sequencer_edit.c +++ b/source/blender/editors/space_sequencer/sequencer_edit.c @@ -69,11 +69,11 @@ /* own include */ #include "sequencer_intern.h" -static void error(const char *dummy) {} -static void waitcursor(int val) {} -static void activate_fileselect(int d1, char *d2, char *d3, void *d4) {} -static int pupmenu(const char *dummy) {return 0;} -static int okee(const char *dummy) {return 0;} +static void error(const char *UNUSED(dummy)) {} +static void waitcursor(int UNUSED(val)) {} +static void activate_fileselect(int UNUSED(d1), char *UNUSED(d2), char *UNUSED(d3), void *UNUSED(d4)) {} +static int pupmenu(const char *UNUSED(dummy)) {return 0;} +static int okee(const char *UNUSED(dummy)) {return 0;} /* XXX */ @@ -468,7 +468,7 @@ static void reload_sound_strip(Scene *scene, char *name) } #endif -static void reload_image_strip(Scene *scene, char *name) +static void reload_image_strip(Scene *scene, char *UNUSED(name)) { Editing *ed= seq_give_editing(scene, FALSE); Sequence *seq=NULL, *seqact; @@ -735,7 +735,7 @@ static void recurs_del_seq_flag(Scene *scene, ListBase *lb, short flag, short de } -static Sequence *cut_seq_hard(Main *bmain, Scene *scene, Sequence * seq, int cutframe) +static Sequence *cut_seq_hard(Scene *scene, Sequence * seq, int cutframe) { TransSeq ts; Sequence *seqn = 0; @@ -782,7 +782,7 @@ static Sequence *cut_seq_hard(Main *bmain, Scene *scene, Sequence * seq, int cut } } - reload_sequence_new_file(bmain, scene, seq, FALSE); + reload_sequence_new_file(scene, seq, FALSE); calc_sequence(scene, seq); new_tstripdata(seq); @@ -822,14 +822,14 @@ static Sequence *cut_seq_hard(Main *bmain, Scene *scene, Sequence * seq, int cut seqn->startstill = 0; } - reload_sequence_new_file(bmain, scene, seqn, FALSE); + reload_sequence_new_file(scene, seqn, FALSE); calc_sequence(scene, seqn); new_tstripdata(seqn); } return seqn; } -static Sequence *cut_seq_soft(Main *bmain, Scene *scene, Sequence * seq, int cutframe) +static Sequence *cut_seq_soft(Scene *scene, Sequence * seq, int cutframe) { TransSeq ts; Sequence *seqn = 0; @@ -919,8 +919,8 @@ static Sequence *cut_seq_soft(Main *bmain, Scene *scene, Sequence * seq, int cut /* like duplicate, but only duplicate and cut overlapping strips, * strips to the left of the cutframe are ignored and strips to the right are moved into the new list */ -static int cut_seq_list(Main *bmain, Scene *scene, ListBase *old, ListBase *new, int cutframe, - Sequence * (*cut_seq)(Main *, Scene *, Sequence *, int)) +static int cut_seq_list(Scene *scene, ListBase *old, ListBase *new, int cutframe, + Sequence * (*cut_seq)(Scene *, Sequence *, int)) { int did_something = FALSE; Sequence *seq, *seq_next; @@ -934,7 +934,7 @@ static int cut_seq_list(Main *bmain, Scene *scene, ListBase *old, ListBase *new, if(seq->flag & SELECT) { if(cutframe > seq->startdisp && cutframe < seq->enddisp) { - Sequence * seqn = cut_seq(bmain, scene, seq, cutframe); + Sequence * seqn = cut_seq(scene, seq, cutframe); if (seqn) { BLI_addtail(new, seqn); } @@ -992,7 +992,7 @@ void touch_seq_files(Scene *scene) if(seq->flag & SELECT) { if(seq->type==SEQ_MOVIE) { if(seq->strip && seq->strip->stripdata) { - BLI_make_file_string(G.sce, str, seq->strip->dir, seq->strip->stripdata->name); + BLI_make_file_string(G.main->name, str, seq->strip->dir, seq->strip->stripdata->name); BLI_touch(seq->name); } } @@ -1004,7 +1004,8 @@ void touch_seq_files(Scene *scene) waitcursor(0); } -void set_filter_seq(Main *bmain, Scene *scene) +/* +static void set_filter_seq(Scene *scene) { Sequence *seq; Editing *ed= seq_give_editing(scene, FALSE); @@ -1018,15 +1019,15 @@ void set_filter_seq(Main *bmain, Scene *scene) if(seq->flag & SELECT) { if(seq->type==SEQ_MOVIE) { seq->flag |= SEQ_FILTERY; - reload_sequence_new_file(bmain, scene, seq, FALSE); + reload_sequence_new_file(scene, seq, FALSE); calc_sequence(scene, seq); } } } SEQ_END - } +*/ void seq_remap_paths(Scene *scene) { @@ -1185,7 +1186,7 @@ static int sequencer_snap_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -static int sequencer_snap_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int sequencer_snap_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { Scene *scene = CTX_data_scene(C); @@ -1310,7 +1311,7 @@ void SEQUENCER_OT_unmute(struct wmOperatorType *ot) /* lock operator */ -static int sequencer_lock_exec(bContext *C, wmOperator *op) +static int sequencer_lock_exec(bContext *C, wmOperator *UNUSED(op)) { Scene *scene= CTX_data_scene(C); Editing *ed= seq_give_editing(scene, FALSE); @@ -1343,7 +1344,7 @@ void SEQUENCER_OT_lock(struct wmOperatorType *ot) } /* unlock operator */ -static int sequencer_unlock_exec(bContext *C, wmOperator *op) +static int sequencer_unlock_exec(bContext *C, wmOperator *UNUSED(op)) { Scene *scene= CTX_data_scene(C); Editing *ed= seq_give_editing(scene, FALSE); @@ -1376,7 +1377,7 @@ void SEQUENCER_OT_unlock(struct wmOperatorType *ot) } /* reload operator */ -static int sequencer_reload_exec(bContext *C, wmOperator *op) +static int sequencer_reload_exec(bContext *C, wmOperator *UNUSED(op)) { Scene *scene= CTX_data_scene(C); Editing *ed= seq_give_editing(scene, FALSE); @@ -1409,7 +1410,7 @@ void SEQUENCER_OT_reload(struct wmOperatorType *ot) } /* reload operator */ -static int sequencer_refresh_all_exec(bContext *C, wmOperator *op) +static int sequencer_refresh_all_exec(bContext *C, wmOperator *UNUSED(op)) { Scene *scene= CTX_data_scene(C); Editing *ed= seq_give_editing(scene, FALSE); @@ -1506,7 +1507,6 @@ static EnumPropertyItem prop_cut_types[] = { static int sequencer_cut_exec(bContext *C, wmOperator *op) { - Main *bmain= CTX_data_main(C); Scene *scene= CTX_data_scene(C); Editing *ed= seq_give_editing(scene, FALSE); int cut_side, cut_hard, cut_frame; @@ -1521,11 +1521,9 @@ static int sequencer_cut_exec(bContext *C, wmOperator *op) newlist.first= newlist.last= NULL; if (cut_hard==SEQ_CUT_HARD) { - changed = cut_seq_list(bmain, scene, - ed->seqbasep, &newlist, cut_frame, cut_seq_hard); + changed = cut_seq_list(scene, ed->seqbasep, &newlist, cut_frame, cut_seq_hard); } else { - changed = cut_seq_list(bmain, scene, - ed->seqbasep, &newlist, cut_frame, cut_seq_soft); + changed = cut_seq_list(scene, ed->seqbasep, &newlist, cut_frame, cut_seq_soft); } if (newlist.first) { /* got new strips ? */ @@ -1609,7 +1607,7 @@ static int apply_unique_name_cb(Sequence *seq, void *arg_pt) } -static int sequencer_add_duplicate_exec(bContext *C, wmOperator *op) +static int sequencer_add_duplicate_exec(bContext *C, wmOperator *UNUSED(op)) { Scene *scene= CTX_data_scene(C); Editing *ed= seq_give_editing(scene, FALSE); @@ -1636,7 +1634,7 @@ static int sequencer_add_duplicate_exec(bContext *C, wmOperator *op) return OPERATOR_CANCELLED; } -static int sequencer_add_duplicate_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int sequencer_add_duplicate_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { sequencer_add_duplicate_exec(C, op); @@ -1666,7 +1664,7 @@ void SEQUENCER_OT_duplicate(wmOperatorType *ot) } /* delete operator */ -static int sequencer_delete_exec(bContext *C, wmOperator *op) +static int sequencer_delete_exec(bContext *C, wmOperator *UNUSED(op)) { Scene *scene= CTX_data_scene(C); Editing *ed= seq_give_editing(scene, FALSE); @@ -1840,7 +1838,7 @@ void SEQUENCER_OT_images_separate(wmOperatorType *ot) /* META Operators */ /* separate_meta_toggle operator */ -static int sequencer_meta_toggle_exec(bContext *C, wmOperator *op) +static int sequencer_meta_toggle_exec(bContext *C, wmOperator *UNUSED(op)) { Scene *scene= CTX_data_scene(C); Editing *ed= seq_give_editing(scene, FALSE); @@ -1985,7 +1983,7 @@ static int seq_depends_on_meta(Sequence *seq, Sequence *seqm) } /* separate_meta_make operator */ -static int sequencer_meta_separate_exec(bContext *C, wmOperator *op) +static int sequencer_meta_separate_exec(bContext *C, wmOperator *UNUSED(op)) { Scene *scene= CTX_data_scene(C); Editing *ed= seq_give_editing(scene, FALSE); @@ -2046,7 +2044,7 @@ void SEQUENCER_OT_meta_separate(wmOperatorType *ot) } /* view_all operator */ -static int sequencer_view_all_exec(bContext *C, wmOperator *op) +static int sequencer_view_all_exec(bContext *C, wmOperator *UNUSED(op)) { //Scene *scene= CTX_data_scene(C); bScreen *sc= CTX_wm_screen(C); @@ -2078,7 +2076,7 @@ void SEQUENCER_OT_view_all(wmOperatorType *ot) } /* view_all operator */ -static int sequencer_view_all_preview_exec(bContext *C, wmOperator *op) +static int sequencer_view_all_preview_exec(bContext *C, wmOperator *UNUSED(op)) { bScreen *sc= CTX_wm_screen(C); ScrArea *area= CTX_wm_area(C); @@ -2189,7 +2187,7 @@ static EnumPropertyItem view_type_items[] = { #endif /* view_all operator */ -static int sequencer_view_toggle_exec(bContext *C, wmOperator *op) +static int sequencer_view_toggle_exec(bContext *C, wmOperator *UNUSED(op)) { SpaceSeq *sseq= (SpaceSeq *)CTX_wm_space_data(C); @@ -2218,7 +2216,7 @@ void SEQUENCER_OT_view_toggle(wmOperatorType *ot) /* view_selected operator */ -static int sequencer_view_selected_exec(bContext *C, wmOperator *op) +static int sequencer_view_selected_exec(bContext *C, wmOperator *UNUSED(op)) { Scene *scene= CTX_data_scene(C); View2D *v2d= UI_view2d_fromcontext(C); @@ -2354,7 +2352,7 @@ static int next_prev_edit_internal(Scene *scene, int side) } /* move frame to next edit point operator */ -static int sequencer_next_edit_exec(bContext *C, wmOperator *op) +static int sequencer_next_edit_exec(bContext *C, wmOperator *UNUSED(op)) { Scene *scene= CTX_data_scene(C); @@ -2384,7 +2382,7 @@ void SEQUENCER_OT_next_edit(wmOperatorType *ot) } /* move frame to previous edit point operator */ -static int sequencer_previous_edit_exec(bContext *C, wmOperator *op) +static int sequencer_previous_edit_exec(bContext *C, wmOperator *UNUSED(op)) { Scene *scene= CTX_data_scene(C); @@ -2518,7 +2516,7 @@ void SEQUENCER_OT_swap(wmOperatorType *ot) RNA_def_enum(ot->srna, "side", prop_side_lr_types, SEQ_SIDE_RIGHT, "Side", "Side of the strip to swap"); } -static int sequencer_rendersize_exec(bContext *C, wmOperator *op) +static int sequencer_rendersize_exec(bContext *C, wmOperator *UNUSED(op)) { int retval = OPERATOR_CANCELLED; Scene *scene= CTX_data_scene(C); @@ -2638,7 +2636,7 @@ static void seq_offset(Scene *scene, Sequence *seq, int ofs) calc_sequence_disp(scene, seq); } -static int sequencer_paste_exec(bContext *C, wmOperator *op) +static int sequencer_paste_exec(bContext *C, wmOperator *UNUSED(op)) { Scene *scene= CTX_data_scene(C); Editing *ed= seq_give_editing(scene, TRUE); /* create if needed */ diff --git a/source/blender/editors/space_sequencer/sequencer_scopes.c b/source/blender/editors/space_sequencer/sequencer_scopes.c index d9d027823bc..f5c8388bf67 100644 --- a/source/blender/editors/space_sequencer/sequencer_scopes.c +++ b/source/blender/editors/space_sequencer/sequencer_scopes.c @@ -143,7 +143,7 @@ static void wform_put_grid(unsigned char * tgt, int w, int h) static struct ImBuf *make_waveform_view_from_ibuf_byte(struct ImBuf * ibuf) { - struct ImBuf * rval = IMB_allocImBuf(ibuf->x + 3, 515, 32, IB_rect, 0); + struct ImBuf * rval = IMB_allocImBuf(ibuf->x + 3, 515, 32, IB_rect); int x,y; unsigned char* src = (unsigned char*) ibuf->rect; unsigned char* tgt = (unsigned char*) rval->rect; @@ -189,7 +189,7 @@ static struct ImBuf *make_waveform_view_from_ibuf_byte(struct ImBuf * ibuf) static struct ImBuf *make_waveform_view_from_ibuf_float(struct ImBuf * ibuf) { - struct ImBuf * rval = IMB_allocImBuf(ibuf->x + 3, 515, 32, IB_rect, 0); + struct ImBuf * rval = IMB_allocImBuf(ibuf->x + 3, 515, 32, IB_rect); int x,y; float* src = ibuf->rect_float; unsigned char* tgt = (unsigned char*) rval->rect; @@ -249,7 +249,7 @@ struct ImBuf *make_waveform_view_from_ibuf(struct ImBuf * ibuf) static struct ImBuf *make_sep_waveform_view_from_ibuf_byte(struct ImBuf * ibuf) { struct ImBuf * rval = IMB_allocImBuf( - ibuf->x + 3, 515, 32, IB_rect, 0); + ibuf->x + 3, 515, 32, IB_rect); int x,y; unsigned char* src = (unsigned char*) ibuf->rect; unsigned char* tgt = (unsigned char*) rval->rect; @@ -299,7 +299,7 @@ static struct ImBuf *make_sep_waveform_view_from_ibuf_float( struct ImBuf * ibuf) { struct ImBuf * rval = IMB_allocImBuf( - ibuf->x + 3, 515, 32, IB_rect, 0); + ibuf->x + 3, 515, 32, IB_rect); int x,y; float* src = ibuf->rect_float; unsigned char* tgt = (unsigned char*) rval->rect; @@ -422,7 +422,7 @@ static void draw_zebra_float(struct ImBuf * src,struct ImBuf * ibuf,float perc) struct ImBuf * make_zebra_view_from_ibuf(struct ImBuf * src, float perc) { - struct ImBuf * ibuf = IMB_allocImBuf(src->x, src->y, 32, IB_rect, 0); + struct ImBuf * ibuf = IMB_allocImBuf(src->x, src->y, 32, IB_rect); if (src->rect_float) { draw_zebra_float(src, ibuf, perc); @@ -463,7 +463,7 @@ static void draw_histogram_bar(struct ImBuf * ibuf, int x,float val, int col) static struct ImBuf *make_histogram_view_from_ibuf_byte( struct ImBuf * ibuf) { - struct ImBuf * rval = IMB_allocImBuf(515, 128, 32, IB_rect, 0); + struct ImBuf * rval = IMB_allocImBuf(515, 128, 32, IB_rect); int n,c,x,y; unsigned char* src = (unsigned char*) ibuf->rect; @@ -517,7 +517,7 @@ static int get_bin_float(float f) static struct ImBuf *make_histogram_view_from_ibuf_float( struct ImBuf * ibuf) { - struct ImBuf * rval = IMB_allocImBuf(515, 128, 32, IB_rect, 0); + struct ImBuf * rval = IMB_allocImBuf(515, 128, 32, IB_rect); int n,c,x,y; float* src = ibuf->rect_float; @@ -596,7 +596,7 @@ static void vectorscope_put_cross(unsigned char r, unsigned char g, static struct ImBuf *make_vectorscope_view_from_ibuf_byte(struct ImBuf * ibuf) { - struct ImBuf * rval = IMB_allocImBuf(515, 515, 32, IB_rect, 0); + struct ImBuf * rval = IMB_allocImBuf(515, 515, 32, IB_rect); int x,y; char* src = (char*) ibuf->rect; char* tgt = (char*) rval->rect; @@ -643,7 +643,7 @@ static struct ImBuf *make_vectorscope_view_from_ibuf_byte(struct ImBuf * ibuf) static struct ImBuf *make_vectorscope_view_from_ibuf_float(struct ImBuf * ibuf) { - struct ImBuf * rval = IMB_allocImBuf(515, 515, 32, IB_rect, 0); + struct ImBuf * rval = IMB_allocImBuf(515, 515, 32, IB_rect); int x,y; float* src = ibuf->rect_float; char* tgt = (char*) rval->rect; diff --git a/source/blender/editors/space_sequencer/sequencer_select.c b/source/blender/editors/space_sequencer/sequencer_select.c index a61e05517d9..720aa098ff6 100644 --- a/source/blender/editors/space_sequencer/sequencer_select.c +++ b/source/blender/editors/space_sequencer/sequencer_select.c @@ -58,7 +58,7 @@ /* own include */ #include "sequencer_intern.h" -static void *find_nearest_marker(int d1, int d2) {return NULL;} +static void *find_nearest_marker(int UNUSED(d1), int UNUSED(d2)) {return NULL;} void select_surrounding_handles(Scene *scene, Sequence *test) /* XXX BRING BACK */ { @@ -209,7 +209,7 @@ void select_neighbor_from_last(Scene *scene, int lr) /* (de)select operator */ -static int sequencer_deselect_exec(bContext *C, wmOperator *op) +static int sequencer_deselect_exec(bContext *C, wmOperator *UNUSED(op)) { Scene *scene= CTX_data_scene(C); Editing *ed= seq_give_editing(scene, FALSE); @@ -255,7 +255,7 @@ void SEQUENCER_OT_select_all_toggle(struct wmOperatorType *ot) /* (de)select operator */ -static int sequencer_select_inverse_exec(bContext *C, wmOperator *op) +static int sequencer_select_inverse_exec(bContext *C, wmOperator *UNUSED(op)) { Scene *scene= CTX_data_scene(C); Editing *ed= seq_give_editing(scene, FALSE); @@ -582,7 +582,7 @@ static int select_more_less_seq__internal(Scene *scene, int sel, int linked) { /* select more operator */ -static int sequencer_select_more_exec(bContext *C, wmOperator *op) +static int sequencer_select_more_exec(bContext *C, wmOperator *UNUSED(op)) { Scene *scene= CTX_data_scene(C); @@ -613,7 +613,7 @@ void SEQUENCER_OT_select_more(wmOperatorType *ot) /* select less operator */ -static int sequencer_select_less_exec(bContext *C, wmOperator *op) +static int sequencer_select_less_exec(bContext *C, wmOperator *UNUSED(op)) { Scene *scene= CTX_data_scene(C); @@ -700,7 +700,7 @@ void SEQUENCER_OT_select_linked_pick(wmOperatorType *ot) /* select linked operator */ -static int sequencer_select_linked_exec(bContext *C, wmOperator *op) +static int sequencer_select_linked_exec(bContext *C, wmOperator *UNUSED(op)) { Scene *scene= CTX_data_scene(C); int selected; diff --git a/source/blender/editors/space_sequencer/space_sequencer.c b/source/blender/editors/space_sequencer/space_sequencer.c index a4b7a17ec13..84daf04e4aa 100644 --- a/source/blender/editors/space_sequencer/space_sequencer.c +++ b/source/blender/editors/space_sequencer/space_sequencer.c @@ -236,7 +236,7 @@ static SpaceLink *sequencer_new(const bContext *C) } /* not spacelink itself */ -static void sequencer_free(SpaceLink *sl) +static void sequencer_free(SpaceLink *UNUSED(sl)) { // SpaceSeq *sseq= (SpaceSequencer*) sl; @@ -246,7 +246,7 @@ static void sequencer_free(SpaceLink *sl) /* spacetype; init callback */ -static void sequencer_init(struct wmWindowManager *wm, ScrArea *sa) +static void sequencer_init(struct wmWindowManager *UNUSED(wm), ScrArea *UNUSED(sa)) { } @@ -296,7 +296,7 @@ static void sequencer_main_area_draw(const bContext *C, ARegion *ar) /* ************* dropboxes ************* */ -static int image_drop_poll(bContext *C, wmDrag *drag, wmEvent *event) +static int image_drop_poll(bContext *UNUSED(C), wmDrag *drag, wmEvent *UNUSED(event)) { if(drag->type==WM_DRAG_PATH) if(ELEM(drag->icon, ICON_FILE_IMAGE, ICON_FILE_BLANK)) /* rule might not work? */ @@ -304,7 +304,7 @@ static int image_drop_poll(bContext *C, wmDrag *drag, wmEvent *event) return 0; } -static int movie_drop_poll(bContext *C, wmDrag *drag, wmEvent *event) +static int movie_drop_poll(bContext *UNUSED(C), wmDrag *drag, wmEvent *UNUSED(event)) { if(drag->type==WM_DRAG_PATH) if(ELEM3(drag->icon, 0, ICON_FILE_MOVIE, ICON_FILE_BLANK)) /* rule might not work? */ @@ -312,7 +312,7 @@ static int movie_drop_poll(bContext *C, wmDrag *drag, wmEvent *event) return 0; } -static int sound_drop_poll(bContext *C, wmDrag *drag, wmEvent *event) +static int sound_drop_poll(bContext *UNUSED(C), wmDrag *drag, wmEvent *UNUSED(event)) { if(drag->type==WM_DRAG_PATH) if(ELEM(drag->icon, ICON_FILE_SOUND, ICON_FILE_BLANK)) /* rule might not work? */ @@ -352,7 +352,7 @@ static void sequencer_dropboxes(void) /* ************* end drop *********** */ /* add handlers, stuff you only do once or on area/region changes */ -static void sequencer_header_area_init(wmWindowManager *wm, ARegion *ar) +static void sequencer_header_area_init(wmWindowManager *UNUSED(wm), ARegion *ar) { ED_region_header_init(ar); } diff --git a/source/blender/editors/space_sound/sound_header.c b/source/blender/editors/space_sound/sound_header.c index fbf6d8c85c9..c857d33bcab 100644 --- a/source/blender/editors/space_sound/sound_header.c +++ b/source/blender/editors/space_sound/sound_header.c @@ -34,6 +34,7 @@ #include "BLI_blenlib.h" +#include "BKE_utildefines.h" #include "BKE_context.h" #include "ED_screen.h" @@ -53,12 +54,12 @@ /* ************************ header area region *********************** */ -static void do_viewmenu(bContext *C, void *arg, int event) +static void do_viewmenu(bContext *UNUSED(C), void *UNUSED(arg), int UNUSED(event)) { } -static uiBlock *dummy_viewmenu(bContext *C, ARegion *ar, void *arg_unused) +static uiBlock *dummy_viewmenu(bContext *C, ARegion *ar, void *UNUSED(arg)) { ScrArea *curarea= CTX_wm_area(C); uiBlock *block; @@ -84,7 +85,7 @@ static uiBlock *dummy_viewmenu(bContext *C, ARegion *ar, void *arg_unused) return block; } -static void do_sound_buttons(bContext *C, void *arg, int event) +static void do_sound_buttons(bContext *UNUSED(C), void *UNUSED(arg), int event) { switch(event) { } diff --git a/source/blender/editors/space_sound/space_sound.c b/source/blender/editors/space_sound/space_sound.c index 905e1d6cdd9..99b24479967 100644 --- a/source/blender/editors/space_sound/space_sound.c +++ b/source/blender/editors/space_sound/space_sound.c @@ -55,7 +55,7 @@ /* ******************** default callbacks for sound space ***************** */ -static SpaceLink *sound_new(const bContext *C) +static SpaceLink *sound_new(const bContext *UNUSED(C)) { ARegion *ar; SpaceSound *ssound; @@ -106,7 +106,7 @@ static SpaceLink *sound_new(const bContext *C) } /* not spacelink itself */ -static void sound_free(SpaceLink *sl) +static void sound_free(SpaceLink *UNUSED(sl)) { // SpaceSound *ssound= (SpaceSound*) sl; @@ -115,7 +115,7 @@ static void sound_free(SpaceLink *sl) /* spacetype; init callback */ -static void sound_init(struct wmWindowManager *wm, ScrArea *sa) +static void sound_init(struct wmWindowManager *UNUSED(wm), ScrArea *UNUSED(sa)) { } @@ -153,7 +153,7 @@ static void sound_main_area_draw(const bContext *C, ARegion *ar) UI_ThemeClearColor(TH_BACK); glClear(GL_COLOR_BUFFER_BIT); - UI_view2d_view_ortho(C, v2d); + UI_view2d_view_ortho(v2d); /* data... */ @@ -169,13 +169,13 @@ void sound_operatortypes(void) } -void sound_keymap(struct wmKeyConfig *keyconf) +void sound_keymap(struct wmKeyConfig *UNUSED(keyconf)) { } /* add handlers, stuff you only do once or on area/region changes */ -static void sound_header_area_init(wmWindowManager *wm, ARegion *ar) +static void sound_header_area_init(wmWindowManager *UNUSED(wm), ARegion *ar) { UI_view2d_region_reinit(&ar->v2d, V2D_COMMONVIEW_HEADER, ar->winx, ar->winy); } @@ -194,7 +194,7 @@ static void sound_header_area_draw(const bContext *C, ARegion *ar) glClear(GL_COLOR_BUFFER_BIT); /* set view2d view matrix for scrolling (without scrollers) */ - UI_view2d_view_ortho(C, &ar->v2d); + UI_view2d_view_ortho(&ar->v2d); sound_header_buttons(C, ar); @@ -202,7 +202,7 @@ static void sound_header_area_draw(const bContext *C, ARegion *ar) UI_view2d_view_restore(C); } -static void sound_main_area_listener(ARegion *ar, wmNotifier *wmn) +static void sound_main_area_listener(ARegion *UNUSED(ar), wmNotifier *UNUSED(wmn)) { /* context changes */ } diff --git a/source/blender/editors/space_text/space_text.c b/source/blender/editors/space_text/space_text.c index 7f7a07f8cf7..06346bc89ed 100644 --- a/source/blender/editors/space_text/space_text.c +++ b/source/blender/editors/space_text/space_text.c @@ -59,7 +59,7 @@ /* ******************** default callbacks for text space ***************** */ -static SpaceLink *text_new(const bContext *C) +static SpaceLink *text_new(const bContext *UNUSED(C)) { ARegion *ar; SpaceText *stext; @@ -92,11 +92,12 @@ static void text_free(SpaceLink *sl) SpaceText *stext= (SpaceText*) sl; stext->text= NULL; + text_free_caches(stext); } /* spacetype; init callback */ -static void text_init(struct wmWindowManager *wm, ScrArea *sa) +static void text_init(struct wmWindowManager *UNUSED(wm), ScrArea *UNUSED(sa)) { } @@ -104,9 +105,11 @@ static void text_init(struct wmWindowManager *wm, ScrArea *sa) static SpaceLink *text_duplicate(SpaceLink *sl) { SpaceText *stextn= MEM_dupallocN(sl); - + /* clear or remove stuff from old */ - + + stextn->drawcache= NULL; /* space need it's own cache */ + return (SpaceLink *)stextn; } @@ -132,8 +135,11 @@ static void text_listener(ScrArea *sa, wmNotifier *wmn) switch(wmn->action) { case NA_EDITED: - if(st->text) + if(st->text) { + text_drawcache_tag_update(st, 1); text_update_edited(st->text); + } + ED_area_tag_redraw(sa); /* no break -- fall down to tag redraw */ case NA_ADDED: @@ -378,7 +384,7 @@ static void text_main_area_draw(const bContext *C, ARegion *ar) UI_ThemeClearColor(TH_BACK); glClear(GL_COLOR_BUFFER_BIT); - // UI_view2d_view_ortho(C, v2d); + // UI_view2d_view_ortho(v2d); /* data... */ draw_text_main(st, ar); @@ -389,7 +395,7 @@ static void text_main_area_draw(const bContext *C, ARegion *ar) /* scrollers? */ } -static void text_cursor(wmWindow *win, ScrArea *sa, ARegion *ar) +static void text_cursor(wmWindow *win, ScrArea *UNUSED(sa), ARegion *UNUSED(ar)) { WM_cursor_set(win, BC_TEXTEDITCURSOR); } @@ -398,7 +404,7 @@ static void text_cursor(wmWindow *win, ScrArea *sa, ARegion *ar) /* ************* dropboxes ************* */ -static int text_drop_poll(bContext *C, wmDrag *drag, wmEvent *event) +static int text_drop_poll(bContext *UNUSED(C), wmDrag *drag, wmEvent *UNUSED(event)) { if(drag->type==WM_DRAG_PATH) if(ELEM(drag->icon, 0, ICON_FILE_BLANK)) /* rule might not work? */ @@ -427,7 +433,7 @@ static void text_dropboxes(void) /****************** header region ******************/ /* add handlers, stuff you only do once or on area/region changes */ -static void text_header_area_init(wmWindowManager *wm, ARegion *ar) +static void text_header_area_init(wmWindowManager *UNUSED(wm), ARegion *ar) { ED_region_header_init(ar); } diff --git a/source/blender/editors/space_text/text_draw.c b/source/blender/editors/space_text/text_draw.c index be2d993dab5..024eef9092a 100644 --- a/source/blender/editors/space_text/text_draw.c +++ b/source/blender/editors/space_text/text_draw.c @@ -10,7 +10,6 @@ * * 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 @@ -68,11 +67,11 @@ static void text_font_begin(SpaceText *st) BLF_size(mono, st->lheight, 72); } -static void text_font_end(SpaceText *st) +static void text_font_end(SpaceText *UNUSED(st)) { } -static int text_font_draw(SpaceText *st, int x, int y, char *str) +static int text_font_draw(SpaceText *UNUSED(st), int x, int y, char *str) { BLF_position(mono, x, y, 0); BLF_draw(mono, str); @@ -93,7 +92,7 @@ static int text_font_draw_character(SpaceText *st, int x, int y, char c) return st->cwidth; } -int text_font_width(SpaceText *st, char *str) +int text_font_width(SpaceText *UNUSED(st), char *str) { return BLF_width(mono, str); } @@ -521,9 +520,22 @@ void wrap_offset(SpaceText *st, ARegion *ar, TextLine *linein, int cursin, int * linep= text->lines.first; i= st->top; while(i>0 && linep) { - if(linep == linein) return; /* Line before top */ - linep= linep->next; - i--; + int lines= text_get_visible_lines(st, ar, linep->line); + + /* Line before top */ + if(linep == linein) { + if(lines <= i) + /* no visible part of line */ + return; + } + + if (i-lines<0) { + break; + } else { + linep= linep->next; + (*offl)+= lines-1; + i-= lines; + } } max= wrap_width(st, ar); @@ -548,10 +560,18 @@ void wrap_offset(SpaceText *st, ARegion *ar, TextLine *linein, int cursin, int * while(chars--) { if(i-start>=max) { - if(chop && linep==linein && i >= cursin) + if(chop && linep==linein && i >= cursin) { + if (i==cursin) { + (*offl)++; + *offc -= end-start; + } + return; + } + (*offl)++; *offc -= end-start; + start= end; end += max; chop= 1; @@ -570,7 +590,66 @@ void wrap_offset(SpaceText *st, ARegion *ar, TextLine *linein, int cursin, int * } } -static int get_char_pos(SpaceText *st, char *line, int cur) +void wrap_offset_in_line(SpaceText *st, ARegion *ar, TextLine *linein, int cursin, int *offl, int *offc) +{ + int i, j, start, end, chars, max, chop; + char ch; + + *offl= *offc= 0; + + if(!st->text) return; + if(!st->wordwrap) return; + + max= wrap_width(st, ar); + + start= 0; + end= max; + chop= 1; + chars= 0; + *offc= 0; + + for(i=0, j=0; linein->line[j]!='\0'; j++) { + + /* Mimic replacement of tabs */ + ch= linein->line[j]; + if(ch=='\t') { + chars= st->tabnumber-i%st->tabnumber; + if(i<cursin) cursin += chars-1; + ch= ' '; + } + else + chars= 1; + + while(chars--) { + if(i-start>=max) { + if(chop && i >= cursin) { + if (i==cursin) { + (*offl)++; + *offc -= end-start; + } + + return; + } + + (*offl)++; + *offc -= end-start; + + start= end; + end += max; + chop= 1; + } + else if(ch==' ' || ch=='-') { + end = i+1; + chop= 0; + if(i >= cursin) + return; + } + i++; + } + } +} + +int text_get_char_pos(SpaceText *st, char *line, int cur) { int a=0, i; @@ -583,7 +662,7 @@ static int get_char_pos(SpaceText *st, char *line, int cur) return a; } -static int text_draw_wrapped(SpaceText *st, char *str, int x, int y, int w, char *format) +static int text_draw_wrapped(SpaceText *st, char *str, int x, int y, int w, char *format, int skip) { FlattenString fs; int basex, i, a, len, start, end, max, lines; @@ -599,6 +678,14 @@ static int text_draw_wrapped(SpaceText *st, char *str, int x, int y, int w, char end= max; for(i=0; i<len; i++) { if(i-start >= max) { + /* skip hidden part of line */ + if(skip) { + skip--; + start= end; + end += max; + continue; + } + /* Draw the visible portion of text on the overshot line */ for(a=start; a<end; a++) { if(st->showsyntax && format) format_draw_color(format[a]); @@ -609,6 +696,8 @@ static int text_draw_wrapped(SpaceText *st, char *str, int x, int y, int w, char lines++; start= end; end += max; + + if(y<=0) break; } else if(str[i]==' ' || str[i]=='-') { end = i+1; @@ -616,7 +705,7 @@ static int text_draw_wrapped(SpaceText *st, char *str, int x, int y, int w, char } /* Draw the remaining text */ - for(a=start; a<len; a++) { + for(a=start; a<len && y > 0; a++) { if(st->showsyntax && format) format_draw_color(format[a]); @@ -631,7 +720,7 @@ static int text_draw_wrapped(SpaceText *st, char *str, int x, int y, int w, char static int text_draw(SpaceText *st, char *str, int cshift, int maxwidth, int draw, int x, int y, char *format) { FlattenString fs; - int r=0, w= 0; + int r=0, w= 0, amount; int *acc; char *in; @@ -647,18 +736,26 @@ static int text_draw(SpaceText *st, char *str, int cshift, int maxwidth, int dra if(draw) { if(st->showsyntax && format) { - int amount, a; + int a; format = format+cshift; amount = strlen(in); + if(maxwidth) + amount= MIN2(amount, maxwidth); for(a = 0; a < amount; a++) { format_draw_color(format[a]); x += text_font_draw_character(st, x, y, in[a]); } } - else + else { + amount = strlen(in); + if(maxwidth) + amount= MIN2(amount, maxwidth); + + in[amount]= 0; text_font_draw(st, x, y, in); + } } else { while(w-- && *acc++ < maxwidth) @@ -675,18 +772,307 @@ static int text_draw(SpaceText *st, char *str, int cshift, int maxwidth, int dra return r+TXT_OFFSET; } +/************************ cache utilities *****************************/ + +typedef struct DrawCache { + int *line_height; + int total_lines, nlines; + + /* this is needed to check cache relevance */ + int winx, wordwrap, showlinenrs, tabnumber; + short lheight; + char cwidth; + char text_id[MAX_ID_NAME]; + + /* for partial lines recalculation */ + short update_flag; + int valid_head, valid_tail; /* amount of unchanged lines */ +} DrawCache; + +static void text_drawcache_init(SpaceText *st) +{ + DrawCache *drawcache= MEM_callocN(sizeof (DrawCache), "text draw cache"); + + drawcache->winx= -1; + drawcache->nlines= BLI_countlist(&st->text->lines); + drawcache->text_id[0]= '\0'; + + st->drawcache= drawcache; +} + +static void text_update_drawcache(SpaceText *st, ARegion *ar) +{ + DrawCache *drawcache; + int full_update= 0, nlines= 0; + Text *txt= st->text; + + if(!st->drawcache) text_drawcache_init(st); + + text_update_character_width(st); + + drawcache= (DrawCache *)st->drawcache; + nlines= drawcache->nlines; + + /* check if full cache update is needed */ + full_update|= drawcache->winx != ar->winx; /* area was resized */ + full_update|= drawcache->wordwrap != st->wordwrap; /* word-wrapping option was toggled */ + full_update|= drawcache->showlinenrs != st->showlinenrs; /* word-wrapping option was toggled */ + full_update|= drawcache->tabnumber != st->tabnumber; /* word-wrapping option was toggled */ + full_update|= drawcache->lheight != st->lheight; /* word-wrapping option was toggled */ + full_update|= drawcache->cwidth != st->cwidth; /* word-wrapping option was toggled */ + full_update|= strncmp(drawcache->text_id, txt->id.name, MAX_ID_NAME); /* text datablock was changed */ + + if(st->wordwrap) { + /* update line heights */ + if(full_update || !drawcache->line_height) { + drawcache->valid_head = 0; + drawcache->valid_tail = 0; + drawcache->update_flag = 1; + } + + if(drawcache->update_flag) { + TextLine *line= st->text->lines.first; + int lineno= 0, size, lines_count; + int *fp= drawcache->line_height, *new_tail, *old_tail; + + nlines= BLI_countlist(&txt->lines); + size= sizeof(int)*nlines; + + if(fp) fp= MEM_reallocN(fp, size); + else fp= MEM_callocN(size, "text drawcache line_height"); + + drawcache->valid_tail= drawcache->valid_head= 0; + old_tail= fp + drawcache->nlines - drawcache->valid_tail; + new_tail= fp + nlines - drawcache->valid_tail; + memmove(new_tail, old_tail, drawcache->valid_tail); + + drawcache->total_lines= 0; + + if(st->showlinenrs) + st->linenrs_tot= (int)floor(log10((float)nlines)) + 1; + + while(line) { + if(drawcache->valid_head) { /* we're inside valid head lines */ + lines_count= fp[lineno]; + drawcache->valid_head--; + } else if (lineno > new_tail - fp) { /* we-re inside valid tail lines */ + lines_count= fp[lineno]; + } else { + lines_count= text_get_visible_lines(st, ar, line->line); + } + + fp[lineno]= lines_count; + + line= line->next; + lineno++; + drawcache->total_lines+= lines_count; + } + + drawcache->line_height= fp; + } + } else { + if(drawcache->line_height) { + MEM_freeN(drawcache->line_height); + drawcache->line_height= NULL; + } + + if(full_update || drawcache->update_flag) { + nlines= BLI_countlist(&txt->lines); + + if(st->showlinenrs) + st->linenrs_tot= (int)floor(log10((float)nlines)) + 1; + } + + drawcache->total_lines= nlines; + } + + drawcache->nlines= nlines; + + /* store settings */ + drawcache->winx = ar->winx; + drawcache->wordwrap = st->wordwrap; + drawcache->lheight = st->lheight; + drawcache->cwidth = st->cwidth; + drawcache->showlinenrs = st->showlinenrs; + drawcache->tabnumber = st->tabnumber; + + strncpy(drawcache->text_id, txt->id.name, MAX_ID_NAME); + + /* clear update flag */ + drawcache->update_flag = 0; + drawcache->valid_head = 0; + drawcache->valid_tail = 0; +} + +void text_drawcache_tag_update(SpaceText *st, int full) +{ + DrawCache *drawcache= (DrawCache *)st->drawcache; + + if(drawcache) { + Text *txt= st->text; + + if(drawcache->update_flag) { + /* happens when tagging update from space listener */ + /* should do nothing to prevent locally tagged cache be fully recalculated */ + return; + } + + if(!full) { + int sellno= BLI_findindex(&txt->lines, txt->sell); + int curlno= BLI_findindex(&txt->lines, txt->curl); + + if(curlno < sellno) { + drawcache->valid_head= curlno; + drawcache->valid_tail= drawcache->nlines - sellno - 1; + } else { + drawcache->valid_head= sellno; + drawcache->valid_tail= drawcache->nlines - curlno - 1; + } + + /* quick cache recalculation is also used in delete operator, + which could merge lines which are adjusent to current selection lines + expand recalculate area to this lines */ + if(drawcache->valid_head>0) drawcache->valid_head--; + if(drawcache->valid_tail>0) drawcache->valid_tail--; + } else { + drawcache->valid_head= 0; + drawcache->valid_tail= 0; + } + + drawcache->update_flag= 1; + } +} + +void text_free_caches(SpaceText *st) +{ + DrawCache *drawcache= (DrawCache *)st->drawcache; + + if(drawcache) { + if(drawcache->line_height) + MEM_freeN(drawcache->line_height); + + MEM_freeN(drawcache); + } +} + +/************************ word-wrap utilities *****************************/ + +/* cache should be updated in caller */ +int text_get_visible_lines_no(SpaceText *st, int lineno) +{ + DrawCache *drawcache= (DrawCache *)st->drawcache; + + return drawcache->line_height[lineno]; +} + +int text_get_visible_lines(SpaceText *st, ARegion *ar, char *str) +{ + int i, j, start, end, max, lines, chars; + char ch; + + max= wrap_width(st, ar); + lines= 1; + start= 0; + end= max; + for(i= 0, j= 0; str[j] != '\0'; j++) { + /* Mimic replacement of tabs */ + ch= str[j]; + if(ch=='\t') { + chars= st->tabnumber-i%st->tabnumber; + ch= ' '; + } + else chars= 1; + + while(chars--) { + if(i-start >= max) { + lines++; + start= end; + end += max; + } + else if(ch==' ' || ch=='-') { + end= i+1; + } + + i++; + } + } + + return lines; +} + +int text_get_span_wrap(SpaceText *st, ARegion *ar, TextLine *from, TextLine *to) +{ + if(st->wordwrap) { + int ret=0; + TextLine *tmp= from; + + /* Look forwards */ + while (tmp) { + if (tmp == to) return ret; + ret+= text_get_visible_lines(st, ar, tmp->line); + tmp= tmp->next; + } + + return ret; + } else return txt_get_span(from, to); +} + +int text_get_total_lines(SpaceText *st, ARegion *ar) +{ + DrawCache *drawcache; + + text_update_drawcache(st, ar); + drawcache= (DrawCache *)st->drawcache; + + return drawcache->total_lines; +} + +/* Move pointer to first visible line (top) */ +static TextLine *first_visible_line(SpaceText *st, ARegion *ar, int *wrap_top) +{ + Text *text= st->text; + TextLine* pline= text->lines.first; + int i= st->top, lineno= 0; + DrawCache *drawcache; + + text_update_drawcache(st, ar); + drawcache= (DrawCache *)st->drawcache; + + if(wrap_top) *wrap_top= 0; + + if(st->wordwrap) { + while(i>0 && pline) { + int lines= text_get_visible_lines_no(st, lineno); + + if (i-lines<0) { + if(wrap_top) *wrap_top= i; + break; + } else { + pline= pline->next; + i-= lines; + lineno++; + } + } + } else { + for(i=st->top, pline= text->lines.first; pline->next && i>0; i--) + pline= pline->next; + } + + return pline; +} + /************************ draw scrollbar *****************************/ static void calc_text_rcts(SpaceText *st, ARegion *ar, rcti *scroll) { - int lhlstart, lhlend, ltexth; + int lhlstart, lhlend, ltexth, sell_off, curl_off; short barheight, barstart, hlstart, hlend, blank_lines; short pix_available, pix_top_margin, pix_bottom_margin, pix_bardiff; pix_top_margin = 8; pix_bottom_margin = 4; pix_available = ar->winy - pix_top_margin - pix_bottom_margin; - ltexth= txt_get_span(st->text->lines.first, st->text->lines.last); + ltexth= text_get_total_lines(st, ar); blank_lines = st->viewlines / 2; /* nicer code: use scroll rect for entire bar */ @@ -722,10 +1108,10 @@ static void calc_text_rcts(SpaceText *st, ARegion *ar, rcti *scroll) st->pix_per_line= (pix_available > 0)? (float) ltexth/pix_available: 0; if(st->pix_per_line<.1) st->pix_per_line=.1f; - lhlstart = MIN2(txt_get_span(st->text->lines.first, st->text->curl), - txt_get_span(st->text->lines.first, st->text->sell)); - lhlend = MAX2(txt_get_span(st->text->lines.first, st->text->curl), - txt_get_span(st->text->lines.first, st->text->sell)); + curl_off= text_get_span_wrap(st, ar, st->text->lines.first, st->text->curl); + sell_off= text_get_span_wrap(st, ar, st->text->lines.first, st->text->sell); + lhlstart = MIN2(curl_off, sell_off); + lhlend = MAX2(curl_off, sell_off); if(ltexth > 0) { hlstart = (lhlstart * pix_available)/ltexth; @@ -787,7 +1173,7 @@ static void calc_text_rcts(SpaceText *st, ARegion *ar, rcti *scroll) CLAMP(st->txtscroll.ymax, pix_bottom_margin, ar->winy - pix_top_margin); } -static void draw_textscroll(SpaceText *st, ARegion *ar, rcti *scroll) +static void draw_textscroll(SpaceText *st, rcti *scroll) { bTheme *btheme= U.themes.first; uiWidgetColors wcol= btheme->tui.wcol_scroll; @@ -811,78 +1197,80 @@ static void draw_markers(SpaceText *st, ARegion *ar) { Text *text= st->text; TextMarker *marker, *next; - TextLine *top, *bottom, *line; - int offl, offc, i, cy, x1, x2, y1, y2, x, y; + TextLine *top, *line; + int offl, offc, i, x1, x2, y1, y2, x, y; + int topi, topy; + + /* Move pointer to first visible line (top) */ + top= first_visible_line(st, ar, NULL); + topi= BLI_findindex(&text->lines, top); - for(i=st->top, top= text->lines.first; top->next && i>0; i--) - top= top->next; + topy= txt_get_span(text->lines.first, top); - for(i=st->viewlines-1, bottom=top; bottom->next && i>0; i--) - bottom= bottom->next; - for(marker= text->markers.first; marker; marker= next) { next= marker->next; - for(cy= 0, line= top; line; cy++, line= line->next) { - if(cy+st->top==marker->lineno) { - /* Remove broken markers */ - if(marker->end>line->len || marker->start>marker->end) { - BLI_freelinkN(&text->markers, marker); - break; - } + /* invisible line (before top) */ + if(marker->lineno<topi) continue; - wrap_offset(st, ar, line, marker->start, &offl, &offc); - x1= get_char_pos(st, line->line, marker->start) - st->left + offc; - y1= cy + offl; - wrap_offset(st, ar, line, marker->end, &offl, &offc); - x2= get_char_pos(st, line->line, marker->end) - st->left + offc; - y2= cy + offl; - - glColor3ub(marker->color[0], marker->color[1], marker->color[2]); - x= st->showlinenrs ? TXT_OFFSET + TEXTXLOC : TXT_OFFSET; - y= ar->winy-3; - - if(y1==y2) { - y -= y1*st->lheight; - glBegin(GL_LINE_LOOP); - glVertex2i(x+x2*st->cwidth+1, y); - glVertex2i(x+x1*st->cwidth-2, y); - glVertex2i(x+x1*st->cwidth-2, y-st->lheight); - glVertex2i(x+x2*st->cwidth+1, y-st->lheight); - glEnd(); - } - else { - y -= y1*st->lheight; - glBegin(GL_LINE_STRIP); - glVertex2i(ar->winx, y); - glVertex2i(x+x1*st->cwidth-2, y); - glVertex2i(x+x1*st->cwidth-2, y-st->lheight); - glVertex2i(ar->winx, y-st->lheight); - glEnd(); - y-=st->lheight; - - for(i=y1+1; i<y2; i++) { - glBegin(GL_LINES); - glVertex2i(x, y); - glVertex2i(ar->winx, y); - glVertex2i(x, y-st->lheight); - glVertex2i(ar->winx, y-st->lheight); - glEnd(); - y-=st->lheight; - } + line= BLI_findlink(&text->lines, marker->lineno); - glBegin(GL_LINE_STRIP); - glVertex2i(x, y); - glVertex2i(x+x2*st->cwidth+1, y); - glVertex2i(x+x2*st->cwidth+1, y-st->lheight); - glVertex2i(x, y-st->lheight); - glEnd(); - } + /* Remove broken markers */ + if(marker->end>line->len || marker->start>marker->end) { + BLI_freelinkN(&text->markers, marker); + continue; + } - break; + wrap_offset(st, ar, line, marker->start, &offl, &offc); + y1 = txt_get_span(top, line) - st->top + offl + topy; + x1 = text_get_char_pos(st, line->line, marker->start) - st->left + offc; + + wrap_offset(st, ar, line, marker->end, &offl, &offc); + y2 = txt_get_span(top, line) - st->top + offl + topy; + x2 = text_get_char_pos(st, line->line, marker->end) - st->left + offc; + + /* invisible part of line (before top, after last visible line) */ + if(y2 < 0 || y1 > st->top+st->viewlines) continue; + + glColor3ub(marker->color[0], marker->color[1], marker->color[2]); + x= st->showlinenrs ? TXT_OFFSET + TEXTXLOC : TXT_OFFSET; + y= ar->winy-3; + + if(y1==y2) { + y -= y1*st->lheight; + glBegin(GL_LINE_LOOP); + glVertex2i(x+x2*st->cwidth+1, y); + glVertex2i(x+x1*st->cwidth-2, y); + glVertex2i(x+x1*st->cwidth-2, y-st->lheight); + glVertex2i(x+x2*st->cwidth+1, y-st->lheight); + glEnd(); + } + else { + y -= y1*st->lheight; + glBegin(GL_LINE_STRIP); + glVertex2i(ar->winx, y); + glVertex2i(x+x1*st->cwidth-2, y); + glVertex2i(x+x1*st->cwidth-2, y-st->lheight); + glVertex2i(ar->winx, y-st->lheight); + glEnd(); + y-=st->lheight; + + for(i=y1+1; i<y2; i++) { + glBegin(GL_LINES); + glVertex2i(x, y); + glVertex2i(ar->winx, y); + glVertex2i(x, y-st->lheight); + glVertex2i(ar->winx, y-st->lheight); + glEnd(); + y-=st->lheight; } - if(line==bottom) break; + glBegin(GL_LINE_STRIP); + glVertex2i(x, y); + glVertex2i(x+x2*st->cwidth+1, y); + glVertex2i(x+x2*st->cwidth+1, y-st->lheight); + glVertex2i(x, y-st->lheight); + glEnd(); } } } @@ -1058,16 +1446,16 @@ static void draw_cursor(SpaceText *st, ARegion *ar) Text *text= st->text; int vcurl, vcurc, vsell, vselc, hidden=0; int offl, offc, x, y, w, i; - + /* Draw the selection */ if(text->curl!=text->sell || text->curc!=text->selc) { /* Convert all to view space character coordinates */ wrap_offset(st, ar, text->curl, text->curc, &offl, &offc); vcurl = txt_get_span(text->lines.first, text->curl) - st->top + offl; - vcurc = get_char_pos(st, text->curl->line, text->curc) - st->left + offc; + vcurc = text_get_char_pos(st, text->curl->line, text->curc) - st->left + offc; wrap_offset(st, ar, text->sell, text->selc, &offl, &offc); vsell = txt_get_span(text->lines.first, text->sell) - st->top + offl; - vselc = get_char_pos(st, text->sell->line, text->selc) - st->left + offc; + vselc = text_get_char_pos(st, text->sell->line, text->selc) - st->left + offc; if(vcurc<0) vcurc=0; if(vselc<0) vselc=0, hidden=1; @@ -1106,7 +1494,7 @@ static void draw_cursor(SpaceText *st, ARegion *ar) else { wrap_offset(st, ar, text->sell, text->selc, &offl, &offc); vsell = txt_get_span(text->lines.first, text->sell) - st->top + offl; - vselc = get_char_pos(st, text->sell->line, text->selc) - st->left + offc; + vselc = text_get_char_pos(st, text->sell->line, text->selc) - st->left + offc; if(vselc<0) { vselc= 0; @@ -1115,17 +1503,30 @@ static void draw_cursor(SpaceText *st, ARegion *ar) } if(st->line_hlight) { - y= ar->winy-2 - vsell*st->lheight; - if(!(y<0 || y > ar->winy)) { /* check we need to draw */ - int x1= st->showlinenrs ? TXT_OFFSET + TEXTXLOC : TXT_OFFSET; - int x2= x1 + ar->winx; - y= ar->winy-2 - vsell*st->lheight; - + int x1, x2, y1, y2; + + if(st->wordwrap) { + int visible_lines = text_get_visible_lines(st, ar, text->sell->line); + int offl, offc; + + wrap_offset_in_line(st, ar, text->sell, text->selc, &offl, &offc); + + y1= ar->winy-2 - (vsell-offl)*st->lheight; + y2= y1-st->lheight*visible_lines+1; + } else { + y1= ar->winy-2 - vsell*st->lheight; + y2= y1-st->lheight+1; + } + + if(!(y1<0 || y2 > ar->winy)) { /* check we need to draw */ + x1= st->showlinenrs ? TXT_OFFSET + TEXTXLOC : TXT_OFFSET; + x2= x1 + ar->winx; + glColor4ub(255, 255, 255, 32); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glEnable(GL_BLEND); - glRecti(x1-4, y, x2, y-st->lheight+1); + glRecti(x1-4, y1, x2, y2); glDisable(GL_BLEND); } } @@ -1138,8 +1539,10 @@ static void draw_cursor(SpaceText *st, ARegion *ar) if(st->overwrite) { char ch= text->sell->line[text->selc]; - if(!ch) ch= ' '; + w= st->cwidth; + if(ch=='\t') w*= st->tabnumber-(vselc+st->left)%st->tabnumber; + UI_ThemeColor(TH_HILITE); glRecti(x, y-st->lheight-1, x+w, y-st->lheight+1); } @@ -1243,7 +1646,7 @@ static void draw_brackets(SpaceText *st, ARegion *ar) /* draw opening bracket */ ch= startl->line[startc]; wrap_offset(st, ar, startl, startc, &offl, &offc); - viewc= get_char_pos(st, startl->line, startc) - st->left + offc; + viewc= text_get_char_pos(st, startl->line, startc) - st->left + offc; if(viewc >= 0){ viewl= txt_get_span(text->lines.first, startl) - st->top + offl; @@ -1255,7 +1658,7 @@ static void draw_brackets(SpaceText *st, ARegion *ar) /* draw closing bracket */ ch= endl->line[endc]; wrap_offset(st, ar, endl, endc, &offl, &offc); - viewc= get_char_pos(st, endl->line, endc) - st->left + offc; + viewc= text_get_char_pos(st, endl->line, endc) - st->left + offc; if(viewc >= 0) { viewl= txt_get_span(text->lines.first, endl) - st->top + offl; @@ -1273,12 +1676,15 @@ void draw_text_main(SpaceText *st, ARegion *ar) TextLine *tmp; rcti scroll; char linenr[12]; - int i, x, y, winx, linecount= 0; + int i, x, y, winx, linecount= 0, lineno= 0; + int wraplinecount= 0, wrap_skip= 0; /* if no text, nothing to do */ if(!text) return; + text_update_drawcache(st, ar); + /* make sure all the positional pointers exist */ if(!text->curl || !text->sell || !text->lines.first || !text->lines.last) txt_clean_text(text); @@ -1291,12 +1697,28 @@ void draw_text_main(SpaceText *st, ARegion *ar) /* update syntax formatting if needed */ tmp= text->lines.first; + lineno= 0; for(i= 0; i<st->top && tmp; i++) { if(st->showsyntax && !tmp->format) txt_format_line(st, tmp, 0); - tmp= tmp->next; - linecount++; + if(st->wordwrap) { + int lines= text_get_visible_lines_no(st, lineno); + + if (wraplinecount+lines>st->top) { + wrap_skip= st->top-wraplinecount; + break; + } else { + wraplinecount+= lines; + tmp= tmp->next; + linecount++; + } + } else { + tmp= tmp->next; + linecount++; + } + + lineno++; } text_font_begin(st); @@ -1305,7 +1727,6 @@ void draw_text_main(SpaceText *st, ARegion *ar) /* draw line numbers background */ if(st->showlinenrs) { - st->linenrs_tot = (int)floor(log10((float)(linecount + st->viewlines))) + 1; x= TXT_OFFSET + TEXTXLOC; UI_ThemeColor(TH_GRID); @@ -1328,7 +1749,7 @@ void draw_text_main(SpaceText *st, ARegion *ar) if(st->showsyntax && !tmp->format) txt_format_line(st, tmp, 0); - if(st->showlinenrs) { + if(st->showlinenrs && !wrap_skip) { /* draw line number */ if(tmp == text->curl) UI_ThemeColor(TH_HILITE); @@ -1344,21 +1765,23 @@ void draw_text_main(SpaceText *st, ARegion *ar) if(st->wordwrap) { /* draw word wrapped text */ - int lines = text_draw_wrapped(st, tmp->line, x, y, winx-x, tmp->format); + int lines = text_draw_wrapped(st, tmp->line, x, y, winx-x, tmp->format, wrap_skip); y -= lines*st->lheight; } else { /* draw unwrapped text */ - text_draw(st, tmp->line, st->left, 0, 1, x, y, tmp->format); + text_draw(st, tmp->line, st->left, ar->winx/st->cwidth, 1, x, y, tmp->format); y -= st->lheight; } + + wrap_skip= 0; } /* draw other stuff */ draw_brackets(st, ar); draw_markers(st, ar); glTranslatef(0.375f, 0.375f, 0.0f); /* XXX scroll requires exact pixel space */ - draw_textscroll(st, ar, &scroll); + draw_textscroll(st, &scroll); draw_documentation(st, ar); draw_suggestion_list(st, ar); @@ -1398,6 +1821,12 @@ void text_update_cursor_moved(bContext *C) text_update_character_width(st); i= txt_get_span(text->lines.first, text->sell); + if(st->wordwrap) { + int offl, offc; + wrap_offset(st, CTX_wm_region(C), text->sell, text->selc, &offl, &offc); + i+= offl; + } + if(st->top+st->viewlines <= i || st->top > i) st->top= i - st->viewlines/2; diff --git a/source/blender/editors/space_text/text_header.c b/source/blender/editors/space_text/text_header.c index 672940cf3cb..464e144515f 100644 --- a/source/blender/editors/space_text/text_header.c +++ b/source/blender/editors/space_text/text_header.c @@ -101,7 +101,7 @@ static int properties_poll(bContext *C) return (CTX_wm_space_text(C) != NULL); } -static int properties_exec(bContext *C, wmOperator *op) +static int properties_exec(bContext *C, wmOperator *UNUSED(op)) { ScrArea *sa= CTX_wm_area(C); ARegion *ar= text_has_properties_region(sa); diff --git a/source/blender/editors/space_text/text_intern.h b/source/blender/editors/space_text/text_intern.h index a93f30ac62a..c229e685aba 100644 --- a/source/blender/editors/space_text/text_intern.h +++ b/source/blender/editors/space_text/text_intern.h @@ -53,7 +53,7 @@ int text_check_whitespace(char ch); int text_font_width_character(struct SpaceText *st); int text_font_width(struct SpaceText *st, char *str); -void text_update_line_edited(struct Text *text, struct TextLine *line); +void text_update_line_edited(struct TextLine *line); void text_update_edited(struct Text *text); void text_update_character_width(struct SpaceText *st); void text_update_cursor_moved(struct bContext *C); @@ -90,12 +90,20 @@ 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); + +void text_drawcache_tag_update(struct SpaceText *st, int full); +void text_free_caches(struct SpaceText *st); int text_file_modified(struct Text *text); int text_do_suggest_select(struct SpaceText *st, struct ARegion *ar); void text_pop_suggest_list(); +int text_get_visible_lines(struct SpaceText *st, struct ARegion *ar, 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); /* text_ops.c */ enum { LINE_BEGIN, LINE_END, FILE_TOP, FILE_BOTTOM, PREV_CHAR, NEXT_CHAR, diff --git a/source/blender/editors/space_text/text_ops.c b/source/blender/editors/space_text/text_ops.c index e3bf390dba8..8d4f3f87f66 100644 --- a/source/blender/editors/space_text/text_ops.c +++ b/source/blender/editors/space_text/text_ops.c @@ -66,7 +66,7 @@ /************************ poll ***************************/ -static int text_new_poll(bContext *C) +static int text_new_poll(bContext *UNUSED(C)) { return 1; } @@ -125,7 +125,7 @@ static int text_region_edit_poll(bContext *C) /********************** updates *********************/ -void text_update_line_edited(Text *text, TextLine *line) +void text_update_line_edited(TextLine *line) { if(!line) return; @@ -142,12 +142,12 @@ void text_update_edited(Text *text) TextLine *line; for(line=text->lines.first; line; line=line->next) - text_update_line_edited(text, line); + text_update_line_edited(line); } /******************* new operator *********************/ -static int new_exec(bContext *C, wmOperator *op) +static int new_exec(bContext *C, wmOperator *UNUSED(op)) { SpaceText *st= CTX_wm_space_text(C); Text *text; @@ -173,6 +173,7 @@ static int new_exec(bContext *C, wmOperator *op) st->top= 0; } + text_drawcache_tag_update(st, 1); WM_event_add_notifier(C, NC_TEXT|NA_ADDED, text); return OPERATOR_FINISHED; @@ -203,7 +204,7 @@ static void open_init(bContext *C, wmOperator *op) uiIDContextProperty(C, &pprop->ptr, &pprop->prop); } -static int open_cancel(bContext *C, wmOperator *op) +static int open_cancel(bContext *UNUSED(C), wmOperator *op) { MEM_freeN(op->customdata); return OPERATOR_CANCELLED; @@ -220,7 +221,7 @@ static int open_exec(bContext *C, wmOperator *op) RNA_string_get(op->ptr, "filepath", str); - text= add_text(str, G.sce); + text= add_text(str, G.main->name); if(!text) { if(op->customdata) MEM_freeN(op->customdata); @@ -254,6 +255,7 @@ static int open_exec(bContext *C, wmOperator *op) text->name = NULL; } + text_drawcache_tag_update(st, 1); WM_event_add_notifier(C, NC_TEXT|NA_ADDED, text); MEM_freeN(op->customdata); @@ -261,10 +263,10 @@ static int open_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -static int open_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int open_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { Text *text= CTX_data_edit_text(C); - char *path= (text && text->name)? text->name: G.sce; + char *path= (text && text->name)? text->name: G.main->name; if(RNA_property_is_set(op->ptr, "filepath")) return open_exec(C, op); @@ -315,6 +317,7 @@ static int reload_exec(bContext *C, wmOperator *op) text_update_edited(text); text_update_cursor_moved(C); + text_drawcache_tag_update(CTX_wm_space_text(C), 1); WM_event_add_notifier(C, NC_TEXT|NA_EDITED, text); return OPERATOR_FINISHED; @@ -335,7 +338,7 @@ void TEXT_OT_reload(wmOperatorType *ot) /******************* delete operator *********************/ -static int unlink_exec(bContext *C, wmOperator *op) +static int unlink_exec(bContext *C, wmOperator *UNUSED(op)) { Main *bmain= CTX_data_main(C); SpaceText *st= CTX_wm_space_text(C); @@ -357,6 +360,8 @@ static int unlink_exec(bContext *C, wmOperator *op) unlink_text(bmain, text); free_libblock(&bmain->text, text); + + text_drawcache_tag_update(st, 1); WM_event_add_notifier(C, NC_TEXT|NA_REMOVED, NULL); return OPERATOR_FINISHED; @@ -380,7 +385,7 @@ void TEXT_OT_unlink(wmOperatorType *ot) /******************* make internal operator *********************/ -static int make_internal_exec(bContext *C, wmOperator *op) +static int make_internal_exec(bContext *C, wmOperator *UNUSED(op)) { Text *text= CTX_data_edit_text(C); @@ -433,7 +438,7 @@ static void txt_write_file(Text *text, ReportList *reports) char file[FILE_MAXDIR+FILE_MAXFILE]; BLI_strncpy(file, text->name, FILE_MAXDIR+FILE_MAXFILE); - BLI_path_abs(file, G.sce); + BLI_path_abs(file, G.main->name); fp= fopen(file, "w"); if(fp==NULL) { @@ -506,7 +511,7 @@ static int save_as_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -static int save_as_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int save_as_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { Text *text= CTX_data_edit_text(C); char *str; @@ -519,7 +524,7 @@ static int save_as_invoke(bContext *C, wmOperator *op, wmEvent *event) else if(text->flags & TXT_ISMEM) str= text->id.name+2; else - str= G.sce; + str= G.main->name; RNA_string_set(op->ptr, "filepath", str); WM_event_add_fileselect(C, op); @@ -588,7 +593,7 @@ void TEXT_OT_run_script(wmOperatorType *ot) /******************* refresh pyconstraints operator *********************/ -static int refresh_pyconstraints_exec(bContext *C, wmOperator *op) +static int refresh_pyconstraints_exec(bContext *UNUSED(C), wmOperator *UNUSED(op)) { #ifndef DISABLE_PYTHON #if 0 @@ -738,6 +743,8 @@ static int paste_exec(bContext *C, wmOperator *op) if(!buf) return OPERATOR_CANCELLED; + text_drawcache_tag_update(CTX_wm_space_text(C), 0); + txt_insert_buf(text, buf); text_update_edited(text); @@ -782,7 +789,7 @@ static void txt_copy_clipboard(Text *text) } } -static int copy_exec(bContext *C, wmOperator *op) +static int copy_exec(bContext *C, wmOperator *UNUSED(op)) { Text *text= CTX_data_edit_text(C); @@ -809,6 +816,8 @@ static int cut_exec(bContext *C, wmOperator *op) { Text *text= CTX_data_edit_text(C); + text_drawcache_tag_update(CTX_wm_space_text(C), 0); + txt_copy_clipboard(text); txt_delete_selected(text); @@ -836,10 +845,12 @@ void TEXT_OT_cut(wmOperatorType *ot) /******************* indent operator *********************/ -static int indent_exec(bContext *C, wmOperator *op) +static int indent_exec(bContext *C, wmOperator *UNUSED(op)) { Text *text= CTX_data_edit_text(C); + text_drawcache_tag_update(CTX_wm_space_text(C), 0); + if(txt_has_sel(text)) { txt_order_cursors(text); indent(text); @@ -869,11 +880,13 @@ void TEXT_OT_indent(wmOperatorType *ot) /******************* unindent operator *********************/ -static int unindent_exec(bContext *C, wmOperator *op) +static int unindent_exec(bContext *C, wmOperator *UNUSED(op)) { Text *text= CTX_data_edit_text(C); if(txt_has_sel(text)) { + text_drawcache_tag_update(CTX_wm_space_text(C), 0); + txt_order_cursors(text); unindent(text); @@ -902,13 +915,15 @@ void TEXT_OT_unindent(wmOperatorType *ot) /******************* line break operator *********************/ -static int line_break_exec(bContext *C, wmOperator *op) +static int line_break_exec(bContext *C, wmOperator *UNUSED(op)) { SpaceText *st= CTX_wm_space_text(C); Text *text= CTX_data_edit_text(C); int a, curts; int space = (text->flags & TXT_TABSTOSPACES) ? st->tabnumber : 1; + text_drawcache_tag_update(st, 0); + // double check tabs/spaces before splitting the line curts= setcurr_tab_spaces(text, space); txt_split_curline(text); @@ -923,8 +938,8 @@ static int line_break_exec(bContext *C, wmOperator *op) if(text->curl) { if(text->curl->prev) - text_update_line_edited(text, text->curl->prev); - text_update_line_edited(text, text->curl); + text_update_line_edited(text->curl->prev); + text_update_line_edited(text->curl); } text_update_cursor_moved(C); @@ -947,11 +962,13 @@ void TEXT_OT_line_break(wmOperatorType *ot) /******************* comment operator *********************/ -static int comment_exec(bContext *C, wmOperator *op) +static int comment_exec(bContext *C, wmOperator *UNUSED(op)) { Text *text= CTX_data_edit_text(C); if(txt_has_sel(text)) { + text_drawcache_tag_update(CTX_wm_space_text(C), 0); + txt_order_cursors(text); comment(text); text_update_edited(text); @@ -978,11 +995,13 @@ void TEXT_OT_comment(wmOperatorType *ot) /******************* uncomment operator *********************/ -static int uncomment_exec(bContext *C, wmOperator *op) +static int uncomment_exec(bContext *C, wmOperator *UNUSED(op)) { Text *text= CTX_data_edit_text(C); if(txt_has_sel(text)) { + text_drawcache_tag_update(CTX_wm_space_text(C), 0); + txt_order_cursors(text); uncomment(text); text_update_edited(text); @@ -1130,6 +1149,7 @@ static int convert_whitespace_exec(bContext *C, wmOperator *op) text_update_edited(text); text_update_cursor_moved(C); + text_drawcache_tag_update(st, 1); WM_event_add_notifier(C, NC_TEXT|NA_EDITED, text); return OPERATOR_FINISHED; @@ -1152,7 +1172,7 @@ void TEXT_OT_convert_whitespace(wmOperatorType *ot) /******************* select all operator *********************/ -static int select_all_exec(bContext *C, wmOperator *op) +static int select_all_exec(bContext *C, wmOperator *UNUSED(op)) { Text *text= CTX_data_edit_text(C); @@ -1178,7 +1198,7 @@ void TEXT_OT_select_all(wmOperatorType *ot) /******************* select line operator *********************/ -static int select_line_exec(bContext *C, wmOperator *op) +static int select_line_exec(bContext *C, wmOperator *UNUSED(op)) { Text *text= CTX_data_edit_text(C); @@ -1204,7 +1224,7 @@ void TEXT_OT_select_line(wmOperatorType *ot) /******************* previous marker operator *********************/ -static int previous_marker_exec(bContext *C, wmOperator *op) +static int previous_marker_exec(bContext *C, wmOperator *UNUSED(op)) { Text *text= CTX_data_edit_text(C); TextMarker *mrk; @@ -1240,7 +1260,7 @@ void TEXT_OT_previous_marker(wmOperatorType *ot) /******************* next marker operator *********************/ -static int next_marker_exec(bContext *C, wmOperator *op) +static int next_marker_exec(bContext *C, wmOperator *UNUSED(op)) { Text *text= CTX_data_edit_text(C); TextMarker *mrk; @@ -1276,7 +1296,7 @@ void TEXT_OT_next_marker(wmOperatorType *ot) /******************* clear all markers operator *********************/ -static int clear_all_markers_exec(bContext *C, wmOperator *op) +static int clear_all_markers_exec(bContext *C, wmOperator *UNUSED(op)) { Text *text= CTX_data_edit_text(C); @@ -1317,146 +1337,360 @@ static EnumPropertyItem move_type_items[]= { {NEXT_PAGE, "NEXT_PAGE", 0, "Next Page", ""}, {0, NULL, 0, NULL, NULL}}; +/* get cursor position in line by relative wrapped line and column positions */ +static int text_get_cursor_rel(SpaceText* st, ARegion *ar, TextLine *linein, int rell, int relc) +{ + int i, j, start, end, chars, max, chop, curs, loop, endj, found, selc; + char ch; + + max= wrap_width(st, ar); + + selc= start= chars= endj= curs= found= 0; + end= max; + chop= loop= 1; + + for(i=0, j=0; loop; j++) { + /* Mimic replacement of tabs */ + ch= linein->line[j]; + if(ch=='\t') { + chars= st->tabnumber-i%st->tabnumber; + ch= ' '; + } + else chars= 1; + + while(chars--) { + if(rell==0 && i-start==relc) { + /* current position could be wrapped to next line */ + /* this should be checked when end of current line would be reached */ + selc= j; + found= 1; + } + else if(i-end==relc) { + curs= j; + } + if(i-start>=max) { + if(found) { + /* exact cursor position was found, check if it's */ + /* still on needed line (hasn't been wrapped) */ + if(selc>endj && !chop) selc= endj; + loop= 0; + break; + } + + if(chop) endj= j; + + start= end; + end += max; + chop= 1; + rell--; + + if(rell==0 && i-start>=relc) { + selc= curs; + loop= 0; + break; + } + } + else if (ch=='\0') { + if(!found) selc= linein->len; + loop= 0; + break; + } + else if(ch==' ' || ch=='-') { + if(found) { + loop= 0; + break; + } + + if(rell==0 && i-start>=relc) { + selc= curs; + loop= 0; + break; + } + end= i+1; + endj= j; + chop= 0; + } + i++; + } + } + + return selc; +} + +static int cursor_skip_find_line(SpaceText* st, ARegion *ar, + int lines, TextLine **linep, int *charp, int *rell, int *relc) +{ + int offl, offc, visible_lines; + + wrap_offset_in_line(st, ar, *linep, *charp, &offl, &offc); + *relc= text_get_char_pos(st, (*linep)->line, *charp) + offc; + *rell= lines; + + /* handle current line */ + if(lines>0) { + visible_lines= text_get_visible_lines(st, ar, (*linep)->line); + + if(*rell-visible_lines+offl>=0) { + if(!(*linep)->next) { + if(offl < visible_lines-1) { + *rell= visible_lines-1; + return 1; + } + + *charp= (*linep)->len; + return 0; + } + + *rell-= visible_lines-offl; + *linep=(*linep)->next; + } else { + *rell+= offl; + return 1; + } + } else { + if(*rell+offl<=0) { + if(!(*linep)->prev) { + if(offl) { + *rell= 0; + return 1; + } + + *charp= 0; + return 0; + } + + *rell+= offl; + *linep=(*linep)->prev; + } else { + *rell+= offl; + return 1; + } + } + + /* skip lines and find destination line and offsets */ + while(*linep) { + visible_lines= text_get_visible_lines(st, ar, (*linep)->line); + + if(lines<0) { /* moving top */ + if(*rell+visible_lines >= 0) { + *rell+= visible_lines; + break; + } + + if(!(*linep)->prev) { + *rell= 0; + break; + } + + *rell+= visible_lines; + *linep=(*linep)->prev; + } else { /* moving bottom */ + if(*rell-visible_lines < 0) break; + + if(!(*linep)->next) { + *rell= visible_lines-1; + break; + } + + *rell-= visible_lines; + *linep=(*linep)->next; + } + } + + return 1; +} + static void wrap_move_bol(SpaceText *st, ARegion *ar, short sel) { Text *text= st->text; - int offl, offc, lin; + TextLine **linep; + int *charp; + int oldl, oldc, i, j, max, start, end, chars, endj, chop, loop; + char ch; text_update_character_width(st); - lin= txt_get_span(text->lines.first, text->sell); - wrap_offset(st, ar, text->sell, text->selc, &offl, &offc); + if (sel) linep= &text->sell, charp= &text->selc; + else linep= &text->curl, charp= &text->curc; - if (sel) { - txt_undo_add_toop(text, UNDO_STO, lin, text->selc, lin, -offc); - text->selc= -offc; - } else { - txt_undo_add_toop(text, UNDO_CTO, lin, text->curc, lin, -offc); - text->curc= -offc; - txt_pop_sel(text); + oldc= *charp; + oldl= txt_get_span(text->lines.first, *linep); + + max= wrap_width(st, ar); + + start= chars= endj= 0; + end= max; + chop= loop= 1; + *charp= 0; + + for(i=0, j=0; loop; j++) { + /* Mimic replacement of tabs */ + ch= (*linep)->line[j]; + if(ch=='\t') { + chars= st->tabnumber-i%st->tabnumber; + ch= ' '; + } + else chars= 1; + + while(chars--) { + if(i-start>=max) { + *charp= endj; + + if(j>=oldc) { + loop= 0; + break; + } + + if(chop) endj= j; + + start= end; + end += max; + chop= 0; + } + else if(ch==' ' || ch=='-' || ch=='\0') { + if(j>=oldc) { + loop= 0; + break; + } + + end= i+1; + endj= j+1; + chop= 0; + } + i++; + } } + + if (!sel) txt_pop_sel(text); + txt_undo_add_toop(text, sel?UNDO_STO:UNDO_CTO, oldl, oldc, oldl, *charp); } static void wrap_move_eol(SpaceText *st, ARegion *ar, short sel) { Text *text= st->text; - int offl, offc, lin, startl, c; + TextLine **linep; + int *charp; + int oldl, oldc, i, j, max, start, end, chars, endj, chop, loop; + char ch; text_update_character_width(st); - lin= txt_get_span(text->lines.first, text->sell); - wrap_offset(st, ar, text->sell, text->selc, &offl, &offc); - startl= offl; - c= text->selc; - while (offl==startl && text->sell->line[c]!='\0') { - c++; - wrap_offset(st, ar, text->sell, c, &offl, &offc); - } if (offl!=startl) c--; - - if (sel) { - txt_undo_add_toop(text, UNDO_STO, lin, text->selc, lin, c); - text->selc= c; - } else { - txt_undo_add_toop(text, UNDO_CTO, lin, text->curc, lin, c); - text->curc= c; - txt_pop_sel(text); + if (sel) linep= &text->sell, charp= &text->selc; + else linep= &text->curl, charp= &text->curc; + + oldc= *charp; + oldl= txt_get_span(text->lines.first, *linep); + + max= wrap_width(st, ar); + + start= chars= endj= 0; + end= max; + chop= loop= 1; + *charp= 0; + + for(i=0, j=0; loop; j++) { + /* Mimic replacement of tabs */ + ch= (*linep)->line[j]; + if(ch=='\t') { + chars= st->tabnumber-i%st->tabnumber; + ch= ' '; + } + else chars= 1; + + while(chars--) { + if(i-start>=max) { + if(endj>=oldc) { + *charp= endj; + loop= 0; + break; + } + + if(chop) endj= j; + + start= end; + end += max; + chop= 0; + } else if(ch=='\0') { + *charp= (*linep)->len; + loop= 0; + break; + } else if(ch==' ' || ch=='-') { + end= i+1; + endj= j; + chop= 0; + } + i++; + } } + + if (!sel) txt_pop_sel(text); + txt_undo_add_toop(text, sel?UNDO_STO:UNDO_CTO, oldl, oldc, oldl, *charp); } static void wrap_move_up(SpaceText *st, ARegion *ar, short sel) { Text *text= st->text; - int offl, offl_1, offc, fromline, toline, c, target; + TextLine **linep; + int *charp; + int oldl, oldc, offl, offc, col, newl; text_update_character_width(st); - wrap_offset(st, ar, text->sell, 0, &offl_1, &offc); - wrap_offset(st, ar, text->sell, text->selc, &offl, &offc); - fromline= toline= txt_get_span(text->lines.first, text->sell); - target= text->selc + offc; + if (sel) linep= &text->sell, charp= &text->selc; + else linep= &text->curl, charp= &text->curc; - if (offl==offl_1) { - if (!text->sell->prev) { - txt_move_bol(text, sel); - return; - } - toline--; - c= text->sell->prev->len; /* End of prev. line */ - wrap_offset(st, ar, text->sell->prev, c, &offl, &offc); - c= -offc+target; + /* store previous position */ + oldc= *charp; + newl= oldl= txt_get_span(text->lines.first, *linep); + + wrap_offset_in_line(st, ar, *linep, *charp, &offl, &offc); + col= text_get_char_pos(st, (*linep)->line, *charp) + offc; + if(offl) { + *charp= text_get_cursor_rel(st, ar, *linep, offl-1, col); } else { - c= -offc-1; /* End of prev. line */ - wrap_offset(st, ar, text->sell, c, &offl, &offc); - c= -offc+target; - } - if (c<0) c=0; - - if (sel) { - txt_undo_add_toop(text, UNDO_STO, fromline, text->selc, toline, c); - if (toline<fromline) text->sell= text->sell->prev; - if(text->sell) { - if (c>text->sell->len) c= text->sell->len; - text->selc= c; - } - } - else if(text->curl) { - txt_undo_add_toop(text, UNDO_CTO, fromline, text->curc, toline, c); - if (toline<fromline) text->curl= text->curl->prev; - if(text->curl) { - if (c>text->curl->len) c= text->curl->len; - text->curc= c; - txt_pop_sel(text); - } + if((*linep)->prev) { + int visible_lines; + + *linep= (*linep)->prev; + visible_lines= text_get_visible_lines(st, ar, (*linep)->line); + *charp= text_get_cursor_rel(st, ar, *linep, visible_lines-1, col); + } else *charp= 0; } + + if (!sel) txt_pop_sel(text); + txt_undo_add_toop(text, sel?UNDO_STO:UNDO_CTO, oldl, oldc, newl, *charp); } static void wrap_move_down(SpaceText *st, ARegion *ar, short sel) { Text *text= st->text; - int offl, startoff, offc, fromline, toline, c, target; + TextLine **linep; + int *charp; + int oldl, oldc, offl, offc, col, newl, visible_lines; text_update_character_width(st); - wrap_offset(st, ar, text->sell, text->selc, &offl, &offc); - fromline= toline= txt_get_span(text->lines.first, text->sell); - target= text->selc + offc; - startoff= offl; - c= text->selc; - while (offl==startoff && text->sell->line[c]!='\0') { - c++; - wrap_offset(st, ar, text->sell, c, &offl, &offc); - } + if (sel) linep= &text->sell, charp= &text->selc; + else linep= &text->curl, charp= &text->curc; - if (text->sell->line[c]=='\0') { - if (!text->sell->next) { - txt_move_eol(text, sel); - return; - } - toline++; - c= target; + /* store previous position */ + oldc= *charp; + newl= oldl= txt_get_span(text->lines.first, *linep); + + wrap_offset_in_line(st, ar, *linep, *charp, &offl, &offc); + col= text_get_char_pos(st, (*linep)->line, *charp) + offc; + visible_lines= text_get_visible_lines(st, ar, (*linep)->line); + if(offl<visible_lines-1) { + *charp= text_get_cursor_rel(st, ar, *linep, offl+1, col); } else { - c += target; - if (c > text->sell->len) c= text->sell->len; - } - if (c<0) c=0; - - if (sel) { - txt_undo_add_toop(text, UNDO_STO, fromline, text->selc, toline, c); - if (toline>fromline) text->sell= text->sell->next; - if(text->sell) { - if (c>text->sell->len) c= text->sell->len; - text->selc= c; - } - } - else if(text->curl) { - txt_undo_add_toop(text, UNDO_CTO, fromline, text->curc, toline, c); - if (toline>fromline) text->curl= text->curl->next; - if(text->curl) { - if (c > text->curl->len) c= text->curl->len; - text->curc= c; - txt_pop_sel(text); - } + if((*linep)->next) { + *linep= (*linep)->next; + *charp= text_get_cursor_rel(st, ar, *linep, 0, col); + } else *charp= (*linep)->len; } + + if (!sel) txt_pop_sel(text); + txt_undo_add_toop(text, sel?UNDO_STO:UNDO_CTO, oldl, oldc, newl, *charp); } /* Moves the cursor vertically by the specified number of lines. @@ -1465,7 +1699,7 @@ static void wrap_move_down(SpaceText *st, ARegion *ar, short sel) This is to replace screen_skip for PageUp/Down operations. */ -static void cursor_skip(Text *text, int lines, int sel) +static void cursor_skip(SpaceText* st, ARegion *ar, Text *text, int lines, int sel) { TextLine **linep; int oldl, oldc, *charp; @@ -1475,13 +1709,21 @@ static void cursor_skip(Text *text, int lines, int sel) oldl= txt_get_span(text->lines.first, *linep); oldc= *charp; - while (lines>0 && (*linep)->next) { - *linep= (*linep)->next; - lines--; - } - while (lines<0 && (*linep)->prev) { - *linep= (*linep)->prev; - lines++; + if(st && ar && st->wordwrap) { + int rell, relc; + + /* find line and offsets inside it needed to set cursor position */ + if(cursor_skip_find_line(st, ar, lines, linep, charp, &rell, &relc)) + *charp= text_get_cursor_rel (st, ar, *linep, rell, relc); + } else { + while (lines>0 && (*linep)->next) { + *linep= (*linep)->next; + lines--; + } + while (lines<0 && (*linep)->prev) { + *linep= (*linep)->prev; + lines++; + } } if (*charp > (*linep)->len) *charp= (*linep)->len; @@ -1546,18 +1788,18 @@ static int move_cursor(bContext *C, int type, int select) break; case PREV_PAGE: - if(st) cursor_skip(text, -st->viewlines, select); - else cursor_skip(text, -10, select); + if(st) cursor_skip(st, ar, st->text, -st->viewlines, select); + else cursor_skip(NULL, NULL, text, -10, select); break; case NEXT_PAGE: - if(st) cursor_skip(text, st->viewlines, select); - else cursor_skip(text, 10, select); + if(st) cursor_skip(st, ar, st->text, st->viewlines, select); + else cursor_skip(NULL, NULL, text, 10, select); break; } text_update_cursor_moved(C); - WM_event_add_notifier(C, NC_TEXT|NA_EDITED, text); + WM_event_add_notifier(C, NC_TEXT|ND_CURSOR, text); return OPERATOR_FINISHED; } @@ -1629,7 +1871,7 @@ static int jump_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -static int jump_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int jump_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { return WM_operator_props_dialog_popup(C,op,200,100); @@ -1665,6 +1907,8 @@ static int delete_exec(bContext *C, wmOperator *op) Text *text= CTX_data_edit_text(C); int type= RNA_enum_get(op->ptr, "type"); + text_drawcache_tag_update(CTX_wm_space_text(C), 0); + if(type == DEL_PREV_WORD) txt_backspace_word(text); else if(type == DEL_PREV_CHAR) @@ -1674,7 +1918,7 @@ static int delete_exec(bContext *C, wmOperator *op) else if(type == DEL_NEXT_CHAR) txt_delete_char(text); - text_update_line_edited(text, text->curl); + text_update_line_edited(text->curl); text_update_cursor_moved(C); WM_event_add_notifier(C, NC_TEXT|NA_EDITED, text); @@ -1703,7 +1947,7 @@ void TEXT_OT_delete(wmOperatorType *ot) /******************* toggle overwrite operator **********************/ -static int toggle_overwrite_exec(bContext *C, wmOperator *op) +static int toggle_overwrite_exec(bContext *C, wmOperator *UNUSED(op)) { SpaceText *st= CTX_wm_space_text(C); @@ -1729,13 +1973,13 @@ void TEXT_OT_overwrite_toggle(wmOperatorType *ot) /******************* scroll operator **********************/ /* Moves the view vertically by the specified number of lines */ -static void screen_skip(SpaceText *st, int lines) +static void screen_skip(SpaceText *st, ARegion *ar, int lines) { int last; - st->top += lines; + st->top += lines; - last= txt_get_span(st->text->lines.first, st->text->lines.last); + last= text_get_total_lines(st, ar); last= last - (st->viewlines/2); if(st->top>last) st->top= last; @@ -1756,12 +2000,14 @@ typedef struct TextScroll { static int scroll_exec(bContext *C, wmOperator *op) { SpaceText *st= CTX_wm_space_text(C); + ARegion *ar= CTX_wm_region(C); + int lines= RNA_int_get(op->ptr, "lines"); if(lines == 0) return OPERATOR_CANCELLED; - screen_skip(st, lines*U.wheellinescroll); + screen_skip(st, ar, lines*U.wheellinescroll); ED_area_tag_redraw(CTX_wm_area(C)); @@ -1771,6 +2017,7 @@ static int scroll_exec(bContext *C, wmOperator *op) static void scroll_apply(bContext *C, wmOperator *op, wmEvent *event) { SpaceText *st= CTX_wm_space_text(C); + ARegion *ar= CTX_wm_region(C); TextScroll *tsc= op->customdata; short *mval= event->mval; @@ -1792,7 +2039,7 @@ static void scroll_apply(bContext *C, wmOperator *op, wmEvent *event) tsc->delta[1]= (tsc->hold[1]-mval[1])*st->pix_per_line; if(tsc->delta[0] || tsc->delta[1]) { - screen_skip(st, tsc->delta[1]); + screen_skip(st, ar, tsc->delta[1]); tsc->lines += tsc->delta[1]; @@ -1969,7 +2216,7 @@ static void set_cursor_to_pos(SpaceText *st, ARegion *ar, int x, int y, int sel) Text *text= st->text; TextLine **linep; int *charp; - int w; + int w, tabs; text_update_character_width(st); @@ -1987,16 +2234,28 @@ static void set_cursor_to_pos(SpaceText *st, ARegion *ar, int x, int y, int sel) x = (x/st->cwidth) + st->left; if(st->wordwrap) { - int i, j, endj, curs, max, chop, start, end, chars, loop; + int i, j, endj, curs, max, chop, start, end, chars, loop, found; char ch; /* Point to first visible line */ *linep= text->lines.first; - for(i=0; i<st->top && (*linep)->next; i++) *linep= (*linep)->next; + i= st->top; + while(i>0 && *linep) { + int lines= text_get_visible_lines(st, ar, (*linep)->line); + + if (i-lines<0) { + y+= i; + break; + } else { + *linep= (*linep)->next; + i-= lines; + } + } max= wrap_width(st, ar); loop= 1; + found= 0; while(loop && *linep) { start= 0; end= max; @@ -2004,12 +2263,14 @@ static void set_cursor_to_pos(SpaceText *st, ARegion *ar, int x, int y, int sel) chars= 0; curs= 0; endj= 0; + tabs= 0; for(i=0, j=0; loop; j++) { /* Mimic replacement of tabs */ ch= (*linep)->line[j]; if(ch=='\t') { chars= st->tabnumber-i%st->tabnumber; + tabs+= chars-1; ch= ' '; } else @@ -2021,22 +2282,34 @@ static void set_cursor_to_pos(SpaceText *st, ARegion *ar, int x, int y, int sel) *charp= endj; loop= 0; break; - /* Exactly at the cursor, done */ + /* Exactly at the cursor */ } else if(y==0 && i-start==x) { + /* current position could be wrapped to next line */ + /* this should be checked when end of current line would be reached */ *charp= curs= j; - loop= 0; - break; + found= 1; /* Prepare curs for next wrap */ } else if(i-end==x) { curs= j; } if(i-start>=max) { + if(found) { + /* exact cursor position was found, check if it's */ + /* still on needed line (hasn't been wrapped) */ + if(*charp>endj && !chop) (*charp)= endj; + loop= 0; + break; + } + if(chop) endj= j; - y--; start= end; end += max; + + if(start-tabs<(*linep)->len) + y--; + chop= 1; if(y==0 && i-start>=x) { *charp= curs; @@ -2045,6 +2318,11 @@ static void set_cursor_to_pos(SpaceText *st, ARegion *ar, int x, int y, int sel) } } else if(ch==' ' || ch=='-' || ch=='\0') { + if(found) { + loop= 0; + break; + } + if(y==0 && i-start>=x) { *charp= curs; loop= 0; @@ -2102,7 +2380,7 @@ static void set_cursor_apply(bContext *C, wmOperator *op, wmEvent *event) if(event->mval[1]<0 || event->mval[1]>ar->winy) { int d= (scu->old[1]-event->mval[1])*st->pix_per_line; - if(d) screen_skip(st, d); + if(d) screen_skip(st, ar, d); set_cursor_to_pos(st, ar, event->mval[0], event->mval[1]<0?0:ar->winy, 1); @@ -2234,7 +2512,7 @@ void TEXT_OT_cursor_set(wmOperatorType *ot) /******************* line number operator **********************/ -static int line_number_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int line_number_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent *event) { SpaceText *st= CTX_wm_space_text(C); Text *text= CTX_data_edit_text(C); @@ -2290,6 +2568,8 @@ static int insert_exec(bContext *C, wmOperator *op) char *str; int done = 0, i; + text_drawcache_tag_update(st, 0); + str= RNA_string_get_alloc(op->ptr, "text", NULL, 0); if(st && st->overwrite) { @@ -2307,7 +2587,7 @@ static int insert_exec(bContext *C, wmOperator *op) if(!done) return OPERATOR_CANCELLED; - text_update_line_edited(text, text->curl); + text_update_line_edited(text->curl); text_update_cursor_moved(C); WM_event_add_notifier(C, NC_TEXT|NA_EDITED, text); @@ -2322,9 +2602,8 @@ static int insert_invoke(bContext *C, wmOperator *op, wmEvent *event) // if(!RNA_property_is_set(op->ptr, "text")) { /* always set from keymap XXX */ if(!RNA_string_length(op->ptr, "text")) { char str[2] = {event->ascii, '\0'}; - /* if alt/ctrl/super are pressed pass through */ - if(event->alt || event->ctrl || event->oskey) + if(event->ctrl || event->oskey) return OPERATOR_PASS_THROUGH; RNA_string_set(op->ptr, "text", str); @@ -2397,6 +2676,7 @@ static int find_and_replace(bContext *C, wmOperator *op, short mode) } text_update_cursor_moved(C); WM_event_add_notifier(C, NC_TEXT|NA_EDITED, text); + text_drawcache_tag_update(CTX_wm_space_text(C), 1); } else if(mode==TEXT_MARK_ALL) { char color[4]; @@ -2530,7 +2810,7 @@ void TEXT_OT_find_set_selected(wmOperatorType *ot) /******************* replace set selected *********************/ -static int replace_set_selected_exec(bContext *C, wmOperator *op) +static int replace_set_selected_exec(bContext *C, wmOperator *UNUSED(op)) { SpaceText *st= CTX_wm_space_text(C); Text *text= CTX_data_edit_text(C); @@ -2580,7 +2860,7 @@ int text_file_modified(Text *text) return 0; BLI_strncpy(file, text->name, FILE_MAXDIR+FILE_MAXFILE); - BLI_path_abs(file, G.sce); + BLI_path_abs(file, G.main->name); if(!BLI_exists(file)) return 2; @@ -2608,7 +2888,7 @@ static void text_ignore_modified(Text *text) if(!text || !text->name) return; BLI_strncpy(file, text->name, FILE_MAXDIR+FILE_MAXFILE); - BLI_path_abs(file, G.sce); + BLI_path_abs(file, G.main->name); if(!BLI_exists(file)) return; @@ -2640,7 +2920,7 @@ static int resolve_conflict_exec(bContext *C, wmOperator *op) return OPERATOR_CANCELLED; } -static int resolve_conflict_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int resolve_conflict_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { Text *text= CTX_data_edit_text(C); uiPopupMenu *pup; @@ -2742,6 +3022,7 @@ void ED_text_undo_step(bContext *C, int step) text_update_edited(text); text_update_cursor_moved(C); + text_drawcache_tag_update(CTX_wm_space_text(C), 1); WM_event_add_notifier(C, NC_TEXT|NA_EDITED, text); } diff --git a/source/blender/editors/space_text/text_python.c b/source/blender/editors/space_text/text_python.c index 9be554924c9..6e64bef4c85 100644 --- a/source/blender/editors/space_text/text_python.c +++ b/source/blender/editors/space_text/text_python.c @@ -204,7 +204,7 @@ short do_texttools(SpaceText *st, char ascii, unsigned short evnt, short val) if(tools & TOOL_SUGG_LIST) { if((ascii != '_' && ascii != '*' && ispunct(ascii)) || text_check_whitespace(ascii)) { confirm_suggestion(st->text, 0); - text_update_line_edited(st->text, st->text->curl); + text_update_line_edited(st->text->curl); } else if((st->overwrite && txt_replace_char(st->text, ascii)) || txt_add_char(st->text, ascii)) { get_suggest_prefix(st->text, 0); @@ -230,7 +230,7 @@ short do_texttools(SpaceText *st, char ascii, unsigned short evnt, short val) case MIDDLEMOUSE: if(text_do_suggest_select(st, ar)) { confirm_suggestion(st->text, 0); - text_update_line_edited(st->text, st->text->curl); + text_update_line_edited(st->text->curl); swallow= 1; } else { @@ -248,7 +248,7 @@ short do_texttools(SpaceText *st, char ascii, unsigned short evnt, short val) case RETKEY: if(tools & TOOL_SUGG_LIST) { confirm_suggestion(st->text, 0); - text_update_line_edited(st->text, st->text->curl); + text_update_line_edited(st->text->curl); swallow= 1; draw= 1; } @@ -430,11 +430,11 @@ short do_textmarkers(SpaceText *st, char ascii, unsigned short evnt, short val) if(s!=c) txt_move_to(text, mrk->lineno, mrk->start+s, 1); if(st->overwrite) { if(txt_replace_char(text, ascii)) - text_update_line_edited(st->text, st->text->curl); + text_update_line_edited(st->text->curl); } else { if(txt_add_char(text, ascii)) { - text_update_line_edited(st->text, st->text->curl); + text_update_line_edited(st->text->curl); } } @@ -459,7 +459,7 @@ short do_textmarkers(SpaceText *st, char ascii, unsigned short evnt, short val) txt_move_to(text, mrk->lineno, mrk->start+c, 0); if(s!=c) txt_move_to(text, mrk->lineno, mrk->start+s, 1); txt_backspace_char(text); - text_update_line_edited(st->text, st->text->curl); + text_update_line_edited(st->text->curl); if(mrk==marker || mrk==nxt) break; mrk= nxt; } @@ -479,7 +479,7 @@ short do_textmarkers(SpaceText *st, char ascii, unsigned short evnt, short val) txt_move_to(text, mrk->lineno, mrk->start+c, 0); if(s!=c) txt_move_to(text, mrk->lineno, mrk->start+s, 1); txt_delete_char(text); - text_update_line_edited(st->text, st->text->curl); + text_update_line_edited(st->text->curl); if(mrk==marker || mrk==nxt) break; mrk= nxt; } diff --git a/source/blender/editors/space_time/space_time.c b/source/blender/editors/space_time/space_time.c index 0d3b0514122..a03baa2fa72 100644 --- a/source/blender/editors/space_time/space_time.c +++ b/source/blender/editors/space_time/space_time.c @@ -61,11 +61,8 @@ /* ************************ main time area region *********************** */ -static void time_draw_sfra_efra(const bContext *C, SpaceTime *stime, ARegion *ar) -{ - View2D *v2d= UI_view2d_fromcontext(C); - Scene *scene= CTX_data_scene(C); - +static void time_draw_sfra_efra(Scene *scene, View2D *v2d) +{ /* draw darkened area outside of active timeline * frame range used is preview range or scene range */ UI_ThemeColorShade(TH_BACK, -25); @@ -86,7 +83,7 @@ static void time_draw_sfra_efra(const bContext *C, SpaceTime *stime, ARegion *ar #define CACHE_DRAW_HEIGHT 3.0f -static void time_draw_cache(const bContext *C, SpaceTime *stime, ARegion *ar) +static void time_draw_cache(SpaceTime *stime) { SpaceTimeCache *stc; float yoffs=0.f; @@ -162,7 +159,7 @@ static void time_cache_free(SpaceTime *stime) BLI_freelistN(&stime->caches); } -static void time_cache_refresh(const bContext *C, SpaceTime *stime, ARegion *ar) +static void time_cache_refresh(const bContext *C, SpaceTime *stime) { Object *ob = CTX_data_active_object(C); PTCacheID *pid; @@ -389,7 +386,7 @@ static void time_refresh(const bContext *C, ScrArea *sa) /* find the main timeline region and refresh cache display*/ for (ar= sa->regionbase.first; ar; ar= ar->next) { if (ar->regiontype==RGN_TYPE_WINDOW) { - time_cache_refresh(C, stime, ar); + time_cache_refresh(C, stime); break; } } @@ -457,6 +454,7 @@ static void time_main_area_init(wmWindowManager *wm, ARegion *ar) static void time_main_area_draw(const bContext *C, ARegion *ar) { /* draw entirely, view changes should be handled here */ + Scene *scene= CTX_data_scene(C); SpaceTime *stime= CTX_wm_space_time(C); View2D *v2d= &ar->v2d; View2DGrid *grid; @@ -467,15 +465,15 @@ static void time_main_area_draw(const bContext *C, ARegion *ar) UI_ThemeClearColor(TH_BACK); glClear(GL_COLOR_BUFFER_BIT); - UI_view2d_view_ortho(C, v2d); + UI_view2d_view_ortho(v2d); /* start and end frame */ - time_draw_sfra_efra(C, stime, ar); + time_draw_sfra_efra(scene, v2d); /* grid */ unit= (stime->flag & TIME_DRAWFRAMES)? V2D_UNIT_FRAMES: V2D_UNIT_SECONDS; - grid= UI_view2d_grid_calc(C, v2d, unit, V2D_GRID_CLAMP, V2D_ARG_DUMMY, V2D_ARG_DUMMY, ar->winx, ar->winy); - UI_view2d_grid_draw(C, v2d, grid, (V2D_VERTICAL_LINES|V2D_VERTICAL_AXIS)); + grid= UI_view2d_grid_calc(scene, v2d, unit, V2D_GRID_CLAMP, V2D_ARG_DUMMY, V2D_ARG_DUMMY, ar->winx, ar->winy); + UI_view2d_grid_draw(v2d, grid, (V2D_VERTICAL_LINES|V2D_VERTICAL_AXIS)); UI_view2d_grid_free(grid); /* keyframes */ @@ -488,11 +486,11 @@ static void time_main_area_draw(const bContext *C, ARegion *ar) ANIM_draw_cfra(C, v2d, flag); /* markers */ - UI_view2d_view_orthoSpecial(C, v2d, 1); + UI_view2d_view_orthoSpecial(ar, v2d, 1); draw_markers_time(C, 0); /* caches */ - time_draw_cache(C, stime, ar); + time_draw_cache(stime); /* reset view matrix */ UI_view2d_view_restore(C); @@ -533,7 +531,7 @@ static void time_main_area_listener(ARegion *ar, wmNotifier *wmn) /* ************************ header time area region *********************** */ /* add handlers, stuff you only do once or on area/region changes */ -static void time_header_area_init(wmWindowManager *wm, ARegion *ar) +static void time_header_area_init(wmWindowManager *UNUSED(wm), ARegion *ar) { ED_region_header_init(ar); } @@ -632,7 +630,7 @@ static void time_free(SpaceLink *sl) /* spacetype; init callback in ED_area_initialize() */ /* init is called to (re)initialize an existing editor (file read, screen changes) */ /* validate spacedata, add own area level handlers */ -static void time_init(wmWindowManager *wm, ScrArea *sa) +static void time_init(wmWindowManager *UNUSED(wm), ScrArea *sa) { SpaceTime *stime= (SpaceTime *)sa->spacedata.first; diff --git a/source/blender/editors/space_time/time_ops.c b/source/blender/editors/space_time/time_ops.c index fb80d54d5e6..edb3da5a06e 100644 --- a/source/blender/editors/space_time/time_ops.c +++ b/source/blender/editors/space_time/time_ops.c @@ -46,7 +46,7 @@ /* ****************** Start/End Frame Operators *******************************/ -static int time_set_sfra_exec (bContext *C, wmOperator *op) +static int time_set_sfra_exec (bContext *C, wmOperator *UNUSED(op)) { Scene *scene= CTX_data_scene(C); int frame= CFRA; @@ -86,7 +86,7 @@ void TIME_OT_start_frame_set (wmOperatorType *ot) } -static int time_set_efra_exec (bContext *C, wmOperator *op) +static int time_set_efra_exec (bContext *C, wmOperator *UNUSED(op)) { Scene *scene= CTX_data_scene(C); int frame= CFRA; @@ -127,7 +127,7 @@ void TIME_OT_end_frame_set (wmOperatorType *ot) /* ************************ View All Operator *******************************/ -static int time_view_all_exec (bContext *C, wmOperator *op) +static int time_view_all_exec (bContext *C, wmOperator *UNUSED(op)) { Scene *scene= CTX_data_scene(C); ARegion *ar= CTX_wm_region(C); diff --git a/source/blender/editors/space_userpref/space_userpref.c b/source/blender/editors/space_userpref/space_userpref.c index 8eea83a1083..a59c03ad17d 100644 --- a/source/blender/editors/space_userpref/space_userpref.c +++ b/source/blender/editors/space_userpref/space_userpref.c @@ -47,7 +47,7 @@ /* ******************** default callbacks for userpref space ***************** */ -static SpaceLink *userpref_new(const bContext *C) +static SpaceLink *userpref_new(const bContext *UNUSED(C)) { ARegion *ar; SpaceUserPref *spref; @@ -72,7 +72,7 @@ static SpaceLink *userpref_new(const bContext *C) } /* not spacelink itself */ -static void userpref_free(SpaceLink *sl) +static void userpref_free(SpaceLink *UNUSED(sl)) { // SpaceUserPref *spref= (SpaceUserPref*) sl; @@ -80,7 +80,7 @@ static void userpref_free(SpaceLink *sl) /* spacetype; init callback */ -static void userpref_init(struct wmWindowManager *wm, ScrArea *sa) +static void userpref_init(struct wmWindowManager *UNUSED(wm), ScrArea *UNUSED(sa)) { } @@ -111,13 +111,13 @@ void userpref_operatortypes(void) { } -void userpref_keymap(struct wmKeyConfig *keyconf) +void userpref_keymap(struct wmKeyConfig *UNUSED(keyconf)) { } /* add handlers, stuff you only do once or on area/region changes */ -static void userpref_header_area_init(wmWindowManager *wm, ARegion *ar) +static void userpref_header_area_init(wmWindowManager *UNUSED(wm), ARegion *ar) { ED_region_header_init(ar); } @@ -127,19 +127,20 @@ static void userpref_header_area_draw(const bContext *C, ARegion *ar) ED_region_header(C, ar); } -static void userpref_main_area_listener(ARegion *ar, wmNotifier *wmn) +static void userpref_main_area_listener(ARegion *UNUSED(ar), wmNotifier *UNUSED(wmn)) { /* context changes */ } -static void userpref_header_listener(ARegion *ar, wmNotifier *wmn) +static void userpref_header_listener(ARegion *UNUSED(ar), wmNotifier *UNUSED(wmn)) { /* context changes */ +#if 0 switch(wmn->category) { default: break; } - +#endif } /* only called once, from space/spacetypes.c */ diff --git a/source/blender/editors/space_view3d/drawanimviz.c b/source/blender/editors/space_view3d/drawanimviz.c index fb271556a9c..4cce166b36b 100644 --- a/source/blender/editors/space_view3d/drawanimviz.c +++ b/source/blender/editors/space_view3d/drawanimviz.c @@ -64,7 +64,7 @@ // - include support for editing the path verts /* Set up drawing environment for drawing motion paths */ -void draw_motion_paths_init(Scene *scene, View3D *v3d, ARegion *ar) +void draw_motion_paths_init(View3D *v3d, ARegion *ar) { RegionView3D *rv3d= ar->regiondata; @@ -79,7 +79,7 @@ void draw_motion_paths_init(Scene *scene, View3D *v3d, ARegion *ar) * i.e. draw_motion_paths_init() has been called */ // FIXME: the text is still drawn in the wrong space - it includes the current transforms of the object still... -void draw_motion_path_instance(Scene *scene, View3D *v3d, ARegion *ar, +void draw_motion_path_instance(Scene *scene, Object *ob, bPoseChannel *pchan, bAnimVizSettings *avs, bMotionPath *mpath) { //RegionView3D *rv3d= ar->regiondata; @@ -283,7 +283,7 @@ void draw_motion_path_instance(Scene *scene, View3D *v3d, ARegion *ar, } /* Clean up drawing environment after drawing motion paths */ -void draw_motion_paths_cleanup(Scene *scene, View3D *v3d, ARegion *ar) +void draw_motion_paths_cleanup(View3D *v3d) { if (v3d->zbuf) glEnable(GL_DEPTH_TEST); glPopMatrix(); diff --git a/source/blender/editors/space_view3d/drawarmature.c b/source/blender/editors/space_view3d/drawarmature.c index c6aa4656191..6cbfc2cffe4 100644 --- a/source/blender/editors/space_view3d/drawarmature.c +++ b/source/blender/editors/space_view3d/drawarmature.c @@ -140,7 +140,7 @@ static void cp_shade_color3ub (char cp[], int offset) } /* This function sets the gl-color for coloring a certain bone (based on bcolor) */ -static short set_pchan_glColor (short colCode, int armflag, int boneflag, int constflag) +static short set_pchan_glColor (short colCode, int boneflag, int constflag) { switch (colCode) { case PCHAN_COLOR_NORMAL: @@ -551,7 +551,7 @@ static void draw_bone_points(int dt, int armflag, unsigned int boneflag, int id) } else { if (armflag & ARM_POSEMODE) - set_pchan_glColor(PCHAN_COLOR_SOLID, armflag, boneflag, 0); + set_pchan_glColor(PCHAN_COLOR_SOLID, boneflag, 0); else UI_ThemeColor(TH_BONE_SOLID); } @@ -574,7 +574,7 @@ static void draw_bone_points(int dt, int armflag, unsigned int boneflag, int id) } else { if (armflag & ARM_POSEMODE) - set_pchan_glColor(PCHAN_COLOR_SOLID, armflag, boneflag, 0); + set_pchan_glColor(PCHAN_COLOR_SOLID, boneflag, 0); else UI_ThemeColor(TH_BONE_SOLID); } @@ -616,7 +616,7 @@ static float co[16] ={ /* smat, imat = mat & imat to draw screenaligned */ -static void draw_sphere_bone_dist(float smat[][4], float imat[][4], int boneflag, bPoseChannel *pchan, EditBone *ebone) +static void draw_sphere_bone_dist(float smat[][4], float imat[][4], bPoseChannel *pchan, EditBone *ebone) { float head, tail, length, dist; float *headvec, *tailvec, dirvec[3]; @@ -782,7 +782,7 @@ static void draw_sphere_bone_wire(float smat[][4], float imat[][4], int armflag, else UI_ThemeColor(TH_VERTEX); } else if (armflag & ARM_POSEMODE) - set_pchan_glColor(PCHAN_COLOR_NORMAL, armflag, boneflag, constflag); + set_pchan_glColor(PCHAN_COLOR_NORMAL, boneflag, constflag); /* Draw root point if we are not connected */ if ((boneflag & BONE_CONNECTED)==0) { @@ -903,7 +903,7 @@ static void draw_sphere_bone(int dt, int armflag, int boneflag, int constflag, u else UI_ThemeColorShade(TH_BONE_SOLID, -30); } else if (armflag & ARM_POSEMODE) - set_pchan_glColor(PCHAN_COLOR_SPHEREBONE_END, armflag, boneflag, constflag); + set_pchan_glColor(PCHAN_COLOR_SPHEREBONE_END, boneflag, constflag); else if (dt==OB_SOLID) UI_ThemeColorShade(TH_BONE_SOLID, -30); @@ -933,7 +933,7 @@ static void draw_sphere_bone(int dt, int armflag, int boneflag, int constflag, u else UI_ThemeColor(TH_BONE_SOLID); } else if (armflag & ARM_POSEMODE) - set_pchan_glColor(PCHAN_COLOR_SPHEREBONE_BASE, armflag, boneflag, constflag); + set_pchan_glColor(PCHAN_COLOR_SPHEREBONE_BASE, boneflag, constflag); else if (dt == OB_SOLID) UI_ThemeColor(TH_BONE_SOLID); @@ -1003,7 +1003,7 @@ static void draw_line_bone(int armflag, int boneflag, int constflag, unsigned in if (armflag & (ARM_EDITMODE|ARM_POSEMODE)) { glLineWidth(4.0f); if (armflag & ARM_POSEMODE) - set_pchan_glColor(PCHAN_COLOR_NORMAL, armflag, boneflag, constflag); + set_pchan_glColor(PCHAN_COLOR_NORMAL, boneflag, constflag); else if (armflag & ARM_EDITMODE) { UI_ThemeColor(TH_WIRE); } @@ -1048,7 +1048,7 @@ static void draw_line_bone(int armflag, int boneflag, int constflag, unsigned in glLoadName(id & 0xFFFF); /* object tag, for bordersel optim */ if (armflag & ARM_POSEMODE) - set_pchan_glColor(PCHAN_COLOR_LINEBONE, armflag, boneflag, constflag); + set_pchan_glColor(PCHAN_COLOR_LINEBONE, boneflag, constflag); } glLineWidth(2.0); @@ -1147,9 +1147,9 @@ static void draw_b_bone(int dt, int armflag, int boneflag, int constflag, unsign /* colors for modes */ if (armflag & ARM_POSEMODE) { if (dt <= OB_WIRE) - set_pchan_glColor(PCHAN_COLOR_NORMAL, armflag, boneflag, constflag); + set_pchan_glColor(PCHAN_COLOR_NORMAL, boneflag, constflag); else - set_pchan_glColor(PCHAN_COLOR_SOLID, armflag, boneflag, constflag); + set_pchan_glColor(PCHAN_COLOR_SOLID, boneflag, constflag); } else if (armflag & ARM_EDITMODE) { if (dt==OB_WIRE) { @@ -1171,7 +1171,7 @@ static void draw_b_bone(int dt, int armflag, int boneflag, int constflag, unsign glEnable(GL_LIGHTING); if (armflag & ARM_POSEMODE) - set_pchan_glColor(PCHAN_COLOR_SOLID, armflag, boneflag, constflag); + set_pchan_glColor(PCHAN_COLOR_SOLID, boneflag, constflag); else UI_ThemeColor(TH_BONE_SOLID); @@ -1186,7 +1186,7 @@ static void draw_b_bone(int dt, int armflag, int boneflag, int constflag, unsign if (armflag & ARM_POSEMODE) { if (constflag) { /* set constraint colors */ - if (set_pchan_glColor(PCHAN_COLOR_CONSTS, armflag, boneflag, constflag)) { + if (set_pchan_glColor(PCHAN_COLOR_CONSTS, boneflag, constflag)) { glEnable(GL_BLEND); draw_b_bone_boxes(OB_SOLID, pchan, xwidth, length, zwidth); @@ -1195,7 +1195,7 @@ static void draw_b_bone(int dt, int armflag, int boneflag, int constflag, unsign } /* restore colors */ - set_pchan_glColor(PCHAN_COLOR_NORMAL, armflag, boneflag, constflag); + set_pchan_glColor(PCHAN_COLOR_NORMAL, boneflag, constflag); } } @@ -1221,9 +1221,9 @@ static void draw_bone(int dt, int armflag, int boneflag, int constflag, unsigned /* colors for posemode */ if (armflag & ARM_POSEMODE) { if (dt <= OB_WIRE) - set_pchan_glColor(PCHAN_COLOR_NORMAL, armflag, boneflag, constflag); + set_pchan_glColor(PCHAN_COLOR_NORMAL, boneflag, constflag); else - set_pchan_glColor(PCHAN_COLOR_SOLID, armflag, boneflag, constflag); + set_pchan_glColor(PCHAN_COLOR_SOLID, boneflag, constflag); } @@ -1245,7 +1245,7 @@ static void draw_bone(int dt, int armflag, int boneflag, int constflag, unsigned else if (armflag & ARM_POSEMODE) { if (constflag) { /* draw constraint colors */ - if (set_pchan_glColor(PCHAN_COLOR_CONSTS, armflag, boneflag, constflag)) { + if (set_pchan_glColor(PCHAN_COLOR_CONSTS, boneflag, constflag)) { glEnable(GL_BLEND); draw_bone_solid_octahedral(); @@ -1254,7 +1254,7 @@ static void draw_bone(int dt, int armflag, int boneflag, int constflag, unsigned } /* restore colors */ - set_pchan_glColor(PCHAN_COLOR_NORMAL, armflag, boneflag, constflag); + set_pchan_glColor(PCHAN_COLOR_NORMAL, boneflag, constflag); } } draw_bone_octahedral(); @@ -1262,7 +1262,7 @@ static void draw_bone(int dt, int armflag, int boneflag, int constflag, unsigned else { /* solid */ if (armflag & ARM_POSEMODE) - set_pchan_glColor(PCHAN_COLOR_SOLID, armflag, boneflag, constflag); + set_pchan_glColor(PCHAN_COLOR_SOLID, boneflag, constflag); else UI_ThemeColor(TH_BONE_SOLID); draw_bone_solid_octahedral(); @@ -1283,7 +1283,7 @@ static void draw_custom_bone(Scene *scene, View3D *v3d, RegionView3D *rv3d, Obje /* colors for posemode */ if (armflag & ARM_POSEMODE) { - set_pchan_glColor(PCHAN_COLOR_NORMAL, armflag, boneflag, 0); + set_pchan_glColor(PCHAN_COLOR_NORMAL, boneflag, 0); } if (id != -1) { @@ -1565,7 +1565,7 @@ static void bone_matrix_translate_y(float mat[][4], float y) } /* assumes object is Armature with pose */ -static void draw_pose_bones(Scene *scene, View3D *v3d, ARegion *ar, Base *base, int dt) +static void draw_pose_bones(Scene *scene, View3D *v3d, ARegion *ar, Base *base, int dt, short ghost) { RegionView3D *rv3d= ar->regiondata; Object *ob= base->object; @@ -1602,7 +1602,7 @@ static void draw_pose_bones(Scene *scene, View3D *v3d, ARegion *ar, Base *base, if (bone && !(bone->flag & (BONE_HIDDEN_P|BONE_NO_DEFORM|BONE_HIDDEN_PG))) { if (bone->flag & (BONE_SELECTED)) { if (bone->layer & arm->layer) - draw_sphere_bone_dist(smat, imat, bone->flag, pchan, NULL); + draw_sphere_bone_dist(smat, imat, pchan, NULL); } } } @@ -1706,9 +1706,11 @@ static void draw_pose_bones(Scene *scene, View3D *v3d, ARegion *ar, Base *base, } /* prepare colors */ - if (arm->flag & ARM_POSEMODE) + if(ghost) { + /* 13 October 2009, Disabled this to make ghosting show the right colors (Aligorith) */ + } + else if (arm->flag & ARM_POSEMODE) set_pchan_colorset(ob, pchan); -#if 0 // XXX - 13 October 2009, Disabled this to make ghosting show the right colors (Aligorith) else { if ((scene->basact)==base) { if (base->flag & (SELECT+BA_WAS_SEL)) UI_ThemeColor(TH_ACTIVE); @@ -1719,7 +1721,6 @@ static void draw_pose_bones(Scene *scene, View3D *v3d, ARegion *ar, Base *base, else UI_ThemeColor(TH_WIRE); } } -#endif /* catch exception for bone with hidden parent */ flag= bone->flag; @@ -1901,7 +1902,7 @@ static void draw_pose_bones(Scene *scene, View3D *v3d, ARegion *ar, Base *base, bone_matrix_translate_y(bmat, pchan->bone->length); glMultMatrixf(bmat); - drawaxes(pchan->bone->length*0.25f, 0, OB_ARROWS); + drawaxes(pchan->bone->length*0.25f, OB_ARROWS); glPopMatrix(); } @@ -1957,7 +1958,7 @@ static void draw_ebones(View3D *v3d, ARegion *ar, Object *ob, int dt) if (eBone->layer & arm->layer) { if ((eBone->flag & (BONE_HIDDEN_A|BONE_NO_DEFORM))==0) { if (eBone->flag & (BONE_SELECTED|BONE_TIPSEL|BONE_ROOTSEL)) - draw_sphere_bone_dist(smat, imat, eBone->flag, NULL, eBone); + draw_sphere_bone_dist(smat, imat, NULL, eBone); } } } @@ -2094,7 +2095,7 @@ static void draw_ebones(View3D *v3d, ARegion *ar, Object *ob, int dt) bone_matrix_translate_y(bmat, eBone->length); glMultMatrixf(bmat); - drawaxes(eBone->length*0.25f, 0, OB_ARROWS); + drawaxes(eBone->length*0.25f, OB_ARROWS); glPopMatrix(); } @@ -2122,16 +2123,16 @@ static void draw_pose_paths(Scene *scene, View3D *v3d, ARegion *ar, Object *ob) bPoseChannel *pchan; /* setup drawing environment for paths */ - draw_motion_paths_init(scene, v3d, ar); + draw_motion_paths_init(v3d, ar); /* draw paths where they exist and they releated bone is visible */ for (pchan= ob->pose->chanbase.first; pchan; pchan= pchan->next) { if ((pchan->bone->layer & arm->layer) && (pchan->mpath)) - draw_motion_path_instance(scene, v3d, ar, ob, pchan, avs, pchan->mpath); + draw_motion_path_instance(scene, ob, pchan, avs, pchan->mpath); } /* cleanup after drawing */ - draw_motion_paths_cleanup(scene, v3d, ar); + draw_motion_paths_cleanup(v3d); } @@ -2211,7 +2212,7 @@ static void draw_ghost_poses_range(Scene *scene, View3D *v3d, ARegion *ar, Base BKE_animsys_evaluate_animdata(&ob->id, adt, (float)CFRA, ADT_RECALC_ALL); where_is_pose(scene, ob); - draw_pose_bones(scene, v3d, ar, base, OB_WIRE); + draw_pose_bones(scene, v3d, ar, base, OB_WIRE, TRUE); } glDisable(GL_BLEND); if (v3d->zbuf) glEnable(GL_DEPTH_TEST); @@ -2290,7 +2291,7 @@ static void draw_ghost_poses_keys(Scene *scene, View3D *v3d, ARegion *ar, Base * BKE_animsys_evaluate_animdata(&ob->id, adt, (float)CFRA, ADT_RECALC_ALL); where_is_pose(scene, ob); - draw_pose_bones(scene, v3d, ar, base, OB_WIRE); + draw_pose_bones(scene, v3d, ar, base, OB_WIRE, TRUE); } glDisable(GL_BLEND); if (v3d->zbuf) glEnable(GL_DEPTH_TEST); @@ -2360,7 +2361,7 @@ static void draw_ghost_poses(Scene *scene, View3D *v3d, ARegion *ar, Base *base) if (CFRA != cfrao) { BKE_animsys_evaluate_animdata(&ob->id, adt, (float)CFRA, ADT_RECALC_ALL); where_is_pose(scene, ob); - draw_pose_bones(scene, v3d, ar, base, OB_WIRE); + draw_pose_bones(scene, v3d, ar, base, OB_WIRE, TRUE); } } @@ -2375,7 +2376,7 @@ static void draw_ghost_poses(Scene *scene, View3D *v3d, ARegion *ar, Base *base) if (CFRA != cfrao) { BKE_animsys_evaluate_animdata(&ob->id, adt, (float)CFRA, ADT_RECALC_ALL); where_is_pose(scene, ob); - draw_pose_bones(scene, v3d, ar, base, OB_WIRE); + draw_pose_bones(scene, v3d, ar, base, OB_WIRE, TRUE); } } } @@ -2409,7 +2410,7 @@ int draw_armature(Scene *scene, View3D *v3d, ARegion *ar, Base *base, int dt, in /* we use color for solid lighting */ glColorMaterial(GL_FRONT_AND_BACK, GL_SPECULAR); glEnable(GL_COLOR_MATERIAL); - glColor3ub(0,0,0); // clear spec + glColor3ub(255,0,255); // clear spec glDisable(GL_COLOR_MATERIAL); glColorMaterial(GL_FRONT_AND_BACK, GL_DIFFUSE); @@ -2458,7 +2459,7 @@ int draw_armature(Scene *scene, View3D *v3d, ARegion *ar, Base *base, int dt, in } } } - draw_pose_bones(scene, v3d, ar, base, dt); + draw_pose_bones(scene, v3d, ar, base, dt, FALSE); arm->flag &= ~ARM_POSEMODE; if(ob->mode & OB_MODE_POSE) diff --git a/source/blender/editors/space_view3d/drawmesh.c b/source/blender/editors/space_view3d/drawmesh.c index cf511a8ad9b..0df2888f4a0 100644 --- a/source/blender/editors/space_view3d/drawmesh.c +++ b/source/blender/editors/space_view3d/drawmesh.c @@ -192,7 +192,7 @@ static int draw_tfaces3D__drawFaceOpts(void *userData, int index) return 0; } -static void draw_tfaces3D(RegionView3D *rv3d, Object *ob, Mesh *me, DerivedMesh *dm) +static void draw_tfaces3D(RegionView3D *rv3d, Mesh *me, DerivedMesh *dm) { struct { Mesh *me; EdgeHash *eh; } data; @@ -671,7 +671,7 @@ void draw_mesh_textured(Scene *scene, View3D *v3d, RegionView3D *rv3d, Object *o /* draw edges and selected faces over textured mesh */ if(!(ob == scene->obedit) && faceselect) - draw_tfaces3D(rv3d, ob, me, dm); + draw_tfaces3D(rv3d, me, dm); /* reset from negative scale correction */ glFrontFace(GL_CCW); diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c index d28813f7522..e7a69642e9f 100644 --- a/source/blender/editors/space_view3d/drawobject.c +++ b/source/blender/editors/space_view3d/drawobject.c @@ -398,8 +398,7 @@ static void draw_xyz_wire(float *c, float size, int axis) } -/* flag is same as for draw_object */ -void drawaxes(float size, int flag, char drawtype) +void drawaxes(float size, char drawtype) { int axis; float v1[3]= {0.0, 0.0, 0.0}; @@ -1212,7 +1211,7 @@ static void drawcamera(Scene *scene, View3D *v3d, RegionView3D *rv3d, Object *ob /* a standing up pyramid with (0,0,0) as top */ Camera *cam; World *wrld; - float nobmat[4][4], vec[8][4], fac, facx, facy, depth, aspx, aspy, caspx, caspy; + float nobmat[4][4], vec[8][4], fac, facx, facy, depth, aspx, aspy, caspx, caspy, shx, shy; int i; cam= ob->data; @@ -1234,6 +1233,8 @@ static void drawcamera(Scene *scene, View3D *v3d, RegionView3D *rv3d, Object *ob if(rv3d->persp>=2 && cam->type==CAM_ORTHO && ob==v3d->camera) { facx= 0.5*cam->ortho_scale*caspx; facy= 0.5*cam->ortho_scale*caspy; + shx= cam->shiftx * cam->ortho_scale; + shy= cam->shifty * cam->ortho_scale; depth= -cam->clipsta-0.1; } else { @@ -1243,13 +1244,15 @@ static void drawcamera(Scene *scene, View3D *v3d, RegionView3D *rv3d, Object *ob depth= - fac*cam->lens/16.0; facx= fac*caspx; facy= fac*caspy; + shx= cam->shiftx*fac*2; + shy= cam->shifty*fac*2; } vec[0][0]= 0.0; vec[0][1]= 0.0; vec[0][2]= 0.001; /* GLBUG: for picking at iris Entry (well thats old!) */ - vec[1][0]= facx; vec[1][1]= facy; vec[1][2]= depth; - vec[2][0]= facx; vec[2][1]= -facy; vec[2][2]= depth; - vec[3][0]= -facx; vec[3][1]= -facy; vec[3][2]= depth; - vec[4][0]= -facx; vec[4][1]= facy; vec[4][2]= depth; + vec[1][0]= shx + facx; vec[1][1]= shy + facy; vec[1][2]= depth; + vec[2][0]= shx + facx; vec[2][1]= shy - facy; vec[2][2]= depth; + vec[3][0]= shx - facx; vec[3][1]= shy - facy; vec[3][2]= depth; + vec[4][0]= shx - facx; vec[4][1]= shy + facy; vec[4][2]= depth; glBegin(GL_LINE_LOOP); glVertex3fv(vec[1]); @@ -1282,16 +1285,16 @@ static void drawcamera(Scene *scene, View3D *v3d, RegionView3D *rv3d, Object *ob if (i==0) glBegin(GL_LINE_LOOP); else if (i==1 && (ob == v3d->camera)) glBegin(GL_TRIANGLES); else break; - - vec[0][0]= -0.7 * cam->drawsize; - vec[0][1]= cam->drawsize * (caspy + 0.1); + + vec[0][0]= shx + (-0.7 * cam->drawsize); + vec[0][1]= shy + (cam->drawsize * (caspy + 0.1)); glVertex3fv(vec[0]); /* left */ - vec[0][0] *= -1.0; + vec[0][0]= shx + (0.7 * cam->drawsize); glVertex3fv(vec[0]); /* right */ - vec[0][0]= 0.0; - vec[0][1]= 1.1 * cam->drawsize * (caspy + 0.7); + vec[0][0]= shx; + vec[0][1]= shy + (1.1 * cam->drawsize * (caspy + 0.7)); glVertex3fv(vec[0]); /* top */ glEnd(); @@ -1463,7 +1466,7 @@ static void drawlattice(Scene *scene, View3D *v3d, Object *ob) * if not, ED_view3d_init_mats_rv3d() can be used for selection tools * but would not give correct results with dupli's for eg. which dont * use the object matrix in the useual way */ -static void mesh_foreachScreenVert__mapFunc(void *userData, int index, float *co, float *no_f, short *no_s) +static void mesh_foreachScreenVert__mapFunc(void *userData, int index, float *co, float *UNUSED(no_f), short *UNUSED(no_s)) { struct { void (*func)(void *userData, EditVert *eve, int x, int y, int index); void *userData; ViewContext vc; int clipVerts; } *data = userData; EditVert *eve = EM_get_vert_for_index(index); @@ -1547,7 +1550,7 @@ void mesh_foreachScreenEdge(ViewContext *vc, void (*func)(void *userData, EditEd dm->release(dm); } -static void mesh_foreachScreenFace__mapFunc(void *userData, int index, float *cent, float *no) +static void mesh_foreachScreenFace__mapFunc(void *userData, int index, float *cent, float *UNUSED(no)) { struct { void (*func)(void *userData, EditFace *efa, int x, int y, int index); void *userData; ViewContext vc; } *data = userData; EditFace *efa = EM_get_face_for_index(index); @@ -1658,7 +1661,7 @@ static void draw_dm_face_normals(Scene *scene, DerivedMesh *dm) glEnd(); } -static void draw_dm_face_centers__mapFunc(void *userData, int index, float *cent, float *no) +static void draw_dm_face_centers__mapFunc(void *userData, int index, float *cent, float *UNUSED(no)) { EditFace *efa = EM_get_face_for_index(index); int sel = *((int*) userData); @@ -1702,7 +1705,7 @@ static void draw_dm_vert_normals(Scene *scene, DerivedMesh *dm) } /* Draw verts with color set based on selection */ -static void draw_dm_verts__mapFunc(void *userData, int index, float *co, float *no_f, short *no_s) +static void draw_dm_verts__mapFunc(void *userData, int index, float *co, float *UNUSED(no_f), short *UNUSED(no_s)) { struct { int sel; EditVert *eve_act; } * data = userData; EditVert *eve = EM_get_vert_for_index(index); @@ -1779,7 +1782,7 @@ static void draw_dm_edges_sel(DerivedMesh *dm, unsigned char *baseCol, unsigned } /* Draw edges */ -static int draw_dm_edges__setDrawOptions(void *userData, int index) +static int draw_dm_edges__setDrawOptions(void *UNUSED(userData), int index) { return EM_get_edge_for_index(index)->h==0; } @@ -1789,7 +1792,7 @@ static void draw_dm_edges(DerivedMesh *dm) } /* Draw edges with color interpolated based on selection */ -static int draw_dm_edges_sel_interp__setDrawOptions(void *userData, int index) +static int draw_dm_edges_sel_interp__setDrawOptions(void *UNUSED(userData), int index) { return EM_get_edge_for_index(index)->h==0; } @@ -1814,7 +1817,7 @@ static void draw_dm_edges_sel_interp(DerivedMesh *dm, unsigned char *baseCol, un } /* Draw only seam edges */ -static int draw_dm_edges_seams__setDrawOptions(void *userData, int index) +static int draw_dm_edges_seams__setDrawOptions(void *UNUSED(userData), int index) { EditEdge *eed = EM_get_edge_for_index(index); @@ -1826,7 +1829,7 @@ static void draw_dm_edges_seams(DerivedMesh *dm) } /* Draw only sharp edges */ -static int draw_dm_edges_sharp__setDrawOptions(void *userData, int index) +static int draw_dm_edges_sharp__setDrawOptions(void *UNUSED(userData), int index) { EditEdge *eed = EM_get_edge_for_index(index); @@ -1840,7 +1843,7 @@ static void draw_dm_edges_sharp(DerivedMesh *dm) /* Draw faces with color set based on selection * return 2 for the active face so it renders with stipple enabled */ -static int draw_dm_faces_sel__setDrawOptions(void *userData, int index, int *drawSmooth_r) +static int draw_dm_faces_sel__setDrawOptions(void *userData, int index, int *UNUSED(drawSmooth_r)) { struct { unsigned char *cols[3]; EditFace *efa_act; } * data = userData; EditFace *efa = EM_get_face_for_index(index); @@ -1872,7 +1875,7 @@ static void draw_dm_faces_sel(DerivedMesh *dm, unsigned char *baseCol, unsigned dm->drawMappedFaces(dm, draw_dm_faces_sel__setDrawOptions, &data, 0, GPU_enable_material); } -static int draw_dm_creases__setDrawOptions(void *userData, int index) +static int draw_dm_creases__setDrawOptions(void *UNUSED(userData), int index) { EditEdge *eed = EM_get_edge_for_index(index); @@ -1890,7 +1893,7 @@ static void draw_dm_creases(DerivedMesh *dm) glLineWidth(1.0); } -static int draw_dm_bweights__setDrawOptions(void *userData, int index) +static int draw_dm_bweights__setDrawOptions(void *UNUSED(userData), int index) { EditEdge *eed = EM_get_edge_for_index(index); @@ -1901,7 +1904,7 @@ static int draw_dm_bweights__setDrawOptions(void *userData, int index) return 0; } } -static void draw_dm_bweights__mapFunc(void *userData, int index, float *co, float *no_f, short *no_s) +static void draw_dm_bweights__mapFunc(void *UNUSED(userData), int index, float *co, float *UNUSED(no_f), short *UNUSED(no_s)) { EditVert *eve = EM_get_vert_for_index(index); @@ -1936,7 +1939,7 @@ static void draw_dm_bweights(Scene *scene, DerivedMesh *dm) /* EditMesh drawing routines*/ -static void draw_em_fancy_verts(Scene *scene, View3D *v3d, Object *obedit, EditMesh *em, DerivedMesh *cageDM, EditVert *eve_act) +static void draw_em_fancy_verts(Scene *scene, View3D *v3d, Object *obedit, DerivedMesh *cageDM, EditVert *eve_act) { ToolSettings *ts= scene->toolsettings; int sel; @@ -2227,7 +2230,7 @@ static void draw_em_measure_stats(View3D *v3d, RegionView3D *rv3d, Object *ob, E } } -static int draw_em_fancy__setFaceOpts(void *userData, int index, int *drawSmooth_r) +static int draw_em_fancy__setFaceOpts(void *UNUSED(userData), int index, int *UNUSED(drawSmooth_r)) { EditFace *efa = EM_get_face_for_index(index); @@ -2239,7 +2242,7 @@ static int draw_em_fancy__setFaceOpts(void *userData, int index, int *drawSmooth return 0; } -static int draw_em_fancy__setGLSLFaceOpts(void *userData, int index) +static int draw_em_fancy__setGLSLFaceOpts(void *UNUSED(userData), int index) { EditFace *efa = EM_get_face_for_index(index); @@ -2385,7 +2388,7 @@ static void draw_em_fancy(Scene *scene, View3D *v3d, RegionView3D *rv3d, Object if(em) { // XXX retopo_matrix_update(v3d); - draw_em_fancy_verts(scene, v3d, ob, em, cageDM, eve_act); + draw_em_fancy_verts(scene, v3d, ob, cageDM, eve_act); if(me->drawflag & ME_DRAWNORMALS) { UI_ThemeColor(TH_NORMAL); @@ -2435,7 +2438,7 @@ static void draw_mesh_object_outline(View3D *v3d, Object *ob, DerivedMesh *dm) } } -static int wpaint__setSolidDrawOptions(void *userData, int index, int *drawSmooth_r) +static int wpaint__setSolidDrawOptions(void *UNUSED(userData), int UNUSED(index), int *drawSmooth_r) { *drawSmooth_r = 1; return 1; @@ -2520,24 +2523,25 @@ static void draw_mesh_fancy(Scene *scene, ARegion *ar, View3D *v3d, RegionView3D * rather then the shading, this is also forced in wire view */ GPU_enable_material(0, NULL); dm->drawMappedFaces(dm, wpaint__setSolidDrawOptions, me->mface, 1, GPU_enable_material); - + bglPolygonOffset(rv3d->dist, 1.0); glDepthMask(0); // disable write in zbuffer, selected edge wires show better glEnable(GL_BLEND); - glColor4ub(196, 196, 196, 196); + glColor4ub(255, 255, 255, 96); glEnable(GL_LINE_STIPPLE); - glLineStipple(1, 0x8888); + glLineStipple(1, 0xAAAA); - dm->drawEdges(dm, 1, 0); + dm->drawEdges(dm, 1, 1); bglPolygonOffset(rv3d->dist, 0.0); glDepthMask(1); glDisable(GL_LINE_STIPPLE); GPU_disable_material(); - - + + /* since we already draw wire as wp guide, dont draw over the top */ + draw_wire= 0; } else { Paint *p; @@ -4029,7 +4033,7 @@ static void draw_update_ptcache_edit(Scene *scene, Object *ob, PTCacheEdit *edit psys_cache_edit_paths(scene, ob, edit, CFRA); } -static void draw_ptcache_edit(Scene *scene, View3D *v3d, RegionView3D *rv3d, Object *ob, PTCacheEdit *edit, int dt) +static void draw_ptcache_edit(Scene *scene, View3D *v3d, PTCacheEdit *edit) { ParticleCacheKey **cache, *path, *pkey; PTCacheEditPoint *point; @@ -4823,9 +4827,9 @@ static void draw_empty_cone (float size) } /* draw points on curve speed handles */ +#if 0 // XXX old animation system stuff static void curve_draw_speed(Scene *scene, Object *ob) { -#if 0 // XXX old animation system stuff Curve *cu= ob->data; IpoCurve *icu; BezTriple *bezt; @@ -4851,8 +4855,8 @@ static void curve_draw_speed(Scene *scene, Object *ob) glPointSize(1.0); bglEnd(); -#endif // XXX old animation system stuff } +#endif // XXX old animation system stuff static void draw_textcurs(float textcurs[][2]) @@ -5648,13 +5652,13 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag) bAnimVizSettings *avs= &ob->avs; /* setup drawing environment for paths */ - draw_motion_paths_init(scene, v3d, ar); + draw_motion_paths_init(v3d, ar); /* draw motion path for object */ - draw_motion_path_instance(scene, v3d, ar, ob, NULL, avs, ob->mpath); + draw_motion_path_instance(scene, ob, NULL, avs, ob->mpath); /* cleanup after drawing */ - draw_motion_paths_cleanup(scene, v3d, ar); + draw_motion_paths_cleanup(v3d); } /* multiply view with object matrix. @@ -5878,9 +5882,9 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag) } else if(boundbox_clip(rv3d, ob->obmat, ob->bb ? ob->bb : cu->bb)) { empty_object= drawDispList(scene, v3d, rv3d, base, dt); - - if(cu->path) - curve_draw_speed(scene, ob); + +//XXX old animsys if(cu->path) +// curve_draw_speed(scene, ob); } break; case OB_MBALL: @@ -5899,7 +5903,7 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag) } case OB_EMPTY: if((v3d->flag2 & V3D_RENDER_OVERRIDE)==0) - drawaxes(ob->empty_drawsize, flag, ob->empty_drawtype); + drawaxes(ob->empty_drawsize, ob->empty_drawtype); break; case OB_LAMP: if((v3d->flag2 & V3D_RENDER_OVERRIDE)==0) { @@ -5925,7 +5929,7 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag) break; default: if((v3d->flag2 & V3D_RENDER_OVERRIDE)==0) { - drawaxes(1.0, flag, OB_ARROWS); + drawaxes(1.0, OB_ARROWS); } } @@ -5997,7 +6001,7 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag) PTCacheEdit *edit = PE_create_current(scene, ob); if(edit) { glLoadMatrixf(rv3d->viewmat); - draw_ptcache_edit(scene, v3d, rv3d, ob, edit, dt); + draw_ptcache_edit(scene, v3d, edit); glMultMatrixf(ob->obmat); } } @@ -6051,7 +6055,7 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag) // #if 0 smd->domain->tex = NULL; GPU_create_smoke(smd, 0); - draw_volume(scene, ar, v3d, base, smd->domain->tex, smd->domain->p0, smd->domain->p1, smd->domain->res, smd->domain->dx, smd->domain->tex_shadow); + draw_volume(ar, smd->domain->tex, smd->domain->p0, smd->domain->p1, smd->domain->res, smd->domain->dx, smd->domain->tex_shadow); GPU_free_smoke(smd); // #endif #if 0 @@ -6102,7 +6106,7 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag) { smd->domain->tex = NULL; GPU_create_smoke(smd, 1); - draw_volume(scene, ar, v3d, base, smd->domain->tex, smd->domain->p0, smd->domain->p1, smd->domain->res_wt, smd->domain->dx_wt, smd->domain->tex_shadow); + draw_volume(ar, smd->domain->tex, smd->domain->p0, smd->domain->p1, smd->domain->res_wt, smd->domain->dx_wt, smd->domain->tex_shadow); GPU_free_smoke(smd); } } @@ -6125,7 +6129,7 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag) if(dtx && (G.f & G_RENDER_OGL)==0) { if(dtx & OB_AXIS) { - drawaxes(1.0f, flag, OB_ARROWS); + drawaxes(1.0f, OB_ARROWS); } if(dtx & OB_BOUNDBOX) { if((v3d->flag2 & V3D_RENDER_OVERRIDE)==0) @@ -6265,7 +6269,7 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag) /* ***************** BACKBUF SEL (BBS) ********* */ -static void bbs_mesh_verts__mapFunc(void *userData, int index, float *co, float *no_f, short *no_s) +static void bbs_mesh_verts__mapFunc(void *userData, int index, float *co, float *UNUSED(no_f), short *UNUSED(no_s)) { int offset = (intptr_t) userData; EditVert *eve = EM_get_vert_for_index(index); @@ -6301,7 +6305,7 @@ static void bbs_mesh_wire(DerivedMesh *dm, int offset) dm->drawMappedEdges(dm, bbs_mesh_wire__setDrawOptions, (void*)(intptr_t) offset); } -static int bbs_mesh_solid__setSolidDrawOptions(void *userData, int index, int *drawSmooth_r) +static int bbs_mesh_solid__setSolidDrawOptions(void *userData, int index, int *UNUSED(drawSmooth_r)) { if (EM_get_face_for_index(index)->h==0) { if (userData) { @@ -6313,7 +6317,7 @@ static int bbs_mesh_solid__setSolidDrawOptions(void *userData, int index, int *d } } -static void bbs_mesh_solid__drawCenter(void *userData, int index, float *cent, float *no) +static void bbs_mesh_solid__drawCenter(void *UNUSED(userData), int index, float *cent, float *UNUSED(no)) { EditFace *efa = EM_get_face_for_index(index); @@ -6345,13 +6349,13 @@ static void bbs_mesh_solid_EM(Scene *scene, View3D *v3d, Object *ob, DerivedMesh } } -static int bbs_mesh_solid__setDrawOpts(void *userData, int index, int *drawSmooth_r) +static int bbs_mesh_solid__setDrawOpts(void *UNUSED(userData), int index, int *UNUSED(drawSmooth_r)) { WM_set_framebuffer_index_color(index+1); return 1; } -static int bbs_mesh_solid_hide__setDrawOpts(void *userData, int index, int *drawSmooth_r) +static int bbs_mesh_solid_hide__setDrawOpts(void *userData, int index, int *UNUSED(drawSmooth_r)) { Mesh *me = userData; @@ -6498,7 +6502,7 @@ void draw_object_instance(Scene *scene, View3D *v3d, RegionView3D *rv3d, Object draw_object_mesh_instance(scene, v3d, rv3d, ob, dt, outline); break; case OB_EMPTY: - drawaxes(ob->empty_drawsize, 0, ob->empty_drawtype); + drawaxes(ob->empty_drawsize, ob->empty_drawtype); break; } } diff --git a/source/blender/editors/space_view3d/drawvolume.c b/source/blender/editors/space_view3d/drawvolume.c index 678920f8173..611cf68d81c 100644 --- a/source/blender/editors/space_view3d/drawvolume.c +++ b/source/blender/editors/space_view3d/drawvolume.c @@ -175,7 +175,7 @@ static int larger_pow2(int n) return n*2; } -void draw_volume(Scene *scene, ARegion *ar, View3D *v3d, Base *base, GPUTexture *tex, float *min, float *max, int res[3], float dx, GPUTexture *tex_shadow) +void draw_volume(ARegion *ar, GPUTexture *tex, float *min, float *max, int res[3], float dx, GPUTexture *tex_shadow) { RegionView3D *rv3d= ar->regiondata; diff --git a/source/blender/editors/space_view3d/space_view3d.c b/source/blender/editors/space_view3d/space_view3d.c index 8a215834c38..6261ca52564 100644 --- a/source/blender/editors/space_view3d/space_view3d.c +++ b/source/blender/editors/space_view3d/space_view3d.c @@ -274,7 +274,7 @@ static void view3d_free(SpaceLink *sl) /* spacetype; init callback */ -static void view3d_init(struct wmWindowManager *wm, ScrArea *sa) +static void view3d_init(struct wmWindowManager *UNUSED(wm), ScrArea *UNUSED(sa)) { } @@ -387,7 +387,7 @@ static void view3d_main_area_init(wmWindowManager *wm, ARegion *ar) } -static int view3d_ob_drop_poll(bContext *C, wmDrag *drag, wmEvent *event) +static int view3d_ob_drop_poll(bContext *UNUSED(C), wmDrag *drag, wmEvent *UNUSED(event)) { if(drag->type==WM_DRAG_ID) { ID *id= (ID *)drag->poin; @@ -397,7 +397,7 @@ static int view3d_ob_drop_poll(bContext *C, wmDrag *drag, wmEvent *event) return 0; } -static int view3d_mat_drop_poll(bContext *C, wmDrag *drag, wmEvent *event) +static int view3d_mat_drop_poll(bContext *UNUSED(C), wmDrag *drag, wmEvent *UNUSED(event)) { if(drag->type==WM_DRAG_ID) { ID *id= (ID *)drag->poin; @@ -407,7 +407,7 @@ static int view3d_mat_drop_poll(bContext *C, wmDrag *drag, wmEvent *event) return 0; } -static int view3d_ima_drop_poll(bContext *C, wmDrag *drag, wmEvent *event) +static int view3d_ima_drop_poll(bContext *UNUSED(C), wmDrag *drag, wmEvent *UNUSED(event)) { if(drag->type==WM_DRAG_ID) { ID *id= (ID *)drag->poin; @@ -548,22 +548,36 @@ static void view3d_recalc_used_layers(ARegion *ar, wmNotifier *wmn, Scene *scene base= base->next; } - sa= win->screen->areabase.first; - while(sa) { - if(sa->spacetype == SPACE_VIEW3D) - if(BLI_findindex(&sa->regionbase, ar) >= 0) { + for(sa= win->screen->areabase.first; sa; sa= sa->next) { + if(sa->spacetype == SPACE_VIEW3D) { + if(BLI_findindex(&sa->regionbase, ar) != -1) { View3D *v3d= sa->spacedata.first; v3d->lay_used= lay_used; break; } + } + } +} - sa= sa->next; +static View3D *view3d_from_wmn(ARegion *ar, wmNotifier *wmn) +{ + wmWindow *win= wmn->wm->winactive; + ScrArea *sa; + + for(sa= win->screen->areabase.first; sa; sa= sa->next) { + if(sa->spacetype == SPACE_VIEW3D) + if(BLI_findindex(&sa->regionbase, ar) != -1) { + return (View3D *)sa->spacedata.first; + } } + + return NULL; } static void view3d_main_area_listener(ARegion *ar, wmNotifier *wmn) { bScreen *sc; + View3D *v3d; /* context changes */ switch(wmn->category) { @@ -600,6 +614,11 @@ static void view3d_main_area_listener(ARegion *ar, wmNotifier *wmn) case ND_MODE: ED_region_tag_redraw(ar); break; + case ND_WORLD: + v3d= view3d_from_wmn(ar, wmn); + if(v3d->flag2 & V3D_RENDER_OVERRIDE) + ED_region_tag_redraw(ar); + break; } if (wmn->action == NA_EDITED) ED_region_tag_redraw(ar); @@ -650,7 +669,9 @@ static void view3d_main_area_listener(ARegion *ar, wmNotifier *wmn) case NC_WORLD: switch(wmn->data) { case ND_WORLD_DRAW: - ED_region_tag_redraw(ar); + v3d= view3d_from_wmn(ar, wmn); + if(v3d->flag2 & V3D_RENDER_OVERRIDE) + ED_region_tag_redraw(ar); break; } break; @@ -705,7 +726,7 @@ static void view3d_main_area_listener(ARegion *ar, wmNotifier *wmn) } /* concept is to retrieve cursor type context-less */ -static void view3d_main_area_cursor(wmWindow *win, ScrArea *sa, ARegion *ar) +static void view3d_main_area_cursor(wmWindow *win, ScrArea *UNUSED(sa), ARegion *UNUSED(ar)) { Scene *scene= win->screen->scene; diff --git a/source/blender/editors/space_view3d/view3d_buttons.c b/source/blender/editors/space_view3d/view3d_buttons.c index a0167c87d87..450b3725bdb 100644 --- a/source/blender/editors/space_view3d/view3d_buttons.c +++ b/source/blender/editors/space_view3d/view3d_buttons.c @@ -128,7 +128,7 @@ typedef struct { /* is used for both read and write... */ -static void v3d_editvertex_buts(const bContext *C, uiLayout *layout, View3D *v3d, Object *ob, float lim) +static void v3d_editvertex_buts(uiLayout *layout, View3D *v3d, Object *ob, float lim) { uiBlock *block= (layout)? uiLayoutAbsoluteBlock(layout): NULL; MDeformVert *dvert=NULL; @@ -643,7 +643,7 @@ static void vgroup_normalize_active(Object *ob) } -static void do_view3d_vgroup_buttons(bContext *C, void *arg, int event) +static void do_view3d_vgroup_buttons(bContext *C, void *UNUSED(arg), int event) { Scene *scene= CTX_data_scene(C); Object *ob= OBACT; @@ -670,7 +670,7 @@ static void do_view3d_vgroup_buttons(bContext *C, void *arg, int event) WM_event_add_notifier(C, NC_GEOM|ND_DATA, ob->data); } -int view3d_panel_vgroup_poll(const bContext *C, PanelType *pt) +int view3d_panel_vgroup_poll(const bContext *C, PanelType *UNUSED(pt)) { Scene *scene= CTX_data_scene(C); Object *ob= OBACT; @@ -794,7 +794,7 @@ static void v3d_transform_butsR(uiLayout *layout, PointerRNA *ptr) } } -static void v3d_posearmature_buts(uiLayout *layout, View3D *v3d, Object *ob, float lim) +static void v3d_posearmature_buts(uiLayout *layout, Object *ob) { // uiBlock *block= uiLayoutGetBlock(layout); // bArmature *arm; @@ -896,7 +896,7 @@ void validate_editbonebutton_cb(bContext *C, void *bonev, void *namev) WM_event_add_notifier(C, NC_OBJECT|ND_BONE_SELECT, CTX_data_edit_object(C)); // XXX fix } -static void v3d_editarmature_buts(uiLayout *layout, View3D *v3d, Object *ob, float lim) +static void v3d_editarmature_buts(uiLayout *layout, Object *ob) { // uiBlock *block= uiLayoutGetBlock(layout); bArmature *arm= ob->data; @@ -930,7 +930,7 @@ static void v3d_editarmature_buts(uiLayout *layout, View3D *v3d, Object *ob, flo uiItemR(col, &eboneptr, "roll", 0, "Roll", 0); } -static void v3d_editmetaball_buts(uiLayout *layout, Object *ob, float lim) +static void v3d_editmetaball_buts(uiLayout *layout, Object *ob) { PointerRNA mbptr, ptr; MetaBall *mball= ob->data; @@ -989,7 +989,7 @@ static int test_parent_loop(Object *par, Object *ob) return test_parent_loop(par->parent, ob); } -static void do_view3d_region_buttons(bContext *C, void *arg, int event) +static void do_view3d_region_buttons(bContext *C, void *UNUSED(index), int event) { Main *bmain= CTX_data_main(C); Scene *scene= CTX_data_scene(C); @@ -1012,7 +1012,7 @@ static void do_view3d_region_buttons(bContext *C, void *arg, int event) case B_OBJECTPANELMEDIAN: if(ob) { - v3d_editvertex_buts(C, NULL, v3d, ob, 1.0); + v3d_editvertex_buts(NULL, v3d, ob, 1.0); DAG_id_flush_update(&ob->id, OB_RECALC_DATA); } break; @@ -1152,12 +1152,12 @@ static void do_view3d_region_buttons(bContext *C, void *arg, int event) WM_event_add_notifier(C, NC_SPACE|ND_SPACE_VIEW3D, ob); } -void removeTransformOrientation_func(bContext *C, void *target, void *unused) +void removeTransformOrientation_func(bContext *C, void *target, void *UNUSED(arg)) { BIF_removeTransformOrientation(C, (TransformOrientation *) target); } -void selectTransformOrientation_func(bContext *C, void *target, void *unused) +void selectTransformOrientation_func(bContext *C, void *target, void *UNUSED(arg)) { BIF_selectTransformOrientation(C, (TransformOrientation *) target); } @@ -1203,12 +1203,12 @@ static void view3d_panel_object(const bContext *C, Panel *pa) RNA_id_pointer_create(&ob->id, &obptr); if(ob==obedit) { - if(ob->type==OB_ARMATURE) v3d_editarmature_buts(col, v3d, ob, lim); - if(ob->type==OB_MBALL) v3d_editmetaball_buts(col, ob, lim); - else v3d_editvertex_buts(C, col, v3d, ob, lim); + if(ob->type==OB_ARMATURE) v3d_editarmature_buts(col, ob); + if(ob->type==OB_MBALL) v3d_editmetaball_buts(col, ob); + else v3d_editvertex_buts(col, v3d, ob, lim); } else if(ob->mode & OB_MODE_POSE) { - v3d_posearmature_buts(col, v3d, ob, lim); + v3d_posearmature_buts(col, ob); } else { @@ -1421,7 +1421,7 @@ static void view3d_panel_operator_redo(const bContext *C, Panel *pa) } RNA_pointer_create(&wm->id, op->type->srna, op->properties, &ptr); - uiDefAutoButsRNA(C, pa->layout, &ptr, 2); + uiDefAutoButsRNA(pa->layout, &ptr, 2); } #endif // XXX not used @@ -1451,7 +1451,7 @@ void view3d_buttons_register(ARegionType *art) // XXX view3d_panel_preview(C, ar, 0); } -static int view3d_properties(bContext *C, wmOperator *op) +static int view3d_properties(bContext *C, wmOperator *UNUSED(op)) { ScrArea *sa= CTX_wm_area(C); ARegion *ar= view3d_has_buttons_region(sa); diff --git a/source/blender/editors/space_view3d/view3d_draw.c b/source/blender/editors/space_view3d/view3d_draw.c index 24f71b8b1df..67c2a4f1c56 100644 --- a/source/blender/editors/space_view3d/view3d_draw.c +++ b/source/blender/editors/space_view3d/view3d_draw.c @@ -1140,7 +1140,7 @@ ImBuf *view3d_read_backbuf(ViewContext *vc, short xmin, short ymin, short xmax, if(ymax >= vc->ar->winy) ymaxc= vc->ar->winy-1; else ymaxc= ymax; if(yminc > ymaxc) return NULL; - ibuf= IMB_allocImBuf((xmaxc-xminc+1), (ymaxc-yminc+1), 32, IB_rect,0); + ibuf= IMB_allocImBuf((xmaxc-xminc+1), (ymaxc-yminc+1), 32, IB_rect); view3d_validate_backbuf(vc); @@ -1160,7 +1160,7 @@ ImBuf *view3d_read_backbuf(ViewContext *vc, short xmin, short ymin, short xmax, if(xminc==xmin && xmaxc==xmax && yminc==ymin && ymaxc==ymax) return ibuf; - ibuf1= IMB_allocImBuf( (xmax-xmin+1),(ymax-ymin+1),32,IB_rect,0); + ibuf1= IMB_allocImBuf( (xmax-xmin+1),(ymax-ymin+1),32,IB_rect); rd= ibuf->rect; dr= ibuf1->rect; @@ -1589,7 +1589,7 @@ static void draw_dupli_objects(Scene *scene, ARegion *ar, View3D *v3d, Base *bas } -void view3d_update_depths(ARegion *ar, View3D *v3d) +void view3d_update_depths(ARegion *ar) { RegionView3D *rv3d= ar->regiondata; @@ -2092,7 +2092,7 @@ ImBuf *ED_view3d_draw_offscreen_imbuf(Scene *scene, View3D *v3d, ARegion *ar, in } /* read in pixels & stamp */ - ibuf= IMB_allocImBuf(sizex, sizey, 32, flag, 0); + ibuf= IMB_allocImBuf(sizex, sizey, 32, flag); if(ibuf->rect_float) glReadPixels(0, 0, sizex, sizey, GL_RGBA, GL_FLOAT, ibuf->rect_float); @@ -2354,7 +2354,7 @@ void view3d_main_area_draw(const bContext *C, ARegion *ar) // retopo= retopo_mesh_check() || retopo_curve_check(); sculptparticle= (obact && obact->mode & (OB_MODE_PARTICLE_EDIT)) && !scene->obedit; if(retopo) - view3d_update_depths(ar, v3d); + view3d_update_depths(ar); /* draw selected and editmode */ for(base= scene->base.first; base; base= base->next) { @@ -2365,7 +2365,7 @@ void view3d_main_area_draw(const bContext *C, ARegion *ar) } if(!retopo && sculptparticle && !(obact && (obact->dtx & OB_DRAWXRAY))) { - view3d_update_depths(ar, v3d); + view3d_update_depths(ar); } // REEB_draw(); @@ -2378,7 +2378,7 @@ void view3d_main_area_draw(const bContext *C, ARegion *ar) ED_region_draw_cb_draw(C, ar, REGION_DRAW_POST_VIEW); if(!retopo && sculptparticle && (obact && (OBACT->dtx & OB_DRAWXRAY))) { - view3d_update_depths(ar, v3d); + view3d_update_depths(ar); } if(rv3d->rflag & RV3D_CLIPPING) diff --git a/source/blender/editors/space_view3d/view3d_edit.c b/source/blender/editors/space_view3d/view3d_edit.c index 9f1b55ee2ce..dc75efcc5ca 100644 --- a/source/blender/editors/space_view3d/view3d_edit.c +++ b/source/blender/editors/space_view3d/view3d_edit.c @@ -1374,7 +1374,7 @@ void VIEW3D_OT_view_all(wmOperatorType *ot) } -static int viewselected_exec(bContext *C, wmOperator *op) /* like a localview without local!, was centerview() in 2.4x */ +static int viewselected_exec(bContext *C, wmOperator *UNUSED(op)) /* like a localview without local!, was centerview() in 2.4x */ { ARegion *ar= CTX_wm_region(C); View3D *v3d = CTX_wm_view3d(C); @@ -1514,7 +1514,7 @@ void VIEW3D_OT_view_selected(wmOperatorType *ot) ot->flag= 0; } -static int viewcenter_cursor_exec(bContext *C, wmOperator *op) +static int viewcenter_cursor_exec(bContext *C, wmOperator *UNUSED(op)) { View3D *v3d = CTX_wm_view3d(C); RegionView3D *rv3d= CTX_wm_region_view3d(C); @@ -1548,7 +1548,7 @@ void VIEW3D_OT_view_center_cursor(wmOperatorType *ot) ot->flag= 0; } -static int view3d_center_camera_exec(bContext *C, wmOperator *op) /* was view3d_home() in 2.4x */ +static int view3d_center_camera_exec(bContext *C, wmOperator *UNUSED(op)) /* was view3d_home() in 2.4x */ { RegionView3D *rv3d= CTX_wm_region_view3d(C); @@ -1691,7 +1691,7 @@ static int view3d_zoom_border_exec(bContext *C, wmOperator *op) rv3d->depths->damaged = 1; } - view3d_update_depths(ar, v3d); + view3d_update_depths(ar); /* Constrain rect to depth bounds */ if (rect.xmin < 0) rect.xmin = 0; @@ -2151,7 +2151,7 @@ void VIEW3D_OT_view_pan(wmOperatorType *ot) RNA_def_enum(ot->srna, "type", prop_view_pan_items, 0, "Pan", "Direction of View Pan"); } -static int viewpersportho_exec(bContext *C, wmOperator *op) +static int viewpersportho_exec(bContext *C, wmOperator *UNUSED(op)) { ARegion *ar= CTX_wm_region(C); RegionView3D *rv3d= CTX_wm_region_view3d(C); @@ -2200,16 +2200,15 @@ static BGpic *add_background_image(bContext *C) return bgpic; } -static int add_background_image_exec(bContext *C, wmOperator *op) +static int add_background_image_exec(bContext *C, wmOperator *UNUSED(op)) { add_background_image(C); return OPERATOR_FINISHED; } -static int add_background_image_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int add_background_image_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { - Scene *scene= CTX_data_scene(C); View3D *v3d= CTX_wm_view3d(C); Image *ima= NULL; BGpic *bgpic; @@ -2220,7 +2219,7 @@ static int add_background_image_invoke(bContext *C, wmOperator *op, wmEvent *eve char path[FILE_MAX]; RNA_string_get(op->ptr, "filepath", path); - ima= BKE_add_image_file(path, scene ? scene->r.cfra : 1); + ima= BKE_add_image_file(path); } else if(RNA_property_is_set(op->ptr, "name")) { RNA_string_get(op->ptr, "name", name); @@ -2410,7 +2409,7 @@ void VIEW3D_OT_clip_border(wmOperatorType *ot) /* ***************** 3d cursor cursor op ******************* */ /* mx my in region coords */ -static int set_3dcursor_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int set_3dcursor_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent *event) { Scene *scene= CTX_data_scene(C); ARegion *ar= CTX_wm_region(C); @@ -2535,7 +2534,7 @@ void VIEW3D_OT_manipulator(wmOperatorType *ot) Transform_Properties(ot, P_CONSTRAINT); } -static int enable_manipulator_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int enable_manipulator_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { View3D *v3d = CTX_wm_view3d(C); @@ -2644,7 +2643,7 @@ int view_autodist(Scene *scene, ARegion *ar, View3D *v3d, short *mval, float mou rv3d->depths->damaged = 1; } - view3d_update_depths(ar, v3d); + view3d_update_depths(ar); depth_close= view_autodist_depth_margin(ar, mval, 4); @@ -2688,7 +2687,7 @@ int view_autodist_init(Scene *scene, ARegion *ar, View3D *v3d, int mode) //, flo rv3d->depths->damaged = 1; } - view3d_update_depths(ar, v3d); + view3d_update_depths(ar); return 1; } @@ -2785,7 +2784,7 @@ void filterNDOFvalues(float *sbval) int dz_flag = 0; float m_dist; -void viewmoveNDOFfly(ARegion *ar, View3D *v3d, int mode) +void viewmoveNDOFfly(ARegion *ar, View3D *v3d, int UNUSED(mode)) { RegionView3D *rv3d= ar->regiondata; int i; @@ -2914,7 +2913,7 @@ void viewmoveNDOFfly(ARegion *ar, View3D *v3d, int mode) // XXX BIF_view3d_previewrender_signal(ar, PR_DBASE|PR_DISPRECT); } -void viewmoveNDOF(Scene *scene, ARegion *ar, View3D *v3d, int mode) +void viewmoveNDOF(Scene *scene, ARegion *ar, View3D *v3d, int UNUSED(mode)) { RegionView3D *rv3d= ar->regiondata; float fval[7]; diff --git a/source/blender/editors/space_view3d/view3d_header.c b/source/blender/editors/space_view3d/view3d_header.c index d7ab8034286..5ca8843b658 100644 --- a/source/blender/editors/space_view3d/view3d_header.c +++ b/source/blender/editors/space_view3d/view3d_header.c @@ -304,7 +304,7 @@ static char *view3d_modeselect_pup(Scene *scene) } -static void do_view3d_header_buttons(bContext *C, void *arg, int event) +static void do_view3d_header_buttons(bContext *C, void *UNUSED(arg), int event) { wmWindow *win= CTX_wm_window(C); ToolSettings *ts= CTX_data_tool_settings(C); diff --git a/source/blender/editors/space_view3d/view3d_intern.h b/source/blender/editors/space_view3d/view3d_intern.h index 4065b159ccf..9d1f5a77a3f 100644 --- a/source/blender/editors/space_view3d/view3d_intern.h +++ b/source/blender/editors/space_view3d/view3d_intern.h @@ -93,11 +93,11 @@ void VIEW3D_OT_drawtype(struct wmOperatorType *ot); void view3d_boxview_copy(ScrArea *sa, ARegion *ar); /* drawanim.c */ -void draw_motion_paths_init(Scene *scene, View3D *v3d, struct ARegion *ar); -void draw_motion_path_instance(Scene *scene, View3D *v3d, struct ARegion *ar, +void draw_motion_paths_init(View3D *v3d, struct ARegion *ar); +void draw_motion_path_instance(Scene *scene, struct Object *ob, struct bPoseChannel *pchan, struct bAnimVizSettings *avs, struct bMotionPath *mpath); -void draw_motion_paths_cleanup(Scene *scene, View3D *v3d, struct ARegion *ar); +void draw_motion_paths_cleanup(View3D *v3d); @@ -106,7 +106,7 @@ void draw_object(Scene *scene, struct ARegion *ar, View3D *v3d, Base *base, int int draw_glsl_material(Scene *scene, struct Object *ob, View3D *v3d, int dt); void draw_object_instance(Scene *scene, View3D *v3d, RegionView3D *rv3d, struct Object *ob, int dt, int outline); void draw_object_backbufsel(Scene *scene, View3D *v3d, RegionView3D *rv3d, struct Object *ob); -void drawaxes(float size, int flag, char drawtype); +void drawaxes(float size, char drawtype); void view3d_cached_text_draw_begin(void); void view3d_cached_text_draw_add(float x, float y, float z, char *str, short xoffs, short flag); @@ -130,7 +130,7 @@ void add_view3d_after(ListBase *lb, Base *base, int flag); void circf(float x, float y, float rad); void circ(float x, float y, float rad); -void view3d_update_depths(struct ARegion *ar, View3D *v3d); +void view3d_update_depths(struct ARegion *ar); /* view3d_select.c */ void VIEW3D_OT_select(struct wmOperatorType *ot); @@ -189,7 +189,7 @@ ARegion *view3d_has_buttons_region(ScrArea *sa); ARegion *view3d_has_tools_region(ScrArea *sa); /* draw_volume.c */ -void draw_volume(struct Scene *scene, struct ARegion *ar, struct View3D *v3d, struct Base *base, struct GPUTexture *tex, float *min, float *max, int res[3], float dx, struct GPUTexture *tex_shadow); +void draw_volume(struct ARegion *ar, struct GPUTexture *tex, float *min, float *max, int res[3], float dx, struct GPUTexture *tex_shadow); #endif /* ED_VIEW3D_INTERN_H */ diff --git a/source/blender/editors/space_view3d/view3d_select.c b/source/blender/editors/space_view3d/view3d_select.c index 7e6e8e0e6af..e3212e8a3d1 100644 --- a/source/blender/editors/space_view3d/view3d_select.c +++ b/source/blender/editors/space_view3d/view3d_select.c @@ -189,9 +189,9 @@ void EM_backbuf_checkAndSelectTFaces(Mesh *me, int select) } } +#if 0 void arrows_move_cursor(unsigned short event) { -#if 0 short mval[2]; getmouseco_sc(mval); @@ -205,8 +205,8 @@ void arrows_move_cursor(unsigned short event) } else if(event==RIGHTARROWKEY) { warp_pointer(mval[0]+1, mval[1]); } -#endif } +#endif /* *********************** GESTURE AND LASSO ******************* */ @@ -404,7 +404,7 @@ void lasso_select_boundbox(rcti *rect, short mcords[][2], short moves) } } -static void do_lasso_select_mesh__doSelectVert(void *userData, EditVert *eve, int x, int y, int index) +static void do_lasso_select_mesh__doSelectVert(void *userData, EditVert *eve, int x, int y, int UNUSED(index)) { struct { ViewContext vc; rcti *rect; short (*mcords)[2], moves, select, pass, done; } *data = userData; @@ -431,7 +431,7 @@ static void do_lasso_select_mesh__doSelectEdge(void *userData, EditEdge *eed, in } } } -static void do_lasso_select_mesh__doSelectFace(void *userData, EditFace *efa, int x, int y, int index) +static void do_lasso_select_mesh__doSelectFace(void *userData, EditFace *efa, int x, int y, int UNUSED(index)) { struct { ViewContext vc; rcti *rect; short (*mcords)[2], moves, select, pass, done; } *data = userData; @@ -560,7 +560,7 @@ static void do_lasso_select_mesh_uv(short mcords[][2], short moves, short select } #endif -static void do_lasso_select_curve__doSelect(void *userData, Nurb *nu, BPoint *bp, BezTriple *bezt, int beztindex, int x, int y) +static void do_lasso_select_curve__doSelect(void *userData, Nurb *UNUSED(nu), BPoint *bp, BezTriple *bezt, int beztindex, int x, int y) { struct { ViewContext *vc; short (*mcords)[2]; short moves; short select; } *data = userData; Object *obedit= data->vc->obedit; @@ -1291,7 +1291,7 @@ int edge_inside_circle(short centx, short centy, short rad, short x1, short y1, return 0; } -static void do_nurbs_box_select__doSelect(void *userData, Nurb *nu, BPoint *bp, BezTriple *bezt, int beztindex, int x, int y) +static void do_nurbs_box_select__doSelect(void *userData, Nurb *UNUSED(nu), BPoint *bp, BezTriple *bezt, int beztindex, int x, int y) { struct { ViewContext *vc; rcti *rect; int select; } *data = userData; Object *obedit= data->vc->obedit; @@ -1359,7 +1359,7 @@ static void do_lattice_box_select(ViewContext *vc, rcti *rect, int select, int e lattice_foreachScreenVert(vc, do_lattice_box_select__doSelect, &data); } -static void do_mesh_box_select__doSelectVert(void *userData, EditVert *eve, int x, int y, int index) +static void do_mesh_box_select__doSelectVert(void *userData, EditVert *eve, int x, int y, int UNUSED(index)) { struct { ViewContext vc; rcti *rect; short select, pass, done; } *data = userData; @@ -1384,7 +1384,7 @@ static void do_mesh_box_select__doSelectEdge(void *userData, EditEdge *eed, int } } } -static void do_mesh_box_select__doSelectFace(void *userData, EditFace *efa, int x, int y, int index) +static void do_mesh_box_select__doSelectFace(void *userData, EditFace *efa, int x, int y, int UNUSED(index)) { struct { ViewContext vc; rcti *rect; short select, pass, done; } *data = userData; @@ -1800,7 +1800,7 @@ void VIEW3D_OT_select(wmOperatorType *ot) /* -------------------- circle select --------------------------------------------- */ -static void mesh_circle_doSelectVert(void *userData, EditVert *eve, int x, int y, int index) +static void mesh_circle_doSelectVert(void *userData, EditVert *eve, int x, int y, int UNUSED(index)) { struct {ViewContext *vc; short select, mval[2]; float radius; } *data = userData; int mx = x - data->mval[0], my = y - data->mval[1]; @@ -1810,7 +1810,7 @@ static void mesh_circle_doSelectVert(void *userData, EditVert *eve, int x, int y eve->f = data->select?(eve->f|1):(eve->f&~1); } } -static void mesh_circle_doSelectEdge(void *userData, EditEdge *eed, int x0, int y0, int x1, int y1, int index) +static void mesh_circle_doSelectEdge(void *userData, EditEdge *eed, int x0, int y0, int x1, int y1, int UNUSED(index)) { struct {ViewContext *vc; short select, mval[2]; float radius; } *data = userData; @@ -1818,7 +1818,7 @@ static void mesh_circle_doSelectEdge(void *userData, EditEdge *eed, int x0, int EM_select_edge(eed, data->select); } } -static void mesh_circle_doSelectFace(void *userData, EditFace *efa, int x, int y, int index) +static void mesh_circle_doSelectFace(void *userData, EditFace *efa, int x, int y, int UNUSED(index)) { struct {ViewContext *vc; short select, mval[2]; float radius; } *data = userData; int mx = x - data->mval[0], my = y - data->mval[1]; @@ -1892,7 +1892,7 @@ static void paint_facesel_circle_select(ViewContext *vc, int selecting, short *m } -static void nurbscurve_circle_doSelect(void *userData, Nurb *nu, BPoint *bp, BezTriple *bezt, int beztindex, int x, int y) +static void nurbscurve_circle_doSelect(void *userData, Nurb *UNUSED(nu), BPoint *bp, BezTriple *bezt, int beztindex, int x, int y) { struct {ViewContext *vc; short select, mval[2]; float radius; } *data = userData; int mx = x - data->mval[0], my = y - data->mval[1]; diff --git a/source/blender/editors/space_view3d/view3d_snap.c b/source/blender/editors/space_view3d/view3d_snap.c index 7f5f7665028..d6778070931 100644 --- a/source/blender/editors/space_view3d/view3d_snap.c +++ b/source/blender/editors/space_view3d/view3d_snap.c @@ -82,7 +82,7 @@ static TransVert *transvmain=NULL; static int tottrans= 0; /* copied from editobject.c, now uses (almost) proper depgraph */ -static void special_transvert_update(Scene *scene, Object *obedit) +static void special_transvert_update(Object *obedit) { if(obedit) { @@ -443,7 +443,7 @@ static void make_trans_verts(Object *obedit, float *min, float *max, int mode) /* *********************** operators ******************** */ -static int snap_sel_to_grid(bContext *C, wmOperator *op) +static int snap_sel_to_grid(bContext *C, wmOperator *UNUSED(op)) { extern float originmat[3][3]; /* XXX object.c */ Main *bmain= CTX_data_main(C); @@ -481,7 +481,7 @@ static int snap_sel_to_grid(bContext *C, wmOperator *op) VECCOPY(tv->loc, vec); } - special_transvert_update(scene, obedit); + special_transvert_update(obedit); MEM_freeN(transvmain); transvmain= NULL; @@ -577,7 +577,7 @@ void VIEW3D_OT_snap_selected_to_grid(wmOperatorType *ot) /* *************************************************** */ -static int snap_sel_to_curs(bContext *C, wmOperator *op) +static int snap_sel_to_curs(bContext *C, wmOperator *UNUSED(op)) { extern float originmat[3][3]; /* XXX object.c */ Main *bmain= CTX_data_main(C); @@ -602,15 +602,12 @@ static int snap_sel_to_curs(bContext *C, wmOperator *op) tv= transvmain; for(a=0; a<tottrans; a++, tv++) { - vec[0]= curs[0]-obedit->obmat[3][0]; - vec[1]= curs[1]-obedit->obmat[3][1]; - vec[2]= curs[2]-obedit->obmat[3][2]; - + sub_v3_v3v3(vec, curs, obedit->obmat[3]); mul_m3_v3(imat, vec); - VECCOPY(tv->loc, vec); + copy_v3_v3(tv->loc, vec); } - special_transvert_update(scene, obedit); + special_transvert_update(obedit); MEM_freeN(transvmain); transvmain= NULL; @@ -703,7 +700,7 @@ void VIEW3D_OT_snap_selected_to_cursor(wmOperatorType *ot) /* *************************************************** */ -static int snap_curs_to_grid(bContext *C, wmOperator *op) +static int snap_curs_to_grid(bContext *C, wmOperator *UNUSED(op)) { Scene *scene= CTX_data_scene(C); RegionView3D *rv3d= CTX_wm_region_data(C); @@ -740,7 +737,7 @@ void VIEW3D_OT_snap_cursor_to_grid(wmOperatorType *ot) /* **************************************************** */ -static int snap_curs_to_sel(bContext *C, wmOperator *op) +static int snap_curs_to_sel(bContext *C, wmOperator *UNUSED(op)) { Object *obedit= CTX_data_edit_object(C); Scene *scene= CTX_data_scene(C); @@ -847,7 +844,7 @@ void VIEW3D_OT_snap_cursor_to_selected(wmOperatorType *ot) /* ********************************************** */ -static int snap_curs_to_active(bContext *C, wmOperator *op) +static int snap_curs_to_active(bContext *C, wmOperator *UNUSED(op)) { Object *obedit= CTX_data_edit_object(C); Object *obact= CTX_data_active_object(C); @@ -898,7 +895,7 @@ void VIEW3D_OT_snap_cursor_to_active(wmOperatorType *ot) /* **************************************************** */ /*New Code - Snap Cursor to Center -*/ -static int snap_curs_to_center(bContext *C, wmOperator *op) +static int snap_curs_to_center(bContext *C, wmOperator *UNUSED(op)) { Scene *scene= CTX_data_scene(C); View3D *v3d= CTX_wm_view3d(C); diff --git a/source/blender/editors/space_view3d/view3d_toolbar.c b/source/blender/editors/space_view3d/view3d_toolbar.c index 6e2624cb60b..16896f75915 100644 --- a/source/blender/editors/space_view3d/view3d_toolbar.c +++ b/source/blender/editors/space_view3d/view3d_toolbar.c @@ -65,7 +65,7 @@ /* op->invoke */ -static void redo_cb(bContext *C, void *arg_op, void *arg2) +static void redo_cb(bContext *C, void *arg_op, void *UNUSED(arg2)) { wmOperator *lastop= arg_op; @@ -114,7 +114,7 @@ static void view3d_panel_operator_redo_buts(const bContext *C, Panel *pa, wmOper op->layout= NULL; } else - uiDefAutoButsRNA(C, pa->layout, &ptr, 1); + uiDefAutoButsRNA(pa->layout, &ptr, 1); } static void view3d_panel_operator_redo_header(const bContext *C, Panel *pa) @@ -177,7 +177,7 @@ static void operator_call_cb(struct bContext *C, void *arg_listbase, void *arg2) } -static void operator_search_cb(const struct bContext *C, void *arg, char *str, uiSearchItems *items) +static void operator_search_cb(const struct bContext *C, void *UNUSED(arg), char *str, uiSearchItems *items) { wmOperatorType *ot = WM_operatortype_first(); @@ -280,7 +280,7 @@ void view3d_tool_props_register(ARegionType *art) /* ********** operator to open/close toolshelf region */ -static int view3d_toolshelf(bContext *C, wmOperator *op) +static int view3d_toolshelf(bContext *C, wmOperator *UNUSED(op)) { ScrArea *sa= CTX_wm_area(C); ARegion *ar= view3d_has_tools_region(sa); diff --git a/source/blender/editors/space_view3d/view3d_view.c b/source/blender/editors/space_view3d/view3d_view.c index 860f9f461c4..8b3d99e355d 100644 --- a/source/blender/editors/space_view3d/view3d_view.c +++ b/source/blender/editors/space_view3d/view3d_view.c @@ -296,7 +296,7 @@ void smooth_view(bContext *C, Object *oldcamera, Object *camera, float *ofs, flo } /* only meant for timer usage */ -static int view3d_smoothview_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int view3d_smoothview_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent *event) { View3D *v3d = CTX_wm_view3d(C); RegionView3D *rv3d= CTX_wm_region_view3d(C); @@ -380,7 +380,7 @@ void VIEW3D_OT_smoothview(wmOperatorType *ot) /* ****************** change view operators ****************** */ -static void setcameratoview3d(View3D *v3d, RegionView3D *rv3d, Object *ob) +static void setcameratoview3d(RegionView3D *rv3d, Object *ob) { float dvec[3]; float mat3[3][3]; @@ -399,7 +399,7 @@ static void setcameratoview3d(View3D *v3d, RegionView3D *rv3d, Object *ob) } -static int view3d_setcameratoview_exec(bContext *C, wmOperator *op) +static int view3d_setcameratoview_exec(bContext *C, wmOperator *UNUSED(op)) { View3D *v3d = CTX_wm_view3d(C); RegionView3D *rv3d= CTX_wm_region_view3d(C); @@ -408,7 +408,7 @@ static int view3d_setcameratoview_exec(bContext *C, wmOperator *op) rv3d->lview= rv3d->view; rv3d->lpersp= rv3d->persp; - setcameratoview3d(v3d, rv3d, v3d->camera); + setcameratoview3d(rv3d, v3d->camera); rv3d->persp = RV3D_CAMOB; WM_event_add_notifier(C, NC_OBJECT|ND_TRANSFORM, v3d->camera); @@ -444,7 +444,7 @@ void VIEW3D_OT_setcameratoview(wmOperatorType *ot) } -static int view3d_setobjectascamera_exec(bContext *C, wmOperator *op) +static int view3d_setobjectascamera_exec(bContext *C, wmOperator *UNUSED(op)) { View3D *v3d = CTX_wm_view3d(C); RegionView3D *rv3d= CTX_wm_region_view3d(C); @@ -1600,7 +1600,7 @@ static void endlocalview(Scene *scene, ScrArea *sa) } } -static int localview_exec(bContext *C, wmOperator *unused) +static int localview_exec(bContext *C, wmOperator *UNUSED(unused)) { View3D *v3d= CTX_wm_view3d(C); @@ -1667,6 +1667,7 @@ static void RestoreState(bContext *C) win->queue= queue_back; GPU_state_init(); + GPU_set_tpage(NULL, 0); glPopAttrib(); } @@ -1779,6 +1780,8 @@ static int game_engine_exec(bContext *C, wmOperator *op) RegionView3D *rv3d; rcti cam_frame; + (void)op; /* unused */ + // bad context switch .. if(!ED_view3d_context_activate(C)) return OPERATOR_CANCELLED; @@ -1827,6 +1830,7 @@ static int game_engine_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; #else + (void)C; /* unused */ BKE_report(op->reports, RPT_ERROR, "Game engine is disabled in this build."); return OPERATOR_CANCELLED; #endif @@ -1985,7 +1989,7 @@ typedef struct FlyInfo { } FlyInfo; -static void drawFlyPixel(const struct bContext *C, struct ARegion *ar, void *arg) +static void drawFlyPixel(const struct bContext *UNUSED(C), struct ARegion *UNUSED(ar), void *arg) { FlyInfo *fly = arg; diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c index cc0916a8893..ec8121739c4 100644 --- a/source/blender/editors/transform/transform.c +++ b/source/blender/editors/transform/transform.c @@ -384,7 +384,7 @@ void BIF_selectOrientation() { #endif } -static void view_editmove(unsigned short event) +static void view_editmove(unsigned short UNUSED(event)) { #if 0 // TRANSFORM_FIX_ME int refresh = 0; @@ -481,6 +481,8 @@ static void view_editmove(unsigned short event) * */ #define TFM_MODAL_PROPSIZE_UP 20 #define TFM_MODAL_PROPSIZE_DOWN 21 +#define TFM_MODAL_AUTOIK_LEN_INC 22 +#define TFM_MODAL_AUTOIK_LEN_DEC 23 /* called in transform_ops.c, on each regeneration of keymaps */ wmKeyMap* transform_modal_keymap(wmKeyConfig *keyconf) @@ -507,6 +509,8 @@ wmKeyMap* transform_modal_keymap(wmKeyConfig *keyconf) {NUM_MODAL_INCREMENT_DOWN, "INCREMENT_DOWN", 0, "Numinput Increment Down", ""}, {TFM_MODAL_PROPSIZE_UP, "PROPORTIONAL_SIZE_UP", 0, "Increase Proportional Influence", ""}, {TFM_MODAL_PROPSIZE_DOWN, "PROPORTIONAL_SIZE_DOWN", 0, "Decrease Poportional Influence", ""}, + {TFM_MODAL_AUTOIK_LEN_INC, "AUTOIK_CHAIN_LEN_UP", 0, "Increase Max AutoIK Chain Length", ""}, + {TFM_MODAL_AUTOIK_LEN_DEC, "AUTOIK_CHAIN_LEN_DOWN", 0, "Decrease Max AutoIK Chain Length", ""}, {0, NULL, 0, NULL, NULL}}; wmKeyMap *keymap= WM_modalkeymap_get(keyconf, "Transform Modal Map"); @@ -541,7 +545,12 @@ wmKeyMap* transform_modal_keymap(wmKeyConfig *keyconf) WM_modalkeymap_add_item(keymap, PAGEDOWNKEY, KM_PRESS, 0, 0, TFM_MODAL_PROPSIZE_DOWN); WM_modalkeymap_add_item(keymap, WHEELDOWNMOUSE, KM_PRESS, 0, 0, TFM_MODAL_PROPSIZE_UP); WM_modalkeymap_add_item(keymap, WHEELUPMOUSE, KM_PRESS, 0, 0, TFM_MODAL_PROPSIZE_DOWN); - + + WM_modalkeymap_add_item(keymap, PAGEUPKEY, KM_PRESS, KM_SHIFT, 0, TFM_MODAL_AUTOIK_LEN_INC); + WM_modalkeymap_add_item(keymap, PAGEDOWNKEY, KM_PRESS, KM_SHIFT, 0, TFM_MODAL_AUTOIK_LEN_DEC); + WM_modalkeymap_add_item(keymap, WHEELDOWNMOUSE, KM_PRESS, KM_SHIFT, 0, TFM_MODAL_AUTOIK_LEN_INC); + WM_modalkeymap_add_item(keymap, WHEELUPMOUSE, KM_PRESS, KM_SHIFT, 0, TFM_MODAL_AUTOIK_LEN_DEC); + return keymap; } @@ -732,6 +741,16 @@ int transformEvent(TransInfo *t, wmEvent *event) } t->redraw |= TREDRAW_HARD; break; + case TFM_MODAL_AUTOIK_LEN_INC: + if (t->flag & T_AUTOIK) + transform_autoik_update(t, 1); + t->redraw |= TREDRAW_HARD; + break; + case TFM_MODAL_AUTOIK_LEN_DEC: + if (t->flag & T_AUTOIK) + transform_autoik_update(t, -1); + t->redraw |= TREDRAW_HARD; + break; default: handled = 0; break; @@ -1198,7 +1217,7 @@ static void drawArc(float size, float angle_start, float angle_end, int segments glEnd(); } -static void drawHelpline(bContext *C, int x, int y, void *customdata) +static void drawHelpline(bContext *UNUSED(C), int x, int y, void *customdata) { TransInfo *t = (TransInfo*)customdata; @@ -1330,16 +1349,16 @@ static void drawHelpline(bContext *C, int x, int y, void *customdata) } } -void drawTransformView(const struct bContext *C, struct ARegion *ar, void *arg) +void drawTransformView(const struct bContext *C, struct ARegion *UNUSED(ar), void *arg) { TransInfo *t = arg; - drawConstraint(C, t); + drawConstraint(t); drawPropCircle(C, t); drawSnapping(C, t); } -void drawTransformPixel(const struct bContext *C, struct ARegion *ar, void *arg) +void drawTransformPixel(const struct bContext *UNUSED(C), struct ARegion *UNUSED(ar), void *UNUSED(arg)) { // TransInfo *t = arg; // @@ -1723,7 +1742,7 @@ void transformApply(const bContext *C, TransInfo *t) } } -void drawTransformApply(const struct bContext *C, struct ARegion *ar, void *arg) +void drawTransformApply(const struct bContext *C, struct ARegion *UNUSED(ar), void *arg) { TransInfo *t = arg; @@ -1896,7 +1915,7 @@ static void protectedQuaternionBits(short protectflag, float *quat, float *oldqu /* ******************* TRANSFORM LIMITS ********************** */ -static void constraintTransLim(TransInfo *t, TransData *td) +static void constraintTransLim(TransInfo *UNUSED(t), TransData *td) { if (td->con) { bConstraintTypeInfo *cti= get_constraint_typeinfo(CONSTRAINT_TYPE_LOCLIMIT); @@ -1991,7 +2010,7 @@ static void constraintob_from_transdata(bConstraintOb *cob, TransData *td) } } -static void constraintRotLim(TransInfo *t, TransData *td) +static void constraintRotLim(TransInfo *UNUSED(t), TransData *td) { if (td->con) { bConstraintTypeInfo *cti= get_constraint_typeinfo(CONSTRAINT_TYPE_ROTLIMIT); @@ -2211,7 +2230,7 @@ int handleEventWarp(TransInfo *t, wmEvent *event) return status; } -int Warp(TransInfo *t, short mval[2]) +int Warp(TransInfo *t, short UNUSED(mval[2])) { TransData *td = t->data; float vec[3], circumfac, dist, phi0, co, si, *curs, cursor[3], gcursor[3]; @@ -2309,7 +2328,7 @@ int Warp(TransInfo *t, short mval[2]) /* ************************** SHEAR *************************** */ -void postInputShear(TransInfo *t, float values[3]) +void postInputShear(TransInfo *UNUSED(t), float values[3]) { mul_v3_fl(values, 0.05f); } @@ -2359,7 +2378,7 @@ int handleEventShear(TransInfo *t, wmEvent *event) } -int Shear(TransInfo *t, short mval[2]) +int Shear(TransInfo *t, short UNUSED(mval[2])) { TransData *td = t->data; float vec[3]; @@ -2723,7 +2742,7 @@ void initToSphere(TransInfo *t) t->val /= (float)t->total; } -int ToSphere(TransInfo *t, short mval[2]) +int ToSphere(TransInfo *t, short UNUSED(mval[2])) { float vec[3]; float ratio, radius; @@ -3058,7 +3077,7 @@ static void applyRotation(TransInfo *t, float angle, float axis[3]) } } -int Rotation(TransInfo *t, short mval[2]) +int Rotation(TransInfo *t, short UNUSED(mval[2])) { char str[64]; @@ -3172,7 +3191,7 @@ static void applyTrackball(TransInfo *t, float axis1[3], float axis2[3], float a } } -int Trackball(TransInfo *t, short mval[2]) +int Trackball(TransInfo *t, short UNUSED(mval[2])) { char str[128]; float axis1[3], axis2[3]; @@ -3391,7 +3410,7 @@ static void applyTranslation(TransInfo *t, float vec[3]) { } /* uses t->vec to store actual translation in */ -int Translation(TransInfo *t, short mval[2]) +int Translation(TransInfo *t, short UNUSED(mval[2])) { char str[250]; @@ -3457,7 +3476,7 @@ void initShrinkFatten(TransInfo *t) -int ShrinkFatten(TransInfo *t, short mval[2]) +int ShrinkFatten(TransInfo *t, short UNUSED(mval[2])) { float vec[3]; float distance; @@ -3532,7 +3551,7 @@ void initTilt(TransInfo *t) -int Tilt(TransInfo *t, short mval[2]) +int Tilt(TransInfo *t, short UNUSED(mval[2])) { TransData *td = t->data; int i; @@ -3604,7 +3623,7 @@ void initCurveShrinkFatten(TransInfo *t) t->flag |= T_NO_CONSTRAINT; } -int CurveShrinkFatten(TransInfo *t, short mval[2]) +int CurveShrinkFatten(TransInfo *t, short UNUSED(mval[2])) { TransData *td = t->data; float ratio; @@ -3672,7 +3691,7 @@ void initPushPull(TransInfo *t) } -int PushPull(TransInfo *t, short mval[2]) +int PushPull(TransInfo *t, short UNUSED(mval[2])) { float vec[3], axis[3]; float distance; @@ -3805,7 +3824,7 @@ int handleEventBevel(TransInfo *t, wmEvent *event) return 0; } -int Bevel(TransInfo *t, short mval[2]) +int Bevel(TransInfo *t, short UNUSED(mval[2])) { float distance,d; int i; @@ -3873,7 +3892,7 @@ void initBevelWeight(TransInfo *t) t->flag |= T_NO_CONSTRAINT|T_NO_PROJECT; } -int BevelWeight(TransInfo *t, short mval[2]) +int BevelWeight(TransInfo *t, short UNUSED(mval[2])) { TransData *td = t->data; float weight; @@ -3946,7 +3965,7 @@ void initCrease(TransInfo *t) t->flag |= T_NO_CONSTRAINT|T_NO_PROJECT; } -int Crease(TransInfo *t, short mval[2]) +int Crease(TransInfo *t, short UNUSED(mval[2])) { TransData *td = t->data; float crease; @@ -4140,7 +4159,7 @@ void initBoneEnvelope(TransInfo *t) t->flag |= T_NO_CONSTRAINT|T_NO_PROJECT; } -int BoneEnvelope(TransInfo *t, short mval[2]) +int BoneEnvelope(TransInfo *t, short UNUSED(mval[2])) { TransData *td = t->data; float ratio; @@ -4846,7 +4865,7 @@ int doEdgeSlide(TransInfo *t, float perc) return 1; } -int EdgeSlide(TransInfo *t, short mval[2]) +int EdgeSlide(TransInfo *t, short UNUSED(mval[2])) { char str[50]; float final; @@ -4905,7 +4924,7 @@ void initBoneRoll(TransInfo *t) t->flag |= T_NO_CONSTRAINT|T_NO_PROJECT; } -int BoneRoll(TransInfo *t, short mval[2]) +int BoneRoll(TransInfo *t, short UNUSED(mval[2])) { TransData *td = t->data; int i; @@ -5041,7 +5060,7 @@ void initMirror(TransInfo *t) } } -int Mirror(TransInfo *t, short mval[2]) +int Mirror(TransInfo *t, short UNUSED(mval[2])) { TransData *td; float size[3], mat[3][3]; @@ -5118,7 +5137,7 @@ void initAlign(TransInfo *t) initMouseInputMode(t, &t->mouse, INPUT_NONE); } -int Align(TransInfo *t, short mval[2]) +int Align(TransInfo *t, short UNUSED(mval[2])) { TransData *td = t->data; float center[3]; @@ -5221,7 +5240,7 @@ static void applySeqSlide(TransInfo *t, float val[2]) { } } -int SeqSlide(TransInfo *t, short mval[2]) +int SeqSlide(TransInfo *t, short UNUSED(mval[2])) { char str[200]; @@ -5449,7 +5468,7 @@ static void headerTimeTranslate(TransInfo *t, char *str) sprintf(str, "DeltaX: %s", &tvec[0]); } -static void applyTimeTranslate(TransInfo *t, float sval) +static void applyTimeTranslate(TransInfo *t, float UNUSED(sval)) { TransData *td = t->data; TransData2D *td2d = t->data2d; @@ -5751,7 +5770,7 @@ static void applyTimeScale(TransInfo *t) { } } -int TimeScale(TransInfo *t, short mval[2]) +int TimeScale(TransInfo *t, short UNUSED(mval[2])) { char str[200]; @@ -5772,7 +5791,7 @@ int TimeScale(TransInfo *t, short mval[2]) /* ************************************ */ -void BIF_TransformSetUndo(char *str) +void BIF_TransformSetUndo(char *UNUSED(str)) { // TRANSFORM_FIX_ME //Trans.undostr= str; diff --git a/source/blender/editors/transform/transform.h b/source/blender/editors/transform/transform.h index 6cfe78a979d..bb6ffe9155f 100644 --- a/source/blender/editors/transform/transform.h +++ b/source/blender/editors/transform/transform.h @@ -571,7 +571,7 @@ void autokeyframe_pose_cb_func(struct bContext *C, struct Scene *scene, struct V /*********************** Constraints *****************************/ -void drawConstraint(const struct bContext *C, TransInfo *t); +void drawConstraint(TransInfo *t); void getConstraintMatrix(TransInfo *t); void setConstraint(TransInfo *t, float space[3][3], int mode, const char text[]); diff --git a/source/blender/editors/transform/transform_constraints.c b/source/blender/editors/transform/transform_constraints.c index 1e6916f0a86..b15c5b07758 100644 --- a/source/blender/editors/transform/transform_constraints.c +++ b/source/blender/editors/transform/transform_constraints.c @@ -593,7 +593,7 @@ void setUserConstraint(TransInfo *t, short orientation, int mode, const char fte /*----------------- DRAWING CONSTRAINTS -------------------*/ -void drawConstraint(const struct bContext *C, TransInfo *t) +void drawConstraint(TransInfo *t) { TransCon *tc = &(t->con); diff --git a/source/blender/editors/transform/transform_conversions.c b/source/blender/editors/transform/transform_conversions.c index 01404603b86..d723f77f537 100644 --- a/source/blender/editors/transform/transform_conversions.c +++ b/source/blender/editors/transform/transform_conversions.c @@ -232,7 +232,7 @@ static void set_prop_dist(TransInfo *t, short with_dist) /* ********************* texture space ********* */ -static void createTransTexspace(bContext *C, TransInfo *t) +static void createTransTexspace(TransInfo *t) { Scene *scene = t->scene; TransData *td; @@ -277,7 +277,7 @@ static void createTransTexspace(bContext *C, TransInfo *t) /* ********************* edge (for crease) ***** */ -static void createTransEdge(bContext *C, TransInfo *t) { +static void createTransEdge(TransInfo *t) { EditMesh *em = ((Mesh *)t->obedit->data)->edit_mesh; TransData *td = NULL; EditEdge *eed; @@ -446,16 +446,21 @@ static short apply_targetless_ik(Object *ob) /* apply and decompose, doesn't work for constraints or non-uniform scale well */ { float rmat3[3][3], qrmat[3][3], imat[3][3], smat[3][3]; - + copy_m3_m4(rmat3, rmat); /* rotation */ - if (parchan->rotmode > 0) - mat3_to_eulO( parchan->eul, parchan->rotmode,rmat3); + /* [#22409] is partially caused by this, as slight numeric error introduced during + * the solving process leads to locked-axis values changing. However, we cannot modify + * the values here, or else there are huge discreptancies between IK-solver (interactive) + * and applied poses. + */ + if (parchan->rotmode > 0) + mat3_to_eulO(parchan->eul, parchan->rotmode,rmat3); else if (parchan->rotmode == ROT_MODE_AXISANGLE) - mat3_to_axis_angle( parchan->rotAxis, &pchan->rotAngle,rmat3); + mat3_to_axis_angle(parchan->rotAxis, &parchan->rotAngle,rmat3); else - mat3_to_quat( parchan->quat,rmat3); + mat3_to_quat(parchan->quat,rmat3); /* for size, remove rotation */ /* causes problems with some constraints (so apply only if needed) */ @@ -840,9 +845,9 @@ static short pose_grab_with_ik_add(bPoseChannel *pchan) data->flag |= CONSTRAINT_IK_TEMP|CONSTRAINT_IK_AUTO; VECCOPY(data->grabtarget, pchan->pose_tail); data->rootbone= 1; - - /* we include only a connected chain */ - while ((pchan) && (pchan->bone->flag & BONE_CONNECTED)) { + + /* we only include bones that are part of a continual connected chain */ + while (pchan) { /* here, we set ik-settings for bone from pchan->protectflag */ if (pchan->protectflag & OB_LOCK_ROTX) pchan->ikflag |= BONE_IK_NO_XDOF_TEMP; if (pchan->protectflag & OB_LOCK_ROTY) pchan->ikflag |= BONE_IK_NO_YDOF_TEMP; @@ -850,7 +855,12 @@ static short pose_grab_with_ik_add(bPoseChannel *pchan) /* now we count this pchan as being included */ data->rootbone++; - pchan= pchan->parent; + + /* continue to parent, but only if we're connected to it */ + if (pchan->bone->flag & BONE_CONNECTED) + pchan = pchan->parent; + else + pchan = NULL; } /* make a copy of maximum chain-length */ @@ -930,7 +940,7 @@ static short pose_grab_with_ik(Object *ob) /* only called with pose mode active object now */ -static void createTransPose(bContext *C, TransInfo *t, Object *ob) +static void createTransPose(TransInfo *t, Object *ob) { bArmature *arm; bPoseChannel *pchan; @@ -995,7 +1005,7 @@ static void createTransPose(bContext *C, TransInfo *t, Object *ob) /* ********************* armature ************** */ -static void createTransArmatureVerts(bContext *C, TransInfo *t) +static void createTransArmatureVerts(TransInfo *t) { EditBone *ebo; bArmature *arm= t->obedit->data; @@ -1195,7 +1205,7 @@ static void createTransArmatureVerts(bContext *C, TransInfo *t) /* ********************* meta elements ********* */ -static void createTransMBallVerts(bContext *C, TransInfo *t) +static void createTransMBallVerts(TransInfo *t) { MetaBall *mb = (MetaBall*)t->obedit->data; MetaElem *ml; @@ -1530,7 +1540,7 @@ static void createTransCurveVerts(bContext *C, TransInfo *t) /* ********************* lattice *************** */ -static void createTransLatticeVerts(bContext *C, TransInfo *t) +static void createTransLatticeVerts(TransInfo *t) { Lattice *latt = ((Lattice*)t->obedit->data)->editlatt->latt; TransData *td = NULL; @@ -1896,7 +1906,7 @@ 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 *no_f, short *no_s) +static void make_vertexcos__mapFunc(void *userData, int index, float *co, float *UNUSED(no_f), short *UNUSED(no_s)) { float *vec = userData; @@ -2145,7 +2155,7 @@ static void createTransEditVerts(bContext *C, TransInfo *t) /* detect CrazySpace [tm] */ if(propmode==0) { if(modifiers_getCageIndex(t->scene, t->obedit, NULL, 1)>=0) { - if(modifiers_isCorrectableDeformed(t->scene, t->obedit)) { + if(modifiers_isCorrectableDeformed(t->obedit)) { /* check if we can use deform matrices for modifier from the start up to stack, they are more accurate than quats */ totleft= editmesh_get_first_deform_matrices(t->scene, t->obedit, em, &defmats, &defcos); @@ -2274,11 +2284,10 @@ void flushTransNodes(TransInfo *t) } /* *** SEQUENCE EDITOR *** */ -#define XXX_DURIAN_ANIM_TX_HACK void flushTransSeq(TransInfo *t) { ListBase *seqbasep= seq_give_editing(t->scene, FALSE)->seqbasep; /* Editing null check already done */ - int a, new_frame; + int a, new_frame, old_start; TransData *td= NULL; TransData2D *td2d= NULL; TransDataSeq *tdsq= NULL; @@ -2295,16 +2304,11 @@ void flushTransSeq(TransInfo *t) for(a=0, td= t->data, td2d= t->data2d; a<t->total; a++, td++, td2d++) { tdsq= (TransDataSeq *)td->extra; seq= tdsq->seq; + old_start = seq->start; new_frame= (int)floor(td2d->loc[0] + 0.5f); switch (tdsq->sel_flag) { case SELECT: -#ifdef XXX_DURIAN_ANIM_TX_HACK - if (seq != seq_prev) { - int ofs = (new_frame - tdsq->start_offset) - seq->start; // breaks for single strips - color/image - seq_offset_animdata(t->scene, seq, ofs); - } -#endif if (seq->type != SEQ_META && (seq->depth != 0 || seq_tx_test(seq))) /* for meta's, their children move */ seq->start= new_frame - tdsq->start_offset; @@ -2335,6 +2339,9 @@ void flushTransSeq(TransInfo *t) else { calc_sequence_disp(t->scene, seq); } + + if(tdsq->sel_flag == SELECT) + seq_offset_animdata(t->scene, seq, seq->start - old_start); } seq_prev= seq; } @@ -3841,6 +3848,7 @@ static short constraints_list_needinv(TransInfo *t, ListBase *list) * seq->depth must be set before running this function so we know if the strips * are root level or not */ +#define XXX_DURIAN_ANIM_TX_HACK static void SeqTransInfo(TransInfo *t, Sequence *seq, int *recursive, int *count, int *flag) { @@ -3978,7 +3986,7 @@ static int SeqTransCount(TransInfo *t, ListBase *seqbase, int depth) } -static TransData *SeqToTransData(TransInfo *t, TransData *td, TransData2D *td2d, TransDataSeq *tdsq, Sequence *seq, int flag, int sel_flag) +static TransData *SeqToTransData(TransData *td, TransData2D *td2d, TransDataSeq *tdsq, Sequence *seq, int flag, int sel_flag) { int start_left; @@ -4063,16 +4071,16 @@ static int SeqToTransData_Recursive(TransInfo *t, ListBase *seqbase, TransData * if (flag & SELECT) { if (flag & (SEQ_LEFTSEL|SEQ_RIGHTSEL)) { if (flag & SEQ_LEFTSEL) { - SeqToTransData(t, td++, td2d++, tdsq++, seq, flag, SEQ_LEFTSEL); + SeqToTransData(td++, td2d++, tdsq++, seq, flag, SEQ_LEFTSEL); tot++; } if (flag & SEQ_RIGHTSEL) { - SeqToTransData(t, td++, td2d++, tdsq++, seq, flag, SEQ_RIGHTSEL); + SeqToTransData(td++, td2d++, tdsq++, seq, flag, SEQ_RIGHTSEL); tot++; } } else { - SeqToTransData(t, td++, td2d++, tdsq++, seq, flag, SELECT); + SeqToTransData(td++, td2d++, tdsq++, seq, flag, SELECT); tot++; } } @@ -4232,7 +4240,7 @@ static void createTransSeqData(bContext *C, TransInfo *t) /* transcribe given object into TransData for Transforming */ -static void ObjectToTransData(bContext *C, TransInfo *t, TransData *td, Object *ob) +static void ObjectToTransData(TransInfo *t, TransData *td, Object *ob) { Scene *scene = t->scene; float obmtx[3][3]; @@ -4342,7 +4350,7 @@ static void ObjectToTransData(bContext *C, TransInfo *t, TransData *td, Object * /* sets flags in Bases to define whether they take part in transform */ /* it deselects Bases, so we have to call the clear function always after */ -static void set_trans_object_base_flags(bContext *C, TransInfo *t) +static void set_trans_object_base_flags(TransInfo *t) { Scene *scene = t->scene; View3D *v3d = t->view; @@ -4720,7 +4728,7 @@ void autokeyframe_pose_cb_func(bContext *C, Scene *scene, View3D *v3d, Object *o */ if (C && (ob->pose->avs.path_bakeflag & MOTIONPATH_BAKE_HAS_PATHS)) { //ED_pose_clear_paths(C, ob); // XXX for now, don't need to clear - ED_pose_recalculate_paths(C, scene, ob); + ED_pose_recalculate_paths(scene, ob); } } else { @@ -5091,7 +5099,7 @@ static void createTransObject(bContext *C, TransInfo *t) TransDataExtension *tx; int propmode = t->flag & T_PROP_EDIT; - set_trans_object_base_flags(C, t); + set_trans_object_base_flags(t); /* count */ t->total= CTX_DATA_COUNT(C, selected_objects); @@ -5130,7 +5138,7 @@ static void createTransObject(bContext *C, TransInfo *t) td->flag |= TD_SKIP; } - ObjectToTransData(C, t, td, ob); + ObjectToTransData(t, td, ob); td->val = NULL; td++; tx++; @@ -5153,7 +5161,7 @@ static void createTransObject(bContext *C, TransInfo *t) td->ext = tx; td->rotOrder= ob->rotmode; - ObjectToTransData(C, t, td, ob); + ObjectToTransData(t, td, ob); td->val = NULL; td++; tx++; @@ -5210,12 +5218,12 @@ void createTransData(bContext *C, TransInfo *t) if (t->options & CTX_TEXTURE) { t->flag |= T_TEXTURE; - createTransTexspace(C, t); + createTransTexspace(t); } else if (t->options & CTX_EDGE) { t->ext = NULL; t->flag |= T_EDIT; - createTransEdge(C, t); + createTransEdge(t); if(t->data && t->flag & T_PROP_EDIT) { sort_trans_data(t); // makes selected become first in array set_prop_dist(t, 1); @@ -5277,14 +5285,14 @@ void createTransData(bContext *C, TransInfo *t) createTransCurveVerts(C, t); } else if (t->obedit->type==OB_LATTICE) { - createTransLatticeVerts(C, t); + createTransLatticeVerts(t); } else if (t->obedit->type==OB_MBALL) { - createTransMBallVerts(C, t); + createTransMBallVerts(t); } else if (t->obedit->type==OB_ARMATURE) { t->flag &= ~T_PROP_EDIT; - createTransArmatureVerts(C, t); + createTransArmatureVerts(t); } else { printf("edit type not implemented!\n"); @@ -5315,22 +5323,22 @@ void createTransData(bContext *C, TransInfo *t) else if (ob && (ob->mode & OB_MODE_POSE)) { // XXX this is currently limited to active armature only... // XXX active-layer checking isn't done as that should probably be checked through context instead - createTransPose(C, t, ob); + createTransPose(t, ob); } else if (ob && (ob->mode & OB_MODE_WEIGHT_PAINT)) { - /* exception, we look for the one selected armature */ - CTX_DATA_BEGIN(C, Object*, ob_armature, selected_objects) - { - if(ob_armature->type==OB_ARMATURE) - { - if((ob_armature->mode & OB_MODE_POSE) && ob_armature == modifiers_isDeformedByArmature(ob)) - { - createTransPose(C, t, ob_armature); - break; + /* important that ob_armature can be set even when its not selected [#23412] + * lines below just check is also visible */ + Object *ob_armature= modifiers_isDeformedByArmature(ob); + if(ob_armature && ob_armature->mode & OB_MODE_POSE) { + Base *base_arm= object_in_scene(ob_armature, t->scene); + if(base_arm) { + View3D *v3d = t->view; + if(BASE_VISIBLE(v3d, base_arm)) { + createTransPose(t, ob_armature); } } + } - CTX_DATA_END; } else if (ob && (ob->mode & OB_MODE_PARTICLE_EDIT) && PE_start_edit(PE_get_current(scene, ob))) { diff --git a/source/blender/editors/transform/transform_input.c b/source/blender/editors/transform/transform_input.c index 54a86b3dca1..ce0888b6a30 100644 --- a/source/blender/editors/transform/transform_input.c +++ b/source/blender/editors/transform/transform_input.c @@ -55,7 +55,7 @@ void InputVector(TransInfo *t, MouseInput *mi, short mval[2], float output[3]) } -void InputSpring(TransInfo *t, MouseInput *mi, short mval[2], float output[3]) +void InputSpring(TransInfo *UNUSED(t), MouseInput *mi, short mval[2], float output[3]) { float ratio, precise_ratio, dx, dy; if(mi->precision) @@ -93,7 +93,7 @@ void InputSpringFlip(TransInfo *t, MouseInput *mi, short mval[2], float output[3 } } -void InputTrackBall(TransInfo *t, MouseInput *mi, short mval[2], float output[3]) +void InputTrackBall(TransInfo *UNUSED(t), MouseInput *mi, short mval[2], float output[3]) { if(mi->precision) @@ -162,7 +162,7 @@ void InputVerticalAbsolute(TransInfo *t, MouseInput *mi, short mval[2], float ou output[0] = dot_v3v3(t->viewinv[1], vec) * 2.0f; } -void setCustomPoints(TransInfo *t, MouseInput *mi, short start[2], short end[2]) +void setCustomPoints(TransInfo *UNUSED(t), MouseInput *mi, short start[2], short end[2]) { short *data; @@ -178,7 +178,7 @@ void setCustomPoints(TransInfo *t, MouseInput *mi, short start[2], short end[2]) data[3] = end[1]; } -void InputCustomRatio(TransInfo *t, MouseInput *mi, short mval[2], float output[3]) +void InputCustomRatio(TransInfo *UNUSED(t), MouseInput *mi, short mval[2], float output[3]) { float length; float distance; @@ -211,7 +211,7 @@ void InputCustomRatio(TransInfo *t, MouseInput *mi, short mval[2], float output[ } } -void InputAngle(TransInfo *t, MouseInput *mi, short mval[2], float output[3]) +void InputAngle(TransInfo *UNUSED(t), MouseInput *mi, short mval[2], float output[3]) { double dx2 = mval[0] - mi->center[0]; double dy2 = mval[1] - mi->center[1]; @@ -272,7 +272,7 @@ void InputAngle(TransInfo *t, MouseInput *mi, short mval[2], float output[3]) output[0] = *angle; } -void initMouseInput(TransInfo *t, MouseInput *mi, int center[2], short mval[2]) +void initMouseInput(TransInfo *UNUSED(t), MouseInput *mi, int center[2], short mval[2]) { mi->factor = 0; mi->precision = 0; diff --git a/source/blender/editors/transform/transform_manipulator.c b/source/blender/editors/transform/transform_manipulator.c index 51698c27b37..030ad190dc3 100644 --- a/source/blender/editors/transform/transform_manipulator.c +++ b/source/blender/editors/transform/transform_manipulator.c @@ -101,16 +101,6 @@ #define MAN_GHOST 1 #define MAN_MOVECOL 2 - -static int is_mat4_flipped(float mat[][4]) -{ - float vec[3]; - - cross_v3_v3v3(vec, mat[0], mat[1]); - if( dot_v3v3(vec, mat[2]) < 0.0 ) return 1; - return 0; -} - /* transform widget center calc helper for below */ static void calc_tw_center(Scene *scene, float *co) { @@ -753,7 +743,7 @@ static void preOrthoFront(int ortho, float twmat[][4], int axis) orthogonalize_m4(omat, axis); glPushMatrix(); glMultMatrixf(omat); - glFrontFace( is_mat4_flipped(omat)?GL_CW:GL_CCW); + glFrontFace(is_negative_m4(omat) ? GL_CW:GL_CCW); } } @@ -850,12 +840,12 @@ static void draw_manipulator_rotate(View3D *v3d, RegionView3D *rv3d, int moving, // XXX mul_m4_m3m4(matt, t->mat, rv3d->twmat); if (ortho) { glMultMatrixf(matt); - glFrontFace( is_mat4_flipped(matt)?GL_CW:GL_CCW); + glFrontFace(is_negative_m4(matt) ? GL_CW:GL_CCW); } } else { if (ortho) { - glFrontFace( is_mat4_flipped(rv3d->twmat)?GL_CW:GL_CCW); + glFrontFace(is_negative_m4(rv3d->twmat) ? GL_CW:GL_CCW); glMultMatrixf(rv3d->twmat); } } @@ -1116,11 +1106,11 @@ static void draw_manipulator_scale(View3D *v3d, RegionView3D *rv3d, int moving, copy_m4_m4(matt, rv3d->twmat); // to copy the parts outside of [3][3] // XXX mul_m4_m3m4(matt, t->mat, rv3d->twmat); glMultMatrixf(matt); - glFrontFace( is_mat4_flipped(matt)?GL_CW:GL_CCW); + glFrontFace(is_negative_m4(matt) ? GL_CW:GL_CCW); } else { glMultMatrixf(rv3d->twmat); - glFrontFace( is_mat4_flipped(rv3d->twmat)?GL_CW:GL_CCW); + glFrontFace(is_negative_m4(rv3d->twmat) ? GL_CW:GL_CCW); } /* axis */ @@ -1197,7 +1187,7 @@ static void draw_cylinder(GLUquadricObj *qobj, float len, float width) } -static void draw_manipulator_translate(View3D *v3d, RegionView3D *rv3d, int moving, int drawflags, int combo, int colcode) +static void draw_manipulator_translate(View3D *v3d, RegionView3D *rv3d, int UNUSED(moving), int drawflags, int combo, int colcode) { GLUquadricObj *qobj; float cylen= 0.01f*(float)U.tw_handlesize; @@ -1327,7 +1317,7 @@ static void draw_manipulator_rotate_cyl(View3D *v3d, RegionView3D *rv3d, int mov glMultMatrixf(rv3d->twmat); } - glFrontFace( is_mat4_flipped(rv3d->twmat)?GL_CW:GL_CCW); + glFrontFace(is_negative_m4(rv3d->twmat) ? GL_CW:GL_CCW); /* axis */ if( (G.f & G_PICKSEL)==0 ) { diff --git a/source/blender/editors/transform/transform_ndofinput.c b/source/blender/editors/transform/transform_ndofinput.c index 3e47484c54c..1ff16dd5f5f 100644 --- a/source/blender/editors/transform/transform_ndofinput.c +++ b/source/blender/editors/transform/transform_ndofinput.c @@ -65,7 +65,7 @@ static void resetNDofInput(NDofInput *n) } -int handleNDofInput(NDofInput *n, wmEvent *event) +int handleNDofInput(NDofInput *UNUSED(n), wmEvent *UNUSED(event)) { int retval = 0; // TRANSFORM_FIX_ME diff --git a/source/blender/editors/transform/transform_ops.c b/source/blender/editors/transform/transform_ops.c index 95e167053ec..381612bf1ef 100644 --- a/source/blender/editors/transform/transform_ops.c +++ b/source/blender/editors/transform/transform_ops.c @@ -145,7 +145,7 @@ static int select_orientation_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -static int select_orientation_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int select_orientation_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent *UNUSED(event)) { uiPopupMenu *pup; uiLayout *layout; @@ -179,7 +179,7 @@ void TRANSFORM_OT_select_orientation(struct wmOperatorType *ot) } -static int delete_orientation_exec(bContext *C, wmOperator *op) +static int delete_orientation_exec(bContext *C, wmOperator *UNUSED(op)) { View3D *v3d = CTX_wm_view3d(C); int selected_index = (v3d->twmode - V3D_MANIP_CUSTOM); @@ -192,7 +192,7 @@ static int delete_orientation_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -static int delete_orientation_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int delete_orientation_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { return delete_orientation_exec(C, op); } @@ -243,7 +243,7 @@ static int create_orientation_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -static int create_orientation_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int create_orientation_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { return create_orientation_exec(C, op); } diff --git a/source/blender/editors/transform/transform_orientations.c b/source/blender/editors/transform/transform_orientations.c index 508dde31010..16519bdf647 100644 --- a/source/blender/editors/transform/transform_orientations.c +++ b/source/blender/editors/transform/transform_orientations.c @@ -141,7 +141,7 @@ void BIF_createTransformOrientation(bContext *C, ReportList *reports, char *name } } -TransformOrientation *createObjectSpace(bContext *C, ReportList *reports, char *name, int overwrite) { +TransformOrientation *createObjectSpace(bContext *C, ReportList *UNUSED(reports), char *name, int overwrite) { Base *base = CTX_data_active_base(C); Object *ob; float mat[3][3]; diff --git a/source/blender/editors/transform/transform_snap.c b/source/blender/editors/transform/transform_snap.c index 09c04168a71..adaaf7c9de6 100644 --- a/source/blender/editors/transform/transform_snap.c +++ b/source/blender/editors/transform/transform_snap.c @@ -210,7 +210,7 @@ void drawSnapping(const struct bContext *C, TransInfo *t) } } -int handleSnapping(TransInfo *t, wmEvent *event) +int handleSnapping(TransInfo *UNUSED(t), wmEvent *UNUSED(event)) { int status = 0; @@ -596,7 +596,7 @@ void ApplySnapResize(TransInfo *t, float vec[3]) /********************** DISTANCE **************************/ -float TranslationBetween(TransInfo *t, float p1[3], float p2[3]) +float TranslationBetween(TransInfo *UNUSED(t), float p1[3], float p2[3]) { return len_v3v3(p1, p2); } @@ -680,12 +680,12 @@ float ResizeBetween(TransInfo *t, float p1[3], float p2[3]) /********************** CALC **************************/ -void CalcSnapGrid(TransInfo *t, float *vec) +void CalcSnapGrid(TransInfo *t, float *UNUSED(vec)) { snapGridAction(t, t->tsnap.snapPoint, BIG_GEARS); } -void CalcSnapGeometry(TransInfo *t, float *vec) +void CalcSnapGeometry(TransInfo *t, float *UNUSED(vec)) { if (t->spacetype == SPACE_VIEW3D) { @@ -1194,7 +1194,7 @@ int snapVertex(ARegion *ar, float vco[3], short vno[3], float mval[2], float ray return retval; } -int snapArmature(short snap_mode, ARegion *ar, Object *ob, bArmature *arm, float obmat[][4], float ray_start[3], float ray_normal[3], float mval[2], float *loc, float *no, int *dist, float *depth) +int snapArmature(short snap_mode, ARegion *ar, Object *ob, bArmature *arm, float obmat[][4], float ray_start[3], float ray_normal[3], float mval[2], float *loc, float *UNUSED(no), int *dist, float *depth) { float imat[4][4]; float ray_start_local[3], ray_normal_local[3]; @@ -1587,7 +1587,7 @@ int snapObjects(Scene *scene, View3D *v3d, ARegion *ar, Object *obedit, float mv base= FIRSTBASE; for ( base = FIRSTBASE; base != NULL; base = base->next ) { - if ( BASE_SELECTABLE(v3d, base) && (base->flag & (BA_HAS_RECALC_OB|BA_HAS_RECALC_DATA)) == 0 && ((mode == SNAP_NOT_SELECTED && (base->flag & (SELECT|BA_WAS_SEL)) == 0) || (ELEM(mode, SNAP_ALL, SNAP_NOT_OBEDIT) && base != BASACT)) ) { + if ( BASE_VISIBLE(v3d, base) && (base->flag & (BA_HAS_RECALC_OB|BA_HAS_RECALC_DATA)) == 0 && ((mode == SNAP_NOT_SELECTED && (base->flag & (SELECT|BA_WAS_SEL)) == 0) || (ELEM(mode, SNAP_ALL, SNAP_NOT_OBEDIT) && base != BASACT)) ) { Object *ob = base->object; if (ob->transflag & OB_DUPLI) @@ -1682,7 +1682,7 @@ void addDepthPeel(ListBase *depth_peels, float depth, float p[3], float no[3], O peel->flag = 0; } -int peelDerivedMesh(Object *ob, DerivedMesh *dm, float obmat[][4], float ray_start[3], float ray_normal[3], float mval[2], ListBase *depth_peels) +int peelDerivedMesh(Object *ob, DerivedMesh *dm, float obmat[][4], float ray_start[3], float ray_normal[3], float UNUSED(mval[2]), ListBase *depth_peels) { int retval = 0; int totvert = dm->getNumVerts(dm); diff --git a/source/blender/editors/util/editmode_undo.c b/source/blender/editors/util/editmode_undo.c index 290c8a64881..debb8cedd07 100644 --- a/source/blender/editors/util/editmode_undo.c +++ b/source/blender/editors/util/editmode_undo.c @@ -37,6 +37,7 @@ #include "DNA_object_types.h" #include "DNA_screen_types.h" +#include "BKE_utildefines.h" #include "BKE_context.h" #include "BKE_depsgraph.h" #include "BKE_global.h" @@ -74,7 +75,7 @@ void undo_editmode_menu(void) // history menu /* ********************************************************************* */ /* ****** XXX ***** */ -void error(const char *dummy) {} +void error(const char *UNUSED(arg)) {} /* ****** XXX ***** */ @@ -341,7 +342,7 @@ void undo_editmode_menu(bContext *C) if(event>0) undo_number(C, event); } -static void do_editmode_undohistorymenu(bContext *C, void *arg, int event) +static void do_editmode_undohistorymenu(bContext *C, void *UNUSED(arg), int event) { Object *obedit= CTX_data_edit_object(C); @@ -351,7 +352,7 @@ static void do_editmode_undohistorymenu(bContext *C, void *arg, int event) } -uiBlock *editmode_undohistorymenu(bContext *C, ARegion *ar, void *arg_unused) +uiBlock *editmode_undohistorymenu(bContext *C, ARegion *ar, void *UNUSED(arg)) { uiBlock *block; UndoElem *uel; diff --git a/source/blender/editors/util/undo.c b/source/blender/editors/util/undo.c index e5128ea784a..a4f661e9511 100644 --- a/source/blender/editors/util/undo.c +++ b/source/blender/editors/util/undo.c @@ -196,14 +196,14 @@ void ED_undo_pop_op(bContext *C, wmOperator *op) ed_undo_step(C, 0, op->type->name); } -static int ed_undo_exec(bContext *C, wmOperator *op) +static int ed_undo_exec(bContext *C, wmOperator *UNUSED(op)) { /* "last operator" should disappear, later we can tie ths with undo stack nicer */ WM_operator_stack_clear(C); return ed_undo_step(C, 1, NULL); } -static int ed_redo_exec(bContext *C, wmOperator *op) +static int ed_redo_exec(bContext *C, wmOperator *UNUSED(op)) { return ed_undo_step(C, -1, NULL); } diff --git a/source/blender/editors/uvedit/uvedit_draw.c b/source/blender/editors/uvedit/uvedit_draw.c index f1f2dd8548a..5169b096d09 100644 --- a/source/blender/editors/uvedit/uvedit_draw.c +++ b/source/blender/editors/uvedit/uvedit_draw.c @@ -113,7 +113,7 @@ static int draw_uvs_face_check(Scene *scene) return (ts->uv_selectmode == UV_SELECT_FACE); } -static void draw_uvs_shadow(SpaceImage *sima, Object *obedit) +static void draw_uvs_shadow(Object *obedit) { EditMesh *em; EditFace *efa; @@ -374,7 +374,7 @@ static void draw_uvs_stretch(SpaceImage *sima, Scene *scene, EditMesh *em, MTFac } } -static void draw_uvs_other(SpaceImage *sima, Scene *scene, Object *obedit, MTFace *activetf) +static void draw_uvs_other(Scene *scene, Object *obedit, MTFace *activetf) { Base *base; Image *curimage; @@ -440,7 +440,7 @@ static void draw_uvs(SpaceImage *sima, Scene *scene, Object *obedit) /* draw other uvs */ if(sima->flag & SI_DRAW_OTHER) - draw_uvs_other(sima, scene, obedit, activetf); + draw_uvs_other(scene, obedit, activetf); /* 1. draw shadow mesh */ @@ -838,7 +838,7 @@ void draw_uvedit_main(SpaceImage *sima, ARegion *ar, Scene *scene, Object *obedi if(show_uvedit || show_uvshadow) { if(show_uvshadow) - draw_uvs_shadow(sima, obedit); + draw_uvs_shadow(obedit); else draw_uvs(sima, scene, obedit); diff --git a/source/blender/editors/uvedit/uvedit_ops.c b/source/blender/editors/uvedit/uvedit_ops.c index 5c4564f1946..d311733e945 100644 --- a/source/blender/editors/uvedit/uvedit_ops.c +++ b/source/blender/editors/uvedit/uvedit_ops.c @@ -141,7 +141,7 @@ void ED_uvedit_assign_image(Scene *scene, Object *obedit, Image *ima, Image *pre /* dotile - 1, set the tile flag (from the space image) * 2, set the tile index for the faces. */ -void ED_uvedit_set_tile(bContext *C, Scene *scene, Object *obedit, Image *ima, int curtile) +static int uvedit_set_tile(Object *obedit, Image *ima, int curtile) { EditMesh *em; EditFace *efa; @@ -149,11 +149,14 @@ void ED_uvedit_set_tile(bContext *C, Scene *scene, Object *obedit, Image *ima, i /* verify if we have something to do */ if(!ima || !ED_uvedit_test(obedit)) - return; - + return 0; + + if((ima->tpageflag & IMA_TILES) == 0) + return 0; + /* skip assigning these procedural images... */ if(ima->type==IMA_TYPE_R_RESULT || ima->type==IMA_TYPE_COMPOSITE) - return; + return 0; em= BKE_mesh_get_editmesh((Mesh*)obedit->data); @@ -165,8 +168,9 @@ void ED_uvedit_set_tile(bContext *C, Scene *scene, Object *obedit, Image *ima, i } DAG_id_flush_update(obedit->data, OB_RECALC_DATA); - WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data); BKE_mesh_end_editmesh(obedit->data, em); + + return 1; } /*********************** space conversion *********************/ @@ -845,7 +849,8 @@ static void select_linked(Scene *scene, Image *ima, EditMesh *em, float limit[2] tf = CustomData_em_get(&em->fdata, efa->data, CD_MTFACE); if(uvedit_face_visible(scene, ima, efa, tf)) { - if(tf->flag & (TF_SEL1|TF_SEL2|TF_SEL3|TF_SEL4)) { + const char select_flag= efa->v4 ? (TF_SEL1|TF_SEL2|TF_SEL3|TF_SEL4) : (TF_SEL1|TF_SEL2|TF_SEL3); + if(tf->flag & select_flag) { stack[stacksize]= a; stacksize++; flag[a]= 1; @@ -909,12 +914,9 @@ static void select_linked(Scene *scene, Image *ima, EditMesh *em, float limit[2] else { for(a=0, efa= em->faces.first; efa; efa= efa->next, a++) { if(flag[a]) { + const char select_flag= efa->v4 ? (TF_SEL1|TF_SEL2|TF_SEL3|TF_SEL4) : (TF_SEL1|TF_SEL2|TF_SEL3); tf = CustomData_em_get(&em->fdata, efa->data, CD_MTFACE); - if(efa->v4) { - if((tf->flag & (TF_SEL1|TF_SEL2|TF_SEL3|TF_SEL4))) - break; - } - else if(tf->flag & (TF_SEL1|TF_SEL2|TF_SEL3)) + if((tf->flag & select_flag)) break; } } @@ -1052,7 +1054,7 @@ void UV_OT_align(wmOperatorType *ot) /* ******************** weld operator **************** */ -static int weld_exec(bContext *C, wmOperator *op) +static int weld_exec(bContext *C, wmOperator *UNUSED(op)) { weld_align_uv(C, 'w'); @@ -1264,7 +1266,7 @@ void UV_OT_stitch(wmOperatorType *ot) /* ******************** (de)select all operator **************** */ -static int select_inverse_exec(bContext *C, wmOperator *op) +static int select_inverse_exec(bContext *C, wmOperator *UNUSED(op)) { Scene *scene; ToolSettings *ts; @@ -1355,10 +1357,11 @@ static int select_all_exec(bContext *C, wmOperator *op) if (action == SEL_TOGGLE) { action = SEL_SELECT; for(efa= em->faces.first; efa; efa= efa->next) { + const char select_flag= efa->v4 ? (TF_SEL1|TF_SEL2|TF_SEL3|TF_SEL4) : (TF_SEL1|TF_SEL2|TF_SEL3); tf = CustomData_em_get(&em->fdata, efa->data, CD_MTFACE); if(uvedit_face_visible(scene, ima, efa, tf)) { - if(tf->flag & (TF_SEL1+TF_SEL2+TF_SEL3+TF_SEL4)) { + if(tf->flag & select_flag) { action = SEL_DESELECT; break; } @@ -1370,12 +1373,7 @@ static int select_all_exec(bContext *C, wmOperator *op) tf = CustomData_em_get(&em->fdata, efa->data, CD_MTFACE); if(uvedit_face_visible(scene, ima, efa, tf)) { - char select_flag; - - if(efa->v4) - select_flag = (TF_SEL1+TF_SEL2+TF_SEL3+TF_SEL4); - else - select_flag = (TF_SEL1+TF_SEL2+TF_SEL3); + const char select_flag= efa->v4 ? (TF_SEL1|TF_SEL2|TF_SEL3|TF_SEL4) : (TF_SEL1|TF_SEL2|TF_SEL3); switch (action) { case SEL_SELECT: @@ -1937,14 +1935,10 @@ static int unlink_selection_exec(bContext *C, wmOperator *op) tf = CustomData_em_get(&em->fdata, efa->data, CD_MTFACE); if(uvedit_face_visible(scene, ima, efa, tf)) { - if(efa->v4) { - if(~tf->flag & (TF_SEL1|TF_SEL2|TF_SEL3|TF_SEL4)) - tf->flag &= ~(TF_SEL1|TF_SEL2|TF_SEL3|TF_SEL4); - } - else { - if(~tf->flag & (TF_SEL1|TF_SEL2|TF_SEL3)) - tf->flag &= ~(TF_SEL1|TF_SEL2|TF_SEL3); - } + const char select_flag= efa->v4 ? (TF_SEL1|TF_SEL2|TF_SEL3|TF_SEL4) : (TF_SEL1|TF_SEL2|TF_SEL3); + if(~tf->flag & select_flag) + tf->flag &= ~select_flag; + } } @@ -2260,7 +2254,7 @@ void UV_OT_select_border(wmOperatorType *ot) /* ******************** circle select operator **************** */ -static void select_uv_inside_ellipse(SpaceImage *sima, Scene *scene, int select, EditFace *efa, MTFace *tface, int index, float *offset, float *ell, int select_index) +static void select_uv_inside_ellipse(Scene *scene, int select, EditFace *efa, MTFace *tface, int index, float *offset, float *ell, int select_index) { /* normalized ellipse: ell[0] = scaleX, ell[1] = scaleY */ float x, y, r2, *uv; @@ -2309,11 +2303,11 @@ int circle_select_exec(bContext *C, wmOperator *op) /* do selection */ for(efa= em->faces.first; efa; efa= efa->next) { tface= CustomData_em_get(&em->fdata, efa->data, CD_MTFACE); - select_uv_inside_ellipse(sima, scene, select, efa, tface, 0, offset, ellipse, 0); - select_uv_inside_ellipse(sima, scene, select, efa, tface, 1, offset, ellipse, 1); - select_uv_inside_ellipse(sima, scene, select, efa, tface, 2, offset, ellipse, 2); + select_uv_inside_ellipse(scene, select, efa, tface, 0, offset, ellipse, 0); + select_uv_inside_ellipse(scene, select, efa, tface, 1, offset, ellipse, 1); + select_uv_inside_ellipse(scene, select, efa, tface, 2, offset, ellipse, 2); if(efa->v4) - select_uv_inside_ellipse(sima, scene, select, efa, tface, 3, offset, ellipse, 3); + select_uv_inside_ellipse(scene, select, efa, tface, 3, offset, ellipse, 3); } if(select) EM_select_flush(em); @@ -2714,7 +2708,7 @@ void UV_OT_pin(wmOperatorType *ot) /******************* select pinned operator ***************/ -static int select_pinned_exec(bContext *C, wmOperator *op) +static int select_pinned_exec(bContext *C, wmOperator *UNUSED(op)) { Scene *scene= CTX_data_scene(C); Object *obedit= CTX_data_edit_object(C); @@ -2800,11 +2794,9 @@ static int hide_exec(bContext *C, wmOperator *op) tf->flag &= ~(TF_SEL1|TF_SEL2|TF_SEL3|TF_SEL4); } else if(em->selectmode == SCE_SELECT_FACE) { - if((tf->flag & (TF_SEL1|TF_SEL2|TF_SEL3))==0) { - if(!efa->v4) - EM_select_face(efa, 0); - else if(!(tf->flag & TF_SEL4)) - EM_select_face(efa, 0); + const char select_flag= efa->v4 ? (TF_SEL1|TF_SEL2|TF_SEL3|TF_SEL4) : (TF_SEL1|TF_SEL2|TF_SEL3); + if((tf->flag & select_flag)==0) { + EM_select_face(efa, 0); tf->flag &= ~(TF_SEL1|TF_SEL2|TF_SEL3|TF_SEL4); } } @@ -2845,9 +2837,8 @@ static int hide_exec(bContext *C, wmOperator *op) tf->flag &= ~(TF_SEL1|TF_SEL2|TF_SEL3|TF_SEL4); } else if(em->selectmode == SCE_SELECT_FACE) { - if(tf->flag & (TF_SEL1|TF_SEL2|TF_SEL3)) - EM_select_face(efa, 0); - else if(efa->v4 && tf->flag & TF_SEL4) + const char select_flag= efa->v4 ? (TF_SEL1|TF_SEL2|TF_SEL3|TF_SEL4) : (TF_SEL1|TF_SEL2|TF_SEL3); + if(tf->flag & select_flag) EM_select_face(efa, 0); tf->flag &= ~(TF_SEL1|TF_SEL2|TF_SEL3|TF_SEL4); @@ -2902,7 +2893,7 @@ void UV_OT_hide(wmOperatorType *ot) /****************** reveal operator ******************/ -static int reveal_exec(bContext *C, wmOperator *op) +static int reveal_exec(bContext *C, wmOperator *UNUSED(op)) { SpaceImage *sima= CTX_wm_space_image(C); ToolSettings *ts= CTX_data_tool_settings(C); @@ -3086,16 +3077,18 @@ static int set_tile_exec(bContext *C, wmOperator *op) { Image *ima= CTX_data_edit_image(C); int tile[2]; - - if(!ima || !(ima->tpageflag & IMA_TILES)) - return OPERATOR_CANCELLED; + Object *obedit= CTX_data_edit_object(C); RNA_int_get_array(op->ptr, "tile", tile); - ED_uvedit_set_tile(C, CTX_data_scene(C), CTX_data_edit_object(C), ima, tile[0] + ima->xrep*tile[1]); - WM_event_add_notifier(C, NC_SPACE|ND_SPACE_IMAGE, NULL); + if(uvedit_set_tile(obedit, ima, tile[0] + ima->xrep*tile[1])) { + WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data); + WM_event_add_notifier(C, NC_SPACE|ND_SPACE_IMAGE, NULL); - return OPERATOR_FINISHED; + return OPERATOR_FINISHED; + } + + return OPERATOR_CANCELLED; } static int set_tile_invoke(bContext *C, wmOperator *op, wmEvent *event) diff --git a/source/blender/editors/uvedit/uvedit_unwrap_ops.c b/source/blender/editors/uvedit/uvedit_unwrap_ops.c index 20c9fa5877b..e5e46d407c9 100644 --- a/source/blender/editors/uvedit/uvedit_unwrap_ops.c +++ b/source/blender/editors/uvedit/uvedit_unwrap_ops.c @@ -330,7 +330,7 @@ static int minimize_stretch_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -static int minimize_stretch_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int minimize_stretch_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { MinStretch *ms; @@ -425,7 +425,7 @@ void UV_OT_minimize_stretch(wmOperatorType *ot) /* ******************** Pack Islands operator **************** */ -static int pack_islands_exec(bContext *C, wmOperator *op) +static int pack_islands_exec(bContext *C, wmOperator *UNUSED(op)) { Scene *scene= CTX_data_scene(C); Object *obedit= CTX_data_edit_object(C); @@ -458,7 +458,7 @@ void UV_OT_pack_islands(wmOperatorType *ot) /* ******************** Average Islands Scale operator **************** */ -static int average_islands_scale_exec(bContext *C, wmOperator *op) +static int average_islands_scale_exec(bContext *C, wmOperator *UNUSED(op)) { Scene *scene= CTX_data_scene(C); Object *obedit= CTX_data_edit_object(C); @@ -975,7 +975,7 @@ void UV_OT_from_view(wmOperatorType *ot) /********************** Reset operator ********************/ -static int reset_exec(bContext *C, wmOperator *op) +static int reset_exec(bContext *C, wmOperator *UNUSED(op)) { Scene *scene= CTX_data_scene(C); Object *obedit= CTX_data_edit_object(C); diff --git a/source/blender/freestyle/intern/stroke/Canvas.cpp b/source/blender/freestyle/intern/stroke/Canvas.cpp index d536bd7f5b4..d67f05ddb92 100755 --- a/source/blender/freestyle/intern/stroke/Canvas.cpp +++ b/source/blender/freestyle/intern/stroke/Canvas.cpp @@ -403,7 +403,7 @@ int rowbytes = w*4; // h = pyramid.height(i); //soc QImage qtmp(ow, oh, QImage::Format_RGB32); - ImBuf *qtmp = IMB_allocImBuf(ow, oh, 32, IB_rect, 0); + ImBuf *qtmp = IMB_allocImBuf(ow, oh, 32, IB_rect); //int k = (1<<i); for(y=0;y<oh;++y){ diff --git a/source/blender/freestyle/intern/system/PythonInterpreter.h b/source/blender/freestyle/intern/system/PythonInterpreter.h index ee2f2085d12..934755b8231 100755 --- a/source/blender/freestyle/intern/system/PythonInterpreter.h +++ b/source/blender/freestyle/intern/system/PythonInterpreter.h @@ -77,7 +77,7 @@ class LIB_SYSTEM_EXPORT PythonInterpreter : public Interpreter int status = BPY_run_python_script(_context, fn, NULL, reports); #else int status; - Text *text = add_text(fn, G.sce); + Text *text = add_text(fn, G.main->name); if (text) { status = BPY_run_python_script(_context, NULL, text, reports); unlink_text(G.main, text); diff --git a/source/blender/freestyle/intern/view_map/SteerableViewMap.cpp b/source/blender/freestyle/intern/view_map/SteerableViewMap.cpp index d1d9eb71e77..6b76c2512f0 100755 --- a/source/blender/freestyle/intern/view_map/SteerableViewMap.cpp +++ b/source/blender/freestyle/intern/view_map/SteerableViewMap.cpp @@ -220,7 +220,7 @@ void SteerableViewMap::saveSteerableViewMap() const { for(int j=0; j<_imagesPyramids[i]->getNumberOfLevels(); ++j){ //soc float coeff = 1;//1/255.f; //100*255;//*pow(2,j); //soc QImage qtmp(ow, oh, QImage::Format_RGB32); - ImBuf *ibuf = IMB_allocImBuf(ow, oh, 32, IB_rect, 0); + ImBuf *ibuf = IMB_allocImBuf(ow, oh, 32, IB_rect); int rowbytes = ow*4; char *pix; diff --git a/source/blender/gpu/GPU_draw.h b/source/blender/gpu/GPU_draw.h index 92bf43e9a5a..1f1bbab9abf 100644 --- a/source/blender/gpu/GPU_draw.h +++ b/source/blender/gpu/GPU_draw.h @@ -114,7 +114,7 @@ void GPU_paint_set_mipmap(int mipmap); void GPU_paint_update_image(struct Image *ima, int x, int y, int w, int h, int mipmap); void GPU_update_images_framechange(void); int GPU_update_image_time(struct Image *ima, double time); -int GPU_verify_image(struct Image *ima, struct ImageUser *iuser, int tftile, int tfmode, int compare, int mipmap); +int GPU_verify_image(struct Image *ima, struct ImageUser *iuser, int tftile, int compare, int mipmap); void GPU_free_image(struct Image *ima); void GPU_free_images(void); void GPU_free_images_anim(void); diff --git a/source/blender/gpu/intern/gpu_buffers.c b/source/blender/gpu/intern/gpu_buffers.c index 5bddb42add2..90c33f68c65 100644 --- a/source/blender/gpu/intern/gpu_buffers.c +++ b/source/blender/gpu/intern/gpu_buffers.c @@ -592,8 +592,8 @@ void GPU_update_grid_buffers(void *buffers_v, DMGridData **grids, //printf("node updated %p\n", buffers_v); } -void *GPU_build_grid_buffers(DMGridData **grids, - int *grid_indices, int totgrid, int gridsize) +void *GPU_build_grid_buffers(DMGridData **UNUSED(grids), int *UNUSED(grid_indices), + int totgrid, int gridsize) { GPU_Buffers *buffers; int i, j, k, totquad, offset= 0; @@ -852,7 +852,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 *user ) +void GPU_buffer_copy_vertex(DerivedMesh *dm, float *varray, int *index, int *redir, void *UNUSED(user)) { int start; int i, j, numfaces; @@ -901,7 +901,7 @@ GPUBuffer *GPU_buffer_vertex( DerivedMesh *dm ) 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 *user ) +void GPU_buffer_copy_normal(DerivedMesh *dm, float *varray, int *index, int *redir, void *UNUSED(user)) { int i, numfaces; int start; @@ -965,7 +965,7 @@ GPUBuffer *GPU_buffer_normal( DerivedMesh *dm ) 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 *user ) +void GPU_buffer_copy_uv(DerivedMesh *dm, float *varray, int *index, int *redir, void *UNUSED(user)) { int start; int i, numfaces; @@ -1107,7 +1107,7 @@ GPUBuffer *GPU_buffer_color( DerivedMesh *dm ) return result; } -void GPU_buffer_copy_edge( DerivedMesh *dm, float *varray, int *index, int *redir, void *user ) +void GPU_buffer_copy_edge(DerivedMesh *dm, float *varray, int *UNUSED(index), int *UNUSED(redir), void *UNUSED(user)) { int i; @@ -1135,7 +1135,7 @@ GPUBuffer *GPU_buffer_edge( DerivedMesh *dm ) 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 *index, int *redir, void *user ) +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; diff --git a/source/blender/gpu/intern/gpu_codegen.c b/source/blender/gpu/intern/gpu_codegen.c index d596f573682..34cf62462a7 100644 --- a/source/blender/gpu/intern/gpu_codegen.c +++ b/source/blender/gpu/intern/gpu_codegen.c @@ -686,7 +686,7 @@ static void codegen_call_functions(DynStr *ds, ListBase *nodes, GPUOutput *final BLI_dynstr_append(ds, ";\n"); } -static char *code_generate_fragment(ListBase *nodes, GPUOutput *output, const char *name) +static char *code_generate_fragment(ListBase *nodes, GPUOutput *output, const char *UNUSED(name)) { DynStr *ds = BLI_dynstr_new(); char *code; @@ -916,7 +916,7 @@ GPUNode *GPU_node_begin(char *name) return node; } -void GPU_node_end(GPUNode *node) +void GPU_node_end(GPUNode *UNUSED(node)) { /* empty */ } @@ -1036,7 +1036,7 @@ static void gpu_node_input_socket(GPUNode *node, GPUNodeStack *sock) } } -void GPU_node_output(GPUNode *node, int type, char *name, GPUNodeLink **link) +void GPU_node_output(GPUNode *node, int type, char *UNUSED(name), GPUNodeLink **link) { GPUOutput *output = MEM_callocN(sizeof(GPUOutput), "GPUOutput"); diff --git a/source/blender/gpu/intern/gpu_draw.c b/source/blender/gpu/intern/gpu_draw.c index 55522ea18b9..a93d8cbbb8e 100644 --- a/source/blender/gpu/intern/gpu_draw.c +++ b/source/blender/gpu/intern/gpu_draw.c @@ -394,7 +394,7 @@ static void gpu_verify_reflection(Image *ima) } } -int GPU_verify_image(Image *ima, ImageUser *iuser, int tftile, int tfmode, int compare, int mipmap) +int GPU_verify_image(Image *ima, ImageUser *iuser, int tftile, int compare, int mipmap) { ImBuf *ibuf = NULL; unsigned int *bind = NULL; @@ -593,7 +593,7 @@ int GPU_set_tpage(MTFace *tface, int mipmap) gpu_verify_alpha_mode(tface); gpu_verify_reflection(ima); - if(GPU_verify_image(ima, NULL, tface->tile, tface->mode, 1, mipmap)) { + if(GPU_verify_image(ima, NULL, tface->tile, 1, mipmap)) { GTS.curtile= GTS.tile; GTS.curima= GTS.ima; GTS.curtilemode= GTS.tilemode; diff --git a/source/blender/gpu/intern/gpu_extensions.c b/source/blender/gpu/intern/gpu_extensions.c index fa8ff7a6354..c6b8a43918c 100644 --- a/source/blender/gpu/intern/gpu_extensions.c +++ b/source/blender/gpu/intern/gpu_extensions.c @@ -484,7 +484,7 @@ GPUTexture *GPU_texture_from_blender(Image *ima, ImageUser *iuser, double time, glGetIntegerv(GL_TEXTURE_BINDING_2D, &lastbindcode); GPU_update_image_time(ima, time); - bindcode = GPU_verify_image(ima, iuser, 0, 0, 0, mipmap); + bindcode = GPU_verify_image(ima, iuser, 0, 0, mipmap); if(ima->gputexture) { ima->gputexture->bindcode = bindcode; @@ -744,7 +744,7 @@ void GPU_framebuffer_texture_detach(GPUFrameBuffer *fb, GPUTexture *tex) tex->fb = NULL; } -void GPU_framebuffer_texture_bind(GPUFrameBuffer *fb, GPUTexture *tex) +void GPU_framebuffer_texture_bind(GPUFrameBuffer *UNUSED(fb), GPUTexture *tex) { /* push attributes */ glPushAttrib(GL_ENABLE_BIT); @@ -766,7 +766,7 @@ void GPU_framebuffer_texture_bind(GPUFrameBuffer *fb, GPUTexture *tex) glLoadIdentity(); } -void GPU_framebuffer_texture_unbind(GPUFrameBuffer *fb, GPUTexture *tex) +void GPU_framebuffer_texture_unbind(GPUFrameBuffer *UNUSED(fb), GPUTexture *UNUSED(tex)) { /* restore matrix */ glMatrixMode(GL_PROJECTION); @@ -1063,7 +1063,7 @@ int GPU_shader_get_uniform(GPUShader *shader, char *name) return glGetUniformLocationARB(shader->object, name); } -void GPU_shader_uniform_vector(GPUShader *shader, int location, int length, int arraysize, float *value) +void GPU_shader_uniform_vector(GPUShader *UNUSED(shader), int location, int length, int arraysize, float *value) { if(location == -1) return; @@ -1080,7 +1080,7 @@ void GPU_shader_uniform_vector(GPUShader *shader, int location, int length, int GPU_print_error("Post Uniform Vector"); } -void GPU_shader_uniform_texture(GPUShader *shader, int location, GPUTexture *tex) +void GPU_shader_uniform_texture(GPUShader *UNUSED(shader), int location, GPUTexture *tex) { GLenum arbnumber; diff --git a/source/blender/ikplugin/intern/iksolver_plugin.c b/source/blender/ikplugin/intern/iksolver_plugin.c index 9c0f151aa8b..c0c4cd9bc6c 100644 --- a/source/blender/ikplugin/intern/iksolver_plugin.c +++ b/source/blender/ikplugin/intern/iksolver_plugin.c @@ -50,7 +50,7 @@ /* allocates PoseTree, and links that to root bone/channel */ /* Note: detecting the IK chain is duplicate code... in drawarmature.c and in transform_conversions.c */ -static void initialize_posetree(struct Object *ob, bPoseChannel *pchan_tip) +static void initialize_posetree(struct Object *UNUSED(ob), bPoseChannel *pchan_tip) { bPoseChannel *curchan, *pchan_root=NULL, *chanlist[256], **oldchan; PoseTree *tree; @@ -488,7 +488,7 @@ static void free_posetree(PoseTree *tree) ///---------------------------------------- /// Plugin API for legacy iksolver -void iksolver_initialize_tree(struct Scene *scene, struct Object *ob, float ctime) +void iksolver_initialize_tree(struct Scene *UNUSED(scene), struct Object *ob, float UNUSED(ctime)) { bPoseChannel *pchan; diff --git a/source/blender/imbuf/IMB_imbuf.h b/source/blender/imbuf/IMB_imbuf.h index d8c7be06aa1..4a9adaf59fd 100644 --- a/source/blender/imbuf/IMB_imbuf.h +++ b/source/blender/imbuf/IMB_imbuf.h @@ -118,8 +118,7 @@ void IMB_freeImBuf(struct ImBuf *ibuf); * @attention Defined in allocimbuf.c */ struct ImBuf *IMB_allocImBuf(unsigned int x, unsigned int y, - unsigned char d, unsigned int flags, - unsigned char bitmap); + unsigned char d, unsigned int flags); /** * diff --git a/source/blender/imbuf/intern/allocimbuf.c b/source/blender/imbuf/intern/allocimbuf.c index e67c319e61a..53828ed8ea8 100644 --- a/source/blender/imbuf/intern/allocimbuf.c +++ b/source/blender/imbuf/intern/allocimbuf.c @@ -324,7 +324,7 @@ short imb_addtilesImBuf(ImBuf *ibuf) return (ibuf->tiles != NULL); } -ImBuf *IMB_allocImBuf(unsigned int x, unsigned int y, uchar d, unsigned int flags, uchar bitmap) /* XXX bitmap argument is deprecated */ +ImBuf *IMB_allocImBuf(unsigned int x, unsigned int y, uchar d, unsigned int flags) { ImBuf *ibuf; @@ -384,7 +384,7 @@ ImBuf *IMB_dupImBuf(ImBuf *ibuf1) y = ibuf1->y; if(ibuf1->flags & IB_fields) y *= 2; - ibuf2 = IMB_allocImBuf(x, y, ibuf1->depth, flags, 0); + ibuf2 = IMB_allocImBuf(x, y, ibuf1->depth, flags); if(ibuf2 == NULL) return NULL; if(flags & IB_rect) diff --git a/source/blender/imbuf/intern/anim.c b/source/blender/imbuf/intern/anim.c index 096ed499f85..8df0d69bcfa 100644 --- a/source/blender/imbuf/intern/anim.c +++ b/source/blender/imbuf/intern/anim.c @@ -63,6 +63,7 @@ #include "MEM_guardedalloc.h" #include "DNA_userdef_types.h" +#include "BKE_utildefines.h" #include "BKE_global.h" #include "BKE_depsgraph.h" @@ -163,7 +164,7 @@ static ImBuf * movie_fetchibuf(struct anim * anim, int position) { if (anim == 0) return (0); - ibuf = IMB_allocImBuf(anim->x, anim->y, 24, IB_rect, 0); + ibuf = IMB_allocImBuf(anim->x, anim->y, 24, IB_rect); if ( mvReadFrames(anim->track, position, 1, ibuf->x * ibuf->y * sizeof(int), ibuf->rect ) != DM_SUCCESS ) { @@ -214,14 +215,14 @@ int ismovie(char *name) { #else -int ismovie(char *name) { +int ismovie(char *UNUSED(name)) { return 0; } /* never called, just keep the linker happy */ -static int startmovie(struct anim * anim) { return 1; } -static ImBuf * movie_fetchibuf(struct anim * anim, int position) { return NULL; } -static void free_anim_movie(struct anim * anim) { ; } +static int startmovie(struct anim *UNUSED(anim)) { return 1; } +static ImBuf * movie_fetchibuf(struct anim *UNUSED(anim), int UNUSED(position)) { return NULL; } +static void free_anim_movie(struct anim *UNUSED(anim)) { ; } #endif @@ -483,7 +484,7 @@ static ImBuf * avi_fetchibuf (struct anim *anim, int position) { #else if (1) { #endif - ibuf = IMB_allocImBuf (anim->x, anim->y, 24, IB_rect, 0); + ibuf = IMB_allocImBuf (anim->x, anim->y, 24, IB_rect); tmp = AVI_read_frame (anim->avi, AVI_FORMAT_RGB32, position, AVI_get_stream(anim->avi, AVIST_VIDEO, 0)); @@ -809,7 +810,7 @@ static ImBuf * ffmpeg_fetchibuf(struct anim * anim, int position) { if (anim == 0) return (0); - ibuf = IMB_allocImBuf(anim->x, anim->y, 32, IB_rect, 0); + ibuf = IMB_allocImBuf(anim->x, anim->y, 32, IB_rect); avpicture_fill((AVPicture*) anim->pFrameRGB, (unsigned char*) ibuf->rect, @@ -998,7 +999,7 @@ static ImBuf * redcode_fetchibuf(struct anim * anim, int position) { } ibuf = IMB_allocImBuf(raw_frame->width * 2, - raw_frame->height * 2, 32, IB_rectfloat, 0); + raw_frame->height * 2, 32, IB_rectfloat); redcode_decode_video_float(raw_frame, ibuf->rect_float, 1); @@ -1050,31 +1051,31 @@ static struct ImBuf * anim_getnew(struct anim * anim) { break; case ANIM_MOVIE: if (startmovie(anim)) return (0); - ibuf = IMB_allocImBuf (anim->x, anim->y, 24, 0, 0); /* fake */ + ibuf = IMB_allocImBuf (anim->x, anim->y, 24, 0); /* fake */ break; case ANIM_AVI: if (startavi(anim)) { printf("couldnt start avi\n"); return (0); } - ibuf = IMB_allocImBuf (anim->x, anim->y, 24, 0, 0); + ibuf = IMB_allocImBuf (anim->x, anim->y, 24, 0); break; #ifdef WITH_QUICKTIME case ANIM_QTIME: if (startquicktime(anim)) return (0); - ibuf = IMB_allocImBuf (anim->x, anim->y, 24, 0, 0); + ibuf = IMB_allocImBuf (anim->x, anim->y, 24, 0); break; #endif #ifdef WITH_FFMPEG case ANIM_FFMPEG: if (startffmpeg(anim)) return (0); - ibuf = IMB_allocImBuf (anim->x, anim->y, 24, 0, 0); + ibuf = IMB_allocImBuf (anim->x, anim->y, 24, 0); break; #endif #ifdef WITH_REDCODE case ANIM_REDCODE: if (startredcode(anim)) return (0); - ibuf = IMB_allocImBuf (8, 8, 32, 0, 0); + ibuf = IMB_allocImBuf (8, 8, 32, 0); break; #endif } diff --git a/source/blender/imbuf/intern/bmp.c b/source/blender/imbuf/intern/bmp.c index 450b09c923b..10dc23b1ad2 100644 --- a/source/blender/imbuf/intern/bmp.c +++ b/source/blender/imbuf/intern/bmp.c @@ -108,6 +108,8 @@ struct ImBuf *imb_bmp_decode(unsigned char *mem, size_t size, int flags) int x, y, depth, skip, i; unsigned char *bmp, *rect; unsigned short col; + + (void)size; /* unused */ if (checkbmp(mem) == 0) return(0); @@ -129,9 +131,9 @@ struct ImBuf *imb_bmp_decode(unsigned char *mem, size_t size, int flags) /* printf("skip: %d, x: %d y: %d, depth: %d (%x)\n", skip, x, y, depth, bmi.biBitCount); */ if (flags & IB_test) { - ibuf = IMB_allocImBuf(x, y, depth, 0, 0); + ibuf = IMB_allocImBuf(x, y, depth, 0); } else { - ibuf = IMB_allocImBuf(x, y, depth, IB_rect, 0); + ibuf = IMB_allocImBuf(x, y, depth, IB_rect); bmp = mem + skip; rect = (unsigned char *) ibuf->rect; @@ -199,6 +201,8 @@ int imb_savebmp(struct ImBuf *ibuf, char *name, int flags) { int bytesize, extrabytes, x, y, t, ptr; uchar *data; FILE *ofile; + + (void)flags; /* unused */ extrabytes = (4 - ibuf->x*3 % 4) % 4; bytesize = (ibuf->x * 3 + extrabytes) * ibuf->y; diff --git a/source/blender/imbuf/intern/cineon/cineon_dpx.c b/source/blender/imbuf/intern/cineon/cineon_dpx.c index a9b229536cb..7a5a3fb011b 100644 --- a/source/blender/imbuf/intern/cineon/cineon_dpx.c +++ b/source/blender/imbuf/intern/cineon/cineon_dpx.c @@ -88,7 +88,7 @@ static struct ImBuf *imb_load_dpx_cineon(unsigned char *mem, int use_cineon, int return NULL; } - ibuf = IMB_allocImBuf(width, height, 32, IB_rectfloat | flags, 0); + ibuf = IMB_allocImBuf(width, height, 32, IB_rectfloat | flags); row = MEM_mallocN(sizeof(unsigned short)*width*depth, "row in cineon_dpx.c"); frow = ibuf->rect_float+width*height*4; @@ -125,6 +125,8 @@ static int imb_save_dpx_cineon(ImBuf *buf, char *filename, int use_cineon, int f int i, j; int index; float *fline; + + (void)flags; /* unused */ cineon_conversion_parameters(&conversion); diff --git a/source/blender/imbuf/intern/cineon/cineonlib.c b/source/blender/imbuf/intern/cineon/cineonlib.c index 9c9156a4dd9..a2a0fae526d 100644 --- a/source/blender/imbuf/intern/cineon/cineonlib.c +++ b/source/blender/imbuf/intern/cineon/cineonlib.c @@ -185,6 +185,8 @@ dumpCineonImageInfo(CineonImageInformation* imageInfo) { static void fillCineonFormatInfo(CineonFile* cineon, CineonFormatInformation* formatInfo) { + (void)cineon; /* unused */ + formatInfo->interleave = 0; formatInfo->packing = 5; formatInfo->signage = 0; @@ -238,6 +240,8 @@ dumpCineonFormatInfo(CineonFormatInformation* formatInfo) { static void fillCineonOriginationInfo(CineonFile* cineon, CineonOriginationInformation* originInfo, CineonFileInformation* fileInfo) { + + (void)cineon; /* unused */ originInfo->x_offset = htonl(0); originInfo->y_offset = htonl(0); diff --git a/source/blender/imbuf/intern/cineon/dpxlib.c b/source/blender/imbuf/intern/cineon/dpxlib.c index 365d56939ed..ade69b4d7c0 100644 --- a/source/blender/imbuf/intern/cineon/dpxlib.c +++ b/source/blender/imbuf/intern/cineon/dpxlib.c @@ -39,6 +39,8 @@ static void fillDpxChannelInfo(DpxFile* dpx, DpxChannelInformation* chan, int des) { + (void)dpx; /* unused */ + chan->signage = 0; chan->ref_low_data = htonl(0); chan->ref_low_quantity = htonf(0.0); @@ -160,7 +162,12 @@ dumpDpxImageInfo(DpxImageInformation* imageInfo) { static void fillDpxOriginationInfo( - DpxFile* dpx, DpxOriginationInformation* originInfo, DpxFileInformation* fileInfo) { + DpxFile* dpx, DpxOriginationInformation* originInfo, DpxFileInformation* fileInfo) +{ + /* unused */ + (void)dpx; + (void)originInfo; + (void)fileInfo; } static void diff --git a/source/blender/imbuf/intern/dds/dds_api.cpp b/source/blender/imbuf/intern/dds/dds_api.cpp index 2e224893271..08f60589977 100644 --- a/source/blender/imbuf/intern/dds/dds_api.cpp +++ b/source/blender/imbuf/intern/dds/dds_api.cpp @@ -104,7 +104,7 @@ struct ImBuf *imb_load_dds(unsigned char *mem, size_t size, int flags) // TODO use the image RGB or RGBA tag to determine the bits per pixel if (dds.hasAlpha()) bits_per_pixel = 32; else bits_per_pixel = 24; - ibuf = IMB_allocImBuf(dds.width(), dds.height(), bits_per_pixel, 0, 0); + ibuf = IMB_allocImBuf(dds.width(), dds.height(), bits_per_pixel, 0); if (ibuf == 0) return(0); /* memory allocation failed */ ibuf->ftype = DDS; diff --git a/source/blender/imbuf/intern/divers.c b/source/blender/imbuf/intern/divers.c index 7b3a07f10ad..dfe316628f6 100644 --- a/source/blender/imbuf/intern/divers.c +++ b/source/blender/imbuf/intern/divers.c @@ -50,8 +50,8 @@ void IMB_de_interlace(struct ImBuf *ibuf) if (ibuf->rect) { /* make copies */ - tbuf1 = IMB_allocImBuf(ibuf->x, ibuf->y / 2, 32, IB_rect, 0); - tbuf2 = IMB_allocImBuf(ibuf->x, ibuf->y / 2, 32, IB_rect, 0); + tbuf1 = IMB_allocImBuf(ibuf->x, ibuf->y / 2, 32, IB_rect); + tbuf2 = IMB_allocImBuf(ibuf->x, ibuf->y / 2, 32, IB_rect); ibuf->x *= 2; IMB_rectcpy(tbuf1, ibuf, 0, 0, 0, 0, ibuf->x, ibuf->y); @@ -78,8 +78,8 @@ void IMB_interlace(struct ImBuf *ibuf) if (ibuf->rect) { /* make copies */ - tbuf1 = IMB_allocImBuf(ibuf->x, ibuf->y / 2, 32, IB_rect, 0); - tbuf2 = IMB_allocImBuf(ibuf->x, ibuf->y / 2, 32, IB_rect, 0); + tbuf1 = IMB_allocImBuf(ibuf->x, ibuf->y / 2, 32, IB_rect); + tbuf2 = IMB_allocImBuf(ibuf->x, ibuf->y / 2, 32, IB_rect); IMB_rectcpy(tbuf1, ibuf, 0, 0, 0, 0, ibuf->x, ibuf->y); IMB_rectcpy(tbuf2, ibuf, 0, 0, 0, tbuf2->y, ibuf->x, ibuf->y); diff --git a/source/blender/imbuf/intern/filetype.c b/source/blender/imbuf/intern/filetype.c index fb5d2f2e4d7..0702fbe3907 100644 --- a/source/blender/imbuf/intern/filetype.c +++ b/source/blender/imbuf/intern/filetype.c @@ -45,7 +45,7 @@ static int imb_ftype_default(ImFileType *type, ImBuf *ibuf) { return (ibuf->ftyp #if defined(__APPLE__) && defined(IMBUF_COCOA) static int imb_ftype_cocoa(ImFileType *type, ImBuf *ibuf) { return (ibuf->ftype & TIF); } #endif -static int imb_ftype_iris(ImFileType *type, ImBuf *ibuf) { return (ibuf->ftype == IMAGIC); } +static int imb_ftype_iris(ImFileType *type, ImBuf *ibuf) { (void)type; return (ibuf->ftype == IMAGIC); } #ifdef WITH_QUICKTIME static int imb_ftype_quicktime(ImFileType *type, ImBuf *ibuf) { return 0; } // XXX #endif diff --git a/source/blender/imbuf/intern/filter.c b/source/blender/imbuf/intern/filter.c index 3cc266e460e..3c2c276b6e4 100644 --- a/source/blender/imbuf/intern/filter.c +++ b/source/blender/imbuf/intern/filter.c @@ -380,7 +380,7 @@ void IMB_makemipmap(ImBuf *ibuf, int use_filter) while(curmap < IB_MIPMAP_LEVELS) { if(use_filter) { - ImBuf *nbuf= IMB_allocImBuf(hbuf->x, hbuf->y, 32, IB_rect, 0); + ImBuf *nbuf= IMB_allocImBuf(hbuf->x, hbuf->y, 32, IB_rect); IMB_filterN(nbuf, hbuf); ibuf->mipmap[curmap] = IMB_onehalf(nbuf); IMB_freeImBuf(nbuf); diff --git a/source/blender/imbuf/intern/imbuf_cocoa.m b/source/blender/imbuf/intern/imbuf_cocoa.m index 02c90c5bd09..9b627612d2a 100644 --- a/source/blender/imbuf/intern/imbuf_cocoa.m +++ b/source/blender/imbuf/intern/imbuf_cocoa.m @@ -93,7 +93,7 @@ struct ImBuf *imb_cocoaLoadImage(unsigned char *mem, int size, int flags) [bitmapImage setSize:bitmapSize]; /* allocate the image buffer */ - ibuf = IMB_allocImBuf(bitmapSize.width, bitmapSize.height, 32/*RGBA*/, 0, 0); + ibuf = IMB_allocImBuf(bitmapSize.width, bitmapSize.height, 32/*RGBA*/, 0); if (!ibuf) { fprintf(stderr, "imb_cocoaLoadImage: could not allocate memory for the " \ diff --git a/source/blender/imbuf/intern/iris.c b/source/blender/imbuf/intern/iris.c index 883de823745..71ba9b06cad 100644 --- a/source/blender/imbuf/intern/iris.c +++ b/source/blender/imbuf/intern/iris.c @@ -123,7 +123,8 @@ static int file_offset; static unsigned short getshort(FILE *inf) { unsigned char * buf; - + (void)inf; /* unused */ + buf = file_data + file_offset; file_offset += 2; @@ -133,6 +134,7 @@ static unsigned short getshort(FILE *inf) static unsigned int getlong(FILE *inf) { unsigned char * buf; + (void)inf; /* unused */ buf = file_data + file_offset; file_offset += 4; @@ -258,6 +260,8 @@ struct ImBuf *imb_loadiris(unsigned char *mem, size_t size, int flags) int bpp, rle, cur, badorder; ImBuf * ibuf; + (void)size; /* unused */ + if(!imb_is_a_iris(mem)) return NULL; /*printf("new iris\n");*/ @@ -283,7 +287,7 @@ struct ImBuf *imb_loadiris(unsigned char *mem, size_t size, int flags) zsize = image.zsize; if (flags & IB_test) { - ibuf = IMB_allocImBuf(image.xsize, image.ysize, 8 * image.zsize, 0, 0); + ibuf = IMB_allocImBuf(image.xsize, image.ysize, 8 * image.zsize, 0); if (ibuf) ibuf->ftype = IMAGIC; return(ibuf); } @@ -315,7 +319,7 @@ struct ImBuf *imb_loadiris(unsigned char *mem, size_t size, int flags) if (bpp == 1) { - ibuf = IMB_allocImBuf(xsize, ysize, 8 * zsize, IB_rect, 0); + ibuf = IMB_allocImBuf(xsize, ysize, 8 * zsize, IB_rect); if (ibuf->depth > 32) ibuf->depth = 32; base = ibuf->rect; zbase = (unsigned int *)ibuf->zbuf; @@ -356,7 +360,7 @@ struct ImBuf *imb_loadiris(unsigned char *mem, size_t size, int flags) } else { /* bpp == 2 */ - ibuf = IMB_allocImBuf(xsize, ysize, 32, (flags & IB_rect)|IB_rectfloat, 0); + ibuf = IMB_allocImBuf(xsize, ysize, 32, (flags & IB_rect)|IB_rectfloat); fbase = ibuf->rect_float; @@ -399,7 +403,7 @@ struct ImBuf *imb_loadiris(unsigned char *mem, size_t size, int flags) } else { if (bpp == 1) { - ibuf = IMB_allocImBuf(xsize, ysize, 8 * zsize, IB_rect, 0); + ibuf = IMB_allocImBuf(xsize, ysize, 8 * zsize, IB_rect); if (ibuf->depth > 32) ibuf->depth = 32; base = ibuf->rect; @@ -424,7 +428,7 @@ struct ImBuf *imb_loadiris(unsigned char *mem, size_t size, int flags) } else { /* bpp == 2 */ - ibuf = IMB_allocImBuf(xsize, ysize, 32, (flags & IB_rect)|IB_rectfloat, 0); + ibuf = IMB_allocImBuf(xsize, ysize, 32, (flags & IB_rect)|IB_rectfloat); fbase = ibuf->rect_float; diff --git a/source/blender/imbuf/intern/jp2.c b/source/blender/imbuf/intern/jp2.c index a70c154014a..0403d0044f5 100644 --- a/source/blender/imbuf/intern/jp2.c +++ b/source/blender/imbuf/intern/jp2.c @@ -189,7 +189,7 @@ struct ImBuf *imb_jp2_decode(unsigned char *mem, size_t size, int flags) float_divs[i]= (1<<image->comps[i].prec)-1; } - ibuf= IMB_allocImBuf(w, h, depth, use_float ? IB_rectfloat : IB_rect, 0); + ibuf= IMB_allocImBuf(w, h, depth, use_float ? IB_rectfloat : IB_rect); if (ibuf==NULL) { if(dinfo) @@ -670,6 +670,8 @@ int imb_savejp2(struct ImBuf *ibuf, char *name, int flags) { opj_event_mgr_t event_mgr; /* event manager */ opj_image_t *image = NULL; + (void)flags; /* unused */ + /* configure the event callbacks (not required) setting of each callback is optionnal diff --git a/source/blender/imbuf/intern/jpeg.c b/source/blender/imbuf/intern/jpeg.c index 0a070646fd5..e7737e68fce 100644 --- a/source/blender/imbuf/intern/jpeg.c +++ b/source/blender/imbuf/intern/jpeg.c @@ -132,6 +132,7 @@ typedef my_source_mgr * my_src_ptr; static void init_source(j_decompress_ptr cinfo) { + (void)cinfo; /* unused */ } @@ -165,6 +166,7 @@ static void skip_input_data(j_decompress_ptr cinfo, long num_bytes) static void term_source(j_decompress_ptr cinfo) { + (void)cinfo; /* unused */ } static void memory_source(j_decompress_ptr cinfo, unsigned char *buffer, size_t size) @@ -297,9 +299,9 @@ static ImBuf * ibJpegImageFromCinfo(struct jpeg_decompress_struct * cinfo, int f if (flags & IB_test) { jpeg_abort_decompress(cinfo); - ibuf = IMB_allocImBuf(x, y, 8 * depth, 0, 0); + ibuf = IMB_allocImBuf(x, y, 8 * depth, 0); } - else if ((ibuf = IMB_allocImBuf(x, y, 8 * depth, IB_rect, 0)) == NULL) { + else if ((ibuf = IMB_allocImBuf(x, y, 8 * depth, IB_rect)) == NULL) { jpeg_abort_decompress(cinfo); } else { @@ -699,7 +701,7 @@ static int save_jstjpeg(char * name, struct ImBuf * ibuf) struct ImBuf * tbuf; int oldy, returnval; - tbuf = IMB_allocImBuf(ibuf->x, ibuf->y / 2, 24, IB_rect, 0); + tbuf = IMB_allocImBuf(ibuf->x, ibuf->y / 2, 24, IB_rect); tbuf->ftype = ibuf->ftype; tbuf->flags = ibuf->flags; diff --git a/source/blender/imbuf/intern/openexr/openexr_api.cpp b/source/blender/imbuf/intern/openexr/openexr_api.cpp index 4107f051d73..5b8c5c72802 100644 --- a/source/blender/imbuf/intern/openexr/openexr_api.cpp +++ b/source/blender/imbuf/intern/openexr/openexr_api.cpp @@ -975,7 +975,7 @@ struct ImBuf *imb_load_openexr(unsigned char *mem, size_t size, int flags) } else { - ibuf = IMB_allocImBuf(width, height, 32, 0, 0); + ibuf = IMB_allocImBuf(width, height, 32, 0); ibuf->ftype = OPENEXR; /* openEXR is linear as per EXR spec */ diff --git a/source/blender/imbuf/intern/openexr/openexr_multi.h b/source/blender/imbuf/intern/openexr/openexr_multi.h index c66abe76289..e96b52e121d 100644 --- a/source/blender/imbuf/intern/openexr/openexr_multi.h +++ b/source/blender/imbuf/intern/openexr/openexr_multi.h @@ -67,24 +67,27 @@ void IMB_exr_close (void *handle); /* ugly... but we only use it on pipeline.c, render module, now */ void * IMB_exr_get_handle (void) {return NULL;} -void IMB_exr_add_channel (void *handle, const char *layname, const char *channame, int xstride, int ystride, float *rect) {} +void IMB_exr_add_channel (void *handle, const char *layname, const char *channame, int xstride, int ystride, float *rect) { (void)handle; (void)layname; (void)channame; (void)xstride; (void)ystride; (void)rect; } -int IMB_exr_begin_read (void *handle, char *filename, int *width, int *height) {return 0;} -void IMB_exr_begin_write (void *handle, char *filename, int width, int height, int compress) {} -void IMB_exrtile_begin_write (void *handle, char *filename, int mipmap, int width, int height, int tilex, int tiley) {} +int IMB_exr_begin_read (void *handle, char *filename, int *width, int *height) { (void)handle; (void)filename; (void)width; (void)height; return 0;} +void IMB_exr_begin_write (void *handle, char *filename, int width, int height, int compress) { (void)handle; (void)filename; (void)width; (void)height; (void)compress; } +void IMB_exrtile_begin_write (void *handle, char *filename, int mipmap, int width, int height, int tilex, int tiley) { (void)handle; (void)filename; (void)mipmap; (void)width; (void)height; (void)tilex; (void)tiley; } -void IMB_exr_set_channel (void *handle, char *layname, char *channame, int xstride, int ystride, float *rect) {} +void IMB_exr_set_channel (void *handle, char *layname, char *channame, int xstride, int ystride, float *rect) { (void)handle; (void)layname; (void)channame; (void)xstride; (void)ystride; (void)rect; } -void IMB_exr_read_channels (void *handle) {} -void IMB_exr_write_channels (void *handle) {} -void IMB_exrtile_write_channels (void *handle, int partx, int party, int level) {} -void IMB_exrtile_clear_channels (void *handle) {} +void IMB_exr_read_channels (void *handle) { (void)handle; } +void IMB_exr_write_channels (void *handle) { (void)handle; } +void IMB_exrtile_write_channels (void *handle, int partx, int party, int level) { (void)handle; (void)partx; (void)party; (void)level; } +void IMB_exrtile_clear_channels (void *handle) { (void)handle; } void IMB_exr_multilayer_convert (void *handle, void *base, void * (*addlayer)(void *base, char *str), - void (*addpass)(void *base, void *lay, char *str, float *rect, int totchan, char *chan_id)) {} + void (*addpass)(void *base, void *lay, char *str, float *rect, int totchan, char *chan_id)) + { + (void)handle; (void)base; (void)addlayer; (void)addpass; + } -void IMB_exr_close (void *handle) {} +void IMB_exr_close (void *handle) { (void)handle; } #endif diff --git a/source/blender/imbuf/intern/png.c b/source/blender/imbuf/intern/png.c index 6b21f20b3fb..b29a4ae0627 100644 --- a/source/blender/imbuf/intern/png.c +++ b/source/blender/imbuf/intern/png.c @@ -61,7 +61,8 @@ int imb_is_a_png(unsigned char *mem) } static void Flush(png_structp png_ptr) -{ +{ + (void)png_ptr; } static void WriteData( png_structp png_ptr, png_bytep data, png_size_t length) @@ -368,7 +369,7 @@ struct ImBuf *imb_loadpng(unsigned char *mem, size_t size, int flags) longjmp(png_jmpbuf(png_ptr), 1); } - ibuf = IMB_allocImBuf(width, height, 8 * bytesperpixel, 0, 0); + ibuf = IMB_allocImBuf(width, height, 8 * bytesperpixel, 0); if (ibuf) { ibuf->ftype = PNG; diff --git a/source/blender/imbuf/intern/radiance_hdr.c b/source/blender/imbuf/intern/radiance_hdr.c index 4064246c866..b356f56ab74 100644 --- a/source/blender/imbuf/intern/radiance_hdr.c +++ b/source/blender/imbuf/intern/radiance_hdr.c @@ -202,8 +202,8 @@ struct ImBuf *imb_loadhdr(unsigned char *mem, size_t size, int flags) ptr = (unsigned char *)strchr((char*)&mem[x+1], '\n'); ptr++; - if (flags & IB_test) ibuf = IMB_allocImBuf(width, height, 32, 0, 0); - else ibuf = IMB_allocImBuf(width, height, 32, (flags & IB_rect)|IB_rectfloat, 0); + if (flags & IB_test) ibuf = IMB_allocImBuf(width, height, 32, 0); + else ibuf = IMB_allocImBuf(width, height, 32, (flags & IB_rect)|IB_rectfloat); if (ibuf==NULL) return NULL; ibuf->ftype = RADHDR; @@ -340,6 +340,8 @@ int imb_savehdr(struct ImBuf *ibuf, char *name, int flags) int y, width=ibuf->x, height=ibuf->y; unsigned char *cp= NULL; + (void)flags; /* unused */ + if (file==NULL) return 0; writeHeader(file, width, height); diff --git a/source/blender/imbuf/intern/scaling.c b/source/blender/imbuf/intern/scaling.c index 4fccf5dae41..73dcc0c8ea9 100644 --- a/source/blender/imbuf/intern/scaling.c +++ b/source/blender/imbuf/intern/scaling.c @@ -62,7 +62,7 @@ struct ImBuf *IMB_half_x(struct ImBuf *ibuf1) if (ibuf1->x <= 1) return(IMB_dupImBuf(ibuf1)); - ibuf2 = IMB_allocImBuf((ibuf1->x)/2, ibuf1->y, ibuf1->depth, ibuf1->flags, 0); + ibuf2 = IMB_allocImBuf((ibuf1->x)/2, ibuf1->y, ibuf1->depth, ibuf1->flags); if (ibuf2==NULL) return (0); _p1 = (uchar *) ibuf1->rect; @@ -123,7 +123,7 @@ struct ImBuf *IMB_double_fast_x(struct ImBuf *ibuf1) do_rect= (ibuf1->rect != NULL); do_float= (ibuf1->rect_float != NULL); - ibuf2 = IMB_allocImBuf(2 * ibuf1->x , ibuf1->y , ibuf1->depth, ibuf1->flags, 0); + ibuf2 = IMB_allocImBuf(2 * ibuf1->x , ibuf1->y , ibuf1->depth, ibuf1->flags); if (ibuf2==NULL) return (0); p1 = (int *) ibuf1->rect; @@ -181,7 +181,7 @@ struct ImBuf *IMB_half_y(struct ImBuf *ibuf1) do_rect= (ibuf1->rect != NULL); do_float= (ibuf1->rect_float != NULL); - ibuf2 = IMB_allocImBuf(ibuf1->x , (ibuf1->y) / 2 , ibuf1->depth, ibuf1->flags, 0); + ibuf2 = IMB_allocImBuf(ibuf1->x , (ibuf1->y) / 2 , ibuf1->depth, ibuf1->flags); if (ibuf2==NULL) return (0); _p1 = (uchar *) ibuf1->rect; @@ -249,7 +249,7 @@ struct ImBuf *IMB_double_fast_y(struct ImBuf *ibuf1) do_rect= (ibuf1->rect != NULL); do_float= (ibuf1->rect_float != NULL); - ibuf2 = IMB_allocImBuf(ibuf1->x , 2 * ibuf1->y , ibuf1->depth, ibuf1->flags, 0); + ibuf2 = IMB_allocImBuf(ibuf1->x , 2 * ibuf1->y , ibuf1->depth, ibuf1->flags); if (ibuf2==NULL) return (0); p1 = (int *) ibuf1->rect; @@ -303,7 +303,7 @@ struct ImBuf *IMB_onehalf(struct ImBuf *ibuf1) if (ibuf1->x <= 1) return(IMB_half_y(ibuf1)); if (ibuf1->y <= 1) return(IMB_half_x(ibuf1)); - ibuf2=IMB_allocImBuf((ibuf1->x)/2, (ibuf1->y)/2, ibuf1->depth, ibuf1->flags, 0); + ibuf2=IMB_allocImBuf((ibuf1->x)/2, (ibuf1->y)/2, ibuf1->depth, ibuf1->flags); if (ibuf2==NULL) return (0); p1f = ibuf1->rect_float; diff --git a/source/blender/imbuf/intern/targa.c b/source/blender/imbuf/intern/targa.c index ada1f448bfc..89a69242a46 100644 --- a/source/blender/imbuf/intern/targa.c +++ b/source/blender/imbuf/intern/targa.c @@ -238,6 +238,8 @@ int imb_savetarga(struct ImBuf * ibuf, char *name, int flags) char buf[20]; FILE *fildes; short ok = 0; + + (void)flags; /* unused */ if (ibuf == 0) return (0); if (ibuf->rect == 0) return (0); @@ -537,8 +539,8 @@ struct ImBuf *imb_loadtarga(unsigned char *mem, size_t mem_size, int flags) if (checktarga(&tga,mem) == 0) return(0); - if (flags & IB_test) ibuf = IMB_allocImBuf(tga.xsize,tga.ysize,tga.pixsize, 0, 0); - else ibuf = IMB_allocImBuf(tga.xsize,tga.ysize,(tga.pixsize + 0x7) & ~0x7, IB_rect, 0); + if (flags & IB_test) ibuf = IMB_allocImBuf(tga.xsize,tga.ysize,tga.pixsize, 0); + else ibuf = IMB_allocImBuf(tga.xsize,tga.ysize,(tga.pixsize + 0x7) & ~0x7, IB_rect); if (ibuf == 0) return(0); ibuf->ftype = TGA; diff --git a/source/blender/imbuf/intern/thumbs.c b/source/blender/imbuf/intern/thumbs.c index f3415d44ecb..8abc2e89952 100644 --- a/source/blender/imbuf/intern/thumbs.c +++ b/source/blender/imbuf/intern/thumbs.c @@ -280,7 +280,7 @@ ImBuf* IMB_thumb_create(const char* path, ThumbSize size, ThumbSource source, Im return NULL; } if (size == THB_FAIL) { - img = IMB_allocImBuf(1,1,32, IB_rect | IB_metadata, 0); + img = IMB_allocImBuf(1,1,32, IB_rect | IB_metadata); if (!img) return 0; } else { if (THB_SOURCE_IMAGE == source || THB_SOURCE_BLEND == source) { diff --git a/source/blender/imbuf/intern/thumbs_blend.c b/source/blender/imbuf/intern/thumbs_blend.c index f1f8383b85e..cd9bf9c7a3a 100644 --- a/source/blender/imbuf/intern/thumbs_blend.c +++ b/source/blender/imbuf/intern/thumbs_blend.c @@ -102,7 +102,7 @@ static ImBuf *loadblend_thumb(gzFile gzfile) return NULL; /* finally malloc and read the data */ - img= IMB_allocImBuf(size[0], size[1], 32, IB_rect | IB_metadata, 0); + img= IMB_allocImBuf(size[0], size[1], 32, IB_rect | IB_metadata); if(gzread(gzfile, img->rect, bhead[1]) != bhead[1]) { IMB_freeImBuf(img); diff --git a/source/blender/imbuf/intern/tiff.c b/source/blender/imbuf/intern/tiff.c index 5b77c6c7c36..eb5d1f2c039 100644 --- a/source/blender/imbuf/intern/tiff.c +++ b/source/blender/imbuf/intern/tiff.c @@ -93,11 +93,18 @@ typedef struct ImbTIFFMemFile { static void imb_tiff_DummyUnmapProc(thandle_t fd, tdata_t base, toff_t size) { + (void)fd; + (void)base; + (void)size; } static int imb_tiff_DummyMapProc(thandle_t fd, tdata_t* pbase, toff_t* psize) { - return (0); + (void)fd; + (void)pbase; + (void)psize; + + return (0); } /** @@ -154,6 +161,10 @@ static tsize_t imb_tiff_ReadProc(thandle_t handle, tdata_t data, tsize_t n) */ static tsize_t imb_tiff_WriteProc(thandle_t handle, tdata_t data, tsize_t n) { + (void)handle; + (void)data; + (void)n; + printf("imb_tiff_WriteProc: this function should not be called.\n"); return (-1); } @@ -368,7 +379,7 @@ static int imb_read_tiff_pixels(ImBuf *ibuf, TIFF *image, int premul) ib_flag = IB_rect; } - tmpibuf= IMB_allocImBuf(ibuf->x, ibuf->y, ibuf->depth, ib_flag, 0); + tmpibuf= IMB_allocImBuf(ibuf->x, ibuf->y, ibuf->depth, ib_flag); /* simple RGBA image */ if (!(bitspersample == 32 || bitspersample == 16)) { @@ -497,7 +508,7 @@ ImBuf *imb_loadtiff(unsigned char *mem, size_t size, int flags) ib_depth = (spp==3)?24:32; - ibuf = IMB_allocImBuf(width, height, ib_depth, 0, 0); + ibuf = IMB_allocImBuf(width, height, ib_depth, 0); if(ibuf) { ibuf->ftype = TIF; } @@ -533,7 +544,7 @@ ImBuf *imb_loadtiff(unsigned char *mem, size_t size, int flags) width= (width > 1)? width/2: 1; height= (height > 1)? height/2: 1; - hbuf= IMB_allocImBuf(width, height, 32, 0, 0); + hbuf= IMB_allocImBuf(width, height, 32, 0); hbuf->miplevel= level; hbuf->ftype= ibuf->ftype; ibuf->mipmap[level-1] = hbuf; diff --git a/source/blender/makesdna/DNA_scene_types.h b/source/blender/makesdna/DNA_scene_types.h index 3da10b0c3de..8ac93e65312 100644 --- a/source/blender/makesdna/DNA_scene_types.h +++ b/source/blender/makesdna/DNA_scene_types.h @@ -1044,6 +1044,7 @@ typedef struct Scene { #define TESTBASELIB_BGMODE(v3d, scene, base) ( ((base)->flag & SELECT) && ((base)->lay & (v3d ? v3d->lay : scene->lay)) && ((base)->object->id.lib==0) && (((base)->object->restrictflag & OB_RESTRICT_VIEW)==0)) #define BASE_EDITABLE_BGMODE(v3d, scene, base) (((base)->lay & (v3d ? v3d->lay : scene->lay)) && ((base)->object->id.lib==0) && (((base)->object->restrictflag & OB_RESTRICT_VIEW)==0)) #define BASE_SELECTABLE(v3d, base) ((base->lay & v3d->lay) && (base->object->restrictflag & (OB_RESTRICT_SELECT|OB_RESTRICT_VIEW))==0) +#define BASE_VISIBLE(v3d, base) ((base->lay & v3d->lay) && (base->object->restrictflag & OB_RESTRICT_VIEW)==0) #define FIRSTBASE scene->base.first #define LASTBASE scene->base.last #define BASACT (scene->basact) diff --git a/source/blender/makesdna/DNA_space_types.h b/source/blender/makesdna/DNA_space_types.h index ce038ee4a95..0e2eea0b942 100644 --- a/source/blender/makesdna/DNA_space_types.h +++ b/source/blender/makesdna/DNA_space_types.h @@ -318,6 +318,8 @@ typedef struct SpaceText { char findstr[256]; /* ST_MAX_FIND_STR */ char replacestr[256]; /* ST_MAX_FIND_STR */ + + void *drawcache; /* cache for faster drawing */ } SpaceText; typedef struct Script { diff --git a/source/blender/makesrna/intern/CMakeLists.txt b/source/blender/makesrna/intern/CMakeLists.txt index 1ab25d9e1be..0df9ce877cb 100644 --- a/source/blender/makesrna/intern/CMakeLists.txt +++ b/source/blender/makesrna/intern/CMakeLists.txt @@ -24,6 +24,9 @@ # # ***** END GPL LICENSE BLOCK ***** +# this warning on generated files gets annoying +STRING(REGEX REPLACE "-Wunused-parameter" "" CMAKE_C_FLAGS ${CMAKE_C_FLAGS}) + FILE(GLOB DEFSRC RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "*.c") FILE(GLOB APISRC RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "*_api.c") LIST(REMOVE_ITEM DEFSRC rna_access.c rna_define.c makesrna.c) diff --git a/source/blender/makesrna/intern/rna_animation.c b/source/blender/makesrna/intern/rna_animation.c index cee6b7f854a..9f5308cce33 100644 --- a/source/blender/makesrna/intern/rna_animation.c +++ b/source/blender/makesrna/intern/rna_animation.c @@ -206,7 +206,7 @@ static StructRNA *rna_KeyingSetInfo_register(const bContext *C, ReportList *repo ksi->generate= (have_function[2])? RKS_GEN_rna_internal: NULL; /* add and register with other info as needed */ - ANIM_keyingset_info_register(C, ksi); + ANIM_keyingset_info_register(ksi); /* return the struct-rna added */ return ksi->ext.srna; diff --git a/source/blender/makesrna/intern/rna_color.c b/source/blender/makesrna/intern/rna_color.c index 40ebc59b562..4ece93ca711 100644 --- a/source/blender/makesrna/intern/rna_color.c +++ b/source/blender/makesrna/intern/rna_color.c @@ -276,7 +276,7 @@ static void rna_ColorRamp_update(Main *bmain, Scene *scene, PointerRNA *ptr) for(node=ntree->nodes.first; node; node=node->next) { if (ELEM3(node->type, SH_NODE_VALTORGB, CMP_NODE_VALTORGB, TEX_NODE_VALTORGB)) { - ED_node_generic_update(bmain, scene, ntree, node); + ED_node_generic_update(bmain, ntree, node); } } } diff --git a/source/blender/makesrna/intern/rna_constraint.c b/source/blender/makesrna/intern/rna_constraint.c index e4726f5e92c..dee12d43144 100644 --- a/source/blender/makesrna/intern/rna_constraint.c +++ b/source/blender/makesrna/intern/rna_constraint.c @@ -1242,10 +1242,16 @@ static void rna_def_constraint_rigid_body_joint(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Axis Z", "Rotate pivot on Z axis in degrees"); RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update"); - /* XXX not sure how to wrap the two 6 element arrays for the generic joint */ - //float minLimit[6]; - //float maxLimit[6]; - + prop= RNA_def_property(srna, "limit_min", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_sdna(prop, NULL, "minLimit"); + RNA_def_property_array(prop, 6); + RNA_def_property_ui_text(prop, "Minimum Limit", ""); + + prop= RNA_def_property(srna, "limit_max", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_sdna(prop, NULL, "maxLimit"); + RNA_def_property_array(prop, 6); + RNA_def_property_ui_text(prop, "Maximum Limit", ""); + prop= RNA_def_property(srna, "use_linked_collision", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", CONSTRAINT_DISABLE_LINKED_COLLISION); RNA_def_property_ui_text(prop, "Disable Linked Collision", "Disable collision between linked bodies"); diff --git a/source/blender/makesrna/intern/rna_define.c b/source/blender/makesrna/intern/rna_define.c index 1fed1663952..0a8e0bad7f0 100644 --- a/source/blender/makesrna/intern/rna_define.c +++ b/source/blender/makesrna/intern/rna_define.c @@ -474,11 +474,12 @@ void RNA_struct_free(BlenderRNA *brna, StructRNA *srna) PropertyRNA *prop, *nextprop; PropertyRNA *parm, *nextparm; + /* if(srna->flag & STRUCT_RUNTIME) { if(RNA_struct_py_type_get(srna)) { fprintf(stderr, "RNA_struct_free '%s' freed while holding a python reference\n", srna->identifier); } - } + } */ for(prop=srna->cont.properties.first; prop; prop=nextprop) { nextprop= prop->next; diff --git a/source/blender/makesrna/intern/rna_fcurve.c b/source/blender/makesrna/intern/rna_fcurve.c index 63405e08f69..23f37f8db8e 100644 --- a/source/blender/makesrna/intern/rna_fcurve.c +++ b/source/blender/makesrna/intern/rna_fcurve.c @@ -53,7 +53,7 @@ EnumPropertyItem fmodifier_type_items[] = { {FMODIFIER_TYPE_CYCLES, "CYCLES", 0, "Cycles", ""}, {FMODIFIER_TYPE_NOISE, "NOISE", 0, "Noise", ""}, {FMODIFIER_TYPE_FILTER, "FILTER", 0, "Filter", ""}, - {FMODIFIER_TYPE_PYTHON, "PYTHON", 0, "Python", ""}, + //{FMODIFIER_TYPE_PYTHON, "PYTHON", 0, "Python", ""}, // FIXME: not implemented yet! {FMODIFIER_TYPE_LIMITS, "LIMITS", 0, "Limits", ""}, {FMODIFIER_TYPE_STEPPED, "STEPPED", 0, "Stepped Interpolation", ""}, {0, NULL, 0, NULL, NULL}}; @@ -542,14 +542,14 @@ static BezTriple *rna_FKeyframe_points_add(FCurve *fcu, float frame, float value index= insert_vert_fcurve(fcu, frame, value, flag); - return index >= 0 ? fcu->bezt + index : NULL; + return ((fcu->bezt) && (index >= 0))? (fcu->bezt + index) : NULL; } static void rna_FKeyframe_points_remove(FCurve *fcu, ReportList *reports, BezTriple *bezt, int do_fast) { int index= (int)(bezt - fcu->bezt); if (index < 0 || index >= fcu->totvert) { - BKE_report(reports, RPT_ERROR, "bezier not in fcurve."); + BKE_report(reports, RPT_ERROR, "Keyframe not in F-Curve."); return; } @@ -1320,7 +1320,7 @@ static void rna_def_fcurve_keyframe_points(BlenderRNA *brna, PropertyRNA *cprop) parm= RNA_def_float(func, "value", 0.0f, -FLT_MAX, FLT_MAX, "", "Y Value of this keyframe point", -FLT_MAX, FLT_MAX); RNA_def_property_flag(parm, PROP_REQUIRED); /* optional */ - parm= RNA_def_boolean(func, "replace", 0, "Replace", "Replace existing keyframes"); + parm= RNA_def_boolean(func, "replace", 0, "Replace", "Don't add any new keyframes, but just replace existing ones"); parm= RNA_def_boolean(func, "needed", 0, "Needed", "Only adds keyframes that are needed"); parm= RNA_def_boolean(func, "fast", 0, "Fast", "Fast keyframe insertion to avoid recalculating the curve each time"); diff --git a/source/blender/makesrna/intern/rna_image_api.c b/source/blender/makesrna/intern/rna_image_api.c index 70438ae3d8c..74d61101273 100644 --- a/source/blender/makesrna/intern/rna_image_api.c +++ b/source/blender/makesrna/intern/rna_image_api.c @@ -41,7 +41,7 @@ #include "BKE_packedFile.h" #include "BKE_main.h" #include "BKE_utildefines.h" -#include "BKE_global.h" /* grr: G.sce */ +#include "BKE_global.h" /* grr: G.main->name */ #include "IMB_imbuf.h" @@ -90,7 +90,7 @@ static void rna_Image_save(Image *image, ReportList *reports) if(ibuf) { char filename[FILE_MAXDIR + FILE_MAXFILE]; BLI_strncpy(filename, image->name, sizeof(filename)); - BLI_path_abs(filename, G.sce); + BLI_path_abs(filename, G.main->name); if(image->packedfile) { if (writePackedFile(reports, image->name, image->packedfile, 0) != RET_OK) { diff --git a/source/blender/makesrna/intern/rna_main.c b/source/blender/makesrna/intern/rna_main.c index 4053f6bd762..0dc04ed214a 100644 --- a/source/blender/makesrna/intern/rna_main.c +++ b/source/blender/makesrna/intern/rna_main.c @@ -36,19 +36,6 @@ #include "BKE_global.h" /* all the list begin functions are added manually here, Main is not in SDNA */ -static int rna_Main_debug_get(PointerRNA *ptr) -{ - return G.f & G_DEBUG; -} - - -static void rna_Main_debug_set(PointerRNA *ptr, const int value) -{ - if (value) - G.f |= G_DEBUG; - else - G.f &= ~G_DEBUG; -} static int rna_Main_is_dirty_get(PointerRNA *ptr) { @@ -324,11 +311,6 @@ void RNA_def_main(BlenderRNA *brna) RNA_def_property_boolean_funcs(prop, "rna_Main_is_dirty_get", NULL); RNA_def_property_ui_text(prop, "File is Saved", "Has the current session been saved to disk as a .blend file"); - prop= RNA_def_property(srna, "debug", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_funcs(prop, "rna_Main_debug_get", "rna_Main_debug_set"); - RNA_def_property_ui_text(prop, "Debug", "Print debugging information in console"); - - for(i=0; lists[i].name; i++) { prop= RNA_def_property(srna, lists[i].identifier, PROP_COLLECTION, PROP_NONE); diff --git a/source/blender/makesrna/intern/rna_main_api.c b/source/blender/makesrna/intern/rna_main_api.c index bb35673e388..0a82cbc1c42 100644 --- a/source/blender/makesrna/intern/rna_main_api.c +++ b/source/blender/makesrna/intern/rna_main_api.c @@ -177,7 +177,7 @@ Object *rna_Main_objects_new(Main *bmain, ReportList *reports, char* name, ID *d void rna_Main_objects_remove(Main *bmain, ReportList *reports, struct Object *object) { if(ID_REAL_USERS(object) <= 0) { - unlink_object(NULL, object); /* needed or ID pointers to this are not cleared */ + unlink_object(object); /* needed or ID pointers to this are not cleared */ free_libblock(&bmain->object, object); } else { @@ -262,7 +262,7 @@ Image *rna_Main_images_load(Main *bmain, ReportList *reports, char *filepath) Image *ima; errno= 0; - ima= BKE_add_image_file(filepath, 0); + ima= BKE_add_image_file(filepath); if(!ima) BKE_reportf(reports, RPT_ERROR, "Can't read: \"%s\", %s.", filepath, errno ? strerror(errno) : "Unsupported image format"); diff --git a/source/blender/makesrna/intern/rna_mesh.c b/source/blender/makesrna/intern/rna_mesh.c index dc3cb675f7a..95e17451e62 100644 --- a/source/blender/makesrna/intern/rna_mesh.c +++ b/source/blender/makesrna/intern/rna_mesh.c @@ -1084,7 +1084,7 @@ static CustomDataLayer *rna_Mesh_uv_texture_new(struct Mesh *me, struct bContext CustomDataLayer *cdl= NULL; int index; - if(ED_mesh_uv_texture_add(C, NULL, NULL, me, name, FALSE)) { + if(ED_mesh_uv_texture_add(C, me, name, FALSE)) { fdata= rna_mesh_fdata(me); index= CustomData_get_named_layer_index(fdata, CD_MTFACE, name); cdl= (index == -1)? NULL: &fdata->layers[index]; diff --git a/source/blender/makesrna/intern/rna_nodetree.c b/source/blender/makesrna/intern/rna_nodetree.c index a97033200de..52a19c6376f 100644 --- a/source/blender/makesrna/intern/rna_nodetree.c +++ b/source/blender/makesrna/intern/rna_nodetree.c @@ -159,7 +159,7 @@ static void rna_Image_end_frame_set(PointerRNA *ptr, int value) static void node_update(Main *bmain, Scene *scene, bNodeTree *ntree, bNode *node) { - ED_node_generic_update(bmain, scene, ntree, node); + ED_node_generic_update(bmain, ntree, node); } static void rna_Node_update(Main *bmain, Scene *scene, PointerRNA *ptr) @@ -180,7 +180,7 @@ static void rna_NodeGroup_update(Main *bmain, Scene *scene, PointerRNA *ptr) node_update(bmain, scene, ntree, node); } -static void rna_Node_update_name(Main *bmain, Scene *scene, PointerRNA *ptr) +static void rna_Node_name_set(PointerRNA *ptr, const char *value) { bNodeTree *ntree= (bNodeTree*)ptr->id.data; bNode *node= (bNode*)ptr->data; @@ -188,14 +188,14 @@ static void rna_Node_update_name(Main *bmain, Scene *scene, PointerRNA *ptr) /* make a copy of the old name first */ BLI_strncpy(oldname, node->name, sizeof(node->name)); + /* set new name */ + BLI_strncpy(node->name, value, sizeof(node->name)); 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); - - node_update(bmain, scene, ntree, node); } /* this should be done at display time! if no custom names are set */ @@ -2263,7 +2263,8 @@ static void rna_def_node(BlenderRNA *brna) prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE); RNA_def_property_ui_text(prop, "Name", "Node name"); RNA_def_struct_name_property(srna, prop); - RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update_name"); + RNA_def_property_string_funcs(prop, NULL, NULL, "rna_Node_name_set"); + RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); prop = RNA_def_property(srna, "inputs", PROP_COLLECTION, PROP_NONE); RNA_def_property_collection_sdna(prop, NULL, "inputs", NULL); diff --git a/source/blender/makesrna/intern/rna_object.c b/source/blender/makesrna/intern/rna_object.c index e74bec566d5..c29ad0d9adf 100644 --- a/source/blender/makesrna/intern/rna_object.c +++ b/source/blender/makesrna/intern/rna_object.c @@ -2152,7 +2152,7 @@ static void rna_def_object(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Pose", "Current pose for armatures"); /* shape keys */ - prop= RNA_def_property(srna, "show_shape_key", PROP_BOOLEAN, PROP_NONE); + prop= RNA_def_property(srna, "show_only_shape_key", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "shapeflag", OB_SHAPE_LOCK); RNA_def_property_ui_text(prop, "Shape Key Lock", "Always show the current Shape for this Object"); RNA_def_property_ui_icon(prop, ICON_UNPINNED, 1); diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c index b1c8dbeb761..a69fe64189e 100644 --- a/source/blender/makesrna/intern/rna_scene.c +++ b/source/blender/makesrna/intern/rna_scene.c @@ -3142,6 +3142,7 @@ static void rna_def_scene_render_data(BlenderRNA *brna) prop= RNA_def_property(srna, "use_single_layer", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "scemode", R_SINGLE_LAYER); RNA_def_property_ui_text(prop, "Single Layer", "Only render the active layer"); + RNA_def_property_ui_icon(prop, ICON_UNPINNED, 1); RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL); /* engine */ @@ -3398,7 +3399,7 @@ void RNA_def_scene(BlenderRNA *brna) prop= RNA_def_property(srna, "world", PROP_POINTER, PROP_NONE); RNA_def_property_flag(prop, PROP_EDITABLE); RNA_def_property_ui_text(prop, "World", "World used for rendering the scene"); - RNA_def_property_update(prop, NC_SCENE|NC_WORLD, NULL); + RNA_def_property_update(prop, NC_SCENE|ND_WORLD, NULL); prop= RNA_def_property(srna, "cursor_location", PROP_FLOAT, PROP_XYZ_LENGTH); RNA_def_property_float_sdna(prop, NULL, "cursor"); diff --git a/source/blender/makesrna/intern/rna_sequencer.c b/source/blender/makesrna/intern/rna_sequencer.c index c004f32f586..923f4560532 100644 --- a/source/blender/makesrna/intern/rna_sequencer.c +++ b/source/blender/makesrna/intern/rna_sequencer.c @@ -150,7 +150,7 @@ static void rna_Sequence_anim_startofs_final_set(PointerRNA *ptr, int value) seq->anim_startofs = MIN2(value, seq->len + seq->anim_startofs); - reload_sequence_new_file(G.main, scene, seq, FALSE); + reload_sequence_new_file(scene, seq, FALSE); rna_Sequence_frame_change_update(scene, seq); } @@ -161,7 +161,7 @@ static void rna_Sequence_anim_endofs_final_set(PointerRNA *ptr, int value) seq->anim_endofs = MIN2(value, seq->len + seq->anim_endofs); - reload_sequence_new_file(G.main, scene, seq, FALSE); + reload_sequence_new_file(scene, seq, FALSE); rna_Sequence_frame_change_update(scene, seq); } @@ -552,7 +552,7 @@ static void rna_Sequence_mute_update(Main *bmain, Scene *scene, PointerRNA *ptr) static void rna_Sequence_filepath_update(Main *bmain, Scene *scene, PointerRNA *ptr) { Sequence *seq= (Sequence*)(ptr->data); - reload_sequence_new_file(G.main, scene, seq, TRUE); + reload_sequence_new_file(scene, seq, TRUE); calc_sequence(scene, seq); rna_Sequence_update(bmain, scene, ptr); } diff --git a/source/blender/makesrna/intern/rna_ui_api.c b/source/blender/makesrna/intern/rna_ui_api.c index 1d86faa5e53..a230a51e792 100644 --- a/source/blender/makesrna/intern/rna_ui_api.c +++ b/source/blender/makesrna/intern/rna_ui_api.c @@ -287,7 +287,6 @@ void RNA_api_ui_layout(StructRNA *srna) RNA_def_int(func, "cols", 0, 0, INT_MAX, "Number of thumbnail preview columns to display", "", 0, INT_MAX); func= RNA_def_function(srna, "template_any_ID", "uiTemplateAnyID"); - RNA_def_function_flag(func, FUNC_USE_CONTEXT); parm= RNA_def_pointer(func, "data", "AnyType", "", "Data from which to take property."); RNA_def_property_flag(parm, PROP_REQUIRED|PROP_RNAPTR|PROP_NEVER_NULL); parm= RNA_def_string(func, "property", "", 0, "", "Identifier of property in data."); @@ -297,7 +296,6 @@ void RNA_api_ui_layout(StructRNA *srna) parm= RNA_def_string(func, "text", "", 0, "", "Custom label to display in UI."); func= RNA_def_function(srna, "template_path_builder", "uiTemplatePathBuilder"); - RNA_def_function_flag(func, FUNC_USE_CONTEXT); parm= RNA_def_pointer(func, "data", "AnyType", "", "Data from which to take property."); RNA_def_property_flag(parm, PROP_REQUIRED|PROP_RNAPTR|PROP_NEVER_NULL); parm= RNA_def_string(func, "property", "", 0, "", "Identifier of property in data."); @@ -343,17 +341,14 @@ void RNA_api_ui_layout(StructRNA *srna) func= RNA_def_function(srna, "template_histogram", "uiTemplateHistogram"); RNA_def_function_ui_description(func, "Item. A histogramm widget to analyze imaga data."); api_ui_item_rna_common(func); - RNA_def_boolean(func, "expand", 0, "", "Expand button to show more detail."); func= RNA_def_function(srna, "template_waveform", "uiTemplateWaveform"); RNA_def_function_ui_description(func, "Item. A waveform widget to analyze imaga data."); api_ui_item_rna_common(func); - RNA_def_boolean(func, "expand", 0, "", "Expand button to show more detail."); func= RNA_def_function(srna, "template_vectorscope", "uiTemplateVectorscope"); RNA_def_function_ui_description(func, "Item. A vectorscope widget to analyze imaga data."); api_ui_item_rna_common(func); - RNA_def_boolean(func, "expand", 0, "", "Expand button to show more detail."); func= RNA_def_function(srna, "template_layers", "uiTemplateLayers"); api_ui_item_rna_common(func); diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c index 18620617c87..4196b3585b3 100644 --- a/source/blender/makesrna/intern/rna_userdef.c +++ b/source/blender/makesrna/intern/rna_userdef.c @@ -221,8 +221,7 @@ static void rna_userdef_addon_remove(bAddon *bext) static void rna_userdef_temp_update(Main *bmain, Scene *scene, PointerRNA *ptr) { extern char btempdir[]; - UserDef *userdef = (UserDef*)ptr->data; - strncpy(btempdir, userdef->tempdir, FILE_MAXDIR+FILE_MAXFILE); + BLI_where_is_temp(btempdir, 1); } #else diff --git a/source/blender/makesrna/intern/rna_world.c b/source/blender/makesrna/intern/rna_world.c index ecf253acbce..726d64f26f4 100644 --- a/source/blender/makesrna/intern/rna_world.c +++ b/source/blender/makesrna/intern/rna_world.c @@ -478,9 +478,8 @@ void RNA_def_world(BlenderRNA *brna) RNA_def_property_array(prop, 3); RNA_def_property_ui_text(prop, "Horizon Color", "Color at the horizon"); /* RNA_def_property_update(prop, 0, "rna_World_update"); */ - /* render-only uses this, the notifier could be made to be more spesific */ - RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, "rna_World_update"); - + /* render-only uses this */ + RNA_def_property_update(prop, NC_WORLD|ND_WORLD_DRAW, "rna_World_update"); prop= RNA_def_property(srna, "zenith_color", PROP_FLOAT, PROP_COLOR); diff --git a/source/blender/modifiers/MOD_modifiertypes.h b/source/blender/modifiers/MOD_modifiertypes.h index a792b163eea..6063acf47f4 100644 --- a/source/blender/modifiers/MOD_modifiertypes.h +++ b/source/blender/modifiers/MOD_modifiertypes.h @@ -69,6 +69,6 @@ extern ModifierTypeInfo modifierType_Solidify; extern ModifierTypeInfo modifierType_Screw; /* MOD_util.c */ -void modifier_type_init(ModifierTypeInfo *types[], ModifierType type); +void modifier_type_init(ModifierTypeInfo *types[]); #endif //MOD_MODIFIERTYPES_H diff --git a/source/blender/modifiers/intern/MOD_armature.c b/source/blender/modifiers/intern/MOD_armature.c index 6d2a3e7098f..2f802ee67c8 100644 --- a/source/blender/modifiers/intern/MOD_armature.c +++ b/source/blender/modifiers/intern/MOD_armature.c @@ -35,6 +35,7 @@ #include "DNA_armature_types.h" #include "DNA_object_types.h" +#include "BKE_utildefines.h" #include "BKE_cdderivedmesh.h" #include "BKE_lattice.h" #include "BKE_modifier.h" @@ -63,7 +64,7 @@ static void copyData(ModifierData *md, ModifierData *target) strncpy(tamd->defgrp_name, amd->defgrp_name, 32); } -static CustomDataMask requiredDataMask(Object *ob, ModifierData *md) +static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *UNUSED(md)) { CustomDataMask dataMask = 0; @@ -73,7 +74,7 @@ static CustomDataMask requiredDataMask(Object *ob, ModifierData *md) return dataMask; } -static int isDisabled(ModifierData *md, int useRenderParams) +static int isDisabled(ModifierData *md, int UNUSED(useRenderParams)) { ArmatureModifierData *amd = (ArmatureModifierData*) md; @@ -90,9 +91,10 @@ static void foreachObjectLink( walk(userData, ob, &amd->object); } -static void updateDepgraph( - ModifierData *md, DagForest *forest, struct Scene *scene, Object *ob, - DagNode *obNode) +static void updateDepgraph(ModifierData *md, DagForest *forest, + struct Scene *UNUSED(scene), + Object *UNUSED(ob), + DagNode *obNode) { ArmatureModifierData *amd = (ArmatureModifierData*) md; @@ -104,9 +106,12 @@ static void updateDepgraph( } } -static void deformVerts( - ModifierData *md, Object *ob, DerivedMesh *derivedData, - float (*vertexCos)[3], int numVerts, int useRenderParams, int isFinalCalc) +static void deformVerts(ModifierData *md, Object *ob, + DerivedMesh *derivedData, + float (*vertexCos)[3], + int numVerts, + int UNUSED(useRenderParams), + int UNUSED(isFinalCalc)) { ArmatureModifierData *amd = (ArmatureModifierData*) md; diff --git a/source/blender/modifiers/intern/MOD_array.c b/source/blender/modifiers/intern/MOD_array.c index 8331c3474b2..839bfef6226 100644 --- a/source/blender/modifiers/intern/MOD_array.c +++ b/source/blender/modifiers/intern/MOD_array.c @@ -101,8 +101,8 @@ static void foreachObjectLink( walk(userData, ob, &amd->offset_ob); } -static void updateDepgraph(ModifierData *md, DagForest *forest, struct Scene *scene, - Object *ob, DagNode *obNode) +static void updateDepgraph(ModifierData *md, DagForest *forest, + struct Scene *UNUSED(scene), Object *UNUSED(ob), DagNode *obNode) { ArrayModifierData *amd = (ArrayModifierData*) md; @@ -731,7 +731,7 @@ static DerivedMesh *arrayModifier_doArray(ArrayModifierData *amd, static DerivedMesh *applyModifier( ModifierData *md, Object *ob, DerivedMesh *derivedData, - int useRenderParams, int isFinalCalc) + int UNUSED(useRenderParams), int UNUSED(isFinalCalc)) { DerivedMesh *result; ArrayModifierData *amd = (ArrayModifierData*) md; @@ -745,7 +745,7 @@ static DerivedMesh *applyModifier( } static DerivedMesh *applyModifierEM( - ModifierData *md, Object *ob, struct EditMesh *editData, + ModifierData *md, Object *ob, struct EditMesh *UNUSED(editData), DerivedMesh *derivedData) { return applyModifier(md, ob, derivedData, 0, 1); diff --git a/source/blender/modifiers/intern/MOD_bevel.c b/source/blender/modifiers/intern/MOD_bevel.c index 68274fbfd78..937c8cd7eac 100644 --- a/source/blender/modifiers/intern/MOD_bevel.c +++ b/source/blender/modifiers/intern/MOD_bevel.c @@ -66,7 +66,7 @@ static void copyData(ModifierData *md, ModifierData *target) strncpy(tbmd->defgrp_name, bmd->defgrp_name, 32); } -static CustomDataMask requiredDataMask(Object *ob, ModifierData *md) +static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md) { BevelModifierData *bmd = (BevelModifierData *)md; CustomDataMask dataMask = 0; @@ -77,9 +77,10 @@ static CustomDataMask requiredDataMask(Object *ob, ModifierData *md) return dataMask; } -static DerivedMesh *applyModifier( - ModifierData *md, Object *ob, DerivedMesh *derivedData, - int useRenderParams, int isFinalCalc) +static DerivedMesh *applyModifier(ModifierData *md, Object *UNUSED(ob), + DerivedMesh *derivedData, + int UNUSED(useRenderParams), + int UNUSED(isFinalCalc)) { DerivedMesh *result; BME_Mesh *bm; @@ -107,9 +108,9 @@ static DerivedMesh *applyModifier( return result; } -static DerivedMesh *applyModifierEM( - ModifierData *md, Object *ob, EditMesh *editData, - DerivedMesh *derivedData) +static DerivedMesh *applyModifierEM(ModifierData *md, Object *ob, + EditMesh *UNUSED(editData), + DerivedMesh *derivedData) { return applyModifier(md, ob, derivedData, 0, 1); } diff --git a/source/blender/modifiers/intern/MOD_boolean.c b/source/blender/modifiers/intern/MOD_boolean.c index 496523a310b..dfcfd55f3d9 100644 --- a/source/blender/modifiers/intern/MOD_boolean.c +++ b/source/blender/modifiers/intern/MOD_boolean.c @@ -32,6 +32,7 @@ #include "DNA_object_types.h" +#include "BKE_utildefines.h" #include "BKE_cdderivedmesh.h" #include "BKE_modifier.h" @@ -49,7 +50,7 @@ static void copyData(ModifierData *md, ModifierData *target) tbmd->operation = bmd->operation; } -static int isDisabled(ModifierData *md, int useRenderParams) +static int isDisabled(ModifierData *md, int UNUSED(useRenderParams)) { BooleanModifierData *bmd = (BooleanModifierData*) md; @@ -66,9 +67,10 @@ static void foreachObjectLink( walk(userData, ob, &bmd->object); } -static void updateDepgraph( - ModifierData *md, DagForest *forest, struct Scene *scene, Object *ob, - DagNode *obNode) +static void updateDepgraph(ModifierData *md, DagForest *forest, + struct Scene *UNUSED(scene), + Object *UNUSED(ob), + DagNode *obNode) { BooleanModifierData *bmd = (BooleanModifierData*) md; @@ -81,9 +83,10 @@ static void updateDepgraph( } -static DerivedMesh *applyModifier( - ModifierData *md, Object *ob, DerivedMesh *derivedData, - int useRenderParams, int isFinalCalc) +static DerivedMesh *applyModifier(ModifierData *md, Object *ob, + DerivedMesh *derivedData, + int UNUSED(useRenderParams), + int UNUSED(isFinalCalc)) { BooleanModifierData *bmd = (BooleanModifierData*) md; DerivedMesh *dm = bmd->object->derivedFinal; @@ -105,7 +108,7 @@ static DerivedMesh *applyModifier( return derivedData; } -static CustomDataMask requiredDataMask(Object *ob, ModifierData *md) +static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *UNUSED(md)) { CustomDataMask dataMask = (1 << CD_MTFACE) + (1 << CD_MEDGE); diff --git a/source/blender/modifiers/intern/MOD_build.c b/source/blender/modifiers/intern/MOD_build.c index de913d79f01..960db7fa925 100644 --- a/source/blender/modifiers/intern/MOD_build.c +++ b/source/blender/modifiers/intern/MOD_build.c @@ -65,14 +65,15 @@ static void copyData(ModifierData *md, ModifierData *target) tbmd->seed = bmd->seed; } -static int dependsOnTime(ModifierData *md) +static int dependsOnTime(ModifierData *UNUSED(md)) { return 1; } static DerivedMesh *applyModifier(ModifierData *md, Object *ob, - DerivedMesh *derivedData, - int useRenderParams, int isFinalCalc) + DerivedMesh *derivedData, + int UNUSED(useRenderParams), + int UNUSED(isFinalCalc)) { DerivedMesh *dm = derivedData; DerivedMesh *result; diff --git a/source/blender/modifiers/intern/MOD_cast.c b/source/blender/modifiers/intern/MOD_cast.c index 1872263848b..c39aa288b18 100644 --- a/source/blender/modifiers/intern/MOD_cast.c +++ b/source/blender/modifiers/intern/MOD_cast.c @@ -35,6 +35,7 @@ #include "BLI_math.h" +#include "BKE_utildefines.h" #include "BKE_deform.h" #include "BKE_DerivedMesh.h" #include "BKE_modifier.h" @@ -73,7 +74,7 @@ static void copyData(ModifierData *md, ModifierData *target) strncpy(tcmd->defgrp_name, cmd->defgrp_name, 32); } -static int isDisabled(ModifierData *md, int useRenderParams) +static int isDisabled(ModifierData *md, int UNUSED(useRenderParams)) { CastModifierData *cmd = (CastModifierData*) md; short flag; @@ -85,7 +86,7 @@ static int isDisabled(ModifierData *md, int useRenderParams) return 0; } -static CustomDataMask requiredDataMask(Object *ob, ModifierData *md) +static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md) { CastModifierData *cmd = (CastModifierData *)md; CustomDataMask dataMask = 0; @@ -106,9 +107,10 @@ static void foreachObjectLink( walk (userData, ob, &cmd->object); } -static void updateDepgraph( - ModifierData *md, DagForest *forest, struct Scene *scene, Object *ob, - DagNode *obNode) +static void updateDepgraph(ModifierData *md, DagForest *forest, + struct Scene *UNUSED(scene), + Object *UNUSED(ob), + DagNode *obNode) { CastModifierData *cmd = (CastModifierData*) md; @@ -566,14 +568,17 @@ static void cuboid_do( } } -static void deformVerts( - ModifierData *md, Object *ob, DerivedMesh *derivedData, - float (*vertexCos)[3], int numVerts, int useRenderParams, int isFinalCalc) +static void deformVerts(ModifierData *md, Object *ob, + DerivedMesh *derivedData, + float (*vertexCos)[3], + int numVerts, + int UNUSED(useRenderParams), + int UNUSED(isFinalCalc)) { DerivedMesh *dm = NULL; CastModifierData *cmd = (CastModifierData *)md; - dm = get_dm(md->scene, ob, NULL, derivedData, NULL, 0); + dm = get_dm(ob, NULL, derivedData, NULL, 0); if (cmd->type == MOD_CAST_TYPE_CUBOID) { cuboid_do(cmd, ob, dm, vertexCos, numVerts); @@ -589,7 +594,7 @@ static void deformVertsEM( ModifierData *md, Object *ob, struct EditMesh *editData, DerivedMesh *derivedData, float (*vertexCos)[3], int numVerts) { - DerivedMesh *dm = get_dm(md->scene, ob, editData, derivedData, NULL, 0); + DerivedMesh *dm = get_dm(ob, editData, derivedData, NULL, 0); CastModifierData *cmd = (CastModifierData *)md; if (cmd->type == MOD_CAST_TYPE_CUBOID) { diff --git a/source/blender/modifiers/intern/MOD_cloth.c b/source/blender/modifiers/intern/MOD_cloth.c index 1c0ab34f15c..0c6c1e87a72 100644 --- a/source/blender/modifiers/intern/MOD_cloth.c +++ b/source/blender/modifiers/intern/MOD_cloth.c @@ -36,6 +36,7 @@ #include "MEM_guardedalloc.h" +#include "BKE_utildefines.h" #include "BKE_cloth.h" #include "BKE_cdderivedmesh.h" #include "BKE_global.h" @@ -111,7 +112,7 @@ static void updateDepgraph( } } -static CustomDataMask requiredDataMask(Object *ob, ModifierData *md) +static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md) { CustomDataMask dataMask = 0; ClothModifierData *clmd = (ClothModifierData*)md; @@ -150,7 +151,7 @@ static void copyData(ModifierData *md, ModifierData *target) tclmd->clothObject = NULL; } -static int dependsOnTime(ModifierData *md) +static int dependsOnTime(ModifierData *UNUSED(md)) { return 1; } diff --git a/source/blender/modifiers/intern/MOD_collision.c b/source/blender/modifiers/intern/MOD_collision.c index 2651122231c..20319b8c65f 100644 --- a/source/blender/modifiers/intern/MOD_collision.c +++ b/source/blender/modifiers/intern/MOD_collision.c @@ -38,6 +38,7 @@ #include "BLI_math.h" +#include "BKE_utildefines.h" #include "BKE_collision.h" #include "BKE_cdderivedmesh.h" #include "BKE_global.h" @@ -94,14 +95,17 @@ static void freeData(ModifierData *md) } } -static int dependsOnTime(ModifierData *md) +static int dependsOnTime(ModifierData *UNUSED(md)) { return 1; } -static void deformVerts( - ModifierData *md, Object *ob, DerivedMesh *derivedData, - float (*vertexCos)[3], int numVerts, int useRenderParams, int isFinalCalc) +static void deformVerts(ModifierData *md, Object *ob, + DerivedMesh *derivedData, + float (*vertexCos)[3], + int UNUSED(numVerts), + int UNUSED(useRenderParams), + int UNUSED(isFinalCalc)) { CollisionModifierData *collmd = (CollisionModifierData*) md; DerivedMesh *dm = NULL; diff --git a/source/blender/modifiers/intern/MOD_curve.c b/source/blender/modifiers/intern/MOD_curve.c index 998bf375e79..8009ad0589c 100644 --- a/source/blender/modifiers/intern/MOD_curve.c +++ b/source/blender/modifiers/intern/MOD_curve.c @@ -35,6 +35,7 @@ #include "DNA_scene_types.h" #include "DNA_object_types.h" +#include "BKE_utildefines.h" #include "BKE_cdderivedmesh.h" #include "BKE_lattice.h" #include "BKE_modifier.h" @@ -59,7 +60,7 @@ static void copyData(ModifierData *md, ModifierData *target) strncpy(tcmd->name, cmd->name, 32); } -static CustomDataMask requiredDataMask(Object *ob, ModifierData *md) +static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md) { CurveModifierData *cmd = (CurveModifierData *)md; CustomDataMask dataMask = 0; @@ -70,7 +71,7 @@ static CustomDataMask requiredDataMask(Object *ob, ModifierData *md) return dataMask; } -static int isDisabled(ModifierData *md, int userRenderParams) +static int isDisabled(ModifierData *md, int UNUSED(userRenderParams)) { CurveModifierData *cmd = (CurveModifierData*) md; @@ -87,9 +88,10 @@ static void foreachObjectLink( walk(userData, ob, &cmd->object); } -static void updateDepgraph( - ModifierData *md, DagForest *forest, Scene *scene, - Object *ob, DagNode *obNode) +static void updateDepgraph(ModifierData *md, DagForest *forest, + Scene *UNUSED(scene), + Object *UNUSED(ob), + DagNode *obNode) { CurveModifierData *cmd = (CurveModifierData*) md; @@ -101,9 +103,12 @@ static void updateDepgraph( } } -static void deformVerts( - ModifierData *md, Object *ob, DerivedMesh *derivedData, - float (*vertexCos)[3], int numVerts, int useRenderParams, int isFinalCalc) +static void deformVerts(ModifierData *md, Object *ob, + DerivedMesh *derivedData, + float (*vertexCos)[3], + int numVerts, + int UNUSED(useRenderParams), + int UNUSED(isFinalCalc)) { CurveModifierData *cmd = (CurveModifierData*) md; diff --git a/source/blender/modifiers/intern/MOD_decimate.c b/source/blender/modifiers/intern/MOD_decimate.c index 03307934e00..8df0c0be3eb 100644 --- a/source/blender/modifiers/intern/MOD_decimate.c +++ b/source/blender/modifiers/intern/MOD_decimate.c @@ -34,6 +34,7 @@ #include "BLI_math.h" +#include "BKE_utildefines.h" #include "BKE_cdderivedmesh.h" #include "BKE_mesh.h" #include "BKE_modifier.h" @@ -59,9 +60,10 @@ static void copyData(ModifierData *md, ModifierData *target) tdmd->percent = dmd->percent; } -static DerivedMesh *applyModifier( - ModifierData *md, Object *ob, DerivedMesh *derivedData, - int useRenderParams, int isFinalCalc) +static DerivedMesh *applyModifier(ModifierData *md, Object *UNUSED(ob), + DerivedMesh *derivedData, + int UNUSED(useRenderParams), + int UNUSED(isFinalCalc)) { DecimateModifierData *dmd = (DecimateModifierData*) md; DerivedMesh *dm = derivedData, *result = NULL; diff --git a/source/blender/modifiers/intern/MOD_displace.c b/source/blender/modifiers/intern/MOD_displace.c index 2e811eb742d..95e8a9ce4cc 100644 --- a/source/blender/modifiers/intern/MOD_displace.c +++ b/source/blender/modifiers/intern/MOD_displace.c @@ -35,6 +35,7 @@ #include "BLI_math.h" +#include "BKE_utildefines.h" #include "BKE_cdderivedmesh.h" #include "BKE_modifier.h" #include "BKE_texture.h" @@ -75,7 +76,7 @@ static void copyData(ModifierData *md, ModifierData *target) strncpy(tdmd->uvlayer_name, dmd->uvlayer_name, 32); } -static CustomDataMask requiredDataMask(Object *ob, ModifierData *md) +static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md) { DisplaceModifierData *dmd = (DisplaceModifierData *)md; CustomDataMask dataMask = 0; @@ -127,16 +128,17 @@ static void foreachIDLink(ModifierData *md, Object *ob, foreachObjectLink(md, ob, (ObjectWalkFunc)walk, userData); } -static int isDisabled(ModifierData *md, int useRenderParams) +static int isDisabled(ModifierData *md, int UNUSED(useRenderParams)) { DisplaceModifierData *dmd = (DisplaceModifierData*) md; return (!dmd->texture || dmd->strength == 0.0f); } -static void updateDepgraph( - ModifierData *md, DagForest *forest, struct Scene *scene, - Object *ob, DagNode *obNode) +static void updateDepgraph(ModifierData *md, DagForest *forest, + struct Scene *UNUSED(scene), + Object *UNUSED(ob), + DagNode *obNode) { DisplaceModifierData *dmd = (DisplaceModifierData*) md; @@ -308,11 +310,14 @@ static void displaceModifier_do( MEM_freeN(tex_co); } -static void deformVerts( - ModifierData *md, Object *ob, DerivedMesh *derivedData, - float (*vertexCos)[3], int numVerts, int useRenderParams, int isFinalCalc) +static void deformVerts(ModifierData *md, Object *ob, + DerivedMesh *derivedData, + float (*vertexCos)[3], + int numVerts, + int UNUSED(useRenderParams), + int UNUSED(isFinalCalc)) { - DerivedMesh *dm= get_cddm(md->scene, ob, NULL, derivedData, vertexCos); + DerivedMesh *dm= get_cddm(ob, NULL, derivedData, vertexCos); displaceModifier_do((DisplaceModifierData *)md, ob, dm, vertexCos, numVerts); @@ -325,7 +330,7 @@ static void deformVertsEM( ModifierData *md, Object *ob, struct EditMesh *editData, DerivedMesh *derivedData, float (*vertexCos)[3], int numVerts) { - DerivedMesh *dm= get_cddm(md->scene, ob, editData, derivedData, vertexCos); + DerivedMesh *dm= get_cddm(ob, editData, derivedData, vertexCos); displaceModifier_do((DisplaceModifierData *)md, ob, dm, vertexCos, numVerts); diff --git a/source/blender/modifiers/intern/MOD_edgesplit.c b/source/blender/modifiers/intern/MOD_edgesplit.c index e80b80abdb5..daf9d76cf51 100644 --- a/source/blender/modifiers/intern/MOD_edgesplit.c +++ b/source/blender/modifiers/intern/MOD_edgesplit.c @@ -40,6 +40,7 @@ #include "BLI_edgehash.h" #include "BLI_math.h" +#include "BKE_utildefines.h" #include "BKE_cdderivedmesh.h" #include "BKE_modifier.h" #include "BKE_particle.h" @@ -730,8 +731,7 @@ static int edge_is_loose(SmoothEdge *edge) return !(edge->faces && edge->faces->next); } -static int edge_is_sharp(SmoothEdge *edge, int flags, - float threshold) +static int edge_is_sharp(SmoothEdge *edge) { #ifdef EDGESPLIT_DEBUG_1 printf("edge %d: ", edge->newIndex); @@ -761,8 +761,7 @@ static int edge_is_sharp(SmoothEdge *edge, int flags, * - hits a sharp edge (the edge is returned) * - returns to the start edge (NULL is returned) */ -static SmoothEdge *find_other_sharp_edge(SmoothVert *vert, SmoothEdge *edge, - LinkNode **visited_faces, float threshold, int flags) +static SmoothEdge *find_other_sharp_edge(SmoothVert *vert, SmoothEdge *edge, LinkNode **visited_faces) { SmoothFace *face = NULL; SmoothEdge *edge2 = NULL; @@ -790,7 +789,7 @@ static SmoothEdge *find_other_sharp_edge(SmoothVert *vert, SmoothEdge *edge, /* search until we hit a loose edge or a sharp edge or an edge we've * seen before */ - while(face && !edge_is_sharp(edge2, flags, threshold) + while(face && !edge_is_sharp(edge2) && !linklist_contains(visited_edges, edge2)) { #ifdef EDGESPLIT_DEBUG_3 printf("current face %4d; current edge %4d\n", face->newIndex, @@ -902,8 +901,7 @@ static void propagate_split(SmoothEdge *edge, SmoothVert *vert, edge->newIndex, vert->newIndex); #endif - edge2 = find_other_sharp_edge(vert, edge, &visited_faces, - mesh->threshold, mesh->flags); + edge2 = find_other_sharp_edge(vert, edge, &visited_faces); if(!edge2) { /* didn't find a sharp or loose edge, so we've hit a dead end */ @@ -912,7 +910,7 @@ static void propagate_split(SmoothEdge *edge, SmoothVert *vert, if(edge_is_loose(edge)) { /* edge is loose, so we can split edge2 at this vert */ split_edge(edge2, vert, mesh); - } else if(edge_is_sharp(edge, mesh->flags, mesh->threshold)) { + } else if(edge_is_sharp(edge)) { /* both edges are sharp, so we can split the pair at vert */ split_edge(edge, vert, mesh); } else { @@ -961,8 +959,7 @@ static void split_edge(SmoothEdge *edge, SmoothVert *vert, SmoothMesh *mesh) edge->newIndex, vert->newIndex); #endif - edge2 = find_other_sharp_edge(vert, edge, &visited_faces, - mesh->threshold, mesh->flags); + edge2 = find_other_sharp_edge(vert, edge, &visited_faces); if(!edge2) { /* didn't find a sharp or loose edge, so try the other vert */ @@ -1111,7 +1108,7 @@ static void split_sharp_edges(SmoothMesh *mesh, float split_angle, int flags) for(i = 0; i < mesh->num_edges; i++) { SmoothEdge *edge = &mesh->edges[i]; - if(edge_is_sharp(edge, flags, mesh->threshold)) { + if(edge_is_sharp(edge)) { split_edge(edge, edge->verts[0], mesh); do { @@ -1190,8 +1187,7 @@ static void split_bridge_verts(SmoothMesh *mesh) } } -static DerivedMesh *edgesplitModifier_do(EdgeSplitModifierData *emd, - Object *ob, DerivedMesh *dm) +static DerivedMesh *edgesplitModifier_do(EdgeSplitModifierData *emd, DerivedMesh *dm) { SmoothMesh *mesh; DerivedMesh *result; @@ -1244,14 +1240,15 @@ static DerivedMesh *edgesplitModifier_do(EdgeSplitModifierData *emd, return result; } -static DerivedMesh *applyModifier( - ModifierData *md, Object *ob, DerivedMesh *derivedData, - int useRenderParams, int isFinalCalc) +static DerivedMesh *applyModifier(ModifierData *md, Object *UNUSED(ob), + DerivedMesh *derivedData, + int UNUSED(useRenderParams), + int UNUSED(isFinalCalc)) { DerivedMesh *result; EdgeSplitModifierData *emd = (EdgeSplitModifierData*) md; - result = edgesplitModifier_do(emd, ob, derivedData); + result = edgesplitModifier_do(emd, derivedData); if(result != derivedData) CDDM_calc_normals(result); @@ -1259,9 +1256,9 @@ static DerivedMesh *applyModifier( return result; } -static DerivedMesh *applyModifierEM( - ModifierData *md, Object *ob, struct EditMesh *editData, - DerivedMesh *derivedData) +static DerivedMesh *applyModifierEM(ModifierData *md, Object *ob, + struct EditMesh *UNUSED(editData), + DerivedMesh *derivedData) { return applyModifier(md, ob, derivedData, 0, 1); } diff --git a/source/blender/modifiers/intern/MOD_explode.c b/source/blender/modifiers/intern/MOD_explode.c index cbf5f3c3b98..67f1f2a3e59 100644 --- a/source/blender/modifiers/intern/MOD_explode.c +++ b/source/blender/modifiers/intern/MOD_explode.c @@ -74,11 +74,11 @@ static void copyData(ModifierData *md, ModifierData *target) temd->protect = emd->protect; temd->vgroup = emd->vgroup; } -static int dependsOnTime(ModifierData *md) +static int dependsOnTime(ModifierData *UNUSED(md)) { return 1; } -static CustomDataMask requiredDataMask(Object *ob, ModifierData *md) +static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md) { ExplodeModifierData *emd= (ExplodeModifierData*) md; CustomDataMask dataMask = 0; @@ -90,8 +90,8 @@ static CustomDataMask requiredDataMask(Object *ob, ModifierData *md) } static void createFacepa(ExplodeModifierData *emd, - ParticleSystemModifierData *psmd, - Object *ob, DerivedMesh *dm) + ParticleSystemModifierData *psmd, + DerivedMesh *dm) { ParticleSystem *psys=psmd->psys; MFace *fa=0, *mface=0; @@ -833,9 +833,10 @@ static ParticleSystemModifierData * findPrecedingParticlesystem(Object *ob, Modi } return psmd; } -static DerivedMesh * applyModifier( - ModifierData *md, Object *ob, DerivedMesh *derivedData, - int useRenderParams, int isFinalCalc) +static DerivedMesh * applyModifier(ModifierData *md, Object *ob, + DerivedMesh *derivedData, + int UNUSED(useRenderParams), + int UNUSED(isFinalCalc)) { DerivedMesh *dm = derivedData; ExplodeModifierData *emd= (ExplodeModifierData*) md; @@ -852,16 +853,16 @@ static DerivedMesh * applyModifier( if(emd->facepa==0 || psmd->flag&eParticleSystemFlag_Pars || emd->flag&eExplodeFlag_CalcFaces - || MEM_allocN_len(emd->facepa)/sizeof(int) != dm->getNumFaces(dm)){ + || MEM_allocN_len(emd->facepa)/sizeof(int) != dm->getNumFaces(dm)) + { if(psmd->flag & eParticleSystemFlag_Pars) psmd->flag &= ~eParticleSystemFlag_Pars; if(emd->flag & eExplodeFlag_CalcFaces) emd->flag &= ~eExplodeFlag_CalcFaces; - createFacepa(emd,psmd,ob,derivedData); - } - + createFacepa(emd,psmd,derivedData); + } /* 2. create new mesh */ if(emd->flag & eExplodeFlag_EdgeSplit){ int *facepa = emd->facepa; diff --git a/source/blender/modifiers/intern/MOD_fluidsim.c b/source/blender/modifiers/intern/MOD_fluidsim.c index 619891e136f..14fb09f1c1f 100644 --- a/source/blender/modifiers/intern/MOD_fluidsim.c +++ b/source/blender/modifiers/intern/MOD_fluidsim.c @@ -34,6 +34,7 @@ #include "DNA_object_fluidsim.h" #include "DNA_object_types.h" +#include "BKE_utildefines.h" #include "BKE_cdderivedmesh.h" #include "BKE_modifier.h" @@ -125,7 +126,7 @@ static void updateDepgraph( } } -static int dependsOnTime(ModifierData *md) +static int dependsOnTime(ModifierData *UNUSED(md)) { return 1; } diff --git a/source/blender/modifiers/intern/MOD_fluidsim_util.c b/source/blender/modifiers/intern/MOD_fluidsim_util.c index 0c5428cc9d8..fb3eb74a919 100644 --- a/source/blender/modifiers/intern/MOD_fluidsim_util.c +++ b/source/blender/modifiers/intern/MOD_fluidsim_util.c @@ -43,10 +43,11 @@ #include "BLI_blenlib.h" #include "BLI_math.h" +#include "BKE_main.h" #include "BKE_cdderivedmesh.h" #include "BKE_mesh.h" #include "BKE_utildefines.h" -#include "BKE_global.h" /* G.sce only */ +#include "BKE_global.h" /* G.main->name only */ #include "MOD_modifiertypes.h" @@ -138,6 +139,8 @@ void fluidsim_init(FluidsimModifierData *fluidmd) fss->flag |= OB_FLUIDSIM_ACTIVE; } +#else + (void)fluidmd; /* unused */ #endif return; } @@ -154,7 +157,10 @@ void fluidsim_free(FluidsimModifierData *fluidmd) } MEM_freeN(fluidmd->fss); } +#else + (void)fluidmd; /* unused */ #endif + return; } @@ -443,7 +449,7 @@ void fluidsim_read_vel_cache(FluidsimModifierData *fluidmd, DerivedMesh *dm, cha gzclose(gzf); } -DerivedMesh *fluidsim_read_cache(Object *ob, DerivedMesh *orgdm, FluidsimModifierData *fluidmd, int framenr, int useRenderParams) +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 */ @@ -477,7 +483,7 @@ DerivedMesh *fluidsim_read_cache(Object *ob, DerivedMesh *orgdm, FluidsimModifie strcat(targetDir,"fluidsurface_final_####"); } - BLI_path_abs(targetDir, G.sce); + BLI_path_abs(targetDir, G.main->name); BLI_path_frame(targetDir, curFrame, 0); // fixed #frame-no strcpy(targetFile,targetDir); @@ -537,7 +543,11 @@ DerivedMesh *fluidsim_read_cache(Object *ob, DerivedMesh *orgdm, FluidsimModifie #endif // DISABLE_ELBEEM -DerivedMesh *fluidsimModifier_do(FluidsimModifierData *fluidmd, Scene *scene, Object *ob, DerivedMesh *dm, int useRenderParams, int isFinalCalc) +DerivedMesh *fluidsimModifier_do(FluidsimModifierData *fluidmd, Scene *scene, + Object *UNUSED(ob), + DerivedMesh *dm, + int useRenderParams, + int UNUSED(isFinalCalc)) { #ifndef DISABLE_ELBEEM DerivedMesh *result = NULL; @@ -567,7 +577,7 @@ DerivedMesh *fluidsimModifier_do(FluidsimModifierData *fluidmd, Scene *scene, Ob } /* try to read from cache */ - if(((fss->lastgoodframe >= framenr) || (fss->lastgoodframe < 0)) && (result = fluidsim_read_cache(ob, dm, fluidmd, framenr, useRenderParams))) + if(((fss->lastgoodframe >= framenr) || (fss->lastgoodframe < 0)) && (result = fluidsim_read_cache(dm, fluidmd, framenr, useRenderParams))) { // fss->lastgoodframe = framenr; // set also in src/fluidsim.c return result; @@ -577,7 +587,7 @@ DerivedMesh *fluidsimModifier_do(FluidsimModifierData *fluidmd, Scene *scene, Ob // display last known good frame if(fss->lastgoodframe >= 0) { - if((result = fluidsim_read_cache(ob, dm, fluidmd, fss->lastgoodframe, useRenderParams))) + if((result = fluidsim_read_cache(dm, fluidmd, fss->lastgoodframe, useRenderParams))) { return result; } @@ -587,7 +597,7 @@ DerivedMesh *fluidsimModifier_do(FluidsimModifierData *fluidmd, Scene *scene, Ob // this could be likely the case when you load an old fluidsim - if((result = fluidsim_read_cache(ob, dm, fluidmd, fss->lastgoodframe, useRenderParams))) + if((result = fluidsim_read_cache(dm, fluidmd, fss->lastgoodframe, useRenderParams))) { return result; } @@ -603,6 +613,11 @@ DerivedMesh *fluidsimModifier_do(FluidsimModifierData *fluidmd, Scene *scene, Ob return dm; #else + /* unused */ + (void)fluidmd; + (void)scene; + (void)dm; + (void)useRenderParams; return NULL; #endif } diff --git a/source/blender/modifiers/intern/MOD_hook.c b/source/blender/modifiers/intern/MOD_hook.c index f2ffd486aa5..c26d3ff0967 100644 --- a/source/blender/modifiers/intern/MOD_hook.c +++ b/source/blender/modifiers/intern/MOD_hook.c @@ -40,6 +40,7 @@ #include "BKE_cdderivedmesh.h" #include "BKE_modifier.h" #include "BKE_deform.h" +#include "BKE_utildefines.h" #include "depsgraph_private.h" #include "MEM_guardedalloc.h" @@ -68,13 +69,14 @@ static void copyData(ModifierData *md, ModifierData *target) strncpy(thmd->subtarget, hmd->subtarget, 32); } -static CustomDataMask requiredDataMask(Object *ob, ModifierData *md) +static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md) { HookModifierData *hmd = (HookModifierData *)md; CustomDataMask dataMask = 0; /* ask for vertexgroups if we need them */ - if(!hmd->indexar && hmd->name[0]) dataMask |= (1 << CD_MDEFORMVERT); + if(hmd->name[0]) dataMask |= (1 << CD_MDEFORMVERT); + // if(hmd->indexar) dataMask |= CD_MASK_ORIGINDEX; return dataMask; } @@ -86,7 +88,7 @@ static void freeData(ModifierData *md) if (hmd->indexar) MEM_freeN(hmd->indexar); } -static int isDisabled(ModifierData *md, int useRenderParams) +static int isDisabled(ModifierData *md, int UNUSED(useRenderParams)) { HookModifierData *hmd = (HookModifierData*) md; @@ -103,8 +105,10 @@ static void foreachObjectLink( walk(userData, ob, &hmd->object); } -static void updateDepgraph(ModifierData *md, DagForest *forest, struct Scene *scene, - Object *ob, DagNode *obNode) +static void updateDepgraph(ModifierData *md, DagForest *forest, + struct Scene *UNUSED(scene), + Object *UNUSED(ob), + DagNode *obNode) { HookModifierData *hmd = (HookModifierData*) md; @@ -118,15 +122,38 @@ static void updateDepgraph(ModifierData *md, DagForest *forest, struct Scene *sc } } -static void deformVerts( - ModifierData *md, Object *ob, DerivedMesh *derivedData, - float (*vertexCos)[3], int numVerts, int useRenderParams, int isFinalCalc) +static float hook_falloff(float *co_1, float *co_2, const float falloff_squared, float fac) +{ + if(falloff_squared) { + float len_squared = len_squared_v3v3(co_1, co_2); + if(len_squared > falloff_squared) { + return 0.0f; + } + else if(len_squared > 0.0) { + return fac * (1.0 - (len_squared / falloff_squared)); + } + } + + return fac; +} + +static void deformVerts(ModifierData *md, Object *ob, + DerivedMesh *derivedData, + float (*vertexCos)[3], + int numVerts, + int UNUSED(useRenderParams), + int UNUSED(isFinalCalc)) { HookModifierData *hmd = (HookModifierData*) md; bPoseChannel *pchan= get_pose_channel(hmd->object->pose, hmd->subtarget); float vec[3], mat[4][4], dmat[4][4]; - int i; + int i, *index_pt; DerivedMesh *dm = derivedData; + const float falloff_squared= hmd->falloff * hmd->falloff; /* for faster comparisons */ + + int max_dvert= 0; + MDeformVert *dvert= NULL; + int defgrp_index = -1; /* get world-space matrix of target, corrected for the space the verts are in */ if (hmd->subtarget[0] && pchan) { @@ -141,98 +168,91 @@ static void deformVerts( mul_serie_m4(mat, ob->imat, dmat, hmd->parentinv, NULL, NULL, NULL, NULL, NULL); - /* vertex indices? */ - if(hmd->indexar) { - for(i = 0; i < hmd->totindex; i++) { - int index = hmd->indexar[i]; - - /* This should always be true and I don't generally like - * "paranoid" style code like this, but old files can have - * indices that are out of range because old blender did - * not correct them on exit editmode. - zr - */ - if(index < numVerts) { - float *co = vertexCos[index]; - float fac = hmd->force; - - /* if DerivedMesh is present and has original index data, - * use it - */ - if(dm && dm->getVertDataArray(dm, CD_ORIGINDEX)) { + if((defgrp_index= defgroup_name_index(ob, hmd->name)) != -1) { + Mesh *me = ob->data; + if(dm) { + dvert= dm->getVertDataArray(dm, CD_MDEFORMVERT); + if(dvert) { + max_dvert = numVerts; + } + } + else if(me->dvert) { + dvert= me->dvert; + if(dvert) { + max_dvert = me->totvert; + } + } + } + + /* Regarding index range checking below. + * + * This should always be true and I don't generally like + * "paranoid" style code like this, but old files can have + * indices that are out of range because old blender did + * not correct them on exit editmode. - zr + */ + + if(hmd->force == 0.0f) { + /* do nothing, avoid annoying checks in the loop */ + } + else if(hmd->indexar) { /* vertex indices? */ + const float fac_orig= hmd->force; + float fac; + const int *origindex_ar; + + /* if DerivedMesh is present and has original index data, + * use it + */ + if(dm && (origindex_ar= dm->getVertDataArray(dm, CD_ORIGINDEX))) { + for(i= 0, index_pt= hmd->indexar; i < hmd->totindex; i++, index_pt++) { + if(*index_pt < numVerts) { int j; - int orig_index; - for(j = 0; j < numVerts; ++j) { - fac = hmd->force; - orig_index = *(int *)dm->getVertData(dm, j, - CD_ORIGINDEX); - if(orig_index == index) { - co = vertexCos[j]; - if(hmd->falloff != 0.0) { - float len = len_v3v3(co, hmd->cent); - if(len > hmd->falloff) fac = 0.0; - else if(len > 0.0) - fac *= sqrt(1.0 - len / hmd->falloff); - } - if(fac != 0.0) { - mul_v3_m4v3(vec, mat, co); - interp_v3_v3v3(co, co, vec, fac); + for(j = 0; j < numVerts; j++) { + if(origindex_ar[j] == *index_pt) { + float *co = vertexCos[j]; + if((fac= hook_falloff(hmd->cent, co, falloff_squared, fac_orig))) { + if(dvert) + fac *= defvert_find_weight(dvert+j, defgrp_index); + + if(fac) { + mul_v3_m4v3(vec, mat, co); + interp_v3_v3v3(co, co, vec, fac); + } } } } - } else { - if(hmd->falloff != 0.0) { - float len = len_v3v3(co, hmd->cent); - if(len > hmd->falloff) fac = 0.0; - else if(len > 0.0) - fac *= sqrt(1.0 - len / hmd->falloff); - } - - if(fac != 0.0) { - mul_v3_m4v3(vec, mat, co); - interp_v3_v3v3(co, co, vec, fac); - } } } } - } - else if(hmd->name[0]) { /* vertex group hook */ - Mesh *me = ob->data; - int use_dverts = 0; - int maxVerts = 0; - int defgrp_index = defgroup_name_index(ob, hmd->name); - - if(dm) { - if(dm->getVertData(dm, 0, CD_MDEFORMVERT)) { - maxVerts = dm->getNumVerts(dm); - use_dverts = 1; + else { /* missing dm or ORIGINDEX */ + for(i= 0, index_pt= hmd->indexar; i < hmd->totindex; i++, index_pt++) { + if(*index_pt < numVerts) { + float *co = vertexCos[*index_pt]; + if((fac= hook_falloff(hmd->cent, co, falloff_squared, fac_orig))) { + if(dvert) + fac *= defvert_find_weight(dvert+(*index_pt), defgrp_index); + + if(fac) { + mul_v3_m4v3(vec, mat, co); + interp_v3_v3v3(co, co, vec, fac); + } + } + } } } - else if(me->dvert) { - maxVerts = me->totvert; - use_dverts = 1; - } + } + else if(dvert) { /* vertex group hook */ + int i; + const float fac_orig= hmd->force; - if(defgrp_index >= 0 && use_dverts) { - MDeformVert *dvert = me->dvert; - int i; + for(i = 0; i < max_dvert; i++, dvert++) { float fac; + float *co = vertexCos[i]; - for(i = 0; i < maxVerts; i++, dvert++) { - if(dm) dvert = dm->getVertData(dm, i, CD_MDEFORMVERT); - - fac= defvert_find_weight(dvert, defgrp_index); - - if(fac > 0.0f) { - float *co = vertexCos[i]; - - if(hmd->falloff != 0.0) { - float len = len_v3v3(co, hmd->cent); - if(len > hmd->falloff) fac = 0.0; - else if(len > 0.0) - fac *= sqrt(1.0 - len / hmd->falloff); - } - + if((fac= hook_falloff(hmd->cent, co, falloff_squared, fac_orig))) { + fac *= defvert_find_weight(dvert, defgrp_index); + if(fac) { mul_v3_m4v3(vec, mat, co); interp_v3_v3v3(co, co, vec, fac); } diff --git a/source/blender/modifiers/intern/MOD_lattice.c b/source/blender/modifiers/intern/MOD_lattice.c index 532475a3466..fdbc3fa0a50 100644 --- a/source/blender/modifiers/intern/MOD_lattice.c +++ b/source/blender/modifiers/intern/MOD_lattice.c @@ -34,6 +34,7 @@ #include "DNA_object_types.h" +#include "BKE_utildefines.h" #include "BKE_cdderivedmesh.h" #include "BKE_lattice.h" #include "BKE_modifier.h" @@ -52,7 +53,7 @@ static void copyData(ModifierData *md, ModifierData *target) strncpy(tlmd->name, lmd->name, 32); } -static CustomDataMask requiredDataMask(Object *ob, ModifierData *md) +static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md) { LatticeModifierData *lmd = (LatticeModifierData *)md; CustomDataMask dataMask = 0; @@ -63,7 +64,7 @@ static CustomDataMask requiredDataMask(Object *ob, ModifierData *md) return dataMask; } -static int isDisabled(ModifierData *md, int userRenderParams) +static int isDisabled(ModifierData *md, int UNUSED(userRenderParams)) { LatticeModifierData *lmd = (LatticeModifierData*) md; @@ -80,8 +81,10 @@ static void foreachObjectLink( walk(userData, ob, &lmd->object); } -static void updateDepgraph(ModifierData *md, DagForest *forest, struct Scene *scene, - Object *ob, DagNode *obNode) +static void updateDepgraph(ModifierData *md, DagForest *forest, + struct Scene *UNUSED(scene), + Object *UNUSED(ob), + DagNode *obNode) { LatticeModifierData *lmd = (LatticeModifierData*) md; @@ -93,9 +96,12 @@ static void updateDepgraph(ModifierData *md, DagForest *forest, struct Scene *sc } } -static void deformVerts( - ModifierData *md, Object *ob, DerivedMesh *derivedData, - float (*vertexCos)[3], int numVerts, int useRenderParams, int isFinalCalc) +static void deformVerts(ModifierData *md, Object *ob, + DerivedMesh *derivedData, + float (*vertexCos)[3], + int numVerts, + int UNUSED(useRenderParams), + int UNUSED(isFinalCalc)) { LatticeModifierData *lmd = (LatticeModifierData*) md; diff --git a/source/blender/modifiers/intern/MOD_mask.c b/source/blender/modifiers/intern/MOD_mask.c index c1565352133..eddb21596a6 100644 --- a/source/blender/modifiers/intern/MOD_mask.c +++ b/source/blender/modifiers/intern/MOD_mask.c @@ -55,7 +55,7 @@ static void copyData(ModifierData *md, ModifierData *target) strcpy(tmmd->vgroup, mmd->vgroup); } -static CustomDataMask requiredDataMask(Object *ob, ModifierData *md) +static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *UNUSED(md)) { return (1 << CD_MDEFORMVERT); } @@ -69,8 +69,10 @@ static void foreachObjectLink( walk(userData, ob, &mmd->ob_arm); } -static void updateDepgraph(ModifierData *md, DagForest *forest, struct Scene *scene, - Object *ob, DagNode *obNode) +static void updateDepgraph(ModifierData *md, DagForest *forest, + struct Scene *UNUSED(scene), + Object *UNUSED(ob), + DagNode *obNode) { MaskModifierData *mmd = (MaskModifierData *)md; @@ -84,8 +86,9 @@ static void updateDepgraph(ModifierData *md, DagForest *forest, struct Scene *sc } static DerivedMesh *applyModifier(ModifierData *md, Object *ob, - DerivedMesh *derivedData, - int useRenderParams, int isFinalCalc) + DerivedMesh *derivedData, + int UNUSED(useRenderParams), + int UNUSED(isFinalCalc)) { MaskModifierData *mmd= (MaskModifierData *)md; DerivedMesh *dm= derivedData, *result= NULL; diff --git a/source/blender/modifiers/intern/MOD_meshdeform.c b/source/blender/modifiers/intern/MOD_meshdeform.c index af87fb6ef74..587b3b8f053 100644 --- a/source/blender/modifiers/intern/MOD_meshdeform.c +++ b/source/blender/modifiers/intern/MOD_meshdeform.c @@ -35,6 +35,7 @@ #include "BLI_math.h" +#include "BKE_utildefines.h" #include "BKE_cdderivedmesh.h" #include "BKE_global.h" #include "BKE_mesh.h" @@ -76,7 +77,7 @@ static void copyData(ModifierData *md, ModifierData *target) tmmd->object = mmd->object; } -static CustomDataMask requiredDataMask(Object *ob, ModifierData *md) +static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md) { MeshDeformModifierData *mmd = (MeshDeformModifierData *)md; CustomDataMask dataMask = 0; @@ -87,7 +88,7 @@ static CustomDataMask requiredDataMask(Object *ob, ModifierData *md) return dataMask; } -static int isDisabled(ModifierData *md, int useRenderParams) +static int isDisabled(ModifierData *md, int UNUSED(useRenderParams)) { MeshDeformModifierData *mmd = (MeshDeformModifierData*) md; @@ -104,9 +105,10 @@ static void foreachObjectLink( walk(userData, ob, &mmd->object); } -static void updateDepgraph( - ModifierData *md, DagForest *forest, struct Scene *scene, Object *ob, - DagNode *obNode) +static void updateDepgraph(ModifierData *md, DagForest *forest, + struct Scene *UNUSED(scene), + Object *UNUSED(ob), + DagNode *obNode) { MeshDeformModifierData *mmd = (MeshDeformModifierData*) md; @@ -204,7 +206,7 @@ static void meshdeformModifier_do( /* if we don't have one computed, use derivedmesh from data * without any modifiers */ if(!cagedm) { - cagedm= get_dm(md->scene, mmd->object, NULL, NULL, NULL, 0); + cagedm= get_dm(mmd->object, NULL, NULL, NULL, 0); if(cagedm) cagedm->needsFree= 1; } @@ -338,11 +340,14 @@ static void meshdeformModifier_do( cagedm->release(cagedm); } -static void deformVerts( - ModifierData *md, Object *ob, DerivedMesh *derivedData, - float (*vertexCos)[3], int numVerts, int useRenderParams, int isFinalCalc) +static void deformVerts(ModifierData *md, Object *ob, + DerivedMesh *derivedData, + float (*vertexCos)[3], + int numVerts, + int UNUSED(useRenderParams), + int UNUSED(isFinalCalc)) { - DerivedMesh *dm= get_dm(md->scene, ob, NULL, derivedData, NULL, 0);; + DerivedMesh *dm= get_dm(ob, NULL, derivedData, NULL, 0);; modifier_vgroup_cache(md, vertexCos); /* if next modifier needs original vertices */ @@ -352,11 +357,13 @@ static void deformVerts( dm->release(dm); } -static void deformVertsEM( - ModifierData *md, Object *ob, struct EditMesh *editData, - DerivedMesh *derivedData, float (*vertexCos)[3], int numVerts) +static void deformVertsEM(ModifierData *md, Object *ob, + struct EditMesh *UNUSED(editData), + DerivedMesh *derivedData, + float (*vertexCos)[3], + int numVerts) { - DerivedMesh *dm= get_dm(md->scene, ob, NULL, derivedData, NULL, 0);; + DerivedMesh *dm= get_dm(ob, NULL, derivedData, NULL, 0);; meshdeformModifier_do(md, ob, dm, vertexCos, numVerts); diff --git a/source/blender/modifiers/intern/MOD_mirror.c b/source/blender/modifiers/intern/MOD_mirror.c index 9289c44c414..6405f0e9d76 100644 --- a/source/blender/modifiers/intern/MOD_mirror.c +++ b/source/blender/modifiers/intern/MOD_mirror.c @@ -74,8 +74,10 @@ static void foreachObjectLink( walk(userData, ob, &mmd->mirror_ob); } -static void updateDepgraph(ModifierData *md, DagForest *forest, struct Scene *scene, - Object *ob, DagNode *obNode) +static void updateDepgraph(ModifierData *md, DagForest *forest, + struct Scene *UNUSED(scene), + Object *UNUSED(ob), + DagNode *obNode) { MirrorModifierData *mmd = (MirrorModifierData*) md; @@ -298,9 +300,10 @@ static DerivedMesh *mirrorModifier__doMirror(MirrorModifierData *mmd, return result; } -static DerivedMesh *applyModifier( - ModifierData *md, Object *ob, DerivedMesh *derivedData, - int useRenderParams, int isFinalCalc) +static DerivedMesh *applyModifier(ModifierData *md, Object *ob, + DerivedMesh *derivedData, + int UNUSED(useRenderParams), + int UNUSED(isFinalCalc)) { DerivedMesh *result; MirrorModifierData *mmd = (MirrorModifierData*) md; @@ -313,9 +316,9 @@ static DerivedMesh *applyModifier( return result; } -static DerivedMesh *applyModifierEM( - ModifierData *md, Object *ob, struct EditMesh *editData, - DerivedMesh *derivedData) +static DerivedMesh *applyModifierEM(ModifierData *md, Object *ob, + struct EditMesh *UNUSED(editData), + DerivedMesh *derivedData) { return applyModifier(md, ob, derivedData, 0, 1); } diff --git a/source/blender/modifiers/intern/MOD_none.c b/source/blender/modifiers/intern/MOD_none.c index 8cfb2a59376..1b6a709e7f4 100644 --- a/source/blender/modifiers/intern/MOD_none.c +++ b/source/blender/modifiers/intern/MOD_none.c @@ -34,13 +34,14 @@ * ***** END GPL LICENSE BLOCK ***** */ +#include "BKE_utildefines.h" #include "MOD_modifiertypes.h" /* We only need to define isDisabled; because it always returns 1, * no other functions will be called */ -static int isDisabled(ModifierData *md, int userRenderParams) +static int isDisabled(ModifierData *UNUSED(md), int UNUSED(userRenderParams)) { return 1; } diff --git a/source/blender/modifiers/intern/MOD_particleinstance.c b/source/blender/modifiers/intern/MOD_particleinstance.c index bbd0219d3f8..9fcefdba49a 100644 --- a/source/blender/modifiers/intern/MOD_particleinstance.c +++ b/source/blender/modifiers/intern/MOD_particleinstance.c @@ -72,12 +72,14 @@ static void copyData(ModifierData *md, ModifierData *target) tpimd->random_position = pimd->random_position; } -static int dependsOnTime(ModifierData *md) +static int dependsOnTime(ModifierData *UNUSED(md)) { return 0; } static void updateDepgraph(ModifierData *md, DagForest *forest, - struct Scene *scene,Object *ob, DagNode *obNode) + struct Scene *UNUSED(scene), + Object *UNUSED(ob), + DagNode *obNode) { ParticleInstanceModifierData *pimd = (ParticleInstanceModifierData*) md; @@ -98,9 +100,10 @@ static void foreachObjectLink(ModifierData *md, Object *ob, walk(userData, ob, &pimd->ob); } -static DerivedMesh * applyModifier( - ModifierData *md, Object *ob, DerivedMesh *derivedData, - int useRenderParams, int isFinalCalc) +static DerivedMesh * applyModifier(ModifierData *md, Object *ob, + DerivedMesh *derivedData, + int UNUSED(useRenderParams), + int UNUSED(isFinalCalc)) { DerivedMesh *dm = derivedData, *result; ParticleInstanceModifierData *pimd= (ParticleInstanceModifierData*) md; @@ -306,9 +309,9 @@ static DerivedMesh * applyModifier( return result; } -static DerivedMesh *applyModifierEM( - ModifierData *md, Object *ob, struct EditMesh *editData, - DerivedMesh *derivedData) +static DerivedMesh *applyModifierEM(ModifierData *md, Object *ob, + struct EditMesh *UNUSED(editData), + DerivedMesh *derivedData) { return applyModifier(md, ob, derivedData, 0, 1); } diff --git a/source/blender/modifiers/intern/MOD_particlesystem.c b/source/blender/modifiers/intern/MOD_particlesystem.c index 602b6dd1d56..0feea3b6bf5 100644 --- a/source/blender/modifiers/intern/MOD_particlesystem.c +++ b/source/blender/modifiers/intern/MOD_particlesystem.c @@ -34,6 +34,7 @@ #include "DNA_material_types.h" +#include "BKE_utildefines.h" #include "BKE_cdderivedmesh.h" #include "BKE_material.h" #include "BKE_modifier.h" @@ -119,9 +120,12 @@ static CustomDataMask requiredDataMask(Object *ob, ModifierData *md) } /* saves the current emitter state for a particle system and calculates particles */ -static void deformVerts( - ModifierData *md, Object *ob, DerivedMesh *derivedData, - float (*vertexCos)[3], int numVerts, int useRenderParams, int isFinalCalc) +static void deformVerts(ModifierData *md, Object *ob, + DerivedMesh *derivedData, + float (*vertexCos)[3], + int UNUSED(numVerts), + int UNUSED(useRenderParams), + int UNUSED(isFinalCalc)) { DerivedMesh *dm = derivedData; ParticleSystemModifierData *psmd= (ParticleSystemModifierData*) md; @@ -137,7 +141,7 @@ static void deformVerts( return; if(dm==0) { - dm= get_dm(md->scene, ob, NULL, NULL, vertexCos, 1); + dm= get_dm(ob, NULL, NULL, vertexCos, 1); if(!dm) return; diff --git a/source/blender/modifiers/intern/MOD_screw.c b/source/blender/modifiers/intern/MOD_screw.c index 0016fd2d266..668f0a086d1 100644 --- a/source/blender/modifiers/intern/MOD_screw.c +++ b/source/blender/modifiers/intern/MOD_screw.c @@ -37,6 +37,7 @@ #include "BLI_math.h" +#include "BKE_utildefines.h" #include "BKE_cdderivedmesh.h" #include "depsgraph_private.h" @@ -128,8 +129,9 @@ static void copyData(ModifierData *md, ModifierData *target) } static DerivedMesh *applyModifier(ModifierData *md, Object *ob, - DerivedMesh *derivedData, - int useRenderParams, int isFinalCalc) + DerivedMesh *derivedData, + int useRenderParams, + int UNUSED(isFinalCalc)) { DerivedMesh *dm= derivedData; DerivedMesh *result; @@ -832,9 +834,10 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, } -static void updateDepgraph( - ModifierData *md, DagForest *forest, - struct Scene *scene, Object *ob, DagNode *obNode) +static void updateDepgraph(ModifierData *md, DagForest *forest, + struct Scene *UNUSED(scene), + Object *UNUSED(ob), + DagNode *obNode) { ScrewModifierData *ltmd= (ScrewModifierData*) md; @@ -859,13 +862,15 @@ static void foreachObjectLink( /* This dosnt work with material*/ static DerivedMesh *applyModifierEM( - ModifierData *md, Object *ob, struct EditMesh *editData, + ModifierData *md, + Object *ob, + struct EditMesh *UNUSED(editData), DerivedMesh *derivedData) { return applyModifier(md, ob, derivedData, 0, 1); } -static int dependsOnTime(ModifierData *md) +static int dependsOnTime(ModifierData *UNUSED(md)) { return 0; } diff --git a/source/blender/modifiers/intern/MOD_shapekey.c b/source/blender/modifiers/intern/MOD_shapekey.c index bf675b874f6..a43e19a5fc1 100644 --- a/source/blender/modifiers/intern/MOD_shapekey.c +++ b/source/blender/modifiers/intern/MOD_shapekey.c @@ -34,6 +34,7 @@ #include "DNA_key_types.h" +#include "BKE_utildefines.h" #include "BKE_cdderivedmesh.h" #include "BKE_key.h" #include "BKE_particle.h" @@ -42,9 +43,12 @@ #include "MEM_guardedalloc.h" -static void deformVerts( - ModifierData *md, Object *ob, DerivedMesh *derivedData, - float (*vertexCos)[3], int numVerts, int useRenderParams, int isFinalCalc) +static void deformVerts(ModifierData *md, Object *ob, + DerivedMesh *UNUSED(derivedData), + float (*vertexCos)[3], + int numVerts, + int UNUSED(useRenderParams), + int UNUSED(isFinalCalc)) { KeyBlock *kb= ob_get_keyblock(ob); float (*deformedVerts)[3]; @@ -58,9 +62,11 @@ static void deformVerts( } } -static void deformVertsEM( - ModifierData *md, Object *ob, struct EditMesh *editData, - DerivedMesh *derivedData, float (*vertexCos)[3], int numVerts) +static void deformVertsEM(ModifierData *md, Object *ob, + struct EditMesh *UNUSED(editData), + DerivedMesh *derivedData, + float (*vertexCos)[3], + int numVerts) { Key *key= ob_get_key(ob); @@ -68,15 +74,19 @@ static void deformVertsEM( deformVerts(md, ob, derivedData, vertexCos, numVerts, 0, 0); } -static void deformMatricesEM( - ModifierData *md, Object *ob, struct EditMesh *editData, - DerivedMesh *derivedData, float (*vertexCos)[3], - float (*defMats)[3][3], int numVerts) +static void deformMatricesEM(ModifierData *UNUSED(md), Object *ob, + struct EditMesh *UNUSED(editData), + DerivedMesh *UNUSED(derivedData), + float (*vertexCos)[3], + float (*defMats)[3][3], + int numVerts) { 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) { scale_m3_fl(scale, kb->curval); diff --git a/source/blender/modifiers/intern/MOD_shrinkwrap.c b/source/blender/modifiers/intern/MOD_shrinkwrap.c index 6baee9f0d98..6eebe9b5e5e 100644 --- a/source/blender/modifiers/intern/MOD_shrinkwrap.c +++ b/source/blender/modifiers/intern/MOD_shrinkwrap.c @@ -32,6 +32,7 @@ #include <string.h> +#include "BKE_utildefines.h" #include "BKE_cdderivedmesh.h" #include "BKE_modifier.h" #include "BKE_shrinkwrap.h" @@ -71,7 +72,7 @@ static void copyData(ModifierData *md, ModifierData *target) tsmd->subsurfLevels = smd->subsurfLevels; } -static CustomDataMask requiredDataMask(Object *ob, ModifierData *md) +static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md) { ShrinkwrapModifierData *smd = (ShrinkwrapModifierData *)md; CustomDataMask dataMask = 0; @@ -87,7 +88,7 @@ static CustomDataMask requiredDataMask(Object *ob, ModifierData *md) return dataMask; } -static int isDisabled(ModifierData *md, int useRenderParams) +static int isDisabled(ModifierData *md, int UNUSED(useRenderParams)) { ShrinkwrapModifierData *smd = (ShrinkwrapModifierData*) md; return !smd->target; @@ -102,14 +103,19 @@ static void foreachObjectLink(ModifierData *md, Object *ob, ObjectWalkFunc walk, walk(userData, ob, &smd->auxTarget); } -static void deformVerts(ModifierData *md, Object *ob, DerivedMesh *derivedData, float (*vertexCos)[3], int numVerts, int useRenderParams, int isFinalCalc) +static void deformVerts(ModifierData *md, Object *ob, + DerivedMesh *derivedData, + float (*vertexCos)[3], + int numVerts, + int UNUSED(useRenderParams), + int UNUSED(isFinalCalc)) { DerivedMesh *dm = derivedData; CustomDataMask dataMask = requiredDataMask(ob, md); /* ensure we get a CDDM with applied vertex coords */ if(dataMask) - dm= get_cddm(md->scene, ob, NULL, dm, vertexCos); + dm= get_cddm(ob, NULL, dm, vertexCos); shrinkwrapModifier_deform((ShrinkwrapModifierData*)md, md->scene, ob, dm, vertexCos, numVerts); @@ -124,7 +130,7 @@ static void deformVertsEM(ModifierData *md, Object *ob, struct EditMesh *editDat /* ensure we get a CDDM with applied vertex coords */ if(dataMask) - dm= get_cddm(md->scene, ob, editData, dm, vertexCos); + dm= get_cddm(ob, editData, dm, vertexCos); shrinkwrapModifier_deform((ShrinkwrapModifierData*)md, md->scene, ob, dm, vertexCos, numVerts); @@ -132,7 +138,10 @@ static void deformVertsEM(ModifierData *md, Object *ob, struct EditMesh *editDat dm->release(dm); } -static void updateDepgraph(ModifierData *md, DagForest *forest, struct Scene *scene, Object *ob, DagNode *obNode) +static void updateDepgraph(ModifierData *md, DagForest *forest, + struct Scene *UNUSED(scene), + Object *UNUSED(ob), + DagNode *obNode) { ShrinkwrapModifierData *smd = (ShrinkwrapModifierData*) md; diff --git a/source/blender/modifiers/intern/MOD_simpledeform.c b/source/blender/modifiers/intern/MOD_simpledeform.c index ab580781351..7c47ab02157 100644 --- a/source/blender/modifiers/intern/MOD_simpledeform.c +++ b/source/blender/modifiers/intern/MOD_simpledeform.c @@ -290,7 +290,7 @@ static void copyData(ModifierData *md, ModifierData *target) strcpy(tsmd->vgroup_name, smd->vgroup_name); } -static CustomDataMask requiredDataMask(Object *ob, ModifierData *md) +static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md) { SimpleDeformModifierData *smd = (SimpleDeformModifierData *)md; CustomDataMask dataMask = 0; @@ -308,7 +308,10 @@ static void foreachObjectLink(ModifierData *md, Object *ob, void (*walk)(void *u walk(userData, ob, &smd->origin); } -static void updateDepgraph(ModifierData *md, DagForest *forest, struct Scene *scene, Object *ob, DagNode *obNode) +static void updateDepgraph(ModifierData *md, DagForest *forest, + struct Scene *UNUSED(scene), + Object *UNUSED(ob), + DagNode *obNode) { SimpleDeformModifierData *smd = (SimpleDeformModifierData*)md; @@ -316,7 +319,12 @@ static void updateDepgraph(ModifierData *md, DagForest *forest, struct Scene *sc dag_add_relation(forest, dag_get_node(forest, smd->origin), obNode, DAG_RL_OB_DATA, "SimpleDeform Modifier"); } -static void deformVerts(ModifierData *md, Object *ob, DerivedMesh *derivedData, float (*vertexCos)[3], int numVerts, int useRenderParams, int isFinalCalc) +static void deformVerts(ModifierData *md, Object *ob, + DerivedMesh *derivedData, + float (*vertexCos)[3], + int numVerts, + int UNUSED(useRenderParams), + int UNUSED(isFinalCalc)) { DerivedMesh *dm = derivedData; CustomDataMask dataMask = requiredDataMask(ob, md); @@ -324,7 +332,7 @@ static void deformVerts(ModifierData *md, Object *ob, DerivedMesh *derivedData, /* we implement requiredDataMask but thats not really usefull since mesh_calc_modifiers pass a NULL derivedData */ if(dataMask) - dm= get_dm(md->scene, ob, NULL, dm, NULL, 0); + dm= get_dm(ob, NULL, dm, NULL, 0); SimpleDeformModifier_do((SimpleDeformModifierData*)md, ob, dm, vertexCos, numVerts); @@ -332,7 +340,11 @@ static void deformVerts(ModifierData *md, Object *ob, DerivedMesh *derivedData, dm->release(dm); } -static void deformVertsEM(ModifierData *md, Object *ob, struct EditMesh *editData, DerivedMesh *derivedData, float (*vertexCos)[3], int numVerts) +static void deformVertsEM(ModifierData *md, Object *ob, + struct EditMesh *editData, + DerivedMesh *derivedData, + float (*vertexCos)[3], + int numVerts) { DerivedMesh *dm = derivedData; CustomDataMask dataMask = requiredDataMask(ob, md); @@ -340,7 +352,7 @@ static void deformVertsEM(ModifierData *md, Object *ob, struct EditMesh *editDat /* we implement requiredDataMask but thats not really usefull since mesh_calc_modifiers pass a NULL derivedData */ if(dataMask) - dm= get_dm(md->scene, ob, editData, dm, NULL, 0); + dm= get_dm(ob, editData, dm, NULL, 0); SimpleDeformModifier_do((SimpleDeformModifierData*)md, ob, dm, vertexCos, numVerts); diff --git a/source/blender/modifiers/intern/MOD_smoke.c b/source/blender/modifiers/intern/MOD_smoke.c index f89ff0bb1b5..aee466802ca 100644 --- a/source/blender/modifiers/intern/MOD_smoke.c +++ b/source/blender/modifiers/intern/MOD_smoke.c @@ -36,6 +36,7 @@ #include "DNA_object_types.h" +#include "BKE_utildefines.h" #include "BKE_cdderivedmesh.h" #include "BKE_modifier.h" #include "BKE_smoke.h" @@ -71,12 +72,15 @@ static void freeData(ModifierData *md) smokeModifier_free (smd); } -static void deformVerts( - ModifierData *md, Object *ob, DerivedMesh *derivedData, - float (*vertexCos)[3], int numVerts, int useRenderParams, int isFinalCalc) +static void deformVerts(ModifierData *md, Object *ob, + DerivedMesh *derivedData, + float (*vertexCos)[3], + int UNUSED(numVerts), + int useRenderParams, + int isFinalCalc) { SmokeModifierData *smd = (SmokeModifierData*) md; - DerivedMesh *dm = dm= get_cddm(md->scene, ob, NULL, derivedData, vertexCos); + DerivedMesh *dm = dm= get_cddm(ob, NULL, derivedData, vertexCos); smokeModifier_do(smd, md->scene, ob, dm, useRenderParams, isFinalCalc); @@ -84,14 +88,15 @@ static void deformVerts( dm->release(dm); } -static int dependsOnTime(ModifierData *md) +static int dependsOnTime(ModifierData *UNUSED(md)) { return 1; } -static void updateDepgraph( - ModifierData *md, DagForest *forest, struct Scene *scene, Object *ob, - DagNode *obNode) +static void updateDepgraph(ModifierData *UNUSED(md), DagForest *UNUSED(forest), + struct Scene *UNUSED(scene), + Object *UNUSED(ob), + DagNode *UNUSED(obNode)) { /*SmokeModifierData *smd = (SmokeModifierData *) md; if(smd && (smd->type & MOD_SMOKE_TYPE_DOMAIN) && smd->domain) diff --git a/source/blender/modifiers/intern/MOD_smooth.c b/source/blender/modifiers/intern/MOD_smooth.c index 96269c092c9..db7013f53ce 100644 --- a/source/blender/modifiers/intern/MOD_smooth.c +++ b/source/blender/modifiers/intern/MOD_smooth.c @@ -37,6 +37,7 @@ #include "BKE_cdderivedmesh.h" #include "BKE_particle.h" #include "BKE_deform.h" +#include "BKE_utildefines.h" #include "MEM_guardedalloc.h" @@ -65,7 +66,7 @@ static void copyData(ModifierData *md, ModifierData *target) strncpy(tsmd->defgrp_name, smd->defgrp_name, 32); } -static int isDisabled(ModifierData *md, int useRenderParams) +static int isDisabled(ModifierData *md, int UNUSED(useRenderParams)) { SmoothModifierData *smd = (SmoothModifierData*) md; short flag; @@ -78,7 +79,7 @@ static int isDisabled(ModifierData *md, int useRenderParams) return 0; } -static CustomDataMask requiredDataMask(Object *ob, ModifierData *md) +static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md) { SmoothModifierData *smd = (SmoothModifierData *)md; CustomDataMask dataMask = 0; @@ -219,9 +220,9 @@ static void smoothModifier_do( static void deformVerts( ModifierData *md, Object *ob, DerivedMesh *derivedData, - float (*vertexCos)[3], int numVerts, int useRenderParams, int isFinalCalc) + float (*vertexCos)[3], int numVerts, int UNUSED(useRenderParams), int UNUSED(isFinalCalc)) { - DerivedMesh *dm= get_dm(md->scene, ob, NULL, derivedData, NULL, 0); + DerivedMesh *dm= get_dm(ob, NULL, derivedData, NULL, 0); smoothModifier_do((SmoothModifierData *)md, ob, dm, vertexCos, numVerts); @@ -234,7 +235,7 @@ static void deformVertsEM( ModifierData *md, Object *ob, struct EditMesh *editData, DerivedMesh *derivedData, float (*vertexCos)[3], int numVerts) { - DerivedMesh *dm= get_dm(md->scene, ob, editData, derivedData, NULL, 0); + DerivedMesh *dm= get_dm(ob, editData, derivedData, NULL, 0); smoothModifier_do((SmoothModifierData *)md, ob, dm, vertexCos, numVerts); diff --git a/source/blender/modifiers/intern/MOD_softbody.c b/source/blender/modifiers/intern/MOD_softbody.c index 931cfe2e2d3..8d962395d01 100644 --- a/source/blender/modifiers/intern/MOD_softbody.c +++ b/source/blender/modifiers/intern/MOD_softbody.c @@ -32,20 +32,24 @@ #include "DNA_scene_types.h" +#include "BKE_utildefines.h" #include "BKE_cdderivedmesh.h" #include "BKE_particle.h" #include "BKE_softbody.h" #include "MOD_modifiertypes.h" -static void deformVerts( - ModifierData *md, Object *ob, DerivedMesh *derivedData, - float (*vertexCos)[3], int numVerts, int useRenderParams, int isFinalCalc) +static void deformVerts(ModifierData *md, Object *ob, + DerivedMesh *UNUSED(derivedData), + float (*vertexCos)[3], + int numVerts, + int UNUSED(useRenderParams), + int UNUSED(isFinalCalc)) { sbObjectStep(md->scene, ob, (float)md->scene->r.cfra, vertexCos, numVerts); } -static int dependsOnTime(ModifierData *md) +static int dependsOnTime(ModifierData *UNUSED(md)) { return 1; } diff --git a/source/blender/modifiers/intern/MOD_solidify.c b/source/blender/modifiers/intern/MOD_solidify.c index 57155c4e1dc..6abe1262c0b 100644 --- a/source/blender/modifiers/intern/MOD_solidify.c +++ b/source/blender/modifiers/intern/MOD_solidify.c @@ -179,7 +179,7 @@ static void copyData(ModifierData *md, ModifierData *target) strcpy(tsmd->defgrp_name, smd->defgrp_name); } -static CustomDataMask requiredDataMask(Object *ob, ModifierData *md) +static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md) { SolidifyModifierData *smd = (SolidifyModifierData*) md; CustomDataMask dataMask = 0; @@ -191,11 +191,10 @@ static CustomDataMask requiredDataMask(Object *ob, ModifierData *md) } -static DerivedMesh *applyModifier(ModifierData *md, - Object *ob, - DerivedMesh *dm, - int useRenderParams, - int isFinalCalc) +static DerivedMesh *applyModifier(ModifierData *md, Object *ob, + DerivedMesh *dm, + int UNUSED(useRenderParams), + int UNUSED(isFinalCalc)) { int i; DerivedMesh *result; @@ -630,7 +629,7 @@ static DerivedMesh *applyModifier(ModifierData *md, static DerivedMesh *applyModifierEM(ModifierData *md, Object *ob, - struct EditMesh *editData, + struct EditMesh *UNUSED(editData), DerivedMesh *derivedData) { return applyModifier(md, ob, derivedData, 0, 1); diff --git a/source/blender/modifiers/intern/MOD_subsurf.c b/source/blender/modifiers/intern/MOD_subsurf.c index cd3657b9674..3264717c97a 100644 --- a/source/blender/modifiers/intern/MOD_subsurf.c +++ b/source/blender/modifiers/intern/MOD_subsurf.c @@ -35,6 +35,7 @@ #include "DNA_scene_types.h" #include "DNA_object_types.h" +#include "BKE_utildefines.h" #include "BKE_cdderivedmesh.h" #include "BKE_scene.h" #include "BKE_subsurf.h" @@ -83,9 +84,10 @@ static int isDisabled(ModifierData *md, int useRenderParams) return get_render_subsurf_level(&md->scene->r, levels) == 0; } -static DerivedMesh *applyModifier( - ModifierData *md, Object *ob, DerivedMesh *derivedData, - int useRenderParams, int isFinalCalc) +static DerivedMesh *applyModifier(ModifierData *md, Object *UNUSED(ob), + DerivedMesh *derivedData, + int useRenderParams, + int isFinalCalc) { SubsurfModifierData *smd = (SubsurfModifierData*) md; DerivedMesh *result; @@ -102,9 +104,9 @@ static DerivedMesh *applyModifier( return result; } -static DerivedMesh *applyModifierEM( - ModifierData *md, Object *ob, struct EditMesh *editData, - DerivedMesh *derivedData) +static DerivedMesh *applyModifierEM(ModifierData *md, Object *UNUSED(ob), + struct EditMesh *UNUSED(editData), + DerivedMesh *derivedData) { SubsurfModifierData *smd = (SubsurfModifierData*) md; DerivedMesh *result; diff --git a/source/blender/modifiers/intern/MOD_surface.c b/source/blender/modifiers/intern/MOD_surface.c index b2f55bde360..a1593df0ffa 100644 --- a/source/blender/modifiers/intern/MOD_surface.c +++ b/source/blender/modifiers/intern/MOD_surface.c @@ -36,6 +36,7 @@ #include "BLI_math.h" +#include "BKE_utildefines.h" #include "BKE_cdderivedmesh.h" #include "MOD_modifiertypes.h" @@ -76,14 +77,17 @@ static void freeData(ModifierData *md) } } -static int dependsOnTime(ModifierData *md) +static int dependsOnTime(ModifierData *UNUSED(md)) { return 1; } -static void deformVerts( - ModifierData *md, Object *ob, DerivedMesh *derivedData, - float (*vertexCos)[3], int numVerts, int useRenderParams, int isFinalCalc) +static void deformVerts(ModifierData *md, Object *ob, + DerivedMesh *derivedData, + float (*vertexCos)[3], + int UNUSED(numVerts), + int UNUSED(useRenderParams), + int UNUSED(isFinalCalc)) { SurfaceModifierData *surmd = (SurfaceModifierData*) md; unsigned int numverts = 0, i = 0; @@ -93,7 +97,7 @@ static void deformVerts( /* if possible use/create DerivedMesh */ if(derivedData) surmd->dm = CDDM_copy(derivedData); - else surmd->dm = get_dm(md->scene, ob, NULL, NULL, NULL, 0); + else surmd->dm = get_dm(ob, NULL, NULL, NULL, 0); if(!ob->pd) { diff --git a/source/blender/modifiers/intern/MOD_util.c b/source/blender/modifiers/intern/MOD_util.c index 754b18bc282..de96684a2dd 100644 --- a/source/blender/modifiers/intern/MOD_util.c +++ b/source/blender/modifiers/intern/MOD_util.c @@ -84,13 +84,13 @@ void validate_layer_name(const CustomData *data, int type, char *name, char *out /* if a layer name was given, try to find that layer */ if(name[0]) - index = CustomData_get_named_layer_index(data, CD_MTFACE, name); + index = CustomData_get_named_layer_index(data, type, name); if(index < 0) { /* either no layer was specified, or the layer we want has been * deleted, so assign the active layer to name */ - index = CustomData_get_active_layer_index(data, CD_MTFACE); + index = CustomData_get_active_layer_index(data, type); strcpy(outname, data->layers[index].name); } else @@ -98,13 +98,13 @@ void validate_layer_name(const CustomData *data, int type, char *name, char *out } /* returns a cdderivedmesh if dm == NULL or is another type of derivedmesh */ -DerivedMesh *get_cddm(struct Scene *scene, Object *ob, struct EditMesh *em, DerivedMesh *dm, float (*vertexCos)[3]) +DerivedMesh *get_cddm(Object *ob, struct EditMesh *em, DerivedMesh *dm, float (*vertexCos)[3]) { if(dm && dm->type == DM_TYPE_CDDM) return dm; if(!dm) { - dm= get_dm(scene, ob, em, dm, vertexCos, 0); + dm= get_dm(ob, em, dm, vertexCos, 0); } else { dm= CDDM_copy(dm); @@ -118,7 +118,7 @@ DerivedMesh *get_cddm(struct Scene *scene, Object *ob, struct EditMesh *em, Deri } /* returns a derived mesh if dm == NULL, for deforming modifiers that need it */ -DerivedMesh *get_dm(struct Scene *scene, Object *ob, struct EditMesh *em, DerivedMesh *dm, float (*vertexCos)[3], int orco) +DerivedMesh *get_dm(Object *ob, struct EditMesh *em, DerivedMesh *dm, float (*vertexCos)[3], int orco) { if(dm) return dm; @@ -143,7 +143,7 @@ DerivedMesh *get_dm(struct Scene *scene, Object *ob, struct EditMesh *em, Derive } /* only called by BKE_modifier.h/modifier.c */ -void modifier_type_init(ModifierTypeInfo *types[], ModifierType type) +void modifier_type_init(ModifierTypeInfo *types[]) { memset(types, 0, sizeof(types)); #define INIT_TYPE(typeName) (types[eModifierType_##typeName] = &modifierType_##typeName) diff --git a/source/blender/modifiers/intern/MOD_util.h b/source/blender/modifiers/intern/MOD_util.h index 5750e042199..6abc29417b5 100644 --- a/source/blender/modifiers/intern/MOD_util.h +++ b/source/blender/modifiers/intern/MOD_util.h @@ -40,9 +40,9 @@ struct ModifierData; void get_texture_value(struct Tex *texture, float *tex_co, struct TexResult *texres); void modifier_vgroup_cache(struct ModifierData *md, float (*vertexCos)[3]); void validate_layer_name(const struct CustomData *data, int type, char *name, char *outname); -struct DerivedMesh *get_cddm(struct Scene *scene, struct Object *ob, struct EditMesh *em, struct DerivedMesh *dm, float (*vertexCos)[3]); -struct DerivedMesh *get_dm(struct Scene *scene, struct Object *ob, struct EditMesh *em, struct DerivedMesh *dm, float (*vertexCos)[3], int orco); +struct DerivedMesh *get_cddm(struct Object *ob, struct EditMesh *em, struct DerivedMesh *dm, float (*vertexCos)[3]); +struct DerivedMesh *get_dm(struct Object *ob, struct EditMesh *em, struct DerivedMesh *dm, float (*vertexCos)[3], int orco); -void modifier_type_init(struct ModifierTypeInfo *types[], ModifierType type); +void modifier_type_init(struct ModifierTypeInfo *types[]); #endif /* MOD_UTIL_H */ diff --git a/source/blender/modifiers/intern/MOD_uvproject.c b/source/blender/modifiers/intern/MOD_uvproject.c index 211640ad777..942b4b0b597 100644 --- a/source/blender/modifiers/intern/MOD_uvproject.c +++ b/source/blender/modifiers/intern/MOD_uvproject.c @@ -39,6 +39,7 @@ #include "BLI_math.h" #include "BLI_uvproject.h" +#include "BKE_utildefines.h" #include "BKE_DerivedMesh.h" #include "MOD_modifiertypes.h" @@ -78,7 +79,7 @@ static void copyData(ModifierData *md, ModifierData *target) tumd->scaley = umd->scaley; } -static CustomDataMask requiredDataMask(Object *ob, ModifierData *md) +static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *UNUSED(md)) { CustomDataMask dataMask = 0; @@ -109,8 +110,10 @@ static void foreachIDLink(ModifierData *md, Object *ob, userData); } -static void updateDepgraph(ModifierData *md, - DagForest *forest, struct Scene *scene, Object *ob, DagNode *obNode) +static void updateDepgraph(ModifierData *md, DagForest *forest, + struct Scene *UNUSED(scene), + Object *UNUSED(ob), + DagNode *obNode) { UVProjectModifierData *umd = (UVProjectModifierData*) md; int i; @@ -376,9 +379,10 @@ static DerivedMesh *uvprojectModifier_do(UVProjectModifierData *umd, return dm; } -static DerivedMesh *applyModifier( - ModifierData *md, Object *ob, DerivedMesh *derivedData, - int useRenderParams, int isFinalCalc) +static DerivedMesh *applyModifier(ModifierData *md, Object *ob, + DerivedMesh *derivedData, + int UNUSED(useRenderParams), + int UNUSED(isFinalCalc)) { DerivedMesh *result; UVProjectModifierData *umd = (UVProjectModifierData*) md; @@ -388,9 +392,9 @@ static DerivedMesh *applyModifier( return result; } -static DerivedMesh *applyModifierEM( - ModifierData *md, Object *ob, struct EditMesh *editData, - DerivedMesh *derivedData) +static DerivedMesh *applyModifierEM(ModifierData *md, Object *ob, + struct EditMesh *UNUSED(editData), + DerivedMesh *derivedData) { return applyModifier(md, ob, derivedData, 0, 1); } diff --git a/source/blender/modifiers/intern/MOD_wave.c b/source/blender/modifiers/intern/MOD_wave.c index 42cbddce233..acd8c29a6dd 100644 --- a/source/blender/modifiers/intern/MOD_wave.c +++ b/source/blender/modifiers/intern/MOD_wave.c @@ -36,6 +36,7 @@ #include "DNA_scene_types.h" #include "DNA_object_types.h" +#include "BKE_utildefines.h" #include "BKE_DerivedMesh.h" #include "BKE_object.h" #include "BKE_deform.h" @@ -93,7 +94,7 @@ static void copyData(ModifierData *md, ModifierData *target) strncpy(twmd->defgrp_name, wmd->defgrp_name, 32); } -static int dependsOnTime(ModifierData *md) +static int dependsOnTime(ModifierData *UNUSED(md)) { return 1; } @@ -118,9 +119,10 @@ static void foreachIDLink(ModifierData *md, Object *ob, foreachObjectLink(md, ob, (ObjectWalkFunc)walk, userData); } -static void updateDepgraph( - ModifierData *md, DagForest *forest, Scene *scene, Object *ob, - DagNode *obNode) +static void updateDepgraph(ModifierData *md, DagForest *forest, + Scene *UNUSED(scene), + Object *UNUSED(ob), + DagNode *obNode) { WaveModifierData *wmd = (WaveModifierData*) md; @@ -139,7 +141,7 @@ static void updateDepgraph( } } -static CustomDataMask requiredDataMask(Object *ob, ModifierData *md) +static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md) { WaveModifierData *wmd = (WaveModifierData *)md; CustomDataMask dataMask = 0; @@ -399,17 +401,20 @@ static void waveModifier_do(WaveModifierData *md, if(wmd->texture) MEM_freeN(tex_co); } -static void deformVerts( - ModifierData *md, Object *ob, DerivedMesh *derivedData, - float (*vertexCos)[3], int numVerts, int useRenderParams, int isFinalCalc) +static void deformVerts(ModifierData *md, Object *ob, + DerivedMesh *derivedData, + float (*vertexCos)[3], + int numVerts, + int UNUSED(useRenderParams), + int UNUSED(isFinalCalc)) { DerivedMesh *dm= derivedData; WaveModifierData *wmd = (WaveModifierData *)md; if(wmd->flag & MOD_WAVE_NORM) - dm= get_cddm(md->scene, ob, NULL, dm, vertexCos); + dm= get_cddm(ob, NULL, dm, vertexCos); else if(wmd->texture || wmd->defgrp_name[0]) - dm= get_dm(md->scene, ob, NULL, dm, NULL, 0); + dm= get_dm(ob, NULL, dm, NULL, 0); waveModifier_do(wmd, md->scene, ob, dm, vertexCos, numVerts); @@ -425,9 +430,9 @@ static void deformVertsEM( WaveModifierData *wmd = (WaveModifierData *)md; if(wmd->flag & MOD_WAVE_NORM) - dm= get_cddm(md->scene, ob, editData, dm, vertexCos); + dm= get_cddm(ob, editData, dm, vertexCos); else if(wmd->texture || wmd->defgrp_name[0]) - dm= get_dm(md->scene, ob, editData, dm, NULL, 0); + dm= get_dm(ob, editData, dm, NULL, 0); waveModifier_do(wmd, md->scene, ob, dm, vertexCos, numVerts); diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_alphaOver.c b/source/blender/nodes/intern/CMP_nodes/CMP_alphaOver.c index 37061dd7eae..3f6bd989477 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_alphaOver.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_alphaOver.c @@ -41,7 +41,7 @@ static bNodeSocketType cmp_node_alphaover_out[]= { { -1, 0, "" } }; -static void do_alphaover_premul(bNode *node, float *out, float *src, float *over, float *fac) +static void do_alphaover_premul(bNode *UNUSED(node), float *out, float *src, float *over, float *fac) { if(over[3]<=0.0f) { @@ -61,7 +61,7 @@ static void do_alphaover_premul(bNode *node, float *out, float *src, float *over } /* result will be still premul, but the over part is premulled */ -static void do_alphaover_key(bNode *node, float *out, float *src, float *over, float *fac) +static void do_alphaover_key(bNode *UNUSED(node), float *out, float *src, float *over, float *fac) { if(over[3]<=0.0f) { @@ -107,7 +107,7 @@ static void do_alphaover_mixed(bNode *node, float *out, float *src, float *over, -static void node_composit_exec_alphaover(void *data, bNode *node, bNodeStack **in, bNodeStack **out) +static void node_composit_exec_alphaover(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out) { /* stack order in: col col */ /* stack order out: col */ diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_bilateralblur.c b/source/blender/nodes/intern/CMP_nodes/CMP_bilateralblur.c index 97577fa6b5e..404f0aefb3c 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_bilateralblur.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_bilateralblur.c @@ -81,7 +81,7 @@ static bNodeSocketType cmp_node_bilateralblur_out[]= { /* code of this node was heavily inspired by the smooth function of opencv library. The main change is an optional image input */ -static void node_composit_exec_bilateralblur(void *data, bNode *node, bNodeStack **in, bNodeStack **out) +static void node_composit_exec_bilateralblur(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out) { NodeBilateralBlurData *nbbd= node->storage; CompBuf *new, *source, *img= in[0]->data , *refimg= in[1]->data; diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_blur.c b/source/blender/nodes/intern/CMP_nodes/CMP_blur.c index eb8b079f341..f367e7b473d 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_blur.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_blur.c @@ -93,109 +93,119 @@ static void blur_single_image(bNode *node, CompBuf *new, CompBuf *img, float sca int x, y, pix= img->type; int i, bigstep; float *src, *dest; - + /* helper image */ work= alloc_compbuf(imgx, imgy, img->type, 1); /* allocs */ - - /* horizontal */ - rad = scale*(float)nbd->sizex; - if(rad>imgx/2) - rad= imgx/2; - else if(rad<1) - rad= 1; - gausstab= make_gausstab(nbd->filtertype, rad); - gausstabcent= gausstab+rad; - - for (y = 0; y < imgy; y++) { - float *srcd= img->rect + pix*(y*img->x); + /* horizontal */ + if(nbd->sizex == 0) { + memcpy(work->rect, img->rect, sizeof(float) * img->type * imgx * imgy); + } + else { + rad = scale*(float)nbd->sizex; + if(rad>imgx/2) + rad= imgx/2; + else if(rad<1) + rad= 1; - dest = work->rect + pix*(y * img->x); + gausstab= make_gausstab(nbd->filtertype, rad); + gausstabcent= gausstab+rad; - for (x = 0; x < imgx ; x++) { - int minr= x-rad<0?-x:-rad; - int maxr= x+rad>imgx?imgx-x:rad; + for (y = 0; y < imgy; y++) { + float *srcd= img->rect + pix*(y*img->x); - src= srcd + pix*(x+minr); + dest = work->rect + pix*(y * img->x); - sum= gval = rval= bval= aval= 0.0f; - for (i= minr; i < maxr; i++) { - val= gausstabcent[i]; - sum+= val; - rval += val * (*src++); + for (x = 0; x < imgx ; x++) { + int minr= x-rad<0?-x:-rad; + int maxr= x+rad>imgx?imgx-x:rad; + + src= srcd + pix*(x+minr); + + sum= gval = rval= bval= aval= 0.0f; + for (i= minr; i < maxr; i++) { + val= gausstabcent[i]; + sum+= val; + rval += val * (*src++); + if(pix==4) { + gval += val * (*src++); + bval += val * (*src++); + aval += val * (*src++); + } + } + sum= 1.0f/sum; + *dest++ = rval*sum; if(pix==4) { - gval += val * (*src++); - bval += val * (*src++); - aval += val * (*src++); + *dest++ = gval*sum; + *dest++ = bval*sum; + *dest++ = aval*sum; } } - sum= 1.0f/sum; - *dest++ = rval*sum; - if(pix==4) { - *dest++ = gval*sum; - *dest++ = bval*sum; - *dest++ = aval*sum; - } + if(node->exec & NODE_BREAK) + break; } - if(node->exec & NODE_BREAK) - break; + + /* vertical */ + MEM_freeN(gausstab); } - /* vertical */ - MEM_freeN(gausstab); - - rad = scale*(float)nbd->sizey; - if(rad>imgy/2) - rad= imgy/2; - else if(rad<1) - rad= 1; - - gausstab= make_gausstab(nbd->filtertype, rad); - gausstabcent= gausstab+rad; - - bigstep = pix*imgx; - for (x = 0; x < imgx; x++) { - float *srcd= work->rect + pix*x; - - dest = new->rect + pix*x; + if(nbd->sizey == 0) { + memcpy(new->rect, work->rect, sizeof(float) * img->type * imgx * imgy); + } + else { + rad = scale*(float)nbd->sizey; + if(rad>imgy/2) + rad= imgy/2; + else if(rad<1) + rad= 1; + + gausstab= make_gausstab(nbd->filtertype, rad); + gausstabcent= gausstab+rad; - for (y = 0; y < imgy ; y++) { - int minr= y-rad<0?-y:-rad; - int maxr= y+rad>imgy?imgy-y:rad; + bigstep = pix*imgx; + for (x = 0; x < imgx; x++) { + float *srcd= work->rect + pix*x; - src= srcd + bigstep*(y+minr); + dest = new->rect + pix*x; - sum= gval = rval= bval= aval= 0.0f; - for (i= minr; i < maxr; i++) { - val= gausstabcent[i]; - sum+= val; - rval += val * src[0]; + for (y = 0; y < imgy ; y++) { + int minr= y-rad<0?-y:-rad; + int maxr= y+rad>imgy?imgy-y:rad; + + src= srcd + bigstep*(y+minr); + + sum= gval = rval= bval= aval= 0.0f; + for (i= minr; i < maxr; i++) { + val= gausstabcent[i]; + sum+= val; + rval += val * src[0]; + if(pix==4) { + gval += val * src[1]; + bval += val * src[2]; + aval += val * src[3]; + } + src += bigstep; + } + sum= 1.0f/sum; + dest[0] = rval*sum; if(pix==4) { - gval += val * src[1]; - bval += val * src[2]; - aval += val * src[3]; + dest[1] = gval*sum; + dest[2] = bval*sum; + dest[3] = aval*sum; } - src += bigstep; + dest+= bigstep; } - sum= 1.0f/sum; - dest[0] = rval*sum; - if(pix==4) { - dest[1] = gval*sum; - dest[2] = bval*sum; - dest[3] = aval*sum; - } - dest+= bigstep; + if(node->exec & NODE_BREAK) + break; } - if(node->exec & NODE_BREAK) - break; + MEM_freeN(gausstab); } - + free_compbuf(work); - MEM_freeN(gausstab); } /* reference has to be mapped 0-1, and equal in size */ -static void bloom_with_reference(CompBuf *new, CompBuf *img, CompBuf *ref, float fac, NodeBlurData *nbd) +static void bloom_with_reference(CompBuf *new, CompBuf *img, CompBuf *UNUSED(ref), float UNUSED(fac), NodeBlurData *nbd) { CompBuf *wbuf; register float val; @@ -572,7 +582,11 @@ static void node_composit_exec_blur(void *data, bNode *node, bNodeStack **in, bN nbd->sizey= (int)(nbd->percenty*nbd->image_in_height); } - if (((NodeBlurData *)node->storage)->filtertype == R_FILTER_FAST_GAUSS) { + if (nbd->sizex==0 && nbd->sizey==0) { + new= pass_on_compbuf(img); + out[0]->data= new; + } + 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];*/ @@ -612,6 +626,7 @@ static void node_composit_exec_blur(void *data, bNode *node, bNodeStack **in, bN /* if fac input, we do it different */ if(in[1]->data) { + CompBuf *gammabuf; /* make output size of input image */ new= alloc_compbuf(img->x, img->y, img->type, 1); /* allocs */ @@ -620,7 +635,18 @@ static void node_composit_exec_blur(void *data, bNode *node, bNodeStack **in, bN new->xof = img->xof; new->yof = img->yof; - blur_with_reference(node, new, img, in[1]->data); + if(nbd->gamma) { + gammabuf= dupalloc_compbuf(img); + gamma_correct_compbuf(gammabuf, 0); + } + else gammabuf= img; + + blur_with_reference(node, new, gammabuf, in[1]->data); + + if(nbd->gamma) { + gamma_correct_compbuf(new, 1); + free_compbuf(gammabuf); + } if(node->exec & NODE_BREAK) { free_compbuf(new); new= NULL; @@ -633,7 +659,6 @@ static void node_composit_exec_blur(void *data, bNode *node, bNodeStack **in, bN new= pass_on_compbuf(img); } else { - NodeBlurData *nbd= node->storage; CompBuf *gammabuf; /* make output size of input image */ diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_brightness.c b/source/blender/nodes/intern/CMP_nodes/CMP_brightness.c index 03eed59a4c4..889d61fe4fa 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_brightness.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_brightness.c @@ -77,7 +77,7 @@ static void do_brightnesscontrast(bNode *node, float *out, float *in) } } -static void node_composit_exec_brightcontrast(void *data, bNode *node, bNodeStack **in, bNodeStack **out) +static void node_composit_exec_brightcontrast(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out) { if(out[0]->hasoutput==0) return; diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_channelMatte.c b/source/blender/nodes/intern/CMP_nodes/CMP_channelMatte.c index ca7c19cc778..182c339132e 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_channelMatte.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_channelMatte.c @@ -42,7 +42,7 @@ static bNodeSocketType cmp_node_channel_matte_out[]={ {-1,0,""} }; -static void do_normalized_rgba_to_ycca2(bNode *node, float *out, float *in) +static void do_normalized_rgba_to_ycca2(bNode *UNUSED(node), float *out, float *in) { /*normalize to the range 0.0 to 1.0) */ rgb_to_ycc(in[0],in[1],in[2], &out[0], &out[1], &out[2], BLI_YCC_ITU_BT601); @@ -52,7 +52,7 @@ static void do_normalized_rgba_to_ycca2(bNode *node, float *out, float *in) out[3]=in[3]; } -static void do_normalized_ycca_to_rgba2(bNode *node, float *out, float *in) +static void do_normalized_ycca_to_rgba2(bNode *UNUSED(node), float *out, float *in) { /*un-normalize the normalize from above */ in[0]=in[0]*255.0; diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_chromaMatte.c b/source/blender/nodes/intern/CMP_nodes/CMP_chromaMatte.c index e502129c3d3..d102afbbd16 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_chromaMatte.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_chromaMatte.c @@ -42,7 +42,7 @@ static bNodeSocketType cmp_node_chroma_out[]={ {-1,0,""} }; -static void do_rgba_to_ycca_normalized(bNode *node, float *out, float *in) +static void do_rgba_to_ycca_normalized(bNode *UNUSED(node), float *out, float *in) { rgb_to_ycc(in[0],in[1],in[2], &out[0], &out[1], &out[2], BLI_YCC_ITU_BT601); @@ -62,7 +62,7 @@ static void do_rgba_to_ycca_normalized(bNode *node, float *out, float *in) out[3]=in[3]; } -static void do_ycca_to_rgba_normalized(bNode *node, float *out, float *in) +static void do_ycca_to_rgba_normalized(bNode *UNUSED(node), float *out, float *in) { /*un-normalize the normalize from above */ in[0]=(in[0]+1.0)/2.0; diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_colorSpill.c b/source/blender/nodes/intern/CMP_nodes/CMP_colorSpill.c index 3191ad757a0..408bda02ee4 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_colorSpill.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_colorSpill.c @@ -182,7 +182,7 @@ static void do_apply_spillmap_blue(bNode *node, float* out, float *in, float *ma } } -static void node_composit_exec_color_spill(void *data, bNode *node, bNodeStack **in, bNodeStack **out) +static void node_composit_exec_color_spill(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out) { /* Originally based on the information from the book "The Art and Science of Digital Composition" and diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_colorbalance.c b/source/blender/nodes/intern/CMP_nodes/CMP_colorbalance.c index 33f5680eaa9..c8e0108a5c8 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_colorbalance.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_colorbalance.c @@ -120,7 +120,7 @@ static void do_colorbalance_lgg_fac(bNode *node, float* out, float *in, float *f out[3] = in[3]; } -static void node_composit_exec_colorbalance(void *data, bNode *node, bNodeStack **in, bNodeStack **out) +static void node_composit_exec_colorbalance(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out) { CompBuf *cbuf= in[1]->data; CompBuf *stackbuf; diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_composite.c b/source/blender/nodes/intern/CMP_nodes/CMP_composite.c index 7510a2d11d4..ffb090f3a94 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_composite.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_composite.c @@ -40,7 +40,7 @@ static bNodeSocketType cmp_node_composite_in[]= { }; /* applies to render pipeline */ -static void node_composit_exec_composite(void *data, bNode *node, bNodeStack **in, bNodeStack **out) +static void node_composit_exec_composite(void *data, bNode *node, bNodeStack **in, bNodeStack **UNUSED(out)) { /* image assigned to output */ /* stack order input sockets: col, alpha, z */ diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_crop.c b/source/blender/nodes/intern/CMP_nodes/CMP_crop.c index dd5ce88bd36..7ecfe40f739 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_crop.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_crop.c @@ -40,7 +40,7 @@ static bNodeSocketType cmp_node_crop_out[]= { { -1, 0, "" } }; -static void node_composit_exec_crop(void *data, bNode *node, bNodeStack **in, bNodeStack **out) +static void node_composit_exec_crop(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out) { if(in[0]->data) { NodeTwoXYs *ntxy= node->storage; diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_curves.c b/source/blender/nodes/intern/CMP_nodes/CMP_curves.c index e4afa1922bb..1a88e9541c6 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_curves.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_curves.c @@ -38,7 +38,7 @@ static bNodeSocketType cmp_node_time_out[]= { { -1, 0, "" } }; -static void node_composit_exec_curves_time(void *data, bNode *node, bNodeStack **in, bNodeStack **out) +static void node_composit_exec_curves_time(void *data, bNode *node, bNodeStack **UNUSED(in), bNodeStack **out) { RenderData *rd= data; /* stack order output: fac */ @@ -89,7 +89,7 @@ static bNodeSocketType cmp_node_curve_vec_out[]= { { -1, 0, "" } }; -static void node_composit_exec_curve_vec(void *data, bNode *node, bNodeStack **in, bNodeStack **out) +static void node_composit_exec_curve_vec(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out) { /* stack order input: vec */ /* stack order output: vec */ @@ -158,7 +158,7 @@ static void do_curves_fac(bNode *node, float *out, float *in, float *fac) out[3]= in[3]; } -static void node_composit_exec_curve_rgb(void *data, bNode *node, bNodeStack **in, bNodeStack **out) +static void node_composit_exec_curve_rgb(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out) { /* stack order input: fac, image, black level, white level */ /* stack order output: image */ diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_defocus.c b/source/blender/nodes/intern/CMP_nodes/CMP_defocus.c index a93a5760842..5c25bffa5d9 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_defocus.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_defocus.c @@ -791,7 +791,7 @@ static void defocus_blur(bNode *node, CompBuf *new, CompBuf *img, CompBuf *zbuf, } -static void node_composit_exec_defocus(void *data, bNode *node, bNodeStack **in, bNodeStack **out) +static void node_composit_exec_defocus(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out) { CompBuf *new, *old, *zbuf_use = NULL, *img = in[0]->data, *zbuf = in[1]->data; NodeDefocus *nqd = node->storage; diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_dilate.c b/source/blender/nodes/intern/CMP_nodes/CMP_dilate.c index 6c67413ea1f..71990b7403a 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_dilate.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_dilate.c @@ -110,7 +110,7 @@ static void morpho_erode(CompBuf *cbuf) } -static void node_composit_exec_dilateerode(void *data, bNode *node, bNodeStack **in, bNodeStack **out) +static void node_composit_exec_dilateerode(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out) { /* stack order in: mask */ /* stack order out: mask */ diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_directionalblur.c b/source/blender/nodes/intern/CMP_nodes/CMP_directionalblur.c index b0cf5559772..42bf48b9128 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_directionalblur.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_directionalblur.c @@ -102,7 +102,7 @@ static CompBuf *dblur(bNode *node, CompBuf *img, int iterations, int wrap, return img; } -static void node_composit_exec_dblur(void *data, bNode *node, bNodeStack **in, bNodeStack **out) +static void node_composit_exec_dblur(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out) { NodeDBlurData *ndbd= node->storage; CompBuf *new, *img= in[0]->data; diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_displace.c b/source/blender/nodes/intern/CMP_nodes/CMP_displace.c index aa7fac81c2c..1ce545e2ca8 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_displace.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_displace.c @@ -48,7 +48,7 @@ static bNodeSocketType cmp_node_displace_out[]= { * in order to take effect */ #define DISPLACE_EPSILON 0.01 -static void do_displace(CompBuf *stackbuf, CompBuf *cbuf, CompBuf *vecbuf, float *veccol, CompBuf *xbuf, CompBuf *ybuf, float *xscale, float *yscale) +static void do_displace(CompBuf *stackbuf, CompBuf *cbuf, CompBuf *vecbuf, float *UNUSED(veccol), CompBuf *xbuf, CompBuf *ybuf, float *xscale, float *yscale) { ImBuf *ibuf; int x, y; @@ -60,7 +60,7 @@ static void do_displace(CompBuf *stackbuf, CompBuf *cbuf, CompBuf *vecbuf, float float vec[3], vecdx[3], vecdy[3]; float col[3]; - ibuf= IMB_allocImBuf(cbuf->x, cbuf->y, 32, 0, 0); + ibuf= IMB_allocImBuf(cbuf->x, cbuf->y, 32, 0); ibuf->rect_float= cbuf->rect; for(y=0; y < stackbuf->y; y++) { @@ -140,7 +140,7 @@ static void do_displace(CompBuf *stackbuf, CompBuf *cbuf, CompBuf *vecbuf, float } -static void node_composit_exec_displace(void *data, bNode *node, bNodeStack **in, bNodeStack **out) +static void node_composit_exec_displace(void *UNUSED(data), bNode *UNUSED(node), bNodeStack **in, bNodeStack **out) { if(out[0]->hasoutput==0) return; diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_flip.c b/source/blender/nodes/intern/CMP_nodes/CMP_flip.c index fbc570c4028..33a17f890d8 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_flip.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_flip.c @@ -40,7 +40,7 @@ static bNodeSocketType cmp_node_flip_out[]= { { -1, 0, "" } }; -static void node_composit_exec_flip(void *data, bNode *node, bNodeStack **in, bNodeStack **out) +static void node_composit_exec_flip(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out) { if(in[0]->data) { CompBuf *cbuf= in[0]->data; diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_gamma.c b/source/blender/nodes/intern/CMP_nodes/CMP_gamma.c index c0e524a3ae9..2e3162b0c30 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_gamma.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_gamma.c @@ -42,7 +42,7 @@ static bNodeSocketType cmp_node_gamma_out[]= { { -1, 0, "" } }; -static void do_gamma(bNode *node, float *out, float *in, float *fac) +static void do_gamma(bNode *UNUSED(node), float *out, float *in, float *fac) { int i=0; for(i=0; i<3; i++) { @@ -51,7 +51,7 @@ static void do_gamma(bNode *node, float *out, float *in, float *fac) } out[3] = in[3]; } -static void node_composit_exec_gamma(void *data, bNode *node, bNodeStack **in, bNodeStack **out) +static void node_composit_exec_gamma(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out) { /* stack order in: Fac, Image */ /* stack order out: Image */ diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_glare.c b/source/blender/nodes/intern/CMP_nodes/CMP_glare.c index 1d50acfdc26..d4968caee0f 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_glare.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_glare.c @@ -422,7 +422,7 @@ static void fglow(NodeGlare* ndg, CompBuf* dst, CompBuf* src) //-------------------------------------------------------------------------------------------- -static void node_composit_exec_glare(void *data, bNode *node, bNodeStack **in, bNodeStack **out) +static void node_composit_exec_glare(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out) { CompBuf *new, *src, *img = in[0]->data; NodeGlare* ndg = node->storage; diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_hueSatVal.c b/source/blender/nodes/intern/CMP_nodes/CMP_hueSatVal.c index c274c580771..e8ce3e20f11 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_hueSatVal.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_hueSatVal.c @@ -65,7 +65,7 @@ static void do_hue_sat_fac(bNode *node, float *out, float *in, float *fac) } } -static void node_composit_exec_hue_sat(void *data, bNode *node, bNodeStack **in, bNodeStack **out) +static void node_composit_exec_hue_sat(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out) { /* stack order in: Fac, Image */ /* stack order out: Image */ diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_huecorrect.c b/source/blender/nodes/intern/CMP_nodes/CMP_huecorrect.c index 9eb79bb8c36..ac009ccb69d 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_huecorrect.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_huecorrect.c @@ -98,7 +98,7 @@ static void do_huecorrect_fac(bNode *node, float *out, float *in, float *fac) out[3]= in[3]; } -static void node_composit_exec_huecorrect(void *data, bNode *node, bNodeStack **in, bNodeStack **out) +static void node_composit_exec_huecorrect(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out) { CompBuf *cbuf= in[1]->data; CompBuf *stackbuf; diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_image.c b/source/blender/nodes/intern/CMP_nodes/CMP_image.c index 9309d2939db..dcf9a059c83 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_image.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_image.c @@ -77,25 +77,31 @@ static CompBuf *node_composit_get_image(RenderData *rd, Image *ima, ImageUser *i /* now we need a float buffer from the image * with matching color management */ - if(rd->color_mgt_flag & R_COLOR_MANAGEMENT) { - if(ibuf->profile != IB_PROFILE_NONE) { - rect= ibuf->rect_float; + if(ibuf->channels == 4) { + if(rd->color_mgt_flag & R_COLOR_MANAGEMENT) { + if(ibuf->profile != IB_PROFILE_NONE) { + rect= ibuf->rect_float; + } + else { + rect= MEM_mapallocN(sizeof(float) * 4 * ibuf->x * ibuf->y, "node_composit_get_image"); + srgb_to_linearrgb_rgba_rgba_buf(rect, ibuf->rect_float, ibuf->x * ibuf->y); + alloc= TRUE; + } } else { - rect= MEM_mapallocN(sizeof(float) * 4 * ibuf->x * ibuf->y, "node_composit_get_image"); - srgb_to_linearrgb_rgba_rgba_buf(rect, ibuf->rect_float, ibuf->x * ibuf->y); - alloc= TRUE; + if(ibuf->profile == IB_PROFILE_NONE) { + rect= ibuf->rect_float; + } + else { + rect= MEM_mapallocN(sizeof(float) * 4 * ibuf->x * ibuf->y, "node_composit_get_image"); + linearrgb_to_srgb_rgba_rgba_buf(rect, ibuf->rect_float, ibuf->x * ibuf->y); + alloc= TRUE; + } } } else { - if(ibuf->profile == IB_PROFILE_NONE) { - rect= ibuf->rect_float; - } - else { - rect= MEM_mapallocN(sizeof(float) * 4 * ibuf->x * ibuf->y, "node_composit_get_image"); - linearrgb_to_srgb_rgba_rgba_buf(rect, ibuf->rect_float, ibuf->x * ibuf->y); - alloc= TRUE; - } + /* non-rgba passes can't use color profiles */ + rect= ibuf->rect_float; } /* done coercing into the correct color management */ @@ -209,7 +215,7 @@ void outputs_multilayer_get(RenderData *rd, RenderLayer *rl, bNodeStack **out, I }; -static void node_composit_exec_image(void *data, bNode *node, bNodeStack **in, bNodeStack **out) +static void node_composit_exec_image(void *data, bNode *node, bNodeStack **UNUSED(in), bNodeStack **out) { /* image assigned to output */ @@ -372,7 +378,7 @@ void node_composit_rlayers_out(RenderData *rd, RenderLayer *rl, bNodeStack **out out[RRES_OUT_ENV]->data= compbuf_from_pass(rd, rl, rectx, recty, SCE_PASS_ENVIRONMENT); }; -static void node_composit_exec_rlayers(void *data, bNode *node, bNodeStack **in, bNodeStack **out) +static void node_composit_exec_rlayers(void *data, bNode *node, bNodeStack **UNUSED(in), bNodeStack **out) { Scene *sce= (Scene *)node->id; Render *re= (sce)? RE_GetRender(sce->id.name): NULL; diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_invert.c b/source/blender/nodes/intern/CMP_nodes/CMP_invert.c index 08ae51975b9..7ea146c7d4d 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_invert.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_invert.c @@ -75,7 +75,7 @@ static void do_invert_fac(bNode *node, float *out, float *in, float *fac) QUATCOPY(out, col); } -static void node_composit_exec_invert(void *data, bNode *node, bNodeStack **in, bNodeStack **out) +static void node_composit_exec_invert(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out) { /* stack order in: fac, Image, Image */ /* stack order out: Image */ diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_lensdist.c b/source/blender/nodes/intern/CMP_nodes/CMP_lensdist.c index fc9045caafd..b6e1fffcce8 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_lensdist.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_lensdist.c @@ -147,7 +147,7 @@ static void lensDistort(CompBuf* dst, CompBuf* src, float kr, float kg, float kb } -static void node_composit_exec_lensdist(void *data, bNode *node, bNodeStack **in, bNodeStack **out) +static void node_composit_exec_lensdist(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out) { CompBuf *new, *img = in[0]->data; NodeLensDist* nld = node->storage; diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_mapUV.c b/source/blender/nodes/intern/CMP_nodes/CMP_mapUV.c index 91d1aa148b2..c605a661556 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_mapUV.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_mapUV.c @@ -51,7 +51,7 @@ static void do_mapuv(CompBuf *stackbuf, CompBuf *cbuf, CompBuf *uvbuf, float thr int x, y, sx, sy, row= 3*stackbuf->x; /* ibuf needed for sampling */ - ibuf= IMB_allocImBuf(cbuf->x, cbuf->y, 32, 0, 0); + ibuf= IMB_allocImBuf(cbuf->x, cbuf->y, 32, 0); ibuf->rect_float= cbuf->rect; /* vars for efficient looping */ @@ -134,7 +134,7 @@ static void do_mapuv(CompBuf *stackbuf, CompBuf *cbuf, CompBuf *uvbuf, float thr } -static void node_composit_exec_mapuv(void *data, bNode *node, bNodeStack **in, bNodeStack **out) +static void node_composit_exec_mapuv(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out) { if(out[0]->hasoutput==0) return; diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_mapValue.c b/source/blender/nodes/intern/CMP_nodes/CMP_mapValue.c index 357218ea937..92709025a84 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_mapValue.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_mapValue.c @@ -52,7 +52,7 @@ static void do_map_value(bNode *node, float *out, float *src) out[0]= texmap->max[0]; } -static void node_composit_exec_map_value(void *data, bNode *node, bNodeStack **in, bNodeStack **out) +static void node_composit_exec_map_value(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out) { /* stack order in: valbuf */ /* stack order out: valbuf */ diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_math.c b/source/blender/nodes/intern/CMP_nodes/CMP_math.c index f663dc76b5c..98bbbf6c752 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_math.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_math.c @@ -151,7 +151,7 @@ static void do_math(bNode *node, float *out, float *in, float *in2) } } -static void node_composit_exec_math(void *data, bNode *node, bNodeStack **in, bNodeStack **out) +static void node_composit_exec_math(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out) { CompBuf *cbuf=in[0]->data; CompBuf *cbuf2=in[1]->data; diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_normal.c b/source/blender/nodes/intern/CMP_nodes/CMP_normal.c index c57caf180ad..04162956ac3 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_normal.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_normal.c @@ -52,7 +52,7 @@ static void do_normal(bNode *node, float *out, float *in) } /* generates normal, does dot product */ -static void node_composit_exec_normal(void *data, bNode *node, bNodeStack **in, bNodeStack **out) +static void node_composit_exec_normal(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out) { bNodeSocket *sock= node->outputs.first; /* stack order input: normal */ diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_normalize.c b/source/blender/nodes/intern/CMP_nodes/CMP_normalize.c index 64855ba5cf3..07a11cdc997 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_normalize.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_normalize.c @@ -40,7 +40,7 @@ static bNodeSocketType cmp_node_normalize_out[]= { { -1, 0, "" } }; -static void do_normalize(bNode *node, float *out, float *src, float *min, float *mult) +static void do_normalize(bNode *UNUSED(node), float *out, float *src, float *min, float *mult) { float res; res = (src[0] - min[0]) * mult[0]; @@ -58,7 +58,7 @@ static void do_normalize(bNode *node, float *out, float *src, float *min, float /* The code below assumes all data is inside range +- this, and that input buffer is single channel */ #define BLENDER_ZMAX 10000.0f -static void node_composit_exec_normalize(void *data, bNode *node, bNodeStack **in, bNodeStack **out) +static void node_composit_exec_normalize(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out) { /* stack order in: valbuf */ /* stack order out: valbuf */ diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_outputFile.c b/source/blender/nodes/intern/CMP_nodes/CMP_outputFile.c index 6f29548fcc3..85baa8c347a 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_outputFile.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_outputFile.c @@ -36,7 +36,7 @@ static bNodeSocketType cmp_node_output_file_in[]= { { -1, 0, "" } }; -static void node_composit_exec_output_file(void *data, bNode *node, bNodeStack **in, bNodeStack **out) +static void node_composit_exec_output_file(void *data, bNode *node, bNodeStack **in, bNodeStack **UNUSED(out)) { /* image assigned to output */ /* stack order input sockets: col, alpha */ @@ -54,7 +54,7 @@ static void node_composit_exec_output_file(void *data, bNode *node, bNodeStack * return; } else { CompBuf *cbuf= typecheck_compbuf(in[0]->data, CB_RGBA); - ImBuf *ibuf= IMB_allocImBuf(cbuf->x, cbuf->y, 32, 0, 0); + ImBuf *ibuf= IMB_allocImBuf(cbuf->x, cbuf->y, 32, 0); char string[256]; ibuf->rect_float= cbuf->rect; diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_premulkey.c b/source/blender/nodes/intern/CMP_nodes/CMP_premulkey.c index 5058fa51c11..1aa2e338f94 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_premulkey.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_premulkey.c @@ -41,7 +41,7 @@ static bNodeSocketType cmp_node_premulkey_out[]= { { -1, 0, "" } }; -static void node_composit_exec_premulkey(void *data, bNode *node, bNodeStack **in, bNodeStack **out) +static void node_composit_exec_premulkey(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out) { if(out[0]->hasoutput==0) return; diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_rgb.c b/source/blender/nodes/intern/CMP_nodes/CMP_rgb.c index 3b9b993d5f8..5fbed05ac8d 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_rgb.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_rgb.c @@ -36,7 +36,7 @@ static bNodeSocketType cmp_node_rgb_out[]= { { -1, 0, "" } }; -static void node_composit_exec_rgb(void *data, bNode *node, bNodeStack **in, bNodeStack **out) +static void node_composit_exec_rgb(void *UNUSED(data), bNode *node, bNodeStack **UNUSED(in), bNodeStack **out) { bNodeSocket *sock= node->outputs.first; diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_rotate.c b/source/blender/nodes/intern/CMP_nodes/CMP_rotate.c index ccb1d8abfd9..8fed6972c20 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_rotate.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_rotate.c @@ -42,7 +42,7 @@ static bNodeSocketType cmp_node_rotate_out[]= { }; /* only supports RGBA nodes now */ -static void node_composit_exec_rotate(void *data, bNode *node, bNodeStack **in, bNodeStack **out) +static void node_composit_exec_rotate(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out) { if(out[0]->hasoutput==0) @@ -68,8 +68,8 @@ static void node_composit_exec_rotate(void *data, bNode *node, bNodeStack **in, maxy= -centy + (float)cbuf->y; - ibuf=IMB_allocImBuf(cbuf->x, cbuf->y, 32, 0, 0); - obuf=IMB_allocImBuf(stackbuf->x, stackbuf->y, 32, 0, 0); + ibuf=IMB_allocImBuf(cbuf->x, cbuf->y, 32, 0); + obuf=IMB_allocImBuf(stackbuf->x, stackbuf->y, 32, 0); if(ibuf && obuf){ ibuf->rect_float=cbuf->rect; diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_scale.c b/source/blender/nodes/intern/CMP_nodes/CMP_scale.c index 9779875b01a..40785f3bc77 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_scale.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_scale.c @@ -75,7 +75,7 @@ static void node_composit_exec_scale(void *data, bNode *node, bNodeStack **in, b newx= MIN2(newx, CMP_SCALE_MAX); newy= MIN2(newy, CMP_SCALE_MAX); - ibuf= IMB_allocImBuf(cbuf->x, cbuf->y, 32, 0, 0); + ibuf= IMB_allocImBuf(cbuf->x, cbuf->y, 32, 0); if(ibuf) { ibuf->rect_float= cbuf->rect; IMB_scaleImBuf(ibuf, newx, newy); diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_sepcombHSVA.c b/source/blender/nodes/intern/CMP_nodes/CMP_sepcombHSVA.c index 0ac47c58ab3..ef8723fd4e9 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_sepcombHSVA.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_sepcombHSVA.c @@ -43,7 +43,7 @@ static bNodeSocketType cmp_node_sephsva_out[]= { { -1, 0, "" } }; -static void do_sephsva(bNode *node, float *out, float *in) +static void do_sephsva(bNode *UNUSED(node), float *out, float *in) { float h, s, v; @@ -55,7 +55,7 @@ static void do_sephsva(bNode *node, float *out, float *in) out[3]= in[3]; } -static void node_composit_exec_sephsva(void *data, bNode *node, bNodeStack **in, bNodeStack **out) +static void node_composit_exec_sephsva(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out) { /* stack order out: bw channels */ /* stack order in: col */ @@ -127,7 +127,7 @@ static bNodeSocketType cmp_node_combhsva_out[]= { { -1, 0, "" } }; -static void do_comb_hsva(bNode *node, float *out, float *in1, float *in2, float *in3, float *in4) +static void do_comb_hsva(bNode *UNUSED(node), float *out, float *in1, float *in2, float *in3, float *in4) { float r,g,b; hsv_to_rgb(in1[0], in2[0], in3[0], &r, &g, &b); @@ -138,7 +138,7 @@ static void do_comb_hsva(bNode *node, float *out, float *in1, float *in2, float out[3] = in4[0]; } -static void node_composit_exec_combhsva(void *data, bNode *node, bNodeStack **in, bNodeStack **out) +static void node_composit_exec_combhsva(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out) { /* stack order out: 1 rgba channels */ /* stack order in: 4 value channels */ diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_sepcombRGBA.c b/source/blender/nodes/intern/CMP_nodes/CMP_sepcombRGBA.c index c5a57f8a175..36603785bb3 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_sepcombRGBA.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_sepcombRGBA.c @@ -42,7 +42,7 @@ static bNodeSocketType cmp_node_seprgba_out[]= { { -1, 0, "" } }; -static void node_composit_exec_seprgba(void *data, bNode *node, bNodeStack **in, bNodeStack **out) +static void node_composit_exec_seprgba(void *UNUSED(data), bNode *UNUSED(node), bNodeStack **in, bNodeStack **out) { /* stack order out: bw channels */ /* stack order in: col */ @@ -106,7 +106,7 @@ static bNodeSocketType cmp_node_combrgba_out[]= { { -1, 0, "" } }; -static void do_combrgba(bNode *node, float *out, float *in1, float *in2, float *in3, float *in4) +static void do_combrgba(bNode *UNUSED(node), float *out, float *in1, float *in2, float *in3, float *in4) { out[0] = in1[0]; out[1] = in2[0]; @@ -114,7 +114,7 @@ static void do_combrgba(bNode *node, float *out, float *in1, float *in2, float * out[3] = in4[0]; } -static void node_composit_exec_combrgba(void *data, bNode *node, bNodeStack **in, bNodeStack **out) +static void node_composit_exec_combrgba(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out) { /* stack order out: 1 rgba channels */ /* stack order in: 4 value channels */ diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_sepcombYCCA.c b/source/blender/nodes/intern/CMP_nodes/CMP_sepcombYCCA.c index 7b3dfccab50..4b164729bbc 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_sepcombYCCA.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_sepcombYCCA.c @@ -43,7 +43,7 @@ static bNodeSocketType cmp_node_sepycca_out[]= { { -1, 0, "" } }; -static void do_sepycca(bNode *node, float *out, float *in) +static void do_sepycca(bNode *UNUSED(node), float *out, float *in) { float y, cb, cr; @@ -56,7 +56,7 @@ static void do_sepycca(bNode *node, float *out, float *in) out[3]= in[3]; } -static void node_composit_exec_sepycca(void *data, bNode *node, bNodeStack **in, bNodeStack **out) +static void node_composit_exec_sepycca(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out) { /* input no image? then only color operation */ if(in[0]->data==NULL) { @@ -126,7 +126,7 @@ static bNodeSocketType cmp_node_combycca_out[]= { { -1, 0, "" } }; -static void do_comb_ycca(bNode *node, float *out, float *in1, float *in2, float *in3, float *in4) +static void do_comb_ycca(bNode *UNUSED(node), float *out, float *in1, float *in2, float *in3, float *in4) { float r,g,b; float y, cb, cr; @@ -144,7 +144,7 @@ static void do_comb_ycca(bNode *node, float *out, float *in1, float *in2, float out[3] = in4[0]; } -static void node_composit_exec_combycca(void *data, bNode *node, bNodeStack **in, bNodeStack **out) +static void node_composit_exec_combycca(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out) { /* stack order out: 1 ycca channels */ /* stack order in: 4 value channels */ diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_sepcombYUVA.c b/source/blender/nodes/intern/CMP_nodes/CMP_sepcombYUVA.c index 13b71026054..333a4a2596e 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_sepcombYUVA.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_sepcombYUVA.c @@ -43,7 +43,7 @@ static bNodeSocketType cmp_node_sepyuva_out[]= { { -1, 0, "" } }; -static void do_sepyuva(bNode *node, float *out, float *in) +static void do_sepyuva(bNode *UNUSED(node), float *out, float *in) { float y, u, v; @@ -55,7 +55,7 @@ static void do_sepyuva(bNode *node, float *out, float *in) out[3]= in[3]; } -static void node_composit_exec_sepyuva(void *data, bNode *node, bNodeStack **in, bNodeStack **out) +static void node_composit_exec_sepyuva(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out) { /* stack order out: bw channels */ /* stack order in: col */ @@ -127,7 +127,7 @@ static bNodeSocketType cmp_node_combyuva_out[]= { { -1, 0, "" } }; -static void do_comb_yuva(bNode *node, float *out, float *in1, float *in2, float *in3, float *in4) +static void do_comb_yuva(bNode *UNUSED(node), float *out, float *in1, float *in2, float *in3, float *in4) { float r,g,b; yuv_to_rgb(in1[0], in2[0], in3[0], &r, &g, &b); @@ -138,7 +138,7 @@ static void do_comb_yuva(bNode *node, float *out, float *in1, float *in2, float out[3] = in4[0]; } -static void node_composit_exec_combyuva(void *data, bNode *node, bNodeStack **in, bNodeStack **out) +static void node_composit_exec_combyuva(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out) { /* stack order out: 1 rgba channels */ /* stack order in: 4 value channels */ diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_setalpha.c b/source/blender/nodes/intern/CMP_nodes/CMP_setalpha.c index a7d10017c1f..f4c5603ce49 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_setalpha.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_setalpha.c @@ -40,7 +40,7 @@ static bNodeSocketType cmp_node_setalpha_out[]= { { -1, 0, "" } }; -static void node_composit_exec_setalpha(void *data, bNode *node, bNodeStack **in, bNodeStack **out) +static void node_composit_exec_setalpha(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out) { /* stack order out: RGBA image */ /* stack order in: col, alpha */ diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_splitViewer.c b/source/blender/nodes/intern/CMP_nodes/CMP_splitViewer.c index 98bda1bd7fa..efb8c12fa84 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_splitViewer.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_splitViewer.c @@ -36,7 +36,7 @@ static bNodeSocketType cmp_node_splitviewer_in[]= { { -1, 0, "" } }; -static void do_copy_split_rgba(bNode *node, float *out, float *in1, float *in2, float *fac) +static void do_copy_split_rgba(bNode *UNUSED(node), float *out, float *in1, float *in2, float *fac) { if(*fac==0.0f) { QUATCOPY(out, in1); @@ -46,7 +46,7 @@ static void do_copy_split_rgba(bNode *node, float *out, float *in1, float *in2, } } -static void node_composit_exec_splitviewer(void *data, bNode *node, bNodeStack **in, bNodeStack **out) +static void node_composit_exec_splitviewer(void *data, bNode *node, bNodeStack **in, bNodeStack **UNUSED(out)) { /* image assigned to output */ /* stack order input sockets: image image */ diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_tonemap.c b/source/blender/nodes/intern/CMP_nodes/CMP_tonemap.c index 12f0c171f94..49031e1625a 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_tonemap.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_tonemap.c @@ -123,7 +123,7 @@ static void tonemap(NodeTonemap* ntm, CompBuf* dst, CompBuf* src) } -static void node_composit_exec_tonemap(void *data, bNode *node, bNodeStack **in, bNodeStack **out) +static void node_composit_exec_tonemap(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out) { CompBuf *new, *img = in[0]->data; diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_translate.c b/source/blender/nodes/intern/CMP_nodes/CMP_translate.c index ca359d436f6..0d8ad41d2dd 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_translate.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_translate.c @@ -43,7 +43,7 @@ static bNodeSocketType cmp_node_translate_out[]= { { -1, 0, "" } }; -static void node_composit_exec_translate(void *data, bNode *node, bNodeStack **in, bNodeStack **out) +static void node_composit_exec_translate(void *UNUSED(data), bNode *UNUSED(node), bNodeStack **in, bNodeStack **out) { if(in[0]->data) { CompBuf *cbuf= in[0]->data; diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_valToRgb.c b/source/blender/nodes/intern/CMP_nodes/CMP_valToRgb.c index 6ce03f38cdb..7e0ecbcb888 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_valToRgb.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_valToRgb.c @@ -46,7 +46,7 @@ static void do_colorband_composit(bNode *node, float *out, float *in) do_colorband(node->storage, in[0], out); } -static void node_composit_exec_valtorgb(void *data, bNode *node, bNodeStack **in, bNodeStack **out) +static void node_composit_exec_valtorgb(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out) { /* stack order in: fac */ /* stack order out: col, alpha */ @@ -109,12 +109,12 @@ static bNodeSocketType cmp_node_rgbtobw_out[]= { { -1, 0, "" } }; -static void do_rgbtobw(bNode *node, float *out, float *in) +static void do_rgbtobw(bNode *UNUSED(node), float *out, float *in) { out[0]= in[0]*0.35f + in[1]*0.45f + in[2]*0.2f; } -static void node_composit_exec_rgbtobw(void *data, bNode *node, bNodeStack **in, bNodeStack **out) +static void node_composit_exec_rgbtobw(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out) { /* stack order out: bw */ /* stack order in: col */ diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_value.c b/source/blender/nodes/intern/CMP_nodes/CMP_value.c index 14a3b6fe15c..a37742c77e9 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_value.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_value.c @@ -35,7 +35,7 @@ static bNodeSocketType cmp_node_value_out[]= { { -1, 0, "" } }; -static void node_composit_exec_value(void *data, bNode *node, bNodeStack **in, bNodeStack **out) +static void node_composit_exec_value(void *UNUSED(data), bNode *node, bNodeStack **UNUSED(in), bNodeStack **out) { bNodeSocket *sock= node->outputs.first; diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_vecBlur.c b/source/blender/nodes/intern/CMP_nodes/CMP_vecBlur.c index eaeeadd02af..9ea626e39d6 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_vecBlur.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_vecBlur.c @@ -44,7 +44,7 @@ static bNodeSocketType cmp_node_vecblur_out[]= { -static void node_composit_exec_vecblur(void *data, bNode *node, bNodeStack **in, bNodeStack **out) +static void node_composit_exec_vecblur(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out) { NodeBlurData *nbd= node->storage; CompBuf *new, *img= in[0]->data, *vecbuf= in[2]->data, *zbuf= in[1]->data; diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_viewer.c b/source/blender/nodes/intern/CMP_nodes/CMP_viewer.c index 80200ad9ce6..24d8a9eb09e 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_viewer.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_viewer.c @@ -39,7 +39,7 @@ static bNodeSocketType cmp_node_viewer_in[]= { }; -static void node_composit_exec_viewer(void *data, bNode *node, bNodeStack **in, bNodeStack **out) +static void node_composit_exec_viewer(void *data, bNode *node, bNodeStack **in, bNodeStack **UNUSED(out)) { /* image assigned to output */ /* stack order input sockets: col, alpha, z */ diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_zcombine.c b/source/blender/nodes/intern/CMP_nodes/CMP_zcombine.c index 7be9f34f00b..80989feaf26 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_zcombine.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_zcombine.c @@ -67,7 +67,7 @@ static void do_zcombine_mask(bNode *node, float *out, float *z1, float *z2) } } -static void do_zcombine_add(bNode *node, float *out, float *col1, float *col2, float *acol) +static void do_zcombine_add(bNode *UNUSED(node), float *out, float *col1, float *col2, float *acol) { float alpha= *acol; float malpha= 1.0f - alpha; diff --git a/source/blender/nodes/intern/CMP_util.c b/source/blender/nodes/intern/CMP_util.c index 9edcc8b0eec..c762d8cb42d 100644 --- a/source/blender/nodes/intern/CMP_util.c +++ b/source/blender/nodes/intern/CMP_util.c @@ -662,59 +662,59 @@ void generate_preview(void *data, bNode *node, CompBuf *stackbuf) } } -void do_rgba_to_yuva(bNode *node, float *out, float *in) +void do_rgba_to_yuva(bNode *UNUSED(node), float *out, float *in) { rgb_to_yuv(in[0],in[1],in[2], &out[0], &out[1], &out[2]); out[3]=in[3]; } -void do_rgba_to_hsva(bNode *node, float *out, float *in) +void do_rgba_to_hsva(bNode *UNUSED(node), float *out, float *in) { rgb_to_hsv(in[0],in[1],in[2], &out[0], &out[1], &out[2]); out[3]=in[3]; } -void do_rgba_to_ycca(bNode *node, float *out, float *in) +void do_rgba_to_ycca(bNode *UNUSED(node), float *out, float *in) { rgb_to_ycc(in[0],in[1],in[2], &out[0], &out[1], &out[2], BLI_YCC_ITU_BT601); out[3]=in[3]; } -void do_yuva_to_rgba(bNode *node, float *out, float *in) +void do_yuva_to_rgba(bNode *UNUSED(node), float *out, float *in) { yuv_to_rgb(in[0],in[1],in[2], &out[0], &out[1], &out[2]); out[3]=in[3]; } -void do_hsva_to_rgba(bNode *node, float *out, float *in) +void do_hsva_to_rgba(bNode *UNUSED(node), float *out, float *in) { hsv_to_rgb(in[0],in[1],in[2], &out[0], &out[1], &out[2]); out[3]=in[3]; } -void do_ycca_to_rgba(bNode *node, float *out, float *in) +void do_ycca_to_rgba(bNode *UNUSED(node), float *out, float *in) { ycc_to_rgb(in[0],in[1],in[2], &out[0], &out[1], &out[2], BLI_YCC_ITU_BT601); out[3]=in[3]; } -void do_copy_rgba(bNode *node, float *out, float *in) +void do_copy_rgba(bNode *UNUSED(node), float *out, float *in) { QUATCOPY(out, in); } -void do_copy_rgb(bNode *node, float *out, float *in) +void do_copy_rgb(bNode *UNUSED(node), float *out, float *in) { VECCOPY(out, in); out[3]= 1.0f; } -void do_copy_value(bNode *node, float *out, float *in) +void do_copy_value(bNode *UNUSED(node), float *out, float *in) { out[0]= in[0]; } -void do_copy_a_rgba(bNode *node, float *out, float *in, float *fac) +void do_copy_a_rgba(bNode *UNUSED(node), float *out, float *in, float *fac) { VECCOPY(out, in); out[3]= *fac; diff --git a/source/blender/nodes/intern/SHD_nodes/SHD_camera.c b/source/blender/nodes/intern/SHD_nodes/SHD_camera.c index d89099955aa..869b1d1e54c 100644 --- a/source/blender/nodes/intern/SHD_nodes/SHD_camera.c +++ b/source/blender/nodes/intern/SHD_nodes/SHD_camera.c @@ -38,7 +38,7 @@ static bNodeSocketType sh_node_camera_out[]= { }; -static void node_shader_exec_camera(void *data, bNode *node, bNodeStack **in, bNodeStack **out) +static void node_shader_exec_camera(void *data, bNode *UNUSED(node), bNodeStack **UNUSED(in), bNodeStack **out) { if(data) { ShadeInput *shi= ((ShaderCallData *)data)->shi; /* Data we need for shading. */ @@ -49,7 +49,7 @@ static void node_shader_exec_camera(void *data, bNode *node, bNodeStack **in, bN } } -static int gpu_shader_camera(GPUMaterial *mat, bNode *node, GPUNodeStack *in, GPUNodeStack *out) +static int gpu_shader_camera(GPUMaterial *mat, bNode *UNUSED(node), GPUNodeStack *in, GPUNodeStack *out) { return GPU_stack_link(mat, "camera", in, out, GPU_builtin(GPU_VIEW_POSITION)); } diff --git a/source/blender/nodes/intern/SHD_nodes/SHD_curves.c b/source/blender/nodes/intern/SHD_nodes/SHD_curves.c index 4e47e75993d..56aaa4fe8a7 100644 --- a/source/blender/nodes/intern/SHD_nodes/SHD_curves.c +++ b/source/blender/nodes/intern/SHD_nodes/SHD_curves.c @@ -42,7 +42,7 @@ static bNodeSocketType sh_node_curve_vec_out[]= { { -1, 0, "" } }; -static void node_shader_exec_curve_vec(void *data, bNode *node, bNodeStack **in, bNodeStack **out) +static void node_shader_exec_curve_vec(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out) { float vec[3]; @@ -97,7 +97,7 @@ static bNodeSocketType sh_node_curve_rgb_out[]= { { -1, 0, "" } }; -static void node_shader_exec_curve_rgb(void *data, bNode *node, bNodeStack **in, bNodeStack **out) +static void node_shader_exec_curve_rgb(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out) { float vec[3]; diff --git a/source/blender/nodes/intern/SHD_nodes/SHD_geom.c b/source/blender/nodes/intern/SHD_nodes/SHD_geom.c index aefe7d104b5..a27918df275 100644 --- a/source/blender/nodes/intern/SHD_nodes/SHD_geom.c +++ b/source/blender/nodes/intern/SHD_nodes/SHD_geom.c @@ -47,7 +47,7 @@ static bNodeSocketType sh_node_geom_out[]= { }; /* node execute callback */ -static void node_shader_exec_geom(void *data, bNode *node, bNodeStack **in, bNodeStack **out) +static void node_shader_exec_geom(void *data, bNode *node, bNodeStack **UNUSED(in), bNodeStack **out) { if(data) { ShadeInput *shi= ((ShaderCallData *)data)->shi; diff --git a/source/blender/nodes/intern/SHD_nodes/SHD_hueSatVal.c b/source/blender/nodes/intern/SHD_nodes/SHD_hueSatVal.c index 4f319f8937c..5c95577e32d 100644 --- a/source/blender/nodes/intern/SHD_nodes/SHD_hueSatVal.c +++ b/source/blender/nodes/intern/SHD_nodes/SHD_hueSatVal.c @@ -45,7 +45,7 @@ static bNodeSocketType sh_node_hue_sat_out[]= { }; /* note: it would be possible to use CMP version for both nodes */ -static void do_hue_sat_fac(bNode *node, float *out, float *hue, float *sat, float *val, float *in, float *fac) +static void do_hue_sat_fac(bNode *UNUSED(node), float *out, float *hue, float *sat, float *val, float *in, float *fac) { if(*fac!=0.0f && (*hue!=0.5f || *sat!=1.0 || *val!=1.0)) { float col[3], hsv[3], mfac= 1.0f - *fac; @@ -66,13 +66,13 @@ static void do_hue_sat_fac(bNode *node, float *out, float *hue, float *sat, floa } } -static void node_shader_exec_hue_sat(void *data, bNode *node, bNodeStack **in, bNodeStack **out) +static void node_shader_exec_hue_sat(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out) { do_hue_sat_fac(node, out[0]->vec, in[0]->vec, in[1]->vec, in[2]->vec, in[4]->vec, in[3]->vec); } -static int gpu_shader_hue_sat(GPUMaterial *mat, bNode *node, GPUNodeStack *in, GPUNodeStack *out) +static int gpu_shader_hue_sat(GPUMaterial *mat, bNode *UNUSED(node), GPUNodeStack *in, GPUNodeStack *out) { return GPU_stack_link(mat, "hue_sat", in, out); } diff --git a/source/blender/nodes/intern/SHD_nodes/SHD_invert.c b/source/blender/nodes/intern/SHD_nodes/SHD_invert.c index 08666f4dd52..73fccf7cd0b 100644 --- a/source/blender/nodes/intern/SHD_nodes/SHD_invert.c +++ b/source/blender/nodes/intern/SHD_nodes/SHD_invert.c @@ -43,7 +43,7 @@ static bNodeSocketType sh_node_invert_out[]= { { -1, 0, "" } }; -static void node_shader_exec_invert(void *data, bNode *node, bNodeStack **in, +static void node_shader_exec_invert(void *UNUSED(data), bNode *UNUSED(node), bNodeStack **in, bNodeStack **out) { float col[3], facm; @@ -64,7 +64,7 @@ bNodeStack **out) VECCOPY(out[0]->vec, col); } -static int gpu_shader_invert(GPUMaterial *mat, bNode *node, GPUNodeStack *in, GPUNodeStack *out) +static int gpu_shader_invert(GPUMaterial *mat, bNode *UNUSED(node), GPUNodeStack *in, GPUNodeStack *out) { return GPU_stack_link(mat, "invert", in, out); } diff --git a/source/blender/nodes/intern/SHD_nodes/SHD_mapping.c b/source/blender/nodes/intern/SHD_nodes/SHD_mapping.c index 49778625446..f01ed3d7ab8 100644 --- a/source/blender/nodes/intern/SHD_nodes/SHD_mapping.c +++ b/source/blender/nodes/intern/SHD_nodes/SHD_mapping.c @@ -41,7 +41,7 @@ static bNodeSocketType sh_node_mapping_out[]= { }; /* do the regular mapping options for blender textures */ -static void node_shader_exec_mapping(void *data, bNode *node, bNodeStack **in, bNodeStack **out) +static void node_shader_exec_mapping(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out) { TexMapping *texmap= node->storage; float *vec= out[0]->vec; diff --git a/source/blender/nodes/intern/SHD_nodes/SHD_math.c b/source/blender/nodes/intern/SHD_nodes/SHD_math.c index 7429c084ab3..40a2e53c665 100644 --- a/source/blender/nodes/intern/SHD_nodes/SHD_math.c +++ b/source/blender/nodes/intern/SHD_nodes/SHD_math.c @@ -43,7 +43,7 @@ static bNodeSocketType sh_node_math_out[]= { { -1, 0, "" } }; -static void node_shader_exec_math(void *data, bNode *node, bNodeStack **in, +static void node_shader_exec_math(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out) { switch(node->custom1){ diff --git a/source/blender/nodes/intern/SHD_nodes/SHD_mixRgb.c b/source/blender/nodes/intern/SHD_nodes/SHD_mixRgb.c index bc4342e11e3..56d863f002a 100644 --- a/source/blender/nodes/intern/SHD_nodes/SHD_mixRgb.c +++ b/source/blender/nodes/intern/SHD_nodes/SHD_mixRgb.c @@ -42,7 +42,7 @@ static bNodeSocketType sh_node_mix_rgb_out[]= { { -1, 0, "" } }; -static void node_shader_exec_mix_rgb(void *data, bNode *node, bNodeStack **in, bNodeStack **out) +static void node_shader_exec_mix_rgb(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out) { /* stack order in: fac, col1, col2 */ /* stack order out: col */ diff --git a/source/blender/nodes/intern/SHD_nodes/SHD_normal.c b/source/blender/nodes/intern/SHD_nodes/SHD_normal.c index eb3786286ae..8054f184cea 100644 --- a/source/blender/nodes/intern/SHD_nodes/SHD_normal.c +++ b/source/blender/nodes/intern/SHD_nodes/SHD_normal.c @@ -42,7 +42,7 @@ static bNodeSocketType sh_node_normal_out[]= { }; /* generates normal, does dot product */ -static void node_shader_exec_normal(void *data, bNode *node, bNodeStack **in, bNodeStack **out) +static void node_shader_exec_normal(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out) { bNodeSocket *sock= node->outputs.first; float vec[3]; diff --git a/source/blender/nodes/intern/SHD_nodes/SHD_output.c b/source/blender/nodes/intern/SHD_nodes/SHD_output.c index 740639b6ab4..4395716e599 100644 --- a/source/blender/nodes/intern/SHD_nodes/SHD_output.c +++ b/source/blender/nodes/intern/SHD_nodes/SHD_output.c @@ -36,7 +36,7 @@ static bNodeSocketType sh_node_output_in[]= { { -1, 0, "" } }; -static void node_shader_exec_output(void *data, bNode *node, bNodeStack **in, bNodeStack **out) +static void node_shader_exec_output(void *data, bNode *node, bNodeStack **in, bNodeStack **UNUSED(out)) { if(data) { ShadeInput *shi= ((ShaderCallData *)data)->shi; @@ -62,7 +62,7 @@ static void node_shader_exec_output(void *data, bNode *node, bNodeStack **in, bN } } -static int gpu_shader_output(GPUMaterial *mat, bNode *node, GPUNodeStack *in, GPUNodeStack *out) +static int gpu_shader_output(GPUMaterial *mat, bNode *UNUSED(node), GPUNodeStack *in, GPUNodeStack *out) { GPUNodeLink *outlink; diff --git a/source/blender/nodes/intern/SHD_nodes/SHD_rgb.c b/source/blender/nodes/intern/SHD_nodes/SHD_rgb.c index 71af58beb67..600518962ab 100644 --- a/source/blender/nodes/intern/SHD_nodes/SHD_rgb.c +++ b/source/blender/nodes/intern/SHD_nodes/SHD_rgb.c @@ -35,7 +35,7 @@ static bNodeSocketType sh_node_rgb_out[]= { { -1, 0, "" } }; -static void node_shader_exec_rgb(void *data, bNode *node, bNodeStack **in, bNodeStack **out) +static void node_shader_exec_rgb(void *UNUSED(data), bNode *node, bNodeStack **UNUSED(in), bNodeStack **out) { bNodeSocket *sock= node->outputs.first; diff --git a/source/blender/nodes/intern/SHD_nodes/SHD_sepcombRGB.c b/source/blender/nodes/intern/SHD_nodes/SHD_sepcombRGB.c index 883cd4d3bf4..1de200c7b1c 100644 --- a/source/blender/nodes/intern/SHD_nodes/SHD_sepcombRGB.c +++ b/source/blender/nodes/intern/SHD_nodes/SHD_sepcombRGB.c @@ -41,14 +41,14 @@ static bNodeSocketType sh_node_seprgb_out[]= { { -1, 0, "" } }; -static void node_shader_exec_seprgb(void *data, bNode *node, bNodeStack **in, bNodeStack **out) +static void node_shader_exec_seprgb(void *UNUSED(data), bNode *UNUSED(node), bNodeStack **in, bNodeStack **out) { out[0]->vec[0] = in[0]->vec[0]; out[1]->vec[0] = in[0]->vec[1]; out[2]->vec[0] = in[0]->vec[2]; } -static int gpu_shader_seprgb(GPUMaterial *mat, bNode *node, GPUNodeStack *in, GPUNodeStack *out) +static int gpu_shader_seprgb(GPUMaterial *mat, bNode *UNUSED(node), GPUNodeStack *in, GPUNodeStack *out) { return GPU_stack_link(mat, "separate_rgb", in, out); } @@ -85,14 +85,14 @@ static bNodeSocketType sh_node_combrgb_out[]= { { -1, 0, "" } }; -static void node_shader_exec_combrgb(void *data, bNode *node, bNodeStack **in, bNodeStack **out) +static void node_shader_exec_combrgb(void *UNUSED(data), bNode *UNUSED(node), bNodeStack **in, bNodeStack **out) { out[0]->vec[0] = in[0]->vec[0]; out[0]->vec[1] = in[1]->vec[0]; out[0]->vec[2] = in[2]->vec[0]; } -static int gpu_shader_combrgb(GPUMaterial *mat, bNode *node, GPUNodeStack *in, GPUNodeStack *out) +static int gpu_shader_combrgb(GPUMaterial *mat, bNode *UNUSED(node), GPUNodeStack *in, GPUNodeStack *out) { return GPU_stack_link(mat, "combine_rgb", in, out); } diff --git a/source/blender/nodes/intern/SHD_nodes/SHD_squeeze.c b/source/blender/nodes/intern/SHD_nodes/SHD_squeeze.c index 926dcd0f046..06b06affaa0 100644 --- a/source/blender/nodes/intern/SHD_nodes/SHD_squeeze.c +++ b/source/blender/nodes/intern/SHD_nodes/SHD_squeeze.c @@ -42,7 +42,7 @@ static bNodeSocketType sh_node_squeeze_out[]= { { -1, 0, "" } }; -static void node_shader_exec_squeeze(void *data, bNode *node, bNodeStack **in, +static void node_shader_exec_squeeze(void *UNUSED(data), bNode *UNUSED(node), bNodeStack **in, bNodeStack **out) { float vec[3]; @@ -54,7 +54,7 @@ bNodeStack **out) out[0]->vec[0] = 1.0f / (1.0f + pow(2.71828183,-((vec[0]-vec[2])*vec[1]))) ; } -static int gpu_shader_squeeze(GPUMaterial *mat, bNode *node, GPUNodeStack *in, GPUNodeStack *out) +static int gpu_shader_squeeze(GPUMaterial *mat, bNode *UNUSED(node), GPUNodeStack *in, GPUNodeStack *out) { return GPU_stack_link(mat, "squeeze", in, out); } diff --git a/source/blender/nodes/intern/SHD_nodes/SHD_valToRgb.c b/source/blender/nodes/intern/SHD_nodes/SHD_valToRgb.c index e2260461152..1e5b9cf935e 100644 --- a/source/blender/nodes/intern/SHD_nodes/SHD_valToRgb.c +++ b/source/blender/nodes/intern/SHD_nodes/SHD_valToRgb.c @@ -40,7 +40,7 @@ static bNodeSocketType sh_node_valtorgb_out[]= { { -1, 0, "" } }; -static void node_shader_exec_valtorgb(void *data, bNode *node, bNodeStack **in, bNodeStack **out) +static void node_shader_exec_valtorgb(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out) { /* stack order in: fac */ /* stack order out: col, alpha */ @@ -98,7 +98,7 @@ static bNodeSocketType sh_node_rgbtobw_out[]= { }; -static void node_shader_exec_rgbtobw(void *data, bNode *node, bNodeStack **in, bNodeStack **out) +static void node_shader_exec_rgbtobw(void *UNUSED(data), bNode *UNUSED(node), bNodeStack **in, bNodeStack **out) { /* stack order out: bw */ /* stack order in: col */ @@ -106,7 +106,7 @@ static void node_shader_exec_rgbtobw(void *data, bNode *node, bNodeStack **in, b out[0]->vec[0]= in[0]->vec[0]*0.35f + in[0]->vec[1]*0.45f + in[0]->vec[2]*0.2f; } -static int gpu_shader_rgbtobw(GPUMaterial *mat, bNode *node, GPUNodeStack *in, GPUNodeStack *out) +static int gpu_shader_rgbtobw(GPUMaterial *mat, bNode *UNUSED(node), GPUNodeStack *in, GPUNodeStack *out) { return GPU_stack_link(mat, "rgbtobw", in, out); } diff --git a/source/blender/nodes/intern/SHD_nodes/SHD_value.c b/source/blender/nodes/intern/SHD_nodes/SHD_value.c index 1663ea352aa..f78480bd794 100644 --- a/source/blender/nodes/intern/SHD_nodes/SHD_value.c +++ b/source/blender/nodes/intern/SHD_nodes/SHD_value.c @@ -35,7 +35,7 @@ static bNodeSocketType sh_node_value_out[]= { { -1, 0, "" } }; -static void node_shader_exec_value(void *data, bNode *node, bNodeStack **in, bNodeStack **out) +static void node_shader_exec_value(void *UNUSED(data), bNode *node, bNodeStack **UNUSED(in), bNodeStack **out) { bNodeSocket *sock= node->outputs.first; diff --git a/source/blender/nodes/intern/SHD_nodes/SHD_vectMath.c b/source/blender/nodes/intern/SHD_nodes/SHD_vectMath.c index 062c6402fb6..dbdb04c2a6a 100644 --- a/source/blender/nodes/intern/SHD_nodes/SHD_vectMath.c +++ b/source/blender/nodes/intern/SHD_nodes/SHD_vectMath.c @@ -44,7 +44,7 @@ static bNodeSocketType sh_node_vect_math_out[]= { { -1, 0, "" } }; -static void node_shader_exec_vect_math(void *data, bNode *node, bNodeStack **in, bNodeStack **out) +static void node_shader_exec_vect_math(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out) { float vec1[3], vec2[3]; diff --git a/source/blender/nodes/intern/TEX_nodes/TEX_at.c b/source/blender/nodes/intern/TEX_nodes/TEX_at.c index 08c1c65792d..1ca293acb5b 100644 --- a/source/blender/nodes/intern/TEX_nodes/TEX_at.c +++ b/source/blender/nodes/intern/TEX_nodes/TEX_at.c @@ -38,7 +38,7 @@ static bNodeSocketType outputs[]= { { -1, 0, "" } }; -static void colorfn(float *out, TexParams *p, bNode *node, bNodeStack **in, short thread) +static void colorfn(float *out, TexParams *p, bNode *UNUSED(node), bNodeStack **in, short thread) { TexParams np = *p; float new_co[3]; diff --git a/source/blender/nodes/intern/TEX_nodes/TEX_checker.c b/source/blender/nodes/intern/TEX_nodes/TEX_checker.c index 4155cec4d7f..64b70455a19 100644 --- a/source/blender/nodes/intern/TEX_nodes/TEX_checker.c +++ b/source/blender/nodes/intern/TEX_nodes/TEX_checker.c @@ -40,7 +40,7 @@ static bNodeSocketType outputs[]= { { -1, 0, "" } }; -static void colorfn(float *out, TexParams *p, bNode *node, bNodeStack **in, short thread) +static void colorfn(float *out, TexParams *p, bNode *UNUSED(node), bNodeStack **in, short thread) { float x = p->co[0]; float y = p->co[1]; diff --git a/source/blender/nodes/intern/TEX_nodes/TEX_compose.c b/source/blender/nodes/intern/TEX_nodes/TEX_compose.c index 7319a50b7d9..f05e1e987da 100644 --- a/source/blender/nodes/intern/TEX_nodes/TEX_compose.c +++ b/source/blender/nodes/intern/TEX_nodes/TEX_compose.c @@ -40,7 +40,7 @@ static bNodeSocketType outputs[]= { { -1, 0, "" } }; -static void colorfn(float *out, TexParams *p, bNode *node, bNodeStack **in, short thread) +static void colorfn(float *out, TexParams *p, bNode *UNUSED(node), bNodeStack **in, short thread) { int i; for(i = 0; i < 4; i++) diff --git a/source/blender/nodes/intern/TEX_nodes/TEX_coord.c b/source/blender/nodes/intern/TEX_nodes/TEX_coord.c index 68e892ce77c..4ad32bc872e 100644 --- a/source/blender/nodes/intern/TEX_nodes/TEX_coord.c +++ b/source/blender/nodes/intern/TEX_nodes/TEX_coord.c @@ -33,7 +33,7 @@ static bNodeSocketType outputs[]= { { -1, 0, "" } }; -static void vectorfn(float *out, TexParams *p, bNode *node, bNodeStack **in, short thread) +static void vectorfn(float *out, TexParams *p, bNode *UNUSED(node), bNodeStack **UNUSED(in), short UNUSED(thread)) { out[0] = p->co[0]; out[1] = p->co[1]; diff --git a/source/blender/nodes/intern/TEX_nodes/TEX_curves.c b/source/blender/nodes/intern/TEX_nodes/TEX_curves.c index 49a1ef35fbb..0fca0aa30ad 100644 --- a/source/blender/nodes/intern/TEX_nodes/TEX_curves.c +++ b/source/blender/nodes/intern/TEX_nodes/TEX_curves.c @@ -36,7 +36,7 @@ static bNodeSocketType time_outputs[]= { { -1, 0, "" } }; -static void time_colorfn(float *out, TexParams *p, bNode *node, bNodeStack **in, short thread) +static void time_colorfn(float *out, TexParams *p, bNode *node, bNodeStack **UNUSED(in), short UNUSED(thread)) { /* stack order output: fac */ float fac= 0.0f; diff --git a/source/blender/nodes/intern/TEX_nodes/TEX_decompose.c b/source/blender/nodes/intern/TEX_nodes/TEX_decompose.c index f031091e08d..13768aaa868 100644 --- a/source/blender/nodes/intern/TEX_nodes/TEX_decompose.c +++ b/source/blender/nodes/intern/TEX_nodes/TEX_decompose.c @@ -41,25 +41,25 @@ static bNodeSocketType outputs[]= { { -1, 0, "" } }; -static void valuefn_r(float *out, TexParams *p, bNode *node, bNodeStack **in, short thread) +static void valuefn_r(float *out, TexParams *p, bNode *UNUSED(node), bNodeStack **in, short thread) { tex_input_rgba(out, in[0], p, thread); *out = out[0]; } -static void valuefn_g(float *out, TexParams *p, bNode *node, bNodeStack **in, short thread) +static void valuefn_g(float *out, TexParams *p, bNode *UNUSED(node), bNodeStack **in, short thread) { tex_input_rgba(out, in[0], p, thread); *out = out[1]; } -static void valuefn_b(float *out, TexParams *p, bNode *node, bNodeStack **in, short thread) +static void valuefn_b(float *out, TexParams *p, bNode *UNUSED(node), bNodeStack **in, short thread) { tex_input_rgba(out, in[0], p, thread); *out = out[2]; } -static void valuefn_a(float *out, TexParams *p, bNode *node, bNodeStack **in, short thread) +static void valuefn_a(float *out, TexParams *p, bNode *UNUSED(node), bNodeStack **in, short thread) { tex_input_rgba(out, in[0], p, thread); *out = out[3]; diff --git a/source/blender/nodes/intern/TEX_nodes/TEX_distance.c b/source/blender/nodes/intern/TEX_nodes/TEX_distance.c index e0fee3e3153..5d624205f43 100644 --- a/source/blender/nodes/intern/TEX_nodes/TEX_distance.c +++ b/source/blender/nodes/intern/TEX_nodes/TEX_distance.c @@ -41,7 +41,7 @@ static bNodeSocketType outputs[]= { { -1, 0, "" } }; -static void valuefn(float *out, TexParams *p, bNode *node, bNodeStack **in, short thread) +static void valuefn(float *out, TexParams *p, bNode *UNUSED(node), bNodeStack **in, short thread) { float co1[3], co2[3]; diff --git a/source/blender/nodes/intern/TEX_nodes/TEX_hueSatVal.c b/source/blender/nodes/intern/TEX_nodes/TEX_hueSatVal.c index 367ea7b9e5f..2ccde083823 100644 --- a/source/blender/nodes/intern/TEX_nodes/TEX_hueSatVal.c +++ b/source/blender/nodes/intern/TEX_nodes/TEX_hueSatVal.c @@ -42,7 +42,7 @@ static bNodeSocketType outputs[]= { { -1, 0, "" } }; -static void do_hue_sat_fac(bNode *node, float *out, float hue, float sat, float val, float *in, float fac) +static void do_hue_sat_fac(bNode *UNUSED(node), float *out, float hue, float sat, float val, float *in, float fac) { if(fac != 0 && (hue != 0.5f || sat != 1 || val != 1)) { float col[3], hsv[3], mfac= 1.0f - fac; diff --git a/source/blender/nodes/intern/TEX_nodes/TEX_image.c b/source/blender/nodes/intern/TEX_nodes/TEX_image.c index 628d9026db1..c764c7a22d2 100644 --- a/source/blender/nodes/intern/TEX_nodes/TEX_image.c +++ b/source/blender/nodes/intern/TEX_nodes/TEX_image.c @@ -34,7 +34,7 @@ static bNodeSocketType outputs[]= { { -1, 0, "" } }; -static void colorfn(float *out, TexParams *p, bNode *node, bNodeStack **in, short thread) +static void colorfn(float *out, TexParams *p, bNode *node, bNodeStack **UNUSED(in), short UNUSED(thread)) { float x = p->co[0]; float y = p->co[1]; diff --git a/source/blender/nodes/intern/TEX_nodes/TEX_invert.c b/source/blender/nodes/intern/TEX_nodes/TEX_invert.c index 1619ed73023..421082aeb34 100644 --- a/source/blender/nodes/intern/TEX_nodes/TEX_invert.c +++ b/source/blender/nodes/intern/TEX_nodes/TEX_invert.c @@ -39,7 +39,7 @@ static bNodeSocketType outputs[]= { { -1, 0, "" } }; -static void colorfn(float *out, TexParams *p, bNode *node, bNodeStack **in, short thread) +static void colorfn(float *out, TexParams *p, bNode *UNUSED(node), bNodeStack **in, short thread) { float col[4]; diff --git a/source/blender/nodes/intern/TEX_nodes/TEX_output.c b/source/blender/nodes/intern/TEX_nodes/TEX_output.c index 09bc893cc1f..26733a94180 100644 --- a/source/blender/nodes/intern/TEX_nodes/TEX_output.c +++ b/source/blender/nodes/intern/TEX_nodes/TEX_output.c @@ -36,7 +36,7 @@ static bNodeSocketType inputs[]= { }; /* applies to render pipeline */ -static void exec(void *data, bNode *node, bNodeStack **in, bNodeStack **out) +static void exec(void *data, bNode *node, bNodeStack **in, bNodeStack **UNUSED(out)) { TexCallData *cdata = (TexCallData *)data; TexResult *target = cdata->target; diff --git a/source/blender/nodes/intern/TEX_nodes/TEX_proc.c b/source/blender/nodes/intern/TEX_nodes/TEX_proc.c index 3e7ef0e94fe..a4a608e777c 100644 --- a/source/blender/nodes/intern/TEX_nodes/TEX_proc.c +++ b/source/blender/nodes/intern/TEX_nodes/TEX_proc.c @@ -111,7 +111,7 @@ static int count_outputs(bNode *node) /* Boilerplate generators */ #define ProcNoInputs(name) \ - static void name##_map_inputs(Tex *tex, bNodeStack **in, TexParams *p, short thread) \ + static void name##_map_inputs(Tex *UNUSED(tex), bNodeStack **UNUSED(in), TexParams *UNUSED(p), short UNUSED(thread)) \ {} #define ProcDef(name) \ diff --git a/source/blender/nodes/intern/TEX_nodes/TEX_rotate.c b/source/blender/nodes/intern/TEX_nodes/TEX_rotate.c index 9a855938eef..88ed5382a6a 100644 --- a/source/blender/nodes/intern/TEX_nodes/TEX_rotate.c +++ b/source/blender/nodes/intern/TEX_nodes/TEX_rotate.c @@ -64,7 +64,7 @@ static void rotate(float new_co[3], float a, float ax[3], float co[3]) new_co[2] = para[2] + perp[2] + cp[2]; } -static void colorfn(float *out, TexParams *p, bNode *node, bNodeStack **in, short thread) +static void colorfn(float *out, TexParams *p, bNode *UNUSED(node), bNodeStack **in, short thread) { float new_co[3], new_dxt[3], new_dyt[3], a, ax[3]; diff --git a/source/blender/nodes/intern/TEX_nodes/TEX_scale.c b/source/blender/nodes/intern/TEX_nodes/TEX_scale.c index 721c322c540..8045c1ca07a 100644 --- a/source/blender/nodes/intern/TEX_nodes/TEX_scale.c +++ b/source/blender/nodes/intern/TEX_nodes/TEX_scale.c @@ -40,7 +40,7 @@ static bNodeSocketType outputs[]= { { -1, 0, "" } }; -static void colorfn(float *out, TexParams *p, bNode *node, bNodeStack **in, short thread) +static void colorfn(float *out, TexParams *p, bNode *UNUSED(node), bNodeStack **in, short thread) { float scale[3], new_co[3], new_dxt[3], new_dyt[3]; TexParams np = *p; diff --git a/source/blender/nodes/intern/TEX_nodes/TEX_translate.c b/source/blender/nodes/intern/TEX_nodes/TEX_translate.c index a823338faf9..a9d7fbcf3da 100644 --- a/source/blender/nodes/intern/TEX_nodes/TEX_translate.c +++ b/source/blender/nodes/intern/TEX_nodes/TEX_translate.c @@ -40,7 +40,7 @@ static bNodeSocketType outputs[]= { { -1, 0, "" } }; -static void colorfn(float *out, TexParams *p, bNode *node, bNodeStack **in, short thread) +static void colorfn(float *out, TexParams *p, bNode *UNUSED(node), bNodeStack **in, short thread) { float offset[3], new_co[3]; TexParams np = *p; diff --git a/source/blender/nodes/intern/TEX_nodes/TEX_valToNor.c b/source/blender/nodes/intern/TEX_nodes/TEX_valToNor.c index 46aefe5ad47..c71d442cef3 100644 --- a/source/blender/nodes/intern/TEX_nodes/TEX_valToNor.c +++ b/source/blender/nodes/intern/TEX_nodes/TEX_valToNor.c @@ -39,7 +39,7 @@ static bNodeSocketType outputs[]= { { -1, 0, "" } }; -static void normalfn(float *out, TexParams *p, bNode *node, bNodeStack **in, short thread) +static void normalfn(float *out, TexParams *p, bNode *UNUSED(node), bNodeStack **in, short thread) { float new_co[3]; float *co = p->co; diff --git a/source/blender/nodes/intern/TEX_nodes/TEX_valToRgb.c b/source/blender/nodes/intern/TEX_nodes/TEX_valToRgb.c index 3810167a58a..fcaa9550efa 100644 --- a/source/blender/nodes/intern/TEX_nodes/TEX_valToRgb.c +++ b/source/blender/nodes/intern/TEX_nodes/TEX_valToRgb.c @@ -87,7 +87,7 @@ static bNodeSocketType rgbtobw_out[]= { }; -static void rgbtobw_valuefn(float *out, TexParams *p, bNode *node, bNodeStack **in, short thread) +static void rgbtobw_valuefn(float *out, TexParams *p, bNode *UNUSED(node), bNodeStack **in, short thread) { float cin[4]; tex_input_rgba(cin, in[0], p, thread); diff --git a/source/blender/nodes/intern/TEX_nodes/TEX_viewer.c b/source/blender/nodes/intern/TEX_nodes/TEX_viewer.c index 698c894a8d8..75fe6945261 100644 --- a/source/blender/nodes/intern/TEX_nodes/TEX_viewer.c +++ b/source/blender/nodes/intern/TEX_nodes/TEX_viewer.c @@ -37,7 +37,7 @@ static bNodeSocketType outputs[]= { { -1, 0, "" } }; -static void exec(void *data, bNode *node, bNodeStack **in, bNodeStack **out) +static void exec(void *data, bNode *node, bNodeStack **in, bNodeStack **UNUSED(out)) { TexCallData *cdata = (TexCallData *)data; diff --git a/source/blender/nodes/intern/TEX_util.c b/source/blender/nodes/intern/TEX_util.c index dc31685827f..4f085c84eda 100644 --- a/source/blender/nodes/intern/TEX_util.c +++ b/source/blender/nodes/intern/TEX_util.c @@ -173,7 +173,7 @@ int ntreeTexExecTree( float *dxt, float *dyt, int osatex, short thread, - Tex *tex, + Tex *UNUSED(tex), short which_output, int cfra, int preview, diff --git a/source/blender/python/generic/IDProp.c b/source/blender/python/generic/IDProp.c index 9d865b1c63e..c64be00093c 100644 --- a/source/blender/python/generic/IDProp.c +++ b/source/blender/python/generic/IDProp.c @@ -24,6 +24,7 @@ */ #include "BKE_idprop.h" +#include "BKE_utildefines.h" #include "IDProp.h" #include "MEM_guardedalloc.h" @@ -177,12 +178,12 @@ int BPy_IDGroup_SetData(BPy_IDProperty *self, IDProperty *prop, PyObject *value) return 0; } -PyObject *BPy_IDGroup_GetName(BPy_IDProperty *self, void *bleh) +PyObject *BPy_IDGroup_GetName(BPy_IDProperty *self, void *UNUSED(closure)) { return PyUnicode_FromString(self->prop->name); } -static int BPy_IDGroup_SetName(BPy_IDProperty *self, PyObject *value, void *bleh) +static int BPy_IDGroup_SetName(BPy_IDProperty *self, PyObject *value, void *UNUSED(closure)) { char *st; if (!PyUnicode_Check(value)) { @@ -860,7 +861,7 @@ PyObject *BPy_Wrap_IDProperty(ID *id, IDProperty *prop, IDProperty *parent) static PyObject *IDArray_repr(BPy_IDArray *self) { - return PyUnicode_FromString("(ID Array)"); + return PyUnicode_FromFormat("(ID Array [%d])", self->prop->len); } @@ -1071,7 +1072,7 @@ static PyObject *IDGroup_Iter_iterself(PyObject *self) static PyObject *IDGroup_Iter_repr(BPy_IDGroup_Iter *self) { - return PyUnicode_FromString("(ID Property Group)"); + return PyUnicode_FromFormat("(ID Property Group Iter \"%s\")", self->group->prop->name); } static PyObject *BPy_Group_Iter_Next(BPy_IDGroup_Iter *self) diff --git a/source/blender/python/generic/bgl.c b/source/blender/python/generic/bgl.c index 8ac2107f8d2..86b7bc522fe 100644 --- a/source/blender/python/generic/bgl.c +++ b/source/blender/python/generic/bgl.c @@ -35,6 +35,8 @@ #include <GL/glew.h> #include "MEM_guardedalloc.h" +#include "BKE_utildefines.h" + static char Method_Buffer_doc[] = "(type, dimensions, [template]) - Create a new Buffer object\n\n\ (type) - The format to store data in\n\ @@ -51,7 +53,7 @@ For example, passing [100, 100] will create a 2 dimensional\n\ square buffer. Passing [16, 16, 32] will create a 3 dimensional\n\ buffer which is twice as deep as it is wide or high."; -static PyObject *Method_Buffer( PyObject * self, PyObject * args ); +static PyObject *Method_Buffer( PyObject * self, PyObject *args ); /* Buffer sequence methods */ @@ -99,7 +101,7 @@ PyTypeObject BGL_bufferType = { /* #ifndef __APPLE__ */ #define BGL_Wrap(nargs, funcname, ret, arg_list) \ -static PyObject *Method_##funcname (PyObject *self, PyObject *args) {\ +static PyObject *Method_##funcname (PyObject *UNUSED(self), PyObject *args) {\ arg_def##nargs arg_list; \ ret_def_##ret; \ if(!PyArg_ParseTuple(args, arg_str##nargs arg_list, arg_ref##nargs arg_list)) return NULL;\ @@ -108,7 +110,7 @@ static PyObject *Method_##funcname (PyObject *self, PyObject *args) {\ } #define BGLU_Wrap(nargs, funcname, ret, arg_list) \ -static PyObject *Method_##funcname (PyObject *self, PyObject *args) {\ +static PyObject *Method_##funcname (PyObject *UNUSED(self), PyObject *args) {\ arg_def##nargs arg_list; \ ret_def_##ret; \ if(!PyArg_ParseTuple(args, arg_str##nargs arg_list, arg_ref##nargs arg_list)) return NULL;\ @@ -181,7 +183,7 @@ Buffer *BGL_MakeBuffer(int type, int ndimensions, int *dimensions, void *initbuf } #define MAX_DIMENSIONS 256 -static PyObject *Method_Buffer (PyObject *self, PyObject *args) +static PyObject *Method_Buffer (PyObject *UNUSED(self), PyObject *args) { PyObject *length_ob= NULL, *template= NULL; Buffer *buffer; diff --git a/source/blender/python/generic/blf_api.c b/source/blender/python/generic/blf_api.c index a5f5f8815c7..66d8cdd923a 100644 --- a/source/blender/python/generic/blf_api.c +++ b/source/blender/python/generic/blf_api.c @@ -26,6 +26,7 @@ #include "blf_api.h" #include "../../blenfont/BLF_api.h" +#include "BKE_utildefines.h" static char py_blf_position_doc[] = ".. function:: position(fontid, x, y, z)\n" @@ -41,7 +42,7 @@ static char py_blf_position_doc[] = " :arg z: Z axis position to draw the text.\n" " :type z: float\n"; -static PyObject *py_blf_position(PyObject *self, PyObject *args) +static PyObject *py_blf_position(PyObject *UNUSED(self), PyObject *args) { int fontid; float x, y, z; @@ -67,7 +68,7 @@ static char py_blf_size_doc[] = " :arg dpi: dots per inch value to use for drawing.\n" " :type dpi: int\n"; -static PyObject *py_blf_size(PyObject *self, PyObject *args) +static PyObject *py_blf_size(PyObject *UNUSED(self), PyObject *args) { int fontid, size, dpi; @@ -90,7 +91,7 @@ static char py_blf_aspect_doc[] = " :arg aspect: The aspect ratio for text drawing to use.\n" " :type aspect: float\n"; -static PyObject *py_blf_aspect(PyObject *self, PyObject *args) +static PyObject *py_blf_aspect(PyObject *UNUSED(self), PyObject *args) { float aspect; int fontid; @@ -114,7 +115,7 @@ static char py_blf_blur_doc[] = " :arg radius: The radius for blurring text (in pixels).\n" " :type radius: int\n"; -static PyObject *py_blf_blur(PyObject *self, PyObject *args) +static PyObject *py_blf_blur(PyObject *UNUSED(self), PyObject *args) { int blur, fontid; @@ -137,7 +138,7 @@ static char py_blf_draw_doc[] = " :arg text: the text to draw.\n" " :type text: string\n"; -static PyObject *py_blf_draw(PyObject *self, PyObject *args) +static PyObject *py_blf_draw(PyObject *UNUSED(self), PyObject *args) { char *text; int fontid; @@ -162,7 +163,7 @@ static char py_blf_dimensions_doc[] = " :return: the width and height of the text.\n" " :rtype: tuple of 2 floats\n"; -static PyObject *py_blf_dimensions(PyObject *self, PyObject *args) +static PyObject *py_blf_dimensions(PyObject *UNUSED(self), PyObject *args) { char *text; float r_width, r_height; @@ -196,7 +197,7 @@ static char py_blf_clipping_doc[] = " :arg ymax: Clip the drawing area by these bounds.\n" " :type ymax: float\n"; -static PyObject *py_blf_clipping(PyObject *self, PyObject *args) +static PyObject *py_blf_clipping(PyObject *UNUSED(self), PyObject *args) { float xmin, ymin, xmax, ymax; int fontid; @@ -219,7 +220,7 @@ static char py_blf_disable_doc[] = " :arg option: One of ROTATION, CLIPPING, SHADOW or KERNING_DEFAULT.\n" " :type option: int\n"; -static PyObject *py_blf_disable(PyObject *self, PyObject *args) +static PyObject *py_blf_disable(PyObject *UNUSED(self), PyObject *args) { int option, fontid; @@ -241,7 +242,7 @@ static char py_blf_enable_doc[] = " :arg option: One of ROTATION, CLIPPING, SHADOW or KERNING_DEFAULT.\n" " :type option: int\n"; -static PyObject *py_blf_enable(PyObject *self, PyObject *args) +static PyObject *py_blf_enable(PyObject *UNUSED(self), PyObject *args) { int option, fontid; @@ -263,7 +264,7 @@ static char py_blf_rotation_doc[] = " :arg angle: The angle for text drawing to use.\n" " :type angle: float\n"; -static PyObject *py_blf_rotation(PyObject *self, PyObject *args) +static PyObject *py_blf_rotation(PyObject *UNUSED(self), PyObject *args) { float angle; int fontid; @@ -294,7 +295,7 @@ static char py_blf_shadow_doc[] = " :arg a: Shadow color (alpha channel 0.0 - 1.0).\n" " :type a: float\n"; -static PyObject *py_blf_shadow(PyObject *self, PyObject *args) +static PyObject *py_blf_shadow(PyObject *UNUSED(self), PyObject *args) { int level, fontid; float r, g, b, a; @@ -324,7 +325,7 @@ static char py_blf_shadow_offset_doc[] = " :arg y: Horizontal shadow offset value in pixels.\n" " :type y: float\n"; -static PyObject *py_blf_shadow_offset(PyObject *self, PyObject *args) +static PyObject *py_blf_shadow_offset(PyObject *UNUSED(self), PyObject *args) { int x, y, fontid; @@ -346,7 +347,7 @@ static char py_blf_load_doc[] = " :return: the new font's fontid or -1 if there was an error.\n" " :rtype: integer\n"; -static PyObject *py_blf_load(PyObject *self, PyObject *args) +static PyObject *py_blf_load(PyObject *UNUSED(self), PyObject *args) { char* filename; diff --git a/source/blender/python/generic/bpy_internal_import.c b/source/blender/python/generic/bpy_internal_import.c index 394c388394a..3ee0c76a44a 100644 --- a/source/blender/python/generic/bpy_internal_import.c +++ b/source/blender/python/generic/bpy_internal_import.c @@ -30,9 +30,10 @@ #include "DNA_text_types.h" #include "MEM_guardedalloc.h" +#include "BKE_utildefines.h" /* UNUSED */ #include "BKE_text.h" /* txt_to_buf */ #include "BKE_main.h" -#include "BKE_global.h" /* grr, only for G.sce */ +#include "BKE_global.h" /* grr, only for G.main->name */ #include "BLI_listbase.h" #include "BLI_path_util.h" #include "BLI_string.h" @@ -61,7 +62,7 @@ void bpy_import_main_set(struct Main *maggie) /* returns a dummy filename for a textblock so we can tell what file a text block comes from */ void bpy_text_filename_get(char *fn, Text *text) { - sprintf(fn, "%s/%s", text->id.lib ? text->id.lib->filepath : G.sce, text->id.name+2); + sprintf(fn, "%s/%s", text->id.lib ? text->id.lib->filepath : G.main->name, text->id.name+2); /* XXX, this is a bug in python's Py_CompileString()! the string encoding should not be required to be utf-8 @@ -191,24 +192,24 @@ PyObject *bpy_text_reimport( PyObject *module, int *found ) } -static PyObject *blender_import( PyObject * self, PyObject * args, PyObject * kw) +static PyObject *blender_import(PyObject *UNUSED(self), PyObject *args, PyObject * kw) { PyObject *exception, *err, *tb; char *name; int found= 0; PyObject *globals = NULL, *locals = NULL, *fromlist = NULL; - PyObject *newmodule; + int level= -1; /* relative imports */ + PyObject *newmodule; //PyObject_Print(args, stderr, 0); - int dummy_val; /* what does this do?*/ static char *kwlist[] = {"name", "globals", "locals", "fromlist", "level", 0}; if( !PyArg_ParseTupleAndKeywords( args, kw, "s|OOOi:bpy_import_meth", kwlist, - &name, &globals, &locals, &fromlist, &dummy_val) ) + &name, &globals, &locals, &fromlist, &level) ) return NULL; /* import existing builtin modules or modules that have been imported already */ - newmodule = PyImport_ImportModuleEx( name, globals, locals, fromlist ); + newmodule= PyImport_ImportModuleLevel(name, globals, locals, fromlist, level); if(newmodule) return newmodule; @@ -244,7 +245,7 @@ static PyObject *blender_import( PyObject * self, PyObject * args, PyObject * k * our reload() module, to handle reloading in-memory scripts */ -static PyObject *blender_reload( PyObject * self, PyObject * module ) +static PyObject *blender_reload(PyObject *UNUSED(self), PyObject * module) { PyObject *exception, *err, *tb; PyObject *newmodule = NULL; diff --git a/source/blender/python/generic/geometry.c b/source/blender/python/generic/geometry.c index 0e98760314d..e0583cc0028 100644 --- a/source/blender/python/generic/geometry.c +++ b/source/blender/python/generic/geometry.c @@ -60,7 +60,7 @@ static char M_Geometry_BezierInterp_doc[] = ""; //---------------------------------INTERSECTION FUNCTIONS-------------------- //----------------------------------geometry.Intersect() ------------------- -static PyObject *M_Geometry_Intersect( PyObject * self, PyObject * args ) +static PyObject *M_Geometry_Intersect(PyObject *UNUSED(self), PyObject* args) { VectorObject *ray, *ray_off, *vec1, *vec2, *vec3; float dir[3], orig[3], v1[3], v2[3], v3[3], e1[3], e2[3], pvec[3], tvec[3], qvec[3]; @@ -133,7 +133,7 @@ static PyObject *M_Geometry_Intersect( PyObject * self, PyObject * args ) } //----------------------------------geometry.LineIntersect() ------------------- /* Line-Line intersection using algorithm from mathworld.wolfram.com */ -static PyObject *M_Geometry_LineIntersect( PyObject * self, PyObject * args ) +static PyObject *M_Geometry_LineIntersect(PyObject *UNUSED(self), PyObject* args) { PyObject * tuple; VectorObject *vec1, *vec2, *vec3, *vec4; @@ -201,7 +201,7 @@ static PyObject *M_Geometry_LineIntersect( PyObject * self, PyObject * args ) //---------------------------------NORMALS FUNCTIONS-------------------- //----------------------------------geometry.QuadNormal() ------------------- -static PyObject *M_Geometry_QuadNormal( PyObject * self, PyObject * args ) +static PyObject *M_Geometry_QuadNormal(PyObject *UNUSED(self), PyObject* args) { VectorObject *vec1; VectorObject *vec2; @@ -252,7 +252,7 @@ static PyObject *M_Geometry_QuadNormal( PyObject * self, PyObject * args ) } //----------------------------geometry.TriangleNormal() ------------------- -static PyObject *M_Geometry_TriangleNormal( PyObject * self, PyObject * args ) +static PyObject *M_Geometry_TriangleNormal(PyObject *UNUSED(self), PyObject* args) { VectorObject *vec1, *vec2, *vec3; float v1[3], v2[3], v3[3], e1[3], e2[3], n[3]; @@ -289,7 +289,7 @@ static PyObject *M_Geometry_TriangleNormal( PyObject * self, PyObject * args ) //--------------------------------- AREA FUNCTIONS-------------------- //----------------------------------geometry.TriangleArea() ------------------- -static PyObject *M_Geometry_TriangleArea( PyObject * self, PyObject * args ) +static PyObject *M_Geometry_TriangleArea(PyObject *UNUSED(self), PyObject* args) { VectorObject *vec1, *vec2, *vec3; float v1[3], v2[3], v3[3]; @@ -335,7 +335,7 @@ static PyObject *M_Geometry_TriangleArea( PyObject * self, PyObject * args ) /*----------------------------------geometry.PolyFill() -------------------*/ /* PolyFill function, uses Blenders scanfill to fill multiple poly lines */ -static PyObject *M_Geometry_PolyFill( PyObject * self, PyObject * polyLineSeq ) +static PyObject *M_Geometry_PolyFill(PyObject *UNUSED(self), PyObject * polyLineSeq ) { PyObject *tri_list; /*return this list of tri's */ PyObject *polyLine, *polyVec; @@ -450,7 +450,7 @@ static PyObject *M_Geometry_PolyFill( PyObject * self, PyObject * polyLineSeq ) } -static PyObject *M_Geometry_LineIntersect2D( PyObject * self, PyObject * args ) +static PyObject *M_Geometry_LineIntersect2D(PyObject *UNUSED(self), PyObject* args) { VectorObject *line_a1, *line_a2, *line_b1, *line_b2; float a1x, a1y, a2x, a2y, b1x, b1y, b2x, b2y, xi, yi, a1,a2,b1,b2, newvec[2]; @@ -548,7 +548,7 @@ static PyObject *M_Geometry_LineIntersect2D( PyObject * self, PyObject * args ) Py_RETURN_NONE; } -static PyObject *M_Geometry_ClosestPointOnLine( PyObject * self, PyObject * args ) +static PyObject *M_Geometry_ClosestPointOnLine(PyObject *UNUSED(self), PyObject* args) { VectorObject *pt, *line_1, *line_2; float pt_in[3], pt_out[3], l1[3], l2[3]; @@ -586,7 +586,7 @@ static PyObject *M_Geometry_ClosestPointOnLine( PyObject * self, PyObject * args return ret; } -static PyObject *M_Geometry_PointInTriangle2D( PyObject * self, PyObject * args ) +static PyObject *M_Geometry_PointInTriangle2D(PyObject *UNUSED(self), PyObject* args) { VectorObject *pt_vec, *tri_p1, *tri_p2, *tri_p3; @@ -606,7 +606,7 @@ static PyObject *M_Geometry_PointInTriangle2D( PyObject * self, PyObject * args return PyLong_FromLong(isect_point_tri_v2(pt_vec->vec, tri_p1->vec, tri_p2->vec, tri_p3->vec)); } -static PyObject *M_Geometry_PointInQuad2D( PyObject * self, PyObject * args ) +static PyObject *M_Geometry_PointInQuad2D(PyObject *UNUSED(self), PyObject* args) { VectorObject *pt_vec, *quad_p1, *quad_p2, *quad_p3, *quad_p4; @@ -690,7 +690,7 @@ static void boxPack_ToPyObject(PyObject * value, boxPack **boxarray) } -static PyObject *M_Geometry_BoxPack2D( PyObject * self, PyObject * boxlist ) +static PyObject *M_Geometry_BoxPack2D(PyObject *UNUSED(self), PyObject * boxlist ) { boxPack *boxarray = NULL; float tot_width, tot_height; @@ -718,7 +718,7 @@ static PyObject *M_Geometry_BoxPack2D( PyObject * self, PyObject * boxlist ) return Py_BuildValue( "ff", tot_width, tot_height); } -static PyObject *M_Geometry_BezierInterp( PyObject * self, PyObject * args ) +static PyObject *M_Geometry_BezierInterp(PyObject *UNUSED(self), PyObject* args) { VectorObject *vec_k1, *vec_h1, *vec_k2, *vec_h2; int resolu; @@ -767,7 +767,7 @@ static PyObject *M_Geometry_BezierInterp( PyObject * self, PyObject * args ) return list; } -static PyObject *M_Geometry_BarycentricTransform(PyObject * self, PyObject * args) +static PyObject *M_Geometry_BarycentricTransform(PyObject *UNUSED(self), PyObject *args) { VectorObject *vec_pt; VectorObject *vec_t1_tar, *vec_t2_tar, *vec_t3_tar; diff --git a/source/blender/python/generic/mathutils.c b/source/blender/python/generic/mathutils.c index e81bc0cf239..c1f24e413c8 100644 --- a/source/blender/python/generic/mathutils.c +++ b/source/blender/python/generic/mathutils.c @@ -61,6 +61,8 @@ #include "BLI_math.h" +#include "BKE_utildefines.h" + //-------------------------DOC STRINGS --------------------------- static char M_Mathutils_doc[] = "This module provides access to matrices, eulers, quaternions and vectors."; @@ -203,7 +205,7 @@ int _BaseMathObject_WriteIndexCallback(BaseMathObject *self, int index) /* BaseMathObject generic functions for all mathutils types */ char BaseMathObject_Owner_doc[] = "The item this is wrapping or None (readonly)."; -PyObject *BaseMathObject_getOwner( BaseMathObject * self, void *type ) +PyObject *BaseMathObject_getOwner(BaseMathObject *self, void *UNUSED(closure)) { PyObject *ret= self->cb_user ? self->cb_user : Py_None; Py_INCREF(ret); @@ -211,7 +213,7 @@ PyObject *BaseMathObject_getOwner( BaseMathObject * self, void *type ) } char BaseMathObject_Wrapped_doc[] = "True when this object wraps external data (readonly).\n\n:type: boolean"; -PyObject *BaseMathObject_getWrapped( BaseMathObject *self, void *type ) +PyObject *BaseMathObject_getWrapped(BaseMathObject *self, void *UNUSED(closure)) { return PyBool_FromLong((self->wrapped == Py_WRAP) ? 1:0); } diff --git a/source/blender/python/generic/mathutils_color.c b/source/blender/python/generic/mathutils_color.c index 57d2838238c..26af8a38f6d 100644 --- a/source/blender/python/generic/mathutils_color.c +++ b/source/blender/python/generic/mathutils_color.c @@ -31,10 +31,15 @@ //----------------------------------mathutils.Color() ------------------- //makes a new color for you to play with -static PyObject *Color_new(PyTypeObject * type, PyObject * args, PyObject * kwargs) +static PyObject *Color_new(PyTypeObject *type, PyObject *args, PyObject *kwds) { float col[3]= {0.0f, 0.0f, 0.0f}; + if(kwds && PyDict_Size(kwds)) { + PyErr_SetString(PyExc_TypeError, "mathutils.Color(): takes no keyword args"); + return NULL; + } + switch(PyTuple_GET_SIZE(args)) { case 0: break; @@ -83,7 +88,7 @@ static char Color_copy_doc[] = "\n" " .. note:: use this to get a copy of a wrapped color with no reference to the original data.\n"; -static PyObject *Color_copy(ColorObject * self, PyObject *args) +static PyObject *Color_copy(ColorObject *self) { if(!BaseMath_ReadCallback(self)) return NULL; @@ -158,7 +163,7 @@ static PyObject* Color_richcmpr(PyObject *objectA, PyObject *objectB, int compar //---------------------SEQUENCE PROTOCOLS------------------------ //----------------------------len(object)------------------------ //sequence length -static int Color_len(ColorObject * self) +static int Color_len(ColorObject *UNUSED(self)) { return COLOR_SIZE; } @@ -394,7 +399,7 @@ static int Color_setChannelHSV(ColorObject * self, PyObject * value, void * type } /* color channel (HSV), color.h/s/v */ -static PyObject *Color_getHSV(ColorObject * self, void *type) +static PyObject *Color_getHSV(ColorObject * self, void *UNUSED(closure)) { float hsv[3]; PyObject *ret; @@ -411,7 +416,7 @@ static PyObject *Color_getHSV(ColorObject * self, void *type) return ret; } -static int Color_setHSV(ColorObject * self, PyObject * value, void * type) +static int Color_setHSV(ColorObject * self, PyObject * value, void *UNUSED(closure)) { float hsv[3]; @@ -452,8 +457,8 @@ static PyGetSetDef Color_getseters[] = { //-----------------------METHOD DEFINITIONS ---------------------- static struct PyMethodDef Color_methods[] = { - {"__copy__", (PyCFunction) Color_copy, METH_VARARGS, Color_copy_doc}, - {"copy", (PyCFunction) Color_copy, METH_VARARGS, Color_copy_doc}, + {"__copy__", (PyCFunction) Color_copy, METH_NOARGS, Color_copy_doc}, + {"copy", (PyCFunction) Color_copy, METH_NOARGS, Color_copy_doc}, {NULL, NULL, 0, NULL} }; diff --git a/source/blender/python/generic/mathutils_euler.c b/source/blender/python/generic/mathutils_euler.c index f85578dd31d..c7091347493 100644 --- a/source/blender/python/generic/mathutils_euler.c +++ b/source/blender/python/generic/mathutils_euler.c @@ -39,7 +39,7 @@ //----------------------------------mathutils.Euler() ------------------- //makes a new euler for you to play with -static PyObject *Euler_new(PyTypeObject * type, PyObject * args, PyObject * kwargs) +static PyObject *Euler_new(PyTypeObject *UNUSED(type), PyObject *args, PyObject *kwds) { PyObject *seq= NULL; char *order_str= NULL; @@ -47,6 +47,11 @@ static PyObject *Euler_new(PyTypeObject * type, PyObject * args, PyObject * kwar float eul[EULER_SIZE]= {0.0f, 0.0f, 0.0f}; short order= EULER_ORDER_XYZ; + if(kwds && PyDict_Size(kwds)) { + PyErr_SetString(PyExc_TypeError, "mathutils.Euler(): takes no keyword args"); + return NULL; + } + if(!PyArg_ParseTuple(args, "|Os:mathutils.Euler", &seq, &order_str)) return NULL; @@ -313,7 +318,7 @@ static char Euler_copy_doc[] = "\n" " .. note:: use this to get a copy of a wrapped euler with no reference to the original data.\n"; -static PyObject *Euler_copy(EulerObject * self, PyObject *args) +static PyObject *Euler_copy(EulerObject *self) { if(!BaseMath_ReadCallback(self)) return NULL; @@ -388,7 +393,7 @@ static PyObject* Euler_richcmpr(PyObject *objectA, PyObject *objectB, int compar //---------------------SEQUENCE PROTOCOLS------------------------ //----------------------------len(object)------------------------ //sequence length -static int Euler_len(EulerObject * self) +static int Euler_len(EulerObject *UNUSED(self)) { return EULER_SIZE; } @@ -411,7 +416,7 @@ static PyObject *Euler_item(EulerObject * self, int i) } //----------------------------object[]------------------------- //sequence accessor (set) -static int Euler_ass_item(EulerObject * self, int i, PyObject * value) +static int Euler_ass_item(EulerObject * self, int i, PyObject *value) { float f = PyFloat_AsDouble(value); @@ -577,18 +582,18 @@ static PyMappingMethods Euler_AsMapping = { /* * euler axis, euler.x/y/z */ -static PyObject *Euler_getAxis( EulerObject * self, void *type ) +static PyObject *Euler_getAxis(EulerObject *self, void *type ) { return Euler_item(self, GET_INT_FROM_POINTER(type)); } -static int Euler_setAxis( EulerObject * self, PyObject * value, void * type ) +static int Euler_setAxis(EulerObject *self, PyObject *value, void *type) { return Euler_ass_item(self, GET_INT_FROM_POINTER(type), value); } /* rotation order */ -static PyObject *Euler_getOrder(EulerObject *self, void *type) +static PyObject *Euler_getOrder(EulerObject *self, void *UNUSED(closure)) { const char order[][4] = {"XYZ", "XZY", "YXZ", "YZX", "ZXY", "ZYX"}; @@ -598,7 +603,7 @@ static PyObject *Euler_getOrder(EulerObject *self, void *type) return PyUnicode_FromString(order[self->order-EULER_ORDER_XYZ]); } -static int Euler_setOrder( EulerObject * self, PyObject * value, void * type ) +static int Euler_setOrder(EulerObject *self, PyObject *value, void *UNUSED(closure)) { char *order_str= _PyUnicode_AsString(value); short order= euler_order_from_string(order_str, "euler.order"); @@ -634,8 +639,8 @@ static struct PyMethodDef Euler_methods[] = { {"to_quat", (PyCFunction) Euler_ToQuat, METH_NOARGS, Euler_ToQuat_doc}, {"rotate_axis", (PyCFunction) Euler_rotate_axis, METH_VARARGS, Euler_rotate_axis_doc}, {"make_compatible", (PyCFunction) Euler_MakeCompatible, METH_O, Euler_MakeCompatible_doc}, - {"__copy__", (PyCFunction) Euler_copy, METH_VARARGS, Euler_copy_doc}, - {"copy", (PyCFunction) Euler_copy, METH_VARARGS, Euler_copy_doc}, + {"__copy__", (PyCFunction) Euler_copy, METH_NOARGS, Euler_copy_doc}, + {"copy", (PyCFunction) Euler_copy, METH_NOARGS, Euler_copy_doc}, {NULL, NULL, 0, NULL} }; diff --git a/source/blender/python/generic/mathutils_matrix.c b/source/blender/python/generic/mathutils_matrix.c index 3b8c7d3122a..9476e8127b6 100644 --- a/source/blender/python/generic/mathutils_matrix.c +++ b/source/blender/python/generic/mathutils_matrix.c @@ -108,7 +108,7 @@ Mathutils_Callback mathutils_matrix_vector_cb = { //----------------------------------mathutils.Matrix() ----------------- //mat is a 1D array of floats - row[0][0],row[0][1], row[1][0], etc. //create a new matrix type -static PyObject *Matrix_new(PyTypeObject *type, PyObject *args, PyObject *kwds) +static PyObject *Matrix_new(PyTypeObject *UNUSED(type), PyObject *args, PyObject *kwds) { PyObject *argObject, *m, *s; MatrixObject *mat; @@ -117,6 +117,11 @@ static PyObject *Matrix_new(PyTypeObject *type, PyObject *args, PyObject *kwds) 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}; float scalar; + if(kwds && PyDict_Size(kwds)) { + PyErr_SetString(PyExc_TypeError, "mathutils.Matrix(): takes no keyword args"); + return NULL; + } + argSize = PyTuple_GET_SIZE(args); if(argSize > MATRIX_MAX_DIM) { //bad arg nums PyErr_SetString(PyExc_AttributeError, "mathutils.Matrix(): expects 0-4 numeric sequences of the same size\n"); @@ -1142,7 +1147,7 @@ static char Matrix_copy_doc[] = " :return: an instance of itself\n" " :rtype: :class:`Matrix`\n"; -PyObject *Matrix_copy(MatrixObject * self) +PyObject *Matrix_copy(MatrixObject *self) { if(!BaseMath_ReadCallback(self)) return NULL; @@ -1680,17 +1685,17 @@ static PyNumberMethods Matrix_NumMethods = { 0, /* nb_index */ }; -static PyObject *Matrix_getRowSize( MatrixObject * self, void *type ) +static PyObject *Matrix_getRowSize(MatrixObject *self, void *UNUSED(closure)) { return PyLong_FromLong((long) self->rowSize); } -static PyObject *Matrix_getColSize( MatrixObject * self, void *type ) +static PyObject *Matrix_getColSize(MatrixObject *self, void *UNUSED(closure)) { return PyLong_FromLong((long) self->colSize); } -static PyObject *Matrix_getMedianScale( MatrixObject * self, void *type ) +static PyObject *Matrix_getMedianScale(MatrixObject *self, void *UNUSED(closure)) { float mat[3][3]; @@ -1710,7 +1715,7 @@ static PyObject *Matrix_getMedianScale( MatrixObject * self, void *type ) return PyFloat_FromDouble(mat3_to_scale(mat)); } -static PyObject *Matrix_getIsNegative( MatrixObject * self, void *type ) +static PyObject *Matrix_getIsNegative(MatrixObject *self, void *UNUSED(closure)) { if(!BaseMath_ReadCallback(self)) return NULL; diff --git a/source/blender/python/generic/mathutils_quat.c b/source/blender/python/generic/mathutils_quat.c index 553844b6ee5..37f20ebbe31 100644 --- a/source/blender/python/generic/mathutils_quat.c +++ b/source/blender/python/generic/mathutils_quat.c @@ -352,7 +352,7 @@ static char Quaternion_copy_doc[] = "\n" " .. note:: use this to get a copy of a wrapped quaternion with no reference to the original data.\n"; -static PyObject *Quaternion_copy(QuaternionObject * self) +static PyObject *Quaternion_copy(QuaternionObject *self) { if(!BaseMath_ReadCallback(self)) return NULL; @@ -429,7 +429,7 @@ static PyObject* Quaternion_richcmpr(PyObject *objectA, PyObject *objectB, int c //---------------------SEQUENCE PROTOCOLS------------------------ //----------------------------len(object)------------------------ //sequence length -static int Quaternion_len(QuaternionObject * self) +static int Quaternion_len(QuaternionObject *UNUSED(self)) { return QUAT_SIZE; } @@ -772,7 +772,7 @@ static int Quaternion_setAxis( QuaternionObject * self, PyObject * value, void * return Quaternion_ass_item(self, GET_INT_FROM_POINTER(type), value); } -static PyObject *Quaternion_getMagnitude( QuaternionObject * self, void *type ) +static PyObject *Quaternion_getMagnitude(QuaternionObject * self, void *UNUSED(closure)) { if(!BaseMath_ReadCallback(self)) return NULL; @@ -780,7 +780,7 @@ static PyObject *Quaternion_getMagnitude( QuaternionObject * self, void *type ) return PyFloat_FromDouble(sqrt(dot_qtqt(self->quat, self->quat))); } -static PyObject *Quaternion_getAngle( QuaternionObject * self, void *type ) +static PyObject *Quaternion_getAngle(QuaternionObject * self, void *UNUSED(closure)) { if(!BaseMath_ReadCallback(self)) return NULL; @@ -788,7 +788,7 @@ static PyObject *Quaternion_getAngle( QuaternionObject * self, void *type ) return PyFloat_FromDouble(2.0 * (saacos(self->quat[0]))); } -static int Quaternion_setAngle(QuaternionObject * self, PyObject * value, void * type) +static int Quaternion_setAngle(QuaternionObject * self, PyObject * value, void *UNUSED(closure)) { float axis[3]; float angle; @@ -821,7 +821,7 @@ static int Quaternion_setAngle(QuaternionObject * self, PyObject * value, void * return 0; } -static PyObject *Quaternion_getAxisVec(QuaternionObject *self, void *type) +static PyObject *Quaternion_getAxisVec(QuaternionObject *self, void *UNUSED(closure)) { float axis[3]; float angle; @@ -842,7 +842,7 @@ static PyObject *Quaternion_getAxisVec(QuaternionObject *self, void *type) return (PyObject *) newVectorObject(axis, 3, Py_NEW, NULL); } -static int Quaternion_setAxisVec(QuaternionObject *self, PyObject *value, void *type) +static int Quaternion_setAxisVec(QuaternionObject *self, PyObject *value, void *UNUSED(closure)) { float axis[3]; float angle; @@ -872,12 +872,17 @@ static int Quaternion_setAxisVec(QuaternionObject *self, PyObject *value, void * } //----------------------------------mathutils.Quaternion() -------------- -static PyObject *Quaternion_new(PyTypeObject *type, PyObject *args, PyObject *kwds) +static PyObject *Quaternion_new(PyTypeObject *UNUSED(type), PyObject *args, PyObject *kwds) { PyObject *seq= NULL; float angle = 0.0f; float quat[QUAT_SIZE]= {0.0f, 0.0f, 0.0f, 0.0f}; + if(kwds && PyDict_Size(kwds)) { + PyErr_SetString(PyExc_TypeError, "mathutils.Quaternion(): takes no keyword args"); + return NULL; + } + if(!PyArg_ParseTuple(args, "|Of:mathutils.Quaternion", &seq, &angle)) return NULL; diff --git a/source/blender/python/generic/mathutils_vector.c b/source/blender/python/generic/mathutils_vector.c index 1fe2518c6ef..84f41b6e66a 100644 --- a/source/blender/python/generic/mathutils_vector.c +++ b/source/blender/python/generic/mathutils_vector.c @@ -45,7 +45,7 @@ static PyObject *Vector_ToTupleExt(VectorObject *self, int ndigits); //----------------------------------mathutils.Vector() ------------------ // Supports 2D, 3D, and 4D vector objects both int and float values // accepted. Mixed float and int values accepted. Ints are parsed to float -static PyObject *Vector_new(PyTypeObject *type, PyObject *args, PyObject *kwds) +static PyObject *Vector_new(PyTypeObject *type, PyObject *args, PyObject *UNUSED(kwds)) { float vec[4]= {0.0f, 0.0f, 0.0f, 0.0f}; int size= 3; /* default to a 3D vector */ @@ -1445,7 +1445,7 @@ static int Vector_setAxis(VectorObject *self, PyObject * value, void * type ) } /* vector.length */ -static PyObject *Vector_getLength(VectorObject *self, void *type ) +static PyObject *Vector_getLength(VectorObject *self, void *UNUSED(closure)) { double dot = 0.0f; int i; diff --git a/source/blender/python/generic/noise.c b/source/blender/python/generic/noise.c index 4a09cbb58d8..a9bbc016a54 100644 --- a/source/blender/python/generic/noise.c +++ b/source/blender/python/generic/noise.c @@ -39,6 +39,8 @@ #include "BLI_blenlib.h" #include "DNA_texture_types.h" + +#include "BKE_utildefines.h" /*-----------------------------------------*/ /* 'mersenne twister' random number generator */ @@ -207,12 +209,12 @@ static void randuvec(float v[3]) v[2] = 1.f; } -static PyObject *Noise_random(PyObject * self) +static PyObject *Noise_random(PyObject *UNUSED(self)) { return PyFloat_FromDouble(frand()); } -static PyObject *Noise_random_unit_vector(PyObject * self) +static PyObject *Noise_random_unit_vector(PyObject *UNUSED(self)) { float v[3] = {0.0f, 0.0f, 0.0f}; randuvec(v); @@ -223,7 +225,7 @@ static PyObject *Noise_random_unit_vector(PyObject * self) /* Random seed init. Only used for MT random() & randuvec() */ -static PyObject *Noise_seed_set(PyObject * self, PyObject * args) +static PyObject *Noise_seed_set(PyObject *UNUSED(self), PyObject *args) { int s; if(!PyArg_ParseTuple(args, "i:seed_set", &s)) @@ -236,7 +238,7 @@ static PyObject *Noise_seed_set(PyObject * self, PyObject * args) /* General noise */ -static PyObject *Noise_noise(PyObject * self, PyObject * args) +static PyObject *Noise_noise(PyObject *UNUSED(self), PyObject *args) { float x, y, z; int nb = 1; @@ -260,7 +262,7 @@ static void noise_vector(float x, float y, float z, int nb, float v[3]) nb) - 1.0); } -static PyObject *Noise_vector(PyObject * self, PyObject * args) +static PyObject *Noise_vector(PyObject *UNUSED(self), PyObject *args) { float x, y, z, v[3]; int nb = 1; @@ -296,7 +298,7 @@ static float turb(float x, float y, float z, int oct, int hard, int nb, return out; } -static PyObject *Noise_turbulence(PyObject * self, PyObject * args) +static PyObject *Noise_turbulence(PyObject *UNUSED(self), PyObject *args) { float x, y, z; int oct, hd, nb = 1; @@ -340,7 +342,7 @@ static void vTurb(float x, float y, float z, int oct, int hard, int nb, } } -static PyObject *Noise_turbulence_vector(PyObject * self, PyObject * args) +static PyObject *Noise_turbulence_vector(PyObject *UNUSED(self), PyObject *args) { float x, y, z, v[3]; int oct, hd, nb = 1; @@ -355,7 +357,7 @@ static PyObject *Noise_turbulence_vector(PyObject * self, PyObject * args) /* F. Kenton Musgrave's fractal functions */ -static PyObject *Noise_fractal(PyObject * self, PyObject * args) +static PyObject *Noise_fractal(PyObject *UNUSED(self), PyObject *args) { float x, y, z, H, lac, oct; int nb = 1; @@ -366,7 +368,7 @@ static PyObject *Noise_fractal(PyObject * self, PyObject * args) /*------------------------------------------------------------------------*/ -static PyObject *Noise_multi_fractal(PyObject * self, PyObject * args) +static PyObject *Noise_multi_fractal(PyObject *UNUSED(self), PyObject *args) { float x, y, z, H, lac, oct; int nb = 1; @@ -378,7 +380,7 @@ static PyObject *Noise_multi_fractal(PyObject * self, PyObject * args) /*------------------------------------------------------------------------*/ -static PyObject *Noise_vl_vector(PyObject * self, PyObject * args) +static PyObject *Noise_vl_vector(PyObject *UNUSED(self), PyObject *args) { float x, y, z, d; int nt1 = 1, nt2 = 1; @@ -389,7 +391,7 @@ static PyObject *Noise_vl_vector(PyObject * self, PyObject * args) /*-------------------------------------------------------------------------*/ -static PyObject *Noise_hetero_terrain(PyObject * self, PyObject * args) +static PyObject *Noise_hetero_terrain(PyObject *UNUSED(self), PyObject *args) { float x, y, z, H, lac, oct, ofs; int nb = 1; @@ -401,7 +403,7 @@ static PyObject *Noise_hetero_terrain(PyObject * self, PyObject * args) /*-------------------------------------------------------------------------*/ -static PyObject *Noise_hybrid_multi_fractal(PyObject * self, PyObject * args) +static PyObject *Noise_hybrid_multi_fractal(PyObject *UNUSED(self), PyObject *args) { float x, y, z, H, lac, oct, ofs, gn; int nb = 1; @@ -413,7 +415,7 @@ static PyObject *Noise_hybrid_multi_fractal(PyObject * self, PyObject * args) /*------------------------------------------------------------------------*/ -static PyObject *Noise_ridged_multi_fractal(PyObject * self, PyObject * args) +static PyObject *Noise_ridged_multi_fractal(PyObject *UNUSED(self), PyObject *args) { float x, y, z, H, lac, oct, ofs, gn; int nb = 1; @@ -424,7 +426,7 @@ static PyObject *Noise_ridged_multi_fractal(PyObject * self, PyObject * args) /*-------------------------------------------------------------------------*/ -static PyObject *Noise_voronoi(PyObject * self, PyObject * args) +static PyObject *Noise_voronoi(PyObject *UNUSED(self), PyObject *args) { float x, y, z, da[4], pa[12]; int dtype = 0; @@ -441,7 +443,7 @@ static PyObject *Noise_voronoi(PyObject * self, PyObject * args) /*-------------------------------------------------------------------------*/ -static PyObject *Noise_cell(PyObject * self, PyObject * args) +static PyObject *Noise_cell(PyObject *UNUSED(self), PyObject *args) { float x, y, z; if(!PyArg_ParseTuple(args, "(fff):cell", &x, &y, &z)) @@ -452,7 +454,7 @@ static PyObject *Noise_cell(PyObject * self, PyObject * args) /*--------------------------------------------------------------------------*/ -static PyObject *Noise_cell_vector(PyObject * self, PyObject * args) +static PyObject *Noise_cell_vector(PyObject *UNUSED(self), PyObject *args) { float x, y, z, ca[3]; if(!PyArg_ParseTuple(args, "(fff):cell_vector", &x, &y, &z)) @@ -603,22 +605,22 @@ look like anything from an earthquake to a very nervous or maybe even drunk came /* Just in case, declarations for a header file */ /* -static PyObject *Noise_random(PyObject *self); -static PyObject *Noise_random_unit_vector(PyObject *self); -static PyObject *Noise_seed_set(PyObject *self, PyObject *args); -static PyObject *Noise_noise(PyObject *self, PyObject *args); -static PyObject *Noise_vector(PyObject *self, PyObject *args); -static PyObject *Noise_turbulence(PyObject *self, PyObject *args); -static PyObject *Noise_turbulence_vector(PyObject *self, PyObject *args); -static PyObject *Noise_fractal(PyObject *self, PyObject *args); -static PyObject *Noise_multi_fractal(PyObject *self, PyObject *args); -static PyObject *Noise_vl_vector(PyObject *self, PyObject *args); -static PyObject *Noise_hetero_terrain(PyObject *self, PyObject *args); -static PyObject *Noise_hybrid_multi_fractal(PyObject *self, PyObject *args); -static PyObject *Noise_ridged_multi_fractal(PyObject *self, PyObject *args); -static PyObject *Noise_voronoi(PyObject *self, PyObject *args); -static PyObject *Noise_cell(PyObject *self, PyObject *args); -static PyObject *Noise_cell_vector(PyObject *self, PyObject *args); +static PyObject *Noise_random(PyObject *UNUSED(self)); +static PyObject *Noise_random_unit_vector(PyObject *UNUSED(self)); +static PyObject *Noise_seed_set(PyObject *UNUSED(self), PyObject *args); +static PyObject *Noise_noise(PyObject *UNUSED(self), PyObject *args); +static PyObject *Noise_vector(PyObject *UNUSED(self), PyObject *args); +static PyObject *Noise_turbulence(PyObject *UNUSED(self), PyObject *args); +static PyObject *Noise_turbulence_vector(PyObject *UNUSED(self), PyObject *args); +static PyObject *Noise_fractal(PyObject *UNUSED(self), PyObject *args); +static PyObject *Noise_multi_fractal(PyObject *UNUSED(self), PyObject *args); +static PyObject *Noise_vl_vector(PyObject *UNUSED(self), PyObject *args); +static PyObject *Noise_hetero_terrain(PyObject *UNUSED(self), PyObject *args); +static PyObject *Noise_hybrid_multi_fractal(PyObject *UNUSED(self), PyObject *args); +static PyObject *Noise_ridged_multi_fractal(PyObject *UNUSED(self), PyObject *args); +static PyObject *Noise_voronoi(PyObject *UNUSED(self), PyObject *args); +static PyObject *Noise_cell(PyObject *UNUSED(self), PyObject *args); +static PyObject *Noise_cell_vector(PyObject *UNUSED(self), PyObject *args); */ static PyMethodDef NoiseMethods[] = { diff --git a/source/blender/python/intern/bpy.c b/source/blender/python/intern/bpy.c index ffb949f9296..9b1f09a7984 100644 --- a/source/blender/python/intern/bpy.c +++ b/source/blender/python/intern/bpy.c @@ -34,7 +34,9 @@ #include "BLI_path_util.h" #include "BLI_bpath.h" - + +#include "BKE_utildefines.h" + /* external util modules */ #include "../generic/geometry.h" #include "../generic/bgl.h" @@ -53,7 +55,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 *self) +PyObject *bpy_script_paths(PyObject *UNUSED(self)) { PyObject *ret= PyTuple_New(2); char *path; @@ -75,7 +77,7 @@ static char bpy_blend_paths_doc[] = " :type absolute: boolean\n" " :return: path list.\n" " :rtype: list of strigs\n"; -static PyObject *bpy_blend_paths(PyObject * self, PyObject *args, PyObject *kw) +static PyObject *bpy_blend_paths(PyObject *UNUSED(self), PyObject *args, PyObject *kw) { struct BPathIterator bpi; PyObject *list = PyList_New(0), *st; /* stupidly big string to be safe */ @@ -126,7 +128,7 @@ static char bpy_user_resource_doc[] = " :type subdir: string\n" " :return: a path.\n" " :rtype: string\n"; -static PyObject *bpy_user_resource(PyObject * self, PyObject *args, PyObject *kw) +static PyObject *bpy_user_resource(PyObject *UNUSED(self), PyObject *args, PyObject *kw) { char *type; char *subdir= NULL; diff --git a/source/blender/python/intern/bpy_app.c b/source/blender/python/intern/bpy_app.c index 78658a611a3..39494678a12 100644 --- a/source/blender/python/intern/bpy_app.c +++ b/source/blender/python/intern/bpy_app.c @@ -26,16 +26,22 @@ #include "BLI_path_util.h" +#include "BKE_utildefines.h" #include "BKE_blender.h" #include "BKE_global.h" #include "structseq.h" +#include "../generic/py_capi_utils.h" + #ifdef BUILD_DATE extern char build_date[]; extern char build_time[]; extern char build_rev[]; extern char build_platform[]; extern char build_type[]; +extern char build_cflags[]; +extern char build_cxxflags[]; +extern char build_linkflags[]; #endif static PyTypeObject BlenderAppType; @@ -44,7 +50,6 @@ static PyStructSequence_Field app_info_fields[] = { {"version", "The Blender version as a tuple of 3 numbers. eg. (2, 50, 11)"}, {"version_string", "The Blender version formatted as a string"}, {"binary_path", "The location of blenders executable, useful for utilities that spawn new instances"}, - {"debug", "Boolean, set when blender is running in debug mode (started with -d)"}, {"background", "Boolean, True when blender is running without a user interface (started with -b)"}, /* buildinfo */ @@ -53,6 +58,9 @@ static PyStructSequence_Field app_info_fields[] = { {"build_revision", "The subversion revision this blender instance was built with"}, {"build_platform", "The platform this blender instance was built for"}, {"build_type", "The type of build (Release, Debug)"}, + {"build_cflags", ""}, + {"build_cxxflags", ""}, + {"build_linkflags", ""}, {0} }; @@ -85,7 +93,6 @@ static PyObject *make_app_info(void) SetObjItem(Py_BuildValue("(iii)", BLENDER_VERSION/100, BLENDER_VERSION%100, BLENDER_SUBVERSION)); SetObjItem(PyUnicode_FromFormat("%d.%02d (sub %d)", BLENDER_VERSION/100, BLENDER_VERSION%100, BLENDER_SUBVERSION)); SetStrItem(bprogname); - SetObjItem(PyBool_FromLong(G.f & G_DEBUG)); SetObjItem(PyBool_FromLong(G.background)); /* build info */ @@ -95,12 +102,18 @@ static PyObject *make_app_info(void) SetStrItem(build_rev); SetStrItem(build_platform); SetStrItem(build_type); + SetStrItem(build_cflags); + SetStrItem(build_cxxflags); + SetStrItem(build_linkflags); #else SetStrItem("Unknown"); SetStrItem("Unknown"); SetStrItem("Unknown"); SetStrItem("Unknown"); SetStrItem("Unknown"); + SetStrItem("Unknown"); + SetStrItem("Unknown"); + SetStrItem("Unknown"); #endif #undef SetIntItem @@ -114,10 +127,51 @@ static PyObject *make_app_info(void) return app_info; } +/* a few getsets because it makes sense for them to be in bpy.app even though + * they are not static */ +static PyObject *bpy_app_debug_get(PyObject *UNUSED(self), void *UNUSED(closure)) +{ + return PyBool_FromLong(G.f & G_DEBUG); +} + +static int bpy_app_debug_set(PyObject *UNUSED(self), PyObject *value, void *UNUSED(closure)) +{ + int param= PyObject_IsTrue(value); + + if(param < 0) { + PyErr_SetString(PyExc_TypeError, "bpy.app.debug can only be True/False"); + return -1; + } + + if(param) G.f |= G_DEBUG; + else G.f &= ~G_DEBUG; + + return 0; +} + +static PyObject *bpy_app_tempdir_get(PyObject *UNUSED(self), void *UNUSED(closure)) +{ + extern char btempdir[]; + return PyC_UnicodeFromByte(btempdir); +} + +PyGetSetDef bpy_app_debug_getset= {"debug", bpy_app_debug_get, bpy_app_debug_set, "Boolean, set when blender is running in debug mode (started with -d)", NULL}; +PyGetSetDef bpy_app_tempdir_getset= {"tempdir", bpy_app_tempdir_get, NULL, "String, the temp directory used by blender (read-only)", NULL}; + +static void py_struct_seq_getset_init(void) +{ + /* tricky dynamic members, not to py-spec! */ + + PyDict_SetItemString(BlenderAppType.tp_dict, bpy_app_debug_getset.name, PyDescr_NewGetSet(&BlenderAppType, &bpy_app_debug_getset)); + PyDict_SetItemString(BlenderAppType.tp_dict, bpy_app_tempdir_getset.name, PyDescr_NewGetSet(&BlenderAppType, &bpy_app_tempdir_getset)); +} +/* end dynamic bpy.app */ + + PyObject *BPY_app_struct(void) { PyObject *ret; - + PyStructSequence_InitType(&BlenderAppType, &app_info_desc); ret= make_app_info(); @@ -125,6 +179,10 @@ PyObject *BPY_app_struct(void) /* prevent user from creating new instances */ BlenderAppType.tp_init = NULL; BlenderAppType.tp_new = NULL; - + + /* kindof a hack ontop of PyStructSequence */ + py_struct_seq_getset_init(); + return ret; } + diff --git a/source/blender/python/intern/bpy_array.c b/source/blender/python/intern/bpy_array.c index 6d971d8708e..d219757b777 100644 --- a/source/blender/python/intern/bpy_array.c +++ b/source/blender/python/intern/bpy_array.c @@ -237,7 +237,7 @@ static char *copy_values(PyObject *seq, PointerRNA *ptr, PropertyRNA *prop, int return data; } -static int py_to_array(PyObject *py, PointerRNA *ptr, PropertyRNA *prop, ParameterList *parms, char *param_data, ItemTypeCheckFunc check_item_type, const char *item_type_str, int item_size, ItemConvertFunc convert_item, RNA_SetArrayFunc rna_set_array, const char *error_prefix) +static int py_to_array(PyObject *py, PointerRNA *ptr, PropertyRNA *prop, char *param_data, ItemTypeCheckFunc check_item_type, const char *item_type_str, int item_size, ItemConvertFunc convert_item, RNA_SetArrayFunc rna_set_array, const char *error_prefix) { int totdim, dim_size[MAX_ARRAY_DIMENSION]; int totitem; @@ -358,18 +358,18 @@ static void bool_set_index(PointerRNA *ptr, PropertyRNA *prop, int index, void * RNA_property_boolean_set_index(ptr, prop, index, *(int*)value); } -int pyrna_py_to_array(PointerRNA *ptr, PropertyRNA *prop, ParameterList *parms, char *param_data, PyObject *py, const char *error_prefix) +int pyrna_py_to_array(PointerRNA *ptr, PropertyRNA *prop, char *param_data, PyObject *py, const char *error_prefix) { int ret; switch (RNA_property_type(prop)) { case PROP_FLOAT: - ret= py_to_array(py, ptr, prop, parms, param_data, py_float_check, "float", sizeof(float), py_to_float, (RNA_SetArrayFunc)RNA_property_float_set_array, error_prefix); + ret= py_to_array(py, ptr, prop, param_data, py_float_check, "float", sizeof(float), py_to_float, (RNA_SetArrayFunc)RNA_property_float_set_array, error_prefix); break; case PROP_INT: - ret= py_to_array(py, ptr, prop, parms, param_data, py_int_check, "int", sizeof(int), py_to_int, (RNA_SetArrayFunc)RNA_property_int_set_array, error_prefix); + ret= py_to_array(py, ptr, prop, param_data, py_int_check, "int", sizeof(int), py_to_int, (RNA_SetArrayFunc)RNA_property_int_set_array, error_prefix); break; case PROP_BOOLEAN: - ret= py_to_array(py, ptr, prop, parms, param_data, py_bool_check, "boolean", sizeof(int), py_to_bool, (RNA_SetArrayFunc)RNA_property_boolean_set_array, error_prefix); + ret= py_to_array(py, ptr, prop, param_data, py_bool_check, "boolean", sizeof(int), py_to_bool, (RNA_SetArrayFunc)RNA_property_boolean_set_array, error_prefix); break; default: PyErr_SetString(PyExc_TypeError, "not an array type"); diff --git a/source/blender/python/intern/bpy_interface.c b/source/blender/python/intern/bpy_interface.c index bc79ba94756..3ff0d86b433 100644 --- a/source/blender/python/intern/bpy_interface.c +++ b/source/blender/python/intern/bpy_interface.c @@ -43,6 +43,7 @@ #include "BLI_math_base.h" #include "BLI_string.h" +#include "BKE_utildefines.h" #include "BKE_context.h" #include "BKE_text.h" #include "BKE_font.h" /* only for utf8towchar */ @@ -104,7 +105,8 @@ void bpy_context_set(bContext *C, PyGILState_STATE *gilstate) } } -void bpy_context_clear(bContext *C, PyGILState_STATE *gilstate) +/* context should be used but not now because it causes some bugs */ +void bpy_context_clear(bContext *UNUSED(C), PyGILState_STATE *gilstate) { py_call_level--; diff --git a/source/blender/python/intern/bpy_operator.c b/source/blender/python/intern/bpy_operator.c index 2b475a57de6..3ffa78dab70 100644 --- a/source/blender/python/intern/bpy_operator.c +++ b/source/blender/python/intern/bpy_operator.c @@ -40,7 +40,7 @@ #include "MEM_guardedalloc.h" #include "BKE_report.h" -static PyObject *pyop_poll( PyObject * self, PyObject * args) +static PyObject *pyop_poll(PyObject *UNUSED(self), PyObject *args) { wmOperatorType *ot; char *opname; @@ -80,7 +80,7 @@ static PyObject *pyop_poll( PyObject * self, PyObject * args) return ret; } -static PyObject *pyop_call( PyObject * self, PyObject * args) +static PyObject *pyop_call(PyObject *UNUSED(self), PyObject *args) { wmOperatorType *ot; int error_val = 0; @@ -196,7 +196,7 @@ static PyObject *pyop_call( PyObject * self, PyObject * args) } -static PyObject *pyop_as_string( PyObject * self, PyObject * args) +static PyObject *pyop_as_string(PyObject *UNUSED(self), PyObject *args) { wmOperatorType *ot; PointerRNA ptr; @@ -248,7 +248,7 @@ static PyObject *pyop_as_string( PyObject * self, PyObject * args) return pybuf; } -static PyObject *pyop_dir(PyObject *self) +static PyObject *pyop_dir(PyObject *UNUSED(self)) { PyObject *list = PyList_New(0), *name; wmOperatorType *ot; @@ -262,7 +262,7 @@ static PyObject *pyop_dir(PyObject *self) return list; } -static PyObject *pyop_getrna(PyObject *self, PyObject *value) +static PyObject *pyop_getrna(PyObject *UNUSED(self), PyObject *value) { wmOperatorType *ot; PointerRNA ptr; diff --git a/source/blender/python/intern/bpy_operator_wrap.c b/source/blender/python/intern/bpy_operator_wrap.c index 6d16896fb16..fa1aeacbc42 100644 --- a/source/blender/python/intern/bpy_operator_wrap.c +++ b/source/blender/python/intern/bpy_operator_wrap.c @@ -84,7 +84,7 @@ void macro_wrapper(wmOperatorType *ot, void *userdata) operator_properties_init(ot); } -PyObject *PYOP_wrap_macro_define(PyObject *self, PyObject *args) +PyObject *PYOP_wrap_macro_define(PyObject *UNUSED(self), PyObject *args) { wmOperatorType *ot; wmOperatorTypeMacro *otmacro; diff --git a/source/blender/python/intern/bpy_rna.c b/source/blender/python/intern/bpy_rna.c index 166213fa07c..a3b0c4739c4 100644 --- a/source/blender/python/intern/bpy_rna.c +++ b/source/blender/python/intern/bpy_rna.c @@ -58,7 +58,7 @@ #include "../generic/IDProp.h" /* for IDprop lookups */ #include "../generic/py_capi_utils.h" -static int pyrna_py_to_prop(PointerRNA *ptr, PropertyRNA *prop, ParameterList *parms, void *data, PyObject *value, const char *error_prefix); +static int pyrna_py_to_prop(PointerRNA *ptr, PropertyRNA *prop, void *data, PyObject *value, const char *error_prefix); static PyObject *pyrna_prop_array_subscript_slice(BPy_PropertyArrayRNA *self, PointerRNA *ptr, PropertyRNA *prop, int start, int stop, int length); static Py_ssize_t pyrna_prop_array_length(BPy_PropertyArrayRNA *self); static Py_ssize_t pyrna_prop_collection_length(BPy_PropertyRNA *self); @@ -135,7 +135,7 @@ static int mathutils_rna_vector_set(BaseMathObject *bmo, int subtype) return 1; } -static int mathutils_rna_vector_get_index(BaseMathObject *bmo, int subtype, int index) +static int mathutils_rna_vector_get_index(BaseMathObject *bmo, int UNUSED(subtype), int index) { BPy_PropertyRNA *self= (BPy_PropertyRNA *)bmo->cb_user; @@ -146,7 +146,7 @@ static int mathutils_rna_vector_get_index(BaseMathObject *bmo, int subtype, int return 1; } -static int mathutils_rna_vector_set_index(BaseMathObject *bmo, int subtype, int index) +static int mathutils_rna_vector_set_index(BaseMathObject *bmo, int UNUSED(subtype), int index) { BPy_PropertyRNA *self= (BPy_PropertyRNA *)bmo->cb_user; @@ -176,7 +176,7 @@ Mathutils_Callback mathutils_rna_array_cb = { /* bpyrna matrix callbacks */ static int mathutils_rna_matrix_cb_index= -1; /* index for our callbacks */ -static int mathutils_rna_matrix_get(BaseMathObject *bmo, int subtype) +static int mathutils_rna_matrix_get(BaseMathObject *bmo, int UNUSED(subtype)) { BPy_PropertyRNA *self= (BPy_PropertyRNA *)bmo->cb_user; @@ -187,7 +187,7 @@ static int mathutils_rna_matrix_get(BaseMathObject *bmo, int subtype) return 1; } -static int mathutils_rna_matrix_set(BaseMathObject *bmo, int subtype) +static int mathutils_rna_matrix_set(BaseMathObject *bmo, int UNUSED(subtype)) { BPy_PropertyRNA *self= (BPy_PropertyRNA *)bmo->cb_user; @@ -864,7 +864,7 @@ int pyrna_pydict_to_props(PointerRNA *ptr, PyObject *kw, int all_args, const cha break; } } else { - if (pyrna_py_to_prop(ptr, prop, NULL, NULL, item, error_prefix)) { + if (pyrna_py_to_prop(ptr, prop, NULL, item, error_prefix)) { error_val= -1; break; } @@ -918,7 +918,7 @@ static PyObject *pyrna_func_to_py(BPy_DummyPointerRNA *pyrna, FunctionRNA *func) -static int pyrna_py_to_prop(PointerRNA *ptr, PropertyRNA *prop, ParameterList *parms, void *data, PyObject *value, const char *error_prefix) +static int pyrna_py_to_prop(PointerRNA *ptr, PropertyRNA *prop, void *data, PyObject *value, const char *error_prefix) { /* XXX hard limits should be checked here */ int type = RNA_property_type(prop); @@ -941,7 +941,7 @@ static int pyrna_py_to_prop(PointerRNA *ptr, PropertyRNA *prop, ParameterList *p return -1; } /* done getting the length */ - ok= pyrna_py_to_array(ptr, prop, parms, data, value, error_prefix); + ok= pyrna_py_to_array(ptr, prop, data, value, error_prefix); if (!ok) { /* PyErr_Format(PyExc_AttributeError, "%.200s %s", error_prefix, error_str); */ @@ -964,7 +964,7 @@ static int pyrna_py_to_prop(PointerRNA *ptr, PropertyRNA *prop, ParameterList *p else param = PyLong_AsLong( value ); - if( param < 0 || param > 1) { + 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; } else { @@ -1391,7 +1391,7 @@ static PyObject *pyrna_prop_collection_subscript_str(BPy_PropertyRNA *self, cons } /* static PyObject *pyrna_prop_array_subscript_str(BPy_PropertyRNA *self, char *keyname) */ -static PyObject *pyrna_prop_collection_subscript_slice(PointerRNA *ptr, PropertyRNA *prop, int start, int stop, int length) +static PyObject *pyrna_prop_collection_subscript_slice(PointerRNA *ptr, PropertyRNA *prop, int start, int stop) { PointerRNA newptr; PyObject *list = PyList_New(stop - start); @@ -1513,7 +1513,7 @@ static PyObject *pyrna_prop_collection_subscript(BPy_PropertyRNA *self, PyObject return PyList_New(0); } else if (step == 1) { - return pyrna_prop_collection_subscript_slice(&self->ptr, self->prop, start, stop, len); + return pyrna_prop_collection_subscript_slice(&self->ptr, self->prop, start, stop); } else { PyErr_SetString(PyExc_TypeError, "bpy_prop_collection[slice]: slice steps not supported with rna"); @@ -2431,7 +2431,7 @@ static char pyrna_struct_type_recast_doc[] = " :return: a new instance of this object with the type initialized again.\n" " :rtype: subclass of :class:`bpy_struct`"; -static PyObject *pyrna_struct_type_recast(BPy_StructRNA *self, PyObject *args) +static PyObject *pyrna_struct_type_recast(BPy_StructRNA *self) { PointerRNA r_ptr; RNA_pointer_recast(&self->ptr, &r_ptr); @@ -2751,7 +2751,7 @@ static int pyrna_struct_setattro( BPy_StructRNA *self, PyObject *pyname, PyObjec PyErr_SetString(PyExc_AttributeError, "bpy_struct: del not supported"); return -1; } - return pyrna_py_to_prop(&self->ptr, prop, NULL, NULL, value, "bpy_struct: item.attr = val:"); + return pyrna_py_to_prop(&self->ptr, prop, NULL, value, "bpy_struct: item.attr = val:"); } else { return PyObject_GenericSetAttr((PyObject *)self, pyname, value); @@ -2835,7 +2835,7 @@ static int pyrna_prop_collection_setattro( BPy_PropertyRNA *self, PyObject *pyna else if(RNA_property_collection_type_get(&self->ptr, self->prop, &r_ptr)) { if ((prop = RNA_struct_find_property(&r_ptr, name))) { /* pyrna_py_to_prop sets its own exceptions */ - return pyrna_py_to_prop(&r_ptr, prop, NULL, NULL, value, "BPy_PropertyRNA - Attribute (setattr):"); + return pyrna_py_to_prop(&r_ptr, prop, NULL, value, "BPy_PropertyRNA - Attribute (setattr):"); } } @@ -3409,7 +3409,7 @@ static struct PyMethodDef pyrna_prop_collection_idprop_methods[] = { /* only needed for subtyping, so a new class gets a valid BPy_StructRNA * todo - also accept useful args */ -static PyObject * pyrna_struct_new(PyTypeObject *type, PyObject *args, PyObject *kwds) { +static PyObject * pyrna_struct_new(PyTypeObject *type, PyObject *args, PyObject *UNUSED(kwds)) { BPy_StructRNA *base; @@ -3432,7 +3432,7 @@ static PyObject * pyrna_struct_new(PyTypeObject *type, PyObject *args, PyObject /* only needed for subtyping, so a new class gets a valid BPy_StructRNA * todo - also accept useful args */ -static PyObject * pyrna_prop_new(PyTypeObject *type, PyObject *args, PyObject *kwds) { +static PyObject * pyrna_prop_new(PyTypeObject *type, PyObject *args, PyObject *UNUSED(kwds)) { BPy_PropertyRNA *base; @@ -3454,7 +3454,7 @@ static PyObject * pyrna_prop_new(PyTypeObject *type, PyObject *args, PyObject *k } } -PyObject *pyrna_param_to_py(PointerRNA *ptr, ParameterList *parms, PropertyRNA *prop, void *data) +PyObject *pyrna_param_to_py(PointerRNA *ptr, PropertyRNA *prop, void *data) { PyObject *ret; int type = RNA_property_type(prop); @@ -3704,7 +3704,7 @@ static PyObject * pyrna_func_call(PyObject *self, PyObject *args, PyObject *kw) continue; } - err= pyrna_py_to_prop(&funcptr, parm, &parms, iter.data, item, ""); + err= pyrna_py_to_prop(&funcptr, parm, iter.data, item, ""); if(err!=0) { /* the error generated isnt that useful, so generate it again with a useful prefix @@ -3717,7 +3717,7 @@ static PyObject * pyrna_func_call(PyObject *self, PyObject *args, PyObject *kw) else snprintf(error_prefix, sizeof(error_prefix), "%s.%s(): error with argument %d, \"%s\" - ", RNA_struct_identifier(self_ptr->type), RNA_function_identifier(self_func), i, parm_id); - pyrna_py_to_prop(&funcptr, parm, &parms, iter.data, item, error_prefix); + pyrna_py_to_prop(&funcptr, parm, iter.data, item, error_prefix); break; } @@ -3822,13 +3822,13 @@ static PyObject * pyrna_func_call(PyObject *self, PyObject *args, PyObject *kw) flag= RNA_property_flag(parm); if (flag & PROP_OUTPUT) - PyTuple_SET_ITEM(ret, i++, pyrna_param_to_py(&funcptr, &parms, parm, iter.data)); + PyTuple_SET_ITEM(ret, i++, pyrna_param_to_py(&funcptr, parm, iter.data)); } RNA_parameter_list_end(&iter); } else - ret= pyrna_param_to_py(&funcptr, &parms, pret_single, retdata_single); + ret= pyrna_param_to_py(&funcptr, pret_single, retdata_single); /* possible there is an error in conversion */ if(ret==NULL) @@ -5012,7 +5012,7 @@ static int bpy_class_validate(PointerRNA *dummyptr, void *py_data, int *have_fun if(strcmp(identifier, rna_attr) == 0) { \ item= PyObject_GetAttrString(py_class, py_attr); \ if(item && item != Py_None) { \ - if(pyrna_py_to_prop(dummyptr, prop, NULL, NULL, item, "validating class error:") != 0) { \ + if(pyrna_py_to_prop(dummyptr, prop, NULL, item, "validating class error:") != 0) { \ Py_DECREF(item); \ return -1; \ } \ @@ -5036,7 +5036,7 @@ static int bpy_class_validate(PointerRNA *dummyptr, void *py_data, int *have_fun else { Py_DECREF(item); /* no need to keep a ref, the class owns it */ - if(pyrna_py_to_prop(dummyptr, prop, NULL, NULL, item, "validating class error:") != 0) + if(pyrna_py_to_prop(dummyptr, prop, NULL, item, "validating class error:") != 0) return -1; } } @@ -5156,7 +5156,7 @@ static int bpy_class_call(PointerRNA *ptr, FunctionRNA *func, ParameterList *par continue; } - parmitem= pyrna_param_to_py(&funcptr, parms, parm, iter.data); + parmitem= pyrna_param_to_py(&funcptr, parm, iter.data); PyTuple_SET_ITEM(args, i, parmitem); i++; } @@ -5191,7 +5191,7 @@ static int bpy_class_call(PointerRNA *ptr, FunctionRNA *func, ParameterList *par err= -1; } else if(ret_len==1) { - err= pyrna_py_to_prop(&funcptr, pret_single, parms, retdata_single, ret, "calling class function:"); + err= pyrna_py_to_prop(&funcptr, pret_single, retdata_single, ret, "calling class function:"); } else if (ret_len > 1) { @@ -5214,7 +5214,7 @@ static int bpy_class_call(PointerRNA *ptr, FunctionRNA *func, ParameterList *par /* only useful for single argument returns, we'll need another list loop for multiple */ if (flag & PROP_OUTPUT) { - err= pyrna_py_to_prop(&funcptr, parm, parms, iter.data, PyTuple_GET_ITEM(ret, i++), "calling class function:"); + err= pyrna_py_to_prop(&funcptr, parm, iter.data, PyTuple_GET_ITEM(ret, i++), "calling class function:"); if(err) break; } @@ -5328,7 +5328,7 @@ void pyrna_free_types(void) * - Should still be fixed - Campbell * */ -static PyObject *pyrna_basetype_register(PyObject *self, PyObject *py_class) +static PyObject *pyrna_basetype_register(PyObject *UNUSED(self), PyObject *py_class) { bContext *C= NULL; ReportList reports; @@ -5425,7 +5425,7 @@ static int pyrna_srna_contains_pointer_prop_srna(StructRNA *srna_props, StructRN return 0; } -static PyObject *pyrna_basetype_unregister(PyObject *self, PyObject *py_class) +static PyObject *pyrna_basetype_unregister(PyObject *UNUSED(self), PyObject *py_class) { bContext *C= NULL; StructUnregisterFunc unreg; diff --git a/source/blender/python/intern/bpy_rna.h b/source/blender/python/intern/bpy_rna.h index 7f750f94242..77b602b6f83 100644 --- a/source/blender/python/intern/bpy_rna.h +++ b/source/blender/python/intern/bpy_rna.h @@ -99,7 +99,7 @@ void pyrna_alloc_types(void); void pyrna_free_types(void); /* primitive type conversion */ -int pyrna_py_to_array(PointerRNA *ptr, PropertyRNA *prop, ParameterList *parms, char *param_data, PyObject *py, const char *error_prefix); +int pyrna_py_to_array(PointerRNA *ptr, PropertyRNA *prop, char *param_data, PyObject *py, const char *error_prefix); int pyrna_py_to_array_index(PointerRNA *ptr, PropertyRNA *prop, int arraydim, int arrayoffset, int index, PyObject *py, const char *error_prefix); PyObject *pyrna_array_index(PointerRNA *ptr, PropertyRNA *prop, int index); diff --git a/source/blender/python/intern/bpy_rna_callback.c b/source/blender/python/intern/bpy_rna_callback.c index b2a7511f998..81d6e0cd4da 100644 --- a/source/blender/python/intern/bpy_rna_callback.c +++ b/source/blender/python/intern/bpy_rna_callback.c @@ -27,6 +27,7 @@ #include "bpy_util.h" #include "DNA_screen_types.h" +#include "BKE_utildefines.h" #include "BKE_context.h" #include "ED_space_api.h" @@ -34,7 +35,7 @@ #define RNA_CAPSULE_ID "RNA_HANDLE" #define RNA_CAPSULE_ID_INVALID "RNA_HANDLE_REMOVED" -void cb_region_draw(const bContext *C, ARegion *ar, void *customdata) +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/quicktime/apple/qtkit_export.m b/source/blender/quicktime/apple/qtkit_export.m index 73e23ea8abd..14a1163ee9a 100644 --- a/source/blender/quicktime/apple/qtkit_export.m +++ b/source/blender/quicktime/apple/qtkit_export.m @@ -41,6 +41,7 @@ #include "AUD_C-API.h" #include "BKE_global.h" +#include "BKE_main.h" #include "BKE_scene.h" #include "BKE_report.h" @@ -208,7 +209,7 @@ void makeqtstring (RenderData *rd, char *string) { char txt[64]; strcpy(string, rd->pic); - BLI_path_abs(string, G.sce); + BLI_path_abs(string, G.main->name); BLI_make_existing_file(string); @@ -222,7 +223,7 @@ void filepath_qt(char *string, RenderData *rd) { if (string==NULL) return; strcpy(string, rd->pic); - BLI_path_abs(string, G.sce); + BLI_path_abs(string, G.main->name); BLI_make_existing_file(string); diff --git a/source/blender/quicktime/apple/qtkit_import.m b/source/blender/quicktime/apple/qtkit_import.m index 41c4e0cc5a3..f067d717a7c 100644 --- a/source/blender/quicktime/apple/qtkit_import.m +++ b/source/blender/quicktime/apple/qtkit_import.m @@ -149,7 +149,7 @@ static ImBuf * nsImageToiBuf(NSImage *sourceImage, int width, int height) NSEnumerator *enumerator; NSImageRep *representation; - ibuf = IMB_allocImBuf (width, height, 32, IB_rect, 0); + ibuf = IMB_allocImBuf (width, height, 32, IB_rect); if (!ibuf) { if(QTIME_DEBUG) printf("quicktime_import: could not allocate memory for the " \ "image.\n"); @@ -359,7 +359,7 @@ int startquicktime (struct anim *anim) return -1; } - anim->qtime->ibuf = IMB_allocImBuf (anim->x, anim->y, 32, IB_rect, 0); + anim->qtime->ibuf = IMB_allocImBuf (anim->x, anim->y, 32, IB_rect); qtTimeDuration = [[anim->qtime->media attributeForKey:QTMediaDurationAttribute] QTTimeValue]; anim->qtime->durationTime = qtTimeDuration.timeValue; @@ -450,7 +450,7 @@ ImBuf *imb_quicktime_decode(unsigned char *mem, int size, int flags) [bitmapImage setSize:bitmapSize]; /* allocate the image buffer */ - ibuf = IMB_allocImBuf(bitmapSize.width, bitmapSize.height, 32/*RGBA*/, 0, 0); + ibuf = IMB_allocImBuf(bitmapSize.width, bitmapSize.height, 32/*RGBA*/, 0); if (!ibuf) { fprintf(stderr, "imb_cocoaLoadImage: could not allocate memory for the " \ diff --git a/source/blender/quicktime/apple/quicktime_export.c b/source/blender/quicktime/apple/quicktime_export.c index c1291fc6949..2623a598d5f 100644 --- a/source/blender/quicktime/apple/quicktime_export.c +++ b/source/blender/quicktime/apple/quicktime_export.c @@ -40,6 +40,7 @@ #include "BKE_context.h" #include "BKE_global.h" +#include "BKE_main.h" #include "BKE_report.h" #include "BKE_scene.h" @@ -379,8 +380,8 @@ static void QT_StartAddVideoSamplesToMedia (const Rect *trackFrame, int rectx, i SCTemporalSettings gTemporalSettings; OSErr err = noErr; - qtexport->ibuf = IMB_allocImBuf (rectx, recty, 32, IB_rect, 0); - qtexport->ibuf2 = IMB_allocImBuf (rectx, recty, 32, IB_rect, 0); + qtexport->ibuf = IMB_allocImBuf (rectx, recty, 32, IB_rect); + qtexport->ibuf2 = IMB_allocImBuf (rectx, recty, 32, IB_rect); err = NewGWorldFromPtr( &qtexport->theGWorld, k32ARGBPixelFormat, @@ -494,7 +495,7 @@ void filepath_qt(char *string, RenderData *rd) { if (string==0) return; strcpy(string, rd->pic); - BLI_path_abs(string, G.sce); + BLI_path_abs(string, G.main->name); BLI_make_existing_file(string); diff --git a/source/blender/quicktime/apple/quicktime_import.c b/source/blender/quicktime/apple/quicktime_import.c index f9793f04b88..699b2c4f6e3 100644 --- a/source/blender/quicktime/apple/quicktime_import.c +++ b/source/blender/quicktime/apple/quicktime_import.c @@ -335,7 +335,7 @@ ImBuf * qtime_fetchibuf (struct anim *anim, int position) return (NULL); } - ibuf = IMB_allocImBuf (anim->x, anim->y, 32, IB_rect, 0); + ibuf = IMB_allocImBuf (anim->x, anim->y, 32, IB_rect); rect = ibuf->rect; SetMovieTimeValue(anim->qtime->movie, anim->qtime->frameIndex[position]); @@ -496,7 +496,7 @@ int startquicktime (struct anim *anim) return -1; } - anim->qtime->ibuf = IMB_allocImBuf (anim->x, anim->y, 32, IB_rect, 0); + anim->qtime->ibuf = IMB_allocImBuf (anim->x, anim->y, 32, IB_rect); #ifdef _WIN32 err = NewGWorldFromPtr(&anim->qtime->offscreenGWorld, @@ -676,7 +676,7 @@ ImBuf *imb_quicktime_decode(unsigned char *mem, int size, int flags) depth = (**desc).depth; if (flags & IB_test) { - ibuf = IMB_allocImBuf(x, y, depth, 0, 0); + ibuf = IMB_allocImBuf(x, y, depth, 0); ibuf->ftype = QUICKTIME; DisposeHandle((Handle)dataref); if (gImporter != NULL) CloseComponent(gImporter); @@ -684,8 +684,8 @@ ImBuf *imb_quicktime_decode(unsigned char *mem, int size, int flags) } #ifdef __APPLE__ - ibuf = IMB_allocImBuf (x, y, 32, IB_rect, 0); - wbuf = IMB_allocImBuf (x, y, 32, IB_rect, 0); + ibuf = IMB_allocImBuf (x, y, 32, IB_rect); + wbuf = IMB_allocImBuf (x, y, 32, IB_rect); err = NewGWorldFromPtr(&offGWorld, k32ARGBPixelFormat, @@ -693,7 +693,7 @@ ImBuf *imb_quicktime_decode(unsigned char *mem, int size, int flags) (unsigned char *)wbuf->rect, x * 4); #else - ibuf = IMB_allocImBuf (x, y, 32, IB_rect, 0); + ibuf = IMB_allocImBuf (x, y, 32, IB_rect); err = NewGWorldFromPtr(&offGWorld, k32RGBAPixelFormat, diff --git a/source/blender/readblenfile/stub/BLO_readblenfileSTUB.c b/source/blender/readblenfile/stub/BLO_readblenfileSTUB.c index 33e9bfec446..c5b523b106f 100644 --- a/source/blender/readblenfile/stub/BLO_readblenfileSTUB.c +++ b/source/blender/readblenfile/stub/BLO_readblenfileSTUB.c @@ -41,7 +41,7 @@ int BLO_read_runtime( char *file); BLO_readblenfilememory( char *fromBuffer, int fromBufferSize) { -#ifndef NDEBUG +#if defined(DEBUG) fprintf(GEN_errorstream, "Error BLO_readblenfilename is a stub\n"); #endif @@ -52,7 +52,7 @@ BLO_readblenfilememory( BLO_readblenfilename( char *fileName) { -#ifndef NDEBUG +#if defined(DEBUG) fprintf(GEN_errorstream, "Error BLO_readblenfilename is a stub\n"); #endif @@ -63,7 +63,7 @@ BLO_readblenfilename( BLO_readblenfilehandle( int fileHandle) { -#ifndef NDEBUG +#if defined(DEBUG) fprintf(GEN_errorstream, "Error BLO_readblenfilehandle is a stub\n"); #endif @@ -74,7 +74,7 @@ BLO_readblenfilehandle( BLO_is_a_runtime( char *file) { -#ifndef NDEBUG +#if defined(DEBUG) fprintf(GEN_errorstream, "Error BLO_is_a_runtime is a stub\n"); #endif @@ -85,7 +85,7 @@ BLO_is_a_runtime( BLO_read_runtime( char *file) { -#ifndef NDEBUG +#if defined(DEBUG) fprintf(GEN_errorstream, "Error BLO_read_runtime is a stub\n"); #endif diff --git a/source/blender/render/CMakeLists.txt b/source/blender/render/CMakeLists.txt index 13e535f0a4e..5085a371688 100644 --- a/source/blender/render/CMakeLists.txt +++ b/source/blender/render/CMakeLists.txt @@ -24,6 +24,9 @@ # # ***** END GPL LICENSE BLOCK ***** +# remove warning until render branch merged. +STRING(REGEX REPLACE "-Wunused-parameter" "" CMAKE_C_FLAGS ${CMAKE_C_FLAGS}) + FILE(GLOB SRC intern/source/*.c intern/raytrace/*.cpp) SET(INC diff --git a/source/blender/render/intern/source/convertblender.c b/source/blender/render/intern/source/convertblender.c index e741c622380..e70287e522e 100644 --- a/source/blender/render/intern/source/convertblender.c +++ b/source/blender/render/intern/source/convertblender.c @@ -321,7 +321,7 @@ u | | F1 | F2 | /* ------------------------------------------------------------------------- */ -static void split_v_renderfaces(ObjectRen *obr, int startvlak, int startvert, int usize, int vsize, int uIndex, int cyclu, int cyclv) +static void split_v_renderfaces(ObjectRen *obr, int startvlak, int startvert, int usize, int vsize, int uIndex, int UNUSED(cyclu), int cyclv) { int vLen = vsize-1+(!!cyclv); int v; diff --git a/source/blender/render/intern/source/envmap.c b/source/blender/render/intern/source/envmap.c index 8977bc7f379..f7da13373d1 100644 --- a/source/blender/render/intern/source/envmap.c +++ b/source/blender/render/intern/source/envmap.c @@ -86,7 +86,7 @@ static void envmap_split_ima(EnvMap *env, ImBuf *ibuf) if (env->type == ENV_CUBE) { for(part=0; part<6; part++) { - env->cube[part]= IMB_allocImBuf(dx, dx, 24, IB_rect|IB_rectfloat, 0); + env->cube[part]= IMB_allocImBuf(dx, dx, 24, IB_rect|IB_rectfloat); } IMB_float_from_rect(ibuf); @@ -458,7 +458,7 @@ static void render_envmap(Render *re, EnvMap *env) int y; float *alpha; - ibuf= IMB_allocImBuf(envre->rectx, envre->recty, 24, IB_rect|IB_rectfloat, 0); + ibuf= IMB_allocImBuf(envre->rectx, envre->recty, 24, IB_rect|IB_rectfloat); memcpy(ibuf->rect_float, rl->rectf, ibuf->channels * ibuf->x * ibuf->y * sizeof(float)); if (re->scene->r.color_mgt_flag & R_COLOR_MANAGEMENT) diff --git a/source/blender/render/intern/source/imagetexture.c b/source/blender/render/intern/source/imagetexture.c index f78031c9030..9376c798c39 100644 --- a/source/blender/render/intern/source/imagetexture.c +++ b/source/blender/render/intern/source/imagetexture.c @@ -157,8 +157,8 @@ int imagewrap(Tex *tex, Image *ima, ImBuf *ibuf, float *texvec, TexResult *texre } } - x = (int)(fx*ibuf->x); - y = (int)(fy*ibuf->y); + x = (int)floorf(fx*ibuf->x); + y = (int)floorf(fy*ibuf->y); if(tex->extend == TEX_CLIPCUBE) { if(x<0 || y<0 || x>=ibuf->x || y>=ibuf->y || texvec[2]<-1.0 || texvec[2]>1.0) { @@ -500,7 +500,7 @@ static void boxsampleclip(struct ImBuf *ibuf, rctf *rf, TexResult *texres) } } -static void boxsample(ImBuf *ibuf, float minx, float miny, float maxx, float maxy, TexResult *texres, int imaprepeat, int imapextend, int intpol) +static void boxsample(ImBuf *ibuf, float minx, float miny, float maxx, float maxy, TexResult *texres, int imaprepeat, int imapextend) { /* Sample box, performs clip. minx etc are in range 0.0 - 1.0 . * Enlarge with antialiased edges of pixels. @@ -1606,11 +1606,11 @@ int imagewraposa(Tex *tex, Image *ima, ImBuf *ibuf, float *texvec, float *DXT, f //minx*= 1.35f; //miny*= 1.35f; - boxsample(curibuf, fx-minx, fy-miny, fx+minx, fy+miny, texres, imaprepeat, imapextend, 0); + boxsample(curibuf, fx-minx, fy-miny, fx+minx, fy+miny, texres, imaprepeat, imapextend); val1= texres->tr+texres->tg+texres->tb; - boxsample(curibuf, fx-minx+dxt[0], fy-miny+dxt[1], fx+minx+dxt[0], fy+miny+dxt[1], &texr, imaprepeat, imapextend, 0); + boxsample(curibuf, fx-minx+dxt[0], fy-miny+dxt[1], fx+minx+dxt[0], fy+miny+dxt[1], &texr, imaprepeat, imapextend); val2= texr.tr + texr.tg + texr.tb; - boxsample(curibuf, fx-minx+dyt[0], fy-miny+dyt[1], fx+minx+dyt[0], fy+miny+dyt[1], &texr, imaprepeat, imapextend, 0); + boxsample(curibuf, fx-minx+dyt[0], fy-miny+dyt[1], fx+minx+dyt[0], fy+miny+dyt[1], &texr, imaprepeat, imapextend); val3= texr.tr + texr.tg + texr.tb; /* don't switch x or y! */ @@ -1619,7 +1619,7 @@ int imagewraposa(Tex *tex, Image *ima, ImBuf *ibuf, float *texvec, float *DXT, f if(previbuf!=curibuf) { /* interpolate */ - boxsample(previbuf, fx-minx, fy-miny, fx+minx, fy+miny, &texr, imaprepeat, imapextend, 0); + boxsample(previbuf, fx-minx, fy-miny, fx+minx, fy+miny, &texr, imaprepeat, imapextend); /* calc rgb */ dx= 2.0f*(pixsize-maxd)/pixsize; @@ -1636,9 +1636,9 @@ int imagewraposa(Tex *tex, Image *ima, ImBuf *ibuf, float *texvec, float *DXT, f } val1= dy*val1+ dx*(texr.tr + texr.tg + texr.tb); - boxsample(previbuf, fx-minx+dxt[0], fy-miny+dxt[1], fx+minx+dxt[0], fy+miny+dxt[1], &texr, imaprepeat, imapextend, 0); + boxsample(previbuf, fx-minx+dxt[0], fy-miny+dxt[1], fx+minx+dxt[0], fy+miny+dxt[1], &texr, imaprepeat, imapextend); val2= dy*val2+ dx*(texr.tr + texr.tg + texr.tb); - boxsample(previbuf, fx-minx+dyt[0], fy-miny+dyt[1], fx+minx+dyt[0], fy+miny+dyt[1], &texr, imaprepeat, imapextend, 0); + boxsample(previbuf, fx-minx+dyt[0], fy-miny+dyt[1], fx+minx+dyt[0], fy+miny+dyt[1], &texr, imaprepeat, imapextend); val3= dy*val3+ dx*(texr.tr + texr.tg + texr.tb); texres->nor[0]= (val1-val2); /* vals have been interpolated above! */ @@ -1661,10 +1661,10 @@ int imagewraposa(Tex *tex, Image *ima, ImBuf *ibuf, float *texvec, float *DXT, f maxy= fy+miny; miny= fy-miny; - boxsample(curibuf, minx, miny, maxx, maxy, texres, imaprepeat, imapextend, 0); + boxsample(curibuf, minx, miny, maxx, maxy, texres, imaprepeat, imapextend); if(previbuf!=curibuf) { /* interpolate */ - boxsample(previbuf, minx, miny, maxx, maxy, &texr, imaprepeat, imapextend, 0); + boxsample(previbuf, minx, miny, maxx, maxy, &texr, imaprepeat, imapextend); fx= 2.0f*(pixsize-maxd)/pixsize; @@ -1690,11 +1690,11 @@ int imagewraposa(Tex *tex, Image *ima, ImBuf *ibuf, float *texvec, float *DXT, f } if(texres->nor && (tex->imaflag & TEX_NORMALMAP)==0) { - boxsample(ibuf, fx-minx, fy-miny, fx+minx, fy+miny, texres, imaprepeat, imapextend, 0); + boxsample(ibuf, fx-minx, fy-miny, fx+minx, fy+miny, texres, imaprepeat, imapextend); val1= texres->tr+texres->tg+texres->tb; - boxsample(ibuf, fx-minx+dxt[0], fy-miny+dxt[1], fx+minx+dxt[0], fy+miny+dxt[1], &texr, imaprepeat, imapextend, 0); + boxsample(ibuf, fx-minx+dxt[0], fy-miny+dxt[1], fx+minx+dxt[0], fy+miny+dxt[1], &texr, imaprepeat, imapextend); val2= texr.tr + texr.tg + texr.tb; - boxsample(ibuf, fx-minx+dyt[0], fy-miny+dyt[1], fx+minx+dyt[0], fy+miny+dyt[1], &texr, imaprepeat, imapextend, 0); + boxsample(ibuf, fx-minx+dyt[0], fy-miny+dyt[1], fx+minx+dyt[0], fy+miny+dyt[1], &texr, imaprepeat, imapextend); val3= texr.tr + texr.tg + texr.tb; /* don't switch x or y! */ @@ -1702,7 +1702,7 @@ int imagewraposa(Tex *tex, Image *ima, ImBuf *ibuf, float *texvec, float *DXT, f texres->nor[1]= (val1-val3); } else - boxsample(ibuf, fx-minx, fy-miny, fx+minx, fy+miny, texres, imaprepeat, imapextend, 0); + boxsample(ibuf, fx-minx, fy-miny, fx+minx, fy+miny, texres, imaprepeat, imapextend); } if(tex->imaflag & TEX_CALCALPHA) { @@ -1749,7 +1749,7 @@ void image_sample(Image *ima, float fx, float fy, float dx, float dy, float *res if( (R.flag & R_SEC_FIELD) && (ibuf->flags & IB_fields) ) ibuf->rect+= (ibuf->x*ibuf->y); - boxsample(ibuf, fx, fy, fx+dx, fy+dy, &texres, 0, 1, 0); + boxsample(ibuf, fx, fy, fx+dx, fy+dy, &texres, 0, 1); result[0]= texres.tr; result[1]= texres.tg; result[2]= texres.tb; diff --git a/source/blender/render/intern/source/pipeline.c b/source/blender/render/intern/source/pipeline.c index c068aaa59bd..1299b4f773b 100644 --- a/source/blender/render/intern/source/pipeline.c +++ b/source/blender/render/intern/source/pipeline.c @@ -126,20 +126,20 @@ Render R; static volatile int g_break= 0; -static int thread_break(void *unused) +static int thread_break(void *UNUSED(arg)) { return g_break; } /* default callbacks, set in each new render */ -static void result_nothing(void *unused, RenderResult *rr) {} -static void result_rcti_nothing(void *unused, RenderResult *rr, volatile struct rcti *rect) {} -static void stats_nothing(void *unused, RenderStats *rs) {} -static void float_nothing(void *unused, float val) {} -static void print_error(void *unused, char *str) {printf("ERROR: %s\n", str);} -static int default_break(void *unused) {return G.afbreek == 1;} +static void result_nothing(void *UNUSED(arg), RenderResult *UNUSED(rr)) {} +static void result_rcti_nothing(void *UNUSED(arg), RenderResult *UNUSED(rr), volatile struct rcti *UNUSED(rect)) {} +static void stats_nothing(void *UNUSED(arg), RenderStats *UNUSED(rs)) {} +static void float_nothing(void *UNUSED(arg), float UNUSED(val)) {} +static void print_error(void *UNUSED(arg), char *str) {printf("ERROR: %s\n", str);} +static int default_break(void *UNUSED(arg)) {return G.afbreek == 1;} -static void stats_background(void *unused, RenderStats *rs) +static void stats_background(void *UNUSED(arg), RenderStats *rs) { char str[400], *spos= str; uintptr_t mem_in_use, mmap_in_use, peak_memory; @@ -456,7 +456,7 @@ static void render_unique_exr_name(Render *re, char *str, int sample) { char di[FILE_MAX], name[FILE_MAXFILE+MAX_ID_NAME+100], fi[FILE_MAXFILE]; - BLI_strncpy(di, G.sce, FILE_MAX); + BLI_strncpy(di, G.main->name, FILE_MAX); BLI_splitdirstring(di, fi); if(sample==0) @@ -866,7 +866,7 @@ static void *ml_addlayer_cb(void *base, char *str) BLI_strncpy(rl->name, str, EXR_LAY_MAXNAME); return rl; } -static void ml_addpass_cb(void *base, void *lay, char *str, float *rect, int totchan, char *chan_id) +static void ml_addpass_cb(void *UNUSED(base), void *lay, char *str, float *rect, int totchan, char *chan_id) { RenderLayer *rl= lay; RenderPass *rpass= MEM_callocN(sizeof(RenderPass), "loaded pass"); @@ -1403,7 +1403,7 @@ void RE_error_cb(Render *re, void *handle, void (*f)(void *handle, char *str)) /* object is considered fully prepared on correct time etc */ /* includes lights */ -void RE_AddObject(Render *re, Object *ob) +void RE_AddObject(Render *UNUSED(re), Object *UNUSED(ob)) { } @@ -2043,7 +2043,7 @@ static void load_backbuffer(Render *re) char name[256]; strcpy(name, re->r.backbuf); - BLI_path_abs(name, G.sce); + BLI_path_abs(name, G.main->name); BLI_path_frame(name, re->r.cfra, 0); if(re->backbuf) { @@ -2052,7 +2052,7 @@ static void load_backbuffer(Render *re) BKE_image_signal(re->backbuf, NULL, IMA_SIGNAL_RELOAD); } - re->backbuf= BKE_add_image_file(name, re->r.cfra); + re->backbuf= BKE_add_image_file(name); ibuf= BKE_image_get_ibuf(re->backbuf, NULL); if(ibuf==NULL) { // error() doesnt work with render window open @@ -2237,7 +2237,7 @@ static int composite_needs_render(Scene *sce) } /* bad call... need to think over proper method still */ -static void render_composit_stats(void *unused, char *str) +static void render_composit_stats(void *UNUSED(arg), char *str) { R.i.infostr= str; R.stats_draw(R.sdh, &R.i); @@ -2753,7 +2753,7 @@ static int is_rendering_allowed(Render *re) return 1; } -static void update_physics_cache(Render *re, Scene *scene, int anim_init) +static void update_physics_cache(Render *re, Scene *scene, int UNUSED(anim_init)) { PTCacheBaker baker; @@ -2899,7 +2899,7 @@ static int do_write_image_or_movie(Render *re, Scene *scene, bMovieHandle *mh, R } } else { - ImBuf *ibuf= IMB_allocImBuf(rres.rectx, rres.recty, scene->r.planes, 0, 0); + ImBuf *ibuf= IMB_allocImBuf(rres.rectx, rres.recty, scene->r.planes, 0); /* if not exists, BKE_write_ibuf makes one */ ibuf->rect= (unsigned int *)rres.rect32; @@ -3256,7 +3256,7 @@ void RE_layer_load_from_file(RenderLayer *layer, ReportList *reports, char *file if(ibuf->rect_float==NULL) IMB_float_from_rect(ibuf); - ibuf_clip = IMB_allocImBuf(layer->rectx, layer->recty, 32, IB_rectfloat, 0); + 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); diff --git a/source/blender/render/intern/source/pointdensity.c b/source/blender/render/intern/source/pointdensity.c index 1ca1ea10273..d8156594085 100644 --- a/source/blender/render/intern/source/pointdensity.c +++ b/source/blender/render/intern/source/pointdensity.c @@ -253,7 +253,7 @@ static void cache_pointdensity(Render *re, Tex *tex) } } -static void free_pointdensity(Render *re, Tex *tex) +static void free_pointdensity(Render *UNUSED(re), Tex *tex) { PointDensity *pd = tex->pd; diff --git a/source/blender/render/intern/source/rayobject_instance.c b/source/blender/render/intern/source/rayobject_instance.c index 25765c4763a..a8098d2e8ef 100644 --- a/source/blender/render/intern/source/rayobject_instance.c +++ b/source/blender/render/intern/source/rayobject_instance.c @@ -41,7 +41,7 @@ static void RE_rayobject_instance_free(RayObject *o); static void RE_rayobject_instance_bb(RayObject *o, float *min, float *max); static float RE_rayobject_instance_cost(RayObject *o); -static void RE_rayobject_instance_hint_bb(RayObject *o, RayHint *hint, float *min, float *max) +static void RE_rayobject_instance_hint_bb(RayObject *UNUSED(o), RayHint *UNUSED(hint), float *UNUSED(min), float *UNUSED(max)) {} static RayObjectAPI instance_api = diff --git a/source/blender/render/intern/source/shadbuf.c b/source/blender/render/intern/source/shadbuf.c index 7101ce5daaf..e589bb3a840 100644 --- a/source/blender/render/intern/source/shadbuf.c +++ b/source/blender/render/intern/source/shadbuf.c @@ -820,7 +820,7 @@ static void *do_shadow_thread(void *re_v) } static volatile int g_break= 0; -static int thread_break(void *unused) +static int thread_break(void *UNUSED(arg)) { return g_break; } diff --git a/source/blender/render/intern/source/shadeoutput.c b/source/blender/render/intern/source/shadeoutput.c index 00eb6e3d17d..2676a2236dd 100644 --- a/source/blender/render/intern/source/shadeoutput.c +++ b/source/blender/render/intern/source/shadeoutput.c @@ -1141,6 +1141,11 @@ float lamp_get_visibility(LampRen *lar, float *co, float *lv, float *dist) visifac = lar->dist/(lar->dist + dist[0]); break; case LA_FALLOFF_INVSQUARE: + /* NOTE: This seems to be a hack since commit r12045 says this + * option is similar to old Quad, but with slight changes. + * Correct inv square would be (which would be old Quad): + * visifac = lar->distkw / (lar->distkw + dist[0]*dist[0]); + */ visifac = lar->dist / (lar->dist + dist[0]*dist[0]); break; case LA_FALLOFF_SLIDERS: diff --git a/source/blender/render/intern/source/sss.c b/source/blender/render/intern/source/sss.c index e8c95a34ac4..1e8709d09f7 100644 --- a/source/blender/render/intern/source/sss.c +++ b/source/blender/render/intern/source/sss.c @@ -466,7 +466,7 @@ static void compute_radiance(ScatterTree *tree, float *co, float *rad) /* building */ -static void sum_leaf_radiance(ScatterTree *tree, ScatterNode *node) +static void sum_leaf_radiance(ScatterTree *UNUSED(tree), ScatterNode *node) { ScatterPoint *p; float rad, totrad= 0.0f, inv; @@ -540,7 +540,7 @@ static void sum_leaf_radiance(ScatterTree *tree, ScatterNode *node) } } -static void sum_branch_radiance(ScatterTree *tree, ScatterNode *node) +static void sum_branch_radiance(ScatterTree *UNUSED(tree), ScatterNode *node) { ScatterNode *subnode; float rad, totrad= 0.0f, inv; diff --git a/source/blender/render/intern/source/texture.c b/source/blender/render/intern/source/texture.c index be2c83a7edf..cdac27f352a 100644 --- a/source/blender/render/intern/source/texture.c +++ b/source/blender/render/intern/source/texture.c @@ -771,7 +771,7 @@ static int plugintex(Tex *tex, float *texvec, float *dxt, float *dyt, int osatex if (pit->version < 6) { texres->tin = pit->result[0]; } else { - texres->tin = result[0]; + texres->tin = result[0]; /* XXX, assigning garbage value, fixme! */ } if(rgbnor & TEX_NOR) { diff --git a/source/blender/render/intern/source/volume_precache.c b/source/blender/render/intern/source/volume_precache.c index d3e8f4058c5..39e8315e7cf 100644 --- a/source/blender/render/intern/source/volume_precache.c +++ b/source/blender/render/intern/source/volume_precache.c @@ -89,7 +89,7 @@ int intersect_outside_volume(RayObject *tree, Isect *isect, float *offset, int l } /* Uses ray tracing to check if a point is inside or outside an ObjectInstanceRen */ -int point_inside_obi(RayObject *tree, ObjectInstanceRen *obi, float *co) +int point_inside_obi(RayObject *tree, ObjectInstanceRen *UNUSED(obi), float *co) { Isect isect; float vec[3] = {0.0f,0.0f,1.0f}; diff --git a/source/blender/render/intern/source/volumetric.c b/source/blender/render/intern/source/volumetric.c index d15ea0c792c..f3f31bf6b43 100644 --- a/source/blender/render/intern/source/volumetric.c +++ b/source/blender/render/intern/source/volumetric.c @@ -358,7 +358,7 @@ void vol_get_sigma_t(ShadeInput *shi, float *sigma_t, float *co) /* phase function - determines in which directions the light * is scattered in the volume relative to incoming direction * and view direction */ -float vol_get_phasefunc(ShadeInput *shi, float g, float *w, float *wp) +float vol_get_phasefunc(ShadeInput *UNUSED(shi), float g, float *w, float *wp) { const float normalize = 0.25f; // = 1.f/4.f = M_PI/(4.f*M_PI) diff --git a/source/blender/render/intern/source/voxeldata.c b/source/blender/render/intern/source/voxeldata.c index 076d6355585..0a2ea54c5b0 100644 --- a/source/blender/render/intern/source/voxeldata.c +++ b/source/blender/render/intern/source/voxeldata.c @@ -178,7 +178,7 @@ static int read_voxeldata_header(FILE *fp, struct VoxelData *vd) return 1; } -static void init_frame_smoke(VoxelData *vd, Tex *tex) +static void init_frame_smoke(VoxelData *vd) { Object *ob; ModifierData *md; @@ -282,7 +282,7 @@ static void cache_voxeldata(struct Render *re,Tex *tex) load_frame_image_sequence(vd, tex); return; case TEX_VD_SMOKE: - init_frame_smoke(vd, tex); + init_frame_smoke(vd); return; case TEX_VD_BLENDERVOXEL: if (!BLI_exists(vd->source_path)) return; diff --git a/source/blender/verify/BLO_sign_verify_Header.h b/source/blender/verify/BLO_sign_verify_Header.h deleted file mode 100644 index 9d73d9ba595..00000000000 --- a/source/blender/verify/BLO_sign_verify_Header.h +++ /dev/null @@ -1,80 +0,0 @@ -/** - * $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) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - * - */ - -#ifndef BLO_SIGN_VERIFY_H -#define BLO_SIGN_VERIFY_H - -#ifdef __cplusplus -extern "C" { -#endif - -#ifdef FREE_WINDOWS -typedef int int32_t; -#endif - -#include "BLO_sys_types.h" - -#define SIGNVERIFYHEADERSTRUCTSIZE sizeof(struct BLO_sign_verify_HeaderStruct) -/* TODO use reasonable sizes -Tests showed: pubKeyLen 64, cryptedKeyLen 64 bytes -So we pick 2*64 bytes + tail for now : */ - -#define MAXPUBKEYLEN 130 -#define MAXSIGNATURELEN 130 - -struct BLO_sign_verify_HeaderStruct { - uint8_t magic; /* poor mans header recognize check */ - uint32_t length; /* how much signed data is there */ - uint8_t pubKey[MAXPUBKEYLEN]; - uint32_t pubKeyLen; /* the actual pubKey length */ - uint8_t signature[MAXSIGNATURELEN]; - int32_t signatureLen; /* the actual signature length */ - uint32_t datacrc; /* data crc checksum */ - uint32_t headercrc; /* header minus crc itself checksum */ -}; - -#define SIGNERHEADERSTRUCTSIZE sizeof(struct BLO_SignerHeaderStruct) -#define MAXSIGNERLEN 100 - -struct BLO_SignerHeaderStruct { - uint8_t name[MAXSIGNERLEN]; /* the signers name (from the key) */ - uint8_t email[MAXSIGNERLEN]; /* the signers email (from the key) */ - uint8_t homeUrl[MAXSIGNERLEN]; /* the signers home page */ - uint8_t text[MAXSIGNERLEN]; /* optional additional user text */ - uint8_t pubKeyUrl1[MAXSIGNERLEN]; /* the signers pubKey store */ - uint8_t pubKeyUrl2[MAXSIGNERLEN]; /* the signers pubKey at NaN */ -}; - -#ifdef __cplusplus -} -#endif - -#endif /* BLO_SIGN_VERIFY_H */ - diff --git a/source/blender/verify/BLO_signer_info.h b/source/blender/verify/BLO_signer_info.h deleted file mode 100644 index 39059cf94a7..00000000000 --- a/source/blender/verify/BLO_signer_info.h +++ /dev/null @@ -1,45 +0,0 @@ -/** - * $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) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - * - */ - -#include "BLO_sign_verify_Header.h" - -/* external struct for signer info */ - -struct BLO_SignerInfo { - char name[MAXSIGNERLEN]; - char email[MAXSIGNERLEN]; - char homeUrl[MAXSIGNERLEN]; - /* more to come... */ -}; - -struct BLO_SignerInfo *BLO_getSignerInfo(void); -int BLO_isValidSignerInfo(struct BLO_SignerInfo *info); -void BLO_clrSignerInfo(struct BLO_SignerInfo *info); - diff --git a/source/blender/verify/BLO_verify.h b/source/blender/verify/BLO_verify.h deleted file mode 100644 index 5f7241c1cd5..00000000000 --- a/source/blender/verify/BLO_verify.h +++ /dev/null @@ -1,76 +0,0 @@ -/** - * $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) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ - -#ifndef BLO_VERIFY_H -#define BLO_VERIFY_H - -#ifdef __cplusplus -extern "C" { -#endif - -#define VERIFY_DECLARE_HANDLE(name) typedef struct name##__ { int unused; } *name - -VERIFY_DECLARE_HANDLE(BLO_verifyStructHandle); - -/** - * openssl verify initializer - * @retval pointer to verify control structure - */ - BLO_verifyStructHandle -BLO_verify_begin( - void *endControl); - -/** - * openssl verify dataprocessor wrapper - * @param BLO_verify Pointer to verify control structure - * @param data Pointer to new data - * @param dataIn New data amount - * @retval streamGlueRead return value - */ - int -BLO_verify_process( - BLO_verifyStructHandle BLO_verifyHandle, - unsigned char *data, - unsigned int dataIn); - -/** - * openssl verify final call and cleanup - * @param BLO_verify Pointer to verify control structure - * @retval streamGlueRead return value - */ - int -BLO_verify_end( - BLO_verifyStructHandle BLO_verifyHandle); - -#ifdef __cplusplus -} -#endif - -#endif /* BLO_VERIFY_H */ - diff --git a/source/blender/verify/Makefile b/source/blender/verify/Makefile deleted file mode 100644 index 4451d5baf22..00000000000 --- a/source/blender/verify/Makefile +++ /dev/null @@ -1,34 +0,0 @@ -# -# $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) 2001-2002 by NaN Holding BV. -# All rights reserved. -# -# The Original Code is: all of this file. -# -# Contributor(s): none yet. -# -# ***** END GPL LICENSE BLOCK ***** -# -# Bounces make to subdirectories. - -SOURCEDIR = source/blender/verify -DIRS = intern - -include nan_subdirs.mk diff --git a/source/blender/verify/intern/BLO_verify.c b/source/blender/verify/intern/BLO_verify.c deleted file mode 100644 index ccdc8a7e916..00000000000 --- a/source/blender/verify/intern/BLO_verify.c +++ /dev/null @@ -1,420 +0,0 @@ -/** - * $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) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - * openssl verify wrapper library - */ - -#include <stdio.h> -#include <stdlib.h> -#include <string.h> - -#include "openssl/rsa.h" -#include "openssl/ripemd.h" -#include "openssl/objects.h" -#include "zlib.h" - -#include "GEN_messaging.h" - -#include "BLO_readStreamGlue.h" -#include "BLO_verify.h" -#include "BLO_sign_verify_Header.h" /* used by verify and encrypt */ - -#include "BLO_signer_info.h" /* external signer info struct */ - -static struct BLO_SignerInfo g_SignerInfo = {"", "", ""}; - -struct verifyStructType { - struct readStreamGlueStruct *streamGlue; - unsigned int streamDone; - unsigned char headerbuffer[SIGNVERIFYHEADERSTRUCTSIZE]; - uint32_t datacrc; - struct BLO_sign_verify_HeaderStruct *streamHeader; - RIPEMD160_CTX ripemd160_ctx; - struct BLO_SignerHeaderStruct *signerHeader; - unsigned char signerHeaderBuffer[SIGNERHEADERSTRUCTSIZE]; - void *endControl; -}; - - BLO_verifyStructHandle -BLO_verify_begin( - void *endControl) -{ - struct verifyStructType *control; - control = malloc(sizeof(struct verifyStructType)); - if (!control) return NULL; - - control->streamGlue = NULL; - control->streamDone = 0; - memset(control->headerbuffer, 0, SIGNVERIFYHEADERSTRUCTSIZE); - control->datacrc = 0; - - control->streamHeader = malloc(SIGNVERIFYHEADERSTRUCTSIZE); - if (!control->streamHeader) { - free(control); - return NULL; - } - control->streamHeader->magic = 0; - control->streamHeader->length = 0; - strcpy(control->streamHeader->pubKey, ""); - control->streamHeader->pubKeyLen = 0; - strcpy(control->streamHeader->signature, ""); - control->streamHeader->signatureLen = 0; - control->streamHeader->datacrc = 0; - control->streamHeader->headercrc = 0; - - RIPEMD160_Init(&(control->ripemd160_ctx)); - - control->signerHeader = malloc(SIGNERHEADERSTRUCTSIZE); - if (!control->signerHeader) { - free(control->streamHeader); - free(control); - return NULL; - } - memset(control->signerHeader->name, 0, MAXSIGNERLEN); - memset(control->signerHeader->email, 0, MAXSIGNERLEN); - memset(control->signerHeader->homeUrl, 0, MAXSIGNERLEN); - memset(control->signerHeader->text, 0, MAXSIGNERLEN); - memset(control->signerHeader->pubKeyUrl1, 0, MAXSIGNERLEN); - memset(control->signerHeader->pubKeyUrl2, 0, MAXSIGNERLEN); - - control->endControl = endControl; - return((BLO_verifyStructHandle) control); -} - - int -BLO_verify_process( - BLO_verifyStructHandle BLO_verifyHandle, - unsigned char *data, - unsigned int dataIn) -{ - int err = 0; - struct verifyStructType *BLO_verify = - (struct verifyStructType *) BLO_verifyHandle; - - if (!BLO_verify) { - err = BRS_SETFUNCTION(BRS_VERIFY) | - BRS_SETGENERR(BRS_NULL); - return err; - } - - /* First check if we have our header filled in yet */ - if (BLO_verify->streamHeader->length == 0) { - unsigned int processed; - if (dataIn == 0) return err; /* really need data to do anything */ - processed = ((dataIn + BLO_verify->streamDone) <= - SIGNVERIFYHEADERSTRUCTSIZE) - ? dataIn : SIGNVERIFYHEADERSTRUCTSIZE; - memcpy(BLO_verify->headerbuffer + BLO_verify->streamDone, - data, processed); - BLO_verify->streamDone += processed; - dataIn -= processed; - data += processed; - if (BLO_verify->streamDone == SIGNVERIFYHEADERSTRUCTSIZE) { - /* we have the whole header, absorb it */ - struct BLO_sign_verify_HeaderStruct *header; - uint32_t crc; - - header = (struct BLO_sign_verify_HeaderStruct *) - BLO_verify->headerbuffer; - crc = crc32(0L, (const Bytef *) header, - SIGNVERIFYHEADERSTRUCTSIZE - 4); - - if (header->magic == 'A') { -#ifndef NDEBUG - fprintf(GEN_errorstream, - "BLO_sign_verify_HeaderStruct Magic confirmed\n"); -#endif - } else { -#ifndef NDEBUG - fprintf(GEN_errorstream, - "ERROR BLO_sign_verify_HeaderStruct Magic NOT confirmed\n"); -#endif - err = BRS_SETFUNCTION(BRS_VERIFY) | - BRS_SETGENERR(BRS_MAGIC); - if (BLO_verify->streamGlue) free(BLO_verify->streamGlue); - if (BLO_verify->streamHeader) free(BLO_verify->streamHeader); - if (BLO_verify->signerHeader) free(BLO_verify->signerHeader); - free(BLO_verify); - return err; - } - - if (crc == ntohl(header->headercrc)) { -#ifndef NDEBUG - fprintf(GEN_errorstream,"BLO_sign_verify_Header CRC correct\n"); -#endif - } else { -#ifndef NDEBUG - fprintf(GEN_errorstream,"ERROR BLO_sign_verify_Header CRC NOT correct\n"); -#endif - err = BRS_SETFUNCTION(BRS_VERIFY) | - BRS_SETGENERR(BRS_CRCHEADER); - if (BLO_verify->streamGlue) free(BLO_verify->streamGlue); - if (BLO_verify->streamHeader) free(BLO_verify->streamHeader); - if (BLO_verify->signerHeader) free(BLO_verify->signerHeader); - free(BLO_verify); - return err; - } - BLO_verify->streamHeader->length = ntohl(header->length); - BLO_verify->streamHeader->pubKeyLen = ntohl(header->pubKeyLen); - memcpy(BLO_verify->streamHeader->pubKey, header->pubKey, - BLO_verify->streamHeader->pubKeyLen); - BLO_verify->streamHeader->signatureLen = - ntohl(header->signatureLen); - memcpy(BLO_verify->streamHeader->signature, header->signature, - BLO_verify->streamHeader->signatureLen); - BLO_verify->streamHeader->datacrc = ntohl(header->datacrc); - -#ifndef NDEBUG - fprintf(GEN_errorstream, - "BLO_verify_process gets %u bytes\n", - (unsigned int) BLO_verify->streamHeader->length); -#endif - - } - } - - /* Is there really (still) new data available ? */ - if (dataIn > 0) { - /* BLO_SignerHeaderStruct */ - if (BLO_verify->signerHeader->name[0] == 0) { - /* we don't have our signerHeader complete yet */ - unsigned int processed; - processed = ((dataIn + BLO_verify->streamDone - - SIGNVERIFYHEADERSTRUCTSIZE) <= SIGNERHEADERSTRUCTSIZE) - ? dataIn : SIGNERHEADERSTRUCTSIZE; - memcpy(BLO_verify->signerHeaderBuffer + - BLO_verify->streamDone - SIGNVERIFYHEADERSTRUCTSIZE, - data, processed); - BLO_verify->streamDone += processed; - dataIn -= processed; - data += processed; - if (BLO_verify->streamDone == SIGNVERIFYHEADERSTRUCTSIZE + - SIGNERHEADERSTRUCTSIZE) { - /* we have the whole header, absorb it */ - struct BLO_SignerHeaderStruct *signerHeader; - signerHeader = (struct BLO_SignerHeaderStruct *) - BLO_verify->signerHeaderBuffer; - strncpy(BLO_verify->signerHeader->name, - signerHeader->name, MAXSIGNERLEN-1); - strncpy(BLO_verify->signerHeader->email, - signerHeader->email, MAXSIGNERLEN-1); - strncpy(BLO_verify->signerHeader->homeUrl, - signerHeader->homeUrl, MAXSIGNERLEN-1); - strncpy(BLO_verify->signerHeader->text, - signerHeader->text, MAXSIGNERLEN-1); - strncpy(BLO_verify->signerHeader->pubKeyUrl1, - signerHeader->pubKeyUrl1, MAXSIGNERLEN-1); - strncpy(BLO_verify->signerHeader->pubKeyUrl2, - signerHeader->pubKeyUrl2, MAXSIGNERLEN-1); - -#ifndef NDEBUG - fprintf(GEN_errorstream, - "name %s\nemail %s\nhomeUrl %s\ntext %s\n", - BLO_verify->signerHeader->name, - BLO_verify->signerHeader->email, - BLO_verify->signerHeader->homeUrl, - BLO_verify->signerHeader->text); - fprintf(GEN_errorstream, - "pubKeyUrl1 %s\npubKeyUrl2 %s\n", - BLO_verify->signerHeader->pubKeyUrl1, - BLO_verify->signerHeader->pubKeyUrl2); -#endif - /* also update the signature and crc checksum */ - RIPEMD160_Update(&(BLO_verify->ripemd160_ctx), - BLO_verify->signerHeaderBuffer, - SIGNERHEADERSTRUCTSIZE); - - /* update datacrc */ - BLO_verify->datacrc = crc32( - BLO_verify->datacrc, (const Bytef *) - BLO_verify->signerHeaderBuffer, - SIGNERHEADERSTRUCTSIZE); - } - } - } - - /* Is there really (still) new data available ? */ - if (dataIn > 0) { - RIPEMD160_Update(&(BLO_verify->ripemd160_ctx), data, dataIn); - - /* update datacrc */ - BLO_verify->datacrc = crc32( - BLO_verify->datacrc, (const Bytef *) data, dataIn); - - BLO_verify->streamDone += dataIn; - - /* give data to streamGlueRead, it will find out what to do next */ - err = readStreamGlue( - BLO_verify->endControl, - &(BLO_verify->streamGlue), - (unsigned char *) data, - dataIn); - } - return err; -} - -/** - * openssl verify final call and cleanup - * @param BLO_verify Pointer to verify control structure - * @retval streamGlueRead return value - */ - int -BLO_verify_end( - BLO_verifyStructHandle BLO_verifyHandle) -{ - int err = 0; - unsigned char *digest; - static unsigned char rsa_e[] = "\x01\x00\x01"; - RSA *rsa = NULL; - int verifySuccess; - struct verifyStructType *BLO_verify = - (struct verifyStructType *) BLO_verifyHandle; - - if (!BLO_verify) { - err = BRS_SETFUNCTION(BRS_VERIFY) | - BRS_SETGENERR(BRS_NULL); - return err; - } - - if (BLO_verify->streamDone == BLO_verify->streamHeader->length + - SIGNVERIFYHEADERSTRUCTSIZE) { -#ifndef NDEBUG - fprintf(GEN_errorstream, "Signed data length is correct\n"); -#endif - } else { -#ifndef NDEBUG - fprintf(GEN_errorstream, "Signed data length is NOT correct\n"); -#endif - err = BRS_SETFUNCTION(BRS_VERIFY) | - BRS_SETGENERR(BRS_DATALEN); - if (BLO_verify->streamGlue) free(BLO_verify->streamGlue); - if (BLO_verify->streamHeader) free(BLO_verify->streamHeader); - if (BLO_verify->signerHeader) free(BLO_verify->signerHeader); - free(BLO_verify); - return err; - } - - if (BLO_verify->datacrc == BLO_verify->streamHeader->datacrc) { -#ifndef NDEBUG - fprintf(GEN_errorstream, "Signed data CRC is correct\n"); -#endif - } else { -#ifndef NDEBUG - fprintf(GEN_errorstream, "Signed data CRC is NOT correct\n"); -#endif - err = BRS_SETFUNCTION(BRS_VERIFY) | - BRS_SETGENERR(BRS_CRCDATA); - if (BLO_verify->streamGlue) free(BLO_verify->streamGlue); - if (BLO_verify->streamHeader) free(BLO_verify->streamHeader); - if (BLO_verify->signerHeader) free(BLO_verify->signerHeader); - free(BLO_verify); - return err; - } - - digest = malloc(RIPEMD160_DIGEST_LENGTH); - if (!digest) { - err = BRS_SETFUNCTION(BRS_VERIFY) | - BRS_SETGENERR(BRS_MALLOC); - if (BLO_verify->streamGlue) free(BLO_verify->streamGlue); - if (BLO_verify->streamHeader) free(BLO_verify->streamHeader); - if (BLO_verify->signerHeader) free(BLO_verify->signerHeader); - free(BLO_verify); - return err; - } - - RIPEMD160_Final(digest, &(BLO_verify->ripemd160_ctx)); - - rsa = RSA_new(); - if (rsa == NULL) { -#ifndef NDEBUG - fprintf(GEN_errorstream, "Error in RSA_new\n"); -#endif - err = BRS_SETFUNCTION(BRS_VERIFY) | - BRS_SETSPECERR(BRS_RSANEWERROR); - free(digest); - if (BLO_verify->streamGlue) free(BLO_verify->streamGlue); - if (BLO_verify->streamHeader) free(BLO_verify->streamHeader); - if (BLO_verify->signerHeader) free(BLO_verify->signerHeader); - free(BLO_verify); - return err; - } - /* static exponent */ - rsa->e = BN_bin2bn(rsa_e, sizeof(rsa_e)-1, rsa->e); - - /* public part into rsa->n */ - rsa->n = BN_bin2bn(BLO_verify->streamHeader->pubKey, - BLO_verify->streamHeader->pubKeyLen, - rsa->n); - /*DEBUG RSA_print_fp(stdout, rsa, 0); */ - - /* verify the signature */ - verifySuccess = RSA_verify(NID_ripemd160, digest, RIPEMD160_DIGEST_LENGTH, - BLO_verify->streamHeader->signature, - BLO_verify->streamHeader->signatureLen, rsa); - if (verifySuccess == 1) { -#ifndef NDEBUG - fprintf(GEN_errorstream, - "Signature verified\n"); -#endif - } else { -#ifndef NDEBUG - fprintf(GEN_errorstream, - "Signature INCORRECT\n"); -#endif - err = BRS_SETFUNCTION(BRS_VERIFY) | - BRS_SETSPECERR(BRS_SIGFAILED); - } - -/* copy signer information to external struct */ - - strncpy(g_SignerInfo.name, BLO_verify->signerHeader->name, MAXSIGNERLEN-1); - strncpy(g_SignerInfo.email, BLO_verify->signerHeader->email, MAXSIGNERLEN-1); - strncpy(g_SignerInfo.homeUrl, BLO_verify->signerHeader->homeUrl, MAXSIGNERLEN-1); - - free(digest); - free(BLO_verify->streamGlue); - free(BLO_verify->streamHeader); - free(BLO_verify->signerHeader); - free(BLO_verify); - RSA_free(rsa); - - return err; -} - -struct BLO_SignerInfo *BLO_getSignerInfo(){ - return &g_SignerInfo; -} - -int BLO_isValidSignerInfo(struct BLO_SignerInfo *info){ - return info->name[0] != 0; -} - -void BLO_clrSignerInfo(struct BLO_SignerInfo *info) -{ - info->name[0] = 0; -} - diff --git a/source/blender/verify/intern/Makefile b/source/blender/verify/intern/Makefile deleted file mode 100644 index 009fd1c6e28..00000000000 --- a/source/blender/verify/intern/Makefile +++ /dev/null @@ -1,50 +0,0 @@ -# -# $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) 2001-2002 by NaN Holding BV. -# All rights reserved. -# -# The Original Code is: all of this file. -# -# Contributor(s): none yet. -# -# ***** END GPL LICENSE BLOCK ***** -# -# - -LIBNAME = verify -DIR = $(OCGDIR)/blender/$(LIBNAME) - -include nan_compile.mk - -CFLAGS += $(LEVEL_2_C_WARNINGS) - -# path to our own external headerfiles -CPPFLAGS += -I.. - -# external modules -CPPFLAGS += -I../../../kernel/gen_messaging -CPPFLAGS += -I../../readstreamglue - -CPPFLAGS += -I$(NAN_OPENSSL)/include - -ifeq ($(OS),$(findstring $(OS), "solaris windows")) - CPPFLAGS += -I$(NAN_ZLIB)/include -endif - diff --git a/source/blender/windowmanager/WM_api.h b/source/blender/windowmanager/WM_api.h index f103cbe2d4e..197f99b989e 100644 --- a/source/blender/windowmanager/WM_api.h +++ b/source/blender/windowmanager/WM_api.h @@ -107,7 +107,7 @@ wmKeyConfig *WM_keyconfig_new (struct wmWindowManager *wm, char *idname); wmKeyConfig *WM_keyconfig_new_user(struct wmWindowManager *wm, char *idname); void WM_keyconfig_remove (struct wmWindowManager *wm, struct wmKeyConfig *keyconf); void WM_keyconfig_free (struct wmKeyConfig *keyconf); -void WM_keyconfig_userdef(struct wmWindowManager *wm); +void WM_keyconfig_userdef(void); void WM_keymap_init (struct bContext *C); void WM_keymap_free (struct wmKeyMap *keymap); diff --git a/source/blender/windowmanager/WM_types.h b/source/blender/windowmanager/WM_types.h index 0447524255f..7af6de6c86c 100644 --- a/source/blender/windowmanager/WM_types.h +++ b/source/blender/windowmanager/WM_types.h @@ -191,6 +191,7 @@ typedef struct wmNotifier { #define ND_TOOLSETTINGS (15<<16) #define ND_LAYER (16<<16) #define ND_FRAME_RANGE (17<<16) +#define ND_WORLD (92<<16) #define ND_LAYER_CONTENT (101<<16) /* NC_OBJECT Object */ diff --git a/source/blender/windowmanager/intern/wm.c b/source/blender/windowmanager/intern/wm.c index 148932fa941..1b0870194a6 100644 --- a/source/blender/windowmanager/intern/wm.c +++ b/source/blender/windowmanager/intern/wm.c @@ -205,7 +205,7 @@ void WM_keymap_init(bContext *C) /* create default key config */ wm_window_keymap(wm->defaultconf); ED_spacetypes_keymap(wm->defaultconf); - WM_keyconfig_userdef(wm); + WM_keyconfig_userdef(); wm->initialized |= WM_INIT_KEYMAP; } diff --git a/source/blender/windowmanager/intern/wm_draw.c b/source/blender/windowmanager/intern/wm_draw.c index 81417e8f8f1..9123cdeef20 100644 --- a/source/blender/windowmanager/intern/wm_draw.c +++ b/source/blender/windowmanager/intern/wm_draw.c @@ -127,7 +127,7 @@ static void wm_method_draw_full(bContext *C, wmWindow *win) CTX_wm_region_set(C, ar); ED_region_do_draw(C, ar); wm_paintcursor_draw(C, ar); - ED_area_overdraw_flush(C, sa, ar); + ED_area_overdraw_flush(sa, ar); CTX_wm_region_set(C, NULL); } } @@ -242,7 +242,7 @@ static void wm_method_draw_overlap_all(bContext *C, wmWindow *win, int exchange) CTX_wm_region_set(C, ar); ED_region_do_draw(C, ar); wm_paintcursor_draw(C, ar); - ED_area_overdraw_flush(C, sa, ar); + ED_area_overdraw_flush(sa, ar); CTX_wm_region_set(C, NULL); if(exchange) @@ -253,7 +253,7 @@ static void wm_method_draw_overlap_all(bContext *C, wmWindow *win, int exchange) CTX_wm_region_set(C, ar); ED_region_do_draw(C, ar); wm_paintcursor_draw(C, ar); - ED_area_overdraw_flush(C, sa, ar); + ED_area_overdraw_flush(sa, ar); CTX_wm_region_set(C, NULL); ar->swap= WIN_BOTH_OK; @@ -592,7 +592,7 @@ static void wm_method_draw_triple(bContext *C, wmWindow *win) if(ar->swinid && ar->do_draw) { CTX_wm_region_set(C, ar); ED_region_do_draw(C, ar); - ED_area_overdraw_flush(C, sa, ar); + ED_area_overdraw_flush(sa, ar); CTX_wm_region_set(C, NULL); copytex= 1; } diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c index 334bc79b96a..47ca4314cc7 100644 --- a/source/blender/windowmanager/intern/wm_event_system.c +++ b/source/blender/windowmanager/intern/wm_event_system.c @@ -1452,11 +1452,24 @@ static int wm_handlers_do(bContext *C, wmEvent *event, ListBase *handlers) wmWindow *win = CTX_wm_window(C); if (win && win->eventstate->prevtype == event->type && win->eventstate->prevval == KM_PRESS) { - /* test for double click first */ - if ((PIL_check_seconds_timer() - win->eventstate->prevclicktime) * 1000 < U.dbl_click_time) { + /* test for double click first, + * note1: this can be problematic because single click operators can get the + * double click event but then with old mouse coords which is highly confusing, + * so check for mouse moves too. + * note2: the first click event will be handled but still used to create a + * double click event if clicking again quickly. + * If no double click events are found itwill fallback to a single click. + * So a double click event can result in 2 successive single click calls + * if its not handled by the keymap - campbell */ + if ( (ABS(event->x - win->eventstate->prevclickx)) <= 2 && + (ABS(event->y - win->eventstate->prevclicky)) <= 2 && + ((PIL_check_seconds_timer() - win->eventstate->prevclicktime) * 1000 < U.dbl_click_time) + ) { event->val = KM_DBL_CLICK; - event->x = win->eventstate->prevclickx; - event->y = win->eventstate->prevclicky; + /* removed this because in cases where we're this is used as a single click + * event, this will give old coords, since the distance is checked above, using new coords should be ok. */ + // event->x = win->eventstate->prevclickx; + // event->y = win->eventstate->prevclicky; action |= wm_handlers_do(C, event, handlers); } @@ -1894,7 +1907,7 @@ wmEventHandler *WM_event_add_keymap_handler(ListBase *handlers, wmKeyMap *keymap } /* priorities not implemented yet, for time being just insert in begin of list */ -wmEventHandler *WM_event_add_keymap_handler_priority(ListBase *handlers, wmKeyMap *keymap, int priority) +wmEventHandler *WM_event_add_keymap_handler_priority(ListBase *handlers, wmKeyMap *keymap, int UNUSED(priority)) { wmEventHandler *handler; @@ -2167,7 +2180,7 @@ static wmWindow *wm_event_cursor_other_windows(wmWindowManager *wm, wmWindow *wi /* windows store own event queues, no bContext here */ /* time is in 1000s of seconds, from ghost */ -void wm_event_add_ghostevent(wmWindowManager *wm, wmWindow *win, int type, int time, void *customdata) +void wm_event_add_ghostevent(wmWindowManager *wm, wmWindow *win, int type, int UNUSED(time), void *customdata) { wmWindow *owin; wmEvent event, *evt= win->eventstate; diff --git a/source/blender/windowmanager/intern/wm_files.c b/source/blender/windowmanager/intern/wm_files.c index 67decd6292e..00a686c0d74 100644 --- a/source/blender/windowmanager/intern/wm_files.c +++ b/source/blender/windowmanager/intern/wm_files.c @@ -259,8 +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]) strncpy(btempdir, U.tempdir, FILE_MAXDIR+FILE_MAXFILE); + if(U.tempdir[0]) BLI_where_is_temp(btempdir, 1); } void WM_read_file(bContext *C, char *name, ReportList *reports) @@ -284,7 +283,7 @@ void WM_read_file(bContext *C, char *name, ReportList *reports) /* also exit screens and editors */ wm_window_match_init(C, &wmbase); - retval= BKE_read_file(C, name, NULL, reports); + retval= BKE_read_file(C, name, reports); G.save_over = 1; /* this flag is initialized by the operator but overwritten on read. @@ -336,13 +335,10 @@ void WM_read_file(bContext *C, char *name, ReportList *reports) /* called on startup, (context entirely filled with NULLs) */ /* or called for 'New File' */ /* op can be NULL */ -/* note: G.sce is used to store the last saved path so backup and restore after loading - * G.main->name is similar to G.sce but when loading from memory set the name to startup.blend - * ...this could be changed but seems better then setting to "" */ int WM_read_homefile(bContext *C, wmOperator *op) { ListBase wmbase; - char tstr[FILE_MAXDIR+FILE_MAXFILE], scestr[FILE_MAXDIR]; + char tstr[FILE_MAXDIR+FILE_MAXFILE]; int from_memory= op && strcmp(op->type->idname, "WM_OT_read_factory_settings")==0; int success; @@ -352,7 +348,7 @@ int WM_read_homefile(bContext *C, wmOperator *op) if (!from_memory) { char *cfgdir = BLI_get_folder(BLENDER_USER_CONFIG, NULL); if (cfgdir) { - BLI_make_file_string(G.sce, tstr, cfgdir, BLENDER_STARTUP_FILE); + BLI_make_file_string(G.main->name, tstr, cfgdir, BLENDER_STARTUP_FILE); } else { tstr[0] = '\0'; from_memory = 1; @@ -361,7 +357,6 @@ int WM_read_homefile(bContext *C, wmOperator *op) } } } - strcpy(scestr, G.sce); /* temporary store */ /* prevent loading no UI */ G.fileflags &= ~G_FILE_NO_UI; @@ -370,9 +365,9 @@ int WM_read_homefile(bContext *C, wmOperator *op) wm_window_match_init(C, &wmbase); if (!from_memory && BLI_exists(tstr)) { - success = BKE_read_file(C, tstr, NULL, NULL); + success = BKE_read_file(C, tstr, NULL); } else { - success = BKE_read_file_from_memory(C, datatoc_startup_blend, datatoc_startup_blend_size, NULL, NULL); + success = BKE_read_file_from_memory(C, datatoc_startup_blend, datatoc_startup_blend_size, NULL); if (wmbase.first == NULL) wm_clear_default_size(C); } @@ -384,7 +379,6 @@ int WM_read_homefile(bContext *C, wmOperator *op) wm_window_match_do(C, &wmbase); WM_check(C); /* opens window(s), checks keymaps */ - strcpy(G.sce, scestr); /* restore */ G.main->name[0]= '\0'; wm_init_userdef(C); @@ -441,9 +435,6 @@ void read_history(void) for (l= lines, num= 0; l && (num<U.recent_files); l= l->next) { line = l->link; if (line[0] && BLI_exists(line)) { - if (num==0) - strcpy(G.sce, line); /* note: this seems highly dodgy since the file isnt actually read. please explain. - campbell */ - 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"); @@ -469,14 +460,14 @@ static void write_history(void) recent = G.recent_files.first; /* refresh recent-files.txt of recent opened files, when current file was changed */ - if(!(recent) || (strcmp(recent->filepath, G.sce)!=0)) { + if(!(recent) || (strcmp(recent->filepath, G.main->name)!=0)) { fp= fopen(name, "w"); if (fp) { /* add current file to the beginning of list */ recent = (RecentFile*)MEM_mallocN(sizeof(RecentFile),"RecentFile"); - recent->filepath = (char*)MEM_mallocN(sizeof(char)*(strlen(G.sce)+1), "name of file"); + recent->filepath = (char*)MEM_mallocN(sizeof(char)*(strlen(G.main->name)+1), "name of file"); recent->filepath[0] = '\0'; - strcpy(recent->filepath, G.sce); + strcpy(recent->filepath, G.main->name); BLI_addhead(&(G.recent_files), recent); /* write current file to recent-files.txt */ fprintf(fp, "%s\n", recent->filepath); @@ -485,7 +476,7 @@ static void write_history(void) /* write rest of recent opened files to recent-files.txt */ while((i<U.recent_files) && (recent)){ /* this prevents to have duplicities in list */ - if (strcmp(recent->filepath, G.sce)!=0) { + if (strcmp(recent->filepath, G.main->name)!=0) { fprintf(fp, "%s\n", recent->filepath); recent = recent->next; } @@ -527,7 +518,7 @@ static void do_history(char *name, ReportList *reports) BKE_report(reports, RPT_ERROR, "Unable to make version backup"); } -static ImBuf *blend_file_thumb(const char *path, Scene *scene, int **thumb_pt) +static ImBuf *blend_file_thumb(Scene *scene, int **thumb_pt) { /* will be scaled down, but gives some nice oversampling */ ImBuf *ibuf; @@ -573,7 +564,7 @@ static ImBuf *blend_file_thumb(const char *path, Scene *scene, int **thumb_pt) int write_crash_blend(void) { char path[FILE_MAX]; - BLI_strncpy(path, G.sce, sizeof(path)); + BLI_strncpy(path, G.main->name, sizeof(path)); BLI_replace_extension(path, sizeof(path), "_crash.blend"); if(BLO_write_file(G.main, path, G.fileflags, NULL, NULL)) { printf("written: %s\n", path); @@ -628,14 +619,13 @@ int WM_write_file(bContext *C, const char *target, int fileflags, ReportList *re ED_sculpt_force_update(C); /* blend file thumbnail */ - ibuf_thumb= blend_file_thumb(di, CTX_data_scene(C), &thumb); + ibuf_thumb= blend_file_thumb(CTX_data_scene(C), &thumb); /* rename to .blend1, do this as last before write */ do_history(di, reports); if (BLO_write_file(CTX_data_main(C), di, fileflags, reports, thumb)) { if(!copy) { - strcpy(G.sce, di); G.relbase_valid = 1; strcpy(G.main->name, di); /* is guaranteed current file */ @@ -736,7 +726,7 @@ void WM_autosave_init(wmWindowManager *wm) wm->autosavetimer= WM_event_add_timer(wm, NULL, TIMERAUTOSAVE, U.savetime*60.0); } -void wm_autosave_timer(const bContext *C, wmWindowManager *wm, wmTimer *wt) +void wm_autosave_timer(const bContext *C, wmWindowManager *wm, wmTimer *UNUSED(wt)) { wmWindow *win; wmEventHandler *handler; diff --git a/source/blender/windowmanager/intern/wm_gesture.c b/source/blender/windowmanager/intern/wm_gesture.c index e87d2d79c39..8dcf65886e4 100644 --- a/source/blender/windowmanager/intern/wm_gesture.c +++ b/source/blender/windowmanager/intern/wm_gesture.c @@ -121,7 +121,7 @@ void WM_gestures_remove(bContext *C) /* tweak and line gestures */ #define TWEAK_THRESHOLD 10 -int wm_gesture_evaluate(bContext *C, wmGesture *gesture) +int wm_gesture_evaluate(wmGesture *gesture) { if(gesture->type==WM_GESTURE_TWEAK) { rcti *rect= gesture->customdata; @@ -159,7 +159,7 @@ int wm_gesture_evaluate(bContext *C, wmGesture *gesture) /* ******************* gesture draw ******************* */ -static void wm_gesture_draw_rect(wmWindow *win, wmGesture *gt) +static void wm_gesture_draw_rect(wmGesture *gt) { rcti *rect= (rcti *)gt->customdata; @@ -183,7 +183,7 @@ static void wm_gesture_draw_rect(wmWindow *win, wmGesture *gt) glDisable(GL_LINE_STIPPLE); } -static void wm_gesture_draw_line(wmWindow *win, wmGesture *gt) +static void wm_gesture_draw_line(wmGesture *gt) { rcti *rect= (rcti *)gt->customdata; @@ -199,7 +199,7 @@ static void wm_gesture_draw_line(wmWindow *win, wmGesture *gt) } -static void wm_gesture_draw_circle(wmWindow *win, wmGesture *gt) +static void wm_gesture_draw_circle(wmGesture *gt) { rcti *rect= (rcti *)gt->customdata; @@ -244,7 +244,7 @@ static void draw_filled_lasso(wmGesture *gt) /* highly unlikely this will fail, but could crash if (gt->points == 0) */ if(firstv) { BLI_addfilledge(firstv, v); - BLI_edgefill(0, 0); + BLI_edgefill(0); glEnable(GL_BLEND); glColor4f(1.0, 1.0, 1.0, 0.05); @@ -261,7 +261,7 @@ static void draw_filled_lasso(wmGesture *gt) } } -static void wm_gesture_draw_lasso(wmWindow *win, wmGesture *gt) +static void wm_gesture_draw_lasso(wmGesture *gt) { short *lasso= (short *)gt->customdata; int i; @@ -320,23 +320,23 @@ void wm_gesture_draw(wmWindow *win) wmSubWindowSet(win, gt->swinid); if(gt->type==WM_GESTURE_RECT) - wm_gesture_draw_rect(win, gt); + wm_gesture_draw_rect(gt); else if(gt->type==WM_GESTURE_TWEAK) - wm_gesture_draw_line(win, gt); + wm_gesture_draw_line(gt); else if(gt->type==WM_GESTURE_CIRCLE) - wm_gesture_draw_circle(win, gt); + wm_gesture_draw_circle(gt); else if(gt->type==WM_GESTURE_CROSS_RECT) { if(gt->mode==1) - wm_gesture_draw_rect(win, gt); + wm_gesture_draw_rect(gt); else wm_gesture_draw_cross(win, gt); } else if(gt->type==WM_GESTURE_LINES) - wm_gesture_draw_lasso(win, gt); + wm_gesture_draw_lasso(gt); else if(gt->type==WM_GESTURE_LASSO) - wm_gesture_draw_lasso(win, gt); + wm_gesture_draw_lasso(gt); else if(gt->type==WM_GESTURE_STRAIGHTLINE) - wm_gesture_draw_line(win, gt); + wm_gesture_draw_line(gt); } } @@ -351,5 +351,3 @@ void wm_gesture_tag_redraw(bContext *C) wm_tag_redraw_overlay(win, ar); } - - diff --git a/source/blender/windowmanager/intern/wm_init_exit.c b/source/blender/windowmanager/intern/wm_init_exit.c index 983361f01ff..b319058ce5c 100644 --- a/source/blender/windowmanager/intern/wm_init_exit.c +++ b/source/blender/windowmanager/intern/wm_init_exit.c @@ -167,10 +167,10 @@ void WM_init(bContext *C, int argc, char **argv) read_history(); - if(G.sce[0] == 0) - BLI_make_file_string("/", G.sce, BLI_getDefaultDocumentFolder(), "untitled.blend"); + if(G.main->name[0] == 0) + BLI_make_file_string("/", G.main->name, BLI_getDefaultDocumentFolder(), "untitled.blend"); - BLI_strncpy(G.lib, G.sce, FILE_MAX); + BLI_strncpy(G.lib, G.main->name, FILE_MAX); } diff --git a/source/blender/windowmanager/intern/wm_keymap.c b/source/blender/windowmanager/intern/wm_keymap.c index f1873b14232..436494be975 100644 --- a/source/blender/windowmanager/intern/wm_keymap.c +++ b/source/blender/windowmanager/intern/wm_keymap.c @@ -118,7 +118,7 @@ void WM_keyconfig_free(wmKeyConfig *keyconf) MEM_freeN(keyconf); } -void WM_keyconfig_userdef(wmWindowManager *wm) +void WM_keyconfig_userdef(void) { wmKeyMap *km; wmKeyMapItem *kmi; @@ -419,7 +419,7 @@ char *WM_keymap_item_to_string(wmKeyMapItem *kmi, char *str, int len) return str; } -static wmKeyMapItem *wm_keymap_item_find_handlers(const bContext *C, ListBase *handlers, const char *opname, int opcontext, IDProperty *properties, int compare_props, int hotkey, wmKeyMap **keymap_r) +static wmKeyMapItem *wm_keymap_item_find_handlers(const bContext *C, ListBase *handlers, const char *opname, int UNUSED(opcontext), IDProperty *properties, int compare_props, int hotkey, wmKeyMap **keymap_r) { wmWindowManager *wm= CTX_wm_manager(C); wmEventHandler *handler; diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c index f0962584801..de08c209d06 100644 --- a/source/blender/windowmanager/intern/wm_operators.c +++ b/source/blender/windowmanager/intern/wm_operators.c @@ -619,7 +619,7 @@ void WM_operator_properties_free(PointerRNA *ptr) /* ************ default op callbacks, exported *********** */ /* invoke callback, uses enum property named "type" */ -int WM_menu_invoke(bContext *C, wmOperator *op, wmEvent *event) +int WM_menu_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { PropertyRNA *prop= op->type->prop; uiPopupMenu *pup; @@ -724,7 +724,7 @@ static uiBlock *wm_enum_search_menu(bContext *C, ARegion *ar, void *arg_op) } -int WM_enum_search_invoke(bContext *C, wmOperator *op, wmEvent *event) +int WM_enum_search_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { uiPupBlock(C, wm_enum_search_menu, op); return OPERATOR_CANCELLED; @@ -751,13 +751,13 @@ int WM_operator_confirm_message(bContext *C, wmOperator *op, char *message) } -int WM_operator_confirm(bContext *C, wmOperator *op, wmEvent *event) +int WM_operator_confirm(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { return WM_operator_confirm_message(C, op, NULL); } /* op->invoke, opens fileselect if path property not set, otherwise executes */ -int WM_operator_filesel(bContext *C, wmOperator *op, wmEvent *event) +int WM_operator_filesel(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { if (RNA_property_is_set(op->ptr, "filepath")) { return WM_operator_call(C, op); @@ -862,7 +862,7 @@ int WM_operator_winactive(bContext *C) } /* op->invoke */ -static void redo_cb(bContext *C, void *arg_op, int event) +static void redo_cb(bContext *C, void *arg_op, int UNUSED(event)) { wmOperator *lastop= arg_op; @@ -903,7 +903,7 @@ static uiBlock *wm_block_create_redo(bContext *C, ARegion *ar, void *arg_op) op->layout= NULL; } else - uiDefAutoButsRNA(C, layout, &ptr, columns); + uiDefAutoButsRNA(layout, &ptr, columns); uiPopupBoundsBlock(block, 4.0f, 0, 0); uiEndBlock(C, block); @@ -922,7 +922,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 *dummy2) +void dialog_check_cb(bContext *C, void *op_ptr, void *UNUSED(arg)) { wmOperator *op= op_ptr; if(op->type->check) { @@ -966,7 +966,7 @@ static uiBlock *wm_block_create_dialog(bContext *C, ARegion *ar, void *userData) op->layout= NULL; } else - uiDefAutoButsRNA(C, layout, &ptr, columns); + uiDefAutoButsRNA(layout, &ptr, columns); uiBlockSetFunc(block, NULL, NULL, NULL); @@ -1014,7 +1014,7 @@ static uiBlock *wm_operator_create_ui(bContext *C, ARegion *ar, void *userData) return block; } -int WM_operator_props_popup(bContext *C, wmOperator *op, wmEvent *event) +int WM_operator_props_popup(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { int retval= OPERATOR_CANCELLED; @@ -1083,7 +1083,7 @@ static uiBlock *wm_block_create_menu(bContext *C, ARegion *ar, void *arg_op) op->layout= NULL; } else - uiDefAutoButsRNA(C, layout, op->ptr, 2); + uiDefAutoButsRNA(layout, op->ptr, 2); uiPopupBoundsBlock(block, 4.0f, 0, 0); uiEndBlock(C, block); @@ -1100,7 +1100,7 @@ static int wm_debug_menu_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -static int wm_debug_menu_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int wm_debug_menu_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { RNA_int_set(op->ptr, "debugval", G.rt); @@ -1127,7 +1127,7 @@ static void WM_OT_debug_menu(wmOperatorType *ot) /* ***************** Splash Screen ************************* */ -static void wm_block_splash_close(bContext *C, void *arg_block, void *arg_unused) +static void wm_block_splash_close(bContext *C, void *arg_block, void *UNUSED(arg)) { uiPupBlockClose(C, arg_block); } @@ -1136,7 +1136,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 *C, void *arg_block, void *unused) +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 @@ -1145,7 +1145,7 @@ void wm_block_splash_refreshmenu (bContext *C, void *arg_block, void *unused) */ } -static uiBlock *wm_block_create_splash(bContext *C, ARegion *ar, void *arg_unused) +static uiBlock *wm_block_create_splash(bContext *C, ARegion *ar, void *UNUSED(arg)) { uiBlock *block; uiBut *but; @@ -1231,7 +1231,7 @@ static uiBlock *wm_block_create_splash(bContext *C, ARegion *ar, void *arg_unuse return block; } -static int wm_splash_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int wm_splash_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent *UNUSED(event)) { uiPupBlock(C, wm_block_create_splash, NULL); @@ -1250,7 +1250,7 @@ static void WM_OT_splash(wmOperatorType *ot) /* ***************** Search menu ************************* */ -static void operator_call_cb(struct bContext *C, void *arg1, void *arg2) +static void operator_call_cb(struct bContext *C, void *UNUSED(arg1), void *arg2) { wmOperatorType *ot= arg2; @@ -1258,7 +1258,7 @@ static void operator_call_cb(struct bContext *C, void *arg1, void *arg2) WM_operator_name_call(C, ot->idname, WM_OP_INVOKE_DEFAULT, NULL); } -static void operator_search_cb(const struct bContext *C, void *arg, char *str, uiSearchItems *items) +static void operator_search_cb(const struct bContext *C, void *UNUSED(arg), char *str, uiSearchItems *items) { wmOperatorType *ot = WM_operatortype_first(); @@ -1285,7 +1285,7 @@ static void operator_search_cb(const struct bContext *C, void *arg, char *str, u } } -static uiBlock *wm_block_search_menu(bContext *C, ARegion *ar, void *arg_op) +static uiBlock *wm_block_search_menu(bContext *C, ARegion *ar, void *UNUSED(arg_op)) { static char search[256]= ""; wmEvent event; @@ -1315,15 +1315,13 @@ static uiBlock *wm_block_search_menu(bContext *C, ARegion *ar, void *arg_op) return block; } -static int wm_search_menu_exec(bContext *C, wmOperator *op) +static int wm_search_menu_exec(bContext *UNUSED(C), wmOperator *UNUSED(op)) { - return OPERATOR_FINISHED; } -static int wm_search_menu_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int wm_search_menu_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { - uiPupBlock(C, wm_block_search_menu, op); return OPERATOR_CANCELLED; @@ -1389,7 +1387,7 @@ static void WM_OT_window_duplicate(wmOperatorType *ot) ot->idname= "WM_OT_window_duplicate"; ot->description="Duplicate the current Blender window"; - ot->exec= wm_window_duplicate_op; + ot->exec= wm_window_duplicate_exec; ot->poll= wm_operator_winactive_normal; } @@ -1440,9 +1438,9 @@ static void open_set_use_scripts(wmOperator *op) RNA_boolean_set(op->ptr, "use_scripts", !(U.flag & USER_SCRIPT_AUTOEXEC_DISABLE)); } -static int wm_open_mainfile_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int wm_open_mainfile_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { - RNA_string_set(op->ptr, "filepath", G.sce); + RNA_string_set(op->ptr, "filepath", G.main->name); open_set_load_ui(op); open_set_use_scripts(op); @@ -1496,7 +1494,7 @@ static void WM_OT_open_mainfile(wmOperatorType *ot) /* **************** link/append *************** */ -static int wm_link_append_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int wm_link_append_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { if(!RNA_property_is_set(op->ptr, "relative_path")) RNA_boolean_set(op->ptr, "relative_path", U.flag & USER_RELPATHS); @@ -1721,7 +1719,7 @@ static int wm_recover_auto_save_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -static int wm_recover_auto_save_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int wm_recover_auto_save_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { char filename[FILE_MAX]; @@ -1769,13 +1767,13 @@ static void save_set_compress(wmOperator *op) } } -static int wm_save_as_mainfile_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int wm_save_as_mainfile_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { char name[FILE_MAX]; save_set_compress(op); - BLI_strncpy(name, G.sce, FILE_MAX); + BLI_strncpy(name, G.main->name, FILE_MAX); untitled(name); RNA_string_set(op->ptr, "filepath", name); @@ -1796,7 +1794,7 @@ static int wm_save_as_mainfile_exec(bContext *C, wmOperator *op) if(RNA_property_is_set(op->ptr, "filepath")) RNA_string_get(op->ptr, "filepath", path); else { - BLI_strncpy(path, G.sce, FILE_MAX); + BLI_strncpy(path, G.main->name, FILE_MAX); untitled(path); } @@ -1820,7 +1818,7 @@ static int wm_save_as_mainfile_exec(bContext *C, wmOperator *op) } /* function used for WM_OT_save_mainfile too */ -static int blend_save_check(bContext *C, wmOperator *op) +static int blend_save_check(bContext *UNUSED(C), wmOperator *op) { char filepath[FILE_MAX]; RNA_string_get(op->ptr, "filepath", filepath); @@ -1850,7 +1848,7 @@ static void WM_OT_save_as_mainfile(wmOperatorType *ot) /* *************** save file directly ******** */ -static int wm_save_mainfile_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int wm_save_mainfile_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { char name[FILE_MAX]; int check_existing=1; @@ -1861,7 +1859,7 @@ static int wm_save_mainfile_invoke(bContext *C, wmOperator *op, wmEvent *event) save_set_compress(op); - BLI_strncpy(name, G.sce, FILE_MAX); + BLI_strncpy(name, G.main->name, FILE_MAX); untitled(name); RNA_string_set(op->ptr, "filepath", name); @@ -1907,7 +1905,7 @@ static int wm_collada_export_invoke(bContext *C, wmOperator *op, wmEvent *event) { if(!RNA_property_is_set(op->ptr, "filepath")) { char filepath[FILE_MAX]; - BLI_strncpy(filepath, G.sce, sizeof(filepath)); + BLI_strncpy(filepath, G.main->name, sizeof(filepath)); BLI_replace_extension(filepath, sizeof(filepath), ".dae"); RNA_string_set(op->ptr, "filepath", filepath); } @@ -1985,7 +1983,7 @@ static void WM_OT_window_fullscreen_toggle(wmOperatorType *ot) ot->idname= "WM_OT_window_fullscreen_toggle"; ot->description="Toggle the current window fullscreen"; - ot->exec= wm_window_fullscreen_toggle_op; + ot->exec= wm_window_fullscreen_toggle_exec; ot->poll= WM_operator_winactive; } @@ -1998,10 +1996,10 @@ static int wm_exit_blender_op(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -static void WM_OT_exit_blender(wmOperatorType *ot) +static void WM_OT_quit_blender(wmOperatorType *ot) { - ot->name= "Exit Blender"; - ot->idname= "WM_OT_exit_blender"; + ot->name= "Quit Blender"; + ot->idname= "WM_OT_quit_blender"; ot->description= "Quit Blender"; ot->invoke= WM_operator_confirm; @@ -2301,7 +2299,7 @@ static void tweak_gesture_modal(bContext *C, wmEvent *event) rect->xmax= event->x - sx; rect->ymax= event->y - sy; - if((val= wm_gesture_evaluate(C, gesture))) { + if((val= wm_gesture_evaluate(gesture))) { wmEvent event; event= *(window->eventstate); @@ -2394,7 +2392,7 @@ int WM_gesture_lines_invoke(bContext *C, wmOperator *op, wmEvent *event) } -static void gesture_lasso_apply(bContext *C, wmOperator *op, int event_type) +static void gesture_lasso_apply(bContext *C, wmOperator *op) { wmGesture *gesture= op->customdata; PointerRNA itemptr; @@ -2463,7 +2461,7 @@ int WM_gesture_lasso_modal(bContext *C, wmOperator *op, wmEvent *event) case MIDDLEMOUSE: case RIGHTMOUSE: if(event->val==KM_RELEASE) { /* key release */ - gesture_lasso_apply(C, op, event->type); + gesture_lasso_apply(C, op); return OPERATOR_FINISHED; } break; @@ -2856,11 +2854,11 @@ void WM_radial_control_string(wmOperator *op, char str[], int maxlen) float v = RNA_float_get(op->ptr, "new_value"); if(mode == WM_RADIALCONTROL_SIZE) - sprintf(str, "Size: %d", (int)v); + BLI_snprintf(str, maxlen, "Size: %d", (int)v); else if(mode == WM_RADIALCONTROL_STRENGTH) - sprintf(str, "Strength: %d", (int)v); + BLI_snprintf(str, maxlen, "Strength: %d", (int)v); else if(mode == WM_RADIALCONTROL_ANGLE) - sprintf(str, "Angle: %d", (int)(v * 180.0f/M_PI)); + BLI_snprintf(str, maxlen, "Angle: %d", (int)(v * 180.0f/M_PI)); } /** Important: this doesn't define an actual operator, it @@ -3027,7 +3025,7 @@ static void WM_OT_redraw_timer(wmOperatorType *ot) /* ************************** memory statistics for testing ***************** */ -static int memory_statistics_exec(bContext *C, wmOperator *op) +static int memory_statistics_exec(bContext *UNUSED(C), wmOperator *UNUSED(op)) { MEM_printmemlist_stats(); return OPERATOR_FINISHED; @@ -3068,7 +3066,7 @@ void wm_operatortype_init(void) WM_operatortype_append(WM_OT_read_factory_settings); WM_operatortype_append(WM_OT_save_homefile); WM_operatortype_append(WM_OT_window_fullscreen_toggle); - WM_operatortype_append(WM_OT_exit_blender); + WM_operatortype_append(WM_OT_quit_blender); WM_operatortype_append(WM_OT_open_mainfile); WM_operatortype_append(WM_OT_link_append); WM_operatortype_append(WM_OT_recover_last_session); @@ -3270,7 +3268,7 @@ void wm_window_keymap(wmKeyConfig *keyconf) WM_keymap_add_item(keymap, "WM_OT_open_mainfile", OKEY, KM_PRESS, KM_OSKEY, 0); WM_keymap_add_item(keymap, "WM_OT_save_mainfile", SKEY, KM_PRESS, KM_OSKEY, 0); WM_keymap_add_item(keymap, "WM_OT_save_as_mainfile", SKEY, KM_PRESS, KM_SHIFT|KM_OSKEY, 0); - WM_keymap_add_item(keymap, "WM_OT_exit_blender", QKEY, KM_PRESS, KM_OSKEY, 0); + WM_keymap_add_item(keymap, "WM_OT_quit_blender", QKEY, KM_PRESS, KM_OSKEY, 0); #endif WM_keymap_add_item(keymap, "WM_OT_read_homefile", NKEY, KM_PRESS, KM_CTRL, 0); WM_keymap_add_item(keymap, "WM_OT_save_homefile", UKEY, KM_PRESS, KM_CTRL, 0); @@ -3290,7 +3288,7 @@ void wm_window_keymap(wmKeyConfig *keyconf) RNA_boolean_set(kmi->ptr, "copy", 1); WM_keymap_verify_item(keymap, "WM_OT_window_fullscreen_toggle", F11KEY, KM_PRESS, KM_ALT, 0); - WM_keymap_add_item(keymap, "WM_OT_exit_blender", QKEY, KM_PRESS, KM_CTRL, 0); + WM_keymap_add_item(keymap, "WM_OT_quit_blender", QKEY, KM_PRESS, KM_CTRL, 0); /* debug/testing */ WM_keymap_verify_item(keymap, "WM_OT_redraw_timer", TKEY, KM_PRESS, KM_ALT|KM_CTRL, 0); @@ -3351,7 +3349,7 @@ void wm_window_keymap(wmKeyConfig *keyconf) } /* Generic itemf's for operators that take library args */ -static EnumPropertyItem *rna_id_itemf(bContext *C, PointerRNA *ptr, int *free, ID *id, int local) +static EnumPropertyItem *rna_id_itemf(bContext *UNUSED(C), PointerRNA *UNUSED(ptr), int *free, ID *id, int local) { EnumPropertyItem *item= NULL, item_tmp; int totitem= 0; diff --git a/source/blender/windowmanager/intern/wm_subwindow.c b/source/blender/windowmanager/intern/wm_subwindow.c index 207b6cebfe6..271b32359f5 100644 --- a/source/blender/windowmanager/intern/wm_subwindow.c +++ b/source/blender/windowmanager/intern/wm_subwindow.c @@ -40,6 +40,7 @@ #include "BLI_blenlib.h" #include "BLI_math.h" +#include "BKE_utildefines.h" #include "BKE_context.h" #include "BKE_global.h" @@ -73,7 +74,7 @@ typedef struct wmSubWindow { /* ******************* open, free, set, get data ******************** */ /* not subwindow itself */ -static void wm_subwindow_free(wmSubWindow *swin) +static void wm_subwindow_free(wmSubWindow *UNUSED(swin)) { /* future fancy stuff */ } diff --git a/source/blender/windowmanager/intern/wm_window.c b/source/blender/windowmanager/intern/wm_window.c index d9d7abd3a68..69a29092058 100644 --- a/source/blender/windowmanager/intern/wm_window.c +++ b/source/blender/windowmanager/intern/wm_window.c @@ -45,6 +45,7 @@ #include "BKE_blender.h" #include "BKE_context.h" #include "BKE_global.h" +#include "BKE_main.h" #include "BKE_utildefines.h" #include "BIF_gl.h" @@ -68,6 +69,7 @@ GHOST_SystemHandle g_system= NULL; /* set by commandline */ static int prefsizx= 0, prefsizy= 0, prefstax= 0, prefstay= 0, initialstate= GHOST_kWindowStateNormal; +static unsigned short useprefsize= 0; /* ******** win open & close ************ */ @@ -259,17 +261,15 @@ void wm_window_title(wmWindowManager *wm, wmWindow *win) else { /* this is set to 1 if you don't have startup.blend open */ - if(G.save_over) { - char *str= MEM_mallocN(strlen(G.sce) + 16, "title"); + if(G.save_over && G.main->name[0]) { + char str[sizeof(G.main->name) + 12]; if(wm->file_saved) - sprintf(str, "Blender [%s]", G.sce); + sprintf(str, "Blender [%s]", G.main->name); else - sprintf(str, "Blender* [%s]", G.sce); + sprintf(str, "Blender* [%s]", G.main->name); GHOST_SetTitle(win->ghostwin, str); - - MEM_freeN(str); } else GHOST_SetTitle(win->ghostwin, "Blender"); @@ -289,7 +289,7 @@ void wm_window_title(wmWindowManager *wm, wmWindow *win) } /* belongs to below */ -static void wm_window_add_ghostwindow(bContext *C, wmWindowManager *wm, char *title, wmWindow *win) +static void wm_window_add_ghostwindow(bContext *C, char *title, wmWindow *win) { GHOST_WindowHandle ghostwin; int scr_w, scr_h, posy; @@ -352,7 +352,10 @@ void wm_window_add_ghostwindows(bContext* C, wmWindowManager *wm) wmKeyMap *keymap; wmWindow *win; - /* no commandline prefsize? then we set this */ + /* no commandline prefsize? then we set this. + * Note that these values will be used only + * when there is no startup.blend yet. + */ if (!prefsizx) { wm_get_screensize(&prefsizx, &prefsizy); @@ -372,18 +375,19 @@ void wm_window_add_ghostwindows(bContext* C, wmWindowManager *wm) for(win= wm->windows.first; win; win= win->next) { if(win->ghostwin==NULL) { - if(win->sizex==0) { + if(win->sizex==0 || useprefsize) { win->posx= prefstax; win->posy= prefstay; win->sizex= prefsizx; win->sizey= prefsizy; win->windowstate= initialstate; + useprefsize= 0; } - wm_window_add_ghostwindow(C, wm, "Blender", win); + wm_window_add_ghostwindow(C, "Blender", win); } /* happens after fileread */ if(win->eventstate==NULL) - win->eventstate= MEM_callocN(sizeof(wmEvent), "window event state"); + win->eventstate= MEM_callocN(sizeof(wmEvent), "window event state"); /* add keymap handlers (1 handler for all keys in map!) */ keymap= WM_keymap_find(wm->defaultconf, "Window", 0, 0); @@ -488,7 +492,7 @@ void WM_window_open_temp(bContext *C, rcti *position, int type) /* ****************** Operators ****************** */ /* operator callback */ -int wm_window_duplicate_op(bContext *C, wmOperator *op) +int wm_window_duplicate_exec(bContext *C, wmOperator *UNUSED(op)) { wm_window_copy(C, CTX_wm_window(C)); WM_check(C); @@ -500,7 +504,7 @@ int wm_window_duplicate_op(bContext *C, wmOperator *op) /* fullscreen operator callback */ -int wm_window_fullscreen_toggle_op(bContext *C, wmOperator *op) +int wm_window_fullscreen_toggle_exec(bContext *C, wmOperator *UNUSED(op)) { wmWindow *window= CTX_wm_window(C); GHOST_TWindowState state = GHOST_GetWindowState(window->ghostwin); @@ -516,22 +520,37 @@ int wm_window_fullscreen_toggle_op(bContext *C, wmOperator *op) /* ************ events *************** */ -static int query_qual(char qual) +typedef enum +{ + SHIFT = 's', + CONTROL = 'c', + ALT = 'a', + OS = 'C' +} modifierKeyType; + +/* check if specified modifier key type is pressed */ +static int query_qual(modifierKeyType qual) { GHOST_TModifierKeyMask left, right; int val= 0; - if (qual=='s') { - left= GHOST_kModifierKeyLeftShift; - right= GHOST_kModifierKeyRightShift; - } else if (qual=='c') { - left= GHOST_kModifierKeyLeftControl; - right= GHOST_kModifierKeyRightControl; - } else if (qual=='C') { - left= right= GHOST_kModifierKeyOS; - } else { - left= GHOST_kModifierKeyLeftAlt; - right= GHOST_kModifierKeyRightAlt; + switch(qual) { + case SHIFT: + left= GHOST_kModifierKeyLeftShift; + right= GHOST_kModifierKeyRightShift; + break; + case CONTROL: + left= GHOST_kModifierKeyLeftControl; + right= GHOST_kModifierKeyRightControl; + break; + case OS: + left= right= GHOST_kModifierKeyOS; + break; + case ALT: + default: + left= GHOST_kModifierKeyLeftAlt; + right= GHOST_kModifierKeyRightAlt; + break; } GHOST_GetModifierKeyState(g_system, left, &val); @@ -600,19 +619,19 @@ static int ghost_event_proc(GHOST_EventHandle evt, GHOST_TUserDataPtr private) /* bad ghost support for modifier keys... so on activate we set the modifiers again */ kdata.ascii= 0; - if (win->eventstate->shift && !query_qual('s')) { + if (win->eventstate->shift && !query_qual(SHIFT)) { kdata.key= GHOST_kKeyLeftShift; wm_event_add_ghostevent(wm, win, GHOST_kEventKeyUp, time, &kdata); } - if (win->eventstate->ctrl && !query_qual('c')) { + if (win->eventstate->ctrl && !query_qual(CONTROL)) { kdata.key= GHOST_kKeyLeftControl; wm_event_add_ghostevent(wm, win, GHOST_kEventKeyUp, time, &kdata); } - if (win->eventstate->alt && !query_qual('a')) { + if (win->eventstate->alt && !query_qual(ALT)) { kdata.key= GHOST_kKeyLeftAlt; wm_event_add_ghostevent(wm, win, GHOST_kEventKeyUp, time, &kdata); } - if (win->eventstate->oskey && !query_qual('C')) { + if (win->eventstate->oskey && !query_qual(OS)) { kdata.key= GHOST_kKeyOS; wm_event_add_ghostevent(wm, win, GHOST_kEventKeyUp, time, &kdata); } @@ -875,7 +894,7 @@ void wm_window_process_events(const bContext *C) PIL_sleep_ms(5); } -void wm_window_process_events_nosleep(const bContext *C) +void wm_window_process_events_nosleep(void) { if(GHOST_ProcessEvents(g_system, 0)) GHOST_DispatchEvents(g_system); @@ -923,7 +942,7 @@ void wm_ghost_exit(void) /* **************** timer ********************** */ /* to (de)activate running timers temporary */ -void WM_event_timer_sleep(wmWindowManager *wm, wmWindow *win, wmTimer *timer, int dosleep) +void WM_event_timer_sleep(wmWindowManager *wm, wmWindow *UNUSED(win), wmTimer *timer, int dosleep) { wmTimer *wt; @@ -951,7 +970,7 @@ wmTimer *WM_event_add_timer(wmWindowManager *wm, wmWindow *win, int event_type, return wt; } -void WM_event_remove_timer(wmWindowManager *wm, wmWindow *win, wmTimer *timer) +void WM_event_remove_timer(wmWindowManager *wm, wmWindow *UNUSED(win), wmTimer *timer) { wmTimer *wt; @@ -1109,6 +1128,7 @@ void WM_setprefsize(int stax, int stay, int sizx, int sizy) prefstay= stay; prefsizx= sizx; prefsizy= sizy; + useprefsize= 1; } /* for borderless and border windows set from command-line */ diff --git a/source/blender/windowmanager/wm.h b/source/blender/windowmanager/wm.h index 7228a6dcd93..e1ca1793c04 100644 --- a/source/blender/windowmanager/wm.h +++ b/source/blender/windowmanager/wm.h @@ -61,7 +61,7 @@ void wm_tweakevent_test(bContext *C, wmEvent *event, int action); /* wm_gesture.c */ #define WM_LASSO_MIN_POINTS 1024 void wm_gesture_draw(struct wmWindow *win); -int wm_gesture_evaluate(bContext *C, wmGesture *gesture); +int wm_gesture_evaluate(wmGesture *gesture); void wm_gesture_tag_redraw(bContext *C); /* wm_jobs.c */ diff --git a/source/blender/windowmanager/wm_event_system.h b/source/blender/windowmanager/wm_event_system.h index 8fd650fb184..4888f9aced3 100644 --- a/source/blender/windowmanager/wm_event_system.h +++ b/source/blender/windowmanager/wm_event_system.h @@ -84,7 +84,6 @@ enum { /* wm_event_system.c */ -void wm_event_add (wmWindow *win, wmEvent *event_to_add); void wm_event_free_all (wmWindow *win); void wm_event_free (wmEvent *event); void wm_event_free_handler (wmEventHandler *handler); diff --git a/source/blender/windowmanager/wm_window.h b/source/blender/windowmanager/wm_window.h index 5a425df01e1..b0aec50e228 100644 --- a/source/blender/windowmanager/wm_window.h +++ b/source/blender/windowmanager/wm_window.h @@ -45,7 +45,7 @@ void wm_window_close (bContext *C, wmWindowManager *wm, wmWindow *win); void wm_window_title (wmWindowManager *wm, wmWindow *win); void wm_window_add_ghostwindows (bContext *C, wmWindowManager *wm); void wm_window_process_events (const bContext *C); -void wm_window_process_events_nosleep(const bContext *C); +void wm_window_process_events_nosleep(void); void wm_window_make_drawable(bContext *C, wmWindow *win); @@ -65,8 +65,8 @@ wmWindow *wm_window_copy (bContext *C, wmWindow *winorig); void wm_window_testbreak (void); /* *************** window operators ************** */ -int wm_window_duplicate_op (bContext *C, struct wmOperator *op); -int wm_window_fullscreen_toggle_op(bContext *C, struct wmOperator *op); +int wm_window_duplicate_exec(bContext *C, struct wmOperator *op); +int wm_window_fullscreen_toggle_exec(bContext *C, struct wmOperator *op); #endif /* WM_WINDOW_H */ diff --git a/source/blenderplayer/CMakeLists.txt b/source/blenderplayer/CMakeLists.txt index a61152d37ba..b1dbde8d4b1 100644 --- a/source/blenderplayer/CMakeLists.txt +++ b/source/blenderplayer/CMakeLists.txt @@ -65,7 +65,7 @@ IF(UNIX) gp_ghost gp_common bf_intern_string - bf_intern_ghost + bf_intern_ghost bf_rna bf_blenkernel bf_blenloader @@ -81,10 +81,10 @@ IF(UNIX) bf_oglrasterizer bf_expressions bf_scenegraph - bf_ikplugin - bf_intern_itasc - bf_intern_ik - bf_intern_smoke + bf_ikplugin + bf_intern_itasc + bf_intern_ik + bf_intern_smoke bf_modifiers bf_intern_moto bf_kernel @@ -114,6 +114,8 @@ IF(UNIX) extern_binreloc extern_glew extern_minilzo + bf_intern_ghost # duplicate for linking + bf_blenkernel # duplicate for linking ) IF(WITH_QUICKTIME) diff --git a/source/blenderplayer/bad_level_call_stubs/CMakeLists.txt b/source/blenderplayer/bad_level_call_stubs/CMakeLists.txt index 50be3c91dbe..473cc823f12 100644 --- a/source/blenderplayer/bad_level_call_stubs/CMakeLists.txt +++ b/source/blenderplayer/bad_level_call_stubs/CMakeLists.txt @@ -24,6 +24,9 @@ # # ***** END GPL LICENSE BLOCK ***** +# this warning on generated files gets annoying +STRING(REGEX REPLACE "-Wunused-parameter" "" CMAKE_C_FLAGS ${CMAKE_C_FLAGS}) + FILE(GLOB SRC stubs.c) IF(WITH_BUILDINFO) diff --git a/source/blenderplayer/bad_level_call_stubs/stubs.c b/source/blenderplayer/bad_level_call_stubs/stubs.c index f563cacf8a8..5fa09cebf29 100644 --- a/source/blenderplayer/bad_level_call_stubs/stubs.c +++ b/source/blenderplayer/bad_level_call_stubs/stubs.c @@ -42,6 +42,7 @@ struct CSG_FaceIteratorDescriptor; struct CSG_VertexIteratorDescriptor; struct ColorBand; struct CurveMapping; +struct Curve; struct EditBone; struct EditFace; struct EditMesh; @@ -205,7 +206,7 @@ struct KeyingSetInfo *ANIM_keyingset_info_find_named (const char name[]){return struct KeyingSet *ANIM_scene_get_active_keyingset (struct Scene *scene){return (struct KeyingSet *) NULL;} int ANIM_scene_get_keyingset_index(struct Scene *scene, struct KeyingSet *ks){return 0;} struct ListBase builtin_keyingsets; -void ANIM_keyingset_info_register (const struct bContext *C, struct KeyingSetInfo *ksi){} +void ANIM_keyingset_info_register (struct KeyingSetInfo *ksi){} void ANIM_keyingset_info_unregister (const struct bContext *C, struct KeyingSetInfo *ksi){} short ANIM_add_driver(struct ID *id, const char rna_path[], int array_index, short flag, int type){return 0;} short ANIM_remove_driver (struct ID *id, const char rna_path[], int array_index, short flag){return 0;} @@ -219,7 +220,7 @@ void WM_event_add_fileselect(struct bContext *C, struct wmOperator *op){} void WM_cursor_wait (int val) {} void ED_node_texture_default(struct Tex *tx){} void ED_node_changed_update(struct bContext *C, struct bNode *node){} -void ED_node_generic_update(struct Main *bmain, struct Scene *scene, struct bNodeTree *ntree, struct bNode *node){} +void ED_node_generic_update(struct Main *bmain, struct bNodeTree *ntree, struct bNode *node){} void ED_view3d_scene_layers_update(struct Main *bmain, struct Scene *scene){} int ED_view3d_scene_layer_set(int lay, const int *values){return 0;} void ED_view3d_quadview_update(struct ScrArea *sa, struct ARegion *ar){} @@ -254,7 +255,7 @@ void ED_mesh_edges_add(struct Mesh *mesh, struct ReportList *reports, int count) void ED_mesh_faces_add(struct Mesh *mesh, struct ReportList *reports, int count){} void ED_mesh_material_link(struct Mesh *mesh, struct Material *ma){} int ED_mesh_color_add(struct bContext *C, struct Scene *scene, struct Object *ob, struct Mesh *me){return 0;} -int ED_mesh_uv_texture_add(struct bContext *C, struct Scene *scene, struct Object *ob, struct Mesh *me){return 0;} +int ED_mesh_uv_texture_add(struct bContext *C, struct Mesh *me){return 0;} void ED_object_constraint_dependency_update(struct Scene *scene, struct Object *ob){} void ED_object_constraint_update(struct Object *ob){} struct bDeformGroup *ED_vgroup_add_name(struct Object *ob, char *name){return (struct bDeformGroup *) NULL;} diff --git a/source/creator/CMakeLists.txt b/source/creator/CMakeLists.txt index a979cb7a515..3dfd8755ef2 100644 --- a/source/creator/CMakeLists.txt +++ b/source/creator/CMakeLists.txt @@ -102,6 +102,9 @@ IF(WITH_BUILDINFO) -DBUILD_REV="${BUILD_REV}" -DBUILD_PLATFORM="${CMAKE_SYSTEM_NAME}" -DBUILD_TYPE="${CMAKE_BUILD_TYPE}" + -DBUILD_CFLAGS="${CMAKE_C_FLAGS}" + -DBUILD_CXXFLAGS="${CMAKE_CXX_FLAGS}" + -DBUILD_LINKFLAGS="${PLATFORM_LINKFLAGS}" ) LIST(APPEND EXESRC buildinfo.c) @@ -213,7 +216,7 @@ IF(WITH_INSTALL) DESTINATION ${CMAKE_INSTALL_PREFIX}/bin ) INSTALL( - FILES ${CMAKE_SOURCE_DIR}/doc/blender.1 + FILES ${CMAKE_SOURCE_DIR}/doc/manpage/blender.1 DESTINATION ${CMAKE_INSTALL_PREFIX}/share/man/man1 ) INSTALL( @@ -452,9 +455,6 @@ IF(WITH_FLUID) LIST(APPEND BLENDER_LINK_LIBS bf_intern_elbeem) ENDIF(WITH_FLUID) -IF(CMAKE_SYSTEM_NAME MATCHES "Linux") - LIST(APPEND BLENDER_LINK_LIBS extern_binreloc) -ENDIF(CMAKE_SYSTEM_NAME MATCHES "Linux") #IF(UNIX) # Sort libraries @@ -499,7 +499,6 @@ ENDIF(CMAKE_SYSTEM_NAME MATCHES "Linux") bf_editor_animation bf_editor_datafiles - bf_intern_bsp bf_render bf_intern_opennl bf_python @@ -531,8 +530,6 @@ ENDIF(CMAKE_SYSTEM_NAME MATCHES "Linux") bf_intern_memutil bf_intern_guardedalloc bf_intern_ctr - bf_intern_moto - bf_windowmanager bf_blroutines bf_converter bf_dummy @@ -547,19 +544,13 @@ ENDIF(CMAKE_SYSTEM_NAME MATCHES "Linux") bf_oglrasterizer bf_expressions bf_scenegraph - bf_intern_moto - bf_blroutines kx_network - bf_kernel + bf_kernel + bf_python # duplicate for BPY_eval_driver bf_ngnetwork extern_bullet bf_loopbacknetwork - bf_intern_itasc - bf_common bf_intern_moto - bf_python - bf_python_ext - extern_binreloc extern_glew extern_openjpeg bf_videotex @@ -567,10 +558,12 @@ ENDIF(CMAKE_SYSTEM_NAME MATCHES "Linux") bf_dna bf_blenfont bf_intern_audaspace - bf_intern_decimate - ) + IF(CMAKE_SYSTEM_NAME MATCHES "Linux") + LIST(APPEND BLENDER_SORTED_LIBS extern_binreloc) + ENDIF(CMAKE_SYSTEM_NAME MATCHES "Linux") + IF(WITH_CXX_GUARDEDALLOC) LIST(APPEND BLENDER_SORTED_LIBS bf_intern_guardedalloc_cpp) ENDIF(WITH_CXX_GUARDEDALLOC) diff --git a/source/creator/buildinfo.c b/source/creator/buildinfo.c index a14cb94b859..cf6f5a11c45 100644 --- a/source/creator/buildinfo.c +++ b/source/creator/buildinfo.c @@ -35,4 +35,15 @@ char build_time[]= STRINGIFY(BUILD_TIME); char build_rev[]= STRINGIFY(BUILD_REV); char build_platform[]= STRINGIFY(BUILD_PLATFORM); char build_type[]= STRINGIFY(BUILD_TYPE); + +#ifdef BUILD_CFLAGS +char build_cflags[]= STRINGIFY(BUILD_CFLAGS); +char build_cxxflags[]= STRINGIFY(BUILD_CXXFLAGS); +char build_linkflags[]= STRINGIFY(BUILD_LINKFLAGS); +#else +char build_cflags[]= "unmaintained buildsystem alert!"; +char build_cxxflags[]= "unmaintained buildsystem alert!"; +char build_linkflags[]= "unmaintained buildsystem alert!"; #endif + +#endif // BUILD_DATE diff --git a/source/creator/creator.c b/source/creator/creator.c index 963bd4775a1..b5ead098e99 100644 --- a/source/creator/creator.c +++ b/source/creator/creator.c @@ -120,6 +120,9 @@ extern char build_time[]; extern char build_rev[]; extern char build_platform[]; extern char build_type[]; +extern char build_cflags[]; +extern char build_cxxflags[]; +extern char build_linkflags[]; #endif /* Local Function prototypes */ @@ -140,7 +143,7 @@ static void setCallbacks(void); /* set breakpoints here when running in debug mode, useful to catch floating point errors */ #if defined(__sgi) || defined(__linux__) || defined(_WIN32) || OSX_SSE_FPE -static void fpe_handler(int sig) +static void fpe_handler(int UNUSED(sig)) { // printf("SIGFPE trapped\n"); } @@ -177,7 +180,7 @@ static void strip_quotes(char *str) } #endif -static int print_version(int argc, char **argv, void *data) +static int print_version(int UNUSED(argc), char **UNUSED(argv), void *UNUSED(data)) { printf (BLEND_VERSION_STRING_FMT); #ifdef BUILD_DATE @@ -186,13 +189,16 @@ static int print_version(int argc, char **argv, void *data) printf ("\tbuild revision: %s\n", build_rev); printf ("\tbuild platform: %s\n", build_platform); printf ("\tbuild type: %s\n", build_type); + printf ("\tbuild c flags: %s\n", build_cflags); + printf ("\tbuild c++ flags: %s\n", build_cxxflags); + printf ("\tbuild link flags: %s\n", build_linkflags); #endif exit(0); return 0; } -static int print_help(int argc, char **argv, void *data) +static int print_help(int UNUSED(argc), char **UNUSED(argv), void *data) { bArgs *ba = (bArgs*)data; @@ -319,30 +325,30 @@ double PIL_check_seconds_timer(void); } }*/ -static int end_arguments(int argc, char **argv, void *data) +static int end_arguments(int UNUSED(argc), char **UNUSED(argv), void *UNUSED(data)) { return -1; } -static int enable_python(int argc, char **argv, void *data) +static int enable_python(int UNUSED(argc), char **UNUSED(argv), void *UNUSED(data)) { G.f |= G_SCRIPT_AUTOEXEC; return 0; } -static int disable_python(int argc, char **argv, void *data) +static int disable_python(int UNUSED(argc), char **UNUSED(argv), void *UNUSED(data)) { G.f &= ~G_SCRIPT_AUTOEXEC; return 0; } -static int background_mode(int argc, char **argv, void *data) +static int background_mode(int UNUSED(argc), char **UNUSED(argv), void *UNUSED(data)) { G.background = 1; return 0; } -static int debug_mode(int argc, char **argv, void *data) +static int debug_mode(int UNUSED(argc), char **UNUSED(argv), void *data) { G.f |= G_DEBUG; /* std output printf's */ printf(BLEND_VERSION_STRING_FMT); @@ -356,7 +362,7 @@ static int debug_mode(int argc, char **argv, void *data) return 0; } -static int set_fpe(int argc, char **argv, void *data) +static int set_fpe(int UNUSED(argc), char **UNUSED(argv), void *UNUSED(data)) { #if defined(__sgi) || defined(__linux__) || defined(_WIN32) || OSX_SSE_FPE /* zealous but makes float issues a heck of a lot easier to find! @@ -381,7 +387,7 @@ static int set_fpe(int argc, char **argv, void *data) return 0; } -static int playback_mode(int argc, char **argv, void *data) +static int playback_mode(int UNUSED(argc), char **UNUSED(argv), void *UNUSED(data)) { /* not if -b was given first */ if (G.background == 0) { @@ -393,7 +399,7 @@ static int playback_mode(int argc, char **argv, void *data) return -2; } -static int prefsize(int argc, char **argv, void *data) +static int prefsize(int argc, char **argv, void *UNUSED(data)) { int stax, stay, sizx, sizy; @@ -412,29 +418,31 @@ static int prefsize(int argc, char **argv, void *data) return 4; } -static int with_borders(int argc, char **argv, void *data) +static int with_borders(int UNUSED(argc), char **UNUSED(argv), void *UNUSED(data)) { WM_setinitialstate_normal(); return 0; } -static int without_borders(int argc, char **argv, void *data) +static int without_borders(int UNUSED(argc), char **UNUSED(argv), void *UNUSED(data)) { WM_setinitialstate_fullscreen(); return 0; } -static int register_extension(int argc, char **argv, void *data) +static int register_extension(int UNUSED(argc), char **UNUSED(argv), void *data) { #ifdef WIN32 char *path = BLI_argsArgv(data)[0]; RegisterBlendExtension(path); +#else + (void)data; /* unused */ #endif return 0; } -static int no_joystick(int argc, char **argv, void *data) +static int no_joystick(int UNUSED(argc), char **UNUSED(argv), void *data) { SYS_SystemHandle *syshandle = data; @@ -448,19 +456,19 @@ static int no_joystick(int argc, char **argv, void *data) return 0; } -static int no_glsl(int argc, char **argv, void *data) +static int no_glsl(int UNUSED(argc), char **UNUSED(argv), void *UNUSED(data)) { GPU_extensions_disable(); return 0; } -static int no_audio(int argc, char **argv, void *data) +static int no_audio(int UNUSED(argc), char **UNUSED(argv), void *UNUSED(data)) { sound_force_device(0); return 0; } -static int set_audio(int argc, char **argv, void *data) +static int set_audio(int argc, char **argv, void *UNUSED(data)) { if (argc < 1) { printf("-setaudio require one argument\n"); @@ -585,7 +593,7 @@ static int set_image_type(int argc, char **argv, void *data) } } -static int set_threads(int argc, char **argv, void *data) +static int set_threads(int argc, char **argv, void *UNUSED(data)) { if (argc >= 1) { if(G.background) { @@ -716,7 +724,7 @@ static int render_frame(int argc, char **argv, void *data) } } -static int render_animation(int argc, char **argv, void *data) +static int render_animation(int UNUSED(argc), char **UNUSED(argv), void *data) { bContext *C = data; if (CTX_data_scene(C)) { @@ -850,7 +858,7 @@ static int run_python(int argc, char **argv, void *data) #endif /* DISABLE_PYTHON */ } -static int run_python_console(int argc, char **argv, void *data) +static int run_python_console(int UNUSED(argc), char **argv, void *data) { #ifndef DISABLE_PYTHON bContext *C = data; @@ -865,7 +873,7 @@ static int run_python_console(int argc, char **argv, void *data) #endif /* DISABLE_PYTHON */ } -static int load_file(int argc, char **argv, void *data) +static int load_file(int UNUSED(argc), char **argv, void *data) { bContext *C = data; @@ -875,7 +883,7 @@ static int load_file(int argc, char **argv, void *data) BLI_path_cwd(filename); if (G.background) { - int retval = BKE_read_file(C, filename, NULL, NULL); + int retval = BKE_read_file(C, filename, NULL); /*we successfully loaded a blend file, get sure that pointcache works */ @@ -1045,6 +1053,9 @@ int main(int argc, char **argv) strip_quotes(build_rev); strip_quotes(build_platform); strip_quotes(build_type); + strip_quotes(build_cflags); + strip_quotes(build_cxxflags); + strip_quotes(build_linkflags); #endif BLI_threadapi_init(); diff --git a/source/darwin/Makefile b/source/darwin/Makefile index 5c68f43f606..a9d9d7f2f20 100644 --- a/source/darwin/Makefile +++ b/source/darwin/Makefile @@ -30,6 +30,7 @@ include nan_definitions.mk DIR = $(OCGDIR)/$(DEBUG_DIR) +VERSION = $(shell $(NANBLENDERHOME)/release/getversion.py) PYARCHIVE = python_$(MACOSX_ARCHITECTURE).zip @@ -38,22 +39,25 @@ all:: @echo "---> creating directory structure for $(APPLICATION)" @rm -rf $(DIR)/bin/$(APPLICATION).app @cp -R $(APPLICATION).app $(DIR)/bin - @cat $(APPLICATION).app/Contents/Info.plist | sed s/VERSION/`cat ../../release/VERSION`/ | sed s/DATE/`date +'%Y-%b-%d'`/ > $(DIR)/bin/$(APPLICATION).app/Contents/Info.plist + @cat $(APPLICATION).app/Contents/Info.plist | sed s/VERSION/$(VERSION)/ | sed s/DATE/`date +'%Y-%b-%d'`/ > $(DIR)/bin/$(APPLICATION).app/Contents/Info.plist @echo "---> copying binary" @cp $(DIR)/bin/$(APPLICATION) $(DIR)/bin/$(APPLICATION).app/Contents/MacOS/ @echo "---> adding excutable attributes" @chmod +x $(DIR)/bin/$(APPLICATION).app/Contents/MacOS/$(APPLICATION) ifeq ($(APPLICATION), blender) + @mkdir -p $(DIR)/bin/$(APPLICATION).app/Contents/MacOS/$(VERSION) @echo "---> copying message files" @cp -R $(NANBLENDERHOME)/release/bin/.blender/locale $(DIR)/bin/$(APPLICATION).app/Contents/Resources @echo "---> copying .Blanguages" @cp $(NANBLENDERHOME)/release/bin/.blender/.Blanguages $(DIR)/bin/$(APPLICATION).app/Contents/Resources - @echo "---> copying .blender/ scripts" - @cp -R $(NANBLENDERHOME)/release/bin/.blender $(DIR)/bin/$(APPLICATION).app/Contents/MacOS - @cp -R $(NANBLENDERHOME)/release/scripts $(DIR)/bin/$(APPLICATION).app/Contents/MacOS/.blender/ + @echo "---> copying bfont.ttf" + @cp $(NANBLENDERHOME)/release/datafiles/bfont.ttf $(DIR)/bin/$(APPLICATION).app/Contents/Resources/ + @cp $(NANBLENDERHOME)/release/datafiles/bmonofont.ttf $(DIR)/bin/$(APPLICATION).app/Contents/Resources/ + @echo "---> copying release scripts" + @cp -R $(NANBLENDERHOME)/release/scripts $(DIR)/bin/$(APPLICATION).app/Contents/MacOS/$(VERSION)/ @echo "---> copying python modules" - @mkdir $(DIR)/bin/$(APPLICATION).app/Contents/MacOS/.blender/python - @unzip -q $(LCGDIR)/release/$(PYARCHIVE) -d $(DIR)/bin/$(APPLICATION).app/Contents/MacOS/.blender/python/ + @mkdir $(DIR)/bin/$(APPLICATION).app/Contents/MacOS/$(VERSION)/python + @unzip -q $(LCGDIR)/release/$(PYARCHIVE) -d $(DIR)/bin/$(APPLICATION).app/Contents/MacOS/$(VERSION)/python/ endif @echo "---> removing SVN directories and Mac hidden files from distribution" @find $(DIR)/bin/$(APPLICATION).app -name CVS -prune -exec rm -rf {} \; diff --git a/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp b/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp index 2bc24aab526..858a5964a52 100644 --- a/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp +++ b/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp @@ -141,10 +141,10 @@ extern "C" void StartKetsjiShell(struct bContext *C, struct ARegion *ar, rcti *c BlendFileData *bfd= NULL; BLI_strncpy(pathname, blenderdata->name, sizeof(pathname)); - BLI_strncpy(oldsce, G.sce, sizeof(oldsce)); + BLI_strncpy(oldsce, G.main->name, sizeof(oldsce)); #ifndef DISABLE_PYTHON resetGamePythonPath(); // need this so running a second time wont use an old blendfiles path - setGamePythonPath(G.sce); + setGamePythonPath(G.main->name); // Acquire Python's GIL (global interpreter lock) // so we can safely run Python code and API calls @@ -309,10 +309,10 @@ extern "C" void StartKetsjiShell(struct bContext *C, struct ARegion *ar, rcti *c startscenename = bfd->curscene->id.name + 2; if(blenderdata) { - BLI_strncpy(G.sce, blenderdata->name, sizeof(G.sce)); + BLI_strncpy(G.main->name, blenderdata->name, sizeof(G.main->name)); BLI_strncpy(pathname, blenderdata->name, sizeof(pathname)); #ifndef DISABLE_PYTHON - setGamePythonPath(G.sce); + setGamePythonPath(G.main->name); #endif } } @@ -440,7 +440,7 @@ extern "C" void StartKetsjiShell(struct bContext *C, struct ARegion *ar, rcti *c ketsjiengine->Render(); } - wm_window_process_events_nosleep(C); + wm_window_process_events_nosleep(); // test for the ESC key //XXX while (qtest()) @@ -573,7 +573,7 @@ extern "C" void StartKetsjiShell(struct bContext *C, struct ARegion *ar, rcti *c if (bfd) BLO_blendfiledata_free(bfd); - BLI_strncpy(G.sce, oldsce, sizeof(G.sce)); + BLI_strncpy(G.main->name, oldsce, sizeof(G.main->name)); #ifndef DISABLE_PYTHON Py_DECREF(pyGlobalDict); diff --git a/source/gameengine/BlenderRoutines/KX_BlenderGL.cpp b/source/gameengine/BlenderRoutines/KX_BlenderGL.cpp index 662222bf990..5e1e213c570 100644 --- a/source/gameengine/BlenderRoutines/KX_BlenderGL.cpp +++ b/source/gameengine/BlenderRoutines/KX_BlenderGL.cpp @@ -67,6 +67,7 @@ extern "C" { #include "DNA_windowmanager_types.h" #include "BKE_global.h" +#include "BKE_main.h" #include "BKE_bmfont.h" #include "BKE_image.h" @@ -247,10 +248,10 @@ void BL_MakeScreenShot(ScrArea *curarea, const char* filename) dumprect= screenshot(curarea, &dumpsx, &dumpsy); if(dumprect) { ImBuf *ibuf; - BLI_path_abs(path, G.sce); + BLI_path_abs(path, G.main->name); /* BKE_add_image_extension() checks for if extension was already set */ BKE_add_image_extension(path, R_PNG); /* scene->r.imtype */ - ibuf= IMB_allocImBuf(dumpsx, dumpsy, 24, 0, 0); + ibuf= IMB_allocImBuf(dumpsx, dumpsy, 24, 0); ibuf->rect= dumprect; ibuf->ftype= PNG; diff --git a/source/gameengine/BlenderRoutines/Makefile b/source/gameengine/BlenderRoutines/Makefile index 3d0f5344c74..cc0c6cf11dd 100644 --- a/source/gameengine/BlenderRoutines/Makefile +++ b/source/gameengine/BlenderRoutines/Makefile @@ -41,6 +41,8 @@ CPPFLAGS += -I$(NAN_MOTO)/include CPPFLAGS += -I$(NAN_GLEW)/include CPPFLAGS += -I$(OPENGL_HEADERS) CPPFLAGS += -I$(NAN_AUDASPACE)/include +# path to the guarded memory allocator +CPPFLAGS += -I$(NAN_GUARDEDALLOC)/include # because of kernel dependency on makesdna CPPFLAGS += -I../../blender/makesdna CPPFLAGS += -I../../blender/editors/include diff --git a/source/gameengine/CMakeLists.txt b/source/gameengine/CMakeLists.txt index 7b58a2a6875..eea600cb0cb 100644 --- a/source/gameengine/CMakeLists.txt +++ b/source/gameengine/CMakeLists.txt @@ -37,7 +37,10 @@ ADD_SUBDIRECTORY(Physics/Dummy) ADD_SUBDIRECTORY(Rasterizer) ADD_SUBDIRECTORY(Rasterizer/RAS_OpenGLRasterizer) ADD_SUBDIRECTORY(SceneGraph) -ADD_SUBDIRECTORY(Physics/Bullet) + +IF(WITH_BULLET) + ADD_SUBDIRECTORY(Physics/Bullet) +ENDIF(WITH_BULLET) IF(WITH_PYTHON) ADD_SUBDIRECTORY(VideoTexture) diff --git a/source/gameengine/Converter/BL_BlenderDataConversion.cpp b/source/gameengine/Converter/BL_BlenderDataConversion.cpp index f9bca9a2cdd..69483aed1ec 100644 --- a/source/gameengine/Converter/BL_BlenderDataConversion.cpp +++ b/source/gameengine/Converter/BL_BlenderDataConversion.cpp @@ -1766,9 +1766,11 @@ static KX_GameObject *gameobject_from_blenderobject( BL_MeshDeformer *dcont = new BL_MeshDeformer((BL_DeformableGameObject*)gameobj, ob, meshobj); ((BL_DeformableGameObject*)gameobj)->SetDeformer(dcont); +#ifdef USE_BULLET } else if (bHasSoftBody) { KX_SoftBodyDeformer *dcont = new KX_SoftBodyDeformer(meshobj, (BL_DeformableGameObject*)gameobj); ((BL_DeformableGameObject*)gameobj)->SetDeformer(dcont); +#endif } MT_Point3 min = MT_Point3(center) - MT_Vector3(extents); diff --git a/source/gameengine/Converter/CMakeLists.txt b/source/gameengine/Converter/CMakeLists.txt index c5b8128903b..87e413c3a44 100644 --- a/source/gameengine/Converter/CMakeLists.txt +++ b/source/gameengine/Converter/CMakeLists.txt @@ -69,4 +69,8 @@ ELSE(WITH_PYTHON) ADD_DEFINITIONS(-DDISABLE_PYTHON) ENDIF(WITH_PYTHON) +IF(WITH_BULLET) + ADD_DEFINITIONS(-DUSE_BULLET) +ENDIF(WITH_BULLET) + BLENDERLIB(bf_converter "${SRC}" "${INC}") diff --git a/source/gameengine/Converter/SConscript b/source/gameengine/Converter/SConscript index 7701d27730b..a276d1623df 100644 --- a/source/gameengine/Converter/SConscript +++ b/source/gameengine/Converter/SConscript @@ -35,4 +35,7 @@ else: if env['WITH_BF_CXX_GUARDEDALLOC']: defs.append('WITH_CXX_GUARDEDALLOC') +if env['WITH_BF_BULLET']: + defs.append('USE_BULLET') + env.BlenderLib ( 'bf_converter', sources, Split(incs), defs, libtype=['core','player'], priority=[305,40], cxx_compileflags=env['BGE_CXXFLAGS']) diff --git a/source/gameengine/Expressions/PyObjectPlus.h b/source/gameengine/Expressions/PyObjectPlus.h index 625549a272e..b2688231a43 100644 --- a/source/gameengine/Expressions/PyObjectPlus.h +++ b/source/gameengine/Expressions/PyObjectPlus.h @@ -461,6 +461,7 @@ typedef PyTypeObject * PyParentObject; // Define the PyParent Object #else // DISABLE_PYTHON +#ifdef WITH_CXX_GUARDEDALLOC #define Py_Header \ public: \ void *operator new(size_t num_bytes) { return MEM_mallocN(num_bytes, "GE:PyObjectPlus"); } \ @@ -471,6 +472,16 @@ typedef PyTypeObject * PyParentObject; // Define the PyParent Object void *operator new(size_t num_bytes) { return MEM_mallocN(num_bytes, "GE:PyObjectPlusPtr"); } \ void operator delete( void *mem ) { MEM_freeN(mem); } \ +#else // WITH_CXX_GUARDEDALLOC + +#define Py_Header \ + public: \ + +#define Py_HeaderPtr \ + public: \ + +#endif // WITH_CXX_GUARDEDALLOC + #endif diff --git a/source/gameengine/GameLogic/SCA_PythonController.cpp b/source/gameengine/GameLogic/SCA_PythonController.cpp index 1f05846abe4..45f0684c02f 100644 --- a/source/gameengine/GameLogic/SCA_PythonController.cpp +++ b/source/gameengine/GameLogic/SCA_PythonController.cpp @@ -214,7 +214,7 @@ SCA_IActuator* SCA_PythonController::LinkedActuatorFromPy(PyObject *value) PyErr_Format(PyExc_ValueError, "'%s' not in this python controllers actuator list", _PyUnicode_AsString(value_str)); Py_DECREF(value_str); - return false; + return NULL; } const char* SCA_PythonController::sPyGetCurrentController__doc__ = "getCurrentController()"; diff --git a/source/gameengine/GamePlayer/common/GPC_RenderTools.cpp b/source/gameengine/GamePlayer/common/GPC_RenderTools.cpp index e02b5fedaf0..a985decabe4 100644 --- a/source/gameengine/GamePlayer/common/GPC_RenderTools.cpp +++ b/source/gameengine/GamePlayer/common/GPC_RenderTools.cpp @@ -284,8 +284,9 @@ void GPC_RenderTools::RenderText2D(RAS_TEXT_RENDER_MODE mode, int width, int height) { + /* STR_String tmpstr(text); - char* s = tmpstr.Ptr(); + char* s = tmpstr.Ptr(); */ // Save and change OpenGL settings int texture2D; diff --git a/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp b/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp index 9c0b5a24aeb..94142e7a604 100644 --- a/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp +++ b/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp @@ -95,9 +95,9 @@ extern char btempdir[]; /* use this to store a valid temp directory */ #ifdef WIN32 #include <windows.h> -#ifdef NDEBUG +#if !defined(DEBUG) #include <wincon.h> -#endif // NDEBUG +#endif // !defined(DEBUG) #endif // WIN32 const int kMinWindowWidth = 100; @@ -391,7 +391,7 @@ int main(int argc, char** argv) IMB_init(); // Parse command line options -#ifndef NDEBUG +#if defined(DEBUG) printf("argv[0] = '%s'\n", argv[0]); #endif @@ -438,7 +438,7 @@ int main(int argc, char** argv) ;) { -#ifndef NDEBUG +#if defined(DEBUG) printf("argv[%d] = '%s' , %i\n", i, argv[i],argc); #endif if (argv[i][0] == '-') @@ -469,7 +469,7 @@ int main(int argc, char** argv) SYS_WriteCommandLineInt(syshandle, paramname, atoi(argv[i])); SYS_WriteCommandLineFloat(syshandle, paramname, atof(argv[i])); SYS_WriteCommandLineString(syshandle, paramname, argv[i]); -#ifndef NDEBUG +#if defined(DEBUG) printf("%s = '%s'\n", paramname, argv[i]); #endif i++; @@ -542,9 +542,9 @@ int main(int argc, char** argv) printf("error: too few options for parent window argument.\n"); } -#ifndef NDEBUG +#if defined(DEBUG) printf("XWindows ID = %d\n", parentWindow); -#endif //NDEBUG +#endif // defined(DEBUG) #endif // _WIN32 case 'c': @@ -745,12 +745,12 @@ int main(int argc, char** argv) else { #ifdef WIN32 -#ifdef NDEBUG +#if !defined(DEBUG) if (closeConsole) { //::FreeConsole(); // Close a console window } -#endif // NDEBUG +#endif // !defined(DEBUG) #endif // WIN32 Main *maggie = bfd->main; Scene *scene = bfd->curscene; @@ -821,8 +821,8 @@ int main(int argc, char** argv) app.SetGameEngineData(maggie, scene, argc, argv); /* this argc cant be argc_py_clamped, since python uses it */ BLI_strncpy(pathname, maggie->name, sizeof(pathname)); - BLI_strncpy(G.sce, maggie->name, sizeof(G.sce)); - setGamePythonPath(G.sce); + BLI_strncpy(G.main->name, maggie->name, sizeof(G.main->name)); + setGamePythonPath(G.main->name); if (firstTimeRunning) { diff --git a/source/gameengine/Ketsji/BL_Texture.cpp b/source/gameengine/Ketsji/BL_Texture.cpp index 5d40ba7d75c..e708775b184 100644 --- a/source/gameengine/Ketsji/BL_Texture.cpp +++ b/source/gameengine/Ketsji/BL_Texture.cpp @@ -634,7 +634,7 @@ void my_envmap_split_ima(EnvMap *env, ImBuf *ibuf) } else { for(part=0; part<6; part++) { - env->cube[part]= IMB_allocImBuf(dx, dx, 24, IB_rect, 0); + env->cube[part]= IMB_allocImBuf(dx, dx, 24, IB_rect); } IMB_rectcpy(env->cube[0], ibuf, 0, 0, 0, 0, dx, dx); diff --git a/source/gameengine/Ketsji/CMakeLists.txt b/source/gameengine/Ketsji/CMakeLists.txt index eaead261b2c..b128f33c6e4 100644 --- a/source/gameengine/Ketsji/CMakeLists.txt +++ b/source/gameengine/Ketsji/CMakeLists.txt @@ -51,13 +51,11 @@ SET(INC ../../../source/gameengine/Network ../../../source/gameengine/SceneGraph ../../../source/gameengine/Physics/common - ../../../source/gameengine/Physics/Bullet ../../../source/gameengine/Network/LoopBackNetwork ../../../intern/audaspace/intern ../../../source/blender/misc ../../../source/blender/blenloader ../../../source/blender/gpu - ../../../extern/bullet2/src ../../../extern/glew/include ) @@ -79,4 +77,10 @@ IF(WITH_FFMPEG) ADD_DEFINITIONS(-DWITH_FFMPEG) ENDIF(WITH_FFMPEG) +IF(WITH_BULLET) + ADD_DEFINITIONS(-DUSE_BULLET) + LIST(APPEND INC ../../../extern/bullet2/src) + LIST(APPEND INC ../../../source/gameengine/Physics/Bullet ) +ENDIF(WITH_BULLET) + BLENDERLIB(bf_ketsji "${SRC}" "${INC}") diff --git a/source/gameengine/Ketsji/KX_BulletPhysicsController.cpp b/source/gameengine/Ketsji/KX_BulletPhysicsController.cpp index 1b2ceae6560..c2fb21bf31a 100644 --- a/source/gameengine/Ketsji/KX_BulletPhysicsController.cpp +++ b/source/gameengine/Ketsji/KX_BulletPhysicsController.cpp @@ -521,4 +521,4 @@ bool KX_BulletPhysicsController::Update(double time) // return false; } -#endif //#ifdef USE_BULLET +#endif // USE_BULLET diff --git a/source/gameengine/Ketsji/KX_BulletPhysicsController.h b/source/gameengine/Ketsji/KX_BulletPhysicsController.h index 48a3c98ff81..a3e8fafec1d 100644 --- a/source/gameengine/Ketsji/KX_BulletPhysicsController.h +++ b/source/gameengine/Ketsji/KX_BulletPhysicsController.h @@ -3,7 +3,9 @@ #include "KX_IPhysicsController.h" +#ifdef USE_BULLET #include "CcdPhysicsController.h" +#endif class KX_BulletPhysicsController : public KX_IPhysicsController ,public CcdPhysicsController { @@ -18,9 +20,10 @@ private: btCollisionShape* m_bulletChildShape; public: +#ifdef USE_BULLET KX_BulletPhysicsController (const CcdConstructionInfo& ci, bool dyna, bool sensor, bool compound); virtual ~KX_BulletPhysicsController (); - +#endif /////////////////////////////////// // KX_IPhysicsController interface //////////////////////////////////// diff --git a/source/gameengine/Ketsji/KX_ConvertPhysicsObject.h b/source/gameengine/Ketsji/KX_ConvertPhysicsObject.h index ca20aa6b618..2bb3534bde7 100644 --- a/source/gameengine/Ketsji/KX_ConvertPhysicsObject.h +++ b/source/gameengine/Ketsji/KX_ConvertPhysicsObject.h @@ -29,19 +29,6 @@ #ifndef KX_CONVERTPHYSICSOBJECTS #define KX_CONVERTPHYSICSOBJECTS -/* These are defined by the build system... */ -//but the build system is broken, because it doesn't allow for 2 or more defines at once. -//Please leave Sumo _AND_ Bullet enabled -#define USE_BULLET - -//on visual studio 7/8, always enable BULLET for now -//you can have multiple physics engines running anyway, and -//the scons build system doesn't really support this at the moment. -//if you got troubles, just comment out USE_BULLET -#if 1300 <= _MSC_VER -#define USE_BULLET -#endif - class RAS_MeshObject; class KX_Scene; struct DerivedMesh; diff --git a/source/gameengine/Ketsji/KX_ConvertPhysicsObjects.cpp b/source/gameengine/Ketsji/KX_ConvertPhysicsObjects.cpp index 061220ce0c1..1888e7cf7b8 100644 --- a/source/gameengine/Ketsji/KX_ConvertPhysicsObjects.cpp +++ b/source/gameengine/Ketsji/KX_ConvertPhysicsObjects.cpp @@ -38,7 +38,6 @@ #include "RAS_MeshObject.h" #include "KX_Scene.h" #include "SYS_System.h" -#include "BulletSoftBody/btSoftBody.h" #include "PHY_Pro.h" //todo cleanup #include "KX_ClientObjectInfo.h" @@ -56,6 +55,7 @@ extern "C"{ } #ifdef USE_BULLET +#include "BulletSoftBody/btSoftBody.h" #include "CcdPhysicsEnvironment.h" #include "CcdPhysicsController.h" @@ -561,4 +561,4 @@ bool KX_ReInstanceBulletShapeFromMesh(KX_GameObject *gameobj, KX_GameObject *fro spc->ReplaceControllerShape(bm); return true; } -#endif +#endif // USE_BULLET diff --git a/source/gameengine/Ketsji/KX_GameObject.cpp b/source/gameengine/Ketsji/KX_GameObject.cpp index 764691c379f..bbb17cd1df9 100644 --- a/source/gameengine/Ketsji/KX_GameObject.cpp +++ b/source/gameengine/Ketsji/KX_GameObject.cpp @@ -1496,6 +1496,7 @@ PyMethodDef KX_GameObject::Methods[] = { PyAttributeDef KX_GameObject::Attributes[] = { KX_PYATTRIBUTE_RO_FUNCTION("name", KX_GameObject, pyattr_get_name), KX_PYATTRIBUTE_RO_FUNCTION("parent", KX_GameObject, pyattr_get_parent), + KX_PYATTRIBUTE_RO_FUNCTION("life", KX_GameObject, pyattr_get_life), KX_PYATTRIBUTE_RW_FUNCTION("mass", KX_GameObject, pyattr_get_mass, pyattr_set_mass), KX_PYATTRIBUTE_RW_FUNCTION("linVelocityMin", KX_GameObject, pyattr_get_lin_vel_min, pyattr_set_lin_vel_min), KX_PYATTRIBUTE_RW_FUNCTION("linVelocityMax", KX_GameObject, pyattr_get_lin_vel_max, pyattr_set_lin_vel_max), @@ -1574,11 +1575,11 @@ PyObject* KX_GameObject::PyReinstancePhysicsMesh(PyObject* args) ) { return NULL; } - +#ifdef USE_BULLET /* gameobj and mesh can be NULL */ if(KX_ReInstanceBulletShapeFromMesh(this, gameobj, mesh)) Py_RETURN_TRUE; - +#endif Py_RETURN_FALSE; } @@ -1787,6 +1788,19 @@ PyObject* KX_GameObject::pyattr_get_parent(void *self_v, const KX_PYATTRIBUTE_DE Py_RETURN_NONE; } +PyObject* KX_GameObject::pyattr_get_life(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef) +{ + KX_GameObject* self= static_cast<KX_GameObject*>(self_v); + + CValue *life = self->GetProperty("::timebomb"); + if (life) + // this convert the timebomb seconds to frames, hard coded 50.0 (assuming 50fps) + // value hardcoded in KX_Scene::AddReplicaObject() + return PyFloat_FromDouble(life->GetNumber() * 50.0); + else + Py_RETURN_NONE; +} + PyObject* KX_GameObject::pyattr_get_mass(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef) { KX_GameObject* self= static_cast<KX_GameObject*>(self_v); diff --git a/source/gameengine/Ketsji/KX_GameObject.h b/source/gameengine/Ketsji/KX_GameObject.h index 524c061b4d5..14587d25c7f 100644 --- a/source/gameengine/Ketsji/KX_GameObject.h +++ b/source/gameengine/Ketsji/KX_GameObject.h @@ -856,6 +856,7 @@ public: static PyObject* pyattr_get_name(void* self_v, const KX_PYATTRIBUTE_DEF *attrdef); static PyObject* pyattr_get_parent(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef); + static PyObject* pyattr_get_life(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef); static PyObject* pyattr_get_mass(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef); static int pyattr_set_mass(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value); static PyObject* pyattr_get_lin_vel_min(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef); diff --git a/source/gameengine/Ketsji/KX_Light.cpp b/source/gameengine/Ketsji/KX_Light.cpp index e282d7ac375..fdd325c46a1 100644 --- a/source/gameengine/Ketsji/KX_Light.cpp +++ b/source/gameengine/Ketsji/KX_Light.cpp @@ -180,7 +180,7 @@ GPULamp *KX_LightObject::GetGPULamp() if(m_glsl) return GPU_lamp_from_blender(m_blenderscene, GetBlenderObject(), GetBlenderGroupObject()); else - return false; + return NULL; } void KX_LightObject::Update() diff --git a/source/gameengine/Ketsji/KX_PythonInit.cpp b/source/gameengine/Ketsji/KX_PythonInit.cpp index 88993f20132..56ec61f9f4c 100644 --- a/source/gameengine/Ketsji/KX_PythonInit.cpp +++ b/source/gameengine/Ketsji/KX_PythonInit.cpp @@ -136,13 +136,14 @@ static RAS_ICanvas* gp_Canvas = NULL; static char gp_GamePythonPath[FILE_MAXDIR + FILE_MAXFILE] = ""; static char gp_GamePythonPathOrig[FILE_MAXDIR + FILE_MAXFILE] = ""; // not super happy about this, but we need to remember the first loaded file for the global/dict load save +static SCA_PythonKeyboard* gp_PythonKeyboard = NULL; +static SCA_PythonMouse* gp_PythonMouse = NULL; #endif // DISABLE_PYTHON static KX_Scene* gp_KetsjiScene = NULL; static KX_KetsjiEngine* gp_KetsjiEngine = NULL; static RAS_IRasterizer* gp_Rasterizer = NULL; -static SCA_PythonKeyboard* gp_PythonKeyboard = NULL; -static SCA_PythonMouse* gp_PythonMouse = NULL; + void KX_SetActiveScene(class KX_Scene* scene) { diff --git a/source/gameengine/Ketsji/KX_Scene.cpp b/source/gameengine/Ketsji/KX_Scene.cpp index 863b73adc96..3d7fcb25f2b 100644 --- a/source/gameengine/Ketsji/KX_Scene.cpp +++ b/source/gameengine/Ketsji/KX_Scene.cpp @@ -82,12 +82,10 @@ #include "BL_ModifierDeformer.h" #include "BL_ShapeDeformer.h" #include "BL_DeformableGameObject.h" -#include "KX_SoftBodyDeformer.h" - -// to get USE_BULLET! -#include "KX_ConvertPhysicsObject.h" #ifdef USE_BULLET +#include "KX_SoftBodyDeformer.h" +#include "KX_ConvertPhysicsObject.h" #include "CcdPhysicsEnvironment.h" #include "CcdPhysicsController.h" #endif @@ -814,6 +812,8 @@ SCA_IObject* KX_Scene::AddReplicaObject(class CValue* originalobject, // add a timebomb to this object // for now, convert between so called frames and realtime m_tempObjectList->Add(replica->AddRef()); + // this convert the life from frames to sort-of seconds, hard coded 0.02 that assumes we have 50 frames per second + // if you change this value, make sure you change it in KX_GameObject::pyattr_get_life property too CValue *fval = new CFloatValue(lifespan*0.02); replica->SetProperty("::timebomb",fval); fval->Release(); @@ -1163,11 +1163,13 @@ void KX_Scene::ReplaceMesh(class CValue* obj,void* meshobj, bool use_gfx, bool u ); newobj->SetDeformer(meshdeformer); } +#ifdef USE_BULLET else if (bHasSoftBody) { KX_SoftBodyDeformer *softdeformer = new KX_SoftBodyDeformer(mesh, newobj); newobj->SetDeformer(softdeformer); } +#endif // release parent reference if its not being used if( releaseParent && parentobj) @@ -1177,10 +1179,12 @@ void KX_Scene::ReplaceMesh(class CValue* obj,void* meshobj, bool use_gfx, bool u gameobj->AddMeshUser(); } - + +#ifdef USE_BULLET if(use_phys) { /* update the new assigned mesh with the physics mesh */ KX_ReInstanceBulletShapeFromMesh(gameobj, NULL, use_gfx?NULL:mesh); } +#endif } KX_Camera* KX_Scene::FindCamera(KX_Camera* cam) @@ -1629,7 +1633,9 @@ double KX_Scene::getSuspendedDelta() return m_suspendeddelta; } +#ifdef USE_BULLET #include "KX_BulletPhysicsController.h" +#endif static void MergeScene_LogicBrick(SCA_ILogicBrick* brick, KX_Scene *to) { @@ -1644,16 +1650,19 @@ static void MergeScene_LogicBrick(SCA_ILogicBrick* brick, KX_Scene *to) } /* near sensors have physics controllers */ +#ifdef USE_BULLET KX_TouchSensor *touch_sensor = dynamic_cast<class KX_TouchSensor *>(brick); if(touch_sensor) { touch_sensor->GetPhysicsController()->SetPhysicsEnvironment(to->GetPhysicsEnvironment()); } +#endif } +#ifdef USE_BULLET #include "CcdGraphicController.h" // XXX ctrl->SetPhysicsEnvironment(to->GetPhysicsEnvironment()); #include "CcdPhysicsEnvironment.h" // XXX ctrl->SetPhysicsEnvironment(to->GetPhysicsEnvironment()); #include "KX_BulletPhysicsController.h" - +#endif static void MergeScene_GameObject(KX_GameObject* gameobj, KX_Scene *to, KX_Scene *from) { @@ -1713,7 +1722,7 @@ static void MergeScene_GameObject(KX_GameObject* gameobj, KX_Scene *to, KX_Scene if(sg->GetSGClientInfo() == from) { sg->SetSGClientInfo(to); } - +#ifdef USE_BULLET SGControllerList::iterator contit; SGControllerList& controllers = sg->GetSGControllerList(); for (contit = controllers.begin();contit!=controllers.end();++contit) @@ -1722,6 +1731,7 @@ static void MergeScene_GameObject(KX_GameObject* gameobj, KX_Scene *to, KX_Scene if (phys_ctrl) phys_ctrl->SetPhysicsEnvironment(to->GetPhysicsEnvironment()); } +#endif // USE_BULLET } /* If the object is a light, update it's scene */ if (gameobj->GetGameObjectType() == SCA_IObject::OBJ_LIGHT) @@ -1737,6 +1747,7 @@ static void MergeScene_GameObject(KX_GameObject* gameobj, KX_Scene *to, KX_Scene bool KX_Scene::MergeScene(KX_Scene *other) { +#ifdef USE_BULLET CcdPhysicsEnvironment *env= dynamic_cast<CcdPhysicsEnvironment *>(this->GetPhysicsEnvironment()); CcdPhysicsEnvironment *env_other= dynamic_cast<CcdPhysicsEnvironment *>(other->GetPhysicsEnvironment()); @@ -1746,6 +1757,7 @@ bool KX_Scene::MergeScene(KX_Scene *other) printf("\tsource %d, terget %d\n", (int)(env!=NULL), (int)(env_other!=NULL)); return false; } +#endif // USE_BULLET if(GetSceneConverter() != other->GetSceneConverter()) { printf("KX_Scene::MergeScene: converters differ, aborting\n"); @@ -1788,9 +1800,11 @@ bool KX_Scene::MergeScene(KX_Scene *other) GetLightList()->MergeList(other->GetLightList()); other->GetLightList()->ReleaseAndRemoveAll(); +#ifdef USE_BULLET if(env) /* bullet scene? - dummy scenes dont need touching */ env->MergeEnvironment(env_other); - +#endif + /* merge logic */ { SCA_LogicManager *logicmgr= GetLogicManager(); diff --git a/source/gameengine/Ketsji/SConscript b/source/gameengine/Ketsji/SConscript index 49e4528594f..6f06d0ff19c 100644 --- a/source/gameengine/Ketsji/SConscript +++ b/source/gameengine/Ketsji/SConscript @@ -16,7 +16,7 @@ incs += ' #source/gameengine/Ketsji #source/gameengine/Ketsji/KXNetwork #source/ incs += ' #source/blender/blenkernel #source/blender #source/blender/editors/include' incs += ' #source/blender/makesdna #source/blender/python #source/gameengine/Rasterizer' incs += ' #source/gameengine/GameLogic #source/gameengine/Expressions #source/gameengine/Network' -incs += ' #source/gameengine/SceneGraph #source/gameengine/Physics/common #source/gameengine/Physics/Bullet' +incs += ' #source/gameengine/SceneGraph #source/gameengine/Physics/common' incs += ' #source/gameengine/Physics/Dummy' incs += ' #source/blender/misc #source/blender/blenloader #extern/glew/include #source/blender/gpu' @@ -43,4 +43,8 @@ if env['OURPLATFORM'] in ('win32-vc', 'win64-vc', 'win32-mingw'): if env['WITH_BF_CXX_GUARDEDALLOC']: defs.append('WITH_CXX_GUARDEDALLOC') +if env['WITH_BF_BULLET']: + defs.append('USE_BULLET') + incs += ' #source/gameengine/Physics/Bullet' + env.BlenderLib ( 'bf_ketsji', sources, Split(incs), defs, libtype=['core','player'], priority=[320,45], cxx_compileflags=env['BGE_CXXFLAGS']) diff --git a/source/gameengine/Physics/Bullet/CMakeLists.txt b/source/gameengine/Physics/Bullet/CMakeLists.txt index 95888967b78..ba6f3bef0db 100644 --- a/source/gameengine/Physics/Bullet/CMakeLists.txt +++ b/source/gameengine/Physics/Bullet/CMakeLists.txt @@ -46,4 +46,8 @@ SET(INC ${PYTHON_INC} ) +IF(WITH_BULLET) + ADD_DEFINITIONS(-DUSE_BULLET) +ENDIF(WITH_BULLET) + BLENDERLIB(bf_bullet "${SRC}" "${INC}") diff --git a/source/gameengine/Physics/Bullet/SConscript b/source/gameengine/Physics/Bullet/SConscript index 6beb044671c..6cebe0638b0 100644 --- a/source/gameengine/Physics/Bullet/SConscript +++ b/source/gameengine/Physics/Bullet/SConscript @@ -30,4 +30,7 @@ else: if env['WITH_BF_CXX_GUARDEDALLOC']: defs.append('WITH_CXX_GUARDEDALLOC') +if env['WITH_BF_BULLET']: + defs.append('USE_BULLET') + env.BlenderLib ( 'bf_bullet', Split(sources), Split(incs), defs, libtype=['core','player'], priority=[350,50], cxx_compileflags=env['BGE_CXXFLAGS']) diff --git a/source/gameengine/Rasterizer/RAS_2DFilterManager.cpp b/source/gameengine/Rasterizer/RAS_2DFilterManager.cpp index 4527850a8e9..0c16d6a29c2 100644 --- a/source/gameengine/Rasterizer/RAS_2DFilterManager.cpp +++ b/source/gameengine/Rasterizer/RAS_2DFilterManager.cpp @@ -431,6 +431,8 @@ void RAS_2DFilterManager::RenderFilters(RAS_ICanvas* canvas) glViewport(0,0, texturewidth, textureheight); glDisable(GL_DEPTH_TEST); + // if the last rendered face had alpha add it would messes with the color of the plane we apply 2DFilter to + glDisable(GL_BLEND); glPushMatrix(); //GL_MODELVIEW glLoadIdentity(); // GL_MODELVIEW glMatrixMode(GL_TEXTURE); diff --git a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_ListRasterizer.cpp b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_ListRasterizer.cpp index 12a255b4e4e..d793a2faf7b 100644 --- a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_ListRasterizer.cpp +++ b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_ListRasterizer.cpp @@ -13,7 +13,7 @@ #include "RAS_TexVert.h" #include "MT_assert.h" -//#ifndef NDEBUG +//#if defined(DEBUG) //#ifdef WIN32 //#define spit(x) std::cout << x << std::endl; //#endif //WIN32 diff --git a/source/gameengine/SConscript b/source/gameengine/SConscript index e7c9328688f..aebbf4d9fcf 100644 --- a/source/gameengine/SConscript +++ b/source/gameengine/SConscript @@ -14,7 +14,6 @@ SConscript(['BlenderRoutines/SConscript', 'Rasterizer/SConscript', 'Rasterizer/RAS_OpenGLRasterizer/SConscript', 'SceneGraph/SConscript', - 'Physics/Bullet/SConscript' ]) if env['WITH_BF_PYTHON']: @@ -22,3 +21,6 @@ if env['WITH_BF_PYTHON']: if env['WITH_BF_PLAYER']: SConscript(['GamePlayer/SConscript']) + +if env['WITH_BF_BULLET']: + SConscript(['Physics/Bullet/SConscript']) diff --git a/source/gameengine/VideoTexture/ImageBuff.cpp b/source/gameengine/VideoTexture/ImageBuff.cpp index 926468c662e..b8a67ccfc40 100644 --- a/source/gameengine/VideoTexture/ImageBuff.cpp +++ b/source/gameengine/VideoTexture/ImageBuff.cpp @@ -147,10 +147,10 @@ void ImageBuff::plot (unsigned char * img, short width, short height, short x, s if (!m_imbuf) { // allocate most basic imbuf, we will assign the rect buffer on the fly - m_imbuf = IMB_allocImBuf(m_size[0], m_size[1], 0, 0, 0); + m_imbuf = IMB_allocImBuf(m_size[0], m_size[1], 0, 0); } - tmpbuf = IMB_allocImBuf(width, height, 0, 0, 0); + tmpbuf = IMB_allocImBuf(width, height, 0, 0); // assign temporarily our buffer to the ImBuf buffer, we use the same format tmpbuf->rect = (unsigned int*)img; @@ -169,11 +169,11 @@ void ImageBuff::plot (ImageBuff* img, short x, short y, short mode) if (!m_imbuf) { // allocate most basic imbuf, we will assign the rect buffer on the fly - m_imbuf = IMB_allocImBuf(m_size[0], m_size[1], 0, 0, 0); + m_imbuf = IMB_allocImBuf(m_size[0], m_size[1], 0, 0); } if (!img->m_imbuf) { // allocate most basic imbuf, we will assign the rect buffer on the fly - img->m_imbuf = IMB_allocImBuf(img->m_size[0], img->m_size[1], 0, 0, 0); + img->m_imbuf = IMB_allocImBuf(img->m_size[0], img->m_size[1], 0, 0); } // assign temporarily our buffer to the ImBuf buffer, we use the same format img->m_imbuf->rect = img->m_image; |