1
1

Compare commits

..

35 Commits

Author SHA1 Message Date
Dalai Felinto
4c0232bdf1 Fixing builds for 2.8 - outliner typo 2018-02-08 21:06:11 +11:00
Dalai Felinto
a37d3f3b6c Merge remote-tracking branch 'origin/blender2.8' into temp-workspace-object-mode-removal 2018-02-08 07:59:08 -02:00
7018e9ca50 Update modes after changing layers or active object from python 2018-02-08 00:36:56 +11:00
26b0de4251 Clear scene obedit when switching view layers 2018-02-07 23:25:47 +11:00
c056c28e55 Fix for mode switching objects 2018-02-07 22:59:51 +11:00
e2a2ac2ce5 Make particle-edit check in cycles TODO (cycles needs some access to mode) 2018-02-07 21:20:54 +11:00
b8cd9b404a Use workspace mode for python scripts 2018-02-07 20:52:20 +11:00
c0ce31c289 Merge branch '28' into temp-workspace-object-mode-removal 2018-02-07 18:40:31 +11:00
025a9fc594 Merge branch '28' into temp-workspace-object-mode-removal 2018-02-07 16:05:03 +11:00
99df345f64 Cleanup 2018-02-07 15:31:25 +11:00
59b35c3927 Check multiple modes with brush update 2018-02-07 15:26:19 +11:00
2682d5cbe8 Correct swapped flags 2018-02-07 13:36:38 +11:00
57640f50f9 Remove headers left in 2018-02-07 13:35:39 +11:00
da9e08847c Pass object mode instead of eval_ctx for brush update function 2018-02-07 13:29:26 +11:00
0336dfa3ff Fix crash in ED_editors_flush_edits
Also take all workspaces into account using WM_windows_object_mode_get
2018-02-07 13:06:08 +11:00
2af6e0b7cb Correct bad eval_ctx.mode use. Use workspace object mode instead 2018-02-07 12:38:15 +11:00
6dc1af640e Merge branch '28' into temp-workspace-object-mode-removal 2018-02-07 11:20:58 +11:00
e7a7ab52b3 Merge branch '28' into temp-workspace-object-mode-removal 2018-02-07 11:05:13 +11:00
4091f5ecb6 Remove unused eval_ctx 2018-02-07 01:44:22 +11:00
33fc85efc7 Avoid passing eval_ctx to modifier functions 2018-02-07 01:29:57 +11:00
7c86782ff2 Pass object mode to multires functions 2018-02-07 01:13:30 +11:00
0472220d7d Merge branch '28' into temp-workspace-object-mode-removal 2018-02-06 23:50:04 +11:00
a996dc7d17 Cleanup: remove unused vars 2018-02-06 20:01:32 +11:00
3cc42b3792 Sync w/ 2.8 2018-02-06 19:53:30 +11:00
8af2782084 Cleanup: unused args 2018-02-06 19:19:59 +11:00
879cdb5e0d Merge branch '28' into temp-workspace-object-mode-removal 2018-02-06 19:19:20 +11:00
479cefc99a Cleanup: remove unneeded eval_ctx argument 2018-02-06 19:08:24 +11:00
2b634cc368 Cleanup: sync header indentation w/ 2.8 2018-02-06 19:03:11 +11:00
0a6a391231 Merge branch '28' into temp-workspace-object-mode-removal 2018-02-06 18:55:34 +11:00
6ec2a1a3fe Merge branch '28' into temp-workspace-object-mode-removal 2018-02-06 10:51:13 +11:00
7f9dc9c79d Resolve building with BGE & OPENSUBDIV 2018-02-05 23:38:02 +11:00
a5ef81c5da Remove EvaluationContext from DRWContextState
Pass object_mode argument instead
2018-02-05 21:29:41 +11:00
5dbd47c7e9 Merge branch '28' into temp-workspace-object-mode-removal 2018-02-05 18:12:11 +11:00
d1322f546d Merge branch '28' into temp-workspace-object-mode-removal 2018-02-05 12:25:03 +11:00
156956380c Initial move of Object.mode to workspace
Differential Revision: https://developer.blender.org/D3037
2018-02-04 10:47:18 +11:00
2583 changed files with 369538 additions and 63829 deletions

View File

