Merged changes in the trunk up to revision 52340.

Conflicts resolved:
source/blender/blenloader/intern/readfile.c
This commit is contained in:
Tamito Kajiyama 2012-11-19 00:41:11 +00:00
commit b7cd9ec3ad
262 changed files with 5998 additions and 4683 deletions

@ -502,20 +502,6 @@ 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)
endif()
if(NOT EXISTS ${LIBDIR})
unset(LIBDIR)
endif()
endif()
find_package(JPEG REQUIRED)
find_package(PNG REQUIRED)
find_package(ZLIB REQUIRED)
@ -590,15 +576,8 @@ if(UNIX AND NOT APPLE)
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)
@ -654,14 +633,13 @@ 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(NOT BOOST_ROOT)
set(Boost_USE_MULTITHREADED OFF)
else()
set(Boost_USE_MULTITHREADED ON)
endif()
set(__boost_packages filesystem regex system thread)
set(__boost_packages filesystem regex system thread date_time)
if (WITH_INTERNATIONAL)
list(APPEND __boost_packages locale)
endif()
@ -676,11 +654,6 @@ 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)
set(OPENIMAGEIO_LIBRARIES ${OPENIMAGEIO_LIBRARIES} ${PNG_LIBRARIES} ${JPEG_LIBRARIES} ${ZLIB_LIBRARIES} ${BOOST_LIBRARIES})
@ -701,11 +674,6 @@ 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)
set(OPENCOLORIO_LIBRARIES ${OPENCOLORIO_LIBRARIES})
@ -718,14 +686,16 @@ 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(EXISTS "${LLVM_DIRECTORY}/bin/llvm-config")
set(LLVM_CONFIG "${LLVM_DIRECTORY}/bin/llvm-config")
else()
set(LLVM_CONFIG llvm-config)
FIND_PROGRAM(LLVM_CONFIG llvm-config-${LLVM_VERSION} HINTS ${LLVM_DIRECTORY})
if(NOT LLVM_CONFIG)
FIND_PROGRAM(LLVM_CONFIG llvm-config HINTS ${LLVM_DIRECTORY})
endif()
execute_process(COMMAND ${LLVM_CONFIG} --version
OUTPUT_VARIABLE LLVM_VERSION
@ -742,6 +712,8 @@ if(UNIX AND NOT APPLE)
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)
@ -928,7 +900,6 @@ elseif(WIN32)
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)
@ -943,8 +914,15 @@ elseif(WIN32)
endif()
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(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)
@ -1113,23 +1091,23 @@ elseif(WIN32)
if(MSVC10)
set(BOOST_LIBPATH ${BOOST}/vc2010/lib)
set(BOOST_POSTFIX "vc100-mt-s-1_49.lib")
set(BOOST_DEBUG_POSTFIX "vc100-mt-sgd-1_49.lib")
#set(BOOST_DEBUG_POSTFIX "vc100-mt-sgd-1_49.lib")
else()
set(BOOST_LIBPATH ${BOOST}/lib)
set(BOOST_POSTFIX "vc90-mt-s-1_49.lib")
set(BOOST_DEBUG_POSTFIX "vc90-mt-sgd-1_49.lib")
#set(BOOST_DEBUG_POSTFIX "vc90-mt-sgd-1_49.lib")
endif()
set(BOOST_LIBRARIES
optimized libboost_date_time-${BOOST_POSTFIX} optimized libboost_filesystem-${BOOST_POSTFIX}
optimized libboost_regex-${BOOST_POSTFIX}
optimized libboost_system-${BOOST_POSTFIX} optimized libboost_thread-${BOOST_POSTFIX}
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})
optimized libboost_system-${BOOST_POSTFIX} optimized libboost_thread-${BOOST_POSTFIX})
#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})
optimized libboost_locale-${BOOST_POSTFIX})
#debug libboost_locale-${BOOST_DEBUG_POSTFIX}
endif(WITH_INTERNATIONAL)
set(BOOST_DEFINITIONS "-DBOOST_ALL_NO_LIB")
endif()
@ -1139,7 +1117,7 @@ elseif(WIN32)
set(OPENIMAGEIO_INCLUDE_DIRS ${OPENIMAGEIO}/include)
set(OPENIMAGEIO_LIBRARIES OpenImageIO)
set(OPENIMAGEIO_LIBPATH ${OPENIMAGEIO}/lib)
set(OPENIMAGEIO_DEFINITIONS)
set(OPENIMAGEIO_DEFINITIONS "-DUSE_TBB=0")
endif()
if(WITH_OPENCOLORIO)
@ -1150,6 +1128,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

@ -306,6 +306,11 @@ if env['OURPLATFORM']=='darwin':
else:
env.Append(LINKFLAGS=['-Xlinker','-weak_framework','-Xlinker','Jackmp'])
if env['WITH_BF_CYCLES_OSL'] == 1:
# this is kinda hardcoded atm due not understood path issues, also look that we need 2 variants of passing the oslexec with the force_load option, why ?
env.Append(LINKFLAGS=['-L../lib/darwin-9.x.universal/osl/lib','-loslcomp','-force_load ../lib/darwin-9.x.universal/osl/lib/liboslexec.a','-loslquery'])
env.Append(BF_PROGRAM_LINKFLAGS=['-Xlinker','-force_load','-Xlinker','../lib/darwin-9.x.universal/osl/lib/liboslexec.a'])
if env['WITH_BF_OPENMP'] == 1:
if env['OURPLATFORM'] in ('win32-vc', 'win64-vc'):
env['CCFLAGS'].append('/openmp')
@ -577,11 +582,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
@ -725,6 +730,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')
@ -870,9 +891,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

@ -120,6 +120,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
@ -144,3 +162,4 @@ WITH_BF_OCEANSIM = True
BF_DEBUG = False
REL_CCFLAGS = ['-O2', '-msse', '-msse2'] # C & C++
PLATFORM_LINKFLAGS = ['-lrt']
BF_PROGRAM_LINKFLAGS = ['-Wl,--whole-archive', '-loslexec', '-Wl,--no-whole-archive']

@ -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
@ -143,3 +161,4 @@ WITH_BF_OCEANSIM = True
BF_DEBUG = False
REL_CCFLAGS = ['-O2', '-msse', '-msse2'] # C & C++
PLATFORM_LINKFLAGS = ['-lrt']
BF_PROGRAM_LINKFLAGS = ['-Wl,--whole-archive', '-loslexec', '-Wl,--no-whole-archive']

@ -107,6 +107,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
@ -129,3 +147,4 @@ WITH_BF_OCEANSIM = True
BF_DEBUG = False
REL_CCFLAGS = ['-O2'] # C & C++
PLATFORM_LINKFLAGS = ['-L/home/sources/staticlibs/lib32']
BF_PROGRAM_LINKFLAGS = ['-Wl,--whole-archive', '-loslexec', '-Wl,--no-whole-archive']

@ -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
@ -128,3 +146,4 @@ WITH_BF_OCEANSIM = True
BF_DEBUG = False
REL_CCFLAGS = ['-O2', '-msse', '-msse2'] # C & C++
PLATFORM_LINKFLAGS = ['-L/home/sources/staticlibs/lib64']
BF_PROGRAM_LINKFLAGS = ['-Wl,--whole-archive', '-loslexec', '-Wl,--no-whole-archive']

@ -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)

