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:
authorTamito Kajiyama <rd6t-kjym@asahi-net.or.jp>2010-05-22 02:01:47 +0400
committerTamito Kajiyama <rd6t-kjym@asahi-net.or.jp>2010-05-22 02:01:47 +0400
commitdbcb73c033fc15fc0df2ab0a05ac0b2c4a9a31b1 (patch)
tree630247e3c4b18a799545bee8de23ee075cfa5a79
parentf76c3aa3764283918413a50ed9dab079e720ed98 (diff)
parentc0a0f2c43e934e2054eefe5bf90889cf67b736f9 (diff)
Merged changes in the trunk up to revision 28911.
-rw-r--r--CMake/macros.cmake6
-rw-r--r--CMakeLists.txt28
-rw-r--r--config/darwin-config.py3
-rw-r--r--config/linux2-config.py2
-rw-r--r--config/win32-mingw-config.py1
-rw-r--r--config/win32-vc-config.py1
-rw-r--r--config/win64-vc-config.py1
-rw-r--r--intern/audaspace/ffmpeg/AUD_FFMPEGFactory.cpp3
-rw-r--r--intern/audaspace/intern/AUD_C-API.cpp6
-rw-r--r--intern/audaspace/intern/AUD_FileFactory.cpp3
-rw-r--r--intern/ghost/CMakeLists.txt92
-rw-r--r--release/scripts/io/engine_render_pov.py4
-rw-r--r--release/scripts/io/import_anim_bvh.py24
-rw-r--r--release/scripts/io/import_shape_mdd.py2
-rw-r--r--release/scripts/keyingsets/keyingsets_utils.py2
-rw-r--r--release/scripts/modules/bpy/utils.py7
-rw-r--r--release/scripts/modules/bpy_types.py13
-rw-r--r--release/scripts/modules/rna_info.py6
-rw-r--r--release/scripts/op/object.py21
-rw-r--r--release/scripts/op/sequencer.py15
-rw-r--r--release/scripts/templates/operator_modal_view3d.py56
-rw-r--r--release/scripts/ui/properties_animviz.py4
-rw-r--r--release/scripts/ui/properties_data_armature.py2
-rw-r--r--release/scripts/ui/properties_data_armature_rigify.py2
-rw-r--r--release/scripts/ui/properties_data_bone.py2
-rw-r--r--release/scripts/ui/properties_data_camera.py2
-rw-r--r--release/scripts/ui/properties_data_curve.py2
-rw-r--r--release/scripts/ui/properties_data_empty.py2
-rw-r--r--release/scripts/ui/properties_data_lamp.py2
-rw-r--r--release/scripts/ui/properties_data_lattice.py2
-rw-r--r--release/scripts/ui/properties_data_mesh.py2
-rw-r--r--release/scripts/ui/properties_data_metaball.py2
-rw-r--r--release/scripts/ui/properties_data_modifier.py4
-rw-r--r--release/scripts/ui/properties_game.py2
-rw-r--r--release/scripts/ui/properties_material.py2
-rw-r--r--release/scripts/ui/properties_object.py2
-rw-r--r--release/scripts/ui/properties_object_constraint.py2
-rw-r--r--release/scripts/ui/properties_particle.py2
-rw-r--r--release/scripts/ui/properties_physics_cloth.py4
-rw-r--r--release/scripts/ui/properties_physics_common.py11
-rw-r--r--release/scripts/ui/properties_physics_field.py2
-rw-r--r--release/scripts/ui/properties_physics_fluid.py4
-rw-r--r--release/scripts/ui/properties_physics_smoke.py2
-rw-r--r--release/scripts/ui/properties_physics_softbody.py2
-rw-r--r--release/scripts/ui/properties_render.py27
-rw-r--r--release/scripts/ui/properties_scene.py3
-rw-r--r--release/scripts/ui/properties_texture.py5
-rw-r--r--release/scripts/ui/properties_world.py10
-rw-r--r--release/scripts/ui/space_image.py2
-rw-r--r--release/scripts/ui/space_info.py2
-rw-r--r--release/scripts/ui/space_logic.py11
-rw-r--r--release/scripts/ui/space_sequencer.py1
-rw-r--r--release/scripts/ui/space_text.py2
-rw-r--r--release/scripts/ui/space_userpref.py7
-rw-r--r--release/scripts/ui/space_view3d.py17
-rw-r--r--source/blender/blenkernel/BKE_global.h3
-rw-r--r--source/blender/blenkernel/BKE_multires.h6
-rw-r--r--source/blender/blenkernel/BKE_utildefines.h1
-rw-r--r--source/blender/blenkernel/CMakeLists.txt4
-rw-r--r--source/blender/blenkernel/SConscript3
-rw-r--r--source/blender/blenkernel/intern/Makefile4
-rw-r--r--source/blender/blenkernel/intern/anim.c95
-rw-r--r--source/blender/blenkernel/intern/anim_sys.c35
-rw-r--r--source/blender/blenkernel/intern/armature.c4
-rw-r--r--source/blender/blenkernel/intern/image.c8
-rw-r--r--source/blender/blenkernel/intern/multires.c10
-rw-r--r--source/blender/blenkernel/intern/packedFile.c8
-rw-r--r--source/blender/blenkernel/intern/pointcache.c58
-rw-r--r--source/blender/blenloader/intern/readblenentry.c17
-rw-r--r--source/blender/blenloader/intern/readfile.c10
-rw-r--r--source/blender/editors/CMakeLists.txt4
-rw-r--r--source/blender/editors/animation/anim_channels_edit.c15
-rw-r--r--source/blender/editors/animation/anim_filter.c77
-rw-r--r--source/blender/editors/include/ED_anim_api.h1
-rw-r--r--source/blender/editors/interface/interface_handlers.c7
-rw-r--r--source/blender/editors/interface/interface_layout.c2
-rw-r--r--source/blender/editors/interface/interface_templates.c2
-rw-r--r--source/blender/editors/interface/resources.c5
-rw-r--r--source/blender/editors/object/object_constraint.c2
-rw-r--r--source/blender/editors/object/object_edit.c167
-rw-r--r--source/blender/editors/object/object_intern.h8
-rw-r--r--source/blender/editors/object/object_modifier.c4
-rw-r--r--source/blender/editors/object/object_ops.c2
-rw-r--r--source/blender/editors/physics/physics_pointcache.c16
-rw-r--r--source/blender/editors/render/render_opengl.c14
-rw-r--r--source/blender/editors/screen/screen_ops.c3
-rw-r--r--source/blender/editors/space_action/action_edit.c36
-rw-r--r--source/blender/editors/space_action/action_select.c33
-rw-r--r--source/blender/editors/space_file/Makefile4
-rw-r--r--source/blender/editors/space_file/SConscript4
-rw-r--r--source/blender/editors/space_file/writeimage.c5
-rw-r--r--source/blender/editors/space_graph/graph_buttons.c92
-rw-r--r--source/blender/editors/space_graph/graph_edit.c42
-rw-r--r--source/blender/editors/space_graph/graph_select.c22
-rw-r--r--source/blender/editors/space_graph/space_graph.c2
-rw-r--r--source/blender/editors/space_image/Makefile4
-rw-r--r--source/blender/editors/space_image/SConscript2
-rw-r--r--source/blender/editors/space_image/image_ops.c5
-rw-r--r--source/blender/editors/space_logic/logic_window.c30
-rw-r--r--source/blender/editors/space_logic/space_logic.c1
-rw-r--r--source/blender/editors/space_nla/nla_select.c2
-rw-r--r--source/blender/editors/space_sequencer/sequencer_edit.c8
-rw-r--r--source/blender/editors/space_view3d/drawanimviz.c27
-rw-r--r--source/blender/editors/space_view3d/drawobject.c40
-rw-r--r--source/blender/editors/space_view3d/view3d_draw.c8
-rw-r--r--source/blender/editors/space_view3d/view3d_view.c3
-rw-r--r--source/blender/editors/transform/transform.c6
-rw-r--r--source/blender/editors/transform/transform_conversions.c64
-rw-r--r--source/blender/editors/transform/transform_generics.c2
-rw-r--r--source/blender/editors/transform/transform_orientations.c1
-rw-r--r--source/blender/gpu/GPU_draw.h1
-rw-r--r--source/blender/gpu/intern/gpu_draw.c11
-rw-r--r--source/blender/imbuf/CMakeLists.txt17
-rw-r--r--source/blender/imbuf/SConscript3
-rw-r--r--source/blender/imbuf/intern/Makefile6
-rw-r--r--source/blender/imbuf/intern/dynlibtiff.c280
-rw-r--r--source/blender/imbuf/intern/dynlibtiff.h59
-rw-r--r--source/blender/imbuf/intern/filetype.c6
-rw-r--r--source/blender/imbuf/intern/jp2.c36
-rw-r--r--source/blender/imbuf/intern/openexr/openexr_api.cpp53
-rw-r--r--source/blender/imbuf/intern/tiff.c330
-rw-r--r--source/blender/imbuf/intern/util.c13
-rw-r--r--source/blender/makesdna/DNA_action_types.h2
-rw-r--r--source/blender/makesdna/DNA_object_types.h5
-rw-r--r--source/blender/makesdna/DNA_userdef_types.h2
-rw-r--r--source/blender/makesrna/RNA_types.h41
-rw-r--r--source/blender/makesrna/SConscript3
-rw-r--r--source/blender/makesrna/intern/CMakeLists.txt4
-rw-r--r--source/blender/makesrna/intern/Makefile4
-rw-r--r--source/blender/makesrna/intern/rna_action.c50
-rw-r--r--source/blender/makesrna/intern/rna_actuator.c43
-rw-r--r--source/blender/makesrna/intern/rna_animation.c2
-rw-r--r--source/blender/makesrna/intern/rna_animviz.c9
-rw-r--r--source/blender/makesrna/intern/rna_curve.c4
-rw-r--r--source/blender/makesrna/intern/rna_fcurve.c28
-rw-r--r--source/blender/makesrna/intern/rna_image.c2
-rw-r--r--source/blender/makesrna/intern/rna_main_api.c163
-rw-r--r--source/blender/makesrna/intern/rna_material.c4
-rw-r--r--source/blender/makesrna/intern/rna_modifier.c2
-rw-r--r--source/blender/makesrna/intern/rna_object.c13
-rw-r--r--source/blender/makesrna/intern/rna_scene.c93
-rw-r--r--source/blender/makesrna/intern/rna_sensor.c11
-rw-r--r--source/blender/makesrna/intern/rna_space.c72
-rw-r--r--source/blender/makesrna/intern/rna_texture.c4
-rw-r--r--source/blender/makesrna/intern/rna_userdef.c7
-rw-r--r--source/blender/makesrna/intern/rna_world.c8
-rw-r--r--source/blender/python/doc/sphinx_doc_gen.py38
-rw-r--r--source/blender/python/generic/bgl.c17
-rw-r--r--source/blender/python/generic/blf_api.c6
-rw-r--r--source/blender/python/generic/mathutils_color.c7
-rw-r--r--source/blender/python/generic/mathutils_euler.c7
-rw-r--r--source/blender/python/generic/mathutils_matrix.c17
-rw-r--r--source/blender/python/generic/mathutils_quat.c17
-rw-r--r--source/blender/python/generic/mathutils_vector.c19
-rw-r--r--source/blender/python/intern/bpy_app.c4
-rw-r--r--source/blender/python/intern/bpy_driver.c25
-rw-r--r--source/blender/python/intern/bpy_rna.c28
-rw-r--r--source/blender/render/intern/source/rendercore.c2
-rw-r--r--source/creator/CMakeLists.txt5
-rw-r--r--source/creator/Makefile4
-rw-r--r--source/creator/SConscript3
-rw-r--r--source/creator/creator.c2
-rw-r--r--source/gameengine/Expressions/ListValue.cpp6
-rw-r--r--source/gameengine/Ketsji/KX_GameObject.cpp4
-rw-r--r--source/gameengine/Ketsji/KX_PythonSeq.cpp2
-rw-r--r--source/gameengine/Ketsji/KX_Scene.cpp6
-rw-r--r--source/gameengine/PyDoc/GameKeys.py190
-rw-r--r--source/gameengine/PyDoc/GameLogic.py518
-rw-r--r--source/gameengine/PyDoc/GameTypes.py6184
-rw-r--r--source/gameengine/PyDoc/Rasterizer.py221
-rw-r--r--source/gameengine/PyDoc/bge.events.rst194
-rw-r--r--source/gameengine/PyDoc/bge.logic.rst622
-rw-r--r--source/gameengine/PyDoc/bge.render.rst231
-rw-r--r--source/gameengine/PyDoc/bge.types.rst4339
-rw-r--r--source/nan_definitions.mk5
-rw-r--r--source/nan_link.mk4
-rw-r--r--tools/Blender.py4
-rw-r--r--tools/btools.py3
178 files changed, 7465 insertions, 8144 deletions
diff --git a/CMake/macros.cmake b/CMake/macros.cmake
index 73458d7312e..54b14dbd5ce 100644
--- a/CMake/macros.cmake
+++ b/CMake/macros.cmake
@@ -61,6 +61,9 @@ MACRO(SETUP_LIBDIRS)
IF(WITH_OPENEXR)
LINK_DIRECTORIES(${OPENEXR_LIBPATH})
ENDIF(WITH_OPENEXR)
+ IF(WITH_TIFF)
+ LINK_DIRECTORIES(${TIFF_LIBPATH})
+ ENDIF(WITH_TIFF)
IF(WITH_QUICKTIME)
LINK_DIRECTORIES(${QUICKTIME_LIBPATH})
ENDIF(WITH_QUICKTIME)
@@ -134,6 +137,9 @@ MACRO(SETUP_LIBLINKS
IF(WITH_QUICKTIME)
TARGET_LINK_LIBRARIES(${target} ${QUICKTIME_LIB})
ENDIF(WITH_QUICKTIME)
+ IF(WITH_TIFF)
+ TARGET_LINK_LIBRARIES(${target} ${TIFF_LIBRARY})
+ ENDIF(WITH_TIFF)
IF(WITH_OPENEXR)
IF(WIN32)
FOREACH(loop_var ${OPENEXR_LIB})
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 038b61e56a6..19d1bdc9405 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -63,6 +63,7 @@ OPTION(WITH_BULLET "Enable Bullet (Physics Engine)" ON)
OPTION(WITH_INTERNATIONAL "Enable I18N (International fonts and text)" ON)
OPTION(WITH_ELBEEM "Enable Elbeem (Fluid Simulation)" ON)
OPTION(WITH_OPENEXR "Enable OpenEXR Support (http://www.openexr.com)" ON)
+OPTION(WITH_TIFF "Enable LibTIFF Support" ON)
OPTION(WITH_DDS "Enable DDS Support" ON)
OPTION(WITH_FFMPEG "Enable FFMPeg Support (http://ffmpeg.mplayerhq.hu/)" OFF)
OPTION(WITH_PYTHON "Enable Embedded Python API" ON)
@@ -124,11 +125,9 @@ IF(UNIX AND NOT APPLE)
IF(WITH_OPENAL)
FIND_PACKAGE(OpenAL)
- IF(OPENAL_FOUND)
- SET(WITH_OPENAL ON)
- ELSE(OPENAL_FOUND)
+ IF(NOT OPENAL_FOUND)
SET(WITH_OPENAL OFF)
- ENDIF(OPENAL_FOUND)
+ ENDIF(NOT OPENAL_FOUND)
ENDIF(WITH_OPENAL)
IF(WITH_JACK)
@@ -185,11 +184,11 @@ IF(UNIX AND NOT APPLE)
ENDIF(NOT SDL_FOUND)
ENDIF(WITH_SDL)
- SET(OPENEXR /usr CACHE FILEPATH "OPENEXR Directory")
+ SET(OPENEXR /usr CACHE FILEPATH "OPENEXR Directory")
FIND_PATH(OPENEXR_INC
ImfXdr.h
PATHS
- ${OPENEXR}/include/OpenEXR
+ ${OPENEXR}/include/OpenEXR
/usr/local/include/OpenEXR
/sw/include/OpenEXR
/opt/local/include/OpenEXR
@@ -215,6 +214,13 @@ IF(UNIX AND NOT APPLE)
SET(LIBSAMPLERATE_LIB samplerate)
SET(LIBSAMPLERATE_LIBPATH ${LIBSAMPLERATE}/lib)
+ IF(WITH_TIFF)
+ FIND_PACKAGE(TIFF)
+ IF(NOT TIFF_FOUND)
+ SET(WITH_TIFF OFF)
+ ENDIF(NOT TIFF_FOUND)
+ ENDIF(WITH_TIFF)
+
FIND_PACKAGE(JPEG REQUIRED)
FIND_PACKAGE(PNG REQUIRED)
@@ -409,7 +415,9 @@ IF(WIN32)
SET(JPEG_LIBPATH ${JPEG}/lib)
SET(TIFF ${LIBDIR}/tiff)
- SET(TIFF_INC ${TIFF}/include)
+ SET(TIFF_INCLUDE_DIR ${TIFF}/include)
+ SET(TIFF_LIBRARY tiff)
+ SET(TIFF_LIBPATH ${TIFF}/lib)
SET(WINTAB_INC ${LIBDIR}/wintab/include)
@@ -478,7 +486,7 @@ IF(APPLE)
# SET(PYTHON_BINARY "${PYTHON}/bin/python${PYTHON_VERSION}") # not used yet
SET(PYTHON_LIB python${PYTHON_VERSION})
SET(PYTHON_LIBPATH "${PYTHON}/lib/python${PYTHON_VERSION}")
- # SET(PYTHON_LINKFLAGS "-u _PyMac_Error") # won't build with this enabled
+ # SET(PYTHON_LINKFLAGS "-u _PyMac_Error") # won't build with this enabled
ELSE(PYTHON_VERSION MATCHES 3.1)
# otherwise, use custom system framework
@@ -585,7 +593,9 @@ IF(APPLE)
SET(JPEG_LIBPATH ${JPEG}/lib)
SET(TIFF ${LIBDIR}/tiff)
- SET(TIFF_INC ${TIFF}/include)
+ SET(TIFF_INCLUDE_DIR ${TIFF}/include)
+ SET(TIFF_LIBRARY tiff)
+ SET(TIFF_LIBPATH ${TIFF}/lib)
SET(EXETYPE MACOSX_BUNDLE)
diff --git a/config/darwin-config.py b/config/darwin-config.py
index bac4c9ab165..2c3d0a7e87e 100644
--- a/config/darwin-config.py
+++ b/config/darwin-config.py
@@ -163,8 +163,11 @@ BF_PNG_INC = '${BF_PNG}/include'
BF_PNG_LIB = 'png'
BF_PNG_LIBPATH = '${BF_PNG}/lib'
+WITH_BF_TIFF = True
BF_TIFF = LIBDIR + '/tiff'
BF_TIFF_INC = '${BF_TIFF}/include'
+BF_TIFF_LIB = 'tiff'
+BF_TIFF_LIBPATH = '${BF_TIFF}/lib'
WITH_BF_ZLIB = True
BF_ZLIB = '/usr'
diff --git a/config/linux2-config.py b/config/linux2-config.py
index 3951dac2454..199ea391d4e 100644
--- a/config/linux2-config.py
+++ b/config/linux2-config.py
@@ -68,8 +68,10 @@ BF_PNG = '/usr'
BF_PNG_INC = '${BF_PNG}/include'
BF_PNG_LIB = 'png'
+WITH_BF_TIFF = True
BF_TIFF = '/usr'
BF_TIFF_INC = '${BF_TIFF}/include'
+BF_TIFF_LIB = 'tiff'
WITH_BF_ZLIB = True
BF_ZLIB = '/usr'
diff --git a/config/win32-mingw-config.py b/config/win32-mingw-config.py
index 9088db5a5d8..319c9b264f2 100644
--- a/config/win32-mingw-config.py
+++ b/config/win32-mingw-config.py
@@ -73,6 +73,7 @@ BF_PNG_INC = '${BF_PNG}/include'
BF_PNG_LIB = 'png'
BF_PNG_LIBPATH = '${BF_PNG}/lib'
+WITH_BF_TIFF = True
BF_TIFF = LIBDIR + '/tiff'
BF_TIFF_INC = '${BF_TIFF}/include'
BF_TIFF_LIB = 'libtiff'
diff --git a/config/win32-vc-config.py b/config/win32-vc-config.py
index 3e8dfc3d5df..b3766247d2d 100644
--- a/config/win32-vc-config.py
+++ b/config/win32-vc-config.py
@@ -79,6 +79,7 @@ BF_PNG_INC = '${BF_PNG}/include'
BF_PNG_LIB = 'libpng_st'
BF_PNG_LIBPATH = '${BF_PNG}/lib'
+WITH_BF_TIFF = True
BF_TIFF = LIBDIR + '/tiff'
BF_TIFF_INC = '${BF_TIFF}/include'
BF_TIFF_LIB = 'libtiff'
diff --git a/config/win64-vc-config.py b/config/win64-vc-config.py
index 41772dea14b..c1cbb7cfee8 100644
--- a/config/win64-vc-config.py
+++ b/config/win64-vc-config.py
@@ -75,6 +75,7 @@ BF_PNG_INC = '${BF_PNG}/include'
BF_PNG_LIB = 'libpng'
BF_PNG_LIBPATH = '${BF_PNG}/lib'
+WITH_BF_TIFF = True
BF_TIFF = LIBDIR + '/tiff'
BF_TIFF_INC = '${BF_TIFF}/include'
BF_TIFF_LIB = 'libtiff'
diff --git a/intern/audaspace/ffmpeg/AUD_FFMPEGFactory.cpp b/intern/audaspace/ffmpeg/AUD_FFMPEGFactory.cpp
index f67c819ff10..8e71c97baec 100644
--- a/intern/audaspace/ffmpeg/AUD_FFMPEGFactory.cpp
+++ b/intern/audaspace/ffmpeg/AUD_FFMPEGFactory.cpp
@@ -23,6 +23,9 @@
* ***** END LGPL LICENSE BLOCK *****
*/
+// needed for INT64_C
+#define __STDC_CONSTANT_MACROS
+
#include "AUD_FFMPEGFactory.h"
#include "AUD_FFMPEGReader.h"
#include "AUD_Buffer.h"
diff --git a/intern/audaspace/intern/AUD_C-API.cpp b/intern/audaspace/intern/AUD_C-API.cpp
index 32cfd2098b0..8740f62c9a7 100644
--- a/intern/audaspace/intern/AUD_C-API.cpp
+++ b/intern/audaspace/intern/AUD_C-API.cpp
@@ -27,6 +27,11 @@
#include <cstring>
#include <cmath>
+#ifdef WITH_FFMPEG
+// needed for INT64_C
+#define __STDC_CONSTANT_MACROS
+#endif
+
#include "AUD_NULLDevice.h"
#include "AUD_I3DDevice.h"
#include "AUD_FileFactory.h"
@@ -62,6 +67,7 @@
#include "AUD_JackDevice.h"
#endif
+
#ifdef WITH_FFMPEG
extern "C" {
#include <libavformat/avformat.h>
diff --git a/intern/audaspace/intern/AUD_FileFactory.cpp b/intern/audaspace/intern/AUD_FileFactory.cpp
index b63390803b1..5888479a0ba 100644
--- a/intern/audaspace/intern/AUD_FileFactory.cpp
+++ b/intern/audaspace/intern/AUD_FileFactory.cpp
@@ -29,6 +29,9 @@
#include <cstring>
#ifdef WITH_FFMPEG
+// needed for INT64_C
+#define __STDC_CONSTANT_MACROS
+
#include "AUD_FFMPEGReader.h"
#endif
#ifdef WITH_SNDFILE
diff --git a/intern/ghost/CMakeLists.txt b/intern/ghost/CMakeLists.txt
index ba62bcb8e4b..fa630ce26f0 100644
--- a/intern/ghost/CMakeLists.txt
+++ b/intern/ghost/CMakeLists.txt
@@ -24,57 +24,67 @@
#
# ***** END GPL LICENSE BLOCK *****
-SET(INC . ../string ../../extern/glew/include ../../source/blender/imbuf ../../source/blender/makesdna)
+SET(INC
+ .
+ ../string
+ ../../extern/glew/include
+ ../../source/blender/imbuf
+ ../../source/blender/makesdna
+)
-FILE(GLOB SRC intern/*.cpp intern/*.mm)
+SET(SRC
+ ${CMAKE_CURRENT_SOURCE_DIR}/intern/GHOST_Buttons.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/intern/GHOST_CallbackEventConsumer.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/intern/GHOST_C-api.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/intern/GHOST_DisplayManager.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/intern/GHOST_EventManager.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/intern/GHOST_EventPrinter.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/intern/GHOST_ISystem.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/intern/GHOST_ModifierKeys.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/intern/GHOST_NDOFManager.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/intern/GHOST_Rect.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/intern/GHOST_System.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/intern/GHOST_TimerManager.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/intern/GHOST_Window.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/intern/GHOST_WindowManager.cpp
+)
IF(APPLE)
IF(WITH_COCOA)
- LIST(REMOVE_ITEM SRC "${CMAKE_CURRENT_SOURCE_DIR}/intern/GHOST_DisplayManagerCarbon.cpp")
- LIST(REMOVE_ITEM SRC "${CMAKE_CURRENT_SOURCE_DIR}/intern/GHOST_SystemCarbon.cpp")
- LIST(REMOVE_ITEM SRC "${CMAKE_CURRENT_SOURCE_DIR}/intern/GHOST_WindowCarbon.cpp")
+ SET(SRC ${SRC}
+ ${CMAKE_CURRENT_SOURCE_DIR}/intern/GHOST_DisplayManagerCocoa.mm
+ ${CMAKE_CURRENT_SOURCE_DIR}/intern/GHOST_SystemCocoa.mm
+ ${CMAKE_CURRENT_SOURCE_DIR}/intern/GHOST_WindowCocoa.mm
+ )
ELSE(WITH_COCOA)
- LIST(REMOVE_ITEM SRC "${CMAKE_CURRENT_SOURCE_DIR}/intern/GHOST_DisplayManagerCocoa.mm")
- LIST(REMOVE_ITEM SRC "${CMAKE_CURRENT_SOURCE_DIR}/intern/GHOST_SystemCocoa.mm")
- LIST(REMOVE_ITEM SRC "${CMAKE_CURRENT_SOURCE_DIR}/intern/GHOST_WindowCocoa.mm")
+ SET(SRC ${SRC}
+ ${CMAKE_CURRENT_SOURCE_DIR}/intern/GHOST_DisplayManagerCarbon.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/intern/GHOST_SystemCarbon.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/intern/GHOST_WindowCarbon.cpp
+ )
ENDIF(WITH_COCOA)
- LIST(REMOVE_ITEM SRC "${CMAKE_CURRENT_SOURCE_DIR}/intern/GHOST_DisplayManagerWin32.cpp")
- LIST(REMOVE_ITEM SRC "${CMAKE_CURRENT_SOURCE_DIR}/intern/GHOST_SystemWin32.cpp")
- LIST(REMOVE_ITEM SRC "${CMAKE_CURRENT_SOURCE_DIR}/intern/GHOST_WindowWin32.cpp")
- LIST(REMOVE_ITEM SRC "${CMAKE_CURRENT_SOURCE_DIR}/intern/GHOST_DropTargetWin32.cpp")
- LIST(REMOVE_ITEM SRC "${CMAKE_CURRENT_SOURCE_DIR}/intern/GHOST_DisplayManagerX11.cpp")
- LIST(REMOVE_ITEM SRC "${CMAKE_CURRENT_SOURCE_DIR}/intern/GHOST_SystemX11.cpp")
- LIST(REMOVE_ITEM SRC "${CMAKE_CURRENT_SOURCE_DIR}/intern/GHOST_WindowX11.cpp")
IF(WITH_QUICKTIME)
ADD_DEFINITIONS(-DWITH_QUICKTIME)
ENDIF(WITH_QUICKTIME)
-ELSE(APPLE)
- IF(WIN32)
- SET(INC ${INC} ${WINTAB_INC})
- LIST(REMOVE_ITEM SRC "${CMAKE_CURRENT_SOURCE_DIR}/intern/GHOST_DisplayManagerCarbon.cpp")
- LIST(REMOVE_ITEM SRC "${CMAKE_CURRENT_SOURCE_DIR}/intern/GHOST_SystemCarbon.cpp")
- LIST(REMOVE_ITEM SRC "${CMAKE_CURRENT_SOURCE_DIR}/intern/GHOST_WindowCarbon.cpp")
- LIST(REMOVE_ITEM SRC "${CMAKE_CURRENT_SOURCE_DIR}/intern/GHOST_DisplayManagerCocoa.mm")
- LIST(REMOVE_ITEM SRC "${CMAKE_CURRENT_SOURCE_DIR}/intern/GHOST_SystemCocoa.mm")
- LIST(REMOVE_ITEM SRC "${CMAKE_CURRENT_SOURCE_DIR}/intern/GHOST_WindowCocoa.mm")
- LIST(REMOVE_ITEM SRC "${CMAKE_CURRENT_SOURCE_DIR}/intern/GHOST_DisplayManagerX11.cpp")
- LIST(REMOVE_ITEM SRC "${CMAKE_CURRENT_SOURCE_DIR}/intern/GHOST_SystemX11.cpp")
- LIST(REMOVE_ITEM SRC "${CMAKE_CURRENT_SOURCE_DIR}/intern/GHOST_WindowX11.cpp")
- ELSE(WIN32)
- SET(INC ${INC} ${X11_X11_INCLUDE_PATH})
- LIST(REMOVE_ITEM SRC "${CMAKE_CURRENT_SOURCE_DIR}/intern/GHOST_DisplayManagerWin32.cpp")
- LIST(REMOVE_ITEM SRC "${CMAKE_CURRENT_SOURCE_DIR}/intern/GHOST_DropTargetWin32.cpp")
- LIST(REMOVE_ITEM SRC "${CMAKE_CURRENT_SOURCE_DIR}/intern/GHOST_SystemWin32.cpp")
- LIST(REMOVE_ITEM SRC "${CMAKE_CURRENT_SOURCE_DIR}/intern/GHOST_WindowWin32.cpp")
- LIST(REMOVE_ITEM SRC "${CMAKE_CURRENT_SOURCE_DIR}/intern/GHOST_DisplayManagerCarbon.cpp")
- LIST(REMOVE_ITEM SRC "${CMAKE_CURRENT_SOURCE_DIR}/intern/GHOST_SystemCarbon.cpp")
- LIST(REMOVE_ITEM SRC "${CMAKE_CURRENT_SOURCE_DIR}/intern/GHOST_WindowCarbon.cpp")
- LIST(REMOVE_ITEM SRC "${CMAKE_CURRENT_SOURCE_DIR}/intern/GHOST_DisplayManagerCocoa.mm")
- LIST(REMOVE_ITEM SRC "${CMAKE_CURRENT_SOURCE_DIR}/intern/GHOST_SystemCocoa.mm")
- LIST(REMOVE_ITEM SRC "${CMAKE_CURRENT_SOURCE_DIR}/intern/GHOST_WindowCocoa.mm")
- ENDIF(WIN32)
+ELSEIF(WIN32)
+ SET(INC ${INC} ${WINTAB_INC})
+
+ SET(SRC ${SRC}
+ ${CMAKE_CURRENT_SOURCE_DIR}/intern/GHOST_DisplayManagerWin32.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/intern/GHOST_SystemWin32.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/intern/GHOST_WindowWin32.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/intern/GHOST_DropTargetWin32.cpp
+ )
+ELSEIF(UNIX)
+ SET(INC ${INC} ${X11_X11_INCLUDE_PATH})
+
+ SET(SRC ${SRC}
+ ${CMAKE_CURRENT_SOURCE_DIR}/intern/GHOST_DisplayManagerX11.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/intern/GHOST_SystemX11.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/intern/GHOST_WindowX11.cpp
+ )
ENDIF(APPLE)
BLENDERLIB(bf_ghost "${SRC}" "${INC}")
-#, libtype=['core','player'], priority = [25,15] )
+
diff --git a/release/scripts/io/engine_render_pov.py b/release/scripts/io/engine_render_pov.py
index d0f03aee65c..12cb2f61df0 100644
--- a/release/scripts/io/engine_render_pov.py
+++ b/release/scripts/io/engine_render_pov.py
@@ -545,7 +545,7 @@ def write_pov(filename, scene=None, info_callback=None):
mist = world.mist
- if mist.enabled:
+ if mist.use_mist:
file.write('fog {\n')
file.write('\tdistance %.6f\n' % mist.depth)
file.write('\tcolor rgbt<%.3g, %.3g, %.3g, %.3g>\n' % (tuple(world.horizon_color) + (1 - mist.intensity,)))
@@ -629,7 +629,7 @@ def write_pov_ini(filename_ini, filename_pov, filename_image):
file.write('Output_File_Type=T\n') # TGA, best progressive loading
file.write('Output_Alpha=1\n')
- if render.antialiasing:
+ if render.render_antialiasing:
aa_mapping = {'5': 2, '8': 3, '11': 4, '16': 5} # method 1 assumed
file.write('Antialias=1\n')
file.write('Antialias_Depth=%d\n' % aa_mapping[render.antialiasing_samples])
diff --git a/release/scripts/io/import_anim_bvh.py b/release/scripts/io/import_anim_bvh.py
index bab692f9daf..4a708d684c8 100644
--- a/release/scripts/io/import_anim_bvh.py
+++ b/release/scripts/io/import_anim_bvh.py
@@ -458,13 +458,11 @@ def bvh_node_dict2armature(context, bvh_nodes, ROT_MODE='XYZ', IMPORT_START_FRAM
pose_bone = pose_bones[bone_name]
pose_bone.rotation_mode = eul_order_lookup[tuple(bvh_node.rot_order)]
- elif ROT_MODE == 'XYZ':
- print(2)
+ elif ROT_MODE != 'QUATERNION':
for pose_bone in pose_bones:
- pose_bone.rotation_mode = 'XYZ'
+ pose_bone.rotation_mode = ROT_MODE
else:
# Quats default
- print(3)
pass
context.scene.update()
@@ -520,13 +518,13 @@ def bvh_node_dict2armature(context, bvh_nodes, ROT_MODE='XYZ', IMPORT_START_FRAM
lx, ly, lz, rx, ry, rz = bvh_node.anim_data[frame_current + 1]
if bvh_node.has_rot:
- bone_rotation_matrix = Euler(rx, ry, rz).to_matrix().resize4x4()
+ bone_rotation_matrix = Euler((rx, ry, rz)).to_matrix().resize4x4()
bone_rotation_matrix = bone_rest_matrix_inv * bone_rotation_matrix * bone_rest_matrix
if ROT_MODE == 'QUATERNION':
pose_bone.rotation_quaternion = bone_rotation_matrix.to_quat()
else:
- euler = bone_rotation_matrix.to_euler('XYZ', prev_euler[i]) # pose_bone.rotation_mode # TODO, XYZ default for now
+ euler = bone_rotation_matrix.to_euler(pose_bone.rotation_mode, prev_euler[i])
pose_bone.rotation_euler = euler
prev_euler[i] = euler
@@ -569,17 +567,17 @@ class BvhImporter(bpy.types.Operator):
loop = BoolProperty(name="Loop", description="Loop the animation playback", default=False)
rotate_mode = EnumProperty(items=(
('QUATERNION', "Quaternion", "Convert rotations to quaternions"),
- # ('NATIVE', "Euler (Native)", "Use the rotation order defined in the BVH file"),
+ ('NATIVE', "Euler (Native)", "Use the rotation order defined in the BVH file"),
('XYZ', "Euler (XYZ)", "Convert rotations to euler XYZ"),
- # ('XZY', "Euler (XZY)", "Convert rotations to euler XZY"),
- # ('YXZ', "Euler (YXZ)", "Convert rotations to euler YXZ"),
- # ('YZX', "Euler (YZX)", "Convert rotations to euler YZX"),
- # ('ZXY', "Euler (ZXY)", "Convert rotations to euler ZXY"),
- # ('ZYX', "Euler (ZYX)", "Convert rotations to euler ZYX")),
+ ('XZY', "Euler (XZY)", "Convert rotations to euler XZY"),
+ ('YXZ', "Euler (YXZ)", "Convert rotations to euler YXZ"),
+ ('YZX', "Euler (YZX)", "Convert rotations to euler YZX"),
+ ('ZXY', "Euler (ZXY)", "Convert rotations to euler ZXY"),
+ ('ZYX', "Euler (ZYX)", "Convert rotations to euler ZYX"),
),
name="Rotation",
description="Rotation conversion.",
- default='QUATERNION')
+ default='NATIVE')
def execute(self, context):
# print("Selected: " + context.active_object.name)
diff --git a/release/scripts/io/import_shape_mdd.py b/release/scripts/io/import_shape_mdd.py
index 884fa92ddd0..8fef7672912 100644
--- a/release/scripts/io/import_shape_mdd.py
+++ b/release/scripts/io/import_shape_mdd.py
@@ -104,7 +104,7 @@ from bpy.props import *
class importMDD(bpy.types.Operator):
'''Import MDD vertex keyframe file to shape keys'''
- bl_idname = "import.mdd"
+ bl_idname = "import_shape.mdd"
bl_label = "Import MDD"
# get first scene to get min and max properties for frames, fps
diff --git a/release/scripts/keyingsets/keyingsets_utils.py b/release/scripts/keyingsets/keyingsets_utils.py
index 777f5f052e2..77b0f3ebacd 100644
--- a/release/scripts/keyingsets/keyingsets_utils.py
+++ b/release/scripts/keyingsets/keyingsets_utils.py
@@ -26,7 +26,7 @@ def RKS_POLL_selected_objects(ksi, context):
def RKS_POLL_selected_bones(ksi, context):
# we must be in Pose Mode, and there must be some bones selected
if (context.active_object) and (context.active_object.mode == 'POSE'):
- if context.active_pose_bone or len(context.select_pose_bones):
+ if context.active_pose_bone or len(context.selected_pose_bones):
return True;
# nothing selected
diff --git a/release/scripts/modules/bpy/utils.py b/release/scripts/modules/bpy/utils.py
index 28e4e71a627..cab5ee5e684 100644
--- a/release/scripts/modules/bpy/utils.py
+++ b/release/scripts/modules/bpy/utils.py
@@ -348,7 +348,7 @@ def smpte_from_seconds(time, fps=None):
hours = minutes = seconds = frames = 0
if time < 0:
- time = -time
+ time = - time
neg = "-"
else:
neg = ""
@@ -361,10 +361,10 @@ def smpte_from_seconds(time, fps=None):
time = time % 60.0
seconds = int(time)
- frames= int(round(math.floor( ((time - seconds) * fps))))
+ frames= int(round(math.floor(((time - seconds) * fps))))
return "%s%02d:%02d:%02d:%02d" % (neg, hours, minutes, seconds, frames)
-
+
def smpte_from_frame(frame, fps=None, fps_base=None):
'''
@@ -380,4 +380,3 @@ def smpte_from_frame(frame, fps=None, fps_base=None):
fps_base = _bpy.context.scene.render.fps_base
return smpte_from_seconds((frame * fps_base) / fps, fps)
- \ No newline at end of file
diff --git a/release/scripts/modules/bpy_types.py b/release/scripts/modules/bpy_types.py
index 6e4596a1109..edead35dafe 100644
--- a/release/scripts/modules/bpy_types.py
+++ b/release/scripts/modules/bpy_types.py
@@ -410,6 +410,19 @@ class MeshFace(StructRNA):
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):
+ __slots__ = ()
+
+ def as_string(self):
+ """Return the text as a string."""
+ return "\n".join(line.line for line in self.lines)
+
+ def from_string(self, string):
+ """Replace text with this string."""
+ self.clear()
+ self.write(string)
+
+
import collections
diff --git a/release/scripts/modules/rna_info.py b/release/scripts/modules/rna_info.py
index 80c61e0a6d9..fa1d15a7845 100644
--- a/release/scripts/modules/rna_info.py
+++ b/release/scripts/modules/rna_info.py
@@ -200,8 +200,8 @@ class InfoPropertyRNA:
if self.type == "enum":
self.enum_items[:] = rna_prop.items.keys()
-
-
+
+
if self.array_length:
self.default = tuple(getattr(rna_prop, "default_array", ()))
else:
@@ -245,7 +245,7 @@ class InfoPropertyRNA:
type_str += self.type
if self.array_length:
type_str += " array of %d items" % (self.array_length)
-
+
if self.type in ("float", "int"):
type_str += " in [%s, %s]" % (range_str(self.min), range_str(self.max))
elif self.type == "enum":
diff --git a/release/scripts/op/object.py b/release/scripts/op/object.py
index 8a11ef7aaf6..a6e0930e69c 100644
--- a/release/scripts/op/object.py
+++ b/release/scripts/op/object.py
@@ -507,6 +507,26 @@ class MakeDupliFace(bpy.types.Operator):
return {'FINISHED'}
+class IsolateTypeRender(bpy.types.Operator):
+ '''Select object matching a naming pattern'''
+ bl_idname = "object.isolate_type_render"
+ bl_label = "Isolate Render Selection"
+ bl_options = {'REGISTER', 'UNDO'}
+
+ def execute(self, context):
+ act_type = context.object.type
+
+ for obj in context.visible_objects:
+
+ if obj.selected:
+ obj.restrict_render = False
+ else:
+ if obj.type == act_type:
+ obj.restrict_render = True
+
+ return {'FINISHED'}
+
+
classes = [
SelectPattern,
SelectCamera,
@@ -514,6 +534,7 @@ classes = [
SubdivisionSet,
ShapeTransfer,
JoinUVs,
+ IsolateTypeRender,
MakeDupliFace]
diff --git a/release/scripts/op/sequencer.py b/release/scripts/op/sequencer.py
index a542337345c..8715f7eeec5 100644
--- a/release/scripts/op/sequencer.py
+++ b/release/scripts/op/sequencer.py
@@ -22,6 +22,7 @@ import bpy
from bpy.props import *
+
class SequencerCrossfadeSounds(bpy.types.Operator):
'''Do crossfading volume animation of two selected sound strips.'''
@@ -95,16 +96,17 @@ class SequencerCutMulticam(bpy.types.Operator):
if not s.selected:
s.selected = True
-
+
cfra = context.scene.frame_current
- bpy.ops.sequencer.cut(frame=cfra,type='HARD',side='RIGHT')
+ bpy.ops.sequencer.cut(frame=cfra, type='HARD', side='RIGHT')
for s in context.scene.sequence_editor.sequences_all:
if s.selected and s.type == 'MULTICAM' and s.frame_final_start <= cfra and cfra < s.frame_final_end:
context.scene.sequence_editor.active_strip = s
-
+
context.scene.sequence_editor.active_strip.multicam_source = camera
return {'FINISHED'}
+
class SequencerDeinterlaceSelectedMovies(bpy.types.Operator):
'''Deinterlace all selected movie sources.'''
@@ -122,14 +124,13 @@ class SequencerDeinterlaceSelectedMovies(bpy.types.Operator):
for s in context.scene.sequence_editor.sequences_all:
if s.selected and s.type == 'MOVIE':
s.de_interlace = True
-
- return {'FINISHED'}
+ return {'FINISHED'}
def register():
register = bpy.types.register
-
+
register(SequencerCrossfadeSounds)
register(SequencerCutMulticam)
register(SequencerDeinterlaceSelectedMovies)
@@ -137,7 +138,7 @@ def register():
def unregister():
unregister = bpy.types.unregister
-
+
unregister(SequencerCrossfadeSounds)
unregister(SequencerCutMulticam)
unregister(SequencerDeinterlaceSelectedMovies)
diff --git a/release/scripts/templates/operator_modal_view3d.py b/release/scripts/templates/operator_modal_view3d.py
new file mode 100644
index 00000000000..2158d9dcc3f
--- /dev/null
+++ b/release/scripts/templates/operator_modal_view3d.py
@@ -0,0 +1,56 @@
+from mathutils import Vector
+from bpy.props import FloatVectorProperty
+
+class ViewOperator(bpy.types.Operator):
+ '''Translate the view using mouse events.'''
+ bl_idname = "view3d.modal_operator"
+ bl_label = "Simple View Operator"
+
+ offset = FloatVectorProperty(name="Offset", size=3)
+
+
+ def execute(self, context):
+ v3d = context.area.spaces[0]
+ rv3d = v3d.region_3d
+
+ rv3d.view_location = self._initial_location + Vector(self.properties.offset)
+
+ def modal(self, context, event):
+ v3d = context.area.spaces[0]
+ rv3d = v3d.region_3d
+
+ if event.type == 'MOUSEMOVE':
+ self.properties.offset = (self._initial_mouse - Vector((event.mouse_x, event.mouse_y, 0.0))) * 0.02
+ self.execute(context)
+
+ elif event.type == 'LEFTMOUSE':
+ return {'FINISHED'}
+
+ elif event.type in ('RIGHTMOUSE', 'ESC'):
+ rv3d.view_location = self._initial_location
+ return {'CANCELLED'}
+
+ return {'RUNNING_MODAL'}
+
+ def invoke(self, context, event):
+ active_space = context.area.spaces[0]
+
+ if active_space.type == 'VIEW_3D':
+ v3d = active_space
+ rv3d = v3d.region_3d
+
+ context.manager.add_modal_handler(self)
+
+ if rv3d.view_perspective == 'CAMERA':
+ rv3d.view_perspective = 'PERSP'
+
+ self._initial_mouse = Vector((event.mouse_x, event.mouse_y, 0.0))
+ self._initial_location = rv3d.view_location.copy()
+
+ return {'RUNNING_MODAL'}
+ else:
+ self.report({'WARNING'}, "Active space must be a View3d")
+ return {'CANCELLED'}
+
+
+bpy.types.register(ViewOperator)
diff --git a/release/scripts/ui/properties_animviz.py b/release/scripts/ui/properties_animviz.py
index 311a8b119cf..9eb046cc2c8 100644
--- a/release/scripts/ui/properties_animviz.py
+++ b/release/scripts/ui/properties_animviz.py
@@ -19,7 +19,7 @@
# <pep8 compliant>
import bpy
-narrowui = 180
+narrowui = bpy.context.user_preferences.view.properties_width_check
################################################
# Generic Panels (Independent of DataType)
@@ -61,6 +61,8 @@ class MotionPathButtonsPanel(bpy.types.Panel):
col.label(text="Display:")
col.prop(mps, "show_frame_numbers", text="Frame Numbers")
col.prop(mps, "highlight_keyframes", text="Keyframes")
+ if bones:
+ col.prop(mps, "search_all_action_keyframes", text="+ Non-Grouped Keyframes")
col.prop(mps, "show_keyframe_numbers", text="Keyframe Numbers")
diff --git a/release/scripts/ui/properties_data_armature.py b/release/scripts/ui/properties_data_armature.py
index 953ab5e5abd..805a21b3be2 100644
--- a/release/scripts/ui/properties_data_armature.py
+++ b/release/scripts/ui/properties_data_armature.py
@@ -20,7 +20,7 @@
import bpy
from rna_prop_ui import PropertyPanel
-narrowui = 180
+narrowui = bpy.context.user_preferences.view.properties_width_check
class DataButtonsPanel(bpy.types.Panel):
diff --git a/release/scripts/ui/properties_data_armature_rigify.py b/release/scripts/ui/properties_data_armature_rigify.py
index ba012368def..5ec50973ea4 100644
--- a/release/scripts/ui/properties_data_armature_rigify.py
+++ b/release/scripts/ui/properties_data_armature_rigify.py
@@ -19,7 +19,7 @@
# <pep8 compliant>
import bpy
-narrowui = 180
+narrowui = bpy.context.user_preferences.view.properties_width_check
class PoseTemplateSettings(bpy.types.IDPropertyGroup):
diff --git a/release/scripts/ui/properties_data_bone.py b/release/scripts/ui/properties_data_bone.py
index 982572b62a3..b6b638ef380 100644
--- a/release/scripts/ui/properties_data_bone.py
+++ b/release/scripts/ui/properties_data_bone.py
@@ -20,7 +20,7 @@
import bpy
from rna_prop_ui import PropertyPanel
-narrowui = 180
+narrowui = bpy.context.user_preferences.view.properties_width_check
class BoneButtonsPanel(bpy.types.Panel):
diff --git a/release/scripts/ui/properties_data_camera.py b/release/scripts/ui/properties_data_camera.py
index 4ce124a279e..3abd460c427 100644
--- a/release/scripts/ui/properties_data_camera.py
+++ b/release/scripts/ui/properties_data_camera.py
@@ -20,7 +20,7 @@
import bpy
from rna_prop_ui import PropertyPanel
-narrowui = 180
+narrowui = bpy.context.user_preferences.view.properties_width_check
class DataButtonsPanel(bpy.types.Panel):
diff --git a/release/scripts/ui/properties_data_curve.py b/release/scripts/ui/properties_data_curve.py
index 62c81df2ece..5f1dc662b97 100644
--- a/release/scripts/ui/properties_data_curve.py
+++ b/release/scripts/ui/properties_data_curve.py
@@ -20,7 +20,7 @@
import bpy
from rna_prop_ui import PropertyPanel
-narrowui = 180
+narrowui = bpy.context.user_preferences.view.properties_width_check
class DataButtonsPanel(bpy.types.Panel):
diff --git a/release/scripts/ui/properties_data_empty.py b/release/scripts/ui/properties_data_empty.py
index a0999fb9d4a..577e32ed840 100644
--- a/release/scripts/ui/properties_data_empty.py
+++ b/release/scripts/ui/properties_data_empty.py
@@ -19,7 +19,7 @@
# <pep8 compliant>
import bpy
-narrowui = 180
+narrowui = bpy.context.user_preferences.view.properties_width_check
class DataButtonsPanel(bpy.types.Panel):
diff --git a/release/scripts/ui/properties_data_lamp.py b/release/scripts/ui/properties_data_lamp.py
index 26f4b158c90..4338489ac5a 100644
--- a/release/scripts/ui/properties_data_lamp.py
+++ b/release/scripts/ui/properties_data_lamp.py
@@ -20,7 +20,7 @@
import bpy
from rna_prop_ui import PropertyPanel
-narrowui = 180
+narrowui = bpy.context.user_preferences.view.properties_width_check
class LAMP_MT_sunsky_presets(bpy.types.Menu):
diff --git a/release/scripts/ui/properties_data_lattice.py b/release/scripts/ui/properties_data_lattice.py
index 2a78d329223..2aa719437a7 100644
--- a/release/scripts/ui/properties_data_lattice.py
+++ b/release/scripts/ui/properties_data_lattice.py
@@ -20,7 +20,7 @@
import bpy
from rna_prop_ui import PropertyPanel
-narrowui = 180
+narrowui = bpy.context.user_preferences.view.properties_width_check
class DataButtonsPanel(bpy.types.Panel):
diff --git a/release/scripts/ui/properties_data_mesh.py b/release/scripts/ui/properties_data_mesh.py
index 5321c76679c..44d3d19e793 100644
--- a/release/scripts/ui/properties_data_mesh.py
+++ b/release/scripts/ui/properties_data_mesh.py
@@ -20,7 +20,7 @@
import bpy
from rna_prop_ui import PropertyPanel
-narrowui = 180
+narrowui = bpy.context.user_preferences.view.properties_width_check
class MESH_MT_vertex_group_specials(bpy.types.Menu):
diff --git a/release/scripts/ui/properties_data_metaball.py b/release/scripts/ui/properties_data_metaball.py
index b751a9f9059..e0155059b98 100644
--- a/release/scripts/ui/properties_data_metaball.py
+++ b/release/scripts/ui/properties_data_metaball.py
@@ -20,7 +20,7 @@
import bpy
from rna_prop_ui import PropertyPanel
-narrowui = 180
+narrowui = bpy.context.user_preferences.view.properties_width_check
class DataButtonsPanel(bpy.types.Panel):
diff --git a/release/scripts/ui/properties_data_modifier.py b/release/scripts/ui/properties_data_modifier.py
index 888d20cb5e1..a6d6e098812 100644
--- a/release/scripts/ui/properties_data_modifier.py
+++ b/release/scripts/ui/properties_data_modifier.py
@@ -19,7 +19,7 @@
# <pep8 compliant>
import bpy
-narrowui = 180
+narrowui = bpy.context.user_preferences.view.properties_width_check
narrowmod = 260
@@ -229,7 +229,7 @@ class DATA_PT_modifiers(DataButtonsPanel):
def DECIMATE(self, layout, ob, md, wide_ui):
layout.prop(md, "ratio")
- layout.prop(md, "face_count")
+ layout.label(text="Face Count: %s" % str(md.face_count))
def DISPLACE(self, layout, ob, md, wide_ui):
split = layout.split()
diff --git a/release/scripts/ui/properties_game.py b/release/scripts/ui/properties_game.py
index 41af955d9ec..a5b443a461b 100644
--- a/release/scripts/ui/properties_game.py
+++ b/release/scripts/ui/properties_game.py
@@ -19,7 +19,7 @@
# <pep8 compliant>
import bpy
-narrowui = 180
+narrowui = bpy.context.user_preferences.view.properties_width_check
class PhysicsButtonsPanel(bpy.types.Panel):
diff --git a/release/scripts/ui/properties_material.py b/release/scripts/ui/properties_material.py
index a7d9af9999d..1526bd004a0 100644
--- a/release/scripts/ui/properties_material.py
+++ b/release/scripts/ui/properties_material.py
@@ -20,7 +20,7 @@
import bpy
from rna_prop_ui import PropertyPanel
-narrowui = 180
+narrowui = bpy.context.user_preferences.view.properties_width_check
def active_node_mat(mat):
diff --git a/release/scripts/ui/properties_object.py b/release/scripts/ui/properties_object.py
index 211a7f5c2e9..6dbfe269436 100644
--- a/release/scripts/ui/properties_object.py
+++ b/release/scripts/ui/properties_object.py
@@ -20,7 +20,7 @@
import bpy
from rna_prop_ui import PropertyPanel
-narrowui = 180
+narrowui = bpy.context.user_preferences.view.properties_width_check
class ObjectButtonsPanel(bpy.types.Panel):
diff --git a/release/scripts/ui/properties_object_constraint.py b/release/scripts/ui/properties_object_constraint.py
index a81ab2fb4d2..f53bac05a7c 100644
--- a/release/scripts/ui/properties_object_constraint.py
+++ b/release/scripts/ui/properties_object_constraint.py
@@ -19,7 +19,7 @@
# <pep8 compliant>
import bpy
-narrowui = 180
+narrowui = bpy.context.user_preferences.view.properties_width_check
class ConstraintButtonsPanel(bpy.types.Panel):
diff --git a/release/scripts/ui/properties_particle.py b/release/scripts/ui/properties_particle.py
index a1bc4019c6d..35c1f84cca5 100644
--- a/release/scripts/ui/properties_particle.py
+++ b/release/scripts/ui/properties_particle.py
@@ -25,7 +25,7 @@ from properties_physics_common import effector_weights_ui
from properties_physics_common import basic_force_field_settings_ui
from properties_physics_common import basic_force_field_falloff_ui
-narrowui = 180
+narrowui = bpy.context.user_preferences.view.properties_width_check
def particle_panel_enabled(context, psys):
diff --git a/release/scripts/ui/properties_physics_cloth.py b/release/scripts/ui/properties_physics_cloth.py
index 67fc79eb4d1..834e3cf2450 100644
--- a/release/scripts/ui/properties_physics_cloth.py
+++ b/release/scripts/ui/properties_physics_cloth.py
@@ -19,7 +19,7 @@
# <pep8 compliant>
import bpy
-narrowui = 180
+narrowui = bpy.context.user_preferences.view.properties_width_check
from properties_physics_common import point_cache_ui
@@ -75,7 +75,7 @@ class PHYSICS_PT_cloth(PhysicButtonsPanel):
# add modifier
split.operator("object.modifier_add", text="Add").type = 'CLOTH'
if wide_ui:
- split.column()
+ split.label()
if md:
cloth = md.settings
diff --git a/release/scripts/ui/properties_physics_common.py b/release/scripts/ui/properties_physics_common.py
index eac2bc60f35..350b17e6e9f 100644
--- a/release/scripts/ui/properties_physics_common.py
+++ b/release/scripts/ui/properties_physics_common.py
@@ -18,16 +18,18 @@
# <pep8 compliant>
-narrowui = 180
-
import bpy
+narrowui = bpy.context.user_preferences.view.properties_width_check
+
#cachetype can be 'PSYS' 'HAIR' 'SMOKE' etc
+
+
def point_cache_ui(self, context, cache, enabled, cachetype):
layout = self.layout
wide_ui = context.region.width > narrowui
- layout.set_context_pointer("PointCache", cache)
+ layout.set_context_pointer("point_cache", cache)
row = layout.row()
row.template_list(cache, "point_cache_list", cache, "active_point_cache_index", rows=2)
@@ -68,7 +70,7 @@ def point_cache_ui(self, context, cache, enabled, cachetype):
sub = col.column()
sub.enabled = enabled
sub.prop(cache, "quick_cache")
-
+
sub = col.column()
sub.enabled = bpy.data.file_is_saved
sub.prop(cache, "disk_cache")
@@ -103,6 +105,7 @@ def point_cache_ui(self, context, cache, enabled, cachetype):
col.operator("ptcache.free_bake_all", text="Free All Bakes")
col.operator("ptcache.bake_all", text="Update All To Frame").bake = False
+
def effector_weights_ui(self, context, weights):
layout = self.layout
diff --git a/release/scripts/ui/properties_physics_field.py b/release/scripts/ui/properties_physics_field.py
index 4dfe4f6372e..57fa40e4c5d 100644
--- a/release/scripts/ui/properties_physics_field.py
+++ b/release/scripts/ui/properties_physics_field.py
@@ -19,7 +19,7 @@
# <pep8 compliant>
import bpy
-narrowui = 180
+narrowui = bpy.context.user_preferences.view.properties_width_check
from properties_physics_common import basic_force_field_settings_ui
diff --git a/release/scripts/ui/properties_physics_fluid.py b/release/scripts/ui/properties_physics_fluid.py
index e3e6e1dbb3d..32acd88654d 100644
--- a/release/scripts/ui/properties_physics_fluid.py
+++ b/release/scripts/ui/properties_physics_fluid.py
@@ -19,7 +19,7 @@
# <pep8 compliant>
import bpy
-narrowui = 180
+narrowui = bpy.context.user_preferences.view.properties_width_check
class PhysicButtonsPanel(bpy.types.Panel):
@@ -42,7 +42,7 @@ class PHYSICS_PT_fluid(PhysicButtonsPanel):
md = context.fluid
wide_ui = context.region.width > narrowui
- split = layout.split(percentage=0.5)
+ split = layout.split()
if md:
# remove modifier + settings
diff --git a/release/scripts/ui/properties_physics_smoke.py b/release/scripts/ui/properties_physics_smoke.py
index d4a40dc6788..f362588cd98 100644
--- a/release/scripts/ui/properties_physics_smoke.py
+++ b/release/scripts/ui/properties_physics_smoke.py
@@ -19,7 +19,7 @@
# <pep8 compliant>
import bpy
-narrowui = 180
+narrowui = bpy.context.user_preferences.view.properties_width_check
from properties_physics_common import point_cache_ui
diff --git a/release/scripts/ui/properties_physics_softbody.py b/release/scripts/ui/properties_physics_softbody.py
index 8e685b8a66c..696f29810a3 100644
--- a/release/scripts/ui/properties_physics_softbody.py
+++ b/release/scripts/ui/properties_physics_softbody.py
@@ -19,7 +19,7 @@
# <pep8 compliant>
import bpy
-narrowui = 180
+narrowui = bpy.context.user_preferences.view.properties_width_check
from properties_physics_common import point_cache_ui
diff --git a/release/scripts/ui/properties_render.py b/release/scripts/ui/properties_render.py
index f1c8ba0ac62..bcfb34a20ac 100644
--- a/release/scripts/ui/properties_render.py
+++ b/release/scripts/ui/properties_render.py
@@ -19,7 +19,7 @@
# <pep8 compliant>
import bpy
-narrowui = 180
+narrowui = bpy.context.user_preferences.view.properties_width_check
class RENDER_MT_presets(bpy.types.Menu):
@@ -215,14 +215,14 @@ class RENDER_PT_shading(RenderButtonsPanel):
split = layout.split()
col = split.column()
- col.prop(rd, "render_textures", text="Textures")
- col.prop(rd, "render_shadows", text="Shadows")
- col.prop(rd, "render_sss", text="Subsurface Scattering")
- col.prop(rd, "render_envmaps", text="Environment Map")
+ col.prop(rd, "use_textures", text="Textures")
+ col.prop(rd, "use_shadows", text="Shadows")
+ col.prop(rd, "use_sss", text="Subsurface Scattering")
+ col.prop(rd, "use_envmaps", text="Environment Map")
if wide_ui:
col = split.column()
- col.prop(rd, "render_raytracing", text="Ray Tracing")
+ col.prop(rd, "use_raytracing", text="Ray Tracing")
col.prop(rd, "color_management")
col.prop(rd, "alpha_mode", text="Alpha")
@@ -261,7 +261,7 @@ class RENDER_PT_performance(RenderButtonsPanel):
sub.active = rd.use_compositing
sub.prop(rd, "free_image_textures")
sub = col.column()
- sub.active = rd.render_raytracing
+ sub.active = rd.use_raytracing
sub.label(text="Acceleration structure:")
sub.prop(rd, "raytrace_structure", text="")
if rd.raytrace_structure == 'OCTREE':
@@ -347,6 +347,15 @@ class RENDER_PT_output(RenderButtonsPanel):
if rd.file_format in ('AVI_JPEG', 'JPEG'):
split = layout.split()
split.prop(rd, "file_quality", slider=True)
+
+ elif rd.file_format == 'MULTILAYER':
+ split = layout.split()
+
+ col = split.column()
+ col.label(text="Codec:")
+ col.prop(rd, "exr_codec", text="")
+ if wide_ui:
+ col = split.column()
elif rd.file_format == 'OPEN_EXR':
split = layout.split()
@@ -506,14 +515,14 @@ class RENDER_PT_antialiasing(RenderButtonsPanel):
def draw_header(self, context):
rd = context.scene.render
- self.layout.prop(rd, "antialiasing", text="")
+ self.layout.prop(rd, "render_antialiasing", text="")
def draw(self, context):
layout = self.layout
rd = context.scene.render
wide_ui = context.region.width > narrowui
- layout.active = rd.antialiasing
+ layout.active = rd.render_antialiasing
split = layout.split()
diff --git a/release/scripts/ui/properties_scene.py b/release/scripts/ui/properties_scene.py
index 119988f8fa3..5e83fad38a0 100644
--- a/release/scripts/ui/properties_scene.py
+++ b/release/scripts/ui/properties_scene.py
@@ -20,7 +20,7 @@
import bpy
from rna_prop_ui import PropertyPanel
-narrowui = 180
+narrowui = bpy.context.user_preferences.view.properties_width_check
class SceneButtonsPanel(bpy.types.Panel):
@@ -89,7 +89,6 @@ class SCENE_PT_keying_sets(SceneButtonsPanel):
row = layout.row()
col = row.column()
- # XXX: this fails because index is not what this expects...
col.template_list(scene, "keying_sets", scene, "active_keying_set_index", rows=2)
col = row.column(align=True)
diff --git a/release/scripts/ui/properties_texture.py b/release/scripts/ui/properties_texture.py
index 07a097cfd3a..39c6bdf1d9f 100644
--- a/release/scripts/ui/properties_texture.py
+++ b/release/scripts/ui/properties_texture.py
@@ -20,7 +20,7 @@
import bpy
from rna_prop_ui import PropertyPanel
-narrowui = 180
+narrowui = bpy.context.user_preferences.view.properties_width_check
class TEXTURE_MT_specials(bpy.types.Menu):
@@ -374,7 +374,8 @@ class TEXTURE_PT_influence(TextureSlotPanel):
factor_but(col, tex.map_raymir, "map_raymir", "raymir_factor", "Ray Mirror")
col.label(text="Geometry:")
- factor_but(col, tex.map_normal, "map_normal", "normal_factor", "Normal")
+ # XXX replace 'or' when displacement is fixed to not rely on normal influence value.
+ factor_but(col, (tex.map_normal or tex.map_displacement), "map_normal", "normal_factor", "Normal")
factor_but(col, tex.map_warp, "map_warp", "warp_factor", "Warp")
factor_but(col, tex.map_displacement, "map_displacement", "displacement_factor", "Displace")
diff --git a/release/scripts/ui/properties_world.py b/release/scripts/ui/properties_world.py
index 1ee47e942a0..e63d513a4b5 100644
--- a/release/scripts/ui/properties_world.py
+++ b/release/scripts/ui/properties_world.py
@@ -20,7 +20,7 @@
import bpy
from rna_prop_ui import PropertyPanel
-narrowui = 180
+narrowui = bpy.context.user_preferences.view.properties_width_check
class WorldButtonsPanel(bpy.types.Panel):
@@ -111,14 +111,14 @@ class WORLD_PT_mist(WorldButtonsPanel):
def draw_header(self, context):
world = context.world
- self.layout.prop(world.mist, "enabled", text="")
+ self.layout.prop(world.mist, "use_mist", text="")
def draw(self, context):
layout = self.layout
wide_ui = context.region.width > narrowui
world = context.world
- layout.active = world.mist.enabled
+ layout.active = world.mist.use_mist
split = layout.split()
@@ -142,14 +142,14 @@ class WORLD_PT_stars(WorldButtonsPanel):
def draw_header(self, context):
world = context.world
- self.layout.prop(world.stars, "enabled", text="")
+ self.layout.prop(world.stars, "use_stars", text="")
def draw(self, context):
layout = self.layout
wide_ui = context.region.width > narrowui
world = context.world
- layout.active = world.stars.enabled
+ layout.active = world.stars.use_stars
split = layout.split()
diff --git a/release/scripts/ui/space_image.py b/release/scripts/ui/space_image.py
index be7370302ec..f0a5a3384be 100644
--- a/release/scripts/ui/space_image.py
+++ b/release/scripts/ui/space_image.py
@@ -19,7 +19,7 @@
# <pep8 compliant>
import bpy
-narrowui = 180
+narrowui = bpy.context.user_preferences.view.properties_width_check
class IMAGE_MT_view(bpy.types.Menu):
diff --git a/release/scripts/ui/space_info.py b/release/scripts/ui/space_info.py
index 0cd92bb91fd..4c504cd69c9 100644
--- a/release/scripts/ui/space_info.py
+++ b/release/scripts/ui/space_info.py
@@ -245,7 +245,7 @@ class INFO_MT_add(bpy.types.Menu):
layout.operator_context = 'INVOKE_DEFAULT'
layout.operator("object.group_instance_add", text="Group Instance...", icon='OUTLINER_OB_EMPTY')
else:
- layout.operator_menu_enum("object.group_instance_add", "type", text="Group Instance", icon='OUTLINER_OB_EMPTY')
+ layout.operator_menu_enum("object.group_instance_add", "group", text="Group Instance", icon='OUTLINER_OB_EMPTY')
class INFO_MT_game(bpy.types.Menu):
diff --git a/release/scripts/ui/space_logic.py b/release/scripts/ui/space_logic.py
index 07b26fdc862..0dcdbbb1def 100644
--- a/release/scripts/ui/space_logic.py
+++ b/release/scripts/ui/space_logic.py
@@ -46,9 +46,18 @@ class LOGIC_PT_properties(bpy.types.Panel):
row.prop(prop, "debug", text="", toggle=True, icon='INFO')
row.operator("object.game_property_remove", text="", icon='X').index = i
+class LOGIC_MT_logicbricks_add(bpy.types.Menu):
+ bl_label = "Add"
+
+ def draw(self, context):
+ layout = self.layout
+
+ layout.operator_menu_enum("logic.sensor_add", "type", text="Sensor")
+ layout.operator_menu_enum("logic.controller_add", "type", text="Controller")
+ layout.operator_menu_enum("logic.actuator_add", "type", text="Actuator")
classes = [
- LOGIC_PT_properties]
+ LOGIC_PT_properties, LOGIC_MT_logicbricks_add]
def register():
diff --git a/release/scripts/ui/space_sequencer.py b/release/scripts/ui/space_sequencer.py
index 9460905bd85..e300cfd3d32 100644
--- a/release/scripts/ui/space_sequencer.py
+++ b/release/scripts/ui/space_sequencer.py
@@ -19,6 +19,7 @@
# <pep8 compliant>
import bpy
+
def act_strip(context):
try:
return context.scene.sequence_editor.active_strip
diff --git a/release/scripts/ui/space_text.py b/release/scripts/ui/space_text.py
index 8671e67bd87..10740f788f5 100644
--- a/release/scripts/ui/space_text.py
+++ b/release/scripts/ui/space_text.py
@@ -286,7 +286,7 @@ class TEXT_MT_toolbox(bpy.types.Menu):
layout.operator("text.paste")
layout.separator()
-
+
layout.operator("text.run_script")
diff --git a/release/scripts/ui/space_userpref.py b/release/scripts/ui/space_userpref.py
index 21ee0d107f6..ca906ef9a03 100644
--- a/release/scripts/ui/space_userpref.py
+++ b/release/scripts/ui/space_userpref.py
@@ -165,6 +165,13 @@ class USERPREF_PT_interface(bpy.types.Panel):
sub.enabled = view.show_mini_axis
sub.prop(view, "mini_axis_size", text="Size")
sub.prop(view, "mini_axis_brightness", text="Brightness")
+
+ col.separator()
+ col.separator()
+ col.separator()
+
+ col.label(text="Properties Window:")
+ col.prop(view, "properties_width_check")
row.separator()
row.separator()
diff --git a/release/scripts/ui/space_view3d.py b/release/scripts/ui/space_view3d.py
index 8be176843fc..538a13536bc 100644
--- a/release/scripts/ui/space_view3d.py
+++ b/release/scripts/ui/space_view3d.py
@@ -32,14 +32,13 @@ class VIEW3D_HT_header(bpy.types.Header):
obj = context.active_object
toolsettings = context.tool_settings
- row = layout.row()
+ row = layout.row(align=True)
row.template_header()
- sub = row.row(align=True)
-
# Menus
if context.area.show_menus:
-
+ sub = row.row(align=True)
+
sub.menu("VIEW3D_MT_view")
# Select Menu
@@ -54,6 +53,7 @@ class VIEW3D_HT_header(bpy.types.Header):
else:
sub.menu("VIEW3D_MT_object")
+ row = layout.row()
row.template_header_3D()
# do in C for now since these buttons cant be both toggle AND exclusive.
@@ -706,14 +706,13 @@ class VIEW3D_MT_object_specials(bpy.types.Menu):
def poll(self, context):
# add more special types
- obj = context.object
- return bool(obj and obj.type == 'LAMP')
+ return context.object
def draw(self, context):
layout = self.layout
obj = context.object
- if obj and obj.type == 'LAMP':
+ if obj.type == 'LAMP':
layout.operator_context = 'INVOKE_REGION_WIN'
props = layout.operator("wm.context_modal_mouse", text="Spot Size")
@@ -736,6 +735,10 @@ class VIEW3D_MT_object_specials(bpy.types.Menu):
props.path_item = "data.shadow_buffer_clip_end"
props.input_scale = 0.05
+ layout.separator()
+
+ props = layout.operator("object.isolate_type_render")
+
class VIEW3D_MT_object_apply(bpy.types.Menu):
bl_label = "Apply"
diff --git a/source/blender/blenkernel/BKE_global.h b/source/blender/blenkernel/BKE_global.h
index 291deb5ea70..6a602339e11 100644
--- a/source/blender/blenkernel/BKE_global.h
+++ b/source/blender/blenkernel/BKE_global.h
@@ -83,9 +83,6 @@ typedef struct Global {
struct VFont *selfont;
struct ListBase ttfdata;
- /* libtiff flag used to determine if shared library loaded for libtiff*/
- int have_libtiff;
-
/* this variable is written to / read from FileGlobal->fileflags */
int fileflags;
diff --git a/source/blender/blenkernel/BKE_multires.h b/source/blender/blenkernel/BKE_multires.h
index e5c7745f637..258fb6f1b3f 100644
--- a/source/blender/blenkernel/BKE_multires.h
+++ b/source/blender/blenkernel/BKE_multires.h
@@ -52,9 +52,9 @@ void multiresModifier_join(struct Object *);
void multiresModifier_del_levels(struct MultiresModifierData *, struct Object *, int direction);
void multiresModifier_subdivide(struct MultiresModifierData *mmd, struct Object *ob,
int updateblock, int simple);
-int multiresModifier_reshape(struct MultiresModifierData *mmd, struct Object *dst, struct Object *src);
-int multiresModifier_reshapeFromDM(struct MultiresModifierData *mmd, struct Object *ob, struct DerivedMesh *srcdm);
-int multiresModifier_reshapeFromDeformMod(struct MultiresModifierData *mmd, struct Object *ob, struct ModifierData *md);
+int multiresModifier_reshape(struct Object *dst, struct Object *src);
+int multiresModifier_reshapeFromDM(struct Object *ob, struct DerivedMesh *srcdm);
+int multiresModifier_reshapeFromDeformMod(struct Object *ob, struct ModifierData *md);
void multires_stitch_grids(struct Object *);
diff --git a/source/blender/blenkernel/BKE_utildefines.h b/source/blender/blenkernel/BKE_utildefines.h
index 51d915cca18..0b3fce9408c 100644
--- a/source/blender/blenkernel/BKE_utildefines.h
+++ b/source/blender/blenkernel/BKE_utildefines.h
@@ -105,6 +105,7 @@
#define AVG2(x, y) ( 0.5 * ((x) + (y)) )
#define FTOCHAR(val) ((val)<=0.0f)? 0 : (((val)>(1.0f-0.5f/255.0f))? 255 : (char)((255.0f*(val))+0.5f))
+#define FTOUSHORT(val) ((val >= 1.0f-0.5f/65535)? 65535: (val <= 0.0f)? 0: (unsigned short)(val*65535.0f + 0.5f))
#define VECCOPY(v1,v2) {*(v1)= *(v2); *(v1+1)= *(v2+1); *(v1+2)= *(v2+2);}
#define VECCOPY2D(v1,v2) {*(v1)= *(v2); *(v1+1)= *(v2+1);}
diff --git a/source/blender/blenkernel/CMakeLists.txt b/source/blender/blenkernel/CMakeLists.txt
index 1ad0ddf0520..2086f4064d5 100644
--- a/source/blender/blenkernel/CMakeLists.txt
+++ b/source/blender/blenkernel/CMakeLists.txt
@@ -50,6 +50,10 @@ IF(WITH_OPENEXR)
ADD_DEFINITIONS(-DWITH_OPENEXR)
ENDIF(WITH_OPENEXR)
+IF(WITH_TIFF)
+ ADD_DEFINITIONS(-DWITH_TIFF)
+ENDIF(WITH_TIFF)
+
IF(WITH_OPENJPEG)
ADD_DEFINITIONS(-DWITH_OPENJPEG)
ENDIF(WITH_OPENJPEG)
diff --git a/source/blender/blenkernel/SConscript b/source/blender/blenkernel/SConscript
index ac10889f36a..85d4934609d 100644
--- a/source/blender/blenkernel/SConscript
+++ b/source/blender/blenkernel/SConscript
@@ -38,6 +38,9 @@ else:
if env['WITH_BF_OPENEXR']:
defs.append('WITH_OPENEXR')
+if env['WITH_BF_TIFF']:
+ defs.append('WITH_TIFF')
+
if env['WITH_BF_OPENJPEG']:
defs.append('WITH_OPENJPEG')
diff --git a/source/blender/blenkernel/intern/Makefile b/source/blender/blenkernel/intern/Makefile
index 4e365f363c3..15c022592f9 100644
--- a/source/blender/blenkernel/intern/Makefile
+++ b/source/blender/blenkernel/intern/Makefile
@@ -132,6 +132,10 @@ ifeq ($(WITH_QUICKTIME), true)
CPPFLAGS += -DWITH_QUICKTIME
endif
+ifeq ($(WITH_TIFF), true)
+ CPPFLAGS += -DWITH_TIFF
+endif
+
ifeq ($(OS), darwin)
ifeq ($(WITH_BF_OPENMP), true)
CPPFLAGS += -DPARALLEL=1
diff --git a/source/blender/blenkernel/intern/anim.c b/source/blender/blenkernel/intern/anim.c
index 8619ab1eb1c..313d79cf3b9 100644
--- a/source/blender/blenkernel/intern/anim.c
+++ b/source/blender/blenkernel/intern/anim.c
@@ -187,6 +187,8 @@ bMotionPath *animviz_verify_motionpaths(Scene *scene, Object *ob, bPoseChannel *
if (avs->path_bakeflag & MOTIONPATH_BAKE_HEADS)
mpath->flag |= MOTIONPATH_FLAG_BHEAD;
+ else
+ mpath->flag &= ~MOTIONPATH_FLAG_BHEAD;
/* allocate a cache */
mpath->points= MEM_callocN(sizeof(bMotionPathVert)*mpath->length, "bMotionPathVerts");
@@ -250,6 +252,83 @@ void animviz_get_object_motionpaths(Object *ob, ListBase *targets)
/* ........ */
+/* Note on evaluation optimisations:
+ * Optimisations currently used here play tricks with the depsgraph in order to try and
+ * evaluate as few objects as strictly necessary to get nicer performance under standard
+ * production conditions. For those people who really need the accurate version,
+ * disable the ifdef (i.e. 1 -> 0) and comment out the call to motionpaths_calc_optimise_depsgraph()
+ */
+
+/* tweak the object ordering to trick depsgraph into making MotionPath calculations run faster */
+static void motionpaths_calc_optimise_depsgraph(Scene *scene, ListBase *targets)
+{
+ Base *base, *baseNext;
+ MPathTarget *mpt;
+
+ /* make sure our temp-tag isn't already in use */
+ for (base= scene->base.first; base; base= base->next)
+ base->object->flag &= ~BA_TEMP_TAG;
+
+ /* for each target, dump its object to the start of the list if it wasn't moved already */
+ for (mpt= targets->first; mpt; mpt= mpt->next) {
+ for (base=scene->base.first; base; base=baseNext) {
+ baseNext = base->next;
+
+ if ((base->object == mpt->ob) && !(mpt->ob->flag & BA_TEMP_TAG)) {
+ BLI_remlink(&scene->base, base);
+ BLI_addhead(&scene->base, base);
+
+ mpt->ob->flag |= BA_TEMP_TAG;
+ break; // we really don't need to continue anymore once this happens, but this line might really 'break'
+ }
+ }
+ }
+
+ /* "brew me a list that's sorted a bit faster now depsy" */
+ DAG_scene_sort(scene);
+}
+
+/* update scene for current frame */
+static void motionpaths_calc_update_scene(Scene *scene)
+{
+#if 1 // 'production' optimisations always on
+ Base *base, *last=NULL;
+
+ /* only stuff that moves or needs display still */
+ DAG_scene_update_flags(scene, scene->lay);
+
+ /* find the last object with the tag
+ * - all those afterwards are assumed to not be relevant for our calculations
+ */
+ // optimise further by moving out...
+ for (base=scene->base.first; base; base=base->next) {
+ if (base->object->flag & BA_TEMP_TAG)
+ last = base;
+ }
+
+ /* perform updates for tagged objects */
+ // XXX: this will break if rigs depend on scene or other data that
+ // is animated but not attached to/updatable from objects
+ for (base=scene->base.first; base; base=base->next) {
+ /* update this object */
+ object_handle_update(scene, base->object);
+
+ /* if this is the last one we need to update, let's stop to save some time */
+ if (base == last)
+ break;
+ }
+#else // original, 'always correct' version
+ /* do all updates
+ * - if this is too slow, resort to using a more efficient way
+ * that doesn't force complete update, but for now, this is the
+ * most accurate way!
+ */
+ scene_update_for_newframe(scene, scene->lay); // XXX this is the best way we can get anything moving
+#endif
+}
+
+/* ........ */
+
/* perform baking for the targets on the current frame */
static void motionpaths_calc_bake_targets(Scene *scene, ListBase *targets)
{
@@ -311,7 +390,7 @@ void animviz_calc_motionpaths(Scene *scene, ListBase *targets)
// TODO: this method could be improved...
// 1) max range for standard baking
- // 2) minimum range for recalc baking (i.e. between keyfames, but how?)
+ // 2) minimum range for recalc baking (i.e. between keyframes, but how?)
for (mpt= targets->first; mpt; mpt= mpt->next) {
/* try to increase area to do (only as much as needed) */
sfra= MIN2(sfra, mpt->mpath->start_frame);
@@ -319,14 +398,14 @@ void animviz_calc_motionpaths(Scene *scene, ListBase *targets)
}
if (efra <= sfra) return;
+ /* optimise the depsgraph for faster updates */
+ // TODO: whether this is used should depend on some setting for the level of optimisations used
+ motionpaths_calc_optimise_depsgraph(scene, targets);
+
/* calculate path over requested range */
for (CFRA=sfra; CFRA<=efra; CFRA++) {
- /* do all updates
- * - if this is too slow, resort to using a more efficient way
- * that doesn't force complete update, but for now, this is the
- * most accurate way!
- */
- scene_update_for_newframe(scene, scene->lay); // XXX this is the best way we can get anything moving
+ /* update relevant data for new frame */
+ motionpaths_calc_update_scene(scene);
/* perform baking for targets */
motionpaths_calc_bake_targets(scene, targets);
@@ -334,7 +413,7 @@ void animviz_calc_motionpaths(Scene *scene, ListBase *targets)
/* reset original environment */
CFRA= cfra;
- scene_update_for_newframe(scene, scene->lay); // XXX this is the best way we can get anything moving
+ motionpaths_calc_update_scene(scene);
/* clear recalc flags from targets */
for (mpt= targets->first; mpt; mpt= mpt->next) {
diff --git a/source/blender/blenkernel/intern/anim_sys.c b/source/blender/blenkernel/intern/anim_sys.c
index a7a4d789610..10c2c1801cb 100644
--- a/source/blender/blenkernel/intern/anim_sys.c
+++ b/source/blender/blenkernel/intern/anim_sys.c
@@ -339,6 +339,19 @@ static void fcurves_path_rename_fix (ID *owner_id, char *prefix, char *oldName,
/* firstly, handle the F-Curve's own path */
if (fcu->rna_path)
fcu->rna_path= rna_path_rename_fix(owner_id, prefix, oldName, newName, fcu->rna_path, verify_paths);
+ }
+}
+
+/* Check RNA-Paths for a list of Drivers */
+static void drivers_path_rename_fix (ID *owner_id, char *prefix, char *oldName, char *newName, char *oldKey, char *newKey, ListBase *curves, int verify_paths)
+{
+ FCurve *fcu;
+
+ /* we need to check every curve - drivers are F-Curves too! */
+ for (fcu= curves->first; fcu; fcu= fcu->next) {
+ /* firstly, handle the F-Curve's own path */
+ if (fcu->rna_path)
+ fcu->rna_path= rna_path_rename_fix(owner_id, prefix, oldKey, newKey, fcu->rna_path, verify_paths);
/* driver? */
if (fcu->driver) {
@@ -352,15 +365,16 @@ static void fcurves_path_rename_fix (ID *owner_id, char *prefix, char *oldName,
{
/* rename RNA path */
if (dtar->rna_path)
- dtar->rna_path= rna_path_rename_fix(dtar->id, prefix, oldName, newName, dtar->rna_path, verify_paths);
+ dtar->rna_path= rna_path_rename_fix(dtar->id, prefix, oldKey, newKey, dtar->rna_path, verify_paths);
/* also fix the bone-name (if applicable) */
- // XXX this has been disabled because the old/new names have padding which means this check will fail
- //if ( ((dtar->id) && (GS(dtar->id->name) == ID_OB)) &&
- // (dtar->pchan_name[0]) && (strcmp(oldName, dtar->pchan_name)==0) )
- //{
- // BLI_strncpy(dtar->pchan_name, newName, sizeof(dtar->pchan_name));
- //}
+ if (strstr(prefix, "bones")) {
+ if ( ((dtar->id) && (GS(dtar->id->name) == ID_OB)) &&
+ (dtar->pchan_name[0]) && (strcmp(oldName, dtar->pchan_name)==0) )
+ {
+ BLI_strncpy(dtar->pchan_name, newName, sizeof(dtar->pchan_name));
+ }
+ }
}
DRIVER_TARGETS_LOOPER_END
}
@@ -398,11 +412,12 @@ void BKE_animdata_fix_paths_rename (ID *owner_id, AnimData *adt, char *prefix, c
if (ELEM(NULL, owner_id, adt))
return;
- if (oldName != NULL && newName != NULL) {
+ if ((oldName != NULL) && (newName != NULL)) {
/* pad the names with [" "] so that only exact matches are made */
oldN= BLI_sprintfN("[\"%s\"]", oldName);
newN= BLI_sprintfN("[\"%s\"]", newName);
- } else {
+ }
+ else {
oldN= BLI_sprintfN("[%d]", oldSubscript);
newN= BLI_sprintfN("[%d]", newSubscript);
}
@@ -414,7 +429,7 @@ void BKE_animdata_fix_paths_rename (ID *owner_id, AnimData *adt, char *prefix, c
fcurves_path_rename_fix(owner_id, prefix, oldN, newN, &adt->tmpact->curves, verify_paths);
/* Drivers - Drivers are really F-Curves */
- fcurves_path_rename_fix(owner_id, prefix, oldN, newN, &adt->drivers, verify_paths);
+ drivers_path_rename_fix(owner_id, prefix, oldName, newName, oldN, newN, &adt->drivers, verify_paths);
/* NLA Data - Animation Data for Strips */
for (nlt= adt->nla_tracks.first; nlt; nlt= nlt->next)
diff --git a/source/blender/blenkernel/intern/armature.c b/source/blender/blenkernel/intern/armature.c
index 4f9b9435a80..557f3900d7b 100644
--- a/source/blender/blenkernel/intern/armature.c
+++ b/source/blender/blenkernel/intern/armature.c
@@ -2055,7 +2055,7 @@ static void splineik_evaluate_bone(tSplineIK_Tree *tree, Scene *scene, Object *o
/* we need to clamp this within sensible values */
// NOTE: these should be fine for now, but should get sanitised in future
- scale= MIN2( MAX2(scale, 0.0001) , 100000);
+ scale= MIN2(MAX2(scale, 0.0001) , 100000);
}
else
scale= 1.0f;
@@ -2127,8 +2127,6 @@ static void splineik_execute_tree(Scene *scene, Object *ob, bPoseChannel *pchan_
splineik_evaluate_bone(tree, scene, ob, pchan, i, ctime);
}
- // TODO: if another pass is needed to ensure the validity of the chain after blending, it should go here
-
/* free the tree info specific to SplineIK trees now */
if (tree->chain) MEM_freeN(tree->chain);
if (tree->free_points) MEM_freeN(tree->points);
diff --git a/source/blender/blenkernel/intern/image.c b/source/blender/blenkernel/intern/image.c
index eb478eaddf5..5588c8df161 100644
--- a/source/blender/blenkernel/intern/image.c
+++ b/source/blender/blenkernel/intern/image.c
@@ -779,10 +779,12 @@ void BKE_add_image_extension(char *string, int imtype)
if(!BLI_testextensie(string, ".bmp"))
extension= ".bmp";
}
- else if(G.have_libtiff && (imtype==R_TIFF)) {
+#ifdef WITH_TIFF
+ else if(imtype==R_TIFF) {
if(!BLI_testextensie(string, ".tif") &&
!BLI_testextensie(string, ".tiff")) extension= ".tif";
}
+#endif
#ifdef WITH_OPENEXR
else if( ELEM(imtype, R_OPENEXR, R_MULTILAYER)) {
if(!BLI_testextensie(string, ".exr"))
@@ -1187,12 +1189,14 @@ int BKE_write_ibuf(Scene *scene, ImBuf *ibuf, char *name, int imtype, int subimt
else if ((imtype==R_BMP)) {
ibuf->ftype= BMP;
}
- else if ((G.have_libtiff) && (imtype==R_TIFF)) {
+#ifdef WITH_TIFF
+ else if (imtype==R_TIFF) {
ibuf->ftype= TIF;
if(subimtype & R_TIFF_16BIT)
ibuf->ftype |= TIF_16BIT;
}
+#endif
#ifdef WITH_OPENEXR
else if (imtype==R_OPENEXR || imtype==R_MULTILAYER) {
ibuf->ftype= OPENEXR;
diff --git a/source/blender/blenkernel/intern/multires.c b/source/blender/blenkernel/intern/multires.c
index 52c6f9355a3..d8c39abc44a 100644
--- a/source/blender/blenkernel/intern/multires.c
+++ b/source/blender/blenkernel/intern/multires.c
@@ -207,7 +207,7 @@ void multiresModifier_join(Object *ob)
}
#endif
-int multiresModifier_reshapeFromDM(MultiresModifierData *mmd, Object *ob, DerivedMesh *srcdm)
+int multiresModifier_reshapeFromDM(Object *ob, DerivedMesh *srcdm)
{
DerivedMesh *mrdm = get_multires_dm (ob);
@@ -228,13 +228,13 @@ int multiresModifier_reshapeFromDM(MultiresModifierData *mmd, Object *ob, Derive
}
/* Returns 1 on success, 0 if the src's totvert doesn't match */
-int multiresModifier_reshape(MultiresModifierData *mmd, Object *dst, Object *src)
+int multiresModifier_reshape(Object *dst, Object *src)
{
DerivedMesh *srcdm = src->derivedFinal;
- return multiresModifier_reshapeFromDM(mmd, dst, srcdm);
+ return multiresModifier_reshapeFromDM(dst, srcdm);
}
-int multiresModifier_reshapeFromDeformMod(MultiresModifierData *mmd, Object *ob, ModifierData *md)
+int multiresModifier_reshapeFromDeformMod(Object *ob, ModifierData *md)
{
ModifierTypeInfo *mti = modifierType_getInfo(md->type);
DerivedMesh *dm, *ndm;
@@ -256,7 +256,7 @@ int multiresModifier_reshapeFromDeformMod(MultiresModifierData *mmd, Object *ob,
dm->release(dm);
/* Reshaping */
- result= multiresModifier_reshapeFromDM(mmd, ob, ndm);
+ result= multiresModifier_reshapeFromDM(ob, ndm);
/* Cleanup */
ndm->release(ndm);
diff --git a/source/blender/blenkernel/intern/packedFile.c b/source/blender/blenkernel/intern/packedFile.c
index fb973febf04..dc4a9ee3bdc 100644
--- a/source/blender/blenkernel/intern/packedFile.c
+++ b/source/blender/blenkernel/intern/packedFile.c
@@ -186,7 +186,7 @@ PackedFile *newPackedFile(ReportList *reports, char *filename)
file= open(name, O_BINARY|O_RDONLY);
if (file <= 0) {
- BKE_reportf(reports, RPT_ERROR, "Can't open file: \"%s\"", name);
+ BKE_reportf(reports, RPT_ERROR, "Unable to pack file, source path not found: \"%s\"", name);
} else {
filelen = BLI_filesize(file);
@@ -216,15 +216,15 @@ void packAll(Main *bmain, ReportList *reports)
bSound *sound;
for(ima=bmain->image.first; ima; ima=ima->id.next)
- if(ima->packedfile == NULL)
+ if(ima->packedfile == NULL && ima->id.lib==NULL && ELEM3(ima->type, IMA_SRC_FILE, IMA_SRC_SEQUENCE, IMA_SRC_MOVIE))
ima->packedfile = newPackedFile(reports, ima->name);
for(vf=bmain->vfont.first; vf; vf=vf->id.next)
- if(vf->packedfile == NULL)
+ if(vf->packedfile == NULL && vf->id.lib==NULL)
vf->packedfile = newPackedFile(reports, vf->name);
for(sound=bmain->sound.first; sound; sound=sound->id.next)
- if(sound->packedfile == NULL)
+ if(sound->packedfile == NULL && vf->id.lib==NULL)
sound->packedfile = newPackedFile(reports, sound->name);
}
diff --git a/source/blender/blenkernel/intern/pointcache.c b/source/blender/blenkernel/intern/pointcache.c
index 160f8a35520..cb596622431 100644
--- a/source/blender/blenkernel/intern/pointcache.c
+++ b/source/blender/blenkernel/intern/pointcache.c
@@ -2366,8 +2366,12 @@ typedef struct {
static void *ptcache_make_cache_thread(void *ptr) {
ptcache_make_cache_data *data = (ptcache_make_cache_data*)ptr;
- for(; (*data->cfra_ptr <= data->endframe) && !data->break_operation; *data->cfra_ptr+=data->step)
+ for(; (*data->cfra_ptr <= data->endframe) && !data->break_operation; *data->cfra_ptr+=data->step) {
scene_update_for_newframe(data->scene, data->scene->lay);
+ if(G.background) {
+ printf("bake: frame %d :: %d\n", (int)*data->cfra_ptr, data->endframe);
+ }
+ }
data->thread_ended = TRUE;
return NULL;
@@ -2489,36 +2493,40 @@ void BKE_ptcache_make_cache(PTCacheBaker* baker)
thread_data.thread_ended = FALSE;
old_progress = -1;
- BLI_init_threads(&threads, ptcache_make_cache_thread, 1);
- BLI_insert_thread(&threads, (void*)&thread_data);
-
- while (thread_data.thread_ended == FALSE) {
+ if(G.background) {
+ ptcache_make_cache_thread((void*)&thread_data);
+ }
+ else {
+ BLI_init_threads(&threads, ptcache_make_cache_thread, 1);
+ BLI_insert_thread(&threads, (void*)&thread_data);
- if(bake)
- progress = (int)(100.0f * (float)(CFRA - startframe)/(float)(thread_data.endframe-startframe));
- else
- progress = CFRA;
+ while (thread_data.thread_ended == FALSE) {
- /* NOTE: baking should not redraw whole ui as this slows things down */
- if ((baker->progressbar) && (progress != old_progress)) {
- baker->progressbar(baker->progresscontext, progress);
- old_progress = progress;
- }
-
- /* Delay to lessen CPU load from UI thread */
- PIL_sleep_ms(200);
+ if(bake)
+ progress = (int)(100.0f * (float)(CFRA - startframe)/(float)(thread_data.endframe-startframe));
+ else
+ progress = CFRA;
+
+ /* NOTE: baking should not redraw whole ui as this slows things down */
+ if ((baker->progressbar) && (progress != old_progress)) {
+ baker->progressbar(baker->progresscontext, progress);
+ old_progress = progress;
+ }
+
+ /* Delay to lessen CPU load from UI thread */
+ PIL_sleep_ms(200);
- /* NOTE: breaking baking should leave calculated frames in cache, not clear it */
- if(blender_test_break() && !thread_data.break_operation) {
- thread_data.break_operation = TRUE;
- if (baker->progressend)
- baker->progressend(baker->progresscontext);
- WM_cursor_wait(1);
+ /* NOTE: breaking baking should leave calculated frames in cache, not clear it */
+ if(blender_test_break() && !thread_data.break_operation) {
+ thread_data.break_operation = TRUE;
+ if (baker->progressend)
+ baker->progressend(baker->progresscontext);
+ WM_cursor_wait(1);
+ }
}
- }
BLI_end_threads(&threads);
-
+ }
/* clear baking flag */
if(pid) {
cache->flag &= ~(PTCACHE_BAKING|PTCACHE_REDO_NEEDED);
diff --git a/source/blender/blenloader/intern/readblenentry.c b/source/blender/blenloader/intern/readblenentry.c
index 6424829c12a..38e9a584952 100644
--- a/source/blender/blenloader/intern/readblenentry.c
+++ b/source/blender/blenloader/intern/readblenentry.c
@@ -239,10 +239,19 @@ LinkNode *BLO_blendhandle_get_previews(BlendHandle *bh, int ofblocktype)
for (bhead= blo_firstbhead(fd); bhead; bhead= blo_nextbhead(fd, bhead)) {
if (bhead->code==ofblocktype) {
ID *id= (ID*) (bhead+1);
- if ( (GS(id->name) == ID_MA) || (GS(id->name) == ID_TE)) {
- new_prv = MEM_callocN(sizeof(PreviewImage), "newpreview");
- BLI_linklist_prepend(&previews, new_prv);
- looking = 1;
+ switch(GS(id->name))
+ {
+ case ID_MA: /* fall through */
+ case ID_TE: /* fall through */
+ case ID_IM: /* fall through */
+ case ID_WO: /* fall through */
+ case ID_LA: /* fall through */
+ new_prv = MEM_callocN(sizeof(PreviewImage), "newpreview");
+ BLI_linklist_prepend(&previews, new_prv);
+ looking = 1;
+ break;
+ default:
+ break;
}
} else if (bhead->code==DATA) {
if (looking) {
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c
index 1ffcef80242..e78a66bf999 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -4162,8 +4162,8 @@ static void lib_link_scene(FileData *fd, Main *main)
base->object= newlibadr_us(fd, sce->id.lib, base->object);
if(base->object==NULL) {
- printf("LIB ERROR: base removed\n");
BKE_reportf(fd->reports, RPT_ERROR, "LIB ERROR: Object lost from scene:'%s\'\n", sce->id.name+2);
+ if(G.background==0) printf("LIB ERROR: base removed from scene:'%s\'\n", sce->id.name+2);
BLI_remlink(&sce->base, base);
if(base==sce->basact) sce->basact= 0;
MEM_freeN(base);
@@ -12301,8 +12301,8 @@ static void read_libraries(FileData *basefd, ListBase *mainlist)
if(fd==NULL) {
/* printf and reports for now... its important users know this */
- printf("read library: '%s', '%s'\n", mainptr->curlib->filename, mainptr->curlib->name);
BKE_reportf(basefd->reports, RPT_INFO, "read library: '%s', '%s'\n", mainptr->curlib->filename, mainptr->curlib->name);
+ if(!G.background && basefd->reports) printf("read library: '%s', '%s'\n", mainptr->curlib->filename, mainptr->curlib->name);
fd= blo_openblenderfile(mainptr->curlib->filename, basefd->reports);
@@ -12347,8 +12347,8 @@ static void read_libraries(FileData *basefd, ListBase *mainlist)
else mainptr->curlib->filedata= NULL;
if (fd==NULL) {
- printf("ERROR: can't find lib %s \n", mainptr->curlib->filename);
BKE_reportf(basefd->reports, RPT_ERROR, "Can't find lib '%s'\n", mainptr->curlib->filename);
+ if(!G.background && basefd->reports) printf("ERROR: can't find lib %s \n", mainptr->curlib->filename);
}
}
if(fd) {
@@ -12365,8 +12365,8 @@ static void read_libraries(FileData *basefd, ListBase *mainlist)
append_id_part(fd, mainptr, id, &realid);
if (!realid) {
- printf("LIB ERROR: %s:'%s' missing from '%s'\n", BLO_idcode_to_name(GS(id->name)), id->name+2, mainptr->curlib->filename);
BKE_reportf(fd->reports, RPT_ERROR, "LIB ERROR: %s:'%s' missing from '%s'\n", BLO_idcode_to_name(GS(id->name)), id->name+2, mainptr->curlib->filename);
+ if(!G.background && basefd->reports) printf("LIB ERROR: %s:'%s' missing from '%s'\n", BLO_idcode_to_name(GS(id->name)), id->name+2, mainptr->curlib->filename);
}
change_idid_adr(mainlist, basefd, id, realid);
@@ -12401,8 +12401,8 @@ static void read_libraries(FileData *basefd, ListBase *mainlist)
ID *idn= id->next;
if(id->flag & LIB_READ) {
BLI_remlink(lbarray[a], id);
- printf("LIB ERROR: %s:'%s' unread libblock missing from '%s'\n", BLO_idcode_to_name(GS(id->name)), id->name+2, mainptr->curlib->filename);
BKE_reportf(basefd->reports, RPT_ERROR, "LIB ERROR: %s:'%s' unread libblock missing from '%s'\n", BLO_idcode_to_name(GS(id->name)), id->name+2, mainptr->curlib->filename);
+ if(!G.background && basefd->reports)printf("LIB ERROR: %s:'%s' unread libblock missing from '%s'\n", BLO_idcode_to_name(GS(id->name)), id->name+2, mainptr->curlib->filename);
change_idid_adr(mainlist, basefd, id, NULL);
MEM_freeN(id);
diff --git a/source/blender/editors/CMakeLists.txt b/source/blender/editors/CMakeLists.txt
index 58a52f7041d..50d511eea24 100644
--- a/source/blender/editors/CMakeLists.txt
+++ b/source/blender/editors/CMakeLists.txt
@@ -58,6 +58,10 @@ IF(WITH_OPENEXR)
ADD_DEFINITIONS(-DWITH_OPENEXR)
ENDIF(WITH_OPENEXR)
+IF(WITH_TIFF)
+ ADD_DEFINITIONS(-DWITH_TIFF)
+ENDIF(WITH_TIFF)
+
IF(WITH_OPENJPEG)
ADD_DEFINITIONS(-DWITH_OPENJPEG)
ENDIF(WITH_OPENJPEG)
diff --git a/source/blender/editors/animation/anim_channels_edit.c b/source/blender/editors/animation/anim_channels_edit.c
index 97c93c6a913..bdaf0bf700a 100644
--- a/source/blender/editors/animation/anim_channels_edit.c
+++ b/source/blender/editors/animation/anim_channels_edit.c
@@ -939,7 +939,7 @@ static int animchannels_delete_exec(bContext *C, wmOperator *op)
/* do groups only first (unless in Drivers mode, where there are none) */
if (ac.datatype != ANIMCONT_DRIVERS) {
/* filter data */
- filter= (ANIMFILTER_VISIBLE | ANIMFILTER_SEL | ANIMFILTER_CHANNELS | ANIMFILTER_FOREDIT);
+ filter= (ANIMFILTER_VISIBLE | ANIMFILTER_SEL | ANIMFILTER_CHANNELS | ANIMFILTER_FOREDIT | ANIMFILTER_NODUPLIS);
ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype);
/* delete selected groups and their associated channels */
@@ -978,7 +978,7 @@ static int animchannels_delete_exec(bContext *C, wmOperator *op)
/* now do F-Curves */
if (ac.datatype != ANIMCONT_GPENCIL) {
/* filter data */
- filter= (ANIMFILTER_VISIBLE | ANIMFILTER_SEL | ANIMFILTER_FOREDIT);
+ filter= (ANIMFILTER_VISIBLE | ANIMFILTER_SEL | ANIMFILTER_FOREDIT | ANIMFILTER_NODUPLIS);
ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype);
/* delete selected F-Curves */
@@ -1038,7 +1038,7 @@ static int animchannels_visibility_set_exec(bContext *C, wmOperator *op)
ANIM_animdata_filter(&ac, &all_data, filter, ac.data, ac.datatype);
/* hide all channels not selected */
- filter= (ANIMFILTER_VISIBLE | ANIMFILTER_UNSEL);
+ filter= (ANIMFILTER_VISIBLE | ANIMFILTER_UNSEL | ANIMFILTER_NODUPLIS);
ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype);
for (ale= anim_data.first; ale; ale= ale->next) {
@@ -1054,7 +1054,7 @@ static int animchannels_visibility_set_exec(bContext *C, wmOperator *op)
BLI_freelistN(&anim_data);
/* make all the selected channels visible */
- filter= (ANIMFILTER_VISIBLE | ANIMFILTER_SEL);
+ filter= (ANIMFILTER_VISIBLE | ANIMFILTER_SEL | ANIMFILTER_NODUPLIS);
ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype);
for (ale= anim_data.first; ale; ale= ale->next) {
@@ -1113,11 +1113,11 @@ static int animchannels_visibility_toggle_exec(bContext *C, wmOperator *op)
return OPERATOR_CANCELLED;
/* get list of all channels that selection may need to be flushed to */
- filter= ANIMFILTER_CHANNELS;
+ filter= (ANIMFILTER_CHANNELS | ANIMFILTER_NODUPLIS);
ANIM_animdata_filter(&ac, &all_data, filter, ac.data, ac.datatype);
/* filter data */
- filter= (ANIMFILTER_VISIBLE | ANIMFILTER_SEL);
+ filter= (ANIMFILTER_VISIBLE | ANIMFILTER_SEL | ANIMFILTER_NODUPLIS);
ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype);
/* See if we should be making showing all selected or hiding */
@@ -1215,7 +1215,8 @@ static void setflag_anim_channels (bAnimContext *ac, short setting, short mode,
}
/* filter data that we're working on */
- filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CHANNELS);
+ // XXX: noduplis enabled so that results don't cancel, but will be problematic for some channels where only type differs
+ filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CHANNELS | ANIMFILTER_NODUPLIS);
if (onlysel) filter |= ANIMFILTER_SEL;
ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
diff --git a/source/blender/editors/animation/anim_filter.c b/source/blender/editors/animation/anim_filter.c
index 5ac7f6d4119..67f2cb834e0 100644
--- a/source/blender/editors/animation/anim_filter.c
+++ b/source/blender/editors/animation/anim_filter.c
@@ -68,6 +68,7 @@
#include "MEM_guardedalloc.h"
#include "BLI_blenlib.h"
+#include "BLI_ghash.h"
#include "BKE_animsys.h"
#include "BKE_action.h"
@@ -2512,6 +2513,65 @@ static short animdata_filter_dopesheet_summary (bAnimContext *ac, ListBase *anim
return 1;
}
+/* ----------- Cleanup API --------------- */
+
+/* Remove entries with invalid types in animation channel list */
+static int animdata_filter_remove_invalid (ListBase *anim_data)
+{
+ bAnimListElem *ale, *next;
+ int items = 0;
+
+ /* only keep entries with valid types */
+ for (ale= anim_data->first; ale; ale= next) {
+ next= ale->next;
+
+ if (ale->type == ANIMTYPE_NONE)
+ BLI_freelinkN(anim_data, ale);
+ else
+ items++;
+ }
+
+ return items;
+}
+
+/* Remove duplicate entries in animation channel list */
+static int animdata_filter_remove_duplis (ListBase *anim_data)
+{
+ bAnimListElem *ale, *next;
+ GHash *gh;
+ int items = 0;
+
+ /* build new hashtable to efficiently store and retrieve which entries have been
+ * encountered already while searching
+ */
+ gh= BLI_ghash_new(BLI_ghashutil_ptrhash, BLI_ghashutil_ptrcmp, "animdata_filter_duplis_remove gh");
+
+ /* loop through items, removing them from the list if a similar item occurs already */
+ for (ale = anim_data->first; ale; ale = next) {
+ next = ale->next;
+
+ /* check if hash has any record of an entry like this
+ * - just use ale->data for now, though it would be nicer to involve
+ * ale->type in combination too to capture corner cases (where same data performs differently)
+ */
+ if (BLI_ghash_haskey(gh, ale->data) == 0) {
+ /* this entry is 'unique' and can be kept */
+ BLI_ghash_insert(gh, ale->data, NULL);
+ items++;
+ }
+ else {
+ /* this entry isn't needed anymore */
+ BLI_freelinkN(anim_data, ale);
+ }
+ }
+
+ /* free the hash... */
+ BLI_ghash_free(gh, NULL, NULL);
+
+ /* return the number of items still in the list */
+ return items;
+}
+
/* ----------- Public API --------------- */
/* This function filters the active data source to leave only animation channels suitable for
@@ -2527,7 +2587,6 @@ int ANIM_animdata_filter (bAnimContext *ac, ListBase *anim_data, int filter_mode
/* only filter data if there's somewhere to put it */
if (data && anim_data) {
- bAnimListElem *ale, *next;
Object *obact= (ac) ? ac->obact : NULL;
/* firstly filter the data */
@@ -2572,16 +2631,12 @@ int ANIM_animdata_filter (bAnimContext *ac, ListBase *anim_data, int filter_mode
break;
}
- /* remove any weedy entries */
- // XXX this is weedy code!
- for (ale= anim_data->first; ale; ale= next) {
- next= ale->next;
-
- if (ale->type == ANIMTYPE_NONE) {
- items--;
- BLI_freelinkN(anim_data, ale);
- }
- }
+ /* remove any 'weedy' entries */
+ items = animdata_filter_remove_invalid(anim_data);
+
+ /* remove duplicates (if required) */
+ if (filter_mode & ANIMFILTER_NODUPLIS)
+ items = animdata_filter_remove_duplis(anim_data);
}
/* return the number of items in the list */
diff --git a/source/blender/editors/include/ED_anim_api.h b/source/blender/editors/include/ED_anim_api.h
index 23cb697b453..230a3e8a3dd 100644
--- a/source/blender/editors/include/ED_anim_api.h
+++ b/source/blender/editors/include/ED_anim_api.h
@@ -192,6 +192,7 @@ typedef enum eAnimFilter_Flags {
ANIMFILTER_ANIMDATA = (1<<9), /* only return the underlying AnimData blocks (not the tracks, etc.) data comes from */
ANIMFILTER_NLATRACKS = (1<<10), /* only include NLA-tracks */
ANIMFILTER_SELEDIT = (1<<11), /* link editability with selected status */
+ ANIMFILTER_NODUPLIS = (1<<12), /* duplicate entries for animation data attached to multi-user blocks must not occur */
/* all filters - the power inside the bracket must be the last power for left-shifts + 1 */
ANIMFILTER_ALLFILTERS = ((1<<12) - 1)
diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c
index ff56b14c653..2c9d5a8e131 100644
--- a/source/blender/editors/interface/interface_handlers.c
+++ b/source/blender/editors/interface/interface_handlers.c
@@ -2119,8 +2119,13 @@ static int ui_do_but_EXIT(bContext *C, uiBut *but, uiHandleButtonData *data, wmE
}
if(ELEM3(event->type, LEFTMOUSE, PADENTER, RETKEY) && event->val==KM_PRESS) {
+ int ret = WM_UI_HANDLER_BREAK;
+ /* XXX (a bit ugly) Special case handling for filebrowser drag button */
+ if(but->dragpoin && but->imb && ui_but_mouse_inside_icon(but, data->region, event)) {
+ ret = WM_UI_HANDLER_CONTINUE;
+ }
button_activate_state(C, but, BUTTON_STATE_EXIT);
- return WM_UI_HANDLER_BREAK;
+ return ret;
}
}
else if(data->state == BUTTON_STATE_WAIT_DRAG) {
diff --git a/source/blender/editors/interface/interface_layout.c b/source/blender/editors/interface/interface_layout.c
index 762203272a3..d91cdd5c20d 100644
--- a/source/blender/editors/interface/interface_layout.c
+++ b/source/blender/editors/interface/interface_layout.c
@@ -1107,7 +1107,7 @@ static void rna_search_cb(const struct bContext *C, void *arg_but, char *str, ui
continue;
if(itemptr.type && RNA_struct_is_ID(itemptr.type))
- iconid= ui_id_icon_get((bContext*)C, itemptr.data, 0);
+ iconid= ui_id_icon_get((bContext*)C, itemptr.data, 1);
else
iconid = 0;
diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c
index aef24acc7a7..8cf6c2915c2 100644
--- a/source/blender/editors/interface/interface_templates.c
+++ b/source/blender/editors/interface/interface_templates.c
@@ -170,7 +170,7 @@ static void id_search_cb(const bContext *C, void *arg_template, char *str, uiSea
continue;
if(BLI_strcasestr(id->name+2, str)) {
- iconid= ui_id_icon_get((bContext*)C, id, 0);
+ iconid= ui_id_icon_get((bContext*)C, id, 1);
if(!uiSearchItemAdd(items, id->name+2, id, iconid))
break;
diff --git a/source/blender/editors/interface/resources.c b/source/blender/editors/interface/resources.c
index 49c455d9299..82b195fb94a 100644
--- a/source/blender/editors/interface/resources.c
+++ b/source/blender/editors/interface/resources.c
@@ -1488,6 +1488,11 @@ void init_userdef_do_versions(void)
if (U.v2d_min_gridsize == 0) {
U.v2d_min_gridsize= 35;
}
+
+ /* Single Column UI Value */
+ if (U.propwidth == 0) {
+ U.propwidth = 200;
+ }
/* funny name, but it is GE stuff, moves userdef stuff to engine */
// XXX space_set_commmandline_options();
diff --git a/source/blender/editors/object/object_constraint.c b/source/blender/editors/object/object_constraint.c
index 039b18efb39..9163baf606f 100644
--- a/source/blender/editors/object/object_constraint.c
+++ b/source/blender/editors/object/object_constraint.c
@@ -1340,7 +1340,7 @@ void OBJECT_OT_constraint_add_with_targets(wmOperatorType *ot)
void OBJECT_OT_constraint_copy(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Copy Constraints to Others";
+ ot->name= "Copy Constraints to Selected";
ot->description = "Copy constraints to other selected objects.";
ot->idname= "OBJECT_OT_constraint_copy";
diff --git a/source/blender/editors/object/object_edit.c b/source/blender/editors/object/object_edit.c
index 4685c12fedd..da3798910e8 100644
--- a/source/blender/editors/object/object_edit.c
+++ b/source/blender/editors/object/object_edit.c
@@ -30,6 +30,7 @@
#include <time.h>
#include <float.h>
#include <ctype.h>
+#include <stddef.h> //for offsetof
#include "MEM_guardedalloc.h"
@@ -104,6 +105,7 @@
/* for menu/popup icons etc etc*/
+#include "UI_interface.h"
#include "WM_api.h"
#include "WM_types.h"
@@ -1098,6 +1100,7 @@ void flip_subdivison(Scene *scene, View3D *v3d, int level)
static void copymenu_properties(Scene *scene, View3D *v3d, Object *ob)
{
+//XXX no longer used - to be removed - replaced by game_properties_copy_exec
bProperty *prop;
Base *base;
int nr, tot=0;
@@ -1156,6 +1159,7 @@ static void copymenu_properties(Scene *scene, View3D *v3d, Object *ob)
static void copymenu_logicbricks(Scene *scene, View3D *v3d, Object *ob)
{
+//XXX no longer used - to be removed - replaced by logicbricks_copy_exec
Base *base;
for(base= FIRSTBASE; base; base= base->next) {
@@ -2203,3 +2207,166 @@ void OBJECT_OT_game_property_remove(wmOperatorType *ot)
RNA_def_int(ot->srna, "index", 0, 0, INT_MAX, "Index", "Property index to remove ", 0, INT_MAX);
}
+static EnumPropertyItem game_properties_copy_types[] ={
+ {1, "REPLACE", 0, "Replace Properties", ""},
+ {2, "MERGE", 0, "Merge Properties", ""},
+ {3, "CLEAR", 0, "Clear All", ""},
+ {4, "COPY", 0, "Copy a Property", ""},
+ {0, NULL, 0, NULL, NULL}};
+
+static int game_property_copy_invoke(bContext *C, wmOperator *op, wmEvent *event)
+{
+ Object *ob= CTX_data_active_object(C);
+ bProperty *prop;
+ int tot=0;
+ uiPopupMenu *pup;
+ uiLayout *menu;
+
+ /* count number of available properties */
+ prop= ob->prop.first;
+ while(prop) {
+ tot++;
+ prop= prop->next;
+ }
+
+ /* start building */
+ pup= uiPupMenuBegin(C, op->type->name, 0);
+ menu= uiPupMenuLayout(pup);
+ uiLayoutSetOperatorContext(menu, WM_OP_EXEC_DEFAULT);
+
+ if(!tot)
+ uiItemEnumO(menu, "OBJECT_OT_game_property_copy", NULL, 0, "type", 3);//CLEAR);
+ else {
+ uiItemEnumO(menu, "OBJECT_OT_game_property_copy", NULL, 0, "type", 1);//REPLACE);
+ uiItemEnumO(menu, "OBJECT_OT_game_property_copy", NULL, 0, "type", 2);//MERGE);
+
+ //Menu Separator
+ uiItemL(menu, "Copy a Property", 0);
+
+ prop= ob->prop.first;
+ while(prop) {
+ uiItemStringO(menu, prop->name, 0, "OBJECT_OT_game_property_copy", "property", prop->name);
+ prop= prop->next;
+ }
+ }
+ uiPupMenuEnd(C, pup);
+
+ /* this operator is only for a menu, not used further */
+ return OPERATOR_CANCELLED;
+}
+
+static int game_property_copy_exec(bContext *C, wmOperator *op)
+{
+ Object *ob=ED_object_active_context(C);
+ bProperty *prop;
+ char prop_name[32];
+
+ int type = RNA_enum_get(op->ptr, "type");
+ RNA_string_get(op->ptr, "property", prop_name);
+
+ if ( type == 1 || type == 2 || type == 3) {
+ CTX_DATA_BEGIN(C, Object*, ob_iter, selected_editable_objects) {
+ if (ob != ob_iter) {
+ if (ob->data != ob_iter->data){
+ if (type == 2) {/* merge */
+ for(prop = ob->prop.first; prop; prop= prop->next ) {
+ set_ob_property(ob_iter, prop);
+ }
+ } else /* replace or clear */
+ copy_properties( &ob_iter->prop, &ob->prop );
+ }
+ }
+ }
+ CTX_DATA_END;
+ }
+ else if(strlen(prop_name) > 0) { /* copy */
+ prop = (bProperty *) BLI_findstring(&ob->prop, prop_name, offsetof(bProperty, name));
+
+ if(prop) {
+ CTX_DATA_BEGIN(C, Object*, ob_iter, selected_editable_objects) {
+ if (ob != ob_iter) {
+ if (ob->data != ob_iter->data)
+ set_ob_property(ob_iter, prop);
+ }
+ } CTX_DATA_END;
+ }
+ }
+ return OPERATOR_FINISHED;
+}
+
+void OBJECT_OT_game_property_copy(wmOperatorType *ot)
+{
+ /* identifiers */
+ ot->name= "Copy Game Property";
+ ot->idname= "OBJECT_OT_game_property_copy";
+
+ /* api callbacks */
+ ot->invoke= game_property_copy_invoke;
+ ot->exec= game_property_copy_exec;
+ ot->poll= ED_operator_object_active_editable;
+
+ /* flags */
+ ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+
+ RNA_def_enum(ot->srna, "type", game_properties_copy_types, 4, "Operation", "");
+ RNA_def_string(ot->srna, "property", "", 32, "Name", "Name of the property to copy");
+}
+
+/************************ Copy Logic Bricks ***********************/
+
+static int logicbricks_copy_exec(bContext *C, wmOperator *op)
+{
+ Object *ob=ED_object_active_context(C);
+
+ CTX_DATA_BEGIN(C, Object*, ob_iter, selected_editable_objects) {
+ if(ob != ob_iter) {
+ if (ob->data != ob_iter->data){
+ /* first: free all logic */
+ free_sensors(&ob_iter->sensors);
+ unlink_controllers(&ob_iter->controllers);
+ free_controllers(&ob_iter->controllers);
+ unlink_actuators(&ob_iter->actuators);
+ free_actuators(&ob_iter->actuators);
+
+ /* now copy it, this also works without logicbricks! */
+ clear_sca_new_poins_ob(ob);
+ copy_sensors(&ob_iter->sensors, &ob->sensors);
+ copy_controllers(&ob_iter->controllers, &ob->controllers);
+ copy_actuators(&ob_iter->actuators, &ob->actuators);
+ set_sca_new_poins_ob(ob_iter);
+
+ /* some menu settings */
+ ob_iter->scavisflag= ob->scavisflag;
+ ob_iter->scaflag= ob->scaflag;
+
+ /* set the initial state */
+ ob_iter->state= ob->state;
+ ob_iter->init_state= ob->init_state;
+ }
+ if(ob_iter->totcol==ob->totcol) {
+ ob_iter->actcol= ob->actcol;
+ WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, ob_iter);
+ }
+ }
+ }
+ CTX_DATA_END;
+
+ WM_event_add_notifier(C, NC_LOGIC, NULL);
+
+ return OPERATOR_FINISHED;
+}
+
+void OBJECT_OT_logic_bricks_copy(wmOperatorType *ot)
+{
+ /* identifiers */
+ ot->name= "Copy Logic Bricks to Selected";
+ ot->description = "Copy logic bricks to other selected objects.";
+ ot->idname= "OBJECT_OT_logic_bricks_copy";
+
+ /* api callbacks */
+ ot->exec= logicbricks_copy_exec;
+ ot->poll= ED_operator_object_active_editable;
+
+ /* flags */
+ ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+}
diff --git a/source/blender/editors/object/object_intern.h b/source/blender/editors/object/object_intern.h
index 7e1f2cbbfdc..2d8faa60bea 100644
--- a/source/blender/editors/object/object_intern.h
+++ b/source/blender/editors/object/object_intern.h
@@ -85,6 +85,11 @@ void OBJECT_OT_shade_flat(struct wmOperatorType *ot);
void OBJECT_OT_paths_calculate(struct wmOperatorType *ot);
void OBJECT_OT_paths_clear(struct wmOperatorType *ot);
+void OBJECT_OT_game_property_new(struct wmOperatorType *ot);
+void OBJECT_OT_game_property_remove(struct wmOperatorType *ot);
+void OBJECT_OT_game_property_copy(struct wmOperatorType *ot);
+void OBJECT_OT_logic_bricks_copy(struct wmOperatorType *ot);
+
/* object_select.c */
void OBJECT_OT_select_all(struct wmOperatorType *ot);
void OBJECT_OT_select_inverse(struct wmOperatorType *ot);
@@ -201,9 +206,6 @@ void OBJECT_OT_vertex_group_set_active(struct wmOperatorType *ot);
void OBJECT_OT_vertex_group_sort(struct wmOperatorType *ot);
void OBJECT_OT_vertex_group_move(struct wmOperatorType *ot);
-void OBJECT_OT_game_property_new(struct wmOperatorType *ot);
-void OBJECT_OT_game_property_remove(struct wmOperatorType *ot);
-
/* object_shapekey.c */
void OBJECT_OT_shape_key_add(struct wmOperatorType *ot);
void OBJECT_OT_shape_key_remove(struct wmOperatorType *ot);
diff --git a/source/blender/editors/object/object_modifier.c b/source/blender/editors/object/object_modifier.c
index 4cfed57f9c7..3c5928d86c2 100644
--- a/source/blender/editors/object/object_modifier.c
+++ b/source/blender/editors/object/object_modifier.c
@@ -413,7 +413,7 @@ static int modifier_apply_obdata(ReportList *reports, Scene *scene, Object *ob,
multires_force_update(ob);
if (mmd && mti->type==eModifierTypeType_OnlyDeform) {
- multiresModifier_reshapeFromDeformMod (mmd, ob, md);
+ multiresModifier_reshapeFromDeformMod (ob, md);
} else {
dm = mesh_create_derived_for_modifier(scene, ob, md);
if (!dm) {
@@ -972,7 +972,7 @@ static int multires_reshape_exec(bContext *C, wmOperator *op)
return OPERATOR_CANCELLED;
}
- if(!multiresModifier_reshape(mmd, ob, secondob)) {
+ if(!multiresModifier_reshape(ob, secondob)) {
BKE_report(op->reports, RPT_ERROR, "Objects do not have the same number of vertices.");
return OPERATOR_CANCELLED;
}
diff --git a/source/blender/editors/object/object_ops.c b/source/blender/editors/object/object_ops.c
index 759e13bffb0..ce1967a1d44 100644
--- a/source/blender/editors/object/object_ops.c
+++ b/source/blender/editors/object/object_ops.c
@@ -183,6 +183,8 @@ void ED_operatortypes_object(void)
WM_operatortype_append(OBJECT_OT_game_property_new);
WM_operatortype_append(OBJECT_OT_game_property_remove);
+ WM_operatortype_append(OBJECT_OT_game_property_copy);
+ WM_operatortype_append(OBJECT_OT_logic_bricks_copy);
WM_operatortype_append(OBJECT_OT_shape_key_add);
WM_operatortype_append(OBJECT_OT_shape_key_remove);
diff --git a/source/blender/editors/physics/physics_pointcache.c b/source/blender/editors/physics/physics_pointcache.c
index 57a123d8f17..5ebbb00939e 100644
--- a/source/blender/editors/physics/physics_pointcache.c
+++ b/source/blender/editors/physics/physics_pointcache.c
@@ -71,7 +71,7 @@ static int ptcache_bake_all_poll(bContext *C)
static int ptcache_poll(bContext *C)
{
- PointerRNA ptr= CTX_data_pointer_get_type(C, "PointCache", &RNA_PointCache);
+ PointerRNA ptr= CTX_data_pointer_get_type(C, "point_cache", &RNA_PointCache);
return (ptr.data && ptr.id.data);
}
@@ -89,7 +89,7 @@ void bake_console_progress_end(void *arg)
static int ptcache_bake_all_exec(bContext *C, wmOperator *op)
{
Scene *scene= CTX_data_scene(C);
- wmWindow *win = CTX_wm_window(C);
+ wmWindow *win = G.background ? NULL : CTX_wm_window(C);
PTCacheBaker baker;
@@ -171,8 +171,8 @@ void PTCACHE_OT_free_bake_all(wmOperatorType *ot)
static int ptcache_bake_exec(bContext *C, wmOperator *op)
{
Scene *scene = CTX_data_scene(C);
- wmWindow *win = CTX_wm_window(C);
- PointerRNA ptr= CTX_data_pointer_get_type(C, "PointCache", &RNA_PointCache);
+ wmWindow *win = G.background ? NULL : CTX_wm_window(C);
+ PointerRNA ptr= CTX_data_pointer_get_type(C, "point_cache", &RNA_PointCache);
Object *ob= ptr.id.data;
PointCache *cache= ptr.data;
PTCacheBaker baker;
@@ -216,7 +216,7 @@ static int ptcache_bake_exec(bContext *C, wmOperator *op)
}
static int ptcache_free_bake_exec(bContext *C, wmOperator *op)
{
- PointerRNA ptr= CTX_data_pointer_get_type(C, "PointCache", &RNA_PointCache);
+ PointerRNA ptr= CTX_data_pointer_get_type(C, "point_cache", &RNA_PointCache);
PointCache *cache= ptr.data;
if(cache->edit) {
@@ -233,7 +233,7 @@ static int ptcache_free_bake_exec(bContext *C, wmOperator *op)
}
static int ptcache_bake_from_cache_exec(bContext *C, wmOperator *op)
{
- PointerRNA ptr= CTX_data_pointer_get_type(C, "PointCache", &RNA_PointCache);
+ PointerRNA ptr= CTX_data_pointer_get_type(C, "point_cache", &RNA_PointCache);
PointCache *cache= ptr.data;
cache->flag |= PTCACHE_BAKED;
@@ -285,7 +285,7 @@ void PTCACHE_OT_bake_from_cache(wmOperatorType *ot)
static int ptcache_add_new_exec(bContext *C, wmOperator *op)
{
Scene *scene = CTX_data_scene(C);
- PointerRNA ptr= CTX_data_pointer_get_type(C, "PointCache", &RNA_PointCache);
+ PointerRNA ptr= CTX_data_pointer_get_type(C, "point_cache", &RNA_PointCache);
Object *ob= ptr.id.data;
PointCache *cache= ptr.data;
PTCacheID *pid;
@@ -308,7 +308,7 @@ static int ptcache_add_new_exec(bContext *C, wmOperator *op)
}
static int ptcache_remove_exec(bContext *C, wmOperator *op)
{
- PointerRNA ptr= CTX_data_pointer_get_type(C, "PointCache", &RNA_PointCache);
+ PointerRNA ptr= CTX_data_pointer_get_type(C, "point_cache", &RNA_PointCache);
Scene *scene= CTX_data_scene(C);
Object *ob= ptr.id.data;
PointCache *cache= ptr.data;
diff --git a/source/blender/editors/render/render_opengl.c b/source/blender/editors/render/render_opengl.c
index ee5363a00f9..aded83c0d16 100644
--- a/source/blender/editors/render/render_opengl.c
+++ b/source/blender/editors/render/render_opengl.c
@@ -211,7 +211,7 @@ static void screen_opengl_render_end(bContext *C, OGLRender *oglrender)
if(oglrender->timer) { /* exec will not have a timer */
scene->r.cfra= oglrender->cfrao;
- scene_update_for_newframe(scene, scene->lay);
+ scene_update_for_newframe(scene, scene->lay|oglrender->v3d->lay);
WM_event_remove_timer(CTX_wm_manager(C), CTX_wm_window(C), oglrender->timer);
}
@@ -268,16 +268,16 @@ static int screen_opengl_render_anim_step(bContext *C, wmOperator *op)
/* go to next frame */
while(CFRA<oglrender->nfra) {
- if(scene->lay & 0xFF000000)
- lay= scene->lay & 0xFF000000;
- else
- lay= scene->lay;
+ lay = scene->lay | oglrender->v3d->lay;
+
+ if(lay & 0xFF000000)
+ lay &= 0xFF000000;
scene_update_for_newframe(scene, lay);
CFRA++;
}
-
- scene_update_for_newframe(scene, scene->lay);
+
+ scene_update_for_newframe(scene, scene->lay | oglrender->v3d->lay);
if(oglrender->rv3d->persp==RV3D_CAMOB && oglrender->v3d->camera && oglrender->v3d->scenelock) {
/* since scene_update_for_newframe() is used rather
diff --git a/source/blender/editors/screen/screen_ops.c b/source/blender/editors/screen/screen_ops.c
index 244997775fc..8b1c0045fd3 100644
--- a/source/blender/editors/screen/screen_ops.c
+++ b/source/blender/editors/screen/screen_ops.c
@@ -3040,7 +3040,8 @@ void ED_keymap_screen(wmKeyConfig *keyconf)
RNA_int_set(WM_keymap_add_item(keymap, "SCREEN_OT_frame_offset", WHEELDOWNMOUSE, KM_PRESS, KM_ALT, 0)->ptr, "delta", 1);
RNA_int_set(WM_keymap_add_item(keymap, "SCREEN_OT_frame_offset", WHEELUPMOUSE, KM_PRESS, KM_ALT, 0)->ptr, "delta", -1);
- WM_keymap_add_item(keymap, "SCREEN_OT_frame_jump", DOWNARROWKEY, KM_PRESS, KM_SHIFT, 0);
+ RNA_boolean_set(WM_keymap_add_item(keymap, "SCREEN_OT_frame_jump", UPARROWKEY, KM_PRESS, KM_SHIFT, 0)->ptr, "end", 1);
+ RNA_boolean_set(WM_keymap_add_item(keymap, "SCREEN_OT_frame_jump", DOWNARROWKEY, KM_PRESS, KM_SHIFT, 0)->ptr, "end", 0);
RNA_boolean_set(WM_keymap_add_item(keymap, "SCREEN_OT_frame_jump", RIGHTARROWKEY, KM_PRESS, KM_SHIFT, 0)->ptr, "end", 1);
RNA_boolean_set(WM_keymap_add_item(keymap, "SCREEN_OT_frame_jump", LEFTARROWKEY, KM_PRESS, KM_SHIFT, 0)->ptr, "end", 0);
diff --git a/source/blender/editors/space_action/action_edit.c b/source/blender/editors/space_action/action_edit.c
index a0616b5f37b..b6e3327bd12 100644
--- a/source/blender/editors/space_action/action_edit.c
+++ b/source/blender/editors/space_action/action_edit.c
@@ -133,7 +133,7 @@ static void get_keyframe_extents (bAnimContext *ac, float *min, float *max)
int filter;
/* get data to filter, from Action or Dopesheet */
- filter= (ANIMFILTER_VISIBLE | ANIMFILTER_SEL | ANIMFILTER_CURVESONLY);
+ filter= (ANIMFILTER_VISIBLE | ANIMFILTER_SEL | ANIMFILTER_CURVESONLY | ANIMFILTER_NODUPLIS);
ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
/* set large values to try to override */
@@ -284,7 +284,7 @@ static short copy_action_keys (bAnimContext *ac)
free_anim_copybuf();
/* filter data */
- filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVESONLY);
+ filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVESONLY | ANIMFILTER_NODUPLIS);
ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
/* copy keyframes */
@@ -303,7 +303,7 @@ static short paste_action_keys (bAnimContext *ac)
int filter, ok=0;
/* filter data */
- filter= (ANIMFILTER_VISIBLE | ANIMFILTER_SEL | ANIMFILTER_FOREDIT | ANIMFILTER_CURVESONLY);
+ filter= (ANIMFILTER_VISIBLE | ANIMFILTER_SEL | ANIMFILTER_FOREDIT | ANIMFILTER_CURVESONLY | ANIMFILTER_NODUPLIS);
ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
/* paste keyframes */
@@ -421,7 +421,7 @@ static void insert_action_keys(bAnimContext *ac, short mode)
short flag = 0;
/* filter data */
- filter= (ANIMFILTER_VISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_CURVESONLY);
+ filter= (ANIMFILTER_VISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_CURVESONLY | ANIMFILTER_NODUPLIS);
if (mode == 2) filter |= ANIMFILTER_SEL;
else if (mode == 3) filter |= ANIMFILTER_ACTGROUPED;
@@ -508,9 +508,9 @@ static void duplicate_action_keys (bAnimContext *ac)
/* filter data */
if (ac->datatype == ANIMCONT_GPENCIL)
- filter= (ANIMFILTER_VISIBLE | ANIMFILTER_FOREDIT);
+ filter= (ANIMFILTER_VISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_NODUPLIS);
else
- filter= (ANIMFILTER_VISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_CURVESONLY);
+ filter= (ANIMFILTER_VISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_CURVESONLY | ANIMFILTER_NODUPLIS);
ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
/* loop through filtered data and delete selected keys */
@@ -586,9 +586,9 @@ static void delete_action_keys (bAnimContext *ac)
/* filter data */
if (ac->datatype == ANIMCONT_GPENCIL)
- filter= (ANIMFILTER_VISIBLE | ANIMFILTER_FOREDIT);
+ filter= (ANIMFILTER_VISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_NODUPLIS);
else
- filter= (ANIMFILTER_VISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_CURVESONLY);
+ filter= (ANIMFILTER_VISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_CURVESONLY | ANIMFILTER_NODUPLIS);
ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
/* loop through filtered data and delete selected keys */
@@ -659,7 +659,7 @@ static void clean_action_keys (bAnimContext *ac, float thresh)
int filter;
/* filter data */
- filter= (ANIMFILTER_VISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_SEL | ANIMFILTER_CURVESONLY);
+ filter= (ANIMFILTER_VISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_SEL | ANIMFILTER_CURVESONLY | ANIMFILTER_NODUPLIS);
ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
/* loop through filtered data and clean curves */
@@ -727,7 +727,7 @@ static void sample_action_keys (bAnimContext *ac)
int filter;
/* filter data */
- filter= (ANIMFILTER_VISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_CURVESONLY);
+ filter= (ANIMFILTER_VISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_CURVESONLY | ANIMFILTER_NODUPLIS);
ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
/* loop through filtered data and add keys between selected keyframes on every frame */
@@ -797,7 +797,7 @@ static void setexpo_action_keys(bAnimContext *ac, short mode)
int filter;
/* filter data */
- filter= (ANIMFILTER_VISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_CURVESONLY);
+ filter= (ANIMFILTER_VISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_CURVESONLY | ANIMFILTER_NODUPLIS);
ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
/* loop through setting mode per F-Curve */
@@ -868,7 +868,7 @@ static void setipo_action_keys(bAnimContext *ac, short mode)
KeyframeEditFunc set_cb= ANIM_editkeyframes_ipo(mode);
/* filter data */
- filter= (ANIMFILTER_VISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_CURVESONLY);
+ filter= (ANIMFILTER_VISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_CURVESONLY | ANIMFILTER_NODUPLIS);
ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
/* loop through setting BezTriple interpolation
@@ -952,7 +952,7 @@ static void sethandles_action_keys(bAnimContext *ac, short mode)
KeyframeEditFunc sel_cb= ANIM_editkeyframes_ok(BEZT_OK_SELECTED);
/* filter data */
- filter= (ANIMFILTER_VISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_CURVESONLY);
+ filter= (ANIMFILTER_VISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_CURVESONLY | ANIMFILTER_NODUPLIS);
ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
/* loop through setting flags for handles
@@ -1036,7 +1036,7 @@ static void setkeytype_action_keys(bAnimContext *ac, short mode)
KeyframeEditFunc set_cb= ANIM_editkeyframes_keytype(mode);
/* filter data */
- filter= (ANIMFILTER_VISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_CURVESONLY);
+ filter= (ANIMFILTER_VISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_CURVESONLY | ANIMFILTER_NODUPLIS);
ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
/* loop through setting BezTriple interpolation
@@ -1118,7 +1118,7 @@ static int actkeys_framejump_exec(bContext *C, wmOperator *op)
memset(&ked, 0, sizeof(KeyframeEditData));
/* loop over action data, averaging values */
- filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVESONLY);
+ filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVESONLY | ANIMFILTER_NODUPLIS);
ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype);
for (ale= anim_data.first; ale; ale= ale->next) {
@@ -1186,7 +1186,7 @@ static void snap_action_keys(bAnimContext *ac, short mode)
if (ac->datatype == ANIMCONT_GPENCIL)
filter= (ANIMFILTER_VISIBLE | ANIMFILTER_FOREDIT);
else
- filter= (ANIMFILTER_VISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_CURVESONLY);
+ filter= (ANIMFILTER_VISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_CURVESONLY | ANIMFILTER_NODUPLIS);
ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
/* get beztriple editing callbacks */
@@ -1311,9 +1311,9 @@ static void mirror_action_keys(bAnimContext *ac, short mode)
/* filter data */
if (ac->datatype == ANIMCONT_GPENCIL)
- filter= (ANIMFILTER_VISIBLE | ANIMFILTER_FOREDIT);
+ filter= (ANIMFILTER_VISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_NODUPLIS);
else
- filter= (ANIMFILTER_VISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_CURVESONLY);
+ filter= (ANIMFILTER_VISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_CURVESONLY | ANIMFILTER_NODUPLIS);
ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
/* mirror keyframes */
diff --git a/source/blender/editors/space_action/action_select.c b/source/blender/editors/space_action/action_select.c
index 29a87ec849b..33f918c0711 100644
--- a/source/blender/editors/space_action/action_select.c
+++ b/source/blender/editors/space_action/action_select.c
@@ -95,9 +95,9 @@ static void deselect_action_keys (bAnimContext *ac, short test, short sel)
/* determine type-based settings */
if (ac->datatype == ANIMCONT_GPENCIL)
- filter= (ANIMFILTER_VISIBLE);
+ filter= (ANIMFILTER_VISIBLE | ANIMFILTER_NODUPLIS);
else
- filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVESONLY);
+ filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVESONLY | ANIMFILTER_NODUPLIS);
/* filter data */
ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
@@ -212,7 +212,7 @@ static void borderselect_action (bAnimContext *ac, rcti rect, short mode, short
UI_view2d_region_to_view(v2d, rect.xmax, rect.ymax-2, &rectf.xmax, &rectf.ymax);
/* filter data */
- filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CHANNELS);
+ filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CHANNELS | ANIMFILTER_NODUPLIS);
ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
/* get filtering flag for dopesheet data (if applicable) */
@@ -389,7 +389,7 @@ static void markers_selectkeys_between (bAnimContext *ac)
ked.f2= max;
/* filter data */
- filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVESONLY);
+ filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVESONLY | ANIMFILTER_NODUPLIS);
ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
/* select keys in-between */
@@ -572,7 +572,7 @@ static int actkeys_select_linked_exec (bContext *C, wmOperator *op)
return OPERATOR_CANCELLED;
/* loop through all of the keys and select additional keyframes based on these */
- filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVEVISIBLE | ANIMFILTER_CURVESONLY);
+ filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVEVISIBLE | ANIMFILTER_CURVESONLY | ANIMFILTER_NODUPLIS);
ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype);
for (ale= anim_data.first; ale; ale= ale->next) {
@@ -627,7 +627,7 @@ static void select_moreless_action_keys (bAnimContext *ac, short mode)
memset(&ked, 0, sizeof(KeyframeEditData));
/* loop through all of the keys and select additional keyframes based on these */
- filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVESONLY);
+ filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVESONLY | ANIMFILTER_NODUPLIS);
ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
for (ale= anim_data.first; ale; ale= ale->next) {
@@ -800,9 +800,9 @@ static void actkeys_mselect_leftright (bAnimContext *ac, short leftright, short
/* filter data */
if (ac->datatype == ANIMCONT_GPENCIL)
- filter= (ANIMFILTER_VISIBLE);
+ filter= (ANIMFILTER_VISIBLE | ANIMFILTER_NODUPLIS);
else
- filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVESONLY);
+ filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVESONLY | ANIMFILTER_NODUPLIS);
ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
/* select keys on the side where most data occurs */
@@ -823,13 +823,14 @@ static void actkeys_mselect_leftright (bAnimContext *ac, short leftright, short
/* Sync marker support */
if((select_mode==SELECT_ADD) && (ac->spacetype==SPACE_ACTION) && ELEM(leftright, ACTKEYS_LRSEL_LEFT, ACTKEYS_LRSEL_RIGHT)) {
SpaceAction *saction= ac->sa->spacedata.first;
+
if (saction && saction->flag & SACTION_MARKERS_MOVE) {
TimeMarker *marker;
-
+
for (marker= scene->markers.first; marker; marker= marker->next) {
- if( ((leftright == ACTKEYS_LRSEL_LEFT) && marker->frame < CFRA) ||
- ((leftright == ACTKEYS_LRSEL_RIGHT) && marker->frame >= CFRA)
- ) {
+ if( ((leftright == ACTKEYS_LRSEL_LEFT) && (marker->frame < CFRA)) ||
+ ((leftright == ACTKEYS_LRSEL_RIGHT) && (marker->frame >= CFRA)) )
+ {
marker->flag |= SELECT;
}
else {
@@ -864,9 +865,9 @@ static void actkeys_mselect_column(bAnimContext *ac, short select_mode, float se
* based on the keys found to be selected above
*/
if (ac->datatype == ANIMCONT_GPENCIL)
- filter= (ANIMFILTER_VISIBLE);
+ filter= (ANIMFILTER_VISIBLE | ANIMFILTER_NODUPLIS);
else
- filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVESONLY);
+ filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVESONLY | ANIMFILTER_NODUPLIS);
ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
for (ale= anim_data.first; ale; ale= ale->next) {
@@ -997,10 +998,8 @@ static void mouse_action_keys (bAnimContext *ac, int mval[2], short select_mode,
gpl_to_keylist(ads, gpl, &anim_keys, NULL);
}
- // the call below is not strictly necessary, since we have adjacency info anyway
- //BLI_dlrbTree_linkedlist_sync(&anim_keys);
-
/* loop through keyframes, finding one that was within the range clicked on */
+ // TODO: replace this with API calls instead of inlining
for (ak= anim_keys.root; ak; ak= akn) {
if (IN_RANGE(ak->cfra, rectf.xmin, rectf.xmax)) {
/* set the frame to use, and apply inverse-correction for NLA-mapping
diff --git a/source/blender/editors/space_file/Makefile b/source/blender/editors/space_file/Makefile
index 43b2f09ed2d..29548b51222 100644
--- a/source/blender/editors/space_file/Makefile
+++ b/source/blender/editors/space_file/Makefile
@@ -63,3 +63,7 @@ ifeq ($(WITH_OPENEXR), true)
CPPFLAGS += -DWITH_OPENEXR
endif
+ifeq ($(WITH_TIFF), true)
+ CPPFLAGS += -DWITH_TIFF
+endif
+
diff --git a/source/blender/editors/space_file/SConscript b/source/blender/editors/space_file/SConscript
index b22a265dcbc..9de705e99d3 100644
--- a/source/blender/editors/space_file/SConscript
+++ b/source/blender/editors/space_file/SConscript
@@ -12,9 +12,13 @@ defs = []
if env['WITH_BF_OPENJPEG']:
defs.append('WITH_OPENJPEG')
+
if env['WITH_BF_OPENEXR']:
defs.append('WITH_OPENEXR')
+if env['WITH_BF_TIFF']:
+ defs.append('WITH_TIFF')
+
if env['OURPLATFORM'] == 'linux2':
cflags='-pthread'
incs += ' ../../../extern/binreloc/include'
diff --git a/source/blender/editors/space_file/writeimage.c b/source/blender/editors/space_file/writeimage.c
index c9b30983b93..05efdc12596 100644
--- a/source/blender/editors/space_file/writeimage.c
+++ b/source/blender/editors/space_file/writeimage.c
@@ -143,10 +143,11 @@ void save_image_filesel_str(Scene *scene, char *str)
case R_BMP:
strcpy(str, "Save BMP");
break;
+#ifdef WITH_TIFF
case R_TIFF:
- if (G.have_libtiff)
- strcpy(str, "Save TIFF");
+ strcpy(str, "Save TIFF");
break;
+#endif
#ifdef WITH_OPENEXR
case R_OPENEXR:
strcpy(str, "Save OpenEXR");
diff --git a/source/blender/editors/space_graph/graph_buttons.c b/source/blender/editors/space_graph/graph_buttons.c
index 5751fb0300e..bf433923707 100644
--- a/source/blender/editors/space_graph/graph_buttons.c
+++ b/source/blender/editors/space_graph/graph_buttons.c
@@ -208,11 +208,88 @@ static void graph_panel_properties(const bContext *C, Panel *pa)
uiLayoutSetEnabled(subrow, (fcu->color_mode==FCURVE_COLOR_CUSTOM));
uiItemR(subrow, &fcu_ptr, "color", 0, "", 0);
- /* TODO: the following settings could be added here
- * - Access details (ID-block + RNA-Path + Array Index)
- * - ...
+ MEM_freeN(ale);
+}
+
+/* ******************* active Keyframe ************** */
+
+/* get 'active' keyframe for panel editing */
+static short get_active_fcurve_keyframe_edit(FCurve *fcu, BezTriple **bezt, BezTriple **prevbezt)
+{
+ BezTriple *b;
+ int i;
+
+ /* zero the pointers */
+ *bezt = *prevbezt = NULL;
+
+ /* sanity checks */
+ if ((fcu->bezt == NULL) || (fcu->totvert == 0))
+ return 0;
+
+ /* find first selected keyframe for now, and call it the active one
+ * - this is a reasonable assumption, given that whenever anyone
+ * wants to edit numerically, there is likely to only be 1 vert selected
*/
+ for (i=0, b=fcu->bezt; i < fcu->totvert; i++, b++) {
+ if (BEZSELECTED(b)) {
+ /* found
+ * - 'previous' is either the one before, of the keyframe itself (which is still fine)
+ * XXX: we can just make this null instead if needed
+ */
+ *prevbezt = (i > 0) ? b-1 : b;
+ *bezt = b;
+
+ return 1;
+ }
+ }
+
+ /* not found */
+ return 0;
+}
+static void graph_panel_key_properties(const bContext *C, Panel *pa)
+{
+ bAnimListElem *ale;
+ FCurve *fcu;
+ BezTriple *bezt, *prevbezt;
+
+ uiLayout *layout = pa->layout;
+ uiLayout *col;
+ uiBlock *block;
+
+ if (!graph_panel_context(C, &ale, &fcu))
+ return;
+
+ block = uiLayoutGetBlock(layout);
+ uiBlockSetHandleFunc(block, do_graph_region_buttons, NULL);
+
+ /* only show this info if there are keyframes to edit */
+ if (get_active_fcurve_keyframe_edit(fcu, &bezt, &prevbezt)) {
+ PointerRNA bezt_ptr;
+
+ /* RNA pointer to keyframe, to allow editing */
+ RNA_pointer_create(ale->id, &RNA_Keyframe, bezt, &bezt_ptr);
+
+ /* interpolation */
+ col= uiLayoutColumn(layout, 0);
+ uiItemR(col, &bezt_ptr, "interpolation", 0, NULL, 0);
+
+ /* numerical coordinate editing */
+ col= uiLayoutColumn(layout, 1);
+ /* keyframe itself */
+ uiItemR(col, &bezt_ptr, "co", 0, "Key", 0);
+
+ /* previous handle - only if previous was Bezier interpolation */
+ if ((prevbezt) && (prevbezt->ipo == BEZT_IPO_BEZ))
+ uiItemR(col, &bezt_ptr, "handle1", 0, NULL, 0);
+
+ /* next handle - only if current is Bezier interpolation */
+ if (bezt->ipo == BEZT_IPO_BEZ)
+ uiItemR(col, &bezt_ptr, "handle2", 0, NULL, 0);
+ }
+ else
+ uiItemL(layout, "No active keyframe on F-Curve", 0);
+
MEM_freeN(ale);
}
@@ -631,6 +708,7 @@ void graph_buttons_register(ARegionType *art)
strcpy(pt->idname, "GRAPH_PT_view");
strcpy(pt->label, "View Properties");
pt->draw= graph_panel_view;
+ pt->flag |= PNL_DEFAULT_CLOSED;
BLI_addtail(&art->paneltypes, pt);
pt= MEM_callocN(sizeof(PanelType), "spacetype graph panel properties");
@@ -639,6 +717,14 @@ void graph_buttons_register(ARegionType *art)
pt->draw= graph_panel_properties;
pt->poll= graph_panel_poll;
BLI_addtail(&art->paneltypes, pt);
+
+ pt= MEM_callocN(sizeof(PanelType), "spacetype graph panel properties");
+ strcpy(pt->idname, "GRAPH_PT_key_properties");
+ strcpy(pt->label, "Active Keyframe");
+ pt->draw= graph_panel_key_properties;
+ pt->poll= graph_panel_poll;
+ BLI_addtail(&art->paneltypes, pt);
+
pt= MEM_callocN(sizeof(PanelType), "spacetype graph panel drivers");
strcpy(pt->idname, "GRAPH_PT_drivers");
diff --git a/source/blender/editors/space_graph/graph_edit.c b/source/blender/editors/space_graph/graph_edit.c
index c762912b297..9322bae13c9 100644
--- a/source/blender/editors/space_graph/graph_edit.c
+++ b/source/blender/editors/space_graph/graph_edit.c
@@ -86,7 +86,7 @@ void get_graph_keyframe_extents (bAnimContext *ac, float *xmin, float *xmax, flo
int filter;
/* get data to filter, from Dopesheet */
- filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVEVISIBLE | ANIMFILTER_CURVESONLY);
+ filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVEVISIBLE | ANIMFILTER_CURVESONLY | ANIMFILTER_NODUPLIS);
ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
/* set large values to try to override */
@@ -258,7 +258,7 @@ static void create_ghost_curves (bAnimContext *ac, int start, int end)
}
/* filter data */
- filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVEVISIBLE | ANIMFILTER_SEL | ANIMFILTER_CURVESONLY);
+ filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVEVISIBLE | ANIMFILTER_SEL | ANIMFILTER_CURVESONLY | ANIMFILTER_NODUPLIS);
ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
/* loop through filtered data and add keys between selected keyframes on every frame */
@@ -417,7 +417,7 @@ static void insert_graph_keys(bAnimContext *ac, short mode)
short flag = 0;
/* filter data */
- filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVEVISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_CURVESONLY);
+ filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVEVISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_CURVESONLY | ANIMFILTER_NODUPLIS);
if (mode == 2) filter |= ANIMFILTER_SEL;
ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
@@ -456,8 +456,6 @@ static int graphkeys_insertkey_exec(bContext *C, wmOperator *op)
/* get editor data */
if (ANIM_animdata_get_context(C, &ac) == 0)
return OPERATOR_CANCELLED;
- if (ac.datatype == ANIMCONT_GPENCIL)
- return OPERATOR_CANCELLED;
/* which channels to affect? */
mode= RNA_enum_get(op->ptr, "type");
@@ -599,7 +597,7 @@ static short copy_graph_keys (bAnimContext *ac)
free_anim_copybuf();
/* filter data */
- filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVEVISIBLE | ANIMFILTER_CURVESONLY);
+ filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVEVISIBLE | ANIMFILTER_CURVESONLY | ANIMFILTER_NODUPLIS);
ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
/* copy keyframes */
@@ -617,7 +615,7 @@ static short paste_graph_keys (bAnimContext *ac)
int filter, ok=0;
/* filter data */
- filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVEVISIBLE | ANIMFILTER_SEL | ANIMFILTER_FOREDIT | ANIMFILTER_CURVESONLY);
+ filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVEVISIBLE | ANIMFILTER_SEL | ANIMFILTER_FOREDIT | ANIMFILTER_CURVESONLY | ANIMFILTER_NODUPLIS);
ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
/* paste keyframes */
@@ -713,7 +711,7 @@ static void duplicate_graph_keys (bAnimContext *ac)
int filter;
/* filter data */
- filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVEVISIBLE| ANIMFILTER_FOREDIT | ANIMFILTER_CURVESONLY);
+ filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVEVISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_CURVESONLY | ANIMFILTER_NODUPLIS);
ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
/* loop through filtered data and delete selected keys */
@@ -785,7 +783,7 @@ static void delete_graph_keys (bAnimContext *ac)
int filter;
/* filter data */
- filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVEVISIBLE| ANIMFILTER_FOREDIT | ANIMFILTER_CURVESONLY);
+ filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVEVISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_CURVESONLY | ANIMFILTER_NODUPLIS);
ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
/* loop through filtered data and delete selected keys */
@@ -852,7 +850,7 @@ static void clean_graph_keys (bAnimContext *ac, float thresh)
int filter;
/* filter data */
- filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVEVISIBLE| ANIMFILTER_FOREDIT | ANIMFILTER_SEL | ANIMFILTER_CURVESONLY);
+ filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVEVISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_SEL | ANIMFILTER_CURVESONLY | ANIMFILTER_NODUPLIS);
ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
/* loop through filtered data and clean curves */
@@ -919,7 +917,7 @@ static void bake_graph_curves (bAnimContext *ac, int start, int end)
int filter;
/* filter data */
- filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVEVISIBLE | ANIMFILTER_SEL | ANIMFILTER_FOREDIT | ANIMFILTER_CURVESONLY);
+ filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVEVISIBLE | ANIMFILTER_SEL | ANIMFILTER_FOREDIT | ANIMFILTER_CURVESONLY | ANIMFILTER_NODUPLIS);
ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
/* loop through filtered data and add keys between selected keyframes on every frame */
@@ -1066,7 +1064,7 @@ static int graphkeys_sound_bake_exec(bContext *C, wmOperator *op)
end = CFRA + sbi.length - 1;
/* filter anim channels */
- filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVEVISIBLE | ANIMFILTER_SEL | ANIMFILTER_FOREDIT | ANIMFILTER_CURVESONLY);
+ filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVEVISIBLE | ANIMFILTER_SEL | ANIMFILTER_FOREDIT | ANIMFILTER_CURVESONLY | ANIMFILTER_NODUPLIS);
ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype);
/* loop through all selected F-Curves, replacing its data with the sound samples */
@@ -1144,7 +1142,7 @@ static void sample_graph_keys (bAnimContext *ac)
int filter;
/* filter data */
- filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVEVISIBLE| ANIMFILTER_FOREDIT | ANIMFILTER_CURVESONLY);
+ filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVEVISIBLE| ANIMFILTER_FOREDIT | ANIMFILTER_CURVESONLY | ANIMFILTER_NODUPLIS);
ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
/* loop through filtered data and add keys between selected keyframes on every frame */
@@ -1213,7 +1211,7 @@ static void setexpo_graph_keys(bAnimContext *ac, short mode)
int filter;
/* filter data */
- filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVEVISIBLE| ANIMFILTER_FOREDIT | ANIMFILTER_CURVESONLY);
+ filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVEVISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_CURVESONLY | ANIMFILTER_NODUPLIS);
ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
/* loop through setting mode per F-Curve */
@@ -1282,7 +1280,7 @@ static void setipo_graph_keys(bAnimContext *ac, short mode)
KeyframeEditFunc set_cb= ANIM_editkeyframes_ipo(mode);
/* filter data */
- filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVEVISIBLE| ANIMFILTER_FOREDIT | ANIMFILTER_CURVESONLY);
+ filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVEVISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_CURVESONLY | ANIMFILTER_NODUPLIS);
ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
/* loop through setting BezTriple interpolation
@@ -1364,7 +1362,7 @@ static void sethandles_graph_keys(bAnimContext *ac, short mode)
KeyframeEditFunc sel_cb= ANIM_editkeyframes_ok(BEZT_OK_SELECTED);
/* filter data */
- filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVEVISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_CURVESONLY);
+ filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVEVISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_CURVESONLY | ANIMFILTER_NODUPLIS);
ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
/* loop through setting flags for handles
@@ -1475,7 +1473,7 @@ static int graphkeys_euler_filter_exec (bContext *C, wmOperator *op)
*/
/* step 1: extract only the rotation f-curves */
- filter= (ANIMFILTER_VISIBLE | ANIMFILTER_SEL | ANIMFILTER_CURVEVISIBLE | ANIMFILTER_CURVESONLY | ANIMFILTER_FOREDIT);
+ filter= (ANIMFILTER_VISIBLE | ANIMFILTER_SEL | ANIMFILTER_CURVEVISIBLE | ANIMFILTER_CURVESONLY | ANIMFILTER_FOREDIT | ANIMFILTER_NODUPLIS);
ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype);
for (ale= anim_data.first; ale; ale= ale->next) {
@@ -1554,7 +1552,7 @@ static int graphkeys_framejump_exec(bContext *C, wmOperator *op)
memset(&ked, 0, sizeof(KeyframeEditData));
/* loop over action data, averaging values */
- filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVEVISIBLE | ANIMFILTER_CURVESONLY);
+ filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVEVISIBLE | ANIMFILTER_CURVESONLY | ANIMFILTER_NODUPLIS);
ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype);
for (ale= anim_data.first; ale; ale= ale->next) {
@@ -1632,7 +1630,7 @@ static void snap_graph_keys(bAnimContext *ac, short mode)
KeyframeEditFunc edit_cb;
/* filter data */
- filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVEVISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_CURVESONLY);
+ filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVEVISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_CURVESONLY | ANIMFILTER_NODUPLIS);
ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
/* get beztriple editing callbacks */
@@ -1770,7 +1768,7 @@ static void mirror_graph_keys(bAnimContext *ac, short mode)
}
/* filter data */
- filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVEVISIBLE| ANIMFILTER_FOREDIT | ANIMFILTER_CURVESONLY);
+ filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVEVISIBLE| ANIMFILTER_FOREDIT | ANIMFILTER_CURVESONLY | ANIMFILTER_NODUPLIS);
ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
/* mirror keyframes */
@@ -1854,7 +1852,7 @@ static int graphkeys_smooth_exec(bContext *C, wmOperator *op)
return OPERATOR_CANCELLED;
/* filter data */
- filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVEVISIBLE| ANIMFILTER_FOREDIT | ANIMFILTER_CURVESONLY);
+ filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVEVISIBLE| ANIMFILTER_FOREDIT | ANIMFILTER_CURVESONLY | ANIMFILTER_NODUPLIS);
ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype);
/* smooth keyframes */
@@ -1945,7 +1943,7 @@ static int graph_fmodifier_add_exec(bContext *C, wmOperator *op)
type= RNA_enum_get(op->ptr, "type");
/* filter data */
- filter= (ANIMFILTER_VISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_CURVESONLY);
+ filter= (ANIMFILTER_VISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_CURVESONLY | ANIMFILTER_NODUPLIS);
if (RNA_boolean_get(op->ptr, "only_active"))
filter |= ANIMFILTER_ACTIVE;
else
diff --git a/source/blender/editors/space_graph/graph_select.c b/source/blender/editors/space_graph/graph_select.c
index 9c898cf1cd7..f347bfea290 100644
--- a/source/blender/editors/space_graph/graph_select.c
+++ b/source/blender/editors/space_graph/graph_select.c
@@ -95,7 +95,7 @@ static void deselect_graph_keys (bAnimContext *ac, short test, short sel)
KeyframeEditFunc test_cb, sel_cb;
/* determine type-based settings */
- filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVEVISIBLE | ANIMFILTER_CURVESONLY);
+ filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVEVISIBLE | ANIMFILTER_CURVESONLY | ANIMFILTER_NODUPLIS);
/* filter data */
ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
@@ -213,7 +213,7 @@ static void borderselect_graphkeys (bAnimContext *ac, rcti rect, short mode, sho
UI_view2d_region_to_view(v2d, rect.xmax, rect.ymax, &rectf.xmax, &rectf.ymax);
/* filter data */
- filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVESONLY | ANIMFILTER_CURVEVISIBLE);
+ filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVESONLY | ANIMFILTER_CURVEVISIBLE | ANIMFILTER_NODUPLIS);
ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
/* get beztriple editing/validation funcs */
@@ -402,7 +402,7 @@ static void markers_selectkeys_between (bAnimContext *ac)
ked.f2= max;
/* filter data */
- filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVEVISIBLE | ANIMFILTER_CURVESONLY);
+ filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVEVISIBLE | ANIMFILTER_CURVESONLY | ANIMFILTER_NODUPLIS);
ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
/* select keys in-between */
@@ -442,7 +442,7 @@ static void columnselect_graph_keys (bAnimContext *ac, short mode)
/* build list of columns */
switch (mode) {
case GRAPHKEYS_COLUMNSEL_KEYS: /* list of selected keys */
- filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVEVISIBLE | ANIMFILTER_CURVESONLY);
+ filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVEVISIBLE | ANIMFILTER_CURVESONLY | ANIMFILTER_NODUPLIS);
ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
for (ale= anim_data.first; ale; ale= ale->next)
@@ -474,7 +474,7 @@ static void columnselect_graph_keys (bAnimContext *ac, short mode)
/* loop through all of the keys and select additional keyframes
* based on the keys found to be selected above
*/
- filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVEVISIBLE | ANIMFILTER_CURVESONLY);
+ filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVEVISIBLE | ANIMFILTER_CURVESONLY | ANIMFILTER_NODUPLIS);
ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
for (ale= anim_data.first; ale; ale= ale->next) {
@@ -561,7 +561,7 @@ static int graphkeys_select_linked_exec (bContext *C, wmOperator *op)
return OPERATOR_CANCELLED;
/* loop through all of the keys and select additional keyframes based on these */
- filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVEVISIBLE | ANIMFILTER_CURVESONLY);
+ filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVEVISIBLE | ANIMFILTER_CURVESONLY | ANIMFILTER_NODUPLIS);
ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype);
for (ale= anim_data.first; ale; ale= ale->next) {
@@ -616,7 +616,7 @@ static void select_moreless_graph_keys (bAnimContext *ac, short mode)
memset(&ked, 0, sizeof(KeyframeEditData));
/* loop through all of the keys and select additional keyframes based on these */
- filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVEVISIBLE | ANIMFILTER_CURVESONLY);
+ filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVEVISIBLE | ANIMFILTER_CURVESONLY | ANIMFILTER_NODUPLIS);
ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
for (ale= anim_data.first; ale; ale= ale->next) {
@@ -834,7 +834,7 @@ static void get_nearest_fcurve_verts_list (bAnimContext *ac, int mval[2], ListBa
* - if the option to only show keyframes that belong to selected F-Curves is enabled,
* include the 'only selected' flag...
*/
- filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVEVISIBLE | ANIMFILTER_CURVESONLY);
+ filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVEVISIBLE | ANIMFILTER_CURVESONLY | ANIMFILTER_NODUPLIS);
if (sipo->flag & SIPO_SELCUVERTSONLY) // FIXME: this should really be check for by the filtering code...
filter |= ANIMFILTER_SEL;
ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
@@ -1055,7 +1055,7 @@ static void mouse_graph_keys (bAnimContext *ac, int mval[], short select_mode, s
/* set active F-Curve (NOTE: sync the filter flags with findnearest_fcurve_vert) */
if (nvi->fcu->flag & FCURVE_SELECTED) {
- int filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVEVISIBLE | ANIMFILTER_CURVESONLY);
+ int filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVEVISIBLE | ANIMFILTER_CURVESONLY | ANIMFILTER_NODUPLIS);
ANIM_set_active_channel(ac, ac->data, ac->datatype, filter, nvi->fcu, ANIMTYPE_FCURVE);
}
}
@@ -1107,7 +1107,7 @@ static void graphkeys_mselect_leftright (bAnimContext *ac, short leftright, shor
}
/* filter data */
- filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVEVISIBLE | ANIMFILTER_CURVESONLY);
+ filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVEVISIBLE | ANIMFILTER_CURVESONLY | ANIMFILTER_NODUPLIS);
ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
/* select keys on the side where most data occurs */
@@ -1180,7 +1180,7 @@ static void graphkeys_mselect_column (bAnimContext *ac, int mval[2], short selec
/* loop through all of the keys and select additional keyframes
* based on the keys found to be selected above
*/
- filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVEVISIBLE | ANIMFILTER_CURVESONLY);
+ filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVEVISIBLE | ANIMFILTER_CURVESONLY | ANIMFILTER_NODUPLIS);
ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
for (ale= anim_data.first; ale; ale= ale->next) {
diff --git a/source/blender/editors/space_graph/space_graph.c b/source/blender/editors/space_graph/space_graph.c
index 2c66cb51fba..e7cee30f374 100644
--- a/source/blender/editors/space_graph/space_graph.c
+++ b/source/blender/editors/space_graph/space_graph.c
@@ -521,7 +521,7 @@ static void graph_refresh(const bContext *C, ScrArea *sa)
* - we don't include ANIMFILTER_CURVEVISIBLE filter, as that will result in a
* mismatch between channel-colors and the drawn curves
*/
- filter= (ANIMFILTER_VISIBLE|ANIMFILTER_CURVESONLY);
+ filter= (ANIMFILTER_VISIBLE|ANIMFILTER_CURVESONLY|ANIMFILTER_NODUPLIS);
items= ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype);
/* loop over F-Curves, assigning colors */
diff --git a/source/blender/editors/space_image/Makefile b/source/blender/editors/space_image/Makefile
index af15b1d9724..4f532166bc7 100644
--- a/source/blender/editors/space_image/Makefile
+++ b/source/blender/editors/space_image/Makefile
@@ -57,3 +57,7 @@ ifeq ($(WITH_OPENEXR), true)
CPPFLAGS += -DWITH_OPENEXR
endif
+ifeq ($(WHITH_TIFF), true)
+ CPPFLAGS += -DWITH_TIFF
+endif
+
diff --git a/source/blender/editors/space_image/SConscript b/source/blender/editors/space_image/SConscript
index dd43559645d..b38e1473a0c 100644
--- a/source/blender/editors/space_image/SConscript
+++ b/source/blender/editors/space_image/SConscript
@@ -13,6 +13,8 @@ if env['WITH_BF_LCMS']:
defs.append('WITH_LCMS')
if env['WITH_BF_OPENEXR']:
defs.append('WITH_OPENEXR')
+if env['WITH_BF_TIFF']:
+ defs.append('WITH_TIFF')
if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc'):
incs += ' ' + env['BF_PTHREADS_INC']
diff --git a/source/blender/editors/space_image/image_ops.c b/source/blender/editors/space_image/image_ops.c
index 1241dbd9f4e..64d24ed578a 100644
--- a/source/blender/editors/space_image/image_ops.c
+++ b/source/blender/editors/space_image/image_ops.c
@@ -637,8 +637,9 @@ static const EnumPropertyItem image_file_type_items[] = {
{R_JP2, "JPEG_2000", 0, "Jpeg 2000", ""},
#endif
{R_IRIS, "IRIS", 0, "Iris", ""},
- //if(G.have_libtiff)
+#ifdef WITH_TIFF
{R_TIFF, "TIFF", 0, "Tiff", ""},
+#endif
{R_RADHDR, "RADIANCE_HDR", 0, "Radiance HDR", ""},
{R_CINEON, "CINEON", 0, "Cineon", ""},
{R_DPX, "DPX", 0, "DPX", ""},
@@ -1155,7 +1156,6 @@ static int reload_exec(bContext *C, wmOperator *op)
BKE_image_signal(ima, (sima)? &sima->iuser: NULL, IMA_SIGNAL_RELOAD);
WM_event_add_notifier(C, NC_IMAGE|NA_EDITED, ima);
- ED_area_tag_redraw(CTX_wm_area(C));
return OPERATOR_FINISHED;
}
@@ -1168,7 +1168,6 @@ void IMAGE_OT_reload(wmOperatorType *ot)
/* api callbacks */
ot->exec= reload_exec;
- ot->poll= space_image_poll;
/* flags */
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
diff --git a/source/blender/editors/space_logic/logic_window.c b/source/blender/editors/space_logic/logic_window.c
index f9310909f2c..69fd740d288 100644
--- a/source/blender/editors/space_logic/logic_window.c
+++ b/source/blender/editors/space_logic/logic_window.c
@@ -3221,9 +3221,14 @@ static void draw_sensor_armature(uiLayout *layout, PointerRNA *ptr)
bArmatureSensor *as = (bArmatureSensor *) sens->data;
Object *ob = (Object *)ptr->id.data;
PointerRNA pose_ptr, pchan_ptr;
- PropertyRNA *bones_prop;
+ PropertyRNA *bones_prop= NULL;
uiLayout *row;
+ if(ob->type != OB_ARMATURE){
+ uiItemL(layout, "Sensor only available for armatures", 0);
+ return;
+ }
+
if (ob->pose) {
RNA_pointer_create((ID *)ob, &RNA_Pose, ob->pose, &pose_ptr);
bones_prop = RNA_struct_find_property(&pose_ptr, "bones");
@@ -3588,6 +3593,10 @@ static void draw_actuator_action(uiLayout *layout, PointerRNA *ptr)
PointerRNA settings_ptr;
uiLayout *row;
+ if(ob->type != OB_ARMATURE){
+ uiItemL(layout, "Actuator only available for armatures", 0);
+ return;
+ }
RNA_pointer_create((ID *)ob, &RNA_GameObjectSettings, ob, &settings_ptr);
row= uiLayoutRow(layout, 0);
@@ -3623,6 +3632,11 @@ static void draw_actuator_armature(uiLayout *layout, PointerRNA *ptr)
Object *ob = (Object *)ptr->id.data;
PointerRNA pose_ptr, pchan_ptr;
PropertyRNA *bones_prop;
+
+ if(ob->type != OB_ARMATURE){
+ uiItemL(layout, "Actuator only available for armatures", 0);
+ return;
+ }
if (ob->pose) {
RNA_pointer_create((ID *)ob, &RNA_Pose, ob->pose, &pose_ptr);
@@ -3782,6 +3796,7 @@ static void draw_actuator_constraint(uiLayout *layout, PointerRNA *ptr)
static void draw_actuator_edit_object(uiLayout *layout, PointerRNA *ptr)
{
+ Object *ob = (Object *)ptr->id.data;
uiLayout *row, *split, *subsplit;
uiItemR(layout, ptr, "mode", 0, NULL, 0);
@@ -3805,6 +3820,10 @@ static void draw_actuator_edit_object(uiLayout *layout, PointerRNA *ptr)
case ACT_EDOB_END_OBJECT:
break;
case ACT_EDOB_REPLACE_MESH:
+ if(ob->type != OB_MESH) {
+ uiItemL(layout, "Mode only available for mesh objects", 0);
+ break;
+ }
split = uiLayoutSplit(layout, 0.6, 0);
uiItemR(split, ptr, "mesh", 0, NULL, 0);
row = uiLayoutRow(split, 0);
@@ -3819,6 +3838,10 @@ static void draw_actuator_edit_object(uiLayout *layout, PointerRNA *ptr)
uiItemR(subsplit, ptr, "enable_3d_tracking", UI_ITEM_R_TOGGLE, NULL, 0);
break;
case ACT_EDOB_DYNAMICS:
+ if(ob->type != OB_MESH) {
+ uiItemL(layout, "Mode only available for mesh objects", 0);
+ break;
+ }
uiItemR(layout, ptr, "dynamic_operation", 0, NULL, 0);
if (RNA_enum_get(ptr, "dynamic_operation") == ACT_EDOB_SET_MASS)
uiItemR(layout, ptr, "mass", 0, NULL, 0);
@@ -4144,6 +4167,11 @@ static void draw_actuator_shape_action(uiLayout *layout, PointerRNA *ptr)
PointerRNA settings_ptr;
uiLayout *row;
+ if(ob->type != OB_MESH){
+ uiItemL(layout, "Actuator only available for mesh objects", 0);
+ return;
+ }
+
RNA_pointer_create((ID *)ob, &RNA_GameObjectSettings, ob, &settings_ptr);
row= uiLayoutRow(layout, 0);
diff --git a/source/blender/editors/space_logic/space_logic.c b/source/blender/editors/space_logic/space_logic.c
index 89eff3beb0c..ed3d956ce01 100644
--- a/source/blender/editors/space_logic/space_logic.c
+++ b/source/blender/editors/space_logic/space_logic.c
@@ -182,6 +182,7 @@ void logic_keymap(struct wmKeyConfig *keyconf)
WM_keymap_add_item(keymap, "LOGIC_OT_properties", NKEY, KM_PRESS, 0, 0);
WM_keymap_add_item(keymap, "LOGIC_OT_links_cut", LEFTMOUSE, KM_PRESS, KM_CTRL, 0);
+ WM_keymap_add_menu(keymap, "LOGIC_MT_logicbricks_add", AKEY, KM_PRESS, KM_SHIFT, 0);
}
static void logic_refresh(const bContext *C, ScrArea *sa)
diff --git a/source/blender/editors/space_nla/nla_select.c b/source/blender/editors/space_nla/nla_select.c
index b76d90bd0f9..1416e0afdc9 100644
--- a/source/blender/editors/space_nla/nla_select.c
+++ b/source/blender/editors/space_nla/nla_select.c
@@ -70,7 +70,7 @@ static short selmodes_to_flagmodes (short sel)
break;
case SELECT_INVERT:
- return ACHANNEL_SETFLAG_TOGGLE;
+ return ACHANNEL_SETFLAG_INVERT;
break;
case SELECT_ADD:
diff --git a/source/blender/editors/space_sequencer/sequencer_edit.c b/source/blender/editors/space_sequencer/sequencer_edit.c
index 164ca6c21b0..9deb0ba4a0a 100644
--- a/source/blender/editors/space_sequencer/sequencer_edit.c
+++ b/source/blender/editors/space_sequencer/sequencer_edit.c
@@ -1650,10 +1650,10 @@ static int sequencer_cut_invoke(bContext *C, wmOperator *op, wmEvent *event)
Scene *scene = CTX_data_scene(C);
ARegion *ar= CTX_wm_region(C);
View2D *v2d= UI_view2d_fromcontext(C);
-
- int cut_side, cut_frame;
-
- cut_frame= CFRA;
+
+ int cut_side= SEQ_SIDE_BOTH;
+ int cut_frame= CFRA;
+
if (ED_operator_sequencer_active(C) && v2d)
cut_side= mouse_frame_side(v2d, event->x - ar->winrct.xmin, cut_frame);
diff --git a/source/blender/editors/space_view3d/drawanimviz.c b/source/blender/editors/space_view3d/drawanimviz.c
index 0a8f19493fa..1bc51de4471 100644
--- a/source/blender/editors/space_view3d/drawanimviz.c
+++ b/source/blender/editors/space_view3d/drawanimviz.c
@@ -199,6 +199,21 @@ void draw_motion_path_instance(Scene *scene, View3D *v3d, ARegion *ar,
glVertex3fv(mpv->co);
glEnd();
+ /* Draw big green dot where the current frame is */
+ // NOTE: only do this when drawing keyframes for now...
+ if (avs->path_viewflag & MOTIONPATH_VIEW_KFRAS) {
+ UI_ThemeColor(TH_CFRAME);
+ glPointSize(6.0f);
+
+ glBegin(GL_POINTS);
+ mpv = mpv_start + (CFRA - sfra);
+ glVertex3fv(mpv->co);
+ glEnd();
+
+ glPointSize(1.0f);
+ UI_ThemeColor(TH_TEXT_HI);
+ }
+
/* Draw frame numbers at each framestep value */
if (avs->path_viewflag & MOTIONPATH_VIEW_FNUMS) {
for (i=0, mpv=mpv_start; i < len; i+=stepsize, mpv+=stepsize) {
@@ -220,9 +235,9 @@ void draw_motion_path_instance(Scene *scene, View3D *v3d, ARegion *ar,
}
}
}
-
+
/* Keyframes - dots and numbers */
- if (avs->path_viewflag & MOTIONPATH_VIEW_KFNOS) {
+ if (avs->path_viewflag & MOTIONPATH_VIEW_KFRAS) {
AnimData *adt= BKE_animdata_from_id(&ob->id);
DLRBT_Tree keys;
@@ -230,8 +245,10 @@ void draw_motion_path_instance(Scene *scene, View3D *v3d, ARegion *ar,
BLI_dlrbTree_init(&keys);
if (adt) {
- /* for now, it is assumed that keyframes for bones are all grouped in a single group */
- if (pchan) {
+ /* it is assumed that keyframes for bones are all grouped in a single group
+ * unless an option is set to always use the whole action
+ */
+ if ((pchan) && (avs->path_viewflag & MOTIONPATH_VIEW_KFACT)==0) {
bActionGroup *agrp= action_groups_find_named(adt->action, pchan->name);
if (agrp) {
@@ -261,7 +278,7 @@ void draw_motion_path_instance(Scene *scene, View3D *v3d, ARegion *ar,
glPointSize(1.0f);
/* Draw frame numbers of keyframes */
- if (avs->path_viewflag & MOTIONPATH_VIEW_FNUMS) {
+ if (avs->path_viewflag & MOTIONPATH_VIEW_KFNOS) {
for (i=0, mpv=mpv_start; i < len; i++, mpv++) {
float mframe= (float)(sfra + i);
diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c
index 70f20df507b..7c0ccfa770c 100644
--- a/source/blender/editors/space_view3d/drawobject.c
+++ b/source/blender/editors/space_view3d/drawobject.c
@@ -30,10 +30,6 @@
#include "MEM_guardedalloc.h"
-
-
-
-
#include "DNA_camera_types.h"
#include "DNA_curve_types.h"
#include "DNA_constraint_types.h" // for drawing constraint
@@ -2488,7 +2484,8 @@ static void draw_mesh_fancy(Scene *scene, ARegion *ar, View3D *v3d, RegionView3D
if (ob==OBACT && paint_facesel_test(ob)) draw_wire = 0;
if(dt==OB_BOUNDBOX) {
- draw_bounding_volume(scene, ob);
+ if((v3d->flag2 & V3D_RENDER_OVERRIDE && v3d->drawtype >= OB_WIRE)==0)
+ draw_bounding_volume(scene, ob);
}
else if(hasHaloMat || (totface==0 && totedge==0)) {
glPointSize(1.5);
@@ -2714,8 +2711,9 @@ static void draw_mesh_fancy(Scene *scene, ARegion *ar, View3D *v3d, RegionView3D
glDepthMask(0); // disable write in zbuffer, selected edge wires show better
}
- dm->drawEdges(dm, (dt==OB_WIRE || totface==0), 0);
-
+ if((v3d->flag2 & V3D_RENDER_OVERRIDE && v3d->drawtype >= OB_SOLID)==0)
+ dm->drawEdges(dm, (dt==OB_WIRE || totface==0), 0);
+
if (dt!=OB_WIRE && draw_wire==2) {
glDepthMask(1);
bglPolygonOffset(rv3d->dist, 0.0);
@@ -3082,7 +3080,8 @@ static int drawCurveDerivedMesh(Scene *scene, View3D *v3d, RegionView3D *rv3d, B
glDisable(GL_LIGHTING);
GPU_end_object_materials();
} else {
- drawCurveDMWired (ob);
+ if((v3d->flag2 & V3D_RENDER_OVERRIDE && v3d->drawtype >= OB_SOLID)==0)
+ drawCurveDMWired (ob);
}
return 0;
@@ -5839,8 +5838,10 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag)
set_inverted_drawing(0);
}
}
- else if(dt==OB_BOUNDBOX)
- draw_bounding_volume(scene, ob);
+ else if(dt==OB_BOUNDBOX) {
+ if((v3d->flag2 & V3D_RENDER_OVERRIDE && v3d->drawtype >= OB_WIRE)==0)
+ draw_bounding_volume(scene, ob);
+ }
else if(boundbox_clip(rv3d, ob->obmat, ob->bb ? ob->bb : cu->bb))
empty_object= drawDispList(scene, v3d, rv3d, base, dt);
@@ -5852,8 +5853,10 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag)
if(cu->editnurb) {
drawnurb(scene, v3d, rv3d, base, cu->editnurb->first, dt);
}
- else if(dt==OB_BOUNDBOX)
- draw_bounding_volume(scene, ob);
+ else if(dt==OB_BOUNDBOX) {
+ if((v3d->flag2 & V3D_RENDER_OVERRIDE && v3d->drawtype >= OB_WIRE)==0)
+ draw_bounding_volume(scene, ob);
+ }
else if(boundbox_clip(rv3d, ob->obmat, ob->bb ? ob->bb : cu->bb)) {
empty_object= drawDispList(scene, v3d, rv3d, base, dt);
@@ -5867,8 +5870,10 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag)
if(mb->editelems)
drawmball(scene, v3d, rv3d, base, dt);
- else if(dt==OB_BOUNDBOX)
- draw_bounding_volume(scene, ob);
+ else if(dt==OB_BOUNDBOX) {
+ if((v3d->flag2 & V3D_RENDER_OVERRIDE && v3d->drawtype >= OB_WIRE)==0)
+ draw_bounding_volume(scene, ob);
+ }
else
empty_object= drawmball(scene, v3d, rv3d, base, dt);
break;
@@ -5905,7 +5910,7 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag)
}
}
- if((v3d->flag2 & V3D_RENDER_OVERRIDE) == 0) {
+ if((v3d->flag2 & V3D_RENDER_OVERRIDE) == 0) {
if(ob->soft /*&& flag & OB_SBMOTION*/){
float mrt[3][3],msc[3][3],mtr[3][3];
@@ -6103,7 +6108,10 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag)
if(dtx & OB_AXIS) {
drawaxes(rv3d, rv3d->viewmatob, 1.0f, flag, OB_ARROWS);
}
- if(dtx & OB_BOUNDBOX) draw_bounding_volume(scene, ob);
+ if(dtx & OB_BOUNDBOX) {
+ if((v3d->flag2 & V3D_RENDER_OVERRIDE)==0)
+ draw_bounding_volume(scene, ob);
+ }
if(dtx & OB_TEXSPACE) drawtexspace(ob);
if(dtx & OB_DRAWNAME) {
/* patch for several 3d cards (IBM mostly) that crash on glSelect with text drawing */
diff --git a/source/blender/editors/space_view3d/view3d_draw.c b/source/blender/editors/space_view3d/view3d_draw.c
index 9f9733bc80c..53fd0125329 100644
--- a/source/blender/editors/space_view3d/view3d_draw.c
+++ b/source/blender/editors/space_view3d/view3d_draw.c
@@ -1965,7 +1965,10 @@ void ED_view3d_draw_offscreen(Scene *scene, View3D *v3d, ARegion *ar, int winx,
/* set flags */
G.f |= G_RENDER_OGL;
- GPU_free_images();
+
+ /* free images which can have changed on frame-change
+ * warning! can be slow so only free animated images - campbell */
+ GPU_free_images_anim();
/* set background color, fallback on the view background color */
if(scene->world) {
@@ -2030,7 +2033,8 @@ void ED_view3d_draw_offscreen(Scene *scene, View3D *v3d, ARegion *ar, int winx,
/* draw grease-pencil stuff - needed to get paint-buffer shown too (since it's 2D) */
draw_gpencil_view3d_ext(scene, ar, 0);
- GPU_free_images();
+ /* freeing the images again here could be done after the operator runs, leaving for now */
+ GPU_free_images_anim();
/* restore size */
ar->winx= bwinx;
diff --git a/source/blender/editors/space_view3d/view3d_view.c b/source/blender/editors/space_view3d/view3d_view.c
index 6a661f18959..31ddc442cc2 100644
--- a/source/blender/editors/space_view3d/view3d_view.c
+++ b/source/blender/editors/space_view3d/view3d_view.c
@@ -1719,7 +1719,8 @@ int ED_view3d_context_activate(bContext *C)
ARegion *ar;
RegionView3D *rv3d;
- if(sa->spacetype != SPACE_VIEW3D)
+ /* sa can be NULL when called from python */
+ if(sa==NULL || sa->spacetype != SPACE_VIEW3D)
for(sa=sc->areabase.first; sa; sa= sa->next)
if(sa->spacetype==SPACE_VIEW3D)
break;
diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c
index 2002eb5a549..aab9f0d5d62 100644
--- a/source/blender/editors/transform/transform.c
+++ b/source/blender/editors/transform/transform.c
@@ -258,9 +258,8 @@ void projectFloatView(TransInfo *t, float *vec, float *adr)
void applyAspectRatio(TransInfo *t, float *vec)
{
- SpaceImage *sima= t->sa->spacedata.first;
-
if ((t->spacetype==SPACE_IMAGE) && (t->mode==TFM_TRANSLATION)) {
+ SpaceImage *sima= t->sa->spacedata.first;
float aspx, aspy;
if((sima->flag & SI_COORDFLOATS)==0) {
@@ -279,9 +278,8 @@ void applyAspectRatio(TransInfo *t, float *vec)
void removeAspectRatio(TransInfo *t, float *vec)
{
- SpaceImage *sima= t->sa->spacedata.first;
-
if ((t->spacetype==SPACE_IMAGE) && (t->mode==TFM_TRANSLATION)) {
+ SpaceImage *sima= t->sa->spacedata.first;
float aspx, aspy;
if((sima->flag & SI_COORDFLOATS)==0) {
diff --git a/source/blender/editors/transform/transform_conversions.c b/source/blender/editors/transform/transform_conversions.c
index d1b6838c517..499631ff755 100644
--- a/source/blender/editors/transform/transform_conversions.c
+++ b/source/blender/editors/transform/transform_conversions.c
@@ -3256,7 +3256,9 @@ static void createTransActionData(bContext *C, TransInfo *t)
/* Helper function for createTransGraphEditData, which is reponsible for associating
* source data with transform data
*/
-static void bezt_to_transdata (TransData *td, TransData2D *td2d, AnimData *adt, BezTriple *bezt, int bi, short selected, short ishandle, short intvals)
+static void bezt_to_transdata (TransData *td, TransData2D *td2d, AnimData *adt, BezTriple *bezt,
+ int bi, short selected, short ishandle, short intvals,
+ float mtx[3][3], float smtx[3][3])
{
float *loc = bezt->vec[bi];
float *cent = bezt->vec[1];
@@ -3326,8 +3328,9 @@ static void bezt_to_transdata (TransData *td, TransData2D *td2d, AnimData *adt,
if (intvals)
td->flag |= TD_INTVALUES;
- unit_m3(td->mtx);
- unit_m3(td->smtx);
+ /* copy space-conversion matrices for dealing with non-uniform scales */
+ copy_m3_m3(td->mtx, mtx);
+ copy_m3_m3(td->smtx, smtx);
}
static void createTransGraphEditData(bContext *C, TransInfo *t)
@@ -3348,6 +3351,7 @@ static void createTransGraphEditData(bContext *C, TransInfo *t)
BezTriple *bezt;
int count=0, i;
float cfra;
+ float mtx[3][3], smtx[3][3];
/* determine what type of data we are operating on */
if (ANIM_animdata_get_context(C, &ac) == 0)
@@ -3387,7 +3391,7 @@ static void createTransGraphEditData(bContext *C, TransInfo *t)
/* F-Curve may not have any keyframes */
if (fcu->bezt == NULL)
continue;
-
+
/* only include BezTriples whose 'keyframe' occurs on the same side of the current frame as mouse */
for (i=0, bezt=fcu->bezt; i < fcu->totvert; i++, bezt++) {
if (FrameOnMouseSide(t->frame_side, bezt->vec[1][0], cfra)) {
@@ -3409,7 +3413,8 @@ static void createTransGraphEditData(bContext *C, TransInfo *t)
if (bezt->f1 & SELECT) count++;
if (bezt->f3 & SELECT) count++;
}
- } else {
+ }
+ else {
/* for 'normal' pivots - just include anything that is selected */
if (bezt->f1 & SELECT) count++;
if (bezt->f2 & SELECT) count++;
@@ -3436,12 +3441,31 @@ static void createTransGraphEditData(bContext *C, TransInfo *t)
td= t->data;
td2d= t->data2d;
+ /* precompute space-conversion matrices for dealing with non-uniform scaling of Graph Editor */
+ unit_m3(mtx);
+ unit_m3(smtx);
+
+ if (ELEM(t->mode, TFM_ROTATION, TFM_RESIZE)) {
+ float xscale, yscale;
+
+ /* apply scale factors to x and y axes of space-conversion matrices */
+ UI_view2d_getscale(v2d, &xscale, &yscale);
+
+ /* mtx is data to global (i.e. view) conversion */
+ mul_v3_fl(mtx[0], xscale);
+ mul_v3_fl(mtx[1], yscale);
+
+ /* smtx is global (i.e. view) to data conversion */
+ if (IS_EQ(xscale, 0.0f) == 0) mul_v3_fl(smtx[0], 1.0f/xscale);
+ if (IS_EQ(yscale, 0.0f) == 0) mul_v3_fl(smtx[1], 1.0f/yscale);
+ }
+
/* loop 2: build transdata arrays */
for (ale= anim_data.first; ale; ale= ale->next) {
AnimData *adt= ANIM_nla_mapping_get(&ac, ale);
FCurve *fcu= (FCurve *)ale->key_data;
short intvals= (fcu->flag & FCURVE_INT_VALUES);
-
+
/* convert current-frame to action-time (slightly less accurate, espcially under
* higher scaling ratios, but is faster than converting all points)
*/
@@ -3463,31 +3487,33 @@ static void createTransGraphEditData(bContext *C, TransInfo *t)
short h1=1, h2=1;
/* only include handles if selected, irrespective of the interpolation modes.
- also, only treat handles specially if the center point isn't selected. */
+ * also, only treat handles specially if the center point isn't selected.
+ */
if (!ELEM3(t->mode, TFM_TRANSLATION, TFM_TIME_TRANSLATE, TFM_TIME_SLIDE) || !(bezt->f2 & SELECT)) {
if (bezt->f1 & SELECT) {
hdata = initTransDataCurveHandles(td, bezt);
- bezt_to_transdata(td++, td2d++, adt, bezt, 0, 1, 1, intvals);
- } else
+ bezt_to_transdata(td++, td2d++, adt, bezt, 0, 1, 1, intvals, mtx, smtx);
+ }
+ else
h1= 0;
-
+
if (bezt->f3 & SELECT) {
if (hdata==NULL)
hdata = initTransDataCurveHandles(td, bezt);
- bezt_to_transdata(td++, td2d++, adt, bezt, 2, 1, 1, intvals);
- } else
+ bezt_to_transdata(td++, td2d++, adt, bezt, 2, 1, 1, intvals, mtx, smtx);
+ }
+ else
h2= 0;
}
-
+
+ /* only include main vert if selected */
if (bezt->f2 & SELECT) {
- /*move handles relative to center*/
+ /* move handles relative to center */
if (ELEM3(t->mode, TFM_TRANSLATION, TFM_TIME_TRANSLATE, TFM_TIME_SLIDE)) {
if (bezt->f1 & SELECT) td->flag |= TD_MOVEHANDLE1;
if (bezt->f3 & SELECT) td->flag |= TD_MOVEHANDLE2;
}
-
- /* only include main vert if selected */
-
+
/* if scaling around individuals centers, do not include keyframes */
if (sipo->around != V3D_LOCAL) {
/* if handles were not selected, store their selection status */
@@ -3496,7 +3522,7 @@ static void createTransGraphEditData(bContext *C, TransInfo *t)
hdata = initTransDataCurveHandles(td, bezt);
}
- bezt_to_transdata(td++, td2d++, adt, bezt, 1, 1, 0, intvals);
+ bezt_to_transdata(td++, td2d++, adt, bezt, 1, 1, 0, intvals, mtx, smtx);
}
/* special hack (must be done after initTransDataCurveHandles(), as that stores handle settings to restore...):
@@ -4473,7 +4499,7 @@ static void clear_trans_object_base_flags(TransInfo *t)
if(base->flag & BA_WAS_SEL)
base->flag |= SELECT;
- base->flag &= ~(BA_WAS_SEL|BA_HAS_RECALC_OB|BA_HAS_RECALC_DATA|BA_DO_IPO|BA_TRANSFORM_CHILD|BA_TRANSFORM_PARENT);
+ base->flag &= ~(BA_WAS_SEL|BA_HAS_RECALC_OB|BA_HAS_RECALC_DATA|BA_TEMP_TAG|BA_TRANSFORM_CHILD|BA_TRANSFORM_PARENT);
}
}
diff --git a/source/blender/editors/transform/transform_generics.c b/source/blender/editors/transform/transform_generics.c
index 99793f4010a..58fc93de745 100644
--- a/source/blender/editors/transform/transform_generics.c
+++ b/source/blender/editors/transform/transform_generics.c
@@ -960,7 +960,7 @@ int initTransInfo (bContext *C, TransInfo *t, wmOperator *op, wmEvent *event)
{
t->current_orientation = RNA_enum_get(op->ptr, "constraint_orientation");
- if (t->current_orientation >= V3D_MANIP_CUSTOM + BIF_countTransformOrientation(C) - 1)
+ if (t->current_orientation >= V3D_MANIP_CUSTOM + BIF_countTransformOrientation(C))
{
t->current_orientation = V3D_MANIP_GLOBAL;
}
diff --git a/source/blender/editors/transform/transform_orientations.c b/source/blender/editors/transform/transform_orientations.c
index e9d372abfec..739aac86713 100644
--- a/source/blender/editors/transform/transform_orientations.c
+++ b/source/blender/editors/transform/transform_orientations.c
@@ -516,6 +516,7 @@ void initTransformOrientation(bContext *C, TransInfo *t)
case V3D_MANIP_GIMBAL:
unit_m3(t->spacemtx);
if (gimbal_axis(ob, t->spacemtx)) {
+ strcpy(t->spacename, "gimbal");
break;
}
/* no gimbal fallthrough to normal */
diff --git a/source/blender/gpu/GPU_draw.h b/source/blender/gpu/GPU_draw.h
index e233a3f3d94..92bf43e9a5a 100644
--- a/source/blender/gpu/GPU_draw.h
+++ b/source/blender/gpu/GPU_draw.h
@@ -117,6 +117,7 @@ int GPU_update_image_time(struct Image *ima, double time);
int GPU_verify_image(struct Image *ima, struct ImageUser *iuser, int tftile, int tfmode, int compare, int mipmap);
void GPU_free_image(struct Image *ima);
void GPU_free_images(void);
+void GPU_free_images_anim(void);
/* smoke drawing functions */
void GPU_free_smoke(struct SmokeModifierData *smd);
diff --git a/source/blender/gpu/intern/gpu_draw.c b/source/blender/gpu/intern/gpu_draw.c
index 6eb3e13c4e2..9a5a6704428 100644
--- a/source/blender/gpu/intern/gpu_draw.c
+++ b/source/blender/gpu/intern/gpu_draw.c
@@ -851,6 +851,17 @@ void GPU_free_images(void)
GPU_free_image(ima);
}
+/* same as above but only free animated images */
+void GPU_free_images_anim(void)
+{
+ Image* ima;
+
+ if(G.main)
+ for(ima=G.main->image.first; ima; ima=ima->id.next)
+ if(ELEM(ima->type, IMA_SRC_SEQUENCE, IMA_SRC_MOVIE))
+ GPU_free_image(ima);
+}
+
/* OpenGL Materials */
#define FIXEDMAT 8
diff --git a/source/blender/imbuf/CMakeLists.txt b/source/blender/imbuf/CMakeLists.txt
index 5af39cea832..98cb3dcefd9 100644
--- a/source/blender/imbuf/CMakeLists.txt
+++ b/source/blender/imbuf/CMakeLists.txt
@@ -28,13 +28,16 @@ FILE(GLOB SRC intern/*.c)
SET(INC
- . ../makesdna ../../../intern/guardedalloc ../../../intern/memutil ../blenlib
- ../avi ../blenkernel
+ .
+ ../makesdna
+ ../../../intern/guardedalloc
+ ../../../intern/memutil
+ ../blenlib
+ ../avi
+ ../blenkernel
${JPEG_INC}
${PNG_INC}
- ${TIFF_INC}
${ZLIB_INC}
- ${OPENJPEG_INC}
)
IF(WIN32)
@@ -45,7 +48,13 @@ IF(WITH_OPENEXR)
ADD_DEFINITIONS(-DWITH_OPENEXR)
ENDIF(WITH_OPENEXR)
+IF(WITH_TIFF)
+ SET(INC ${INC} ${TIFF_INCLUDE_DIR})
+ ADD_DEFINITIONS(-DWITH_TIFF)
+ENDIF(WITH_TIFF)
+
IF(WITH_OPENJPEG)
+ SET(INC ${INC} ${OPENJPEG_INC})
ADD_DEFINITIONS(-DWITH_OPENJPEG)
ENDIF(WITH_OPENJPEG)
diff --git a/source/blender/imbuf/SConscript b/source/blender/imbuf/SConscript
index b4f56df9ec0..439cdecdf5b 100644
--- a/source/blender/imbuf/SConscript
+++ b/source/blender/imbuf/SConscript
@@ -20,6 +20,9 @@ if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc'):
if env['WITH_BF_OPENEXR']:
defs.append('WITH_OPENEXR')
+if env['WITH_BF_TIFF']:
+ defs.append('WITH_TIFF')
+
if env['WITH_BF_DDS']:
defs.append('WITH_DDS')
diff --git a/source/blender/imbuf/intern/Makefile b/source/blender/imbuf/intern/Makefile
index 0f2020c799a..5f8029ddf72 100644
--- a/source/blender/imbuf/intern/Makefile
+++ b/source/blender/imbuf/intern/Makefile
@@ -61,7 +61,6 @@ CFLAGS += $(LEVEL_1_C_WARNINGS)
CPPFLAGS += -I$(NAN_JPEG)/include
CPPFLAGS += -I$(NAN_PNG)/include
CPPFLAGS += -I$(NAN_ZLIB)/include
-CPPFLAGS += -I$(NAN_TIFF)/include
CPPFLAGS += -I../../include
CPPFLAGS += -I../../blenkernel
CPPFLAGS += -I../../blenlib
@@ -85,3 +84,8 @@ ifeq ($(WITH_FFMPEG), true)
CPPFLAGS += -DWITH_FFMPEG
CPPFLAGS += $(NAN_FFMPEGCFLAGS)
endif
+
+ifeq ($(WITH_TIFF), true)
+ CPPFLAGS += -DWITH_TIFF
+ CPPFLAGS += -I$(NAN_TIFF)/include
+endif
diff --git a/source/blender/imbuf/intern/dynlibtiff.c b/source/blender/imbuf/intern/dynlibtiff.c
deleted file mode 100644
index eb1b5f8e10a..00000000000
--- a/source/blender/imbuf/intern/dynlibtiff.c
+++ /dev/null
@@ -1,280 +0,0 @@
-/**
- * Dynamically loaded libtiff support.
- *
- * This file is automatically generated by the gen_dynlibtiff.py script.
- *
- * ***** 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): Jonathan Merritt.
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-/**
- * To use the dynamic libtiff support, you must initialize the library using:
- * libtiff_init()
- * This attempts to load libtiff dynamically at runtime. G.have_libtiff will
- * be set to indicate whether or not libtiff is available. If libtiff is
- * not available, Blender can proceed with no ill effects, provided that
- * it does not attempt to use any of the libtiff_ functions. When you're
- * finished, close the library with:
- * libtiff_exit()
- * These functions are both declared in IMB_imbuf.h
- *
- * The functions provided by dyn_libtiff.h are the same as those in the
- * normal static / shared libtiff, except that they are prefixed by the
- * string "libtiff_" to indicate that they belong to a dynamically-loaded
- * version.
- */
-#include "dynlibtiff.h"
-
-#include <assert.h>
-#include <stdio.h>
-#include <stdlib.h>
-
-#include "BLI_blenlib.h"
-
-#include "imbuf.h"
-#include "IMB_imbuf.h"
-
-#include "BKE_global.h"
-#include "PIL_dynlib.h"
-
-/*********************
- * LOCAL DEFINITIONS *
- *********************/
-PILdynlib *libtiff = NULL;
-void libtiff_loadlibtiff(void);
-void* libtiff_findsymbol(char*);
-int libtiff_load_symbols(void);
-
-
-/**************************
- * LIBRARY INITIALIZATION *
- **************************/
-
-void libtiff_loadlibtiff(void)
-{
- char *filename;
- libtiff = NULL;
-
- filename = getenv("BF_TIFF_LIB");
- if (filename) libtiff = PIL_dynlib_open(filename);
- if (libtiff != NULL) return;
-
- /* Try to find libtiff in a couple of standard places */
-#ifdef __APPLE__
- /* OSX has version specific library */
- //standard install location
- libtiff = PIL_dynlib_open("/usr/local/lib/libtiff.dylib");
- if (libtiff != NULL) return;
- libtiff = PIL_dynlib_open("/usr/local/lib/libtiff.3.dylib");
- if (libtiff != NULL) return;
- libtiff = PIL_dynlib_open("/usr/local/lib/libtiff.4.dylib");
- if (libtiff != NULL) return;
- //inside the blender app package contents/resources
- libtiff = PIL_dynlib_open("@executable_path/../resources/libtiff.dylib");
- if (libtiff != NULL) return;
- libtiff = PIL_dynlib_open("@executable_path/../resources/libtiff.3.dylib");
- if (libtiff != NULL) return;
- libtiff = PIL_dynlib_open("@executable_path/../resources/libtiff.4.dylib");
- if (libtiff != NULL) return;
- //inside the blender app package contents/frameworks
- libtiff = PIL_dynlib_open("@executable_path/../frameworks/libtiff.dylib");
- if (libtiff != NULL) return;
- libtiff = PIL_dynlib_open("@executable_path/../frameworks/libtiff.3.dylib");
- if (libtiff != NULL) return;
- libtiff = PIL_dynlib_open("@executable_path/../frameworks/libtiff.4.dylib");
- if (libtiff != NULL) return;
- //along side the blender app package
- libtiff = PIL_dynlib_open("@executable_path/../../../libtiff.dylib");
- if (libtiff != NULL) return;
- libtiff = PIL_dynlib_open("@executable_path/../../../libtiff.3.dylib");
- if (libtiff != NULL) return;
- libtiff = PIL_dynlib_open("@executable_path/../../../libtiff.4.dylib");
- if (libtiff != NULL) return;
- //inside the blender app package contents/MacOS
- libtiff = PIL_dynlib_open("@executable_path/libtiff.dylib");
- if (libtiff != NULL) return;
- libtiff = PIL_dynlib_open("@executable_path/libtiff.3.dylib");
- if (libtiff != NULL) return;
- libtiff = PIL_dynlib_open("@executable_path/libtiff.4.dylib");
- if (libtiff != NULL) return;
-#else
- libtiff = PIL_dynlib_open("libtiff.so");
- if (libtiff != NULL) return;
- libtiff = PIL_dynlib_open("libtiff.so.3");
- if (libtiff != NULL) return;
- libtiff = PIL_dynlib_open("libtiff.so.4");
- if (libtiff != NULL) return;
- libtiff = PIL_dynlib_open("libtiff.dll");
- if (libtiff != NULL) return;
- libtiff = PIL_dynlib_open("/usr/lib/libtiff.so");
- if (libtiff != NULL) return;
- libtiff = PIL_dynlib_open("/usr/lib/libtiff.so.3");
- if (libtiff != NULL) return;
- libtiff = PIL_dynlib_open("/usr/lib/libtiff.so.4");
- if (libtiff != NULL) return;
-#ifdef __x86_64__
- libtiff = PIL_dynlib_open("/usr/lib64/libtiff.so");
- if (libtiff != NULL) return;
- libtiff = PIL_dynlib_open("/usr/lib64/libtiff.so.3");
- if (libtiff != NULL) return;
- libtiff = PIL_dynlib_open("/usr/lib64/libtiff.so.4");
- if (libtiff != NULL) return;
-#endif
- libtiff = PIL_dynlib_open("/usr/local/lib/libtiff.so");
- if (libtiff != NULL) return;
- /* For solaris */
- libtiff = PIL_dynlib_open("/usr/openwin/lib/libtiff.so");
-#endif
-
-}
-
-void *libtiff_findsymbol(char *name)
-{
- void *symbol = NULL;
- assert(libtiff != NULL);
- symbol = PIL_dynlib_find_symbol(libtiff, name);
- if (symbol == NULL) {
- char *err = PIL_dynlib_get_error_as_string(libtiff);
-
- if (err) printf("libtiff_findsymbol: error %s\n",err);
- else printf("libtiff_findsymbol: error Unknown.\n");
-
- libtiff = NULL;
- G.have_libtiff = (0);
- return NULL;
- }
- return symbol;
-}
-
-void libtiff_init(void)
-{
- if (libtiff != NULL) {
- printf("libtiff_init: Attempted to load libtiff twice!\n");
- return;
- }
- libtiff_loadlibtiff();
- G.have_libtiff = ((libtiff != NULL) && (libtiff_load_symbols()));
-
- if (!G.have_libtiff && (G.f & G_DEBUG)) {
- printf("Unable to load: libtiff.\n");
- printf("Try setting the BF_TIFF_LIB environment variable if you want this support.\n");
- printf("Example: setenv BF_TIFF_LIB /usr/lib/libtiff.so\n");
- }
-}
-
-void libtiff_exit(void)
-{
- if (libtiff != NULL) {
- PIL_dynlib_close(libtiff);
- libtiff = NULL;
- }
-}
-
-
-int libtiff_load_symbols(void)
-{
- /* Attempt to load TIFFClientOpen */
- libtiff_TIFFClientOpen = libtiff_findsymbol("TIFFClientOpen");
- if (libtiff_TIFFClientOpen == NULL) {
- return (0);
- }
- /* Attempt to load TIFFClose */
- libtiff_TIFFClose = libtiff_findsymbol("TIFFClose");
- if (libtiff_TIFFClose == NULL) {
- return (0);
- }
- /* Attempt to load TIFFGetField */
- libtiff_TIFFGetField = libtiff_findsymbol("TIFFGetField");
- if (libtiff_TIFFGetField == NULL) {
- return (0);
- }
- /* Attempt to load TIFFOpen */
- libtiff_TIFFOpen = libtiff_findsymbol("TIFFOpen");
- if (libtiff_TIFFOpen == NULL) {
- return (0);
- }
- /* Attempt to load TIFFReadRGBAImage */
- libtiff_TIFFReadRGBAImage = libtiff_findsymbol("TIFFReadRGBAImage");
- if (libtiff_TIFFReadRGBAImage == NULL) {
- return (0);
- }
- /* Attempt to load TIFFSetField */
- libtiff_TIFFSetField = libtiff_findsymbol("TIFFSetField");
- if (libtiff_TIFFSetField == NULL) {
- return (0);
- }
- /* Attempt to load TIFFWriteEncodedStrip */
- libtiff_TIFFWriteEncodedStrip = libtiff_findsymbol("TIFFWriteEncodedStrip");
- if (libtiff_TIFFWriteEncodedStrip == NULL) {
- return (0);
- }
- /* Attempt to load _TIFFfree */
- libtiff__TIFFfree = libtiff_findsymbol("_TIFFfree");
- if (libtiff__TIFFfree == NULL) {
- return (0);
- }
- /* Attempt to load _TIFFmalloc */
- libtiff__TIFFmalloc = libtiff_findsymbol("_TIFFmalloc");
- if (libtiff__TIFFmalloc == NULL) {
- return (0);
- }
- /* Attempt to load TIFFSetDirectory */
- libtiff_TIFFSetDirectory = libtiff_findsymbol("TIFFSetDirectory");
- if (libtiff_TIFFSetDirectory == NULL) {
- return (0);
- }
- /* Attempt to load TIFFNumberOfDirectories */
- libtiff_TIFFNumberOfDirectories = libtiff_findsymbol("TIFFNumberOfDirectories");
- if (libtiff_TIFFNumberOfDirectories == NULL) {
- return (0);
- }
- /* Attempt to load TIFFIsTiled */
- libtiff_TIFFIsTiled = libtiff_findsymbol("TIFFIsTiled");
- if (libtiff_TIFFIsTiled == NULL) {
- return (0);
- }
- /* Attempt to load TIFFReadRGBATile */
- libtiff_TIFFReadRGBATile = libtiff_findsymbol("TIFFReadRGBATile");
- if (libtiff_TIFFReadRGBATile == NULL) {
- return (0);
- }
- return (1);
-}
-
-
-/*******************
- * SYMBOL POINTERS *
- *******************/
-
-TIFF* (*libtiff_TIFFClientOpen)(const char*, const char*, thandle_t, TIFFReadWriteProc, TIFFReadWriteProc, TIFFSeekProc, TIFFCloseProc, TIFFSizeProc, TIFFMapFileProc, TIFFUnmapFileProc) = NULL;
-void (*libtiff_TIFFClose)(TIFF*) = NULL;
-int (*libtiff_TIFFGetField)(TIFF*, ttag_t, ...) = NULL;
-TIFF* (*libtiff_TIFFOpen)(const char*, const char*) = NULL;
-int (*libtiff_TIFFReadRGBAImage)(TIFF*, uint32, uint32, uint32*, int) = NULL;
-int (*libtiff_TIFFSetField)(TIFF*, ttag_t, ...) = NULL;
-tsize_t (*libtiff_TIFFWriteEncodedStrip)(TIFF*, tstrip_t, tdata_t, tsize_t) = NULL;
-void (*libtiff__TIFFfree)(tdata_t) = NULL;
-tdata_t (*libtiff__TIFFmalloc)(tsize_t) = NULL;
-int (*libtiff_TIFFSetDirectory)(TIFF*, tdir_t) = NULL;
-tdir_t (*libtiff_TIFFNumberOfDirectories)(TIFF*) = NULL;
-int (*libtiff_TIFFIsTiled)(TIFF*) = NULL;
-int (*libtiff_TIFFReadRGBATile)(TIFF*, uint32, uint32, uint32 * ) = NULL;
-
-
diff --git a/source/blender/imbuf/intern/dynlibtiff.h b/source/blender/imbuf/intern/dynlibtiff.h
deleted file mode 100644
index 5fafafbcf94..00000000000
--- a/source/blender/imbuf/intern/dynlibtiff.h
+++ /dev/null
@@ -1,59 +0,0 @@
-/**
- * Dynamically loaded libtiff support.
- *
- * This file is automatically generated by the gen_dynlibtiff.py script.
- *
- * ***** 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): Jonathan Merritt.
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-/**
- * To use the dynamic libtiff support, you must initialize the library using:
- * libtiff_init()
- * This attempts to load libtiff dynamically at runtime. G.have_libtiff will
- * be set to indicate whether or not libtiff is available. If libtiff is
- * not available, Blender can proceed with no ill effects, provided that
- * it does not attempt to use any of the libtiff_ functions. When you're
- * finished, close the library with:
- * libtiff_exit()
- * These functions are both declared in IMB_imbuf.h
- *
- * The functions provided by dyn_libtiff.h are the same as those in the
- * normal static / shared libtiff, except that they are prefixed by the
- * string "libtiff_" to indicate that they belong to a dynamically-loaded
- * version.
- */
-#ifndef DYN_LIBTIFF_H
-#include "tiffio.h"
-extern TIFF* (*libtiff_TIFFClientOpen)(const char*, const char*, thandle_t, TIFFReadWriteProc, TIFFReadWriteProc, TIFFSeekProc, TIFFCloseProc, TIFFSizeProc, TIFFMapFileProc, TIFFUnmapFileProc);
-extern void (*libtiff_TIFFClose)(TIFF*);
-extern int (*libtiff_TIFFGetField)(TIFF*, ttag_t, ...);
-extern TIFF* (*libtiff_TIFFOpen)(const char*, const char*);
-extern int (*libtiff_TIFFReadRGBAImage)(TIFF*, uint32, uint32, uint32*, int);
-extern int (*libtiff_TIFFSetField)(TIFF*, ttag_t, ...);
-extern tsize_t (*libtiff_TIFFWriteEncodedStrip)(TIFF*, tstrip_t, tdata_t, tsize_t);
-extern void (*libtiff__TIFFfree)(tdata_t);
-extern tdata_t (*libtiff__TIFFmalloc)(tsize_t);
-extern int (*libtiff_TIFFSetDirectory)(TIFF*, tdir_t);
-extern tdir_t (*libtiff_TIFFNumberOfDirectories)(TIFF*);
-extern int (*libtiff_TIFFIsTiled)(TIFF*);
-extern int (*libtiff_TIFFReadRGBATile)(TIFF*, uint32, uint32, uint32 * );
-#endif /* DYN_LIBTIFF_H */
-
diff --git a/source/blender/imbuf/intern/filetype.c b/source/blender/imbuf/intern/filetype.c
index 4a491ceba22..a0ff4476556 100644
--- a/source/blender/imbuf/intern/filetype.c
+++ b/source/blender/imbuf/intern/filetype.c
@@ -65,10 +65,10 @@ ImFileType IMB_FILE_TYPES[]= {
{NULL, NULL, imb_is_a_targa, imb_ftype_default, imb_loadtarga, imb_savetarga, NULL, 0, TGA},
{NULL, NULL, imb_is_dpx, imb_ftype_default, imb_loaddpx, imb_save_dpx, NULL, IM_FTYPE_FLOAT, DPX},
{NULL, NULL, imb_is_cineon, imb_ftype_default, imb_loadcineon, imb_savecineon, NULL, IM_FTYPE_FLOAT, CINEON},
-#if defined(__APPLE__) && defined(IMBUF_COCOA)
+#ifdef WITH_TIFF
+ {NULL, NULL, imb_is_a_tiff, imb_ftype_default, imb_loadtiff, imb_savetiff, imb_loadtiletiff, 0, TIF},
+#elif defined(__APPLE__) && defined(IMBUF_COCOA)
{NULL, NULL, imb_is_a_cocoa, imb_ftype_cocoa, imb_imb_cocoaLoadImage, imb_savecocoa, NULL, 0, TIF},
-#else
- {libtiff_init, libtiff_exit, imb_is_a_tiff, imb_ftype_default, imb_loadtiff, imb_savetiff, imb_loadtiletiff, 0, TIF},
#endif
{NULL, NULL, imb_is_a_hdr, imb_ftype_default, imb_loadhdr, imb_savehdr, NULL, IM_FTYPE_FLOAT, RADHDR},
#ifdef WITH_OPENEXR
diff --git a/source/blender/imbuf/intern/jp2.c b/source/blender/imbuf/intern/jp2.c
index 9d045aff3bf..a76c6e780ca 100644
--- a/source/blender/imbuf/intern/jp2.c
+++ b/source/blender/imbuf/intern/jp2.c
@@ -24,6 +24,7 @@
#ifdef WITH_OPENJPEG
#include "BLI_blenlib.h"
+#include "BLI_math.h"
#include "imbuf.h"
@@ -532,16 +533,23 @@ static opj_image_t* ibuftoimage(ImBuf *ibuf, opj_cparameters_t *parameters) {
if (rect_float) {
+ float rgb[3];
+
switch (prec) {
case 8: /* Convert blenders float color channels to 8,12 or 16bit ints */
for(y=h-1; y>=0; y--) {
y_row = y*w;
for(x=0; x<w; x++, rect_float+=4) {
i = y_row + x;
+
+ if (ibuf->profile == IB_PROFILE_LINEAR_RGB)
+ linearrgb_to_srgb_v3_v3(rgb, rect_float);
+ else
+ copy_v3_v3(rgb, rect_float);
- image->comps[0].data[i] = DOWNSAMPLE_FLOAT_TO_8BIT(rect_float[0]);
- image->comps[1].data[i] = DOWNSAMPLE_FLOAT_TO_8BIT(rect_float[1]);
- image->comps[2].data[i] = DOWNSAMPLE_FLOAT_TO_8BIT(rect_float[2]);
+ image->comps[0].data[i] = DOWNSAMPLE_FLOAT_TO_8BIT(rgb[0]);
+ image->comps[1].data[i] = DOWNSAMPLE_FLOAT_TO_8BIT(rgb[1]);
+ image->comps[2].data[i] = DOWNSAMPLE_FLOAT_TO_8BIT(rgb[2]);
if (numcomps>3)
image->comps[3].data[i] = DOWNSAMPLE_FLOAT_TO_8BIT(rect_float[3]);
}
@@ -553,10 +561,15 @@ static opj_image_t* ibuftoimage(ImBuf *ibuf, opj_cparameters_t *parameters) {
y_row = y*w;
for(x=0; x<w; x++, rect_float+=4) {
i = y_row + x;
+
+ if (ibuf->profile == IB_PROFILE_LINEAR_RGB)
+ linearrgb_to_srgb_v3_v3(rgb, rect_float);
+ else
+ copy_v3_v3(rgb, rect_float);
- image->comps[0].data[i] = DOWNSAMPLE_FLOAT_TO_12BIT(rect_float[0]);
- image->comps[1].data[i] = DOWNSAMPLE_FLOAT_TO_12BIT(rect_float[1]);
- image->comps[2].data[i] = DOWNSAMPLE_FLOAT_TO_12BIT(rect_float[2]);
+ image->comps[0].data[i] = DOWNSAMPLE_FLOAT_TO_12BIT(rgb[0]);
+ image->comps[1].data[i] = DOWNSAMPLE_FLOAT_TO_12BIT(rgb[1]);
+ image->comps[2].data[i] = DOWNSAMPLE_FLOAT_TO_12BIT(rgb[2]);
if (numcomps>3)
image->comps[3].data[i] = DOWNSAMPLE_FLOAT_TO_12BIT(rect_float[3]);
}
@@ -567,10 +580,15 @@ static opj_image_t* ibuftoimage(ImBuf *ibuf, opj_cparameters_t *parameters) {
y_row = y*w;
for(x=0; x<w; x++, rect_float+=4) {
i = y_row + x;
+
+ if (ibuf->profile == IB_PROFILE_LINEAR_RGB)
+ linearrgb_to_srgb_v3_v3(rgb, rect_float);
+ else
+ copy_v3_v3(rgb, rect_float);
- image->comps[0].data[i] = DOWNSAMPLE_FLOAT_TO_16BIT(rect_float[0]);
- image->comps[1].data[i] = DOWNSAMPLE_FLOAT_TO_16BIT(rect_float[1]);
- image->comps[2].data[i] = DOWNSAMPLE_FLOAT_TO_16BIT(rect_float[2]);
+ image->comps[0].data[i] = DOWNSAMPLE_FLOAT_TO_16BIT(rgb[0]);
+ image->comps[1].data[i] = DOWNSAMPLE_FLOAT_TO_16BIT(rgb[1]);
+ image->comps[2].data[i] = DOWNSAMPLE_FLOAT_TO_16BIT(rgb[2]);
if (numcomps>3)
image->comps[3].data[i] = DOWNSAMPLE_FLOAT_TO_16BIT(rect_float[3]);
}
diff --git a/source/blender/imbuf/intern/openexr/openexr_api.cpp b/source/blender/imbuf/intern/openexr/openexr_api.cpp
index c495508558e..fd505115994 100644
--- a/source/blender/imbuf/intern/openexr/openexr_api.cpp
+++ b/source/blender/imbuf/intern/openexr/openexr_api.cpp
@@ -531,12 +531,9 @@ void IMB_exr_set_channel(void *handle, char *layname, char *passname, int xstrid
}
else
BLI_strncpy(name, passname, EXR_TOT_MAXNAME-1);
-
-
- for(echan= (ExrChannel *)data->channels.first; echan; echan= echan->next)
- if(strcmp(echan->name, name)==0)
- break;
-
+
+ echan= (ExrChannel *)BLI_findstring(&data->channels, name, offsetof(ExrChannel, name));
+
if(echan) {
echan->xstride= xstride;
echan->ystride= ystride;
@@ -724,35 +721,30 @@ static int imb_exr_split_channel_name(ExrChannel *echan, char *layname, char *pa
static ExrLayer *imb_exr_get_layer(ListBase *lb, char *layname)
{
- ExrLayer *lay;
-
- for(lay= (ExrLayer *)lb->first; lay; lay= lay->next) {
- if( strcmp(lay->name, layname)==0 )
- return lay;
+ ExrLayer *lay= (ExrLayer *)BLI_findstring(lb, layname, offsetof(ExrLayer, name));
+
+ if(lay==NULL) {
+ lay= (ExrLayer *)MEM_callocN(sizeof(ExrLayer), "exr layer");
+ BLI_addtail(lb, lay);
+ BLI_strncpy(lay->name, layname, EXR_LAY_MAXNAME);
}
- lay= (ExrLayer *)MEM_callocN(sizeof(ExrLayer), "exr layer");
- BLI_addtail(lb, lay);
- BLI_strncpy(lay->name, layname, EXR_LAY_MAXNAME);
-
+
return lay;
}
static ExrPass *imb_exr_get_pass(ListBase *lb, char *passname)
{
- ExrPass *pass;
+ ExrPass *pass= (ExrPass *)BLI_findstring(lb, passname, offsetof(ExrPass, name));
- for(pass= (ExrPass *)lb->first; pass; pass= pass->next) {
- if( strcmp(pass->name, passname)==0 )
- return pass;
+ if(pass==NULL) {
+ pass= (ExrPass *)MEM_callocN(sizeof(ExrPass), "exr pass");
+
+ if(strcmp(passname, "Combined")==0)
+ BLI_addhead(lb, pass);
+ else
+ BLI_addtail(lb, pass);
}
-
- pass= (ExrPass *)MEM_callocN(sizeof(ExrPass), "exr pass");
- if(strcmp(passname, "Combined")==0)
- BLI_addhead(lb, pass);
- else
- BLI_addtail(lb, pass);
-
BLI_strncpy(pass->name, passname, EXR_LAY_MAXNAME);
return pass;
@@ -904,14 +896,7 @@ static const char *exr_rgba_channelname(InputFile *file, const char *chan)
static int exr_has_zbuffer(InputFile *file)
{
- const ChannelList &channels = file->header().channels();
-
- for (ChannelList::ConstIterator i = channels.begin(); i != channels.end(); ++i)
- {
- if(strcmp("Z", i.name())==0)
- return 1;
- }
- return 0;
+ return !(file->header().channels().findChannel("Z") == NULL);
}
static int exr_is_renderresult(InputFile *file)
diff --git a/source/blender/imbuf/intern/tiff.c b/source/blender/imbuf/intern/tiff.c
index e7309eefb56..1e4b2ea7110 100644
--- a/source/blender/imbuf/intern/tiff.c
+++ b/source/blender/imbuf/intern/tiff.c
@@ -40,12 +40,16 @@
* used to compress images.
*/
+#ifdef WITH_TIFF
+
#include <string.h>
#include "imbuf.h"
-
+
#include "BKE_global.h"
+#include "BKE_utildefines.h"
+#include "BLI_math.h"
#include "BLI_string.h"
#include "IMB_imbuf_types.h"
@@ -55,7 +59,7 @@
#include "IMB_filetype.h"
#include "IMB_filter.h"
-#include "dynlibtiff.h"
+#include "tiffio.h"
@@ -265,7 +269,7 @@ static TIFF *imb_tiff_client_open(ImbTIFFMemFile *memFile, unsigned char *mem, i
memFile->offset = 0;
memFile->size = size;
- return libtiff_TIFFClientOpen("(Blender TIFF Interface Layer)",
+ return TIFFClientOpen("(Blender TIFF Interface Layer)",
"r", (thandle_t)(memFile),
imb_tiff_ReadProc, imb_tiff_WriteProc,
imb_tiff_SeekProc, imb_tiff_CloseProc,
@@ -297,16 +301,77 @@ int imb_is_a_tiff(unsigned char *mem)
(memcmp(lil_endian, mem, IMB_TIFF_NCB) == 0) );
}
-static int imb_read_tiff_pixels(ImBuf *ibuf, TIFF *image, int premul)
+static void scanline_contig_8bit(unsigned char *rect, unsigned char *cbuf, int scanline_w, int spp)
+{
+ int i;
+ for (i=0; i < scanline_w; i++) {
+ rect[i*4 + 0] = cbuf[i*spp + 0];
+ rect[i*4 + 1] = cbuf[i*spp + 1];
+ rect[i*4 + 2] = cbuf[i*spp + 2];
+ rect[i*4 + 3] = (spp==4)?cbuf[i*spp + 3]:255;
+ }
+}
+
+static void scanline_contig_16bit(float *rectf, unsigned short *sbuf, int scanline_w, int spp)
+{
+ int i;
+ for (i=0; i < scanline_w; i++) {
+ rectf[i*4 + 0] = sbuf[i*spp + 0] / 65535.0;
+ rectf[i*4 + 1] = sbuf[i*spp + 1] / 65535.0;
+ rectf[i*4 + 2] = sbuf[i*spp + 2] / 65535.0;
+ rectf[i*4 + 3] = (spp==4)?(sbuf[i*spp + 3] / 65535.0):1.0;
+ }
+}
+
+static void scanline_contig_32bit(float *rectf, float *fbuf, int scanline_w, int spp)
+{
+ int i;
+ for (i=0; i < scanline_w; i++) {
+ rectf[i*4 + 0] = fbuf[i*spp + 0];
+ rectf[i*4 + 1] = fbuf[i*spp + 1];
+ rectf[i*4 + 2] = fbuf[i*spp + 2];
+ rectf[i*4 + 3] = (spp==4)?fbuf[i*spp + 3]:1.0;
+ }
+}
+
+static void scanline_separate_8bit(unsigned char *rect, unsigned char *cbuf, int scanline_w, int chan)
+{
+ int i;
+ for (i=0; i < scanline_w; i++)
+ rect[i*4 + chan] = cbuf[i];
+}
+
+static void scanline_separate_16bit(float *rectf, unsigned short *sbuf, int scanline_w, int chan)
+{
+ int i;
+ for (i=0; i < scanline_w; i++)
+ rectf[i*4 + chan] = sbuf[i] / 65535.0;
+}
+
+static void scanline_separate_32bit(float *rectf, float *fbuf, int scanline_w, int chan)
+{
+ int i;
+ for (i=0; i < scanline_w; i++)
+ rectf[i*4 + chan] = fbuf[i];
+}
+
+
+/*
+ * Use the libTIFF RGBAImage API to read a TIFF image.
+ * This function uses the "RGBA Image" support from libtiff, which enables
+ * it to load most commonly-encountered TIFF formats. libtiff handles format
+ * conversion, color depth conversion, etc.
+ */
+static int imb_read_tiff_pixels_rgba(ImBuf *ibuf, TIFF *image, int premul)
{
ImBuf *tmpibuf;
int success;
-
+
tmpibuf= IMB_allocImBuf(ibuf->x, ibuf->y, 32, IB_rect, 0);
- success= libtiff_TIFFReadRGBAImage(image, ibuf->x, ibuf->y, tmpibuf->rect, 0);
+ success= TIFFReadRGBAImage(image, ibuf->x, ibuf->y, tmpibuf->rect, 0);
if(ENDIAN_ORDER == B_ENDIAN)
- IMB_convert_rgba_to_abgr(tmpibuf);
+ IMB_convert_rgba_to_abgr(tmpibuf);
if(premul) {
IMB_premultiply_alpha(tmpibuf);
ibuf->flags |= IB_premul;
@@ -323,12 +388,133 @@ static int imb_read_tiff_pixels(ImBuf *ibuf, TIFF *image, int premul)
return success;
}
+/*
+ * Use the libTIFF scanline API to read a TIFF image.
+ * This method is most flexible and can handle multiple different bit depths
+ * and RGB channel orderings.
+ */
+static int imb_read_tiff_pixels(ImBuf *ibuf, TIFF *image, int premul)
+{
+ ImBuf *tmpibuf;
+ int success;
+ short bitspersample, spp, config;
+ size_t scanline;
+ int ib_flag=0, row, chan;
+ float *fbuf=NULL;
+ unsigned short *sbuf=NULL;
+ unsigned char *cbuf=NULL;
+
+ TIFFGetField(image, TIFFTAG_BITSPERSAMPLE, &bitspersample);
+ TIFFGetField(image, TIFFTAG_SAMPLESPERPIXEL, &spp); /* number of 'channels' */
+ TIFFGetField(image, TIFFTAG_PLANARCONFIG, &config);
+ scanline = TIFFScanlineSize(image);
+
+ /* if file has an unsupported channel count, use libTIFF to
+ * convert to an 8 bit RGBA image */
+ if (!ELEM(spp, 3, 4))
+ return imb_read_tiff_pixels_rgba(ibuf, image, premul);
+
+
+ if (bitspersample == 32) {
+ ib_flag = IB_rectfloat;
+ fbuf = (float *)_TIFFmalloc(scanline);
+ } else if (bitspersample == 16) {
+ ib_flag = IB_rectfloat;
+ sbuf = (unsigned short *)_TIFFmalloc(scanline);
+ } else if (bitspersample == 8) {
+ ib_flag = IB_rect;
+ cbuf = (unsigned char *)_TIFFmalloc(scanline);
+ }
+
+ tmpibuf= IMB_allocImBuf(ibuf->x, ibuf->y, ibuf->depth, ib_flag, 0);
+
+ /* contiguous channels: RGBRGBRGB */
+ if (config == PLANARCONFIG_CONTIG) {
+ for (row = 0; row < ibuf->y; row++) {
+ int ib_offset = ibuf->x*ibuf->y*4 - ibuf->x*4 * (row+1);
+
+ if (bitspersample == 32) {
+ success = TIFFReadScanline(image, fbuf, row, 0);
+ scanline_contig_32bit(tmpibuf->rect_float+ib_offset, fbuf, ibuf->x, spp);
+
+ } else if (bitspersample == 16) {
+ success = TIFFReadScanline(image, sbuf, row, 0);
+ scanline_contig_16bit(tmpibuf->rect_float+ib_offset, sbuf, ibuf->x, spp);
+
+ } else if (bitspersample == 8) {
+ unsigned char *crect = (unsigned char*)tmpibuf->rect;
+ success = TIFFReadScanline(image, cbuf, row, 0);
+ scanline_contig_8bit(crect+ib_offset, cbuf, ibuf->x, spp);
+ }
+ }
+ /* separate channels: RRRGGGBBB */
+ } else if (config == PLANARCONFIG_SEPARATE) {
+
+ /* imbufs always have 4 channels of data, so we iterate over all of them
+ * but only fill in from the TIFF scanline where necessary. */
+ for (chan = 0; chan < 4; chan++) {
+ for (row = 0; row < ibuf->y; row++) {
+ int ib_offset = ibuf->x*ibuf->y*4 - ibuf->x*4 * (row+1);
+
+ if (bitspersample == 32) {
+ if (chan == 3 && spp == 3) /* fill alpha if only RGB TIFF */
+ memset(fbuf, 1.0, sizeof(fbuf));
+ else
+ success = TIFFReadScanline(image, fbuf, row, chan);
+ scanline_separate_32bit(tmpibuf->rect_float+ib_offset, fbuf, ibuf->x, chan);
+
+ } else if (bitspersample == 16) {
+ if (chan == 3 && spp == 3) /* fill alpha if only RGB TIFF */
+ memset(sbuf, 65535, sizeof(sbuf));
+ else
+ success = TIFFReadScanline(image, sbuf, row, chan);
+ scanline_separate_16bit(tmpibuf->rect_float+ib_offset, sbuf, ibuf->x, chan);
+
+ } else if (bitspersample == 8) {
+ unsigned char *crect = (unsigned char*)tmpibuf->rect;
+ if (chan == 3 && spp == 3) /* fill alpha if only RGB TIFF */
+ memset(cbuf, 255, sizeof(cbuf));
+ else
+ success = TIFFReadScanline(image, cbuf, row, chan);
+ scanline_separate_8bit(crect+ib_offset, cbuf, ibuf->x, chan);
+ }
+ }
+ }
+ }
+
+ ibuf->profile = (bitspersample==32)?IB_PROFILE_LINEAR_RGB:IB_PROFILE_SRGB;
+
+ if (bitspersample == 32)
+ _TIFFfree(fbuf);
+ else if (bitspersample == 16)
+ _TIFFfree(sbuf);
+ else if (bitspersample == 8)
+ _TIFFfree(cbuf);
+
+ if(ENDIAN_ORDER == B_ENDIAN)
+ IMB_convert_rgba_to_abgr(tmpibuf);
+ if(premul) {
+ IMB_premultiply_alpha(tmpibuf);
+ ibuf->flags |= IB_premul;
+ }
+
+ /* assign rect last */
+ if (tmpibuf->rect_float)
+ ibuf->rect_float= tmpibuf->rect_float;
+ else
+ ibuf->rect= tmpibuf->rect;
+ ibuf->mall |= ib_flag;
+ ibuf->flags |= ib_flag;
+
+ tmpibuf->mall &= ~ib_flag;
+ IMB_freeImBuf(tmpibuf);
+
+ return success;
+}
+
/**
* Loads a TIFF file.
*
- * This function uses the "RGBA Image" support from libtiff, which enables
- * it to load most commonly-encountered TIFF formats. libtiff handles format
- * conversion, color depth conversion, etc.
*
* @param mem: Memory containing the TIFF file.
* @param size: Size of the mem buffer.
@@ -345,9 +531,8 @@ ImBuf *imb_loadtiff(unsigned char *mem, int size, int flags)
uint32 width, height;
char *format = NULL;
int level;
-
- if(!G.have_libtiff)
- return NULL;
+ short spp;
+ int ib_depth;
/* check whether or not we have a TIFF file */
if(size < IMB_TIFF_NCB) {
@@ -365,24 +550,27 @@ ImBuf *imb_loadtiff(unsigned char *mem, int size, int flags)
}
/* allocate the image buffer */
- libtiff_TIFFGetField(image, TIFFTAG_IMAGEWIDTH, &width);
- libtiff_TIFFGetField(image, TIFFTAG_IMAGELENGTH, &height);
- ibuf = IMB_allocImBuf(width, height, 32, 0, 0);
+ TIFFGetField(image, TIFFTAG_IMAGEWIDTH, &width);
+ TIFFGetField(image, TIFFTAG_IMAGELENGTH, &height);
+ TIFFGetField(image, TIFFTAG_SAMPLESPERPIXEL, &spp);
+
+ ib_depth = (spp==3)?24:32;
+
+ ibuf = IMB_allocImBuf(width, height, ib_depth, 0, 0);
if(ibuf) {
ibuf->ftype = TIF;
- ibuf->profile = IB_PROFILE_SRGB;
}
else {
fprintf(stderr,
"imb_loadtiff: could not allocate memory for TIFF " \
"image.\n");
- libtiff_TIFFClose(image);
+ TIFFClose(image);
return NULL;
}
/* if testing, we're done */
if(flags & IB_test) {
- libtiff_TIFFClose(image);
+ TIFFClose(image);
return ibuf;
}
@@ -390,14 +578,14 @@ ImBuf *imb_loadtiff(unsigned char *mem, int size, int flags)
we don't read pixels but leave it to the cache to load tiles */
if(flags & IB_tilecache) {
format= NULL;
- libtiff_TIFFGetField(image, TIFFTAG_PIXAR_TEXTUREFORMAT, &format);
+ TIFFGetField(image, TIFFTAG_PIXAR_TEXTUREFORMAT, &format);
- if(format && strcmp(format, "Plain Texture")==0 && libtiff_TIFFIsTiled(image)) {
- int numlevel = libtiff_TIFFNumberOfDirectories(image);
+ if(format && strcmp(format, "Plain Texture")==0 && TIFFIsTiled(image)) {
+ int numlevel = TIFFNumberOfDirectories(image);
/* create empty mipmap levels in advance */
for(level=0; level<numlevel; level++) {
- if(!libtiff_TIFFSetDirectory(image, level))
+ if(!TIFFSetDirectory(image, level))
break;
if(level > 0) {
@@ -416,8 +604,8 @@ ImBuf *imb_loadtiff(unsigned char *mem, int size, int flags)
else
hbuf= ibuf;
- libtiff_TIFFGetField(image, TIFFTAG_TILEWIDTH, &hbuf->tilex);
- libtiff_TIFFGetField(image, TIFFTAG_TILELENGTH, &hbuf->tiley);
+ TIFFGetField(image, TIFFTAG_TILEWIDTH, &hbuf->tilex);
+ TIFFGetField(image, TIFFTAG_TILELENGTH, &hbuf->tiley);
hbuf->xtiles= ceil(hbuf->x/(float)hbuf->tilex);
hbuf->ytiles= ceil(hbuf->y/(float)hbuf->tiley);
@@ -432,12 +620,12 @@ ImBuf *imb_loadtiff(unsigned char *mem, int size, int flags)
/* read pixels */
if(!(ibuf->flags & IB_tilecache) && !imb_read_tiff_pixels(ibuf, image, 0)) {
fprintf(stderr, "imb_loadtiff: Failed to read tiff image.\n");
- libtiff_TIFFClose(image);
+ TIFFClose(image);
return NULL;
}
/* close the client layer interface to the in-memory file */
- libtiff_TIFFClose(image);
+ TIFFClose(image);
/* return successfully */
return ibuf;
@@ -456,15 +644,15 @@ void imb_loadtiletiff(ImBuf *ibuf, unsigned char *mem, int size, int tx, int ty,
return;
}
- if(libtiff_TIFFSetDirectory(image, ibuf->miplevel)) {
+ if(TIFFSetDirectory(image, ibuf->miplevel)) {
/* allocate the image buffer */
- libtiff_TIFFGetField(image, TIFFTAG_IMAGEWIDTH, &width);
- libtiff_TIFFGetField(image, TIFFTAG_IMAGELENGTH, &height);
+ TIFFGetField(image, TIFFTAG_IMAGEWIDTH, &width);
+ TIFFGetField(image, TIFFTAG_IMAGELENGTH, &height);
if(width == ibuf->x && height == ibuf->y) {
if(rect) {
/* tiff pixels are bottom to top, tiles are top to bottom */
- if(libtiff_TIFFReadRGBATile(image, tx*ibuf->tilex, (ibuf->ytiles - 1 - ty)*ibuf->tiley, rect) == 1) {
+ if(TIFFReadRGBATile(image, tx*ibuf->tilex, (ibuf->ytiles - 1 - ty)*ibuf->tiley, rect) == 1) {
if(ibuf->tiley > ibuf->y)
memmove(rect, rect+ibuf->tilex*(ibuf->tiley - ibuf->y), sizeof(int)*ibuf->tilex*ibuf->y);
@@ -482,7 +670,7 @@ void imb_loadtiletiff(ImBuf *ibuf, unsigned char *mem, int size, int tx, int ty,
printf("imb_loadtiff: could not find mipmap level %d\n", ibuf->miplevel);
/* close the client layer interface to the in-memory file */
- libtiff_TIFFClose(image);
+ TIFFClose(image);
}
/**
@@ -501,8 +689,6 @@ void imb_loadtiletiff(ImBuf *ibuf, unsigned char *mem, int size, int tx, int ty,
* @return: 1 if the function is successful, 0 on failure.
*/
-#define FTOUSHORT(val) ((val >= 1.0f-0.5f/65535)? 65535: (val <= 0.0f)? 0: (unsigned short)(val*65535.0f + 0.5f))
-
int imb_savetiff(ImBuf *ibuf, char *name, int flags)
{
TIFF *image = NULL;
@@ -515,10 +701,6 @@ int imb_savetiff(ImBuf *ibuf, char *name, int flags)
int x, y, from_i, to_i, i;
int extraSampleTypes[1] = { EXTRASAMPLE_ASSOCALPHA };
- if(!G.have_libtiff) {
- fprintf(stderr, "imb_savetiff: no tiff library available.\n");
- return (0);
- }
/* check for a valid number of bytes per pixel. Like the PNG writer,
* the TIFF writer supports 1, 3 or 4 bytes per pixel, corresponding
@@ -546,7 +728,7 @@ int imb_savetiff(ImBuf *ibuf, char *name, int flags)
}
else {
/* create image as a file */
- image = libtiff_TIFFOpen(name, "w");
+ image = TIFFOpen(name, "w");
}
if(image == NULL) {
fprintf(stderr,
@@ -557,16 +739,16 @@ int imb_savetiff(ImBuf *ibuf, char *name, int flags)
/* allocate array for pixel data */
npixels = ibuf->x * ibuf->y;
if(bitspersample == 16)
- pixels16 = (unsigned short*)libtiff__TIFFmalloc(npixels *
+ pixels16 = (unsigned short*)_TIFFmalloc(npixels *
samplesperpixel * sizeof(unsigned short));
else
- pixels = (unsigned char*)libtiff__TIFFmalloc(npixels *
+ pixels = (unsigned char*)_TIFFmalloc(npixels *
samplesperpixel * sizeof(unsigned char));
if(pixels == NULL && pixels16 == NULL) {
fprintf(stderr,
"imb_savetiff: could not allocate pixels array.\n");
- libtiff_TIFFClose(image);
+ TIFFClose(image);
return (0);
}
@@ -581,24 +763,24 @@ int imb_savetiff(ImBuf *ibuf, char *name, int flags)
}
/* setup samples per pixel */
- libtiff_TIFFSetField(image, TIFFTAG_BITSPERSAMPLE, bitspersample);
- libtiff_TIFFSetField(image, TIFFTAG_SAMPLESPERPIXEL, samplesperpixel);
+ TIFFSetField(image, TIFFTAG_BITSPERSAMPLE, bitspersample);
+ TIFFSetField(image, TIFFTAG_SAMPLESPERPIXEL, samplesperpixel);
if(samplesperpixel == 4) {
/* RGBA images */
- libtiff_TIFFSetField(image, TIFFTAG_EXTRASAMPLES, 1,
+ TIFFSetField(image, TIFFTAG_EXTRASAMPLES, 1,
extraSampleTypes);
- libtiff_TIFFSetField(image, TIFFTAG_PHOTOMETRIC,
+ TIFFSetField(image, TIFFTAG_PHOTOMETRIC,
PHOTOMETRIC_RGB);
}
else if(samplesperpixel == 3) {
/* RGB images */
- libtiff_TIFFSetField(image, TIFFTAG_PHOTOMETRIC,
+ TIFFSetField(image, TIFFTAG_PHOTOMETRIC,
PHOTOMETRIC_RGB);
}
else if(samplesperpixel == 1) {
/* greyscale images, 1 channel */
- libtiff_TIFFSetField(image, TIFFTAG_PHOTOMETRIC,
+ TIFFSetField(image, TIFFTAG_PHOTOMETRIC,
PHOTOMETRIC_MINISBLACK);
}
@@ -609,8 +791,23 @@ int imb_savetiff(ImBuf *ibuf, char *name, int flags)
to_i = samplesperpixel*((ibuf->y-y-1)*ibuf->x+x);
if(pixels16) {
- for(i = 0; i < samplesperpixel; i++, to_i++, from_i++)
- to16[to_i] = FTOUSHORT(fromf[from_i]);
+ /* convert from float source */
+ float rgb[3];
+
+ if (ibuf->profile == IB_PROFILE_LINEAR_RGB)
+ linearrgb_to_srgb_v3_v3(rgb, &fromf[from_i]);
+ else
+ copy_v3_v3(rgb, &fromf[from_i]);
+
+ to16[to_i+0] = FTOUSHORT(rgb[0]);
+ to16[to_i+1] = FTOUSHORT(rgb[1]);
+ to16[to_i+2] = FTOUSHORT(rgb[2]);
+ to_i += 3; from_i+=3;
+
+ if (samplesperpixel == 4) {
+ to16[to_i+3] = FTOUSHORT(fromf[from_i+3]);
+ to_i++; from_i++;
+ }
}
else {
for(i = 0; i < samplesperpixel; i++, to_i++, from_i++)
@@ -620,30 +817,31 @@ int imb_savetiff(ImBuf *ibuf, char *name, int flags)
}
/* write the actual TIFF file */
- libtiff_TIFFSetField(image, TIFFTAG_IMAGEWIDTH, ibuf->x);
- libtiff_TIFFSetField(image, TIFFTAG_IMAGELENGTH, ibuf->y);
- libtiff_TIFFSetField(image, TIFFTAG_ROWSPERSTRIP, ibuf->y);
- libtiff_TIFFSetField(image, TIFFTAG_COMPRESSION, COMPRESSION_DEFLATE);
- libtiff_TIFFSetField(image, TIFFTAG_FILLORDER, FILLORDER_MSB2LSB);
- libtiff_TIFFSetField(image, TIFFTAG_PLANARCONFIG, PLANARCONFIG_CONTIG);
- libtiff_TIFFSetField(image, TIFFTAG_XRESOLUTION, 150.0);
- libtiff_TIFFSetField(image, TIFFTAG_YRESOLUTION, 150.0);
- libtiff_TIFFSetField(image, TIFFTAG_RESOLUTIONUNIT, RESUNIT_INCH);
- if(libtiff_TIFFWriteEncodedStrip(image, 0,
+ TIFFSetField(image, TIFFTAG_IMAGEWIDTH, ibuf->x);
+ TIFFSetField(image, TIFFTAG_IMAGELENGTH, ibuf->y);
+ TIFFSetField(image, TIFFTAG_ROWSPERSTRIP, ibuf->y);
+ TIFFSetField(image, TIFFTAG_COMPRESSION, COMPRESSION_DEFLATE);
+ TIFFSetField(image, TIFFTAG_FILLORDER, FILLORDER_MSB2LSB);
+ TIFFSetField(image, TIFFTAG_PLANARCONFIG, PLANARCONFIG_CONTIG);
+ TIFFSetField(image, TIFFTAG_XRESOLUTION, 150.0);
+ TIFFSetField(image, TIFFTAG_YRESOLUTION, 150.0);
+ TIFFSetField(image, TIFFTAG_RESOLUTIONUNIT, RESUNIT_INCH);
+ if(TIFFWriteEncodedStrip(image, 0,
(bitspersample == 16)? (unsigned char*)pixels16: pixels,
ibuf->x*ibuf->y*samplesperpixel*bitspersample/8) == -1) {
fprintf(stderr,
"imb_savetiff: Could not write encoded TIFF.\n");
- libtiff_TIFFClose(image);
- if(pixels) libtiff__TIFFfree(pixels);
- if(pixels16) libtiff__TIFFfree(pixels16);
+ TIFFClose(image);
+ if(pixels) _TIFFfree(pixels);
+ if(pixels16) _TIFFfree(pixels16);
return (1);
}
/* close the TIFF file */
- libtiff_TIFFClose(image);
- if(pixels) libtiff__TIFFfree(pixels);
- if(pixels16) libtiff__TIFFfree(pixels16);
+ TIFFClose(image);
+ if(pixels) _TIFFfree(pixels);
+ if(pixels16) _TIFFfree(pixels16);
return (1);
}
+#endif /* WITH_TIFF */ \ No newline at end of file
diff --git a/source/blender/imbuf/intern/util.c b/source/blender/imbuf/intern/util.c
index aff05b4eaff..e6f4e226caa 100644
--- a/source/blender/imbuf/intern/util.c
+++ b/source/blender/imbuf/intern/util.c
@@ -105,17 +105,19 @@ static int IMB_ispic_name(char *name)
int IMB_ispic(char *filename)
{
if(U.uiflag & USER_FILTERFILEEXTS) {
- if (G.have_libtiff && (BLI_testextensie(filename, ".tif")
+ if (BLI_testextensie(filename, ".tif")
|| BLI_testextensie(filename, ".tiff")
- || BLI_testextensie(filename, ".tx"))) {
+ || BLI_testextensie(filename, ".tx")) {
return IMB_ispic_name(filename);
}
if (G.have_quicktime){
if( BLI_testextensie(filename, ".jpg")
|| BLI_testextensie(filename, ".jpeg")
+#ifdef WITH_TIFF
|| BLI_testextensie(filename, ".tif")
|| BLI_testextensie(filename, ".tiff")
|| BLI_testextensie(filename, ".tx")
+#endif
|| BLI_testextensie(filename, ".hdr")
|| BLI_testextensie(filename, ".tga")
|| BLI_testextensie(filename, ".rgb")
@@ -144,9 +146,14 @@ int IMB_ispic(char *filename)
} else {
return(FALSE);
}
- } else { /* no quicktime or libtiff */
+ } else { /* no quicktime */
if( BLI_testextensie(filename, ".jpg")
|| BLI_testextensie(filename, ".jpeg")
+#ifdef WITH_TIFF
+ || BLI_testextensie(filename, ".tif")
+ || BLI_testextensie(filename, ".tiff")
+ || BLI_testextensie(filename, ".tx")
+#endif
|| BLI_testextensie(filename, ".hdr")
|| BLI_testextensie(filename, ".tga")
|| BLI_testextensie(filename, ".rgb")
diff --git a/source/blender/makesdna/DNA_action_types.h b/source/blender/makesdna/DNA_action_types.h
index 181ab6f0afa..210bb6a9af0 100644
--- a/source/blender/makesdna/DNA_action_types.h
+++ b/source/blender/makesdna/DNA_action_types.h
@@ -154,6 +154,8 @@ typedef enum eMotionPaths_ViewFlag {
MOTIONPATH_VIEW_KFRAS = (1<<1),
/* show keyframe/frame numbers */
MOTIONPATH_VIEW_KFNOS = (1<<2),
+ /* find keyframes in whole action (instead of just in matching group name) */
+ MOTIONPATH_VIEW_KFACT = (1<<3),
} eMotionPath_ViewFlag;
/* bAnimVizSettings->path_bakeflag */
diff --git a/source/blender/makesdna/DNA_object_types.h b/source/blender/makesdna/DNA_object_types.h
index f50909e641b..9649b8351a6 100644
--- a/source/blender/makesdna/DNA_object_types.h
+++ b/source/blender/makesdna/DNA_object_types.h
@@ -412,14 +412,15 @@ extern Object workob;
#define BA_HAS_RECALC_OB 4
#define BA_HAS_RECALC_DATA 8
- // XXX DEPRECEATED SETTING...
-#define BA_DO_IPO 32
+ /* NOTE: this was used as a proper setting in past, so nullify before using */
+#define BA_TEMP_TAG 32
#define BA_FROMSET 128
#define BA_TRANSFORM_CHILD 256 /* child of a transformed object */
#define BA_TRANSFORM_PARENT 8192 /* parent of a transformed object */
+
/* an initial attempt as making selection more specific! */
#define BA_DESELECT 0
#define BA_SELECT 1
diff --git a/source/blender/makesdna/DNA_userdef_types.h b/source/blender/makesdna/DNA_userdef_types.h
index 933ccf1bdd0..091c05a8b98 100644
--- a/source/blender/makesdna/DNA_userdef_types.h
+++ b/source/blender/makesdna/DNA_userdef_types.h
@@ -362,6 +362,8 @@ typedef struct UserDef {
short scrcastfps; /* frame rate for screencast to be played back */
short scrcastwait; /* milliseconds between screencast snapshots */
+
+ short propwidth, pad[3]; /* Value for Dual/Single Column UI */
char versemaster[160];
char verseuser[160];
diff --git a/source/blender/makesrna/RNA_types.h b/source/blender/makesrna/RNA_types.h
index 6102ccb0f34..1f066a7209d 100644
--- a/source/blender/makesrna/RNA_types.h
+++ b/source/blender/makesrna/RNA_types.h
@@ -330,22 +330,31 @@ typedef struct ExtensionRNA {
/* fake struct definitions, needed otherwise collections end up owning the C
* structs like 'Object' when defined first */
-#define MainCameras Main
-#define MainScenes Main
-#define MainArmatures Main
-#define MainMaterials Main
-#define MainMeshes Main
-#define MainLamps Main
-#define MainImages Main
-#define MainObjects Main
-#define MainTexts Main
-#define MainActions Main
-#define MainGroups Main
-#define MainTextures Main
-#define MainCurves Main
-#define MainBrushes Main
-#define MainLattices Main
-#define MainMetaBall Main
+#define MainActions Main
+#define MainArmatures Main
+#define MainBrushes Main
+#define MainCameras Main
+#define MainCurves Main
+#define MainFonts Main
+#define MainGreasePencils Main
+#define MainGroups Main
+#define MainImages Main
+#define MainLamps Main
+#define MainLattices Main
+#define MainLibraries Main
+#define MainMaterials Main
+#define MainMeshes Main
+#define MainMetaBalls Main
+#define MainNodeTrees Main
+#define MainObjects Main
+#define MainParticles Main
+#define MainScenes Main
+#define MainScreens Main
+#define MainSounds Main
+#define MainTexts Main
+#define MainTextures Main
+#define MainWindowManagers Main
+#define MainWorlds Main
#ifdef __cplusplus
}
diff --git a/source/blender/makesrna/SConscript b/source/blender/makesrna/SConscript
index 71cfc3c7da4..c4ee90dde16 100644
--- a/source/blender/makesrna/SConscript
+++ b/source/blender/makesrna/SConscript
@@ -15,6 +15,9 @@ defs = []
if env['WITH_BF_OPENEXR']:
defs.append('WITH_OPENEXR')
+if env['WITH_BF_TIFF']:
+ defs.append('WITH_TIFF')
+
if env['WITH_BF_OPENJPEG']:
defs.append('WITH_OPENJPEG')
diff --git a/source/blender/makesrna/intern/CMakeLists.txt b/source/blender/makesrna/intern/CMakeLists.txt
index 0e25160cdff..e9fc5c10f9e 100644
--- a/source/blender/makesrna/intern/CMakeLists.txt
+++ b/source/blender/makesrna/intern/CMakeLists.txt
@@ -58,6 +58,10 @@ IF(WITH_OPENEXR)
ADD_DEFINITIONS(-DWITH_OPENEXR)
ENDIF(WITH_OPENEXR)
+IF(WITH_TIFF)
+ ADD_DEFINITIONS(-DWITH_TIFF)
+ENDIF(WITH_TIFF)
+
IF(WITH_OPENJPEG)
ADD_DEFINITIONS(-DWITH_OPENJPEG)
ENDIF(WITH_OPENJPEG)
diff --git a/source/blender/makesrna/intern/Makefile b/source/blender/makesrna/intern/Makefile
index c26593100f8..8aef06e762d 100644
--- a/source/blender/makesrna/intern/Makefile
+++ b/source/blender/makesrna/intern/Makefile
@@ -92,6 +92,10 @@ ifeq ($(WITH_OPENAL),true)
CPPFLAGS += -DWITH_OPENAL
endif
+ifeq ($(WITH_TIFF),true)
+ CPPFLAGS += -DWITH_TIFF
+endif
+
ifeq ($(OS),windows)
# Windows needs these extra libs because of winstuff... It is not
# _really_ needed, but it is the easiest fix for now. If you have
diff --git a/source/blender/makesrna/intern/rna_action.c b/source/blender/makesrna/intern/rna_action.c
index df0159d22a4..4f37195068a 100644
--- a/source/blender/makesrna/intern/rna_action.c
+++ b/source/blender/makesrna/intern/rna_action.c
@@ -127,6 +127,27 @@ static void rna_Action_fcurve_remove(bAction *act, ReportList *reports, FCurve *
}
}
+static TimeMarker *rna_Action_pose_markers_new(bAction *act, ReportList *reports, char name[])
+{
+ TimeMarker *marker = MEM_callocN(sizeof(TimeMarker), "TimeMarker");
+ marker->flag= 1;
+ marker->frame= 1;
+ BLI_strncpy(marker->name, name, sizeof(marker->name));
+ BLI_addtail(&act->markers, marker);
+ return marker;
+}
+
+static void rna_Action_pose_markers_remove(bAction *act, ReportList *reports, TimeMarker *marker)
+{
+ if (!BLI_remlink_safe(&act->markers, marker)) {
+ BKE_reportf(reports, RPT_ERROR, "TimelineMarker '%s' not found in action '%s'", marker->name, act->id.name+2);
+ return;
+ }
+
+ /* XXX, invalidates PyObject */
+ MEM_freeN(marker);
+}
+
#else
static void rna_def_dopesheet(BlenderRNA *brna)
@@ -379,6 +400,34 @@ static void rna_def_action_fcurves(BlenderRNA *brna, PropertyRNA *cprop)
RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL);
}
+static void rna_def_action_pose_markers(BlenderRNA *brna, PropertyRNA *cprop)
+{
+ StructRNA *srna;
+
+ FunctionRNA *func;
+ PropertyRNA *parm;
+
+ RNA_def_property_srna(cprop, "ActionPoseMarkers");
+ srna= RNA_def_struct(brna, "ActionPoseMarkers", NULL);
+ RNA_def_struct_sdna(srna, "bAction");
+ RNA_def_struct_ui_text(srna, "Action Pose Markers", "Collection of timeline markers");
+
+ func= RNA_def_function(srna, "new", "rna_Action_pose_markers_new");
+ RNA_def_function_ui_description(func, "Add a pose marker to the action.");
+ RNA_def_function_flag(func, FUNC_USE_REPORTS);
+ parm= RNA_def_string(func, "name", "Marker", 0, "", "New name for the marker (not unique).");
+ RNA_def_property_flag(parm, PROP_REQUIRED);
+
+ parm= RNA_def_pointer(func, "marker", "TimelineMarker", "", "Newly created marker");
+ RNA_def_function_return(func, parm);
+
+ func= RNA_def_function(srna, "remove", "rna_Action_pose_markers_remove");
+ RNA_def_function_ui_description(func, "Remove a timeline marker.");
+ RNA_def_function_flag(func, FUNC_USE_REPORTS);
+ parm= RNA_def_pointer(func, "marker", "TimelineMarker", "", "Timeline marker to remove.");
+ RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL);
+}
+
static void rna_def_action(BlenderRNA *brna)
{
StructRNA *srna;
@@ -405,6 +454,7 @@ static void rna_def_action(BlenderRNA *brna)
RNA_def_property_collection_sdna(prop, NULL, "markers", NULL);
RNA_def_property_struct_type(prop, "TimelineMarker");
RNA_def_property_ui_text(prop, "Pose Markers", "Markers specific to this Action, for labeling poses");
+ rna_def_action_pose_markers(brna, prop);
RNA_api_action(srna);
}
diff --git a/source/blender/makesrna/intern/rna_actuator.c b/source/blender/makesrna/intern/rna_actuator.c
index b3800b2d68d..e9da96e0960 100644
--- a/source/blender/makesrna/intern/rna_actuator.c
+++ b/source/blender/makesrna/intern/rna_actuator.c
@@ -56,14 +56,6 @@ EnumPropertyItem actuator_type_items[] ={
{ACT_VISIBILITY, "VISIBILITY", 0, "Visibility", ""},
{0, NULL, 0, NULL, NULL}};
-EnumPropertyItem edit_object_type_items[] ={
- {ACT_EDOB_ADD_OBJECT, "ADDOBJECT", 0, "Add Object", ""},
- {ACT_EDOB_END_OBJECT, "ENDOBJECT", 0, "End Object", ""},
- {ACT_EDOB_REPLACE_MESH, "REPLACEMESH", 0, "Replace Mesh", ""},
- {ACT_EDOB_TRACK_TO, "TRACKTO", 0, "Track to", ""},
- {ACT_EDOB_DYNAMICS, "DYNAMICS", 0, "Dynamics", ""},
- {0, NULL, 0, NULL, NULL} };
-
#ifdef RNA_RUNTIME
#include "BKE_sca.h"
@@ -346,28 +338,6 @@ static void rna_StateActuator_state_set(PointerRNA *ptr, const int *values)
}
}
-static EnumPropertyItem *rna_EditObjectActuator_mode_itemf(bContext *C, PointerRNA *ptr, int *free)
-{
- EnumPropertyItem *item= NULL;
- Object *ob = (Object *)ptr->id.data;
-
- int totitem= 0;
- if (ob->type!=OB_ARMATURE)
- {
- RNA_enum_items_add_value(&item, &totitem, edit_object_type_items, ACT_EDOB_REPLACE_MESH);
- RNA_enum_items_add_value(&item, &totitem, edit_object_type_items, ACT_EDOB_DYNAMICS);
- }
-
- RNA_enum_items_add_value(&item, &totitem, edit_object_type_items, ACT_EDOB_ADD_OBJECT);
- RNA_enum_items_add_value(&item, &totitem, edit_object_type_items, ACT_EDOB_END_OBJECT);
- RNA_enum_items_add_value(&item, &totitem, edit_object_type_items, ACT_EDOB_TRACK_TO);
-
- RNA_enum_item_end(&item, &totitem);
- *free= 1;
-
- return item;
-}
-
/* Always keep in alphabetical order */
EnumPropertyItem *rna_Actuator_type_itemf(bContext *C, PointerRNA *ptr, int *free)
{
@@ -1209,14 +1179,21 @@ static void rna_def_edit_object_actuator(BlenderRNA *brna)
{ACT_EDOB_SET_MASS, "SETMASS", 0, "Set Mass", ""},
{0, NULL, 0, NULL, NULL} };
+ static EnumPropertyItem prop_type_items[] ={
+ {ACT_EDOB_ADD_OBJECT, "ADDOBJECT", 0, "Add Object", ""},
+ {ACT_EDOB_END_OBJECT, "ENDOBJECT", 0, "End Object", ""},
+ {ACT_EDOB_REPLACE_MESH, "REPLACEMESH", 0, "Replace Mesh", ""},
+ {ACT_EDOB_TRACK_TO, "TRACKTO", 0, "Track to", ""},
+ {ACT_EDOB_DYNAMICS, "DYNAMICS", 0, "Dynamics", ""},
+ {0, NULL, 0, NULL, NULL} };
+
srna= RNA_def_struct(brna, "EditObjectActuator", "Actuator");
RNA_def_struct_ui_text(srna, "Edit Object Actuator", "Actuator used to edit objects");
RNA_def_struct_sdna_from(srna, "bEditObjectActuator", "data");
prop= RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "type");
- RNA_def_property_enum_items(prop, edit_object_type_items);
- RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_EditObjectActuator_mode_itemf");
+ RNA_def_property_enum_items(prop, prop_type_items);
RNA_def_property_ui_text(prop, "Edit Object", "The mode of the actuator");
RNA_def_property_update(prop, NC_LOGIC, NULL);
@@ -1834,7 +1811,7 @@ static void rna_def_armature_actuator(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Secondary Target", "Set weight of this constraint");
RNA_def_property_update(prop, NC_LOGIC, NULL);
- prop= RNA_def_property(srna, "weight", PROP_FLOAT, PROP_PERCENTAGE);
+ prop= RNA_def_property(srna, "weight", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "weight");
RNA_def_property_range(prop, 0.0, 1.0);
RNA_def_property_ui_text(prop, "Weight", "Set weight of this constraint");
diff --git a/source/blender/makesrna/intern/rna_animation.c b/source/blender/makesrna/intern/rna_animation.c
index d791bde3054..e0cf4f912b1 100644
--- a/source/blender/makesrna/intern/rna_animation.c
+++ b/source/blender/makesrna/intern/rna_animation.c
@@ -557,7 +557,7 @@ static void rna_def_keyingset_paths(BlenderRNA *brna, PropertyRNA *cprop)
parm= RNA_def_string(func, "data_path", "", 256, "Data-Path", "RNA-Path to destination property."); // xxx hopefully this is long enough
RNA_def_property_flag(parm, PROP_REQUIRED);
/* index (defaults to -1 for entire array) */
- parm=RNA_def_int(func, "index", -1, 0, INT_MAX, "Index", "The index of the destination property (i.e. axis of Location/Rotation/etc.), or -1 for the entire array.", 0, INT_MAX);
+ parm=RNA_def_int(func, "index", -1, -1, INT_MAX, "Index", "The index of the destination property (i.e. axis of Location/Rotation/etc.), or -1 for the entire array.", 0, INT_MAX);
/* grouping */
parm=RNA_def_enum(func, "grouping_method", keyingset_path_grouping_items, KSP_GROUP_KSNAME, "Grouping Method", "Method used to define which Group-name to use.");
parm=RNA_def_string(func, "group_name", "", 64, "Group Name", "Name of Action Group to assign destination to (only if grouping mode is to use this name).");
diff --git a/source/blender/makesrna/intern/rna_animviz.c b/source/blender/makesrna/intern/rna_animviz.c
index c5172c4e59c..985521fe2c6 100644
--- a/source/blender/makesrna/intern/rna_animviz.c
+++ b/source/blender/makesrna/intern/rna_animviz.c
@@ -158,7 +158,7 @@ static void rna_def_animviz_ghosts(BlenderRNA *brna)
PropertyRNA *prop;
static const EnumPropertyItem prop_type_items[] = {
- {GHOST_TYPE_NONE, "NONE", 0, "No Ghosts", "Don not show any ghosts"},
+ {GHOST_TYPE_NONE, "NONE", 0, "No Ghosts", "Do not show any ghosts"},
{GHOST_TYPE_ACFRA, "CURRENT_FRAME", 0, "Around Current Frame", "Show ghosts from around the current frame"},
{GHOST_TYPE_RANGE, "RANGE", 0, "In Range", "Show ghosts for the specified frame range"},
{GHOST_TYPE_KEYS, "KEYS", 0, "On Keyframes", "Show ghosts on keyframes"},
@@ -222,8 +222,8 @@ static void rna_def_animviz_paths(BlenderRNA *brna)
PropertyRNA *prop;
static const EnumPropertyItem prop_type_items[]= {
- {MOTIONPATH_TYPE_RANGE, "RANGE", 0, "In Range", "Display Paths of poses within specified range"},
{MOTIONPATH_TYPE_ACFRA, "CURRENT_FRAME", 0, "Around Frame", "Display Paths of poses within a fixed number of frames around the current frame"},
+ {MOTIONPATH_TYPE_RANGE, "RANGE", 0, "In Range", "Display Paths of poses within specified range"},
{0, NULL, 0, NULL, NULL}};
static const EnumPropertyItem prop_location_items[]= {
{MOTIONPATH_BAKE_HEADS, "HEADS", 0, "Heads", "Calculate bone paths from heads"},
@@ -264,6 +264,11 @@ static void rna_def_animviz_paths(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Show Keyframe Numbers", "Show frame numbers of Keyframes on Motion Paths");
RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL); /* XXX since this is only for 3d-view drawing */
+ prop= RNA_def_property(srna, "search_all_action_keyframes", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "path_viewflag", MOTIONPATH_VIEW_KFACT);
+ RNA_def_property_ui_text(prop, "All Action Keyframes", "For bone motion paths, search whole Action for keyframes instead of in group with matching name only (is slower)");
+ RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL); /* XXX since this is only for 3d-view drawing */
+
prop= RNA_def_property(srna, "frame_step", PROP_INT, PROP_NONE);
RNA_def_property_int_sdna(prop, NULL, "path_step");
RNA_def_property_range(prop, 1, 100);
diff --git a/source/blender/makesrna/intern/rna_curve.c b/source/blender/makesrna/intern/rna_curve.c
index b12fe3a018b..563fdbf8236 100644
--- a/source/blender/makesrna/intern/rna_curve.c
+++ b/source/blender/makesrna/intern/rna_curve.c
@@ -1256,13 +1256,13 @@ static void rna_def_curve_nurb(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Type", "The interpolation type for this curve element");
RNA_def_property_update(prop, 0, "rna_Curve_update_data");
- prop= RNA_def_property(srna, "point_count_u", PROP_INT, PROP_NONE);
+ prop= RNA_def_property(srna, "point_count_u", PROP_INT, PROP_UNSIGNED);
RNA_def_property_clear_flag(prop, PROP_EDITABLE); /* editing this needs knot recalc*/
RNA_def_property_int_sdna(prop, NULL, "pntsu");
RNA_def_property_ui_text(prop, "Points U", "Total number points for the curve or surface in the U direction");
RNA_def_property_update(prop, 0, "rna_Curve_update_data");
- prop= RNA_def_property(srna, "point_count_v", PROP_INT, PROP_NONE);
+ prop= RNA_def_property(srna, "point_count_v", PROP_INT, PROP_UNSIGNED);
RNA_def_property_clear_flag(prop, PROP_EDITABLE); /* editing this needs knot recalc*/
RNA_def_property_int_sdna(prop, NULL, "pntsv");
RNA_def_property_ui_text(prop, "Points V", "Total number points for the surface on the V direction");
diff --git a/source/blender/makesrna/intern/rna_fcurve.c b/source/blender/makesrna/intern/rna_fcurve.c
index a8a73d15c9d..1fe22e8fdd8 100644
--- a/source/blender/makesrna/intern/rna_fcurve.c
+++ b/source/blender/makesrna/intern/rna_fcurve.c
@@ -546,6 +546,11 @@ static void rna_FKeyframe_points_remove(FCurve *fcu, ReportList *reports, BezTri
delete_fcurve_key(fcu, index, !do_fast);
}
+static void rna_fcurve_range(FCurve *fcu, float range[2])
+{
+ calc_fcurve_range(fcu, range, range+1);
+}
+
#else
static void rna_def_fmodifier_generator(BlenderRNA *brna)
@@ -852,7 +857,7 @@ static void rna_def_fmodifier_noise(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Phase", "A random seed for the noise effect");
RNA_def_property_update(prop, NC_ANIMATION|ND_KEYFRAME_EDIT, NULL);
- prop= RNA_def_property(srna, "depth", PROP_INT, PROP_NONE);
+ prop= RNA_def_property(srna, "depth", PROP_INT, PROP_UNSIGNED);
RNA_def_property_int_sdna(prop, NULL, "depth");
RNA_def_property_ui_text(prop, "Depth", "Amount of fine level detail present in the noise");
RNA_def_property_update(prop, NC_ANIMATION|ND_KEYFRAME_EDIT, NULL);
@@ -1321,7 +1326,9 @@ static void rna_def_fcurve(BlenderRNA *brna)
{
StructRNA *srna;
PropertyRNA *prop;
-
+ FunctionRNA *func;
+ PropertyRNA *parm;
+
static EnumPropertyItem prop_mode_extend_items[] = {
{FCURVE_EXTRAPOLATE_CONSTANT, "CONSTANT", 0, "Constant", ""},
{FCURVE_EXTRAPOLATE_LINEAR, "LINEAR", 0, "Linear", ""},
@@ -1423,8 +1430,23 @@ static void rna_def_fcurve(BlenderRNA *brna)
prop= RNA_def_property(srna, "modifiers", PROP_COLLECTION, PROP_NONE);
RNA_def_property_struct_type(prop, "FModifier");
RNA_def_property_ui_text(prop, "Modifiers", "Modifiers affecting the shape of the F-Curve");
-
rna_def_fcurve_modifiers(brna, prop);
+
+ /* Functions */
+ func= RNA_def_function(srna, "evaluate", "evaluate_fcurve"); /* calls the C/API direct */
+ RNA_def_function_ui_description(func, "Evaluate fcurve.");
+ parm= RNA_def_float(func, "frame", 1.0f, -FLT_MAX, FLT_MAX, "Frame", "Evaluate fcurve at given frame", -FLT_MAX, FLT_MAX);
+ RNA_def_property_flag(parm, PROP_REQUIRED);
+ /* return value */
+ parm= RNA_def_float(func, "position", 0, -FLT_MAX, FLT_MAX, "Position", "Fcurve position", -FLT_MAX, FLT_MAX);
+ RNA_def_function_return(func, parm);
+
+ func= RNA_def_function(srna, "range", "rna_fcurve_range");
+ RNA_def_function_ui_description(func, "Get the time extents for F-Curve.");
+ /* return value */
+ parm= RNA_def_float_vector(func, "range", 2, NULL, -FLT_MAX, FLT_MAX, "Range", "Min/Max values", -FLT_MAX, FLT_MAX);
+ RNA_def_property_flag(parm, PROP_THICK_WRAP);
+ RNA_def_function_output(func, parm);
}
/* *********************** */
diff --git a/source/blender/makesrna/intern/rna_image.c b/source/blender/makesrna/intern/rna_image.c
index 52f4b289368..c4137d5379b 100644
--- a/source/blender/makesrna/intern/rna_image.c
+++ b/source/blender/makesrna/intern/rna_image.c
@@ -441,7 +441,7 @@ static void rna_def_image(BlenderRNA *brna)
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
RNA_def_property_ui_text(prop, "Has data", "True if this image has data");
- prop= RNA_def_property(srna, "depth", PROP_INT, PROP_NONE);
+ prop= RNA_def_property(srna, "depth", PROP_INT, PROP_UNSIGNED);
RNA_def_property_int_funcs(prop, "rna_Image_depth_get", NULL, NULL);
RNA_def_property_ui_text(prop, "Depth", "Image bit depth");
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
diff --git a/source/blender/makesrna/intern/rna_main_api.c b/source/blender/makesrna/intern/rna_main_api.c
index ba1bc29ebf1..d2acb49bae2 100644
--- a/source/blender/makesrna/intern/rna_main_api.c
+++ b/source/blender/makesrna/intern/rna_main_api.c
@@ -53,6 +53,10 @@
#include "BKE_brush.h"
#include "BKE_lattice.h"
#include "BKE_mball.h"
+#include "BKE_world.h"
+#include "BKE_particle.h"
+#include "BKE_font.h"
+#include "BKE_node.h"
#include "DNA_armature_types.h"
#include "DNA_camera_types.h"
@@ -67,6 +71,10 @@
#include "DNA_brush_types.h"
#include "DNA_lattice_types.h"
#include "DNA_meta_types.h"
+#include "DNA_world_types.h"
+#include "DNA_particle_types.h"
+#include "DNA_vfont_types.h"
+#include "DNA_node_types.h"
#include "ED_screen.h"
@@ -196,6 +204,23 @@ void rna_Main_materials_remove(Main *bmain, ReportList *reports, struct Material
/* XXX python now has invalid pointer? */
}
+// XXX, commended for now, need to see how this can be used with node groups.
+struct bNodeTree *rna_Main_nodetree_new(Main *bmain, int type)
+{
+ bNodeTree *tree = ntreeAddTree(type);
+ tree->id.us--;
+ return tree;
+}
+void rna_Main_nodetree_remove(Main *bmain, ReportList *reports, struct bNodeTree *tree)
+{
+ if(ID_REAL_USERS(tree) <= 0)
+ free_libblock(&bmain->nodetree, tree);
+ else
+ BKE_reportf(reports, RPT_ERROR, "Node Tree \"%s\" must have zero users to be removed, found %d.", tree->id.name+2, ID_REAL_USERS(tree));
+
+ /* XXX python now has invalid pointer? */
+}
+
Mesh *rna_Main_meshes_new(Main *bmain, char* name)
{
Mesh *me= add_mesh(name);
@@ -291,6 +316,20 @@ void rna_Main_metaballs_remove(Main *bmain, ReportList *reports, struct MetaBall
BKE_reportf(reports, RPT_ERROR, "MetaBall \"%s\" must have zero users to be removed, found %d.", mb->id.name+2, ID_REAL_USERS(mb));
}
+VFont *rna_Main_fonts_load(Main *bmain, char *filename)
+{
+ return load_vfont(filename);
+}
+void rna_Main_fonts_remove(Main *bmain, ReportList *reports, VFont *vfont)
+{
+ if(ID_REAL_USERS(vfont) <= 0)
+ free_libblock(&bmain->vfont, vfont);
+ else
+ BKE_reportf(reports, RPT_ERROR, "Font \"%s\" must have zero users to be removed, found %d.", vfont->id.name+2, ID_REAL_USERS(vfont));
+
+ /* XXX python now has invalid pointer? */
+}
+
Tex *rna_Main_textures_new(Main *bmain, char* name)
{
Tex *tex= add_texture(name);
@@ -319,6 +358,20 @@ void rna_Main_brushes_remove(Main *bmain, ReportList *reports, struct Brush *bru
BKE_reportf(reports, RPT_ERROR, "Brush \"%s\" must have zero users to be removed, found %d.", brush->id.name+2, ID_REAL_USERS(brush));
}
+World *rna_Main_worlds_new(Main *bmain, char* name)
+{
+ World *world = add_world(name);
+ world->id.us--;
+ return world;
+}
+void rna_Main_worlds_remove(Main *bmain, ReportList *reports, struct World *world)
+{
+ if(ID_REAL_USERS(world) <= 0)
+ free_libblock(&bmain->world, world);
+ else
+ BKE_reportf(reports, RPT_ERROR, "World \"%s\" must have zero users to be removed, found %d.", world->id.name+2, ID_REAL_USERS(world));
+}
+
Group *rna_Main_groups_new(Main *bmain, char* name)
{
return add_group(name);
@@ -383,6 +436,22 @@ void rna_Main_actions_remove(Main *bmain, ReportList *reports, bAction *act)
/* XXX python now has invalid pointer? */
}
+ParticleSettings *rna_Main_particles_new(Main *bmain, char* name)
+{
+ ParticleSettings *part = psys_new_settings(name, bmain);
+ part->id.us--;
+ return part;
+}
+void rna_Main_particles_remove(Main *bmain, ReportList *reports, ParticleSettings *part)
+{
+ if(ID_REAL_USERS(part) <= 0)
+ free_libblock(&bmain->particle, part);
+ else
+ BKE_reportf(reports, RPT_ERROR, "Particle Settings \"%s\" must have zero users to be removed, found %d.", part->id.name+2, ID_REAL_USERS(part));
+
+ /* XXX python now has invalid pointer? */
+}
+
#else
void RNA_api_main(StructRNA *srna)
@@ -510,7 +579,35 @@ void RNA_def_main_materials(BlenderRNA *brna, PropertyRNA *cprop)
}
void RNA_def_main_node_groups(BlenderRNA *brna, PropertyRNA *cprop)
{
+ StructRNA *srna;
+ FunctionRNA *func;
+ PropertyRNA *parm;
+
+ static EnumPropertyItem node_nodetree_items[] = {
+ {0, "SHADER", 0, "Shader", ""},
+ {1, "COMPOSITE", 0, "Composite", ""},
+ {2, "TEXTURE", 0, "Texture", ""},
+ {0, NULL, 0, NULL, NULL}};
+
+ RNA_def_property_srna(cprop, "MainNodeTrees");
+ srna= RNA_def_struct(brna, "MainNodeTrees", NULL);
+ RNA_def_struct_ui_text(srna, "Main Node Trees", "Collection of node trees");
+
+#if 0 // need to see some examples of using these functions before enabling.
+ func= RNA_def_function(srna, "new", "rna_Main_nodetree_new");
+ RNA_def_function_ui_description(func, "Add a new node tree to the main database");
+ parm= RNA_def_enum(func, "type", node_nodetree_items, 0, "Type", "The type of curve object to add");
+ RNA_def_property_flag(parm, PROP_REQUIRED);
+ /* return type */
+ parm= RNA_def_pointer(func, "tree", "NodeTree", "", "New node tree datablock.");
+ RNA_def_function_return(func, parm);
+ func= RNA_def_function(srna, "remove", "rna_Main_nodetree_remove");
+ RNA_def_function_flag(func, FUNC_USE_REPORTS);
+ RNA_def_function_ui_description(func, "Remove a node tree from the current blendfile.");
+ parm= RNA_def_pointer(func, "tree", "NodeTree", "", "Node tree to remove.");
+ RNA_def_property_flag(parm, PROP_REQUIRED);
+#endif
}
void RNA_def_main_meshes(BlenderRNA *brna, PropertyRNA *cprop)
{
@@ -664,8 +761,8 @@ void RNA_def_main_metaballs(BlenderRNA *brna, PropertyRNA *cprop)
FunctionRNA *func;
PropertyRNA *parm;
- RNA_def_property_srna(cprop, "MainMetaBall");
- srna= RNA_def_struct(brna, "MainMetaBall", NULL);
+ RNA_def_property_srna(cprop, "MainMetaBalls");
+ srna= RNA_def_struct(brna, "MainMetaBalls", NULL);
RNA_def_struct_ui_text(srna, "Main MetaBall", "Collection of metaballs");
func= RNA_def_function(srna, "new", "rna_Main_metaballs_new");
@@ -684,7 +781,27 @@ void RNA_def_main_metaballs(BlenderRNA *brna, PropertyRNA *cprop)
}
void RNA_def_main_fonts(BlenderRNA *brna, PropertyRNA *cprop)
{
+ StructRNA *srna;
+ FunctionRNA *func;
+ PropertyRNA *parm;
+ RNA_def_property_srna(cprop, "MainFonts");
+ srna= RNA_def_struct(brna, "MainFonts", NULL);
+ RNA_def_struct_ui_text(srna, "Main Fonts", "Collection of fonts");
+
+ func= RNA_def_function(srna, "load", "rna_Main_fonts_load");
+ RNA_def_function_ui_description(func, "Load a new font into the main database");
+ parm= RNA_def_string(func, "filename", "File Name", 0, "", "path of the font to load.");
+ RNA_def_property_flag(parm, PROP_REQUIRED);
+ /* return type */
+ parm= RNA_def_pointer(func, "vfont", "VectorFont", "", "New font datablock.");
+ RNA_def_function_return(func, parm);
+
+ func= RNA_def_function(srna, "remove", "rna_Main_fonts_remove");
+ RNA_def_function_flag(func, FUNC_USE_REPORTS);
+ RNA_def_function_ui_description(func, "Remove a font from the current blendfile.");
+ parm= RNA_def_pointer(func, "vfont", "VectorFont", "", "Font to remove.");
+ RNA_def_property_flag(parm, PROP_REQUIRED);
}
void RNA_def_main_textures(BlenderRNA *brna, PropertyRNA *cprop)
{
@@ -734,10 +851,32 @@ void RNA_def_main_brushes(BlenderRNA *brna, PropertyRNA *cprop)
parm= RNA_def_pointer(func, "brush", "Brush", "", "Brush to remove.");
RNA_def_property_flag(parm, PROP_REQUIRED);
}
+
void RNA_def_main_worlds(BlenderRNA *brna, PropertyRNA *cprop)
{
+ StructRNA *srna;
+ FunctionRNA *func;
+ PropertyRNA *parm;
+ RNA_def_property_srna(cprop, "MainWorlds");
+ srna= RNA_def_struct(brna, "MainWorlds", NULL);
+ RNA_def_struct_ui_text(srna, "Main Worlds", "Collection of worlds");
+
+ func= RNA_def_function(srna, "new", "rna_Main_worlds_new");
+ RNA_def_function_ui_description(func, "Add a new world to the main database");
+ parm= RNA_def_string(func, "name", "World", 0, "", "New name for the datablock.");
+ RNA_def_property_flag(parm, PROP_REQUIRED);
+ /* return type */
+ parm= RNA_def_pointer(func, "world", "World", "", "New world datablock.");
+ RNA_def_function_return(func, parm);
+
+ func= RNA_def_function(srna, "remove", "rna_Main_worlds_remove");
+ RNA_def_function_flag(func, FUNC_USE_REPORTS);
+ RNA_def_function_ui_description(func, "Remove a world from the current blendfile.");
+ parm= RNA_def_pointer(func, "world", "World", "", "World to remove.");
+ RNA_def_property_flag(parm, PROP_REQUIRED);
}
+
void RNA_def_main_groups(BlenderRNA *brna, PropertyRNA *cprop)
{
StructRNA *srna;
@@ -850,7 +989,27 @@ void RNA_def_main_actions(BlenderRNA *brna, PropertyRNA *cprop)
}
void RNA_def_main_particles(BlenderRNA *brna, PropertyRNA *cprop)
{
+ StructRNA *srna;
+ FunctionRNA *func;
+ PropertyRNA *parm;
+
+ RNA_def_property_srna(cprop, "MainParticles");
+ srna= RNA_def_struct(brna, "MainParticles", NULL);
+ RNA_def_struct_ui_text(srna, "Main Particle Settings", "Collection of particle settings");
+ func= RNA_def_function(srna, "new", "rna_Main_particles_new");
+ RNA_def_function_ui_description(func, "Add a new particle settings instance to the main database");
+ parm= RNA_def_string(func, "name", "ParticleSettings", 0, "", "New name for the datablock.");
+ RNA_def_property_flag(parm, PROP_REQUIRED);
+ /* return type */
+ parm= RNA_def_pointer(func, "particle", "ParticleSettings", "", "New particle settings datablock.");
+ RNA_def_function_return(func, parm);
+
+ func= RNA_def_function(srna, "remove", "rna_Main_particles_remove");
+ RNA_def_function_flag(func, FUNC_USE_REPORTS);
+ RNA_def_function_ui_description(func, "Remove a particle settings instance from the current blendfile.");
+ parm= RNA_def_pointer(func, "particle", "ParticleSettings", "", "Particle Settings to remove.");
+ RNA_def_property_flag(parm, PROP_REQUIRED);
}
void RNA_def_main_gpencil(BlenderRNA *brna, PropertyRNA *cprop)
{
diff --git a/source/blender/makesrna/intern/rna_material.c b/source/blender/makesrna/intern/rna_material.c
index f360fa7012d..1c790898ef2 100644
--- a/source/blender/makesrna/intern/rna_material.c
+++ b/source/blender/makesrna/intern/rna_material.c
@@ -870,7 +870,7 @@ static void rna_def_material_raymirror(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Gloss Threshold", "Threshold for adaptive sampling. If a sample contributes less than this amount (as a percentage), sampling is stopped");
RNA_def_property_update(prop, 0, "rna_Material_update");
- prop= RNA_def_property(srna, "depth", PROP_INT, PROP_NONE);
+ prop= RNA_def_property(srna, "depth", PROP_INT, PROP_UNSIGNED);
RNA_def_property_int_sdna(prop, NULL, "ray_depth");
RNA_def_property_range(prop, 0, 10);
RNA_def_property_ui_text(prop, "Depth", "Maximum allowed number of light inter-reflections");
@@ -935,7 +935,7 @@ static void rna_def_material_raytra(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Gloss Threshold", "Threshold for adaptive sampling. If a sample contributes less than this amount (as a percentage), sampling is stopped");
RNA_def_property_update(prop, 0, "rna_Material_update");
- prop= RNA_def_property(srna, "depth", PROP_INT, PROP_NONE);
+ prop= RNA_def_property(srna, "depth", PROP_INT, PROP_UNSIGNED);
RNA_def_property_int_sdna(prop, NULL, "ray_depth_tra");
RNA_def_property_range(prop, 0, 10);
RNA_def_property_ui_text(prop, "Depth", "Maximum allowed number of light inter-refractions");
diff --git a/source/blender/makesrna/intern/rna_modifier.c b/source/blender/makesrna/intern/rna_modifier.c
index ebf3f660dc3..d2bf791fb67 100644
--- a/source/blender/makesrna/intern/rna_modifier.c
+++ b/source/blender/makesrna/intern/rna_modifier.c
@@ -55,8 +55,8 @@ EnumPropertyItem modifier_type_items[] ={
{eModifierType_EdgeSplit, "EDGE_SPLIT", ICON_MOD_EDGESPLIT, "Edge Split", ""},
{eModifierType_Mask, "MASK", ICON_MOD_MASK, "Mask", ""},
{eModifierType_Mirror, "MIRROR", ICON_MOD_MIRROR, "Mirror", ""},
- {eModifierType_Screw, "SCREW", ICON_MOD_SCREW, "Screw", ""},
{eModifierType_Multires, "MULTIRES", ICON_MOD_MULTIRES, "Multiresolution", ""},
+ {eModifierType_Screw, "SCREW", ICON_MOD_SCREW, "Screw", ""},
{eModifierType_Solidify, "SOLIDIFY", ICON_MOD_SOLIDIFY, "Solidify", ""},
{eModifierType_Subsurf, "SUBSURF", ICON_MOD_SUBSURF, "Subdivision Surface", ""},
{eModifierType_UVProject, "UV_PROJECT", ICON_MOD_UVPROJECT, "UV Project", ""},
diff --git a/source/blender/makesrna/intern/rna_object.c b/source/blender/makesrna/intern/rna_object.c
index 95f142d299d..93a133bf380 100644
--- a/source/blender/makesrna/intern/rna_object.c
+++ b/source/blender/makesrna/intern/rna_object.c
@@ -859,6 +859,17 @@ static void rna_Base_layer_set(PointerRNA *ptr, const int *values)
/* rna_Base_layer_update updates the objects layer */
}
+static void rna_GameObjectSettings_state_get(PointerRNA *ptr, int *values)
+{
+ Object *ob= (Object*)ptr->data;
+ int i;
+ int all_states = (ob->scaflag & OB_ALLSTATE?1:0);
+
+ memset(values, 0, sizeof(int)*OB_MAX_STATES);
+ for(i=0; i<OB_MAX_STATES; i++)
+ values[i] = (ob->state & (1<<i)) | all_states;
+}
+
static void rna_GameObjectSettings_state_set(PointerRNA *ptr, const int *values)
{
Object *ob= (Object*)ptr->data;
@@ -1257,7 +1268,7 @@ static void rna_def_object_game_settings(BlenderRNA *brna)
RNA_def_property_boolean_sdna(prop, NULL, "state", 1);
RNA_def_property_array(prop, OB_MAX_STATES);
RNA_def_property_ui_text(prop, "State", "State determining which controllers are displayed");
- RNA_def_property_boolean_funcs(prop, NULL, "rna_GameObjectSettings_state_set");
+ RNA_def_property_boolean_funcs(prop, "rna_GameObjectSettings_state_get", "rna_GameObjectSettings_state_set");
prop= RNA_def_property(srna, "used_state", PROP_BOOLEAN, PROP_LAYER_MEMBER);
RNA_def_property_array(prop, OB_MAX_STATES);
diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c
index 90372dfb819..22cfb1c0a78 100644
--- a/source/blender/makesrna/intern/rna_scene.c
+++ b/source/blender/makesrna/intern/rna_scene.c
@@ -93,31 +93,38 @@ EnumPropertyItem snap_element_items[] = {
EnumPropertyItem image_type_items[] = {
{0, "", 0, "Image", NULL},
+ {R_BMP, "BMP", ICON_FILE_IMAGE, "BMP", ""},
+ //{R_DDS, "DDS", ICON_FILE_IMAGE, "DDS", ""}, // XXX not yet implemented
+ {R_IRIS, "IRIS", ICON_FILE_IMAGE, "Iris", ""},
{R_PNG, "PNG", ICON_FILE_IMAGE, "PNG", ""},
{R_JPEG90, "JPEG", ICON_FILE_IMAGE, "JPEG", ""},
#ifdef WITH_OPENJPEG
{R_JP2, "JPEG2000", ICON_FILE_IMAGE, "JPEG 2000", ""},
#endif
- {R_BMP, "BMP", ICON_FILE_IMAGE, "BMP", ""},
{R_TARGA, "TARGA", ICON_FILE_IMAGE, "Targa", ""},
{R_RAWTGA, "TARGA_RAW", ICON_FILE_IMAGE, "Targa Raw", ""},
- //{R_DDS, "DDS", ICON_FILE_IMAGE, "DDS", ""}, // XXX not yet implemented
- //{R_HAMX, "HAMX", ICON_FILE_IMAGE, "HamX", ""}, // should remove this format, 8bits are so 80's
- {R_IRIS, "IRIS", ICON_FILE_IMAGE, "Iris", ""},
{0, "", 0, " ", NULL},
+ {R_CINEON, "CINEON", ICON_FILE_IMAGE, "Cineon", ""},
+ {R_DPX, "DPX",ICON_FILE_IMAGE, "DPX", ""},
#ifdef WITH_OPENEXR
- {R_OPENEXR, "OPEN_EXR", ICON_FILE_IMAGE, "OpenEXR", ""},
{R_MULTILAYER, "MULTILAYER", ICON_FILE_IMAGE, "MultiLayer", ""},
+ {R_OPENEXR, "OPEN_EXR", ICON_FILE_IMAGE, "OpenEXR", ""},
#endif
- {R_TIFF, "TIFF", ICON_FILE_IMAGE, "TIFF", ""}, // XXX only with G.have_libtiff
{R_RADHDR, "HDR", ICON_FILE_IMAGE, "Radiance HDR", ""},
- {R_CINEON, "CINEON", ICON_FILE_IMAGE, "Cineon", ""},
- {R_DPX, "DPX", ICON_FILE_IMAGE, "DPX", ""},
+#ifdef WITH_TIFF
+ {R_TIFF, "TIFF", ICON_FILE_IMAGE, "TIFF", ""},
+#endif
{0, "", 0, "Movie", NULL},
- {R_AVIRAW, "AVI_RAW", ICON_FILE_MOVIE, "AVI Raw", ""},
- {R_AVIJPEG, "AVI_JPEG", ICON_FILE_MOVIE, "AVI JPEG", ""},
#ifdef _WIN32
- {R_AVICODEC, "AVICODEC", ICON_FILE_MOVIE, "AVI Codec", ""},
+ {R_AVICODEC, "AVICODEC", ICON_FILE_MOVIE, "AVI Codec", ""}, // XXX Missing codec menu
+#endif
+ {R_AVIJPEG, "AVI_JPEG", ICON_FILE_MOVIE, "AVI JPEG", ""},
+ {R_AVIRAW, "AVI_RAW", ICON_FILE_MOVIE, "AVI Raw", ""},
+ {R_FRAMESERVER, "FRAMESERVER", ICON_FILE_SCRIPT, "Frame Server", ""},
+#ifdef WITH_FFMPEG
+ {R_H264, "H264", ICON_FILE_MOVIE, "H.264", ""},
+ {R_FFMPEG, "FFMPEG", ICON_FILE_MOVIE, "MPEG", ""},
+ {R_THEORA, "THEORA", ICON_FILE_MOVIE, "Ogg Theora", ""},
#endif
#ifdef WITH_QUICKTIME
# ifdef USE_QTKIT
@@ -126,16 +133,9 @@ EnumPropertyItem image_type_items[] = {
{R_QUICKTIME, "QUICKTIME_CARBON", ICON_FILE_MOVIE, "QuickTime", ""},
# endif
#endif
-#ifdef __sgi
- {R_MOVIE, "MOVIE", ICON_FILE_MOVIE, "Movie", ""},
-#endif
#ifdef WITH_FFMPEG
- {R_H264, "H264", ICON_FILE_MOVIE, "H.264", ""},
{R_XVID, "XVID", ICON_FILE_MOVIE, "Xvid", ""},
- {R_THEORA, "THEORA", ICON_FILE_MOVIE, "Ogg Theora", ""},
- {R_FFMPEG, "FFMPEG", ICON_FILE_MOVIE, "MPEG", ""},
#endif
- {R_FRAMESERVER, "FRAMESERVER", ICON_FILE_SCRIPT, "Frame Server", ""},
{0, NULL, 0, NULL, NULL}};
#ifdef RNA_RUNTIME
@@ -376,16 +376,24 @@ static void rna_Scene_active_keying_set_set(PointerRNA *ptr, PointerRNA value)
scene->active_keyingset= ANIM_scene_get_keyingset_index(scene, ks);
}
-#if 0 // XXX: these need to be fixed up first...
-static void rna_Scene_active_keying_set_index_range(PointerRNA *ptr, int *min, int *max)
+/* get KeyingSet index stuff for list of Keying Sets editing UI
+ * - active_keyingset-1 since 0 is reserved for 'none'
+ * - don't clamp, otherwise can never set builtins types as active...
+ */
+static int rna_Scene_active_keying_set_index_get(PointerRNA *ptr)
{
- Scene *scene= (Scene *)ptr->data;
-
- // FIXME: would need access to builtin keyingsets list to count min...
- *min= 0;
- *max= 0;
+ Scene *scene= (Scene *)ptr->data;
+ return scene->active_keyingset-1;
+}
+
+/* get KeyingSet index stuff for list of Keying Sets editing UI
+ * - value+1 since 0 is reserved for 'none'=
+ */
+static void rna_Scene_active_keying_set_index_set(PointerRNA *ptr, int value)
+{
+ Scene *scene= (Scene *)ptr->data;
+ scene->active_keyingset= value+1;
}
-#endif
// XXX: evil... builtin_keyingsets is defined in keyingsets.c!
// TODO: make API function to retrieve this...
@@ -1582,7 +1590,7 @@ static void rna_def_scene_game_data(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Resolution Y", "Number of vertical pixels in the screen");
RNA_def_property_update(prop, NC_SCENE, NULL);
- prop= RNA_def_property(srna, "depth", PROP_INT, PROP_NONE);
+ prop= RNA_def_property(srna, "depth", PROP_INT, PROP_UNSIGNED);
RNA_def_property_int_sdna(prop, NULL, "depth");
RNA_def_property_range(prop, 8, 32);
RNA_def_property_ui_text(prop, "Bits", "Displays bit depth of full screen display");
@@ -2376,7 +2384,7 @@ static void rna_def_scene_render_data(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Use Local Coords", "Vertex coordinates are stored localy on each primitive. Increases memory usage, but may have impact on speed");
RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL);
- prop= RNA_def_property(srna, "antialiasing", PROP_BOOLEAN, PROP_NONE);
+ prop= RNA_def_property(srna, "render_antialiasing", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "mode", R_OSA);
RNA_def_property_ui_text(prop, "Anti-Aliasing", "Render and combine multiple samples per pixel to prevent jagged edges");
RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL);
@@ -2403,34 +2411,35 @@ static void rna_def_scene_render_data(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Fields Still", "Disable the time difference between fields");
RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL);
- prop= RNA_def_property(srna, "render_shadows", PROP_BOOLEAN, PROP_NONE);
+ /* rendering features */
+ prop= RNA_def_property(srna, "use_shadows", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "mode", R_SHADOW);
- RNA_def_property_ui_text(prop, "Render Shadows", "Calculate shadows while rendering");
+ RNA_def_property_ui_text(prop, "Shadows", "Calculate shadows while rendering");
RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL);
- prop= RNA_def_property(srna, "render_envmaps", PROP_BOOLEAN, PROP_NONE);
+ prop= RNA_def_property(srna, "use_envmaps", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "mode", R_ENVMAP);
- RNA_def_property_ui_text(prop, "Render Environment Maps", "Calculate environment maps while rendering");
+ RNA_def_property_ui_text(prop, "Environment Maps", "Calculate environment maps while rendering");
RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL);
- prop= RNA_def_property(srna, "render_radiosity", PROP_BOOLEAN, PROP_NONE);
+ prop= RNA_def_property(srna, "use_radiosity", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "mode", R_RADIO);
- RNA_def_property_ui_text(prop, "Render Radiosity", "Calculate radiosity in a pre-process before rendering");
+ RNA_def_property_ui_text(prop, "Radiosity", "Calculate radiosity in a pre-process before rendering");
RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL);
- prop= RNA_def_property(srna, "render_sss", PROP_BOOLEAN, PROP_NONE);
+ prop= RNA_def_property(srna, "use_sss", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "mode", R_SSS);
- RNA_def_property_ui_text(prop, "Render SSS", "Calculate sub-surface scattering in materials rendering");
+ RNA_def_property_ui_text(prop, "Subsurface Scattering", "Calculate sub-surface scattering in materials rendering");
RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL);
- prop= RNA_def_property(srna, "render_raytracing", PROP_BOOLEAN, PROP_NONE);
+ prop= RNA_def_property(srna, "use_raytracing", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "mode", R_RAYTRACE);
- RNA_def_property_ui_text(prop, "Render Raytracing", "Pre-calculate the raytrace accelerator and render raytracing effects");
+ RNA_def_property_ui_text(prop, "Raytracing", "Pre-calculate the raytrace accelerator and render raytracing effects");
RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL);
- prop= RNA_def_property(srna, "render_textures", PROP_BOOLEAN, PROP_NONE);
+ prop= RNA_def_property(srna, "use_textures", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_negative_sdna(prop, NULL, "scemode", R_NO_TEX);
- RNA_def_property_ui_text(prop, "Render Textures", "Use textures to affect material properties");
+ RNA_def_property_ui_text(prop, "Textures", "Use textures to affect material properties");
RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL);
prop= RNA_def_property(srna, "edge", PROP_BOOLEAN, PROP_NONE);
@@ -2797,7 +2806,7 @@ static void rna_def_scene_render_data(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Use Simplify", "Enable simplification of scene for quicker preview renders");
RNA_def_property_update(prop, 0, "rna_Scene_simplify_update");
- prop= RNA_def_property(srna, "simplify_subdivision", PROP_INT, PROP_NONE);
+ prop= RNA_def_property(srna, "simplify_subdivision", PROP_INT, PROP_UNSIGNED);
RNA_def_property_int_sdna(prop, NULL, "simplify_subsurf");
RNA_def_property_ui_range(prop, 0, 6, 1, 0);
RNA_def_property_ui_text(prop, "Simplify Subdivision", "Global maximum subdivision level");
@@ -3116,7 +3125,7 @@ void RNA_def_scene(BlenderRNA *brna)
prop= RNA_def_property(srna, "active_keying_set_index", PROP_INT, PROP_NONE);
RNA_def_property_int_sdna(prop, NULL, "active_keyingset");
- //RNA_def_property_int_funcs(prop, NULL, NULL, "rna_Scene_active_keying_set_index_range"); // XXX
+ RNA_def_property_int_funcs(prop, "rna_Scene_active_keying_set_index_get", "rna_Scene_active_keying_set_index_set", NULL);
RNA_def_property_ui_text(prop, "Active Keying Set Index", "Current Keying Set index (negative for 'builtin' and positive for 'absolute')");
RNA_def_property_update(prop, NC_SCENE|ND_KEYINGSET, NULL);
diff --git a/source/blender/makesrna/intern/rna_sensor.c b/source/blender/makesrna/intern/rna_sensor.c
index ff0f6ab7b30..85fcba286dd 100644
--- a/source/blender/makesrna/intern/rna_sensor.c
+++ b/source/blender/makesrna/intern/rna_sensor.c
@@ -128,11 +128,9 @@ EnumPropertyItem *rna_Sensor_type_itemf(bContext *C, PointerRNA *ptr, int *free)
if (ob != NULL) {
if (ob->type==OB_ARMATURE) {
RNA_enum_items_add_value(&item, &totitem, sensor_type_items, SENS_ARMATURE);
- } else if(ob->type==OB_MESH) {
- RNA_enum_items_add_value(&item, &totitem, sensor_type_items, SENS_COLLISION);
}
}
-
+ RNA_enum_items_add_value(&item, &totitem, sensor_type_items, SENS_COLLISION);
RNA_enum_items_add_value(&item, &totitem, sensor_type_items, SENS_DELAY);
RNA_enum_items_add_value(&item, &totitem, sensor_type_items, SENS_JOYSTICK);
RNA_enum_items_add_value(&item, &totitem, sensor_type_items, SENS_KEYBOARD);
@@ -143,12 +141,7 @@ EnumPropertyItem *rna_Sensor_type_itemf(bContext *C, PointerRNA *ptr, int *free)
RNA_enum_items_add_value(&item, &totitem, sensor_type_items, SENS_RADAR);
RNA_enum_items_add_value(&item, &totitem, sensor_type_items, SENS_RANDOM);
RNA_enum_items_add_value(&item, &totitem, sensor_type_items, SENS_RAY);
-
- if (ob != NULL) {
- if(ob->type==OB_MESH) {
- RNA_enum_items_add_value(&item, &totitem, sensor_type_items, SENS_TOUCH);
- }
- }
+ RNA_enum_items_add_value(&item, &totitem, sensor_type_items, SENS_TOUCH);
RNA_enum_item_end(&item, &totitem);
*free= 1;
diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c
index 7ba56d77801..500ea6ee429 100644
--- a/source/blender/makesrna/intern/rna_space.c
+++ b/source/blender/makesrna/intern/rna_space.c
@@ -338,6 +338,18 @@ static void rna_RegionView3D_quadview_update(Main *main, Scene *scene, PointerRN
ED_view3d_quadview_update(sa, ar);
}
+static void rna_RegionView3D_view_location_get(PointerRNA *ptr, float *values)
+{
+ RegionView3D *rv3d= (RegionView3D *)(ptr->data);
+ negate_v3_v3(values, rv3d->ofs);
+}
+
+static void rna_RegionView3D_view_location_set(PointerRNA *ptr, const float *values)
+{
+ RegionView3D *rv3d= (RegionView3D *)(ptr->data);
+ negate_v3_v3(rv3d->ofs, values);
+}
+
/* Space Image Editor */
static PointerRNA rna_SpaceImageEditor_uvedit_get(PointerRNA *ptr)
@@ -509,6 +521,28 @@ static StructRNA *rna_SpaceProperties_pin_id_typef(PointerRNA *ptr)
return &RNA_ID;
}
+static void rna_SpaceProperties_pin_id_update(Main *bmain, Scene *scene, PointerRNA *ptr)
+{
+ SpaceButs *sbuts= (SpaceButs*)(ptr->data);
+ ID *id = sbuts->pinid;
+
+ switch (GS(id->name)) {
+ case ID_MA:
+ WM_main_add_notifier(NC_MATERIAL|ND_SHADING, NULL);
+ break;
+ case ID_TE:
+ WM_main_add_notifier(NC_TEXTURE, NULL);
+ break;
+ case ID_WO:
+ WM_main_add_notifier(NC_WORLD, NULL);
+ break;
+ case ID_LA:
+ WM_main_add_notifier(NC_LAMP, NULL);
+ break;
+ }
+}
+
+
static void rna_SpaceProperties_align_set(PointerRNA *ptr, int value)
{
SpaceButs *sbuts= (SpaceButs*)(ptr->data);
@@ -899,7 +933,13 @@ static void rna_def_space_view3d(BlenderRNA *brna)
{V3D_CENTROID, "MEDIAN_POINT", ICON_ROTATECENTER, "Median Point", ""},
{V3D_ACTIVE, "ACTIVE_ELEMENT", ICON_ROTACTIVE, "Active Element", ""},
{0, NULL, 0, NULL, NULL}};
-
+
+ static EnumPropertyItem rv3d_persp_items[] = {
+ {RV3D_PERSP, "PERSP", 0, "Perspective", ""},
+ {RV3D_ORTHO, "ORTHO", 0, "Orthographic", ""},
+ {RV3D_CAMOB, "CAMERA", 0, "Camera", ""},
+ {0, NULL, 0, NULL, NULL}};
+
srna= RNA_def_struct(brna, "SpaceView3D", "Space");
RNA_def_struct_sdna(srna, "View3D");
RNA_def_struct_ui_text(srna, "3D View Space", "3D View space data");
@@ -1146,6 +1186,34 @@ static void rna_def_space_view3d(BlenderRNA *brna)
RNA_def_property_clear_flag(prop, PROP_EDITABLE); // XXX: for now, it's too risky for users to do this
RNA_def_property_multi_array(prop, 2, matrix_dimsize);
RNA_def_property_ui_text(prop, "View Matrix", "Current view matrix of the 3D region");
+
+ prop= RNA_def_property(srna, "view_perspective", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "persp");
+ RNA_def_property_enum_items(prop, rv3d_persp_items);
+ RNA_def_property_ui_text(prop, "Perspective", "View Perspective");
+ RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL);
+
+ prop= RNA_def_property(srna, "view_location", PROP_FLOAT, PROP_TRANSLATION);
+#if 0
+ RNA_def_property_float_sdna(prop, NULL, "ofs"); // cant use because its negated
+#else
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_float_funcs(prop, "rna_RegionView3D_view_location_get", "rna_RegionView3D_view_location_set", NULL);
+#endif
+ RNA_def_property_ui_text(prop, "View Location", "View pivot location");
+ RNA_def_property_ui_range(prop, -10000.0, 10000.0, 10, 4);
+ RNA_def_property_update(prop, NC_WINDOW, NULL);
+
+ prop= RNA_def_property(srna, "view_rotation", PROP_FLOAT, PROP_QUATERNION);
+ RNA_def_property_float_sdna(prop, NULL, "viewquat");
+ RNA_def_property_ui_text(prop, "View Rotation", "Rotation in quaternions (keep normalized)");
+ RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL);
+
+ /* not sure we need rna access to these but adding anyway */
+ prop= RNA_def_property(srna, "view_distance", PROP_FLOAT, PROP_UNSIGNED);
+ RNA_def_property_float_sdna(prop, NULL, "dist");
+ RNA_def_property_ui_text(prop, "Distance", "Distance to the view location");
+ RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL);
}
static void rna_def_space_buttons(BlenderRNA *brna)
@@ -1203,7 +1271,7 @@ static void rna_def_space_buttons(BlenderRNA *brna)
/* note: custom set function is ONLY to avoid rna setting a user for this. */
RNA_def_property_pointer_funcs(prop, NULL, "rna_SpaceProperties_pin_id_set", "rna_SpaceProperties_pin_id_typef");
RNA_def_property_flag(prop, PROP_EDITABLE);
- RNA_def_property_update(prop, NC_SPACE|ND_SPACE_PROPERTIES, NULL);
+ RNA_def_property_update(prop, NC_SPACE|ND_SPACE_PROPERTIES, "rna_SpaceProperties_pin_id_update");
prop= RNA_def_property(srna, "use_pin_id", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", SB_PIN_CONTEXT);
diff --git a/source/blender/makesrna/intern/rna_texture.c b/source/blender/makesrna/intern/rna_texture.c
index b2d613f83bf..5e58403e41b 100644
--- a/source/blender/makesrna/intern/rna_texture.c
+++ b/source/blender/makesrna/intern/rna_texture.c
@@ -620,13 +620,13 @@ static void rna_def_environment_map(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Ignore Layers", "Hide objects on these layers when generating the Environment Map");
RNA_def_property_update(prop, 0, "rna_Texture_update");
- prop= RNA_def_property(srna, "resolution", PROP_INT, PROP_NONE);
+ prop= RNA_def_property(srna, "resolution", PROP_INT, PROP_UNSIGNED);
RNA_def_property_int_sdna(prop, NULL, "cuberes");
RNA_def_property_range(prop, 50, 4096);
RNA_def_property_ui_text(prop, "Resolution", "Pixel resolution of the rendered environment map");
RNA_def_property_update(prop, 0, "rna_Texture_update");
- prop= RNA_def_property(srna, "depth", PROP_INT, PROP_NONE);
+ prop= RNA_def_property(srna, "depth", PROP_INT, PROP_UNSIGNED);
RNA_def_property_range(prop, 0, 5);
RNA_def_property_ui_text(prop, "Depth", "Number of times a map will be rendered recursively (mirror effects.)");
RNA_def_property_update(prop, 0, "rna_Texture_update");
diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c
index aa152fbf2b0..e19efd745d8 100644
--- a/source/blender/makesrna/intern/rna_userdef.c
+++ b/source/blender/makesrna/intern/rna_userdef.c
@@ -2052,6 +2052,13 @@ static void rna_def_userdef_view(BlenderRNA *brna)
RNA_def_property_enum_funcs(prop, NULL, "rna_userdef_timecode_style_set", NULL);
RNA_def_property_ui_text(prop, "TimeCode Style", "Format of Time Codes displayed when not displaying timing in terms of frames");
RNA_def_property_update(prop, 0, "rna_userdef_update");
+
+ /* Properties Window */
+ prop= RNA_def_property(srna, "properties_width_check", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "propwidth");
+ RNA_def_property_range(prop, 150, 400);
+ RNA_def_property_ui_text(prop, "Width Check", "Dual Column layout will change to single column layout when the width of the area gets below this value (needs restart to take effect)");
+ RNA_def_property_update(prop, 0, "rna_userdef_update");
}
static void rna_def_userdef_edit(BlenderRNA *brna)
diff --git a/source/blender/makesrna/intern/rna_world.c b/source/blender/makesrna/intern/rna_world.c
index 3b0f53df43b..8d5e2291724 100644
--- a/source/blender/makesrna/intern/rna_world.c
+++ b/source/blender/makesrna/intern/rna_world.c
@@ -362,9 +362,9 @@ static void rna_def_world_mist(BlenderRNA *brna)
RNA_def_struct_nested(brna, srna, "World");
RNA_def_struct_ui_text(srna, "World Mist", "Mist settings for a World data-block");
- prop= RNA_def_property(srna, "enabled", PROP_BOOLEAN, PROP_NONE);
+ prop= RNA_def_property(srna, "use_mist", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "mode", WO_MIST);
- RNA_def_property_ui_text(prop, "Enabled", "Occlude objects with the environment color as they are further away");
+ RNA_def_property_ui_text(prop, "Use Mist", "Occlude objects with the environment color as they are further away");
RNA_def_property_update(prop, 0, "rna_World_draw_update");
prop= RNA_def_property(srna, "intensity", PROP_FLOAT, PROP_NONE);
@@ -410,9 +410,9 @@ static void rna_def_world_stars(BlenderRNA *brna)
RNA_def_struct_nested(brna, srna, "World");
RNA_def_struct_ui_text(srna, "World Stars", "Stars setting for a World data-block");
- prop= RNA_def_property(srna, "enabled", PROP_BOOLEAN, PROP_NONE);
+ prop= RNA_def_property(srna, "use_stars", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "mode", WO_STARS);
- RNA_def_property_ui_text(prop, "Enabled", "Enable starfield generation");
+ RNA_def_property_ui_text(prop, "Use Stars", "Enable starfield generation");
RNA_def_property_update(prop, 0, "rna_World_draw_update");
prop= RNA_def_property(srna, "size", PROP_FLOAT, PROP_NONE);
diff --git a/source/blender/python/doc/sphinx_doc_gen.py b/source/blender/python/doc/sphinx_doc_gen.py
index 5de7ea0652d..69aa68acdc9 100644
--- a/source/blender/python/doc/sphinx_doc_gen.py
+++ b/source/blender/python/doc/sphinx_doc_gen.py
@@ -331,6 +331,11 @@ def rna2sphinx(BASEPATH):
fw(" * user interface functions for defining buttons, creation of menus, headers, panels\n")
fw(" * modules: bgl, mathutils and geometry\n")
fw("\n")
+
+ fw("===================\n")
+ fw("Application Modules\n")
+ fw("===================\n")
+ fw("\n")
fw(".. toctree::\n")
fw(" :maxdepth: 1\n\n")
fw(" bpy.ops.rst\n\n")
@@ -342,10 +347,31 @@ def rna2sphinx(BASEPATH):
# C modules
fw(" bpy.props.rst\n\n")
-
+
+ fw("==================\n")
+ fw("Standalone Modules\n")
+ fw("==================\n")
+ fw("\n")
+ fw(".. toctree::\n")
+ fw(" :maxdepth: 1\n\n")
+
+
fw(" mathutils.rst\n\n")
fw(" Freestyle.rst\n\n")
fw(" blf.rst\n\n")
+
+ # game engine
+ fw("===================\n")
+ fw("Game Engine Modules\n")
+ fw("===================\n")
+ fw("\n")
+ fw(".. toctree::\n")
+ fw(" :maxdepth: 1\n\n")
+ fw(" bge.types.rst\n\n")
+ fw(" bge.logic.rst\n\n")
+ fw(" bge.render.rst\n\n")
+ fw(" bge.events.rst\n\n")
+
file.close()
@@ -371,7 +397,6 @@ def rna2sphinx(BASEPATH):
file.close()
-
# python modules
from bpy import utils as module
pymodule2sphinx(BASEPATH, "bpy.utils", module, "Utilities (bpy.utils)")
@@ -395,6 +420,15 @@ def rna2sphinx(BASEPATH):
pymodule2sphinx(BASEPATH, "blf", module, "Blender Font Drawing (blf)")
del module
+ # game engine
+ import shutil
+ # copy2 keeps time/date stamps
+ shutil.copy2(os.path.join(BASEPATH, "../../../../gameengine/PyDoc/bge.types.rst"), BASEPATH)
+ shutil.copy2(os.path.join(BASEPATH, "../../../../gameengine/PyDoc/bge.logic.rst"), BASEPATH)
+ shutil.copy2(os.path.join(BASEPATH, "../../../../gameengine/PyDoc/bge.render.rst"), BASEPATH)
+ shutil.copy2(os.path.join(BASEPATH, "../../../../gameengine/PyDoc/bge.events.rst"), BASEPATH)
+
+
if 0:
filepath = os.path.join(BASEPATH, "bpy.rst")
file = open(filepath, "w")
diff --git a/source/blender/python/generic/bgl.c b/source/blender/python/generic/bgl.c
index 63c518c8721..806b5a5b3ce 100644
--- a/source/blender/python/generic/bgl.c
+++ b/source/blender/python/generic/bgl.c
@@ -64,13 +64,16 @@ static int Buffer_ass_slice( PyObject * self, int begin, int end,
PyObject * seq );
static PySequenceMethods Buffer_SeqMethods = {
- ( lenfunc ) Buffer_len, /*sq_length */
- ( binaryfunc ) 0, /*sq_concat */
- ( ssizeargfunc ) 0, /*sq_repeat */
- ( ssizeargfunc ) Buffer_item, /*sq_item */
- ( ssizessizeargfunc ) Buffer_slice, /*sq_slice */
- ( ssizeobjargproc ) Buffer_ass_item, /*sq_ass_item */
- ( ssizessizeobjargproc ) Buffer_ass_slice, /*sq_ass_slice */
+ ( lenfunc ) Buffer_len, /*sq_length */
+ ( binaryfunc ) NULL, /*sq_concat */
+ ( ssizeargfunc ) NULL, /*sq_repeat */
+ ( ssizeargfunc ) Buffer_item, /*sq_item */
+ ( ssizessizeargfunc ) Buffer_slice, /*sq_slice, deprecated TODO, replace */
+ ( ssizeobjargproc ) Buffer_ass_item, /*sq_ass_item */
+ ( ssizessizeobjargproc ) Buffer_ass_slice, /*sq_ass_slice, deprecated TODO, replace */
+ (objobjproc) NULL, /* sq_contains */
+ (binaryfunc) NULL, /* sq_inplace_concat */
+ (ssizeargfunc) NULL, /* sq_inplace_repeat */
};
static void Buffer_dealloc( PyObject * self );
diff --git a/source/blender/python/generic/blf_api.c b/source/blender/python/generic/blf_api.c
index a16481d760c..67f07ad8378 100644
--- a/source/blender/python/generic/blf_api.c
+++ b/source/blender/python/generic/blf_api.c
@@ -290,7 +290,9 @@ static char py_blf_shadow_doc[] =
" :arg g: Shadow color (green channel 0.0 - 1.0).\n"
" :type g: float\n"
" :arg b: Shadow color (blue channel 0.0 - 1.0).\n"
-" :type b: float\n";
+" :type b: float\n"
+" :arg a: Shadow color (alpha channel 0.0 - 1.0).\n"
+" :type a: float\n";
static PyObject *py_blf_shadow(PyObject *self, PyObject *args)
{
@@ -340,7 +342,7 @@ static char py_blf_load_doc[] =
" Load a new font.\n"
"\n"
" :arg filename: the filename of the font.\n"
-" :type text: string\n"
+" :type filename: string\n"
" :return: the new font's fontid or -1 if there was an error.\n"
" :rtype: integer\n";
diff --git a/source/blender/python/generic/mathutils_color.c b/source/blender/python/generic/mathutils_color.c
index 34c8dd88b4b..5acd03060d4 100644
--- a/source/blender/python/generic/mathutils_color.c
+++ b/source/blender/python/generic/mathutils_color.c
@@ -326,12 +326,15 @@ static int Color_ass_subscript(ColorObject *self, PyObject *item, PyObject *valu
//-----------------PROTCOL DECLARATIONS--------------------------
static PySequenceMethods Color_SeqMethods = {
(lenfunc) Color_len, /* sq_length */
- (binaryfunc) 0, /* sq_concat */
- (ssizeargfunc) 0, /* sq_repeat */
+ (binaryfunc) NULL, /* sq_concat */
+ (ssizeargfunc) NULL, /* sq_repeat */
(ssizeargfunc) Color_item, /* sq_item */
(ssizessizeargfunc) NULL, /* sq_slice, deprecated */
(ssizeobjargproc) Color_ass_item, /* sq_ass_item */
(ssizessizeobjargproc) NULL, /* sq_ass_slice, deprecated */
+ (objobjproc) NULL, /* sq_contains */
+ (binaryfunc) NULL, /* sq_inplace_concat */
+ (ssizeargfunc) NULL, /* sq_inplace_repeat */
};
static PyMappingMethods Color_AsMapping = {
diff --git a/source/blender/python/generic/mathutils_euler.c b/source/blender/python/generic/mathutils_euler.c
index 3bda1b3a991..aac65043a0a 100644
--- a/source/blender/python/generic/mathutils_euler.c
+++ b/source/blender/python/generic/mathutils_euler.c
@@ -557,12 +557,15 @@ static int Euler_ass_subscript(EulerObject *self, PyObject *item, PyObject *valu
//-----------------PROTCOL DECLARATIONS--------------------------
static PySequenceMethods Euler_SeqMethods = {
(lenfunc) Euler_len, /* sq_length */
- (binaryfunc) 0, /* sq_concat */
- (ssizeargfunc) 0, /* sq_repeat */
+ (binaryfunc) NULL, /* sq_concat */
+ (ssizeargfunc) NULL, /* sq_repeat */
(ssizeargfunc) Euler_item, /* sq_item */
(ssizessizeargfunc) NULL, /* sq_slice, deprecated */
(ssizeobjargproc) Euler_ass_item, /* sq_ass_item */
(ssizessizeobjargproc) NULL, /* sq_ass_slice, deprecated */
+ (objobjproc) NULL, /* sq_contains */
+ (binaryfunc) NULL, /* sq_inplace_concat */
+ (ssizeargfunc) NULL, /* sq_inplace_repeat */
};
static PyMappingMethods Euler_AsMapping = {
diff --git a/source/blender/python/generic/mathutils_matrix.c b/source/blender/python/generic/mathutils_matrix.c
index 8bb46d8c966..a211386f503 100644
--- a/source/blender/python/generic/mathutils_matrix.c
+++ b/source/blender/python/generic/mathutils_matrix.c
@@ -1126,13 +1126,16 @@ static PyObject* Matrix_inv(MatrixObject *self)
/*-----------------PROTOCOL DECLARATIONS--------------------------*/
static PySequenceMethods Matrix_SeqMethods = {
- (lenfunc) Matrix_len, /* sq_length */
- (binaryfunc) 0, /* sq_concat */
- (ssizeargfunc) 0, /* sq_repeat */
- (ssizeargfunc) Matrix_item, /* sq_item */
- (ssizessizeargfunc) Matrix_slice, /* sq_slice */
- (ssizeobjargproc) Matrix_ass_item, /* sq_ass_item */
- (ssizessizeobjargproc) Matrix_ass_slice, /* sq_ass_slice */
+ (lenfunc) Matrix_len, /* sq_length */
+ (binaryfunc) NULL, /* sq_concat */
+ (ssizeargfunc) NULL, /* sq_repeat */
+ (ssizeargfunc) Matrix_item, /* sq_item */
+ (ssizessizeargfunc) Matrix_slice, /* sq_slice, deprecated TODO, replace */
+ (ssizeobjargproc) Matrix_ass_item, /* sq_ass_item */
+ (ssizessizeobjargproc) Matrix_ass_slice, /* sq_ass_slice, deprecated TODO, replace */
+ (objobjproc) NULL, /* sq_contains */
+ (binaryfunc) NULL, /* sq_inplace_concat */
+ (ssizeargfunc) NULL, /* sq_inplace_repeat */
};
diff --git a/source/blender/python/generic/mathutils_quat.c b/source/blender/python/generic/mathutils_quat.c
index c39e6ee5587..f94e5e2a03a 100644
--- a/source/blender/python/generic/mathutils_quat.c
+++ b/source/blender/python/generic/mathutils_quat.c
@@ -707,13 +707,16 @@ static PyObject *Quaternion_mul(PyObject * q1, PyObject * q2)
//-----------------PROTOCOL DECLARATIONS--------------------------
static PySequenceMethods Quaternion_SeqMethods = {
- (lenfunc) Quaternion_len, /* sq_length */
- (binaryfunc) 0, /* sq_concat */
- (ssizeargfunc) 0, /* sq_repeat */
- (ssizeargfunc) Quaternion_item, /* sq_item */
- (ssizessizeargfunc) NULL, /* sq_slice, deprecated */
- (ssizeobjargproc) Quaternion_ass_item, /* sq_ass_item */
- (ssizessizeobjargproc) NULL, /* sq_ass_slice, deprecated */
+ (lenfunc) Quaternion_len, /* sq_length */
+ (binaryfunc) NULL, /* sq_concat */
+ (ssizeargfunc) NULL, /* sq_repeat */
+ (ssizeargfunc) Quaternion_item, /* sq_item */
+ (ssizessizeargfunc) NULL, /* sq_slice, deprecated */
+ (ssizeobjargproc) Quaternion_ass_item, /* sq_ass_item */
+ (ssizessizeobjargproc) NULL, /* sq_ass_slice, deprecated */
+ (objobjproc) NULL, /* sq_contains */
+ (binaryfunc) NULL, /* sq_inplace_concat */
+ (ssizeargfunc) NULL, /* sq_inplace_repeat */
};
static PyMappingMethods Quaternion_AsMapping = {
diff --git a/source/blender/python/generic/mathutils_vector.c b/source/blender/python/generic/mathutils_vector.c
index c9e151167de..af549762756 100644
--- a/source/blender/python/generic/mathutils_vector.c
+++ b/source/blender/python/generic/mathutils_vector.c
@@ -279,7 +279,7 @@ static char Vector_ToTrackQuat_doc[] =
" :type track: string\n"
" :arg up: Up axis in ['X', 'Y', 'Z'].\n"
" :type up: string\n"
-" :return: rotation from the vector and the track and up axis."
+" :return: rotation from the vector and the track and up axis.\n"
" :rtype: :class:`Quaternion`\n";
static PyObject *Vector_ToTrackQuat(VectorObject *self, PyObject *args )
@@ -1258,13 +1258,16 @@ static PyObject* Vector_richcmpr(PyObject *objectA, PyObject *objectB, int compa
/*-----------------PROTCOL DECLARATIONS--------------------------*/
static PySequenceMethods Vector_SeqMethods = {
- (lenfunc) Vector_len, /* sq_length */
- (binaryfunc) 0, /* sq_concat */
- (ssizeargfunc) 0, /* sq_repeat */
- (ssizeargfunc) Vector_item, /* sq_item */
- NULL, /* py3 deprecated slice func */
- (ssizeobjargproc) Vector_ass_item, /* sq_ass_item */
- NULL, /* py3 deprecated slice assign func */
+ (lenfunc) Vector_len, /* sq_length */
+ (binaryfunc) 0, /* sq_concat */
+ (ssizeargfunc) 0, /* sq_repeat */
+ (ssizeargfunc) Vector_item, /* sq_item */
+ NULL, /* py3 deprecated slice func */
+ (ssizeobjargproc) Vector_ass_item, /* sq_ass_item */
+ NULL, /* py3 deprecated slice assign func */
+ (objobjproc) NULL, /* sq_contains */
+ (binaryfunc) NULL, /* sq_inplace_concat */
+ (ssizeargfunc) NULL, /* sq_inplace_repeat */
};
static PyObject *Vector_subscript(VectorObject* self, PyObject* item)
diff --git a/source/blender/python/intern/bpy_app.c b/source/blender/python/intern/bpy_app.c
index 15c6ad09e69..4a2ac0c9252 100644
--- a/source/blender/python/intern/bpy_app.c
+++ b/source/blender/python/intern/bpy_app.c
@@ -46,6 +46,7 @@ static PyStructSequence_Field app_info_fields[] = {
{"home", "The blender home directory, normally matching $HOME"},
{"binary_path", "The location of blenders executable, useful for utilities that spawn new instances"},
{"debug", "Boolean, set when blender is running in debug mode (started with -d)"},
+ {"background", "Boolean, True when blender is running without a user interface (started with -b)"},
/* buildinfo */
{"build_date", "The date this blender instance was built"},
@@ -60,7 +61,7 @@ static PyStructSequence_Desc app_info_desc = {
"bpy.app", /* name */
"This module contains application values that remain unchanged during runtime.", /* doc */
app_info_fields, /* fields */
- 10
+ (sizeof(app_info_fields)/sizeof(PyStructSequence_Field)) - 1
};
static PyObject *make_app_info(void)
@@ -87,6 +88,7 @@ static PyObject *make_app_info(void)
SetStrItem(BLI_gethome());
SetStrItem(bprogname);
SetObjItem(PyBool_FromLong(G.f & G_DEBUG));
+ SetObjItem(PyBool_FromLong(G.background));
/* build info */
#ifdef BUILD_DATE
diff --git a/source/blender/python/intern/bpy_driver.c b/source/blender/python/intern/bpy_driver.c
index 5b1a8958247..afe6b63458f 100644
--- a/source/blender/python/intern/bpy_driver.c
+++ b/source/blender/python/intern/bpy_driver.c
@@ -109,7 +109,11 @@ static int bpy_pydriver_create_dict(void)
*/
void BPY_pydriver_update(void)
{
- PyGILState_STATE gilstate = PyGILState_Ensure();
+ PyGILState_STATE gilstate;
+ int use_gil= 1; // (PyThreadState_Get()==NULL);
+
+ if(use_gil)
+ gilstate = PyGILState_Ensure();
if (bpy_pydriver_Dict) { /* free the global dict used by pydrivers */
PyDict_Clear(bpy_pydriver_Dict);
@@ -117,7 +121,8 @@ void BPY_pydriver_update(void)
bpy_pydriver_Dict = NULL;
}
- PyGILState_Release(gilstate);
+ if(use_gil)
+ PyGILState_Release(gilstate);
return;
}
@@ -143,6 +148,10 @@ static float pydriver_error(ChannelDriver *driver)
/* This evals py driver expressions, 'expr' is a Python expression that
* should evaluate to a float number, which is returned.
+ *
+ * note: PyGILState_Ensure() isnt always called because python can call the
+ * bake operator which intern starts a thread which calls scene update which
+ * does a driver update. to avoid a deadlock check PyThreadState_Get() if PyGILState_Ensure() is needed.
*/
float BPY_pydriver_eval (ChannelDriver *driver)
{
@@ -151,6 +160,7 @@ float BPY_pydriver_eval (ChannelDriver *driver)
PyObject *expr_vars; /* speed up by pre-hashing string & avoids re-converting unicode strings for every execution */
PyObject *expr_code;
PyGILState_STATE gilstate;
+ int use_gil;
DriverVar *dvar;
double result = 0.0; /* default return */
@@ -168,13 +178,17 @@ float BPY_pydriver_eval (ChannelDriver *driver)
return 0.0f;
}
- gilstate = PyGILState_Ensure();
+ use_gil= 1; //(PyThreadState_Get()==NULL);
+
+ if(use_gil)
+ gilstate = PyGILState_Ensure();
/* init global dictionary for py-driver evaluation settings */
if (!bpy_pydriver_Dict) {
if (bpy_pydriver_create_dict() != 0) {
fprintf(stderr, "Pydriver error: couldn't create Python dictionary");
- PyGILState_Release(gilstate);
+ if(use_gil)
+ PyGILState_Release(gilstate);
return 0.0f;
}
}
@@ -269,7 +283,8 @@ float BPY_pydriver_eval (ChannelDriver *driver)
Py_DECREF(retval);
}
- PyGILState_Release(gilstate);
+ if(use_gil)
+ PyGILState_Release(gilstate);
if(finite(result)) {
return (float)result;
diff --git a/source/blender/python/intern/bpy_rna.c b/source/blender/python/intern/bpy_rna.c
index f047ca7341e..3aed5a8c7cc 100644
--- a/source/blender/python/intern/bpy_rna.c
+++ b/source/blender/python/intern/bpy_rna.c
@@ -1194,17 +1194,17 @@ static Py_ssize_t pyrna_prop_collection_length( BPy_PropertyRNA *self )
static PyObject *pyrna_prop_collection_subscript_int(BPy_PropertyRNA *self, Py_ssize_t keynum)
{
PointerRNA newptr;
- int len= RNA_property_collection_length(&self->ptr, self->prop);
+ int len= RNA_property_collection_length(&self->ptr, self->prop);
if(keynum < 0) keynum += len;
- if(keynum >= 0 && keynum < len) {
- if(RNA_property_collection_lookup_int(&self->ptr, self->prop, keynum, &newptr)) {
- return pyrna_struct_CreatePyObject(&newptr);
- }
- PyErr_Format(PyExc_IndexError, "bpy_prop_collection[index]: index %d could not be found", keynum);
- return NULL;
- }
+ if(keynum >= 0 && keynum < len) {
+ if(RNA_property_collection_lookup_int(&self->ptr, self->prop, keynum, &newptr)) {
+ return pyrna_struct_CreatePyObject(&newptr);
+ }
+ PyErr_Format(PyExc_IndexError, "bpy_prop_collection[index]: index %d could not be found", keynum);
+ return NULL;
+ }
PyErr_Format(PyExc_IndexError, "bpy_prop_collection[index]: index %d out of range", keynum);
return NULL;
}
@@ -1637,6 +1637,8 @@ static PySequenceMethods pyrna_prop_array_as_sequence = {
(ssizeobjargproc)prop_subscript_ass_array_int, /* sq_ass_item */
NULL, /* *was* sq_ass_slice */
(objobjproc)pyrna_prop_array_contains, /* sq_contains */
+ (binaryfunc) NULL, /* sq_inplace_concat */
+ (ssizeargfunc) NULL, /* sq_inplace_repeat */
};
static PySequenceMethods pyrna_prop_collection_as_sequence = {
@@ -1648,6 +1650,8 @@ static PySequenceMethods pyrna_prop_collection_as_sequence = {
NULL, /* sq_ass_item */
NULL, /* *was* sq_ass_slice */
(objobjproc)pyrna_prop_collection_contains, /* sq_contains */
+ (binaryfunc) NULL, /* sq_inplace_concat */
+ (ssizeargfunc) NULL, /* sq_inplace_repeat */
};
static PySequenceMethods pyrna_struct_as_sequence = {
@@ -1659,6 +1663,8 @@ static PySequenceMethods pyrna_struct_as_sequence = {
NULL, /* sq_ass_item */
NULL, /* *was* sq_ass_slice */
(objobjproc)pyrna_struct_contains, /* sq_contains */
+ (binaryfunc) NULL, /* sq_inplace_concat */
+ (ssizeargfunc) NULL, /* sq_inplace_repeat */
};
static PyObject *pyrna_struct_subscript( BPy_StructRNA *self, PyObject *key )
@@ -1886,7 +1892,7 @@ static PyObject *pyrna_struct_keyframe_insert(BPy_StructRNA *self, PyObject *arg
char *path_full= NULL;
int index= -1;
float cfra= FLT_MAX;
- char *group_name= NULL;
+ char *group_name= NULL;
if(pyrna_struct_keyframe_parse(&self->ptr, args, kw, "s|ifs:bpy_struct.keyframe_insert()", "bpy_struct.keyframe_insert()", &path_full, &index, &cfra, &group_name) == -1)
return NULL;
@@ -1920,7 +1926,7 @@ static PyObject *pyrna_struct_keyframe_delete(BPy_StructRNA *self, PyObject *arg
char *path_full= NULL;
int index= -1;
float cfra= FLT_MAX;
- char *group_name= NULL;
+ char *group_name= NULL;
if(pyrna_struct_keyframe_parse(&self->ptr, args, kw, "s|ifs:bpy_struct.keyframe_delete()", "bpy_struct.keyframe_insert()", &path_full, &index, &cfra, &group_name) == -1)
return NULL;
@@ -3550,7 +3556,7 @@ PyTypeObject pyrna_prop_Type = {
0, /* tp_itemsize */
/* methods */
NULL, /* tp_dealloc */
- NULL, /* printfunc tp_print; */
+ NULL, /* printfunc tp_print; */
NULL, /* getattrfunc tp_getattr; */
NULL, /* setattrfunc tp_setattr; */
NULL, /* tp_compare */ /* DEPRECATED in python 3.0! */
diff --git a/source/blender/render/intern/source/rendercore.c b/source/blender/render/intern/source/rendercore.c
index 047bbd7629f..760ce5636bb 100644
--- a/source/blender/render/intern/source/rendercore.c
+++ b/source/blender/render/intern/source/rendercore.c
@@ -2634,7 +2634,7 @@ int RE_bake_shade_all_selected(Render *re, int type, Object *actob, short *do_up
get_next_bake_face(NULL);
/* do we need a mask? */
- if (re->r.bake_filter && (re->r.bake_flag & R_BAKE_CLEAR)==0)
+ if (re->r.bake_filter)
usemask = 1;
/* baker uses this flag to detect if image was initialized */
diff --git a/source/creator/CMakeLists.txt b/source/creator/CMakeLists.txt
index fb84a4e3985..60627070ff8 100644
--- a/source/creator/CMakeLists.txt
+++ b/source/creator/CMakeLists.txt
@@ -62,6 +62,10 @@ IF(WITH_OPENEXR)
ADD_DEFINITIONS(-DWITH_OPENEXR)
ENDIF(WITH_OPENEXR)
+IF(WITH_TIFF)
+ ADD_DEFINITIONS(-DWITH_TIFF)
+ENDIF(WITH_TIFF)
+
IF(WITH_PYTHON)
INCLUDE_DIRECTORIES(../blender/python)
ELSE(WITH_PYTHON)
@@ -281,7 +285,6 @@ IF(WITH_INSTALL)
COMMAND copy /Y \"${WIN_LIBDIR}\\png\\lib\\libpng.dll\" \"${TARGETDIR}\\\"
COMMAND copy /Y \"${WIN_LIBDIR}\\sdl\\lib\\SDL.dll\" \"${TARGETDIR}\\\"
COMMAND copy /Y \"${WIN_LIBDIR}\\zlib\\lib\\zlib.dll\" \"${TARGETDIR}\\\"
- COMMAND copy /Y \"${WIN_LIBDIR}\\tiff\\lib\\libtiff.dll\" \"${TARGETDIR}\\\"
COMMAND copy /Y \"${WIN_LIBDIR}\\python\\lib\\python31.dll\" \"${TARGETDIR}\\\"
COMMAND copy /Y \"${WIN_LIBDIR}\\python\\lib\\python31_d.dll\" \"${TARGETDIR}\\\"
COMMAND copy /Y \"${WIN_LIBDIR}\\pthreads\\lib\\pthreadVC2.dll\" \"${TARGETDIR}\\\"
diff --git a/source/creator/Makefile b/source/creator/Makefile
index 592cf913dfa..34ebc5fa305 100644
--- a/source/creator/Makefile
+++ b/source/creator/Makefile
@@ -69,4 +69,8 @@ ifeq ($(WITH_BINRELOC), true)
CPPFLAGS += -I$(NANBLENDERHOME)/extern/binreloc/include -DWITH_BINRELOC
endif
+ifeq ($(WITH_TIFF), true)
+ CPPFLAGS += -DWITH_TIFF
+endif
+
CPPFLAGS += -I$(OPENGL_HEADERS)
diff --git a/source/creator/SConscript b/source/creator/SConscript
index 35c6ae40898..7f359b2f5a8 100644
--- a/source/creator/SConscript
+++ b/source/creator/SConscript
@@ -23,6 +23,9 @@ if env['WITH_BF_BINRELOC']:
if env['WITH_BF_OPENEXR']:
defs.append('WITH_OPENEXR')
+if env['WITH_BF_TIFF']:
+ defs.append('WITH_TIFF')
+
if not env['WITH_BF_SDL']:
defs.append('DISABLE_SDL')
diff --git a/source/creator/creator.c b/source/creator/creator.c
index 85a3eb136a3..dbb0c38267d 100644
--- a/source/creator/creator.c
+++ b/source/creator/creator.c
@@ -545,7 +545,9 @@ static int set_image_type(int argc, char **argv, void *data)
else if (!strcmp(imtype,"QUICKTIME")) scene->r.imtype = R_QUICKTIME;
else if (!strcmp(imtype,"BMP")) scene->r.imtype = R_BMP;
else if (!strcmp(imtype,"HDR")) scene->r.imtype = R_RADHDR;
+#ifdef WITH_TIFF
else if (!strcmp(imtype,"TIFF")) scene->r.imtype = R_TIFF;
+#endif
#ifdef WITH_OPENEXR
else if (!strcmp(imtype,"EXR")) scene->r.imtype = R_OPENEXR;
else if (!strcmp(imtype,"MULTILAYER")) scene->r.imtype = R_MULTILAYER;
diff --git a/source/gameengine/Expressions/ListValue.cpp b/source/gameengine/Expressions/ListValue.cpp
index 75aff67424b..4d9d82efb98 100644
--- a/source/gameengine/Expressions/ListValue.cpp
+++ b/source/gameengine/Expressions/ListValue.cpp
@@ -362,8 +362,8 @@ PyObject* listvalue_buffer_slice(PyObject* self,Py_ssize_t ilow, Py_ssize_t ihig
if (ihigh >= n)
ihigh = n;
- if (ihigh < ilow)
- ihigh = ilow;
+ if (ihigh < ilow)
+ ihigh = ilow;
newlist = PyList_New(ihigh - ilow);
if (!newlist)
@@ -491,6 +491,8 @@ static PySequenceMethods listvalue_as_sequence = {
NULL, /*sq_ass_item*/
NULL, /*sq_ass_slice*/
(objobjproc)listvalue_buffer_contains, /* sq_contains */
+ (binaryfunc) NULL, /* sq_inplace_concat */
+ (ssizeargfunc) NULL, /* sq_inplace_repeat */
};
diff --git a/source/gameengine/Ketsji/KX_GameObject.cpp b/source/gameengine/Ketsji/KX_GameObject.cpp
index 11caa9cd4e2..abc597a9eae 100644
--- a/source/gameengine/Ketsji/KX_GameObject.cpp
+++ b/source/gameengine/Ketsji/KX_GameObject.cpp
@@ -1739,6 +1739,8 @@ PySequenceMethods KX_GameObject::Sequence = {
NULL, /* sq_ass_item */
NULL, /* sq_ass_slice */
(objobjproc)Seq_Contains, /* sq_contains */
+ (binaryfunc) NULL, /* sq_inplace_concat */
+ (ssizeargfunc) NULL, /* sq_inplace_repeat */
};
PyTypeObject KX_GameObject::Type = {
@@ -2733,7 +2735,7 @@ KX_PYMETHODDEF_DOC(KX_GameObject, rayCastTo,
KX_RayCast::Callback<KX_GameObject> callback(this,spc);
KX_RayCast::RayTest(pe, fromPoint, toPoint, callback);
- if (m_pHitObject)
+ if (m_pHitObject)
return m_pHitObject->GetProxy();
Py_RETURN_NONE;
diff --git a/source/gameengine/Ketsji/KX_PythonSeq.cpp b/source/gameengine/Ketsji/KX_PythonSeq.cpp
index f28c9518ac4..8ffd58a781b 100644
--- a/source/gameengine/Ketsji/KX_PythonSeq.cpp
+++ b/source/gameengine/Ketsji/KX_PythonSeq.cpp
@@ -324,6 +324,8 @@ PySequenceMethods KX_PythonSeq_as_sequence = {
NULL, /* sq_ass_item */
NULL, /* sq_ass_slice */
(objobjproc)KX_PythonSeq_contains, /* sq_contains */
+ (binaryfunc) NULL, /* sq_inplace_concat */
+ (ssizeargfunc) NULL, /* sq_inplace_repeat */
};
static PyMappingMethods KX_PythonSeq_as_mapping = {
diff --git a/source/gameengine/Ketsji/KX_Scene.cpp b/source/gameengine/Ketsji/KX_Scene.cpp
index f805b693d0b..ebd0fa5c525 100644
--- a/source/gameengine/Ketsji/KX_Scene.cpp
+++ b/source/gameengine/Ketsji/KX_Scene.cpp
@@ -962,8 +962,8 @@ int KX_Scene::NewRemoveObject(class CValue* gameobj)
{
m_logicmgr->RemoveSensor(*its);
}
-
- SCA_ControllerList& controllers = newobj->GetControllers();
+
+ SCA_ControllerList& controllers = newobj->GetControllers();
for (SCA_ControllerList::iterator itc = controllers.begin();
!(itc==controllers.end());itc++)
{
@@ -1999,6 +1999,8 @@ PySequenceMethods KX_Scene::Sequence = {
NULL, /* sq_ass_item */
NULL, /* sq_ass_slice */
(objobjproc)Seq_Contains, /* sq_contains */
+ (binaryfunc) NULL, /* sq_inplace_concat */
+ (ssizeargfunc) NULL, /* sq_inplace_repeat */
};
PyObject* KX_Scene::pyattr_get_name(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
diff --git a/source/gameengine/PyDoc/GameKeys.py b/source/gameengine/PyDoc/GameKeys.py
deleted file mode 100644
index 1c4f45ddbab..00000000000
--- a/source/gameengine/PyDoc/GameKeys.py
+++ /dev/null
@@ -1,190 +0,0 @@
-# $Id$
-"""
-Documentation for the GameKeys module.
-======================================
-
-This module holds key constants for the SCA_KeyboardSensor.
-
-
-Example::
- # Set a connected keyboard sensor to accept F1
- import GameLogic
- import GameKeys
-
- co = GameLogic.getCurrentController()
- # 'Keyboard' is a keyboard sensor
- sensor = co.sensors["Keyboard"]
- sensor.key = GameKeys.F1KEY
-
-Example::
- # Do the all keys thing
- import GameLogic
- import GameKeys
-
- co = GameLogic.getCurrentController()
- # 'Keyboard' is a keyboard sensor
- sensor = co.sensors["Keyboard"]
-
- for key,status in sensor.events:
- # key[0] == GameKeys.keycode, key[1] = status
- if status == GameLogic.KX_INPUT_JUST_ACTIVATED:
- if key == GameKeys.WKEY:
- # Activate Forward!
- if key == GameKeys.SKEY:
- # Activate Backward!
- if key == GameKeys.AKEY:
- # Activate Left!
- if key == GameKeys.DKEY:
- # Activate Right!
-
-@group Alphabet keys: AKEY, BKEY, CKEY, DKEY, EKEY, FKEY, GKEY, HKEY, IKEY, JKEY, KKEY, LKEY, MKEY, NKEY, OKEY, PKEY, QKEY, RKEY, SKEY, TKEY, UKEY, VKEY, WKEY, XKEY, YKEY, ZKEY
-@var AKEY:
-@var BKEY:
-@var CKEY:
-@var DKEY:
-@var EKEY:
-@var FKEY:
-@var GKEY:
-@var HKEY:
-@var IKEY:
-@var JKEY:
-@var KKEY:
-@var LKEY:
-@var MKEY:
-@var NKEY:
-@var OKEY:
-@var PKEY:
-@var QKEY:
-@var RKEY:
-@var SKEY:
-@var TKEY:
-@var UKEY:
-@var VKEY:
-@var WKEY:
-@var XKEY:
-@var YKEY:
-@var ZKEY:
-
-@group Number keys: ZEROKEY, ONEKEY, TWOKEY, THREEKEY, FOURKEY, FIVEKEY, SIXKEY, SEVENKEY, EIGHTKEY, NINEKEY
-@var ZEROKEY:
-@var ONEKEY:
-@var TWOKEY:
-@var THREEKEY:
-@var FOURKEY:
-@var FIVEKEY:
-@var SIXKEY:
-@var SEVENKEY:
-@var EIGHTKEY:
-@var NINEKEY:
-
-@group Modifiers: CAPSLOCKKEY, LEFTCTRLKEY, LEFTALTKEY, RIGHTALTKEY, RIGHTCTRLKEY, RIGHTSHIFTKEY, LEFTSHIFTKEY
-@var CAPSLOCKKEY:
-@var LEFTCTRLKEY:
-@var LEFTALTKEY:
-@var RIGHTALTKEY:
-@var RIGHTCTRLKEY:
-@var RIGHTSHIFTKEY:
-@var LEFTSHIFTKEY:
-
-@group Arrow Keys: LEFTARROWKEY, DOWNARROWKEY, RIGHTARROWKEY, UPARROWKEY
-@var LEFTARROWKEY:
-@var DOWNARROWKEY:
-@var RIGHTARROWKEY:
-@var UPARROWKEY:
-
-@group Numberpad Keys: PAD0, PAD1, PAD2, PAD3, PAD4, PAD5, PAD6, PAD7, PAD8, PAD9, PADPERIOD, PADSLASHKEY, PADASTERKEY, PADMINUS, PADENTER, PADPLUSKEY
-@var PAD0:
-@var PAD1:
-@var PAD2:
-@var PAD3:
-@var PAD4:
-@var PAD5:
-@var PAD6:
-@var PAD7:
-@var PAD8:
-@var PAD9:
-@var PADPERIOD:
-@var PADSLASHKEY:
-@var PADASTERKEY:
-@var PADMINUS:
-@var PADENTER:
-@var PADPLUSKEY:
-
-@group Function Keys: F1KEY, F2KEY, F3KEY, F4KEY, F5KEY, F6KEY, F7KEY, F8KEY, F9KEY, F10KEY, F11KEY, F12KEY, F13KEY, F14KEY, F15KEY, F16KEY, F17KEY, F18KEY, F19KEY
-@var F1KEY:
-@var F2KEY:
-@var F3KEY:
-@var F4KEY:
-@var F5KEY:
-@var F6KEY:
-@var F7KEY:
-@var F8KEY:
-@var F9KEY:
-@var F10KEY:
-@var F11KEY:
-@var F12KEY:
-@var F13KEY:
-@var F14KEY:
-@var F15KEY:
-@var F16KEY:
-@var F17KEY:
-@var F18KEY:
-@var F19KEY:
-
-@group Other Keys: ACCENTGRAVEKEY, BACKSLASHKEY, BACKSPACEKEY, COMMAKEY, DELKEY, ENDKEY, EQUALKEY, ESCKEY, HOMEKEY, INSERTKEY, LEFTBRACKETKEY, LINEFEEDKEY, MINUSKEY, PAGEDOWNKEY, PAGEUPKEY, PAUSEKEY, PERIODKEY, QUOTEKEY, RIGHTBRACKETKEY, RETKEY, SEMICOLONKEY, SLASHKEY, SPACEKEY, TABKEY
-@var ACCENTGRAVEKEY:
-@var BACKSLASHKEY:
-@var BACKSPACEKEY:
-@var COMMAKEY:
-@var DELKEY:
-@var ENDKEY:
-@var EQUALKEY:
-@var ESCKEY:
-@var HOMEKEY:
-@var INSERTKEY:
-@var LEFTBRACKETKEY:
-@var LINEFEEDKEY:
-@var MINUSKEY:
-@var PAGEDOWNKEY:
-@var PAGEUPKEY:
-@var PAUSEKEY:
-@var PERIODKEY:
-@var QUOTEKEY:
-@var RIGHTBRACKETKEY:
-@var RETKEY:
-@var SEMICOLONKEY:
-@var SLASHKEY:
-@var SPACEKEY:
-@var TABKEY:
-
-@group Mouse Events: LEFTMOUSE, MIDDLEMOUSE, RIGHTMOUSE, WHEELUPMOUSE, WHEELDOWNMOUSE, MOUSEX, MOUSEY
-@var LEFTMOUSE:
-@var MIDDLEMOUSE:
-@var RIGHTMOUSE:
-@var WHEELUPMOUSE:
-@var WHEELDOWNMOUSE:
-@var MOUSEX:
-@var MOUSEY:
-
-"""
-
-def EventToString(event):
- """
- Return the string name of a key event. Will raise a ValueError error if its invalid.
-
- @type event: int
- @param event: key event from GameKeys or the keyboard sensor.
- @rtype: string
- """
-
-def EventToCharacter(event, shift):
- """
- Return the string name of a key event. Returns an empty string if the event cant be represented as a character.
-
- @type event: int
- @param event: key event from GameKeys or the keyboard sensor.
- @type shift: bool
- @param shift: set to true if shift is held.
- @rtype: string
- """
-
diff --git a/source/gameengine/PyDoc/GameLogic.py b/source/gameengine/PyDoc/GameLogic.py
deleted file mode 100644
index 5eb0fecd94c..00000000000
--- a/source/gameengine/PyDoc/GameLogic.py
+++ /dev/null
@@ -1,518 +0,0 @@
-# $Id$
-"""
-Documentation for the GameLogic Module.
-=======================================
-
- Module to access logic functions, imported automatically into the python controllers namespace.
-
- Examples::
- # To get the controller thats running this python script:
- cont = GameLogic.getCurrentController() # GameLogic is automatically imported
-
- # To get the game object this controller is on:
- obj = cont.owner
- L{KX_GameObject} and L{KX_Camera} or L{KX_LightObject} methods are
- available depending on the type of object::
- # To get a sensor linked to this controller.
- # "sensorname" is the name of the sensor as defined in the Blender interface.
- # +---------------------+ +--------+
- # | Sensor "sensorname" +--+ Python +
- # +---------------------+ +--------+
- sens = cont.sensors["sensorname"]
-
- # To get a sequence of all sensors:
- sensors = co.sensors
-
- See the sensor's reference for available methods:
- - L{DelaySensor<GameTypes.SCA_DelaySensor>}
- - L{JoystickSensor<GameTypes.SCA_JoystickSensor>}
- - L{KeyboardSensor<GameTypes.SCA_KeyboardSensor>}
- - L{MouseFocusSensor<GameTypes.KX_MouseFocusSensor>}
- - L{MouseSensor<GameTypes.SCA_MouseSensor>}
- - L{NearSensor<GameTypes.KX_NearSensor>}
- - L{NetworkMessageSensor<GameTypes.KX_NetworkMessageSensor>}
- - L{PropertySensor<GameTypes.SCA_PropertySensor>}
- - L{RadarSensor<GameTypes.KX_RadarSensor>}
- - L{RandomSensor<GameTypes.SCA_RandomSensor>}
- - L{RaySensor<GameTypes.KX_RaySensor>}
- - L{TouchSensor<GameTypes.KX_TouchSensor>}
-
- You can also access actuators linked to the controller::
- # To get an actuator attached to the controller:
- # +--------+ +-------------------------+
- # + Python +--+ Actuator "actuatorname" |
- # +--------+ +-------------------------+
- actuator = co.actuators["actuatorname"]
-
- # Activate an actuator
- controller.activate(actuator)
-
- See the actuator's reference for available methods:
- - L{2DFilterActuator<GameTypes.SCA_2DFilterActuator>}
- - L{ActionActuator<GameTypes.BL_ActionActuator>}
- - L{AddObjectActuator<GameTypes.KX_SCA_AddObjectActuator>}
- - L{CameraActuator<GameTypes.KX_CameraActuator>}
- - L{ConstraintActuator<GameTypes.KX_ConstraintActuator>}
- - L{DynamicActuator<GameTypes.KX_SCA_DynamicActuator>}
- - L{EndObjectActuator<GameTypes.KX_SCA_EndObjectActuator>}
- - L{GameActuator<GameTypes.KX_GameActuator>}
- - L{IpoActuator<GameTypes.KX_IpoActuator>}
- - L{NetworkMessageActuator<GameTypes.KX_NetworkMessageActuator>}
- - L{ObjectActuator<GameTypes.KX_ObjectActuator>}
- - L{ParentActuator<GameTypes.KX_ParentActuator>}
- - L{PropertyActuator<GameTypes.SCA_PropertyActuator>}
- - L{RandomActuator<GameTypes.SCA_RandomActuator>}
- - L{ReplaceMeshActuator<GameTypes.KX_SCA_ReplaceMeshActuator>}
- - L{SceneActuator<GameTypes.KX_SceneActuator>}
- - L{ShapeActionActuator<GameTypes.BL_ShapeActionActuator>}
- - L{SoundActuator<GameTypes.KX_SoundActuator>}
- - L{StateActuator<GameTypes.KX_StateActuator>}
- - L{TrackToActuator<GameTypes.KX_TrackToActuator>}
- - L{VisibilityActuator<GameTypes.KX_VisibilityActuator>}
-
- Most logic brick's methods are accessors for the properties available in the logic buttons.
- Consult the logic bricks documentation for more information on how each logic brick works.
-
- There are also methods to access the current L{KX_Scene}::
- # Get the current scene
- scene = GameLogic.getCurrentScene()
-
- # Get the current camera
- cam = scene.active_camera
-
- Matricies as used by the game engine are B{row major}::
- matrix[row][col] = float
- L{KX_Camera} has some examples using matricies.
-
-
-@group Constants: KX_TRUE, KX_FALSE
-@var KX_TRUE: True value used by some modules.
-@var KX_FALSE: False value used by some modules.
-
-@group Property Sensor: KX_PROPSENSOR_*
-@var KX_PROPSENSOR_EQUAL: Activate when the property is equal to the sensor value.
-@var KX_PROPSENSOR_NOTEQUAL: Activate when the property is not equal to the sensor value.
-@var KX_PROPSENSOR_INTERVAL: Activate when the property is between the specified limits.
-@var KX_PROPSENSOR_CHANGED: Activate when the property changes
-@var KX_PROPSENSOR_EXPRESSION: Activate when the expression matches
-
-@group Constraint Actuator: KX_CONSTRAINTACT_*
-@var KX_CONSTRAINTACT_LOCX: See L{KX_ConstraintActuator}
-@var KX_CONSTRAINTACT_LOCY: See L{KX_ConstraintActuator}
-@var KX_CONSTRAINTACT_LOCZ: See L{KX_ConstraintActuator}
-@var KX_CONSTRAINTACT_ROTX: See L{KX_ConstraintActuator}
-@var KX_CONSTRAINTACT_ROTY: See L{KX_ConstraintActuator}
-@var KX_CONSTRAINTACT_ROTZ: See L{KX_ConstraintActuator}
-@var KX_CONSTRAINTACT_DIRNX: See L{KX_ConstraintActuator}
-@var KX_CONSTRAINTACT_DIRNY: See L{KX_ConstraintActuator}
-@var KX_CONSTRAINTACT_DIRPX: See L{KX_ConstraintActuator}
-@var KX_CONSTRAINTACT_DIRPY: See L{KX_ConstraintActuator}
-@var KX_CONSTRAINTACT_ORIX: See L{KX_ConstraintActuator}
-@var KX_CONSTRAINTACT_ORIY: See L{KX_ConstraintActuator}
-@var KX_CONSTRAINTACT_ORIZ: See L{KX_ConstraintActuator}
-
-@group IPO Actuator: KX_IPOACT_*
-@var KX_IPOACT_PLAY: See L{KX_IpoActuator}
-@var KX_IPOACT_PINGPONG: See L{KX_IpoActuator}
-@var KX_IPOACT_FLIPPER: See L{KX_IpoActuator}
-@var KX_IPOACT_LOOPSTOP: See L{KX_IpoActuator}
-@var KX_IPOACT_LOOPEND: See L{KX_IpoActuator}
-@var KX_IPOACT_FROM_PROP: See L{KX_IpoActuator}
-
-@group Random Distributions: KX_RANDOMACT_*
-@var KX_RANDOMACT_BOOL_CONST: See L{SCA_RandomActuator}
-@var KX_RANDOMACT_BOOL_UNIFORM: See L{SCA_RandomActuator}
-@var KX_RANDOMACT_BOOL_BERNOUILLI: See L{SCA_RandomActuator}
-@var KX_RANDOMACT_INT_CONST: See L{SCA_RandomActuator}
-@var KX_RANDOMACT_INT_UNIFORM: See L{SCA_RandomActuator}
-@var KX_RANDOMACT_INT_POISSON: See L{SCA_RandomActuator}
-@var KX_RANDOMACT_FLOAT_CONST: See L{SCA_RandomActuator}
-@var KX_RANDOMACT_FLOAT_UNIFORM: See L{SCA_RandomActuator}
-@var KX_RANDOMACT_FLOAT_NORMAL: See L{SCA_RandomActuator}
-@var KX_RANDOMACT_FLOAT_NEGATIVE_EXPONENTIAL: See L{SCA_RandomActuator}
-
-@group Action Actuator: KX_ACTIONACT_*
-@var KX_ACTIONACT_PLAY: See L{BL_ActionActuator}
-@var KX_ACTIONACT_FLIPPER: See L{BL_ActionActuator}
-@var KX_ACTIONACT_LOOPSTOP: See L{BL_ActionActuator}
-@var KX_ACTIONACT_LOOPEND: See L{BL_ActionActuator}
-@var KX_ACTIONACT_PROPERTY: See L{BL_ActionActuator}
-
-@group Sound Actuator: KX_SOUNDACT_*
-@var KX_SOUNDACT_PLAYSTOP: See L{KX_SoundActuator}
-@var KX_SOUNDACT_PLAYEND: See L{KX_SoundActuator}
-@var KX_SOUNDACT_LOOPSTOP: See L{KX_SoundActuator}
-@var KX_SOUNDACT_LOOPEND: See L{KX_SoundActuator}
-@var KX_SOUNDACT_LOOPBIDIRECTIONAL: See L{KX_SoundActuator}
-@var KX_SOUNDACT_LOOPBIDIRECTIONAL_STOP: See L{KX_SoundActuator}
-
-@group Radar Sensor: KX_RADAR_*
-@var KX_RADAR_AXIS_POS_X: See L{KX_RadarSensor}
-@var KX_RADAR_AXIS_POS_Y: See L{KX_RadarSensor}
-@var KX_RADAR_AXIS_POS_Z: See L{KX_RadarSensor}
-@var KX_RADAR_AXIS_NEG_X: See L{KX_RadarSensor}
-@var KX_RADAR_AXIS_NEG_Y: See L{KX_RadarSensor}
-@var KX_RADAR_AXIS_NEG_Z: See L{KX_RadarSensor}
-
-@group Ray Sensor: KX_RAY_*
-@var KX_RAY_AXIS_POS_X: See L{KX_RaySensor}
-@var KX_RAY_AXIS_POS_Y: See L{KX_RaySensor}
-@var KX_RAY_AXIS_POS_Z: See L{KX_RaySensor}
-@var KX_RAY_AXIS_NEG_X: See L{KX_RaySensor}
-@var KX_RAY_AXIS_NEG_Y: See L{KX_RaySensor}
-@var KX_RAY_AXIS_NEG_Z: See L{KX_RaySensor}
-
-@group Dynamic Actuator: KX_DYN_*
-@var KX_DYN_RESTORE_DYNAMICS: See L{KX_SCA_DynamicActuator}
-@var KX_DYN_DISABLE_DYNAMICS: See L{KX_SCA_DynamicActuator}
-@var KX_DYN_ENABLE_RIGID_BODY: See L{KX_SCA_DynamicActuator}
-@var KX_DYN_DISABLE_RIGID_BODY: See L{KX_SCA_DynamicActuator}
-@var KX_DYN_SET_MASS: See L{KX_SCA_DynamicActuator}
-
-@group Game Actuator: KX_GAME_*
-@var KX_GAME_LOAD: See L{KX_GameActuator}
-@var KX_GAME_START: See L{KX_GameActuator}
-@var KX_GAME_RESTART: See L{KX_GameActuator}
-@var KX_GAME_QUIT: See L{KX_GameActuator}
-@var KX_GAME_SAVECFG: See L{KX_GameActuator}
-@var KX_GAME_LOADCFG: See L{KX_GameActuator}
-
-@group Scene Actuator: KX_SCENE_*
-@var KX_SCENE_RESTART: See L{KX_SceneActuator}
-@var KX_SCENE_SET_SCENE: See L{KX_SceneActuator}
-@var KX_SCENE_SET_CAMERA: See L{KX_SceneActuator}
-@var KX_SCENE_ADD_FRONT_SCENE: See L{KX_SceneActuator}
-@var KX_SCENE_ADD_BACK_SCENE: See L{KX_SceneActuator}
-@var KX_SCENE_REMOVE_SCENE: See L{KX_SceneActuator}
-@var KX_SCENE_SUSPEND: See L{KX_SceneActuator}
-@var KX_SCENE_RESUME: See L{KX_SceneActuator}
-
-@group Input Status: KX_INPUT_*
-@var KX_INPUT_NONE: See L{SCA_MouseSensor}
-@var KX_INPUT_JUST_ACTIVATED: See L{SCA_MouseSensor}
-@var KX_INPUT_ACTIVE: See L{SCA_MouseSensor}
-@var KX_INPUT_JUST_RELEASED: See L{SCA_MouseSensor}
-
-
-@group Mouse Buttons: KX_MOUSE_BUT_*
-@var KX_MOUSE_BUT_LEFT: See L{SCA_MouseSensor}
-@var KX_MOUSE_BUT_MIDDLE: See L{SCA_MouseSensor}
-@var KX_MOUSE_BUT_RIGHT: See L{SCA_MouseSensor}
-
-@group States: KX_STATE*
-@var KX_STATE1:
-@var KX_STATE10:
-@var KX_STATE11:
-@var KX_STATE12:
-@var KX_STATE13:
-@var KX_STATE14:
-@var KX_STATE15:
-@var KX_STATE16:
-@var KX_STATE17:
-@var KX_STATE18:
-@var KX_STATE19:
-@var KX_STATE2:
-@var KX_STATE20:
-@var KX_STATE21:
-@var KX_STATE22:
-@var KX_STATE23:
-@var KX_STATE24:
-@var KX_STATE25:
-@var KX_STATE26:
-@var KX_STATE27:
-@var KX_STATE28:
-@var KX_STATE29:
-@var KX_STATE3:
-@var KX_STATE30:
-@var KX_STATE4:
-@var KX_STATE5:
-@var KX_STATE6:
-@var KX_STATE7:
-@var KX_STATE8:
-@var KX_STATE9:
-@var KX_STATE_OP_CLR:
-@var KX_STATE_OP_CPY:
-@var KX_STATE_OP_NEG:
-@var KX_STATE_OP_SET:
-
-@group 2D Filter: RAS_2DFILTER_*
-@var RAS_2DFILTER_BLUR:
-@var RAS_2DFILTER_CUSTOMFILTER:
-@var RAS_2DFILTER_DILATION:
-@var RAS_2DFILTER_DISABLED:
-@var RAS_2DFILTER_ENABLED:
-@var RAS_2DFILTER_EROSION:
-@var RAS_2DFILTER_GRAYSCALE:
-@var RAS_2DFILTER_INVERT:
-@var RAS_2DFILTER_LAPLACIAN:
-@var RAS_2DFILTER_MOTIONBLUR:
-@var RAS_2DFILTER_NOFILTER:
-@var RAS_2DFILTER_PREWITT:
-@var RAS_2DFILTER_SEPIA:
-@var RAS_2DFILTER_SHARPEN:
-@var RAS_2DFILTER_SOBEL:
-
-@group Constraint Actuator: KX_ACT_CONSTRAINT_*
-@var KX_ACT_CONSTRAINT_DISTANCE:
-@var KX_ACT_CONSTRAINT_DOROTFH:
-@var KX_ACT_CONSTRAINT_FHNX:
-@var KX_ACT_CONSTRAINT_FHNY:
-@var KX_ACT_CONSTRAINT_FHNZ:
-@var KX_ACT_CONSTRAINT_FHPX:
-@var KX_ACT_CONSTRAINT_FHPY:
-@var KX_ACT_CONSTRAINT_FHPZ:
-@var KX_ACT_CONSTRAINT_LOCAL:
-@var KX_ACT_CONSTRAINT_MATERIAL:
-@var KX_ACT_CONSTRAINT_NORMAL:
-@var KX_ACT_CONSTRAINT_PERMANENT:
-
-@group Parent Actuator: KX_PARENT_*
-@var KX_PARENT_REMOVE:
-@var KX_PARENT_SET:
-
-@group Shader: MODELMATRIX*, MODELVIEWMATRIX*, VIEWMATRIX*, CAM_POS, CONSTANT_TIMER, SHD_TANGENT
-@var VIEWMATRIX:
-@var VIEWMATRIX_INVERSE:
-@var VIEWMATRIX_INVERSETRANSPOSE:
-@var VIEWMATRIX_TRANSPOSE:
-@var MODELMATRIX:
-@var MODELMATRIX_INVERSE:
-@var MODELMATRIX_INVERSETRANSPOSE:
-@var MODELMATRIX_TRANSPOSE:
-@var MODELVIEWMATRIX:
-@var MODELVIEWMATRIX_INVERSE:
-@var MODELVIEWMATRIX_INVERSETRANSPOSE:
-@var MODELVIEWMATRIX_TRANSPOSE:
-@var CAM_POS: Current camera position
-@var CONSTANT_TIMER: User a timer for the uniform value.
-@var SHD_TANGENT: Not yet documented.
-
-@group Blender Material: BL_*
-@var BL_DST_ALPHA:
-@var BL_DST_COLOR:
-@var BL_ONE:
-@var BL_ONE_MINUS_DST_ALPHA:
-@var BL_ONE_MINUS_DST_COLOR:
-@var BL_ONE_MINUS_SRC_ALPHA:
-@var BL_ONE_MINUS_SRC_COLOR:
-@var BL_SRC_ALPHA:
-@var BL_SRC_ALPHA_SATURATE:
-@var BL_SRC_COLOR:
-@var BL_ZERO:
-
-@group Deprecated: addActiveActuator
-
-@var globalDict: A dictionary that is saved between loading blend files so you can use
- it to store inventory and other variables you want to store between
- scenes and blend files. It can also be written to a file and loaded
- later on with the game load/save actuators.
- note: only python built in types such as int/string/bool/float/tuples/lists
- can be saved, GameObjects, Actuators etc will not work as expectred.
-
-@var keyboard: The current keyboard wrapped in an SCA_PythonKeyboard object.
-@var mouse: The current mouse wrapped in an SCA_PythonMouse object.
-"""
-
-import GameTypes
-
-# TODO
-# error
-
-def getCurrentController():
- """
- Gets the Python controller associated with this Python script.
-
- @rtype: L{SCA_PythonController}
- """
-def getCurrentScene():
- """
- Gets the current Scene.
-
- @rtype: L{KX_Scene}
- """
-def getSceneList():
- """
- Gets a list of the current scenes loaded in the game engine.
-
- @note: Scenes in your blend file that have not been converted wont be in this list. This list will only contain scenes such as overlays scenes.
-
- @rtype: list of L{KX_Scene}
- """
-def addActiveActuator(actuator, activate):
- """
- Activates the given actuator.
-
- @deprecated: Use L{GameTypes.SCA_PythonController.activate} and L{GameTypes.SCA_PythonController.deactivate} instead.
- @type actuator: L{SCA_IActuator} or the actuator name as a string.
- @type activate: boolean
- @param activate: whether to activate or deactivate the given actuator.
- """
-def loadGlobalDict():
- """
- Loads GameLogic.globalDict from a file.
- """
-def saveGlobalDict():
- """
- Saves GameLogic.globalDict to a file.
- """
-def addScene(name, overlay=1):
- """
- Loads a scene into the game engine.
-
- @param name: The name of the scene
- @type name: string
- @param overlay: Overlay or underlay (optional)
- @type overlay: int
- """
-def sendMessage(subject, body="", to="", message_from=""):
- """
- Sends a message to sensors in any active scene.
-
- @param subject: The subject of the message
- @type subject: string
- @param body: The body of the message (optional)
- @type body: string
- @param to: The name of the object to send the message to (optional)
- @type to: string
- @param message_from: The name of the object that the message is coming from (optional)
- @type message_from: string
- """
-def setGravity(gravity):
- """
- Sets the world gravity.
-
- @type gravity: list [fx, fy, fz]
- """
-def getSpectrum():
- """
- Returns a 512 point list from the sound card.
- This only works if the fmod sound driver is being used.
-
- @rtype: list [float], len(getSpectrum()) == 512
- """
-def stopDSP():
- """
- Stops the sound driver using DSP effects.
-
- Only the fmod sound driver supports this.
- DSP can be computationally expensive.
- """
-def getMaxLogicFrame():
- """
- Gets the maximum number of logic frame per render frame.
-
- @return: The maximum number of logic frame per render frame
- @rtype: integer
- """
-def setMaxLogicFrame(maxlogic):
- """
- Sets the maximum number of logic frame that are executed per render frame.
- This does not affect the physic system that still runs at full frame rate.
-
- @param maxlogic: The new maximum number of logic frame per render frame. Valid values: 1..5
- @type maxlogic: integer
- """
-def getMaxPhysicsFrame():
- """
- Gets the maximum number of physics frame per render frame.
-
- @return: The maximum number of physics frame per render frame
- @rtype: integer
- """
-def setMaxPhysicsFrame(maxphysics):
- """
- Sets the maximum number of physics timestep that are executed per render frame.
- Higher value allows physics to keep up with realtime even if graphics slows down the game.
- Physics timestep is fixed and equal to 1/tickrate (see setLogicTicRate)
- maxphysics/ticrate is the maximum delay of the renderer that physics can compensate.
-
- @param maxphysics: The new maximum number of physics timestep per render frame. Valid values: 1..5.
- @type maxphysics: integer
- """
-def getLogicTicRate():
- """
- Gets the logic update frequency.
-
- @return: The logic frequency in Hz
- @rtype: float
- """
-def setLogicTicRate(ticrate):
- """
- Sets the logic update frequency.
-
- The logic update frequency is the number of times logic bricks are executed every second.
- The default is 60 Hz.
-
- @param ticrate: The new logic update frequency (in Hz).
- @type ticrate: float
- """
-def getPhysicsTicRate():
- """
- NOT IMPLEMENTED
- Gets the physics update frequency
-
- @return: The physics update frequency in Hz
- @rtype: float
- """
-def setPhysicsTicRate(ticrate):
- """
- NOT IMPLEMENTED
- Sets the physics update frequency
-
- The physics update frequency is the number of times the physics system is executed every second.
- The default is 60 Hz.
-
- @param ticrate: The new update frequency (in Hz).
- @type ticrate: float
- """
-def saveGlobalDict():
- """
- Saves GameLogic.globalDict to a file.
- """
-def loadGlobalDict():
- """
- Loads GameLogic.globalDict from a file.
- """
-
-#{ Utility functions
-def getAverageFrameRate():
- """
- Gets the estimated average framerate
-
- @return: The estimed average framerate in frames per second
- @rtype: float
- """
-def expandPath(path):
- """
- Converts a blender internal path into a proper file system path.
-
- Use / as directory separator in path
- You can use '//' at the start of the string to define a relative path;
- Blender replaces that string by the directory of the startup .blend or runtime file
- to make a full path name (doesn't change during the game, even if you load other .blend).
- The function also converts the directory separator to the local file system format.
-
- @param path: The path string to be converted/expanded.
- @type path: string
- @return: The converted string
- @rtype: string
- """
-
-def getBlendFileList(path = "//"):
- """
- Returns a list of blend files in the same directory as the open blend file, or from using the option argument.
-
- @param path: Optional directory argument, will be expanded (like expandPath) into the full path.
- @type path: string
- @return: A list of filenames, with no directory prefix
- @rtype: list
- """
-def PrintGLInfo():
- """
- Prints GL Extension Info into the console
- """
-def getRandomFloat():
- """
- Returns a random floating point value in the range [0...1)
- """
-#}
diff --git a/source/gameengine/PyDoc/GameTypes.py b/source/gameengine/PyDoc/GameTypes.py
deleted file mode 100644
index 22915de37c7..00000000000
--- a/source/gameengine/PyDoc/GameTypes.py
+++ /dev/null
@@ -1,6184 +0,0 @@
-"""
-Documentation for the GameTypes Module.
-=======================================
-
-@group Base: PyObjectPlus, CValue, CPropValue, SCA_ILogicBrick, SCA_IObject, SCA_ISensor, SCA_IController, SCA_IActuator
-
-@group Object: KX_GameObject, KX_LightObject, KX_Camera, BL_ArmatureObject
-
-@group Animation: BL_ArmatureConstraint
-
-@group Mesh: KX_MeshProxy, KX_PolyProxy, KX_VertexProxy
-
-@group Shading: KX_PolygonMaterial, KX_BlenderMaterial, BL_Shader
-
-@group Sensors: SCA_ActuatorSensor, SCA_AlwaysSensor, SCA_DelaySensor, SCA_JoystickSensor, SCA_KeyboardSensor, KX_MouseFocusSensor, SCA_MouseSensor, KX_NearSensor, KX_NetworkMessageSensor, SCA_PropertySensor, KX_RadarSensor, SCA_RandomSensor, KX_RaySensor, KX_TouchSensor, KX_ArmatureSensor
-
-@group Actuators: SCA_2DFilterActuator, BL_ActionActuator, BL_ArmatureActuator, KX_SCA_AddObjectActuator, KX_CameraActuator, KX_ConstraintActuator, KX_SCA_DynamicActuator, KX_SCA_EndObjectActuator, KX_GameActuator, KX_IpoActuator, KX_NetworkMessageActuator, KX_ObjectActuator, KX_ParentActuator, SCA_PropertyActuator, SCA_RandomActuator, KX_SCA_ReplaceMeshActuator, KX_SceneActuator, BL_ShapeActionActuator, KX_SoundActuator, KX_StateActuator, KX_TrackToActuator, KX_VisibilityActuator
-
-@group Controllers: SCA_ANDController, SCA_NANDController, SCA_NORController, SCA_ORController, SCA_PythonController, SCA_XNORController, SCA_XORController
-"""
-import GameLogic
-
-class PyObjectPlus:
- """
- PyObjectPlus base class of most other types in the Game Engine.
-
- @ivar invalid: Test if the object has been freed by the game engine and is no longer valid.
-
- Normally this is not a problem but when storing game engine data in the GameLogic module,
- KX_Scenes or other KX_GameObjects its possible to hold a reference to invalid data.
- Calling an attribute or method on an invalid object will raise a SystemError.
-
- The invalid attribute allows testing for this case without exception handling.
- @type invalid: bool
- """
-
- def isA(game_type):
- """
- Check if this is a type or a subtype game_type.
-
- @param game_type: the name of the type or the type its self from the L{GameTypes} module.
- @type game_type: string or type
- @return: True if this object is a type or a subtype of game_type.
- @rtype: bool
- """
-
-class CValue(PyObjectPlus):
- """
- This class is a basis for other classes.
- @ivar name: The name of this CValue derived object (read-only).
- @type name: string
- @group Deprecated: getName
- """
- def getName():
- """
- Returns the name of the CValue.
-
- @deprecated: Use the L{name} attribute instead.
- @note: in most cases the CValue's subclasses will override this function.
- @rtype: string
- """
-
-class CPropValue(CValue):
- """
- This class has no python functions
- """
- pass
-
-class SCA_ILogicBrick(CValue):
- """
- Base class for all logic bricks.
-
- @ivar executePriority: This determines the order controllers are evaluated, and actuators are activated (lower priority is executed first).
- @type executePriority: int
- @ivar owner: The game object this logic brick is attached to (read-only).
- @type owner: L{KX_GameObject} or None in exceptional cases.
- @ivar name: The name of this logic brick (read-only).
- @type name: string
- """
-
-#{ Deprecated
- def getOwner():
- """
- Gets the game object associated with this logic brick.
-
- @deprecated: Use the L{owner} attribute instead.
- @rtype: L{KX_GameObject}
- """
-
- def setExecutePriority(priority):
- """
- Sets the priority of this logic brick.
-
- This determines the order controllers are evaluated, and actuators are activated.
- Bricks with lower priority will be executed first.
-
- @deprecated: Use the L{executePriority} attribute instead.
- @type priority: integer
- @param priority: the priority of this logic brick.
- """
- def getExecutePriority():
- """
- Gets the execution priority of this logic brick.
-
- @deprecated: Use the L{executePriority} attribute instead.
- @rtype: integer
- @return: this logic bricks current priority.
- """
-#}
-
-class SCA_PythonKeyboard(PyObjectPlus):
- """
- The current keyboard.
- @ivar events: a list of pressed keys that have either been pressed, or just released, or are active this frame. (read-only).
-
- - 'keycode' matches the values in L{GameKeys}.
- - 'status' uses...
- - L{GameLogic.KX_INPUT_NONE}
- - L{GameLogic.KX_INPUT_JUST_ACTIVATED}
- - L{GameLogic.KX_INPUT_ACTIVE}
- - L{GameLogic.KX_INPUT_JUST_RELEASED}
-
- @type events: list [[keycode, status], ...]
- """
- pass
-
-class SCA_PythonMouse(PyObjectPlus):
- """
- The current mouse.
-
- @ivar events: a list of pressed buttons that have either been pressed, or just released, or are active this frame. (read-only).
-
- - 'keycode' matches the values in L{GameKeys}.
- - 'status' uses...
- - L{GameLogic.KX_INPUT_NONE}
- - L{GameLogic.KX_INPUT_JUST_ACTIVATED}
- - L{GameLogic.KX_INPUT_ACTIVE}
- - L{GameLogic.KX_INPUT_JUST_RELEASED}
-
- @type events: list [[keycode, status], ...]
- @ivar position: The normalized x and y position of the mouse cursor.
- @type position: list [x, y]
- @ivar visible: The visibility of the mouse cursor
- @type visible: boolean
- """
- pass
-
-class SCA_IObject(CValue):
- """
- This class has no python functions
- """
- pass
-
-class SCA_ISensor(SCA_ILogicBrick):
- """
- Base class for all sensor logic bricks.
-
- @ivar usePosPulseMode: Flag to turn positive pulse mode on and off.
- @type usePosPulseMode: boolean
- @ivar useNegPulseMode: Flag to turn negative pulse mode on and off.
- @type useNegPulseMode: boolean
- @ivar frequency: The frequency for pulse mode sensors.
- @type frequency: int
- @ivar level: Option whether to detect level or edge transition when entering a state.
- It makes a difference only in case of logic state transition (state actuator).
- A level detector will immediately generate a pulse, negative or positive
- depending on the sensor condition, as soon as the state is activated.
- A edge detector will wait for a state change before generating a pulse.
- note: mutually exclusive with L{tap}, enabling will disable L{tap}.
- @type level: boolean
- @ivar tap: When enabled only sensors that are just activated will send a positive event,
- after this they will be detected as negative by the controllers.
- This will make a key thats held act as if its only tapped for an instant.
- note: mutually exclusive with L{level}, enabling will disable L{level}.
- @type tap: boolean
- @ivar invert: Flag to set if this sensor activates on positive or negative events.
- @type invert: boolean
- @ivar triggered: True if this sensor brick is in a positive state. (read-only)
- @type triggered: boolean
- @ivar positive: True if this sensor brick is in a positive state. (read-only)
- @type positive: boolean
- @ivar status: The status of the sensor. (read-only)
- KX_SENSOR_INACTIVE, KX_SENSOR_JUST_ACTIVATED,
- KX_SENSOR_ACTIVE, KX_SENSOR_JUST_DEACTIVATED
- Note: this convenient attribute combines the values of triggered and positive attributes
- @type status: int from 0-3.
- """
-
- def reset():
- """
- Reset sensor internal state, effect depends on the type of sensor and settings.
-
- The sensor is put in its initial state as if it was just activated.
- """
-#{ Deprecated
- def isPositive():
- """
- True if this sensor brick is in a positive state.
-
- @deprecated: use L{positive}
- """
-
- def isTriggered():
- """
- True if this sensor brick has triggered the current controller.
-
- @deprecated: use L{triggered}
- """
-
- def getUsePosPulseMode():
- """
- True if the sensor is in positive pulse mode.
-
- @deprecated: use L{usePosPulseMode}
- """
- def setUsePosPulseMode(pulse):
- """
- Sets positive pulse mode.
-
- @type pulse: boolean
- @param pulse: If True, will activate positive pulse mode for this sensor.
- @deprecated: use L{usePosPulseMode}
- """
- def getFrequency():
- """
- The frequency for pulse mode sensors.
-
- @rtype: integer
- @return: the pulse frequency in 1/50 sec.
- @deprecated: use L{frequency}
- """
- def setFrequency(freq):
- """
- Sets the frequency for pulse mode sensors.
-
- @type freq: integer
- @return: the pulse frequency in 1/50 sec.
- @deprecated: use L{frequency}
- """
- def getUseNegPulseMode():
- """
- True if the sensor is in negative pulse mode.
-
- @deprecated: use L{useNegPulseMode}
- """
- def setUseNegPulseMode(pulse):
- """
- Sets negative pulse mode.
-
- @type pulse: boolean
- @param pulse: If True, will activate negative pulse mode for this sensor.
- @deprecated: use L{useNegPulseMode}
- """
- def getInvert():
- """
- True if this sensor activates on negative events.
-
- @deprecated: use L{invert}
- """
- def setInvert(invert):
- """
- Sets if this sensor activates on positive or negative events.
-
- @type invert: boolean
- @param invert: true if activates on negative events; false if activates on positive events.
- @deprecated: use L{invert}
- """
- def getLevel():
- """
- Returns whether this sensor is a level detector or a edge detector.
- It makes a difference only in case of logic state transition (state actuator).
- A level detector will immediately generate a pulse, negative or positive
- depending on the sensor condition, as soon as the state is activated.
- A edge detector will wait for a state change before generating a pulse.
-
- @rtype: boolean
- @return: true if sensor is level sensitive, false if it is edge sensitive
- @deprecated: use L{level}
- """
- def setLevel(level):
- """
- Set whether to detect level or edge transition when entering a state.
-
- @param level: Detect level instead of edge? (KX_TRUE, KX_FALSE)
- @type level: boolean
- @deprecated: use L{level}
- """
-#}
-
-class SCA_IController(SCA_ILogicBrick):
- """
- Base class for all controller logic bricks.
-
- @ivar state: the controllers state bitmask.
- This can be used with the GameObject's state to test if the controller is active.
- @type state: int bitmask
- @ivar sensors: a list of sensors linked to this controller
- - note: the sensors are not necessarily owned by the same object.
- - note: when objects are instanced in dupligroups links may be lost from objects outside the dupligroup.
- @type sensors: sequence supporting index/string lookups and iteration.
- @ivar actuators: a list of actuators linked to this controller.
- - note: the sensors are not necessarily owned by the same object.
- - note: when objects are instanced in dupligroups links may be lost from objects outside the dupligroup.
- @type actuators: sequence supporting index/string lookups and iteration.
- @ivar useHighPriority: When set the controller executes always before all other controllers that dont have this set.
- note: Order of execution between high priority controllers is not guaranteed.
- @type useHighPriority: bool
- """
-#{ Deprecated
- def getState():
- """
- Get the controllers state bitmask, this can be used with the GameObject's state to test if the the controller is active.
- This for instance will always be true however you could compare with a previous state to see when the state was activated.
- GameLogic.getCurrentController().state & GameLogic.getCurrentController().owner.state
- @deprecated: Use the L{state} property
- @rtype: int
- """
- def getSensors():
- """
- Gets a list of all sensors attached to this controller.
- @deprecated: use the L{sensors} property
- @rtype: list [L{SCA_ISensor}]
- """
- def getSensor(name):
- """
- Gets the named linked sensor.
- @deprecated: use the L{sensors}[name] property
- @type name: string
- @rtype: L{SCA_ISensor}
- """
- def getActuators():
- """
- Gets a list of all actuators linked to this controller.
- @deprecated: Use the L{actuators} property
- @rtype: list [L{SCA_IActuator}]
- """
- def getActuator(name):
- """
- Gets the named linked actuator.
- @deprecated: use the L{actuators}[name] property
- @type name: string
- @rtype: L{SCA_IActuator}
- """
-#}
-
-class SCA_IActuator(SCA_ILogicBrick):
- """
- Base class for all actuator logic bricks.
- """
-
-class BL_ActionActuator(SCA_IActuator):
- """
- Action Actuators apply an action to an actor.
-
- @ivar action: The name of the action to set as the current action.
- @type action: string
- @ivar channelNames: A list of channel names that may be used with L{setChannel} and L{getChannel}
- @type channelNames: list of strings
- @ivar frameStart: Specifies the starting frame of the animation.
- @type frameStart: float
- @ivar frameEnd: Specifies the ending frame of the animation.
- @type frameEnd: float
- @ivar blendIn: Specifies the number of frames of animation to generate when making transitions between actions.
- @type blendIn: float
- @ivar priority: Sets the priority of this actuator. Actuators will lower
- priority numbers will override actuators with higher
- numbers.
- @type priority: integer
- @ivar frame: Sets the current frame for the animation.
- @type frame: float
- @ivar propName: Sets the property to be used in FromProp playback mode.
- @type propName: string
- @ivar blendTime: Sets the internal frame timer. This property must be in
- the range from 0.0 to blendIn.
- @type blendTime: float
- @ivar mode: The operation mode of the actuator. KX_ACTIONACT_PLAY, KX_ACTIONACT_PROPERTY, KX_ACTIONACT_FLIPPER, KX_ACTIONACT_LOOPSTOP, KX_ACTIONACT_LOOPEND
- @type mode: integer
- @ivar useContinue: The actions continue option, True or False.
- When True, the action will always play from where last left off,
- otherwise negative events to this actuator will reset it to its start frame.
- @type useContinue: boolean
- @ivar framePropName: The name of the property that is set to the current frame number.
- @type framePropName: string
- """
- def setChannel(channel, matrix):
- """
- Alternative to the 2 arguments, 4 arguments (channel, matrix, loc, size, quat) are also supported.
-
- @note: These values are relative to the bones rest position, currently the api has no way to get this info (which is annoying), but can be worked around by using bones with a rest pose that has no translation.
- @param channel: A string specifying the name of the bone channel, error raised if not in L{channelNames}.
- @type channel: string
- @param matrix: A 4x4 matrix specifying the overriding transformation
- as an offset from the bone's rest position.
- @type matrix: list [[float]]
- """
-
- def getChannel(channel):
- """
- @param channel: A string specifying the name of the bone channel. error raised if not in L{channelNames}.
- @type channel: string
- @rtype: tuple
- @return: (loc, size, quat)
- """
-
-#{ Deprecated
- def setAction(action, reset = True):
- """
- Sets the current action.
- @deprecated: use the L{action} property
- @param action: The name of the action to set as the current action.
- @type action: string
- @param reset: Optional parameter indicating whether to reset the
- blend timer or not. A value of 1 indicates that the
- timer should be reset. A value of 0 will leave it
- unchanged. If reset is not specified, the timer will
- be reset.
- """
-
- def setStart(start):
- """
- Specifies the starting frame of the animation.
- @deprecated: Use the L{frameStart} property
- @param start: the starting frame of the animation
- @type start: float
- """
-
- def setEnd(end):
- """
- Specifies the ending frame of the animation.
- @deprecated: use the L{frameEnd} property
- @param end: the ending frame of the animation
- @type end: float
- """
- def setBlendin(blendin):
- """
- Specifies the number of frames of animation to generate
- when making transitions between actions.
- @deprecated: use the L{blendIn} property
- @param blendin: the number of frames in transition.
- @type blendin: float
- """
-
- def setPriority(priority):
- """
- Sets the priority of this actuator.
-
- @deprecated: Use use the L{priority} property
- @param priority: Specifies the new priority. Actuators will lower
- priority numbers will override actuators with higher
- numbers.
- @type priority: integer
- """
- def setFrame(frame):
- """
- Sets the current frame for the animation.
-
- @deprecated: use the L{frame} property
- @param frame: Specifies the new current frame for the animation
- @type frame: float
- """
-
- def setProperty(prop):
- """
- Sets the property to be used in FromProp playback mode.
-
- @deprecated: use the L{property} property
- @param prop: the name of the property to use.
- @type prop: string.
- """
-
- def setBlendtime(blendtime):
- """
- Sets the internal frame timer.
-
- Allows the script to directly modify the internal timer
- used when generating transitions between actions.
-
- @deprecated: use the L{blendTime} property
- @param blendtime: The new time. This parameter must be in the range from 0.0 to 1.0.
- @type blendtime: float
- """
-
- def setType(mode):
- """
- Sets the operation mode of the actuator
-
- @deprecated: use the L{type} property
- @param mode: KX_ACTIONACT_PLAY, KX_ACTIONACT_PROPERTY, KX_ACTIONACT_FLIPPER, KX_ACTIONACT_LOOPSTOP, KX_ACTIONACT_LOOPEND
- @type mode: integer
- """
-
- def setContinue(cont):
- """
- Set the actions continue option True or False. see getContinue.
-
- @deprecated: use the L{useContinue} property
- @param cont: The continue option.
- @type cont: bool
- """
-
- def getType():
- """
- Returns the operation mode of the actuator
-
- @deprecated: use the L{type} property
- @rtype: integer
- @return: KX_ACTIONACT_PLAY, KX_ACTIONACT_PROPERTY, KX_ACTIONACT_FLIPPER, KX_ACTIONACT_LOOPSTOP, KX_ACTIONACT_LOOPEND
- """
-
- def getContinue():
- """
- When True, the action will always play from where last left off, otherwise negative events to this actuator will reset it to its start frame.
-
- @deprecated: use the L{useContinue} property
- @rtype: bool
- """
-
- def getAction():
- """
- getAction() returns the name of the action associated with this actuator.
-
- @deprecated: use the L{action} property
- @rtype: string
- """
-
- def getStart():
- """
- Returns the starting frame of the action.
-
- @deprecated: use the L{frameStart} property
- @rtype: float
- """
- def getEnd():
- """
- Returns the last frame of the action.
-
- @deprecated: use the L{frameEnd} property
- @rtype: float
- """
- def getBlendin():
- """
- Returns the number of interpolation animation frames to be generated when this actuator is triggered.
-
- @deprecated: use the L{blendIn} property
- @rtype: float
- """
- def getPriority():
- """
- Returns the priority for this actuator. Actuators with lower Priority numbers will
- override actuators with higher numbers.
-
- @deprecated: use the L{priority} property
- @rtype: integer
- """
- def getFrame():
- """
- Returns the current frame number.
-
- @deprecated: use the L{frame} property
- @rtype: float
- """
- def getProperty():
- """
- Returns the name of the property to be used in FromProp mode.
-
- @deprecated: use the L{property} property
- @rtype: string
- """
- def setFrameProperty(prop):
- """
- @deprecated: use the L{framePropName} property
- @param prop: A string specifying the property of the object that will be updated with the action frame number.
- @type prop: string
- """
- def getFrameProperty():
- """
- Returns the name of the property that is set to the current frame number.
-
- @deprecated: use the L{framePropName} property
- @rtype: string
- """
-#}
-
-class BL_Shader(PyObjectPlus):
- """
- BL_Shader GLSL shaders.
-
- TODO - Description
- """
-
- def setUniformfv(name, fList):
- """
- Set a uniform with a list of float values
-
- @param name: the uniform name
- @type name: string
-
- @param fList: a list (2, 3 or 4 elements) of float values
- @type fList: list[float]
- """
-
- def delSource():
- """
- Clear the shader. Use this method before the source is changed with L{setSource}.
- """
- def getFragmentProg():
- """
- Returns the fragment program.
-
- @rtype: string
- @return: The fragment program.
- """
- def getVertexProg():
- """
- Get the vertex program.
-
- @rtype: string
- @return: The vertex program.
- """
- def isValid():
- """
- Check if the shader is valid.
-
- @rtype: bool
- @return: True if the shader is valid
- """
- def setAttrib(enum):
- """
- Set attribute location. (The parameter is ignored a.t.m. and the value of "tangent" is always used.)
-
- @param enum: attribute location value
- @type enum: integer
- """
- def setNumberOfPasses( max_pass ):
- """
- Set the maximum number of passes. Not used a.t.m.
-
- @param max_pass: the maximum number of passes
- @type max_pass: integer
- """
- def setSampler(name, index):
- """
- Set uniform texture sample index.
-
- @param name: Uniform name
- @type name: string
-
- @param index: Texture sample index.
- @type index: integer
- """
- def setSource(vertexProgram, fragmentProgram):
- """
- Set the vertex and fragment programs
-
- @param vertexProgram: Vertex program
- @type vertexProgram: string
-
- @param fragmentProgram: Fragment program
- @type fragmentProgram: string
- """
- def setUniform1f(name, fx):
- """
- Set a uniform with 1 float value.
-
- @param name: the uniform name
- @type name: string
-
- @param fx: Uniform value
- @type fx: float
- """
- def setUniform1i(name, ix):
- """
- Set a uniform with an integer value.
-
- @param name: the uniform name
- @type name: string
-
- @param ix: the uniform value
- @type ix: integer
- """
- def setUniform2f(name, fx, fy):
- """
- Set a uniform with 2 float values
-
- @param name: the uniform name
- @type name: string
-
- @param fx: first float value
- @type fx: float
-
- @param fy: second float value
- @type fy: float
- """
- def setUniform2i(name, ix, iy):
- """
- Set a uniform with 2 integer values
-
- @param name: the uniform name
- @type name: string
-
- @param ix: first integer value
- @type ix: integer
-
- @param iy: second integer value
- @type iy: integer
- """
- def setUniform3f(name, fx,fy,fz):
- """
- Set a uniform with 3 float values.
-
- @param name: the uniform name
- @type name: string
-
- @param fx: first float value
- @type fx: float
-
- @param fy: second float value
- @type fy: float
-
- @param fz: third float value
- @type fz: float
- """
- def setUniform3i(name, ix,iy,iz):
- """
- Set a uniform with 3 integer values
-
- @param name: the uniform name
- @type name: string
-
- @param ix: first integer value
- @type ix: integer
-
- @param iy: second integer value
- @type iy: integer
-
- @param iz: third integer value
- @type iz: integer
- """
- def setUniform4f(name, fx,fy,fz,fw):
- """
- Set a uniform with 4 float values.
-
- @param name: the uniform name
- @type name: string
-
- @param fx: first float value
- @type fx: float
-
- @param fy: second float value
- @type fy: float
-
- @param fz: third float value
- @type fz: float
-
- @param fw: fourth float value
- @type fw: float
- """
- def setUniform4i(name, ix,iy,iz, iw):
- """
- Set a uniform with 4 integer values
-
- @param name: the uniform name
- @type name: string
-
- @param ix: first integer value
- @type ix: integer
-
- @param iy: second integer value
- @type iy: integer
-
- @param iz: third integer value
- @type iz: integer
-
- @param iw: fourth integer value
- @type iw: integer
- """
- def setUniformDef(name, type):
- """
- Define a new uniform
-
- @param name: the uniform name
- @type name: string
-
- @param type: uniform type
- @type type: UNI_NONE, UNI_INT, UNI_FLOAT, UNI_INT2, UNI_FLOAT2, UNI_INT3, UNI_FLOAT3, UNI_INT4, UNI_FLOAT4, UNI_MAT3, UNI_MAT4, UNI_MAX
- """
- def setUniformMatrix3(name, mat, transpose):
- """
- Set a uniform with a 3x3 matrix value
-
- @param name: the uniform name
- @type name: string
-
- @param mat: A 3x3 matrix [[f,f,f], [f,f,f], [f,f,f]]
- @type mat: 3x3 matrix
-
- @param transpose: set to True to transpose the matrix
- @type transpose: bool
- """
- def setUniformMatrix4(name, mat, transpose):
- """
- Set a uniform with a 4x4 matrix value
-
- @param name: the uniform name
- @type name: string
-
- @param mat: A 4x4 matrix [[f,f,f,f], [f,f,f,f], [f,f,f,f], [f,f,f,f]]
- @type mat: 4x4 matrix
-
- @param transpose: set to True to transpose the matrix
- @type transpose: bool
- """
- def setUniformiv(name, iList):
- """
- Set a uniform with a list of integer values
-
- @param name: the uniform name
- @type name: string
-
- @param iList: a list (2, 3 or 4 elements) of integer values
- @type iList: list[integer]
- """
- def validate():
- """
- Validate the shader object.
-
- """
-
-class BL_ShapeActionActuator(SCA_IActuator):
- """
- ShapeAction Actuators apply an shape action to an mesh object.\
-
- @ivar action: The name of the action to set as the current shape action.
- @type action: string
- @ivar frameStart: Specifies the starting frame of the shape animation.
- @type frameStart: float
- @ivar frameEnd: Specifies the ending frame of the shape animation.
- @type frameEnd: float
- @ivar blendIn: Specifies the number of frames of animation to generate when making transitions between actions.
- @type blendIn: float
- @ivar priority: Sets the priority of this actuator. Actuators will lower
- priority numbers will override actuators with higher
- numbers.
- @type priority: integer
- @ivar frame: Sets the current frame for the animation.
- @type frame: float
- @ivar propName: Sets the property to be used in FromProp playback mode.
- @type propName: string
- @ivar blendTime: Sets the internal frame timer. This property must be in
- the range from 0.0 to blendin.
- @type blendTime: float
- @ivar mode: The operation mode of the actuator.
- KX_ACTIONACT_PLAY, KX_ACTIONACT_PROPERTY, KX_ACTIONACT_FLIPPER,
- KX_ACTIONACT_LOOPSTOP, KX_ACTIONACT_LOOPEND
- @type mode: integer
- @ivar framePropName: The name of the property that is set to the current frame number.
- @type framePropName: string
-
- """
-#{ Deprecated
- def setAction(action, reset = True):
- """
- Sets the current action.
-
- @deprecated: use the L{action} property
- @param action: The name of the action to set as the current action.
- @type action: string
- @param reset: Optional parameter indicating whether to reset the
- blend timer or not. A value of 1 indicates that the
- timer should be reset. A value of 0 will leave it
- unchanged. If reset is not specified, the timer will
- be reset.
- """
-
- def setStart(start):
- """
- Specifies the starting frame of the animation.
-
- @deprecated: use the L{frameStart} property
- @param start: the starting frame of the animation
- @type start: float
- """
-
- def setEnd(end):
- """
- Specifies the ending frame of the animation.
-
- @deprecated: use the L{frameEnd} property
- @param end: the ending frame of the animation
- @type end: float
- """
- def setBlendin(blendin):
- """
- Specifies the number of frames of animation to generate
- when making transitions between actions.
-
- @deprecated: use the L{blendIn} property
- @param blendin: the number of frames in transition.
- @type blendin: float
- """
-
- def setPriority(priority):
- """
- Sets the priority of this actuator.
-
- @deprecated: use the L{priority} property
- @param priority: Specifies the new priority. Actuators will lower
- priority numbers will override actuators with higher
- numbers.
- @type priority: integer
- """
- def setFrame(frame):
- """
- Sets the current frame for the animation.
-
- @deprecated: use the L{frame} property
- @param frame: Specifies the new current frame for the animation
- @type frame: float
- """
-
- def setProperty(prop):
- """
- Sets the property to be used in FromProp playback mode.
-
- @deprecated: use the L{property} property
- @param prop: the name of the property to use.
- @type prop: string.
- """
-
- def setBlendtime(blendtime):
- """
- Sets the internal frame timer.
-
- Allows the script to directly modify the internal timer
- used when generating transitions between actions.
-
- @deprecated: use the L{blendTime} property
- @param blendtime: The new time. This parameter must be in the range from 0.0 to 1.0.
- @type blendtime: float
- """
-
- def setType(mode):
- """
- Sets the operation mode of the actuator
-
- @deprecated: use the L{type} property
- @param mode: KX_ACTIONACT_PLAY, KX_ACTIONACT_PROPERTY, KX_ACTIONACT_FLIPPER, KX_ACTIONACT_LOOPSTOP, KX_ACTIONACT_LOOPEND
- @type mode: integer
- """
-
- def getType():
- """
- Returns the operation mode of the actuator
-
- @deprecated: use the L{type} property
- @rtype: integer
- @return: KX_ACTIONACT_PLAY, KX_ACTIONACT_PROPERTY, KX_ACTIONACT_FLIPPER, KX_ACTIONACT_LOOPSTOP, KX_ACTIONACT_LOOPEND
- """
-
- def getAction():
- """
- getAction() returns the name of the action associated with this actuator.
-
- @deprecated: use the L{action} property
- @rtype: string
- """
-
- def getStart():
- """
- Returns the starting frame of the action.
-
- @deprecated: use the L{frameStart} property
- @rtype: float
- """
- def getEnd():
- """
- Returns the last frame of the action.
-
- @deprecated: use the L{frameEnd} property
- @rtype: float
- """
- def getBlendin():
- """
- Returns the number of interpolation animation frames to be generated when this actuator is triggered.
-
- @deprecated: use the L{blendIn} property
- @rtype: float
- """
- def getPriority():
- """
- Returns the priority for this actuator. Actuators with lower Priority numbers will
- override actuators with higher numbers.
-
- @deprecated: use the L{priority} property
- @rtype: integer
- """
- def getFrame():
- """
- Returns the current frame number.
-
- @deprecated: use the L{frame} property
- @rtype: float
- """
- def getProperty():
- """
- Returns the name of the property to be used in FromProp mode.
-
- @deprecated: use the L{property} property
- @rtype: string
- """
- def setFrameProperty(prop):
- """
- @deprecated: use the L{framePropName} property
- @param prop: A string specifying the property of the object that will be updated with the action frame number.
- @type prop: string
- """
- def getFrameProperty():
- """
- Returns the name of the property that is set to the current frame number.
-
- @deprecated: use the L{framePropName} property
- @rtype: string
- """
-#}
-
-class CListValue(CPropValue):
- """
- CListValue
-
- This is a list like object used in the game engine internally that behaves similar to a python list in most ways.
-
- As well as the normal index lookup.
- C{val= clist[i]}
-
- CListValue supports string lookups.
- C{val= scene.objects["Cube"]}
-
- Other operations such as C{len(clist), list(clist), clist[0:10]} are also supported.
- """
- def append(val):
- """
- Add an item to the list (like pythons append)
-
- Warning: Appending values to the list can cause crashes when the list is used internally by the game engine.
- """
-
- def count(val):
- """
- Count the number of instances of a value in the list.
-
- @rtype: integer
- @return: number of instances
- """
- def index(val):
- """
- Return the index of a value in the list.
-
- @rtype: integer
- @return: The index of the value in the list.
- """
- def reverse():
- """
- Reverse the order of the list.
- """
- def get(key, default=None):
- """
- Return the value matching key, or the default value if its not found.
- @return: The key value or a default.
- """
- def from_id(id):
- """
- This is a funtion especially for the game engine to return a value with a spesific id.
-
- Since object names are not always unique, the id of an object can be used to get an object from the CValueList.
-
- Example.
-
- C{myObID = id(gameObject)}
-
- C{...}
-
- C{ob= scene.objects.from_id(myObID)}
-
- Where myObID is an int or long from the id function.
-
- This has the advantage that you can store the id in places you could not store a gameObject.
-
- Warning: the id is derived from a memory location and will be different each time the game engine starts.
- """
-
-class KX_BlenderMaterial(PyObjectPlus): # , RAS_IPolyMaterial)
- """
- KX_BlenderMaterial
-
- """
-
- def getShader():
- """
- Returns the material's shader.
-
- @rtype: L{BL_Shader}
- @return: the material's shader
- """
-
- def setBlending(src, dest):
- """
- Set the pixel color arithmetic functions.
-
- @param src: Specifies how the red, green, blue,
- and alpha source blending factors are computed.
- @type src: GL_ZERO,
- GL_ONE,
- GL_SRC_COLOR,
- GL_ONE_MINUS_SRC_COLOR,
- GL_DST_COLOR,
- GL_ONE_MINUS_DST_COLOR,
- GL_SRC_ALPHA,
- GL_ONE_MINUS_SRC_ALPHA,
- GL_DST_ALPHA,
- GL_ONE_MINUS_DST_ALPHA,
- GL_SRC_ALPHA_SATURATE
-
-
- @param dest: Specifies how the red, green, blue,
- and alpha destination blending factors are computed.
- @type dest: GL_ZERO,
- GL_ONE,
- GL_SRC_COLOR,
- GL_ONE_MINUS_SRC_COLOR,
- GL_DST_COLOR,
- GL_ONE_MINUS_DST_COLOR,
- GL_SRC_ALPHA,
- GL_ONE_MINUS_SRC_ALPHA,
- GL_DST_ALPHA,
- GL_ONE_MINUS_DST_ALPHA,
- GL_SRC_ALPHA_SATURATE
-
- """
- def getMaterialIndex():
- """
- Returns the material's index.
-
- @rtype: integer
- @return: the material's index
- """
-
-class KX_CameraActuator(SCA_IActuator):
- """
- Applies changes to a camera.
-
- @ivar min: minimum distance to the target object maintained by the actuator
- @type min: float
- @ivar max: maximum distance to stay from the target object
- @type max: float
- @ivar height: height to stay above the target object
- @type height: float
- @ivar useXY: axis this actuator is tracking, true=X, false=Y
- @type useXY: boolean
- @ivar object: the object this actuator tracks.
- @type object: L{KX_GameObject} or None
- @author: snail
- """
-#{ Deprecated
- def getObject(name_only = 1):
- """
- Returns the name of the object this actuator tracks.
-
- @deprecated: Use the L{object} attribute instead.
- @type name_only: bool
- @param name_only: optional argument, when 0 return a KX_GameObject
- @rtype: string, L{KX_GameObject} or None if no object is set
- """
-
- def setObject(target):
- """
- Sets the object this actuator tracks.
-
- @deprecated: Use the L{object} attribute instead.
- @param target: the object to track.
- @type target: L{KX_GameObject}, string or None
- """
-
- def getMin():
- """
- Returns the minimum distance to target maintained by the actuator.
-
- @deprecated: Use the L{min} attribute instead.
- @rtype: float
- """
-
- def setMin(distance):
- """
- Sets the minimum distance to the target object maintained by the
- actuator.
-
- @deprecated: Use the L{min} attribute instead.
- @param distance: The minimum distance to maintain.
- @type distance: float
- """
-
- def getMax():
- """
- Gets the maximum distance to stay from the target object.
-
- @deprecated: Use the L{max} attribute instead.
- @rtype: float
- """
-
- def setMax(distance):
- """
- Sets the maximum distance to stay from the target object.
-
- @deprecated: Use the L{max} attribute instead.
- @param distance: The maximum distance to maintain.
- @type distance: float
- """
-
- def getHeight():
- """
- Returns the height to stay above the target object.
-
- @deprecated: Use the L{height} attribute instead.
- @rtype: float
- """
-
- def setHeight(height):
- """
- Sets the height to stay above the target object.
-
- @deprecated: Use the L{height} attribute instead.
- @type height: float
- @param height: The height to stay above the target object.
- """
-
- def setXY(xaxis):
- """
- Sets the axis to get behind.
-
- @deprecated: Use the L{useXY} attribute instead.
- @param xaxis: False to track Y axis, True to track X axis.
- @type xaxis: boolean
- """
-
- def getXY():
- """
- Returns the axis this actuator is tracking.
-
- @deprecated: Use the L{useXY} attribute instead.
- @return: True if tracking X axis, False if tracking Y axis.
- @rtype: boolean
- """
-#}
-
-class KX_ConstraintActuator(SCA_IActuator):
- """
- A constraint actuator limits the position, rotation, distance or orientation of an object.
-
- Properties:
-
- @ivar damp: time constant of the constraint expressed in frame (not use by Force field constraint)
- @type damp: integer
-
- @ivar rotDamp: time constant for the rotation expressed in frame (only for the distance constraint)
- 0 = use damp for rotation as well
- @type rotDamp: integer
-
- @ivar direction: the reference direction in world coordinate for the orientation constraint
- @type direction: 3-tuple of float: [x,y,z]
-
- @ivar option: Binary combination of the following values:
- Applicable to Distance constraint:
- - KX_ACT_CONSTRAINT_NORMAL ( 64) : Activate alignment to surface
- - KX_ACT_CONSTRAINT_DISTANCE ( 512) : Activate distance control
- - KX_ACT_CONSTRAINT_LOCAL (1024) : direction of the ray is along the local axis
- Applicable to Force field constraint:
- - KX_ACT_CONSTRAINT_DOROTFH (2048) : Force field act on rotation as well
- Applicable to both:
- - KX_ACT_CONSTRAINT_MATERIAL ( 128) : Detect material rather than property
- - KX_ACT_CONSTRAINT_PERMANENT ( 256) : No deactivation if ray does not hit target
- @type option: integer
-
- @ivar time: activation time of the actuator. The actuator disables itself after this many frame.
- If set to 0, the actuator is not limited in time.
- @type time: integer
-
- @ivar propName: the name of the property or material for the ray detection of the distance constraint.
- @type propName: string
-
- @ivar min: The lower bound of the constraint
- For the rotation and orientation constraint, it represents radiant
- @type min: float
-
- @ivar distance: the target distance of the distance constraint
- @type distance: float
-
- @ivar max: the upper bound of the constraint.
- For rotation and orientation constraints, it represents radiant.
- @type max: float
-
- @ivar rayLength: the length of the ray of the distance constraint.
- @type rayLength: float
-
- @ivar limit: type of constraint, use one of the following constant:
- KX_ACT_CONSTRAINT_LOCX ( 1) : limit X coord
- KX_ACT_CONSTRAINT_LOCY ( 2) : limit Y coord
- KX_ACT_CONSTRAINT_LOCZ ( 3) : limit Z coord
- KX_ACT_CONSTRAINT_ROTX ( 4) : limit X rotation
- KX_ACT_CONSTRAINT_ROTY ( 5) : limit Y rotation
- KX_ACT_CONSTRAINT_ROTZ ( 6) : limit Z rotation
- KX_ACT_CONSTRAINT_DIRPX ( 7) : set distance along positive X axis
- KX_ACT_CONSTRAINT_DIRPY ( 8) : set distance along positive Y axis
- KX_ACT_CONSTRAINT_DIRPZ ( 9) : set distance along positive Z axis
- KX_ACT_CONSTRAINT_DIRNX (10) : set distance along negative X axis
- KX_ACT_CONSTRAINT_DIRNY (11) : set distance along negative Y axis
- KX_ACT_CONSTRAINT_DIRNZ (12) : set distance along negative Z axis
- KX_ACT_CONSTRAINT_ORIX (13) : set orientation of X axis
- KX_ACT_CONSTRAINT_ORIY (14) : set orientation of Y axis
- KX_ACT_CONSTRAINT_ORIZ (15) : set orientation of Z axis
- KX_ACT_CONSTRAINT_FHPX (16) : set force field along positive X axis
- KX_ACT_CONSTRAINT_FHPY (17) : set force field along positive Y axis
- KX_ACT_CONSTRAINT_FHPZ (18) : set force field along positive Z axis
- KX_ACT_CONSTRAINT_FHNX (19) : set force field along negative X axis
- KX_ACT_CONSTRAINT_FHNY (20) : set force field along negative Y axis
- KX_ACT_CONSTRAINT_FHNZ (21) : set force field along negative Z axis
- @type limit: integer
- """
-#{ Deprecated
- def setDamp(time):
- """
- Sets the time this constraint is delayed.
-
- @param time: The number of frames to delay.
- Negative values are ignored.
- @type time: integer
- """
- def getDamp():
- """
- Returns the damping time of the constraint.
-
- @rtype: integer
- """
- def setMin(lower):
- """
- Sets the lower bound of the constraint.
-
- For rotational and orientation constraints, lower is specified in degrees.
-
- @type lower: float
- """
- def getMin():
- """
- Gets the lower bound of the constraint.
-
- For rotational and orientation constraints, the lower bound is returned in radians.
-
- @rtype: float
- """
- def setMax(upper):
- """
- Sets the upper bound of the constraint.
-
- For rotational and orientation constraints, upper is specified in degrees.
-
- @type upper: float
- """
- def getMax():
- """
- Gets the upper bound of the constraint.
-
- For rotational and orientation constraints, the upper bound is returned in radians.
-
- @rtype: float
- """
- def setLimit(limit):
- """
- Sets the type of constraint.
-
- See module L{GameLogic} for valid constraint types.
-
- @param limit:
- Position constraints: KX_CONSTRAINTACT_LOCX, KX_CONSTRAINTACT_LOCY, KX_CONSTRAINTACT_LOCZ
- Rotation constraints: KX_CONSTRAINTACT_ROTX, KX_CONSTRAINTACT_ROTY or KX_CONSTRAINTACT_ROTZ
- Distance contraints: KX_ACT_CONSTRAINT_DIRPX, KX_ACT_CONSTRAINT_DIRPY, KX_ACT_CONSTRAINT_DIRPZ, KX_ACT_CONSTRAINT_DIRNX, KX_ACT_CONSTRAINT_DIRNY, KX_ACT_CONSTRAINT_DIRNZ
- Orientation constraints: KX_ACT_CONSTRAINT_ORIX, KX_ACT_CONSTRAINT_ORIY, KX_ACT_CONSTRAINT_ORIZ
- """
- def getLimit():
- """
- Gets the type of constraint.
-
- See module L{GameLogic} for valid constraints.
-
- @return:
- Position constraints: KX_CONSTRAINTACT_LOCX, KX_CONSTRAINTACT_LOCY, KX_CONSTRAINTACT_LOCZ,
- Rotation constraints: KX_CONSTRAINTACT_ROTX, KX_CONSTRAINTACT_ROTY, KX_CONSTRAINTACT_ROTZ,
- Distance contraints: KX_ACT_CONSTRAINT_DIRPX, KX_ACT_CONSTRAINT_DIRPY, KX_ACT_CONSTRAINT_DIRPZ, KX_ACT_CONSTRAINT_DIRNX, KX_ACT_CONSTRAINT_DIRNY, KX_ACT_CONSTRAINT_DIRNZ,
- Orientation constraints: KX_ACT_CONSTRAINT_ORIX, KX_ACT_CONSTRAINT_ORIY, KX_ACT_CONSTRAINT_ORIZ
- """
- def setRotDamp(duration):
- """
- Sets the time constant of the orientation constraint.
-
- @param duration: If the duration is negative, it is set to 0.
- @type duration: integer
- """
- def getRotDamp():
- """
- Returns the damping time for application of the constraint.
-
- @rtype: integer
- """
- def setDirection(vector):
- """
- Sets the reference direction in world coordinate for the orientation constraint
-
- @type vector: 3-tuple
- """
- def getDirection():
- """
- Returns the reference direction of the orientation constraint in world coordinate.
-
- @rtype: 3-tuple
- """
- def setOption(option):
- """
- Sets several options of the distance constraint.
-
- @type option: integer
- @param option: Binary combination of the following values:
- 64 : Activate alignment to surface
- 128 : Detect material rather than property
- 256 : No deactivation if ray does not hit target
- 512 : Activate distance control
- """
- def getOption():
- """
- Returns the option parameter.
-
- @rtype: integer
- """
- def setTime(duration):
- """
- Sets the activation time of the actuator.
-
- @type duration: integer
- @param duration: The actuator disables itself after this many frame.
- If set to 0 or negative, the actuator is not limited in time.
- """
- def getTime():
- """
- Returns the time parameter.
-
- @rtype: integer
- """
- def setProperty(property):
- """
- Sets the name of the property or material for the ray detection of the distance constraint.
-
- @type property: string
- @param property: If empty, the ray will detect any collisioning object.
- """
- def getProperty():
- """
- Returns the property parameter.
-
- @rtype: string
- """
- def setDistance(distance):
- """
- Sets the target distance in distance constraint.
-
- @type distance: float
- """
- def getDistance():
- """
- Returns the distance parameter.
-
- @rtype: float
- """
- def setRayLength(length):
- """
- Sets the maximum ray length of the distance constraint.
-
- @type length: float
- """
- def getRayLength():
- """
- Returns the length of the ray
-
- @rtype: float
- """
-#}
-
-class KX_ConstraintWrapper(PyObjectPlus):
- """
- KX_ConstraintWrapper
-
- """
- def getConstraintId(val):
- """
- Returns the contraint's ID
-
- @rtype: integer
- @return: the constraint's ID
- """
-
-class KX_GameActuator(SCA_IActuator):
- """
- The game actuator loads a new .blend file, restarts the current .blend file or quits the game.
-
- Properties:
-
- @ivar fileName: the new .blend file to load
- @type fileName: string.
- @ivar mode: The mode of this actuator
- @type mode: Constant in...
- - L{GameLogic.KX_GAME_LOAD}
- - L{GameLogic.KX_GAME_START}
- - L{GameLogic.KX_GAME_RESTART}
- - L{GameLogic.KX_GAME_QUIT}
- - L{GameLogic.KX_GAME_SAVECFG}
- - L{GameLogic.KX_GAME_LOADCFG}
- """
-#{ Deprecated
- def getFile():
- """
- Returns the filename of the new .blend file to load.
-
- @deprecated: use the L{fileName} property
- @rtype: string
- """
- def setFile(filename):
- """
- Sets the new .blend file to load.
-
- @deprecated: use the L{fileName} property
- @param filename: The file name this actuator will load.
- @type filename: string
- """
-#}
-
-class KX_GameObject(SCA_IObject):
- """
- All game objects are derived from this class.
-
- Properties assigned to game objects are accessible as attributes of this class.
- - note: Calling ANY method or attribute on an object that has been removed from a scene will raise a SystemError, if an object may have been removed since last accessing it use the L{invalid} attribute to check.
-
- @ivar name: The object's name. (read-only)
- @type name: string.
- @ivar mass: The object's mass
- - note: The object must have a physics controller for the mass to be applied, otherwise the mass value will be returned as 0.0
- @type mass: float
- @ivar linVelocityMin: Enforces the object keeps moving at a minimum velocity.
- - note: Applies to dynamic and rigid body objects only.
- - note: A value of 0.0 disables this option.
- - note: While objects are stationary the minimum velocity will not be applied.
- @type linVelocityMin: float
- @ivar linVelocityMax: Clamp the maximum linear velocity to prevent objects moving beyond a set speed.
- - note: Applies to dynamic and rigid body objects only.
- - note: A value of 0.0 disables this option (rather then setting it stationary).
- @type linVelocityMax: float
- @ivar localInertia: the object's inertia vector in local coordinates. Read only.
- @type localInertia: list [ix, iy, iz]
- @ivar parent: The object's parent object. (read-only)
- @type parent: L{KX_GameObject} or None
- @ivar visible: visibility flag.
- - note: Game logic will still run for invisible objects.
- @type visible: boolean
- @ivar color: The object color of the object
- @type color: list [r, g, b, a]
- @ivar occlusion: occlusion capability flag.
- @type occlusion: boolean
- @ivar position: The object's position.
-
- deprecated: use L{localPosition} and L{worldPosition}
- @type position: list [x, y, z] On write: local position, on read: world position
- @ivar orientation: The object's orientation. 3x3 Matrix. You can also write a Quaternion or Euler vector.
-
- deprecated: use L{localOrientation} and L{worldOrientation}
- @type orientation: 3x3 Matrix [[float]] On write: local orientation, on read: world orientation
- @ivar scaling: The object's scaling factor. list [sx, sy, sz]
-
- deprecated: use L{localScale} and L{worldScale}
- @type scaling: list [sx, sy, sz] On write: local scaling, on read: world scaling
- @ivar localOrientation: The object's local orientation. 3x3 Matrix. You can also write a Quaternion or Euler vector.
- @type localOrientation: 3x3 Matrix [[float]]
- @ivar worldOrientation: The object's world orientation.
- @type worldOrientation: 3x3 Matrix [[float]]
- @ivar localScale: The object's local scaling factor.
- @type localScale: list [sx, sy, sz]
- @ivar worldScale: The object's world scaling factor. Read-only
- @type worldScale: list [sx, sy, sz]
- @ivar localPosition: The object's local position.
- @type localPosition: list [x, y, z]
- @ivar worldPosition: The object's world position.
- @type worldPosition: list [x, y, z]
- @ivar timeOffset: adjust the slowparent delay at runtime.
- @type timeOffset: float
- @ivar state: the game object's state bitmask, using the first 30 bits, one bit must always be set.
- @type state: int
- @ivar meshes: a list meshes for this object.
- - note: Most objects use only 1 mesh.
- - note: Changes to this list will not update the KX_GameObject.
- @type meshes: list of L{KX_MeshProxy}
- @ivar sensors: a sequence of L{SCA_ISensor} objects with string/index lookups and iterator support.
- - note: This attribute is experemental and may be removed (but probably wont be).
- - note: Changes to this list will not update the KX_GameObject.
- @type sensors: list
- @ivar controllers: a sequence of L{SCA_IController} objects with string/index lookups and iterator support.
- - note: This attribute is experemental and may be removed (but probably wont be).
- - note: Changes to this list will not update the KX_GameObject.
- @type controllers: list of L{SCA_ISensor}.
- @ivar actuators: a list of L{SCA_IActuator} with string/index lookups and iterator support.
- - note: This attribute is experemental and may be removed (but probably wont be).
- - note: Changes to this list will not update the KX_GameObject.
- @type actuators: list
- @ivar attrDict: get the objects internal python attribute dictionary for direct (faster) access.
- @type attrDict: dict
- @ivar children: direct children of this object, (read-only).
- @type children: L{CListValue} of L{KX_GameObject}'s
- @ivar childrenRecursive: all children of this object including childrens children, (read-only).
- @type childrenRecursive: L{CListValue} of L{KX_GameObject}'s
- @group Deprecated: getPosition, setPosition, setWorldPosition, getOrientation, setOrientation, getState, setState, getParent, getVisible, getMass, getMesh, getChildren, getChildrenRecursive
- @group Property Access: get, attrDict, getPropertyNames
- """
- def endObject():
- """
- Delete this object, can be used in place of the EndObject Actuator.
- The actual removal of the object from the scene is delayed.
- """
- def replaceMesh(mesh, useDisplayMesh=True, usePhysicsMesh=False):
- """
- Replace the mesh of this object with a new mesh. This works the same was as the actuator.
- @type mesh: L{KX_MeshProxy} or mesh name
- @type useDisplayMesh: bool
- @param useDisplayMesh: when enabled the display mesh will be replaced (optional argument).
- @type usePhysicsMesh: bool
- @param usePhysicsMesh: when enabled the physics mesh will be replaced (optional argument).
- """
- def getVisible():
- """
- Gets the game object's visible flag.
-
- @deprecated: use L{visible}
- @rtype: boolean
- """
- def setVisible(visible, recursive):
- """
- Sets the game object's visible flag.
-
- @type visible: boolean
- @type recursive: boolean
- @param recursive: optional argument to set all childrens visibility flag too.
- """
- def setOcclusion(occlusion, recursive):
- """
- Sets the game object's occlusion capability.
-
- @type occlusion: boolean
- @type recursive: boolean
- @param recursive: optional argument to set all childrens occlusion flag too.
- """
- def getState():
- """
- Gets the game object's state bitmask.
-
- @deprecated: use L{state}
- @rtype: int
- @return: the objects state.
- """
- def setState(state):
- """
- Sets the game object's state flag.
- The bitmasks for states from 1 to 30 can be set with (1<<0, 1<<1, 1<<2 ... 1<<29)
- @deprecated: use L{state}
- @type state: integer
- """
- def setPosition(pos):
- """
- Sets the game object's position.
- Global coordinates for root object, local for child objects.
-
- @deprecated: use L{localPosition}
- @type pos: [x, y, z]
- @param pos: the new position, in local coordinates.
- """
- def setWorldPosition(pos):
- """
- Sets the game object's position in world coordinates regardless if the object is root or child.
-
- @deprecated: use L{worldPosition}
- @type pos: [x, y, z]
- @param pos: the new position, in world coordinates.
- """
- def getPosition():
- """
- Gets the game object's position.
-
- @deprecated: use L{worldPosition}
- @rtype: list [x, y, z]
- @return: the object's position in world coordinates.
- """
- def setOrientation(orn):
- """
- Sets the game object's orientation.
-
- @deprecated: use L{localOrientation}
- @type orn: 3x3 rotation matrix, or Quaternion.
- @param orn: a rotation matrix specifying the new rotation.
- @note: When using this matrix with Blender.mathutils.Matrix() types, it will need to be transposed.
- """
- def alignAxisToVect(vect, axis, factor):
- """
- Aligns any of the game object's axis along the given vector.
-
- @type vect: 3d vector.
- @param vect: a vector to align the axis.
- @type axis: integer.
- @param axis:The axis you want to align
- - 0: X axis
- - 1: Y axis
- - 2: Z axis (default)
- @type factor: float
- @param factor: Only rotate a feaction of the distance to the target vector (0.0 - 1.0)
- """
- def getAxisVect(vect):
- """
- Returns the axis vector rotates by the objects worldspace orientation.
- This is the equivalent of multiplying the vector by the orientation matrix.
-
- @type vect: 3d vector.
- @param vect: a vector to align the axis.
- @rtype: 3d vector.
- @return: The vector in relation to the objects rotation.
-
- """
- def getOrientation():
- """
- Gets the game object's orientation.
-
- @deprecated: use L{worldOrientation}
- @rtype: 3x3 rotation matrix
- @return: The game object's rotation matrix
- @note: When using this matrix with Blender.mathutils.Matrix() types, it will need to be transposed.
- """
- def applyMovement(movement, local = 0):
- """
- Sets the game object's movement.
-
- @type movement: 3d vector.
- @param movement: movement vector.
- @type local: boolean
- @param local: - False: you get the "global" movement ie: relative to world orientation (default).
- - True: you get the "local" movement ie: relative to object orientation.
- """
- def applyRotation(rotation, local = 0):
- """
- Sets the game object's rotation.
-
- @type rotation: 3d vector.
- @param rotation: rotation vector.
- @type local: boolean
- @param local: - False: you get the "global" rotation ie: relative to world orientation (default).
- - True: you get the "local" rotation ie: relative to object orientation.
- """
- def applyForce(force, local = 0):
- """
- Sets the game object's force.
-
- This requires a dynamic object.
-
- @type force: 3d vector.
- @param force: force vector.
- @type local: boolean
- @param local: - False: you get the "global" force ie: relative to world orientation (default).
- - True: you get the "local" force ie: relative to object orientation.
- """
- def applyTorque(torque, local = 0):
- """
- Sets the game object's torque.
-
- This requires a dynamic object.
-
- @type torque: 3d vector.
- @param torque: torque vector.
- @type local: boolean
- @param local: - False: you get the "global" torque ie: relative to world orientation (default).
- - True: you get the "local" torque ie: relative to object orientation.
- """
- def getLinearVelocity(local = 0):
- """
- Gets the game object's linear velocity.
-
- This method returns the game object's velocity through it's centre of mass,
- ie no angular velocity component.
-
- @type local: boolean
- @param local: - False: you get the "global" velocity ie: relative to world orientation (default).
- - True: you get the "local" velocity ie: relative to object orientation.
- @rtype: list [vx, vy, vz]
- @return: the object's linear velocity.
- """
- def setLinearVelocity(velocity, local = 0):
- """
- Sets the game object's linear velocity.
-
- This method sets game object's velocity through it's centre of mass,
- ie no angular velocity component.
-
- This requires a dynamic object.
-
- @type velocity: 3d vector.
- @param velocity: linear velocity vector.
- @type local: boolean
- @param local: - False: you get the "global" velocity ie: relative to world orientation (default).
- - True: you get the "local" velocity ie: relative to object orientation.
- """
- def getAngularVelocity(local = 0):
- """
- Gets the game object's angular velocity.
-
- @type local: boolean
- @param local: - False: you get the "global" velocity ie: relative to world orientation (default).
- - True: you get the "local" velocity ie: relative to object orientation.
- @rtype: list [vx, vy, vz]
- @return: the object's angular velocity.
- """
- def setAngularVelocity(velocity, local = 0):
- """
- Sets the game object's angular velocity.
-
- This requires a dynamic object.
-
- @type velocity: 3d vector.
- @param velocity: angular velocity vector.
- @type local: boolean
- @param local: - False: you get the "global" velocity ie: relative to world orientation (default).
- - True: you get the "local" velocity ie: relative to object orientation.
- """
- def getVelocity(point):
- """
- Gets the game object's velocity at the specified point.
-
- Gets the game object's velocity at the specified point, including angular
- components.
-
- @type point: list [x, y, z]
- @param point: the point to return the velocity for, in local coordinates. (optional: default = [0, 0, 0])
- @rtype: list [vx, vy, vz]
- @return: the velocity at the specified point.
- """
- def getMass():
- """
- Gets the game object's mass.
-
- @deprecated: use L{mass}
- @rtype: float
- @return: the object's mass.
- """
- def getReactionForce():
- """
- Gets the game object's reaction force.
-
- The reaction force is the force applied to this object over the last simulation timestep.
- This also includes impulses, eg from collisions.
-
- (B{This is not implimented for bullet physics at the moment})
-
- @rtype: list [fx, fy, fz]
- @return: the reaction force of this object.
- """
- def applyImpulse(point, impulse):
- """
- Applies an impulse to the game object.
-
- This will apply the specified impulse to the game object at the specified point.
- If point != getPosition(), applyImpulse will also change the object's angular momentum.
- Otherwise, only linear momentum will change.
-
- @type point: list [x, y, z]
- @param point: the point to apply the impulse to (in world coordinates)
- """
- def suspendDynamics():
- """
- Suspends physics for this object.
- """
- def restoreDynamics():
- """
- Resumes physics for this object.
- @Note: The objects linear velocity will be applied from when the dynamics were suspended.
- """
- def enableRigidBody():
- """
- Enables rigid body physics for this object.
-
- Rigid body physics allows the object to roll on collisions.
- @Note: This is not working with bullet physics yet.
- """
- def disableRigidBody():
- """
- Disables rigid body physics for this object.
- @Note: This is not working with bullet physics yet. The angular is removed but rigid body physics can still rotate it later.
- """
- def getParent():
- """
- Gets this object's parent.
-
- @deprecated: use L{parent}
- @rtype: L{KX_GameObject}
- @return: this object's parent object, or None if this object has no parent.
- """
- def setParent(parent,compound,ghost):
- """
- Sets this object's parent.
- Control the shape status with the optional compound and ghost parameters:
- compound=1: the object shape should be added to the parent compound shape (default)
- compound=0: the object should keep its individual shape.
- In that case you can control if it should be ghost or not:
- ghost=1 if the object should be made ghost while parented (default)
- ghost=0 if the object should be solid while parented
- Note: if the object type is sensor, it stays ghost regardless of ghost parameter
-
- @type parent: L{KX_GameObject}
- @param parent: new parent object.
- @type compound: int
- @param compound: whether the shape should be added to the parent compound shape
- @type ghost: int
- @param ghost: whether the object should be ghost while parented
- """
- def removeParent():
- """
- Removes this objects parent.
- """
- def getChildren():
- """
- Return a list of immediate children of this object.
- @rtype: L{CListValue} of L{KX_GameObject}
- @return: a list of all this objects children.
- """
- def getChildrenRecursive():
- """
- Return a list of children of this object, including all their childrens children.
- @rtype: L{CListValue} of L{KX_GameObject}
- @return: a list of all this objects children recursivly.
- """
- def getMesh(mesh):
- """
- Gets the mesh object for this object.
-
- @type mesh: integer
- @param mesh: the mesh object to return (optional: default mesh = 0)
- @rtype: L{KX_MeshProxy}
- @return: the first mesh object associated with this game object, or None if this object has no meshs.
- """
- def getPhysicsId():
- """
- Returns the user data object associated with this game object's physics controller.
- """
- def getPropertyNames():
- """
- Gets a list of all property names.
- @rtype: list
- @return: All property names for this object.
- """
- def getDistanceTo(other):
- """
- Returns the distance to another object or point.
-
- @param other: a point or another L{KX_GameObject} to measure the distance to.
- @type other: L{KX_GameObject} or list [x, y, z]
- @rtype: float
- """
- def getVectTo(other):
- """
- Returns the vector and the distance to another object or point.
- The vector is normalized unless the distance is 0, in which a NULL vector is returned.
-
- @param other: a point or another L{KX_GameObject} to get the vector and distance to.
- @type other: L{KX_GameObject} or list [x, y, z]
- @rtype: 3-tuple (float, 3-tuple (x,y,z), 3-tuple (x,y,z))
- @return: (distance, globalVector(3), localVector(3))
- """
- def rayCastTo(other,dist,prop):
- """
- Look towards another point/object and find first object hit within dist that matches prop.
-
- The ray is always casted from the center of the object, ignoring the object itself.
- The ray is casted towards the center of another object or an explicit [x,y,z] point.
- Use rayCast() if you need to retrieve the hit point
-
- @param other: [x,y,z] or object towards which the ray is casted
- @type other: L{KX_GameObject} or 3-tuple
- @param dist: max distance to look (can be negative => look behind); 0 or omitted => detect up to other
- @type dist: float
- @param prop: property name that object must have; can be omitted => detect any object
- @type prop: string
- @rtype: L{KX_GameObject}
- @return: the first object hit or None if no object or object does not match prop
- """
- def rayCast(objto,objfrom,dist,prop,face,xray,poly):
- """
- Look from a point/object to another point/object and find first object hit within dist that matches prop.
- if poly is 0, returns a 3-tuple with object reference, hit point and hit normal or (None,None,None) if no hit.
- if poly is 1, returns a 4-tuple with in addition a L{KX_PolyProxy} as 4th element.
- if poly is 2, returns a 5-tuple with in addition a 2D vector with the UV mapping of the hit point as 5th element.
-
- Ex::
- # shoot along the axis gun-gunAim (gunAim should be collision-free)
- ob,point,normal = gun.rayCast(gunAim,None,50)
- if ob:
- # hit something
-
- Notes:
- The ray ignores the object on which the method is called.
- It is casted from/to object center or explicit [x,y,z] points.
-
- The face paremeter determines the orientation of the normal::
- 0 => hit normal is always oriented towards the ray origin (as if you casted the ray from outside)
- 1 => hit normal is the real face normal (only for mesh object, otherwise face has no effect)
-
- The ray has X-Ray capability if xray parameter is 1, otherwise the first object hit (other than self object) stops the ray.
- The prop and xray parameters interact as follow::
- prop off, xray off: return closest hit or no hit if there is no object on the full extend of the ray.
- prop off, xray on : idem.
- prop on, xray off: return closest hit if it matches prop, no hit otherwise.
- prop on, xray on : return closest hit matching prop or no hit if there is no object matching prop on the full extend of the ray.
- The L{KX_PolyProxy} 4th element of the return tuple when poly=1 allows to retrieve information on the polygon hit by the ray.
- If there is no hit or the hit object is not a static mesh, None is returned as 4th element.
-
- The ray ignores collision-free objects and faces that dont have the collision flag enabled, you can however use ghost objects.
-
- @param objto: [x,y,z] or object to which the ray is casted
- @type objto: L{KX_GameObject} or 3-tuple
- @param objfrom: [x,y,z] or object from which the ray is casted; None or omitted => use self object center
- @type objfrom: L{KX_GameObject} or 3-tuple or None
- @param dist: max distance to look (can be negative => look behind); 0 or omitted => detect up to to
- @type dist: float
- @param prop: property name that object must have; can be omitted or "" => detect any object
- @type prop: string
- @param face: normal option: 1=>return face normal; 0 or omitted => normal is oriented towards origin
- @type face: int
- @param xray: X-ray option: 1=>skip objects that don't match prop; 0 or omitted => stop on first object
- @type xray: int
- @param poly: polygon option: 0,1 or 2 to return a 3-, 4- or 5-tuple with information on the face hit
- 0 or omitted=> return value is a 3-tuple (object, hitpoint, hitnormal) or (None,None,None) if no hit
- 1=>return value is a 4-tuple and the 4th element is a L{KX_PolyProxy} or None if no hit or the object doesn't use a mesh collision shape.
- 2=>return value is a 5-tuple and the 5th element is a 2-tuple (u,v) with the UV mapping of the hit point or None if no hit, or the object doesn't use a mesh collision shape, or doesn't have a UV mapping.
- @type poly: int
- @rtype: 3-tuple (L{KX_GameObject}, 3-tuple (x,y,z), 3-tuple (nx,ny,nz))
- or 4-tuple (L{KX_GameObject}, 3-tuple (x,y,z), 3-tuple (nx,ny,nz), L{KX_PolyProxy})
- or 5-tuple (L{KX_GameObject}, 3-tuple (x,y,z), 3-tuple (nx,ny,nz), L{KX_PolyProxy}, 2-tuple (u,v))
- @return: (object,hitpoint,hitnormal) or (object,hitpoint,hitnormal,polygon) or (object,hitpoint,hitnormal,polygon,hituv)
- object, hitpoint and hitnormal are None if no hit.
- polygon is valid only if the object is valid and is a static object, a dynamic object using mesh collision shape or a soft body object, otherwise it is None
- hituv is valid only if polygon is valid and the object has a UV mapping, otherwise it is None
- """
- def setCollisionMargin(margin):
- """
- Set the objects collision margin.
-
- note: If this object has no physics controller (a physics ID of zero), this function will raise RuntimeError.
-
- @type margin: float
- @param margin: the collision margin distance in blender units.
- """
- def sendMessage(subject, body="", to=""):
- """
- Sends a message.
-
- @param subject: The subject of the message
- @type subject: string
- @param body: The body of the message (optional)
- @type body: string
- @param to: The name of the object to send the message to (optional)
- @type to: string
- """
- def reinstancePhysicsMesh(gameObject, meshObject):
- """
- Updates the physics system with the changed mesh.
-
- If no arguments are given the physics mesh will be re-created from the first mesh assigned to the game object.
-
- @param gameObject: optional argument, set the physics shape from this gameObjets mesh.
- @type gameObject: string, L{KX_GameObject} or None
- @param meshObject: optional argument, set the physics shape from this mesh.
- @type meshObject: string, L{KX_MeshProxy} or None
-
- @note: if this object has instances the other instances will be updated too.
- @note: the gameObject argument has an advantage that it can convert from a mesh with modifiers applied (such as subsurf).
- @warning: only triangle mesh type objects are supported currently (not convex hull)
- @warning: if the object is a part of a combound object it will fail (parent or child)
- @warning: rebuilding the physics mesh can be slow, running many times per second will give a performance hit.
- @rtype: boolean
- @return: True if reinstance succeeded, False if it failed.
- """
-
- def get(key, default=None):
- """
- Return the value matching key, or the default value if its not found.
- @return: The key value or a default.
- """
-
-
-class KX_IpoActuator(SCA_IActuator):
- """
- IPO actuator activates an animation.
-
- @ivar frameStart: Start frame.
- @type frameStart: float
- @ivar frameEnd: End frame.
- @type frameEnd: float
- @ivar propName: Use this property to define the Ipo position
- @type propName: string
- @ivar framePropName: Assign this property this action current frame number
- @type framePropName: string
- @ivar mode: Play mode for the ipo. (In GameLogic.KX_IPOACT_PLAY, KX_IPOACT_PINGPONG, KX_IPOACT_FLIPPER, KX_IPOACT_LOOPSTOP, KX_IPOACT_LOOPEND, KX_IPOACT_FROM_PROP)
- @type mode: int
- @ivar useIpoAsForce: Apply Ipo as a global or local force depending on the local option (dynamic objects only)
- @type useIpoAsForce: bool
- @ivar useIpoAdd: Ipo is added to the current loc/rot/scale in global or local coordinate according to Local flag
- @type useIpoAdd: bool
- @ivar useIpoLocal: Let the ipo acts in local coordinates, used in Force and Add mode.
- @type useIpoLocal: bool
- @ivar useChildren: Update IPO on all children Objects as well
- @type useChildren: bool
- """
-#{ Deprecated
- def set(mode, startframe, endframe, force):
- """
- Sets the properties of the actuator.
-
- @deprecated: use other attributes.
- @param mode: "Play", "PingPong", "Flipper", "LoopStop", "LoopEnd" or "FromProp"
- @type mode: string
- @param startframe: first frame to use
- @type startframe: integer
- @param endframe: last frame to use
- @type endframe: integer
- @param force: special mode
- @type force: integer (0=normal, 1=interpret location as force, 2=additive)
- """
- def setProperty(property):
- """
- Sets the name of the property to be used in FromProp mode.
-
- @deprecated: use L{propName}
- @type property: string
- """
- def setStart(startframe):
- """
- Sets the frame from which the IPO starts playing.
-
- @deprecated: use L{frameStart}
- @type startframe: integer
- """
- def getStart():
- """
- Returns the frame from which the IPO starts playing.
-
- @deprecated: use L{frameStart}
- @rtype: integer
- """
- def setEnd(endframe):
- """
- Sets the frame at which the IPO stops playing.
-
- @deprecated: use L{frameEnd}
- @type endframe: integer
- """
- def getEnd():
- """
- Returns the frame at which the IPO stops playing.
-
- @deprecated: use L{frameEnd}
- @rtype: integer
- """
- def setIpoAsForce(force):
- """
- Set whether to interpret the ipo as a force rather than a displacement.
-
- @deprecated: use L{useIpoAsForce}
- @type force: boolean
- @param force: KX_TRUE or KX_FALSE
- """
- def getIpoAsForce():
- """
- Returns whether to interpret the ipo as a force rather than a displacement.
-
- @deprecated: use L{useIpoAsForce}
- @rtype: boolean
- """
- def setIpoAdd(add):
- """
- Set whether to interpret the ipo as additive rather than absolute.
-
- @deprecated: use L{useIpoAdd}
- @type add: boolean
- @param add: KX_TRUE or KX_FALSE
- """
- def getIpoAdd():
- """
- Returns whether to interpret the ipo as additive rather than absolute.
-
- @deprecated: use L{useIpoAdd}
- @rtype: boolean
- """
- def setType(mode):
- """
- Sets the operation mode of the actuator.
-
- @deprecated: use L{type}
- @param mode: KX_IPOACT_PLAY, KX_IPOACT_PINGPONG, KX_IPOACT_FLIPPER, KX_IPOACT_LOOPSTOP, KX_IPOACT_LOOPEND
- @type mode: string
- """
- def getType():
- """
- Returns the operation mode of the actuator.
-
- @deprecated: use L{type}
- @rtype: integer
- @return: KX_IPOACT_PLAY, KX_IPOACT_PINGPONG, KX_IPOACT_FLIPPER, KX_IPOACT_LOOPSTOP, KX_IPOACT_LOOPEND
- """
- def setForceIpoActsLocal(local):
- """
- Set whether to apply the force in the object's local
- coordinates rather than the world global coordinates.
-
- @deprecated: use L{useIpoLocal}
- @param local: Apply the ipo-as-force in the object's local
- coordinates? (KX_TRUE, KX_FALSE)
- @type local: boolean
- """
- def getForceIpoActsLocal():
- """
- Return whether to apply the force in the object's local
- coordinates rather than the world global coordinates.
-
- @deprecated: use L{useIpoLocal}
- """
-#}
-
-class KX_LightObject(KX_GameObject):
- """
- A Light object.
-
- Example:
-
- # Turn on a red alert light.
- import GameLogic
-
- co = GameLogic.getCurrentController()
- light = co.owner
-
- light.energy = 1.0
- light.colour = [1.0, 0.0, 0.0]
-
- @group Constants: NORMAL, SPOT, SUN
- @ivar SPOT: A spot light source. See attribute 'type'
- @ivar SUN: A point light source with no attenuation. See attribute 'type'
- @ivar NORMAL: A point light source. See attribute 'type'
-
- @ivar type: The type of light - must be SPOT, SUN or NORMAL
- @ivar layer: The layer mask that this light affects object on.
- @type layer: bitfield
- @ivar energy: The brightness of this light.
- @type energy: float
- @ivar distance: The maximum distance this light can illuminate. (SPOT and NORMAL lights only)
- @type distance: float
- @ivar colour: The colour of this light. Black = [0.0, 0.0, 0.0], White = [1.0, 1.0, 1.0]
- @type colour: list [r, g, b]
- @ivar color: Synonym for colour.
- @ivar lin_attenuation: The linear component of this light's attenuation. (SPOT and NORMAL lights only)
- @type lin_attenuation: float
- @ivar quad_attenuation: The quadratic component of this light's attenuation (SPOT and NORMAL lights only)
- @type quad_attenuation: float
- @ivar spotsize: The cone angle of the spot light, in degrees. (float) (SPOT lights only)
- 0.0 <= spotsize <= 180.0. Spotsize = 360.0 is also accepted.
- @ivar spotblend: Specifies the intensity distribution of the spot light. (float) (SPOT lights only)
- Higher values result in a more focused light source.
- 0.0 <= spotblend <= 1.0.
-
- """
-
-class KX_MeshProxy(SCA_IObject):
- """
- A mesh object.
-
- You can only change the vertex properties of a mesh object, not the mesh topology.
-
- To use mesh objects effectively, you should know a bit about how the game engine handles them.
- 1. Mesh Objects are converted from Blender at scene load.
- 2. The Converter groups polygons by Material. This means they can be sent to the
- renderer efficiently. A material holds:
- 1. The texture.
- 2. The Blender material.
- 3. The Tile properties
- 4. The face properties - (From the "Texture Face" panel)
- 5. Transparency & z sorting
- 6. Light layer
- 7. Polygon shape (triangle/quad)
- 8. Game Object
- 3. Verticies will be split by face if necessary. Verticies can only be shared between
- faces if:
- 1. They are at the same position
- 2. UV coordinates are the same
- 3. Their normals are the same (both polygons are "Set Smooth")
- 4. They are the same colour
- For example: a cube has 24 verticies: 6 faces with 4 verticies per face.
-
- The correct method of iterating over every L{KX_VertexProxy} in a game object::
- import GameLogic
-
- co = GameLogic.getCurrentController()
- obj = co.owner
-
- m_i = 0
- mesh = obj.getMesh(m_i) # There can be more than one mesh...
- while mesh != None:
- for mat in range(mesh.getNumMaterials()):
- for v_index in range(mesh.getVertexArrayLength(mat)):
- vertex = mesh.getVertex(mat, v_index)
- # Do something with vertex here...
- # ... eg: colour the vertex red.
- vertex.colour = [1.0, 0.0, 0.0, 1.0]
- m_i += 1
- mesh = obj.getMesh(m_i)
-
- @ivar materials:
- @type materials: list of L{KX_BlenderMaterial} or L{KX_PolygonMaterial} types
-
- @ivar numPolygons:
- @type numPolygons: integer
-
- @ivar numMaterials:
- @type numMaterials: integer
- """
-
- def getNumMaterials():
- """
- Gets the number of materials associated with this object.
-
- @rtype: integer
- """
-
- def getMaterialName(matid):
- """
- Gets the name of the specified material.
-
- @type matid: integer
- @param matid: the specified material.
- @rtype: string
- @return: the attached material name.
- """
- def getTextureName(matid):
- """
- Gets the name of the specified material's texture.
-
- @type matid: integer
- @param matid: the specified material
- @rtype: string
- @return: the attached material's texture name.
- """
- def getVertexArrayLength(matid):
- """
- Gets the length of the vertex array associated with the specified material.
-
- There is one vertex array for each material.
-
- @type matid: integer
- @param matid: the specified material
- @rtype: integer
- @return: the number of verticies in the vertex array.
- """
- def getVertex(matid, index):
- """
- Gets the specified vertex from the mesh object.
-
- @type matid: integer
- @param matid: the specified material
- @type index: integer
- @param index: the index into the vertex array.
- @rtype: L{KX_VertexProxy}
- @return: a vertex object.
- """
- def getNumPolygons():
- """
- Returns the number of polygon in the mesh.
-
- @rtype: integer
- """
- def getPolygon(index):
- """
- Gets the specified polygon from the mesh.
-
- @type index: integer
- @param index: polygon number
- @rtype: L{KX_PolyProxy}
- @return: a polygon object.
- """
-
-class SCA_MouseSensor(SCA_ISensor):
- """
- Mouse Sensor logic brick.
-
- Properties:
-
- @ivar position: current [x,y] coordinates of the mouse, in frame coordinates (pixels)
- @type position: [integer,interger]
- @ivar mode: sensor mode: 1=KX_MOUSESENSORMODE_LEFTBUTTON 2=KX_MOUSESENSORMODE_MIDDLEBUTTON
- 3=KX_MOUSESENSORMODE_RIGHTBUTTON 4=KX_MOUSESENSORMODE_WHEELUP
- 5=KX_MOUSESENSORMODE_WHEELDOWN 9=KX_MOUSESENSORMODE_MOVEMENT
- @type mode: integer
- """
-
- def getXPosition():
- """
- Gets the x coordinate of the mouse.
-
- @deprecated: use the L{position} property
- @rtype: integer
- @return: the current x coordinate of the mouse, in frame coordinates (pixels)
- """
- def getYPosition():
- """
- Gets the y coordinate of the mouse.
-
- @deprecated: use the L{position} property
- @rtype: integer
- @return: the current y coordinate of the mouse, in frame coordinates (pixels).
- """
- def getButtonStatus(button):
- """
- Get the mouse button status.
-
- @type button: int
- @param button: value in GameLogic members KX_MOUSE_BUT_LEFT, KX_MOUSE_BUT_MIDDLE, KX_MOUSE_BUT_RIGHT
-
- @rtype: integer
- @return: value in GameLogic members KX_INPUT_NONE, KX_INPUT_NONE, KX_INPUT_JUST_ACTIVATED, KX_INPUT_ACTIVE, KX_INPUT_JUST_RELEASED
- """
-
-class KX_MouseFocusSensor(SCA_MouseSensor):
- """
- The mouse focus sensor detects when the mouse is over the current game object.
-
- The mouse focus sensor works by transforming the mouse coordinates from 2d device
- space to 3d space then raycasting away from the camera.
-
- @ivar raySource: The worldspace source of the ray (the view position)
- @type raySource: list (vector of 3 floats)
- @ivar rayTarget: The worldspace target of the ray.
- @type rayTarget: list (vector of 3 floats)
- @ivar rayDirection: The L{rayTarget} - L{raySource} normalized.
- @type rayDirection: list (normalized vector of 3 floats)
- @ivar hitObject: the last object the mouse was over.
- @type hitObject: L{KX_GameObject} or None
- @ivar hitPosition: The worldspace position of the ray intersecton.
- @type hitPosition: list (vector of 3 floats)
- @ivar hitNormal: the worldspace normal from the face at point of intersection.
- @type hitNormal: list (normalized vector of 3 floats)
- @ivar hitUV: the UV coordinates at the point of intersection.
- If the object has no UV mapping, it returns [0,0].
- The UV coordinates are not normalized, they can be < 0 or > 1 depending on the UV mapping.
- @type hitUV: list (vector of 2 floats)
- @ivar usePulseFocus: When enabled, moving the mouse over a different object generates a pulse. (only used when the 'Mouse Over Any' sensor option is set)
- @type usePulseFocus: bool
- """
-#{ Deprecated
- def getHitNormal():
- """
- Returns the normal (in worldcoordinates) at the point of collision where the object was hit by this ray.
-
- @deprecated: use the L{hitNormal} property
- @rtype: list [x, y, z]
- @return: the ray collision normal.
- """
- def getHitObject():
- """
- Returns the object that was hit by this ray or None.
-
- @deprecated: use the L{hitObject} property
- @rtype: L{KX_GameObject} or None
- @return: the collision object.
- """
- def getHitPosition():
- """
- Returns the position (in worldcoordinates) at the point of collision where the object was hit by this ray.
-
- @deprecated: use the L{hitPosition} property
- @rtype: list [x, y, z]
- @return: the ray collision position.
- """
- def getRayDirection():
- """
- Returns the normalized direction (in worldcoordinates) of the ray cast by the mouse.
-
- @deprecated: use the L{rayDirection} property
- @rtype: list [x, y, z]
- @return: the ray direction.
- """
- def getRaySource():
- """
- Returns the position (in worldcoordinates) the ray was cast from by the mouse.
-
- @deprecated: use the L{raySource} property
- @rtype: list [x, y, z]
- @return: the ray source.
- """
- def getRayTarget():
- """
- Returns the target of the ray (in worldcoordinates) that seeks the focus object.
-
- @deprecated: use the L{rayTarget} property
- @rtype: list [x, y, z]
- @return: the ray target.
- """
-#}
-
-class KX_TouchSensor(SCA_ISensor):
- """
- Touch sensor detects collisions between objects.
-
- @ivar propName: The property or material to collide with.
- @type propName: string
- @ivar useMaterial: Determines if the sensor is looking for a property or material.
- KX_True = Find material; KX_False = Find property
- @type useMaterial: boolean
- @ivar usePulseCollision: When enabled, changes to the set of colliding objects generate a pulse.
- @type usePulseCollision: bool
- @ivar hitObject: The last collided object. (read-only)
- @type hitObject: L{KX_GameObject} or None
- @ivar hitObjectList: A list of colliding objects. (read-only)
- @type hitObjectList: L{CListValue} of L{KX_GameObject}
- """
-#{ Deprecated
- def setProperty(name):
- """
- Set the property or material to collide with. Use
- setTouchMaterial() to switch between properties and
- materials.
-
- @deprecated: use the L{property} property
- @type name: string
- """
-
- def getProperty():
- """
- Returns the property or material to collide with. Use
- getTouchMaterial() to find out whether this sensor
- looks for properties or materials.
-
- @deprecated: use the L{property} property
- @rtype: string
- """
- def getHitObject():
- """
- Returns the last object hit by this touch sensor.
-
- @deprecated: use the L{hitObject} property
- @rtype: L{KX_GameObject}
- """
- def getHitObjectList():
- """
- Returns a list of all objects hit in the last frame. (B{deprecated})
-
- Only objects that have the requisite material/property are listed.
-
- @deprecated: use the L{hitObjectList} property
- @rtype: L{CListValue} of L{hitObjectList}
- """
- def getTouchMaterial():
- """
- Returns KX_TRUE if this sensor looks for a specific material,
- KX_FALSE if it looks for a specific property. (B{deprecated})
-
- @deprecated: use the L{useMaterial} property
- """
-#}
-
-class KX_NearSensor(KX_TouchSensor):
- """
- A near sensor is a specialised form of touch sensor.
-
- @ivar distance: The near sensor activates when an object is within this distance.
- @type distance: float
- @ivar resetDistance: The near sensor deactivates when the object exceeds this distance.
- @type resetDistance: float
- """
-
-class KX_NetworkMessageActuator(SCA_IActuator):
- """
- Message Actuator
-
- @ivar propName: Messages will only be sent to objects with the given property name.
- @type propName: string
- @ivar subject: The subject field of the message.
- @type subject: string
- @ivar body: The body of the message.
- @type body: string
- @ivar usePropBody: Send a property instead of a regular body message.
- @type usePropBody: boolean
- """
-#{Deprecated
- def setToPropName(name):
- """
- Messages will only be sent to objects with the given property name.
-
- @deprecated: Use the L{propName} attribute instead.
- @type name: string
- """
- def setSubject(subject):
- """
- Sets the subject field of the message.
-
- @deprecated: Use the L{subject} attribute instead.
- @type subject: string
- """
- def setBodyType(bodytype):
- """
- Sets the type of body to send.
-
- @deprecated: Use the L{usePropBody} attribute instead.
- @type bodytype: boolean
- @param bodytype: True to send the value of a property, False to send the body text.
- """
- def setBody(body):
- """
- Sets the message body.
-
- @deprecated: Use the L{body} attribute instead.
- @type body: string
- @param body: if the body type is True, this is the name of the property to send.
- if the body type is False, this is the text to send.
- """
-#}
-
-class KX_NetworkMessageSensor(SCA_ISensor):
- """
- The Message Sensor logic brick.
-
- Currently only loopback (local) networks are supported.
-
- @ivar subject: The subject the sensor is looking for.
- @type subject: string
- @ivar frameMessageCount: The number of messages received since the last frame.
- (Read-only)
- @type frameMessageCount: int
- @ivar subjects: The list of message subjects received. (Read-only)
- @type subjects: list of strings
- @ivar bodies: The list of message bodies received. (Read-only)
- @type bodies: list of strings
- """
-#{ Deprecated
- def setSubjectFilterText(subject):
- """
- Change the message subject text that this sensor is listening to.
-
- @deprecated: Use the L{subject} attribute instead.
- @type subject: string
- @param subject: the new message subject to listen for.
- """
-
- def getFrameMessageCount():
- """
- Get the number of messages received since the last frame.
-
- @deprecated: Use the L{frameMessageCount} attribute instead.
- @rtype: integer
- """
- def getBodies():
- """
- Gets the list of message bodies.
-
- @deprecated: Use the L{bodies} attribute instead.
- @rtype: list
- """
- def getSubject():
- """
- Gets the message subject this sensor is listening for from the Subject: field.
-
- @deprecated: Use the L{subject} attribute instead.
- @rtype: string
- """
- def getSubjects():
- """
- Gets the list of message subjects received.
-
- @deprecated: Use the L{subjects} attribute instead.
- @rtype: list
- """
-#}
-
-class KX_ObjectActuator(SCA_IActuator):
- """
- The object actuator ("Motion Actuator") applies force, torque, displacement, angular displacement,
- velocity, or angular velocity to an object.
- Servo control allows to regulate force to achieve a certain speed target.
-
- @ivar force: The force applied by the actuator
- @type force: list [x, y, z]
- @ivar useLocalForce: A flag specifying if the force is local
- @type useLocalForce: bool
- @ivar torque: The torque applied by the actuator
- @type torque: list [x, y, z]
- @ivar useLocalTorque: A flag specifying if the torque is local
- @type useLocalTorque: bool
- @ivar dLoc: The displacement vector applied by the actuator
- @type dLoc: list [x, y, z]
- @ivar useLocalDLoc: A flag specifying if the dLoc is local
- @type useLocalDLoc: bool
- @ivar dRot: The angular displacement vector applied by the actuator
- - note: Since the displacement is applied every frame, you must adjust the displacement
- based on the frame rate, or you game experience will depend on the player's computer
- speed.
- @type dRot: list [x, y, z]
- @ivar useLocalDRot: A flag specifying if the dRot is local
- @type useLocalDRot: bool
- @ivar linV: The linear velocity applied by the actuator
- @type linV: list [x, y, z]
- @ivar useLocalLinV: A flag specifying if the linear velocity is local
- - note: This is the target speed for servo controllers
- @type useLocalLinV: bool
- @ivar angV: The angular velocity applied by the actuator
- @type angV: list [x, y, z]
- @ivar useLocalAngV: A flag specifying if the angular velocity is local
- @type useLocalAngV: bool
-
- @ivar damping: The damping parameter of the servo controller
- @type damping: short
-
- @ivar forceLimitX: The min/max force limit along the X axis and activates or deactivates the limits in the servo controller
- @type forceLimitX: list [min(float), max(float), bool]
- @ivar forceLimitY: The min/max force limit along the Y axis and activates or deactivates the limits in the servo controller
- @type forceLimitY: list [min(float), max(float), bool]
- @ivar forceLimitZ: The min/max force limit along the Z axis and activates or deactivates the limits in the servo controller
- @type forceLimitZ: list [min(float), max(float), bool]
-
- @ivar pid: The PID coefficients of the servo controller
- @type pid: list of floats [proportional, integral, derivate]
- @ivar reference: The object that is used as reference to compute the velocity for the servo controller.
- @type reference: L{KX_GameObject} or None
-
- @group Deprecated: getForce, setForce, getTorque, setTorque, getDLoc, setDLoc, getDRot, setDRot, getLinearVelocity, setLinearVelocity, getAngularVelocity,
- setAngularVelocity, getDamping, setDamping, getForceLimitX, setForceLimitX, getForceLimitY, setForceLimitY, getForceLimitZ, setForceLimitZ,
- getPID, setPID
- """
- def getForce():
- """
- Returns the force applied by the actuator.
-
- @deprecated: Use L{force} and L{useLocalForce} instead.
- @rtype: list [fx, fy, fz, local]
- @return: A four item list, containing the vector force, and a flag specifying whether the force is local.
- """
- def setForce(fx, fy, fz, local):
- """
- Sets the force applied by the actuator.
-
- @deprecated: Use L{force} and L{useLocalForce} instead.
- @type fx: float
- @param fx: the x component of the force.
- @type fy: float
- @param fy: the z component of the force.
- @type fz: float
- @param fz: the z component of the force.
- @type local: boolean
- @param local: - False: the force is applied in world coordinates.
- - True: the force is applied in local coordinates.
- """
- def getTorque():
- """
- Returns the torque applied by the actuator.
-
- @deprecated: Use L{torque} and L{useLocalTorque} instead.
- @rtype: list [S{Tau}x, S{Tau}y, S{Tau}z, local]
- @return: A four item list, containing the vector torque, and a flag specifying whether
- the torque is applied in local coordinates (True) or world coordinates (False)
- """
- def setTorque(tx, ty, tz, local):
- """
- Sets the torque applied by the actuator.
-
- @deprecated: Use L{torque} and L{useLocalTorque} instead.
- @type tx: float
- @param tx: the x component of the torque.
- @type ty: float
- @param ty: the z component of the torque.
- @type tz: float
- @param tz: the z component of the torque.
- @type local: boolean
- @param local: - False: the torque is applied in world coordinates.
- - True: the torque is applied in local coordinates.
- """
- def getDLoc():
- """
- Returns the displacement vector applied by the actuator.
-
- @deprecated: Use L{dLoc} and L{useLocalDLoc} instead.
- @rtype: list [dx, dy, dz, local]
- @return: A four item list, containing the vector displacement, and whether
- the displacement is applied in local coordinates (True) or world
- coordinates (False)
- """
- def setDLoc(dx, dy, dz, local):
- """
- Sets the displacement vector applied by the actuator.
-
- Since the displacement is applied every frame, you must adjust the displacement
- based on the frame rate, or you game experience will depend on the player's computer
- speed.
-
- @deprecated: Use L{dLoc} and L{useLocalDLoc} instead.
- @type dx: float
- @param dx: the x component of the displacement vector.
- @type dy: float
- @param dy: the z component of the displacement vector.
- @type dz: float
- @param dz: the z component of the displacement vector.
- @type local: boolean
- @param local: - False: the displacement vector is applied in world coordinates.
- - True: the displacement vector is applied in local coordinates.
- """
- def getDRot():
- """
- Returns the angular displacement vector applied by the actuator.
-
- @deprecated: Use L{dRot} and L{useLocalDRot} instead.
- @rtype: list [dx, dy, dz, local]
- @return: A four item list, containing the angular displacement vector, and whether
- the displacement is applied in local coordinates (True) or world coordinates (False)
- """
- def setDRot(dx, dy, dz, local):
- """
- Sets the angular displacement vector applied by the actuator.
-
- Since the displacement is applied every frame, you must adjust the displacement
- based on the frame rate, or you game experience will depend on the player's computer
- speed.
-
- @deprecated: Use L{dRot} and L{useLocalDRot} instead.
- @type dx: float
- @param dx: the x component of the angular displacement vector.
- @type dy: float
- @param dy: the z component of the angular displacement vector.
- @type dz: float
- @param dz: the z component of the angular displacement vector.
- @type local: boolean
- @param local: - False: the angular displacement vector is applied in world coordinates.
- - True: the angular displacement vector is applied in local coordinates.
- """
- def getLinearVelocity():
- """
- Returns the linear velocity applied by the actuator.
- For the servo control actuator, this is the target speed.
-
- @deprecated: Use L{linV} and L{useLocalLinV} instead.
- @rtype: list [vx, vy, vz, local]
- @return: A four item list, containing the vector velocity, and whether the velocity is applied in local coordinates (True) or world coordinates (False)
- """
- def setLinearVelocity(vx, vy, vz, local):
- """
- Sets the linear velocity applied by the actuator.
- For the servo control actuator, sets the target speed.
-
- @deprecated: Use L{linV} and L{useLocalLinV} instead.
- @type vx: float
- @param vx: the x component of the velocity vector.
- @type vy: float
- @param vy: the z component of the velocity vector.
- @type vz: float
- @param vz: the z component of the velocity vector.
- @type local: boolean
- @param local: - False: the velocity vector is in world coordinates.
- - True: the velocity vector is in local coordinates.
- """
- def getAngularVelocity():
- """
- Returns the angular velocity applied by the actuator.
-
- @deprecated: Use L{angV} and L{useLocalAngV} instead.
- @rtype: list [S{omega}x, S{omega}y, S{omega}z, local]
- @return: A four item list, containing the vector velocity, and whether
- the velocity is applied in local coordinates (True) or world
- coordinates (False)
- """
- def setAngularVelocity(wx, wy, wz, local):
- """
- Sets the angular velocity applied by the actuator.
-
- @deprecated: Use L{angV} and L{useLocalAngV} instead.
- @type wx: float
- @param wx: the x component of the velocity vector.
- @type wy: float
- @param wy: the z component of the velocity vector.
- @type wz: float
- @param wz: the z component of the velocity vector.
- @type local: boolean
- @param local: - False: the velocity vector is applied in world coordinates.
- - True: the velocity vector is applied in local coordinates.
- """
- def getDamping():
- """
- Returns the damping parameter of the servo controller.
-
- @deprecated: Use L{damping} instead.
- @rtype: integer
- @return: the time constant of the servo controller in frame unit.
- """
- def setDamping(damp):
- """
- Sets the damping parameter of the servo controller.
-
- @deprecated: Use L{damping} instead.
- @type damp: integer
- @param damp: the damping parameter in frame unit.
- """
- def getForceLimitX():
- """
- Returns the min/max force limit along the X axis used by the servo controller.
-
- @deprecated: Use L{forceLimitX} instead.
- @rtype: list [min, max, enabled]
- @return: A three item list, containing the min and max limits of the force as float
- and whether the limits are active(true) or inactive(true)
- """
- def setForceLimitX(min, max, enable):
- """
- Sets the min/max force limit along the X axis and activates or deactivates the limits in the servo controller.
-
- @deprecated: Use L{forceLimitX} instead.
- @type min: float
- @param min: the minimum value of the force along the X axis.
- @type max: float
- @param max: the maximum value of the force along the X axis.
- @type enable: boolean
- @param enable: - True: the force will be limited to the min/max
- - False: the force will not be limited
- """
- def getForceLimitY():
- """
- Returns the min/max force limit along the Y axis used by the servo controller.
-
- @deprecated: Use L{forceLimitY} instead.
- @rtype: list [min, max, enabled]
- @return: A three item list, containing the min and max limits of the force as float
- and whether the limits are active(true) or inactive(true)
- """
- def setForceLimitY(min, max, enable):
- """
- Sets the min/max force limit along the Y axis and activates or deactivates the limits in the servo controller.
-
- @deprecated: Use L{forceLimitY} instead.
- @type min: float
- @param min: the minimum value of the force along the Y axis.
- @type max: float
- @param max: the maximum value of the force along the Y axis.
- @type enable: boolean
- @param enable: - True: the force will be limited to the min/max
- - False: the force will not be limited
- """
- def getForceLimitZ():
- """
- Returns the min/max force limit along the Z axis used by the servo controller.
-
- @deprecated: Use L{forceLimitZ} instead.
- @rtype: list [min, max, enabled]
- @return: A three item list, containing the min and max limits of the force as float
- and whether the limits are active(true) or inactive(true)
- """
- def setForceLimitZ(min, max, enable):
- """
- Sets the min/max force limit along the Z axis and activates or deactivates the limits in the servo controller.
-
- @deprecated: Use L{forceLimitZ} instead.
- @type min: float
- @param min: the minimum value of the force along the Z axis.
- @type max: float
- @param max: the maximum value of the force along the Z axis.
- @type enable: boolean
- @param enable: - True: the force will be limited to the min/max
- - False: the force will not be limited
- """
- def getPID():
- """
- Returns the PID coefficient of the servo controller.
-
- @deprecated: Use L{pid} instead.
- @rtype: list [P, I, D]
- @return: A three item list, containing the PID coefficient as floats:
- P : proportional coefficient
- I : Integral coefficient
- D : Derivate coefficient
- """
- def setPID(P, I, D):
- """
- Sets the PID coefficients of the servo controller.
-
- @deprecated: Use L{pid} instead.
- @type P: flat
- @param P: proportional coefficient
- @type I: float
- @param I: Integral coefficient
- @type D: float
- @param D: Derivate coefficient
- """
-
-class KX_ParentActuator(SCA_IActuator):
- """
- The parent actuator can set or remove an objects parent object.
- @ivar object: the object this actuator sets the parent too.
- @type object: L{KX_GameObject} or None
- @ivar mode: The mode of this actuator
- @type mode: int from 0 to 1 L{GameLogic.Parent Actuator}
- @ivar compound: Whether the object shape should be added to the parent compound shape when parenting
- Effective only if the parent is already a compound shape
- @type compound: bool
- @ivar ghost: whether the object should be made ghost when parenting
- Effective only if the shape is not added to the parent compound shape
- @type ghost: bool
-
- """
- def setObject(object):
- """
- Sets the object to set as parent.
-
- Object can be either a L{KX_GameObject} or the name of the object.
-
- @deprecated: Use the L{object} property.
- @type object: L{KX_GameObject}, string or None
- """
- def getObject(name_only = 1):
- """
- Returns the name of the object to change to.
-
- @deprecated: Use the L{object} property.
- @type name_only: bool
- @param name_only: optional argument, when 0 return a KX_GameObject
- @rtype: string, L{KX_GameObject} or None if no object is set
- """
-
-class KX_PhysicsObjectWrapper(PyObjectPlus):
- """
- KX_PhysicsObjectWrapper
-
- """
- def setActive(active):
- """
- Set the object to be active.
-
- @param active: set to True to be active
- @type active: bool
- """
-
- def setAngularVelocity(x, y, z, local):
- """
- Set the angular velocity of the object.
-
- @param x: angular velocity for the x-axis
- @type x: float
-
- @param y: angular velocity for the y-axis
- @type y: float
-
- @param z: angular velocity for the z-axis
- @type z: float
-
- @param local: set to True for local axis
- @type local: bool
- """
- def setLinearVelocity(x, y, z, local):
- """
- Set the linear velocity of the object.
-
- @param x: linear velocity for the x-axis
- @type x: float
-
- @param y: linear velocity for the y-axis
- @type y: float
-
- @param z: linear velocity for the z-axis
- @type z: float
-
- @param local: set to True for local axis
- @type local: bool
- """
- def setPosition(x, y, z):
- """
- Set the position of the object
-
- @param x: x coordinate
- @type x: float
-
- @param y: y coordinate
- @type y: float
-
- @param z: z coordinate
- @type z: float
- """
-
-class KX_PolyProxy(SCA_IObject):
- """
- A polygon holds the index of the vertex forming the poylgon.
-
- Note:
- The polygon attributes are read-only, you need to retrieve the vertex proxy if you want
- to change the vertex settings.
-
- @ivar matname: The name of polygon material, empty if no material.
- @type matname: string
- @ivar material: The material of the polygon
- @type material: L{KX_PolygonMaterial} or L{KX_BlenderMaterial}
- @ivar texture: The texture name of the polygon.
- @type texture: string
- @ivar matid: The material index of the polygon, use this to retrieve vertex proxy from mesh proxy
- @type matid: integer
- @ivar v1: vertex index of the first vertex of the polygon, use this to retrieve vertex proxy from mesh proxy
- @type v1: integer
- @ivar v2: vertex index of the second vertex of the polygon, use this to retrieve vertex proxy from mesh proxy
- @type v2: integer
- @ivar v3: vertex index of the third vertex of the polygon, use this to retrieve vertex proxy from mesh proxy
- @type v3: integer
- @ivar v4: vertex index of the fourth vertex of the polygon, 0 if polygon has only 3 vertex
- use this to retrieve vertex proxy from mesh proxy
- @type v4: integer
- @ivar visible: visible state of the polygon: 1=visible, 0=invisible
- @type visible: integer
- @ivar collide: collide state of the polygon: 1=receives collision, 0=collision free.
- @type collide: integer
- """
-
- def getMaterialName():
- """
- Returns the polygon material name with MA prefix
-
- @rtype: string
- @return: material name
- """
- def getMaterial():
- """
- Returns the polygon material
-
- @rtype: L{KX_PolygonMaterial} or L{KX_BlenderMaterial}
- """
- def getTextureName():
- """
- Returns the polygon texture name
-
- @rtype: string
- @return: texture name
- """
- def getMaterialIndex():
- """
- Returns the material bucket index of the polygon.
- This index and the ones returned by getVertexIndex() are needed to retrieve the vertex proxy from L{KX_MeshProxy}.
-
- @rtype: integer
- @return: the material index in the mesh
- """
- def getNumVertex():
- """
- Returns the number of vertex of the polygon.
-
- @rtype: integer
- @return: number of vertex, 3 or 4.
- """
- def isVisible():
- """
- Returns whether the polygon is visible or not
-
- @rtype: integer
- @return: 0=invisible, 1=visible
- """
- def isCollider():
- """
- Returns whether the polygon is receives collision or not
-
- @rtype: integer
- @return: 0=collision free, 1=receives collision
- """
- def getVertexIndex(vertex):
- """
- Returns the mesh vertex index of a polygon vertex
- This index and the one returned by getMaterialIndex() are needed to retrieve the vertex proxy from L{KX_MeshProxy}.
-
- @type vertex: integer
- @param vertex: index of the vertex in the polygon: 0->3
- @rtype: integer
- @return: mesh vertex index
- """
- def getMesh():
- """
- Returns a mesh proxy
-
- @rtype: L{KX_MeshProxy}
- @return: mesh proxy
- """
-
-class KX_PolygonMaterial:
- """
- This is the interface to materials in the game engine.
-
- Materials define the render state to be applied to mesh objects.
-
- Warning: Some of the methods/variables are CObjects. If you mix these up,
- you will crash blender.
-
- This example requires:
- - PyOpenGL http://pyopengl.sourceforge.net/
- - GLEWPy http://glewpy.sourceforge.net/
- Example::
-
- import GameLogic
- import OpenGL
- from OpenGL.GL import *
- from OpenGL.GLU import *
- import glew
- from glew import *
-
- glewInit()
-
- vertex_shader = \"\"\"
-
- void main(void)
- {
- gl_Position = ftransform();
- }
- \"\"\"
-
- fragment_shader =\"\"\"
-
- void main(void)
- {
- gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0);
- }
- \"\"\"
-
- class MyMaterial:
- def __init__(self):
- self.pass_no = 0
- # Create a shader
- self.m_program = glCreateProgramObjectARB()
- # Compile the vertex shader
- self.shader(GL_VERTEX_SHADER_ARB, (vertex_shader))
- # Compile the fragment shader
- self.shader(GL_FRAGMENT_SHADER_ARB, (fragment_shader))
- # Link the shaders together
- self.link()
-
- def PrintInfoLog(self, tag, object):
- \"\"\"
- PrintInfoLog prints the GLSL compiler log
- \"\"\"
- print "Tag: def PrintGLError(self, tag = ""):
-
- def PrintGLError(self, tag = ""):
- \"\"\"
- Prints the current GL error status
- \"\"\"
- if len(tag):
- print tag
- err = glGetError()
- if err != GL_NO_ERROR:
- print "GL Error: %s\\n"%(gluErrorString(err))
-
- def shader(self, type, shaders):
- \"\"\"
- shader compiles a GLSL shader and attaches it to the current
- program.
-
- type should be either GL_VERTEX_SHADER_ARB or GL_FRAGMENT_SHADER_ARB
- shaders should be a sequence of shader source to compile.
- \"\"\"
- # Create a shader object
- shader_object = glCreateShaderObjectARB(type)
-
- # Add the source code
- glShaderSourceARB(shader_object, len(shaders), shaders)
-
- # Compile the shader
- glCompileShaderARB(shader_object)
-
- # Print the compiler log
- self.PrintInfoLog("vertex shader", shader_object)
-
- # Check if compiled, and attach if it did
- compiled = glGetObjectParameterivARB(shader_object, GL_OBJECT_COMPILE_STATUS_ARB)
- if compiled:
- glAttachObjectARB(self.m_program, shader_object)
-
- # Delete the object (glAttachObjectARB makes a copy)
- glDeleteObjectARB(shader_object)
-
- # print the gl error log
- self.PrintGLError()
-
- def link(self):
- \"\"\"
- Links the shaders together.
- \"\"\"
- # clear error indicator
- glGetError()
-
- glLinkProgramARB(self.m_program)
-
- self.PrintInfoLog("link", self.m_program)
-
- linked = glGetObjectParameterivARB(self.m_program, GL_OBJECT_LINK_STATUS_ARB)
- if not linked:
- print "Shader failed to link"
- return
-
- glValidateProgramARB(self.m_program)
- valid = glGetObjectParameterivARB(self.m_program, GL_OBJECT_VALIDATE_STATUS_ARB)
- if not valid:
- print "Shader failed to validate"
- return
-
- def activate(self, rasty, cachingInfo, mat):
- self.pass_no+=1
- if (self.pass_no == 1):
- glDisable(GL_COLOR_MATERIAL)
- glUseProgramObjectARB(self.m_program)
- return True
-
- glEnable(GL_COLOR_MATERIAL)
- glUseProgramObjectARB(0)
- self.pass_no = 0
- return False
-
- obj = GameLogic.getCurrentController().owner
-
- mesh = obj.meshes[0]
-
- for mat in mesh.materials:
- mat.setCustomMaterial(MyMaterial())
- print mat.texture
-
- @ivar texture: Texture name
- @type texture: string (read-only)
-
- @ivar gl_texture: OpenGL texture handle (eg for glBindTexture(GL_TEXTURE_2D, gl_texture)
- @type gl_texture: integer (read-only)
-
- @ivar material: Material name
- @type material: string (read-only)
-
- @ivar tface: Texture face properties
- @type tface: CObject (read-only)
-
- @ivar tile: Texture is tiling
- @type tile: boolean
- @ivar tilexrep: Number of tile repetitions in x direction.
- @type tilexrep: integer
- @ivar tileyrep: Number of tile repetitions in y direction.
- @type tileyrep: integer
-
- @ivar drawingmode: Drawing mode for the material.
- - 2 (drawingmode & 4) Textured
- - 4 (drawingmode & 16) Light
- - 14 (drawingmode & 16384) 3d Polygon Text
- @type drawingmode: bitfield
-
- @ivar transparent: This material is transparent. All meshes with this
- material will be rendered after non transparent meshes from back
- to front.
- @type transparent: boolean
-
- @ivar zsort: Transparent polygons in meshes with this material will be sorted back to
- front before rendering.
- Non-Transparent polygons will be sorted front to back before rendering.
- @type zsort: boolean
-
- @ivar lightlayer: Light layers this material affects.
- @type lightlayer: bitfield.
-
- @ivar triangle: Mesh data with this material is triangles. It's probably not safe to change this.
- @type triangle: boolean
-
- @ivar diffuse: The diffuse colour of the material. black = [0.0, 0.0, 0.0] white = [1.0, 1.0, 1.0]
- @type diffuse: list [r, g, b]
- @ivar specular: The specular colour of the material. black = [0.0, 0.0, 0.0] white = [1.0, 1.0, 1.0]
- @type specular: list [r, g, b]
- @ivar shininess: The shininess (specular exponent) of the material. 0.0 <= shininess <= 128.0
- @type shininess: float
- @ivar specularity: The amount of specular of the material. 0.0 <= specularity <= 1.0
- @type specularity: float
- """
- def updateTexture(tface, rasty):
- """
- Updates a realtime animation.
-
- @param tface: Texture face (eg mat.tface)
- @type tface: CObject
- @param rasty: Rasterizer
- @type rasty: CObject
- """
- def setTexture(tface):
- """
- Sets texture render state.
-
- Example::
- mat.setTexture(mat.tface)
-
- @param tface: Texture face
- @type tface: CObject
- """
- def activate(rasty, cachingInfo):
- """
- Sets material parameters for this object for rendering.
-
- Material Parameters set:
- 1. Texture
- 2. Backface culling
- 3. Line drawing
- 4. Specular Colour
- 5. Shininess
- 6. Diffuse Colour
- 7. Polygon Offset.
-
- @param rasty: Rasterizer instance.
- @type rasty: CObject
- @param cachingInfo: Material cache instance.
- @type cachingInfo: CObject
- """
- def setCustomMaterial(material):
- """
- Sets the material state setup object.
-
- Using this method, you can extend or completely replace the gameengine material
- to do your own advanced multipass effects.
-
- Use this method to register your material class. Instead of the normal material,
- your class's activate method will be called just before rendering the mesh.
- This should setup the texture, material, and any other state you would like.
- It should return True to render the mesh, or False if you are finished. You should
- clean up any state Blender does not set before returning False.
-
- Activate Method Definition::
- def activate(self, rasty, cachingInfo, material):
-
- Example::
- class PyMaterial:
- def __init__(self):
- self.pass_no = -1
-
- def activate(self, rasty, cachingInfo, material):
- # Activate the material here.
- #
- # The activate method will be called until it returns False.
- # Every time the activate method returns True the mesh will
- # be rendered.
- #
- # rasty is a CObject for passing to material.updateTexture()
- # and material.activate()
- # cachingInfo is a CObject for passing to material.activate()
- # material is the KX_PolygonMaterial instance this material
- # was added to
-
- # default material properties:
- self.pass_no += 1
- if self.pass_no == 0:
- material.activate(rasty, cachingInfo)
- # Return True to do this pass
- return True
-
- # clean up and return False to finish.
- self.pass_no = -1
- return False
-
- # Create a new Python Material and pass it to the renderer.
- mat.setCustomMaterial(PyMaterial())
-
- @param material: The material object.
- @type material: instance
- """
-
-class KX_RadarSensor(KX_NearSensor):
- """
- Radar sensor is a near sensor with a conical sensor object.
-
- @ivar coneOrigin: The origin of the cone with which to test. The origin
- is in the middle of the cone.
- (read-only)
- @type coneOrigin: list of floats [x, y, z]
- @ivar coneTarget: The center of the bottom face of the cone with which to test.
- (read-only)
- @type coneTarget: list of floats [x, y, z]
- @ivar distance: The height of the cone with which to test.
- @type distance: float
- @ivar angle: The angle of the cone (in degrees) with which to test.
- @type angle: float from 0 to 360
- @ivar axis: The axis on which the radar cone is cast
- @type axis: int from 0 to 5
- KX_RADAR_AXIS_POS_X, KX_RADAR_AXIS_POS_Y, KX_RADAR_AXIS_POS_Z,
- KX_RADAR_AXIS_NEG_X, KX_RADAR_AXIS_NEG_Y, KX_RADAR_AXIS_NEG_Z
- """
-#{Deprecated
- #--The following methods are deprecated, please use properties instead.
- def getConeOrigin():
- """
- Returns the origin of the cone with which to test. The origin
- is in the middle of the cone.
-
- @deprecated: Use the L{coneOrigin} property.
- @rtype: list [x, y, z]
- """
-
- def getConeTarget():
- """
- Returns the center of the bottom face of the cone with which to test.
-
- @deprecated: Use the L{coneTarget} property.
- @rtype: list [x, y, z]
- """
-#}
-
- def getConeHeight():
- """
- Returns the height of the cone with which to test.
-
- @rtype: float
- """
-
-class KX_RaySensor(SCA_ISensor):
- """
- A ray sensor detects the first object in a given direction.
-
- @ivar propName: The property the ray is looking for.
- @type propName: string
- @ivar range: The distance of the ray.
- @type range: float
- @ivar useMaterial: Whether or not to look for a material (false = property)
- @type useMaterial: boolean
- @ivar useXRay: Whether or not to use XRay.
- @type useXRay: boolean
- @ivar hitObject: The game object that was hit by the ray. (Read-only)
- @type hitObject: L{KX_GameObject}
- @ivar hitPosition: The position (in worldcoordinates) where the object was hit by the ray. (Read-only)
- @type hitPosition: list [x, y, z]
- @ivar hitNormal: The normal (in worldcoordinates) of the object at the location where the object was hit by the ray. (Read-only)
- @type hitNormal: list [x, y, z]
- @ivar rayDirection: The direction from the ray (in worldcoordinates). (Read-only)
- @type rayDirection: list [x, y, z]
- @ivar axis: The axis the ray is pointing on.
- @type axis: int from 0 to 5
- KX_RAY_AXIS_POS_X, KX_RAY_AXIS_POS_Y, KX_RAY_AXIS_POS_Z,
- KX_RAY_AXIS_NEG_X, KX_RAY_AXIS_NEG_Y, KX_RAY_AXIS_NEG_Z
- """
-#{ Deprecated
- def getHitObject():
- """
- Returns the game object that was hit by this ray.
-
- @deprecated: Use the L{hitObject} attribute instead.
- @rtype: L{KX_GameObject}
- """
- def getHitPosition():
- """
- Returns the position (in worldcoordinates) where the object was hit by this ray.
-
- @deprecated: Use the L{hitPosition} attribute instead.
- @rtype: list [x, y, z]
- """
- def getHitNormal():
- """
- Returns the normal (in worldcoordinates) of the object at the location where the object was hit by this ray.
-
- @deprecated: Use the L{hitNormal} attribute instead.
- @rtype: list [nx, ny, nz]
- """
- def getRayDirection():
- """
- Returns the direction from the ray (in worldcoordinates)
-
- @deprecated: Use the L{rayDirection} attribute instead.
- @rtype: list [dx, dy, dz]
- """
-#}
-
-class KX_SCA_AddObjectActuator(SCA_IActuator):
- """
- Edit Object Actuator (in Add Object Mode)
- @ivar object: the object this actuator adds.
- @type object: L{KX_GameObject} or None
- @ivar objectLastCreated: the last added object from this actuator (read-only).
- @type objectLastCreated: L{KX_GameObject} or None
- @ivar time: the lifetime of added objects, in frames. Set to 0 to disable automatic deletion.
- @type time: integer
- @ivar linearVelocity: the initial linear velocity of added objects.
- @type linearVelocity: list [vx, vy, vz]
- @ivar angularVelocity: the initial angular velocity of added objects.
- @type angularVelocity: list [vx, vy, vz]
-
- @warning: An Add Object actuator will be ignored if at game start, the linked object doesn't exist
- (or is empty) or the linked object is in an active layer.
-
- This will genereate a warning in the console:
-
- C{ERROR: GameObject I{Name} has a AddObjectActuator I{ActuatorName} without object (in 'nonactive' layer)}
- """
-#{Deprecated
- def setObject(object):
- """
- Sets the game object to add.
-
- A copy of the object will be added to the scene when the actuator is activated.
-
- If the object does not exist, this function is ignored.
-
- object can either be a L{KX_GameObject} or the name of an object or None.
-
- @deprecated: use the L{object} property
- @type object: L{KX_GameObject}, string or None
- """
- def getObject(name_only = 0):
- """
- Returns the name of the game object to be added.
-
- Returns None if no game object has been assigned to be added.
-
- @deprecated: use the L{object} property
- @type name_only: bool
- @param name_only: optional argument, when 0 return a KX_GameObject
- @rtype: string, L{KX_GameObject} or None if no object is set
- """
- def setTime(time):
- """
- Sets the lifetime of added objects, in frames.
-
- If time == 0, the object will last forever.
-
- @deprecated: use the L{time} property
- @type time: integer
- @param time: The minimum value for time is 0.
- """
- def getTime():
- """
- Returns the lifetime of the added object, in frames.
-
- @deprecated: use the L{time} property
- @rtype: integer
- """
- def setLinearVelocity(vx, vy, vz):
- """
- Sets the initial linear velocity of added objects.
-
- @deprecated: use the L{linearVelocity} property
- @type vx: float
- @param vx: the x component of the initial linear velocity.
- @type vy: float
- @param vy: the y component of the initial linear velocity.
- @type vz: float
- @param vz: the z component of the initial linear velocity.
- """
- def getLinearVelocity():
- """
- Returns the initial linear velocity of added objects.
-
- @deprecated: use the L{linearVelocity} property
- @rtype: list [vx, vy, vz]
- """
- def setAngularVelocity(vx, vy, vz):
- """
- Sets the initial angular velocity of added objects.
-
- @deprecated: use the L{angularVelocity} property
- @type vx: float
- @param vx: the x component of the initial angular velocity.
- @type vy: float
- @param vy: the y component of the initial angular velocity.
- @type vz: float
- @param vz: the z component of the initial angular velocity.
- """
- def getAngularVelocity():
- """
- Returns the initial angular velocity of added objects.
-
- @deprecated: use the L{angularVelocity} property
- @rtype: list [vx, vy, vz]
- """
- def getLastCreatedObject():
- """
- Returns the last object created by this actuator.
-
- @deprecated: use the L{objectLastCreated} property
- @rtype: L{KX_GameObject}
- @return: A L{KX_GameObject} or None if no object has been created.
- """
-#}
- def instantAddObject():
- """
- Returns the last object created by this actuator. The object can then be accessed from L{objectLastCreated}.
-
- @rtype: None
- """
-
-class KX_SCA_DynamicActuator(SCA_IActuator):
- """
- Dynamic Actuator.
- @ivar mode: the type of operation of the actuator, 0-4
- KX_DYN_RESTORE_DYNAMICS, KX_DYN_DISABLE_DYNAMICS,
- KX_DYN_ENABLE_RIGID_BODY, KX_DYN_DISABLE_RIGID_BODY, KX_DYN_SET_MASS
- @type mode: integer
- @ivar mass: the mass value for the KX_DYN_SET_MASS operation
- @type mass: float
- """
-#{ Deprecated
- def setOperation(operation):
- """
- Set the type of operation when the actuator is activated:
- - 0 = restore dynamics
- - 1 = disable dynamics
- - 2 = enable rigid body
- - 3 = disable rigid body
- - 4 = set mass
-
- @deprecated: Use the L{mode} attribute instead.
- """
- def getOperation():
- """
- return the type of operation
- @deprecated: Use the L{mode} attribute instead.
- """
-#}
-
-class KX_SCA_EndObjectActuator(SCA_IActuator):
- """
- Edit Object Actuator (in End Object mode)
-
- This actuator has no python methods.
- """
-
-class KX_SCA_ReplaceMeshActuator(SCA_IActuator):
- """
- Edit Object actuator, in Replace Mesh mode.
-
- Example::
- # Level-of-detail
- # Switch a game object's mesh based on its depth in the camera view.
- # +----------+ +-----------+ +-------------------------------------+
- # | Always +-----+ Python +-----+ Edit Object (Replace Mesh) LOD.Mesh |
- # +----------+ +-----------+ +-------------------------------------+
- import GameLogic
-
- # List detail meshes here
- # Mesh (name, near, far)
- # Meshes overlap so that they don't 'pop' when on the edge of the distance.
- meshes = ((".Hi", 0.0, -20.0),
- (".Med", -15.0, -50.0),
- (".Lo", -40.0, -100.0)
- )
-
- co = GameLogic.getCurrentController()
- obj = co.owner
- act = co.actuators["LOD." + obj.name]
- cam = GameLogic.getCurrentScene().active_camera
-
- def Depth(pos, plane):
- return pos[0]*plane[0] + pos[1]*plane[1] + pos[2]*plane[2] + plane[3]
-
- # Depth is negative and decreasing further from the camera
- depth = Depth(obj.position, cam.world_to_camera[2])
-
- newmesh = None
- curmesh = None
- # Find the lowest detail mesh for depth
- for mesh in meshes:
- if depth < mesh[1] and depth > mesh[2]:
- newmesh = mesh
- if "ME" + obj.name + mesh[0] == act.getMesh():
- curmesh = mesh
-
- if newmesh != None and "ME" + obj.name + newmesh[0] != act.getMesh():
- # The mesh is a different mesh - switch it.
- # Check the current mesh is not a better fit.
- if curmesh == None or curmesh[1] < depth or curmesh[2] > depth:
- act.mesh = obj.getName() + newmesh[0]
- GameLogic.addActiveActuator(act, True)
-
- @warning: Replace mesh actuators will be ignored if at game start, the
- named mesh doesn't exist.
-
- This will generate a warning in the console:
-
- C{ERROR: GameObject I{Name} ReplaceMeshActuator I{ActuatorName} without object}
-
- @ivar mesh: L{KX_MeshProxy} or the name of the mesh that will replace the current one
- Set to None to disable actuator
- @type mesh: L{KX_MeshProxy} or None if no mesh is set
-
- @ivar useDisplayMesh: when true the displayed mesh is replaced.
- @type useDisplayMesh: boolean
- @ivar usePhysicsMesh: when true the physics mesh is replaced.
- @type usePhysicsMesh: boolean
- """
- def setMesh(name):
- """
- Sets the name of the mesh that will replace the current one.
- When the name is None it will unset the mesh value so no action is taken.
-
- @deprecated: Use the L{mesh} attribute instead.
- @type name: string or None
- """
- def getMesh():
- """
- Returns the name of the mesh that will replace the current one.
-
- Returns None if no mesh has been scheduled to be added.
-
- @deprecated: Use the L{mesh} attribute instead.
- @rtype: string or None
- """
- def instantReplaceMesh():
- """
- Immediately replace mesh without delay.
- @rtype: None
- """
-
-class KX_Scene(PyObjectPlus):
- """
- An active scene that gives access to objects, cameras, lights and scene attributes.
-
- The activity culling stuff is supposed to disable logic bricks when their owner gets too far
- from the active camera. It was taken from some code lurking at the back of KX_Scene - who knows
- what it does!
-
- Example::
- import GameLogic
-
- # get the scene
- scene = GameLogic.getCurrentScene()
-
- # print all the objects in the scene
- for obj in scene.objects:
- print obj.name
-
- # get an object named 'Cube'
- obj = scene.objects["Cube"]
-
- # get the first object in the scene.
- obj = scene.objects[0]
-
- Example::
- # Get the depth of an object in the camera view.
- import GameLogic
-
- obj = GameLogic.getCurrentController().owner
- cam = GameLogic.getCurrentScene().active_camera
-
- # Depth is negative and decreasing further from the camera
- depth = obj.position[0]*cam.world_to_camera[2][0] + obj.position[1]*cam.world_to_camera[2][1] + obj.position[2]*cam.world_to_camera[2][2] + cam.world_to_camera[2][3]
-
- @bug: All attributes are read only at the moment.
-
- @ivar name: The scene's name, (read-only).
- @type name: string
- @ivar objects: A list of objects in the scene, (read-only).
- @type objects: L{CListValue} of L{KX_GameObject}
- @ivar objectsInactive: A list of objects on background layers (used for the addObject actuator), (read-only).
- @type objectsInactive: L{CListValue} of L{KX_GameObject}
- @ivar lights: A list of lights in the scene, (read-only).
- @type lights: L{CListValue} of L{KX_LightObject}
- @ivar cameras: A list of cameras in the scene, (read-only).
- @type cameras: L{CListValue} of L{KX_Camera}
- @ivar active_camera: The current active camera.
- note: this can be set directly from python to avoid using the L{KX_SceneActuator}.
- @type active_camera: L{KX_Camera}
- @ivar suspended: True if the scene is suspended, (read-only).
- @type suspended: boolean
- @ivar activity_culling: True if the scene is activity culling
- @type activity_culling: boolean
- @ivar activity_culling_radius: The distance outside which to do activity culling. Measured in manhattan distance.
- @type activity_culling_radius: float
- @ivar dbvt_culling: True when Dynamic Bounding box Volume Tree is set (read-only).
- @type dbvt_culling: bool
- @ivar pre_draw: A list of callables to be run before the render step.
- @type pre_draw: list
- @ivar post_draw: A list of callables to be run after the render step.
- @type post_draw: list
- @group Deprecated: getLightList, getObjectList, getName
- """
-
- def getLightList():
- """
- Returns the list of lights in the scene.
-
- @deprecated: Use the L{lights} attribute instead.
- @rtype: list [L{KX_LightObject}]
- """
- def getObjectList():
- """
- Returns the list of objects in the scene.
-
- @deprecated: Use the L{objects} attribute instead.
- @rtype: list [L{KX_GameObject}]
- """
- def getName():
- """
- Returns the name of the scene.
-
- @deprecated: Use the L{name} attribute instead.
- @rtype: string
- """
-
- def addObject(object, other, time=0):
- """
- Adds an object to the scene like the Add Object Actuator would, and returns the created object.
-
- @param object: The object to add
- @type object: L{KX_GameObject} or string
- @param other: The object's center to use when adding the object
- @type other: L{KX_GameObject} or string
- @param time: The lifetime of the added object, in frames. A time of 0 means the object will last forever.
- @type time: int
-
- @rtype: L{KX_GameObject}
- """
-
- def end():
- """
- Removes the scene from the game.
- """
-
- def restart():
- """
- Restarts the scene.
- """
-
- def replace(scene):
- """
- Replaces this scene with another one.
-
- @param scene: The name of the scene to replace this scene with.
- @type scene: string
- """
-
- def suspend():
- """
- Suspends this scene.
- """
-
- def resume():
- """
- Resume this scene.
- """
-
- def get(key, default=None):
- """
- Return the value matching key, or the default value if its not found.
- @return: The key value or a default.
- """
-
-class KX_SceneActuator(SCA_IActuator):
- """
- Scene Actuator logic brick.
-
- @warning: Scene actuators that use a scene name will be ignored if at game start, the
- named scene doesn't exist or is empty
-
- This will generate a warning in the console:
-
- C{ERROR: GameObject I{Name} has a SceneActuator I{ActuatorName} (SetScene) without scene}
-
- @ivar scene: the name of the scene to change to/overlay/underlay/remove/suspend/resume
- @type scene: string.
- @ivar camera: the camera to change to.
- When setting the attribute, you can use either a L{KX_Camera} or the name of the camera.
- @type camera: L{KX_Camera} on read, string or L{KX_Camera} on write
- @ivar useRestart: Set flag to True to restart the sene
- @type useRestart: bool
- @ivar mode: The mode of the actuator
- @type mode: int from 0 to 5 L{GameLogic.Scene Actuator}
- """
-#{ Deprecated
- def setUseRestart(flag):
- """
- Set flag to True to restart the scene.
-
- @deprecated: Use the L{useRestart} attribute instead.
- @type flag: boolean
- """
- def setScene(scene):
- """
- Sets the name of the scene to change to/overlay/underlay/remove/suspend/resume.
-
- @deprecated: use the L{scene} attribute instead.
- @type scene: string
- """
- def setCamera(camera):
- """
- Sets the camera to change to.
-
- Camera can be either a L{KX_Camera} or the name of the camera.
-
- @deprecated: use the L{camera} attribute instead.
- @type camera: L{KX_Camera} or string
- """
- def getUseRestart():
- """
- Returns True if the scene will be restarted.
-
- @deprecated: use the L{useRestart} attribute instead.
- @rtype: boolean
- """
- def getScene():
- """
- Returns the name of the scene to change to/overlay/underlay/remove/suspend/resume.
-
- Returns an empty string ("") if no scene has been set.
-
- @deprecated: use the L{scene} attribute instead.
- @rtype: string
- """
- def getCamera():
- """
- Returns the name of the camera to change to.
-
- @deprecated: use the L{camera} attribute instead.
- @rtype: string
- """
-#}
-
-class KX_SoundActuator(SCA_IActuator):
- """
- Sound Actuator.
-
- The L{startSound()}, L{pauseSound()} and L{stopSound()} do not require
- the actuator to be activated - they act instantly provided that the actuator has
- been activated once at least.
-
- @ivar fileName: The filename of the sound this actuator plays.
- @type fileName: string
-
- @ivar volume: The volume (gain) of the sound.
- @type volume: float
-
- @ivar pitch: The pitch of the sound.
- @type pitch: float
-
- @ivar rollOffFactor: The roll off factor. Rolloff defines the rate of attenuation as the sound gets further away.
- @type rollOffFactor: float
-
- @ivar looping: The loop mode of the actuator.
- @type looping: integer
-
- @ivar position: The position of the sound as a list: [x, y, z].
- @type position: float array
-
- @ivar velocity: The velocity of the emitter as a list: [x, y, z]. The relative velocity to the observer determines the pitch. List of 3 floats: [x, y, z].
- @type velocity: float array
-
- @ivar orientation: The orientation of the sound. When setting the orientation you can also use quaternion [float,float,float,float] or euler angles [float,float,float]
- @type orientation: 3x3 matrix [[float]]
-
- @ivar mode: The operation mode of the actuator. You can use one of the following constants:
- - KX_SOUNDACT_PLAYSTOP (1)
- - KX_SOUNDACT_PLAYEND (2)
- - KX_SOUNDACT_LOOPSTOP (3)
- - KX_SOUNDACT_LOOPEND (4)
- - KX_SOUNDACT_LOOPBIDIRECTIONAL (5)
- - KX_SOUNDACT_LOOPBIDIRECTIONAL_STOP (6)
- @type mode: integer
- """
-
-#{ Play Methods
- def startSound():
- """
- Starts the sound.
- """
- def pauseSound():
- """
- Pauses the sound.
- """
- def stopSound():
- """
- Stops the sound.
- """
-#}
-
-#{ Deprecated
- def setFilename(filename):
- """
- Sets the filename of the sound this actuator plays.
-
- @deprecated: Use the L{fileName} attribute instead.
- @type filename: string
- """
- def getFilename():
- """
- Returns the filename of the sound this actuator plays.
-
- @deprecated: Use the L{fileName} attribute instead.
- @rtype: string
- """
- def setGain(gain):
- """
- Sets the gain (volume) of the sound
-
- @deprecated: Use the L{volume} attribute instead.
- @type gain: float
- @param gain: 0.0 (quiet) <= gain <= 1.0 (loud)
- """
- def getGain():
- """
- Gets the gain (volume) of the sound.
-
- @deprecated: Use the L{volume} attribute instead.
- @rtype: float
- """
- def setPitch(pitch):
- """
- Sets the pitch of the sound.
-
- @deprecated: Use the L{pitch} attribute instead.
- @type pitch: float
- """
- def getPitch():
- """
- Returns the pitch of the sound.
-
- @deprecated: Use the L{pitch} attribute instead.
- @rtype: float
- """
- def setRollOffFactor(rolloff):
- """
- Sets the rolloff factor for the sounds.
-
- Rolloff defines the rate of attenuation as the sound gets further away.
- Higher rolloff factors shorten the distance at which the sound can be heard.
-
- @deprecated: Use the L{rollOffFactor} attribute instead.
- @type rolloff: float
- """
- def getRollOffFactor():
- """
- Returns the rolloff factor for the sound.
-
- @deprecated: Use the L{rollOffFactor} attribute instead.
- @rtype: float
- """
- def setLooping(loop):
- """
- Sets the loop mode of the actuator.
-
- @bug: There are no constants defined for this method!
- @param loop: - Play Stop 1
- - Play End 2
- - Loop Stop 3
- - Loop End 4
- - Bidirection Stop 5
- - Bidirection End 6
-
- @deprecated: Use the L{looping} attribute instead.
- @type loop: integer
- """
- def getLooping():
- """
- Returns the current loop mode of the actuator.
-
- @deprecated: Use the L{looping} attribute instead.
- @rtype: integer
- """
- def setPosition(x, y, z):
- """
- Sets the position this sound will come from.
-
- @deprecated: Use the L{position} attribute instead.
- @type x: float
- @param x: The x coordinate of the sound.
- @type y: float
- @param y: The y coordinate of the sound.
- @type z: float
- @param z: The z coordinate of the sound.
- """
- def setVelocity(vx, vy, vz):
- """
- Sets the velocity this sound is moving at.
-
- The sound's pitch is determined from the velocity.
-
- @deprecated: Use the L{velocity} attribute instead.
- @type vx: float
- @param vx: The vx coordinate of the sound.
- @type vy: float
- @param vy: The vy coordinate of the sound.
- @type vz: float
- @param vz: The vz coordinate of the sound.
- """
- def setOrientation(o11, o12, o13, o21, o22, o23, o31, o32, o33):
- """
- Sets the orientation of the sound.
-
- The nine parameters specify a rotation matrix::
- | o11, o12, o13 |
- | o21, o22, o23 |
- | o31, o32, o33 |
- @deprecated: Use the L{orientation} attribute instead.
- """
-
- def setType(mode):
- """
- Sets the operation mode of the actuator.
-
- @deprecated: Use the L{type} attribute instead.
- @param mode: KX_SOUNDACT_PLAYSTOP, KX_SOUNDACT_PLAYEND, KX_SOUNDACT_LOOPSTOP, KX_SOUNDACT_LOOPEND, KX_SOUNDACT_LOOPBIDIRECTIONAL, KX_SOUNDACT_LOOPBIDIRECTIONAL_STOP
- @type mode: integer
- """
-
- def getType():
- """
- Returns the operation mode of the actuator.
-
- @deprecated: Use the L{type} attribute instead.
- @rtype: integer
- @return: KX_SOUNDACT_PLAYSTOP, KX_SOUNDACT_PLAYEND, KX_SOUNDACT_LOOPSTOP, KX_SOUNDACT_LOOPEND, KX_SOUNDACT_LOOPBIDIRECTIONAL, KX_SOUNDACT_LOOPBIDIRECTIONAL_STOP
- """
-#}
-
-class KX_StateActuator(SCA_IActuator):
- """
- State actuator changes the state mask of parent object.
-
- Property:
-
- @ivar operation: type of bit operation to be applied on object state mask.
- You can use one of the following constant:
- - KX_STATE_OP_CPY (0) : Copy state mask
- - KX_STATE_OP_SET (1) : Add bits to state mask
- - KX_STATE_OP_CLR (2) : Substract bits to state mask
- - KX_STATE_OP_NEG (3) : Invert bits to state mask
- @type operation: integer
-
- @ivar mask: value that defines the bits that will be modified by the operation.
- The bits that are 1 in the mask will be updated in the object state,
- the bits that are 0 are will be left unmodified expect for the Copy operation
- which copies the mask to the object state
- @type mask: integer
- """
- def setOperation(op):
- """
- Set the type of bit operation to be applied on object state mask.
- Use setMask() to specify the bits that will be modified.
-
- @deprecated: Use the L{operation} attribute instead.
- @param op: bit operation (0=Copy, 1=Add, 2=Substract, 3=Invert)
- @type op: integer
- """
- def setMask(mask):
- """
- Set the value that defines the bits that will be modified by the operation.
- The bits that are 1 in the value will be updated in the object state,
- the bits that are 0 are will be left unmodified expect for the Copy operation
- which copies the value to the object state.
-
- @deprecated: Use the L{mask} attribute instead.
- @param mask: bits that will be modified
- @type mask: integer
- """
-
-class KX_TrackToActuator(SCA_IActuator):
- """
- Edit Object actuator in Track To mode.
-
- @warning: Track To Actuators will be ignored if at game start, the
- object to track to is invalid.
-
- This will generate a warning in the console:
-
- C{ERROR: GameObject I{Name} no object in EditObjectActuator I{ActuatorName}}
-
- @ivar object: the object this actuator tracks.
- @type object: L{KX_GameObject} or None
- @ivar time: the time in frames with which to delay the tracking motion
- @type time: integer
- @ivar use3D: the tracking motion to use 3D
- @type use3D: boolean
-
- """
-#{ Deprecated
- def setObject(object):
- """
- Sets the object to track.
-
- @deprecated: Use the L{object} attribute instead.
- @type object: L{KX_GameObject}, string or None
- @param object: Either a reference to a game object or the name of the object to track.
- """
- def getObject(name_only):
- """
- Returns the name of the object to track.
-
- @deprecated: Use the L{object} attribute instead.
- @type name_only: bool
- @param name_only: optional argument, when 0 return a KX_GameObject
- @rtype: string, L{KX_GameObject} or None if no object is set
- """
- def setTime(time):
- """
- Sets the time in frames with which to delay the tracking motion.
-
- @deprecated: Use the L{time} attribute instead.
- @type time: integer
- """
- def getTime():
- """
- Returns the time in frames with which the tracking motion is delayed.
-
- @deprecated: Use the L{time} attribute instead.
- @rtype: integer
- """
- def setUse3D(use3d):
- """
- DEPRECATED: Use the property.
- Sets the tracking motion to use 3D.
-
- @deprecated: Use the L{use3D} attribute instead.
- @type use3d: boolean
- @param use3d: - True: allow the tracking motion to extend in the z-direction.
- - False: lock the tracking motion to the x-y plane.
- """
- def getUse3D():
- """
- Returns True if the tracking motion will track in the z direction.
-
- @deprecated: Use the L{use3D} attribute instead.
- @rtype: boolean
- """
-#}
-
-class KX_VehicleWrapper(PyObjectPlus):
- """
- KX_VehicleWrapper
-
- TODO - description
- """
-
- def addWheel(wheel, attachPos, attachDir, axleDir, suspensionRestLength, wheelRadius, hasSteering):
-
- """
- Add a wheel to the vehicle
-
- @param wheel: The object to use as a wheel.
- @type wheel: L{KX_GameObject} or a KX_GameObject name
- @param attachPos: The position that this wheel will attach to.
- @type attachPos: vector of 3 floats
- @param attachDir: The direction this wheel points.
- @type attachDir: vector of 3 floats
- @param axleDir: The direction of this wheels axle.
- @type axleDir: vector of 3 floats
- @param suspensionRestLength: TODO - Description
- @type suspensionRestLength: float
- @param wheelRadius: The size of the wheel.
- @type wheelRadius: float
- """
-
- def applyBraking(force, wheelIndex):
- """
- Apply a braking force to the specified wheel
-
- @param force: the brake force
- @type force: float
-
- @param wheelIndex: index of the wheel where the force needs to be applied
- @type wheelIndex: integer
- """
- def applyEngineForce(force, wheelIndex):
- """
- Apply an engine force to the specified wheel
-
- @param force: the engine force
- @type force: float
-
- @param wheelIndex: index of the wheel where the force needs to be applied
- @type wheelIndex: integer
- """
- def getConstraintId():
- """
- Get the constraint ID
-
- @rtype: integer
- @return: the constraint id
- """
- def getConstraintType():
- """
- Returns the constraint type.
-
- @rtype: integer
- @return: constraint type
- """
- def getNumWheels():
- """
- Returns the number of wheels.
-
- @rtype: integer
- @return: the number of wheels for this vehicle
- """
- def getWheelOrientationQuaternion(wheelIndex):
- """
- Returns the wheel orientation as a quaternion.
-
- @param wheelIndex: the wheel index
- @type wheelIndex: integer
-
- @rtype: TODO - type should be quat as per method name but from the code it looks like a matrix
- @return: TODO Description
- """
- def getWheelPosition(wheelIndex):
- """
- Returns the position of the specified wheel
-
- @param wheelIndex: the wheel index
- @type wheelIndex: integer
-
- @rtype: list[x, y, z]
- @return: position vector
- """
- def getWheelRotation(wheelIndex):
- """
- Returns the rotation of the specified wheel
-
- @param wheelIndex: the wheel index
- @type wheelIndex: integer
-
- @rtype: float
- @return: the wheel rotation
- """
- def setRollInfluence(rollInfluece, wheelIndex):
- """
- Set the specified wheel's roll influence.
- The higher the roll influence the more the vehicle will tend to roll over in corners.
-
- @param rollInfluece: the wheel roll influence
- @type rollInfluece: float
-
- @param wheelIndex: the wheel index
- @type wheelIndex: integer
- """
- def setSteeringValue(steering, wheelIndex):
- """
- Set the specified wheel's steering
-
- @param steering: the wheel steering
- @type steering: float
-
- @param wheelIndex: the wheel index
- @type wheelIndex: integer
- """
- def setSuspensionCompression(compression, wheelIndex):
- """
- Set the specified wheel's compression
-
- @param compression: the wheel compression
- @type compression: float
-
- @param wheelIndex: the wheel index
- @type wheelIndex: integer
- """
- def setSuspensionDamping(damping, wheelIndex):
- """
- Set the specified wheel's damping
-
- @param damping: the wheel damping
- @type damping: float
-
- @param wheelIndex: the wheel index
- @type wheelIndex: integer
- """
- def setSuspensionStiffness(stiffness, wheelIndex):
- """
- Set the specified wheel's stiffness
-
- @param stiffness: the wheel stiffness
- @type stiffness: float
-
- @param wheelIndex: the wheel index
- @type wheelIndex: integer
- """
- def setTyreFriction(friction, wheelIndex):
- """
- Set the specified wheel's tyre friction
-
- @param friction: the tyre friction
- @type friction: float
-
- @param wheelIndex: the wheel index
- @type wheelIndex: integer
- """
-
-class KX_VertexProxy(SCA_IObject):
- """
- A vertex holds position, UV, colour and normal information.
-
- Note:
- The physics simulation is NOT currently updated - physics will not respond
- to changes in the vertex position.
-
- @ivar XYZ: The position of the vertex.
- @type XYZ: list [x, y, z]
- @ivar UV: The texture coordinates of the vertex.
- @type UV: list [u, v]
- @ivar normal: The normal of the vertex
- @type normal: list [nx, ny, nz]
- @ivar colour: The colour of the vertex.
- Black = [0.0, 0.0, 0.0, 1.0], White = [1.0, 1.0, 1.0, 1.0]
- @type colour: list [r, g, b, a]
- @ivar color: Synonym for colour.
-
- @group Position: x, y, z
- @ivar x: The x coordinate of the vertex.
- @type x: float
- @ivar y: The y coordinate of the vertex.
- @type y: float
- @ivar z: The z coordinate of the vertex.
- @type z: float
-
- @group Texture Coordinates: u, v
- @ivar u: The u texture coordinate of the vertex.
- @type u: float
- @ivar v: The v texture coordinate of the vertex.
- @type v: float
-
- @ivar u2: The second u texture coordinate of the vertex.
- @type u2: float
- @ivar v2: The second v texture coordinate of the vertex.
- @type v2: float
-
- @group Colour: r, g, b, a
- @ivar r: The red component of the vertex colour. 0.0 <= r <= 1.0
- @type r: float
- @ivar g: The green component of the vertex colour. 0.0 <= g <= 1.0
- @type g: float
- @ivar b: The blue component of the vertex colour. 0.0 <= b <= 1.0
- @type b: float
- @ivar a: The alpha component of the vertex colour. 0.0 <= a <= 1.0
- @type a: float
- """
-
- def getXYZ():
- """
- Gets the position of this vertex.
-
- @rtype: list [x, y, z]
- @return: this vertexes position in local coordinates.
- """
- def setXYZ(pos):
- """
- Sets the position of this vertex.
-
- @type pos: list [x, y, z]
- @param pos: the new position for this vertex in local coordinates.
- """
- def getUV():
- """
- Gets the UV (texture) coordinates of this vertex.
-
- @rtype: list [u, v]
- @return: this vertexes UV (texture) coordinates.
- """
- def setUV(uv):
- """
- Sets the UV (texture) coordinates of this vertex.
-
- @type uv: list [u, v]
- """
- def getUV2():
- """
- Gets the 2nd UV (texture) coordinates of this vertex.
-
- @rtype: list [u, v]
- @return: this vertexes UV (texture) coordinates.
- """
- def setUV2(uv, unit):
- """
- Sets the 2nd UV (texture) coordinates of this vertex.
-
- @type uv: list [u, v]
- @param unit: optional argument, FLAT==1, SECOND_UV==2, defaults to SECOND_UV
- @param unit: int
- """
- def getRGBA():
- """
- Gets the colour of this vertex.
-
- The colour is represented as four bytes packed into an integer value. The colour is
- packed as RGBA.
-
- Since Python offers no way to get each byte without shifting, you must use the struct module to
- access colour in an machine independent way.
-
- Because of this, it is suggested you use the r, g, b and a attributes or the colour attribute instead.
-
- Example::
- import struct;
- col = struct.unpack('4B', struct.pack('I', v.getRGBA()))
- # col = (r, g, b, a)
- # black = ( 0, 0, 0, 255)
- # white = (255, 255, 255, 255)
-
- @rtype: integer
- @return: packed colour. 4 byte integer with one byte per colour channel in RGBA format.
- """
- def setRGBA(col):
- """
- Sets the colour of this vertex.
-
- See getRGBA() for the format of col, and its relevant problems. Use the r, g, b and a attributes
- or the colour attribute instead.
-
- setRGBA() also accepts a four component list as argument col. The list represents the colour as [r, g, b, a]
- with black = [0.0, 0.0, 0.0, 1.0] and white = [1.0, 1.0, 1.0, 1.0]
-
- Example::
- v.setRGBA(0xff0000ff) # Red
- v.setRGBA(0xff00ff00) # Green on little endian, transparent purple on big endian
- v.setRGBA([1.0, 0.0, 0.0, 1.0]) # Red
- v.setRGBA([0.0, 1.0, 0.0, 1.0]) # Green on all platforms.
-
- @type col: integer or list [r, g, b, a]
- @param col: the new colour of this vertex in packed RGBA format.
- """
- def getNormal():
- """
- Gets the normal vector of this vertex.
-
- @rtype: list [nx, ny, nz]
- @return: normalised normal vector.
- """
- def setNormal(normal):
- """
- Sets the normal vector of this vertex.
-
- @type normal: sequence of floats [r, g, b]
- @param normal: the new normal of this vertex.
- """
-
-class KX_VisibilityActuator(SCA_IActuator):
- """
- Visibility Actuator.
- @ivar visibility: whether the actuator makes its parent object visible or invisible
- @type visibility: boolean
- @ivar useOcclusion: whether the actuator makes its parent object an occluder or not
- @type useOcclusion: boolean
- @ivar useRecursion: whether the visibility/occlusion should be propagated to all children of the object
- @type useRecursion: boolean
- """
-#{ Deprecated
- def set(visible):
- """
- Sets whether the actuator makes its parent object visible or invisible.
-
- @deprecated: Use the L{visibility} attribute instead.
- @param visible: - True: Makes its parent visible.
- - False: Makes its parent invisible.
- """
-#}
-
-class SCA_2DFilterActuator(SCA_IActuator):
- """
- Create, enable and disable 2D filters
-
- Properties:
-
- The following properties don't have an immediate effect.
- You must active the actuator to get the result.
- The actuator is not persistent: it automatically stops itself after setting up the filter
- but the filter remains active. To stop a filter you must activate the actuator with 'type'
- set to RAS_2DFILTER_DISABLED or RAS_2DFILTER_NOFILTER.
-
- @ivar shaderText: shader source code for custom shader
- @type shaderText: string
- @ivar disableMotionBlur: action on motion blur: 0=enable, 1=disable
- @type disableMotionBlur: integer
- @ivar mode: type of 2D filter, use one of the following constants:
- RAS_2DFILTER_ENABLED (-2) : enable the filter that was previously disabled
- RAS_2DFILTER_DISABLED (-1) : disable the filter that is currently active
- RAS_2DFILTER_NOFILTER (0) : disable and destroy the filter that is currently active
- RAS_2DFILTER_MOTIONBLUR (1) : create and enable preset filters
- RAS_2DFILTER_BLUR (2)
- RAS_2DFILTER_SHARPEN (3)
- RAS_2DFILTER_DILATION (4)
- RAS_2DFILTER_EROSION (5)
- RAS_2DFILTER_LAPLACIAN (6)
- RAS_2DFILTER_SOBEL (7)
- RAS_2DFILTER_PREWITT (8)
- RAS_2DFILTER_GRAYSCALE (9)
- RAS_2DFILTER_SEPIA (10)
- RAS_2DFILTER_INVERT (11)
- RAS_2DFILTER_CUSTOMFILTER (12) : customer filter, the code code is set via shaderText property
- @type mode: integer
- @ivar passNumber: order number of filter in the stack of 2D filters. Filters are executed in increasing order of passNb.
- Only be one filter can be defined per passNb.
- @type passNumber: integer (0-100)
- @ivar value: argument for motion blur filter
- @type value: float (0.0-100.0)
- """
-
-class SCA_ANDController(SCA_IController):
- """
- An AND controller activates only when all linked sensors are activated.
-
- There are no special python methods for this controller.
- """
-
-class SCA_ActuatorSensor(SCA_ISensor):
- """
- Actuator sensor detect change in actuator state of the parent object.
- It generates a positive pulse if the corresponding actuator is activated
- and a negative pulse if the actuator is deactivated.
-
- Properties:
-
- @ivar actuator: the name of the actuator that the sensor is monitoring.
- @type actuator: string
- """
-#{Deprecated
- def getActuator():
- """
- Return the Actuator with which the sensor operates.
-
- @deprecated: Use the L{actuator} attribute instead.
- @rtype: string
- """
- def setActuator(name):
- """
- Sets the Actuator with which to operate. If there is no Actuator
- of this name, the function has no effect.
-
- @deprecated: Use the L{actuator} attribute instead.
- @param name: actuator name
- @type name: string
- """
-#}
-
-class SCA_AlwaysSensor(SCA_ISensor):
- """
- This sensor is always activated.
- """
-
-class SCA_DelaySensor(SCA_ISensor):
- """
- The Delay sensor generates positive and negative triggers at precise time,
- expressed in number of frames. The delay parameter defines the length
- of the initial OFF period. A positive trigger is generated at the end of this period.
- The duration parameter defines the length of the ON period following the OFF period.
- There is a negative trigger at the end of the ON period. If duration is 0, the sensor
- stays ON and there is no negative trigger.
- The sensor runs the OFF-ON cycle once unless the repeat option is set: the
- OFF-ON cycle repeats indefinately (or the OFF cycle if duration is 0).
- Use SCA_ISensor::reset() at any time to restart sensor.
-
- Properties:
-
- @ivar delay: length of the initial OFF period as number of frame, 0 for immediate trigger.
- @type delay: integer.
- @ivar duration: length of the ON period in number of frame after the initial OFF period.
- If duration is greater than 0, a negative trigger is sent at the end of the ON pulse.
- @type duration: integer
- @ivar repeat: 1 if the OFF-ON cycle should be repeated indefinately, 0 if it should run once.
- @type repeat: integer
- """
-#{Deprecated
- def setDelay(delay):
- """
- Set the initial delay before the positive trigger.
-
- @deprecated: Use the L{delay} attribute instead.
- @param delay: length of the initial OFF period as number of frame, 0 for immediate trigger
- @type delay: integer
- """
- def setDuration(duration):
- """
- Set the duration of the ON pulse after initial delay and the generation of the positive trigger.
- If duration is greater than 0, a negative trigger is sent at the end of the ON pulse.
-
- @deprecated: Use the L{duration} attribute instead.
- @param duration: length of the ON period in number of frame after the initial OFF period
- @type duration: integer
- """
- def setRepeat(repeat):
- """
- Set if the sensor repeat mode.
-
- @deprecated: Use the L{repeat} attribute instead.
- @param repeat: 1 if the OFF-ON cycle should be repeated indefinately, 0 if it should run once.
- @type repeat: integer
- """
- def getDelay():
- """
- Return the delay parameter value.
-
- @deprecated: Use the L{delay} attribute instead.
- @rtype: integer
- """
- def getDuration():
- """
- Return the duration parameter value
-
- @deprecated: Use the L{duration} attribute instead.
- @rtype: integer
- """
- def getRepeat():
- """
- Return the repeat parameter value
-
- @deprecated: Use the L{repeat} attribute instead.
- @rtype: KX_TRUE or KX_FALSE
- """
-#}
-
-class SCA_JoystickSensor(SCA_ISensor):
- """
- This sensor detects player joystick events.
-
- Properties:
-
- @ivar axisValues: (read-only) The state of the joysticks axis as a list of values L{numAxis} long.
- each spesifying the value of an axis between -32767 and 32767 depending on how far the axis is pushed, 0 for nothing.
- The first 2 values are used by most joysticks and gamepads for directional control. 3rd and 4th values are only on some joysticks and can be used for arbitary controls.
- left:[-32767, 0, ...], right:[32767, 0, ...], up:[0, -32767, ...], down:[0, 32767, ...]
- @type axisValues: list of ints
-
- @ivar axisSingle: (read-only) like L{axisValues} but returns a single axis value that is set by the sensor.
- Only use this for "Single Axis" type sensors otherwise it will raise an error.
- @type axisSingle: int
-
- @ivar hatValues: (read-only) The state of the joysticks hats as a list of values L{numHats} long.
- each spesifying the direction of the hat from 1 to 12, 0 when inactive.
- Hat directions are as follows...
- - 0:None
- - 1:Up
- - 2:Right
- - 4:Down
- - 8:Left
- - 3:Up - Right
- - 6:Down - Right
- - 12:Down - Left
- - 9:Up - Left
-
- @type hatValues: list of ints
-
- @ivar hatSingle: (read-only) like L{hatValues} but returns a single hat direction value that is set by the sensor.
- @type hatSingle: int
-
- @ivar numAxis: (read-only) The number of axes for the joystick at this index.
- @type numAxis: integer
- @ivar numButtons: (read-only) The number of buttons for the joystick at this index.
- @type numButtons: integer
- @ivar numHats: (read-only) The number of hats for the joystick at this index.
- @type numHats: integer
- @ivar connected: (read-only) True if a joystick is connected at this joysticks index.
- @type connected: boolean
- @ivar index: The joystick index to use (from 0 to 7). The first joystick is always 0.
- @type index: integer
- @ivar threshold: Axis threshold. Joystick axis motion below this threshold wont trigger an event. Use values between (0 and 32767), lower values are more sensitive.
- @type threshold: integer
- @ivar button: The button index the sensor reacts to (first button = 0). When the "All Events" toggle is set, this option has no effect.
- @type button: integer
- @ivar axis: The axis this sensor reacts to, as a list of two values [axisIndex, axisDirection]
- axisIndex: the axis index to use when detecting axis movement, 1=primary directional control, 2=secondary directional control.
- axisDirection: 0=right, 1=up, 2=left, 3=down
- @type axis: [integer, integer]
- @ivar hat: The hat the sensor reacts to, as a list of two values: [hatIndex, hatDirection]
- hatIndex: the hat index to use when detecting hat movement, 1=primary hat, 2=secondary hat (4 max).
- hatDirection: 1-12
- @type hat: [integer, integer]
- """
-
- def getButtonActiveList():
- """
- Returns a list containing the indicies of the currently pressed buttons.
- @rtype: list
- """
- def getButtonStatus(buttonIndex):
- """
- Returns a bool of the current pressed state of the specified button.
- @param buttonIndex: the button index, 0=first button
- @type buttonIndex: integer
- @rtype: bool
- """
-#{Deprecated
- def getIndex():
- """
- Returns the joystick index to use (from 1 to 8).
-
- @deprecated: Use the L{index} attribute instead.
- @rtype: integer
- """
- def setIndex(index):
- """
- Sets the joystick index to use.
-
- @deprecated: Use the L{index} attribute instead.
- @param index: The index of this joystick sensor, Clamped between 1 and 8.
- @type index: integer
- @note: This is only useful when you have more then 1 joystick connected to your computer - multiplayer games.
- """
- def getAxis():
- """
- Returns the current axis this sensor reacts to. See L{getAxisValue()<SCA_JoystickSensor.getAxisValue>} for the current axis state.
-
- @deprecated: Use the L{axis} attribute instead.
- @rtype: list
- @return: 2 values returned are [axisIndex, axisDirection] - see L{setAxis()<SCA_JoystickSensor.setAxis>} for their purpose.
- @note: When the "All Events" toggle is set, this option has no effect.
- """
- def setAxis(axisIndex, axisDirection):
- """
- @deprecated: Use the L{axis} attribute instead.
- @param axisIndex: Set the axis index to use when detecting axis movement.
- @type axisIndex: integer from 1 to 2
- @param axisDirection: Set the axis direction used for detecting motion. 0:right, 1:up, 2:left, 3:down.
- @type axisDirection: integer from 0 to 3
- @note: When the "All Events" toggle is set, this option has no effect.
- """
- def getAxisValue():
- """
- Returns the state of the joysticks axis. See differs to L{getAxis()<SCA_JoystickSensor.getAxis>} returning the current state of the joystick.
-
- @deprecated: Use the L{axisValues} attribute instead.
- @rtype: list
- @return: 4 values, each spesifying the value of an axis between -32767 and 32767 depending on how far the axis is pushed, 0 for nothing.
-
- The first 2 values are used by most joysticks and gamepads for directional control. 3rd and 4th values are only on some joysticks and can be used for arbitary controls.
-
- left:[-32767, 0, ...], right:[32767, 0, ...], up:[0, -32767, ...], down:[0, 32767, ...]
- @note: Some gamepads only set the axis on and off like a button.
- """
- def getThreshold():
- """
- Get the axis threshold. See L{setThreshold()<SCA_JoystickSensor.setThreshold>} for details.
-
- @deprecated: Use the L{threshold} attribute instead.
- @rtype: integer
- """
- def setThreshold(threshold):
- """
- Set the axis threshold.
-
- @deprecated: Use the L{threshold} attribute instead.
- @param threshold: Joystick axis motion below this threshold wont trigger an event. Use values between (0 and 32767), lower values are more sensitive.
- @type threshold: integer
- """
- def getButton():
- """
- Returns the button index the sensor reacts to. See L{getButtonValue()<SCA_JoystickSensor.getButtonValue>} for a list of pressed buttons.
-
- @deprecated: Use the L{button} attribute instead.
- @rtype: integer
- @note: When the "All Events" toggle is set, this option has no effect.
- """
- def setButton(index):
- """
- Sets the button index the sensor reacts to when the "All Events" option is not set.
-
- @deprecated: Use the L{button} attribute instead.
- @note: When the "All Events" toggle is set, this option has no effect.
- """
- def getButtonValue():
- """
- Returns a list containing the indicies of the currently pressed buttons.
-
- @deprecated: Use the L{getButtonActiveList} method instead.
- @rtype: list
- """
- def getHat():
- """
- Returns the current hat direction this sensor is set to.
- [hatNumber, hatDirection].
-
- @deprecated: Use the L{hat} attribute instead.
- @rtype: list
- @note: When the "All Events" toggle is set, this option has no effect.
- """
- def setHat(index,direction):
- """
- Sets the hat index the sensor reacts to when the "All Events" option is not set.
-
- @deprecated: Use the L{hat} attribute instead.
- @type index: integer
- """
- def getNumAxes():
- """
- Returns the number of axes for the joystick at this index.
-
- @deprecated: Use the L{numAxis} attribute instead.
- @rtype: integer
- """
- def getNumButtons():
- """
- Returns the number of buttons for the joystick at this index.
-
- @deprecated: Use the L{numButtons} attribute instead.
- @rtype: integer
- """
- def getNumHats():
- """
- Returns the number of hats for the joystick at this index.
-
- @deprecated: Use the L{numHats} attribute instead.
- @rtype: integer
- """
- def isConnected():
- """
- Returns True if a joystick is detected at this joysticks index.
-
- @deprecated: Use the L{connected} attribute instead.
- @rtype: bool
- """
-#}
-
-class SCA_KeyboardSensor(SCA_ISensor):
- """
- A keyboard sensor detects player key presses.
-
- See module L{GameKeys} for keycode values.
-
- @ivar key: The key code this sensor is looking for.
- @type key: keycode from L{GameKeys} module
- @ivar hold1: The key code for the first modifier this sensor is looking for.
- @type hold1: keycode from L{GameKeys} module
- @ivar hold2: The key code for the second modifier this sensor is looking for.
- @type hold2: keycode from L{GameKeys} module
- @ivar toggleProperty: The name of the property that indicates whether or not to log keystrokes as a string.
- @type toggleProperty: string
- @ivar targetProperty: The name of the property that receives keystrokes in case in case a string is logged.
- @type targetProperty: string
- @ivar useAllKeys: Flag to determine whether or not to accept all keys.
- @type useAllKeys: boolean
- @ivar events: a list of pressed keys that have either been pressed, or just released, or are active this frame. (read-only).
-
- - 'keycode' matches the values in L{GameKeys}.
- - 'status' uses...
- - L{GameLogic.KX_INPUT_NONE}
- - L{GameLogic.KX_INPUT_JUST_ACTIVATED}
- - L{GameLogic.KX_INPUT_ACTIVE}
- - L{GameLogic.KX_INPUT_JUST_RELEASED}
-
- @type events: list [[keycode, status], ...]
- """
-
- def getKeyStatus(keycode):
- """
- Get the status of a key.
-
- @rtype: key state L{GameLogic} members (KX_INPUT_NONE, KX_INPUT_JUST_ACTIVATED, KX_INPUT_ACTIVE, KX_INPUT_JUST_RELEASED)
- @return: The state of the given key
- @type keycode: integer
- @param keycode: The code that represents the key you want to get the state of
- """
-
-#{Deprecated
- def getKey():
- """
- Returns the key code this sensor is looking for.
-
- @deprecated: Use the L{key} attribute instead.
- @rtype: keycode from L{GameKeys} module
- """
-
- def setKey(keycode):
- """
- Set the key this sensor should listen for.
-
- @deprecated: Use the L{key} attribute instead.
- @type keycode: keycode from L{GameKeys} module
- """
-
- def getHold1():
- """
- Returns the key code for the first modifier this sensor is looking for.
-
- @deprecated: Use the L{hold1} attribute instead.
- @rtype: keycode from L{GameKeys} module
- """
-
- def setHold1(keycode):
- """
- Sets the key code for the first modifier this sensor should look for.
-
- @deprecated: Use the L{hold1} attribute instead.
- @type keycode: keycode from L{GameKeys} module
- """
-
- def getHold2():
- """
- Returns the key code for the second modifier this sensor is looking for.
-
- @deprecated: Use the L{hold2} attribute instead.
- @rtype: keycode from L{GameKeys} module
- """
-
- def setHold2(keycode):
- """
- Sets the key code for the second modifier this sensor should look for.
-
- @deprecated: Use the L{hold2} attribute instead.
- @type keycode: keycode from L{GameKeys} module
- """
-
- def getPressedKeys():
- """
- Get a list of keys that have either been pressed, or just released this frame.
-
- @deprecated: Use the L{events} attribute instead.
- @rtype: list of key status. [[keycode, status]]
- """
-
- def getCurrentlyPressedKeys():
- """
- Get a list of currently pressed keys that have either been pressed, or just released
-
- @deprecated: Use the L{events} attribute instead.
- @rtype: list of key status. [[keycode, status]]
- """
-#}
-
-class SCA_NANDController(SCA_IController):
- """
- An NAND controller activates when all linked sensors are not active.
-
- There are no special python methods for this controller.
- """
-
-class SCA_NORController(SCA_IController):
- """
- An NOR controller activates only when all linked sensors are de-activated.
-
- There are no special python methods for this controller.
- """
-
-class SCA_ORController(SCA_IController):
- """
- An OR controller activates when any connected sensor activates.
-
- There are no special python methods for this controller.
- """
-
-class SCA_PropertyActuator(SCA_IActuator):
- """
- Property Actuator
-
- Properties:
-
- @ivar propName: the property on which to operate.
- @type propName: string
- @ivar value: the value with which the actuator operates.
- @type value: string
- @ivar mode: TODO - add constants to game logic dict!.
- @type mode: int
- """
-#{ Deprecated
- def setProperty(prop):
- """
- Set the property on which to operate.
-
- If there is no property of this name, the call is ignored.
-
- @deprecated: Use the L{propName} attribute instead.
- @type prop: string
- @param prop: The name of the property to set.
- """
- def getProperty():
- """
- Returns the name of the property on which to operate.
-
- @deprecated: Use the L{propName} attribute instead.
- @rtype: string
- """
- def setValue(value):
- """
- Set the value with which the actuator operates.
-
- If the value is not compatible with the type of the
- property, the subsequent action is ignored.
-
- @deprecated: Use the L{value} attribute instead.
- @type value: string
- """
- def getValue():
- """
- Gets the value with which this actuator operates.
-
- @deprecated: Use the L{value} attribute instead.
- @rtype: string
- """
-#}
-
-class SCA_PropertySensor(SCA_ISensor):
- """
- Activates when the game object property matches.
-
- Properties:
-
- @ivar mode: type of check on the property:
- KX_PROPSENSOR_EQUAL(1), KX_PROPSENSOR_NOTEQUAL(2), KX_PROPSENSOR_INTERVAL(3),
- KX_PROPSENSOR_CHANGED(4), KX_PROPSENSOR_EXPRESSION(5)
- @type mode: integer
- @ivar propName: the property the sensor operates.
- @type propName: string
- @ivar value: the value with which the sensor compares to the value of the property.
- @type value: string
- @ivar min: the minimum value of the range used to evaluate the property when in interval mode.
- @type min: string
- @ivar max: the maximum value of the range used to evaluate the property when in interval mode.
- @type max: string
- """
-#{ Deprecated
- def getType():
- """
- Gets when to activate this sensor.
-
- @deprecated: Use the L{mode} attribute instead.
- @return: KX_PROPSENSOR_EQUAL, KX_PROPSENSOR_NOTEQUAL,
- KX_PROPSENSOR_INTERVAL, KX_PROPSENSOR_CHANGED,
- or KX_PROPSENSOR_EXPRESSION.
- """
-
- def setType(checktype):
- """
- Set the type of check to perform.
-
- @deprecated: Use the L{mode} attribute instead.
- @type checktype: KX_PROPSENSOR_EQUAL, KX_PROPSENSOR_NOTEQUAL,
- KX_PROPSENSOR_INTERVAL, KX_PROPSENSOR_CHANGED,
- or KX_PROPSENSOR_EXPRESSION.
- """
-
- def getProperty():
- """
- Return the property with which the sensor operates.
-
- @deprecated: Use the L{propName} attribute instead.
- @rtype: string
- @return: the name of the property this sensor is watching.
- """
- def setProperty(name):
- """
- Sets the property with which to operate. If there is no property
- of that name, this call is ignored.
-
- @deprecated: Use the L{propName} attribute instead.
- @type name: string.
- """
- def getValue():
- """
- Return the value with which the sensor compares to the value of the property.
-
- @deprecated: Use the L{value} attribute instead.
- @rtype: string
- @return: the value of the property this sensor is watching.
- """
- def setValue(value):
- """
- Set the value with which the sensor operates. If the value
- is not compatible with the type of the property, the subsequent
- action is ignored.
-
- @deprecated: Use the L{value} attribute instead.
- @type value: string
- """
-#}
-
-class SCA_PythonController(SCA_IController):
- """
- A Python controller uses a Python script to activate it's actuators,
- based on it's sensors.
-
- Properties:
-
- @ivar script: The value of this variable depends on the execution methid.
- - When 'Script' execution mode is set this value contains the entire python script as a single string (not the script name as you might expect) which can be modified to run different scripts.
- - When 'Module' execution mode is set this value will contain a single line string - module name and function "module.func" or "package.modile.func" where the module names are python textblocks or external scripts.
- note: once this is set the script name given for warnings will remain unchanged.
- @type script: string
- @ivar mode: the execution mode for this controller (read-only).
- - Script: 0, Execite the L{script} as a python code.
- - Module: 1, Execite the L{script} as a module and function.
- @type mode: int
-
- @group Deprecated: getScript, setScript
- """
- def activate(actuator):
- """
- Activates an actuator attached to this controller.
- @type actuator: actuator or the actuator name as a string
- """
- def deactivate(actuator):
- """
- Deactivates an actuator attached to this controller.
- @type actuator: actuator or the actuator name as a string
- """
- def getScript():
- """
- Gets the Python script body this controller executes.
-
- @deprecated: Use the L{script} attribute instead.
- @rtype: string
- """
- def setScript(script_body):
- """
- Sets the Python script string this controller executes.
-
- @deprecated: Use the L{script} attribute instead.
- @type script_body: string.
- """
-
-class SCA_RandomActuator(SCA_IActuator):
- """
- Random Actuator
-
- Properties:
-
- @ivar seed: Seed of the random number generator.
- Equal seeds produce equal series. If the seed is 0,
- the generator will produce the same value on every call.
- @type seed: integer
- @ivar para1: the first parameter of the active distribution.
- Refer to the documentation of the generator types for the meaning
- of this value.
- @type para1: float, read-only
- @ivar para2: the second parameter of the active distribution.
- Refer to the documentation of the generator types for the meaning
- of this value.
- @type para2: float, read-only
- @ivar distribution: distribution type:
- KX_RANDOMACT_BOOL_CONST, KX_RANDOMACT_BOOL_UNIFORM, KX_RANDOMACT_BOOL_BERNOUILLI,
- KX_RANDOMACT_INT_CONST, KX_RANDOMACT_INT_UNIFORM, KX_RANDOMACT_INT_POISSON,
- KX_RANDOMACT_FLOAT_CONST, KX_RANDOMACT_FLOAT_UNIFORM, KX_RANDOMACT_FLOAT_NORMAL,
- KX_RANDOMACT_FLOAT_NEGATIVE_EXPONENTIAL
- @type distribution: integer, read-only
- @ivar propName: the name of the property to set with the random value.
- If the generator and property types do not match, the assignment is ignored.
- @type propName: string
-
- """
- def setBoolConst(value):
- """
- Sets this generator to produce a constant boolean value.
-
- @param value: The value to return.
- @type value: boolean
- """
- def setBoolUniform():
- """
- Sets this generator to produce a uniform boolean distribution.
-
- The generator will generate True or False with 50% chance.
- """
- def setBoolBernouilli(value):
- """
- Sets this generator to produce a Bernouilli distribution.
-
- @param value: Specifies the proportion of False values to produce.
- - 0.0: Always generate True
- - 1.0: Always generate False
- @type value: float
- """
- def setIntConst(value):
- """
- Sets this generator to always produce the given value.
-
- @param value: the value this generator produces.
- @type value: integer
- """
- def setIntUniform(lower_bound, upper_bound):
- """
- Sets this generator to produce a random value between the given lower and
- upper bounds (inclusive).
-
- @type lower_bound: integer
- @type upper_bound: integer
- """
- def setIntPoisson(value):
- """
- Generate a Poisson-distributed number.
-
- This performs a series of Bernouilli tests with parameter value.
- It returns the number of tries needed to achieve succes.
-
- @type value: float
- """
- def setFloatConst(value):
- """
- Always generate the given value.
-
- @type value: float
- """
- def setFloatUniform(lower_bound, upper_bound):
- """
- Generates a random float between lower_bound and upper_bound with a
- uniform distribution.
-
- @type lower_bound: float
- @type upper_bound: float
- """
- def setFloatNormal(mean, standard_deviation):
- """
- Generates a random float from the given normal distribution.
-
- @type mean: float
- @param mean: The mean (average) value of the generated numbers
- @type standard_deviation: float
- @param standard_deviation: The standard deviation of the generated numbers.
- """
- def setFloatNegativeExponential(half_life):
- """
- Generate negative-exponentially distributed numbers.
-
- The half-life 'time' is characterized by half_life.
-
- @type half_life: float
- """
-#{ Deprecated
- def setSeed(seed):
- """
- Sets the seed of the random number generator.
-
- Equal seeds produce equal series. If the seed is 0,
- the generator will produce the same value on every call.
-
- @deprecated: Use the L{seed} attribute instead.
- @type seed: integer
- """
- def getSeed():
- """
- Returns the initial seed of the generator.
-
- @deprecated: Use the L{seed} attribute instead.
- @rtype: integer
- """
- def getPara1():
- """
- Returns the first parameter of the active distribution.
-
- Refer to the documentation of the generator types for the meaning
- of this value.
-
- @deprecated: Use the L{para1} attribute instead.
- @rtype: float
- """
- def getPara2():
- """
- Returns the second parameter of the active distribution.
-
- Refer to the documentation of the generator types for the meaning
- of this value.
-
- @deprecated: Use the L{para2} attribute instead.
- @rtype: float
- """
- def getDistribution():
- """
- Returns the type of random distribution.
-
- @deprecated: Use the L{distribution} attribute instead.
- @rtype: distribution type
- @return: KX_RANDOMACT_BOOL_CONST, KX_RANDOMACT_BOOL_UNIFORM, KX_RANDOMACT_BOOL_BERNOUILLI,
- KX_RANDOMACT_INT_CONST, KX_RANDOMACT_INT_UNIFORM, KX_RANDOMACT_INT_POISSON,
- KX_RANDOMACT_FLOAT_CONST, KX_RANDOMACT_FLOAT_UNIFORM, KX_RANDOMACT_FLOAT_NORMAL,
- KX_RANDOMACT_FLOAT_NEGATIVE_EXPONENTIAL
- """
- def setProperty(property):
- """
- Set the property to which the random value is assigned.
-
- If the generator and property types do not match, the assignment is ignored.
-
- @deprecated: Use the L{propName} attribute instead.
- @type property: string
- @param property: The name of the property to set.
- """
- def getProperty():
- """
- Returns the name of the property to set.
-
- @deprecated: Use the L{propName} attribute instead.
- @rtype: string
- """
-#}
-
-
-class SCA_RandomSensor(SCA_ISensor):
- """
- This sensor activates randomly.
-
- @ivar lastDraw: The seed of the random number generator.
- @type lastDraw: int
- @ivar seed: The seed of the random number generator.
- @type seed: int
- """
-
- def setSeed(seed):
- """
- Sets the seed of the random number generator.
-
- If the seed is 0, the generator will produce the same value on every call.
-
- @type seed: integer.
- """
- def getSeed():
- """
- Returns the initial seed of the generator. Equal seeds produce equal random
- series.
-
- @rtype: integer
- """
- def getLastDraw():
- """
- Returns the last random number generated.
-
- @rtype: integer
- """
-
-class SCA_XNORController(SCA_IController):
- """
- An XNOR controller activates when all linked sensors are the same (activated or inative).
-
- There are no special python methods for this controller.
- """
-
-class SCA_XORController(SCA_IController):
- """
- An XOR controller activates when there is the input is mixed, but not when all are on or off.
-
- There are no special python methods for this controller.
- """
-
-class KX_Camera(KX_GameObject):
- """
- A Camera object.
-
- @group Constants: INSIDE, INTERSECT, OUTSIDE
- @ivar INSIDE: see sphereInsideFrustum() and boxInsideFrustum()
- @ivar INTERSECT: see sphereInsideFrustum() and boxInsideFrustum()
- @ivar OUTSIDE: see sphereInsideFrustum() and boxInsideFrustum()
-
- @ivar lens: The camera's lens value.
- @type lens: float
- @ivar near: The camera's near clip distance.
- @type near: float
- @ivar far: The camera's far clip distance.
- @type far: float
- @ivar perspective: True if this camera has a perspective transform, False for an orthographic projection.
- @type perspective: boolean
- @ivar frustum_culling: True if this camera is frustum culling.
- @type frustum_culling: boolean
- @ivar projection_matrix: This camera's 4x4 projection matrix.
- @type projection_matrix: 4x4 Matrix [[float]]
- @ivar modelview_matrix: This camera's 4x4 model view matrix. (read-only)
- Regenerated every frame from the camera's position and orientation.
- @type modelview_matrix: 4x4 Matrix [[float]]
- @ivar camera_to_world: This camera's camera to world transform. (read-only)
- Regenerated every frame from the camera's position and orientation.
- @type camera_to_world: 4x4 Matrix [[float]]
- @ivar world_to_camera: This camera's world to camera transform. (read-only)
- Regenerated every frame from the camera's position and orientation.
- This is camera_to_world inverted.
- @type world_to_camera: 4x4 Matrix [[float]]
- @ivar useViewport: True when the camera is used as a viewport, set True to enable a viewport for this camera.
- @type useViewport: bool
-
- @group Deprecated: enableViewport, getProjectionMatrix, setProjectionMatrix
- """
-
- def sphereInsideFrustum(centre, radius):
- """
- Tests the given sphere against the view frustum.
-
- @note: when the camera is first initialized the result will be invalid because the projection matrix has not been set.
- @param centre: The centre of the sphere (in world coordinates.)
- @type centre: list [x, y, z]
- @param radius: the radius of the sphere
- @type radius: float
- @return: INSIDE, OUTSIDE or INTERSECT
-
- Example::
- import GameLogic
- co = GameLogic.getCurrentController()
- cam = co.owner
-
- # A sphere of radius 4.0 located at [x, y, z] = [1.0, 1.0, 1.0]
- if (cam.sphereInsideFrustum([1.0, 1.0, 1.0], 4) != cam.OUTSIDE):
- # Sphere is inside frustum !
- # Do something useful !
- else:
- # Sphere is outside frustum
- """
- def boxInsideFrustum(box):
- """
- Tests the given box against the view frustum.
-
- Example::
- import GameLogic
- co = GameLogic.getCurrentController()
- cam = co.owner
-
- # Box to test...
- box = []
- box.append([-1.0, -1.0, -1.0])
- box.append([-1.0, -1.0, 1.0])
- box.append([-1.0, 1.0, -1.0])
- box.append([-1.0, 1.0, 1.0])
- box.append([ 1.0, -1.0, -1.0])
- box.append([ 1.0, -1.0, 1.0])
- box.append([ 1.0, 1.0, -1.0])
- box.append([ 1.0, 1.0, 1.0])
-
- if (cam.boxInsideFrustum(box) != cam.OUTSIDE):
- # Box is inside/intersects frustum !
- # Do something useful !
- else:
- # Box is outside the frustum !
-
- @note: when the camera is first initialized the result will be invalid because the projection matrix has not been set.
- @return: INSIDE, OUTSIDE or INTERSECT
- @type box: list
- @param box: Eight (8) corner points of the box (in world coordinates.)
- """
- def pointInsideFrustum(point):
- """
- Tests the given point against the view frustum.
-
- Example::
- import GameLogic
- co = GameLogic.getCurrentController()
- cam = co.owner
-
- # Test point [0.0, 0.0, 0.0]
- if (cam.pointInsideFrustum([0.0, 0.0, 0.0])):
- # Point is inside frustum !
- # Do something useful !
- else:
- # Box is outside the frustum !
-
- @note: when the camera is first initialized the result will be invalid because the projection matrix has not been set.
- @rtype: boolean
- @return: True if the given point is inside this camera's viewing frustum.
- @type point: [x, y, z]
- @param point: The point to test (in world coordinates.)
- """
- def getCameraToWorld():
- """
- Returns the camera-to-world transform.
-
- @rtype: matrix (4x4 list)
- @return: the camera-to-world transform matrix.
- """
- def getWorldToCamera():
- """
- Returns the world-to-camera transform.
-
- This returns the inverse matrix of getCameraToWorld().
-
- @rtype: matrix (4x4 list)
- @return: the world-to-camera transform matrix.
- """
- def getProjectionMatrix():
- """
- Returns the camera's projection matrix.
-
- @deprecated: Use the L{projection_matrix} attribute instead.
- @rtype: matrix (4x4 list)
- @return: the camera's projection matrix.
- """
- def setProjectionMatrix(matrix):
- """
- Sets the camera's projection matrix.
-
- You should use normalised device coordinates for the clipping planes:
- left = -1.0, right = 1.0, top = 1.0, bottom = -1.0, near = cam.near, far = cam.far
-
- Example::
- import GameLogic
-
- def Scale(matrix, size):
- for y in range(4):
- for x in range(4):
- matrix[y][x] = matrix[y][x] * size[y]
- return matrix
-
- # Generate a perspective projection matrix
- def Perspective(cam):
- return [[cam.near, 0.0 , 0.0 , 0.0 ],
- [0.0 , cam.near, 0.0 , 0.0 ],
- [0.0 , 0.0 , -(cam.far+cam.near)/(cam.far-cam.near), -2.0*cam.far*cam.near/(cam.far - cam.near)],
- [0.0 , 0.0 , -1.0 , 0.0 ]]
-
- # Generate an orthographic projection matrix
- # You will need to scale the camera
- def Orthographic(cam):
- return [[1.0/cam.scaling[0], 0.0 , 0.0 , 0.0 ],
- [0.0 , 1.0/cam.scaling[1], 0.0 , 0.0 ],
- [0.0 , 0.0 , -2.0/(cam.far-cam.near), -(cam.far+cam.near)/(cam.far-cam.near)],
- [0.0 , 0.0 , 0.0 , 1.0 ]]
-
- # Generate an isometric projection matrix
- def Isometric(cam):
- return Scale([[0.707, 0.0 , 0.707, 0.0],
- [0.408, 0.816,-0.408, 0.0],
- [0.0 , 0.0 , 0.0 , 0.0],
- [0.0 , 0.0 , 0.0 , 1.0]],
- [1.0/cam.scaling[0], 1.0/cam.scaling[1], 1.0/cam.scaling[2], 1.0])
-
- co = GameLogic.getCurrentController()
- cam = co.owner
- cam.setProjectionMatrix(Perspective(cam)))
-
- @deprecated: Use the L{projection_matrix} attribute instead.
- @type matrix: 4x4 matrix.
- @param matrix: The new projection matrix for this camera.
- """
-
- def enableViewport(viewport):
- """
- Use this camera to draw a viewport on the screen (for split screen games or overlay scenes). The viewport region is defined with L{setViewport}.
-
- @deprecated: Use the L{useViewport} attribute instead.
- @type viewport: bool
- @param viewport: the new viewport status
- """
- def setOnTop():
- """
- Set this cameras viewport ontop of all other viewport.
- """
- def setViewport(left, bottom, right, top):
- """
- Sets the region of this viewport on the screen in pixels.
-
- Use L{Rasterizer.getWindowHeight} L{Rasterizer.getWindowWidth} to calculate values relative to the entire display.
-
- @type left: int
- @type bottom: int
- @type right: int
- @type top: int
- """
- def getScreenPosition(arg):
- """
- Gets the position of an object projected on screen space.
-
- Example:
- # For an object in the middle of the screen, coord = [0.5,0.5]
- coord = camera.getScreenPosition(object)
-
- @param arg: L{KX_GameObject}, object name or list [x, y, z]
- @rtype: list [x, y]
- @return: the object's position in screen coordinates.
- """
- def getScreenVect(x, y):
- """
- Gets the vector from the camera position in the screen coordinate direction.
-
- Example:
- # Gets the vector of the camera front direction:
- m_vect = camera.getScreenVect(0.5,0.5)
-
- @type x: float
- @type y: float
- @rtype: 3d vector
- @return: the vector from a screen coordinate.
- """
- def getScreenRay(x, y, dist, property):
- """
- Look towards a screen coordinate (x,y) and find first object hit within dist that matches prop.
- The ray is similar to KX_GameObject->rayCastTo.
-
- Example:
- # Gets an object with a property "wall" in front of the camera within a distance of 100:
- target = camera.getScreenRay(0.5,0.5,100,"wall")
-
- @type x: float
- @type y: float
- @param dist: max distance to look (can be negative => look behind); 0 or omitted => detect up to other
- @type dist: float
- @param property: property name that object must have; can be omitted => detect any object
- @type property: string
- @rtype: L{KX_GameObject}
- @return: the first object hit or None if no object or object does not match prop
- """
-
-class BL_ArmatureObject(KX_GameObject):
- """
- An armature object.
-
- @ivar constraints: The list of armature constraint defined on this armature
- Elements of the list can be accessed by index or string.
- The key format for string access is '<bone_name>:<constraint_name>'
- @type constraints: list of L{BL_ArmatureConstraint}
- @ivar channels: The list of armature channels.
- Elements of the list can be accessed by index or name the bone.
- @type channels: list of L{BL_ArmatureChannel}
- """
-
- def update():
- """
- Ensures that the armature will be updated on next graphic frame.
-
- This action is unecessary if a KX_ArmatureActuator with mode run is active
- or if an action is playing. Use this function in other cases. It must be called
- on each frame to ensure that the armature is updated continously.
- """
-
-class BL_ArmatureActuator(SCA_IActuator):
- """
- Armature Actuators change constraint condition on armatures.
-
- @group Constants: KX_ACT_ARMATURE_RUN, KX_ACT_ARMATURE_ENABLE, KX_ACT_ARMATURE_DISABLE, KX_ACT_ARMATURE_SETTARGET, KX_ACT_ARMATURE_SETWEIGHT
- @ivar KX_ACT_ARMATURE_RUN: see type
- @ivar KX_ACT_ARMATURE_ENABLE: see type
- @ivar KX_ACT_ARMATURE_DISABLE: see type
- @ivar KX_ACT_ARMATURE_SETTARGET: see type
- @ivar KX_ACT_ARMATURE_SETWEIGHT: see type
- @ivar type: The type of action that the actuator executes when it is active.
-
- KX_ACT_ARMATURE_RUN(0): just make sure the armature will be updated on the next graphic frame
- This is the only persistent mode of the actuator: it executes automatically once per frame until stopped by a controller
-
- KX_ACT_ARMATURE_ENABLE(1): enable the constraint.
-
- KX_ACT_ARMATURE_DISABLE(2): disable the constraint (runtime constraint values are not updated).
-
- KX_ACT_ARMATURE_SETTARGET(3): change target and subtarget of constraint
-
- KX_ACT_ARMATURE_SETWEIGHT(4): change weight of (only for IK constraint)
- @type type: integer
- @ivar constraint: The constraint object this actuator is controlling.
- @type constraint: L{BL_ArmatureConstraint}
- @ivar target: The object that this actuator will set as primary target to the constraint it controls
- @type target: L{KX_GameObject}
- @ivar subtarget: The object that this actuator will set as secondary target to the constraint it controls.
- Currently, the only secondary target is the pole target for IK constraint.
- @type subtarget: L{KX_GameObject}
- @ivar weight: The weight this actuator will set on the constraint it controls.
- Currently only the IK constraint has a weight. It must be a value between 0 and 1.
- A weight of 0 disables a constraint while still updating constraint runtime values (see L{BL_ArmatureConstraint})
- @type weight: float
- """
-
-class KX_ArmatureSensor(SCA_ISensor):
- """
- Armature sensor detect conditions on armatures.
-
- @group Constants: KX_ARMSENSOR_STATE_CHANGED, KX_ARMSENSOR_LIN_ERROR_BELOW, KX_ARMSENSOR_LIN_ERROR_ABOVE, KX_ARMSENSOR_ROT_ERROR_BELOW, KX_ARMSENSOR_ROT_ERROR_ABOVE
- @ivar KX_ARMSENSOR_STATE_CHANGED: see type
- @ivar KX_ARMSENSOR_LIN_ERROR_BELOW: see type
- @ivar KX_ARMSENSOR_LIN_ERROR_ABOVE: see type
- @ivar KX_ARMSENSOR_ROT_ERROR_BELOW: see type
- @ivar KX_ARMSENSOR_ROT_ERROR_ABOVE: see type
- @ivar type: The type of measurement that the sensor make when it is active.
-
- KX_ARMSENSOR_STATE_CHANGED(0): detect that the constraint is changing state (active/inactive)
-
- KX_ARMSENSOR_LIN_ERROR_BELOW(1): detect that the constraint linear error is above a threshold
-
- KX_ARMSENSOR_LIN_ERROR_ABOVE(2): detect that the constraint linear error is below a threshold
-
- KX_ARMSENSOR_ROT_ERROR_BELOW(3): detect that the constraint rotation error is above a threshold
-
- KX_ARMSENSOR_ROT_ERROR_ABOVE(4): detect that the constraint rotation error is below a threshold
- @type type: integer
- @ivar constraint: The constraint object this sensor is watching.
- @type constraint: L{BL_ArmatureConstraint}
- @ivar value: The threshold used in the comparison with the constraint error
- The linear error is only updated on CopyPose/Distance IK constraint with iTaSC solver
- The rotation error is only updated on CopyPose+rotation IK constraint with iTaSC solver
- The linear error on CopyPose is always >= 0: it is the norm of the distance between the target and the bone
- The rotation error on CopyPose is always >= 0: it is the norm of the equivalent rotation vector between the bone and the target orientations
- The linear error on Distance can be positive if the distance between the bone and the target is greater than the desired distance, and negative if the distance is smaller
- @type value: float
- """
-
-class BL_ArmatureConstraint(PyObjectPlus):
- """
- Proxy to Armature Constraint. Allows to change constraint on the fly.
- Obtained through L{BL_ArmatureObject}.constraints.
- Note: not all armature constraints are supported in the GE.
-
- @group Constants: CONSTRAINT_TYPE_TRACKTO, CONSTRAINT_TYPE_KINEMATIC, CONSTRAINT_TYPE_ROTLIKE, CONSTRAINT_TYPE_LOCLIKE, CONSTRAINT_TYPE_MINMAX, CONSTRAINT_TYPE_SIZELIKE, CONSTRAINT_TYPE_LOCKTRACK, CONSTRAINT_TYPE_STRETCHTO, CONSTRAINT_TYPE_CLAMPTO, CONSTRAINT_TYPE_TRANSFORM, CONSTRAINT_TYPE_DISTLIMIT,CONSTRAINT_IK_COPYPOSE, CONSTRAINT_IK_DISTANCE,CONSTRAINT_IK_MODE_INSIDE, CONSTRAINT_IK_MODE_OUTSIDE,CONSTRAINT_IK_MODE_ONSURFACE,CONSTRAINT_IK_FLAG_TIP,CONSTRAINT_IK_FLAG_ROT, CONSTRAINT_IK_FLAG_STRETCH, CONSTRAINT_IK_FLAG_POS
- @ivar CONSTRAINT_TYPE_TRACKTO: see type
- @ivar CONSTRAINT_TYPE_KINEMATIC: see type
- @ivar CONSTRAINT_TYPE_ROTLIKE: see type
- @ivar CONSTRAINT_TYPE_LOCLIKE: see type
- @ivar CONSTRAINT_TYPE_MINMAX: see type
- @ivar CONSTRAINT_TYPE_SIZELIKE: see type
- @ivar CONSTRAINT_TYPE_LOCKTRACK: see type
- @ivar CONSTRAINT_TYPE_STRETCHTO: see type
- @ivar CONSTRAINT_TYPE_CLAMPTO: see type
- @ivar CONSTRAINT_TYPE_TRANSFORM: see type
- @ivar CONSTRAINT_TYPE_DISTLIMIT: see type
- @ivar CONSTRAINT_IK_COPYPOSE: see ik_type
- @ivar CONSTRAINT_IK_DISTANCE: see ik_type
- @ivar CONSTRAINT_IK_MODE_INSIDE: see ik_mode
- @ivar CONSTRAINT_IK_MODE_OUTSIDE: see ik_mode
- @ivar CONSTRAINT_IK_MODE_ONSURFACE: see ik_mode
- @ivar CONSTRAINT_IK_FLAG_TIP: see ik_flag
- @ivar CONSTRAINT_IK_FLAG_ROT: see ik_flag
- @ivar CONSTRAINT_IK_FLAG_STRETCH: see ik_flag
- @ivar CONSTRAINT_IK_FLAG_POS: see ik_flag
- @ivar type: Type of constraint, read-only
- @type type: integer, one of CONSTRAINT_TYPE_ constant
- @ivar name: Name of constraint constructed as <bone_name>:<constraint_name>
- This name is also the key subscript on L{BL_ArmatureObject}.constraints list
- @type name: string
- @ivar enforce: fraction of constraint effect that is enforced. Between 0 and 1.
- @type enforce: float
- @ivar headtail: position of target between head and tail of the target bone: 0=head, 1=tail
- Only used if the target is a bone (i.e target object is an armature)
- @type headtail: float
- @ivar lin_error: runtime linear error (in Blender unit) on constraint at the current frame.
- This is a runtime value updated on each frame by the IK solver. Only available on IK constraint and iTaSC solver.
- @type lin_error: float
- @ivar rot_error: runtime rotation error (in radiant) on constraint at the current frame.
- This is a runtime value updated on each frame by the IK solver. Only available on IK constraint and iTaSC solver.
- It is only set if the constraint has a rotation part, for example, a CopyPose+Rotation IK constraint.
- @type rot_error: float
- @ivar target: Primary target object for the constraint. The position of this object in the GE will be used as target for the constraint.
- @type target: L{KX_GameObject}
- @ivar subtarget: Secondary target object for the constraint. The position of this object in the GE will be used as secondary target for the constraint.
- Currently this is only used for pole target on IK constraint.
- @type subtarget: L{KX_GameObject}
- @ivar active: True if the constraint is active.
- Note: an inactive constraint does not update lin_error and rot_error.
- @type active: boolean
- @ivar ik_weight: Weight of the IK constraint between 0 and 1.
- Only defined for IK constraint.
- @type ik_weight: float
- @ivar ik_type: Type of IK constraint, read-only
-
- CONSTRAINT_IK_COPYPOSE(0): constraint is trying to match the position and eventually the rotation of the target.
-
- CONSTRAINT_IK_DISTANCE(1): constraint is maintaining a certain distance to target subject to ik_mode
- @type ik_type: integer
- @ivar ik_flag: Combination of IK constraint option flags, read-only
-
- CONSTRAINT_IK_FLAG_TIP(1) : set when the constraint operates on the head of the bone and not the tail
-
- CONSTRAINT_IK_FLAG_ROT(2) : set when the constraint tries to match the orientation of the target
-
- CONSTRAINT_IK_FLAG_STRETCH(16) : set when the armature is allowed to stretch (only the bones with stretch factor > 0.0)
-
- CONSTRAINT_IK_FLAG_POS(32) : set when the constraint tries to match the position of the target
- @type ik_flag: integer
- @ivar ik_dist: Distance the constraint is trying to maintain with target, only used when ik_type=CONSTRAINT_IK_DISTANCE
- @type ik_dist: float
- @ivar ik_mode: Additional mode for IK constraint. Currently only used for Distance constraint:
-
- CONSTRAINT_IK_MODE_INSIDE(0) : the constraint tries to keep the bone within ik_dist of target
-
- CONSTRAINT_IK_MODE_OUTSIDE(1) : the constraint tries to keep the bone outside ik_dist of the target
-
- CONSTRAINT_IK_MODE_ONSURFACE(2) : the constraint tries to keep the bone exactly at ik_dist of the target
- @type ik_mode: integer
- """
-
-class BL_ArmatureChannel(PyObjectPlus):
- """
- Proxy to armature pose channel. Allows to read and set armature pose.
- The attributes are identical to RNA attributes, but mostly in read-only mode.
-
- @group Constants: PCHAN_ROT_QUAT, PCHAN_ROT_XYZ, PCHAN_ROT_XZY, PCHAN_ROT_YXZ, PCHAN_ROT_YZX, PCHAN_ROT_ZXY, PCHAN_ROT_ZYX
- @ivar PCHAN_ROT_QUAT: see rotation_mode
- @ivar PCHAN_ROT_XYZ: see rotation_mode
- @ivar PCHAN_ROT_XZY: see rotation_mode
- @ivar PCHAN_ROT_YXZ: see rotation_mode
- @ivar PCHAN_ROT_YZX: see rotation_mode
- @ivar PCHAN_ROT_ZXY: see rotation_mode
- @ivar PCHAN_ROT_ZYX: see rotation_mode
- @ivar name: channel name (=bone name), read-only.
- @type name: string
- @ivar bone: return the bone object corresponding to this pose channel, read-only.
- @type bone: L{BL_ArmatureBone}
- @ivar parent: return the parent channel object, None if root channel, read-only.
- @type parent: L{BL_ArmatureChannel}
- @ivar has_ik: true if the bone is part of an active IK chain, read-only.
- This flag is not set when an IK constraint is defined but not enabled (miss target information for example)
- @type has_ik: boolean
- @ivar ik_dof_x: true if the bone is free to rotation in the X axis, read-only.
- @type ik_dof_x: boolean
- @ivar ik_dof_y: true if the bone is free to rotation in the Y axis, read-only.
- @type ik_dof_y: boolean
- @ivar ik_dof_z: true if the bone is free to rotation in the Z axis, read-only.
- @type ik_dof_z: boolean
- @ivar ik_limit_x: true if a limit is imposed on X rotation, read-only.
- @type ik_limit_x: boolean
- @ivar ik_limit_y: true if a limit is imposed on Y rotation, read-only.
- @type ik_limit_y: boolean
- @ivar ik_limit_z: true if a limit is imposed on Z rotation, read-only.
- @type ik_limit_z: boolean
- @ivar ik_rot_control: true if channel rotation should applied as IK constraint, read-only.
- @type ik_rot_control: boolean
- @ivar ik_lin_control: true if channel size should applied as IK constraint, read-only.
- @type ik_lin_control: boolean
- @ivar location: displacement of the bone head in armature local space, read-write.
- You can only move a bone if it is unconnected to its parent. An action playing on the armature may change the value. An IK chain does not update this value, see joint_rotation.
- Changing this field has no immediate effect, the pose is updated when the armature is updated during the graphic render (see L{BL_ArmatureObject.update})
- @type location: vector [X,Y,Z]
- @ivar scale: scale of the bone relative to its parent, read-write.
- An action playing on the armature may change the value. An IK chain does not update this value, see joint_rotation.
- Changing this field has no immediate effect, the pose is updated when the armature is updated during the graphic render (see L{BL_ArmatureObject.update})
- @type scale: vector [sizeX, sizeY, sizeZ]
- @ivar rotation: rotation of the bone relative to its parent expressed as a quaternion, read-write.
- This field is only used if rotation_mode is 0. An action playing on the armature may change the value. An IK chain does not update this value, see joint_rotation.
- Changing this field has no immediate effect, the pose is updated when the armature is updated during the graphic render (see L{BL_ArmatureObject.update})
- @type rotation: vector [qr, qi, qj, qk]
- @ivar euler_rotation: rotation of the bone relative to its parent expressed as a set of euler angles, read-write.
- This field is only used if rotation_mode is > 0. You must always pass the angles in [X,Y,Z] order; the order of applying the angles to the bone depends on rotation_mode. An action playing on the armature may change this field. An IK chain does not update this value, see joint_rotation.
- Changing this field has no immediate effect, the pose is updated when the armature is updated during the graphic render (see L{BL_ArmatureObject.update})
- @type euler_rotation: vector [X, Y, Z]
- @ivar rotation_mode: method of updating the bone rotation, read-write.
- Use the following constants (euler mode are named as in BLender UI but the actual axis order is reversed):
- - PCHAN_ROT_QUAT(0) : use quaternioin in rotation attribute to update bone rotation
- - PCHAN_ROT_XYZ(1) : use euler_rotation and apply angles on bone's Z, Y, X axis successively
- - PCHAN_ROT_XZY(2) : use euler_rotation and apply angles on bone's Y, Z, X axis successively
- - PCHAN_ROT_YXZ(3) : use euler_rotation and apply angles on bone's Z, X, Y axis successively
- - PCHAN_ROT_YZX(4) : use euler_rotation and apply angles on bone's X, Z, Y axis successively
- - PCHAN_ROT_ZXY(5) : use euler_rotation and apply angles on bone's Y, X, Z axis successively
- - PCHAN_ROT_ZYX(6) : use euler_rotation and apply angles on bone's X, Y, Z axis successively
- @type rotation_mode: integer
- @ivar channel_matrix: pose matrix in bone space (deformation of the bone due to action, constraint, etc), Read-only.
- This field is updated after the graphic render, it represents the current pose.
- @type channel_matrix: matrix [4][4]
- @ivar pose_matrix: pose matrix in armature space, read-only,
- This field is updated after the graphic render, it represents the current pose.
- @type pose_matrix: matrix [4][4]
- @ivar pose_head: position of bone head in armature space, read-only.
- @type pose_head: vector [x, y, z]
- @ivar pose_tail: position of bone tail in armature space, read-only.
- @type pose_tail: vector [x, y, z]
- @ivar ik_min_x: minimum value of X rotation in degree (<= 0) when X rotation is limited (see ik_limit_x), read-only.
- @type ik_min_x: float
- @ivar ik_max_x: maximum value of X rotation in degree (>= 0) when X rotation is limited (see ik_limit_x), read-only.
- @type ik_max_x: float
- @ivar ik_min_y: minimum value of Y rotation in degree (<= 0) when Y rotation is limited (see ik_limit_y), read-only.
- @type ik_min_y: float
- @ivar ik_max_y: maximum value of Y rotation in degree (>= 0) when Y rotation is limited (see ik_limit_y), read-only.
- @type ik_max_y: float
- @ivar ik_min_z: minimum value of Z rotation in degree (<= 0) when Z rotation is limited (see ik_limit_z), read-only.
- @type ik_min_z: float
- @ivar ik_max_z: maximum value of Z rotation in degree (>= 0) when Z rotation is limited (see ik_limit_z), read-only.
- @type ik_max_z: float
- @ivar ik_stiffness_x: bone rotation stiffness in X axis, read-only
- @type ik_stiffness_x: float between 0 and 1
- @ivar ik_stiffness_y: bone rotation stiffness in Y axis, read-only
- @type ik_stiffness_y: float between 0 and 1
- @ivar ik_stiffness_z: bone rotation stiffness in Z axis, read-only
- @type ik_stiffness_z: float between 0 and 1
- @ivar ik_stretch: ratio of scale change that is allowed, 0=bone can't change size, read-only.
- @type ik_stretch: float
- @ivar ik_rot_weight: weight of rotation constraint when ik_rot_control is set, read-write.
- @type ik_rot_weight: float between 0 and 1
- @ivar ik_lin_weight: weight of size constraint when ik_lin_control is set, read-write.
- @type ik_lin_weight: float between 0 and 1
- @ivar joint_rotation: control bone rotation in term of joint angle (for robotic applications), read-write.
- When writing to this attribute, you pass a [x, y, z] vector and an appropriate set of euler angles or quaternion is calculated according to the rotation_mode.
- When you read this attribute, the current pose matrix is converted into a [x, y, z] vector representing the joint angles.
- The value and the meaning of the x, y, z depends on the ik_dof_ attributes:
- - 1DoF joint X, Y or Z: the corresponding x, y, or z value is used an a joint angle in radiant
- - 2DoF joint X+Y or Z+Y: treated as 2 successive 1DoF joints: first X or Z, then Y. The x or z value is used as a joint angle in radiant along the X or Z axis, followed by a rotation along the new Y axis of y radiants.
- - 2DoF joint X+Z: treated as a 2DoF joint with rotation axis on the X/Z plane. The x and z values are used as the coordinates of the rotation vector in the X/Z plane.
- - 3DoF joint X+Y+Z: treated as a revolute joint. The [x,y,z] vector represents the equivalent rotation vector to bring the joint from the rest pose to the new pose.
-
- Notes:
- - The bone must be part of an IK chain if you want to set the ik_dof_ attributes via the UI, but this will interfere with this attribute since the IK solver will overwrite the pose. You can stay in control of the armature if you create an IK constraint but do not finalize it (e.g. don't set a target): the IK solver will not run but the IK panel will show up on the UI for each bone in the chain.
- - [0,0,0] always corresponds to the rest pose.
- - You must request the armature pose to update and wait for the next graphic frame to see the effect of setting this attribute (see L{BL_ArmatureObject.update}).
- - You can read the result of the calculation in rotation or euler_rotation attributes after setting this attribute.
- @type joint_rotation: vector [x, y, z]
- """
-
-class BL_ArmatureBone(PyObjectPlus):
- """
- Proxy to Blender bone structure. All fields are read-only and comply to RNA names.
- All space attribute correspond to the rest pose.
-
- @ivar name: bone name
- @type name: string
- @ivar connected: true when the bone head is struck to the parent's tail
- @type connected: boolean
- @ivar hinge: true when bone doesn't inherit rotation or scale from parent bone
- @type hinge: boolean
- @ivar inherit_scale: true when bone inherits scaling from parent bone
- @type inherit_scale: boolean
- @ivar bbone_segments: number of B-bone segments
- @type bbone_segments: integer
- @ivar roll: bone rotation around head-tail axis
- @type roll: float
- @ivar head: location of head end of the bone in parent bone space
- @type head: vector [x, y, z]
- @ivar tail: location of head end of the bone in parent bone space
- @type tail: vector [x, y, z]
- @ivar length: bone length
- @type length: float
- @ivar arm_head: location of head end of the bone in armature space
- @type arm_head: vector [x, y, z]
- @ivar arm_tail: location of tail end of the bone in armature space
- @type arm_tail: vector [x, y, z]
- @ivar arm_mat: matrix of the bone head in armature space
- This matrix has no scale part.
- @type arm_mat: matrix [4][4]
- @ivar bone_mat: rotation matrix of the bone in parent bone space.
- @type bone_mat: matrix [3][3]
- @ivar parent: parent bone, or None for root bone
- @type parent: L{BL_ArmatureBone}
- @ivar children: list of bone's children
- @type children: list of L{BL_ArmatureBone}
- """
-# Util func to extract all attrs
-"""
-import types
-attrs = []
-for name, val in locals().items():
- if name.startswith('__'):
- continue
- if type(val) == types.ClassType:
- for line in val.__doc__.split('\n'):
- if '@ivar' in line:
- attrs.append(name + '::' + line.split()[1].replace(':', ''))
-
-for a in attrs:
- print a
-"""
-
-
-# Util func to construct a mapping from deprecated attrs to new ones.
-"""
-import types
-import re
-import pprint
-depAttrs = {}
-for name, val in locals().items():
- if name.startswith('__'):
- continue
- if type(val) == types.ClassType:
- print "\t# %s" % name
-
- # Inspect each attribute.
- for attrName in dir(val):
- if attrName.startswith('__'):
- continue
- attr = getattr(val, attrName)
-
- # Check whether this attribute is deprecated by searching each line.
- newAttrName = None
- for line in attr.__doc__.split('\n'):
- match = re.search(r'@deprecated.*L{(\w+)}', line)
- if match:
- newAttrName = match.group(1)
- break
- if not newAttrName:
- continue
-
- # Store the mappings to new attributes in a list (because there
- # could be collisions).
- if attrName not in depAttrs:
- depAttrs[attrName] = {}
- mapping = depAttrs[attrName]
-
- for line in val.__doc__.split('\n'):
- if ("@type %s:" % newAttrName) in line:
- # The attribute is being replaced in this class (i.e. the
- # deprecated attribute wasn't inherited from a parent). We
- # have a winner!
- funcType = None
- if 'sequence' in line:
- funcType = 'Keyed'
- else:
- funcType = 'Simple'
-
- if attrName.startswith('get') or attrName.startswith('is'):
- func = "replace%sGetter" % funcType
- elif attrName.startswith('set') or attrName.startswith('enable'):
- func = "replace%sSetter" % funcType
- else:
- func = 'UNKNOWN'
-
- # Another mapping, from a conversion tuple to lists of class
- # names.
- conversion = (func, newAttrName)
- if conversion not in mapping:
- mapping[conversion] = []
- mapping[conversion].append(name)
- break
-
-pprint.pprint(depAttrs, width = 100)
-"""
diff --git a/source/gameengine/PyDoc/Rasterizer.py b/source/gameengine/PyDoc/Rasterizer.py
deleted file mode 100644
index 8fd4d506bde..00000000000
--- a/source/gameengine/PyDoc/Rasterizer.py
+++ /dev/null
@@ -1,221 +0,0 @@
-# $Id$
-"""
-Documentation for the Rasterizer module.
-
-Example Uses an L{SCA_MouseSensor}, and two L{KX_ObjectActuator}s to implement MouseLook::
- # To use a mouse movement sensor "Mouse" and a
- # motion actuator to mouse look:
- import Rasterizer
- import GameLogic
-
- # SCALE sets the speed of motion
- SCALE=[1, 0.5]
-
- co = GameLogic.getCurrentController()
- obj = co.getOwner()
- mouse = co.getSensor("Mouse")
- lmotion = co.getActuator("LMove")
- wmotion = co.getActuator("WMove")
-
- # Transform the mouse coordinates to see how far the mouse has moved.
- def mousePos():
- x = (Rasterizer.getWindowWidth()/2 - mouse.getXPosition())*SCALE[0]
- y = (Rasterizer.getWindowHeight()/2 - mouse.getYPosition())*SCALE[1]
- return (x, y)
-
- pos = mousePos()
-
- # Set the amount of motion: X is applied in world coordinates...
- lmotion.setTorque(0.0, 0.0, pos[0], False)
- # ...Y is applied in local coordinates
- wmotion.setTorque(-pos[1], 0.0, 0.0, True)
-
- # Activate both actuators
- GameLogic.addActiveActuator(lmotion, True)
- GameLogic.addActiveActuator(wmotion, True)
-
- # Centre the mouse
- Rasterizer.setMousePosition(Rasterizer.getWindowWidth()/2, Rasterizer.getWindowHeight()/2)
-
-@group Material Types: KX_TEXFACE_MATERIAL, KX_BLENDER_MULTITEX_MATERIAL, KX_BLENDER_GLSL_MATERIAL
-@var KX_TEXFACE_MATERIAL: Materials as defined by the texture face settings.
-@var KX_BLENDER_MULTITEX_MATERIAL: Materials approximating blender materials with multitexturing.
-@var KX_BLENDER_GLSL_MATERIAL: Materials approximating blender materials with GLSL.
-
-"""
-def getWindowWidth():
- """
- Gets the width of the window (in pixels)
-
- @rtype: integer
- """
-def getWindowHeight():
- """
- Gets the height of the window (in pixels)
-
- @rtype: integer
- """
-def makeScreenshot(filename):
- """
- Writes a screenshot to the given filename.
-
- If filename starts with // the image will be saved relative to the current directory.
- If the filename contains # it will be replaced with the frame number.
-
- The standalone player saves .png files. It does not support colour space conversion
- or gamma correction.
-
- When run from Blender, makeScreenshot supports Iris, IrisZ, TGA, Raw TGA, PNG, HamX, and Jpeg.
- Gamma, Colourspace conversion and Jpeg compression are taken from the Render settings panels.
-
- @type filename: string
- """
-
-def enableVisibility(visible):
- """
- Doesn't really do anything...
- """
-
-def showMouse(visible):
- """
- Enables or disables the operating system mouse cursor.
-
- @type visible: boolean
- """
-
-def setMousePosition(x, y):
- """
- Sets the mouse cursor position.
-
- @type x: integer
- @type y: integer
- """
-
-def setBackgroundColor(rgba):
- """
- Sets the window background colour.
-
- @type rgba: list [r, g, b, a]
- """
-
-def setMistColor(rgb):
- """
- Sets the mist colour.
-
- @type rgb: list [r, g, b]
- """
-
-def setAmbientColor(rgb):
- """
- Sets the color of ambient light.
-
- @type rgb: list [r, g, b]
- """
-
-def setMistStart(start):
- """
- Sets the mist start value. Objects further away than start will have mist applied to them.
-
- @type start: float
- """
-
-def setMistEnd(end):
- """
- Sets the mist end value. Objects further away from this will be coloured solid with
- the colour set by setMistColor().
-
- @type end: float
- """
-
-def disableMist():
- """
- Disables mist.
-
- @note: Set any of the mist properties to enable mist.
- """
-
-def setEyeSeparation(eyesep):
- """
- Sets the eye separation for stereo mode. Usually Focal Length/30 provides a confortable value.
-
- @param eyesep: The distance between the left and right eye.
- @type eyesep: float
- """
-
-def getEyeSeparation():
- """
- Gets the current eye separation for stereo mode.
-
- @rtype: float
- """
-
-def setFocalLength(focallength):
- """
- Sets the focal length for stereo mode. It uses the current camera focal length as initial value.
-
- @param focallength: The focal length.
- @type focallength: float
- """
-
-def getFocalLength():
- """
- Gets the current focal length for stereo mode.
-
- @rtype: float
- """
-
-def setMaterialMode(mode):
- """
- Set the material mode to use for OpenGL rendering.
-
- @type mode: KX_TEXFACE_MATERIAL, KX_BLENDER_MULTITEX_MATERIAL, KX_BLENDER_GLSL_MATERIAL
- @note: Changes will only affect newly created scenes.
- """
-
-def getMaterialMode(mode):
- """
- Get the material mode to use for OpenGL rendering.
-
- @rtype: KX_TEXFACE_MATERIAL, KX_BLENDER_MULTITEX_MATERIAL, KX_BLENDER_GLSL_MATERIAL
- """
-
-def setGLSLMaterialSetting(setting, enable):
- """
- Enables or disables a GLSL material setting.
-
- @type setting: string (lights, shaders, shadows, ramps, nodes, extra_textures)
- @type enable: boolean
- """
-
-def getGLSLMaterialSetting(setting, enable):
- """
- Get the state of a GLSL material setting.
-
- @type setting: string (lights, shaders, shadows, ramps, nodes, extra_textures)
- @rtype: boolean
- """
-
-def drawLine(fromVec,toVec,color):
- """
- Draw a line in the 3D scene.
-
- @param fromVec: the origin of the line
- @type fromVec: list [x, y, z]
- @param toVec: the end of the line
- @type toVec: list [x, y, z]
- @param color: the color of the line
- @type color: list [r, g, b]
- """
-
-def enableMotionBlur(factor):
- """
- Enable the motion blue effect.
-
- @param factor: the ammount of motion blur to display.
- @type factor: float [0.0 - 1.0]
- """
-
-def disableMotionBlur():
- """
- Disable the motion blue effect.
- """
diff --git a/source/gameengine/PyDoc/bge.events.rst b/source/gameengine/PyDoc/bge.events.rst
new file mode 100644
index 00000000000..afdcf39f178
--- /dev/null
+++ b/source/gameengine/PyDoc/bge.events.rst
@@ -0,0 +1,194 @@
+
+Game Engine bge.events module.
+==============================
+
+This module holds key constants for the SCA_KeyboardSensor.
+
+.. module:: bge.events
+
+.. code-block:: python
+
+ # Set a connected keyboard sensor to accept F1
+ import bge
+
+ co = bge.logic.getCurrentController()
+ # 'Keyboard' is a keyboard sensor
+ sensor = co.sensors["Keyboard"]
+ sensor.key = bge.keys.F1KEY
+
+.. code-block:: python
+
+ # Do the all keys thing
+ import bge
+
+ co = bge.logic.getCurrentController()
+ # 'Keyboard' is a keyboard sensor
+ sensor = co.sensors["Keyboard"]
+
+ for key,status in sensor.events:
+ # key[0] == bge.keys.keycode, key[1] = status
+ if status == bge.logic.KX_INPUT_JUST_ACTIVATED:
+ if key == bge.keys.WKEY:
+ # Activate Forward!
+ if key == bge.keys.SKEY:
+ # Activate Backward!
+ if key == bge.keys.AKEY:
+ # Activate Left!
+ if key == bge.keys.DKEY:
+ # Activate Right!
+
+.. function:: EventToString(event)
+
+ Return the string name of a key event. Will raise a ValueError error if its invalid.
+
+ :arg event: key event from bge.keys or the keyboard sensor.
+ :type event: int
+ :rtype: string
+
+.. function:: EventToCharacter(event, shift)
+
+ Return the string name of a key event. Returns an empty string if the event cant be represented as a character.
+
+ :type event: int
+ :arg event: key event from :mod:`bge.keys` or the keyboard sensor.
+ :type shift: bool
+ :arg shift: set to true if shift is held.
+ :rtype: string
+
+
+**Alphabet keys**
+
+.. data:: AKEY
+.. data:: BKEY
+.. data:: CKEY
+.. data:: DKEY
+.. data:: EKEY
+.. data:: FKEY
+.. data:: GKEY
+.. data:: HKEY
+.. data:: IKEY
+.. data:: JKEY
+.. data:: KKEY
+.. data:: LKEY
+.. data:: MKEY
+.. data:: NKEY
+.. data:: OKEY
+.. data:: PKEY
+.. data:: QKEY
+.. data:: RKEY
+.. data:: SKEY
+.. data:: TKEY
+.. data:: UKEY
+.. data:: VKEY
+.. data:: WKEY
+.. data:: XKEY
+.. data:: YKEY
+.. data:: ZKEY
+
+**Number keys**
+
+.. data:: ZEROKEY
+.. data:: ONEKEY
+.. data:: TWOKEY
+.. data:: THREEKEY
+.. data:: FOURKEY
+.. data:: FIVEKEY
+.. data:: SIXKEY
+.. data:: SEVENKEY
+.. data:: EIGHTKEY
+.. data:: NINEKEY
+
+**Modifiers**
+
+.. data:: CAPSLOCKKEY
+.. data:: LEFTCTRLKEY
+.. data:: LEFTALTKEY
+.. data:: RIGHTALTKEY
+.. data:: RIGHTCTRLKEY
+.. data:: RIGHTSHIFTKEY
+.. data:: LEFTSHIFTKEY
+
+**Arrow Keys**
+
+.. data:: LEFTARROWKEY
+.. data:: DOWNARROWKEY
+.. data:: RIGHTARROWKEY
+.. data:: UPARROWKEY
+
+**Numberpad Keys**
+
+.. data:: PAD0
+.. data:: PAD1
+.. data:: PAD2
+.. data:: PAD3
+.. data:: PAD4
+.. data:: PAD5
+.. data:: PAD6
+.. data:: PAD7
+.. data:: PAD8
+.. data:: PAD9
+.. data:: PADPERIOD
+.. data:: PADSLASHKEY
+.. data:: PADASTERKEY
+.. data:: PADMINUS
+.. data:: PADENTER
+.. data:: PADPLUSKEY
+
+**Function Keys**
+
+.. data:: F1KEY
+.. data:: F2KEY
+.. data:: F3KEY
+.. data:: F4KEY
+.. data:: F5KEY
+.. data:: F6KEY
+.. data:: F7KEY
+.. data:: F8KEY
+.. data:: F9KEY
+.. data:: F10KEY
+.. data:: F11KEY
+.. data:: F12KEY
+.. data:: F13KEY
+.. data:: F14KEY
+.. data:: F15KEY
+.. data:: F16KEY
+.. data:: F17KEY
+.. data:: F18KEY
+.. data:: F19KEY
+
+**Other Keys**
+
+.. data:: ACCENTGRAVEKEY
+.. data:: BACKSLASHKEY
+.. data:: BACKSPACEKEY
+.. data:: COMMAKEY
+.. data:: DELKEY
+.. data:: ENDKEY
+.. data:: EQUALKEY
+.. data:: ESCKEY
+.. data:: HOMEKEY
+.. data:: INSERTKEY
+.. data:: LEFTBRACKETKEY
+.. data:: LINEFEEDKEY
+.. data:: MINUSKEY
+.. data:: PAGEDOWNKEY
+.. data:: PAGEUPKEY
+.. data:: PAUSEKEY
+.. data:: PERIODKEY
+.. data:: QUOTEKEY
+.. data:: RIGHTBRACKETKEY
+.. data:: RETKEY
+.. data:: SEMICOLONKEY
+.. data:: SLASHKEY
+.. data:: SPACEKEY
+.. data:: TABKEY
+
+**Mouse Events**
+
+.. data:: LEFTMOUSE
+.. data:: MIDDLEMOUSE
+.. data:: RIGHTMOUSE
+.. data:: WHEELUPMOUSE
+.. data:: WHEELDOWNMOUSE
+.. data:: MOUSEX
+.. data:: MOUSEY:
diff --git a/source/gameengine/PyDoc/bge.logic.rst b/source/gameengine/PyDoc/bge.logic.rst
new file mode 100644
index 00000000000..7fb2c3df67a
--- /dev/null
+++ b/source/gameengine/PyDoc/bge.logic.rst
@@ -0,0 +1,622 @@
+
+Game Engine bge.logic Module.
+=============================
+
+Module to access logic functions, imported automatically into the python controllers namespace.
+
+.. module:: bge.logic
+
+.. code-block:: python
+
+ # To get the controller thats running this python script:
+ cont = bge.logic.getCurrentController() # bge.logic is automatically imported
+
+ # To get the game object this controller is on:
+ obj = cont.owner
+
+:class:`bge.types.KX_GameObject` and :class:`bge.types.KX_Camera` or :class:`bge.types.KX_LightObject` methods are available depending on the type of object
+
+.. code-block:: python
+
+ # To get a sensor linked to this controller.
+ # "sensorname" is the name of the sensor as defined in the Blender interface.
+ # +---------------------+ +--------+
+ # | Sensor "sensorname" +--+ Python +
+ # +---------------------+ +--------+
+ sens = cont.sensors["sensorname"]
+
+ # To get a sequence of all sensors:
+ sensors = co.sensors
+
+See the sensor's reference for available methods:
+
+* :class:`bge.types.SCA_DelaySensor`
+* :class:`bge.types.SCA_JoystickSensor`
+* :class:`bge.types.SCA_KeyboardSensor`
+* :class:`bge.types.KX_MouseFocusSensor`
+* :class:`bge.types.SCA_MouseSensor`
+* :class:`bge.types.KX_NearSensor`
+* :class:`bge.types.KX_NetworkMessageSensor`
+* :class:`bge.types.SCA_PropertySensor`
+* :class:`bge.types.KX_RadarSensor`
+* :class:`bge.types.SCA_RandomSensor`
+* :class:`bge.types.KX_RaySensor`
+* :class:`bge.types.KX_TouchSensor`
+
+You can also access actuators linked to the controller
+
+.. code-block:: python
+
+ # To get an actuator attached to the controller:
+ # +--------+ +-------------------------+
+ # + Python +--+ Actuator "actuatorname" |
+ # +--------+ +-------------------------+
+ actuator = co.actuators["actuatorname"]
+
+ # Activate an actuator
+ controller.activate(actuator)
+
+
+See the actuator's reference for available methods
+
+* :class:`bge.types.SCA_2DFilterActuator`
+* :class:`bge.types.BL_ActionActuator`
+* :class:`bge.types.KX_SCA_AddObjectActuator`
+* :class:`bge.types.KX_CameraActuator`
+* :class:`bge.types.KX_ConstraintActuator`
+* :class:`bge.types.KX_SCA_DynamicActuator`
+* :class:`bge.types.KX_SCA_EndObjectActuator`
+* :class:`bge.types.KX_GameActuator`
+* :class:`bge.types.KX_IpoActuator`
+* :class:`bge.types.KX_NetworkMessageActuator`
+* :class:`bge.types.KX_ObjectActuator`
+* :class:`bge.types.KX_ParentActuator`
+* :class:`bge.types.SCA_PropertyActuator`
+* :class:`bge.types.SCA_RandomActuator`
+* :class:`bge.types.KX_SCA_ReplaceMeshActuator`
+* :class:`bge.types.KX_SceneActuator`
+* :class:`bge.types.BL_ShapeActionActuator`
+* :class:`bge.types.KX_SoundActuator`
+* :class:`bge.types.KX_StateActuator`
+* :class:`bge.types.KX_TrackToActuator`
+* :class:`bge.types.KX_VisibilityActuator`
+
+Most logic brick's methods are accessors for the properties available in the logic buttons.
+Consult the logic bricks documentation for more information on how each logic brick works.
+
+There are also methods to access the current :class:`bge.types.KX_Scene`
+
+.. code-block:: python
+
+ # Get the current scene
+ scene = bge.logic.getCurrentScene()
+
+ # Get the current camera
+ cam = scene.active_camera
+
+Matricies as used by the game engine are **row major**
+``matrix[row][col] = float``
+
+:class:`bge.types.KX_Camera` has some examples using matricies.
+
+
+.. data:: globalDict
+
+ A dictionary that is saved between loading blend files so you can use it to store inventory and other variables you want to store between scenes and blend files.
+ It can also be written to a file and loaded later on with the game load/save actuators.
+
+ .. note:: only python built in types such as int/string/bool/float/tuples/lists can be saved, GameObjects, Actuators etc will not work as expectred.
+
+.. data:: keyboard: The current keyboard wrapped in an SCA_PythonKeyboard object.
+.. data:: mouse: The current mouse wrapped in an SCA_PythonMouse object.
+
+.. function:: getCurrentController()
+
+ Gets the Python controller associated with this Python script.
+
+ :rtype: :class:`bge.types.SCA_PythonController`
+
+.. function:: getCurrentScene()
+
+ Gets the current Scene.
+
+ :rtype: :class:`bge.types.KX_Scene`
+
+.. function:: getSceneList()
+
+ Gets a list of the current scenes loaded in the game engine.
+
+ :rtype: list of :class:`bge.types.KX_Scene`
+
+ .. note:: Scenes in your blend file that have not been converted wont be in this list. This list will only contain scenes such as overlays scenes.
+
+.. function:: loadGlobalDict()
+
+ Loads bge.logic.globalDict from a file.
+
+.. function:: saveGlobalDict()
+
+ Saves bge.logic.globalDict to a file.
+
+.. function:: addScene(name, overlay=1)
+
+ Loads a scene into the game engine.
+
+ :arg name: The name of the scene
+ :type name: string
+ :arg overlay: Overlay or underlay (optional)
+ :type overlay: integer
+
+.. function:: sendMessage(subject, body="", to="", message_from="")
+
+ Sends a message to sensors in any active scene.
+
+ :arg subject: The subject of the message
+ :type subject: string
+ :arg body: The body of the message (optional)
+ :type body: string
+ :arg to: The name of the object to send the message to (optional)
+ :type to: string
+ :arg message_from: The name of the object that the message is coming from (optional)
+ :type message_from: string
+
+.. function:: setGravity(gravity)
+
+ Sets the world gravity.
+
+ :type gravity: list [fx, fy, fz]
+
+.. function:: getSpectrum()
+
+ Returns a 512 point list from the sound card.
+ This only works if the fmod sound driver is being used.
+
+ :rtype: list [float], len(getSpectrum()) == 512
+
+.. function:: stopDSP()
+
+ Stops the sound driver using DSP effects.
+
+ Only the fmod sound driver supports this.
+ DSP can be computationally expensive.
+
+.. function:: getMaxLogicFrame()
+
+ Gets the maximum number of logic frame per render frame.
+
+ :return: The maximum number of logic frame per render frame
+ :rtype: integer
+
+.. function:: setMaxLogicFrame(maxlogic)
+
+ Sets the maximum number of logic frame that are executed per render frame.
+ This does not affect the physic system that still runs at full frame rate.
+
+ :arg maxlogic: The new maximum number of logic frame per render frame. Valid values: 1..5
+ :type maxlogic: integer
+
+.. function:: getMaxPhysicsFrame()
+
+ Gets the maximum number of physics frame per render frame.
+
+ :return: The maximum number of physics frame per render frame
+ :rtype: integer
+
+.. function:: setMaxPhysicsFrame(maxphysics)
+
+ Sets the maximum number of physics timestep that are executed per render frame.
+ Higher value allows physics to keep up with realtime even if graphics slows down the game.
+ Physics timestep is fixed and equal to 1/tickrate (see setLogicTicRate)
+ maxphysics/ticrate is the maximum delay of the renderer that physics can compensate.
+
+ :arg maxphysics: The new maximum number of physics timestep per render frame. Valid values: 1..5.
+ :type maxphysics: integer
+
+.. function:: getLogicTicRate()
+
+ Gets the logic update frequency.
+
+ :return: The logic frequency in Hz
+ :rtype: float
+
+.. function:: setLogicTicRate(ticrate)
+
+ Sets the logic update frequency.
+
+ The logic update frequency is the number of times logic bricks are executed every second.
+ The default is 60 Hz.
+
+ :arg ticrate: The new logic update frequency (in Hz).
+ :type ticrate: float
+
+.. function:: getPhysicsTicRate()
+
+ Gets the physics update frequency
+
+ :return: The physics update frequency in Hz
+ :rtype: float
+
+ .. warning: Not implimented yet
+
+.. function:: setPhysicsTicRate(ticrate)
+
+ Sets the physics update frequency
+
+ The physics update frequency is the number of times the physics system is executed every second.
+ The default is 60 Hz.
+
+ :arg ticrate: The new update frequency (in Hz).
+ :type ticrate: float
+
+ .. warning: Not implimented yet
+
+.. function:: saveGlobalDict()
+
+ Saves bge.logic.globalDict to a file.
+
+.. function:: loadGlobalDict()
+
+ Loads bge.logic.globalDict from a file.
+
+
+Utility functions
+
+.. function:: getAverageFrameRate()
+
+ Gets the estimated average framerate
+
+ :return: The estimed average framerate in frames per second
+ :rtype: float
+
+.. function:: expandPath(path)
+
+ Converts a blender internal path into a proper file system path.
+
+ Use / as directory separator in path
+ You can use '//' at the start of the string to define a relative path;
+ Blender replaces that string by the directory of the startup .blend or runtime file
+ to make a full path name (doesn't change during the game, even if you load other .blend).
+ The function also converts the directory separator to the local file system format.
+
+ :arg path: The path string to be converted/expanded.
+ :type path: string
+ :return: The converted string
+ :rtype: string
+
+
+.. function:: getBlendFileList(path = "//")
+
+ Returns a list of blend files in the same directory as the open blend file, or from using the option argument.
+
+ :arg path: Optional directory argument, will be expanded (like expandPath) into the full path.
+ :type path: string
+ :return: A list of filenames, with no directory prefix
+ :rtype: list
+
+.. function:: PrintGLInfo()
+
+ Prints GL Extension Info into the console
+
+.. function:: getRandomFloat()
+
+ Returns a random floating point value in the range [0 - 1)
+
+=========
+Constants
+=========
+
+.. data:: KX_TRUE: True value used by some modules.
+.. data:: KX_FALSE: False value used by some modules.
+
+---------------
+Property Sensor
+---------------
+
+.. data:: KX_PROPSENSOR_EQUAL
+
+ Activate when the property is equal to the sensor value.
+
+.. data:: KX_PROPSENSOR_NOTEQUAL
+
+ Activate when the property is not equal to the sensor value.
+
+.. data:: KX_PROPSENSOR_INTERVAL
+
+ Activate when the property is between the specified limits.
+
+.. data:: KX_PROPSENSOR_CHANGED
+
+ Activate when the property changes
+
+.. data:: KX_PROPSENSOR_EXPRESSION
+
+ Activate when the expression matches
+
+-------------------
+Constraint Actuator
+-------------------
+
+See :class:`bge.types.KX_ConstraintActuator`
+
+.. data:: KX_CONSTRAINTACT_LOCX
+.. data:: KX_CONSTRAINTACT_LOCY
+.. data:: KX_CONSTRAINTACT_LOCZ
+.. data:: KX_CONSTRAINTACT_ROTX
+.. data:: KX_CONSTRAINTACT_ROTY
+.. data:: KX_CONSTRAINTACT_ROTZ
+.. data:: KX_CONSTRAINTACT_DIRNX
+.. data:: KX_CONSTRAINTACT_DIRNY
+.. data:: KX_CONSTRAINTACT_DIRPX
+.. data:: KX_CONSTRAINTACT_DIRPY
+.. data:: KX_CONSTRAINTACT_ORIX
+.. data:: KX_CONSTRAINTACT_ORIY
+.. data:: KX_CONSTRAINTACT_ORIZ
+
+------------
+IPO Actuator
+------------
+
+See :class:`bge.types.KX_IpoActuator`
+
+.. data:: KX_IPOACT_PLAY
+.. data:: KX_IPOACT_PINGPONG
+.. data:: KX_IPOACT_FLIPPER
+.. data:: KX_IPOACT_LOOPSTOP
+.. data:: KX_IPOACT_LOOPEND
+.. data:: KX_IPOACT_FROM_PROP
+
+--------------------
+Random Distributions
+--------------------
+
+See :class:`bge.types.SCA_RandomActuator`
+
+.. data:: KX_RANDOMACT_BOOL_CONST
+.. data:: KX_RANDOMACT_BOOL_UNIFORM
+.. data:: KX_RANDOMACT_BOOL_BERNOUILLI
+.. data:: KX_RANDOMACT_INT_CONST
+.. data:: KX_RANDOMACT_INT_UNIFORM
+.. data:: KX_RANDOMACT_INT_POISSON
+.. data:: KX_RANDOMACT_FLOAT_CONST
+.. data:: KX_RANDOMACT_FLOAT_UNIFORM
+.. data:: KX_RANDOMACT_FLOAT_NORMAL
+.. data:: KX_RANDOMACT_FLOAT_NEGATIVE_EXPONENTIAL
+
+---------------
+Action Actuator
+---------------
+
+See :class:`bge.types.BL_ActionActuator`
+
+.. data:: KX_ACTIONACT_PLAY
+.. data:: KX_ACTIONACT_FLIPPER
+.. data:: KX_ACTIONACT_LOOPSTOP
+.. data:: KX_ACTIONACT_LOOPEND
+.. data:: KX_ACTIONACT_PROPERTY
+
+--------------
+Sound Actuator
+--------------
+
+See :class:`bge.types.KX_SoundActuator`
+
+.. data:: KX_SOUNDACT_PLAYSTOP
+.. data:: KX_SOUNDACT_PLAYEND
+.. data:: KX_SOUNDACT_LOOPSTOP
+.. data:: KX_SOUNDACT_LOOPEND
+.. data:: KX_SOUNDACT_LOOPBIDIRECTIONAL
+.. data:: KX_SOUNDACT_LOOPBIDIRECTIONAL_STOP
+
+------------
+Radar Sensor
+------------
+
+See :class:`bge.types.KX_RadarSensor`
+
+.. data:: KX_RADAR_AXIS_POS_X
+.. data:: KX_RADAR_AXIS_POS_Y
+.. data:: KX_RADAR_AXIS_POS_Z
+.. data:: KX_RADAR_AXIS_NEG_X
+.. data:: KX_RADAR_AXIS_NEG_Y
+.. data:: KX_RADAR_AXIS_NEG_Z
+
+----------
+Ray Sensor
+----------
+
+See :class:`bge.types.KX_RaySensor`
+
+.. data:: KX_RAY_AXIS_POS_X
+.. data:: KX_RAY_AXIS_POS_Y
+.. data:: KX_RAY_AXIS_POS_Z
+.. data:: KX_RAY_AXIS_NEG_X
+.. data:: KX_RAY_AXIS_NEG_Y
+.. data:: KX_RAY_AXIS_NEG_Z
+
+----------------
+Dynamic Actuator
+----------------
+
+See :class:`bge.types.KX_SCA_DynamicActuator`
+
+.. data:: KX_DYN_RESTORE_DYNAMICS
+.. data:: KX_DYN_DISABLE_DYNAMICS
+.. data:: KX_DYN_ENABLE_RIGID_BODY
+.. data:: KX_DYN_DISABLE_RIGID_BODY
+.. data:: KX_DYN_SET_MASS
+
+-------------
+Game Actuator
+-------------
+
+See :class:`bge.types.KX_GameActuator`
+
+.. data:: KX_GAME_LOAD
+.. data:: KX_GAME_START
+.. data:: KX_GAME_RESTART
+.. data:: KX_GAME_QUIT
+.. data:: KX_GAME_SAVECFG
+.. data:: KX_GAME_LOADCFG
+
+--------------
+Scene Actuator
+--------------
+
+See :class:`bge.types.KX_SceneActuator`
+
+.. data:: KX_SCENE_RESTART
+.. data:: KX_SCENE_SET_SCENE
+.. data:: KX_SCENE_SET_CAMERA
+.. data:: KX_SCENE_ADD_FRONT_SCENE
+.. data:: KX_SCENE_ADD_BACK_SCENE
+.. data:: KX_SCENE_REMOVE_SCENE
+.. data:: KX_SCENE_SUSPEND
+.. data:: KX_SCENE_RESUME
+
+------------
+Input Status
+------------
+
+See :class:`bge.types.SCA_MouseSensor`
+
+.. data:: KX_INPUT_NONE
+.. data:: KX_INPUT_JUST_ACTIVATED
+.. data:: KX_INPUT_ACTIVE
+.. data:: KX_INPUT_JUST_RELEASED
+
+-------------
+Mouse Buttons
+-------------
+
+See :class:`bge.types.SCA_MouseSensor`
+
+.. data:: KX_MOUSE_BUT_LEFT
+.. data:: KX_MOUSE_BUT_MIDDLE
+.. data:: KX_MOUSE_BUT_RIGHT
+
+------
+States
+------
+
+See :class:`bge.types.KX_StateActuator`
+
+.. data:: KX_STATE1
+.. data:: KX_STATE2
+.. data:: KX_STATE3
+.. data:: KX_STATE4
+.. data:: KX_STATE5
+.. data:: KX_STATE6
+.. data:: KX_STATE7
+.. data:: KX_STATE8
+.. data:: KX_STATE9
+.. data:: KX_STATE10
+.. data:: KX_STATE11
+.. data:: KX_STATE12
+.. data:: KX_STATE13
+.. data:: KX_STATE14
+.. data:: KX_STATE15
+.. data:: KX_STATE16
+.. data:: KX_STATE17
+.. data:: KX_STATE18
+.. data:: KX_STATE19
+.. data:: KX_STATE20
+.. data:: KX_STATE21
+.. data:: KX_STATE22
+.. data:: KX_STATE23
+.. data:: KX_STATE24
+.. data:: KX_STATE25
+.. data:: KX_STATE26
+.. data:: KX_STATE27
+.. data:: KX_STATE28
+.. data:: KX_STATE29
+.. data:: KX_STATE30
+.. data:: KX_STATE_OP_CLR
+.. data:: KX_STATE_OP_CPY
+.. data:: KX_STATE_OP_NEG
+.. data:: KX_STATE_OP_SET
+
+---------
+2D Filter
+---------
+
+.. data:: RAS_2DFILTER_BLUR
+.. data:: RAS_2DFILTER_CUSTOMFILTER
+.. data:: RAS_2DFILTER_DILATION
+.. data:: RAS_2DFILTER_DISABLED
+.. data:: RAS_2DFILTER_ENABLED
+.. data:: RAS_2DFILTER_EROSION
+.. data:: RAS_2DFILTER_GRAYSCALE
+.. data:: RAS_2DFILTER_INVERT
+.. data:: RAS_2DFILTER_LAPLACIAN
+.. data:: RAS_2DFILTER_MOTIONBLUR
+.. data:: RAS_2DFILTER_NOFILTER
+.. data:: RAS_2DFILTER_PREWITT
+.. data:: RAS_2DFILTER_SEPIA
+.. data:: RAS_2DFILTER_SHARPEN
+.. data:: RAS_2DFILTER_SOBEL
+
+-------------------
+Constraint Actuator
+-------------------
+
+.. data:: KX_ACT_CONSTRAINT_DISTANCE
+.. data:: KX_ACT_CONSTRAINT_DOROTFH
+.. data:: KX_ACT_CONSTRAINT_FHNX
+.. data:: KX_ACT_CONSTRAINT_FHNY
+.. data:: KX_ACT_CONSTRAINT_FHNZ
+.. data:: KX_ACT_CONSTRAINT_FHPX
+.. data:: KX_ACT_CONSTRAINT_FHPY
+.. data:: KX_ACT_CONSTRAINT_FHPZ
+.. data:: KX_ACT_CONSTRAINT_LOCAL
+.. data:: KX_ACT_CONSTRAINT_MATERIAL
+.. data:: KX_ACT_CONSTRAINT_NORMAL
+.. data:: KX_ACT_CONSTRAINT_PERMANENT
+
+---------------
+Parent Actuator
+---------------
+
+.. data:: KX_PARENT_REMOVE
+.. data:: KX_PARENT_SET
+
+------
+Shader
+------
+
+.. data:: VIEWMATRIX
+.. data:: VIEWMATRIX_INVERSE
+.. data:: VIEWMATRIX_INVERSETRANSPOSE
+.. data:: VIEWMATRIX_TRANSPOSE
+.. data:: MODELMATRIX
+.. data:: MODELMATRIX_INVERSE
+.. data:: MODELMATRIX_INVERSETRANSPOSE
+.. data:: MODELMATRIX_TRANSPOSE
+.. data:: MODELVIEWMATRIX
+.. data:: MODELVIEWMATRIX_INVERSE
+.. data:: MODELVIEWMATRIX_INVERSETRANSPOSE
+.. data:: MODELVIEWMATRIX_TRANSPOSE
+.. data:: CAM_POS
+
+ Current camera position
+
+.. data:: CONSTANT_TIMER
+
+ User a timer for the uniform value.
+
+.. data:: SHD_TANGENT
+
+----------------
+Blender Material
+----------------
+
+.. data:: BL_DST_ALPHA
+.. data:: BL_DST_COLOR
+.. data:: BL_ONE
+.. data:: BL_ONE_MINUS_DST_ALPHA
+.. data:: BL_ONE_MINUS_DST_COLOR
+.. data:: BL_ONE_MINUS_SRC_ALPHA
+.. data:: BL_ONE_MINUS_SRC_COLOR
+.. data:: BL_SRC_ALPHA
+.. data:: BL_SRC_ALPHA_SATURATE
+.. data:: BL_SRC_COLOR
+.. data:: BL_ZERO
diff --git a/source/gameengine/PyDoc/bge.render.rst b/source/gameengine/PyDoc/bge.render.rst
new file mode 100644
index 00000000000..d1a35019165
--- /dev/null
+++ b/source/gameengine/PyDoc/bge.render.rst
@@ -0,0 +1,231 @@
+
+Game Engine bge.render Module.
+==============================
+
+.. module:: bge.render
+
+.. code-block:: python
+
+ # Example Uses an L{SCA_MouseSensor}, and two L{KX_ObjectActuator}s to implement MouseLook::
+ # To use a mouse movement sensor "Mouse" and a
+ # motion actuator to mouse look:
+ import bge.render
+ import bge.logic
+
+ # SCALE sets the speed of motion
+ SCALE=[1, 0.5]
+
+ co = bge.logic.getCurrentController()
+ obj = co.getOwner()
+ mouse = co.getSensor("Mouse")
+ lmotion = co.getActuator("LMove")
+ wmotion = co.getActuator("WMove")
+
+ # Transform the mouse coordinates to see how far the mouse has moved.
+ def mousePos():
+ x = (bge.render.getWindowWidth()/2 - mouse.getXPosition())*SCALE[0]
+ y = (bge.render.getWindowHeight()/2 - mouse.getYPosition())*SCALE[1]
+ return (x, y)
+
+ pos = mousePos()
+
+ # Set the amount of motion: X is applied in world coordinates...
+ lmotion.setTorque(0.0, 0.0, pos[0], False)
+ # ...Y is applied in local coordinates
+ wmotion.setTorque(-pos[1], 0.0, 0.0, True)
+
+ # Activate both actuators
+ bge.logic.addActiveActuator(lmotion, True)
+ bge.logic.addActiveActuator(wmotion, True)
+
+ # Centre the mouse
+ bge.render.setMousePosition(bge.render.getWindowWidth()/2, bge.render.getWindowHeight()/2)
+
+
+.. data:: KX_TEXFACE_MATERIAL
+
+ Materials as defined by the texture face settings.
+
+.. data:: KX_BLENDER_MULTITEX_MATERIAL
+
+ Materials approximating blender materials with multitexturing.
+
+.. data:: KX_BLENDER_GLSL_MATERIAL
+
+ Materials approximating blender materials with GLSL.
+
+.. function:: getWindowWidth()
+
+ Gets the width of the window (in pixels)
+
+ :rtype: integer
+
+.. function:: getWindowHeight()
+
+ Gets the height of the window (in pixels)
+
+ :rtype: integer
+
+.. function:: makeScreenshot(filename)
+
+ Writes a screenshot to the given filename.
+
+ If filename starts with // the image will be saved relative to the current directory.
+ If the filename contains # it will be replaced with the frame number.
+
+ The standalone player saves .png files. It does not support colour space conversion
+ or gamma correction.
+
+ When run from Blender, makeScreenshot supports Iris, IrisZ, TGA, Raw TGA, PNG, HamX, and Jpeg.
+ Gamma, Colourspace conversion and Jpeg compression are taken from the Render settings panels.
+
+ :type filename: string
+
+
+.. function:: enableVisibility(visible)
+
+ Doesn't really do anything...
+
+
+.. function:: showMouse(visible)
+
+ Enables or disables the operating system mouse cursor.
+
+ :type visible: boolean
+
+
+.. function:: setMousePosition(x, y)
+
+ Sets the mouse cursor position.
+
+ :type x: integer
+ :type y: integer
+
+
+.. function:: setBackgroundColor(rgba)
+
+ Sets the window background colour.
+
+ :type rgba: list [r, g, b, a]
+
+
+.. function:: setMistColor(rgb)
+
+ Sets the mist colour.
+
+ :type rgb: list [r, g, b]
+
+
+.. function:: setAmbientColor(rgb)
+
+ Sets the color of ambient light.
+
+ :type rgb: list [r, g, b]
+
+
+.. function:: setMistStart(start)
+
+ Sets the mist start value. Objects further away than start will have mist applied to them.
+
+ :type start: float
+
+
+.. function:: setMistEnd(end)
+
+ Sets the mist end value. Objects further away from this will be coloured solid with
+ the colour set by setMistColor().
+
+ :type end: float
+
+
+.. function:: disableMist()
+
+ Disables mist.
+
+ .. note:: Set any of the mist properties to enable mist.
+
+
+.. function:: setEyeSeparation(eyesep)
+
+ Sets the eye separation for stereo mode. Usually Focal Length/30 provides a confortable value.
+
+ :arg eyesep: The distance between the left and right eye.
+ :type eyesep: float
+
+
+.. function:: getEyeSeparation()
+
+ Gets the current eye separation for stereo mode.
+
+ :rtype: float
+
+
+.. function:: setFocalLength(focallength)
+
+ Sets the focal length for stereo mode. It uses the current camera focal length as initial value.
+
+ :arg focallength: The focal length.
+ :type focallength: float
+
+.. function:: getFocalLength()
+
+ Gets the current focal length for stereo mode.
+
+ :rtype: float
+
+.. function:: setMaterialMode(mode)
+
+ Set the material mode to use for OpenGL rendering.
+
+ :type mode: KX_TEXFACE_MATERIAL, KX_BLENDER_MULTITEX_MATERIAL, KX_BLENDER_GLSL_MATERIAL
+
+ .. note:: Changes will only affect newly created scenes.
+
+
+.. function:: getMaterialMode(mode)
+
+ Get the material mode to use for OpenGL rendering.
+
+ :rtype: KX_TEXFACE_MATERIAL, KX_BLENDER_MULTITEX_MATERIAL, KX_BLENDER_GLSL_MATERIAL
+
+
+.. function:: setGLSLMaterialSetting(setting, enable)
+
+ Enables or disables a GLSL material setting.
+
+ :type setting: string (lights, shaders, shadows, ramps, nodes, extra_textures)
+ :type enable: boolean
+
+
+.. function:: getGLSLMaterialSetting(setting, enable)
+
+ Get the state of a GLSL material setting.
+
+ :type setting: string (lights, shaders, shadows, ramps, nodes, extra_textures)
+ :rtype: boolean
+
+
+.. function:: drawLine(fromVec,toVec,color)
+
+ Draw a line in the 3D scene.
+
+ :arg fromVec: the origin of the line
+ :type fromVec: list [x, y, z]
+ :arg toVec: the end of the line
+ :type toVec: list [x, y, z]
+ :arg color: the color of the line
+ :type color: list [r, g, b]
+
+
+.. function:: enableMotionBlur(factor)
+
+ Enable the motion blue effect.
+
+ :arg factor: the ammount of motion blur to display.
+ :type factor: float [0.0 - 1.0]
+
+
+.. function:: disableMotionBlur()
+
+ Disable the motion blue effect.
+
diff --git a/source/gameengine/PyDoc/bge.types.rst b/source/gameengine/PyDoc/bge.types.rst
new file mode 100644
index 00000000000..6cfb3377cac
--- /dev/null
+++ b/source/gameengine/PyDoc/bge.types.rst
@@ -0,0 +1,4339 @@
+
+Game Engine bge.types Module.
+==============================
+
+.. module:: bge.types
+
+.. class:: PyObjectPlus
+
+ PyObjectPlus base class of most other types in the Game Engine.
+
+ .. attribute:: invalid
+
+ Test if the object has been freed by the game engine and is no longer valid.
+
+ Normally this is not a problem but when storing game engine data in the GameLogic module,
+ KX_Scenes or other KX_GameObjects its possible to hold a reference to invalid data.
+ Calling an attribute or method on an invalid object will raise a SystemError.
+
+ The invalid attribute allows testing for this case without exception handling.
+
+ *type* bool
+
+ .. method:: isA(game_type)
+
+ Check if this is a type or a subtype game_type.
+
+ :arg game_type: the name of the type or the type its self from the :mod:`bge.types` module.
+ :type game_type: string or type
+ :return: True if this object is a type or a subtype of game_type.
+ :rtype: bool
+
+.. class:: CValue(PyObjectPlus)
+
+ This class is a basis for other classes.
+
+ .. attribute:: name
+
+ The name of this CValue derived object (read-only). **type** string
+
+.. class:: CPropValue(CValue)
+
+ This class has no python functions
+
+.. class:: SCA_ILogicBrick(CValue)
+
+ Base class for all logic bricks.
+
+ .. attribute:: executePriority
+
+ This determines the order controllers are evaluated, and actuators are activated (lower priority is executed first).
+
+ *type* executePriority: int
+
+ .. attribute:: owner
+
+ The game object this logic brick is attached to (read-only). **type** :class:`KX_GameObject` or None in exceptional cases.
+
+ .. attribute:: name
+
+ The name of this logic brick (read-only). **type** string
+
+.. class:: SCA_PythonKeyboard(PyObjectPlus)
+
+ The current keyboard.
+
+ .. attribute:: events
+
+ A list of pressed keys that have either been pressed, or just released, or are active this frame. (read-only).
+
+ * 'keycode' matches the values in :mod:`bge.keys`.
+ * 'status' uses...
+ * :mod:`bge.logic.KX_INPUT_NONE`
+ * :mod:`bge.logic.KX_INPUT_JUST_ACTIVATED`
+ * :mod:`bge.logic.KX_INPUT_ACTIVE`
+ * :mod:`bge.logic.KX_INPUT_JUST_RELEASED`
+
+ *type* list [[keycode, status], ...]
+
+.. class:: SCA_PythonMouse(PyObjectPlus)
+
+ The current mouse.
+
+ .. attribute:: events
+
+ a list of pressed buttons that have either been pressed, or just released, or are active this frame. (read-only).
+
+ * 'keycode' matches the values in :mod:`bge.keys`.
+ * 'status' uses...
+ * :mod:`bge.logic.KX_INPUT_NONE`
+ * :mod:`bge.logic.KX_INPUT_JUST_ACTIVATED`
+ * :mod:`bge.logic.KX_INPUT_ACTIVE`
+ * :mod:`bge.logic.KX_INPUT_JUST_RELEASED`
+
+ *type* list [[keycode, status], ...]
+
+ .. attribute:: position
+
+ The normalized x and y position of the mouse cursor. **type** list [x, y]
+
+ .. attribute:: visible
+
+ The visibility of the mouse cursor. **type** boolean
+
+.. class:: SCA_IObject(CValue)
+
+ This class has no python functions
+
+.. class:: SCA_ISensor(SCA_ILogicBrick)
+
+ Base class for all sensor logic bricks.
+
+ .. attribute:: usePosPulseMode
+
+ Flag to turn positive pulse mode on and off. **type** boolean
+
+ .. attribute:: useNegPulseMode
+
+ Flag to turn negative pulse mode on and off. **type** boolean
+
+ .. attribute:: frequency
+
+ The frequency for pulse mode sensors. **type** integer
+
+ .. attribute:: level
+
+ level Option whether to detect level or edge transition when entering a state.
+ It makes a difference only in case of logic state transition (state actuator).
+ A level detector will immediately generate a pulse, negative or positive
+ depending on the sensor condition, as soon as the state is activated.
+ A edge detector will wait for a state change before generating a pulse.
+ note: mutually exclusive with :data:`tap`, enabling will disable :data:`tap`.
+
+ *type* boolean
+
+ .. attribute:: tap
+
+ When enabled only sensors that are just activated will send a positive event,
+ after this they will be detected as negative by the controllers.
+ This will make a key thats held act as if its only tapped for an instant.
+ note: mutually exclusive with :data:`level`, enabling will disable :data:`level`.
+
+ *type* boolean
+
+ .. attribute:: invert
+
+ Flag to set if this sensor activates on positive or negative events. **type** boolean
+
+ .. attribute:: triggered
+
+ True if this sensor brick is in a positive state. (read-only). **type** boolean
+
+ .. attribute:: positive
+
+ True if this sensor brick is in a positive state. (read-only). **type** boolean
+
+ .. attribute:: status
+
+ The status of the sensor. (read-only). **type** int from 0-3.
+
+ * KX_SENSOR_INACTIVE
+ * KX_SENSOR_JUST_ACTIVATED
+ * KX_SENSOR_ACTIVE
+ * KX_SENSOR_JUST_DEACTIVATED
+
+ .. note:: this convenient attribute combines the values of triggered and positive attributes.
+
+ .. method:: reset()
+
+ Reset sensor internal state, effect depends on the type of sensor and settings.
+
+ The sensor is put in its initial state as if it was just activated.
+
+.. class:: SCA_IController(SCA_ILogicBrick)
+
+ Base class for all controller logic bricks.
+
+ .. attribute:: state
+
+ The controllers state bitmask. This can be used with the GameObject's state to test if the controller is active. **type** int bitmask
+
+ .. attribute:: sensors
+
+ A list of sensors linked to this controller. **type** sequence supporting index/string lookups and iteration.
+
+ .. note:: The sensors are not necessarily owned by the same object.
+ .. note:: When objects are instanced in dupligroups links may be lost from objects outside the dupligroup.
+
+ .. attribute:: actuators
+
+ A list of actuators linked to this controller. **type** sequence supporting index/string lookups and iteration.
+
+ .. note:: The sensors are not necessarily owned by the same object.
+ .. note:: When objects are instanced in dupligroups links may be lost from objects outside the dupligroup.
+
+ .. attribute:: useHighPriority
+
+ When set the controller executes always before all other controllers that dont have this set. **type** bool
+
+ .. note:: Order of execution between high priority controllers is not guaranteed.
+
+.. class:: SCA_IActuator(SCA_ILogicBrick)
+
+ Base class for all actuator logic bricks.
+
+.. class:: BL_ActionActuator(SCA_IActuator)
+
+ Action Actuators apply an action to an actor.
+
+ .. attribute:: action
+
+ The name of the action to set as the current action. **type** string
+
+ .. attribute:: channelNames
+
+ A list of channel names that may be used with :data:`setChannel` and :data:`getChannel`. **type** list of strings
+
+ .. attribute:: frameStart
+
+ Specifies the starting frame of the animation. **type** float
+
+ .. attribute:: frameEnd
+
+ Specifies the ending frame of the animation. **type** float
+
+ .. attribute:: blendIn
+
+ Specifies the number of frames of animation to generate when making transitions between actions. **type** float
+
+ .. attribute:: priority
+
+ Sets the priority of this actuator. Actuators will lower priority numbers will override actuators with higher numbers. **type** integer
+
+ .. attribute:: frame
+
+ Sets the current frame for the animation. **type** float
+
+ .. attribute:: propName
+
+ Sets the property to be used in FromProp playback mode. **type** string
+
+ .. attribute:: blendTime
+
+ Sets the internal frame timer. This property must be in the range from 0.0 to blendIn. **type** float
+
+ .. attribute:: mode
+
+ The operation mode of the actuator. KX_ACTIONACT_PLAY, KX_ACTIONACT_PROPERTY, KX_ACTIONACT_FLIPPER, KX_ACTIONACT_LOOPSTOP, KX_ACTIONACT_LOOPEND. **type** integer
+
+ .. attribute:: useContinue
+
+ The actions continue option, True or False. When True, the action will always play from where last left off, otherwise negative events to this actuator will reset it to its start frame. **type** boolean
+
+ .. attribute:: framePropName
+
+ The name of the property that is set to the current frame number. **type** string
+
+ .. method:: setChannel(channel, matrix)
+
+ Alternative to the 2 arguments, 4 arguments (channel, matrix, loc, size, quat) are also supported.
+
+ :arg channel: A string specifying the name of the bone channel, error raised if not in :data:`channelNames`.
+ :type channel: string
+ :arg matrix: A 4x4 matrix specifying the overriding transformation as an offset from the bone's rest position.
+ :arg matrix: list [[float]]
+
+ .. note:: These values are relative to the bones rest position, currently the api has no way to get this info (which is annoying), but can be worked around by using bones with a rest pose that has no translation.
+
+ .. method:: getChannel(channel)
+
+ :arg channel: A string specifying the name of the bone channel. error raised if not in :data:`channelNames`.
+ :type channel: string
+ :return: (loc, size, quat)
+ :rtype: tuple
+
+.. class:: BL_Shader(PyObjectPlus)
+
+ BL_Shader GLSL shaders.
+
+ TODO - Description
+
+ .. method:: setUniformfv(name, fList)
+
+ Set a uniform with a list of float values
+
+ :arg name: the uniform name
+ :type name: string
+ :arg fList: a list (2, 3 or 4 elements) of float values
+ :type fList: list[float]
+
+ .. method:: delSource()
+
+ Clear the shader. Use this method before the source is changed with :data:`setSource`.
+
+ .. method:: getFragmentProg()
+
+ Returns the fragment program.
+
+ :return: The fragment program.
+ :rtype: string
+
+ .. method:: getVertexProg()
+
+ Get the vertex program.
+
+ :return: The vertex program.
+ :rtype: string
+
+ .. method:: isValid()
+
+ Check if the shader is valid.
+
+ :return: True if the shader is valid
+ :rtype: bool
+
+ .. method:: setAttrib(enum)
+
+ Set attribute location. (The parameter is ignored a.t.m. and the value of "tangent" is always used.)
+
+ :arg enum: attribute location value
+ :type enum: integer
+
+ .. method:: setNumberOfPasses( max_pass )
+
+ Set the maximum number of passes. Not used a.t.m.
+
+ :arg max_pass: the maximum number of passes
+ :type max_pass: integer
+
+ .. method:: setSampler(name, index)
+
+ Set uniform texture sample index.
+
+ :arg name: Uniform name
+ :type name: string
+ :arg index: Texture sample index.
+ :type index: integer
+
+ .. method:: setSource(vertexProgram, fragmentProgram)
+
+ Set the vertex and fragment programs
+
+ :arg vertexProgram: Vertex program
+ :type vertexProgram: string
+ :arg fragmentProgram: Fragment program
+ :type fragmentProgram: string
+
+ .. method:: setUniform1f(name, fx)
+
+ Set a uniform with 1 float value.
+
+ :arg name: the uniform name
+ :type name: string
+ :arg fx: Uniform value
+ :type fx: float
+
+ .. method:: setUniform1i(name, ix)
+
+ Set a uniform with an integer value.
+
+ :arg name: the uniform name
+ :type name: string
+ :arg ix: the uniform value
+ :type ix: integer
+
+ .. method:: setUniform2f(name, fx, fy)
+
+ Set a uniform with 2 float values
+
+ :arg name: the uniform name
+ :type name: string
+ :arg fx: first float value
+ :type fx: float
+
+ :arg fy: second float value
+ :type fy: float
+
+ .. method:: setUniform2i(name, ix, iy)
+
+ Set a uniform with 2 integer values
+
+ :arg name: the uniform name
+ :type name: string
+ :arg ix: first integer value
+ :type ix: integer
+ :arg iy: second integer value
+ :type iy: integer
+
+ .. method:: setUniform3f(name, fx, fy, fz)
+
+ Set a uniform with 3 float values.
+
+ :arg name: the uniform name
+ :type name: string
+ :arg fx: first float value
+ :type fx: float
+ :arg fy: second float value
+ :type fy: float
+ :arg fz: third float value
+ :type fz: float
+
+ .. method:: setUniform3i(name, ix, iy, iz)
+
+ Set a uniform with 3 integer values
+
+ :arg name: the uniform name
+ :type name: string
+ :arg ix: first integer value
+ :type ix: integer
+ :arg iy: second integer value
+ :type iy: integer
+ :arg iz: third integer value
+ :type iz: integer
+
+ .. method:: setUniform4f(name, fx, fy, fz, fw)
+
+ Set a uniform with 4 float values.
+
+ :arg name: the uniform name
+ :type name: string
+ :arg fx: first float value
+ :type fx: float
+ :arg fy: second float value
+ :type fy: float
+ :arg fz: third float value
+ :type fz: float
+ :arg fw: fourth float value
+ :type fw: float
+
+ .. method:: setUniform4i(name, ix, iy, iz, iw)
+
+ Set a uniform with 4 integer values
+
+ :arg name: the uniform name
+ :type name: string
+ :arg ix: first integer value
+ :type ix: integer
+ :arg iy: second integer value
+ :type iy: integer
+ :arg iz: third integer value
+ :type iz: integer
+ :arg iw: fourth integer value
+ :type iw: integer
+
+ .. method:: setUniformDef(name, type)
+
+ Define a new uniform
+
+ :arg name: the uniform name
+ :type name: string
+ :arg type: uniform type
+ :type type: UNI_NONE, UNI_INT, UNI_FLOAT, UNI_INT2, UNI_FLOAT2, UNI_INT3, UNI_FLOAT3, UNI_INT4, UNI_FLOAT4, UNI_MAT3, UNI_MAT4, UNI_MAX
+
+ .. method:: setUniformMatrix3(name, mat, transpose)
+
+ Set a uniform with a 3x3 matrix value
+
+ :arg name: the uniform name
+ :type name: string
+ :arg mat: A 3x3 matrix [[f, f, f], [f, f, f], [f, f, f]]
+ :type mat: 3x3 matrix
+ :arg transpose: set to True to transpose the matrix
+ :type transpose: bool
+
+ .. method:: setUniformMatrix4(name, mat, transpose)
+
+ Set a uniform with a 4x4 matrix value
+
+ :arg name: the uniform name
+ :type name: string
+ :arg mat: A 4x4 matrix [[f, f, f, f], [f, f, f, f], [f, f, f, f], [f, f, f, f]]
+ :type mat: 4x4 matrix
+ :arg transpose: set to True to transpose the matrix
+ :type transpose: bool
+
+ .. method:: setUniformiv(name, iList)
+
+ Set a uniform with a list of integer values
+
+ :arg name: the uniform name
+ :type name: string
+ :arg iList: a list (2, 3 or 4 elements) of integer values
+ :type iList: list[integer]
+
+ .. method:: validate()
+
+ Validate the shader object.
+
+.. class:: BL_ShapeActionActuator(SCA_IActuator)
+
+ ShapeAction Actuators apply an shape action to an mesh object.
+
+ .. attribute:: action
+
+ The name of the action to set as the current shape action. **type** string
+
+ .. attribute:: frameStart
+
+ Specifies the starting frame of the shape animation. **type** float
+
+ .. attribute:: frameEnd
+
+ Specifies the ending frame of the shape animation. **type** float
+
+ .. attribute:: blendIn
+
+ Specifies the number of frames of animation to generate when making transitions between actions. **type** float
+
+ .. attribute:: priority
+
+ Sets the priority of this actuator. Actuators will lower priority numbers will override actuators with higher numbers. **type** integer
+
+ .. attribute:: frame
+
+ Sets the current frame for the animation. **type** float
+
+ .. attribute:: propName
+
+ Sets the property to be used in FromProp playback mode. **type** string
+
+ .. attribute:: blendTime
+
+ Sets the internal frame timer. This property must be in the range from 0.0 to blendin. **type** float
+
+ .. attribute:: mode
+
+ The operation mode of the actuator in [KX_ACTIONACT_PLAY, KX_ACTIONACT_PROPERTY, KX_ACTIONACT_FLIPPER, KX_ACTIONACT_LOOPSTOP, KX_ACTIONACT_LOOPEND] **type** integer
+
+ .. attribute:: framePropName
+
+ The name of the property that is set to the current frame number. **type** string
+
+.. class:: CListValue(CPropValue)
+
+ CListValue
+
+ This is a list like object used in the game engine internally that behaves similar to a python list in most ways.
+
+ As well as the normal index lookup.
+ ``val= clist[i]``
+
+ CListValue supports string lookups.
+ ``val= scene.objects["Cube"]``
+
+ Other operations such as ``len(clist), list(clist), clist[0:10]`` are also supported.
+
+ .. method:: append(val)
+
+ Add an item to the list (like pythons append)
+
+ .. warning:: Appending values to the list can cause crashes when the list is used internally by the game engine.
+
+ .. method:: count(val)
+
+ Count the number of instances of a value in the list.
+
+ :return: number of instances
+ :rtype: integer
+
+ .. method:: index(val)
+
+ Return the index of a value in the list.
+
+ :return: The index of the value in the list.
+ :rtype: integer
+
+ .. method:: reverse()
+
+ Reverse the order of the list.
+
+ .. method:: get(key, default=None)
+
+ Return the value matching key, or the default value if its not found.
+
+ :return: The key value or a default.
+
+ .. method:: from_id(id)
+
+ This is a funtion especially for the game engine to return a value with a spesific id.
+
+ Since object names are not always unique, the id of an object can be used to get an object from the CValueList.
+
+ Example.
+
+ ``myObID=id(gameObject)``
+ ``ob= scene.objects.from_id(myObID)``
+
+ Where myObID is an int or long from the id function.
+
+ This has the advantage that you can store the id in places you could not store a gameObject.
+
+ .. warning:: the id is derived from a memory location and will be different each time the game engine starts.
+
+.. class:: KX_BlenderMaterial(PyObjectPlus)
+
+ KX_BlenderMaterial
+
+ .. method:: getShader()
+
+ Returns the material's shader.
+
+ :return: the material's shader
+ :rtype: :class:`BL_Shader`
+
+ .. method:: setBlending(src, dest)
+
+ Set the pixel color arithmetic functions.
+
+ :arg src: Specifies how the red, green, blue, and alpha source blending factors are computed.
+ :type src: Value in...
+
+ * GL_ZERO,
+ * GL_ONE,
+ * GL_SRC_COLOR,
+ * GL_ONE_MINUS_SRC_COLOR,
+ * GL_DST_COLOR,
+ * GL_ONE_MINUS_DST_COLOR,
+ * GL_SRC_ALPHA,
+ * GL_ONE_MINUS_SRC_ALPHA,
+ * GL_DST_ALPHA,
+ * GL_ONE_MINUS_DST_ALPHA,
+ * GL_SRC_ALPHA_SATURATE
+
+ :arg dest: Specifies how the red, green, blue, and alpha destination blending factors are computed.
+ :type dest: Value in...
+
+ * GL_ZERO
+ * GL_ONE
+ * GL_SRC_COLOR
+ * GL_ONE_MINUS_SRC_COLOR
+ * GL_DST_COLOR
+ * GL_ONE_MINUS_DST_COLOR
+ * GL_SRC_ALPHA
+ * GL_ONE_MINUS_SRC_ALPHA
+ * GL_DST_ALPHA
+ * GL_ONE_MINUS_DST_ALPHA
+ * GL_SRC_ALPHA_SATURATE
+
+ .. method:: getMaterialIndex()
+
+ Returns the material's index.
+
+ :return: the material's index
+ :rtype: integer
+
+.. class:: KX_CameraActuator(SCA_IActuator)
+
+ Applies changes to a camera.
+
+ .. attribute:: min
+
+ minimum distance to the target object maintained by the actuator. **type** float
+
+ .. attribute:: max
+
+ maximum distance to stay from the target object. **type** float
+
+ .. attribute:: height
+
+ height to stay above the target object. **type** float
+
+ .. attribute:: useXY
+
+ axis this actuator is tracking, True=X, False=Y. **type** boolean
+
+ .. attribute:: object
+
+ the object this actuator tracks. **type** :class:`KX_GameObject` or None
+
+ @author: snail
+
+.. class:: KX_ConstraintActuator(SCA_IActuator)
+
+ A constraint actuator limits the position, rotation, distance or orientation of an object.
+
+ Properties:
+
+ .. attribute:: damp
+
+ Time constant of the constraint expressed in frame (not use by Force field constraint). **type** integer
+
+ .. attribute:: rotDamp
+
+ Time constant for the rotation expressed in frame (only for the distance constraint), 0 = use damp for rotation as well. **type** integer
+
+ .. attribute:: direction
+
+ The reference direction in world coordinate for the orientation constraint. **type** 3-tuple of float: (x, y, z)
+
+ .. attribute:: option
+
+ Binary combination of the following values. **type** integer
+
+ * Applicable to Distance constraint
+ * KX_ACT_CONSTRAINT_NORMAL ( 64) : Activate alignment to surface
+ * KX_ACT_CONSTRAINT_DISTANCE ( 512) : Activate distance control
+ * KX_ACT_CONSTRAINT_LOCAL (1024) : direction of the ray is along the local axis
+ * Applicable to Force field constraint:
+ * KX_ACT_CONSTRAINT_DOROTFH (2048) : Force field act on rotation as well
+ * Applicable to both:
+ * KX_ACT_CONSTRAINT_MATERIAL ( 128) : Detect material rather than property
+ * KX_ACT_CONSTRAINT_PERMANENT ( 256) : No deactivation if ray does not hit target
+
+ .. attribute:: time
+
+ activation time of the actuator. The actuator disables itself after this many frame. If set to 0, the actuator is not limited in time. **type** integer
+
+ .. attribute:: propName
+
+ the name of the property or material for the ray detection of the distance constraint. **type** string
+
+ .. attribute:: min
+
+ The lower bound of the constraint. For the rotation and orientation constraint, it represents radiant **type** float
+
+ .. attribute:: distance
+
+ the target distance of the distance constraint **type** float
+
+ .. attribute:: max
+
+ the upper bound of the constraint. For rotation and orientation constraints, it represents radiant. **type** float
+
+ .. attribute:: rayLength
+
+ the length of the ray of the distance constraint.
+
+ *type* float
+
+ .. attribute:: limit
+
+ type of constraint. **type** integer.
+
+ use one of the following constant:
+
+ * KX_ACT_CONSTRAINT_LOCX ( 1) : limit X coord
+ * KX_ACT_CONSTRAINT_LOCY ( 2) : limit Y coord
+ * KX_ACT_CONSTRAINT_LOCZ ( 3) : limit Z coord
+ * KX_ACT_CONSTRAINT_ROTX ( 4) : limit X rotation
+ * KX_ACT_CONSTRAINT_ROTY ( 5) : limit Y rotation
+ * KX_ACT_CONSTRAINT_ROTZ ( 6) : limit Z rotation
+ * KX_ACT_CONSTRAINT_DIRPX ( 7) : set distance along positive X axis
+ * KX_ACT_CONSTRAINT_DIRPY ( 8) : set distance along positive Y axis
+ * KX_ACT_CONSTRAINT_DIRPZ ( 9) : set distance along positive Z axis
+ * KX_ACT_CONSTRAINT_DIRNX (10) : set distance along negative X axis
+ * KX_ACT_CONSTRAINT_DIRNY (11) : set distance along negative Y axis
+ * KX_ACT_CONSTRAINT_DIRNZ (12) : set distance along negative Z axis
+ * KX_ACT_CONSTRAINT_ORIX (13) : set orientation of X axis
+ * KX_ACT_CONSTRAINT_ORIY (14) : set orientation of Y axis
+ * KX_ACT_CONSTRAINT_ORIZ (15) : set orientation of Z axis
+ * KX_ACT_CONSTRAINT_FHPX (16) : set force field along positive X axis
+ * KX_ACT_CONSTRAINT_FHPY (17) : set force field along positive Y axis
+ * KX_ACT_CONSTRAINT_FHPZ (18) : set force field along positive Z axis
+ * KX_ACT_CONSTRAINT_FHNX (19) : set force field along negative X axis
+ * KX_ACT_CONSTRAINT_FHNY (20) : set force field along negative Y axis
+ * KX_ACT_CONSTRAINT_FHNZ (21) : set force field along negative Z axis
+
+.. class:: KX_ConstraintWrapper(PyObjectPlus)
+
+ KX_ConstraintWrapper
+
+ .. method:: getConstraintId(val)
+
+ Returns the contraint's ID
+
+ :return: the constraint's ID
+ :rtype: integer
+
+.. class:: KX_GameActuator(SCA_IActuator)
+
+ The game actuator loads a new .blend file, restarts the current .blend file or quits the game.
+
+ Properties:
+
+ .. attribute:: fileName
+
+ the new .blend file to load **type** string.
+
+ .. attribute:: mode
+
+ The mode of this actuator **type** Constant in...
+
+ * :mod:`bge.logic.KX_GAME_LOAD`
+ * :mod:`bge.logic.KX_GAME_START`
+ * :mod:`bge.logic.KX_GAME_RESTART`
+ * :mod:`bge.logic.KX_GAME_QUIT`
+ * :mod:`bge.logic.KX_GAME_SAVECFG`
+ * :mod:`bge.logic.KX_GAME_LOADCFG`
+
+.. class:: KX_GameObject(SCA_IObject)
+
+ All game objects are derived from this class.
+
+ Properties assigned to game objects are accessible as attributes of this class.
+
+ .. note:: Calling ANY method or attribute on an object that has been removed from a scene will raise a SystemError, if an object may have been removed since last accessing it use the :data:`invalid` attribute to check.
+
+ .. attribute:: name
+
+ The object's name. (read-only). **type** string.
+
+ .. attribute:: mass
+
+ The object's mass
+
+ .. note:: The object must have a physics controller for the mass to be applied, otherwise the mass value will be returned as 0.0 **type** float
+
+ .. attribute:: linVelocityMin
+
+ Enforces the object keeps moving at a minimum velocity.
+
+ .. note:: Applies to dynamic and rigid body objects only.
+ .. note:: A value of 0.0 disables this option.
+ .. note:: While objects are stationary the minimum velocity will not be applied. **type** float
+
+ .. attribute:: linVelocityMax
+
+ Clamp the maximum linear velocity to prevent objects moving beyond a set speed.
+
+ .. note:: Applies to dynamic and rigid body objects only.
+ .. note:: A value of 0.0 disables this option (rather then setting it stationary). **type** float
+
+ .. attribute:: localInertia
+
+ the object's inertia vector in local coordinates. Read only. **type** list [ix, iy, iz]
+
+ .. attribute:: parent
+
+ The object's parent object. (read-only). **type** :class:`KX_GameObject` or None
+
+ .. attribute:: visible
+
+ visibility flag.
+
+ .. note:: Game logic will still run for invisible objects. **type** boolean
+
+ .. attribute:: color
+
+ The object color of the object **type** list [r, g, b, a]
+
+ .. attribute:: occlusion
+
+ occlusion capability flag. **type** boolean
+
+ .. attribute:: position
+
+ The object's position.
+
+ .. deprecated:: use :data:`localPosition` and :data:`worldPosition`. **type** list [x, y, z] On write: local position, on read: world position
+
+ .. attribute:: orientation
+
+ The object's orientation. 3x3 Matrix. You can also write a Quaternion or Euler vector.
+
+ .. deprecated:: use :data:`localOrientation` and :data:`worldOrientation`. **type** 3x3 Matrix [[float]] On write: local orientation, on read: world orientation
+
+ .. attribute:: scaling
+
+ The object's scaling factor. list [sx, sy, sz]
+
+ .. deprecated:: use :data:`localScale` and :data:`worldScale`. **type** list [sx, sy, sz] On write: local scaling, on read: world scaling
+
+ .. attribute:: localOrientation
+
+ The object's local orientation. 3x3 Matrix. You can also write a Quaternion or Euler vector. **type** 3x3 Matrix [[float]]
+
+ .. attribute:: worldOrientation
+
+ The object's world orientation. **type** 3x3 Matrix [[float]]
+
+ .. attribute:: localScale
+
+ The object's local scaling factor. **type** list [sx, sy, sz]
+
+ .. attribute:: worldScale
+
+ The object's world scaling factor. Read-only **type** list [sx, sy, sz]
+
+ .. attribute:: localPosition
+
+ The object's local position. **type** list [x, y, z]
+
+ .. attribute:: worldPosition
+
+ The object's world position. **type** list [x, y, z]
+
+ .. attribute:: timeOffset
+
+ adjust the slowparent delay at runtime. **type** float
+
+ .. attribute:: state
+
+ the game object's state bitmask, using the first 30 bits, one bit must always be set. **type** int
+
+ .. attribute:: meshes
+
+ a list meshes for this object.
+
+ .. note:: Most objects use only 1 mesh.
+ .. note:: Changes to this list will not update the KX_GameObject. **type** list of :class:`KX_MeshProxy`
+
+ .. attribute:: sensors
+
+ a sequence of :class:`SCA_ISensor` objects with string/index lookups and iterator support.
+
+ .. note:: This attribute is experemental and may be removed (but probably wont be).
+ .. note:: Changes to this list will not update the KX_GameObject. **type** list
+
+ .. attribute:: controllers
+
+ a sequence of :class:`SCA_IController` objects with string/index lookups and iterator support.
+ .. note:: This attribute is experemental and may be removed (but probably wont be).
+ .. note:: Changes to this list will not update the KX_GameObject. **type** list of :class:`SCA_ISensor`.
+
+ .. attribute:: actuators
+
+ a list of :class:`SCA_IActuator` with string/index lookups and iterator support.
+
+ .. note:: This attribute is experemental and may be removed (but probably wont be).
+ .. note:: Changes to this list will not update the KX_GameObject. **type** list
+
+ .. attribute:: attrDict
+
+ get the objects internal python attribute dictionary for direct (faster) access. **type** dict
+
+ .. attribute:: children
+
+ direct children of this object, (read-only). **type** :class:`CListValue` of :class:`KX_GameObject`'s
+
+ .. attribute:: childrenRecursive
+
+ all children of this object including childrens children, (read-only). **type** :class:`CListValue` of :class:`KX_GameObject`'s
+
+ .. method:: endObject()
+
+ Delete this object, can be used in place of the EndObject Actuator.
+
+ The actual removal of the object from the scene is delayed.
+
+ .. method:: replaceMesh(mesh, useDisplayMesh=True, usePhysicsMesh=False)
+
+ Replace the mesh of this object with a new mesh. This works the same was as the actuator.
+
+ :arg mesh: mesh to replace or the meshes name.
+ :type mesh: :class:`MeshProxy` or string
+ :arg useDisplayMesh: when enabled the display mesh will be replaced (optional argument).
+ :type useDisplayMesh: bool
+ :arg usePhysicsMesh: when enabled the physics mesh will be replaced (optional argument).
+ :type usePhysicsMesh: bool
+
+ .. method:: setVisible(visible, recursive)
+
+ Sets the game object's visible flag.
+
+ :arg visible: the visible state to set.
+ :type visible: boolean
+ :arg recursive: optional argument to set all childrens visibility flag too.
+ :type recursive: boolean
+
+ .. method:: setOcclusion(occlusion, recursive)
+
+ Sets the game object's occlusion capability.
+
+ :arg occlusion: the state to set the occlusion to.
+ :type occlusion: boolean
+ :arg recursive: optional argument to set all childrens occlusion flag too.
+ :type recursive: boolean
+
+ .. method:: alignAxisToVect(vect, axis=2, factor=1.0)
+
+ Aligns any of the game object's axis along the given vector.
+
+
+ :arg vect: a vector to align the axis.
+ :type vect: 3D vector
+ :arg axis: The axis you want to align
+
+ * 0: X axis
+ * 1: Y axis
+ * 2: Z axis
+
+ :type axis: integer
+ :arg factor: Only rotate a feaction of the distance to the target vector (0.0 - 1.0)
+ :type factor: float
+
+ .. method:: getAxisVect(vect)
+
+ Returns the axis vector rotates by the objects worldspace orientation.
+ This is the equivalent of multiplying the vector by the orientation matrix.
+
+ :arg vect: a vector to align the axis.
+ :type vect: 3D Vector
+ :return: The vector in relation to the objects rotation.
+ :rtype: 3d vector.
+
+ .. method:: applyMovement(movement, local=False)
+
+ Sets the game object's movement.
+
+ :arg movement: movement vector.
+ :type movement: 3D Vector
+ :arg local:
+ * False: you get the "global" movement ie: relative to world orientation.
+ * True: you get the "local" movement ie: relative to object orientation.
+ :arg local: boolean
+
+ .. method:: applyRotation(rotation, local=False)
+
+ Sets the game object's rotation.
+
+ :arg rotation: rotation vector.
+ :type rotation: 3D Vector
+ :arg local:
+ * False: you get the "global" rotation ie: relative to world orientation.
+ * True: you get the "local" rotation ie: relative to object orientation.
+ :arg local: boolean
+
+ .. method:: applyForce(force, local=False)
+
+ Sets the game object's force.
+
+ This requires a dynamic object.
+
+ :arg force: force vector.
+ :type force: 3D Vector
+ :arg local:
+ * False: you get the "global" force ie: relative to world orientation.
+ * True: you get the "local" force ie: relative to object orientation.
+ :type local: boolean
+
+ .. method:: applyTorque(torque, local=False)
+
+ Sets the game object's torque.
+
+ This requires a dynamic object.
+
+ :arg torque: torque vector.
+ :type torque: 3D Vector
+ :arg local:
+ * False: you get the "global" torque ie: relative to world orientation.
+ * True: you get the "local" torque ie: relative to object orientation.
+ :type local: boolean
+
+ .. method:: getLinearVelocity(local=False)
+
+ Gets the game object's linear velocity.
+
+ This method returns the game object's velocity through it's centre of mass, ie no angular velocity component.
+
+ :arg local:
+ * False: you get the "global" velocity ie: relative to world orientation.
+ * True: you get the "local" velocity ie: relative to object orientation.
+ :type local: boolean
+ :return: the object's linear velocity.
+ :rtype: list [vx, vy, vz]
+
+ .. method:: setLinearVelocity(velocity, local=False)
+
+ Sets the game object's linear velocity.
+
+ This method sets game object's velocity through it's centre of mass,
+ ie no angular velocity component.
+
+ This requires a dynamic object.
+
+ :arg velocity: linear velocity vector.
+ :type velocity: 3D Vector
+ :arg local:
+ * False: you get the "global" velocity ie: relative to world orientation.
+ * True: you get the "local" velocity ie: relative to object orientation.
+ :type local: boolean
+
+ .. method:: getAngularVelocity(local=False)
+
+ Gets the game object's angular velocity.
+
+ :arg local:
+ * False: you get the "global" velocity ie: relative to world orientation.
+ * True: you get the "local" velocity ie: relative to object orientation.
+ :type local: boolean
+ :return: the object's angular velocity.
+ :rtype: list [vx, vy, vz]
+
+ .. method:: setAngularVelocity(velocity, local=False)
+
+ Sets the game object's angular velocity.
+
+ This requires a dynamic object.
+
+ :arg velocity: angular velocity vector.
+ :type velocity: boolean
+ :arg local:
+ * False: you get the "global" velocity ie: relative to world orientation.
+ * True: you get the "local" velocity ie: relative to object orientation.
+
+ .. method:: getVelocity(point=(0, 0, 0))
+
+ Gets the game object's velocity at the specified point.
+
+ Gets the game object's velocity at the specified point, including angular
+ components.
+
+ :arg point: optional point to return the velocity for, in local coordinates.
+ :type point: 3D Vector
+ :return: the velocity at the specified point.
+ :rtype: list [vx, vy, vz]
+
+ .. method:: getReactionForce()
+
+ Gets the game object's reaction force.
+
+ The reaction force is the force applied to this object over the last simulation timestep.
+ This also includes impulses, eg from collisions.
+
+ :return: the reaction force of this object.
+ :rtype: list [fx, fy, fz]
+
+ .. note:: This is not implimented at the moment.
+
+ .. method:: applyImpulse(point, impulse)
+
+ Applies an impulse to the game object.
+
+ This will apply the specified impulse to the game object at the specified point.
+ If point != position, applyImpulse will also change the object's angular momentum.
+ Otherwise, only linear momentum will change.
+
+ :arg point: the point to apply the impulse to (in world coordinates)
+ :type point: the point to apply the impulse to (in world coordinates)
+
+ .. method:: suspendDynamics()
+
+ Suspends physics for this object.
+
+ .. method:: restoreDynamics()
+
+ Resumes physics for this object.
+
+ .. note:: The objects linear velocity will be applied from when the dynamics were suspended.
+
+ .. method:: enableRigidBody()
+
+ Enables rigid body physics for this object.
+
+ Rigid body physics allows the object to roll on collisions.
+
+ .. note:: This is not working with bullet physics yet.
+
+ .. method:: disableRigidBody()
+
+ Disables rigid body physics for this object.
+
+ .. note:: This is not working with bullet physics yet. The angular is removed but rigid body physics can still rotate it later.
+
+ .. method:: setParent(parent, compound=True, ghost=True)
+
+ Sets this object's parent.
+ Control the shape status with the optional compound and ghost parameters:
+
+ In that case you can control if it should be ghost or not:
+
+ :arg parent: new parent object.
+ :type parent: :class:`KX_GameObject`
+ :arg compound: whether the shape should be added to the parent compound shape.
+
+ * True: the object shape should be added to the parent compound shape.
+ * False: the object should keep its individual shape.
+
+ :type compound: boolean
+ :arg ghost: whether the object should be ghost while parented.
+
+ * True: if the object should be made ghost while parented.
+ * False: if the object should be solid while parented.
+
+ :type ghost: boolean
+
+ .. note:: if the object type is sensor, it stays ghost regardless of ghost parameter
+
+ .. method:: removeParent()
+
+ Removes this objects parent.
+
+ .. method:: getPhysicsId()
+
+ Returns the user data object associated with this game object's physics controller.
+
+ .. method:: getPropertyNames()
+
+ Gets a list of all property names.
+
+ :return: All property names for this object.
+ :rtype: list
+
+ .. method:: getDistanceTo(other)
+
+ :arg other: a point or another :class:`KX_GameObject` to measure the distance to.
+ :type other: :class:`KX_GameObject` or list [x, y, z]
+ :return: distance to another object or point.
+ :rtype: float
+
+ .. method:: getVectTo(other)
+
+ Returns the vector and the distance to another object or point.
+ The vector is normalized unless the distance is 0, in which a zero length vector is returned.
+
+ :arg other: a point or another :class:`KX_GameObject` to get the vector and distance to.
+ :type other: :class:`KX_GameObject` or list [x, y, z]
+ :return: (distance, globalVector(3), localVector(3))
+ :rtype: 3-tuple (float, 3-tuple (x, y, z), 3-tuple (x, y, z))
+
+ .. method:: rayCastTo(other, dist, prop)
+
+ Look towards another point/object and find first object hit within dist that matches prop.
+
+ The ray is always casted from the center of the object, ignoring the object itself.
+ The ray is casted towards the center of another object or an explicit [x, y, z] point.
+ Use rayCast() if you need to retrieve the hit point
+
+ :arg other: [x, y, z] or object towards which the ray is casted
+ :type other: :class:`KX_GameObject` or 3-tuple
+ :arg dist: max distance to look (can be negative => look behind); 0 or omitted => detect up to other
+ :type dist: float
+ :arg prop: property name that object must have; can be omitted => detect any object
+ :type prop: string
+ :return: the first object hit or None if no object or object does not match prop
+ :rtype: :class:`KX_GameObject`
+
+ .. method:: rayCast(objto, objfrom, dist, prop, face, xray, poly)
+
+ Look from a point/object to another point/object and find first object hit within dist that matches prop.
+ if poly is 0, returns a 3-tuple with object reference, hit point and hit normal or (None, None, None) if no hit.
+ if poly is 1, returns a 4-tuple with in addition a :class:`KX_PolyProxy` as 4th element.
+ if poly is 2, returns a 5-tuple with in addition a 2D vector with the UV mapping of the hit point as 5th element.
+
+ .. code-block:: python
+
+ # shoot along the axis gun-gunAim (gunAim should be collision-free)
+ obj, point, normal = gun.rayCast(gunAim, None, 50)
+ if obj:
+ # do something
+ pass
+
+ The face paremeter determines the orientation of the normal.
+
+ * 0 => hit normal is always oriented towards the ray origin (as if you casted the ray from outside)
+ * 1 => hit normal is the real face normal (only for mesh object, otherwise face has no effect)
+
+ The ray has X-Ray capability if xray parameter is 1, otherwise the first object hit (other than self object) stops the ray.
+ The prop and xray parameters interact as follow.
+
+ * prop off, xray off: return closest hit or no hit if there is no object on the full extend of the ray.
+ * prop off, xray on : idem.
+ * prop on, xray off: return closest hit if it matches prop, no hit otherwise.
+ * prop on, xray on : return closest hit matching prop or no hit if there is no object matching prop on the full extend of the ray.
+
+ The :class:`KX_PolyProxy` 4th element of the return tuple when poly=1 allows to retrieve information on the polygon hit by the ray.
+ If there is no hit or the hit object is not a static mesh, None is returned as 4th element.
+
+ The ray ignores collision-free objects and faces that dont have the collision flag enabled, you can however use ghost objects.
+
+ :arg objto: [x, y, z] or object to which the ray is casted
+ :type objto: :class:`KX_GameObject` or 3-tuple
+ :arg objfrom: [x, y, z] or object from which the ray is casted; None or omitted => use self object center
+ :type objfrom: :class:`KX_GameObject` or 3-tuple or None
+ :arg dist: max distance to look (can be negative => look behind); 0 or omitted => detect up to to
+ :type dist: float
+ :arg prop: property name that object must have; can be omitted or "" => detect any object
+ :type prop: string
+ :arg face: normal option: 1=>return face normal; 0 or omitted => normal is oriented towards origin
+ :type face: integer
+ :arg xray: X-ray option: 1=>skip objects that don't match prop; 0 or omitted => stop on first object
+ :type xray: integer
+ :arg poly: polygon option: 0, 1 or 2 to return a 3-, 4- or 5-tuple with information on the face hit.
+
+ * 0 or omitted: return value is a 3-tuple (object, hitpoint, hitnormal) or (None, None, None) if no hit
+ * 1: return value is a 4-tuple and the 4th element is a :class:`KX_PolyProxy` or None if no hit or the object doesn't use a mesh collision shape.
+ * 2: return value is a 5-tuple and the 5th element is a 2-tuple (u, v) with the UV mapping of the hit point or None if no hit, or the object doesn't use a mesh collision shape, or doesn't have a UV mapping.
+
+ :type poly: integer
+ :return: (object, hitpoint, hitnormal) or (object, hitpoint, hitnormal, polygon) or (object, hitpoint, hitnormal, polygon, hituv).
+
+ * object, hitpoint and hitnormal are None if no hit.
+ * polygon is valid only if the object is valid and is a static object, a dynamic object using mesh collision shape or a soft body object, otherwise it is None
+ * hituv is valid only if polygon is valid and the object has a UV mapping, otherwise it is None
+
+ :rtype:
+
+ * 3-tuple (:class:`KX_GameObject`, 3-tuple (x, y, z), 3-tuple (nx, ny, nz))
+ * or 4-tuple (:class:`KX_GameObject`, 3-tuple (x, y, z), 3-tuple (nx, ny, nz), :class:`PolyProxy`)
+ * or 5-tuple (:class:`KX_GameObject`, 3-tuple (x, y, z), 3-tuple (nx, ny, nz), :class:`PolyProxy`, 2-tuple (u, v))
+
+ .. note:: The ray ignores the object on which the method is called. It is casted from/to object center or explicit [x, y, z] points.
+
+ .. method:: setCollisionMargin(margin)
+
+ Set the objects collision margin.
+
+ .. note:: If this object has no physics controller (a physics ID of zero), this function will raise RuntimeError.
+
+ :arg margin: the collision margin distance in blender units.
+ :type margin: float
+
+ .. method:: sendMessage(subject, body="", to="")
+
+ Sends a message.
+
+ :arg subject: The subject of the message
+ :type subject: string
+ :arg body: The body of the message (optional)
+ :type body: string
+ :arg to: The name of the object to send the message to (optional)
+ :type to: string
+
+ .. method:: reinstancePhysicsMesh(gameObject, meshObject)
+
+ Updates the physics system with the changed mesh.
+
+ If no arguments are given the physics mesh will be re-created from the first mesh assigned to the game object.
+
+ :arg gameObject: optional argument, set the physics shape from this gameObjets mesh.
+ :type gameObject: string, :class:`KX_GameObject` or None
+ :arg meshObject: optional argument, set the physics shape from this mesh.
+ :type meshObject: string, :class:`MeshProxy` or None
+
+ .. note:: if this object has instances the other instances will be updated too.
+ .. note:: the gameObject argument has an advantage that it can convert from a mesh with modifiers applied (such as subsurf).
+ .. warning:: only triangle mesh type objects are supported currently (not convex hull)
+ .. warning:: if the object is a part of a combound object it will fail (parent or child)
+ .. warning:: rebuilding the physics mesh can be slow, running many times per second will give a performance hit.
+
+ :return: True if reinstance succeeded, False if it failed.
+ :rtype: boolean
+
+ .. method:: get(key, default=None)
+
+ Return the value matching key, or the default value if its not found.
+ :return: The key value or a default.
+
+.. class:: KX_IpoActuator(SCA_IActuator)
+
+ IPO actuator activates an animation.
+
+ .. attribute:: frameStart
+
+ Start frame. **type** float
+
+ .. attribute:: frameEnd
+
+ End frame. **type** float
+
+ .. attribute:: propName
+
+ Use this property to define the Ipo position **type** string
+
+ .. attribute:: framePropName
+
+ Assign this property this action current frame number **type** string
+
+ .. attribute:: mode
+
+ Play mode for the ipo. (In GameLogic.KX_IPOACT_PLAY, KX_IPOACT_PINGPONG, KX_IPOACT_FLIPPER, KX_IPOACT_LOOPSTOP, KX_IPOACT_LOOPEND, KX_IPOACT_FROM_PROP) **type** integer
+
+ .. attribute:: useIpoAsForce
+
+ Apply Ipo as a global or local force depending on the local option (dynamic objects only) **type** bool
+
+ .. attribute:: useIpoAdd
+
+ Ipo is added to the current loc/rot/scale in global or local coordinate according to Local flag **type** bool
+
+ .. attribute:: useIpoLocal
+
+ Let the ipo acts in local coordinates, used in Force and Add mode. **type** bool
+
+ .. attribute:: useChildren
+
+ Update IPO on all children Objects as well **type** bool
+
+.. class:: KX_LightObject(KX_GameObject)
+
+ A Light object.
+
+ .. code-block:: python
+
+ # Turn on a red alert light.
+ import bge
+
+ co = bge.logic.getCurrentController()
+ light = co.owner
+
+ light.energy = 1.0
+ light.colour = [1.0, 0.0, 0.0]
+
+ .. data:: SPOT
+
+ A spot light source. See attribute :data:`type`
+
+ .. data:: SUN
+
+ A point light source with no attenuation. See attribute :data:`type`
+
+ .. data:: NORMAL
+
+ A point light source. See attribute :data:`type`
+
+ .. attribute:: type
+
+ The type of light - must be SPOT, SUN or NORMAL
+
+ .. attribute:: layer
+
+ The layer mask that this light affects object on. **type** bitfield
+
+ .. attribute:: energy
+
+ The brightness of this light. **type** float
+
+ .. attribute:: distance
+
+ The maximum distance this light can illuminate. (SPOT and NORMAL lights only) **type** float
+
+ .. attribute:: colour
+
+ The colour of this light. Black = [0.0, 0.0, 0.0], White = [1.0, 1.0, 1.0]. **type** list [r, g, b]
+
+ .. attribute:: color
+
+ Synonym for colour.
+
+ .. attribute:: lin_attenuation
+
+ The linear component of this light's attenuation. (SPOT and NORMAL lights only) **type** float
+
+ .. attribute:: quad_attenuation
+
+ The quadratic component of this light's attenuation (SPOT and NORMAL lights only) **type** float
+
+ .. attribute:: spotsize
+
+ The cone angle of the spot light, in degrees (SPOT lights only). **type** float in [0 - 180].
+
+ .. attribute:: spotblend
+
+ Specifies the intensity distribution of the spot light (SPOT lights only). **type** float in [0 - 1]
+
+ .. note:: Higher values result in a more focused light source.
+
+.. class:: KX_MeshProxy(SCA_IObject)
+
+ A mesh object.
+
+ You can only change the vertex properties of a mesh object, not the mesh topology.
+
+ To use mesh objects effectively, you should know a bit about how the game engine handles them.
+
+ #. Mesh Objects are converted from Blender at scene load.
+ #. The Converter groups polygons by Material. This means they can be sent to the renderer efficiently. A material holds:
+
+ #. The texture.
+ #. The Blender material.
+ #. The Tile properties
+ #. The face properties - (From the "Texture Face" panel)
+ #. Transparency & z sorting
+ #. Light layer
+ #. Polygon shape (triangle/quad)
+ #. Game Object
+
+ #. Verticies will be split by face if necessary. Verticies can only be shared between faces if:
+
+ #. They are at the same position
+ #. UV coordinates are the same
+ #. Their normals are the same (both polygons are "Set Smooth")
+ #. They are the same colour, for example: a cube has 24 verticies: 6 faces with 4 verticies per face.
+
+ The correct method of iterating over every :class:`KX_VertexProxy` in a game object
+
+ .. code-block:: python
+
+ import GameLogic
+
+ co = GameLogic.getCurrentController()
+ obj = co.owner
+
+ m_i = 0
+ mesh = obj.getMesh(m_i) # There can be more than one mesh...
+ while mesh != None:
+ for mat in range(mesh.getNumMaterials()):
+ for v_index in range(mesh.getVertexArrayLength(mat)):
+ vertex = mesh.getVertex(mat, v_index)
+ # Do something with vertex here...
+ # ... eg: colour the vertex red.
+ vertex.colour = [1.0, 0.0, 0.0, 1.0]
+ m_i += 1
+ mesh = obj.getMesh(m_i)
+
+ .. attribute:: materials
+
+ **type** list of :class:`KX_BlenderMaterial` or :class:`KX_PolygonMaterial` types
+
+ .. attribute:: numPolygons
+
+ **type** integer
+
+ .. attribute:: numMaterials
+
+ **type** integer
+
+ .. method:: getNumMaterials()
+
+ :return: number of materials associated with this object
+ :rtype: integer
+
+ .. method:: getMaterialName(matid)
+
+ Gets the name of the specified material.
+
+ :arg matid: the specified material.
+ :type matid: integer
+ :return: the attached material name.
+ :rtype: string
+
+ .. method:: getTextureName(matid)
+
+ Gets the name of the specified material's texture.
+
+ :arg matid: the specified material
+ :type matid: integer
+ :return: the attached material's texture name.
+ :rtype: string
+
+ .. method:: getVertexArrayLength(matid)
+
+ Gets the length of the vertex array associated with the specified material.
+
+ There is one vertex array for each material.
+
+ :arg matid: the specified material
+ :type matid: integer
+ :return: the number of verticies in the vertex array.
+ :rtype: integer
+
+ .. method:: getVertex(matid, index)
+
+ Gets the specified vertex from the mesh object.
+
+ :arg matid: the specified material
+ :type matid: integer
+ :arg index: the index into the vertex array.
+ :type index: integer
+ :return: a vertex object.
+ :rtype: :class:`KX_VertexProxy`
+
+ .. method:: getNumPolygons()
+
+ :return: The number of polygon in the mesh.
+ :rtype: integer
+
+ .. method:: getPolygon(index)
+
+ Gets the specified polygon from the mesh.
+
+ :arg index: polygon number
+ :type index: integer
+ :return: a polygon object.
+ :rtype: :class:`PolyProxy`
+
+.. class:: SCA_MouseSensor(SCA_ISensor)
+
+ Mouse Sensor logic brick.
+
+ Properties:
+
+ .. attribute:: position
+
+ current [x, y] coordinates of the mouse, in frame coordinates (pixels) **type** [integer, interger]
+
+ .. attribute:: mode
+
+ sensor mode. **type** integer
+
+ * KX_MOUSESENSORMODE_LEFTBUTTON(1)
+ * KX_MOUSESENSORMODE_MIDDLEBUTTON(2)
+ * KX_MOUSESENSORMODE_RIGHTBUTTON(3)
+ * KX_MOUSESENSORMODE_WHEELUP(4)
+ * KX_MOUSESENSORMODE_WHEELDOWN(5)
+ * KX_MOUSESENSORMODE_MOVEMENT(6)
+
+ .. method:: getButtonStatus(button)
+
+ Get the mouse button status.
+
+ :arg button: value in GameLogic members KX_MOUSE_BUT_LEFT, KX_MOUSE_BUT_MIDDLE, KX_MOUSE_BUT_RIGHT
+ :type button: integer
+ :return: value in GameLogic members KX_INPUT_NONE, KX_INPUT_NONE, KX_INPUT_JUST_ACTIVATED, KX_INPUT_ACTIVE, KX_INPUT_JUST_RELEASED
+ :rtype: integer
+
+.. class:: KX_MouseFocusSensor(SCA_MouseSensor)
+
+ The mouse focus sensor detects when the mouse is over the current game object.
+
+ The mouse focus sensor works by transforming the mouse coordinates from 2d device
+ space to 3d space then raycasting away from the camera.
+
+ .. attribute:: raySource
+
+ The worldspace source of the ray (the view position) **type** list (vector of 3 floats)
+
+ .. attribute:: rayTarget
+
+ The worldspace target of the ray. **type** list (vector of 3 floats)
+
+ .. attribute:: rayDirection
+
+ The :data:`rayTarget` - :class:`raySource` normalized. **type** list (normalized vector of 3 floats)
+
+ .. attribute:: hitObject
+
+ the last object the mouse was over. **type** :class:`KX_GameObject` or None
+
+ .. attribute:: hitPosition
+
+ The worldspace position of the ray intersecton. **type** list (vector of 3 floats)
+
+ .. attribute:: hitNormal
+
+ the worldspace normal from the face at point of intersection. **type** list (normalized vector of 3 floats)
+
+ .. attribute:: hitUV
+
+ the UV coordinates at the point of intersection. **type** list (vector of 2 floats)
+
+ If the object has no UV mapping, it returns [0, 0].
+
+ The UV coordinates are not normalized, they can be < 0 or > 1 depending on the UV mapping.
+
+ .. attribute:: usePulseFocus
+
+ When enabled, moving the mouse over a different object generates a pulse. (only used when the 'Mouse Over Any' sensor option is set) **type** bool
+
+.. class:: KX_TouchSensor(SCA_ISensor)
+
+ Touch sensor detects collisions between objects.
+
+ .. attribute:: propName
+
+ The property or material to collide with. **type** string
+
+ .. attribute:: useMaterial
+
+ Determines if the sensor is looking for a property or material. KX_True = Find material; KX_False = Find property. **type** boolean
+
+ .. attribute:: usePulseCollision
+
+ When enabled, changes to the set of colliding objects generate a pulse. **type** bool
+
+ .. attribute:: hitObject
+
+ The last collided object. (read-only) **type** :class:`KX_GameObject` or None
+
+ .. attribute:: hitObjectList
+
+ A list of colliding objects. (read-only) **type** :class:`CListValue` of :class:`KX_GameObject`
+
+.. class:: KX_NearSensor(KX_TouchSensor)
+
+ A near sensor is a specialised form of touch sensor.
+
+ .. attribute:: distance
+
+ The near sensor activates when an object is within this distance. **type** float
+
+ .. attribute:: resetDistance
+
+ The near sensor deactivates when the object exceeds this distance. **type** float
+
+.. class:: KX_NetworkMessageActuator(SCA_IActuator)
+
+ Message Actuator
+
+ .. attribute:: propName
+
+ Messages will only be sent to objects with the given property name. **type** string
+
+ .. attribute:: subject
+
+ The subject field of the message. **type** string
+
+ .. attribute:: body
+
+ The body of the message. **type** string
+
+ .. attribute:: usePropBody
+
+ Send a property instead of a regular body message. **type** boolean
+
+.. class:: KX_NetworkMessageSensor(SCA_ISensor)
+
+ The Message Sensor logic brick.
+
+ Currently only loopback (local) networks are supported.
+
+ .. attribute:: subject
+
+ The subject the sensor is looking for. **type** string
+
+ .. attribute:: frameMessageCount
+
+ The number of messages received since the last frame. (read-only). **type** integer
+
+ .. attribute:: subjects
+
+ The list of message subjects received. (read-only). **type** list of strings
+
+ .. attribute:: bodies
+
+ The list of message bodies received. (read-only) **type** list of strings
+
+.. class:: KX_ObjectActuator(SCA_IActuator)
+
+ The object actuator ("Motion Actuator") applies force, torque, displacement, angular displacement,
+ velocity, or angular velocity to an object.
+ Servo control allows to regulate force to achieve a certain speed target.
+
+ .. attribute:: force
+
+ The force applied by the actuator **type** list [x, y, z]
+
+ .. attribute:: useLocalForce
+
+ A flag specifying if the force is local **type** bool
+
+ .. attribute:: torque
+
+ The torque applied by the actuator **type** list [x, y, z]
+
+ .. attribute:: useLocalTorque
+
+ A flag specifying if the torque is local **type** bool
+
+ .. attribute:: dLoc
+
+ The displacement vector applied by the actuator **type** list [x, y, z]
+
+ .. attribute:: useLocalDLoc
+
+ A flag specifying if the dLoc is local **type** bool
+
+ .. attribute:: dRot
+
+ The angular displacement vector applied by the actuator
+
+ .. note:: Since the displacement is applied every frame, you must adjust the displacement based on the frame rate, or you game experience will depend on the player's computer speed. **type** list [x, y, z]
+
+ .. attribute:: useLocalDRot
+
+ A flag specifying if the dRot is local **type** bool
+
+ .. attribute:: linV
+
+ The linear velocity applied by the actuator **type** list [x, y, z]
+
+ .. attribute:: useLocalLinV
+
+ A flag specifying if the linear velocity is local.
+
+ .. note:: This is the target speed for servo controllers **type** bool
+
+ .. attribute:: angV
+
+ The angular velocity applied by the actuator **type** list [x, y, z]
+
+ .. attribute:: useLocalAngV
+
+ A flag specifying if the angular velocity is local **type** bool
+
+ .. attribute:: damping
+
+ The damping parameter of the servo controller **type** short
+
+ .. attribute:: forceLimitX
+
+ The min/max force limit along the X axis and activates or deactivates the limits in the servo controller **type** list [min(float), max(float), bool]
+
+ .. attribute:: forceLimitY
+
+ The min/max force limit along the Y axis and activates or deactivates the limits in the servo controller **type** list [min(float), max(float), bool]
+
+ .. attribute:: forceLimitZ
+
+ The min/max force limit along the Z axis and activates or deactivates the limits in the servo controller **type** list [min(float), max(float), bool]
+
+ .. attribute:: pid
+
+ The PID coefficients of the servo controller **type** list of floats [proportional, integral, derivate]
+
+ .. attribute:: reference
+
+ The object that is used as reference to compute the velocity for the servo controller. **type** :class:`KX_GameObject` or None
+
+.. class:: KX_ParentActuator(SCA_IActuator)
+
+ The parent actuator can set or remove an objects parent object.
+
+ .. attribute:: object
+
+ the object this actuator sets the parent too. **type** :class:`KX_GameObject` or None
+
+ .. attribute:: mode
+
+ The mode of this actuator **type** integer from 0 to 1.
+
+ .. attribute:: compound
+
+ Whether the object shape should be added to the parent compound shape when parenting.
+
+ Effective only if the parent is already a compound shape **type** bool
+
+ .. attribute:: ghost
+
+ whether the object should be made ghost when parenting
+ Effective only if the shape is not added to the parent compound shape **type** bool
+
+.. class:: KX_PhysicsObjectWrapper(PyObjectPlus)
+
+ KX_PhysicsObjectWrapper
+
+ .. method:: setActive(active)
+
+ Set the object to be active.
+
+ :arg active: set to True to be active
+ :type active: bool
+
+ .. method:: setAngularVelocity(x, y, z, local)
+
+ Set the angular velocity of the object.
+
+ :arg x: angular velocity for the x-axis
+ :type x: float
+
+ :arg y: angular velocity for the y-axis
+ :type y: float
+
+ :arg z: angular velocity for the z-axis
+ :type z: float
+
+ :arg local: set to True for local axis
+ :type local: bool
+
+ .. method:: setLinearVelocity(x, y, z, local)
+
+ Set the linear velocity of the object.
+
+ :arg x: linear velocity for the x-axis
+ :type x: float
+
+ :arg y: linear velocity for the y-axis
+ :type y: float
+
+ :arg z: linear velocity for the z-axis
+ :type z: float
+
+ :arg local: set to True for local axis
+ :type local: bool
+
+.. class:: KX_PolyProxy(SCA_IObject)
+
+ A polygon holds the index of the vertex forming the poylgon.
+
+ Note:
+ The polygon attributes are read-only, you need to retrieve the vertex proxy if you want
+ to change the vertex settings.
+
+ .. attribute:: matname
+
+ The name of polygon material, empty if no material. **type** string
+
+ .. attribute:: material
+
+ The material of the polygon **type** :class:`KX_PolygonMaterial` or :class:`KX_BlenderMaterial`
+
+ .. attribute:: texture
+
+ The texture name of the polygon. **type** string
+
+ .. attribute:: matid
+
+ The material index of the polygon, use this to retrieve vertex proxy from mesh proxy **type** integer
+
+ .. attribute:: v1
+
+ vertex index of the first vertex of the polygon, use this to retrieve vertex proxy from mesh proxy **type** integer
+
+ .. attribute:: v2
+
+ vertex index of the second vertex of the polygon, use this to retrieve vertex proxy from mesh proxy **type** integer
+
+ .. attribute:: v3
+
+ vertex index of the third vertex of the polygon, use this to retrieve vertex proxy from mesh proxy **type** integer
+
+ .. attribute:: v4
+
+ vertex index of the fourth vertex of the polygon, 0 if polygon has only 3 vertex
+ use this to retrieve vertex proxy from mesh proxy **type** integer
+
+ .. attribute:: visible
+
+ visible state of the polygon: 1=visible, 0=invisible **type** integer
+
+ .. attribute:: collide
+
+ collide state of the polygon: 1=receives collision, 0=collision free. **type** integer
+
+ .. method:: getMaterialName()
+
+ Returns the polygon material name with MA prefix
+
+ :return: material name
+ :rtype: string
+
+ .. method:: getMaterial()
+
+ :return: The polygon material
+ :rtype: :class:`KX_PolygonMaterial` or :class:`KX_BlenderMaterial`
+
+ .. method:: getTextureName()
+
+ :return: The texture name
+ :rtype: string
+
+ .. method:: getMaterialIndex()
+
+ Returns the material bucket index of the polygon.
+ This index and the ones returned by getVertexIndex() are needed to retrieve the vertex proxy from :class:`MeshProxy`.
+
+ :return: the material index in the mesh
+ :rtype: integer
+
+ .. method:: getNumVertex()
+
+ Returns the number of vertex of the polygon.
+
+ :return: number of vertex, 3 or 4.
+ :rtype: integer
+
+ .. method:: isVisible()
+
+ Returns whether the polygon is visible or not
+
+ :return: 0=invisible, 1=visible
+ :rtype: boolean
+
+ .. method:: isCollider()
+
+ Returns whether the polygon is receives collision or not
+
+ :return: 0=collision free, 1=receives collision
+ :rtype: integer
+
+ .. method:: getVertexIndex(vertex)
+
+ Returns the mesh vertex index of a polygon vertex
+ This index and the one returned by getMaterialIndex() are needed to retrieve the vertex proxy from :class:`MeshProxy`.
+
+ :arg vertex: index of the vertex in the polygon: 0->3
+ :arg vertex: integer
+ :return: mesh vertex index
+ :rtype: integer
+
+ .. method:: getMesh()
+
+ Returns a mesh proxy
+
+ :return: mesh proxy
+ :rtype: :class:`MeshProxy`
+
+.. class:: KX_PolygonMaterial
+
+ This is the interface to materials in the game engine.
+
+ Materials define the render state to be applied to mesh objects.
+
+ .. warning:: Some of the methods/variables are CObjects. If you mix these up, you will crash blender.
+
+ This example requires
+
+ * PyOpenGL <http://pyopengl.sourceforge.net>
+ * GLEWPy <http://glewpy.sourceforge.net>
+
+ .. code-block:: python
+
+ import GameLogic
+ import OpenGL
+ from OpenGL.GL import *
+ from OpenGL.GLU import *
+ import glew
+ from glew import *
+
+ glewInit()
+
+ vertex_shader = """
+
+ void main(void)
+ {
+ gl_Position = ftransform();
+ }
+ """
+
+ fragment_shader ="""
+
+ void main(void)
+ {
+ gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0);
+ }
+ """
+
+ class MyMaterial:
+ def __init__(self):
+ self.pass_no = 0
+ # Create a shader
+ self.m_program = glCreateProgramObjectARB()
+ # Compile the vertex shader
+ self.shader(GL_VERTEX_SHADER_ARB, (vertex_shader))
+ # Compile the fragment shader
+ self.shader(GL_FRAGMENT_SHADER_ARB, (fragment_shader))
+ # Link the shaders together
+ self.link()
+
+ def PrintInfoLog(self, tag, object):
+ """
+ PrintInfoLog prints the GLSL compiler log
+ """
+ print "Tag: def PrintGLError(self, tag = ""):
+
+ def PrintGLError(self, tag = ""):
+ """
+ Prints the current GL error status
+ """
+ if len(tag):
+ print tag
+ err = glGetError()
+ if err != GL_NO_ERROR:
+ print "GL Error: %s\\n"%(gluErrorString(err))
+
+ def shader(self, type, shaders):
+ """
+ shader compiles a GLSL shader and attaches it to the current
+ program.
+
+ type should be either GL_VERTEX_SHADER_ARB or GL_FRAGMENT_SHADER_ARB
+ shaders should be a sequence of shader source to compile.
+ """
+ # Create a shader object
+ shader_object = glCreateShaderObjectARB(type)
+
+ # Add the source code
+ glShaderSourceARB(shader_object, len(shaders), shaders)
+
+ # Compile the shader
+ glCompileShaderARB(shader_object)
+
+ # Print the compiler log
+ self.PrintInfoLog("vertex shader", shader_object)
+
+ # Check if compiled, and attach if it did
+ compiled = glGetObjectParameterivARB(shader_object, GL_OBJECT_COMPILE_STATUS_ARB)
+ if compiled:
+ glAttachObjectARB(self.m_program, shader_object)
+
+ # Delete the object (glAttachObjectARB makes a copy)
+ glDeleteObjectARB(shader_object)
+
+ # print the gl error log
+ self.PrintGLError()
+
+ def link(self):
+ """
+ Links the shaders together.
+ """
+ # clear error indicator
+ glGetError()
+
+ glLinkProgramARB(self.m_program)
+
+ self.PrintInfoLog("link", self.m_program)
+
+ linked = glGetObjectParameterivARB(self.m_program, GL_OBJECT_LINK_STATUS_ARB)
+ if not linked:
+ print "Shader failed to link"
+ return
+
+ glValidateProgramARB(self.m_program)
+ valid = glGetObjectParameterivARB(self.m_program, GL_OBJECT_VALIDATE_STATUS_ARB)
+ if not valid:
+ print "Shader failed to validate"
+ return
+
+ def activate(self, rasty, cachingInfo, mat):
+ self.pass_no+=1
+ if (self.pass_no == 1):
+ glDisable(GL_COLOR_MATERIAL)
+ glUseProgramObjectARB(self.m_program)
+ return True
+
+ glEnable(GL_COLOR_MATERIAL)
+ glUseProgramObjectARB(0)
+ self.pass_no = 0
+ return False
+
+ obj = GameLogic.getCurrentController().owner
+
+ mesh = obj.meshes[0]
+
+ for mat in mesh.materials:
+ mat.setCustomMaterial(MyMaterial())
+ print mat.texture
+
+ .. attribute:: texture
+
+ Texture name **type** string (read-only)
+
+ .. attribute:: gl_texture
+
+ OpenGL texture handle (eg for glBindTexture(GL_TEXTURE_2D, gl_texture) **type** integer (read-only)
+
+ .. attribute:: material
+
+ Material name **type** string (read-only)
+
+ .. attribute:: tface
+
+ Texture face properties **type** CObject (read-only)
+
+ .. attribute:: tile
+
+ Texture is tiling **type** boolean
+
+ .. attribute:: tilexrep
+
+ Number of tile repetitions in x direction. **type** integer
+
+ .. attribute:: tileyrep
+
+ Number of tile repetitions in y direction. **type** integer
+
+ .. attribute:: drawingmode
+
+ Drawing mode for the material.
+ - 2 (drawingmode & 4) Textured
+ - 4 (drawingmode & 16) Light
+ - 14 (drawingmode & 16384) 3d Polygon Text **type** bitfield
+
+ .. attribute:: transparent
+
+ This material is transparent. All meshes with this
+ material will be rendered after non transparent meshes from back
+ to front. **type** boolean
+
+ .. attribute:: zsort
+
+ Transparent polygons in meshes with this material will be sorted back to
+ front before rendering.
+ Non-Transparent polygons will be sorted front to back before rendering. **type** boolean
+
+ .. attribute:: lightlayer
+
+ Light layers this material affects. **type** bitfield.
+
+ .. attribute:: triangle
+
+ Mesh data with this material is triangles. It's probably not safe to change this. **type** boolean
+
+ .. attribute:: diffuse
+
+ The diffuse colour of the material. black = [0.0, 0.0, 0.0] white = [1.0, 1.0, 1.0] **type** list [r, g, b]
+
+ .. attribute:: specular
+
+ The specular colour of the material. black = [0.0, 0.0, 0.0] white = [1.0, 1.0, 1.0] **type** list [r, g, b]
+
+ .. attribute:: shininess
+
+ The shininess (specular exponent) of the material. 0.0 <= shininess <= 128.0 **type** float
+
+ .. attribute:: specularity
+
+ The amount of specular of the material. 0.0 <= specularity <= 1.0 **type** float
+
+ .. method:: updateTexture(tface, rasty)
+
+ Updates a realtime animation.
+
+ :arg tface: Texture face (eg mat.tface)
+ :type tface: CObject
+ :arg rasty: Rasterizer
+ :type rasty: CObject
+
+ .. method:: setTexture(tface)
+
+ Sets texture render state.
+
+ .. code-block:: python
+
+ mat.setTexture(mat.tface)
+
+ :arg tface: Texture face
+ :type tface: CObject
+
+ .. method:: activate(rasty, cachingInfo)
+
+ Sets material parameters for this object for rendering.
+
+ Material Parameters set:
+
+ #. Texture
+ #. Backface culling
+ #. Line drawing
+ #. Specular Colour
+ #. Shininess
+ #. Diffuse Colour
+ #. Polygon Offset.
+
+ :arg rasty: Rasterizer instance.
+ :type rasty: CObject
+ :arg cachingInfo: Material cache instance.
+ :type cachingInfo: CObject
+
+ .. method:: setCustomMaterial(material)
+
+ Sets the material state setup object.
+
+ Using this method, you can extend or completely replace the gameengine material
+ to do your own advanced multipass effects.
+
+ Use this method to register your material class. Instead of the normal material,
+ your class's activate method will be called just before rendering the mesh.
+ This should setup the texture, material, and any other state you would like.
+ It should return True to render the mesh, or False if you are finished. You should
+ clean up any state Blender does not set before returning False.
+
+ Activate Method Definition::
+ `def activate(self, rasty, cachingInfo, material):`
+
+ .. code-block:: python
+
+ class PyMaterial:
+ def __init__(self):
+ self.pass_no = -1
+
+ def activate(self, rasty, cachingInfo, material):
+ # Activate the material here.
+ #
+ # The activate method will be called until it returns False.
+ # Every time the activate method returns True the mesh will
+ # be rendered.
+ #
+ # rasty is a CObject for passing to material.updateTexture()
+ # and material.activate()
+ # cachingInfo is a CObject for passing to material.activate()
+ # material is the KX_PolygonMaterial instance this material
+ # was added to
+
+ # default material properties:
+ self.pass_no += 1
+ if self.pass_no == 0:
+ material.activate(rasty, cachingInfo)
+ # Return True to do this pass
+ return True
+
+ # clean up and return False to finish.
+ self.pass_no = -1
+ return False
+
+ # Create a new Python Material and pass it to the renderer.
+ mat.setCustomMaterial(PyMaterial())
+
+ :arg material: The material object.
+ :type material: instance
+
+.. class:: KX_RadarSensor(KX_NearSensor)
+
+ Radar sensor is a near sensor with a conical sensor object.
+
+ .. attribute:: coneOrigin
+
+ The origin of the cone with which to test. The origin is in the middle of the cone. (read-only) **type** list of floats [x, y, z]
+
+ .. attribute:: coneTarget
+
+ The center of the bottom face of the cone with which to test. (read-only) **type** list of floats [x, y, z]
+
+ .. attribute:: distance
+
+ The height of the cone with which to test. **type** float
+
+ .. attribute:: angle
+
+ The angle of the cone (in degrees) with which to test. **type** float from 0 to 360
+
+ .. attribute:: axis
+
+ The axis on which the radar cone is cast **type** integer from 0 to 5
+
+ KX_RADAR_AXIS_POS_X, KX_RADAR_AXIS_POS_Y, KX_RADAR_AXIS_POS_Z,
+ KX_RADAR_AXIS_NEG_X, KX_RADAR_AXIS_NEG_Y, KX_RADAR_AXIS_NEG_Z
+
+ .. method:: getConeHeight()
+
+ :return: The height of the cone with which to test.
+ :rtype: float
+
+.. class:: KX_RaySensor(SCA_ISensor)
+
+ A ray sensor detects the first object in a given direction.
+
+ .. attribute:: propName
+
+ The property the ray is looking for. **type** string
+
+ .. attribute:: range
+
+ The distance of the ray. **type** float
+
+ .. attribute:: useMaterial
+
+ Whether or not to look for a material (false = property) **type** boolean
+
+ .. attribute:: useXRay
+
+ Whether or not to use XRay. **type** boolean
+
+ .. attribute:: hitObject
+
+ The game object that was hit by the ray. (read-only) **type** :class:`KX_GameObject`
+
+ .. attribute:: hitPosition
+
+ The position (in worldcoordinates) where the object was hit by the ray. (read-only) **type** list [x, y, z]
+
+ .. attribute:: hitNormal
+
+ The normal (in worldcoordinates) of the object at the location where the object was hit by the ray. (read-only) **type** list [x, y, z]
+
+ .. attribute:: rayDirection
+
+ The direction from the ray (in worldcoordinates). (read-only) **type** list [x, y, z]
+
+ .. attribute:: axis
+
+ The axis the ray is pointing on. **type** integer from 0 to 5
+
+ * KX_RAY_AXIS_POS_X
+ * KX_RAY_AXIS_POS_Y
+ * KX_RAY_AXIS_POS_Z
+ * KX_RAY_AXIS_NEG_X
+ * KX_RAY_AXIS_NEG_Y
+ * KX_RAY_AXIS_NEG_Z
+
+.. class:: KX_SCA_AddObjectActuator(SCA_IActuator)
+
+ Edit Object Actuator (in Add Object Mode)
+
+ .. attribute:: object
+
+ the object this actuator adds. **type** :class:`KX_GameObject` or None
+
+ .. attribute:: objectLastCreated
+
+ the last added object from this actuator (read-only). **type** :class:`KX_GameObject` or None
+
+ .. attribute:: time
+
+ the lifetime of added objects, in frames. Set to 0 to disable automatic deletion. **type** integer
+
+ .. attribute:: linearVelocity
+
+ the initial linear velocity of added objects. **type** list [vx, vy, vz]
+
+ .. attribute:: angularVelocity
+
+ the initial angular velocity of added objects. **type** list [vx, vy, vz]
+
+ .. warning:: An Add Object actuator will be ignored if at game start, the linked object doesn't exist
+ (or is empty) or the linked object is in an active layer.
+
+ This will genereate a warning in the console:
+
+ ``Error: GameObject 'Name' has a AddObjectActuator 'ActuatorName' without object (in 'nonactive' layer)``
+
+ .. method:: instantAddObject()
+
+ :return: The last object created by this actuator. The object can then be accessed from :data:`objectLastCreated`.
+ :rtype: None
+
+.. class:: KX_SCA_DynamicActuator(SCA_IActuator)
+
+ Dynamic Actuator.
+
+ .. attribute:: mode
+
+ **type** integer
+
+ the type of operation of the actuator, 0-4
+
+ * KX_DYN_RESTORE_DYNAMICS(0)
+ * KX_DYN_DISABLE_DYNAMICS(1)
+ * KX_DYN_ENABLE_RIGID_BODY(2)
+ * KX_DYN_DISABLE_RIGID_BODY(3)
+ * KX_DYN_SET_MASS(4)
+
+ .. attribute:: mass
+
+ the mass value for the KX_DYN_SET_MASS operation **type** float
+
+.. class:: KX_SCA_EndObjectActuator(SCA_IActuator)
+
+ Edit Object Actuator (in End Object mode)
+
+ This actuator has no python methods.
+
+.. class:: KX_SCA_ReplaceMeshActuator(SCA_IActuator)
+
+ Edit Object actuator, in Replace Mesh mode.
+
+ .. code-block:: python
+
+ # Level-of-detail
+ # Switch a game object's mesh based on its depth in the camera view.
+ # +----------+ +-----------+ +-------------------------------------+
+ # | Always +-----+ Python +-----+ Edit Object (Replace Mesh) LOD.Mesh |
+ # +----------+ +-----------+ +-------------------------------------+
+ import GameLogic
+
+ # List detail meshes here
+ # Mesh (name, near, far)
+ # Meshes overlap so that they don't 'pop' when on the edge of the distance.
+ meshes = ((".Hi", 0.0, -20.0),
+ (".Med", -15.0, -50.0),
+ (".Lo", -40.0, -100.0)
+ )
+
+ co = GameLogic.getCurrentController()
+ obj = co.owner
+ act = co.actuators["LOD." + obj.name]
+ cam = GameLogic.getCurrentScene().active_camera
+
+ def Depth(pos, plane):
+ return pos[0]*plane[0] + pos[1]*plane[1] + pos[2]*plane[2] + plane[3]
+
+ # Depth is negative and decreasing further from the camera
+ depth = Depth(obj.position, cam.world_to_camera[2])
+
+ newmesh = None
+ curmesh = None
+ # Find the lowest detail mesh for depth
+ for mesh in meshes:
+ if depth < mesh[1] and depth > mesh[2]:
+ newmesh = mesh
+ if "ME" + obj.name + mesh[0] == act.getMesh():
+ curmesh = mesh
+
+ if newmesh != None and "ME" + obj.name + newmesh[0] != act.getMesh():
+ # The mesh is a different mesh - switch it.
+ # Check the current mesh is not a better fit.
+ if curmesh == None or curmesh[1] < depth or curmesh[2] > depth:
+ act.mesh = obj.getName() + newmesh[0]
+ GameLogic.addActiveActuator(act, True)
+
+ .. warning:: Replace mesh actuators will be ignored if at game start, the named mesh doesn't exist.
+
+ This will generate a warning in the console
+
+ ``Error: GameObject 'Name' ReplaceMeshActuator 'ActuatorName' without object``
+
+ .. attribute:: mesh
+
+ :class:`MeshProxy` or the name of the mesh that will replace the current one.
+
+ Set to None to disable actuator **type** :class:`MeshProxy` or None if no mesh is set
+
+ .. attribute:: useDisplayMesh
+
+ when true the displayed mesh is replaced. **type** boolean
+
+ .. attribute:: usePhysicsMesh
+
+ when true the physics mesh is replaced. **type** boolean
+
+ .. method:: instantReplaceMesh()
+
+ Immediately replace mesh without delay.
+
+.. class:: KX_Scene(PyObjectPlus)
+
+ An active scene that gives access to objects, cameras, lights and scene attributes.
+
+ The activity culling stuff is supposed to disable logic bricks when their owner gets too far
+ from the active camera. It was taken from some code lurking at the back of KX_Scene - who knows
+ what it does!
+
+ .. code-block:: python
+
+ import GameLogic
+
+ # get the scene
+ scene = GameLogic.getCurrentScene()
+
+ # print all the objects in the scene
+ for obj in scene.objects:
+ print obj.name
+
+ # get an object named 'Cube'
+ obj = scene.objects["Cube"]
+
+ # get the first object in the scene.
+ obj = scene.objects[0]
+
+ .. code-block:: python
+
+ # Get the depth of an object in the camera view.
+ import GameLogic
+
+ obj = GameLogic.getCurrentController().owner
+ cam = GameLogic.getCurrentScene().active_camera
+
+ # Depth is negative and decreasing further from the camera
+ depth = obj.position[0]*cam.world_to_camera[2][0] + obj.position[1]*cam.world_to_camera[2][1] + obj.position[2]*cam.world_to_camera[2][2] + cam.world_to_camera[2][3]
+
+ @bug: All attributes are read only at the moment.
+
+ .. attribute:: name
+
+ The scene's name, (read-only). **type** string
+
+ .. attribute:: objects
+
+ A list of objects in the scene, (read-only). **type** :class:`CListValue` of :class:`KX_GameObject`
+
+ .. attribute:: objectsInactive
+
+ A list of objects on background layers (used for the addObject actuator), (read-only). **type** :class:`CListValue` of :class:`KX_GameObject`
+
+ .. attribute:: lights
+
+ A list of lights in the scene, (read-only). **type** :class:`CListValue` of :class:`KX_LightObject`
+
+ .. attribute:: cameras
+
+ A list of cameras in the scene, (read-only). **type** :class:`CListValue` of :class:`KX_Camera`
+
+ .. attribute:: active_camera
+
+ The current active camera.
+
+ .. note:: this can be set directly from python to avoid using the :class:`KX_SceneActuator`. **type** :class:`KX_Camera`
+
+ .. attribute:: suspended
+
+ True if the scene is suspended, (read-only). **type** boolean
+
+ .. attribute:: activity_culling
+
+ True if the scene is activity culling **type** boolean
+
+ .. attribute:: activity_culling_radius
+
+ The distance outside which to do activity culling. Measured in manhattan distance. **type** float
+
+ .. attribute:: dbvt_culling
+
+ True when Dynamic Bounding box Volume Tree is set (read-only). **type** bool
+
+ .. attribute:: pre_draw
+
+ A list of callables to be run before the render step. **type** list
+
+ .. attribute:: post_draw
+
+ A list of callables to be run after the render step. **type** list
+
+ .. method:: addObject(object, other, time=0)
+
+ Adds an object to the scene like the Add Object Actuator would.
+
+ :arg object: The object to add
+ :type object: :class:`KX_GameObject` or string
+ :arg other: The object's center to use when adding the object
+ :type other: :class:`KX_GameObject` or string
+ :arg time: The lifetime of the added object, in frames. A time of 0 means the object will last forever.
+ :type time: integer
+ :return: The newly added object.
+ :rtype: :class:`KX_GameObject`
+
+ .. method:: end()
+
+ Removes the scene from the game.
+
+ .. method:: restart()
+
+ Restarts the scene.
+
+ .. method:: replace(scene)
+
+ Replaces this scene with another one.
+
+ :arg scene: The name of the scene to replace this scene with.
+ :type scene: string
+
+ .. method:: suspend()
+
+ Suspends this scene.
+
+ .. method:: resume()
+
+ Resume this scene.
+
+ .. method:: get(key, default=None)
+
+ Return the value matching key, or the default value if its not found.
+ :return: The key value or a default.
+
+.. class:: KX_SceneActuator(SCA_IActuator)
+
+ Scene Actuator logic brick.
+
+ .. warning:: Scene actuators that use a scene name will be ignored if at game start, the named scene doesn't exist or is empty
+
+ This will generate a warning in the console:
+
+ ``Error: GameObject 'Name' has a SceneActuator 'ActuatorName' (SetScene) without scene``
+
+ .. attribute:: scene
+
+ the name of the scene to change to/overlay/underlay/remove/suspend/resume **type** string.
+
+ .. attribute:: camera
+
+ the camera to change to.
+
+ .. note:: When setting the attribute, you can use either a :class:`KX_Camera` or the name of the camera. **type** :class:`KX_Camera` on read, string or :class:`KX_Camera` on write
+
+ .. attribute:: useRestart
+
+ Set flag to True to restart the sene **type** bool
+
+ .. attribute:: mode
+
+ The mode of the actuator **type** integer from 0 to 5.
+
+.. class:: KX_SoundActuator(SCA_IActuator)
+
+ Sound Actuator.
+
+ The :data:`startSound`, :data:`pauseSound` and :data:`stopSound` do not requirethe actuator to be activated - they act instantly provided that the actuator has been activated once at least.
+
+ .. attribute:: fileName
+
+ The filename of the sound this actuator plays. **type** string
+
+ .. attribute:: volume
+
+ The volume (gain) of the sound. **type** float
+
+ .. attribute:: pitch
+
+ The pitch of the sound. **type** float
+
+ .. attribute:: rollOffFactor
+
+ The roll off factor. Rolloff defines the rate of attenuation as the sound gets further away. **type** float
+
+ .. attribute:: looping
+
+ The loop mode of the actuator. **type** integer
+
+ .. attribute:: position
+
+ The position of the sound as a list: [x, y, z]. **type** float array
+
+ .. attribute:: velocity
+
+ The velocity of the emitter as a list: [x, y, z]. The relative velocity to the observer determines the pitch. List of 3 floats: [x, y, z]. **type** float array
+
+ .. attribute:: orientation
+
+ The orientation of the sound. When setting the orientation you can also use quaternion [float, float, float, float] or euler angles [float, float, float] **type** 3x3 matrix [[float]]
+
+ .. attribute:: mode
+
+ The operation mode of the actuator. **type** integer
+
+ You can use one of the following constants:
+ * KX_SOUNDACT_PLAYSTOP (1)
+ * KX_SOUNDACT_PLAYEND (2)
+ * KX_SOUNDACT_LOOPSTOP (3)
+ * KX_SOUNDACT_LOOPEND (4)
+ * KX_SOUNDACT_LOOPBIDIRECTIONAL (5)
+ * KX_SOUNDACT_LOOPBIDIRECTIONAL_STOP (6)
+
+.. class:: KX_StateActuator(SCA_IActuator)
+
+ State actuator changes the state mask of parent object.
+
+ Property:
+
+ .. attribute:: operation
+
+ type of bit operation to be applied on object state mask.
+
+ You can use one of the following constant:
+
+ * KX_STATE_OP_CPY (0) : Copy state mask
+ * KX_STATE_OP_SET (1) : Add bits to state mask
+ * KX_STATE_OP_CLR (2) : Substract bits to state mask
+ * KX_STATE_OP_NEG (3) : Invert bits to state mask **type** integer
+
+ .. attribute:: mask
+
+ value that defines the bits that will be modified by the operation.
+ The bits that are 1 in the mask will be updated in the object state,
+ the bits that are 0 are will be left unmodified expect for the Copy operation
+ which copies the mask to the object state **type** integer
+
+.. class:: KX_TrackToActuator(SCA_IActuator)
+
+ Edit Object actuator in Track To mode.
+
+ .. warning:: Track To Actuators will be ignored if at game start, the
+ object to track to is invalid.
+
+ This will generate a warning in the console:
+
+ ``Error: GameObject 'Name' no object in EditObjectActuator 'ActuatorName'``
+
+ .. attribute:: object
+
+ the object this actuator tracks. **type** :class:`KX_GameObject` or None
+
+ .. attribute:: time
+
+ the time in frames with which to delay the tracking motion **type** integer
+
+ .. attribute:: use3D
+
+ the tracking motion to use 3D **type** boolean
+
+.. class:: KX_VehicleWrapper(PyObjectPlus)
+
+ KX_VehicleWrapper
+
+ TODO - description
+
+ .. method:: addWheel(wheel, attachPos, attachDir, axleDir, suspensionRestLength, wheelRadius, hasSteering)
+
+ Add a wheel to the vehicle
+
+ :arg wheel: The object to use as a wheel.
+ :type wheel: :class:`KX_GameObject` or a KX_GameObject name
+ :arg attachPos: The position that this wheel will attach to.
+ :type attachPos: vector of 3 floats
+ :arg attachDir: The direction this wheel points.
+ :type attachDir: vector of 3 floats
+ :arg axleDir: The direction of this wheels axle.
+ :type axleDir: vector of 3 floats
+ :arg suspensionRestLength: TODO - Description
+ :type suspensionRestLength: float
+ :arg wheelRadius: The size of the wheel.
+ :type wheelRadius: float
+
+ .. method:: applyBraking(force, wheelIndex)
+
+ Apply a braking force to the specified wheel
+
+ :arg force: the brake force
+ :type force: float
+
+ :arg wheelIndex: index of the wheel where the force needs to be applied
+ :type wheelIndex: integer
+
+ .. method:: applyEngineForce(force, wheelIndex)
+
+ Apply an engine force to the specified wheel
+
+ :arg force: the engine force
+ :type force: float
+
+ :arg wheelIndex: index of the wheel where the force needs to be applied
+ :type wheelIndex: integer
+
+ .. method:: getConstraintId()
+
+ Get the constraint ID
+
+ :return: the constraint id
+ :rtype: integer
+
+ .. method:: getConstraintType()
+
+ Returns the constraint type.
+
+ :return: constraint type
+ :rtype: integer
+
+ .. method:: getNumWheels()
+
+ Returns the number of wheels.
+
+ :return: the number of wheels for this vehicle
+ :rtype: integer
+
+ .. method:: getWheelOrientationQuaternion(wheelIndex)
+
+ Returns the wheel orientation as a quaternion.
+
+ :arg wheelIndex: the wheel index
+ :type wheelIndex: integer
+
+ :return: TODO Description
+ :rtype: TODO - type should be quat as per method name but from the code it looks like a matrix
+
+ .. method:: getWheelPosition(wheelIndex)
+
+ Returns the position of the specified wheel
+
+ :arg wheelIndex: the wheel index
+ :type wheelIndex: integer
+ :return: position vector
+ :rtype: list[x, y, z]
+
+ .. method:: getWheelRotation(wheelIndex)
+
+ Returns the rotation of the specified wheel
+
+ :arg wheelIndex: the wheel index
+ :type wheelIndex: integer
+
+ :return: the wheel rotation
+ :rtype: float
+
+ .. method:: setRollInfluence(rollInfluece, wheelIndex)
+
+ Set the specified wheel's roll influence.
+ The higher the roll influence the more the vehicle will tend to roll over in corners.
+
+ :arg rollInfluece: the wheel roll influence
+ :type rollInfluece: float
+
+ :arg wheelIndex: the wheel index
+ :type wheelIndex: integer
+
+ .. method:: setSteeringValue(steering, wheelIndex)
+
+ Set the specified wheel's steering
+
+ :arg steering: the wheel steering
+ :type steering: float
+
+ :arg wheelIndex: the wheel index
+ :type wheelIndex: integer
+
+ .. method:: setSuspensionCompression(compression, wheelIndex)
+
+ Set the specified wheel's compression
+
+ :arg compression: the wheel compression
+ :type compression: float
+
+ :arg wheelIndex: the wheel index
+ :type wheelIndex: integer
+
+ .. method:: setSuspensionDamping(damping, wheelIndex)
+
+ Set the specified wheel's damping
+
+ :arg damping: the wheel damping
+ :type damping: float
+
+ :arg wheelIndex: the wheel index
+ :type wheelIndex: integer
+
+ .. method:: setSuspensionStiffness(stiffness, wheelIndex)
+
+ Set the specified wheel's stiffness
+
+ :arg stiffness: the wheel stiffness
+ :type stiffness: float
+
+ :arg wheelIndex: the wheel index
+ :type wheelIndex: integer
+
+ .. method:: setTyreFriction(friction, wheelIndex)
+
+ Set the specified wheel's tyre friction
+
+ :arg friction: the tyre friction
+ :type friction: float
+
+ :arg wheelIndex: the wheel index
+ :type wheelIndex: integer
+
+.. class:: KX_VertexProxy(SCA_IObject)
+
+ A vertex holds position, UV, colour and normal information.
+
+ Note:
+ The physics simulation is NOT currently updated - physics will not respond
+ to changes in the vertex position.
+
+ .. attribute:: XYZ
+
+ The position of the vertex. **type** list [x, y, z]
+
+ .. attribute:: UV
+
+ The texture coordinates of the vertex. **type** list [u, v]
+
+ .. attribute:: normal
+
+ The normal of the vertex **type** list [nx, ny, nz]
+
+ .. attribute:: colour
+
+ The colour of the vertex. **type** list [r, g, b, a]
+
+ Black = [0.0, 0.0, 0.0, 1.0], White = [1.0, 1.0, 1.0, 1.0]
+
+ .. attribute:: color
+
+ Synonym for colour.
+
+ .. attribute:: x
+
+ The x coordinate of the vertex. **type** float
+
+ .. attribute:: y
+
+ The y coordinate of the vertex. **type** float
+
+ .. attribute:: z
+
+ The z coordinate of the vertex. **type** float
+
+ .. attribute:: u
+
+ The u texture coordinate of the vertex. **type** float
+
+ .. attribute:: v
+
+ The v texture coordinate of the vertex. **type** float
+
+ .. attribute:: u2
+
+ The second u texture coordinate of the vertex. **type** float
+
+ .. attribute:: v2
+
+ The second v texture coordinate of the vertex. **type** float
+
+ .. attribute:: r
+
+ The red component of the vertex colour. 0.0 <= r <= 1.0 **type** float
+
+ .. attribute:: g
+
+ The green component of the vertex colour. 0.0 <= g <= 1.0 **type** float
+
+ .. attribute:: b
+
+ The blue component of the vertex colour. 0.0 <= b <= 1.0 **type** float
+
+ .. attribute:: a
+
+ The alpha component of the vertex colour. 0.0 <= a <= 1.0 **type** float
+
+ .. method:: getXYZ()
+
+ Gets the position of this vertex.
+
+ :return: this vertexes position in local coordinates.
+ :rtype: list [x, y, z]
+
+ .. method:: setXYZ(pos)
+
+ Sets the position of this vertex.
+
+ **type** list [x, y, z]
+
+ :arg pos: the new position for this vertex in local coordinates.
+
+ .. method:: getUV()
+
+ Gets the UV (texture) coordinates of this vertex.
+
+ :return: this vertexes UV (texture) coordinates.
+ :rtype: list [u, v]
+
+ .. method:: setUV(uv)
+
+ Sets the UV (texture) coordinates of this vertex.
+
+ **type** list [u, v]
+
+ .. method:: getUV2()
+
+ Gets the 2nd UV (texture) coordinates of this vertex.
+
+ :return: this vertexes UV (texture) coordinates.
+ :rtype: list [u, v]
+
+ .. method:: setUV2(uv, unit)
+
+ Sets the 2nd UV (texture) coordinates of this vertex.
+
+ **type** list [u, v]
+
+ :arg unit: optional argument, FLAT==1, SECOND_UV==2, defaults to SECOND_UV
+ :arg unit: integer
+
+ .. method:: getRGBA()
+
+ Gets the colour of this vertex.
+
+ The colour is represented as four bytes packed into an integer value. The colour is
+ packed as RGBA.
+
+ Since Python offers no way to get each byte without shifting, you must use the struct module to
+ access colour in an machine independent way.
+
+ Because of this, it is suggested you use the r, g, b and a attributes or the colour attribute instead.
+
+ .. code-block:: python
+
+ import struct;
+ col = struct.unpack('4B', struct.pack('I', v.getRGBA()))
+ # col = (r, g, b, a)
+ # black = ( 0, 0, 0, 255)
+ # white = (255, 255, 255, 255)
+
+ :return: packed colour. 4 byte integer with one byte per colour channel in RGBA format.
+ :rtype: integer
+
+ .. method:: setRGBA(col)
+
+ Sets the colour of this vertex.
+
+ See getRGBA() for the format of col, and its relevant problems. Use the r, g, b and a attributes
+ or the colour attribute instead.
+
+ setRGBA() also accepts a four component list as argument col. The list represents the colour as [r, g, b, a]
+ with black = [0.0, 0.0, 0.0, 1.0] and white = [1.0, 1.0, 1.0, 1.0]
+
+ .. code-block:: python
+
+ v.setRGBA(0xff0000ff) # Red
+ v.setRGBA(0xff00ff00) # Green on little endian, transparent purple on big endian
+ v.setRGBA([1.0, 0.0, 0.0, 1.0]) # Red
+ v.setRGBA([0.0, 1.0, 0.0, 1.0]) # Green on all platforms.
+
+ :arg col: the new colour of this vertex in packed RGBA format.
+ :type col: integer or list [r, g, b, a]
+
+ .. method:: getNormal()
+
+ Gets the normal vector of this vertex.
+
+ :return: normalised normal vector.
+ :rtype: list [nx, ny, nz]
+
+ .. method:: setNormal(normal)
+
+ Sets the normal vector of this vertex.
+
+ **type** sequence of floats [r, g, b]
+
+ :arg normal: the new normal of this vertex.
+
+.. class:: KX_VisibilityActuator(SCA_IActuator)
+
+ Visibility Actuator.
+
+ .. attribute:: visibility
+
+ whether the actuator makes its parent object visible or invisible **type** boolean
+
+ .. attribute:: useOcclusion
+
+ whether the actuator makes its parent object an occluder or not **type** boolean
+
+ .. attribute:: useRecursion
+
+ whether the visibility/occlusion should be propagated to all children of the object **type** boolean
+
+.. class:: SCA_2DFilterActuator(SCA_IActuator)
+
+ Create, enable and disable 2D filters
+
+ Properties:
+
+ The following properties don't have an immediate effect.
+ You must active the actuator to get the result.
+ The actuator is not persistent: it automatically stops itself after setting up the filter
+ but the filter remains active. To stop a filter you must activate the actuator with 'type'
+ set to RAS_2DFILTER_DISABLED or RAS_2DFILTER_NOFILTER.
+
+ .. attribute:: shaderText
+
+ shader source code for custom shader **type** string
+
+ .. attribute:: disableMotionBlur
+
+ action on motion blur: 0=enable, 1=disable **type** integer
+
+ .. attribute:: mode
+
+ type of 2D filter, use one of the following constants:
+
+ * RAS_2DFILTER_ENABLED (-2) : enable the filter that was previously disabled
+ * RAS_2DFILTER_DISABLED (-1) : disable the filter that is currently active
+ * RAS_2DFILTER_NOFILTER (0) : disable and destroy the filter that is currently active
+ * RAS_2DFILTER_MOTIONBLUR (1) : create and enable preset filters
+ * RAS_2DFILTER_BLUR (2)
+ * RAS_2DFILTER_SHARPEN (3)
+ * RAS_2DFILTER_DILATION (4)
+ * RAS_2DFILTER_EROSION (5)
+ * RAS_2DFILTER_LAPLACIAN (6)
+ * RAS_2DFILTER_SOBEL (7)
+ * RAS_2DFILTER_PREWITT (8)
+ * RAS_2DFILTER_GRAYSCALE (9)
+ * RAS_2DFILTER_SEPIA (10)
+ * RAS_2DFILTER_INVERT (11)
+ * RAS_2DFILTER_CUSTOMFILTER (12) : customer filter, the code code is set via shaderText property **type** integer
+
+ .. attribute:: passNumber
+
+ order number of filter in the stack of 2D filters. Filters are executed in increasing order of passNb.
+
+ Only be one filter can be defined per passNb. **type** integer (0-100)
+
+ .. attribute:: value
+
+ argument for motion blur filter **type** float (0.0-100.0)
+
+.. class:: SCA_ANDController(SCA_IController)
+
+ An AND controller activates only when all linked sensors are activated.
+
+ There are no special python methods for this controller.
+
+.. class:: SCA_ActuatorSensor(SCA_ISensor)
+
+ Actuator sensor detect change in actuator state of the parent object.
+ It generates a positive pulse if the corresponding actuator is activated
+ and a negative pulse if the actuator is deactivated.
+
+ Properties:
+
+ .. attribute:: actuator
+
+ the name of the actuator that the sensor is monitoring. **type** string
+
+.. class:: SCA_AlwaysSensor(SCA_ISensor)
+
+ This sensor is always activated.
+
+.. class:: SCA_DelaySensor(SCA_ISensor)
+
+ The Delay sensor generates positive and negative triggers at precise time,
+ expressed in number of frames. The delay parameter defines the length of the initial OFF period. A positive trigger is generated at the end of this period.
+
+ The duration parameter defines the length of the ON period following the OFF period.
+ There is a negative trigger at the end of the ON period. If duration is 0, the sensor stays ON and there is no negative trigger.
+
+ The sensor runs the OFF-ON cycle once unless the repeat option is set: the OFF-ON cycle repeats indefinately (or the OFF cycle if duration is 0).
+
+ Use :class:`SCA_ISensor.reset` at any time to restart sensor.
+
+ Properties:
+
+ .. attribute:: delay
+
+ length of the initial OFF period as number of frame, 0 for immediate trigger. **type** integer.
+
+ .. attribute:: duration
+
+ length of the ON period in number of frame after the initial OFF period.
+
+ If duration is greater than 0, a negative trigger is sent at the end of the ON pulse. **type** integer
+
+ .. attribute:: repeat
+
+ 1 if the OFF-ON cycle should be repeated indefinately, 0 if it should run once. **type** integer
+
+.. class:: SCA_JoystickSensor(SCA_ISensor)
+
+ This sensor detects player joystick events.
+
+ Properties:
+
+ .. attribute:: axisValues
+
+ The state of the joysticks axis as a list of values :data:`numAxis` long. (read-only). **type** list of ints.
+
+ Each spesifying the value of an axis between -32767 and 32767 depending on how far the axis is pushed, 0 for nothing.
+ The first 2 values are used by most joysticks and gamepads for directional control. 3rd and 4th values are only on some joysticks and can be used for arbitary controls.
+
+ * left:[-32767, 0, ...]
+ * right:[32767, 0, ...]
+ * up:[0, -32767, ...]
+ * down:[0, 32767, ...]
+
+ .. attribute:: axisSingle
+
+ like :data:`axisValues` but returns a single axis value that is set by the sensor. (read-only). **type** integer
+
+ .. note:: only use this for "Single Axis" type sensors otherwise it will raise an error.
+
+ .. attribute:: hatValues
+
+ The state of the joysticks hats as a list of values :data:`numHats` long. (read-only) **type** list of ints
+
+ Each spesifying the direction of the hat from 1 to 12, 0 when inactive.
+
+ Hat directions are as follows...
+
+ * 0:None
+ * 1:Up
+ * 2:Right
+ * 4:Down
+ * 8:Left
+ * 3:Up - Right
+ * 6:Down - Right
+ * 12:Down - Left
+ * 9:Up - Left
+
+ .. attribute:: hatSingle
+
+ Like :data:`hatValues` but returns a single hat direction value that is set by the sensor. (read-only). **type** integer
+
+ .. attribute:: numAxis
+
+ The number of axes for the joystick at this index. (read-only). **type** integer
+
+ .. attribute:: numButtons
+
+ The number of buttons for the joystick at this index. (read-only). **type** integer
+
+ .. attribute:: numHats
+
+ The number of hats for the joystick at this index. (read-only). **type** integer
+
+ .. attribute:: connected
+
+ True if a joystick is connected at this joysticks index. (read-only). **type** boolean
+
+ .. attribute:: index
+
+ The joystick index to use (from 0 to 7). The first joystick is always 0. **type** integer
+
+ .. attribute:: threshold
+
+ Axis threshold. Joystick axis motion below this threshold wont trigger an event. Use values between (0 and 32767), lower values are more sensitive. **type** integer
+
+ .. attribute:: button
+
+ The button index the sensor reacts to (first button = 0). When the "All Events" toggle is set, this option has no effect. **type** integer
+
+ .. attribute:: axis
+
+ The axis this sensor reacts to, as a list of two values [axisIndex, axisDirection]
+
+ * axisIndex: the axis index to use when detecting axis movement, 1=primary directional control, 2=secondary directional control.
+ * axisDirection: 0=right, 1=up, 2=left, 3=down. **type** [integer, integer]
+
+ .. attribute:: hat
+
+ The hat the sensor reacts to, as a list of two values: [hatIndex, hatDirection]
+
+ * hatIndex: the hat index to use when detecting hat movement, 1=primary hat, 2=secondary hat (4 max).
+ * hatDirection: 1-12 **type** [integer, integer]
+
+ .. method:: getButtonActiveList()
+
+ :return: A list containing the indicies of the currently pressed buttons.
+ :rtype: list
+
+ .. method:: getButtonStatus(buttonIndex)
+
+ :arg buttonIndex: the button index, 0=first button
+ :type buttonIndex: integer
+ :return: The current pressed state of the specified button.
+ :rtype: boolean
+
+.. class:: SCA_KeyboardSensor(SCA_ISensor)
+
+ A keyboard sensor detects player key presses.
+
+ See module :mod:`bge.keys` for keycode values.
+
+ .. attribute:: key
+
+ The key code this sensor is looking for. **type** keycode from :mod:`bge.keys` module
+
+ .. attribute:: hold1
+
+ The key code for the first modifier this sensor is looking for. **type** keycode from :mod:`bge.keys` module
+
+ .. attribute:: hold2
+
+ The key code for the second modifier this sensor is looking for. **type** keycode from :mod:`bge.keys` module
+
+ .. attribute:: toggleProperty
+
+ The name of the property that indicates whether or not to log keystrokes as a string. **type** string
+
+ .. attribute:: targetProperty
+
+ The name of the property that receives keystrokes in case in case a string is logged. **type** string
+
+ .. attribute:: useAllKeys
+
+ Flag to determine whether or not to accept all keys. **type** boolean
+
+ .. attribute:: events
+
+ a list of pressed keys that have either been pressed, or just released, or are active this frame. (read-only). **type** list [[keycode, status], ...]
+
+ * 'keycode' matches the values in :mod:`bge.keys`.
+ * 'status' uses...
+
+ * :mod:`bge.logic.KX_INPUT_NONE`
+ * :mod:`bge.logic.KX_INPUT_JUST_ACTIVATED`
+ * :mod:`bge.logic.KX_INPUT_ACTIVE`
+ * :mod:`bge.logic.KX_INPUT_JUST_RELEASED`
+
+ .. method:: getKeyStatus(keycode)
+
+ Get the status of a key.
+
+ :arg keycode: The code that represents the key you want to get the state of
+ :type keycode: integer
+ :return: The state of the given key
+ :rtype: key state :mod:`bge.logic` members (KX_INPUT_NONE, KX_INPUT_JUST_ACTIVATED, KX_INPUT_ACTIVE, KX_INPUT_JUST_RELEASED)
+
+.. class:: SCA_NANDController(SCA_IController)
+
+ An NAND controller activates when all linked sensors are not active.
+
+ There are no special python methods for this controller.
+
+.. class:: SCA_NORController(SCA_IController)
+
+ An NOR controller activates only when all linked sensors are de-activated.
+
+ There are no special python methods for this controller.
+
+.. class:: SCA_ORController(SCA_IController)
+
+ An OR controller activates when any connected sensor activates.
+
+ There are no special python methods for this controller.
+
+.. class:: SCA_PropertyActuator(SCA_IActuator)
+
+ Property Actuator
+
+ Properties:
+
+ .. attribute:: propName
+
+ the property on which to operate. **type** string
+
+ .. attribute:: value
+
+ the value with which the actuator operates. **type** string
+
+ .. attribute:: mode
+
+ TODO - add constants to game logic dict!. **type** integer
+
+.. class:: SCA_PropertySensor(SCA_ISensor)
+
+ Activates when the game object property matches.
+
+ Properties:
+
+ .. attribute:: mode
+
+ Type of check on the property. **type** integer
+
+ * KX_PROPSENSOR_EQUAL(1)
+ * KX_PROPSENSOR_NOTEQUAL(2)
+ * KX_PROPSENSOR_INTERVAL(3)
+ * KX_PROPSENSOR_CHANGED(4)
+ * KX_PROPSENSOR_EXPRESSION(5)
+
+ .. attribute:: propName
+
+ the property the sensor operates. **type** string
+
+ .. attribute:: value
+
+ the value with which the sensor compares to the value of the property. **type** string
+
+ .. attribute:: min
+
+ the minimum value of the range used to evaluate the property when in interval mode. **type** string
+
+ .. attribute:: max
+
+ the maximum value of the range used to evaluate the property when in interval mode. **type** string
+
+.. class:: SCA_PythonController(SCA_IController)
+
+ A Python controller uses a Python script to activate it's actuators,
+ based on it's sensors.
+
+ Properties:
+
+ .. attribute:: script
+
+ The value of this variable depends on the execution methid.
+
+ * When 'Script' execution mode is set this value contains the entire python script as a single string (not the script name as you might expect) which can be modified to run different scripts.
+ * When 'Module' execution mode is set this value will contain a single line string - module name and function "module.func" or "package.modile.func" where the module names are python textblocks or external scripts.
+
+ .. note:: once this is set the script name given for warnings will remain unchanged. **type** string
+
+ .. attribute:: mode
+
+ the execution mode for this controller (read-only).
+
+ * Script: 0, Execite the :data:`script` as a python code.
+ * Module: 1, Execite the :data:`script` as a module and function. **type** integer
+
+ .. method:: activate(actuator)
+
+ Activates an actuator attached to this controller.
+
+ :arg actuator: The actuator to operate on.
+ :type actuator: actuator or the actuator name as a string
+
+ .. method:: deactivate(actuator)
+
+ Deactivates an actuator attached to this controller.
+
+ :arg actuator: The actuator to operate on.
+ :type actuator: actuator or the actuator name as a string
+
+.. class:: SCA_RandomActuator(SCA_IActuator)
+
+ Random Actuator
+
+ Properties:
+
+ .. attribute:: seed
+
+ Seed of the random number generator. **type** integer.
+
+ Equal seeds produce equal series. If the seed is 0, the generator will produce the same value on every call.
+
+ .. attribute:: para1
+
+ the first parameter of the active distribution. **type** float, read-only.
+
+ Refer to the documentation of the generator types for the meaning of this value.
+
+ .. attribute:: para2
+
+ the second parameter of the active distribution. **type** float, read-only
+
+ Refer to the documentation of the generator types for the meaning of this value.
+
+ .. attribute:: distribution
+
+ distribution type. (read-only). **type** integer
+
+ * KX_RANDOMACT_BOOL_CONST
+ * KX_RANDOMACT_BOOL_UNIFORM
+ * KX_RANDOMACT_BOOL_BERNOUILLI
+ * KX_RANDOMACT_INT_CONST
+ * KX_RANDOMACT_INT_UNIFORM
+ * KX_RANDOMACT_INT_POISSON
+ * KX_RANDOMACT_FLOAT_CONST
+ * KX_RANDOMACT_FLOAT_UNIFORM
+ * KX_RANDOMACT_FLOAT_NORMAL
+ * KX_RANDOMACT_FLOAT_NEGATIVE_EXPONENTIAL
+
+ .. attribute:: propName
+
+ the name of the property to set with the random value. **type** string
+
+ If the generator and property types do not match, the assignment is ignored.
+
+ .. method:: setBoolConst(value)
+
+ Sets this generator to produce a constant boolean value.
+
+ :arg value: The value to return.
+ :type value: boolean
+
+ .. method:: setBoolUniform()
+
+ Sets this generator to produce a uniform boolean distribution.
+
+ The generator will generate True or False with 50% chance.
+
+ .. method:: setBoolBernouilli(value)
+
+ Sets this generator to produce a Bernouilli distribution.
+
+ :arg value: Specifies the proportion of False values to produce.
+
+ * 0.0: Always generate True
+ * 1.0: Always generate False
+ :type value: float
+
+ .. method:: setIntConst(value)
+
+ Sets this generator to always produce the given value.
+
+ :arg value: the value this generator produces.
+ :type value: integer
+
+ .. method:: setIntUniform(lower_bound, upper_bound)
+
+ Sets this generator to produce a random value between the given lower and
+ upper bounds (inclusive).
+
+ :type lower_bound: integer
+ :type upper_bound: integer
+
+ .. method:: setIntPoisson(value)
+
+ Generate a Poisson-distributed number.
+
+ This performs a series of Bernouilli tests with parameter value.
+ It returns the number of tries needed to achieve succes.
+
+ :type value: float
+
+ .. method:: setFloatConst(value)
+
+ Always generate the given value.
+
+ :type value: float
+
+ .. method:: setFloatUniform(lower_bound, upper_bound)
+
+ Generates a random float between lower_bound and upper_bound with a
+ uniform distribution.
+
+ :type lower_bound: float
+ :type upper_bound: float
+
+ .. method:: setFloatNormal(mean, standard_deviation)
+
+ Generates a random float from the given normal distribution.
+
+ :arg mean: The mean (average) value of the generated numbers
+ :type mean: float
+ :arg standard_deviation: The standard deviation of the generated numbers.
+ :type standard_deviation: float
+
+ .. method:: setFloatNegativeExponential(half_life)
+
+ Generate negative-exponentially distributed numbers.
+
+ The half-life 'time' is characterized by half_life.
+
+ :type half_life: float
+
+.. class:: SCA_RandomSensor(SCA_ISensor)
+
+ This sensor activates randomly.
+
+ .. attribute:: lastDraw
+
+ The seed of the random number generator. **type** integer
+
+ .. attribute:: seed
+
+ The seed of the random number generator. **type** integer
+
+ .. method:: setSeed(seed)
+
+ Sets the seed of the random number generator.
+
+ If the seed is 0, the generator will produce the same value on every call.
+
+ :type seed: integer
+
+ .. method:: getSeed()
+
+ :return: The initial seed of the generator. Equal seeds produce equal random series.
+ :rtype: integer
+
+ .. method:: getLastDraw()
+
+ :return: The last random number generated.
+ :rtype: integer
+
+.. class:: SCA_XNORController(SCA_IController)
+
+ An XNOR controller activates when all linked sensors are the same (activated or inative).
+
+ There are no special python methods for this controller.
+
+.. class:: SCA_XORController(SCA_IController)
+
+ An XOR controller activates when there is the input is mixed, but not when all are on or off.
+
+ There are no special python methods for this controller.
+
+.. class:: KX_Camera(KX_GameObject)
+
+ A Camera object.
+
+ .. attribute:: INSIDE
+
+ see :data:`sphereInsideFrustum` and :data:`boxInsideFrustum`
+
+ .. attribute:: INTERSECT
+
+ see :data:`sphereInsideFrustum` and :data:`boxInsideFrustum`
+
+ .. attribute:: OUTSIDE
+
+ see :data:`sphereInsideFrustum` and :data:`boxInsideFrustum`
+
+ .. attribute:: lens
+
+ The camera's lens value. **type** float
+
+ .. attribute:: near
+
+ The camera's near clip distance. **type** float
+
+ .. attribute:: far
+
+ The camera's far clip distance. **type** float
+
+ .. attribute:: perspective
+
+ True if this camera has a perspective transform, False for an orthographic projection. **type** boolean
+
+ .. attribute:: frustum_culling
+
+ True if this camera is frustum culling. **type** boolean
+
+ .. attribute:: projection_matrix
+
+ This camera's 4x4 projection matrix. **type** 4x4 Matrix [[float]]
+
+ .. attribute:: modelview_matrix
+
+ This camera's 4x4 model view matrix. (read-only). **type** 4x4 Matrix [[float]]
+
+ .. note:: This matrix is regenerated every frame from the camera's position and orientation.
+
+ .. attribute:: camera_to_world
+
+ This camera's camera to world transform. (read-only). **type** 4x4 Matrix [[float]]
+
+ .. note:: This matrix is regenerated every frame from the camera's position and orientation.
+
+ .. attribute:: world_to_camera
+
+ This camera's world to camera transform. (read-only). **type** 4x4 Matrix [[float]]
+
+ .. note:: Regenerated every frame from the camera's position and orientation.
+ .. note:: This is camera_to_world inverted.
+
+ .. attribute:: useViewport
+
+ True when the camera is used as a viewport, set True to enable a viewport for this camera. **type** boolean
+
+ .. method:: sphereInsideFrustum(centre, radius)
+
+ Tests the given sphere against the view frustum.
+
+ :arg centre: The centre of the sphere (in world coordinates.)
+ :type centre: list [x, y, z]
+ :arg radius: the radius of the sphere
+ :type radius: float
+ :return: INSIDE, OUTSIDE or INTERSECT
+ :rtype: integer
+
+ .. code-block:: python
+
+ import GameLogic
+ co = GameLogic.getCurrentController()
+ cam = co.owner
+
+ # A sphere of radius 4.0 located at [x, y, z] = [1.0, 1.0, 1.0]
+ if (cam.sphereInsideFrustum([1.0, 1.0, 1.0], 4) != cam.OUTSIDE):
+ # Sphere is inside frustum !
+ # Do something useful !
+ else:
+ # Sphere is outside frustum
+
+ .. note:: when the camera is first initialized the result will be invalid because the projection matrix has not been set.
+
+ .. method:: boxInsideFrustum(box)
+
+ Tests the given box against the view frustum.
+
+ .. code-block:: python
+
+ import GameLogic
+ co = GameLogic.getCurrentController()
+ cam = co.owner
+
+ # Box to test...
+ box = []
+ box.append([-1.0, -1.0, -1.0])
+ box.append([-1.0, -1.0, 1.0])
+ box.append([-1.0, 1.0, -1.0])
+ box.append([-1.0, 1.0, 1.0])
+ box.append([ 1.0, -1.0, -1.0])
+ box.append([ 1.0, -1.0, 1.0])
+ box.append([ 1.0, 1.0, -1.0])
+ box.append([ 1.0, 1.0, 1.0])
+
+ if (cam.boxInsideFrustum(box) != cam.OUTSIDE):
+ # Box is inside/intersects frustum !
+ # Do something useful !
+ else:
+ # Box is outside the frustum !
+
+ :arg box: Eight (8) corner points of the box (in world coordinates.)
+ :type box: list of lists
+ :return: INSIDE, OUTSIDE or INTERSECT
+
+ .. note:: when the camera is first initialized the result will be invalid because the projection matrix has not been set.
+
+ .. method:: pointInsideFrustum(point)
+
+ Tests the given point against the view frustum.
+
+ .. code-block:: python
+
+ import GameLogic
+ co = GameLogic.getCurrentController()
+ cam = co.owner
+
+ # Test point [0.0, 0.0, 0.0]
+ if (cam.pointInsideFrustum([0.0, 0.0, 0.0])):
+ # Point is inside frustum !
+ # Do something useful !
+ else:
+ # Box is outside the frustum !
+
+ :arg point: The point to test (in world coordinates.)
+ :type point: 3D Vector
+ :return: True if the given point is inside this camera's viewing frustum.
+ :rtype: boolean
+
+ .. note:: when the camera is first initialized the result will be invalid because the projection matrix has not been set.
+
+ .. method:: getCameraToWorld()
+
+ Returns the camera-to-world transform.
+
+ :return: the camera-to-world transform matrix.
+ :rtype: matrix (4x4 list)
+
+ .. method:: getWorldToCamera()
+
+ Returns the world-to-camera transform.
+
+ This returns the inverse matrix of getCameraToWorld().
+
+ :return: the world-to-camera transform matrix.
+ :rtype: matrix (4x4 list)
+
+ .. method:: setOnTop()
+
+ Set this cameras viewport ontop of all other viewport.
+
+ .. method:: setViewport(left, bottom, right, top)
+
+ Sets the region of this viewport on the screen in pixels.
+
+ Use :data:`bge.render.getWindowHeight` and :data:`bge.render.getWindowWidth` to calculate values relative to the entire display.
+
+ :arg left: left pixel coordinate of this viewport
+ :type left: integer
+ :arg bottom: bottom pixel coordinate of this viewport
+ :type bottom: integer
+ :arg right: right pixel coordinate of this viewport
+ :type right: integer
+ :arg top: top pixel coordinate of this viewport
+ :type top: integer
+
+ .. method:: getScreenPosition(object)
+
+ Gets the position of an object projected on screen space.
+
+ .. code-block:: python
+
+ # For an object in the middle of the screen, coord = [0.5, 0.5]
+ coord = camera.getScreenPosition(object)
+
+ :arg object: object name or list [x, y, z]
+ :type object: :class:`KX_GameObject` or 3D Vector
+ :return: the object's position in screen coordinates.
+ :rtype: list [x, y]
+
+ .. method:: getScreenVect(x, y)
+
+ Gets the vector from the camera position in the screen coordinate direction.
+
+ .. code-block:: python
+
+ # Gets the vector of the camera front direction:
+ m_vect = camera.getScreenVect(0.5, 0.5)
+
+
+ :arg x: X Axis
+ :type x: float
+ :arg y: Y Axis
+ :type y: float
+ :rtype: 3D Vector
+ :return: The vector from screen coordinate.
+
+ .. method:: getScreenRay(x, y, dist=inf, property=None)
+
+ Look towards a screen coordinate (x, y) and find first object hit within dist that matches prop.
+ The ray is similar to KX_GameObject->rayCastTo.
+
+ .. code-block:: python
+
+ # Gets an object with a property "wall" in front of the camera within a distance of 100:
+ target = camera.getScreenRay(0.5, 0.5, 100, "wall")
+
+ :arg x: X Axis
+ :type x: float
+ :arg y: Y Axis
+ :type y: float
+ :arg dist: max distance to look (can be negative => look behind); 0 or omitted => detect up to other
+ :type dist: float
+ :arg property: property name that object must have; can be omitted => detect any object
+ :type property: string
+ :rtype: :class:`KX_GameObject`
+ :return: the first object hit or None if no object or object does not match prop
+
+.. class:: BL_ArmatureObject(KX_GameObject)
+
+ An armature object.
+
+ .. attribute:: constraints
+
+ The list of armature constraint defined on this armature.
+ Elements of the list can be accessed by index or string.
+ The key format for string access is '<bone_name>:<constraint_name>' **type** list of :class:`BL_ArmatureConstraint`
+
+ .. attribute:: channels
+
+ The list of armature channels.
+ Elements of the list can be accessed by index or name the bone. **type** list of :class:`BL_ArmatureChannel`
+
+ .. method:: update()
+
+ Ensures that the armature will be updated on next graphic frame.
+
+ This action is unecessary if a KX_ArmatureActuator with mode run is active
+ or if an action is playing. Use this function in other cases. It must be called
+ on each frame to ensure that the armature is updated continously.
+
+.. class:: BL_ArmatureActuator(SCA_IActuator)
+
+ Armature Actuators change constraint condition on armatures.
+
+ .. attribute:: KX_ACT_ARMATURE_RUN
+
+ see type
+
+ .. attribute:: KX_ACT_ARMATURE_ENABLE
+
+ see type
+
+ .. attribute:: KX_ACT_ARMATURE_DISABLE
+
+ see type
+
+ .. attribute:: KX_ACT_ARMATURE_SETTARGET
+
+ see type
+
+ .. attribute:: KX_ACT_ARMATURE_SETWEIGHT
+
+ see type
+
+ .. attribute:: type
+
+ The type of action that the actuator executes when it is active.
+
+ * KX_ACT_ARMATURE_RUN(0) just make sure the armature will be updated on the next graphic frame. This is the only persistent mode of the actuator: it executes automatically once per frame until stopped by a controller
+ * KX_ACT_ARMATURE_ENABLE(1) enable the constraint.
+ * KX_ACT_ARMATURE_DISABLE(2) disable the constraint (runtime constraint values are not updated).
+ * KX_ACT_ARMATURE_SETTARGET(3) change target and subtarget of constraint.
+ * KX_ACT_ARMATURE_SETWEIGHT(4) change weight of (only for IK constraint). **type** integer
+
+ .. attribute:: constraint
+
+ The constraint object this actuator is controlling. **type** :class:`BL_ArmatureConstraint`
+
+ .. attribute:: target
+
+ The object that this actuator will set as primary target to the constraint it controls **type** :class:`KX_GameObject`
+
+ .. attribute:: subtarget
+
+ The object that this actuator will set as secondary target to the constraint it controls. **type** :class:`KX_GameObject`.
+
+ .. note:: Currently, the only secondary target is the pole target for IK constraint.
+
+ .. attribute:: weight
+
+ The weight this actuator will set on the constraint it controls. **type** float.
+
+ .. note:: Currently only the IK constraint has a weight. It must be a value between 0 and 1.
+
+ .. note:: A weight of 0 disables a constraint while still updating constraint runtime values (see :class:`BL_ArmatureConstraint`)
+
+.. class:: KX_ArmatureSensor(SCA_ISensor)
+
+ Armature sensor detect conditions on armatures.
+
+ See :data:`type`
+
+ .. data:: KX_ARMSENSOR_STATE_CHANGED
+ .. data:: KX_ARMSENSOR_LIN_ERROR_BELOW
+ .. data:: KX_ARMSENSOR_LIN_ERROR_ABOVE
+ .. data:: KX_ARMSENSOR_ROT_ERROR_BELOW
+ .. data:: KX_ARMSENSOR_ROT_ERROR_ABOVE
+
+ .. attribute:: type
+
+ The type of measurement that the sensor make when it is active. **type** integer.
+
+ * KX_ARMSENSOR_STATE_CHANGED(0) detect that the constraint is changing state (active/inactive)
+ * KX_ARMSENSOR_LIN_ERROR_BELOW(1) detect that the constraint linear error is above a threshold
+ * KX_ARMSENSOR_LIN_ERROR_ABOVE(2) detect that the constraint linear error is below a threshold
+ * KX_ARMSENSOR_ROT_ERROR_BELOW(3) detect that the constraint rotation error is above a threshold
+ * KX_ARMSENSOR_ROT_ERROR_ABOVE(4) detect that the constraint rotation error is below a threshold
+
+ .. attribute:: constraint
+
+ The constraint object this sensor is watching. **type** :class:`BL_ArmatureConstraint`
+
+ .. attribute:: value
+
+ **type** float
+
+ The threshold used in the comparison with the constraint error
+ The linear error is only updated on CopyPose/Distance IK constraint with iTaSC solver
+ The rotation error is only updated on CopyPose+rotation IK constraint with iTaSC solver
+ The linear error on CopyPose is always >= 0: it is the norm of the distance between the target and the bone
+ The rotation error on CopyPose is always >= 0: it is the norm of the equivalent rotation vector between the bone and the target orientations
+ The linear error on Distance can be positive if the distance between the bone and the target is greater than the desired distance, and negative if the distance is smaller.
+
+.. class:: BL_ArmatureConstraint(PyObjectPlus)
+
+ Proxy to Armature Constraint. Allows to change constraint on the fly.
+ Obtained through :class:`BL_ArmatureObject`.constraints.
+
+ .. note:: not all armature constraints are supported in the GE.
+
+
+ Constants related to see :data:`type`
+
+ .. data:: CONSTRAINT_TYPE_TRACKTO
+ .. data:: CONSTRAINT_TYPE_KINEMATIC
+ .. data:: CONSTRAINT_TYPE_ROTLIKE
+ .. data:: CONSTRAINT_TYPE_LOCLIKE
+ .. data:: CONSTRAINT_TYPE_MINMAX
+ .. data:: CONSTRAINT_TYPE_SIZELIKE
+ .. data:: CONSTRAINT_TYPE_LOCKTRACK
+ .. data:: CONSTRAINT_TYPE_STRETCHTO
+ .. data:: CONSTRAINT_TYPE_CLAMPTO
+ .. data:: CONSTRAINT_TYPE_TRANSFORM
+ .. data:: CONSTRAINT_TYPE_DISTLIMIT
+
+
+ Constants related to see :data:`ik_type`
+
+ .. data:: CONSTRAINT_IK_COPYPOSE
+ .. data:: CONSTRAINT_IK_DISTANCE
+ .. data:: CONSTRAINT_IK_MODE_INSIDE
+ .. data:: CONSTRAINT_IK_MODE_OUTSIDE
+ .. data:: CONSTRAINT_IK_MODE_ONSURFACE
+ .. data:: CONSTRAINT_IK_FLAG_TIP
+ .. data:: CONSTRAINT_IK_FLAG_ROT
+ .. data:: CONSTRAINT_IK_FLAG_STRETCH
+ .. data:: CONSTRAINT_IK_FLAG_POS
+
+ .. attribute:: type
+
+ Type of constraint, (read-only) **type** integer, one of CONSTRAINT_TYPE_* constants
+
+ .. attribute:: name
+
+ Name of constraint constructed as <bone_name>:<constraint_name>. constraints list **type** string
+
+ This name is also the key subscript on :class:`BL_ArmatureObject`.
+
+ .. attribute:: enforce
+
+ fraction of constraint effect that is enforced. Between 0 and 1. **type** float
+
+ .. attribute:: headtail
+
+ Position of target between head and tail of the target bone: 0=head, 1=tail. **type** float.
+
+ .. note:: Only used if the target is a bone (i.e target object is an armature.
+
+ .. attribute:: lin_error
+
+ runtime linear error (in Blender units) on constraint at the current frame.
+
+ This is a runtime value updated on each frame by the IK solver. Only available on IK constraint and iTaSC solver. **type** float
+
+ .. attribute:: rot_error
+
+ Runtime rotation error (in radiant) on constraint at the current frame. **type** float.
+
+ This is a runtime value updated on each frame by the IK solver. Only available on IK constraint and iTaSC solver.
+
+ It is only set if the constraint has a rotation part, for example, a CopyPose+Rotation IK constraint.
+
+ .. attribute:: target
+
+ Primary target object for the constraint. The position of this object in the GE will be used as target for the constraint. **type** :class:`KX_GameObject`.
+
+ .. attribute:: subtarget
+
+ Secondary target object for the constraint. The position of this object in the GE will be used as secondary target for the constraint. **type** :class:`KX_GameObject`.
+
+ Currently this is only used for pole target on IK constraint.
+
+ .. attribute:: active
+
+ True if the constraint is active.
+
+ .. note:: an inactive constraint does not update lin_error and rot_error. **type** boolean
+
+ .. attribute:: ik_weight
+
+ Weight of the IK constraint between 0 and 1.
+
+ Only defined for IK constraint. **type** float
+
+ .. attribute:: ik_type
+
+ Type of IK constraint, (read-only). **type** integer.
+
+ * CONSTRAINT_IK_COPYPOSE(0) constraint is trying to match the position and eventually the rotation of the target.
+ * CONSTRAINT_IK_DISTANCE(1) constraint is maintaining a certain distance to target subject to ik_mode
+
+ .. attribute:: ik_flag
+
+ Combination of IK constraint option flags, read-only
+
+ * CONSTRAINT_IK_FLAG_TIP(1) : set when the constraint operates on the head of the bone and not the tail
+ * CONSTRAINT_IK_FLAG_ROT(2) : set when the constraint tries to match the orientation of the target
+ * CONSTRAINT_IK_FLAG_STRETCH(16) : set when the armature is allowed to stretch (only the bones with stretch factor > 0.0)
+ * CONSTRAINT_IK_FLAG_POS(32) : set when the constraint tries to match the position of the target **type** integer
+
+ .. attribute:: ik_dist
+
+ Distance the constraint is trying to maintain with target, only used when ik_type=CONSTRAINT_IK_DISTANCE **type** float
+
+ .. attribute:: ik_mode
+
+ Additional mode for IK constraint. Currently only used for Distance constraint:
+
+ * CONSTRAINT_IK_MODE_INSIDE(0) : the constraint tries to keep the bone within ik_dist of target
+ * CONSTRAINT_IK_MODE_OUTSIDE(1) : the constraint tries to keep the bone outside ik_dist of the target
+ * CONSTRAINT_IK_MODE_ONSURFACE(2) : the constraint tries to keep the bone exactly at ik_dist of the target **type** integer
+
+.. class:: BL_ArmatureChannel(PyObjectPlus)
+
+ Proxy to armature pose channel. Allows to read and set armature pose.
+ The attributes are identical to RNA attributes, but mostly in read-only mode.
+
+ See :data:`rotation_mode`
+
+ .. data:: PCHAN_ROT_QUAT
+ .. data:: PCHAN_ROT_XYZ
+ .. data:: PCHAN_ROT_XZY
+ .. data:: PCHAN_ROT_YXZ
+ .. data:: PCHAN_ROT_YZX
+ .. data:: PCHAN_ROT_ZXY
+ .. data:: PCHAN_ROT_ZYX
+
+ .. attribute:: name
+
+ channel name (=bone name), read-only. **type** string
+
+ .. attribute:: bone
+
+ return the bone object corresponding to this pose channel, read-only. **type** :class:`BL_ArmatureBone`
+
+ .. attribute:: parent
+
+ return the parent channel object, None if root channel, read-only. **type** :class:`BL_ArmatureChannel`
+
+ .. attribute:: has_ik
+
+ true if the bone is part of an active IK chain, read-only.
+ This flag is not set when an IK constraint is defined but not enabled (miss target information for example) **type** boolean
+
+ .. attribute:: ik_dof_x
+
+ true if the bone is free to rotation in the X axis, read-only. **type** boolean
+
+ .. attribute:: ik_dof_y
+
+ true if the bone is free to rotation in the Y axis, read-only. **type** boolean
+
+ .. attribute:: ik_dof_z
+
+ true if the bone is free to rotation in the Z axis, read-only. **type** boolean
+
+ .. attribute:: ik_limit_x
+
+ true if a limit is imposed on X rotation, read-only. **type** boolean
+
+ .. attribute:: ik_limit_y
+
+ true if a limit is imposed on Y rotation, read-only. **type** boolean
+
+ .. attribute:: ik_limit_z
+
+ true if a limit is imposed on Z rotation, read-only. **type** boolean
+
+ .. attribute:: ik_rot_control
+
+ true if channel rotation should applied as IK constraint, read-only. **type** boolean
+
+ .. attribute:: ik_lin_control
+
+ true if channel size should applied as IK constraint, read-only. **type** boolean
+
+ .. attribute:: location
+
+ displacement of the bone head in armature local space, read-write. **type** vector [X, Y, Z].
+
+ .. note:: You can only move a bone if it is unconnected to its parent. An action playing on the armature may change the value. An IK chain does not update this value, see joint_rotation.
+ .. note:: Changing this field has no immediate effect, the pose is updated when the armature is updated during the graphic render (see :data:`BL_ArmatureObject.update`).
+
+ .. attribute:: scale
+
+ scale of the bone relative to its parent, read-write. **type** vector [sizeX, sizeY, sizeZ].
+
+ .. note:: An action playing on the armature may change the value. An IK chain does not update this value, see joint_rotation.
+ .. note:: Changing this field has no immediate effect, the pose is updated when the armature is updated during the graphic render (see :data:`BL_ArmatureObject.update`)
+
+ .. attribute:: rotation
+
+ rotation of the bone relative to its parent expressed as a quaternion, read-write. **type** vector [qr, qi, qj, qk].
+
+ .. note:: This field is only used if rotation_mode is 0. An action playing on the armature may change the value. An IK chain does not update this value, see joint_rotation.
+ .. note:: Changing this field has no immediate effect, the pose is updated when the armature is updated during the graphic render (see :data:`BL_ArmatureObject.update`)
+
+ .. attribute:: euler_rotation
+
+ rotation of the bone relative to its parent expressed as a set of euler angles, read-write. **type** vector [X, Y, Z].
+
+ .. note:: This field is only used if rotation_mode is > 0. You must always pass the angles in [X, Y, Z] order; the order of applying the angles to the bone depends on rotation_mode. An action playing on the armature may change this field. An IK chain does not update this value, see joint_rotation.
+ .. note:: Changing this field has no immediate effect, the pose is updated when the armature is updated during the graphic render (see :data:`BL_ArmatureObject.update`)
+
+ .. attribute:: rotation_mode
+
+ Method of updating the bone rotation, read-write. **type** integer
+
+ Use the following constants (euler mode are named as in Blender UI but the actual axis order is reversed).
+
+ * PCHAN_ROT_QUAT(0) : use quaternioin in rotation attribute to update bone rotation
+ * PCHAN_ROT_XYZ(1) : use euler_rotation and apply angles on bone's Z, Y, X axis successively
+ * PCHAN_ROT_XZY(2) : use euler_rotation and apply angles on bone's Y, Z, X axis successively
+ * PCHAN_ROT_YXZ(3) : use euler_rotation and apply angles on bone's Z, X, Y axis successively
+ * PCHAN_ROT_YZX(4) : use euler_rotation and apply angles on bone's X, Z, Y axis successively
+ * PCHAN_ROT_ZXY(5) : use euler_rotation and apply angles on bone's Y, X, Z axis successively
+ * PCHAN_ROT_ZYX(6) : use euler_rotation and apply angles on bone's X, Y, Z axis successively
+
+ .. attribute:: channel_matrix
+
+ pose matrix in bone space (deformation of the bone due to action, constraint, etc), Read-only.
+ This field is updated after the graphic render, it represents the current pose. **type** matrix [4][4]
+
+ .. attribute:: pose_matrix
+
+ pose matrix in armature space, read-only,
+ This field is updated after the graphic render, it represents the current pose. **type** matrix [4][4]
+
+ .. attribute:: pose_head
+
+ position of bone head in armature space, read-only. **type** vector [x, y, z]
+
+ .. attribute:: pose_tail
+
+ position of bone tail in armature space, read-only. **type** vector [x, y, z]
+
+ .. attribute:: ik_min_x
+
+ minimum value of X rotation in degree (<= 0) when X rotation is limited (see ik_limit_x), read-only. **type** float
+
+ .. attribute:: ik_max_x
+
+ maximum value of X rotation in degree (>= 0) when X rotation is limited (see ik_limit_x), read-only. **type** float
+
+ .. attribute:: ik_min_y
+
+ minimum value of Y rotation in degree (<= 0) when Y rotation is limited (see ik_limit_y), read-only. **type** float
+
+ .. attribute:: ik_max_y
+
+ maximum value of Y rotation in degree (>= 0) when Y rotation is limited (see ik_limit_y), read-only. **type** float
+
+ .. attribute:: ik_min_z
+
+ minimum value of Z rotation in degree (<= 0) when Z rotation is limited (see ik_limit_z), read-only. **type** float
+
+ .. attribute:: ik_max_z
+
+ maximum value of Z rotation in degree (>= 0) when Z rotation is limited (see ik_limit_z), read-only. **type** float
+
+ .. attribute:: ik_stiffness_x
+
+ bone rotation stiffness in X axis, read-only **type** float between 0 and 1
+
+ .. attribute:: ik_stiffness_y
+
+ bone rotation stiffness in Y axis, read-only **type** float between 0 and 1
+
+ .. attribute:: ik_stiffness_z
+
+ bone rotation stiffness in Z axis, read-only **type** float between 0 and 1
+
+ .. attribute:: ik_stretch
+
+ ratio of scale change that is allowed, 0=bone can't change size, read-only. **type** float
+
+ .. attribute:: ik_rot_weight
+
+ weight of rotation constraint when ik_rot_control is set, read-write. **type** float between 0 and 1
+
+ .. attribute:: ik_lin_weight
+
+ weight of size constraint when ik_lin_control is set, read-write. **type** float between 0 and 1
+
+ .. attribute:: joint_rotation
+
+ Control bone rotation in term of joint angle (for robotic applications), read-write. **type** vector [x, y, z]
+
+ When writing to this attribute, you pass a [x, y, z] vector and an appropriate set of euler angles or quaternion is calculated according to the rotation_mode.
+
+ When you read this attribute, the current pose matrix is converted into a [x, y, z] vector representing the joint angles.
+
+ The value and the meaning of the x, y, z depends on the ik_dof_x/ik_dof_y/ik_dof_z attributes:
+
+ * 1DoF joint X, Y or Z: the corresponding x, y, or z value is used an a joint angle in radiant
+ * 2DoF joint X+Y or Z+Y: treated as 2 successive 1DoF joints: first X or Z, then Y. The x or z value is used as a joint angle in radiant along the X or Z axis, followed by a rotation along the new Y axis of y radiants.
+ * 2DoF joint X+Z: treated as a 2DoF joint with rotation axis on the X/Z plane. The x and z values are used as the coordinates of the rotation vector in the X/Z plane.
+ * 3DoF joint X+Y+Z: treated as a revolute joint. The [x, y, z] vector represents the equivalent rotation vector to bring the joint from the rest pose to the new pose.
+
+ .. note:: The bone must be part of an IK chain if you want to set the ik_dof_x/ik_dof_y/ik_dof_z attributes via the UI, but this will interfere with this attribute since the IK solver will overwrite the pose. You can stay in control of the armature if you create an IK constraint but do not finalize it (e.g. don't set a target) the IK solver will not run but the IK panel will show up on the UI for each bone in the chain.
+ .. note:: [0, 0, 0] always corresponds to the rest pose.
+ .. note:: You must request the armature pose to update and wait for the next graphic frame to see the effect of setting this attribute (see :data:`BL_ArmatureObject.update`).
+ .. note:: You can read the result of the calculation in rotation or euler_rotation attributes after setting this attribute.
+
+.. class:: BL_ArmatureBone(PyObjectPlus)
+
+ Proxy to Blender bone structure. All fields are read-only and comply to RNA names.
+ All space attribute correspond to the rest pose.
+
+ .. attribute:: name
+
+ bone name **type** string
+
+ .. attribute:: connected
+
+ true when the bone head is struck to the parent's tail **type** boolean
+
+ .. attribute:: hinge
+
+ true when bone doesn't inherit rotation or scale from parent bone **type** boolean
+
+ .. attribute:: inherit_scale
+
+ true when bone inherits scaling from parent bone **type** boolean
+
+ .. attribute:: bbone_segments
+
+ number of B-bone segments **type** integer
+
+ .. attribute:: roll
+
+ bone rotation around head-tail axis **type** float
+
+ .. attribute:: head
+
+ location of head end of the bone in parent bone space **type** vector [x, y, z]
+
+ .. attribute:: tail
+
+ location of head end of the bone in parent bone space **type** vector [x, y, z]
+
+ .. attribute:: length
+
+ bone length **type** float
+
+ .. attribute:: arm_head
+
+ location of head end of the bone in armature space **type** vector [x, y, z]
+
+ .. attribute:: arm_tail
+
+ location of tail end of the bone in armature space **type** vector [x, y, z]
+
+ .. attribute:: arm_mat
+
+ matrix of the bone head in armature space **type** matrix [4][4]
+
+ .. note:: This matrix has no scale part.
+
+ .. attribute:: bone_mat
+
+ rotation matrix of the bone in parent bone space. **type** matrix [3][3]
+
+ .. attribute:: parent
+
+ parent bone, or None for root bone **type** :class:`BL_ArmatureBone`
+
+ .. attribute:: children
+
+ list of bone's children. **type** list of :class:`BL_ArmatureBone`
diff --git a/source/nan_definitions.mk b/source/nan_definitions.mk
index 5bd3c7aaafa..d10a2353a94 100644
--- a/source/nan_definitions.mk
+++ b/source/nan_definitions.mk
@@ -158,6 +158,8 @@ ifndef CONFIG_GUESS
export BF_PCRE_LIBS ?= $(BF_PCRE)/lib/libpcre.a
endif
+ export WITH_TIFF ?= true
+
# Compare recreated .mo files with committed ones
export BF_VERIFY_MO_FILES ?= true
@@ -618,6 +620,9 @@ ifndef CONFIG_GUESS
endif # freebsd
endif # darwin
+ # default tiff libs
+ export NAN_TIFF_LIBS ?= $(NAN_TIFF)/lib/libtiff.a
+
endif # CONFIG_GUESS
# Don't want to build the gameengine?
diff --git a/source/nan_link.mk b/source/nan_link.mk
index b88e835c54a..5337e75c6c1 100644
--- a/source/nan_link.mk
+++ b/source/nan_link.mk
@@ -191,4 +191,8 @@ ifeq ($(WITH_OPENCOLLADA),true)
LLIBS += $(BF_OPENCOLLADA_LIBS)
endif
+ifeq ($(WITH_TIFF),true)
+ LLIBS += $(NAN_TIFF_LIBS)
+endif
+
LLIBS += $(NAN_PYTHON_LIB)
diff --git a/tools/Blender.py b/tools/Blender.py
index 441d454b782..69f6850fa52 100644
--- a/tools/Blender.py
+++ b/tools/Blender.py
@@ -146,6 +146,8 @@ def setup_staticlibs(lenv):
libincs += Split(lenv['BF_OPENEXR_LIBPATH'])
if lenv['WITH_BF_STATICOPENEXR']:
statlibs += Split(lenv['BF_OPENEXR_LIB_STATIC'])
+ if lenv['WITH_BF_TIFF']:
+ libincs += Split(lenv['BF_TIFF_LIBPATH'])
if lenv['WITH_BF_FFTW3']:
libincs += Split(lenv['BF_FFTW3_LIBPATH'])
if lenv['WITH_BF_INTERNATIONAL']:
@@ -208,6 +210,8 @@ def setup_syslibs(lenv):
if lenv['WITH_BF_OPENEXR']:
if not lenv['WITH_BF_STATICOPENEXR']:
syslibs += Split(lenv['BF_OPENEXR_LIB'])
+ if lenv['WITH_BF_TIFF']:
+ syslibs += Split(lenv['BF_TIFF_LIB'])
if lenv['WITH_BF_FFMPEG']:
syslibs += Split(lenv['BF_FFMPEG_LIB'])
if lenv['WITH_BF_OGG']:
diff --git a/tools/btools.py b/tools/btools.py
index 4cb86ecee62..271fccff50c 100644
--- a/tools/btools.py
+++ b/tools/btools.py
@@ -42,7 +42,7 @@ def validate_arguments(args, bc):
'WITH_BF_OPENJPEG', 'BF_OPENJPEG', 'BF_OPENJPEG_INC', 'BF_OPENJPEG_LIB', 'BF_OPENJPEG_LIBPATH',
'WITH_BF_REDCODE', 'BF_REDCODE', 'BF_REDCODE_INC', 'BF_REDCODE_LIB', 'BF_REDCODE_LIBPATH',
'WITH_BF_PNG', 'BF_PNG', 'BF_PNG_INC', 'BF_PNG_LIB', 'BF_PNG_LIBPATH',
- 'BF_TIFF', 'BF_TIFF_INC', 'BF_TIFF_LIB', 'BF_TIFF_LIBPATH',
+ 'WITH_BF_TIFF', 'BF_TIFF', 'BF_TIFF_INC', 'BF_TIFF_LIB', 'BF_TIFF_LIBPATH',
'WITH_BF_ZLIB', 'BF_ZLIB', 'BF_ZLIB_INC', 'BF_ZLIB_LIB', 'BF_ZLIB_LIBPATH',
'WITH_BF_INTERNATIONAL',
'BF_GETTEXT', 'BF_GETTEXT_INC', 'BF_GETTEXT_LIB', 'BF_GETTEXT_LIBPATH',
@@ -261,6 +261,7 @@ def read_opts(cfg, args):
('BF_PNG_LIB', 'PNG library', ''),
('BF_PNG_LIBPATH', 'PNG library path', ''),
+ (BoolVariable('WITH_BF_TIFF', 'Use TIFF if true', True)),
('BF_TIFF', 'TIFF base path', ''),
('BF_TIFF_INC', 'TIFF include path', ''),
('BF_TIFF_LIB', 'TIFF library', ''),