Merging r41937 through r42061 from trunk into soc-2011-tomato

This commit is contained in:
Sergey Sharybin 2011-11-22 14:04:34 +00:00
commit 0bdbddf3d3
368 changed files with 5300 additions and 4011 deletions

@ -70,6 +70,7 @@ BlenderEnvironment = Blender.BlenderEnvironment
B = Blender
VERSION = btools.VERSION # This is used in creating the local config directories
VERSION_RELEASE_CYCLE = btools.VERSION_RELEASE_CYCLE
### globals ###
platform = sys.platform
@ -524,6 +525,10 @@ if env['OURPLATFORM']!='darwin':
if '__pycache__' in dn: # py3.2 cache dir
dn.remove('__pycache__')
# only for testing builds
if VERSION_RELEASE_CYCLE == "release" and "addons_contrib" in dn:
dn.remove('addons_contrib')
dir = os.path.join(env['BF_INSTALLDIR'], VERSION)
dir += os.sep + os.path.basename(scriptpath) + dp[len(scriptpath):]

@ -22,6 +22,12 @@
# <pep8 compliant>
import sys
if not sys.version.startswith("3"):
print("\nPython3.x needed, found %s.\nAborting!\n" %
sys.version.partition(" ")[0])
sys.exit(1)
from cmake_consistency_check_config import IGNORE, UTF8_CHECK, SOURCE_DIR
import os

@ -44,7 +44,14 @@ __all__ = (
"project_name_get"
)
import sys
if not sys.version.startswith("3"):
print("\nPython3.x needed, found %s.\nAborting!\n" %
sys.version.partition(" ")[0])
sys.exit(1)
import os
from os.path import join, dirname, normpath, abspath, splitext, exists
@ -142,10 +149,11 @@ def cmake_advanced_info():
from xml.dom.minidom import parse
tree = parse(join(CMAKE_DIR, ".cproject"))
'''
f = open(".cproject_pretty", 'w')
f.write(tree.toprettyxml(indent=" ", newl=""))
'''
# to check on nicer xml
# f = open(".cproject_pretty", 'w')
# f.write(tree.toprettyxml(indent=" ", newl=""))
ELEMENT_NODE = tree.ELEMENT_NODE
cproject, = tree.getElementsByTagName("cproject")
@ -224,7 +232,9 @@ def project_name_get(path, fallback="Blender", prefix="Blender_"):
import subprocess
info = subprocess.Popen(["svn", "info", path],
stdout=subprocess.PIPE).communicate()[0].decode()
stdout=subprocess.PIPE).communicate()[0]
# string version, we only want the URL
info = info.decode(encoding="utf-8", errors="ignore")
for l in info.split("\n"):
l = l.strip()