@@ -165,6 +165,7 @@ option_defaults_init(
_init_OPENCOLORIO
_init_SDL
_init_FFTW3
_init_GAMEENGINE
_init_OPENSUBDIV
)
@@ -234,6 +235,13 @@ option(WITH_FFTW3 "Enable FFTW3 support (Used for smoke, ocean sim, and
option(WITH_BULLET "Enable Bullet (Physics Engine)" ON)
option(WITH_SYSTEM_BULLET "Use the systems bullet library (currently unsupported due to missing features in upstream!)" )
mark_as_advanced(WITH_SYSTEM_BULLET)
option(WITH_GAMEENGINE "Enable Game Engine" ${_init_GAMEENGINE})
if(APPLE)
set(WITH_GAMEENGINE_DECKLINK OFF)
else()
option(WITH_GAMEENGINE_DECKLINK "Support BlackMagicDesign DeckLink cards in the Game Engine" ON)
endif()
option(WITH_PLAYER "Build Player" OFF)
option(WITH_OPENCOLORIO "Enable OpenColorIO color management" ${_init_OPENCOLORIO})
option(WITH_CLAY_ENGINE "Enable Clay engine" ON)
@@ -245,8 +253,6 @@ option(WITH_OPENSUBDIV "Enable OpenSubdiv for surface subdivision" _init_OPEN
option(WITH_OPENVDB "Enable features relying on OpenVDB" OFF)
option(WITH_OPENVDB_BLOSC "Enable blosc compression for OpenVDB, only enable if OpenVDB was built with blosc support" OFF)
option(WITH_OPENVDB_3_ABI_COMPATIBLE "Assume OpenVDB library has been compiled with version 3 ABI compatibility" OFF)
mark_as_advanced(WITH_OPENVDB_3_ABI_COMPATIBLE)
# GHOST Windowing Library Options
option(WITH_GHOST_DEBUG "Enable debugging output for the GHOST library" OFF)
@@ -306,6 +312,7 @@ endif()
# Modifiers
option(WITH_MOD_FLUID "Enable Elbeem Modifier (Fluid Simulation)" ON)
option(WITH_MOD_SMOKE "Enable Smoke Modifier (Smoke Simulation)" ON)
option(WITH_MOD_BOOLEAN "Enable Boolean Modifier" ON)
option(WITH_MOD_REMESH "Enable Remesh Modifier" ON)
# option(WITH_MOD_CLOTH_ELTOPO "Enable Experimental cloth solver" OFF) # this is now only available in a branch
# mark_as_advanced(WITH_MOD_CLOTH_ELTOPO)
@@ -409,7 +416,7 @@ option(WITH_CYCLES_OSL "Build Cycles with OSL support" ${_init_CYCLES_OSL})
option(WITH_CYCLES_OPENSUBDIV "Build Cycles with OpenSubdiv support" ${_init_CYCLES_OPENSUBDIV})
option(WITH_CYCLES_CUDA_BINARIES "Build Cycles CUDA binaries" OFF)
option(WITH_CYCLES_CUBIN_COMPILER "Build cubins with nvrtc based compiler instead of nvcc" OFF)
set(CYCLES_CUDA_BINARIES_ARCH sm_30 sm_35 sm_37 sm_50 sm_52 sm_60 sm_61 CACHE STRING "CUDA architectures to build binaries for")
set(CYCLES_CUDA_BINARIES_ARCH sm_20 sm_21 sm_30 sm_35 sm_37 sm_50 sm_52 sm_60 sm_61 CACHE STRING "CUDA architectures to build binaries for")
mark_as_advanced(CYCLES_CUDA_BINARIES_ARCH)
unset(PLATFORM_DEFAULT)
option(WITH_CYCLES_LOGGING "Build Cycles with logging support" ON)
@@ -420,13 +427,6 @@ mark_as_advanced(WITH_CYCLES_LOGGING)
mark_as_advanced(WITH_CYCLES_DEBUG)
mark_as_advanced(WITH_CYCLES_NATIVE_ONLY)
option(WITH_CYCLES_DEVICE_CUDA "Enable Cycles CUDA compute support" ON)
option(WITH_CYCLES_DEVICE_OPENCL "Enable Cycles OpenCL compute support" ON)
option(WITH_CYCLES_NETWORK "Enable Cycles compute over network support (EXPERIMENTAL and unfinished)" OFF)
mark_as_advanced(WITH_CYCLES_DEVICE_CUDA)
mark_as_advanced(WITH_CYCLES_DEVICE_OPENCL)
mark_as_advanced(WITH_CYCLES_NETWORK)
option(WITH_CUDA_DYNLOAD "Dynamically load CUDA libraries at runtime" ON)
mark_as_advanced(WITH_CUDA_DYNLOAD)
@@ -458,8 +458,7 @@ option(WITH_BOOST "Enable features depending on boost" ON)
# Unit testsing
option(WITH_GTESTS "Enable GTest unit testing" OFF)
option(WITH_OPENGL_RENDER_TESTS "Enable OpenGL render related unit testing (Experimental)" OFF)
option(WITH_OPENGL_DRAW_TESTS "Enable OpenGL UI drawing related unit testing (Experimental)" OFF)
option(WITH_OPENGL_TESTS "Enable OpenGL related unit testing (Experimental)" OFF)
# Documentation
@@ -572,13 +571,17 @@ endif()
#-----------------------------------------------------------------------------
# Check for conflicting/unsupported configurations
if(NOT WITH_BLENDER AND NOT WITH_CYCLES_STANDALONE)
if(NOT WITH_BLENDER AND NOT WITH_PLAYER AND NOT WITH_CYCLES_STANDALONE)
message(FATAL_ERROR
"At least one of WITH_BLENDER or WITH_CYCLES_STANDALONE "
"must be enabled, nothing to do!"
"At least one of WITH_BLENDER or WITH_PLAYER or "
"WITH_CYCLES_STANDALONE must be enabled, nothing to do!"
)
endif()
if(NOT WITH_GAMEENGINE AND WITH_PLAYER)
message(FATAL_ERROR "WITH_PLAYER requires WITH_GAMEENGINE")
endif()
if(NOT WITH_CXX11)
if(WITH_AUDASPACE AND NOT WITH_SYSTEM_AUDASPACE)
message(FATAL_ERROR "WITH_AUDASPACE requires WITH_CXX11")
@@ -592,6 +595,9 @@ if(NOT WITH_AUDASPACE)
if(WITH_JACK)
message(FATAL_ERROR "WITH_JACK requires WITH_AUDASPACE")
endif()
if(WITH_GAMEENGINE)
message(FATAL_ERROR "WITH_GAMEENGINE requires WITH_AUDASPACE")
endif()
endif()
if(NOT WITH_SDL AND WITH_GHOST_SDL)
@@ -599,6 +605,10 @@ if(NOT WITH_SDL AND WITH_GHOST_SDL)
endif()
# python module, needs some different options
if(WITH_PYTHON_MODULE AND WITH_PLAYER)
message(FATAL_ERROR "WITH_PYTHON_MODULE requires WITH_PLAYER to be OFF")
endif()
if(WITH_PYTHON_MODULE AND WITH_PYTHON_INSTALL)
message(FATAL_ERROR "WITH_PYTHON_MODULE requires WITH_PYTHON_INSTALL to be OFF")
endif()
@@ -629,8 +639,9 @@ if(NOT WITH_BOOST)
set_and_warn(WITH_INTERNATIONAL OFF)
set_and_warn(WITH_OPENVDB OFF)
set_and_warn(WITH_OPENCOLORIO OFF)
set_and_warn(WITH_MOD_BOOLEAN OFF)
elseif(WITH_CYCLES OR WITH_OPENIMAGEIO OR WITH_INTERNATIONAL OR
WITH_OPENVDB OR WITH_OPENCOLORIO)
WITH_OPENVDB OR WITH_OPENCOLORIO OR WITH_MOD_BOOLEAN)
# Keep enabled
else()
# New dependency graph needs either Boost or C++11 for function bindings.
@@ -704,15 +715,6 @@ if(WITH_AUDASPACE)
endif()
endif()
# Auto-enable CUDA dynload if toolkit is not found.
if(NOT WITH_CUDA_DYNLOAD)
find_package(CUDA)
if (NOT CUDA_FOUND)
message("CUDA toolkit not found, using dynamic runtime loading of libraries instead")
set(WITH_CUDA_DYNLOAD ON)
endif()
endif()
#-----------------------------------------------------------------------------
# Check for valid directories
# ... a partial checkout may cause this.
@@ -1224,7 +1226,7 @@ if(WITH_LIBMV OR WITH_GTESTS OR (WITH_CYCLES AND WITH_CYCLES_LOGGING))
if(WIN32)
set(GLOG_INCLUDE_DIRS ${CMAKE_SOURCE_DIR}/extern/glog/src/windows)
else()
set(GLOG_INCLUDE_DIRS ${CMAKE_SOURCE_DIR}/extern/glog/include)
set(GLOG_INCLUDE_DIRS ${CMAKE_SOURCE_DIR}/extern/glog/src)
endif()
endif()
endif()
@@ -1361,7 +1363,6 @@ if(CMAKE_COMPILER_IS_GNUCC)
# flags to undo strict flags
ADD_CHECK_C_COMPILER_FLAG(CC_REMOVE_STRICT_FLAGS C_WARN_NO_DEPRECATED_DECLARATIONS -Wno-deprecated-declarations)
ADD_CHECK_C_COMPILER_FLAG(CC_REMOVE_STRICT_FLAGS C_WARN_NO_UNUSED_PARAMETER -Wno-unused-parameter)
ADD_CHECK_C_COMPILER_FLAG(CC_REMOVE_STRICT_FLAGS C_WARN_NO_UNUSED_FUNCTION -Wno-unused-function)
if(CMAKE_COMPILER_IS_GNUCC AND (NOT "${CMAKE_C_COMPILER_VERSION}" VERSION_LESS "7.0"))
ADD_CHECK_C_COMPILER_FLAG(CC_REMOVE_STRICT_FLAGS C_WARN_NO_IMPLICIT_FALLTHROUGH -Wno-implicit-fallthrough)
@@ -1426,8 +1427,8 @@ elseif(CMAKE_C_COMPILER_ID MATCHES "Intel")
ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_NO_SIGN_COMPARE -Wno-sign-compare)
# disable numbered, false positives
set(C_WARNINGS "${C_WARNINGS} -wd188,186,144,913,556,858,597,177,1292,167,279,592,94,2722,3199")
set(CXX_WARNINGS "${CXX_WARNINGS} -wd188,186,144,913,556,858,597,177,1292,167,279,592,94,2722,3199")
set(C_WARNINGS "${C_WARNINGS} -wd188,186,144,913,556")
set(CXX_WARNINGS "${CXX_WARNINGS} -wd188,186,144,913,556")
elseif(CMAKE_C_COMPILER_ID MATCHES "MSVC")
# most msvc warnings are C & C++
set(_WARNINGS
@@ -1445,7 +1446,6 @@ elseif(CMAKE_C_COMPILER_ID MATCHES "MSVC")
"/wd4267" # conversion from 'size_t' to 'type', possible loss of data
"/wd4305" # truncation from 'type1' to 'type2'
"/wd4800" # forcing value to bool 'true' or 'false'
"/wd4828" # The file contains a character that is illegal
# errors:
"/we4013" # 'function' undefined; assuming extern returning int
"/we4133" # incompatible pointer types
@@ -1564,7 +1564,7 @@ if(WITH_GTESTS)
include(GTestTesting)
endif()
if(WITH_BLENDER)
if(WITH_BLENDER OR WITH_PLAYER)
add_subdirectory(intern)
add_subdirectory(extern)
@@ -1589,6 +1589,13 @@ if(WITH_BLENDER)
endif()
#-----------------------------------------------------------------------------
# Blender Player
if(WITH_PLAYER)
add_subdirectory(source/blenderplayer)
endif()
#-----------------------------------------------------------------------------
# Testing
add_subdirectory(tests)
@@ -1603,6 +1610,9 @@ include(build_files/cmake/packaging.cmake)
if(WITH_BLENDER)
openmp_delayload(blender)
endif()
if(WITH_PLAYER)
openmp_delayload(blenderplayer)
endif()
#-----------------------------------------------------------------------------
# Print Final Configuration
@@ -1636,6 +1646,8 @@ if(FIRST_RUN)
message(STATUS "C++ Compiler: \"${CMAKE_CXX_COMPILER_ID}\"")
info_cfg_text("Build Options:")
info_cfg_option(WITH_GAMEENGINE)
info_cfg_option(WITH_PLAYER)
info_cfg_option(WITH_BULLET)
info_cfg_option(WITH_IK_SOLVER)
info_cfg_option(WITH_IK_ITASC)
@@ -1698,6 +1710,7 @@ if(FIRST_RUN)
endif()
info_cfg_text("Modifiers:")
info_cfg_option(WITH_MOD_BOOLEAN)
info_cfg_option(WITH_MOD_REMESH)
info_cfg_option(WITH_MOD_FLUID)
info_cfg_option(WITH_MOD_OCEANSIM)

View File

@@ -58,6 +58,7 @@ include(cmake/openexr.cmake)
include(cmake/freetype.cmake)
include(cmake/freeglut.cmake)
include(cmake/glew.cmake)
include(cmake/hdf5.cmake)
include(cmake/alembic.cmake)
include(cmake/glfw.cmake)
include(cmake/clew.cmake)

View File

@@ -53,20 +53,17 @@ if(WIN32)
if(BUILD_MODE STREQUAL Release)
set(BOOST_HARVEST_CMD ${BOOST_HARVEST_CMD} && ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/boost/include/boost-1_60/ ${HARVEST_TARGET}/boost/include/)
endif()
set(BOOST_PATCH_COMMAND ${PATCH_CMD} --verbose -p 1 -N -d ${BUILD_DIR}/boost/src/external_boost < ${PATCH_DIR}/boost.diff)
elseif(APPLE)
set(BOOST_CONFIGURE_COMMAND ./bootstrap.sh)
set(BOOST_BUILD_COMMAND ./bjam)
set(BOOST_BUILD_OPTIONS toolset=clang cxxflags=${PLATFORM_CXXFLAGS} linkflags=${PLATFORM_LDFLAGS} --disable-icu boost.locale.icu=off)
set(BOOST_HARVEST_CMD echo .)
set(BOOST_PATCH_COMMAND echo .)
else()
set(BOOST_HARVEST_CMD echo .)
set(BOOST_CONFIGURE_COMMAND ./bootstrap.sh)
set(BOOST_BUILD_COMMAND ./bjam)
set(BOOST_BUILD_OPTIONS cxxflags=${PLATFORM_CXXFLAGS} --disable-icu boost.locale.icu=off)
set(BOOST_PATCH_COMMAND echo .)
endif()
set(BOOST_OPTIONS
@@ -99,7 +96,6 @@ ExternalProject_Add(external_boost
URL_HASH MD5=${BOOST_MD5}
PREFIX ${BUILD_DIR}/boost
UPDATE_COMMAND ""
PATCH_COMMAND ${BOOST_PATCH_COMMAND}
CONFIGURE_COMMAND ${BOOST_CONFIGURE_COMMAND}
BUILD_COMMAND ${BOOST_BUILD_COMMAND} ${BOOST_BUILD_OPTIONS} -j${MAKE_THREADS} architecture=x86 address-model=${BOOST_ADDRESS_MODEL} variant=${BOOST_BUILD_TYPE} link=static threading=multi ${BOOST_OPTIONS} --prefix=${LIBDIR}/boost install
BUILD_IN_SOURCE 1

View File

@@ -102,6 +102,8 @@ if(BUILD_MODE STREQUAL Release)
${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/python/ ${HARVEST_TARGET}/python/ &&
# alembic
${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/alembic ${HARVEST_TARGET}/alembic &&
# hdf5
${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/hdf5 ${HARVEST_TARGET}/hdf5 &&
# BlendThumb
${CMAKE_COMMAND} -E copy ${LIBDIR}/BlendThumb64/bin/blendthumb.dll ${HARVEST_TARGET}/ThumbHandler/lib/BlendThumb64.dll &&
${CMAKE_COMMAND} -E copy ${LIBDIR}/BlendThumb32/bin/blendthumb.dll ${HARVEST_TARGET}/ThumbHandler/lib/BlendThumb.dll &&

View File

@@ -25,7 +25,6 @@ if(BUILD_MODE STREQUAL Release)
-DALSOFT_CONFIG=Off
-DALSOFT_HRTF_DEFS=Off
-DALSOFT_INSTALL=On
-DALSOFT_BACKEND_SNDIO=Off
)
if(UNIX)

View File

@@ -90,7 +90,6 @@ set(OPENIMAGEIO_EXTRA_ARGS
-DUSE_PYTHON=OFF
-DUSE_PYTHON3=OFF
-DUSE_OCIO=OFF
-DUSE_WEBP=${WITH_WEBP}
-DOIIO_BUILD_TOOLS=${OIIO_TOOLS}
-DOIIO_BUILD_TESTS=OFF
-DBUILD_TESTING=OFF

View File

@@ -27,7 +27,7 @@ else()
set(SNDFILE_OPTIONS --enable-static --disable-shared )
endif()
if(UNIX)
if(APPLE)
set(SNDFILE_PATCH_CMD ${PATCH_CMD} --verbose -p 0 -d ${BUILD_DIR}/sndfile/src/external_sndfile < ${PATCH_DIR}/sndfile.diff)
else()
set(SNDFILE_PATCH_CMD)

View File

@@ -1650,6 +1650,7 @@ compile_OIIO() {
cmake_d="$cmake_d -D LINKSTATIC=OFF"
cmake_d="$cmake_d -D USE_SIMD=sse2"
cmake_d="$cmake_d -D ILMBASE_VERSION=$ILMBASE_VERSION"
cmake_d="$cmake_d -D OPENEXR_VERSION=$OPENEXR_VERSION"
if [ "$_with_built_openexr" = true ]; then
@@ -1668,7 +1669,6 @@ compile_OIIO() {
cmake_d="$cmake_d -D BUILD_TESTING=OFF"
cmake_d="$cmake_d -D OIIO_BUILD_TESTS=OFF"
cmake_d="$cmake_d -D OIIO_BUILD_TOOLS=OFF"
cmake_d="$cmake_d -D TXT2MAN="
#cmake_d="$cmake_d -D CMAKE_EXPORT_COMPILE_COMMANDS=ON"
#cmake_d="$cmake_d -D CMAKE_VERBOSE_MAKEFILE=ON"

View File

@@ -1,15 +0,0 @@
--- a/boost/config/compiler/visualc.hpp 2015-12-08 11:55:19 -0700
+++ b/boost/config/compiler/visualc.hpp 2018-03-17 10:29:52 -0600
@@ -287,12 +287,3 @@
# define BOOST_COMPILER "Microsoft Visual C++ version " BOOST_STRINGIZE(BOOST_COMPILER_VERSION)
#endif
-//
-// last known and checked version is 19.00.23026 (VC++ 2015 RTM):
-#if (_MSC_VER > 1900)
-# if defined(BOOST_ASSERT_CONFIG)
-# error "Unknown compiler version - please run the configure tests and report the results"
-# else
-# pragma message("Unknown compiler version - please run the configure tests and report the results")
-# endif
-#endif

View File

@@ -21,8 +21,9 @@ else()
message(FATAL_ERROR "Unknown build environment")
endif()
# Default to only build Blender
# Default to only build Blender, not the player
set(WITH_BLENDER ON CACHE BOOL "" FORCE)
set(WITH_PLAYER OFF CACHE BOOL "" FORCE)
# ######## Linux-specific build options ########
# Options which are specific to Linux-only platforms

View File

@@ -0,0 +1,12 @@
# This is applied as an override on top of blender_linux.config
# Disables all the areas which are not needed for the player.
set(WITH_COMPOSITOR OFF CACHE BOOL "" FORCE)
set(WITH_CYCLES OFF CACHE BOOL "" FORCE)
set(WITH_FREESTYLE OFF CACHE BOOL "" FORCE)
set(WITH_GHOST_XDND OFF CACHE BOOL "" FORCE)
set(WITH_OPENCOLLADA OFF CACHE BOOL "" FORCE)
set(WITH_OPENSUBDIV OFF CACHE BOOL "" FORCE)
set(WITH_LIBMV OFF CACHE BOOL "" FORCE)
set(WITH_BLENDER OFF CACHE BOOL "" FORCE)
set(WITH_PLAYER ON CACHE BOOL "" FORCE)

View File

@@ -0,0 +1,368 @@
# -*- python -*-
# ex: set syntax=python:
# <pep8 compliant>
# List of the branches being built automatically overnight
NIGHT_SCHEDULE_BRANCHES = [None, "blender2.8"]
# List of the branches available for force build
FORCE_SCHEDULE_BRANCHES = ["master", "blender2.8", "experimental-build"]
"""
Stock Twisted directory lister doesn't provide any information about last file
modification time, we hack the class a bit in order to have such functionaliity
:)
"""
from buildbot.status.web.base import DirectoryLister
def get_files_and_directories(self, directory):
from twisted.web.static import (getTypeAndEncoding,
formatFileSize)
import urllib
import cgi
import time
import os
files = []
dirs = []
for path in directory:
url = urllib.quote(path, "/")
escapedPath = cgi.escape(path)
lastmodified = time.ctime(os.path.getmtime(
os.path.join(self.path, path)))
if os.path.isdir(os.path.join(self.path, path)):
url = url + '/'
dirs.append({'text': escapedPath + "/", 'href': url,
'size': '', 'type': '[Directory]',
'encoding': '',
'lastmodified': lastmodified})
else:
mimetype, encoding = getTypeAndEncoding(path, self.contentTypes,
self.contentEncodings,
self.defaultType)
try:
size = os.stat(os.path.join(self.path, path)).st_size
except OSError:
continue
files.append({
'text': escapedPath, "href": url,
'type': '[%s]' % mimetype,
'encoding': (encoding and '[%s]' % encoding or ''),
'size': formatFileSize(size),
'lastmodified': lastmodified})
return dirs, files
DirectoryLister._getFilesAndDirectories = get_files_and_directories
# Dictionary that the buildmaster pays attention to.
c = BuildmasterConfig = {}
# BUILD SLAVES
#
# We load the slaves and their passwords from a separator file, so we can have
# this one in SVN.
from buildbot.buildslave import BuildSlave
import master_private
c['slaves'] = []
for slave in master_private.slaves:
c['slaves'].append(BuildSlave(slave['name'], slave['password']))
# TCP port through which slaves connect
c['slavePortnum'] = 9989
# CHANGE SOURCES
from buildbot.changes.svnpoller import SVNPoller
from buildbot.changes.gitpoller import GitPoller
c['change_source'] = GitPoller(
'git://git.blender.org/blender.git',
pollinterval=1200)
# CODEBASES
#
# Allow to control separately things like branches for each repo and submodules.
all_repositories = {
r'git://git.blender.org/blender.git': 'blender',
r'git://git.blender.org/blender-translations.git': 'blender-translations',
r'git://git.blender.org/blender-addons.git': 'blender-addons',
r'git://git.blender.org/blender-addons-contrib.git': 'blender-addons-contrib',
r'git://git.blender.org/blender-dev-tools.git': 'blender-dev-tools',
r'https://svn.blender.org/svnroot/bf-blender/': 'lib svn',
}
def codebaseGenerator(chdict):
return all_repositories[chdict['repository']]
c['codebaseGenerator'] = codebaseGenerator
# SCHEDULERS
#
# Decide how to react to incoming changes.
# from buildbot.scheduler import Scheduler
from buildbot.schedulers import timed, forcesched
c['schedulers'] = []
def schedule_force_build(name):
c['schedulers'].append(forcesched.ForceScheduler(name='force ' + name,
builderNames=[name],
codebases=[forcesched.CodebaseParameter(
codebase="blender",
branch=forcesched.ChoiceStringParameter(
name="branch", choices=FORCE_SCHEDULE_BRANCHES, default="master"),
# Do not hide revision, can be handy!
repository=forcesched.FixedParameter(name="repository", default="", hide=True),
project=forcesched.FixedParameter(name="project", default="", hide=True)),
# For now, hide other codebases.
forcesched.CodebaseParameter(hide=True, codebase="blender-translations"),
forcesched.CodebaseParameter(
codebase="blender-addons",
branch=forcesched.ChoiceStringParameter(
name="branch", choices=["master", "blender2.8"], default="master"),
repository=forcesched.FixedParameter(name="repository", default="", hide=True),
project=forcesched.FixedParameter(name="project", default="", hide=True),
revision=forcesched.FixedParameter(name="revision", default="", hide=True),
),
forcesched.CodebaseParameter(hide=True, codebase="blender-addons-contrib"),
forcesched.CodebaseParameter(hide=True, codebase="blender-dev-tools"),
forcesched.CodebaseParameter(hide=True, codebase="lib svn")],
properties=[]))
def schedule_build(name, hour, minute=0):
for current_branch in NIGHT_SCHEDULE_BRANCHES:
scheduler_name = "nightly " + name
if current_branch:
scheduler_name += ' ' + current_branch
# Use special addons submodule branch when building blender2.8 branch.
addons_branch = "master"
if current_branch == "blender2.8":
addons_branch = "blender2.8"
c['schedulers'].append(timed.Nightly(name=scheduler_name,
codebases={
"blender": {"repository": ""},
"blender-translations": {"repository": "", "branch": "master"},
"blender-addons": {"repository": "", "branch": addons_branch},
"blender-addons-contrib": {"repository": "", "branch": "master"},
"blender-dev-tools": {"repository": "", "branch": "master"},
"lib svn": {"repository": "", "branch": "trunk"}},
branch=current_branch,
builderNames=[name],
hour=hour,
minute=minute))
# BUILDERS
#
# The 'builders' list defines the Builders, which tell Buildbot how to
# perform a build: what steps, and which slaves can execute them.
# Note that any particular build will only take place on one slave.
from buildbot.process.factory import BuildFactory
from buildbot.process.properties import Interpolate
from buildbot.steps.source import SVN
from buildbot.steps.source import Git
from buildbot.steps.shell import ShellCommand
from buildbot.steps.shell import Compile
from buildbot.steps.shell import Test
from buildbot.steps.transfer import FileUpload
from buildbot.steps.master import MasterShellCommand
from buildbot.config import BuilderConfig
# add builder utility
c['builders'] = []
buildernames = []
def add_builder(c, name, libdir, factory, branch='',
rsync=False, hour=3, minute=0):
slavenames = []
for slave in master_private.slaves:
if name in slave['builders']:
slavenames.append(slave['name'])
if len(slavenames) > 0:
f = factory(name, libdir, branch, rsync)
c['builders'].append(BuilderConfig(name=name,
slavenames=slavenames,
factory=f,
category='blender'))
buildernames.append(name)
schedule_build(name, hour, minute)
schedule_force_build(name)
# common steps
def git_submodule_step(submodule):
return Git(name=submodule + '.git',
repourl='git://git.blender.org/' + submodule + '.git',
mode='update',
codebase=submodule,
workdir=submodule + '.git')
def git_step(branch=''):
if branch:
return Git(name='blender.git',
repourl='git://git.blender.org/blender.git',
mode='update',
branch=branch,
codebase='blender',
workdir='blender.git',
submodules=True)
else:
return Git(name='blender.git',
repourl='git://git.blender.org/blender.git',
mode='update',
codebase='blender',
workdir='blender.git',
submodules=True)
def git_submodules_update():
command = ['git', 'submodule', 'update', '--remote']
return ShellCommand(name='Submodules Update',
command=command,
description='updating',
descriptionDone='up to date',
workdir='blender.git')
def lib_svn_step(dir):
return SVN(name='lib svn',
baseURL='https://svn.blender.org/svnroot/bf-blender/%%BRANCH%%/lib/' + dir,
codebase='lib svn',
mode='update',
defaultBranch='trunk',
workdir='lib/' + dir)
def rsync_step(id, branch, rsync_script):
return ShellCommand(name='rsync',
command=['python', rsync_script, id, branch],
description='uploading',
descriptionDone='uploaded',
workdir='install')
# generic builder
def generic_builder(id, libdir='', branch='', rsync=False):
filename = 'uploaded/buildbot_upload_' + id + '.zip'
compile_script = '../blender.git/build_files/buildbot/slave_compile.py'
test_script = '../blender.git/build_files/buildbot/slave_test.py'
pack_script = '../blender.git/build_files/buildbot/slave_pack.py'
rsync_script = '../blender.git/build_files/buildbot/slave_rsync.py'
unpack_script = 'master_unpack.py'
f = BuildFactory()
if libdir != '':
f.addStep(lib_svn_step(libdir))
for submodule in ('blender-translations',
'blender-addons',
'blender-addons-contrib',
'blender-dev-tools'):
f.addStep(git_submodule_step(submodule))
f.addStep(git_step(branch))
f.addStep(git_submodules_update())
f.addStep(Compile(command=['python', compile_script, id], timeout=3600))
f.addStep(Test(command=['python', test_script, id]))
f.addStep(ShellCommand(name='package',
command=['python', pack_script, id, branch or Interpolate('%(src:blender:branch)s')],
description='packaging',
descriptionDone='packaged'))
if rsync:
f.addStep(rsync_step(id, branch, rsync_script))
else:
f.addStep(FileUpload(name='upload',
slavesrc='buildbot_upload.zip',
masterdest=filename,
maxsize=180 * 1024 * 1024,
workdir='install'))
f.addStep(MasterShellCommand(name='unpack',
command=['python2.7', unpack_script, filename],
description='unpacking',
descriptionDone='unpacked'))
return f
# Builders
add_builder(c, 'mac_x86_64_10_9_cmake', 'darwin', generic_builder, hour=1)
add_builder(c, 'linux_glibc219_i686_cmake', '', generic_builder, hour=2)
add_builder(c, 'linux_glibc219_x86_64_cmake', '', generic_builder, hour=1)
add_builder(c, 'win32_cmake_vc2013', 'windows_vc12', generic_builder, hour=1)
add_builder(c, 'win64_cmake_vc2013', 'win64_vc12', generic_builder, hour=2)
add_builder(c, 'win32_cmake_vc2015', 'windows_vc14', generic_builder, hour=3)
add_builder(c, 'win64_cmake_vc2015', 'win64_vc14', generic_builder, hour=4)
# STATUS TARGETS
#
# 'status' is a list of Status Targets. The results of each build will be
# pushed to these targets. buildbot/status/*.py has a variety to choose from,
# including web pages, email senders, and IRC bots.
c['status'] = []
from buildbot.status import html
from buildbot.status.web import authz
from buildbot.status.web import auth
users = []
for slave in master_private.slaves:
users += [(slave['name'], slave['password'])]
authz_cfg = authz.Authz(
auth=auth.BasicAuth(users),
# change any of these to True to enable; see the manual for more
# options
gracefulShutdown=False,
forceBuild=True, # use this to test your slave once it is set up
forceAllBuilds=False,
pingBuilder=False,
stopBuild=True,
stopAllBuilds=False,
cancelPendingBuild=True,
)
c['status'].append(html.WebStatus(http_port=8010, authz=authz_cfg))
#c['status'].append(html.WebStatus(http_port=8010))
# PROJECT IDENTITY
c['projectName'] = "Blender"
c['projectURL'] = "http://www.blender.org"
# the 'buildbotURL' string should point to the location where the buildbot's
# internal web server (usually the html.WebStatus page) is visible. This
# typically uses the port number set in the Waterfall 'status' entry, but
# with an externally-visible host name which the buildbot cannot figure out
# without some help.
c['buildbotURL'] = "http://builder.blender.org/"
# DB URL
#
# This specifies what database buildbot uses to store change and scheduler
# state. You can leave this at its default for all but the largest
# installations.
c['db_url'] = "sqlite:///state.sqlite"

View File

@@ -0,0 +1,151 @@
# ##### BEGIN GPL LICENSE BLOCK #####
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# ##### END GPL LICENSE BLOCK #####
# Runs on Buildbot master, to unpack incoming unload.zip into latest
# builds directory and remove older builds.
# <pep8 compliant>
import os
import shutil
import sys
import zipfile
# extension stripping
def strip_extension(filename):
extensions = '.zip', '.tar', '.bz2', '.gz', '.tgz', '.tbz', '.exe'
for ext in extensions:
if filename.endswith(ext):
filename = filename[:-len(ext)]
return filename
# extract platform from package name
def get_platform(filename):
# name is blender-version-platform.extension. we want to get the
# platform out, but there may be some variations, so we fiddle a
# bit to handle current and hopefully future names
filename = strip_extension(filename)
filename = strip_extension(filename)
tokens = filename.split("-")
platforms = ('osx', 'mac', 'bsd',
'win', 'linux', 'source',
'irix', 'solaris')
platform_tokens = []
found = False
for i, token in enumerate(tokens):
if not found:
for platform in platforms:
if platform in token.lower():
found = True
break
if found:
platform_tokens += [token]
return '-'.join(platform_tokens)
def get_branch(filename):
if filename.startswith("blender-2.8"):
return "blender2.8"
tokens = filename.split("-")
branch = ""
for token in tokens:
if token == "blender":
return branch
if branch == "":
branch = token
else:
branch = branch + "-" + token
return ""
# get filename
if len(sys.argv) < 2:
sys.stderr.write("Not enough arguments, expecting file to unpack\n")
sys.exit(1)
filename = sys.argv[1]
# open zip file
if not os.path.exists(filename):
sys.stderr.write("File %r not found.\n" % filename)
sys.exit(1)
try:
z = zipfile.ZipFile(filename, "r")
except Exception as ex:
sys.stderr.write('Failed to open zip file: %s\n' % str(ex))
sys.exit(1)
if len(z.namelist()) != 1:
sys.stderr.write("Expected one file in %r." % filename)
sys.exit(1)
package = z.namelist()[0]
packagename = os.path.basename(package)
# detect platform and branch
platform = get_platform(packagename)
branch = get_branch(packagename)
if platform == '':
sys.stderr.write('Failed to detect platform ' +
'from package: %r\n' % packagename)
sys.exit(1)
# extract
if not branch or branch == 'master':
directory = 'public_html/download'
elif branch == 'experimental-build':
directory = 'public_html/download/experimental'
else:
directory = 'public_html/download'
try:
filename = os.path.join(directory, packagename)
zf = z.open(package)
f = file(filename, "wb")
shutil.copyfileobj(zf, f)
os.chmod(filename, 0644)
zf.close()
z.close()
except Exception as ex:
sys.stderr.write('Failed to unzip package: %s\n' % str(ex))
sys.exit(1)
# remove other files from the same platform and branch
try:
for f in os.listdir(directory):
if get_platform(f) == platform and get_branch(f) == branch:
if f != packagename:
os.remove(os.path.join(directory, f))
except Exception as ex:
sys.stderr.write('Failed to remove old packages: %s\n' % str(ex))
sys.exit(1)

View File

@@ -60,6 +60,7 @@ if 'cmake' in builder:
# Config file to be used (relative to blender's sources root)
cmake_config_file = "build_files/cmake/config/blender_full.cmake"
cmake_player_config_file = None
cmake_cuda_config_file = None
# Set build options.
@@ -72,9 +73,8 @@ if 'cmake' in builder:
if builder.endswith('x86_64_10_9_cmake'):
cmake_extra_options.append('-DCMAKE_OSX_ARCHITECTURES:STRING=x86_64')
cmake_extra_options.append('-DCMAKE_OSX_DEPLOYMENT_TARGET=10.9')
# Used to trick CUDFA to see CLang as an older version.
# cmake_extra_options.append('-DCUDA_HOST_COMPILER=/usr/local/cuda-hack/clang')
# cmake_extra_options.append('-DCUDA_NVCC_EXECUTABLE=/usr/local/cuda-hack/nvcc')
cmake_extra_options.append('-DCUDA_HOST_COMPILER=/usr/local/cuda-hack/clang')
cmake_extra_options.append('-DCUDA_NVCC_EXECUTABLE=/usr/local/cuda-hack/nvcc')
elif builder.startswith('win'):
if builder.endswith('_vc2015'):
@@ -100,30 +100,32 @@ if 'cmake' in builder:
elif glibc == 'glibc211':
deb_name = "squeeze"
cmake_config_file = "build_files/buildbot/config/blender_linux.cmake"
cmake_player_config_file = "build_files/buildbot/config/blender_linux_player.cmake"
if builder.endswith('x86_64_cmake'):
chroot_name = 'buildbot_' + deb_name + '_x86_64'
targets = ['blender']
targets = ['player', 'blender']
elif builder.endswith('i686_cmake'):
bits = 32
chroot_name = 'buildbot_' + deb_name + '_i686'
targets = ['blender']
cuda_chroot_name = 'buildbot_' + deb_name + '_x86_64'
targets = ['player', 'blender', 'cuda']
cmake_extra_options.extend(["-DCMAKE_C_COMPILER=/usr/bin/gcc-7",
"-DCMAKE_CXX_COMPILER=/usr/bin/g++-7"])
cmake_options.append("-C" + os.path.join(blender_dir, cmake_config_file))
# Prepare CMake options needed to configure cuda binaries compilation, 64bit only.
if bits == 64:
cuda_cmake_options.append("-DWITH_CYCLES_CUDA_BINARIES=%s" % ('ON' if build_cubins else 'OFF'))
cuda_cmake_options.append("-DCYCLES_CUDA_BINARIES_ARCH=sm_30;sm_35;sm_37;sm_50;sm_52;sm_60;sm_61;sm_70")
if build_cubins or 'cuda' in targets:
# Prepare CMake options needed to configure cuda binaries compilation.
cuda_cmake_options.append("-DWITH_CYCLES_CUDA_BINARIES=%s" % ('ON' if build_cubins else 'OFF'))
cuda_cmake_options.append("-DCYCLES_CUDA_BINARIES_ARCH=sm_20;sm_21;sm_30;sm_35;sm_37;sm_50;sm_52;sm_60;sm_61")
if build_cubins or 'cuda' in targets:
if bits == 32:
cuda_cmake_options.append("-DCUDA_64_BIT_DEVICE_CODE=OFF")
else:
cuda_cmake_options.append("-DCUDA_64_BIT_DEVICE_CODE=ON")
# Only modify common cmake options if cuda doesn't require separate target.
if 'cuda' not in targets:
cmake_options += cuda_cmake_options
else:
cuda_cmake_options.append("-DWITH_CYCLES_CUDA_BINARIES=OFF")
# Only modify common cmake options if cuda doesn't require separate target.
if 'cuda' not in targets:
cmake_options += cuda_cmake_options
cmake_options.append("-DCMAKE_INSTALL_PREFIX=%s" % (install_dir))
@@ -157,7 +159,9 @@ if 'cmake' in builder:
os.chdir(target_build_dir)
# Tweaking CMake options to respect the target
target_cmake_options = cmake_options[:]
if target == 'cuda':
if target == 'player':
target_cmake_options.append("-C" + os.path.join(blender_dir, cmake_player_config_file))
elif target == 'cuda':
target_cmake_options += cuda_cmake_options
target_chroot_prefix = cuda_chroot_prefix[:]
target_name = 'cycles_kernel_cuda'

View File

@@ -126,6 +126,7 @@ if builder.find('cmake') != -1:
elif builder.startswith('linux_'):
blender = os.path.join(install_dir, 'blender')
blenderplayer = os.path.join(install_dir, 'blenderplayer')
buildinfo_h = os.path.join(build_dir, "source", "creator", "buildinfo.h")
blender_h = os.path.join(blender_dir, "source", "blender", "blenkernel", "BKE_blender_version.h")
@@ -137,18 +138,18 @@ if builder.find('cmake') != -1:
blender_glibc = builder.split('_')[1]
if builder.endswith('x86_64_cmake'):
chroot_name = 'buildbot_jessie_x86_64'
chroot_name = 'buildbot_squeeze_x86_64'
bits = 64
blender_arch = 'x86_64'
elif builder.endswith('i686_cmake'):
chroot_name = 'buildbot_jessie_i686'
chroot_name = 'buildbot_squeeze_i686'
bits = 32
blender_arch = 'i686'
# Strip all unused symbols from the binaries
print("Stripping binaries...")
chroot_prefix = ['schroot', '-c', chroot_name, '--']
subprocess.call(chroot_prefix + ['strip', '--strip-all', blender])
subprocess.call(chroot_prefix + ['strip', '--strip-all', blender, blenderplayer])
print("Stripping python...")
py_target = os.path.join(install_dir, blender_version)

View File

@@ -44,9 +44,9 @@ if "cmake" in builder:
"""
if builder.endswith('x86_64_cmake'):
chroot_name = 'buildbot_jessie_x86_64'
chroot_name = 'buildbot_squeeze_x86_64'
elif builder.endswith('i686_cmake'):
chroot_name = 'buildbot_jessie_i686'
chroot_name = 'buildbot_squeeze_i686'
if chroot_name:
chroot_prefix = ['schroot', '-c', chroot_name, '--']
"""

View File

@@ -25,6 +25,10 @@ IGNORE = (
"extern/bullet2/src/BulletDynamics/Character/btKinematicCharacterController.h",
"extern/bullet2/src/BulletDynamics/ConstraintSolver/btHinge2Constraint.h",
"extern/bullet2/src/BulletDynamics/ConstraintSolver/btUniversalConstraint.h",
"extern/carve/include/carve/config.h",
"extern/carve/include/carve/random/random.h",
"extern/carve/patches/files/config.h",
"extern/carve/patches/files/random.h",
"intern/audaspace/SRC/AUD_SRCResampleFactory.h",
"intern/audaspace/SRC/AUD_SRCResampleReader.h",
)

View File

@@ -16,6 +16,7 @@ set(WITH_CYCLES_OPENSUBDIV ON CACHE BOOL "" FORCE)
set(WITH_FFTW3 ON CACHE BOOL "" FORCE)
set(WITH_LIBMV ON CACHE BOOL "" FORCE)
set(WITH_LIBMV_SCHUR_SPECIALIZATIONS ON CACHE BOOL "" FORCE)
set(WITH_GAMEENGINE ON CACHE BOOL "" FORCE)
set(WITH_COMPOSITOR ON CACHE BOOL "" FORCE)
set(WITH_FREESTYLE ON CACHE BOOL "" FORCE)
set(WITH_GHOST_XDND ON CACHE BOOL "" FORCE)
@@ -33,6 +34,7 @@ set(WITH_INTERNATIONAL ON CACHE BOOL "" FORCE)
set(WITH_JACK ON CACHE BOOL "" FORCE)
set(WITH_LZMA ON CACHE BOOL "" FORCE)
set(WITH_LZO ON CACHE BOOL "" FORCE)
set(WITH_MOD_BOOLEAN ON CACHE BOOL "" FORCE)
set(WITH_MOD_FLUID ON CACHE BOOL "" FORCE)
set(WITH_MOD_REMESH ON CACHE BOOL "" FORCE)
set(WITH_MOD_SMOKE ON CACHE BOOL "" FORCE)
@@ -50,6 +52,7 @@ set(WITH_SDL ON CACHE BOOL "" FORCE)
set(WITH_X11_XINPUT ON CACHE BOOL "" FORCE)
set(WITH_X11_XF86VMODE ON CACHE BOOL "" FORCE)
set(WITH_PLAYER ON CACHE BOOL "" FORCE)
set(WITH_MEM_JEMALLOC ON CACHE BOOL "" FORCE)

View File

@@ -6,6 +6,7 @@
#
set(WITH_HEADLESS ON CACHE BOOL "" FORCE)
set(WITH_GAMEENGINE OFF CACHE BOOL "" FORCE)
# disable audio, its possible some devs may want this but for now disable
# so the python module doesnt hold the audio device and loads quickly.

View File

@@ -9,7 +9,6 @@ set(WITH_INSTALL_PORTABLE ON CACHE BOOL "" FORCE)
set(WITH_SYSTEM_GLEW ON CACHE BOOL "" FORCE)
set(WITH_ALEMBIC OFF CACHE BOOL "" FORCE)
set(WITH_BOOST OFF CACHE BOOL "" FORCE)
set(WITH_BUILDINFO OFF CACHE BOOL "" FORCE)
set(WITH_BULLET OFF CACHE BOOL "" FORCE)
set(WITH_CODEC_AVI OFF CACHE BOOL "" FORCE)
@@ -21,6 +20,7 @@ set(WITH_CYCLES_OPENSUBDIV OFF CACHE BOOL "" FORCE)
set(WITH_FFTW3 OFF CACHE BOOL "" FORCE)
set(WITH_LIBMV OFF CACHE BOOL "" FORCE)
set(WITH_LLVM OFF CACHE BOOL "" FORCE)
set(WITH_GAMEENGINE OFF CACHE BOOL "" FORCE)
set(WITH_COMPOSITOR OFF CACHE BOOL "" FORCE)
set(WITH_FREESTYLE OFF CACHE BOOL "" FORCE)
set(WITH_GHOST_XDND OFF CACHE BOOL "" FORCE)
@@ -38,6 +38,7 @@ set(WITH_INTERNATIONAL OFF CACHE BOOL "" FORCE)
set(WITH_JACK OFF CACHE BOOL "" FORCE)
set(WITH_LZMA OFF CACHE BOOL "" FORCE)
set(WITH_LZO OFF CACHE BOOL "" FORCE)
set(WITH_MOD_BOOLEAN OFF CACHE BOOL "" FORCE)
set(WITH_MOD_FLUID OFF CACHE BOOL "" FORCE)
set(WITH_MOD_REMESH OFF CACHE BOOL "" FORCE)
set(WITH_MOD_SMOKE OFF CACHE BOOL "" FORCE)
@@ -54,3 +55,4 @@ set(WITH_RAYOPTIMIZATION OFF CACHE BOOL "" FORCE)
set(WITH_SDL OFF CACHE BOOL "" FORCE)
set(WITH_X11_XINPUT OFF CACHE BOOL "" FORCE)
set(WITH_X11_XF86VMODE OFF CACHE BOOL "" FORCE)

View File

@@ -16,6 +16,7 @@ set(WITH_CYCLES_OPENSUBDIV ON CACHE BOOL "" FORCE)
set(WITH_FFTW3 ON CACHE BOOL "" FORCE)
set(WITH_LIBMV ON CACHE BOOL "" FORCE)
set(WITH_LIBMV_SCHUR_SPECIALIZATIONS ON CACHE BOOL "" FORCE)
set(WITH_GAMEENGINE ON CACHE BOOL "" FORCE)
set(WITH_COMPOSITOR ON CACHE BOOL "" FORCE)
set(WITH_FREESTYLE ON CACHE BOOL "" FORCE)
set(WITH_GHOST_XDND ON CACHE BOOL "" FORCE)
@@ -33,6 +34,7 @@ set(WITH_INTERNATIONAL ON CACHE BOOL "" FORCE)
set(WITH_JACK ON CACHE BOOL "" FORCE)
set(WITH_LZMA ON CACHE BOOL "" FORCE)
set(WITH_LZO ON CACHE BOOL "" FORCE)
set(WITH_MOD_BOOLEAN ON CACHE BOOL "" FORCE)
set(WITH_MOD_FLUID ON CACHE BOOL "" FORCE)
set(WITH_MOD_REMESH ON CACHE BOOL "" FORCE)
set(WITH_MOD_SMOKE ON CACHE BOOL "" FORCE)
@@ -50,9 +52,10 @@ set(WITH_SDL ON CACHE BOOL "" FORCE)
set(WITH_X11_XINPUT ON CACHE BOOL "" FORCE)
set(WITH_X11_XF86VMODE ON CACHE BOOL "" FORCE)
set(WITH_PLAYER ON CACHE BOOL "" FORCE)
set(WITH_MEM_JEMALLOC ON CACHE BOOL "" FORCE)
set(WITH_CYCLES_CUDA_BINARIES ON CACHE BOOL "" FORCE)
set(CYCLES_CUDA_BINARIES_ARCH sm_30;sm_35;sm_37;sm_50;sm_52;sm_60;sm_61 CACHE STRING "" FORCE)
set(CYCLES_CUDA_BINARIES_ARCH sm_20;sm_21;sm_30;sm_35;sm_37;sm_50;sm_52;sm_60;sm_61 CACHE STRING "" FORCE)
# platform dependent options
if(UNIX AND NOT APPLE)

View File

@@ -12,6 +12,9 @@ set(WITH_INSTALL_PORTABLE OFF CACHE BOOL "" FORCE)
# no point int copying python into python
set(WITH_PYTHON_INSTALL OFF CACHE BOOL "" FORCE)
# dont build the game engine
set(WITH_GAMEENGINE OFF CACHE BOOL "" FORCE)
# disable audio, its possible some devs may want this but for now disable
# so the python module doesnt hold the audio device and loads quickly.
set(WITH_AUDASPACE OFF CACHE BOOL "" FORCE)

View File

@@ -6,6 +6,7 @@
# disable Blender
set(WITH_BLENDER OFF CACHE BOOL "" FORCE)
set(WITH_PLAYER OFF CACHE BOOL "" FORCE)
set(WITH_CYCLES_BLENDER OFF CACHE BOOL "" FORCE)
# build Cycles

View File

@@ -565,8 +565,6 @@ function(SETUP_BLENDER_SORTED_LIBS)
set(BLENDER_SORTED_LIBS
bf_windowmanager
bf_editor_undo
bf_editor_space_api
bf_editor_space_action
bf_editor_space_buttons
@@ -583,7 +581,6 @@ function(SETUP_BLENDER_SORTED_LIBS)
bf_editor_space_sequencer
bf_editor_space_text
bf_editor_space_time
bf_editor_space_topbar
bf_editor_space_userpref
bf_editor_space_view3d
bf_editor_space_clip
@@ -598,7 +595,6 @@ function(SETUP_BLENDER_SORTED_LIBS)
bf_editor_mesh
bf_editor_metaball
bf_editor_object
bf_editor_lattice
bf_editor_armature
bf_editor_physics
bf_editor_render
@@ -692,7 +688,6 @@ function(SETUP_BLENDER_SORTED_LIBS)
extern_sdlew
bf_intern_glew_mx
bf_intern_clog
)
if(NOT WITH_SYSTEM_GLOG)
@@ -741,6 +736,10 @@ function(SETUP_BLENDER_SORTED_LIBS)
list(APPEND BLENDER_SORTED_LIBS bf_intern_itasc)
endif()
if(WITH_MOD_BOOLEAN)
list(APPEND BLENDER_SORTED_LIBS extern_carve)
endif()
if(WITH_GHOST_XDND)
list(APPEND BLENDER_SORTED_LIBS extern_xdnd)
endif()
@@ -761,6 +760,10 @@ function(SETUP_BLENDER_SORTED_LIBS)
list_insert_after(BLENDER_SORTED_LIBS "ge_logic_ngnetwork" "extern_bullet")
endif()
if(WITH_GAMEENGINE_DECKLINK)
list(APPEND BLENDER_SORTED_LIBS bf_intern_decklink)
endif()
if(WIN32)
list(APPEND BLENDER_SORTED_LIBS bf_intern_gpudirect)
endif()
@@ -819,7 +822,7 @@ macro(TEST_SSE_SUPPORT
endif()
elseif(CMAKE_C_COMPILER_ID MATCHES "Intel")
set(${_sse_flags} "") # icc defaults to -msse
set(${_sse2_flags} "") # icc defaults to -msse2
set(${_sse2_flags} "-msse2")
else()
message(WARNING "SSE flags for this compiler: '${CMAKE_C_COMPILER_ID}' not known")
set(${_sse_flags})
@@ -1145,9 +1148,7 @@ endmacro()
# External libs may need 'signed char' to be default.
macro(remove_cc_flag_unsigned_char)
if(CMAKE_COMPILER_IS_GNUCC OR
(CMAKE_C_COMPILER_ID MATCHES "Clang") OR
(CMAKE_C_COMPILER_ID MATCHES "Intel"))
if(CMAKE_C_COMPILER_ID MATCHES "^(GNU|Clang|Intel)$")
remove_cc_flag("-funsigned-char")
elseif(MSVC)
remove_cc_flag("/J")

View File

@@ -31,9 +31,6 @@ endmacro()
if(NOT DEFINED LIBDIR)
set(LIBDIR ${CMAKE_SOURCE_DIR}/../lib/darwin)
# Prefer lib directory paths
file(GLOB LIB_SUBDIRS ${LIBDIR}/*)
set(CMAKE_PREFIX_PATH ${LIB_SUBDIRS})
else()
message(STATUS "Using pre-compiled LIBDIR: ${LIBDIR}")
endif()
@@ -330,8 +327,8 @@ if(WITH_OPENVDB)
endif()
if(WITH_LLVM)
set(LLVM_ROOT_DIR ${LIBDIR}/llvm)
set(LLVM_VERSION 3.4)
set(LLVM_ROOT_DIR ${LIBDIR}/llvm CACHE PATH "Path to the LLVM installation")
set(LLVM_VERSION "3.4" CACHE STRING "Version of LLVM to use")
if(EXISTS "${LLVM_ROOT_DIR}/bin/llvm-config")
set(LLVM_CONFIG "${LLVM_ROOT_DIR}/bin/llvm-config")
else()
@@ -368,7 +365,7 @@ if(WITH_LLVM)
endif()
if(WITH_CYCLES_OSL)
set(CYCLES_OSL ${LIBDIR}/osl)
set(CYCLES_OSL ${LIBDIR}/osl CACHE PATH "Path to OpenShadingLanguage installation")
find_library(OSL_LIB_EXEC NAMES oslexec PATHS ${CYCLES_OSL}/lib)
find_library(OSL_LIB_COMP NAMES oslcomp PATHS ${CYCLES_OSL}/lib)

View File

@@ -10,10 +10,6 @@
* \ingroup intern
*/
/** \defgroup clog C-Logging (CLOG)
* \ingroup intern
*/
/** \defgroup ctr container
* \ingroup intern
*/

View File

@@ -36,6 +36,62 @@
/* ================================ */
/** \defgroup bge Game Engine */
/** \defgroup gamelogic Game Logic
* \ingroup bge
*/
/** \defgroup bgeconv Converter
* \ingroup bge
*/
/** \defgroup blroutines Blender Routines
* \ingroup bge
*/
/** \defgroup expressions Expressions
* \ingroup bge
*/
/** \defgroup player Game Player
* \ingroup bge
*/
/** \defgroup ketsji Ketsji
* \ingroup bge
* \todo check all headers and code files for proper licenses
*/
/** \defgroup ketsjinet Ketsji Network
* \ingroup ketsji
*/
/** \defgroup bgenet Network
* \ingroup bge
*/
/** \defgroup bgenetlb Loopback Network
* \ingroup bgenet
*/
/** \defgroup phys Physics
* \ingroup bge
*/
/** \defgroup physbullet Bullet Physics
* \ingroup phys
*/
/** \defgroup physdummy Dummy Physics (none)
* \ingroup phys
*/
/** \defgroup bgerast Rasterizer
* \ingroup bge
*/
/** \defgroup bgerastoglfilters OpenGL Filters
* \ingroup bgerast
*/
/** \defgroup bgerastogl OpenGL Rasterizer
* \ingroup bgerast
*/
/** \defgroup bgesg BGE SceneGraph
* \ingroup bge
*/
/** \defgroup bgevideotex BGE Video Texture
* \ingroup bge
*/
/* ================================ */
/** \defgroup blender Blender */
/** \defgroup blt BlenTranslation
@@ -140,10 +196,6 @@
* \ingroup editors
*/
/** \defgroup edlattice lattice
* \ingroup editors
*/
/** \defgroup edmesh mesh
* \ingroup editors
*/
@@ -212,6 +264,10 @@
* \ingroup editors
*/
/** \defgroup splogic game logic editor
* \ingroup editors
*/
/** \defgroup spnla NLA editor
* \ingroup editors
*/
@@ -260,10 +316,6 @@
* \ingroup editors
*/
/** \defgroup edundo undo utilities
* \ingroup editors
*/
/** \defgroup spuv UV editing
* \ingroup editors
*/

View File

@@ -1,7 +1,7 @@
MEMORY MANAGEMENT IN BLENDER (guardedalloc)
-------------------------------------------
NOTE: This file does not cover memutil and smart pointers and reference counted
NOTE: This file does not cover memutil and smart pointers and rerefence counted
garbage collection, which are contained in the memutil module.
Blender takes care of dynamic memory allocation using a set of own functions
@@ -51,7 +51,7 @@ void MEM_printmemlist(void);
- if err_stream is set by MEM_set_error_stream() this function dumps a list of all
currently allocated memory blocks with length and name to the stream
bool MEM_consistency_check(void);
int MEM_check_memory_integrity(void);
- this function tests if the internal structures of the memory manager are intact
- returns 0 on success and !=0 on error

View File

@@ -0,0 +1,37 @@
"""
Basic Physics Constraint
++++++++++++++++++++++++
Example of how to create a hinge Physics Constraint between two objects.
"""
from bge import logic
from bge import constraints
# get object list
objects = logic.getCurrentScene().objects
# get object named Object1 and Object 2
object_1 = objects["Object1"]
object_2 = objects["Object2"]
# want to use Edge constraint type
constraint_type = 2
# get Object1 and Object2 physics IDs
physics_id_1 = object_1.getPhysicsId()
physics_id_2 = object_2.getPhysicsId()
# use bottom right edge of Object1 for hinge position
edge_position_x = 1.0
edge_position_y = 0.0
edge_position_z = -1.0
# rotate the pivot z axis about 90 degrees
edge_angle_x = 0.0
edge_angle_y = 0.0
edge_angle_z = 90.0
# create an edge constraint
constraints.createConstraint(physics_id_1, physics_id_2,
constraint_type,
edge_position_x, edge_position_y, edge_position_z,
edge_angle_x, edge_angle_y, edge_angle_z)

View File

@@ -0,0 +1,40 @@
"""
Texture Replacement
+++++++++++++++++++
Example of how to replace a texture in game with an external image.
``createTexture()`` and ``removeTexture()`` are to be called from a
module Python Controller.
"""
from bge import logic
from bge import texture
def createTexture(cont):
"""Create a new Dynamic Texture"""
obj = cont.owner
# get the reference pointer (ID) of the internal texture
ID = texture.materialID(obj, 'IMoriginal.png')
# create a texture object
object_texture = texture.Texture(obj, ID)
# create a new source with an external image
url = logic.expandPath("//newtexture.jpg")
new_source = texture.ImageFFmpeg(url)
# the texture has to be stored in a permanent Python object
logic.texture = object_texture
# update/replace the texture
logic.texture.source = new_source
logic.texture.refresh(False)
def removeTexture(cont):
"""Delete the Dynamic Texture, reversing back the final to its original state."""
try:
del logic.texture
except:
pass

View File

@@ -0,0 +1,237 @@
"""
Video Capture with DeckLink
+++++++++++++++++++++++++++
Video frames captured with DeckLink cards have pixel formats that are generally not directly
usable by OpenGL, they must be processed by a shader. The three shaders presented here should
cover all common video capture cases.
This file reflects the current video transfer method implemented in the Decklink module:
whenever possible the video images are transferred as float texture because this is more
compatible with GPUs. Of course, only the pixel formats that have a correspondant GL format
can be transferred as float. Look for fg_shaders in this file for an exhaustive list.
Other pixel formats will be transferred as 32 bits integer red-channel texture but this
won't work with certain GPU (Intel GMA); the corresponding shaders are not shown here.
However, it should not be necessary to use any of them as the list below covers all practical
cases of video capture with all types of Decklink product.
In other words, only use one of the pixel format below and you will be fine. Note that depending
on the video stream, only certain pixel formats will be allowed (others will throw an exception).
For example, to capture a PAL video stream, you must use one of the YUV formats.
To find which pixel format is suitable for a particular video stream, use the 'Media Express'
utility that comes with the Decklink software : if you see the video in the 'Log and Capture'
Window, you have selected the right pixel format and you can use the same in Blender.
Notes: * these shaders only decode the RGB channel and set the alpha channel to a fixed
value (look for color.a = ). It's up to you to add postprocessing to the color.
* these shaders are compatible with 2D and 3D video stream
"""
import bge
from bge import logic
from bge import texture as vt
# The default vertex shader, because we need one
#
VertexShader = """
#version 130
void main()
{
gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
gl_TexCoord[0] = gl_MultiTexCoord0;
}
"""
# For use with RGB video stream: the pixel is directly usable
#
FragmentShader_R10l = """
#version 130
uniform sampler2D tex;
// stereo = 1.0 if 2D image, =0.5 if 3D (left eye below, right eye above)
uniform float stereo;
// eye = 0.0 for the left eye, 0.5 for the right eye
uniform float eye;
void main(void)
{
vec4 color;
float tx, ty;
tx = gl_TexCoord[0].x;
ty = eye+gl_TexCoord[0].y*stereo;
color = texture(tex, vec2(tx,ty));
color.a = 0.7;
gl_FragColor = color;
}
"""
# For use with YUV video stream
#
FragmentShader_2vuy = """
#version 130
uniform sampler2D tex;
// stereo = 1.0 if 2D image, =0.5 if 3D (left eye below, right eye above)
uniform float stereo;
// eye = 0.0 for the left eye, 0.5 for the right eye
uniform float eye;
void main(void)
{
vec4 color;
float tx, ty, width, Y, Cb, Cr;
int px;
tx = gl_TexCoord[0].x;
ty = eye+gl_TexCoord[0].y*stereo;
width = float(textureSize(tex, 0).x);
color = texture(tex, vec2(tx, ty));
px = int(floor(fract(tx*width)*2.0));
switch (px) {
case 0:
Y = color.g;
break;
case 1:
Y = color.a;
break;
}
Y = (Y - 0.0625) * 1.168949772;
Cb = (color.b - 0.0625) * 1.142857143 - 0.5;
Cr = (color.r - 0.0625) * 1.142857143 - 0.5;
color.r = Y + 1.5748 * Cr;
color.g = Y - 0.1873 * Cb - 0.4681 * Cr;
color.b = Y + 1.8556 * Cb;
color.a = 0.7;
gl_FragColor = color;
}
"""
# For use with high resolution YUV
#
FragmentShader_v210 = """
#version 130
uniform sampler2D tex;
// stereo = 1.0 if 2D image, =0.5 if 3D (left eye below, right eye above)
uniform float stereo;
// eye = 0.0 for the left eye, 0.5 for the right eye
uniform float eye;
void main(void)
{
vec4 color, color1, color2, color3;
int px;
float tx, ty, width, sx, dx, bx, Y, Cb, Cr;
tx = gl_TexCoord[0].x;
ty = eye+gl_TexCoord[0].y*stereo;
width = float(textureSize(tex, 0).x);
// to sample macro pixels (6 pixels in 4 words)
sx = tx*width*0.25+0.01;
// index of display pixel in the macro pixel 0..5
px = int(floor(fract(sx)*6.0));
// increment as we sample the macro pixel
dx = 1.0/width;
// base x coord of macro pixel
bx = (floor(sx)+0.01)*dx*4.0;
color = texture(tex, vec2(bx, ty));
color1 = texture(tex, vec2(bx+dx, ty));
color2 = texture(tex, vec2(bx+dx*2.0, ty));
color3 = texture(tex, vec2(bx+dx*3.0, ty));
switch (px) {
case 0:
case 1:
Cb = color.b;
Cr = color.r;
break;
case 2:
case 3:
Cb = color1.g;
Cr = color2.b;
break;
default:
Cb = color2.r;
Cr = color3.g;
break;
}
switch (px) {
case 0:
Y = color.g;
break;
case 1:
Y = color1.b;
break;
case 2:
Y = color1.r;
break;
case 3:
Y = color2.g;
break;
case 4:
Y = color3.b;
break;
default:
Y = color3.r;
break;
}
Y = (Y - 0.0625) * 1.168949772;
Cb = (Cb - 0.0625) * 1.142857143 - 0.5;
Cr = (Cr - 0.0625) * 1.142857143 - 0.5;
color.r = Y + 1.5748 * Cr;
color.g = Y - 0.1873 * Cb - 0.4681 * Cr;
color.b = Y + 1.8556 * Cb;
color.a = 0.7;
gl_FragColor = color;
}
"""
# The exhausitve list of pixel formats that are transferred as float texture
# Only use those for greater efficiency and compatiblity.
#
fg_shaders = {
'2vuy' :FragmentShader_2vuy,
'8BitYUV' :FragmentShader_2vuy,
'v210' :FragmentShader_v210,
'10BitYUV' :FragmentShader_v210,
'8BitBGRA' :FragmentShader_R10l,
'BGRA' :FragmentShader_R10l,
'8BitARGB' :FragmentShader_R10l,
'10BitRGBXLE':FragmentShader_R10l,
'R10l' :FragmentShader_R10l
}
#
# Helper function to attach a pixel shader to the material that receives the video frame.
#
def config_video(obj, format, pixel, is3D=False, mat=0, card=0):
if pixel not in fg_shaders:
raise('Unsuported shader')
shader = obj.meshes[0].materials[mat].getShader()
if shader is not None and not shader.isValid():
shader.setSource(VertexShader, fg_shaders[pixel], True)
shader.setSampler('tex', 0)
shader.setUniformEyef("eye")
shader.setUniform1f("stereo", 0.5 if is3D else 1.0)
tex = vt.Texture(obj, mat)
tex.source = vt.VideoDeckLink(format + "/" + pixel + ("/3D" if is3D else ""), card)
print("frame rate: ", tex.source.framerate)
tex.source.play()
obj["video"] = tex
#
# Attach this function to an object that has a material with texture
# and call it once to initialize the object
#
def init(cont):
# config_video(cont.owner, 'HD720p5994', '8BitBGRA')
# config_video(cont.owner, 'HD720p5994', '8BitYUV')
# config_video(cont.owner, 'pal ', '10BitYUV')
config_video(cont.owner, 'pal ', '8BitYUV')
#
# To be called on every frame
#
def play(cont):
obj = cont.owner
video = obj.get("video")
if video is not None:
video.refresh(True)

View File

@@ -0,0 +1,33 @@
"""
Basic Video Playback
++++++++++++++++++++
Example of how to replace a texture in game with a video. It needs to run
everyframe.
"""
import bge
from bge import texture
from bge import logic
cont = logic.getCurrentController()
obj = cont.owner
# the creation of the texture must be done once: save the
# texture object in an attribute of bge.logic module makes it persistent
if not hasattr(logic, 'video'):
# identify a static texture by name
matID = texture.materialID(obj, 'IMvideo.png')
# create a dynamic texture that will replace the static texture
logic.video = texture.Texture(obj, matID)
# define a source of image for the texture, here a movie
movie = logic.expandPath('//trailer_400p.ogg')
logic.video.source = texture.VideoFFmpeg(movie)
logic.video.source.scale = True
# quick off the movie, but it wont play in the background
logic.video.source.play()
# you need to call this function every frame to ensure update of the texture.
logic.video.refresh(True)

View File

@@ -2,44 +2,43 @@
Hello World Text Example
++++++++++++++++++++++++
Example of using the blf module. For this module to work we
Blender Game Engine example of using the blf module. For this module to work we
need to use the OpenGL wrapper :class:`~bgl` as well.
"""
# import game engine modules
from bge import render
from bge import logic
# import stand alone modules
import bgl
import blf
import bpy
font_info = {
"font_id": 0,
"handler": None,
}
def init():
"""init function - runs once"""
import os
# Create a new font object, use external ttf file.
font_path = bpy.path.abspath('//Zeyada.ttf')
# Store the font indice - to use later.
if os.path.exists(font_path):
font_info["font_id"] = blf.load(font_path)
else:
# Default font.
font_info["font_id"] = 0
# create a new font object, use external ttf file
font_path = logic.expandPath('//Zeyada.ttf')
# store the font indice - to use later
logic.font_id = blf.load(font_path)
# set the font drawing routine to run every frame
font_info["handler"] = bpy.types.SpaceView3D.draw_handler_add(
draw_callback_px, (None, None), 'WINDOW', 'POST_PIXEL')
scene = logic.getCurrentScene()
scene.post_draw = [write]
def draw_callback_px(self, context):
"""Draw on the viewports"""
def write():
"""write on screen"""
width = render.getWindowWidth()
height = render.getWindowHeight()
# OpenGL setup
bgl.glMatrixMode(bgl.GL_PROJECTION)
bgl.glLoadIdentity()
bgl.gluOrtho2D(0, width, 0, height)
bgl.glMatrixMode(bgl.GL_MODELVIEW)
bgl.glLoadIdentity()
# BLF drawing routine
font_id = font_info["font_id"]
blf.position(font_id, 2, 80, 0)
font_id = logic.font_id
blf.position(font_id, (width * 0.2), (height * 0.3), 0)
blf.size(font_id, 50, 72)
blf.draw(font_id, "Hello World")
if __name__ == '__main__':
init()

View File

@@ -2,56 +2,30 @@
Operator Example
++++++++++++++++
A common use of custom properties is for python based :class:`Operator`
classes. Test this code by running it in the text editor, or by clicking the
button in the 3D Viewport's Tools panel. The latter will show the properties
in the Redo panel and allow you to change them.
A common use of custom properties is for python based :class:`Operator` classes.
"""
import bpy
class OBJECT_OT_property_example(bpy.types.Operator):
bl_idname = "object.property_example"
class DialogOperator(bpy.types.Operator):
bl_idname = "object.dialog_operator"
bl_label = "Property Example"
bl_options = {'REGISTER', 'UNDO'}
my_float = bpy.props.FloatProperty(name="Some Floating Point")
my_bool = bpy.props.BoolProperty(name="Toggle Option")
my_string = bpy.props.StringProperty(name="String Value")
def execute(self, context):
self.report({'INFO'}, 'F: %.2f B: %s S: %r' %
(self.my_float, self.my_bool, self.my_string))
print('My float:', self.my_float)
print('My bool:', self.my_bool)
print('My string:', self.my_string)
print("Dialog Runs")
return {'FINISHED'}
class OBJECT_PT_property_example(bpy.types.Panel):
bl_idname = "object_PT_property_example"
bl_label = "Property Example"
bl_space_type = 'VIEW_3D'
bl_region_type = 'TOOLS'
bl_category = "Tools"
def draw(self, context):
# You can set the property values that should be used when the user
# presses the button in the UI.
props = self.layout.operator('object.property_example')
props.my_bool = True
props.my_string = "Shouldn't that be 47?"
# You can set properties dynamically:
if context.object:
props.my_float = context.object.location.x
else:
props.my_float = 327
def invoke(self, context, event):
wm = context.window_manager
return wm.invoke_props_dialog(self)
bpy.utils.register_class(OBJECT_OT_property_example)
bpy.utils.register_class(OBJECT_PT_property_example)
bpy.utils.register_class(DialogOperator)
# Demo call. Be sure to also test in the 3D Viewport.
bpy.ops.object.property_example(my_float=47, my_bool=True,
my_string="Shouldn't that be 327?")
# test call
bpy.ops.object.dialog_operator('INVOKE_DEFAULT')

View File

@@ -1,12 +1,13 @@
"""
Getter/Setter Example
+++++++++++++++++++++
Get/Set Example
+++++++++++++++
Getter/setter functions can be used for boolean, int, float, string and enum properties.
Get/Set functions can be used for boolean, int, float, string and enum properties.
If these callbacks are defined the property will not be stored in the ID properties
automatically. Instead, the `get` and `set` functions will be called when the property
is respectively read or written from the API.
automatically, instead the get/set functions will be called when the property is
read or written from the API.
"""
import bpy
@@ -64,24 +65,25 @@ def set_enum(self, value):
bpy.types.Scene.test_enum = bpy.props.EnumProperty(items=test_items, get=get_enum, set=set_enum)
# Testing the properties:
# Testing
scene = bpy.context.scene
scene.test_float = 12.34
print('test_float:', scene.test_float)
print(scene.test_float)
scene.test_array = (True, False)
print('test_array:', tuple(scene.test_array))
print([x for x in scene.test_array])
# scene.test_date = "blah" # this would fail, property is read-only
print('test_date:', scene.test_date)
print(scene.test_date)
scene.test_enum = 'BLUE'
print('test_enum:', scene.test_enum)
print(scene.test_enum)
# The above outputs:
# test_float: 12.34000015258789
# test_array: (True, False)
# test_date: 2018-03-14 11:36:53.158653
# setting value 3
# test_enum: GREEN
# >>> 12.34000015258789
# >>> [True, False]
# >>> 2013-01-05 16:33:52.135340
# >>> setting value 3
# >>> GREEN

View File

@@ -0,0 +1,49 @@
Application Data (bge.app)
==========================
Module to access application values that remain unchanged during runtime.
.. module:: bge.app
.. data:: version
The Blender/BGE version as a tuple of 3 ints, eg. (2, 75, 1).
.. note::
Version tuples can be compared simply with (in)equality symbols;
for example, ``(2, 74, 5) <= (2, 75, 0)`` returns True (lexical order).
:type: tuple of three ints
.. data:: version_string
The Blender/BGE version formatted as a string, eg. "2.75 (sub 1)".
:type: str
.. data:: version_char
The Blender/BGE version character (for minor releases).
:type: str
.. data:: has_texture_ffmpeg
True if the BGE has been built with FFmpeg support,
enabling use of :class:`~bge.texture.ImageFFmpeg` and :class:`~bge.texture.VideoFFmpeg`.
:type: bool
.. data:: has_joystick
True if the BGE has been built with joystick support.
:type: bool
.. data:: has_physics
True if the BGE has been built with physics support.
:type: bool

View File

@@ -0,0 +1,336 @@
Physics Constraints (bge.constraints)
=====================================
.. module:: bge.constraints
Examples
--------
.. include:: __/examples/bge.constraints.py
:start-line: 1
:end-line: 4
.. literalinclude:: __/examples/bge.constraints.py
:lines: 6-
Functions
---------
.. function:: createConstraint( \
physicsid_1, physicsid_2, constraint_type, \
pivot_x=0.0, pivot_y=0.0, pivot_z=0.0, \
axis_x=0.0, axis_y=0.0, axis_z=0.0, flag=0)
Creates a constraint.
:arg physicsid_1: The physics id of the first object in constraint.
:type physicsid_1: int
:arg physicsid_2: The physics id of the second object in constraint.
:type physicsid_2: int
:arg constraint_type: The type of the constraint, see `Create Constraint Constants`_.
:type constraint_type: int
:arg pivot_x: Pivot X position. (optional)
:type pivot_x: float
:arg pivot_y: Pivot Y position. (optional)
:type pivot_y: float
:arg pivot_z: Pivot Z position. (optional)
:type pivot_z: float
:arg axis_x: X axis angle in degrees. (optional)
:type axis_x: float
:arg axis_y: Y axis angle in degrees. (optional)
:type axis_y: float
:arg axis_z: Z axis angle in degrees. (optional)
:type axis_z: float
:arg flag: 128 to disable collision between linked bodies. (optional)
:type flag: int
:return: A constraint wrapper.
:rtype: :class:`~bge.types.KX_ConstraintWrapper`
.. function:: exportBulletFile(filename)
Exports a file representing the dynamics world (usually using ``.bullet`` extension).
See `Bullet binary serialization <http://bulletphysics.org/mediawiki-1.5.8/index.php/Bullet_binary_serialization>`__.
:arg filename: File path.
:type filename: str
.. function:: getAppliedImpulse(constraintId)
:arg constraintId: The id of the constraint.
:type constraintId: int
:return: The most recent applied impulse.
:rtype: float
.. function:: getVehicleConstraint(constraintId)
:arg constraintId: The id of the vehicle constraint.
:type constraintId: int
:return: A vehicle constraint object.
:rtype: :class:`~bge.types.KX_VehicleWrapper`
.. function:: getCharacter(gameobj)
:arg gameobj: The game object with the character physics.
:type gameobj: :class:`~bge.types.KX_GameObject`
:return: Character wrapper.
:rtype: :class:`~bge.types.KX_CharacterWrapper`
.. function:: removeConstraint(constraintId)
Removes a constraint.
:arg constraintId: The id of the constraint to be removed.
:type constraintId: int
.. function:: setCcdMode(ccdMode)
.. note::
Very experimental, not recommended
Sets the CCD (Continous Colision Detection) mode in the Physics Environment.
:arg ccdMode: The new CCD mode.
:type ccdMode: int
.. function:: setContactBreakingTreshold(breakingTreshold)
.. note::
Reasonable default is 0.02 (if units are meters)
Sets tresholds to do with contact point management.
:arg breakingTreshold: The new contact breaking treshold.
:type breakingTreshold: float
.. function:: setDeactivationAngularTreshold(angularTreshold)
Sets the angular velocity treshold.
:arg angularTreshold: New deactivation angular treshold.
:type angularTreshold: float
.. function:: setDeactivationLinearTreshold(linearTreshold)
Sets the linear velocity treshold.
:arg linearTreshold: New deactivation linear treshold.
:type linearTreshold: float
.. function:: setDeactivationTime(time)
Sets the time after which a resting rigidbody gets deactived.
:arg time: The deactivation time.
:type time: float
.. function:: setDebugMode(mode)
Sets the debug mode.
:arg mode: The new debug mode, see `Debug Mode Constants`_.
:type mode: int
.. function:: setGravity(x, y, z)
Sets the gravity force.
:arg x: Gravity X force.
:type x: float
:arg y: Gravity Y force.
:type y: float
:arg z: Gravity Z force.
:type z: float
.. function:: setLinearAirDamping(damping)
.. note::
Not implemented
Sets the linear air damping for rigidbodies.
.. function:: setNumIterations(numiter)
Sets the number of iterations for an iterative constraint solver.
:arg numiter: New number of iterations.
:type numiter: int
.. function:: setNumTimeSubSteps(numsubstep)
Sets the number of substeps for each physics proceed. Tradeoff quality for performance.
:arg numsubstep: New number of substeps.
:type numsubstep: int
.. function:: setSolverDamping(damping)
.. note::
Very experimental, not recommended
Sets the damper constant of a penalty based solver.
:arg damping: New damping for the solver.
:type damping: float
.. function:: setSolverTau(tau)
.. note::
Very experimental, not recommended
Sets the spring constant of a penalty based solver.
:arg tau: New tau for the solver.
:type tau: float
.. function:: setSolverType(solverType)
.. note::
Very experimental, not recommended
Sets the solver type.
:arg solverType: The new type of the solver.
:type solverType: int
.. function:: setSorConstant(sor)
.. note::
Very experimental, not recommended
Sets the successive overrelaxation constant.
:arg sor: New sor value.
:type sor: float
.. function:: setUseEpa(epa)
.. note::
Not implemented
Constants
+++++++++
.. attribute:: error
Symbolic constant string that indicates error.
:type: str
Debug Mode Constants
^^^^^^^^^^^^^^^^^^^^
Debug mode to be used with :func:`setDebugMode`.
.. data:: DBG_NODEBUG
No debug.
.. data:: DBG_DRAWWIREFRAME
Draw wireframe in debug.
.. data:: DBG_DRAWAABB
Draw Axis Aligned Bounding Box in debug.
.. data:: DBG_DRAWFREATURESTEXT
Draw features text in debug.
.. data:: DBG_DRAWCONTACTPOINTS
Draw contact points in debug.
.. data:: DBG_NOHELPTEXT
Debug without help text.
.. data:: DBG_DRAWTEXT
Draw text in debug.
.. data:: DBG_PROFILETIMINGS
Draw profile timings in debug.
.. data:: DBG_ENABLESATCOMPARISION
Enable sat comparision in debug.
.. data:: DBG_DISABLEBULLETLCP
Disable Bullet LCP.
.. data:: DBG_ENABLECCD
Enable Continous Collision Detection in debug.
.. data:: DBG_DRAWCONSTRAINTS
Draw constraints in debug.
.. data:: DBG_DRAWCONSTRAINTLIMITS
Draw constraint limits in debug.
.. data:: DBG_FASTWIREFRAME
Draw a fast wireframe in debug.
Create Constraint Constants
^^^^^^^^^^^^^^^^^^^^^^^^^^^
Constraint type to be used with :func:`createConstraint`.
.. data:: POINTTOPOINT_CONSTRAINT
.. to do
.. data:: LINEHINGE_CONSTRAINT
.. to do
.. data:: ANGULAR_CONSTRAINT
.. to do
.. data:: CONETWIST_CONSTRAINT
.. to do
.. data:: VEHICLE_CONSTRAINT
.. to do
.. data:: GENERIC_6DOF_CONSTRAINT
.. to do

View File

@@ -0,0 +1,250 @@
Game Keys (bge.events)
======================
*****
Intro
*****
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.events.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.events.keycode, key[1] = status
if status == bge.logic.KX_INPUT_JUST_ACTIVATED:
if key == bge.events.WKEY:
# Activate Forward!
if key == bge.events.SKEY:
# Activate Backward!
if key == bge.events.AKEY:
# Activate Left!
if key == bge.events.DKEY:
# Activate Right!
code-block:: python
# The all keys thing without a keyboard sensor (but you will
# need an always sensor with pulse mode on)
import bge
# Just shortening names here
keyboard = bge.logic.keyboard
JUST_ACTIVATED = bge.logic.KX_INPUT_JUST_ACTIVATED
if keyboard.events[bge.events.WKEY] == JUST_ACTIVATED:
print("Activate Forward!")
if keyboard.events[bge.events.SKEY] == JUST_ACTIVATED:
print("Activate Backward!")
if keyboard.events[bge.events.AKEY] == JUST_ACTIVATED:
print("Activate Left!")
if keyboard.events[bge.events.DKEY] == JUST_ACTIVATED:
print("Activate Right!")
*********
Functions
*********
.. function:: EventToString(event)
Return the string name of a key event. Will raise a ValueError error if its invalid.
:arg event: key event constant from :mod:`bge.events` 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 constant from :mod:`bge.events` or the keyboard sensor.
:type shift: bool
:arg shift: set to true if shift is held.
:rtype: string
****************
Keys (Constants)
****************
.. _mouse-keys:
==========
Mouse Keys
==========
.. data:: LEFTMOUSE
.. data:: MIDDLEMOUSE
.. data:: RIGHTMOUSE
.. data:: WHEELUPMOUSE
.. data:: WHEELDOWNMOUSE
.. data:: MOUSEX
.. data:: MOUSEY
.. _keyboard-keys:
=============
Keyboard Keys
=============
-------------
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 Keys
--------------
.. 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 (Deprecated: use bge.events.ENTERKEY)
.. data:: ENTERKEY
.. data:: SEMICOLONKEY
.. data:: SLASHKEY
.. data:: SPACEKEY
.. data:: TABKEY

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,425 @@
Rasterizer (bge.render)
=======================
*****
Intro
*****
.. module:: bge.render
Example of using a :class:`bge.types.SCA_MouseSensor`,
and two :class:`bge.types.KX_ObjectActuator` to implement MouseLook:
.. note::
This can also be achieved with the :class:`bge.types.KX_MouseActuator`.
.. code-block:: python
# To use a mouse movement sensor "Mouse" and a
# motion actuator to mouse look:
import bge
# scale sets the speed of motion
scale = 1.0, 0.5
co = bge.logic.getCurrentController()
obj = co.owner
mouse = co.sensors["Mouse"]
lmotion = co.actuators["LMove"]
wmotion = co.actuators["WMove"]
# Transform the mouse coordinates to see how far the mouse has moved.
def mousePos():
x = (bge.render.getWindowWidth() / 2 - mouse.position[0]) * scale[0]
y = (bge.render.getWindowHeight() / 2 - mouse.position[1]) * scale[1]
return (x, y)
pos = mousePos()
# Set the amount of motion: X is applied in world coordinates...
wmotion.useLocalTorque = False
wmotion.torque = ((0.0, 0.0, pos[0]))
# ...Y is applied in local coordinates
lmotion.useLocalTorque = True
lmotion.torque = ((-pos[1], 0.0, 0.0))
# Activate both actuators
co.activate(lmotion)
co.activate(wmotion)
# Centre the mouse
bge.render.setMousePosition(int(bge.render.getWindowWidth() / 2), int(bge.render.getWindowHeight() / 2))
*********
Constants
*********
.. 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.
.. DATA:: VSYNC_OFF
Disables vsync
.. DATA:: VSYNC_ON
Enables vsync
.. DATA:: VSYNC_ADAPTIVE
Enables adaptive vsync if supported.
Adaptive vsync enables vsync if the framerate is above the monitors refresh rate.
Otherwise, vsync is diabled if the framerate is too low.
.. data:: LEFT_EYE
Left eye being used during stereoscopic rendering.
.. data:: RIGHT_EYE
Right eye being used during stereoscopic rendering.
.. data:: RAS_OFS_RENDER_BUFFER
The pixel buffer for offscreen render is a RenderBuffer. Argument to :func:`offScreenCreate`
.. data:: RAS_OFS_RENDER_TEXTURE
The pixel buffer for offscreen render is a Texture. Argument to :func:`offScreenCreate`
*****
Types
*****
.. class:: RASOffScreen
An off-screen render buffer object.
Use :func:`offScreenCreate` to create it.
Currently it can only be used in the :class:`bge.texture.ImageRender`
constructor to render on a FBO rather than the default viewport.
.. attribute:: width
The width in pixel of the FBO
:type: integer
.. attribute:: height
The height in pixel of the FBO
:type: integer
.. attribute:: color
The underlying OpenGL bind code of the texture object that holds
the rendered image, 0 if the FBO is using RenderBuffer.
The choice between RenderBuffer and Texture is determined
by the target argument of :func:`offScreenCreate`.
:type: integer
*********
Functions
*********
.. 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:: setWindowSize(width, height)
Set the width and height of the window (in pixels). This also works for fullscreen applications.
.. note:: Only works in the standalone player, not the Blender-embedded player.
:arg width: width in pixels
:type width: integer
:arg height: height in pixels
:type height: integer
.. function:: setFullScreen(enable)
Set whether or not the window should be fullscreen.
.. note:: Only works in the standalone player, not the Blender-embedded player.
:arg enable: ``True`` to set full screen, ``False`` to set windowed.
:type enable: bool
.. function:: getFullScreen()
Returns whether or not the window is fullscreen.
.. note:: Only works in the standalone player, not the Blender-embedded player; there it always returns False.
:rtype: bool
.. function:: getDisplayDimensions()
Get the display dimensions, in pixels, of the display (e.g., the
monitor). Can return the size of the entire view, so the
combination of all monitors; for example, ``(3840, 1080)`` for two
side-by-side 1080p monitors.
:rtype: tuple (width, height)
.. function:: makeScreenshot(filename)
Writes an image file with the current displayed frame.
The image is written to *'filename'*.
The path may be absolute (eg. ``/home/foo/image``) or relative when started with
``//`` (eg. ``//image``). Note that absolute paths are not portable between platforms.
If the filename contains a ``#``,
it will be replaced by an incremental index so that screenshots can be taken multiple
times without overwriting the previous ones (eg. ``image-#``).
Settings for the image are taken from the render settings (file format and respective settings,
gamma and colospace conversion, etc).
The image resolution matches the framebuffer, meaning, the window size and aspect ratio.
When running from the standalone player, instead of the embedded player, only PNG files are supported.
Additional color conversions are also not supported.
:arg filename: path and name of the file to write
:type filename: string
.. function:: enableVisibility(visible)
Deprecated; doesn't do anything.
.. function:: showMouse(visible)
Enables or disables the operating system mouse cursor.
:arg visible:
:type visible: boolean
.. function:: setMousePosition(x, y)
Sets the mouse cursor position.
:arg x: X-coordinate in screen pixel coordinates.
:type x: integer
:arg y: Y-coordinate in screen pixel coordinates.
:type y: integer
.. function:: setBackgroundColor(rgba)
Deprecated and no longer functional. Use :py:meth:`bge.types.KX_WorldInfo.backgroundColor` instead.
.. 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:: getStereoEye()
Gets the current stereoscopy eye being rendered.
This function is mainly used in a :class:`bge.types.KX_Scene.pre_draw` callback
function to customize the camera projection matrices for each
stereoscopic eye.
:rtype: LEFT_EYE, RIGHT_EYE
.. function:: setMaterialMode(mode)
Set the material mode to use for OpenGL rendering.
:arg mode: material mode
: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.
:arg setting:
:type setting: string (lights, shaders, shadows, ramps, nodes, extra_textures)
:arg enable:
:type enable: boolean
.. function:: getGLSLMaterialSetting(setting)
Get the state of a GLSL material setting.
:arg setting:
:type setting: string (lights, shaders, shadows, ramps, nodes, extra_textures)
:rtype: boolean
.. function:: setAnisotropicFiltering(level)
Set the anisotropic filtering level for textures.
:arg level: The new anisotropic filtering level to use
:type level: integer (must be one of 1, 2, 4, 8, 16)
.. note:: Changing this value can cause all textures to be recreated, which can be slow.
.. function:: getAnisotropicFiltering()
Get the anisotropic filtering level used for textures.
:rtype: integer (one of 1, 2, 4, 8, 16)
.. function:: setMipmapping(value)
Change how to use mipmapping.
:type value: RAS_MIPMAP_NONE, RAS_MIPMAP_NEAREST, RAS_MIPMAP_LINEAR
.. note:: Changing this value can cause all textures to be recreated, which can be slow.
.. function:: getMipmapping()
Get the current mipmapping setting.
:rtype: RAS_MIPMAP_NONE, RAS_MIPMAP_NEAREST, RAS_MIPMAP_LINEAR
.. 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 blur effect.
:arg factor: the ammount of motion blur to display.
:type factor: float [0.0 - 1.0]
.. function:: disableMotionBlur()
Disable the motion blur effect.
.. function:: showFramerate(enable)
Show or hide the framerate.
:arg enable:
:type enable: boolean
.. function:: showProfile(enable)
Show or hide the profile.
:arg enable:
:type enable: boolean
.. function:: showProperties(enable)
Show or hide the debug properties.
:arg enable:
:type enable: boolean
.. function:: autoDebugList(enable)
Enable or disable auto adding debug properties to the debug list.
:arg enable:
:type enable: boolean
.. function:: clearDebugList()
Clears the debug property list.
.. function:: setVsync(value)
Set the vsync value
:arg value: One of VSYNC_OFF, VSYNC_ON, VSYNC_ADAPTIVE
:type value: integer
.. function:: getVsync()
Get the current vsync value
:rtype: One of VSYNC_OFF, VSYNC_ON, VSYNC_ADAPTIVE
.. function:: offScreenCreate(width,height[,samples=0][,target=bge.render.RAS_OFS_RENDER_BUFFER])
Create a Off-screen render buffer object.
:arg width: the width of the buffer in pixels
:type width: integer
:arg height: the height of the buffer in pixels
:type height: integer
:arg samples: the number of multisample for anti-aliasing (MSAA), 0 to disable MSAA
:type samples: integer
:arg target: the pixel storage: :data:`RAS_OFS_RENDER_BUFFER` to render on RenderBuffers (the default),
:data:`RAS_OFS_RENDER_TEXTURE` to render on texture.
The later is interesting if you want to access the texture directly (see :attr:`RASOffScreen.color`).
Otherwise the default is preferable as it's more widely supported by GPUs and more efficient.
If the GPU does not support MSAA+Texture (e.g. Intel HD GPU), MSAA will be disabled.
:type target: integer
:rtype: :class:`RASOffScreen`

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,38 @@
Game Types (bge.types)
======================
.. module:: bge.types
************
Introduction
************
This module contains the classes that appear as instances in the Game Engine. A
script must interact with these classes if it is to affect the behaviour of
objects in a game.
The following example would move an object (i.e. an instance of
:class:`KX_GameObject`) one unit up.
.. code-block:: python
# bge.types.SCA_PythonController
cont = bge.logic.getCurrentController()
# bge.types.KX_GameObject
obj = cont.owner
obj.worldPosition.z += 1
To run the code, it could be placed in a Blender text block and executed with
a :class:`SCA_PythonController` logic brick.
*****
Types
*****
.. toctree::
:glob:
bge.types.*

View File

@@ -0,0 +1,78 @@
BL_ActionActuator(SCA_IActuator)
================================
.. module:: bge.types
base class --- :class:`SCA_IActuator`
.. 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:: 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. Can be one of :ref:`these constants<action-actuator>`.
: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

View File

@@ -0,0 +1,61 @@
BL_ArmatureActuator(SCA_IActuator)
==================================
.. module:: bge.types
base class --- :class:`SCA_IActuator`
.. class:: BL_ArmatureActuator(SCA_IActuator)
Armature Actuators change constraint condition on armatures.
.. attribute:: type
The type of action that the actuator executes when it is active.
Can be one of :ref:`these constants <armatureactuator-constants-type>`
: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`)
.. attribute:: influence
The influence this actuator will set on the constraint it controls.
:type: float.

View File

@@ -0,0 +1,105 @@
BL_ArmatureBone(PyObjectPlus)
=============================
.. module:: bge.types
base class --- :class:`PyObjectPlus`
.. 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`

View File

@@ -0,0 +1,278 @@
BL_ArmatureChannel(PyObjectPlus)
================================
.. module:: bge.types
base class --- :class:`PyObjectPlus`
.. 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.
.. 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_quaternion
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:: rotation_euler
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 (one of :ref:`these constants <armaturechannel-constants-rotation-mode>`)
.. 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.
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.
:type: vector [x, y, z]
.. 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.

View File

@@ -0,0 +1,129 @@
BL_ArmatureConstraint(PyObjectPlus)
===================================
.. module:: bge.types
base class --- :class:`PyObjectPlus`
.. 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.
.. attribute:: type
Type of constraint, (read-only).
Use one of :ref:`these constants<armatureconstraint-constants-type>`.
: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.
:type: boolean
.. note::
An inactive constraint does not update lin_error and rot_error.
.. 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).
Use one of :ref:`these constants<armatureconstraint-constants-ik-type>`.
:type: integer.
.. attribute:: ik_flag
Combination of IK constraint option flags, read-only.
Use one of :ref:`these constants<armatureconstraint-constants-ik-flag>`.
: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
Use one of :ref:`these constants<armatureconstraint-constants-ik-mode>`.
Additional mode for IK constraint. Currently only used for Distance constraint:
:type: integer

View File

@@ -0,0 +1,34 @@
BL_ArmatureObject(KX_GameObject)
================================
.. module:: bge.types
base class --- :class:`KX_GameObject`
.. 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.

View File

@@ -0,0 +1,230 @@
BL_Shader(PyObjectPlus)
=======================
.. module:: bge.types
base class --- :class:`PyObjectPlus`
.. 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: boolean
.. 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: boolean
.. 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: boolean
.. 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:: setUniformEyef(name)
Set a uniform with a float value that reflects the eye being render in stereo mode:
0.0 for the left eye, 0.5 for the right eye. In non stereo mode, the value of the uniform
is fixed to 0.0. The typical use of this uniform is in stereo mode to sample stereo textures
containing the left and right eye images in a top-bottom order.
:arg name: the uniform name
:type name: string
.. method:: validate()
Validate the shader object.

View File

@@ -0,0 +1,70 @@
BL_ShapeActionActuator(SCA_IActuator)
=====================================
.. module:: bge.types
base class --- :class:`SCA_IActuator`
.. 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. Can be one of :ref:`these constants<action-actuator>`.
:type: integer
.. attribute:: framePropName
The name of the property that is set to the current frame number.
:type: string

View File

@@ -0,0 +1,72 @@
CListValue(CPropValue)
======================
.. module:: bge.types
base class --- :class:`CPropValue`
.. class:: CListValue(CPropValue)
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:
.. code-block:: python
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.
.. warning::
The id can't be stored as an integer in game object properties, as those only have a limited range that the id may not be contained in. Instead an id can be stored as a string game property and converted back to an integer for use in from_id lookups.

View File

@@ -0,0 +1,11 @@
CPropValue(CValue)
==================
.. module:: bge.types
base class --- :class:`CValue`
.. class:: CPropValue(CValue)
This class has no python functions

View File

@@ -0,0 +1,17 @@
CValue(PyObjectPlus)
====================
.. module:: bge.types
base class --- :class:`PyObjectPlus`
.. class:: CValue(PyObjectPlus)
This class is a basis for other classes.
.. attribute:: name
The name of this CValue derived object (read-only).
:type: string

View File

@@ -0,0 +1,36 @@
KX_ArmatureSensor(SCA_ISensor)
==============================
.. module:: bge.types
base class --- :class:`SCA_ISensor`
.. class:: KX_ArmatureSensor(SCA_ISensor)
Armature sensor detect conditions on armatures.
.. attribute:: type
The type of measurement that the sensor make when it is active.
Can be one of :ref:`these constants <armaturesensor-type>`
:type: integer.
.. attribute:: constraint
The constraint object this sensor is watching.
:type: :class:`BL_ArmatureConstraint`
.. attribute:: 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: float

View File

@@ -0,0 +1,185 @@
KX_BlenderMaterial(PyObjectPlus)
================================
.. module:: bge.types
base class --- :class:`PyObjectPlus`
.. class:: KX_BlenderMaterial(PyObjectPlus)
This is the interface to materials in the game engine.
Materials define the render state to be applied to mesh objects.
The example below shows a simple GLSL shader setup allowing to dynamically mix two texture channels
in a material. All materials of the object executing this script should have two textures using
separate UV maps in the two first texture channels.
The code works for both Multitexture and GLSL rendering modes.
.. code-block:: python
from bge import logic
vertex_shader = """
void main(void)
{
// simple projection of the vertex position to view space
gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
// coordinate of the 1st texture channel
gl_TexCoord[0] = gl_MultiTexCoord0;
// coordinate of the 2nd texture channel
gl_TexCoord[1] = gl_MultiTexCoord1;
}
"""
fragment_shader ="""
uniform sampler2D texture_0;
uniform sampler2D texture_1;
uniform float factor;
void main(void)
{
vec4 color_0 = texture2D(texture_0, gl_TexCoord[0].st);
vec4 color_1 = texture2D(texture_1, gl_TexCoord[1].st);
gl_FragColor = mix(color_0, color_1, factor);
}
"""
object = logic.getCurrentController().owner
for mesh in object.meshes:
for material in mesh.materials:
shader = material.getShader()
if shader is not None:
if not shader.isValid():
shader.setSource(vertex_shader, fragment_shader, True)
# get the first texture channel of the material
shader.setSampler('texture_0', 0)
# get the second texture channel of the material
shader.setSampler('texture_1', 1)
# pass another uniform to the shader
shader.setUniform1f('factor', 0.3)
.. attribute:: shader
The material's shader.
:type: :class:`BL_Shader`
.. attribute:: blending
Ints used for pixel blending, (src, dst), matching the setBlending method.
:type: (integer, integer)
.. attribute:: material_index
The material's index.
:type: integer
.. method:: getShader()
Returns the material's shader.
:return: the material's shader
:rtype: :class:`BL_Shader`
.. method:: getTextureBindcode(textureslot)
Returns the material's texture OpenGL bind code/id/number/name.
:arg textureslot: Specifies the texture slot number
:type textureslot: integer
:return: the material's texture OpenGL bind code/id/number/name
:rtype: integer
.. attribute:: alpha
The material's alpha transparency.
:type: float between 0.0 and 1.0 inclusive
.. attribute:: hardness
How hard (sharp) the material's specular reflection is.
:type: integer between 1 and 511 inclusive
.. attribute:: emit
Amount of light to emit.
:type: float between 0.0 and 2.0 inclusive
.. attribute:: specularIntensity
How intense (bright) the material's specular reflection is.
:type: float between 0.0 and 1.0 inclusive
.. attribute:: diffuseIntensity
The material's amount of diffuse reflection.
:type: float between 0.0 and 1.0 inclusive
.. attribute:: specularColor
The material's specular color.
:type: :class:`mathutils.Color`
.. attribute:: diffuseColor
The material's diffuse color.
:type: :class:`mathutils.Color`
.. 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, one of...
* :data:`~bgl.GL_ZERO`
* :data:`~bgl.GL_ONE`
* :data:`~bgl.GL_SRC_COLOR`
* :data:`~bgl.GL_ONE_MINUS_SRC_COLOR`
* :data:`~bgl.GL_DST_COLOR`
* :data:`~bgl.GL_ONE_MINUS_DST_COLOR`
* :data:`~bgl.GL_SRC_ALPHA`
* :data:`~bgl.GL_ONE_MINUS_SRC_ALPHA`
* :data:`~bgl.GL_DST_ALPHA`
* :data:`~bgl.GL_ONE_MINUS_DST_ALPHA`
* :data:`~bgl.GL_SRC_ALPHA_SATURATE`
:type src: int
:arg dest: Specifies how the red, green, blue, and alpha destination blending factors are computed, one of...
* :data:`~bgl.GL_ZERO`
* :data:`~bgl.GL_ONE`
* :data:`~bgl.GL_SRC_COLOR`
* :data:`~bgl.GL_ONE_MINUS_SRC_COLOR`
* :data:`~bgl.GL_DST_COLOR`
* :data:`~bgl.GL_ONE_MINUS_DST_COLOR`
* :data:`~bgl.GL_SRC_ALPHA`
* :data:`~bgl.GL_ONE_MINUS_SRC_ALPHA`
* :data:`~bgl.GL_DST_ALPHA`
* :data:`~bgl.GL_ONE_MINUS_DST_ALPHA`
* :data:`~bgl.GL_SRC_ALPHA_SATURATE`
:type dest: int
.. method:: getMaterialIndex()
Returns the material's index.
:return: the material's index
:rtype: integer

View File

@@ -0,0 +1,302 @@
KX_Camera(KX_GameObject)
========================
.. module:: bge.types
base class --- :class:`KX_GameObject`
.. class:: KX_Camera(KX_GameObject)
A Camera object.
.. data:: INSIDE
See :data:`sphereInsideFrustum` and :data:`boxInsideFrustum`
.. data:: INTERSECT
See :data:`sphereInsideFrustum` and :data:`boxInsideFrustum`
.. data:: OUTSIDE
See :data:`sphereInsideFrustum` and :data:`boxInsideFrustum`
.. attribute:: lens
The camera's lens value.
:type: float
.. attribute:: fov
The camera's field of view value.
:type: float
.. attribute:: ortho_scale
The camera's view scale when in orthographic mode.
:type: float
.. attribute:: near
The camera's near clip distance.
:type: float
.. attribute:: far
The camera's far clip distance.
:type: float
.. attribute:: shift_x
The camera's horizontal shift.
:type: float
.. attribute:: shift_y
The camera's vertical shift.
: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.
.. note::
This is the identity matrix prior to rendering the first frame (any Python done on frame 1).
: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. Also, this is the identity matrix prior to rendering the first frame (any Python done on frame 1).
.. 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: :data:`~bge.types.KX_Camera.INSIDE`, :data:`~bge.types.KX_Camera.OUTSIDE` or :data:`~bge.types.KX_Camera.INTERSECT`
:rtype: integer
.. note::
When the camera is first initialized the result will be invalid because the projection matrix has not been set.
.. code-block:: python
from bge import logic
cont = logic.getCurrentController()
cam = cont.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
.. method:: boxInsideFrustum(box)
Tests the given box against the view frustum.
:arg box: Eight (8) corner points of the box (in world coordinates.)
:type box: list of lists
:return: :data:`~bge.types.KX_Camera.INSIDE`, :data:`~bge.types.KX_Camera.OUTSIDE` or :data:`~bge.types.KX_Camera.INTERSECT`
.. note::
When the camera is first initialized the result will be invalid because the projection matrix has not been set.
.. code-block:: python
from bge import logic
cont = logic.getCurrentController()
cam = cont.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 !
.. method:: pointInsideFrustum(point)
Tests the given point against the view 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.
.. code-block:: python
from bge import logic
cont = logic.getCurrentController()
cam = cont.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 !
.. 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.
:arg x: X Axis
:type x: float
:arg y: Y Axis
:type y: float
:rtype: 3D Vector
:return: The vector from screen coordinate.
.. code-block:: python
# Gets the vector of the camera front direction:
m_vect = camera.getScreenVect(0.5, 0.5)
.. 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.
: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
.. 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")

View File

@@ -0,0 +1,47 @@
KX_CameraActuator(SCA_IActuator)
================================
.. module:: bge.types
base class --- :class:`SCA_IActuator`
.. class:: KX_CameraActuator(SCA_IActuator)
Applies changes to a camera.
.. attribute:: damping
strength of of the camera following movement.
:type: float
.. attribute:: axis
The camera axis (0, 1, 2) for positive ``XYZ``, (3, 4, 5) for negative ``XYZ``.
:type: int
.. 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:: object
the object this actuator tracks.
:type: :class:`KX_GameObject` or None

View File

@@ -0,0 +1,45 @@
KX_CharacterWrapper(PyObjectPlus)
=================================
.. module:: bge.types
base class --- :class:`PyObjectPlus`
.. class:: KX_CharacterWrapper(PyObjectPlus)
A wrapper to expose character physics options.
.. attribute:: onGround
Whether or not the character is on the ground. (read-only)
:type: boolean
.. attribute:: gravity
The gravity value used for the character.
:type: float
.. attribute:: maxJumps
The maximum number of jumps a character can perform before having to touch the ground. By default this is set to 1. 2 allows for a double jump, etc.
:type: int in [0, 255], default 1
.. attribute:: jumpCount
The current jump count. This can be used to have different logic for a single jump versus a double jump. For example, a different animation for the second jump.
:type: int
.. attribute:: walkDirection
The speed and direction the character is traveling in using world coordinates. This should be used instead of applyMovement() to properly move the character.
:type: Vector((x, y, z))
.. method:: jump()
The character jumps based on it's jump speed.

View File

@@ -0,0 +1,78 @@
KX_ConstraintActuator(SCA_IActuator)
====================================
.. module:: bge.types
base class --- :class:`SCA_IActuator`
.. class:: KX_ConstraintActuator(SCA_IActuator)
A constraint actuator limits the position, rotation, distance or orientation of an object.
.. 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 :ref:`these constants <constraint-actuator-option>`
:type: integer
.. 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. Use one of the :ref:`these constants <constraint-actuator-limit>`
:type: integer.

View File

@@ -0,0 +1,143 @@
KX_ConstraintWrapper(PyObjectPlus)
==================================
.. module:: bge.types
base class --- :class:`PyObjectPlus`
.. class:: KX_ConstraintWrapper(PyObjectPlus)
KX_ConstraintWrapper
.. method:: getConstraintId(val)
Returns the contraint ID
:return: the constraint ID
:rtype: integer
.. method:: setParam(axis, value0, value1)
Set the contraint limits
:arg axis:
:type axis: integer
.. note::
* Lowerlimit == Upperlimit -> axis is locked
* Lowerlimit > Upperlimit -> axis is free
* Lowerlimit < Upperlimit -> axis it limited in that range
For PHY_LINEHINGE_CONSTRAINT = 2 or PHY_ANGULAR_CONSTRAINT = 3:
axis = 3 is a constraint limit, with low/high limit value
* 3: X axis angle
:arg value0 (min): Set the minimum limit of the axis
:type value0: float
:arg value1 (max): Set the maximum limit of the axis
:type value1: float
For PHY_CONE_TWIST_CONSTRAINT = 4:
axis = 3..5 are constraint limits, high limit values
* 3: X axis angle
* 4: Y axis angle
* 5: Z axis angle
:arg value0 (min): Set the minimum limit of the axis
:type value0: float
:arg value1 (max): Set the maximum limit of the axis
:type value1: float
For PHY_GENERIC_6DOF_CONSTRAINT = 12:
axis = 0..2 are constraint limits, with low/high limit value
* 0: X axis position
* 1: Y axis position
* 2: Z axis position
axis = 3..5 are relative constraint (Euler) angles in radians
* 3: X axis angle
* 4: Y axis angle
* 5: Z axis angle
:arg value0 (min): Set the minimum limit of the axis
:type value0: float
:arg value1 (max): Set the maximum limit of the axis
:type value1: float
axis = 6..8 are translational motors, with value0=target velocity, value1 = max motor force
* 6: X axis position
* 7: Y axis position
* 8: Z axis position
axis = 9..11 are rotational motors, with value0=target velocity, value1 = max motor force
* 9: X axis angle
* 10: Y axis angle
* 11: Z axis angle
:arg value0 (speed): Set the linear velocity of the axis
:type value0: float Range: -10,000.00 to 10,000.00
:arg value1 (force): Set the maximum force limit of the axis
:type value1: float Range: -10,000.00 to 10,000.00
axis = 12..14 are for linear springs on each of the position of freedom
* 12: X axis position
* 13: Y axis position
* 14: Z axis position
axis = 15..17 are for angular springs on each of the angle of freedom in radians
* 15: X axis angle
* 16: Y axis angle
* 17: Z axis angle
:arg value0 (stiffness): Set the stiffness of the spring
:type value0: float
:arg value1 (damping): Tendency of the spring to return to it's original position
:type value1: float
1.0 = springs back to original position (no damping)
0.0 = don't springs back
.. method:: getParam(axis)
Get the contraint position or euler angle of a generic 6DOF constraint
:arg axis:
:type axis: integer
axis = 0..2 are linear constraint values
* 0: X axis position
* 1: Y axis position
* 2: Z axis position
:return: position
:rtype: float
axis = 3..5 are relative constraint (Euler) angles in radians
* 3: X axis angle
* 4: Y axis angle
* 5: Z axis angle
:return: angle
:rtype: float
.. attribute:: constraint_id
Returns the contraint ID (read only)
:type: integer
.. attribute:: constraint_type
Returns the contraint type (read only)
:type: integer
- :class:`~bge.constraints.POINTTOPOINT_CONSTRAINT`
- :class:`~bge.constraints.LINEHINGE_CONSTRAINT`
- :class:`~bge.constraints.ANGULAR_CONSTRAINT`
- :class:`~bge.constraints.CONETWIST_CONSTRAINT`
- :class:`~bge.constraints.VEHICLE_CONSTRAINT`
- :class:`~bge.constraints.GENERIC_6DOF_CONSTRAINT`

View File

@@ -0,0 +1,32 @@
KX_FontObject(KX_GameObject)
============================
.. module:: bge.types
base class --- :class:`KX_GameObject`
.. class:: KX_FontObject(KX_GameObject)
A Font object.
.. code-block:: python
# Display a message about the exit key using a Font object.
import bge
co = bge.logic.getCurrentController()
font = co.owner
exit_key = bge.events.EventToString(bge.logic.getExitKey())
if exit_key.endswith("KEY"):
exit_key = exit_key[:-3]
font.text = "Press key '%s' to quit the game." % exit_key
.. attribute:: text
The text displayed by this Font object.
:type: string

View File

@@ -0,0 +1,23 @@
KX_GameActuator(SCA_IActuator)
==============================
.. module:: bge.types
base class --- :class:`SCA_IActuator`
.. class:: KX_GameActuator(SCA_IActuator)
The game actuator loads a new .blend file, restarts the current .blend file or quits the game.
.. attribute:: fileName
the new .blend file to load.
:type: string
.. attribute:: mode
The mode of this actuator. Can be on of :ref:`these constants <game-actuator>`
:type: Int

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,51 @@
KX_LibLoadStatus(PyObjectPlus)
==============================
.. module:: bge.types
base class --- :class:`PyObjectPlus`
.. class:: KX_LibLoadStatus(PyObjectPlus)
An object providing information about a LibLoad() operation.
.. code-block:: python
# Print a message when an async LibLoad is done
import bge
def finished_cb(status):
print("Library (%s) loaded in %.2fms." % (status.libraryName, status.timeTaken))
bge.logic.LibLoad('myblend.blend', 'Scene', async=True).onFinish = finished_cb
.. attribute:: onFinish
A callback that gets called when the lib load is done.
:type: callable
.. attribute:: finished
The current status of the lib load.
:type: boolean
.. attribute:: progress
The current progress of the lib load as a normalized value from 0.0 to 1.0.
:type: float
.. attribute:: libraryName
The name of the library being loaded (the first argument to LibLoad).
:type: string
.. attribute:: timeTaken
The amount of time, in seconds, the lib load took (0 until the operation is complete).
:type: float

View File

@@ -0,0 +1,164 @@
KX_LightObject(KX_GameObject)
=============================
.. module:: bge.types
base class --- :class:`KX_GameObject`
.. 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.color = [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:: shadowClipStart
The shadowmap clip start, below which objects will not generate shadows.
:type: float (read only)
.. attribute:: shadowClipEnd
The shadowmap clip end, beyond which objects will not generate shadows.
:type: float (read only)
.. attribute:: shadowFrustumSize
Size of the frustum used for creating the shadowmap.
:type: float (read only)
.. attribute:: shadowBindId
The OpenGL shadow texture bind number/id.
:type: int (read only)
.. attribute:: shadowMapType
The shadow shadow map type (0 -> Simple; 1 -> Variance)
:type: int (read only)
.. attribute:: shadowBias
The shadow buffer sampling bias.
:type: float (read only)
.. attribute:: shadowBleedBias
The bias for reducing light-bleed on variance shadow maps.
:type: float (read only)
.. attribute:: useShadow
Returns True if the light has Shadow option activated, else returns False.
:type: boolean (read only)
.. attribute:: shadowColor
The color of this light shadows. Black = (0.0, 0.0, 0.0), White = (1.0, 1.0, 1.0).
:type: :class:`mathutils.Color` (read only)
.. attribute:: shadowMatrix
Matrix that converts a vector in camera space to shadow buffer depth space.
Computed as:
mat4_perspective_to_depth * mat4_lamp_to_perspective * mat4_world_to_lamp * mat4_cam_to_world.
mat4_perspective_to_depth is a fixed matrix defined as follow:
0.5 0.0 0.0 0.5
0.0 0.5 0.0 0.5
0.0 0.0 0.5 0.5
0.0 0.0 0.0 1.0
.. note:
There is one matrix of that type per lamp casting shadow in the scene.
:type: Matrix4x4 (read only)
.. attribute:: distance
The maximum distance this light can illuminate. (SPOT and NORMAL lights only).
:type: float
.. attribute:: color
The color of this light. Black = [0.0, 0.0, 0.0], White = [1.0, 1.0, 1.0].
:type: list [r, g, b]
.. 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.

View File

@@ -0,0 +1,134 @@
KX_MeshProxy(SCA_IObject)
=========================
.. module:: bge.types
base class --- :class:`SCA_IObject`
.. 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
#. Vertices will be split by face if necessary. Vertices 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 color, for example: a cube has 24 vertices: 6 faces with 4 vertices per face.
The correct method of iterating over every :class:`KX_VertexProxy` in a game object
.. code-block:: python
from bge import logic
cont = logic.getCurrentController()
object = cont.owner
for mesh in object.meshes:
for m_index in range(len(mesh.materials)):
for v_index in range(mesh.getVertexArrayLength(m_index)):
vertex = mesh.getVertex(m_index, v_index)
# Do something with vertex here...
# ... eg: color the vertex red.
vertex.color = [1.0, 0.0, 0.0, 1.0]
.. attribute:: materials
:type: list of :class:`KX_BlenderMaterial` type
.. attribute:: numPolygons
:type: integer
.. attribute:: numMaterials
:type: 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:: getPolygon(index)
Gets the specified polygon from the mesh.
:arg index: polygon number
:type index: integer
:return: a polygon object.
:rtype: :class:`KX_PolyProxy`
.. method:: transform(matid, matrix)
Transforms the vertices of a mesh.
:arg matid: material index, -1 transforms all.
:type matid: integer
:arg matrix: transformation matrix.
:type matrix: 4x4 matrix [[float]]
.. method:: transformUV(matid, matrix, uv_index=-1, uv_index_from=-1)
Transforms the vertices UV's of a mesh.
:arg matid: material index, -1 transforms all.
:type matid: integer
:arg matrix: transformation matrix.
:type matrix: 4x4 matrix [[float]]
:arg uv_index: optional uv index, -1 for all, otherwise 0 or 1.
:type uv_index: integer
:arg uv_index_from: optional uv index to copy from, -1 to transform the current uv.
:type uv_index_from: integer

View File

@@ -0,0 +1,103 @@
KX_MouseActuator(SCA_IActuator)
====================================
.. module:: bge.types
base class --- :class:`SCA_IActuator`
.. class:: KX_MouseActuator(SCA_IActuator)
The mouse actuator gives control over the visibility of the mouse cursor and rotates the parent object according to mouse movement.
.. method:: reset()
Undoes the rotation caused by the mouse actuator.
.. attribute:: visible
The visibility of the mouse cursor.
:type: boolean
.. attribute:: use_axis_x
Mouse movement along the x axis effects object rotation.
:type: boolean
.. attribute:: use_axis_y
Mouse movement along the y axis effects object rotation.
:type: boolean
.. attribute:: threshold
Amount of movement from the mouse required before rotation is triggered.
:type: list (vector of 2 floats)
The values in the list should be between 0.0 and 0.5.
.. attribute:: reset_x
Mouse is locked to the center of the screen on the x axis.
:type: boolean
.. attribute:: reset_y
Mouse is locked to the center of the screen on the y axis.
:type: boolean
.. attribute:: object_axis
The object's 3D axis to rotate with the mouse movement. ([x, y])
:type: list (vector of 2 integers from 0 to 2)
* KX_ACT_MOUSE_OBJECT_AXIS_X
* KX_ACT_MOUSE_OBJECT_AXIS_Y
* KX_ACT_MOUSE_OBJECT_AXIS_Z
.. attribute:: local_x
Rotation caused by mouse movement along the x axis is local.
:type: boolean
.. attribute:: local_y
Rotation caused by mouse movement along the y axis is local.
:type: boolean
.. attribute:: sensitivity
The amount of rotation caused by mouse movement along the x and y axis.
:type: list (vector of 2 floats)
Negative values invert the rotation.
.. attribute:: limit_x
The minimum and maximum angle of rotation caused by mouse movement along the x axis in degrees.
limit_x[0] is minimum, limit_x[1] is maximum.
:type: list (vector of 2 floats)
.. attribute:: limit_y
The minimum and maximum angle of rotation caused by mouse movement along the y axis in degrees.
limit_y[0] is minimum, limit_y[1] is maximum.
:type: list (vector of 2 floats)
.. attribute:: angle
The current rotational offset caused by the mouse actuator in degrees.
:type: list (vector of 2 floats)

View File

@@ -0,0 +1,83 @@
KX_MouseFocusSensor(SCA_MouseSensor)
====================================
.. module:: bge.types
base class --- :class:`SCA_MouseSensor`
.. 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: boolean
.. attribute:: useXRay
If enabled it allows the sensor to see through game objects that don't have the selected property or material.
:type: boolean
.. attribute:: propName
The property or material the sensor is looking for.
: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

View File

@@ -0,0 +1,47 @@
KX_NavMeshObject(KX_GameObject)
===============================
.. module:: bge.types
base class --- :class:`KX_GameObject`
.. class:: KX_NavMeshObject(KX_GameObject)
Python interface for using and controlling navigation meshes.
.. method:: findPath(start, goal)
Finds the path from start to goal points.
:arg start: the start point
:arg start: 3D Vector
:arg goal: the goal point
:arg start: 3D Vector
:return: a path as a list of points
:rtype: list of points
.. method:: raycast(start, goal)
Raycast from start to goal points.
:arg start: the start point
:arg start: 3D Vector
:arg goal: the goal point
:arg start: 3D Vector
:return: the hit factor
:rtype: float
.. method:: draw(mode)
Draws a debug mesh for the navigation mesh.
:arg mode: the drawing mode (one of :ref:`these constants <navmesh-draw-mode>`)
:arg mode: integer
:return: None
.. method:: rebuild()
Rebuild the navigation mesh.
:return: None

View File

@@ -0,0 +1,23 @@
KX_NearSensor(KX_TouchSensor)
=============================
.. module:: bge.types
base class --- :class:`KX_TouchSensor`
.. 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

View File

@@ -0,0 +1,35 @@
KX_NetworkMessageActuator(SCA_IActuator)
========================================
.. module:: bge.types
base class --- :class:`SCA_IActuator`
.. 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

View File

@@ -0,0 +1,38 @@
KX_NetworkMessageSensor(SCA_ISensor)
====================================
.. module:: bge.types
base class --- :class:`SCA_ISensor`
.. 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

View File

@@ -0,0 +1,129 @@
KX_ObjectActuator(SCA_IActuator)
================================
.. module:: bge.types
base class --- :class:`SCA_IActuator`
.. 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: Vector((x, y, z))
.. attribute:: useLocalForce
A flag specifying if the force is local.
:type: boolean
.. attribute:: torque
The torque applied by the actuator.
:type: Vector((x, y, z))
.. attribute:: useLocalTorque
A flag specifying if the torque is local.
:type: boolean
.. attribute:: dLoc
The displacement vector applied by the actuator.
:type: Vector((x, y, z))
.. attribute:: useLocalDLoc
A flag specifying if the dLoc is local.
:type: boolean
.. attribute:: dRot
The angular displacement vector applied by the actuator
:type: Vector((x, y, z))
.. 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.
.. attribute:: useLocalDRot
A flag specifying if the dRot is local.
:type: boolean
.. attribute:: linV
The linear velocity applied by the actuator.
:type: Vector((x, y, z))
.. attribute:: useLocalLinV
A flag specifying if the linear velocity is local.
:type: boolean
.. note::
This is the target speed for servo controllers.
.. attribute:: angV
The angular velocity applied by the actuator.
:type: Vector((x, y, z))
.. attribute:: useLocalAngV
A flag specifying if the angular velocity is local.
:type: boolean
.. 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

View File

@@ -0,0 +1,38 @@
KX_ParentActuator(SCA_IActuator)
================================
.. module:: bge.types
base class --- :class:`SCA_IActuator`
.. 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: boolean
.. 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: boolean

View File

@@ -0,0 +1,139 @@
KX_PolyProxy(SCA_IObject)
=========================
.. module:: bge.types
base class --- :class:`SCA_IObject`
.. 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:: material_name
The name of polygon material, empty if no material.
:type: string
.. attribute:: material
The material of the polygon.
:type: :class:`KX_BlenderMaterial`
.. attribute:: texture_name
The texture name of the polygon.
:type: string
.. attribute:: material_id
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_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`

View File

@@ -0,0 +1,44 @@
KX_RadarSensor(KX_NearSensor)
=============================
.. module:: bge.types
base class --- :class:`KX_NearSensor`
.. 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
.. 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

View File

@@ -0,0 +1,78 @@
KX_RaySensor(SCA_ISensor)
=========================
.. module:: bge.types
base class --- :class:`SCA_ISensor`
.. 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:: hitMaterial
The material of the object in the face hit by the ray. (read-only).
:type: string
.. 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

View File

@@ -0,0 +1,55 @@
KX_SCA_AddObjectActuator(SCA_IActuator)
=======================================
.. module:: bge.types
base class --- :class:`SCA_IActuator`
.. class:: KX_SCA_AddObjectActuator(SCA_IActuator)
Edit Object Actuator (in Add Object Mode)
.. 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.
.. code-block:: none
Error: GameObject 'Name' has a AddObjectActuator 'ActuatorName' without object (in 'nonactive' layer)
.. 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]
.. method:: instantAddObject()
adds the object without needing to calling SCA_PythonController.activate()
.. note:: Use objectLastCreated to get the newly created object.

View File

@@ -0,0 +1,29 @@
KX_SCA_DynamicActuator(SCA_IActuator)
=====================================
.. module:: bge.types
base class --- :class:`SCA_IActuator`
.. 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

View File

@@ -0,0 +1,13 @@
KX_SCA_EndObjectActuator(SCA_IActuator)
=======================================
.. module:: bge.types
base class --- :class:`SCA_IActuator`
.. class:: KX_SCA_EndObjectActuator(SCA_IActuator)
Edit Object Actuator (in End Object mode)
This actuator has no python methods.

View File

@@ -0,0 +1,89 @@
KX_SCA_ReplaceMeshActuator(SCA_IActuator)
=========================================
.. module:: bge.types
base class --- :class:`SCA_IActuator`
.. class:: KX_SCA_ReplaceMeshActuator(SCA_IActuator)
Edit Object actuator, in Replace Mesh mode.
.. 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
.. code-block:: none
Error: GameObject 'Name' ReplaceMeshActuator 'ActuatorName' without object
.. 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 |
# +----------+ +-----------+ +-------------------------------------+
from bge import logic
# 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)
)
cont = logic.getCurrentController()
object = cont.owner
actuator = cont.actuators["LOD." + obj.name]
camera = logic.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(object.position, camera.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" + object.name + mesh[0] == actuator.getMesh():
curmesh = mesh
if newmesh != None and "ME" + object.name + newmesh[0] != actuator.mesh:
# 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:
actuator.mesh = object.name + newmesh[0]
cont.activate(actuator)
.. 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.

View File

@@ -0,0 +1,186 @@
KX_Scene(PyObjectPlus)
======================
.. module:: bge.types
base class --- :class:`PyObjectPlus`
.. 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
from bge import logic
# get the scene
scene = logic.getCurrentScene()
# print all the objects in the scene
for object in scene.objects:
print(object.name)
# get an object named 'Cube'
object = scene.objects["Cube"]
# get the first object in the scene.
object = scene.objects[0]
.. code-block:: python
# Get the depth of an object in the camera view.
from bge import logic
object = logic.getCurrentController().owner
cam = logic.getCurrentScene().active_camera
# Depth is negative and decreasing further from the camera
depth = object.position[0]*cam.world_to_camera[2][0] + object.position[1]*cam.world_to_camera[2][1] + object.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.
:type: :class:`KX_Camera`
.. note::
This can be set directly from python to avoid using the :class:`KX_SceneActuator`.
.. attribute:: world
The current active world, (read-only).
:type: :class:`KX_WorldInfo`
.. 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: boolean
.. 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
.. attribute:: pre_draw_setup
A list of callables to be run before the drawing setup (i.e., before the model view and projection matrices are computed).
:type: list
.. attribute:: gravity
The scene gravity using the world x, y and z axis.
:type: Vector((gx, gy, gz))
.. method:: addObject(object, reference, time=0)
Adds an object to the scene like the Add Object Actuator would.
:arg object: The (name of the) object to add.
:type object: :class:`KX_GameObject` or string
:arg reference: The (name of the) object which position, orientation, and scale to copy (optional), if the object to add is a light and there is not reference the light's layer will be the same that the active layer in the blender scene.
:type reference: :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 (optional).
: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
:return: True if the scene exists and was scheduled for addition, False otherwise.
:rtype: boolean
.. 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.
.. method:: drawObstacleSimulation()
Draw debug visualization of obstacle simulation.

View File

@@ -0,0 +1,49 @@
KX_SceneActuator(SCA_IActuator)
===============================
.. module:: bge.types
base class --- :class:`SCA_IActuator`
.. 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:
.. code-block:: none
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.
:type: :class:`KX_Camera` on read, string or :class:`KX_Camera` on write
.. note::
When setting the attribute, you can use either a :class:`KX_Camera` or the name of the camera.
.. attribute:: useRestart
Set flag to True to restart the sene.
:type: boolean
.. attribute:: mode
The mode of the actuator.
:type: integer from 0 to 5.

View File

@@ -0,0 +1,115 @@
KX_SoundActuator(SCA_IActuator)
===============================
.. module:: bge.types
base class --- :class:`SCA_IActuator`
.. class:: KX_SoundActuator(SCA_IActuator)
Sound Actuator.
The :data:`startSound`, :data:`pauseSound` and :data:`stopSound` do not require the actuator to be activated - they act instantly provided that the actuator has been activated once at least.
.. attribute:: volume
The volume (gain) of the sound.
:type: float
.. attribute:: time
The current position in the audio stream (in seconds).
:type: float
.. attribute:: pitch
The pitch of the sound.
:type: float
.. attribute:: mode
The operation mode of the actuator. Can be one of :ref:`these constants<logic-sound-actuator>`
:type: integer
.. attribute:: sound
The sound the actuator should play.
:type: Audaspace factory
.. attribute:: is3D
Whether or not the actuator should be using 3D sound. (read-only)
:type: boolean
.. attribute:: volume_maximum
The maximum gain of the sound, no matter how near it is.
:type: float
.. attribute:: volume_minimum
The minimum gain of the sound, no matter how far it is away.
:type: float
.. attribute:: distance_reference
The distance where the sound has a gain of 1.0.
:type: float
.. attribute:: distance_maximum
The maximum distance at which you can hear the sound.
:type: float
.. attribute:: attenuation
The influence factor on volume depending on distance.
:type: float
.. attribute:: cone_angle_inner
The angle of the inner cone.
:type: float
.. attribute:: cone_angle_outer
The angle of the outer cone.
:type: float
.. attribute:: cone_volume_outer
The gain outside the outer cone (the gain in the outer cone will be interpolated between this value and the normal gain in the inner cone).
:type: float
.. method:: startSound()
Starts the sound.
:return: None
.. method:: pauseSound()
Pauses the sound.
:return: None
.. method:: stopSound()
Stops the sound.
:return: None

View File

@@ -0,0 +1,29 @@
KX_StateActuator(SCA_IActuator)
===============================
.. module:: bge.types
base class --- :class:`SCA_IActuator`
.. class:: KX_StateActuator(SCA_IActuator)
State actuator changes the state mask of parent object.
.. attribute:: operation
Type of bit operation to be applied on object state mask.
You can use one of :ref:`these constants <state-actuator-operation>`
: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

View File

@@ -0,0 +1,71 @@
KX_SteeringActuator(SCA_IActuator)
==================================
.. module:: bge.types
base class --- :class:`SCA_IActuator`
.. class:: KX_SteeringActuator(SCA_IActuator)
Steering Actuator for navigation.
.. attribute:: behavior
The steering behavior to use.
:type: one of :ref:`these constants <logic-steering-actuator>`
.. attribute:: velocity
Velocity magnitude
:type: float
.. attribute:: acceleration
Max acceleration
:type: float
.. attribute:: turnspeed
Max turn speed
:type: float
.. attribute:: distance
Relax distance
:type: float
.. attribute:: target
Target object
:type: :class:`KX_GameObject`
.. attribute:: navmesh
Navigation mesh
:type: :class:`KX_GameObject`
.. attribute:: selfterminated
Terminate when target is reached
:type: boolean
.. attribute:: enableVisualization
Enable debug visualization
:type: boolean
.. attribute:: pathUpdatePeriod
Path update period
:type: int

View File

@@ -0,0 +1,47 @@
KX_TouchSensor(SCA_ISensor)
===========================
.. module:: bge.types
base class --- :class:`SCA_ISensor`
.. 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: boolean
.. 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`
.. attribute:: hitMaterial
The material of the object in the face hit by the ray. (read-only).
:type: string

View File

@@ -0,0 +1,61 @@
KX_TrackToActuator(SCA_IActuator)
=================================
.. module:: bge.types
base class --- :class:`SCA_IActuator`
.. 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:
.. code-block:: none
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
.. attribute:: upAxis
The axis that points upward.
:type: integer from 0 to 2
* KX_TRACK_UPAXIS_POS_X
* KX_TRACK_UPAXIS_POS_Y
* KX_TRACK_UPAXIS_POS_Z
.. attribute:: trackAxis
The axis that points to the target object.
:type: integer from 0 to 5
* KX_TRACK_TRAXIS_POS_X
* KX_TRACK_TRAXIS_POS_Y
* KX_TRACK_TRAXIS_POS_Z
* KX_TRACK_TRAXIS_NEG_X
* KX_TRACK_TRAXIS_NEG_Y
* KX_TRACK_TRAXIS_NEG_Z

View File

@@ -0,0 +1,166 @@
KX_VehicleWrapper(PyObjectPlus)
===============================
.. module:: bge.types
base class --- :class:`PyObjectPlus`
.. class:: KX_VehicleWrapper(PyObjectPlus)
KX_VehicleWrapper
TODO - description
.. method:: addWheel(wheel, attachPos, downDir, 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 :class:`KX_GameObject` name
:arg attachPos: The position to attach the wheel, relative to the chassis object center.
:type attachPos: vector of 3 floats
:arg downDir: The direction vector pointing down to where the vehicle should collide with the floor.
:type downDir: vector of 3 floats
:arg axleDir: The axis the wheel rotates around, relative to the chassis.
:type axleDir: vector of 3 floats
:arg suspensionRestLength: The length of the suspension when no forces are being applied.
:type suspensionRestLength: float
:arg wheelRadius: The radius of the wheel (half the diameter).
:type wheelRadius: float
:arg hasSteering: True if the wheel should turn with steering, typically used in front wheels.
:type hasSteering: boolean
.. 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

View File

@@ -0,0 +1,209 @@
KX_VertexProxy(SCA_IObject)
===========================
.. module:: bge.types
base class --- :class:`SCA_IObject`
.. class:: KX_VertexProxy(SCA_IObject)
A vertex holds position, UV, color 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: Vector((x, y, z))
.. attribute:: UV
The texture coordinates of the vertex.
:type: Vector((u, v))
.. attribute:: normal
The normal of the vertex.
:type: Vector((nx, ny, nz))
.. attribute:: color
The color of the vertex.
:type: Vector((r, g, b, a))
Black = [0.0, 0.0, 0.0, 1.0], White = [1.0, 1.0, 1.0, 1.0]
.. 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 color. 0.0 <= r <= 1.0.
:type: float
.. attribute:: g
The green component of the vertex color. 0.0 <= g <= 1.0.
:type: float
.. attribute:: b
The blue component of the vertex color. 0.0 <= b <= 1.0.
:type: float
.. attribute:: a
The alpha component of the vertex color. 0.0 <= a <= 1.0.
:type: float
.. method:: getXYZ()
Gets the position of this vertex.
:return: this vertexes position in local coordinates.
:rtype: Vector((x, y, z))
.. method:: setXYZ(pos)
Sets the position of this vertex.
:type: Vector((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: Vector((u, v))
.. method:: setUV(uv)
Sets the UV (texture) coordinates of this vertex.
:type: Vector((u, v))
.. method:: getUV2()
Gets the 2nd UV (texture) coordinates of this vertex.
:return: this vertexes UV (texture) coordinates.
:rtype: Vector((u, v))
.. method:: setUV2(uv, unit)
Sets the 2nd UV (texture) coordinates of this vertex.
:type: Vector((u, v))
:arg unit: optional argument, FLAT==1, SECOND_UV==2, defaults to SECOND_UV
:arg unit: integer
.. method:: getRGBA()
Gets the color of this vertex.
The color is represented as four bytes packed into an integer value. The color is
packed as RGBA.
Since Python offers no way to get each byte without shifting, you must use the struct module to
access color in an machine independent way.
Because of this, it is suggested you use the r, g, b and a attributes or the color 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 color. 4 byte integer with one byte per color channel in RGBA format.
:rtype: integer
.. method:: setRGBA(col)
Sets the color of this vertex.
See getRGBA() for the format of col, and its relevant problems. Use the r, g, b and a attributes
or the color attribute instead.
setRGBA() also accepts a four component list as argument col. The list represents the color 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 color 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: normalized normal vector.
:rtype: Vector((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.

View File

@@ -0,0 +1,29 @@
KX_VisibilityActuator(SCA_IActuator)
====================================
.. module:: bge.types
base class --- :class:`SCA_IActuator`
.. 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

View File

@@ -0,0 +1,79 @@
KX_WorldInfo(PyObjectPlus)
=============================
.. module:: bge.types
base class --- :class:`PyObjectPlus`
.. class:: KX_WorldInfo(PyObjectPlus)
A world object.
.. code-block:: python
# Set the mist color to red.
import bge
sce = bge.logic.getCurrentScene()
sce.world.mistColor = [1.0, 0.0, 0.0]
.. data:: KX_MIST_QUADRATIC
Type of quadratic attenuation used to fade mist.
.. data:: KX_MIST_LINEAR
Type of linear attenuation used to fade mist.
.. data:: KX_MIST_INV_QUADRATIC
Type of inverse quadratic attenuation used to fade mist.
.. attribute:: mistEnable
Return the state of the mist.
:type: bool
.. attribute:: mistStart
The mist start point.
:type: float
.. attribute:: mistDistance
The mist distance fom the start point to reach 100% mist.
:type: float
.. attribute:: mistIntensity
The mist intensity.
:type: float
.. attribute:: mistType
The type of mist - must be KX_MIST_QUADRATIC, KX_MIST_LINEAR or KX_MIST_INV_QUADRATIC
.. attribute:: mistColor
The color of the mist. Black = [0.0, 0.0, 0.0], White = [1.0, 1.0, 1.0].
Mist and background color sould always set to the same color.
:type: :class:`mathutils.Color`
.. attribute:: backgroundColor
The color of the background. Black = [0.0, 0.0, 0.0], White = [1.0, 1.0, 1.0].
Mist and background color sould always set to the same color.
:type: :class:`mathutils.Color`
.. attribute:: ambientColor
The color of the ambient light. Black = [0.0, 0.0, 0.0], White = [1.0, 1.0, 1.0].
:type: :class:`mathutils.Color`

View File

@@ -0,0 +1,21 @@
PyObjectPlus
============
.. 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: boolean

View File

@@ -0,0 +1,49 @@
SCA_2DFilterActuator(SCA_IActuator)
===================================
.. module:: bge.types
base class --- :class:`SCA_IActuator`
.. class:: SCA_2DFilterActuator(SCA_IActuator)
Create, enable and disable 2D filters.
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 :data:`~bge.logic.RAS_2DFILTER_DISABLED` or :data:`~bge.logic.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 :ref:`these constants <Two-D-FilterActuator-mode>`.
: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)

View File

@@ -0,0 +1,13 @@
SCA_ANDController(SCA_IController)
==================================
.. module:: bge.types
base class --- :class:`SCA_IController`
.. 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.

View File

@@ -0,0 +1,19 @@
SCA_ActuatorSensor(SCA_ISensor)
===============================
.. module:: bge.types
base class --- :class:`SCA_ISensor`
.. 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.
.. attribute:: actuator
the name of the actuator that the sensor is monitoring.
:type: string

View File

@@ -0,0 +1,11 @@
SCA_AlwaysSensor(SCA_ISensor)
=============================
.. module:: bge.types
base class --- :class:`SCA_ISensor`
.. class:: SCA_AlwaysSensor(SCA_ISensor)
This sensor is always activated.

View File

@@ -0,0 +1,39 @@
SCA_DelaySensor(SCA_ISensor)
============================
.. module:: bge.types
base class --- :class:`SCA_ISensor`
.. 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.
.. 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

View File

@@ -0,0 +1,11 @@
SCA_IActuator(SCA_ILogicBrick)
==============================
.. module:: bge.types
base class --- :class:`SCA_ILogicBrick`
.. class:: SCA_IActuator(SCA_ILogicBrick)
Base class for all actuator logic bricks.

View File

@@ -0,0 +1,55 @@
SCA_IController(SCA_ILogicBrick)
================================
.. module:: bge.types
base class --- :class:`SCA_ILogicBrick`
.. 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: boolen
.. note::
Order of execution between high priority controllers is not guaranteed.

Some files were not shown because too many files have changed in this diff Show More