Merging r51923 through r52851 from trunk into soc-2011-tomato

This commit is contained in:
Sergey Sharybin 2012-12-10 15:18:00 +00:00
parent da24aa8d10
commit b1afaa8312
978 changed files with 32475 additions and 17107 deletions

@ -127,7 +127,7 @@ option(WITH_PYTHON_MODULE "Enable building as a python module which runs without
option(WITH_BUILDINFO "Include extra build details (only disable for development & faster builds)" ON)
option(WITH_IK_ITASC "Enable ITASC IK solver (only disable for development & for incompatible C++ compilers)" ON)
option(WITH_IK_SOLVER "Enable Legacy IK solver (only disable for development)" ON)
option(WITH_FFTW3 "Enable FFTW3 support (Used for smoke and audio effects)" OFF)
option(WITH_FFTW3 "Enable FFTW3 support (Used for smoke and audio effects)" ON)
option(WITH_BULLET "Enable Bullet (Physics Engine)" ON)
option(WITH_GAMEENGINE "Enable Game Engine" ON)
option(WITH_PLAYER "Build Player" OFF)
@ -190,8 +190,8 @@ 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)
mark_as_advanced(WITH_MOD_CLOTH_ELTOPO)
# 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)
option(WITH_MOD_OCEANSIM "Enable Ocean Modifier" OFF)
# Image format support
@ -234,17 +234,13 @@ option(WITH_INPUT_NDOF "Enable NDOF input devices (SpaceNavigator and friends)"
option(WITH_RAYOPTIMIZATION "Enable use of SIMD (SSE) optimizations for the raytracer" ON)
if(UNIX AND NOT APPLE)
option(WITH_INSTALL_PORTABLE "Install redistributeable runtime, otherwise install into CMAKE_INSTALL_PREFIX" ON)
option(WITH_STATIC_LIBS "Try to link with static libraries, as much as possible, to make blender more portable across distributions" OFF)
endif()
option(WITH_PYTHON_INSTALL "Copy system python into the blender install folder" ON)
option(WITH_PYTHON_INSTALL_NUMPY "Copy system numpy into the blender install folder" ON)
set(PYTHON_NUMPY_PATH "" CACHE PATH "Python to python site-packages or dist-packages containing 'numpy' module")
mark_as_advanced(PYTHON_NUMPY_PATH)
if(MINGW)
option(WITH_MINGW64 "Use the 64-bit version of MinGW" OFF)
mark_as_advanced(WITH_MINGW64)
endif()
# Cycles
option(WITH_CYCLES "Enable cycles Render Engine" ON)
option(WITH_CYCLES_TEST "Build cycles test application" OFF)
@ -270,6 +266,9 @@ mark_as_advanced(WITH_ASSERT_ABORT)
if(APPLE)
cmake_minimum_required(VERSION 2.8.8)
cmake_policy(VERSION 2.8.8)
if(NOT CMAKE_OSX_ARCHITECTURES)
set(CMAKE_OSX_ARCHITECTURES x86_64 CACHE STRING
"Choose the architecture you want to build Blender for: i386, x86_64 or ppc"
@ -289,18 +288,14 @@ if(APPLE)
set(OSX_SYSTEM unsupported)
endif()
message(STATUS "Detected system-version: " ${OSX_SYSTEM})
if(NOT CMAKE_OSX_DEPLOYMENT_TARGET)
set(CMAKE_OSX_DEPLOYMENT_TARGET "10.5" CACHE STRING "" FORCE) # 10.5 is our minimum target, if you have higher sdk, weak linking happens
endif()
if(${CMAKE_GENERATOR} MATCHES "Xcode")
##### workaround for actual official cmake incompatibility with xcode 4.3 #####
##### cmake incompatibility with xcode 4.3 and higher #####
if(${XCODE_VERSION} MATCHES '') # cmake fails due looking for xcode in the wrong path, thus will be empty var
message("Official cmake does not yet support Xcode 4.3, get a patched version here: http://www.jensverwiebe.de/Blender/CMake%202.8-7patched.zip")
message(FATAL_ERROR "Xcode 4.3 and higher must be used with cmake 2.8-8 or higher")
endif()
### end workaround for actual official cmake incompatibility with xcode 4.3 ###
### end cmake incompatibility with xcode 4.3 and higher ###
if(${XCODE_VERSION} VERSION_EQUAL 4 OR ${XCODE_VERSION} VERSION_GREATER 4 AND ${XCODE_VERSION} VERSION_LESS 4.3)
# Xcode 4 defaults to the Apple LLVM Compiler.
@ -315,7 +310,28 @@ if(APPLE)
endif()
message(STATUS "Detected Xcode-version: " ${XCODE_VERSION})
if(${XCODE_VERSION} VERSION_LESS 4.3)
set(CMAKE_OSX_SYSROOT /Developer/SDKs/MacOSX${OSX_SYSTEM}.sdk CACHE PATH "" FORCE) # use guaranteed existing sdk
else()
# note: i don't use xcode-select path on purpose, cause also /Applications/Xcode.app would be allowed
# absolute pathes are more foolproof here !
set(OSX_SYSROOT_PREFIX /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform)
set(OSX_DEVELOPER_PREFIX /Developer/SDKs/MacOSX${OSX_SYSTEM}.sdk) # use guaranteed existing sdk
set(CMAKE_OSX_SYSROOT ${OSX_SYSROOT_PREFIX}/${OSX_DEVELOPER_PREFIX} CACHE PATH "" FORCE)
endif()
if(NOT CMAKE_OSX_DEPLOYMENT_TARGET)
set(CMAKE_OSX_DEPLOYMENT_TARGET "10.5" CACHE STRING "" FORCE) # 10.5 is our min. target, if you use higher sdk, weak linking happens
endif()
if(NOT ${CMAKE_GENERATOR} MATCHES "Xcode")
# force CMAKE_OSX_DEPLOYMENT_TARGET for makefiles, will not work else ( cmake bug ? )
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mmacosx-version-min=${CMAKE_OSX_DEPLOYMENT_TARGET}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mmacosx-version-min=${CMAKE_OSX_DEPLOYMENT_TARGET}")
add_definitions ("-DMACOSX_DEPLOYMENT_TARGET=${CMAKE_OSX_DEPLOYMENT_TARGET}")
endif()
option(WITH_COCOA "Use Cocoa framework instead of deprecated Carbon" ON)
option(USE_QTKIT "Use QtKit instead of Carbon quicktime (needed for having partial quicktime for 64bit)" OFF)
option(WITH_LIBS10.5 "Use 10.5 libs (needed for 64bit builds)" OFF)
@ -336,12 +352,20 @@ if(NOT WITH_GAMEENGINE AND WITH_PLAYER)
message(FATAL_ERROR "WITH_PLAYER requires WITH_GAMEENGINE")
endif()
if(NOT WITH_AUDASPACE AND (WITH_OPENAL OR WITH_SDL OR WITH_JACK OR WITH_GAMEENGINE))
message(FATAL_ERROR "WITH_OPENAL/WITH_SDL/WITH_JACK/WITH_CODEC_FFMPEG/WITH_GAMEENGINE require WITH_AUDASPACE")
if(NOT WITH_AUDASPACE)
if(WITH_OPENAL)
message(FATAL_ERROR "WITH_OPENAL requires WITH_AUDASPACE")
endif()
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)
message(FATAL_ERROR "WITH_GHOST_SDL requires WITH_SDL to be ON")
message(FATAL_ERROR "WITH_GHOST_SDL requires WITH_SDL")
endif()
if(WITH_IMAGE_REDCODE AND ((NOT WITH_IMAGE_OPENJPEG) OR (NOT WITH_CODEC_FFMPEG)))
@ -358,10 +382,6 @@ if(WITH_PYTHON_MODULE AND WITH_PYTHON_INSTALL)
endif()
if(NOT WITH_FFTW3 AND WITH_MOD_OCEANSIM)
message(FATAL_ERROR "WITH_MOD_OCEANSIM requires WITH_FFTW3 to be ON")
endif()
# may as well build python module without a UI
if(WITH_PYTHON_MODULE)
set(WITH_HEADLESS ON)
@ -372,8 +392,8 @@ if(WITH_CYCLES)
set(WITH_OPENIMAGEIO ON)
endif()
# auto enable boost for cycles and booleans
if(WITH_CYCLES OR WITH_MOD_BOOLEAN)
# auto enable boost for cycles, booleans, audaspace or i18n
if(WITH_CYCLES OR WITH_MOD_BOOLEAN OR WITH_AUDASPACE OR WITH_INTERNATIONAL)
set(WITH_BOOST ON)
endif()
@ -461,14 +481,14 @@ set(PLATFORM_LINKFLAGS_DEBUG "")
# For alternate Python locations the commandline can be used to override detected/default cache settings, e.g:
# On Unix:
# cmake ../blender \
# -D PYTHON_VERSION=3.2 \
# -D PYTHON_INCLUDE_DIR=/opt/py32/include/python3.2d \
# -D PYTHON_LIBRARY=/opt/py32/lib/libpython3.2d.so
# -D PYTHON_VERSION=3.3 \
# -D PYTHON_INCLUDE_DIR=/opt/py33/include/python3.3d \
# -D PYTHON_LIBRARY=/opt/py33/lib/libpython3.3d.so
#
# On Macs:
# cmake ../blender \
# -D PYTHON_INCLUDE_DIR=/System/Library/Frameworks/Python.framework/Versions/3.2/include/python3.2 \
# -D PYTHON_LIBPATH=/System/Library/Frameworks/Python.framework/Versions/3.2/lib/python3.2/config \
# -D PYTHON_INCLUDE_DIR=/System/Library/Frameworks/Python.framework/Versions/3.3/include/python3.3 \
# -D PYTHON_LIBPATH=/System/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/config \
# -G Xcode
#
# When changing any of this remember to update the notes in doc/build_systems/cmake.txt
@ -477,50 +497,52 @@ set(PLATFORM_LINKFLAGS_DEBUG "")
#Platform specifics
if(UNIX AND NOT APPLE)
# set lib directory if it exists
if(CMAKE_SYSTEM_NAME MATCHES "Linux")
if("${CMAKE_SIZEOF_VOID_P}" EQUAL "8")
set(LIBDIR ${CMAKE_SOURCE_DIR}/../lib/linux64)
else()
set(LIBDIR ${CMAKE_SOURCE_DIR}/../lib/linux)
macro(find_package_wrapper)
STRING(TOUPPER ${ARGV0} _NAME_UPPER)
if(${WITH_STATIC_LIBS})
set(_cmake_find_library_suffixes_back ${CMAKE_FIND_LIBRARY_SUFFIXES})
set(CMAKE_FIND_LIBRARY_SUFFIXES .a ${CMAKE_FIND_LIBRARY_SUFFIXES})
endif()
if(NOT EXISTS ${LIBDIR})
unset(LIBDIR)
find_package(${ARGV})
if(${WITH_STATIC_LIBS})
set(CMAKE_FIND_LIBRARY_SUFFIXES ${_cmake_find_library_suffixes_back})
unset(_cmake_find_library_suffixes_back)
endif()
endif()
endmacro()
find_package(JPEG REQUIRED)
find_package(PNG REQUIRED)
find_package(ZLIB REQUIRED)
find_package(Freetype REQUIRED)
find_package_wrapper(JPEG REQUIRED)
find_package_wrapper(PNG REQUIRED)
find_package_wrapper(ZLIB REQUIRED)
find_package_wrapper(Freetype REQUIRED)
if(WITH_PYTHON)
# No way to set py32. remove for now.
# No way to set py33. remove for now.
# find_package(PythonLibs)
# Use our own instead, since wothout py is such a rare case,
# require this package
# XXX Linking errors with debian static python :/
# find_package_wrapper(PythonLibsUnix REQUIRED)
find_package(PythonLibsUnix REQUIRED)
endif()
if(WITH_IMAGE_OPENEXR)
find_package(OpenEXR) # our own module
find_package_wrapper(OpenEXR) # our own module
if(NOT OPENEXR_FOUND)
set(WITH_IMAGE_OPENEXR OFF)
endif()
endif()
if(WITH_IMAGE_OPENJPEG)
find_package(OpenJPEG)
find_package_wrapper(OpenJPEG)
if(NOT OPENJPEG_FOUND)
set(WITH_IMAGE_OPENJPEG OFF)
endif()
endif()
if(WITH_IMAGE_TIFF)
# XXX Linking errors with debian static tiff :/
# find_package_wrapper(TIFF)
find_package(TIFF)
if(NOT TIFF_FOUND)
set(WITH_IMAGE_TIFF OFF)
@ -529,14 +551,14 @@ if(UNIX AND NOT APPLE)
# Audio IO
if(WITH_OPENAL)
find_package(OpenAL)
find_package_wrapper(OpenAL)
if(NOT OPENAL_FOUND)
set(WITH_OPENAL OFF)
endif()
endif()
if(WITH_SDL)
find_package(SDL)
find_package_wrapper(SDL)
mark_as_advanced(
SDLMAIN_LIBRARY
SDL_INCLUDE_DIR
@ -550,7 +572,7 @@ if(UNIX AND NOT APPLE)
endif()
if(WITH_JACK)
find_package(Jack)
find_package_wrapper(Jack)
if(NOT JACK_FOUND)
set(WITH_JACK OFF)
endif()
@ -558,22 +580,15 @@ if(UNIX AND NOT APPLE)
# Codecs
if(WITH_CODEC_SNDFILE)
find_package(SndFile)
find_package_wrapper(SndFile)
if(NOT SNDFILE_FOUND)
set(WITH_CODEC_SNDFILE OFF)
endif()
endif()
if(WITH_CODEC_FFMPEG)
# use lib dir if available and nothing else specified
if(LIBDIR AND NOT FFMPEG)
set(FFMPEG ${LIBDIR}/ffmpeg CACHE PATH "FFMPEG Directory")
# XXX, some distros might need 'theoraenc theoradec' too
set(FFMPEG_LIBRARIES avformat avcodec avutil avdevice swscale dirac_encoder mp3lame ogg orc-0.4 schroedinger-1.0 theora vorbis vorbisenc vpx x264 xvidcore faad asound CACHE STRING "FFMPEG Libraries")
else()
set(FFMPEG /usr CACHE PATH "FFMPEG Directory")
set(FFMPEG_LIBRARIES avformat avcodec avutil avdevice swscale CACHE STRING "FFMPEG Libraries")
endif()
set(FFMPEG /usr CACHE PATH "FFMPEG Directory")
set(FFMPEG_LIBRARIES avformat avcodec avutil avdevice swscale CACHE STRING "FFMPEG Libraries")
mark_as_advanced(FFMPEG)
@ -589,54 +604,32 @@ if(UNIX AND NOT APPLE)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D__STDC_CONSTANT_MACROS")
endif()
if(WITH_INTERNATIONAL)
find_library(INTL_LIBRARY
NAMES intl
PATHS
/sw/lib
)
find_library(ICONV_LIBRARY
NAMES iconv
PATHS
/sw/lib
)
mark_as_advanced(
ICONV_LIBRARY
INTL_LIBRARY
)
if(INTL_LIBRARY AND ICONV_LIBRARY)
set(GETTEXT_LIBRARIES ${INTL_LIBRARY} ${ICONV_LIBRARY})
endif()
endif()
if(WITH_FFTW3)
find_package(Fftw3)
find_package_wrapper(Fftw3)
if(NOT FFTW3_FOUND)
set(WITH_FFTW3 OFF)
endif()
endif()
if(WITH_OPENCOLLADA)
find_package(OpenCOLLADA)
find_package_wrapper(OpenCOLLADA)
if(OPENCOLLADA_FOUND)
find_package(XML2)
find_package(PCRE)
find_package_wrapper(XML2)
find_package_wrapper(PCRE)
else()
set(WITH_OPENCOLLADA OFF)
endif()
endif()
if(WITH_MEM_JEMALLOC)
find_package(JeMalloc)
find_package_wrapper(JeMalloc)
if(NOT JEMALLOC_FOUND)
set(WITH_MEM_JEMALLOC OFF)
endif()
endif()
if (WITH_INPUT_NDOF)
find_package(Spacenav)
find_package_wrapper(Spacenav)
if(NOT SPACENAV_FOUND)
set(WITH_INPUT_NDOF OFF)
endif()
@ -651,14 +644,23 @@ if(UNIX AND NOT APPLE)
if(WITH_BOOST)
# uses in build instructions to override include and library variables
if(NOT BOOST_CUSTOM)
# use lib dir if available and nothing else specified
if(LIBDIR AND NOT BOOST_ROOT)
set(BOOST_ROOT ${LIBDIR}/boost)
# XXX No more lib dir, is this multithread stuff still needed?
if(${WITH_STATIC_LIBS})
set(Boost_USE_STATIC_LIBS ON)
endif()
if(NOT BOOST_ROOT)
set(Boost_USE_MULTITHREADED OFF)
else()
set(Boost_USE_MULTITHREADED ON)
endif()
find_package(Boost 1.34 COMPONENTS filesystem regex system thread)
set(__boost_packages filesystem regex system thread date_time)
if (WITH_INTERNATIONAL)
list(APPEND __boost_packages locale)
endif()
find_package(Boost 1.34 COMPONENTS ${__boost_packages})
if(Boost_USE_STATIC_LIBS AND Boost_USE_ICU)
find_package(IcuLinux)
endif()
mark_as_advanced(Boost_DIR) # why doesnt boost do this?
endif()
@ -669,12 +671,7 @@ if(UNIX AND NOT APPLE)
endif()
if(WITH_OPENIMAGEIO)
# use lib dir if available and nothing else specified
if(LIBDIR AND NOT OPENIMAGEIO_ROOT_DIR)
set(OPENIMAGEIO_ROOT_DIR ${LIBDIR}/oiio)
endif()
find_package(OpenImageIO)
find_package_wrapper(OpenImageIO)
set(OPENIMAGEIO_LIBRARIES ${OPENIMAGEIO_LIBRARIES} ${PNG_LIBRARIES} ${JPEG_LIBRARIES} ${ZLIB_LIBRARIES} ${BOOST_LIBRARIES})
set(OPENIMAGEIO_LIBPATH) # TODO, remove and reference the absolute path everywhere
@ -694,12 +691,7 @@ if(UNIX AND NOT APPLE)
endif()
if(WITH_OPENCOLORIO)
# use lib dir if available and nothing else specified
if(LIBDIR AND NOT OPENCOLORIO_ROOT_DIR)
set(OPENCOLORIO_ROOT_DIR ${LIBDIR}/ocio)
endif()
find_package(OpenColorIO)
find_package_wrapper(OpenColorIO)
set(OPENCOLORIO_LIBRARIES ${OPENCOLORIO_LIBRARIES})
set(OPENCOLORIO_LIBPATH) # TODO, remove and reference the absolute path everywhere
@ -711,14 +703,23 @@ if(UNIX AND NOT APPLE)
endif()
endif()
# XXX Maybe most of this section should go into an llvm module?
if(WITH_LLVM)
set(LLVM_DIRECTORY ${LIBDIR}/llvm CACHE PATH "Path to the LLVM installation")
set(LLVM_VERSION "3.0" CACHE STRING "Version of LLVM to use")
# Set llvm version if not specified
if(NOT LLVM_VERSION)
set(LLVM_VERSION "3.0")
endif()
set(LLVM_STATIC YES)
if(LLVM_DIRECTORY)
set(LLVM_CONFIG "${LLVM_DIRECTORY}/bin/llvm-config")
FIND_PROGRAM(LLVM_CONFIG llvm-config-${LLVM_VERSION} HINTS ${LLVM_DIRECTORY}/bin NO_CMAKE_PATH)
if(NOT LLVM_CONFIG)
FIND_PROGRAM(LLVM_CONFIG llvm-config HINTS ${LLVM_DIRECTORY}/bin NO_CMAKE_PATH)
endif()
else()
set(LLVM_CONFIG llvm-config)
FIND_PROGRAM(LLVM_CONFIG llvm-config-${LLVM_VERSION})
if(NOT LLVM_CONFIG)
FIND_PROGRAM(LLVM_CONFIG llvm-config)
endif()
endif()
execute_process(COMMAND ${LLVM_CONFIG} --version
OUTPUT_VARIABLE LLVM_VERSION
@ -730,11 +731,13 @@ if(UNIX AND NOT APPLE)
OUTPUT_VARIABLE LLVM_LIB_DIR
OUTPUT_STRIP_TRAILING_WHITESPACE)
find_library(LLVM_LIBRARY
NAMES libLLVMAnalysis.a # first of a whole bunch of libs to get
NAMES LLVMAnalysis # first of a whole bunch of libs to get
PATHS ${LLVM_LIB_DIR})
message(STATUS "LLVM version = ${LLVM_VERSION}")
message(STATUS "LLVM dir = ${LLVM_DIRECTORY}")
message(STATUS "LLVM lib dir = ${LLVM_LIB_DIR}")
set(LLVM_VERSION ${LLVM_VERSION} CACHE STRING "Version of LLVM to use")
set(LLVM_DIRECTORY ${LLVM_DIRECTORY} CACHE PATH "Path to the LLVM installation")
if(LLVM_LIBRARY AND LLVM_DIRECTORY AND LLVM_LIB_DIR)
if(LLVM_STATIC)
@ -746,10 +749,12 @@ if(UNIX AND NOT APPLE)
OUTPUT_STRIP_TRAILING_WHITESPACE)
string(REPLACE " " ";" LLVM_LIBRARY ${LLVM_LIBRARY})
endif()
message(STATUS "LLVM library = ${LLVM_LIBRARY}")
else()
message(FATAL_ERROR "LLVM not found.")
endif()
# Fix for conflict with Mesa llvmpipe
set(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} -Wl,--version-script=${CMAKE_SOURCE_DIR}/source/creator/blender.map")
endif()
if(WITH_CYCLES_OSL)
@ -812,7 +817,7 @@ if(UNIX AND NOT APPLE)
endif()
endif()
set(PLATFORM_LINKFLAGS "-pthread")
set(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} -pthread")
# lfs on glibc, all compilers should use
add_definitions(-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE)
@ -857,10 +862,18 @@ elseif(WIN32)
if(CMAKE_COMPILER_IS_GNUCC)
set(LIBDIR ${CMAKE_SOURCE_DIR}/../lib/mingw32)
INCLUDE (CheckCSourceCompiles)
# Setup 64bit and 64bit windows systems
CHECK_C_SOURCE_COMPILES("
#ifndef __MINGW64__
#error
#endif
main(){}
"
WITH_MINGW64)
if(WITH_MINGW64)
message("Set 64 bit compiler for MinGW.")
message("Compiling for 64 bit with MinGW-w64.")
set(LIBDIR ${CMAKE_SOURCE_DIR}/../lib/mingw64)
endif()
else()
@ -875,13 +888,6 @@ elseif(WIN32)
add_definitions(-DWIN32)
if(WITH_INTERNATIONAL)
set(ICONV ${LIBDIR}/iconv)
set(ICONV_INCLUDE_DIRS ${ICONV}/include)
set(ICONV_LIBRARIES iconv)
set(ICONV_LIBPATH ${ICONV}/lib)
endif()
set(JPEG "${LIBDIR}/jpeg")
set(JPEG_INCLUDE_DIR "${JPEG}/include")
set(JPEG_LIBPATH ${JPEG}/lib) # not cmake defined
@ -923,28 +929,22 @@ elseif(WIN32)
if(WITH_CYCLES_OSL)
set(CYCLES_OSL ${LIBDIR}/osl CACHE PATH "Path to OpenShadingLanguage installation")
message(STATUS "CYCLES_OSL = ${CYCLES_OSL}")
find_library(OSL_LIB_EXEC NAMES oslexec PATHS ${CYCLES_OSL}/lib)
find_library(OSL_LIB_COMP NAMES oslcomp PATHS ${CYCLES_OSL}/lib)
find_library(OSL_LIB_QUERY NAMES oslquery PATHS ${CYCLES_OSL}/lib)
# WARNING! depends on correct order of OSL libs linking
list(APPEND OSL_LIBRARIES ${OSL_LIB_COMP} ${OSL_LIB_EXEC} ${OSL_LIB_QUERY})
find_path(OSL_INCLUDES OSL/oslclosure.h PATHS ${CYCLES_OSL}/include)
find_program(OSL_COMPILER NAMES oslc PATHS ${CYCLES_OSL}/bin)
if(OSL_INCLUDES AND OSL_LIBRARIES AND OSL_COMPILER)
set(OSL_FOUND TRUE)
message(STATUS "OSL includes = ${OSL_INCLUDES}")
message(STATUS "OSL library = ${OSL_LIBRARIES}")
message(STATUS "OSL compiler = ${OSL_COMPILER}")
else()
message(STATUS "OSL not found")
endif()
endif()
if(MSVC)
set(PLATFORM_LINKLIBS ws2_32 vfw32 winmm kernel32 user32 gdi32 comdlg32 advapi32 shfolder shell32 ole32 oleaut32 uuid)
set(PLATFORM_LINKLIBS ws2_32 vfw32 winmm kernel32 user32 gdi32 comdlg32 advapi32 shfolder shell32 ole32 oleaut32 uuid psapi)
add_definitions(/D_CRT_NONSTDC_NO_DEPRECATE /D_CRT_SECURE_NO_DEPRECATE /D_SCL_SECURE_NO_DEPRECATE /D_CONSOLE /D_LIB)
@ -974,13 +974,6 @@ elseif(WIN32)
set(CXX_WARNINGS "${_WARNINGS}")
unset(_WARNINGS)
if(WITH_INTERNATIONAL)
set(GETTEXT ${LIBDIR}/gettext)
set(GETTEXT_INCLUDE_DIRS ${GETTEXT}/include)
set(GETTEXT_LIBPATH ${GETTEXT}/lib)
set(GETTEXT_LIBRARIES gnu_gettext)
endif()
if(WITH_MOD_CLOTH_ELTOPO)
set(LAPACK ${LIBDIR}/lapack)
# set(LAPACK_INCLUDE_DIR ${LAPACK}/include)
@ -1072,6 +1065,7 @@ elseif(WIN32)
if(WITH_IMAGE_OPENEXR)
set_lib_path(OPENEXR "openexr")
set(OPENEXR_INCLUDE_DIR ${OPENEXR}/include)
set(OPENEXR_INCLUDE_DIRS ${OPENEXR}/include/OpenEXR)
set(OPENEXR_LIBPATH ${OPENEXR}/lib)
set(OPENEXR_LIBRARIES
${OPENEXR_LIBPATH}/Iex.lib
@ -1080,12 +1074,6 @@ elseif(WIN32)
${OPENEXR_LIBPATH}/Imath.lib
${OPENEXR_LIBPATH}/IlmThread.lib
)
set(OPENEXR_INCLUDE_DIRS
${OPENEXR_INCLUDE_DIR}
${OPENEXR_INCLUDE_DIR}/IlmImf
${OPENEXR_INCLUDE_DIR}/Iex
${OPENEXR_INCLUDE_DIR}/Imath
)
endif()
if(WITH_IMAGE_TIFF)
@ -1103,9 +1091,17 @@ elseif(WIN32)
if(WITH_PYTHON)
# normally cached but not since we include them with blender
set(PYTHON_VERSION 3.2) # CACHE STRING)
if(MSVC10)
set(PYTHON_VERSION 3.2) # CACHE STRING)
else()
set(PYTHON_VERSION 3.3) # CACHE STRING)
endif()
set_lib_path(PYTHON "python")
set(PYTHON_LIBRARY ${PYTHON}/lib/python32.lib) #CACHE FILEPATH
STRING(REPLACE "." "" _PYTHON_VERSION_NO_DOTS ${PYTHON_VERSION})
set(PYTHON_LIBRARY ${PYTHON}/lib/python${_PYTHON_VERSION_NO_DOTS}.lib) #CACHE FILEPATH
unset(_PYTHON_VERSION_NO_DOTS)
#Shared includes for both vc2008 and vc2010
set(PYTHON_INCLUDE_DIR ${LIBDIR}/python/include/python${PYTHON_VERSION})
@ -1133,17 +1129,28 @@ elseif(WIN32)
debug libboost_date_time-${BOOST_DEBUG_POSTFIX} debug libboost_filesystem-${BOOST_DEBUG_POSTFIX}
debug libboost_regex-${BOOST_DEBUG_POSTFIX}
debug libboost_system-${BOOST_DEBUG_POSTFIX} debug libboost_thread-${BOOST_DEBUG_POSTFIX})
if(WITH_INTERNATIONAL)
set(BOOST_LIBRARIES ${BOOST_LIBRARIES}
optimized libboost_locale-${BOOST_POSTFIX}
debug libboost_locale-${BOOST_DEBUG_POSTFIX})
endif(WITH_INTERNATIONAL)
set(BOOST_DEFINITIONS "-DBOOST_ALL_NO_LIB")
endif()
if(WITH_OPENIMAGEIO)
set(OPENIMAGEIO ${LIBDIR}/openimageio)
set(OPENIMAGEIO_INCLUDE_DIRS ${OPENIMAGEIO}/include)
set(OPENIMAGEIO_LIBRARIES OpenImageIO)
set(OPENIMAGEIO_LIBRARIES optimized OpenImageIO debug OpenImageIO_d)
set(OPENIMAGEIO_LIBPATH ${OPENIMAGEIO}/lib)
set(OPENIMAGEIO_DEFINITIONS)
set(OPENIMAGEIO_DEFINITIONS "-DUSE_TBB=0")
endif()
if(WITH_LLVM)
set(LLVM_DIRECTORY ${LIBDIR}/llvm CACHE PATH "Path to the LLVM installation")
file(GLOB LLVM_LIBRARY ${LLVM_DIRECTORY}/lib/*.lib)
set(LLVM_STATIC YES)
endif()
if(WITH_OPENCOLORIO)
set(OPENCOLORIO ${LIBDIR}/opencolorio)
set(OPENCOLORIO_INCLUDE_DIRS ${OPENCOLORIO}/include)
@ -1152,6 +1159,7 @@ elseif(WIN32)
set(OPENCOLORIO_DEFINITIONS)
endif()
set(PLATFORM_LINKFLAGS "/SUBSYSTEM:CONSOLE /STACK:2097152 /INCREMENTAL:NO /NODEFAULTLIB:msvcrt.lib /NODEFAULTLIB:msvcmrt.lib /NODEFAULTLIB:msvcurt.lib /NODEFAULTLIB:msvcrtd.lib")
# MSVC only, Mingw doesnt need
@ -1186,16 +1194,8 @@ elseif(WIN32)
add_definitions(-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE)
add_definitions(-DFREE_WINDOWS)
if(WITH_INTERNATIONAL)
set(GETTEXT ${LIBDIR}/gettext)
set(GETTEXT_INCLUDE_DIRS ${GETTEXT}/include)
set(GETTEXT_LIBPATH ${GETTEXT}/lib)
set(GETTEXT_LIBRARIES intl)
endif()
set(PNG "${LIBDIR}/png")
set(PNG_INCLUDE_DIR "${PNG}/include")
set(PNG_LIBPATH ${PNG}/lib) # not cmake defined
@ -1215,7 +1215,7 @@ elseif(WIN32)
#comes with own pthread library
if(NOT WITH_MINGW64)
set(PTHREADS ${LIBDIR}/pthreads)
set(PTHREADS_INCLUDE_DIRS ${PTHREADS}/include)
#set(PTHREADS_INCLUDE_DIRS ${PTHREADS}/include)
set(PTHREADS_LIBPATH ${PTHREADS}/lib)
set(PTHREADS_LIBRARIES pthreadGC2)
endif()
@ -1263,6 +1263,7 @@ elseif(WIN32)
if(WITH_IMAGE_OPENEXR)
set(OPENEXR ${LIBDIR}/openexr)
set(OPENEXR_INCLUDE_DIR ${OPENEXR}/include)
set(OPENEXR_INCLUDE_DIRS ${OPENEXR}/include/OpenEXR)
set(OPENEXR_LIBRARIES Half IlmImf Imath IlmThread Iex)
set(OPENEXR_LIBPATH ${OPENEXR}/lib)
@ -1287,9 +1288,9 @@ elseif(WIN32)
if(WITH_PYTHON)
# normally cached but not since we include them with blender
set(PYTHON_VERSION 3.2) # CACHE STRING)
set(PYTHON_VERSION 3.3) # CACHE STRING)
set(PYTHON_INCLUDE_DIR "${LIBDIR}/python/include/python${PYTHON_VERSION}") # CACHE PATH)
set(PYTHON_LIBRARY "${LIBDIR}/python/lib/python32mw.lib") # CACHE FILEPATH)
set(PYTHON_LIBRARY "${LIBDIR}/python/lib/python33mw.lib") # CACHE FILEPATH)
# uncached vars
set(PYTHON_INCLUDE_DIRS "${PYTHON_INCLUDE_DIR}")
@ -1313,6 +1314,11 @@ elseif(WIN32)
debug boost_date_time-${BOOST_DEBUG_POSTFIX} boost_filesystem-${BOOST_DEBUG_POSTFIX}
boost_regex-${BOOST_DEBUG_POSTFIX}
boost_system-${BOOST_DEBUG_POSTFIX} boost_thread-${BOOST_DEBUG_POSTFIX})
if(WITH_INTERNATIONAL)
set(BOOST_LIBRARIES ${BOOST_LIBRARIES}
optimized boost_locale-${BOOST_POSTFIX}
debug boost_locale-${BOOST_DEBUG_POSTFIX})
endif()
set(BOOST_LIBPATH ${BOOST}/lib)
set(BOOST_DEFINITIONS "-DBOOST_ALL_NO_LIB -DBOOST_THREAD_USE_LIB ")
endif()
@ -1325,6 +1331,34 @@ elseif(WIN32)
set(OPENIMAGEIO_DEFINITIONS)
endif()
if(WITH_LLVM)
set(LLVM_DIRECTORY ${LIBDIR}/llvm CACHE PATH "Path to the LLVM installation")
set(LLVM_LIB_DIR ${LLVM_DIRECTORY}/lib)
#Explicitly set llvm lib order.
#---- WARNING ON GCC ORDER OF LIBS IS IMPORTANT, DO NOT CHANGE! ---------
set(LLVM_LIBRARY LLVMSelectionDAG LLVMCodeGen LLVMScalarOpts LLVMAnalysis LLVMArchive
LLVMAsmParser LLVMAsmPrinter
LLVMBitReader LLVMBitWriter
LLVMDebugInfo LLVMExecutionEngine
LLVMInstCombine LLVMInstrumentation
LLVMInterpreter LLVMJIT
LLVMLinker LLVMMC
LLVMMCDisassembler LLVMMCJIT
LLVMMCParser LLVMObject
LLVMRuntimeDyld
LLVMSupport
LLVMTableGen LLVMTarget
LLVMTransformUtils LLVMVectorize
LLVMX86AsmParser LLVMX86AsmPrinter
LLVMX86CodeGen LLVMX86Desc
LLVMX86Disassembler LLVMX86Info
LLVMX86Utils LLVMipa
LLVMipo LLVMCore)
#imagehelp is needed by LLVM 3.1 on MinGW, check lib\Support\Windows\Signals.inc
set(PLATFORM_LINKLIBS "${PLATFORM_LINKLIBS} -limagehlp")
set(LLVM_STATIC YES)
endif()
if(WITH_OPENCOLORIO)
set(OPENCOLORIO ${LIBDIR}/opencolorio)
set(OPENCOLORIO_INCLUDE_DIRS ${OPENCOLORIO}/include)
@ -1347,16 +1381,6 @@ elseif(APPLE)
set(WITH_LIBS10.5 ON CACHE BOOL "Use 10.5 libs" FORCE) # valid also for 10.6/10.7
endif()
if(${XCODE_VERSION} VERSION_LESS 4.3)
set(CMAKE_OSX_SYSROOT /Developer/SDKs/MacOSX${OSX_SYSTEM}.sdk CACHE PATH "" FORCE) # use guaranteed existing sdk
else()
# note: i don't use xcode-select path on purpose, cause also /Applications/Xcode.app would be allowed
# absolute pathes are more foolproof here !
set(OSX_SYSROOT_PREFIX /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform)
set(OSX_DEVELOPER_PREFIX /Developer/SDKs/MacOSX${OSX_SYSTEM}.sdk) # use guaranteed existing sdk
set(CMAKE_OSX_SYSROOT ${OSX_SYSROOT_PREFIX}/${OSX_DEVELOPER_PREFIX} CACHE PATH "" FORCE)
endif()
if(WITH_LIBS10.5)
set(LIBDIR ${CMAKE_SOURCE_DIR}/../lib/darwin-9.x.universal)
else()
@ -1379,10 +1403,13 @@ elseif(APPLE)
endif()
if(WITH_JACK)
set(JACK /usr)
set(JACK_INCLUDE_DIRS ${JACK}/include/jack)
set(JACK_LIBRARIES jack)
set(JACK_LIBPATH ${JACK}/lib)
find_library(JACK_FRAMEWORK
NAMES jackmp
)
set(JACK_INCLUDE_DIRS ${JACK_FRAMEWORK}/headers)
if(NOT JACK_FRAMEWORK)
set(WITH_JACK OFF)
endif()
endif()
if(WITH_CODEC_SNDFILE)
@ -1394,13 +1421,13 @@ elseif(APPLE)
if(WITH_PYTHON)
if(NOT WITH_PYTHON_MODULE)
# we use precompiled libraries for py 3.2 and up by default
# we use precompiled libraries for py 3.3 and up by default
# normally cached but not since we include them with blender
set(PYTHON_VERSION 3.2)
set(PYTHON_INCLUDE_DIR "${LIBDIR}/python/include/python${PYTHON_VERSION}")
set(PYTHON_VERSION 3.3)
set(PYTHON_INCLUDE_DIR "${LIBDIR}/python/include/python${PYTHON_VERSION}m")
# set(PYTHON_BINARY "${LIBDIR}/python/bin/python${PYTHON_VERSION}") # not used yet
set(PYTHON_LIBRARY python${PYTHON_VERSION})
set(PYTHON_LIBRARY python${PYTHON_VERSION}m)
set(PYTHON_LIBPATH "${LIBDIR}/python/lib/python${PYTHON_VERSION}")
# set(PYTHON_LINKFLAGS "-u _PyMac_Error") # won't build with this enabled
else()
@ -1420,13 +1447,6 @@ elseif(APPLE)
set(PYTHON_LIBRARIES "${PYTHON_LIBRARY}")
endif()
if(WITH_INTERNATIONAL)
set(GETTEXT ${LIBDIR}/gettext)
set(GETTEXT_INCLUDE_DIRS "${GETTEXT}/include")
set(GETTEXT_LIBRARIES intl iconv)
set(GETTEXT_LIBPATH ${GETTEXT}/lib)
endif()
if(WITH_FFTW3)
set(FFTW3 ${LIBDIR}/fftw3)
set(FFTW3_INCLUDE_DIRS ${FFTW3}/include)
@ -1493,10 +1513,10 @@ elseif(APPLE)
if(WITH_INPUT_NDOF)
# This thread it *should* work and check the framework - campbell
# http://www.cmake.org/pipermail/cmake/2005-December/007740.html
find_library(3D_CONNEXION_CLIENT_LIBRARY
find_library(3DCONNEXION_CLIENT_FRAMEWORK
NAMES 3DconnexionClient
)
if(NOT 3D_CONNEXION_CLIENT_LIBRARY)
if(NOT 3DCONNEXION_CLIENT_FRAMEWORK)
set(WITH_INPUT_NDOF OFF)
endif()
@ -1505,6 +1525,10 @@ elseif(APPLE)
endif()
endif()
if(WITH_JACK)
set(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} -weak_framework jackmp")
endif()
else()
set(PLATFORM_CFLAGS "-pipe -funsigned-char")
set(PLATFORM_LINKFLAGS "-fexceptions -framework CoreServices -framework Foundation -framework IOKit -framework AppKit -framework Carbon -framework AGL -framework AudioUnit -framework AudioToolbox -framework CoreAudio -framework QuickTime")
@ -1567,7 +1591,11 @@ elseif(APPLE)
if(WITH_BOOST)
set(BOOST ${LIBDIR}/boost)
set(BOOST_INCLUDE_DIR ${BOOST}/include)
set(BOOST_LIBRARIES boost_date_time-mt boost_filesystem-mt boost_regex-mt boost_system-mt boost_thread-mt)
set(BOOST_LIBRARIES boost_date_time-mt boost_filesystem-mt boost_regex-mt boost_system-mt boost_thread-mt boost_wave-mt)
if (WITH_INTERNATIONAL)
list(APPEND BOOST_LIBRARIES boost_locale-mt)
set(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} -liconv") # boost_locale needs it !
endif()
set(BOOST_LIBPATH ${BOOST}/lib)
set(BOOST_DEFINITIONS)
endif()
@ -1592,7 +1620,7 @@ elseif(APPLE)
set(LLVM_DIRECTORY ${LIBDIR}/llvm CACHE PATH "Path to the LLVM installation")
set(LLVM_VERSION "3.1" CACHE STRING "Version of LLVM to use")
set(LLVM_STATIC YES)
if(LLVM_DIRECTORY)
if(EXISTS "${LLVM_DIRECTORY}/bin/llvm-config")
set(LLVM_CONFIG "${LLVM_DIRECTORY}/bin/llvm-config")
else()
set(LLVM_CONFIG llvm-config)
@ -1607,11 +1635,8 @@ elseif(APPLE)
OUTPUT_VARIABLE LLVM_LIB_DIR
OUTPUT_STRIP_TRAILING_WHITESPACE)
find_library(LLVM_LIBRARY
NAMES libLLVMAnalysis.a # first of a whole bunch of libs to get
NAMES LLVMAnalysis # first of a whole bunch of libs to get
PATHS ${LLVM_LIB_DIR})
message(STATUS "LLVM version = ${LLVM_VERSION}")
message(STATUS "LLVM dir = ${LLVM_DIRECTORY}")
message(STATUS "LLVM lib dir = ${LLVM_LIB_DIR}")
if(LLVM_LIBRARY AND LLVM_DIRECTORY AND LLVM_LIB_DIR)
if(LLVM_STATIC)
@ -1623,7 +1648,6 @@ elseif(APPLE)
OUTPUT_STRIP_TRAILING_WHITESPACE)
string(REPLACE " " ";" LLVM_LIBRARY ${LLVM_LIBRARY})
endif()
message(STATUS "LLVM library = ${LLVM_LIBRARY}")
else()
message(FATAL_ERROR "LLVM not found.")
endif()
@ -1632,8 +1656,6 @@ elseif(APPLE)
if(WITH_CYCLES_OSL)
set(CYCLES_OSL ${LIBDIR}/osl CACHE PATH "Path to OpenShadingLanguage installation")
message(STATUS "CYCLES_OSL = ${CYCLES_OSL}")
find_library(OSL_LIB_EXEC NAMES oslexec PATHS ${CYCLES_OSL}/lib)
find_library(OSL_LIB_COMP NAMES oslcomp PATHS ${CYCLES_OSL}/lib)
find_library(OSL_LIB_QUERY NAMES oslquery PATHS ${CYCLES_OSL}/lib)
@ -1644,9 +1666,6 @@ elseif(APPLE)
if(OSL_INCLUDES AND OSL_LIBRARIES AND OSL_COMPILER)
set(OSL_FOUND TRUE)
message(STATUS "OSL includes = ${OSL_INCLUDES}")
message(STATUS "OSL library = ${OSL_LIBRARIES}")
message(STATUS "OSL compiler = ${OSL_COMPILER}")
else()
message(STATUS "OSL not found")
endif()
@ -1678,6 +1697,10 @@ if(APPLE OR WIN32)
endif()
endif()
if(NOT WITH_FFTW3 AND WITH_MOD_OCEANSIM)
message(FATAL_ERROR "WITH_MOD_OCEANSIM requires WITH_FFTW3 to be ON")
endif()
if(WITH_CYCLES)
if(NOT WITH_OPENIMAGEIO)
message(FATAL_ERROR "Cycles reqires WITH_OPENIMAGEIO, the library may not have been found. Configure OIIO or disable WITH_CYCLES")
@ -1693,6 +1716,11 @@ if(WITH_CYCLES)
endif()
endif()
if(WITH_INTERNATIONAL)
if(NOT WITH_BOOST)
message(FATAL_ERROR "Internationalization reqires WITH_BOOST, the library may not have been found. Configure BOOST or disable WITH_INTERNATIONAL")
endif()
endif()
# See TEST_SSE_SUPPORT() for how this is defined.
@ -1842,7 +1870,7 @@ if(CMAKE_COMPILER_IS_GNUCC)
ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_NO_DIV_BY_ZERO -Wno-div-by-zero)
# gcc 4.2 gives annoying warnings on every file with this
if ("${CMAKE_C_COMPILER_VERSION}" VERSION_GREATER "4.2")
if (NOT "${CMAKE_C_COMPILER_VERSION}" VERSION_LESS "4.3")
ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_UNINITIALIZED -Wuninitialized)
endif()
@ -1862,7 +1890,7 @@ if(CMAKE_COMPILER_IS_GNUCC)
ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_NO_DIV_BY_ZERO -Wno-div-by-zero)
# gcc 4.2 gives annoying warnings on every file with this
if ("${CMAKE_C_COMPILER_VERSION}" VERSION_GREATER "4.2")
if (NOT "${CMAKE_C_COMPILER_VERSION}" VERSION_LESS "4.3")
ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_UNINITIALIZED -Wuninitialized)
endif()
@ -1935,12 +1963,13 @@ if(WITH_PYTHON)
if(WITH_PYTHON_INSTALL AND WITH_PYTHON_INSTALL_NUMPY)
# set but invalid
if(NOT ${PYTHON_NUMPY_PATH} STREQUAL "")
if(NOT EXISTS "${PYTHON_NUMPY_PATH}/numpy")
message(WARNING "PYTHON_NUMPY_PATH is invalid, numpy not found in '${PYTHON_NUMPY_PATH}' "
"WITH_PYTHON_INSTALL_NUMPY option will be ignored when installing python")
set(WITH_PYTHON_INSTALL_NUMPY OFF)
endif()
# -- disabled until we make numpy bundled with blender - campbell
if((NOT ${PYTHON_NUMPY_PATH} STREQUAL "") AND (NOT ${PYTHON_NUMPY_PATH} MATCHES NOTFOUND))
# if(NOT EXISTS "${PYTHON_NUMPY_PATH}/numpy")
# message(WARNING "PYTHON_NUMPY_PATH is invalid, numpy not found in '${PYTHON_NUMPY_PATH}' "
# "WITH_PYTHON_INSTALL_NUMPY option will be ignored when installing python")
# set(WITH_PYTHON_INSTALL_NUMPY OFF)
# endif()
# not set, so initialize
else()
string(REPLACE "." ";" _PY_VER_SPLIT "${PYTHON_VERSION}")

@ -173,14 +173,15 @@ help:
@echo " * test_style_osl_qtc - checks OpenShadingLanguage conforms with blenders style guide: http://wiki.blender.org/index.php/Dev:Doc/CodeStyle"
@echo ""
@echo "Static Source Code Checking (not associated with building blender)"
@echo " * check_cppcheck - run blender source through cppcheck (C & C++)"
@echo " * check_clang_array - run blender source through clang array checking script (C & C++)"
@echo " * check_splint - run blenders source through splint (C only)"
@echo " * check_sparse - run blenders source through sparse (C only)"
@echo " * check_smatch - run blenders source through smatch (C only)"
@echo " * check_spelling_c - check for spelling errors (OSL only)"
@echo " * check_spelling_osl - check for spelling errors (C/C++ only)"
@echo " * check_spelling_py - check for spelling errors (Python only)"
@echo " * check_cppcheck - run blender source through cppcheck (C & C++)"
@echo " * check_clang_array - run blender source through clang array checking script (C & C++)"
@echo " * check_splint - run blenders source through splint (C only)"
@echo " * check_sparse - run blenders source through sparse (C only)"
@echo " * check_smatch - run blenders source through smatch (C only)"
@echo " * check_spelling_c - check for spelling errors (OSL only)"
@echo " * check_spelling_c_qtc - same as check_spelling_c but outputs QtCreator tasks format"
@echo " * check_spelling_osl - check for spelling errors (C/C++ only)"
@echo " * check_spelling_py - check for spelling errors (Python only)"
@echo ""
@echo "Utilities (not associated with building blender)"
@echo " * tbz - create a compressed svn export 'blender_archive.tar.bz2'"
@ -240,13 +241,13 @@ test_style_c_qtc:
test_style_osl:
# run our own checks on C/C++ style
PYTHONIOENCODING=utf_8 python3 $(BLENDER_DIR)/source/tools/check_style_c.py $(BLENDER_DIR)/intern/cycles/kernel/osl
PYTHONIOENCODING=utf_8 python3 $(BLENDER_DIR)/source/tools/check_style_c.py $(BLENDER_DIR)/intern/cycles/kernel/shaders
test_style_osl_qtc:
# run our own checks on C/C++ style
USE_QTC_TASK=1 \
PYTHONIOENCODING=utf_8 python3 $(BLENDER_DIR)/source/tools/check_style_c.py $(BLENDER_DIR)/intern/cycles/kernel/osl > \
PYTHONIOENCODING=utf_8 python3 $(BLENDER_DIR)/source/tools/check_style_c.py $(BLENDER_DIR)/intern/cycles/kernel/shaders > \
test_style.tasks
@echo "written: test_style.tasks"
@ -270,32 +271,44 @@ project_eclipse:
check_cppcheck:
$(CMAKE_CONFIG)
cd $(BUILD_DIR) ; python3 $(BLENDER_DIR)/build_files/cmake/cmake_static_check_cppcheck.py
cd $(BUILD_DIR) ; \
python3 $(BLENDER_DIR)/build_files/cmake/cmake_static_check_cppcheck.py
check_clang_array:
$(CMAKE_CONFIG)
cd $(BUILD_DIR) ; python3 $(BLENDER_DIR)/build_files/cmake/cmake_static_check_clang_array.py
cd $(BUILD_DIR) ; \
python3 $(BLENDER_DIR)/build_files/cmake/cmake_static_check_clang_array.py
check_splint:
$(CMAKE_CONFIG)
cd $(BUILD_DIR) ; python3 $(BLENDER_DIR)/build_files/cmake/cmake_static_check_splint.py
cd $(BUILD_DIR) ; \
python3 $(BLENDER_DIR)/build_files/cmake/cmake_static_check_splint.py
check_sparse:
$(CMAKE_CONFIG)
cd $(BUILD_DIR) ; python3 $(BLENDER_DIR)/build_files/cmake/cmake_static_check_sparse.py
cd $(BUILD_DIR) ; \
python3 $(BLENDER_DIR)/build_files/cmake/cmake_static_check_sparse.py
check_smatch:
$(CMAKE_CONFIG)
cd $(BUILD_DIR) ; python3 $(BLENDER_DIR)/build_files/cmake/cmake_static_check_smatch.py
cd $(BUILD_DIR) ; \
python3 $(BLENDER_DIR)/build_files/cmake/cmake_static_check_smatch.py
check_spelling_py:
cd $(BUILD_DIR) ; PYTHONIOENCODING=utf_8 python3 $(BLENDER_DIR)/source/tools/spell_check_source.py $(BLENDER_DIR)/release/scripts
cd $(BUILD_DIR) ; \
PYTHONIOENCODING=utf_8 python3 $(BLENDER_DIR)/source/tools/spell_check_source.py $(BLENDER_DIR)/release/scripts
check_spelling_c:
cd $(BUILD_DIR) ; PYTHONIOENCODING=utf_8 python3 $(BLENDER_DIR)/source/tools/spell_check_source.py $(BLENDER_DIR)/source
cd $(BUILD_DIR) ; \
PYTHONIOENCODING=utf_8 python3 $(BLENDER_DIR)/source/tools/spell_check_source.py $(BLENDER_DIR)/source
check_spelling_c_qtc:
cd $(BUILD_DIR) ; USE_QTC_TASK=1 \
PYTHONIOENCODING=utf_8 python3 $(BLENDER_DIR)/source/tools/spell_check_source.py $(BLENDER_DIR)/source > \
$(BLENDER_DIR)/check_spelling_c.tasks
check_spelling_osl:
cd $(BUILD_DIR) ; PYTHONIOENCODING=utf_8 python3 $(BLENDER_DIR)/source/tools/spell_check_source.py $(BLENDER_DIR)/intern/cycles/kernel/osl
cd $(BUILD_DIR) ; PYTHONIOENCODING=utf_8 python3 $(BLENDER_DIR)/source/tools/spell_check_source.py $(BLENDER_DIR)/intern/cycles/kernel/shaders
# -----------------------------------------------------------------------------
# Utilities

@ -306,6 +306,15 @@ if env['OURPLATFORM']=='darwin':
else:
env.Append(LINKFLAGS=['-Xlinker','-weak_framework','-Xlinker','Jackmp'])
if env['WITH_BF_CYCLES_OSL'] == 1:
OSX_OSL_LIBPATH = Dir(env.subst(env['BF_OSL_LIBPATH'])).abspath
# we need 2 variants of passing the oslexec with the force_load option, string and list type atm
env.Append(LINKFLAGS=['-L'+OSX_OSL_LIBPATH,'-loslcomp','-force_load '+ OSX_OSL_LIBPATH +'/liboslexec.a','-loslquery'])
env.Append(BF_PROGRAM_LINKFLAGS=['-Xlinker','-force_load','-Xlinker',OSX_OSL_LIBPATH +'/liboslexec.a'])
# Trying to get rid of eventually clashes, we export some explicite as local symbols
env.Append(LINKFLAGS=['-Xlinker','-unexported_symbols_list','-Xlinker','./source/creator/osx_locals.map'])
if env['WITH_BF_OPENMP'] == 1:
if env['OURPLATFORM'] in ('win32-vc', 'win64-vc'):
env['CCFLAGS'].append('/openmp')
@ -422,16 +431,22 @@ if not quickie and do_clean:
# with _any_ library but since we used a fixed python version this tends to
# be most problematic.
if env['WITH_BF_PYTHON']:
py_h = os.path.join(Dir(env.subst('${BF_PYTHON_INC}')).abspath, "Python.h")
found_python_h = found_pyconfig_h = False
for bf_python_inc in env.subst('${BF_PYTHON_INC}').split():
py_h = os.path.join(Dir(bf_python_inc).abspath, "Python.h")
if os.path.exists(py_h):
found_python_h = True
py_h = os.path.join(Dir(bf_python_inc).abspath, "pyconfig.h")
if os.path.exists(py_h):
found_pyconfig_h = True
if not os.path.exists(py_h):
print("\nMissing: \"" + env.subst('${BF_PYTHON_INC}') + os.sep + "Python.h\",\n"
if not (found_python_h and found_pyconfig_h):
print("\nMissing: Python.h and/or pyconfig.h in\"" + env.subst('${BF_PYTHON_INC}') + "\",\n"
" Set 'BF_PYTHON_INC' to point "
"to a valid python include path.\n Containing "
"Python.h for python version \"" + env.subst('${BF_PYTHON_VERSION}') + "\"")
"to valid python include path(s).\n Containing "
"Python.h and pyconfig.h for python version \"" + env.subst('${BF_PYTHON_VERSION}') + "\"")
Exit()
del py_h
if not os.path.isdir ( B.root_build_dir):
@ -571,11 +586,11 @@ B.init_lib_dict()
Export('env')
BuildDir(B.root_build_dir+'/source', 'source', duplicate=0)
VariantDir(B.root_build_dir+'/source', 'source', duplicate=0)
SConscript(B.root_build_dir+'/source/SConscript')
BuildDir(B.root_build_dir+'/intern', 'intern', duplicate=0)
VariantDir(B.root_build_dir+'/intern', 'intern', duplicate=0)
SConscript(B.root_build_dir+'/intern/SConscript')
BuildDir(B.root_build_dir+'/extern', 'extern', duplicate=0)
VariantDir(B.root_build_dir+'/extern', 'extern', duplicate=0)
SConscript(B.root_build_dir+'/extern/SConscript')
# now that we have read all SConscripts, we know what
@ -685,6 +700,8 @@ if env['OURPLATFORM']!='darwin':
source.remove('kernel.cpp')
source.remove('CMakeLists.txt')
source.remove('svm')
source.remove('closure')
source.remove('shaders')
source.remove('osl')
source=['intern/cycles/kernel/'+s for s in source]
source.append('intern/cycles/util/util_color.h')
@ -700,6 +717,14 @@ if env['OURPLATFORM']!='darwin':
if '__pycache__' in source: source.remove('__pycache__')
source=['intern/cycles/kernel/svm/'+s for s in source]
scriptinstall.append(env.Install(dir=dir,source=source))
# closure
dir=os.path.join(env['BF_INSTALLDIR'], VERSION, 'scripts', 'addons','cycles', 'kernel', 'closure')
source=os.listdir('intern/cycles/kernel/closure')
if '.svn' in source: source.remove('.svn')
if '_svn' in source: source.remove('_svn')
if '__pycache__' in source: source.remove('__pycache__')
source=['intern/cycles/kernel/closure/'+s for s in source]
scriptinstall.append(env.Install(dir=dir,source=source))
# licenses
dir=os.path.join(env['BF_INSTALLDIR'], VERSION, 'scripts', 'addons','cycles', 'license')
@ -719,6 +744,22 @@ if env['OURPLATFORM']!='darwin':
cubin_file = os.path.join(kernel_build_dir, "kernel_%s.cubin" % arch)
scriptinstall.append(env.Install(dir=dir,source=cubin_file))
# osl shaders
if env['WITH_BF_CYCLES_OSL']:
dir=os.path.join(env['BF_INSTALLDIR'], VERSION, 'scripts', 'addons','cycles', 'shader')
osl_source_dir = Dir('./intern/cycles/kernel/shaders').srcnode().path
oso_build_dir = os.path.join(B.root_build_dir, 'intern/cycles/kernel/shaders')
headers='node_color.h node_fresnel.h node_texture.h oslutil.h stdosl.h'.split()
source=['intern/cycles/kernel/shaders/'+s for s in headers]
scriptinstall.append(env.Install(dir=dir,source=source))
for f in os.listdir(osl_source_dir):
if f.endswith('.osl'):
oso_file = os.path.join(oso_build_dir, f.replace('.osl', '.oso'))
scriptinstall.append(env.Install(dir=dir,source=oso_file))
if env['WITH_BF_OCIO']:
colormanagement = os.path.join('release', 'datafiles', 'colormanagement')
@ -819,10 +860,6 @@ else:
if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'win64-vc', 'linuxcross'):
dllsources = []
if not env['OURPLATFORM'] in ('win32-mingw', 'linuxcross'):
# For MinGW and linuxcross static linking will be used
dllsources += ['${LCGDIR}/gettext/lib/gnu_gettext.dll']
dllsources += ['${BF_ZLIB_LIBPATH}/zlib.dll']
# Used when linking to libtiff was dynamic
# keep it here until compilation on all platform would be ok
@ -868,9 +905,6 @@ if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'win64-vc', 'linuxcross'):
dllsources.append('${LCGDIR}/thumbhandler/lib/BlendThumb.dll')
dllsources.append('${LCGDIR}/thumbhandler/lib/BlendThumb64.dll')
if env['WITH_BF_OIIO'] and env['OURPLATFORM'] != 'win32-mingw':
dllsources.append('${LCGDIR}/openimageio/bin/OpenImageIO.dll')
if env['WITH_BF_OCIO']:
if not env['OURPLATFORM'] in ('win32-mingw', 'linuxcross'):
dllsources.append('${LCGDIR}/opencolorio/bin/OpenColorIO.dll')

File diff suppressed because it is too large Load Diff

@ -88,6 +88,9 @@ OIIO_V="1.0.9"
OCIO_V="1.0.7"
MESA_V="8.0.5"
OPENSSL_V="0.9.8o"
OPENSSL_FV="0.9.8o-4squeeze13"
CUDA_V="4.2.9"
CUDA_DISTR="ubuntu10.04"
CUDA_32="cudatoolkit_${CUDA_V}_linux_32_${CUDA_DISTR}.run"
@ -611,6 +614,15 @@ INSTALL_SOURCES() {
-P "$SOURCES_PATH/backport/gcc-4.7"
fi
if [ ! -d "$SOURCES_PATH/backport/openssl" ]; then
INFO "Downloading openssl"
mkdir -p "$SOURCES_PATH/backport/openssl"
wget -c $DEBIAN_MIRROR/pool/main/o/openssl/openssl_$OPENSSL_FV.debian.tar.gz \
$DEBIAN_MIRROR/pool/main/o/openssl/openssl_$OPENSSL_FV.dsc \
$DEBIAN_MIRROR/pool/main/o/openssl/openssl_$OPENSSL_V.orig.tar.gz \
-P "$SOURCES_PATH/backport/openssl"
fi
# JeMalloc
J="$SOURCES_PATH/packages/jemalloc-$JEMALLOC_V"
if [ ! -d "$J" ]; then
@ -731,7 +743,6 @@ EOF
chmod +x "$P/0config.sh"
fi
# OpenImageIO
O="$SOURCES_PATH/packages/OpenImageIO-$OIIO_V"
if [ ! -d "$O" ]; then
@ -1075,6 +1086,64 @@ DO_BACKPORT() {
INFO "Cleaning gcc-4.7"
$RUN sh -c "cd '$G' && fakeroot debian/rules clean"
fi
# Backport OpenSSL
if [ ! -f $CHROOT_PATH/usr/lib/libssl_pic.a ]; then
INFO "Backporting OpenSSL"
O="$P/openssl/openssl-$OPENSSL_V"
pkg="libssl-dev_0.9.8o-4squeeze13_amd64.deb libssl0.9.8_0.9.8o-4squeeze13_amd64.deb openssl_0.9.8o-4squeeze13_amd64.deb"
if [ ! -d "$CHROOT_PATH/$O" ]; then
INFO "Unpacking OpenSSL"
$RUN dpkg-source -x "$P/openssl/openssl_$OPENSSL_FV.dsc" "$O"
fi
if [ "$CHROOT_ARCH" = "i386" ]; then
pkg=`echo "$pkg" | sed -r 's/amd64/i386/g'`
fi
ok=true
for x in `echo "$pkg"`; do
if [ ! -f "$CHROOT_PATH/$P/openssl/$x" ]; then
ok=false
break;
fi
done
if ! $ok; then
INFO "Compiling OpenSSL"
sed -ie 's/#\s*mv debian\/tmp\/usr\/lib\/libcrypto.a debian\/tmp\/usr\/lib\/libcrypto_pic.a/ mv debian\/tmp\/usr\/lib\/libcrypto.a debian\/tmp\/usr\/lib\/libcrypto_pic.a/' "$CHROOT_PATH/$O/debian/rules"
sed -ie 's/#\s*mv debian\/tmp\/usr\/lib\/libssl.a debian\/tmp\/usr\/lib\/libssl_pic.a/ mv debian\/tmp\/usr\/lib\/libssl.a debian\/tmp\/usr\/lib\/libssl_pic.a/' "$CHROOT_PATH/$O/debian/rules"
cat << EOF > $CHROOT_PATH/$O/debian/libssl-dev.files
usr/lib/libssl.so
usr/lib/libcrypto.so
usr/lib/libssl.a
usr/lib/libcrypto.a
usr/lib/libssl_pic.a
usr/lib/libcrypto_pic.a
usr/lib/pkgconfig
usr/include
usr/share/man/man3
EOF
$RUN sh -c "cd '$O' && dpkg-buildpackage -rfakeroot -j$THREADS"
fi
inst=""
for x in `echo "$pkg"`; do
inst="$inst $P/openssl/$x"
done
INFO "Installing OpenSSL"
$RUN dpkg -i $inst
echo "openssl hold" | $RUN dpkg --set-selections
echo "libssl-dev hold" | $RUN dpkg --set-selections
echo "libssl0.9.8 hold" | $RUN dpkg --set-selections
INFO "Cleaning OpenSSL"
$RUN sh -c "cd '$O' && fakeroot debian/rules clean"
fi
}
DO_COMPILE() {
@ -1161,6 +1230,8 @@ _sha256 sha256module.c
_sha512 sha512module.c
EOF
sed -ie "s/libraries = \['ssl', 'crypto'\]/libraries = ['ssl_pic', 'crypto_pic', 'z']/" "$P/Python-$PYTHON_V/setup.py"
$RUN sh -c "cd '$P/Python-$PYTHON_V' && ./0config.sh && make clean && make -j$THREADS && make install && make clean"
rm -f "$L/python-$PYTHIN_V_SHORT"
@ -1356,6 +1427,7 @@ EOF
fi
INFO "Installing packages from repository"
$RUN apt-get install -y mc gcc g++ cmake python dpkg-dev build-essential autoconf bison \
flex gettext texinfo dejagnu quilt file lsb-release zlib1g-dev fakeroot debhelper \
g++-multilib libtool autoconf2.64 automake gawk lzma patchutils gperf sharutils \
@ -1366,7 +1438,7 @@ EOF
libsqlite3-dev liblzma-dev libncurses5-dev xutils-dev libxext-dev python-libxml2 \
libglu1-mesa-dev libfftw3-dev libfreetype6-dev libsdl1.2-dev libopenal-dev libjack-dev \
libxi-dev portaudio19-dev po4a subversion scons libpcre3-dev libexpat1-dev sudo \
expect
expect bc
if [ $CHROOT_ARCH = "amd64" ]; then
$RUN apt-get install -y libc6-dev-i386 lib32gcc1

@ -110,8 +110,7 @@ BF_JACK_LIB_STATIC = '${BF_ZLIB}/lib/libjack.a'
# Cycles
WITH_BF_CYCLES = True
WITH_BF_CYCLES_CUDA_BINARIES = True
#BF_CYCLES_CUDA_BINARIES_ARCH = ['sm_13', 'sm_20', 'sm_21', 'sm_30']
BF_CYCLES_CUDA_BINARIES_ARCH = ['sm_20', 'sm_21', 'sm_30']
BF_CYCLES_CUDA_BINARIES_ARCH = ['sm_13', 'sm_20', 'sm_21', 'sm_30']
WITH_BF_OIIO = True
WITH_BF_STATICOIIO = True
@ -120,6 +119,24 @@ BF_OIIO_INC = '${BF_OIIO}/include'
BF_OIIO_LIB_STATIC = '${BF_OIIO_LIBPATH}/libOpenImageIO.a ${BF_OPENEXR}/lib/libIlmImf.a ${BF_JPEG}/lib/libjpeg.a'
BF_OIIO_LIBPATH = '${BF_OIIO}/lib'
WITH_BF_CYCLES_OSL = True
WITH_BF_STATICOSL = False
BF_OSL = '/opt/lib/osl'
BF_OSL_INC = '${BF_OSL}/include'
# note oslexec would passed via program linkflags, which is needed to
# make llvm happy with osl_allocate_closure_component
BF_OSL_LIB = 'oslcomp oslexec oslquery'
BF_OSL_LIBPATH = '${BF_OSL}/lib'
BF_OSL_COMPILER = '${BF_OSL}/bin/oslc'
WITH_BF_LLVM = True
WITH_BF_STATICLLVM = False
BF_LLVM = '/opt/lib/llvm-3.1'
BF_LLVM_LIB = 'LLVMBitReader LLVMJIT LLVMipo LLVMVectorize LLVMBitWriter LLVMX86CodeGen LLVMX86Desc LLVMX86Info LLVMX86AsmPrinter ' + \
'LLVMX86Utils LLVMSelectionDAG LLVMCodeGen LLVMScalarOpts LLVMInstCombine LLVMTransformUtils LLVMipa LLVMAnalysis LLVMExecutionEngine ' + \
'LLVMTarget LLVMMC LLVMCore LLVMSupport'
BF_LLVM_LIBPATH = '${BF_LLVM}/lib'
# Color management
WITH_BF_OCIO = True
WITH_BF_STATICOCIO = True
@ -133,7 +150,8 @@ WITH_BF_STATICBOOST = True
BF_BOOST = '/opt/lib/boost'
BF_BOOST_INC = '${BF_BOOST}/include'
BF_BOOST_LIB_STATIC = '${BF_BOOST_LIBPATH}/libboost_filesystem.a ${BF_BOOST_LIBPATH}/libboost_date_time.a ' + \
'${BF_BOOST_LIBPATH}/libboost_regex.a ${BF_BOOST_LIBPATH}/libboost_system.a ${BF_BOOST_LIBPATH}/libboost_thread.a'
'${BF_BOOST_LIBPATH}/libboost_regex.a ${BF_BOOST_LIBPATH}/libboost_locale.a ${BF_BOOST_LIBPATH}/libboost_system.a \
${BF_BOOST_LIBPATH}/libboost_thread.a'
BF_BOOST_LIBPATH = '${BF_BOOST}/lib'
# Ocean Simulation
@ -141,5 +159,6 @@ WITH_BF_OCEANSIM = True
# Compilation and optimization
BF_DEBUG = False
REL_CCFLAGS = ['-O2', '-msse', '-msse2'] # C & C++
REL_CCFLAGS = ['-DNDEBUG', '-O2', '-msse', '-msse2'] # C & C++
PLATFORM_LINKFLAGS = ['-lrt']
BF_PROGRAM_LINKFLAGS = ['-Wl,--whole-archive', '-loslexec', '-Wl,--no-whole-archive', '-Wl,--version-script=source/creator/blender.map']

@ -119,6 +119,24 @@ BF_OIIO_INC = '${BF_OIIO}/include'
BF_OIIO_LIB_STATIC = '${BF_OIIO_LIBPATH}/libOpenImageIO.a ${BF_OPENEXR}/lib/libIlmImf.a ${BF_JPEG}/lib/libjpeg.a'
BF_OIIO_LIBPATH = '${BF_OIIO}/lib'
WITH_BF_CYCLES_OSL = True
WITH_BF_STATICOSL = False
BF_OSL = '/opt/lib/osl'
BF_OSL_INC = '${BF_OSL}/include'
# note oslexec would passed via program linkflags, which is needed to
# make llvm happy with osl_allocate_closure_component
BF_OSL_LIB = 'oslcomp oslexec oslquery'
BF_OSL_LIBPATH = '${BF_OSL}/lib'
BF_OSL_COMPILER = '${BF_OSL}/bin/oslc'
WITH_BF_LLVM = True
WITH_BF_STATICLLVM = False
BF_LLVM = '/opt/lib/llvm-3.1'
BF_LLVM_LIB = 'LLVMBitReader LLVMJIT LLVMipo LLVMVectorize LLVMBitWriter LLVMX86CodeGen LLVMX86Desc LLVMX86Info LLVMX86AsmPrinter ' + \
'LLVMX86Utils LLVMSelectionDAG LLVMCodeGen LLVMScalarOpts LLVMInstCombine LLVMTransformUtils LLVMipa LLVMAnalysis LLVMExecutionEngine ' + \
'LLVMTarget LLVMMC LLVMCore LLVMSupport'
BF_LLVM_LIBPATH = '${BF_LLVM}/lib'
# Color management
WITH_BF_OCIO = True
WITH_BF_STATICOCIO = True
@ -132,7 +150,8 @@ WITH_BF_STATICBOOST = True
BF_BOOST = '/opt/lib/boost'
BF_BOOST_INC = '${BF_BOOST}/include'
BF_BOOST_LIB_STATIC = '${BF_BOOST_LIBPATH}/libboost_filesystem.a ${BF_BOOST_LIBPATH}/libboost_date_time.a ' + \
'${BF_BOOST_LIBPATH}/libboost_regex.a ${BF_BOOST_LIBPATH}/libboost_system.a ${BF_BOOST_LIBPATH}/libboost_thread.a'
'${BF_BOOST_LIBPATH}/libboost_regex.a ${BF_BOOST_LIBPATH}/libboost_locale.a ${BF_BOOST_LIBPATH}/libboost_system.a \
${BF_BOOST_LIBPATH}/libboost_thread.a'
BF_BOOST_LIBPATH = '${BF_BOOST}/lib'
# Ocean Simulation
@ -140,5 +159,6 @@ WITH_BF_OCEANSIM = True
# Compilation and optimization
BF_DEBUG = False
REL_CCFLAGS = ['-O2', '-msse', '-msse2'] # C & C++
REL_CCFLAGS = ['-DNDEBUG', '-O2', '-msse', '-msse2'] # C & C++
PLATFORM_LINKFLAGS = ['-lrt']
BF_PROGRAM_LINKFLAGS = ['-Wl,--whole-archive', '-loslexec', '-Wl,--no-whole-archive', '-Wl,--version-script=source/creator/blender.map']

@ -97,8 +97,7 @@ WITH_BF_JACK = True
# Cycles
WITH_BF_CYCLES = True
WITH_BF_CYCLES_CUDA_BINARIES = True
#BF_CYCLES_CUDA_BINARIES_ARCH = ['sm_13', 'sm_20', 'sm_21', 'sm_30']
BF_CYCLES_CUDA_BINARIES_ARCH = ['sm_20', 'sm_21', 'sm_30']
BF_CYCLES_CUDA_BINARIES_ARCH = ['sm_13', 'sm_20', 'sm_21', 'sm_30']
WITH_BF_OIIO = True
WITH_BF_STATICOIIO = True
@ -107,6 +106,24 @@ BF_OIIO_INC = '${BF_OIIO}/include'
BF_OIIO_LIB_STATIC = '${BF_OIIO_LIBPATH}/libOpenImageIO.a ${BF_OPENEXR}/lib/libIlmImf.a'
BF_OIIO_LIBPATH = '${BF_OIIO}/lib'
WITH_BF_CYCLES_OSL = True
WITH_BF_STATICOSL = False
BF_OSL = '/opt/osl'
BF_OSL_INC = '${BF_OSL}/include'
# note oslexec would passed via program linkflags, which is needed to
# make llvm happy with osl_allocate_closure_component
BF_OSL_LIB = 'oslcomp oslexec oslquery'
BF_OSL_LIBPATH = '${BF_OSL}/lib'
BF_OSL_COMPILER = '${BF_OSL}/bin/oslc'
WITH_BF_LLVM = True
WITH_BF_STATICLLVM = False
BF_LLVM = '/opt/llvm-3.1'
BF_LLVM_LIB = 'LLVMBitReader LLVMJIT LLVMipo LLVMVectorize LLVMBitWriter LLVMX86CodeGen LLVMX86Desc LLVMX86Info LLVMX86AsmPrinter ' + \
'LLVMX86Utils LLVMSelectionDAG LLVMCodeGen LLVMScalarOpts LLVMInstCombine LLVMTransformUtils LLVMipa LLVMAnalysis LLVMExecutionEngine ' + \
'LLVMTarget LLVMMC LLVMCore LLVMSupport'
BF_LLVM_LIBPATH = '${BF_LLVM}/lib'
# Color management
WITH_BF_OCIO = True
WITH_BF_STATICOCIO = True
@ -119,7 +136,7 @@ WITH_BF_BOOST = True
WITH_BF_STATICBOOST = True
BF_BOOST = '/opt/boost'
BF_BOOST_INC = '${BF_BOOST}/include'
BF_BOOST_LIB_STATIC = '${BF_BOOST_LIBPATH}/libboost_filesystem.a ${BF_BOOST_LIBPATH}/libboost_date_time.a ${BF_BOOST_LIBPATH}/libboost_regex.a ${BF_BOOST_LIBPATH}/libboost_system.a ${BF_BOOST_LIBPATH}/libboost_thread.a'
BF_BOOST_LIB_STATIC = '${BF_BOOST_LIBPATH}/libboost_filesystem.a ${BF_BOOST_LIBPATH}/libboost_date_time.a ${BF_BOOST_LIBPATH}/libboost_regex.a ${BF_BOOST_LIBPATH}/libboost_locale.a ${BF_BOOST_LIBPATH}/libboost_system.a ${BF_BOOST_LIBPATH}/libboost_thread.a'
BF_BOOST_LIBPATH = '${BF_BOOST}/lib'
# Ocean Simulation
@ -127,5 +144,6 @@ WITH_BF_OCEANSIM = True
# Compilation and optimization
BF_DEBUG = False
REL_CCFLAGS = ['-O2'] # C & C++
REL_CCFLAGS = ['-DNDEBUG', '-DNDEBUG', '-O2'] # C & C++
PLATFORM_LINKFLAGS = ['-L/home/sources/staticlibs/lib32']
BF_PROGRAM_LINKFLAGS = ['-Wl,--whole-archive', '-loslexec', '-Wl,--no-whole-archive', '-Wl,--version-script=source/creator/blender.map']

@ -106,6 +106,24 @@ BF_OIIO_INC = '${BF_OIIO}/include'
BF_OIIO_LIB_STATIC = '${BF_OIIO_LIBPATH}/libOpenImageIO.a ${BF_OPENEXR}/lib/libIlmImf.a'
BF_OIIO_LIBPATH = '${BF_OIIO}/lib'
WITH_BF_CYCLES_OSL = True
WITH_BF_STATICOSL = False
BF_OSL = '/opt/osl'
BF_OSL_INC = '${BF_OSL}/include'
# note oslexec would passed via program linkflags, which is needed to
# make llvm happy with osl_allocate_closure_component
BF_OSL_LIB = 'oslcomp oslexec oslquery'
BF_OSL_LIBPATH = '${BF_OSL}/lib'
BF_OSL_COMPILER = '${BF_OSL}/bin/oslc'
WITH_BF_LLVM = True
WITH_BF_STATICLLVM = False
BF_LLVM = '/opt/llvm-3.1'
BF_LLVM_LIB = 'LLVMBitReader LLVMJIT LLVMipo LLVMVectorize LLVMBitWriter LLVMX86CodeGen LLVMX86Desc LLVMX86Info LLVMX86AsmPrinter ' + \
'LLVMX86Utils LLVMSelectionDAG LLVMCodeGen LLVMScalarOpts LLVMInstCombine LLVMTransformUtils LLVMipa LLVMAnalysis LLVMExecutionEngine ' + \
'LLVMTarget LLVMMC LLVMCore LLVMSupport'
BF_LLVM_LIBPATH = '${BF_LLVM}/lib'
# Color management
WITH_BF_OCIO = True
WITH_BF_STATICOCIO = True
@ -118,7 +136,7 @@ WITH_BF_BOOST = True
WITH_BF_STATICBOOST = True
BF_BOOST = '/opt/boost'
BF_BOOST_INC = '${BF_BOOST}/include'
BF_BOOST_LIB_STATIC = '${BF_BOOST_LIBPATH}/libboost_filesystem.a ${BF_BOOST_LIBPATH}/libboost_date_time.a ${BF_BOOST_LIBPATH}/libboost_regex.a ${BF_BOOST_LIBPATH}/libboost_system.a ${BF_BOOST_LIBPATH}/libboost_thread.a'
BF_BOOST_LIB_STATIC = '${BF_BOOST_LIBPATH}/libboost_filesystem.a ${BF_BOOST_LIBPATH}/libboost_date_time.a ${BF_BOOST_LIBPATH}/libboost_regex.a ${BF_BOOST_LIBPATH}/libboost_locale.a ${BF_BOOST_LIBPATH}/libboost_system.a ${BF_BOOST_LIBPATH}/libboost_thread.a'
BF_BOOST_LIBPATH = '${BF_BOOST}/lib'
# Ocean Simulation
@ -126,5 +144,6 @@ WITH_BF_OCEANSIM = True
# Compilation and optimization
BF_DEBUG = False
REL_CCFLAGS = ['-O2', '-msse', '-msse2'] # C & C++
REL_CCFLAGS = ['-DNDEBUG', '-O2', '-msse', '-msse2'] # C & C++
PLATFORM_LINKFLAGS = ['-L/home/sources/staticlibs/lib64']
BF_PROGRAM_LINKFLAGS = ['-Wl,--whole-archive', '-loslexec', '-Wl,--no-whole-archive', '-Wl,--version-script=source/creator/blender.map']

@ -98,7 +98,8 @@ WITH_BF_STATICBOOST = True
BF_BOOST = '/opt/lib/boost'
BF_BOOST_INC = '${BF_BOOST}/include'
BF_BOOST_LIB_STATIC = '${BF_BOOST_LIBPATH}/libboost_filesystem.a ${BF_BOOST_LIBPATH}/libboost_date_time.a ' + \
'${BF_BOOST_LIBPATH}/libboost_regex.a ${BF_BOOST_LIBPATH}/libboost_system.a ${BF_BOOST_LIBPATH}/libboost_thread.a'
'${BF_BOOST_LIBPATH}/libboost_regex.a ${BF_BOOST_LIBPATH}/libboost_locale.a ${BF_BOOST_LIBPATH}/libboost_system.a \
${BF_BOOST_LIBPATH}/libboost_thread.a'
BF_BOOST_LIBPATH = '${BF_BOOST}/lib'
# JACK
@ -116,5 +117,5 @@ WITH_BF_OCEANSIM = True
# Compilation and optimization
BF_DEBUG = False
REL_CCFLAGS = ['-O2', '-msse', '-msse2'] # C & C++
REL_CCFLAGS = ['-DNDEBUG', '-O2', '-msse', '-msse2'] # C & C++
PLATFORM_LINKFLAGS = ['-lrt']

@ -98,7 +98,8 @@ WITH_BF_STATICBOOST = True
BF_BOOST = '/opt/lib/boost'
BF_BOOST_INC = '${BF_BOOST}/include'
BF_BOOST_LIB_STATIC = '${BF_BOOST_LIBPATH}/libboost_filesystem.a ${BF_BOOST_LIBPATH}/libboost_date_time.a ' + \
'${BF_BOOST_LIBPATH}/libboost_regex.a ${BF_BOOST_LIBPATH}/libboost_system.a ${BF_BOOST_LIBPATH}/libboost_thread.a'
'${BF_BOOST_LIBPATH}/libboost_regex.a ${BF_BOOST_LIBPATH}/libboost_locale.a ${BF_BOOST_LIBPATH}/libboost_system.a \
${BF_BOOST_LIBPATH}/libboost_thread.a'
BF_BOOST_LIBPATH = '${BF_BOOST}/lib'
# JACK
@ -116,5 +117,5 @@ WITH_BF_OCEANSIM = True
# Compilation and optimization
BF_DEBUG = False
REL_CCFLAGS = ['-O2', '-msse', '-msse2'] # C & C++
REL_CCFLAGS = ['-DNDEBUG', '-O2', '-msse', '-msse2'] # C & C++
PLATFORM_LINKFLAGS = ['-lrt']

@ -94,7 +94,7 @@ WITH_BF_BOOST = True
WITH_BF_STATICBOOST = True
BF_BOOST = '/opt/boost'
BF_BOOST_INC = '${BF_BOOST}/include'
BF_BOOST_LIB_STATIC = '${BF_BOOST_LIBPATH}/libboost_filesystem.a ${BF_BOOST_LIBPATH}/libboost_date_time.a ${BF_BOOST_LIBPATH}/libboost_regex.a ${BF_BOOST_LIBPATH}/libboost_system.a ${BF_BOOST_LIBPATH}/libboost_thread.a'
BF_BOOST_LIB_STATIC = '${BF_BOOST_LIBPATH}/libboost_filesystem.a ${BF_BOOST_LIBPATH}/libboost_date_time.a ${BF_BOOST_LIBPATH}/libboost_regex.a ${BF_BOOST_LIBPATH}/libboost_locale.a ${BF_BOOST_LIBPATH}/libboost_system.a ${BF_BOOST_LIBPATH}/libboost_thread.a'
BF_BOOST_LIBPATH = '${BF_BOOST}/lib'
# JACK
@ -110,5 +110,5 @@ WITH_BF_OCEANSIM = True
# Compilation and optimization
BF_DEBUG = False
REL_CCFLAGS = ['-O2'] # C & C++
REL_CCFLAGS = ['-DNDEBUG', '-O2'] # C & C++
PLATFORM_LINKFLAGS = ['-L/home/sources/staticlibs/lib32']

@ -94,7 +94,7 @@ WITH_BF_BOOST = True
WITH_BF_STATICBOOST = True
BF_BOOST = '/opt/boost'
BF_BOOST_INC = '${BF_BOOST}/include'
BF_BOOST_LIB_STATIC = '${BF_BOOST_LIBPATH}/libboost_filesystem.a ${BF_BOOST_LIBPATH}/libboost_date_time.a ${BF_BOOST_LIBPATH}/libboost_regex.a ${BF_BOOST_LIBPATH}/libboost_system.a ${BF_BOOST_LIBPATH}/libboost_thread.a'
BF_BOOST_LIB_STATIC = '${BF_BOOST_LIBPATH}/libboost_filesystem.a ${BF_BOOST_LIBPATH}/libboost_date_time.a ${BF_BOOST_LIBPATH}/libboost_regex.a ${BF_BOOST_LIBPATH}/libboost_locale.a ${BF_BOOST_LIBPATH}/libboost_system.a ${BF_BOOST_LIBPATH}/libboost_thread.a'
BF_BOOST_LIBPATH = '${BF_BOOST}/lib'
# JACK
@ -110,5 +110,5 @@ WITH_BF_OCEANSIM = True
# Compilation and optimization
BF_DEBUG = False
REL_CCFLAGS = ['-O2', '-msse', '-msse2'] # C & C++
REL_CCFLAGS = ['-DNDEBUG', '-O2', '-msse', '-msse2'] # C & C++
PLATFORM_LINKFLAGS = ['-L/home/sources/staticlibs/lib64']

@ -77,17 +77,18 @@ def svn_step(branch=''):
def lib_svn_step(dir):
return SVN(name='lib svn', baseURL='https://svn.blender.org/svnroot/bf-blender/%%BRANCH%%/lib/' + dir, mode='update', defaultBranch='trunk', workdir='lib/' + dir)
def rsync_step(file_from, file_to):
return ShellCommand(name='rsync', command=['rsync', '-v', '-P', file_from, 'brecht@builder.blender.org:/data/buildbot-master/' + file_to], haltOnFailure=True, description=['rsync'])
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 = 'buildbot_upload_' + id + '.zip'
filename = 'uploaded/buildbot_upload_' + id + '.zip'
compile_script = '../blender/build_files/buildbot/slave_compile.py'
test_script = '../blender/build_files/buildbot/slave_test.py'
pack_script = '../blender/build_files/buildbot/slave_pack.py'
rsync_script = '../blender/build_files/buildbot/slave_rsync.py'
unpack_script = 'master_unpack.py'
f = BuildFactory()
@ -95,11 +96,11 @@ def generic_builder(id, libdir='', branch='', rsync=False):
if libdir != '':
f.addStep(lib_svn_step(libdir))
f.addStep(Compile(command=['python', compile_script, id]))
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], description='packaging', descriptionDone='packaged'))
if rsync:
f.addStep(rsync_step('../install/buildbot_upload.zip', filename))
f.addStep(rsync_step(id, branch, rsync_script))
elif id.find('cmake') != -1:
f.addStep(FileUpload(name='upload', slavesrc='buildbot_upload.zip', masterdest=filename, maxsize=100 * 1024 * 1024))
else:
@ -109,7 +110,8 @@ def generic_builder(id, libdir='', branch='', rsync=False):
# builders
add_builder(c, 'mac_x86_64_scons', '', generic_builder)
add_builder(c, 'mac_x86_64_10_6_scons', 'darwin-9.x.universal', generic_builder, '', True)
add_builder(c, 'mac_x86_64_10_5_scons', '', generic_builder, '', True)
#add_builder(c, 'salad_mac_x86_64_scons', 'darwin-9.x.universal', generic_builder, 'soc-2011-salad')
add_builder(c, 'mac_i386_scons', 'darwin-9.x.universal', generic_builder)
add_builder(c, 'mac_ppc_scons', 'darwin-9.x.universal', generic_builder)

@ -0,0 +1,45 @@
# ##### BEGIN GPL LICENSE BLOCK #####
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# ##### END GPL LICENSE BLOCK #####
# <pep8 compliant>
# Runs on buildbot slave, rsync zip directly to buildbot server rather
# than using upload which is much slower
import os
import sys
# get builder name
if len(sys.argv) < 2:
sys.stderr.write("Not enough arguments, expecting builder name\n")
sys.exit(1)
builder = sys.argv[1]
# rsync, this assumes ssh keys are setup so no password is needed
local_zip = "buildbot_upload.zip"
remote_folder = "builder.blender.org:/data/buildbot-master/uploaded/"
remote_zip = remote_folder + "buildbot_upload_" + builder + ".zip"
command = "rsync -avz %s %s" % (local_zip, remote_zip)
print(command)
ret = os.system(command)
sys.exit(ret)

@ -0,0 +1,146 @@
# - Find static icu libraries
# Find the native static icu libraries (needed for static boost_locale :/ ).
# This module defines
# ICU_LIBRARIES, libraries to link against to use icu.
# ICU_ROOT_DIR, The base directory to search for icu.
# This can also be an environment variable.
# ICU_FOUND, If false, do not try to use icu.
#
# also defined, but not for general use are
# ICU_LIBRARY_xxx, where to find the icu libraries.
#=============================================================================
# Copyright 2012 Blender Foundation.
#
# Distributed under the OSI-approved BSD License (the "License");
# see accompanying file Copyright.txt for details.
#
# This software is distributed WITHOUT ANY WARRANTY; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the License for more information.
#=============================================================================
# If ICU_ROOT_DIR was defined in the environment, use it.
IF(NOT ICU_ROOT_DIR AND NOT $ENV{ICU_ROOT_DIR} STREQUAL "")
SET(ICU_ROOT_DIR $ENV{ICU_ROOT_DIR})
ENDIF()
if(Boost_USE_STATIC_LIBS)
set(_icu_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES})
set(CMAKE_FIND_LIBRARY_SUFFIXES .a)
endif()
SET(_icu_SEARCH_DIRS
${ICU_ROOT_DIR}
/usr/local
/sw # Fink
/opt/local # DarwinPorts
/opt/csw # Blastwave
)
# We don't need includes, only libs to link against...
#FIND_PATH(ICU_INCLUDE_DIR
# NAMES
# utf.h
# HINTS
# ${_icu_SEARCH_DIRS}
# PATH_SUFFIXES
# include/unicode
#)
FIND_LIBRARY(ICU_LIBRARY_DATA
NAMES
icudata
HINTS
${_icu_SEARCH_DIRS}
PATH_SUFFIXES
lib64 lib
)
FIND_LIBRARY(ICU_LIBRARY_I18N
NAMES
icui18n
HINTS
${_icu_SEARCH_DIRS}
PATH_SUFFIXES
lib64 lib
)
FIND_LIBRARY(ICU_LIBRARY_IO
NAMES
icuio
HINTS
${_icu_SEARCH_DIRS}
PATH_SUFFIXES
lib64 lib
)
FIND_LIBRARY(ICU_LIBRARY_LE
NAMES
icule
HINTS
${_icu_SEARCH_DIRS}
PATH_SUFFIXES
lib64 lib
)
FIND_LIBRARY(ICU_LIBRARY_LX
NAMES
iculx
HINTS
${_icu_SEARCH_DIRS}
PATH_SUFFIXES
lib64 lib
)
FIND_LIBRARY(ICU_LIBRARY_TU
NAMES
icutu
HINTS
${_icu_SEARCH_DIRS}
PATH_SUFFIXES
lib64 lib
)
FIND_LIBRARY(ICU_LIBRARY_UC
NAMES
icuuc
HINTS
${_icu_SEARCH_DIRS}
PATH_SUFFIXES
lib64 lib
)
# Restore the original find library ordering
if(Boost_USE_STATIC_LIBS)
set(CMAKE_FIND_LIBRARY_SUFFIXES ${_icu_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES})
endif()
# handle the QUIETLY and REQUIRED arguments and set ICU_FOUND to TRUE if
# all listed variables are TRUE
INCLUDE(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(Icu DEFAULT_MSG
ICU_LIBRARY_DATA
ICU_LIBRARY_I18N
ICU_LIBRARY_IO
ICU_LIBRARY_LE
ICU_LIBRARY_LX
ICU_LIBRARY_TU
ICU_LIBRARY_UC
)
IF(ICU_FOUND)
SET(ICU_LIBRARIES ${ICU_LIBRARY_DATA} ${ICU_LIBRARY_I18N} ${ICU_LIBRARY_IO} ${ICU_LIBRARY_LE} ${ICU_LIBRARY_LX} ${ICU_LIBRARY_TU} ${ICU_LIBRARY_UC})
SET(ICU_INCLUDE_DIRS ${ICU_INCLUDE_DIR})
ENDIF(ICU_FOUND)
MARK_AS_ADVANCED(
ICU_INCLUDE_DIR
ICU_LIBRARY_DATA
ICU_LIBRARY_I18N
ICU_LIBRARY_IO
ICU_LIBRARY_LE
ICU_LIBRARY_LX
ICU_LIBRARY_TU
ICU_LIBRARY_UC
)

@ -39,6 +39,7 @@ SET(_opencolorio_SEARCH_DIRS
/sw # Fink
/opt/local # DarwinPorts
/opt/csw # Blastwave
/opt/lib/ocio
)
FIND_PATH(OPENCOLORIO_INCLUDE_DIR

@ -33,6 +33,7 @@ SET(_openimageio_SEARCH_DIRS
/sw # Fink
/opt/local # DarwinPorts
/opt/csw # Blastwave
/opt/lib/oiio
)
FIND_PATH(OPENIMAGEIO_INCLUDE_DIR

@ -9,6 +9,7 @@
# This module defines
# PYTHON_VERSION
# PYTHON_INCLUDE_DIRS
# PYTHON_INCLUDE_CONFIG_DIRS
# PYTHON_LIBRARIES
# PYTHON_LIBPATH, Used for installation
# PYTHON_LINKFLAGS
@ -46,17 +47,25 @@ MARK_AS_ADVANCED(PYTHON_LINKFLAGS)
# if the user passes these defines as args, we dont want to overwrite
SET(_IS_INC_DEF OFF)
SET(_IS_INC_CONF_DEF OFF)
SET(_IS_LIB_DEF OFF)
SET(_IS_LIB_PATH_DEF OFF)
IF(DEFINED PYTHON_INCLUDE_DIR)
SET(_IS_INC_DEF ON)
ENDIF()
IF(DEFINED PYTHON_INCLUDE_CONFIG_DIR)
SET(_IS_INC_CONF_DEF ON)
ENDIF()
IF(DEFINED PYTHON_LIBRARY)
SET(_IS_LIB_DEF ON)
ENDIF()
IF(DEFINED PYTHON_LIBPATH)
SET(_IS_LIB_PATH_DEF ON)
ENDIF()
# only search for the dirs if we havn't already
IF((NOT _IS_INC_DEF) OR (NOT _IS_LIB_DEF))
IF((NOT _IS_INC_DEF) OR (NOT _IS_INC_CONF_DEF) OR (NOT _IS_LIB_DEF) OR (NOT _IS_LIB_PATH_DEF))
SET(_python_ABI_FLAGS
"m;mu;u; " # release
@ -69,6 +78,7 @@ IF((NOT _IS_INC_DEF) OR (NOT _IS_LIB_DEF))
${PYTHON_ROOT_DIR}
"$ENV{HOME}/py${_PYTHON_VERSION_NO_DOTS}"
"/opt/py${_PYTHON_VERSION_NO_DOTS}"
"/opt/lib/python-${PYTHON_VERSION}"
)
FOREACH(_CURRENT_ABI_FLAGS ${_python_ABI_FLAGS})
@ -85,9 +95,27 @@ IF((NOT _IS_INC_DEF) OR (NOT _IS_LIB_DEF))
${_python_SEARCH_DIRS}
PATH_SUFFIXES
include/python${PYTHON_VERSION}${_CURRENT_ABI_FLAGS}
include/${CMAKE_LIBRARY_ARCHITECTURE}/python${PYTHON_VERSION}${_CURRENT_ABI_FLAGS}
)
ENDIF()
IF(NOT DEFINED PYTHON_INCLUDE_CONFIG_DIR)
FIND_PATH(PYTHON_INCLUDE_CONFIG_DIR
NAMES
pyconfig.h
HINTS
${_python_SEARCH_DIRS}
PATH_SUFFIXES
include/python${PYTHON_VERSION}${_CURRENT_ABI_FLAGS}
include/${CMAKE_LIBRARY_ARCHITECTURE}/python${PYTHON_VERSION}${_CURRENT_ABI_FLAGS}
)
IF((NOT PYTHON_INCLUDE_CONFIG_DIR) AND PYTHON_INCLUDE_DIR)
# Fallback...
UNSET(PYTHON_INCLUDE_CONFIG_DIR CACHE)
SET(PYTHON_INCLUDE_CONFIG_DIR ${PYTHON_INCLUDE_DIR} CACHE PATH "")
ENDIF()
ENDIF()
IF(NOT DEFINED PYTHON_LIBRARY)
FIND_LIBRARY(PYTHON_LIBRARY
NAMES
@ -99,16 +127,38 @@ IF((NOT _IS_INC_DEF) OR (NOT _IS_LIB_DEF))
)
ENDIF()
IF(PYTHON_LIBRARY AND PYTHON_INCLUDE_DIR)
IF(NOT DEFINED PYTHON_LIBPATH)
FIND_PATH(PYTHON_LIBPATH
NAMES
"python${PYTHON_VERSION}/abc.py" # This is a bit hackish! :/
HINTS
${_python_SEARCH_DIRS}
PATH_SUFFIXES
lib64 lib
)
IF((NOT PYTHON_LIBPATH) AND PYTHON_LIBRARY)
# Fallback...
UNSET(PYTHON_LIBPATH CACHE)
GET_FILENAME_COMPONENT(PYTHON_LIBPATH ${PYTHON_LIBRARY} PATH)
ENDIF()
ENDIF()
IF(PYTHON_LIBRARY AND PYTHON_LIBPATH AND PYTHON_INCLUDE_DIR AND PYTHON_INCLUDE_CONFIG_DIR)
break()
ELSE()
# ensure we dont find values from 2 different ABI versions
IF(NOT _IS_INC_DEF)
UNSET(PYTHON_INCLUDE_DIR CACHE)
ENDIF()
IF(NOT _IS_INC_CONF_DEF)
UNSET(PYTHON_INCLUDE_CONFIG_DIR CACHE)
ENDIF()
IF(NOT _IS_LIB_DEF)
UNSET(PYTHON_LIBRARY CACHE)
ENDIF()
IF(NOT _IS_LIB_PATH_DEF)
UNSET(PYTHON_LIBPATH CACHE)
ENDIF()
ENDIF()
ENDFOREACH()
@ -120,22 +170,24 @@ IF((NOT _IS_INC_DEF) OR (NOT _IS_LIB_DEF))
ENDIF()
UNSET(_IS_INC_DEF)
UNSET(_IS_INC_CONF_DEF)
UNSET(_IS_LIB_DEF)
UNSET(_IS_LIB_PATH_DEF)
# handle the QUIETLY and REQUIRED arguments and SET PYTHONLIBSUNIX_FOUND to TRUE IF
# all listed variables are TRUE
INCLUDE(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(PythonLibsUnix DEFAULT_MSG
PYTHON_LIBRARY PYTHON_INCLUDE_DIR)
PYTHON_LIBRARY PYTHON_LIBPATH PYTHON_INCLUDE_DIR PYTHON_INCLUDE_CONFIG_DIR)
IF(PYTHONLIBSUNIX_FOUND)
# Assign cache items
SET(PYTHON_INCLUDE_DIRS ${PYTHON_INCLUDE_DIR})
SET(PYTHON_INCLUDE_DIRS ${PYTHON_INCLUDE_DIR} ${PYTHON_INCLUDE_CONFIG_DIR})
SET(PYTHON_LIBRARIES ${PYTHON_LIBRARY})
# we need this for installation
GET_FILENAME_COMPONENT(PYTHON_LIBPATH ${PYTHON_LIBRARY} PATH)
# XXX No more valid with debian-like py3.3 packages...
# GET_FILENAME_COMPONENT(PYTHON_LIBPATH ${PYTHON_LIBRARY} PATH)
# not used
# SET(PYTHON_BINARY ${PYTHON_EXECUTABLE} CACHE STRING "")
@ -143,5 +195,6 @@ ENDIF()
MARK_AS_ADVANCED(
PYTHON_INCLUDE_DIR
PYTHON_INCLUDE_CONFIG_DIR
PYTHON_LIBRARY
)

@ -1,4 +1,4 @@
#!/usr/bin/env python3.2
#!/usr/bin/env python3
# ***** BEGIN GPL LICENSE BLOCK *****
#
@ -222,8 +222,8 @@ def cmake_get_src(f):
'''
# reset
sources_h[:] = []
sources_c[:] = []
del sources_h[:]
del sources_c[:]
filen.close()

@ -1,4 +1,4 @@
#!/usr/bin/env python3.2
#!/usr/bin/env python3
# ***** BEGIN GPL LICENSE BLOCK *****
#

@ -1,4 +1,4 @@
#!/usr/bin/env python3.2
#!/usr/bin/env python3
# ***** BEGIN GPL LICENSE BLOCK *****
#

@ -1,4 +1,4 @@
#!/usr/bin/env python3.2
#!/usr/bin/env python3
# ***** BEGIN GPL LICENSE BLOCK *****
#
@ -27,6 +27,8 @@ import subprocess
import sys
import os
USE_QUIET = (os.environ.get("QUIET", None) is not None)
CHECKER_IGNORE_PREFIX = [
"extern",
"intern/moto",
@ -59,11 +61,12 @@ def main():
process_functions = []
def my_process(i, c, cmd):
percent = 100.0 * (i / (len(check_commands) - 1))
percent_str = "[" + ("%.2f]" % percent).rjust(7) + " %:"
if not USE_QUIET:
percent = 100.0 * (i / (len(check_commands) - 1))
percent_str = "[" + ("%.2f]" % percent).rjust(7) + " %:"
sys.stdout.flush()
sys.stdout.write("%s " % percent_str)
sys.stdout.flush()
sys.stdout.write("%s " % percent_str)
return subprocess.Popen(cmd)

@ -1,4 +1,4 @@
#!/usr/bin/env python3.2
#!/usr/bin/env python3
# ***** BEGIN GPL LICENSE BLOCK *****
#
@ -27,6 +27,8 @@ import subprocess
import sys
import os
USE_QUIET = (os.environ.get("QUIET", None) is not None)
CHECKER_IGNORE_PREFIX = [
"extern",
"intern/moto",
@ -44,6 +46,9 @@ CHECKER_ARGS = [
# "--enable=all", # if you want sixty hundred pedantic suggestions
]
if USE_QUIET:
CHECKER_ARGS.append("--quiet")
def main():
source_info = project_source_info.build_info(ignore_prefix_list=CHECKER_IGNORE_PREFIX)
@ -62,11 +67,12 @@ def main():
process_functions = []
def my_process(i, c, cmd):
percent = 100.0 * (i / (len(check_commands) - 1))
percent_str = "[" + ("%.2f]" % percent).rjust(7) + " %:"
if not USE_QUIET:
percent = 100.0 * (i / (len(check_commands) - 1))
percent_str = "[" + ("%.2f]" % percent).rjust(7) + " %:"
sys.stdout.flush()
sys.stdout.write("%s " % percent_str)
sys.stdout.flush()
sys.stdout.write("%s " % percent_str)
return subprocess.Popen(cmd)
@ -75,6 +81,8 @@ def main():
project_source_info.queue_processes(process_functions)
print("Finished!")
if __name__ == "__main__":
main()

@ -1,4 +1,4 @@
#!/usr/bin/env python3.2
#!/usr/bin/env python3
# ***** BEGIN GPL LICENSE BLOCK *****
#
@ -37,7 +37,9 @@ CHECKER_ARGS = [
import project_source_info
import subprocess
import sys
import os
USE_QUIET = (os.environ.get("QUIET", None) is not None)
def main():
source_info = project_source_info.build_info(use_cxx=False, ignore_prefix_list=CHECKER_IGNORE_PREFIX)
@ -55,11 +57,12 @@ def main():
check_commands.append((c, cmd))
def my_process(i, c, cmd):
percent = 100.0 * (i / (len(check_commands) - 1))
percent_str = "[" + ("%.2f]" % percent).rjust(7) + " %:"
if not USE_QUIET:
percent = 100.0 * (i / (len(check_commands) - 1))
percent_str = "[" + ("%.2f]" % percent).rjust(7) + " %:"
sys.stdout.flush()
sys.stdout.write("%s %s\n" % (percent_str, c))
sys.stdout.flush()
sys.stdout.write("%s %s\n" % (percent_str, c))
return subprocess.Popen(cmd)

@ -1,4 +1,4 @@
#!/usr/bin/env python3.2
#!/usr/bin/env python3
# ***** BEGIN GPL LICENSE BLOCK *****
#
@ -35,6 +35,9 @@ CHECKER_ARGS = [
import project_source_info
import subprocess
import sys
import os
USE_QUIET = (os.environ.get("QUIET", None) is not None)
def main():
@ -53,11 +56,12 @@ def main():
check_commands.append((c, cmd))
def my_process(i, c, cmd):
percent = 100.0 * (i / (len(check_commands) - 1))
percent_str = "[" + ("%.2f]" % percent).rjust(7) + " %:"
if not USE_QUIET:
percent = 100.0 * (i / (len(check_commands) - 1))
percent_str = "[" + ("%.2f]" % percent).rjust(7) + " %:"
sys.stdout.flush()
sys.stdout.write("%s %s\n" % (percent_str, c))
sys.stdout.flush()
sys.stdout.write("%s %s\n" % (percent_str, c))
return subprocess.Popen(cmd)

@ -1,4 +1,4 @@
#!/usr/bin/env python3.2
#!/usr/bin/env python3
# ***** BEGIN GPL LICENSE BLOCK *****
#
@ -68,6 +68,9 @@ CHECKER_ARGS = [
import project_source_info
import subprocess
import sys
import os
USE_QUIET = (os.environ.get("QUIET", None) is not None)
def main():
@ -85,11 +88,12 @@ def main():
check_commands.append((c, cmd))
def my_process(i, c, cmd):
percent = 100.0 * (i / (len(check_commands) - 1))
percent_str = "[" + ("%.2f]" % percent).rjust(7) + " %:"
if not USE_QUIET:
percent = 100.0 * (i / (len(check_commands) - 1))
percent_str = "[" + ("%.2f]" % percent).rjust(7) + " %:"
sys.stdout.write("%s %s\n" % (percent_str, c))
sys.stdout.flush()
sys.stdout.write("%s %s\n" % (percent_str, c))
sys.stdout.flush()
return subprocess.Popen(cmd)

@ -1,4 +1,4 @@
#!/usr/bin/env python3.2
#!/usr/bin/env python3
# ##### BEGIN GPL LICENSE BLOCK #####
#

@ -196,10 +196,6 @@ macro(SETUP_LIBDIRS)
if(WITH_PYTHON) # AND NOT WITH_PYTHON_MODULE # WIN32 needs
link_directories(${PYTHON_LIBPATH})
endif()
if(WITH_INTERNATIONAL)
link_directories(${ICONV_LIBPATH})
link_directories(${GETTEXT_LIBPATH})
endif()
if(WITH_SDL)
link_directories(${SDL_LIBPATH})
endif()
@ -287,14 +283,6 @@ macro(setup_liblinks
target_link_libraries(${target} ${GLEW_LIBRARY})
endif()
if(WITH_INTERNATIONAL)
target_link_libraries(${target} ${GETTEXT_LIBRARIES})
if(WIN32 AND NOT UNIX)
target_link_libraries(${target} ${ICONV_LIBRARIES})
endif()
endif()
if(WITH_OPENAL)
target_link_libraries(${target} ${OPENAL_LIBRARY})
endif()
@ -324,6 +312,9 @@ macro(setup_liblinks
endif()
if(WITH_BOOST)
target_link_libraries(${target} ${BOOST_LIBRARIES})
if(Boost_USE_STATIC_LIBS AND Boost_USE_ICU)
target_link_libraries(${target} ${ICU_LIBRARIES})
endif()
endif()
target_link_libraries(${target} ${JPEG_LIBRARIES})
if(WITH_IMAGE_OPENEXR)
@ -712,7 +703,11 @@ macro(delayed_install
destination)
foreach(f ${files})
set_property(GLOBAL APPEND PROPERTY DELAYED_INSTALL_FILES ${base}/${f})
if(IS_ABSOLUTE ${f})
set_property(GLOBAL APPEND PROPERTY DELAYED_INSTALL_FILES ${f})
else()
set_property(GLOBAL APPEND PROPERTY DELAYED_INSTALL_FILES ${base}/${f})
endif()
set_property(GLOBAL APPEND PROPERTY DELAYED_INSTALL_DESTINATIONS ${destination})
endforeach()
endmacro()

@ -1,4 +1,4 @@
#!/usr/bin/env python3.2
#!/usr/bin/env python3
# ***** BEGIN GPL LICENSE BLOCK *****
#

@ -118,16 +118,16 @@ BF_FFMPEG_LIBPATH='${BF_FFMPEG}/lib'
BF_FFMPEG_LIB = 'avcodec avdevice avformat avutil mp3lame swscale x264 xvidcore theora theoradec theoraenc vorbis vorbisenc vorbisfile ogg bz2'
#bz2 is a standard osx dynlib
BF_PYTHON_VERSION = '3.2'
BF_PYTHON_VERSION = '3.3'
WITH_OSX_STATICPYTHON = True
if WITH_OSX_STATICPYTHON:
# python 3.2 uses precompiled libraries in bf svn /lib by default
# python 3.3 uses precompiled libraries in bf svn /lib by default
BF_PYTHON = LIBDIR + '/python'
BF_PYTHON_INC = '${BF_PYTHON}/include/python${BF_PYTHON_VERSION}'
BF_PYTHON_INC = '${BF_PYTHON}/include/python${BF_PYTHON_VERSION}m'
# BF_PYTHON_BINARY = '${BF_PYTHON}/bin/python${BF_PYTHON_VERSION}'
BF_PYTHON_LIB = 'python${BF_PYTHON_VERSION}'
BF_PYTHON_LIB = 'python${BF_PYTHON_VERSION}m'
BF_PYTHON_LIBPATH = '${BF_PYTHON}/lib/python${BF_PYTHON_VERSION}'
# BF_PYTHON_LINKFLAGS = ['-u', '_PyMac_Error', '-framework', 'System']
else:
@ -223,11 +223,6 @@ BF_ZLIB_LIB = 'z'
WITH_BF_INTERNATIONAL = True
BF_GETTEXT = LIBDIR + '/gettext'
BF_GETTEXT_INC = '${BF_GETTEXT}/include'
BF_GETTEXT_LIB = 'intl'
BF_GETTEXT_LIBPATH = '${BF_GETTEXT}/lib'
WITH_BF_GAMEENGINE = True
WITH_BF_PLAYER = True
WITH_BF_OCEANSIM = True
@ -281,23 +276,42 @@ BF_PCRE_LIBPATH = '${BF_PCRE}/lib'
# Cycles
WITH_BF_CYCLES = True
#OSL
WITH_BF_CYCLES_OSL = True
BF_OSL = LIBDIR + '/osl'
BF_OSL_INC = '${BF_OSL}/include'
# note oslexec would passed via program linkflags, which is needed to
# make llvm happy with osl_allocate_closure_component
#BF_OSL_LIB = 'oslcomp oslquery'
BF_OSL_LIBPATH = '${BF_OSL}/lib'
BF_OSL_COMPILER = '${BF_OSL}/bin/oslc'
WITH_BF_LLVM = True
BF_LLVM = LIBDIR + '/llvm'
BF_LLVM_LIB = 'LLVMBitReader LLVMJIT LLVMipo LLVMVectorize LLVMBitWriter LLVMX86CodeGen LLVMX86Desc LLVMX86Info LLVMX86AsmPrinter ' + \
'LLVMX86Utils LLVMSelectionDAG LLVMCodeGen LLVMScalarOpts LLVMInstCombine LLVMTransformUtils LLVMipa LLVMAnalysis LLVMExecutionEngine ' + \
'LLVMTarget LLVMMC LLVMCore LLVMSupport'
BF_LLVM_LIBPATH = '${BF_LLVM}/lib'
WITH_BF_OIIO = True
BF_OIIO = LIBDIR + '/openimageio'
BF_OIIO_INC = BF_OIIO + '/include'
BF_OIIO_INC = '${BF_OIIO}/include'
BF_OIIO_LIB = 'OpenImageIO'
BF_OIIO_LIBPATH = BF_OIIO + '/lib'
BF_OIIO_LIBPATH = '${BF_OIIO}/lib'
WITH_BF_OCIO = True
BF_OCIO = LIBDIR + '/opencolorio'
BF_OCIO_INC = BF_OCIO + '/include'
BF_OCIO_INC = '${BF_OCIO}/include'
BF_OCIO_LIB = 'OpenColorIO tinyxml yaml-cpp'
BF_OCIO_LIBPATH = BF_OCIO + '/lib'
BF_OCIO_LIBPATH = '${BF_OCIO}/lib'
WITH_BF_BOOST = True
BF_BOOST = LIBDIR + '/boost'
BF_BOOST_INC = BF_BOOST + '/include'
BF_BOOST_LIB = 'boost_date_time-mt boost_filesystem-mt boost_regex-mt boost_system-mt boost_thread-mt'
BF_BOOST_LIBPATH = BF_BOOST + '/lib'
BF_BOOST_INC = '${BF_BOOST}/include'
BF_BOOST_LIB = 'boost_date_time-mt boost_filesystem-mt boost_regex-mt boost_system-mt boost_thread-mt boost_wave-mt'
BF_BOOST_LIB_INTERNATIONAL = 'boost_locale-mt'
BF_BOOST_LIBPATH = '${BF_BOOST}/lib'
WITH_BF_CYCLES_CUDA_BINARIES = False
BF_CYCLES_CUDA_NVCC = '/usr/local/cuda/bin/nvcc'

@ -7,7 +7,7 @@ LIBDIR = "${LCGDIR}"
BF_PYTHON_ABI_FLAGS = ''
BF_PYTHON = '/usr/local'
BF_PYTHON_LIBPATH = '${BF_PYTHON}/lib'
BF_PYTHON_VERSION = '3.2'
BF_PYTHON_VERSION = '3.3'
WITH_BF_STATICPYTHON = False
BF_PYTHON_INC = '${BF_PYTHON}/include/python${BF_PYTHON_VERSION}${BF_PYTHON_ABI_FLAGS}'
BF_PYTHON_BINARY = '${BF_PYTHON}/bin/python${BF_PYTHON_VERSION}'
@ -77,11 +77,6 @@ BF_ZLIB_LIB = 'z'
WITH_BF_INTERNATIONAL = True
BF_GETTEXT = '/usr/local'
BF_GETTEXT_INC = '${BF_GETTEXT}/include'
BF_GETTEXT_LIB = 'gettextlib'
BF_GETTEXT_LIBPATH = '${BF_GETTEXT}/lib'
WITH_BF_GAMEENGINE = False
WITH_BF_PLAYER = True
WITH_BF_OCEANSIM = True

@ -7,7 +7,7 @@ LIBDIR = "${LCGDIR}"
BF_PYTHON_ABI_FLAGS = ''
BF_PYTHON = '/usr/local'
BF_PYTHON_LIBPATH = '${BF_PYTHON}/lib'
BF_PYTHON_VERSION = '3.2'
BF_PYTHON_VERSION = '3.3'
WITH_BF_STATICPYTHON = False
BF_PYTHON_INC = '${BF_PYTHON}/include/python${BF_PYTHON_VERSION}${BF_PYTHON_ABI_FLAGS}'
BF_PYTHON_BINARY = '${BF_PYTHON}/bin/python${BF_PYTHON_VERSION}'
@ -77,11 +77,6 @@ BF_ZLIB_LIB = 'z'
WITH_BF_INTERNATIONAL = True
BF_GETTEXT = '/usr/local'
BF_GETTEXT_INC = '${BF_GETTEXT}/include'
BF_GETTEXT_LIB = 'gettextlib'
BF_GETTEXT_LIBPATH = '${BF_GETTEXT}/lib'
WITH_BF_GAMEENGINE = False
WITH_BF_PLAYER = True
WITH_BF_OCEANSIM = True

@ -7,7 +7,7 @@ LIBDIR = "${LCGDIR}"
BF_PYTHON_ABI_FLAGS = ''
BF_PYTHON = '/usr/local'
BF_PYTHON_LIBPATH = '${BF_PYTHON}/lib'
BF_PYTHON_VERSION = '3.2'
BF_PYTHON_VERSION = '3.3'
WITH_BF_STATICPYTHON = False
BF_PYTHON_INC = '${BF_PYTHON}/include/python${BF_PYTHON_VERSION}${BF_PYTHON_ABI_FLAGS}'
BF_PYTHON_BINARY = '${BF_PYTHON}/bin/python${BF_PYTHON_VERSION}'
@ -77,11 +77,6 @@ BF_ZLIB_LIB = 'z'
WITH_BF_INTERNATIONAL = True
BF_GETTEXT = '/usr/local'
BF_GETTEXT_INC = '${BF_GETTEXT}/include'
BF_GETTEXT_LIB = 'gettextlib'
BF_GETTEXT_LIBPATH = '${BF_GETTEXT}/lib'
WITH_BF_GAMEENGINE = False
WITH_BF_PLAYER = True
WITH_BF_OCEANSIM = True

@ -89,13 +89,6 @@ BF_ZLIB_LIB = 'z'
WITH_BF_INTERNATIONAL = True
BF_GETTEXT = '/usr'
BF_GETTEXT_INC = '${BF_GETTEXT}/include'
BF_GETTEXT_LIB = 'gettextlib'
BF_GETTEXT_LIBPATH = '${BF_GETTEXT}/lib'
#WITH_BF_GETTEXT_STATIC = True
#BF_GETTEXT_LIB_STATIC = '${BF_GETTEXT}/lib/libgettextlib.a'
WITH_BF_GAMEENGINE = True
WITH_BF_PLAYER = True
WITH_BF_OCEANSIM = True
@ -211,9 +204,9 @@ BF_OIIO = LIBDIR + '/oiio'
if not os.path.exists(LCGDIR + '/oiio'):
WITH_BF_OIIO = False
BF_OIIO = '/usr'
BF_OIIO_INC = BF_OIIO + '/include'
BF_OIIO_INC = '${BF_OIIO}/include'
BF_OIIO_LIB = 'OpenImageIO'
BF_OIIO_LIBPATH = BF_OIIO + '/lib'
BF_OIIO_LIBPATH = '${BF_OIIO}/lib'
WITH_BF_OCIO = True
WITH_BF_STATICOCIO = False
@ -221,9 +214,9 @@ BF_OCIO = LIBDIR + '/ocio'
if not os.path.exists(LCGDIR + '/ocio'):
WITH_BF_OCIO = False
BF_OCIO = '/usr'
BF_OCIO_INC = BF_OCIO + '/include'
BF_OCIO_INC = '${BF_OCIO}/include'
BF_OCIO_LIB = 'OpenColorIO yaml-cpp tinyxml'
BF_OCIO_LIBPATH = BF_OCIO + '/lib'
BF_OCIO_LIBPATH = '${BF_OCIO}/lib'
WITH_BF_BOOST = True
WITH_BF_STATICBOOST = False
@ -231,9 +224,10 @@ BF_BOOST = LIBDIR + '/boost'
if not os.path.exists(LCGDIR + '/boost'):
WITH_BF_BOOST = False
BF_BOOST = '/usr'
BF_BOOST_INC = BF_BOOST + '/include'
BF_BOOST_INC = '${BF_BOOST}/include'
BF_BOOST_LIB = 'boost_date_time boost_filesystem boost_regex boost_system boost_thread'
BF_BOOST_LIBPATH = BF_BOOST + '/lib'
BF_BOOST_LIB_INTERNATIONAL = 'boost_locale'
BF_BOOST_LIBPATH = '${BF_BOOST}/lib'
WITH_BF_CYCLES = WITH_BF_OIIO and WITH_BF_BOOST
@ -304,3 +298,7 @@ BF_INSTALLDIR='../install/linux'
#Link against pthread
PLATFORM_LINKFLAGS = ['-pthread']
#Fix for LLVM conflict with Mesa llvmpipe
if WITH_BF_LLVM:
PLATFORM_LINKFLAGS += ['-Wl,--version-script=source/creator/blender.map']

@ -2,7 +2,7 @@ LCGDIR = '#../lib/windows'
LIBDIR = '${LCGDIR}'
BF_PYTHON = LIBDIR + '/python'
BF_PYTHON_VERSION = '3.2'
BF_PYTHON_VERSION = '3.3'
BF_PYTHON_INC = '${BF_PYTHON}/include/python${BF_PYTHON_VERSION}'
BF_PYTHON_BINARY = 'python'
BF_PYTHON_LIB = 'python${BF_PYTHON_VERSION[0]}${BF_PYTHON_VERSION[2]}mw'
@ -83,11 +83,6 @@ BF_ZLIB_LIBPATH = '${BF_ZLIB}/lib'
WITH_BF_INTERNATIONAL = True
BF_GETTEXT = LIBDIR + '/gcc/gettext'
BF_GETTEXT_INC = '${BF_GETTEXT}/include'
BF_GETTEXT_LIB = 'intl'
BF_GETTEXT_LIBPATH = '${BF_GETTEXT}/lib'
WITH_BF_GAMEENGINE = True
WITH_BF_PLAYER = False
WITH_BF_OCEANSIM = True

@ -2,12 +2,12 @@ LCGDIR = '#../lib/mingw32'
LIBDIR = "${LCGDIR}"
BF_PYTHON = LIBDIR + '/python'
BF_PYTHON_VERSION = '3.2'
BF_PYTHON_VERSION = '3.3'
WITH_BF_STATICPYTHON = False
BF_PYTHON_INC = '${BF_PYTHON}/include/python${BF_PYTHON_VERSION}'
BF_PYTHON_BINARY = 'python'
BF_PYTHON_LIB = 'python${BF_PYTHON_VERSION[0]}${BF_PYTHON_VERSION[2]}mw'
BF_PYTHON_DLL = 'python32'
BF_PYTHON_DLL = 'python33'
BF_PYTHON_LIBPATH = '${BF_PYTHON}/lib'
BF_PYTHON_LIB_STATIC = '${BF_PYTHON}/lib/libpython${BF_PYTHON_VERSION[0]}${BF_PYTHON_VERSION[2]}.a'
@ -83,11 +83,6 @@ BF_ZLIB_LIBPATH = '${BF_ZLIB}/lib'
WITH_BF_INTERNATIONAL = True
BF_GETTEXT = LIBDIR + '/gettext'
BF_GETTEXT_INC = '${BF_GETTEXT}/include'
BF_GETTEXT_LIB = 'intl'
BF_GETTEXT_LIBPATH = '${BF_GETTEXT}/lib'
WITH_BF_OPENJPEG = True
BF_OPENJPEG = '#extern/libopenjpeg'
BF_OPENJPEG_LIB = ''
@ -155,21 +150,22 @@ WITH_BF_CYCLES = True
WITH_BF_OIIO = True
BF_OIIO = LIBDIR + '/openimageio'
BF_OIIO_INC = BF_OIIO + '/include'
BF_OIIO_INC = '${BF_OIIO}/include'
BF_OIIO_LIB = 'OpenImageIO'
BF_OIIO_LIBPATH = BF_OIIO + '/lib'
BF_OIIO_LIBPATH = '${BF_OIIO}/lib'
WITH_BF_OCIO = True
BF_OCIO = LIBDIR + '/opencolorio'
BF_OCIO_INC = BF_OCIO + '/include'
BF_OCIO_INC = '${BF_OCIO}/include'
BF_OCIO_LIB = 'OpenColorIO'
BF_OCIO_LIBPATH = BF_OCIO + '/lib'
BF_OCIO_LIBPATH = '${BF_OCIO}/lib'
WITH_BF_BOOST = True
BF_BOOST = LIBDIR + '/boost'
BF_BOOST_INC = BF_BOOST + '/include'
BF_BOOST_INC = '${BF_BOOST}/include'
BF_BOOST_LIB = 'boost_date_time-mgw46-mt-s-1_49 boost_filesystem-mgw46-mt-s-1_49 boost_regex-mgw46-mt-s-1_49 boost_system-mgw46-mt-s-1_49 boost_thread-mgw46-mt-s-1_49'
BF_BOOST_LIBPATH = BF_BOOST + '/lib'
BF_BOOST_LIB_INTERNATIONAL = 'boost_locale-mgw46-mt-s-1_49'
BF_BOOST_LIBPATH = '${BF_BOOST}/lib'
#Ray trace optimization
WITH_BF_RAYOPTIMIZATION = True

@ -9,10 +9,10 @@ BF_FFMPEG_LIB = 'avformat-53.lib avcodec-53.lib avdevice-53.lib avutil-51.lib sw
BF_FFMPEG_DLL = '${BF_FFMPEG_LIBPATH}/avformat-53.dll ${BF_FFMPEG_LIBPATH}/avcodec-53.dll ${BF_FFMPEG_LIBPATH}/avdevice-53.dll ${BF_FFMPEG_LIBPATH}/avutil-51.dll ${BF_FFMPEG_LIBPATH}/swscale-2.dll'
BF_PYTHON = LIBDIR + '/python'
BF_PYTHON_VERSION = '3.2'
BF_PYTHON_VERSION = '3.3'
BF_PYTHON_INC = '${BF_PYTHON}/include/python${BF_PYTHON_VERSION}'
BF_PYTHON_BINARY = 'python'
BF_PYTHON_LIB = 'python32'
BF_PYTHON_LIB = 'python33'
BF_PYTHON_DLL = '${BF_PYTHON_LIB}'
BF_PYTHON_LIBPATH = '${BF_PYTHON}/lib'
@ -54,7 +54,7 @@ BF_PTHREADS_LIBPATH = '${BF_PTHREADS}/lib'
WITH_BF_OPENEXR = True
WITH_BF_STATICOPENEXR = False
BF_OPENEXR = LIBDIR + '/openexr'
BF_OPENEXR_INC = '${BF_OPENEXR}/include ${BF_OPENEXR}/include/IlmImf ${BF_OPENEXR}/include/Iex ${BF_OPENEXR}/include/Imath '
BF_OPENEXR_INC = '${BF_OPENEXR}/include ${BF_OPENEXR}/include/OpenEXR '
BF_OPENEXR_LIB = ' Iex Half IlmImf Imath IlmThread '
BF_OPENEXR_LIBPATH = '${BF_OPENEXR}/lib'
BF_OPENEXR_LIB_STATIC = '${BF_OPENEXR}/lib/libHalf.a ${BF_OPENEXR}/lib/libIlmImf.a ${BF_OPENEXR}/lib/libIex.a ${BF_OPENEXR}/lib/libImath.a ${BF_OPENEXR}/lib/libIlmThread.a'
@ -87,11 +87,6 @@ BF_ZLIB_LIBPATH = '${BF_ZLIB}/lib'
WITH_BF_INTERNATIONAL = True
BF_GETTEXT = LIBDIR + '/gettext'
BF_GETTEXT_INC = '${BF_GETTEXT}/include'
BF_GETTEXT_LIB = 'gnu_gettext'
BF_GETTEXT_LIBPATH = '${BF_GETTEXT}/lib'
WITH_BF_GAMEENGINE = True
WITH_BF_PLAYER = True
WITH_BF_OCEANSIM = True
@ -155,22 +150,40 @@ WITH_BF_OPENMP = True
#Cycles
WITH_BF_CYCLES = True
WITH_BF_CYCLES_OSL = True
WITH_BF_STATICOSL = True
BF_OSL = '${LIBDIR}/osl'
BF_OSL_INC = '${BF_OSL}/include'
BF_OSL_LIBPATH = '${BF_OSL}/lib'
BF_OSL_LIB_STATIC = '${BF_OSL_LIBPATH}/oslcomp.lib ${BF_OSL_LIBPATH}/oslexec.lib ${BF_OSL_LIBPATH}/oslquery.lib '
BF_OSL_COMPILER = '${BF_OSL}/bin/oslc'
WITH_BF_LLVM = True
BF_LLVM = LIBDIR + '/llvm'
BF_LLVM_LIB = 'LLVMBitReader LLVMJIT LLVMipo LLVMVectorize LLVMBitWriter LLVMX86CodeGen LLVMX86Desc LLVMX86Info LLVMX86AsmPrinter ' + \
'LLVMX86Utils LLVMSelectionDAG LLVMCodeGen LLVMScalarOpts LLVMInstCombine LLVMTransformUtils LLVMipa LLVMAnalysis LLVMExecutionEngine ' + \
'LLVMTarget LLVMMC LLVMCore LLVMSupport'
BF_LLVM_LIBPATH = '${BF_LLVM}/lib'
WITH_BF_OIIO = True
BF_OIIO = '${LIBDIR}/openimageio'
BF_OIIO_INC = '${BF_OIIO}/include'
BF_OIIO_LIB = 'OpenImageIO'
BF_OIIO_LIBPATH = '${BF_OIIO}/lib'
BF_OIIO_LIB_STATIC = '${BF_OIIO_LIBPATH}/OpenImageIO.lib'
WITH_BF_STATICOIIO = True
WITH_BF_OCIO = True
BF_OCIO = '${LIBDIR}/opencolorio'
BF_OCIO_INC = '${BF_OCIO}/include'
BF_OCIO_LIB = 'OpenColorIO'
BF_OCIO_LIBPATH = '${BF_OCIO}/lib'
BF_OCIO_LIB_STATIC = '${BF_OCIO_LIBPATH}/OpenColorIO.lib'
WITH_BF_STATICOCIO = True
WITH_BF_BOOST = True
BF_BOOST = '${LIBDIR}/boost'
BF_BOOST_INC = '${BF_BOOST}/include'
BF_BOOST_LIB = 'libboost_date_time-vc90-mt-s-1_49 libboost_filesystem-vc90-mt-s-1_49 libboost_regex-vc90-mt-s-1_49 libboost_system-vc90-mt-s-1_49 libboost_thread-vc90-mt-s-1_49'
BF_BOOST_LIB_INTERNATIONAL = 'libboost_locale-vc90-mt-s-1_49'
BF_BOOST_LIBPATH = '${BF_BOOST}/lib'
#CUDA
@ -208,7 +221,7 @@ C_WARN = []
CC_WARN = []
CXX_WARN = []
LLIBS = ['ws2_32', 'vfw32', 'winmm', 'kernel32', 'user32', 'gdi32', 'comdlg32', 'advapi32', 'shfolder', 'shell32', 'ole32', 'oleaut32', 'uuid']
LLIBS = ['ws2_32', 'vfw32', 'winmm', 'kernel32', 'user32', 'gdi32', 'comdlg32', 'advapi32', 'shfolder', 'shell32', 'ole32', 'oleaut32', 'uuid', 'psapi']
PLATFORM_LINKFLAGS = ['/SUBSYSTEM:CONSOLE','/MACHINE:IX86','/STACK:2097152','/INCREMENTAL:NO', '/LARGEADDRESSAWARE', '/NODEFAULTLIB:msvcrt.lib', '/NODEFAULTLIB:msvcmrt.lib', '/NODEFAULTLIB:msvcurt.lib', '/NODEFAULTLIB:msvcrtd.lib']

@ -2,12 +2,12 @@ LCGDIR = '#../lib/mingw64'
LIBDIR = "${LCGDIR}"
BF_PYTHON = LIBDIR + '/python'
BF_PYTHON_VERSION = '3.2'
BF_PYTHON_VERSION = '3.3'
WITH_BF_STATICPYTHON = False
BF_PYTHON_INC = '${BF_PYTHON}/include/python${BF_PYTHON_VERSION}'
BF_PYTHON_BINARY = 'python'
BF_PYTHON_LIB = 'python${BF_PYTHON_VERSION[0]}${BF_PYTHON_VERSION[2]}mw'
BF_PYTHON_DLL = 'python32'
BF_PYTHON_DLL = 'python33'
BF_PYTHON_LIBPATH = '${BF_PYTHON}/lib'
WITH_BF_OPENAL = True
@ -80,11 +80,6 @@ BF_ZLIB_LIBPATH = '${BF_ZLIB}/lib'
WITH_BF_INTERNATIONAL = True
BF_GETTEXT = LIBDIR + '/gettext'
BF_GETTEXT_INC = '${BF_GETTEXT}/include'
BF_GETTEXT_LIB = 'intl'
BF_GETTEXT_LIBPATH = '${BF_GETTEXT}/lib'
WITH_BF_OPENJPEG = True
BF_OPENJPEG = '#extern/libopenjpeg'
BF_OPENJPEG_LIB = ''
@ -118,7 +113,7 @@ BF_FREETYPE_LIBPATH = '${BF_FREETYPE}/lib'
WITH_BF_QUICKTIME = False
WITH_BF_ICONV = True
WITH_BF_ICONV = False
BF_ICONV = LIBDIR + "/iconv"
BF_ICONV_INC = '${BF_ICONV}/include'
BF_ICONV_LIB = 'iconv'
@ -167,9 +162,10 @@ BF_OCIO_LIBPATH = '${BF_OCIO}/lib'
WITH_BF_BOOST = True
BF_BOOST = LIBDIR + '/boost'
BF_BOOST_INC = BF_BOOST + '/include'
BF_BOOST_INC = '${BF_BOOST}/include'
BF_BOOST_LIB = 'boost_date_time-mgw47-mt-s-1_49 boost_date_time-mgw47-mt-sd-1_49 boost_filesystem-mgw47-mt-s-1_49 boost_filesystem-mgw47-mt-sd-1_49 boost_regex-mgw47-mt-s-1_49 boost_regex-mgw47-mt-sd-1_49 boost_system-mgw47-mt-s-1_49 boost_system-mgw47-mt-sd-1_49 boost_thread-mgw47-mt-s-1_49 boost_thread-mgw47-mt-sd-1_49'
BF_BOOST_LIBPATH = BF_BOOST + '/lib'
BF_BOOST_LIB_INTERNATIONAL = ' boost_locale-mgw47-mt-s-1_49 boost_locale-mgw47-mt-sd-1_49'
BF_BOOST_LIBPATH = '${BF_BOOST}/lib'
#Ray trace optimization
WITH_BF_RAYOPTIMIZATION = True

@ -9,10 +9,10 @@ BF_FFMPEG_LIB = 'avformat-53.lib avcodec-53.lib avdevice-53.lib avutil-51.lib sw
BF_FFMPEG_DLL = '${BF_FFMPEG_LIBPATH}/avformat-53.dll ${BF_FFMPEG_LIBPATH}/avcodec-53.dll ${BF_FFMPEG_LIBPATH}/avdevice-53.dll ${BF_FFMPEG_LIBPATH}/avutil-51.dll ${BF_FFMPEG_LIBPATH}/swscale-2.dll'
BF_PYTHON = LIBDIR + '/python'
BF_PYTHON_VERSION = '3.2'
BF_PYTHON_VERSION = '3.3'
BF_PYTHON_INC = '${BF_PYTHON}/include/python${BF_PYTHON_VERSION}'
BF_PYTHON_BINARY = 'python'
BF_PYTHON_LIB = 'python32'
BF_PYTHON_LIB = 'python33'
BF_PYTHON_DLL = '${BF_PYTHON_LIB}'
BF_PYTHON_LIBPATH = '${BF_PYTHON}/lib'
@ -50,7 +50,7 @@ BF_PTHREADS_LIBPATH = '${BF_PTHREADS}/lib'
WITH_BF_OPENEXR = True
WITH_BF_STATICOPENEXR = False
BF_OPENEXR = LIBDIR + '/openexr'
BF_OPENEXR_INC = '${BF_OPENEXR}/include ${BF_OPENEXR}/include/IlmImf ${BF_OPENEXR}/include/Iex ${BF_OPENEXR}/include/Imath '
BF_OPENEXR_INC = '${BF_OPENEXR}/include ${BF_OPENEXR}/include/OpenEXR '
BF_OPENEXR_LIB = ' Iex Half IlmImf Imath IlmThread '
BF_OPENEXR_LIBPATH = '${BF_OPENEXR}/lib'
BF_OPENEXR_LIB_STATIC = '${BF_OPENEXR}/lib/libHalf.a ${BF_OPENEXR}/lib/libIlmImf.a ${BF_OPENEXR}/lib/libIex.a ${BF_OPENEXR}/lib/libImath.a ${BF_OPENEXR}/lib/libIlmThread.a'
@ -83,11 +83,6 @@ BF_ZLIB_LIBPATH = '${BF_ZLIB}/lib'
WITH_BF_INTERNATIONAL = True
BF_GETTEXT = LIBDIR + '/gettext'
BF_GETTEXT_INC = '${BF_GETTEXT}/include'
BF_GETTEXT_LIB = 'gnu_gettext'
BF_GETTEXT_LIBPATH = '${BF_GETTEXT}/lib'
WITH_BF_GAMEENGINE = True
WITH_BF_PLAYER = True
WITH_BF_OCEANSIM = True
@ -151,24 +146,40 @@ WITH_BF_OPENMP = True
#Cycles
WITH_BF_CYCLES = True
WITH_BF_CYCLES_OSL = True
WITH_BF_STATICOSL = True
BF_OSL = '${LIBDIR}/osl'
BF_OSL_INC = '${BF_OSL}/include'
BF_OSL_LIBPATH = '${BF_OSL}/lib'
BF_OSL_LIB_STATIC = '${BF_OSL_LIBPATH}/oslcomp.lib ${BF_OSL_LIBPATH}/oslexec.lib ${BF_OSL_LIBPATH}/oslquery.lib '
BF_OSL_COMPILER = '${BF_OSL}/bin/oslc'
WITH_BF_LLVM = True
BF_LLVM = LIBDIR + '/llvm'
BF_LLVM_LIB = 'LLVMBitReader LLVMJIT LLVMipo LLVMVectorize LLVMBitWriter LLVMX86CodeGen LLVMX86Desc LLVMX86Info LLVMX86AsmPrinter ' + \
'LLVMX86Utils LLVMSelectionDAG LLVMCodeGen LLVMScalarOpts LLVMInstCombine LLVMTransformUtils LLVMipa LLVMAnalysis LLVMExecutionEngine ' + \
'LLVMTarget LLVMMC LLVMCore LLVMSupport'
BF_LLVM_LIBPATH = '${BF_LLVM}/lib'
WITH_BF_OIIO = True
BF_OIIO = '${LIBDIR}/openimageio'
BF_OIIO_INC = '${BF_OIIO}/include'
BF_OIIO_LIB = 'OpenImageIO'
BF_OIIO_LIBPATH = '${BF_OIIO}/lib'
BF_OIIO_LIBPATH = '${BF_OIIO}/lib'
BF_OIIO_LIB_STATIC = '${BF_OIIO_LIBPATH}/OpenImageIO.lib'
WITH_BF_STATICOIIO = True
WITH_BF_OCIO = True
BF_OCIO = '${LIBDIR}/opencolorio'
BF_OCIO_INC = '${BF_OCIO}/include'
BF_OCIO_LIB = 'OpenColorIO'
BF_OCIO_LIBPATH = '${BF_OCIO}/lib'
BF_OCIO_LIBPATH = '${BF_OCIO}/lib'
BF_OCIO_LIB_STATIC = '${BF_OCIO_LIBPATH}/OpenColorIO.lib'
WITH_BF_STATICOCIO = True
WITH_BF_BOOST = True
BF_BOOST = '${LIBDIR}/boost'
BF_BOOST_INC = '${BF_BOOST}/include'
BF_BOOST_LIB = 'libboost_date_time-vc90-mt-s-1_49 libboost_filesystem-vc90-mt-s-1_49 libboost_regex-vc90-mt-s-1_49 libboost_system-vc90-mt-s-1_49 libboost_thread-vc90-mt-s-1_49'
BF_BOOST_LIB_INTERNATIONAL = ' libboost_locale-vc90-mt-s-1_49'
BF_BOOST_LIBPATH = '${BF_BOOST}/lib'
#CUDA
@ -207,7 +218,7 @@ C_WARN = []
CC_WARN = []
CXX_WARN = []
LLIBS = ['ws2_32', 'vfw32', 'winmm', 'kernel32', 'user32', 'gdi32', 'comdlg32', 'advapi32', 'shfolder', 'shell32', 'ole32', 'oleaut32', 'uuid']
LLIBS = ['ws2_32', 'vfw32', 'winmm', 'kernel32', 'user32', 'gdi32', 'comdlg32', 'advapi32', 'shfolder', 'shell32', 'ole32', 'oleaut32', 'uuid', 'psapi']
PLATFORM_LINKFLAGS = ['/SUBSYSTEM:CONSOLE','/MACHINE:X64','/STACK:2097152','/OPT:NOREF','/INCREMENTAL:NO', '/NODEFAULTLIB:msvcrt.lib', '/NODEFAULTLIB:msvcmrt.lib', '/NODEFAULTLIB:msvcurt.lib', '/NODEFAULTLIB:msvcrtd.lib']

@ -166,16 +166,15 @@ def setup_staticlibs(lenv):
libincs += Split(lenv['BF_FFTW3_LIBPATH'])
if lenv['WITH_BF_STATICFFTW3']:
statlibs += Split(lenv['BF_FFTW3_LIB_STATIC'])
'''
if lenv['WITH_BF_ELTOPO']:
libincs += Split(lenv['BF_LAPACK_LIBPATH'])
if lenv['WITH_BF_STATICLAPACK']:
statlibs += Split(lenv['BF_LAPACK_LIB_STATIC'])
statlibs += Split(lenv['BF_LAPACK_LIB_STATIC'])
'''
if lenv['WITH_BF_FFMPEG'] and lenv['WITH_BF_STATICFFMPEG']:
statlibs += Split(lenv['BF_FFMPEG_LIB_STATIC'])
if lenv['WITH_BF_INTERNATIONAL']:
libincs += Split(lenv['BF_GETTEXT_LIBPATH'])
if lenv['WITH_BF_GETTEXT_STATIC']:
statlibs += Split(lenv['BF_GETTEXT_LIB_STATIC'])
if lenv['WITH_BF_FREETYPE_STATIC']:
statlibs += Split(lenv['BF_FREETYPE_LIB_STATIC'])
if lenv['WITH_BF_OPENAL']:
@ -225,6 +224,16 @@ def setup_staticlibs(lenv):
if lenv['WITH_BF_STATICBOOST']:
statlibs += Split(lenv['BF_BOOST_LIB_STATIC'])
if lenv['WITH_BF_CYCLES_OSL']:
libincs += Split(lenv['BF_OSL_LIBPATH'])
if lenv['WITH_BF_STATICOSL']:
statlibs += Split(lenv['BF_OSL_LIB_STATIC'])
if lenv['WITH_BF_LLVM']:
libincs += Split(lenv['BF_LLVM_LIBPATH'])
if lenv['WITH_BF_STATICLLVM']:
statlibs += Split(lenv['BF_LLVM_LIB_STATIC'])
# setting this last so any overriding of manually libs could be handled
if lenv['OURPLATFORM'] not in ('win32-vc', 'win32-mingw', 'win64-vc', 'linuxcross', 'win64-mingw'):
libincs.append('/usr/lib')
@ -252,8 +261,6 @@ def setup_syslibs(lenv):
syslibs.append(lenv['BF_PYTHON_LIB']+'_d')
else:
syslibs.append(lenv['BF_PYTHON_LIB'])
if lenv['WITH_BF_INTERNATIONAL'] and not lenv['WITH_BF_GETTEXT_STATIC']:
syslibs += Split(lenv['BF_GETTEXT_LIB'])
if lenv['WITH_BF_OPENAL']:
if not lenv['WITH_BF_STATICOPENAL']:
syslibs += Split(lenv['BF_OPENAL_LIB'])
@ -288,8 +295,10 @@ def setup_syslibs(lenv):
syslibs += Split(lenv['BF_SNDFILE_LIB'])
if lenv['WITH_BF_FFTW3'] and not lenv['WITH_BF_STATICFFTW3']:
syslibs += Split(lenv['BF_FFTW3_LIB'])
'''
if lenv['WITH_BF_ELTOPO']:
syslibs += Split(lenv['BF_LAPACK_LIB'])
'''
if lenv['WITH_BF_SDL']:
syslibs += Split(lenv['BF_SDL_LIB'])
if not lenv['WITH_BF_STATICOPENGL']:
@ -315,6 +324,15 @@ def setup_syslibs(lenv):
if lenv['WITH_BF_BOOST'] and not lenv['WITH_BF_STATICBOOST']:
syslibs += Split(lenv['BF_BOOST_LIB'])
if lenv['WITH_BF_INTERNATIONAL']:
syslibs += Split(lenv['BF_BOOST_LIB_INTERNATIONAL'])
if lenv['WITH_BF_CYCLES_OSL'] and not lenv['WITH_BF_STATICOSL']:
syslibs += Split(lenv['BF_OSL_LIB'])
if lenv['WITH_BF_LLVM'] and not lenv['WITH_BF_STATICLLVM']:
syslibs += Split(lenv['BF_LLVM_LIB'])
if not lenv['WITH_BF_STATICJPEG']:
syslibs += Split(lenv['BF_JPEG_LIB'])
@ -582,8 +600,8 @@ def AppIt(target=None, source=None, env=None):
bldroot = env.Dir('.').abspath
binary = env['BINARYKIND']
sourcedir = bldroot + '/source/darwin/%s.app'%binary
sourceinfo = bldroot + "/source/darwin/%s.app/Contents/Info.plist"%binary
sourcedir = bldroot + '/release/darwin/%s.app' % binary
sourceinfo = bldroot + "/release/darwin/%s.app/Contents/Info.plist"%binary
targetinfo = installdir +'/' + "%s.app/Contents/Info.plist"%binary
cmd = installdir + '/' +'%s.app'%binary
@ -633,11 +651,19 @@ def AppIt(target=None, source=None, env=None):
commands.getoutput(cmd)
cmd = 'cp -R %s/kernel/*.h %s/kernel/*.cl %s/kernel/*.cu %s/kernel/' % (croot, croot, croot, cinstalldir)
commands.getoutput(cmd)
cmd = 'cp -R %s/kernel/svm %s/util/util_color.h %s/util/util_math.h %s/util/util_transform.h %s/util/util_types.h %s/kernel/' % (croot, croot, croot, croot, croot, cinstalldir)
cmd = 'cp -R %s/kernel/svm %s/kernel/closure %s/util/util_color.h %s/util/util_math.h %s/util/util_transform.h %s/util/util_types.h %s/kernel/' % (croot, croot, croot, croot, croot, croot, cinstalldir)
commands.getoutput(cmd)
cmd = 'cp -R %s/../intern/cycles/kernel/*.cubin %s/lib/' % (builddir, cinstalldir)
commands.getoutput(cmd)
if env['WITH_BF_CYCLES_OSL']:
cmd = 'mkdir %s/shader' % (cinstalldir)
commands.getoutput(cmd)
cmd = 'cp -R %s/kernel/shaders/*.h %s/shader' % (croot, cinstalldir)
commands.getoutput(cmd)
cmd = 'cp -R %s/../intern/cycles/kernel/shaders/*.oso %s/shader' % (builddir, cinstalldir)
commands.getoutput(cmd)
if env['WITH_OSX_STATICPYTHON']:
cmd = 'mkdir %s/%s.app/Contents/MacOS/%s/python/'%(installdir,binary, VERSION)
commands.getoutput(cmd)
@ -664,7 +690,7 @@ def AppIt(target=None, source=None, env=None):
commands.getoutput(cmd)
cmd = 'rm -rf %s/set_simulation_threads.app'%(installdir) # first clear omp_num_threads applescript
commands.getoutput(cmd)
cmd = 'cp -R %s/source/darwin/set_simulation_threads.app %s/'%(bldroot, installdir) # copy the omp_num_threads applescript
cmd = 'cp -R %s/release/darwin/set_simulation_threads.app %s/'%(bldroot, installdir) # copy the omp_num_threads applescript
commands.getoutput(cmd)
# extract copy system python, be sure to update other build systems
@ -792,6 +818,20 @@ class BlenderEnvironment(SConsEnvironment):
def BlenderLib(self=None, libname=None, sources=None, includes=[], defines=[], libtype='common', priority = 100, compileflags=None, cc_compileflags=None, cxx_compileflags=None, cc_compilerchange=None, cxx_compilerchange=None):
global vcp
# sanity check
# run once in a while to check we dont have duplicates
if 0:
for name, dirs in (("source", sources), ("include", includes)):
files_clean = [os.path.normpath(f) for f in dirs]
files_clean_set = set(files_clean)
if len(files_clean) != len(files_clean_set):
for f in sorted(files_clean_set):
if f != '.' and files_clean.count(f) > 1:
raise Exception("Found duplicate %s %r" % (name, f))
del name, dirs, files_clean, files_clean_set, f
# end sanity check
if not self or not libname or not sources:
print bc.FAIL+'Cannot continue. Missing argument for BuildBlenderLib '+libname+bc.ENDC
self.Exit()
@ -871,6 +911,7 @@ class BlenderEnvironment(SConsEnvironment):
print bc.HEADER+'Configuring program '+bc.ENDC+bc.OKGREEN+progname+bc.ENDC
lenv = self.Clone()
lenv.Append(LINKFLAGS = lenv['PLATFORM_LINKFLAGS'])
lenv.Append(LINKFLAGS = lenv['BF_PROGRAM_LINKFLAGS'])
if lenv['OURPLATFORM'] in ('win32-mingw', 'win64-mingw', 'linuxcross', 'cygwin', 'linux'):
lenv.Replace(LINK = '$CXX')
if lenv['OURPLATFORM'] in ('win32-vc', 'cygwin', 'win64-vc'):

@ -116,11 +116,11 @@ def validate_arguments(args, bc):
'WITH_BF_TIFF', 'BF_TIFF', 'BF_TIFF_INC', 'BF_TIFF_LIB', 'BF_TIFF_LIBPATH', 'WITH_BF_STATICTIFF', 'BF_TIFF_LIB_STATIC',
'WITH_BF_ZLIB', 'BF_ZLIB', 'BF_ZLIB_INC', 'BF_ZLIB_LIB', 'BF_ZLIB_LIBPATH', 'WITH_BF_STATICZLIB', 'BF_ZLIB_LIB_STATIC',
'WITH_BF_INTERNATIONAL',
'BF_GETTEXT', 'BF_GETTEXT_INC', 'BF_GETTEXT_LIB', 'WITH_BF_GETTEXT_STATIC', 'BF_GETTEXT_LIB_STATIC', 'BF_GETTEXT_LIBPATH',
'WITH_BF_ICONV', 'BF_ICONV', 'BF_ICONV_INC', 'BF_ICONV_LIB', 'BF_ICONV_LIBPATH',
'WITH_BF_GAMEENGINE',
'WITH_BF_BULLET', 'BF_BULLET', 'BF_BULLET_INC', 'BF_BULLET_LIB',
'WITH_BF_ELTOPO', 'BF_LAPACK', 'BF_LAPACK_LIB', 'BF_LAPACK_LIBPATH', 'BF_LAPACK_LIB_STATIC',
# 'WITH_BF_ELTOPO', # now only available in a branch
'BF_LAPACK', 'BF_LAPACK_LIB', 'BF_LAPACK_LIBPATH', 'BF_LAPACK_LIB_STATIC',
'BF_WINTAB', 'BF_WINTAB_INC',
'BF_FREETYPE', 'BF_FREETYPE_INC', 'BF_FREETYPE_LIB', 'BF_FREETYPE_LIBPATH', 'BF_FREETYPE_LIB_STATIC', 'WITH_BF_FREETYPE_STATIC',
'WITH_BF_QUICKTIME', 'BF_QUICKTIME', 'BF_QUICKTIME_INC', 'BF_QUICKTIME_LIB', 'BF_QUICKTIME_LIBPATH',
@ -164,8 +164,10 @@ def validate_arguments(args, bc):
'WITH_BF_CYCLES', 'WITH_BF_CYCLES_CUDA_BINARIES', 'BF_CYCLES_CUDA_NVCC', 'BF_CYCLES_CUDA_NVCC', 'WITH_BF_CYCLES_CUDA_THREADED_COMPILE',
'WITH_BF_OIIO', 'WITH_BF_STATICOIIO', 'BF_OIIO', 'BF_OIIO_INC', 'BF_OIIO_LIB', 'BF_OIIO_LIB_STATIC', 'BF_OIIO_LIBPATH',
'WITH_BF_OCIO', 'WITH_BF_STATICOCIO', 'BF_OCIO', 'BF_OCIO_INC', 'BF_OCIO_LIB', 'BF_OCIO_LIB_STATIC', 'BF_OCIO_LIBPATH',
'WITH_BF_BOOST', 'WITH_BF_STATICBOOST', 'BF_BOOST', 'BF_BOOST_INC', 'BF_BOOST_LIB', 'BF_BOOST_LIB_STATIC', 'BF_BOOST_LIBPATH',
'WITH_BF_LIBMV'
'WITH_BF_BOOST', 'WITH_BF_STATICBOOST', 'BF_BOOST', 'BF_BOOST_INC', 'BF_BOOST_LIB', 'BF_BOOST_LIB_INTERNATIONAL', 'BF_BOOST_LIB_STATIC', 'BF_BOOST_LIBPATH',
'WITH_BF_LIBMV',
'WITH_BF_CYCLES_OSL', 'WITH_BF_STATICOSL', 'BF_OSL', 'BF_OSL_INC', 'BF_OSL_LIB', 'BF_OSL_LIBPATH', 'BF_OSL_LIB_STATIC', 'BF_OSL_COMPILER',
'WITH_BF_LLVM', 'WITH_BF_STATICLLVM', 'BF_LLVM', 'BF_LLVM_LIB', 'BF_LLVM_LIBPATH', 'BF_LLVM_LIB_STATIC', 'BF_PROGRAM_LINKFLAGS'
]
# Have options here that scons expects to be lists
@ -179,7 +181,7 @@ def validate_arguments(args, bc):
'BF_DEBUG_CFLAGS', 'BF_DEBUG_CCFLAGS', 'BF_DEBUG_CXXFLAGS',
'C_WARN', 'CC_WARN', 'CXX_WARN',
'LLIBS', 'PLATFORM_LINKFLAGS','MACOSX_ARCHITECTURE', 'MACOSX_SDK_CHECK', 'XCODE_CUR_VER',
'BF_CYCLES_CUDA_BINARIES_ARCH',
'BF_CYCLES_CUDA_BINARIES_ARCH', 'BF_PROGRAM_LINKFLAGS', 'MACOSX_DEPLOYMENT_TARGET'
]
@ -381,15 +383,8 @@ def read_opts(env, cfg, args):
('BF_ZLIB_LIBPATH', 'ZLib library path', ''),
('BF_ZLIB_LIB_STATIC', 'ZLib static library', ''),
(BoolVariable('WITH_BF_INTERNATIONAL', 'Use Gettext if true', True)),
(BoolVariable('WITH_BF_INTERNATIONAL', 'Use Boost::locale if true', True)),
('BF_GETTEXT', 'gettext base path', ''),
('BF_GETTEXT_INC', 'gettext include path', ''),
('BF_GETTEXT_LIB', 'gettext library', ''),
(BoolVariable('WITH_BF_GETTEXT_STATIC', 'Use static gettext library if true', False)),
('BF_GETTEXT_LIB_STATIC', 'static gettext library', ''),
('BF_GETTEXT_LIBPATH', 'gettext library path', ''),
(BoolVariable('WITH_BF_ICONV', 'Use iconv if true', True)),
('BF_ICONV', 'iconv base path', ''),
('BF_ICONV_INC', 'iconv include path', ''),
@ -399,8 +394,7 @@ def read_opts(env, cfg, args):
(BoolVariable('WITH_BF_GAMEENGINE', 'Build with gameengine' , False)),
(BoolVariable('WITH_BF_BULLET', 'Use Bullet if true', True)),
(BoolVariable('WITH_BF_ELTOPO', 'Use Eltopo collision library if true', False)),
# (BoolVariable('WITH_BF_ELTOPO', 'Use Eltopo collision library if true', False)), # this is now only available in a branch
('BF_LAPACK', 'LAPACK base path', ''),
('BF_LAPACK_LIB', 'LAPACK library', ''),
('BF_LAPACK_LIB_STATIC', 'LAPACK library', ''),
@ -508,8 +502,9 @@ def read_opts(env, cfg, args):
('LLIBS', 'Platform libs', []),
('PLATFORM_LINKFLAGS', 'Platform linkflags', []),
('MACOSX_ARCHITECTURE', 'python_arch.zip select', ''),
('MACOSX_SDK_CHECK', 'detect available OSX sdk`s', ''),
('XCODE_CUR_VER', 'detect XCode version', ''),
('MACOSX_SDK_CHECK', 'Detect available OS X SDK`s', ''),
('XCODE_CUR_VER', 'Detect XCode version', ''),
('MACOSX_DEPLOYMENT_TARGET', 'Detect OS X target version', ''),
(BoolVariable('BF_PROFILE', 'Add profiling information if true', False)),
('BF_PROFILE_CFLAGS', 'C only profiling flags', []),
@ -598,11 +593,30 @@ def read_opts(env, cfg, args):
('BF_BOOST', 'Boost root path', ''),
('BF_BOOST_INC', 'Boost include path', ''),
('BF_BOOST_LIB', 'Boost library', ''),
('BF_BOOST_LIB_INTERNATIONAL', 'Boost library', ''),
('BF_BOOST_LIBPATH', 'Boost library path', ''),
('BF_BOOST_LIB_STATIC', 'Boost static library', ''),
(BoolVariable('WITH_GHOST_XDND', 'Build with drag-n-drop support on Linux platforms using XDND protocol', True)),
(BoolVariable('WITH_BF_COMPOSITOR_LEGACY', 'Enable the legacy compositor', False))
(BoolVariable('WITH_BF_COMPOSITOR_LEGACY', 'Enable the legacy compositor', False)),
(BoolVariable('WITH_BF_CYCLES_OSL', 'Build with OSL sypport in Cycles', False)),
(BoolVariable('WITH_BF_STATICOSL', 'Staticly link to OSL', False)),
('BF_OSL', 'OSL root path', ''),
('BF_OSL_INC', 'OSL include path', ''),
('BF_OSL_LIB', 'OSL library', ''),
('BF_OSL_LIBPATH', 'OSL library path', ''),
('BF_OSL_LIB_STATIC', 'OSL static library', ''),
('BF_OSL_COMPILER', 'OSL compiler', ''),
(BoolVariable('WITH_BF_LLVM', 'Build with LLVM sypport (required for OSL)', False)),
(BoolVariable('WITH_BF_STATICLLVM', 'Staticly link to LLVM', False)),
('BF_LLVM', 'LLVM root path', ''),
('BF_LLVM_LIB', 'LLVM library', ''),
('BF_LLVM_LIBPATH', 'LLVM library path', ''),
('BF_LLVM_LIB_STATIC', 'LLVM static library', ''),
('BF_PROGRAM_LINKFLAGS', 'Link flags applied only to final binaries (blender and blenderplayer, not makesrna/makesdna)', '')
) # end of opts.AddOptions()
return localopts
@ -673,7 +687,7 @@ def buildslave(target=None, source=None, env=None):
elif bitness == '32bit':
platform = 'linux-' + glibc + '-i686'
if platform == 'darwin':
platform = 'OSX-' + env['MACOSX_ARCHITECTURE']
platform = 'OSX-' + env['MACOSX_DEPLOYMENT_TARGET'] + '-' + env['MACOSX_ARCHITECTURE']
branch = env['BUILDBOT_BRANCH']

@ -1,4 +1,4 @@
#!/usr/bin/env python3.2
#!/usr/bin/env python3
# ***** BEGIN GPL LICENSE BLOCK *****
#

@ -1,4 +1,4 @@
#!/usr/bin/env python3.2
#!/usr/bin/env python3
# ***** BEGIN GPL LICENSE BLOCK *****
#

@ -1,4 +1,4 @@
.TH "BLENDER" "1" "October 04, 2012" "Blender Blender 2\&.64 (sub 0)"
.TH "BLENDER" "1" "December 04, 2012" "Blender Blender 2\&.65"
.SH NAME
blender \- a 3D modelling and rendering package
@ -15,7 +15,7 @@ Use Blender to create TV commercials, to make technical visualizations, business
http://www.blender.org
.SH OPTIONS
Blender 2.64 (sub 0)
Blender 2.65
Usage: blender [args ...] [file] [args ...]
.br
.SS "Render Options:"
@ -145,6 +145,10 @@ Playback <file(s)>, only operates this way when not running in background.
.br
\-j <frame> Set frame step to <frame>
.br
\-s <frame> Play from <frame>
.br
\-e <frame> Play until <frame>
.br
.IP
@ -344,6 +348,12 @@ Enable debug messages for python
Enable debug messages for the event system
.br
.TP
.B \-\-debug\-handlers
.br
Enable debug messages for event handling
.br
.TP
.B \-\-debug\-wm
.br

@ -0,0 +1,108 @@
# This script uses bmesh operators to make 2 links of a chain.
import bpy
import bmesh
import math
import mathutils
# Make a new BMesh
bm = bmesh.new()
# Add a circle XXX, should return all geometry created, not just verts.
bmesh.ops.create_circle(
bm,
cap_ends=False,
diameter=0.2,
segments=8)
# Spin and deal with geometry on side 'a'
edges_start_a = bm.edges[:]
geom_start_a = bm.verts[:] + edges_start_a
ret = bmesh.ops.spin(
bm,
geom=geom_start_a,
angle=math.radians(180.0),
steps=8,
axis=(1.0, 0.0, 0.0),
cent=(0.0, 1.0, 0.0))
edges_end_a = [ele for ele in ret["geom_last"]
if isinstance(ele, bmesh.types.BMEdge)]
del ret
# Extrude and create geometry on side 'b'
ret = bmesh.ops.extrude_edge_only(
bm,
edges=edges_start_a)
geom_extrude_mid = ret["geom"]
del ret
# Collect the edges to spin XXX, 'extrude_edge_only' could return this.
verts_extrude_b = [ele for ele in geom_extrude_mid
if isinstance(ele, bmesh.types.BMVert)]
edges_extrude_b = [ele for ele in geom_extrude_mid
if isinstance(ele, bmesh.types.BMEdge) and ele.is_boundary]
bmesh.ops.translate(
bm,
verts=verts_extrude_b,
vec=(0.0, 0.0, 1.0))
# Create the circle on side 'b'
ret = bmesh.ops.spin(
bm,
geom=verts_extrude_b + edges_extrude_b,
angle=-math.radians(180.0),
steps=8,
axis=(1.0, 0.0, 0.0),
cent=(0.0, 1.0, 1.0))
edges_end_b = [ele for ele in ret["geom_last"]
if isinstance(ele, bmesh.types.BMEdge)]
del ret
# Bridge the resulting edge loops of both spins 'a & b'
bmesh.ops.bridge_loops(
bm,
edges=edges_end_a + edges_end_b)
# Now we have made a links of the chain, make a copy and rotate it
# (so this looks something like a chain)
ret = bmesh.ops.duplicate(
bm,
geom=bm.verts[:] + bm.edges[:] + bm.faces[:])
geom_dupe = ret["geom"]
verts_dupe = [ele for ele in geom_dupe if isinstance(ele, bmesh.types.BMVert)]
del ret
# position the new link
bmesh.ops.translate(
bm,
verts=verts_dupe,
vec=(0.0, 0.0, 2.0))
bmesh.ops.rotate(
bm,
verts=verts_dupe,
cent=(0.0, 1.0, 0.0),
matrix=mathutils.Matrix.Rotation(math.radians(90.0), 3, 'Z'))
# Done with creating the mesh, simply link it into the scene so we can see it
# Finish up, write the bmesh into a new mesh
me = bpy.data.meshes.new("Mesh")
bm.to_mesh(me)
bm.free()
# Add the mesh to the scene
scene = bpy.context.scene
obj = bpy.data.objects.new("Object", me)
scene.objects.link(obj)
# Select and make active
scene.objects.active = obj
obj.select = True

@ -254,13 +254,6 @@ General functions
:rtype: list [float], len(getSpectrum()) == 512
.. function:: stopDSP()
Stops the sound driver using DSP effects.
Only the fmod sound driver supports this.
DSP can be computationally expensive.
.. function:: getMaxLogicFrame()
Gets the maximum number of logic frames per render frame.
@ -331,6 +324,24 @@ General functions
.. warning: Not implimented yet
.. function:: getExitKey()
Gets the key used to exit the game engine
:return: The key (defaults to :mod:`bge.events.ESCKEY`)
:rtype: int
.. function:: setExitKey(key)
Sets the key used to exit the game engine
:arg key: A key constant from :mod:`bge.events`
:type key: int
.. function:: NextFrame()
Render next frame (if Python has control)
*****************
Utility functions
*****************
@ -373,6 +384,10 @@ Utility functions
.. function:: PrintGLInfo()
Prints GL Extension Info into the console
.. function:: PrintMemInfo()
Prints engine statistics into the console
*********
Constants
@ -401,6 +416,45 @@ Sensor Status
.. data:: KX_SENSOR_ACTIVE
.. data:: KX_SENSOR_JUST_DEACTIVATED
---------------
Armature Sensor
---------------
.. _armaturesensor-type:
See :class:`bge.types.KX_ArmatureSensor.type`
.. data:: KX_ARMSENSOR_STATE_CHANGED
Detect that the constraint is changing state (active/inactive)
:value: 0
.. data:: KX_ARMSENSOR_LIN_ERROR_BELOW
Detect that the constraint linear error is above a threshold
:value: 1
.. data:: KX_ARMSENSOR_LIN_ERROR_ABOVE
Detect that the constraint linear error is below a threshold
:value: 2
.. data:: KX_ARMSENSOR_ROT_ERROR_BELOW
Detect that the constraint rotation error is above a threshold
:value: 3
.. data:: KX_ARMSENSOR_ROT_ERROR_ABOVE
Detect that the constraint rotation error is below a threshold
:value: 4
.. _logic-property-sensor:
---------------
@ -483,6 +537,52 @@ See :class:`bge.types.BL_ActionActuator`
.. data:: KX_ACTIONACT_LOOPEND
.. data:: KX_ACTIONACT_PROPERTY
-----------------
Armature Actuator
-----------------
.. _armatureactuator-constants-type:
See :class:`bge.types.BL_ArmatureActuator.type`
.. data:: KX_ACT_ARMATURE_RUN
Just make sure the armature will be updated on the next graphic frame.
This is the only persistent mode of the actuator:
it executes automatically once per frame until stopped by a controller
:value: 0
.. data:: KX_ACT_ARMATURE_ENABLE
Enable the constraint.
:value: 1
.. data:: KX_ACT_ARMATURE_DISABLE
Disable the constraint (runtime constraint values are not updated).
:value: 2
.. data:: KX_ACT_ARMATURE_SETTARGET
Change target and subtarget of constraint.
:value: 3
.. data:: KX_ACT_ARMATURE_SETWEIGHT
Change weight of constraint (IK only).
:value: 4
.. data:: KX_ACT_ARMATURE_SETINFLUENCE
Change influence of constraint.
:value: 5
-------------------
Constraint Actuator
-------------------
@ -493,31 +593,31 @@ See :class:`bge.types.KX_ConstraintActuator.option`
* Applicable to Distance constraint:
.. data:: KX_ACT_CONSTRAINT_NORMAL
.. data:: KX_CONSTRAINTACT_NORMAL
Activate alignment to surface
.. data:: KX_ACT_CONSTRAINT_DISTANCE
.. data:: KX_CONSTRAINTACT_DISTANCE
Activate distance control
.. data:: KX_ACT_CONSTRAINT_LOCAL
.. data:: KX_CONSTRAINTACT_LOCAL
Direction of the ray is along the local axis
* Applicable to Force field constraint:
.. data:: KX_ACT_CONSTRAINT_DOROTFH
.. data:: KX_CONSTRAINTACT_DOROTFH
Force field act on rotation as well
* Applicable to both:
.. data:: KX_ACT_CONSTRAINT_MATERIAL
.. data:: KX_CONSTRAINTACT_MATERIAL
Detect material rather than property
.. data:: KX_ACT_CONSTRAINT_PERMANENT
.. data:: KX_CONSTRAINTACT_PERMANENT
No deactivation if ray does not hit target
@ -585,27 +685,27 @@ See :class:`bge.types.KX_ConstraintActuator.limit`
Set orientation of Z axis
.. data:: KX_ACT_CONSTRAINT_FHNX
.. data:: KX_CONSTRAINTACT_FHNX
Set force field along negative X axis
.. data:: KX_ACT_CONSTRAINT_FHNY
.. data:: KX_CONSTRAINTACT_FHNY
Set force field along negative Y axis
.. data:: KX_ACT_CONSTRAINT_FHNZ
.. data:: KX_CONSTRAINTACT_FHNZ
Set force field along negative Z axis
.. data:: KX_ACT_CONSTRAINT_FHPX
.. data:: KX_CONSTRAINTACT_FHPX
Set force field along positive X axis
.. data:: KX_ACT_CONSTRAINT_FHPY
.. data:: KX_CONSTRAINTACT_FHPY
Set force field along positive Y axis
.. data:: KX_ACT_CONSTRAINT_FHPZ
.. data:: KX_CONSTRAINTACT_FHPZ
Set force field along positive Z axis
@ -708,102 +808,32 @@ See :class:`bge.types.KX_SoundActuator`
.. data:: KX_SOUNDACT_LOOPBIDIRECTIONAL_STOP
:value: 6
-----------------
Steering Actuator
-----------------
.. _logic-steering-actuator:
See :class:`bge.types.KX_SteeringActuator.behavior`
.. data:: KX_STEERING_SEEK
:value: 1
.. data:: KX_STEERING_FLEE
:value: 2
.. data:: KX_STEERING_PATHFOLLOWING
:value: 3
=======
Various
=======
.. _input-status:
------------
Input Status
------------
See :class:`bge.types.SCA_PythonKeyboard`, :class:`bge.types.SCA_PythonMouse`, :class:`bge.types.SCA_MouseSensor`, :class:`bge.types.SCA_KeyboardSensor`
.. data:: KX_INPUT_NONE
.. data:: KX_INPUT_JUST_ACTIVATED
.. data:: KX_INPUT_ACTIVE
.. data:: KX_INPUT_JUST_RELEASED
-------------
Mouse Buttons
-------------
See :class:`bge.types.SCA_MouseSensor`
.. data:: KX_MOUSE_BUT_LEFT
.. data:: KX_MOUSE_BUT_MIDDLE
.. data:: KX_MOUSE_BUT_RIGHT
------
States
------
See :class:`bge.types.KX_StateActuator`
.. data:: KX_STATE1
.. data:: KX_STATE2
.. data:: KX_STATE3
.. data:: KX_STATE4
.. data:: KX_STATE5
.. data:: KX_STATE6
.. data:: KX_STATE7
.. data:: KX_STATE8
.. data:: KX_STATE9
.. data:: KX_STATE10
.. data:: KX_STATE11
.. data:: KX_STATE12
.. data:: KX_STATE13
.. data:: KX_STATE14
.. data:: KX_STATE15
.. data:: KX_STATE16
.. data:: KX_STATE17
.. data:: KX_STATE18
.. data:: KX_STATE19
.. data:: KX_STATE20
.. data:: KX_STATE21
.. data:: KX_STATE22
.. data:: KX_STATE23
.. data:: KX_STATE24
.. data:: KX_STATE25
.. data:: KX_STATE26
.. data:: KX_STATE27
.. data:: KX_STATE28
.. data:: KX_STATE29
.. data:: KX_STATE30
.. _state-actuator-operation:
See :class:`bge.types.KX_StateActuator.operation`
.. data:: KX_STATE_OP_CLR
Substract bits to state mask
:value: 0
.. data:: KX_STATE_OP_CPY
Copy state mask
:value: 1
.. data:: KX_STATE_OP_NEG
Invert bits to state mask
:value: 2
.. data:: KX_STATE_OP_SET
Add bits to state mask
:value: 3
.. _Two-D-FilterActuator-mode:
---------
2D Filter
---------
@ -877,6 +907,227 @@ See :class:`bge.types.KX_StateActuator.operation`
.. data:: RAS_2DFILTER_SOBEL
:value: 7
----------------
Armature Channel
----------------
.. _armaturechannel-constants-rotation-mode:
See :class:`bge.types.BL_ArmatureChannel.rotation_mode`
.. note:
euler mode are named as in Blender UI but the actual axis order is reversed
.. data:: ROT_MODE_QUAT
Use quaternion in rotation attribute to update bone rotation.
:value: 0
.. data:: ROT_MODE_XYZ
Use euler_rotation and apply angles on bone's Z, Y, X axis successively.
:value: 1
.. data:: ROT_MODE_XZY
Use euler_rotation and apply angles on bone's Y, Z, X axis successively.
:value: 2
.. data:: ROT_MODE_YXZ
Use euler_rotation and apply angles on bone's Z, X, Y axis successively.
:value: 3
.. data:: ROT_MODE_YZX
Use euler_rotation and apply angles on bone's X, Z, Y axis successively.
:value: 4
.. data:: ROT_MODE_ZXY
Use euler_rotation and apply angles on bone's Y, X, Z axis successively.
:value: 5
.. data:: ROT_MODE_ZYX
Use euler_rotation and apply angles on bone's X, Y, Z axis successively.
:value: 6
-------------------
Armature Constraint
-------------------
.. _armatureconstraint-constants-type:
See :class:`bge.types.BL_ArmatureConstraint.type`
.. data:: CONSTRAINT_TYPE_TRACKTO
.. data:: CONSTRAINT_TYPE_KINEMATIC
.. data:: CONSTRAINT_TYPE_ROTLIKE
.. data:: CONSTRAINT_TYPE_LOCLIKE
.. data:: CONSTRAINT_TYPE_MINMAX
.. data:: CONSTRAINT_TYPE_SIZELIKE
.. data:: CONSTRAINT_TYPE_LOCKTRACK
.. data:: CONSTRAINT_TYPE_STRETCHTO
.. data:: CONSTRAINT_TYPE_CLAMPTO
.. data:: CONSTRAINT_TYPE_TRANSFORM
.. data:: CONSTRAINT_TYPE_DISTLIMIT
.. _armatureconstraint-constants-ik-type:
See :class:`bge.types.BL_ArmatureConstraint.ik_type`
.. data:: CONSTRAINT_IK_COPYPOSE
constraint is trying to match the position and eventually the rotation of the target.
:value: 0
.. data:: CONSTRAINT_IK_DISTANCE
Constraint is maintaining a certain distance to target subject to ik_mode
:value: 1
.. _armatureconstraint-constants-ik-flag:
See :class:`bge.types.BL_ArmatureConstraint.ik_flag`
.. data:: CONSTRAINT_IK_FLAG_TIP
Set when the constraint operates on the head of the bone and not the tail
:value: 1
.. data:: CONSTRAINT_IK_FLAG_ROT
Set when the constraint tries to match the orientation of the target
:value: 2
.. data:: CONSTRAINT_IK_FLAG_STRETCH
Set when the armature is allowed to stretch (only the bones with stretch factor > 0.0)
:value: 16
.. data:: CONSTRAINT_IK_FLAG_POS
Set when the constraint tries to match the position of the target.
:value: 32
.. _armatureconstraint-constants-ik-mode:
See :class:`bge.types.BL_ArmatureConstraint.ik_mode`
.. data:: CONSTRAINT_IK_MODE_INSIDE
The constraint tries to keep the bone within ik_dist of target
:value: 0
.. data:: CONSTRAINT_IK_MODE_OUTSIDE
The constraint tries to keep the bone outside ik_dist of the target
:value: 1
.. data:: CONSTRAINT_IK_MODE_ONSURFACE
The constraint tries to keep the bone exactly at ik_dist of the target.
:value: 2
.. _input-status:
----------------
Blender Material
----------------
.. data:: BL_DST_ALPHA
.. data:: BL_DST_COLOR
.. data:: BL_ONE
.. data:: BL_ONE_MINUS_DST_ALPHA
.. data:: BL_ONE_MINUS_DST_COLOR
.. data:: BL_ONE_MINUS_SRC_ALPHA
.. data:: BL_ONE_MINUS_SRC_COLOR
.. data:: BL_SRC_ALPHA
.. data:: BL_SRC_ALPHA_SATURATE
.. data:: BL_SRC_COLOR
.. data:: BL_ZERO
------------
Input Status
------------
See :class:`bge.types.SCA_PythonKeyboard`, :class:`bge.types.SCA_PythonMouse`, :class:`bge.types.SCA_MouseSensor`, :class:`bge.types.SCA_KeyboardSensor`
.. data:: KX_INPUT_NONE
.. data:: KX_INPUT_JUST_ACTIVATED
.. data:: KX_INPUT_ACTIVE
.. data:: KX_INPUT_JUST_RELEASED
-------------
KX_GameObject
-------------
.. _gameobject-playaction-mode:
See :class:`bge.types.KX_GameObject.playAction`
.. data:: KX_ACTION_MODE_PLAY
Play the action once.
:value: 0
.. data:: KX_ACTION_MODE_LOOP
Loop the action (repeat it).
:value: 1
.. data:: KX_ACTION_MODE_PING_PONG
Play the action one direct then back the other way when it has completed.
:value: 2
-------------
Mouse Buttons
-------------
See :class:`bge.types.SCA_MouseSensor`
.. data:: KX_MOUSE_BUT_LEFT
.. data:: KX_MOUSE_BUT_MIDDLE
.. data:: KX_MOUSE_BUT_RIGHT
--------------------------
Navigation Mesh Draw Modes
--------------------------
.. _navmesh-draw-mode:
.. data:: RM_WALLS
Draw only the walls.
.. data:: RM_POLYS
Draw only polygons.
.. data:: RM_TRIS
Draw triangle mesh.
------
Shader
@ -904,18 +1155,69 @@ Shader
.. data:: SHD_TANGENT
----------------
Blender Material
----------------
------
States
------
.. data:: BL_DST_ALPHA
.. data:: BL_DST_COLOR
.. data:: BL_ONE
.. data:: BL_ONE_MINUS_DST_ALPHA
.. data:: BL_ONE_MINUS_DST_COLOR
.. data:: BL_ONE_MINUS_SRC_ALPHA
.. data:: BL_ONE_MINUS_SRC_COLOR
.. data:: BL_SRC_ALPHA
.. data:: BL_SRC_ALPHA_SATURATE
.. data:: BL_SRC_COLOR
.. data:: BL_ZERO
See :class:`bge.types.KX_StateActuator`
.. data:: KX_STATE1
.. data:: KX_STATE2
.. data:: KX_STATE3
.. data:: KX_STATE4
.. data:: KX_STATE5
.. data:: KX_STATE6
.. data:: KX_STATE7
.. data:: KX_STATE8
.. data:: KX_STATE9
.. data:: KX_STATE10
.. data:: KX_STATE11
.. data:: KX_STATE12
.. data:: KX_STATE13
.. data:: KX_STATE14
.. data:: KX_STATE15
.. data:: KX_STATE16
.. data:: KX_STATE17
.. data:: KX_STATE18
.. data:: KX_STATE19
.. data:: KX_STATE20
.. data:: KX_STATE21
.. data:: KX_STATE22
.. data:: KX_STATE23
.. data:: KX_STATE24
.. data:: KX_STATE25
.. data:: KX_STATE26
.. data:: KX_STATE27
.. data:: KX_STATE28
.. data:: KX_STATE29
.. data:: KX_STATE30
.. _state-actuator-operation:
See :class:`bge.types.KX_StateActuator.operation`
.. data:: KX_STATE_OP_CLR
Substract bits to state mask
:value: 0
.. data:: KX_STATE_OP_CPY
Copy state mask
:value: 1
.. data:: KX_STATE_OP_NEG
Invert bits to state mask
:value: 2
.. data:: KX_STATE_OP_SET
Add bits to state mask
:value: 3
.. _Two-D-FilterActuator-mode:

@ -205,6 +205,18 @@ Types
:type: boolean
.. attribute:: pos_ticks
The number of ticks since the last positive pulse (read-only).
:type: int
.. attribute:: neg_ticks
The number of ticks since the last negative pulse (read-only).
:type: int
.. attribute:: status
The status of the sensor (read-only): can be one of :ref:`these constants<sensor-status>`.
@ -621,6 +633,71 @@ Types
:type: string
.. 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
.. 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.
@ -682,10 +759,32 @@ Types
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.
.. class:: KX_BlenderMaterial(PyObjectPlus)
KX_BlenderMaterial
.. attribute:: shader
The materials 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.
@ -743,7 +842,13 @@ Types
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.
@ -762,12 +867,6 @@ Types
:type: float
.. attribute:: useXY
axis this actuator is tracking, True=X, False=Y.
:type: boolean
.. attribute:: object
the object this actuator tracks.
@ -988,14 +1087,14 @@ Types
The object's parent object. (read-only).
:type: :class:`KX_GameObject` or None
.. attribute:: group_children
.. attribute:: groupMembers
Returns the list of group members if the object is a group object, otherwise None is returned.
:type: :class:`CListValue` of :class:`KX_GameObject` or None
.. attribute:: group_parent
.. attribute:: groupObject
Returns the group object that the object belongs to or None if the object is not part of a group.
@ -1100,30 +1199,30 @@ Types
The object's world space transform matrix. 4x4 Matrix.
:type: :class:`mathutils.Matrix`
.. attribute:: localLinearVelocity
The object's local linear velocity. [x, y, z]
:type: :class:`mathutils.Vector`
The object's local linear velocity. [x, y, z]
:type: :class:`mathutils.Vector`
.. attribute:: worldLinearVelocity
The object's world linear velocity. [x, y, z]
:type: :class:`mathutils.Vector`
:type: :class:`mathutils.Vector`
.. attribute:: localAngularVelocity
The object's local angular velocity. [x, y, z]
:type: :class:`mathutils.Vector`
:type: :class:`mathutils.Vector`
.. attribute:: worldAngularVelocity
The object's world angular velocity. [x, y, z]
:type: :class:`mathutils.Vector`
:type: :class:`mathutils.Vector`
.. attribute:: timeOffset
@ -1211,6 +1310,13 @@ Types
:type: :class:`CListValue` of :class:`KX_GameObject`'s
.. attribute:: life
The number of seconds until the object ends, assumes 50fps.
(when added with an add object actuator), (read-only).
:type: float
.. method:: endObject()
Delete this object, can be used in place of the EndObject Actuator.
@ -1653,7 +1759,7 @@ Types
:arg blendin: the amount of blending between this animation and the previous one on this layer
:type blendin: float
:arg play_mode: the play mode
:type play_mode: KX_ACTION_MODE_PLAY, KX_ACTION_MODE_LOOP, or KX_ACTION_MODE_PING_PONG
:type play_mode: one of :ref:`these constants <gameobject-playaction-mode>`
:arg layer_weight: how much of the previous layer to use for blending (0 = add)
:type layer_weight: float
:arg ipo_flags: flags for the old IPO behaviors (force, etc)
@ -1810,10 +1916,6 @@ Types
:type: list [r, g, b]
.. attribute:: colour
Synonym for color.
.. attribute:: lin_attenuation
The linear component of this light's attenuation. (SPOT and NORMAL lights only).
@ -1898,11 +2000,6 @@ Types
:type: integer
.. method:: getNumMaterials()
:return: number of materials associated with this object
:rtype: integer
.. method:: getMaterialName(matid)
Gets the name of the specified material.
@ -1943,11 +2040,6 @@ Types
:return: a vertex object.
:rtype: :class:`KX_VertexProxy`
.. method:: getNumPolygons()
:return: The number of polygon in the mesh.
:rtype: integer
.. method:: getPolygon(index)
Gets the specified polygon from the mesh.
@ -1957,6 +2049,28 @@ Types
:return: a polygon object.
:rtype: :class:`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
.. class:: SCA_MouseSensor(SCA_ISensor)
Mouse Sensor logic brick.
@ -2156,6 +2270,52 @@ Types
:type: list of strings
.. class:: KX_FontObject(KX_GameObject)
TODO.
.. 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
.. class:: KX_ObjectActuator(SCA_IActuator)
The object actuator ("Motion Actuator") applies force, torque, displacement, angular displacement,
@ -2309,49 +2469,6 @@ Types
:type: boolean
.. class:: KX_PhysicsObjectWrapper(PyObjectPlus)
KX_PhysicsObjectWrapper
.. method:: setActive(active)
Set the object to be active.
:arg active: set to True to be active
:type active: boolean
.. method:: setAngularVelocity(x, y, z, local)
Set the angular velocity of the object.
:arg x: angular velocity for the x-axis
:type x: float
:arg y: angular velocity for the y-axis
:type y: float
:arg z: angular velocity for the z-axis
:type z: float
:arg local: set to True for local axis
:type local: boolean
.. method:: setLinearVelocity(x, y, z, local)
Set the linear velocity of the object.
:arg x: linear velocity for the x-axis
:type x: float
:arg y: linear velocity for the y-axis
:type y: float
:arg z: linear velocity for the z-axis
:type z: float
:arg local: set to True for local axis
:type local: boolean
.. class:: KX_PolyProxy(SCA_IObject)
A polygon holds the index of the vertex forming the poylgon.
@ -2360,7 +2477,7 @@ Types
The polygon attributes are read-only, you need to retrieve the vertex proxy if you want
to change the vertex settings.
.. attribute:: matname
.. attribute:: material_name
The name of polygon material, empty if no material.
@ -2372,13 +2489,13 @@ Types
:type: :class:`KX_PolygonMaterial` or :class:`KX_BlenderMaterial`
.. attribute:: texture
.. attribute:: texture_name
The texture name of the polygon.
:type: string
.. attribute:: matid
.. attribute:: material_id
The material index of the polygon, use this to retrieve vertex proxy from mesh proxy.
@ -2609,18 +2726,6 @@ Types
:type: boolean
.. attribute:: lightlayer
Light layers this material affects.
:type: bitfield.
.. attribute:: triangle
Mesh data with this material is triangles. It's probably not safe to change this.
:type: boolean
.. attribute:: diffuse
The diffuse color of the material. black = [0.0, 0.0, 0.0] white = [1.0, 1.0, 1.0].
@ -2886,8 +2991,8 @@ Types
.. method:: instantAddObject()
adds the object without needing to calling SCA_PythonController.activate()
.. note:: Use objectLastCreated to get the newly created object.
.. note:: Use objectLastCreated to get the newly created object.
.. class:: KX_SCA_DynamicActuator(SCA_IActuator)
@ -3113,6 +3218,12 @@ Types
:type: list
.. attribute:: gravity
The scene gravity using the world x, y and z axis.
:type: list [fx, fy, fz]
.. method:: addObject(object, other, time=0)
Adds an object to the scene like the Add Object Actuator would.
@ -3154,6 +3265,10 @@ Types
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.
.. class:: KX_SceneActuator(SCA_IActuator)
Scene Actuator logic brick.
@ -3200,13 +3315,7 @@ Types
Sound Actuator.
The :data:`startSound`, :data:`pauseSound` and :data:`stopSound` do not requirethe actuator to be activated - they act instantly provided that the actuator has been activated once at least.
.. attribute:: fileName
The filename of the sound this actuator plays.
:type: string
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
@ -3214,48 +3323,102 @@ Types
: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:: rollOffFactor
The roll off factor. Rolloff defines the rate of attenuation as the sound gets further away.
:type: float
.. attribute:: looping
The loop mode of the actuator.
:type: integer
.. attribute:: position
The position of the sound as a list: [x, y, z].
:type: float array
.. attribute:: velocity
The velocity of the emitter as a list: [x, y, z]. The relative velocity to the observer determines the pitch. List of 3 floats: [x, y, z].
:type: float array
.. attribute:: orientation
The orientation of the sound. When setting the orientation you can also use quaternion [float, float, float, float] or euler angles [float, float, float].
:type: 3x3 matrix [[float]]
.. attribute:: mode
The operation mode of the actuator. 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
.. class:: KX_StateActuator(SCA_IActuator)
State actuator changes the state mask of parent object.
@ -3472,7 +3635,7 @@ Types
Whether or not the character is on the ground. (read-only)
:type: boolean
:type: boolean
.. attribute:: gravity
@ -3518,10 +3681,6 @@ Types
Black = [0.0, 0.0, 0.0, 1.0], White = [1.0, 1.0, 1.0, 1.0]
.. attribute:: colour
Synonym for color.
.. attribute:: x
The x coordinate of the vertex.
@ -4242,24 +4401,6 @@ Types
:type: integer
.. method:: setSeed(seed)
Sets the seed of the random number generator.
If the seed is 0, the generator will produce the same value on every call.
:type seed: integer
.. method:: getSeed()
:return: The initial seed of the generator. Equal seeds produce equal random series.
:rtype: integer
.. method:: getLastDraw()
:return: The last random number generated.
:rtype: integer
.. class:: SCA_XNORController(SCA_IController)
An XNOR controller activates when all linked sensors are the same (activated or inative).
@ -4327,7 +4468,7 @@ Types
.. 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).
@ -4580,48 +4721,6 @@ Types
Armature Actuators change constraint condition on armatures.
.. _armatureactuator-constants-type:
Constants related to :data:`~bge.types.BL_ArmatureActuator.type`
.. data:: KX_ACT_ARMATURE_RUN
Just make sure the armature will be updated on the next graphic frame.
This is the only persistent mode of the actuator:
it executes automatically once per frame until stopped by a controller
:value: 0
.. data:: KX_ACT_ARMATURE_ENABLE
Enable the constraint.
:value: 1
.. data:: KX_ACT_ARMATURE_DISABLE
Disable the constraint (runtime constraint values are not updated).
:value: 2
.. data:: KX_ACT_ARMATURE_SETTARGET
Change target and subtarget of constraint.
:value: 3
.. data:: KX_ACT_ARMATURE_SETWEIGHT
Change weight of constraint (IK only).
:value: 4
.. data:: KX_ACT_ARMATURE_SETINFLUENCE
Change influence of constraint.
:value: 5
.. attribute:: type
The type of action that the actuator executes when it is active.
@ -4676,40 +4775,6 @@ Types
Armature sensor detect conditions on armatures.
.. _armaturesensor-type:
Constants related to :data:`type`
.. data:: KX_ARMSENSOR_STATE_CHANGED
Detect that the constraint is changing state (active/inactive)
:value: 0
.. data:: KX_ARMSENSOR_LIN_ERROR_BELOW
Detect that the constraint linear error is above a threshold
:value: 1
.. data:: KX_ARMSENSOR_LIN_ERROR_ABOVE
Detect that the constraint linear error is below a threshold
:value: 2
.. data:: KX_ARMSENSOR_ROT_ERROR_BELOW
Detect that the constraint rotation error is above a threshold
:value: 3
.. data:: KX_ARMSENSOR_ROT_ERROR_ABOVE
Detect that the constraint rotation error is below a threshold
:value: 4
.. attribute:: type
The type of measurement that the sensor make when it is active.
@ -4744,87 +4809,6 @@ Types
Not all armature constraints are supported in the GE.
.. _armatureconstraint-constants-type:
Constants related to :data:`type`
.. data:: CONSTRAINT_TYPE_TRACKTO
.. data:: CONSTRAINT_TYPE_KINEMATIC
.. data:: CONSTRAINT_TYPE_ROTLIKE
.. data:: CONSTRAINT_TYPE_LOCLIKE
.. data:: CONSTRAINT_TYPE_MINMAX
.. data:: CONSTRAINT_TYPE_SIZELIKE
.. data:: CONSTRAINT_TYPE_LOCKTRACK
.. data:: CONSTRAINT_TYPE_STRETCHTO
.. data:: CONSTRAINT_TYPE_CLAMPTO
.. data:: CONSTRAINT_TYPE_TRANSFORM
.. data:: CONSTRAINT_TYPE_DISTLIMIT
.. _armatureconstraint-constants-ik-type:
Constants related to :data:`ik_type`
.. data:: CONSTRAINT_IK_COPYPOSE
constraint is trying to match the position and eventually the rotation of the target.
:value: 0
.. data:: CONSTRAINT_IK_DISTANCE
Constraint is maintaining a certain distance to target subject to ik_mode
:value: 1
.. _armatureconstraint-constants-ik-flag:
Constants related to :data:`ik_flag`
.. data:: CONSTRAINT_IK_FLAG_TIP
Set when the constraint operates on the head of the bone and not the tail
:value: 1
.. data:: CONSTRAINT_IK_FLAG_ROT
Set when the constraint tries to match the orientation of the target
:value: 2
.. data:: CONSTRAINT_IK_FLAG_STRETCH
Set when the armature is allowed to stretch (only the bones with stretch factor > 0.0)
:value: 16
.. data:: CONSTRAINT_IK_FLAG_POS
Set when the constraint tries to match the position of the target.
:value: 32
.. _armatureconstraint-constants-ik-mode:
Constants related to :data:`ik_mode`
.. data:: CONSTRAINT_IK_MODE_INSIDE
The constraint tries to keep the bone within ik_dist of target
:value: 0
.. data:: CONSTRAINT_IK_MODE_OUTSIDE
The constraint tries to keep the bone outside ik_dist of the target
:value: 1
.. data:: CONSTRAINT_IK_MODE_ONSURFACE
The constraint tries to keep the bone exactly at ik_dist of the target.
:value: 2
.. attribute:: type
@ -4943,16 +4927,6 @@ Types
Proxy to armature pose channel. Allows to read and set armature pose.
The attributes are identical to RNA attributes, but mostly in read-only mode.
See :data:`rotation_mode`
.. data:: PCHAN_ROT_QUAT
.. data:: PCHAN_ROT_XYZ
.. data:: PCHAN_ROT_XZY
.. data:: PCHAN_ROT_YXZ
.. data:: PCHAN_ROT_YZX
.. data:: PCHAN_ROT_ZXY
.. data:: PCHAN_ROT_ZYX
.. attribute:: name
channel name (=bone name), read-only.
@ -5086,17 +5060,7 @@ Types
Method of updating the bone rotation, read-write.
:type: integer
Use the following constants (euler mode are named as in Blender UI but the actual axis order is reversed).
* PCHAN_ROT_QUAT(0) : use quaternioin in rotation attribute to update bone rotation
* PCHAN_ROT_XYZ(1) : use euler_rotation and apply angles on bone's Z, Y, X axis successively
* PCHAN_ROT_XZY(2) : use euler_rotation and apply angles on bone's Y, Z, X axis successively
* PCHAN_ROT_YXZ(3) : use euler_rotation and apply angles on bone's Z, X, Y axis successively
* PCHAN_ROT_YZX(4) : use euler_rotation and apply angles on bone's X, Z, Y axis successively
* PCHAN_ROT_ZXY(5) : use euler_rotation and apply angles on bone's Y, X, Z axis successively
* PCHAN_ROT_ZYX(6) : use euler_rotation and apply angles on bone's X, Y, Z axis successively
:type: integer (one of :ref:`these constants <armaturechannel-constants-rotation-mode>`)
.. attribute:: channel_matrix

@ -689,7 +689,7 @@ OpenGL}" and the online NeHe tutorials are two of the best resources.
Return the specified pixel map
.. seealso:: `OpenGL Docs <http://www.opengl.org/sdk/docs/man/xhtml/glGetPixelMap.xml>`_
.. seealso:: `OpenGL Docs <http://www.opengl.org/sdk/docs/man2/xhtml/glGetPixelMap.xml>`_
:type map: Enumerated constant
:arg map: Specifies the name of the pixel map to return.
@ -701,7 +701,7 @@ OpenGL}" and the online NeHe tutorials are two of the best resources.
Return the polygon stipple pattern
.. seealso:: `OpenGL Docs <http://www.opengl.org/sdk/docs/man/xhtml/glGetPolygonStipple.xml>`_
.. seealso:: `OpenGL Docs <http://www.opengl.org/sdk/docs/man2/xhtml/glGetPolygonStipple.xml>`_
:type mask: :class:`bgl.Buffer` object I{type GL_BYTE}
:arg mask: Returns the stipple pattern. The initial value is all 1's.
@ -824,13 +824,25 @@ OpenGL}" and the online NeHe tutorials are two of the best resources.
Set the current color index
.. seealso:: `OpenGL Docs <http://www.opengl.org/sdk/docs/man/xhtml/glIndex.xml>`_
.. seealso:: `OpenGL Docs <http://www.opengl.org/sdk/docs/man2/xhtml/glIndex.xml>`_
:type c: :class:`bgl.Buffer` object. Depends on function prototype.
:arg c: Specifies a pointer to a one element array that contains the new value for
the current color index.
.. function:: glIndexMask(mask):
Control the writing of individual bits in the color index buffers
.. seealso:: `OpenGL Docs <http://www.opengl.org/sdk/docs/man2/xhtml/glIndexMask.xml>`_
:type mask: int
:arg mask: Specifies a bit mask to enable and disable the writing of individual bits
in the color index buffers.
Initially, the mask is all 1's.
.. function:: glInitNames():
Initialize the name stack
@ -1510,7 +1522,7 @@ OpenGL}" and the online NeHe tutorials are two of the best resources.
:arg mode: Specifies a symbolic value representing a shading technique.
.. function:: glStencilFuc(func, ref, mask):
.. function:: glStencilFunc(func, ref, mask):
Set function and reference value for stencil testing
@ -1835,7 +1847,238 @@ OpenGL}" and the online NeHe tutorials are two of the best resources.
:arg objx, objy, objz: Return the computed object coordinates.
class Buffer:
.. function:: glUseProgram(program):
Installs a program object as part of current rendering state
.. seealso:: `OpenGL Docs <http://www.opengl.org/sdk/docs/man/xhtml/glUseProgram.xml>`_
:type program: int
:arg program: Specifies the handle of the program object whose executables are to be used as part of current rendering state.
.. function:: glValidateProgram(program):
Validates a program object
.. seealso:: `OpenGL Docs <http://www.opengl.org/sdk/docs/man/xhtml/glValidateProgram.xml>`_
:type program: int
:arg program: Specifies the handle of the program object to be validated.
.. function:: glLinkProgram(program):
Links a program object.
.. seealso:: `OpenGL Docs <http://www.opengl.org/sdk/docs/man/xhtml/glLinkProgram.xml>`_
:type program: int
:arg program: Specifies the handle of the program object to be linked.
.. function:: glActiveTexture(texture):
Select active texture unit.
.. seealso:: `OpenGL Docs <http://www.opengl.org/sdk/docs/man/xhtml/glActiveTexture.xml>`_
:type texture: int
:arg texture: Constant in ``GL_TEXTURE0`` 0 - 8
.. function:: glAttachShader(program, shader):
Attaches a shader object to a program object.
.. seealso:: `OpenGL Docs <http://www.opengl.org/sdk/docs/man/xhtml/glAttachShader.xml>`_
:type program: int
:arg program: Specifies the program object to which a shader object will be attached.
:type shader: int
:arg shader: Specifies the shader object that is to be attached.
.. function:: glCompileShader(shader):
Compiles a shader object.
.. seealso:: `OpenGL Docs <http://www.opengl.org/sdk/docs/man/xhtml/glCompileShader.xml>`_
:type shader: int
:arg shader: Specifies the shader object to be compiled.
.. function:: glCreateProgram():
Creates a program object
.. seealso:: `OpenGL Docs <http://www.opengl.org/sdk/docs/man/xhtml/glCreateProgram.xml>`_
:rtype: int
:return: The new program or zero if an error occurs.
.. function:: glCreateShader(shaderType):
Creates a shader object.
.. seealso:: `OpenGL Docs <http://www.opengl.org/sdk/docs/man/xhtml/glCreateShader.xml>`_
:type shaderType: Specifies the type of shader to be created.
Must be one of ``GL_VERTEX_SHADER``,
``GL_TESS_CONTROL_SHADER``,
``GL_TESS_EVALUATION_SHADER``,
``GL_GEOMETRY_SHADER``,
or ``GL_FRAGMENT_SHADER``.
:arg shaderType:
:rtype: int
:return: 0 if an error occurs.
.. function:: glDeleteProgram(program):
Deletes a program object.
.. seealso:: `OpenGL Docs <http://www.opengl.org/sdk/docs/man/xhtml/glDeleteProgram.xml>`_
:type program: int
:arg program: Specifies the program object to be deleted.
.. function:: glDeleteShader(shader):
Deletes a shader object.
.. seealso:: `OpenGL Docs <http://www.opengl.org/sdk/docs/man/xhtml/glDeleteShader.xml>`_
:type shader: int
:arg shader: Specifies the shader object to be deleted.
.. function:: glDetachShader(program, shader):
Detaches a shader object from a program object to which it is attached.
.. seealso:: `OpenGL Docs <http://www.opengl.org/sdk/docs/man/xhtml/glDetachShader.xml>`_
:type program: int
:arg program: Specifies the program object from which to detach the shader object.
:type shader: int
:arg shader: pecifies the program object from which to detach the shader object.
.. function:: glGetAttachedShaders(program, maxCount, count, shaders):
Returns the handles of the shader objects attached to a program object.
.. seealso:: `OpenGL Docs <http://www.opengl.org/sdk/docs/man/xhtml/glGetAttachedShaders.xml>`_
:type program: int
:arg program: Specifies the program object to be queried.
:type maxCount: int
:arg maxCount: Specifies the size of the array for storing the returned object names.
:type count: :class:`bgl.Buffer` int buffer.
:arg count: Returns the number of names actually returned in objects.
:type shaders: :class:`bgl.Buffer` int buffer.
:arg shaders: Specifies an array that is used to return the names of attached shader objects.
.. function:: glGetProgramInfoLog(program, maxLength, length, infoLog):
Returns the information log for a program object.
.. seealso:: `OpenGL Docs <http://www.opengl.org/sdk/docs/man/xhtml/glGetProgramInfoLog.xml>`_
:type program: int
:arg program: Specifies the program object whose information log is to be queried.
:type maxLength: int
:arg maxLength: Specifies the size of the character buffer for storing the returned information log.
:type length: :class:`bgl.Buffer` int buffer.
:arg length: Returns the length of the string returned in **infoLog** (excluding the null terminator).
:type infoLog: :class:`bgl.Buffer` char buffer.
:arg infoLog: Specifies an array of characters that is used to return the information log.
.. function:: glGetShaderInfoLog(program, maxLength, length, infoLog):
Returns the information log for a shader object.
.. seealso:: `OpenGL Docs <http://www.opengl.org/sdk/docs/man/xhtml/glGetShaderInfoLog.xml>`_
:type shader: int
:arg shader: Specifies the shader object whose information log is to be queried.
:type maxLength: int
:arg maxLength: Specifies the size of the character buffer for storing the returned information log.
:type length: :class:`bgl.Buffer` int buffer.
:arg length: Returns the length of the string returned in **infoLog** (excluding the null terminator).
:type infoLog: :class:`bgl.Buffer` char buffer.
:arg infoLog: Specifies an array of characters that is used to return the information log.
.. function:: glGetProgramiv(program, pname, params):
Returns a parameter from a program object.
.. seealso:: `OpenGL Docs <http://www.opengl.org/sdk/docs/man/xhtml/glGetProgram.xml>`_
:type program: int
:arg program: Specifies the program object to be queried.
:type pname: int
:arg pname: Specifies the object parameter.
:type params: :class:`bgl.Buffer` int buffer.
:arg params: Returns the requested object parameter.
.. function:: glIsShader(shader):
Determines if a name corresponds to a shader object.
.. seealso:: `OpenGL Docs <http://www.opengl.org/sdk/docs/man/xhtml/glIsShader.xml>`_
:type shader: int
:arg shader: Specifies a potential shader object.
.. function:: glIsProgram(program):
Determines if a name corresponds to a program object
.. seealso:: `OpenGL Docs <http://www.opengl.org/sdk/docs/man/xhtml/glIsProgram.xml>`_
:type program: int
:arg program: Specifies a potential program object.
.. function:: glGetShaderSource(shader, bufSize, length, source):
Returns the source code string from a shader object
.. seealso:: `OpenGL Docs <http://www.opengl.org/sdk/docs/man/xhtml/glGetShaderSource.xml>`_
:type shader: int
:arg shader: Specifies the shader object to be queried.
:type bufSize: int
:arg bufSize: Specifies the size of the character buffer for storing the returned source code string.
:type length: :class:`bgl.Buffer` int buffer.
:arg length: Returns the length of the string returned in source (excluding the null terminator).
:type source: :class:`bgl.Buffer` char.
:arg source: Specifies an array of characters that is used to return the source code string.
.. function:: glShaderSource(shader, shader_string):
Replaces the source code in a shader object.
.. seealso:: `OpenGL Docs <http://www.opengl.org/sdk/docs/man/xhtml/glShaderSource.xml>`_
:type shader: int
:arg shader: Specifies the handle of the shader object whose source code is to be replaced.
:type shader_string: string
:arg shader_string: The shader string.
.. class:: Buffer
The Buffer object is simply a block of memory that is delineated and initialized by the
user. Many OpenGL functions return data to a C-style pointer, however, because this

@ -262,10 +262,16 @@ The calculation of some of the uniforms is based on matrices available in the sc
.. data:: GPU_DYNAMIC_SAMPLER_2DSHADOW
The uniform is an float representing the bumpmap scaling.
:value: 14
.. data:: GPU_DYNAMIC_OBJECT_AUTOBUMPSCALE
The uniform is an integer representing a shadow buffer corresponding to a lamp
casting shadow.
:value: 14
:value: 15
GLSL attribute type

@ -4,6 +4,13 @@
./blender.bin -b -noaudio -P doc/python_api/sphinx_doc_gen.py -- --partial bmesh* ; cd doc/python_api ; sphinx-build sphinx-in sphinx-out ; cd ../../
Submodules:
* :mod:`bmesh.ops`
* :mod:`bmesh.types`
* :mod:`bmesh.utils`
Intro
-----
@ -35,7 +42,6 @@ For an overview of BMesh data types and how they reference each other see:
TODO items are...
* add access to BMesh **walkers**
* add api for calling BMesh operators (unrelated to bpy.ops)
* add custom-data manipulation functions add/remove/rename.
Example Script

@ -0,0 +1,305 @@
*******************
Reference API Usage
*******************
Blender has many interlinking data types which have an auto-generated reference api which often has the information
you need to write a script, but can be difficult to use.
This document is designed to help you understand how to use the reference api.
Reference API Scope
===================
The reference API covers :mod:`bpy.types`, which stores types accessed via :mod:`bpy.context` - *The user context*
or :mod:`bpy.data` - *Blend file data*.
Other modules such as :mod:`bge`, :mod:`bmesh` and :mod:`aud` are not using Blenders data API
so this document doesn't apply to those modules.
Data Access
===========
The most common case for using the reference API is to find out how to access data in the blend file.
Before going any further its best to be aware of ID Data-Blocks in Blender since you will often find properties
relative to them.
ID Data
-------
ID Data-Blocks are used in Blender as top-level data containers.
From the user interface this isn't so obvious, but when developing you need to know about ID Data-Blocks.
ID data types include Scene, Group, Object, Mesh, Screen, World, Armature, Image and Texture.
for a full list see the sub-classes of :class:`bpy.types.ID`
Here are some characteristics ID Data-Blocks share.
- ID's are blend file data, so loading a new blend file reloads an entire new set of Data-Blocks.
- ID's can be accessed in Python from ``bpy.data.*``
- Each data-block has a unique ``.name`` attribute, displayed in the interface.
- Animation data is stored in ID's ``.animation_data``.
- ID's are the only data types that can be linked between blend files.
- ID's can be added/copied and removed via Python.
- ID's have their own garbage-collection system which frees unused ID's when saving.
- When a data-block has a reference to some external data, this is typically an ID Data-Block.
Simple Data Access
------------------
Lets start with a simple case, say you wan't a python script to adjust the objects location.
Start by finding this setting in the interface ``Properties Window -> Object -> Transform -> Location``
From the button you can right click and select **Online Python Reference**, this will link you to:
:class:`bpy.types.Object.location`
Being an API reference, this link often gives little more information then the tool-tip, though some of the pages
include examples (normally at the top of the page).
At this point you may say *Now what?* - you know that you have to use ``.location`` and that its an array of 3 floats
but you're still left wondering how to access this in a script.
So the next step is to find out where to access objects, go down to the bottom of the page to the **References**
section, for objects there are many references, but one of the most common places to access objects is via the context.
It's easy to be overwhelmed at this point since there ``Object`` get referenced in so many places - modifiers,
functions, textures and constraints.
But if you want to access any data the user has selected
you typically only need to check the :mod:`bpy.context` references.
Even then, in this case there are quite a few though if you read over these - most are mode specific.
If you happen to be writing a tool that only runs in weight paint mode, then using ``weight_paint_object``
would be appropriate.
However to access an item the user last selected, look for the ``active`` members,
Having access to a single active member the user selects is a convention in Blender: eg. ``active_bone``,
``active_pose_bone``, ``active_node`` ... and in this case we can use - ``active_object``.
So now we have enough information to find the location of the active object.
.. code-block:: python
bpy.context.active_object.location
You can type this into the python console to see the result.
The other common place to access objects in the reference is :class:`bpy.types.BlendData.objects`.
.. note::
This is **not** listed as :mod:`bpy.data.objects`,
this is because :mod:`bpy.data` is an instance of the :class:`bpy.types.BlendData` class,
so the documentation points there.
With :mod:`bpy.data.objects`, this is a collection of objects so you need to access one of its members.
.. code-block:: python
bpy.data.objects["Cube"].location
Nested Properties
-----------------
The previous example is quite straightforward because ``location`` is a property of ``Object`` which can be accessed
from the context directly.
Here are some more complex examples:
.. code-block:: python
# access a render layers samples
bpy.context.scene.render.layers["RenderLayer"].samples
# access to the current weight paint brush size
bpy.context.tool_settings.weight_paint.brush.size
# check if the window is fullscreen
bpy.context.window.screen.show_fullscreen
As you can see there are times when you want to access data which is nested
in a way that causes you to go through a few indirections.
The properties are arranged to match how data is stored internally (in blenders C code) which is often logical but
not always quite what you would expect from using Blender.
So this takes some time to learn, it helps you understand how data fits together in Blender which is important
to know when writing scripts.
When starting out scripting you will often run into the problem where you're not sure how to access the data you want.
There are a few ways to do this.
- Use the Python console's auto-complete to inspect properties. *This can be hit-and-miss but has the advantage
that you can easily see the values of properties and assign them to interactively see the results.*
- Copy the Data-Path from the user interface. *Explained further in :ref:`Copy Data Path <info_data_path_copy>`*
- Using the documentation to follow references. *Explained further in :ref:`Indirect Data Access <info_data_path_indirect>`*
.. _info_data_path_copy
Copy Data Path
--------------
Blender can compute the Python string to a property which is shown in the tool-tip, on the line below ``Python: ...``,
This saves having to use the API reference to click back up the references to find where data is accessed from.
There is a user-interface feature to copy the data-path which gives the path from an :class:`bpy.types.ID` data-block,
to its property.
To see how this works we'll get the path to the Subdivision-Surface modifiers subdivision setting.
Start with the default scene and select the **Modifiers** tab, then add a **Subdivision-Surface** modifier to the cube.
Now hover your mouse over the button labeled **View**, The tool-tip includes :class:`bpy.types.SubsurfModifier.levels`
but we want the path from the object to this property.
Note that the text copied won't include the ``bpy.data.collection["name"].`` component since its assumed that
you won't be doing collection look-ups on every access and typically you'll want to use the context rather
then access each :class:`bpy.types.ID` instance by name.
Type in the ID path into a Python console :mod:`bpy.context.active_object`. Include the trailing dot and don't hit "enter", yet.
Now right-click on the button and select **Copy Data Path**, then paste the result into the console.
So now you should have the answer:
.. code-block:: python
bpy.context.active_object.modifiers["Subsurf"].levels
Hit "enter" and you'll get the current value of 1. Now try changing the value to 2:
.. code-block:: python
bpy.context.active_object.modifiers["Subsurf"].levels = 2
You can see the value update in the Subdivision-Surface modifier's UI as well as the cube.
.. _info_data_path_indirect
Indirect Data Access
--------------------
For this example we'll go over something more involved, showing the steps to access the active sculpt brushes texture.
Lets say we want to access the texture of a brush via Python, to adjust its ``contrast`` for example.
- Start in the default scene and enable 'Sculpt' mode from the 3D-View header.
- From the toolbar expand the **Texture** panel and add a new texture.
*Notice the texture button its self doesn't have very useful links (you can check the tool-tips).*
- The contrast setting isn't exposed in the sculpt toolbar, so view the texture in the properties panel...
- In the properties button select the Texture context.
- Select the Brush icon to show the brush texture.
- Expand the **Colors** panel to locate the **Contrast** button.
- Right click on the contrast button and select **Online Python Reference** This takes you to ``bpy.types.Texture.contrast``
- Now we can see that ``contrast`` is a property of texture, so next we'll check on how to access the texture from the brush.
- Check on the **References** at the bottom of the page, sometimes there are many references, and it may take
some guess work to find the right one, but in this case its obviously ``Brush.texture``.
*Now we know that the texture can be accessed from* ``bpy.data.brushes["BrushName"].texture``
*but normally you won't want to access the brush by name, so we'll see now to access the active brush instead.*
- So the next step is to check on where brushes are accessed from via the **References**.
In this case there is simply ``bpy.context.brush`` which is all we need.
Now you can use the Python console to form the nested properties needed to access brush textures contrast,
logically we now know.
*Context -> Brush -> Texture -> Contrast*
Since the attribute for each is given along the way we can compose the data path in the python console:
.. code-block:: python
bpy.context.brush.texture.contrast
There can be multiple ways to access the same data, which you choose often depends on the task.
An alternate path to access the same setting is...
.. code-block:: python
bpy.context.sculpt.brush.texture.contrast
Or access the brush directly...
.. code-block:: python
bpy.data.brushes["BrushName"].texture.contrast
If you are writing a user tool normally you want to use the :mod:`bpy.context` since the user normally expects
the tool to operate on what they have selected.
For automation you are more likely to use :mod:`bpy.data` since you want to be able to access specific data and manipulate
it, no matter what the user currently has the view set at.
Operators
=========
Most key-strokes and buttons in Blender call an operator which is also exposed to python via :mod:`bpy.ops`,
To see the Python equivalent hover your mouse over the button and see the tool-tip,
eg ``Python: bpy.ops.render.render()``,
If there is no tool-tip or the ``Python:`` line is missing then this button is not using an operator and
can't be accessed from Python.
If you want to use this in a script you can press :kbd:`Control-C` while your mouse is over the button to copy it to the
clipboard.
You can also right click on the button and view the **Online Python Reference**, this mainly shows arguments and
their defaults however operators written in Python show their file and line number which may be useful if you
are interested to check on the source code.
.. note::
Not all operators can be called usefully from Python, for more on this see :ref:`using operators <using_operators>`.
Info View
---------
Blender records operators you run and displays them in the **Info** space.
This is located above the file-menu which can be dragged down to display its contents.
Select the **Script** screen that comes default with Blender to see its output.
You can perform some actions and see them show up - delete a vertex for example.
Each entry can be selected (Right-Mouse-Button), then copied :kbd:`Control-C`, usually to paste in the text editor or python console.
.. note::
Not all operators get registered for display,
zooming the view for example isn't so useful to repeat so its excluded from the output.
To display *every* operator that runs see :ref:`Show All Operators <info_show_all_operators>`

@ -5,6 +5,8 @@ Gotchas
This document attempts to help you work with the Blender API in areas that can be troublesome and avoid practices that are known to give instability.
.. _using_operators:
Using Operators
===============
@ -118,18 +120,19 @@ If you insist - yes its possible, but scripts that use this hack wont be conside
bpy.ops.wm.redraw_timer(type='DRAW_WIN_SWAP', iterations=1)
I can't edit the mesh in edit-mode!
===================================
Modes and Mesh Access
=====================
Blender's EditMesh is an internal data structure (not saved and not exposed to python), this gives the main annoyance that you need to exit edit-mode to edit the mesh from python.
When working with mesh data you may run into the problem where a script fails to run as expected in edit-mode. This is caused by edit-mode having its own data which is only written back to the mesh when exiting edit-mode.
The reason we have not made much attempt to fix this yet is because we
will likely move to BMesh mesh API eventually, so any work on the API now will be wasted effort.
A common example is that exporters may access a mesh through ``obj.data`` (a :class:`bpy.types.Mesh`) but the user is in edit-mode, where the mesh data is available but out of sync with the edit mesh.
With the BMesh API we may expose mesh data to python so we can
write useful tools in python which are also fast to execute while in edit-mode.
In this situation you can...
For the time being this limitation just has to be worked around but we're aware its frustrating needs to be addressed.
* Exit edit-mode before running the tool.
* Explicitly update the mesh by calling :class:`bmesh.types.BMesh.to_mesh`.
* Modify the script to support working on the edit-mode data directly, see: :mod:`bmesh.from_edit_mesh`.
* Report the context as incorrect and only allow the script to run outside edit-mode.
.. _info_gotcha_mesh_faces:
@ -311,7 +314,7 @@ Naming Limitations
A common mistake is to assume newly created data is given the requested name.
This can cause bugs when you add some data (normally imported) and then reference it later by name.
This can cause bugs when you add some data (normally imported) then reference it later by name.
.. code-block:: python
@ -493,7 +496,7 @@ Heres an example of threading supported by Blender:
t.join()
This an example of a timer which runs many times a second and moves the default cube continuously while Blender runs (Unsupported).
This an example of a timer which runs many times a second and moves the default cube continuously while Blender runs **(Unsupported)**.
.. code-block:: python
@ -516,7 +519,7 @@ So far, no work has gone into making Blender's python integration thread safe, s
.. note::
Pythons threads only allow co-currency and won't speed up your scripts on multi-processor systems, the ``subprocess`` and ``multiprocess`` modules can be used with blender and make use of multiple CPU's too.
Pythons threads only allow co-currency and won't speed up your scripts on multi-processor systems, the ``subprocess`` and ``multiprocess`` modules can be used with Blender and make use of multiple CPU's too.
Help! My script crashes Blender
@ -536,11 +539,18 @@ Here are some general hints to avoid running into these problems.
* Crashes may not happen every time, they may happen more on some configurations/operating-systems.
.. note::
To find the line of your script that crashes you can use the ``faulthandler`` module.
See `faulthandler docs <http://docs.python.org/dev/library/faulthandler.html>`_.
While the crash may be in Blenders C/C++ code, this can help a lot to track down the area of the script that causes the crash.
Undo/Redo
---------
Undo invalidates all :class:`bpy.types.ID` instances (Object, Scene, Mesh etc).
Undo invalidates all :class:`bpy.types.ID` instances (Object, Scene, Mesh, Lamp... etc).
This example shows how you can tell undo changes the memory locations.
@ -557,6 +567,21 @@ This example shows how you can tell undo changes the memory locations.
As suggested above, simply not holding references to data when Blender is used interactively by the user is the only way to ensure the script doesn't become unstable.
Undo & Library Data
^^^^^^^^^^^^^^^^^^^
One of the advantages with Blenders library linking system that undo can skip checking changes in library data since it is assumed to be static.
Tools in Blender are not allowed to modify library data.
Python however does not enforce this restriction.
This can be useful in some cases, using a script to adjust material values for example.
But its also possible to use a script to make library data point to newly created local data, which is not supported since a call to undo will remove the local data but leave the library referencing it and likely crash.
So it's best to consider modifying library data an advanced usage of the API and only to use it when you know what you're doing.
Edit Mode / Memory Access
-------------------------
@ -616,15 +641,36 @@ Removing Data
**Any** data that you remove shouldn't be modified or accessed afterwards, this includes f-curves, drivers, render layers, timeline markers, modifiers, constraints along with objects, scenes, groups, bones.. etc.
This is a problem in the API at the moment that we should eventually solve.
The ``remove()`` api calls will invalidate the data they free to prevent common mistakes.
The following example shows how this precortion works.
.. code-block:: python
mesh = bpy.data.meshes.new(name="MyMesh")
# normally the script would use the mesh here...
bpy.data.meshes.remove(mesh)
print(mesh.name) # <- give an exception rather then crashing:
# ReferenceError: StructRNA of type Mesh has been removed
But take care because this is limited to scripts accessing the variable which is removed, the next example will still crash.
.. code-block:: python
mesh = bpy.data.meshes.new(name="MyMesh")
vertices = mesh.vertices
bpy.data.meshes.remove(mesh)
print(vertices) # <- this may crash
sys.exit
========
Some python modules will call sys.exit() themselves when an error occurs, while not common behavior this is something to watch out for because it may seem as if blender is crashing since sys.exit() will quit blender immediately.
Some python modules will call ``sys.exit()`` themselves when an error occurs, while not common behavior this is something to watch out for because it may seem as if blender is crashing since ``sys.exit()`` will quit blender immediately.
For example, the ``optparse`` module will print an error and exit if the arguments are invalid.
An ugly way of troubleshooting this is to set ``sys.exit = None`` and see what line of python code is quitting, you could of course replace ``sys.exit``/ with your own function but manipulating python in this way is bad practice.
An ugly way of troubleshooting this is to set ``sys.exit = None`` and see what line of python code is quitting, you could of course replace ``sys.exit`` with your own function but manipulating python in this way is bad practice.

@ -1,3 +1,5 @@
.. _info_overview:
*******************
Python API Overview
*******************

@ -1,3 +1,5 @@
.. _info_quickstart:
***********************
Quickstart Introduction
***********************

@ -44,15 +44,17 @@ if this can't be generated, only the property name is copied.
.. note::
This uses the same method for creating the animation path used by :class:`FCurve.data_path` and :class:`DriverTarget.data_path` drivers.
This uses the same method for creating the animation path used by :class:`bpy.types.FCurve.data_path` and :class:`bpy.types.DriverTarget.data_path` drivers.
.. _info_show_all_operators
Show All Operators
==================
While blender logs operators in the Info space, this only reports operators with the ``REGISTER`` option enabeld so as not to flood the Info view with calls to ``bpy.ops.view3d.smoothview`` and ``bpy.ops.view3d.zoom``.
However, for testing it can be useful to see **every** operator called in a terminal, do this by enabling the debug option either by passing the ``--debug`` argument when starting blender or by setting :mod:`bpy.app.debug` to True while blender is running.
However, for testing it can be useful to see **every** operator called in a terminal, do this by enabling the debug option either by passing the ``--debug-wm`` argument when starting blender or by setting :mod:`bpy.app.debug_wm` to True while blender is running.
Use an External Editor
@ -218,6 +220,14 @@ The next example is an equivalent single line version of the script above which
``code.interact`` can be added at any line in the script and will pause the script an launch an interactive interpreter in the terminal, when you're done you can quit the interpreter and the script will continue execution.
If you have **IPython** installed you can use their ``embed()`` function which will implicitly use the current namespace, this has autocomplete and some useful features that the standard python eval-loop doesn't have.
.. code-block:: python
import IPython
IPython.embed()
Admittedly this highlights the lack of any python debugging support built into blender, but its still handy to know.
.. note::

@ -0,0 +1,645 @@
Addon Tutorial
##############
************
Introduction
************
Intended Audience
=================
This tutorial is designed to help technical artists or developers learn to extend Blender.
An understanding of the basics of Python is expected for those working through this tutorial.
Prerequisites
-------------
Before going through the tutorial you should...
* Familiarity with the basics of working in Blender.
* Know how to run a script in Blender's text editor (as documented in the quick-start)
* Have an understanding of Python primitive types (int, boolean, string, list, tuple, dictionary, and set).
* Be familiar with the concept of Python modules.
* Basic understanding of classes (object orientation) in Python.
Suggested reading before starting this tutorial.
* `Dive Into Python <http://getpython3.com/diveintopython3/index.html>`_ sections (1, 2, 3, 4, and 7).
* :ref:`Blender API Quickstart <info_quickstart>`
to help become familiar with Blender/Python basics.
To best troubleshoot any error message Python prints while writing scripts you run blender with from a terminal,
see :ref:`Use The Terminal <use_the_terminal>`.
Documentation Links
===================
While going through the tutorial you may want to look into our reference documentation.
* :ref:`Blender API Overview <info_overview>`. -
*This document is rather detailed but helpful if you want to know more on a topic.*
* :mod:`bpy.context` api reference. -
*Handy to have a list of available items your script may operate on.*
* :class:`bpy.types.Operator`. -
*The following addons define operators, these docs give details and more examples of operators.*
******
Addons
******
What is an Addon?
=================
An addon is simply a Python module with some additional requirements so Blender can display it in a list with useful
information.
To give an example, here is the simplest possible addon.
.. code-block:: python
bl_info = {"name": "My Test Addon", "category": "Object"}
def register():
print("Hello World")
def unregister():
print("Goodbye World")
* ``bl_info`` is a dictionary containing addon meta-data such as the title, version and author to be displayed in the
user preferences addon list.
* ``register`` is a function which only runs when enabling the addon, this means the module can be loaded without
activating the addon.
* ``unregister`` is a function to unload anything setup by ``register``, this is called when the addon is disabled.
Notice this addon does not do anything related to Blender, (the :mod:`bpy` module is not imported for example).
This is a contrived example of an addon that serves to illustrate the point
that the base requirements of an addon are simple.
An addon will typically register operators, panels, menu items etc, but its worth noting that _any_ script can do this,
when executed from the text editor or even the interactive console - there is nothing inherently different about an
addon that allows it to integrate with Blender, such functionality is just provided by the :mod:`bpy` module for any
script to access.
So an addon is just a way to encapsulate a Python module in a way a user can easily utilize.
.. note::
Running this script within the text editor won't print anything,
to see the output it must be installed through the user preferences.
Messages will be printed when enabling and disabling.
Your First Addon
================
The simplest possible addon above was useful as an example but not much else.
This next addon is simple but shows how to integrate a script into Blender using an ``Operator``
which is the typical way to define a tool accessed from menus, buttons and keyboard shortcuts.
For the first example we'll make a script that simply moves all objects in a scene.
Write The Script
----------------
Add the following script to the text editor in Blender.
.. code-block:: python
import bpy
scene = bpy.context.scene
for obj in scene.objects:
obj.location.x += 1.0
.. image:: run_script.png
:width: 924px
:align: center
:height: 574px
:alt: Run Script button
Click the Run Script button, all objects in the active scene are moved by 1.0 Blender unit.
Next we'll make this script into an addon.
Write the Addon (Simple)
------------------------
This addon takes the body of the script above, and adds them to an operator's ``execute()`` function.
.. code-block:: python
bl_info = {
"name": "Move X Axis",
"category": "Object",
}
import bpy
class ObjectMoveX(bpy.types.Operator):
"""My Object Moving Script""" # blender will use this as a tooltip for menu items and buttons.
bl_idname = "object.move_x" # unique identifier for buttons and menu items to reference.
bl_label = "Move X by One" # display name in the interface.
bl_options = {'REGISTER', 'UNDO'} # enable undo for the operator.
def execute(self, context): # execute() is called by blender when running the operator.
# The original script
scene = context.scene
for obj in scene.objects:
obj.location.x += 1.0
return {'FINISHED'} # this lets blender know the operator finished successfully.
def register():
bpy.utils.register_class(ObjectMoveX)
def unregister():
bpy.utils.unregister_class(ObjectMoveX)
# This allows you to run the script directly from blenders text editor
# to test the addon without having to install it.
if __name__ == "__main__":
register()
.. note:: ``bl_info`` is split across multiple lines, this is just a style convention used to more easily add items.
.. note:: Rather than using ``bpy.context.scene``, we use the ``context.scene`` argument passed to ``execute()``.
In most cases these will be the same however in some cases operators will be passed a custom context
so script authors should prefer the ``context`` argument passed to operators.
To test the script you can copy and paste this into Blender text editor and run it, this will execute the script
directly and call register immediately.
However running the script wont move any objects, for this you need to execute the newly registered operator.
.. image:: spacebar.png
:width: 924px
:align: center
:height: 574px
:alt: Spacebar
Do this by pressing ``SpaceBar`` to bring up the operator search dialog and type in "Move X by One" (the ``bl_label``),
then press ``Enter``.
The objects should move as before.
*Keep this addon open in Blender for the next step - Installing.*
Install The Addon
-----------------
Once you have your addon within in Blender's text editor, you will want to be able to install it so it can be enabled in
the user preferences to load on startup.
Even though the addon above is a test, lets go through the steps anyway so you know how to do it for later.
To install the Blender text as an addon you will first have to save it to disk, take care to obey the naming
restrictions that apply to Python modules and end with a ``.py`` extension.
Once the file is on disk, you can install it as you would for an addon downloaded online.
Open the user **File -> User Preferences**, Select the **Addon** section, press **Install Addon...** and select the file.
Now the addon will be listed and you can enable it by pressing the check-box, if you want it to be enabled on restart,
press **Save as Default**.
.. note::
The destination of the addon depends on your Blender configuration.
When installing an addon the source and destination path are printed in the console.
You can also find addon path locations by running this in the Python console.
.. code-block:: python
import addon_utils
print(addon_utils.paths())
More is written on this topic here:
`Directory Layout <http://wiki.blender.org/index.php/Doc:2.6/Manual/Introduction/Installing_Blender/DirectoryLayout>`_
Your Second Addon
=================
For our second addon, we will focus on object instancing - this is - to make linked copies of an object in a
similar way to what you may have seen with the array modifier.
Write The Script
----------------
As before, first we will start with a script, develop it, then convert into an addon.
.. code-block:: python
import bpy
from bpy import context
# Get the current scene
scene = context.scene
# Get the 3D cursor
cursor = scene.cursor_location
# Get the active object (assume we have one)
obj = scene.objects.active
# Now make a copy of the object
obj_new = obj.copy()
# The object won't automatically get into a new scene
scene.objects.link(obj_new)
# Now we can place the object
obj_new.location = cursor
Now try copy this script into Blender and run it on the default cube.
Make sure you click to move the 3D cursor before running as the duplicate will appear at the cursor's location.
... go off and test ...
After running, notice that when you go into edit-mode to change the cube - all of the copies change,
in Blender this is known as *Linked-Duplicates*.
Next, we're going to do this in a loop, to make an array of objects between the active object and the cursor.
.. code-block:: python
import bpy
from bpy import context
scene = context.scene
cursor = scene.cursor_location
obj = scene.objects.active
# Use a fixed value for now, eventually make this user adjustable
total = 10
# Add 'total' objects into the scene
for i in range(total):
obj_new = obj.copy()
scene.objects.link(obj_new)
# Now place the object in between the cursor
# and the active object based on 'i'
factor = i / total
obj_new.location = (obj.location * factor) + (cursor * (1.0 - factor))
Try run this script with with the active object and the cursor spaced apart to see the result.
With this script you'll notice we're doing some math with the object location and cursor, this works because both are
3D :class:`mathutils.Vector` instances, a convenient class provided by the :mod:`mathutils` module and
allows vectors to be multiplied by numbers and matrices.
If you are interested in this area, read into :class:`mathutils.Vector` - there are many handy utility functions
such as getting the angle between vectors, cross product, dot products
as well as more advanced functions in :mod:`mathutils.geometry` such as bezier spline interpolation and
ray-triangle intersection.
For now we'll focus on making this script an addon, but its good to know that this 3D math module is available and
can help you with more advanced functionality later on.
Write the Addon
---------------
The first step is to convert the script as-is into an addon.
.. code-block:: python
bl_info = {
"name": "Cursor Array",
"category": "Object",
}
import bpy
class ObjectCursorArray(bpy.types.Operator):
"""Object Cursor Array"""
bl_idname = "object.cursor_array"
bl_label = "Cursor Array"
bl_options = {'REGISTER', 'UNDO'}
def execute(self, context):
scene = context.scene
cursor = scene.cursor_location
obj = scene.objects.active
total = 10
for i in range(total):
obj_new = obj.copy()
scene.objects.link(obj_new)
factor = i / total
obj_new.location = (obj.location * factor) + (cursor * (1.0 - factor))
return {'FINISHED'}
def register():
bpy.utils.register_class(ObjectCursorArray)
def unregister():
bpy.utils.unregister_class(ObjectCursorArray)
if __name__ == "__main__":
register()
Everything here has been covered in the previous steps, you may want to try run the addon still
and consider what could be done to make it more useful.
... go off and test ...
The two of the most obvious missing things are - having the total fixed at 10, and having to access the operator from
space-bar is not very convenient.
Both these additions are explained next, with the final script afterwards.
Operator Property
^^^^^^^^^^^^^^^^^
There are a variety of property types that are used for tool settings, common property types include:
int, float, vector, color, boolean and string.
These properties are handled differently to typical Python class attributes
because Blender needs to be display them in the interface,
store their settings in key-maps and keep settings for re-use.
While this is handled in a fairly Pythonic way, be mindful that you are in fact defining tool settings that
are loaded into Blender and accessed by other parts of Blender, outside of Python.
To get rid of the literal 10 for `total`, we'll us an operator property.
Operator properties are defined via bpy.props module, this is added to the class body.
.. code-block:: python
# moved assignment from execute() to the body of the class...
total = bpy.props.IntProperty(name="Steps", default=2, min=1, max=100)
# and this is accessed on the class
# instance within the execute() function as...
self.total
These properties from :mod:`bpy.props` are handled specially by Blender when the class is registered
so they display as buttons in the user interface.
There are many arguments you can pass to properties to set limits, change the default and display a tooltip.
.. seealso:: :mod:`bpy.props.IntProperty`
This document doesn't go into details about using other property types,
however the link above includes examples of more advanced property usage.
Menu Item
^^^^^^^^^
Addons can add to the user interface of existing panels, headers and menus defined in Python.
For this example we'll add to an existing menu.
.. image:: menu_id.png
:width: 334px
:align: center
:height: 128px
:alt: Menu Identifier
To find the identifier of a menu you can hover your mouse over the menu item and the identifier is displayed.
The method used for adding a menu item is to append a draw function into an existing class.
.. code-block:: python
def menu_func(self, context):
self.layout.operator(ObjectCursorArray.bl_idname)
def register():
bpy.types.VIEW3D_MT_object.append(menu_func)
For docs on extending menus see: :doc:`bpy.types.Menu`.
Keymap
^^^^^^
In Blender addons have their own key-maps so as not to interfere with Blenders built in key-maps.
In the example below, a new object-mode :class:`bpy.types.KeyMap` is added,
then a :class:`bpy.types.KeyMapItem` is added to the key-map which references our newly added operator,
using :kbd:`Ctrl-Shift-Space` as the key shortcut to activate it.
.. code-block:: python
# store keymaps here to access after registration
addon_keymaps = []
def register():
# handle the keymap
wm = bpy.context.window_manager
km = wm.keyconfigs.addon.keymaps.new(name='Object Mode', space_type='EMPTY')
kmi = km.keymap_items.new(ObjectCursorArray.bl_idname, 'SPACE', 'PRESS', ctrl=True, shift=True)
kmi.properties.total = 4
addon_keymaps.append(km)
def unregister():
# handle the keymap
wm = bpy.context.window_manager
for km in addon_keymaps:
wm.keyconfigs.addon.keymaps.remove(km)
# clear the list
addon_keymaps.clear()
Notice how the key-map item can have a different ``total`` setting then the default set by the operator,
this allows you to have multiple keys accessing the same operator with different settings.
.. note::
While :kbd:`Ctrl-Shift-Space` isn't a default Blender key shortcut, its hard to make sure addons won't
overwrite each others keymaps, At least take care when assigning keys that they don't
conflict with important functionality within Blender.
For API documentation on the functions listed above, see:
:class:`bpy.types.KeyMaps.new`,
:class:`bpy.types.KeyMap`,
:class:`bpy.types.KeyMapItems.new`,
:class:`bpy.types.KeyMapItem`.
Bringing it all together
^^^^^^^^^^^^^^^^^^^^^^^^
.. code-block:: python
bl_info = {
"name": "Cursor Array",
"category": "Object",
}
import bpy
class ObjectCursorArray(bpy.types.Operator):
"""Object Cursor Array"""
bl_idname = "object.cursor_array"
bl_label = "Cursor Array"
bl_options = {'REGISTER', 'UNDO'}
total = bpy.props.IntProperty(name="Steps", default=2, min=1, max=100)
def execute(self, context):
scene = context.scene
cursor = scene.cursor_location
obj = scene.objects.active
for i in range(self.total):
obj_new = obj.copy()
scene.objects.link(obj_new)
factor = i / self.total
obj_new.location = (obj.location * factor) + (cursor * (1.0 - factor))
return {'FINISHED'}
def menu_func(self, context):
self.layout.operator(ObjectCursorArray.bl_idname)
# store keymaps here to access after registration
addon_keymaps = []
def register():
bpy.utils.register_class(ObjectCursorArray)
bpy.types.VIEW3D_MT_object.append(menu_func)
# handle the keymap
wm = bpy.context.window_manager
km = wm.keyconfigs.addon.keymaps.new(name='Object Mode', space_type='EMPTY')
kmi = km.keymap_items.new(ObjectCursorArray.bl_idname, 'SPACE', 'PRESS', ctrl=True, shift=True)
kmi.properties.total = 4
addon_keymaps.append(km)
def unregister():
bpy.utils.unregister_class(ObjectCursorArray)
bpy.types.VIEW3D_MT_object.remove(menu_func)
# handle the keymap
wm = bpy.context.window_manager
for km in addon_keymaps:
wm.keyconfigs.addon.keymaps.remove(km)
# clear the list
del addon_keymaps[:]
if __name__ == "__main__":
register()
.. image:: in_menu.png
:width: 591px
:align: center
:height: 649px
:alt: In the menu
Run the script (or save it and add it through the Preferences like before) and it will appear in the menu.
.. image:: op_prop.png
:width: 669px
:align: center
:height: 644px
:alt: Operator Property
After selecting it from the menu, you can choose how many instance of the cube you want created.
.. note::
Directly executing the script multiple times will add the menu each time too.
While not useful behavior, theres nothing to worry about since addons won't register them selves multiple
times when enabled through the user preferences.
Conclusions
===========
Addons can encapsulate certain functionality neatly for writing tools to improve your work-flow or for writing utilities
for others to use.
While there are limits to what Python can do within Blender, there is certainly a lot that can be achieved without
having to dive into Blender's C/C++ code.
The example given in the tutorial is limited, but shows the Blender API used for common tasks that you can expand on
to write your own tools.
Further Reading
---------------
Blender comes commented templates which are accessible from the text editor header, if you have specific areas
you want to see example code for, this is a good place to start.
Here are some sites you might like to check on after completing this tutorial.
* :ref:`Blender/Python API Overview <info_overview>` -
*For more background details on Blender/Python integration.*
* `How to Think Like a Computer Scientist <http://interactivepython.org/courselib/static/thinkcspy/index.html>`_ -
*Great info for those who are still learning Python.*
* `Blender Development (Wiki) <http://wiki.blender.org/index.php/Dev:Contents>`_ -
*Blender Development, general information and helpful links.*
* `Blender Artists (Coding Section) <http://blenderartists.org/forum/forumdisplay.php?47-Coding>`_ -
*forum where people ask Python development questions*

@ -0,0 +1,380 @@
# ##### BEGIN GPL LICENSE BLOCK #####
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# ##### END GPL LICENSE BLOCK #####
# <pep8 compliant>
# This is a quite stupid script which extracts bmesh api docs from
# 'bmesh_opdefines.c' in order to avoid having to add a lot of introspection
# data access into the api.
#
# The script is stupid becase it makes assumptions about formatting...
# that each arg has its own line, that comments above or directly after will be __doc__ etc...
#
# We may want to replace this script with something else one day but for now its good enough.
# if it needs large updates it may be better to rewrite using a real parser or
# add introspection into bmesh.ops.
# - campbell
import os
CURRENT_DIR = os.path.abspath(os.path.dirname(__file__))
SOURCE_DIR = os.path.normpath(os.path.abspath(os.path.normpath(os.path.join(CURRENT_DIR, "..", ".."))))
FILE_OP_DEFINES_C = os.path.join(SOURCE_DIR, "source", "blender", "bmesh", "intern", "bmesh_opdefines.c")
OUT_RST = os.path.join(CURRENT_DIR, "rst", "bmesh.ops.rst")
HEADER = r"""
BMesh Operators (bmesh.ops)
===========================
.. module:: bmesh.ops
This module gives access to low level bmesh operations.
Most operators take input and return output, they can be chained together
to perform useful operations.
.. note::
This API us new in 2.65 and not yet well tested.
Operator Example
++++++++++++++++
This script shows how operators can be used to model a link of a chain.
.. literalinclude:: ../examples/bmesh.ops.1.py
"""
def main():
fsrc = open(FILE_OP_DEFINES_C, 'r', encoding="utf-8")
blocks = []
is_block = False
is_comment = False # /* global comments only */
comment_ctx = None
block_ctx = None
for l in fsrc:
l = l[:-1]
# weak but ok
if ("BMOpDefine" in l and l.split()[1] == "BMOpDefine") and not "bmo_opdefines[]" in l:
is_block = True
block_ctx = []
blocks.append((comment_ctx, block_ctx))
elif l.strip().startswith("/*"):
is_comment = True
comment_ctx = []
if is_block:
if l.strip().startswith("//"):
pass
else:
# remove c++ comment if we have one
cpp_comment = l.find("//")
if cpp_comment != -1:
l = l[:cpp_comment]
block_ctx.append(l)
if l.strip() == "};":
is_block = False
comment_ctx = None
if is_comment:
c_comment_start = l.find("/*")
if c_comment_start != -1:
l = l[c_comment_start + 2:]
c_comment_end = l.find("*/")
if c_comment_end != -1:
l = l[:c_comment_end]
is_comment = False
comment_ctx.append(l)
fsrc.close()
del fsrc
# namespace hack
vars = (
"BMO_OP_SLOT_ELEMENT_BUF",
"BMO_OP_SLOT_BOOL",
"BMO_OP_SLOT_FLT",
"BMO_OP_SLOT_INT",
"BMO_OP_SLOT_MAT",
"BMO_OP_SLOT_VEC",
"BMO_OP_SLOT_PTR",
"BMO_OP_SLOT_MAPPING",
"BMO_OP_SLOT_SUBTYPE_MAP_ELEM",
"BMO_OP_SLOT_SUBTYPE_MAP_BOOL",
"BMO_OP_SLOT_SUBTYPE_MAP_INT",
"BMO_OP_SLOT_SUBTYPE_MAP_FLT",
"BMO_OP_SLOT_SUBTYPE_MAP_EMPTY",
"BMO_OP_SLOT_SUBTYPE_MAP_INTERNAL",
"BMO_OP_SLOT_SUBTYPE_PTR_SCENE",
"BMO_OP_SLOT_SUBTYPE_PTR_OBJECT",
"BMO_OP_SLOT_SUBTYPE_PTR_MESH",
"BMO_OP_SLOT_SUBTYPE_PTR_BMESH",
"BMO_OP_SLOT_SUBTYPE_ELEM_IS_SINGLE",
"BM_VERT",
"BM_EDGE",
"BM_FACE",
"BMO_OP_FLAG_UNTAN_MULTIRES",
)
vars_dict = {}
for i, v in enumerate(vars):
vars_dict[v] = (1 << i)
globals().update(vars_dict)
# reverse lookup
vars_dict_reverse = {v: k for k, v in vars_dict.items()}
# end namespace hack
blocks_py = []
for comment, b in blocks:
# magic, translate into python
b[0] = b[0].replace("static BMOpDefine ", "")
for i, l in enumerate(b):
l = l.strip()
l = l.replace("{", "(")
l = l.replace("}", ")")
if l.startswith("/*"):
l = l.replace("/*", "'''own <")
else:
l = l.replace("/*", "'''inline <")
l = l.replace("*/", ">''',")
# exec func. eg: bmo_rotate_edges_exec,
if l.startswith("bmo_") and l.endswith("_exec,"):
l = "None,"
b[i] = l
#for l in b:
# print(l)
text = "\n".join(b)
global_namespace = {
"__file__": "generated",
"__name__": "__main__",
}
global_namespace.update(vars_dict)
text_a, text_b = text.split("=", 1)
text = "result = " + text_b
exec(compile(text, "generated", 'exec'), global_namespace)
# print(global_namespace["result"])
blocks_py.append((comment, global_namespace["result"]))
# ---------------------
# Now convert into rst.
fout = open(OUT_RST, 'w', encoding="utf-8")
fw = fout.write
fw(HEADER)
for comment, b in blocks_py:
args_in = None
args_out = None
for member in b[1:]:
if type(member) == tuple:
if args_in is None:
args_in = member
elif args_out is None:
args_out = member
break
args_in_index = []
args_out_index = []
if args_in is not None:
args_in_index[:] = [i for (i, a) in enumerate(args_in) if type(a) == tuple]
if args_out is not None:
args_out_index[:] = [i for (i, a) in enumerate(args_out) if type(a) == tuple]
fw(".. function:: %s(bm, %s)\n\n" % (b[0], ", ".join([args_in[i][0] for i in args_in_index])))
# -- wash the comment
comment_washed = []
for i, l in enumerate(comment):
assert((l.strip() == "") or
(l in {"/*", " *"}) or
(l.startswith(("/* ", " * "))))
l = l[3:]
if i == 0 and not l.strip():
continue
if l.strip():
l = " " + l
comment_washed.append(l)
fw("\n".join(comment_washed))
fw("\n")
# -- done
# get the args
def get_args_wash(args, args_index, is_ret):
args_wash = []
for i in args_index:
arg = args[i]
if len(arg) == 3:
name, tp, tp_sub = arg
elif len(arg) == 2:
name, tp = arg
tp_sub = None
else:
print(arg)
assert(0)
tp_str = ""
comment_prev = ""
comment_next = ""
if i != 0:
comment_prev = args[i + 1]
if type(comment_prev) == str and comment_prev.startswith("our <"):
comment_prev = comment_next[5:-1] # strip inline <...>
else:
comment_prev = ""
if i + 1 < len(args):
comment_next = args[i + 1]
if type(comment_next) == str and comment_next.startswith("inline <"):
comment_next = comment_next[8:-1] # strip inline <...>
else:
comment_next = ""
comment = ""
if comment_prev:
comment += comment_prev.strip()
if comment_next:
comment += ("\n" if comment_prev else "") + comment_next.strip()
if tp == BMO_OP_SLOT_FLT:
tp_str = "float"
elif tp == BMO_OP_SLOT_INT:
tp_str = "int"
elif tp == BMO_OP_SLOT_BOOL:
tp_str = "bool"
elif tp == BMO_OP_SLOT_MAT:
tp_str = ":class:`mathutils.Matrix`"
elif tp == BMO_OP_SLOT_VEC:
tp_str = ":class:`mathutils.Vector`"
if not is_ret:
tp_str += " or any sequence of 3 floats"
elif tp == BMO_OP_SLOT_PTR:
tp_str = "dict"
assert(tp_sub is not None)
if tp_sub == BMO_OP_SLOT_SUBTYPE_PTR_BMESH:
tp_str = ":class:`bmesh.types.BMesh`"
elif tp_sub == BMO_OP_SLOT_SUBTYPE_PTR_SCENE:
tp_str = ":class:`bpy.types.Scene`"
elif tp_sub == BMO_OP_SLOT_SUBTYPE_PTR_OBJECT:
tp_str = ":class:`bpy.types.Object`"
elif tp_sub == BMO_OP_SLOT_SUBTYPE_PTR_MESH:
tp_str = ":class:`bpy.types.Mesh`"
else:
print("Cant find", vars_dict_reverse[tp_sub])
assert(0)
elif tp == BMO_OP_SLOT_ELEMENT_BUF:
assert(tp_sub is not None)
ls = []
if tp_sub & BM_VERT: ls.append(":class:`bmesh.types.BMVert`")
if tp_sub & BM_EDGE: ls.append(":class:`bmesh.types.BMEdge`")
if tp_sub & BM_FACE: ls.append(":class:`bmesh.types.BMFace`")
assert(ls) # must be at least one
if tp_sub & BMO_OP_SLOT_SUBTYPE_ELEM_IS_SINGLE:
tp_str = "/".join(ls)
else:
tp_str = ("list of (%s)" % ", ".join(ls))
del ls
elif tp == BMO_OP_SLOT_MAPPING:
if tp_sub & BMO_OP_SLOT_SUBTYPE_MAP_EMPTY:
tp_str = "set of vert/edge/face type"
else:
tp_str = "dict mapping vert/edge/face types to "
if tp_sub == BMO_OP_SLOT_SUBTYPE_MAP_BOOL:
tp_str += "bool"
elif tp_sub == BMO_OP_SLOT_SUBTYPE_MAP_INT:
tp_str += "int"
elif tp_sub == BMO_OP_SLOT_SUBTYPE_MAP_FLT:
tp_str += "float"
elif tp_sub == BMO_OP_SLOT_SUBTYPE_MAP_ELEM:
tp_str += ":class:`bmesh.types.BMVert`/:class:`bmesh.types.BMEdge`/:class:`bmesh.types.BMFace`"
elif tp_sub == BMO_OP_SLOT_SUBTYPE_MAP_INTERNAL:
tp_str += "unknown internal data, not compatible with python"
else:
print("Cant find", vars_dict_reverse[tp_sub])
assert(0)
else:
print("Cant find", vars_dict_reverse[tp])
assert(0)
args_wash.append((name, tp_str, comment))
return args_wash
# end get_args_wash
# all ops get this arg
fw(" :arg bm: The bmesh to operate on.\n")
fw(" :type bm: :class:`bmesh.types.BMesh`\n")
args_in_wash = get_args_wash(args_in, args_in_index, False)
args_out_wash = get_args_wash(args_out, args_out_index, True)
for (name, tp, comment) in args_in_wash:
if comment == "":
comment = "Undocumented."
fw(" :arg %s: %s\n" % (name, comment))
fw(" :type %s: %s\n" % (name, tp))
if args_out_wash:
fw(" :return:\n\n")
for (name, tp, comment) in args_out_wash:
assert(name.endswith(".out"))
name = name[:-4]
fw(" - ``%s``: %s\n\n" % (name, comment))
fw(" **type** %s\n" % tp)
fw("\n")
fw(" :rtype: dict with string keys\n")
fw("\n\n")
fout.close()
del fout
print(OUT_RST)
if __name__ == "__main__":
main()

@ -35,7 +35,7 @@ API dump in RST files
./blender.bin --background --python doc/python_api/sphinx_doc_gen.py -- --output ../python_api
For quick builds:
./blender.bin --background --python doc/python_api/sphinx_doc_gen.py -- --partial
./blender.bin --background --python doc/python_api/sphinx_doc_gen.py -- --partial bmesh.*
Sphinx: HTML generation
@ -245,6 +245,7 @@ else:
"bgl",
"blf",
"bmesh",
"bmesh.ops",
"bmesh.types",
"bmesh.utils",
"bpy.app",
@ -297,7 +298,7 @@ try:
__import__("aud")
except ImportError:
BPY_LOGGER.debug("Warning: Built without 'aud' module, docs incomplete...")
EXCLUDE_MODULES = EXCLUDE_MODULES + ("aud", )
EXCLUDE_MODULES = list(EXCLUDE_MODULES) + ["aud"]
# examples
EXAMPLES_DIR = os.path.abspath(os.path.join(SCRIPT_DIR, "examples"))
@ -315,6 +316,8 @@ RST_DIR = os.path.abspath(os.path.join(SCRIPT_DIR, "rst"))
INFO_DOCS = (
("info_quickstart.rst", "Blender/Python Quickstart: new to blender/scripting and want to get your feet wet?"),
("info_overview.rst", "Blender/Python API Overview: a more complete explanation of python integration"),
("info_tutorial_addon.rst", "Blender/Python Addon Tutorial: a step by step guide on how to write an addon from scratch"),
("info_api_reference.rst", "Blender/Python API Reference Usage: examples of how to use the API reference docs"),
("info_best_practice.rst", "Best Practice: Conventions to follow for writing good scripts"),
("info_tips_and_tricks.rst", "Tips and Tricks: Hints to help you while writing scripts for blender"),
("info_gotcha.rst", "Gotcha's: some of the problems you may come up against when writing scripts"),
@ -1251,7 +1254,7 @@ def pyrna2sphinx(basepath):
bases = list(reversed(struct.get_bases()))
# props
lines[:] = []
del lines[:]
if _BPY_STRUCT_FAKE:
descr_items = [(key, descr) for key, descr in sorted(bpy.types.Struct.__bases__[0].__dict__.items()) if not key.startswith("__")]
@ -1282,7 +1285,7 @@ def pyrna2sphinx(basepath):
fw("\n")
# funcs
lines[:] = []
del lines[:]
if _BPY_STRUCT_FAKE:
for key, descr in descr_items:
@ -1305,7 +1308,7 @@ def pyrna2sphinx(basepath):
fw(line)
fw("\n")
lines[:] = []
del lines[:]
if struct.references:
# use this otherwise it gets in the index for a normal heading.
@ -1472,6 +1475,11 @@ def write_sphinx_conf_py(basepath):
file.close()
def execfile(filepath):
global_namespace = {"__file__": filepath, "__name__": "__main__"}
exec(compile(open(filepath).read(), filepath, 'exec'), global_namespace)
def write_rst_contents(basepath):
'''
Write the rst file of the main page, needed for sphinx (index.html)
@ -1532,14 +1540,18 @@ def write_rst_contents(basepath):
"mathutils", "mathutils.geometry", "mathutils.noise",
# misc
"bgl", "blf", "gpu", "aud", "bpy_extras",
# bmesh
"bmesh", "bmesh.types", "bmesh.utils",
# bmesh, submodules are in own page
"bmesh",
)
for mod in standalone_modules:
if mod not in EXCLUDE_MODULES:
fw(" %s\n\n" % mod)
# special case, this 'bmesh.ops.rst' is extracted from C source
if "bmesh.ops" not in EXCLUDE_MODULES:
execfile(os.path.join(SCRIPT_DIR, "rst_from_bmesh_opdefines.py"))
# game engine
if "bge" not in EXCLUDE_MODULES:
fw(title_string("Game Engine Modules", "=", double=True))
@ -1701,6 +1713,8 @@ def copy_handwritten_rsts(basepath):
"bgl", # "Blender OpenGl wrapper"
"gpu", # "GPU Shader Module"
"bmesh.ops", # generated by rst_from_bmesh_opdefines.py
# includes...
"include__bmesh",
]
@ -1712,6 +1726,11 @@ def copy_handwritten_rsts(basepath):
# changelog
shutil.copy2(os.path.join(RST_DIR, "change_log.rst"), basepath)
# copy images, could be smarter but just glob for now.
for f in os.listdir(RST_DIR):
if f.endswith(".png"):
shutil.copy2(os.path.join(RST_DIR, f), basepath)
def rna2sphinx(basepath):

@ -32,9 +32,10 @@ if(WITH_BULLET)
add_subdirectory(bullet2)
endif()
if(WITH_MOD_CLOTH_ELTOPO)
add_subdirectory(eltopo)
endif()
# now only available in a branch
#if(WITH_MOD_CLOTH_ELTOPO)
# add_subdirectory(eltopo)
#endif()
if(WITH_BINRELOC)
add_subdirectory(binreloc)

3
extern/SConscript vendored

@ -8,8 +8,11 @@ SConscript(['colamd/SConscript'])
if env['WITH_BF_GAMEENGINE']:
SConscript(['recastnavigation/SConscript'])
# now only available in a branch
'''
if env['WITH_BF_ELTOPO']:
SConscript(['eltopo/SConscript'])
'''
if env['WITH_BF_BULLET']:
SConscript(['bullet2/src/SConscript'])

@ -93,7 +93,7 @@ void* dlGetProcAddress (const GLubyte* name)
#include <string.h>
#include <AvailabilityMacros.h>
#ifdef MAC_OS_X_VERSION_10_3
#if MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_3
#include <dlfcn.h>
@ -142,7 +142,7 @@ void* NSGLGetProcAddress (const GLubyte *name)
return NULL;
#endif
}
#endif /* MAC_OS_X_VERSION_10_3 */
#endif /* MAC_OS_X_VERSION_MIN_REQUIRED */
#endif /* __APPLE__ */
/*

@ -102,6 +102,8 @@ set(SRC
libmv/multiview/conditioning.h
libmv/multiview/euclidean_resection.h
libmv/multiview/fundamental.h
libmv/multiview/homography.h
libmv/multiview/homography_parameterization.h
libmv/multiview/nviewtriangulation.h
libmv/multiview/projection.h
libmv/multiview/resection.h
@ -131,6 +133,7 @@ set(SRC
libmv/tracking/pyramid_region_tracker.h
libmv/tracking/region_tracker.h
libmv/tracking/retrack_region_tracker.h
libmv/tracking/track_region.h
libmv/tracking/trklt_region_tracker.h
third_party/fast/fast.h

@ -192,7 +192,7 @@ static void imageToFloatBuf(const libmv::FloatImage *image, int channels, float
}
#if defined(DUMP_FAILURE) || defined (DUMP_ALWAYS)
void savePNGImage(png_bytep *row_pointers, int width, int height, int depth, int color_type, char *file_name)
static void savePNGImage(png_bytep *row_pointers, int width, int height, int depth, int color_type, char *file_name)
{
png_infop info_ptr;
png_structp png_ptr;
@ -437,6 +437,9 @@ int libmv_trackRegion(const struct libmv_trackRegionOptions *options,
#endif
saveImage("old_patch", old_patch, x1[4], y1[4]);
saveImage("new_patch", new_patch, x2[4], y2[4]);
if (options->image1_mask)
saveImage("mask", image1_mask, x2[4], y2[4]);
}
#endif
@ -897,7 +900,7 @@ void libmv_CameraIntrinsicsUpdate(struct libmv_CameraIntrinsics *libmvIntrinsics
intrinsics->SetFocalLength(focal_length, focal_length);
if (intrinsics->principal_point_x() != principal_x || intrinsics->principal_point_y() != principal_y)
intrinsics->SetFocalLength(focal_length, focal_length);
intrinsics->SetPrincipalPoint(principal_x, principal_y);
if (intrinsics->k1() != k1 || intrinsics->k2() != k2 || intrinsics->k3() != k3)
intrinsics->SetRadialDistortion(k1, k2, k3);

@ -57,7 +57,7 @@ struct EuclideanResectCostFunction {
EuclideanResectCostFunction(const vector<Marker> &markers,
const EuclideanReconstruction &reconstruction,
const Mat3 initial_R)
const Mat3 &initial_R)
: markers(markers),
reconstruction(reconstruction),
initial_R(initial_R) {}

2
extern/xdnd/xdnd.c vendored

@ -347,7 +347,7 @@ void xdnd_set_dnd_aware (DndClass * dnd, Window window, Atom * typelist)
&nchildren_return);
if (children_return)
XFree (children_return);
if (r)
if (r && parent != root_return)
xdnd_set_dnd_aware (dnd, parent, typelist);
}

@ -65,6 +65,10 @@ if(WITH_CYCLES)
add_subdirectory(cycles)
endif()
if(WITH_INTERNATIONAL)
add_subdirectory(locale)
endif()
# only windows needs utf16 converter
if(WIN32)
add_subdirectory(utfconv)

@ -30,6 +30,9 @@ if env['WITH_BF_CYCLES']:
if env['WITH_BF_BOOLEAN']:
SConscript(['bsp/SConscript'])
if env['WITH_BF_INTERNATIONAL']:
SConscript(['locale/SConscript'])
if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'win64-mingw', 'linuxcross', 'win64-vc'):
SConscript(['utfconv/SConscript'])

@ -64,8 +64,8 @@ public:
* Writes a reader to a writer.
* \param reader The reader to read from.
* \param writer The writer to write to.
* \param length How many samples should be transfered.
* \param buffersize How many samples should be transfered at once.
* \param length How many samples should be transferred.
* \param buffersize How many samples should be transferred at once.
*/
static void writeReader(boost::shared_ptr<AUD_IReader> reader, boost::shared_ptr<AUD_IWriter> writer, unsigned int length, unsigned int buffersize);
@ -73,8 +73,8 @@ public:
* Writes a reader to several writers.
* \param reader The reader to read from.
* \param writers The writers to write to.
* \param length How many samples should be transfered.
* \param buffersize How many samples should be transfered at once.
* \param length How many samples should be transferred.
* \param buffersize How many samples should be transferred at once.
*/
static void writeReader(boost::shared_ptr<AUD_IReader> reader, std::vector<boost::shared_ptr<AUD_IWriter> >& writers, unsigned int length, unsigned int buffersize);
};

@ -81,7 +81,7 @@ void AUD_LinearResampleReader::read(int& length, bool& eos, sample_t* buffer)
int samplesize = AUD_SAMPLE_SIZE(specs);
int size = length;
float factor = m_rate / m_reader->getSpecs().rate;
float spos;
float spos = 0.0f;
sample_t low, high;
eos = false;

@ -205,7 +205,7 @@ static void Carve_getIntersectedOperandMeshes(std::vector<MeshSet<3>::mesh_t*> &
std::vector<MeshSet<3>::mesh_t*>::iterator it = meshes.begin();
std::vector< RTreeNode<3, Face<3> *> *> meshRTree;
while(it != meshes.end()) {
while (it != meshes.end()) {
MeshSet<3>::mesh_t *mesh = *it;
bool isAdded = false;
@ -279,7 +279,7 @@ static MeshSet<3> *Carve_unionIntersectingMeshes(MeshSet<3> *poly,
return poly;
}
while(orig_meshes.size()) {
while (orig_meshes.size()) {
MeshSet<3> *right = Carve_getIntersectedOperand(orig_meshes, otherAABB);
if (!right) {

@ -46,13 +46,13 @@ class CTR_HashedPtr
void *m_valptr;
public:
CTR_HashedPtr(void *val) : m_valptr(val) {
};
}
unsigned int hash() const {
return CTR_Hash(m_valptr);
};
}
inline friend bool operator ==(const CTR_HashedPtr & rhs, const CTR_HashedPtr & lhs) {
return rhs.m_valptr == lhs.m_valptr;
};
}
void *getValue() const {
return m_valptr;
}

@ -21,8 +21,11 @@ elseif(CMAKE_COMPILER_IS_GNUCC)
endif()
# for OSL
set(RTTI_DISABLE_FLAGS "-fno-rtti -DBOOST_NO_RTTI -DBOOST_NO_TYPEID")
# set(RTTI_DISABLE_FLAGS "/GR- -DBOOST_NO_RTTI -DBOOST_NO_TYPEID")
if(WIN32 AND MSVC)
set(RTTI_DISABLE_FLAGS "/GR- -DBOOST_NO_RTTI -DBOOST_NO_TYPEID")
elseif(CMAKE_COMPILER_IS_GNUCC OR (CMAKE_C_COMPILER_ID MATCHES "Clang"))
set(RTTI_DISABLE_FLAGS "-fno-rtti -DBOOST_NO_RTTI -DBOOST_NO_TYPEID")
endif()
# Definitions and Includes
@ -44,10 +47,6 @@ if(WITH_CYCLES_OSL)
include_directories(${OSL_INCLUDES})
endif()
if(WITH_CYCLES_PARTIO)
add_definitions(-DWITH_PARTIO)
endif()
if(WITH_CYCLES_CUDA_BINARIES)
add_definitions(-DWITH_CUDA_BINARIES)
endif()
@ -69,7 +68,10 @@ if(WITH_CYCLES_BLENDER)
add_subdirectory(blender)
endif()
add_subdirectory(app)
if(WITH_CYCLES_TEST)
add_subdirectory(app)
endif()
add_subdirectory(bvh)
add_subdirectory(device)
add_subdirectory(doc)

@ -23,6 +23,10 @@ defs.append('WITH_OPENCL')
defs.append('WITH_MULTI')
defs.append('WITH_CUDA')
if env['WITH_BF_CYCLES_OSL']:
defs.append('WITH_OSL')
incs.append(cycles['BF_OSL_INC'])
if env['WITH_BF_CYCLES_CUDA_BINARIES']:
defs.append('WITH_CUDA_BINARIES')
@ -32,7 +36,8 @@ incs.extend('#source/blender/blenloader ../../source/blender/makesrna/intern'.sp
incs.extend('#extern/glew/include #intern/mikktspace'.split())
incs.append(cycles['BF_OIIO_INC'])
incs.append(cycles['BF_BOOST_INC'])
incs.append(cycles['BF_PYTHON_INC'])
incs.append(cycles['BF_OPENEXR_INC'].split())
incs.extend(cycles['BF_PYTHON_INC'].split())
if env['OURPLATFORM'] in ('win32-vc', 'win64-vc'):
cxxflags.append('-D_CRT_SECURE_NO_WARNINGS /fp:fast /EHsc'.split())
@ -44,7 +49,7 @@ if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc', '
# optimized kernel
if env['WITH_BF_RAYOPTIMIZATION']:
optim_cxxflags = []
optim_cxxflags = Split(env['CXXFLAGS'])
if env['OURPLATFORM'] == 'win32-vc':
optim_cxxflags.append('/arch:SSE2 -D_CRT_SECURE_NO_WARNINGS /fp:fast /EHsc'.split())
@ -62,6 +67,12 @@ if env['WITH_BF_RAYOPTIMIZATION']:
cycles.BlenderLib('bf_intern_cycles', sources, incs, defs, libtype=['intern'], priority=[0], cxx_compileflags=cxxflags)
if env['WITH_BF_CYCLES_OSL']:
oso_files = SConscript(['kernel/shaders/SConscript'])
cycles.Depends("kernel/osl/osl_shader.o", oso_files)
SConscript(['kernel/osl/SConscript'])
# cuda kernel binaries
if env['WITH_BF_CYCLES_CUDA_BINARIES']:
kernel_binaries = SConscript(['kernel/SConscript'])

@ -35,10 +35,6 @@ if(WITH_CYCLES_OSL)
list(APPEND LIBRARIES cycles_kernel_osl ${OSL_LIBRARIES})
endif()
if(WITH_CYCLES_PARTIO)
list(APPEND LIBRARIES ${PARTIO_LIBRARIES})
endif()
include_directories(${INC})
include_directories(SYSTEM ${INC_SYS})

@ -326,7 +326,7 @@ using namespace ccl;
int main(int argc, const char **argv)
{
path_init("../build/bin/2.59/scripts/addons/cycles/");
path_init();
options_parse(argc, argv);

@ -23,12 +23,12 @@
extern "C" {
#endif
/* returns a list of devices for selection, array is name NULL pointer
/* returns a list of devices for selection, array is empty identifier
* terminated and must not be freed */
typedef struct CCLDeviceInfo {
const char *identifier;
const char *name;
char identifier[128];
char name[512];
int value;
} CCLDeviceInfo;

@ -48,7 +48,11 @@ class CyclesRender(bpy.types.RenderEngine):
# final render
def update(self, data, scene):
engine.create(self, data, scene)
if not self.session:
engine.create(self, data, scene)
else:
engine.reset(self, data, scene)
engine.update(self, data, scene)
def render(self, scene):

@ -61,6 +61,13 @@ def render(engine):
_cycles.render(engine.session)
def reset(engine, data, scene):
import _cycles
data = data.as_pointer()
scene = scene.as_pointer()
_cycles.reset(engine.session, data, scene)
def update(engine, data, scene):
import _cycles
_cycles.sync(engine.session)

@ -57,7 +57,7 @@ aperture_types = (
panorama_types = (
('EQUIRECTANGULAR', "Equirectangular", "Render the scene with a spherical camera, also known as Lat Long panorama"),
('FISHEYE_EQUIDISTANT', "Fisheye Equidistant", "Ignore the sensor dimensions"),
('FISHEYE_EQUISOLID', "Fisheye Equisolid", "Similar to most fisheye modern lens, take sensor dimensions into consideration. For fulldomes use it with a square sensor ratio",
('FISHEYE_EQUIDISTANT', "Fisheye Equidistant", "Ideal for fulldomes, ignore the sensor dimensions"),
('FISHEYE_EQUISOLID', "Fisheye Equisolid",
"Similar to most fisheye modern lens, takes sensor dimensions into consideration"),
)

@ -79,12 +79,13 @@ def update_script_node(node, report):
if script.is_in_memory or script.is_dirty or script.is_modified or not os.path.exists(osl_path):
# write text datablock contents to temporary file
osl_file = tempfile.NamedTemporaryFile(mode='w', suffix=".osl", delete=True)
osl_file = tempfile.NamedTemporaryFile(mode='w', suffix=".osl", delete=False)
osl_file.write(script.as_string())
osl_file.flush()
osl_file.close()
ok, oso_path = osl_compile(osl_file.name, report)
oso_file_remove = False
osl_file.close()
os.remove(osl_file.name)
else:
# compile text datablock from disk directly
ok, oso_path = osl_compile(osl_path, report)

@ -216,6 +216,10 @@ class CyclesRender_PT_performance(CyclesButtonsPanel, Panel):
sub.label(text="Viewport:")
sub.prop(cscene, "preview_start_resolution")
sub = col.column(align=True)
sub.label(text="Final Render:")
sub.prop(rd, "use_persistent_data", text="Persistent Images")
class CyclesRender_PT_layers(CyclesButtonsPanel, Panel):
bl_label = "Layers"
@ -953,7 +957,7 @@ def draw_device(self, context):
elif device_type == 'OPENCL' and cscene.feature_set == 'EXPERIMENTAL':
layout.prop(cscene, "device")
if engine.with_osl() and (cscene.device == 'CPU' or device_type == 'None'):
if engine.with_osl() and (cscene.device == 'CPU' or device_type == 'NONE'):
layout.prop(cscene, "shading_system")
@ -1022,6 +1026,8 @@ def get_panels():
bpy.types.TEXTURE_PT_voxeldata,
bpy.types.TEXTURE_PT_pointdensity,
bpy.types.TEXTURE_PT_pointdensity_turbulence,
bpy.types.TEXTURE_PT_mapping,
bpy.types.TEXTURE_PT_influence,
bpy.types.PARTICLE_PT_context_particles,
bpy.types.PARTICLE_PT_emission,
bpy.types.PARTICLE_PT_hair_dynamics,

@ -56,15 +56,16 @@ struct BlenderCamera {
float sensor_width;
float sensor_height;
float border_left;
float border_right;
float border_bottom;
float border_top;
int full_width;
int full_height;
BoundBox2D border;
BoundBox2D pano_viewplane;
Transform matrix;
};
static void blender_camera_init(BlenderCamera *bcam)
static void blender_camera_init(BlenderCamera *bcam, BL::Scene b_scene)
{
memset(bcam, 0, sizeof(BlenderCamera));
@ -75,8 +76,16 @@ static void blender_camera_init(BlenderCamera *bcam)
bcam->sensor_height = 18.0f;
bcam->sensor_fit = BlenderCamera::AUTO;
bcam->shuttertime = 1.0f;
bcam->border_right = 1.0f;
bcam->border_top = 1.0f;
bcam->border.right = 1.0f;
bcam->border.top = 1.0f;
bcam->pano_viewplane.right = 1.0f;
bcam->pano_viewplane.top = 1.0f;
/* render resolution */
BL::RenderSettings r = b_scene.render();
bcam->full_width = (int)(r.resolution_x()*r.resolution_percentage()/100);
bcam->full_height = (int)(r.resolution_y()*r.resolution_percentage()/100);
}
static float blender_camera_focal_distance(BL::Object b_ob, BL::Camera b_camera)
@ -199,7 +208,7 @@ static Transform blender_camera_matrix(const Transform& tfm, CameraType type)
}
static void blender_camera_viewplane(BlenderCamera *bcam, int width, int height,
float *left, float *right, float *bottom, float *top, float *aspectratio, float *sensor_size)
BoundBox2D *viewplane, float *aspectratio, float *sensor_size)
{
/* dimensions */
float xratio = width*bcam->pixelaspect.x;
@ -207,10 +216,9 @@ static void blender_camera_viewplane(BlenderCamera *bcam, int width, int height,
/* compute x/y aspect and ratio */
float xaspect, yaspect;
/* sensor fitting */
bool horizontal_fit;
/* sensor fitting */
if(bcam->sensor_fit == BlenderCamera::AUTO) {
horizontal_fit = (xratio > yratio);
*sensor_size = bcam->sensor_width;
@ -244,32 +252,26 @@ static void blender_camera_viewplane(BlenderCamera *bcam, int width, int height,
if(bcam->type == CAMERA_PANORAMA) {
/* set viewplane */
*left = 0.0f;
*right = 1.0f;
*bottom = 0.0f;
*top = 1.0f;
*viewplane = bcam->pano_viewplane;
}
else {
/* set viewplane */
*left = -xaspect;
*right = xaspect;
*bottom = -yaspect;
*top = yaspect;
viewplane->left = -xaspect;
viewplane->right = xaspect;
viewplane->bottom = -yaspect;
viewplane->top = yaspect;
/* zoom for 3d camera view */
*left *= bcam->zoom;
*right *= bcam->zoom;
*bottom *= bcam->zoom;
*top *= bcam->zoom;
*viewplane = (*viewplane) * bcam->zoom;
/* modify viewplane with camera shift and 3d camera view offset */
float dx = 2.0f*(*aspectratio*bcam->shift.x + bcam->offset.x*xaspect*2.0f);
float dy = 2.0f*(*aspectratio*bcam->shift.y + bcam->offset.y*yaspect*2.0f);
*left += dx;
*right += dx;
*bottom += dy;
*top += dy;
viewplane->left += dx;
viewplane->right += dx;
viewplane->bottom += dy;
viewplane->top += dy;
}
}
@ -281,11 +283,37 @@ static void blender_camera_sync(Camera *cam, BlenderCamera *bcam, int width, int
/* viewplane */
blender_camera_viewplane(bcam, width, height,
&cam->left, &cam->right, &cam->bottom, &cam->top, &aspectratio, &sensor_size);
&cam->viewplane, &aspectratio, &sensor_size);
/* sensor */
cam->sensorwidth = bcam->sensor_width;
cam->sensorheight = bcam->sensor_height;
/* panorama sensor */
if (bcam->type == CAMERA_PANORAMA && bcam->panorama_type == PANORAMA_FISHEYE_EQUISOLID) {
float fit_xratio = bcam->full_width*bcam->pixelaspect.x;
float fit_yratio = bcam->full_height*bcam->pixelaspect.y;
bool horizontal_fit;
float sensor_size;
if(bcam->sensor_fit == BlenderCamera::AUTO) {
horizontal_fit = (fit_xratio > fit_yratio);
sensor_size = bcam->sensor_width;
}
else if(bcam->sensor_fit == BlenderCamera::HORIZONTAL) {
horizontal_fit = true;
sensor_size = bcam->sensor_width;
}
else { /* vertical */
horizontal_fit = false;
sensor_size = bcam->sensor_height;
}
if(horizontal_fit) {
cam->sensorwidth = sensor_size;
cam->sensorheight = sensor_size * fit_yratio / fit_xratio;
}
else {
cam->sensorwidth = sensor_size * fit_xratio / fit_yratio;
cam->sensorheight = sensor_size;
}
}
/* clipping distances */
cam->nearclip = bcam->nearclip;
@ -314,10 +342,7 @@ static void blender_camera_sync(Camera *cam, BlenderCamera *bcam, int width, int
cam->shuttertime = bcam->shuttertime;
/* border */
cam->border_left = bcam->border_left;
cam->border_right = bcam->border_right;
cam->border_bottom = bcam->border_bottom;
cam->border_top = bcam->border_top;
cam->border = bcam->border;
/* set update flag */
if(cam->modified(prevcam))
@ -329,7 +354,7 @@ static void blender_camera_sync(Camera *cam, BlenderCamera *bcam, int width, int
void BlenderSync::sync_camera(BL::Object b_override, int width, int height)
{
BlenderCamera bcam;
blender_camera_init(&bcam);
blender_camera_init(&bcam, b_scene);
/* pixel aspect */
BL::RenderSettings r = b_scene.render();
@ -340,10 +365,10 @@ void BlenderSync::sync_camera(BL::Object b_override, int width, int height)
/* border */
if(r.use_border()) {
bcam.border_left = r.border_min_x();
bcam.border_right = r.border_max_x();
bcam.border_bottom = r.border_min_y();
bcam.border_top = r.border_max_y();
bcam.border.left = r.border_min_x();
bcam.border.right = r.border_max_x();
bcam.border.bottom = r.border_min_y();
bcam.border.top = r.border_max_y();
}
/* camera object */
@ -381,6 +406,9 @@ void BlenderSync::sync_camera_motion(BL::Object b_ob, int motion)
/* Sync 3D View Camera */
static void blender_camera_view_subset(BL::Scene b_scene, BL::Object b_ob, BL::SpaceView3D b_v3d,
BL::RegionView3D b_rv3d, int width, int height, BoundBox2D *view_box, BoundBox2D *cam_box);
static void blender_camera_from_view(BlenderCamera *bcam, BL::Scene b_scene, BL::SpaceView3D b_v3d, BL::RegionView3D b_rv3d, int width, int height, bool skip_panorama = false)
{
/* 3d view parameters */
@ -396,14 +424,25 @@ static void blender_camera_from_view(BlenderCamera *bcam, BL::Scene b_scene, BL:
if(b_ob) {
blender_camera_from_object(bcam, b_ob, skip_panorama);
/* magic zoom formula */
bcam->zoom = (float)b_rv3d.view_camera_zoom();
bcam->zoom = (1.41421f + bcam->zoom/50.0f);
bcam->zoom *= bcam->zoom;
bcam->zoom = 2.0f/bcam->zoom;
if(!skip_panorama && bcam->type == CAMERA_PANORAMA) {
/* in panorama camera view, we map viewplane to camera border */
BoundBox2D view_box, cam_box;
/* offset */
bcam->offset = get_float2(b_rv3d.view_camera_offset());
blender_camera_view_subset(b_scene, b_ob, b_v3d, b_rv3d, width, height,
&view_box, &cam_box);
bcam->pano_viewplane = view_box.make_relative_to(cam_box);
}
else {
/* magic zoom formula */
bcam->zoom = (float)b_rv3d.view_camera_zoom();
bcam->zoom = (1.41421f + bcam->zoom/50.0f);
bcam->zoom *= bcam->zoom;
bcam->zoom = 2.0f/bcam->zoom;
/* offset */
bcam->offset = get_float2(b_rv3d.view_camera_offset());
}
}
}
else if(b_rv3d.view_perspective() == BL::RegionView3D::view_perspective_ORTHO) {
@ -427,6 +466,34 @@ static void blender_camera_from_view(BlenderCamera *bcam, BL::Scene b_scene, BL:
bcam->matrix = transform_inverse(get_transform(b_rv3d.view_matrix()));
}
static void blender_camera_view_subset(BL::Scene b_scene, BL::Object b_ob, BL::SpaceView3D b_v3d,
BL::RegionView3D b_rv3d, int width, int height, BoundBox2D *view_box, BoundBox2D *cam_box)
{
// BL::RenderSettings r = b_scene.render(); /* UNUSED */
BoundBox2D cam, view;
float view_aspect, cam_aspect, sensor_size;
/* get viewport viewplane */
BlenderCamera view_bcam;
blender_camera_init(&view_bcam, b_scene);
blender_camera_from_view(&view_bcam, b_scene, b_v3d, b_rv3d, width, height, true);
blender_camera_viewplane(&view_bcam, width, height,
&view, &view_aspect, &sensor_size);
/* get camera viewplane */
BlenderCamera cam_bcam;
blender_camera_init(&cam_bcam, b_scene);
blender_camera_from_object(&cam_bcam, b_ob, true);
blender_camera_viewplane(&cam_bcam, cam_bcam.full_width, cam_bcam.full_height,
&cam, &cam_aspect, &sensor_size);
/* return */
*view_box = view * (1.0f/view_aspect);
*cam_box = cam * (1.0f/cam_aspect);
}
static void blender_camera_border(BlenderCamera *bcam, BL::Scene b_scene, BL::SpaceView3D b_v3d,
BL::RegionView3D b_rv3d, int width, int height)
{
@ -442,10 +509,10 @@ static void blender_camera_border(BlenderCamera *bcam, BL::Scene b_scene, BL::Sp
* assume viewport has got correctly clamped border already
*/
if(b_v3d.use_render_border()) {
bcam->border_left = b_v3d.render_border_min_x();
bcam->border_right = b_v3d.render_border_max_x();
bcam->border_bottom = b_v3d.render_border_min_y();
bcam->border_top = b_v3d.render_border_max_y();
bcam->border.left = b_v3d.render_border_min_x();
bcam->border.right = b_v3d.render_border_max_x();
bcam->border.bottom = b_v3d.render_border_min_y();
bcam->border.top = b_v3d.render_border_max_y();
return;
}
@ -458,66 +525,26 @@ static void blender_camera_border(BlenderCamera *bcam, BL::Scene b_scene, BL::Sp
if(!b_ob)
return;
bcam->border_left = r.border_min_x();
bcam->border_right = r.border_max_x();
bcam->border_bottom = r.border_min_y();
bcam->border_top = r.border_max_y();
bcam->border.left = r.border_min_x();
bcam->border.right = r.border_max_x();
bcam->border.bottom = r.border_min_y();
bcam->border.top = r.border_max_y();
float cam_left, cam_right, cam_bottom, cam_top;
float view_left, view_right, view_bottom, view_top;
float view_aspect, cam_aspect, sensor_size;
/* determine camera viewport subset */
BoundBox2D view_box, cam_box;
/* get viewport viewplane */
BlenderCamera view_bcam;
blender_camera_init(&view_bcam);
blender_camera_from_view(&view_bcam, b_scene, b_v3d, b_rv3d, width, height, true);
blender_camera_viewplane(&view_bcam, width, height,
&view_left, &view_right, &view_bottom, &view_top, &view_aspect, &sensor_size);
view_left /= view_aspect;
view_right /= view_aspect;
view_bottom /= view_aspect;
view_top /= view_aspect;
/* get camera viewplane */
BlenderCamera cam_bcam;
blender_camera_init(&cam_bcam);
blender_camera_from_object(&cam_bcam, b_ob, true);
width = (int)(r.resolution_x()*r.resolution_percentage()/100);
height = (int)(r.resolution_y()*r.resolution_percentage()/100);
blender_camera_viewplane(&cam_bcam, width, height,
&cam_left, &cam_right, &cam_bottom, &cam_top, &cam_aspect, &sensor_size);
cam_left /= cam_aspect;
cam_right /= cam_aspect;
cam_bottom /= cam_aspect;
cam_top /= cam_aspect;
blender_camera_view_subset(b_scene, b_ob, b_v3d, b_rv3d, width, height,
&view_box, &cam_box);
/* determine viewport subset matching camera border */
float tmp_left = ((cam_left - view_left) / (view_right - view_left));
float tmp_right = ((cam_right - view_left) / (view_right - view_left));
float tmp_bottom = ((cam_bottom - view_bottom) / (view_top - view_bottom));
float tmp_top = ((cam_top - view_bottom) / (view_top - view_bottom));
bcam->border_left = tmp_left + bcam->border_left*(tmp_right - tmp_left);
bcam->border_right = tmp_left + bcam->border_right*(tmp_right - tmp_left);
bcam->border_bottom = tmp_bottom + bcam->border_bottom*(tmp_top - tmp_bottom);
bcam->border_top = tmp_bottom + bcam->border_top*(tmp_top - tmp_bottom);
/* clamp */
bcam->border_left = clamp(bcam->border_left, 0.0f, 1.0f);
bcam->border_right = clamp(bcam->border_right, 0.0f, 1.0f);
bcam->border_bottom = clamp(bcam->border_bottom, 0.0f, 1.0f);
bcam->border_top = clamp(bcam->border_top, 0.0f, 1.0f);
cam_box = cam_box.make_relative_to(view_box);
bcam->border = cam_box.subset(bcam->border).clamp();
}
void BlenderSync::sync_view(BL::SpaceView3D b_v3d, BL::RegionView3D b_rv3d, int width, int height)
{
BlenderCamera bcam;
blender_camera_init(&bcam);
blender_camera_init(&bcam, b_scene);
blender_camera_from_view(&bcam, b_scene, b_v3d, b_rv3d, width, height);
blender_camera_border(&bcam, b_scene, b_v3d, b_rv3d, width, height);
@ -539,10 +566,10 @@ BufferParams BlenderSync::get_buffer_params(BL::Scene b_scene, BL::SpaceView3D b
if(use_border) {
/* border render */
params.full_x = cam->border_left*width;
params.full_y = cam->border_bottom*height;
params.width = (int)(cam->border_right*width) - params.full_x;
params.height = (int)(cam->border_top*height) - params.full_y;
params.full_x = cam->border.left*width;
params.full_y = cam->border.bottom*height;
params.width = (int)(cam->border.right*width) - params.full_x;
params.height = (int)(cam->border.top*height) - params.full_y;
/* survive in case border goes out of view or becomes too small */
params.width = max(params.width, 1);

@ -116,7 +116,7 @@ static void mikk_set_tangent_space(const SMikkTSpaceContext *context, const floa
userdata->tangent[face*4 + vert] = make_float4(T[0], T[1], T[2], sign);
}
static void mikk_compute_tangents(BL::Mesh b_mesh, BL::MeshTextureFaceLayer b_layer, Mesh *mesh, vector<int>& nverts)
static void mikk_compute_tangents(BL::Mesh b_mesh, BL::MeshTextureFaceLayer b_layer, Mesh *mesh, vector<int>& nverts, bool need_sign, bool active_render)
{
/* setup userdata */
MikkUserData userdata(b_mesh, b_layer, nverts.size());
@ -140,22 +140,57 @@ static void mikk_compute_tangents(BL::Mesh b_mesh, BL::MeshTextureFaceLayer b_la
/* compute tangents */
genTangSpaceDefault(&context);
/* create attribute */
/* todo: create float4 attribute for sign */
Attribute *attr = mesh->attributes.add(ATTR_STD_TANGENT, ustring("tangent"));
/* create tangent attributes */
Attribute *attr;
ustring name = ustring((string(b_layer.name().c_str()) + ".tangent").c_str());
if(active_render)
attr = mesh->attributes.add(ATTR_STD_UV_TANGENT, name);
else
attr = mesh->attributes.add(name, TypeDesc::TypeVector, Attribute::CORNER);
float3 *tangent = attr->data_float3();
for (int i = 0; i < nverts.size(); i++) {
/* create bitangent sign attribute */
float *tangent_sign = NULL;
if(need_sign) {
Attribute *attr_sign;
ustring name_sign = ustring((string(b_layer.name().c_str()) + ".tangent_sign").c_str());
if(active_render)
attr_sign = mesh->attributes.add(ATTR_STD_UV_TANGENT_SIGN, name_sign);
else
attr_sign = mesh->attributes.add(name_sign, TypeDesc::TypeFloat, Attribute::CORNER);
tangent_sign = attr_sign->data_float();
}
for(int i = 0; i < nverts.size(); i++) {
tangent[0] = float4_to_float3(userdata.tangent[i*4 + 0]);
tangent[1] = float4_to_float3(userdata.tangent[i*4 + 1]);
tangent[2] = float4_to_float3(userdata.tangent[i*4 + 2]);
tangent += 3;
if(tangent_sign) {
tangent_sign[0] = userdata.tangent[i*4 + 0].w;
tangent_sign[1] = userdata.tangent[i*4 + 1].w;
tangent_sign[2] = userdata.tangent[i*4 + 2].w;
tangent_sign += 3;
}
if(nverts[i] == 4) {
tangent[0] = float4_to_float3(userdata.tangent[i*4 + 0]);
tangent[1] = float4_to_float3(userdata.tangent[i*4 + 2]);
tangent[2] = float4_to_float3(userdata.tangent[i*4 + 3]);
tangent += 3;
if(tangent_sign) {
tangent_sign[0] = userdata.tangent[i*4 + 0].w;
tangent_sign[1] = userdata.tangent[i*4 + 2].w;
tangent_sign[2] = userdata.tangent[i*4 + 3].w;
tangent_sign += 3;
}
}
}
}
@ -233,48 +268,49 @@ static void create_mesh(Scene *scene, Mesh *mesh, BL::Mesh b_mesh, const vector<
BL::Mesh::tessface_uv_textures_iterator l;
for(b_mesh.tessface_uv_textures.begin(l); l != b_mesh.tessface_uv_textures.end(); ++l) {
AttributeStandard std = (l->active_render())? ATTR_STD_UV: ATTR_STD_NONE;
bool active_render = l->active_render();
AttributeStandard std = (active_render)? ATTR_STD_UV: ATTR_STD_NONE;
ustring name = ustring(l->name().c_str());
if(!(mesh->need_attribute(scene, name) || mesh->need_attribute(scene, std)))
continue;
/* UV map */
if(mesh->need_attribute(scene, name) || mesh->need_attribute(scene, std)) {
Attribute *attr;
Attribute *attr;
if(active_render)
attr = mesh->attributes.add(std, name);
else
attr = mesh->attributes.add(name, TypeDesc::TypePoint, Attribute::CORNER);
if(l->active_render())
attr = mesh->attributes.add(std, name);
else
attr = mesh->attributes.add(name, TypeDesc::TypePoint, Attribute::CORNER);
BL::MeshTextureFaceLayer::data_iterator t;
float3 *fdata = attr->data_float3();
size_t i = 0;
BL::MeshTextureFaceLayer::data_iterator t;
float3 *fdata = attr->data_float3();
size_t i = 0;
for(l->data.begin(t); t != l->data.end(); ++t, ++i) {
fdata[0] = get_float3(t->uv1());
fdata[1] = get_float3(t->uv2());
fdata[2] = get_float3(t->uv3());
fdata += 3;
if(nverts[i] == 4) {
for(l->data.begin(t); t != l->data.end(); ++t, ++i) {
fdata[0] = get_float3(t->uv1());
fdata[1] = get_float3(t->uv3());
fdata[2] = get_float3(t->uv4());
fdata[1] = get_float3(t->uv2());
fdata[2] = get_float3(t->uv3());
fdata += 3;
if(nverts[i] == 4) {
fdata[0] = get_float3(t->uv1());
fdata[1] = get_float3(t->uv3());
fdata[2] = get_float3(t->uv4());
fdata += 3;
}
}
}
}
}
/* create texcoord-based tangent attributes */
if(mesh->need_attribute(scene, ATTR_STD_TANGENT)) {
BL::Mesh::tessface_uv_textures_iterator l;
/* UV tangent */
std = (active_render)? ATTR_STD_UV_TANGENT: ATTR_STD_NONE;
name = ustring((string(l->name().c_str()) + ".tangent").c_str());
for(b_mesh.tessface_uv_textures.begin(l); l != b_mesh.tessface_uv_textures.end(); ++l) {
if(!l->active_render())
continue;
if(mesh->need_attribute(scene, name) || mesh->need_attribute(scene, std)) {
std = (active_render)? ATTR_STD_UV_TANGENT_SIGN: ATTR_STD_NONE;
name = ustring((string(l->name().c_str()) + ".tangent_sign").c_str());
bool need_sign = (mesh->need_attribute(scene, name) || mesh->need_attribute(scene, std));
mikk_compute_tangents(b_mesh, *l, mesh, nverts);
mikk_compute_tangents(b_mesh, *l, mesh, nverts, need_sign, active_render);
}
}
}

@ -86,11 +86,11 @@ static uint object_ray_visibility(BL::Object b_ob)
/* Light */
void BlenderSync::sync_light(BL::Object b_parent, int b_index, BL::Object b_ob, Transform& tfm)
void BlenderSync::sync_light(BL::Object b_parent, int persistent_id[OBJECT_PERSISTENT_ID_SIZE], BL::Object b_ob, Transform& tfm)
{
/* test if we need to sync */
Light *light;
ObjectKey key(b_parent, b_index, b_ob);
ObjectKey key(b_parent, persistent_id, b_ob);
if(!light_map.sync(&light, b_ob, b_parent, key))
return;
@ -196,23 +196,24 @@ void BlenderSync::sync_background_light()
/* Object */
void BlenderSync::sync_object(BL::Object b_parent, int b_index, BL::DupliObject b_dupli_ob, Transform& tfm, uint layer_flag, int motion, int particle_id)
Object *BlenderSync::sync_object(BL::Object b_parent, int persistent_id[OBJECT_PERSISTENT_ID_SIZE], BL::DupliObject b_dupli_ob, Transform& tfm, uint layer_flag, int motion)
{
BL::Object b_ob = (b_dupli_ob ? b_dupli_ob.object() : b_parent);
/* light is handled separately */
if(object_is_light(b_ob)) {
if(!motion)
sync_light(b_parent, b_index, b_ob, tfm);
return;
sync_light(b_parent, persistent_id, b_ob, tfm);
return NULL;
}
/* only interested in object that we can create meshes from */
if(!object_is_mesh(b_ob))
return;
return NULL;
/* key to lookup object */
ObjectKey key(b_parent, b_index, b_ob);
ObjectKey key(b_parent, persistent_id, b_ob);
Object *object;
/* motion vector case */
@ -234,7 +235,7 @@ void BlenderSync::sync_object(BL::Object b_parent, int b_index, BL::DupliObject
sync_mesh_motion(b_ob, object->mesh, motion);
}
return;
return object;
}
/* test if we need to sync */
@ -248,13 +249,15 @@ void BlenderSync::sync_object(BL::Object b_parent, int b_index, BL::DupliObject
/* mesh sync */
object->mesh = sync_mesh(b_ob, object_updated);
/* sspecial case not tracked by object update flags */
if(use_holdout != object->use_holdout) {
object->use_holdout = use_holdout;
scene->object_manager->tag_update(scene);
object_updated = true;
}
/* object sync */
/* transform comparison should not be needed, but duplis don't work perfect
/* object sync
* transform comparison should not be needed, but duplis don't work perfect
* in the depsgraph and may not signal changes, so this is a workaround */
if(object_updated || (object->mesh && object->mesh->need_update) || tfm != object->tfm) {
object->name = b_ob.name().c_str();
@ -264,7 +267,15 @@ void BlenderSync::sync_object(BL::Object b_parent, int b_index, BL::DupliObject
object->motion.post = tfm;
object->use_motion = false;
object->random_id = hash_int_2d(hash_string(object->name.c_str()), b_index);
/* random number */
object->random_id = hash_string(object->name.c_str());
if(persistent_id) {
for(int i = 0; i < OBJECT_PERSISTENT_ID_SIZE; i++)
object->random_id = hash_int_2d(object->random_id, persistent_id[i]);
}
else
object->random_id = hash_int_2d(object->random_id, 0);
/* visibility flags for both parent */
object->visibility = object_ray_visibility(b_ob) & PATH_RAY_ALL;
@ -273,6 +284,10 @@ void BlenderSync::sync_object(BL::Object b_parent, int b_index, BL::DupliObject
object->random_id ^= hash_int(hash_string(b_parent.name().c_str()));
}
/* make holdout objects on excluded layer invisible for non-camera rays */
if(use_holdout && (layer_flag & render_layer.exclude_layer))
object->visibility &= ~(PATH_RAY_ALL - PATH_RAY_CAMERA);
/* camera flag is not actually used, instead is tested
* against render layer flags */
if(object->visibility & PATH_RAY_CAMERA) {
@ -289,10 +304,17 @@ void BlenderSync::sync_object(BL::Object b_parent, int b_index, BL::DupliObject
object->dupli_uv = make_float2(0.0f, 0.0f);
}
object->particle_id = particle_id;
object->tag_update(scene);
}
return object;
}
static bool object_dupli_hide_original(BL::Object::dupli_type_enum dupli_type)
{
return (dupli_type == BL::Object::dupli_type_VERTS ||
dupli_type == BL::Object::dupli_type_FACES ||
dupli_type == BL::Object::dupli_type_FRAMES);
}
/* Object Loop */
@ -314,7 +336,9 @@ void BlenderSync::sync_objects(BL::SpaceView3D b_v3d, int motion)
/* object loop */
BL::Scene::objects_iterator b_ob;
BL::Scene b_sce = b_scene;
int particle_offset = 1; /* first particle is dummy for regular, non-instanced objects */
/* global particle index counter */
int particle_id = 1;
bool cancel = false;
@ -327,16 +351,14 @@ void BlenderSync::sync_objects(BL::SpaceView3D b_v3d, int motion)
if(!hide) {
progress.set_sync_status("Synchronizing object", (*b_ob).name());
int num_particles = object_count_particles(*b_ob);
if(b_ob->is_duplicator()) {
hide = true; /* duplicators hidden by default */
/* duplicators hidden by default */
hide = true;
/* dupli objects */
b_ob->dupli_list_create(b_scene, 2);
BL::Object::dupli_list_iterator b_dup;
int b_index = 0;
for(b_ob->dupli_list.begin(b_dup); b_dup != b_ob->dupli_list.end(); ++b_dup) {
Transform tfm = get_transform(b_dup->matrix());
@ -345,7 +367,9 @@ void BlenderSync::sync_objects(BL::SpaceView3D b_v3d, int motion)
bool emitter_hide = false;
if(b_dup_ob.is_duplicator()) {
emitter_hide = true; /* duplicators hidden by default */
/* duplicators hidden by default, except dupliframes which duplicate self */
if(b_dup_ob.dupli_type() != BL::Object::dupli_type_FRAMES)
emitter_hide = true;
/* check if we should render or hide particle emitter */
BL::Object::particle_systems_iterator b_psys;
@ -354,33 +378,54 @@ void BlenderSync::sync_objects(BL::SpaceView3D b_v3d, int motion)
emitter_hide = false;
}
/* hide original object for duplis */
BL::Object parent = b_dup_ob.parent();
if(parent && object_dupli_hide_original(parent.dupli_type()))
if(b_dup->type() == BL::DupliObject::type_GROUP)
dup_hide = true;
if(!(b_dup->hide() || dup_hide || emitter_hide)) {
sync_object(*b_ob, b_index, *b_dup, tfm, ob_layer, motion, b_dup->particle_index() + particle_offset);
/* the persistent_id allows us to match dupli objects
* between frames and updates */
BL::Array<int, OBJECT_PERSISTENT_ID_SIZE> persistent_id = b_dup->persistent_id();
/* sync object and mesh or light data */
Object *object = sync_object(*b_ob, persistent_id.data, *b_dup, tfm, ob_layer, motion);
/* sync possible particle data, note particle_id
* starts counting at 1, first is dummy particle */
if(!motion && object && sync_dupli_particle(*b_ob, *b_dup, object)) {
if(particle_id != object->particle_id) {
object->particle_id = particle_id;
scene->object_manager->tag_update(scene);
}
particle_id++;
}
}
++b_index;
}
b_ob->dupli_list_clear();
}
/* sync particles and check if we should render or hide particle emitter */
/* check if we should render or hide particle emitter */
BL::Object::particle_systems_iterator b_psys;
for(b_ob->particle_systems.begin(b_psys); b_psys != b_ob->particle_systems.end(); ++b_psys) {
if(!motion)
sync_particles(*b_ob, *b_psys);
for(b_ob->particle_systems.begin(b_psys); b_psys != b_ob->particle_systems.end(); ++b_psys)
if(b_psys->settings().use_render_emitter())
hide = false;
}
/* hide original object for duplis */
BL::Object parent = b_ob->parent();
if(parent && object_dupli_hide_original(parent.dupli_type()))
hide = true;
if(!hide) {
/* object itself */
Transform tfm = get_transform(b_ob->matrix_world());
sync_object(*b_ob, 0, PointerRNA_NULL, tfm, ob_layer, motion, 0);
sync_object(*b_ob, NULL, PointerRNA_NULL, tfm, ob_layer, motion);
}
particle_offset += num_particles;
}
cancel = progress.get_cancel();

@ -17,6 +17,7 @@
*/
#include "mesh.h"
#include "object.h"
#include "particles.h"
#include "blender_sync.h"
@ -28,170 +29,57 @@ CCL_NAMESPACE_BEGIN
/* Utilities */
/* Particles Sync */
bool BlenderSync::psys_need_update(BL::ParticleSystem b_psys)
bool BlenderSync::sync_dupli_particle(BL::Object b_ob, BL::DupliObject b_dup, Object *object)
{
/* Particle data is only needed for
* a) Billboard render mode if object's own material uses particle info
* b) object/group render mode if any dupli object's material uses particle info
*
* Note: Meshes have to be synced at this point!
*/
bool need_update = false;
switch (b_psys.settings().render_type()) {
/* XXX not implemented yet!
* billboards/strands would become part of the mesh data (?),
* so the mesh attributes would store whether particle info is required.
*/
#if 0
case BL::ParticleSettings::render_type_BILLBOARD:
case BL::ParticleSettings::render_type_PATH: { /* for strand rendering */
BL::ID key = (BKE_object_is_modified(b_ob))? b_ob: b_ob.data();
Mesh *mesh = mesh_map.find(key);
if(mesh) {
need_update |= mesh->need_attribute(scene, ATTR_STD_PARTICLE) && mesh->need_update;
}
break;
}
#endif
case BL::ParticleSettings::render_type_OBJECT: {
BL::Object b_dupli_ob = b_psys.settings().dupli_object();
if(b_dupli_ob) {
BL::ID key = (BKE_object_is_modified(b_dupli_ob))? b_dupli_ob: b_dupli_ob.data();
Mesh *mesh = mesh_map.find(key);
if(mesh) {
need_update |= mesh->need_attribute(scene, ATTR_STD_PARTICLE) && mesh->need_update;
}
}
break;
}
case BL::ParticleSettings::render_type_GROUP: {
BL::Group b_dupli_group = b_psys.settings().dupli_group();
if(b_dupli_group) {
BL::Group::objects_iterator b_gob;
for (b_dupli_group.objects.begin(b_gob); b_gob != b_dupli_group.objects.end(); ++b_gob) {
BL::ID key = (BKE_object_is_modified(*b_gob))? *b_gob: b_gob->data();
Mesh *mesh = mesh_map.find(key);
if(mesh) {
need_update |= mesh->need_attribute(scene, ATTR_STD_PARTICLE) && mesh->need_update;
}
}
}
break;
}
default:
/* avoid compiler warning */
break;
/* test if this dupli was generated from a particle sytem */
BL::ParticleSystem b_psys = b_dup.particle_system();
if(!b_psys)
return false;
/* test if we need particle data */
if(!object->mesh->need_attribute(scene, ATTR_STD_PARTICLE))
return false;
/* don't handle child particles yet */
BL::Array<int, OBJECT_PERSISTENT_ID_SIZE> persistent_id = b_dup.persistent_id();
if(persistent_id[0] >= b_psys.particles.length())
return false;
/* find particle system */
ParticleSystemKey key(b_ob, persistent_id);
ParticleSystem *psys;
bool first_use = !particle_system_map.is_used(key);
bool need_update = particle_system_map.sync(&psys, b_ob, b_dup.object(), key);
/* no update needed? */
if(!need_update && !object->mesh->need_update && !scene->object_manager->need_update)
return true;
/* first time used in this sync loop? clear and tag update */
if(first_use) {
psys->particles.clear();
psys->tag_update(scene);
}
return need_update;
}
static bool use_particle_system(BL::ParticleSystem b_psys)
{
/* only use duplicator particles? disabled particle info for
* halo and billboard to reduce particle count.
* Probably not necessary since particles don't contain a huge amount
* of data compared to other textures.
*/
#if 0
int render_type = b_psys->settings().render_type();
return (render_type == BL::ParticleSettings::render_type_OBJECT
|| render_type == BL::ParticleSettings::render_type_GROUP);
#endif
/* add particle */
BL::Particle b_pa = b_psys.particles[persistent_id[0]];
Particle pa;
pa.index = persistent_id[0];
pa.age = b_scene.frame_current() - b_pa.birth_time();
pa.lifetime = b_pa.lifetime();
pa.location = get_float3(b_pa.location());
pa.rotation = get_float4(b_pa.rotation());
pa.size = b_pa.size();
pa.velocity = get_float3(b_pa.velocity());
pa.angular_velocity = get_float3(b_pa.angular_velocity());
psys->particles.push_back(pa);
/* return that this object has particle data */
return true;
}
static bool use_particle(BL::Particle b_pa, bool preview, bool show_unborn, bool use_dead)
{
return b_pa.is_exist() && (!preview || b_pa.is_visible()) &&
(b_pa.alive_state() != BL::Particle::alive_state_UNBORN || show_unborn) &&
(b_pa.alive_state() != BL::Particle::alive_state_DEAD || use_dead);
}
static int psys_count_particles(BL::ParticleSystem b_psys, bool preview)
{
BL::ParticleSystem::particles_iterator b_pa;
bool show_unborn = b_psys.settings().show_unborn();
bool use_dead = b_psys.settings().use_dead();
int num = 0;
for(b_psys.particles.begin(b_pa); b_pa != b_psys.particles.end(); ++b_pa)
if(use_particle(*b_pa, preview, show_unborn, use_dead))
++num;
return num;
}
int BlenderSync::object_count_particles(BL::Object b_ob)
{
BL::Object::particle_systems_iterator b_psys;
int num = 0;
for(b_ob.particle_systems.begin(b_psys); b_psys != b_ob.particle_systems.end(); ++b_psys)
if(use_particle_system(*b_psys))
num += psys_count_particles(*b_psys, preview);
return num;
}
void BlenderSync::sync_particles(BL::Object b_ob, BL::ParticleSystem b_psys)
{
/* depending on settings the psys may not even be rendered */
if(!use_particle_system(b_psys))
return;
/* key to lookup particle system */
ParticleSystemKey key(b_ob, b_psys);
ParticleSystem *psys;
/* test if we need to sync */
bool object_updated = false;
if(particle_system_map.sync(&psys, b_ob, b_ob, key))
object_updated = true;
bool need_update = psys_need_update(b_psys);
if(object_updated || need_update) {
bool show_unborn = b_psys.settings().show_unborn();
bool use_dead = b_psys.settings().use_dead();
int num = psys_count_particles(b_psys, preview);
psys->particles.clear();
psys->particles.reserve(num);
BL::ParticleSystem::particles_iterator b_pa;
int index = 0;
for(b_psys.particles.begin(b_pa); b_pa != b_psys.particles.end(); ++b_pa) {
if(use_particle(*b_pa, preview, show_unborn, use_dead)) {
Particle pa;
pa.index = index;
pa.age = b_scene.frame_current() - b_pa->birth_time();
pa.lifetime = b_pa->lifetime();
pa.location = get_float3(b_pa->location());
pa.rotation = get_float4(b_pa->rotation());
pa.size = b_pa->size();
pa.velocity = get_float3(b_pa->velocity());
pa.angular_velocity = get_float3(b_pa->angular_velocity());
psys->particles.push_back(pa);
}
++index;
}
psys->tag_update(scene);
}
}
CCL_NAMESPACE_END

@ -146,6 +146,32 @@ static PyObject *draw_func(PyObject *self, PyObject *args)
Py_RETURN_NONE;
}
static PyObject *reset_func(PyObject *self, PyObject *args)
{
PyObject *pysession, *pydata, *pyscene;
if(!PyArg_ParseTuple(args, "OOO", &pysession, &pydata, &pyscene))
return NULL;
BlenderSession *session = (BlenderSession*)PyLong_AsVoidPtr(pysession);
PointerRNA dataptr;
RNA_id_pointer_create((ID*)PyLong_AsVoidPtr(pydata), &dataptr);
BL::BlendData b_data(dataptr);
PointerRNA sceneptr;
RNA_id_pointer_create((ID*)PyLong_AsVoidPtr(pyscene), &sceneptr);
BL::Scene b_scene(sceneptr);
Py_BEGIN_ALLOW_THREADS
session->reset_session(b_data, b_scene);
Py_END_ALLOW_THREADS
Py_RETURN_NONE;
}
static PyObject *sync_func(PyObject *self, PyObject *value)
{
Py_BEGIN_ALLOW_THREADS
@ -217,6 +243,7 @@ static PyObject *osl_update_node_func(PyObject *self, PyObject *args)
float default_float4[4] = {0.0f, 0.0f, 0.0f, 1.0f};
float default_float = 0.0f;
int default_int = 0;
std::string default_string = "";
if(param->isclosure) {
socket_type = BL::NodeSocket::type_SHADER;
@ -252,6 +279,13 @@ static PyObject *osl_update_node_func(PyObject *self, PyObject *args)
if(param->validdefault)
default_float = param->fdefault[0];
}
else if(param->type.basetype == TypeDesc::STRING) {
socket_type = BL::NodeSocket::type_STRING;
if(param->validdefault)
default_string = param->sdefault[0];
}
else
continue;
}
else
continue;
@ -286,6 +320,10 @@ static PyObject *osl_update_node_func(PyObject *self, PyObject *args)
BL::NodeSocketVectorNone b_vector_sock(b_sock.ptr);
b_vector_sock.default_value(default_float4);
}
else if(socket_type == BL::NodeSocket::type_STRING) {
BL::NodeSocketStringNone b_string_sock(b_sock.ptr);
b_string_sock.default_value(default_string);
}
}
used_sockets.insert(b_sock.ptr.data);
@ -342,6 +380,7 @@ static PyMethodDef methods[] = {
{"render", render_func, METH_O, ""},
{"draw", draw_func, METH_VARARGS, ""},
{"sync", sync_func, METH_O, ""},
{"reset", reset_func, METH_VARARGS, ""},
#ifdef WITH_OSL
{"osl_update_node", osl_update_node_func, METH_VARARGS, ""},
{"osl_compile", osl_compile_func, METH_VARARGS, ""},
@ -379,14 +418,23 @@ static CCLDeviceInfo *compute_device_list(DeviceType type)
if(info.type == type ||
(info.type == DEVICE_MULTI && info.multi_devices[0].type == type))
{
CCLDeviceInfo cinfo = {info.id.c_str(), info.description.c_str(), i++};
CCLDeviceInfo cinfo;
strncpy(cinfo.identifier, info.id.c_str(), sizeof(cinfo.identifier));
cinfo.identifier[info.id.length()] = '\0';
strncpy(cinfo.name, info.description.c_str(), sizeof(cinfo.name));
cinfo.name[info.description.length()] = '\0';
cinfo.value = i++;
device_list.push_back(cinfo);
}
}
/* null terminate */
if(!device_list.empty()) {
CCLDeviceInfo cinfo = {NULL, NULL, 0};
CCLDeviceInfo cinfo = {"", "", 0};
device_list.push_back(cinfo);
}
}

@ -109,9 +109,53 @@ void BlenderSession::create_session()
session->reset(buffer_params, session_params.samples);
}
void BlenderSession::reset_session(BL::BlendData b_data_, BL::Scene b_scene_)
{
b_data = b_data_;
b_scene = b_scene_;
SceneParams scene_params = BlenderSync::get_scene_params(b_scene, background);
SessionParams session_params = BlenderSync::get_session_params(b_engine, b_userpref, b_scene, background);
width = b_engine.resolution_x();
height = b_engine.resolution_y();
if(scene->params.modified(scene_params) ||
session->params.modified(session_params))
{
/* if scene or session parameters changed, it's easier to simply re-create
* them rather than trying to distinguish which settings need to be updated
*/
delete session;
create_session();
return;
}
session->progress.reset();
scene->reset();
/* peak memory usage should show current render peak, not peak for all renders
* made by this render session
*/
session->stats.mem_peak = session->stats.mem_used;
/* sync object should be re-created */
sync = new BlenderSync(b_engine, b_data, b_scene, scene, !background, session->progress);
sync->sync_data(b_v3d, b_engine.camera_override());
sync->sync_camera(b_engine.camera_override(), width, height);
BufferParams buffer_params = BlenderSync::get_buffer_params(b_scene, PointerRNA_NULL, PointerRNA_NULL, scene->camera, width, height);
session->reset(buffer_params, session_params.samples);
}
void BlenderSession::free_session()
{
delete sync;
if(sync)
delete sync;
delete session;
}
@ -304,6 +348,15 @@ void BlenderSession::render()
/* clear callback */
session->write_render_tile_cb = NULL;
session->update_render_tile_cb = NULL;
/* free all memory used (host and device), so we wouldn't leave render
* engine with extra memory allocated
*/
session->device_free();
delete sync;
sync = NULL;
}
void BlenderSession::do_write_update_render_result(BL::RenderResult b_rr, BL::RenderLayer b_rlay, RenderTile& rtile, bool do_update_only)
@ -465,8 +518,8 @@ void BlenderSession::get_progress(float& progress, double& total_time)
sample = session->progress.get_sample();
samples_per_tile = session->params.samples;
if(samples_per_tile)
progress = ((float)sample/(float)(tile_total * samples_per_tile));
if(samples_per_tile && tile_total)
progress = ((float)sample / (float)(tile_total * samples_per_tile));
else
progress = 0.0;
}

@ -46,6 +46,8 @@ public:
void create_session();
void free_session();
void reset_session(BL::BlendData b_data, BL::Scene b_scene);
/* offline render */
void render();

@ -90,6 +90,8 @@ static ShaderSocketType convert_socket_type(BL::NodeSocket::type_enum b_type)
return SHADER_SOCKET_COLOR;
case BL::NodeSocket::type_SHADER:
return SHADER_SOCKET_CLOSURE;
case BL::NodeSocket::type_STRING:
return SHADER_SOCKET_STRING;
case BL::NodeSocket::type_BOOLEAN:
case BL::NodeSocket::type_MESH:
@ -98,7 +100,7 @@ static ShaderSocketType convert_socket_type(BL::NodeSocket::type_enum b_type)
}
}
static void set_default_value(ShaderInput *input, BL::NodeSocket sock)
static void set_default_value(ShaderInput *input, BL::NodeSocket sock, BL::BlendData b_data, BL::ID b_id)
{
/* copy values for non linked inputs */
switch(input->type) {
@ -124,6 +126,11 @@ static void set_default_value(ShaderInput *input, BL::NodeSocket sock)
input->set(get_float3(vec_sock.default_value()));
break;
}
case SHADER_SOCKET_STRING: {
BL::NodeSocketStringNone string_sock(sock);
input->set((ustring)blender_absolute_path(b_data, b_id, string_sock.default_value()));
break;
}
case SHADER_SOCKET_CLOSURE:
break;
}
@ -173,6 +180,7 @@ static ShaderNode *add_node(Scene *scene, BL::BlendData b_data, BL::Scene b_scen
case BL::ShaderNode::type_OUTPUT: break;
case BL::ShaderNode::type_SQUEEZE: break;
case BL::ShaderNode::type_TEXTURE: break;
case BL::ShaderNode::type_FRAME: break;
/* handled outside this function */
case BL::ShaderNode::type_GROUP: break;
/* existing blender nodes */
@ -366,6 +374,23 @@ static ShaderNode *add_node(Scene *scene, BL::BlendData b_data, BL::Scene b_scen
node = glass;
break;
}
case BL::ShaderNode::type_BSDF_REFRACTION: {
BL::ShaderNodeBsdfRefraction b_refraction_node(b_node);
RefractionBsdfNode *refraction = new RefractionBsdfNode();
switch(b_refraction_node.distribution()) {
case BL::ShaderNodeBsdfRefraction::distribution_SHARP:
refraction->distribution = ustring("Sharp");
break;
case BL::ShaderNodeBsdfRefraction::distribution_BECKMANN:
refraction->distribution = ustring("Beckmann");
break;
case BL::ShaderNodeBsdfRefraction::distribution_GGX:
refraction->distribution = ustring("GGX");
break;
}
node = refraction;
break;
}
case BL::ShaderNode::type_BSDF_TRANSLUCENT: {
node = new TranslucentBsdfNode();
break;
@ -382,6 +407,10 @@ static ShaderNode *add_node(Scene *scene, BL::BlendData b_data, BL::Scene b_scen
node = new EmissionNode();
break;
}
case BL::ShaderNode::type_AMBIENT_OCCLUSION: {
node = new AmbientOcclusionNode();
break;
}
case BL::ShaderNode::type_VOLUME_ISOTROPIC: {
node = new IsotropicVolumeNode();
break;
@ -416,7 +445,7 @@ static ShaderNode *add_node(Scene *scene, BL::BlendData b_data, BL::Scene b_scen
}
case BL::ShaderNode::type_SCRIPT: {
#ifdef WITH_OSL
if(scene->params.shadingsystem != SceneParams::OSL)
if(!scene->shader_manager->use_osl())
break;
/* create script node */
@ -435,7 +464,7 @@ static ShaderNode *add_node(Scene *scene, BL::BlendData b_data, BL::Scene b_scen
for (b_script_node.inputs.begin(b_input); b_input != b_script_node.inputs.end(); ++b_input) {
script_node->input_names.push_back(ustring(b_input->name()));
ShaderInput *input = script_node->add_input(script_node->input_names.back().c_str(), convert_socket_type(b_input->type()));
set_default_value(input, *b_input);
set_default_value(input, *b_input, b_data, b_ntree);
}
BL::Node::outputs_iterator b_output;
@ -471,8 +500,10 @@ static ShaderNode *add_node(Scene *scene, BL::BlendData b_data, BL::Scene b_scen
BL::Image b_image(b_image_node.image());
ImageTextureNode *image = new ImageTextureNode();
/* todo: handle generated/builtin images */
if(b_image && b_image.source() != BL::Image::source_MOVIE)
if(b_image && b_image.source() != BL::Image::source_MOVIE) {
image->filename = image_user_file_path(b_image_node.image_user(), b_image, b_scene.frame_current());
image->animated = b_image_node.image_user().use_auto_refresh();
}
image->color_space = ImageTextureNode::color_space_enum[(int)b_image_node.color_space()];
image->projection = ImageTextureNode::projection_enum[(int)b_image_node.projection()];
image->projection_blend = b_image_node.projection_blend();
@ -484,8 +515,10 @@ static ShaderNode *add_node(Scene *scene, BL::BlendData b_data, BL::Scene b_scen
BL::ShaderNodeTexEnvironment b_env_node(b_node);
BL::Image b_image(b_env_node.image());
EnvironmentTextureNode *env = new EnvironmentTextureNode();
if(b_image && b_image.source() != BL::Image::source_MOVIE)
if(b_image && b_image.source() != BL::Image::source_MOVIE) {
env->filename = image_user_file_path(b_env_node.image_user(), b_image, b_scene.frame_current());
env->animated = b_env_node.image_user().use_auto_refresh();
}
env->color_space = EnvironmentTextureNode::color_space_enum[(int)b_env_node.color_space()];
env->projection = EnvironmentTextureNode::projection_enum[(int)b_env_node.projection()];
get_tex_mapping(&env->tex_mapping, b_env_node.texture_mapping());
@ -573,6 +606,23 @@ static ShaderNode *add_node(Scene *scene, BL::BlendData b_data, BL::Scene b_scen
node = sky;
break;
}
case BL::ShaderNode::type_NORMAL_MAP: {
BL::ShaderNodeNormalMap b_normal_map_node(b_node);
NormalMapNode *nmap = new NormalMapNode();
nmap->space = NormalMapNode::space_enum[(int)b_normal_map_node.space()];
nmap->attribute = b_normal_map_node.uv_map();
node = nmap;
break;
}
case BL::ShaderNode::type_TANGENT: {
BL::ShaderNodeTangent b_tangent_node(b_node);
TangentNode *tangent = new TangentNode();
tangent->direction_type = TangentNode::direction_type_enum[(int)b_tangent_node.direction_type()];
tangent->axis = TangentNode::axis_enum[(int)b_tangent_node.axis()];
tangent->attribute = b_tangent_node.uv_map();
node = tangent;
break;
}
}
if(node && node != graph->output())
@ -687,7 +737,7 @@ static void add_nodes(Scene *scene, BL::BlendData b_data, BL::Scene b_scene, Sha
group_sockmap[b_input->group_socket().ptr.data] = SocketPair(proxy, proxy->outputs[0]->name);
/* default input values of the group node */
set_default_value(proxy->inputs[0], *b_input);
set_default_value(proxy->inputs[0], *b_input, b_data, b_group_ntree);
}
for(b_node->outputs.begin(b_output); b_output != b_node->outputs.end(); ++b_output) {
@ -701,7 +751,7 @@ static void add_nodes(Scene *scene, BL::BlendData b_data, BL::Scene b_scene, Sha
group_sockmap[b_output->group_socket().ptr.data] = SocketPair(proxy, proxy->inputs[0]->name);
/* default input values of internal, unlinked group outputs */
set_default_value(proxy->inputs[0], b_output->group_socket());
set_default_value(proxy->inputs[0], b_output->group_socket(), b_data, b_group_ntree);
}
add_nodes(scene, b_data, b_scene, graph, b_group_ntree, group_sockmap);
@ -721,7 +771,7 @@ static void add_nodes(Scene *scene, BL::BlendData b_data, BL::Scene b_scene, Sha
assert(input);
/* copy values for non linked inputs */
set_default_value(input, *b_input);
set_default_value(input, *b_input, b_data, b_ntree);
}
}
}
@ -775,7 +825,7 @@ static void add_nodes(Scene *scene, BL::BlendData b_data, BL::Scene b_scene, Sha
/* Sync Materials */
void BlenderSync::sync_materials()
void BlenderSync::sync_materials(bool update_all)
{
shader_map.set_default(scene->shaders[scene->default_surface]);
@ -786,7 +836,7 @@ void BlenderSync::sync_materials()
Shader *shader;
/* test if we need to sync */
if(shader_map.sync(&shader, *b_mat)) {
if(shader_map.sync(&shader, *b_mat) || update_all) {
ShaderGraph *graph = new ShaderGraph();
shader->name = b_mat->name().c_str();
@ -822,14 +872,14 @@ void BlenderSync::sync_materials()
/* Sync World */
void BlenderSync::sync_world()
void BlenderSync::sync_world(bool update_all)
{
Background *background = scene->background;
Background prevbackground = *background;
BL::World b_world = b_scene.world();
if(world_recalc || b_world.ptr.data != world_map) {
if(world_recalc || update_all || b_world.ptr.data != world_map) {
Shader *shader = scene->shaders[scene->default_background];
ShaderGraph *graph = new ShaderGraph();
@ -876,7 +926,7 @@ void BlenderSync::sync_world()
/* Sync Lamps */
void BlenderSync::sync_lamps()
void BlenderSync::sync_lamps(bool update_all)
{
shader_map.set_default(scene->shaders[scene->default_light]);
@ -887,7 +937,7 @@ void BlenderSync::sync_lamps()
Shader *shader;
/* test if we need to sync */
if(shader_map.sync(&shader, *b_lamp)) {
if(shader_map.sync(&shader, *b_lamp) || update_all) {
ShaderGraph *graph = new ShaderGraph();
/* create nodes */
@ -926,11 +976,20 @@ void BlenderSync::sync_lamps()
void BlenderSync::sync_shaders()
{
/* for auto refresh images */
bool auto_refresh_update = false;
if(preview) {
ImageManager *image_manager = scene->image_manager;
int frame = b_scene.frame_current();
auto_refresh_update = image_manager->set_animation_frame_update(frame);
}
shader_map.pre_sync();
sync_world();
sync_lamps();
sync_materials();
sync_world(auto_refresh_update);
sync_lamps(auto_refresh_update);
sync_materials(auto_refresh_update);
/* false = don't delete unused shaders, not supported */
shader_map.post_sync(false);

@ -179,12 +179,14 @@ void BlenderSync::sync_integrator()
integrator->sample_clamp = get_float(cscene, "sample_clamp");
#ifdef __CAMERA_MOTION__
if(integrator->motion_blur != r.use_motion_blur()) {
scene->object_manager->tag_update(scene);
scene->camera->tag_update();
}
if(!preview) {
if(integrator->motion_blur != r.use_motion_blur()) {
scene->object_manager->tag_update(scene);
scene->camera->tag_update();
}
integrator->motion_blur = (!preview && r.use_motion_blur());
integrator->motion_blur = r.use_motion_blur();
}
#endif
integrator->diffuse_samples = get_int(cscene, "diffuse_samples");
@ -241,6 +243,7 @@ void BlenderSync::sync_render_layers(BL::SpaceView3D b_v3d, const char *layer)
render_layer.use_localview = (b_v3d.local_view() ? true : false);
render_layer.scene_layer = get_layer(b_v3d.layers(), b_v3d.layers_local_view(), render_layer.use_localview);
render_layer.layer = render_layer.scene_layer;
render_layer.exclude_layer = 0;
render_layer.holdout_layer = 0;
render_layer.material_override = PointerRNA_NULL;
render_layer.use_background = true;
@ -258,10 +261,16 @@ void BlenderSync::sync_render_layers(BL::SpaceView3D b_v3d, const char *layer)
for(r.layers.begin(b_rlay); b_rlay != r.layers.end(); ++b_rlay) {
if((!layer && first_layer) || (layer && b_rlay->name() == layer)) {
render_layer.name = b_rlay->name();
render_layer.scene_layer = get_layer(b_scene.layers()) & ~get_layer(b_rlay->layers_exclude());
render_layer.layer = get_layer(b_rlay->layers());
render_layer.holdout_layer = get_layer(b_rlay->layers_zmask());
render_layer.exclude_layer = get_layer(b_rlay->layers_exclude());
render_layer.scene_layer = get_layer(b_scene.layers()) & ~render_layer.exclude_layer;
render_layer.scene_layer |= render_layer.exclude_layer & render_layer.holdout_layer;
render_layer.layer = get_layer(b_rlay->layers());
render_layer.layer |= render_layer.holdout_layer;
render_layer.material_override = b_rlay->material_override();
render_layer.use_background = b_rlay->use_sky();
render_layer.use_viewport_visibility = false;
@ -277,6 +286,7 @@ void BlenderSync::sync_render_layers(BL::SpaceView3D b_v3d, const char *layer)
SceneParams BlenderSync::get_scene_params(BL::Scene b_scene, bool background)
{
BL::RenderSettings r = b_scene.render();
SceneParams params;
PointerRNA cscene = RNA_pointer_get(&b_scene.ptr, "cycles");
int shadingsystem = RNA_enum_get(&cscene, "shading_system");
@ -294,6 +304,8 @@ SceneParams BlenderSync::get_scene_params(BL::Scene b_scene, bool background)
params.use_bvh_spatial_split = RNA_boolean_get(&cscene, "debug_use_spatial_splits");
params.use_bvh_cache = (background)? RNA_boolean_get(&cscene, "use_cache"): false;
params.persistent_images = (background)? r.use_persistent_data(): false;
return params;
}
@ -379,7 +391,10 @@ SessionParams BlenderSync::get_session_params(BL::RenderEngine b_engine, BL::Use
params.start_resolution = get_int(cscene, "preview_start_resolution");
/* other parameters */
params.threads = b_scene.render().threads();
if(b_scene.render().threads_mode() == BL::RenderSettings::threads_mode_FIXED)
params.threads = b_scene.render().threads();
else
params.threads = 0;
params.cancel_timeout = get_float(cscene, "debug_cancel_timeout");
params.reset_timeout = get_float(cscene, "debug_reset_timeout");

@ -42,6 +42,7 @@ class Film;
class Light;
class Mesh;
class Object;
class ParticleSystem;
class Scene;
class Shader;
class ShaderGraph;
@ -67,33 +68,33 @@ public:
private:
/* sync */
void sync_lamps();
void sync_materials();
void sync_lamps(bool update_all);
void sync_materials(bool update_all);
void sync_objects(BL::SpaceView3D b_v3d, int motion = 0);
void sync_motion(BL::SpaceView3D b_v3d, BL::Object b_override);
void sync_film();
void sync_integrator();
void sync_view();
void sync_world();
void sync_world(bool update_all);
void sync_render_layers(BL::SpaceView3D b_v3d, const char *layer);
void sync_shaders();
void sync_nodes(Shader *shader, BL::ShaderNodeTree b_ntree);
Mesh *sync_mesh(BL::Object b_ob, bool object_updated);
void sync_object(BL::Object b_parent, int b_index, BL::DupliObject b_dupli_object, Transform& tfm, uint layer_flag, int motion, int particle_id);
void sync_light(BL::Object b_parent, int b_index, BL::Object b_ob, Transform& tfm);
Object *sync_object(BL::Object b_parent, int persistent_id[OBJECT_PERSISTENT_ID_SIZE], BL::DupliObject b_dupli_object, Transform& tfm, uint layer_flag, int motion);
void sync_light(BL::Object b_parent, int persistent_id[OBJECT_PERSISTENT_ID_SIZE], BL::Object b_ob, Transform& tfm);
void sync_background_light();
void sync_mesh_motion(BL::Object b_ob, Mesh *mesh, int motion);
void sync_camera_motion(BL::Object b_ob, int motion);
void sync_particles(BL::Object b_ob, BL::ParticleSystem b_psys);
/* particles */
bool sync_dupli_particle(BL::Object b_ob, BL::DupliObject b_dup, Object *object);
/* util */
void find_shader(BL::ID id, vector<uint>& used_shaders, int default_shader);
bool BKE_object_is_modified(BL::Object b_ob);
bool object_is_mesh(BL::Object b_ob);
bool object_is_light(BL::Object b_ob);
bool psys_need_update(BL::ParticleSystem b_psys);
int object_count_particles(BL::Object b_ob);
/* variables */
BL::RenderEngine b_engine;
@ -115,7 +116,8 @@ private:
struct RenderLayerInfo {
RenderLayerInfo()
: scene_layer(0), layer(0), holdout_layer(0),
: scene_layer(0), layer(0),
holdout_layer(0), exclude_layer(0),
material_override(PointerRNA_NULL),
use_background(true),
use_viewport_visibility(false),
@ -126,6 +128,7 @@ private:
uint scene_layer;
uint layer;
uint holdout_layer;
uint exclude_layer;
BL::Material material_override;
bool use_background;
bool use_viewport_visibility;

@ -284,6 +284,12 @@ public:
return recalc;
}
bool is_used(const K& key)
{
T *data = find(key);
return (data) ? used_set.find(data) != used_set.end() : false;
}
void used(T *data)
{
/* tag data as still in use */
@ -343,27 +349,63 @@ protected:
/* Object Key */
enum { OBJECT_PERSISTENT_ID_SIZE = 8 };
struct ObjectKey {
void *parent;
int index;
int id[OBJECT_PERSISTENT_ID_SIZE];
void *ob;
ObjectKey(void *parent_, int index_, void *ob_)
: parent(parent_), index(index_), ob(ob_) {}
ObjectKey(void *parent_, int id_[OBJECT_PERSISTENT_ID_SIZE], void *ob_)
: parent(parent_), ob(ob_)
{
if(id_)
memcpy(id, id_, sizeof(id));
else
memset(id, 0, sizeof(id));
}
bool operator<(const ObjectKey& k) const
{ return (parent < k.parent || (parent == k.parent && (index < k.index || (index == k.index && ob < k.ob)))); }
{
if(ob < k.ob) {
return true;
}
else if(ob == k.ob) {
if(parent < k.parent)
return true;
else if(parent == k.parent)
return memcmp(id, k.id, sizeof(id)) < 0;
}
return false;
}
};
/* Particle System Key */
struct ParticleSystemKey {
void *ob;
void *psys;
int id[OBJECT_PERSISTENT_ID_SIZE];
ParticleSystemKey(void *ob_, void *psys_)
: ob(ob_), psys(psys_) {}
ParticleSystemKey(void *ob_, int id_[OBJECT_PERSISTENT_ID_SIZE])
: ob(ob_)
{
if(id_)
memcpy(id, id_, sizeof(id));
else
memset(id, 0, sizeof(id));
}
bool operator<(const ParticleSystemKey& k) const
{ return (ob < k.ob && psys < k.psys); }
{
/* first id is particle index, we don't compare that */
if(ob < k.ob)
return true;
else if(ob == k.ob)
return memcmp(id+1, k.id+1, sizeof(int)*(OBJECT_PERSISTENT_ID_SIZE-1)) < 0;
return false;
}
};
CCL_NAMESPACE_END

@ -17,33 +17,6 @@ else()
set(CYCLES_GLEW_LIBRARY extern_glew)
endif()
###########################################################################
# Partio
if(WITH_CYCLES_PARTIO)
set(CYCLES_PARTIO "" CACHE PATH "Path to Partio installation")
message(STATUS "CYCLES_PARTIO = ${CYCLES_PARTIO}")
find_library(PARTIO_LIBRARIES NAMES partio PATHS ${CYCLES_PARTIO}/lib)
find_path(PARTIO_INCLUDES Partio.h ${CYCLES_PARTIO}/include)
find_package(ZLIB)
if(PARTIO_INCLUDES AND PARTIO_LIBRARIES AND ZLIB_LIBRARIES)
list(APPEND PARTIO_LIBRARIES ${ZLIB_LIBRARIES})
set(PARTIO_FOUND TRUE)
message(STATUS "PARTIO includes = ${PARTIO_INCLUDES}")
message(STATUS "PARTIO library = ${PARTIO_LIBRARIES}")
else()
message(STATUS "PARTIO not found")
endif()
include_directories(${PARTIO_INCLUDES})
endif()
###########################################################################
# CUDA

@ -78,13 +78,13 @@ void Device::draw_pixels(device_memory& rgba, int y, int w, int h, int dy, int w
glDisable(GL_BLEND);
}
Device *Device::create(DeviceInfo& info, Stats &stats, bool background, int threads)
Device *Device::create(DeviceInfo& info, Stats &stats, bool background)
{
Device *device;
switch(info.type) {
case DEVICE_CPU:
device = device_cpu_create(info, stats, threads);
device = device_cpu_create(info, stats);
break;
#ifdef WITH_CUDA
case DEVICE_CUDA:
@ -189,18 +189,6 @@ vector<DeviceInfo>& Device::available_devices()
{
static vector<DeviceInfo> devices;
static bool devices_init = false;
static double device_update_time = 0.0;
/* only update device list if we're not actively rendering already, things
* could go very wrong if a device suddenly becomes (un)available. also do
* it only every 5 seconds. it not super cpu intensive but don't want to do
* it on every redraw. */
if(devices_init) {
if(!TaskScheduler::active() && (time_dt() > device_update_time + 5.0)) {
devices.clear();
devices_init = false;
}
}
if(!devices_init) {
#ifdef WITH_CUDA
@ -224,7 +212,6 @@ vector<DeviceInfo>& Device::available_devices()
#endif
devices_init = true;
device_update_time = time_dt();
}
return devices;

@ -134,7 +134,7 @@ public:
virtual int device_number(Device *sub_device) { return 0; }
/* static */
static Device *create(DeviceInfo& info, Stats &stats, bool background = true, int threads = 0);
static Device *create(DeviceInfo& info, Stats &stats, bool background = true);
static DeviceType type_from_string(const char *name);
static string string_from_type(DeviceType type);

@ -23,9 +23,12 @@
#include "device_intern.h"
#include "kernel.h"
#include "kernel_compat_cpu.h"
#include "kernel_types.h"
#include "kernel_globals.h"
#include "osl_shader.h"
#include "osl_globals.h"
#include "buffers.h"
@ -43,11 +46,16 @@ class CPUDevice : public Device
{
public:
TaskPool task_pool;
KernelGlobals *kg;
KernelGlobals kernel_globals;
#ifdef WITH_OSL
OSLGlobals osl_globals;
#endif
CPUDevice(Stats &stats, int threads_num) : Device(stats)
CPUDevice(Stats &stats) : Device(stats)
{
kg = kernel_globals_create();
#ifdef WITH_OSL
kernel_globals.osl = &osl_globals;
#endif
/* do now to avoid thread issues */
system_cpu_support_optimized();
@ -56,7 +64,6 @@ public:
~CPUDevice()
{
task_pool.stop();
kernel_globals_free(kg);
}
bool support_advanced_shading()
@ -95,12 +102,12 @@ public:
void const_copy_to(const char *name, void *host, size_t size)
{
kernel_const_copy(kg, name, host, size);
kernel_const_copy(&kernel_globals, name, host, size);
}
void tex_alloc(const char *name, device_memory& mem, bool interpolation, bool periodic)
{
kernel_tex_copy(kg, name, mem.data_pointer, mem.data_width, mem.data_height);
kernel_tex_copy(&kernel_globals, name, mem.data_pointer, mem.data_width, mem.data_height);
mem.device_pointer = mem.data_pointer;
stats.mem_alloc(mem.memory_size());
@ -116,7 +123,7 @@ public:
void *osl_memory()
{
#ifdef WITH_OSL
return kernel_osl_memory(kg);
return &osl_globals;
#else
return NULL;
#endif
@ -148,9 +155,10 @@ public:
return;
}
KernelGlobals kg = kernel_globals;
#ifdef WITH_OSL
if(kernel_osl_use(kg))
OSLShader::thread_init(kg);
OSLShader::thread_init(&kg, &kernel_globals, &osl_globals);
#endif
RenderTile tile;
@ -171,7 +179,7 @@ public:
for(int y = tile.y; y < tile.y + tile.h; y++) {
for(int x = tile.x; x < tile.x + tile.w; x++) {
kernel_cpu_optimized_path_trace(kg, render_buffer, rng_state,
kernel_cpu_optimized_path_trace(&kg, render_buffer, rng_state,
sample, x, y, tile.offset, tile.stride);
}
}
@ -192,7 +200,7 @@ public:
for(int y = tile.y; y < tile.y + tile.h; y++) {
for(int x = tile.x; x < tile.x + tile.w; x++) {
kernel_cpu_path_trace(kg, render_buffer, rng_state,
kernel_cpu_path_trace(&kg, render_buffer, rng_state,
sample, x, y, tile.offset, tile.stride);
}
}
@ -212,8 +220,7 @@ public:
}
#ifdef WITH_OSL
if(kernel_osl_use(kg))
OSLShader::thread_free(kg);
OSLShader::thread_free(&kg);
#endif
}
@ -223,7 +230,7 @@ public:
if(system_cpu_support_optimized()) {
for(int y = task.y; y < task.y + task.h; y++)
for(int x = task.x; x < task.x + task.w; x++)
kernel_cpu_optimized_tonemap(kg, (uchar4*)task.rgba, (float*)task.buffer,
kernel_cpu_optimized_tonemap(&kernel_globals, (uchar4*)task.rgba, (float*)task.buffer,
task.sample, task.resolution, x, y, task.offset, task.stride);
}
else
@ -231,22 +238,23 @@ public:
{
for(int y = task.y; y < task.y + task.h; y++)
for(int x = task.x; x < task.x + task.w; x++)
kernel_cpu_tonemap(kg, (uchar4*)task.rgba, (float*)task.buffer,
kernel_cpu_tonemap(&kernel_globals, (uchar4*)task.rgba, (float*)task.buffer,
task.sample, task.resolution, x, y, task.offset, task.stride);
}
}
void thread_shader(DeviceTask& task)
{
KernelGlobals kg = kernel_globals;
#ifdef WITH_OSL
if(kernel_osl_use(kg))
OSLShader::thread_init(kg);
OSLShader::thread_init(&kg, &kernel_globals, &osl_globals);
#endif
#ifdef WITH_OPTIMIZED_KERNEL
if(system_cpu_support_optimized()) {
for(int x = task.shader_x; x < task.shader_x + task.shader_w; x++) {
kernel_cpu_optimized_shader(kg, (uint4*)task.shader_input, (float4*)task.shader_output, task.shader_eval_type, x);
kernel_cpu_optimized_shader(&kg, (uint4*)task.shader_input, (float4*)task.shader_output, task.shader_eval_type, x);
if(task_pool.cancelled())
break;
@ -256,7 +264,7 @@ public:
#endif
{
for(int x = task.shader_x; x < task.shader_x + task.shader_w; x++) {
kernel_cpu_shader(kg, (uint4*)task.shader_input, (float4*)task.shader_output, task.shader_eval_type, x);
kernel_cpu_shader(&kg, (uint4*)task.shader_input, (float4*)task.shader_output, task.shader_eval_type, x);
if(task_pool.cancelled())
break;
@ -264,8 +272,7 @@ public:
}
#ifdef WITH_OSL
if(kernel_osl_use(kg))
OSLShader::thread_free(kg);
OSLShader::thread_free(&kg);
#endif
}
@ -274,7 +281,7 @@ public:
/* split task into smaller ones, more than number of threads for uneven
* workloads where some parts of the image render slower than others */
list<DeviceTask> tasks;
task.split(tasks, TaskScheduler::num_threads()+1);
task.split(tasks, TaskScheduler::num_threads());
foreach(DeviceTask& task, tasks)
task_pool.push(new CPUDeviceTask(this, task));
@ -291,9 +298,9 @@ public:
}
};
Device *device_cpu_create(DeviceInfo& info, Stats &stats, int threads)
Device *device_cpu_create(DeviceInfo& info, Stats &stats)
{
return new CPUDevice(stats, threads);
return new CPUDevice(stats);
}
void device_cpu_info(vector<DeviceInfo>& devices)

@ -60,7 +60,7 @@ public:
return (CUdeviceptr)mem;
}
const char *cuda_error_string(CUresult result)
static const char *cuda_error_string(CUresult result)
{
switch(result) {
case CUDA_SUCCESS: return "No errors";
@ -915,12 +915,21 @@ Device *device_cuda_create(DeviceInfo& info, Stats &stats, bool background)
void device_cuda_info(vector<DeviceInfo>& devices)
{
CUresult result;
int count = 0;
if(cuInit(0) != CUDA_SUCCESS)
result = cuInit(0);
if(result != CUDA_SUCCESS) {
if(result != CUDA_ERROR_NO_DEVICE)
fprintf(stderr, "CUDA cuInit: %s\n", CUDADevice::cuda_error_string(result));
return;
if(cuDeviceGetCount(&count) != CUDA_SUCCESS)
}
result = cuDeviceGetCount(&count);
if(result != CUDA_SUCCESS) {
fprintf(stderr, "CUDA cuDeviceGetCount: %s\n", CUDADevice::cuda_error_string(result));
return;
}
vector<DeviceInfo> display_devices;

@ -23,7 +23,7 @@ CCL_NAMESPACE_BEGIN
class Device;
Device *device_cpu_create(DeviceInfo& info, Stats &stats, int threads);
Device *device_cpu_create(DeviceInfo& info, Stats &stats);
Device *device_opencl_create(DeviceInfo& info, Stats &stats, bool background);
Device *device_cuda_create(DeviceInfo& info, Stats &stats, bool background);
Device *device_network_create(DeviceInfo& info, Stats &stats, const char *address);

@ -101,7 +101,7 @@ void DeviceTask::update_progress(RenderTile &rtile)
if(update_tile_sample) {
double current_time = time_dt();
if (current_time - last_update_time >= 1.0f) {
if (current_time - last_update_time >= 1.0) {
update_tile_sample(rtile);
last_update_time = current_time;

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