OPTION(WITH_VERSE "Enable Verse (http://verse.blender.org)" OFF)
OPTION(WITH_ELBEEM "Enable Elbeem (Fluid Simulation)" ON)
OPTION(WITH_QUICKTIME "Enable Quicktime Support" OFF)
-OPTION(WITH_OPENEXR "Enable OpenEXR Support (http://www.openexr.com)" OFF)
+OPTION(WITH_OPENEXR "Enable OpenEXR Support (http://www.openexr.com)" ON)
OPTION(WITH_FFMPEG "Enable FFMPeg Support (http://ffmpeg.mplayerhq.hu/)" OFF)
OPTION(WITH_OPENAL "Enable OpenAL Support (http://www.openal.org)" ON)
OPTION(YESIAMSTUPID "Enable execution on 64-bit platforms" OFF)
env['OURPLATFORM'] = platform
-configfile = B.arguments.get('BF_CONFIG', 'config'+os.sep+platform+'-config.py')
+configfile = 'config'+os.sep+platform+'-config.py'
if os.path.exists(configfile):
print B.bc.OKGREEN + "Using config file: " + B.bc.ENDC + configfile
# Needed for gui programs, console programs should do without it
env.Append(LINKFLAGS=['-mwindows'])
+userconfig = B.arguments.get('BF_CONFIG', 'user-config.py')
# first read platform config. B.arguments will override
optfiles = [configfile]
-if os.path.exists('user-config.py'):
- print B.bc.OKGREEN + "Using config file: " + B.bc.ENDC + 'user-config.py'
- optfiles += ['user-config.py']
+if os.path.exists(userconfig):
+ print B.bc.OKGREEN + "Using user-config file: " + B.bc.ENDC + userconfig
+ optfiles += [userconfig]
else:
- print B.bc.WARNING + 'user-config.py' + " not found, no user overrides" + B.bc.ENDC
+ print B.bc.WARNING + userconfig + " not found, no user overrides" + B.bc.ENDC
opts = btools.read_opts(optfiles, B.arguments)
opts.Update(env)
env['CCFLAGS'].append('-DDISABLE_ELBEEM')
if env['WITH_BF_OPENMP'] == 1:
- if env['OURPLATFORM']=='win32-vc':
- env['CCFLAGS'].append('/openmp')
- env['CPPFLAGS'].append('/openmp')
- env['CXXFLAGS'].append('/openmp')
- else:
- if env['CC'] == 'icc':
- env.Append(LINKFLAGS=['-openmp', '-static-intel'])
- env['CCFLAGS'].append('-openmp')
- env['CPPFLAGS'].append('-openmp')
- env['CXXFLAGS'].append('-openmp')
- else:
- env['CCFLAGS'].append('-fopenmp')
- env['CPPFLAGS'].append('-fopenmp')
- env['CXXFLAGS'].append('-fopenmp')
+ if env['OURPLATFORM']=='win32-vc':
+ env['CCFLAGS'].append('/openmp')
+ env['CPPFLAGS'].append('/openmp')
+ env['CXXFLAGS'].append('/openmp')
+ else:
+ if env['CC'] == 'icc':
+ env.Append(LINKFLAGS=['-openmp', '-static-intel'])
+ env['CCFLAGS'].append('-openmp')
+ env['CPPFLAGS'].append('-openmp')
+ env['CXXFLAGS'].append('-openmp')
+ else:
+ env['CCFLAGS'].append('-fopenmp')
+ env['CPPFLAGS'].append('-fopenmp')
+ env['CXXFLAGS'].append('-fopenmp')
#check for additional debug libnames
if os.path.exists(B.root_build_dir):
print B.bc.HEADER+'Cleaning...'+B.bc.ENDC
dirs = os.listdir(B.root_build_dir)
- for dir in dirs:
- if os.path.isdir(B.root_build_dir + dir) == 1:
- print "clean dir %s"%(B.root_build_dir+dir)
- shutil.rmtree(B.root_build_dir+dir)
+ for entry in dirs:
+ if os.path.isdir(B.root_build_dir + entry) == 1:
+ print "clean dir %s"%(B.root_build_dir+entry)
+ shutil.rmtree(B.root_build_dir+entry)
+ else: # remove file
+ print "remove file %s"%(B.root_build_dir+entry)
+ os.remove(B.root_build_dir+entry)
+ for confile in ['extern/ffmpeg/config.mak', 'extern/x264/config.mak',
+ 'extern/xvidcore/build/generic/platform.inc']:
+ if os.path.exists(confile):
+ print "clean file %s"%confile
+ os.remove(confile)
print B.bc.OKGREEN+'...done'+B.bc.ENDC
else:
print B.bc.HEADER+'Already Clean, nothing to do.'+B.bc.ENDC
scriptinstall = []
if env['OURPLATFORM']!='darwin':
- for dp, dn, df in os.walk('bin/.blender'):
- if 'CVS' in dn:
- dn.remove('CVS')
- if '.svn' in dn:
- dn.remove('.svn')
- for f in df:
- dotblendlist.append(dp+os.sep+f)
- dottargetlist.append(env['BF_INSTALLDIR']+dp[3:]+os.sep+f)
-
- dotblenderinstall = []
- for targetdir,srcfile in zip(dottargetlist, dotblendlist):
- td, tf = os.path.split(targetdir)
- dotblenderinstall.append(env.Install(dir=td, source=srcfile))
-
- #-- .blender/scripts
- scriptpath='release/scripts'
- for dp, dn, df in os.walk(scriptpath):
- if 'CVS' in dn:
- dn.remove('CVS')
- if '.svn' in dn:
- dn.remove('.svn')
- dir=env['BF_INSTALLDIR']+'/.blender/scripts'+dp[len(scriptpath):]
- source=[dp+os.sep+f for f in df]
- scriptinstall.append(env.Install(dir=dir,source=source))
+ for dp, dn, df in os.walk('bin/.blender'):
+ if 'CVS' in dn:
+ dn.remove('CVS')
+ if '.svn' in dn:
+ dn.remove('.svn')
+ for f in df:
+ dotblendlist.append(dp+os.sep+f)
+ dottargetlist.append(env['BF_INSTALLDIR']+dp[3:]+os.sep+f)
+
+ dotblenderinstall = []
+ for targetdir,srcfile in zip(dottargetlist, dotblendlist):
+ td, tf = os.path.split(targetdir)
+ dotblenderinstall.append(env.Install(dir=td, source=srcfile))
+
+ #-- .blender/scripts
+ scriptpath='release/scripts'
+ for dp, dn, df in os.walk(scriptpath):
+ if 'CVS' in dn:
+ dn.remove('CVS')
+ if '.svn' in dn:
+ dn.remove('.svn')
+ dir=env['BF_INSTALLDIR']+'/.blender/scripts'+dp[len(scriptpath):]
+ source=[dp+os.sep+f for f in df]
+ scriptinstall.append(env.Install(dir=dir,source=source))
#-- plugins
pluglist = []
textinstall = env.Install(dir=env['BF_INSTALLDIR'], source=textlist)
if env['OURPLATFORM']=='darwin':
- allinstall = [blenderinstall, plugininstall, textinstall]
+ allinstall = [blenderinstall, plugininstall, textinstall]
else:
- allinstall = [blenderinstall, dotblenderinstall, scriptinstall, plugininstall, textinstall]
+ allinstall = [blenderinstall, dotblenderinstall, scriptinstall, plugininstall, textinstall]
if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw'):
dllsources = ['${LCGDIR}/gettext/lib/gnu_gettext.dll',
dllsources += ['${LCGDIR}/pthreads/lib/pthreadVC2.dll']
if env['WITH_BF_ICONV']:
dllsources += ['${LCGDIR}/iconv/lib/iconv.dll']
-# if env['WITH_BF_FFMPEG']:
-# dllsources += ['${LCGDIR}/ffmpeg/lib/avcodec-51.dll',
-# '${LCGDIR}/ffmpeg/lib/avformat-51.dll',
-# '${LCGDIR}/ffmpeg/lib/avutil-49.dll']
+ if env['WITH_BF_FFMPEG']:
+ dllsources += ['${LCGDIR}/ffmpeg/lib/avcodec-51.dll',
+ '${LCGDIR}/ffmpeg/lib/avformat-52.dll',
+ '${LCGDIR}/ffmpeg/lib/avdevice-52.dll',
+ '${LCGDIR}/ffmpeg/lib/avutil-49.dll',
+ '${LCGDIR}/ffmpeg/lib/libfaad-0.dll',
+ '${LCGDIR}/ffmpeg/lib/libfaac-0.dll',
+ '${LCGDIR}/ffmpeg/lib/libmp3lame-0.dll',
+ '${LCGDIR}/ffmpeg/lib/libx264-59.dll',
+ '${LCGDIR}/ffmpeg/lib/xvidcore.dll',
+ '${LCGDIR}/ffmpeg/lib/swscale-0.dll']
windlls = env.Install(dir=env['BF_INSTALLDIR'], source = dllsources)
allinstall += windlls
Default(B.program_list)
if not env['WITHOUT_BF_INSTALL']:
- Default(installtarget)
+ Default(installtarget)
#------------ RELEASE
# TODO: zipup the installation
-LCGDIR = '#../lib/darwin-6.1-powerpc'
+#
+# Note : if you want to alter this file
+# copy it as a whole in the upper folder
+# as user-config.py
+# dont create a new file with only some
+# vars changed.
+
+import commands
+
+# IMPORTANT NOTE : OFFICIAL BUILDS SHOULD BE DONE WITH SDKs
+USE_SDK='true'
+
+BF_PYTHON_VERSION = '2.3'
+
+cmd = 'uname -p'
+MAC_PROC=commands.getoutput(cmd)
+cmd = 'uname -r'
+cmd_res=commands.getoutput(cmd)
+if cmd_res[0]=='7':
+ MAC_CUR_VER='10.3'
+elif cmd_res[0]=='8':
+ MAC_CUR_VER='10.4'
+else:
+ MAC_CUR_VER='10.5'
+
+if MAC_PROC == 'powerpc':
+ LCGDIR = '#../lib/darwin-6.1-powerpc'
+else :
+ LCGDIR = '#../lib/darwin-8.x.i386'
LIBDIR = '${LCGDIR}'
+if MAC_PROC== 'powerpc' and BF_PYTHON_VERSION == '2.3':
+ MAC_MIN_VERS = '10.3'
+ MACOSX_SDK='/Developer/SDKs/MacOSX10.3.9.sdk'
+else:
+ MAC_MIN_VERS = '10.4'
+ MACOSX_SDK='/Developer/SDKs/MacOSX10.4u.sdk'
+
+
# enable ffmpeg support
WITH_BF_FFMPEG = 'true' # -DWITH_FFMPEG
BF_FFMPEG = "#extern/ffmpeg"
BF_FFMPEG_INC = '${BF_FFMPEG}/include'
+if USE_SDK=='true':
+ BF_FFMPEG_EXTRA = '-isysroot '+MACOSX_SDK+' -mmacosx-version-min='+MAC_MIN_VERS
#BF_FFMPEG_LIBPATH='${BF_FFMPEG}/lib'
#BF_FFMPEG_LIB = 'avformat.a avcodec.a avutil.a'
BF_VERSE_INCLUDE = BF_VERSE
BF_VERSE_LIBS = "libverse"
-# python.org libs install in /library
-BF_PYTHON_VERSION = '2.5'
+# python.org libs install in /library we want to use that for 2.5
+#
+# if you want py2.5 on leopard without installing
+# change value to BF_PYTHON = '/Library/Frameworks/Python.framework/Versions/'
+# BEWARE: in that case it will work only on leopard
+
if BF_PYTHON_VERSION=='2.3':
BF_PYTHON = '/System/Library/Frameworks/Python.framework/Versions/'
else:
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'
-BF_PYTHON_LINKFLAGS = '-u __dummy -u _PyMac_Error -framework System -framework Python'
-
-WITH_BF_OPENAL = 'true'
+BF_PYTHON_LINKFLAGS = '-u _PyMac_Error -framework System -framework Python'
+if MAC_CUR_VER=='10.3' or MAC_CUR_VER=='10.4':
+ BF_PYTHON_LINKFLAGS ='-u __dummy '+BF_PYTHON_LINKFLAGS
+
+BF_QUIET = '1'
+WITH_BF_OPENMP = '0'
+
+# Note : should be true, but openal simply dont work on intel
+if MAC_PROC == 'i386':
+ WITH_BF_OPENAL = 'false'
+else:
+ 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
-BF_OPENAL = '#../lib/darwin-8.0.0-powerpc/openal'
-
+# for gcc 3.4 and ulterior
+if MAC_PROC == 'powerpc':
+ BF_OPENAL = '#../lib/darwin-8.0.0-powerpc/openal'
+else :
+ BF_OPENAL = LIBDIR + '/openal'
+
BF_OPENAL_INC = '${BF_OPENAL}/include'
BF_OPENAL_LIB = 'openal'
BF_OPENAL_LIBPATH = '${BF_OPENAL}/lib'
WITH_BF_GAMEENGINE='true'
WITH_BF_PLAYER='true'
+WITH_BF_GLEXT= '1'
WITH_BF_ODE = 'false'
BF_ODE = LIBDIR + '/ode'
BF_OPENGL_LIBPATH = '/System/Library/Frameworks/OpenGL.framework/Libraries'
BF_OPENGL_LINKFLAGS = '-framework OpenGL'
-##
-##CC = gcc
-##CCC = g++
-##ifeq ($CPU),alpha)
-## CFLAGS += -pipe -fPIC -funsigned-char -fno-strict-aliasing -mieee
-
-CFLAGS = ['-pipe','-fPIC','-funsigned-char','-fno-strict-aliasing']
+CFLAGS = ['-pipe','-fPIC','-funsigned-char']
CPPFLAGS = ['-fpascal-strings']
-CCFLAGS = ['-pipe','-fPIC','-funsigned-char','-fno-strict-aliasing', '-fpascal-strings']
-CXXFLAGS = ['-pipe','-fPIC','-funsigned-char','-fno-strict-aliasing', '-fpascal-strings']
+CCFLAGS = ['-pipe','-fPIC','-funsigned-char','-fpascal-strings']
+CXXFLAGS = [ '-pipe','-fPIC','-funsigned-char', '-fpascal-strings']
PLATFORM_LINKFLAGS = '-fexceptions -framework CoreServices -framework Foundation -framework IOKit -framework AppKit -framework Carbon -framework AGL -framework AudioUnit -framework AudioToolbox -framework CoreAudio -framework QuickTime'
-REL_CFLAGS = ['-O2']
-REL_CCFLAGS = ['-O2']
+
+#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
+LLIBS = 'stdc++ SystemStubs'
+
+# some flags shuffling for different Os versions
+if MAC_MIN_VERS == '10.3':
+ CFLAGS = ['-fuse-cxa-atexit']+CFLAGS
+ CXXFLAGS = ['-fuse-cxa-atexit']+CXXFLAGS
+ PLATFORM_LINKFLAGS = '-fuse-cxa-atexit '+PLATFORM_LINKFLAGS
+ LLIBS = LLIBS + ' crt3.o'
+
+if USE_SDK=='true':
+ SDK_FLAGS=['-isysroot', MACOSX_SDK,'-mmacosx-version-min='+MAC_MIN_VERS]
+ PLATFORM_LINKFLAGS = '-mmacosx-version-min='+MAC_MIN_VERS+ ' -Wl,-syslibroot,' + MACOSX_SDK+" "+PLATFORM_LINKFLAGS
+ CCFLAGS=SDK_FLAGS+CCFLAGS
+ CXXFLAGS=SDK_FLAGS+CXXFLAGS
+
+if MAC_PROC == 'i386':
+ REL_CFLAGS = ['-O2','-ftree-vectorize','-msse','-msse2','-msse3','-mssse3']
+ REL_CCFLAGS = ['-O2','-ftree-vectorize','-msse','-msse2','-msse3','-mssse3']
+else:
+ CFLAGS = CFLAGS+['-fno-strict-aliasing']
+ CCFLAGS = CCFLAGS+['-fno-strict-aliasing']
+ CXXFLAGS = CXXFLAGS+['-fno-strict-aliasing']
+
+ REL_CFLAGS = ['-O2']
+ REL_CCFLAGS = ['-O2']
+
##BF_DEPEND = 'true'
##
##AR = ar
##FIX_STUBS_WARNINGS = -Wno-unused
-LLIBS = 'stdc++ SystemStubs'
##LOPTS = --dynamic
##DYNLDFLAGS = -shared $(LDFLAGS)
$Id$
- Note: The current official release of SCons is 0.97
+ Note: The current official release of SCons is 0.98, but
+ our system still works for 0.97. However, this will be fixed
+ soon.
Blenders SCons build scripts
============================
likings. Any value set here will override the ones from the
(platform)-config.py.
+ You can use BF_CONFIG argument to override the default user-config.py
+ check. This is just like the user-config.py, but just with another name:
+
+ % scons BF_CONFIG=myownsettings
+
If you want to quickly test a new setting, you can give the option
also on the command-line:
typedef short int16;
typedef unsigned char uint8;
typedef char int8;
-typedef char boolean;
+typedef unsigned char boolean;
#include "v_cmd_gen.h"
#include "v_network.h"
#include <stdarg.h>
/* mmap exception */
-#if defined(AMIGA) || defined(__BeOS) || defined(WIN32)
+#if defined(AMIGA) || defined(__BeOS)
+#elif defined(WIN32)
+#include <sys/types.h>
+#include "mmap_win.h"
#else
#include <sys/types.h>
#include <sys/mman.h>
/* note; mmap returns zero'd memory */
void *MEM_mapallocN(unsigned int len, const char *str)
{
-#if defined(AMIGA) || defined(__BeOS) || defined(WIN32)
+#if defined(AMIGA) || defined(__BeOS)
return MEM_callocN(len, str);
#else
MemHead *memh;
totblock--;
mem_in_use -= memh->len;
-#if defined(AMIGA) || defined(__BeOS) || defined(WIN32)
+#if defined(AMIGA) || defined(__BeOS)
free(memh);
#else
--- /dev/null
+/**
+ * $Id: $
+ *
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * The Original Code is Copyright (C) 2008 Blender Foundation.
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): Andrea Weikert.
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+#if defined(WIN32)
+
+#include <windows.h>
+#include <errno.h>
+#include <io.h>
+#include <sys/types.h>
+#include <stdio.h>
+
+#include "mmap_win.h"
+
+#ifndef FILE_MAP_EXECUTE
+//not defined in earlier versions of the Platform SDK (before February 2003)
+#define FILE_MAP_EXECUTE 0x0020
+#endif
+
+/* --------------------------------------------------------------------- */
+/* local storage definitions */
+/* --------------------------------------------------------------------- */
+/* all memory mapped chunks are put in linked lists */
+typedef struct mmapLink
+{
+ struct mmapLink *next,*prev;
+} mmapLink;
+
+typedef struct mmapListBase
+{
+ void *first, *last;
+} mmapListBase;
+
+typedef struct MemMap {
+ struct MemMap *next,*prev;
+ void *mmap;
+ HANDLE fhandle;
+ HANDLE maphandle;
+} MemMap;
+
+/* --------------------------------------------------------------------- */
+/* local functions */
+/* --------------------------------------------------------------------- */
+
+static void mmap_addtail(volatile mmapListBase *listbase, void *vlink);
+static void mmap_remlink(volatile mmapListBase *listbase, void *vlink);
+static void *mmap_findlink(volatile mmapListBase *listbase, void *ptr);
+
+static int mmap_get_prot_flags (int flags);
+static int mmap_get_access_flags (int flags);
+
+/* --------------------------------------------------------------------- */
+/* vars */
+/* --------------------------------------------------------------------- */
+volatile static struct mmapListBase _mmapbase;
+volatile static struct mmapListBase *mmapbase = &_mmapbase;
+
+
+/* --------------------------------------------------------------------- */
+/* implementation */
+/* --------------------------------------------------------------------- */
+
+/* mmap for windows */
+void *mmap(void *start, size_t len, int prot, int flags, int fd, off_t offset)
+{
+ HANDLE fhandle = INVALID_HANDLE_VALUE;
+ HANDLE maphandle;
+ int prot_flags = mmap_get_prot_flags(prot);
+ int access_flags = mmap_get_access_flags(prot);
+ MemMap *mm = NULL;
+ void *ptr = NULL;
+
+ if ( flags & MAP_FIXED ) {
+ return MAP_FAILED;
+ }
+
+ /*
+ if ( fd == -1 ) {
+ _set_errno( EBADF );
+ return MAP_FAILED;
+ }
+ */
+
+ if ( fd != -1 ) {
+ fhandle = (HANDLE) _get_osfhandle (fd);
+ }
+ if ( fhandle == INVALID_HANDLE_VALUE ) {
+ if (!(flags & MAP_ANONYMOUS)) {
+ errno = EBADF;
+ return MAP_FAILED;
+ }
+ } else {
+ if ( !DuplicateHandle( GetCurrentProcess(), fhandle, GetCurrentProcess(),
+ &fhandle, 0, FALSE, DUPLICATE_SAME_ACCESS ) ) {
+ return MAP_FAILED;
+ }
+ }
+
+ maphandle = CreateFileMapping(fhandle, NULL, prot_flags, 0, len, NULL);
+ if ( maphandle == 0 ) {
+ errno = EBADF;
+ return MAP_FAILED;
+ }
+
+ ptr = MapViewOfFile(maphandle, access_flags, 0, offset, 0);
+ if ( ptr == NULL ) {
+ DWORD dwLastErr = GetLastError();
+ if ( dwLastErr == ERROR_MAPPED_ALIGNMENT )
+ errno=EINVAL;
+ else
+ errno=EACCES;
+ CloseHandle(maphandle);
+ return MAP_FAILED;
+ }
+
+ mm= (MemMap *)malloc(sizeof(MemMap));
+ if (!mm) {
+ errno=ENOMEM;
+ }
+ mm->fhandle = fhandle;
+ mm->maphandle = maphandle;
+ mm->mmap = ptr;
+ mmap_addtail(mmapbase, mm);
+
+ return ptr;
+}
+
+/* munmap for windows */
+long munmap(void *ptr, long size)
+{
+ MemMap *mm = mmap_findlink(mmapbase, ptr);
+ if (!mm) {
+ errno=EINVAL;
+ return -1;
+ }
+ UnmapViewOfFile( mm->mmap );
+ CloseHandle( mm->maphandle );
+ CloseHandle( mm->fhandle);
+ mmap_remlink(mmapbase, mm);
+ return 0;
+}
+
+/* --------------------------------------------------------------------- */
+/* local functions */
+/* --------------------------------------------------------------------- */
+
+static void mmap_addtail(volatile mmapListBase *listbase, void *vlink)
+{
+ struct mmapLink *link= vlink;
+
+ if (link == 0) return;
+ if (listbase == 0) return;
+
+ link->next = 0;
+ link->prev = listbase->last;
+
+ if (listbase->last) ((struct mmapLink *)listbase->last)->next = link;
+ if (listbase->first == 0) listbase->first = link;
+ listbase->last = link;
+}
+
+static void mmap_remlink(volatile mmapListBase *listbase, void *vlink)
+{
+ struct mmapLink *link= vlink;
+
+ if (link == 0) return;
+ if (listbase == 0) return;
+
+ if (link->next) link->next->prev = link->prev;
+ if (link->prev) link->prev->next = link->next;
+
+ if (listbase->last == link) listbase->last = link->prev;
+ if (listbase->first == link) listbase->first = link->next;
+}
+
+static void *mmap_findlink(volatile mmapListBase *listbase, void *ptr)
+{
+ MemMap *mmap_ptr = (MemMap*)ptr;
+ MemMap *mm;
+
+ if (ptr == 0) return NULL;
+ if (listbase == 0) return NULL;
+
+ mm = (MemMap *)listbase->first;
+ while (mm) {
+ if (mm->mmap == ptr) {
+ return mm;
+ }
+ mm = mm->next;
+ }
+ return NULL;
+}
+
+static int mmap_get_prot_flags (int flags)
+{
+ int prot = PAGE_NOACCESS;
+
+ if ( ( flags & PROT_READ ) == PROT_READ ) {
+ if ( ( flags & PROT_WRITE ) == PROT_WRITE ) {
+ prot = (flags & PROT_EXEC) ? PAGE_EXECUTE_READWRITE : PAGE_READWRITE;
+ } else {
+ prot = (flags & PROT_EXEC) ? PAGE_EXECUTE_READ : PAGE_READONLY;
+ }
+ } else if ( ( flags & PROT_WRITE ) == PROT_WRITE ) {
+ prot = (flags & PROT_EXEC) ? PAGE_EXECUTE_READ : PAGE_WRITECOPY;
+ } else if ( ( flags & PROT_EXEC ) == PROT_EXEC ) {
+ prot = PAGE_EXECUTE_READ;
+ }
+ return prot;
+}
+
+static int mmap_get_access_flags (int flags)
+{
+ int access = 0;
+
+ if ( ( flags & PROT_READ ) == PROT_READ ) {
+ if ( ( flags & PROT_WRITE ) == PROT_WRITE ) {
+ access = FILE_MAP_WRITE;
+ } else {
+ access = (flags & PROT_EXEC) ? FILE_MAP_EXECUTE : FILE_MAP_READ;
+ }
+ } else if ( ( flags & PROT_WRITE ) == PROT_WRITE ) {
+ access = FILE_MAP_COPY;
+ } else if ( ( flags & PROT_EXEC ) == PROT_EXEC ) {
+ access = FILE_MAP_EXECUTE;
+ }
+ return access;
+}
+
+
+#endif // WIN32
+
+
+
+
+
<File
RelativePath="..\..\intern\mallocn.c">
</File>
+ <File
+ RelativePath="..\..\intern\mmap_win.c">
+ </File>
</Filter>
<Filter
Name="Header Files"
<File
RelativePath="..\..\MEM_guardedalloc.h">
</File>
+ <File
+ RelativePath="..\..\mmap_win.h">
+ </File>
+ </Filter>
+ <Filter
+ Name="intern"
+ Filter="">
</Filter>
</Filter>
</Files>
--- /dev/null
+/**
+ * $Id: $
+ *
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * The Original Code is Copyright (C) 2008 Blender Foundation.
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): Andrea Weikert.
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+#ifndef MMAP_WIN_H
+#define MMAP_WIN_H
+
+#define PROT_NONE 0
+#define PROT_READ 1
+#define PROT_WRITE 2
+#define PROT_EXEC 4
+
+#define MAP_FILE 0
+#define MAP_SHARED 1
+#define MAP_PRIVATE 2
+#define MAP_TYPE 0xF
+#define MAP_FIXED 0x10
+#define MAP_ANONYMOUS 0x20
+#define MAP_ANON MAP_ANONYMOUS
+
+#define MAP_FAILED ((void *)-1)
+
+void *mmap(void *start, size_t len, int prot, int flags, int fd, off_t offset);
+long munmap(void *ptr, long size);
+
+#endif
+
if not 'fill:none' in pr:
Courbe[n].fill=1
if USE_COLORS:
- if '#' in pr:
- i= pr.find('fill:#')+6
+ i= pr.find('fill:#')
+ if i != -1:
+ i= i+6
Courbe[n].color=[int(pr[i:i+2],16),int(pr[i+2:i+4],16),int(pr[i+4:i+6],16)]
Courbe[n].mat=1
elif ';fill-opacity' in pr:
"""
Name: 'Raw Faces (.raw)...'
-Blender: 242
+Blender: 245
Group: 'Export'
-Tooltip: 'Export selected mesh to Raw Triangle Format (.raw)'
+Tooltip: 'Export selected mesh to Raw Format (.raw)'
"""
__author__ = "Anthony D'Agostino (Scorpius)"
__version__ = "Part of IOSuite 0.5"
__bpydoc__ = """\
-This script exports meshes to Raw Triangle file format.
+This script exports meshes to Raw file format.
The raw triangle format is very simple; it has no verts or faces lists.
-It's just a simple ascii text file with the vertices of each triangle
+It's just a simple ascii text file with the vertices of each triangle or quad
listed on each line. There were some very old utilities (when the PovRay
forum was in existence on CompuServe) that preformed operations on these
files.
filename += '.raw'
scn= Blender.Scene.GetCurrent()
- object= scn.getActiveObject()
- if not object:
+ ob= scn.objects.active
+ if not ob:
Blender.Draw.PupMenu('Error%t|Select 1 active object')
return
file = open(filename, 'wb')
- mesh = BPyMesh.getMeshFromObject(object, None, True, False, scn)
+ mesh = BPyMesh.getMeshFromObject(ob, None, True, False, scn)
if not mesh:
Blender.Draw.PupMenu('Error%t|Could not get mesh data from active object')
return
- mesh.transform(object.matrixWorld)
+ mesh.transform(ob.matrixWorld)
file = open(filename, "wb")
for f in mesh.faces:
- for v in f.v:
+ for v in f:
file.write('%.6f %.6f %.6f ' % tuple(v.co))
file.write('\n')
file.close()
struct MemFile;
#define BLENDER_VERSION 245
-#define BLENDER_SUBVERSION 16
+#define BLENDER_SUBVERSION 17
#define BLENDER_MINVERSION 240
#define BLENDER_MINSUBVERSION 0
#include "BKE_collision.h"
struct Object;
-struct Cloth;
+
struct MFace;
struct DerivedMesh;
struct ClothModifierData;
#define CLOTH_VERT_FLAG_COLLISION 2
#define CLOTH_VERT_FLAG_PINNED_EM 3
+/**
+* This structure describes a cloth object against which the
+* simulation can run.
+*
+* The m and n members of this structure represent the assumed
+* rectangular ordered grid for which the original paper is written.
+* At some point they need to disappear and we need to determine out
+* own connectivity of the mesh based on the actual edges in the mesh.
+*
+**/
+typedef struct Cloth
+{
+ struct ClothVertex *verts; /* The vertices that represent this cloth. */
+ struct LinkNode *springs; /* The springs connecting the mesh. */
+ unsigned int numverts; /* The number of verts == m * n. */
+ unsigned int numsprings; /* The count of springs. */
+ unsigned int numfaces;
+ unsigned char old_solver_type; /* unused, only 1 solver here */
+ unsigned char pad2;
+ short pad3;
+ struct BVH *tree; /* collision tree for this cloth object */
+ struct MFace *mfaces;
+ struct Implicit_Data *implicit; /* our implicit solver connects to this pointer */
+ struct Implicit_Data *implicitEM; /* our implicit solver connects to this pointer */
+ struct EdgeHash *edgehash; /* used for selfcollisions */
+} Cloth;
+
/**
* The definition of a cloth vertex.
*/
struct Effect;
struct ListBase;
-struct PartEff;
struct Particle;
struct Group;
Object obcopy; /* for restoring transformation data */
} pEffectorCache;
-
-struct Effect *add_effect(int type);
void free_effect(struct Effect *eff);
void free_effects(struct ListBase *lb);
struct Effect *copy_effect(struct Effect *eff);
-void copy_act_effect(struct Object *ob);
void copy_effects(struct ListBase *lbn, struct ListBase *lb);
void deselectall_eff(struct Object *ob);
-struct PartEff *give_parteff(struct Object *ob);
-void where_is_particle(struct PartEff *paf, struct Particle *pa, float ctime, float *vec);
-void build_particle_system(struct Object *ob);
/* particle deflector */
#define PE_WIND_AS_SPEED 0x00000001
+struct PartEff *give_parteff(struct Object *ob);
struct ListBase *pdInitEffectors(struct Object *obsrc, struct Group *group);
void pdEndEffectors(struct ListBase *lb);
void pdDoEffectors(struct ListBase *lb, float *opco, float *force, float *speed, float cur_time, float loc_time, unsigned int flags);
void multires_level_to_mesh(struct Object *ob, struct Mesh *me, const int render);
void multires_update_levels(struct Mesh *me, const int render);
void multires_update_first_level(struct Mesh *me, struct EditMesh *em);
-void multires_update_customdata(struct MultiresLevel *lvl1, struct CustomData *src,
+void multires_update_customdata(struct MultiresLevel *lvl1, struct EditMesh *em, struct CustomData *src,
struct CustomData *dst, const int type);
void multires_customdata_to_mesh(struct Mesh *me, struct EditMesh *em,
struct MultiresLevel *lvl, struct CustomData *src,
struct ParticleSettings *psys_new_settings(char *name, struct Main *main);
struct ParticleSettings *psys_copy_settings(struct ParticleSettings *part);
void psys_flush_settings(struct ParticleSettings *part, int event, int hair_recalc);
+void make_local_particlesettings(struct ParticleSettings *part);
struct LinkNode *psys_using_settings(struct ParticleSettings *part, int flush_update);
void psys_changed_type(struct ParticleSystem *psys);
/* editseq.c */
Sequence *get_forground_frame_seq(int frame){return 0;};
+void set_last_seq(Sequence *seq){return 0;};
/* modifier.c stub */
void harmonic_coordinates_bind(struct MeshDeformModifierData *mmd,
dofluidsim = ((ob->fluidsimFlag & OB_FLUIDSIM_ENABLE) &&
(ob->fluidsimSettings->type & OB_FLUIDSIM_DOMAIN)&&
(ob->fluidsimSettings->meshSurface) &&
- (1) && (!give_parteff(ob)) && // doesnt work together with particle systems!
(me->totvert == ((Mesh *)(ob->fluidsimSettings->meshSurface))->totvert));
if (vertCos && !dofluidsim)
* domain objects
*/
if((G.obedit!=ob) && !needMapping) {
- if((ob->fluidsimFlag & OB_FLUIDSIM_ENABLE) &&
- (1) && (!give_parteff(ob)) ) { // doesnt work together with particle systems!
+ if((ob->fluidsimFlag & OB_FLUIDSIM_ENABLE)) {
if(ob->fluidsimSettings->type & OB_FLUIDSIM_DOMAIN) {
loadFluidsimMesh(ob,useRenderParams);
fluidsimMeshUsed = 1;
if (ob==G.obedit) {
editmesh_build_data(dataMask);
} else {
- PartEff *paf= give_parteff(ob);
-
mesh_build_data(ob, dataMask);
-
- if(paf) {
- if((paf->flag & PAF_STATIC) || (ob->recalc & OB_RECALC_TIME)==0)
- build_particle_system(ob);
- }
}
}
/* global time */
cfra*= G.scene->r.framelen;
-
-
- /* decide later... */
-// if(no_speed_curve==0) if(ob && ob->ipo) cfra= calc_ipo_time(ob->ipo, cfra);
-
+
return cfra;
}
workob.constraints.first = ob->constraints.first;
workob.constraints.last = ob->constraints.last;
- strcpy(workob.parsubstr, ob->parsubstr);
+ strcpy(workob.parsubstr, ob->parsubstr);
+ strcpy(workob.id.name, ob->id.name);
/* extract_ipochannels_from_action needs id's! */
workob.action= act;
- extract_ipochannels_from_action(&tchanbase, &ob->id, act, "Object", bsystem_time(&workob, cframe, 0.0));
+ extract_ipochannels_from_action(&tchanbase, &workob.id, act, "Object", bsystem_time(&workob, cframe, 0.0));
if (tchanbase.first) {
execute_ipochannels(&tchanbase);
ParticleSystemModifierData *psmd;
float ctime, pa_time, scale = 1.0f;
float tmat[4][4], mat[4][4], obrotmat[4][4], pamat[4][4], size=0.0;
- float obmat[4][4], (*obmatlist)[4][4]=0;
+ float (*obmat)[4];
float xvec[3] = {-1.0, 0.0, 0.0}, q[4];
int lay, a, b, k, step_nbr = 0, counter, hair = 0;
int totpart, totchild, totgroup=0, pa_num;
}
oblist= MEM_callocN(totgroup*sizeof(Object *), "dupgroup object list");
- obmatlist= MEM_callocN(totgroup*sizeof(float)*4*4, "dupgroup obmat list");
go= part->dup_group->gobject.first;
- for(a=0; a<totgroup; a++, go=go->next) {
+ for(a=0; a<totgroup; a++, go=go->next)
oblist[a]=go->ob;
- Mat4CpyMat4(obmatlist[a], go->ob->obmat);
- }
}
- else {
+ else
ob = part->dup_ob;
- Mat4CpyMat4(obmat, ob->obmat);
- }
if(totchild==0 || part->draw & PART_DRAW_PARENT)
a=0;
b= a % totgroup;
ob = oblist[b];
- Mat4CpyMat4(obmat, obmatlist[b]);
+ obmat= oblist[b]->obmat;
}
+ else
+ obmat= ob->obmat;
for(k=0; k<=step_nbr; k++, counter++) {
if(hair) {
if(part->draw_as==PART_DRAW_GR && psys->part->draw & PART_DRAW_WHOLE_GR) {
for(go= part->dup_group->gobject.first, b=0; go; go= go->next, b++) {
- Mat4MulMat4(tmat, obmatlist[b], pamat);
+ Mat4MulMat4(tmat, obmat, pamat);
Mat4MulFloat3((float *)tmat, size*scale);
if(par_space_mat)
Mat4MulMat4(mat, tmat, par_space_mat);
}
if(oblist)
MEM_freeN(oblist);
- if(obmatlist)
- MEM_freeN(obmatlist);
if(psys->lattice) {
end_latt_deform();
dag_add_relation(dag,node2,node,DAG_RL_DATA_DATA|DAG_RL_OB_DATA, "Texture On Curve");
}
}
- else if(ob->type==OB_MESH) {
- PartEff *paf= give_parteff(ob);
- if(paf) {
- ListBase *listb;
- pEffectorCache *ec;
-
- /* ob location depends on itself */
- if((paf->flag & PAF_STATIC)==0)
- dag_add_relation(dag, node, node, DAG_RL_OB_DATA, "Particle-Object Relation");
-
- listb= pdInitEffectors(ob, paf->group); /* note, makes copy... */
- if(listb) {
- for(ec= listb->first; ec; ec= ec->next) {
- Object *ob1= ec->ob;
- PartDeflect *pd= ob1->pd;
-
- if(pd->forcefield) {
- node2 = dag_get_node(dag, ob1);
- if(pd->forcefield==PFIELD_GUIDE)
- dag_add_relation(dag, node2, node, DAG_RL_DATA_DATA|DAG_RL_OB_DATA, "Particle Field");
- else
- dag_add_relation(dag, node2, node, DAG_RL_OB_DATA, "Particle Field");
- }
- }
-
- pdEndEffectors(listb); /* restores copy... */
- }
- }
- }
-
+
psys= ob->particlesystem.first;
if(psys) {
ParticleEffectorCache *nec;
ob->shapeflag &= ~OB_SHAPE_TEMPLOCK;
}
}
- else if(ob->effect.first) {
- Effect *eff= ob->effect.first;
- PartEff *paf= give_parteff(ob);
-
- if(eff->type==EFF_WAVE)
- ob->recalc |= OB_RECALC_DATA;
- else if(paf && paf->keys==NULL)
- ob->recalc |= OB_RECALC_DATA;
- }
if((ob->fluidsimFlag & OB_FLUIDSIM_ENABLE) && (ob->fluidsimSettings)) {
// fluidsimSettings might not be initialized during load...
if(ob->fluidsimSettings->type & (OB_FLUIDSIM_DOMAIN|OB_FLUIDSIM_PARTICLE)) {
float co[3], no[3];
} VeNoCo;
-Effect *add_effect(int type)
+/* ***************** PARTICLES ***************** */
+
+/* deprecated, only keep this for readfile.c */
+PartEff *give_parteff(Object *ob)
{
- Effect *eff=0;
PartEff *paf;
- int a;
- switch(type) {
- case EFF_PARTICLE:
- paf= MEM_callocN(sizeof(PartEff), "neweff");
- eff= (Effect *)paf;
-
- paf->sta= 1.0;
- paf->end= 100.0;
- paf->lifetime= 50.0;
- for(a=0; a<PAF_MAXMULT; a++) {
- paf->life[a]= 50.0;
- paf->child[a]= 4;
- paf->mat[a]= 1;
- }
-
- paf->totpart= 1000;
- paf->totkey= 8;
- paf->staticstep= 5;
- paf->defvec[2]= 1.0f;
- paf->nabla= 0.05f;
- paf->disp = 100;
- paf->speedtex = 8;
- paf->omat = 1;
- paf->flag= PAF_FACE;
-
- break;
+ paf= ob->effect.first;
+ while(paf) {
+ if(paf->type==EFF_PARTICLE) return paf;
+ paf= paf->next;
}
-
- eff->type= eff->buttype= type;
- eff->flag |= SELECT;
-
- return eff;
+ return 0;
}
void free_effect(Effect *eff)
}
}
-Effect *copy_effect(Effect *eff)
-{
- Effect *effn;
-
- effn= MEM_dupallocN(eff);
- if(effn->type==EFF_PARTICLE) ((PartEff *)effn)->keys= 0;
-
- return effn;
-}
-
-void copy_act_effect(Object *ob)
-{
- /* return a copy of the active effect */
- Effect *effn, *eff;
-
- eff= ob->effect.first;
- while(eff) {
- if(eff->flag & SELECT) {
-
- effn= copy_effect(eff);
- BLI_addtail(&ob->effect, effn);
-
- eff->flag &= ~SELECT;
- return;
-
- }
- eff= eff->next;
- }
-
- /* when it comes here: add new effect */
- eff= add_effect(EFF_PARTICLE);
- BLI_addtail(&ob->effect, eff);
-
-}
-
-void copy_effects(ListBase *lbn, ListBase *lb)
-{
- Effect *eff, *effn;
-
- lbn->first= lbn->last= 0;
-
- eff= lb->first;
- while(eff) {
- effn= copy_effect(eff);
- BLI_addtail(lbn, effn);
-
- eff= eff->next;
- }
-
-}
-
-void deselectall_eff(Object *ob)
-{
- Effect *eff= ob->effect.first;
-
- while(eff) {
- eff->flag &= ~SELECT;
- eff= eff->next;
- }
-}
-
-/* ***************** PARTICLES ***************** */
-
-static Particle *new_particle(PartEff *paf)
-{
- static Particle *pa;
- static int cur;
-
- /* we agree: when paf->keys==0: alloc */
- if(paf->keys==NULL) {
- pa= paf->keys= MEM_callocN( paf->totkey*paf->totpart*sizeof(Particle), "particlekeys" );
- cur= 0;
- }
- else {
- if(cur && cur<paf->totpart) pa+=paf->totkey;
- cur++;
- }
- return pa;
-}
-
-PartEff *give_parteff(Object *ob)
-{
- PartEff *paf;
-
- paf= ob->effect.first;
- while(paf) {
- if(paf->type==EFF_PARTICLE) return paf;
- paf= paf->next;
- }
- return 0;
-}
-
-void where_is_particle(PartEff *paf, Particle *pa, float ctime, float *vec)
-{
- Particle *p[4];
- float dt, t[4];
- int a;
-
- if(paf->totkey==1 || ctime < pa->time) {
- VECCOPY(vec, pa->co);
- return;
- }
-
- /* first find the first particlekey */
- a= (int)((paf->totkey-1)*(ctime-pa->time)/pa->lifetime);
- if(a>=paf->totkey) a= paf->totkey-1;
- else if(a<0) a= 0;
-
- pa+= a;
-
- if(a>0) p[0]= pa-1; else p[0]= pa;
- p[1]= pa;
-
- if(a+1<paf->totkey) p[2]= pa+1; else p[2]= pa;
- if(a+2<paf->totkey) p[3]= pa+2; else p[3]= p[2];
-
- if(p[1]==p[2] || p[2]->time == p[1]->time) dt= 0.0;
- else dt= (ctime-p[1]->time)/(p[2]->time - p[1]->time);
-
- if(paf->flag & PAF_BSPLINE) set_four_ipo(dt, t, KEY_BSPLINE);
- else set_four_ipo(dt, t, KEY_CARDINAL);
-
- vec[0]= t[0]*p[0]->co[0] + t[1]*p[1]->co[0] + t[2]*p[2]->co[0] + t[3]*p[3]->co[0];
- vec[1]= t[0]*p[0]->co[1] + t[1]*p[1]->co[1] + t[2]*p[2]->co[1] + t[3]*p[3]->co[1];
- vec[2]= t[0]*p[0]->co[2] + t[1]*p[1]->co[2] + t[2]*p[2]->co[2] + t[3]*p[3]->co[2];
-
-}
-
-static void particle_tex(MTex *mtex, PartEff *paf, float *co, float *no)
-{
- float tin, tr, tg, tb, ta;
- float old;
-
- externtex(mtex, co, &tin, &tr, &tg, &tb, &ta);
-
- if(paf->texmap==PAF_TEXINT) {
- tin*= paf->texfac;
- no[0]+= tin*paf->defvec[0];
- no[1]+= tin*paf->defvec[1];
- no[2]+= tin*paf->defvec[2];
- }
- else if(paf->texmap==PAF_TEXRGB) {
- no[0]+= (tr-0.5f)*paf->texfac;
- no[1]+= (tg-0.5f)*paf->texfac;
- no[2]+= (tb-0.5f)*paf->texfac;
- }
- else { /* PAF_TEXGRAD */
-
- old= tin;
- co[0]+= paf->nabla;
- externtex(mtex, co, &tin, &tr, &tg, &tb, &ta);
- no[0]+= (old-tin)*paf->texfac;
-
- co[0]-= paf->nabla;
- co[1]+= paf->nabla;
- externtex(mtex, co, &tin, &tr, &tg, &tb, &ta);
- no[1]+= (old-tin)*paf->texfac;
-
- co[1]-= paf->nabla;
- co[2]+= paf->nabla;
- externtex(mtex, co, &tin, &tr, &tg, &tb, &ta);
- no[2]+= (old-tin)*paf->texfac;
-
- }
-}
-
/* -------------------------- Effectors ------------------ */
static void add_to_effectorcache(ListBase *lb, Object *ob, Object *obsrc)
}
}
-/* local for this c file, only for guides now */
-static void precalc_effectors(Object *ob, PartEff *paf, Particle *pa, ListBase *lb)
-{
- pEffectorCache *ec;
-
- for(ec= lb->first; ec; ec= ec->next) {
- PartDeflect *pd= ec->ob->pd;
-
- ec->oldspeed[0]= ec->oldspeed[1]= ec->oldspeed[2]= 0.0f;
-
- if(pd->forcefield==PFIELD_GUIDE && ec->ob->type==OB_CURVE) {
- float vec[4], dir[3];
-
- if(!(paf->flag & PAF_STATIC))
- where_is_object_time(ec->ob, pa->time);
-
- /* scale corrects speed vector to curve size */
- if(paf->totkey>1) ec->scale= (paf->totkey-1)/pa->lifetime;
- else ec->scale= 1.0f;
-
- /* time_scale is for random life */
- if(pa->lifetime>paf->lifetime)
- ec->time_scale= paf->lifetime/pa->lifetime;
- else
- ec->time_scale= pa->lifetime/paf->lifetime;
-
- /* distance of first path point to particle origin */
- where_on_path(ec->ob, 0.0f, vec, dir);
- VECCOPY(ec->oldloc, vec); /* store local coord for differences */
- Mat4MulVecfl(ec->ob->obmat, vec);
-
- /* for static we need to move to global space */
- if(paf->flag & PAF_STATIC) {
- VECCOPY(dir, pa->co);
- Mat4MulVecfl(ob->obmat, dir);
- ec->guide_dist= VecLenf(vec, dir);
- }
- else
- ec->guide_dist= VecLenf(vec, pa->co);
- }
- }
-}
-
/* -------- pdDoEffectors() --------
generic force/speed system, now used for particles and softbodies
}
}
-static void cache_object_vertices(Object *ob)
-{
- Mesh *me;
- MVert *mvert;
- float *fp;
- int a;
-
- me= ob->data;
- if(me->totvert==0) return;
-
- fp= ob->sumohandle= MEM_mallocN(3*sizeof(float)*me->totvert, "cache particles");
- mvert= me->mvert;
- a= me->totvert;
- while(a--) {
- VECCOPY(fp, mvert->co);
- Mat4MulVecfl(ob->obmat, fp);
- mvert++;
- fp+= 3;
- }
-}
-
-static int pdDoDeflection(RNG *rng, float opco[3], float npco[3], float opno[3],
- float npno[3], float life, float force[3], int def_depth,
- float cur_time, unsigned int par_layer, int *last_object,
- int *last_face, int *same_face)
-{
- /* Particle deflection code */
- /* The code is in two sections: the first part checks whether a particle has */
- /* intersected a face of a deflector mesh, given its old and new co-ords, opco and npco */
- /* and which face it hit first */
- /* The second part calculates the new co-ordinates given that collision and updates */
- /* the new co-ordinates accordingly */
- Base *base;
- Object *ob, *deflection_object = NULL;
- Mesh *def_mesh;
- MFace *mface, *deflection_face = NULL;
- float *v1, *v2, *v3, *v4, *vcache=NULL;
- float nv1[3], nv2[3], nv3[3], nv4[3], edge1[3], edge2[3];
- float dv1[3] = {0}, dv2[3] = {0}, dv3[3] = {0};
- float vect_to_int[3], refl_vel[3];
- float d_intersect_co[3], d_intersect_vect[3], d_nvect[3], d_i_co_above[3];
- float forcec[3];
- float k_point3, dist_to_plane;
- float first_dist, ref_plane_mag;
- float dk_plane=0, dk_point1=0;
- float icalctop, icalcbot, n_mag;
- float mag_iv, x_m,y_m,z_m;
- float damping, perm_thresh;
- float perm_val, rdamp_val;
- int a, deflected=0, deflected_now=0;
- float t,t2, min_t;
- float mat[3][3], obloc[3] = {0};
- int cur_frame;
- float time_before, time_after;
- float force_mag_norm;
- int d_object=0, d_face=0, ds_object=0, ds_face=0;
-
- first_dist = 200000;
- min_t = 200000;
-
- /* The first part of the code, finding the first intersected face*/
- base= G.scene->base.first;
- while (base) {
- /*Only proceed for mesh object in same layer */
- if(base->object->type==OB_MESH && (base->lay & par_layer)) {
- ob= base->object;
- /* only with deflecting set */
- if(ob->pd && ob->pd->deflect) {
- def_mesh= ob->data;
-
- d_object = d_object + 1;
-
- d_face = d_face + 1;
- mface= def_mesh->mface;
- a = def_mesh->totface;
-
-
- if(ob->parent==NULL && ob->ipo==NULL) { // static
- if(ob->sumohandle==NULL) cache_object_vertices(ob);
- vcache= ob->sumohandle;
- }
- else {
- /*Find out where the object is at this time*/
- cur_frame = G.scene->r.cfra;
- G.scene->r.cfra = (int)cur_time;
- where_is_object_time(ob, cur_time);
- G.scene->r.cfra = cur_frame;
-
- /*Pass the values from ob->obmat to mat*/
- /*and the location values to obloc */
- Mat3CpyMat4(mat,ob->obmat);
- obloc[0] = ob->obmat[3][0];
- obloc[1] = ob->obmat[3][1];
- obloc[2] = ob->obmat[3][2];
- vcache= NULL;
-
- }
-
- while (a--) {
-
- if(vcache) {
- v1= vcache+ 3*(mface->v1);
- VECCOPY(nv1, v1);
- v1= vcache+ 3*(mface->v2);
- VECCOPY(nv2, v1);
- v1= vcache+ 3*(mface->v3);
- VECCOPY(nv3, v1);
- v1= vcache+ 3*(mface->v4);
- VECCOPY(nv4, v1);
- }
- else {
- /* Calculate the global co-ordinates of the vertices*/
- v1= (def_mesh->mvert+(mface->v1))->co;
- v2= (def_mesh->mvert+(mface->v2))->co;
- v3= (def_mesh->mvert+(mface->v3))->co;
- v4= (def_mesh->mvert+(mface->v4))->co;
-
- VECCOPY(nv1, v1);
- VECCOPY(nv2, v2);
- VECCOPY(nv3, v3);
- VECCOPY(nv4, v4);
-
- /*Apply the objects deformation matrix*/
- Mat3MulVecfl(mat, nv1);
- Mat3MulVecfl(mat, nv2);
- Mat3MulVecfl(mat, nv3);
- Mat3MulVecfl(mat, nv4);
-
- VECADD(nv1, nv1, obloc);
- VECADD(nv2, nv2, obloc);
- VECADD(nv3, nv3, obloc);
- VECADD(nv4, nv4, obloc);
- }
-
- deflected_now = 0;
-
-
-
-// t= 0.5; // this is labda of line, can use it optimize quad intersection
-// sorry but no .. see below (BM)
- if( LineIntersectsTriangle(opco, npco, nv1, nv2, nv3, &t, NULL) ) {
- if (t < min_t) {
- deflected = 1;
- deflected_now = 1;
- }
- }
-// else if (mface->v4 && (t>=0.0 && t<=1.0)) {
-// no, you can't skip testing the other triangle
-// it might give a smaller t on (close to) the edge .. this is numerics not esoteric maths :)
-// note: the 2 triangles don't need to share a plane ! (BM)
- if (mface->v4) {
- if( LineIntersectsTriangle(opco, npco, nv1, nv3, nv4, &t2, NULL) ) {
- if (t2 < min_t) {
- deflected = 1;
- deflected_now = 2;
- }
- }
- }
-
- if ((deflected_now > 0) && ((t < min_t) ||(t2 < min_t))) {
- min_t = t;
- ds_object = d_object;
- ds_face = d_face;
- deflection_object = ob;
- deflection_face = mface;
- if (deflected_now==1) {
- min_t = t;
- VECCOPY(dv1, nv1);
- VECCOPY(dv2, nv2);
- VECCOPY(dv3, nv3);
- }
- else {
- min_t = t2;
- VECCOPY(dv1, nv1);
- VECCOPY(dv2, nv3);
- VECCOPY(dv3, nv4);
- }
- }
- mface++;
- }
- }
- }
- base = base->next;
- }
-
-
- /* Here's the point to do the permeability calculation */
- /* Set deflected to 0 if a random number is below the value */
- /* Get the permeability IPO here*/
- if (deflected) {
-
- if (has_ipo_code(deflection_object->ipo, OB_PD_PERM))
- perm_val = IPO_GetFloatValue(deflection_object->ipo, OB_PD_PERM, cur_time);
- else
- perm_val = deflection_object->pd->pdef_perm;
-
- perm_thresh = rng_getFloat(rng) - perm_val;
- if (perm_thresh < 0 ) {
- deflected = 0;
- }
- }
-
- /* Now for the second part of the deflection code - work out the new speed */
- /* and position of the particle if a collision occurred */
- if (deflected) {
- VECSUB(edge1, dv1, dv2);
- VECSUB(edge2, dv3, dv2);
- Crossf(d_nvect, edge2, edge1);
- n_mag = Normalize(d_nvect);
- dk_plane = INPR(d_nvect, nv1);
- dk_point1 = INPR(d_nvect,opco);
-
- VECSUB(d_intersect_vect, npco, opco);
-
- d_intersect_co[0] = opco[0] + (min_t * (npco[0] - opco[0]));
- d_intersect_co[1] = opco[1] + (min_t * (npco[1] - opco[1]));
- d_intersect_co[2] = opco[2] + (min_t * (npco[2] - opco[2]));
-
- d_i_co_above[0] = (d_intersect_co[0] + (0.001f * d_nvect[0]));
- d_i_co_above[1] = (d_intersect_co[1] + (0.001f * d_nvect[1]));
- d_i_co_above[2] = (d_intersect_co[2] + (0.001f * d_nvect[2]));
- mag_iv = Normalize(d_intersect_vect);
- VECCOPY(npco, d_intersect_co);
-
- VECSUB(vect_to_int, opco, d_intersect_co);
- first_dist = Normalize(vect_to_int);
-
- /* Work out the lengths of time before and after collision*/
- time_before = (life*(first_dist / (mag_iv)));
- time_after = (life*((mag_iv - first_dist) / (mag_iv)));
-
- /* We have to recalculate what the speed would have been at the */
- /* point of collision, not the key frame time */
- npno[0]= opno[0] + time_before*force[0];
- npno[1]= opno[1] + time_before*force[1];
- npno[2]= opno[2] + time_before*force[2];
-
-
- /* Reflect the speed vector in the face */
- x_m = (2 * npno[0] * d_nvect[0]);
- y_m = (2 * npno[1] * d_nvect[1]);
- z_m = (2 * npno[2] * d_nvect[2]);
- refl_vel[0] = npno[0] - (d_nvect[0] * (x_m + y_m + z_m));
- refl_vel[1] = npno[1] - (d_nvect[1] * (x_m + y_m + z_m));
- refl_vel[2] = npno[2] - (d_nvect[2] * (x_m + y_m + z_m));
-
- /*A random variation in the damping factor........ */
- /*Get the IPO values for damping here*/
-
- if (has_ipo_code(deflection_object->ipo, OB_PD_SDAMP))
- damping = IPO_GetFloatValue(deflection_object->ipo, OB_PD_SDAMP, cur_time);
- else
- damping = deflection_object->pd->pdef_damp;
-
- if (has_ipo_code(deflection_object->ipo, OB_PD_RDAMP))
- rdamp_val = IPO_GetFloatValue(deflection_object->ipo, OB_PD_RDAMP, cur_time);
- else
- rdamp_val = deflection_object->pd->pdef_rdamp;
-
- damping = damping + ((1.0f - damping) * rng_getFloat(rng) *rdamp_val);
- damping = damping * damping;
- ref_plane_mag = INPR(refl_vel,d_nvect);
-
- if (damping > 0.999) damping = 0.999f;
-
- /* Now add in the damping force - only damp in the direction of */
- /* the faces normal vector */
- npno[0] = (refl_vel[0] - (d_nvect[0] * ref_plane_mag * damping));
- npno[1] = (refl_vel[1] - (d_nvect[1] * ref_plane_mag * damping));
- npno[2] = (refl_vel[2] - (d_nvect[2] * ref_plane_mag * damping));
-
- /* Now reset opno */
- VECCOPY(opno,npno);
- VECCOPY(forcec, force);
-
- /* If the particle has bounced more than four times on the same */
- /* face within this cycle (depth > 4, same face > 4 ) */
- /* Then set the force to be only that component of the force */
- /* in the same direction as the face normal */
- /* i.e. subtract the component of the force in the direction */
- /* of the face normal from the actual force */
- if ((ds_object == *last_object) && (ds_face == *last_face)) {
- /* Increment same_face */
- *same_face = *same_face + 1;
- if ((*same_face > 3) && (def_depth > 3)) {
- force_mag_norm = INPR(forcec, d_nvect);
- forcec[0] = forcec[0] - (d_nvect[0] * force_mag_norm);
- forcec[1] = forcec[1] - (d_nvect[1] * force_mag_norm);
- forcec[2] = forcec[2] - (d_nvect[2] * force_mag_norm);
- }
- }
- else *same_face = 1;
-
- *last_object = ds_object;
- *last_face = ds_face;
-
- /* We have the particles speed at the point of collision */
- /* Now we want the particles speed at the current key frame */
-
- npno[0]= npno[0] + time_after*forcec[0];
- npno[1]= npno[1] + time_after*forcec[1];
- npno[2]= npno[2] + time_after*forcec[2];
-
- /* Now we have to recalculate pa->co for the remainder*/
- /* of the time since the intersect*/
- npco[0]= npco[0] + time_after*npno[0];
- npco[1]= npco[1] + time_after*npno[1];
- npco[2]= npco[2] + time_after*npno[2];
-
- /* And set the old co-ordinates back to the point just above the intersection */
- VECCOPY(opco, d_i_co_above);
-
- /* Finally update the time */
- life = time_after;
- cur_time += time_before;
-
- /* The particle may have fallen through the face again by now!!*/
- /* So check if the particle has changed sides of the plane compared*/
- /* the co-ordinates at the last keyframe*/
- /* But only do this as a last resort, if we've got to the end of the */
- /* number of collisions allowed */
- if (def_depth==9) {
- k_point3 = INPR(d_nvect,npco);
- if (((dk_plane > k_point3) && (dk_plane < dk_point1))||((dk_plane < k_point3) && (dk_plane > dk_point1))) {
-
- /* Yup, the pesky particle may have fallen through a hole!!! */
- /* So we'll cheat a bit and move the particle along the normal vector */
- /* until it's just the other side of the plane */
- icalctop = (dk_plane - d_nvect[0]*npco[0] - d_nvect[1]*npco[1] - d_nvect[2]*npco[2]);
- icalcbot = (d_nvect[0]*d_nvect[0] + d_nvect[1]*d_nvect[1] + d_nvect[2]*d_nvect[2]);
- dist_to_plane = icalctop / icalcbot;
-
- /* Now just increase the distance a little to place */
- /* the point the other side of the plane */
- dist_to_plane *= 1.1f;
- npco[0]= npco[0] + (dist_to_plane * d_nvect[0]);
- npco[1]= npco[1] + (dist_to_plane * d_nvect[1]);
- npco[2]= npco[2] + (dist_to_plane * d_nvect[2]);
-
- }
- }
- }
- return deflected;
-}
-
-/*
- rng= random number generator
- ob = object that spawns the particles
- depth = for fireworks
- nr = index nr of current particle
- paf = the particle system
- part = current particle
- force = force vector
- deform = flag to indicate lattice deform
- */
-static void make_particle_keys(RNG *rng, Object *ob, int depth, int nr, PartEff *paf, Particle *part, float *force, int deform, MTex *mtex, ListBase *effectorbase)
-{
- Particle *pa, *opa = NULL;
- float damp, deltalife, life;
- float cur_time, maxspeed= paf->maxlen/(float)paf->totkey;
- float opco[3], opno[3], npco[3], npno[3], new_force[3], new_speed[3];
- int b, rt1, rt2, deflected, deflection, finish_defs, def_count;
- int last_ob, last_fc, same_fc;
-
- damp= 1.0f-paf->damp;
- pa= part;
-
- /* start speed: random */
- if(paf->randfac!=0.0) {
- pa->no[0]+= paf->randfac*(rng_getFloat(rng) - 0.5f);
- pa->no[1]+= paf->randfac*(rng_getFloat(rng) - 0.5f);
- pa->no[2]+= paf->randfac*(rng_getFloat(rng) - 0.5f);
- }
-
- /* start speed: texture */
- if(mtex && paf->texfac!=0.0) {
- particle_tex(mtex, paf, pa->co, pa->no);
- }
-
- /* effectors here? */
- if(effectorbase)
- precalc_effectors(ob, paf, pa, effectorbase);
-
- if(paf->totkey>1) deltalife= pa->lifetime/(paf->totkey-1);
- else deltalife= pa->lifetime;
-
- /* longer lifetime results in longer distance covered */
- VecMulf(pa->no, deltalife);
-
- opa= pa;
- pa++;
-
- for(b=1; b<paf->totkey; b++) {
-
- /* new time */
- pa->time= opa->time+deltalife;
- cur_time = pa->time;
-
- /* set initial variables */
- VECCOPY(opco, opa->co);
- VECCOPY(new_force, force);
- VECCOPY(new_speed, opa->no);
- VecMulf(new_speed, 1.0f/deltalife);
- //new_speed[0] = new_speed[1] = new_speed[2] = 0.0f;
-
- /* handle differences between static (local coords, fixed frame) and dynamic */
- if(effectorbase) {
- float loc_time= ((float)b)/(float)(paf->totkey-1);
-
- if(paf->flag & PAF_STATIC) {
- float opco1[3], new_force1[3];
-
- /* move co and force to global coords */
- VECCOPY(opco1, opco);
- Mat4MulVecfl(ob->obmat, opco1);
- VECCOPY(new_force1, new_force);
- Mat4Mul3Vecfl(ob->obmat, new_force1);
- Mat4Mul3Vecfl(ob->obmat, new_speed);
-
- cur_time = G.scene->r.cfra;
-
- /* force fields */
- pdDoEffectors(effectorbase, opco1, new_force1, new_speed, cur_time, loc_time, 0);
-
- /* move co, force and newspeed back to local */
- VECCOPY(opco, opco1);
- Mat4MulVecfl(ob->imat, opco);
- VECCOPY(new_force, new_force1);
- Mat4Mul3Vecfl(ob->imat, new_force);
- Mat4Mul3Vecfl(ob->imat, new_speed);
- }
- else {
- /* force fields */
- pdDoEffectors(effectorbase, opco, new_force, new_speed, cur_time, loc_time, 0);
- }
- }
-
- /* new speed */
- pa->no[0]= deltalife * (new_speed[0] + new_force[0]);
- pa->no[1]= deltalife * (new_speed[1] + new_force[1]);
- pa->no[2]= deltalife * (new_speed[2] + new_force[2]);
-
- /* speed limitor */
- if((paf->flag & PAF_STATIC) && maxspeed!=0.0f) {
- float len= VecLength(pa->no);
- if(len > maxspeed)
- VecMulf(pa->no, maxspeed/len);
- }
-
- /* new location */
- pa->co[0]= opa->co[0] + pa->no[0];
- pa->co[1]= opa->co[1] + pa->no[1];
- pa->co[2]= opa->co[2] + pa->no[2];
-
- /* Particle deflection code */
- if((paf->flag & PAF_STATIC)==0) {
- deflection = 0;
- finish_defs = 1;
- def_count = 0;
-
- VECCOPY(opno, opa->no);
- VECCOPY(npco, pa->co);
- VECCOPY(npno, pa->no);
-
- life = deltalife;
- cur_time -= deltalife;
-
- last_ob = -1;
- last_fc = -1;
- same_fc = 0;
-
- /* First call the particle deflection check for the particle moving */
- /* between the old co-ordinates and the new co-ordinates */
- /* If a deflection occurs, call the code again, this time between the */
- /* intersection point and the updated new co-ordinates */
- /* Bail out if we've done the calculation 10 times - this seems ok */
- /* for most scenes I've tested */
- while (finish_defs) {
- deflected = pdDoDeflection(rng, opco, npco, opno, npno, life, new_force,
- def_count, cur_time, ob->lay,
- &last_ob, &last_fc, &same_fc);
- if (deflected) {
- def_count = def_count + 1;
- deflection = 1;
- if (def_count==10) finish_defs = 0;
- }
- else {
- finish_defs = 0;
- }
- }
-
- /* Only update the particle positions and speed if we had a deflection */
- if (deflection) {
- pa->co[0] = npco[0];
- pa->co[1] = npco[1];
- pa->co[2] = npco[2];
- pa->no[0] = npno[0];
- pa->no[1] = npno[1];
- pa->no[2] = npno[2];
- }
- }
-
- /* speed: texture */
- if(mtex && paf->texfac!=0.0) {
- particle_tex(mtex, paf, pa->co, pa->no);
- }
- if(damp!=1.0) {
- pa->no[0]*= damp;
- pa->no[1]*= damp;
- pa->no[2]*= damp;
- }
-
- opa= pa;
- pa++;
- /* opa is used later on too! */
- }
-
- if(deform) {
- /* deform all keys */
- pa= part;
- b= paf->totkey;
- while(b--) {
- calc_latt_deform(pa->co, 1.0f);
- pa++;
- }
- }
-
- /* the big multiplication */
- if(depth<PAF_MAXMULT && paf->mult[depth]!=0.0) {
-
- /* new 'child' emerges from an average 'mult' part from
- the particles */
- damp = (float)nr;
- rt1= (int)(damp*paf->mult[depth]);
- rt2= (int)((damp+1.0)*paf->mult[depth]);
- if(rt1!=rt2) {
-
- for(b=0; b<paf->child[depth]; b++) {
- pa= new_particle(paf);
- *pa= *opa;
- pa->lifetime= paf->life[depth];
- if(paf->randlife!=0.0) {
- pa->lifetime*= 1.0f + paf->randlife*(rng_getFloat(rng) - 0.5f);
- }
- pa->mat_nr= paf->mat[depth];
-
- make_particle_keys(rng, ob, depth+1, b, paf, pa, force, deform, mtex, effectorbase);
- }
- }
- }
-}
-
-static void init_mv_jit(float *jit, int num, int seed2)
-{
- RNG *rng;
- float *jit2, x, rad1, rad2, rad3;
- int i, num2;
-
- if(num==0) return;
-
- rad1= (float)(1.0/sqrt((float)num));
- rad2= (float)(1.0/((float)num));
- rad3= (float)sqrt((float)num)/((float)num);
-
- rng = rng_new(31415926 + num + seed2);
- x= 0;
- num2 = 2 * num;
- for(i=0; i<num2; i+=2) {
-
- jit[i]= x + rad1*(0.5f - rng_getFloat(rng));
- jit[i+1]= i/(2.0f*num) + rad1*(0.5f - rng_getFloat(rng));
-
- jit[i]-= (float)floor(jit[i]);
- jit[i+1]-= (float)floor(jit[i+1]);
-
- x+= rad3;
- x -= (float)floor(x);
- }
-
- jit2= MEM_mallocN(12 + 2*sizeof(float)*num, "initjit");
-
- for (i=0 ; i<4 ; i++) {
- BLI_jitterate1(jit, jit2, num, rad1);
- BLI_jitterate1(jit, jit2, num, rad1);
- BLI_jitterate2(jit, jit2, num, rad2);
- }
- MEM_freeN(jit2);
- rng_free(rng);
-}
-
-#define JIT_RAND 32
-
-/* for a position within a face, tot is total amount of faces */
-static void give_mesh_particle_coord(PartEff *paf, VeNoCo *noco, MFace *mface, int partnr, int subnr, float *co, float *no)
-{
- static float *jit= NULL;
- static float *trands= NULL;
- static int jitlevel= 1;
- float *v1, *v2, *v3, *v4;
- float u, v;
- float *n1, *n2, *n3, *n4;
-
- /* free signal */
- if(paf==NULL) {
- if(jit) MEM_freeN(jit);
- jit= NULL;
- if(trands) MEM_freeN(trands);
- trands= NULL;
- return;
- }
-
- /* first time initialize jitter or trand, partnr then is total amount of particles, subnr total amount of faces */
- if(trands==NULL && jit==NULL) {
- RNG *rng = rng_new(31415926 + paf->seed);
- int i, tot;
-
- if(paf->flag & PAF_TRAND)
- tot= partnr;
- else
- tot= JIT_RAND; /* arbitrary... allows JIT_RAND times more particles in a face for jittered distro */
-
- trands= MEM_callocN(2+2*tot*sizeof(float), "trands");
- for(i=0; i<tot; i++) {
- trands[2*i]= rng_getFloat(rng);
- trands[2*i+1]= rng_getFloat(rng);
- }
- rng_free(rng);
-
- if((paf->flag & PAF_TRAND)==0) {
- jitlevel= paf->userjit;
-
- if(jitlevel == 0) {
- jitlevel= partnr/subnr;
- if(paf->flag & PAF_EDISTR) jitlevel*= 2; /* looks better in general, not very scietific */
- if(jitlevel<3) jitlevel= 3;
- if(jitlevel>100) jitlevel= 100;
- }
-
- jit= MEM_callocN(2+ jitlevel*2*sizeof(float), "jit");
- init_mv_jit(jit, jitlevel, paf->seed);
- BLI_array_randomize(jit, 2*sizeof(float), jitlevel, paf->seed); /* for custom jit or even distribution */
- }
- return;
- }
-
- if(paf->flag & PAF_TRAND) {
- u= trands[2*partnr];
- v= trands[2*partnr+1];
- }
- else {
- /* jittered distribution gets fixed random offset */
- if(subnr>=jitlevel) {
- int jitrand= (subnr/jitlevel) % JIT_RAND;
-
- subnr %= jitlevel;
- u= jit[2*subnr] + trands[2*jitrand];
- v= jit[2*subnr+1] + trands[2*jitrand+1];
- if(u > 1.0f) u-= 1.0f;
- if(v > 1.0f) v-= 1.0f;
- }
- else {
- u= jit[2*subnr];
- v= jit[2*subnr+1];
- }
- }
-
- v1= (noco+(mface->v1))->co;
- v2= (noco+(mface->v2))->co;
- v3= (noco+(mface->v3))->co;
- n1= (noco+(mface->v1))->no;
- n2= (noco+(mface->v2))->no;
- n3= (noco+(mface->v3))->no;
-
- if(mface->v4) {
- float uv= u*v;
- float muv= (1.0f-u)*(v);
- float umv= (u)*(1.0f-v);
- float mumv= (1.0f-u)*(1.0f-v);
-
- v4= (noco+(mface->v4))->co;
- n4= (noco+(mface->v4))->no;
-
- co[0]= mumv*v1[0] + muv*v2[0] + uv*v3[0] + umv*v4[0];
- co[1]= mumv*v1[1] + muv*v2[1] + uv*v3[1] + umv*v4[1];
- co[2]= mumv*v1[2] + muv*v2[2] + uv*v3[2] + umv*v4[2];
-
- no[0]= mumv*n1[0] + muv*n2[0] + uv*n3[0] + umv*n4[0];
- no[1]= mumv*n1[1] + muv*n2[1] + uv*n3[1] + umv*n4[1];
- no[2]= mumv*n1[2] + muv*n2[2] + uv*n3[2] + umv*n4[2];
- }
- else {
- /* mirror triangle uv coordinates when on other side */
- if(u + v > 1.0f) {
- u= 1.0f-u;
- v= 1.0f-v;
- }
- co[0]= v1[0] + u*(v3[0]-v1[0]) + v*(v2[0]-v1[0]);
- co[1]= v1[1] + u*(v3[1]-v1[1]) + v*(v2[1]-v1[1]);
- co[2]= v1[2] + u*(v3[2]-v1[2]) + v*(v2[2]-v1[2]);
-
- no[0]= n1[0] + u*(n3[0]-n1[0]) + v*(n2[0]-n1[0]);
- no[1]= n1[1] + u*(n3[1]-n1[1]) + v*(n2[1]-n1[1]);
- no[2]= n1[2] + u*(n3[2]-n1[2]) + v*(n2[2]-n1[2]);
- }
-}
-
-
-/* Gets a MDeformVert's weight in group (0 if not in group) */
-/* note; this call could be in mesh.c or deform.c, but OK... it's in armature.c too! (ton) */
-static float vert_weight(MDeformVert *dvert, int group)
-{
- MDeformWeight *dw;
- int i;
-
- if(dvert) {
- dw= dvert->dw;
- for(i= dvert->totweight; i>0; i--, dw++) {
- if(dw->def_nr == group) return dw->weight;
- if(i==1) break; /*otherwise dw will point to somewhere it shouldn't*/
- }
- }
- return 0.0;
-}
-
-/* Gets a faces average weight in a group, helper for below, face and weights are always set */
-static float face_weight(MFace *face, float *weights)
-{
- float tweight;
-
- tweight = weights[face->v1] + weights[face->v2] + weights[face->v3];
-
- if(face->v4) {
- tweight += weights[face->v4];
- tweight /= 4.0;
- }
- else {
- tweight /= 3.0;
- }
-
- return tweight;
-}
-
-/* helper function for build_particle_system() */
-static void make_weight_tables(PartEff *paf, Mesh *me, int totpart, VeNoCo *vertlist, int totvert, MFace *facelist, int totface, float **vweights, float **fweights)
-{
- MFace *mface;
- float *foweights=NULL, *voweights=NULL;
- float totvweight=0.0f, totfweight=0.0f;
- int a;
-
- if((paf->flag & PAF_FACE)==0) totface= 0;
-
- /* collect emitting vertices & faces if vert groups used */
- if(paf->vertgroup && me->dvert) {
-
- /* allocate weights array for all vertices, also for lookup of faces later on. note it's a malloc */
- *vweights= voweights= MEM_mallocN( totvert*sizeof(float), "pafvoweights" );
- totvweight= 0.0f;
- for(a=0; a<totvert; a++) {
- voweights[a]= vert_weight(me->dvert+a, paf->vertgroup-1);
- totvweight+= voweights[a];
- }
-
- if(totface) {
- /* allocate weights array for faces, note it's a malloc */
- *fweights= foweights= MEM_mallocN(totface*sizeof(float), "paffoweights" );
- for(a=0, mface=facelist; a<totface; a++, mface++) {
- foweights[a] = face_weight(mface, voweights);
- }
- }
- }
-
- /* make weights for faces or for even area distribution */
- if(totface && (paf->flag & PAF_EDISTR)) {
- float maxfarea= 0.0f, curfarea;
-
- /* two cases for area distro, second case we already have group weights */
- if(foweights==NULL) {
- /* allocate weights array for faces, note it's a malloc */
- *fweights= foweights= MEM_mallocN(totface*sizeof(float), "paffoweights" );
-
- for(a=0, mface=facelist; a<totface; a++, mface++) {
- if (mface->v4)
- curfarea= AreaQ3Dfl(vertlist[mface->v1].co, vertlist[mface->v2].co, vertlist[mface->v3].co, vertlist[mface->v4].co);
- else
- curfarea= AreaT3Dfl(vertlist[mface->v1].co, vertlist[mface->v2].co, vertlist[mface->v3].co);
- if(curfarea>maxfarea)
- maxfarea = curfarea;
- foweights[a]= curfarea;
- }
- }
- else {
- for(a=0, mface=facelist; a<totface; a++, mface++) {
- if(foweights[a]!=0.0f) {
- if (mface->v4)
- curfarea= AreaQ3Dfl(vertlist[mface->v1].co, vertlist[mface->v2].co, vertlist[mface->v3].co, vertlist[mface->v4].co);
- else
- curfarea= AreaT3Dfl(vertlist[mface->v1].co, vertlist[mface->v2].co, vertlist[mface->v3].co);
- if(curfarea>maxfarea)
- maxfarea = curfarea;
- foweights[a]*= curfarea;
- }
- }
- }
-
- /* normalize weights for max face area, calculate tot */
- if(maxfarea!=0.0f) {
- maxfarea= 1.0f/maxfarea;
- for(a=0; a< totface; a++) {
- if(foweights[a]!=0.0) {
- foweights[a] *= maxfarea;
- totfweight+= foweights[a];
- }
- }
- }
- }
- else if(foweights) {
- /* only add totfweight value */
- for(a=0; a< totface; a++) {
- if(foweights[a]!=0.0) {
- totfweight+= foweights[a];
- }
- }
- }
-
- /* if weight arrays, we turn these arrays into the amount of particles */
- if(totvert && voweights) {
- float mult= (float)totpart/totvweight;
-
- for(a=0; a< totvert; a++) {
- if(voweights[a]!=0.0)
- voweights[a] *= mult;
- }
- }
-
- if(totface && foweights) {
- float mult= (float)totpart/totfweight;
-
- for(a=0; a< totface; a++) {
- if(foweights[a]!=0.0)
- foweights[a] *= mult;
- }
- }
-}
-
-/* helper function for build_particle_system() */
-static void make_length_tables(PartEff *paf, Mesh *me, int totvert, MFace *facelist, int totface, float **vlengths, float **flengths)
-{
- MFace *mface;
- float *folengths=NULL, *volengths=NULL;
- int a;
-
- if((paf->flag & PAF_FACE)==0) totface= 0;
-
- /* collect emitting vertices & faces if vert groups used */
- if(paf->vertgroup_v && me->dvert) {
-
- /* allocate lengths array for all vertices, also for lookup of faces later on. note it's a malloc */
- *vlengths= volengths= MEM_mallocN( totvert*sizeof(float), "pafvolengths" );
- for(a=0; a<totvert; a++) {
- volengths[a]= vert_weight(me->dvert+a, paf->vertgroup_v-1);
- }
-
- if(totface) {
- /* allocate lengths array for faces, note it's a malloc */
- *flengths= folengths= MEM_mallocN(totface*sizeof(float), "paffolengths" );
- for(a=0, mface=facelist; a<totface; a++, mface++) {
- folengths[a] = face_weight(mface, volengths);
- }
- }
- }
-}
-
/* for paf start to end, store all matrices for objects */
typedef struct pMatrixCache {
float imat[3][3];
} pMatrixCache;
-
-/* WARN: this function stores data in ob->id.idnew! */
-/* error: this function changes ob->recalc of other objects... */
-static pMatrixCache *cache_object_matrices(Object *ob, int start, int end)
-{
- pMatrixCache *mcache, *mc;
- Group *group= NULL;
- Object *obcopy;
- Base *base;
- float framelenold, cfrao, sfo;
-
- /* object can be linked in group... stupid exception */
- if(NULL==object_in_scene(ob, G.scene))
- group= find_group(ob, NULL); /* TODO - dont just use the first group! - Campbell */
-
- mcache= mc= MEM_mallocN( (end-start+1)*sizeof(pMatrixCache), "ob matrix cache");
-
- framelenold= G.scene->r.framelen;
- G.scene->r.framelen= 1.0f;
- cfrao= G.scene->r.cfra;
- sfo= ob->sf; /* warning, dont use sfo, value should be from give_timeoffset if used for anything */
- ob->sf= 0.0f;
-
- /* clear storage, copy recalc tag (bad loop) */
- for(obcopy= G.main->object.first; obcopy; obcopy= obcopy->id.next) {
- obcopy->id.newid= NULL;
- obcopy->recalco= obcopy->recalc;
- obcopy->recalc= 0;
- }
-
- /* all objects get tagged recalc that influence this object (does group too) */
- /* note that recalco has the real recalc tags, set by callers of this function */
- ob->recalc |= OB_RECALC_OB; /* make sure a recalc gets flushed */
- DAG_object_update_flags(G.scene, ob, -1);
-
- for(G.scene->r.cfra= start; G.scene->r.cfra<=end; G.scene->r.cfra++, mc++) {
-
- if(group) {
- GroupObject *go;
-
- for(go= group->gobject.first; go; go= go->next) {
- if(go->ob->recalc) {
- where_is_object(go->ob);
-
- do_ob_key(go->ob);
- if(go->ob->type==OB_ARMATURE) {
- do_all_pose_actions(go->ob); // only does this object actions
- where_is_pose(go->ob);
- }
- }
- }
- }
- else {
- for(base= G.scene->base.first; base; base= base->next) {
- if(base->object->recalc) {
- if(base->object->id.newid==NULL)
- base->object->id.newid= MEM_dupallocN(base->object);
-
- where_is_object(base->object);
-
- do_ob_key(base->object);
- if(base->object->type==OB_ARMATURE) {
- do_all_pose_actions(base->object); // only does this object actions
- where_is_pose(base->object);
- }
- }
- }
- }
- Mat4CpyMat4(mc->obmat, ob->obmat);
- Mat4Invert(ob->imat, ob->obmat);
- Mat3CpyMat4(mc->imat, ob->imat);
- Mat3Transp(mc->imat);
- }
-
- /* restore */
- G.scene->r.cfra= cfrao;
- G.scene->r.framelen= framelenold;
- ob->sf= sfo;
-
- if(group) {
- GroupObject *go;
-
- for(go= group->gobject.first; go; go= go->next) {
- if(go->ob->recalc) {
- where_is_object(go->ob);
-
- do_ob_key(go->ob);
- if(go->ob->type==OB_ARMATURE) {
- do_all_pose_actions(go->ob); // only does this object actions
- where_is_pose(go->ob);
- }
- }
- }
- }
- else {
- for(base= G.scene->base.first; base; base= base->next) {
- if(base->object->recalc) {
-
- if(base->object->id.newid) {
- obcopy= (Object *)base->object->id.newid;
- *(base->object) = *(obcopy);
- MEM_freeN(obcopy);
- base->object->id.newid= NULL;
- }
-
- do_ob_key(base->object);
- if(base->object->type==OB_ARMATURE) {
- do_all_pose_actions(base->object); // only does this object actions
- where_is_pose(base->object);
- }
- }
- }
- }
-
- /* copy recalc tag (bad loop) */
- for(obcopy= G.main->object.first; obcopy; obcopy= obcopy->id.next)
- obcopy->recalc= obcopy->recalco;
-
- return mcache;
-}
-
/* for fluidsim win32 debug messages */
#if defined(WIN32) && (!(defined snprintf))
#define snprintf _snprintf
#endif
-
-/* main particle building function
- one day particles should become dynamic (realtime) with the current method as a 'bake' (ton) */
-void build_particle_system(Object *ob)
-{
- RNG *rng;
- PartEff *paf;
- Particle *pa;
- Mesh *me;
- Base *base;
- MTex *mtexmove=0, *mtextime=0;
- Material *ma;
- MFace *facelist= NULL;
- pMatrixCache *mcache=NULL, *mcnow, *mcprev;
- ListBase *effectorbase;
- VeNoCo *vertexcosnos;
- double startseconds= PIL_check_seconds_timer();
- float ftime, dtime, force[3], vec[3], fac, co[3], no[3];
- float *voweights= NULL, *foweights= NULL, maxw=1.0f;
- float *volengths= NULL, *folengths= NULL;
- int deform=0, a, totpart, paf_sta, paf_end;
- int waitcursor_set= 0, totvert, totface, curface, curvert;
-#ifndef DISABLE_ELBEEM
- int readMask, activeParts, fileParts;
-#endif
-
- /* return conditions */
- if(ob->type!=OB_MESH) return;
- me= ob->data;
-
- paf= give_parteff(ob);
- if(paf==NULL) return;
-
- if(G.rendering==0 && paf->disp==0) return;
-
- if(paf->keys) MEM_freeN(paf->keys); /* free as early as possible, for returns */
- paf->keys= NULL;
-
- //printf("build particles\n");
-
- /* fluid sim particle import handling, actual loading of particles from file */
- #ifndef DISABLE_ELBEEM
- if( (1) && (ob->fluidsimFlag & OB_FLUIDSIM_ENABLE) && // broken, disabled for now!
- (ob->fluidsimSettings) &&
- (ob->fluidsimSettings->type == OB_FLUIDSIM_PARTICLE)) {
- char *suffix = "fluidsurface_particles_####";
- char *suffix2 = ".gz";
- char filename[256];
- char debugStrBuffer[256];
- int curFrame = G.scene->r.cfra -1; // warning - sync with derived mesh fsmesh loading
- int j, numFileParts;
- gzFile gzf;
- float vel[3];
-
- if(ob==G.obedit) { // off...
- paf->totpart = 0; // 1 or 0?
- return;
- }
-
- // ok, start loading
- strcpy(filename, ob->fluidsimSettings->surfdataPath);
- strcat(filename, suffix);
- BLI_convertstringcode(filename, G.sce, curFrame); // fixed #frame-no
- strcat(filename, suffix2);
-
- gzf = gzopen(filename, "rb");
- if (!gzf) {
- snprintf(debugStrBuffer,256,"readFsPartData::error - Unable to open file for reading '%s' \n", filename);
- //elbeemDebugOut(debugStrBuffer);
- paf->totpart = 0;
- return;
- }
-
- gzread(gzf, &totpart, sizeof(totpart));
- numFileParts = totpart;
- totpart = (G.rendering)?totpart:(paf->disp*totpart)/100;
- paf->totpart= totpart;
- paf->totkey= 1;
- /* initialize particles */
- new_particle(paf);
- ftime = 0.0; // unused...
-
- // set up reading mask
- readMask = ob->fluidsimSettings->typeFlags;
- activeParts=0;
- fileParts=0;
-
- for(a=0; a<totpart; a++) {
- int ptype=0;
- short shsize=0;
- float convertSize=0.0;
- gzread(gzf, &ptype, sizeof( ptype ));
- if(ptype&readMask) {
- activeParts++;
- pa= new_particle(paf);
- pa->time= ftime;
- pa->lifetime= ftime + 10000.; // add large number to make sure they are displayed, G.scene->r.efra +1.0;
- pa->co[0] = 0.0;
- pa->co[1] =
- pa->co[2] = 1.0*(float)a / (float)totpart;
- pa->no[0] = pa->no[1] = pa->no[2] = 0.0;
- pa->mat_nr= paf->omat;
- gzread(gzf, &convertSize, sizeof( float ));
- // convert range of 1.0-10.0 to shorts 1000-10000)
- shsize = (short)(convertSize*1000.0);
- pa->rt = shsize;
-
- for(j=0; j<3; j++) {
- float wrf;
- gzread(gzf, &wrf, sizeof( wrf ));
- pa->co[j] = wrf;
- //fprintf(stderr,"Rj%d ",j);
- }
- for(j=0; j<3; j++) {
- float wrf;
- gzread(gzf, &wrf, sizeof( wrf ));
- vel[j] = wrf;
- }
- //if(a<25) fprintf(stderr,"FSPARTICLE debug set %s , a%d = %f,%f,%f , life=%f \n", filename, a, pa->co[0],pa->co[1],pa->co[2], pa->lifetime );
- } else {
- // skip...
- for(j=0; j<2*3+1; j++) {
- float wrf; gzread(gzf, &wrf, sizeof( wrf ));
- }
- }
- fileParts++;
- }
- gzclose( gzf );
-
- totpart = paf->totpart = activeParts;
- snprintf(debugStrBuffer,256,"readFsPartData::done - particles:%d, active:%d, file:%d, mask:%d \n", paf->totpart,activeParts,fileParts,readMask);
- elbeemDebugOut(debugStrBuffer);
- return;
- } // fluid sim particles done
- #endif // DISABLE_ELBEEM
-
- if(paf->end < paf->sta) return;
-
- if( (paf->flag & PAF_OFACE) && (paf->flag & PAF_FACE)==0) return;
-
- if(me->totvert==0) return;
-
- if(ob==G.obedit) return;
- totpart= (G.rendering)?paf->totpart:(paf->disp*paf->totpart)/100;
- if(totpart==0) return;
-
- /* No returns after this line! */
-
- /* material */
- ma= give_current_material(ob, paf->omat);
- if(ma) {
- if(paf->speedtex)
- mtexmove= ma->mtex[paf->speedtex-1];
- mtextime= ma->mtex[paf->timetex-1];
- }
-
- disable_speed_curve(1); /* check this... */
-
- /* initialize particles */
- new_particle(paf);
-
- /* reset deflector cache, sumohandle is free, but its still sorta abuse... (ton) */
- for(base= G.scene->base.first; base; base= base->next)
- base->object->sumohandle= NULL;
-
- /* all object positions from start to end */
- paf_sta= (int)floor(paf->sta);
- paf_end= (int)ceil(paf->end);
- if((paf->flag & PAF_STATIC)==0)
- mcache= cache_object_matrices(ob, paf_sta, paf_end);
-
- /* mult generations? */
- for(a=0; a<PAF_MAXMULT; a++) {
- if(paf->mult[a]!=0.0) {
- /* interesting formula! this way after 'x' generations the total is paf->totpart */
- totpart= (int)(totpart / (1.0+paf->mult[a]*paf->child[a]));
- }
- else break;
- }
-
- /* for static particles, calculate system on current frame (? ton) */
- if(ma) do_mat_ipo(ma);
-
- /* matrix invert for static too */
- Mat4Invert(ob->imat, ob->obmat);
- Mat4CpyMat4(paf->imat, ob->imat); /* used for duplicators */
-
- /* new random generator */
- rng = rng_new(paf->seed);
-
- /* otherwise it goes way too fast */
- force[0]= paf->force[0]*0.05f;
- force[1]= paf->force[1]*0.05f;
- force[2]= paf->force[2]*0.05f;
-
- if( paf->flag & PAF_STATIC ) deform= 0;
- else {
- Object *parlatt= modifiers_isDeformedByLattice(ob);
- if(parlatt) {
- deform= 1;
- init_latt_deform(parlatt, 0);
- }
- }
-
- /* get the effectors */
- effectorbase= pdInitEffectors(ob, paf->group);
-
- /* init geometry, return is 6 x float * me->totvert in size */
- vertexcosnos= (VeNoCo *)mesh_get_mapped_verts_nors(ob);
- facelist= me->mface;
- totvert= me->totvert;
- totface= me->totface;
-
- /* if vertexweights or even distribution, it makes weight tables, also checks where it emits from */
- make_weight_tables(paf, me, totpart, vertexcosnos, totvert, facelist, totface, &voweights, &foweights);
-
- /* vertexweights can define lengths too */
- make_length_tables(paf, me, totvert, facelist, totface, &volengths, &folengths);
-
- /* now define where to emit from, if there are face weights we skip vertices */
- if(paf->flag & PAF_OFACE) totvert= 0;
- if((paf->flag & PAF_FACE)==0) totface= 0;
- if(foweights) totvert= 0;
-
- /* initialize give_mesh_particle_coord */
- if(totface)
- give_mesh_particle_coord(paf, vertexcosnos, facelist, totpart, totface, NULL, NULL);
-
- /* correction for face timing when using weighted average */
- if(totface && foweights) {
- maxw= (paf->end-paf->sta)/foweights[0];
- }
- else if(totvert && voweights) {
- maxw= (paf->end-paf->sta)/voweights[0];
- }
-
- /* for loop below */
- if (paf->flag & PAF_STATIC) {
- ftime = G.scene->r.cfra;
- dtime= 0.0f;
- } else {
- ftime= paf->sta;
- dtime= (paf->end - paf->sta)/(float)totpart;
- }
-
- curface= curvert= 0;
- for(a=0; a<totpart; a++, ftime+=dtime) {
-
- /* we set waitcursor only when a half second expired, particles now are realtime updated */
- if(waitcursor_set==0 && (a % 256)==255) {
- double seconds= PIL_check_seconds_timer();
- if(seconds - startseconds > 0.5) {
- waitcursor(1);
- waitcursor_set= 1;
- }
- }
-
- pa= new_particle(paf);
- pa->time= ftime;
-
- /* get coordinates from faces, only when vertices set to zero */
- if(totvert==0 && totface) {
- int curjit;
-
- /* use weight table, we have to do faces in order to be able to use jitter table... */
- if(foweights) {
-
- if(foweights[curface] < 1.0f) {
- float remainder= 0.0f;
-
- while(remainder + foweights[curface] < 1.0f && curface<totface-1) {
- remainder += foweights[curface];
- curface++;
- }
- /* if this is the last face, the foweights[] can be zero, so we don't add a particle extra */
- if(curface!=totface-1)
- foweights[curface] += remainder;
-
- maxw= (paf->end-paf->sta)/foweights[curface];
- }
-
- if(foweights[curface]==0.0f)
- break; /* WARN skips here out of particle generating */
- else {
- if(foweights[curface] >= 1.0f) /* note the >= here, this because of the < 1.0f above, it otherwise will stick to 1 face forever */
- foweights[curface] -= 1.0f;
-
- curjit= (int) foweights[curface];
- give_mesh_particle_coord(paf, vertexcosnos, facelist+curface, a, curjit, co, no);
-
- /* time correction to make particles appear evenly, maxw does interframe (0-1) */
- pa->time= paf->sta + maxw*foweights[curface];
- }
- }
- else {
- curface= a % totface;
- curjit= a/totface;
- give_mesh_particle_coord(paf, vertexcosnos, facelist+curface, a, curjit, co, no);
- }
- }
- /* get coordinates from vertices */
- if(totvert) {
- /* use weight table */
- if(voweights) {
-
- if(voweights[curvert] < 1.0f) {
- float remainder= 0.0f;
-
- while(remainder + voweights[curvert] < 1.0f && curvert<totvert-1) {
- remainder += voweights[curvert];
- curvert++;
- }
- voweights[curvert] += remainder;
- maxw= (paf->end-paf->sta)/voweights[curvert];
- }
-
- if(voweights[curvert]==0.0f)
- break; /* WARN skips here out of particle generating */
- else {
- if(voweights[curvert] > 1.0f)
- voweights[curvert] -= 1.0f;
-
- /* time correction to make particles appear evenly */
- pa->time= paf->sta + maxw*voweights[curvert];
- }
- }
- else {
- curvert= a % totvert;
- if(a >= totvert && totface)
- totvert= 0;
- }
-
- VECCOPY(co, vertexcosnos[curvert].co);
- VECCOPY(no, vertexcosnos[curvert].no);
- }
-
- VECCOPY(pa->co, co);
-
- /* dynamic options */
- if((paf->flag & PAF_STATIC)==0) {
- int cur;
-
- /* particle retiming with texture */
- if(mtextime && (paf->flag2 & PAF_TEXTIME)) {
- float tin, tr, tg, tb, ta, orco[3];
-
- /* calculate normalized orco */
- orco[0] = (co[0]-me->loc[0])/me->size[0];
- orco[1] = (co[1]-me->loc[1])/me->size[1];
- orco[2] = (co[2]-me->loc[2])/me->size[2];
- externtex(mtextime, orco, &tin, &tr, &tg, &tb, &ta);
-
- if(paf->flag2neg & PAF_TEXTIME)
- pa->time = paf->sta + (paf->end - paf->sta)*tin;
- else
- pa->time = paf->sta + (paf->end - paf->sta)*(1.0f-tin);
- }
-
- /* set ob at correct time, we use cached matrices */
- cur= (int)floor(pa->time) + 1 ; /* + 1 has a reason: (obmat/prevobmat) otherwise comet-tails start too late */
-
- if(cur <= paf_end) mcnow= mcache + cur - paf_sta;
- else mcnow= mcache + paf_end - paf_sta;
-
- if(cur > paf_sta) mcprev= mcnow-1;
- else mcprev= mcache;
-
- /* move to global space */
- Mat4MulVecfl(mcnow->obmat, pa->co);
-
- VECCOPY(vec, co);
- Mat4MulVecfl(mcprev->obmat, vec);
-
- /* first start speed: object */
- VECSUB(pa->no, pa->co, vec);
-
- VecMulf(pa->no, paf->obfac);
-
- /* calculate the correct inter-frame */
- fac= (pa->time- (float)floor(pa->time));
- pa->co[0]= fac*pa->co[0] + (1.0f-fac)*vec[0];
- pa->co[1]= fac*pa->co[1] + (1.0f-fac)*vec[1];
- pa->co[2]= fac*pa->co[2] + (1.0f-fac)*vec[2];
-
- /* start speed: normal */
- if(paf->normfac!=0.0) {
- /* imat is transpose ! */
- VECCOPY(vec, no);
- Mat3MulVecfl(mcnow->imat, vec);
-
- Normalize(vec);
- VecMulf(vec, paf->normfac);
- VECADD(pa->no, pa->no, vec);
- }
- }
- else {
- if(paf->normfac!=0.0) {
- VECCOPY(pa->no, no);
- Normalize(pa->no);
- VecMulf(pa->no, paf->normfac);
- }
- }
-
- pa->lifetime= paf->lifetime;
- if(paf->randlife!=0.0) {
- pa->lifetime*= 1.0f + paf->randlife*(rng_getFloat(rng) - 0.5f);
- }
- pa->mat_nr= paf->omat;
-
- if(folengths)
- pa->lifetime*= folengths[curface];
-
- make_particle_keys(rng, ob, 0, a, paf, pa, force, deform, mtexmove, effectorbase);
- }
-
- /* free stuff */
- give_mesh_particle_coord(NULL, NULL, NULL, 0, 0, NULL, NULL);
- MEM_freeN(vertexcosnos);
- if(voweights) MEM_freeN(voweights);
- if(foweights) MEM_freeN(foweights);
- if(volengths) MEM_freeN(volengths);
- if(folengths) MEM_freeN(folengths);
- if(mcache) MEM_freeN(mcache);
- rng_free(rng);
-
- if(deform) end_latt_deform();
-
- if(effectorbase)
- pdEndEffectors(effectorbase);
-
- /* reset deflector cache */
- for(base= G.scene->base.first; base; base= base->next) {
- if(base->object->sumohandle) {
-
- MEM_freeN(base->object->sumohandle);
- base->object->sumohandle= NULL;
- }
- }
-
- disable_speed_curve(0);
-
- if(waitcursor_set) waitcursor(0);
-}
-
#include "DNA_object_types.h"
#include "DNA_nla_types.h"
#include "DNA_scene_types.h"
+#include "DNA_particle_types.h"
#include "BLI_blenlib.h"
{
Material *ma;
Object *ob;
+ Scene *sce;
+ SceneRenderLayer *srl;
+ ParticleSystem *psys;
for(ma= G.main->mat.first; ma; ma= ma->id.next) {
if(ma->group==group)
ma->group= NULL;
}
+ for(ma= G.main->mat.first; ma; ma= ma->id.next) {
+ if(ma->group==group)
+ ma->group= NULL;
+ }
+ for (sce= G.main->scene.first; sce; sce= sce->id.next) {
+ for(srl= sce->r.layers.first; srl; srl= srl->next) {
+ if (srl->light_override==group)
+ srl->light_override= NULL;
+ }
+ }
+
for(ob= G.main->object.first; ob; ob= ob->id.next) {
bActionStrip *strip;
- PartEff *paf;
if(ob->dup_group==group) {
ob->dup_group= NULL;
strip->object= NULL;
}
}
- for(paf= ob->effect.first; paf; paf= paf->next) {
- if(paf->type==EFF_PARTICLE) {
- if(paf->group)
- paf->group= NULL;
- }
+
+ for(psys=ob->particlesystem.first; psys; psys=psys->next){
+ if(psys->part->dup_group==group)
+ psys->part->dup_group= NULL;
+ if(psys->part->eff_group==group)
+ psys->part->eff_group= NULL;
}
}
group->id.us= 0;
/* get the ibuf from an image cache, local use here only */
static ImBuf *image_get_ibuf(Image *ima, int index, int frame)
{
+ /* this function is intended to be thread safe. with IMA_NO_INDEX this
+ * should be OK, but when iterating over the list this is more tricky
+ * */
if(index==IMA_NO_INDEX)
return ima->ibufs.first;
else {
ImBuf *ibuf;
-
+
index= IMA_MAKE_INDEX(frame, index);
for(ibuf= ima->ibufs.first; ibuf; ibuf= ibuf->next)
if(ibuf->index==index)
return ibuf;
+
return NULL;
}
}
for(link= ima->ibufs.first; link; link= link->next)
if(link->index>=index)
break;
- /* now we don't want copies? */
- if(link && ibuf->index==link->index) {
- ImBuf *prev= ibuf->prev;
- image_remove_ibuf(ima, link);
- link= prev;
- }
-
+
+ ibuf->index= index;
+
/* this function accepts link==NULL */
BLI_insertlinkbefore(&ima->ibufs, link, ibuf);
-
- ibuf->index= index;
+
+ /* now we don't want copies? */
+ if(link && ibuf->index==link->index)
+ image_remove_ibuf(ima, link);
}
-
}
/* checks if image was already loaded, then returns same image */
ibuf= NULL;
}
else {
- image_assign_ibuf(ima, ibuf, 0, frame);
image_initialize_after_load(ima, ibuf);
+ image_assign_ibuf(ima, ibuf, 0, frame);
}
#else
- image_assign_ibuf(ima, ibuf, 0, frame);
image_initialize_after_load(ima, ibuf);
+ image_assign_ibuf(ima, ibuf, 0, frame);
#endif
}
else
// if(oldrr) printf("freed previous result %p\n", oldrr);
if(oldrr) RE_FreeRenderResult(oldrr);
}
- else
+ else {
ima->rr= oldrr;
+ }
}
if(ima->rr) {
ibuf->mall= IB_rectfloat;
ibuf->channels= rpass->channels;
- image_assign_ibuf(ima, ibuf, iuser->multi_index, frame);
image_initialize_after_load(ima, ibuf);
+ image_assign_ibuf(ima, ibuf, iuser->multi_index, frame);
}
// else printf("pass not found\n");
ibuf = IMB_anim_absolute(ima->anim, fra);
if(ibuf) {
- image_assign_ibuf(ima, ibuf, 0, frame);
image_initialize_after_load(ima, ibuf);
+ image_assign_ibuf(ima, ibuf, 0, frame);
}
else
ima->ok= 0;
{
struct ImBuf *ibuf;
char str[FILE_MAX];
+ int assign = 0;
/* always ensure clean ima */
image_free_buffers(ima);
ibuf= NULL;
}
else {
- image_assign_ibuf(ima, ibuf, IMA_NO_INDEX, 0);
image_initialize_after_load(ima, ibuf);
+ assign= 1;
/* check if the image is a font image... */
detectBitmapFont(ibuf);
else
ima->ok= 0;
+ if(assign)
+ image_assign_ibuf(ima, ibuf, IMA_NO_INDEX, 0);
+
if(iuser)
iuser->ok= ima->ok;
if(rpass) {
ibuf= IMB_allocImBuf(ima->rr->rectx, ima->rr->recty, 32, 0, 0);
- image_assign_ibuf(ima, ibuf, iuser?iuser->multi_index:IMA_NO_INDEX, 0);
image_initialize_after_load(ima, ibuf);
ibuf->rect_float= rpass->rect;
ibuf->flags |= IB_rectfloat;
ibuf->channels= rpass->channels;
+
+ image_assign_ibuf(ima, ibuf, iuser?iuser->multi_index:IMA_NO_INDEX, 0);
}
}
return NULL;
}
-/* Checks optional ImageUser and verifies/creates ImBuf. */
-/* returns ibuf */
-ImBuf *BKE_image_get_ibuf(Image *ima, ImageUser *iuser)
+static ImBuf *image_get_ibuf_threadsafe(Image *ima, ImageUser *iuser, int *frame_r, int *index_r)
{
- ImBuf *ibuf= NULL;
- float color[] = {0, 0, 0, 1};
+ ImBuf *ibuf = NULL;
+ int frame = 0, index = 0;
- /* quick reject tests */
- if(ima==NULL)
- return NULL;
- if(iuser) {
- if(iuser->ok==0)
- return NULL;
- }
- else if(ima->ok==0)
- return NULL;
-
- BLI_lock_thread(LOCK_IMAGE);
-
- /* handle image source and types */
+ /* see if we already have an appropriate ibuf, with image source and type */
if(ima->source==IMA_SRC_MOVIE) {
- /* source is from single file, use flipbook to store ibuf */
- int frame= iuser?iuser->framenr:ima->lastframe;
-
+ frame= iuser?iuser->framenr:ima->lastframe;
ibuf= image_get_ibuf(ima, 0, frame);
- if(ibuf==NULL)
- ibuf= image_load_movie_file(ima, iuser, frame);
}
else if(ima->source==IMA_SRC_SEQUENCE) {
-
if(ima->type==IMA_TYPE_IMAGE) {
- /* regular files, ibufs in flipbook, allows saving */
- int frame= iuser?iuser->framenr:ima->lastframe;
-
+ frame= iuser?iuser->framenr:ima->lastframe;
ibuf= image_get_ibuf(ima, 0, frame);
- if(ibuf==NULL)
- ibuf= image_load_sequence_file(ima, iuser, frame);
- else
- BLI_strncpy(ima->name, ibuf->name, sizeof(ima->name));
}
- /* no else; on load the ima type can change */
- if(ima->type==IMA_TYPE_MULTILAYER) {
- /* only 1 layer/pass stored in imbufs, no exrhandle anim storage, no saving */
- int frame= iuser?iuser->framenr:ima->lastframe;
- int index= iuser?iuser->multi_index:IMA_NO_INDEX;
-
+ else if(ima->type==IMA_TYPE_MULTILAYER) {
+ frame= iuser?iuser->framenr:ima->lastframe;
+ index= iuser?iuser->multi_index:IMA_NO_INDEX;
ibuf= image_get_ibuf(ima, index, frame);
- if(G.rt) printf("seq multi fra %d id %d ibuf %p %s\n", frame, index, ibuf, ima->id.name);
- if(ibuf==NULL)
- ibuf= image_load_sequence_multilayer(ima, iuser, frame);
- else
- BLI_strncpy(ima->name, ibuf->name, sizeof(ima->name));
}
-
}
else if(ima->source==IMA_SRC_FILE) {
-
- if(ima->type==IMA_TYPE_IMAGE) {
+ if(ima->type==IMA_TYPE_IMAGE)
ibuf= image_get_ibuf(ima, IMA_NO_INDEX, 0);
- if(ibuf==NULL)
- ibuf= image_load_image_file(ima, iuser, G.scene->r.cfra); /* cfra only for '#', this global is OK */
- }
- /* no else; on load the ima type can change */
- if(ima->type==IMA_TYPE_MULTILAYER) {
- /* keeps render result, stores ibufs in listbase, allows saving */
+ else if(ima->type==IMA_TYPE_MULTILAYER)
ibuf= image_get_ibuf(ima, iuser?iuser->multi_index:IMA_NO_INDEX, 0);
- if(ibuf==NULL)
- ibuf= image_get_ibuf_multilayer(ima, iuser);
- }
-
}
else if(ima->source == IMA_SRC_GENERATED) {
- /* generated is: ibuf is allocated dynamically */
ibuf= image_get_ibuf(ima, IMA_NO_INDEX, 0);
-
- if(ibuf==NULL) {
- if(ima->type==IMA_TYPE_VERSE) {
- /* todo */
- }
- else { /* always fall back to IMA_TYPE_UV_TEST */
- /* UV testgrid or black or solid etc */
- if(ima->gen_x==0) ima->gen_x= 256;
- if(ima->gen_y==0) ima->gen_y= 256;
- ibuf= add_ibuf_size(ima->gen_x, ima->gen_y, ima->name, 0, ima->gen_type, color);
- image_assign_ibuf(ima, ibuf, IMA_NO_INDEX, 0);
- ima->ok= IMA_OK_LOADED;
- }
- }
}
else if(ima->source == IMA_SRC_VIEWER) {
if(ima->type==IMA_TYPE_R_RESULT) {
- /* always verify entirely */
- ibuf= image_get_render_result(ima, iuser);
+ /* always verify entirely, not that this shouldn't happen
+ * during render anyway */
}
else if(ima->type==IMA_TYPE_COMPOSITE) {
- int frame= iuser?iuser->framenr:0;
-
- /* Composite Viewer, all handled in compositor */
+ frame= iuser?iuser->framenr:0;
ibuf= image_get_ibuf(ima, 0, frame);
- if(ibuf==NULL) {
- /* fake ibuf, will be filled in compositor */
- ibuf= IMB_allocImBuf(256, 256, 32, IB_rect, 0);
- image_assign_ibuf(ima, ibuf, 0, frame);
+ }
+ }
+
+ *frame_r = frame;
+ *index_r = index;
+
+ return ibuf;
+}
+
+/* Checks optional ImageUser and verifies/creates ImBuf. */
+/* returns ibuf */
+ImBuf *BKE_image_get_ibuf(Image *ima, ImageUser *iuser)
+{
+ ImBuf *ibuf= NULL;
+ float color[] = {0, 0, 0, 1};
+ int frame= 0, index= 0;
+
+ /* This function is intended to be thread-safe. It postpones the mutex lock
+ * until it needs to load the image, if the image is already there it
+ * should just get the pointer and return. The reason is that a lot of mutex
+ * locks appears to be very slow on certain multicore macs, causing a render
+ * with image textures to actually slow down as more threads are used.
+ *
+ * Note that all the image loading functions should also make sure they do
+ * things in a threadsafe way for image_get_ibuf_threadsafe to work correct.
+ * That means, the last two steps must be, 1) add the ibuf to the list and
+ * 2) set ima/iuser->ok to 0 to IMA_OK_LOADED */
+
+ /* quick reject tests */
+ if(ima==NULL)
+ return NULL;
+ if(iuser) {
+ if(iuser->ok==0)
+ return NULL;
+ }
+ else if(ima->ok==0)
+ return NULL;
+
+ /* try to get the ibuf without locking */
+ ibuf= image_get_ibuf_threadsafe(ima, iuser, &frame, &index);
+
+ if(ibuf == NULL) {
+ /* couldn't get ibuf and image is not ok, so let's lock and try to
+ * load the image */
+ BLI_lock_thread(LOCK_IMAGE);
+
+ /* need to check ok flag and loading ibuf again, because the situation
+ * might have changed in the meantime */
+ if(iuser) {
+ if(iuser->ok==0) {
+ BLI_unlock_thread(LOCK_IMAGE);
+ return NULL;
+ }
+ }
+ else if(ima->ok==0) {
+ BLI_unlock_thread(LOCK_IMAGE);
+ return NULL;
+ }
+
+ ibuf= image_get_ibuf_threadsafe(ima, iuser, &frame, &index);
+
+ if(ibuf == NULL) {
+ /* we are sure we have to load the ibuf, using source and type */
+ if(ima->source==IMA_SRC_MOVIE) {
+ /* source is from single file, use flipbook to store ibuf */
+ ibuf= image_load_movie_file(ima, iuser, frame);
+ }
+ else if(ima->source==IMA_SRC_SEQUENCE) {
+ if(ima->type==IMA_TYPE_IMAGE) {
+ /* regular files, ibufs in flipbook, allows saving */
+ ibuf= image_load_sequence_file(ima, iuser, frame);
+ }
+ /* no else; on load the ima type can change */
+ if(ima->type==IMA_TYPE_MULTILAYER) {
+ /* only 1 layer/pass stored in imbufs, no exrhandle anim storage, no saving */
+ ibuf= image_load_sequence_multilayer(ima, iuser, frame);
+ }
+
+ if(ibuf)
+ BLI_strncpy(ima->name, ibuf->name, sizeof(ima->name));
+ }
+ else if(ima->source==IMA_SRC_FILE) {
+
+ if(ima->type==IMA_TYPE_IMAGE)
+ ibuf= image_load_image_file(ima, iuser, G.scene->r.cfra); /* cfra only for '#', this global is OK */
+ /* no else; on load the ima type can change */
+ if(ima->type==IMA_TYPE_MULTILAYER)
+ /* keeps render result, stores ibufs in listbase, allows saving */
+ ibuf= image_get_ibuf_multilayer(ima, iuser);
+
+ }
+ else if(ima->source == IMA_SRC_GENERATED) {
+ /* generated is: ibuf is allocated dynamically */
+ if(ima->type==IMA_TYPE_VERSE) {
+ /* todo */
+ }
+ else { /* always fall back to IMA_TYPE_UV_TEST */
+ /* UV testgrid or black or solid etc */
+ if(ima->gen_x==0) ima->gen_x= 256;
+ if(ima->gen_y==0) ima->gen_y= 256;
+ ibuf= add_ibuf_size(ima->gen_x, ima->gen_y, ima->name, 0, ima->gen_type, color);
+ image_assign_ibuf(ima, ibuf, IMA_NO_INDEX, 0);
+ ima->ok= IMA_OK_LOADED;
+ }
+ }
+ else if(ima->source == IMA_SRC_VIEWER) {
+ if(ima->type==IMA_TYPE_R_RESULT) {
+ /* always verify entirely */
+ ibuf= image_get_render_result(ima, iuser);
+ }
+ else if(ima->type==IMA_TYPE_COMPOSITE) {
+ /* Composite Viewer, all handled in compositor */
+ /* fake ibuf, will be filled in compositor */
+ ibuf= IMB_allocImBuf(256, 256, 32, IB_rect, 0);
+ image_assign_ibuf(ima, ibuf, 0, frame);
+ }
}
}
+
+ BLI_unlock_thread(LOCK_IMAGE);
}
+ /* we assuming that if it is not rendering, it's also not multithreaded
+ * (a somewhat weak assumption) */
if(G.rendering==0)
tag_image_time(ima);
- BLI_unlock_thread(LOCK_IMAGE);
-
return ibuf;
}
float gravity[3];
float tm2[3][3] = {{-spring_air,0,0}, {0,-spring_air,0},{0,0,-spring_air}};
MFace *mfaces = cloth->mfaces;
- ClothVertex *verts = cloth->verts;
+ //ClothVertex *verts = cloth->verts;
float wind_normalized[3];
unsigned int numverts = cloth->numverts;
LinkNode *search = cloth->springs;
Object *ob= (Object *)id;
bActionStrip *strip;
Mesh *me;
- PartEff *paf;
+
int a;
for (strip=ob->nlastrips.first; strip; strip=strip->next){
for(a=0; a<ob->totcol; a++) {
LIBTAG(ob->mat[a]);
}
-
- paf = give_parteff(ob);
- if (paf)
- LIBTAG(paf->group);
LIBTAG(ob->dup_group);
LIBTAG(ob->proxy);
}
/* Copy vdata or fdata from Mesh or EditMesh to Multires. */
-void multires_update_customdata(MultiresLevel *lvl1, CustomData *src, CustomData *dst, const int type)
+void multires_update_customdata(MultiresLevel *lvl1, EditMesh *em, CustomData *src, CustomData *dst, const int type)
{
if(src && dst && type_ok(type)) {
const int tot= (type == CD_MDEFORMVERT ? lvl1->totvert : lvl1->totface);
CustomData_free(dst, tot);
if(CustomData_has_layer(src, type)) {
- if(G.obedit) {
+ if(em) {
EditVert *eve= G.editMesh->verts.first;
EditFace *efa= G.editMesh->faces.first;
CustomData_copy(src, dst, cdmask(type), CD_CALLOC, tot);
void multires_update_first_level(Mesh *me, EditMesh *em)
{
if(me && me->mr && me->mr->current == 1) {
- multires_update_customdata(me->mr->levels.first, em ? &em->vdata : &me->vdata,
+ multires_update_customdata(me->mr->levels.first, em, em ? &em->vdata : &me->vdata,
&me->mr->vdata, CD_MDEFORMVERT);
- multires_update_customdata(me->mr->levels.first, em ? &em->fdata : &me->fdata,
+ multires_update_customdata(me->mr->levels.first, em, em ? &em->fdata : &me->fdata,
&me->mr->fdata, CD_MTFACE);
multires_update_edge_flags(me, em);
}
/* Load vertices and vdata (MDeformVerts) */
lvl->totvert= em ? BLI_countlist(&em->verts) : me->totvert;
me->mr->verts= MEM_callocN(sizeof(MVert)*lvl->totvert,"multires verts");
- multires_update_customdata(me->mr->levels.first, em ? &em->vdata : &me->vdata,
+ multires_update_customdata(me->mr->levels.first, em, em ? &em->vdata : &me->vdata,
&me->mr->vdata, CD_MDEFORMVERT);
if(em) eve= em->verts.first;
for(i=0; i<lvl->totvert; ++i) {
/* Load faces and fdata (MTFaces) */
lvl->totface= em ? BLI_countlist(&em->faces) : me->totface;
lvl->faces= MEM_callocN(sizeof(MultiresFace)*lvl->totface,"multires faces");
- multires_update_customdata(me->mr->levels.first, em ? &em->fdata : &me->fdata,
+ multires_update_customdata(me->mr->levels.first, em, em ? &em->fdata : &me->fdata,
&me->mr->fdata, CD_MTFACE);
if(em) efa= em->faces.first;
for(i=0; i<lvl->totface; ++i) {
#include "BKE_constraint.h"
#include "BKE_curve.h"
#include "BKE_displist.h"
-#include "BKE_effect.h"
#include "BKE_group.h"
#include "BKE_icons.h"
#include "BKE_ipo.h"
BLI_freelistN(&ob->defbase);
if(ob->pose)
free_pose(ob->pose);
- free_effects(&ob->effect);
free_properties(&ob->prop);
object_free_modifiers(ob);
/* object is deflector or field */
if(ob->pd) {
- if(give_parteff(obt))
- obt->recalc |= OB_RECALC_DATA;
- else if(obt->soft)
+ if(obt->soft)
obt->recalc |= OB_RECALC_DATA;
/* cloth */
ob->type= type;
/* ob->transflag= OB_QUAT; */
+#if 0 /* not used yet */
QuatOne(ob->quat);
QuatOne(ob->dquat);
+#endif
ob->col[0]= ob->col[1]= ob->col[2]= 0.0;
ob->col[3]= 1.0;
if (U.flag & USER_ADD_VIEWALIGNED) {
v3d->viewquat[0]= -v3d->viewquat[0];
- if (ob->transflag & OB_QUAT) {
+
+ /* Quats arnt used yet */
+ /*if (ob->transflag & OB_QUAT) {
QUATCOPY(ob->quat, v3d->viewquat);
- } else {
+ } else {*/
QuatToEul(v3d->viewquat, ob->rot);
- }
+ /*}*/
v3d->viewquat[0]= -v3d->viewquat[0];
}
}
obn->path= NULL;
obn->flag &= ~OB_FROMGROUP;
- copy_effects(&obn->effect, &ob->effect);
obn->modifiers.first = obn->modifiers.last= NULL;
for (md=ob->modifiers.first; md; md=md->next) {
void expand_local_object(Object *ob)
{
bActionStrip *strip;
+ ParticleSystem *psys;
int a;
id_lib_extern((ID *)ob->action);
for (strip=ob->nlastrips.first; strip; strip=strip->next) {
id_lib_extern((ID *)strip->act);
}
-
+ for(psys=ob->particlesystem.first; psys; psys=psys->next)
+ id_lib_extern((ID *)psys->part);
}
void make_local_object(Object *ob)
cfra*= G.scene->r.framelen;
if (ob) {
- if (no_speed_curve==0 && ob->ipo)
+ if (no_speed_curve==0 && ob->ipo)
cfra= calc_ipo_time(ob->ipo, cfra);
/* ofset frames */
{
float smat[3][3], vec[3];
float rmat[3][3];
- float q1[4];
+ /*float q1[4];*/
/* size */
if(ob->ipo) {
}
/* rot */
- if(ob->transflag & OB_QUAT) {
+ /* Quats arnt used yet */
+ /*if(ob->transflag & OB_QUAT) {
if(ob->ipo) {
QuatMul(q1, ob->quat, ob->dquat);
QuatToMat3(q1, rmat);
QuatToMat3(ob->quat, rmat);
}
}
- else {
+ else {*/
if(ob->ipo) {
vec[0]= ob->rot[0]+ob->drot[0];
vec[1]= ob->rot[1]+ob->drot[1];
else {
EulToMat3(ob->rot, rmat);
}
- }
+ /*}*/
Mat3MulMat3(mat, rmat, smat);
}
}
}
- if(count > 0) {
+ if (count==0) {
+ /* keep as 0,0,0 */
+ } else if(count > 0) {
VecMulf(vec, 1.0f / count);
} else {
+ /* use first index if its out of range */
dm->getVertCo(dm, 0, vec);
}
}
return partn;
}
-void psys_make_local_settings(ParticleSettings *part)
+void make_local_particlesettings(ParticleSettings *part)
{
Object *ob;
ParticleSettings *par;
lib= (pid)? pid->ob->id.lib: NULL;
if (G.relbase_valid || lib) {
- char dir[FILE_MAX], file[FILE_MAX]; /* we dont want the dir, only the file */
+ char file[FILE_MAX]; /* we dont want the dir, only the file */
char *blendfilename;
blendfilename= (lib)? lib->filename: G.sce;
#include "BKE_utildefines.h"
#include "BIF_previewrender.h"
+#include "BIF_editseq.h"
#include "BPY_extern.h"
#include "BLI_arithb.h"
GroupObject *go;
int flag;
+ // Note: this here is defined in editseq.c (BIF_editseq.h), NOT in blenkernel!
+ set_last_seq(NULL);
+
G.scene= sce;
/* check for cyclic sets, for reading old files but also for definite security (py?) */
int totseq;
int seq;
struct Sequence **seqar; /* Sequence */
+ struct Scene *scene; /* Current scene */
};
struct BPathIterator {
DIR *opendir (const char *path);
struct dirent *readdir(DIR *dp);
int closedir (DIR *dp);
-void get_default_root(char* root);
+void get_default_root(char *root);
+int check_file_chars(char *filename);
#endif /* __WINSTUFF_H__ */
bpi->seqdata.totseq = 0;
bpi->seqdata.seq = 0;
bpi->seqdata.seqar = NULL;
+ bpi->seqdata.scene = NULL;
BLI_bpathIterator_step(bpi);
}
if (bpi->seqdata.seqar)
MEM_freeN((void *)bpi->seqdata.seqar);
bpi->seqdata.seqar = NULL;
+ bpi->seqdata.scene = NULL;
}
void BLI_bpathIterator_getPath( struct BPathIterator *bpi, char *path) {
static struct Sequence *seq_stepdata__internal(struct BPathIterator *bpi, int step_next) {
Sequence *seq;
- if (G.scene->ed==NULL) {
- return NULL;
- }
-
- if (bpi->seqdata.seqar == NULL) {
- /* allocate the sequencer array */
- build_seqar( &(((Editing *)G.scene->ed)->seqbase), &bpi->seqdata.seqar, &bpi->seqdata.totseq);
- bpi->seqdata.seq = 0;
+ /* Initializing */
+ if (bpi->seqdata.scene==NULL) {
+ bpi->seqdata.scene= G.main->scene.first;
}
if (step_next) {
bpi->seqdata.seq++;
}
- if (bpi->seqdata.seq >= bpi->seqdata.totseq) {
- seq = NULL;
- } else {
- seq = bpi->seqdata.seqar[bpi->seqdata.seq];
- while (!SEQ_HAS_PATH(seq)) {
- bpi->seqdata.seq++;
+ while (bpi->seqdata.scene) {
+
+ if (bpi->seqdata.scene->ed) {
+ if (bpi->seqdata.seqar == NULL) {
+ /* allocate the sequencer array */
+ build_seqar( &(((Editing *)bpi->seqdata.scene->ed)->seqbase), &bpi->seqdata.seqar, &bpi->seqdata.totseq);
+ bpi->seqdata.seq = 0;
+ }
+
if (bpi->seqdata.seq >= bpi->seqdata.totseq) {
seq = NULL;
- break;
+ } else {
+ seq = bpi->seqdata.seqar[bpi->seqdata.seq];
+ while (!SEQ_HAS_PATH(seq)) {
+ bpi->seqdata.seq++;
+ if (bpi->seqdata.seq >= bpi->seqdata.totseq) {
+ seq = NULL;
+ break;
+ }
+ seq = bpi->seqdata.seqar[bpi->seqdata.seq];
+ }
+ }
+ if (seq) {
+ return seq;
+ } else {
+ /* keep looking through the next scene, reallocate seq array */
+ if (bpi->seqdata.seqar) {
+ MEM_freeN((void *)bpi->seqdata.seqar);
+ bpi->seqdata.seqar = NULL;
+ }
+ bpi->seqdata.scene = bpi->seqdata.scene->id.next;
}
- seq = bpi->seqdata.seqar[bpi->seqdata.seq];
+ } else {
+ /* no seq data in this scene, next */
+ bpi->seqdata.scene = bpi->seqdata.scene->id.next;
}
}
- return seq ;
+
+ return NULL;
}
void seq_getpath(struct BPathIterator *bpi, char *path) {
char filepath[FILE_MAX], *libpath;
int filesize, recur_depth;
- char dirname[FILE_MAX], filename[FILE_MAX], filename_new[FILE_MAX], dummyname[FILE_MAX];
+ char dirname[FILE_MAX], filename[FILE_MAX], filename_new[FILE_MAX];
waitcursor( 1 );
float g[512+2][3]= {
-0.33783,0.715698,-0.611206,-0.944031,-0.326599,-0.045624,-0.101074,-0.416443,-0.903503,0.799286,0.49411,-0.341949,-0.854645,0.518036,0.033936,0.42514,-0.437866,-0.792114,-0.358948,0.597046,0.717377,-0.985413,0.144714,0.089294,-0.601776,-0.33728,-0.723907,-0.449921,0.594513,0.666382,0.208313,-0.10791,
-0.972076,0.575317,0.060425,0.815643,0.293365,-0.875702,-0.383453,0.293762,0.465759,0.834686,-0.846008,-0.233398,-0.47934,-0.115814,0.143036,-0.98291,0.204681,-0.949036,-0.239532,0.946716,-0.263947,0.184326,-0.235596,0.573822,0.784332,0.203705,-0.372253,-0.905487,0.756989,-0.651031,0.055298,0.497803,
-0.814697,-0.297363,-0.16214,0.063995,-0.98468,-0.329254,0.834381,0.441925,0.703827,-0.527039,-0.476227,0.956421,0.266113,0.119781,0.480133,0.482849,0.7323,-0.18631,0.961212,-0.203125,-0.748474,-0.656921,-0.090393,-0.085052,-0.165253,0.982544,-0.76947,0.628174,-0.115234,0.383148,0.537659,0.751068,
-0.616486,-0.668488,-0.415924,-0.259979,-0.630005,0.73175,0.570953,-0.087952,0.816223,-0.458008,0.023254,0.888611,-0.196167,0.976563,-0.088287,-0.263885,-0.69812,-0.665527,0.437134,-0.892273,-0.112793,-0.621674,-0.230438,0.748566,0.232422,0.900574,-0.367249,0.22229,-0.796143,0.562744,-0.665497,-0.73764,
-0.11377,0.670135,0.704803,0.232605,0.895599,0.429749,-0.114655,-0.11557,-0.474243,0.872742,0.621826,0.604004,-0.498444,-0.832214,0.012756,0.55426,-0.702484,0.705994,-0.089661,-0.692017,0.649292,0.315399,-0.175995,-0.977997,0.111877,0.096954,-0.04953,0.994019,0.635284,-0.606689,-0.477783,-0.261261,
--0.607422,-0.750153,0.983276,0.165436,0.075958,-0.29837,0.404083,-0.864655,-0.638672,0.507721,0.578156,0.388214,0.412079,0.824249,0.556183,-0.208832,0.804352,0.778442,0.562012,0.27951,-0.616577,0.781921,-0.091522,0.196289,0.051056,0.979187,-0.121216,0.207153,-0.970734,-0.173401,-0.384735,0.906555,
-0.161499,-0.723236,-0.671387,0.178497,-0.006226,-0.983887,-0.126038,0.15799,0.97934,0.830475,-0.024811,0.556458,-0.510132,-0.76944,0.384247,0.81424,0.200104,-0.544891,-0.112549,-0.393311,-0.912445,0.56189,0.152222,-0.813049,0.198914,-0.254517,-0.946381,-0.41217,0.690979,-0.593811,-0.407257,0.324524,
-0.853668,-0.690186,0.366119,-0.624115,-0.428345,0.844147,-0.322296,-0.21228,-0.297546,-0.930756,-0.273071,0.516113,0.811798,0.928314,0.371643,0.007233,0.785828,-0.479218,-0.390778,-0.704895,0.058929,0.706818,0.173248,0.203583,0.963562,0.422211,-0.904297,-0.062469,-0.363312,-0.182465,0.913605,0.254028,
--0.552307,-0.793945,-0.28891,-0.765747,-0.574554,0.058319,0.291382,0.954803,0.946136,-0.303925,0.111267,-0.078156,0.443695,-0.892731,0.182098,0.89389,0.409515,-0.680298,-0.213318,0.701141,0.062469,0.848389,-0.525635,-0.72879,-0.641846,0.238342,-0.88089,0.427673,0.202637,-0.532501,-0.21405,0.818878,
-0.948975,-0.305084,0.07962,0.925446,0.374664,0.055817,0.820923,0.565491,0.079102,0.25882,0.099792,-0.960724,-0.294617,0.910522,0.289978,0.137115,0.320038,-0.937408,-0.908386,0.345276,-0.235718,-0.936218,0.138763,0.322754,0.366577,0.925934,-0.090637,0.309296,-0.686829,-0.657684,0.66983,0.024445,
-0.742065,-0.917999,-0.059113,-0.392059,0.365509,0.462158,-0.807922,0.083374,0.996399,-0.014801,0.593842,0.253143,-0.763672,0.974976,-0.165466,0.148285,0.918976,0.137299,0.369537,0.294952,0.694977,0.655731,0.943085,0.152618,-0.295319,0.58783,-0.598236,0.544495,0.203796,0.678223,0.705994,-0.478821,
--0.661011,0.577667,0.719055,-0.1698,-0.673828,-0.132172,-0.965332,0.225006,-0.981873,-0.14502,0.121979,0.763458,0.579742,0.284546,-0.893188,0.079681,0.442474,-0.795776,-0.523804,0.303802,0.734955,0.67804,-0.007446,0.15506,0.986267,-0.056183,0.258026,0.571503,-0.778931,-0.681549,-0.702087,-0.206116,
--0.96286,-0.177185,0.203613,-0.470978,-0.515106,0.716095,-0.740326,0.57135,0.354095,-0.56012,-0.824982,-0.074982,-0.507874,0.753204,0.417969,-0.503113,0.038147,0.863342,0.594025,0.673553,-0.439758,-0.119873,-0.005524,-0.992737,0.098267,-0.213776,0.971893,-0.615631,0.643951,0.454163,0.896851,-0.441071,
-0.032166,-0.555023,0.750763,-0.358093,0.398773,0.304688,0.864929,-0.722961,0.303589,0.620544,-0.63559,-0.621948,-0.457306,-0.293243,0.072327,0.953278,-0.491638,0.661041,-0.566772,-0.304199,-0.572083,-0.761688,0.908081,-0.398956,0.127014,-0.523621,-0.549683,-0.650848,-0.932922,-0.19986,0.299408,0.099426,
-0.140869,0.984985,-0.020325,-0.999756,-0.002319,0.952667,0.280853,-0.11615,-0.971893,0.082581,0.220337,0.65921,0.705292,-0.260651,0.733063,-0.175537,0.657043,-0.555206,0.429504,-0.712189,0.400421,-0.89859,0.179352,0.750885,-0.19696,0.630341,0.785675,-0.569336,0.241821,-0.058899,-0.464111,0.883789,
-0.129608,-0.94519,0.299622,-0.357819,0.907654,0.219238,-0.842133,-0.439117,-0.312927,-0.313477,0.84433,0.434479,-0.241211,0.053253,0.968994,0.063873,0.823273,0.563965,0.476288,0.862152,-0.172516,0.620941,-0.298126,0.724915,0.25238,-0.749359,-0.612122,-0.577545,0.386566,0.718994,-0.406342,-0.737976,
-0.538696,0.04718,0.556305,0.82959,-0.802856,0.587463,0.101166,-0.707733,-0.705963,0.026428,0.374908,0.68457,0.625092,0.472137,0.208405,-0.856506,-0.703064,-0.581085,-0.409821,-0.417206,-0.736328,0.532623,-0.447876,-0.20285,-0.870728,0.086945,-0.990417,0.107086,0.183685,0.018341,-0.982788,0.560638,
--0.428864,0.708282,0.296722,-0.952576,-0.0672,0.135773,0.990265,0.030243,-0.068787,0.654724,0.752686,0.762604,-0.551758,0.337585,-0.819611,-0.407684,0.402466,-0.727844,-0.55072,-0.408539,-0.855774,-0.480011,0.19281,0.693176,-0.079285,0.716339,0.226013,0.650116,-0.725433,0.246704,0.953369,-0.173553,
--0.970398,-0.239227,-0.03244,0.136383,-0.394318,0.908752,0.813232,0.558167,0.164368,0.40451,0.549042,-0.731323,-0.380249,-0.566711,0.730865,0.022156,0.932739,0.359741,0.00824,0.996552,-0.082306,0.956635,-0.065338,-0.283722,-0.743561,0.008209,0.668579,-0.859589,-0.509674,0.035767,-0.852234,0.363678,
--0.375977,-0.201965,-0.970795,-0.12915,0.313477,0.947327,0.06546,-0.254028,-0.528259,0.81015,0.628052,0.601105,0.49411,-0.494385,0.868378,0.037933,0.275635,-0.086426,0.957336,-0.197937,0.468903,-0.860748,0.895599,0.399384,0.195801,0.560791,0.825012,-0.069214,0.304199,-0.849487,0.43103,0.096375,
-0.93576,0.339111,-0.051422,0.408966,-0.911072,0.330444,0.942841,-0.042389,-0.452362,-0.786407,0.420563,0.134308,-0.933472,-0.332489,0.80191,-0.566711,-0.188934,-0.987946,-0.105988,0.112518,-0.24408,0.892242,-0.379791,-0.920502,0.229095,-0.316376,0.7789,0.325958,0.535706,-0.912872,0.185211,-0.36377,
--0.184784,0.565369,-0.803833,-0.018463,0.119537,0.992615,-0.259247,-0.935608,0.239532,-0.82373,-0.449127,-0.345947,-0.433105,0.659515,0.614349,-0.822754,0.378845,-0.423676,0.687195,-0.674835,-0.26889,-0.246582,-0.800842,0.545715,-0.729187,-0.207794,0.651978,0.653534,-0.610443,-0.447388,0.492584,-0.023346,
-0.869934,0.609039,0.009094,-0.79306,0.962494,-0.271088,-0.00885,0.2659,-0.004913,0.963959,0.651245,0.553619,-0.518951,0.280548,-0.84314,0.458618,-0.175293,-0.983215,0.049805,0.035339,-0.979919,0.196045,-0.982941,0.164307,-0.082245,0.233734,-0.97226,-0.005005,-0.747253,-0.611328,0.260437,0.645599,
-0.592773,0.481384,0.117706,-0.949524,-0.29068,-0.535004,-0.791901,-0.294312,-0.627167,-0.214447,0.748718,-0.047974,-0.813477,-0.57959,-0.175537,0.477264,-0.860992,0.738556,-0.414246,-0.53183,0.562561,-0.704071,0.433289,-0.754944,0.64801,-0.100586,0.114716,0.044525,-0.992371,0.966003,0.244873,-0.082764,
-0.33783,0.715698,-0.611206,-0.944031,-0.326599,-0.045624,-0.101074,-0.416443,-0.903503,0.799286,0.49411,-0.341949,-0.854645,0.518036,0.033936,0.42514,-0.437866,-0.792114,-0.358948,0.597046,0.717377,-0.985413,0.144714,0.089294,-0.601776,-0.33728,-0.723907,-0.449921,0.594513,0.666382,0.208313,-0.10791,
-0.972076,0.575317,0.060425,0.815643,0.293365,-0.875702,-0.383453,0.293762,0.465759,0.834686,-0.846008,-0.233398,-0.47934,-0.115814,0.143036,-0.98291,0.204681,-0.949036,-0.239532,0.946716,-0.263947,0.184326,-0.235596,0.573822,0.784332,0.203705,-0.372253,-0.905487,0.756989,-0.651031,0.055298,0.497803,
-0.814697,-0.297363,-0.16214,0.063995,-0.98468,-0.329254,0.834381,0.441925,0.703827,-0.527039,-0.476227,0.956421,0.266113,0.119781,0.480133,0.482849,0.7323,-0.18631,0.961212,-0.203125,-0.748474,-0.656921,-0.090393,-0.085052,-0.165253,0.982544,-0.76947,0.628174,-0.115234,0.383148,0.537659,0.751068,
-0.616486,-0.668488,-0.415924,-0.259979,-0.630005,0.73175,0.570953,-0.087952,0.816223,-0.458008,0.023254,0.888611,-0.196167,0.976563,-0.088287,-0.263885,-0.69812,-0.665527,0.437134,-0.892273,-0.112793,-0.621674,-0.230438,0.748566,0.232422,0.900574,-0.367249,0.22229,-0.796143,0.562744,-0.665497,-0.73764,
-0.11377,0.670135,0.704803,0.232605,0.895599,0.429749,-0.114655,-0.11557,-0.474243,0.872742,0.621826,0.604004,-0.498444,-0.832214,0.012756,0.55426,-0.702484,0.705994,-0.089661,-0.692017,0.649292,0.315399,-0.175995,-0.977997,0.111877,0.096954,-0.04953,0.994019,0.635284,-0.606689,-0.477783,-0.261261,
--0.607422,-0.750153,0.983276,0.165436,0.075958,-0.29837,0.404083,-0.864655,-0.638672,0.507721,0.578156,0.388214,0.412079,0.824249,0.556183,-0.208832,0.804352,0.778442,0.562012,0.27951,-0.616577,0.781921,-0.091522,0.196289,0.051056,0.979187,-0.121216,0.207153,-0.970734,-0.173401,-0.384735,0.906555,
-0.161499,-0.723236,-0.671387,0.178497,-0.006226,-0.983887,-0.126038,0.15799,0.97934,0.830475,-0.024811,0.556458,-0.510132,-0.76944,0.384247,0.81424,0.200104,-0.544891,-0.112549,-0.393311,-0.912445,0.56189,0.152222,-0.813049,0.198914,-0.254517,-0.946381,-0.41217,0.690979,-0.593811,-0.407257,0.324524,
-0.853668,-0.690186,0.366119,-0.624115,-0.428345,0.844147,-0.322296,-0.21228,-0.297546,-0.930756,-0.273071,0.516113,0.811798,0.928314,0.371643,0.007233,0.785828,-0.479218,-0.390778,-0.704895,0.058929,0.706818,0.173248,0.203583,0.963562,0.422211,-0.904297,-0.062469,-0.363312,-0.182465,0.913605,0.254028,
--0.552307,-0.793945,-0.28891,-0.765747,-0.574554,0.058319,0.291382,0.954803,0.946136,-0.303925,0.111267,-0.078156,0.443695,-0.892731,0.182098,0.89389,0.409515,-0.680298,-0.213318,0.701141,0.062469,0.848389,-0.525635,-0.72879,-0.641846,0.238342,-0.88089,0.427673,0.202637,-0.532501,-0.21405,0.818878,
-0.948975,-0.305084,0.07962,0.925446,0.374664,0.055817,0.820923,0.565491,0.079102,0.25882,0.099792,-0.960724,-0.294617,0.910522,0.289978,0.137115,0.320038,-0.937408,-0.908386,0.345276,-0.235718,-0.936218,0.138763,0.322754,0.366577,0.925934,-0.090637,0.309296,-0.686829,-0.657684,0.66983,0.024445,
-0.742065,-0.917999,-0.059113,-0.392059,0.365509,0.462158,-0.807922,0.083374,0.996399,-0.014801,0.593842,0.253143,-0.763672,0.974976,-0.165466,0.148285,0.918976,0.137299,0.369537,0.294952,0.694977,0.655731,0.943085,0.152618,-0.295319,0.58783,-0.598236,0.544495,0.203796,0.678223,0.705994,-0.478821,
--0.661011,0.577667,0.719055,-0.1698,-0.673828,-0.132172,-0.965332,0.225006,-0.981873,-0.14502,0.121979,0.763458,0.579742,0.284546,-0.893188,0.079681,0.442474,-0.795776,-0.523804,0.303802,0.734955,0.67804,-0.007446,0.15506,0.986267,-0.056183,0.258026,0.571503,-0.778931,-0.681549,-0.702087,-0.206116,
--0.96286,-0.177185,0.203613,-0.470978,-0.515106,0.716095,-0.740326,0.57135,0.354095,-0.56012,-0.824982,-0.074982,-0.507874,0.753204,0.417969,-0.503113,0.038147,0.863342,0.594025,0.673553,-0.439758,-0.119873,-0.005524,-0.992737,0.098267,-0.213776,0.971893,-0.615631,0.643951,0.454163,0.896851,-0.441071,
-0.032166,-0.555023,0.750763,-0.358093,0.398773,0.304688,0.864929,-0.722961,0.303589,0.620544,-0.63559,-0.621948,-0.457306,-0.293243,0.072327,0.953278,-0.491638,0.661041,-0.566772,-0.304199,-0.572083,-0.761688,0.908081,-0.398956,0.127014,-0.523621,-0.549683,-0.650848,-0.932922,-0.19986,0.299408,0.099426,
-0.140869,0.984985,-0.020325,-0.999756,-0.002319,0.952667,0.280853,-0.11615,-0.971893,0.082581,0.220337,0.65921,0.705292,-0.260651,0.733063,-0.175537,0.657043,-0.555206,0.429504,-0.712189,0.400421,-0.89859,0.179352,0.750885,-0.19696,0.630341,0.785675,-0.569336,0.241821,-0.058899,-0.464111,0.883789,
-0.129608,-0.94519,0.299622,-0.357819,0.907654,0.219238,-0.842133,-0.439117,-0.312927,-0.313477,0.84433,0.434479,-0.241211,0.053253,0.968994,0.063873,0.823273,0.563965,0.476288,0.862152,-0.172516,0.620941,-0.298126,0.724915,0.25238,-0.749359,-0.612122,-0.577545,0.386566,0.718994,-0.406342,-0.737976,
-0.538696,0.04718,0.556305,0.82959,-0.802856,0.587463,0.101166,-0.707733,-0.705963,0.026428,0.374908,0.68457,0.625092,0.472137,0.208405,-0.856506,-0.703064,-0.581085,-0.409821,-0.417206,-0.736328,0.532623,-0.447876,-0.20285,-0.870728,0.086945,-0.990417,0.107086,0.183685,0.018341,-0.982788,0.560638,
--0.428864,0.708282,0.296722,-0.952576,-0.0672,0.135773,0.990265,0.030243,-0.068787,0.654724,0.752686,0.762604,-0.551758,0.337585,-0.819611,-0.407684,0.402466,-0.727844,-0.55072,-0.408539,-0.855774,-0.480011,0.19281,0.693176,-0.079285,0.716339,0.226013,0.650116,-0.725433,0.246704,0.953369,-0.173553,
--0.970398,-0.239227,-0.03244,0.136383,-0.394318,0.908752,0.813232,0.558167,0.164368,0.40451,0.549042,-0.731323,-0.380249,-0.566711,0.730865,0.022156,0.932739,0.359741,0.00824,0.996552,-0.082306,0.956635,-0.065338,-0.283722,-0.743561,0.008209,0.668579,-0.859589,-0.509674,0.035767,-0.852234,0.363678,
--0.375977,-0.201965,-0.970795,-0.12915,0.313477,0.947327,0.06546,-0.254028,-0.528259,0.81015,0.628052,0.601105,0.49411,-0.494385,0.868378,0.037933,0.275635,-0.086426,0.957336,-0.197937,0.468903,-0.860748,0.895599,0.399384,0.195801,0.560791,0.825012,-0.069214,0.304199,-0.849487,0.43103,0.096375,
-0.93576,0.339111,-0.051422,0.408966,-0.911072,0.330444,0.942841,-0.042389,-0.452362,-0.786407,0.420563,0.134308,-0.933472,-0.332489,0.80191,-0.566711,-0.188934,-0.987946,-0.105988,0.112518,-0.24408,0.892242,-0.379791,-0.920502,0.229095,-0.316376,0.7789,0.325958,0.535706,-0.912872,0.185211,-0.36377,
--0.184784,0.565369,-0.803833,-0.018463,0.119537,0.992615,-0.259247,-0.935608,0.239532,-0.82373,-0.449127,-0.345947,-0.433105,0.659515,0.614349,-0.822754,0.378845,-0.423676,0.687195,-0.674835,-0.26889,-0.246582,-0.800842,0.545715,-0.729187,-0.207794,0.651978,0.653534,-0.610443,-0.447388,0.492584,-0.023346,
-0.869934,0.609039,0.009094,-0.79306,0.962494,-0.271088,-0.00885,0.2659,-0.004913,0.963959,0.651245,0.553619,-0.518951,0.280548,-0.84314,0.458618,-0.175293,-0.983215,0.049805,0.035339,-0.979919,0.196045,-0.982941,0.164307,-0.082245,0.233734,-0.97226,-0.005005,-0.747253,-0.611328,0.260437,0.645599,
-0.592773,0.481384,0.117706,-0.949524,-0.29068,-0.535004,-0.791901,-0.294312,-0.627167,-0.214447,0.748718,-0.047974,-0.813477,-0.57959,-0.175537,0.477264,-0.860992,0.738556,-0.414246,-0.53183,0.562561,-0.704071,0.433289,-0.754944,0.64801,-0.100586,0.114716,0.044525,-0.992371,0.966003,0.244873,-0.082764,
-0.33783,0.715698,-0.611206,-0.944031,-0.326599,-0.045624};
+ {0.33783, 0.715698, -0.611206},
+ {-0.944031, -0.326599, -0.045624},
+ {-0.101074, -0.416443, -0.903503},
+ {0.799286, 0.49411, -0.341949},
+ {-0.854645, 0.518036, 0.033936},
+ {0.42514, -0.437866, -0.792114},
+ {-0.358948, 0.597046, 0.717377},
+ {-0.985413, 0.144714, 0.089294},
+ {-0.601776, -0.33728, -0.723907},
+ {-0.449921, 0.594513, 0.666382},
+ {0.208313, -0.10791, 0.972076},
+ {0.575317, 0.060425, 0.815643},
+ {0.293365, -0.875702, -0.383453},
+ {0.293762, 0.465759, 0.834686},
+ {-0.846008, -0.233398, -0.47934},
+ {-0.115814, 0.143036, -0.98291},
+ {0.204681, -0.949036, -0.239532},
+ {0.946716, -0.263947, 0.184326},
+ {-0.235596, 0.573822, 0.784332},
+ {0.203705, -0.372253, -0.905487},
+ {0.756989, -0.651031, 0.055298},
+ {0.497803, 0.814697, -0.297363},
+ {-0.16214, 0.063995, -0.98468},
+ {-0.329254, 0.834381, 0.441925},
+ {0.703827, -0.527039, -0.476227},
+ {0.956421, 0.266113, 0.119781},
+ {0.480133, 0.482849, 0.7323},
+ {-0.18631, 0.961212, -0.203125},
+ {-0.748474, -0.656921, -0.090393},
+ {-0.085052, -0.165253, 0.982544},
+ {-0.76947, 0.628174, -0.115234},
+ {0.383148, 0.537659, 0.751068},
+ {0.616486, -0.668488, -0.415924},
+ {-0.259979, -0.630005, 0.73175},
+ {0.570953, -0.087952, 0.816223},
+ {-0.458008, 0.023254, 0.888611},
+ {-0.196167, 0.976563, -0.088287},
+ {-0.263885, -0.69812, -0.665527},
+ {0.437134, -0.892273, -0.112793},
+ {-0.621674, -0.230438, 0.748566},
+ {0.232422, 0.900574, -0.367249},
+ {0.22229, -0.796143, 0.562744},
+ {-0.665497, -0.73764, 0.11377},
+ {0.670135, 0.704803, 0.232605},
+ {0.895599, 0.429749, -0.114655},
+ {-0.11557, -0.474243, 0.872742},
+ {0.621826, 0.604004, -0.498444},
+ {-0.832214, 0.012756, 0.55426},
+ {-0.702484, 0.705994, -0.089661},
+ {-0.692017, 0.649292, 0.315399},
+ {-0.175995, -0.977997, 0.111877},
+ {0.096954, -0.04953, 0.994019},
+ {0.635284, -0.606689, -0.477783},
+ {-0.261261, -0.607422, -0.750153},
+ {0.983276, 0.165436, 0.075958},
+ {-0.29837, 0.404083, -0.864655},
+ {-0.638672, 0.507721, 0.578156},
+ {0.388214, 0.412079, 0.824249},
+ {0.556183, -0.208832, 0.804352},
+ {0.778442, 0.562012, 0.27951},
+ {-0.616577, 0.781921, -0.091522},
+ {0.196289, 0.051056, 0.979187},
+ {-0.121216, 0.207153, -0.970734},
+ {-0.173401, -0.384735, 0.906555},
+ {0.161499, -0.723236, -0.671387},
+ {0.178497, -0.006226, -0.983887},
+ {-0.126038, 0.15799, 0.97934},
+ {0.830475, -0.024811, 0.556458},
+ {-0.510132, -0.76944, 0.384247},
+ {0.81424, 0.200104, -0.544891},
+ {-0.112549, -0.393311, -0.912445},
+ {0.56189, 0.152222, -0.813049},
+ {0.198914, -0.254517, -0.946381},
+ {-0.41217, 0.690979, -0.593811},
+ {-0.407257, 0.324524, 0.853668},
+ {-0.690186, 0.366119, -0.624115},
+ {-0.428345, 0.844147, -0.322296},
+ {-0.21228, -0.297546, -0.930756},
+ {-0.273071, 0.516113, 0.811798},
+ {0.928314, 0.371643, 0.007233},
+ {0.785828, -0.479218, -0.390778},
+ {-0.704895, 0.058929, 0.706818},
+ {0.173248, 0.203583, 0.963562},
+ {0.422211, -0.904297, -0.062469},
+ {-0.363312, -0.182465, 0.913605},
+ {0.254028, -0.552307, -0.793945},
+ {-0.28891, -0.765747, -0.574554},
+ {0.058319, 0.291382, 0.954803},
+ {0.946136, -0.303925, 0.111267},
+ {-0.078156, 0.443695, -0.892731},
+ {0.182098, 0.89389, 0.409515},
+ {-0.680298, -0.213318, 0.701141},
+ {0.062469, 0.848389, -0.525635},
+ {-0.72879, -0.641846, 0.238342},
+ {-0.88089, 0.427673, 0.202637},
+ {-0.532501, -0.21405, 0.818878},
+ {0.948975, -0.305084, 0.07962},
+ {0.925446, 0.374664, 0.055817},
+ {0.820923, 0.565491, 0.079102},
+ {0.25882, 0.099792, -0.960724},
+ {-0.294617, 0.910522, 0.289978},
+ {0.137115, 0.320038, -0.937408},
+ {-0.908386, 0.345276, -0.235718},
+ {-0.936218, 0.138763, 0.322754},
+ {0.366577, 0.925934, -0.090637},
+ {0.309296, -0.686829, -0.657684},
+ {0.66983, 0.024445, 0.742065},
+ {-0.917999, -0.059113, -0.392059},
+ {0.365509, 0.462158, -0.807922},
+ {0.083374, 0.996399, -0.014801},
+ {0.593842, 0.253143, -0.763672},
+ {0.974976, -0.165466, 0.148285},
+ {0.918976, 0.137299, 0.369537},
+ {0.294952, 0.694977, 0.655731},
+ {0.943085, 0.152618, -0.295319},
+ {0.58783, -0.598236, 0.544495},
+ {0.203796, 0.678223, 0.705994},
+ {-0.478821, -0.661011, 0.577667},
+ {0.719055, -0.1698, -0.673828},
+ {-0.132172, -0.965332, 0.225006},
+ {-0.981873, -0.14502, 0.121979},
+ {0.763458, 0.579742, 0.284546},
+ {-0.893188, 0.079681, 0.442474},
+ {-0.795776, -0.523804, 0.303802},
+ {0.734955, 0.67804, -0.007446},
+ {0.15506, 0.986267, -0.056183},
+ {0.258026, 0.571503, -0.778931},
+ {-0.681549, -0.702087, -0.206116},
+ {-0.96286, -0.177185, 0.203613},
+ {-0.470978, -0.515106, 0.716095},
+ {-0.740326, 0.57135, 0.354095},
+ {-0.56012, -0.824982, -0.074982},
+ {-0.507874, 0.753204, 0.417969},
+ {-0.503113, 0.038147, 0.863342},
+ {0.594025, 0.673553, -0.439758},
+ {-0.119873, -0.005524, -0.992737},
+ {0.098267, -0.213776, 0.971893},
+ {-0.615631, 0.643951, 0.454163},
+ {0.896851, -0.441071, 0.032166},
+ {-0.555023, 0.750763, -0.358093},
+ {0.398773, 0.304688, 0.864929},
+ {-0.722961, 0.303589, 0.620544},
+ {-0.63559, -0.621948, -0.457306},
+ {-0.293243, 0.072327, 0.953278},
+ {-0.491638, 0.661041, -0.566772},
+ {-0.304199, -0.572083, -0.761688},
+ {0.908081, -0.398956, 0.127014},
+ {-0.523621, -0.549683, -0.650848},
+ {-0.932922, -0.19986, 0.299408},
+ {0.099426, 0.140869, 0.984985},
+ {-0.020325, -0.999756, -0.002319},
+ {0.952667, 0.280853, -0.11615},
+ {-0.971893, 0.082581, 0.220337},
+ {0.65921, 0.705292, -0.260651},
+ {0.733063, -0.175537, 0.657043},
+ {-0.555206, 0.429504, -0.712189},
+ {0.400421, -0.89859, 0.179352},
+ {0.750885, -0.19696, 0.630341},
+ {0.785675, -0.569336, 0.241821},
+ {-0.058899, -0.464111, 0.883789},
+ {0.129608, -0.94519, 0.299622},
+ {-0.357819, 0.907654, 0.219238},
+ {-0.842133, -0.439117, -0.312927},
+ {-0.313477, 0.84433, 0.434479},
+ {-0.241211, 0.053253, 0.968994},
+ {0.063873, 0.823273, 0.563965},
+ {0.476288, 0.862152, -0.172516},
+ {0.620941, -0.298126, 0.724915},
+ {0.25238, -0.749359, -0.612122},
+ {-0.577545, 0.386566, 0.718994},
+ {-0.406342, -0.737976, 0.538696},
+ {0.04718, 0.556305, 0.82959},
+ {-0.802856, 0.587463, 0.101166},
+ {-0.707733, -0.705963, 0.026428},
+ {0.374908, 0.68457, 0.625092},
+ {0.472137, 0.208405, -0.856506},
+ {-0.703064, -0.581085, -0.409821},
+ {-0.417206, -0.736328, 0.532623},
+ {-0.447876, -0.20285, -0.870728},
+ {0.086945, -0.990417, 0.107086},
+ {0.183685, 0.018341, -0.982788},
+ {0.560638, -0.428864, 0.708282},
+ {0.296722, -0.952576, -0.0672},
+ {0.135773, 0.990265, 0.030243},
+ {-0.068787, 0.654724, 0.752686},
+ {0.762604, -0.551758, 0.337585},
+ {-0.819611, -0.407684, 0.402466},
+ {-0.727844, -0.55072, -0.408539},
+ {-0.855774, -0.480011, 0.19281},
+ {0.693176, -0.079285, 0.716339},
+ {0.226013, 0.650116, -0.725433},
+ {0.246704, 0.953369, -0.173553},
+ {-0.970398, -0.239227, -0.03244},
+ {0.136383, -0.394318, 0.908752},
+ {0.813232, 0.558167, 0.164368},
+ {0.40451, 0.549042, -0.731323},
+ {-0.380249, -0.566711, 0.730865},
+ {0.022156, 0.932739, 0.359741},
+ {0.00824, 0.996552, -0.082306},
+ {0.956635, -0.065338, -0.283722},
+ {-0.743561, 0.008209, 0.668579},
+ {-0.859589, -0.509674, 0.035767},
+ {-0.852234, 0.363678, -0.375977},
+ {-0.201965, -0.970795, -0.12915},
+ {0.313477, 0.947327, 0.06546},
+ {-0.254028, -0.528259, 0.81015},
+ {0.628052, 0.601105, 0.49411},
+ {-0.494385, 0.868378, 0.037933},
+ {0.275635, -0.086426, 0.957336},
+ {-0.197937, 0.468903, -0.860748},
+ {0.895599, 0.399384, 0.195801},
+ {0.560791, 0.825012, -0.069214},
+ {0.304199, -0.849487, 0.43103},
+ {0.096375, 0.93576, 0.339111},
+ {-0.051422, 0.408966, -0.911072},
+ {0.330444, 0.942841, -0.042389},
+ {-0.452362, -0.786407, 0.420563},
+ {0.134308, -0.933472, -0.332489},
+ {0.80191, -0.566711, -0.188934},
+ {-0.987946, -0.105988, 0.112518},
+ {-0.24408, 0.892242, -0.379791},
+ {-0.920502, 0.229095, -0.316376},
+ {0.7789, 0.325958, 0.535706},
+ {-0.912872, 0.185211, -0.36377},
+ {-0.184784, 0.565369, -0.803833},
+ {-0.018463, 0.119537, 0.992615},
+ {-0.259247, -0.935608, 0.239532},
+ {-0.82373, -0.449127, -0.345947},
+ {-0.433105, 0.659515, 0.614349},
+ {-0.822754, 0.378845, -0.423676},
+ {0.687195, -0.674835, -0.26889},
+ {-0.246582, -0.800842, 0.545715},
+ {-0.729187, -0.207794, 0.651978},
+ {0.653534, -0.610443, -0.447388},
+ {0.492584, -0.023346, 0.869934},
+ {0.609039, 0.009094, -0.79306},
+ {0.962494, -0.271088, -0.00885},
+ {0.2659, -0.004913, 0.963959},
+ {0.651245, 0.553619, -0.518951},
+ {0.280548, -0.84314, 0.458618},
+ {-0.175293, -0.983215, 0.049805},
+ {0.035339, -0.979919, 0.196045},
+ {-0.982941, 0.164307, -0.082245},
+ {0.233734, -0.97226, -0.005005},
+ {-0.747253, -0.611328, 0.260437},
+ {0.645599, 0.592773, 0.481384},
+ {0.117706, -0.949524, -0.29068},
+ {-0.535004, -0.791901, -0.294312},
+ {-0.627167, -0.214447, 0.748718},
+ {-0.047974, -0.813477, -0.57959},
+ {-0.175537, 0.477264, -0.860992},
+ {0.738556, -0.414246, -0.53183},
+ {0.562561, -0.704071, 0.433289},
+ {-0.754944, 0.64801, -0.100586},
+ {0.114716, 0.044525, -0.992371},
+ {0.966003, 0.244873, -0.082764},
+ {0.33783, 0.715698, -0.611206},
+ {-0.944031, -0.326599, -0.045624},
+ {-0.101074, -0.416443, -0.903503},
+ {0.799286, 0.49411, -0.341949},
+ {-0.854645, 0.518036, 0.033936},
+ {0.42514, -0.437866, -0.792114},
+ {-0.358948, 0.597046, 0.717377},
+ {-0.985413, 0.144714, 0.089294},
+ {-0.601776, -0.33728, -0.723907},
+ {-0.449921, 0.594513, 0.666382},
+ {0.208313, -0.10791, 0.972076},
+ {0.575317, 0.060425, 0.815643},
+ {0.293365, -0.875702, -0.383453},
+ {0.293762, 0.465759, 0.834686},
+ {-0.846008, -0.233398, -0.47934},
+ {-0.115814, 0.143036, -0.98291},
+ {0.204681, -0.949036, -0.239532},
+ {0.946716, -0.263947, 0.184326},
+ {-0.235596, 0.573822, 0.784332},
+ {0.203705, -0.372253, -0.905487},
+ {0.756989, -0.651031, 0.055298},
+ {0.497803, 0.814697, -0.297363},
+ {-0.16214, 0.063995, -0.98468},
+ {-0.329254, 0.834381, 0.441925},
+ {0.703827, -0.527039, -0.476227},
+ {0.956421, 0.266113, 0.119781},
+ {0.480133, 0.482849, 0.7323},
+ {-0.18631, 0.961212, -0.203125},
+ {-0.748474, -0.656921, -0.090393},
+ {-0.085052, -0.165253, 0.982544},
+ {-0.76947, 0.628174, -0.115234},
+ {0.383148, 0.537659, 0.751068},
+ {0.616486, -0.668488, -0.415924},
+ {-0.259979, -0.630005, 0.73175},
+ {0.570953, -0.087952, 0.816223},
+ {-0.458008, 0.023254, 0.888611},
+ {-0.196167, 0.976563, -0.088287},
+ {-0.263885, -0.69812, -0.665527},
+ {0.437134, -0.892273, -0.112793},
+ {-0.621674, -0.230438, 0.748566},
+ {0.232422, 0.900574, -0.367249},
+ {0.22229, -0.796143, 0.562744},
+ {-0.665497, -0.73764, 0.11377},
+ {0.670135, 0.704803, 0.232605},
+ {0.895599, 0.429749, -0.114655},
+ {-0.11557, -0.474243, 0.872742},
+ {0.621826, 0.604004, -0.498444},
+ {-0.832214, 0.012756, 0.55426},
+ {-0.702484, 0.705994, -0.089661},
+ {-0.692017, 0.649292, 0.315399},
+ {-0.175995, -0.977997, 0.111877},
+ {0.096954, -0.04953, 0.994019},
+ {0.635284, -0.606689, -0.477783},
+ {-0.261261, -0.607422, -0.750153},
+ {0.983276, 0.165436, 0.075958},
+ {-0.29837, 0.404083, -0.864655},
+ {-0.638672, 0.507721, 0.578156},
+ {0.388214, 0.412079, 0.824249},
+ {0.556183, -0.208832, 0.804352},
+ {0.778442, 0.562012, 0.27951},
+ {-0.616577, 0.781921, -0.091522},
+ {0.196289, 0.051056, 0.979187},
+ {-0.121216, 0.207153, -0.970734},
+ {-0.173401, -0.384735, 0.906555},
+ {0.161499, -0.723236, -0.671387},
+ {0.178497, -0.006226, -0.983887},
+ {-0.126038, 0.15799, 0.97934},
+ {0.830475, -0.024811, 0.556458},
+ {-0.510132, -0.76944, 0.384247},
+ {0.81424, 0.200104, -0.544891},
+ {-0.112549, -0.393311, -0.912445},
+ {0.56189, 0.152222, -0.813049},
+ {0.198914, -0.254517, -0.946381},
+ {-0.41217, 0.690979, -0.593811},
+ {-0.407257, 0.324524, 0.853668},
+ {-0.690186, 0.366119, -0.624115},
+ {-0.428345, 0.844147, -0.322296},
+ {-0.21228, -0.297546, -0.930756},
+ {-0.273071, 0.516113, 0.811798},
+ {0.928314, 0.371643, 0.007233},
+ {0.785828, -0.479218, -0.390778},
+ {-0.704895, 0.058929, 0.706818},
+ {0.173248, 0.203583, 0.963562},
+ {0.422211, -0.904297, -0.062469},
+ {-0.363312, -0.182465, 0.913605},
+ {0.254028, -0.552307, -0.793945},
+ {-0.28891, -0.765747, -0.574554},
+ {0.058319, 0.291382, 0.954803},
+ {0.946136, -0.303925, 0.111267},
+ {-0.078156, 0.443695, -0.892731},
+ {0.182098, 0.89389, 0.409515},
+ {-0.680298, -0.213318, 0.701141},
+ {0.062469, 0.848389, -0.525635},
+ {-0.72879, -0.641846, 0.238342},
+ {-0.88089, 0.427673, 0.202637},
+ {-0.532501, -0.21405, 0.818878},
+ {0.948975, -0.305084, 0.07962},
+ {0.925446, 0.374664, 0.055817},
+ {0.820923, 0.565491, 0.079102},
+ {0.25882, 0.099792, -0.960724},
+ {-0.294617, 0.910522, 0.289978},
+ {0.137115, 0.320038, -0.937408},
+ {-0.908386, 0.345276, -0.235718},
+ {-0.936218, 0.138763, 0.322754},
+ {0.366577, 0.925934, -0.090637},
+ {0.309296, -0.686829, -0.657684},
+ {0.66983, 0.024445, 0.742065},
+ {-0.917999, -0.059113, -0.392059},
+ {0.365509, 0.462158, -0.807922},
+ {0.083374, 0.996399, -0.014801},
+ {0.593842, 0.253143, -0.763672},
+ {0.974976, -0.165466, 0.148285},
+ {0.918976, 0.137299, 0.369537},
+ {0.294952, 0.694977, 0.655731},
+ {0.943085, 0.152618, -0.295319},
+ {0.58783, -0.598236, 0.544495},
+ {0.203796, 0.678223, 0.705994},
+ {-0.478821, -0.661011, 0.577667},
+ {0.719055, -0.1698, -0.673828},
+ {-0.132172, -0.965332, 0.225006},
+ {-0.981873, -0.14502, 0.121979},
+ {0.763458, 0.579742, 0.284546},
+ {-0.893188, 0.079681, 0.442474},
+ {-0.795776, -0.523804, 0.303802},
+ {0.734955, 0.67804, -0.007446},
+ {0.15506, 0.986267, -0.056183},
+ {0.258026, 0.571503, -0.778931},
+ {-0.681549, -0.702087, -0.206116},
+ {-0.96286, -0.177185, 0.203613},
+ {-0.470978, -0.515106, 0.716095},
+ {-0.740326, 0.57135, 0.354095},
+ {-0.56012, -0.824982, -0.074982},
+ {-0.507874, 0.753204, 0.417969},
+ {-0.503113, 0.038147, 0.863342},
+ {0.594025, 0.673553, -0.439758},
+ {-0.119873, -0.005524, -0.992737},
+ {0.098267, -0.213776, 0.971893},
+ {-0.615631, 0.643951, 0.454163},
+ {0.896851, -0.441071, 0.032166},
+ {-0.555023, 0.750763, -0.358093},
+ {0.398773, 0.304688, 0.864929},
+ {-0.722961, 0.303589, 0.620544},
+ {-0.63559, -0.621948, -0.457306},
+ {-0.293243, 0.072327, 0.953278},
+ {-0.491638, 0.661041, -0.566772},
+ {-0.304199, -0.572083, -0.761688},
+ {0.908081, -0.398956, 0.127014},
+ {-0.523621, -0.549683, -0.650848},
+ {-0.932922, -0.19986, 0.299408},
+ {0.099426, 0.140869, 0.984985},
+ {-0.020325, -0.999756, -0.002319},
+ {0.952667, 0.280853, -0.11615},
+ {-0.971893, 0.082581, 0.220337},
+ {0.65921, 0.705292, -0.260651},
+ {0.733063, -0.175537, 0.657043},
+ {-0.555206, 0.429504, -0.712189},
+ {0.400421, -0.89859, 0.179352},
+ {0.750885, -0.19696, 0.630341},
+ {0.785675, -0.569336, 0.241821},
+ {-0.058899, -0.464111, 0.883789},
+ {0.129608, -0.94519, 0.299622},
+ {-0.357819, 0.907654, 0.219238},
+ {-0.842133, -0.439117, -0.312927},
+ {-0.313477, 0.84433, 0.434479},
+ {-0.241211, 0.053253, 0.968994},
+ {0.063873, 0.823273, 0.563965},
+ {0.476288, 0.862152, -0.172516},
+ {0.620941, -0.298126, 0.724915},
+ {0.25238, -0.749359, -0.612122},
+ {-0.577545, 0.386566, 0.718994},
+ {-0.406342, -0.737976, 0.538696},
+ {0.04718, 0.556305, 0.82959},
+ {-0.802856, 0.587463, 0.101166},
+ {-0.707733, -0.705963, 0.026428},
+ {0.374908, 0.68457, 0.625092},
+ {0.472137, 0.208405, -0.856506},
+ {-0.703064, -0.581085, -0.409821},
+ {-0.417206, -0.736328, 0.532623},
+ {-0.447876, -0.20285, -0.870728},
+ {0.086945, -0.990417, 0.107086},
+ {0.183685, 0.018341, -0.982788},
+ {0.560638, -0.428864, 0.708282},
+ {0.296722, -0.952576, -0.0672},
+ {0.135773, 0.990265, 0.030243},
+ {-0.068787, 0.654724, 0.752686},
+ {0.762604, -0.551758, 0.337585},
+ {-0.819611, -0.407684, 0.402466},
+ {-0.727844, -0.55072, -0.408539},
+ {-0.855774, -0.480011, 0.19281},
+ {0.693176, -0.079285, 0.716339},
+ {0.226013, 0.650116, -0.725433},
+ {0.246704, 0.953369, -0.173553},
+ {-0.970398, -0.239227, -0.03244},
+ {0.136383, -0.394318, 0.908752},
+ {0.813232, 0.558167, 0.164368},
+ {0.40451, 0.549042, -0.731323},
+ {-0.380249, -0.566711, 0.730865},
+ {0.022156, 0.932739, 0.359741},
+ {0.00824, 0.996552, -0.082306},
+ {0.956635, -0.065338, -0.283722},
+ {-0.743561, 0.008209, 0.668579},
+ {-0.859589, -0.509674, 0.035767},
+ {-0.852234, 0.363678, -0.375977},
+ {-0.201965, -0.970795, -0.12915},
+ {0.313477, 0.947327, 0.06546},
+ {-0.254028, -0.528259, 0.81015},
+ {0.628052, 0.601105, 0.49411},
+ {-0.494385, 0.868378, 0.037933},
+ {0.275635, -0.086426, 0.957336},
+ {-0.197937, 0.468903, -0.860748},
+ {0.895599, 0.399384, 0.195801},
+ {0.560791, 0.825012, -0.069214},
+ {0.304199, -0.849487, 0.43103},
+ {0.096375, 0.93576, 0.339111},
+ {-0.051422, 0.408966, -0.911072},
+ {0.330444, 0.942841, -0.042389},
+ {-0.452362, -0.786407, 0.420563},
+ {0.134308, -0.933472, -0.332489},
+ {0.80191, -0.566711, -0.188934},
+ {-0.987946, -0.105988, 0.112518},
+ {-0.24408, 0.892242, -0.379791},
+ {-0.920502, 0.229095, -0.316376},
+ {0.7789, 0.325958, 0.535706},
+ {-0.912872, 0.185211, -0.36377},
+ {-0.184784, 0.565369, -0.803833},
+ {-0.018463, 0.119537, 0.992615},
+ {-0.259247, -0.935608, 0.239532},
+ {-0.82373, -0.449127, -0.345947},
+ {-0.433105, 0.659515, 0.614349},
+ {-0.822754, 0.378845, -0.423676},
+ {0.687195, -0.674835, -0.26889},
+ {-0.246582, -0.800842, 0.545715},
+ {-0.729187, -0.207794, 0.651978},
+ {0.653534, -0.610443, -0.447388},
+ {0.492584, -0.023346, 0.869934},
+ {0.609039, 0.009094, -0.79306},
+ {0.962494, -0.271088, -0.00885},
+ {0.2659, -0.004913, 0.963959},
+ {0.651245, 0.553619, -0.518951},
+ {0.280548, -0.84314, 0.458618},
+ {-0.175293, -0.983215, 0.049805},
+ {0.035339, -0.979919, 0.196045},
+ {-0.982941, 0.164307, -0.082245},
+ {0.233734, -0.97226, -0.005005},
+ {-0.747253, -0.611328, 0.260437},
+ {0.645599, 0.592773, 0.481384},
+ {0.117706, -0.949524, -0.29068},
+ {-0.535004, -0.791901, -0.294312},
+ {-0.627167, -0.214447, 0.748718},
+ {-0.047974, -0.813477, -0.57959},
+ {-0.175537, 0.477264, -0.860992},
+ {0.738556, -0.414246, -0.53183},
+ {0.562561, -0.704071, 0.433289},
+ {-0.754944, 0.64801, -0.100586},
+ {0.114716, 0.044525, -0.992371},
+ {0.966003, 0.244873, -0.082764},
+ {0.33783, 0.715698, -0.611206},
+ {-0.944031, -0.326599, -0.045624},
+};
static int savesplines = 1;
static pschar ISOcharlist[NASCII] = {
- "/space", 040, 0,
- "/exclam", 041, 0,
- "/quotedbl", 042, 0,
- "/numbersign", 043, 0,
- "/dollar", 044, 0,
- "/percent", 045, 0,
- "/ampersand", 046, 0,
- "/quoteright", 047, 0,
-
- "/parenleft", 050, 0,
- "/parenright", 051, 0,
- "/asterisk", 052, 0,
- "/plus", 053, 0,
- "/comma", 054, 0,
- "/hyphen", 055, 0,
- "/period", 056, 0,
- "/slash", 057, 0,
-
- "/zero", 060, 0,
- "/one", 061, 0,
- "/two", 062, 0,
- "/three", 063, 0,
- "/four", 064, 0,
- "/five", 065, 0,
- "/six", 066, 0,
- "/seven", 067, 0,
-
- "/eight", 070, 0,
- "/nine", 071, 0,
- "/colon", 072, 0,
- "/semicolon", 073, 0,
- "/less", 074, 0,
- "/equal", 075, 0,
- "/greater", 076, 0,
- "/question", 077, 0,
-
- "/at", 0100, 0,
- "/A", 0101, 0,
- "/B", 0102, 0,
- "/C", 0103, 0,
- "/D", 0104, 0,
- "/E", 0105, 0,
- "/F", 0106, 0,
- "/G", 0107, 0,
-
- "/H", 0110, 0,
- "/I", 0111, 0,
- "/J", 0112, 0,
- "/K", 0113, 0,
- "/L", 0114, 0,
- "/M", 0115, 0,
- "/N", 0116, 0,
- "/O", 0117, 0,
-
- "/P", 0120, 0,
- "/Q", 0121, 0,
- "/R", 0122, 0,
- "/S", 0123, 0,
- "/T", 0124, 0,
- "/U", 0125, 0,
- "/V", 0126, 0,
- "/W", 0127, 0,
-
- "/X", 0130, 0,
- "/Y", 0131, 0,
- "/Z", 0132, 0,
- "/bracketleft", 0133, 0,
- "/backslash", 0134, 0,
- "/bracketright", 0135, 0,
- "/asciicircum", 0136, 0,
- "/underscore", 0137, 0,
-
- "/quoteleft", 0140, 0,
- "/a", 0141, 0,
- "/b", 0142, 0,
- "/c", 0143, 0,
- "/d", 0144, 0,
- "/e", 0145, 0,
- "/f", 0146, 0,
- "/g", 0147, 0,
-
- "/h", 0150, 0,
- "/i", 0151, 0,
- "/j", 0152, 0,
- "/k", 0153, 0,
- "/l", 0154, 0,
- "/m", 0155, 0,
- "/n", 0156, 0,
- "/o", 0157, 0,
-
- "/p", 0160, 0,
- "/q", 0161, 0,
- "/r", 0162, 0,
- "/s", 0163, 0,
- "/t", 0164, 0,
- "/u", 0165, 0,
- "/v", 0166, 0,
- "/w", 0167, 0,
-
- "/x", 0170, 0,
- "/y", 0171, 0,
- "/z", 0172, 0,
- "/braceleft", 0173, 0,
- "/bar", 0174, 0,
- "/braceright", 0175, 0,
- "/asciitilde", 0176, 0,
- "/", 0177, 0,
+ {"/space", 040, 0},
+ {"/exclam", 041, 0},
+ {"/quotedbl", 042, 0},
+ {"/numbersign", 043, 0},
+ {"/dollar", 044, 0},
+ {"/percent", 045, 0},
+ {"/ampersand", 046, 0},
+ {"/quoteright", 047, 0},
+
+ {"/parenleft", 050, 0},
+ {"/parenright", 051, 0},
+ {"/asterisk", 052, 0},
+ {"/plus", 053, 0},
+ {"/comma", 054, 0},
+ {"/hyphen", 055, 0},
+ {"/period", 056, 0},
+ {"/slash", 057, 0},
+
+ {"/zero", 060, 0},
+ {"/one", 061, 0},
+ {"/two", 062, 0},
+ {"/three", 063, 0},
+ {"/four", 064, 0},
+ {"/five", 065, 0},
+ {"/six", 066, 0},
+ {"/seven", 067, 0},
+
+ {"/eight", 070, 0},
+ {"/nine", 071, 0},
+ {"/colon", 072, 0},
+ {"/semicolon", 073, 0},
+ {"/less", 074, 0},
+ {"/equal", 075, 0},
+ {"/greater", 076, 0},
+ {"/question", 077, 0},
+
+ {"/at", 0100, 0},
+ {"/A", 0101, 0},
+ {"/B", 0102, 0},
+ {"/C", 0103, 0},
+ {"/D", 0104, 0},
+ {"/E", 0105, 0},
+ {"/F", 0106, 0},
+ {"/G", 0107, 0},
+
+ {"/H", 0110, 0},
+ {"/I", 0111, 0},
+ {"/J", 0112, 0},
+ {"/K", 0113, 0},
+ {"/L", 0114, 0},
+ {"/M", 0115, 0},
+ {"/N", 0116, 0},
+ {"/O", 0117, 0},
+
+ {"/P", 0120, 0},
+ {"/Q", 0121, 0},
+ {"/R", 0122, 0},
+ {"/S", 0123, 0},
+ {"/T", 0124, 0},
+ {"/U", 0125, 0},
+ {"/V", 0126, 0},
+ {"/W", 0127, 0},
+
+ {"/X", 0130, 0},
+ {"/Y", 0131, 0},
+ {"/Z", 0132, 0},
+ {"/bracketleft", 0133, 0},
+ {"/backslash", 0134, 0},
+ {"/bracketright", 0135, 0},
+ {"/asciicircum", 0136, 0},
+ {"/underscore", 0137, 0},
+
+ {"/quoteleft", 0140, 0},
+ {"/a", 0141, 0},
+ {"/b", 0142, 0},
+ {"/c", 0143, 0},
+ {"/d", 0144, 0},
+ {"/e", 0145, 0},
+ {"/f", 0146, 0},
+ {"/g", 0147, 0},
+
+ {"/h", 0150, 0},
+ {"/i", 0151, 0},
+ {"/j", 0152, 0},
+ {"/k", 0153, 0},
+ {"/l", 0154, 0},
+ {"/m", 0155, 0},
+ {"/n", 0156, 0},
+ {"/o", 0157, 0},
+
+ {"/p", 0160, 0},
+ {"/q", 0161, 0},
+ {"/r", 0162, 0},
+ {"/s", 0163, 0},
+ {"/t", 0164, 0},
+ {"/u", 0165, 0},
+ {"/v", 0166, 0},
+ {"/w", 0167, 0},
+
+ {"/x", 0170, 0},
+ {"/y", 0171, 0},
+ {"/z", 0172, 0},
+ {"/braceleft", 0173, 0},
+ {"/bar", 0174, 0},
+ {"/braceright", 0175, 0},
+ {"/asciitilde", 0176, 0},
+ {"/", 0177, 0},
/* nonstandard defs */
- "/quotedblleft", 0200, 0,
- "/quotedblright", 0201, 0,
- "/quotedblbase", 0202, 0,
- "/quotesinglbase", 0203, 0,
- "/guilsinglleft", 0204, 0,
- "/guilsinglright", 0205, 0,
- "/endash", 0206, 0,
- "/dagger", 0207, 0,
-
- "/daggerdbl", 0210, 0,
- "/trademark", 0211, 0,
- "/bullet", 0212, 0,
- "/perthousand", 0213, 0,
- "/Lslash", 0214, 0,
- "/OE", 0215, 0,
- "/lslash", 0216, 0,
- "/oe", 0217, 0,
+ {"/quotedblleft", 0200, 0},
+ {"/quotedblright", 0201, 0},
+ {"/quotedblbase", 0202, 0},
+ {"/quotesinglbase", 0203, 0},
+ {"/guilsinglleft", 0204, 0},
+ {"/guilsinglright", 0205, 0},
+ {"/endash", 0206, 0},
+ {"/dagger", 0207, 0},
+
+ {"/daggerdbl", 0210, 0},
+ {"/trademark", 0211, 0},
+ {"/bullet", 0212, 0},
+ {"/perthousand", 0213, 0},
+ {"/Lslash", 0214, 0},
+ {"/OE", 0215, 0},
+ {"/lslash", 0216, 0},
+ {"/oe", 0217, 0},
/* endnonstandard defs */
- "/dotlessi", 0220, 0,
- "/grave", 0221, 0,
- "/acute", 0222, 0,
- "/circumflex", 0223, 0,
- "/tilde", 0224, 0,
- "/", 0225, 0,
- "/breve", 0226, 0,
- "/dotaccent", 0227, 0,
-
- "/", 0230, 0,
- "/", 0231, 0,
- "/ring", 0232, 0,
- "/", 0233, 0,
- "/", 0234, 0,
- "/hungarumlaut", 0235, 0,
- "/ogonek", 0236, 0,
- "/caron", 0237, 0,
-
- "/", 0240, 0,
- "/exclamdown", 0241, 0,
- "/cent", 0242, 0,
- "/sterling", 0243, 0,
- "/florin", 0244, 0,
- "/yen", 0245, 0,
- "/brokenbar", 0246, 0,
- "/section", 0247, 0,
-
- "/dieresis", 0250, 0,
- "/copyright", 0251, 0,
- "/ordfeminine", 0252, 0,
- "/guillemotleft", 0253, 0,
- "/logicalnot", 0254, 0,
- "/hyphen", 0255, 0,
- "/registered", 0256, 0,
- "/macron", 0257, 0,
-
- "/degree", 0260, 0,
- "/plusminus", 0261, 0,
- "/twosuperior", 0262, 0,
- "/threesuperior", 0263, 0,
- "/acute", 0264, 0,
- "/mu", 0265, 0,
- "/paragraph", 0266, 0,
- "/periodcentered", 0267, 0,
-
- "/cedilla", 0270, 0,
- "/onesuperior", 0271, 0,
- "/ordmasculine", 0272, 0,
- "/guillemotright", 0273, 0,
- "/onequarter", 0274, 0,
- "/onehalf", 0275, 0,
- "/threequarters", 0276, 0,
- "/questiondown", 0277, 0,
-
- "/Agrave", 0300, 0,
- "/Aacute", 0301, 0,
- "/Acircumflex", 0302, 0,
- "/Atilde", 0303, 0,
- "/Adieresis", 0304, 0,
- "/Aring", 0305, 0,
- "/AE", 0306, 0,
- "/Ccedilla", 0307, 0,
-
- "/Egrave", 0310, 0,
- "/Eacute", 0311, 0,
- "/Ecircumflex", 0312, 0,
- "/Edieresis", 0313, 0,
- "/Igrave", 0314, 0,
- "/Iacute", 0315, 0,
- "/Icircumflex", 0316, 0,
- "/Idieresis", 0317, 0,
-
- "/Eth", 0320, 0,
- "/Ntilde", 0321, 0,
- "/Ograve", 0322, 0,
- "/Oacute", 0323, 0,
- "/Ocircumflex", 0324, 0,
- "/Otilde", 0325, 0,
- "/Odieresis", 0326, 0,
- "/multiply", 0327, 0,
-
- "/Oslash", 0330, 0,
- "/Ugrave", 0331, 0,
- "/Uacute", 0332, 0,
- "/Ucircumflex", 0333, 0,
- "/Udieresis", 0334, 0,
- "/Yacute", 0335, 0,
- "/Thorn", 0336, 0,
- "/germandbls", 0337, 0,
-
- "/agrave", 0340, 0,
- "/aacute", 0341, 0,
- "/acircumflex", 0342, 0,
- "/atilde", 0343, 0,
- "/adieresis", 0344, 0,
- "/aring", 0345, 0,
- "/ae", 0346, 0,
- "/ccedilla", 0347, 0,
-
- "/egrave", 0350, 0,
- "/eacute", 0351, 0,
- "/ecircumflex", 0352, 0,
- "/edieresis", 0353, 0,
- "/igrave", 0354, 0,
- "/iacute", 0355, 0,
- "/icircumflex", 0356, 0,
- "/idieresis", 0357, 0,
-
- "/eth", 0360, 0,
- "/ntilde", 0361, 0,
- "/ograve", 0362, 0,
- "/oacute", 0363, 0,
- "/ocircumflex", 0364, 0,
- "/otilde", 0365, 0,
- "/odieresis", 0366, 0,
- "/divide", 0367, 0,
-
- "/oslash", 0370, 0,
- "/ugrave", 0371, 0,
- "/uacute", 0372, 0,
- "/ucircumflex", 0373, 0,
- "/udieresis", 0374, 0,
- "/yacute", 0375, 0,
- "/thorn", 0376, 0,
- "/ydieresis", 0377, 0,
+ {"/dotlessi", 0220, 0},
+ {"/grave", 0221, 0},
+ {"/acute", 0222, 0},
+ {"/circumflex", 0223, 0},
+ {"/tilde", 0224, 0},
+ {"/", 0225, 0},
+ {"/breve", 0226, 0},
+ {"/dotaccent", 0227, 0},
+
+ {"/", 0230, 0},
+ {"/", 0231, 0},
+ {"/ring", 0232, 0},
+ {"/", 0233, 0},
+ {"/", 0234, 0},
+ {"/hungarumlaut", 0235, 0},
+ {"/ogonek", 0236, 0},
+ {"/caron", 0237, 0},
+
+ {"/", 0240, 0},
+ {"/exclamdown", 0241, 0},
+ {"/cent", 0242, 0},
+ {"/sterling", 0243, 0},
+ {"/florin", 0244, 0},
+ {"/yen", 0245, 0},
+ {"/brokenbar", 0246, 0},
+ {"/section", 0247, 0},
+
+ {"/dieresis", 0250, 0},
+ {"/copyright", 0251, 0},
+ {"/ordfeminine", 0252, 0},
+ {"/guillemotleft", 0253, 0},
+ {"/logicalnot", 0254, 0},
+ {"/hyphen", 0255, 0},
+ {"/registered", 0256, 0},
+ {"/macron", 0257, 0},
+
+ {"/degree", 0260, 0},
+ {"/plusminus", 0261, 0},
+ {"/twosuperior", 0262, 0},
+ {"/threesuperior", 0263, 0},
+ {"/acute", 0264, 0},
+ {"/mu", 0265, 0},
+ {"/paragraph", 0266, 0},
+ {"/periodcentered", 0267, 0},
+
+ {"/cedilla", 0270, 0},
+ {"/onesuperior", 0271, 0},
+ {"/ordmasculine", 0272, 0},
+ {"/guillemotright", 0273, 0},
+ {"/onequarter", 0274, 0},
+ {"/onehalf", 0275, 0},
+ {"/threequarters", 0276, 0},
+ {"/questiondown", 0277, 0},
+
+ {"/Agrave", 0300, 0},
+ {"/Aacute", 0301, 0},
+ {"/Acircumflex", 0302, 0},
+ {"/Atilde", 0303, 0},
+ {"/Adieresis", 0304, 0},
+ {"/Aring", 0305, 0},
+ {"/AE", 0306, 0},
+ {"/Ccedilla", 0307, 0},
+
+ {"/Egrave", 0310, 0},
+ {"/Eacute", 0311, 0},
+ {"/Ecircumflex", 0312, 0},
+ {"/Edieresis", 0313, 0},
+ {"/Igrave", 0314, 0},
+ {"/Iacute", 0315, 0},
+ {"/Icircumflex", 0316, 0},
+ {"/Idieresis", 0317, 0},
+
+ {"/Eth", 0320, 0},
+ {"/Ntilde", 0321, 0},
+ {"/Ograve", 0322, 0},
+ {"/Oacute", 0323, 0},
+ {"/Ocircumflex", 0324, 0},
+ {"/Otilde", 0325, 0},
+ {"/Odieresis", 0326, 0},
+ {"/multiply", 0327, 0},
+
+ {"/Oslash", 0330, 0},
+ {"/Ugrave", 0331, 0},
+ {"/Uacute", 0332, 0},
+ {"/Ucircumflex",0333, 0},
+ {"/Udieresis", 0334, 0},
+ {"/Yacute", 0335, 0},
+ {"/Thorn", 0336, 0},
+ {"/germandbls", 0337, 0},
+
+ {"/agrave", 0340, 0},
+ {"/aacute", 0341, 0},
+ {"/acircumflex",0342, 0},
+ {"/atilde", 0343, 0},
+ {"/adieresis", 0344, 0},
+ {"/aring", 0345, 0},
+ {"/ae", 0346, 0},
+ {"/ccedilla", 0347, 0},
+
+ {"/egrave", 0350, 0},
+ {"/eacute", 0351, 0},
+ {"/ecircumflex", 0352, 0},
+ {"/edieresis", 0353, 0},
+ {"/igrave", 0354, 0},
+ {"/iacute", 0355, 0},
+ {"/icircumflex", 0356, 0},
+ {"/idieresis", 0357, 0},
+
+ {"/eth", 0360, 0},
+ {"/ntilde", 0361, 0},
+ {"/ograve", 0362, 0},
+ {"/oacute", 0363, 0},
+ {"/ocircumflex",0364, 0},
+ {"/otilde", 0365, 0},
+ {"/odieresis", 0366, 0},
+ {"/divide", 0367, 0},
+
+ {"/oslash", 0370, 0},
+ {"/ugrave", 0371, 0},
+ {"/uacute", 0372, 0},
+ {"/ucircumflex",0373, 0},
+ {"/udieresis", 0374, 0},
+ {"/yacute", 0375, 0},
+ {"/thorn", 0376, 0},
+ {"/ydieresis", 0377, 0},
};
static short STDvsISO [][2] = {
- 0341, 0306, /* AE */
- 0351, 0330, /* Oslash */
- 0302, 0222, /* acute */
- 0361, 0346, /* ae */
- 0306, 0226, /* breve */
- 0317, 0237, /* caron */
- 0313, 0270, /* cedilla */
- 0303, 0223, /* circumflex */
- 0250, 0244, /* currency */
- 0310, 0250, /* dieresis */
- 0307, 0227, /* dotaccent */
- 0365, 0220, /* dotlessi */
- 0373, 0337, /* germandbls */
- 0301, 0221, /* grave */
- 0315, 0235, /* hungarumlaut */
- 0055, 0255, /* hyphen */
- 0305, 0257, /* macron */
- 0316, 0236, /* ogenek */
- 0343, 0252, /* ordfeminine */
- 0353, 0272, /* ordmasculine */
- 0371, 0370, /* oslash */
- 0264, 0267, /* periodcentered */
- 0312, 0232, /* ring */
- 0304, 0224, /* tilde */
+ {0341, 0306}, /* AE */
+ {0351, 0330}, /* Oslash */
+ {0302, 0222}, /* acute */
+ {0361, 0346}, /* ae */
+ {0306, 0226}, /* breve */
+ {0317, 0237}, /* caron */
+ {0313, 0270}, /* cedilla */
+ {0303, 0223}, /* circumflex */
+ {0250, 0244}, /* currency */
+ {0310, 0250}, /* dieresis */
+ {0307, 0227}, /* dotaccent */
+ {0365, 0220}, /* dotlessi */
+ {0373, 0337}, /* germandbls */
+ {0301, 0221}, /* grave */
+ {0315, 0235}, /* hungarumlaut */
+ {0055, 0255}, /* hyphen */
+ {0305, 0257}, /* macron */
+ {0316, 0236}, /* ogenek */
+ {0343, 0252}, /* ordfeminine */
+ {0353, 0272}, /* ordmasculine */
+ {0371, 0370}, /* oslash */
+ {0264, 0267}, /* periodcentered */
+ {0312, 0232}, /* ring */
+ {0304, 0224}, /* tilde */
};
/* from objfont.c, rest is in lfm_s !!*/
* take the dir name, make it absolute, and clean it up, replacing
* excess file entry stuff (like /tmp/../tmp/../)
* note that dir isn't protected for max string names...
+ *
+ * If relbase is NULL then its ignored
*/
void BLI_cleanup_dir(const char *relabase, char *dir)
{
short a;
char *start, *eind;
-
- BLI_convertstringcode(dir, relabase, 0);
-
+ if (relabase) {
+ BLI_convertstringcode(dir, relabase, 0);
+ }
#ifdef WIN32
if(dir[0]=='.') { /* happens for example in FILE_MAIN */
get_default_root(dir);
char * lslash;
char temp[FILE_MAXDIR+FILE_MAXFILE];
char res[FILE_MAXDIR+FILE_MAXFILE];
-
+
/* if file is already relative, bail out */
if(file[0]=='/' && file[1]=='/') return;
BLI_char_switch(temp, '\\', '/');
BLI_char_switch(file, '\\', '/');
-
+
+ /* remove /./ which confuse the following slash counting... */
+ BLI_cleanup_file(NULL, file);
+ BLI_cleanup_file(NULL, temp);
+
/* the last slash in the file indicates where the path part ends */
lslash = BLI_last_slash(temp);
BLI_strncpy(base, basepath, FILE_MAX);
+ BLI_cleanup_file(NULL, base);
+
/* push slashes into unix mode - strings entering this part are
potentially messed up: having both back- and forward slashes.
Here we push into one conform direction, and at the end we
*/
BLI_char_switch(path+2, '/', '\\');
#endif
-
+
return wasrelative;
}
}
}
+int check_file_chars(char *filename)
+{
+ char *p = filename;
+ while (*p) {
+ switch (*p) {
+ case ':':
+ case '?':
+ case '*':
+ case '|':
+ case '\\':
+ case '/':
+ case '\"':
+ return 0;
+ break;
+ }
+
+ p++;
+ }
+ return 1;
+}
+
#else
static void BLI_WINSTUFF_C_IS_EMPTY_FOR_UNIX(void)
#include "BKE_customdata.h"
#include "BKE_deform.h"
#include "BKE_depsgraph.h"
-#include "BKE_effect.h" // for give_parteff
+#include "BKE_effect.h" /* give_parteff */
#include "BKE_global.h" // for G
#include "BKE_group.h"
#include "BKE_image.h"
BHead *blo_prevbhead(FileData *fd, BHead *thisblock)
{
- BHeadN *bheadn= (BHeadN *) (((char *) thisblock) - (int) (&((BHeadN*)0)->bhead));
+ BHeadN *bheadn= (BHeadN *) (((char *) thisblock) - GET_INT_FROM_POINTER( &((BHeadN*)0)->bhead) );
BHeadN *prev= bheadn->prev;
return prev?&prev->bhead:NULL;
if (thisblock) {
// bhead is actually a sub part of BHeadN
// We calculate the BHeadN pointer from the BHead pointer below
- new_bhead = (BHeadN *) (((char *) thisblock) - (int) (&((BHeadN*)0)->bhead));
+ new_bhead = (BHeadN *) (((char *) thisblock) - GET_INT_FROM_POINTER( &((BHeadN*)0)->bhead) );
// get the next BHeadN. If it doesn't exist we read in the next one
new_bhead = new_bhead->next;
while(ob) {
ob->mass= 1.0f;
ob->damping= 0.1f;
- ob->quat[1]= 1.0f;
+ /*ob->quat[1]= 1.0f;*/ /* quats arnt used yet */
ob= ob->id.next;
}
idproperties_fix_group_lengths(main->brush);
idproperties_fix_group_lengths(main->particle);
}
+
+ /* only needed until old bad svn/RC1,2 files are saved with a > 17 version -dg */
+ if(main->versionfile == 245 && main->subversionfile < 17) {
+ ModifierData *md;
+ Object *ob;
+
+ for(ob = main->object.first; ob; ob= ob->id.next) {
+ for(md=ob->modifiers.first; md; ) {
+ if(md->type==eModifierType_Cloth) {
+ ModifierData *next;
+ MEM_freeN(((ClothModifierData *)md)->sim_parms);
+ MEM_freeN(((ClothModifierData *)md)->coll_parms);
+ MEM_freeN(((ClothModifierData *)md)->point_cache);
+ ((ClothModifierData *)md)->sim_parms = NULL;
+ ((ClothModifierData *)md)->coll_parms = NULL;
+ ((ClothModifierData *)md)->point_cache = NULL;
+ next=md->next;
+ BLI_remlink(&ob->modifiers, md);
+ md = next;
+ }
+ else
+ md = md->next;
+ }
+ }
+ }
/* WATCH IT!!!: pointers from libdata have not been converted yet here! */
/* WATCH IT 2!: Userdef struct init has to be in src/usiblender.c! */
}
}
-static void write_effects(WriteData *wd, ListBase *lb)
-{
- Effect *eff;
-
- eff= lb->first;
- while(eff) {
-
- switch(eff->type) {
- case EFF_PARTICLE:
- writestruct(wd, DATA, "PartEff", 1, eff);
- break;
- default:
- writedata(wd, DATA, MEM_allocN_len(eff), eff);
- }
-
- eff= eff->next;
- }
-}
-
static void write_particlesettings(WriteData *wd, ListBase *idbase)
{
ParticleSettings *part;
/* direct data */
writedata(wd, DATA, sizeof(void *)*ob->totcol, ob->mat);
- write_effects(wd, &ob->effect);
+ /* write_effects(wd, &ob->effect); */ /* not used anymore */
write_properties(wd, &ob->prop);
write_sensors(wd, &ob->sensors);
write_controllers(wd, &ob->controllers);
#include "BLI_blenlib.h" /* util and noise functions */
#include "BLI_threads.h" /* For threadsfe guardedalloc malloc/calloc/free */
#include "IMB_imbuf.h" /* image buffer stuff */
+#define GET_INT_FROM_POINTER(i) ((int)(long)(i)) /* should use BKE_utildefines.h */
/* -------------------------------------------------------------------------- */
/* stuff from util.h */
int pluginapi_force_ref(void)
{
- return (int) mallocN +
- (int) callocN +
- (int) freeN +
- (int) mallocT +
- (int) callocT +
- (int) freeT +
- (int) allocImBuf +
- (int) dupImBuf +
- (int) freeImBuf +
- (int) converttocmap +
- (int) saveiff +
- (int) loadiffmem +
- (int) loadifffile +
- (int) loadiffname +
- (int) testiffname +
- (int) onehalf +
- (int) onethird +
- (int) halflace +
- (int) half_x +
- (int) half_y +
- (int) double_x +
- (int) double_y +
- (int) double_fast_x +
- (int) double_fast_y +
- (int) ispic +
- (int) dit2 +
- (int) dit0 +
- (int) scaleImBuf +
- (int) scalefastImBuf +
- (int) scalefieldImBuf +
- (int) scalefastfieldImBuf +
- (int) hnoise +
- (int) hnoisep +
- (int) turbulence +
- (int) turbulence1 +
- (int) de_interlace +
- (int) interlace +
- (int) gamwarp;
+ return
+ GET_INT_FROM_POINTER( mallocN ) +
+ GET_INT_FROM_POINTER( callocN ) +
+ GET_INT_FROM_POINTER( freeN ) +
+ GET_INT_FROM_POINTER( mallocT ) +
+ GET_INT_FROM_POINTER( callocT ) +
+ GET_INT_FROM_POINTER( freeT ) +
+ GET_INT_FROM_POINTER( allocImBuf ) +
+ GET_INT_FROM_POINTER( dupImBuf ) +
+ GET_INT_FROM_POINTER( freeImBuf ) +
+ GET_INT_FROM_POINTER( converttocmap ) +
+ GET_INT_FROM_POINTER( saveiff ) +
+ GET_INT_FROM_POINTER( loadiffmem ) +
+ GET_INT_FROM_POINTER( loadifffile ) +
+ GET_INT_FROM_POINTER( loadiffname ) +
+ GET_INT_FROM_POINTER( testiffname ) +
+ GET_INT_FROM_POINTER( onehalf ) +
+ GET_INT_FROM_POINTER( onethird ) +
+ GET_INT_FROM_POINTER( halflace ) +
+ GET_INT_FROM_POINTER( half_x ) +
+ GET_INT_FROM_POINTER( half_y ) +
+ GET_INT_FROM_POINTER( double_x ) +
+ GET_INT_FROM_POINTER( double_y ) +
+ GET_INT_FROM_POINTER( double_fast_x ) +
+ GET_INT_FROM_POINTER( double_fast_y ) +
+ GET_INT_FROM_POINTER( ispic ) +
+ GET_INT_FROM_POINTER( dit2 ) +
+ GET_INT_FROM_POINTER( dit0 ) +
+ GET_INT_FROM_POINTER( scaleImBuf ) +
+ GET_INT_FROM_POINTER( scalefastImBuf ) +
+ GET_INT_FROM_POINTER( scalefieldImBuf ) +
+ GET_INT_FROM_POINTER( scalefastfieldImBuf ) +
+ GET_INT_FROM_POINTER( hnoise ) +
+ GET_INT_FROM_POINTER( hnoisep ) +
+ GET_INT_FROM_POINTER( turbulence ) +
+ GET_INT_FROM_POINTER( turbulence1 ) +
+ GET_INT_FROM_POINTER( de_interlace ) +
+ GET_INT_FROM_POINTER( interlace ) +
+ GET_INT_FROM_POINTER( gamwarp );
}
static short imb_save_openexr_half(struct ImBuf *ibuf, char *name, int flags)
{
-
+ int channels = ibuf->channels;
int width = ibuf->x;
int height = ibuf->y;
int write_zbuf = (flags & IB_zbuffloat) && ibuf->zbuf_float != NULL; // summarize
header.channels().insert ("R", Channel (HALF));
header.channels().insert ("G", Channel (HALF));
header.channels().insert ("B", Channel (HALF));
- if (ibuf->depth==32)
+ if (ibuf->depth==32 && channels >= 4)
header.channels().insert ("A", Channel (HALF));
if (write_zbuf) // z we do as float always
header.channels().insert ("Z", Channel (FLOAT));
RGBAZ *to = pixels;
int xstride= sizeof (RGBAZ);
int ystride= xstride*width;
-
+
/* indicate used buffers */
frameBuffer.insert ("R", Slice (HALF, (char *) &pixels[0].r, xstride, ystride));
frameBuffer.insert ("G", Slice (HALF, (char *) &pixels[0].g, xstride, ystride));
frameBuffer.insert ("B", Slice (HALF, (char *) &pixels[0].b, xstride, ystride));
- if (ibuf->depth==32)
+ if (ibuf->depth==32 && channels >= 4)
frameBuffer.insert ("A", Slice (HALF, (char *) &pixels[0].a, xstride, ystride));
if (write_zbuf)
- frameBuffer.insert ("Z", Slice (FLOAT, (char *) ibuf->zbuf_float + 4*(height-1)*width,
+ frameBuffer.insert ("Z", Slice (FLOAT, (char *)(ibuf->zbuf_float + (height-1)*width),
sizeof(float), sizeof(float) * -width));
if(ibuf->rect_float) {
float *from;
for (int i = ibuf->y-1; i >= 0; i--)
{
- from= ibuf->rect_float + 4*i*width;
+ from= ibuf->rect_float + channels*i*width;
for (int j = ibuf->x; j > 0; j--)
{
to->r = from[0];
- to->g = from[1];
- to->b = from[2];
- to->a = from[3];
+ to->g = (channels >= 2)? from[1]: from[0];
+ to->b = (channels >= 3)? from[2]: from[0];
+ to->a = (channels >= 4)? from[3]: from[0];
to++; from += 4;
}
}
for (int i = ibuf->y-1; i >= 0; i--)
{
- from= (unsigned char *)(ibuf->rect + i*width);
+ from= (unsigned char *)ibuf->rect + channels*i*width;
for (int j = ibuf->x; j > 0; j--)
{
to->r = (float)(from[0])/255.0;
- to->g = (float)(from[1])/255.0;
- to->b = (float)(from[2])/255.0;
- to->a = (float)(from[3])/255.0;
+ to->g = (float)((channels >= 2)? from[1]: from[0])/255.0;
+ to->b = (float)((channels >= 3)? from[2]: from[0])/255.0;
+ to->a = (float)((channels >= 4)? from[3]: from[0])/255.0;
to++; from += 4;
}
}
static short imb_save_openexr_float(struct ImBuf *ibuf, char *name, int flags)
{
-
+ int channels = ibuf->channels;
int width = ibuf->x;
int height = ibuf->y;
int write_zbuf = (flags & IB_zbuffloat) && ibuf->zbuf_float != NULL; // summarize
header.channels().insert ("R", Channel (FLOAT));
header.channels().insert ("G", Channel (FLOAT));
header.channels().insert ("B", Channel (FLOAT));
- if (ibuf->depth==32)
+ if (ibuf->depth==32 && channels >= 4)
header.channels().insert ("A", Channel (FLOAT));
if (write_zbuf)
header.channels().insert ("Z", Channel (FLOAT));
FrameBuffer frameBuffer;
OutputFile *file = new OutputFile(name, header);
- float *first= ibuf->rect_float + 4*(height-1)*width;
- int xstride = sizeof(float) * 4;
+ int xstride = sizeof(float) * channels;
int ystride = - xstride*width;
-
- frameBuffer.insert ("R", Slice (FLOAT, (char *) first, xstride, ystride));
- frameBuffer.insert ("G", Slice (FLOAT, (char *) (first+1), xstride, ystride));
- frameBuffer.insert ("B", Slice (FLOAT, (char *) (first+2), xstride, ystride));
- if (ibuf->depth==32)
- frameBuffer.insert ("A", Slice (FLOAT, (char *) (first+3), xstride, ystride));
+ float *rect[4] = {NULL, NULL, NULL, NULL};
+
+ rect[0]= ibuf->rect_float + channels*(height-1)*width;
+ rect[1]= (channels >= 2)? rect[0]+1: rect[0];
+ rect[2]= (channels >= 3)? rect[0]+2: rect[0];
+ rect[3]= (channels >= 4)? rect[0]+3: rect[0];
+
+ frameBuffer.insert ("R", Slice (FLOAT, (char *)rect[0], xstride, ystride));
+ frameBuffer.insert ("G", Slice (FLOAT, (char *)rect[1], xstride, ystride));
+ frameBuffer.insert ("B", Slice (FLOAT, (char *)rect[2], xstride, ystride));
+ if (ibuf->depth==32 && channels >= 4)
+ frameBuffer.insert ("A", Slice (FLOAT, (char *)rect[3], xstride, ystride));
if (write_zbuf)
- frameBuffer.insert ("Z", Slice (FLOAT, (char *) ibuf->zbuf_float + 4*(height-1)*width,
+ frameBuffer.insert ("Z", Slice (FLOAT, (char *) (ibuf->zbuf_float + (height-1)*width),
sizeof(float), sizeof(float) * -width));
file->setFrameBuffer (frameBuffer);
file->writePixels (height);
}
/* ImBuf write */
-static int fwritecolrs(FILE* file, int width, unsigned char* ibufscan, float* fpscan)
+static int fwritecolrs(FILE* file, int width, int channels, unsigned char* ibufscan, float* fpscan)
{
int x, i, j, beg, c2, cnt=0;
fCOLOR fcol;
for (i=0;i<width;i++) {
if (fpscan) {
fcol[RED] = fpscan[j];
- fcol[GRN] = fpscan[j+1];
- fcol[BLU] = fpscan[j+2];
+ fcol[GRN] = (channels >= 2)? fpscan[j+1]: fpscan[j];
+ fcol[BLU] = (channels >= 3)? fpscan[j+2]: fpscan[j];
} else {
fcol[RED] = (float)ibufscan[j] / 255.f;
- fcol[GRN] = (float)ibufscan[j+1] / 255.f;
- fcol[BLU] = (float)ibufscan[j+2] /255.f;
+ fcol[GRN] = (float)((channels >= 2)? ibufscan[j+1]: ibufscan[j]) / 255.f;
+ fcol[BLU] = (float)((channels >= 3)? ibufscan[j+2]: ibufscan[j]) / 255.f;
}
FLOAT2RGBE(fcol, rgbe);
copy_rgbe(rgbe, rgbe_scan[i]);
- j+=4;
+ j+=channels;
}
if ((width < MINELEN) | (width > MAXELEN)) { /* OOBs, write out flat */
writeHeader(file, width, height);
if(ibuf->rect)
- cp= (unsigned char *)(ibuf->rect + (height-1)*width);
+ cp= (unsigned char *)ibuf->rect + ibuf->channels*(height-1)*width;
if(ibuf->rect_float)
- fp= ibuf->rect_float + 4*(height-1)*width;
+ fp= ibuf->rect_float + ibuf->channels*(height-1)*width;
for (y=height-1;y>=0;y--) {
- if (fwritecolrs(file, width, cp, fp) < 0) {
+ if (fwritecolrs(file, width, ibuf->channels, cp, fp) < 0) {
fclose(file);
printf("HDR write error\n");
return 0;
}
- if(cp) cp-= 4*width;
- if(fp) fp-= 4*width;
+ if(cp) cp-= ibuf->channels*width;
+ if(fp) fp-= ibuf->channels*width;
}
fclose(file);
#ifdef WIN32
#include <io.h>
+#include <stddef.h>
+#include <sys/types.h>
+#include "mmap_win.h"
#endif
#include "BLI_blenlib.h"
size = BLI_filesize(file);
-#if defined(AMIGA) || defined(__BeOS) || defined(WIN32)
+#if defined(AMIGA) || defined(__BeOS)
mem= (int *)malloc(size);
if (mem==0) {
printf("Out of mem\n");
/* Group/Channel Operations */
struct bActionGroup *get_active_actiongroup(struct bAction *act);
void set_active_actiongroup(struct bAction *act, struct bActionGroup *agrp, short select);
-void verify_pchan2achan_grouping(struct bAction *act, struct bPose *pose, char name[]);
+void verify_pchan2achan_grouping(struct bAction *act, struct bPose *pose, char name[]);
+void sync_pchan2achan_grouping(void);
void action_groups_group(short add_group);
void action_groups_ungroup(void);
/* Select */
void borderselect_action(void);
+void borderselect_actionchannels(void);
void deselect_action_keys(short test, short sel);
void deselect_action_channels(short mode);
void deselect_actionchannels(struct bAction *act, short mode);
#define B_AUTOTIMEOFS 3403 /* see B_OFSTIMEOFS, B_RANDTIMEOFS also */
#define B_FRAMEMAP 3404
-#define B_NEWEFFECT 3405
#define B_PREVEFFECT 3406
-#define B_NEXTEFFECT 3407
#define B_CHANGEEFFECT 3408
-#define B_CALCEFFECT 3409
-#define B_DELEFFECT 3410
#define B_RECALCAL 3411
#define B_RECALC_DEFL 3412
-#define B_EFFECT_DEP 3413
#define B_FIELD_DEP 3414
#define B_FIELD_CHANGE 3415
-#define B_PAF_SET_VG 3416
-#define B_PAF_SET_VG1 3417
#define B_PARTBROWSE 3418
#define B_PARTDELETE 3419
#define B_PARTALONE 3420
#ifndef PARTICLE_EFFECT_H
#define PARTICLE_EFFECT_H
-/* effect.c */
-extern Effect *add_effect(int type);
-extern PartEff *give_parteff(Object *ob);
-extern void where_is_particle(PartEff *paf, Particle *pa, float ctime, float *vec);
-extern void free_effect(Effect *eff);
-extern void free_effects(ListBase *lb);
-extern void copy_effects(ListBase *lbn, ListBase *lb);
-extern void build_particle_system(Object *ob);
-
#endif
SACTION_HORIZOPTIMISEON = (1<<5),
/* hack for moving pose-markers (temp flag) */
SACTION_POSEMARKERS_MOVE = (1<<6),
- /* draw action channels using group colours (where applicable) */
- SACTION_DRAWGCOLORS = (1<<7)
+ /* don't draw action channels using group colours (where applicable) */
+ SACTION_NODRAWGCOLORS = (1<<7)
} SACTION_FLAG;
/* SpaceAction AutoSnap Settings (also used by SpaceNLA) */
typedef struct ClothSimSettings
{
- short vgroup_mass; /* optional vertexgroup name for assigning weight.*/
- short vgroup_struct; /* vertex group for scaling structural stiffness */
+ struct LinkNode *cache; /* UNUSED atm */
float mingoal; /* see SB */
- int preroll; /* How many frames of simulation to do before we start. */
float Cdis; /* Mechanical damping of springs. */
float Cvi; /* Viscous/fluid damping. */
- int stepsPerFrame; /* Number of time steps per frame. */
float gravity [3]; /* Gravity/external force vector. */
- float ufluid [3]; /* Velocity vector of the fluid. */
float dt; /* This is the duration of our time step, computed. */
float mass; /* The mass of the entire cloth. */
float structural; /* Structural spring stiffness. */
float shear; /* Shear spring stiffness. */
float bending; /* Flexion spring stiffness. */
- float padf;
- int flags; /* flags, see CSIMSETT_FLAGS enum above. */
- short solver_type; /* which solver should be used? txold */
- short vgroup_bend; /* vertex group for scaling bending stiffness */
+ float max_bend; /* max bending scaling value, min is "bending" */
+ float max_struct; /* max structural scaling value, min is "structural" */
+ float max_shear; /* max shear scaling value, UNUSED */
+ float avg_spring_len; /* used for normalized springs */
+ float timescale; /* parameter how fast cloth runs */
float maxgoal; /* see SB */
float eff_force_scale;/* Scaling of effector forces (see softbody_calc_forces).*/
float eff_wind_scale; /* Scaling of effector wind (see softbody_calc_forces). */
float sim_time_old;
- struct LinkNode *cache; /* UNUSED atm */
float defgoal;
- int goalfrict;
float goalspring;
+ float goalfrict;
+ int stepsPerFrame; /* Number of time steps per frame. */
+ int flags; /* flags, see CSIMSETT_FLAGS enum above. */
+ int preroll; /* How many frames of simulation to do before we start. */
int maxspringlen; /* in percent!; if tearing enabled, a spring will get cut */
- float max_bend; /* max bending scaling value, min is "bending" */
- float max_struct; /* max structural scaling value, min is "structural" */
- float max_shear; /* max shear scaling value, UNUSED */
- float avg_spring_len; /* used for normalized springs */
+ short solver_type; /* which solver should be used? txold */
+ short vgroup_bend; /* vertex group for scaling bending stiffness */
+ short vgroup_mass; /* optional vertexgroup name for assigning weight.*/
+ short vgroup_struct; /* vertex group for scaling structural stiffness */
short presets; /* used for presets on GUI */
short pad;
- float timescale; /* parameter how fast cloth runs */
+ int pad2;
} ClothSimSettings;
typedef struct ClothCollSettings
{
+ struct LinkNode *collision_list; /* e.g. pointer to temp memory for collisions */
float epsilon; /* min distance for collisions. */
float self_friction; /* Fiction/damping with self contact. */
float friction; /* Friction/damping applied on contact with other object.*/
+ float selfepsilon; /* for selfcollision */
+ int flags; /* collision flags defined in BKE_cloth.h */
short self_loop_count; /* How many iterations for the selfcollision loop */
short loop_count; /* How many iterations for the collision loop. */
- struct LinkNode *collision_list; /* e.g. pointer to temp memory for collisions */
- int flags; /* collision flags defined in BKE_cloth.h */
- float selfepsilon; /* for selfcollision */
} ClothCollSettings;
-/**
-* This structure describes a cloth object against which the
-* simulation can run.
-*
-* The m and n members of this structure represent the assumed
-* rectangular ordered grid for which the original paper is written.
-* At some point they need to disappear and we need to determine out
-* own connectivity of the mesh based on the actual edges in the mesh.
-*
-**/
-typedef struct Cloth
-{
- struct ClothVertex *verts; /* The vertices that represent this cloth. */
- struct LinkNode *springs; /* The springs connecting the mesh. */
- unsigned int numverts; /* The number of verts == m * n. */
- unsigned int numsprings; /* The count of springs. */
- unsigned int numfaces;
- unsigned char old_solver_type; /* unused, only 1 solver here */
- unsigned char pad2;
- short pad3;
- struct BVH *tree; /* collision tree for this cloth object */
- struct MFace *mfaces;
- struct Implicit_Data *implicit; /* our implicit solver connects to this pointer */
- struct Implicit_Data *implicitEM; /* our implicit solver connects to this pointer */
- struct EdgeHash *edgehash; /* used for selfcollisions */
-} Cloth;
#endif
float loc[3], dloc[3], orig[3];
float size[3], dsize[3];
float rot[3], drot[3];
- float quat[4], dquat[4];
+ /* float quat[4], dquat[4]; (not used ye