@ -25,6 +25,14 @@ __all__ = (
"SOURCE_DIR",
)
import sys
if not sys.version.startswith("3"):
print("\nPython3.x needed, found %s.\nAborting!\n" %
sys.version.partition(" ")[0])
sys.exit(1)
import os
from os.path import join, dirname, normpath, abspath
@ -73,7 +81,7 @@ def do_ignore(filepath, ignore_prefix_list):
def makefile_log():
import subprocess
import time
# Check blender is not 2.5x until it supports playback again
print("running make with --dry-run ...")
process = subprocess.Popen(["make", "--always-make", "--dry-run", "--keep-going", "VERBOSE=1"],
stdout=subprocess.PIPE,
@ -85,7 +93,7 @@ def makefile_log():
out = process.stdout.read()
process.stdout.close()
print("done!", len(out), "bytes")
return out.decode("ascii").split("\n")
return out.decode("utf-8", errors="ignore").split("\n")
def build_info(use_c=True, use_cxx=True, ignore_prefix_list=None):

@ -18,20 +18,20 @@ MACOSX_ARCHITECTURE = 'i386' # valid archs: ppc, i386, ppc64, x86_64
cmd = 'uname -p'
MAC_PROC=commands.getoutput(cmd)
MAC_PROC=commands.getoutput(cmd)
cmd = 'uname -r'
cmd_res=commands.getoutput(cmd)
cmd_res=commands.getoutput(cmd)
if cmd_res[:1]=='7':
MAC_CUR_VER='10.3'
MAC_CUR_VER='10.3'
elif cmd_res[:1]=='8':
MAC_CUR_VER='10.4'
MAC_CUR_VER='10.4'
elif cmd_res[:1]=='9':
MAC_CUR_VER='10.5'
MAC_CUR_VER='10.5'
elif cmd_res[:2]=='10':
MAC_CUR_VER='10.6'
MAC_CUR_VER='10.6'
elif cmd_res[:2]=='11':
MAC_CUR_VER='10.7'
MAC_CUR_VER='10.7'
cmd = 'xcodebuild -version'
cmd_xcode=commands.getoutput(cmd)
XCODE_CUR_VER=cmd_xcode
@ -40,7 +40,7 @@ cmd_sdk=commands.getoutput(cmd)
MACOSX_SDK_CHECK=cmd_sdk
if MACOSX_ARCHITECTURE == 'x86_64' or MACOSX_ARCHITECTURE == 'ppc64':
USE_QTKIT=True # Carbon quicktime is not available for 64bit
USE_QTKIT=True # Carbon quicktime is not available for 64bit
# Default target OSX settings per architecture
@ -48,41 +48,41 @@ if MACOSX_ARCHITECTURE == 'x86_64' or MACOSX_ARCHITECTURE == 'ppc64':
if MACOSX_ARCHITECTURE == 'ppc' and MAC_CUR_VER == '10.4':
# all releases are now made for 10.5 !
# MAC_MIN_VERS = '10.3'
# MACOSX_SDK='/Developer/SDKs/MacOSX10.3.9.sdk'
# LCGDIR = '#../lib/darwin-6.1-powerpc'
# CC = 'gcc-3.3'
# CXX = 'g++-3.3'
MAC_MIN_VERS = '10.4'
MACOSX_DEPLOYMENT_TARGET = '10.4'
MACOSX_SDK='/Developer/SDKs/MacOSX10.4u.sdk'
LCGDIR = '#../lib/darwin-8.0.0-powerpc'
CC = 'gcc-4.0'
CXX = 'g++-4.0'
# MAC_MIN_VERS = '10.3'
# MACOSX_SDK='/Developer/SDKs/MacOSX10.3.9.sdk'
# LCGDIR = '#../lib/darwin-6.1-powerpc'
# CC = 'gcc-3.3'
# CXX = 'g++-3.3'
MAC_MIN_VERS = '10.4'
MACOSX_DEPLOYMENT_TARGET = '10.4'
MACOSX_SDK='/Developer/SDKs/MacOSX10.4u.sdk'
LCGDIR = '#../lib/darwin-8.0.0-powerpc'
CC = 'gcc-4.0'
CXX = 'g++-4.0'
elif MACOSX_ARCHITECTURE == 'i386' and MAC_CUR_VER == '10.4':
MAC_MIN_VERS = '10.4'
MACOSX_DEPLOYMENT_TARGET = '10.4'
MACOSX_SDK='/Developer/SDKs/MacOSX10.4u.sdk'
LCGDIR = '#../lib/darwin-8.x.i386'
CC = 'gcc-4.0'
CXX = 'g++-4.0'
MAC_MIN_VERS = '10.4'
MACOSX_DEPLOYMENT_TARGET = '10.4'
MACOSX_SDK='/Developer/SDKs/MacOSX10.4u.sdk'
LCGDIR = '#../lib/darwin-8.x.i386'
CC = 'gcc-4.0'
CXX = 'g++-4.0'
else :
if 'Mac OS X 10.5' in MACOSX_SDK_CHECK:
# OSX 10.5/6 with Xcode 3.x
MAC_MIN_VERS = '10.5'
MACOSX_DEPLOYMENT_TARGET = '10.5'
MACOSX_SDK='/Developer/SDKs/MacOSX10.5.sdk'
LCGDIR = '#../lib/darwin-9.x.universal'
CC = 'gcc-4.2'
CXX = 'g++-4.2'
else:
# OSX 10.6/7 with Xcode 4.x
MAC_MIN_VERS = '10.6'
MACOSX_DEPLOYMENT_TARGET = '10.6'
MACOSX_SDK='/Developer/SDKs/MacOSX10.6.sdk'
LCGDIR = '#../lib/darwin-9.x.universal'
CC = 'gcc-4.2'
CXX = 'g++-4.2'
if 'Mac OS X 10.5' in MACOSX_SDK_CHECK:
# OSX 10.5/6 with Xcode 3.x
MAC_MIN_VERS = '10.5'
MACOSX_DEPLOYMENT_TARGET = '10.5'
MACOSX_SDK='/Developer/SDKs/MacOSX10.5.sdk'
LCGDIR = '#../lib/darwin-9.x.universal'
CC = 'gcc-4.2'
CXX = 'g++-4.2'
else:
# OSX 10.6/7 with Xcode 4.x
MAC_MIN_VERS = '10.6'
MACOSX_DEPLOYMENT_TARGET = '10.6'
MACOSX_SDK='/Developer/SDKs/MacOSX10.6.sdk'
LCGDIR = '#../lib/darwin-9.x.universal'
CC = 'gcc-4.2'
CXX = 'g++-4.2'
LIBDIR = '${LCGDIR}'
@ -109,32 +109,32 @@ BF_PYTHON_VERSION = '3.2'
WITH_OSX_STATICPYTHON = True
if WITH_OSX_STATICPYTHON:
# python 3.2 uses precompiled libraries in bf svn /lib by default
# python 3.2 uses precompiled libraries in bf svn /lib by default
BF_PYTHON = LIBDIR + '/python'
BF_PYTHON_INC = '${BF_PYTHON}/include/python${BF_PYTHON_VERSION}'
# BF_PYTHON_BINARY = '${BF_PYTHON}/bin/python${BF_PYTHON_VERSION}'
BF_PYTHON_LIB = 'python${BF_PYTHON_VERSION}'
BF_PYTHON_LIBPATH = '${BF_PYTHON}/lib/python${BF_PYTHON_VERSION}'
# BF_PYTHON_LINKFLAGS = ['-u', '_PyMac_Error', '-framework', 'System']
BF_PYTHON = LIBDIR + '/python'
BF_PYTHON_INC = '${BF_PYTHON}/include/python${BF_PYTHON_VERSION}'
# BF_PYTHON_BINARY = '${BF_PYTHON}/bin/python${BF_PYTHON_VERSION}'
BF_PYTHON_LIB = 'python${BF_PYTHON_VERSION}'
BF_PYTHON_LIBPATH = '${BF_PYTHON}/lib/python${BF_PYTHON_VERSION}'
# BF_PYTHON_LINKFLAGS = ['-u', '_PyMac_Error', '-framework', 'System']
else:
# python 3.2 uses Python-framework additionally installed in /Library/Frameworks
BF_PYTHON = '/Library/Frameworks/Python.framework/Versions/'
BF_PYTHON_INC = '${BF_PYTHON}${BF_PYTHON_VERSION}/include/python${BF_PYTHON_VERSION}m'
BF_PYTHON_BINARY = '${BF_PYTHON}${BF_PYTHON_VERSION}/bin/python${BF_PYTHON_VERSION}'
#BF_PYTHON_LIB = ''
BF_PYTHON_LIBPATH = '${BF_PYTHON}${BF_PYTHON_VERSION}/lib/python${BF_PYTHON_VERSION}/config-3.2m'
# python 3.2 uses Python-framework additionally installed in /Library/Frameworks
BF_PYTHON = '/Library/Frameworks/Python.framework/Versions/'
BF_PYTHON_INC = '${BF_PYTHON}${BF_PYTHON_VERSION}/include/python${BF_PYTHON_VERSION}m'
BF_PYTHON_BINARY = '${BF_PYTHON}${BF_PYTHON_VERSION}/bin/python${BF_PYTHON_VERSION}'
#BF_PYTHON_LIB = ''
BF_PYTHON_LIBPATH = '${BF_PYTHON}${BF_PYTHON_VERSION}/lib/python${BF_PYTHON_VERSION}/config-3.2m'
WITH_BF_OPENAL = True
#different lib must be used following version of gcc
# for gcc 3.3
#BF_OPENAL = LIBDIR + '/openal'
# for gcc 3.4 and ulterior
if MAC_PROC == 'powerpc':
BF_OPENAL = '#../lib/darwin-8.0.0-powerpc/openal'
BF_OPENAL = '#../lib/darwin-8.0.0-powerpc/openal'
else :
BF_OPENAL = LIBDIR + '/openal'
BF_OPENAL = LIBDIR + '/openal'
WITH_BF_STATICOPENAL = False
BF_OPENAL_INC = '${BF_OPENAL}/include' # only headers from libdir needed for proper use of framework !!!!
@ -233,7 +233,7 @@ BF_FFTW3_LIBPATH = '${BF_FFTW3}/lib'
#WITH_BF_NSPR = True
#BF_NSPR = $(LIBDIR)/nspr
#BF_NSPR_INC = -I$(BF_NSPR)/include -I$(BF_NSPR)/include/nspr
#BF_NSPR_LIB =
#BF_NSPR_LIB =
# Uncomment the following line to use Mozilla inplace of netscape
#CPPFLAGS += -DMOZ_NOT_NET
@ -284,7 +284,7 @@ BF_PCRE_LIBPATH = '${BF_PCRE}/lib'
#BF_EXPAT_LIBPATH = '/usr/lib'
#Cycles
WITH_BF_CYCLES = True
WITH_BF_CYCLES = True
WITH_BF_OIIO = True
BF_OIIO = LIBDIR + '/openimageio'
@ -318,9 +318,9 @@ WITH_BF_3DMOUSE = True
BF_QUIET = '1' # suppress verbose output
if MACOSX_ARCHITECTURE == 'x86_64' or MACOSX_ARCHITECTURE == 'ppc64':
ARCH_FLAGS = ['-m64']
ARCH_FLAGS = ['-m64']
else:
ARCH_FLAGS = ['-m32']
ARCH_FLAGS = ['-m32']
CFLAGS = []
CXXFLAGS = []
@ -329,53 +329,53 @@ CCFLAGS = ['-pipe','-funsigned-char']
CPPFLAGS = list(ARCH_FLAGS)
if WITH_GHOST_COCOA:
PLATFORM_LINKFLAGS = ['-fexceptions','-framework','CoreServices','-framework','Foundation','-framework','IOKit','-framework','AppKit','-framework','Cocoa','-framework','Carbon','-framework','AudioUnit','-framework','AudioToolbox','-framework','CoreAudio','-framework','OpenAL']+ARCH_FLAGS
PLATFORM_LINKFLAGS = ['-fexceptions','-framework','CoreServices','-framework','Foundation','-framework','IOKit','-framework','AppKit','-framework','Cocoa','-framework','Carbon','-framework','AudioUnit','-framework','AudioToolbox','-framework','CoreAudio','-framework','OpenAL']+ARCH_FLAGS
else:
PLATFORM_LINKFLAGS = ['-fexceptions','-framework','CoreServices','-framework','Foundation','-framework','IOKit','-framework','AppKit','-framework','Carbon','-framework','AGL','-framework','AudioUnit','-framework','AudioToolbox','-framework','CoreAudio','-framework','OpenAL']+ARCH_FLAGS
PLATFORM_LINKFLAGS = ['-fexceptions','-framework','CoreServices','-framework','Foundation','-framework','IOKit','-framework','AppKit','-framework','Carbon','-framework','AGL','-framework','AudioUnit','-framework','AudioToolbox','-framework','CoreAudio','-framework','OpenAL']+ARCH_FLAGS
if WITH_BF_QUICKTIME:
if USE_QTKIT:
PLATFORM_LINKFLAGS = PLATFORM_LINKFLAGS+['-framework','QTKit']
else:
PLATFORM_LINKFLAGS = PLATFORM_LINKFLAGS+['-framework','QuickTime']
if USE_QTKIT:
PLATFORM_LINKFLAGS = PLATFORM_LINKFLAGS+['-framework','QTKit']
else:
PLATFORM_LINKFLAGS = PLATFORM_LINKFLAGS+['-framework','QuickTime']
if not WITH_OSX_STATICPYTHON:
PLATFORM_LINKFLAGS = PLATFORM_LINKFLAGS+['-framework','Python']
PLATFORM_LINKFLAGS = PLATFORM_LINKFLAGS+['-framework','Python']
#note to build succesfully on 10.3.9 SDK you need to patch 10.3.9 by adding the SystemStubs.a lib from 10.4
#for 10.7.sdk, SystemStubs needs to be excluded (lib doesn't exist anymore)
if MACOSX_DEPLOYMENT_TARGET == '10.7':
LLIBS = ['stdc++']
LLIBS = ['stdc++']
else:
LLIBS = ['stdc++', 'SystemStubs']
LLIBS = ['stdc++', 'SystemStubs']
# some flags shuffling for different OS versions
if MAC_MIN_VERS == '10.3':
CCFLAGS = ['-fuse-cxa-atexit'] + CCFLAGS
PLATFORM_LINKFLAGS = ['-fuse-cxa-atexit'] + PLATFORM_LINKFLAGS
LLIBS.append('crt3.o')
if USE_SDK:
SDK_FLAGS=['-isysroot', MACOSX_SDK,'-mmacosx-version-min='+MAC_MIN_VERS,'-arch',MACOSX_ARCHITECTURE]
PLATFORM_LINKFLAGS = ['-mmacosx-version-min='+MAC_MIN_VERS,'-Wl','-isysroot',MACOSX_SDK,'-arch',MACOSX_ARCHITECTURE]+PLATFORM_LINKFLAGS
CCFLAGS=SDK_FLAGS+CCFLAGS
CXXFLAGS=SDK_FLAGS+CXXFLAGS
CCFLAGS = ['-fuse-cxa-atexit'] + CCFLAGS
PLATFORM_LINKFLAGS = ['-fuse-cxa-atexit'] + PLATFORM_LINKFLAGS
LLIBS.append('crt3.o')
#Intel Macs are CoreDuo and Up
if USE_SDK:
SDK_FLAGS=['-isysroot', MACOSX_SDK,'-mmacosx-version-min='+MAC_MIN_VERS,'-arch',MACOSX_ARCHITECTURE]
PLATFORM_LINKFLAGS = ['-mmacosx-version-min='+MAC_MIN_VERS,'-Wl','-isysroot',MACOSX_SDK,'-arch',MACOSX_ARCHITECTURE]+PLATFORM_LINKFLAGS
CCFLAGS=SDK_FLAGS+CCFLAGS
CXXFLAGS=SDK_FLAGS+CXXFLAGS
#Intel Macs are CoreDuo and Up
if MACOSX_ARCHITECTURE == 'i386' or MACOSX_ARCHITECTURE == 'x86_64':
REL_CFLAGS = []
REL_CXXFLAGS = []
REL_CCFLAGS = ['-DNDEBUG', '-O2','-ftree-vectorize','-msse','-msse2','-msse3','-mfpmath=sse']
REL_CFLAGS = []
REL_CXXFLAGS = []
REL_CCFLAGS = ['-DNDEBUG', '-O2','-ftree-vectorize','-msse','-msse2','-msse3','-mfpmath=sse']
else:
CCFLAGS += ['-fno-strict-aliasing']
REL_CFLAGS = []
REL_CXXFLAGS = []
REL_CCFLAGS = ['-DNDEBUG', '-O2']
CCFLAGS += ['-fno-strict-aliasing']
REL_CFLAGS = []
REL_CXXFLAGS = []
REL_CCFLAGS = ['-DNDEBUG', '-O2']
# Intel 64bit Macs are Core2Duo and up
if MACOSX_ARCHITECTURE == 'x86_64':
REL_CCFLAGS += ['-march=core2','-mssse3','-with-tune=core2','-enable-threads']
REL_CCFLAGS += ['-march=core2','-mssse3','-with-tune=core2','-enable-threads']
CC_WARN = ['-Wall']
C_WARN = ['-Wno-char-subscripts', '-Wpointer-arith', '-Wcast-align', '-Wdeclaration-after-statement', '-Wno-unknown-pragmas', '-Wstrict-prototypes']

@ -175,8 +175,8 @@ CCFLAGS = ['-pipe','-fPIC','-funsigned-char','-fno-strict-aliasing','-D_LARGEFIL
CPPFLAGS = []
CXXFLAGS = []
if WITH_BF_FFMPEG:
# libavutil needs UINT64_C()
CXXFLAGS += ['-D__STDC_CONSTANT_MACROS', ]
# libavutil needs UINT64_C()
CXXFLAGS += ['-D__STDC_CONSTANT_MACROS', ]
REL_CFLAGS = []
REL_CXXFLAGS = []
REL_CCFLAGS = ['-DNDEBUG', '-O2']

@ -175,8 +175,8 @@ CCFLAGS = ['-pipe','-fPIC','-funsigned-char','-fno-strict-aliasing','-D_LARGEFIL
CPPFLAGS = []
CXXFLAGS = []
if WITH_BF_FFMPEG:
# libavutil needs UINT64_C()
CXXFLAGS += ['-D__STDC_CONSTANT_MACROS', ]
# libavutil needs UINT64_C()
CXXFLAGS += ['-D__STDC_CONSTANT_MACROS', ]
REL_CFLAGS = []
REL_CXXFLAGS = []
REL_CCFLAGS = ['-DNDEBUG', '-O2']

@ -175,8 +175,8 @@ CXXFLAGS = []
CPPFLAGS = []
if WITH_BF_FFMPEG:
# libavutil needs UINT64_C()
CXXFLAGS += ['-D__STDC_CONSTANT_MACROS', ]
# libavutil needs UINT64_C()
CXXFLAGS += ['-D__STDC_CONSTANT_MACROS', ]
REL_CFLAGS = []
REL_CXXFLAGS = []
REL_CCFLAGS = ['-DNDEBUG', '-O2']

@ -247,8 +247,8 @@ CPPFLAGS = []
# g++ 4.6, only needed for bullet
CXXFLAGS += ['-fpermissive']
if WITH_BF_FFMPEG:
# libavutil needs UINT64_C()
CXXFLAGS += ['-D__STDC_CONSTANT_MACROS', ]
# libavutil needs UINT64_C()
CXXFLAGS += ['-D__STDC_CONSTANT_MACROS', ]
REL_CFLAGS = []
REL_CXXFLAGS = []
REL_CCFLAGS = ['-DNDEBUG', '-O2']

@ -34,6 +34,7 @@ import bcolors
bc = bcolors.bcolors()
import btools
VERSION = btools.VERSION
VERSION_RELEASE_CYCLE = btools.VERSION_RELEASE_CYCLE
Split = SCons.Util.Split
Action = SCons.Action.Action
@ -257,9 +258,9 @@ def setup_syslibs(lenv):
if lenv['WITH_BF_OGG']:
syslibs += Split(lenv['BF_OGG_LIB'])
if lenv['WITH_BF_JACK']:
syslibs += Split(lenv['BF_JACK_LIB'])
syslibs += Split(lenv['BF_JACK_LIB'])
if lenv['WITH_BF_SNDFILE'] and not lenv['WITH_BF_STATICSNDFILE']:
syslibs += Split(lenv['BF_SNDFILE_LIB'])
syslibs += Split(lenv['BF_SNDFILE_LIB'])
if lenv['WITH_BF_FFTW3'] and not lenv['WITH_BF_STATICFFTW3']:
syslibs += Split(lenv['BF_FFTW3_LIB'])
if lenv['WITH_BF_SDL']:
@ -584,6 +585,10 @@ def AppIt(target=None, source=None, env=None):
cmd = 'cp -R %s/release/scripts %s/%s.app/Contents/MacOS/%s/'%(bldroot,installdir,binary,VERSION)
commands.getoutput(cmd)
if VERSION_RELEASE_CYCLE == "release":
cmd = 'rm -rf %s/%s.app/Contents/MacOS/%s/scripts/addons_contrib'%(installdir,binary,VERSION)
commands.getoutput(cmd)
if env['WITH_BF_CYCLES']:
croot = '%s/intern/cycles' % (bldroot)
cinstalldir = '%s/%s.app/Contents/MacOS/%s/scripts/addons/cycles' % (installdir,binary,VERSION)
@ -759,17 +764,17 @@ class BlenderEnvironment(SConsEnvironment):
lenv.Append(CPPPATH=includes)
lenv.Append(CPPDEFINES=defines)
if lenv['BF_DEBUG'] or (libname in quickdebug):
lenv.Append(CFLAGS = lenv['BF_DEBUG_CFLAGS'])
lenv.Append(CCFLAGS = lenv['BF_DEBUG_CCFLAGS'])
lenv.Append(CXXFLAGS = lenv['BF_DEBUG_CXXFLAGS'])
lenv.Append(CFLAGS = lenv['BF_DEBUG_CFLAGS'])
lenv.Append(CCFLAGS = lenv['BF_DEBUG_CCFLAGS'])
lenv.Append(CXXFLAGS = lenv['BF_DEBUG_CXXFLAGS'])
else:
lenv.Append(CFLAGS = lenv['REL_CFLAGS'])
lenv.Append(CCFLAGS = lenv['REL_CCFLAGS'])
lenv.Append(CXXFLAGS = lenv['REL_CXXFLAGS'])
lenv.Append(CFLAGS = lenv['REL_CFLAGS'])
lenv.Append(CCFLAGS = lenv['REL_CCFLAGS'])
lenv.Append(CXXFLAGS = lenv['REL_CXXFLAGS'])
if lenv['BF_PROFILE']:
lenv.Append(CFLAGS = lenv['BF_PROFILE_CFLAGS'])
lenv.Append(CCFLAGS = lenv['BF_PROFILE_CCFLAGS'])
lenv.Append(CXXFLAGS = lenv['BF_PROFILE_CXXFLAGS'])
lenv.Append(CFLAGS = lenv['BF_PROFILE_CFLAGS'])
lenv.Append(CCFLAGS = lenv['BF_PROFILE_CCFLAGS'])
lenv.Append(CXXFLAGS = lenv['BF_PROFILE_CXXFLAGS'])
if compileflags:
lenv.Replace(CFLAGS = compileflags)
if cc_compileflags:
@ -829,7 +834,7 @@ class BlenderEnvironment(SConsEnvironment):
if lenv['WITH_BF_PYTHON']:
lenv.Append(LINKFLAGS = lenv['BF_PYTHON_LINKFLAGS'])
if lenv['CXX'].endswith('CC'):
lenv.Replace(LINK = '$CXX')
lenv.Replace(LINK = '$CXX')
if lenv['OURPLATFORM']=='darwin':
if lenv['WITH_BF_PYTHON']:
lenv.Append(LINKFLAGS = lenv['BF_PYTHON_LINKFLAGS'])
@ -841,8 +846,8 @@ class BlenderEnvironment(SConsEnvironment):
lenv.Append(LIBPATH=libpath)
lenv.Append(LIBS=libs)
if lenv['WITH_BF_QUICKTIME']:
lenv.Append(LIBS = lenv['BF_QUICKTIME_LIB'])
lenv.Append(LIBPATH = lenv['BF_QUICKTIME_LIBPATH'])
lenv.Append(LIBS = lenv['BF_QUICKTIME_LIB'])
lenv.Append(LIBPATH = lenv['BF_QUICKTIME_LIBPATH'])
prog = lenv.Program(target=builddir+'bin/'+progname, source=sources)
if lenv['BF_DEBUG'] and lenv['OURPLATFORM'] in ('win32-vc', 'win64-vc') and lenv['BF_BSC']:
f = lenv.File(progname + '.bsc', builddir)

@ -52,7 +52,7 @@ def get_version():
else:
ver_display = "%s%s" % (ver_base, ver_char) # assume release
return ver_base, ver_display
return ver_base, ver_display, ver_cycle
raise Exception("%s: missing version string" % fname)
@ -80,7 +80,7 @@ def checkEndian():
# This is used in creating the local config directories
VERSION, VERSION_DISPLAY = get_version()
VERSION, VERSION_DISPLAY, VERSION_RELEASE_CYCLE = get_version()
REVISION = get_revision()
ENDIAN = checkEndian()

@ -52,9 +52,9 @@ else:
cmd = [blender_bin, "--help"]
print(" executing:", " ".join(cmd))
blender_help = subprocess.Popen(cmd, stdout=subprocess.PIPE).communicate()[0].decode()
blender_help = subprocess.Popen(cmd, stdout=subprocess.PIPE).communicate()[0].decode(encoding="utf-8")
blender_version = subprocess.Popen([blender_bin, "--version"], stdout=subprocess.PIPE).communicate()[0].decode().strip()
blender_version = subprocess.Popen([blender_bin, "--version"], stdout=subprocess.PIPE).communicate()[0].decode(encoding="utf-8").strip()
blender_version = blender_version.split("Build")[0]
date_string = datetime.date.fromtimestamp(time.time()).strftime("%B %d, %Y")

@ -1,45 +0,0 @@
# Testing the BGL module
import Blender
from Blender.BGL import *
from Blender import Draw
R = G = B = 0
A = 1
instructions = "Hold mouse buttons to change the background color."
quitting = " Press ESC or q to quit."
def show_win():
glClearColor(R,G,B,A) # define color used to clear buffers
glClear(GL_COLOR_BUFFER_BIT) # use it to clear the color buffer
glColor3f(1,1,1) # change default color
glRasterPos2i(50,100) # move cursor to x = 50, y = 100
Draw.Text("Testing BGL + Draw") # draw this text there
glRasterPos2i(350,20) # move cursor again
Draw.Text(instructions + quitting) # draw another msg
glBegin(GL_LINE_LOOP) # begin a vertex-data list
glVertex2i(46,92)
glVertex2i(120,92)
glVertex2i(120,115)
glVertex2i(46,115)
glEnd() # close this list
glColor3f(0.35,0.18,0.92) # change default color again
glBegin(GL_POLYGON) # another list, for a polygon
glVertex2i(315, 292)
glVertex2i(412, 200)
glVertex2i(264, 256)
glEnd()
Draw.Redraw(1) # make changes visible.
def ev(evt, val): # this is a callback for Draw.Register()
global R,G,B,A # it handles input events
if evt == Draw.ESCKEY or evt == Draw.QKEY:
Draw.Exit() # this quits the script
elif evt == Draw.LEFTMOUSE: R = 1 - R
elif evt == Draw.MIDDLEMOUSE: G = 1 - G
elif evt == Draw.RIGHTMOUSE: B = 1 - B
else:
Draw.Register(show_win, ev, None)
Draw.Register(show_win, ev, None) # start the main loop

@ -147,7 +147,7 @@ Armature Bones in Blender have three distinct data structures that contain them.
.. note::
In the following examples ``bpy.context.object`` is assumed to be an armature object.
In the following examples ``bpy.context.object`` is assumed to be an armature object.
Edit Bones
@ -163,11 +163,11 @@ This is only possible in edit mode.
This will be empty outside of editmode.
>>> mybones = bpy.context.selected_editable_bones
>>> mybones = bpy.context.selected_editable_bones
Returns an editbone only in edit mode.
>>> bpy.context.active_bone
>>> bpy.context.active_bone
Bones (Object Mode)
@ -179,15 +179,15 @@ Example using :class:`bpy.types.Bone` in object or pose mode:
Returns a bone (not an editbone) outside of edit mode
>>> bpy.context.active_bone
>>> bpy.context.active_bone
This works, as with blender the setting can be edited in any mode
>>> bpy.context.object.data.bones["Bone"].use_deform = True
>>> bpy.context.object.data.bones["Bone"].use_deform = True
Accessible but read-only
>>> tail = myobj.data.bones["Bone"].tail
>>> tail = myobj.data.bones["Bone"].tail
Pose Bones
@ -199,20 +199,20 @@ Examples using :class:`bpy.types.PoseBone` in object or pose mode:
.. code-block:: python
# Gets the name of the first constraint (if it exists)
bpy.context.object.pose.bones["Bone"].constraints[0].name
# Gets the name of the first constraint (if it exists)
bpy.context.object.pose.bones["Bone"].constraints[0].name
# Gets the last selected pose bone (pose mode only)
bpy.context.active_pose_bone
# Gets the last selected pose bone (pose mode only)
bpy.context.active_pose_bone
.. note::
Notice the pose is accessed from the object rather than the object data, this is why blender can have 2 or more objects sharing the same armature in different poses.
Notice the pose is accessed from the object rather than the object data, this is why blender can have 2 or more objects sharing the same armature in different poses.
.. note::
Strictly speaking PoseBone's are not bones, they are just the state of the armature, stored in the :class:`bpy.types.Object` rather than the :class:`bpy.types.Armature`, the real bones are however accessible from the pose bones - :class:`bpy.types.PoseBone.bone`
Strictly speaking PoseBone's are not bones, they are just the state of the armature, stored in the :class:`bpy.types.Object` rather than the :class:`bpy.types.Armature`, the real bones are however accessible from the pose bones - :class:`bpy.types.PoseBone.bone`
Armature Mode Switching
@ -223,6 +223,86 @@ While writing scripts that deal with armatures you may find you have to switch b
This is mainly an issue with editmode since pose data can be manipulated without having to be in pose mode, however for operator access you may still need to enter pose mode.
Data Names
==========
Naming Limitations
------------------
A common mistake is to assume newly created data is given the requested name.
This can cause bugs when you add some data (normally imported) and then reference it later by name.
.. code-block:: python
bpy.data.meshes.new(name=meshid)
# normally some code, function calls...
bpy.data.meshes[meshid]
Or with name assignment...
.. code-block:: python
obj.name = objname
# normally some code, function calls...
obj = bpy.data.meshes[objname]
Data names may not match the assigned values if they exceed the maximum length, are already used or an empty string.
Its better practice not to reference objects by names at all, once created you can store the data in a list, dictionary, on a class etc, there is rarely a reason to have to keep searching for the same data by name.
If you do need to use name references, its best to use a dictionary to maintain a mapping between the names of the imported assets and the newly created data, this way you don't run this risk of referencing existing data from the blend file, or worse modifying it.
.. code-block:: python
# typically declared in the main body of the function.
mesh_name_mapping = {}
mesh = bpy.data.meshes.new(name=meshid)
mesh_name_mapping[meshid] = mesh
# normally some code, or function calls...
# use own dictionary rather then bpy.data
mesh = mesh_name_mapping[meshid]
Library Collisions
------------------
Blender keeps data names unique - :class:`bpy.types.ID.name` so you can't name two objects, meshes, scenes etc the same thing by accident.
However when linking in library data from another blend file naming collisions can occur, so its best to avoid referencing data by name at all.
This can be tricky at times and not even blender handles this correctly in some case (when selecting the modifier object for eg you can't select between multiple objects with the same name), but its still good to try avoid problems in this area.
If you need to select between local and library data, there is a feature in ``bpy.data`` members to allow for this.
.. code-block:: python
# typical name lookup, could be local or library.
obj = bpy.data.objects["my_obj"]
# library object name look up using a pair
# where the second argument is the library path matching bpy.types.Library.filepath
obj = bpy.data.objects["my_obj", "//my_lib.blend"]
# local object name look up using a pair
# where the second argument excludes library data from being returned.
obj = bpy.data.objects["my_obj", None]
# both the examples above also works for 'get'
obj = bpy.data.objects.get(("my_obj", None))
Relative File Paths
===================
@ -230,12 +310,12 @@ Blenders relative file paths are not compatible with standard python modules suc
Built in python functions don't understand blenders ``//`` prefix which denotes the blend file path.
A common case where you would run into this problem is when exporting a material with assosiated image paths.
A common case where you would run into this problem is when exporting a material with associated image paths.
>>> bpy.path.abspath(image.filepath)
When using blender data from linked libraries there is an unfortunate complication since the path will be relative to the library rather then the open blend file. When the data block may be from an external blend file pass the library argument from the `bpy.types.ID`.
When using blender data from linked libraries there is an unfortunate complication since the path will be relative to the library rather then the open blend file. When the data block may be from an external blend file pass the library argument from the :class:`bpy.types.ID`.
>>> bpy.path.abspath(image.filepath, library=image.library)
@ -289,7 +369,7 @@ Unicode encoding/decoding is a big topic with comprehensive python documentation
* To print paths or to include them in the user interface use ``repr(path)`` first or ``"%r" % path`` with string formatting.
* **Possibly** - use bytes instead of python strings, when reading some input its less trouble to read it as binary data though you will still need to deciede how to treat any strings you want to use with Blender, some importers do this.
* **Possibly** - use bytes instead of python strings, when reading some input its less trouble to read it as binary data though you will still need to decide how to treat any strings you want to use with Blender, some importers do this.
Strange errors using 'threading' module
@ -458,3 +538,14 @@ Removing Data
**Any** data that you remove shouldn't be modified or accessed afterwards, this includes f-curves, drivers, render layers, timeline markers, modifiers, constraints along with objects, scenes, groups, bones.. etc.
This is a problem in the API at the moment that we should eventually solve.
sys.exit
========
Some python modules will call sys.exit() themselves when an error occurs, while not common behavior this is something to watch out for because it may seem as if blender is crashing since sys.exit() will quit blender immediately.
For example, the ``optparse`` module will print an error and exit if the arguments are invalid.
An ugly way of troubleshooting this is to set ``sys.exit = None`` and see what line of python code is quitting, you could of course replace ``sys.exit``/ with your own function but manipulating python in this way is bad practice.

@ -658,7 +658,7 @@ def pycontext2sphinx(BASEPATH):
char_array = c_char_p_p.from_address(attr)
i = 0
while char_array[i] is not None:
member = ctypes.string_at(char_array[i]).decode()
member = ctypes.string_at(char_array[i]).decode(encoding="ascii")
fw(".. data:: %s\n\n" % member)
member_type, is_seq = type_map[member]
fw(" :type: %s :class:`bpy.types.%s`\n\n" % ("sequence of " if is_seq else "", member_type))

@ -24,7 +24,7 @@
namespace libmv {
struct Offset {
signed char ix, iy;
short ix, iy;
unsigned char fx,fy;
};
@ -201,20 +201,14 @@ void CameraIntrinsics::ComputeLookupGrid(Grid* grid, int width, int height, doub
warp_y = warp_y*aspy + 0.5 * overscan * h;
int ix = int(warp_x), iy = int(warp_y);
int fx = round((warp_x-ix)*256), fy = round((warp_y-iy)*256);
if(fx == 256) { fx=0; ix++; }
if(fy == 256) { fy=0; iy++; }
// Use nearest border pixel
if( ix < 0 ) { ix = 0, fx = 0; }
if( iy < 0 ) { iy = 0, fy = 0; }
if( ix >= width-2 ) ix = width-2;
if( iy >= height-2 ) iy = height-2;
if ( ix-x > -128 && ix-x < 128 && iy-y > -128 && iy-y < 128 ) {
Offset offset = { ix-x, iy-y, fx, fy };
grid->offset[y*width+x] = offset;
} else {
Offset offset = { 0, 0, 0, 0 };
grid->offset[y*width+x] = offset;
}
Offset offset = { ix-x, iy-y, fx, fy };
grid->offset[y*width+x] = offset;
}
}
}

@ -61,6 +61,7 @@ include_directories(
# Subdirectories
if(WITH_CYCLES_BLENDER)
add_definitions(-DBLENDER_PLUGIN)
add_subdirectory(blender)
endif(WITH_CYCLES_BLENDER)

@ -1,11 +1,4 @@
set(BLENDER_INCLUDE_DIRS
${CMAKE_SOURCE_DIR}/intern/guardedalloc
${CMAKE_SOURCE_DIR}/source/blender/makesdna
${CMAKE_SOURCE_DIR}/source/blender/makesrna
${CMAKE_SOURCE_DIR}/source/blender/blenloader
${CMAKE_BINARY_DIR}/source/blender/makesrna/intern)
set(INC
../render
../device
@ -13,15 +6,18 @@ set(INC
../kernel/svm
../util
../subd
../../../intern/guardedalloc
../../../source/blender/makesdna
../../../source/blender/makesrna
../../../source/blender/blenloader
${CMAKE_BINARY_DIR}/source/blender/makesrna/intern
)
set(INC_SYS
${BLENDER_INCLUDE_DIRS}
${PYTHON_INCLUDE_DIRS}
${GLEW_INCLUDE_PATH}
)
set(SRC
blender_camera.cpp
blender_mesh.cpp

@ -43,7 +43,7 @@ from cycles import presets
class CyclesRender(bpy.types.RenderEngine):
bl_idname = 'CYCLES'
bl_label = "Cycles"
bl_label = "Cycles Render"
bl_use_shading_nodes = True
def __init__(self):

@ -295,7 +295,7 @@ class Cycles_PT_mesh_displacement(CyclesButtonsPanel, Panel):
@classmethod
def poll(cls, context):
return CyclesButtonsPanel.poll(context) and context.mesh or context.curve or context.meta_ball
return CyclesButtonsPanel.poll(context) and (context.mesh or context.curve or context.meta_ball)
def draw(self, context):
layout = self.layout

@ -99,6 +99,9 @@ static float get_node_output_value(BL::Node b_node, const string& name)
static void get_tex_mapping(TextureMapping *mapping, BL::TexMapping b_mapping)
{
if(!b_mapping)
return;
mapping->translation = get_float3(b_mapping.location());
mapping->rotation = get_float3(b_mapping.rotation());
mapping->scale = get_float3(b_mapping.scale());
@ -110,6 +113,9 @@ static void get_tex_mapping(TextureMapping *mapping, BL::TexMapping b_mapping)
static void get_tex_mapping(TextureMapping *mapping, BL::ShaderNodeMapping b_mapping)
{
if(!b_mapping)
return;
mapping->translation = get_float3(b_mapping.location());
mapping->rotation = get_float3(b_mapping.rotation());
mapping->scale = get_float3(b_mapping.scale());

@ -70,21 +70,6 @@ if(WITH_CYCLES_PARTIO)
endif()
###########################################################################
# Blender
if(WITH_CYCLES_BLENDER)
set(BLENDER_INCLUDE_DIRS
${CMAKE_SOURCE_DIR}/intern/guardedalloc
${CMAKE_SOURCE_DIR}/source/blender/makesdna
${CMAKE_SOURCE_DIR}/source/blender/makesrna
${CMAKE_SOURCE_DIR}/source/blender/blenloader
${CMAKE_BINARY_DIR}/source/blender/makesrna/intern)
add_definitions(-DBLENDER_PLUGIN)
endif()
###########################################################################
# CUDA

@ -260,12 +260,9 @@ public:
return true;
}
bool build_kernel(const string& kernel_path)
string kernel_build_options()
{
string build_options = "";
build_options += "-I " + kernel_path + ""; /* todo: escape path */
build_options += " -cl-fast-relaxed-math ";
string build_options = " -cl-fast-relaxed-math ";
/* Full Shading only on NVIDIA cards at the moment */
char vendor[256];
@ -273,14 +270,19 @@ public:
clGetPlatformInfo(cpPlatform, CL_PLATFORM_NAME, sizeof(vendor), &vendor, NULL);
string name = vendor;
if (name == "NVIDIA CUDA") {
build_options += "-D __SVM__ ";
build_options += "-D __EMISSION__ ";
build_options += "-D __TEXTURES__ ";
build_options += "-D __HOLDOUT__ ";
build_options += "-D __MULTI_CLOSURE__ ";
}
if(name == "NVIDIA CUDA")
build_options += "-D__KERNEL_SHADING__ -D__MULTI_CLOSURE__ ";
return build_options;
}
bool build_kernel(const string& kernel_path)
{
string build_options = "";
build_options += "-I " + kernel_path + ""; /* todo: escape path, but it doesn't get parsed correct? */
build_options += kernel_build_options();
ciErr = clBuildProgram(cpProgram, 0, NULL, build_options.c_str(), NULL, NULL);
if(ciErr != CL_SUCCESS) {
@ -344,6 +346,9 @@ public:
md5.append((uint8_t*)name, strlen(name));
md5.append((uint8_t*)driver, strlen(driver));
string options = kernel_build_options();
md5.append((uint8_t*)options.c_str(), options.size());
return md5.get_hex();
}
@ -563,24 +568,20 @@ public:
cl_int set_kernel_arg_mem(cl_kernel kernel, int *narg, const char *name)
{
cl_mem ptr;
cl_int size, err = 0;
cl_int err = 0;
if(mem_map.find(name) != mem_map.end()) {
device_memory *mem = mem_map[name];
ptr = CL_MEM_PTR(mem->device_pointer);
size = mem->data_width;
}
else {
/* work around NULL not working, even though the spec says otherwise */
ptr = CL_MEM_PTR(null_mem);
size = 1;
}
err |= clSetKernelArg(kernel, (*narg)++, sizeof(ptr), (void*)&ptr);
opencl_assert(err);
err |= clSetKernelArg(kernel, (*narg)++, sizeof(size), (void*)&size);
opencl_assert(err);
return err;
}

@ -33,8 +33,7 @@ __kernel void kernel_ocl_path_trace(
__global uint *rng_state,
#define KERNEL_TEX(type, ttype, name) \
__global type *name, \
int name##_width,
__global type *name,
#include "kernel_textures.h"
int sample,
@ -45,8 +44,7 @@ __kernel void kernel_ocl_path_trace(
kg->data = data;
#define KERNEL_TEX(type, ttype, name) \
kg->name = name; \
kg->name##_width = name##_width;
kg->name = name;
#include "kernel_textures.h"
int x = sx + get_global_id(0);
@ -62,8 +60,7 @@ __kernel void kernel_ocl_tonemap(
__global float4 *buffer,
#define KERNEL_TEX(type, ttype, name) \
__global type *name, \
int name##_width,
__global type *name,
#include "kernel_textures.h"
int sample, int resolution,
@ -74,8 +71,7 @@ __kernel void kernel_ocl_tonemap(
kg->data = data;
#define KERNEL_TEX(type, ttype, name) \
kg->name = name; \
kg->name##_width = name##_width;
kg->name = name;
#include "kernel_textures.h"
int x = sx + get_global_id(0);

@ -97,11 +97,7 @@ __device_inline void bvh_node_intersect(KernelGlobals *kg,
float c1loz = nz.z * idir.z - ood.z;
float c1hiz = nz.w * idir.z - ood.z;
float c0min_x = min(c0lox, c0hix);
float c0min_y = min(c0loy, c0hiy);
float c0min_z = min(c0loz, c0hiz);
float c0min = max4(c0min_x, c0min_y, c0min_z, 0.0f);
float c0min = max4(min(c0lox, c0hix), min(c0loy, c0hiy), min(c0loz, c0hiz), 0.0f);
float c0max = min4(max(c0lox, c0hix), max(c0loy, c0hiy), max(c0loz, c0hiz), t);
float c1lox = n1xy.x * idir.x - ood.x;
float c1hix = n1xy.y * idir.x - ood.x;

@ -127,8 +127,8 @@ __device void camera_sample_orthographic(KernelGlobals *kg, float raster_x, floa
__device void camera_sample(KernelGlobals *kg, int x, int y, float filter_u, float filter_v, float lens_u, float lens_v, Ray *ray)
{
/* pixel filter */
float raster_x = x + kernel_tex_interp(__filter_table, filter_u);
float raster_y = y + kernel_tex_interp(__filter_table, filter_v);
float raster_x = x + kernel_tex_interp(__filter_table, filter_u, FILTER_TABLE_SIZE);
float raster_y = y + kernel_tex_interp(__filter_table, filter_v, FILTER_TABLE_SIZE);
/* motion blur */
//ray->time = lerp(time_t, kernel_data.cam.shutter_open, kernel_data.cam.shutter_close);

@ -55,8 +55,10 @@ template<typename T> struct texture {
return ((__m128i*)data)[index];
}*/
float interp(float x)
float interp(float x, int size)
{
kernel_assert(size == width);
x = clamp(x, 0.0f, 1.0f)*width;
int index = min((int)x, width-1);
@ -151,7 +153,7 @@ typedef texture_image<uchar4> texture_image_uchar4;
#define kernel_tex_fetch(tex, index) (kg->tex.fetch(index))
#define kernel_tex_fetch_m128(tex, index) (kg->tex.fetch_m128(index))
#define kernel_tex_fetch_m128i(tex, index) (kg->tex.fetch_m128i(index))
#define kernel_tex_interp(tex, t) (kg->tex.interp(t))
#define kernel_tex_interp(tex, t, size) (kg->tex.interp(t, size))
#define kernel_tex_image_interp(tex, x, y) (kg->tex.interp(x, y))
#define kernel_data (kg->__data)

@ -55,7 +55,7 @@ typedef texture<uchar4, 2, cudaReadModeNormalizedFloat> texture_image_uchar4;
/* Macros to handle different memory storage on different devices */
#define kernel_tex_fetch(t, index) tex1Dfetch(t, index)
#define kernel_tex_interp(t, x) tex1D(t, x)
#define kernel_tex_interp(t, x, size) tex1D(t, x)
#define kernel_tex_image_interp(t, x, y) tex2D(t, x, y)
#define kernel_data __data

@ -100,7 +100,7 @@ __device float kernel_tex_interp_(__global float *data, int width, float x)
/* data lookup defines */
#define kernel_data (*kg->data)
#define kernel_tex_interp(t, x) kernel_tex_interp_(kg->t, kg->t##_width, x)
#define kernel_tex_interp(t, x, size) kernel_tex_interp_(kg->t, size, x)
#define kernel_tex_fetch(t, index) kg->t[index]
/* define NULL */

@ -77,8 +77,7 @@ typedef struct KernelGlobals {
__constant KernelData *data;
#define KERNEL_TEX(type, ttype, name) \
__global type *name; \
int name##_width;
__global type *name;
#include "kernel_textures.h"
} KernelGlobals;

@ -226,7 +226,7 @@ __device void shader_setup_from_displace(KernelGlobals *kg, ShaderData *sd,
Ng = triangle_normal_MT(kg, prim, &shader);
/* force smooth shading for displacement */
sd->shader |= SHADER_SMOOTH_NORMAL;
shader |= SHADER_SMOOTH_NORMAL;
/* watch out: no instance transform currently */

@ -25,9 +25,30 @@
CCL_NAMESPACE_BEGIN
#define OBJECT_SIZE 16
#define LIGHT_SIZE 4
/* constants */
#define OBJECT_SIZE 16
#define LIGHT_SIZE 4
#define FILTER_TABLE_SIZE 256
/* device capabilities */
#ifdef __KERNEL_CPU__
#define __KERNEL_SHADING__
#define __KERNEL_ADV_SHADING__
#endif
#ifdef __KERNEL_CUDA__
#define __KERNEL_SHADING__
#if __CUDA_ARCH__ >= 200
#define __KERNEL_ADV_SHADING__
#endif
#endif
#ifdef __KERNEL_OPENCL__
//#define __KERNEL_SHADING__
//#define __KERNEL_ADV_SHADING__
#endif
/* kernel features */
#define __SOBOL__
#define __INSTANCING__
#define __DPDU__
@ -39,27 +60,20 @@ CCL_NAMESPACE_BEGIN
#define __CAMERA_CLIPPING__
#define __INTERSECTION_REFINE__
#ifndef __KERNEL_OPENCL__
#ifdef __KERNEL_SHADING__
#define __SVM__
#define __EMISSION__
#define __TEXTURES__
#define __HOLDOUT__
#endif
#ifdef __KERNEL_ADV_SHADING__
#define __MULTI_CLOSURE__
#define __TRANSPARENT_SHADOWS__
#endif
//#define __MULTI_LIGHT__
#endif
#ifdef __KERNEL_CPU__
#define __MULTI_CLOSURE__
#define __TRANSPARENT_SHADOWS__
//#define __OSL__
#endif
#ifdef __KERNEL_CUDA__
#if __CUDA_ARCH__ >= 200
#define __MULTI_CLOSURE__
#define __TRANSPARENT_SHADOWS__
#endif
#endif
//#define __SOBOL_FULL_SCREEN__
//#define __MODIFY_TP__
//#define __QBVH__

@ -70,8 +70,8 @@ __device float3 bsdf_oren_nayar_get_intensity(const ShaderClosure *sc, float3 n,
cos_b = nl;
}
float sin_a = sqrtf(1.0f - cos_a * cos_a);
float tan_b = sqrtf(1.0f - cos_b * cos_b) / (cos_b + FLT_MIN);
float sin_a = sqrtf(max(1.0f - cos_a * cos_a, 0.0f));
float tan_b = sqrtf(max(1.0f - cos_b * cos_b, 0.0f)) / max(cos_b, 1e-8f);
float is = nl * (sc->data0 + sc->data1 * t * sin_a * tan_b);
return make_float3(is, is, is);
@ -84,8 +84,10 @@ __device void bsdf_oren_nayar_setup(ShaderData *sd, ShaderClosure *sc, float sig
sigma = clamp(sigma, 0.0f, 1.0f);
sc->data0 = 1.0f / ((1.0f + 0.5f * sigma) * M_PI_F);
sc->data1 = sigma / ((1.0f + 0.5f * sigma) * M_PI_F);
float div = 1.0f / ((1.0f + 0.5f * sigma) * M_PI_F);
sc->data0 = 1.0f * div;
sc->data1 = sigma * div;
}
__device void bsdf_oren_nayar_blur(ShaderClosure *sc, float roughness)

@ -21,6 +21,8 @@
#include "filter.h"
#include "scene.h"
#include "kernel_types.h"
#include "util_algorithm.h"
#include "util_debug.h"
#include "util_math.h"
@ -51,7 +53,7 @@ static float filter_func_gaussian(float v, float width)
static vector<float> filter_table(FilterType type, float width)
{
const int filter_table_size = 256;
const int filter_table_size = FILTER_TABLE_SIZE;
vector<float> filter_table_cdf(filter_table_size+1);
vector<float> filter_table(filter_table_size+1);
float (*filter_func)(float, float) = NULL;

@ -115,12 +115,12 @@ __device_inline double min(double a, double b)
__device_inline float min4(float a, float b, float c, float d)
{
return min(min(min(a, b), c), d);
return min(min(a, b), min(c, d));
}
__device_inline float max4(float a, float b, float c, float d)
{
return max(max(max(a, b), c), d);
return max(max(a, b), max(c, d));
}
#ifndef __KERNEL_OPENCL__

@ -62,7 +62,7 @@ def modules(module_cache):
path_list = paths()
# fake module importing
def fake_module(mod_name, mod_path, speedy=True):
def fake_module(mod_name, mod_path, speedy=True, force_support=None):
global error_encoding
if _bpy.app.debug:
@ -134,6 +134,9 @@ def modules(module_cache):
traceback.print_exc()
raise
if force_support is not None:
mod.bl_info["support"] = force_support
return mod
else:
return None
@ -141,6 +144,13 @@ def modules(module_cache):
modules_stale = set(module_cache.keys())
for path in path_list:
# force all contrib addons to be 'TESTING'
if path.endswith("addons_contrib") or path.endswith("addons_extern"):
force_support = 'TESTING'
else:
force_support = None
for mod_name, mod_path in _bpy.path.module_names(path):
modules_stale -= {mod_name}
mod = module_cache.get(mod_name)
@ -161,7 +171,7 @@ def modules(module_cache):
mod = None
if mod is None:
mod = fake_module(mod_name, mod_path)
mod = fake_module(mod_name, mod_path, force_support=force_support)
if mod:
module_cache[mod_name] = mod

@ -35,9 +35,9 @@ def drepr(string):
class DataPathBuilder(object):
__slots__ = ("data_path", )
""" Dummy class used to parse fcurve and driver data paths.
"""
__slots__ = ("data_path", )
def __init__(self, attrs):
self.data_path = attrs

@ -2,7 +2,6 @@ import bpy
camera = bpy.context.edit_movieclip.tracking.camera
camera.sensor_width = 23.4
camera.sensor_height = 15.6
camera.units = 'MILLIMETERS'
camera.focal_length = 24.0
camera.pixel_aspect = 1

@ -77,11 +77,11 @@ class CLIP_OT_track_to_empty(Operator):
return {'FINISHED'}
class CLIP_OT_tracks_to_mesh(Operator):
"""Create vertex cloud using coordinates of tracks"""
class CLIP_OT_bundles_to_mesh(Operator):
"""Create vertex cloud using coordinates of reconstructed tracks"""
bl_idname = "clip.tracks_to_mesh"
bl_label = "Tracks to Mesh"
bl_idname = "clip.bundles_to_mesh"
bl_label = "3D Markers to Mesh"
bl_options = {'UNDO', 'REGISTER'}
@classmethod
@ -116,7 +116,7 @@ class CLIP_OT_delete_proxy(Operator):
bl_idname = "clip.delete_proxy"
bl_label = "Delete Proxy"
bl_options = {'UNDO', 'REGISTER'}
bl_options = {'REGISTER'}
@classmethod
def poll(cls, context):
@ -191,7 +191,7 @@ class CLIP_OT_set_viewport_background(Operator):
bl_idname = "clip.set_viewport_background"
bl_label = "Set as Background"
bl_options = {'UNDO', 'REGISTER'}
bl_options = {'REGISTER'}
@classmethod
def poll(cls, context):
@ -211,7 +211,7 @@ class CLIP_OT_set_viewport_background(Operator):
break
if not bgpic:
bgpic = space_v3d.background_images.add()
bgpic = space_v3d.background_images.new()
bgpic.source = 'MOVIE'
bgpic.clip = clip
@ -259,14 +259,10 @@ object's movement caused by this constraint"""
con = x
if not con:
return
self.report({'ERROR'},
"Motion Tracking constraint to be converted not found")
if con.type == 'FOLLOW_TRACK' and con.use_3d_position:
mat = ob.matrix_world.copy()
ob.constraints.remove(con)
ob.matrix_world = mat
return
return {'CANCELLED'}
# Get clip used for parenting
if con.use_active_clip:
@ -275,7 +271,17 @@ object's movement caused by this constraint"""
clip = con.clip
if not clip:
return
self.report({'ERROR'},
"Movie clip to use tracking data from isn't set")
return {'CANCELLED'}
if con.type == 'FOLLOW_TRACK' and con.use_3d_position:
mat = ob.matrix_world.copy()
ob.constraints.remove(con)
ob.matrix_world = mat
return {'FINISHED'}
# Find start and end frames
for track in clip.tracking.tracks:

@ -116,11 +116,15 @@ def register():
)
WindowManager.addon_support = EnumProperty(
items=[('OFFICIAL', "Official", ""),
('COMMUNITY', 'Community', ""),
items=[('OFFICIAL', "Official", "Officially supported"),
('COMMUNITY', "Community", "Maintained by community developers"),
('TESTING', "Testing", "Newly contributed scripts (excluded from release builds)"),
],
name="Support",
description="Display support level", default={'OFFICIAL', 'COMMUNITY'}, options={'ENUM_FLAG'})
description="Display support level",
default={'OFFICIAL', 'COMMUNITY'},
options={'ENUM_FLAG'},
)
# done...

@ -454,12 +454,19 @@ class DATA_PT_modifiers(ModifierButtonsPanel, Panel):
layout.separator()
layout.prop(md, "use_normals")
row = layout.row()
row.prop(md, "use_foam")
sub = row.row()
split = layout.split()
col = split.column()
col.prop(md, "use_foam")
sub = col.row()
sub.active = md.use_foam
sub.prop(md, "foam_coverage", text="Coverage")
col = split.column()
col.active = md.use_foam
col.label("Foam Data Layer Name:")
col.prop(md, "foam_layer_name", text="")
layout.separator()

@ -408,7 +408,7 @@ class SceneButtonsPanel():
class SCENE_PT_game_navmesh(SceneButtonsPanel, Panel):
bl_label = "Navigation mesh"
bl_default_closed = True
bl_options = {'DEFAULT_CLOSED'}
COMPAT_ENGINES = {'BLENDER_GAME'}
@classmethod

@ -262,10 +262,6 @@ class PARTICLE_PT_hair_dynamics(ParticleButtonsPanel, Panel):
return psys.settings.type == 'HAIR' and (engine in cls.COMPAT_ENGINES)
def draw_header(self, context):
#cloth = context.cloth.collision_settings
#self.layout.active = cloth_panel_enabled(context.cloth)
#self.layout.prop(cloth, "use_collision", text="")
psys = context.particle_system
self.layout.prop(psys, "use_hair_dynamics", text="")

@ -452,66 +452,22 @@ class RENDER_PT_output(RenderButtonsPanel, Panel):
layout = self.layout
rd = context.scene.render
file_format = rd.file_format
image_settings = rd.image_settings
file_format = rd.image_settings.file_format
layout.prop(rd, "filepath", text="")
split = layout.split()
col = split.column()
col.prop(rd, "file_format", text="")
col.row().prop(rd, "color_mode", text="Color", expand=True)
col.template_image_settings(rd.image_settings)
col = split.column()
col.prop(rd, "use_file_extension")
col.prop(rd, "use_overwrite")
col.prop(rd, "use_placeholder")
if file_format in {'AVI_JPEG', 'JPEG'}:
layout.prop(rd, "file_quality", slider=True)
if file_format == 'PNG':
layout.prop(rd, "file_quality", slider=True, text="Compression")
if file_format in {'OPEN_EXR', 'MULTILAYER'}:
row = layout.row()
row.prop(rd, "exr_codec", text="Codec")
if file_format == 'OPEN_EXR':
row = layout.row()
row.prop(rd, "use_exr_half")
row.prop(rd, "exr_zbuf")
row.prop(rd, "exr_preview")
elif file_format == 'JPEG2000':
split = layout.split()
col = split.column()
col.label(text="Depth:")
col.row().prop(rd, "jpeg2k_depth", expand=True)
col = split.column()
col.prop(rd, "jpeg2k_preset", text="")
col.prop(rd, "jpeg2k_ycc")
elif file_format in {'CINEON', 'DPX'}:
split = layout.split()
split.label("FIXME: hard coded Non-Linear, Gamma:1.0")
'''
col = split.column()
col.prop(rd, "use_cineon_log", text="Convert to Log")
col = split.column(align=True)
col.active = rd.use_cineon_log
col.prop(rd, "cineon_black", text="Black")
col.prop(rd, "cineon_white", text="White")
col.prop(rd, "cineon_gamma", text="Gamma")
'''
elif file_format == 'TIFF':
layout.prop(rd, "use_tiff_16bit")
elif file_format == 'QUICKTIME_CARBON':
if file_format == 'QUICKTIME_CARBON':
layout.operator("scene.render_data_set_quicktime_codec")
elif file_format == 'QUICKTIME_QTKIT':
@ -552,7 +508,7 @@ class RENDER_PT_encoding(RenderButtonsPanel, Panel):
@classmethod
def poll(cls, context):
rd = context.scene.render
return rd.file_format in {'FFMPEG', 'XVID', 'H264', 'THEORA'}
return rd.image_settings.file_format in {'FFMPEG', 'XVID', 'H264', 'THEORA'}
def draw(self, context):
layout = self.layout

@ -195,14 +195,13 @@ class SCENE_PT_simplify(SceneButtonsPanel, Panel):
COMPAT_ENGINES = {'BLENDER_RENDER'}
def draw_header(self, context):
scene = context.scene
rd = scene.render
rd = context.scene.render
self.layout.prop(rd, "use_simplify", text="")
def draw(self, context):
layout = self.layout
scene = context.scene
rd = scene.render
rd = context.scene.render
layout.active = rd.use_simplify

@ -210,7 +210,7 @@ class CLIP_PT_tools_geometry(Panel):
def draw(self, context):
layout = self.layout
layout.operator("clip.tracks_to_mesh")
layout.operator("clip.bundles_to_mesh")
layout.operator("clip.track_to_empty")
@ -402,15 +402,15 @@ class CLIP_PT_display(Panel):
col.prop(sc, "show_marker_search", text="Search")
col.prop(sc, "show_pyramid_levels", text="Pyramid")
col.prop(sc, "show_track_path", text="Track Path")
col.prop(sc, "show_track_path", text="Path")
row = col.row()
row.active = sc.show_track_path
row.prop(sc, "path_length", text="Length")
col.prop(sc, "show_disabled", "Disabled Tracks")
col.prop(sc, "show_bundles", text="Bundles")
col.prop(sc, "show_bundles", text="3D Markers")
col.prop(sc, "show_names", text="Track Names and Status")
col.prop(sc, "show_names", text="Names and Status")
col.prop(sc, "show_tiny_markers", text="Compact Markers")
col.prop(sc, "show_grease_pencil", text="Grease Pencil")
@ -474,16 +474,14 @@ class CLIP_PT_stabilization(Panel):
return sc.mode == 'RECONSTRUCTION' and sc.clip
def draw_header(self, context):
sc = context.space_data
tracking = sc.clip.tracking
stab = tracking.stabilization
stab = context.space_data.clip.tracking.stabilization
self.layout.prop(stab, "use_2d_stabilization", text="")
def draw(self, context):
layout = self.layout
sc = context.space_data
tracking = sc.clip.tracking
tracking = context.space_data.clip.tracking
stab = tracking.stabilization
layout.active = stab.use_2d_stabilization

@ -473,9 +473,9 @@ class SEQUENCER_PT_effect(SequencerButtonsPanel, Panel):
if strip.type == 'SPEED':
col.prop(strip, "multiply_speed")
elif strip.type in {'CROSS', 'GAMMA_CROSS', 'PLUGIN', 'WIPE'}:
col.prop(strip, "use_default_fade", "Default fade")
if not strip.use_default_fade:
col.prop(strip, "effect_fader", text="Effect fader")
col.prop(strip, "use_default_fade", "Default fade")
if not strip.use_default_fade:
col.prop(strip, "effect_fader", text="Effect fader")
layout.prop(strip, "use_translation", text="Image Offset:")
if strip.use_translation:

@ -634,12 +634,51 @@ class USERPREF_PT_theme(Panel):
colsub.row().prop(ui, "inner_key_sel")
colsub.row().prop(ui, "blend")
ui = theme.user_interface
col.separator()
col.separator()
split = col.split(percentage=0.93)
split.prop(ui, "icon_file")
ui = theme.user_interface
col.label("Icons:")
row = col.row()
subsplit = row.split(percentage=0.95)
padding = subsplit.split(percentage=0.15)
colsub = padding.column()
colsub = padding.column()
colsub.row().prop(ui, "icon_file")
subsplit = row.split(percentage=0.85)
padding = subsplit.split(percentage=0.15)
colsub = padding.column()
colsub = padding.column()
colsub.row().prop(ui, "icon_alpha")
col.separator()
col.separator()
ui = theme.user_interface.panel
col.label("Panels:")
row = col.row()
subsplit = row.split(percentage=0.95)
padding = subsplit.split(percentage=0.15)
colsub = padding.column()
colsub = padding.column()
rowsub = colsub.row()
rowsub.prop(ui, "show_header")
rowsub.label()
subsplit = row.split(percentage=0.85)
padding = subsplit.split(percentage=0.15)
colsub = padding.column()
colsub = padding.column()
colsub.row().prop(ui, "header")
layout.separator()
layout.separator()
@ -891,6 +930,12 @@ class USERPREF_PT_addons(Panel):
bl_region_type = 'WINDOW'
bl_options = {'HIDE_HEADER'}
_support_icon_mapping = {
'OFFICIAL': 'FILE_BLEND',
'COMMUNITY': 'POSE_DATA',
'TESTING': 'MOD_EXPLODE',
}
@classmethod
def poll(cls, context):
userpref = context.user_preferences
@ -931,12 +976,13 @@ class USERPREF_PT_addons(Panel):
split = layout.split(percentage=0.2)
col = split.column()
col.prop(context.window_manager, "addon_search", text="", icon='VIEWZOOM')
col.label(text="Categories")
col.prop(context.window_manager, "addon_filter", expand=True)
col.label(text="Supported Level")
col.prop(context.window_manager, "addon_support", expand=True)
col.label(text="Categories")
col.prop(context.window_manager, "addon_filter", expand=True)
col = split.column()
# set in addon_utils.modules(...)
@ -995,12 +1041,7 @@ class USERPREF_PT_addons(Panel):
rowsub.label(icon='ERROR')
# icon showing support level.
if info["support"] == 'OFFICIAL':
rowsub.label(icon='FILE_BLEND')
elif info["support"] == 'COMMUNITY':
rowsub.label(icon='POSE_DATA')
else:
rowsub.label(icon='QUESTION')
rowsub.label(icon=self._support_icon_mapping.get(info["support"], 'QUESTION'))
if is_enabled:
row.operator("wm.addon_disable", icon='CHECKBOX_HLT', text="", emboss=False).module = module_name

@ -262,6 +262,7 @@ class VIEW3D_MT_uv_map(Menu):
layout.separator()
layout.operator_context = 'EXEC_REGION_WIN'
layout.operator("uv.project_from_view")
layout.operator("uv.project_from_view", text="Project from View (Bounds)").scale_to_bounds = True
@ -525,7 +526,7 @@ class VIEW3D_MT_select_edit_mesh(Menu):
layout.operator("mesh.select_by_number_vertices", text="Triangles").type = 'TRIANGLES'
layout.operator("mesh.select_by_number_vertices", text="Quads").type = 'QUADS'
if context.scene.tool_settings.mesh_select_mode[2] == False:
layout.operator("mesh.select_non_manifold", text="Non Manifold")
layout.operator("mesh.select_non_manifold", text="Non Manifold")
layout.operator("mesh.select_by_number_vertices", text="Loose Verts/Edges").type = 'OTHER'
layout.operator("mesh.select_similar", text="Similar")
@ -1830,32 +1831,32 @@ class VIEW3D_MT_edit_text_chars(Menu):
def draw(self, context):
layout = self.layout
layout.operator("font.text_insert", text="Copyright|Alt C").text = b'\xC2\xA9'.decode()
layout.operator("font.text_insert", text="Registered Trademark|Alt R").text = b'\xC2\xAE'.decode()
layout.operator("font.text_insert", text="Copyright|Alt C").text = "\u00A9"
layout.operator("font.text_insert", text="Registered Trademark|Alt R").text = "\u00AE"
layout.separator()
layout.operator("font.text_insert", text="Degree Sign|Alt G").text = b'\xC2\xB0'.decode()
layout.operator("font.text_insert", text="Multiplication Sign|Alt x").text = b'\xC3\x97'.decode()
layout.operator("font.text_insert", text="Circle|Alt .").text = b'\xC2\x8A'.decode()
layout.operator("font.text_insert", text="Superscript 1|Alt 1").text = b'\xC2\xB9'.decode()
layout.operator("font.text_insert", text="Superscript 2|Alt 2").text = b'\xC2\xB2'.decode()
layout.operator("font.text_insert", text="Superscript 3|Alt 3").text = b'\xC2\xB3'.decode()
layout.operator("font.text_insert", text="Double >>|Alt >").text = b'\xC2\xBB'.decode()
layout.operator("font.text_insert", text="Double <<|Alt <").text = b'\xC2\xAB'.decode()
layout.operator("font.text_insert", text="Promillage|Alt %").text = b'\xE2\x80\xB0'.decode()
layout.operator("font.text_insert", text="Degree Sign|Alt G").text = "\u00B0"
layout.operator("font.text_insert", text="Multiplication Sign|Alt x").text = "\u00D7"
layout.operator("font.text_insert", text="Circle|Alt .").text = "\u008A"
layout.operator("font.text_insert", text="Superscript 1|Alt 1").text = "\u00B9"
layout.operator("font.text_insert", text="Superscript 2|Alt 2").text = "\u00B2"
layout.operator("font.text_insert", text="Superscript 3|Alt 3").text = "\u00B3"
layout.operator("font.text_insert", text="Double >>|Alt >").text = "\u00BB"
layout.operator("font.text_insert", text="Double <<|Alt <").text = "\u00AB"
layout.operator("font.text_insert", text="Promillage|Alt %").text = "\u2030"
layout.separator()
layout.operator("font.text_insert", text="Dutch Florin|Alt F").text = b'\xC2\xA4'.decode()
layout.operator("font.text_insert", text="British Pound|Alt L").text = b'\xC2\xA3'.decode()
layout.operator("font.text_insert", text="Japanese Yen|Alt Y").text = b'\xC2\xA5'.decode()
layout.operator("font.text_insert", text="Dutch Florin|Alt F").text = "\u00A4"
layout.operator("font.text_insert", text="British Pound|Alt L").text = "\u00A3"
layout.operator("font.text_insert", text="Japanese Yen|Alt Y").text = "\u00A5"
layout.separator()
layout.operator("font.text_insert", text="German S|Alt S").text = b'\xC3\x9F'.decode()
layout.operator("font.text_insert", text="Spanish Question Mark|Alt ?").text = b'\xC2\xBF'.decode()
layout.operator("font.text_insert", text="Spanish Exclamation Mark|Alt !").text = b'\xC2\xA1'.decode()
layout.operator("font.text_insert", text="German S|Alt S").text = "\u00DF"
layout.operator("font.text_insert", text="Spanish Question Mark|Alt ?").text = "\u00BF"
layout.operator("font.text_insert", text="Spanish Exclamation Mark|Alt !").text = "\u00A1"
class VIEW3D_MT_edit_meta(Menu):
@ -2192,10 +2193,9 @@ class VIEW3D_PT_view3d_motion_tracking(Panel):
return (view)
def draw_header(self, context):
layout = self.layout
view = context.space_data
layout.prop(view, "show_reconstruction", text="")
self.layout.prop(view, "show_reconstruction", text="")
def draw(self, context):
layout = self.layout
@ -2204,7 +2204,7 @@ class VIEW3D_PT_view3d_motion_tracking(Panel):
col = layout.column()
col.active = view.show_reconstruction
col.prop(view, "show_tracks_name")
col.prop(view, "show_bundle_names")
col.prop(view, "show_camera_path")
col.label(text="Tracks:")
col.prop(view, "tracks_draw_type", text="")
@ -2277,10 +2277,9 @@ class VIEW3D_PT_background_image(Panel):
bl_options = {'DEFAULT_CLOSED'}
def draw_header(self, context):
layout = self.layout
view = context.space_data
layout.prop(view, "show_background_images", text="")
self.layout.prop(view, "show_background_images", text="")
def draw(self, context):
layout = self.layout
@ -2297,7 +2296,7 @@ class VIEW3D_PT_background_image(Panel):
row.prop(bg, "show_expanded", text="", emboss=False)
if bg.source == 'IMAGE' and bg.image:
row.prop(bg.image, "name", text="", emboss=False)
if bg.source == 'MOVIE' and bg.clip:
elif bg.source == 'MOVIE' and bg.clip:
row.prop(bg.clip, "name", text="", emboss=False)
else:
row.label(text="Not Set")
@ -2359,14 +2358,12 @@ class VIEW3D_PT_transform_orientations(Panel):
layout = self.layout
view = context.space_data
orientation = view.current_orientation
col = layout.column()
col.prop(view, "transform_orientation")
col.operator("transform.create_orientation", text="Create")
orientation = view.current_orientation
if orientation:
col.prop(orientation, "name")
col.operator("transform.delete_orientation", text="Delete")

@ -78,7 +78,7 @@ static const char *locales[] = {
"finnish", "fi_FI",
"swedish", "sv_SE",
"french", "fr_FR",
"spanish", "es_ES",
"spanish", "es",
"catalan", "ca_AD",
"czech", "cs_CZ",
"ptb", "pt_BR",

@ -42,7 +42,7 @@ extern "C" {
* and keep comment above the defines.
* Use STRINGIFY() rather than defining with quotes */
#define BLENDER_VERSION 260
#define BLENDER_SUBVERSION 4
#define BLENDER_SUBVERSION 5
#define BLENDER_MINVERSION 250
#define BLENDER_MINSUBVERSION 0

@ -36,28 +36,80 @@
extern "C" {
#endif
#include "DNA_vec_types.h"
struct Camera;
struct Object;
struct RegionView3D;
struct RenderData;
struct Scene;
struct rctf;
struct View3D;
/* Camera Datablock */
void *add_camera(const char *name);
struct Camera *copy_camera(struct Camera *cam);
void make_local_camera(struct Camera *cam);
void free_camera(struct Camera *ca);
float dof_camera(struct Object *ob);
/* Camera Usage */
void object_camera_mode(struct RenderData *rd, struct Object *camera);
void object_camera_intrinsics(struct Object *camera, struct Camera **cam_r, short *is_ortho, float *shiftx, float *shifty,
float *clipsta, float *clipend, float *lens, float *sensor_x, float *sensor_y, short *sensor_fit);
void object_camera_matrix(
struct RenderData *rd, struct Object *camera, int winx, int winy, short field_second,
float winmat[][4], struct rctf *viewplane, float *clipsta, float *clipend, float *lens,
float *sensor_x, float *sensor_y, short *sensor_fit, float *ycor,
float *viewdx, float *viewdy);
float object_camera_dof_distance(struct Object *ob);
void object_camera_mode(struct RenderData *rd, struct Object *ob);
int camera_sensor_fit(int sensor_fit, float sizex, float sizey);
float camera_sensor_size(int sensor_fit, float sensor_x, float sensor_y);
/* Camera Parameters:
*
* Intermediate struct for storing camera parameters from various sources,
* to unify computation of viewplane, window matrix, ... */
typedef struct CameraParams {
/* lens */
int is_ortho;
float lens;
float ortho_scale;
float zoom;
float shiftx;
float shifty;
float offsetx;
float offsety;
/* sensor */
float sensor_x;
float sensor_y;
int sensor_fit;
/* clipping */
float clipsta;
float clipend;
/* fields */
int use_fields;
int field_second;
int field_odd;
/* computed viewplane */
float ycor;
float viewdx;
float viewdy;
rctf viewplane;
/* computed matrix */
float winmat[4][4];
} CameraParams;
void camera_params_init(CameraParams *params);
void camera_params_from_object(CameraParams *params, struct Object *camera);
void camera_params_from_view3d(CameraParams *params, struct View3D *v3d, struct RegionView3D *rv3d);
void camera_params_compute_viewplane(CameraParams *params, int winx, int winy, float aspx, float aspy);
void camera_params_compute_matrix(CameraParams *params);
/* Camera View Frame */
void camera_view_frame_ex(struct Scene *scene, struct Camera *camera, float drawsize, const short do_clip, const float scale[3],
float r_asp[2], float r_shift[2], float *r_drawsize, float r_vec[4][3]);

@ -43,6 +43,7 @@ struct Tex;
struct anim;
struct Scene;
struct Object;
struct ImageFormatData;
/* call from library */
void free_image(struct Image *me);
@ -50,13 +51,19 @@ void free_image(struct Image *me);
void BKE_stamp_info(struct Scene *scene, struct Object *camera, struct ImBuf *ibuf);
void BKE_stamp_buf(struct Scene *scene, struct Object *camera, unsigned char *rect, float *rectf, int width, int height, int channels);
int BKE_alphatest_ibuf(struct ImBuf *ibuf);
int BKE_write_ibuf_stamp(struct Scene *scene, struct Object *camera, struct ImBuf *ibuf, const char *name, int imtype, int subimtype, int quality);
int BKE_write_ibuf(struct ImBuf *ibuf, const char *name, int imtype, int subimtype, int quality);
void BKE_makepicstring(char *string, const char *base, int frame, int imtype, const short use_ext, const short use_frames);
int BKE_add_image_extension(char *string, int imtype);
int BKE_ftype_to_imtype(int ftype);
int BKE_imtype_to_ftype(int imtype);
int BKE_imtype_is_movie(int imtype);
int BKE_write_ibuf_stamp(struct Scene *scene, struct Object *camera, struct ImBuf *ibuf, const char *name, struct ImageFormatData *imf);
int BKE_write_ibuf(struct ImBuf *ibuf, const char *name, struct ImageFormatData *imf);
void BKE_makepicstring(char *string, const char *base, const char *relbase, int frame, char imtype, const short use_ext, const short use_frames);
int BKE_add_image_extension(char *string, const char imtype);
char BKE_ftype_to_imtype(const int ftype);
int BKE_imtype_to_ftype(char imtype);
int BKE_imtype_is_movie(const char imtype);
int BKE_imtype_supports_alpha(const char imtype);
int BKE_imtype_supports_zbuf(const char imtype);
int BKE_imtype_supports_compress(const char imtype);
int BKE_imtype_supports_quality(const char imtype);
char BKE_imtype_valid_depths(const char imtype);
struct anim *openanim(const char *name, int flags, int streamindex);

@ -364,5 +364,8 @@ void test_object_modifiers(struct Object *ob);
/* here for do_versions */
void modifier_mdef_compact_influences(struct ModifierData *md);
void modifier_path_init(char *path, int path_maxlen, const char *name);
const char *modifier_path_relbase(struct Object *ob);
#endif

@ -190,10 +190,24 @@ typedef struct bNodeType {
* when a final generic version of execution code is defined, this will be changed anyway
*/
void (*newexecfunc)(void *data, int thread, struct bNode *, void *nodedata, struct bNodeStack **, struct bNodeStack **);
/* This is the muting callback.
* XXX Mimics the newexecfunc signature... Not sure all of this will be useful, we will see.
*/
void (*mutefunc)(void *data, int thread, struct bNode *, void *nodedata, struct bNodeStack **, struct bNodeStack **);
/* And the muting util.
* Returns links as a ListBase, as pairs of bNodeStack* if in/out bNodeStacks were provided,
* else as pairs of bNodeSocket* if node tree was provided.
*/
ListBase (*mutelinksfunc)(struct bNodeTree *, struct bNode *, struct bNodeStack **, struct bNodeStack **,
struct GPUNodeStack *, struct GPUNodeStack *);
/* gpu */
int (*gpufunc)(struct GPUMaterial *mat, struct bNode *node, struct GPUNodeStack *in, struct GPUNodeStack *out);
/* extended gpu function */
int (*gpuextfunc)(struct GPUMaterial *mat, struct bNode *node, void *nodedata, struct GPUNodeStack *in, struct GPUNodeStack *out);
/* This is the muting gpu callback.
* XXX Mimics the gpuextfunc signature... Not sure all of this will be useful, we will see.
*/
int (*gpumutefunc)(struct GPUMaterial *, struct bNode *, void *, struct GPUNodeStack *, struct GPUNodeStack *);
} bNodeType;
/* node->exec, now in use for composites (#define for break is same as ready yes) */
@ -270,6 +284,13 @@ typedef struct bNodeTreeType
void (*update_node)(struct bNodeTree *ntree, struct bNode *node);
int (*validate_link)(struct bNodeTree *ntree, struct bNodeLink *link);
/* Default muting pointers. */
void (*mutefunc)(void *data, int thread, struct bNode *, void *nodedata, struct bNodeStack **, struct bNodeStack **);
ListBase (*mutelinksfunc)(struct bNodeTree *, struct bNode *, struct bNodeStack **, struct bNodeStack **,
struct GPUNodeStack *, struct GPUNodeStack *);
/* gpu */
int (*gpumutefunc)(struct GPUMaterial *, struct bNode *, void *, struct GPUNodeStack *, struct GPUNodeStack *);
} bNodeTreeType;
/* ************** GENERIC API, TREES *************** */
@ -325,7 +346,7 @@ struct bNode *nodeAddNode(struct bNodeTree *ntree, struct bNodeTemplate *ntemp);
void nodeUnlinkNode(struct bNodeTree *ntree, struct bNode *node);
void nodeUniqueName(struct bNodeTree *ntree, struct bNode *node);
void nodeRegisterType(struct ListBase *typelist, struct bNodeType *ntype) ;
void nodeRegisterType(struct bNodeTreeType *ttype, struct bNodeType *ntype) ;
void nodeMakeDynamicType(struct bNode *node);
int nodeDynamicUnlinkText(struct ID *txtid);
@ -368,7 +389,8 @@ struct bNodeTree *nodeGroupEditSet(struct bNode *node, int edit);
void nodeGroupEditClear(struct bNode *node);
/* Init a new node type struct with default values and callbacks */
void node_type_base(struct bNodeType *ntype, int type, const char *name, short nclass, short flag);
void node_type_base(struct bNodeTreeType *ttype, struct bNodeType *ntype, int type,
const char *name, short nclass, short flag);
void node_type_socket_templates(struct bNodeType *ntype, struct bNodeSocketTemplate *inputs, struct bNodeSocketTemplate *outputs);
void node_type_size(struct bNodeType *ntype, int width, int minwidth, int maxwidth);
void node_type_init(struct bNodeType *ntype, void (*initfunc)(struct bNodeTree *ntree, struct bNode *node, struct bNodeTemplate *ntemp));
@ -390,13 +412,25 @@ void node_type_group_edit(struct bNodeType *ntype,
struct bNodeTree *(*group_edit_set)(struct bNode *node, int edit),
void (*group_edit_clear)(struct bNode *node));
void node_type_exec(struct bNodeType *ntype, void (*execfunc)(void *data, struct bNode *, struct bNodeStack **, struct bNodeStack **));
void node_type_exec(struct bNodeType *ntype, void (*execfunc)(void *data, struct bNode *, struct bNodeStack **,
struct bNodeStack **));
void node_type_exec_new(struct bNodeType *ntype,
void *(*initexecfunc)(struct bNode *node),
void (*freeexecfunc)(struct bNode *node, void *nodedata),
void (*newexecfunc)(void *data, int thread, struct bNode *, void *nodedata, struct bNodeStack **, struct bNodeStack **));
void node_type_gpu(struct bNodeType *ntype, int (*gpufunc)(struct GPUMaterial *mat, struct bNode *node, struct GPUNodeStack *in, struct GPUNodeStack *out));
void node_type_gpu_ext(struct bNodeType *ntype, int (*gpuextfunc)(struct GPUMaterial *mat, struct bNode *node, void *nodedata, struct GPUNodeStack *in, struct GPUNodeStack *out));
void (*newexecfunc)(void *data, int thread, struct bNode *, void *nodedata,
struct bNodeStack **, struct bNodeStack **));
void node_type_mute(struct bNodeType *ntype,
void (*mutefunc)(void *data, int thread, struct bNode *, void *nodedata,
struct bNodeStack **, struct bNodeStack **),
ListBase (*mutelinksfunc)(struct bNodeTree *, struct bNode *, struct bNodeStack **,
struct bNodeStack **, struct GPUNodeStack*, struct GPUNodeStack*));
void node_type_gpu(struct bNodeType *ntype, int (*gpufunc)(struct GPUMaterial *mat, struct bNode *node,
struct GPUNodeStack *in, struct GPUNodeStack *out));
void node_type_gpu_ext(struct bNodeType *ntype, int (*gpuextfunc)(struct GPUMaterial *mat, struct bNode *node,
void *nodedata, struct GPUNodeStack *in,
struct GPUNodeStack *out));
void node_type_gpu_mute(struct bNodeType *ntype, int (*gpumutefunc)(struct GPUMaterial *, struct bNode *, void *,
struct GPUNodeStack *, struct GPUNodeStack *));
void node_type_compatibility(struct bNodeType *ntype, short compatibility);
/* ************** COMMON NODES *************** */
@ -421,7 +455,7 @@ struct bNode *node_group_make_from_selected(struct bNodeTree *ntree);
int node_group_ungroup(struct bNodeTree *ntree, struct bNode *gnode);
/* in node_common.c */
void register_node_type_frame(ListBase *lb);
void register_node_type_frame(struct bNodeTreeType *ttype);
/* ************** SHADER NODES *************** */

@ -94,7 +94,6 @@ void object_to_mat3(struct Object *ob, float mat[][3]);
void object_to_mat4(struct Object *ob, float mat[][4]);
void object_apply_mat4(struct Object *ob, float mat[][4], const short use_compat, const short use_parent);
void set_no_parent_ipo(int val);
struct Object *object_pose_armature_get(struct Object *ob);
void where_is_object_time(struct Scene *scene, struct Object *ob, float ctime);

@ -48,7 +48,8 @@ typedef struct OceanCache {
struct ImBuf **ibufs_foam;
struct ImBuf **ibufs_norm;
char *bakepath;
const char *bakepath;
const char *relbase;
/* precalculated for time range */
float *time;
@ -92,8 +93,9 @@ void BKE_ocean_eval_ij(struct Ocean * oc, struct OceanResult *ocr, int i, int j)
/* ocean cache handling */
struct OceanCache *BKE_init_ocean_cache(char *bakepath, int start, int end, float wave_scale,
float chop_amount, float foam_coverage, float foam_fade, int resolution);
struct OceanCache *BKE_init_ocean_cache(const char *bakepath, const char *relbase,
int start, int end, float wave_scale,
float chop_amount, float foam_coverage, float foam_fade, int resolution);
void BKE_simulate_ocean_cache(struct OceanCache *och, int frame);
void BKE_bake_ocean(struct Ocean *o, struct OceanCache *och, void (*update_cb)(void *, float progress, int *cancel), void *update_cb_data);

@ -44,6 +44,7 @@ struct Main;
struct Object;
struct QuicktimeCodecData;
struct RenderData;
struct SceneRenderLayer;
struct Scene;
struct Text;
struct Text;
@ -93,7 +94,8 @@ void scene_clear_tagged(struct Main *bmain, struct Scene *sce);
void scene_update_for_newframe(struct Main *bmain, struct Scene *sce, unsigned int lay);
void scene_add_render_layer(struct Scene *sce);
struct SceneRenderLayer *scene_add_render_layer(struct Scene *sce, const char *name);
int scene_remove_render_layer(struct Main *main, struct Scene *scene, struct SceneRenderLayer *srl);
/* render profile */
int get_render_subsurf_level(struct RenderData *r, int level);

@ -50,7 +50,7 @@ typedef struct bMovieHandle {
void (*get_movie_path)(char *string, struct RenderData *rd); /* optional */
} bMovieHandle;
bMovieHandle *BKE_get_movie_handle(int imtype);
bMovieHandle *BKE_get_movie_handle(const char imtype);
void BKE_makeanimstring(char *string, struct RenderData *rd);
#ifdef __cplusplus

@ -1373,17 +1373,17 @@ void animsys_evaluate_action (PointerRNA *ptr, bAction *act, AnimMapper *remap,
static float nlastrip_get_influence (NlaStrip *strip, float cframe)
{
/* sanity checks - normalise the blendin/out values? */
strip->blendin= (float)fabs(strip->blendin);
strip->blendout= (float)fabs(strip->blendout);
strip->blendin= fabsf(strip->blendin);
strip->blendout= fabsf(strip->blendout);
/* result depends on where frame is in respect to blendin/out values */
if (IS_EQ(strip->blendin, 0)==0 && (cframe <= (strip->start + strip->blendin))) {
/* there is some blend-in */
return (float)fabs(cframe - strip->start) / (strip->blendin);
return fabsf(cframe - strip->start) / (strip->blendin);
}
else if (IS_EQ(strip->blendout, 0)==0 && (cframe >= (strip->end - strip->blendout))) {
/* there is some blend-out */
return (float)fabs(strip->end - cframe) / (strip->blendout);
return fabsf(strip->end - cframe) / (strip->blendout);
}
else {
/* in the middle of the strip, we should be full strength */

@ -159,7 +159,7 @@ void readBitmapFontVersion0(ImBuf * ibuf, unsigned char * rect, int step)
ibuf->userdata = bmfont;
ibuf->userflags |= IB_BITMAPFONT;
if (ibuf->depth < 32) {
if (ibuf->planes < 32) {
// we're going to fake alpha here:
calcAlpha(ibuf);
}

@ -35,6 +35,7 @@
#include "DNA_lamp_types.h"
#include "DNA_object_types.h"
#include "DNA_scene_types.h"
#include "DNA_view3d_types.h"
#include "BLI_math.h"
#include "BLI_utildefines.h"
@ -45,6 +46,9 @@
#include "BKE_global.h"
#include "BKE_library.h"
#include "BKE_main.h"
#include "BKE_screen.h"
/****************************** Camera Datablock *****************************/
void *add_camera(const char *name)
{
@ -70,7 +74,9 @@ Camera *copy_camera(Camera *cam)
Camera *camn;
camn= copy_libblock(&cam->id);
id_lib_extern((ID *)camn->dof_ob);
return camn;
}
@ -121,8 +127,26 @@ void make_local_camera(Camera *cam)
}
}
void free_camera(Camera *ca)
{
BKE_free_animdata((ID *)ca);
}
/******************************** Camera Usage *******************************/
void object_camera_mode(RenderData *rd, Object *cam_ob)
{
rd->mode &= ~(R_ORTHO|R_PANORAMA);
if(cam_ob && cam_ob->type==OB_CAMERA) {
Camera *cam= cam_ob->data;
if(cam->type == CAM_ORTHO) rd->mode |= R_ORTHO;
if(cam->flag & CAM_PANORAMA) rd->mode |= R_PANORAMA;
}
}
/* get the camera's dof value, takes the dof object into account */
float dof_camera(Object *ob)
float object_camera_dof_distance(Object *ob)
{
Camera *cam = (Camera *)ob->data;
if (ob->type != OB_CAMERA)
@ -136,180 +160,212 @@ float dof_camera(Object *ob)
normalize_m4(obmat);
invert_m4_m4(imat, obmat);
mul_m4_m4m4(mat, cam->dof_ob->obmat, imat);
return (float)fabs(mat[3][2]);
return fabsf(mat[3][2]);
}
return cam->YF_dofdist;
}
void free_camera(Camera *ca)
float camera_sensor_size(int sensor_fit, float sensor_x, float sensor_y)
{
BKE_free_animdata((ID *)ca);
/* sensor size used to fit to. for auto, sensor_x is both x and y. */
if(sensor_fit == CAMERA_SENSOR_FIT_VERT)
return sensor_y;
return sensor_x;
}
void object_camera_mode(RenderData *rd, Object *camera)
int camera_sensor_fit(int sensor_fit, float sizex, float sizey)
{
rd->mode &= ~(R_ORTHO|R_PANORAMA);
if(camera && camera->type==OB_CAMERA) {
Camera *cam= camera->data;
if(cam->type == CAM_ORTHO) rd->mode |= R_ORTHO;
if(cam->flag & CAM_PANORAMA) rd->mode |= R_PANORAMA;
if(sensor_fit == CAMERA_SENSOR_FIT_AUTO) {
if(sizex >= sizey)
return CAMERA_SENSOR_FIT_HOR;
else
return CAMERA_SENSOR_FIT_VERT;
}
return sensor_fit;
}
void object_camera_intrinsics(Object *camera, Camera **cam_r, short *is_ortho, float *shiftx, float *shifty,
float *clipsta, float *clipend, float *lens, float *sensor_x, float *sensor_y, short *sensor_fit)
/******************************** Camera Params *******************************/
void camera_params_init(CameraParams *params)
{
Camera *cam= NULL;
memset(params, 0, sizeof(CameraParams));
(*shiftx)= 0.0f;
(*shifty)= 0.0f;
/* defaults */
params->sensor_x= DEFAULT_SENSOR_WIDTH;
params->sensor_y= DEFAULT_SENSOR_HEIGHT;
params->sensor_fit= CAMERA_SENSOR_FIT_AUTO;
(*sensor_x)= DEFAULT_SENSOR_WIDTH;
(*sensor_y)= DEFAULT_SENSOR_HEIGHT;
(*sensor_fit)= CAMERA_SENSOR_FIT_AUTO;
params->zoom= 1.0f;
}
if(camera->type==OB_CAMERA) {
cam= camera->data;
void camera_params_from_object(CameraParams *params, Object *ob)
{
if(!ob)
return;
if(cam->type == CAM_ORTHO) {
*is_ortho= TRUE;
}
if(ob->type==OB_CAMERA) {
/* camera object */
Camera *cam= ob->data;
/* solve this too... all time depending stuff is in convertblender.c?
* Need to update the camera early because it's used for projection matrices
* and other stuff BEFORE the animation update loop is done
* */
#if 0 // XXX old animation system
if(cam->ipo) {
calc_ipo(cam->ipo, frame_to_float(re->scene, re->r.cfra));
execute_ipo(&cam->id, cam->ipo);
}
#endif // XXX old animation system
(*shiftx)=cam->shiftx;
(*shifty)=cam->shifty;
(*lens)= cam->lens;
(*sensor_x)= cam->sensor_x;
(*sensor_y)= cam->sensor_y;
(*clipsta)= cam->clipsta;
(*clipend)= cam->clipend;
(*sensor_fit)= cam->sensor_fit;
if(cam->type == CAM_ORTHO)
params->is_ortho= TRUE;
params->lens= cam->lens;
params->ortho_scale= cam->ortho_scale;
params->shiftx= cam->shiftx;
params->shifty= cam->shifty;
params->sensor_x= cam->sensor_x;
params->sensor_y= cam->sensor_y;
params->sensor_fit= cam->sensor_fit;
params->clipsta= cam->clipsta;
params->clipend= cam->clipend;
}
else if(camera->type==OB_LAMP) {
Lamp *la= camera->data;
else if(ob->type==OB_LAMP) {
/* lamp object */
Lamp *la= ob->data;
float fac= cosf((float)M_PI*la->spotsize/360.0f);
float phi= acos(fac);
(*lens)= 16.0f*fac/sinf(phi);
if((*lens)==0.0f)
(*lens)= 35.0f;
(*clipsta)= la->clipsta;
(*clipend)= la->clipend;
}
else { /* envmap exception... */;
if((*lens)==0.0f) /* is this needed anymore? */
(*lens)= 16.0f;
params->lens= 16.0f*fac/sinf(phi);
if(params->lens==0.0f)
params->lens= 35.0f;
if((*clipsta)==0.0f || (*clipend)==0.0f) {
(*clipsta)= 0.1f;
(*clipend)= 1000.0f;
}
params->clipsta= la->clipsta;
params->clipend= la->clipend;
}
(*cam_r)= cam;
}
/* 'lens' may be set for envmap only */
void object_camera_matrix(
RenderData *rd, Object *camera, int winx, int winy, short field_second,
float winmat[][4], rctf *viewplane, float *clipsta, float *clipend, float *lens,
float *sensor_x, float *sensor_y, short *sensor_fit, float *ycor,
float *viewdx, float *viewdy)
void camera_params_from_view3d(CameraParams *params, View3D *v3d, RegionView3D *rv3d)
{
Camera *cam=NULL;
float pixsize;
float shiftx=0.0, shifty=0.0, winside, viewfac;
short is_ortho= FALSE;
/* common */
params->lens= v3d->lens;
params->clipsta= v3d->near;
params->clipend= v3d->far;
/* question mark */
(*ycor)= rd->yasp / rd->xasp;
if(rd->mode & R_FIELDS)
(*ycor) *= 2.0f;
if(rv3d->persp==RV3D_CAMOB) {
/* camera view */
camera_params_from_object(params, v3d->camera);
object_camera_intrinsics(camera, &cam, &is_ortho, &shiftx, &shifty, clipsta, clipend, lens, sensor_x, sensor_y, sensor_fit);
params->zoom= BKE_screen_view3d_zoom_to_fac((float)rv3d->camzoom);
/* ortho only with camera available */
if(cam && is_ortho) {
if((*sensor_fit)==CAMERA_SENSOR_FIT_AUTO) {
if(rd->xasp*winx >= rd->yasp*winy) viewfac= winx;
else viewfac= (*ycor) * winy;
}
else if((*sensor_fit)==CAMERA_SENSOR_FIT_HOR) {
viewfac= winx;
}
else { /* if((*sensor_fit)==CAMERA_SENSOR_FIT_VERT) { */
viewfac= (*ycor) * winy;
}
params->offsetx= 2.0f*rv3d->camdx*params->zoom;
params->offsety= 2.0f*rv3d->camdy*params->zoom;
/* ortho_scale == 1.0 means exact 1 to 1 mapping */
pixsize= cam->ortho_scale/viewfac;
params->shiftx *= params->zoom;
params->shifty *= params->zoom;
params->zoom= 1.0f/params->zoom;
}
else if(rv3d->persp==RV3D_ORTHO) {
/* orthographic view */
params->clipend *= 0.5f; // otherwise too extreme low zbuffer quality
params->clipsta= - params->clipend;
params->is_ortho= TRUE;
params->ortho_scale = rv3d->dist;
params->zoom= 2.0f;
}
else {
if((*sensor_fit)==CAMERA_SENSOR_FIT_AUTO) {
if(rd->xasp*winx >= rd->yasp*winy) viewfac= ((*lens) * winx) / (*sensor_x);
else viewfac= (*ycor) * ((*lens) * winy) / (*sensor_x);
}
else if((*sensor_fit)==CAMERA_SENSOR_FIT_HOR) {
viewfac= ((*lens) * winx) / (*sensor_x);
}
else { /* if((*sensor_fit)==CAMERA_SENSOR_FIT_VERT) { */
viewfac= ((*lens) * winy) / (*sensor_y);
}
/* perspective view */
params->zoom= 2.0f;
}
}
pixsize= (*clipsta) / viewfac;
void camera_params_compute_viewplane(CameraParams *params, int winx, int winy, float xasp, float yasp)
{
rctf viewplane;
float pixsize, viewfac, sensor_size, dx, dy;
int sensor_fit;
/* fields rendering */
params->ycor= yasp/xasp;
if(params->use_fields)
params->ycor *= 2.0f;
if(params->is_ortho) {
/* orthographic camera */
/* scale == 1.0 means exact 1 to 1 mapping */
pixsize= params->ortho_scale;
}
else {
/* perspective camera */
sensor_size= camera_sensor_size(params->sensor_fit, params->sensor_x, params->sensor_y);
pixsize= (sensor_size * params->clipsta)/params->lens;
}
/* viewplane fully centered, zbuffer fills in jittered between -.5 and +.5 */
winside= MAX2(winx, winy);
/* determine sensor fit */
sensor_fit = camera_sensor_fit(params->sensor_fit, xasp*winx, yasp*winy);
if(cam) {
if(cam->sensor_fit==CAMERA_SENSOR_FIT_HOR)
winside= winx;
else if(cam->sensor_fit==CAMERA_SENSOR_FIT_VERT)
winside= winy;
}
if(sensor_fit==CAMERA_SENSOR_FIT_HOR)
viewfac= winx;
else
viewfac= params->ycor * winy;
viewplane->xmin= -0.5f*(float)winx + shiftx*winside;
viewplane->ymin= -0.5f*(*ycor)*(float)winy + shifty*winside;
viewplane->xmax= 0.5f*(float)winx + shiftx*winside;
viewplane->ymax= 0.5f*(*ycor)*(float)winy + shifty*winside;
pixsize /= viewfac;
if(field_second) {
if(rd->mode & R_ODDFIELD) {
viewplane->ymin-= 0.5f * (*ycor);
viewplane->ymax-= 0.5f * (*ycor);
/* extra zoom factor */
pixsize *= params->zoom;
/* compute view plane:
* fully centered, zbuffer fills in jittered between -.5 and +.5 */
viewplane.xmin= -0.5f*(float)winx;
viewplane.ymin= -0.5f*params->ycor*(float)winy;
viewplane.xmax= 0.5f*(float)winx;
viewplane.ymax= 0.5f*params->ycor*(float)winy;
/* lens shift and offset */
dx= params->shiftx*viewfac + winx*params->offsetx;
dy= params->shifty*viewfac + winy*params->offsety;
viewplane.xmin += dx;
viewplane.ymin += dy;
viewplane.xmax += dx;
viewplane.ymax += dy;
/* fields offset */
if(params->field_second) {
if(params->field_odd) {
viewplane.ymin-= 0.5f * params->ycor;
viewplane.ymax-= 0.5f * params->ycor;
}
else {
viewplane->ymin+= 0.5f * (*ycor);
viewplane->ymax+= 0.5f * (*ycor);
viewplane.ymin+= 0.5f * params->ycor;
viewplane.ymax+= 0.5f * params->ycor;
}
}
/* the window matrix is used for clipping, and not changed during OSA steps */
/* using an offset of +0.5 here would give clip errors on edges */
viewplane->xmin *= pixsize;
viewplane->xmax *= pixsize;
viewplane->ymin *= pixsize;
viewplane->ymax *= pixsize;
(*viewdx)= pixsize;
(*viewdy)= (*ycor) * pixsize;
if(is_ortho)
orthographic_m4(winmat, viewplane->xmin, viewplane->xmax, viewplane->ymin, viewplane->ymax, *clipsta, *clipend);
else
perspective_m4(winmat, viewplane->xmin, viewplane->xmax, viewplane->ymin, viewplane->ymax, *clipsta, *clipend);
viewplane.xmin *= pixsize;
viewplane.xmax *= pixsize;
viewplane.ymin *= pixsize;
viewplane.ymax *= pixsize;
params->viewdx= pixsize;
params->viewdy= params->ycor * pixsize;
params->viewplane= viewplane;
}
/* viewplane is assumed to be already computed */
void camera_params_compute_matrix(CameraParams *params)
{
rctf viewplane= params->viewplane;
/* compute projection matrix */
if(params->is_ortho)
orthographic_m4(params->winmat, viewplane.xmin, viewplane.xmax,
viewplane.ymin, viewplane.ymax, params->clipsta, params->clipend);
else
perspective_m4(params->winmat, viewplane.xmin, viewplane.xmax,
viewplane.ymin, viewplane.ymax, params->clipsta, params->clipend);
}
/***************************** Camera View Frame *****************************/
void camera_view_frame_ex(Scene *scene, Camera *camera, float drawsize, const short do_clip, const float scale[3],
float r_asp[2], float r_shift[2], float *r_drawsize, float r_vec[4][3])
{
@ -320,25 +376,16 @@ void camera_view_frame_ex(Scene *scene, Camera *camera, float drawsize, const sh
if (scene) {
float aspx= (float) scene->r.xsch*scene->r.xasp;
float aspy= (float) scene->r.ysch*scene->r.yasp;
int sensor_fit= camera_sensor_fit(camera->sensor_fit, aspx, aspy);
if(camera->sensor_fit==CAMERA_SENSOR_FIT_AUTO) {
if(aspx < aspy) {
r_asp[0]= aspx / aspy;
r_asp[1]= 1.0;
}
else {
r_asp[0]= 1.0;
r_asp[1]= aspy / aspx;
}
}
else if(camera->sensor_fit==CAMERA_SENSOR_FIT_AUTO) {
r_asp[0]= aspx / aspy;
r_asp[1]= 1.0;
}
else {
if(sensor_fit==CAMERA_SENSOR_FIT_HOR) {
r_asp[0]= 1.0;
r_asp[1]= aspy / aspx;
}
else {
r_asp[0]= aspx / aspy;
r_asp[1]= 1.0;
}
}
else {
r_asp[0]= 1.0f;
@ -409,7 +456,7 @@ static void camera_to_frame_view_cb(const float co[3], void *user_data)
unsigned int i;
for (i= 0; i < 4; i++) {
float nd= -dist_to_plane_v3(co, data->frame_tx[i], data->normal_tx[i]);
float nd= dist_to_plane_v3(co, data->frame_tx[i], data->normal_tx[i]);
if (nd < data->dist_vals[i]) {
data->dist_vals[i]= nd;
}
@ -419,6 +466,7 @@ static void camera_to_frame_view_cb(const float co[3], void *user_data)
}
/* dont move the camera, just yield the fit location */
/* only valid for perspective cameras */
int camera_view_frame_fit_to_scene(Scene *scene, struct View3D *v3d, Object *camera_ob, float r_co[3])
{
float shift[2];
@ -482,55 +530,49 @@ int camera_view_frame_fit_to_scene(Scene *scene, struct View3D *v3d, Object *cam
mul_v3_v3fl(plane_tx[i], data_cb.normal_tx[i], data_cb.dist_vals[i]);
}
if ( (isect_plane_plane_v3(plane_isect_1, plane_isect_1_no,
plane_tx[0], data_cb.normal_tx[0],
plane_tx[2], data_cb.normal_tx[2]) == 0) ||
(isect_plane_plane_v3(plane_isect_2, plane_isect_2_no,
plane_tx[1], data_cb.normal_tx[1],
plane_tx[3], data_cb.normal_tx[3]) == 0))
isect_plane_plane_v3(plane_isect_1, plane_isect_1_no,
plane_tx[0], data_cb.normal_tx[0],
plane_tx[2], data_cb.normal_tx[2]);
isect_plane_plane_v3(plane_isect_2, plane_isect_2_no,
plane_tx[1], data_cb.normal_tx[1],
plane_tx[3], data_cb.normal_tx[3]);
add_v3_v3v3(plane_isect_1_other, plane_isect_1, plane_isect_1_no);
add_v3_v3v3(plane_isect_2_other, plane_isect_2, plane_isect_2_no);
if (isect_line_line_v3(plane_isect_1, plane_isect_1_other,
plane_isect_2, plane_isect_2_other,
plane_isect_pt_1, plane_isect_pt_2) == 0)
{
/* this is very unlikely */
return FALSE;
}
else {
float cam_plane_no[3]= {0.0f, 0.0f, -1.0f};
float plane_isect_delta[3];
float plane_isect_delta_len;
add_v3_v3v3(plane_isect_1_other, plane_isect_1, plane_isect_1_no);
add_v3_v3v3(plane_isect_2_other, plane_isect_2, plane_isect_2_no);
mul_m3_v3(rot_obmat, cam_plane_no);
if (isect_line_line_v3(plane_isect_1, plane_isect_1_other,
plane_isect_2, plane_isect_2_other,
plane_isect_pt_1, plane_isect_pt_2) == 0)
{
return FALSE;
sub_v3_v3v3(plane_isect_delta, plane_isect_pt_2, plane_isect_pt_1);
plane_isect_delta_len= len_v3(plane_isect_delta);
if (dot_v3v3(plane_isect_delta, cam_plane_no) > 0.0f) {
copy_v3_v3(r_co, plane_isect_pt_1);
/* offset shift */
normalize_v3(plane_isect_1_no);
madd_v3_v3fl(r_co, plane_isect_1_no, shift[1] * -plane_isect_delta_len);
}
else {
float cam_plane_no[3]= {0.0f, 0.0f, -1.0f};
float plane_isect_delta[3];
float plane_isect_delta_len;
copy_v3_v3(r_co, plane_isect_pt_2);
mul_m3_v3(rot_obmat, cam_plane_no);
sub_v3_v3v3(plane_isect_delta, plane_isect_pt_2, plane_isect_pt_1);
plane_isect_delta_len= len_v3(plane_isect_delta);
if (dot_v3v3(plane_isect_delta, cam_plane_no) > 0.0f) {
copy_v3_v3(r_co, plane_isect_pt_1);
/* offset shift */
normalize_v3(plane_isect_1_no);
madd_v3_v3fl(r_co, plane_isect_1_no, shift[1] * -plane_isect_delta_len);
}
else {
copy_v3_v3(r_co, plane_isect_pt_2);
/* offset shift */
normalize_v3(plane_isect_2_no);
madd_v3_v3fl(r_co, plane_isect_2_no, shift[0] * -plane_isect_delta_len);
}
return TRUE;
/* offset shift */
normalize_v3(plane_isect_2_no);
madd_v3_v3fl(r_co, plane_isect_2_no, shift[0] * -plane_isect_delta_len);
}
return TRUE;
}
}
}

@ -3988,7 +3988,7 @@ static void followtrack_evaluate (bConstraint *con, bConstraintOb *cob, ListBase
MovieTrackingMarker *marker;
float vec[3], disp[3], axis[3], mat[4][4];
float aspect= (scene->r.xsch*scene->r.xasp) / (scene->r.ysch*scene->r.yasp);
float sensor_x, sensor_y, lens, len, d, ortho_scale= 1.0f;
float len, d;
where_is_object_mat(scene, camob, mat);
@ -4006,23 +4006,20 @@ static void followtrack_evaluate (bConstraint *con, bConstraintOb *cob, ListBase
len= len_v3(disp);
if (len > FLT_EPSILON) {
float pos[2], rmat[4][4], shiftx= 0.0f, shifty= 0.0f, clipsta= 0.0f, clipend= 0.0f;
short is_ortho= 0, sensor_fit= CAMERA_SENSOR_FIT_AUTO;
Camera *cam= NULL;
CameraParams params;
float pos[2], rmat[4][4];
user.framenr= scene->r.cfra;
marker= BKE_tracking_get_marker(track, user.framenr);
add_v2_v2v2(pos, marker->pos, track->offset);
object_camera_intrinsics(camob, &cam, &is_ortho, &shiftx, &shifty, &clipsta, &clipend, &lens, &sensor_x, &sensor_y, &sensor_fit);
if (is_ortho) {
if (cam)
ortho_scale= cam->ortho_scale;
vec[0]= ortho_scale * (pos[0]-0.5f+shiftx);
vec[1]= ortho_scale * (pos[1]-0.5f+shifty);
camera_params_init(&params);
camera_params_from_object(&params, camob);
if (params.is_ortho) {
vec[0]= params.ortho_scale * (pos[0]-0.5f+params.shiftx);
vec[1]= params.ortho_scale * (pos[1]-0.5f+params.shifty);
vec[2]= -len;
if (aspect > 1.0f) vec[1] /= aspect;
@ -4037,10 +4034,10 @@ static void followtrack_evaluate (bConstraint *con, bConstraintOb *cob, ListBase
copy_v3_v3(cob->matrix[3], disp);
}
else {
d= (len*sensor_x) / (2.0f*lens);
d= (len*params.sensor_x) / (2.0f*params.lens);
vec[0]= d*(2.0f*(pos[0]+shiftx)-1.0f);
vec[1]= d*(2.0f*(pos[1]+shifty)-1.0f);
vec[0]= d*(2.0f*(pos[0]+params.shiftx)-1.0f);
vec[1]= d*(2.0f*(pos[1]+params.shifty)-1.0f);
vec[2]= -len;
if (aspect > 1.0f) vec[1] /= aspect;

@ -976,8 +976,8 @@ struct DynamicPaintSurface *dynamicPaint_createNewSurface(DynamicPaintCanvasSett
surface->wave_timescale = 1.0f;
surface->wave_spring = 0.20f;
BLI_snprintf(surface->image_output_path, sizeof(surface->image_output_path), "%sdynamicpaint", U.textudir);
BLI_cleanup_dir(NULL, surface->image_output_path);
modifier_path_init(surface->image_output_path, sizeof(surface->image_output_path), "cache_dynamicpaint");
dynamicPaintSurface_setUniqueName(surface, "Surface");
surface->effector_weights = BKE_add_effector_weights(NULL);
@ -1475,11 +1475,12 @@ int dynamicPaint_resetSurface(DynamicPaintSurface *surface)
}
/* make sure allocated surface size matches current requirements */
static void dynamicPaint_checkSurfaceData(DynamicPaintSurface *surface)
static int dynamicPaint_checkSurfaceData(DynamicPaintSurface *surface)
{
if (!surface->data || ((dynamicPaint_surfaceNumOfPoints(surface) != surface->data->total_points))) {
dynamicPaint_resetSurface(surface);
return dynamicPaint_resetSurface(surface);
}
return 1;
}
@ -1614,6 +1615,10 @@ static struct DerivedMesh *dynamicPaint_Modifier_apply(DynamicPaintModifierData
/* paint layer */
col = CustomData_get_layer_named(&result->faceData, CD_MCOL, surface->output_name);
/* if output layer is lost from a constructive modifier, re-add it */
if (!col && dynamicPaint_outputLayerExists(surface, ob, 0))
col = CustomData_add_layer_named(&result->faceData, CD_MCOL, CD_CALLOC, NULL, numOfFaces, surface->output_name);
/* apply color */
if (col) {
#pragma omp parallel for schedule(static)
for (i=0; i<numOfFaces; i++) {
@ -1634,6 +1639,10 @@ static struct DerivedMesh *dynamicPaint_Modifier_apply(DynamicPaintModifierData
/* wet layer */
col = CustomData_get_layer_named(&result->faceData, CD_MCOL, surface->output_name2);
/* if output layer is lost from a constructive modifier, re-add it */
if (!col && dynamicPaint_outputLayerExists(surface, ob, 1))
col = CustomData_add_layer_named(&result->faceData, CD_MCOL, CD_CALLOC, NULL, numOfFaces, surface->output_name2);
/* apply color */
if (col) {
#pragma omp parallel for schedule(static)
for (i=0; i<numOfFaces; i++) {
@ -1792,7 +1801,7 @@ static void dynamicPaint_frameUpdate(DynamicPaintModifierData *pmd, Scene *scene
if (!(surface->flags & MOD_DPAINT_ACTIVE)) continue;
/* make sure surface is valid */
dynamicPaint_checkSurfaceData(surface);
if (!dynamicPaint_checkSurfaceData(surface)) continue;
/* limit frame range */
CLAMP(current_frame, surface->start_frame, surface->end_frame);
@ -2518,13 +2527,13 @@ void dynamicPaint_outputSurfaceImage(DynamicPaintSurface *surface, char* filenam
PaintSurfaceData *sData = surface->data;
ImgSeqFormatData *f_data = (ImgSeqFormatData*)sData->format_data;
/* OpenEXR or PNG */
int format = (surface->image_fileformat & MOD_DPAINT_IMGFORMAT_OPENEXR) ? R_OPENEXR : R_PNG;
int format = (surface->image_fileformat & MOD_DPAINT_IMGFORMAT_OPENEXR) ? R_IMF_IMTYPE_OPENEXR : R_IMF_IMTYPE_PNG;
char output_file[FILE_MAX];
if (!sData || !sData->type_data) {setError(surface->canvas, "Image save failed: Invalid surface.");return;}
/* if selected format is openexr, but current build doesnt support one */
#ifndef WITH_OPENEXR
if (format == R_OPENEXR) format = R_PNG;
if (format == R_IMF_IMTYPE_OPENEXR) format = R_IMF_IMTYPE_PNG;
#endif
BLI_strncpy(output_file, filename, sizeof(output_file));
BKE_add_image_extension(output_file, format);
@ -2613,7 +2622,7 @@ void dynamicPaint_outputSurfaceImage(DynamicPaintSurface *surface, char* filenam
/* Set output format, png in case exr isnt supported */
ibuf->ftype= PNG|95;
#ifdef WITH_OPENEXR
if (format == R_OPENEXR) { /* OpenEXR 32-bit float */
if (format == R_IMF_IMTYPE_OPENEXR) { /* OpenEXR 32-bit float */
ibuf->ftype = OPENEXR | OPENEXR_COMPRESS;
}
#endif
@ -3396,7 +3405,8 @@ static int dynamicPaint_paintMesh(DynamicPaintSurface *surface,
velocity_val = len_v3(velocity);
/* if brush has smudge enabled store brush velocity */
if (brush->flags & MOD_DPAINT_DO_SMUDGE && bData->brush_velocity) {
if (surface->type == MOD_DPAINT_SURFACE_T_PAINT &&
brush->flags & MOD_DPAINT_DO_SMUDGE && bData->brush_velocity) {
copy_v3_v3(&bData->brush_velocity[index*4], velocity);
mul_v3_fl(&bData->brush_velocity[index*4], 1.0f/velocity_val);
bData->brush_velocity[index*4+3] = velocity_val;
@ -3690,7 +3700,8 @@ static int dynamicPaint_paintParticles(DynamicPaintSurface *surface,
velocity_val = len_v3(velocity);
/* store brush velocity for smudge */
if (brush->flags & MOD_DPAINT_DO_SMUDGE && bData->brush_velocity) {
if (surface->type == MOD_DPAINT_SURFACE_T_PAINT &&
brush->flags & MOD_DPAINT_DO_SMUDGE && bData->brush_velocity) {
copy_v3_v3(&bData->brush_velocity[index*4], velocity);
mul_v3_fl(&bData->brush_velocity[index*4], 1.0f/velocity_val);
bData->brush_velocity[index*4+3] = velocity_val;
@ -3788,7 +3799,8 @@ static int dynamicPaint_paintSinglePoint(DynamicPaintSurface *surface, float *po
velocity_val = len_v3(velocity);
/* store brush velocity for smudge */
if (brush->flags & MOD_DPAINT_DO_SMUDGE && bData->brush_velocity) {
if (surface->type == MOD_DPAINT_SURFACE_T_PAINT &&
brush->flags & MOD_DPAINT_DO_SMUDGE && bData->brush_velocity) {
copy_v3_v3(&bData->brush_velocity[index*4], velocity);
mul_v3_fl(&bData->brush_velocity[index*4], 1.0f/velocity_val);
bData->brush_velocity[index*4+3] = velocity_val;
@ -4802,7 +4814,7 @@ static int dynamicPaint_doStep(Scene *scene, Object *ob, DynamicPaintSurface *su
BrushMaterials bMats = {0};
/* calculate brush speed vectors if required */
if (brush->flags & MOD_DPAINT_DO_SMUDGE) {
if (surface->type == MOD_DPAINT_SURFACE_T_PAINT && brush->flags & MOD_DPAINT_DO_SMUDGE) {
bData->brush_velocity = MEM_callocN(sData->total_points*sizeof(float)*4, "Dynamic Paint brush velocity");
/* init adjacency data if not already */
if (!sData->adj_data)
@ -4852,7 +4864,7 @@ static int dynamicPaint_doStep(Scene *scene, Object *ob, DynamicPaintSurface *su
/* process special brush effects, like smudge */
if (bData->brush_velocity) {
if (brush->flags & MOD_DPAINT_DO_SMUDGE)
if (surface->type == MOD_DPAINT_SURFACE_T_PAINT && brush->flags & MOD_DPAINT_DO_SMUDGE)
dynamicPaint_doSmudge(surface, brush, timescale);
MEM_freeN(bData->brush_velocity);
bData->brush_velocity = NULL;

@ -1576,7 +1576,7 @@ float driver_get_variable_value (ChannelDriver *driver, DriverVar *dvar)
* - "evaltime" is the frame at which F-Curve is being evaluated
* - has to return a float value
*/
static float evaluate_driver (ChannelDriver *driver, float UNUSED(evaltime))
static float evaluate_driver (ChannelDriver *driver, const float evaltime)
{
DriverVar *dvar;
@ -1663,8 +1663,10 @@ static float evaluate_driver (ChannelDriver *driver, float UNUSED(evaltime))
/* this evaluates the expression using Python,and returns its result:
* - on errors it reports, then returns 0.0f
*/
driver->curval= BPY_driver_exec(driver);
driver->curval= BPY_driver_exec(driver, evaltime);
}
#else /* WITH_PYTHON*/
(void)evaltime;
#endif /* WITH_PYTHON*/
}
break;
@ -1705,8 +1707,8 @@ void correct_bezpart (float *v1, float *v2, float *v3, float *v4)
* - len2 = length of handle of end key
*/
len= v4[0]- v1[0];
len1= (float)fabs(h1[0]);
len2= (float)fabs(h2[0]);
len1= fabsf(h1[0]);
len2= fabsf(h2[0]);
/* if the handles have no length, no need to do any corrections */
if ((len1+len2) == 0.0f)
@ -2087,7 +2089,7 @@ static float fcurve_eval_samples (FCurve *fcu, FPoint *fpts, float evaltime)
/* Evaluate and return the value of the given F-Curve at the specified frame ("evaltime")
* Note: this is also used for drivers
*/
float evaluate_fcurve (FCurve *fcu, float evaltime)
float evaluate_fcurve (FCurve *fcu, float evaltime)
{
float cvalue= 0.0f;
float devaltime;

@ -556,13 +556,13 @@ Image *BKE_add_image_size(unsigned int width, unsigned int height, const char *n
if (ima) {
ImBuf *ibuf;
BLI_strncpy(ima->name, name, FILE_MAX);
/* BLI_strncpy(ima->name, name, FILE_MAX); */ /* dont do this, this writes in ain invalid filepath! */
ima->gen_x= width;
ima->gen_y= height;
ima->gen_type= uvtestgrid;
ima->gen_flag |= (floatbuf ? IMA_GEN_FLOAT : 0);
ibuf= add_ibuf_size(width, height, name, depth, floatbuf, uvtestgrid, color);
ibuf= add_ibuf_size(width, height, ima->name, depth, floatbuf, uvtestgrid, color);
image_assign_ibuf(ima, ibuf, IMA_NO_INDEX, 0);
ima->ok= IMA_OK_LOADED;
@ -601,7 +601,7 @@ void BKE_image_memorypack(Image *ima)
}
ibuf->ftype= PNG;
ibuf->depth= 32;
ibuf->planes= R_IMF_PLANES_RGBA;
IMB_saveiff(ibuf, ibuf->name, IB_rect | IB_mem);
if(ibuf->encodedbuffer==NULL) {
@ -800,175 +800,246 @@ void BKE_image_all_free_anim_ibufs(int cfra)
/* *********** READ AND WRITE ************** */
int BKE_imtype_to_ftype(int imtype)
int BKE_imtype_to_ftype(const char imtype)
{
if(imtype==R_TARGA)
if(imtype==R_IMF_IMTYPE_TARGA)
return TGA;
else if(imtype==R_RAWTGA)
else if(imtype==R_IMF_IMTYPE_RAWTGA)
return RAWTGA;
else if(imtype== R_IRIS)
else if(imtype== R_IMF_IMTYPE_IRIS)
return IMAGIC;
#ifdef WITH_HDR
else if (imtype==R_RADHDR)
else if (imtype==R_IMF_IMTYPE_RADHDR)
return RADHDR;
#endif
else if (imtype==R_PNG)
else if (imtype==R_IMF_IMTYPE_PNG)
return PNG;
#ifdef WITH_DDS
else if (imtype==R_DDS)
else if (imtype==R_IMF_IMTYPE_DDS)
return DDS;
#endif
else if (imtype==R_BMP)
else if (imtype==R_IMF_IMTYPE_BMP)
return BMP;
#ifdef WITH_TIFF
else if (imtype==R_TIFF)
else if (imtype==R_IMF_IMTYPE_TIFF)
return TIF;
#endif
else if (imtype==R_OPENEXR || imtype==R_MULTILAYER)
else if (imtype==R_IMF_IMTYPE_OPENEXR || imtype==R_IMF_IMTYPE_MULTILAYER)
return OPENEXR;
#ifdef WITH_CINEON
else if (imtype==R_CINEON)
else if (imtype==R_IMF_IMTYPE_CINEON)
return CINEON;
else if (imtype==R_DPX)
else if (imtype==R_IMF_IMTYPE_DPX)
return DPX;
#endif
#ifdef WITH_OPENJPEG
else if(imtype==R_JP2)
else if(imtype==R_IMF_IMTYPE_JP2)
return JP2;
#endif
else
return JPG|90;
}
int BKE_ftype_to_imtype(int ftype)
char BKE_ftype_to_imtype(const int ftype)
{
if(ftype==0)
return TGA;
return R_IMF_IMTYPE_TARGA;
else if(ftype == IMAGIC)
return R_IRIS;
return R_IMF_IMTYPE_IRIS;
#ifdef WITH_HDR
else if (ftype & RADHDR)
return R_RADHDR;
return R_IMF_IMTYPE_RADHDR;
#endif
else if (ftype & PNG)
return R_PNG;
return R_IMF_IMTYPE_PNG;
#ifdef WITH_DDS
else if (ftype & DDS)
return R_DDS;
return R_IMF_IMTYPE_DDS;
#endif
else if (ftype & BMP)
return R_BMP;
return R_IMF_IMTYPE_BMP;
#ifdef WITH_TIFF
else if (ftype & TIF)
return R_TIFF;
return R_IMF_IMTYPE_TIFF;
#endif
else if (ftype & OPENEXR)
return R_OPENEXR;
return R_IMF_IMTYPE_OPENEXR;
#ifdef WITH_CINEON
else if (ftype & CINEON)
return R_CINEON;
return R_IMF_IMTYPE_CINEON;
else if (ftype & DPX)
return R_DPX;
return R_IMF_IMTYPE_DPX;
#endif
else if (ftype & TGA)
return R_TARGA;
return R_IMF_IMTYPE_TARGA;
else if(ftype & RAWTGA)
return R_RAWTGA;
return R_IMF_IMTYPE_RAWTGA;
#ifdef WITH_OPENJPEG
else if(ftype & JP2)
return R_JP2;
return R_IMF_IMTYPE_JP2;
#endif
else
return R_JPEG90;
return R_IMF_IMTYPE_JPEG90;
}
int BKE_imtype_is_movie(int imtype)
int BKE_imtype_is_movie(const char imtype)
{
switch(imtype) {
case R_AVIRAW:
case R_AVIJPEG:
case R_AVICODEC:
case R_QUICKTIME:
case R_FFMPEG:
case R_H264:
case R_THEORA:
case R_XVID:
case R_FRAMESERVER:
case R_IMF_IMTYPE_AVIRAW:
case R_IMF_IMTYPE_AVIJPEG:
case R_IMF_IMTYPE_AVICODEC:
case R_IMF_IMTYPE_QUICKTIME:
case R_IMF_IMTYPE_FFMPEG:
case R_IMF_IMTYPE_H264:
case R_IMF_IMTYPE_THEORA:
case R_IMF_IMTYPE_XVID:
case R_IMF_IMTYPE_FRAMESERVER:
return 1;
}
return 0;
}
int BKE_add_image_extension(char *string, int imtype)
int BKE_imtype_supports_alpha(const char imtype)
{
switch(imtype) {
case R_IMF_IMTYPE_TARGA:
case R_IMF_IMTYPE_IRIS:
case R_IMF_IMTYPE_PNG:
/* case R_IMF_IMTYPE_BMP: */ /* read but not write */
case R_IMF_IMTYPE_RADHDR:
case R_IMF_IMTYPE_TIFF:
case R_IMF_IMTYPE_OPENEXR:
case R_IMF_IMTYPE_MULTILAYER:
case R_IMF_IMTYPE_DDS:
case R_IMF_IMTYPE_JP2:
return 1;
}
return 0;
}
int BKE_imtype_supports_zbuf(const char imtype)
{
switch(imtype) {
case R_IMF_IMTYPE_IRIZ:
case R_IMF_IMTYPE_OPENEXR: /* but not R_IMF_IMTYPE_MULTILAYER */
return 1;
}
return 0;
}
int BKE_imtype_supports_compress(const char imtype)
{
switch(imtype) {
case R_IMF_IMTYPE_PNG:
return 1;
}
return 0;
}
int BKE_imtype_supports_quality(const char imtype)
{
switch(imtype) {
case R_IMF_IMTYPE_JPEG90:
case R_IMF_IMTYPE_JP2:
case R_IMF_IMTYPE_AVIJPEG:
return 1;
}
return 0;
}
char BKE_imtype_valid_depths(const char imtype)
{
switch (imtype) {
case R_IMF_IMTYPE_RADHDR:
return R_IMF_CHAN_DEPTH_32;
case R_IMF_IMTYPE_TIFF:
return R_IMF_CHAN_DEPTH_8 | R_IMF_CHAN_DEPTH_16;
case R_IMF_IMTYPE_OPENEXR:
return R_IMF_CHAN_DEPTH_16 | R_IMF_CHAN_DEPTH_32;
case R_IMF_IMTYPE_MULTILAYER:
return R_IMF_CHAN_DEPTH_32;
/* eeh, cineone does some strange 10bits per channel */
case R_IMF_IMTYPE_DPX:
case R_IMF_IMTYPE_CINEON:
return R_IMF_CHAN_DEPTH_12;
case R_IMF_IMTYPE_JP2:
return R_IMF_CHAN_DEPTH_8 | R_IMF_CHAN_DEPTH_12 | R_IMF_CHAN_DEPTH_16;
/* most formats are 8bit only */
default:
return R_IMF_CHAN_DEPTH_8;
}
}
int BKE_add_image_extension(char *string, const char imtype)
{
const char *extension= NULL;
if(imtype== R_IRIS) {
if(imtype== R_IMF_IMTYPE_IRIS) {
if(!BLI_testextensie(string, ".rgb"))
extension= ".rgb";
}
else if(imtype==R_IRIZ) {
else if(imtype==R_IMF_IMTYPE_IRIZ) {
if(!BLI_testextensie(string, ".rgb"))
extension= ".rgb";
}
#ifdef WITH_HDR
else if(imtype==R_RADHDR) {
else if(imtype==R_IMF_IMTYPE_RADHDR) {
if(!BLI_testextensie(string, ".hdr"))
extension= ".hdr";
}
#endif
else if (ELEM5(imtype, R_PNG, R_FFMPEG, R_H264, R_THEORA, R_XVID)) {
else if (ELEM5(imtype, R_IMF_IMTYPE_PNG, R_IMF_IMTYPE_FFMPEG, R_IMF_IMTYPE_H264, R_IMF_IMTYPE_THEORA, R_IMF_IMTYPE_XVID)) {
if(!BLI_testextensie(string, ".png"))
extension= ".png";
}
#ifdef WITH_DDS
else if(imtype==R_DDS) {
else if(imtype==R_IMF_IMTYPE_DDS) {
if(!BLI_testextensie(string, ".dds"))
extension= ".dds";
}
#endif
else if(imtype==R_RAWTGA) {
else if(imtype==R_IMF_IMTYPE_RAWTGA) {
if(!BLI_testextensie(string, ".tga"))
extension= ".tga";
}
else if(imtype==R_BMP) {
else if(imtype==R_IMF_IMTYPE_BMP) {
if(!BLI_testextensie(string, ".bmp"))
extension= ".bmp";
}
#ifdef WITH_TIFF
else if(imtype==R_TIFF) {
else if(imtype==R_IMF_IMTYPE_TIFF) {
if(!BLI_testextensie(string, ".tif") &&
!BLI_testextensie(string, ".tiff")) extension= ".tif";
}
#endif
#ifdef WITH_OPENEXR
else if( ELEM(imtype, R_OPENEXR, R_MULTILAYER)) {
else if( ELEM(imtype, R_IMF_IMTYPE_OPENEXR, R_IMF_IMTYPE_MULTILAYER)) {
if(!BLI_testextensie(string, ".exr"))
extension= ".exr";
}
#endif
#ifdef WITH_CINEON
else if(imtype==R_CINEON){
else if(imtype==R_IMF_IMTYPE_CINEON){
if (!BLI_testextensie(string, ".cin"))
extension= ".cin";
}
else if(imtype==R_DPX){
else if(imtype==R_IMF_IMTYPE_DPX){
if (!BLI_testextensie(string, ".dpx"))
extension= ".dpx";
}
#endif
else if(imtype==R_TARGA) {
else if(imtype==R_IMF_IMTYPE_TARGA) {
if(!BLI_testextensie(string, ".tga"))
extension= ".tga";
}
#ifdef WITH_OPENJPEG
else if(imtype==R_JP2) {
else if(imtype==R_IMF_IMTYPE_JP2) {
if(!BLI_testextensie(string, ".jp2"))
extension= ".jp2";
}
#endif
else { // R_AVICODEC, R_AVIRAW, R_AVIJPEG, R_JPEG90, R_QUICKTIME etc
else { // R_IMF_IMTYPE_AVICODEC, R_IMF_IMTYPE_AVIRAW, R_IMF_IMTYPE_AVIJPEG, R_IMF_IMTYPE_JPEG90, R_IMF_IMTYPE_QUICKTIME etc
if(!( BLI_testextensie(string, ".jpg") || BLI_testextensie(string, ".jpeg")))
extension= ".jpg";
}
@ -1371,98 +1442,101 @@ int BKE_alphatest_ibuf(ImBuf *ibuf)
return FALSE;
}
int BKE_write_ibuf(ImBuf *ibuf, const char *name, int imtype, int subimtype, int quality)
int BKE_write_ibuf(ImBuf *ibuf, const char *name, ImageFormatData *imf)
{
char imtype= imf->imtype;
char compress= imf->compress;
char quality= imf->quality;
int ok;
(void)subimtype; /* quies unused warnings */
if(imtype == -1) {
/* use whatever existing image type is set by 'ibuf' */
}
else if(imtype== R_IRIS) {
else if(imtype== R_IMF_IMTYPE_IRIS) {
ibuf->ftype= IMAGIC;
}
#ifdef WITH_HDR
else if (imtype==R_RADHDR) {
else if (imtype==R_IMF_IMTYPE_RADHDR) {
ibuf->ftype= RADHDR;
}
#endif
else if (ELEM5(imtype, R_PNG, R_FFMPEG, R_H264, R_THEORA, R_XVID)) {
else if (ELEM5(imtype, R_IMF_IMTYPE_PNG, R_IMF_IMTYPE_FFMPEG, R_IMF_IMTYPE_H264, R_IMF_IMTYPE_THEORA, R_IMF_IMTYPE_XVID)) {
ibuf->ftype= PNG;
if(imtype==R_PNG)
ibuf->ftype |= quality; /* quality is actually compression 0-100 --> 0-9 */
if(imtype==R_IMF_IMTYPE_PNG)
ibuf->ftype |= compress;
}
#ifdef WITH_DDS
else if (imtype==R_DDS) {
else if (imtype==R_IMF_IMTYPE_DDS) {
ibuf->ftype= DDS;
}
#endif
else if (imtype==R_BMP) {
else if (imtype==R_IMF_IMTYPE_BMP) {
ibuf->ftype= BMP;
}
#ifdef WITH_TIFF
else if (imtype==R_TIFF) {
else if (imtype==R_IMF_IMTYPE_TIFF) {
ibuf->ftype= TIF;
if(subimtype & R_TIFF_16BIT)
if(imf->depth == R_IMF_CHAN_DEPTH_16)
ibuf->ftype |= TIF_16BIT;
}
#endif
#ifdef WITH_OPENEXR
else if (imtype==R_OPENEXR || imtype==R_MULTILAYER) {
else if (imtype==R_IMF_IMTYPE_OPENEXR || imtype==R_IMF_IMTYPE_MULTILAYER) {
ibuf->ftype= OPENEXR;
if(subimtype & R_OPENEXR_HALF)
if(imf->depth == R_IMF_CHAN_DEPTH_16)
ibuf->ftype |= OPENEXR_HALF;
ibuf->ftype |= (quality & OPENEXR_COMPRESS);
if(!(subimtype & R_OPENEXR_ZBUF))
if(!(imf->flag & R_IMF_FLAG_ZBUF))
ibuf->zbuf_float = NULL; /* signal for exr saving */
}
#endif
#ifdef WITH_CINEON
else if (imtype==R_CINEON) {
else if (imtype==R_IMF_IMTYPE_CINEON) {
ibuf->ftype = CINEON;
}
else if (imtype==R_DPX) {
else if (imtype==R_IMF_IMTYPE_DPX) {
ibuf->ftype = DPX;
}
#endif
else if (imtype==R_TARGA) {
else if (imtype==R_IMF_IMTYPE_TARGA) {
ibuf->ftype= TGA;
}
else if(imtype==R_RAWTGA) {
else if(imtype==R_IMF_IMTYPE_RAWTGA) {
ibuf->ftype= RAWTGA;
}
#ifdef WITH_OPENJPEG
else if(imtype==R_JP2) {
else if(imtype==R_IMF_IMTYPE_JP2) {
if(quality < 10) quality= 90;
ibuf->ftype= JP2|quality;
if (subimtype & R_JPEG2K_16BIT) {
if (imf->depth == R_IMF_CHAN_DEPTH_16) {
ibuf->ftype |= JP2_16BIT;
} else if (subimtype & R_JPEG2K_12BIT) {
} else if (imf->depth == R_IMF_CHAN_DEPTH_12) {
ibuf->ftype |= JP2_12BIT;
}
if (subimtype & R_JPEG2K_YCC) {
if (imf->jp2_flag & R_IMF_JP2_FLAG_YCC) {
ibuf->ftype |= JP2_YCC;
}
if (subimtype & R_JPEG2K_CINE_PRESET) {
if (imf->jp2_flag & R_IMF_JP2_FLAG_CINE_PRESET) {
ibuf->ftype |= JP2_CINE;
if (subimtype & R_JPEG2K_CINE_48FPS)
if (imf->jp2_flag & R_IMF_JP2_FLAG_CINE_48)
ibuf->ftype |= JP2_CINE_48FPS;
}
}
#endif
else {
/* R_JPEG90, etc. default we save jpegs */
/* R_IMF_IMTYPE_JPEG90, etc. default we save jpegs */
if(quality < 10) quality= 90;
ibuf->ftype= JPG|quality;
if(ibuf->depth==32) ibuf->depth= 24; /* unsupported feature only confuses other s/w */
if(ibuf->planes==32) ibuf->planes= 24; /* unsupported feature only confuses other s/w */
}
BLI_make_existing_file(name);
@ -1475,20 +1549,20 @@ int BKE_write_ibuf(ImBuf *ibuf, const char *name, int imtype, int subimtype, int
return(ok);
}
int BKE_write_ibuf_stamp(Scene *scene, struct Object *camera, ImBuf *ibuf, const char *name, int imtype, int subimtype, int quality)
int BKE_write_ibuf_stamp(Scene *scene, struct Object *camera, ImBuf *ibuf, const char *name, struct ImageFormatData *imf)
{
if(scene && scene->r.stamp & R_STAMP_ALL)
BKE_stamp_info(scene, camera, ibuf);
return BKE_write_ibuf(ibuf, name, imtype, subimtype, quality);
return BKE_write_ibuf(ibuf, name, imf);
}
void BKE_makepicstring(char *string, const char *base, int frame, int imtype, const short use_ext, const short use_frames)
void BKE_makepicstring(char *string, const char *base, const char *relbase, int frame, const char imtype, const short use_ext, const short use_frames)
{
if (string==NULL) return;
BLI_strncpy(string, base, FILE_MAX - 10); /* weak assumption */
BLI_path_abs(string, G.main->name);
BLI_path_abs(string, relbase);
if(use_frames)
BLI_path_frame(string, frame, 4);
@ -2414,13 +2488,13 @@ int BKE_image_has_alpha(struct Image *image)
{
ImBuf *ibuf;
void *lock;
int depth;
int planes;
ibuf= BKE_image_acquire_ibuf(image, NULL, &lock);
depth = (ibuf?ibuf->depth:0);
planes = (ibuf?ibuf->planes:0);
BKE_image_release_ibuf(image, lock);
if (depth == 32)
if (planes == 32)
return 1;
else
return 0;

@ -1781,11 +1781,11 @@ float init_meta(Scene *scene, Object *ob) /* return totsize */
calc_mballco(mainb[a], vec);
size= (float)fabs( vec[0] );
size= fabsf( vec[0] );
if( size > totsize ) totsize= size;
size= (float)fabs( vec[1] );
size= fabsf( vec[1] );
if( size > totsize ) totsize= size;
size= (float)fabs( vec[2] );
size= fabsf( vec[2] );
if( size > totsize ) totsize= size;
vec[0]= mainb[a]->x - mainb[a]->rad;
@ -1794,11 +1794,11 @@ float init_meta(Scene *scene, Object *ob) /* return totsize */
calc_mballco(mainb[a], vec);
size= (float)fabs( vec[0] );
size= fabsf( vec[0] );
if( size > totsize ) totsize= size;
size= (float)fabs( vec[1] );
size= fabsf( vec[1] );
if( size > totsize ) totsize= size;
size= (float)fabs( vec[2] );
size= fabsf( vec[2] );
if( size > totsize ) totsize= size;
}

@ -60,6 +60,11 @@
#include "BKE_key.h"
#include "BKE_multires.h"
/* may move these, only for modifier_path_relbase */
#include "BKE_global.h" /* ugh, G.main->name only */
#include "BKE_main.h"
/* end */
#include "MOD_modifiertypes.h"
ModifierTypeInfo *modifierType_getInfo(ModifierType type)
@ -573,3 +578,36 @@ void test_object_modifiers(Object *ob)
}
}
}
/* where should this go?, it doesnt fit well anywhere :S - campbell */
/* elubie: changed this to default to the same dir as the render output
* to prevent saving to C:\ on Windows */
/* campbell: logic behind this...
*
* - if the ID is from a library, return library path
* - else if the file has been saved return the blend file path.
* - else if the file isn't saved and the ID isnt from a library, return the temp dir.
*/
const char *modifier_path_relbase(Object *ob)
{
if (G.relbase_valid || ob->id.lib) {
return ID_BLEND_PATH(G.main, &ob->id);
}
else {
/* last resort, better then using "" which resolves to the current
* working directory */
return BLI_temporary_dir();
}
}
/* initializes the path with either */
void modifier_path_init(char *path, int path_maxlen, const char *name)
{
/* elubie: changed this to default to the same dir as the render output
* to prevent saving to C:\ on Windows */
BLI_join_dirfile(path, path_maxlen,
G.relbase_valid ? "//" : BLI_temporary_dir(),
name);
}

@ -913,8 +913,8 @@ static void movieclip_build_proxy_ibuf(MovieClip *clip, ImBuf *ibuf, int cfra, i
scaleibuf->ftype= JPG | quality;
/* unsupported feature only confuses other s/w */
if(scaleibuf->depth==32)
scaleibuf->depth= 24;
if(scaleibuf->planes==32)
scaleibuf->planes= 24;
BLI_lock_thread(LOCK_MOVIECLIP);

@ -400,7 +400,7 @@ static float nlastrip_get_frame_actionclip (NlaStrip *strip, float cframe, short
/* scaling */
if (IS_EQF(strip->scale, 0.0f)) strip->scale= 1.0f;
scale = (float)fabs(strip->scale); /* scale must be positive - we've got a special flag for reversing */
scale = fabsf(strip->scale); /* scale must be positive - we've got a special flag for reversing */
/* length of referenced action */
actlength = strip->actend - strip->actstart;
@ -1087,7 +1087,7 @@ void BKE_nlastrip_set_active (AnimData *adt, NlaStrip *strip)
short BKE_nlastrip_within_bounds (NlaStrip *strip, float min, float max)
{
const float stripLen= (strip) ? strip->end - strip->start : 0.0f;
const float boundsLen= (float)fabs(max - min);
const float boundsLen= fabsf(max - min);
/* sanity checks */
if ((strip == NULL) || IS_EQF(stripLen, 0.0f) || IS_EQF(boundsLen, 0.0f))

@ -1643,15 +1643,22 @@ struct bNodeTemplate nodeMakeTemplate(struct bNode *node)
}
}
void node_type_base(bNodeType *ntype, int type, const char *name, short nclass, short flag)
void node_type_base(bNodeTreeType *ttype, bNodeType *ntype, int type, const char *name, short nclass, short flag)
{
memset(ntype, 0, sizeof(bNodeType));
ntype->type = type;
BLI_strncpy(ntype->name, name, sizeof(ntype->name));
ntype->nclass = nclass;
ntype->flag = flag;
/* Default muting stuff. */
if(ttype) {
ntype->mutefunc = ttype->mutefunc;
ntype->mutelinksfunc = ttype->mutelinksfunc;
ntype->gpumutefunc = ttype->gpumutefunc;
}
/* default size values */
ntype->width = 140;
ntype->minwidth = 100;
@ -1746,6 +1753,16 @@ void node_type_exec_new(struct bNodeType *ntype,
ntype->newexecfunc = newexecfunc;
}
void node_type_mute(struct bNodeType *ntype,
void (*mutefunc)(void *data, int thread, struct bNode *, void *nodedata,
struct bNodeStack **, struct bNodeStack **),
ListBase (*mutelinksfunc)(struct bNodeTree *, struct bNode *, struct bNodeStack **, struct bNodeStack **,
struct GPUNodeStack *, struct GPUNodeStack *))
{
ntype->mutefunc = mutefunc;
ntype->mutelinksfunc = mutelinksfunc;
}
void node_type_gpu(struct bNodeType *ntype, int (*gpufunc)(struct GPUMaterial *mat, struct bNode *node, struct GPUNodeStack *in, struct GPUNodeStack *out))
{
ntype->gpufunc = gpufunc;
@ -1756,6 +1773,12 @@ void node_type_gpu_ext(struct bNodeType *ntype, int (*gpuextfunc)(struct GPUMate
ntype->gpuextfunc = gpuextfunc;
}
void node_type_gpu_mute(struct bNodeType *ntype, int (*gpumutefunc)(struct GPUMaterial *, struct bNode *, void *,
struct GPUNodeStack *, struct GPUNodeStack *))
{
ntype->gpumutefunc = gpumutefunc;
}
void node_type_compatibility(struct bNodeType *ntype, short compatibility)
{
ntype->compatibility = compatibility;
@ -1772,211 +1795,212 @@ static bNodeType *is_nodetype_registered(ListBase *typelist, int type)
return NULL;
}
void nodeRegisterType(ListBase *typelist, bNodeType *ntype)
void nodeRegisterType(bNodeTreeType *ttype, bNodeType *ntype)
{
ListBase *typelist = &(ttype->node_types);
bNodeType *found= is_nodetype_registered(typelist, ntype->type);
if(found==NULL)
BLI_addtail(typelist, ntype);
}
static void registerCompositNodes(ListBase *ntypelist)
static void registerCompositNodes(bNodeTreeType *ttype)
{
register_node_type_frame(ntypelist);
register_node_type_frame(ttype);
register_node_type_cmp_group(ntypelist);
// register_node_type_cmp_forloop(ntypelist);
// register_node_type_cmp_whileloop(ntypelist);
register_node_type_cmp_group(ttype);
// register_node_type_cmp_forloop(ttype);
// register_node_type_cmp_whileloop(ttype);
register_node_type_cmp_rlayers(ntypelist);
register_node_type_cmp_image(ntypelist);
register_node_type_cmp_texture(ntypelist);
register_node_type_cmp_value(ntypelist);
register_node_type_cmp_rgb(ntypelist);
register_node_type_cmp_curve_time(ntypelist);
register_node_type_cmp_movieclip(ntypelist);
register_node_type_cmp_rlayers(ttype);
register_node_type_cmp_image(ttype);
register_node_type_cmp_texture(ttype);
register_node_type_cmp_value(ttype);
register_node_type_cmp_rgb(ttype);
register_node_type_cmp_curve_time(ttype);
register_node_type_cmp_movieclip(ttype);
register_node_type_cmp_composite(ntypelist);
register_node_type_cmp_viewer(ntypelist);
register_node_type_cmp_splitviewer(ntypelist);
register_node_type_cmp_output_file(ntypelist);
register_node_type_cmp_view_levels(ntypelist);
register_node_type_cmp_composite(ttype);
register_node_type_cmp_viewer(ttype);
register_node_type_cmp_splitviewer(ttype);
register_node_type_cmp_output_file(ttype);
register_node_type_cmp_view_levels(ttype);
register_node_type_cmp_curve_rgb(ntypelist);
register_node_type_cmp_mix_rgb(ntypelist);
register_node_type_cmp_hue_sat(ntypelist);
register_node_type_cmp_brightcontrast(ntypelist);
register_node_type_cmp_gamma(ntypelist);
register_node_type_cmp_invert(ntypelist);
register_node_type_cmp_alphaover(ntypelist);
register_node_type_cmp_zcombine(ntypelist);
register_node_type_cmp_colorbalance(ntypelist);
register_node_type_cmp_huecorrect(ntypelist);
register_node_type_cmp_curve_rgb(ttype);
register_node_type_cmp_mix_rgb(ttype);
register_node_type_cmp_hue_sat(ttype);
register_node_type_cmp_brightcontrast(ttype);
register_node_type_cmp_gamma(ttype);
register_node_type_cmp_invert(ttype);
register_node_type_cmp_alphaover(ttype);
register_node_type_cmp_zcombine(ttype);
register_node_type_cmp_colorbalance(ttype);
register_node_type_cmp_huecorrect(ttype);
register_node_type_cmp_normal(ntypelist);
register_node_type_cmp_curve_vec(ntypelist);
register_node_type_cmp_map_value(ntypelist);
register_node_type_cmp_normalize(ntypelist);
register_node_type_cmp_normal(ttype);
register_node_type_cmp_curve_vec(ttype);
register_node_type_cmp_map_value(ttype);
register_node_type_cmp_normalize(ttype);
register_node_type_cmp_filter(ntypelist);
register_node_type_cmp_blur(ntypelist);
register_node_type_cmp_dblur(ntypelist);
register_node_type_cmp_bilateralblur(ntypelist);
register_node_type_cmp_vecblur(ntypelist);
register_node_type_cmp_dilateerode(ntypelist);
register_node_type_cmp_defocus(ntypelist);
register_node_type_cmp_filter(ttype);
register_node_type_cmp_blur(ttype);
register_node_type_cmp_dblur(ttype);
register_node_type_cmp_bilateralblur(ttype);
register_node_type_cmp_vecblur(ttype);
register_node_type_cmp_dilateerode(ttype);
register_node_type_cmp_defocus(ttype);
register_node_type_cmp_valtorgb(ntypelist);
register_node_type_cmp_rgbtobw(ntypelist);
register_node_type_cmp_setalpha(ntypelist);
register_node_type_cmp_idmask(ntypelist);
register_node_type_cmp_math(ntypelist);
register_node_type_cmp_seprgba(ntypelist);
register_node_type_cmp_combrgba(ntypelist);
register_node_type_cmp_sephsva(ntypelist);
register_node_type_cmp_combhsva(ntypelist);
register_node_type_cmp_sepyuva(ntypelist);
register_node_type_cmp_combyuva(ntypelist);
register_node_type_cmp_sepycca(ntypelist);
register_node_type_cmp_combycca(ntypelist);
register_node_type_cmp_premulkey(ntypelist);
register_node_type_cmp_valtorgb(ttype);
register_node_type_cmp_rgbtobw(ttype);
register_node_type_cmp_setalpha(ttype);
register_node_type_cmp_idmask(ttype);
register_node_type_cmp_math(ttype);
register_node_type_cmp_seprgba(ttype);
register_node_type_cmp_combrgba(ttype);
register_node_type_cmp_sephsva(ttype);
register_node_type_cmp_combhsva(ttype);
register_node_type_cmp_sepyuva(ttype);
register_node_type_cmp_combyuva(ttype);
register_node_type_cmp_sepycca(ttype);
register_node_type_cmp_combycca(ttype);
register_node_type_cmp_premulkey(ttype);
register_node_type_cmp_diff_matte(ntypelist);
register_node_type_cmp_distance_matte(ntypelist);
register_node_type_cmp_chroma_matte(ntypelist);
register_node_type_cmp_color_matte(ntypelist);
register_node_type_cmp_channel_matte(ntypelist);
register_node_type_cmp_color_spill(ntypelist);
register_node_type_cmp_luma_matte(ntypelist);
register_node_type_cmp_diff_matte(ttype);
register_node_type_cmp_distance_matte(ttype);
register_node_type_cmp_chroma_matte(ttype);
register_node_type_cmp_color_matte(ttype);
register_node_type_cmp_channel_matte(ttype);
register_node_type_cmp_color_spill(ttype);
register_node_type_cmp_luma_matte(ttype);
register_node_type_cmp_translate(ntypelist);
register_node_type_cmp_rotate(ntypelist);
register_node_type_cmp_scale(ntypelist);
register_node_type_cmp_flip(ntypelist);
register_node_type_cmp_crop(ntypelist);
register_node_type_cmp_displace(ntypelist);
register_node_type_cmp_mapuv(ntypelist);
register_node_type_cmp_glare(ntypelist);
register_node_type_cmp_tonemap(ntypelist);
register_node_type_cmp_lensdist(ntypelist);
register_node_type_cmp_transform(ntypelist);
register_node_type_cmp_stabilize2d(ntypelist);
register_node_type_cmp_moviedistortion(ntypelist);
register_node_type_cmp_translate(ttype);
register_node_type_cmp_rotate(ttype);
register_node_type_cmp_scale(ttype);
register_node_type_cmp_flip(ttype);
register_node_type_cmp_crop(ttype);
register_node_type_cmp_displace(ttype);
register_node_type_cmp_mapuv(ttype);
register_node_type_cmp_glare(ttype);
register_node_type_cmp_tonemap(ttype);
register_node_type_cmp_lensdist(ttype);
register_node_type_cmp_transform(ttype);
register_node_type_cmp_stabilize2d(ttype);
register_node_type_cmp_moviedistortion(ttype);
}
static void registerShaderNodes(ListBase *ntypelist)
static void registerShaderNodes(bNodeTreeType *ttype)
{
register_node_type_frame(ntypelist);
register_node_type_frame(ttype);
register_node_type_sh_group(ntypelist);
//register_node_type_sh_forloop(ntypelist);
//register_node_type_sh_whileloop(ntypelist);
register_node_type_sh_group(ttype);
//register_node_type_sh_forloop(ttype);
//register_node_type_sh_whileloop(ttype);
register_node_type_sh_output(ntypelist);
register_node_type_sh_material(ntypelist);
register_node_type_sh_camera(ntypelist);
register_node_type_sh_value(ntypelist);
register_node_type_sh_rgb(ntypelist);
register_node_type_sh_mix_rgb(ntypelist);
register_node_type_sh_valtorgb(ntypelist);
register_node_type_sh_rgbtobw(ntypelist);
register_node_type_sh_texture(ntypelist);
register_node_type_sh_normal(ntypelist);
register_node_type_sh_geom(ntypelist);
register_node_type_sh_mapping(ntypelist);
register_node_type_sh_curve_vec(ntypelist);
register_node_type_sh_curve_rgb(ntypelist);
register_node_type_sh_math(ntypelist);
register_node_type_sh_vect_math(ntypelist);
register_node_type_sh_squeeze(ntypelist);
//register_node_type_sh_dynamic(ntypelist);
register_node_type_sh_material_ext(ntypelist);
register_node_type_sh_invert(ntypelist);
register_node_type_sh_seprgb(ntypelist);
register_node_type_sh_combrgb(ntypelist);
register_node_type_sh_hue_sat(ntypelist);
register_node_type_sh_output(ttype);
register_node_type_sh_material(ttype);
register_node_type_sh_camera(ttype);
register_node_type_sh_value(ttype);
register_node_type_sh_rgb(ttype);
register_node_type_sh_mix_rgb(ttype);
register_node_type_sh_valtorgb(ttype);
register_node_type_sh_rgbtobw(ttype);
register_node_type_sh_texture(ttype);
register_node_type_sh_normal(ttype);
register_node_type_sh_geom(ttype);
register_node_type_sh_mapping(ttype);
register_node_type_sh_curve_vec(ttype);
register_node_type_sh_curve_rgb(ttype);
register_node_type_sh_math(ttype);
register_node_type_sh_vect_math(ttype);
register_node_type_sh_squeeze(ttype);
//register_node_type_sh_dynamic(ttype);
register_node_type_sh_material_ext(ttype);
register_node_type_sh_invert(ttype);
register_node_type_sh_seprgb(ttype);
register_node_type_sh_combrgb(ttype);
register_node_type_sh_hue_sat(ttype);
register_node_type_sh_attribute(ntypelist);
register_node_type_sh_geometry(ntypelist);
register_node_type_sh_light_path(ntypelist);
register_node_type_sh_fresnel(ntypelist);
register_node_type_sh_layer_weight(ntypelist);
register_node_type_sh_tex_coord(ntypelist);
register_node_type_sh_attribute(ttype);
register_node_type_sh_geometry(ttype);
register_node_type_sh_light_path(ttype);
register_node_type_sh_fresnel(ttype);
register_node_type_sh_layer_weight(ttype);
register_node_type_sh_tex_coord(ttype);
register_node_type_sh_background(ntypelist);
register_node_type_sh_bsdf_diffuse(ntypelist);
register_node_type_sh_bsdf_glossy(ntypelist);
register_node_type_sh_bsdf_glass(ntypelist);
register_node_type_sh_bsdf_translucent(ntypelist);
register_node_type_sh_bsdf_transparent(ntypelist);
register_node_type_sh_bsdf_velvet(ntypelist);
register_node_type_sh_emission(ntypelist);
register_node_type_sh_holdout(ntypelist);
//register_node_type_sh_volume_transparent(ntypelist);
//register_node_type_sh_volume_isotropic(ntypelist);
register_node_type_sh_mix_shader(ntypelist);
register_node_type_sh_add_shader(ntypelist);
register_node_type_sh_background(ttype);
register_node_type_sh_bsdf_diffuse(ttype);
register_node_type_sh_bsdf_glossy(ttype);
register_node_type_sh_bsdf_glass(ttype);
register_node_type_sh_bsdf_translucent(ttype);
register_node_type_sh_bsdf_transparent(ttype);
register_node_type_sh_bsdf_velvet(ttype);
register_node_type_sh_emission(ttype);
register_node_type_sh_holdout(ttype);
//register_node_type_sh_volume_transparent(ttype);
//register_node_type_sh_volume_isotropic(ttype);
register_node_type_sh_mix_shader(ttype);
register_node_type_sh_add_shader(ttype);
register_node_type_sh_output_lamp(ntypelist);
register_node_type_sh_output_material(ntypelist);
register_node_type_sh_output_world(ntypelist);
register_node_type_sh_output_lamp(ttype);
register_node_type_sh_output_material(ttype);
register_node_type_sh_output_world(ttype);
register_node_type_sh_tex_image(ntypelist);
register_node_type_sh_tex_environment(ntypelist);
register_node_type_sh_tex_sky(ntypelist);
register_node_type_sh_tex_noise(ntypelist);
register_node_type_sh_tex_wave(ntypelist);
register_node_type_sh_tex_voronoi(ntypelist);
register_node_type_sh_tex_musgrave(ntypelist);
register_node_type_sh_tex_gradient(ntypelist);
register_node_type_sh_tex_magic(ntypelist);
register_node_type_sh_tex_image(ttype);
register_node_type_sh_tex_environment(ttype);
register_node_type_sh_tex_sky(ttype);
register_node_type_sh_tex_noise(ttype);
register_node_type_sh_tex_wave(ttype);
register_node_type_sh_tex_voronoi(ttype);
register_node_type_sh_tex_musgrave(ttype);
register_node_type_sh_tex_gradient(ttype);
register_node_type_sh_tex_magic(ttype);
}
static void registerTextureNodes(ListBase *ntypelist)
static void registerTextureNodes(bNodeTreeType *ttype)
{
register_node_type_frame(ntypelist);
register_node_type_frame(ttype);
register_node_type_tex_group(ntypelist);
// register_node_type_tex_forloop(ntypelist);
// register_node_type_tex_whileloop(ntypelist);
register_node_type_tex_group(ttype);
// register_node_type_tex_forloop(ttype);
// register_node_type_tex_whileloop(ttype);
register_node_type_tex_math(ntypelist);
register_node_type_tex_mix_rgb(ntypelist);
register_node_type_tex_valtorgb(ntypelist);
register_node_type_tex_rgbtobw(ntypelist);
register_node_type_tex_valtonor(ntypelist);
register_node_type_tex_curve_rgb(ntypelist);
register_node_type_tex_curve_time(ntypelist);
register_node_type_tex_invert(ntypelist);
register_node_type_tex_hue_sat(ntypelist);
register_node_type_tex_coord(ntypelist);
register_node_type_tex_distance(ntypelist);
register_node_type_tex_compose(ntypelist);
register_node_type_tex_decompose(ntypelist);
register_node_type_tex_math(ttype);
register_node_type_tex_mix_rgb(ttype);
register_node_type_tex_valtorgb(ttype);
register_node_type_tex_rgbtobw(ttype);
register_node_type_tex_valtonor(ttype);
register_node_type_tex_curve_rgb(ttype);
register_node_type_tex_curve_time(ttype);
register_node_type_tex_invert(ttype);
register_node_type_tex_hue_sat(ttype);
register_node_type_tex_coord(ttype);
register_node_type_tex_distance(ttype);
register_node_type_tex_compose(ttype);
register_node_type_tex_decompose(ttype);
register_node_type_tex_output(ntypelist);
register_node_type_tex_viewer(ntypelist);
register_node_type_tex_output(ttype);
register_node_type_tex_viewer(ttype);
register_node_type_tex_checker(ntypelist);
register_node_type_tex_texture(ntypelist);
register_node_type_tex_bricks(ntypelist);
register_node_type_tex_image(ntypelist);
register_node_type_tex_checker(ttype);
register_node_type_tex_texture(ttype);
register_node_type_tex_bricks(ttype);
register_node_type_tex_image(ttype);
register_node_type_tex_rotate(ntypelist);
register_node_type_tex_translate(ntypelist);
register_node_type_tex_scale(ntypelist);
register_node_type_tex_at(ntypelist);
register_node_type_tex_rotate(ttype);
register_node_type_tex_translate(ttype);
register_node_type_tex_scale(ttype);
register_node_type_tex_at(ttype);
register_node_type_tex_proc_voronoi(ntypelist);
register_node_type_tex_proc_blend(ntypelist);
register_node_type_tex_proc_magic(ntypelist);
register_node_type_tex_proc_marble(ntypelist);
register_node_type_tex_proc_clouds(ntypelist);
register_node_type_tex_proc_wood(ntypelist);
register_node_type_tex_proc_musgrave(ntypelist);
register_node_type_tex_proc_noise(ntypelist);
register_node_type_tex_proc_stucci(ntypelist);
register_node_type_tex_proc_distnoise(ntypelist);
register_node_type_tex_proc_voronoi(ttype);
register_node_type_tex_proc_blend(ttype);
register_node_type_tex_proc_magic(ttype);
register_node_type_tex_proc_marble(ttype);
register_node_type_tex_proc_clouds(ttype);
register_node_type_tex_proc_wood(ttype);
register_node_type_tex_proc_musgrave(ttype);
register_node_type_tex_proc_noise(ttype);
register_node_type_tex_proc_stucci(ttype);
register_node_type_tex_proc_distnoise(ttype);
}
static void free_dynamic_typeinfo(bNodeType *ntype)
@ -2010,9 +2034,9 @@ static void free_typeinfos(ListBase *list)
void init_nodesystem(void)
{
registerCompositNodes(&ntreeGetType(NTREE_COMPOSIT)->node_types);
registerShaderNodes(&ntreeGetType(NTREE_SHADER)->node_types);
registerTextureNodes(&ntreeGetType(NTREE_TEXTURE)->node_types);
registerCompositNodes(ntreeGetType(NTREE_COMPOSIT));
registerShaderNodes(ntreeGetType(NTREE_SHADER));
registerTextureNodes(ntreeGetType(NTREE_TEXTURE));
}
void free_nodesystem(void)

@ -1887,13 +1887,6 @@ static void ob_parvert3(Object *ob, Object *par, float mat[][4])
}
}
// XXX what the hell is this?
static int no_parent_ipo=0;
void set_no_parent_ipo(int val)
{
no_parent_ipo= val;
}
static int where_is_object_parslow(Object *ob, float obmat[4][4], float slowmat[4][4])
{
float *fp1, *fp2;
@ -1901,7 +1894,7 @@ static int where_is_object_parslow(Object *ob, float obmat[4][4], float slowmat[
int a;
// include framerate
fac1= ( 1.0f / (1.0f + (float)fabs(ob->sf)) );
fac1= ( 1.0f / (1.0f + fabsf(ob->sf)) );
if(fac1 >= 1.0f) return 0;
fac2= 1.0f-fac1;
@ -1933,7 +1926,7 @@ void where_is_object_time(Scene *scene, Object *ob, float ctime)
/* hurms, code below conflicts with depgraph... (ton) */
/* and even worse, it gives bad effects for NLA stride too (try ctime != par->ctime, with MBlur) */
if(no_parent_ipo==0 && stime != par->ctime) {
if(stime != par->ctime) {
// only for ipo systems?
Object tmp= *par;

@ -998,7 +998,7 @@ void BKE_free_ocean(struct Ocean *oc)
#define CACHE_TYPE_FOAM 2
#define CACHE_TYPE_NORMAL 3
static void cache_filename(char *string, const char *path, int frame, int type)
static void cache_filename(char *string, const char *path, const char *relbase, int frame, int type)
{
char cachepath[FILE_MAX];
const char *fname;
@ -1018,7 +1018,7 @@ static void cache_filename(char *string, const char *path, int frame, int type)
BLI_join_dirfile(cachepath, sizeof(cachepath), path, fname);
BKE_makepicstring(string, cachepath, frame, R_OPENEXR, 1, TRUE);
BKE_makepicstring(string, cachepath, relbase, frame, R_IMF_IMTYPE_OPENEXR, 1, TRUE);
}
void BKE_free_ocean_cache(struct OceanCache *och)
@ -1119,12 +1119,15 @@ void BKE_ocean_cache_eval_ij(struct OceanCache *och, struct OceanResult *ocr, in
}
}
struct OceanCache *BKE_init_ocean_cache(char *bakepath, int start, int end, float wave_scale,
float chop_amount, float foam_coverage, float foam_fade, int resolution)
struct OceanCache *BKE_init_ocean_cache(const char *bakepath, const char *relbase,
int start, int end, float wave_scale,
float chop_amount, float foam_coverage, float foam_fade, int resolution)
{
OceanCache *och = MEM_callocN(sizeof(OceanCache), "ocean cache data");
och->bakepath = bakepath;
och->relbase = relbase;
och->start = start;
och->end = end;
och->duration = (end - start) + 1;
@ -1158,17 +1161,17 @@ void BKE_simulate_ocean_cache(struct OceanCache *och, int frame)
if (och->ibufs_disp[f] != NULL ) return;
cache_filename(string, och->bakepath, frame, CACHE_TYPE_DISPLACE);
cache_filename(string, och->bakepath, och->relbase, frame, CACHE_TYPE_DISPLACE);
och->ibufs_disp[f] = IMB_loadiffname(string, 0);
//if (och->ibufs_disp[f] == NULL) printf("error loading %s \n", string);
//else printf("loaded cache %s \n", string);
cache_filename(string, och->bakepath, frame, CACHE_TYPE_FOAM);
cache_filename(string, och->bakepath, och->relbase, frame, CACHE_TYPE_FOAM);
och->ibufs_foam[f] = IMB_loadiffname(string, 0);
//if (och->ibufs_foam[f] == NULL) printf("error loading %s \n", string);
//else printf("loaded cache %s \n", string);
cache_filename(string, och->bakepath, frame, CACHE_TYPE_NORMAL);
cache_filename(string, och->bakepath, och->relbase, frame, CACHE_TYPE_NORMAL);
och->ibufs_norm[f] = IMB_loadiffname(string, 0);
//if (och->ibufs_norm[f] == NULL) printf("error loading %s \n", string);
//else printf("loaded cache %s \n", string);
@ -1182,6 +1185,8 @@ void BKE_bake_ocean(struct Ocean *o, struct OceanCache *och, void (*update_cb)(v
* before use - campbell */
OceanResult ocr;
ImageFormatData imf= {0};
int f, i=0, x, y, cancel=0;
float progress;
@ -1198,6 +1203,13 @@ void BKE_bake_ocean(struct Ocean *o, struct OceanCache *och, void (*update_cb)(v
BLI_srand(0);
/* setup image format */
imf.imtype= R_IMF_IMTYPE_OPENEXR;
imf.depth= R_IMF_CHAN_DEPTH_16;
imf.exr_codec= R_IMF_EXR_CODEC_ZIP; /* ZIP */
for (f=och->start, i=0; f<=och->end; f++, i++) {
/* create a new imbuf to store image for this frame */
@ -1288,19 +1300,19 @@ void BKE_bake_ocean(struct Ocean *o, struct OceanCache *och, void (*update_cb)(v
}
/* write the images */
cache_filename(string, och->bakepath, f, CACHE_TYPE_DISPLACE);
if(0 == BKE_write_ibuf(ibuf_disp, string, R_OPENEXR, R_OPENEXR_HALF, 2)) // 2 == ZIP exr codec
cache_filename(string, och->bakepath, och->relbase, f, CACHE_TYPE_DISPLACE);
if(0 == BKE_write_ibuf(ibuf_disp, string, &imf)) // 2 == ZIP exr codec
printf("Cannot save Displacement File Output to %s\n", string);
if (o->_do_jacobian) {
cache_filename(string, och->bakepath, f, CACHE_TYPE_FOAM);
if(0 == BKE_write_ibuf(ibuf_foam, string, R_OPENEXR, R_OPENEXR_HALF, 2)) // 2 == ZIP exr codec
cache_filename(string, och->bakepath, och->relbase, f, CACHE_TYPE_FOAM);
if(0 == BKE_write_ibuf(ibuf_foam, string, &imf)) // 2 == ZIP exr codec
printf("Cannot save Foam File Output to %s\n", string);
}
if (o->_do_normals) {
cache_filename(string, och->bakepath, f, CACHE_TYPE_NORMAL);
if(0 == BKE_write_ibuf(ibuf_normal, string, R_OPENEXR, R_OPENEXR_HALF, 2)) // 2 == ZIP exr codec
cache_filename(string, och->bakepath, och->relbase, f, CACHE_TYPE_NORMAL);
if(0 == BKE_write_ibuf(ibuf_normal, string, &imf)) // 2 == ZIP exr codec
printf("Cannot save Normal File Output to %s\n", string);
}
@ -1401,8 +1413,9 @@ void BKE_ocean_cache_eval_ij(struct OceanCache *UNUSED(och), struct OceanResult
{
}
struct OceanCache *BKE_init_ocean_cache(char *UNUSED(bakepath), int UNUSED(start), int UNUSED(end), float UNUSED(wave_scale),
float UNUSED(chop_amount), float UNUSED(foam_coverage), float UNUSED(foam_fade), int UNUSED(resolution))
struct OceanCache *BKE_init_ocean_cache(const char *UNUSED(bakepath), const char *UNUSED(relbase),
int UNUSED(start), int UNUSED(end), float UNUSED(wave_scale),
float UNUSED(chop_amount), float UNUSED(foam_coverage), float UNUSED(foam_fade), int UNUSED(resolution))
{
OceanCache *och = MEM_callocN(sizeof(OceanCache), "ocean cache data");

@ -3935,9 +3935,10 @@ static void particles_fluid_step(ParticleSimulationData *sim, int UNUSED(cfra))
// return;
// ok, start loading
BLI_snprintf(filename, sizeof(filename), "%sfluidsurface_particles_####.gz", fss->surfdataPath);
BLI_path_abs(filename, G.main->name);
BLI_join_dirfile(filename, sizeof(filename), fss->surfdataPath, OB_FLUIDSIM_SURF_PARTICLES_FNAME);
BLI_path_abs(filename, modifier_path_relbase(sim->ob));
BLI_path_frame(filename, curFrame, 0); // fixed #frame-no
gzf = gzopen(filename, "rb");

@ -44,6 +44,7 @@
#include "DNA_anim_types.h"
#include "DNA_group_types.h"
#include "DNA_node_types.h"
#include "DNA_object_types.h"
#include "DNA_scene_types.h"
#include "DNA_screen_types.h"
@ -346,9 +347,11 @@ Scene *add_scene(const char *name)
sce->r.mblur_samples= 1;
sce->r.filtertype= R_FILTER_MITCH;
sce->r.size= 50;
sce->r.planes= 24;
sce->r.imtype= R_PNG;
sce->r.quality= 90;
sce->r.im_format.planes= R_IMF_PLANES_RGB;
sce->r.im_format.imtype= R_IMF_IMTYPE_PNG;
sce->r.im_format.quality= 90;
sce->r.displaymode= R_OUTPUT_AREA;
sce->r.framapto= 100;
sce->r.images= 100;
@ -483,7 +486,7 @@ Scene *add_scene(const char *name)
sce->r.osa= 8;
/* note; in header_info.c the scene copy happens..., if you add more to renderdata it has to be checked there */
scene_add_render_layer(sce);
scene_add_render_layer(sce, NULL);
/* game data */
sce->gm.stereoflag = STEREO_NOSTEREO;
@ -1086,13 +1089,15 @@ void scene_update_for_newframe(Main *bmain, Scene *sce, unsigned int lay)
}
/* return default layer, also used to patch old files */
void scene_add_render_layer(Scene *sce)
SceneRenderLayer *scene_add_render_layer(Scene *sce, const char *name)
{
SceneRenderLayer *srl;
// int tot= 1 + BLI_countlist(&sce->r.layers);
if(!name)
name= "RenderLayer";
srl= MEM_callocN(sizeof(SceneRenderLayer), "new render layer");
strcpy(srl->name, "RenderLayer");
BLI_strncpy(srl->name, name, sizeof(srl->name));
BLI_uniquename(&sce->r.layers, srl, "RenderLayer", '.', offsetof(SceneRenderLayer, name), sizeof(srl->name));
BLI_addtail(&sce->r.layers, srl);
@ -1100,6 +1105,45 @@ void scene_add_render_layer(Scene *sce)
srl->lay= (1<<20) -1;
srl->layflag= 0x7FFF; /* solid ztra halo edge strand */
srl->passflag= SCE_PASS_COMBINED|SCE_PASS_Z;
return srl;
}
int scene_remove_render_layer(Main *bmain, Scene *scene, SceneRenderLayer *srl)
{
const int act= BLI_findindex(&scene->r.layers, srl);
Scene *sce;
if (act == -1) {
return 0;
}
else if ( (scene->r.layers.first == scene->r.layers.last) &&
(scene->r.layers.first == srl))
{
/* ensure 1 layer is kept */
return 0;
}
BLI_remlink(&scene->r.layers, srl);
MEM_freeN(srl);
scene->r.actlay= 0;
for(sce = bmain->scene.first; sce; sce = sce->id.next) {
if(sce->nodetree) {
bNode *node;
for(node = sce->nodetree->nodes.first; node; node = node->next) {
if(node->type==CMP_NODE_R_LAYERS && (Scene*)node->id==scene) {
if(node->custom1==act)
node->custom1= 0;
else if(node->custom1>act)
node->custom1--;
}
}
}
}
return 1;
}
/* render simplification */

@ -1327,8 +1327,8 @@ static void seq_proxy_build_frame(SeqRenderData context,
ibuf->ftype= JPG | quality;
/* unsupported feature only confuses other s/w */
if(ibuf->depth==32)
ibuf->depth= 24;
if(ibuf->planes==32)
ibuf->planes= 24;
BLI_make_existing_file(name);
@ -1729,7 +1729,7 @@ static ImBuf * input_preprocess(
}
if(seq->flag & SEQ_MAKE_PREMUL) {
if(ibuf->depth == 32 && ibuf->zbuf == NULL) {
if(ibuf->planes == 32 && ibuf->zbuf == NULL) {
IMB_premultiply_alpha(ibuf);
}
}

@ -1173,8 +1173,6 @@ static void ccgdm_pbvh_update(CCGDerivedMesh *ccgdm)
static void ccgDM_drawEdges(DerivedMesh *dm, int drawLooseEdges, int UNUSED(drawAllEdges)) {
CCGDerivedMesh *ccgdm = (CCGDerivedMesh*) dm;
CCGSubSurf *ss = ccgdm->ss;
CCGEdgeIterator *ei = ccgSubSurf_getEdgeIterator(ss);
CCGFaceIterator *fi = ccgSubSurf_getFaceIterator(ss);
int i, j, edgeSize = ccgSubSurf_getEdgeSize(ss);
int totedge = ccgSubSurf_getNumEdges(ss);
int gridSize = ccgSubSurf_getGridSize(ss);
@ -1212,8 +1210,10 @@ static void ccgDM_drawEdges(DerivedMesh *dm, int drawLooseEdges, int UNUSED(draw
}
if (ccgdm->drawInteriorEdges) {
for (; !ccgFaceIterator_isStopped(fi); ccgFaceIterator_next(fi)) {
CCGFace *f = ccgFaceIterator_getCurrent(fi);
int totface = ccgSubSurf_getNumFaces(ss);
for(j = 0; j < totface; j++) {
CCGFace *f = ccgdm->faceMap[j].face;
int S, x, y, numVerts = ccgSubSurf_getFaceNumVerts(f);
for (S=0; S<numVerts; S++) {
@ -1238,18 +1238,15 @@ static void ccgDM_drawEdges(DerivedMesh *dm, int drawLooseEdges, int UNUSED(draw
}
}
}
ccgFaceIterator_free(fi);
ccgEdgeIterator_free(ei);
}
static void ccgDM_drawLooseEdges(DerivedMesh *dm) {
CCGDerivedMesh *ccgdm = (CCGDerivedMesh*) dm;
CCGSubSurf *ss = ccgdm->ss;
CCGEdgeIterator *ei = ccgSubSurf_getEdgeIterator(ss);
int i, edgeSize = ccgSubSurf_getEdgeSize(ss);
int totedge = ccgSubSurf_getNumEdges(ss);
int i, j, edgeSize = ccgSubSurf_getEdgeSize(ss);
for (; !ccgEdgeIterator_isStopped(ei); ccgEdgeIterator_next(ei)) {
CCGEdge *e = ccgEdgeIterator_getCurrent(ei);
for (j=0; j< totedge; j++) {
CCGEdge *e = ccgdm->edgeMap[j].edge;
DMGridData *edgeData = ccgSubSurf_getEdgeDataArray(ss, e);
if (!ccgSubSurf_getEdgeNumFaces(e)) {
@ -1261,8 +1258,6 @@ static void ccgDM_drawLooseEdges(DerivedMesh *dm) {
glEnd();
}
}
ccgEdgeIterator_free(ei);
}
static void ccgDM_glNormalFast(float *a, float *b, float *c, float *d)
@ -1283,10 +1278,11 @@ static void ccgDM_glNormalFast(float *a, float *b, float *c, float *d)
static void ccgDM_drawFacesSolid(DerivedMesh *dm, float (*partial_redraw_planes)[4], int fast, int (*setMaterial)(int, void *attribs)) {
CCGDerivedMesh *ccgdm = (CCGDerivedMesh*) dm;
CCGSubSurf *ss = ccgdm->ss;
CCGFaceIterator *fi;
int gridSize = ccgSubSurf_getGridSize(ss);
char *faceFlags = ccgdm->faceFlags;
int step = (fast)? gridSize-1: 1;
int i, totface = ccgSubSurf_getNumFaces(ss);
int drawcurrent = 0, matnr = -1, shademodel = -1;
ccgdm_pbvh_update(ccgdm);
@ -1304,30 +1300,37 @@ static void ccgDM_drawFacesSolid(DerivedMesh *dm, float (*partial_redraw_planes)
return;
}
fi = ccgSubSurf_getFaceIterator(ss);
for (; !ccgFaceIterator_isStopped(fi); ccgFaceIterator_next(fi)) {
CCGFace *f = ccgFaceIterator_getCurrent(fi);
for(i = 0; i < totface; i++) {
CCGFace *f = ccgdm->faceMap[i].face;
int S, x, y, numVerts = ccgSubSurf_getFaceNumVerts(f);
int index = GET_INT_FROM_POINTER(ccgSubSurf_getFaceFaceHandle(ss, f));
int drawSmooth, mat_nr;
int new_matnr, new_shademodel;
if(faceFlags) {
drawSmooth = (faceFlags[index*2] & ME_SMOOTH);
mat_nr= faceFlags[index*2 + 1];
new_shademodel = (faceFlags[index*2] & ME_SMOOTH)? GL_SMOOTH: GL_FLAT;
new_matnr= faceFlags[index*2 + 1];
}
else {
drawSmooth = 1;
mat_nr= 0;
new_shademodel = GL_SMOOTH;
new_matnr= 0;
}
if (!setMaterial(mat_nr+1, NULL))
if(shademodel != new_shademodel || matnr != new_matnr) {
matnr= new_matnr;
shademodel= new_shademodel;
drawcurrent= setMaterial(matnr+1, NULL);
glShadeModel(shademodel);
}
if(!drawcurrent)
continue;
glShadeModel(drawSmooth? GL_SMOOTH: GL_FLAT);
for (S=0; S<numVerts; S++) {
DMGridData *faceGridData = ccgSubSurf_getFaceGridDataArray(ss, f, S);
if (drawSmooth) {
if (shademodel == GL_SMOOTH) {
for (y=0; y<gridSize-1; y+=step) {
glBegin(GL_QUAD_STRIP);
for (x=0; x<gridSize; x+=step) {
@ -1362,15 +1365,12 @@ static void ccgDM_drawFacesSolid(DerivedMesh *dm, float (*partial_redraw_planes)
}
}
}
ccgFaceIterator_free(fi);
}
/* Only used by non-editmesh types */
static void ccgDM_drawMappedFacesGLSL(DerivedMesh *dm, int (*setMaterial)(int, void *attribs), int (*setDrawOptions)(void *userData, int index), void *userData) {
CCGDerivedMesh *ccgdm = (CCGDerivedMesh*) dm;
CCGSubSurf *ss = ccgdm->ss;
CCGFaceIterator *fi = ccgSubSurf_getFaceIterator(ss);
GPUVertexAttribs gattribs;
DMVertexAttribs attribs= {{{NULL}}};
/* MTFace *tf = dm->getFaceDataArray(dm, CD_MTFACE); */ /* UNUSED */
@ -1503,8 +1503,6 @@ static void ccgDM_drawMappedFacesGLSL(DerivedMesh *dm, int (*setMaterial)(int, v
}
#undef PASSATTRIB
ccgFaceIterator_free(fi);
}
static void ccgDM_drawFacesGLSL(DerivedMesh *dm, int (*setMaterial)(int, void *attribs)) {
@ -1515,7 +1513,6 @@ static void ccgDM_drawFacesGLSL(DerivedMesh *dm, int (*setMaterial)(int, void *a
static void ccgDM_drawMappedFacesMat(DerivedMesh *dm, void (*setMaterial)(void *userData, int, void *attribs), int (*setFace)(void *userData, int index), void *userData) {
CCGDerivedMesh *ccgdm = (CCGDerivedMesh*) dm;
CCGSubSurf *ss = ccgdm->ss;
CCGFaceIterator *fi = ccgSubSurf_getFaceIterator(ss);
GPUVertexAttribs gattribs;
DMVertexAttribs attribs= {{{NULL}}};
int gridSize = ccgSubSurf_getGridSize(ss);
@ -1655,18 +1652,15 @@ static void ccgDM_drawMappedFacesMat(DerivedMesh *dm, void (*setMaterial)(void *
}
#undef PASSATTRIB
ccgFaceIterator_free(fi);
}
static void ccgDM_drawFacesColored(DerivedMesh *dm, int UNUSED(useTwoSided), unsigned char *col1, unsigned char *col2) {
CCGDerivedMesh *ccgdm = (CCGDerivedMesh*) dm;
CCGSubSurf *ss = ccgdm->ss;
CCGFaceIterator *fi = ccgSubSurf_getFaceIterator(ss);
int gridSize = ccgSubSurf_getGridSize(ss);
unsigned char *cp1, *cp2;
int useTwoSide=1;
int useTwoSide=1, i, totface;
ccgdm_pbvh_update(ccgdm);
@ -1685,8 +1679,9 @@ static void ccgDM_drawFacesColored(DerivedMesh *dm, int UNUSED(useTwoSided), uns
}
glBegin(GL_QUADS);
for (; !ccgFaceIterator_isStopped(fi); ccgFaceIterator_next(fi)) {
CCGFace *f = ccgFaceIterator_getCurrent(fi);
totface = ccgSubSurf_getNumFaces(ss);
for(i = 0; i < totface; i++) {
CCGFace *f = ccgdm->faceMap[i].face;
int S, x, y, numVerts = ccgSubSurf_getFaceNumVerts(f);
for (S=0; S<numVerts; S++) {
@ -1725,8 +1720,6 @@ static void ccgDM_drawFacesColored(DerivedMesh *dm, int UNUSED(useTwoSided), uns
}
}
glEnd();
ccgFaceIterator_free(fi);
}
static void ccgDM_drawFacesTex_common(DerivedMesh *dm,

@ -231,9 +231,12 @@ MovieTrackingTrack *BKE_tracking_add_track(MovieTracking *tracking, float x, flo
void BKE_tracking_insert_marker(MovieTrackingTrack *track, MovieTrackingMarker *marker)
{
MovieTrackingMarker *old_marker= BKE_tracking_get_marker(track, marker->framenr);
MovieTrackingMarker *old_marker= NULL;
if(old_marker && old_marker->framenr==marker->framenr) {
if(track->markersnr)
old_marker= BKE_tracking_exact_marker(track, marker->framenr);
if(old_marker) {
*old_marker= *marker;
} else {
int a= track->markersnr;
@ -324,7 +327,7 @@ MovieTrackingMarker *BKE_tracking_ensure_marker(MovieTrackingTrack *track, int f
{
MovieTrackingMarker *marker= BKE_tracking_get_marker(track, framenr);
if(marker && marker->framenr!=framenr) {
if(marker->framenr!=framenr) {
MovieTrackingMarker marker_new;
marker_new= *marker;
@ -341,7 +344,7 @@ MovieTrackingMarker *BKE_tracking_exact_marker(MovieTrackingTrack *track, int fr
{
MovieTrackingMarker *marker= BKE_tracking_get_marker(track, framenr);
if(marker && marker->framenr!=framenr)
if(marker->framenr!=framenr)
return NULL;
return marker;
@ -440,7 +443,6 @@ void BKE_tracking_clear_path(MovieTrackingTrack *track, int ref_frame, int actio
int BKE_tracking_test_join_tracks(MovieTrackingTrack *dst_track, MovieTrackingTrack *src_track)
{
int a= 0, b= 0;
/* int tot= dst_track->markersnr+src_track->markersnr; */ /* UNUSED */
int count= 0;
while(a<src_track->markersnr || b<dst_track->markersnr) {
@ -858,13 +860,11 @@ static unsigned char *get_search_bytebuf(ImBuf *ibuf, MovieTrackingTrack *track,
static ImBuf *get_frame_ibuf(MovieTrackingContext *context, int framenr)
{
ImBuf *ibuf;
int framenr_old= context->user.framenr;
MovieClipUser user= context->user;
context->user.framenr= framenr;
user.framenr= framenr;
ibuf= BKE_movieclip_get_ibuf_flag(context->clip, &context->user, 0);
context->user.framenr= framenr_old;
ibuf= BKE_movieclip_get_ibuf_flag(context->clip, &user, 0);
return ibuf;
}
@ -1050,9 +1050,9 @@ int BKE_tracking_next(MovieTrackingContext *context)
for(a= 0; a<context->num_tracks; a++) {
TrackContext *track_context= &context->track_context[a];
MovieTrackingTrack *track= track_context->track;
MovieTrackingMarker *marker= BKE_tracking_get_marker(track, curfra);
MovieTrackingMarker *marker= BKE_tracking_exact_marker(track, curfra);
if(marker && (marker->flag&MARKER_DISABLED)==0 && marker->framenr==curfra) {
if(marker && (marker->flag&MARKER_DISABLED)==0) {
#ifdef WITH_LIBMV
int width, height, origin[2], tracked= 0, need_readjust= 0;
float pos[2], margin[2];
@ -1285,8 +1285,10 @@ static int retrieve_libmv_reconstruct_tracks(MovieTracking *tracking, struct lib
MovieTrackingTrack *track;
MovieTrackingReconstruction *reconstruction= &tracking->reconstruction;
MovieReconstructedCamera *reconstructed;
float origin[3]= {0.0f, 0.0f, 0.0f};
int ok= 1;
float imat[4][4];
unit_m4(imat);
track= tracking->tracks.first;
while(track) {
@ -1354,12 +1356,13 @@ static int retrieve_libmv_reconstruct_tracks(MovieTracking *tracking, struct lib
mat[i][j]= matd[i][j];
if(!origin_set) {
copy_v3_v3(origin, mat[3]);
copy_m4_m4(imat, mat);
invert_m4(imat);
origin_set= 1;
}
if(origin_set)
sub_v3_v3(mat[3], origin);
mul_m4_m4m4(mat, mat, imat);
copy_m4_m4(reconstructed[reconstruction->camnr].mat, mat);
reconstructed[reconstruction->camnr].framenr= a;
@ -1380,7 +1383,7 @@ static int retrieve_libmv_reconstruct_tracks(MovieTracking *tracking, struct lib
track= tracking->tracks.first;
while(track) {
if(track->flag&TRACK_HAS_BUNDLE)
sub_v3_v3(track->bundle_pos, origin);
mul_v3_m4v3(track->bundle_pos, imat, track->bundle_pos);
track= track->next;
}
@ -1918,10 +1921,8 @@ static float stabilization_auto_scale_factor(MovieTracking *tracking, int width,
while(track) {
if(track->flag&TRACK_USE_2D_STAB ||
((stab->flag&TRACKING_STABILIZE_ROTATION) && track==stab->rot_track)) {
if(track->markersnr) {
sfra= MIN2(sfra, track->markers[0].framenr);
efra= MAX2(efra, track->markers[track->markersnr-1].framenr);
}
sfra= MIN2(sfra, track->markers[0].framenr);
efra= MAX2(efra, track->markers[track->markersnr-1].framenr);
}
track= track->next;
@ -2021,7 +2022,7 @@ static ImBuf* stabilize_alloc_ibuf(ImBuf *cacheibuf, ImBuf *srcibuf, int fill)
}
}
else {
cacheibuf= IMB_allocImBuf(srcibuf->x, srcibuf->y, srcibuf->depth, flags);
cacheibuf= IMB_allocImBuf(srcibuf->x, srcibuf->y, srcibuf->planes, flags);
cacheibuf->profile= srcibuf->profile;
}

@ -67,7 +67,7 @@ static void filepath_avi(char *string, RenderData *rd);
#include "BKE_writeframeserver.h"
bMovieHandle *BKE_get_movie_handle(int imtype)
bMovieHandle *BKE_get_movie_handle(const char imtype)
{
static bMovieHandle mh;
@ -80,14 +80,14 @@ bMovieHandle *BKE_get_movie_handle(int imtype)
/* do the platform specific handles */
#if defined(_WIN32) && !defined(FREE_WINDOWS)
if (imtype == R_AVICODEC) {
if (imtype == R_IMF_IMTYPE_AVICODEC) {
//XXX mh.start_movie= start_avi_codec;
//XXX mh.append_movie= append_avi_codec;
//XXX mh.end_movie= end_avi_codec;
}
#endif
#ifdef WITH_QUICKTIME
if (imtype == R_QUICKTIME) {
if (imtype == R_IMF_IMTYPE_QUICKTIME) {
mh.start_movie= start_qt;
mh.append_movie= append_qt;
mh.end_movie= end_qt;
@ -95,7 +95,7 @@ bMovieHandle *BKE_get_movie_handle(int imtype)
}
#endif
#ifdef WITH_FFMPEG
if (ELEM4(imtype, R_FFMPEG, R_H264, R_XVID, R_THEORA)) {
if (ELEM4(imtype, R_IMF_IMTYPE_FFMPEG, R_IMF_IMTYPE_H264, R_IMF_IMTYPE_XVID, R_IMF_IMTYPE_THEORA)) {
mh.start_movie = start_ffmpeg;
mh.append_movie = append_ffmpeg;
mh.end_movie = end_ffmpeg;
@ -103,7 +103,7 @@ bMovieHandle *BKE_get_movie_handle(int imtype)
}
#endif
#ifdef WITH_FRAMESERVER
if (imtype == R_FRAMESERVER) {
if (imtype == R_IMF_IMTYPE_FRAMESERVER) {
mh.start_movie = start_frameserver;
mh.append_movie = append_frameserver;
mh.end_movie = end_frameserver;
@ -154,7 +154,7 @@ static int start_avi(Scene *scene, RenderData *rd, int rectx, int recty, ReportL
x = rectx;
y = recty;
quality= rd->quality;
quality= rd->im_format.quality;
framerate= (double) rd->frs_sec / (double) rd->frs_sec_base;
avi = MEM_mallocN (sizeof(AviMovie), "avimovie");
@ -162,7 +162,7 @@ static int start_avi(Scene *scene, RenderData *rd, int rectx, int recty, ReportL
/* RPW 11-21-2002
if (rd->imtype != AVI_FORMAT_MJPEG) format = AVI_FORMAT_AVI_RGB;
*/
if (rd->imtype != R_AVIJPEG ) format = AVI_FORMAT_AVI_RGB;
if (rd->im_format.imtype != R_IMF_IMTYPE_AVIJPEG ) format = AVI_FORMAT_AVI_RGB;
else format = AVI_FORMAT_MJPEG;
if (AVI_open_compress (name, avi, 1, format) != AVI_ERROR_NONE) {
@ -233,7 +233,7 @@ static void end_avi(void)
/* similar to BKE_makepicstring() */
void BKE_makeanimstring(char *string, RenderData *rd)
{
bMovieHandle *mh= BKE_get_movie_handle(rd->imtype);
bMovieHandle *mh= BKE_get_movie_handle(rd->im_format.imtype);
if(mh->get_movie_path)
mh->get_movie_path(string, rd);
else

@ -1337,7 +1337,7 @@ void ffmpeg_verify_image_type(RenderData *rd)
{
int audio= 0;
if(rd->imtype == R_FFMPEG) {
if(rd->imtype == R_IMF_IMTYPE_FFMPEG) {
if(rd->ffcodecdata.type <= 0 ||
rd->ffcodecdata.codec <= 0 ||
rd->ffcodecdata.audio_codec <= 0 ||
@ -1353,19 +1353,19 @@ void ffmpeg_verify_image_type(RenderData *rd)
audio= 1;
}
else if(rd->imtype == R_H264) {
else if(rd->imtype == R_IMF_IMTYPE_H264) {
if(rd->ffcodecdata.codec != CODEC_ID_H264) {
ffmpeg_set_preset(rd, FFMPEG_PRESET_H264);
audio= 1;
}
}
else if(rd->imtype == R_XVID) {
else if(rd->imtype == R_IMF_IMTYPE_XVID) {
if(rd->ffcodecdata.codec != CODEC_ID_MPEG4) {
ffmpeg_set_preset(rd, FFMPEG_PRESET_XVID);
audio= 1;
}
}
else if(rd->imtype == R_THEORA) {
else if(rd->imtype == R_IMF_IMTYPE_THEORA) {
if(rd->ffcodecdata.codec != CODEC_ID_THEORA) {
ffmpeg_set_preset(rd, FFMPEG_PRESET_THEORA);
audio= 1;

@ -60,6 +60,7 @@ float dist_to_line_v2(const float p[2], const float l1[2], const float l2[2]);
float dist_to_line_segment_v2(const float p[2], const float l1[2], const float l2[2]);
void closest_to_line_segment_v2(float closest[2], const float p[2], const float l1[2], const float l2[2]);
float dist_to_plane_normalized_v3(const float p[3], const float plane_co[3], const float plane_no_unit[3]);
float dist_to_plane_v3(const float p[3], const float plane_co[3], const float plane_no[3]);
float dist_to_line_segment_v3(const float p[3], const float l1[3], const float l2[3]);
float closest_to_line_v3(float r[3], const float p[3], const float l1[3], const float l2[3]);
@ -96,12 +97,13 @@ int isect_line_line_v3(const float v1[3], const float v2[3],
float i1[3], float i2[3]);
int isect_line_line_strict_v3(const float v1[3], const float v2[3],
const float v3[3], const float v4[3],
float vi[3], float *lambda);
float vi[3], float *r_lambda);
/*if clip is nonzero, will only return true if lambda is >= 0.0
(i.e. intersection point is along positive d)*/
int isect_ray_plane_v3(float p1[3], float d[3], float v0[3],
float v1[3], float v2[3], float *lambda, int clip);
int isect_ray_plane_v3(const float p1[3], const float d[3],
const float v0[3], const float v1[3], const float v2[3],
float *r_lambda, const int clip);
/**
* Intersect line/plane, optionally treat line as directional (like a ray) with the no_flip argument.
@ -126,19 +128,19 @@ int isect_line_plane_v3(float out[3], const float l1[3], const float l2[3],
* @param plane_b_co The point on the second plane.
* @param plane_b_no The normal of the second plane.
*/
int isect_plane_plane_v3(float r_isect_co[3], float r_isect_no[3],
const float plane_a_co[3], const float plane_a_no[3],
const float plane_b_co[3], const float plane_b_no[3]);
void isect_plane_plane_v3(float r_isect_co[3], float r_isect_no[3],
const float plane_a_co[3], const float plane_a_no[3],
const float plane_b_co[3], const float plane_b_no[3]);
/* line/ray triangle */
int isect_line_tri_v3(const float p1[3], const float p2[3],
const float v0[3], const float v1[3], const float v2[3], float *lambda, float uv[2]);
const float v0[3], const float v1[3], const float v2[3], float *r_lambda, float r_uv[2]);
int isect_ray_tri_v3(const float p1[3], const float d[3],
const float v0[3], const float v1[3], const float v2[3], float *lambda, float uv[2]);
const float v0[3], const float v1[3], const float v2[3], float *r_lambda, float r_uv[2]);
int isect_ray_tri_threshold_v3(const float p1[3], const float d[3],
const float v0[3], const float v1[3], const float v2[3], float *lambda, float uv[2], const float threshold);
const float v0[3], const float v1[3], const float v2[3], float *r_lambda, float r_uv[2], const float threshold);
int isect_ray_tri_epsilon_v3(const float p1[3], const float d[3],
const float v0[3], const float v1[3], const float v2[3], float *lambda, float uv[2], const float epsilon);
const float v0[3], const float v1[3], const float v2[3], float *r_lambda, float r_uv[2], const float epsilon);
/* point in polygon */
int isect_point_quad_v2(const float p[2], const float a[2], const float b[2], const float c[2], const float d[2]);
@ -148,16 +150,16 @@ int isect_point_tri_v2_int(const int x1, const int y1, const int x2, const int y
int isect_point_tri_prism_v3(const float p[3], const float v1[3], const float v2[3], const float v3[3]);
void isect_point_quad_uv_v2(const float v0[2], const float v1[2], const float v2[2], const float v3[2],
const float pt[2], float *uv);
const float pt[2], float r_uv[2]);
void isect_point_face_uv_v2(const int isquad, const float v0[2], const float v1[2], const float v2[2],
const float v3[2], const float pt[2], float *uv);
const float v3[2], const float pt[2], float r_uv[2]);
/* other */
int isect_sweeping_sphere_tri_v3(const float p1[3], const float p2[3], const float radius,
const float v0[3], const float v1[3], const float v2[3], float *lambda, float ipoint[3]);
const float v0[3], const float v1[3], const float v2[3], float *r_lambda, float ipoint[3]);
int isect_axial_line_tri_v3(const int axis, const float co1[3], const float co2[3],
const float v0[3], const float v1[3], const float v2[3], float *lambda);
const float v0[3], const float v1[3], const float v2[3], float *r_lambda);
int isect_aabb_aabb_v3(const float min1[3], const float max1[3], const float min2[3], const float max2[3]);
@ -184,7 +186,7 @@ void barycentric_transform(float pt_tar[3], float const pt_src[3],
void barycentric_weights_v2(const float v1[2], const float v2[2], const float v3[2],
const float co[2], float w[3]);
void resolve_tri_uv(float uv[2], const float st[2], const float st0[2], const float st1[2], const float st2[2]);
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]);
/***************************** View & Projection *****************************/

@ -32,6 +32,7 @@ extern "C" {
#endif
char *BLI_strncpy_utf8(char *dst, const char *src, size_t maxncpy);
char *BLI_strncat_utf8(char *dst, const char *src, size_t maxncpy);
int BLI_utf8_invalid_byte(const char *str, int length);
int BLI_utf8_invalid_strip(char *str, int length);

@ -66,7 +66,7 @@ typedef struct BLI_mempool_chunk {
void *data;
} BLI_mempool_chunk;
typedef struct BLI_mempool {
struct BLI_mempool {
struct ListBase chunks;
int esize, csize, pchunk; /* size of elements and chunks in bytes
* and number of elements per chunk*/
@ -76,7 +76,7 @@ typedef struct BLI_mempool {
BLI_freenode *free; /* free element list. Interleaved into chunk datas.*/
int totalloc, totused; /* total number of elements allocated in total,
* and currently in use*/
} BLI_mempool;
};
#define MEMPOOL_ELEM_SIZE_MIN (sizeof(void *) * 2)

@ -209,7 +209,7 @@ DLRBT_Node *BLI_dlrbTree_search_exact (DLRBT_Tree *tree, DLRBT_Comparator_FP cmp
}
}
/* return the nearest matching node */
/* return the exactly matching node */
return (found == 1) ? (node) : (NULL);
}

@ -134,9 +134,9 @@ float area_poly_v3(int nr, float verts[][3], const float normal[3])
int a, px=0, py=1;
/* first: find dominant axis: 0==X, 1==Y, 2==Z */
x= (float)fabs(normal[0]);
y= (float)fabs(normal[1]);
z= (float)fabs(normal[2]);
x= fabsf(normal[0]);
y= fabsf(normal[1]);
z= fabsf(normal[2]);
max = MAX3(x, y, z);
if(max==y) py=2;
else if(max==x) {
@ -238,6 +238,15 @@ void closest_to_line_segment_v3(float closest[3], const float v1[3], const float
}
/* signed distance from the point to the plane in 3D */
float dist_to_plane_normalized_v3(const float p[3], const float plane_co[3], const float plane_no_unit[3])
{
float plane_co_other[3];
add_v3_v3v3(plane_co_other, plane_co, plane_no_unit);
return line_point_factor_v3(p, plane_co, plane_co_other);
}
float dist_to_plane_v3(const float p[3], const float plane_co[3], const float plane_no[3])
{
float plane_no_unit[3];
@ -246,7 +255,7 @@ float dist_to_plane_v3(const float p[3], const float plane_co[3], const float pl
normalize_v3_v3(plane_no_unit, plane_no);
add_v3_v3v3(plane_co_other, plane_co, plane_no_unit);
return -line_point_factor_v3(p, plane_co, plane_co_other);
return line_point_factor_v3(p, plane_co, plane_co_other);
}
/* distance v1 to line-piece v2-v3 in 3D */
@ -601,7 +610,9 @@ int isect_point_quad_v2(const float pt[2], const float v1[2], const float v2[2],
test if the line starting at p1 ending at p2 intersects the triangle v0..v2
return non zero if it does
*/
int isect_line_tri_v3(const float p1[3], const float p2[3], const float v0[3], const float v1[3], const float v2[3], float *lambda, float uv[2])
int isect_line_tri_v3(const float p1[3], const float p2[3],
const float v0[3], const float v1[3], const float v2[3],
float *r_lambda, float r_uv[2])
{
float p[3], s[3], d[3], e1[3], e2[3], q[3];
@ -626,12 +637,12 @@ int isect_line_tri_v3(const float p1[3], const float p2[3], const float v0[3], c
v = f * dot_v3v3(d, q);
if ((v < 0.0f)||((u + v) > 1.0f)) return 0;
*lambda = f * dot_v3v3(e2, q);
if ((*lambda < 0.0f)||(*lambda > 1.0f)) return 0;
*r_lambda = f * dot_v3v3(e2, q);
if ((*r_lambda < 0.0f)||(*r_lambda > 1.0f)) return 0;
if(uv) {
uv[0]= u;
uv[1]= v;
if(r_uv) {
r_uv[0]= u;
r_uv[1]= v;
}
return 1;
@ -640,7 +651,9 @@ int isect_line_tri_v3(const float p1[3], const float p2[3], const float v0[3], c
test if the ray starting at p1 going in d direction intersects the triangle v0..v2
return non zero if it does
*/
int isect_ray_tri_v3(const float p1[3], const float d[3], const float v0[3], const float v1[3], const float v2[3], float *lambda, float uv[2])
int isect_ray_tri_v3(const float p1[3], const float d[3],
const float v0[3], const float v1[3], const float v2[3],
float *r_lambda, float r_uv[2])
{
float p[3], s[3], e1[3], e2[3], q[3];
float a, f, u, v;
@ -665,18 +678,20 @@ int isect_ray_tri_v3(const float p1[3], const float d[3], const float v0[3], con
v = f * dot_v3v3(d, q);
if ((v < 0.0f)||((u + v) > 1.0f)) return 0;
*lambda = f * dot_v3v3(e2, q);
if ((*lambda < 0.0f)) return 0;
*r_lambda = f * dot_v3v3(e2, q);
if ((*r_lambda < 0.0f)) return 0;
if(uv) {
uv[0]= u;
uv[1]= v;
if(r_uv) {
r_uv[0]= u;
r_uv[1]= v;
}
return 1;
}
int isect_ray_plane_v3(float p1[3], float d[3], float v0[3], float v1[3], float v2[3], float *lambda, int clip)
int isect_ray_plane_v3(const float p1[3], const float d[3],
const float v0[3], const float v1[3], const float v2[3],
float *r_lambda, const int clip)
{
float p[3], s[3], e1[3], e2[3], q[3];
float a, f;
@ -700,13 +715,15 @@ int isect_ray_plane_v3(float p1[3], float d[3], float v0[3], float v1[3], float
/* v = f * dot_v3v3(d, q); */ /*UNUSED*/
*lambda = f * dot_v3v3(e2, q);
if (clip && (*lambda < 0.0f)) return 0;
*r_lambda = f * dot_v3v3(e2, q);
if (clip && (*r_lambda < 0.0f)) return 0;
return 1;
}
int isect_ray_tri_epsilon_v3(const float p1[3], const float d[3], const float v0[3], const float v1[3], const float v2[3], float *lambda, float uv[2], const float epsilon)
int isect_ray_tri_epsilon_v3(const float p1[3], const float d[3],
const float v0[3], const float v1[3], const float v2[3],
float *r_lambda, float uv[2], const float epsilon)
{
float p[3], s[3], e1[3], e2[3], q[3];
float a, f, u, v;
@ -729,8 +746,8 @@ int isect_ray_tri_epsilon_v3(const float p1[3], const float d[3], const float v0
v = f * dot_v3v3(d, q);
if ((v < -epsilon)||((u + v) > 1.0f+epsilon)) return 0;
*lambda = f * dot_v3v3(e2, q);
if ((*lambda < 0.0f)) return 0;
*r_lambda = f * dot_v3v3(e2, q);
if ((*r_lambda < 0.0f)) return 0;
if(uv) {
uv[0]= u;
@ -740,7 +757,9 @@ int isect_ray_tri_epsilon_v3(const float p1[3], const float d[3], const float v0
return 1;
}
int isect_ray_tri_threshold_v3(const float p1[3], const float d[3], const float v0[3], const float v1[3], const float v2[3], float *lambda, float *uv, const float threshold)
int isect_ray_tri_threshold_v3(const float p1[3], const float d[3],
const float v0[3], const float v1[3], const float v2[3],
float *r_lambda, float r_uv[2], const float threshold)
{
float p[3], s[3], e1[3], e2[3], q[3];
float a, f, u, v;
@ -757,8 +776,8 @@ int isect_ray_tri_threshold_v3(const float p1[3], const float d[3], const float
sub_v3_v3v3(s, p1, v0);
cross_v3_v3v3(q, s, e1);
*lambda = f * dot_v3v3(e2, q);
if ((*lambda < 0.0f)) return 0;
*r_lambda = f * dot_v3v3(e2, q);
if ((*r_lambda < 0.0f)) return 0;
u = f * dot_v3v3(s, p);
v = f * dot_v3v3(d, q);
@ -782,9 +801,9 @@ int isect_ray_tri_threshold_v3(const float p1[3], const float d[3], const float
return 0;
}
if(uv) {
uv[0]= u;
uv[1]= v;
if(r_uv) {
r_uv[0]= u;
r_uv[1]= v;
}
return 1;
@ -833,24 +852,16 @@ int isect_line_plane_v3(float out[3], const float l1[3], const float l2[3], cons
}
}
int isect_plane_plane_v3(float r_isect_co[3], float r_isect_no[3],
/* note: return normal isnt unit length */
void isect_plane_plane_v3(float r_isect_co[3], float r_isect_no[3],
const float plane_a_co[3], const float plane_a_no[3],
const float plane_b_co[3], const float plane_b_no[3])
{
float p1_co_other[3], p2_co_other[3];
float isect_co_dummy[3];
cross_v3_v3v3(r_isect_no, plane_a_no, plane_b_no);
cross_v3_v3v3(p1_co_other, plane_a_no, r_isect_no);
cross_v3_v3v3(p2_co_other, plane_b_no, r_isect_no);
add_v3_v3(p1_co_other, plane_a_co);
add_v3_v3(p2_co_other, plane_b_co);
/* we could use either ix_1, ix_2 - doesnt matter in this case */
return isect_line_line_v3(plane_a_co, p1_co_other,
plane_b_co, p2_co_other,
r_isect_co, isect_co_dummy);
float plane_a_co_other[3];
cross_v3_v3v3(r_isect_no, plane_a_no, plane_b_no); /* direction is simply the cross product */
cross_v3_v3v3(plane_a_co_other, plane_a_no, r_isect_no);
add_v3_v3(plane_a_co_other, plane_a_co);
isect_line_plane_v3(r_isect_co, plane_a_co, plane_a_co_other, plane_b_co, plane_b_no, FALSE);
}
@ -893,7 +904,10 @@ static int getLowestRoot(const float a, const float b, const float c, const floa
return 0;
}
int isect_sweeping_sphere_tri_v3(const float p1[3], const float p2[3], const float radius, const float v0[3], const float v1[3], const float v2[3], float *lambda, float ipoint[3])
int isect_sweeping_sphere_tri_v3(
const float p1[3], const float p2[3], const float radius,
const float v0[3], const float v1[3], const float v2[3],
float *r_lambda, float ipoint[3])
{
float e1[3], e2[3], e3[3], point[3], vel[3], /*dist[3],*/ nor[3], temp[3], bv[3];
float a, b, c, d, e, x, y, z, radius2=radius*radius;
@ -960,14 +974,14 @@ int isect_sweeping_sphere_tri_v3(const float p1[3], const float p2[3], const flo
if(z <= 0.0f && (x >= 0.0f && y >= 0.0f))
{
//(((unsigned int)z)& ~(((unsigned int)x)|((unsigned int)y))) & 0x80000000){
*lambda=t0;
*r_lambda=t0;
copy_v3_v3(ipoint,point);
return 1;
}
}
*lambda=1.0f;
*r_lambda=1.0f;
/*---test points---*/
a=dot_v3v3(vel,vel);
@ -977,7 +991,7 @@ int isect_sweeping_sphere_tri_v3(const float p1[3], const float p2[3], const flo
b=2.0f*dot_v3v3(vel,temp);
c=dot_v3v3(temp,temp)-radius2;
if(getLowestRoot(a, b, c, *lambda, lambda))
if(getLowestRoot(a, b, c, *r_lambda, r_lambda))
{
copy_v3_v3(ipoint,v0);
found_by_sweep=1;
@ -988,7 +1002,7 @@ int isect_sweeping_sphere_tri_v3(const float p1[3], const float p2[3], const flo
b=2.0f*dot_v3v3(vel,temp);
c=dot_v3v3(temp,temp)-radius2;
if(getLowestRoot(a, b, c, *lambda, lambda))
if(getLowestRoot(a, b, c, *r_lambda, r_lambda))
{
copy_v3_v3(ipoint,v1);
found_by_sweep=1;
@ -999,7 +1013,7 @@ int isect_sweeping_sphere_tri_v3(const float p1[3], const float p2[3], const flo
b=2.0f*dot_v3v3(vel,temp);
c=dot_v3v3(temp,temp)-radius2;
if(getLowestRoot(a, b, c, *lambda, lambda))
if(getLowestRoot(a, b, c, *r_lambda, r_lambda))
{
copy_v3_v3(ipoint,v2);
found_by_sweep=1;
@ -1020,13 +1034,13 @@ int isect_sweeping_sphere_tri_v3(const float p1[3], const float p2[3], const flo
b=2.0f*(elen2*dot_v3v3(vel,bv)-edotv*edotbv);
c=elen2*(radius2-dot_v3v3(bv,bv))+edotbv*edotbv;
if(getLowestRoot(a, b, c, *lambda, &newLambda))
if(getLowestRoot(a, b, c, *r_lambda, &newLambda))
{
e=(edotv*newLambda-edotbv)/elen2;
if(e >= 0.0f && e <= 1.0f)
{
*lambda = newLambda;
*r_lambda = newLambda;
copy_v3_v3(ipoint,e1);
mul_v3_fl(ipoint,e);
add_v3_v3(ipoint, v0);
@ -1044,13 +1058,13 @@ int isect_sweeping_sphere_tri_v3(const float p1[3], const float p2[3], const flo
b=2.0f*(elen2*dot_v3v3(vel,bv)-edotv*edotbv);
c=elen2*(radius2-dot_v3v3(bv,bv))+edotbv*edotbv;
if(getLowestRoot(a, b, c, *lambda, &newLambda))
if(getLowestRoot(a, b, c, *r_lambda, &newLambda))
{
e=(edotv*newLambda-edotbv)/elen2;
if(e >= 0.0f && e <= 1.0f)
{
*lambda = newLambda;
*r_lambda = newLambda;
copy_v3_v3(ipoint,e2);
mul_v3_fl(ipoint,e);
add_v3_v3(ipoint, v0);
@ -1073,13 +1087,13 @@ int isect_sweeping_sphere_tri_v3(const float p1[3], const float p2[3], const flo
b=2.0f*(elen2*dot_v3v3(vel,bv)-edotv*edotbv);
c=elen2*(radius2-dot_v3v3(bv,bv))+edotbv*edotbv;
if(getLowestRoot(a, b, c, *lambda, &newLambda))
if(getLowestRoot(a, b, c, *r_lambda, &newLambda))
{
e=(edotv*newLambda-edotbv)/elen2;
if(e >= 0.0f && e <= 1.0f)
{
*lambda = newLambda;
*r_lambda = newLambda;
copy_v3_v3(ipoint,e3);
mul_v3_fl(ipoint,e);
add_v3_v3(ipoint, v1);
@ -1090,7 +1104,8 @@ int isect_sweeping_sphere_tri_v3(const float p1[3], const float p2[3], const flo
return found_by_sweep;
}
int isect_axial_line_tri_v3(const int axis, const float p1[3], const float p2[3], const float v0[3], const float v1[3], const float v2[3], float *lambda)
int isect_axial_line_tri_v3(const int axis, const float p1[3], const float p2[3],
const float v0[3], const float v1[3], const float v2[3], float *r_lambda)
{
float p[3], e1[3], e2[3];
float u, v, f;
@ -1127,9 +1142,9 @@ int isect_axial_line_tri_v3(const int axis, const float p1[3], const float p2[3]
if ((u < 0.0f) || ((u + v) > 1.0f)) return 0;
*lambda = (p[a0]+u*e1[a0]+v*e2[a0])/(p2[a0]-p1[a0]);
*r_lambda = (p[a0]+u*e1[a0]+v*e2[a0])/(p2[a0]-p1[a0]);
if ((*lambda < 0.0f) || (*lambda > 1.0f)) return 0;
if ((*r_lambda < 0.0f) || (*r_lambda > 1.0f)) return 0;
return 1;
}
@ -1203,7 +1218,7 @@ int isect_line_line_v3(const float v1[3], const float v2[3], const float v3[3],
/* Intersection point strictly between the two lines
* 0 when no intersection is found
* */
int isect_line_line_strict_v3(const float v1[3], const float v2[3], const float v3[3], const float v4[3], float vi[3], float *lambda)
int isect_line_line_strict_v3(const float v1[3], const float v2[3], const float v3[3], const float v4[3], float vi[3], float *r_lambda)
{
float a[3], b[3], c[3], ab[3], cb[3], ca[3], dir1[3], dir2[3];
float d;
@ -1237,12 +1252,9 @@ int isect_line_line_strict_v3(const float v1[3], const float v2[3], const float
{
mul_v3_fl(a, f1);
add_v3_v3v3(vi, v1, a);
if (lambda != NULL)
{
*lambda = f1;
}
if (r_lambda) *r_lambda = f1;
return 1; /* intersection found */
}
else
@ -1306,7 +1318,7 @@ float line_point_factor_v2(const float p[2], const float l1[2], const float l2[2
}
/* Similar to LineIntersectsTriangleUV, except it operates on a quad and in 2d, assumes point is in quad */
void isect_point_quad_uv_v2(const float v0[2], const float v1[2], const float v2[2], const float v3[2], const float pt[2], float *uv)
void isect_point_quad_uv_v2(const float v0[2], const float v1[2], const float v2[2], const float v3[2], const float pt[2], float r_uv[2])
{
float x0,y0, x1,y1, wtot, v2d[2], w1, w2;
@ -1331,7 +1343,7 @@ void isect_point_quad_uv_v2(const float v0[2], const float v1[2], const float v2
wtot = w1+w2;
/*w1 = w1/wtot;*/
/*w2 = w2/wtot;*/
uv[0] = w1/wtot;
r_uv[0] = w1/wtot;
} else {
/* lines are parallel, lambda_cp_line_ex is 3d grrr */
/*printf("\tparallel1\n");*/
@ -1353,7 +1365,7 @@ void isect_point_quad_uv_v2(const float v0[2], const float v1[2], const float v2
v2d[1] = pt[1]-pt_on_line[1];
w2 = len_v2(v2d);
wtot = w1+w2;
uv[0] = w1/wtot;
r_uv[0] = w1/wtot;
}
/* Same as above to calc the uv[1] value, alternate calculation */
@ -1371,7 +1383,7 @@ void isect_point_quad_uv_v2(const float v0[2], const float v1[2], const float v2
v2d[1] = y1-v1[1];
w2 = len_v2(v2d);
wtot = w1+w2;
uv[1] = w1/wtot;
r_uv[1] = w1/wtot;
} else {
/* lines are parallel, lambda_cp_line_ex is 3d grrr */
/*printf("\tparallel2\n");*/
@ -1394,23 +1406,23 @@ void isect_point_quad_uv_v2(const float v0[2], const float v1[2], const float v2
v2d[1] = pt[1]-pt_on_line[1];
w2 = len_v2(v2d);
wtot = w1+w2;
uv[1] = w1/wtot;
r_uv[1] = w1/wtot;
}
/* may need to flip UV's here */
}
/* same as above but does tri's and quads, tri's are a bit of a hack */
void isect_point_face_uv_v2(const int isquad, const float v0[2], const float v1[2], const float v2[2], const float v3[2], const float pt[2], float *uv)
void isect_point_face_uv_v2(const int isquad, const float v0[2], const float v1[2], const float v2[2], const float v3[2], const float pt[2], float r_uv[2])
{
if (isquad) {
isect_point_quad_uv_v2(v0, v1, v2, v3, pt, uv);
isect_point_quad_uv_v2(v0, v1, v2, v3, pt, r_uv);
}
else {
/* not for quads, use for our abuse of LineIntersectsTriangleUV */
float p1_3d[3], p2_3d[3], v0_3d[3], v1_3d[3], v2_3d[3], lambda;
p1_3d[0] = p2_3d[0] = uv[0];
p1_3d[1] = p2_3d[1] = uv[1];
p1_3d[0] = p2_3d[0] = r_uv[0];
p1_3d[1] = p2_3d[1] = r_uv[1];
p1_3d[2] = 1.0f;
p2_3d[2] = -1.0f;
v0_3d[2] = v1_3d[2] = v2_3d[2] = 0.0;
@ -1427,7 +1439,7 @@ void isect_point_face_uv_v2(const int isquad, const float v0[2], const float v1[
copy_v2_v2(v2_3d, v2);
/* Doing this in 3D is not nice */
isect_line_tri_v3(p1_3d, p2_3d, v0_3d, v1_3d, v2_3d, &lambda, uv);
isect_line_tri_v3(p1_3d, p2_3d, v0_3d, v1_3d, v2_3d, &lambda, r_uv);
}
}
@ -1689,9 +1701,9 @@ static int barycentric_weights(const float v1[3], const float v2[3], const float
/* find best projection of face XY, XZ or YZ: barycentric weights of
the 2d projected coords are the same and faster to compute */
xn= (float)fabs(n[0]);
yn= (float)fabs(n[1]);
zn= (float)fabs(n[2]);
xn= fabsf(n[0]);
yn= fabsf(n[1]);
zn= fabsf(n[2]);
if(zn>=xn && zn>=yn) {i= 0; j= 1;}
else if(yn>=xn && yn>=zn) {i= 0; j= 2;}
else {i= 1; j= 2;}
@ -1993,7 +2005,7 @@ void interp_cubic_v3(float x[3], float v[3], const float x1[3], const float v1[3
#define IS_ZERO(x) ((x>(-DBL_EPSILON) && x<DBL_EPSILON) ? 1 : 0)
/* Barycentric reverse */
void resolve_tri_uv(float uv[2], const float st[2], const float st0[2], const float st1[2], const float st2[2])
void resolve_tri_uv(float r_uv[2], const float st[2], const float st0[2], const float st1[2], const float st2[2])
{
/* find UV such that
t= u*t0 + v*t1 + (1-u-v)*t2
@ -2005,13 +2017,13 @@ void resolve_tri_uv(float uv[2], const float st[2], const float st0[2], const fl
if(IS_ZERO(det)==0) { /* det should never be zero since the determinant is the signed ST area of the triangle. */
const double x[]= {st[0]-st2[0], st[1]-st2[1]};
uv[0]= (float)((d*x[0] - b*x[1])/det);
uv[1]= (float)(((-c)*x[0] + a*x[1])/det);
} else zero_v2(uv);
r_uv[0]= (float)((d*x[0] - b*x[1])/det);
r_uv[1]= (float)(((-c)*x[0] + a*x[1])/det);
} else zero_v2(r_uv);
}
/* bilinear reverse */
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])
void resolve_quad_uv(float r_uv[2], const float st[2], const float st0[2], const float st1[2], const float st2[2], const float st3[2])
{
const double signed_area= (st0[0]*st1[1] - st0[1]*st1[0]) + (st1[0]*st2[1] - st1[1]*st2[0]) +
(st2[0]*st3[1] - st2[1]*st3[0]) + (st3[0]*st0[1] - st3[1]*st0[0]);
@ -2029,25 +2041,25 @@ void resolve_quad_uv(float uv[2], const float st[2], const float st0[2], const f
const double denom= a - 2*b + fC;
// clear outputs
zero_v2(uv);
zero_v2(r_uv);
if(IS_ZERO(denom)!=0) {
const double fDen= a-fC;
if(IS_ZERO(fDen)==0)
uv[0]= (float)(a / fDen);
r_uv[0]= (float)(a / fDen);
} else {
const double desc_sq= b*b - a*fC;
const double desc= sqrt(desc_sq<0.0?0.0:desc_sq);
const double s= signed_area>0 ? (-1.0) : 1.0;
uv[0]= (float)(( (a-b) + s * desc ) / denom);
r_uv[0]= (float)(( (a-b) + s * desc ) / denom);
}
/* find UV such that
fST = (1-u)(1-v)*ST0 + u*(1-v)*ST1 + u*v*ST2 + (1-u)*v*ST3 */
{
const double denom_s= (1-uv[0])*(st0[0]-st3[0]) + uv[0]*(st1[0]-st2[0]);
const double denom_t= (1-uv[0])*(st0[1]-st3[1]) + uv[0]*(st1[1]-st2[1]);
const double denom_s= (1-r_uv[0])*(st0[0]-st3[0]) + r_uv[0]*(st1[0]-st2[0]);
const double denom_t= (1-r_uv[0])*(st0[1]-st3[1]) + r_uv[0]*(st1[1]-st2[1]);
int i= 0; double denom= denom_s;
if(fabs(denom_s)<fabs(denom_t)) {
@ -2056,7 +2068,7 @@ void resolve_quad_uv(float uv[2], const float st[2], const float st0[2], const f
}
if(IS_ZERO(denom)==0)
uv[1]= (float) (( (1.0f-uv[0])*(st0[i]-st[i]) + uv[0]*(st1[i]-st[i]) ) / denom);
r_uv[1]= (float) (( (1.0f-r_uv[0])*(st0[i]-st[i]) + r_uv[0]*(st1[i]-st[i]) ) / denom);
}
}

@ -1322,8 +1322,8 @@ void mat3_to_compatible_eulO(float eul[3], float oldrot[3], short order,float ma
compatible_eul(eul1, oldrot);
compatible_eul(eul2, oldrot);
d1= (float)fabs(eul1[0]-oldrot[0]) + (float)fabs(eul1[1]-oldrot[1]) + (float)fabs(eul1[2]-oldrot[2]);
d2= (float)fabs(eul2[0]-oldrot[0]) + (float)fabs(eul2[1]-oldrot[1]) + (float)fabs(eul2[2]-oldrot[2]);
d1= fabsf(eul1[0]-oldrot[0]) + fabsf(eul1[1]-oldrot[1]) + fabsf(eul1[2]-oldrot[2]);
d2= fabsf(eul2[0]-oldrot[0]) + fabsf(eul2[1]-oldrot[1]) + fabsf(eul2[2]-oldrot[2]);
/* return best, which is just the one with lowest difference */
if (d1 > d2)

@ -44,6 +44,7 @@
#include "BLI_fileops.h"
#include "BLI_path_util.h"
#include "BLI_string.h"
#include "BLI_string_utf8.h"
#include "BLI_utildefines.h"
#include "BKE_utildefines.h"
@ -220,16 +221,25 @@ int BLI_uniquename_cb(int (*unique_check)(void *, const char *), void *arg, cons
}
if(unique_check(arg, name)) {
char numstr[16];
char tempname[UNIQUE_NAME_MAX];
char left[UNIQUE_NAME_MAX];
int number;
int len= BLI_split_name_num(left, &number, name, delim);
do {
int newlen= BLI_snprintf(tempname, name_len, "%s%c%03d", left, delim, ++number);
if(newlen >= name_len) {
len -= ((newlen + 1) - name_len);
if(len < 0) len= number= 0;
left[len]= '\0';
int numlen= BLI_snprintf(numstr, sizeof(numstr), "%c%03d", delim, ++number);
/* highly unlikely the string only has enough room for the number
* but support anyway */
if ((len == 0) || (numlen >= name_len)) {
/* number is know not to be utf-8 */
BLI_strncpy(tempname, numstr, name_len);
}
else {
char *tempname_buf;
tempname[0]= '\0';
tempname_buf =BLI_strncat_utf8(tempname, left, name_len - numlen);
memcpy(tempname_buf, numstr, numlen + 1);
}
} while(unique_check(arg, tempname));

@ -163,28 +163,46 @@ static const size_t utf8_skip_data[256] = {
3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,4,4,4,4,4,4,4,4,5,5,5,5,6,6,1,1
};
#define BLI_STR_UTF8_CPY(dst, src, maxncpy) \
{ \
size_t utf8_size; \
while(*src != '\0' && (utf8_size= utf8_skip_data[*src]) < maxncpy) { \
maxncpy -= utf8_size; \
switch(utf8_size) { \
case 6: *dst ++ = *src ++; \
case 5: *dst ++ = *src ++; \
case 4: *dst ++ = *src ++; \
case 3: *dst ++ = *src ++; \
case 2: *dst ++ = *src ++; \
case 1: *dst ++ = *src ++; \
} \
} \
*dst= '\0'; \
}
char *BLI_strncpy_utf8(char *dst, const char *src, size_t maxncpy)
{
char *dst_r= dst;
size_t utf8_size;
/* note: currently we dont attempt to deal with invalid utf8 chars */
BLI_STR_UTF8_CPY(dst, src, maxncpy)
while(*src != '\0' && (utf8_size= utf8_skip_data[*src]) < maxncpy) {
maxncpy -= utf8_size;
switch(utf8_size) {
case 6: *dst ++ = *src ++;
case 5: *dst ++ = *src ++;
case 4: *dst ++ = *src ++;
case 3: *dst ++ = *src ++;
case 2: *dst ++ = *src ++;
case 1: *dst ++ = *src ++;
}
}
*dst= '\0';
return dst_r;
}
char *BLI_strncat_utf8(char *dst, const char *src, size_t maxncpy)
{
while (*dst && maxncpy > 0) {
dst++;
maxncpy--;
}
BLI_STR_UTF8_CPY(dst, src, maxncpy)
return dst;
}
#undef BLI_STR_UTF8_CPY
/* --------------------------------------------------------------------------*/
/* wchar_t / utf8 functions */

@ -4726,6 +4726,9 @@ static void lib_link_scene(FileData *fd, Main *main)
/*Game Settings: Dome Warp Text*/
sce->gm.dome.warptext= newlibadr(fd, sce->id.lib, sce->gm.dome.warptext);
/* Motion Tracking */
sce->clip= newlibadr_us(fd, sce->id.lib, sce->clip);
sce->id.flag -= LIB_NEEDLINK;
}
@ -4929,8 +4932,6 @@ static void direct_link_scene(FileData *fd, Scene *sce)
sce->nodetree= newdataadr(fd, sce->nodetree);
if(sce->nodetree)
direct_link_nodetree(fd, sce->nodetree);
sce->clip= newlibadr_us(fd, sce->id.lib, sce->clip);
}
/* ************ READ WM ***************** */
@ -7347,6 +7348,67 @@ static void do_versions_nodetree_convert_angle(bNodeTree *ntree)
}
}
void do_versions_image_settings_2_60(Scene *sce)
{
/* note: rd->subimtype is moved into indervidual settings now and no longer
* exists */
RenderData *rd= &sce->r;
ImageFormatData *imf= &sce->r.im_format;
imf->imtype= rd->imtype;
imf->planes= rd->planes;
imf->compress= rd->quality;
imf->quality= rd->quality;
/* default, was stored in multiple places, may override later */
imf->depth= R_IMF_CHAN_DEPTH_8;
/* openexr */
imf->exr_codec = rd->quality & 7; /* strange but true! 0-4 are valid values, OPENEXR_COMPRESS */
switch (imf->imtype) {
case R_IMF_IMTYPE_OPENEXR:
imf->depth= (rd->subimtype & R_OPENEXR_HALF) ? R_IMF_CHAN_DEPTH_16 : R_IMF_CHAN_DEPTH_32;
if (rd->subimtype & R_PREVIEW_JPG) {
imf->flag |= R_IMF_FLAG_PREVIEW_JPG;
}
if (rd->subimtype & R_OPENEXR_ZBUF) {
imf->flag |= R_IMF_FLAG_ZBUF;
}
break;
case R_IMF_IMTYPE_TIFF:
if (rd->subimtype & R_TIFF_16BIT) {
imf->depth= R_IMF_CHAN_DEPTH_16;
}
break;
case R_IMF_IMTYPE_JP2:
if (rd->subimtype & R_JPEG2K_16BIT) {
imf->depth= R_IMF_CHAN_DEPTH_16;
}
else if (rd->subimtype & R_JPEG2K_12BIT) {
imf->depth= R_IMF_CHAN_DEPTH_12;
}
if (rd->subimtype & R_JPEG2K_YCC) {
imf->jp2_flag |= R_IMF_JP2_FLAG_YCC;
}
if (rd->subimtype & R_JPEG2K_CINE_PRESET) {
imf->jp2_flag |= R_IMF_JP2_FLAG_CINE_PRESET;
}
if (rd->subimtype & R_JPEG2K_CINE_48FPS) {
imf->jp2_flag |= R_IMF_JP2_FLAG_CINE_48;
}
break;
case R_IMF_IMTYPE_CINEON:
case R_IMF_IMTYPE_DPX:
if (rd->subimtype & R_CINEON_LOG) {
imf->cineon_flag |= R_IMF_CINEON_FLAG_LOG;
}
break;
}
}
static void do_versions(FileData *fd, Library *lib, Main *main)
{
/* WATCH IT!!!: pointers from libdata have not been converted */
@ -8947,7 +9009,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
if(sce->r.yparts<2) sce->r.yparts= 4;
/* adds default layer */
if(sce->r.layers.first==NULL)
scene_add_render_layer(sce);
scene_add_render_layer(sce, NULL);
else {
SceneRenderLayer *srl;
/* new layer flag for sky, was default for solid */
@ -12543,6 +12605,12 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
/* put compatibility code here until next subversion bump */
{
Scene *sce;
for(sce = main->scene.first; sce; sce = sce->id.next) {
if (sce->r.im_format.depth == 0) {
do_versions_image_settings_2_60(sce);
}
}
}
/* WATCH IT!!!: pointers from libdata have not been converted yet here! */

@ -794,7 +794,7 @@ void draw_gpencil_view3d (Scene *scene, View3D *v3d, ARegion *ar, short only3d)
* deal with the camera border, otherwise map the coords to the camera border. */
if ((rv3d->persp == RV3D_CAMOB) && !(G.f & G_RENDER_OGL)) {
rctf rectf;
ED_view3d_calc_camera_border(scene, ar, v3d, rv3d, &rectf, -1); /* negative shift */
ED_view3d_calc_camera_border(scene, ar, v3d, rv3d, &rectf, TRUE); /* no shift */
BLI_copy_rcti_rctf(&rect, &rectf);
}
else {

@ -468,7 +468,7 @@ static int gp_camera_view_subrect(bContext *C, rctf *subrect)
/* for camera view set the subrect */
if (rv3d->persp == RV3D_CAMOB) {
Scene *scene= CTX_data_scene(C);
ED_view3d_calc_camera_border(scene, ar, v3d, rv3d, subrect, -1); /* negative shift */
ED_view3d_calc_camera_border(scene, ar, v3d, rv3d, subrect, TRUE); /* no shift */
return 1;
}
}

@ -1258,7 +1258,7 @@ static void gp_paint_initstroke (tGPsdata *p, short paintmode)
/* for camera view set the subrect */
if (rv3d->persp == RV3D_CAMOB) {
ED_view3d_calc_camera_border(p->scene, p->ar, v3d, rv3d, &p->subrect_data, -1); /* negative shift */
ED_view3d_calc_camera_border(p->scene, p->ar, v3d, rv3d, &p->subrect_data, TRUE); /* no shift */
p->subrect= &p->subrect_data;
}
}

@ -183,10 +183,10 @@ typedef enum SnapMode
#define SNAP_MIN_DISTANCE 30
int peelObjectsTransForm(struct TransInfo *t, struct ListBase *depth_peels, float mval[2]);
int peelObjectsContext(struct bContext *C, struct ListBase *depth_peels, float mval[2]);
int snapObjectsTransform(struct TransInfo *t, float mval[2], int *dist, float *loc, float *no, SnapMode mode);
int snapObjectsContext(struct bContext *C, float mval[2], int *dist, float *loc, float *no, SnapMode mode);
int peelObjectsTransForm(struct TransInfo *t, struct ListBase *depth_peels, const float mval[2]);
int peelObjectsContext(struct bContext *C, struct ListBase *depth_peels, const float mval[2]);
int snapObjectsTransform(struct TransInfo *t, const float mval[2], int *r_dist, float r_loc[3], float r_no[3], SnapMode mode);
int snapObjectsContext(struct bContext *C, const float mval[2], int *r_dist, float r_loc[3], float r_no[3], SnapMode mode);
#endif

@ -206,12 +206,12 @@ void project_int_noclip(struct ARegion *ar, const float vec[3], int adr[2]);
void project_float(struct ARegion *ar, const float vec[3], float adr[2]);
void project_float_noclip(struct ARegion *ar, const float vec[3], float adr[2]);
void ED_view3d_ob_clip_range_get(struct Object *ob, float *lens, float *clipsta, float *clipend);
int ED_view3d_clip_range_get(struct View3D *v3d, struct RegionView3D *rv3d, float *clipsta, float *clipend);
int ED_view3d_viewplane_get(struct View3D *v3d, struct RegionView3D *rv3d, int winxi, int winyi, struct rctf *viewplane, float *clipsta, float *clipend, float *pixsize);
int ED_view3d_viewplane_get(struct View3D *v3d, struct RegionView3D *rv3d, int winxi, int winyi, struct rctf *viewplane, float *clipsta, float *clipend);
void ED_view3d_ob_project_mat_get(struct RegionView3D *v3d, struct Object *ob, float pmat[4][4]);
void ED_view3d_project_float(struct ARegion *a, const float vec[3], float adr[2], float mat[4][4]);
void ED_view3d_calc_camera_border(struct Scene *scene, struct ARegion *ar, struct View3D *v3d, struct RegionView3D *rv3d, struct rctf *viewborder_r, short do_shift);
void ED_view3d_calc_camera_border(struct Scene *scene, struct ARegion *ar, struct View3D *v3d, struct RegionView3D *rv3d, struct rctf *viewborder_r, short no_shift);
void ED_view3d_calc_camera_border_size(struct Scene *scene, struct ARegion *ar, struct View3D *v3d, struct RegionView3D *rv3d, float size_r[2]);
/* drawobject.c iterators */
void mesh_foreachScreenVert(struct ViewContext *vc, void (*func)(void *userData, struct EditVert *eve, int x, int y, int index), void *userData, int clipVerts);
@ -290,6 +290,7 @@ void ED_view3d_camera_lock_init(struct View3D *v3d, struct RegionView3D *rv3d);
/* copy the view to the camera, return TRUE if */
int ED_view3d_camera_lock_sync(struct View3D *v3d, struct RegionView3D *rv3d);
struct BGpic *ED_view3D_background_image_add(struct View3D *v3d);
struct BGpic *ED_view3D_background_image_new(struct View3D *v3d);
void ED_view3D_background_image_remove(struct View3D *v3d, struct BGpic *bgpic);
#endif /* ED_VIEW3D_H */

@ -515,7 +515,7 @@ uiBut *uiDefHotKeyevtButS(uiBlock *block, int retval, const char *str, int x1, i
uiBut *uiDefSearchBut(uiBlock *block, void *arg, int retval, int icon, int maxlen, int x1, int y1, short x2, short y2, float a1, float a2, const char *tip);
uiBut *uiDefAutoButR(uiBlock *block, struct PointerRNA *ptr, struct PropertyRNA *prop, int index, const char *name, int icon, int x1, int y1, int x2, int y2);
int uiDefAutoButsRNA(uiLayout *layout, struct PointerRNA *ptr, int (*check_prop)(struct PropertyRNA *), const char label_align);
int uiDefAutoButsRNA(uiLayout *layout, struct PointerRNA *ptr, int (*check_prop)(struct PointerRNA *, struct PropertyRNA *), const char label_align);
/* Links
*
@ -592,7 +592,8 @@ void autocomplete_end(AutoComplete *autocpl, char *autoname);
* not clear yet so we postpone that. */
void uiBeginPanels(const struct bContext *C, struct ARegion *ar);
void uiEndPanels(const struct bContext *C, struct ARegion *ar);
void uiEndPanels(const struct bContext *C, struct ARegion *ar, int *x, int *y);
void uiDrawPanels(const struct bContext *C, struct ARegion *ar);
struct Panel *uiBeginPanel(struct ScrArea *sa, struct ARegion *ar, uiBlock *block, struct PanelType *pt, int *open);
void uiEndPanel(uiBlock *block, int width, int height);
@ -687,7 +688,7 @@ uiBlock *uiLayoutGetBlock(uiLayout *layout);
void uiLayoutSetFunc(uiLayout *layout, uiMenuHandleFunc handlefunc, void *argv);
void uiLayoutSetContextPointer(uiLayout *layout, const char *name, struct PointerRNA *ptr);
const char *uiLayoutIntrospect(uiLayout *layout); // XXX - testing
void uiLayoutOperatorButs(const struct bContext *C, struct uiLayout *layout, struct wmOperator *op, int (*check_prop)(struct PropertyRNA *), const char label_align, const short flag);
void uiLayoutOperatorButs(const struct bContext *C, struct uiLayout *layout, struct wmOperator *op, int (*check_prop)(struct PointerRNA *, struct PropertyRNA *), const char label_align, const short flag);
struct MenuType *uiButGetMenuType(uiBut *but);
void uiLayoutSetOperatorContext(uiLayout *layout, int opcontext);
@ -747,6 +748,7 @@ void uiTemplateColorWheel(uiLayout *layout, struct PointerRNA *ptr, const char *
void uiTemplateLayers(uiLayout *layout, struct PointerRNA *ptr, const char *propname,
PointerRNA *used_ptr, const char *used_propname, int active_layer);
void uiTemplateImage(uiLayout *layout, struct bContext *C, struct PointerRNA *ptr, const char *propname, struct PointerRNA *userptr, int compact);
void uiTemplateImageSettings(uiLayout *layout, struct PointerRNA *imfptr);
void uiTemplateImageLayers(uiLayout *layout, struct bContext *C, struct Image *ima, struct ImageUser *iuser);
void uiTemplateRunningJobs(uiLayout *layout, struct bContext *C);
void uiTemplateOperatorSearch(uiLayout *layout);

@ -318,6 +318,9 @@ void UI_ThemeClearColor(int colorid);
// internal (blender) usage only, for init and set active
void UI_SetTheme(int spacetype, int regionid);
// get current theme
struct bTheme *UI_GetTheme(void);
/* only for buttons in theme editor! */
const unsigned char *UI_ThemeGetColorPtr(struct bTheme *btheme, int spacetype, int colorid);

@ -2618,11 +2618,8 @@ static uiBut *ui_def_but_rna(uiBlock *block, int type, int retval, const char *s
else
BLI_dynstr_appendf(dynstr, "|%s %%x%d", item[i].name, item[i].value);
if(value == item[i].value) {
if(value == item[i].value)
icon= item[i].icon;
if(!tip)
tip= item[i].description;
}
}
str= BLI_dynstr_get_cstring(dynstr);
BLI_dynstr_free(dynstr);

@ -164,24 +164,7 @@ int ui_but_anim_expression_create(uiBut *but, const char *str)
/* set the expression */
// TODO: need some way of identifying variables used
BLI_strncpy_utf8(driver->expression, str, sizeof(driver->expression));
/* FIXME: for now, assume that
* - for expressions, users are likely to be using "frame" -> current frame" as a variable
* - driver_add_new_variable() adds a single-prop variable by default
*/
{
DriverVar *dvar;
DriverTarget *dtar;
dvar = driver_add_new_variable(driver);
BLI_strncpy(dvar->name, "frame", sizeof(dvar->name));
dtar = &dvar->targets[0];
dtar->id = (ID *)CTX_data_scene(C); // XXX: should we check that C is valid first?
dtar->idtype= ID_SCE;
dtar->rna_path = BLI_sprintfN("frame_current");
}
/* updates */
driver->flag |= DRIVER_FLAG_RECOMPILE;
WM_event_add_notifier(C, NC_ANIMATION|ND_KEYFRAME, NULL);

@ -506,7 +506,7 @@ static void init_brush_icons(void)
static void init_internal_icons(void)
{
bTheme *btheme= U.themes.first;
bTheme *btheme= UI_GetTheme();
ImBuf *bbuf= NULL;
int x, y, icontype;
char iconfilestr[FILE_MAXDIR+FILE_MAXFILE];
@ -950,6 +950,7 @@ static int get_draw_size(enum eIconSizes size)
static void icon_draw_size(float x, float y, int icon_id, float aspect, float alpha, float *rgb, enum eIconSizes size, int draw_size, int UNUSED(nocreate), short is_preview)
{
bTheme *btheme= UI_GetTheme();
Icon *icon = NULL;
DrawInfo *di = NULL;
IconImage *iimg;
@ -957,6 +958,7 @@ static void icon_draw_size(float x, float y, int icon_id, float aspect, float al
int w, h;
icon = BKE_icon_get(icon_id);
alpha *= btheme->tui.icon_alpha;
if (icon==NULL) {
if (G.f & G_DEBUG)

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