@ -222,8 +222,8 @@ def cmake_get_src(f):
'''
# reset
sources_h[:] = []
sources_c[:] = []
del sources_h[:]
del sources_c[:]
filen.close()

@ -700,7 +700,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()

@ -276,24 +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_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_LIB_INTERNATIONAL = 'boost_locale-mt'
BF_BOOST_LIBPATH = BF_BOOST + '/lib'
BF_BOOST_LIBPATH = '${BF_BOOST}/lib'
WITH_BF_CYCLES_CUDA_BINARIES = False
BF_CYCLES_CUDA_NVCC = '/usr/local/cuda/bin/nvcc'

@ -204,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
@ -214,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
@ -224,10 +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_LIB_INTERNATIONAL = 'boost_locale'
BF_BOOST_LIBPATH = BF_BOOST + '/lib'
BF_BOOST_LIBPATH = '${BF_BOOST}/lib'
WITH_BF_CYCLES = WITH_BF_OIIO and WITH_BF_BOOST

@ -150,22 +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_LIB_INTERNATIONAL = 'boost_locale-mgw46-mt-s-1_49'
BF_BOOST_LIBPATH = BF_BOOST + '/lib'
BF_BOOST_LIBPATH = '${BF_BOOST}/lib'
#Ray trace optimization
WITH_BF_RAYOPTIMIZATION = True

@ -150,6 +150,17 @@ WITH_BF_OPENMP = True
#Cycles
WITH_BF_CYCLES = True
#OSL
WITH_BF_CYCLES_OSL = False
WITH_BF_STATICOSL = 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 oslexec oslquery'
BF_OSL_LIBPATH = '${BF_OSL}/lib'
BF_OSL_COMPILER = '${BF_OSL}/bin/oslc'
WITH_BF_OIIO = True
BF_OIIO = '${LIBDIR}/openimageio'
BF_OIIO_INC = '${BF_OIIO}/include'
@ -204,7 +215,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']

@ -162,10 +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_LIB_INTERNATIONAL = ' boost_locale-mgw47-mt-s-1_49 boost_locale-mgw47-mt-sd-1_49'
BF_BOOST_LIBPATH = BF_BOOST + '/lib'
BF_BOOST_LIBPATH = '${BF_BOOST}/lib'
#Ray trace optimization
WITH_BF_RAYOPTIMIZATION = True

@ -146,19 +146,28 @@ WITH_BF_OPENMP = True
#Cycles
WITH_BF_CYCLES = True
#OSL
WITH_BF_CYCLES_OSL = False
WITH_BF_STATICOSL = 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 oslexec oslquery'
BF_OSL_LIBPATH = '${BF_OSL}/lib'
BF_OSL_COMPILER = '${BF_OSL}/bin/oslc'
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'
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'
WITH_BF_BOOST = True
BF_BOOST = '${LIBDIR}/boost'
@ -203,7 +212,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']

@ -222,6 +222,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')
@ -314,6 +324,12 @@ def setup_syslibs(lenv):
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'])
@ -580,8 +596,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
@ -636,6 +652,14 @@ def AppIt(target=None, source=None, env=None):
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)
@ -662,7 +686,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
@ -790,6 +814,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()
@ -869,6 +907,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'):

@ -164,7 +164,9 @@ def validate_arguments(args, bc):
'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_INTERNATIONAL', 'BF_BOOST_LIB_STATIC', 'BF_BOOST_LIBPATH',
'WITH_BF_LIBMV'
'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
@ -178,7 +180,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'
]
@ -500,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', []),
@ -595,7 +598,25 @@ def read_opts(env, cfg, args):
('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
@ -666,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']

@ -1259,7 +1259,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("__")]
@ -1290,7 +1290,7 @@ def pyrna2sphinx(basepath):
fw("\n")
# funcs
lines[:] = []
del lines[:]
if _BPY_STRUCT_FAKE:
for key, descr in descr_items:
@ -1313,7 +1313,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.

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);
}

@ -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,6 +36,7 @@ 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_OPENEXR_INC'].split())
incs.extend(cycles['BF_PYTHON_INC'].split())
if env['OURPLATFORM'] in ('win32-vc', 'win64-vc'):
@ -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'])

@ -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)

@ -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");

@ -301,10 +301,6 @@ __device_inline float3 path_radiance_sum(KernelGlobals *kg, PathRadiance *L)
__device_inline void path_radiance_clamp(PathRadiance *L, float3 *L_sum, float clamp)
{
#ifdef __OSL__
using std::isfinite;
#endif
float sum = fabsf((*L_sum).x) + fabsf((*L_sum).y) + fabsf((*L_sum).z);
if(!isfinite(sum)) {

@ -331,10 +331,13 @@ __device float4 kernel_path_progressive(KernelGlobals *kg, RNG *rng, int sample,
float bsdf_u = path_rng(kg, rng, sample, rng_offset + PRNG_BSDF_U);
float bsdf_v = path_rng(kg, rng, sample, rng_offset + PRNG_BSDF_V);
float ao_factor = kernel_data.background.ao_factor;
float3 ao_N;
float3 ao_bsdf = shader_bsdf_ao(kg, &sd, ao_factor, &ao_N);
float3 ao_D;
float ao_pdf;
sample_cos_hemisphere(sd.N, bsdf_u, bsdf_v, &ao_D, &ao_pdf);
sample_cos_hemisphere(ao_N, bsdf_u, bsdf_v, &ao_D, &ao_pdf);
if(dot(sd.Ng, ao_D) > 0.0f && ao_pdf != 0.0f) {
Ray light_ray;
@ -347,11 +350,8 @@ __device float4 kernel_path_progressive(KernelGlobals *kg, RNG *rng, int sample,
light_ray.time = sd.time;
#endif
if(!shadow_blocked(kg, &state, &light_ray, &ao_shadow)) {
float3 ao_bsdf = shader_bsdf_diffuse(kg, &sd)*kernel_data.background.ao_factor;
ao_bsdf += shader_bsdf_ao(kg, &sd);
if(!shadow_blocked(kg, &state, &light_ray, &ao_shadow))
path_radiance_accum_ao(&L, throughput, ao_bsdf, ao_shadow, state.bounce);
}
}
}
#endif
@ -509,10 +509,13 @@ __device void kernel_path_indirect(KernelGlobals *kg, RNG *rng, int sample, Ray
float bsdf_u = path_rng(kg, rng, sample, rng_offset + PRNG_BSDF_U);
float bsdf_v = path_rng(kg, rng, sample, rng_offset + PRNG_BSDF_V);
float ao_factor = kernel_data.background.ao_factor;
float3 ao_N;
float3 ao_bsdf = shader_bsdf_ao(kg, &sd, ao_factor, &ao_N);
float3 ao_D;
float ao_pdf;
sample_cos_hemisphere(sd.N, bsdf_u, bsdf_v, &ao_D, &ao_pdf);
sample_cos_hemisphere(ao_N, bsdf_u, bsdf_v, &ao_D, &ao_pdf);
if(dot(sd.Ng, ao_D) > 0.0f && ao_pdf != 0.0f) {
Ray light_ray;
@ -525,11 +528,8 @@ __device void kernel_path_indirect(KernelGlobals *kg, RNG *rng, int sample, Ray
light_ray.time = sd.time;
#endif
if(!shadow_blocked(kg, &state, &light_ray, &ao_shadow)) {
float3 ao_bsdf = shader_bsdf_diffuse(kg, &sd)*kernel_data.background.ao_factor;
ao_bsdf += shader_bsdf_ao(kg, &sd);
if(!shadow_blocked(kg, &state, &light_ray, &ao_shadow))
path_radiance_accum_ao(L, throughput, ao_bsdf, ao_shadow, state.bounce);
}
}
}
#endif
@ -712,6 +712,8 @@ __device float4 kernel_path_non_progressive(KernelGlobals *kg, RNG *rng, int sam
int num_samples = kernel_data.integrator.ao_samples;
float num_samples_inv = 1.0f/num_samples;
float ao_factor = kernel_data.background.ao_factor;
float3 ao_N;
float3 ao_bsdf = shader_bsdf_ao(kg, &sd, ao_factor, &ao_N);
for(int j = 0; j < num_samples; j++) {
/* todo: solve correlation */
@ -721,7 +723,7 @@ __device float4 kernel_path_non_progressive(KernelGlobals *kg, RNG *rng, int sam
float3 ao_D;
float ao_pdf;
sample_cos_hemisphere(sd.N, bsdf_u, bsdf_v, &ao_D, &ao_pdf);
sample_cos_hemisphere(ao_N, bsdf_u, bsdf_v, &ao_D, &ao_pdf);
if(dot(sd.Ng, ao_D) > 0.0f && ao_pdf != 0.0f) {
Ray light_ray;
@ -734,11 +736,8 @@ __device float4 kernel_path_non_progressive(KernelGlobals *kg, RNG *rng, int sam
light_ray.time = sd.time;
#endif
if(!shadow_blocked(kg, &state, &light_ray, &ao_shadow)) {
float3 ao_bsdf = shader_bsdf_diffuse(kg, &sd)*ao_factor;
ao_bsdf += shader_bsdf_ao(kg, &sd);
if(!shadow_blocked(kg, &state, &light_ray, &ao_shadow))
path_radiance_accum_ao(&L, throughput*num_samples_inv, ao_bsdf, ao_shadow, state.bounce);
}
}
}
}

@ -599,21 +599,35 @@ __device float3 shader_bsdf_transmission(KernelGlobals *kg, ShaderData *sd)
#endif
}
__device float3 shader_bsdf_ao(KernelGlobals *kg, ShaderData *sd)
__device float3 shader_bsdf_ao(KernelGlobals *kg, ShaderData *sd, float ao_factor, float3 *N)
{
#ifdef __MULTI_CLOSURE__
float3 eval = make_float3(0.0f, 0.0f, 0.0f);
*N = make_float3(0.0f, 0.0f, 0.0f);
for(int i = 0; i< sd->num_closure; i++) {
ShaderClosure *sc = &sd->closure[i];
if(CLOSURE_IS_AMBIENT_OCCLUSION(sc->type))
if(CLOSURE_IS_BSDF_DIFFUSE(sc->type)) {
eval += sc->weight*ao_factor;
*N += sc->N*average(sc->weight);
}
if(CLOSURE_IS_AMBIENT_OCCLUSION(sc->type)) {
eval += sc->weight;
*N += sd->N*average(sc->weight);
}
}
*N = normalize(*N);
return eval;
#else
if(CLOSURE_IS_AMBIENT_OCCLUSION(sd->closure.type))
*N = sd->N;
if(CLOSURE_IS_BSDF_DIFFUSE(sd->closure.type))
return sd->closure.weight*ao_factor;
else if(CLOSURE_IS_AMBIENT_OCCLUSION(sd->closure.type))
return sd->closure.weight;
else
return make_float3(0.0f, 0.0f, 0.0f);

@ -0,0 +1,27 @@
#!/usr/bin/python
Import('env')
defs = []
incs = []
cxxflags = Split(env['CXXFLAGS'])
sources = env.Glob('*.cpp')
incs.extend('. .. ../svm ../../render ../../util ../../device'.split())
incs.append(env['BF_OIIO_INC'])
incs.append(env['BF_BOOST_INC'])
incs.append(env['BF_OSL_INC'])
incs.append(env['BF_OPENEXR_INC'].split())
defs.append('CCL_NAMESPACE_BEGIN=namespace ccl {')
defs.append('CCL_NAMESPACE_END=}')
defs.append('WITH_OSL')
if env['OURPLATFORM'] in ('win32-vc', 'win64-vc'):
cxxflags.append('-DBOOST_NO_RTTI -DBOOST_NO_TYPEID'.split())
incs.append(env['BF_PTHREADS_INC'])
else:
cxxflags.append('-fno-rtti -DBOOST_NO_RTTI -DBOOST_NO_TYPEID'.split())
env.BlenderLib ('cycles_kernel_osl', sources, incs, defs, libtype=['intern'], priority=[10], cxx_compileflags=cxxflags)

@ -22,12 +22,17 @@
#ifdef WITH_OSL
#include <OSL/oslexec.h>
#include <cmath>
#include "util_map.h"
#include "util_param.h"
#include "util_thread.h"
#include "util_vector.h"
#ifndef WIN32
using std::isfinite;
#endif
CCL_NAMESPACE_BEGIN
class OSLRenderServices;

@ -89,7 +89,7 @@ foreach(_file ${SRC_OSL})
list(APPEND SRC_OSO
${_OSO_FILE}
)
unset(_OSL_FILE)
unset(_OSO_FILE)
endforeach()

@ -0,0 +1,45 @@
#!/usr/bin/python
import sys
import os
import Blender as B
def normpath(path):
return os.path.abspath(os.path.normpath(path))
Import ('env')
oso_files = []
if env['WITH_BF_CYCLES_OSL']:
shaders = env.Clone()
# osl compiler info
if env['OURPLATFORM']=='darwin':
osl_compiler = '../lib/darwin-9.x.universal/osl/bin/oslc' # temporary hack to get the leading "#" away that breaks shadercompile
else:
osl_compiler = env['BF_OSL_COMPILER']
# build directory
root_build_dir = normpath(env['BF_BUILDDIR'])
build_dir = os.path.join(root_build_dir, 'intern/cycles/kernel/shaders')
# source directories and files
source_dir = Dir('.').srcnode().path
# dependencies
dependencies = shaders.Glob('*.h')
for f in os.listdir(source_dir):
if f.endswith('.osl'):
osl_file = os.path.join(source_dir, f)
oso_file = os.path.join(build_dir, f.replace('.osl', '.oso'))
command = "%s -O2 -I%s -o %s %s" % (osl_compiler, source_dir, oso_file, osl_file)
shaders.Command(oso_file, f, command)
shaders.Depends(oso_file, [f] + dependencies)
oso_files.append(oso_file)
Return('oso_files')

@ -19,6 +19,7 @@
#include "stdosl.h"
shader node_ambient_occlusion(
normal NormalIn = N,
color Color = color(0.8, 0.8, 0.8),
output closure color AO = ambient_occlusion())
{

@ -1578,6 +1578,8 @@ void HoldoutNode::compile(OSLCompiler& compiler)
AmbientOcclusionNode::AmbientOcclusionNode()
: ShaderNode("ambient_occlusion")
{
add_input("NormalIn", SHADER_SOCKET_NORMAL, ShaderInput::NORMAL, true);
add_input("Color", SHADER_SOCKET_COLOR, make_float3(0.8f, 0.8f, 0.8f));
add_output("AO", SHADER_SOCKET_CLOSURE);
}

@ -75,7 +75,7 @@ protected:
* Boost implementation is a bit slow, and Mac OS X __thread is not supported
* but the pthreads implementation is optimized, so we use these macros. */
#ifdef __APPLE__
#if defined(__APPLE__) || defined(_WIN32)
#define tls_ptr(type, name) \
pthread_key_t name
@ -90,10 +90,6 @@ protected:
#else
#ifdef __WIN32
#define __thread __declspec(thread)
#endif
#define tls_ptr(type, name) \
__thread type *name
#define tls_set(name, value) \

@ -1591,13 +1591,17 @@ GHOST_TSuccess GHOST_SystemCocoa::handleMouseEvent(void *eventPtr)
if ((dx == 0) && (dy == 0)) break;
/* Quadratic acceleration */
dx = dx*(fabs(dx)+0.5);
if (dx<0.0) dx-=0.5; else dx+=0.5;
if (dx< -deltaMax) dx= -deltaMax; else if (dx>deltaMax) dx=deltaMax;
dx = dx*(fabs(dx) + 0.5);
if (dx < 0.0) dx -= 0.5;
else dx += 0.5;
if (dx < -deltaMax) dx = -deltaMax;
else if (dx > deltaMax) dx = deltaMax;
dy = dy*(fabs(dy)+0.5);
if (dy<0.0) dy-=0.5; else dy+=0.5;
if (dy< -deltaMax) dy= -deltaMax; else if (dy>deltaMax) dy=deltaMax;
dy = dy*(fabs(dy) + 0.5);
if (dy < 0.0) dy -= 0.5;
else dy += 0.5;
if (dy < -deltaMax) dy= -deltaMax;
else if (dy > deltaMax) dy= deltaMax;
window->clientToScreenIntern(mousePos.x, mousePos.y, x, y);
dy = -dy;

@ -232,7 +232,6 @@ def enable(module_name, default_set=True, persistent=False):
import os
import sys
import imp
def handle_error():
import traceback
@ -246,6 +245,7 @@ def enable(module_name, default_set=True, persistent=False):
mtime_orig = getattr(mod, "__time__", 0)
mtime_new = os.path.getmtime(mod.__file__)
if mtime_orig != mtime_new:
import imp
print("module changed on disk:", mod.__file__, "reloading...")
try:

@ -216,7 +216,7 @@ def load_scripts(reload_scripts=False, refresh_scripts=False):
for mod in _global_loaded_modules:
test_reload(mod)
_global_loaded_modules[:] = []
del _global_loaded_modules[:]
for base_path in script_paths():
for path_subdir in _script_module_dirs:

@ -223,7 +223,7 @@ def edge_loops_from_tessfaces(mesh, tessfaces=None, seams=()):
else:
other_dir = None
ed_adj[:] = []
del ed_adj[:]
flipped = False
@ -235,22 +235,22 @@ def edge_loops_from_tessfaces(mesh, tessfaces=None, seams=()):
if other_dir and flipped is False:
flipped = True # only flip the list once
context_loop.reverse()
ed_adj[:] = []
del ed_adj[:]
context_loop.append(other_dir) # save 1 look-up
ed_adj = edges[context_loop[-1]]
if len(ed_adj) != 2:
ed_adj[:] = []
del ed_adj[:]
break
else:
ed_adj[:] = []
del ed_adj[:]
break
i = ed_adj.index(context_loop[-2])
context_loop.append(ed_adj[not i])
# Dont look at this again
ed_adj[:] = []
del ed_adj[:]
return edge_loops
@ -436,7 +436,7 @@ def ngon_tessellate(from_data, indices, fix_loops=True):
if s1[0][1] == s1[-1][1]: # remove endpoints double
s1.pop()
s2[:] = [] # Empty this segment s2 so we don't use it again.
del s2[:] # Empty this segment s2 so we don't use it again.
return True
joining_segments = True

@ -558,7 +558,7 @@ class WM_MT_operator_presets(Menu):
# dummy 'default' menu item
layout = self.layout
layout.operator("wm.operator_defaults")
layout.seperator()
layout.separator()
Menu.draw_preset(self, context)

@ -116,8 +116,12 @@ class PlayRenderedAnim(Operator):
cmd = [player_path]
# extra options, fps controls etc.
if preset in {'BLENDER24', 'INTERNAL'}:
opts = ["-a", "-f", str(rd.fps), str(rd.fps_base),
"-j", str(scene.frame_step), file]
opts = ["-a",
"-f", str(rd.fps), str(rd.fps_base),
"-s", str(scene.frame_start),
"-e", str(scene.frame_end),
"-j", str(scene.frame_step),
file]
cmd.extend(opts)
elif preset == 'DJV':
opts = [file, "-playback_speed", "%d" % int(rd.fps / rd.fps_base)]

@ -517,7 +517,7 @@ def mergeUvIslands(islandList):
for uv in f.uv:
uv+= offset
sourceIsland[0][:] = [] # Empty
del sourceIsland[0][:] # Empty
# Move edge loop into new and offset.
@ -527,7 +527,7 @@ def mergeUvIslands(islandList):
(e[0]+offset, e[1]+offset, e[2])\
) for e in sourceIsland[6] ] )
sourceIsland[6][:] = [] # Empty
del sourceIsland[6][:] # Empty
# Sort by edge length, reverse so biggest are first.
@ -540,7 +540,7 @@ def mergeUvIslands(islandList):
for p in sourceIsland[7]:
p+= offset
sourceIsland[7][:] = []
del sourceIsland[7][:]
# Decrement the efficiency

@ -41,12 +41,17 @@ class MESH_OT_delete_edgeloop(Operator):
return bpy.ops.transform.edge_slide.poll()
def execute(self, context):
mesh = context.object.data
use_mirror_x = mesh.use_mirror_x
mesh.use_mirror_x = False
if 'FINISHED' in bpy.ops.transform.edge_slide(value=1.0):
bpy.ops.mesh.select_more()
bpy.ops.mesh.remove_doubles()
return {'FINISHED'}
return {'CANCELLED'}
ret = {'FINISHED'}
else:
ret = {'CANCELLED'}
mesh.use_mirror_x = use_mirror_x
return ret
rna_path_prop = StringProperty(
name="Context Attributes",

@ -98,7 +98,7 @@ void *avi_converter_from_avi_rgb(AviMovie *movie, int stream, unsigned char *buf
buf = MEM_mallocN(movie->header->Height * movie->header->Width * 3, "fromavirgbbuf");
rowstride = movie->header->Width * 3;
if (bits != 16) if (movie->header->Width % 2) rowstride++;
if ((bits != 16) && (movie->header->Width % 2)) rowstride++;
for (y = 0; y < movie->header->Height; y++) {
memcpy(&buf[y * movie->header->Width * 3], &buffer[((movie->header->Height - 1) - y) * rowstride], movie->header->Width * 3);

@ -48,6 +48,9 @@ struct Main;
#define IMA_MAX_SPACE 64
void BKE_images_init(void);
void BKE_images_exit(void);
/* call from library */
void BKE_image_free(struct Image *me);
@ -133,14 +136,13 @@ enum {
#define IMA_CHAN_FLAG_RGB 2
#define IMA_CHAN_FLAG_ALPHA 4
/* depending Image type, and (optional) ImageUser setting it returns ibuf */
/* always call to make signals work */
struct ImBuf *BKE_image_get_ibuf(struct Image *ima, struct ImageUser *iuser);
/* checks whether there's an image buffer for given image and user */
int BKE_image_has_ibuf(struct Image *ima, struct ImageUser *iuser);
/* same as above, but can be used to retrieve images being rendered in
* a thread safe way, always call both acquire and release */
struct ImBuf *BKE_image_acquire_ibuf(struct Image *ima, struct ImageUser *iuser, void **lock_r);
void BKE_image_release_ibuf(struct Image *ima, void *lock);
void BKE_image_release_ibuf(struct Image *ima, struct ImBuf *ibuf, void *lock);
/* returns a new image or NULL if it can't load */
struct Image *BKE_image_load(const char *filepath);

@ -706,6 +706,8 @@ void ntreeGPUMaterialNodes(struct bNodeTree *ntree, struct GPUMateria
#define CMP_NODE_SWITCH 317
#define CMP_NODE_PIXELATE 318
#define CMP_NODE_MAP_RANGE 319
/* channel toggles */
#define CMP_CHAN_RGB 1
#define CMP_CHAN_A 2

@ -83,7 +83,7 @@ void txt_sel_line (struct Text *text);
char* txt_sel_to_buf (struct Text *text);
void txt_insert_buf (struct Text *text, const char *in_buffer);
void txt_print_undo (struct Text *text);
void txt_undo_add_toop (struct Text *text, int op, unsigned int froml, unsigned short fromc, unsigned int tol, unsigned short toc);
void txt_undo_add_op (struct Text *text, int op);
void txt_do_undo (struct Text *text);
void txt_do_redo (struct Text *text);
void txt_split_curline (struct Text *text);
@ -123,24 +123,6 @@ enum {
/* Undo opcodes */
/* Simple main cursor movement */
#define UNDO_CLEFT 001
#define UNDO_CRIGHT 002
#define UNDO_CUP 003
#define UNDO_CDOWN 004
/* Simple selection cursor movement */
#define UNDO_SLEFT 005
#define UNDO_SRIGHT 006
#define UNDO_SUP 007
#define UNDO_SDOWN 010
/* Complex movement (opcode is followed
* by 4 character line ID + a 2 character
* position ID and opcode (repeat)) */
#define UNDO_CTO 011
#define UNDO_STO 012
/* Complex editing */
/* 1 - opcode is followed by 1 byte for ascii character and opcode (repeat)) */
/* 2 - opcode is followed by 2 bytes for utf-8 character and opcode (repeat)) */
@ -169,8 +151,6 @@ enum {
#define UNDO_IBLOCK 030 /* Insert block */
/* Misc */
#define UNDO_SWAP 031 /* Swap cursors */
#define UNDO_INDENT 032
#define UNDO_UNINDENT 033
#define UNDO_COMMENT 034

@ -70,6 +70,7 @@
#include "BKE_displist.h"
#include "BKE_global.h"
#include "BKE_idprop.h"
#include "BKE_image.h"
#include "BKE_ipo.h"
#include "BKE_library.h"
#include "BKE_main.h"
@ -113,6 +114,7 @@ void free_blender(void)
BKE_spacetypes_free(); /* after free main, it uses space callbacks */
IMB_exit();
BKE_images_exit();
BLI_callback_global_finalize();

@ -1287,8 +1287,6 @@ unsigned int *BKE_brush_gen_texture_cache(Brush *br, int half_side)
texcache = MEM_callocN(sizeof(int) * side * side, "Brush texture cache");
BKE_image_get_ibuf(mtex->tex->ima, NULL);
/*do normalized cannonical view coords for texture*/
for (y = -1.0, iy = 0; iy < side; iy++, y += step) {
for (x = -1.0, ix = 0; ix < side; ix++, x += step) {

@ -44,6 +44,7 @@
#include "BLI_listbase.h"
#include "BLI_string.h"
#include "BLI_threads.h"
#include "BLI_utildefines.h"
#include "BKE_context.h"
@ -245,6 +246,10 @@ static void *ctx_wm_python_context_get(const bContext *C, const char *member, vo
(void)C, (void)member;
#endif
/* don't allow UI context access from non-main threads */
if (!BLI_thread_is_main())
return NULL;
return fall_through;
}
@ -264,6 +269,11 @@ static int ctx_data_get(bContext *C, const char *member, bContextDataResult *res
// return 1;
}
#endif
/* don't allow UI context access from non-main threads */
if (!BLI_thread_is_main())
return done;
/* we check recursion to ensure that we do not get infinite
* loops requesting data from ourselfs in a context callback */

@ -1116,7 +1116,7 @@ void BKE_nurb_makeCurve(Nurb *nu, float *coord_array, float *tilt_array, float *
*fp = basisu[i] * bp->vec[3];
sumdiv += *fp;
}
if (sumdiv != 0.0f) if (sumdiv < 0.999f || sumdiv > 1.001f) {
if ((sumdiv != 0.0f) && (sumdiv < 0.999f || sumdiv > 1.001f)) {
/* is normalizing needed? */
fp = sum;
for (i = istart; i <= iend; i++, fp++) {

@ -761,7 +761,7 @@ static void layerDoMinMax_mloopuv(void *data, void *vmin, void *vmax)
{
MLoopUV *min = vmin, *max = vmax, *luv = data;
DO_MINMAX2(luv->uv, min->uv, max->uv);
minmax_v2v2_v2(min->uv, max->uv, luv->uv);
}
static void layerAdd_mloopuv(void *data1, void *data2)
@ -833,7 +833,7 @@ static void layerDoMinMax_mloop_origspace(void *data, void *vmin, void *vmax)
{
OrigSpaceLoop *min = vmin, *max = vmax, *luv = data;
DO_MINMAX2(luv->uv, min->uv, max->uv);
minmax_v2v2_v2(min->uv, max->uv, luv->uv);
}
static void layerAdd_mloop_origspace(void *data1, void *data2)

@ -100,6 +100,8 @@
#include "WM_api.h"
static SpinLock image_spin;
/* max int, to indicate we don't store sequences in ibuf */
#define IMA_NO_INDEX 0x7FEFEFEF
@ -108,6 +110,16 @@
#define IMA_INDEX_FRAME(index) (index >> 10)
#define IMA_INDEX_PASS(index) (index & ~1023)
void BKE_images_init(void)
{
BLI_spin_init(&image_spin);
}
void BKE_images_exit(void)
{
BLI_spin_end(&image_spin);
}
/* ******** IMAGE PROCESSING ************* */
static void de_interlace_ng(struct ImBuf *ibuf) /* neogeo fields */
@ -168,13 +180,14 @@ static void de_interlace_st(struct ImBuf *ibuf) /* standard fields */
void BKE_image_de_interlace(Image *ima, int odd)
{
ImBuf *ibuf = BKE_image_get_ibuf(ima, NULL);
ImBuf *ibuf = BKE_image_acquire_ibuf(ima, NULL, NULL);
if (ibuf) {
if (odd)
de_interlace_st(ibuf);
else
de_interlace_ng(ibuf);
}
BKE_image_release_ibuf(ima, ibuf, NULL);
}
/* ***************** ALLOC & FREE, DATA MANAGING *************** */
@ -260,8 +273,9 @@ static ImBuf *image_get_ibuf(Image *ima, int index, int frame)
/* this function is intended to be thread safe. with IMA_NO_INDEX this
* should be OK, but when iterating over the list this is more tricky
* */
if (index == IMA_NO_INDEX)
if (index == IMA_NO_INDEX) {
return ima->ibufs.first;
}
else {
ImBuf *ibuf;
@ -269,9 +283,9 @@ static ImBuf *image_get_ibuf(Image *ima, int index, int frame)
for (ibuf = ima->ibufs.first; ibuf; ibuf = ibuf->next)
if (ibuf->index == index)
return ibuf;
return NULL;
}
return NULL;
}
/* no ima->ibuf anymore, but listbase */
@ -534,7 +548,7 @@ int BKE_image_scale(Image *image, int width, int height)
ibuf->userflags |= IB_BITMAPDIRTY;
}
BKE_image_release_ibuf(image, lock);
BKE_image_release_ibuf(image, ibuf, lock);
return (ibuf != NULL);
}
@ -2081,6 +2095,8 @@ void BKE_image_signal(Image *ima, ImageUser *iuser, int signal)
if (ima == NULL)
return;
BLI_spin_lock(&image_spin);
switch (signal) {
case IMA_SIGNAL_FREE:
image_free_buffers(ima);
@ -2157,6 +2173,8 @@ void BKE_image_signal(Image *ima, ImageUser *iuser, int signal)
break;
}
BLI_spin_unlock(&image_spin);
/* don't use notifiers because they are not 100% sure to succeeded
* this also makes sure all scenes are accounted for. */
{
@ -2320,7 +2338,7 @@ static ImBuf *image_load_sequence_file(Image *ima, ImageUser *iuser, int frame)
if (ibuf) {
#ifdef WITH_OPENEXR
/* handle multilayer case, don't assign ibuf. will be handled in BKE_image_get_ibuf */
/* handle multilayer case, don't assign ibuf. will be handled in BKE_image_acquire_ibuf */
if (ibuf->ftype == OPENEXR && ibuf->userdata) {
image_create_multilayer(ima, ibuf, frame);
ima->type = IMA_TYPE_MULTILAYER;
@ -2482,7 +2500,7 @@ static ImBuf *image_load_image_file(Image *ima, ImageUser *iuser, int cfra)
}
if (ibuf) {
/* handle multilayer case, don't assign ibuf. will be handled in BKE_image_get_ibuf */
/* handle multilayer case, don't assign ibuf. will be handled in BKE_image_acquire_ibuf */
if (ibuf->ftype == OPENEXR && ibuf->userdata) {
image_create_multilayer(ima, ibuf, cfra);
ima->type = IMA_TYPE_MULTILAYER;
@ -2751,38 +2769,32 @@ static ImBuf *image_get_ibuf_threadsafe(Image *ima, ImageUser *iuser, int *frame
* a big bottleneck */
}
*frame_r = frame;
*index_r = index;
if (frame_r)
*frame_r = frame;
if (index_r)
*index_r = index;
return ibuf;
}
/* Checks optional ImageUser and verifies/creates ImBuf. */
/* use this one if you want to get a render result in progress,
* if not, use BKE_image_get_ibuf which doesn't require a release */
ImBuf *BKE_image_acquire_ibuf(Image *ima, ImageUser *iuser, void **lock_r)
/* Checks optional ImageUser and verifies/creates ImBuf.
*
* not thread-safe, so callee should worry about thread locks
*/
static ImBuf *image_acquire_ibuf(Image *ima, ImageUser *iuser, void **lock_r)
{
ImBuf *ibuf = NULL;
float color[] = {0, 0, 0, 1};
int frame = 0, index = 0;
/* This function is intended to be thread-safe. It postpones the mutex lock
* until it needs to load the image, if the image is already there it
* should just get the pointer and return. The reason is that a lot of mutex
* locks appears to be very slow on certain multicore macs, causing a render
* with image textures to actually slow down as more threads are used.
*
* Note that all the image loading functions should also make sure they do
* things in a threadsafe way for image_get_ibuf_threadsafe to work correct.
* That means, the last two steps must be, 1) add the ibuf to the list and
* 2) set ima/iuser->ok to 0 to IMA_OK_LOADED */
if (lock_r)
*lock_r = NULL;
/* quick reject tests */
if (ima == NULL)
return NULL;
if (iuser) {
if (iuser->ok == 0)
return NULL;
@ -2790,95 +2802,71 @@ ImBuf *BKE_image_acquire_ibuf(Image *ima, ImageUser *iuser, void **lock_r)
else if (ima->ok == 0)
return NULL;
/* try to get the ibuf without locking */
ibuf = image_get_ibuf_threadsafe(ima, iuser, &frame, &index);
if (ibuf == NULL) {
/* couldn't get ibuf and image is not ok, so let's lock and try to
* load the image */
BLI_lock_thread(LOCK_IMAGE);
/* need to check ok flag and loading ibuf again, because the situation
* might have changed in the meantime */
if (iuser) {
if (iuser->ok == 0) {
BLI_unlock_thread(LOCK_IMAGE);
return NULL;
/* we are sure we have to load the ibuf, using source and type */
if (ima->source == IMA_SRC_MOVIE) {
/* source is from single file, use flipbook to store ibuf */
ibuf = image_load_movie_file(ima, iuser, frame);
}
else if (ima->source == IMA_SRC_SEQUENCE) {
if (ima->type == IMA_TYPE_IMAGE) {
/* regular files, ibufs in flipbook, allows saving */
ibuf = image_load_sequence_file(ima, iuser, frame);
}
/* no else; on load the ima type can change */
if (ima->type == IMA_TYPE_MULTILAYER) {
/* only 1 layer/pass stored in imbufs, no exrhandle anim storage, no saving */
ibuf = image_load_sequence_multilayer(ima, iuser, frame);
}
}
else if (ima->ok == 0) {
BLI_unlock_thread(LOCK_IMAGE);
return NULL;
else if (ima->source == IMA_SRC_FILE) {
if (ima->type == IMA_TYPE_IMAGE)
ibuf = image_load_image_file(ima, iuser, frame); /* cfra only for '#', this global is OK */
/* no else; on load the ima type can change */
if (ima->type == IMA_TYPE_MULTILAYER)
/* keeps render result, stores ibufs in listbase, allows saving */
ibuf = image_get_ibuf_multilayer(ima, iuser);
}
ibuf = image_get_ibuf_threadsafe(ima, iuser, &frame, &index);
if (ibuf == NULL) {
/* we are sure we have to load the ibuf, using source and type */
if (ima->source == IMA_SRC_MOVIE) {
/* source is from single file, use flipbook to store ibuf */
ibuf = image_load_movie_file(ima, iuser, frame);
else if (ima->source == IMA_SRC_GENERATED) {
/* generated is: ibuf is allocated dynamically */
/* UV testgrid or black or solid etc */
if (ima->gen_x == 0) ima->gen_x = 1024;
if (ima->gen_y == 0) ima->gen_y = 1024;
ibuf = add_ibuf_size(ima->gen_x, ima->gen_y, ima->name, 24, (ima->gen_flag & IMA_GEN_FLOAT) != 0, ima->gen_type,
color, &ima->colorspace_settings);
image_assign_ibuf(ima, ibuf, IMA_NO_INDEX, 0);
ima->ok = IMA_OK_LOADED;
}
else if (ima->source == IMA_SRC_VIEWER) {
if (ima->type == IMA_TYPE_R_RESULT) {
/* always verify entirely, and potentially
* returns pointer to release later */
ibuf = image_get_render_result(ima, iuser, lock_r);
}
else if (ima->source == IMA_SRC_SEQUENCE) {
if (ima->type == IMA_TYPE_IMAGE) {
/* regular files, ibufs in flipbook, allows saving */
ibuf = image_load_sequence_file(ima, iuser, frame);
}
/* no else; on load the ima type can change */
if (ima->type == IMA_TYPE_MULTILAYER) {
/* only 1 layer/pass stored in imbufs, no exrhandle anim storage, no saving */
ibuf = image_load_sequence_multilayer(ima, iuser, frame);
}
}
else if (ima->source == IMA_SRC_FILE) {
else if (ima->type == IMA_TYPE_COMPOSITE) {
/* requires lock/unlock, otherwise don't return image */
if (lock_r) {
/* unlock in BKE_image_release_ibuf */
BLI_lock_thread(LOCK_VIEWER);
*lock_r = ima;
if (ima->type == IMA_TYPE_IMAGE)
ibuf = image_load_image_file(ima, iuser, frame); /* cfra only for '#', this global is OK */
/* no else; on load the ima type can change */
if (ima->type == IMA_TYPE_MULTILAYER)
/* keeps render result, stores ibufs in listbase, allows saving */
ibuf = image_get_ibuf_multilayer(ima, iuser);
/* XXX anim play for viewer nodes not yet supported */
frame = 0; // XXX iuser?iuser->framenr:0;
ibuf = image_get_ibuf(ima, 0, frame);
}
else if (ima->source == IMA_SRC_GENERATED) {
/* generated is: ibuf is allocated dynamically */
/* UV testgrid or black or solid etc */
if (ima->gen_x == 0) ima->gen_x = 1024;
if (ima->gen_y == 0) ima->gen_y = 1024;
ibuf = add_ibuf_size(ima->gen_x, ima->gen_y, ima->name, 24, (ima->gen_flag & IMA_GEN_FLOAT) != 0, ima->gen_type,
color, &ima->colorspace_settings);
image_assign_ibuf(ima, ibuf, IMA_NO_INDEX, 0);
ima->ok = IMA_OK_LOADED;
}
else if (ima->source == IMA_SRC_VIEWER) {
if (ima->type == IMA_TYPE_R_RESULT) {
/* always verify entirely, and potentially
* returns pointer to release later */
ibuf = image_get_render_result(ima, iuser, lock_r);
}
else if (ima->type == IMA_TYPE_COMPOSITE) {
/* requires lock/unlock, otherwise don't return image */
if (lock_r) {
/* unlock in BKE_image_release_ibuf */
BLI_lock_thread(LOCK_VIEWER);
*lock_r = ima;
/* XXX anim play for viewer nodes not yet supported */
frame = 0; // XXX iuser?iuser->framenr:0;
ibuf = image_get_ibuf(ima, 0, frame);
if (!ibuf) {
/* Composite Viewer, all handled in compositor */
/* fake ibuf, will be filled in compositor */
ibuf = IMB_allocImBuf(256, 256, 32, IB_rect);
image_assign_ibuf(ima, ibuf, 0, frame);
}
if (!ibuf) {
/* Composite Viewer, all handled in compositor */
/* fake ibuf, will be filled in compositor */
ibuf = IMB_allocImBuf(256, 256, 32, IB_rect);
image_assign_ibuf(ima, ibuf, 0, frame);
}
}
}
}
BLI_unlock_thread(LOCK_IMAGE);
}
BKE_image_tag_time(ima);
@ -2886,23 +2874,66 @@ ImBuf *BKE_image_acquire_ibuf(Image *ima, ImageUser *iuser, void **lock_r)
return ibuf;
}
void BKE_image_release_ibuf(Image *ima, void *lock)
/* return image buffer for given image and user
*
* - will lock render result if image type is render result and lock is not NULL
* - will return NULL if image type if render or composite result and lock is NULL
*
* references the result, BKE_image_release_ibuf should be used to de-reference
*/
ImBuf *BKE_image_acquire_ibuf(Image *ima, ImageUser *iuser, void **lock_r)
{
/* for getting image during threaded render / compositing, need to release */
if (lock == ima) {
BLI_unlock_thread(LOCK_VIEWER); /* viewer image */
ImBuf *ibuf;
BLI_spin_lock(&image_spin);
ibuf = image_acquire_ibuf(ima, iuser, lock_r);
if (ibuf)
IMB_refImBuf(ibuf);
BLI_spin_unlock(&image_spin);
return ibuf;
}
void BKE_image_release_ibuf(Image *ima, ImBuf *ibuf, void *lock)
{
if (lock) {
/* for getting image during threaded render / compositing, need to release */
if (lock == ima) {
BLI_unlock_thread(LOCK_VIEWER); /* viewer image */
}
else if (lock) {
RE_ReleaseResultImage(lock); /* render result */
BLI_unlock_thread(LOCK_VIEWER); /* view image imbuf */
}
}
else if (lock) {
RE_ReleaseResultImage(lock); /* render result */
BLI_unlock_thread(LOCK_VIEWER); /* view image imbuf */
if (ibuf) {
BLI_spin_lock(&image_spin);
IMB_freeImBuf(ibuf);
BLI_spin_unlock(&image_spin);
}
}
/* warning, this can allocate generated images */
ImBuf *BKE_image_get_ibuf(Image *ima, ImageUser *iuser)
/* checks whether there's an image buffer for given image and user */
int BKE_image_has_ibuf(Image *ima, ImageUser *iuser)
{
/* here (+fie_ima/2-1) makes sure that division happens correctly */
return BKE_image_acquire_ibuf(ima, iuser, NULL);
ImBuf *ibuf = image_get_ibuf_threadsafe(ima, iuser, NULL, NULL);
if (!ibuf) {
BLI_spin_lock(&image_spin);
ibuf = image_get_ibuf_threadsafe(ima, iuser, NULL, NULL);
if (!ibuf)
ibuf = image_acquire_ibuf(ima, iuser, NULL);
BLI_spin_unlock(&image_spin);
}
return ibuf != NULL;
}
int BKE_image_user_frame_get(const ImageUser *iuser, int cfra, int fieldnr, short *r_is_in_range)
@ -3020,7 +3051,7 @@ int BKE_image_has_alpha(struct Image *image)
ibuf = BKE_image_acquire_ibuf(image, NULL, &lock);
planes = (ibuf ? ibuf->planes : 0);
BKE_image_release_ibuf(image, lock);
BKE_image_release_ibuf(image, ibuf, lock);
if (planes == 32)
return 1;
@ -3044,7 +3075,7 @@ void BKE_image_get_size(Image *image, ImageUser *iuser, int *width, int *height)
*height = IMG_SIZE_FALLBACK;
}
BKE_image_release_ibuf(image, lock);
BKE_image_release_ibuf(image, ibuf, lock);
}
void BKE_image_get_size_fl(Image *image, ImageUser *iuser, float size[2])

@ -1535,7 +1535,9 @@ void test_idbutton(char *name)
/* search for id */
idtest = BLI_findstring(lb, name, offsetof(ID, name) + 2);
if (idtest) if (new_id(lb, idtest, name) == 0) id_sort_by_name(lb, idtest);
if (idtest && (new_id(lb, idtest, name) == 0)) {
id_sort_by_name(lb, idtest);
}
}
void text_idbutton(struct ID *id, char *text)

@ -289,10 +289,10 @@ static void feather_bucket_check_intersect(float (*feather_points)[2], int tot_f
/* collapse loop with smaller AABB */
for (k = 0; k < tot_feather_point; k++) {
if (k >= check_b && k <= cur_a) {
DO_MINMAX2(feather_points[k], min_a, max_a);
minmax_v2v2_v2(min_a, max_a, feather_points[k]);
}
else {
DO_MINMAX2(feather_points[k], min_b, max_b);
minmax_v2v2_v2(min_b, max_b, feather_points[k]);
}
}
@ -379,7 +379,7 @@ void BKE_mask_spline_feather_collapse_inner_loops(MaskSpline *spline, float (*fe
int next = i + 1;
float delta;
DO_MINMAX2(feather_points[i], min, max);
minmax_v2v2_v2(min, max, feather_points[i]);
if (next == tot_feather_point) {
if (spline->flag & MASK_SPLINE_CYCLIC)

@ -2184,6 +2184,7 @@ static void registerCompositNodes(bNodeTreeType *ttype)
register_node_type_cmp_normal(ttype);
register_node_type_cmp_curve_vec(ttype);
register_node_type_cmp_map_value(ttype);
register_node_type_cmp_map_range(ttype);
register_node_type_cmp_normalize(ttype);
register_node_type_cmp_filter(ttype);

@ -3786,14 +3786,22 @@ static int get_particle_uv(DerivedMesh *dm, ParticleData *pa, int face_index, co
return 1;
}
#define SET_PARTICLE_TEXTURE(type, pvalue, texfac) \
if ((event & mtex->mapto) & type) { pvalue = texture_value_blend(def, pvalue, value, texfac, blend); } (void)0
#define SET_PARTICLE_TEXTURE(type, pvalue, texfac) \
if ((event & mtex->mapto) & type) { \
pvalue = texture_value_blend(def, pvalue, value, texfac, blend); \
} (void)0
#define CLAMP_PARTICLE_TEXTURE_POS(type, pvalue) \
if (event & type) { if (pvalue < 0.0f) pvalue = 1.0f + pvalue; CLAMP(pvalue, 0.0f, 1.0f); } (void)0
#define CLAMP_PARTICLE_TEXTURE_POS(type, pvalue) \
if (event & type) { \
if (pvalue < 0.0f) \
pvalue = 1.0f + pvalue; \
CLAMP(pvalue, 0.0f, 1.0f); \
} (void)0
#define CLAMP_PARTICLE_TEXTURE_POSNEG(type, pvalue) \
if (event & type) { CLAMP(pvalue, -1.0f, 1.0f); } (void)0
#define CLAMP_PARTICLE_TEXTURE_POSNEG(type, pvalue) \
if (event & type) { \
CLAMP(pvalue, -1.0f, 1.0f); \
} (void)0
static void get_cpa_texture(DerivedMesh *dm, ParticleSystem *psys, ParticleSettings *part, ParticleData *par, int child_index, int face_index, const float fw[4], float *orco, ParticleTexture *ptex, int event, float cfra)
{
@ -3802,8 +3810,8 @@ static void get_cpa_texture(DerivedMesh *dm, ParticleSystem *psys, ParticleSetti
float value, rgba[4], texvec[3];
ptex->ivel = ptex->life = ptex->exist = ptex->size = ptex->damp =
ptex->gravity = ptex->field = ptex->time = ptex->clump = ptex->kink =
ptex->effector = ptex->rough1 = ptex->rough2 = ptex->roughe = 1.f;
ptex->gravity = ptex->field = ptex->time = ptex->clump = ptex->kink =
ptex->effector = ptex->rough1 = ptex->rough2 = ptex->roughe = 1.0f;
ptex->length = 1.0f - part->randlength * PSYS_FRAND(child_index + 26);
ptex->length *= part->clength_thres < PSYS_FRAND(child_index + 27) ? part->clength : 1.0f;

@ -2568,10 +2568,12 @@ int BKE_ptcache_id_reset(Scene *scene, PTCacheID *pid, int mode)
sbFreeSimulation(pid->calldata);
else if (pid->type == PTCACHE_TYPE_PARTICLES)
psys_reset(pid->calldata, PSYS_RESET_DEPSGRAPH);
/*else if (pid->type == PTCACHE_TYPE_SMOKE_DOMAIN)
#if 0
else if (pid->type == PTCACHE_TYPE_SMOKE_DOMAIN)
smokeModifier_reset(pid->calldata);
else if (pid->type == PTCACHE_TYPE_SMOKE_HIGHRES)
smokeModifier_reset_turbulence(pid->calldata);*/
smokeModifier_reset_turbulence(pid->calldata);
#endif
else if (pid->type == PTCACHE_TYPE_DYNAMICPAINT)
dynamicPaint_clearSurface((DynamicPaintSurface*)pid->calldata);
}

@ -1052,7 +1052,7 @@ static void scene_update_tagged_recursive(Main *bmain, Scene *scene, Scene *scen
/* always update layer, so that animating layers works (joshua july 2010) */
/* XXX commented out, this has depsgraph issues anyway - and this breaks setting scenes
(on scene-set, the base-lay is copied to ob-lay (ton nov 2012) */
* (on scene-set, the base-lay is copied to ob-lay (ton nov 2012) */
// base->lay = ob->lay;
}

@ -47,6 +47,7 @@ static SuggList suggestions = {NULL, NULL, NULL, NULL, NULL};
static char *documentation = NULL;
//static int doc_lines = 0;
/* TODO, replace with BLI_strncasecmp() */
static int txttl_cmp(const char *first, const char *second, int len)
{
int cmp, i;
@ -113,19 +114,18 @@ short texttool_text_is_active(Text *text)
void texttool_suggest_add(const char *name, char type)
{
const int len = strlen(name);
int cmp;
SuggItem *newitem, *item;
int len, cmp;
newitem = MEM_mallocN(sizeof(SuggItem) + strlen(name) + 1, "SuggestionItem");
newitem = MEM_mallocN(sizeof(SuggItem) + len + 1, "SuggItem");
if (!newitem) {
printf("Failed to allocate memory for suggestion.\n");
return;
}
newitem->name = (char *) (newitem + 1);
len = strlen(name);
strncpy(newitem->name, name, len);
newitem->name[len] = '\0';
memcpy(newitem->name, name, len + 1);
newitem->type = type;
newitem->prev = newitem->next = NULL;

File diff suppressed because it is too large Load Diff

@ -1124,10 +1124,10 @@ void BKE_tracking_marker_pattern_minmax(const MovieTrackingMarker *marker, float
{
INIT_MINMAX2(min, max);
DO_MINMAX2(marker->pattern_corners[0], min, max);
DO_MINMAX2(marker->pattern_corners[1], min, max);
DO_MINMAX2(marker->pattern_corners[2], min, max);
DO_MINMAX2(marker->pattern_corners[3], min, max);
minmax_v2v2_v2(min, max, marker->pattern_corners[0]);
minmax_v2v2_v2(min, max, marker->pattern_corners[1]);
minmax_v2v2_v2(min, max, marker->pattern_corners[2]);
minmax_v2v2_v2(min, max, marker->pattern_corners[3]);
}
void BKE_tracking_marker_get_subframe_position(MovieTrackingTrack *track, float framenr, float pos[2])
@ -3161,7 +3161,7 @@ static int stabilization_median_point_get(MovieTracking *tracking, int framenr,
if (track->flag & TRACK_USE_2D_STAB) {
MovieTrackingMarker *marker = BKE_tracking_marker_get(track, framenr);
DO_MINMAX2(marker->pos, min, max);
minmax_v2v2_v2(min, max, marker->pos);
ok = TRUE;
}

@ -187,6 +187,10 @@ int barycentric_inside_triangle_v2(const float w[3]);
void resolve_tri_uv(float r_uv[2], const float st[2], const float st0[2], const float st1[2], const float st2[2]);
void resolve_quad_uv(float uv[2], const float st[2], const float st0[2], const float st1[2], const float st2[2], const float st3[2]);
/* use to find the point of a UV on a face */
void interp_bilinear_quad_v3(float data[4][3], float u, float v, float res[3]);
void interp_barycentric_tri_v3(float data[3][3], float u, float v, float res[3]);
/***************************** View & Projection *****************************/
void lookat_m4(float mat[4][4], float vx, float vy,

@ -169,6 +169,7 @@ void interp_v4_v4v4v4v4(float p[4], const float v1[4], const float v2[4], const
void mid_v3_v3v3(float r[3], const float a[3], const float b[3]);
void mid_v2_v2v2(float r[2], const float a[2], const float b[2]);
void mid_v3_v3v3v3(float v[3], const float v1[3], const float v2[3], const float v3[3]);
/********************************* Comparison ********************************/

@ -37,6 +37,10 @@ extern "C" {
#include <pthread.h>
#ifdef __APPLE__
#include <libkern/OSAtomic.h>
#endif
/* for tables, button in UI, etc */
#define BLENDER_MAX_THREADS 64
@ -92,6 +96,19 @@ void BLI_mutex_lock(ThreadMutex *mutex);
void BLI_mutex_unlock(ThreadMutex *mutex);
void BLI_mutex_end(ThreadMutex *mutex);
/* Spin Lock */
#ifdef __APPLE__
typedef OSSpinLock SpinLock;
#else
typedef pthread_spinlock_t SpinLock;
#endif
void BLI_spin_init(SpinLock *spin);
void BLI_spin_lock(SpinLock *spin);
void BLI_spin_unlock(SpinLock *spin);
void BLI_spin_end(SpinLock *spin);
/* Read/Write Mutex Lock */
#define THREAD_LOCK_READ 1

@ -257,6 +257,15 @@
#define IN_RANGE(a, b, c) ((b < c) ? ((b < a && a < c) ? 1 : 0) : ((c < a && a < b) ? 1 : 0))
#define IN_RANGE_INCL(a, b, c) ((b < c) ? ((b <= a && a <= c) ? 1 : 0) : ((c <= a && a <= b) ? 1 : 0))
/* unpack vector for args */
#define UNPACK2(a) ((a)[0]), ((a)[1])
#define UNPACK3(a) ((a)[0]), ((a)[1]), ((a)[2])
#define UNPACK4(a) ((a)[0]), ((a)[1]), ((a)[2]), ((a)[3])
/* op may be '&' or '*' */
#define UNPACK2OP(a, op) op((a)[0]), op((a)[1])
#define UNPACK3OP(a, op) op((a)[0]), op((a)[1]), op((a)[2])
#define UNPACK4OP(a, op) op((a)[0]), op((a)[1]), op((a)[2]), op((a)[3])
/* array helpers */
#define ARRAY_LAST_ITEM(arr_start, arr_dtype, elem_size, tot) \
(arr_dtype *)((char *)arr_start + (elem_size * (tot - 1)))

@ -1410,7 +1410,7 @@ static float ray_nearest_hit(BVHRayCastData *data, const float bv[6])
* Based on Tactical Optimization of Ray/Box Intersection, by Graham Fyffe
* [http://tog.acm.org/resources/RTNews/html/rtnv21n1.html#art9]
*
* TODO this doens't has data->ray.radius in consideration */
* TODO this doesn't take data->ray.radius into consideration */
static float fast_ray_nearest_hit(const BVHRayCastData *data, const BVHNode *node)
{
const float *bv = node->bv;

@ -2399,6 +2399,33 @@ void resolve_quad_uv(float r_uv[2], const float st[2], const float st0[2], const
#undef IS_ZERO
/* reverse of the functions above */
void interp_bilinear_quad_v3(float data[4][3], float u, float v, float res[3])
{
float vec[3];
copy_v3_v3(res, data[0]);
mul_v3_fl(res, (1 - u) * (1 - v));
copy_v3_v3(vec, data[1]);
mul_v3_fl(vec, u * (1 - v)); add_v3_v3(res, vec);
copy_v3_v3(vec, data[2]);
mul_v3_fl(vec, u * v); add_v3_v3(res, vec);
copy_v3_v3(vec, data[3]);
mul_v3_fl(vec, (1 - u) * v); add_v3_v3(res, vec);
}
void interp_barycentric_tri_v3(float data[3][3], float u, float v, float res[3])
{
float vec[3];
copy_v3_v3(res, data[0]);
mul_v3_fl(res, u);
copy_v3_v3(vec, data[1]);
mul_v3_fl(vec, v); add_v3_v3(res, vec);
copy_v3_v3(vec, data[2]);
mul_v3_fl(vec, 1.0f - u - v); add_v3_v3(res, vec);
}
/***************************** View & Projection *****************************/
void orthographic_m4(float matrix[][4], const float left, const float right, const float bottom, const float top,

@ -134,12 +134,12 @@ BLI_INLINE void bicubic_interpolation(const unsigned char *byte_buffer, const fl
w = wx * wy[m + 1];
if (float_output) {
const float *float_data = float_buffer + width * y1 * 4 + 4 * x1;
const float *float_data = float_buffer + width * y1 * components + components * x1;
vector_from_float(float_data, data, components);
}
else {
const unsigned char *byte_data = byte_buffer + width * y1 * 4 + 4 * x1;
const unsigned char *byte_data = byte_buffer + width * y1 * components + components * x1;
vector_from_byte(byte_data, data, components);
}
@ -173,12 +173,12 @@ BLI_INLINE void bicubic_interpolation(const unsigned char *byte_buffer, const fl
float data[4];
if (float_output) {
const float *float_data = float_buffer + width * y1 * 4 + 4 * x1;
const float *float_data = float_buffer + width * y1 * components + components * x1;
vector_from_float(float_data, data, components);
}
else {
const unsigned char *byte_data = byte_buffer + width * y1 * 4 + 4 * x1;
const unsigned char *byte_data = byte_buffer + width * y1 * components + components * x1;
vector_from_byte(byte_data, data, components);
}
@ -270,16 +270,16 @@ BLI_INLINE void bilinear_interpolation(const unsigned char *byte_buffer, const f
/* sample including outside of edges of image */
if (x1 < 0 || y1 < 0) row1 = empty;
else row1 = float_buffer + width * y1 * 4 + 4 * x1;
else row1 = float_buffer + width * y1 * components + components * x1;
if (x1 < 0 || y2 > height - 1) row2 = empty;
else row2 = float_buffer + width * y2 * 4 + 4 * x1;
else row2 = float_buffer + width * y2 * components + components * x1;
if (x2 > width - 1 || y1 < 0) row3 = empty;
else row3 = float_buffer + width * y1 * 4 + 4 * x2;
else row3 = float_buffer + width * y1 * components + components * x2;
if (x2 > width - 1 || y2 > height - 1) row4 = empty;
else row4 = float_buffer + width * y2 * 4 + 4 * x2;
else row4 = float_buffer + width * y2 * components + components * x2;
a = u - floorf(u);
b = v - floorf(v);
@ -306,16 +306,16 @@ BLI_INLINE void bilinear_interpolation(const unsigned char *byte_buffer, const f
/* sample including outside of edges of image */
if (x1 < 0 || y1 < 0) row1 = empty;
else row1 = byte_buffer + width * y1 * 4 + 4 * x1;
else row1 = byte_buffer + width * y1 * components + components * x1;
if (x1 < 0 || y2 > height - 1) row2 = empty;
else row2 = byte_buffer + width * y2 * 4 + 4 * x1;
else row2 = byte_buffer + width * y2 * components + components * x1;
if (x2 > width - 1 || y1 < 0) row3 = empty;
else row3 = byte_buffer + width * y1 * 4 + 4 * x2;
else row3 = byte_buffer + width * y1 * components + components * x2;
if (x2 > width - 1 || y2 > height - 1) row4 = empty;
else row4 = byte_buffer + width * y2 * 4 + 4 * x2;
else row4 = byte_buffer + width * y2 * components + components * x2;
a = u - floorf(u);
b = v - floorf(v);

@ -84,7 +84,7 @@ void mul_qt_qtqt(float q[4], const float q1[4], const float q2[4])
* \note:
* Assumes a unit quaternion?
*
* in fact not, but you may wan't to use a unit quat, read on...
* in fact not, but you may want to use a unit quat, read on...
*
* Shortcut for 'q v q*' when \a v is actually a quaternion.
* This removes the need for converting a vector to a quaternion,

@ -115,6 +115,13 @@ void mid_v2_v2v2(float v[2], const float v1[2], const float v2[2])
v[1] = 0.5f * (v1[1] + v2[1]);
}
void mid_v3_v3v3v3(float v[3], const float v1[3], const float v2[3], const float v3[3])
{
v[0] = (v1[0] + v2[0] + v3[0]) / 3.0f;
v[1] = (v1[1] + v2[1] + v3[1]) / 3.0f;
v[2] = (v1[2] + v2[2] + v3[2]) / 3.0f;
}
/********************************** Angles ***********************************/
/* Return the angle in radians between vecs 1-2 and 2-3 in radians
@ -201,6 +208,13 @@ float angle_signed_v2v2(const float v1[2], const float v2[2])
float angle_normalized_v3v3(const float v1[3], const float v2[3])
{
/* double check they are normalized */
#ifdef DEBUG
float test;
BLI_assert(fabsf((test = len_squared_v3(v1)) - 1.0f) < 0.0001f || fabsf(test) < 0.0001f);
BLI_assert(fabsf((test = len_squared_v3(v2)) - 1.0f) < 0.0001f || fabsf(test) < 0.0001f);
#endif
/* this is the same as acos(dot_v3v3(v1, v2)), but more accurate */
if (dot_v3v3(v1, v2) < 0.0f) {
float vec[3];
@ -217,6 +231,13 @@ float angle_normalized_v3v3(const float v1[3], const float v2[3])
float angle_normalized_v2v2(const float v1[2], const float v2[2])
{
/* double check they are normalized */
#ifdef DEBUG
float test;
BLI_assert(fabsf((test = len_squared_v2(v1)) - 1.0f) < 0.0001f || fabsf(test) < 0.0001f);
BLI_assert(fabsf((test = len_squared_v2(v2)) - 1.0f) < 0.0001f || fabsf(test) < 0.0001f);
#endif
/* this is the same as acos(dot_v3v3(v1, v2)), but more accurate */
if (dot_v2v2(v1, v2) < 0.0f) {
float vec[2];
@ -401,6 +422,12 @@ void rotate_normalized_v3_v3v3fl(float r[3], const float p[3], const float axis[
const float costheta = cos(angle);
const float sintheta = sin(angle);
/* double check they are normalized */
#ifdef DEBUG
float test;
BLI_assert(fabsf((test = len_squared_v3(axis)) - 1.0f) < 0.0001f || fabsf(test) < 0.0001f);
#endif
r[0] = ((costheta + (1 - costheta) * axis[0] * axis[0]) * p[0]) +
(((1 - costheta) * axis[0] * axis[1] - axis[2] * sintheta) * p[1]) +
(((1 - costheta) * axis[0] * axis[2] + axis[1] * sintheta) * p[2]);

@ -398,7 +398,8 @@ static float orgBlenderNoise(float x, float y, float z)
h = hashvectf + 3 * hash[b21 + b11];
n += i * (h[0] * jx + h[1] * jy + h[2] * jz);
if (n < 0.0f) n = 0.0f; else if (n > 1.0f) n = 1.0f;
if (n < 0.0f) n = 0.0f;
else if (n > 1.0f) n = 1.0f;
return n;
}
@ -1890,7 +1891,8 @@ float mg_RidgedMultiFractal(float x, float y, float z, float H, float lacunarity
y *= lacunarity;
z *= lacunarity;
weight = signal * gain;
if (weight > 1.0f) weight = 1.0f; else if (weight < 0.0f) weight = 0.0f;
if (weight > 1.0f) weight = 1.0f;
else if (weight < 0.0f) weight = 0.0f;
signal = offset - fabsf(noisefunc(x, y, z));
signal *= signal;
signal *= weight;

@ -1715,11 +1715,14 @@ void BLI_pbvh_grids_update(PBVH *bvh, CCGElem **grids, DMGridAdjacency *gridadj,
bvh->grids = grids;
bvh->gridadj = gridadj;
bvh->gridfaces = gridfaces;
bvh->grid_flag_mats = flagmats;
bvh->grid_hidden = grid_hidden;
for (a = 0; a < bvh->totnode; ++a)
BLI_pbvh_node_mark_rebuild_draw(&bvh->nodes[a]);
if (flagmats != bvh->grid_flag_mats || bvh->grid_hidden != grid_hidden) {
bvh->grid_flag_mats = flagmats;
bvh->grid_hidden = grid_hidden;
for (a = 0; a < bvh->totnode; ++a)
BLI_pbvh_node_mark_rebuild_draw(&bvh->nodes[a]);
}
}
float (*BLI_pbvh_get_vertCos(PBVH * pbvh))[3]

@ -985,7 +985,7 @@ int BLI_scanfill_calc_ex(ScanFillContext *sf_ctx, const short do_quad_tri_speedu
/* CURRENT STATUS:
* - eve->f :1 = availalble in edges
* - eve->f :1 = available in edges
* - eve->xs :polynumber
* - eve->h :amount of edges connected to vertex
* - eve->tmp.v :store! original vertex number

@ -400,6 +400,42 @@ void BLI_mutex_end(ThreadMutex *mutex)
pthread_mutex_destroy(mutex);
}
/* Spin Locks */
void BLI_spin_init(SpinLock *spin)
{
#ifdef __APPLE__
*spin = OS_SPINLOCK_INIT;
#else
pthread_spin_init(spin, 0);
#endif
}
void BLI_spin_lock(SpinLock *spin)
{
#ifdef __APPLE__
OSSpinLockLock(spin);
#else
pthread_spin_lock(spin);
#endif
}
void BLI_spin_unlock(SpinLock *spin)
{
#ifdef __APPLE__
OSSpinLockUnlock(spin);
#else
pthread_spin_unlock(spin);
#endif
}
void BLI_spin_end(SpinLock *spin)
{
#ifndef __APPLE__
pthread_spin_destroy(spin);
#endif
}
/* Read/Write Mutex Lock */
void BLI_rw_mutex_init(ThreadRWMutex *mutex)

@ -8553,6 +8553,17 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
}
}
{
Object *ob;
for (ob = main->object.first; ob; ob = ob->id.next) {
if (ob->step_height == 0.0) {
ob->step_height = 0.150;
ob->jump_speed = 10.0;
ob->fall_speed = 55.0;
}
}
}
/* default values in Freestyle settings */
{
Scene *sce;

@ -68,10 +68,6 @@ set(SRC
intern/bmesh_construct.h
intern/bmesh_core.c
intern/bmesh_core.h
intern/bmesh_decimate_collapse.c
intern/bmesh_decimate_dissolve.c
intern/bmesh_decimate_unsubdivide.c
intern/bmesh_decimate.h
intern/bmesh_inline.h
intern/bmesh_interp.c
intern/bmesh_interp.h
@ -109,6 +105,12 @@ set(SRC
intern/bmesh_error.h
tools/BME_bevel.c
tools/bmesh_bevel.c
tools/bmesh_bevel.h
tools/bmesh_decimate_collapse.c
tools/bmesh_decimate_dissolve.c
tools/bmesh_decimate_unsubdivide.c
tools/bmesh_decimate.h
bmesh.h
bmesh_class.h

@ -252,7 +252,6 @@ extern "C" {
#include "intern/bmesh_construct.h"
#include "intern/bmesh_core.h"
#include "intern/bmesh_decimate.h"
#include "intern/bmesh_interp.h"
#include "intern/bmesh_iterators.h"
#include "intern/bmesh_marking.h"
@ -267,6 +266,9 @@ extern "C" {
#include "intern/bmesh_inline.h"
#include "tools/bmesh_decimate.h"
#include "tools/bmesh_bevel.h"
#ifdef __cplusplus
}
#endif

@ -48,6 +48,8 @@ struct Object;
* hrm. it doesn't but stull works ok, remove the comment above? - campbell.
*/
// #pragma GCC diagnostic error "-Wpadded"
/**
* BMHeader
*
@ -69,10 +71,19 @@ typedef struct BMHeader {
* this is abused by various tools which set it dirty.
* - For loops this is used for sorting during tessellation. */
char htype; /* element geometric type (verts/edges/loops/faces) */
char hflag; /* this would be a CD layer, see below */
char htype; /* element geometric type (verts/edges/loops/faces) */
char hflag; /* this would be a CD layer, see below */
/* internal use only!
* note,.we are very picky about not bloating this struct
* but in this case its padded up to 16 bytes anyway,
* so adding a flag here gives no increase in size */
char api_flag;
// char _pad;
} BMHeader;
BLI_STATIC_ASSERT((sizeof(BMHeader) <= 16), "BMHeader size has grown!");
/* note: need some way to specify custom locations for custom data layers. so we can
* make them point directly into structs. and some way to make it only happen to the
* active layer, and properly update when switching active layers.*/
@ -122,7 +133,10 @@ typedef struct BMLoop {
/* can cast BMFace/BMEdge/BMVert, but NOT BMLoop, since these don't have a flag layer */
typedef struct BMElemF {
BMHeader head;
struct BMFlagLayer *oflags; /* keep after header, an array of flags, mostly used by the operator stack */
/* keep directly after header,
* optional array of flags, only used by the operator stack */
struct BMFlagLayer *oflags;
} BMElemF;
/* can cast anything to this, including BMLoop */
@ -142,21 +156,24 @@ typedef struct BMFace {
BMHeader head;
struct BMFlagLayer *oflags; /* an array of flags, mostly used by the operator stack */
int len; /*includes all boundary loops*/
#ifdef USE_BMESH_HOLES
int totbounds; /*total boundaries, is one plus the number of holes in the face*/
ListBase loops;
#else
BMLoop *l_first;
#endif
float no[3]; /*yes, we do store this here*/
int len; /* includes all boundary loops */
float no[3]; /* yes, we do store this here */
short mat_nr;
// short _pad[3];
} BMFace;
typedef struct BMFlagLayer {
short f, pflag; /* flags */
short f; /* flags */
} BMFlagLayer;
// #pragma GCC diagnostic ignored "-Wpadded"
typedef struct BMesh {
int totvert, totedge, totloop, totface;
int totvertsel, totedgesel, totfacesel;
@ -166,7 +183,7 @@ typedef struct BMesh {
* valid flags are - BM_VERT | BM_EDGE | BM_FACE.
* BM_LOOP isn't handled so far. */
char elem_index_dirty;
/*element pools*/
struct BLI_mempool *vpool, *epool, *lpool, *fpool;
@ -192,7 +209,7 @@ typedef struct BMesh {
int walkers, totflags;
ListBase selected, error_stack;
BMFace *act_face;
ListBase errorstack;

@ -187,8 +187,10 @@ BMFace *BM_face_create_ngon(BMesh *bm, BMVert *v1, BMVert *v2, BMEdge **edges, i
* _and_ the old bmesh_mf functions, so its kindof smashed together
* - joeedh */
if (!len || !v1 || !v2 || !edges || !bm)
if (!len || !v1 || !v2 || !edges || !bm) {
BLI_assert(0);
return NULL;
}
/* put edges in correct order */
for (i = 0; i < len; i++) {

@ -76,7 +76,9 @@ BMVert *BM_vert_create(BMesh *bm, const float co[3], const BMVert *example)
}
/* allocate flag */
v->oflags = BLI_mempool_calloc(bm->toolflagpool);
if (bm->toolflagpool) {
v->oflags = BLI_mempool_calloc(bm->toolflagpool);
}
CustomData_bmesh_set_default(&bm->vdata, &v->head.data);
@ -125,7 +127,9 @@ BMEdge *BM_edge_create(BMesh *bm, BMVert *v1, BMVert *v2, const BMEdge *example,
e->head.htype = BM_EDGE;
/* allocate flag */
e->oflags = BLI_mempool_calloc(bm->toolflagpool);
if (bm->toolflagpool) {
e->oflags = BLI_mempool_calloc(bm->toolflagpool);
}
e->v1 = v1;
e->v2 = v2;
@ -278,7 +282,9 @@ BLI_INLINE BMFace *bm_face_create__internal(BMesh *bm)
f->head.htype = BM_FACE;
/* allocate flag */
f->oflags = BLI_mempool_calloc(bm->toolflagpool);
if (bm->toolflagpool) {
f->oflags = BLI_mempool_calloc(bm->toolflagpool);
}
CustomData_bmesh_set_default(&bm->pdata, &f->head.data);
@ -495,7 +501,9 @@ static void bm_kill_only_vert(BMesh *bm, BMVert *v)
if (v->head.data)
CustomData_bmesh_free_block(&bm->vdata, &v->head.data);
BLI_mempool_free(bm->toolflagpool, v->oflags);
if (bm->toolflagpool) {
BLI_mempool_free(bm->toolflagpool, v->oflags);
}
BLI_mempool_free(bm->vpool, v);
}
@ -513,7 +521,9 @@ static void bm_kill_only_edge(BMesh *bm, BMEdge *e)
if (e->head.data)
CustomData_bmesh_free_block(&bm->edata, &e->head.data);
BLI_mempool_free(bm->toolflagpool, e->oflags);
if (bm->toolflagpool) {
BLI_mempool_free(bm->toolflagpool, e->oflags);
}
BLI_mempool_free(bm->epool, e);
}
@ -534,7 +544,9 @@ static void bm_kill_only_face(BMesh *bm, BMFace *f)
if (f->head.data)
CustomData_bmesh_free_block(&bm->pdata, &f->head.data);
BLI_mempool_free(bm->toolflagpool, f->oflags);
if (bm->toolflagpool) {
BLI_mempool_free(bm->toolflagpool, f->oflags);
}
BLI_mempool_free(bm->fpool, f);
}
@ -1773,14 +1785,18 @@ BMFace *bmesh_jfke(BMesh *bm, BMFace *f1, BMFace *f2, BMEdge *e)
bmesh_disk_edge_remove(f1loop->e, f1loop->e->v2);
/* deallocate edge and its two loops as well as f2 */
BLI_mempool_free(bm->toolflagpool, f1loop->e->oflags);
if (bm->toolflagpool) {
BLI_mempool_free(bm->toolflagpool, f1loop->e->oflags);
}
BLI_mempool_free(bm->epool, f1loop->e);
bm->totedge--;
BLI_mempool_free(bm->lpool, f1loop);
bm->totloop--;
BLI_mempool_free(bm->lpool, f2loop);
bm->totloop--;
BLI_mempool_free(bm->toolflagpool, f2->oflags);
if (bm->toolflagpool) {
BLI_mempool_free(bm->toolflagpool, f2->oflags);
}
BLI_mempool_free(bm->fpool, f2);
bm->totface--;
/* account for both above */

@ -107,14 +107,14 @@ typedef struct BMIter {
BMesh *bm;
void (*begin)(struct BMIter *iter);
void *(*step)(struct BMIter *iter);
/*
#if 0
union {
void *p;
int i;
long l;
float f;
} filter;
*/
#endif
int count; /* note, only some iterators set this, don't rely on it */
char itype;
} BMIter;

@ -59,9 +59,37 @@ static void bm_mempool_init(BMesh *bm, const BMAllocTemplate *allocsize)
#ifdef USE_BMESH_HOLES
bm->looplistpool = BLI_mempool_create(sizeof(BMLoopList), 512, 512, 0);
#endif
}
/* allocate one flag pool that we don't get rid of. */
bm->toolflagpool = BLI_mempool_create(sizeof(BMFlagLayer), 512, 512, 0);
void BM_mesh_elem_toolflags_ensure(BMesh *bm)
{
if (bm->toolflagpool == NULL) {
const int totflagpool_size = max_ii(512, bm->totvert + bm->totedge + bm->totface);
BLI_mempool *toolflagpool;
BMIter iter;
BMElemF *ele;
const char iter_types[3] = {BM_VERTS_OF_MESH,
BM_EDGES_OF_MESH,
BM_FACES_OF_MESH};
int i;
BLI_assert(bm->totflags == 0);
/* allocate one flag pool that we don't get rid of. */
toolflagpool = BLI_mempool_create(sizeof(BMFlagLayer), totflagpool_size, 512, 0);
for (i = 0; i < 3; i++) {
BM_ITER_MESH (ele, &iter, bm, iter_types[i]) {
ele->oflags = BLI_mempool_calloc(toolflagpool);
}
}
bm->toolflagpool = toolflagpool;
bm->totflags = 1;
}
}
/**
@ -83,7 +111,7 @@ BMesh *BM_mesh_create(BMAllocTemplate *allocsize)
/* allocate one flag pool that we don't get rid of. */
bm->stackdepth = 1;
bm->totflags = 1;
bm->totflags = 0;
CustomData_reset(&bm->vdata);
CustomData_reset(&bm->edata);
@ -143,7 +171,9 @@ void BM_mesh_data_free(BMesh *bm)
BLI_mempool_destroy(bm->fpool);
/* destroy flag pool */
BLI_mempool_destroy(bm->toolflagpool);
if (bm->toolflagpool) {
BLI_mempool_destroy(bm->toolflagpool);
}
#ifdef USE_BMESH_HOLES
BLI_mempool_destroy(bm->looplistpool);

@ -29,6 +29,7 @@
struct BMAllocTemplate;
void BM_mesh_elem_toolflags_ensure(BMesh *bm);
BMesh *BM_mesh_create(struct BMAllocTemplate *allocsize);
void BM_mesh_free(BMesh *bm);
@ -58,4 +59,8 @@ typedef struct BMAllocTemplate {
extern BMAllocTemplate bm_mesh_allocsize_default;
extern BMAllocTemplate bm_mesh_chunksize_default;
enum {
BM_MESH_CREATE_USE_TOOLFLAGS = (1 << 0)
};
#endif /* __BMESH_MESH_H__ */

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