forked from bartvdbraak/blender
svn merge -r 13240:13323 https://svn.blender.org/svnroot/bf-blender/trunk/blender
This commit is contained in:
commit
ddef077b38
@ -68,6 +68,7 @@ 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)
|
||||
OPTION(WITH_OPENMP "Enable OpenMP (has to be supported by the compiler)" OFF)
|
||||
OPTION(WITH_BINRELOC "Enable binreloc filepath support" OFF)
|
||||
|
||||
IF(NOT WITH_GAMEENGINE AND WITH_PLAYER)
|
||||
MESSAGE("WARNING: WITH_PLAYER needs WITH_GAMEENGINE")
|
||||
@ -264,6 +265,9 @@ IF(WIN32)
|
||||
SET(FFMPEG_LIB avcodec-51 avformat-51 avutil-49)
|
||||
SET(FFMPEG_LIBPATH ${FFMPEG}/lib)
|
||||
|
||||
SET(BINRELC ${LIBDIR}/binreloc)
|
||||
SET(BINRELC_INC ${BINRELOC}/include)
|
||||
|
||||
SET(LLIBS kernel32 user32 gdi32 comdlg32 advapi32 shell32 ole32 oleaut32 uuid ws2_32 vfw32 winmm)
|
||||
IF(WITH_OPENAL)
|
||||
SET(LLIBS ${LLIBS} dxguid)
|
||||
|
@ -114,6 +114,8 @@ BF_ICONV_INC = '${BF_ICONV}/include'
|
||||
BF_ICONV_LIB = 'iconv'
|
||||
BF_ICONV_LIBPATH = '${BF_ICONV}/lib'
|
||||
|
||||
WITH_BF_BINRELOC = 'true'
|
||||
|
||||
# enable ffmpeg support
|
||||
WITH_BF_FFMPEG = 'true' # -DWITH_FFMPEG
|
||||
BF_FFMPEG = '#extern/ffmpeg'
|
||||
|
@ -106,6 +106,8 @@ BF_WINTAB_INC = '${BF_WINTAB}/INCLUDE'
|
||||
|
||||
WITH_BF_YAFRAY = 'true'
|
||||
|
||||
WITH_BF_BINRELOC = 'false'
|
||||
|
||||
#WITH_BF_NSPR = 'true'
|
||||
#BF_NSPR = $(LIBDIR)/nspr
|
||||
#BF_NSPR_INC = -I$(BF_NSPR)/include -I$(BF_NSPR)/include/nspr
|
||||
|
3
extern/CMakeLists.txt
vendored
3
extern/CMakeLists.txt
vendored
@ -43,3 +43,6 @@ IF(WITH_VERSE)
|
||||
SUBDIRS(verse)
|
||||
ENDIF(WITH_VERSE)
|
||||
|
||||
if(WITH_BINRELOC)
|
||||
SUBDIRS(binreloc)
|
||||
ENDIF(WITH_BINRELOC)
|
||||
|
4
extern/Makefile
vendored
4
extern/Makefile
vendored
@ -56,6 +56,10 @@ ifneq ($(NAN_NO_KETSJI), true)
|
||||
DIRS += bullet2
|
||||
endif
|
||||
|
||||
ifeq ($(WITH_BINRELOC), true)
|
||||
DIRS += binreloc
|
||||
endif
|
||||
|
||||
TARGET =
|
||||
ifneq ($(OS),irix)
|
||||
TARGET=solid
|
||||
|
3
extern/SConscript
vendored
3
extern/SConscript
vendored
@ -17,3 +17,6 @@ if env['WITH_BF_VERSE']:
|
||||
|
||||
if env['WITH_BF_FFMPEG'] and env['BF_FFMPEG_LIB'] == '':
|
||||
SConscript(['ffmpeg/SConscript']);
|
||||
|
||||
if env['OURPLATFORM'] == 'linux2':
|
||||
SConscript(['binreloc/SConscript']);
|
26
extern/binreloc/CMakeLists.txt
vendored
Normal file
26
extern/binreloc/CMakeLists.txt
vendored
Normal file
@ -0,0 +1,26 @@
|
||||
# ***** 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 by The Blender Foundation
|
||||
# All rights reserved.
|
||||
#
|
||||
|
||||
SET(INC ./include ${WINTAB_INC})
|
||||
ADD_DEFINITIONS(-DWITH_BINRELOC)
|
||||
FILE(GLOB SRC *.c)
|
||||
|
||||
BLENDERLIB(binreloc "${SRC}" "${INC}")
|
||||
#, libtype=['core','player'], priority = [25,15] )
|
37
extern/binreloc/Makefile
vendored
Normal file
37
extern/binreloc/Makefile
vendored
Normal file
@ -0,0 +1,37 @@
|
||||
#
|
||||
# ***** 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 by The Blender Foundation
|
||||
# All rights reserved.
|
||||
#
|
||||
#
|
||||
|
||||
LIBNAME = binreloc
|
||||
DIR = $(OCGDIR)/extern/$(LIBNAME)
|
||||
|
||||
include nan_definitions.mk
|
||||
|
||||
CPPFLAGS += -I./include
|
||||
|
||||
|
||||
include nan_compile.mk
|
||||
|
||||
|
||||
install: all debug
|
||||
@[ -d $(DIR) ] || mkdir $(DIR)
|
||||
@[ -d $(DIR)/include ] || mkdir $(DIR)/include
|
||||
@../../intern/tools/cpifdiff.sh include/*.h $(DIR)/include/
|
13
extern/binreloc/SConscript
vendored
Normal file
13
extern/binreloc/SConscript
vendored
Normal file
@ -0,0 +1,13 @@
|
||||
#!/usr/bin/python
|
||||
import sys
|
||||
import os
|
||||
|
||||
Import('env')
|
||||
defs = 'ENABLE_BINRELOC'
|
||||
cflags = []
|
||||
|
||||
sources = ['binreloc.c']
|
||||
incs = 'include'
|
||||
|
||||
env.BlenderLib ( 'extern_binreloc', sources, Split(incs), Split(defs), libtype=['intern','player'], priority=[36, 114], compileflags = cflags)
|
||||
|
766
extern/binreloc/binreloc.c
vendored
Normal file
766
extern/binreloc/binreloc.c
vendored
Normal file
@ -0,0 +1,766 @@
|
||||
/*
|
||||
* BinReloc - a library for creating relocatable executables
|
||||
* Written by: Hongli Lai <h.lai@chello.nl>
|
||||
* http://autopackage.org/
|
||||
*
|
||||
* This source code is public domain. You can relicense this code
|
||||
* under whatever license you want.
|
||||
*
|
||||
* See http://autopackage.org/docs/binreloc/ for
|
||||
* more information and how to use this.
|
||||
*/
|
||||
|
||||
#ifndef __BINRELOC_C__
|
||||
#define __BINRELOC_C__
|
||||
|
||||
#ifdef ENABLE_BINRELOC
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
#endif /* ENABLE_BINRELOC */
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <limits.h>
|
||||
#include <string.h>
|
||||
#include "binreloc.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
|
||||
|
||||
/** @internal
|
||||
* Find the canonical filename of the executable. Returns the filename
|
||||
* (which must be freed) or NULL on error. If the parameter 'error' is
|
||||
* not NULL, the error code will be stored there, if an error occured.
|
||||
*/
|
||||
static char *
|
||||
_br_find_exe (BrInitError *error)
|
||||
{
|
||||
#ifndef ENABLE_BINRELOC
|
||||
if (error)
|
||||
*error = BR_INIT_ERROR_DISABLED;
|
||||
return NULL;
|
||||
#else
|
||||
char *path, *path2, *line, *result;
|
||||
size_t buf_size;
|
||||
ssize_t size;
|
||||
struct stat stat_buf;
|
||||
FILE *f;
|
||||
|
||||
/* Read from /proc/self/exe (symlink) */
|
||||
if (sizeof (path) > SSIZE_MAX)
|
||||
buf_size = SSIZE_MAX - 1;
|
||||
else
|
||||
buf_size = PATH_MAX - 1;
|
||||
path = (char *) malloc (buf_size);
|
||||
if (path == NULL) {
|
||||
/* Cannot allocate memory. */
|
||||
if (error)
|
||||
*error = BR_INIT_ERROR_NOMEM;
|
||||
return NULL;
|
||||
}
|
||||
path2 = (char *) malloc (buf_size);
|
||||
if (path2 == NULL) {
|
||||
/* Cannot allocate memory. */
|
||||
if (error)
|
||||
*error = BR_INIT_ERROR_NOMEM;
|
||||
free (path);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
strncpy (path2, "/proc/self/exe", buf_size - 1);
|
||||
|
||||
while (1) {
|
||||
int i;
|
||||
|
||||
size = readlink (path2, path, buf_size - 1);
|
||||
if (size == -1) {
|
||||
/* Error. */
|
||||
free (path2);
|
||||
break;
|
||||
}
|
||||
|
||||
/* readlink() success. */
|
||||
path[size] = '\0';
|
||||
|
||||
/* Check whether the symlink's target is also a symlink.
|
||||
* We want to get the final target. */
|
||||
i = stat (path, &stat_buf);
|
||||
if (i == -1) {
|
||||
/* Error. */
|
||||
free (path2);
|
||||
break;
|
||||
}
|
||||
|
||||
/* stat() success. */
|
||||
if (!S_ISLNK (stat_buf.st_mode)) {
|
||||
/* path is not a symlink. Done. */
|
||||
free (path2);
|
||||
return path;
|
||||
}
|
||||
|
||||
/* path is a symlink. Continue loop and resolve this. */
|
||||
strncpy (path, path2, buf_size - 1);
|
||||
}
|
||||
|
||||
|
||||
/* readlink() or stat() failed; this can happen when the program is
|
||||
* running in Valgrind 2.2. Read from /proc/self/maps as fallback. */
|
||||
|
||||
buf_size = PATH_MAX + 128;
|
||||
line = (char *) realloc (path, buf_size);
|
||||
if (line == NULL) {
|
||||
/* Cannot allocate memory. */
|
||||
free (path);
|
||||
if (error)
|
||||
*error = BR_INIT_ERROR_NOMEM;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
f = fopen ("/proc/self/maps", "r");
|
||||
if (f == NULL) {
|
||||
free (line);
|
||||
if (error)
|
||||
*error = BR_INIT_ERROR_OPEN_MAPS;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* The first entry should be the executable name. */
|
||||
result = fgets (line, (int) buf_size, f);
|
||||
if (result == NULL) {
|
||||
fclose (f);
|
||||
free (line);
|
||||
if (error)
|
||||
*error = BR_INIT_ERROR_READ_MAPS;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Get rid of newline character. */
|
||||
buf_size = strlen (line);
|
||||
if (buf_size <= 0) {
|
||||
/* Huh? An empty string? */
|
||||
fclose (f);
|
||||
free (line);
|
||||
if (error)
|
||||
*error = BR_INIT_ERROR_INVALID_MAPS;
|
||||
return NULL;
|
||||
}
|
||||
if (line[buf_size - 1] == 10)
|
||||
line[buf_size - 1] = 0;
|
||||
|
||||
/* Extract the filename; it is always an absolute path. */
|
||||
path = strchr (line, '/');
|
||||
|
||||
/* Sanity check. */
|
||||
if (strstr (line, " r-xp ") == NULL || path == NULL) {
|
||||
fclose (f);
|
||||
free (line);
|
||||
if (error)
|
||||
*error = BR_INIT_ERROR_INVALID_MAPS;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
path = strdup (path);
|
||||
free (line);
|
||||
fclose (f);
|
||||
return path;
|
||||
#endif /* ENABLE_BINRELOC */
|
||||
}
|
||||
|
||||
|
||||
/** @internal
|
||||
* Find the canonical filename of the executable which owns symbol.
|
||||
* Returns a filename which must be freed, or NULL on error.
|
||||
*/
|
||||
static char *
|
||||
_br_find_exe_for_symbol (const void *symbol, BrInitError *error)
|
||||
{
|
||||
#ifndef ENABLE_BINRELOC
|
||||
if (error)
|
||||
*error = BR_INIT_ERROR_DISABLED;
|
||||
return (char *) NULL;
|
||||
#else
|
||||
#define SIZE PATH_MAX + 100
|
||||
FILE *f;
|
||||
size_t address_string_len;
|
||||
char *address_string, line[SIZE], *found;
|
||||
|
||||
if (symbol == NULL)
|
||||
return (char *) NULL;
|
||||
|
||||
f = fopen ("/proc/self/maps", "r");
|
||||
if (f == NULL)
|
||||
return (char *) NULL;
|
||||
|
||||
address_string_len = 4;
|
||||
address_string = (char *) malloc (address_string_len);
|
||||
found = (char *) NULL;
|
||||
|
||||
while (!feof (f)) {
|
||||
char *start_addr, *end_addr, *end_addr_end, *file;
|
||||
void *start_addr_p, *end_addr_p;
|
||||
size_t len;
|
||||
|
||||
if (fgets (line, SIZE, f) == NULL)
|
||||
break;
|
||||
|
||||
/* Sanity check. */
|
||||
if (strstr (line, " r-xp ") == NULL || strchr (line, '/') == NULL)
|
||||
continue;
|
||||
|
||||
/* Parse line. */
|
||||
start_addr = line;
|
||||
end_addr = strchr (line, '-');
|
||||
file = strchr (line, '/');
|
||||
|
||||
/* More sanity check. */
|
||||
if (!(file > end_addr && end_addr != NULL && end_addr[0] == '-'))
|
||||
continue;
|
||||
|
||||
end_addr[0] = '\0';
|
||||
end_addr++;
|
||||
end_addr_end = strchr (end_addr, ' ');
|
||||
if (end_addr_end == NULL)
|
||||
continue;
|
||||
|
||||
end_addr_end[0] = '\0';
|
||||
len = strlen (file);
|
||||
if (len == 0)
|
||||
continue;
|
||||
if (file[len - 1] == '\n')
|
||||
file[len - 1] = '\0';
|
||||
|
||||
/* Get rid of "(deleted)" from the filename. */
|
||||
len = strlen (file);
|
||||
if (len > 10 && strcmp (file + len - 10, " (deleted)") == 0)
|
||||
file[len - 10] = '\0';
|
||||
|
||||
/* I don't know whether this can happen but better safe than sorry. */
|
||||
len = strlen (start_addr);
|
||||
if (len != strlen (end_addr))
|
||||
continue;
|
||||
|
||||
|
||||
/* Transform the addresses into a string in the form of 0xdeadbeef,
|
||||
* then transform that into a pointer. */
|
||||
if (address_string_len < len + 3) {
|
||||
address_string_len = len + 3;
|
||||
address_string = (char *) realloc (address_string, address_string_len);
|
||||
}
|
||||
|
||||
memcpy (address_string, "0x", 2);
|
||||
memcpy (address_string + 2, start_addr, len);
|
||||
address_string[2 + len] = '\0';
|
||||
sscanf (address_string, "%p", &start_addr_p);
|
||||
|
||||
memcpy (address_string, "0x", 2);
|
||||
memcpy (address_string + 2, end_addr, len);
|
||||
address_string[2 + len] = '\0';
|
||||
sscanf (address_string, "%p", &end_addr_p);
|
||||
|
||||
|
||||
if (symbol >= start_addr_p && symbol < end_addr_p) {
|
||||
found = file;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
free (address_string);
|
||||
fclose (f);
|
||||
|
||||
if (found == NULL)
|
||||
return (char *) NULL;
|
||||
else
|
||||
return strdup (found);
|
||||
#endif /* ENABLE_BINRELOC */
|
||||
}
|
||||
|
||||
|
||||
#ifndef BINRELOC_RUNNING_DOXYGEN
|
||||
#undef NULL
|
||||
#define NULL ((void *) 0) /* typecasted as char* for C++ type safeness */
|
||||
#endif
|
||||
|
||||
static char *exe = (char *) NULL;
|
||||
|
||||
|
||||
/** Initialize the BinReloc library (for applications).
|
||||
*
|
||||
* This function must be called before using any other BinReloc functions.
|
||||
* It attempts to locate the application's canonical filename.
|
||||
*
|
||||
* @note If you want to use BinReloc for a library, then you should call
|
||||
* br_init_lib() instead.
|
||||
*
|
||||
* @param error If BinReloc failed to initialize, then the error code will
|
||||
* be stored in this variable. Set to NULL if you want to
|
||||
* ignore this. See #BrInitError for a list of error codes.
|
||||
*
|
||||
* @returns 1 on success, 0 if BinReloc failed to initialize.
|
||||
*/
|
||||
int
|
||||
br_init (BrInitError *error)
|
||||
{
|
||||
exe = _br_find_exe (error);
|
||||
return exe != NULL;
|
||||
}
|
||||
|
||||
|
||||
/** Initialize the BinReloc library (for libraries).
|
||||
*
|
||||
* This function must be called before using any other BinReloc functions.
|
||||
* It attempts to locate the calling library's canonical filename.
|
||||
*
|
||||
* @note The BinReloc source code MUST be included in your library, or this
|
||||
* function won't work correctly.
|
||||
*
|
||||
* @param error If BinReloc failed to initialize, then the error code will
|
||||
* be stored in this variable. Set to NULL if you want to
|
||||
* ignore this. See #BrInitError for a list of error codes.
|
||||
*
|
||||
* @returns 1 on success, 0 if a filename cannot be found.
|
||||
*/
|
||||
int
|
||||
br_init_lib (BrInitError *error)
|
||||
{
|
||||
exe = _br_find_exe_for_symbol ((const void *) "", error);
|
||||
return exe != NULL;
|
||||
}
|
||||
|
||||
|
||||
/** Find the canonical filename of the current application.
|
||||
*
|
||||
* @param default_exe A default filename which will be used as fallback.
|
||||
* @returns A string containing the application's canonical filename,
|
||||
* which must be freed when no longer necessary. If BinReloc is
|
||||
* not initialized, or if br_init() failed, then a copy of
|
||||
* default_exe will be returned. If default_exe is NULL, then
|
||||
* NULL will be returned.
|
||||
*/
|
||||
char *
|
||||
br_find_exe (const char *default_exe)
|
||||
{
|
||||
if (exe == (char *) NULL) {
|
||||
/* BinReloc is not initialized. */
|
||||
if (default_exe != (const char *) NULL)
|
||||
return strdup (default_exe);
|
||||
else
|
||||
return (char *) NULL;
|
||||
}
|
||||
return strdup (exe);
|
||||
}
|
||||
|
||||
|
||||
/** Locate the directory in which the current application is installed.
|
||||
*
|
||||
* The prefix is generated by the following pseudo-code evaluation:
|
||||
* \code
|
||||
* dirname(exename)
|
||||
* \endcode
|
||||
*
|
||||
* @param default_dir A default directory which will used as fallback.
|
||||
* @return A string containing the directory, which must be freed when no
|
||||
* longer necessary. If BinReloc is not initialized, or if the
|
||||
* initialization function failed, then a copy of default_dir
|
||||
* will be returned. If default_dir is NULL, then NULL will be
|
||||
* returned.
|
||||
*/
|
||||
char *
|
||||
br_find_exe_dir (const char *default_dir)
|
||||
{
|
||||
if (exe == NULL) {
|
||||
/* BinReloc not initialized. */
|
||||
if (default_dir != NULL)
|
||||
return strdup (default_dir);
|
||||
else
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return br_dirname (exe);
|
||||
}
|
||||
|
||||
|
||||
/** Locate the prefix in which the current application is installed.
|
||||
*
|
||||
* The prefix is generated by the following pseudo-code evaluation:
|
||||
* \code
|
||||
* dirname(dirname(exename))
|
||||
* \endcode
|
||||
*
|
||||
* @param default_prefix A default prefix which will used as fallback.
|
||||
* @return A string containing the prefix, which must be freed when no
|
||||
* longer necessary. If BinReloc is not initialized, or if
|
||||
* the initialization function failed, then a copy of default_prefix
|
||||
* will be returned. If default_prefix is NULL, then NULL will be returned.
|
||||
*/
|
||||
char *
|
||||
br_find_prefix (const char *default_prefix)
|
||||
{
|
||||
char *dir1, *dir2;
|
||||
|
||||
if (exe == (char *) NULL) {
|
||||
/* BinReloc not initialized. */
|
||||
if (default_prefix != (const char *) NULL)
|
||||
return strdup (default_prefix);
|
||||
else
|
||||
return (char *) NULL;
|
||||
}
|
||||
|
||||
dir1 = br_dirname (exe);
|
||||
dir2 = br_dirname (dir1);
|
||||
free (dir1);
|
||||
return dir2;
|
||||
}
|
||||
|
||||
|
||||
/** Locate the application's binary folder.
|
||||
*
|
||||
* The path is generated by the following pseudo-code evaluation:
|
||||
* \code
|
||||
* prefix + "/bin"
|
||||
* \endcode
|
||||
*
|
||||
* @param default_bin_dir A default path which will used as fallback.
|
||||
* @return A string containing the bin folder's path, which must be freed when
|
||||
* no longer necessary. If BinReloc is not initialized, or if
|
||||
* the initialization function failed, then a copy of default_bin_dir will
|
||||
* be returned. If default_bin_dir is NULL, then NULL will be returned.
|
||||
*/
|
||||
char *
|
||||
br_find_bin_dir (const char *default_bin_dir)
|
||||
{
|
||||
char *prefix, *dir;
|
||||
|
||||
prefix = br_find_prefix ((const char *) NULL);
|
||||
if (prefix == (char *) NULL) {
|
||||
/* BinReloc not initialized. */
|
||||
if (default_bin_dir != (const char *) NULL)
|
||||
return strdup (default_bin_dir);
|
||||
else
|
||||
return (char *) NULL;
|
||||
}
|
||||
|
||||
dir = br_build_path (prefix, "bin");
|
||||
free (prefix);
|
||||
return dir;
|
||||
}
|
||||
|
||||
|
||||
/** Locate the application's superuser binary folder.
|
||||
*
|
||||
* The path is generated by the following pseudo-code evaluation:
|
||||
* \code
|
||||
* prefix + "/sbin"
|
||||
* \endcode
|
||||
*
|
||||
* @param default_sbin_dir A default path which will used as fallback.
|
||||
* @return A string containing the sbin folder's path, which must be freed when
|
||||
* no longer necessary. If BinReloc is not initialized, or if the
|
||||
* initialization function failed, then a copy of default_sbin_dir will
|
||||
* be returned. If default_bin_dir is NULL, then NULL will be returned.
|
||||
*/
|
||||
char *
|
||||
br_find_sbin_dir (const char *default_sbin_dir)
|
||||
{
|
||||
char *prefix, *dir;
|
||||
|
||||
prefix = br_find_prefix ((const char *) NULL);
|
||||
if (prefix == (char *) NULL) {
|
||||
/* BinReloc not initialized. */
|
||||
if (default_sbin_dir != (const char *) NULL)
|
||||
return strdup (default_sbin_dir);
|
||||
else
|
||||
return (char *) NULL;
|
||||
}
|
||||
|
||||
dir = br_build_path (prefix, "sbin");
|
||||
free (prefix);
|
||||
return dir;
|
||||
}
|
||||
|
||||
|
||||
/** Locate the application's data folder.
|
||||
*
|
||||
* The path is generated by the following pseudo-code evaluation:
|
||||
* \code
|
||||
* prefix + "/share"
|
||||
* \endcode
|
||||
*
|
||||
* @param default_data_dir A default path which will used as fallback.
|
||||
* @return A string containing the data folder's path, which must be freed when
|
||||
* no longer necessary. If BinReloc is not initialized, or if the
|
||||
* initialization function failed, then a copy of default_data_dir
|
||||
* will be returned. If default_data_dir is NULL, then NULL will be
|
||||
* returned.
|
||||
*/
|
||||
char *
|
||||
br_find_data_dir (const char *default_data_dir)
|
||||
{
|
||||
char *prefix, *dir;
|
||||
|
||||
prefix = br_find_prefix ((const char *) NULL);
|
||||
if (prefix == (char *) NULL) {
|
||||
/* BinReloc not initialized. */
|
||||
if (default_data_dir != (const char *) NULL)
|
||||
return strdup (default_data_dir);
|
||||
else
|
||||
return (char *) NULL;
|
||||
}
|
||||
|
||||
dir = br_build_path (prefix, "share");
|
||||
free (prefix);
|
||||
return dir;
|
||||
}
|
||||
|
||||
|
||||
/** Locate the application's localization folder.
|
||||
*
|
||||
* The path is generated by the following pseudo-code evaluation:
|
||||
* \code
|
||||
* prefix + "/share/locale"
|
||||
* \endcode
|
||||
*
|
||||
* @param default_locale_dir A default path which will used as fallback.
|
||||
* @return A string containing the localization folder's path, which must be freed when
|
||||
* no longer necessary. If BinReloc is not initialized, or if the
|
||||
* initialization function failed, then a copy of default_locale_dir will be returned.
|
||||
* If default_locale_dir is NULL, then NULL will be returned.
|
||||
*/
|
||||
char *
|
||||
br_find_locale_dir (const char *default_locale_dir)
|
||||
{
|
||||
char *data_dir, *dir;
|
||||
|
||||
data_dir = br_find_data_dir ((const char *) NULL);
|
||||
if (data_dir == (char *) NULL) {
|
||||
/* BinReloc not initialized. */
|
||||
if (default_locale_dir != (const char *) NULL)
|
||||
return strdup (default_locale_dir);
|
||||
else
|
||||
return (char *) NULL;
|
||||
}
|
||||
|
||||
dir = br_build_path (data_dir, "locale");
|
||||
free (data_dir);
|
||||
return dir;
|
||||
}
|
||||
|
||||
|
||||
/** Locate the application's library folder.
|
||||
*
|
||||
* The path is generated by the following pseudo-code evaluation:
|
||||
* \code
|
||||
* prefix + "/lib"
|
||||
* \endcode
|
||||
*
|
||||
* @param default_lib_dir A default path which will used as fallback.
|
||||
* @return A string containing the library folder's path, which must be freed when
|
||||
* no longer necessary. If BinReloc is not initialized, or if the initialization
|
||||
* function failed, then a copy of default_lib_dir will be returned.
|
||||
* If default_lib_dir is NULL, then NULL will be returned.
|
||||
*/
|
||||
char *
|
||||
br_find_lib_dir (const char *default_lib_dir)
|
||||
{
|
||||
char *prefix, *dir;
|
||||
|
||||
prefix = br_find_prefix ((const char *) NULL);
|
||||
if (prefix == (char *) NULL) {
|
||||
/* BinReloc not initialized. */
|
||||
if (default_lib_dir != (const char *) NULL)
|
||||
return strdup (default_lib_dir);
|
||||
else
|
||||
return (char *) NULL;
|
||||
}
|
||||
|
||||
dir = br_build_path (prefix, "lib");
|
||||
free (prefix);
|
||||
return dir;
|
||||
}
|
||||
|
||||
|
||||
/** Locate the application's libexec folder.
|
||||
*
|
||||
* The path is generated by the following pseudo-code evaluation:
|
||||
* \code
|
||||
* prefix + "/libexec"
|
||||
* \endcode
|
||||
*
|
||||
* @param default_libexec_dir A default path which will used as fallback.
|
||||
* @return A string containing the libexec folder's path, which must be freed when
|
||||
* no longer necessary. If BinReloc is not initialized, or if the initialization
|
||||
* function failed, then a copy of default_libexec_dir will be returned.
|
||||
* If default_libexec_dir is NULL, then NULL will be returned.
|
||||
*/
|
||||
char *
|
||||
br_find_libexec_dir (const char *default_libexec_dir)
|
||||
{
|
||||
char *prefix, *dir;
|
||||
|
||||
prefix = br_find_prefix ((const char *) NULL);
|
||||
if (prefix == (char *) NULL) {
|
||||
/* BinReloc not initialized. */
|
||||
if (default_libexec_dir != (const char *) NULL)
|
||||
return strdup (default_libexec_dir);
|
||||
else
|
||||
return (char *) NULL;
|
||||
}
|
||||
|
||||
dir = br_build_path (prefix, "libexec");
|
||||
free (prefix);
|
||||
return dir;
|
||||
}
|
||||
|
||||
|
||||
/** Locate the application's configuration files folder.
|
||||
*
|
||||
* The path is generated by the following pseudo-code evaluation:
|
||||
* \code
|
||||
* prefix + "/etc"
|
||||
* \endcode
|
||||
*
|
||||
* @param default_etc_dir A default path which will used as fallback.
|
||||
* @return A string containing the etc folder's path, which must be freed when
|
||||
* no longer necessary. If BinReloc is not initialized, or if the initialization
|
||||
* function failed, then a copy of default_etc_dir will be returned.
|
||||
* If default_etc_dir is NULL, then NULL will be returned.
|
||||
*/
|
||||
char *
|
||||
br_find_etc_dir (const char *default_etc_dir)
|
||||
{
|
||||
char *prefix, *dir;
|
||||
|
||||
prefix = br_find_prefix ((const char *) NULL);
|
||||
if (prefix == (char *) NULL) {
|
||||
/* BinReloc not initialized. */
|
||||
if (default_etc_dir != (const char *) NULL)
|
||||
return strdup (default_etc_dir);
|
||||
else
|
||||
return (char *) NULL;
|
||||
}
|
||||
|
||||
dir = br_build_path (prefix, "etc");
|
||||
free (prefix);
|
||||
return dir;
|
||||
}
|
||||
|
||||
|
||||
/***********************
|
||||
* Utility functions
|
||||
***********************/
|
||||
|
||||
/** Concatenate str1 and str2 to a newly allocated string.
|
||||
*
|
||||
* @param str1 A string.
|
||||
* @param str2 Another string.
|
||||
* @returns A newly-allocated string. This string should be freed when no longer needed.
|
||||
*/
|
||||
char *
|
||||
br_strcat (const char *str1, const char *str2)
|
||||
{
|
||||
char *result;
|
||||
size_t len1, len2;
|
||||
|
||||
if (str1 == NULL)
|
||||
str1 = "";
|
||||
if (str2 == NULL)
|
||||
str2 = "";
|
||||
|
||||
len1 = strlen (str1);
|
||||
len2 = strlen (str2);
|
||||
|
||||
result = (char *) malloc (len1 + len2 + 1);
|
||||
memcpy (result, str1, len1);
|
||||
memcpy (result + len1, str2, len2);
|
||||
result[len1 + len2] = '\0';
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
char *
|
||||
br_build_path (const char *dir, const char *file)
|
||||
{
|
||||
char *dir2, *result;
|
||||
size_t len;
|
||||
int must_free = 0;
|
||||
|
||||
len = strlen (dir);
|
||||
if (len > 0 && dir[len - 1] != '/') {
|
||||
dir2 = br_strcat (dir, "/");
|
||||
must_free = 1;
|
||||
} else
|
||||
dir2 = (char *) dir;
|
||||
|
||||
result = br_strcat (dir2, file);
|
||||
if (must_free)
|
||||
free (dir2);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
/* Emulates glibc's strndup() */
|
||||
static char *
|
||||
br_strndup (const char *str, size_t size)
|
||||
{
|
||||
char *result = (char *) NULL;
|
||||
size_t len;
|
||||
|
||||
if (str == (const char *) NULL)
|
||||
return (char *) NULL;
|
||||
|
||||
len = strlen (str);
|
||||
if (len == 0)
|
||||
return strdup ("");
|
||||
if (size > len)
|
||||
size = len;
|
||||
|
||||
result = (char *) malloc (len + 1);
|
||||
memcpy (result, str, size);
|
||||
result[size] = '\0';
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
/** Extracts the directory component of a path.
|
||||
*
|
||||
* Similar to g_dirname() or the dirname commandline application.
|
||||
*
|
||||
* Example:
|
||||
* \code
|
||||
* br_dirname ("/usr/local/foobar"); --> Returns: "/usr/local"
|
||||
* \endcode
|
||||
*
|
||||
* @param path A path.
|
||||
* @returns A directory name. This string should be freed when no longer needed.
|
||||
*/
|
||||
char *
|
||||
br_dirname (const char *path)
|
||||
{
|
||||
char *end, *result;
|
||||
|
||||
if (path == (const char *) NULL)
|
||||
return (char *) NULL;
|
||||
|
||||
end = strrchr (path, '/');
|
||||
if (end == (const char *) NULL)
|
||||
return strdup (".");
|
||||
|
||||
while (end > path && *end == '/')
|
||||
end--;
|
||||
result = br_strndup (path, end - path + 1);
|
||||
if (result[0] == 0) {
|
||||
free (result);
|
||||
return strdup ("/");
|
||||
} else
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif /* __BINRELOC_C__ */
|
80
extern/binreloc/include/binreloc.h
vendored
Normal file
80
extern/binreloc/include/binreloc.h
vendored
Normal file
@ -0,0 +1,80 @@
|
||||
/*
|
||||
* BinReloc - a library for creating relocatable executables
|
||||
* Written by: Hongli Lai <h.lai@chello.nl>
|
||||
* http://autopackage.org/
|
||||
*
|
||||
* This source code is public domain. You can relicense this code
|
||||
* under whatever license you want.
|
||||
*
|
||||
* See http://autopackage.org/docs/binreloc/ for
|
||||
* more information and how to use this.
|
||||
*/
|
||||
|
||||
#ifndef __BINRELOC_H__
|
||||
#define __BINRELOC_H__
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
|
||||
/** These error codes can be returned by br_init(), br_init_lib(), gbr_init() or gbr_init_lib(). */
|
||||
typedef enum {
|
||||
/** Cannot allocate memory. */
|
||||
BR_INIT_ERROR_NOMEM,
|
||||
/** Unable to open /proc/self/maps; see errno for details. */
|
||||
BR_INIT_ERROR_OPEN_MAPS,
|
||||
/** Unable to read from /proc/self/maps; see errno for details. */
|
||||
BR_INIT_ERROR_READ_MAPS,
|
||||
/** The file format of /proc/self/maps is invalid; kernel bug? */
|
||||
BR_INIT_ERROR_INVALID_MAPS,
|
||||
/** BinReloc is disabled (the ENABLE_BINRELOC macro is not defined). */
|
||||
BR_INIT_ERROR_DISABLED
|
||||
} BrInitError;
|
||||
|
||||
|
||||
#ifndef BINRELOC_RUNNING_DOXYGEN
|
||||
/* Mangle symbol names to avoid symbol collisions with other ELF objects. */
|
||||
#define br_init zLhm65070058860608_br_init
|
||||
#define br_init_lib zLhm65070058860608_br_init_lib
|
||||
#define br_find_exe zLhm65070058860608_br_find_exe
|
||||
#define br_find_exe_dir zLhm65070058860608_br_find_exe_dir
|
||||
#define br_find_prefix zLhm65070058860608_br_find_prefix
|
||||
#define br_find_bin_dir zLhm65070058860608_br_find_bin_dir
|
||||
#define br_find_sbin_dir zLhm65070058860608_br_find_sbin_dir
|
||||
#define br_find_data_dir zLhm65070058860608_br_find_data_dir
|
||||
#define br_find_locale_dir zLhm65070058860608_br_find_locale_dir
|
||||
#define br_find_lib_dir zLhm65070058860608_br_find_lib_dir
|
||||
#define br_find_libexec_dir zLhm65070058860608_br_find_libexec_dir
|
||||
#define br_find_etc_dir zLhm65070058860608_br_find_etc_dir
|
||||
#define br_strcat zLhm65070058860608_br_strcat
|
||||
#define br_build_path zLhm65070058860608_br_build_path
|
||||
#define br_dirname zLhm65070058860608_br_dirname
|
||||
|
||||
|
||||
#endif
|
||||
int br_init (BrInitError *error);
|
||||
int br_init_lib (BrInitError *error);
|
||||
|
||||
char *br_find_exe (const char *default_exe);
|
||||
char *br_find_exe_dir (const char *default_dir);
|
||||
char *br_find_prefix (const char *default_prefix);
|
||||
char *br_find_bin_dir (const char *default_bin_dir);
|
||||
char *br_find_sbin_dir (const char *default_sbin_dir);
|
||||
char *br_find_data_dir (const char *default_data_dir);
|
||||
char *br_find_locale_dir (const char *default_locale_dir);
|
||||
char *br_find_lib_dir (const char *default_lib_dir);
|
||||
char *br_find_libexec_dir (const char *default_libexec_dir);
|
||||
char *br_find_etc_dir (const char *default_etc_dir);
|
||||
|
||||
/* Utility functions */
|
||||
char *br_strcat (const char *str1, const char *str2);
|
||||
char *br_build_path (const char *dir, const char *file);
|
||||
char *br_dirname (const char *path);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif /* __BINRELOC_H__ */
|
@ -152,8 +152,9 @@ void BMF_DrawStringTexture(BMF_Font* font, char* string, float x, float y, float
|
||||
* @param fbuf float image buffer, when NULL to not operate on it.
|
||||
* @param w image buffer width.
|
||||
* @param h image buffer height.
|
||||
* @param channels number of channels in the image (3 or 4 - currently)
|
||||
*/
|
||||
void BMF_DrawStringBuf(BMF_Font* font, char *str, int posx, int posy, float *col, unsigned char *buf, float *fbuf, int w, int h);
|
||||
void BMF_DrawStringBuf(BMF_Font* font, char *str, int posx, int posy, float *col, unsigned char *buf, float *fbuf, int w, int h, int channels);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
@ -180,7 +180,7 @@ void BMF_DrawStringTexture(BMF_Font* font, char *string, float x, float y, float
|
||||
((BMF_BitmapFont*)font)->DrawStringTexture(string, x, y, z);
|
||||
}
|
||||
|
||||
void BMF_DrawStringBuf(BMF_Font* font, char *str, int posx, int posy, float *col, unsigned char *buf, float *fbuf, int w, int h) {
|
||||
void BMF_DrawStringBuf(BMF_Font* font, char *str, int posx, int posy, float *col, unsigned char *buf, float *fbuf, int w, int h, int channels) {
|
||||
if (!font) return;
|
||||
((BMF_BitmapFont*)font)->DrawStringBuf(str, posx, posy, col, buf, fbuf, w, h);
|
||||
((BMF_BitmapFont*)font)->DrawStringBuf(str, posx, posy, col, buf, fbuf, w, h, channels);
|
||||
}
|
||||
|
@ -241,7 +241,7 @@ void BMF_BitmapFont::DrawStringTexture(char *str, float x, float y, float z)
|
||||
}
|
||||
|
||||
#define FTOCHAR(val) val<=0.0f?0: (val>=1.0f?255: (char)(255.0f*val))
|
||||
void BMF_BitmapFont::DrawStringBuf(char *str, int posx, int posy, float *col, unsigned char *buf, float *fbuf, int w, int h)
|
||||
void BMF_BitmapFont::DrawStringBuf(char *str, int posx, int posy, float *col, unsigned char *buf, float *fbuf, int w, int h, int channels)
|
||||
{
|
||||
int x, y;
|
||||
|
||||
@ -277,7 +277,9 @@ void BMF_BitmapFont::DrawStringBuf(char *str, int posx, int posy, float *col, un
|
||||
pixel[0] = colch[0];
|
||||
pixel[1] = colch[1];
|
||||
pixel[2] = colch[2];
|
||||
pixel[4] = 1; /*colch[3];*/
|
||||
if (channels==4) {
|
||||
pixel[4] = 1; /*colch[3];*/
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@ -310,7 +312,9 @@ void BMF_BitmapFont::DrawStringBuf(char *str, int posx, int posy, float *col, un
|
||||
pixel[0] = col[0];
|
||||
pixel[1] = col[1];
|
||||
pixel[2] = col[2];
|
||||
pixel[3] = 1; /*col[3];*/
|
||||
if (channels==4) {
|
||||
pixel[3] = 1; /*col[3];*/
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -130,8 +130,9 @@ public:
|
||||
* @param fbuf float image buffer, when NULL to not operate on it.
|
||||
* @param w image buffer width.
|
||||
* @param h image buffer height.
|
||||
* @param channels number of channels in the image (3 or 4 - currently)
|
||||
*/
|
||||
void DrawStringBuf(char *str, int posx, int posy, float *col, unsigned char *buf, float *fbuf, int w, int h);
|
||||
void DrawStringBuf(char *str, int posx, int posy, float *col, unsigned char *buf, float *fbuf, int w, int h, int channels);
|
||||
|
||||
protected:
|
||||
/** Pointer to the font data. */
|
||||
|
@ -31,7 +31,7 @@
|
||||
|
||||
include nan_definitions.mk
|
||||
|
||||
export VERSION := $(shell cat VERSION)
|
||||
export VERSION := $(shell getversion.py)
|
||||
|
||||
BLENDNAME=blender-$(VERSION)-$(CONFIG_GUESS)-py$(NAN_PYTHON_VERSION)$(TYPE)
|
||||
export DISTDIR=$(NAN_OBJDIR)/$(BLENDNAME)
|
||||
|
55
release/getversion.py
Executable file
55
release/getversion.py
Executable file
@ -0,0 +1,55 @@
|
||||
#!/usr/bin/env python
|
||||
# ***** 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 by the Blender Foundation
|
||||
# All rights reserved.
|
||||
#
|
||||
# The Original Code is: all of this file.
|
||||
#
|
||||
# Contributor(s): none yet.
|
||||
#
|
||||
import sys, os, re
|
||||
|
||||
nanblenderhome = os.getenv("NANBLENDERHOME");
|
||||
|
||||
if nanblenderhome == None:
|
||||
nanblenderhome = os.path.dirname(os.path.abspath(sys.argv[0]))+"/.."
|
||||
|
||||
config = nanblenderhome+"/source/blender/blenkernel/BKE_blender.h"
|
||||
|
||||
infile = open(config)
|
||||
|
||||
major = None
|
||||
minor = None
|
||||
|
||||
for line in infile.readlines():
|
||||
m = re.search("#define BLENDER_VERSION\s+(\d+)", line)
|
||||
if m:
|
||||
major = m.group(1)
|
||||
m = re.search("#define BLENDER_SUBVERSION\s+(\d+)", line)
|
||||
if m:
|
||||
minor = m.group(1)
|
||||
if minor and major:
|
||||
major = float(major) / 100.0
|
||||
break
|
||||
|
||||
infile.close()
|
||||
|
||||
if minor and major:
|
||||
print str(major)+"."+minor
|
||||
else:
|
||||
print "unknownversion"
|
@ -234,6 +234,19 @@ Tooltip: 'Export to M3G'
|
||||
#
|
||||
# * Modul shutil is not needed any longer. Exporter has its own copy_file.
|
||||
# (realized and inspired by ideasman_42 and Martin Neumann)
|
||||
#
|
||||
# History 0.8
|
||||
#
|
||||
# * Blender works with SpotAngles 1..180 but M3G works only with 0..90
|
||||
# M3G use the 'half angle' (cut off angle) (Thanks to Martin Storsjö)
|
||||
#
|
||||
# * Error fixed: Texture coordinates was not calculated correct.
|
||||
# (Thanks to Milan Piskla, Vlad, Max Gilead, Regis Cosnier ...)
|
||||
#
|
||||
# * New options in GUI:
|
||||
# M3G Version 2.0 : Will export M3G files Vers. 2.0 in future
|
||||
# Game Physics: Adds Game Physics infos for NOPE API
|
||||
#
|
||||
# --------------------------------------------------------------------------#
|
||||
# TODO: Export only selected mesh
|
||||
# TODO: Optimize Bones <--> Vertex Group mapping
|
||||
@ -1213,7 +1226,7 @@ class M3GVertexArray(M3GObject3D):
|
||||
# Reverse t coordinate because M3G uses a different 2D coordinate system than Blender.
|
||||
if self.uvmapping:
|
||||
for i in range(0,len(self.components),2):
|
||||
self.components[i]= int(self.components[i]*(-1))
|
||||
self.components[i+1]= int(self.components[i+1]*(-1)) #Error in Version 0.7
|
||||
for i in range(len(self.components)):
|
||||
if abs(self.components[i])>maxValue:raise Exception( i+". element too great/small!")
|
||||
|
||||
@ -1284,7 +1297,7 @@ class M3GVertexArray(M3GObject3D):
|
||||
self.blenderIndexes[key]=index
|
||||
#print"blenderIndexes",self.blenderIndexes
|
||||
else:
|
||||
# print "VertexArray.append: element=",element
|
||||
print "VertexArray.append: element=",element
|
||||
self.components.append(element)
|
||||
|
||||
class M3GVertexBuffer(M3GObject3D):
|
||||
@ -2001,7 +2014,7 @@ class M3GTranslator:
|
||||
self.scene = Blender.Scene.GetCurrent()
|
||||
self.world = self.translateWorld(self.scene)
|
||||
|
||||
for obj in self.scene.objects:
|
||||
for obj in self.scene.objects :
|
||||
if obj.getType()=='Camera': # older Version: isinstance(obj.getData(),Types.CameraType)
|
||||
self.translateCamera(obj)
|
||||
elif obj.getType()=='Mesh':
|
||||
@ -2176,7 +2189,7 @@ class M3GTranslator:
|
||||
if mOptions.createAmbientLight & mOptions.lightingEnabled:
|
||||
lLight = M3GLight()
|
||||
lLight.mode = lLight.modes['AMBIENT']
|
||||
lLight.color = self.translateRGB(AllWorlds[0].getAmb())
|
||||
lLight.color = self.translateRGB(blWorld.getAmb())
|
||||
self.nodes.append(lLight)
|
||||
|
||||
#TODO: Set background picture from world
|
||||
@ -2550,7 +2563,7 @@ class M3GTranslator:
|
||||
mLight.intensity = lamp.energy
|
||||
#SpotAngle, SpotExponent (SPOT)
|
||||
if lampType == Lamp.Types.Spot:
|
||||
mLight.spotAngle = lamp.spotSize
|
||||
mLight.spotAngle = lamp.spotSize/2
|
||||
mLight.spotExponent = lamp.spotBlend
|
||||
self.translateToNode(obj,mLight)
|
||||
|
||||
@ -2945,6 +2958,8 @@ class OptionMgr:
|
||||
self.perspectiveCorrection = rdict['perspectiveCorrection']
|
||||
self.smoothShading = rdict['smoothShading']
|
||||
self.exportAsJava = rdict['exportAsJava']
|
||||
self.exportVersion2 = rdict['exportVersion2']
|
||||
self.exportGamePhysics = rdict['exportGamePhysics']
|
||||
|
||||
except: self.save() # if data isn't valid, rewrite it
|
||||
|
||||
@ -2958,6 +2973,8 @@ class OptionMgr:
|
||||
self.perspectiveCorrection = False
|
||||
self.smoothShading = True
|
||||
self.exportAsJava = False
|
||||
self.exportVersion2 = False
|
||||
self.exportGamePhysics = False
|
||||
|
||||
def save(self):
|
||||
d = {}
|
||||
@ -2970,6 +2987,8 @@ class OptionMgr:
|
||||
d['perspectiveCorrection'] = self.perspectiveCorrection
|
||||
d['smoothShading'] = self.smoothShading
|
||||
d['exportAsJava'] = self.exportAsJava
|
||||
d['exportVersion2'] = self.exportVersion2
|
||||
d['exportGamePhysics'] = self.exportGamePhysics
|
||||
|
||||
Blender.Registry.SetKey('M3GExport', d, True)
|
||||
|
||||
@ -2993,6 +3012,8 @@ def gui():
|
||||
perspectiveCorrection = Draw.Create(mOptions.perspectiveCorrection)
|
||||
smoothShading = Draw.Create(mOptions.smoothShading)
|
||||
exportAsJava = Draw.Create(mOptions.exportAsJava)
|
||||
exportVersion2 = Draw.Create(mOptions.exportVersion2)
|
||||
exportGamePhysics = Draw.Create(mOptions.exportGamePhysics)
|
||||
|
||||
pupBlock = [\
|
||||
('Texturing'),\
|
||||
@ -3008,7 +3029,9 @@ def gui():
|
||||
('Posing'),\
|
||||
('All Armature Actions', exportAllActions, 'Exports all actions for armatures'),\
|
||||
('Export'),\
|
||||
('As Java Source', exportAsJava, 'Exports scene as Java source code')
|
||||
('As Java Source', exportAsJava, 'Exports scene as Java source code'),\
|
||||
('M3G Version 2.0', exportVersion2, 'Exports M3G Version 2.0 File'),\
|
||||
('Game Physics', exportGamePhysics, 'Includes Game Physics infos for NOPE in export')
|
||||
]
|
||||
|
||||
# Only execute if use didn't quit (ESC).
|
||||
@ -3022,6 +3045,8 @@ def gui():
|
||||
mOptions.perspectiveCorrection = perspectiveCorrection.val
|
||||
mOptions.smoothShading = smoothShading.val
|
||||
mOptions.exportAsJava = exportAsJava.val
|
||||
mOptions.exportVersion2 = exportVersion2.val
|
||||
mOptions.exportGamePhysics = exportGamePhysics.val
|
||||
mOptions.save()
|
||||
|
||||
if mOptions.exportAsJava:
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -162,8 +162,10 @@ class VRML2Export:
|
||||
##########################################################
|
||||
|
||||
def writeHeader(self):
|
||||
bfile = sys.expandpath(Blender.Get('filename'))
|
||||
#bfile = sys.expandpath( Blender.Get('filename') ).replace('<', '<').replace('>', '>')
|
||||
bfile = self.filename.replace('<', '<').replace('>', '>') # use outfile name
|
||||
self.file.write("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n")
|
||||
print "fooe"
|
||||
self.file.write("<!DOCTYPE X3D PUBLIC \"ISO//Web3D//DTD X3D 3.0//EN\" \"http://www.web3d.org/specifications/x3d-3.0.dtd\">\n")
|
||||
self.file.write("<X3D version=\"3.0\" profile=\"Immersive\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema-instance\" xsd:noNamespaceSchemaLocation=\"http://www.web3d.org/specifications/x3d-3.0.xsd\">\n")
|
||||
self.file.write("<head>\n")
|
||||
@ -256,7 +258,7 @@ class VRML2Export:
|
||||
headlight = "FALSE"
|
||||
self.file.write("<NavigationInfo headlight=\"%s\" " % headlight)
|
||||
self.file.write("visibilityLimit=\"%s\" " % (round(vislimit,self.cp)))
|
||||
self.file.write("type=\"EXAMINE, ANY\" avatarSize=\"0.25, 1.75, 0.75\" />\n\n")
|
||||
self.file.write("type=\"EXAMINE\", \"ANY\" avatarSize=\"0.25, 1.75, 0.75\" />\n\n")
|
||||
|
||||
def writeSpotLight(self, ob, lamp):
|
||||
safeName = self.cleanStr(ob.name)
|
||||
@ -404,7 +406,7 @@ class VRML2Export:
|
||||
self.writeIndented("<Appearance>\n", 1)
|
||||
# right now this script can only handle a single material per mesh.
|
||||
if len(maters) >= 1:
|
||||
mat=Blender.Material.Get(maters[0].name)
|
||||
mat=maters[0]
|
||||
matFlags = mat.getMode()
|
||||
if not matFlags & Blender.Material.Modes['TEXFACE']:
|
||||
self.writeMaterial(mat, self.cleanStr(maters[0].name,''))
|
||||
@ -452,6 +454,7 @@ class VRML2Export:
|
||||
for face in mesh.faces:
|
||||
if face.smooth:
|
||||
issmooth=1
|
||||
break
|
||||
if issmooth==1 and self.wire == 0:
|
||||
creaseAngle=(mesh.getMaxSmoothAngle())*(math.pi/180.0)
|
||||
self.file.write("creaseAngle=\"%s\" " % (round(creaseAngle,self.cp)))
|
||||
|
@ -175,6 +175,10 @@ ifeq ($(WITH_DDS), true)
|
||||
COMLIB += $(OCGDIR)/blender/imbuf/dds/$(DEBUG_DIR)libdds.a
|
||||
endif
|
||||
|
||||
ifeq ($(WITH_BINRELOC), true)
|
||||
COMLIB += $(OCGDIR)/extern/binreloc/$(DEBUG_DIR)libbinreloc.a
|
||||
endif
|
||||
|
||||
ifeq ($(WITH_FREETYPE2), true)
|
||||
COMLIB += $(OCGDIR)/blender/ftfont/$(DEBUG_DIR)libftfont.a
|
||||
ifeq ($(OS), windows)
|
||||
|
@ -60,6 +60,11 @@ extern "C" {
|
||||
*/
|
||||
void free_pose_channels(struct bPose *pose);
|
||||
|
||||
/**
|
||||
* Removes and deallocates all data from a pose, and also frees the pose.
|
||||
*/
|
||||
void free_pose(struct bPose *pose);
|
||||
|
||||
/**
|
||||
* Allocate a new pose on the heap, and copy the src pose and it's channels
|
||||
* into the new pose. *dst is set to the newly allocated structure, and assumed to be NULL.
|
||||
|
@ -44,7 +44,7 @@ struct ListBase;
|
||||
struct MemFile;
|
||||
|
||||
#define BLENDER_VERSION 245
|
||||
#define BLENDER_SUBVERSION 12
|
||||
#define BLENDER_SUBVERSION 13
|
||||
|
||||
#define BLENDER_MINVERSION 240
|
||||
#define BLENDER_MINSUBVERSION 0
|
||||
|
@ -45,7 +45,7 @@ void unlink_group(struct Group *group);
|
||||
struct Group *add_group(char *name);
|
||||
void add_to_group(struct Group *group, struct Object *ob);
|
||||
void rem_from_group(struct Group *group, struct Object *ob);
|
||||
struct Group *find_group(struct Object *ob);
|
||||
struct Group *find_group(struct Object *ob, struct Group *group);
|
||||
int object_in_group(struct Object *ob, struct Group *group);
|
||||
|
||||
void group_tag_recalc(struct Group *group);
|
||||
|
@ -47,7 +47,7 @@ struct anim;
|
||||
void free_image(struct Image *me);
|
||||
|
||||
void BKE_stamp_info(struct ImBuf *ibuf);
|
||||
void BKE_stamp_buf(unsigned char *rect, float *rectf, int width, int height);
|
||||
void BKE_stamp_buf(unsigned char *rect, float *rectf, int width, int height, int channels);
|
||||
int BKE_write_ibuf(struct ImBuf *ibuf, char *name, int imtype, int subimtype, int quality);
|
||||
void BKE_makepicstring(char *string, char *base, int frame, int imtype);
|
||||
void BKE_add_image_extension(char *string, int imtype);
|
||||
|
@ -236,21 +236,22 @@ void set_node_shader_lamp_loop(void (*lamp_loop_func)(struct ShadeInput *, str
|
||||
/* ************** COMPOSITE NODES *************** */
|
||||
|
||||
/* output socket defines */
|
||||
#define RRES_OUT_IMAGE 0
|
||||
#define RRES_OUT_ALPHA 1
|
||||
#define RRES_OUT_Z 2
|
||||
#define RRES_OUT_NORMAL 3
|
||||
#define RRES_OUT_UV 4
|
||||
#define RRES_OUT_VEC 5
|
||||
#define RRES_OUT_RGBA 6
|
||||
#define RRES_OUT_DIFF 7
|
||||
#define RRES_OUT_SPEC 8
|
||||
#define RRES_OUT_SHADOW 9
|
||||
#define RRES_OUT_AO 10
|
||||
#define RRES_OUT_REFLECT 11
|
||||
#define RRES_OUT_REFRACT 12
|
||||
#define RRES_OUT_RADIO 13
|
||||
#define RRES_OUT_INDEXOB 14
|
||||
#define RRES_OUT_IMAGE 0
|
||||
#define RRES_OUT_ALPHA 1
|
||||
#define RRES_OUT_Z 2
|
||||
#define RRES_OUT_NORMAL 3
|
||||
#define RRES_OUT_UV 4
|
||||
#define RRES_OUT_VEC 5
|
||||
#define RRES_OUT_RGBA 6
|
||||
#define RRES_OUT_DIFF 7
|
||||
#define RRES_OUT_SPEC 8
|
||||
#define RRES_OUT_SHADOW 9
|
||||
#define RRES_OUT_AO 10
|
||||
#define RRES_OUT_REFLECT 11
|
||||
#define RRES_OUT_REFRACT 12
|
||||
#define RRES_OUT_RADIO 13
|
||||
#define RRES_OUT_INDEXOB 14
|
||||
#define RRES_OUT_MIST 15
|
||||
|
||||
/* note: types are needed to restore callbacks, don't change values */
|
||||
#define CMP_NODE_VIEWER 201
|
||||
|
@ -110,9 +110,10 @@ void solve_tracking (struct Object *ob, float targetmat[][4]);
|
||||
|
||||
void object_handle_update(struct Object *ob);
|
||||
|
||||
float give_timeoffset(struct Object *ob);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -289,6 +289,8 @@ void psys_particle_on_dm(struct Object *ob, struct DerivedMesh *dm, int from, in
|
||||
void initialize_particle(struct ParticleData *pa, int p, struct Object *ob, struct ParticleSystem *psys, struct ParticleSystemModifierData *psmd);
|
||||
void reset_particle(struct ParticleData *pa, struct ParticleSystem *psys, struct ParticleSystemModifierData *psmd, struct Object *ob, float dtime, float cfra, float *vg_vel, float *vg_tan, float *vg_rot);
|
||||
|
||||
void do_effectors(int pa_no, struct ParticleData *pa, struct ParticleKey *state, struct Object *ob, struct ParticleSystem *psys, float *force_field, float *vel,float framestep, float cfra);
|
||||
|
||||
void psys_calc_dmfaces(struct Object *ob, struct DerivedMesh *dm, struct ParticleSystem *psys);
|
||||
int psys_particle_dm_face_lookup(struct Object *ob, struct DerivedMesh *dm, int index, float *fw, struct LinkNode *node);
|
||||
|
||||
|
@ -31,30 +31,11 @@
|
||||
#define BKE_SCULPT_H
|
||||
|
||||
struct NumInput;
|
||||
struct RadialControl;
|
||||
struct Scene;
|
||||
struct SculptData;
|
||||
struct SculptSession;
|
||||
|
||||
typedef enum PropsetMode {
|
||||
PropsetNone = 0,
|
||||
PropsetSize,
|
||||
PropsetStrength,
|
||||
PropsetTexRot
|
||||
} PropsetMode;
|
||||
|
||||
typedef struct PropsetData {
|
||||
PropsetMode mode;
|
||||
unsigned int tex;
|
||||
short origloc[2];
|
||||
float *texdata;
|
||||
|
||||
short origsize;
|
||||
char origstrength;
|
||||
float origtexrot;
|
||||
|
||||
struct NumInput *num;
|
||||
} PropsetData;
|
||||
|
||||
typedef struct SculptSession {
|
||||
struct ProjVert *projverts;
|
||||
|
||||
@ -76,7 +57,7 @@ typedef struct SculptSession {
|
||||
/* Used to cache the render of the active texture */
|
||||
unsigned int texcache_w, texcache_h, *texcache;
|
||||
|
||||
struct PropsetData *propset;
|
||||
struct RadialControl *radialcontrol;
|
||||
|
||||
/* For rotating around a pivot point */
|
||||
vec3f pivot;
|
||||
|
@ -178,7 +178,11 @@ void free_action (bAction *act)
|
||||
if (act->chanbase.first)
|
||||
BLI_freelistN(&act->chanbase);
|
||||
|
||||
/* Free pose-references */
|
||||
/* Free groups */
|
||||
if (act->groups.first)
|
||||
BLI_freelistN(&act->groups);
|
||||
|
||||
/* Free pose-references (aka local markers) */
|
||||
if (act->markers.first)
|
||||
BLI_freelistN(&act->markers);
|
||||
}
|
||||
@ -187,19 +191,37 @@ bAction *copy_action (bAction *src)
|
||||
{
|
||||
bAction *dst = NULL;
|
||||
bActionChannel *dchan, *schan;
|
||||
bActionGroup *dgrp, *sgrp;
|
||||
|
||||
if (!src) return NULL;
|
||||
|
||||
dst= copy_libblock(src);
|
||||
|
||||
duplicatelist(&(dst->chanbase), &(src->chanbase));
|
||||
duplicatelist(&(dst->groups), &(src->groups));
|
||||
duplicatelist(&(dst->markers), &(src->markers));
|
||||
|
||||
for (dchan=dst->chanbase.first, schan=src->chanbase.first; dchan; dchan=dchan->next, schan=schan->next){
|
||||
for (dchan=dst->chanbase.first, schan=src->chanbase.first; dchan; dchan=dchan->next, schan=schan->next) {
|
||||
for (dgrp=dst->groups.first, sgrp=src->groups.first; dgrp && sgrp; dgrp=dgrp->next, sgrp=sgrp->next) {
|
||||
if (dchan->grp == sgrp) {
|
||||
dchan->grp= dgrp;
|
||||
|
||||
if (dgrp->channels.first == schan)
|
||||
dgrp->channels.first= dchan;
|
||||
if (dgrp->channels.last == schan)
|
||||
dgrp->channels.last= dchan;
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
dchan->ipo = copy_ipo(dchan->ipo);
|
||||
copy_constraint_channels(&dchan->constraintChannels, &schan->constraintChannels);
|
||||
}
|
||||
|
||||
dst->id.flag |= LIB_FAKEUSER;
|
||||
dst->id.us++;
|
||||
|
||||
return dst;
|
||||
}
|
||||
|
||||
@ -290,7 +312,7 @@ void free_pose_channels(bPose *pose)
|
||||
{
|
||||
bPoseChannel *pchan;
|
||||
|
||||
if (pose->chanbase.first){
|
||||
if (pose->chanbase.first) {
|
||||
for (pchan = pose->chanbase.first; pchan; pchan=pchan->next){
|
||||
if(pchan->path)
|
||||
MEM_freeN(pchan->path);
|
||||
@ -300,6 +322,21 @@ void free_pose_channels(bPose *pose)
|
||||
}
|
||||
}
|
||||
|
||||
void free_pose(bPose *pose)
|
||||
{
|
||||
if (pose) {
|
||||
/* free pose-channels */
|
||||
free_pose_channels(pose);
|
||||
|
||||
/* free pose-groups */
|
||||
if (pose->agroups.first)
|
||||
BLI_freelistN(&pose->agroups);
|
||||
|
||||
/* free pose */
|
||||
MEM_freeN(pose);
|
||||
}
|
||||
}
|
||||
|
||||
static void copy_pose_channel_data(bPoseChannel *pchan, const bPoseChannel *chan)
|
||||
{
|
||||
bConstraint *pcon, *con;
|
||||
@ -393,7 +430,7 @@ bActionChannel *get_action_channel(bAction *act, const char *name)
|
||||
if (!act || !name)
|
||||
return NULL;
|
||||
|
||||
for (chan = act->chanbase.first; chan; chan=chan->next){
|
||||
for (chan = act->chanbase.first; chan; chan=chan->next) {
|
||||
if (!strcmp (chan->name, name))
|
||||
return chan;
|
||||
}
|
||||
@ -401,18 +438,16 @@ bActionChannel *get_action_channel(bAction *act, const char *name)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* returns existing channel, or adds new one. In latter case it doesnt activate it, context is required for that*/
|
||||
/* returns existing channel, or adds new one. In latter case it doesnt activate it, context is required for that */
|
||||
bActionChannel *verify_action_channel(bAction *act, const char *name)
|
||||
{
|
||||
bActionChannel *chan;
|
||||
|
||||
chan= get_action_channel(act, name);
|
||||
if(chan==NULL) {
|
||||
if (!chan) {
|
||||
chan = MEM_callocN (sizeof(bActionChannel), "actionChannel");
|
||||
strncpy (chan->name, name, 31);
|
||||
BLI_addtail (&act->chanbase, chan);
|
||||
}
|
||||
if (chan == NULL) {
|
||||
chan = MEM_callocN (sizeof(bActionChannel), "actionChannel");
|
||||
strncpy(chan->name, name, 31);
|
||||
BLI_addtail(&act->chanbase, chan);
|
||||
}
|
||||
return chan;
|
||||
}
|
||||
@ -1318,10 +1353,8 @@ static void do_nla(Object *ob, int blocktype)
|
||||
}
|
||||
|
||||
/* free */
|
||||
if (tpose){
|
||||
free_pose_channels(tpose);
|
||||
MEM_freeN(tpose);
|
||||
}
|
||||
if (tpose)
|
||||
free_pose(tpose);
|
||||
if(chanbase.first)
|
||||
BLI_freelistN(&chanbase);
|
||||
}
|
||||
|
@ -65,6 +65,7 @@
|
||||
#include "BKE_key.h"
|
||||
#include "BKE_lattice.h"
|
||||
#include "BKE_main.h"
|
||||
#include "BKE_mesh.h"
|
||||
#include "BKE_object.h"
|
||||
#include "BKE_particle.h"
|
||||
#include "BKE_utildefines.h"
|
||||
@ -423,6 +424,7 @@ static void vertex_dupli__mapFunc(void *userData, int index, float *co, float *n
|
||||
static void vertex_duplilist(ListBase *lb, ID *id, Object *par, float par_space_mat[][4], int level)
|
||||
{
|
||||
Object *ob, *ob_iter;
|
||||
Mesh *me;
|
||||
Base *base = NULL;
|
||||
float vec[3], no[3], pmat[4][4];
|
||||
int lay, totvert, a, oblay;
|
||||
@ -431,23 +433,22 @@ static void vertex_duplilist(ListBase *lb, ID *id, Object *par, float par_space_
|
||||
Scene *sce = NULL;
|
||||
Group *group = NULL;
|
||||
GroupObject * go = NULL;
|
||||
CustomDataMask dataMask = CD_MASK_BAREMESH;
|
||||
|
||||
Mat4CpyMat4(pmat, par->obmat);
|
||||
|
||||
/* simple preventing of too deep nested groups */
|
||||
if(level>MAX_DUPLI_RECUR) return;
|
||||
|
||||
if(G.rendering)
|
||||
dataMask |= CD_MASK_ORCO;
|
||||
|
||||
if(par==G.obedit)
|
||||
dm= editmesh_get_derived_cage(dataMask);
|
||||
dm= editmesh_get_derived_cage(CD_MASK_BAREMESH);
|
||||
else
|
||||
dm= mesh_get_derived_deform(par, dataMask);
|
||||
dm= mesh_get_derived_deform(par, CD_MASK_BAREMESH);
|
||||
|
||||
if(G.rendering)
|
||||
vdd.orco= dm->getVertDataArray(dm, CD_ORCO);
|
||||
if(G.rendering) {
|
||||
me= par->data;
|
||||
vdd.orco= (float(*)[3])get_mesh_orco_verts(par);
|
||||
transform_mesh_orco_verts(me, vdd.orco, me->totvert, 0);
|
||||
}
|
||||
else
|
||||
vdd.orco= NULL;
|
||||
|
||||
@ -521,6 +522,8 @@ static void vertex_duplilist(ListBase *lb, ID *id, Object *par, float par_space_
|
||||
else go= go->next; /* group loop */
|
||||
}
|
||||
|
||||
if(vdd.orco)
|
||||
MEM_freeN(vdd.orco);
|
||||
dm->release(dm);
|
||||
}
|
||||
|
||||
@ -534,25 +537,21 @@ static void face_duplilist(ListBase *lb, ID *id, Object *par, float par_space_ma
|
||||
MTFace *mtface;
|
||||
MFace *mface;
|
||||
MVert *mvert;
|
||||
float pmat[4][4], imat[3][3], (*orco)[3], w;
|
||||
float pmat[4][4], imat[3][3], (*orco)[3] = NULL, w;
|
||||
int lay, oblay, totface, a;
|
||||
Scene *sce = NULL;
|
||||
Group *group = NULL;
|
||||
GroupObject *go = NULL;
|
||||
CustomDataMask dataMask = CD_MASK_BAREMESH;
|
||||
float ob__obmat[4][4]; /* needed for groups where the object matrix needs to be modified */
|
||||
|
||||
/* simple preventing of too deep nested groups */
|
||||
if(level>MAX_DUPLI_RECUR) return;
|
||||
|
||||
if(G.rendering)
|
||||
dataMask |= CD_MASK_ORCO;
|
||||
|
||||
Mat4CpyMat4(pmat, par->obmat);
|
||||
|
||||
if(par==G.obedit) {
|
||||
int totvert;
|
||||
dm= editmesh_get_derived_cage(dataMask);
|
||||
dm= editmesh_get_derived_cage(CD_MASK_BAREMESH);
|
||||
|
||||
totface= dm->getNumFaces(dm);
|
||||
mface= MEM_mallocN(sizeof(MFace)*totface, "mface temp");
|
||||
@ -562,7 +561,7 @@ static void face_duplilist(ListBase *lb, ID *id, Object *par, float par_space_ma
|
||||
dm->copyVertArray(dm, mvert);
|
||||
}
|
||||
else {
|
||||
dm = mesh_get_derived_deform(par, dataMask);
|
||||
dm = mesh_get_derived_deform(par, CD_MASK_BAREMESH);
|
||||
|
||||
totface= dm->getNumFaces(dm);
|
||||
mface= dm->getFaceArray(dm);
|
||||
@ -571,7 +570,9 @@ static void face_duplilist(ListBase *lb, ID *id, Object *par, float par_space_ma
|
||||
|
||||
if(G.rendering) {
|
||||
me= (Mesh*)par->data;
|
||||
orco= dm->getVertDataArray(dm, CD_ORCO);
|
||||
|
||||
orco= (float(*)[3])get_mesh_orco_verts(par);
|
||||
transform_mesh_orco_verts(me, orco, me->totvert, 0);
|
||||
mtface= me->mtface;
|
||||
}
|
||||
else {
|
||||
@ -712,6 +713,9 @@ static void face_duplilist(ListBase *lb, ID *id, Object *par, float par_space_ma
|
||||
MEM_freeN(mvert);
|
||||
}
|
||||
|
||||
if(orco)
|
||||
MEM_freeN(orco);
|
||||
|
||||
dm->release(dm);
|
||||
}
|
||||
|
||||
|
@ -308,7 +308,6 @@ static void clean_paths(Main *main)
|
||||
}
|
||||
BLI_clean(scene->r.backbuf);
|
||||
BLI_clean(scene->r.pic);
|
||||
BLI_clean(scene->r.ftype);
|
||||
|
||||
scene= scene->id.next;
|
||||
}
|
||||
|
@ -31,6 +31,7 @@
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stddef.h>
|
||||
#include <string.h>
|
||||
#include <math.h>
|
||||
|
||||
@ -226,55 +227,7 @@ void do_constraint_channels (ListBase *conbase, ListBase *chanbase, float ctime,
|
||||
/* Find the first available, non-duplicate name for a given constraint */
|
||||
void unique_constraint_name (bConstraint *con, ListBase *list)
|
||||
{
|
||||
bConstraint *curcon;
|
||||
char tempname[64];
|
||||
int number = 1, exists = 0;
|
||||
char *dot;
|
||||
|
||||
/* See if we are given an empty string */
|
||||
if (con->name[0] == '\0') {
|
||||
/* give it default name first */
|
||||
strcpy(con->name, "Const");
|
||||
}
|
||||
|
||||
/* See if we even need to do this */
|
||||
if (list == NULL)
|
||||
return;
|
||||
|
||||
for (curcon = list->first; curcon; curcon=curcon->next) {
|
||||
if (curcon != con) {
|
||||
if (!strcmp(curcon->name, con->name)) {
|
||||
exists = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (exists == 0)
|
||||
return;
|
||||
|
||||
/* Strip off the suffix */
|
||||
dot = strchr(con->name, '.');
|
||||
if (dot)
|
||||
*dot=0;
|
||||
|
||||
for (number = 1; number <= 999; number++) {
|
||||
sprintf(tempname, "%s.%03d", con->name, number);
|
||||
|
||||
exists = 0;
|
||||
for (curcon=list->first; curcon; curcon=curcon->next) {
|
||||
if (con != curcon) {
|
||||
if (strcmp(curcon->name, tempname)==0) {
|
||||
exists = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (exists == 0) {
|
||||
strcpy(con->name, tempname);
|
||||
return;
|
||||
}
|
||||
}
|
||||
BLI_uniquename(list, con, "Const", offsetof(bConstraint, name), 32);
|
||||
}
|
||||
|
||||
/* ----------------- Evaluation Loop Preparation --------------- */
|
||||
@ -2036,8 +1989,7 @@ static void actcon_get_tarmat (bConstraint *con, bConstraintOb *cob, bConstraint
|
||||
Mat4CpyMat4(ct->matrix, tchan->chan_mat);
|
||||
|
||||
/* Clean up */
|
||||
free_pose_channels(pose);
|
||||
MEM_freeN(pose);
|
||||
free_pose(pose);
|
||||
}
|
||||
else if (cob->type == CONSTRAINT_OBTYPE_OBJECT) {
|
||||
/* evaluate using workob */
|
||||
|
@ -2064,8 +2064,8 @@ void DAG_object_update_flags(Scene *sce, Object *ob, unsigned int lay)
|
||||
|
||||
/* object not in scene? then handle group exception. needs to be dagged once too */
|
||||
if(node==NULL) {
|
||||
Group *group= find_group(ob);
|
||||
if(group) {
|
||||
Group *group= NULL;
|
||||
while( (group = find_group(ob, group)) ) {
|
||||
GroupObject *go;
|
||||
/* primitive; tag all... this call helps building groups for particles */
|
||||
for(go= group->gobject.first; go; go= go->next)
|
||||
|
@ -1552,14 +1552,14 @@ static pMatrixCache *cache_object_matrices(Object *ob, int start, int end)
|
||||
|
||||
/* object can be linked in group... stupid exception */
|
||||
if(NULL==object_in_scene(ob, G.scene))
|
||||
group= find_group(ob);
|
||||
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;
|
||||
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) */
|
||||
|
@ -164,9 +164,12 @@ int object_in_group(Object *ob, Group *group)
|
||||
return 0;
|
||||
}
|
||||
|
||||
Group *find_group(Object *ob)
|
||||
Group *find_group(Object *ob, Group *group)
|
||||
{
|
||||
Group *group= G.main->group.first;
|
||||
if (group)
|
||||
group= group->id.next;
|
||||
else
|
||||
group= G.main->group.first;
|
||||
|
||||
while(group) {
|
||||
if(object_in_group(ob, group))
|
||||
@ -238,12 +241,12 @@ void group_handle_recalc_and_update(Object *parent, Group *group)
|
||||
GroupObject *go;
|
||||
|
||||
/* if animated group... */
|
||||
if(parent->sf != 0.0f || parent->nlastrips.first) {
|
||||
if(give_timeoffset(parent) != 0.0f || parent->nlastrips.first) {
|
||||
int cfrao;
|
||||
|
||||
/* switch to local time */
|
||||
cfrao= G.scene->r.cfra;
|
||||
G.scene->r.cfra -= (int)parent->sf;
|
||||
G.scene->r.cfra -= (int)give_timeoffset(parent);
|
||||
|
||||
/* we need a DAG per group... */
|
||||
for(go= group->gobject.first; go; go= go->next) {
|
||||
|
@ -969,7 +969,7 @@ static void stampdata(StampData *stamp_data, int do_prefix)
|
||||
}
|
||||
}
|
||||
|
||||
void BKE_stamp_buf(unsigned char *rect, float *rectf, int width, int height)
|
||||
void BKE_stamp_buf(unsigned char *rect, float *rectf, int width, int height, int channels)
|
||||
{
|
||||
struct StampData stamp_data;
|
||||
|
||||
@ -1017,7 +1017,7 @@ void BKE_stamp_buf(unsigned char *rect, float *rectf, int width, int height)
|
||||
/* Top left corner */
|
||||
text_width = BMF_GetStringWidth(font, stamp_data.file);
|
||||
buf_rectfill_area(rect, rectf, width, height, G.scene->r.bg_stamp, x-1, y-1, x+text_width+text_pad+1, y+font_height+1);
|
||||
BMF_DrawStringBuf(font, stamp_data.file, x+(text_pad/2), y, G.scene->r.fg_stamp, rect, rectf, width, height);
|
||||
BMF_DrawStringBuf(font, stamp_data.file, x+(text_pad/2), y, G.scene->r.fg_stamp, rect, rectf, width, height, channels);
|
||||
y -= font_height+2; /* Top and bottom 1 pix padding each */
|
||||
}
|
||||
|
||||
@ -1025,7 +1025,7 @@ void BKE_stamp_buf(unsigned char *rect, float *rectf, int width, int height)
|
||||
if (stamp_data.note[0]) {
|
||||
text_width = BMF_GetStringWidth(font, stamp_data.note);
|
||||
buf_rectfill_area(rect, rectf, width, height, G.scene->r.bg_stamp, x-1, y-1, x+text_width+text_pad+1, y+font_height+1);
|
||||
BMF_DrawStringBuf(font, stamp_data.note, x+(text_pad/2), y, G.scene->r.fg_stamp, rect, rectf, width, height);
|
||||
BMF_DrawStringBuf(font, stamp_data.note, x+(text_pad/2), y, G.scene->r.fg_stamp, rect, rectf, width, height, channels);
|
||||
y -= font_height+2; /* Top and bottom 1 pix padding each */
|
||||
}
|
||||
|
||||
@ -1033,7 +1033,7 @@ void BKE_stamp_buf(unsigned char *rect, float *rectf, int width, int height)
|
||||
if (stamp_data.date[0]) {
|
||||
text_width = BMF_GetStringWidth(font, stamp_data.date);
|
||||
buf_rectfill_area(rect, rectf, width, height, G.scene->r.bg_stamp, x-1, y-1, x+text_width+text_pad+1, y+font_height+1);
|
||||
BMF_DrawStringBuf(font, stamp_data.date, x+(text_pad/2), y, G.scene->r.fg_stamp, rect, rectf, width, height);
|
||||
BMF_DrawStringBuf(font, stamp_data.date, x+(text_pad/2), y, G.scene->r.fg_stamp, rect, rectf, width, height, channels);
|
||||
}
|
||||
|
||||
/* Bottom left corner, leaving space for timing */
|
||||
@ -1042,7 +1042,7 @@ void BKE_stamp_buf(unsigned char *rect, float *rectf, int width, int height)
|
||||
y = font_height+2+1; /* 2 for padding in TIME|FRAME fields below and 1 for padding in this one */
|
||||
text_width = BMF_GetStringWidth(font, stamp_data.marker);
|
||||
buf_rectfill_area(rect, rectf, width, height, G.scene->r.bg_stamp, x-1, y-1, x+text_width+text_pad+1, y+font_height+1);
|
||||
BMF_DrawStringBuf(font, stamp_data.marker, x+(text_pad/2), y, G.scene->r.fg_stamp, rect, rectf, width, height);
|
||||
BMF_DrawStringBuf(font, stamp_data.marker, x+(text_pad/2), y, G.scene->r.fg_stamp, rect, rectf, width, height, channels);
|
||||
}
|
||||
|
||||
/* Left bottom corner */
|
||||
@ -1051,7 +1051,7 @@ void BKE_stamp_buf(unsigned char *rect, float *rectf, int width, int height)
|
||||
y = 1;
|
||||
text_width = BMF_GetStringWidth(font, stamp_data.time);
|
||||
buf_rectfill_area(rect, rectf, width, height, G.scene->r.bg_stamp, x-1, y-1, x+text_width+text_pad+1, y+font_height+1);
|
||||
BMF_DrawStringBuf(font, stamp_data.time, x+(text_pad/2), y, G.scene->r.fg_stamp, rect, rectf, width, height);
|
||||
BMF_DrawStringBuf(font, stamp_data.time, x+(text_pad/2), y, G.scene->r.fg_stamp, rect, rectf, width, height, channels);
|
||||
x += text_width+text_pad+2; /* Both sides have 1 pix additional padding each */
|
||||
}
|
||||
|
||||
@ -1061,7 +1061,7 @@ void BKE_stamp_buf(unsigned char *rect, float *rectf, int width, int height)
|
||||
if (!stamp_data.time[0]) x = 1;
|
||||
y = 1;
|
||||
buf_rectfill_area(rect, rectf, width, height, G.scene->r.bg_stamp, x-1, y-1, x+text_width+text_pad+1, y+font_height+1);
|
||||
BMF_DrawStringBuf(font, stamp_data.frame, x+(text_pad/2), y, G.scene->r.fg_stamp, rect, rectf, width, height);
|
||||
BMF_DrawStringBuf(font, stamp_data.frame, x+(text_pad/2), y, G.scene->r.fg_stamp, rect, rectf, width, height, channels);
|
||||
}
|
||||
|
||||
if (stamp_data.camera[0]) {
|
||||
@ -1070,7 +1070,7 @@ void BKE_stamp_buf(unsigned char *rect, float *rectf, int width, int height)
|
||||
x = (width/2) - (BMF_GetStringWidth(font, stamp_data.camera)/2);
|
||||
y = 1;
|
||||
buf_rectfill_area(rect, rectf, width, height, G.scene->r.bg_stamp, x-1, y-1, x+text_width+text_pad+1, y+font_height+1);
|
||||
BMF_DrawStringBuf(font, stamp_data.camera, x+(text_pad/2), y, G.scene->r.fg_stamp, rect, rectf, width, height);
|
||||
BMF_DrawStringBuf(font, stamp_data.camera, x+(text_pad/2), y, G.scene->r.fg_stamp, rect, rectf, width, height, channels);
|
||||
}
|
||||
|
||||
if (stamp_data.scene[0]) {
|
||||
@ -1079,7 +1079,7 @@ void BKE_stamp_buf(unsigned char *rect, float *rectf, int width, int height)
|
||||
x = width - (text_width+1+text_pad);
|
||||
y = 1;
|
||||
buf_rectfill_area(rect, rectf, width, height, G.scene->r.bg_stamp, x-1, y-1, x+text_width+text_pad+1, y+font_height+1);
|
||||
BMF_DrawStringBuf(font, stamp_data.scene, x+(text_pad/2), y, G.scene->r.fg_stamp, rect, rectf, width, height);
|
||||
BMF_DrawStringBuf(font, stamp_data.scene, x+(text_pad/2), y, G.scene->r.fg_stamp, rect, rectf, width, height, channels);
|
||||
}
|
||||
|
||||
if (stamp_data.strip[0]) {
|
||||
@ -1088,7 +1088,7 @@ void BKE_stamp_buf(unsigned char *rect, float *rectf, int width, int height)
|
||||
x = width - (text_width+1+text_pad);
|
||||
y = height - font_height - 1;
|
||||
buf_rectfill_area(rect, rectf, width, height, G.scene->r.bg_stamp, x-1, y-1, x+text_width+text_pad+1, y+font_height+1);
|
||||
BMF_DrawStringBuf(font, stamp_data.strip, x+(text_pad/2), y, G.scene->r.fg_stamp, rect, rectf, width, height);
|
||||
BMF_DrawStringBuf(font, stamp_data.strip, x+(text_pad/2), y, G.scene->r.fg_stamp, rect, rectf, width, height, channels);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -2727,9 +2727,9 @@ static void displaceModifier_foreachIDLink(ModifierData *md, Object *ob,
|
||||
{
|
||||
DisplaceModifierData *dmd = (DisplaceModifierData*) md;
|
||||
|
||||
walk(userData, ob, &dmd->texture);
|
||||
walk(userData, ob, (ID **)&dmd->texture);
|
||||
|
||||
displaceModifier_foreachObjectLink(md, ob, (ObjectWalkFunc) walk, userData);
|
||||
displaceModifier_foreachObjectLink(md, ob, (ObjectWalkFunc)walk, userData);
|
||||
}
|
||||
|
||||
static int displaceModifier_isDisabled(ModifierData *md)
|
||||
|
@ -2211,6 +2211,8 @@ static void force_hidden_passes(bNode *node, int passflag)
|
||||
if(!(passflag & SCE_PASS_RADIO)) sock->flag |= SOCK_UNAVAIL;
|
||||
sock= BLI_findlink(&node->outputs, RRES_OUT_INDEXOB);
|
||||
if(!(passflag & SCE_PASS_INDEXOB)) sock->flag |= SOCK_UNAVAIL;
|
||||
sock= BLI_findlink(&node->outputs, RRES_OUT_MIST);
|
||||
if(!(passflag & SCE_PASS_MIST)) sock->flag |= SOCK_UNAVAIL;
|
||||
|
||||
}
|
||||
|
||||
|
@ -229,10 +229,8 @@ void free_object(Object *ob)
|
||||
if(ob->dup_group) ob->dup_group->id.us--;
|
||||
if(ob->defbase.first)
|
||||
BLI_freelistN(&ob->defbase);
|
||||
if(ob->pose) {
|
||||
free_pose_channels(ob->pose);
|
||||
MEM_freeN(ob->pose);
|
||||
}
|
||||
if(ob->pose)
|
||||
free_pose(ob->pose);
|
||||
free_effects(&ob->effect);
|
||||
free_properties(&ob->prop);
|
||||
object_free_modifiers(ob);
|
||||
@ -1367,7 +1365,7 @@ float bsystem_time(Object *ob, float cfra, float ofs)
|
||||
|
||||
/* ofset frames */
|
||||
if ((ob->ipoflag & OB_OFFS_PARENT) && (ob->partype & PARSLOW)==0)
|
||||
cfra-= ob->sf;
|
||||
cfra-= give_timeoffset(ob);
|
||||
}
|
||||
|
||||
cfra-= ofs;
|
||||
@ -1438,7 +1436,7 @@ static void ob_parcurve(Object *ob, Object *par, float mat[][4])
|
||||
{
|
||||
Curve *cu;
|
||||
float q[4], vec[4], dir[3], *quat, x1, ctime;
|
||||
float timeoffs= 0.0;
|
||||
float timeoffs = 0.0, sf_orig = 0.0;
|
||||
|
||||
Mat4One(mat);
|
||||
|
||||
@ -1449,7 +1447,8 @@ static void ob_parcurve(Object *ob, Object *par, float mat[][4])
|
||||
|
||||
/* exception, timeoffset is regarded as distance offset */
|
||||
if(cu->flag & CU_OFFS_PATHDIST) {
|
||||
SWAP(float, timeoffs, ob->sf);
|
||||
timeoffs = give_timeoffset(ob);
|
||||
SWAP(float, sf_orig, ob->sf);
|
||||
}
|
||||
|
||||
/* catch exceptions: feature for nla stride editing */
|
||||
@ -1466,7 +1465,7 @@ static void ob_parcurve(Object *ob, Object *par, float mat[][4])
|
||||
}
|
||||
}
|
||||
else {
|
||||
ctime= G.scene->r.cfra - ob->sf;
|
||||
ctime= G.scene->r.cfra - give_timeoffset(ob);
|
||||
ctime /= cu->pathlen;
|
||||
|
||||
CLAMP(ctime, 0.0, 1.0);
|
||||
@ -1477,7 +1476,7 @@ static void ob_parcurve(Object *ob, Object *par, float mat[][4])
|
||||
ctime += timeoffs/cu->path->totdist;
|
||||
|
||||
/* restore */
|
||||
SWAP(float, timeoffs, ob->sf);
|
||||
SWAP(float, sf_orig, ob->sf);
|
||||
}
|
||||
|
||||
|
||||
@ -1735,7 +1734,7 @@ void where_is_object_time(Object *ob, float ctime)
|
||||
if(ob->parent) {
|
||||
Object *par= ob->parent;
|
||||
|
||||
if(ob->ipoflag & OB_OFFS_PARENT) ctime-= ob->sf;
|
||||
if(ob->ipoflag & OB_OFFS_PARENT) ctime-= give_timeoffset(ob);
|
||||
|
||||
/* hurms, code below conflicts with depgraph... (ton) */
|
||||
/* and even worse, it gives bad effects for NLA stride too (try ctime != par->ctime, with MBlur) */
|
||||
@ -1759,7 +1758,7 @@ void where_is_object_time(Object *ob, float ctime)
|
||||
if(ob->partype & PARSLOW) {
|
||||
// include framerate
|
||||
|
||||
fac1= (1.0f/(1.0f+ fabs(ob->sf)));
|
||||
fac1= (1.0f/(1.0f+ fabs(give_timeoffset(ob))));
|
||||
if(fac1>=1.0) return;
|
||||
fac2= 1.0f-fac1;
|
||||
|
||||
@ -1942,7 +1941,7 @@ for a lamp that is the child of another object */
|
||||
|
||||
if(ob->partype & PARSLOW) {
|
||||
|
||||
fac1= (float)(1.0/(1.0+ fabs(ob->sf)));
|
||||
fac1= (float)(1.0/(1.0+ fabs(give_timeoffset(ob))));
|
||||
fac2= 1.0f-fac1;
|
||||
fp1= ob->obmat[0];
|
||||
fp2= slowmat[0];
|
||||
@ -2199,6 +2198,7 @@ void object_handle_update(Object *ob)
|
||||
|
||||
if(ob->particlesystem.first) {
|
||||
ParticleSystem *tpsys, *psys;
|
||||
DerivedMesh *dm;
|
||||
|
||||
psys= ob->particlesystem.first;
|
||||
while(psys) {
|
||||
@ -2215,6 +2215,17 @@ void object_handle_update(Object *ob)
|
||||
else
|
||||
psys= psys->next;
|
||||
}
|
||||
|
||||
if(G.rendering && ob->transflag & OB_DUPLIPARTS) {
|
||||
/* this is to make sure we get render level duplis in groups:
|
||||
* the derivedmesh must be created before init_render_mesh,
|
||||
* since object_duplilist does dupliparticles before that */
|
||||
dm = mesh_create_derived_render(ob, CD_MASK_BAREMESH|CD_MASK_MTFACE|CD_MASK_MCOL);
|
||||
dm->release(dm);
|
||||
|
||||
for(psys=ob->particlesystem.first; psys; psys=psys->next)
|
||||
psys_get_modifier(ob, psys)->flag &= ~eParticleSystemFlag_psys_updated;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -2235,3 +2246,11 @@ void object_handle_update(Object *ob)
|
||||
// printf("set proxy pointer for later group stuff %s\n", ob->id.name);
|
||||
}
|
||||
}
|
||||
|
||||
float give_timeoffset(Object *ob) {
|
||||
if ((ob->ipoflag & OB_OFFS_PARENTADD) && ob->parent) {
|
||||
return ob->sf + give_timeoffset(ob->parent);
|
||||
} else {
|
||||
return ob->sf;
|
||||
}
|
||||
}
|
||||
|
@ -2240,7 +2240,7 @@ void psys_cache_paths(Object *ob, ParticleSystem *psys, float cfra, int editupda
|
||||
Material *ma;
|
||||
|
||||
float birthtime = 0.0, dietime = 0.0;
|
||||
float t, time, keytime, dfra = 1.0, frs_sec = G.scene->r.frs_sec;
|
||||
float t, time = 0.0, keytime = 0.0, dfra = 1.0, frs_sec = G.scene->r.frs_sec;
|
||||
float col[3] = {0.5f, 0.5f, 0.5f};
|
||||
float prev_tangent[3], hairmat[4][4];
|
||||
int k,i;
|
||||
@ -2249,6 +2249,7 @@ void psys_cache_paths(Object *ob, ParticleSystem *psys, float cfra, int editupda
|
||||
char nosel[4], sel[4];
|
||||
float sel_col[3];
|
||||
float nosel_col[3];
|
||||
float length, vec[3];
|
||||
|
||||
/* we don't have anything valid to create paths from so let's quit here */
|
||||
if((psys->flag & PSYS_HAIR_DONE)==0 && (psys->flag & PSYS_KEYED)==0)
|
||||
@ -2417,7 +2418,6 @@ void psys_cache_paths(Object *ob, ParticleSystem *psys, float cfra, int editupda
|
||||
: ((psys->part->flag & PART_HAIR_BSPLINE) ? KEY_BSPLINE : KEY_CARDINAL)
|
||||
,keys, keytime, &result);
|
||||
|
||||
|
||||
/* the velocity needs to be converted back from cubic interpolation */
|
||||
if(psys->flag & PSYS_KEYED){
|
||||
VecMulf(result.vel, frs_sec / dfra);
|
||||
@ -2426,11 +2426,48 @@ void psys_cache_paths(Object *ob, ParticleSystem *psys, float cfra, int editupda
|
||||
Mat4MulVecfl(hairmat, result.co);
|
||||
}
|
||||
|
||||
VECCOPY(ca->co, result.co);
|
||||
}
|
||||
|
||||
/*--modify paths--*/
|
||||
|
||||
VecSubf(vec,(cache[i]+1)->co,cache[i]->co);
|
||||
length = VecLength(vec);
|
||||
|
||||
for(k=0, ca=cache[i]; k<=steps; k++, ca++) {
|
||||
/* apply effectors */
|
||||
if(edit==0 && k) {
|
||||
float force[3] = {0.0f,0.0f,0.0f}, vel[3] = {0.0f,0.0f,0.0f};
|
||||
ParticleKey eff_key;
|
||||
|
||||
VECCOPY(eff_key.co,(ca-1)->co);
|
||||
VECCOPY(eff_key.vel,(ca-1)->vel);
|
||||
QUATCOPY(eff_key.rot,(ca-1)->rot);
|
||||
|
||||
do_effectors(i, pa, &eff_key, ob, psys, force, vel, dfra, cfra);
|
||||
|
||||
VecMulf(force, pow((float)k / (float)steps, 100.0f * psys->part->eff_hair) / (float)steps);
|
||||
|
||||
VecAddf(force, force, vec);
|
||||
|
||||
Normalize(force);
|
||||
|
||||
if(k < steps) {
|
||||
VecSubf(vec, (ca+1)->co, ca->co);
|
||||
length = VecLength(vec);
|
||||
}
|
||||
|
||||
VECADDFAC(ca->co, (ca-1)->co, force, length);
|
||||
}
|
||||
|
||||
/* apply guide curves to path data */
|
||||
if(edit==0 && psys->effectors.first && (psys->part->flag & PART_CHILD_GUIDE)==0)
|
||||
do_guide(&result, i, time, &psys->effectors);
|
||||
|
||||
/* apply lattice */
|
||||
if(psys->lattice && edit==0)
|
||||
calc_latt_deform(ca->co, 1.0f);
|
||||
|
||||
/* figure out rotation */
|
||||
|
||||
if(k) {
|
||||
@ -2439,7 +2476,7 @@ void psys_cache_paths(Object *ob, ParticleSystem *psys, float cfra, int editupda
|
||||
if(k == 1) {
|
||||
float *q2;
|
||||
|
||||
VECSUB(tangent, result.co, (ca - 1)->co);
|
||||
VECSUB(tangent, ca->co, (ca - 1)->co);
|
||||
|
||||
q2 = vectoquat(tangent, OB_POSX, OB_POSZ);
|
||||
|
||||
@ -2449,7 +2486,7 @@ void psys_cache_paths(Object *ob, ParticleSystem *psys, float cfra, int editupda
|
||||
Normalize(prev_tangent);
|
||||
}
|
||||
else {
|
||||
VECSUB(tangent, result.co, (ca - 1)->co);
|
||||
VECSUB(tangent, ca->co, (ca - 1)->co);
|
||||
Normalize(tangent);
|
||||
angle = saacos(Inpf(tangent, prev_tangent));
|
||||
|
||||
@ -2470,7 +2507,8 @@ void psys_cache_paths(Object *ob, ParticleSystem *psys, float cfra, int editupda
|
||||
}
|
||||
}
|
||||
|
||||
VECCOPY(ca->co, result.co);
|
||||
|
||||
/* set velocity */
|
||||
|
||||
if(k){
|
||||
VECSUB(ca->vel, ca->co, (ca-1)->co);
|
||||
@ -2512,9 +2550,6 @@ void psys_cache_paths(Object *ob, ParticleSystem *psys, float cfra, int editupda
|
||||
else{
|
||||
VECCOPY(ca->col, col);
|
||||
}
|
||||
|
||||
if(psys->lattice && edit==0)
|
||||
calc_latt_deform(ca->co, 1.0f);
|
||||
}
|
||||
}
|
||||
|
||||
@ -3200,13 +3235,13 @@ void psys_get_particle_on_path(Object *ob, ParticleSystem *psys, int p, Particle
|
||||
ParticleData *pa;
|
||||
ChildParticle *cpa;
|
||||
ParticleTexture ptex;
|
||||
ParticleKey tstate;
|
||||
ParticleKey *kkey[2] = {NULL, NULL};
|
||||
HairKey *hkey[2];
|
||||
ParticleKey *par=0, keys[4];
|
||||
|
||||
float t, real_t, dfra, keytime;
|
||||
float t, real_t, dfra, keytime, frs_sec = G.scene->r.frs_sec;
|
||||
float co[3], orco[3];
|
||||
float imat[4][4], hairmat[4][4], cpa_1st[3];
|
||||
float hairmat[4][4];
|
||||
float pa_clump = 0.0, pa_kink = 0.0;
|
||||
int totparent = 0;
|
||||
int totpart = psys->totpart;
|
||||
@ -3239,19 +3274,39 @@ void psys_get_particle_on_path(Object *ob, ParticleSystem *psys, int p, Particle
|
||||
return;
|
||||
}
|
||||
|
||||
hkey[0] = pa->hair;
|
||||
hkey[1] = pa->hair + 1;
|
||||
if(psys->flag & PSYS_KEYED) {
|
||||
kkey[0] = pa->keys;
|
||||
kkey[1] = kkey[0] + 1;
|
||||
|
||||
real_t = hkey[0]->time + (hkey[0][pa->totkey-1].time - hkey[0]->time) * t;
|
||||
real_t = kkey[0]->time + t * (kkey[0][pa->totkey-1].time - kkey[0]->time);
|
||||
}
|
||||
else {
|
||||
hkey[0] = pa->hair;
|
||||
hkey[1] = pa->hair + 1;
|
||||
|
||||
while(hkey[1]->time < real_t)
|
||||
hkey[1]++;
|
||||
real_t = hkey[0]->time + (hkey[0][pa->totkey-1].time - hkey[0]->time) * t;
|
||||
}
|
||||
|
||||
hkey[0] = hkey[1] - 1;
|
||||
if(psys->flag & PSYS_KEYED) {
|
||||
while(kkey[1]->time < real_t) {
|
||||
kkey[1]++;
|
||||
}
|
||||
kkey[0] = kkey[1] - 1;
|
||||
|
||||
hair_to_particle(keys + 1, hkey[0]);
|
||||
hair_to_particle(keys + 2, hkey[1]);
|
||||
memcpy(keys + 1, kkey[0], sizeof(ParticleKey));
|
||||
memcpy(keys + 2, kkey[1], sizeof(ParticleKey));
|
||||
}
|
||||
else {
|
||||
while(hkey[1]->time < real_t)
|
||||
hkey[1]++;
|
||||
|
||||
hkey[0] = hkey[1] - 1;
|
||||
|
||||
hair_to_particle(keys + 1, hkey[0]);
|
||||
hair_to_particle(keys + 2, hkey[1]);
|
||||
}
|
||||
|
||||
if((psys->flag & PSYS_KEYED)==0) {
|
||||
//if(soft){
|
||||
// if(key[0] != sbel.keys)
|
||||
// DB_copy_key(&k1,key[0]-1);
|
||||
@ -3276,6 +3331,7 @@ void psys_get_particle_on_path(Object *ob, ParticleSystem *psys, int p, Particle
|
||||
hair_to_particle(keys + 3, hkey[1] + 1);
|
||||
else
|
||||
hair_to_particle(keys + 3, hkey[1]);
|
||||
}
|
||||
//}
|
||||
|
||||
//psys_get_particle_on_path(bsys,p,t,bkey,ckey[0]);
|
||||
@ -3296,24 +3352,38 @@ void psys_get_particle_on_path(Object *ob, ParticleSystem *psys, int p, Particle
|
||||
|
||||
keytime = (real_t - keys[1].time) / dfra;
|
||||
|
||||
interpolate_particle((psys->part->flag & PART_HAIR_BSPLINE) ? KEY_BSPLINE : KEY_CARDINAL
|
||||
/* convert velocity to timestep size */
|
||||
if(psys->flag & PSYS_KEYED){
|
||||
VecMulf(keys[1].vel, dfra / frs_sec);
|
||||
VecMulf(keys[2].vel, dfra / frs_sec);
|
||||
QuatInterpol(state->rot,keys[1].rot,keys[2].rot,keytime);
|
||||
}
|
||||
|
||||
interpolate_particle((psys->flag & PSYS_KEYED) ? -1 /* signal for cubic interpolation */
|
||||
: ((psys->part->flag & PART_HAIR_BSPLINE) ? KEY_BSPLINE : KEY_CARDINAL)
|
||||
,keys, keytime, state);
|
||||
|
||||
if((pa->flag & PARS_REKEY)==0) {
|
||||
psys_mat_hair_to_global(ob, psmd->dm, part->from, pa, hairmat);
|
||||
Mat4MulVecfl(hairmat, state->co);
|
||||
/* the velocity needs to be converted back from cubic interpolation */
|
||||
if(psys->flag & PSYS_KEYED){
|
||||
VecMulf(state->vel, frs_sec / dfra);
|
||||
}
|
||||
else {
|
||||
if((pa->flag & PARS_REKEY)==0) {
|
||||
psys_mat_hair_to_global(ob, psmd->dm, part->from, pa, hairmat);
|
||||
Mat4MulVecfl(hairmat, state->co);
|
||||
|
||||
if(psys->effectors.first && (part->flag & PART_CHILD_GUIDE)==0) {
|
||||
do_guide(state, p, state->time, &psys->effectors);
|
||||
/* TODO: proper velocity handling */
|
||||
if(psys->effectors.first && (part->flag & PART_CHILD_GUIDE)==0) {
|
||||
do_guide(state, p, state->time, &psys->effectors);
|
||||
/* TODO: proper velocity handling */
|
||||
}
|
||||
|
||||
if(psys->lattice && edit==0)
|
||||
calc_latt_deform(state->co,1.0f);
|
||||
}
|
||||
|
||||
if(psys->lattice && edit==0)
|
||||
calc_latt_deform(state->co,1.0f);
|
||||
}
|
||||
}
|
||||
else if(totchild){
|
||||
Mat4Invert(imat,ob->obmat);
|
||||
//Mat4Invert(imat,ob->obmat);
|
||||
|
||||
cpa=psys->child+p-totpart;
|
||||
|
||||
@ -3345,19 +3415,9 @@ void psys_get_particle_on_path(Object *ob, ParticleSystem *psys, int p, Particle
|
||||
psys_particle_on_emitter(ob,psmd,cpa_from,cpa_num,DMCACHE_ISCHILD,cpa->fuv,foffset,co,0,0,0,orco,0);
|
||||
|
||||
/* we need to save the actual root position of the child for positioning it accurately to the surface of the emitter */
|
||||
VECCOPY(cpa_1st,co);
|
||||
//VECCOPY(cpa_1st,co);
|
||||
|
||||
//w=0;
|
||||
//while(w<4 && cpa->pa[w]>=0){
|
||||
// pa=psys->particles+cpa->pa[w];
|
||||
// psys_particle_on_emitter(ob,psmd,part->from,pa->num,pa->fuv,pa->foffset,vec,0,0,0);
|
||||
// cpa_1st[0] -= cpa->w[w]*vec[0];
|
||||
// cpa_1st[1] -= cpa->w[w]*vec[1];
|
||||
// cpa_1st[2] -= cpa->w[w]*vec[2];
|
||||
// w++;
|
||||
//}
|
||||
|
||||
Mat4MulVecfl(ob->obmat,cpa_1st);
|
||||
//Mat4MulVecfl(ob->obmat,cpa_1st);
|
||||
|
||||
pa=0;
|
||||
}
|
||||
@ -3412,7 +3472,7 @@ void psys_get_particle_on_path(Object *ob, ParticleSystem *psys, int p, Particle
|
||||
w++;
|
||||
}
|
||||
/* apply offset for correct positioning */
|
||||
VECADD(state->co,state->co,cpa_1st);
|
||||
//VECADD(state->co,state->co,cpa_1st);
|
||||
}
|
||||
else{
|
||||
/* offset the child from the parent position */
|
||||
@ -3452,19 +3512,18 @@ void psys_get_particle_on_path(Object *ob, ParticleSystem *psys, int p, Particle
|
||||
if(part->rough_end != 0.0)
|
||||
do_rough_end(cpa->rand, t, part->rough_end, part->rough_end_shape, state, par);
|
||||
|
||||
if(vel){
|
||||
if(t>=0.001f){
|
||||
tstate.time=t-0.001f;
|
||||
psys_get_particle_on_path(ob,psys,p,&tstate,0);
|
||||
VECSUB(state->vel,state->co,tstate.co);
|
||||
}
|
||||
else{
|
||||
tstate.time=t+0.001f;
|
||||
psys_get_particle_on_path(ob,psys,p,&tstate,0);
|
||||
VECSUB(state->vel,tstate.co,state->co);
|
||||
}
|
||||
}
|
||||
|
||||
//if(vel){
|
||||
// if(t>=0.001f){
|
||||
// tstate.time=t-0.001f;
|
||||
// psys_get_particle_on_path(ob,psys,p,&tstate,0);
|
||||
// VECSUB(state->vel,state->co,tstate.co);
|
||||
// }
|
||||
// else{
|
||||
// tstate.time=t+0.001f;
|
||||
// psys_get_particle_on_path(ob,psys,p,&tstate,0);
|
||||
// VECSUB(state->vel,tstate.co,state->co);
|
||||
// }
|
||||
//}
|
||||
}
|
||||
}
|
||||
/* gets particle's state at a time, returns 1 if particle exists and can be seen and 0 if not */
|
||||
@ -3505,18 +3564,18 @@ int psys_get_particle_state(Object *ob, ParticleSystem *psys, int p, ParticleKey
|
||||
return 0;
|
||||
}
|
||||
|
||||
//if(bsys->flag & (BSYS_DONE|BSYS_KEYED)){
|
||||
// if(between){
|
||||
// //ChildParticle *cpa=psys->child+p-totpart;
|
||||
// //state->time= (cfra-(part->sta+(part->end-part->sta)*cpa->rand[0]))/(part->lifetime*cpa->rand[1]);
|
||||
// }
|
||||
// else
|
||||
// state->time= (cfra-pa->time)/(pa->dietime-pa->time);//pa->lifetime;
|
||||
if(psys->flag & PSYS_KEYED){
|
||||
if(between){
|
||||
ChildParticle *cpa=psys->child+p-totpart;
|
||||
state->time= (cfra-(part->sta+(part->end-part->sta)*cpa->rand[0]))/(part->lifetime*cpa->rand[1]);
|
||||
}
|
||||
else
|
||||
state->time= (cfra-pa->time)/(pa->dietime-pa->time);
|
||||
|
||||
// psys_get_particle_on_path(ob,psys,p,state,1);
|
||||
// return 1;
|
||||
//}
|
||||
//else{
|
||||
psys_get_particle_on_path(ob,psys,p,state,1);
|
||||
return 1;
|
||||
}
|
||||
else{
|
||||
//if(psys->totchild && p>=psys->totpart){
|
||||
// ChildParticle *cpa=psys->child+p-psys->totpart;
|
||||
// ParticleKey *key1, skey;
|
||||
@ -3560,7 +3619,7 @@ int psys_get_particle_state(Object *ob, ParticleSystem *psys, int p, ParticleKey
|
||||
//}
|
||||
|
||||
return 1;
|
||||
//}
|
||||
}
|
||||
}
|
||||
|
||||
void psys_get_dupli_texture(Object *ob, ParticleSettings *part, ParticleSystemModifierData *psmd, ParticleData *pa, ChildParticle *cpa, float *uv, float *orco)
|
||||
|
@ -2607,7 +2607,7 @@ static void precalc_effectors(Object *ob, ParticleSystem *psys, ParticleSystemMo
|
||||
|
||||
|
||||
/* calculate forces that all effectors apply to a particle*/
|
||||
static void do_effectors(int pa_no, ParticleData *pa, ParticleKey *state, Object *ob, ParticleSystem *psys, float *force_field, float *vel,float framestep, float cfra)
|
||||
void do_effectors(int pa_no, ParticleData *pa, ParticleKey *state, Object *ob, ParticleSystem *psys, float *force_field, float *vel,float framestep, float cfra)
|
||||
{
|
||||
Object *eob;
|
||||
ParticleSystem *epsys;
|
||||
@ -4050,12 +4050,16 @@ static void dynamics_step(Object *ob, ParticleSystem *psys, ParticleSystemModifi
|
||||
pa->alive=PARS_UNBORN;
|
||||
}
|
||||
else{
|
||||
pa->loop=0;
|
||||
if(cfra<=pa->time)
|
||||
pa->alive=PARS_UNBORN;
|
||||
pa->loop = 0;
|
||||
if(cfra <= pa->time)
|
||||
pa->alive = PARS_UNBORN;
|
||||
/* without dynamics the state is allways known so no need to kill */
|
||||
else if(ELEM(part->phystype,PART_PHYS_NO,PART_PHYS_KEYED)==0)
|
||||
pa->alive=PARS_KILLED;
|
||||
else if(ELEM(part->phystype, PART_PHYS_NO, PART_PHYS_KEYED)){
|
||||
if(cfra < pa->dietime)
|
||||
pa->alive = PARS_ALIVE;
|
||||
}
|
||||
else
|
||||
pa->alive = PARS_KILLED;
|
||||
}
|
||||
}
|
||||
|
||||
@ -4398,7 +4402,9 @@ static void system_step(Object *ob, ParticleSystem *psys, ParticleSystemModifier
|
||||
return;
|
||||
}
|
||||
}
|
||||
else if(part->phystype != PART_PHYS_NO) { /* cache shouldn't be used for none physics */
|
||||
else if(ELEM(part->phystype, PART_PHYS_NO, PART_PHYS_KEYED))
|
||||
; /* cache shouldn't be used for "none" or "keyed" physics */
|
||||
else {
|
||||
if(psys->recalc && (psys->flag & PSYS_PROTECT_CACHE) == 0)
|
||||
clear_particles_from_cache(ob,psys,(int)cfra);
|
||||
else if(get_particles_from_cache(ob, psys, (int)cfra)) {
|
||||
@ -4500,9 +4506,12 @@ static void system_step(Object *ob, ParticleSystem *psys, ParticleSystemModifier
|
||||
dynamics_step(ob,psys,psmd,cfra,vg_vel,vg_tan,vg_rot,vg_size);
|
||||
|
||||
psys->recalc = 0;
|
||||
psys->cfra=cfra;
|
||||
psys->cfra = cfra;
|
||||
|
||||
if(part->type!=PART_HAIR)
|
||||
if(part->type == PART_HAIR || part->phystype == PART_PHYS_NO
|
||||
|| (part->phystype == PART_PHYS_KEYED && psys->flag & PSYS_FIRST_KEYED))
|
||||
; /* cache shouldn't be used for hair or "none" or "first keyed" physics */
|
||||
else
|
||||
write_particles_to_cache(ob, psys, cfra);
|
||||
|
||||
/* for keyed particles the path is allways known so it can be drawn */
|
||||
|
@ -257,7 +257,6 @@ Scene *add_scene(char *name)
|
||||
|
||||
strcpy(sce->r.backbuf, "//backbuf");
|
||||
strcpy(sce->r.pic, U.renderdir);
|
||||
strcpy(sce->r.ftype, "//ftype");
|
||||
|
||||
BLI_init_rctf(&sce->r.safety, 0.1f, 0.9f, 0.1f, 0.9f);
|
||||
sce->r.osa= 8;
|
||||
@ -661,13 +660,8 @@ void sculptsession_free(Scene *sce)
|
||||
if(ss->mats)
|
||||
MEM_freeN(ss->mats);
|
||||
|
||||
if(ss->propset) {
|
||||
if(ss->propset->texdata)
|
||||
MEM_freeN(ss->propset->texdata);
|
||||
if(ss->propset->num)
|
||||
MEM_freeN(ss->propset->num);
|
||||
MEM_freeN(ss->propset);
|
||||
}
|
||||
if(ss->radialcontrol)
|
||||
MEM_freeN(ss->radialcontrol);
|
||||
|
||||
sculpt_vertexusers_free(ss);
|
||||
if(ss->texcache)
|
||||
|
@ -98,12 +98,12 @@ World *add_world(char *name)
|
||||
wrld->exp= 0.0f;
|
||||
wrld->exposure=wrld->range= 1.0f;
|
||||
|
||||
wrld->aodist= 5.0;
|
||||
wrld->aodist= 5.0f;
|
||||
wrld->aosamp= 5;
|
||||
wrld->aoenergy= 1.0;
|
||||
wrld->aobias= 0.05;
|
||||
wrld->aoenergy= 1.0f;
|
||||
wrld->aobias= 0.05f;
|
||||
wrld->ao_samp_method = WO_AOSAMP_HAMMERSLEY;
|
||||
|
||||
wrld->ao_approx_error= 0.25f;
|
||||
|
||||
wrld->physicsEngine= WOPHY_BULLET;//WOPHY_SUMO; Bullet by default
|
||||
wrld->preview = NULL;
|
||||
|
@ -107,6 +107,7 @@ int BLI_findindex(struct ListBase *listbase, void *vlink);
|
||||
void BLI_freelistN(struct ListBase *listbase);
|
||||
void BLI_addtail(struct ListBase *listbase, void *vlink);
|
||||
void BLI_remlink(struct ListBase *listbase, void *vlink);
|
||||
void BLI_uniquename(struct ListBase *list, void *vlink, char defname[], short name_offs, short len);
|
||||
void BLI_newname(char * name, int add);
|
||||
int BLI_stringdec(char *string, char *kop, char *start, unsigned short *numlen);
|
||||
void BLI_stringenc(char *string, char *kop, char *start, unsigned short numlen, int pic);
|
||||
@ -254,7 +255,7 @@ void BLI_free_file_lines(struct LinkNode *lines);
|
||||
* @param fullname The full path and full name of the executable
|
||||
* @param name The name of the executable (usually argv[0]) to be checked
|
||||
*/
|
||||
void BLI_where_am_i(char *fullname, char *name);
|
||||
void BLI_where_am_i(char *fullname, const char *name);
|
||||
|
||||
/**
|
||||
* determines the full path to the application bundle on OS X
|
||||
@ -296,8 +297,8 @@ int BLI_rename(char *from, char *to);
|
||||
int BLI_gzip(char *from, char *to);
|
||||
int BLI_delete(char *file, int dir, int recursive);
|
||||
int BLI_move(char *file, char *to);
|
||||
int BLI_touch(char *file);
|
||||
char *BLI_last_slash(char *string);
|
||||
int BLI_touch(const char *file);
|
||||
char *BLI_last_slash(const char *string);
|
||||
|
||||
/* BLI_rct.c */
|
||||
/**
|
||||
|
@ -19,6 +19,7 @@ if env['WITH_BF_VERSE']:
|
||||
|
||||
if env['OURPLATFORM'] == 'linux2':
|
||||
cflags='-pthread'
|
||||
incs += ' ../../../extern/binreloc/include'
|
||||
|
||||
if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw'):
|
||||
incs += ' ' + env['BF_PTHREADS_INC']
|
||||
|
@ -59,3 +59,6 @@ endif
|
||||
ifeq ($(WITH_FREETYPE2), true)
|
||||
CPPFLAGS += -DWITH_FREETYPE2
|
||||
endif
|
||||
ifeq ($(OS),linux)
|
||||
CPPFLAGS += -I$(OCGDIR)/extern/binreloc/include
|
||||
endif
|
@ -79,7 +79,7 @@ char *first_slash(char *string) {
|
||||
else return fbslash;
|
||||
}
|
||||
|
||||
char *BLI_last_slash(char *string) {
|
||||
char *BLI_last_slash(const char *string) {
|
||||
char *lfslash, *lbslash;
|
||||
|
||||
lfslash= strrchr(string, '/');
|
||||
@ -140,6 +140,23 @@ int BLI_is_writable(char *filename)
|
||||
}
|
||||
}
|
||||
|
||||
int BLI_touch(const char *file)
|
||||
{
|
||||
FILE *f = fopen(file,"r+b");
|
||||
if (f != NULL) {
|
||||
char c = getc(f);
|
||||
rewind(f);
|
||||
putc(c,f);
|
||||
} else {
|
||||
f = fopen(file,"wb");
|
||||
}
|
||||
if (f) {
|
||||
fclose(f);
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifdef WIN32
|
||||
|
||||
static char str[MAXPATHLEN+12];
|
||||
@ -161,12 +178,6 @@ int BLI_delete(char *file, int dir, int recursive) {
|
||||
return err;
|
||||
}
|
||||
|
||||
int BLI_touch(char *file) {
|
||||
callLocalErrorCallBack("Touching files is unsupported on Windows");
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
int BLI_move(char *file, char *to) {
|
||||
int err;
|
||||
|
||||
@ -296,17 +307,6 @@ int BLI_delete(char *file, int dir, int recursive)
|
||||
return -1;
|
||||
}
|
||||
|
||||
int BLI_touch(char *file)
|
||||
{
|
||||
|
||||
if( BLI_exists("/bin/touch") )
|
||||
sprintf(str, "/bin/touch %s", file);
|
||||
else
|
||||
sprintf(str, "/usr/bin/touch %s", file);
|
||||
|
||||
return system(str);
|
||||
}
|
||||
|
||||
int BLI_move(char *file, char *to) {
|
||||
sprintf(str, "/bin/mv -f \"%s\" \"%s\"", file, to);
|
||||
|
||||
|
@ -84,6 +84,10 @@
|
||||
#include <CoreFoundation/CoreFoundation.h>
|
||||
#endif
|
||||
|
||||
#ifdef __linux__
|
||||
#include "binreloc.h"
|
||||
#endif
|
||||
|
||||
/* local */
|
||||
|
||||
static int add_win32_extension(char *name);
|
||||
@ -216,6 +220,79 @@ void BLI_newname(char *name, int add)
|
||||
BLI_stringenc(name, head, tail, digits, pic);
|
||||
}
|
||||
|
||||
/* little helper macro for BLI_uniquename */
|
||||
#ifndef GIVE_STRADDR
|
||||
#define GIVE_STRADDR(data, offset) ( ((char *)data) + offset )
|
||||
#endif
|
||||
|
||||
/* Generic function to set a unique name. It is only designed to be used in situations
|
||||
* where the name is part of the struct, and also that the name is at most 128 chars long.
|
||||
*
|
||||
* For places where this is used, see constraint.c for example...
|
||||
*
|
||||
* name_offs: should be calculated using offsetof(structname, membername) macro from stddef.h
|
||||
* len: maximum length of string (to prevent overflows, etc.)
|
||||
* defname: the name that should be used by default if none is specified already
|
||||
*/
|
||||
void BLI_uniquename(ListBase *list, void *vlink, char defname[], short name_offs, short len)
|
||||
{
|
||||
Link *link;
|
||||
char tempname[128];
|
||||
int number = 1, exists = 0;
|
||||
char *dot;
|
||||
|
||||
/* Make sure length can be handled */
|
||||
if ((len < 0) || (len > 128))
|
||||
return;
|
||||
|
||||
/* See if we are given an empty string */
|
||||
if (ELEM(NULL, vlink, defname))
|
||||
return;
|
||||
|
||||
if (GIVE_STRADDR(vlink, name_offs) == '\0') {
|
||||
/* give it default name first */
|
||||
BLI_strncpy(GIVE_STRADDR(vlink, name_offs), defname, len);
|
||||
}
|
||||
|
||||
/* See if we even need to do this */
|
||||
if (list == NULL)
|
||||
return;
|
||||
|
||||
for (link = list->first; link; link= link->next) {
|
||||
if (link != vlink) {
|
||||
if (!strcmp(GIVE_STRADDR(link, name_offs), GIVE_STRADDR(vlink, name_offs))) {
|
||||
exists = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (exists == 0)
|
||||
return;
|
||||
|
||||
/* Strip off the suffix */
|
||||
dot = strchr(GIVE_STRADDR(vlink, name_offs), '.');
|
||||
if (dot)
|
||||
*dot=0;
|
||||
|
||||
for (number = 1; number <= 999; number++) {
|
||||
BLI_snprintf(tempname, 128, "%s.%03d", GIVE_STRADDR(vlink, name_offs), number);
|
||||
|
||||
exists = 0;
|
||||
for (link= list->first; link; link= link->next) {
|
||||
if (vlink != link) {
|
||||
if (!strcmp(GIVE_STRADDR(link, name_offs), tempname)) {
|
||||
exists = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (exists == 0) {
|
||||
BLI_strncpy(GIVE_STRADDR(vlink, name_offs), tempname, len);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void BLI_addhead(ListBase *listbase, void *vlink)
|
||||
{
|
||||
@ -1444,10 +1521,10 @@ static int add_win32_extension(char *name)
|
||||
return (retval);
|
||||
}
|
||||
|
||||
void BLI_where_am_i(char *fullname, char *name)
|
||||
void BLI_where_am_i(char *fullname, const char *name)
|
||||
{
|
||||
char filename[FILE_MAXDIR+FILE_MAXFILE];
|
||||
char *path, *temp;
|
||||
char *path = NULL, *temp;
|
||||
int len;
|
||||
#ifdef _WIN32
|
||||
char *seperator = ";";
|
||||
@ -1457,6 +1534,17 @@ void BLI_where_am_i(char *fullname, char *name)
|
||||
char *slash = "/";
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef __linux__
|
||||
/* linux uses binreloc since argv[0] is not relyable, call br_init( NULL ) first */
|
||||
path = br_find_exe( NULL );
|
||||
if (path) {
|
||||
strcpy(fullname, path);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* unix and non linux */
|
||||
if (name && fullname && strlen(name)) {
|
||||
strcpy(fullname, name);
|
||||
if (name[0] == '.') {
|
||||
|
@ -1861,12 +1861,24 @@ static void direct_link_bones(FileData *fd, Bone* bone)
|
||||
static void direct_link_action(FileData *fd, bAction *act)
|
||||
{
|
||||
bActionChannel *achan;
|
||||
bActionGroup *agrp;
|
||||
|
||||
link_list(fd, &act->chanbase);
|
||||
link_list(fd, &act->groups);
|
||||
link_list(fd, &act->markers);
|
||||
|
||||
for (achan = act->chanbase.first; achan; achan=achan->next)
|
||||
for (achan = act->chanbase.first; achan; achan=achan->next) {
|
||||
achan->grp= newdataadr(fd, achan->grp);
|
||||
|
||||
link_list(fd, &achan->constraintChannels);
|
||||
}
|
||||
|
||||
for (agrp = act->groups.first; agrp; agrp= agrp->next) {
|
||||
if (agrp->channels.first) {
|
||||
agrp->channels.first= newdataadr(fd, agrp->channels.first);
|
||||
agrp->channels.last= newdataadr(fd, agrp->channels.last);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void direct_link_armature(FileData *fd, bArmature *arm)
|
||||
@ -2528,6 +2540,11 @@ static void direct_link_particlesystems(FileData *fd, ListBase *particles)
|
||||
for(a=0; a<psys->totpart; a++, pa++)
|
||||
pa->hair=newdataadr(fd,pa->hair);
|
||||
}
|
||||
if(psys->particles && psys->particles->keys){
|
||||
ParticleData *pa = psys->particles;
|
||||
for(a=0; a<psys->totpart; a++, pa++)
|
||||
pa->keys=newdataadr(fd,pa->keys);
|
||||
}
|
||||
psys->child=newdataadr(fd,psys->child);
|
||||
psys->effectors.first=psys->effectors.last=0;
|
||||
|
||||
@ -2815,8 +2832,7 @@ static void lib_link_object(FileData *fd, Main *main)
|
||||
else printf("Object %s lost data.", ob->id.name+2);
|
||||
|
||||
if(ob->pose) {
|
||||
free_pose_channels(ob->pose);
|
||||
MEM_freeN(ob->pose);
|
||||
free_pose(ob->pose);
|
||||
ob->pose= NULL;
|
||||
ob->flag &= ~OB_POSEMODE;
|
||||
}
|
||||
@ -2953,6 +2969,7 @@ static void direct_link_pose(FileData *fd, bPose *pose) {
|
||||
return;
|
||||
|
||||
link_list(fd, &pose->chanbase);
|
||||
link_list(fd, &pose->agroups);
|
||||
|
||||
for (pchan = pose->chanbase.first; pchan; pchan=pchan->next) {
|
||||
pchan->bone= NULL;
|
||||
@ -6718,6 +6735,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
|
||||
Lamp *la;
|
||||
Material *ma;
|
||||
ParticleSettings *part;
|
||||
World *wrld;
|
||||
Mesh *me;
|
||||
|
||||
/* unless the file was created 2.44.3 but not 2.45, update the constraints */
|
||||
@ -6898,6 +6916,11 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
|
||||
}
|
||||
}
|
||||
|
||||
for(wrld=main->world.first; wrld; wrld= wrld->id.next) {
|
||||
if(wrld->ao_approx_error == 0.0f)
|
||||
wrld->ao_approx_error= 0.25f;
|
||||
}
|
||||
|
||||
if (main->versionfile < 245 || main->subversionfile < 12)
|
||||
{
|
||||
/* initialize skeleton generation toolsettings */
|
||||
@ -7531,6 +7554,14 @@ static void expand_doit(FileData *fd, Main *mainvar, void *old)
|
||||
}
|
||||
}
|
||||
|
||||
static void expand_particlesettings(FileData *fd, Main *mainvar, ParticleSettings *part)
|
||||
{
|
||||
expand_doit(fd, mainvar, part->dup_ob);
|
||||
expand_doit(fd, mainvar, part->dup_group);
|
||||
expand_doit(fd, mainvar, part->eff_group);
|
||||
expand_doit(fd, mainvar, part->bb_ob);
|
||||
}
|
||||
|
||||
static void expand_ipo(FileData *fd, Main *mainvar, Ipo *ipo)
|
||||
{
|
||||
IpoCurve *icu;
|
||||
@ -8123,6 +8154,8 @@ static void expand_main(FileData *fd, Main *mainvar)
|
||||
case ID_IP:
|
||||
expand_ipo(fd, mainvar, (Ipo *)id);
|
||||
break;
|
||||
case ID_PA:
|
||||
expand_particlesettings(fd, mainvar, (ParticleSettings *)id);
|
||||
}
|
||||
|
||||
doit= 1;
|
||||
@ -8146,7 +8179,7 @@ static int object_in_any_scene(Object *ob)
|
||||
}
|
||||
|
||||
/* when *lib set, it also does objects that were in the appended group */
|
||||
static void give_base_to_objects(Scene *sce, ListBase *lb, Library *lib)
|
||||
static void give_base_to_objects(Scene *sce, ListBase *lb, Library *lib, int is_group_append)
|
||||
{
|
||||
Object *ob;
|
||||
Base *base;
|
||||
@ -8155,25 +8188,33 @@ static void give_base_to_objects(Scene *sce, ListBase *lb, Library *lib)
|
||||
for(ob= lb->first; ob; ob= ob->id.next) {
|
||||
|
||||
if( ob->id.flag & LIB_INDIRECT ) {
|
||||
int do_it= 0;
|
||||
|
||||
if(ob->id.us==0)
|
||||
do_it= 1;
|
||||
else if(ob->id.us==1 && lib)
|
||||
if(ob->id.lib==lib && (ob->flag & OB_FROMGROUP) && object_in_any_scene(ob)==0)
|
||||
/* IF below is quite confusing!
|
||||
if we are appending, but this object wasnt just added allong with a group,
|
||||
then this is alredy used indirectly in the scene somewhere else and we didnt just append it.
|
||||
|
||||
(ob->id.flag & LIB_APPEND_TAG)==0 means that this is a newly appended object - Campbell */
|
||||
if (is_group_append==0 || (ob->id.flag & LIB_APPEND_TAG)==0) {
|
||||
|
||||
int do_it= 0;
|
||||
|
||||
if(ob->id.us==0)
|
||||
do_it= 1;
|
||||
else if(ob->id.us==1 && lib)
|
||||
if(ob->id.lib==lib && (ob->flag & OB_FROMGROUP) && object_in_any_scene(ob)==0)
|
||||
do_it= 1;
|
||||
|
||||
if(do_it) {
|
||||
base= MEM_callocN( sizeof(Base), "add_ext_base");
|
||||
BLI_addtail(&(sce->base), base);
|
||||
base->lay= ob->lay;
|
||||
base->object= ob;
|
||||
base->flag= ob->flag;
|
||||
ob->id.us= 1;
|
||||
|
||||
ob->id.flag -= LIB_INDIRECT;
|
||||
ob->id.flag |= LIB_EXTERN;
|
||||
if(do_it) {
|
||||
base= MEM_callocN( sizeof(Base), "add_ext_base");
|
||||
BLI_addtail(&(sce->base), base);
|
||||
base->lay= ob->lay;
|
||||
base->object= ob;
|
||||
base->flag= ob->flag;
|
||||
ob->id.us= 1;
|
||||
|
||||
ob->id.flag -= LIB_INDIRECT;
|
||||
ob->id.flag |= LIB_EXTERN;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -8312,11 +8353,15 @@ static Library* library_append( Scene *scene, char* file, char *dir, int idcode,
|
||||
lib_verify_nodetree(G.main);
|
||||
|
||||
/* give a base to loose objects. If group append, do it for objects too */
|
||||
if(idcode==ID_GR)
|
||||
give_base_to_objects(scene, &(G.main->object), (flag & FILE_LINK)?NULL:curlib);
|
||||
else
|
||||
give_base_to_objects(scene, &(G.main->object), NULL);
|
||||
|
||||
if(idcode==ID_GR) {
|
||||
if (flag & FILE_LINK) {
|
||||
give_base_to_objects(scene, &(G.main->object), NULL, 0);
|
||||
} else {
|
||||
give_base_to_objects(scene, &(G.main->object), curlib, 1);
|
||||
}
|
||||
} else {
|
||||
give_base_to_objects(scene, &(G.main->object), NULL, 0);
|
||||
}
|
||||
/* has been removed... erm, why? s..ton) */
|
||||
/* 20040907: looks like they are give base already in append_named_part(); -Nathan L */
|
||||
/* 20041208: put back. It only linked direct, not indirect objects (ton) */
|
||||
|
@ -560,6 +560,13 @@ static void write_particlesystems(WriteData *wd, ListBase *particles)
|
||||
for(a=0; a<psys->totpart; a++, pa++)
|
||||
writestruct(wd, DATA, "HairKey", pa->totkey, pa->hair);
|
||||
}
|
||||
|
||||
if(psys->particles->keys) {
|
||||
ParticleData *pa = psys->particles;
|
||||
|
||||
for(a=0; a<psys->totpart; a++, pa++)
|
||||
writestruct(wd, DATA, "ParticleKey", pa->totkey, pa->keys);
|
||||
}
|
||||
}
|
||||
if(psys->child) writestruct(wd, DATA, "ChildParticle", psys->totchild ,psys->child);
|
||||
writestruct(wd, DATA, "SoftBody", 1, psys->soft);
|
||||
@ -772,6 +779,7 @@ static void write_constraints(WriteData *wd, ListBase *conlist)
|
||||
static void write_pose(WriteData *wd, bPose *pose)
|
||||
{
|
||||
bPoseChannel *chan;
|
||||
bActionGroup *grp;
|
||||
|
||||
/* Write each channel */
|
||||
if (!pose)
|
||||
@ -788,6 +796,10 @@ static void write_pose(WriteData *wd, bPose *pose)
|
||||
writestruct(wd, DATA, "bPoseChannel", 1, chan);
|
||||
}
|
||||
|
||||
/* Write groups */
|
||||
for (grp=pose->agroups.first; grp; grp=grp->next)
|
||||
writestruct(wd, DATA, "bActionGroup", 1, grp);
|
||||
|
||||
/* Write this pose */
|
||||
writestruct(wd, DATA, "bPose", 1, pose);
|
||||
}
|
||||
@ -1752,6 +1764,7 @@ static void write_actions(WriteData *wd, ListBase *idbase)
|
||||
{
|
||||
bAction *act;
|
||||
bActionChannel *chan;
|
||||
bActionGroup *grp;
|
||||
TimeMarker *marker;
|
||||
|
||||
for(act=idbase->first; act; act= act->id.next) {
|
||||
@ -1764,6 +1777,10 @@ static void write_actions(WriteData *wd, ListBase *idbase)
|
||||
write_constraint_channels(wd, &chan->constraintChannels);
|
||||
}
|
||||
|
||||
for (grp=act->groups.first; grp; grp=grp->next) {
|
||||
writestruct(wd, DATA, "bActionGroup", 1, grp);
|
||||
}
|
||||
|
||||
for (marker=act->markers.first; marker; marker=marker->next) {
|
||||
writestruct(wd, DATA, "TimeMarker", 1, marker);
|
||||
}
|
||||
|
@ -280,6 +280,7 @@ short imb_addrectfloatImBuf(struct ImBuf * ibuf)
|
||||
|
||||
size = ibuf->x * ibuf->y;
|
||||
size = size * 4 * sizeof(float);
|
||||
ibuf->channels= 4;
|
||||
|
||||
if ( (ibuf->rect_float = MEM_mapallocN(size, "imb_addrectfloatImBuf")) ){
|
||||
ibuf->mall |= IB_rectfloat;
|
||||
@ -445,7 +446,7 @@ struct ImBuf *IMB_dupImBuf(struct ImBuf *ibuf1)
|
||||
memcpy(ibuf2->rect, ibuf1->rect, x * y * sizeof(int));
|
||||
|
||||
if (flags & IB_rectfloat)
|
||||
memcpy(ibuf2->rect_float, ibuf1->rect_float, 4 * x * y * sizeof(float));
|
||||
memcpy(ibuf2->rect_float, ibuf1->rect_float, ibuf1->channels * x * y * sizeof(float));
|
||||
|
||||
if (flags & IB_planes)
|
||||
memcpy(*(ibuf2->planes),*(ibuf1->planes),ibuf1->depth * ibuf1->skipx * y * sizeof(int));
|
||||
|
@ -594,7 +594,7 @@ static int startffmpeg(struct anim * anim) {
|
||||
anim->pFrame = avcodec_alloc_frame();
|
||||
anim->pFrameRGB = avcodec_alloc_frame();
|
||||
|
||||
if (avpicture_get_size(PIX_FMT_RGBA32, anim->x, anim->y)
|
||||
if (avpicture_get_size(PIX_FMT_BGR32, anim->x, anim->y)
|
||||
!= anim->x * anim->y * 4) {
|
||||
fprintf (stderr,
|
||||
"ffmpeg has changed alloc scheme ... ARGHHH!\n");
|
||||
@ -617,7 +617,7 @@ static int startffmpeg(struct anim * anim) {
|
||||
anim->pCodecCtx->pix_fmt,
|
||||
anim->pCodecCtx->width,
|
||||
anim->pCodecCtx->height,
|
||||
PIX_FMT_RGBA,
|
||||
PIX_FMT_BGR32,
|
||||
SWS_FAST_BILINEAR | SWS_PRINT_INFO,
|
||||
NULL, NULL, NULL);
|
||||
|
||||
@ -637,7 +637,7 @@ static ImBuf * ffmpeg_fetchibuf(struct anim * anim, int position) {
|
||||
|
||||
avpicture_fill((AVPicture *)anim->pFrameRGB,
|
||||
(unsigned char*) ibuf->rect,
|
||||
PIX_FMT_RGBA32, anim->x, anim->y);
|
||||
PIX_FMT_BGR32, anim->x, anim->y);
|
||||
|
||||
if (position != anim->curposition + 1) {
|
||||
if (position > anim->curposition + 1
|
||||
@ -714,34 +714,98 @@ static ImBuf * ffmpeg_fetchibuf(struct anim * anim, int position) {
|
||||
}
|
||||
|
||||
if(frameFinished && pos_found == 1) {
|
||||
int * dstStride = anim->pFrameRGB->linesize;
|
||||
uint8_t** dst = anim->pFrameRGB->data;
|
||||
int dstStride2[4]= { -dstStride[0], 0, 0, 0 };
|
||||
uint8_t* dst2[4]= {
|
||||
dst[0] + (anim->y - 1)*dstStride[0],
|
||||
0, 0, 0 };
|
||||
int i;
|
||||
unsigned char* r;
|
||||
if (G.order == B_ENDIAN) {
|
||||
int * dstStride
|
||||
= anim->pFrameRGB->linesize;
|
||||
uint8_t** dst = anim->pFrameRGB->data;
|
||||
int dstStride2[4]
|
||||
= { dstStride[0], 0, 0, 0 };
|
||||
uint8_t* dst2[4]= {
|
||||
dst[0], 0, 0, 0 };
|
||||
int x,y,h,w;
|
||||
unsigned char* bottom;
|
||||
unsigned char* top;
|
||||
|
||||
sws_scale(anim->img_convert_ctx,
|
||||
anim->pFrame->data,
|
||||
anim->pFrame->linesize,
|
||||
0,
|
||||
anim->pCodecCtx->height,
|
||||
dst2,
|
||||
dstStride2);
|
||||
sws_scale(anim->img_convert_ctx,
|
||||
anim->pFrame->data,
|
||||
anim->pFrame->linesize,
|
||||
0,
|
||||
anim->pCodecCtx->height,
|
||||
dst2,
|
||||
dstStride2);
|
||||
|
||||
/* workaround: sws_scale sets alpha = 0... */
|
||||
/* workaround: sws_scale
|
||||
sets alpha = 0 and compensate
|
||||
for altivec-bugs and flipy... */
|
||||
|
||||
r = (unsigned char*) ibuf->rect;
|
||||
bottom = (unsigned char*) ibuf->rect;
|
||||
top = bottom
|
||||
+ ibuf->x * (ibuf->y-1) * 4;
|
||||
|
||||
for (i = 0; i < ibuf->x * ibuf->y; i++) {
|
||||
r[3] = 0xff;
|
||||
r+=4;
|
||||
h = (ibuf->y + 1) / 2;
|
||||
w = ibuf->x;
|
||||
|
||||
for (y = 0; y < h; y++) {
|
||||
unsigned char tmp[4];
|
||||
unsigned long * tmp_l =
|
||||
(unsigned long*) tmp;
|
||||
tmp[3] = 0xff;
|
||||
|
||||
for (x = 0; x < w; x++) {
|
||||
tmp[0] = bottom[3];
|
||||
tmp[1] = bottom[2];
|
||||
tmp[2] = bottom[1];
|
||||
|
||||
bottom[0] = top[3];
|
||||
bottom[1] = top[2];
|
||||
bottom[2] = top[1];
|
||||
bottom[3] = 0xff;
|
||||
|
||||
*(unsigned long*) top
|
||||
= *tmp_l;
|
||||
|
||||
bottom +=4;
|
||||
top += 4;
|
||||
}
|
||||
top -= 8 * w;
|
||||
}
|
||||
|
||||
av_free_packet(&packet);
|
||||
break;
|
||||
} else {
|
||||
int * dstStride
|
||||
= anim->pFrameRGB->linesize;
|
||||
uint8_t** dst = anim->pFrameRGB->data;
|
||||
int dstStride2[4]
|
||||
= { -dstStride[0], 0, 0, 0 };
|
||||
uint8_t* dst2[4]= {
|
||||
dst[0]
|
||||
+ (anim->y - 1)*dstStride[0],
|
||||
0, 0, 0 };
|
||||
int i;
|
||||
unsigned char* r;
|
||||
|
||||
sws_scale(anim->img_convert_ctx,
|
||||
anim->pFrame->data,
|
||||
anim->pFrame->linesize,
|
||||
0,
|
||||
anim->pCodecCtx->height,
|
||||
dst2,
|
||||
dstStride2);
|
||||
|
||||
/* workaround: sws_scale
|
||||
sets alpha = 0... */
|
||||
|
||||
r = (unsigned char*) ibuf->rect;
|
||||
|
||||
for (i = 0; i < ibuf->x * ibuf->y;i++){
|
||||
r[3] = 0xff;
|
||||
r+=4;
|
||||
}
|
||||
|
||||
av_free_packet(&packet);
|
||||
break;
|
||||
}
|
||||
|
||||
av_free_packet(&packet);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -61,6 +61,7 @@
|
||||
|
||||
#include <stdio.h> // printf
|
||||
#include <math.h> // sqrt
|
||||
#include <sys/types.h>
|
||||
|
||||
/*** declarations ***/
|
||||
|
||||
@ -769,7 +770,7 @@ static Color32 buildNormal(uint8 x, uint8 y)
|
||||
float nx = 2 * (x / 255.0f) - 1;
|
||||
float ny = 2 * (y / 255.0f) - 1;
|
||||
float nz = 0.0f;
|
||||
if (1 - nx*nx - ny*ny > 0) nz = sqrtf(1 - nx*nx - ny*ny);
|
||||
if (1 - nx*nx - ny*ny > 0) nz = sqrt(1 - nx*nx - ny*ny);
|
||||
uint8 z = clamp(int(255.0f * (nz + 1) / 2.0f), 0, 255);
|
||||
|
||||
return Color32(x, y, z);
|
||||
|
@ -51,22 +51,28 @@ I stole it from util.h in the plugins api */
|
||||
/* Only this one is used liberally here, and in imbuf */
|
||||
void IMB_convert_rgba_to_abgr(struct ImBuf *ibuf)
|
||||
{
|
||||
int size, do_float=0;
|
||||
int size;
|
||||
unsigned char rt, *cp = (unsigned char *)ibuf->rect;
|
||||
float rtf, *cpf = ibuf->rect_float;
|
||||
|
||||
if (ibuf->rect_float) do_float = 1;
|
||||
size = ibuf->x * ibuf->y;
|
||||
if (ibuf->rect) {
|
||||
size = ibuf->x * ibuf->y;
|
||||
|
||||
while(size-- > 0) {
|
||||
rt= cp[0];
|
||||
cp[0]= cp[3];
|
||||
cp[3]= rt;
|
||||
rt= cp[1];
|
||||
cp[1]= cp[2];
|
||||
cp[2]= rt;
|
||||
cp+= 4;
|
||||
if (do_float) {
|
||||
while(size-- > 0) {
|
||||
rt= cp[0];
|
||||
cp[0]= cp[3];
|
||||
cp[3]= rt;
|
||||
rt= cp[1];
|
||||
cp[1]= cp[2];
|
||||
cp[2]= rt;
|
||||
cp+= 4;
|
||||
}
|
||||
}
|
||||
|
||||
if (ibuf->rect_float) {
|
||||
size = ibuf->x * ibuf->y;
|
||||
|
||||
while(size-- > 0) {
|
||||
rtf= cpf[0];
|
||||
cpf[0]= cpf[3];
|
||||
cpf[3]= rtf;
|
||||
|
@ -38,6 +38,7 @@ struct Ipo;
|
||||
struct IpoCurve;
|
||||
struct gla2DDrawInfo;
|
||||
struct bAction;
|
||||
struct bActionGroup;
|
||||
struct Object;
|
||||
struct ListBase;
|
||||
|
||||
@ -75,14 +76,16 @@ void draw_cfra_action(void);
|
||||
/* Channel Drawing */
|
||||
void draw_icu_channel(struct gla2DDrawInfo *di, struct IpoCurve *icu, float ypos);
|
||||
void draw_ipo_channel(struct gla2DDrawInfo *di, struct Ipo *ipo, float ypos);
|
||||
void draw_action_channel(struct gla2DDrawInfo *di, bAction *act, float ypos);
|
||||
void draw_object_channel(struct gla2DDrawInfo *di, Object *ob, float ypos);
|
||||
void draw_agroup_channel(struct gla2DDrawInfo *di, struct bActionGroup *agrp, float ypos);
|
||||
void draw_action_channel(struct gla2DDrawInfo *di, struct bAction *act, float ypos);
|
||||
void draw_object_channel(struct gla2DDrawInfo *di, struct Object *ob, float ypos);
|
||||
|
||||
/* Keydata Generation */
|
||||
void icu_to_keylist(struct IpoCurve *icu, ListBase *keys, ListBase *blocks);
|
||||
void ipo_to_keylist(struct Ipo *ipo, ListBase *keys, ListBase *blocks);
|
||||
void action_to_keylist(bAction *act, ListBase *keys, ListBase *blocks);
|
||||
void ob_to_keylist(Object *ob, ListBase *keys, ListBase *blocks);
|
||||
void agroup_to_keylist(struct bActionGroup *agrp, ListBase *keys, ListBase *blocks);
|
||||
void action_to_keylist(struct bAction *act, ListBase *keys, ListBase *blocks);
|
||||
void ob_to_keylist(struct Object *ob, ListBase *keys, ListBase *blocks);
|
||||
|
||||
#endif /* BDR_DRAWACTION_H */
|
||||
|
||||
|
@ -111,6 +111,8 @@ void set_ob_ipoflags(void);
|
||||
void select_select_keys(void);
|
||||
int vergbaseco(const void *a1, const void *a2);
|
||||
void auto_timeoffs(void);
|
||||
void ofs_timeoffs(void);
|
||||
void rand_timeoffs(void);
|
||||
void texspace_edit(void);
|
||||
void flip_subdivison(int);
|
||||
void mirrormenu(void);
|
||||
|
@ -33,7 +33,6 @@
|
||||
#include "DNA_listBase.h"
|
||||
#include "DNA_vec_types.h"
|
||||
#include "BKE_sculpt.h"
|
||||
#include "transform.h"
|
||||
|
||||
struct uiBlock;
|
||||
struct BrushData;
|
||||
@ -59,15 +58,13 @@ void sculptmode_draw_interface_tools(struct uiBlock *block,unsigned short cx, un
|
||||
void sculptmode_draw_interface_brush(struct uiBlock *block,unsigned short cx, unsigned short cy);
|
||||
void sculptmode_draw_interface_textures(struct uiBlock *block,unsigned short cx, unsigned short cy);
|
||||
void sculptmode_rem_tex(void*,void*);
|
||||
void sculptmode_propset_init(PropsetMode mode);
|
||||
void sculptmode_propset(const unsigned short event);
|
||||
void sculptmode_selectbrush_menu(void);
|
||||
void sculptmode_draw_mesh(int);
|
||||
void sculpt_paint_brush(char clear);
|
||||
void sculpt_stroke_draw();
|
||||
void sculpt_radialcontrol_start(int mode);
|
||||
|
||||
struct BrushData *sculptmode_brush(void);
|
||||
float tex_angle(void);
|
||||
void do_symmetrical_brush_actions(struct EditData *e, short *, short *);
|
||||
|
||||
void sculptmode_update_tex(void);
|
||||
|
@ -43,6 +43,7 @@
|
||||
/* Some types for easier type-testing */
|
||||
enum {
|
||||
ACTTYPE_NONE= 0,
|
||||
ACTTYPE_GROUP,
|
||||
ACTTYPE_ACHAN,
|
||||
ACTTYPE_CONCHAN,
|
||||
ACTTYPE_ICU,
|
||||
@ -53,6 +54,10 @@ enum {
|
||||
};
|
||||
|
||||
/* Macros for easier/more consistant state testing */
|
||||
#define EDITABLE_AGRP(agrp) ((agrp->flag & AGRP_PROTECTED)==0)
|
||||
#define EXPANDED_AGRP(agrp) (agrp->flag & AGRP_EXPANDED)
|
||||
#define SEL_AGRP(agrp) ((agrp->flag & AGRP_SELECTED) || (agrp->flag & AGRP_ACTIVE))
|
||||
|
||||
#define VISIBLE_ACHAN(achan) ((achan->flag & ACHAN_HIDDEN)==0)
|
||||
#define EDITABLE_ACHAN(achan) ((VISIBLE_ACHAN(achan)) && ((achan->flag & ACHAN_PROTECTED)==0))
|
||||
#define EXPANDED_ACHAN(achan) ((VISIBLE_ACHAN(achan)) && (achan->flag & ACHAN_EXPANDED))
|
||||
@ -81,7 +86,6 @@ enum {
|
||||
|
||||
/* constants for setting ipo-extrapolation type */
|
||||
enum {
|
||||
|
||||
SET_EXTEND_MENU = 9,
|
||||
SET_EXTEND_POPUP = 10,
|
||||
|
||||
@ -91,9 +95,19 @@ enum {
|
||||
SET_EXTEND_CYCLICEXTRAPOLATION
|
||||
};
|
||||
|
||||
/* constants for channel rearranging */
|
||||
/* WARNING: don't change exising ones without modifying rearrange func accordingly */
|
||||
enum {
|
||||
REARRANGE_ACTCHAN_TOP= -2,
|
||||
REARRANGE_ACTCHAN_UP= -1,
|
||||
REARRANGE_ACTCHAN_DOWN= 1,
|
||||
REARRANGE_ACTCHAN_BOTTOM= 2
|
||||
};
|
||||
|
||||
|
||||
struct bAction;
|
||||
struct bActionChannel;
|
||||
struct bActionGroup;
|
||||
struct bPoseChannel;
|
||||
struct Object;
|
||||
struct Ipo;
|
||||
@ -125,11 +139,16 @@ void free_actcopybuf(void);
|
||||
void copy_actdata(void);
|
||||
void paste_actdata(void);
|
||||
|
||||
/* Channel/strip operations */
|
||||
void up_sel_action(void);
|
||||
void down_sel_action(void);
|
||||
void top_sel_action(void);
|
||||
void bottom_sel_action(void);
|
||||
/* Group/Channel Operations */
|
||||
struct bActionGroup *get_active_actiongroup(struct bAction *act);
|
||||
void set_active_actiongroup(struct bAction *act, struct bActionGroup *agrp, short select);
|
||||
void unique_name_actiongroup(struct ListBase *lb, struct bActionGroup *agrp);
|
||||
// <--- add some func to add group for action-channel based on corresponding pchan's grouping
|
||||
void action_groups_group(short add_group);
|
||||
void action_groups_ungroup(void);
|
||||
|
||||
/* Channel/Strip Operations */
|
||||
void rearrange_action_channels(short mode);
|
||||
|
||||
void expand_all_action(void);
|
||||
void openclose_level_action(short mode);
|
||||
|
@ -38,6 +38,7 @@
|
||||
struct Object;
|
||||
struct ParticleSystem;
|
||||
struct ParticleEditSettings;
|
||||
struct RadialControl;
|
||||
|
||||
/* particle edit mode */
|
||||
void PE_set_particle_edit(void);
|
||||
@ -53,6 +54,7 @@ short PE_get_current_num(struct Object *ob);
|
||||
int PE_minmax(float *min, float *max);
|
||||
void PE_get_colors(char sel[4], char nosel[4]);
|
||||
struct ParticleEditSettings *PE_settings(void);
|
||||
struct RadialControl **PE_radialcontrol();
|
||||
|
||||
/* update calls */
|
||||
void PE_hide_keys_time(struct ParticleSystem *psys, float cfra);
|
||||
@ -83,6 +85,7 @@ void PE_remove_doubles(void);
|
||||
void PE_mirror_x(int tagged);
|
||||
void PE_selectbrush_menu(void);
|
||||
void PE_remove_doubles(void);
|
||||
void PE_radialcontrol_start(const int mode);
|
||||
|
||||
/* undo */
|
||||
void PE_undo_push(char *str);
|
||||
|
@ -62,6 +62,7 @@ void mouse_select_seq(void);
|
||||
void no_gaps(void);
|
||||
void seq_snap(short event);
|
||||
void seq_snap_menu(void);
|
||||
void seq_mute_sel( int mute );
|
||||
void set_filter_seq(void);
|
||||
void swap_select_seq(void);
|
||||
void touch_seq_files(void);
|
||||
@ -77,9 +78,18 @@ void select_surround_from_last();
|
||||
void select_dir_from_last(int lr);
|
||||
void select_neighbor_from_last(int lr);
|
||||
void select_linked_seq(int mode);
|
||||
int test_overlap_seq(struct Sequence *test);
|
||||
void shuffle_seq(struct Sequence *test);
|
||||
struct Sequence* alloc_sequence(ListBase *lb, int cfra, int machine); /*used from python*/
|
||||
int check_single_seq(struct Sequence *seq);
|
||||
|
||||
/* seq funcs for transform
|
||||
notice the difference between start/end and left/right.
|
||||
|
||||
left and right are the bounds at which the setuence is rendered,
|
||||
start and end are from the start and fixed length of the sequence.
|
||||
*/
|
||||
|
||||
/* sequence transform functions, for internal used */
|
||||
int seq_tx_get_start(struct Sequence *seq);
|
||||
int seq_tx_get_end(struct Sequence *seq);
|
||||
@ -94,40 +104,9 @@ void seq_tx_set_final_right(struct Sequence *seq, int i);
|
||||
int seq_tx_check_left(struct Sequence *seq);
|
||||
int seq_tx_check_right(struct Sequence *seq);
|
||||
|
||||
#define SEQ_DEBUG_INFO(seq) printf("seq into '%s' -- len:%i start:%i startstill:%i endstill:%i startofs:%i endofs:%i\n",\
|
||||
seq->name, seq->len, seq->start, seq->startstill, seq->endstill, seq->startofs, seq->endofs)
|
||||
#define SEQ_DEBUG_INFO(seq) printf("seq into '%s' -- len:%i start:%i startstill:%i endstill:%i startofs:%i endofs:%i depth:%i\n",\
|
||||
seq->name, seq->len, seq->start, seq->startstill, seq->endstill, seq->startofs, seq->endofs, seq->depth)
|
||||
|
||||
/* seq macro's for transform
|
||||
notice the difference between start/end and left/right.
|
||||
|
||||
left and right are the bounds at which the setuence is rendered,
|
||||
start and end are from the start and fixed length of the sequence.
|
||||
*/
|
||||
/*
|
||||
#define SEQ_GET_START(seq) (seq->start)
|
||||
#define SEQ_GET_END(seq) (seq->start+seq->len)
|
||||
|
||||
#define SEQ_GET_FINAL_LEFT(seq) ((seq->start - seq->startstill) + seq->startofs)
|
||||
#define SEQ_GET_FINAL_RIGHT(seq) (((seq->start+seq->len) + seq->endstill) - seq->endofs)
|
||||
|
||||
#define SEQ_SET_FINAL_LEFT(seq, val) \
|
||||
if (val < (seq)->start) { \
|
||||
(seq)->startstill = abs(val - (seq)->start); \
|
||||
(seq)->startofs = 0; \
|
||||
} else { \
|
||||
(seq)->startofs = abs(val - (seq)->start); \
|
||||
(seq)->startstill = 0; \
|
||||
}
|
||||
|
||||
#define SEQ_SET_FINAL_RIGHT(seq, val) \
|
||||
if (val > (seq)->start + (seq)->len) { \
|
||||
(seq)->endstill = abs(val - ((seq)->start + (seq)->len)); \
|
||||
(seq)->endofs = 0; \
|
||||
} else { \
|
||||
(seq)->endofs = abs(val - ((seq)->start + (seq)->len)); \
|
||||
(seq)->endstill = 0; \
|
||||
}
|
||||
*/
|
||||
|
||||
#endif
|
||||
|
||||
|
62
source/blender/include/BIF_radialcontrol.h
Normal file
62
source/blender/include/BIF_radialcontrol.h
Normal file
@ -0,0 +1,62 @@
|
||||
/*
|
||||
* $Id: multires.h 13015 2007-12-27 07:27:03Z nicholasbishop $
|
||||
*
|
||||
* ***** 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 by Nicholas Bishop
|
||||
* All rights reserved.
|
||||
*
|
||||
* The Original Code is: all of this file.
|
||||
*
|
||||
* Contributor(s): none yet.
|
||||
*
|
||||
* ***** END GPL LICENSE BLOCK *****
|
||||
*/
|
||||
|
||||
#ifndef RADIALCONTROL_H
|
||||
#define RADIALCONTROL_H
|
||||
|
||||
struct NumInput;
|
||||
|
||||
#define RADIALCONTROL_NONE 0
|
||||
#define RADIALCONTROL_SIZE 1
|
||||
#define RADIALCONTROL_STRENGTH 2
|
||||
#define RADIALCONTROL_ROTATION 3
|
||||
|
||||
typedef void (*RadialControlCallback)(const int, const int);
|
||||
|
||||
typedef struct RadialControl {
|
||||
int mode;
|
||||
short origloc[2];
|
||||
|
||||
unsigned int tex;
|
||||
|
||||
int new_value;
|
||||
int original_value;
|
||||
int max_value;
|
||||
RadialControlCallback callback;
|
||||
|
||||
struct NumInput *num;
|
||||
} RadialControl;
|
||||
|
||||
RadialControl *radialcontrol_start(const int mode, RadialControlCallback callback,
|
||||
const int original_value, const int max_value,
|
||||
const unsigned int tex);
|
||||
void radialcontrol_do_events(RadialControl *rc, const unsigned short event);
|
||||
void radialcontrol_draw(RadialControl *rc);
|
||||
|
||||
#endif
|
@ -37,9 +37,12 @@
|
||||
/* FILTERED ACTION DATA - TYPES */
|
||||
|
||||
/* types of keyframe data in ActListElem */
|
||||
#define ALE_NONE 0
|
||||
#define ALE_IPO 1
|
||||
#define ALE_ICU 2
|
||||
typedef enum ALE_KEYTYPE {
|
||||
ALE_NONE = 0,
|
||||
ALE_IPO,
|
||||
ALE_ICU,
|
||||
ALE_GROUP
|
||||
} ALE_KEYTYPE;
|
||||
|
||||
/* This struct defines a structure used for quick access */
|
||||
typedef struct bActListElem {
|
||||
@ -53,6 +56,8 @@ typedef struct bActListElem {
|
||||
void *key_data; /* motion data - ipo or ipo-curve */
|
||||
short datatype; /* type of motion data to expect */
|
||||
|
||||
struct bActionGroup *grp; /* action group that owns the channel */
|
||||
|
||||
void *owner; /* will either be an action channel or fake ipo-channel (for keys) */
|
||||
short ownertype; /* type of owner */
|
||||
} bActListElem;
|
||||
@ -61,17 +66,21 @@ typedef struct bActListElem {
|
||||
/* FILTER ACTION DATA - METHODS/TYPES */
|
||||
|
||||
/* filtering flags - under what circumstances should a channel be added */
|
||||
#define ACTFILTER_VISIBLE 0x001 /* should channels be visible */
|
||||
#define ACTFILTER_SEL 0x002 /* should channels be selected */
|
||||
#define ACTFILTER_FOREDIT 0x004 /* does editable status matter */
|
||||
#define ACTFILTER_CHANNELS 0x008 /* do we only care that it is a channel */
|
||||
#define ACTFILTER_IPOKEYS 0x010 /* only channels referencing ipo's */
|
||||
#define ACTFILTER_ONLYICU 0x020 /* only reference ipo-curves */
|
||||
#define ACTFILTER_FORDRAWING 0x040 /* make list for interface drawing */
|
||||
typedef enum ACTFILTER_FLAGS {
|
||||
ACTFILTER_VISIBLE = (1<<0), /* should channels be visible */
|
||||
ACTFILTER_SEL = (1<<1), /* should channels be selected */
|
||||
ACTFILTER_FOREDIT = (1<<2), /* does editable status matter */
|
||||
ACTFILTER_CHANNELS = (1<<3), /* do we only care that it is a channel */
|
||||
ACTFILTER_IPOKEYS = (1<<4), /* only channels referencing ipo's */
|
||||
ACTFILTER_ONLYICU = (1<<5), /* only reference ipo-curves */
|
||||
ACTFILTER_FORDRAWING = (1<<6) /* make list for interface drawing */
|
||||
} ACTFILTER_FLAGS;
|
||||
|
||||
/* Action Editor - Main Data types */
|
||||
#define ACTCONT_NONE 0
|
||||
#define ACTCONT_ACTION 1
|
||||
#define ACTCONT_SHAPEKEY 2
|
||||
typedef enum ACTCONT_TYPES {
|
||||
ACTCONT_NONE = 0,
|
||||
ACTCONT_ACTION,
|
||||
ACTCONT_SHAPEKEY
|
||||
} ACTCONT_TYPES;
|
||||
|
||||
#endif
|
||||
|
@ -315,7 +315,7 @@ void curvemap_buttons(struct uiBlock *block, struct CurveMapping *cumap, char la
|
||||
#define B_FS_PIC 1601
|
||||
#define B_FS_BACKBUF 1602
|
||||
|
||||
#define B_FS_FTYPE 1604
|
||||
#define B_FS_FTYPE 1604 /* FTYPE is no more */
|
||||
#define B_DORENDER 1605
|
||||
#define B_DOANIM 1606
|
||||
#define B_PLAYANIM 1607
|
||||
@ -332,7 +332,7 @@ void curvemap_buttons(struct uiBlock *block, struct CurveMapping *cumap, char la
|
||||
#define B_PR_PANO 1619
|
||||
#define B_PR_NTSC 1620
|
||||
|
||||
#define B_IS_FTYPE 1622
|
||||
#define B_IS_FTYPE 1622 /* FTYPE is nomore */
|
||||
#define B_IS_BACKBUF 1623
|
||||
#define B_PR_PC 1624
|
||||
|
||||
@ -531,6 +531,11 @@ void curvemap_buttons(struct uiBlock *block, struct CurveMapping *cumap, char la
|
||||
#define B_POSELIB_ALONE 2321
|
||||
#define B_POSELIB_DELETE 2322
|
||||
|
||||
|
||||
#define B_POSEGRP_RECALC 2330
|
||||
#define B_POSEGRP_ADD 2331
|
||||
#define B_POSEGRP_REMOVE 2332
|
||||
|
||||
/* *********************** */
|
||||
#define B_CAMBUTS 2500
|
||||
|
||||
@ -732,7 +737,7 @@ enum {
|
||||
|
||||
#define B_EFFECTSBUTS 3500
|
||||
|
||||
#define B_AUTOTIMEOFS 3403
|
||||
#define B_AUTOTIMEOFS 3403 /* see B_OFSTIMEOFS, B_RANDTIMEOFS also */
|
||||
#define B_FRAMEMAP 3404
|
||||
#define B_NEWEFFECT 3405
|
||||
#define B_PREVEFFECT 3406
|
||||
@ -767,6 +772,8 @@ enum {
|
||||
#define B_PART_EDITABLE 3435
|
||||
#define B_PART_REKEY 3436
|
||||
#define B_PART_ENABLE 3437
|
||||
#define B_OFSTIMEOFS 3438 /* see B_AUTOTIMEOFS too */
|
||||
#define B_RANDTIMEOFS 3439
|
||||
|
||||
#define B_MODIFIER_BUTS 3600
|
||||
|
||||
|
@ -265,18 +265,19 @@ typedef struct TransInfo {
|
||||
|
||||
/* transdata->flag */
|
||||
#define TD_SELECTED 1
|
||||
#define TD_NOACTION 2
|
||||
#define TD_USEQUAT 4
|
||||
#define TD_NOTCONNECTED 8
|
||||
#define TD_SINGLESIZE 16 /* used for scaling of MetaElem->rad */
|
||||
#define TD_ACTIVE (1 << 1)
|
||||
#define TD_NOACTION (1 << 2)
|
||||
#define TD_USEQUAT (1 << 3)
|
||||
#define TD_NOTCONNECTED (1 << 4)
|
||||
#define TD_SINGLESIZE (1 << 5) /* used for scaling of MetaElem->rad */
|
||||
#ifdef WITH_VERSE
|
||||
#define TD_VERSE_OBJECT 32
|
||||
#define TD_VERSE_VERT 64
|
||||
#define TD_VERSE_OBJECT (1 << 6)
|
||||
#define TD_VERSE_VERT (1 << 7)
|
||||
#endif
|
||||
#define TD_TIMEONLY 128
|
||||
#define TD_NOCENTER 256
|
||||
#define TD_NO_EXT 512 /* ext abused for particle key timing */
|
||||
#define TD_SKIP 1024 /* don't transform this data */
|
||||
#define TD_TIMEONLY (1 << 8)
|
||||
#define TD_NOCENTER (1 << 9)
|
||||
#define TD_NO_EXT (1 << 10) /* ext abused for particle key timing */
|
||||
#define TD_SKIP (1 << 11) /* don't transform this data */
|
||||
|
||||
/* transsnap->status */
|
||||
#define SNAP_ON 1
|
||||
@ -291,6 +292,7 @@ typedef struct TransInfo {
|
||||
#define SNAP_CLOSEST 0
|
||||
#define SNAP_CENTER 1
|
||||
#define SNAP_MEDIAN 2
|
||||
#define SNAP_ACTIVE 3
|
||||
|
||||
void checkFirstTime(void);
|
||||
|
||||
|
@ -37,6 +37,8 @@
|
||||
struct SpaceLink;
|
||||
struct Object;
|
||||
|
||||
/* -------------- Poses ----------------- */
|
||||
|
||||
/* PoseChannel stores the results of Actions (ipos) and transform information
|
||||
with respect to the restposition of Armature bones */
|
||||
typedef struct bPoseChannel {
|
||||
@ -49,7 +51,7 @@ typedef struct bPoseChannel {
|
||||
short ikflag; /* settings for IK bones */
|
||||
short selectflag; /* copy of bone flag, so you can work with library armatures */
|
||||
short protectflag; /* protect channels from being transformed */
|
||||
short customCol; /* index of custom color set to use (0=default - used for all old files) */
|
||||
short agrp_index; /* index of action-group this bone belongs to (0 = default/no group) */
|
||||
|
||||
int pathlen; /* for drawing paths, the amount of frames */
|
||||
int pathsf; /* for drawing paths, the start frame number */
|
||||
@ -96,13 +98,45 @@ typedef struct bPose {
|
||||
float ctime; /* local action time of this pose */
|
||||
float stride_offset[3]; /* applied to object */
|
||||
float cyclic_offset[3]; /* result of match and cycles, applied in where_is_pose() */
|
||||
|
||||
|
||||
ListBase agroups; /* list of bActionGroups */
|
||||
|
||||
int active_group; /* index of active group (starts from 1) */
|
||||
int pad;
|
||||
} bPose;
|
||||
|
||||
|
||||
/* ------------- Action ---------------- */
|
||||
|
||||
/* Action-Channel Group. These are stored as a list per-Action, and are only used to
|
||||
* group that Action's Action-Channels when displayed in the Action Editor.
|
||||
*
|
||||
* Even though all Action-Channels live in a big list per Action, each group they are in also
|
||||
* holds references to the achans within that list which belong to it. Care must be taken to
|
||||
* ensure that action-groups never end up being the sole 'owner' of a channel.
|
||||
*/
|
||||
typedef struct bActionGroup {
|
||||
struct bActionGroup *next, *prev;
|
||||
|
||||
int flag; /* settings for this action-group */
|
||||
int customCol; /* index of custom color set to use when used for bones (0=default - used for all old files) */
|
||||
char name[32]; /* name of the group */
|
||||
|
||||
ListBase channels; /* Note: this must not be touched by standard listbase functions */
|
||||
} bActionGroup;
|
||||
|
||||
/* Action Channels belong to Actions. They are linked with an IPO block, and can also own
|
||||
* Constraint Channels in certain situations.
|
||||
*
|
||||
* Action-Channels can only belong to one group at a time, but they still live the Action's
|
||||
* list of achans (to preserve backwards compatability, and also minimise the code
|
||||
* that would need to be recoded). Grouped achans are stored at the start of the list, according
|
||||
* to the position of the group in the list, and their position within the group.
|
||||
*/
|
||||
typedef struct bActionChannel {
|
||||
struct bActionChannel *next, *prev;
|
||||
bActionGroup *grp; /* Action Group this Action Channel belongs to */
|
||||
|
||||
struct Ipo *ipo; /* IPO block this action channel references */
|
||||
ListBase constraintChannels; /* Constraint Channels (when Action Channel represents an Object or Bone) */
|
||||
@ -119,12 +153,16 @@ typedef struct bAction {
|
||||
ID id;
|
||||
|
||||
ListBase chanbase; /* Action Channels in this Action */
|
||||
ListBase groups; /* Action Groups in the Action */
|
||||
ListBase markers; /* TimeMarkers local to this Action for labelling 'poses' */
|
||||
|
||||
int active_marker; /* Index of active-marker (first marker = 1) */
|
||||
int pad;
|
||||
} bAction;
|
||||
|
||||
|
||||
/* ------------- Action Editor --------------------- */
|
||||
|
||||
/* Action Editor Space. This is defined here instead of in DNA_space_types.h */
|
||||
typedef struct SpaceAction {
|
||||
struct SpaceLink *next, *prev;
|
||||
@ -143,6 +181,9 @@ typedef struct SpaceAction {
|
||||
float timeslide; /* for Time-Slide transform mode drawing - current frame? */
|
||||
} SpaceAction;
|
||||
|
||||
|
||||
/* -------------- Action Flags -------------- */
|
||||
|
||||
/* Action Channel flags */
|
||||
typedef enum ACHAN_FLAG {
|
||||
ACHAN_SELECTED = (1<<0),
|
||||
@ -155,6 +196,20 @@ typedef enum ACHAN_FLAG {
|
||||
ACHAN_MOVED = (1<<31),
|
||||
} ACHAN_FLAG;
|
||||
|
||||
|
||||
/* Action Group flags */
|
||||
typedef enum AGRP_FLAG {
|
||||
AGRP_SELECTED = (1<<0),
|
||||
AGRP_ACTIVE = (1<<1),
|
||||
AGRP_PROTECTED = (1<<2),
|
||||
AGRP_EXPANDED = (1<<3),
|
||||
|
||||
AGRP_TEMP = (1<<30),
|
||||
AGRP_MOVED = (1<<31)
|
||||
} AGRP_FLAG;
|
||||
|
||||
/* ------------ Action Editor Flags -------------- */
|
||||
|
||||
/* SpaceAction flag */
|
||||
typedef enum SACTION_FLAG {
|
||||
/* during transform */
|
||||
@ -179,6 +234,9 @@ typedef enum SACTSNAP_MODES {
|
||||
SACTSNAP_MARKER,
|
||||
} SACTSNAP_MODES;
|
||||
|
||||
|
||||
/* --------- Pose Flags --------------- */
|
||||
|
||||
/* Pose->flag */
|
||||
typedef enum POSE_FLAG {
|
||||
/* results in armature_rebuild_pose being called */
|
||||
|
@ -88,8 +88,10 @@ typedef struct Material {
|
||||
float strand_min, strand_widthfade;
|
||||
char strand_uvname[32];
|
||||
|
||||
float sbias; /* shadow bias */
|
||||
float sbias; /* shadow bias to prevent terminator prob */
|
||||
float lbias; /* factor to multiply lampbias with (0.0 = no mult) */
|
||||
float shad_alpha; /* in use for irregular shadowbuffer */
|
||||
float padf; /* free padding, take me! */
|
||||
|
||||
/* for buttons and render*/
|
||||
char rgbsel, texact, pr_type, use_nodes;
|
||||
|
@ -119,7 +119,7 @@ typedef struct Object {
|
||||
|
||||
int dupon, dupoff, dupsta, dupend;
|
||||
|
||||
float sf, ctime;
|
||||
float sf, ctime; /* sf is time-offset, ctime is the objects current time */
|
||||
|
||||
/* during realtime */
|
||||
|
||||
@ -297,6 +297,9 @@ extern Object workob;
|
||||
/* for stride edit */
|
||||
#define OB_DISABLE_PATH 1024
|
||||
|
||||
#define OB_OFFS_PARENTADD 2048
|
||||
|
||||
|
||||
/* (short) trackflag / upflag */
|
||||
#define OB_POSX 0
|
||||
#define OB_POSY 1
|
||||
|
@ -128,7 +128,7 @@ typedef struct ParticleSettings {
|
||||
|
||||
/* general values */
|
||||
float sta, end, lifetime, randlife;
|
||||
float timetweak, jitfac, keyed_time;
|
||||
float timetweak, jitfac, keyed_time, eff_hair, rt;
|
||||
int totpart, userjit, grid_res;
|
||||
|
||||
/* initial velocity factors */
|
||||
|
@ -153,6 +153,8 @@ typedef struct SceneRenderLayer {
|
||||
#define SCE_PASS_INDEXOB 2048
|
||||
#define SCE_PASS_UV 4096
|
||||
#define SCE_PASS_RADIO 8192
|
||||
#define SCE_PASS_MIST 16384
|
||||
|
||||
/* note, srl->passflag is treestore element 'nr' in outliner, short still... */
|
||||
|
||||
|
||||
@ -279,7 +281,7 @@ typedef struct RenderData {
|
||||
float YF_gamma, YF_exposure, YF_raybias, YF_AApixelsize, YF_AAthreshold;
|
||||
|
||||
/* paths to backbufffer, output, ftype */
|
||||
char backbuf[160], pic[160], ftype[160];
|
||||
char backbuf[160], pic[160];
|
||||
|
||||
/* stamps flags. */
|
||||
int stamp;
|
||||
@ -549,6 +551,9 @@ typedef struct Scene {
|
||||
#define R_THREADS 0x80000
|
||||
#define R_SPEED 0x100000
|
||||
#define R_SSS 0x200000
|
||||
#define R_NO_OVERWRITE 0x400000 /* skip existing files */
|
||||
#define R_TOUCH 0x800000 /* touch files before rendering */
|
||||
|
||||
|
||||
/* filtertype */
|
||||
#define R_FILTER_BOX 0
|
||||
@ -608,7 +613,7 @@ typedef struct Scene {
|
||||
#define R_TARGA 0
|
||||
#define R_IRIS 1
|
||||
#define R_HAMX 2
|
||||
#define R_FTYPE 3
|
||||
#define R_FTYPE 3 /* ftype is nomore */
|
||||
#define R_JPEG90 4
|
||||
#define R_MOVIE 5
|
||||
#define R_IRIZ 7
|
||||
@ -658,6 +663,7 @@ typedef struct Scene {
|
||||
#define SCE_SNAP_TARGET_CLOSEST 0
|
||||
#define SCE_SNAP_TARGET_CENTER 1
|
||||
#define SCE_SNAP_TARGET_MEDIAN 2
|
||||
#define SCE_SNAP_TARGET_ACTIVE 3
|
||||
|
||||
/* sce->selectmode */
|
||||
#define SCE_SELECT_VERTEX 1 /* for mesh */
|
||||
|
@ -421,7 +421,7 @@ typedef struct SpaceImaSel {
|
||||
|
||||
/* filesel types */
|
||||
#define FILE_UNIX 8
|
||||
#define FILE_BLENDER 8
|
||||
#define FILE_BLENDER 8 /* dont display relative paths */
|
||||
#define FILE_SPECIAL 9
|
||||
|
||||
#define FILE_LOADLIB 1
|
||||
|
@ -230,7 +230,7 @@ extern UserDef U; /* from usiblender.c !!!! */
|
||||
#define USER_CUSTOM_RANGE (1 << 17)
|
||||
#define USER_ADD_EDITMODE (1 << 18)
|
||||
#define USER_ADD_VIEWALIGNED (1 << 19)
|
||||
#define USER_ADD_VIEWALIGNED (1 << 19)
|
||||
#define USER_RELPATHS (1 << 20)
|
||||
|
||||
/* viewzom */
|
||||
#define USER_ZOOM_CONT 0
|
||||
|
@ -104,9 +104,8 @@ typedef struct World {
|
||||
float aodist, aodistfac, aoenergy, aobias;
|
||||
short aomode, aosamp, aomix, aocolor;
|
||||
float ao_adapt_thresh, ao_adapt_speed_fac;
|
||||
float pad2[2];
|
||||
short ao_samp_method;
|
||||
short pad1[3];
|
||||
float ao_approx_error, ao_approx_correction;
|
||||
short ao_samp_method, ao_gather_method, ao_approx_passes, pad1;
|
||||
|
||||
float *aosphere, *aotables;
|
||||
|
||||
@ -151,12 +150,17 @@ typedef struct World {
|
||||
/* aomode (use distances & random sampling modes) */
|
||||
#define WO_AODIST 1
|
||||
#define WO_AORNDSMP 2
|
||||
#define WO_AOCACHE 4
|
||||
|
||||
/* aocolor */
|
||||
#define WO_AOPLAIN 0
|
||||
#define WO_AOSKYCOL 1
|
||||
#define WO_AOSKYTEX 2
|
||||
|
||||
/* ao_gather_method */
|
||||
#define WO_AOGATHER_RAYTRACE 0
|
||||
#define WO_AOGATHER_APPROX 1
|
||||
|
||||
/* texco (also in DNA_material_types.h) */
|
||||
#define TEXCO_ANGMAP 64
|
||||
#define TEXCO_H_SPHEREMAP 256
|
||||
|
@ -48,6 +48,7 @@ static bNodeSocketType cmp_node_rlayers_out[]= {
|
||||
{ SOCK_RGBA, 0, "Refract", 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f},
|
||||
{ SOCK_RGBA, 0, "Radio", 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f},
|
||||
{ SOCK_VALUE, 0, "IndexOB", 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f},
|
||||
{ SOCK_VALUE, 0, "Mist", 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f},
|
||||
{ -1, 0, "" }
|
||||
};
|
||||
|
||||
@ -149,6 +150,8 @@ void outputs_multilayer_get(RenderData *rd, RenderLayer *rl, bNodeStack **out, I
|
||||
out[RRES_OUT_RADIO]->data= compbuf_multilayer_get(rd, rl, ima, iuser, SCE_PASS_RADIO);
|
||||
if(out[RRES_OUT_INDEXOB]->hasoutput)
|
||||
out[RRES_OUT_INDEXOB]->data= compbuf_multilayer_get(rd, rl, ima, iuser, SCE_PASS_INDEXOB);
|
||||
if(out[RRES_OUT_MIST]->hasoutput)
|
||||
out[RRES_OUT_MIST]->data= compbuf_multilayer_get(rd, rl, ima, iuser, SCE_PASS_MIST);
|
||||
|
||||
};
|
||||
|
||||
@ -236,7 +239,7 @@ static CompBuf *compbuf_from_pass(RenderData *rd, RenderLayer *rl, int rectx, in
|
||||
CompBuf *buf;
|
||||
int buftype= CB_VEC3;
|
||||
|
||||
if(ELEM(passcode, SCE_PASS_Z, SCE_PASS_INDEXOB))
|
||||
if(ELEM3(passcode, SCE_PASS_Z, SCE_PASS_INDEXOB, SCE_PASS_MIST))
|
||||
buftype= CB_VAL;
|
||||
else if(passcode==SCE_PASS_VECTOR)
|
||||
buftype= CB_VEC4;
|
||||
@ -282,7 +285,9 @@ void node_composit_rlayers_out(RenderData *rd, RenderLayer *rl, bNodeStack **out
|
||||
if(out[RRES_OUT_RADIO]->hasoutput)
|
||||
out[RRES_OUT_RADIO]->data= compbuf_from_pass(rd, rl, rectx, recty, SCE_PASS_RADIO);
|
||||
if(out[RRES_OUT_INDEXOB]->hasoutput)
|
||||
out[RRES_OUT_INDEXOB]->data= compbuf_from_pass(rd, rl, rectx, recty, SCE_PASS_INDEXOB);
|
||||
out[RRES_OUT_INDEXOB]->data= compbuf_from_pass(rd, rl, rectx, recty, SCE_PASS_INDEXOB);
|
||||
if(out[RRES_OUT_MIST]->hasoutput)
|
||||
out[RRES_OUT_MIST]->data= compbuf_from_pass(rd, rl, rectx, recty, SCE_PASS_MIST);
|
||||
|
||||
};
|
||||
|
||||
|
@ -1330,7 +1330,7 @@ static PyObject *Effect_getParticlesLoc( BPy_Effect * self )
|
||||
|
||||
/* if object is in motion */
|
||||
if( ob->ipoflag & OB_OFFS_PARTICLE )
|
||||
p_time= ob->sf;
|
||||
p_time= give_timeoffset(ob);
|
||||
else
|
||||
p_time= 0.0;
|
||||
|
||||
|
@ -697,7 +697,7 @@ static PyObject *GroupObSeq_unlink( BPy_GroupObSeq * self, BPy_Object *value )
|
||||
|
||||
rem_from_group(self->bpygroup->group, blen_ob);
|
||||
|
||||
if(find_group(blen_ob)==NULL) {
|
||||
if(find_group(blen_ob, NULL)==NULL) {
|
||||
blen_ob->flag &= ~OB_FROMGROUP;
|
||||
|
||||
base= object_in_scene(blen_ob, G.scene);
|
||||
|
@ -47,7 +47,7 @@ The valid IpoCurve constants are:
|
||||
4. Camera Ipo: CA_LENS, CA_CLSTA, CA_CLEND, CA_APERT, CA_FDIST
|
||||
5. Object Ipo: OB_LOCX, OB_LOCY, OB_LOCZ, OB_DLOCX, OB_DLOCY, OB_DLOCZ,
|
||||
OB_ROTX, OB_ROTY, OB_ROTZ, OB_DROTX, OB_DROTY, OB_DROTZ,
|
||||
OB_SIZEX, OB_SIZEY, OB_SIZEZ, OB_DSIZEX, OB_DSIZEY, OB_DSIZEZ,
|
||||
OB_SCALEX, OB_SCALEY, OB_SCALEZ, OB_DSCALEX, OB_DSCALEY, OB_DSCALEZ,
|
||||
OB_LAYER, OB_TIME, OB_COLR, OB_COLG, OB_COLB, OB_COLA,
|
||||
OB_FSTRENG, OB_FFALL, OB_RDAMP, OB_DAMPING, OB_PERM
|
||||
6. Curve Ipo: CU_SPEED
|
||||
|
@ -246,10 +246,12 @@ class RenderData:
|
||||
@type extensions: boolean
|
||||
@ivar compositor: 'Do Compositor' enabled.
|
||||
@type compositor: boolean
|
||||
@ivar freeImages: 'Do Compositor' enabled.
|
||||
@ivar freeImages: Texture images are freed after render.
|
||||
@type freeImages: boolean
|
||||
@ivar singleLayer: Only render the active layer.
|
||||
@type singleLayer: boolean
|
||||
@ivar activeLayer: The active render layer. Must be in range[0,num render layers-1]
|
||||
@type activeLayer: int
|
||||
@ivar saveBuffers: Save render buffers to disk while rendering, saves memory.
|
||||
@type saveBuffers: boolean
|
||||
@ivar compositeFree: Free nodes that are not used while composite.
|
||||
|
@ -116,8 +116,6 @@ static PyObject *RenderData_SetRenderPath( BPy_RenderData *self,
|
||||
PyObject *args );
|
||||
static PyObject *RenderData_SetBackbufPath( BPy_RenderData *self,
|
||||
PyObject *args );
|
||||
static PyObject *RenderData_SetFtypePath( BPy_RenderData *self,
|
||||
PyObject *args );
|
||||
static PyObject *RenderData_SetOversamplingLevel( BPy_RenderData * self,
|
||||
PyObject * args );
|
||||
static PyObject *RenderData_SetRenderWinSize( BPy_RenderData * self,
|
||||
@ -982,7 +980,6 @@ static int RenderData_setImageType( BPy_RenderData *self, PyObject *value )
|
||||
case R_HAMX :
|
||||
case R_IRIS :
|
||||
case R_IRIZ :
|
||||
case R_FTYPE :
|
||||
case R_TIFF :
|
||||
case R_CINEON :
|
||||
case R_DPX :
|
||||
@ -2220,29 +2217,6 @@ static int RenderData_setBackbufPath( BPy_RenderData *self, PyObject *value )
|
||||
return 0;
|
||||
}
|
||||
|
||||
PyObject *RenderData_getFtypePath( BPy_RenderData * self )
|
||||
{
|
||||
return PyString_FromString( self->renderContext->ftype );
|
||||
}
|
||||
|
||||
static int RenderData_setFtypePath( BPy_RenderData *self, PyObject *value )
|
||||
{
|
||||
char *name;
|
||||
|
||||
name = PyString_AsString( value );
|
||||
if( !name )
|
||||
return EXPP_ReturnIntError( PyExc_TypeError, "expected a string" );
|
||||
|
||||
if( strlen( name ) >= sizeof(self->renderContext->ftype) )
|
||||
return EXPP_ReturnIntError( PyExc_ValueError,
|
||||
"ftype path is too long" );
|
||||
|
||||
strcpy( self->renderContext->ftype, name );
|
||||
EXPP_allqueue( REDRAWBUTSSCENE, 0 );
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
PyObject *RenderData_getRenderWinSize( BPy_RenderData * self )
|
||||
{
|
||||
return PyInt_FromLong( (long) self->renderContext->size );
|
||||
@ -2357,6 +2331,32 @@ static int RenderData_setThreads( BPy_RenderData *self, PyObject *value )
|
||||
return 0;
|
||||
}
|
||||
|
||||
PyObject *RenderData_getActiveLayer( BPy_RenderData * self )
|
||||
{
|
||||
return PyInt_FromLong( (long) self->renderContext->actlay );
|
||||
}
|
||||
|
||||
static int RenderData_setActiveLayer( BPy_RenderData *self, PyObject *value )
|
||||
{
|
||||
int layer;
|
||||
short nr;
|
||||
SceneRenderLayer *srl;
|
||||
|
||||
if( !PyInt_Check( value ) )
|
||||
return EXPP_ReturnIntError( PyExc_TypeError, "active layer must be an int" );
|
||||
|
||||
layer = PyInt_AsLong( value );
|
||||
for(nr=0, srl= self->renderContext->layers.first; srl; srl= srl->next, nr++) {
|
||||
}
|
||||
if(layer >= nr)
|
||||
return EXPP_ReturnIntError( PyExc_ValueError, "value larger than number of render layers" );
|
||||
|
||||
self->renderContext->actlay = layer;
|
||||
EXPP_allqueue(REDRAWBUTSSCENE, 0);
|
||||
EXPP_allqueue(REDRAWNODE, 0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/***************************************************************************/
|
||||
/* BPy_RenderData attribute def */
|
||||
/***************************************************************************/
|
||||
@ -2481,10 +2481,6 @@ static PyGetSetDef BPy_RenderData_getseters[] = {
|
||||
(getter)RenderData_getBackbufPath, (setter)RenderData_setBackbufPath,
|
||||
"Path to a background image (setting loads image)",
|
||||
NULL},
|
||||
{"ftypePath",
|
||||
(getter)RenderData_getFtypePath, (setter)RenderData_setFtypePath,
|
||||
"The path to Ftype file",
|
||||
NULL},
|
||||
{"edgeColor",
|
||||
(getter)RenderData_getEdgeColor, (setter)RenderData_setEdgeColor,
|
||||
"RGB color triplet for edges in Toon shading",
|
||||
@ -2600,6 +2596,11 @@ static PyGetSetDef BPy_RenderData_getseters[] = {
|
||||
"Scene link 'set' value",
|
||||
NULL},
|
||||
|
||||
{"activeLayer",
|
||||
(getter)RenderData_getActiveLayer, (setter)RenderData_setActiveLayer,
|
||||
"Active rendering layer",
|
||||
NULL},
|
||||
|
||||
{"yafrayGIMethod",
|
||||
(getter)RenderData_getYafrayGIMethod, (setter)RenderData_setYafrayGIMethod,
|
||||
"Global illumination method",
|
||||
@ -2699,10 +2700,6 @@ static PyMethodDef BPy_RenderData_methods[] = {
|
||||
{"enableBackbuf", ( PyCFunction ) RenderData_EnableBackbuf,
|
||||
METH_VARARGS,
|
||||
"(bool) - enable/disable the backbuf image"},
|
||||
{"setFtypePath", ( PyCFunction ) RenderData_SetFtypePath, METH_VARARGS,
|
||||
"(string) - get/set the path to output the Ftype file"},
|
||||
{"getFtypePath", ( PyCFunction ) RenderData_getFtypePath, METH_NOARGS,
|
||||
"() - get the path to Ftype file"},
|
||||
{"enableExtensions", ( PyCFunction ) RenderData_EnableExtensions,
|
||||
METH_VARARGS,
|
||||
"(bool) - enable/disable windows extensions for output files"},
|
||||
@ -3109,7 +3106,6 @@ PyObject *Render_Init( void )
|
||||
PyModule_AddIntConstant( submodule, "HAMX", R_HAMX );
|
||||
PyModule_AddIntConstant( submodule, "IRIS", R_IRIS );
|
||||
PyModule_AddIntConstant( submodule, "IRISZ", R_IRIZ );
|
||||
PyModule_AddIntConstant( submodule, "FTYPE", R_FTYPE );
|
||||
PyModule_AddIntConstant( submodule, "PAL", B_PR_PAL );
|
||||
PyModule_AddIntConstant( submodule, "NTSC", B_PR_NTSC );
|
||||
PyModule_AddIntConstant( submodule, "DEFAULT", B_PR_PRESET );
|
||||
@ -3173,13 +3169,6 @@ static PyObject *RenderData_SetBackbufPath( BPy_RenderData *self,
|
||||
(setter)RenderData_setBackbufPath );
|
||||
}
|
||||
|
||||
static PyObject *RenderData_SetFtypePath( BPy_RenderData *self,
|
||||
PyObject *args )
|
||||
{
|
||||
return EXPP_setterWrapperTuple( (void *)self, args,
|
||||
(setter)RenderData_setFtypePath );
|
||||
}
|
||||
|
||||
static PyObject *RenderData_SetOversamplingLevel( BPy_RenderData * self,
|
||||
PyObject * args )
|
||||
{
|
||||
|
@ -47,7 +47,7 @@ typedef struct ShadeResult
|
||||
{
|
||||
float combined[4];
|
||||
float col[4];
|
||||
float alpha;
|
||||
float alpha, mist;
|
||||
float diff[3]; /* no ramps, shadow, etc */
|
||||
float spec[3];
|
||||
float shad[3];
|
||||
@ -64,6 +64,7 @@ struct ShadeInputCopy {
|
||||
|
||||
struct Material *mat;
|
||||
struct VlakRen *vlr;
|
||||
struct StrandRen *strand;
|
||||
struct ObjectInstanceRen *obi;
|
||||
struct ObjectRen *obr;
|
||||
int facenr;
|
||||
@ -96,6 +97,7 @@ typedef struct ShadeInput
|
||||
|
||||
struct Material *mat;
|
||||
struct VlakRen *vlr;
|
||||
struct StrandRen *strand;
|
||||
struct ObjectInstanceRen *obi;
|
||||
struct ObjectRen *obr;
|
||||
int facenr;
|
||||
@ -132,7 +134,7 @@ typedef struct ShadeInput
|
||||
/* texture coordinates */
|
||||
float lo[3], gl[3], ref[3], orn[3], winco[3], sticky[3], vcol[4], rad[3];
|
||||
float refcol[4], displace[3];
|
||||
float strand, tang[3], stress, winspeed[4];
|
||||
float strandco, tang[3], stress, winspeed[4];
|
||||
float duplilo[3], dupliuv[3];
|
||||
|
||||
ShadeInputUV uv[8]; /* 8 = MAX_MTFACE */
|
||||
|
51
source/blender/render/intern/include/occlusion.h
Normal file
51
source/blender/render/intern/include/occlusion.h
Normal file
@ -0,0 +1,51 @@
|
||||
/*
|
||||
* $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): Brecht Van Lommel.
|
||||
*
|
||||
* ***** END GPL LICENSE BLOCK *****
|
||||
*/
|
||||
|
||||
#ifndef OCCLUSION_H
|
||||
#define OCCLUSION_H
|
||||
|
||||
struct Render;
|
||||
struct ShadeInput;
|
||||
struct ShadeResult;
|
||||
struct RenderPart;
|
||||
struct ShadeSample;
|
||||
struct DerivedMesh;
|
||||
struct ObjectRen;
|
||||
|
||||
void make_occ_tree(struct Render *re);
|
||||
void free_occ(struct Render *re);
|
||||
void sample_occ(struct Render *re, struct ShadeInput *shi);
|
||||
|
||||
void cache_occ_samples(struct Render *re, struct RenderPart *pa, struct ShadeSample *ssamp);
|
||||
void free_occ_samples(struct Render *re, struct RenderPart *pa);
|
||||
|
||||
void *cache_occ_mesh(struct Render *re, struct ObjectRen *obr, struct DerivedMesh *dm, float mat[][4]);
|
||||
|
||||
#endif
|
||||
|
@ -159,6 +159,10 @@ struct Render
|
||||
/* octree tables and variables for raytrace */
|
||||
void *raytree;
|
||||
|
||||
/* occlusion tree */
|
||||
void *occlusiontree;
|
||||
ListBase occlusionmesh;
|
||||
|
||||
/* use this instead of R.r.cfra */
|
||||
float cfra;
|
||||
|
||||
@ -174,7 +178,6 @@ struct Render
|
||||
|
||||
struct ObjectInstanceRen *objectinstance;
|
||||
ListBase instancetable;
|
||||
struct GHash *objecthash;
|
||||
int totinstance;
|
||||
|
||||
struct Image *backbuf, *bakebuf;
|
||||
@ -342,6 +345,7 @@ typedef struct StrandBuffer {
|
||||
|
||||
struct ObjectRen *obr;
|
||||
struct Material *ma;
|
||||
void *occlusionmesh;
|
||||
unsigned int lay;
|
||||
int overrideuv;
|
||||
int flag, maxdepth;
|
||||
|
@ -70,6 +70,7 @@ typedef struct StrandTableNode {
|
||||
float *winspeed;
|
||||
float *surfnor;
|
||||
float *simplify;
|
||||
int *face;
|
||||
struct MCol *mcol;
|
||||
float *uv;
|
||||
int totuv, totmcol;
|
||||
@ -114,6 +115,7 @@ float *RE_strandren_get_surfnor(struct ObjectRen *obr, struct StrandRen *strand,
|
||||
float *RE_strandren_get_uv(struct ObjectRen *obr, struct StrandRen *strand, int n, char **name, int verify);
|
||||
struct MCol *RE_strandren_get_mcol(struct ObjectRen *obr, struct StrandRen *strand, int n, char **name, int verify);
|
||||
float *RE_strandren_get_simplify(struct ObjectRen *obr, struct StrandRen *strand, int verify);
|
||||
int *RE_strandren_get_face(struct ObjectRen *obr, struct StrandRen *strand, int verify);
|
||||
float *RE_strandren_get_winspeed(struct ObjectInstanceRen *obi, struct StrandRen *strand, int verify);
|
||||
|
||||
struct VertRen *RE_vertren_copy(struct ObjectRen *obr, struct VertRen *ver);
|
||||
|
@ -57,7 +57,7 @@ void threaded_makeshadowbufs(struct Render *re);
|
||||
* @param inp The inproduct between viewvector and ?
|
||||
*
|
||||
*/
|
||||
float testshadowbuf(struct ShadBuf *shb, float *rco, float *dxco, float *dyco, float inp);
|
||||
float testshadowbuf(struct ShadBuf *shb, float *rco, float *dxco, float *dyco, float inp, float mat_bias);
|
||||
|
||||
/**
|
||||
* Determines the shadow factor for lamp <lar>, between <p1>
|
||||
|
@ -69,6 +69,7 @@ void shade_input_initialize(struct ShadeInput *shi, struct RenderPart *pa, struc
|
||||
|
||||
void shade_sample_initialize(struct ShadeSample *ssamp, struct RenderPart *pa, struct RenderLayer *rl);
|
||||
void shade_samples_do_AO(struct ShadeSample *ssamp);
|
||||
void shade_samples_fill_with_ps(struct ShadeSample *ssamp, struct PixStr *ps, int x, int y);
|
||||
int shade_samples(struct ShadeSample *ssamp, struct PixStr *ps, int x, int y);
|
||||
|
||||
void vlr_set_uv_indices(struct VlakRen *vlr, int *i1, int *i2, int *i3);
|
||||
|
@ -100,6 +100,7 @@
|
||||
|
||||
#include "envmap.h"
|
||||
#include "multires.h"
|
||||
#include "occlusion.h"
|
||||
#include "render_types.h"
|
||||
#include "rendercore.h"
|
||||
#include "renderdatabase.h"
|
||||
@ -1497,7 +1498,7 @@ static int render_new_particle_system(Render *re, ObjectRen *obr, ParticleSystem
|
||||
float *orco=0,*surfnor=0,*uvco=0, strandlen=0.0f, curlen=0.0f;
|
||||
float hasize, pa_size, pa_time, r_tilt, cfra=bsystem_time(ob,(float)CFRA,0.0);
|
||||
float adapt_angle=0.0, adapt_pix=0.0, random, simplify[2];
|
||||
int i, a, k, max_k=0, totpart, totuv=0, override_uv=-1, dosimplify = 0;
|
||||
int i, a, k, max_k=0, totpart, totuv=0, override_uv=-1, dosimplify = 0, doapproxao = 0;
|
||||
int path_possible=0, keys_possible=0, baked_keys=0, totchild=psys->totchild;
|
||||
int seed, path_nbr=0, path=0, orco1=0, adapt=0, uv[3]={0,0,0}, num;
|
||||
char **uv_name=0;
|
||||
@ -1656,6 +1657,10 @@ static int render_new_particle_system(Render *re, ObjectRen *obr, ParticleSystem
|
||||
strandbuf->flag |= R_STRAND_B_UNITS;
|
||||
|
||||
svert= strandbuf->vert;
|
||||
|
||||
if((re->wrld.mode & WO_AMB_OCC) && (re->wrld.ao_gather_method == WO_AOGATHER_APPROX))
|
||||
if(ma->amb != 0.0f)
|
||||
doapproxao= 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1704,15 +1709,15 @@ static int render_new_particle_system(Render *re, ObjectRen *obr, ParticleSystem
|
||||
else
|
||||
psys_particle_on_emitter(ob, psmd,part->from,pa->num,pa->num_dmcache,pa->fuv,pa->foffset,co,nor,0,0,orco,0);
|
||||
|
||||
num= pa->num_dmcache;
|
||||
|
||||
if(num == DMCACHE_NOTFOUND)
|
||||
if(pa->num < psmd->dm->getNumFaces(psmd->dm))
|
||||
num= pa->num;
|
||||
|
||||
if(uvco && ELEM(part->from,PART_FROM_FACE,PART_FROM_VOLUME)){
|
||||
layer=psmd->dm->faceData.layers + CustomData_get_layer_index(&psmd->dm->faceData,CD_MFACE);
|
||||
|
||||
num= pa->num_dmcache;
|
||||
|
||||
if(num == DMCACHE_NOTFOUND)
|
||||
if(pa->num < psmd->dm->getNumFaces(psmd->dm))
|
||||
num= pa->num;
|
||||
|
||||
for(i=0; i<totuv; i++){
|
||||
if(num != DMCACHE_NOTFOUND) {
|
||||
MFace *mface=psmd->dm->getFaceData(psmd->dm,num,CD_MFACE);
|
||||
@ -1761,6 +1766,8 @@ static int render_new_particle_system(Render *re, ObjectRen *obr, ParticleSystem
|
||||
|
||||
r_tilt=2.0f*cpa->rand[2];
|
||||
|
||||
num= cpa->num;
|
||||
|
||||
/* get orco */
|
||||
psys_particle_on_emitter(ob, psmd,
|
||||
(part->childtype == PART_CHILD_FACES)? PART_FROM_FACE: PART_FROM_PARTICLE,
|
||||
@ -1831,6 +1838,11 @@ static int render_new_particle_system(Render *re, ObjectRen *obr, ParticleSystem
|
||||
VECCOPY(snor, surfnor);
|
||||
}
|
||||
|
||||
if(doapproxao && num >= 0) {
|
||||
int *facenum= RE_strandren_get_face(obr, strand, 1);
|
||||
*facenum= num;
|
||||
}
|
||||
|
||||
if(uvco){
|
||||
for(i=0; i<totuv; i++){
|
||||
if(i != override_uv) {
|
||||
@ -1930,6 +1942,9 @@ static int render_new_particle_system(Render *re, ObjectRen *obr, ParticleSystem
|
||||
break;
|
||||
}
|
||||
|
||||
if(doapproxao)
|
||||
strandbuf->occlusionmesh= cache_occ_mesh(re, obr, psmd->dm, mat);
|
||||
|
||||
/* 4. clean up */
|
||||
if(ma) do_mat_ipo(ma);
|
||||
|
||||
@ -3636,13 +3651,18 @@ void init_render_world(Render *re)
|
||||
if(re->osa)
|
||||
while(re->wrld.aosamp*re->wrld.aosamp < re->osa)
|
||||
re->wrld.aosamp++;
|
||||
if(!(re->r.mode & R_RAYTRACE))
|
||||
if(!(re->r.mode & R_RAYTRACE) && (re->wrld.ao_gather_method == WO_AOGATHER_RAYTRACE))
|
||||
re->wrld.mode &= ~WO_AMB_OCC;
|
||||
}
|
||||
else {
|
||||
memset(&re->wrld, 0, sizeof(World));
|
||||
re->wrld.exp= 0.0;
|
||||
re->wrld.range= 1.0;
|
||||
re->wrld.exp= 0.0f;
|
||||
re->wrld.range= 1.0f;
|
||||
|
||||
/* for mist pass */
|
||||
re->wrld.miststa= re->clipsta;
|
||||
re->wrld.mistdist= re->clipend-re->clipsta;
|
||||
re->wrld.misi= 1.0f;
|
||||
}
|
||||
|
||||
re->wrld.linfac= 1.0 + pow((2.0*re->wrld.exp + 0.5), -10);
|
||||
@ -3870,6 +3890,29 @@ static int render_object_type(int type)
|
||||
return ELEM5(type, OB_FONT, OB_CURVE, OB_SURF, OB_MESH, OB_MBALL);
|
||||
}
|
||||
|
||||
static void find_dupli_instances(Render *re, ObjectRen *obr)
|
||||
{
|
||||
ObjectInstanceRen *obi;
|
||||
float imat[4][4], obmat[4][4], obimat[4][4], nmat[3][3];
|
||||
|
||||
Mat4MulMat4(obmat, obr->ob->obmat, re->viewmat);
|
||||
Mat4Invert(imat, obmat);
|
||||
|
||||
for(obi=re->instancetable.last; obi; obi=obi->prev) {
|
||||
if(!obi->obr && obi->ob == obr->ob && obi->psysindex == obr->psysindex) {
|
||||
obi->obr= obr;
|
||||
|
||||
/* compute difference between object matrix and
|
||||
* object matrix with dupli transform, in viewspace */
|
||||
Mat4CpyMat4(obimat, obi->mat);
|
||||
Mat4MulMat4(obi->mat, imat, obimat);
|
||||
|
||||
Mat3CpyMat4(nmat, obi->mat);
|
||||
Mat3Inv(obi->imat, nmat);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void init_render_object_data(Render *re, ObjectRen *obr, int only_verts)
|
||||
{
|
||||
Object *ob= obr->ob;
|
||||
@ -3937,6 +3980,8 @@ static void add_render_object(Render *re, Object *ob, Object *par, int index, in
|
||||
/* only add instance for objects that have not been used for dupli */
|
||||
if(!(ob->transflag & OB_RENDER_DUPLI))
|
||||
RE_addRenderInstance(re, obr, ob, par, index, 0, NULL);
|
||||
else
|
||||
find_dupli_instances(re, obr);
|
||||
}
|
||||
|
||||
/* and one render object per particle system */
|
||||
@ -3950,6 +3995,8 @@ static void add_render_object(Render *re, Object *ob, Object *par, int index, in
|
||||
/* only add instance for objects that have not been used for dupli */
|
||||
if(!(ob->transflag & OB_RENDER_DUPLI))
|
||||
RE_addRenderInstance(re, obr, ob, par, index, psysindex, NULL);
|
||||
else
|
||||
find_dupli_instances(re, obr);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -4042,6 +4089,7 @@ void RE_Database_Free(Render *re)
|
||||
if(re->r.mode & R_RAYTRACE) freeraytree(re);
|
||||
|
||||
free_sss(re);
|
||||
free_occ(re);
|
||||
|
||||
re->totvlak=re->totvert=re->totstrand=re->totlamp=re->tothalo= 0;
|
||||
re->i.convertdone= 0;
|
||||
@ -4070,9 +4118,8 @@ static int allow_render_object(Object *ob, int nolamps, int onlyselected, Object
|
||||
for(psys=ob->particlesystem.first; psys; psys=psys->next){
|
||||
part=psys->part;
|
||||
|
||||
if((part->draw_as==PART_DRAW_OB && part->dup_ob) || (part->draw_as==PART_DRAW_GR && part->dup_group))
|
||||
if(part->draw & PART_DRAW_EMITTER)
|
||||
allow= 1;
|
||||
if(part->draw & PART_DRAW_EMITTER)
|
||||
allow= 1;
|
||||
}
|
||||
}
|
||||
|
||||
@ -4105,22 +4152,30 @@ static void dupli_render_particle_set(Render *re, Object *ob, int level, int ena
|
||||
Group *group;
|
||||
GroupObject *go;
|
||||
ParticleSystem *psys;
|
||||
DerivedMesh *dm;
|
||||
|
||||
if(level >= MAX_DUPLI_RECUR)
|
||||
return;
|
||||
|
||||
if(ob->transflag & OB_DUPLIPARTS) {
|
||||
DerivedMesh *dm;
|
||||
for(psys=ob->particlesystem.first; psys; psys=psys->next) {
|
||||
if(ELEM(psys->part->draw_as, PART_DRAW_OB, PART_DRAW_GR)) {
|
||||
if(enable)
|
||||
psys_render_set(ob, psys, re->viewmat, re->winmat, re->winx, re->winy);
|
||||
else
|
||||
psys_render_restore(ob, psys);
|
||||
}
|
||||
}
|
||||
|
||||
for(psys=ob->particlesystem.first; psys; psys=psys->next)
|
||||
if(enable)
|
||||
psys_render_set(ob, psys, re->viewmat, re->winmat, re->winx, re->winy);
|
||||
else
|
||||
psys_render_restore(ob, psys);
|
||||
|
||||
if(enable) {
|
||||
dm = mesh_create_derived_render(ob, CD_MASK_BAREMESH|CD_MASK_MTFACE|CD_MASK_MCOL);
|
||||
if(level == 0 && enable) {
|
||||
/* this is to make sure we get render level duplis in groups:
|
||||
* the derivedmesh must be created before init_render_mesh,
|
||||
* since object_duplilist does dupliparticles before that */
|
||||
dm = mesh_create_derived_render(ob, CD_MASK_BAREMESH|CD_MASK_MTFACE|CD_MASK_MCOL);
|
||||
dm->release(dm);
|
||||
|
||||
for(psys=ob->particlesystem.first; psys; psys=psys->next)
|
||||
psys_get_modifier(ob, psys)->flag &= ~eParticleSystemFlag_psys_updated;
|
||||
}
|
||||
}
|
||||
|
||||
@ -4137,7 +4192,7 @@ static void database_init_objects(Render *re, unsigned int lay, int nolamps, int
|
||||
Object *ob;
|
||||
ObjectInstanceRen *obi;
|
||||
Scene *sce;
|
||||
float mat[4][4], obmat[4][4];
|
||||
float mat[4][4];
|
||||
|
||||
for(SETLOOPER(re->scene, base)) {
|
||||
ob= base->object;
|
||||
@ -4173,11 +4228,10 @@ static void database_init_objects(Render *re, unsigned int lay, int nolamps, int
|
||||
for(dob= lb->first; dob; dob= dob->next) {
|
||||
Object *obd= dob->ob;
|
||||
|
||||
Mat4CpyMat4(obmat, obd->obmat);
|
||||
Mat4CpyMat4(obd->obmat, dob->mat);
|
||||
|
||||
/* group duplis need to set ob matrices correct, for deform. so no_draw is part handled */
|
||||
if(dob->no_draw)
|
||||
if(!(obd->transflag & OB_RENDER_DUPLI) && dob->no_draw)
|
||||
continue;
|
||||
|
||||
if(obd->restrictflag & OB_RESTRICT_RENDER)
|
||||
@ -4192,13 +4246,9 @@ static void database_init_objects(Render *re, unsigned int lay, int nolamps, int
|
||||
if(allow_render_dupli_instance(re, dob, obd)) {
|
||||
ParticleSystem *psys;
|
||||
int psysindex;
|
||||
float imat[4][4], mat[4][4];
|
||||
|
||||
/* compute difference between object matrix and
|
||||
* object matrix with dupli transform, in viewspace */
|
||||
Mat4Invert(imat, obmat);
|
||||
MTC_Mat4MulSerie(mat, re->viewmat, dob->mat, imat, re->viewinv, 0, 0, 0, 0);
|
||||
float mat[4][4];
|
||||
|
||||
Mat4MulMat4(mat, dob->mat, re->viewmat);
|
||||
obi= RE_addRenderInstance(re, NULL, obd, ob, dob->index, 0, mat);
|
||||
VECCOPY(obi->dupliorco, dob->orco);
|
||||
obi->dupliuv[0]= dob->uv[0];
|
||||
@ -4214,8 +4264,6 @@ static void database_init_objects(Render *re, unsigned int lay, int nolamps, int
|
||||
|
||||
obd->flag |= OB_DONE;
|
||||
obd->transflag |= OB_RENDER_DUPLI;
|
||||
|
||||
Mat4CpyMat4(obd->obmat, obmat);
|
||||
}
|
||||
else
|
||||
init_render_object(re, obd, ob, dob->index, only_verts);
|
||||
@ -4277,7 +4325,7 @@ void RE_Database_FromScene(Render *re, Scene *scene, int use_camera_view)
|
||||
}
|
||||
|
||||
init_render_world(re); /* do first, because of ambient. also requires re->osa set correct */
|
||||
if(re->wrld.mode & WO_AMB_OCC) {
|
||||
if((re->r.mode & R_RAYTRACE) && (re->wrld.mode & WO_AMB_OCC)) {
|
||||
if (re->wrld.ao_samp_method == WO_AOSAMP_HAMMERSLEY)
|
||||
init_render_hammersley(re);
|
||||
else if (re->wrld.ao_samp_method == WO_AOSAMP_CONSTANT)
|
||||
@ -4343,9 +4391,15 @@ void RE_Database_FromScene(Render *re, Scene *scene, int use_camera_view)
|
||||
if(!re->test_break())
|
||||
project_renderdata(re, projectverto, re->r.mode & R_PANORAMA, 0, 1);
|
||||
|
||||
/* Occlusion */
|
||||
if((re->wrld.mode & WO_AMB_OCC) && !re->test_break())
|
||||
if(re->wrld.ao_gather_method == WO_AOGATHER_APPROX)
|
||||
if(re->r.renderer==R_INTERN)
|
||||
make_occ_tree(re);
|
||||
|
||||
/* SSS */
|
||||
if((re->r.mode & R_SSS) && !re->test_break())
|
||||
if (re->r.renderer==R_INTERN)
|
||||
if(re->r.renderer==R_INTERN)
|
||||
make_sss_tree(re);
|
||||
}
|
||||
|
||||
@ -4825,7 +4879,7 @@ void RE_Database_Baking(Render *re, Scene *scene, int type, Object *actob)
|
||||
}
|
||||
|
||||
init_render_world(re); /* do first, because of ambient. also requires re->osa set correct */
|
||||
if(re->wrld.mode & WO_AMB_OCC) {
|
||||
if((re->r.mode & R_RAYTRACE) && (re->wrld.mode & WO_AMB_OCC)) {
|
||||
if (re->wrld.ao_samp_method == WO_AOSAMP_HAMMERSLEY)
|
||||
init_render_hammersley(re);
|
||||
else if (re->wrld.ao_samp_method == WO_AOSAMP_CONSTANT)
|
||||
|
1694
source/blender/render/intern/source/occlusion.c
Normal file
1694
source/blender/render/intern/source/occlusion.c
Normal file
File diff suppressed because it is too large
Load Diff
@ -331,6 +331,10 @@ static char *get_pass_name(int passtype, int channel)
|
||||
if(channel==-1) return "IndexOB";
|
||||
return "IndexOB.X";
|
||||
}
|
||||
if(passtype == SCE_PASS_MIST) {
|
||||
if(channel==-1) return "Mist";
|
||||
return "Mist.Z";
|
||||
}
|
||||
return "Unknown";
|
||||
}
|
||||
|
||||
@ -379,6 +383,9 @@ static int passtype_from_name(char *str)
|
||||
if(strcmp(str, "IndexOB")==0)
|
||||
return SCE_PASS_INDEXOB;
|
||||
|
||||
if(strcmp(str, "Mist")==0)
|
||||
return SCE_PASS_MIST;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -538,11 +545,16 @@ static RenderResult *new_render_result(Render *re, rcti *partrct, int crop, int
|
||||
if(srl->passflag & SCE_PASS_REFRACT)
|
||||
render_layer_add_pass(rr, rl, 3, SCE_PASS_REFRACT);
|
||||
}
|
||||
else if(re->wrld.mode & WO_AMB_OCC)
|
||||
if(re->wrld.ao_gather_method == WO_AOGATHER_APPROX)
|
||||
render_layer_add_pass(rr, rl, 3, SCE_PASS_AO);
|
||||
if(re->r.mode & R_RADIO)
|
||||
if(srl->passflag & SCE_PASS_RADIO)
|
||||
render_layer_add_pass(rr, rl, 3, SCE_PASS_RADIO);
|
||||
if(srl->passflag & SCE_PASS_INDEXOB)
|
||||
render_layer_add_pass(rr, rl, 1, SCE_PASS_INDEXOB);
|
||||
if(srl->passflag & SCE_PASS_MIST)
|
||||
render_layer_add_pass(rr, rl, 1, SCE_PASS_MIST);
|
||||
|
||||
}
|
||||
/* sss, previewrender and envmap don't do layers, so we make a default one */
|
||||
@ -2010,7 +2022,7 @@ static void renderresult_stampinfo()
|
||||
RenderResult rres;
|
||||
/* this is the basic trick to get the displayed float or char rect from render result */
|
||||
RE_GetResultImage(RE_GetRender(G.scene->id.name), &rres);
|
||||
BKE_stamp_buf((unsigned char *)rres.rect32, rres.rectf, rres.rectx, rres.recty);
|
||||
BKE_stamp_buf((unsigned char *)rres.rect32, rres.rectf, rres.rectx, rres.recty, 4);
|
||||
}
|
||||
|
||||
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
|
||||
@ -2335,8 +2347,20 @@ void RE_BlenderAnim(Render *re, Scene *scene, int sfra, int efra)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for(scene->r.cfra= sfra;
|
||||
scene->r.cfra<=efra; scene->r.cfra++) {
|
||||
for(scene->r.cfra= sfra; scene->r.cfra<=efra; scene->r.cfra++) {
|
||||
char name[FILE_MAX];
|
||||
if (scene->r.mode & (R_NO_OVERWRITE | R_TOUCH) ) {
|
||||
BKE_makepicstring(name, scene->r.pic, scene->r.cfra, scene->r.imtype);
|
||||
}
|
||||
|
||||
if (scene->r.mode & R_NO_OVERWRITE && BLI_exist(name)) {
|
||||
printf("skipping existing frame \"%s\"\n", name);
|
||||
continue;
|
||||
}
|
||||
if (scene->r.mode & R_TOUCH && !BLI_exist(name)) {
|
||||
BLI_touch(name);
|
||||
}
|
||||
|
||||
re->r.cfra= scene->r.cfra; /* weak.... */
|
||||
|
||||
do_render_all_options(re);
|
||||
|
@ -182,7 +182,7 @@ static void render_lighting_halo(HaloRen *har, float *colf)
|
||||
inp= vn[0]*lv[0] + vn[1]*lv[1] + vn[2]*lv[2];
|
||||
if(inp>0.0) {
|
||||
/* testshadowbuf==0.0 : 100% shadow */
|
||||
shadfac = testshadowbuf(lar->shb, rco, dco, dco, inp);
|
||||
shadfac = testshadowbuf(lar->shb, rco, dco, dco, inp, 0.0f);
|
||||
if( shadfac>0.0 ) {
|
||||
shadfac*= inp*soft*lar->energy;
|
||||
ir -= shadfac;
|
||||
@ -219,7 +219,7 @@ static void render_lighting_halo(HaloRen *har, float *colf)
|
||||
if(i> -0.41) { /* heuristic valua! */
|
||||
shadfac= 1.0;
|
||||
if(lar->shb) {
|
||||
shadfac = testshadowbuf(lar->shb, rco, dco, dco, inp);
|
||||
shadfac = testshadowbuf(lar->shb, rco, dco, dco, inp, 0.0f);
|
||||
if(shadfac==0.0) continue;
|
||||
i*= shadfac;
|
||||
}
|
||||
|
@ -60,6 +60,7 @@
|
||||
#include "renderpipeline.h"
|
||||
#include "render_types.h"
|
||||
#include "renderdatabase.h"
|
||||
#include "occlusion.h"
|
||||
#include "pixelblending.h"
|
||||
#include "pixelshading.h"
|
||||
#include "shadbuf.h"
|
||||
@ -399,6 +400,12 @@ static void add_filt_passes(RenderLayer *rl, int curmask, int rectx, int offset,
|
||||
*fp= (float)shi->obr->ob->index;
|
||||
}
|
||||
break;
|
||||
case SCE_PASS_MIST:
|
||||
/* */
|
||||
col= &shr->mist;
|
||||
pixsize= 1;
|
||||
break;
|
||||
|
||||
case SCE_PASS_VECTOR:
|
||||
{
|
||||
/* add minimum speed in pixel, no filter */
|
||||
@ -477,6 +484,10 @@ static void add_passes(RenderLayer *rl, int offset, ShadeInput *shi, ShadeResult
|
||||
*fp= (float)shi->obr->ob->index;
|
||||
}
|
||||
break;
|
||||
case SCE_PASS_MIST:
|
||||
fp= rpass->rect + offset;
|
||||
*fp= shr->mist;
|
||||
break;
|
||||
}
|
||||
if(col) {
|
||||
fp= rpass->rect + pixsize*offset;
|
||||
@ -535,6 +546,10 @@ static void shadeDA_tile(RenderPart *pa, RenderLayer *rl)
|
||||
shade_sample_initialize(&ssamp, pa, rl);
|
||||
addpassflag= rl->passflag & ~(SCE_PASS_Z|SCE_PASS_COMBINED);
|
||||
|
||||
/* occlusion caching */
|
||||
if(R.occlusiontree)
|
||||
cache_occ_samples(&R, pa, &ssamp);
|
||||
|
||||
/* filtered render, for now we assume only 1 filter size */
|
||||
if(pa->crop) {
|
||||
crop= 1;
|
||||
@ -582,6 +597,9 @@ static void shadeDA_tile(RenderPart *pa, RenderLayer *rl)
|
||||
|
||||
if(R.r.mode & R_SHADOW)
|
||||
ISB_free(pa);
|
||||
|
||||
if(R.occlusiontree)
|
||||
free_occ_samples(&R, pa);
|
||||
}
|
||||
|
||||
/* ************* pixel struct ******** */
|
||||
@ -1073,6 +1091,9 @@ void zbufshade_tile(RenderPart *pa)
|
||||
if(R.r.mode & R_SHADOW)
|
||||
ISB_create(pa, NULL);
|
||||
|
||||
if(R.occlusiontree)
|
||||
cache_occ_samples(&R, pa, &ssamp);
|
||||
|
||||
for(y=pa->disprect.ymin; y<pa->disprect.ymax; y++, rr->renrect.ymax++) {
|
||||
for(x=pa->disprect.xmin; x<pa->disprect.xmax; x++, ro++, rz++, rp++, fcol+=4, offs++) {
|
||||
/* per pixel fixed seed */
|
||||
@ -1085,9 +1106,6 @@ void zbufshade_tile(RenderPart *pa)
|
||||
if(shade_samples(&ssamp, &ps, x, y)) {
|
||||
QUATCOPY(fcol, ssamp.shr[0].combined);
|
||||
|
||||
if(!(fcol[0] == fcol[0]))
|
||||
printvecf("fudgecol", fcol);
|
||||
|
||||
/* passes */
|
||||
if(addpassflag)
|
||||
add_passes(rl, offs, ssamp.shi, ssamp.shr);
|
||||
@ -1098,6 +1116,9 @@ void zbufshade_tile(RenderPart *pa)
|
||||
if(R.test_break()) break;
|
||||
}
|
||||
|
||||
if(R.occlusiontree)
|
||||
free_occ_samples(&R, pa);
|
||||
|
||||
if(R.r.mode & R_SHADOW)
|
||||
ISB_free(pa);
|
||||
}
|
||||
|
@ -105,6 +105,7 @@
|
||||
#define RE_UV_ELEMS 2
|
||||
#define RE_SURFNOR_ELEMS 3
|
||||
#define RE_SIMPLIFY_ELEMS 2
|
||||
#define RE_FACE_ELEMS 1
|
||||
|
||||
float *RE_vertren_get_sticky(ObjectRen *obr, VertRen *ver, int verify)
|
||||
{
|
||||
@ -408,6 +409,7 @@ int RE_vlakren_get_normal(Render *re, ObjectInstanceRen *obi, VlakRen *vlr, floa
|
||||
nor[0]= imat[0][0]*xn+imat[0][1]*yn+imat[0][2]*zn;
|
||||
nor[1]= imat[1][0]*xn+imat[1][1]*yn+imat[1][2]*zn;
|
||||
nor[2]= imat[2][0]*xn+imat[2][1]*yn+imat[2][2]*zn;
|
||||
Normalize(nor);
|
||||
}
|
||||
else
|
||||
VECCOPY(nor, vlr->n);
|
||||
@ -606,6 +608,21 @@ float *RE_strandren_get_simplify(struct ObjectRen *obr, struct StrandRen *strand
|
||||
return simplify + (strand->index & 255)*RE_SIMPLIFY_ELEMS;
|
||||
}
|
||||
|
||||
int *RE_strandren_get_face(ObjectRen *obr, StrandRen *strand, int verify)
|
||||
{
|
||||
int *face;
|
||||
int nr= strand->index>>8;
|
||||
|
||||
face= obr->strandnodes[nr].face;
|
||||
if(face==NULL) {
|
||||
if(verify)
|
||||
face= obr->strandnodes[nr].face= MEM_callocN(256*RE_FACE_ELEMS*sizeof(int), "face table");
|
||||
else
|
||||
return NULL;
|
||||
}
|
||||
return face + (strand->index & 255)*RE_FACE_ELEMS;
|
||||
}
|
||||
|
||||
/* winspeed is exception, it is stored per instance */
|
||||
float *RE_strandren_get_winspeed(ObjectInstanceRen *obi, StrandRen *strand, int verify)
|
||||
{
|
||||
@ -756,6 +773,8 @@ void free_renderdata_strandnodes(StrandTableNode *strandnodes)
|
||||
MEM_freeN(strandnodes[a].surfnor);
|
||||
if(strandnodes[a].simplify)
|
||||
MEM_freeN(strandnodes[a].simplify);
|
||||
if(strandnodes[a].face)
|
||||
MEM_freeN(strandnodes[a].face);
|
||||
}
|
||||
|
||||
MEM_freeN(strandnodes);
|
||||
@ -1275,34 +1294,9 @@ ObjectInstanceRen *RE_addRenderInstance(Render *re, ObjectRen *obr, Object *ob,
|
||||
return obi;
|
||||
}
|
||||
|
||||
void find_dupli_objectren(Render *re, ObjectInstanceRen *obi, ObjectInstanceRen *lastobi)
|
||||
{
|
||||
ObjectRen *obr;
|
||||
|
||||
/* see if last object did the same lookup, so we can just reuse result */
|
||||
if(lastobi && obi->ob == lastobi->ob && obi->par == lastobi->par && obi->psysindex == lastobi->psysindex) {
|
||||
obi->obr= lastobi->obr;
|
||||
return;
|
||||
}
|
||||
|
||||
/* dupli objects are created after object instances, so we look through
|
||||
* object list to find it */
|
||||
obr= re->objecttable.first;
|
||||
while(obr && (obr->ob != obi->ob || obr->par != obi->par || obr->psysindex != obi->psysindex))
|
||||
obr= obr->next;
|
||||
|
||||
if(!obr) {
|
||||
obr= re->objecttable.first;
|
||||
while(obr && (obr->ob != obi->ob || obr->psysindex != obi->psysindex) && obr->par == NULL)
|
||||
obr= obr->next;
|
||||
}
|
||||
|
||||
obi->obr= obr;
|
||||
}
|
||||
|
||||
void RE_makeRenderInstances(Render *re)
|
||||
{
|
||||
ObjectInstanceRen *obi, *oldobi, *lastobi= NULL;
|
||||
ObjectInstanceRen *obi, *oldobi;
|
||||
ListBase newlist;
|
||||
int tot;
|
||||
|
||||
@ -1316,11 +1310,6 @@ void RE_makeRenderInstances(Render *re)
|
||||
for(oldobi=re->instancetable.first; oldobi; oldobi=oldobi->next) {
|
||||
*obi= *oldobi;
|
||||
|
||||
if(!obi->obr) {
|
||||
find_dupli_objectren(re, obi, lastobi);
|
||||
lastobi= obi;
|
||||
}
|
||||
|
||||
if(obi->obr) {
|
||||
obi->prev= obi->next= NULL;
|
||||
BLI_addtail(&newlist, obi);
|
||||
|
@ -648,11 +648,11 @@ static float readshadowbuf(ShadBuf *shb, ShadSampleBuf *shsample, int bias, int
|
||||
|
||||
/* the externally called shadow testing (reading) function */
|
||||
/* return 1.0: no shadow at all */
|
||||
float testshadowbuf(ShadBuf *shb, float *rco, float *dxco, float *dyco, float inp)
|
||||
float testshadowbuf(ShadBuf *shb, float *rco, float *dxco, float *dyco, float inp, float mat_bias)
|
||||
{
|
||||
ShadSampleBuf *shsample;
|
||||
float fac, co[4], dx[3], dy[3], shadfac=0.0f;
|
||||
float xs1,ys1, siz, *jit, *weight, xres, yres;
|
||||
float xs1,ys1, siz, *jit, *weight, xres, yres, biasf;
|
||||
int xs, ys, zs, bias, *rz;
|
||||
short a, num;
|
||||
|
||||
@ -689,9 +689,11 @@ float testshadowbuf(ShadBuf *shb, float *rco, float *dxco, float *dyco, float in
|
||||
num= shb->samp*shb->samp;
|
||||
fac= shb->soft;
|
||||
|
||||
if(mat_bias!=0.0f) biasf= shb->bias*mat_bias;
|
||||
else biasf= shb->bias;
|
||||
/* with inp==1.0, bias is half the size. correction value was 1.1, giving errors
|
||||
on cube edges, with one side being almost frontal lighted (ton) */
|
||||
bias= (1.5f-inp*inp)*shb->bias;
|
||||
bias= (1.5f-inp*inp)*biasf;
|
||||
|
||||
if(num==1) {
|
||||
for(shsample= shb->buffers.first; shsample; shsample= shsample->next)
|
||||
|
@ -161,11 +161,16 @@ void shade_input_do_shade(ShadeInput *shi, ShadeResult *shr)
|
||||
}
|
||||
|
||||
/* MIST */
|
||||
if((R.wrld.mode & WO_MIST) && (shi->mat->mode & MA_NOMIST)==0 ) {
|
||||
if((shi->passflag & SCE_PASS_MIST) || ((R.wrld.mode & WO_MIST) && (shi->mat->mode & MA_NOMIST)==0)) {
|
||||
if(R.r.mode & R_ORTHO)
|
||||
alpha= mistfactor(-shi->co[2], shi->co);
|
||||
shr->mist= mistfactor(-shi->co[2], shi->co);
|
||||
else
|
||||
alpha= mistfactor(VecLength(shi->co), shi->co);
|
||||
shr->mist= mistfactor(VecLength(shi->co), shi->co);
|
||||
}
|
||||
else shr->mist= 0.0f;
|
||||
|
||||
if((R.wrld.mode & WO_MIST) && (shi->mat->mode & MA_NOMIST)==0 ) {
|
||||
alpha= shr->mist;
|
||||
}
|
||||
else alpha= 1.0f;
|
||||
|
||||
@ -422,7 +427,7 @@ void shade_input_set_strand_texco(ShadeInput *shi, StrandRen *strand, StrandVert
|
||||
}
|
||||
|
||||
if(texco & TEXCO_STRAND) {
|
||||
shi->strand= spoint->strandco;
|
||||
shi->strandco= spoint->strandco;
|
||||
|
||||
if(shi->osatex) {
|
||||
shi->dxstrand= spoint->dtstrandco;
|
||||
@ -935,7 +940,7 @@ void shade_input_set_shade_texco(ShadeInput *shi)
|
||||
}
|
||||
|
||||
if(texco & TEXCO_STRAND) {
|
||||
shi->strand= (l*v3->accum - u*v1->accum - v*v2->accum);
|
||||
shi->strandco= (l*v3->accum - u*v1->accum - v*v2->accum);
|
||||
if(shi->osatex) {
|
||||
dl= shi->dx_u+shi->dx_v;
|
||||
shi->dxstrand= dl*v3->accum-shi->dx_u*v1->accum-shi->dx_v*v2->accum;
|
||||
@ -1236,7 +1241,7 @@ void shade_samples_do_AO(ShadeSample *ssamp)
|
||||
|
||||
if(!(R.r.mode & R_SHADOW))
|
||||
return;
|
||||
if(!(R.r.mode & R_RAYTRACE))
|
||||
if(!(R.r.mode & R_RAYTRACE) && !(R.wrld.ao_gather_method == WO_AOGATHER_APPROX))
|
||||
return;
|
||||
|
||||
if(R.wrld.mode & WO_AMB_OCC)
|
||||
@ -1248,7 +1253,7 @@ void shade_samples_do_AO(ShadeSample *ssamp)
|
||||
}
|
||||
|
||||
|
||||
static void shade_samples_fill_with_ps(ShadeSample *ssamp, PixStr *ps, int x, int y)
|
||||
void shade_samples_fill_with_ps(ShadeSample *ssamp, PixStr *ps, int x, int y)
|
||||
{
|
||||
ShadeInput *shi;
|
||||
float xs, ys;
|
||||
|
@ -43,6 +43,7 @@
|
||||
#include "DNA_material_types.h"
|
||||
|
||||
/* local include */
|
||||
#include "occlusion.h"
|
||||
#include "renderpipeline.h"
|
||||
#include "render_types.h"
|
||||
#include "pixelblending.h"
|
||||
@ -1006,8 +1007,9 @@ static void do_specular_ramp(ShadeInput *shi, float is, float t, float *spec)
|
||||
/* pure AO, check for raytrace and world should have been done */
|
||||
void ambient_occlusion(ShadeInput *shi)
|
||||
{
|
||||
|
||||
if((R.r.mode & R_RAYTRACE) && shi->mat->amb!=0.0f)
|
||||
if((R.wrld.ao_gather_method == WO_AOGATHER_APPROX) && shi->mat->amb!=0.0f)
|
||||
sample_occ(&R, shi);
|
||||
else if((R.r.mode & R_RAYTRACE) && shi->mat->amb!=0.0f)
|
||||
ray_ao(shi, shi->ao);
|
||||
else
|
||||
shi->ao[0]= shi->ao[1]= shi->ao[2]= 1.0f;
|
||||
@ -1017,25 +1019,28 @@ void ambient_occlusion(ShadeInput *shi)
|
||||
/* wrld mode was checked for */
|
||||
void ambient_occlusion_to_diffuse(ShadeInput *shi, float *diff)
|
||||
{
|
||||
if((R.r.mode & R_RAYTRACE) || R.wrld.ao_gather_method == WO_AOGATHER_APPROX) {
|
||||
if(shi->mat->amb!=0.0f) {
|
||||
float f= R.wrld.aoenergy*shi->mat->amb;
|
||||
|
||||
if((R.r.mode & R_RAYTRACE) && shi->mat->amb!=0.0f) {
|
||||
float f= R.wrld.aoenergy*shi->mat->amb;
|
||||
if (R.wrld.aomix==WO_AOADDSUB) {
|
||||
diff[0] = 2.0f*shi->ao[0]-1.0f;
|
||||
diff[1] = 2.0f*shi->ao[1]-1.0f;
|
||||
diff[2] = 2.0f*shi->ao[2]-1.0f;
|
||||
}
|
||||
else if (R.wrld.aomix==WO_AOSUB) {
|
||||
diff[0] = shi->ao[0]-1.0f;
|
||||
diff[1] = shi->ao[1]-1.0f;
|
||||
diff[2] = shi->ao[2]-1.0f;
|
||||
}
|
||||
else {
|
||||
VECCOPY(diff, shi->ao);
|
||||
}
|
||||
|
||||
if (R.wrld.aomix==WO_AOADDSUB) {
|
||||
diff[0] = 2.0f*shi->ao[0]-1.0f;
|
||||
diff[1] = 2.0f*shi->ao[1]-1.0f;
|
||||
diff[2] = 2.0f*shi->ao[2]-1.0f;
|
||||
VECMUL(diff, f);
|
||||
}
|
||||
else if (R.wrld.aomix==WO_AOSUB) {
|
||||
diff[0] = shi->ao[0]-1.0f;
|
||||
diff[1] = shi->ao[1]-1.0f;
|
||||
diff[2] = shi->ao[2]-1.0f;
|
||||
}
|
||||
else {
|
||||
VECCOPY(diff, shi->ao);
|
||||
}
|
||||
|
||||
VECMUL(diff, f);
|
||||
else
|
||||
diff[0]= diff[1]= diff[2]= 0.0f;
|
||||
}
|
||||
else
|
||||
diff[0]= diff[1]= diff[2]= 0.0f;
|
||||
@ -1054,7 +1059,7 @@ void lamp_get_shadow(LampRen *lar, ShadeInput *shi, float inp, float *shadfac, i
|
||||
if(lar->buftype==LA_SHADBUF_IRREGULAR)
|
||||
shadfac[3]= ISB_getshadow(shi, lar->shb);
|
||||
else
|
||||
shadfac[3] = testshadowbuf(lar->shb, shi->co, shi->dxco, shi->dyco, inp);
|
||||
shadfac[3] = testshadowbuf(lar->shb, shi->co, shi->dxco, shi->dyco, inp, shi->mat->lbias);
|
||||
}
|
||||
else if(lar->mode & LA_SHAD_RAY) {
|
||||
ray_shadow(shi, lar, shadfac);
|
||||
|
@ -59,7 +59,7 @@ void merge_transp_passes(RenderLayer *rl, ShadeResult *shr);
|
||||
void add_transp_passes(RenderLayer *rl, int offset, ShadeResult *shr, float alpha);
|
||||
void hoco_to_zco(ZSpan *zspan, float *zco, float *hoco);
|
||||
void zspan_scanconvert_strand(ZSpan *zspan, void *handle, float *v1, float *v2, float *v3, void (*func)(void *, int, int, float, float, float) );
|
||||
void zbufsinglewire(ZSpan *zspan, ObjectRen *obr, int zvlnr, float *ho1, float *ho2);
|
||||
void zbufsinglewire(ZSpan *zspan, int obi, int zvlnr, float *ho1, float *ho2);
|
||||
int addtosamp_shr(ShadeResult *samp_shr, ShadeSample *ssamp, int addpassflag);
|
||||
void add_transp_speed(RenderLayer *rl, int offset, float *speed, float alpha, long *rdrect);
|
||||
void reset_sky_speedvectors(RenderPart *pa, RenderLayer *rl, float *rectf);
|
||||
@ -458,6 +458,11 @@ static int compare_strand_segment(const void *poin1, const void *poin2)
|
||||
return 1;
|
||||
}
|
||||
|
||||
static void interpolate_vec1(float *v1, float *v2, float t, float negt, float *v)
|
||||
{
|
||||
v[0]= negt*v1[0] + t*v2[0];
|
||||
}
|
||||
|
||||
static void interpolate_vec3(float *v1, float *v2, float t, float negt, float *v)
|
||||
{
|
||||
v[0]= negt*v1[0] + t*v2[0];
|
||||
@ -504,6 +509,8 @@ static void interpolate_shade_result(ShadeResult *shr1, ShadeResult *shr2, float
|
||||
interpolate_vec3(shr1->refr, shr2->refr, t, negt, shr->refr);
|
||||
if(addpassflag & SCE_PASS_RADIO)
|
||||
interpolate_vec3(shr1->rad, shr2->rad, t, negt, shr->rad);
|
||||
if(addpassflag & SCE_PASS_MIST)
|
||||
interpolate_vec1(&shr1->mist, &shr2->mist, t, negt, &shr->mist);
|
||||
}
|
||||
}
|
||||
|
||||
@ -685,6 +692,7 @@ static void strand_shade_point(Render *re, ShadeSample *ssamp, StrandSegment *ss
|
||||
vlr.flag |= R_TANGENT;
|
||||
|
||||
shi->vlr= &vlr;
|
||||
shi->strand= sseg->strand;
|
||||
shi->obi= sseg->obi;
|
||||
shi->obr= sseg->obi->obr;
|
||||
|
||||
@ -1057,6 +1065,9 @@ unsigned short *zbuffer_strands_shade(Render *re, RenderPart *pa, RenderLayer *r
|
||||
if(re->test_break())
|
||||
break;
|
||||
|
||||
if(!(strand->buffer->lay & rl->lay))
|
||||
continue;
|
||||
|
||||
#if 0
|
||||
if(strand->clip)
|
||||
continue;
|
||||
|
@ -1521,7 +1521,7 @@ void do_material_tex(ShadeInput *shi)
|
||||
}
|
||||
else if(mtex->texco==TEXCO_STRAND) {
|
||||
co= tempvec; dx= dxt; dy= dyt;
|
||||
co[0]= shi->strand;
|
||||
co[0]= shi->strandco;
|
||||
co[1]= co[2]= 0.0f;
|
||||
dx[0]= shi->dxstrand;
|
||||
dx[1]= dx[2]= 0.0f;
|
||||
|
@ -3346,6 +3346,10 @@ void merge_transp_passes(RenderLayer *rl, ShadeResult *shr)
|
||||
case SCE_PASS_NORMAL:
|
||||
col= shr->nor;
|
||||
break;
|
||||
case SCE_PASS_MIST:
|
||||
col= &shr->mist;
|
||||
pixsize= 1;
|
||||
break;
|
||||
case SCE_PASS_VECTOR:
|
||||
|
||||
{
|
||||
@ -3397,6 +3401,7 @@ void add_transp_passes(RenderLayer *rl, int offset, ShadeResult *shr, float alph
|
||||
|
||||
for(rpass= rl->passes.first; rpass; rpass= rpass->next) {
|
||||
float *fp, *col= NULL;
|
||||
int pixsize= 3;
|
||||
|
||||
switch(rpass->passtype) {
|
||||
case SCE_PASS_RGBA:
|
||||
@ -3427,13 +3432,19 @@ void add_transp_passes(RenderLayer *rl, int offset, ShadeResult *shr, float alph
|
||||
case SCE_PASS_NORMAL:
|
||||
col= shr->nor;
|
||||
break;
|
||||
case SCE_PASS_MIST:
|
||||
col= &shr->mist;
|
||||
pixsize= 1;
|
||||
break;
|
||||
}
|
||||
if(col) {
|
||||
|
||||
fp= rpass->rect + 3*offset;
|
||||
fp= rpass->rect + pixsize*offset;
|
||||
fp[0]= alpha*col[0] + (1.0f-alpha)*fp[0];
|
||||
fp[1]= alpha*col[1] + (1.0f-alpha)*fp[1];
|
||||
fp[2]= alpha*col[2] + (1.0f-alpha)*fp[2];
|
||||
if(pixsize==3) {
|
||||
fp[1]= alpha*col[1] + (1.0f-alpha)*fp[1];
|
||||
fp[2]= alpha*col[2] + (1.0f-alpha)*fp[2];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -3595,6 +3606,10 @@ int addtosamp_shr(ShadeResult *samp_shr, ShadeSample *ssamp, int addpassflag)
|
||||
|
||||
if(addpassflag & SCE_PASS_RADIO)
|
||||
addvecmul(samp_shr->rad, shr->rad, fac);
|
||||
|
||||
if(addpassflag & SCE_PASS_MIST)
|
||||
samp_shr->mist= samp_shr->mist+fac*shr->mist;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -3775,6 +3790,7 @@ unsigned short *zbuffer_transp_shade(RenderPart *pa, RenderLayer *rl, float *pas
|
||||
add_transp_speed(rl, od, ssamp.shr[0].winspeed, pass[3], rdrect);
|
||||
}
|
||||
else {
|
||||
float alpha= 0.0f;
|
||||
short filled, *sp= (short *)(ztramask+od);
|
||||
|
||||
/* for each mask-sample we alpha-under colors. then in end it's added using filter */
|
||||
@ -3797,17 +3813,21 @@ unsigned short *zbuffer_transp_shade(RenderPart *pa, RenderLayer *rl, float *pas
|
||||
}
|
||||
}
|
||||
|
||||
/* note; cannot use pass[3] for alpha due to filtermask */
|
||||
for(a=0; a<R.osa; a++) {
|
||||
add_filt_fmask(1<<a, samp_shr[a].combined, pass, rr->rectx);
|
||||
alpha+= samp_shr[a].combined[3];
|
||||
}
|
||||
|
||||
if(addpassflag) {
|
||||
alpha*= sampalpha;
|
||||
|
||||
/* merge all in one, and then add */
|
||||
merge_transp_passes(rl, samp_shr);
|
||||
add_transp_passes(rl, od, samp_shr, pass[3]);
|
||||
add_transp_passes(rl, od, samp_shr, alpha);
|
||||
|
||||
if(addpassflag & SCE_PASS_VECTOR)
|
||||
add_transp_speed(rl, od, samp_shr[0].winspeed, pass[3], rdrect);
|
||||
add_transp_speed(rl, od, samp_shr[0].winspeed, alpha, rdrect);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -33,6 +33,7 @@
|
||||
#include <time.h>
|
||||
#include <math.h>
|
||||
#include <stdlib.h>
|
||||
#include <stddef.h>
|
||||
#include <string.h>
|
||||
|
||||
#ifdef WIN32
|
||||
@ -3867,6 +3868,43 @@ void do_armbuts(unsigned short event)
|
||||
}
|
||||
}
|
||||
break;
|
||||
case B_POSEGRP_RECALC:
|
||||
allqueue(REDRAWVIEW3D, 0);
|
||||
allqueue(REDRAWBUTSEDIT, 0);
|
||||
break;
|
||||
case B_POSEGRP_ADD:
|
||||
if (ob && ob->pose) {
|
||||
bPose *pose= ob->pose;
|
||||
bActionGroup *grp;
|
||||
|
||||
grp= MEM_callocN(sizeof(bActionGroup), "PoseGroup");
|
||||
strcpy(grp->name, "Group");
|
||||
BLI_addtail(&pose->agroups, grp);
|
||||
BLI_uniquename(&pose->agroups, grp, "Group", offsetof(bActionGroup, name), 32);
|
||||
|
||||
pose->active_group= BLI_countlist(&pose->agroups);
|
||||
|
||||
BIF_undo_push("Add Pose Group");
|
||||
allqueue(REDRAWBUTSEDIT, 0);
|
||||
allqueue(REDRAWVIEW3D, 0);
|
||||
}
|
||||
break;
|
||||
case B_POSEGRP_REMOVE:
|
||||
if (ob && ob->pose && ob->pose->active_group) {
|
||||
bPose *pose= ob->pose;
|
||||
bActionGroup *grp= NULL;
|
||||
|
||||
grp= BLI_findlink(&pose->agroups, pose->active_group-1);
|
||||
if (grp) {
|
||||
BLI_freelinkN(&pose->agroups, grp);
|
||||
pose->active_group= 0;
|
||||
}
|
||||
|
||||
BIF_undo_push("Remove Pose Group");
|
||||
allqueue(REDRAWBUTSEDIT, 0);
|
||||
allqueue(REDRAWVIEW3D, 0);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@ -4297,6 +4335,37 @@ static int ob_arm_bone_pchan_lock(Object *ob, bArmature *arm, Bone *bone, bPoseC
|
||||
return 0;
|
||||
}
|
||||
|
||||
static char *build_posegroups_menustr(bPose *pose)
|
||||
{
|
||||
DynStr *pupds= BLI_dynstr_new();
|
||||
bActionGroup *agrp;
|
||||
char *str;
|
||||
char buf[16];
|
||||
int i;
|
||||
|
||||
/* add title first (and the "none" entry) */
|
||||
BLI_dynstr_append(pupds, "Pose Group%t|");
|
||||
BLI_dynstr_append(pupds, "BG: [None]%x0");
|
||||
|
||||
/* loop through markers, adding them */
|
||||
for (agrp= pose->agroups.first, i=1; agrp; agrp=agrp->next, i++) {
|
||||
BLI_dynstr_append(pupds, "BG: ");
|
||||
BLI_dynstr_append(pupds, agrp->name);
|
||||
|
||||
sprintf(buf, "%%x%d", i);
|
||||
BLI_dynstr_append(pupds, buf);
|
||||
|
||||
if (agrp->next)
|
||||
BLI_dynstr_append(pupds, "|");
|
||||
}
|
||||
|
||||
/* convert to normal MEM_malloc'd string */
|
||||
str= BLI_dynstr_get_cstring(pupds);
|
||||
BLI_dynstr_free(pupds);
|
||||
|
||||
return str;
|
||||
}
|
||||
|
||||
static void editing_panel_pose_bones(Object *ob, bArmature *arm)
|
||||
{
|
||||
uiBlock *block;
|
||||
@ -4305,6 +4374,7 @@ static void editing_panel_pose_bones(Object *ob, bArmature *arm)
|
||||
Bone *curBone;
|
||||
int by, a;
|
||||
int index, zerodof, zerolimit;
|
||||
char *menustr;
|
||||
|
||||
/* Draw the bone name block */
|
||||
block= uiNewBlock(&curarea->uiblocks, "editing_panel_pose_bones", UI_EMBOSS, UI_HELV, curarea->win);
|
||||
@ -4320,19 +4390,23 @@ static void editing_panel_pose_bones(Object *ob, bArmature *arm)
|
||||
for (pchan=ob->pose->chanbase.first, index=0; pchan; pchan=pchan->next, index++){
|
||||
curBone= pchan->bone;
|
||||
if ((curBone->flag & BONE_SELECTED) && (curBone->layer & arm->layer)) {
|
||||
|
||||
if(ob_arm_bone_pchan_lock(ob, arm, curBone, pchan))
|
||||
uiDefBut(block, LABEL, 0, "Proxy Locked", 160, 180,150,18, NULL, 1, 0, 0, 0, "");
|
||||
|
||||
/* Bone naming button */
|
||||
/* Bone naming button */
|
||||
uiBlockBeginAlign(block);
|
||||
but=uiDefBut(block, TEX, REDRAWVIEW3D, "BO:", -10,by,117,19, curBone->name, 0, 24, 0, 0, "Change the bone name");
|
||||
uiButSetFunc(but, validate_posebonebutton_cb, curBone, NULL);
|
||||
uiButSetCompleteFunc(but, autocomplete_bone, (void *)ob);
|
||||
|
||||
/* Dist and weight buttons */
|
||||
uiDefButF(block, NUM,B_ARM_RECALCDATA, "Dist:", 107, by, 105, 19, &curBone->dist, 0.0, 1000.0, 10.0, 0.0, "Bone deformation distance");
|
||||
uiDefButF(block, NUM,B_ARM_RECALCDATA, "Weight:", 220, by, 110, 19, &curBone->weight, 0.0F, 1000.0F, 10.0F, 0.0F, "Bone deformation weight");
|
||||
/* Bone custom drawing */
|
||||
menustr= build_posegroups_menustr(ob->pose);
|
||||
uiDefButS(block, MENU,REDRAWVIEW3D, menustr, 107,by,105,19, &pchan->agrp_index, 0.0, 0.0, 0.0, 0.0, "Change the Pose Group this Bone belongs to");
|
||||
MEM_freeN(menustr);
|
||||
|
||||
ob_arm_bone_pchan_lock(ob, arm, curBone, pchan);
|
||||
uiDefIDPoinBut(block, test_obpoin_but, ID_OB, REDRAWVIEW3D, "OB:", 220,by,110,19, &pchan->custom, "Object that defines custom draw type for this Bone");
|
||||
ob_arm_bone_pchan_lock(ob, arm, curBone, NULL);
|
||||
|
||||
/* Segment, ease in/out buttons */
|
||||
uiBlockBeginAlign(block);
|
||||
@ -4345,9 +4419,7 @@ static void editing_panel_pose_bones(Object *ob, bArmature *arm)
|
||||
uiDefButBitI(block, TOG, BONE_NO_SCALE, B_ARM_RECALCDATA, "S", 70,by-38,20,19, &curBone->flag, 1.0, 32.0, 0.0, 0.0, "Don't inherit scale from parent Bone");
|
||||
uiDefButBitI(block, TOGN, BONE_NO_DEFORM, B_ARM_RECALCDATA, "Deform", 90, by-38, 80, 19, &curBone->flag, 0.0, 0.0, 0.0, 0.0, "Indicate if Bone deforms geometry");
|
||||
uiDefButBitI(block, TOG, BONE_MULT_VG_ENV, B_ARM_RECALCDATA, "Mult", 170,by-38,80,19, &curBone->flag, 1.0, 32.0, 0.0, 0.0, "Multiply Bone Envelope with VertexGroup");
|
||||
ob_arm_bone_pchan_lock(ob, arm, curBone, pchan);
|
||||
uiDefIDPoinBut(block, test_obpoin_but, ID_OB, REDRAWVIEW3D, "OB:", 250,by-38,80,19, &pchan->custom, "Object that defines custom draw type for this Bone");
|
||||
ob_arm_bone_pchan_lock(ob, arm, curBone, NULL);
|
||||
uiDefButBitI(block, TOG, BONE_MULT_VG_ENV, B_ARM_RECALCDATA, "Hide", 250,by-38,80,19, &curBone->flag, 1.0, 32.0, 0.0, 0.0, "Toggles display of this bone in Edit Mode");
|
||||
|
||||
/* layers */
|
||||
uiBlockBeginAlign(block);
|
||||
@ -4995,6 +5067,22 @@ char *get_vertexgroup_menustr(Object *ob)
|
||||
return menustr;
|
||||
}
|
||||
|
||||
static void verify_poselib_posename(void *arg1, void *arg2)
|
||||
{
|
||||
bAction *act= (bAction *)arg1;
|
||||
TimeMarker *marker= (TimeMarker *)arg2;
|
||||
|
||||
BLI_uniquename(&act->markers, marker, "Pose", offsetof(TimeMarker, name), 64);
|
||||
}
|
||||
|
||||
static void verify_posegroup_groupname(void *arg1, void *arg2)
|
||||
{
|
||||
bPose *pose= (bPose *)arg1;
|
||||
bActionGroup *grp= (bActionGroup *)arg2;
|
||||
|
||||
BLI_uniquename(&pose->agroups, grp, "Group", offsetof(bActionGroup, name), 32);
|
||||
}
|
||||
|
||||
static void editing_panel_links(Object *ob)
|
||||
{
|
||||
uiBlock *block;
|
||||
@ -5081,10 +5169,14 @@ static void editing_panel_links(Object *ob)
|
||||
if (ob->type==OB_ARMATURE) {
|
||||
if ((ob->pose) && (ob->flag & OB_POSEMODE) && (G.obedit != ob)) {
|
||||
bAction *act= ob->poselib;
|
||||
bPose *pose= ob->pose;
|
||||
int count;
|
||||
char *menustr;
|
||||
|
||||
/* PoseLib settings for armature reside on the left */
|
||||
xco= 143;
|
||||
|
||||
uiDefBut(block, LABEL,0, "Pose Library (Action):", xco, 154, 200, 20, 0, 0, 0, 0, 0, "");
|
||||
uiDefBut(block, LABEL,0, "Pose Library:", xco, 154, 200, 20, 0, 0, 0, 0, 0, "");
|
||||
|
||||
/* PoseLib Action */
|
||||
uiBlockSetCol(block, TH_BUT_SETTING2);
|
||||
@ -5093,20 +5185,23 @@ static void editing_panel_links(Object *ob)
|
||||
|
||||
uiDefBut(block, BUT, B_POSELIB_VALIDATE, "Auto-Sync PoseLib", xco,110,160,20, 0, 0, 0, 0, 0, "Syncs the current PoseLib with the poses available");
|
||||
|
||||
/* poselib pose editing controls */
|
||||
if ((act) && (act->markers.first)) {
|
||||
TimeMarker *marker= poselib_get_active_pose(act);
|
||||
int count= BLI_countlist(&act->markers);
|
||||
char *menustr= poselib_build_poses_menu(act, "PoseLib Poses");
|
||||
|
||||
/* PoseLib - Pose editing controls */
|
||||
if (act) {
|
||||
uiBlockBeginAlign(block);
|
||||
/* currently 'active' pose */
|
||||
uiDefButI(block, MENU, B_POSELIB_APPLYP, menustr, xco, 85,18,20, &act->active_marker, 1, count, 0, 0, "Browses Poses in Pose Library. Applies chosen pose.");
|
||||
MEM_freeN(menustr);
|
||||
if (act->markers.first) {
|
||||
count= BLI_countlist(&act->markers);
|
||||
menustr= poselib_build_poses_menu(act, "PoseLib Poses");
|
||||
uiDefButI(block, MENU, B_POSELIB_APPLYP, menustr, xco, 85,18,20, &act->active_marker, 1, count, 0, 0, "Browses Poses in Pose Library. Applies chosen pose.");
|
||||
MEM_freeN(menustr);
|
||||
|
||||
if (act->active_marker) {
|
||||
uiDefBut(block, TEX, REDRAWBUTSEDIT,"", xco+18,85,160-18-20,20, marker->name, 0, 63, 0, 0, "Displays current Pose Library Pose name. Click to change.");
|
||||
uiDefIconBut(block, BUT, B_POSELIB_REMOVEP, VICON_X, xco+160-20, 85, 20, 20, NULL, 0.0, 0.0, 0.0, 0.0, "Remove this Pose Library Pose from Pose Library.");
|
||||
if (act->active_marker) {
|
||||
TimeMarker *marker= poselib_get_active_pose(act);
|
||||
|
||||
but= uiDefBut(block, TEX, REDRAWBUTSEDIT,"", xco+18,85,160-18-20,20, marker->name, 0, 63, 0, 0, "Displays current Pose Library Pose name. Click to change.");
|
||||
uiButSetFunc(but, verify_poselib_posename, act, marker);
|
||||
uiDefIconBut(block, BUT, B_POSELIB_REMOVEP, VICON_X, xco+160-20, 85, 20, 20, NULL, 0.0, 0.0, 0.0, 0.0, "Remove this Pose Library Pose from Pose Library.");
|
||||
}
|
||||
}
|
||||
|
||||
/* add new poses */
|
||||
@ -5114,6 +5209,38 @@ static void editing_panel_links(Object *ob)
|
||||
uiDefBut(block, BUT, B_POSELIB_REPLACEP, "Replace Pose", xco+80,65,80,20, 0, 0, 0, 0, 0, "Replace existing PoseLib Pose with current pose");
|
||||
uiBlockEndAlign(block);
|
||||
}
|
||||
|
||||
|
||||
/* Action Groups settings for armature reside on the right */
|
||||
xco= 315;
|
||||
|
||||
uiDefBut(block, LABEL,0, "Bone Groups:", xco, 154, 140, 20, 0, 0, 0, 0, 0, "");
|
||||
|
||||
/* add new group */
|
||||
uiDefBut(block, BUT, B_POSEGRP_ADD, "Add Group", xco,130,140,20, 0, 0, 0, 0, 0, "Add a new Pose Group for the Pose");
|
||||
|
||||
if (pose->agroups.first) {
|
||||
uiBlockBeginAlign(block);
|
||||
/* currently 'active' group - browse groups */
|
||||
count= BLI_countlist(&pose->agroups);
|
||||
menustr= build_posegroups_menustr(pose);
|
||||
uiDefButI(block, MENU, B_POSEGRP_RECALC, menustr, xco, 85,18,20, &pose->active_group, 1, count, 0, 0, "Browses Pose Groups available for Armature. Click to change.");
|
||||
MEM_freeN(menustr);
|
||||
|
||||
|
||||
if (pose->active_group) {
|
||||
bActionGroup *grp= (bActionGroup *)BLI_findlink(&pose->agroups, pose->active_group-1);
|
||||
|
||||
/* active group */
|
||||
but= uiDefBut(block, TEX, REDRAWBUTSEDIT,"", xco+18,85,140-18-20,20, grp->name, 0, 63, 0, 0, "Displays current Pose Group name. Click to change.");
|
||||
uiButSetFunc(but, verify_posegroup_groupname, pose, grp);
|
||||
uiDefIconBut(block, BUT, B_POSEGRP_REMOVE, VICON_X, xco+140-20, 85, 20, 20, NULL, 0.0, 0.0, 0.0, 0.0, "Remove this Pose Group");
|
||||
|
||||
/* set custom color set */
|
||||
uiDefButI(block, MENU,B_POSEGRP_RECALC, "Custom Color Set%t|GrpCol: [None]%x0", xco,65,140,19, &grp->customCol, 0.0, 0.0, 0.0, 0.0, "Set of Custom Colors to shade Group's bones with. (NOT YET FUNCTIONAL)");
|
||||
}
|
||||
uiBlockEndAlign(block);
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
@ -2352,7 +2352,7 @@ static void group_ob_rem(void *gr_v, void *ob_v)
|
||||
Object *ob= OBACT;
|
||||
|
||||
rem_from_group(gr_v, ob);
|
||||
if(find_group(ob)==NULL) {
|
||||
if(find_group(ob, NULL)==NULL) {
|
||||
ob->flag &= ~OB_FROMGROUP;
|
||||
BASACT->flag &= ~OB_FROMGROUP;
|
||||
}
|
||||
@ -2496,19 +2496,25 @@ static void object_panel_anim(Object *ob)
|
||||
uiDefButI(block, NUM, REDRAWVIEW3D, "DupOn:", 170,85,146,19, &ob->dupon, 1.0, 1500.0, 0, 0, "Specify the number of frames to use between DupOff frames");
|
||||
uiDefButI(block, NUM, REDRAWVIEW3D, "DupEnd", 24,65,140,19, &ob->dupend, 1.0, 32767, 0, 0, "Specify endframe for Dupliframes");
|
||||
uiDefButI(block, NUM, REDRAWVIEW3D, "DupOff", 171,65,145,19, &ob->dupoff, 0.0, 1500.0, 0, 0, "Specify recurring frames to exclude from the Dupliframes");
|
||||
uiBlockBeginAlign(block);
|
||||
uiDefButBitS(block, TOG, OB_OFFS_OB, REDRAWALL, "Offs Ob", 24,35,56,20, &ob->ipoflag, 0, 0, 0, 0, "Not functional at the moment!");
|
||||
uiDefButBitS(block, TOG, OB_OFFS_PARENT, REDRAWALL, "Offs Par", 82,35,56,20 , &ob->ipoflag, 0, 0, 0, 0, "Let the timeoffset work on the parent");
|
||||
uiDefButBitS(block, TOG, OB_OFFS_PARTICLE, REDRAWALL, "Offs Particle", 140,35,103,20, &ob->ipoflag, 0, 0, 0, 0, "Let the timeoffset work on the particle effect");
|
||||
uiBlockEndAlign(block);
|
||||
|
||||
uiBlockBeginAlign(block);
|
||||
uiDefButF(block, NUM, REDRAWALL, "TimeOffset:", 24,10,115,20, &ob->sf, -MAXFRAMEF, MAXFRAMEF, 100, 0, "Specify an offset in frames");
|
||||
uiDefBut(block, BUT, B_AUTOTIMEOFS, "Automatic Time", 139,10,104,20, 0, 0, 0, 0, 0, "Generate automatic timeoffset values for all selected frames");
|
||||
uiDefBut(block, BUT, B_PRINTSPEED, "PrSpeed", 248,10,67,20, 0, 0, 0, 0, 0, "Print objectspeed");
|
||||
uiDefButF(block, NUM, REDRAWALL, "TimeOffset:", 24,35,115,20, &ob->sf, -MAXFRAMEF, MAXFRAMEF, 100, 0, "Animation offset in frames for ipo's and dupligroup instances");
|
||||
uiDefBut(block, BUT, B_AUTOTIMEOFS, "Auto", 139,35,34,20, 0, 0, 0, 0, 0, "Assign selected objects a timeoffset within a range, starting from the active object");
|
||||
uiDefBut(block, BUT, B_OFSTIMEOFS, "Ofs", 173,35,34,20, 0, 0, 0, 0, 0, "Offset selected objects timeoffset");
|
||||
uiDefBut(block, BUT, B_RANDTIMEOFS, "Rand", 207,35,34,20, 0, 0, 0, 0, 0, "Randomize selected objects timeoffset");
|
||||
uiDefBut(block, BUT, B_PRINTSPEED, "PrSpeed", 250,35,65,20, 0, 0, 0, 0, 0, "Print objectspeed");
|
||||
uiBlockEndAlign(block);
|
||||
|
||||
uiBlockBeginAlign(block);
|
||||
uiDefButBitS(block, TOG, OB_OFFS_OB, REDRAWALL, "OfsEdit", 24,10,56,20, &ob->ipoflag, 0, 0, 0, 0, "Use timeoffset when inserting keys and display timeoffset for ipo and action views");
|
||||
uiDefButBitS(block, TOG, OB_OFFS_PARENT, REDRAWALL, "OfsParent", 82,10,56,20 , &ob->ipoflag, 0, 0, 0, 0, "Apply the timeoffset to this objects parent relationship");
|
||||
uiDefButBitS(block, TOG, OB_OFFS_PARTICLE, REDRAWALL, "OfsParticle", 140,10,56,20, &ob->ipoflag, 0, 0, 0, 0, "Let the timeoffset work on the particle effect");
|
||||
uiDefButBitS(block, TOG, OB_OFFS_PARENTADD, REDRAWALL, "AddParent", 196,10,56,20, &ob->ipoflag, 0, 0, 0, 0, "Add the parents timeoffset value");
|
||||
uiBlockEndAlign(block);
|
||||
|
||||
sprintf(str, "%.4f", prspeed);
|
||||
uiDefBut(block, LABEL, 0, str, 247,35,63,31, NULL, 1.0, 0, 0, 0, "");
|
||||
uiDefBut(block, LABEL, 0, str, 260,10,63,31, NULL, 1.0, 0, 0, 0, "");
|
||||
|
||||
}
|
||||
|
||||
@ -2649,6 +2655,12 @@ void do_effects_panels(unsigned short event)
|
||||
case B_AUTOTIMEOFS:
|
||||
auto_timeoffs();
|
||||
break;
|
||||
case B_OFSTIMEOFS:
|
||||
ofs_timeoffs();
|
||||
break;
|
||||
case B_RANDTIMEOFS:
|
||||
rand_timeoffs();
|
||||
break;
|
||||
case B_FRAMEMAP:
|
||||
G.scene->r.framelen= G.scene->r.framapto;
|
||||
G.scene->r.framelen/= G.scene->r.images;
|
||||
@ -3451,15 +3463,18 @@ static void object_softbodies__enable_psys(void *ob_v, void *psys_v)
|
||||
|
||||
#ifdef _work_on_sb_solver
|
||||
static char sbsolvers[] = "Solver %t|RKP almost SOFT not usable but for some german teachers %x1|STU ip semi implicit euler%x3|SI1 (half step)adaptive semi implict euler %x2|SI2 (use dv)adaptive semi implict euler %x4|SOFT step size controlled midpoint(1rst choice for real softbodies)%x0";
|
||||
#else
|
||||
/* SIF would have been candidate .. well lack of time .. brecht is busy .. better make a stable version for peach now :) */
|
||||
static char sbsolvers[] = "SIF semi implicit euler with fixed step size (worth a try with real stiff egdes)%x3|SOFT step size controlled midpoint(1rst choice for real softbodies)%x0";
|
||||
#else
|
||||
static char sbsolvers[] = "SOFT step size controlled midpoint(1rst choice for real softbodies)%x0";
|
||||
#endif
|
||||
|
||||
static void object_softbodies_II(Object *ob)
|
||||
{
|
||||
SoftBody *sb=ob->soft;
|
||||
uiBlock *block;
|
||||
static int val;
|
||||
short *softflag=&ob->softflag, psys_cur=0,adaptive_mode;
|
||||
short *softflag=&ob->softflag, psys_cur=0, adaptive_mode=0;
|
||||
int ob_has_hair=psys_ob_has_hair(ob);
|
||||
if(!_can_softbodies_at_all(ob)) return;
|
||||
/*bah that is ugly! creating missing data members in UI code*/
|
||||
@ -3546,6 +3561,7 @@ static void object_softbodies_II(Object *ob)
|
||||
uiBlockBeginAlign(block);
|
||||
uiDefButS(block, MENU, B_SOFTBODY_CHANGE, sbsolvers,10,100,50,20, &sb->solver_ID, 14.0, 0.0, 0, 0, "Select Solver");
|
||||
/*some have adapive step size - some not*/
|
||||
sb->solver_ID = 0; /* ugly hack to prepare peach freeze */
|
||||
switch (sb->solver_ID) {
|
||||
case 0:
|
||||
case 1:
|
||||
@ -3998,9 +4014,13 @@ static void object_panel_particle_extra(Object *ob)
|
||||
buty=butx=160;
|
||||
|
||||
uiDefButI(block, NUM, B_PART_DISTR, "Seed:", butx,(buty-=buth),butw,buth, &psys->seed, 0.0, 255.0, 1, 0, "Set an offset in the random table");
|
||||
if(part->type == PART_HAIR && psys->flag & PSYS_EDITED)
|
||||
uiDefButF(block, NUM, B_PART_RECALC, "Stiff:", butx,(buty-=buth),butw,buth, &part->eff_hair, 0.0, 1.0, 0, 0, "Hair stiffness for effectors");
|
||||
else
|
||||
buty-=buth;
|
||||
|
||||
/* size changes must create a recalc event always so that sizes are updated properly */
|
||||
uiDefButF(block, NUM, B_PART_RECALC, "Size:", butx,(buty-=2*buth),butw,buth, &part->size, 0.01, 100, 10, 1, "The size of the particles");
|
||||
uiDefButF(block, NUM, B_PART_RECALC, "Size:", butx,(buty-=buth),butw,buth, &part->size, 0.01, 100, 10, 1, "The size of the particles");
|
||||
uiDefButF(block, NUM, B_PART_RECALC, "Rand:", butx,(buty-=buth),butw,buth, &part->randsize, 0.0, 2.0, 10, 1, "Give the particle size a random variation");
|
||||
|
||||
uiDefButBitI(block, TOG, PART_SIZEMASS, B_PART_RECALC, "Mass from size", butx,(buty-=buth),butw,buth, &part->flag, 0, 0, 0, 0, "Multiply mass with particle size");
|
||||
|
@ -579,26 +579,33 @@ static void seq_panel_editing()
|
||||
130, 80, 120, 20, &last_seq->machine,
|
||||
0.0, MAXSEQ, 0.0, 0.0, "Channel used (Y position)");
|
||||
|
||||
if (last_seq->type == SEQ_IMAGE) {
|
||||
if (check_single_seq(last_seq)) {
|
||||
uiDefButI(block, NUM,
|
||||
B_SEQ_BUT_TRANSFORM, "Start-Still",
|
||||
10, 60, 120, 20, &last_seq->startstill,
|
||||
0.0, MAXFRAMEF, 0.0, 0.0, "Start still");
|
||||
uiDefButI(block, NUM,
|
||||
B_SEQ_BUT_TRANSFORM, "End-Still",
|
||||
130, 60, 120, 19, &last_seq->endstill,
|
||||
0.0, MAXFRAMEF, 0.0, 0.0, "End still");
|
||||
B_SEQ_BUT_TRANSFORM, "End-Still",
|
||||
130, 60, 120, 19, &last_seq->endstill,
|
||||
0.0, MAXFRAMEF, 0.0, 0.0, "End still");
|
||||
} else {
|
||||
uiDefButI(block, NUM,
|
||||
B_SEQ_BUT_TRANSFORM, "Start-Ofs",
|
||||
10, 60, 120, 20, &last_seq->startofs,
|
||||
0.0, last_seq->len - last_seq->endofs,
|
||||
0.0, 0.0, "Start offset");
|
||||
uiDefButI(block, NUM,
|
||||
B_SEQ_BUT_TRANSFORM, "End-Ofs",
|
||||
130, 60, 120, 19, &last_seq->endofs,
|
||||
0.0, last_seq->len - last_seq->startofs,
|
||||
0.0, 0.0, "End offset");
|
||||
if (last_seq->type == SEQ_IMAGE) {
|
||||
uiDefButI(block, NUM,
|
||||
B_SEQ_BUT_TRANSFORM, "Start-Still",
|
||||
10, 60, 120, 20, &last_seq->startstill,
|
||||
0.0, MAXFRAMEF, 0.0, 0.0, "Start still");
|
||||
uiDefButI(block, NUM,
|
||||
B_SEQ_BUT_TRANSFORM, "End-Still",
|
||||
130, 60, 120, 19, &last_seq->endstill,
|
||||
0.0, MAXFRAMEF, 0.0, 0.0, "End still");
|
||||
} else {
|
||||
uiDefButI(block, NUM,
|
||||
B_SEQ_BUT_TRANSFORM, "Start-Ofs",
|
||||
10, 60, 120, 20, &last_seq->startofs,
|
||||
0.0, last_seq->len - last_seq->endofs,
|
||||
0.0, 0.0, "Start offset");
|
||||
uiDefButI(block, NUM,
|
||||
B_SEQ_BUT_TRANSFORM, "End-Ofs",
|
||||
130, 60, 120, 19, &last_seq->endofs,
|
||||
0.0, last_seq->len - last_seq->startofs,
|
||||
0.0, 0.0, "End offset");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1121,6 +1128,8 @@ void do_sequencer_panels(unsigned short event)
|
||||
break;
|
||||
case B_SEQ_BUT_TRANSFORM:
|
||||
calc_sequence(last_seq);
|
||||
if (test_overlap_seq(last_seq))
|
||||
shuffle_seq(last_seq);
|
||||
break;
|
||||
}
|
||||
|
||||
@ -1156,12 +1165,6 @@ static void backbuf_pic(char *name)
|
||||
BIF_undo_push("Change background picture");
|
||||
}
|
||||
|
||||
static void ftype_pic(char *name)
|
||||
{
|
||||
strcpy(G.scene->r.ftype, name);
|
||||
allqueue(REDRAWBUTSSCENE, 0);
|
||||
}
|
||||
|
||||
static void run_playanim(char *file)
|
||||
{
|
||||
extern char bprogname[]; /* usiblender.c */
|
||||
@ -1261,15 +1264,6 @@ void do_render_panels(unsigned short event)
|
||||
activate_fileselect(FILE_SPECIAL, "SELECT BACKBUF PICTURE", G.scene->r.backbuf, backbuf_pic);
|
||||
break;
|
||||
|
||||
case B_FS_FTYPE:
|
||||
sa= closest_bigger_area();
|
||||
areawinset(sa->win);
|
||||
if(G.qual == LR_CTRLKEY)
|
||||
activate_imageselect(FILE_SPECIAL, "SELECT FTYPE", G.scene->r.ftype, ftype_pic);
|
||||
else
|
||||
activate_fileselect(FILE_SPECIAL, "SELECT FTYPE", G.scene->r.ftype, ftype_pic);
|
||||
break;
|
||||
|
||||
case B_PR_PAL:
|
||||
G.scene->r.xsch= 720;
|
||||
G.scene->r.ysch= 576;
|
||||
@ -1832,7 +1826,6 @@ static void render_panel_output(void)
|
||||
uiBlock *block;
|
||||
char *strp;
|
||||
|
||||
|
||||
block= uiNewBlock(&curarea->uiblocks, "render_panel_output", UI_EMBOSS, UI_HELV, curarea->win);
|
||||
if(uiNewPanel(curarea, block, "Output", "Render", 0, 0, 318, 204)==0) return;
|
||||
|
||||
@ -1841,17 +1834,19 @@ static void render_panel_output(void)
|
||||
uiDefBut(block, TEX,0,"", 31, 190, 279, 20,G.scene->r.pic, 0.0,79.0, 0, 0, "Directory/name to save rendered Pics to");
|
||||
uiDefIconBut(block, BUT,B_FS_BACKBUF, ICON_FILESEL, 10, 168, 20, 20, 0, 0, 0, 0, 0, "Open Fileselect to get Backbuf image");
|
||||
uiDefBut(block, TEX,0,"", 31, 168, 279, 20,G.scene->r.backbuf, 0.0,79.0, 0, 0, "Image to use as background for rendering");
|
||||
uiDefIconBut(block, BUT,B_FS_FTYPE, ICON_FILESEL, 10, 146, 20, 20, 0, 0, 0, 0, 0, "Open Fileselect to get Ftype image");
|
||||
uiDefBut(block, TEX,0,"", 31, 146, 279, 20,G.scene->r.ftype,0.0,79.0, 0, 0, "Image to use with FTYPE Image type");
|
||||
uiBlockEndAlign(block);
|
||||
|
||||
uiBlockBeginAlign(block);
|
||||
uiDefButBitI(block, TOG, R_NO_OVERWRITE, B_NOP, "No Overwrite", 10, 142, 90, 20, &G.scene->r.mode, 0.0, 0.0, 0, 0, "Skip rendering frames when the file exists (image output only)");
|
||||
uiDefButBitI(block, TOG, R_TOUCH, B_NOP, "Touch", 100, 142, 50, 20, &G.scene->r.mode, 0.0, 0.0, 0, 0, "Create an empty file before rendering each frame");
|
||||
uiBlockEndAlign(block);
|
||||
|
||||
/* SET BUTTON */
|
||||
uiBlockBeginAlign(block);
|
||||
id= (ID *)G.scene->set;
|
||||
IDnames_to_pupstring(&strp, NULL, NULL, &(G.main->scene), id, &(G.buts->menunr));
|
||||
if(strp[0])
|
||||
uiDefButS(block, MENU, B_SETBROWSE, strp, 10, 120, 20, 20, &(G.buts->menunr), 0, 0, 0, 0, "Scene to link as a Set");
|
||||
uiDefButS(block, MENU, B_SETBROWSE, strp, 10, 114, 20, 20, &(G.buts->menunr), 0, 0, 0, 0, "Scene to link as a Set");
|
||||
MEM_freeN(strp);
|
||||
|
||||
if(G.scene->set) {
|
||||
@ -1863,8 +1858,8 @@ static void render_panel_output(void)
|
||||
uiBlockEndAlign(block);
|
||||
|
||||
uiBlockSetCol(block, TH_BUT_SETTING1);
|
||||
uiDefButBitS(block, TOG, R_BACKBUF, B_NOP,"Backbuf", 10, 94, 80, 20, &G.scene->r.bufflag, 0, 0, 0, 0, "Enable/Disable use of Backbuf image");
|
||||
uiDefButS(block, NUM, B_NOP, "Threads:", 10, 68, 100, 20, &G.scene->r.threads, 1, BLENDER_MAX_THREADS, 0, 0, "Amount of threads for render (takes advantage of multi-core and multi-processor computers)");
|
||||
uiDefButBitS(block, TOG, R_BACKBUF, B_NOP,"Backbuf", 10, 89, 80, 20, &G.scene->r.bufflag, 0, 0, 0, 0, "Enable/Disable use of Backbuf image");
|
||||
uiDefButS(block, NUM, B_NOP, "Threads:", 10, 63, 100, 20, &G.scene->r.threads, 1, BLENDER_MAX_THREADS, 0, 0, "Amount of threads for render (takes advantage of multi-core and multi-processor computers)");
|
||||
uiBlockSetCol(block, TH_AUTO);
|
||||
|
||||
uiBlockBeginAlign(block);
|
||||
@ -1878,20 +1873,18 @@ static void render_panel_output(void)
|
||||
uiDefButS(block, MENU, B_REDR, "Render Display %t|Render Window %x1|Image Editor %x0|Full Screen %x2",
|
||||
72, 10, 120, 19, &G.displaymode, 0.0, (float)R_DISPLAYWIN, 0, 0, "Sets render output display");
|
||||
|
||||
uiDefButBitS(block, TOG, R_EXTENSION, B_NOP, "Extensions", 205, 10, 105, 19, &G.scene->r.scemode, 0.0, 0.0, 0, 0, "Adds filetype extensions to the filename when rendering animations");
|
||||
|
||||
/* Dither control */
|
||||
uiDefButF(block, NUM,B_DIFF, "Dither:", 205,31,105,19, &G.scene->r.dither_intensity, 0.0, 2.0, 0, 0, "The amount of dithering noise present in the output image (0.0 = no dithering)");
|
||||
|
||||
/* Toon shading buttons */
|
||||
uiBlockBeginAlign(block);
|
||||
uiDefButBitI(block, TOG, R_EDGE, B_NOP,"Edge", 100, 94, 70, 20, &G.scene->r.mode, 0, 0, 0, 0, "Enable Toon Edge-enhance");
|
||||
uiDefBlockBut(block, edge_render_menu, NULL, "Edge Settings", 170, 94, 140, 20, "Display Edge settings");
|
||||
uiDefButBitI(block, TOG, R_EDGE, B_NOP,"Edge", 100, 89, 70, 20, &G.scene->r.mode, 0, 0, 0, 0, "Enable Toon Edge-enhance");
|
||||
uiDefBlockBut(block, edge_render_menu, NULL, "Edge Settings", 170, 89, 140, 20, "Display Edge settings");
|
||||
uiBlockEndAlign(block);
|
||||
|
||||
uiBlockBeginAlign(block);
|
||||
uiDefButBitS(block, TOG, R_NO_TEX, B_NOP, "Disable Tex", 115, 68, 70, 20, &G.scene->r.scemode, 0.0, 0.0, 0, 0, "Disables Textures for render");
|
||||
uiDefButBitS(block, TOG, R_FREE_IMAGE, B_NOP, "Free Tex Images", 205, 68, 100, 20, &G.scene->r.scemode, 0.0, 0.0, 0, 0, "Frees all Images used by Textures after each render");
|
||||
uiDefButBitS(block, TOG, R_NO_TEX, B_NOP, "Disable Tex", 115, 63, 70, 20, &G.scene->r.scemode, 0.0, 0.0, 0, 0, "Disables Textures for render");
|
||||
uiDefButBitS(block, TOG, R_FREE_IMAGE, B_NOP, "Free Tex Images", 205, 63, 100, 20, &G.scene->r.scemode, 0.0, 0.0, 0, 0, "Frees all Images used by Textures after each render");
|
||||
uiBlockEndAlign(block);
|
||||
}
|
||||
|
||||
@ -2650,7 +2643,8 @@ static void render_panel_layers(void)
|
||||
uiDefButBitI(block, TOG, SCE_PASS_VECTOR, B_SET_PASS,"Vec", 120, 30, 40, 20, &srl->passflag, 0, 0, 0, 0, "Deliver Speed Vector pass");
|
||||
uiDefButBitI(block, TOG, SCE_PASS_NORMAL, B_SET_PASS,"Nor", 160, 30, 40, 20, &srl->passflag, 0, 0, 0, 0, "Deliver Normal pass");
|
||||
uiDefButBitI(block, TOG, SCE_PASS_UV, B_SET_PASS,"UV", 200, 30, 40, 20, &srl->passflag, 0, 0, 0, 0, "Deliver Texture UV pass");
|
||||
uiDefButBitI(block, TOG, SCE_PASS_INDEXOB, B_SET_PASS,"IndexOb",240, 30, 70, 20, &srl->passflag, 0, 0, 0, 0, "Deliver Object Index pass");
|
||||
uiDefButBitI(block, TOG, SCE_PASS_MIST, B_SET_PASS,"Mist", 240, 30, 35, 20, &srl->passflag, 0, 0, 0, 0, "Deliver Mist factor pass (0-1)");
|
||||
uiDefButBitI(block, TOG, SCE_PASS_INDEXOB, B_SET_PASS,"Index", 275, 30, 35, 20, &srl->passflag, 0, 0, 0, 0, "Deliver Object Index pass");
|
||||
|
||||
uiDefButBitI(block, TOG, SCE_PASS_RGBA, B_SET_PASS,"Col", 10, 10, 35, 20, &srl->passflag, 0, 0, 0, 0, "Deliver shade-less Color pass");
|
||||
uiDefButBitI(block, TOG, SCE_PASS_DIFFUSE, B_SET_PASS,"Diff", 45, 10, 35, 20, &srl->passflag, 0, 0, 0, 0, "Deliver Diffuse pass");
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user