This commit is contained in:
Andre Susano Pinto 2008-08-18 14:33:26 +00:00
parent a88eb64f70
commit 2ce338f7e8
151 changed files with 3599 additions and 4156 deletions

@ -63,7 +63,6 @@ OPTION(WITH_QUICKTIME "Enable Quicktime Support" OFF)
OPTION(WITH_OPENEXR "Enable OpenEXR Support (http://www.openexr.com)" ON)
OPTION(WITH_FFMPEG "Enable FFMPeg Support (http://ffmpeg.mplayerhq.hu/)" OFF)
OPTION(WITH_OPENAL "Enable OpenAL Support (http://www.openal.org)" ON)
OPTION(YESIAMSTUPID "Enable execution on 64-bit platforms" OFF)
OPTION(WITH_OPENMP "Enable OpenMP (has to be supported by the compiler)" OFF)
IF(NOT WITH_GAMEENGINE AND WITH_PLAYER)

@ -0,0 +1,125 @@
/**
* $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) 2001-2002 by NaN Holding BV.
* All rights reserved.
*
* The Original Code is: all of this file.
*
* Contributor(s): none yet.
*
* ***** END GPL LICENSE BLOCK *****
* A platform-independent definition of [u]intXX_t
* Plus the accompanying header include for htonl/ntohl
*
* This file includes <sys/types.h> to define [u]intXX_t types, where
* XX can be 8, 16, 32 or 64. Unfortunately, not all systems have this
* file.
* - Windows uses __intXX compiler-builtin types. These are signed,
* so we have to flip the signs.
* For these rogue platforms, we make the typedefs ourselves.
*
*/
/*
// DG: original BLO_sys_types.h is in source/blender/blenkernel
// but is not allowed be accessed here because of bad-level-call
*/
#ifndef BLO_SYS_TYPES_H
#define BLO_SYS_TYPES_H
#ifdef __cplusplus
extern "C" {
#endif
#if defined(_WIN32) && !defined(FREE_WINDOWS)
/* The __intXX are built-in types of the visual complier! So we don't
* need to include anything else here. */
typedef signed __int8 int8_t;
typedef signed __int16 int16_t;
typedef signed __int32 int32_t;
typedef signed __int64 int64_t;
typedef unsigned __int8 uint8_t;
typedef unsigned __int16 uint16_t;
typedef unsigned __int32 uint32_t;
typedef unsigned __int64 uint64_t;
#ifndef _INTPTR_T_DEFINED
#ifdef _WIN64
typedef __int64 intptr_t;
#else
typedef long intptr_t;
#endif
#define _INTPTR_T_DEFINED
#endif
#ifndef _UINTPTR_T_DEFINED
#ifdef _WIN64
typedef unsigned __int64 uintptr_t;
#else
typedef unsigned long uintptr_t;
#endif
#define _UINTPTR_T_DEFINED
#endif
#elif defined(__linux__)
/* Linux-i386, Linux-Alpha, Linux-ppc */
#include <stdint.h>
#elif defined (__APPLE__)
#include <inttypes.h>
#elif defined(FREE_WINDOWS)
#include <stdint.h>
#else
/* FreeBSD, Irix, Solaris */
#include <sys/types.h>
#endif /* ifdef platform for types */
#ifdef _WIN32
#ifndef htonl
#define htonl(x) correctByteOrder(x)
#endif
#ifndef ntohl
#define ntohl(x) correctByteOrder(x)
#endif
#elif defined (__FreeBSD__) || defined (__OpenBSD__)
#include <sys/param.h>
#elif defined (__APPLE__)
#include <sys/types.h>
#else /* irix sun linux */
#include <netinet/in.h>
#endif /* ifdef platform for htonl/ntohl */
#ifdef __cplusplus
}
#endif
#endif /* eof */

