Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2011-09-08 12:29:49 +0400
committerCampbell Barton <ideasman42@gmail.com>2011-09-08 12:29:49 +0400
commit61b6fcd80443691da77a918c5e50e06cc0998c1b (patch)
tree5d8dbcd1edcfe6ca4a23dd4886ed8eb9f7d0ad6c
parente7f21e58de3ac1c590a4a1180723a854e2a6e21a (diff)
parent1f0bb0e0353687c17738608d884077dc6779638d (diff)
svn merge -r39991:40034 https://svn.blender.org/svnroot/bf-blender/trunk/blender
-rw-r--r--CMakeLists.txt11
-rw-r--r--build_files/cmake/Modules/FindOpenCOLLADA.cmake27
-rw-r--r--build_files/cmake/Modules/FindPCRE.cmake43
-rw-r--r--build_files/cmake/Modules/FindXML2.cmake88
-rw-r--r--build_files/scons/config/darwin-config.py2
-rw-r--r--doc/python_api/examples/bge.texture.1.py2
-rw-r--r--doc/python_api/examples/bpy.types.Operator.py2
-rw-r--r--doc/python_api/rst/info_tips_and_tricks.rst158
-rw-r--r--doc/python_api/sphinx_doc_gen.py1
-rw-r--r--release/scripts/modules/bpy_types.py29
-rw-r--r--release/scripts/startup/bl_operators/animsys_update.py1
-rw-r--r--release/scripts/startup/bl_operators/nla.py9
-rw-r--r--release/scripts/startup/bl_ui/properties_data_armature.py12
-rw-r--r--release/scripts/startup/bl_ui/properties_data_modifier.py58
-rw-r--r--release/scripts/startup/bl_ui/properties_data_speaker.py2
-rw-r--r--release/scripts/startup/bl_ui/properties_game.py2
-rw-r--r--release/scripts/startup/bl_ui/space_userpref.py13
-rw-r--r--source/blender/blenkernel/intern/node.c10
-rw-r--r--source/blender/collada/ArmatureExporter.cpp6
-rw-r--r--source/blender/collada/ArmatureExporter.h33
-rw-r--r--source/blender/collada/CMakeLists.txt2
-rw-r--r--source/blender/collada/CameraExporter.cpp6
-rw-r--r--source/blender/collada/CameraExporter.h8
-rw-r--r--source/blender/collada/DocumentExporter.cpp39
-rw-r--r--source/blender/collada/DocumentExporter.h7
-rw-r--r--source/blender/collada/EffectExporter.cpp6
-rw-r--r--source/blender/collada/EffectExporter.h8
-rw-r--r--source/blender/collada/ExportSettings.cpp29
-rw-r--r--source/blender/collada/ExportSettings.h39
-rw-r--r--source/blender/collada/GeometryExporter.cpp6
-rw-r--r--source/blender/collada/GeometryExporter.h8
-rw-r--r--source/blender/collada/ImageExporter.cpp8
-rw-r--r--source/blender/collada/ImageExporter.h10
-rw-r--r--source/blender/collada/LightExporter.cpp6
-rw-r--r--source/blender/collada/LightExporter.h7
-rw-r--r--source/blender/collada/MaterialExporter.cpp6
-rw-r--r--source/blender/collada/MaterialExporter.h6
-rw-r--r--source/blender/collada/SceneExporter.cpp12
-rw-r--r--source/blender/collada/SceneExporter.h16
-rw-r--r--source/blender/collada/collada.cpp9
-rw-r--r--source/blender/editors/include/UI_icons.h2
-rw-r--r--source/blender/editors/space_node/drawnode.c7
-rw-r--r--source/blender/editors/space_node/node_draw.c2
-rw-r--r--source/blender/editors/space_node/node_edit.c32
-rw-r--r--source/blender/editors/space_view3d/view3d_edit.c46
-rw-r--r--source/blender/makesdna/DNA_modifier_types.h4
-rw-r--r--source/blender/makesdna/DNA_userdef_types.h6
-rw-r--r--source/blender/makesrna/intern/rna_modifier.c56
-rw-r--r--source/blender/makesrna/intern/rna_userdef.c30
-rw-r--r--source/blender/modifiers/intern/MOD_weightvg_util.c70
-rw-r--r--source/blender/modifiers/intern/MOD_weightvg_util.h52
-rw-r--r--source/blender/modifiers/intern/MOD_weightvgedit.c62
-rw-r--r--source/blender/modifiers/intern/MOD_weightvgmix.c54
-rw-r--r--source/blender/modifiers/intern/MOD_weightvgproximity.c89
-rw-r--r--source/blender/nodes/composite/node_composite_tree.c37
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_value.c3
-rw-r--r--source/blender/nodes/intern/node_common.c2
-rw-r--r--source/blender/nodes/shader/node_shader_tree.c2
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_value.c3
-rw-r--r--source/blender/python/generic/py_capi_utils.c76
-rw-r--r--source/blender/windowmanager/intern/wm_event_system.c10
61 files changed, 979 insertions, 413 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 8b5693fb1aa..ea89cbddb9f 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -452,15 +452,8 @@ if(UNIX AND NOT APPLE)
if(WITH_OPENCOLLADA)
find_package(OpenCOLLADA)
if(OPENCOLLADA_FOUND)
- set(PCRE /usr CACHE PATH "PCRE Directory")
- mark_as_advanced(PCRE)
- set(PCRE_LIBPATH ${PCRE}/lib)
- set(PCRE_LIB pcre)
-
- set(EXPAT /usr CACHE PATH "Expat Directory")
- mark_as_advanced(EXPAT)
- set(EXPAT_LIBPATH ${EXPAT}/lib)
- set(EXPAT_LIB expat)
+ find_package(XML2)
+ find_package(PCRE)
else()
set(WITH_OPENCOLLADA OFF)
endif()
diff --git a/build_files/cmake/Modules/FindOpenCOLLADA.cmake b/build_files/cmake/Modules/FindOpenCOLLADA.cmake
index c7637283514..a9a1d544507 100644
--- a/build_files/cmake/Modules/FindOpenCOLLADA.cmake
+++ b/build_files/cmake/Modules/FindOpenCOLLADA.cmake
@@ -49,12 +49,14 @@ SET(_opencollada_FIND_COMPONENTS
OpenCOLLADAFramework
OpenCOLLADABaseUtils
GeneratedSaxParser
- UTF
MathMLSolver
- pcre
+)
+
+# Fedora openCOLLADA package links these statically
+SET(_opencollada_FIND_STATIC_COMPONENTS
+ UTF
ftoa
buffer
- xml2
)
SET(_opencollada_SEARCH_DIRS
@@ -104,6 +106,25 @@ FOREACH(COMPONENT ${_opencollada_FIND_COMPONENTS})
LIST(APPEND _opencollada_LIBRARIES "${OPENCOLLADA_${UPPERCOMPONENT}_LIBRARY}")
ENDFOREACH()
+FOREACH(COMPONENT ${_opencollada_FIND_STATIC_COMPONENTS})
+ STRING(TOUPPER ${COMPONENT} UPPERCOMPONENT)
+
+ FIND_LIBRARY(OPENCOLLADA_${UPPERCOMPONENT}_LIBRARY
+ NAMES
+ ${COMPONENT}
+ HINTS
+ ${_opencollada_SEARCH_DIRS}
+ PATH_SUFFIXES
+ lib64 lib
+ # Ubuntu ppa needs this.
+ lib64/opencollada lib/opencollada
+ )
+ IF(OPENCOLLADA_${UPPERCOMPONENT}_LIBRARY)
+ MARK_AS_ADVANCED(OPENCOLLADA_${UPPERCOMPONENT}_LIBRARY)
+ LIST(APPEND _opencollada_LIBRARIES "${OPENCOLLADA_${UPPERCOMPONENT}_LIBRARY}")
+ ENDIF()
+ENDFOREACH()
+
# handle the QUIETLY and REQUIRED arguments and set OPENCOLLADA_FOUND to TRUE if
# all listed variables are TRUE
diff --git a/build_files/cmake/Modules/FindPCRE.cmake b/build_files/cmake/Modules/FindPCRE.cmake
new file mode 100644
index 00000000000..a09375287a6
--- /dev/null
+++ b/build_files/cmake/Modules/FindPCRE.cmake
@@ -0,0 +1,43 @@
+# - Try to find the PCRE regular expression library
+# Once done this will define
+#
+# PCRE_FOUND - system has the PCRE library
+# PCRE_INCLUDE_DIR - the PCRE include directory
+# PCRE_LIBRARIES - The libraries needed to use PCRE
+
+# Copyright (c) 2006, Alexander Neundorf, <neundorf@kde.org>
+#
+# Redistribution and use is allowed according to the terms of the BSD license.
+
+if (PCRE_INCLUDE_DIR AND PCRE_PCREPOSIX_LIBRARY AND PCRE_PCRE_LIBRARY)
+ # Already in cache, be silent
+ set(PCRE_FIND_QUIETLY TRUE)
+endif (PCRE_INCLUDE_DIR AND PCRE_PCREPOSIX_LIBRARY AND PCRE_PCRE_LIBRARY)
+
+if (NOT WIN32)
+ # use pkg-config to get the directories and then use these values
+ # in the FIND_PATH() and FIND_LIBRARY() calls
+ find_package(PkgConfig)
+ pkg_check_modules(PC_PCRE QUIET libpcre)
+ set(PCRE_DEFINITIONS ${PC_PCRE_CFLAGS_OTHER})
+endif (NOT WIN32)
+
+find_path(PCRE_INCLUDE_DIR pcre.h
+ HINTS ${PC_PCRE_INCLUDEDIR} ${PC_PCRE_INCLUDE_DIRS}
+ PATH_SUFFIXES pcre)
+
+find_library(PCRE_PCRE_LIBRARY NAMES pcre HINTS ${PC_PCRE_LIBDIR} ${PC_PCRE_LIBRARY_DIRS})
+
+find_library(PCRE_PCREPOSIX_LIBRARY NAMES pcreposix HINTS ${PC_PCRE_LIBDIR} ${PC_PCRE_LIBRARY_DIRS})
+
+include(FindPackageHandleStandardArgs)
+
+IF(NOT WIN32)
+ find_package_handle_standard_args(PCRE DEFAULT_MSG PCRE_INCLUDE_DIR PCRE_PCRE_LIBRARY PCRE_PCREPOSIX_LIBRARY )
+ mark_as_advanced(PCRE_INCLUDE_DIR PCRE_LIBRARIES PCRE_PCREPOSIX_LIBRARY PCRE_PCRE_LIBRARY)
+ set(PCRE_LIBRARIES ${PCRE_PCRE_LIBRARY} ${PCRE_PCREPOSIX_LIBRARY})
+ELSE()
+ find_package_handle_standard_args(PCRE DEFAULT_MSG PCRE_INCLUDE_DIR PCRE_PCRE_LIBRARY )
+ set(PCRE_LIBRARIES ${PCRE_PCRE_LIBRARY} )
+ mark_as_advanced(PCRE_INCLUDE_DIR PCRE_LIBRARIES PCRE_PCRE_LIBRARY)
+ENDIF()
diff --git a/build_files/cmake/Modules/FindXML2.cmake b/build_files/cmake/Modules/FindXML2.cmake
new file mode 100644
index 00000000000..e9f9fb3ca74
--- /dev/null
+++ b/build_files/cmake/Modules/FindXML2.cmake
@@ -0,0 +1,88 @@
+# - Try to find XML2
+# Once done this will define
+#
+# XML2_FOUND - system has XML2
+# XML2_INCLUDE_DIRS - the XML2 include directory
+# XML2_LIBRARIES - Link these to use XML2
+# XML2_DEFINITIONS - Compiler switches required for using XML2
+#
+# Copyright (c) 2008 Andreas Schneider <mail@cynapses.org>
+#
+# Redistribution and use is allowed according to the terms of the New
+# BSD license.
+#
+
+
+if (XML2_LIBRARIES AND XML2_INCLUDE_DIRS)
+ # in cache already
+ set(XML2_FOUND TRUE)
+else (XML2_LIBRARIES AND XML2_INCLUDE_DIRS)
+ # use pkg-config to get the directories and then use these values
+ # in the FIND_PATH() and FIND_LIBRARY() calls
+ if (${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} EQUAL 4)
+ include(UsePkgConfig)
+ pkgconfig(libxml-2.0 _XML2_INCLUDEDIR _XML2_LIBDIR _XML2_LDFLAGS _XML2_CFLAGS)
+ else (${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} EQUAL 4)
+ find_package(PkgConfig)
+ if (PKG_CONFIG_FOUND)
+ pkg_check_modules(_XML2 libxml-2.0)
+ endif (PKG_CONFIG_FOUND)
+ endif (${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} EQUAL 4)
+ find_path(XML2_INCLUDE_DIR
+ NAMES
+ libxml/xpath.h
+ PATHS
+ ${_XML2_INCLUDEDIR}
+ /usr/include
+ /usr/local/include
+ /opt/local/include
+ /sw/include
+ PATH_SUFFIXES
+ libxml2
+ )
+
+ find_library(XML2_LIBRARY
+ NAMES
+ xml2
+ PATHS
+ ${_XML2_LIBDIR}
+ /usr/lib
+ /usr/local/lib
+ /opt/local/lib
+ /sw/lib
+ )
+
+ if (XML2_LIBRARY)
+ set(XML2_FOUND TRUE)
+ endif (XML2_LIBRARY)
+
+ set(XML2_INCLUDE_DIRS
+ ${XML2_INCLUDE_DIR}
+ )
+
+ if (XML2_FOUND)
+ set(XML2_LIBRARIES
+ ${XML2_LIBRARIES}
+ ${XML2_LIBRARY}
+ )
+ endif (XML2_FOUND)
+
+ if (XML2_INCLUDE_DIRS AND XML2_LIBRARIES)
+ set(XML2_FOUND TRUE)
+ endif (XML2_INCLUDE_DIRS AND XML2_LIBRARIES)
+
+ if (XML2_FOUND)
+ if (NOT XML2_FIND_QUIETLY)
+ message(STATUS "Found XML2: ${XML2_LIBRARIES}")
+ endif (NOT XML2_FIND_QUIETLY)
+ else (XML2_FOUND)
+ if (XML2_FIND_REQUIRED)
+ message(FATAL_ERROR "Could not find XML2")
+ endif (XML2_FIND_REQUIRED)
+ endif (XML2_FOUND)
+
+ # show the XML2_INCLUDE_DIRS and XML2_LIBRARIES variables only in the advanced view
+ mark_as_advanced(XML2_INCLUDE_DIRS XML2_LIBRARIES)
+
+endif (XML2_LIBRARIES AND XML2_INCLUDE_DIRS)
+
diff --git a/build_files/scons/config/darwin-config.py b/build_files/scons/config/darwin-config.py
index 102ec73a4e3..29d2b39323e 100644
--- a/build_files/scons/config/darwin-config.py
+++ b/build_files/scons/config/darwin-config.py
@@ -14,7 +14,7 @@ USE_SDK=True
################### Cocoa & architecture settings ##################
#############################################################################
WITH_GHOST_COCOA=True
-MACOSX_ARCHITECTURE = 'x86_64' # valid archs: ppc, i386, ppc64, x86_64
+MACOSX_ARCHITECTURE = 'i386' # valid archs: ppc, i386, ppc64, x86_64
cmd = 'uname -p'
diff --git a/doc/python_api/examples/bge.texture.1.py b/doc/python_api/examples/bge.texture.1.py
index faa0ae736e8..4be6f51de67 100644
--- a/doc/python_api/examples/bge.texture.1.py
+++ b/doc/python_api/examples/bge.texture.1.py
@@ -14,7 +14,7 @@ def createTexture(cont):
object = cont.owner
# get the reference pointer (ID) of the internal texture
- ID = texture.materialID(obj, 'IMoriginal.png')
+ ID = texture.materialID(object, 'IMoriginal.png')
# create a texture object
object_texture = texture.Texture(object, ID)
diff --git a/doc/python_api/examples/bpy.types.Operator.py b/doc/python_api/examples/bpy.types.Operator.py
index 52edfa0a61b..0981712e1ff 100644
--- a/doc/python_api/examples/bpy.types.Operator.py
+++ b/doc/python_api/examples/bpy.types.Operator.py
@@ -21,7 +21,7 @@ class HelloWorldOperator(bpy.types.Operator):
print("Hello World")
return {'FINISHED'}
-bpy.utils.register_class(SimpleOperator)
+bpy.utils.register_class(HelloWorldOperator)
# test call to the newly defined operator
bpy.ops.wm.hello_world()
diff --git a/doc/python_api/rst/info_tips_and_tricks.rst b/doc/python_api/rst/info_tips_and_tricks.rst
index f4e68a4516c..00766508056 100644
--- a/doc/python_api/rst/info_tips_and_tricks.rst
+++ b/doc/python_api/rst/info_tips_and_tricks.rst
@@ -2,7 +2,9 @@
Tips and Tricks
***************
-Some of these are just python features that scripters may not have thaught to use with blender.
+Here are various suggestions that you might find useful when writing scripts.
+
+Some of these are just python features that scripters may not have thought to use with blender, others are blender specific.
Use The Terminal
@@ -14,44 +16,36 @@ There are 3 main uses for the terminal, these are:
* You can see the output of `print()` as you're script runs, which is useful to view debug info.
-* The error tracebacks are printed in full to the terminal which wont always generate an error popup in blenders user interface (depending on how the script is executed).
+* The error trace-back is printed in full to the terminal which wont always generate an error popup in blenders user interface (depending on how the script is executed).
-* If the script runs for too long or you accidentally enter an infinate loop, Ctrl+C in the terminal (Ctrl+Break on Windows) will quit the script early.
+* If the script runs for too long or you accidentally enter an infinite loop, Ctrl+C in the terminal (Ctrl+Break on Windows) will quit the script early.
.. note::
For Linux and OSX users this means starting the terminal first, then running blender from within it. On Windows the terminal can be enabled from the help menu.
-Run External Scripts
-====================
+Use an External Editor
+======================
-Blenders text editor is fine for edits and writing small tests but it is not a full featured editor so for larger projects you'll probably want to use an external editor.
+Blenders text editor is fine for small changes and writing tests but its not full featured, for larger projects you'll probably want to use a standalone editor or python IDE.
Editing a text file externally and having the same text open in blender does work but isn't that optimal so here are 2 ways you can easily use an external file from blender.
Executing External Scripts
-^^^^^^^^^^^^^^^^^^^^^^^^^^
+--------------------------
-This is the equivilent to running the script directly, referencing a scripts path from a 2 line textblock.
+This is the equivalent to running the script directly, referencing a scripts path from a 2 line textblock.
-.. code-block::
+.. code-block:: python
filename = "/full/path/to/myscript.py"
exec(compile(open(filename).read(), filename, 'exec'))
-You might also want to reference the file relative to the blend file.
-
-.. code-block::
-
- filename = "/full/path/to/script.py"
- exec(compile(open(filename).read(), filename, 'exec'))
-
-
-You might want to reference a script thats at the same location as the blend file.
+You might want to reference a script relative to the blend file.
-.. code-block::
+.. code-block:: python
import bpy
import os
@@ -61,11 +55,11 @@ You might want to reference a script thats at the same location as the blend fil
Executing Modules
-^^^^^^^^^^^^^^^^^
+-----------------
This example shows loading a script in as a module and executing a module function.
-.. code-block::
+.. code-block:: python
import myscript
import imp
@@ -74,18 +68,18 @@ This example shows loading a script in as a module and executing a module functi
myscript.main()
-Notice that the script is reloaded every time, this forces an update, normally the module stays cached in `sys.modules`.
+Notice that the script is reloaded every time, this forces use of the modified version otherwise the cached one in `sys.modules` would be used until blender was restarted.
-The main difference between this and executing the script directly is it has to call a function in the module, in this case `main()` but it can be any function, an advantage with this is you can pass argumnents to the function from this small script which is often useful for testing differnt settings quickly.
+The important difference between this and executing the script directly is it has to call a function in the module, in this case `main()` but it can be any function, an advantage with this is you can pass arguments to the function from this small script which is often useful for testing different settings quickly.
The other issue with this is the script has to be in pythons module search path.
While this is not best practice - for testing you can extend the search path, this example adds the current blend files directory to the search path, then loads the script as a module.
-.. code-block::
+.. code-block:: python
import sys
import os
- impory bpy
+ import bpy
blend_dir = os.path.basename(bpy.data.filepath)
if blend_dir not in sys.path:
@@ -100,21 +94,103 @@ While this is not best practice - for testing you can extend the search path, th
Don't Use Blender!
==================
+While developing your own scripts blenders interface can get in the way, manually reloading, running the scripts, opening file import etc. adds overhead.
+
+For scripts that are not interactive it can end up being more efficient not to use blenders interface at all and instead execute the script on the command line.
+
+.. code-block:: python
+
+ blender --background --python myscript.py
+
+
+You might want to run this with a blend file so the script has some data to operate on.
+
+.. code-block:: python
+
+ blender myscene.blend --background --python myscript.py
+
+
+.. note::
+
+ Depending on you're setup you might have to enter the full path to the blender executable.
+
+
+Once the script is running properly in background mode, you'll want to check the output of the script, this depends completely on the task at hand however here are some suggestions.
+
+* render the output to an image, use an image viewer and keep writing over the same image each time.
+
+* save a new blend file, or export the file using one of blenders exporters.
+
+* if the results can be displayed as text - print them or write them to a file.
+
+
+This can take a little time to setup, but it can be well worth the effort to reduce the time it takes to test changes - you can even have blender running the script ever few seconds with a viewer updating the results, so no need to leave you're text editor to see changes.
+
Use External Tools
==================
+When there are no readily available python modules to perform specific tasks its worth keeping in mind you may be able to have python execute an external command on you're data and read the result back in.
+
+Using external programs adds an extra dependency and may limit who can use the script but to quickly setup you're own custom pipeline or writing one-off scripts this can be handy.
+
+Examples include:
+
+* Run The Gimp in batch mode to execute custom scripts for advanced image processing.
+
+* Write out 3D models to use external mesh manipulation tools and read back in the results.
+
+* Convert files into recognizable formats before reading.
-Bundled Python
-==============
-Blender from blender.org includes a compleate python installation on all platforms, this has the disadvantage that any extensions you have installed in you're systems python wont be found by blender.
+Bundled Python & Extensions
+===========================
+
+The Blender releases distributed from blender.org include a complete python installation on all platforms, this has the disadvantage that any extensions you have installed in you're systems python wont be found by blender.
There are 2 ways around this:
-* remove blender python subdirectory, blender will then look for the systems python and use that instead **python version must match the one that blender comes with**.
+* remove blender python sub-directory, blender will then fallback on the systems python and use that instead **python version must match the one that blender comes with**.
+
+* copy the extensions into blender's python sub-directory so blender can access them, you could also copy the entire python installation into blenders sub-directory, replacing the one blender comes with. This works as long as the python versions match and the paths are created in the same relative locations. Doing this has the advantage that you can redistribute this bundle to others with blender and/or the game player, including any extensions you rely on.
+
+
+Drop Into a Python Interpreter in You're Script
+===============================================
+
+In the middle of a script you may want to inspect some variables, run some function and generally dig about to see whats going on.
+
+.. code-block:: python
+
+ import code
+ code.interact(locals=locals())
+
+
+If you want to access both global and local variables do this...
+
+.. code-block:: python
+
+ import code
+ namespace = globals().copy()
+ namespace.update(locals())
+ code.interact(locals=namespace)
+
+
+The next example is an equivalent single line version of the script above which is easier to paste into you're code:
+
+.. code-block:: python
+
+ __import__('code').interact(locals={k: v for ns in (globals(), locals()) for k, v in ns.items()})
+
-* copy the extensions into blender's python subdirectry so blender can access them, you could also copy the entire python installation into blenders subdirectory, replacing the one blender comes with. This works as long as the python versions match and the paths are created in the same location relative locations. Doing this has the advantage that you can redistribute this bundle to others with blender and/or the game player, including any extensions you rely on.
+`code.interact` can be added at any line in the script and will pause the script an launch an interactive interpreter in the terminal, when you're done you can quit the interpreter and the script will continue execution.
+
+
+Admittedly this highlights the lack of any python debugging support built into blender, but its still handy to know.
+
+.. note::
+
+ This works in the game engine as well, it can be handy to inspect the state of a running game.
Advanced
@@ -124,10 +200,28 @@ Advanced
Blender as a module
-------------------
+From a python perspective its nicer to have everything as an extension which lets the python script combine many components.
+
+Advantages include:
+
+* you can use external editors/IDE's with blenders python API and execute scripts within the IDE (step over code, inspect variables as the script runs).
+
+* editors/IDE's can auto complete blender modules & variables.
+
+* existing scripts can import blender API's without having to run inside blender.
+
+
+This is marked advanced because to run blender as a python module requires a special build option.
+
+For instructions on building see `Building blender as a python module <http://wiki.blender.org/index.php/User:Ideasman42/BlenderAsPyModule>`_
+
Python Safety (Build Option)
----------------------------
+Since its possible to accessed data which has been removed (see Gotcha's), this can be a hard to track down the cause of crashes.
+
+To raise python exceptions on accessing freed data (rather then crashing), enable the CMake build option WITH_PYTHON_SAFETY.
+
+This enables data tracking which makes data access about 2x slower which is why the option is not enabled in release builds.
-CTypes in Blender
------------------
diff --git a/doc/python_api/sphinx_doc_gen.py b/doc/python_api/sphinx_doc_gen.py
index 661d41af4ef..a7657fad432 100644
--- a/doc/python_api/sphinx_doc_gen.py
+++ b/doc/python_api/sphinx_doc_gen.py
@@ -103,6 +103,7 @@ sphinx-build doc/python_api/sphinx-in doc/python_api/sphinx-out
INFO_DOCS = (
("info_quickstart.rst", "Blender/Python Quickstart: new to blender/scripting and want to get you're feet wet?"),
("info_overview.rst", "Blender/Python API Overview: a more complete explanation of python integration"),
+ ("info_tips_and_tricks.rst", "Tips and Tricks: Hints to help you while writeing scripts for blender"),
("info_gotcha.rst", "Gotcha's: some of the problems you may come up against when writing scripts"),
)
diff --git a/release/scripts/modules/bpy_types.py b/release/scripts/modules/bpy_types.py
index 4a5de9f9e57..1446e45e5f0 100644
--- a/release/scripts/modules/bpy_types.py
+++ b/release/scripts/modules/bpy_types.py
@@ -353,7 +353,10 @@ class Mesh(bpy_types.ID):
@property
def edge_keys(self):
- return [edge_key for face in self.faces for edge_key in face.edge_keys]
+ return list({edge_key
+ for face in self.faces
+ for edge_key in face.edge_keys
+ })
class MeshEdge(StructRNA):
@@ -373,17 +376,31 @@ class MeshFace(StructRNA):
face_verts = self.vertices[:]
mesh_verts = self.id_data.vertices
if len(face_verts) == 3:
- return (mesh_verts[face_verts[0]].co + mesh_verts[face_verts[1]].co + mesh_verts[face_verts[2]].co) / 3.0
+ return (mesh_verts[face_verts[0]].co +
+ mesh_verts[face_verts[1]].co +
+ mesh_verts[face_verts[2]].co
+ ) / 3.0
else:
- return (mesh_verts[face_verts[0]].co + mesh_verts[face_verts[1]].co + mesh_verts[face_verts[2]].co + mesh_verts[face_verts[3]].co) / 4.0
+ return (mesh_verts[face_verts[0]].co +
+ mesh_verts[face_verts[1]].co +
+ mesh_verts[face_verts[2]].co +
+ mesh_verts[face_verts[3]].co
+ ) / 4.0
@property
def edge_keys(self):
verts = self.vertices[:]
if len(verts) == 3:
- return ord_ind(verts[0], verts[1]), ord_ind(verts[1], verts[2]), ord_ind(verts[2], verts[0])
-
- return ord_ind(verts[0], verts[1]), ord_ind(verts[1], verts[2]), ord_ind(verts[2], verts[3]), ord_ind(verts[3], verts[0])
+ return (ord_ind(verts[0], verts[1]),
+ ord_ind(verts[1], verts[2]),
+ ord_ind(verts[2], verts[0]),
+ )
+ else:
+ return (ord_ind(verts[0], verts[1]),
+ ord_ind(verts[1], verts[2]),
+ ord_ind(verts[2], verts[3]),
+ ord_ind(verts[3], verts[0]),
+ )
class Text(bpy_types.ID):
diff --git a/release/scripts/startup/bl_operators/animsys_update.py b/release/scripts/startup/bl_operators/animsys_update.py
index 3710c57ac16..23b9cf13f07 100644
--- a/release/scripts/startup/bl_operators/animsys_update.py
+++ b/release/scripts/startup/bl_operators/animsys_update.py
@@ -685,7 +685,6 @@ data_path_update = [
]
-import bpy
from bpy.types import Operator
diff --git a/release/scripts/startup/bl_operators/nla.py b/release/scripts/startup/bl_operators/nla.py
index c764f7d62f1..feb0016b1c7 100644
--- a/release/scripts/startup/bl_operators/nla.py
+++ b/release/scripts/startup/bl_operators/nla.py
@@ -271,7 +271,8 @@ class BakeAction(Operator):
class ClearUselessActions(Operator):
- '''Mark actions with no F-Curves for deletion after save+reload of file preserving "action libraries"'''
+ '''Mark actions with no F-Curves for deletion after save+reload of ''' \
+ '''file preserving "action libraries"'''
bl_idname = "anim.clear_useless_actions"
bl_label = "Clear Useless Actions"
bl_options = {'REGISTER', 'UNDO'}
@@ -292,12 +293,14 @@ class ClearUselessActions(Operator):
if ((self.only_unused is False) or
(action.use_fake_user and action.users == 1)):
- # if it has F-Curves, then it's a "action library" (i.e. walk, wave, jump, etc.)
+ # if it has F-Curves, then it's a "action library"
+ # (i.e. walk, wave, jump, etc.)
# and should be left alone as that's what fake users are for!
if not action.fcurves:
# mark action for deletion
action.user_clear()
removed += 1
- self.report({'INFO'}, "Removed %d empty and/or fake-user only Actions" % (removed))
+ self.report({'INFO'}, "Removed %d empty and/or fake-user only Actions"
+ % removed)
return {'FINISHED'}
diff --git a/release/scripts/startup/bl_ui/properties_data_armature.py b/release/scripts/startup/bl_ui/properties_data_armature.py
index 463ba84470f..61093abe814 100644
--- a/release/scripts/startup/bl_ui/properties_data_armature.py
+++ b/release/scripts/startup/bl_ui/properties_data_armature.py
@@ -74,6 +74,7 @@ class DATA_PT_skeleton(ArmatureButtonsPanel, Panel):
if context.scene.render.engine == "BLENDER_GAME":
layout.row().prop(arm, "vert_deformer", expand=True)
+
class DATA_PT_display(ArmatureButtonsPanel, Panel):
bl_label = "Display"
@@ -185,11 +186,10 @@ class DATA_PT_pose_library(ArmatureButtonsPanel, Panel):
layout.template_ID(ob, "pose_library", new="poselib.new", unlink="poselib.unlink")
if poselib:
-
- # list of poses in pose library
+ # list of poses in pose library
row = layout.row()
row.template_list(poselib, "pose_markers", poselib.pose_markers, "active_index", rows=5)
-
+
# column of operators for active pose
# - goes beside list
col = row.column(align=True)
@@ -206,9 +206,9 @@ class DATA_PT_pose_library(ArmatureButtonsPanel, Panel):
if pose_marker_active is not None:
col.operator("poselib.pose_remove", icon='ZOOMOUT', text="").pose = pose_marker_active.name
col.operator("poselib.apply_pose", icon='ZOOM_SELECTED', text="").pose_index = poselib.pose_markers.active_index
-
- col.operator("poselib.action_sanitise", icon='HELP', text="") # XXX: put in menu?
-
+
+ col.operator("poselib.action_sanitise", icon='HELP', text="") # XXX: put in menu?
+
# properties for active marker
if pose_marker_active is not None:
layout.prop(pose_marker_active, "name")
diff --git a/release/scripts/startup/bl_ui/properties_data_modifier.py b/release/scripts/startup/bl_ui/properties_data_modifier.py
index 875ace10c6d..c600debe935 100644
--- a/release/scripts/startup/bl_ui/properties_data_modifier.py
+++ b/release/scripts/startup/bl_ui/properties_data_modifier.py
@@ -742,22 +742,23 @@ class DATA_PT_modifiers(ModifierButtonsPanel, Panel):
col.prop(md, "narrowness", slider=True)
@staticmethod
- def weight_vg_mask(layout, ob, md):
+ def vertex_weight_mask(layout, ob, md):
layout.label(text="Influence/Mask Options:")
- split = layout.split()
- col1 = split.column()
- col2 = split.column()
+ row = layout.row()
- col1.label(text="Global Influence:")
- col2.prop(md, "mask_constant", text="")
+ split = layout.split(percentage=0.4)
+ split.label(text="Global Influence:")
+ split.prop(md, "mask_constant", text="")
if not md.mask_texture:
- col1.label(text="Vertex Group Mask:")
- col2.prop_search(md, "mask_vertex_group", ob, "vertex_groups", text="")
+ split = layout.split(percentage=0.4)
+ split.label(text="Vertex Group Mask:")
+ split.prop_search(md, "mask_vertex_group", ob, "vertex_groups", text="")
if not md.mask_vertex_group:
- col1.label(text="Texture Mask:")
- col2.template_ID(md, "mask_texture", new="texture.new")
+ split = layout.split(percentage=0.4)
+ split.label(text="Texture Mask:")
+ split.template_ID(md, "mask_texture", new="texture.new")
if md.mask_texture:
split = layout.split()
col = split.column()
@@ -772,7 +773,7 @@ class DATA_PT_modifiers(ModifierButtonsPanel, Panel):
elif md.mask_tex_mapping == 'UV' and ob.type == 'MESH':
layout.prop_search(md, "mask_tex_uv_layer", ob.data, "uv_textures")
- def WEIGHT_VGEDIT(self, layout, ob, md):
+ def VERTEX_WEIGHT_EDIT(self, layout, ob, md):
if ob.type == 'MESH':
split = layout.split()
col = split.column()
@@ -783,25 +784,28 @@ class DATA_PT_modifiers(ModifierButtonsPanel, Panel):
col.label(text="Default Weight:")
col.prop(md, "default_weight", text="")
- layout.prop(md, "mapping_mode")
- if md.mapping_mode == 'CURVE':
+ layout.prop(md, "falloff_type")
+ if md.falloff_type == 'CURVE':
col = layout.column()
col.template_curve_mapping(md, "map_curve")
- row = layout.row()
- row.prop(md, "use_add")
- row.prop(md, "use_remove")
- row = layout.row()
- if md.use_add:
- row.prop(md, "add_threshold")
- if md.use_remove:
- row.prop(md, "remove_threshold")
+ split = layout.split(percentage=0.4)
+ split.prop(md, "use_add")
+ row = split.row()
+ row.active = md.use_add
+ row.prop(md, "add_threshold")
+
+ split = layout.split(percentage=0.4)
+ split.prop(md, "use_remove")
+ row = split.row()
+ row.active = md.use_remove
+ row.prop(md, "remove_threshold")
# Common mask options…
layout.separator()
- self.weight_vg_mask(layout, ob, md)
+ self.vertex_weight_mask(layout, ob, md)
- def WEIGHT_VGMIX(self, layout, ob, md):
+ def VERTEX_WEIGHT_MIX(self, layout, ob, md):
if ob.type == 'MESH':
split = layout.split()
col = split.column()
@@ -824,9 +828,9 @@ class DATA_PT_modifiers(ModifierButtonsPanel, Panel):
# Common mask options…
layout.separator()
- self.weight_vg_mask(layout, ob, md)
+ self.vertex_weight_mask(layout, ob, md)
- def WEIGHT_VGPROXIMITY(self, layout, ob, md):
+ def VERTEX_WEIGHT_PROXIMITY(self, layout, ob, md):
if ob.type == 'MESH':
split = layout.split()
col = split.column()
@@ -847,11 +851,11 @@ class DATA_PT_modifiers(ModifierButtonsPanel, Panel):
row.prop(md, "min_dist")
row.prop(md, "max_dist")
- layout.prop(md, "mapping_mode")
+ layout.prop(md, "falloff_type")
# Common mask options…
layout.separator()
- self.weight_vg_mask(layout, ob, md)
+ self.vertex_weight_mask(layout, ob, md)
if __name__ == "__main__": # only for live edit.
bpy.utils.register_module(__name__)
diff --git a/release/scripts/startup/bl_ui/properties_data_speaker.py b/release/scripts/startup/bl_ui/properties_data_speaker.py
index 657c0fe652a..a1b86b51f5f 100644
--- a/release/scripts/startup/bl_ui/properties_data_speaker.py
+++ b/release/scripts/startup/bl_ui/properties_data_speaker.py
@@ -81,7 +81,7 @@ class DATA_PT_distance(DataButtonsPanel, bpy.types.Panel):
speaker = context.speaker
split = layout.split()
-
+
col = split.column()
col.label("Volume:")
col.prop(speaker, "volume_min", text="Minimum")
diff --git a/release/scripts/startup/bl_ui/properties_game.py b/release/scripts/startup/bl_ui/properties_game.py
index 161e4b10cff..5ea55d82471 100644
--- a/release/scripts/startup/bl_ui/properties_game.py
+++ b/release/scripts/startup/bl_ui/properties_game.py
@@ -344,7 +344,7 @@ class RENDER_PT_game_performance(RenderButtonsPanel, Panel):
row = col.row()
row.prop(gs, "use_frame_rate")
row.prop(gs, "use_display_lists")
-
+
col.prop(gs, "restrict_animation_updates")
diff --git a/release/scripts/startup/bl_ui/space_userpref.py b/release/scripts/startup/bl_ui/space_userpref.py
index 13edc3471d2..67aca5eb4c1 100644
--- a/release/scripts/startup/bl_ui/space_userpref.py
+++ b/release/scripts/startup/bl_ui/space_userpref.py
@@ -773,7 +773,18 @@ class USERPREF_MT_ndof_settings(Menu):
layout.separator()
layout.label(text="orbit options")
- layout.prop(input_prefs, "ndof_orbit_invert_axes")
+ if input_prefs.view_rotate_method == 'TRACKBALL':
+ layout.prop(input_prefs, "ndof_roll_invert_axis")
+ layout.prop(input_prefs, "ndof_tilt_invert_axis")
+ layout.prop(input_prefs, "ndof_rotate_invert_axis")
+ else:
+ layout.prop(input_prefs, "ndof_orbit_invert_axes")
+
+ layout.separator()
+ layout.label(text="pan options")
+ layout.prop(input_prefs, "ndof_panx_invert_axis")
+ layout.prop(input_prefs, "ndof_pany_invert_axis")
+ layout.prop(input_prefs, "ndof_panz_invert_axis")
layout.separator()
layout.label(text="fly options")
diff --git a/source/blender/blenkernel/intern/node.c b/source/blender/blenkernel/intern/node.c
index 292f38b9472..d40b030c470 100644
--- a/source/blender/blenkernel/intern/node.c
+++ b/source/blender/blenkernel/intern/node.c
@@ -398,6 +398,11 @@ bNode *nodeCopyNode(struct bNodeTree *ntree, struct bNode *node)
sock->stack_index= 0;
sock->default_value = (oldsock->default_value ? MEM_dupallocN(oldsock->default_value) : NULL);
+
+ /* XXX some compositor node (e.g. image, render layers) still store
+ * some persistent buffer data here, need to clear this to avoid dangling pointers.
+ */
+ sock->cache = NULL;
}
BLI_duplicatelist(&nnode->outputs, &node->outputs);
@@ -407,6 +412,11 @@ bNode *nodeCopyNode(struct bNodeTree *ntree, struct bNode *node)
sock->stack_index= 0;
sock->default_value = (oldsock->default_value ? MEM_dupallocN(oldsock->default_value) : NULL);
+
+ /* XXX some compositor node (e.g. image, render layers) still store
+ * some persistent buffer data here, need to clear this to avoid dangling pointers.
+ */
+ sock->cache = NULL;
}
/* don't increase node->id users, freenode doesn't decrement either */
diff --git a/source/blender/collada/ArmatureExporter.cpp b/source/blender/collada/ArmatureExporter.cpp
index de01c000373..431c67833f1 100644
--- a/source/blender/collada/ArmatureExporter.cpp
+++ b/source/blender/collada/ArmatureExporter.cpp
@@ -49,7 +49,7 @@
// XXX exporter writes wrong data for shared armatures. A separate
// controller should be written for each armature-mesh binding how do
// we make controller ids then?
-ArmatureExporter::ArmatureExporter(COLLADASW::StreamWriter *sw) : COLLADASW::LibraryControllers(sw) {}
+ArmatureExporter::ArmatureExporter(COLLADASW::StreamWriter *sw, const ExportSettings *export_settings) : COLLADASW::LibraryControllers(sw), export_settings(export_settings) {}
// write bone nodes
void ArmatureExporter::add_armature_bones(Object *ob_arm, Scene *sce)
@@ -90,14 +90,14 @@ void ArmatureExporter::add_instance_controller(Object *ob)
ins.add();
}
-void ArmatureExporter::export_controllers(Scene *sce, bool export_selected)
+void ArmatureExporter::export_controllers(Scene *sce)
{
scene = sce;
openLibrary();
GeometryFunctor gf;
- gf.forEachMeshObjectInScene<ArmatureExporter>(sce, *this, export_selected);
+ gf.forEachMeshObjectInScene<ArmatureExporter>(sce, *this, this->export_settings->selected);
closeLibrary();
}
diff --git a/source/blender/collada/ArmatureExporter.h b/source/blender/collada/ArmatureExporter.h
index b3441c797e8..554a8a7cfe6 100644
--- a/source/blender/collada/ArmatureExporter.h
+++ b/source/blender/collada/ArmatureExporter.h
@@ -47,16 +47,15 @@
#include "TransformWriter.h"
#include "InstanceWriter.h"
+#include "ExportSettings.h"
+
// XXX exporter writes wrong data for shared armatures. A separate
// controller should be written for each armature-mesh binding how do
// we make controller ids then?
class ArmatureExporter: public COLLADASW::LibraryControllers, protected TransformWriter, protected InstanceWriter
{
-private:
- Scene *scene;
-
public:
- ArmatureExporter(COLLADASW::StreamWriter *sw);
+ ArmatureExporter(COLLADASW::StreamWriter *sw, const ExportSettings *export_settings);
// write bone nodes
void add_armature_bones(Object *ob_arm, Scene *sce);
@@ -65,13 +64,14 @@ public:
void add_instance_controller(Object *ob);
- void export_controllers(Scene *sce, bool export_selected);
+ void export_controllers(Scene *sce);
void operator()(Object *ob);
private:
-
+ Scene *scene;
UnitConverter converter;
+ const ExportSettings *export_settings;
#if 0
std::vector<Object*> written_armatures;
@@ -119,25 +119,4 @@ private:
Object *ob_arm, ListBase *defbase);
};
-/*
-struct GeometryFunctor {
- // f should have
- // void operator()(Object* ob)
- template<class Functor>
- void forEachMeshObjectInScene(Scene *sce, Functor &f)
- {
-
- Base *base= (Base*) sce->base.first;
- while(base) {
- Object *ob = base->object;
-
- if (ob->type == OB_MESH && ob->data) {
- f(ob);
- }
- base= base->next;
-
- }
- }
-};*/
-
#endif
diff --git a/source/blender/collada/CMakeLists.txt b/source/blender/collada/CMakeLists.txt
index cc7229383e3..2ee34091fc9 100644
--- a/source/blender/collada/CMakeLists.txt
+++ b/source/blender/collada/CMakeLists.txt
@@ -52,6 +52,7 @@ set(SRC
DocumentImporter.cpp
EffectExporter.cpp
ErrorHandler.cpp
+ ExportSettings.cpp
ExtraHandler.cpp
ExtraTags.cpp
GeometryExporter.cpp
@@ -77,6 +78,7 @@ set(SRC
DocumentImporter.h
EffectExporter.h
ErrorHandler.h
+ ExportSettings.h
ExtraHandler.h
ExtraTags.h
GeometryExporter.h
diff --git a/source/blender/collada/CameraExporter.cpp b/source/blender/collada/CameraExporter.cpp
index a935f45c403..542409072f1 100644
--- a/source/blender/collada/CameraExporter.cpp
+++ b/source/blender/collada/CameraExporter.cpp
@@ -39,7 +39,7 @@
#include "collada_internal.h"
-CamerasExporter::CamerasExporter(COLLADASW::StreamWriter *sw): COLLADASW::LibraryCameras(sw){}
+CamerasExporter::CamerasExporter(COLLADASW::StreamWriter *sw, const ExportSettings *export_settings): COLLADASW::LibraryCameras(sw), export_settings(export_settings) {}
template<class Functor>
void forEachCameraObjectInScene(Scene *sce, Functor &f, bool export_selected)
@@ -56,11 +56,11 @@ void forEachCameraObjectInScene(Scene *sce, Functor &f, bool export_selected)
}
}
-void CamerasExporter::exportCameras(Scene *sce, bool export_selected)
+void CamerasExporter::exportCameras(Scene *sce)
{
openLibrary();
- forEachCameraObjectInScene(sce, *this, export_selected);
+ forEachCameraObjectInScene(sce, *this, this->export_settings->selected);
closeLibrary();
}
diff --git a/source/blender/collada/CameraExporter.h b/source/blender/collada/CameraExporter.h
index 999a6ddd3e5..8d08fe23f80 100644
--- a/source/blender/collada/CameraExporter.h
+++ b/source/blender/collada/CameraExporter.h
@@ -36,12 +36,16 @@
#include "DNA_object_types.h"
#include "DNA_scene_types.h"
+#include "ExportSettings.h"
+
class CamerasExporter: COLLADASW::LibraryCameras
{
public:
- CamerasExporter(COLLADASW::StreamWriter *sw);
- void exportCameras(Scene *sce, bool export_selected);
+ CamerasExporter(COLLADASW::StreamWriter *sw, const ExportSettings *export_settings);
+ void exportCameras(Scene *sce);
void operator()(Object *ob, Scene *sce);
+private:
+ const ExportSettings *export_settings;
};
#endif
diff --git a/source/blender/collada/DocumentExporter.cpp b/source/blender/collada/DocumentExporter.cpp
index 85f37d29f22..d562e51b922 100644
--- a/source/blender/collada/DocumentExporter.cpp
+++ b/source/blender/collada/DocumentExporter.cpp
@@ -110,6 +110,7 @@ extern char build_rev[];
#include "collada_internal.h"
#include "DocumentExporter.h"
+#include "ExportSettings.h"
// can probably go after refactor is complete
#include "InstanceWriter.h"
@@ -145,11 +146,13 @@ char *bc_CustomData_get_active_layer_name(const CustomData *data, int type)
return data->layers[layer_index].name;
}
+DocumentExporter::DocumentExporter(const ExportSettings *export_settings) : export_settings(export_settings) {}
+
// TODO: it would be better to instantiate animations rather than create a new one per object
// COLLADA allows this through multiple <channel>s in <animation>.
// For this to work, we need to know objects that use a certain action.
-void DocumentExporter::exportCurrentScene(Scene *sce, const char* filename, bool selected)
+void DocumentExporter::exportCurrentScene(Scene *sce)
{
PointerRNA sceneptr, unit_settings;
PropertyRNA *system; /* unused , *scale; */
@@ -157,7 +160,7 @@ void DocumentExporter::exportCurrentScene(Scene *sce, const char* filename, bool
clear_global_id_map();
COLLADABU::NativeString native_filename =
- COLLADABU::NativeString(std::string(filename));
+ COLLADABU::NativeString(std::string(this->export_settings->filepath));
COLLADASW::StreamWriter sw(native_filename);
// open <collada>
@@ -227,32 +230,32 @@ void DocumentExporter::exportCurrentScene(Scene *sce, const char* filename, bool
// <library_cameras>
if(has_object_type(sce, OB_CAMERA)) {
- CamerasExporter ce(&sw);
- ce.exportCameras(sce, selected);
+ CamerasExporter ce(&sw, this->export_settings);
+ ce.exportCameras(sce);
}
// <library_lights>
if(has_object_type(sce, OB_LAMP)) {
- LightsExporter le(&sw);
- le.exportLights(sce, selected);
+ LightsExporter le(&sw, this->export_settings);
+ le.exportLights(sce);
}
// <library_images>
- ImagesExporter ie(&sw, filename);
- ie.exportImages(sce, selected);
+ ImagesExporter ie(&sw, this->export_settings);
+ ie.exportImages(sce);
// <library_effects>
- EffectsExporter ee(&sw);
- ee.exportEffects(sce, selected);
+ EffectsExporter ee(&sw, this->export_settings);
+ ee.exportEffects(sce);
// <library_materials>
- MaterialsExporter me(&sw);
- me.exportMaterials(sce, selected);
+ MaterialsExporter me(&sw, this->export_settings);
+ me.exportMaterials(sce);
// <library_geometries>
if(has_object_type(sce, OB_MESH)) {
- GeometryExporter ge(&sw);
- ge.exportGeom(sce, selected);
+ GeometryExporter ge(&sw, this->export_settings);
+ ge.exportGeom(sce);
}
// <library_animations>
@@ -260,14 +263,14 @@ void DocumentExporter::exportCurrentScene(Scene *sce, const char* filename, bool
ae.exportAnimations(sce);
// <library_controllers>
- ArmatureExporter arm_exporter(&sw);
+ ArmatureExporter arm_exporter(&sw, this->export_settings);
if(has_object_type(sce, OB_ARMATURE)) {
- arm_exporter.export_controllers(sce, selected);
+ arm_exporter.export_controllers(sce);
}
// <library_visual_scenes>
- SceneExporter se(&sw, &arm_exporter);
- se.exportScene(sce, selected);
+ SceneExporter se(&sw, &arm_exporter, this->export_settings);
+ se.exportScene(sce);
// <scene>
std::string scene_name(translate_id(id_name(sce)));
diff --git a/source/blender/collada/DocumentExporter.h b/source/blender/collada/DocumentExporter.h
index 923313c4ed9..83724505efa 100644
--- a/source/blender/collada/DocumentExporter.h
+++ b/source/blender/collada/DocumentExporter.h
@@ -29,13 +29,18 @@
#ifndef __DOCUMENTEXPORTER_H__
#define __DOCUMENTEXPORTER_H__
+#include "ExportSettings.h"
+
struct Scene;
class DocumentExporter
{
public:
- void exportCurrentScene(Scene *sce, const char* filename, bool selected);
+ DocumentExporter(const ExportSettings *export_settings);
+ void exportCurrentScene(Scene *sce);
void exportScenes(const char* filename);
+private:
+ const ExportSettings *export_settings;
};
#endif
diff --git a/source/blender/collada/EffectExporter.cpp b/source/blender/collada/EffectExporter.cpp
index 355e384d000..ed37dada195 100644
--- a/source/blender/collada/EffectExporter.cpp
+++ b/source/blender/collada/EffectExporter.cpp
@@ -55,7 +55,7 @@ static std::string getActiveUVLayerName(Object *ob)
return "";
}
-EffectsExporter::EffectsExporter(COLLADASW::StreamWriter *sw) : COLLADASW::LibraryEffects(sw){}
+EffectsExporter::EffectsExporter(COLLADASW::StreamWriter *sw, const ExportSettings *export_settings) : COLLADASW::LibraryEffects(sw), export_settings(export_settings) {}
bool EffectsExporter::hasEffects(Scene *sce)
{
@@ -78,12 +78,12 @@ bool EffectsExporter::hasEffects(Scene *sce)
return false;
}
-void EffectsExporter::exportEffects(Scene *sce, bool export_selected)
+void EffectsExporter::exportEffects(Scene *sce)
{
if(hasEffects(sce)) {
openLibrary();
MaterialFunctor mf;
- mf.forEachMaterialInScene<EffectsExporter>(sce, *this, export_selected);
+ mf.forEachMaterialInScene<EffectsExporter>(sce, *this, this->export_settings->selected);
closeLibrary();
}
diff --git a/source/blender/collada/EffectExporter.h b/source/blender/collada/EffectExporter.h
index 86143ae4d07..dc1f4c4474b 100644
--- a/source/blender/collada/EffectExporter.h
+++ b/source/blender/collada/EffectExporter.h
@@ -43,11 +43,13 @@
#include "DNA_object_types.h"
#include "DNA_scene_types.h"
+#include "ExportSettings.h"
+
class EffectsExporter: COLLADASW::LibraryEffects
{
public:
- EffectsExporter(COLLADASW::StreamWriter *sw);
- void exportEffects(Scene *sce, bool export_selected);
+ EffectsExporter(COLLADASW::StreamWriter *sw, const ExportSettings *export_settings);
+ void exportEffects(Scene *sce);
void operator()(Material *ma, Object *ob);
@@ -66,6 +68,8 @@ private:
void writePhong(COLLADASW::EffectProfile &ep, Material *ma);
bool hasEffects(Scene *sce);
+
+ const ExportSettings *export_settings;
};
#endif
diff --git a/source/blender/collada/ExportSettings.cpp b/source/blender/collada/ExportSettings.cpp
new file mode 100644
index 00000000000..19f1c05ddcf
--- /dev/null
+++ b/source/blender/collada/ExportSettings.cpp
@@ -0,0 +1,29 @@
+/*
+ * $Id$
+ *
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Contributor(s): Chingiz Dyussenov, Arystanbek Dyussenov, Jan Diederich, Tod Liverseed.
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+/** \file blender/collada/ExportSettings.cpp
+ * \ingroup collada
+ */
+
+#include "ExportSettings.h"
diff --git a/source/blender/collada/ExportSettings.h b/source/blender/collada/ExportSettings.h
new file mode 100644
index 00000000000..2636ca88a23
--- /dev/null
+++ b/source/blender/collada/ExportSettings.h
@@ -0,0 +1,39 @@
+/*
+ * $Id$
+ *
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Contributor(s): Chingiz Dyussenov, Arystanbek Dyussenov.
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+/** \file ExportSettings.h
+ * \ingroup collada
+ */
+
+#ifndef __EXPORTSETTINGS_H__
+#define __EXPORTSETTINGS_H__
+
+struct ExportSettings
+{
+ public:
+ bool selected;
+ char *filepath;
+};
+
+#endif
diff --git a/source/blender/collada/GeometryExporter.cpp b/source/blender/collada/GeometryExporter.cpp
index b724844b1ec..4da0a4c6e1f 100644
--- a/source/blender/collada/GeometryExporter.cpp
+++ b/source/blender/collada/GeometryExporter.cpp
@@ -44,16 +44,16 @@
#include "collada_internal.h"
// TODO: optimize UV sets by making indexed list with duplicates removed
-GeometryExporter::GeometryExporter(COLLADASW::StreamWriter *sw) : COLLADASW::LibraryGeometries(sw) {}
+GeometryExporter::GeometryExporter(COLLADASW::StreamWriter *sw, const ExportSettings *export_settings) : COLLADASW::LibraryGeometries(sw), export_settings(export_settings) {}
-void GeometryExporter::exportGeom(Scene *sce, bool export_selected)
+void GeometryExporter::exportGeom(Scene *sce)
{
openLibrary();
mScene = sce;
GeometryFunctor gf;
- gf.forEachMeshObjectInScene<GeometryExporter>(sce, *this, export_selected);
+ gf.forEachMeshObjectInScene<GeometryExporter>(sce, *this, this->export_settings->selected);
closeLibrary();
}
diff --git a/source/blender/collada/GeometryExporter.h b/source/blender/collada/GeometryExporter.h
index d9d265a66fc..64c51b6324e 100644
--- a/source/blender/collada/GeometryExporter.h
+++ b/source/blender/collada/GeometryExporter.h
@@ -42,6 +42,8 @@
#include "DNA_object_types.h"
#include "DNA_scene_types.h"
+#include "ExportSettings.h"
+
// TODO: optimize UV sets by making indexed list with duplicates removed
class GeometryExporter : COLLADASW::LibraryGeometries
{
@@ -58,9 +60,9 @@ class GeometryExporter : COLLADASW::LibraryGeometries
Scene *mScene;
public:
- GeometryExporter(COLLADASW::StreamWriter *sw);
+ GeometryExporter(COLLADASW::StreamWriter *sw, const ExportSettings *export_settings);
- void exportGeom(Scene *sce, bool export_selected);
+ void exportGeom(Scene *sce);
void operator()(Object *ob);
@@ -96,6 +98,8 @@ public:
/* int getTriCount(MFace *faces, int totface);*/
private:
std::set<std::string> exportedGeometry;
+
+ const ExportSettings *export_settings;
};
struct GeometryFunctor {
diff --git a/source/blender/collada/ImageExporter.cpp b/source/blender/collada/ImageExporter.cpp
index 8e426e9dba8..747f3c783d7 100644
--- a/source/blender/collada/ImageExporter.cpp
+++ b/source/blender/collada/ImageExporter.cpp
@@ -43,7 +43,7 @@
#include "BLI_path_util.h"
#include "BLI_string.h"
-ImagesExporter::ImagesExporter(COLLADASW::StreamWriter *sw, const char* filename) : COLLADASW::LibraryImages(sw), mfilename(filename)
+ImagesExporter::ImagesExporter(COLLADASW::StreamWriter *sw, const ExportSettings *export_settings) : COLLADASW::LibraryImages(sw), export_settings(export_settings)
{}
bool ImagesExporter::hasImages(Scene *sce)
@@ -71,12 +71,12 @@ bool ImagesExporter::hasImages(Scene *sce)
return false;
}
-void ImagesExporter::exportImages(Scene *sce, bool export_selected)
+void ImagesExporter::exportImages(Scene *sce)
{
if(hasImages(sce)) {
openLibrary();
MaterialFunctor mf;
- mf.forEachMaterialInScene<ImagesExporter>(sce, *this, export_selected);
+ mf.forEachMaterialInScene<ImagesExporter>(sce, *this, this->export_settings->selected);
closeLibrary();
}
@@ -97,7 +97,7 @@ void ImagesExporter::operator()(Material *ma, Object *ob)
char src[FILE_MAX];
char dir[FILE_MAX];
- BLI_split_dirfile(mfilename, dir, NULL);
+ BLI_split_dirfile(this->export_settings->filepath, dir, NULL);
BKE_rebase_path(abs, sizeof(abs), rel, sizeof(rel), G.main->name, image->name, dir);
diff --git a/source/blender/collada/ImageExporter.h b/source/blender/collada/ImageExporter.h
index 6b81c099259..9e5767fd9d3 100644
--- a/source/blender/collada/ImageExporter.h
+++ b/source/blender/collada/ImageExporter.h
@@ -40,17 +40,19 @@
#include "DNA_object_types.h"
#include "DNA_scene_types.h"
+#include "ExportSettings.h"
+
class ImagesExporter: COLLADASW::LibraryImages
{
- const char *mfilename;
- std::vector<std::string> mImages; // contains list of written images, to avoid duplicates
public:
- ImagesExporter(COLLADASW::StreamWriter *sw, const char* filename);
+ ImagesExporter(COLLADASW::StreamWriter *sw, const ExportSettings *export_settings);
- void exportImages(Scene *sce, bool export_selected);
+ void exportImages(Scene *sce);
void operator()(Material *ma, Object *ob);
private:
+ std::vector<std::string> mImages; // contains list of written images, to avoid duplicates
bool hasImages(Scene *sce);
+ const ExportSettings *export_settings;
};
#endif
diff --git a/source/blender/collada/LightExporter.cpp b/source/blender/collada/LightExporter.cpp
index 31ade5604a7..3d5814cb6db 100644
--- a/source/blender/collada/LightExporter.cpp
+++ b/source/blender/collada/LightExporter.cpp
@@ -52,13 +52,13 @@ void forEachLampObjectInScene(Scene *sce, Functor &f, bool export_selected)
}
}
-LightsExporter::LightsExporter(COLLADASW::StreamWriter *sw): COLLADASW::LibraryLights(sw){}
+LightsExporter::LightsExporter(COLLADASW::StreamWriter *sw, const ExportSettings *export_settings): COLLADASW::LibraryLights(sw), export_settings(export_settings) {}
-void LightsExporter::exportLights(Scene *sce, bool export_selected)
+void LightsExporter::exportLights(Scene *sce)
{
openLibrary();
- forEachLampObjectInScene(sce, *this, export_selected);
+ forEachLampObjectInScene(sce, *this, this->export_settings->selected);
closeLibrary();
}
diff --git a/source/blender/collada/LightExporter.h b/source/blender/collada/LightExporter.h
index 2ae1a19fdb1..6c52ed2b76d 100644
--- a/source/blender/collada/LightExporter.h
+++ b/source/blender/collada/LightExporter.h
@@ -37,14 +37,17 @@
#include "DNA_object_types.h"
#include "DNA_scene_types.h"
+#include "ExportSettings.h"
+
class LightsExporter: COLLADASW::LibraryLights
{
public:
- LightsExporter(COLLADASW::StreamWriter *sw);
- void exportLights(Scene *sce, bool export_selected);
+ LightsExporter(COLLADASW::StreamWriter *sw, const ExportSettings *export_settings);
+ void exportLights(Scene *sce);
void operator()(Object *ob);
private:
bool exportBlenderProfile(COLLADASW::Light &cla, Lamp *la);
+ const ExportSettings *export_settings;
};
#endif
diff --git a/source/blender/collada/MaterialExporter.cpp b/source/blender/collada/MaterialExporter.cpp
index 9d29177578d..37c1a6f6b68 100644
--- a/source/blender/collada/MaterialExporter.cpp
+++ b/source/blender/collada/MaterialExporter.cpp
@@ -33,15 +33,15 @@
#include "COLLADABUUtils.h"
#include "collada_internal.h"
-MaterialsExporter::MaterialsExporter(COLLADASW::StreamWriter *sw): COLLADASW::LibraryMaterials(sw){}
+MaterialsExporter::MaterialsExporter(COLLADASW::StreamWriter *sw, const ExportSettings *export_settings): COLLADASW::LibraryMaterials(sw), export_settings(export_settings) {}
-void MaterialsExporter::exportMaterials(Scene *sce, bool export_selected)
+void MaterialsExporter::exportMaterials(Scene *sce)
{
if(hasMaterials(sce)) {
openLibrary();
MaterialFunctor mf;
- mf.forEachMaterialInScene<MaterialsExporter>(sce, *this, export_selected);
+ mf.forEachMaterialInScene<MaterialsExporter>(sce, *this, this->export_settings->selected);
closeLibrary();
}
diff --git a/source/blender/collada/MaterialExporter.h b/source/blender/collada/MaterialExporter.h
index c080e4b0596..97a1e27358f 100644
--- a/source/blender/collada/MaterialExporter.h
+++ b/source/blender/collada/MaterialExporter.h
@@ -44,16 +44,18 @@
#include "GeometryExporter.h"
#include "collada_internal.h"
+#include "ExportSettings.h"
class MaterialsExporter: COLLADASW::LibraryMaterials
{
public:
- MaterialsExporter(COLLADASW::StreamWriter *sw);
- void exportMaterials(Scene *sce, bool export_selected);
+ MaterialsExporter(COLLADASW::StreamWriter *sw, const ExportSettings *export_settings);
+ void exportMaterials(Scene *sce);
void operator()(Material *ma, Object *ob);
private:
bool hasMaterials(Scene *sce);
+ const ExportSettings *export_settings;
};
// used in forEachMaterialInScene
diff --git a/source/blender/collada/SceneExporter.cpp b/source/blender/collada/SceneExporter.cpp
index 96f20ac21c3..5109df0bb6a 100644
--- a/source/blender/collada/SceneExporter.cpp
+++ b/source/blender/collada/SceneExporter.cpp
@@ -28,21 +28,21 @@
#include "SceneExporter.h"
-SceneExporter::SceneExporter(COLLADASW::StreamWriter *sw, ArmatureExporter *arm)
- : COLLADASW::LibraryVisualScenes(sw), arm_exporter(arm)
+SceneExporter::SceneExporter(COLLADASW::StreamWriter *sw, ArmatureExporter *arm, const ExportSettings *export_settings)
+ : COLLADASW::LibraryVisualScenes(sw), arm_exporter(arm), export_settings(export_settings)
{}
-void SceneExporter::exportScene(Scene *sce, bool export_selected)
+void SceneExporter::exportScene(Scene *sce)
{
// <library_visual_scenes> <visual_scene>
std::string id_naming = id_name(sce);
openVisualScene(translate_id(id_naming), id_naming);
- exportHierarchy(sce, export_selected);
+ exportHierarchy(sce);
closeVisualScene();
closeLibrary();
}
-void SceneExporter::exportHierarchy(Scene *sce, bool export_selected)
+void SceneExporter::exportHierarchy(Scene *sce)
{
Base *base= (Base*) sce->base.first;
while(base) {
@@ -56,7 +56,7 @@ void SceneExporter::exportHierarchy(Scene *sce, bool export_selected)
case OB_LAMP:
case OB_ARMATURE:
case OB_EMPTY:
- if (export_selected && !(ob->flag & SELECT)) {
+ if (this->export_settings->selected && !(ob->flag & SELECT)) {
break;
}
// write nodes....
diff --git a/source/blender/collada/SceneExporter.h b/source/blender/collada/SceneExporter.h
index 30fef924ffd..919cba61ec0 100644
--- a/source/blender/collada/SceneExporter.h
+++ b/source/blender/collada/SceneExporter.h
@@ -29,6 +29,10 @@
#ifndef __SCENEEXPORTER_H__
#define __SCENEEXPORTER_H__
+#include <stdlib.h>
+#include <stdio.h>
+#include <math.h>
+
extern "C" {
#include "DNA_scene_types.h"
#include "DNA_object_types.h"
@@ -86,16 +90,20 @@ extern "C" {
#include "ArmatureExporter.h"
+#include "ExportSettings.h"
+
class SceneExporter: COLLADASW::LibraryVisualScenes, protected TransformWriter, protected InstanceWriter
{
- ArmatureExporter *arm_exporter;
public:
- SceneExporter(COLLADASW::StreamWriter *sw, ArmatureExporter *arm);
- void exportScene(Scene *sce, bool export_selected);
+ SceneExporter(COLLADASW::StreamWriter *sw, ArmatureExporter *arm, const ExportSettings *export_settings);
+ void exportScene(Scene *sce);
private:
- void exportHierarchy(Scene *sce, bool export_selected);
+ void exportHierarchy(Scene *sce);
void writeNodes(Object *ob, Scene *sce);
+
+ ArmatureExporter *arm_exporter;
+ const ExportSettings *export_settings;
};
#endif
diff --git a/source/blender/collada/collada.cpp b/source/blender/collada/collada.cpp
index 4caca20531f..8059b1cf3ff 100644
--- a/source/blender/collada/collada.cpp
+++ b/source/blender/collada/collada.cpp
@@ -30,6 +30,7 @@
/* COLLADABU_ASSERT, may be able to remove later */
#include "COLLADABUPlatform.h"
+#include "ExportSettings.h"
#include "DocumentExporter.h"
#include "DocumentImporter.h"
@@ -53,7 +54,10 @@ extern "C"
int collada_export(Scene *sce, const char *filepath, int selected)
{
- DocumentExporter exp;
+ ExportSettings export_settings;
+
+ export_settings.selected = selected != 0;
+ export_settings.filepath = (char *)filepath;
/* annoying, collada crashes if file cant be created! [#27162] */
if(!BLI_exist(filepath)) {
@@ -64,7 +68,8 @@ extern "C"
}
/* end! */
- exp.exportCurrentScene(sce, filepath, selected);
+ DocumentExporter exporter(&export_settings);
+ exporter.exportCurrentScene(sce);
return 1;
}
diff --git a/source/blender/editors/include/UI_icons.h b/source/blender/editors/include/UI_icons.h
index d6ef4264b07..f8d0b819ac1 100644
--- a/source/blender/editors/include/UI_icons.h
+++ b/source/blender/editors/include/UI_icons.h
@@ -589,7 +589,7 @@ DEF_ICON(MOD_MULTIRES)
DEF_ICON(MOD_SMOKE)
DEF_ICON(MOD_SOLIDIFY)
DEF_ICON(MOD_SCREW)
-DEF_ICON(MOD_WEIGHTVG)
+DEF_ICON(MOD_VERTEX_WEIGHT)
#ifndef DEF_ICON_BLANK_SKIP
DEF_ICON(BLANK161)
DEF_ICON(BLANK162)
diff --git a/source/blender/editors/space_node/drawnode.c b/source/blender/editors/space_node/drawnode.c
index 0d2ec7c646f..623855485d7 100644
--- a/source/blender/editors/space_node/drawnode.c
+++ b/source/blender/editors/space_node/drawnode.c
@@ -639,7 +639,7 @@ static void draw_group_socket(const bContext *C, SpaceNode *snode, bNodeTree *nt
float colw= 0.6f*node_group_frame;
float col1= 6 - node_group_frame;
float col2= col1 + colw+6;
- float col3= node_group_frame - arrowbutw - 6;
+ float col3= - arrowbutw - 6;
/* layout stuff for buttons on group right frame */
float cor1= 6;
float cor2= cor1 + arrowbutw + 6;
@@ -660,6 +660,7 @@ static void draw_group_socket(const bContext *C, SpaceNode *snode, bNodeTree *nt
* 1) input: not internal
* 2) output: (node type uses const outputs) and (group output is unlinked)
*/
+ draw_value = 0;
switch (in_out) {
case SOCK_IN:
draw_value = !(gsock && (gsock->flag & SOCK_INTERNAL));
@@ -667,8 +668,6 @@ static void draw_group_socket(const bContext *C, SpaceNode *snode, bNodeTree *nt
case SOCK_OUT:
if (gnode->typeinfo->flag & NODE_CONST_OUTPUT)
draw_value = !(gsock && gsock->link);
- else
- draw_value = 0;
break;
}
if (draw_value) {
@@ -713,7 +712,7 @@ static void draw_group_socket(const bContext *C, SpaceNode *snode, bNodeTree *nt
uiBlockSetDirection(gnode->block, 0);
/* remove button */
- offset = (in_out==SOCK_IN ? col3 : col1);
+ offset = (in_out==SOCK_IN ? col3 : cor1);
uiBlockSetEmboss(gnode->block, UI_EMBOSSN);
bt = uiDefIconButO(gnode->block, BUT, "NODE_OT_group_socket_remove", 0, ICON_X,
gsock->locx+offset, gsock->locy-0.5f*arrowbutw, arrowbutw, arrowbutw, "");
diff --git a/source/blender/editors/space_node/node_draw.c b/source/blender/editors/space_node/node_draw.c
index 6be8978cb5b..ba1e8d3dd59 100644
--- a/source/blender/editors/space_node/node_draw.c
+++ b/source/blender/editors/space_node/node_draw.c
@@ -220,7 +220,7 @@ static void node_update_basis(const bContext *C, bNodeTree *ntree, bNode *node)
PointerRNA ptr;
bNodeSocket *nsock;
float locx, locy;
- float dy= locy;
+ float dy;
int buty;
/* get "global" coords */
diff --git a/source/blender/editors/space_node/node_edit.c b/source/blender/editors/space_node/node_edit.c
index b5633d50997..5f58f540aae 100644
--- a/source/blender/editors/space_node/node_edit.c
+++ b/source/blender/editors/space_node/node_edit.c
@@ -447,9 +447,8 @@ void snode_set_context(SpaceNode *snode, Scene *scene)
else if(snode->treetype==NTREE_COMPOSIT) {
snode->id= &scene->id;
- /* bit clumsy but reliable way to see if we draw first time */
- if(snode->nodetree==NULL)
- ntreeCompositForceHidden(scene->nodetree, scene);
+ /* update output sockets based on available layers */
+ ntreeCompositForceHidden(scene->nodetree, scene);
}
else if(snode->treetype==NTREE_TEXTURE) {
Tex *tx= NULL;
@@ -608,28 +607,45 @@ void ED_node_set_active(Main *bmain, bNodeTree *ntree, bNode *node)
static int compare_nodes(bNode *a, bNode *b)
{
bNode *parent;
+ /* These tell if either the node or any of the parent nodes is selected.
+ * A selected parent means an unselected node is also in foreground!
+ */
+ int a_select=(a->flag & NODE_SELECT), b_select=(b->flag & NODE_SELECT);
+ int a_active=(a->flag & NODE_ACTIVE), b_active=(b->flag & NODE_ACTIVE);
/* if one is an ancestor of the other */
/* XXX there might be a better sorting algorithm for stable topological sort, this is O(n^2) worst case */
for (parent = a->parent; parent; parent=parent->parent) {
+ /* if b is an ancestor, it is always behind a */
if (parent==b)
return 1;
+ /* any selected ancestor moves the node forward */
+ if (parent->flag & NODE_ACTIVE)
+ a_active = 1;
+ if (parent->flag & NODE_SELECT)
+ a_select = 1;
}
for (parent = b->parent; parent; parent=parent->parent) {
+ /* if a is an ancestor, it is always behind b */
if (parent==a)
return 0;
+ /* any selected ancestor moves the node forward */
+ if (parent->flag & NODE_ACTIVE)
+ b_active = 1;
+ if (parent->flag & NODE_SELECT)
+ b_select = 1;
}
/* if one of the nodes is in the background and the other not */
- if ((a->flag & NODE_BACKGROUND) && !(b->typeinfo->flag & NODE_BACKGROUND))
+ if ((a->flag & NODE_BACKGROUND) && !(b->flag & NODE_BACKGROUND))
return 0;
- else if (!(a->flag & NODE_BACKGROUND) && (b->typeinfo->flag & NODE_BACKGROUND))
+ else if (!(a->flag & NODE_BACKGROUND) && (b->flag & NODE_BACKGROUND))
return 1;
/* if one has a higher selection state (active > selected > nothing) */
- if (!(b->flag & NODE_ACTIVE) && (a->flag & NODE_ACTIVE))
+ if (!b_active && a_active)
return 1;
- else if (!(b->flag & NODE_SELECT) && ((a->flag & NODE_ACTIVE) || (a->flag & NODE_SELECT)))
+ else if (!b_select && (a_active || a_select))
return 1;
return 0;
@@ -776,7 +792,7 @@ static int edit_node_invoke_properties(bContext *C, wmOperator *op)
static void edit_node_properties_get(wmOperator *op, bNodeTree *ntree, bNode **rnode, bNodeSocket **rsock, int *rin_out)
{
bNode *node;
- bNodeSocket *sock;
+ bNodeSocket *sock=NULL;
char nodename[32];
int sockindex;
int in_out;
diff --git a/source/blender/editors/space_view3d/view3d_edit.c b/source/blender/editors/space_view3d/view3d_edit.c
index 19e8d42db2d..761de836cfb 100644
--- a/source/blender/editors/space_view3d/view3d_edit.c
+++ b/source/blender/editors/space_view3d/view3d_edit.c
@@ -1017,18 +1017,26 @@ static int ndof_orbit_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent *event
if (has_rotation) {
- const int invert = U.ndof_flag & NDOF_ORBIT_INVERT_AXES;
-
rv3d->view = RV3D_VIEW_USER;
if (U.flag & USER_TRACKBALL) {
+ const int invert_roll = U.ndof_flag & NDOF_ROLL_INVERT_AXIS;
+ const int invert_tilt = U.ndof_flag & NDOF_TILT_INVERT_AXIS;
+ const int invert_rot = U.ndof_flag & NDOF_ROTATE_INVERT_AXIS;
+
float rot[4];
float axis[3];
float angle = rot_sensitivity * ndof_to_axis_angle(ndof, axis);
-
- if (invert)
- angle = -angle;
-
+
+ if (invert_roll)
+ axis[2] = -axis[2];
+
+ if (invert_tilt)
+ axis[0] = -axis[0];
+
+ if (invert_rot)
+ axis[1] = -axis[1];
+
// transform rotation axis from view to world coordinates
mul_qt_v3(view_inv, axis);
@@ -1042,6 +1050,8 @@ static int ndof_orbit_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent *event
mul_qt_qtqt(rv3d->viewquat, rv3d->viewquat, rot);
} else {
/* turntable view code by John Aughey, adapted for 3D mouse by [mce] */
+ const int invert = U.ndof_flag & NDOF_ORBIT_INVERT_AXES;
+
float angle, rot[4];
float xvec[3] = {1,0,0};
@@ -1143,10 +1153,26 @@ static int ndof_pan_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent *event)
const float vertical_sensitivity = 0.4f;
const float lateral_sensitivity = 0.6f;
- float pan_vec[3] = {lateral_sensitivity * ndof->tvec[0],
- vertical_sensitivity * ndof->tvec[1],
- forward_sensitivity * ndof->tvec[2]
- };
+ const int invert_panx = U.ndof_flag & NDOF_PANX_INVERT_AXIS;
+ const int invert_pany = U.ndof_flag & NDOF_PANY_INVERT_AXIS;
+ const int invert_panz = U.ndof_flag & NDOF_PANZ_INVERT_AXIS;
+
+ float pan_vec[3];
+
+ if (invert_panx)
+ pan_vec[0] = -lateral_sensitivity * ndof->tvec[0];
+ else
+ pan_vec[0] = lateral_sensitivity * ndof->tvec[0];
+
+ if (invert_panz)
+ pan_vec[1] = -vertical_sensitivity * ndof->tvec[1];
+ else
+ pan_vec[1] = vertical_sensitivity * ndof->tvec[1];
+
+ if (invert_pany)
+ pan_vec[2] = -forward_sensitivity * ndof->tvec[2];
+ else
+ pan_vec[2] = forward_sensitivity * ndof->tvec[2];
mul_v3_fl(pan_vec, speed * dt);
#endif
diff --git a/source/blender/makesdna/DNA_modifier_types.h b/source/blender/makesdna/DNA_modifier_types.h
index 59373490c83..5d75f8215ac 100644
--- a/source/blender/makesdna/DNA_modifier_types.h
+++ b/source/blender/makesdna/DNA_modifier_types.h
@@ -802,7 +802,7 @@ typedef struct WeightVGEditModifierData {
char defgrp_name[32]; /* Name of vertex group to edit. */
short edit_flags; /* Using MOD_WVG_EDIT_* flags. */
- short mapping_mode; /* Using MOD_WVG_MAPPING_* defines. */
+ short falloff_type; /* Using MOD_WVG_MAPPING_* defines. */
float default_weight; /* Weight for vertices not in vgroup. */
/* Mapping stuff. */
@@ -919,7 +919,7 @@ typedef struct WeightVGProximityModifierData {
float min_dist, max_dist; /* Distances mapping to 0.0/1.0 weights. */
/* Put here to avoid breaking existing struct... */
- short mapping_mode; /* Using MOD_WVG_MAPPING_* defines. */
+ short falloff_type; /* Using MOD_WVG_MAPPING_* defines. */
/* Padding... */
short pad_s1;
diff --git a/source/blender/makesdna/DNA_userdef_types.h b/source/blender/makesdna/DNA_userdef_types.h
index 3a14c261fd9..6eee9f8b24f 100644
--- a/source/blender/makesdna/DNA_userdef_types.h
+++ b/source/blender/makesdna/DNA_userdef_types.h
@@ -607,6 +607,12 @@ extern UserDef U; /* from blenkernel blender.c */
/* zoom is up/down if this flag is set (otherwise forward/backward) */
#define NDOF_ZOOM_UPDOWN (1 << 7)
#define NDOF_ZOOM_INVERT (1 << 8)
+#define NDOF_ROTATE_INVERT_AXIS (1 << 9)
+#define NDOF_TILT_INVERT_AXIS (1 << 10)
+#define NDOF_ROLL_INVERT_AXIS (1 << 11)
+#define NDOF_PANX_INVERT_AXIS (1 << 12)
+#define NDOF_PANY_INVERT_AXIS (1 << 13)
+#define NDOF_PANZ_INVERT_AXIS (1 << 14)
#ifdef __cplusplus
diff --git a/source/blender/makesrna/intern/rna_modifier.c b/source/blender/makesrna/intern/rna_modifier.c
index 657ec893925..bfe2c7ffaac 100644
--- a/source/blender/makesrna/intern/rna_modifier.c
+++ b/source/blender/makesrna/intern/rna_modifier.c
@@ -69,9 +69,9 @@ EnumPropertyItem modifier_type_items[] ={
{eModifierType_Solidify, "SOLIDIFY", ICON_MOD_SOLIDIFY, "Solidify", ""},
{eModifierType_Subsurf, "SUBSURF", ICON_MOD_SUBSURF, "Subdivision Surface", ""},
{eModifierType_UVProject, "UV_PROJECT", ICON_MOD_UVPROJECT, "UV Project", ""},
- {eModifierType_WeightVGEdit, "WEIGHT_VGEDIT", ICON_MOD_WEIGHTVG, "WeightVG Edit", ""},
- {eModifierType_WeightVGMix, "WEIGHT_VGMIX", ICON_MOD_WEIGHTVG, "WeightVG Mix", ""},
- {eModifierType_WeightVGProximity, "WEIGHT_VGPROXIMITY", ICON_MOD_WEIGHTVG, "WeightVG Proximity", ""},
+ {eModifierType_WeightVGEdit, "VERTEX_WEIGHT_EDIT", ICON_MOD_VERTEX_WEIGHT, "Vertex Weight Edit", ""},
+ {eModifierType_WeightVGMix, "VERTEX_WEIGHT_MIX", ICON_MOD_VERTEX_WEIGHT, "Vertex Weight Mix", ""},
+ {eModifierType_WeightVGProximity, "VERTEX_WEIGHT_PROXIMITY", ICON_MOD_VERTEX_WEIGHT, "Vertex Weight Proximity", ""},
{0, "", 0, "Deform", ""},
{eModifierType_Armature, "ARMATURE", ICON_MOD_ARMATURE, "Armature", ""},
{eModifierType_Cast, "CAST", ICON_MOD_CAST, "Cast", ""},
@@ -191,11 +191,11 @@ static StructRNA* rna_Modifier_refine(struct PointerRNA *ptr)
case eModifierType_Warp:
return &RNA_WarpModifier;
case eModifierType_WeightVGEdit:
- return &RNA_WeightVGEditModifier;
+ return &RNA_VertexWeightEditModifier;
case eModifierType_WeightVGMix:
- return &RNA_WeightVGMixModifier;
+ return &RNA_VertexWeightMixModifier;
case eModifierType_WeightVGProximity:
- return &RNA_WeightVGProximityModifier;
+ return &RNA_VertexWeightProximityModifier;
default:
return &RNA_Modifier;
}
@@ -2513,7 +2513,7 @@ static void rna_def_modifier_weightvg_mask(BlenderRNA *brna, StructRNA *srna)
prop= RNA_def_property(srna, "mask_constant", PROP_FLOAT, PROP_NONE);
RNA_def_property_range(prop, -FLT_MAX, FLT_MAX);
- RNA_def_property_ui_range(prop, -1.0, 1.0, 10, 0);
+ RNA_def_property_ui_range(prop, 0.0, 1.0, 10, 0);
RNA_def_property_ui_text(prop, "Influence", "Global influence of current modifications on vgroup.");
RNA_def_property_update(prop, 0, "rna_Modifier_update");
@@ -2555,7 +2555,7 @@ static void rna_def_modifier_weightvg_mask(BlenderRNA *brna, StructRNA *srna)
static void rna_def_modifier_weightvgedit(BlenderRNA *brna)
{
- static EnumPropertyItem weightvg_edit_mapping_mode_items[] = {
+ static EnumPropertyItem weightvg_edit_falloff_type_items[] = {
{MOD_WVG_MAPPING_NONE, "LINEAR", ICON_LINCURVE, "Linear", ""},
{MOD_WVG_MAPPING_CURVE, "CURVE", ICON_RNDCURVE, "Custom Curve", ""},
{MOD_WVG_MAPPING_SHARP, "SHARP", ICON_SHARPCURVE, "Sharp", ""},
@@ -2569,11 +2569,11 @@ static void rna_def_modifier_weightvgedit(BlenderRNA *brna)
StructRNA *srna;
PropertyRNA *prop;
- srna= RNA_def_struct(brna, "WeightVGEditModifier", "Modifier");
+ srna= RNA_def_struct(brna, "VertexWeightEditModifier", "Modifier");
RNA_def_struct_ui_text(srna, "WeightVG Edit Modifier",
"Edit the weights of vertices in a group.");
RNA_def_struct_sdna(srna, "WeightVGEditModifierData");
- RNA_def_struct_ui_icon(srna, ICON_MOD_WEIGHTVG);
+ RNA_def_struct_ui_icon(srna, ICON_MOD_VERTEX_WEIGHT);
prop= RNA_def_property(srna, "vertex_group", PROP_STRING, PROP_NONE);
RNA_def_property_string_sdna(prop, NULL, "defgrp_name");
@@ -2581,9 +2581,9 @@ static void rna_def_modifier_weightvgedit(BlenderRNA *brna)
RNA_def_property_string_funcs(prop, NULL, NULL, "rna_WeightVGModifier_vgroup_set");
RNA_def_property_update(prop, 0, "rna_Modifier_update");
- prop= RNA_def_property(srna, "mapping_mode", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_items(prop, weightvg_edit_mapping_mode_items);
- RNA_def_property_ui_text(prop, "Mapping Mode", "How weights are mapped to there new values.");
+ prop= RNA_def_property(srna, "falloff_type", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_items(prop, weightvg_edit_falloff_type_items);
+ RNA_def_property_ui_text(prop, "Falloff Type", "How weights are mapped to there new values.");
RNA_def_property_update(prop, 0, "rna_Modifier_update");
prop= RNA_def_property(srna, "use_add", PROP_BOOLEAN, PROP_NONE);
@@ -2653,11 +2653,11 @@ static void rna_def_modifier_weightvgmix(BlenderRNA *brna)
StructRNA *srna;
PropertyRNA *prop;
- srna= RNA_def_struct(brna, "WeightVGMixModifier", "Modifier");
+ srna= RNA_def_struct(brna, "VertexWeightMixModifier", "Modifier");
RNA_def_struct_ui_text(srna, "WeightVG Mix Modifier",
"Mix the weights of two vertex groups.");
RNA_def_struct_sdna(srna, "WeightVGMixModifierData");
- RNA_def_struct_ui_icon(srna, ICON_MOD_WEIGHTVG);
+ RNA_def_struct_ui_icon(srna, ICON_MOD_VERTEX_WEIGHT);
prop= RNA_def_property(srna, "vertex_group_a", PROP_STRING, PROP_NONE);
RNA_def_property_string_sdna(prop, NULL, "defgrp_name_a");
@@ -2710,12 +2710,12 @@ static void rna_def_modifier_weightvgproximity(BlenderRNA *brna)
{0, NULL, 0, NULL, NULL}};
static EnumPropertyItem proximity_geometry_items[] = {
- {MOD_WVG_PROXIMITY_GEOM_VERTS, "VERTEX", ICON_VERTEXSEL, "Vertex", ""},
- {MOD_WVG_PROXIMITY_GEOM_EDGES, "EDGE", ICON_EDGESEL, "Edge", ""},
- {MOD_WVG_PROXIMITY_GEOM_FACES, "FACE", ICON_FACESEL, "Face", ""},
+ {MOD_WVG_PROXIMITY_GEOM_VERTS, "VERTEX", ICON_VERTEXSEL, "Vertex", "Compute distance to nearest vertex."},
+ {MOD_WVG_PROXIMITY_GEOM_EDGES, "EDGE", ICON_EDGESEL, "Edge", "Compute distance to nearest edge."},
+ {MOD_WVG_PROXIMITY_GEOM_FACES, "FACE", ICON_FACESEL, "Face", "Compute distance to nearest face."},
{0, NULL, 0, NULL, NULL}};
- static EnumPropertyItem weightvg_proximity_mapping_mode_items[] = {
+ static EnumPropertyItem weightvg_proximity_falloff_type_items[] = {
{MOD_WVG_MAPPING_NONE, "LINEAR", ICON_LINCURVE, "Linear", ""},
/* No curve mapping here! */
{MOD_WVG_MAPPING_SHARP, "SHARP", ICON_SHARPCURVE, "Sharp", ""},
@@ -2729,12 +2729,12 @@ static void rna_def_modifier_weightvgproximity(BlenderRNA *brna)
StructRNA *srna;
PropertyRNA *prop;
- srna= RNA_def_struct(brna, "WeightVGProximityModifier", "Modifier");
+ srna= RNA_def_struct(brna, "VertexWeightProximityModifier", "Modifier");
RNA_def_struct_ui_text(srna, "WeightVG Proximity Modifier",
"Set the weights of vertices in a group from a target object's "
"distance.");
RNA_def_struct_sdna(srna, "WeightVGProximityModifierData");
- RNA_def_struct_ui_icon(srna, ICON_MOD_WEIGHTVG);
+ RNA_def_struct_ui_icon(srna, ICON_MOD_VERTEX_WEIGHT);
prop= RNA_def_property(srna, "vertex_group", PROP_STRING, PROP_NONE);
RNA_def_property_string_sdna(prop, NULL, "defgrp_name");
@@ -2751,7 +2751,9 @@ static void rna_def_modifier_weightvgproximity(BlenderRNA *brna)
RNA_def_property_enum_sdna(prop, NULL, "proximity_flags");
RNA_def_property_enum_items(prop, proximity_geometry_items);
RNA_def_property_flag(prop, PROP_ENUM_FLAG); /* important to run before default set */
- RNA_def_property_ui_text(prop, "Proximity Geometry", "Use shortest distance to target object's geometry as weight");
+ RNA_def_property_ui_text(prop, "Proximity Geometry",
+ "Use the shortest computed distance to target object's geometry "
+ "as weight.");
RNA_def_property_update(prop, 0, "rna_Modifier_update");
prop= RNA_def_property(srna, "target", PROP_POINTER, PROP_NONE);
@@ -2763,18 +2765,18 @@ static void rna_def_modifier_weightvgproximity(BlenderRNA *brna)
prop= RNA_def_property(srna, "min_dist", PROP_FLOAT, PROP_NONE);
RNA_def_property_range(prop, 0.0, FLT_MAX);
RNA_def_property_ui_range(prop, 0.0, 1000.0, 10, 0);
- RNA_def_property_ui_text(prop, "Lowest Dist", "Distance mapping to weight 0.0.");
+ RNA_def_property_ui_text(prop, "Lowest Dist", "Distance mapping to weight 0.0 (or weight 1.0 if above Highest Dist).");
RNA_def_property_update(prop, 0, "rna_Modifier_update");
prop= RNA_def_property(srna, "max_dist", PROP_FLOAT, PROP_NONE);
RNA_def_property_range(prop, 0.0, FLT_MAX);
RNA_def_property_ui_range(prop, 0.0, 1000.0, 10, 0);
- RNA_def_property_ui_text(prop, "Highest Dist", "Distance mapping to weight 1.0.");
+ RNA_def_property_ui_text(prop, "Highest Dist", "Distance mapping to weight 1.0 (or weight 0.0 if below Lowest Dist).");
RNA_def_property_update(prop, 0, "rna_Modifier_update");
- prop= RNA_def_property(srna, "mapping_mode", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_items(prop, weightvg_proximity_mapping_mode_items);
- RNA_def_property_ui_text(prop, "Mapping Mode", "How weights are mapped to there new values.");
+ prop= RNA_def_property(srna, "falloff_type", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_items(prop, weightvg_proximity_falloff_type_items);
+ RNA_def_property_ui_text(prop, "Falloff Type", "How weights are mapped to there new values.");
RNA_def_property_update(prop, 0, "rna_Modifier_update");
/* Common masking properties. */
diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c
index 7d0502f1be9..66c4e7245c4 100644
--- a/source/blender/makesrna/intern/rna_userdef.c
+++ b/source/blender/makesrna/intern/rna_userdef.c
@@ -2791,6 +2791,36 @@ static void rna_def_userdef_input(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Invert Axes", "Toggle between moving the viewpoint or moving the scene being viewed");
/* in 3Dx docs, this is called 'object mode' vs. 'target camera mode' */
+ /* 3D view: roll */
+ prop= RNA_def_property(srna, "ndof_roll_invert_axis", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "ndof_flag", NDOF_ROLL_INVERT_AXIS);
+ RNA_def_property_ui_text(prop, "Invert roll Axis", "Invert roll axis");
+
+ /* 3D view: tilt */
+ prop= RNA_def_property(srna, "ndof_tilt_invert_axis", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "ndof_flag", NDOF_TILT_INVERT_AXIS);
+ RNA_def_property_ui_text(prop, "Invert tilt Axis", "Invert tilt axis");
+
+ /* 3D view: rotate */
+ prop= RNA_def_property(srna, "ndof_rotate_invert_axis", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "ndof_flag", NDOF_ROTATE_INVERT_AXIS);
+ RNA_def_property_ui_text(prop, "Invert rotation Axis", "Invert rotation axis");
+
+ /* 3D view: pan x */
+ prop= RNA_def_property(srna, "ndof_panx_invert_axis", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "ndof_flag", NDOF_PANX_INVERT_AXIS);
+ RNA_def_property_ui_text(prop, "Invert x Axis", "Invert x axis");
+
+ /* 3D view: pan y */
+ prop= RNA_def_property(srna, "ndof_pany_invert_axis", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "ndof_flag", NDOF_PANY_INVERT_AXIS);
+ RNA_def_property_ui_text(prop, "Invert y Axis", "Invert y axis");
+
+ /* 3D view: pan z */
+ prop= RNA_def_property(srna, "ndof_panz_invert_axis", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "ndof_flag", NDOF_PANZ_INVERT_AXIS);
+ RNA_def_property_ui_text(prop, "Invert z Axis", "Invert z axis");
+
/* 3D view: fly */
prop= RNA_def_property(srna, "ndof_lock_horizon", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "ndof_flag", NDOF_LOCK_HORIZON);
diff --git a/source/blender/modifiers/intern/MOD_weightvg_util.c b/source/blender/modifiers/intern/MOD_weightvg_util.c
index 675f0d76a48..51465cc80b0 100644
--- a/source/blender/modifiers/intern/MOD_weightvg_util.c
+++ b/source/blender/modifiers/intern/MOD_weightvg_util.c
@@ -1,34 +1,34 @@
/*
-* $Id$
-*
-* ***** BEGIN GPL LICENSE BLOCK *****
-*
-* This program is free software; you can redistribute it and/or
-* modify it under the terms of the GNU General Public License
-* as published by the Free Software Foundation; either version 2
-* of the License, or (at your option) any later version.
-*
-* This program is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-* GNU General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program; if not, write to the Free Software Foundation,
-* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-*
-* The Original Code is Copyright (C) 2011 by Bastien Montagne.
-* All rights reserved.
-*
-* Contributor(s): None yet.
-*
-* ***** END GPL LICENSE BLOCK *****
-*
-*/
+ * $Id$
+ *
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * The Original Code is Copyright (C) 2011 by Bastien Montagne.
+ * All rights reserved.
+ *
+ * Contributor(s): None yet.
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ *
+ */
/*
* XXX I'd like to make modified weights visible in WeightPaint mode,
- * but couldn't figure a way to do this…
+ * but couldn't figure a way to do this...
* Maybe this will need changes in mesh_calc_modifiers (DerivedMesh.c)?
* Or the WeightPaint mode code itself?
*/
@@ -63,16 +63,16 @@
* vertex index (in case the weight tables do not cover the whole vertices...).
* cmap might be NULL, in which case curve mapping mode will return unmodified data.
*/
-void weightvg_do_map(int num, float *new_w, short mode, CurveMapping *cmap)
+void weightvg_do_map(int num, float *new_w, short falloff_type, CurveMapping *cmap)
{
int i;
/* Return immediately, if we have nothing to do! */
/* Also security checks... */
- if(((mode == MOD_WVG_MAPPING_CURVE) && (cmap == NULL))
- || !ELEM7(mode, MOD_WVG_MAPPING_CURVE, MOD_WVG_MAPPING_SHARP, MOD_WVG_MAPPING_SMOOTH,
- MOD_WVG_MAPPING_ROOT, MOD_WVG_MAPPING_SPHERE, MOD_WVG_MAPPING_RANDOM,
- MOD_WVG_MAPPING_STEP))
+ if(((falloff_type == MOD_WVG_MAPPING_CURVE) && (cmap == NULL))
+ || !ELEM7(falloff_type, MOD_WVG_MAPPING_CURVE, MOD_WVG_MAPPING_SHARP, MOD_WVG_MAPPING_SMOOTH,
+ MOD_WVG_MAPPING_ROOT, MOD_WVG_MAPPING_SPHERE, MOD_WVG_MAPPING_RANDOM,
+ MOD_WVG_MAPPING_STEP))
return;
/* Map each weight (vertex) to its new value, accordingly to the chosen mode. */
@@ -81,7 +81,7 @@ void weightvg_do_map(int num, float *new_w, short mode, CurveMapping *cmap)
/* Code borrowed from the warp modifier. */
/* Closely matches PROP_SMOOTH and similar. */
- switch(mode) {
+ switch(falloff_type) {
case MOD_WVG_MAPPING_CURVE:
fac = curvemapping_evaluateF(cmap, 0, fac);
break;
@@ -131,7 +131,7 @@ void weightvg_do_mask(int num, const int *indices, float *org_w, const float *ne
if (texture) {
/* The texture coordinates. */
float (*tex_co)[3];
- /* See mapping note below… */
+ /* See mapping note below... */
MappingInfoModifierData t_map;
float (*v_co)[3];
@@ -158,7 +158,7 @@ void weightvg_do_mask(int num, const int *indices, float *org_w, const float *ne
texres.nor = NULL;
get_texture_value(texture, tex_co[idx], &texres);
- /* Get the good channel value… */
+ /* Get the good channel value... */
switch(tex_use_channel) {
case MOD_WVG_MASK_TEX_USE_INT:
org_w[i] = (new_w[i] * texres.tin * fact) + (org_w[i] * (1.0f - (texres.tin*fact)));
diff --git a/source/blender/modifiers/intern/MOD_weightvg_util.h b/source/blender/modifiers/intern/MOD_weightvg_util.h
index 3afff391943..00c63a3d5d5 100644
--- a/source/blender/modifiers/intern/MOD_weightvg_util.h
+++ b/source/blender/modifiers/intern/MOD_weightvg_util.h
@@ -1,30 +1,30 @@
/*
-* $Id$
-*
-* ***** BEGIN GPL LICENSE BLOCK *****
-*
-* This program is free software; you can redistribute it and/or
-* modify it under the terms of the GNU General Public License
-* as published by the Free Software Foundation; either version 2
-* of the License, or (at your option) any later version.
-*
-* This program is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-* GNU General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program; if not, write to the Free Software Foundation,
-* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-*
-* The Original Code is Copyright (C) 2011 by Bastien Montagne.
-* All rights reserved.
-*
-* Contributor(s): None yet.
-*
-* ***** END GPL LICENSE BLOCK *****
-*
-*/
+ * $Id$
+ *
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * The Original Code is Copyright (C) 2011 by Bastien Montagne.
+ * All rights reserved.
+ *
+ * Contributor(s): None yet.
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ *
+ */
/** \file blender/modifiers/intern/MOD_util.h
* \ingroup modifiers
diff --git a/source/blender/modifiers/intern/MOD_weightvgedit.c b/source/blender/modifiers/intern/MOD_weightvgedit.c
index 19b6ddaddde..b8bbf2a4b6c 100644
--- a/source/blender/modifiers/intern/MOD_weightvgedit.c
+++ b/source/blender/modifiers/intern/MOD_weightvgedit.c
@@ -1,30 +1,30 @@
/*
-* $Id$
-*
-* ***** BEGIN GPL LICENSE BLOCK *****
-*
-* This program is free software; you can redistribute it and/or
-* modify it under the terms of the GNU General Public License
-* as published by the Free Software Foundation; either version 2
-* of the License, or (at your option) any later version.
-*
-* This program is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-* GNU General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program; if not, write to the Free Software Foundation,
-* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-*
-* The Original Code is Copyright (C) 2011 by Bastien Montagne.
-* All rights reserved.
-*
-* Contributor(s): None yet.
-*
-* ***** END GPL LICENSE BLOCK *****
-*
-*/
+ * $Id$
+ *
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * The Original Code is Copyright (C) 2011 by Bastien Montagne.
+ * All rights reserved.
+ *
+ * Contributor(s): None yet.
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ *
+ */
/*
* XXX I'd like to make modified weights visible in WeightPaint mode,
@@ -62,7 +62,7 @@ static void initData(ModifierData *md)
{
WeightVGEditModifierData *wmd = (WeightVGEditModifierData*) md;
wmd->edit_flags = 0;
- wmd->mapping_mode = MOD_WVG_MAPPING_NONE;
+ wmd->falloff_type = MOD_WVG_MAPPING_NONE;
wmd->default_weight = 0.0f;
wmd->cmap_curve = curvemapping_add(1, 0.0, 0.0, 1.0, 1.0);
@@ -90,7 +90,7 @@ static void copyData(ModifierData *md, ModifierData *target)
BLI_strncpy(twmd->defgrp_name, wmd->defgrp_name, sizeof(twmd->defgrp_name));
twmd->edit_flags = wmd->edit_flags;
- twmd->mapping_mode = wmd->mapping_mode;
+ twmd->falloff_type = wmd->falloff_type;
twmd->default_weight = wmd->default_weight;
twmd->cmap_curve = curvemapping_copy(wmd->cmap_curve);
@@ -268,8 +268,8 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, DerivedMesh *der
}
/* Do mapping. */
- if (wmd->mapping_mode != MOD_WVG_MAPPING_NONE) {
- weightvg_do_map(numVerts, new_w, wmd->mapping_mode, wmd->cmap_curve);
+ if (wmd->falloff_type != MOD_WVG_MAPPING_NONE) {
+ weightvg_do_map(numVerts, new_w, wmd->falloff_type, wmd->cmap_curve);
}
/* Do masking. */
@@ -298,7 +298,7 @@ static DerivedMesh *applyModifierEM(ModifierData *md, Object *ob,
ModifierTypeInfo modifierType_WeightVGEdit = {
- /* name */ "WeightVGEdit",
+ /* name */ "VertexWeightEdit",
/* structName */ "WeightVGEditModifierData",
/* structSize */ sizeof(WeightVGEditModifierData),
/* type */ eModifierTypeType_Nonconstructive,
diff --git a/source/blender/modifiers/intern/MOD_weightvgmix.c b/source/blender/modifiers/intern/MOD_weightvgmix.c
index 9be92da51be..8139adc5910 100644
--- a/source/blender/modifiers/intern/MOD_weightvgmix.c
+++ b/source/blender/modifiers/intern/MOD_weightvgmix.c
@@ -1,30 +1,30 @@
/*
-* $Id$
-*
-* ***** BEGIN GPL LICENSE BLOCK *****
-*
-* This program is free software; you can redistribute it and/or
-* modify it under the terms of the GNU General Public License
-* as published by the Free Software Foundation; either version 2
-* of the License, or (at your option) any later version.
-*
-* This program is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-* GNU General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program; if not, write to the Free Software Foundation,
-* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-*
-* The Original Code is Copyright (C) 2011 by Bastien Montagne.
-* All rights reserved.
-*
-* Contributor(s): None yet.
-*
-* ***** END GPL LICENSE BLOCK *****
-*
-*/
+ * $Id$
+ *
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * The Original Code is Copyright (C) 2011 by Bastien Montagne.
+ * All rights reserved.
+ *
+ * Contributor(s): None yet.
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ *
+ */
/*
* XXX I'd like to make modified weights visible in WeightPaint mode,
@@ -438,7 +438,7 @@ static DerivedMesh *applyModifierEM(ModifierData *md, Object *ob,
ModifierTypeInfo modifierType_WeightVGMix = {
- /* name */ "WeightVGMix",
+ /* name */ "VertexWeightMix",
/* structName */ "WeightVGMixModifierData",
/* structSize */ sizeof(WeightVGMixModifierData),
/* type */ eModifierTypeType_Nonconstructive,
diff --git a/source/blender/modifiers/intern/MOD_weightvgproximity.c b/source/blender/modifiers/intern/MOD_weightvgproximity.c
index 7eeec211b41..b0be02c5b27 100644
--- a/source/blender/modifiers/intern/MOD_weightvgproximity.c
+++ b/source/blender/modifiers/intern/MOD_weightvgproximity.c
@@ -1,30 +1,30 @@
/*
-* $Id$
-*
-* ***** BEGIN GPL LICENSE BLOCK *****
-*
-* This program is free software; you can redistribute it and/or
-* modify it under the terms of the GNU General Public License
-* as published by the Free Software Foundation; either version 2
-* of the License, or (at your option) any later version.
-*
-* This program is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-* GNU General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program; if not, write to the Free Software Foundation,
-* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-*
-* The Original Code is Copyright (C) 2011 by Bastien Montagne.
-* All rights reserved.
-*
-* Contributor(s): None yet.
-*
-* ***** END GPL LICENSE BLOCK *****
-*
-*/
+ * $Id$
+ *
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * The Original Code is Copyright (C) 2011 by Bastien Montagne.
+ * All rights reserved.
+ *
+ * Contributor(s): None yet.
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ *
+ */
/*
* XXX I'd like to make modified weights visible in WeightPaint mode,
@@ -199,10 +199,24 @@ void do_map(float *weights, const int nidx, const float min_d, const float max_d
{
const float range_inv= 1.0f / (max_d - min_d); /* invert since multiplication is faster */
unsigned int i= nidx;
- while (i-- > 0) {
- if (weights[i] >= max_d) weights[i]= 1.0f; /* most likely case first */
- else if(weights[i] <= min_d) weights[i]= 0.0f;
- else weights[i]= (weights[i] - min_d) * range_inv;
+ if(max_d == min_d) {
+ while (i-- > 0) {
+ weights[i] = (weights[i] >= max_d) ? 1.0f : 0.0f; /* "Step" behavior... */
+ }
+ }
+ else if(max_d > min_d) {
+ while (i-- > 0) {
+ if (weights[i] >= max_d) weights[i]= 1.0f; /* most likely case first */
+ else if(weights[i] <= min_d) weights[i]= 0.0f;
+ else weights[i]= (weights[i] - min_d) * range_inv;
+ }
+ }
+ else {
+ while (i-- > 0) {
+ if (weights[i] <= max_d) weights[i]= 1.0f; /* most likely case first */
+ else if(weights[i] >= min_d) weights[i]= 0.0f;
+ else weights[i]= (weights[i] - min_d) * range_inv;
+ }
}
if(!ELEM(mode, MOD_WVG_MAPPING_NONE, MOD_WVG_MAPPING_CURVE)) {
@@ -220,7 +234,7 @@ static void initData(ModifierData *md)
wmd->proximity_mode = MOD_WVG_PROXIMITY_OBJECT;
wmd->proximity_flags = MOD_WVG_PROXIMITY_GEOM_VERTS;
- wmd->mapping_mode = MOD_WVG_MAPPING_NONE;
+ wmd->falloff_type = MOD_WVG_MAPPING_NONE;
wmd->mask_constant = 1.0f;
wmd->mask_tex_use_channel = MOD_WVG_MASK_TEX_USE_INT; /* Use intensity by default. */
@@ -238,7 +252,7 @@ static void copyData(ModifierData *md, ModifierData *target)
twmd->proximity_flags = wmd->proximity_flags;
twmd->proximity_ob_target = wmd->proximity_ob_target;
- twmd->mapping_mode = wmd->mapping_mode;
+ twmd->falloff_type = wmd->falloff_type;
twmd->mask_constant = wmd->mask_constant;
BLI_strncpy(twmd->mask_defgrp_name, wmd->mask_defgrp_name, sizeof(twmd->mask_defgrp_name));
@@ -481,6 +495,9 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, DerivedMesh *der
new_w[i] = dists_e ? minf(dists_e[i], new_w[i]) : new_w[i];
new_w[i] = dists_f ? minf(dists_f[i], new_w[i]) : new_w[i];
}
+ if(dists_v) MEM_freeN(dists_v);
+ if(dists_e) MEM_freeN(dists_e);
+ if(dists_f) MEM_freeN(dists_f);
}
/* Else, fall back to default obj2vert behavior. */
else {
@@ -492,14 +509,14 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, DerivedMesh *der
}
}
+ /* Map distances to weights. */
+ do_map(new_w, numIdx, wmd->min_dist, wmd->max_dist, wmd->falloff_type);
+
/* Do masking. */
weightvg_do_mask(numIdx, indices, org_w, new_w, ob, ret, wmd->mask_constant,
wmd->mask_defgrp_name, wmd->mask_texture, wmd->mask_tex_use_channel,
wmd->mask_tex_mapping, wmd->mask_tex_map_obj, wmd->mask_tex_uvlayer_name);
- /* Map distances to weights. */
- do_map(org_w, numIdx, wmd->min_dist, wmd->max_dist, wmd->mapping_mode);
-
/* Update vgroup. Note we never add nor remove vertices from vgroup here. */
weightvg_update_vg(dvert, defgrp_idx, numIdx, indices, org_w, 0, 0.0f, 0, 0.0f);
@@ -522,7 +539,7 @@ static DerivedMesh *applyModifierEM(ModifierData *md, Object *ob,
ModifierTypeInfo modifierType_WeightVGProximity = {
- /* name */ "WeightVGProximity",
+ /* name */ "VertexWeightProximity",
/* structName */ "WeightVGProximityModifierData",
/* structSize */ sizeof(WeightVGProximityModifierData),
/* type */ eModifierTypeType_Nonconstructive,
diff --git a/source/blender/nodes/composite/node_composite_tree.c b/source/blender/nodes/composite/node_composite_tree.c
index 4fc5e23e26a..01e46ed3df9 100644
--- a/source/blender/nodes/composite/node_composite_tree.c
+++ b/source/blender/nodes/composite/node_composite_tree.c
@@ -341,15 +341,15 @@ static void *exec_composite_node(void *nodeexec_v)
}
/* return total of executable nodes, for timecursor */
-static int setExecutableNodes(bNodeTree *ntree, ThreadData *thd)
+static int setExecutableNodes(bNodeTreeExec *exec, ThreadData *thd)
{
+ bNodeTree *ntree = exec->nodetree;
bNodeStack *nsin[MAX_SOCKET]; /* arbitrary... watch this */
bNodeStack *nsout[MAX_SOCKET]; /* arbitrary... watch this */
+ bNodeExec *nodeexec;
bNode *node;
bNodeSocket *sock;
- int totnode= 0, group_edit= 0;
-
- /* note; do not add a dependency sort here, the stack was created already */
+ int n, totnode= 0, group_edit= 0;
/* if we are in group edit, viewer nodes get skipped when group has viewer */
for(node= ntree->nodes.first; node; node= node->next)
@@ -357,10 +357,12 @@ static int setExecutableNodes(bNodeTree *ntree, ThreadData *thd)
if(ntreeHasType((bNodeTree *)node->id, CMP_NODE_VIEWER))
group_edit= 1;
- for(node= ntree->nodes.first; node; node= node->next) {
+ /* NB: using the exec data list here to have valid dependency sort */
+ for(n=0, nodeexec=exec->nodeexec; n < exec->totnodes; ++n, ++nodeexec) {
int a;
+ node = nodeexec->node;
- node_get_stack(node, thd->stack, nsin, nsout);
+ node_get_stack(node, exec->stack, nsin, nsout);
/* test the outputs */
/* skip value-only nodes (should be in type!) */
@@ -422,10 +424,11 @@ static int setExecutableNodes(bNodeTree *ntree, ThreadData *thd)
/* last step: set the stack values for only-value nodes */
/* just does all now, compared to a full buffer exec this is nothing */
if(totnode) {
- for(node= ntree->nodes.first; node; node= node->next) {
+ for(n=0, nodeexec=exec->nodeexec; n < exec->totnodes; ++n, ++nodeexec) {
+ node = nodeexec->node;
if(node->need_exec==0 && node_only_value(node)) {
if(node->typeinfo->execfunc) {
- node_get_stack(node, thd->stack, nsin, nsout);
+ node_get_stack(node, exec->stack, nsin, nsout);
node->typeinfo->execfunc(thd->rd, node, nsin, nsout);
}
}
@@ -436,14 +439,17 @@ static int setExecutableNodes(bNodeTree *ntree, ThreadData *thd)
}
/* while executing tree, free buffers from nodes that are not needed anymore */
-static void freeExecutableNode(bNodeTree *ntree, bNodeTreeExec *exec)
+static void freeExecutableNode(bNodeTreeExec *exec)
{
/* node outputs can be freed when:
- not a render result or image node
- when node outputs go to nodes all being set NODE_FINISHED
*/
+ bNodeTree *ntree = exec->nodetree;
+ bNodeExec *nodeexec;
bNode *node;
bNodeSocket *sock;
+ int n;
/* set exec flag for finished nodes that might need freed */
for(node= ntree->nodes.first; node; node= node->next) {
@@ -451,8 +457,11 @@ static void freeExecutableNode(bNodeTree *ntree, bNodeTreeExec *exec)
if(node->exec & NODE_FINISHED)
node->exec |= NODE_FREEBUFS;
}
- /* clear this flag for input links that are not done yet */
- for(node= ntree->nodes.first; node; node= node->next) {
+ /* clear this flag for input links that are not done yet.
+ * Using the exec data for valid dependency sort.
+ */
+ for(n=0, nodeexec=exec->nodeexec; n < exec->totnodes; ++n, ++nodeexec) {
+ node = nodeexec->node;
if((node->exec & NODE_FINISHED)==0) {
for(sock= node->inputs.first; sock; sock= sock->next)
if(sock->link)
@@ -526,7 +535,7 @@ void ntreeCompositExecTree(bNodeTree *ntree, RenderData *rd, int do_preview)
ListBase threads;
ThreadData thdata;
int totnode, curnode, rendering= 1, n;
- bNodeTreeExec *exec= NULL;
+ bNodeTreeExec *exec= ntree->execdata;
if(ntree==NULL) return;
@@ -551,7 +560,7 @@ void ntreeCompositExecTree(bNodeTree *ntree, RenderData *rd, int do_preview)
BLI_srandom(rd->cfra);
/* sets need_exec tags in nodes */
- curnode = totnode= setExecutableNodes(ntree, &thdata);
+ curnode = totnode= setExecutableNodes(exec, &thdata);
BLI_init_threads(&threads, exec_composite_node, rd->threads);
@@ -597,7 +606,7 @@ void ntreeCompositExecTree(bNodeTree *ntree, RenderData *rd, int do_preview)
/* freeing unused buffers */
if(rd->scemode & R_COMP_FREE)
- freeExecutableNode(ntree, exec);
+ freeExecutableNode(exec);
}
}
else rendering= 1;
diff --git a/source/blender/nodes/composite/nodes/node_composite_value.c b/source/blender/nodes/composite/nodes/node_composite_value.c
index 80b71b9e65d..ed650477f50 100644
--- a/source/blender/nodes/composite/nodes/node_composite_value.c
+++ b/source/blender/nodes/composite/nodes/node_composite_value.c
@@ -36,7 +36,8 @@
/* **************** VALUE ******************** */
static bNodeSocketTemplate cmp_node_value_out[]= {
- { SOCK_FLOAT, 0, "Value"},
+ /* XXX value nodes use the output sockets for buttons, so we need explicit limits here! */
+ { SOCK_FLOAT, 0, "Value", 0.0f, 0.0f, 0.0f, 0.0f, -FLT_MAX, FLT_MAX},
{ -1, 0, "" }
};
diff --git a/source/blender/nodes/intern/node_common.c b/source/blender/nodes/intern/node_common.c
index 07f3eb943cc..d7830b6a260 100644
--- a/source/blender/nodes/intern/node_common.c
+++ b/source/blender/nodes/intern/node_common.c
@@ -878,7 +878,7 @@ static void loop_sync(bNodeTree *ntree, int sync_in_out)
while (sync && ((sync->flag & SOCK_INTERNAL) || !(sync->flag & SOCK_DYNAMIC)))
sync = sync->next;
- if (!(sync->flag & SOCK_INTERNAL) && (sync->flag & SOCK_DYNAMIC)) {
+ if (sync && !(sync->flag & SOCK_INTERNAL) && (sync->flag & SOCK_DYNAMIC)) {
if (sock->storage==NULL) {
/* if mirror index is 0, the sockets is newly added and a new mirror must be created. */
mirror = node_group_expose_socket(ntree, sock, sync_in_out);
diff --git a/source/blender/nodes/shader/node_shader_tree.c b/source/blender/nodes/shader/node_shader_tree.c
index 642e4be10d7..c50005bef67 100644
--- a/source/blender/nodes/shader/node_shader_tree.c
+++ b/source/blender/nodes/shader/node_shader_tree.c
@@ -211,7 +211,7 @@ void ntreeShaderExecTree(bNodeTree *ntree, ShadeInput *shi, ShadeResult *shr)
memset(shr, 0, sizeof(ShadeResult));
if (!exec)
- exec = ntree->execdata = ntreeShaderBeginExecTree(exec->nodetree, 1);
+ exec = ntree->execdata = ntreeShaderBeginExecTree(ntree, 1);
nts= ntreeGetThreadStack(exec, shi->thread);
ntreeExecThreadNodes(exec, nts, &scd, shi->thread);
diff --git a/source/blender/nodes/shader/nodes/node_shader_value.c b/source/blender/nodes/shader/nodes/node_shader_value.c
index aadbd034e10..119a3664308 100644
--- a/source/blender/nodes/shader/nodes/node_shader_value.c
+++ b/source/blender/nodes/shader/nodes/node_shader_value.c
@@ -36,7 +36,8 @@
/* **************** VALUE ******************** */
static bNodeSocketTemplate sh_node_value_out[]= {
- { SOCK_FLOAT, 0, "Value"},
+ /* XXX value nodes use the output sockets for buttons, so we need explicit limits here! */
+ { SOCK_FLOAT, 0, "Value", 0.0f, 0.0f, 0.0f, 0.0f, -FLT_MAX, FLT_MAX},
{ -1, 0, "" }
};
diff --git a/source/blender/python/generic/py_capi_utils.c b/source/blender/python/generic/py_capi_utils.c
index b7e67ec5a93..a1571dc028c 100644
--- a/source/blender/python/generic/py_capi_utils.c
+++ b/source/blender/python/generic/py_capi_utils.c
@@ -209,6 +209,10 @@ PyObject *PyC_Object_GetAttrStringArgs(PyObject *o, Py_ssize_t n, ...)
}
/* returns the exception string as a new PyUnicode object, depends on external traceback module */
+#if 0
+
+/* this version uses traceback module but somehow fails on UI errors */
+
PyObject *PyC_ExceptionBuffer(void)
{
PyObject *traceback_mod= NULL;
@@ -236,6 +240,78 @@ error_cleanup:
return ret;
}
+#else /* verbose, non-threadsafe version */
+PyObject *PyC_ExceptionBuffer(void)
+{
+ PyObject *stdout_backup = PySys_GetObject("stdout"); /* borrowed */
+ PyObject *stderr_backup = PySys_GetObject("stderr"); /* borrowed */
+ PyObject *string_io = NULL;
+ PyObject *string_io_buf = NULL;
+ PyObject *string_io_mod= NULL;
+ PyObject *string_io_getvalue= NULL;
+
+ PyObject *error_type, *error_value, *error_traceback;
+
+ if (!PyErr_Occurred())
+ return NULL;
+
+ PyErr_Fetch(&error_type, &error_value, &error_traceback);
+
+ PyErr_Clear();
+
+ /* import io
+ * string_io = io.StringIO()
+ */
+
+ if(! (string_io_mod= PyImport_ImportModule("io")) ) {
+ goto error_cleanup;
+ }
+ else if (! (string_io = PyObject_CallMethod(string_io_mod, (char *)"StringIO", NULL))) {
+ goto error_cleanup;
+ }
+ else if (! (string_io_getvalue= PyObject_GetAttrString(string_io, "getvalue"))) {
+ goto error_cleanup;
+ }
+
+ Py_INCREF(stdout_backup); // since these were borrowed we dont want them freed when replaced.
+ Py_INCREF(stderr_backup);
+
+ PySys_SetObject("stdout", string_io); // both of these are free'd when restoring
+ PySys_SetObject("stderr", string_io);
+
+ PyErr_Restore(error_type, error_value, error_traceback);
+ PyErr_Print(); /* print the error */
+ PyErr_Clear();
+
+ string_io_buf = PyObject_CallObject(string_io_getvalue, NULL);
+
+ PySys_SetObject("stdout", stdout_backup);
+ PySys_SetObject("stderr", stderr_backup);
+
+ Py_DECREF(stdout_backup); /* now sys owns the ref again */
+ Py_DECREF(stderr_backup);
+
+ Py_DECREF(string_io_mod);
+ Py_DECREF(string_io_getvalue);
+ Py_DECREF(string_io); /* free the original reference */
+
+ PyErr_Clear();
+ return string_io_buf;
+
+
+error_cleanup:
+ /* could not import the module so print the error and close */
+ Py_XDECREF(string_io_mod);
+ Py_XDECREF(string_io);
+
+ PyErr_Restore(error_type, error_value, error_traceback);
+ PyErr_Print(); /* print the error */
+ PyErr_Clear();
+
+ return NULL;
+}
+#endif
+
/* string conversion, escape non-unicode chars, coerce must be set to NULL */
const char *PyC_UnicodeAsByte(PyObject *py_str, PyObject **coerce)
diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c
index 8861f128c4b..518ebeafc80 100644
--- a/source/blender/windowmanager/intern/wm_event_system.c
+++ b/source/blender/windowmanager/intern/wm_event_system.c
@@ -441,12 +441,17 @@ static void wm_operator_reports(bContext *C, wmOperator *op, int retval, int pop
if(op->reports->list.first) {
/* FIXME, temp setting window, see other call to uiPupMenuReports for why */
wmWindow *win_prev= CTX_wm_window(C);
+ ScrArea *area_prev= CTX_wm_area(C);
+ ARegion *ar_prev= CTX_wm_region(C);
+
if(win_prev==NULL)
CTX_wm_window_set(C, CTX_wm_manager(C)->windows.first);
uiPupMenuReports(C, op->reports);
CTX_wm_window_set(C, win_prev);
+ CTX_wm_area_set(C, area_prev);
+ CTX_wm_region_set(C, ar_prev);
}
}
@@ -1394,6 +1399,9 @@ static int wm_handler_fileselect_call(bContext *C, ListBase *handlers, wmEventHa
* only have because lib linking errors need to be seen by users :(
* it can be removed without breaking anything but then no linking errors - campbell */
wmWindow *win_prev= CTX_wm_window(C);
+ ScrArea *area_prev= CTX_wm_area(C);
+ ARegion *ar_prev= CTX_wm_region(C);
+
if(win_prev==NULL)
CTX_wm_window_set(C, CTX_wm_manager(C)->windows.first);
@@ -1405,6 +1413,8 @@ static int wm_handler_fileselect_call(bContext *C, ListBase *handlers, wmEventHa
BLI_movelisttolist(&CTX_wm_reports(C)->list, &handler->op->reports->list);
CTX_wm_window_set(C, win_prev);
+ CTX_wm_area_set(C, area_prev);
+ CTX_wm_region_set(C, ar_prev);
}
WM_operator_free(handler->op);