@ -49,6 +49,8 @@
#include "MEM_guardedalloc.h"
#include "BLO_sys_types.h" // needed for intptr_t
/* --------------------------------------------------------------------- */
/* Data definition */
/* --------------------------------------------------------------------- */
@ -112,7 +114,7 @@ static const char *check_memlist(MemHead *memh);
volatile int totblock= 0;
volatile unsigned long mem_in_use= 0, mmap_in_use= 0;
volatile uintptr_t mem_in_use= 0, mmap_in_use= 0;
static volatile struct localListBase _membase;
static volatile struct localListBase *membase = &_membase;
@ -335,7 +337,7 @@ void *MEM_mapallocN(unsigned int len, const char *str)
/* Memory statistics print */
typedef struct MemPrintBlock {
const char *name;
unsigned long len;
uintptr_t len;
int items;
} MemPrintBlock;
@ -485,14 +487,14 @@ short MEM_freeN(void *vmemh) /* anders compileertie niet meer */
return(-1);
}
if(sizeof(long)==8) {
if (((long) memh) & 0x7) {
if(sizeof(intptr_t)==8) {
if (((intptr_t) memh) & 0x7) {
MemorY_ErroR("free","attempt to free illegal pointer");
return(-1);
}
}
else {
if (((long) memh) & 0x3) {
if (((intptr_t) memh) & 0x3) {
MemorY_ErroR("free","attempt to free illegal pointer");
return(-1);
}

@ -151,7 +151,7 @@ void *mmap(void *start, size_t len, int prot, int flags, int fd, off_t offset)
}
/* munmap for windows */
long munmap(void *ptr, long size)
intptr_t munmap(void *ptr, intptr_t size)
{
MemMap *mm = mmap_findlink(mmapbase, ptr);
if (!mm) {

@ -261,6 +261,9 @@ ECHO Done
<Filter
Name="extern"
Filter="">
<File
RelativePath="..\..\BLO_sys_types.h">
</File>
<File
RelativePath="..\..\MEM_guardedalloc.h">
</File>

@ -45,8 +45,10 @@
#define MAP_FAILED ((void *)-1)
#include "BLO_sys_types.h" // needed for intptr_t
void *mmap(void *start, size_t len, int prot, int flags, int fd, off_t offset);
long munmap(void *ptr, long size);
intptr_t munmap(void *ptr, intptr_t size);
#endif

@ -715,6 +715,9 @@ ECHO Done
<Filter
Name="superlu"
Filter="">
<File
RelativePath="..\..\superlu\BLO_sys_types.h">
</File>
<File
RelativePath="..\..\superlu\Cnames.h">
</File>

@ -0,0 +1,125 @@
/**
* $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) 2001-2002 by NaN Holding BV.
* All rights reserved.
*
* The Original Code is: all of this file.
*
* Contributor(s): none yet.
*
* ***** END GPL LICENSE BLOCK *****
* A platform-independent definition of [u]intXX_t
* Plus the accompanying header include for htonl/ntohl
*
* This file includes <sys/types.h> to define [u]intXX_t types, where
* XX can be 8, 16, 32 or 64. Unfortunately, not all systems have this
* file.
* - Windows uses __intXX compiler-builtin types. These are signed,
* so we have to flip the signs.
* For these rogue platforms, we make the typedefs ourselves.
*
*/
/*
// DG: original BLO_sys_types.h is in source/blender/blenkernel
// but is not allowed be accessed here because of bad-level-call
*/
#ifndef BLO_SYS_TYPES_H
#define BLO_SYS_TYPES_H
#ifdef __cplusplus
extern "C" {
#endif
#if defined(_WIN32) && !defined(FREE_WINDOWS)
/* The __intXX are built-in types of the visual complier! So we don't
* need to include anything else here. */
typedef signed __int8 int8_t;
typedef signed __int16 int16_t;
typedef signed __int32 int32_t;
typedef signed __int64 int64_t;
typedef unsigned __int8 uint8_t;
typedef unsigned __int16 uint16_t;
typedef unsigned __int32 uint32_t;
typedef unsigned __int64 uint64_t;
#ifndef _INTPTR_T_DEFINED
#ifdef _WIN64
typedef __int64 intptr_t;
#else
typedef long intptr_t;
#endif
#define _INTPTR_T_DEFINED
#endif
#ifndef _UINTPTR_T_DEFINED
#ifdef _WIN64
typedef unsigned __int64 uintptr_t;
#else
typedef unsigned long uintptr_t;
#endif
#define _UINTPTR_T_DEFINED
#endif
#elif defined(__linux__)
/* Linux-i386, Linux-Alpha, Linux-ppc */
#include <stdint.h>
#elif defined (__APPLE__)
#include <inttypes.h>
#elif defined(FREE_WINDOWS)
#include <stdint.h>
#else
/* FreeBSD, Irix, Solaris */
#include <sys/types.h>
#endif /* ifdef platform for types */
#ifdef _WIN32
#ifndef htonl
#define htonl(x) correctByteOrder(x)
#endif
#ifndef ntohl
#define ntohl(x) correctByteOrder(x)
#endif
#elif defined (__FreeBSD__) || defined (__OpenBSD__)
#include <sys/param.h>
#elif defined (__APPLE__)
#include <sys/types.h>
#else /* irix sun linux */
#include <netinet/in.h>
#endif /* ifdef platform for htonl/ntohl */
#ifdef __cplusplus
}
#endif
#endif /* eof */

@ -8,6 +8,8 @@
*/
#include "ssp_defs.h"
#include "BLO_sys_types.h" // needed for intptr_t
/* Constants */
#define NO_MEMTYPE 4 /* 0: lusup;
1: ucol;
@ -49,8 +51,8 @@ static int no_expand;
/* Macros to manipulate stack */
#define StackFull(x) ( x + stack.used >= stack.size )
#define NotDoubleAlign(addr) ( (long int)addr & 7 )
#define DoubleAlign(addr) ( ((long int)addr + 7) & ~7L )
#define NotDoubleAlign(addr) ( (intptr_t)addr & 7 )
#define DoubleAlign(addr) ( ((intptr_t)addr + 7) & ~7L )
#define TempSpace(m, w) ( (2*w + 4 + NO_MARKER) * m * sizeof(int) + \
(w + 1) * m * sizeof(float) )
#define Reduce(alpha) ((alpha + 1) / 2) /* i.e. (alpha-1)/2 + 1 */
@ -611,8 +613,8 @@ sStackCompress(GlobalLU_t *Glu)
last = (char*)usub + xusub[ndim] * iword;
fragment = (char*) (((char*)stack.array + stack.top1) - last);
stack.used -= (long int) fragment;
stack.top1 -= (long int) fragment;
stack.used -= (intptr_t) fragment;
stack.top1 -= (intptr_t) fragment;
Glu->ucol = ucol;
Glu->lsub = lsub;

@ -347,6 +347,9 @@
<File
RelativePath="..\..\..\source\gameengine\GameLogic\SCA_ANDController.cpp">
</File>
<File
RelativePath="..\..\..\source\gameengine\GameLogic\SCA_DelaySensor.cpp">
</File>
<File
RelativePath="..\..\..\source\gameengine\GameLogic\SCA_EventManager.cpp">
</File>
@ -465,6 +468,9 @@
<File
RelativePath="..\..\..\source\gameengine\GameLogic\SCA_ANDController.h">
</File>
<File
RelativePath="..\..\..\source\gameengine\GameLogic\SCA_DelaySensor.h">
</File>
<File
RelativePath="..\..\..\source\gameengine\GameLogic\SCA_EventManager.h">
</File>

@ -125,7 +125,7 @@
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="..\..\..\..\build\msvc_7\intern\string\include;..\..\..\..\build\msvc_7\intern\moto\include"
AdditionalIncludeDirectories="..\..\..\..\build\msvc_7\intern\string\include;..\..\..\..\build\msvc_7\intern\moto\include;..\..\..\..\build\msvc_7\intern\guardedalloc\include"
PreprocessorDefinitions="_DEBUG,WIN32,_LIB"
BasicRuntimeChecks="3"
RuntimeLibrary="1"
@ -177,7 +177,7 @@
<Tool
Name="VCCLCompilerTool"
InlineFunctionExpansion="1"
AdditionalIncludeDirectories="..\..\..\..\build\msvc_7\intern\string\include;..\..\..\..\build\msvc_7\intern\moto\include"
AdditionalIncludeDirectories="..\..\..\..\build\msvc_7\intern\string\include;..\..\..\..\build\msvc_7\intern\moto\include;..\..\..\..\build\msvc_7\intern\guardedalloc\include"
PreprocessorDefinitions="NDEBUG,WIN32,_LIB"
StringPooling="TRUE"
RuntimeLibrary="0"
@ -229,7 +229,7 @@
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="..\..\..\..\build\msvc_7\intern\string\include;..\..\..\..\build\msvc_7\intern\moto\include"
AdditionalIncludeDirectories="..\..\..\..\build\msvc_7\intern\string\include;..\..\..\..\build\msvc_7\intern\moto\include;..\..\..\..\build\msvc_7\intern\guardedalloc\include"
PreprocessorDefinitions="_DEBUG,WIN32,_LIB"
BasicRuntimeChecks="3"
RuntimeLibrary="1"
@ -281,7 +281,7 @@
<Tool
Name="VCCLCompilerTool"
InlineFunctionExpansion="1"
AdditionalIncludeDirectories="..\..\..\..\build\msvc_7\intern\string\include;..\..\..\..\build\msvc_7\intern\moto\include"
AdditionalIncludeDirectories="..\..\..\..\build\msvc_7\intern\string\include;..\..\..\..\build\msvc_7\intern\moto\include;..\..\..\..\build\msvc_7\intern\guardedalloc\include"
PreprocessorDefinitions="NDEBUG,WIN32,_LIB"
StringPooling="TRUE"
RuntimeLibrary="0"

@ -1 +1 @@
2.46
2.47

@ -35,7 +35,7 @@ int main(int argc, char**argv) {
FILE *fpin, *fpout;
char cname[256];
char sizest[256];
long size;
size_t size;
int i;
if (argc<1) {

Binary file not shown.

Before

Width:  |  Height:  |  Size: 93 KiB

After

Width:  |  Height:  |  Size: 50 KiB

@ -40,8 +40,8 @@ extern "C" {
struct ListBase;
struct MemFile;
#define BLENDER_VERSION 246
#define BLENDER_SUBVERSION 1
#define BLENDER_VERSION 247
#define BLENDER_SUBVERSION 0
#define BLENDER_MINVERSION 245
#define BLENDER_MINSUBVERSION 15

@ -32,9 +32,11 @@
#ifndef BKE_CUSTOMDATA_H
#define BKE_CUSTOMDATA_H
#include "BLO_sys_types.h" // for intptr_t support
struct CustomData;
struct CustomDataLayer;
typedef long CustomDataMask;
typedef intptr_t CustomDataMask;
extern const CustomDataMask CD_MASK_BAREMESH;
extern const CustomDataMask CD_MASK_MESH;

@ -37,6 +37,7 @@ struct Effect;
struct ListBase;
struct Particle;
struct Group;
struct RNG;
typedef struct pEffectorCache {
struct pEffectorCache *next, *prev;
@ -64,6 +65,11 @@ struct ListBase *pdInitEffectors(struct Object *obsrc, struct Group *group);
void pdEndEffectors(struct ListBase *lb);
void pdDoEffectors(struct ListBase *lb, float *opco, float *force, float *speed, float cur_time, float loc_time, unsigned int flags);
/* required for particle_system.c */
void do_physical_effector(short type, float force_val, float distance, float falloff, float size, float damp, float *eff_velocity, float *vec_to_part, float *velocity, float *field, int planar, struct RNG *rng, float noise);
float effector_falloff(struct PartDeflect *pd, float *eff_velocity, float *vec_to_part);
#endif

@ -33,11 +33,11 @@
#define BKE_ENDIANNESS(a) { \
union { \
long l; \
char c[sizeof (long)]; \
intptr_t l; \
char c[sizeof (intptr_t)]; \
} u; \
u.l = 1; \
a = (u.c[sizeof (long) - 1] == 1) ? 1 : 0; \
a = (u.c[sizeof (intptr_t) - 1] == 1) ? 1 : 0; \
}
#endif

@ -197,8 +197,8 @@
/* Warning-free macros for storing ints in pointers. Use these _only_
* for storing an int in a pointer, not a pointer in an int (64bit)! */
#define SET_INT_IN_POINTER(i) ((void*)(long)(i))
#define GET_INT_FROM_POINTER(i) ((int)(long)(i))
#define SET_INT_IN_POINTER(i) ((void*)(intptr_t)(i))
#define GET_INT_FROM_POINTER(i) ((int)(intptr_t)(i))
#endif

@ -7,6 +7,8 @@
#include "CCGSubSurf.h"
#include "BLO_sys_types.h" // for intptr_t support
/***/
typedef unsigned char byte;
@ -35,7 +37,7 @@ typedef struct _EHash {
#define EHASH_alloc(eh, nb) ((eh)->allocatorIFC.alloc((eh)->allocator, nb))
#define EHASH_free(eh, ptr) ((eh)->allocatorIFC.free((eh)->allocator, ptr))
#define EHASH_hash(eh, item) (((unsigned long) (item))%((unsigned int) (eh)->curSize))
#define EHASH_hash(eh, item) (((uintptr_t) (item))%((unsigned int) (eh)->curSize))
static EHash *_ehash_new(int estimatedNumEntries, CCGAllocatorIFC *allocatorIFC, CCGAllocatorHDL allocator) {
EHash *eh = allocatorIFC->alloc(allocator, sizeof(*eh));

@ -79,6 +79,8 @@
#include "BKE_utildefines.h"
#include "BKE_particle.h"
#include "BLO_sys_types.h" // for intptr_t support
#ifdef WITH_VERSE
#include "BKE_verse.h"
#endif
@ -479,7 +481,7 @@ static void emDM_foreachMappedEdge(DerivedMesh *dm, void (*func)(void *userData,
EditVert *eve;
for (i=0,eve=emdm->em->verts.first; eve; eve= eve->next)
eve->tmp.l = (long) i++;
eve->tmp.l = (intptr_t) i++;
for(i=0,eed= emdm->em->edges.first; eed; i++,eed= eed->next)
func(userData, i, emdm->vertexCos[(int) eed->v1->tmp.l], emdm->vertexCos[(int) eed->v2->tmp.l]);
} else {
@ -497,7 +499,7 @@ static void emDM_drawMappedEdges(DerivedMesh *dm, int (*setDrawOptions)(void *us
EditVert *eve;
for (i=0,eve=emdm->em->verts.first; eve; eve= eve->next)
eve->tmp.l = (long) i++;
eve->tmp.l = (intptr_t) i++;
glBegin(GL_LINES);
for(i=0,eed= emdm->em->edges.first; eed; i++,eed= eed->next) {
@ -532,7 +534,7 @@ static void emDM_drawMappedEdgesInterp(DerivedMesh *dm, int (*setDrawOptions)(vo
EditVert *eve;
for (i=0,eve=emdm->em->verts.first; eve; eve= eve->next)
eve->tmp.l = (long) i++;
eve->tmp.l = (intptr_t) i++;
glBegin(GL_LINES);
for (i=0,eed= emdm->em->edges.first; eed; i++,eed= eed->next) {
@ -619,7 +621,7 @@ static void emDM_foreachMappedFaceCenter(DerivedMesh *dm, void (*func)(void *use
if (emdm->vertexCos) {
for (i=0,eve=emdm->em->verts.first; eve; eve= eve->next)
eve->tmp.l = (long) i++;
eve->tmp.l = (intptr_t) i++;
}
for(i=0,efa= emdm->em->faces.first; efa; i++,efa= efa->next) {
@ -637,7 +639,7 @@ static void emDM_drawMappedFaces(DerivedMesh *dm, int (*setDrawOptions)(void *us
EditVert *eve;
for (i=0,eve=emdm->em->verts.first; eve; eve= eve->next)
eve->tmp.l = (long) i++;
eve->tmp.l = (intptr_t) i++;
for (i=0,efa= emdm->em->faces.first; efa; i++,efa= efa->next) {
int drawSmooth = (efa->flag & ME_SMOOTH);
@ -733,7 +735,7 @@ static void emDM_drawFacesTex_common(DerivedMesh *dm,
EditVert *eve;
for (i=0,eve=em->verts.first; eve; eve= eve->next)
eve->tmp.l = (long) i++;
eve->tmp.l = (intptr_t) i++;
for (i=0,efa= em->faces.first; efa; i++,efa= efa->next) {
MTFace *tf= CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
@ -1053,7 +1055,7 @@ void emDM_copyEdgeArray(DerivedMesh *dm, MEdge *edge_r)
/* store vertex indices in tmp union */
for(ev = em->verts.first, i = 0; ev; ev = ev->next, ++i)
ev->tmp.l = (long) i;
ev->tmp.l = (intptr_t) i;
for( ; ee; ee = ee->next, ++edge_r) {
edge_r->crease = (unsigned char) (ee->crease*255.0f);
@ -1081,7 +1083,7 @@ void emDM_copyFaceArray(DerivedMesh *dm, MFace *face_r)
/* store vertexes indices in tmp union */
for(ev = em->verts.first, i = 0; ev; ev = ev->next, ++i)
ev->tmp.l = (long) i;
ev->tmp.l = (intptr_t) i;
for( ; ef; ef = ef->next, ++face_r) {
face_r->mat_nr = ef->mat_nr;
@ -1168,7 +1170,7 @@ static DerivedMesh *getEditMeshDerivedMesh(EditMesh *em, Object *ob,
int i;
for (i=0,eve=em->verts.first; eve; eve= eve->next)
eve->tmp.l = (long) i++;
eve->tmp.l = (intptr_t) i++;
emdm->vertexNos = MEM_callocN(sizeof(*emdm->vertexNos)*i, "emdm_vno");
emdm->faceNos = MEM_mallocN(sizeof(*emdm->faceNos)*totface, "emdm_vno");

@ -155,7 +155,7 @@ void cloth_init ( ClothModifierData *clmd )
BVHTree *bvhselftree_build_from_cloth (ClothModifierData *clmd, float epsilon)
{
int i;
unsigned int i;
BVHTree *bvhtree;
Cloth *cloth = clmd->clothObject;
ClothVertex *verts;
@ -196,7 +196,7 @@ BVHTree *bvhselftree_build_from_cloth (ClothModifierData *clmd, float epsilon)
BVHTree *bvhtree_build_from_cloth (ClothModifierData *clmd, float epsilon)
{
int i;
unsigned int i;
BVHTree *bvhtree;
Cloth *cloth = clmd->clothObject;
ClothVertex *verts;
@ -782,11 +782,11 @@ static void cloth_to_object (Object *ob, ClothModifierData *clmd, DerivedMesh *
/* can be optimized to do all groups in one loop */
static void cloth_apply_vgroup ( ClothModifierData *clmd, DerivedMesh *dm )
{
unsigned int i = 0;
unsigned int j = 0;
int i = 0;
int j = 0;
MDeformVert *dvert = NULL;
Cloth *clothObj = NULL;
unsigned int numverts = dm->getNumVerts ( dm );
int numverts = dm->getNumVerts ( dm );
float goalfac = 0;
ClothVertex *verts = NULL;
@ -857,7 +857,7 @@ static void cloth_apply_vgroup ( ClothModifierData *clmd, DerivedMesh *dm )
static int cloth_from_object(Object *ob, ClothModifierData *clmd, DerivedMesh *dm, float framenr, int first)
{
unsigned int i = 0;
int i = 0;
MVert *mvert = NULL;
ClothVertex *verts = NULL;
float tnull[3] = {0,0,0};
@ -1082,13 +1082,13 @@ int cloth_build_springs ( ClothModifierData *clmd, DerivedMesh *dm )
Cloth *cloth = clmd->clothObject;
ClothSpring *spring = NULL, *tspring = NULL, *tspring2 = NULL;
unsigned int struct_springs = 0, shear_springs=0, bend_springs = 0;
unsigned int i = 0;
unsigned int numverts = dm->getNumVerts ( dm );
unsigned int numedges = dm->getNumEdges ( dm );
unsigned int numfaces = dm->getNumFaces ( dm );
int i = 0;
int numverts = dm->getNumVerts ( dm );
int numedges = dm->getNumEdges ( dm );
int numfaces = dm->getNumFaces ( dm );
MEdge *medge = CDDM_get_edges ( dm );
MFace *mface = CDDM_get_faces ( dm );
unsigned int index2 = 0; // our second vertex index
int index2 = 0; // our second vertex index
LinkNode **edgelist = NULL;
EdgeHash *edgehash = NULL;
LinkNode *search = NULL, *search2 = NULL;

@ -88,6 +88,8 @@
#include "RE_pipeline.h"
#include "RE_shader_ext.h"
#include "BLO_sys_types.h" // for intptr_t support
static void boundbox_displist(Object *ob);
@ -986,9 +988,9 @@ void filldisplist(ListBase *dispbase, ListBase *to)
efa= fillfacebase.first;
index= dlnew->index;
while(efa) {
index[0]= (long)efa->v1->tmp.l;
index[1]= (long)efa->v2->tmp.l;
index[2]= (long)efa->v3->tmp.l;
index[0]= (intptr_t)efa->v1->tmp.l;
index[1]= (intptr_t)efa->v2->tmp.l;
index[2]= (intptr_t)efa->v3->tmp.l;
index+= 3;
efa= efa->next;

@ -157,6 +157,13 @@ static void add_to_effectorcache(ListBase *lb, Object *ob, Object *obsrc)
}
}
else if(pd->forcefield) {
if(pd->forcefield == PFIELD_WIND)
{
pd->rng = rng_new(1);
rng_srandom(pd->rng, (unsigned int)(ceil(PIL_check_seconds_timer()))); // use better seed
}
ec= MEM_callocN(sizeof(pEffectorCache), "effector cache");
ec->ob= ob;
BLI_addtail(lb, ec);
@ -205,13 +212,189 @@ void pdEndEffectors(ListBase *lb)
pEffectorCache *ec;
/* restore full copy */
for(ec= lb->first; ec; ec= ec->next)
{
if(ec->ob->pd && (ec->ob->pd->forcefield == PFIELD_WIND))
rng_free(ec->ob->pd->rng);
*(ec->ob)= ec->obcopy;
}
BLI_freelistN(lb);
}
}
/************************************************/
/* Effectors */
/************************************************/
// noise function for wind e.g.
static float wind_func(struct RNG *rng, float strength)
{
int random = (rng_getInt(rng)+1) % 65535; // max 2357
float force = rng_getFloat(rng) + 1.0f;
float ret;
float sign = 0;
sign = (random > 32000.0) ? 1.0: -1.0; // dividing by 2 is not giving equal sign distribution
ret = sign*((float)random / force)*strength/65535.0f;
return ret;
}
static float falloff_func(float fac, int usemin, float mindist, int usemax, float maxdist, float power)
{
if(!usemin)
mindist= 0.0f;
if(fac < mindist) {
return 1.0f;
}
else if(usemax) {
if(fac>maxdist || (maxdist-mindist)<=0.0f)
return 0.0f;
fac= (fac-mindist)/(maxdist-mindist);
return 1.0f - (float)pow((double)fac, (double)power);
}
else
return pow((double)1.0f+fac-mindist, (double)-power);
}
static float falloff_func_dist(PartDeflect *pd, float fac)
{
return falloff_func(fac, pd->flag&PFIELD_USEMIN, pd->mindist, pd->flag&PFIELD_USEMAX, pd->maxdist, pd->f_power);
}
static float falloff_func_rad(PartDeflect *pd, float fac)
{
return falloff_func(fac, pd->flag&PFIELD_USEMINR, pd->minrad, pd->flag&PFIELD_USEMAXR, pd->maxrad, pd->f_power_r);
}
float effector_falloff(PartDeflect *pd, float *eff_velocity, float *vec_to_part)
{
float eff_dir[3], temp[3];
float falloff=1.0, fac, r_fac;
VecCopyf(eff_dir,eff_velocity);
Normalize(eff_dir);
if(pd->flag & PFIELD_POSZ && Inpf(eff_dir,vec_to_part)<0.0f)
falloff=0.0f;
else switch(pd->falloff){
case PFIELD_FALL_SPHERE:
fac=VecLength(vec_to_part);
falloff= falloff_func_dist(pd, fac);
break;
case PFIELD_FALL_TUBE:
fac=Inpf(vec_to_part,eff_dir);
falloff= falloff_func_dist(pd, ABS(fac));
if(falloff == 0.0f)
break;
VECADDFAC(temp,vec_to_part,eff_dir,-fac);
r_fac=VecLength(temp);
falloff*= falloff_func_rad(pd, r_fac);
break;
case PFIELD_FALL_CONE:
fac=Inpf(vec_to_part,eff_dir);
falloff= falloff_func_dist(pd, ABS(fac));
if(falloff == 0.0f)
break;
r_fac=saacos(fac/VecLength(vec_to_part))*180.0f/(float)M_PI;
falloff*= falloff_func_rad(pd, r_fac);
break;
}
return falloff;
}
void do_physical_effector(short type, float force_val, float distance, float falloff, float size, float damp, float *eff_velocity, float *vec_to_part, float *velocity, float *field, int planar, struct RNG *rng, float noise)
{
float mag_vec[3]={0,0,0};
float temp[3], temp2[3];
float eff_vel[3];
float wind = 0;
VecCopyf(eff_vel,eff_velocity);
Normalize(eff_vel);
switch(type){
case PFIELD_WIND:
VECCOPY(mag_vec,eff_vel);
// add wind noise here
if(noise> 0.0f)
wind = wind_func(rng, noise);
VecMulf(mag_vec,(force_val+wind)*falloff);
VecAddf(field,field,mag_vec);
break;
case PFIELD_FORCE:
if(planar)
Projf(mag_vec,vec_to_part,eff_vel);
else
VecCopyf(mag_vec,vec_to_part);
VecMulf(mag_vec,force_val*falloff);
VecAddf(field,field,mag_vec);
break;
case PFIELD_VORTEX:
Crossf(mag_vec,eff_vel,vec_to_part);
Normalize(mag_vec);
VecMulf(mag_vec,force_val*distance*falloff);
VecAddf(field,field,mag_vec);
break;
case PFIELD_MAGNET:
if(planar)
VecCopyf(temp,eff_vel);
else
/* magnetic field of a moving charge */
Crossf(temp,eff_vel,vec_to_part);
Crossf(temp2,velocity,temp);
VecAddf(mag_vec,mag_vec,temp2);
VecMulf(mag_vec,force_val*falloff);
VecAddf(field,field,mag_vec);
break;
case PFIELD_HARMONIC:
if(planar)
Projf(mag_vec,vec_to_part,eff_vel);
else
VecCopyf(mag_vec,vec_to_part);
VecMulf(mag_vec,force_val*falloff);
VecSubf(field,field,mag_vec);
VecCopyf(mag_vec,velocity);
/* 1.9 is an experimental value to get critical damping at damp=1.0 */
VecMulf(mag_vec,damp*1.9f*(float)sqrt(force_val));
VecSubf(field,field,mag_vec);
break;
case PFIELD_NUCLEAR:
/*pow here is root of cosine expression below*/
//rad=(float)pow(2.0,-1.0/power)*distance/size;
//VECCOPY(mag_vec,vec_to_part);
//Normalize(mag_vec);
//VecMulf(mag_vec,(float)cos(3.0*M_PI/2.0*(1.0-1.0/(pow(rad,power)+1.0)))/(rad+0.2f));
//VECADDFAC(field,field,mag_vec,force_val);
break;
}
}
/* -------- pdDoEffectors() --------
generic force/speed system, now used for particles and softbodies
lb = listbase with objects that take part in effecting
@ -244,13 +427,10 @@ void pdDoEffectors(ListBase *lb, float *opco, float *force, float *speed, float
pEffectorCache *ec;
PartDeflect *pd;
float vect_to_vert[3];
float f_force, force_vec[3];
float *obloc;
float distance, force_val, ffall_val;
float guidecollect[3], guidedist= 0.0f;
int cur_frame;
guidecollect[0]= guidecollect[1]= guidecollect[2]=0.0f;
float distance, vec_to_part[3];
float falloff;
/* Cycle through collected objects, get total of (1/(gravity_strength * dist^gravity_power)) */
/* Check for min distance here? (yes would be cool to add that, ton) */
@ -261,178 +441,32 @@ void pdDoEffectors(ListBase *lb, float *opco, float *force, float *speed, float
pd= ob->pd;
/* Get IPO force strength and fall off values here */
if (has_ipo_code(ob->ipo, OB_PD_FSTR))
force_val = IPO_GetFloatValue(ob->ipo, OB_PD_FSTR, cur_time);
else
force_val = pd->f_strength;
if (has_ipo_code(ob->ipo, OB_PD_FFALL))
ffall_val = IPO_GetFloatValue(ob->ipo, OB_PD_FFALL, cur_time);
else
ffall_val = pd->f_power;
/* Need to set r.cfra for paths (investigate, ton) (uses ob->ctime now, ton) */
if(ob->ctime!=cur_time) {
cur_frame = G.scene->r.cfra;
G.scene->r.cfra = (int)cur_time;
where_is_object_time(ob, cur_time);
G.scene->r.cfra = cur_frame;
}
where_is_object_time(ob,cur_time);
/* use center of object for distance calculus */
obloc= ob->obmat[3];
VECSUB(vect_to_vert, obloc, opco);
distance = VecLength(vect_to_vert);
if((pd->flag & PFIELD_USEMAX) && distance>pd->maxdist && pd->forcefield != PFIELD_GUIDE)
VecSubf(vec_to_part, opco, ob->obmat[3]);
distance = VecLength(vec_to_part);
falloff=effector_falloff(pd,ob->obmat[2],vec_to_part);
if(falloff<=0.0f)
; /* don't do anything */
else if((pd->flag & PFIELD_USEMIN) && distance<pd->mindist && pd->forcefield != PFIELD_GUIDE)
; /* don't do anything */
else if(pd->forcefield == PFIELD_WIND) {
VECCOPY(force_vec, ob->obmat[2]);
else {
float field[3]={0,0,0}, tmp[3];
VECCOPY(field, force);
do_physical_effector(pd->forcefield,pd->f_strength,distance,
falloff,pd->f_dist,pd->f_damp,ob->obmat[2],vec_to_part,
speed,force,pd->flag&PFIELD_PLANAR, pd->rng, pd->f_noise);
/* wind works harder perpendicular to normal, would be nice for softbody later (ton) */
/* Limit minimum distance to vertex so that */
/* the force is not too big */
if (distance < 0.001) distance = 0.001f;
f_force = (force_val)*(1/(1000 * (float)pow((double)distance, (double)ffall_val)));
/* this option for softbody only */
if(flags && PE_WIND_AS_SPEED){
speed[0] -= (force_vec[0] * f_force );
speed[1] -= (force_vec[1] * f_force );
speed[2] -= (force_vec[2] * f_force );
}
else{
force[0] += force_vec[0]*f_force;
force[1] += force_vec[1]*f_force;
force[2] += force_vec[2]*f_force;
// for softbody backward compatibility
if(flags & PE_WIND_AS_SPEED){
VECSUB(tmp, force, field);
VECSUB(speed, speed, tmp);
}
}
else if(pd->forcefield == PFIELD_FORCE) {
/* only use center of object */
obloc= ob->obmat[3];
/* Now calculate the gravitational force */
VECSUB(vect_to_vert, obloc, opco);
distance = VecLength(vect_to_vert);
/* Limit minimum distance to vertex so that */
/* the force is not too big */
if (distance < 0.001) distance = 0.001f;
f_force = (force_val)*(1.0/(1000.0 * (float)pow((double)distance, (double)ffall_val)));
force[0] += (vect_to_vert[0] * f_force );
force[1] += (vect_to_vert[1] * f_force );
force[2] += (vect_to_vert[2] * f_force );
}
else if(pd->forcefield == PFIELD_VORTEX) {
float vortexvec[3];
/* only use center of object */
obloc= ob->obmat[3];
/* Now calculate the vortex force */
VECSUB(vect_to_vert, obloc, opco);
distance = VecLength(vect_to_vert);
Crossf(force_vec, ob->obmat[2], vect_to_vert);
Normalize(force_vec);
/* Limit minimum distance to vertex so that */
/* the force is not too big */
if (distance < 0.001) distance = 0.001f;
f_force = (force_val)*(1.0/(100.0 * (float)pow((double)distance, (double)ffall_val)));
vortexvec[0]= -(force_vec[0] * f_force );
vortexvec[1]= -(force_vec[1] * f_force );
vortexvec[2]= -(force_vec[2] * f_force );
/* this option for softbody only */
if(flags &&PE_WIND_AS_SPEED) {
speed[0]+= vortexvec[0];
speed[1]+= vortexvec[1];
speed[2]+= vortexvec[2];
}
else {
/* since vortex alters the speed, we have to correct for the previous vortex result */
speed[0]+= vortexvec[0] - ec->oldspeed[0];
speed[1]+= vortexvec[1] - ec->oldspeed[1];
speed[2]+= vortexvec[2] - ec->oldspeed[2];
VECCOPY(ec->oldspeed, vortexvec);
}
}
else if(pd->forcefield == PFIELD_GUIDE) {
float guidevec[4], guidedir[3];
float mindist= force_val; /* force_val is actually mindist in the UI */
distance= ec->guide_dist;
/* WARNING: bails out with continue here */
if((pd->flag & PFIELD_USEMAX) && distance>pd->maxdist) continue;
/* calculate contribution factor for this guide */
if(distance<=mindist) f_force= 1.0f;
else if(pd->flag & PFIELD_USEMAX) {
if(distance>pd->maxdist || mindist>=pd->maxdist) f_force= 0.0f;
else {
f_force= 1.0f - (distance-mindist)/(pd->maxdist - mindist);
if(ffall_val!=0.0f)
f_force = (float)pow(f_force, ffall_val+1.0);
}
}
else {
f_force= 1.0f/(1.0f + distance-mindist);
if(ffall_val!=0.0f)
f_force = (float)pow(f_force, ffall_val+1.0);
}
/* now derive path point from loc_time */
if(pd->flag & PFIELD_GUIDE_PATH_ADD)
where_on_path(ob, f_force*loc_time*ec->time_scale, guidevec, guidedir);
else
where_on_path(ob, loc_time*ec->time_scale, guidevec, guidedir);
VECSUB(guidedir, guidevec, ec->oldloc);
VECCOPY(ec->oldloc, guidevec);
Mat4Mul3Vecfl(ob->obmat, guidedir);
VecMulf(guidedir, ec->scale); /* correction for lifetime and speed */
/* we subtract the speed we gave it previous step */
VECCOPY(guidevec, guidedir);
VECSUB(guidedir, guidedir, ec->oldspeed);
VECCOPY(ec->oldspeed, guidevec);
/* if it fully contributes, we stop */
if(f_force==1.0) {
VECCOPY(guidecollect, guidedir);
guidedist= 1.0f;
break;
}
else if(guidedist<1.0f) {
VecMulf(guidedir, f_force);
VECADD(guidecollect, guidecollect, guidedir);
guidedist += f_force;
}
}
}
/* all guides are accumulated here */
if(guidedist!=0.0f) {
if(guidedist!=1.0f) VecMulf(guidecollect, 1.0f/guidedist);
VECADD(speed, speed, guidecollect);
}
}
/* for paf start to end, store all matrices for objects */
typedef struct pMatrixCache {
float obmat[4][4];
float imat[3][3];
} pMatrixCache;
/* for fluidsim win32 debug messages */
#if defined(WIN32) && (!(defined snprintf))
#define snprintf _snprintf
#endif

@ -50,6 +50,8 @@
#include "BKE_icons.h"
#include "BKE_utildefines.h"
#include "BLO_sys_types.h" // for intptr_t support
#define GS(a) (*((short *)(a)))
/* GLOBALS */

@ -86,6 +86,8 @@
#include "blendef.h"
#include "BSE_time.h"
#include "BLO_sys_types.h" // for intptr_t support
/* max int, to indicate we don't store sequences in ibuf */
#define IMA_NO_INDEX 0x7FEFEFEF
@ -630,11 +632,11 @@ void free_old_images()
}
}
static unsigned long image_mem_size(Image *ima)
static uintptr_t image_mem_size(Image *ima)
{
ImBuf *ibuf, *ibufm;
int level;
unsigned long size = 0;
uintptr_t size = 0;
size= 0;
for(ibuf= ima->ibufs.first; ibuf; ibuf= ibuf->next) {
@ -656,7 +658,7 @@ static unsigned long image_mem_size(Image *ima)
void BKE_image_print_memlist(void)
{
Image *ima;
unsigned long size, totsize= 0;
uintptr_t size, totsize= 0;
for(ima= G.main->image.first; ima; ima= ima->id.next)
totsize += image_mem_size(ima);

@ -1354,25 +1354,57 @@ DO_INLINE void cloth_apply_spring_force(ClothModifierData *clmd, ClothSpring *s,
}
}
static void CalcFloat( float *v1, float *v2, float *v3, float *n)
{
float n1[3],n2[3];
n1[0]= v1[0]-v2[0];
n2[0]= v2[0]-v3[0];
n1[1]= v1[1]-v2[1];
n2[1]= v2[1]-v3[1];
n1[2]= v1[2]-v2[2];
n2[2]= v2[2]-v3[2];
n[0]= n1[1]*n2[2]-n1[2]*n2[1];
n[1]= n1[2]*n2[0]-n1[0]*n2[2];
n[2]= n1[0]*n2[1]-n1[1]*n2[0];
}
static void CalcFloat4( float *v1, float *v2, float *v3, float *v4, float *n)
{
/* real cross! */
float n1[3],n2[3];
n1[0]= v1[0]-v3[0];
n1[1]= v1[1]-v3[1];
n1[2]= v1[2]-v3[2];
n2[0]= v2[0]-v4[0];
n2[1]= v2[1]-v4[1];
n2[2]= v2[2]-v4[2];
n[0]= n1[1]*n2[2]-n1[2]*n2[1];
n[1]= n1[2]*n2[0]-n1[0]*n2[2];
n[2]= n1[0]*n2[1]-n1[1]*n2[0];
}
float calculateVertexWindForce(float wind[3], float vertexnormal[3])
{
return fabs(INPR(wind, vertexnormal));
return (INPR(wind, vertexnormal));
}
void cloth_calc_force(ClothModifierData *clmd, lfVector *lF, lfVector *lX, lfVector *lV, fmatrix3x3 *dFdV, fmatrix3x3 *dFdX, ListBase *effectors, float time, fmatrix3x3 *M)
{
/* Collect forces and derivatives: F,dFdX,dFdV */
Cloth *cloth = clmd->clothObject;
long i = 0;
int i = 0;
float spring_air = clmd->sim_parms->Cvi * 0.01f; /* viscosity of air scaled in percent */
float gravity[3];
float tm2[3][3] = {{-spring_air,0,0}, {0,-spring_air,0},{0,0,-spring_air}};
MFace *mfaces = cloth->mfaces;
//ClothVertex *verts = cloth->verts;
float wind_normalized[3];
unsigned int numverts = cloth->numverts;
LinkNode *search = cloth->springs;
lfVector *winvec;
VECCOPY(gravity, clmd->sim_parms->gravity);
mul_fvector_S(gravity, gravity, 0.001f); /* scale gravity force */
@ -1387,7 +1419,7 @@ void cloth_calc_force(ClothModifierData *clmd, lfVector *lF, lfVector *lX, lfVec
/* multiply lF with mass matrix
// force = mass * acceleration (in this case: gravity)
*/
for(i = 0; i < (long)numverts; i++)
for(i = 0; i < numverts; i++)
{
float temp[3];
VECCOPY(temp, lF[i]);
@ -1399,70 +1431,61 @@ void cloth_calc_force(ClothModifierData *clmd, lfVector *lF, lfVector *lX, lfVec
/* handle external forces like wind */
if(effectors)
{
// 0 = force, 1 = normalized force
winvec = create_lfvector(cloth->numverts);
if(!winvec)
printf("winvec: out of memory in implicit.c\n");
// precalculate wind forces
for(i = 0; i < cloth->numverts; i++)
{
float speed[3] = {0.0f, 0.0f,0.0f};
pdDoEffectors(effectors, lX[i], winvec[i], speed, (float)G.scene->r.cfra, 0.0f, 0);
}
for(i = 0; i < cloth->numfaces; i++)
{
float vertexnormal[3]={0,0,0};
float speed[3] = {0.0f, 0.0f,0.0f};
float force[3]= {0.0f, 0.0f, 0.0f};
float trinormal[3]={0,0,0}; // normalized triangle normal
float triunnormal[3]={0,0,0}; // not-normalized-triangle normal
float tmp[3]={0,0,0};
float factor = (mfaces[i].v4) ? 0.25 : 1.0 / 3.0;
factor *= 0.05;
// calculate face normal
if(mfaces[i].v4)
CalcNormFloat4(lX[mfaces[i].v1],lX[mfaces[i].v2],lX[mfaces[i].v3],lX[mfaces[i].v4],vertexnormal);
CalcFloat4(lX[mfaces[i].v1],lX[mfaces[i].v2],lX[mfaces[i].v3],lX[mfaces[i].v4],triunnormal);
else
CalcNormFloat(lX[mfaces[i].v1],lX[mfaces[i].v2],lX[mfaces[i].v3],vertexnormal);
CalcFloat(lX[mfaces[i].v1],lX[mfaces[i].v2],lX[mfaces[i].v3],triunnormal);
pdDoEffectors(effectors, lX[mfaces[i].v1], force, speed, (float)G.scene->r.cfra, 0.0f, PE_WIND_AS_SPEED);
VECCOPY(wind_normalized, speed);
Normalize(wind_normalized);
VecMulf(wind_normalized, -calculateVertexWindForce(speed, vertexnormal));
VECCOPY(trinormal, triunnormal);
Normalize(trinormal);
// add wind from v1
VECCOPY(tmp, trinormal);
VecMulf(tmp, calculateVertexWindForce(winvec[mfaces[i].v1], triunnormal));
VECADDS(lF[mfaces[i].v1], lF[mfaces[i].v1], tmp, factor);
// add wind from v2
VECCOPY(tmp, trinormal);
VecMulf(tmp, calculateVertexWindForce(winvec[mfaces[i].v2], triunnormal));
VECADDS(lF[mfaces[i].v2], lF[mfaces[i].v2], tmp, factor);
// add wind from v3
VECCOPY(tmp, trinormal);
VecMulf(tmp, calculateVertexWindForce(winvec[mfaces[i].v3], triunnormal));
VECADDS(lF[mfaces[i].v3], lF[mfaces[i].v3], tmp, factor);
// add wind from v4
if(mfaces[i].v4)
{
VECADDS(lF[mfaces[i].v1], lF[mfaces[i].v1], wind_normalized, 0.25);
VECCOPY(tmp, trinormal);
VecMulf(tmp, calculateVertexWindForce(winvec[mfaces[i].v4], triunnormal));
VECADDS(lF[mfaces[i].v4], lF[mfaces[i].v4], tmp, factor);
}
else
{
VECADDS(lF[mfaces[i].v1], lF[mfaces[i].v1], wind_normalized, 1.0 / 3.0);
}
speed[0] = speed[1] = speed[2] = 0.0;
pdDoEffectors(effectors, lX[mfaces[i].v2], force, speed, (float)G.scene->r.cfra, 0.0f, PE_WIND_AS_SPEED);
VECCOPY(wind_normalized, speed);
Normalize(wind_normalized);
VecMulf(wind_normalized, -calculateVertexWindForce(speed, vertexnormal));
if(mfaces[i].v4)
{
VECADDS(lF[mfaces[i].v2], lF[mfaces[i].v2], wind_normalized, 0.25);
}
else
{
VECADDS(lF[mfaces[i].v2], lF[mfaces[i].v2], wind_normalized, 1.0 / 3.0);
}
speed[0] = speed[1] = speed[2] = 0.0;
pdDoEffectors(effectors, lX[mfaces[i].v3], force, speed, (float)G.scene->r.cfra, 0.0f, PE_WIND_AS_SPEED);
VECCOPY(wind_normalized, speed);
Normalize(wind_normalized);
VecMulf(wind_normalized, -calculateVertexWindForce(speed, vertexnormal));
if(mfaces[i].v4)
{
VECADDS(lF[mfaces[i].v3], lF[mfaces[i].v3], wind_normalized, 0.25);
}
else
{
VECADDS(lF[mfaces[i].v3], lF[mfaces[i].v3], wind_normalized, 1.0 / 3.0);
}
speed[0] = speed[1] = speed[2] = 0.0;
if(mfaces[i].v4)
{
pdDoEffectors(effectors, lX[mfaces[i].v4], force, speed, (float)G.scene->r.cfra, 0.0f, PE_WIND_AS_SPEED);
VECCOPY(wind_normalized, speed);
Normalize(wind_normalized);
VecMulf(wind_normalized, -calculateVertexWindForce(speed, vertexnormal));
VECADDS(lF[mfaces[i].v4], lF[mfaces[i].v4], wind_normalized, 0.25);
}
}
del_lfvector(winvec);
}
// calculate spring forces

@ -182,7 +182,7 @@ int part_ar[PART_TOTIPO]= {
PART_EMIT_FREQ, PART_EMIT_LIFE, PART_EMIT_VEL, PART_EMIT_AVE, PART_EMIT_SIZE,
PART_AVE, PART_SIZE, PART_DRAG, PART_BROWN, PART_DAMP, PART_LENGTH, PART_CLUMP,
PART_GRAV_X, PART_GRAV_Y, PART_GRAV_Z, PART_KINK_AMP, PART_KINK_FREQ, PART_KINK_SHAPE,
PART_BB_TILT
PART_BB_TILT, PART_PD_FSTR, PART_PD_FFALL, PART_PD_FMAXD
};
@ -1608,6 +1608,12 @@ void *get_ipo_poin(ID *id, IpoCurve *icu, int *type)
poin= &(part->kink_shape); break;
case PART_BB_TILT:
poin= &(part->bb_tilt); break;
case PART_PD_FSTR:
poin= (part->pd?(&(part->pd->f_strength)):NULL); break;
case PART_PD_FFALL:
poin= (part->pd?(&(part->pd->f_power)):NULL); break;
case PART_PD_FMAXD:
poin= (part->pd?(&(part->pd->maxdist)):NULL); break;
}
}

@ -2205,177 +2205,6 @@ static int get_particles_from_cache(Object *ob, ParticleSystem *psys, int cfra)
return 1;
}
/************************************************/
/* Effectors */
/************************************************/
static float falloff_func(float fac, int usemin, float mindist, int usemax, float maxdist, float power)
{
if(!usemin)
mindist= 0.0f;
if(fac < mindist) {
return 1.0f;
}
else if(usemax) {
if(fac>maxdist || (maxdist-mindist)<=0.0f)
return 0.0f;
fac= (fac-mindist)/(maxdist-mindist);
return 1.0f - (float)pow((double)fac, (double)power);
}
else
return pow((double)1.0f+fac-mindist, (double)-power);
}
static float falloff_func_dist(PartDeflect *pd, float fac)
{
return falloff_func(fac, pd->flag&PFIELD_USEMIN, pd->mindist, pd->flag&PFIELD_USEMAX, pd->maxdist, pd->f_power);
}
static float falloff_func_rad(PartDeflect *pd, float fac)
{
return falloff_func(fac, pd->flag&PFIELD_USEMINR, pd->minrad, pd->flag&PFIELD_USEMAXR, pd->maxrad, pd->f_power_r);
}
static float effector_falloff(PartDeflect *pd, float *eff_velocity, float *vec_to_part)
{
float eff_dir[3], temp[3];
float falloff=1.0, fac, r_fac;
VecCopyf(eff_dir,eff_velocity);
Normalize(eff_dir);
if(pd->flag & PFIELD_POSZ && Inpf(eff_dir,vec_to_part)<0.0f)
falloff=0.0f;
else switch(pd->falloff){
case PFIELD_FALL_SPHERE:
fac=VecLength(vec_to_part);
falloff= falloff_func_dist(pd, fac);
break;
case PFIELD_FALL_TUBE:
fac=Inpf(vec_to_part,eff_dir);
falloff= falloff_func_dist(pd, ABS(fac));
if(falloff == 0.0f)
break;
VECADDFAC(temp,vec_to_part,eff_dir,-fac);
r_fac=VecLength(temp);
falloff*= falloff_func_rad(pd, r_fac);
break;
case PFIELD_FALL_CONE:
fac=Inpf(vec_to_part,eff_dir);
falloff= falloff_func_dist(pd, ABS(fac));
if(falloff == 0.0f)
break;
r_fac=saacos(fac/VecLength(vec_to_part))*180.0f/(float)M_PI;
falloff*= falloff_func_rad(pd, r_fac);
break;
// case PFIELD_FALL_INSIDE:
//for(i=0; i<totface; i++,mface++){
// VECCOPY(v1,mvert[mface->v1].co);
// VECCOPY(v2,mvert[mface->v2].co);
// VECCOPY(v3,mvert[mface->v3].co);
// if(AxialLineIntersectsTriangle(a,co1, co2, v2, v3, v1, &lambda)){
// if(from==PART_FROM_FACE)
// (pa+(int)(lambda*size[a])*a0mul)->flag &= ~PARS_UNEXIST;
// else /* store number of intersections */
// (pa+(int)(lambda*size[a])*a0mul)->loop++;
// }
//
// if(mface->v4){
// VECCOPY(v4,mvert[mface->v4].co);
// if(AxialLineIntersectsTriangle(a,co1, co2, v4, v1, v3, &lambda)){
// if(from==PART_FROM_FACE)
// (pa+(int)(lambda*size[a])*a0mul)->flag &= ~PARS_UNEXIST;
// else
// (pa+(int)(lambda*size[a])*a0mul)->loop++;
// }
// }
//}
// break;
}
return falloff;
}
static void do_physical_effector(short type, float force_val, float distance, float falloff, float size, float damp,
float *eff_velocity, float *vec_to_part, float *velocity, float *field, int planar)
{
float mag_vec[3]={0,0,0};
float temp[3], temp2[3];
float eff_vel[3];
VecCopyf(eff_vel,eff_velocity);
Normalize(eff_vel);
switch(type){
case PFIELD_WIND:
VECCOPY(mag_vec,eff_vel);
VecMulf(mag_vec,force_val*falloff);
VecAddf(field,field,mag_vec);
break;
case PFIELD_FORCE:
if(planar)
Projf(mag_vec,vec_to_part,eff_vel);
else
VecCopyf(mag_vec,vec_to_part);
VecMulf(mag_vec,force_val*falloff);
VecAddf(field,field,mag_vec);
break;
case PFIELD_VORTEX:
Crossf(mag_vec,eff_vel,vec_to_part);
Normalize(mag_vec);
VecMulf(mag_vec,force_val*distance*falloff);
VecAddf(field,field,mag_vec);
break;
case PFIELD_MAGNET:
if(planar)
VecCopyf(temp,eff_vel);
else
/* magnetic field of a moving charge */
Crossf(temp,eff_vel,vec_to_part);
Crossf(temp2,velocity,temp);
VecAddf(mag_vec,mag_vec,temp2);
VecMulf(mag_vec,force_val*falloff);
VecAddf(field,field,mag_vec);
break;
case PFIELD_HARMONIC:
if(planar)
Projf(mag_vec,vec_to_part,eff_vel);
else
VecCopyf(mag_vec,vec_to_part);
VecMulf(mag_vec,force_val*falloff);
VecSubf(field,field,mag_vec);
VecCopyf(mag_vec,velocity);
/* 1.9 is an experimental value to get critical damping at damp=1.0 */
VecMulf(mag_vec,damp*1.9f*(float)sqrt(force_val));
VecSubf(field,field,mag_vec);
break;
case PFIELD_NUCLEAR:
/*pow here is root of cosine expression below*/
//rad=(float)pow(2.0,-1.0/power)*distance/size;
//VECCOPY(mag_vec,vec_to_part);
//Normalize(mag_vec);
//VecMulf(mag_vec,(float)cos(3.0*M_PI/2.0*(1.0-1.0/(pow(rad,power)+1.0)))/(rad+0.2f));
//VECADDFAC(field,field,mag_vec,force_val);
break;
}
}
static void do_texture_effector(Tex *tex, short mode, short is_2d, float nabla, short object, float *pa_co, float obmat[4][4], float force_val, float falloff, float *field)
{
TexResult result[4];
@ -2788,7 +2617,7 @@ void do_effectors(int pa_no, ParticleData *pa, ParticleKey *state, Object *ob, P
} else {
do_physical_effector(pd->forcefield,pd->f_strength,distance,
falloff,pd->f_dist,pd->f_damp,eob->obmat[2],vec_to_part,
pa->state.vel,force_field,pd->flag&PFIELD_PLANAR);
pa->state.vel,force_field,pd->flag&PFIELD_PLANAR, pd->rng, pd->f_noise);
}
}
if(ec->type & PSYS_EC_PARTICLE){
@ -2837,7 +2666,7 @@ void do_effectors(int pa_no, ParticleData *pa, ParticleKey *state, Object *ob, P
else
do_physical_effector(pd->forcefield,pd->f_strength,distance,
falloff,epart->size,pd->f_damp,estate.vel,vec_to_part,
state->vel,force_field,0);
state->vel,force_field,0, pd->rng, pd->f_noise);
}
else if(pd->forcefield==PFIELD_HARMONIC && cfra-framestep <= epa->dietime && cfra>epa->dietime){
/* first step after key release */
@ -3948,27 +3777,44 @@ static void boid_body(BoidVecFunc *bvf, ParticleData *pa, ParticleSystem *psys,
bvf->Addf(dvec,dvec,bvec);
bvf->Addf(state->co,state->co,dvec);
/* air speed from wind effectors */
if(psys->effectors.first){
/* air speed from wind and vortex effectors */
if(psys->effectors.first) {
ParticleEffectorCache *ec;
for(ec=psys->effectors.first; ec; ec=ec->next){
if(ec->type & PSYS_EC_EFFECTOR){
for(ec=psys->effectors.first; ec; ec=ec->next) {
if(ec->type & PSYS_EC_EFFECTOR) {
Object *eob = ec->ob;
PartDeflect *pd = eob->pd;
float direction[3], vec_to_part[3];
float falloff;
if(pd->forcefield==PFIELD_WIND && pd->f_strength!=0.0){
float distance, wind[3];
VecCopyf(wind,eob->obmat[2]);
distance=VecLenf(state->co,eob->obmat[3]);
if(pd->f_strength != 0.0f) {
VecCopyf(direction, eob->obmat[2]);
VecSubf(vec_to_part, state->co, eob->obmat[3]);
if (distance < 0.001) distance = 0.001f;
falloff=effector_falloff(pd, direction, vec_to_part);
if(pd->flag&PFIELD_USEMAX && distance > pd->maxdist)
;
else{
Normalize(wind);
VecMulf(wind,pd->f_strength/(float)pow((double)distance,(double)pd->f_power));
bvf->Addf(state->co,state->co,wind);
switch(pd->forcefield) {
case PFIELD_WIND:
if(falloff <= 0.0f)
; /* don't do anything */
else {
Normalize(direction);
VecMulf(direction, pd->f_strength * falloff);
bvf->Addf(state->co, state->co, direction);
}
break;
case PFIELD_VORTEX:
{
float distance, mag_vec[3];
Crossf(mag_vec, direction, vec_to_part);
Normalize(mag_vec);
distance = VecLength(vec_to_part);
VecMulf(mag_vec, pd->f_strength * distance * falloff);
bvf->Addf(state->co, state->co, mag_vec);
break;
}
}
}
}

@ -153,6 +153,9 @@ void init_sensor(bSensor *sens)
case SENS_ACTUATOR:
sens->data= MEM_callocN(sizeof(bActuatorSensor), "actsens");
break;
case SENS_DELAY:
sens->data= MEM_callocN(sizeof(bDelaySensor), "delaysens");
break;
case SENS_MOUSE:
ms=sens->data= MEM_callocN(sizeof(bMouseSensor), "mousesens");
ms->type= LEFTMOUSE;

@ -38,6 +38,8 @@
#include "DNA_customdata_types.h"
#include "DNA_mesh_types.h"
#include "BLO_sys_types.h" // for intptr_t support
struct DerivedMesh;
struct RetopoPaintData;
@ -53,7 +55,7 @@ typedef struct EditVert
struct EditEdge *e;
struct EditFace *f;
void *p;
long l;
intptr_t l;
float fp;
} tmp;
float no[3]; /*vertex normal */
@ -95,7 +97,7 @@ typedef struct EditEdge
struct EditEdge *e;
struct EditFace *f;
void *p;
long l;
intptr_t l;
float fp;
} tmp;
short f1, f2; /* short, f1 is (ab)used in subdiv */
@ -122,7 +124,7 @@ typedef struct EditFace
struct EditEdge *e;
struct EditFace *f;
void *p;
long l;
intptr_t l;
float fp;
} tmp;
float n[3], cent[3];

@ -44,6 +44,7 @@ struct RNG* rng_new (unsigned int seed);
void rng_free (struct RNG* rng);
void rng_seed (struct RNG* rng, unsigned int seed);
void rng_srandom(struct RNG *rng, unsigned int seed);
int rng_getInt (struct RNG* rng);
double rng_getDouble (struct RNG* rng);
float rng_getFloat (struct RNG* rng);

@ -34,6 +34,8 @@
#include "MEM_guardedalloc.h"
#include "BLI_ghash.h"
#include "BLO_sys_types.h" // for intptr_t support
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@ -256,11 +258,7 @@ int BLI_ghashutil_ptrcmp(void *a, void *b) {
}
unsigned int BLI_ghashutil_inthash(void *ptr) {
#if defined(_WIN64)
unsigned __int64 key = (unsigned __int64)ptr;
#else
unsigned long key = (unsigned long)ptr;
#endif
uintptr_t key = (uintptr_t)ptr;
key += ~(key << 16);
key ^= (key >> 5);

@ -634,6 +634,18 @@ static void non_recursive_bvh_div_nodes(BVHTree *tree, BVHNode *branches_array,
BVHBuildHelper data;
int depth;
//Most of bvhtree code relies on 1-leaf trees having at least one branch
//We handle that special case here
if(num_leafs == 1)
{
BVHNode *root = branches_array+0;
refit_kdop_hull(tree, root, 0, num_leafs);
root->main_axis = get_largest_axis(root->bv) / 2;
root->totnode = 1;
root->children[0] = leafs_array[0];
return;
}
branches_array--; //Implicit trees use 1-based indexs
build_implicit_tree_helper(tree, &data);

@ -62,6 +62,8 @@
#include "BKE_utildefines.h"
#include <errno.h>
#include "BLO_sys_types.h" // for intptr_t support
/* implementations: */
char *first_slash(char *string) {
char *ffslash, *fbslash;
@ -72,7 +74,7 @@ char *first_slash(char *string) {
if (!ffslash) return fbslash;
else if (!fbslash) return ffslash;
if ((long)ffslash < (long)fbslash) return ffslash;
if ((intptr_t)ffslash < (intptr_t)fbslash) return ffslash;
else return fbslash;
}
@ -85,7 +87,7 @@ char *BLI_last_slash(const char *string) {
if (!lfslash) return lbslash;
else if (!lbslash) return lfslash;
if ((long)lfslash < (long)lbslash) return lbslash;
if ((intptr_t)lfslash < (intptr_t)lbslash) return lbslash;
else return lfslash;
}

@ -43,6 +43,8 @@
#include "DNA_packedFile_types.h"
#include "DNA_curve_types.h"
#include "BLO_sys_types.h" // for intptr_t support
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@ -54,7 +56,7 @@ typedef struct chardesc {
short llx, lly; /* bounding box */
short urx, ury;
short *data; /* char data */
long datalen;
intptr_t datalen;
} chardesc;
typedef struct objfnt {

@ -81,6 +81,16 @@ void rng_seed(RNG *rng, unsigned int seed) {
rng->X= (((r_uint64) seed)<<16) | LOWSEED;
}
void rng_srandom(RNG *rng, unsigned int seed) {
extern unsigned char hash[]; // noise.c
rng_seed(rng, seed + hash[seed & 255]);
seed= rng_getInt(rng);
rng_seed(rng, seed + hash[seed & 255]);
seed= rng_getInt(rng);
rng_seed(rng, seed + hash[seed & 255]);
}
int rng_getInt(RNG *rng) {
rng->X= (MULTIPLIER*rng->X + ADDEND)&MASK;
return (int) (rng->X>>17);
@ -132,13 +142,7 @@ void BLI_srand(unsigned int seed) {
/* using hash table to create better seed */
void BLI_srandom(unsigned int seed) {
extern unsigned char hash[]; // noise.c
rng_seed(&theBLI_rng, seed + hash[seed & 255]);
seed= rng_getInt(&theBLI_rng);
rng_seed(&theBLI_rng, seed + hash[seed & 255]);
seed= rng_getInt(&theBLI_rng);
rng_seed(&theBLI_rng, seed + hash[seed & 255]);
rng_srandom(&theBLI_rng, seed);
}
int BLI_rand(void) {

@ -1970,7 +1970,7 @@ void BLI_timestr(double _time, char *str)
int BLI_int_from_pointer(void *poin)
{
long lval= (long)poin;
intptr_t lval= (intptr_t)poin;
return (int)(lval>>3);
}
@ -1978,17 +1978,17 @@ int BLI_int_from_pointer(void *poin)
void *BLI_pointer_from_int(int val)
{
static int firsttime= 1;
static long basevalue= 0;
static intptr_t basevalue= 0;
if(firsttime) {
void *poin= malloc(10000);
basevalue= (long)poin;
basevalue= (intptr_t)poin;
basevalue &= ~PMASK;
printf("base: %d pointer %p\n", basevalue, poin); /* debug */
firsttime= 0;
free(poin);
}
return (void *)(basevalue | (((long)val)<<3));
return (void *)(basevalue | (((intptr_t)val)<<3));
}
#else

@ -43,11 +43,6 @@
#ifdef __cplusplus
extern "C" {
#endif
#ifdef FREE_WINDOWS
typedef unsigned char uint8_t;
typedef unsigned int uint32_t;
#endif
#if defined(_WIN32) && !defined(FREE_WINDOWS)
@ -64,6 +59,14 @@ typedef unsigned __int16 uint16_t;
typedef unsigned __int32 uint32_t;
typedef unsigned __int64 uint64_t;
#ifdef _WIN64
typedef __int64 intptr_t;
typedef unsigned __int64 uintptr_t;
#else
typedef long intptr_t;
typedef unsigned long uintptr_t;
#endif
#elif defined(__linux__)
/* Linux-i386, Linux-Alpha, Linux-ppc */
@ -73,6 +76,10 @@ typedef unsigned __int64 uint64_t;
#include <inttypes.h>
#elif defined(FREE_WINDOWS)
#include <stdint.h>
#else
/* FreeBSD, Irix, Solaris */

@ -58,6 +58,8 @@
#include "genfile.h"
#include "BLO_sys_types.h" // for intptr_t support
/* gcc 4.1 on mingw was complaining that __int64 was alredy defined
actually is saw the line below as typedef long long long long...
Anyhow, since its alredy defined, its safe to do an ifndef here- Cambpell*/
@ -315,7 +317,7 @@ static void init_structDNA(struct SDNA *sdna, int do_endian_swap)
/* in sdna->data the data, now we convert that to something understandable */
{
int *data, *verg;
long nr;
intptr_t nr;
short *sp;
char str[8], *cp;
@ -351,7 +353,7 @@ static void init_structDNA(struct SDNA *sdna, int do_endian_swap)
cp++;
nr++;
}
nr= (long)cp; /* prevent BUS error */
nr= (intptr_t)cp; /* prevent BUS error */
nr= (nr+3) & ~3;
cp= (char *)nr;
@ -389,7 +391,7 @@ static void init_structDNA(struct SDNA *sdna, int do_endian_swap)
cp++;
nr++;
}
nr= (long)cp; /* prevent BUS error */
nr= (intptr_t)cp; /* prevent BUS error */
nr= (nr+3) & ~3;
cp= (char *)nr;
@ -1098,7 +1100,7 @@ int dna_elem_offset(struct SDNA *sdna, char *stype, char *vartype, char *name)
int SDNAnr= dna_findstruct_nr(sdna, stype);
short *spo= sdna->structs[SDNAnr];
char *cp= find_elem(sdna, vartype, name, spo, NULL, NULL);
return (int)((long)cp);
return (int)((intptr_t)cp);
}

@ -63,6 +63,8 @@
#include "BLO_readblenfile.h"
#include "BLO_sys_types.h" // needed for intptr_t
/**
* IDType stuff, I plan to move this
* out into its own file + prefix, and
@ -193,7 +195,7 @@ void BLO_blendhandle_print_sizes(BlendHandle *bh, void *fp)
buf[2]= buf[2]?buf[2]:' ';
buf[3]= buf[3]?buf[3]:' ';
fprintf(fp, "['%.4s', '%s', %d, %ld ], \n", buf, name, bhead->nr, (long)bhead->len+sizeof(BHead));
fprintf(fp, "['%.4s', '%s', %d, %ld ], \n", buf, name, bhead->nr, (intptr_t)bhead->len+sizeof(BHead));
}
}
fprintf(fp, "]\n");

@ -2949,11 +2949,9 @@ static void lib_link_object(FileData *fd, Main *main)
sens= ob->sensors.first;
while(sens) {
if(ob->id.lib==NULL) { // done in expand_main
for(a=0; a<sens->totlinks; a++) {
sens->links[a]= newglobadr(fd, sens->links[a]);
}
}
for(a=0; a<sens->totlinks; a++)
sens->links[a]= newglobadr(fd, sens->links[a]);
if(sens->type==SENS_TOUCH) {
bTouchSensor *ts= sens->data;
ts->ma= newlibadr(fd, ob->id.lib, ts->ma);
@ -2968,11 +2966,9 @@ static void lib_link_object(FileData *fd, Main *main)
cont= ob->controllers.first;
while(cont) {
if(ob->id.lib==NULL) { // done in expand_main
for(a=0; a<cont->totlinks; a++) {
cont->links[a]= newglobadr(fd, cont->links[a]);
}
}
for(a=0; a<cont->totlinks; a++)
cont->links[a]= newglobadr(fd, cont->links[a]);
if(cont->type==CONT_PYTHON) {
bPythonCont *pc= cont->data;
pc->text= newlibadr(fd, ob->id.lib, pc->text);
@ -3600,9 +3596,9 @@ static void direct_link_scene(FileData *fd, Scene *sce)
{
Sequence temp;
char *poin;
long offset;
intptr_t offset;
offset= ((long)&(temp.seqbase)) - ((long)&temp);
offset= ((intptr_t)&(temp.seqbase)) - ((intptr_t)&temp);
/* root pointer */
if(ed->seqbasep == old_seqbasep) {
@ -4101,7 +4097,7 @@ static void direct_link_screen(FileData *fd, bScreen *sc)
while(se) {
se->v1= newdataadr(fd, se->v1);
se->v2= newdataadr(fd, se->v2);
if( (long)se->v1 > (long)se->v2) {
if( (intptr_t)se->v1 > (intptr_t)se->v2) {
sv= se->v1;
se->v1= se->v2;
se->v2= sv;
@ -7737,31 +7733,6 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
idproperties_fix_group_lengths(main->brush);
idproperties_fix_group_lengths(main->particle);
}
/* only needed until old bad svn/RC1,2 files are saved with a > 17 version -dg */
if(main->versionfile == 245 && main->subversionfile < 17) {
ModifierData *md;
Object *ob;
for(ob = main->object.first; ob; ob= ob->id.next) {
for(md=ob->modifiers.first; md; ) {
if(md->type==eModifierType_Cloth) {
ModifierData *next;
MEM_freeN(((ClothModifierData *)md)->sim_parms);
MEM_freeN(((ClothModifierData *)md)->coll_parms);
MEM_freeN(((ClothModifierData *)md)->point_cache);
((ClothModifierData *)md)->sim_parms = NULL;
((ClothModifierData *)md)->coll_parms = NULL;
((ClothModifierData *)md)->point_cache = NULL;
next=md->next;
BLI_remlink(&ob->modifiers, md);
md = next;
}
else
md = md->next;
}
}
}
/* sun/sky */
if(main->versionfile < 246) {
@ -7788,6 +7759,14 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
for(me=main->mesh.first; me; me= me->id.next)
alphasort_version_246(fd, lib, me);
}
if(main->versionfile <= 246 && main->subversionfile < 1){
Object *ob;
for(ob = main->object.first; ob; ob= ob->id.next) {
if(ob->pd && (ob->pd->forcefield == PFIELD_WIND))
ob->pd->f_noise = 0.0;
}
}
/* WATCH IT!!!: pointers from libdata have not been converted yet here! */
/* WATCH IT 2!: Userdef struct init has to be in src/usiblender.c! */
@ -8510,9 +8489,6 @@ static void expand_object(FileData *fd, Main *mainvar, Object *ob)
sens= ob->sensors.first;
while(sens) {
for(a=0; a<sens->totlinks; a++) {
sens->links[a]= newglobadr(fd, sens->links[a]);
}
if(sens->type==SENS_TOUCH) {
bTouchSensor *ts= sens->data;
expand_doit(fd, mainvar, ts->ma);
@ -8526,9 +8502,6 @@ static void expand_object(FileData *fd, Main *mainvar, Object *ob)
cont= ob->controllers.first;
while(cont) {
for(a=0; a<cont->totlinks; a++) {
cont->links[a]= newglobadr(fd, cont->links[a]);
}
if(cont->type==CONT_PYTHON) {
bPythonCont *pc= cont->data;
expand_doit(fd, mainvar, pc->text);

@ -608,6 +608,9 @@ static void write_sensors(WriteData *wd, ListBase *lb)
case SENS_ACTUATOR:
writestruct(wd, DATA, "bActuatorSensor", 1, sens->data);
break;
case SENS_DELAY:
writestruct(wd, DATA, "bDelaySensor", 1, sens->data);
break;
case SENS_COLLISION:
writestruct(wd, DATA, "bCollisionSensor", 1, sens->data);
break;

@ -50,10 +50,12 @@
#include "plugin.h"
#include "MEM_guardedalloc.h"
#include "BLO_sys_types.h" // needed for intptr_t
#include "BLI_blenlib.h" /* util and noise functions */
#include "BLI_threads.h" /* For threadsfe guardedalloc malloc/calloc/free */
#include "IMB_imbuf.h" /* image buffer stuff */
#define GET_INT_FROM_POINTER(i) ((int)(long)(i)) /* should use BKE_utildefines.h */
#define GET_INT_FROM_POINTER(i) ((int)(intptr_t)(i)) /* should use BKE_utildefines.h */
/* -------------------------------------------------------------------------- */
/* stuff from util.h */

@ -67,12 +67,12 @@ fillCineonFileInfo(CineonFile* cineon, CineonFileInformation* fileInfo, const ch
static void
dumpCineonFileInfo(CineonFileInformation* fileInfo) {
d_printf("\n--File Information--\n");
d_printf("Magic: %8.8lX\n", (unsigned long)ntohl(fileInfo->magic_num));
d_printf("Image Offset %ld\n", (long)ntohl(fileInfo->image_offset));
d_printf("Generic Header size %ld\n", (long)ntohl(fileInfo->gen_hdr_size));
d_printf("Industry Header size %ld\n", (long)ntohl(fileInfo->ind_hdr_size));
d_printf("User Data size %ld\n", (long)ntohl(fileInfo->user_data_size));
d_printf("File size %ld\n", (long)ntohl(fileInfo->file_size));
d_printf("Magic: %8.8lX\n", (uintptr_t)ntohl(fileInfo->magic_num));
d_printf("Image Offset %ld\n", (intptr_t)ntohl(fileInfo->image_offset));
d_printf("Generic Header size %ld\n", (intptr_t)ntohl(fileInfo->gen_hdr_size));
d_printf("Industry Header size %ld\n", (intptr_t)ntohl(fileInfo->ind_hdr_size));
d_printf("User Data size %ld\n", (intptr_t)ntohl(fileInfo->user_data_size));
d_printf("File size %ld\n", (intptr_t)ntohl(fileInfo->file_size));
d_printf("Version \"%s\"\n", fileInfo->vers);
d_printf("File name \"%s\"\n", fileInfo->file_name);
d_printf("Creation date \"%s\"\n", fileInfo->create_date);
@ -112,11 +112,11 @@ dumpCineonChannelInfo(CineonChannelInformation* chan) {
default: d_printf(" (unknown)\n"); break;
}
d_printf(" Bits per pixel %d\n", chan->bits_per_pixel);
d_printf(" Pixels per line %ld\n", (long)ntohl(chan->pixels_per_line));
d_printf(" Lines per image %ld\n", (long)ntohl(chan->lines_per_image));
d_printf(" Ref low data %ld\n", (long)ntohl(chan->ref_low_data));
d_printf(" Pixels per line %ld\n", (intptr_t)ntohl(chan->pixels_per_line));
d_printf(" Lines per image %ld\n", (intptr_t)ntohl(chan->lines_per_image));
d_printf(" Ref low data %ld\n", (intptr_t)ntohl(chan->ref_low_data));
d_printf(" Ref low quantity %f\n", ntohf(chan->ref_low_quantity));
d_printf(" Ref high data %ld\n", (long)ntohl(chan->ref_high_data));
d_printf(" Ref high data %ld\n", (intptr_t)ntohl(chan->ref_high_data));
d_printf(" Ref high quantity %f\n", ntohf(chan->ref_high_quantity));
}
@ -231,8 +231,8 @@ dumpCineonFormatInfo(CineonFormatInformation* formatInfo) {
} else {
d_printf(" positive\n");
}
d_printf("End of line padding %ld\n", (long)ntohl(formatInfo->line_padding));
d_printf("End of channel padding %ld\n", (long)ntohl(formatInfo->channel_padding));
d_printf("End of line padding %ld\n", (intptr_t)ntohl(formatInfo->line_padding));
d_printf("End of channel padding %ld\n", (intptr_t)ntohl(formatInfo->channel_padding));
}
static void
@ -256,8 +256,8 @@ fillCineonOriginationInfo(CineonFile* cineon,
static void
dumpCineonOriginationInfo(CineonOriginationInformation* originInfo) {
d_printf("\n--Origination Information--\n");
d_printf("X offset %ld\n", (long)ntohl(originInfo->x_offset));
d_printf("Y offset %ld\n", (long)ntohl(originInfo->y_offset));
d_printf("X offset %ld\n", (intptr_t)ntohl(originInfo->x_offset));
d_printf("Y offset %ld\n", (intptr_t)ntohl(originInfo->y_offset));
d_printf("File name \"%s\"\n", originInfo->file_name);
d_printf("Creation date \"%s\"\n", originInfo->create_date);
d_printf("Creation time \"%s\"\n", originInfo->create_time);
@ -529,7 +529,7 @@ cineonOpen(const char* filename) {
/* let's assume cineon files are always network order */
if (header.fileInfo.magic_num != ntohl(CINEON_FILE_MAGIC)) {
if (verbose) d_printf("Bad magic number %8.8lX in \"%s\".\n",
(unsigned long)ntohl(header.fileInfo.magic_num), filename);
(uintptr_t)ntohl(header.fileInfo.magic_num), filename);
cineonClose(cineon);
return 0;
}
@ -628,7 +628,7 @@ cineonOpenFromMem(unsigned char *mem, unsigned int size) {
/* let's assume cineon files are always network order */
if (header.fileInfo.magic_num != ntohl(CINEON_FILE_MAGIC)) {
if (verbose) d_printf("Bad magic number %8.8lX in\n", (unsigned long)ntohl(header.fileInfo.magic_num));
if (verbose) d_printf("Bad magic number %8.8lX in\n", (uintptr_t)ntohl(header.fileInfo.magic_num));
cineonClose(cineon);
return 0;

@ -58,15 +58,15 @@ fillDpxChannelInfo(DpxFile* dpx, DpxChannelInformation* chan, int des) {
static void
dumpDpxChannelInfo(DpxChannelInformation* chan) {
d_printf(" Signage %ld", (long)ntohl(chan->signage));
d_printf(" Ref low data %ld\n", (long)ntohl(chan->ref_low_data));
d_printf(" Signage %ld", (intptr_t)ntohl(chan->signage));
d_printf(" Ref low data %ld\n", (intptr_t)ntohl(chan->ref_low_data));
d_printf(" Ref low quantity %f\n", ntohf(chan->ref_low_quantity));
d_printf(" Ref high data %ld\n", (long)ntohl(chan->ref_high_data));
d_printf(" Ref high data %ld\n", (intptr_t)ntohl(chan->ref_high_data));
d_printf(" Ref high quantity %f\n", ntohf(chan->ref_high_quantity));
d_printf(" Designator1: %d,", chan->designator1);
d_printf(" Bits per pixel %d\n", chan->bits_per_pixel);
d_printf(" Packing: %d,", ntohs(chan->packing));
d_printf(" Data Offset: %ld,", (long)ntohl(chan->data_offset));
d_printf(" Data Offset: %ld,", (intptr_t)ntohl(chan->data_offset));
}
static void
@ -110,19 +110,19 @@ static void
dumpDpxFileInfo(DpxFileInformation* fileInfo) {
d_printf("\n--File Information--\n");
d_printf("Magic: %8.8lX\n", (unsigned long)ntohl(fileInfo->magic_num));
d_printf("Image Offset %ld\n", (long)ntohl(fileInfo->offset));
d_printf("Image Offset %ld\n", (intptr_t)ntohl(fileInfo->offset));
d_printf("Version \"%s\"\n", fileInfo->vers);
d_printf("File size %ld\n", (long)ntohl(fileInfo->file_size));
d_printf("Ditto key %ld\n", (long)ntohl(fileInfo->ditto_key));
d_printf("Generic Header size %ld\n", (long)ntohl(fileInfo->gen_hdr_size));
d_printf("Industry Header size %ld\n", (long)ntohl(fileInfo->ind_hdr_size));
d_printf("User Data size %ld\n", (long)ntohl(fileInfo->user_data_size));
d_printf("File size %ld\n", (intptr_t)ntohl(fileInfo->file_size));
d_printf("Ditto key %ld\n", (intptr_t)ntohl(fileInfo->ditto_key));
d_printf("Generic Header size %ld\n", (intptr_t)ntohl(fileInfo->gen_hdr_size));
d_printf("Industry Header size %ld\n", (intptr_t)ntohl(fileInfo->ind_hdr_size));
d_printf("User Data size %ld\n", (intptr_t)ntohl(fileInfo->user_data_size));
d_printf("File name \"%s\"\n", fileInfo->file_name);
d_printf("Creation date \"%s\"\n", fileInfo->create_date);
d_printf("Creator \"%s\"\n", fileInfo->creator);
d_printf("Project \"%s\"\n", fileInfo->project);
d_printf("Copyright \"%s\"\n", fileInfo->copyright);
d_printf("Key %ld\n", (long)ntohl(fileInfo->key));
d_printf("Key %ld\n", (intptr_t)ntohl(fileInfo->key));
}
static void
@ -150,8 +150,8 @@ dumpDpxImageInfo(DpxImageInformation* imageInfo) {
d_printf("Image orientation %d,", ntohs(imageInfo->orientation));
n = ntohs(imageInfo->channels_per_image);
d_printf("Channels %d\n", n);
d_printf("Pixels per line %ld\n", (long)ntohl(imageInfo->pixels_per_line));
d_printf("Lines per image %ld\n", (long)ntohl(imageInfo->lines_per_image));
d_printf("Pixels per line %ld\n", (intptr_t)ntohl(imageInfo->pixels_per_line));
d_printf("Lines per image %ld\n", (intptr_t)ntohl(imageInfo->lines_per_image));
for (i = 0; i < n; ++i) {
d_printf(" --Channel %d--\n", i);
dumpDpxChannelInfo(&imageInfo->channel[i]);
@ -166,12 +166,12 @@ fillDpxOriginationInfo(
static void
dumpDpxOriginationInfo(DpxOriginationInformation* originInfo) {
d_printf("\n--Origination Information--\n");
d_printf("X offset %ld\n", (long)ntohl(originInfo->x_offset));
d_printf("Y offset %ld\n", (long)ntohl(originInfo->y_offset));
d_printf("X offset %ld\n", (intptr_t)ntohl(originInfo->x_offset));
d_printf("Y offset %ld\n", (intptr_t)ntohl(originInfo->y_offset));
d_printf("X centre %f\n", ntohf(originInfo->x_centre));
d_printf("Y centre %f\n", ntohf(originInfo->y_centre));
d_printf("Original X %ld\n", (long)ntohl(originInfo->x_original_size));
d_printf("Original Y %ld\n", (long)ntohl(originInfo->y_original_size));
d_printf("Original X %ld\n", (intptr_t)ntohl(originInfo->x_original_size));
d_printf("Original Y %ld\n", (intptr_t)ntohl(originInfo->y_original_size));
d_printf("File name \"%s\"\n", originInfo->file_name);
d_printf("Creation time \"%s\"\n", originInfo->creation_time);
d_printf("Input device \"%s\"\n", originInfo->input_device);
@ -417,7 +417,7 @@ intern_dpxOpen(int mode, const char* bytestuff, int bufsize) {
/* let's assume dpx files are always network order */
if (header.fileInfo.magic_num != ntohl(DPX_FILE_MAGIC)) {
if (verbose) d_printf("Bad magic number %8.8lX in \"%s\".\n",
(unsigned long)ntohl(header.fileInfo.magic_num), filename);
(uintptr_t)ntohl(header.fileInfo.magic_num), filename);
dpxClose(dpx);
return 0;
}

@ -34,7 +34,9 @@
extern "C" {
#endif
#include "BLO_sys_types.h" // for intptr_t support
#undef ntohl
#undef htonl
typedef int (GetRowFn)(LogImageFile* logImage, unsigned short* row, int lineNum);
typedef int (SetRowFn)(LogImageFile* logImage, const unsigned short* row, int lineNum);
typedef void (CloseFn)(LogImageFile* logImage);
@ -80,7 +82,7 @@ struct _Log_Image_File_t_
CloseFn* close;
unsigned char *membuffer;
unsigned long membuffersize;
uintptr_t membuffersize;
unsigned char *memcursor;
};

@ -24,10 +24,10 @@
#include "logImageCore.h"
int logimage_fseek(void* logfile, long offsett, int origin)
int logimage_fseek(void* logfile, intptr_t offsett, int origin)
{
struct _Log_Image_File_t_ *file = (struct _Log_Image_File_t_*) logfile;
long offset = offsett;
intptr_t offset = offsett;
if (file->file) fseek(file->file, offset, origin);
else { /*we're seeking in memory*/
@ -38,7 +38,7 @@ int logimage_fseek(void* logfile, long offsett, int origin)
if (offset > file->membuffersize) return 1;
file->memcursor = (file->membuffer + file->membuffersize) - offset;
} else if (origin==SEEK_CUR) {
unsigned long pos = (unsigned long)file->membuffer - (unsigned long)file->memcursor;
uintptr_t pos = (uintptr_t)file->membuffer - (uintptr_t)file->memcursor;
if (pos + offset > file->membuffersize) return 1;
if (pos < 0) return 1;
file->memcursor += offset;

@ -22,7 +22,7 @@
#ifndef _LOGMEMFILE_H
#define _LOGMEMFILE_H
int logimage_fseek(void* logfile, long offsett, int origin);
int logimage_fseek(void* logfile, intptr_t offsett, int origin);
int logimage_fwrite(void *buffer, unsigned int size, unsigned int count, void *logfile);
int logimage_fread(void *buffer, unsigned int size, unsigned int count, void *logfile);

@ -39,6 +39,8 @@
#include "IMB_allocimbuf.h"
#include "IMB_filter.h"
#include "BLO_sys_types.h" // for intptr_t support
/************************************************************************/
/* SCALING */
/************************************************************************/
@ -490,8 +492,8 @@ static void enlarge_picture_byte(
/ (double) (src_width - 1.001);
double ratioy = (double) (dst_height - 1.0)
/ (double) (src_height - 1.001);
unsigned long x_src, dx_src, x_dst;
unsigned long y_src, dy_src, y_dst;
uintptr_t x_src, dx_src, x_dst;
uintptr_t y_src, dy_src, y_dst;
dx_src = 65536.0 / ratiox;
dy_src = 65536.0 / ratioy;
@ -500,8 +502,8 @@ static void enlarge_picture_byte(
for (y_dst = 0; y_dst < dst_height; y_dst++) {
unsigned char* line1 = src + (y_src >> 16) * 4 * src_width;
unsigned char* line2 = line1 + 4 * src_width;
unsigned long weight1y = 65536 - (y_src & 0xffff);
unsigned long weight2y = 65536 - weight1y;
uintptr_t weight1y = 65536 - (y_src & 0xffff);
uintptr_t weight2y = 65536 - weight1y;
if ((y_src >> 16) == src_height - 1) {
line2 = line1;
@ -509,8 +511,8 @@ static void enlarge_picture_byte(
x_src = 0;
for (x_dst = 0; x_dst < dst_width; x_dst++) {
unsigned long weight1x = 65536 - (x_src & 0xffff);
unsigned long weight2x = 65536 - weight1x;
uintptr_t weight1x = 65536 - (x_src & 0xffff);
uintptr_t weight2x = 65536 - weight1x;
unsigned long x = (x_src >> 16) * 4;
@ -557,12 +559,12 @@ static void enlarge_picture_byte(
}
struct scale_outpix_byte {
unsigned long r;
unsigned long g;
unsigned long b;
unsigned long a;
uintptr_t r;
uintptr_t g;
uintptr_t b;
uintptr_t a;
unsigned long weight;
uintptr_t weight;
};
static void shrink_picture_byte(
@ -571,9 +573,9 @@ static void shrink_picture_byte(
{
double ratiox = (double) (dst_width) / (double) (src_width);
double ratioy = (double) (dst_height) / (double) (src_height);
unsigned long x_src, dx_dst, x_dst;
unsigned long y_src, dy_dst, y_dst;
long y_counter;
uintptr_t x_src, dx_dst, x_dst;
uintptr_t y_src, dy_dst, y_dst;
intptr_t y_counter;
unsigned char * dst_begin = dst;
struct scale_outpix_byte * dst_line1 = NULL;
@ -593,16 +595,16 @@ static void shrink_picture_byte(
y_counter = 65536;
for (y_src = 0; y_src < src_height; y_src++) {
unsigned char* line = src + y_src * 4 * src_width;
unsigned long weight1y = 65536 - (y_dst & 0xffff);
unsigned long weight2y = 65536 - weight1y;
uintptr_t weight1y = 65536 - (y_dst & 0xffff);
uintptr_t weight2y = 65536 - weight1y;
x_dst = 0;
for (x_src = 0; x_src < src_width; x_src++) {
unsigned long weight1x = 65536 - (x_dst & 0xffff);
unsigned long weight2x = 65536 - weight1x;
uintptr_t weight1x = 65536 - (x_dst & 0xffff);
uintptr_t weight2x = 65536 - weight1x;
unsigned long x = x_dst >> 16;
uintptr_t x = x_dst >> 16;
unsigned long w;
uintptr_t w;
w = (weight1y * weight1x) >> 16;
@ -643,13 +645,13 @@ static void shrink_picture_byte(
y_dst += dy_dst;
y_counter -= dy_dst;
if (y_counter < 0) {
unsigned long x;
uintptr_t x;
struct scale_outpix_byte * temp;
y_counter += 65536;
for (x=0; x < dst_width; x++) {
unsigned long f = 0x80000000UL
uintptr_t f = 0x80000000UL
/ dst_line1[x].weight;
*dst++ = (dst_line1[x].r * f) >> 15;
*dst++ = (dst_line1[x].g * f) >> 15;
@ -664,9 +666,9 @@ static void shrink_picture_byte(
}
}
if (dst - dst_begin < dst_width * dst_height * 4) {
unsigned long x;
uintptr_t x;
for (x = 0; x < dst_width; x++) {
unsigned long f = 0x80000000UL / dst_line1[x].weight;
uintptr_t f = 0x80000000UL / dst_line1[x].weight;
*dst++ = (dst_line1[x].r * f) >> 15;
*dst++ = (dst_line1[x].g * f) >> 15;
*dst++ = (dst_line1[x].b * f) >> 15;
@ -698,8 +700,8 @@ static void enlarge_picture_float(
/ (double) (src_width - 1.001);
double ratioy = (double) (dst_height - 1.0)
/ (double) (src_height - 1.001);
unsigned long x_dst;
unsigned long y_dst;
uintptr_t x_dst;
uintptr_t y_dst;
double x_src, dx_src;
double y_src, dy_src;
@ -727,7 +729,7 @@ static void enlarge_picture_float(
float w12 = weight1y * weight2x;
float w22 = weight2y * weight2x;
unsigned long x = ((int) x_src) * 4;
uintptr_t x = ((int) x_src) * 4;
*dst++ = line1[x] * w11
+ line2[x] * w21
@ -770,8 +772,8 @@ static void shrink_picture_float(
{
double ratiox = (double) (dst_width) / (double) (src_width);
double ratioy = (double) (dst_height) / (double) (src_height);
unsigned long x_src;
unsigned long y_src;
uintptr_t x_src;
uintptr_t y_src;
float dx_dst, x_dst;
float dy_dst, y_dst;
float y_counter;
@ -794,14 +796,14 @@ static void shrink_picture_float(
y_counter = 1.0;
for (y_src = 0; y_src < src_height; y_src++) {
float* line = src + y_src * 4 * src_width;
unsigned long weight1y = 1.0 - (y_dst - (int) y_dst);
unsigned long weight2y = 1.0 - weight1y;
uintptr_t weight1y = 1.0 - (y_dst - (int) y_dst);
uintptr_t weight2y = 1.0 - weight1y;
x_dst = 0;
for (x_src = 0; x_src < src_width; x_src++) {
unsigned long weight1x = 1.0 - (x_dst - (int) x_dst);
unsigned long weight2x = 1.0 - weight1x;
uintptr_t weight1x = 1.0 - (x_dst - (int) x_dst);
uintptr_t weight2x = 1.0 - weight1x;
unsigned long x = (int) x_dst;
uintptr_t x = (int) x_dst;
float w;
@ -844,7 +846,7 @@ static void shrink_picture_float(
y_dst += dy_dst;
y_counter -= dy_dst;
if (y_counter < 0) {
unsigned long x;
uintptr_t x;
struct scale_outpix_float * temp;
y_counter += 1.0;
@ -864,7 +866,7 @@ static void shrink_picture_float(
}
}
if (dst - dst_begin < dst_width * dst_height * 4) {
unsigned long x;
uintptr_t x;
for (x = 0; x < dst_width; x++) {
float f = 1.0 / dst_line1[x].weight;
*dst++ = dst_line1[x].r * f;

@ -40,7 +40,7 @@ extern void objects_bake_render_menu(void);
extern void objects_bake_render_ui(short event);
extern void objects_bake_render(short event, char **error_msg);
extern long mesh_octree_table(struct Object *ob, float *co, char mode);
extern intptr_t mesh_octree_table(struct Object *ob, float *co, char mode);
extern int mesh_get_x_mirror_vert(struct Object *ob, int index);
extern struct EditVert *editmesh_get_x_mirror_vert(struct Object *ob, float *co);
extern int *mesh_get_x_mirror_faces(struct Object *ob);

@ -354,8 +354,8 @@ typedef short IPO_Channel;
/* ******************** */
/* particle ipos */
#define PART_TOTIPO 19
#define PART_TOTNAM 19
#define PART_TOTIPO 22
#define PART_TOTNAM 22
#define PART_EMIT_FREQ 1
#define PART_EMIT_LIFE 2
@ -381,6 +381,10 @@ typedef short IPO_Channel;
#define PART_BB_TILT 19
#define PART_PD_FSTR 20
#define PART_PD_FFALL 21
#define PART_PD_FMAXD 22
/* these are IpoCurve specific */
/* **************** IPO ********************* */

@ -67,6 +67,9 @@ typedef struct PartDeflect {
float tex_nabla;
short tex_mode, kink, kink_axis, rt2;
struct Tex *tex; /* Texture of the texture effector */
struct RNG *rng; /* random noise generator for e.g. wind */
float f_noise; /* noise of force (currently used for wind) */
int pad;
} PartDeflect;
typedef struct PointCache {

@ -88,6 +88,13 @@ typedef struct bActuatorSensor {
char name[32];
} bActuatorSensor;
typedef struct bDelaySensor {
short delay;
short duration;
short flag;
short pad;
} bDelaySensor;
typedef struct bCollisionSensor {
char name[32]; /* property name */
char materialName[32]; /* material */
@ -204,6 +211,7 @@ typedef struct bJoystickSensor {
#define SENS_MESSAGE 10
#define SENS_JOYSTICK 11
#define SENS_ACTUATOR 12
#define SENS_DELAY 13
/* sensor->flag */
#define SENS_SHOW 1
#define SENS_DEL 2
@ -254,5 +262,7 @@ typedef struct bJoystickSensor {
#define SENS_JOY_HAT 2
#define SENS_JOY_HAT_DIR 0
#define SENS_DELAY_REPEAT 1
#endif

@ -55,6 +55,8 @@
#include "MEM_guardedalloc.h"
#include "DNA_sdna_types.h"
#include "BLO_sys_types.h" // for intptr_t support
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@ -955,7 +957,7 @@ int make_structDNA(char *baseDirectory, FILE *file)
/* calculate size of datablock with strings */
cp= names[nr_names-1];
cp+= strlen(names[nr_names-1]) + 1; /* +1: null-terminator */
len= (long) (cp - (char*) names[0]);
len= (intptr_t) (cp - (char*) names[0]);
len= (len+3) & ~3;
dna_write(file, names[0], len);
@ -968,7 +970,7 @@ int make_structDNA(char *baseDirectory, FILE *file)
/* calculate datablock size */
cp= types[nr_types-1];
cp+= strlen(types[nr_types-1]) + 1; /* +1: null-terminator */
len= (long) (cp - (char*) types[0]);
len= (intptr_t) (cp - (char*) types[0]);
len= (len+3) & ~3;
dna_write(file, types[0], len);
@ -990,7 +992,7 @@ int make_structDNA(char *baseDirectory, FILE *file)
/* calc datablock size */
sp= structs[nr_structs-1];
sp+= 2+ 2*( sp[1] );
len= (long) ((char*) sp - (char*) structs[0]);
len= (intptr_t) ((char*) sp - (char*) structs[0]);
len= (len+3) & ~3;
dna_write(file, structs[0], len);

@ -1554,6 +1554,12 @@ static PyObject *Method_Number( PyObject * self, PyObject * args )
UI_METHOD_ERRORCHECK;
if ( !PyNumber_Check(inio) || !PyNumber_Check(mino) ||
!PyNumber_Check(maxo) ) {
return EXPP_ReturnPyObjError( PyExc_TypeError,
"expected ints or floats for the initial, min and max values" );
}
but = newbutton( );
if (tip) strncpy(but->tooltip, tip, BPY_MAX_TOOLTIP);
block = Get_uiBlock( );

@ -132,9 +132,12 @@ static PyObject *Text3d_getAlignment( BPy_Text3d * self );
static PyObject *Text3d_setAlignment( BPy_Text3d * self, PyObject * args );
static PyObject *Text3d_getFont( BPy_Text3d * self );
static PyObject *Text3d_setFont( BPy_Text3d * self, PyObject * args );
static PyObject *Text3d_getMaterial( BPy_Text3d * self, PyObject * value );
static PyObject *Text3d_setMaterial( BPy_Text3d * self, PyObject * args );
static PyObject *Text3d_addFrame( BPy_Text3d * self );
static PyObject *Text3d_removeFrame( BPy_Text3d * self, PyObject * args );
/*****************************************************************************/
/* Python BPy_Text3d methods table: */
/*****************************************************************************/
@ -210,6 +213,10 @@ static PyMethodDef BPy_Text3d_methods[] = {
METH_NOARGS, "() - Gets font list for Text3d"},
{"setFont", ( PyCFunction ) Text3d_setFont,
METH_VARARGS, "() - Sets font for Text3d"},
{"getMaterial", ( PyCFunction ) Text3d_getMaterial,
METH_O, "() - Gets font list for Text3d"},
{"setMaterial", ( PyCFunction ) Text3d_setMaterial,
METH_VARARGS, "() - Sets font for Text3d"},
{"addFrame", ( PyCFunction ) Text3d_addFrame,
METH_NOARGS, "() - adds a new text frame"},
{"removeFrame", ( PyCFunction ) Text3d_removeFrame,
@ -1132,6 +1139,45 @@ static PyObject *Text3d_setFont( BPy_Text3d * self, PyObject * args )
Py_RETURN_NONE;
}
/* todo, add style access, will be almost exact copy of these 2 */
static PyObject *Text3d_getMaterial( BPy_Text3d * self, PyObject * value )
{
int index = PyInt_AsLong( value );
if (index == -1 && PyErr_Occurred())
return EXPP_ReturnPyObjError( PyExc_TypeError, "expected a character index" );
if (index < 0)
index = self->curve->len + index;
if ( index < 0 || index >= self->curve->len )
return EXPP_ReturnPyObjError( PyExc_IndexError, "character index out of range" );
return PyInt_FromLong( self->curve->strinfo[index].mat_nr );
}
static PyObject *Text3d_setMaterial( BPy_Text3d * self, PyObject * args )
{
int index, mat_nr;
if( !PyArg_ParseTuple( args, "ii",&index, &mat_nr) )
return NULL; /* Python error is ok */
if (index < 0)
index = self->curve->len + index;
if ( index < 0 || index >= self->curve->len )
return EXPP_ReturnPyObjError( PyExc_IndexError, "character index out of range" );
if (mat_nr < 0)
mat_nr = self->curve->totcol + mat_nr;
if ( mat_nr < 0 || mat_nr >= self->curve->totcol )
return EXPP_ReturnPyObjError( PyExc_IndexError, "material index out of range" );
self->curve->strinfo[index].mat_nr = mat_nr;
Py_RETURN_NONE;
}
static PyObject *Text3d_addFrame( BPy_Text3d * self )
{
Curve *cu = self->curve;

@ -521,6 +521,15 @@ class Vector:
@return: Return a quaternion rotation from the vector and the track and up axis.
"""
def reflect(mirror):
"""
Return the reflection vector from the mirror vector argument.
@type mirror: Vector object
@param mirror: This vector could be a normal from the reflecting surface.
@rtype: Vector object matching the size of this vector.
@return: The reflected vector.
"""
class Euler:
"""
The Euler object

@ -287,6 +287,26 @@ class Text3d:
@param align: The new text3d's Alignment value.
"""
def getMaterial(index):
"""
get the material index of a character.
@rtype: int
@return: the material index if the character
@type index: int
@param index: the index of the character in a string
"""
def setMaterial(index, material_index):
"""
Set a characters material.
@note: after changing this youll need to update the object with object.makeDisplayList() to see the changes.
@rtype: None
@type index: int
@param index: the index of the character in a string
@type material_index: int
@param material_index: the material index set set the character.
"""
def addFrame():
"""
Adds a text frame. maximum number of frames is 255.

@ -42,6 +42,7 @@ char Vector_Resize3D_doc[] = "() - resize a vector to [x,y,z]";
char Vector_Resize4D_doc[] = "() - resize a vector to [x,y,z,w]";
char Vector_toPoint_doc[] = "() - create a new Point Object from this vector";
char Vector_ToTrackQuat_doc[] = "(track, up) - extract a quaternion from the vector and the track and up axis";
char Vector_reflect_doc[] = "(mirror) - return a vector reflected on the mirror normal";
char Vector_copy_doc[] = "() - return a copy of the vector";
/*-----------------------METHOD DEFINITIONS ----------------------*/
struct PyMethodDef Vector_methods[] = {
@ -53,6 +54,7 @@ struct PyMethodDef Vector_methods[] = {
{"resize4D", (PyCFunction) Vector_Resize4D, METH_NOARGS, Vector_Resize2D_doc},
{"toPoint", (PyCFunction) Vector_toPoint, METH_NOARGS, Vector_toPoint_doc},
{"toTrackQuat", ( PyCFunction ) Vector_ToTrackQuat, METH_VARARGS, Vector_ToTrackQuat_doc},
{"reflect", ( PyCFunction ) Vector_reflect, METH_O, Vector_reflect_doc},
{"copy", (PyCFunction) Vector_copy, METH_NOARGS, Vector_copy_doc},
{"__copy__", (PyCFunction) Vector_copy, METH_NOARGS, Vector_copy_doc},
{NULL, NULL, 0, NULL}
@ -273,7 +275,55 @@ PyObject *Vector_ToTrackQuat( VectorObject * self, PyObject * args )
return newQuaternionObject(quat, Py_NEW);
}
/*----------------------------Vector.reflect(mirror) ----------------------
return a reflected vector on the mirror normal
((2 * DotVecs(vec, mirror)) * mirror) - vec
using arithb.c would be nice here */
PyObject *Vector_reflect( VectorObject * self, PyObject * value )
{
VectorObject *mirrvec;
float mirror[3];
float vec[3];
float reflect[4] = {0.0f, 0.0f, 0.0f, 0.0f};
float dot2;
/* for normalizing */
int i;
float norm = 0.0f;
if (!VectorObject_Check(value))
return EXPP_ReturnPyObjError( PyExc_TypeError, "expected a vector argument" );
mirrvec = (VectorObject *)value;
mirror[0] = mirrvec->vec[0];
mirror[1] = mirrvec->vec[1];
if (mirrvec->size > 2) mirror[2] = mirrvec->vec[2];
else mirror[2] = 0.0;
/* normalize, whos idea was it not to use arithb.c? :-/ */
for(i = 0; i < 3; i++) {
norm += mirror[i] * mirror[i];
}
norm = (float) sqrt(norm);
for(i = 0; i < 3; i++) {
mirror[i] /= norm;
}
/* done */
vec[0] = self->vec[0];
vec[1] = self->vec[1];
if (self->size > 2) vec[2] = self->vec[2];
else vec[2] = 0.0;
dot2 = 2 * vec[0]*mirror[0]+vec[1]*mirror[1]+vec[2]*mirror[2];
reflect[0] = (dot2 * mirror[0]) - vec[0];
reflect[1] = (dot2 * mirror[1]) - vec[1];
reflect[2] = (dot2 * mirror[2]) - vec[2];
return newVectorObject(reflect, self->size, Py_NEW);
}
/*----------------------------Vector.copy() --------------------------------------
return a copy of the vector */

@ -52,6 +52,7 @@ PyObject *Vector_Resize3D( VectorObject * self );
PyObject *Vector_Resize4D( VectorObject * self );
PyObject *Vector_toPoint( VectorObject * self );
PyObject *Vector_ToTrackQuat( VectorObject * self, PyObject * args );
PyObject *Vector_reflect( VectorObject * self, PyObject * value );
PyObject *Vector_copy( VectorObject * self );
PyObject *newVectorObject(float *vec, int size, int type);

@ -29,7 +29,7 @@ FILE(GLOB SRC intern/source/*.c)
SET(INC
extern/include ../blenlib ../blenkernel ../makesdna ../include
../../../intern/guardedalloc ../render/extern/include
../render/intern/include
../render/intern/include ../blenloader
)
BLENDERLIB_NOLIST(blender_radiosity "${SRC}" "${INC}")

@ -5,7 +5,7 @@ sources = env.Glob('intern/source/*.c')
incs = 'extern/include ../blenlib ../blenkernel ../makesdna ../include'
incs += ' #/intern/guardedalloc ../render/extern/include'
incs += ' ../render/intern/include'
incs += ' ../render/intern/include ../blenloader'
incs += ' ' + env['BF_OPENGL_INC']

@ -44,6 +44,7 @@ CPPFLAGS += -I../../../blenlib
CPPFLAGS += -I../../../makesdna
CPPFLAGS += -I../../../imbuf
CPPFLAGS += -I../../../
CPPFLAGS += -I../../../blenloader
CPPFLAGS += -I$(NAN_GUARDEDALLOC)/include
# first /include is my own includes, second are the external includes

@ -50,6 +50,8 @@
#include "radio.h"
#include "BLO_sys_types.h" // for intptr_t support
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@ -167,14 +169,14 @@ void *calloc_fast(int size)
void free_fast(void *poin, int size)
{
MallocGroup *mg;
long val;
intptr_t val;
mg= MallocBase.last;
while(mg) {
if(mg->size==size) {
if( ((long)poin) >= ((long)mg->data) ) {
if( ((long)poin) < ((long)(mg->data+MAL_GROUPSIZE*size)) ) {
val= ((long)poin) - ((long)mg->data);
if( ((intptr_t)poin) >= ((intptr_t)mg->data) ) {
if( ((intptr_t)poin) < ((intptr_t)(mg->data+MAL_GROUPSIZE*size)) ) {
val= ((intptr_t)poin) - ((intptr_t)mg->data);
val/= size;
mg->curfree= val;
mg->flags[val]= 0;

@ -68,6 +68,8 @@
#include "radio.h"
#include "BLO_sys_types.h" // for intptr_t support
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@ -179,7 +181,7 @@ int vergedge(const void *v1,const void *v2)
void addedge(float *v1, float *v2, EdSort *es)
{
if( ((long)v1)<((long)v2) ) {
if( ((intptr_t)v1)<((intptr_t)v2) ) {
es->v1= v1;
es->v2= v2;
}

@ -29,7 +29,7 @@ FILE(GLOB SRC intern/source/*.c)
SET(INC
intern/include ../../../intern/guardedalloc ../blenlib ../makesdna
extern/include ../blenkernel ../radiosity/extern/include ../imbuf
../quicktime ../include ../../kernel/gen_messaging ../yafray
../quicktime ../include ../../kernel/gen_messaging ../yafray ../blenloader
)
IF(WITH_OPENEXR)

@ -6,7 +6,7 @@ sources = env.Glob('intern/source/*.c')
incs = 'intern/include #/intern/guardedalloc ../blenlib ../makesdna'
incs += ' extern/include ../blenkernel ../radiosity/extern/include ../imbuf'
incs += ' ../quicktime ../include ../../kernel/gen_messaging'
incs += ' ../quicktime ../include ../../kernel/gen_messaging ../blenloader'
defs = []

@ -44,6 +44,8 @@
#include "RE_shader_ext.h" /* TexResult, ShadeResult, ShadeInput */
#include "sunsky.h"
#include "BLO_sys_types.h" // for intptr_t support
struct Object;
struct MemArena;
struct VertTableNode;
@ -89,11 +91,11 @@ typedef struct RenderPart
int *rectp; /* polygon index table */
int *rectz; /* zbuffer */
int *rectmask; /* negative zmask */
long *rectdaps; /* delta acum buffer for pixel structs */
intptr_t *rectdaps; /* delta acum buffer for pixel structs */
int *rectbacko; /* object table for backside sss */
int *rectbackp; /* polygon index table for backside sss */
int *rectbackz; /* zbuffer for backside sss */
long *rectall; /* buffer for all faces for sss */
intptr_t *rectall; /* buffer for all faces for sss */
rcti disprect; /* part coordinates within total picture */
int rectx, recty; /* the size */
@ -226,7 +228,7 @@ struct ISBData;
typedef struct ShadSampleBuf {
struct ShadSampleBuf *next, *prev;
long *zbuf;
intptr_t *zbuf;
char *cbuf;
} ShadSampleBuf;

@ -1670,7 +1670,7 @@ void cache_occ_samples(Render *re, RenderPart *pa, ShadeSample *ssamp)
OcclusionCacheSample *sample;
OccFace exclude;
ShadeInput *shi;
long *rd=NULL;
intptr_t *rd=NULL;
int *ro=NULL, *rp=NULL, *rz=NULL, onlyshadow;
int x, y, step = CACHE_STEP;

@ -138,7 +138,7 @@ static void print_error(char *str) {printf("ERROR: %s\n", str);}
static void stats_background(RenderStats *rs)
{
extern unsigned long mem_in_use;
extern uintptr_t mem_in_use;
float megs_used_memory= mem_in_use/(1024.0*1024.0);
char str[400], *spos= str;

@ -243,7 +243,7 @@ static void halo_tile(RenderPart *pa, RenderLayer *rl)
rcti disprect= pa->disprect, testrect= pa->disprect;
float dist, xsq, ysq, xn, yn;
float col[4];
long *rd= NULL;
intptr_t *rd= NULL;
int a, *rz, zz, y, sample, totsample, od;
short minx, maxx, miny, maxy, x;
unsigned int lay= rl->lay;
@ -324,7 +324,7 @@ static void lamphalo_tile(RenderPart *pa, RenderLayer *rl)
ShadeInput shi;
float *pass;
float fac, col[4];
long *rd= pa->rectdaps;
intptr_t *rd= pa->rectdaps;
int *rz= pa->rectz;
int x, y, sample, totsample, fullsample, od;
@ -767,7 +767,7 @@ static void shadeDA_tile(RenderPart *pa, RenderLayer *rl)
{
RenderResult *rr= pa->result;
ShadeSample ssamp;
long *rd, *rectdaps= pa->rectdaps;
intptr_t *rd, *rectdaps= pa->rectdaps;
int samp;
int x, y, seed, crop=0, offs=0, od;
@ -874,7 +874,7 @@ static void freeps(ListBase *lb)
lb->first= lb->last= NULL;
}
static void addps(ListBase *lb, long *rd, int obi, int facenr, int z, int maskz, unsigned short mask)
static void addps(ListBase *lb, intptr_t *rd, int obi, int facenr, int z, int maskz, unsigned short mask)
{
PixStrMain *psm;
PixStr *ps, *last= NULL;
@ -901,7 +901,7 @@ static void addps(ListBase *lb, long *rd, int obi, int facenr, int z, int maskz,
ps= psm->ps + psm->counter++;
if(last) last->next= ps;
else *rd= (long)ps;
else *rd= (intptr_t)ps;
ps->next= NULL;
ps->obi= obi;
@ -1027,7 +1027,7 @@ static void reset_sky_speed(RenderPart *pa, RenderLayer *rl)
static unsigned short *make_solid_mask(RenderPart *pa)
{
long *rd= pa->rectdaps;
intptr_t *rd= pa->rectdaps;
unsigned short *solidmask, *sp;
int x;
@ -1092,7 +1092,7 @@ void make_pixelstructs(RenderPart *pa, ZSpan *zspan, int sample, void *data)
{
ZbufSolidData *sdata= (ZbufSolidData*)data;
ListBase *lb= sdata->psmlist;
long *rd= pa->rectdaps;
intptr_t *rd= pa->rectdaps;
int *ro= zspan->recto;
int *rp= zspan->rectp;
int *rz= zspan->rectz;
@ -1133,7 +1133,7 @@ void zbufshadeDA_tile(RenderPart *pa)
/* initialize pixelstructs and edge buffer */
addpsmain(&psmlist);
pa->rectdaps= MEM_callocN(sizeof(long)*pa->rectx*pa->recty+4, "zbufDArectd");
pa->rectdaps= MEM_callocN(sizeof(intptr_t)*pa->rectx*pa->recty+4, "zbufDArectd");
if(rl->layflag & SCE_LAY_EDGE)
if(R.r.mode & R_EDGE)
@ -1433,7 +1433,7 @@ static void addps_sss(void *cb_handle, int obi, int facenr, int x, int y, int z)
return;
if(pa->rectall) {
long *rs= pa->rectall + pa->rectx*y + x;
intptr_t *rs= pa->rectall + pa->rectx*y + x;
addps(&handle->psmlist, rs, obi, facenr, z, 0, 0);
handle->totps++;
@ -1569,7 +1569,7 @@ void zbufshade_sss_tile(RenderPart *pa)
int *ro, *rz, *rp, *rbo, *rbz, *rbp, lay;
#if 0
PixStr *ps;
long *rs;
intptr_t *rs;
int z;
#endif
@ -1581,7 +1581,7 @@ void zbufshade_sss_tile(RenderPart *pa)
handle.psmlist.first= handle.psmlist.last= NULL;
addpsmain(&handle.psmlist);
pa->rectall= MEM_callocN(sizeof(long)*pa->rectx*pa->recty+4, "rectall");
pa->rectall= MEM_callocN(sizeof(intptr_t)*pa->rectx*pa->recty+4, "rectall");
#else
pa->recto= MEM_mallocN(sizeof(int)*pa->rectx*pa->recty, "recto");
pa->rectp= MEM_mallocN(sizeof(int)*pa->rectx*pa->recty, "rectp");

@ -171,7 +171,7 @@ static void compress_shadowbuf(ShadBuf *shb, int *rectz, int square)
{
ShadSampleBuf *shsample;
float dist;
unsigned long *ztile;
uintptr_t *ztile;
int *rz, *rz1, verg, verg1, size= shb->size;
int a, x, y, minx, miny, byt1, byt2;
char *rc, *rcline, *ctile, *zt;
@ -179,10 +179,10 @@ static void compress_shadowbuf(ShadBuf *shb, int *rectz, int square)
shsample= MEM_mallocN( sizeof(ShadSampleBuf), "shad sample buf");
BLI_addtail(&shb->buffers, shsample);
shsample->zbuf= MEM_mallocN( sizeof(unsigned long)*(size*size)/256, "initshadbuf2");
shsample->zbuf= MEM_mallocN( sizeof(uintptr_t)*(size*size)/256, "initshadbuf2");
shsample->cbuf= MEM_callocN( (size*size)/256, "initshadbuf3");
ztile= (unsigned long *)shsample->zbuf;
ztile= (uintptr_t *)shsample->zbuf;
ctile= shsample->cbuf;
/* help buffer */
@ -237,7 +237,7 @@ static void compress_shadowbuf(ShadBuf *shb, int *rectz, int square)
}
if(byt1 && byt2) { /* only store byte */
*ctile= 1;
*ztile= (unsigned long)MEM_mallocN(256+4, "tile1");
*ztile= (uintptr_t)MEM_mallocN(256+4, "tile1");
rz= (int *)*ztile;
*rz= *rz1;
@ -247,7 +247,7 @@ static void compress_shadowbuf(ShadBuf *shb, int *rectz, int square)
}
else if(byt1) { /* only store short */
*ctile= 2;
*ztile= (unsigned long)MEM_mallocN(2*256+4,"Tile2");
*ztile= (uintptr_t)MEM_mallocN(2*256+4,"Tile2");
rz= (int *)*ztile;
*rz= *rz1;
@ -260,7 +260,7 @@ static void compress_shadowbuf(ShadBuf *shb, int *rectz, int square)
}
else { /* store triple */
*ctile= 3;
*ztile= (unsigned long)MEM_mallocN(3*256,"Tile3");
*ztile= (uintptr_t)MEM_mallocN(3*256,"Tile3");
zt= (char *)*ztile;
rc= rcline;
@ -542,7 +542,7 @@ void freeshadowbuf(LampRen *lar)
v= (shb->size*shb->size)/256;
for(shsample= shb->buffers.first; shsample; shsample= shsample->next) {
long *ztile= shsample->zbuf;
intptr_t *ztile= shsample->zbuf;
char *ctile= shsample->cbuf;
for(b=0; b<v; b++, ztile++, ctile++)
@ -1752,7 +1752,7 @@ static void isb_make_buffer(RenderPart *pa, LampRen *lar)
ISBSample *samp, *samplebuf[16]; /* should be RE_MAX_OSA */
ISBBranch root;
MemArena *memarena;
long *rd;
intptr_t *rd;
int *recto, *rectp, x, y, sindex, sample, bsp_err=0;
/* storage for shadow, per thread */

@ -416,7 +416,7 @@ typedef struct StrandPart {
int *totapixbuf;
int *rectz;
int *rectmask;
long *rectdaps;
intptr_t *rectdaps;
int rectx, recty;
int sample;
@ -510,7 +510,7 @@ static void do_strand_fillac(void *handle, int x, int y, float u, float v, float
if(spart->rectdaps) {
/* find the z of the sample */
PixStr *ps;
long *rd= spart->rectdaps + offset;
intptr_t *rd= spart->rectdaps + offset;
bufferz= 0x7FFFFFFF;
if(spart->rectmask) maskz= 0x7FFFFFFF;

@ -2278,7 +2278,7 @@ static int hashlist_projectvert(float *v1, float winmat[][4], float *hoco)
return 0;
}
buck= &bucket[ (((long)v1)/16) & 255 ];
buck= &bucket[ (((intptr_t)v1)/16) & 255 ];
if(buck->vert==v1) {
QUATCOPY(hoco, buck->hoco);
return buck->clip;
@ -3263,7 +3263,7 @@ static void copyto_abufz(RenderPart *pa, int *arectz, int *rectmask, int sample)
{
PixStr *ps;
int x, y, *rza, *rma;
long *rd;
intptr_t *rd;
if(R.osa==0) {
memcpy(arectz, pa->rectz, sizeof(int)*pa->rectx*pa->recty);
@ -3484,7 +3484,7 @@ static int zbuffer_abuf(RenderPart *pa, APixstr *APixbuf, ListBase *apsmbase, Re
/* speed pointer NULL = sky, we clear */
/* else if either alpha is full or no solid was filled in: copy speed */
/* else fill in minimum speed */
void add_transp_speed(RenderLayer *rl, int offset, float *speed, float alpha, long *rdrect)
void add_transp_speed(RenderLayer *rl, int offset, float *speed, float alpha, intptr_t *rdrect)
{
RenderPass *rpass;
@ -3958,7 +3958,7 @@ unsigned short *zbuffer_transp_shade(RenderPart *pa, RenderLayer *rl, float *pas
ZTranspRow zrow[MAX_ZROW];
StrandShadeCache *sscache= NULL;
float sampalpha, alpha, *passrect= pass;
long *rdrect;
intptr_t *rdrect;
int x, y, crop=0, a, b, totface, totsample, doztra;
int addpassflag, offs= 0, od, addzbuf, osa = (R.osa? R.osa: 1);
unsigned short *ztramask= NULL, filled;

@ -4277,7 +4277,7 @@ static void validate_posebonebutton_cb(void *bonev, void *namev)
static void armature_layer_cb(void *lay_v, void *value_v)
{
short *layer= lay_v;
int value= (long)value_v;
int value= (intptr_t)value_v;
if(*layer==0 || G.qual==0) *layer= value;
allqueue(REDRAWBUTSEDIT, 0);

@ -683,6 +683,8 @@ static char *sensor_name(int type)
return "Property";
case SENS_ACTUATOR:
return "Actuator";
case SENS_DELAY:
return "Delay";
case SENS_MOUSE:
return "Mouse";
case SENS_COLLISION:
@ -704,7 +706,7 @@ static char *sensor_name(int type)
static char *sensor_pup(void)
{
/* the number needs to match defines in game.h */
return "Sensors %t|Always %x0|Keyboard %x3|Mouse %x5|"
return "Sensors %t|Always %x0|Delay %x13|Keyboard %x3|Mouse %x5|"
"Touch %x1|Collision %x6|Near %x2|Radar %x7|"
"Property %x4|Random %x8|Ray %x9|Message %x10|Joystick %x11|Actuator %x12";
}
@ -1000,6 +1002,7 @@ static int get_col_sensor(int type)
{
switch(type) {
case SENS_ALWAYS: return TH_BUT_ACTION;
case SENS_DELAY: return TH_BUT_ACTION;
case SENS_TOUCH: return TH_BUT_NEUTRAL;
case SENS_COLLISION: return TH_BUT_SETTING;
case SENS_NEAR: return TH_BUT_SETTING1;
@ -1070,8 +1073,8 @@ static short draw_sensorbuttons(bSensor *sens, uiBlock *block, short xco, short
bRaySensor *raySens = NULL;
bMessageSensor *mes = NULL;
bJoystickSensor *joy = NULL;
bActuatorSensor *as = NULL;
bActuatorSensor *as = NULL;
bDelaySensor *ds = NULL;
short ysize;
char *str;
@ -1297,6 +1300,27 @@ static short draw_sensorbuttons(bSensor *sens, uiBlock *block, short xco, short
yco-= ysize;
break;
}
case SENS_DELAY:
{
ysize= 48;
glRects(xco, yco-ysize, xco+width, yco);
uiEmboss((float)xco, (float)yco-ysize,
(float)xco+width, (float)yco, 1);
draw_default_sensor_header(sens, block, xco, yco, width);
ds = sens->data;
uiDefButS(block, NUM, 0, "Delay",(short)(10+xco),(short)(yco-44),(short)((width-22)*0.4+10), 19,
&ds->delay, 0.0, 5000.0, 0, 0, "Delay in number of frames before the positive trigger");
uiDefButS(block, NUM, 0, "Dur",(short)(10+xco+(width-22)*0.4+10),(short)(yco-44),(short)((width-22)*0.4-10), 19,
&ds->duration, 0.0, 5000.0, 0, 0, "If >0, delay in number of frames before the negative trigger following the positive trigger");
uiDefButBitS(block, TOG, SENS_DELAY_REPEAT, 0, "REP",(short)(xco + 10 + (width-22)*0.8),(short)(yco - 44),
(short)(0.20 * (width-22)), 19, &ds->flag, 0.0, 0.0, 0, 0,
"Toggle repeat option. If selected, the sensor restarts after Delay+Dur frames");
yco-= ysize;
break;
}
case SENS_MOUSE:
{
ms= sens->data;
@ -1689,7 +1713,7 @@ static short draw_actuatorbuttons(Object *ob, bActuator *act, uiBlock *block, sh
uiDefBut(block, LABEL, 0, "Torque", xco, yco-106, 55, 19, NULL, 0, 0, 0, 0, "Sets the torque");
uiDefButF(block, NUM, 0, "", xco+45, yco-106, wval, 19, oa->forcerot, -10000.0, 10000.0, 10, 0, "");
uiDefButF(block, NUM, 0, "", xco+45+wval, yco-106, wval, 19, oa->forcerot+1, -10000.0, 10000.0, 10, 0, "");
uiDefButF(block, NUM, 0, "", xco+45+2*wval, yco-6106, wval, 19, oa->forcerot+2, -10000.0, 10000.0, 10, 0, "");
uiDefButF(block, NUM, 0, "", xco+45+2*wval, yco-106, wval, 19, oa->forcerot+2, -10000.0, 10000.0, 10, 0, "");
}
if ( ob->gameflag & OB_DYNAMIC )
@ -3183,7 +3207,8 @@ void logic_buts(void)
while(cont) {
for (iact=0; iact<cont->totlinks; iact++) {
act = cont->links[iact];
act->flag |= ACT_LINKED;
if (act)
act->flag |= ACT_LINKED;
}
controller_state_mask |= cont->state_mask;
cont = cont->next;
@ -3231,7 +3256,8 @@ void logic_buts(void)
/* this controller is visible, mark all its actuator */
for (iact=0; iact<cont->totlinks; iact++) {
act = cont->links[iact];
act->flag |= ACT_VISIBLE;
if (act)
act->flag |= ACT_VISIBLE;
}
uiBlockSetEmboss(block, UI_EMBOSSM);
uiDefIconButBitS(block, TOG, CONT_DEL, B_DEL_CONT, ICON_X, xco, yco, 22, 19, &cont->flag, 0, 0, 0, 0, "Delete Controller");
@ -3323,8 +3349,8 @@ void logic_buts(void)
ycoo= yco;
if(sens->flag & SENS_SHOW)
{
uiDefButS(block, MENU, B_CHANGE_SENS, sensor_pup(), (short)(xco+22), yco, 100, 19, &sens->type, 0, 0, 0, 0, "Sensor type");
but= uiDefBut(block, TEX, 1, "", (short)(xco+122), yco, (short)(width-144), 19, sens->name, 0, 31, 0, 0, "Sensor name");
uiDefButS(block, MENU, B_CHANGE_SENS, sensor_pup(), (short)(xco+22), yco, 80, 19, &sens->type, 0, 0, 0, 0, "Sensor type");
but= uiDefBut(block, TEX, 1, "", (short)(xco+102), yco, (short)(width-124), 19, sens->name, 0, 31, 0, 0, "Sensor name");
uiButSetFunc(but, make_unique_prop_names_cb, sens->name, (void*) 0);
sens->otype= sens->type;
@ -3334,9 +3360,9 @@ void logic_buts(void)
else {
set_col_sensor(sens->type, 1);
glRecti(xco+22, yco, xco+width-22,yco+19);
but= uiDefBut(block, LABEL, 0, sensor_name(sens->type), (short)(xco+22), yco, 100, 19, sens, 0, 0, 0, 0, "");
but= uiDefBut(block, LABEL, 0, sensor_name(sens->type), (short)(xco+22), yco, 80, 19, sens, 0, 0, 0, 0, "");
uiButSetFunc(but, sca_move_sensor, sens, NULL);
but= uiDefBut(block, LABEL, 0, sens->name, (short)(xco+122), yco, (short)(width-144), 19, sens, 0, 31, 0, 0, "");
but= uiDefBut(block, LABEL, 0, sens->name, (short)(xco+102), yco, (short)(width-124), 19, sens, 0, 31, 0, 0, "");
uiButSetFunc(but, sca_move_sensor, sens, NULL);
}
@ -3393,8 +3419,8 @@ void logic_buts(void)
if(act->flag & ACT_SHOW) {
act->otype= act->type;
uiDefButS(block, MENU, B_CHANGE_ACT, actuator_pup(ob), (short)(xco+22), yco, 100, 19, &act->type, 0, 0, 0, 0, "Actuator type");
but= uiDefBut(block, TEX, 1, "", (short)(xco+122), yco, (short)(width-144), 19, act->name, 0, 31, 0, 0, "Actuator name");
uiDefButS(block, MENU, B_CHANGE_ACT, actuator_pup(ob), (short)(xco+22), yco, 90, 19, &act->type, 0, 0, 0, 0, "Actuator type");
but= uiDefBut(block, TEX, 1, "", (short)(xco+112), yco, (short)(width-134), 19, act->name, 0, 31, 0, 0, "Actuator name");
uiButSetFunc(but, make_unique_prop_names_cb, act->name, (void*) 0);
ycoo= yco;
@ -3404,9 +3430,9 @@ void logic_buts(void)
else {
set_col_actuator(act->type, 1);
glRecti((short)(xco+22), yco, (short)(xco+width-22),(short)(yco+19));
but= uiDefBut(block, LABEL, 0, actuator_name(act->type), (short)(xco+22), yco, 100, 19, act, 0, 0, 0, 0, "Actuator type");
but= uiDefBut(block, LABEL, 0, actuator_name(act->type), (short)(xco+22), yco, 90, 19, act, 0, 0, 0, 0, "Actuator type");
uiButSetFunc(but, sca_move_actuator, act, NULL);
but= uiDefBut(block, LABEL, 0, act->name, (short)(xco+122), yco, (short)(width-144), 19, act, 0, 0, 0, 0, "Actuator name");
but= uiDefBut(block, LABEL, 0, act->name, (short)(xco+112), yco, (short)(width-134), 19, act, 0, 0, 0, 0, "Actuator name");
uiButSetFunc(but, sca_move_actuator, act, NULL);
ycoo= yco;
}

@ -3452,6 +3452,8 @@ static void object_panel_fields(Object *ob)
}
else if(pd->forcefield == PFIELD_HARMONIC)
uiDefButF(block, NUM, B_FIELD_CHANGE, "Damp: ", 10,120,140,20, &pd->f_damp, 0, 10, 10, 0, "Damping of the harmonic force");
else if(pd->forcefield == PFIELD_WIND)
uiDefButF(block, NUM, B_FIELD_CHANGE, "Noise: ",10,120,140,20, &pd->f_noise, 0, 10, 100, 0, "Noise of the wind force");
}
uiBlockEndAlign(block);

@ -33,6 +33,7 @@
#include <string.h>
#include "MEM_guardedalloc.h"
#include "BLO_sys_types.h" // for intptr_t support
#include "DNA_node_types.h"
#include "DNA_screen_types.h"
#include "DNA_space_types.h"
@ -3261,7 +3262,7 @@ static void layer_copy_func(void *lay_v, void *lay_p)
static void delete_scene_layer_func(void *srl_v, void *act_i)
{
if(BLI_countlist(&G.scene->r.layers)>1) {
long act= (long)act_i;
intptr_t act= (intptr_t)act_i;
BLI_remlink(&G.scene->r.layers, srl_v);
MEM_freeN(srl_v);
@ -3322,7 +3323,7 @@ static char *scene_layer_menu(void)
static void draw_3d_layer_buttons(uiBlock *block, int type, unsigned int *poin, short xco, short yco, short dx, short dy, char *tip)
{
uiBut *bt;
long a;
intptr_t a;
uiBlockBeginAlign(block);
for(a=0; a<5; a++) {
@ -3381,7 +3382,7 @@ static void render_panel_layers(void)
uiDefButBitI(block, TOG, R_SINGLE_LAYER, B_NOP, "Single", 230,145,60,20, &G.scene->r.scemode, 0, 0, 0, 0, "Only render this layer");
bt=uiDefIconBut(block, BUT, B_NOP, ICON_X, 285, 145, 25, 20, 0, 0, 0, 0, 0, "Deletes current Render Layer");
uiButSetFunc(bt, delete_scene_layer_func, srl, (void *)(long)G.scene->r.actlay);
uiButSetFunc(bt, delete_scene_layer_func, srl, (void *)(intptr_t)G.scene->r.actlay);
uiBlockEndAlign(block);
/* RenderLayer visible-layers */

@ -664,7 +664,7 @@ static int draw_tfaces3D__setHiddenOpts(void *userData, int index)
{
struct { Mesh *me; EdgeHash *eh; } *data = userData;
MEdge *med = &data->me->medge[index];
unsigned long flags = (long) BLI_edgehash_lookup(data->eh, med->v1, med->v2);
uintptr_t flags = (intptr_t) BLI_edgehash_lookup(data->eh, med->v1, med->v2);
if((G.f & G_DRAWSEAMS) && (med->flag&ME_SEAM)) {
return 0;
@ -682,7 +682,7 @@ static int draw_tfaces3D__setSeamOpts(void *userData, int index)
{
struct { Mesh *me; EdgeHash *eh; } *data = userData;
MEdge *med = &data->me->medge[index];
unsigned long flags = (long) BLI_edgehash_lookup(data->eh, med->v1, med->v2);
uintptr_t flags = (intptr_t) BLI_edgehash_lookup(data->eh, med->v1, med->v2);
if (med->flag&ME_SEAM) {
if (G.f&G_HIDDENEDGES) {
@ -698,7 +698,7 @@ static int draw_tfaces3D__setSelectOpts(void *userData, int index)
{
struct { Mesh *me; EdgeHash *eh; } *data = userData;
MEdge *med = &data->me->medge[index];
unsigned long flags = (long) BLI_edgehash_lookup(data->eh, med->v1, med->v2);
uintptr_t flags = (intptr_t) BLI_edgehash_lookup(data->eh, med->v1, med->v2);
return flags & eEdge_Select;
}
@ -706,7 +706,7 @@ static int draw_tfaces3D__setActiveOpts(void *userData, int index)
{
struct { Mesh *me; EdgeHash *eh; } *data = userData;
MEdge *med = &data->me->medge[index];
unsigned long flags = (long) BLI_edgehash_lookup(data->eh, med->v1, med->v2);
uintptr_t flags = (intptr_t) BLI_edgehash_lookup(data->eh, med->v1, med->v2);
if (flags & eEdge_Select) {
return 1;

@ -5315,7 +5315,7 @@ void draw_object_ext(Base *base)
static void bbs_mesh_verts__mapFunc(void *userData, int index, float *co, float *no_f, short *no_s)
{
int offset = (long) userData;
int offset = (intptr_t) userData;
EditVert *eve = EM_get_vert_for_index(index);
if (eve->h==0) {
@ -5327,7 +5327,7 @@ static int bbs_mesh_verts(DerivedMesh *dm, int offset)
{
glPointSize( BIF_GetThemeValuef(TH_VERTEX_SIZE) );
bglBegin(GL_POINTS);
dm->foreachMappedVert(dm, bbs_mesh_verts__mapFunc, (void*)(long) offset);
dm->foreachMappedVert(dm, bbs_mesh_verts__mapFunc, (void*)(intptr_t) offset);
bglEnd();
glPointSize(1.0);
@ -5336,7 +5336,7 @@ static int bbs_mesh_verts(DerivedMesh *dm, int offset)
static int bbs_mesh_wire__setDrawOptions(void *userData, int index)
{
int offset = (long) userData;
int offset = (intptr_t) userData;
EditEdge *eed = EM_get_edge_for_index(index);
if (eed->h==0) {
@ -5348,7 +5348,7 @@ static int bbs_mesh_wire__setDrawOptions(void *userData, int index)
}
static int bbs_mesh_wire(DerivedMesh *dm, int offset)
{
dm->drawMappedEdges(dm, bbs_mesh_wire__setDrawOptions, (void*)(long) offset);
dm->drawMappedEdges(dm, bbs_mesh_wire__setDrawOptions, (void*)(intptr_t) offset);
return offset + G.totedge;
}
@ -5382,7 +5382,7 @@ static int bbs_mesh_solid_EM(DerivedMesh *dm, int facecol)
cpack(0);
if (facecol) {
dm->drawMappedFaces(dm, bbs_mesh_solid__setSolidDrawOptions, (void*)(long) 1, 0);
dm->drawMappedFaces(dm, bbs_mesh_solid__setSolidDrawOptions, (void*)(intptr_t) 1, 0);
if( CHECK_OB_DRAWFACEDOT(G.scene, G.vd, G.obedit->dt) ) {
glPointSize(BIF_GetThemeValuef(TH_FACEDOT_SIZE));
@ -5415,7 +5415,7 @@ static int bbs_mesh_wire__setDrawOpts(void *userData, int index)
{
struct { Mesh *me; EdgeHash *eh; int offset; } *data = userData;
MEdge *med = data->me->medge + index;
unsigned long flags = (long)BLI_edgehash_lookup(data->eh, med->v1, med->v2);
uintptr_t flags = (intptr_t)BLI_edgehash_lookup(data->eh, med->v1, med->v2);
if (flags & 1) {
set_framebuffer_index_color(data->offset+index);

@ -103,7 +103,7 @@ char *ic_name_empty[1] ={ "" };
char *fluidsim_ic_names[FLUIDSIM_TOTNAM] = { "Fac-Visc", "Fac-Time", "GravX","GravY","GravZ", "VelX","VelY","VelZ", "Active" };
char *part_ic_names[PART_TOTNAM] = { "E_Freq", "E_Life", "E_Speed", "E_Angular", "E_Size",
"Angular", "Size", "Drag", "Brown", "Damp", "Length", "Clump",
"GravX", "GravY", "GravZ", "KinkAmp", "KinkFreq", "KinkShape", "BBTilt"};
"GravX", "GravY", "GravZ", "KinkAmp", "KinkFreq", "KinkShape", "BBTilt", "FStreng", "FFall", "FMaxD"};
/* gets the appropriate icon for the given blocktype */
int geticon_ipo_blocktype(short blocktype)

@ -84,6 +84,8 @@
#include "blendef.h"
#include "mydevice.h"
#include "BLO_sys_types.h" // for intptr_t support
extern ListBase editNurb; /* in editcurve.c */
/* temporary storage for slider values */
@ -162,7 +164,7 @@ static void rvk_slider_func(void *voidob, void *voidkeynum)
IpoCurve *icu=NULL;
BezTriple *bezt=NULL;
float cfra, rvkval;
int keynum = (long) voidkeynum;
int keynum = (intptr_t) voidkeynum;
cfra = frame_to_float(CFRA);
@ -275,7 +277,7 @@ void make_rvk_slider(uiBlock *block, Object *ob, int keynum,
x, y , w, h,
meshslidervals+keynum, min, max, 10, 2, tip);
uiButSetFunc(but, rvk_slider_func, ob, (void *)(long)keynum);
uiButSetFunc(but, rvk_slider_func, ob, (void *)(intptr_t)keynum);
// no hilite, the winmatrix is not correct later on...
uiButSetFlag(but, UI_NO_HILITE);

@ -109,6 +109,7 @@ editmesh_mods.c, UI level access, no geometry changes
#include "editmesh.h"
#include "BLO_sys_types.h" // for intptr_t support
/* ****************************** MIRROR **************** */
@ -2937,7 +2938,7 @@ void select_sharp_edges(void)
EditFace *efa;
EditFace **efa1;
EditFace **efa2;
long edgecount = 0, i;
intptr_t edgecount = 0, i;
static short sharpness = 135;
float fsharpness;
@ -3041,7 +3042,7 @@ void select_linked_flat_faces(void)
EditFace *efa;
EditFace **efa1;
EditFace **efa2;
long edgecount = 0, i, faceselcount=0, faceselcountold=0;
intptr_t edgecount = 0, i, faceselcount=0, faceselcountold=0;
static short sharpness = 135;
float fsharpness;

@ -110,6 +110,8 @@ editmesh_tool.c: UI called tools for editmesh, geometry changes here, otherwise
#include "PIL_time.h"
#include "BLO_sys_types.h" // for intptr_t support
/* local prototypes ---------------*/
void bevel_menu(void);
static void free_tagged_edges_faces(EditEdge *eed, EditFace *efa);
@ -132,7 +134,7 @@ static int vergxco(const void *v1, const void *v2)
}
struct facesort {
unsigned long x;
uintptr_t x;
struct EditFace *efa;
};
@ -433,8 +435,8 @@ int removedoublesflag(short flag, short automerge, float limit) /* return amoun
efa= em->faces.first;
while(efa) {
if(efa->f1 & 1) {
if(efa->v4) vsb->x= (unsigned long) MIN4( (unsigned long)efa->v1, (unsigned long)efa->v2, (unsigned long)efa->v3, (unsigned long)efa->v4);
else vsb->x= (unsigned long) MIN3( (unsigned long)efa->v1, (unsigned long)efa->v2, (unsigned long)efa->v3);
if(efa->v4) vsb->x= (uintptr_t) MIN4( (uintptr_t)efa->v1, (uintptr_t)efa->v2, (uintptr_t)efa->v3, (uintptr_t)efa->v4);
else vsb->x= (uintptr_t) MIN3( (uintptr_t)efa->v1, (uintptr_t)efa->v2, (uintptr_t)efa->v3);
vsb->efa= efa;
vsb++;

@ -39,6 +39,8 @@
#include <config.h>
#endif
#include "BLO_sys_types.h" // for intptr_t support
#include "DNA_group_types.h"
#include "DNA_ID.h"
#include "DNA_image_types.h"
@ -2106,7 +2108,7 @@ static void info_text(int x, int y)
{
Object *ob= OBACT;
extern float hashvectf[];
extern unsigned long mem_in_use, mmap_in_use;
extern uintptr_t mem_in_use, mmap_in_use;
unsigned int swatch_color;
float fac1, fac2, fac3;
char infostr[300], memstr[64];

@ -63,12 +63,14 @@
#include "blendef.h"
#include "mydevice.h"
#include "BLO_sys_types.h" // for intptr_t support
/* ********************** SCRIPT ****************************** */
/* action executed after clicking in Scripts menu */
static void do_scripts_submenus(void *int_arg, int event)
{
int menutype = (long)int_arg;
int menutype = (intptr_t)int_arg;
BPY_menu_do_python (menutype, event);
@ -80,7 +82,7 @@ static uiBlock *script_scripts_submenus(void *int_menutype)
uiBlock *block;
short yco = 20, menuwidth = 120;
BPyMenu *pym;
int i = 0, menutype = (long)int_menutype;
int i = 0, menutype = (intptr_t)int_menutype;
if ((menutype < 0) || (menutype > PYMENU_SCRIPTS_MENU_TOTAL))
return NULL;
@ -132,7 +134,7 @@ static uiBlock *script_scriptsmenu(void *arg_unused)
uiBlockSetButmFunc(block, do_script_scriptsmenu, NULL);
for (i = 0; i < PYMENU_SCRIPTS_MENU_TOTAL; i++) {
uiDefIconTextBlockBut(block, script_scripts_submenus, (void *)(long)i, ICON_RIGHTARROW_THIN, BPyMenu_group_itoa(i), 0, yco-=20, menuwidth, 19, "");
uiDefIconTextBlockBut(block, script_scripts_submenus, (void *)(intptr_t)i, ICON_RIGHTARROW_THIN, BPyMenu_group_itoa(i), 0, yco-=20, menuwidth, 19, "");
}
uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");

@ -5139,7 +5139,7 @@ static char *snapmode_pup(void)
static char string[512];
char *str = string;
str += sprintf(str, "%s", "Snap Mode: %t");
str += sprintf(str, "%s", "Snap Element: %t");
str += sprintf(str, "%s", "|Vertex%x0");
str += sprintf(str, "%s", "|Edge%x1");
str += sprintf(str, "%s", "|Face%x2");
@ -5777,7 +5777,7 @@ void view3d_buttons(void)
xco+= XIC;
uiDefIconTextButS(block, ICONTEXTROW,B_REDR, ICON_VERTEXSEL, snapmode_pup(), xco,0,XIC+10,YIC, &(G.scene->snap_mode), 0.0, 0.0, 0, 0, "Snapping mode");
xco+= XIC;
uiDefButS(block, MENU, B_NOP, "Mode%t|Closest%x0|Center%x1|Median%x2|Active%x3",xco,0,70,YIC, &G.scene->snap_target, 0, 0, 0, 0, "Snap Target Mode");
uiDefButS(block, MENU, B_NOP, "Snap Mode%t|Closest%x0|Center%x1|Median%x2|Active%x3",xco,0,70,YIC, &G.scene->snap_target, 0, 0, 0, 0, "Snap Target Mode");
xco+= 70;
} else {
uiDefIconButBitS(block, TOG, SCE_SNAP, B_REDR, ICON_SNAP_GEAR,xco,0,XIC,YIC, &G.scene->snap_flag, 0, 0, 0, 0, "Snap while Ctrl is held during transform (Shift Tab)");

@ -105,6 +105,8 @@
#include "blendef.h"
#include "winlay.h"
#include "BLO_sys_types.h" // for intptr_t support
#define INSIDE_BLOCK 1
#define INSIDE_PANEL_HEADER 2
#define INSIDE_PANEL_SCALE 3
@ -6039,7 +6041,7 @@ void autocomplete_end(AutoComplete *autocpl, char *autoname)
/* autocomplete callback for ID buttons */
static void autocomplete_id(char *str, void *arg_v)
{
int blocktype= (long)arg_v;
int blocktype= (intptr_t)arg_v;
ListBase *listb= wich_libbase(G.main, blocktype);
if(listb==NULL) return;
@ -6370,7 +6372,7 @@ uiBut *uiDefIDPoinBut(uiBlock *block, uiIDPoinFuncFP func, short blocktype, int
ui_check_but(but);
if(blocktype)
uiButSetCompleteFunc(but, autocomplete_id, (void *)(long)blocktype);
uiButSetCompleteFunc(but, autocomplete_id, (void *)(intptr_t)blocktype);
return but;
}

@ -63,6 +63,8 @@
#include "ONL_opennl.h"
#include "BLO_sys_types.h" // for intptr_t support
/************************** Laplacian System *****************************/
struct LaplacianSystem {
@ -126,14 +128,14 @@ static void laplacian_increase_edge_count(EdgeHash *edgehash, int v1, int v2)
void **p = BLI_edgehash_lookup_p(edgehash, v1, v2);
if(p)
*p = (void*)((long)*p + (long)1);
*p = (void*)((intptr_t)*p + (intptr_t)1);
else
BLI_edgehash_insert(edgehash, v1, v2, (void*)(long)1);
BLI_edgehash_insert(edgehash, v1, v2, (void*)(intptr_t)1);
}
static int laplacian_edge_count(EdgeHash *edgehash, int v1, int v2)
{
return (int)(long)BLI_edgehash_lookup(edgehash, v1, v2);
return (int)(intptr_t)BLI_edgehash_lookup(edgehash, v1, v2);
}
static float cotan_weight(float *v1, float *v2, float *v3)

@ -107,6 +107,8 @@ void sort_faces(void);
#include "IMB_imbuf_types.h"
#include "IMB_imbuf.h"
#include "BLO_sys_types.h" // for intptr_t support
/* from rendercode.c */
#define VECMUL(dest, f) dest[0]*= f; dest[1]*= f; dest[2]*= f
@ -592,7 +594,7 @@ void sort_faces(void)
typedef struct MocNode {
struct MocNode *next;
long index[MOC_NODE_RES];
intptr_t index[MOC_NODE_RES];
} MocNode;
static int mesh_octree_get_base_offs(float *co, float *offs, float *div)
@ -610,7 +612,7 @@ static int mesh_octree_get_base_offs(float *co, float *offs, float *div)
return (vx*MOC_RES*MOC_RES) + vy*MOC_RES + vz;
}
static void mesh_octree_add_node(MocNode **bt, long index)
static void mesh_octree_add_node(MocNode **bt, intptr_t index)
{
if(*bt==NULL) {
*bt= MEM_callocN(sizeof(MocNode), "MocNode");
@ -642,7 +644,7 @@ static void mesh_octree_free_node(MocNode **bt)
/* temporal define, just to make nicer code below */
#define MOC_ADDNODE(vx, vy, vz) mesh_octree_add_node(basetable + ((vx)*MOC_RES*MOC_RES) + (vy)*MOC_RES + (vz), index)
static void mesh_octree_add_nodes(MocNode **basetable, float *co, float *offs, float *div, long index)
static void mesh_octree_add_nodes(MocNode **basetable, float *co, float *offs, float *div, intptr_t index)
{
float fx, fy, fz;
int vx, vy, vz;
@ -690,7 +692,7 @@ static void mesh_octree_add_nodes(MocNode **basetable, float *co, float *offs, f
}
static long mesh_octree_find_index(MocNode **bt, float (*orco)[3], MVert *mvert, float *co)
static intptr_t mesh_octree_find_index(MocNode **bt, float (*orco)[3], MVert *mvert, float *co)
{
float *vec;
int a;
@ -734,7 +736,7 @@ static struct {
/* mode is 's' start, or 'e' end, or 'u' use */
/* if end, ob can be NULL */
long mesh_octree_table(Object *ob, float *co, char mode)
intptr_t mesh_octree_table(Object *ob, float *co, char mode)
{
MocNode **bt;
@ -805,7 +807,7 @@ long mesh_octree_table(Object *ob, float *co, char mode)
EditVert *eve;
for(eve= G.editMesh->verts.first; eve; eve= eve->next) {
mesh_octree_add_nodes(MeshOctree.table, eve->co, MeshOctree.offs, MeshOctree.div, (long)(eve));
mesh_octree_add_nodes(MeshOctree.table, eve->co, MeshOctree.offs, MeshOctree.div, (intptr_t)(eve));
}
}
else {
@ -863,7 +865,7 @@ int mesh_get_x_mirror_vert(Object *ob, int index)
EditVert *editmesh_get_x_mirror_vert(Object *ob, float *co)
{
float vec[3];
long poinval;
intptr_t poinval;
/* ignore nan verts */
if (isnan(co[0]) || !finite(co[0]) ||

@ -22,6 +22,8 @@
#include <stdio.h>
#include <string.h>
#include "BLO_sys_types.h" // for intptr_t support
#if defined(_WIN32)
#define M_PI 3.14159265358979323846
#endif
@ -38,7 +40,7 @@ static int PHashSizes[] = {
4194319, 8388617, 16777259, 33554467, 67108879, 134217757, 268435459
};
#define PHASH_hash(ph, item) (((unsigned long) (item))%((unsigned int) (ph)->cursize))
#define PHASH_hash(ph, item) (((uintptr_t) (item))%((unsigned int) (ph)->cursize))
#define PHASH_edge(v1, v2) ((v1)^(v2))
static PHash *phash_new(PHashLink **list, int sizehint)

@ -5,9 +5,11 @@
#ifdef __cplusplus
extern "C" {
#endif
#include "BLO_sys_types.h" // for intptr_t support
typedef void ParamHandle; /* handle to a set of charts */
typedef long ParamKey; /* (hash) key for identifying verts and faces */
typedef intptr_t ParamKey; /* (hash) key for identifying verts and faces */
typedef enum ParamBool {
PARAM_TRUE = 1,
PARAM_FALSE = 0

@ -30,7 +30,7 @@ typedef enum PBool {
/* Special Purpose Hash */
typedef long PHashKey;
typedef intptr_t PHashKey;
typedef struct PHashLink {
struct PHashLink *next;

@ -50,6 +50,8 @@
#endif
#include "BLO_sys_types.h" // for intptr_t support
#include <limits.h>
#include "BLI_blenlib.h"
@ -901,7 +903,7 @@ static void renderwin_progress_display_cb(RenderResult *rr, volatile rcti *rect)
void make_renderinfo_string(RenderStats *rs, char *str)
{
extern char info_time_str[32]; // header_info.c
extern unsigned long mem_in_use, mmap_in_use;
extern uintptr_t mem_in_use, mmap_in_use;
float megs_used_memory, mmap_used_memory;
char *spos= str;

@ -182,6 +182,8 @@
#include "SYS_System.h" /* for the user def menu ... should move elsewhere. */
#include "BLO_sys_types.h" // for intptr_t support
/* maybe we need this defined somewhere else */
extern void StartKetsjiShell(ScrArea *area, char* startscenename, struct Main* maggie, struct SpaceIpo* sipo,int always_use_expand_framing);
extern void StartKetsjiShellSimulation(ScrArea *area, char* startscenename, struct Main* maggie, struct SpaceIpo* sipo,int always_use_expand_framing);/*rcruiz*/
@ -460,7 +462,7 @@ static LinkNode *save_and_reset_all_scene_cfra(void)
Scene *sc;
for (sc= G.main->scene.first; sc; sc= sc->id.next) {
BLI_linklist_prepend(&storelist, (void*) (long) sc->r.cfra);
BLI_linklist_prepend(&storelist, (void*) (intptr_t) sc->r.cfra);
/* why is this reset to 1 ?*/
/* sc->r.cfra= 1;*/
@ -478,7 +480,7 @@ static void restore_all_scene_cfra(LinkNode *storelist) {
Scene *sc;
for (sc= G.main->scene.first; sc; sc= sc->id.next) {
int stored_cfra= (long) sc_store->link;
int stored_cfra= (intptr_t) sc_store->link;
sc->r.cfra= stored_cfra;
set_scene_bg(sc);

File diff suppressed because it is too large Load Diff

@ -123,6 +123,8 @@
#include "BPY_extern.h"
#include "BPY_menus.h"
#include "BLO_sys_types.h" // for intptr_t support
void asciitoraw(int ch, unsigned short *event, unsigned short *qual)
{
if( isupper(ch) ) {
@ -238,7 +240,7 @@ void error_libdata(void)
int saveover(char *file)
{
int len= strlen(file);
size_t len= strlen(file);
if(len==0)
return 0;
@ -1756,8 +1758,8 @@ static uiBlock *tb_makemenu(void *arg)
static int tb_mainx= 1234, tb_mainy= 0;
static void store_main(void *arg1, void *arg2)
{
tb_mainx= (long)arg1;
tb_mainy= (long)arg2;
tb_mainx= (intptr_t)arg1;
tb_mainy= (intptr_t)arg2;
}
static void do_group_addmenu(void *arg, int event)
@ -2185,27 +2187,27 @@ void toolbox_n(void)
but=uiDefBlockBut(block, tb_makemenu, menu1, str1, mval[0]-(1.5*dx)+tb_mainx,mval[1]+tb_mainy, dx, 19, "");
uiButSetFlag(but, UI_MAKE_TOP|UI_MAKE_RIGHT);
uiButSetFunc(but, store_main, (void *)(long)dx, (void *)(long)-5);
uiButSetFunc(but, store_main, (void *)(intptr_t)dx, (void *)(intptr_t)-5);
but=uiDefBlockBut(block, tb_makemenu, menu2, str2, mval[0]-(0.5*dx)+tb_mainx,mval[1]+tb_mainy, dx, 19, "");
uiButSetFlag(but, UI_MAKE_TOP);
uiButSetFunc(but, store_main, (void *)(long)0, (void *)(long)-5);
uiButSetFunc(but, store_main, (void *)(intptr_t)0, (void *)(intptr_t)-5);
but=uiDefBlockBut(block, tb_makemenu, menu3, str3, mval[0]+(0.5*dx)+tb_mainx,mval[1]+tb_mainy, dx, 19, "");
uiButSetFlag(but, UI_MAKE_TOP|UI_MAKE_LEFT);
uiButSetFunc(but, store_main, (void *)(long)-dx, (void *)(long)-5);
uiButSetFunc(but, store_main, (void *)(intptr_t)-dx, (void *)(intptr_t)-5);
but=uiDefBlockBut(block, tb_makemenu, menu4, str4, mval[0]-(1.5*dx)+tb_mainx,mval[1]+tb_mainy-20, dx, 19, "");
uiButSetFlag(but, UI_MAKE_DOWN|UI_MAKE_RIGHT);
uiButSetFunc(but, store_main, (void *)(long)dx, (void *)(long)5);
uiButSetFunc(but, store_main, (void *)(intptr_t)dx, (void *)(intptr_t)5);
but=uiDefBlockBut(block, tb_makemenu, menu5, str5, mval[0]-(0.5*dx)+tb_mainx,mval[1]+tb_mainy-20, dx, 19, "");
uiButSetFlag(but, UI_MAKE_DOWN);
uiButSetFunc(but, store_main, (void *)(long)0, (void *)(long)5);
uiButSetFunc(but, store_main, (void *)(intptr_t)0, (void *)(intptr_t)5);
but=uiDefBlockBut(block, tb_makemenu, menu6, str6, mval[0]+(0.5*dx)+tb_mainx,mval[1]+tb_mainy-20, dx, 19, "");
uiButSetFlag(but, UI_MAKE_DOWN|UI_MAKE_LEFT);
uiButSetFunc(but, store_main, (void *)(long)-dx, (void *)(long)5);
uiButSetFunc(but, store_main, (void *)(intptr_t)-dx, (void *)(intptr_t)5);
} else if (tot==5 || tot==7) {
/* check if it fits, dubious */
if(mval[0]-0.25*dx+tb_mainx < 6) mval[0]= 6 + 0.25*dx -tb_mainx;
@ -2282,7 +2284,7 @@ void toolbox_generic( TBitem *generic_menu )
TBitem *menu;
int dx=96;
short event, mval[2];
long ypos = -5;
intptr_t ypos = -5;
tb_mainx= -32;
tb_mainy= -5;

@ -144,6 +144,8 @@ extern ListBase editelems;
#include "transform.h"
#include "BLO_sys_types.h" // for intptr_t support
/* local function prototype - for Object/Bone Constraints */
static short constraints_list_needinv(TransInfo *t, ListBase *list);
/* local function prototype - for finding number of keyframes that are selected for editing */
@ -1913,7 +1915,7 @@ static void set_crazyspace_quats(float *origcos, float *mappedcos, float *quats)
EditVert *eve, *prev;
EditFace *efa;
float *v1, *v2, *v3, *v4, *co1, *co2, *co3, *co4;
long index= 0;
intptr_t index= 0;
/* two abused locations in vertices */
for(eve= em->verts.first; eve; eve= eve->next, index++) {
@ -1925,13 +1927,13 @@ static void set_crazyspace_quats(float *origcos, float *mappedcos, float *quats)
for(efa= em->faces.first; efa; efa= efa->next) {
/* retrieve mapped coordinates */
v1= mappedcos + 3*(long)(efa->v1->prev);
v2= mappedcos + 3*(long)(efa->v2->prev);
v3= mappedcos + 3*(long)(efa->v3->prev);
v1= mappedcos + 3*(intptr_t)(efa->v1->prev);
v2= mappedcos + 3*(intptr_t)(efa->v2->prev);
v3= mappedcos + 3*(intptr_t)(efa->v3->prev);
co1= (origcos)? origcos + 3*(long)(efa->v1->prev): efa->v1->co;
co2= (origcos)? origcos + 3*(long)(efa->v2->prev): efa->v2->co;
co3= (origcos)? origcos + 3*(long)(efa->v3->prev): efa->v3->co;
co1= (origcos)? origcos + 3*(intptr_t)(efa->v1->prev): efa->v1->co;
co2= (origcos)? origcos + 3*(intptr_t)(efa->v2->prev): efa->v2->co;
co3= (origcos)? origcos + 3*(intptr_t)(efa->v3->prev): efa->v3->co;
if(efa->v2->tmp.p==NULL && efa->v2->f1) {
set_crazy_vertex_quat(quats, co2, co3, co1, v2, v3, v1);
@ -1940,8 +1942,8 @@ static void set_crazyspace_quats(float *origcos, float *mappedcos, float *quats)
}
if(efa->v4) {
v4= mappedcos + 3*(long)(efa->v4->prev);
co4= (origcos)? origcos + 3*(long)(efa->v4->prev): efa->v4->co;
v4= mappedcos + 3*(intptr_t)(efa->v4->prev);
co4= (origcos)? origcos + 3*(intptr_t)(efa->v4->prev): efa->v4->co;
if(efa->v1->tmp.p==NULL && efa->v1->f1) {
set_crazy_vertex_quat(quats, co1, co2, co4, v1, v2, v4);

@ -32,6 +32,8 @@
#include "MEM_guardedalloc.h"
#include "BLO_sys_types.h" // for intptr_t support
#include "DNA_action_types.h"
#include "DNA_armature_types.h"
#include "DNA_constraint_types.h"

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