diff options
Diffstat (limited to 'source')
235 files changed, 2525 insertions, 1143 deletions
diff --git a/source/Makefile b/source/Makefile index 9768dbc0010..637fbf36871 100644 --- a/source/Makefile +++ b/source/Makefile @@ -129,9 +129,10 @@ endif ifeq ($(WITH_SNDFILE),true) COMLIB += $(NAN_AUDASPACE)/lib/$(DEBUG_DIR)libaud_sndfile.a endif -ifeq ($(WITH_FFTW3),true) - COMLIB += $(NAN_AUDASPACE)/lib/$(DEBUG_DIR)libaud_fftw.a -endif +# Not in use currently, see also intern/audaspace/Makefile and r31375 +#ifeq ($(WITH_FFTW3),true) +# COMLIB += $(NAN_AUDASPACE)/lib/$(DEBUG_DIR)libaud_fftw.a +#endif COMLIB += $(NAN_SAMPLERATE)/lib/$(DEBUG_DIR)libsamplerate.a COMLIB += $(NAN_LZO)/lib/$(DEBUG_DIR)libminilzo.a COMLIB += $(NAN_LZMA)/lib/$(DEBUG_DIR)liblzma.a diff --git a/source/blender/avi/CMakeLists.txt b/source/blender/avi/CMakeLists.txt index b1ddb8c7895..62bf51dada3 100644 --- a/source/blender/avi/CMakeLists.txt +++ b/source/blender/avi/CMakeLists.txt @@ -24,12 +24,20 @@ # # ***** END GPL LICENSE BLOCK ***** -FILE(GLOB SRC intern/*.c) - SET(INC . ../../../intern/guardedalloc ${JPEG_INC} ) +SET(SRC + intern/avi.c + intern/avirgb.c + intern/codecs.c + intern/endian.c + intern/mjpeg.c + intern/options.c + intern/rgb32.c +) + BLENDERLIB(bf_avi "${SRC}" "${INC}") diff --git a/source/blender/avi/intern/avi.c b/source/blender/avi/intern/avi.c index 5f0d36e17e2..53be1b4467a 100644 --- a/source/blender/avi/intern/avi.c +++ b/source/blender/avi/intern/avi.c @@ -48,7 +48,7 @@ static int AVI_DEBUG=0; static char DEBUG_FCC[4]; -#define DEBUG(x) if(AVI_DEBUG) printf("AVI DEBUG: " x); +#define DEBUG_PRINT(x) if(AVI_DEBUG) printf("AVI DEBUG: " x); /* local functions */ char *fcc_to_char (unsigned int fcc); @@ -218,7 +218,7 @@ int AVI_is_avi (char *name) { AviBitmapInfoHeader bheader; int movie_tracks = 0; - DEBUG("opening movie\n"); + DEBUG_PRINT("opening movie\n"); memset(&movie, 0, sizeof(AviMovie)); @@ -243,7 +243,7 @@ int AVI_is_avi (char *name) { GET_FCC (movie.fp) != FCC("hdrl") || (movie.header->fcc = GET_FCC (movie.fp)) != FCC("avih") || !(movie.header->size = GET_FCC (movie.fp))) { - DEBUG("bad initial header info\n"); + DEBUG_PRINT("bad initial header info\n"); fclose(movie.fp); return 0; } @@ -266,7 +266,7 @@ int AVI_is_avi (char *name) { fseek (movie.fp, movie.header->size-14*4, SEEK_CUR); if (movie.header->Streams < 1) { - DEBUG("streams less than 1\n"); + DEBUG_PRINT("streams less than 1\n"); fclose(movie.fp); return 0; } @@ -280,7 +280,7 @@ int AVI_is_avi (char *name) { GET_FCC (movie.fp) != FCC ("strl") || (movie.streams[temp].sh.fcc = GET_FCC (movie.fp)) != FCC ("strh") || !(movie.streams[temp].sh.size = GET_FCC (movie.fp))) { - DEBUG("bad stream header information\n"); + DEBUG_PRINT("bad stream header information\n"); MEM_freeN(movie.streams); fclose(movie.fp); @@ -328,7 +328,7 @@ int AVI_is_avi (char *name) { fseek (movie.fp, movie.streams[temp].sh.size-14*4, SEEK_CUR); if (GET_FCC (movie.fp) != FCC("strf")) { - DEBUG("no stream format information\n"); + DEBUG_PRINT("no stream format information\n"); MEM_freeN(movie.streams); fclose(movie.fp); return 0; @@ -384,7 +384,7 @@ int AVI_is_avi (char *name) { while (GET_FCC (movie.fp) != FCC("LIST")) { temp= GET_FCC (movie.fp); if (temp<0 || ftell(movie.fp) > movie.size) { - DEBUG("incorrect size in header or error in AVI\n"); + DEBUG_PRINT("incorrect size in header or error in AVI\n"); MEM_freeN(movie.streams); fclose(movie.fp); @@ -407,7 +407,7 @@ int AVI_is_avi (char *name) { AviError AVI_open_movie (char *name, AviMovie *movie) { int temp, fcca, size, j; - DEBUG("opening movie\n"); + DEBUG_PRINT("opening movie\n"); memset(movie, 0, sizeof(AviMovie)); @@ -430,7 +430,7 @@ AviError AVI_open_movie (char *name, AviMovie *movie) { GET_FCC (movie->fp) != FCC("hdrl") || (movie->header->fcc = GET_FCC (movie->fp)) != FCC("avih") || !(movie->header->size = GET_FCC (movie->fp))) { - DEBUG("bad initial header info\n"); + DEBUG_PRINT("bad initial header info\n"); return AVI_ERROR_FORMAT; } @@ -452,7 +452,7 @@ AviError AVI_open_movie (char *name, AviMovie *movie) { fseek (movie->fp, movie->header->size-14*4, SEEK_CUR); if (movie->header->Streams < 1) { - DEBUG("streams less than 1\n"); + DEBUG_PRINT("streams less than 1\n"); return AVI_ERROR_FORMAT; } @@ -465,7 +465,7 @@ AviError AVI_open_movie (char *name, AviMovie *movie) { GET_FCC (movie->fp) != FCC ("strl") || (movie->streams[temp].sh.fcc = GET_FCC (movie->fp)) != FCC ("strh") || !(movie->streams[temp].sh.size = GET_FCC (movie->fp))) { - DEBUG("bad stream header information\n"); + DEBUG_PRINT("bad stream header information\n"); return AVI_ERROR_FORMAT; } @@ -507,7 +507,7 @@ AviError AVI_open_movie (char *name, AviMovie *movie) { fseek (movie->fp, movie->streams[temp].sh.size-14*4, SEEK_CUR); if (GET_FCC (movie->fp) != FCC("strf")) { - DEBUG("no stream format information\n"); + DEBUG_PRINT("no stream format information\n"); return AVI_ERROR_FORMAT; } @@ -560,7 +560,7 @@ AviError AVI_open_movie (char *name, AviMovie *movie) { while (GET_FCC (movie->fp) != FCC("LIST")) { temp= GET_FCC (movie->fp); if (temp<0 || ftell(movie->fp) > movie->size) { - DEBUG("incorrect size in header or error in AVI\n"); + DEBUG_PRINT("incorrect size in header or error in AVI\n"); return AVI_ERROR_FORMAT; } fseek(movie->fp, temp, SEEK_CUR); @@ -585,7 +585,7 @@ AviError AVI_open_movie (char *name, AviMovie *movie) { fseek (movie->fp, size, SEEK_CUR); } if (ftell(movie->fp) > movie->size) { - DEBUG("incorrect size in header or error in AVI\n"); + DEBUG_PRINT("incorrect size in header or error in AVI\n"); return AVI_ERROR_FORMAT; } } @@ -599,13 +599,13 @@ AviError AVI_open_movie (char *name, AviMovie *movie) { fseek(movie->fp, size-4, SEEK_CUR); if (GET_FCC(movie->fp) != FCC("idx1")) { - DEBUG("bad index informatio\n"); + DEBUG_PRINT("bad index informatio\n"); return AVI_ERROR_FORMAT; } movie->index_entries = GET_FCC (movie->fp)/sizeof(AviIndexEntry); if (movie->index_entries == 0) { - DEBUG("no index entries\n"); + DEBUG_PRINT("no index entries\n"); return AVI_ERROR_FORMAT; } @@ -631,7 +631,7 @@ AviError AVI_open_movie (char *name, AviMovie *movie) { movie->read_offset= 4; } - DEBUG("movie succesfully opened\n"); + DEBUG_PRINT("movie succesfully opened\n"); return AVI_ERROR_NONE; } diff --git a/source/blender/blenfont/CMakeLists.txt b/source/blender/blenfont/CMakeLists.txt index abaf769bd3c..f6afa31a28d 100644 --- a/source/blender/blenfont/CMakeLists.txt +++ b/source/blender/blenfont/CMakeLists.txt @@ -22,8 +22,6 @@ # # ***** END GPL LICENSE BLOCK ***** -FILE(GLOB SRC intern/*.c) - SET(INC . ../blenlib @@ -35,6 +33,15 @@ SET(INC ${FREETYPE_INCLUDE_DIRS} ) +SET(SRC + intern/blf.c + intern/blf_dir.c + intern/blf_font.c + intern/blf_glyph.c + intern/blf_lang.c + intern/blf_util.c +) + IF(WITH_INTERNATIONAL) LIST(APPEND INC ${GETTEXT_INC}) ADD_DEFINITIONS(-DINTERNATIONAL) diff --git a/source/blender/blenkernel/BKE_armature.h b/source/blender/blenkernel/BKE_armature.h index 242de4d788b..466b5d9a845 100644 --- a/source/blender/blenkernel/BKE_armature.h +++ b/source/blender/blenkernel/BKE_armature.h @@ -91,6 +91,7 @@ void where_is_armature_bone(struct Bone *bone, struct Bone *prevbone); void armature_rebuild_pose(struct Object *ob, struct bArmature *arm); void where_is_pose (struct Scene *scene, struct Object *ob); void where_is_pose_bone(struct Scene *scene, struct Object *ob, struct bPoseChannel *pchan, float ctime, int do_extra); +void where_is_pose_bone_tail(struct bPoseChannel *pchan); /* get_objectspace_bone_matrix has to be removed still */ void get_objectspace_bone_matrix (struct Bone* bone, float M_accumulatedMatrix[][4], int root, int posed); diff --git a/source/blender/blenkernel/BKE_cloth.h b/source/blender/blenkernel/BKE_cloth.h index e9f0304e645..19f6ab4b0a8 100644 --- a/source/blender/blenkernel/BKE_cloth.h +++ b/source/blender/blenkernel/BKE_cloth.h @@ -222,7 +222,7 @@ void clmdSetInterruptCallBack ( int ( *f ) ( void ) ); void cloth_free_modifier_extern ( struct ClothModifierData *clmd ); void cloth_free_modifier ( struct ClothModifierData *clmd ); void cloth_init ( struct ClothModifierData *clmd ); -struct DerivedMesh *clothModifier_do ( struct ClothModifierData *clmd, struct Scene *scene, struct Object *ob, struct DerivedMesh *dm, int useRenderParams, int isFinalCalc ); +struct DerivedMesh *clothModifier_do ( struct ClothModifierData *clmd, struct Scene *scene, struct Object *ob, struct DerivedMesh *dm); void cloth_update_normals ( ClothVertex *verts, int nVerts, struct MFace *face, int totface ); int cloth_uses_vgroup(struct ClothModifierData *clmd); diff --git a/source/blender/blenkernel/BKE_collision.h b/source/blender/blenkernel/BKE_collision.h index d7ae7df9342..03d4800076c 100644 --- a/source/blender/blenkernel/BKE_collision.h +++ b/source/blender/blenkernel/BKE_collision.h @@ -136,7 +136,7 @@ void interpolateOnTriangle ( float to[3], float v1[3], float v2[3], float v3[3], ///////////////////////////////////////////////// // used in effect.c ///////////////////////////////////////////////// -struct Object **get_collisionobjects(struct Scene *scene, struct Object *self, struct Group *group, int *numcollobj); +struct Object **get_collisionobjects(struct Scene *scene, struct Object *self, struct Group *group, unsigned int *numcollobj); typedef struct ColliderCache { struct ColliderCache *next, *prev; diff --git a/source/blender/blenkernel/BKE_idprop.h b/source/blender/blenkernel/BKE_idprop.h index 0e0d76f4284..eb33479cdb4 100644 --- a/source/blender/blenkernel/BKE_idprop.h +++ b/source/blender/blenkernel/BKE_idprop.h @@ -33,7 +33,7 @@ struct IDProperty; struct ID; -typedef union { +typedef union IDPropertyTemplate { int i; float f; double d; diff --git a/source/blender/blenkernel/BKE_smoke.h b/source/blender/blenkernel/BKE_smoke.h index 088d61061b2..396db60714a 100644 --- a/source/blender/blenkernel/BKE_smoke.h +++ b/source/blender/blenkernel/BKE_smoke.h @@ -34,7 +34,7 @@ typedef float (*bresenham_callback) (float *result, float *input, int res[3], int *pixel, float *tRay, float correct); -void smokeModifier_do(struct SmokeModifierData *smd, struct Scene *scene, struct Object *ob, struct DerivedMesh *dm, int useRenderParams, int isFinalCalc); +void smokeModifier_do(struct SmokeModifierData *smd, struct Scene *scene, struct Object *ob, struct DerivedMesh *dm); void smokeModifier_free (struct SmokeModifierData *smd); void smokeModifier_reset(struct SmokeModifierData *smd); diff --git a/source/blender/blenkernel/BKE_utildefines.h b/source/blender/blenkernel/BKE_utildefines.h index 33ab6c36b74..016aef4d865 100644 --- a/source/blender/blenkernel/BKE_utildefines.h +++ b/source/blender/blenkernel/BKE_utildefines.h @@ -44,12 +44,14 @@ #define STRINGIFY_ARG(x) #x #define STRINGIFY(x) STRINGIFY_ARG(x) +/* useful for debugging */ +#define AT __FILE__ ":" STRINGIFY(__LINE__) #ifdef __GNUC__ # define UNUSED(x) UNUSED_ ## x __attribute__((__unused__)) #else -# define UNUSED(x) x +# define UNUSED(x) UNUSED_ ## x #endif /* these values need to be hardcoded in structs, dna does not recognize defines */ @@ -260,8 +262,8 @@ behaviour, though it may not be the best in practice. #define V_GROW(vec) \ V_SIZE(vec) > _##vec##_count ? _##vec##_count++ : \ ((_##vec##_tmp = MEM_callocN(sizeof(*vec)*(_##vec##_count*2+2), #vec " " __FILE__ " ")),\ - (vec && memcpy(_##vec##_tmp, vec, sizeof(*vec) * _##vec##_count)),\ - (vec && (MEM_freeN(vec),1)),\ + (void)(vec && memcpy(_##vec##_tmp, vec, sizeof(*vec) * _##vec##_count)),\ + (void)(vec && (MEM_freeN(vec),1)),\ (vec = _##vec##_tmp),\ _##vec##_count++) diff --git a/source/blender/blenkernel/CMakeLists.txt b/source/blender/blenkernel/CMakeLists.txt index c8645f91de8..7e701f19a18 100644 --- a/source/blender/blenkernel/CMakeLists.txt +++ b/source/blender/blenkernel/CMakeLists.txt @@ -24,8 +24,6 @@ # # ***** END GPL LICENSE BLOCK ***** -FILE(GLOB SRC intern/*.c) - SET(INC . ../avi @@ -55,6 +53,94 @@ SET(INC ${ZLIB_INC} ) +SET(SRC + intern/BME_Customdata.c + intern/BME_conversions.c + intern/BME_eulers.c + intern/BME_mesh.c + intern/BME_structure.c + intern/BME_tools.c + intern/CCGSubSurf.c + intern/DerivedMesh.c + intern/action.c + intern/anim.c + intern/anim_sys.c + intern/armature.c + intern/blender.c + intern/bmfont.c + intern/boids.c + intern/booleanops_mesh.c + intern/brush.c + intern/bullet.c + intern/bvhutils.c + intern/cdderivedmesh.c + intern/cloth.c + intern/collision.c + intern/colortools.c + intern/constraint.c + intern/context.c + intern/curve.c + intern/customdata.c + intern/customdata_file.c + intern/deform.c + intern/depsgraph.c + intern/displist.c + intern/effect.c + intern/exotic.c + intern/fcurve.c + intern/fluidsim.c + intern/fmodifier.c + intern/font.c + intern/gpencil.c + intern/group.c + intern/icons.c + intern/idcode.c + intern/idprop.c + intern/image.c + intern/image_gen.c + intern/implicit.c + intern/ipo.c + intern/key.c + intern/lattice.c + intern/library.c + intern/linestyle.c + intern/material.c + intern/mball.c + intern/mesh.c + intern/modifier.c + intern/multires.c + intern/nla.c + intern/node.c + intern/object.c + intern/packedFile.c + intern/paint.c + intern/particle.c + intern/particle_system.c + intern/pointcache.c + intern/property.c + intern/report.c + intern/sca.c + intern/scene.c + intern/screen.c + intern/script.c + intern/seqcache.c + intern/seqeffects.c + intern/sequencer.c + intern/shrinkwrap.c + intern/sketch.c + intern/smoke.c + intern/softbody.c + intern/sound.c + intern/subsurf_ccg.c + intern/suggestions.c + intern/text.c + intern/texture.c + intern/unit.c + intern/world.c + intern/writeavi.c + intern/writeffmpeg.c + intern/writeframeserver.c +) ADD_DEFINITIONS(-DGLEW_STATIC) @@ -112,9 +198,9 @@ IF(WITH_OPENMP) ADD_DEFINITIONS(-DPARALLEL=1) ENDIF(WITH_OPENMP) -IF(NOT WITH_FLUID) +IF(NOT WITH_MOD_FLUID) ADD_DEFINITIONS(-DDISABLE_ELBEEM) -ENDIF(NOT WITH_FLUID) +ENDIF(NOT WITH_MOD_FLUID) IF(WITH_JACK) ADD_DEFINITIONS(-DWITH_JACK) @@ -131,6 +217,7 @@ IF(WITH_LZMA) ENDIF(WITH_LZMA) IF(WIN32) + SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /WX") LIST(APPEND INC ${PTHREADS_INC}) ENDIF(WIN32) diff --git a/source/blender/blenkernel/SConscript b/source/blender/blenkernel/SConscript index 52530c94f27..52d8da96994 100644 --- a/source/blender/blenkernel/SConscript +++ b/source/blender/blenkernel/SConscript @@ -89,4 +89,7 @@ if env['WITH_BF_LZMA']: if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc'): incs += ' ' + env['BF_PTHREADS_INC'] -env.BlenderLib ( libname = 'bf_blenkernel', sources = sources, includes = Split(incs), defines = defs, libtype=['core','player'], priority = [166,25] ) +if env['OURPLATFORM'] in ('win32-vc', 'win64-vc'): + env.BlenderLib ( libname = 'bf_blenkernel', sources = sources, includes = Split(incs), defines = defs, libtype=['core','player'], priority = [166,25], cc_compileflags = ['/WX'] ) +else: + env.BlenderLib ( libname = 'bf_blenkernel', sources = sources, includes = Split(incs), defines = defs, libtype=['core','player'], priority = [166,25] ) diff --git a/source/blender/blenkernel/depsgraph_private.h b/source/blender/blenkernel/depsgraph_private.h index 503ee973be0..0527fe406bc 100644 --- a/source/blender/blenkernel/depsgraph_private.h +++ b/source/blender/blenkernel/depsgraph_private.h @@ -64,8 +64,8 @@ typedef struct DagNode void * ob; void * first_ancestor; int ancestor_count; - int lay; // accumulated layers of its relations + itself - int scelay; // layers due to being in scene + unsigned int lay; // accumulated layers of its relations + itself + unsigned int scelay; // layers due to being in scene int lasttime; // if lasttime != DagForest->time, this node was not evaluated yet for flushing int BFS_dist; // BFS distance int DFS_dist; // DFS distance diff --git a/source/blender/blenkernel/intern/DerivedMesh.c b/source/blender/blenkernel/intern/DerivedMesh.c index 2e8922dec1b..3d87b77dec9 100644 --- a/source/blender/blenkernel/intern/DerivedMesh.c +++ b/source/blender/blenkernel/intern/DerivedMesh.c @@ -1693,9 +1693,6 @@ static void mesh_calc_modifiers(Scene *scene, Object *ob, float (*inputVertexCos if(useRenderParams) required_mode = eModifierMode_Render; else required_mode = eModifierMode_Realtime; - /* we always want to keep original indices */ - dataMask |= CD_MASK_ORIGINDEX; - datamasks = modifiers_calcDataMasks(scene, ob, md, dataMask, required_mode); curr = datamasks; @@ -1816,6 +1813,12 @@ static void mesh_calc_modifiers(Scene *scene, Object *ob, float (*inputVertexCos } else { DerivedMesh *ndm; + /* determine which data layers are needed by following modifiers */ + if(curr->next) + nextmask= (CustomDataMask)GET_INT_FROM_POINTER(curr->next->link); + else + nextmask= dataMask; + /* apply vertex coordinates or build a DerivedMesh as necessary */ if(dm) { if(deformedVerts) { @@ -1837,28 +1840,25 @@ static void mesh_calc_modifiers(Scene *scene, Object *ob, float (*inputVertexCos if((dataMask & CD_MASK_WEIGHT_MCOL) && (ob->mode & OB_MODE_WEIGHT_PAINT)) add_weight_mcol_dm(ob, dm); - /* constructive modifiers need to have an origindex - * otherwise they wont have anywhere to copy the data from */ - if(needMapping) { - int *index, i; + /* Constructive modifiers need to have an origindex + * otherwise they wont have anywhere to copy the data from. + * + * Also create ORIGINDEX data if any of the following modifiers + * requests it, this way Mirror, Solidify etc will keep ORIGINDEX + * data by using generic DM_copy_vert_data() functions. + */ + if(needMapping || (nextmask & CD_MASK_ORIGINDEX)) { + /* calc */ DM_add_vert_layer(dm, CD_ORIGINDEX, CD_CALLOC, NULL); DM_add_edge_layer(dm, CD_ORIGINDEX, CD_CALLOC, NULL); DM_add_face_layer(dm, CD_ORIGINDEX, CD_CALLOC, NULL); - index = DM_get_vert_data_layer(dm, CD_ORIGINDEX); - for(i=0; i<dm->numVertData; i++) *index++= i; - index = DM_get_edge_data_layer(dm, CD_ORIGINDEX); - for(i=0; i<dm->numEdgeData; i++) *index++= i; - index = DM_get_face_data_layer(dm, CD_ORIGINDEX); - for(i=0; i<dm->numFaceData; i++) *index++= i; + range_vni(DM_get_vert_data_layer(dm, CD_ORIGINDEX), dm->numVertData, 0); + range_vni(DM_get_edge_data_layer(dm, CD_ORIGINDEX), dm->numEdgeData, 0); + range_vni(DM_get_face_data_layer(dm, CD_ORIGINDEX), dm->numFaceData, 0); } } - /* determine which data layers are needed by following modifiers */ - if(curr->next) - nextmask= (CustomDataMask)GET_INT_FROM_POINTER(curr->next->link); - else - nextmask= dataMask; /* set the DerivedMesh to only copy needed data */ mask= (CustomDataMask)GET_INT_FROM_POINTER(curr->link); @@ -1895,7 +1895,7 @@ static void mesh_calc_modifiers(Scene *scene, Object *ob, float (*inputVertexCos orcodm= create_orco_dm(ob, me, NULL, CD_ORCO); nextmask &= ~CD_MASK_ORCO; - DM_set_only_copy(orcodm, nextmask); + DM_set_only_copy(orcodm, nextmask | CD_MASK_ORIGINDEX); ndm = mti->applyModifier(md, ob, orcodm, useRenderParams, 0); if(ndm) { @@ -1911,7 +1911,7 @@ static void mesh_calc_modifiers(Scene *scene, Object *ob, float (*inputVertexCos clothorcodm= create_orco_dm(ob, me, NULL, CD_CLOTH_ORCO); nextmask &= ~CD_MASK_CLOTH_ORCO; - DM_set_only_copy(clothorcodm, nextmask); + DM_set_only_copy(clothorcodm, nextmask | CD_MASK_ORIGINDEX); ndm = mti->applyModifier(md, ob, clothorcodm, useRenderParams, 0); if(ndm) { @@ -2029,9 +2029,6 @@ static void editmesh_calc_modifiers(Scene *scene, Object *ob, EditMesh *em, Deri dm = NULL; md = modifiers_getVirtualModifierList(ob); - - /* we always want to keep original indices */ - dataMask |= CD_MASK_ORIGINDEX; datamasks = modifiers_calcDataMasks(scene, ob, md, dataMask, required_mode); @@ -2110,7 +2107,7 @@ static void editmesh_calc_modifiers(Scene *scene, Object *ob, EditMesh *em, Deri orcodm= create_orco_dm(ob, ob->data, em, CD_ORCO); mask &= ~CD_MASK_ORCO; - DM_set_only_copy(orcodm, mask); + DM_set_only_copy(orcodm, mask | CD_MASK_ORIGINDEX); if (mti->applyModifierEM) ndm = mti->applyModifierEM(md, ob, em, orcodm); @@ -2125,9 +2122,11 @@ static void editmesh_calc_modifiers(Scene *scene, Object *ob, EditMesh *em, Deri } /* set the DerivedMesh to only copy needed data */ - DM_set_only_copy(dm, (CustomDataMask)GET_INT_FROM_POINTER(curr->link)); + mask= (CustomDataMask)GET_INT_FROM_POINTER(curr->link); /* CD_MASK_ORCO may have been cleared above */ - if(((CustomDataMask)GET_INT_FROM_POINTER(curr->link)) & CD_MASK_ORIGSPACE) + DM_set_only_copy(dm, mask | CD_MASK_ORIGINDEX); + + if(mask & CD_MASK_ORIGSPACE) if(!CustomData_has_layer(&dm->faceData, CD_ORIGSPACE)) DM_add_face_layer(dm, CD_ORIGSPACE, CD_DEFAULT, NULL); diff --git a/source/blender/blenkernel/intern/anim.c b/source/blender/blenkernel/intern/anim.c index 7b52d9c586a..a4e791aa6b3 100644 --- a/source/blender/blenkernel/intern/anim.c +++ b/source/blender/blenkernel/intern/anim.c @@ -843,7 +843,8 @@ static void vertex_duplilist(ListBase *lb, ID *id, Scene *scene, Object *par, fl GroupObject * go = NULL; EditMesh *em; float vec[3], no[3], pmat[4][4]; - int lay, totvert, a, oblay; + int totvert, a, oblay; + unsigned int lay; copy_m4_m4(pmat, par->obmat); @@ -1153,8 +1154,9 @@ static void new_particle_duplilist(ListBase *lb, ID *UNUSED(id), Scene *scene, O float ctime, pa_time, scale = 1.0f; float tmat[4][4], mat[4][4], pamat[4][4], vec[3], size=0.0; float (*obmat)[4], (*oldobmat)[4]; - int lay, a, b, counter, hair = 0; + int a, b, counter, hair = 0; int totpart, totchild, totgroup=0, pa_num; + unsigned int lay; if(psys==0) return; diff --git a/source/blender/blenkernel/intern/anim_sys.c b/source/blender/blenkernel/intern/anim_sys.c index 6ace4a64773..5e97137991e 100644 --- a/source/blender/blenkernel/intern/anim_sys.c +++ b/source/blender/blenkernel/intern/anim_sys.c @@ -1877,22 +1877,7 @@ void BKE_animsys_evaluate_all_animation (Main *main, float ctime) EVAL_ANIM_IDS(main->mball.first, ADT_RECALC_ANIM); /* curves */ - /* we need to perform a special hack here to ensure that the ctime - * value of the curve gets set in case there's no animation for that - * - it needs to be set before animation is evaluated just so that - * animation can successfully override... - * - it shouldn't get set when calculating drivers... - */ - for (id= main->curve.first; id; id= id->next) { - AnimData *adt= BKE_animdata_from_id(id); - Curve *cu= (Curve *)id; - - /* set ctime variable for curve */ - cu->ctime= ctime; - - /* now execute animation data on top of this as per normal */ - BKE_animsys_evaluate_animdata(id, adt, ctime, ADT_RECALC_ANIM); - } + EVAL_ANIM_IDS(main->curve.first, ADT_RECALC_ANIM); /* armatures */ EVAL_ANIM_IDS(main->armature.first, ADT_RECALC_ANIM); diff --git a/source/blender/blenkernel/intern/armature.c b/source/blender/blenkernel/intern/armature.c index f0c39e6373e..029b3c2e141 100644 --- a/source/blender/blenkernel/intern/armature.c +++ b/source/blender/blenkernel/intern/armature.c @@ -1105,22 +1105,50 @@ void armature_mat_pose_to_bone(bPoseChannel *pchan, float inmat[][4], float outm { float pc_trans[4][4], inv_trans[4][4]; float pc_posemat[4][4], inv_posemat[4][4]; - + float pose_mat[4][4]; + /* paranoia: prevent crashes with no pose-channel supplied */ if (pchan==NULL) return; - - /* get the inverse matrix of the pchan's transforms */ - if (pchan->rotmode) - loc_eul_size_to_mat4(pc_trans, pchan->loc, pchan->eul, pchan->size); - else - loc_quat_size_to_mat4(pc_trans, pchan->loc, pchan->quat, pchan->size); + + /* default flag */ + if((pchan->bone->flag & BONE_NO_LOCAL_LOCATION)==0) { + /* get the inverse matrix of the pchan's transforms */ + switch(pchan->rotmode) { + case ROT_MODE_QUAT: + loc_quat_size_to_mat4(pc_trans, pchan->loc, pchan->quat, pchan->size); + break; + case ROT_MODE_AXISANGLE: + loc_axisangle_size_to_mat4(pc_trans, pchan->loc, pchan->rotAxis, pchan->rotAngle, pchan->size); + break; + default: /* euler */ + loc_eul_size_to_mat4(pc_trans, pchan->loc, pchan->eul, pchan->size); + } + + copy_m4_m4(pose_mat, pchan->pose_mat); + } + else { + /* local location, this is not default, different calculation + * note: only tested for location with pose bone snapping. + * If this is not useful in other cases the BONE_NO_LOCAL_LOCATION + * case may have to be split into its own function. */ + unit_m4(pc_trans); + copy_v3_v3(pc_trans[3], pchan->loc); + + /* use parents rotation/scale space + own absolute position */ + if(pchan->parent) copy_m4_m4(pose_mat, pchan->parent->pose_mat); + else unit_m4(pose_mat); + + copy_v3_v3(pose_mat[3], pchan->pose_mat[3]); + } + + invert_m4_m4(inv_trans, pc_trans); /* Remove the pchan's transforms from it's pose_mat. * This should leave behind the effects of restpose + * parenting + constraints */ - mul_m4_m4m4(pc_posemat, inv_trans, pchan->pose_mat); + mul_m4_m4m4(pc_posemat, inv_trans, pose_mat); /* get the inverse of the leftovers so that we can remove * that component from the supplied matrix @@ -1990,7 +2018,9 @@ static void splineik_evaluate_bone(tSplineIK_Tree *tree, Scene *scene, Object *o /* finally, store the new transform */ copy_m4_m4(pchan->pose_mat, poseMat); VECCOPY(pchan->pose_head, poseHead); - VECCOPY(pchan->pose_tail, poseTail); + + /* recalculate tail, as it's now outdated after the head gets adjusted above! */ + where_is_pose_bone_tail(pchan); /* done! */ pchan->flag |= POSE_DONE; @@ -2203,6 +2233,15 @@ static void do_strip_modifiers(Scene *scene, Object *armob, Bone *bone, bPoseCha } } +/* calculate tail of posechannel */ +void where_is_pose_bone_tail(bPoseChannel *pchan) +{ + float vec[3]; + + VECCOPY(vec, pchan->pose_mat[1]); + mul_v3_fl(vec, pchan->bone->length); + add_v3_v3v3(pchan->pose_tail, pchan->pose_head, vec); +} /* The main armature solver, does all constraints excluding IK */ /* pchan is validated, as having bone and parent pointer @@ -2336,9 +2375,7 @@ void where_is_pose_bone(Scene *scene, Object *ob, bPoseChannel *pchan, float cti /* calculate head */ VECCOPY(pchan->pose_head, pchan->pose_mat[3]); /* calculate tail */ - VECCOPY(vec, pchan->pose_mat[1]); - mul_v3_fl(vec, bone->length); - add_v3_v3v3(pchan->pose_tail, pchan->pose_head, vec); + where_is_pose_bone_tail(pchan); } /* This only reads anim data from channels, and writes to channels */ diff --git a/source/blender/blenkernel/intern/cdderivedmesh.c b/source/blender/blenkernel/intern/cdderivedmesh.c index eb895d62f17..20987e15c4d 100644 --- a/source/blender/blenkernel/intern/cdderivedmesh.c +++ b/source/blender/blenkernel/intern/cdderivedmesh.c @@ -1686,6 +1686,8 @@ DerivedMesh *CDDM_copy(DerivedMesh *source) return dm; } +/* note, the CD_ORIGINDEX layers are all 0, so if there is a direct + * relationship betwen mesh data this needs to be set by the caller. */ DerivedMesh *CDDM_from_template(DerivedMesh *source, int numVerts, int numEdges, int numFaces) { diff --git a/source/blender/blenkernel/intern/cloth.c b/source/blender/blenkernel/intern/cloth.c index e7e94c407f1..f8772cd802f 100644 --- a/source/blender/blenkernel/intern/cloth.c +++ b/source/blender/blenkernel/intern/cloth.c @@ -385,7 +385,8 @@ static int do_step_cloth(Object *ob, ClothModifierData *clmd, DerivedMesh *resul Cloth *cloth; ListBase *effectors = NULL; MVert *mvert; - int i, ret = 0; + unsigned int i = 0; + int ret = 0; /* simulate 1 frame forward */ cloth = clmd->clothObject; @@ -423,7 +424,7 @@ static int do_step_cloth(Object *ob, ClothModifierData *clmd, DerivedMesh *resul /************************************************ * clothModifier_do - main simulation function ************************************************/ -DerivedMesh *clothModifier_do(ClothModifierData *clmd, Scene *scene, Object *ob, DerivedMesh *dm, int UNUSED(useRenderParams), int UNUSED(isFinalCalc)) +DerivedMesh *clothModifier_do(ClothModifierData *clmd, Scene *scene, Object *ob, DerivedMesh *dm) { DerivedMesh *result; PointCache *cache; @@ -1044,10 +1045,10 @@ static 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; - int i = 0; - int numverts = dm->getNumVerts ( dm ); - int numedges = dm->getNumEdges ( dm ); - int numfaces = dm->getNumFaces ( dm ); + unsigned int i = 0; + unsigned int numverts = (unsigned int)dm->getNumVerts ( dm ); + unsigned int numedges = (unsigned int)dm->getNumEdges ( dm ); + unsigned int numfaces = (unsigned int)dm->getNumFaces ( dm ); MEdge *medge = CDDM_get_edges ( dm ); MFace *mface = CDDM_get_faces ( dm ); int index2 = 0; // our second vertex index diff --git a/source/blender/blenkernel/intern/collision.c b/source/blender/blenkernel/intern/collision.c index 5c9cc441b95..d39e550192b 100644 --- a/source/blender/blenkernel/intern/collision.c +++ b/source/blender/blenkernel/intern/collision.c @@ -83,7 +83,7 @@ BVHTree *bvhtree_build_from_mvert ( MFace *mfaces, unsigned int numfaces, MVert { BVHTree *tree; float co[12]; - int i; + unsigned int i; MFace *tface = mfaces; tree = BLI_bvhtree_new ( numfaces*2, epsilon, 4, 26 ); @@ -1307,7 +1307,7 @@ static int cloth_collision_moving ( ClothModifierData *clmd, CollisionModifierDa } #endif -static void add_collision_object(Object ***objs, int *numobj, int *maxobj, Object *ob, Object *self, int level) +static void add_collision_object(Object ***objs, unsigned int *numobj, unsigned int *maxobj, Object *ob, Object *self, int level) { CollisionModifierData *cmd= NULL; @@ -1342,12 +1342,12 @@ static void add_collision_object(Object ***objs, int *numobj, int *maxobj, Objec // return all collision objects in scene // collision object will exclude self -Object **get_collisionobjects(Scene *scene, Object *self, Group *group, int *numcollobj) +Object **get_collisionobjects(Scene *scene, Object *self, Group *group, unsigned int *numcollobj) { Base *base; Object **objs; GroupObject *go; - int numobj= 0, maxobj= 100; + unsigned int numobj= 0, maxobj= 100; objs= MEM_callocN(sizeof(Object *)*maxobj, "CollisionObjectsArray"); @@ -1503,12 +1503,12 @@ int cloth_bvh_objcollision (Object *ob, ClothModifierData * clmd, float step, fl { Cloth *cloth= clmd->clothObject; BVHTree *cloth_bvh= cloth->bvhtree; - int i=0, numfaces = 0, numverts = 0, k, l, j; + unsigned int i=0, numfaces = 0, numverts = 0, k, l, j; int rounds = 0; // result counts applied collisions; ic is for debug output; ClothVertex *verts = NULL; int ret = 0, ret2 = 0; Object **collobjs = NULL; - int numcollobj = 0; + unsigned int numcollobj = 0; if ((clmd->sim_parms->flags & CLOTH_SIMSETTINGS_FLAG_COLLOBJ) || cloth_bvh==NULL) return 0; @@ -1545,7 +1545,7 @@ int cloth_bvh_objcollision (Object *ob, ClothModifierData * clmd, float step, fl Object *collob= collobjs[i]; CollisionModifierData *collmd = (CollisionModifierData*)modifiers_findByType(collob, eModifierType_Collision); BVHTreeOverlap *overlap = NULL; - int result = 0; + unsigned int result = 0; if(!collmd->bvhtree) continue; @@ -1605,11 +1605,11 @@ int cloth_bvh_objcollision (Object *ob, ClothModifierData * clmd, float step, fl //////////////////////////////////////////////////////////// if ( clmd->coll_parms->flags & CLOTH_COLLSETTINGS_FLAG_SELF ) { - for(l = 0; l < clmd->coll_parms->self_loop_count; l++) + for(l = 0; l < (unsigned int)clmd->coll_parms->self_loop_count; l++) { // TODO: add coll quality rounds again BVHTreeOverlap *overlap = NULL; - int result = 0; + unsigned int result = 0; // collisions = 1; verts = cloth->verts; // needed for openMP diff --git a/source/blender/blenkernel/intern/colortools.c b/source/blender/blenkernel/intern/colortools.c index 83ed65a1bf2..86d7cbf0133 100644 --- a/source/blender/blenkernel/intern/colortools.c +++ b/source/blender/blenkernel/intern/colortools.c @@ -869,7 +869,7 @@ void curvemapping_do_ibuf(CurveMapping *cumap, ImBuf *ibuf) if(ibuf->channels) stride= ibuf->channels; - for(pixel= ibuf->x*ibuf->y; pixel>0; pixel--, pix_in+=stride, pix_out+=4) { + for(pixel= ibuf->x*ibuf->y; pixel>0; pixel--, pix_in+=stride, pix_out+=stride) { if(stride<3) { col[0]= curvemap_evaluateF(cumap->cm, *pix_in); @@ -1004,7 +1004,8 @@ DO_INLINE void save_sample_line(Scopes *scopes, const int idx, const float fx, f void scopes_update(Scopes *scopes, ImBuf *ibuf, int use_color_management) { - int x, y, c, n, nl; + int x, y, c; + unsigned int n, nl; double div, divl; float *rf=NULL; unsigned char *rc=NULL; diff --git a/source/blender/blenkernel/intern/constraint.c b/source/blender/blenkernel/intern/constraint.c index 5dad01a126f..c3f05e497f1 100644 --- a/source/blender/blenkernel/intern/constraint.c +++ b/source/blender/blenkernel/intern/constraint.c @@ -2015,6 +2015,7 @@ static void pycon_get_tarmat (bConstraint *con, bConstraintOb *cob, bConstraintT static void pycon_evaluate (bConstraint *con, bConstraintOb *cob, ListBase *targets) { #ifdef DISABLE_PYTHON + (void)con; (void)cob; (void)targets; /* unused */ return; #else bPythonConstraint *data= con->data; diff --git a/source/blender/blenkernel/intern/exotic.c b/source/blender/blenkernel/intern/exotic.c index c5431005b18..5e2ca921ef2 100644 --- a/source/blender/blenkernel/intern/exotic.c +++ b/source/blender/blenkernel/intern/exotic.c @@ -64,6 +64,7 @@ #include "BKE_utildefines.h" #include "BLI_blenlib.h" #include "BLI_math.h" +#include "BLI_storage.h" #include "BKE_blender.h" #include "BKE_global.h" diff --git a/source/blender/blenkernel/intern/fmodifier.c b/source/blender/blenkernel/intern/fmodifier.c index 6660442b14a..c900f178ca7 100644 --- a/source/blender/blenkernel/intern/fmodifier.c +++ b/source/blender/blenkernel/intern/fmodifier.c @@ -146,7 +146,7 @@ static void fcm_generator_verify (FModifier *fcm) nc= MEM_callocN(sizeof(float)*(data->poly_order+1), "FMod_Generator_Coefs"); if (data->coefficients) { - if (data->arraysize > (data->poly_order+1)) + if ((int)data->arraysize > (data->poly_order+1)) memcpy(nc, data->coefficients, sizeof(float)*(data->poly_order+1)); else memcpy(nc, data->coefficients, sizeof(float)*data->arraysize); @@ -172,7 +172,7 @@ static void fcm_generator_verify (FModifier *fcm) nc= MEM_callocN(sizeof(float)*(data->poly_order*2), "FMod_Generator_Coefs"); if (data->coefficients) { - if (data->arraysize > (data->poly_order * 2)) + if (data->arraysize > (unsigned int)(data->poly_order * 2)) memcpy(nc, data->coefficients, sizeof(float)*(data->poly_order * 2)); else memcpy(nc, data->coefficients, sizeof(float)*data->arraysize); @@ -240,7 +240,7 @@ static void fcm_generator_evaluate (FCurve *UNUSED(fcu), FModifier *fcm, float * unsigned int i; /* for each coefficient pair, solve for that bracket before accumulating in value by multiplying */ - for (cp=data->coefficients, i=0; (cp) && (i < data->poly_order); cp+=2, i++) + for (cp=data->coefficients, i=0; (cp) && (i < (unsigned int)data->poly_order); cp+=2, i++) value *= (cp[0]*evaltime + cp[1]); /* only if something changed, write *cvalue in one go */ diff --git a/source/blender/blenkernel/intern/font.c b/source/blender/blenkernel/intern/font.c index 131b16b319e..58917e75a43 100644 --- a/source/blender/blenkernel/intern/font.c +++ b/source/blender/blenkernel/intern/font.c @@ -305,7 +305,7 @@ static VFontData *vfont_get_data(VFont *vfont) if (!vfont->data) { PackedFile *pf; - if (BLI_streq(vfont->name, "<builtin>")) { + if (strcmp(vfont->name, FO_BUILTIN_NAME)==0) { pf= get_builtin_packedfile(); } else { if (vfont->packedfile) { @@ -342,7 +342,7 @@ static VFontData *vfont_get_data(VFont *vfont) if(!pf) { printf("Font file doesn't exist: %s\n", vfont->name); - strcpy(vfont->name, "<builtin>"); + strcpy(vfont->name, FO_BUILTIN_NAME); pf= get_builtin_packedfile(); } } @@ -367,7 +367,7 @@ VFont *load_vfont(char *name) int is_builtin; struct TmpFont *tmpfnt; - if (BLI_streq(name, "<builtin>")) { + if (strcmp(name, FO_BUILTIN_NAME)==0) { strcpy(filename, name); pf= get_builtin_packedfile(); @@ -403,8 +403,8 @@ VFont *load_vfont(char *name) vfont->packedfile = pf; } - // Do not add <builtin> to temporary listbase - if(strcmp(filename, "<builtin>")) + // Do not add FO_BUILTIN_NAME to temporary listbase + if(strcmp(filename, FO_BUILTIN_NAME)) { tmpfnt= (struct TmpFont *) MEM_callocN(sizeof(struct TmpFont), "temp_font"); tmpfnt->pf= tpf; @@ -443,10 +443,10 @@ VFont *get_builtin_font(void) VFont *vf; for (vf= G.main->vfont.first; vf; vf= vf->id.next) - if (BLI_streq(vf->name, "<builtin>")) + if (strcmp(vf->name, FO_BUILTIN_NAME)==0) return vf; - return load_vfont("<builtin>"); + return load_vfont(FO_BUILTIN_NAME); } static VChar *find_vfont_char(VFontData *vfd, intptr_t character) @@ -781,10 +781,10 @@ struct chartrans *BKE_text_to_curve(Scene *scene, Object *ob, int mode) /* * The character wasn't in the current curve base so load it - * But if the font is <builtin> then do not try loading since + * But if the font is FO_BUILTIN_NAME then do not try loading since * whole font is in the memory already */ - if(che == NULL && strcmp(vfont->name, "<builtin>")) { + if(che == NULL && strcmp(vfont->name, FO_BUILTIN_NAME)) { BLI_vfontchar_from_freetypefont(vfont, ascii); } diff --git a/source/blender/blenkernel/intern/implicit.c b/source/blender/blenkernel/intern/implicit.c index e0077ec7d26..6ca95752887 100644 --- a/source/blender/blenkernel/intern/implicit.c +++ b/source/blender/blenkernel/intern/implicit.c @@ -1425,7 +1425,7 @@ typedef struct HairGridVert { by Lena Petrovic, Mark Henne and John Anderson * Pixar Technical Memo #06-08, Pixar Animation Studios */ -static void hair_velocity_smoothing(ClothModifierData *clmd, lfVector *lF, lfVector *lX, lfVector *lV, int numverts) +static void hair_velocity_smoothing(ClothModifierData *clmd, lfVector *lF, lfVector *lX, lfVector *lV, unsigned int numverts) { /* TODO: This is an initial implementation and should be made much better in due time. * What should at least be implemented is a grid size parameter and a smoothing kernel @@ -1441,10 +1441,10 @@ static void hair_velocity_smoothing(ClothModifierData *clmd, lfVector *lF, lfVec /* 2.0f is an experimental value that seems to give good results */ float smoothfac = 2.0f * clmd->sim_parms->velocity_smooth; float collfac = 2.0f * clmd->sim_parms->collider_friction; - int v = 0; - int i = 0; - int j = 0; - int k = 0; + unsigned int v = 0; + unsigned int i = 0; + int j = 0; + int k = 0; INIT_MINMAX(gmin, gmax); @@ -1559,7 +1559,7 @@ static void cloth_calc_force(ClothModifierData *clmd, float UNUSED(frame), lfVec { /* Collect forces and derivatives: F,dFdX,dFdV */ Cloth *cloth = clmd->clothObject; - int i = 0; + unsigned int i = 0; float spring_air = clmd->sim_parms->Cvi * 0.01f; /* viscosity of air scaled in percent */ float gravity[3] = {0.0f, 0.0f, 0.0f}; float tm2[3][3] = {{-spring_air,0,0}, {0,-spring_air,0},{0,0,-spring_air}}; diff --git a/source/blender/blenkernel/intern/ipo.c b/source/blender/blenkernel/intern/ipo.c index 846592f0f2f..5ed6beaf376 100644 --- a/source/blender/blenkernel/intern/ipo.c +++ b/source/blender/blenkernel/intern/ipo.c @@ -1123,7 +1123,8 @@ static void icu_to_fcurves (ID *id, ListBase *groups, ListBase *list, IpoCurve * { AdrBit2Path *abp; FCurve *fcu; - int i=0, totbits; + unsigned int i=0; + int totbits; /* allocate memory for a new F-Curve */ fcu= MEM_callocN(sizeof(FCurve), "FCurve"); diff --git a/source/blender/blenkernel/intern/multires.c b/source/blender/blenkernel/intern/multires.c index b0ab947d478..91f15d1ee6c 100644 --- a/source/blender/blenkernel/intern/multires.c +++ b/source/blender/blenkernel/intern/multires.c @@ -1158,18 +1158,19 @@ static void multires_load_old_dm(DerivedMesh *dm, Mesh *me, int totlvl) MultiresLevel *lvl, *lvl1; Multires *mr= me->mr; MVert *vsrc, *vdst; - int src, dst; + unsigned int src, dst; int st = multires_side_tot[totlvl - 1] - 1; int extedgelen = multires_side_tot[totlvl] - 2; int *vvmap; // inorder for dst, map to src int crossedgelen; - int i, j, s, x, totvert, tottri, totquad; + int s, x, tottri, totquad; + unsigned int i, j, totvert; src = 0; dst = 0; vsrc = mr->verts; vdst = dm->getVertArray(dm); - totvert = dm->getNumVerts(dm); + totvert = (unsigned int)dm->getNumVerts(dm); vvmap = MEM_callocN(sizeof(int) * totvert, "multires vvmap"); lvl1 = mr->levels.first; @@ -1260,7 +1261,7 @@ static void multires_load_old_dm(DerivedMesh *dm, Mesh *me, int totlvl) fmem = MEM_callocN(sizeof(IndexNode*) * (mr->level_count-1), "multires fmem"); emem = MEM_callocN(sizeof(IndexNode*) * (mr->level_count-1), "multires emem"); lvl = lvl1; - for(i = 0; i < mr->level_count - 1; ++i) { + for(i = 0; i < (unsigned int)mr->level_count - 1; ++i) { create_old_vert_face_map(fmap + i, fmem + i, lvl->faces, lvl->totvert, lvl->totface); create_old_vert_edge_map(emap + i, emem + i, lvl->edges, lvl->totvert, lvl->totedge); lvl = lvl->next; @@ -1297,7 +1298,7 @@ static void multires_load_old_dm(DerivedMesh *dm, Mesh *me, int totlvl) lvl = lvl->next; - for(i = 0; i < mr->level_count - 1; ++i) { + for(i = 0; i < (unsigned int)(mr->level_count - 1); ++i) { MEM_freeN(fmap[i]); MEM_freeN(fmem[i]); MEM_freeN(emap[i]); diff --git a/source/blender/blenkernel/intern/node.c b/source/blender/blenkernel/intern/node.c index cb98c2282bc..6b53e538f8e 100644 --- a/source/blender/blenkernel/intern/node.c +++ b/source/blender/blenkernel/intern/node.c @@ -1803,7 +1803,7 @@ int NodeTagIDChanged(bNodeTree *ntree, ID *id) { int change = FALSE; - if(id==NULL) + if(ELEM(NULL, id, ntree)) return change; if(ntree->type==NTREE_COMPOSIT) { diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c index 5237335e8ca..142e41918dd 100644 --- a/source/blender/blenkernel/intern/object.c +++ b/source/blender/blenkernel/intern/object.c @@ -1476,7 +1476,7 @@ static void armature_set_id_extern(Object *ob) { bArmature *arm= ob->data; bPoseChannel *pchan; - int lay= arm->layer_protected; + unsigned int lay= arm->layer_protected; for (pchan = ob->pose->chanbase.first; pchan; pchan=pchan->next) { if(!(pchan->bone->layer & lay)) @@ -1704,12 +1704,18 @@ void object_apply_mat4(Object *ob, float mat[][4]) /* location */ copy_v3_v3(ob->loc, mat[3]); - - /* rotation */ + + /* rotation & scale are linked, we need to create the mat's + * for these together since they are related. */ copy_m3_m4(mat3, mat); /* so scale doesnt interfear with rotation [#24291] */ normalize_m3_m3(mat3_n, (const float(*)[3])mat3); + if(mat3_n[0][0] < 0.0f) negate_v3(mat3_n[0]); + if(mat3_n[1][1] < 0.0f) negate_v3(mat3_n[1]); + if(mat3_n[2][2] < 0.0f) negate_v3(mat3_n[2]); + + /* rotation */ object_mat3_to_rot(ob, mat3_n, 0); /* scale */ diff --git a/source/blender/blenkernel/intern/packedFile.c b/source/blender/blenkernel/intern/packedFile.c index 33f1949c5ac..e8223caed41 100644 --- a/source/blender/blenkernel/intern/packedFile.c +++ b/source/blender/blenkernel/intern/packedFile.c @@ -227,7 +227,7 @@ void packAll(Main *bmain, ReportList *reports) } for(vf=bmain->vfont.first; vf; vf=vf->id.next) - if(vf->packedfile == NULL && vf->id.lib==NULL && strcmp(vf->name, "<builtin>") != 0) + if(vf->packedfile == NULL && vf->id.lib==NULL && strcmp(vf->name, FO_BUILTIN_NAME) != 0) vf->packedfile = newPackedFile(reports, vf->name); for(sound=bmain->sound.first; sound; sound=sound->id.next) diff --git a/source/blender/blenkernel/intern/particle_system.c b/source/blender/blenkernel/intern/particle_system.c index 71ec1114848..be616d9922c 100644 --- a/source/blender/blenkernel/intern/particle_system.c +++ b/source/blender/blenkernel/intern/particle_system.c @@ -62,6 +62,7 @@ #include "BLI_kdopbvh.h" #include "BLI_listbase.h" #include "BLI_threads.h" +#include "BLI_storage.h" /* For _LARGEFILE64_SOURCE; zlib needs this on some systems */ #include "BKE_main.h" #include "BKE_animsys.h" @@ -3260,7 +3261,7 @@ static void do_hair_dynamics(ParticleSimulationData *sim) psys->clmd->point_cache = psys->pointcache; psys->clmd->sim_parms->effector_weights = psys->part->effector_weights; - psys->hair_out_dm = clothModifier_do(psys->clmd, sim->scene, sim->ob, dm, 0, 0); + psys->hair_out_dm = clothModifier_do(psys->clmd, sim->scene, sim->ob, dm); psys->clmd->sim_parms->effector_weights = NULL; } diff --git a/source/blender/blenkernel/intern/sequencer.c b/source/blender/blenkernel/intern/sequencer.c index 21b7cfd010c..53930cee68b 100644 --- a/source/blender/blenkernel/intern/sequencer.c +++ b/source/blender/blenkernel/intern/sequencer.c @@ -62,8 +62,6 @@ #include "IMB_imbuf.h" #include "IMB_imbuf_types.h" - - #include "BKE_context.h" #include "BKE_sound.h" #include "AUD_C-API.h" @@ -1803,7 +1801,8 @@ static ImBuf * seq_render_scene_strip_impl( Object *oldcamera; ListBase oldmarkers; - /* Hack! This function can be called from do_render_seq(), in that case + /* Old info: + Hack! This function can be called from do_render_seq(), in that case the seq->scene can already have a Render initialized with same name, so we have to use a default name. (compositor uses scene name to find render). @@ -1815,9 +1814,27 @@ static ImBuf * seq_render_scene_strip_impl( and since G.rendering is uhm, gone... (Peter) */ + /* New info: + Using the same name for the renders works just fine as the do_render_seq() + render is not used while the scene strips are rendered. + + However rendering from UI (through sequencer_preview_area_draw) can crash in + very many cases since other renders (material preview, an actual render etc.) + can be started while this sequence preview render is running. The only proper + solution is to make the sequencer preview render a proper job, which can be + stopped when needed. This would also give a nice progress bar for the preview + space so that users know there's something happening. + + As a result the active scene now only uses OpenGL rendering for the sequencer + preview. This is far from nice, but is the only way to prevent crashes at this + time. + + -jahka + */ + int rendering = G.rendering; int doseq; - int doseq_gl= G.rendering ? /*(scene->r.seq_flag & R_SEQ_GL_REND)*/ 0 : (scene->r.seq_flag & R_SEQ_GL_PREV); + int doseq_gl= G.rendering ? /*(scene->r.seq_flag & R_SEQ_GL_REND)*/ 0 : /*(scene->r.seq_flag & R_SEQ_GL_PREV)*/ 1; int have_seq= FALSE; Scene *sce= seq->scene; /* dont refer to seq->scene above this point!, it can be NULL */ int sce_valid= FALSE; @@ -1850,30 +1867,28 @@ static ImBuf * seq_render_scene_strip_impl( #endif if(sequencer_view3d_cb && BLI_thread_is_main() && doseq_gl && (seq->scene == scene || have_seq==0) && seq->scene->camera) { + /* for old scened this can be uninitialized, should probably be added to do_versions at some point if the functionality stays */ + if(scene->r.seq_prev_type==0) + scene->r.seq_prev_type = 3 /* ==OB_SOLID */; + /* opengl offscreen render */ scene_update_for_newframe(bmain, seq->scene, seq->scene->lay); - ibuf= sequencer_view3d_cb(seq->scene, seqrectx, seqrecty, IB_rect, - scene->r.seq_prev_type); + ibuf= sequencer_view3d_cb(seq->scene, seqrectx, seqrecty, IB_rect, scene->r.seq_prev_type); } else { - Render *re; + Render *re = RE_GetRender(sce->id.name); RenderResult rres; - - if(rendering) - re= RE_NewRender(" do_build_seq_ibuf"); - /* If the top level scene that does the sequencer rendering is included - * as a strip the default render name for the strip will conflict with - * the original render, so override the name in this case. - * See bugs #22236 and #24160 for examples. - * XXX: Somebody with deeper insight to the rendering pipeline should - * probably check if this is the best way to handle this. -jahka - */ - else if(seq->scene == scene) - re= RE_NewRender("scene_conflict_render"); - else - re= RE_NewRender(sce->id.name); - - RE_BlenderFrame(re, bmain, sce, NULL, sce->lay, frame); + + /* XXX: this if can be removed when sequence preview rendering uses the job system */ + if(rendering || scene != sce) { + if(re==NULL) + re= RE_NewRender(sce->id.name); + + RE_BlenderFrame(re, bmain, sce, NULL, sce->lay, frame); + + /* restore previous state after it was toggled on & off by RE_BlenderFrame */ + G.rendering = rendering; + } RE_AcquireResultImage(re, &rres); @@ -3219,7 +3234,7 @@ void seq_offset_animdata(Scene *scene, Sequence *seq, int ofs) for (fcu= scene->adt->action->curves.first; fcu; fcu= fcu->next) { if(strstr(fcu->rna_path, "sequence_editor.sequences_all[") && strstr(fcu->rna_path, str)) { - int i; + unsigned int i; for (i = 0; i < fcu->totvert; i++) { BezTriple *bezt= &fcu->bezt[i]; bezt->vec[0][0] += ofs; diff --git a/source/blender/blenkernel/intern/smoke.c b/source/blender/blenkernel/intern/smoke.c index d1eed94d330..a7e664bf2bf 100644 --- a/source/blender/blenkernel/intern/smoke.c +++ b/source/blender/blenkernel/intern/smoke.c @@ -1270,7 +1270,7 @@ static void smoke_calc_domain(Scene *scene, Object *ob, SmokeModifierData *smd) } } } -void smokeModifier_do(SmokeModifierData *smd, Scene *scene, Object *ob, DerivedMesh *dm, int UNUSED(useRenderParams), int UNUSED(isFinalCalc)) +void smokeModifier_do(SmokeModifierData *smd, Scene *scene, Object *ob, DerivedMesh *dm) { if((smd->type & MOD_SMOKE_TYPE_FLOW)) { diff --git a/source/blender/blenkernel/intern/subsurf_ccg.c b/source/blender/blenkernel/intern/subsurf_ccg.c index 26bd981db4a..51cee333370 100644 --- a/source/blender/blenkernel/intern/subsurf_ccg.c +++ b/source/blender/blenkernel/intern/subsurf_ccg.c @@ -1146,71 +1146,74 @@ static void ccgDM_drawVerts(DerivedMesh *dm) { ccgFaceIterator_free(fi); glEnd(); } + static void ccgDM_drawEdges(DerivedMesh *dm, int drawLooseEdges, int UNUSED(drawAllEdges)) { CCGDerivedMesh *ccgdm = (CCGDerivedMesh*) dm; CCGSubSurf *ss = ccgdm->ss; - CCGEdgeIterator *ei = ccgSubSurf_getEdgeIterator(ss); CCGFaceIterator *fi = ccgSubSurf_getFaceIterator(ss); - int i, edgeSize = ccgSubSurf_getEdgeSize(ss); + CCGEdgeIterator *ei = ccgSubSurf_getEdgeIterator(ss); int gridSize = ccgSubSurf_getGridSize(ss); + int edgeSize = ccgSubSurf_getEdgeSize(ss); + int step; int useAging; ccgSubSurf_getUseAgeCounts(ss, &useAging, NULL, NULL, NULL); - for (; !ccgEdgeIterator_isStopped(ei); ccgEdgeIterator_next(ei)) { - CCGEdge *e = ccgEdgeIterator_getCurrent(ei); - DMGridData *edgeData = ccgSubSurf_getEdgeDataArray(ss, e); - - if (!drawLooseEdges && !ccgSubSurf_getEdgeNumFaces(e)) - continue; - - if (useAging && !(G.f&G_BACKBUFSEL)) { - int ageCol = 255-ccgSubSurf_getEdgeAge(ss, e)*4; - glColor3ub(0, ageCol>0?ageCol:0, 0); - } - - glBegin(GL_LINE_STRIP); - for (i=0; i<edgeSize-1; i++) { - glVertex3fv(edgeData[i].co); - glVertex3fv(edgeData[i+1].co); - } - glEnd(); - } + /* nothing to do */ + if(!drawLooseEdges && !ccgdm->drawInteriorEdges) + return; if (useAging && !(G.f&G_BACKBUFSEL)) { glColor3ub(0, 0, 0); } - if (ccgdm->drawInteriorEdges) { - for (; !ccgFaceIterator_isStopped(fi); ccgFaceIterator_next(fi)) { - CCGFace *f = ccgFaceIterator_getCurrent(fi); - int S, x, y, numVerts = ccgSubSurf_getFaceNumVerts(f); + if(ccgdm->drawInteriorEdges) + step = 1; + else + step = gridSize - 1; - for (S=0; S<numVerts; S++) { - DMGridData *faceGridData = ccgSubSurf_getFaceGridDataArray(ss, f, S); + /* draw edges using face grids */ + for (; !ccgFaceIterator_isStopped(fi); ccgFaceIterator_next(fi)) { + CCGFace *f = ccgFaceIterator_getCurrent(fi); + int S, x, y, numVerts = ccgSubSurf_getFaceNumVerts(f); + for (S=0; S<numVerts; S++) { + DMGridData *faceGridData = ccgSubSurf_getFaceGridDataArray(ss, f, S); + + for (y=0; y<gridSize; y+=step) { glBegin(GL_LINE_STRIP); for (x=0; x<gridSize; x++) - glVertex3fv(faceGridData[x].co); + glVertex3fv(faceGridData[y*gridSize + x].co); glEnd(); - for (y=1; y<gridSize-1; y++) { - glBegin(GL_LINE_STRIP); - for (x=0; x<gridSize; x++) - glVertex3fv(faceGridData[y*gridSize + x].co); - glEnd(); - } - for (x=1; x<gridSize-1; x++) { - glBegin(GL_LINE_STRIP); - for (y=0; y<gridSize; y++) - glVertex3fv(faceGridData[y*gridSize + x].co); - glEnd(); - } } + for (x=0; x<gridSize; x+=step) { + glBegin(GL_LINE_STRIP); + for (y=0; y<gridSize; y++) + glVertex3fv(faceGridData[y*gridSize + x].co); + glEnd(); + } + } + } + + /* draw edges with no adjacent face */ + if(!drawLooseEdges) return; + for(; !ccgEdgeIterator_isStopped(ei); ccgEdgeIterator_next(ei)) { + CCGEdge *e = ccgEdgeIterator_getCurrent(ei); + + if(!ccgSubSurf_getEdgeNumFaces(e)) { + DMGridData *edgeData = ccgSubSurf_getEdgeDataArray(ss, e); + int i; + + glBegin(GL_LINE_STRIP); + for (i=0; i<edgeSize-1; i++) { + glVertex3fv(edgeData[i].co); + glVertex3fv(edgeData[i+1].co); + } + glEnd(); } } ccgFaceIterator_free(fi); - ccgEdgeIterator_free(ei); } static void ccgDM_drawLooseEdges(DerivedMesh *dm) { CCGDerivedMesh *ccgdm = (CCGDerivedMesh*) dm; diff --git a/source/blender/blenkernel/intern/text.c b/source/blender/blenkernel/intern/text.c index bb1a1a88a09..cb3c0c08cc0 100644 --- a/source/blender/blenkernel/intern/text.c +++ b/source/blender/blenkernel/intern/text.c @@ -991,8 +991,8 @@ void txt_move_to (Text *text, unsigned int line, unsigned int ch, short sel) if ((*linep)->next) *linep= (*linep)->next; else break; } - if (ch>(*linep)->len) - ch= (*linep)->len; + if (ch>(unsigned int)((*linep)->len)) + ch= (unsigned int)((*linep)->len); *charp= ch; if(!sel) txt_pop_sel(text); diff --git a/source/blender/blenkernel/intern/texture.c b/source/blender/blenkernel/intern/texture.c index 77416f4dd12..da3dea37220 100644 --- a/source/blender/blenkernel/intern/texture.c +++ b/source/blender/blenkernel/intern/texture.c @@ -1337,13 +1337,11 @@ int BKE_texture_dependsOnTime(const struct Tex *texture) else if( texture->ima && ELEM(texture->ima->source, IMA_SRC_SEQUENCE, IMA_SRC_MOVIE)) { return 1; - } -#if 0 // XXX old animation system - else if(texture->ipo) { - // assume any ipo means the texture is animated + } + else if(texture->adt) { + // assume anything in adt means the texture is animated return 1; } -#endif // XXX old animation system return 0; } diff --git a/source/blender/blenkernel/intern/unit.c b/source/blender/blenkernel/intern/unit.c index 25aab77ba9b..83ace49eb67 100644 --- a/source/blender/blenkernel/intern/unit.c +++ b/source/blender/blenkernel/intern/unit.c @@ -26,11 +26,7 @@ #include <string.h> #include "BKE_unit.h" -#ifdef WIN32 -#define _USE_MATH_DEFINES -#endif -#include <math.h> - +#include "BLI_math.h" #include "BLI_winstuff.h" @@ -687,7 +683,7 @@ void bUnit_ToUnitAltName(char *str, int len_max, char *orig_str, int system, int found= unit_find_str(orig_str, unit->name_short); if(found) { - int offset= found - orig_str; + int offset= (int)(found - orig_str); int len_name= 0; /* copy everything before the unit */ diff --git a/source/blender/blenkernel/intern/writeffmpeg.c b/source/blender/blenkernel/intern/writeffmpeg.c index aae26da02dd..0ec38a035aa 100644 --- a/source/blender/blenkernel/intern/writeffmpeg.c +++ b/source/blender/blenkernel/intern/writeffmpeg.c @@ -955,7 +955,7 @@ int append_ffmpeg(RenderData *rd, int frame, int *pixels, int rectx, int recty, void end_ffmpeg(void) { - int i; + unsigned int i; fprintf(stderr, "Closing ffmpeg...\n"); @@ -1058,6 +1058,8 @@ IDProperty *ffmpeg_property_add(RenderData *rd, char * type, int opt_index, int IDPropertyTemplate val; int idp_type; char name[256]; + + val.i = 0; avcodec_get_context_defaults(&c); @@ -1065,8 +1067,6 @@ IDProperty *ffmpeg_property_add(RenderData *rd, char * type, int opt_index, int parent = c.av_class->option + parent_index; if (!rd->ffcodecdata.properties) { - IDPropertyTemplate val; - rd->ffcodecdata.properties = IDP_New(IDP_GROUP, val, "ffmpeg"); } @@ -1075,8 +1075,6 @@ IDProperty *ffmpeg_property_add(RenderData *rd, char * type, int opt_index, int rd->ffcodecdata.properties, (char*) type); if (!group) { - IDPropertyTemplate val; - group = IDP_New(IDP_GROUP, val, (char*) type); IDP_AddToGroup(rd->ffcodecdata.properties, group); } diff --git a/source/blender/blenlib/BLI_kdopbvh.h b/source/blender/blenlib/BLI_kdopbvh.h index d9e3d7e42c6..aa55ececc06 100644 --- a/source/blender/blenlib/BLI_kdopbvh.h +++ b/source/blender/blenlib/BLI_kdopbvh.h @@ -90,7 +90,7 @@ int BLI_bvhtree_update_node(BVHTree *tree, int index, float *co, float *co_movin void BLI_bvhtree_update_tree(BVHTree *tree); /* collision/overlap: check two trees if they overlap, alloc's *overlap with length of the int return value */ -BVHTreeOverlap *BLI_bvhtree_overlap(BVHTree *tree1, BVHTree *tree2, int *result); +BVHTreeOverlap *BLI_bvhtree_overlap(BVHTree *tree1, BVHTree *tree2, unsigned int *result); float BLI_bvhtree_getepsilon(BVHTree *tree); diff --git a/source/blender/blenlib/BLI_math_base.h b/source/blender/blenlib/BLI_math_base.h index 77266e2e9d8..2feacd64651 100644 --- a/source/blender/blenlib/BLI_math_base.h +++ b/source/blender/blenlib/BLI_math_base.h @@ -128,6 +128,7 @@ extern "C" { #ifndef FREE_WINDOWS #define isnan(n) _isnan(n) #define finite _finite +#define hypot _hypot #endif #endif diff --git a/source/blender/blenlib/BLI_math_matrix.h b/source/blender/blenlib/BLI_math_matrix.h index 6b3d8bf9d0b..d25707d480c 100644 --- a/source/blender/blenlib/BLI_math_matrix.h +++ b/source/blender/blenlib/BLI_math_matrix.h @@ -135,21 +135,23 @@ void scale_m4_fl(float R[4][4], float scale); float mat3_to_scale(float M[3][3]); float mat4_to_scale(float M[4][4]); -void size_to_mat3(float R[3][3], float size[3]); -void size_to_mat4(float R[4][4], float size[3]); +void size_to_mat3(float R[3][3], const float size[3]); +void size_to_mat4(float R[4][4], const float size[3]); void mat3_to_size(float r[3], float M[3][3]); void mat4_to_size(float r[3], float M[4][4]); void translate_m4(float mat[4][4], float tx, float ty, float tz); -void rotate_m4(float mat[4][4], char axis, float angle); +void rotate_m4(float mat[4][4], const char axis, const float angle); void loc_eul_size_to_mat4(float R[4][4], - float loc[3], float eul[3], float size[3]); + const float loc[3], const float eul[3], const float size[3]); void loc_eulO_size_to_mat4(float R[4][4], - float loc[3], float eul[3], float size[3], short order); + const float loc[3], const float eul[3], const float size[3], const short order); void loc_quat_size_to_mat4(float R[4][4], - float loc[3], float quat[4], float size[3]); + const float loc[3], const float quat[4], const float size[3]); +void loc_axisangle_size_to_mat4(float R[4][4], + const float loc[3], const float axis[4], const float angle, const float size[3]); void blend_m3_m3m3(float R[3][3], float A[3][3], float B[3][3], float t); void blend_m4_m4m4(float R[4][4], float A[4][4], float B[4][4], float t); diff --git a/source/blender/blenlib/BLI_math_rotation.h b/source/blender/blenlib/BLI_math_rotation.h index 321fd28a62f..a953a01a8a1 100644 --- a/source/blender/blenlib/BLI_math_rotation.h +++ b/source/blender/blenlib/BLI_math_rotation.h @@ -48,29 +48,29 @@ void mul_qt_v3(const float q[4], float r[3]); void mul_qt_fl(float q[4], const float f); void mul_fac_qt_fl(float q[4], const float f); -void sub_qt_qtqt(float q[4], float a[4], float b[4]); +void sub_qt_qtqt(float q[4], const float a[4], const float b[4]); void invert_qt(float q[4]); void invert_qt_qt(float *q1, const float *q2); void conjugate_qt(float q[4]); -float dot_qtqt(float a[4], float b[4]); +float dot_qtqt(const float a[4], const float b[4]); void normalize_qt(float q[4]); /* comparison */ int is_zero_qt(float q[4]); /* interpolation */ -void interp_qt_qtqt(float q[4], float a[4], float b[4], float t); -void add_qt_qtqt(float q[4], float a[4], float b[4], float t); +void interp_qt_qtqt(float q[4], const float a[4], const float b[4], const float t); +void add_qt_qtqt(float q[4], const float a[4], const float b[4], const float t); /* conversion */ -void quat_to_mat3(float mat[3][3], float q[4]); -void quat_to_mat4(float mat[4][4], float q[4]); +void quat_to_mat3(float mat[3][3], const float q[4]); +void quat_to_mat4(float mat[4][4], const float q[4]); void mat3_to_quat(float q[4], float mat[3][3]); void mat4_to_quat(float q[4], float mat[4][4]); -void tri_to_quat(float q[4], float a[3], float b[3], float c[3]); -void vec_to_quat(float q[4], float vec[3], short axis, short upflag); +void tri_to_quat(float q[4], const float a[3], const float b[3], const float c[3]); +void vec_to_quat(float q[4], const float vec[3], short axis, const short upflag); /* note: v1 and v2 must be normalized */ void rotation_between_vecs_to_quat(float q[4], const float v1[3], const float v2[3]); void rotation_between_quats_to_quat(float q[4], const float q1[4], const float q2[4]); @@ -84,11 +84,11 @@ void print_qt(char *str, float q[4]); /******************************** Axis Angle *********************************/ /* conversion */ -void axis_angle_to_quat(float r[4], float axis[3], float angle); -void axis_angle_to_mat3(float R[3][3], float axis[3], float angle); -void axis_angle_to_mat4(float R[4][4], float axis[3], float angle); +void axis_angle_to_quat(float r[4], const float axis[3], float angle); +void axis_angle_to_mat3(float R[3][3], const float axis[3], const float angle); +void axis_angle_to_mat4(float R[4][4], const float axis[3], const float angle); -void quat_to_axis_angle(float axis[3], float *angle, float q[4]); +void quat_to_axis_angle(float axis[3], float *angle, const float q[4]); void mat3_to_axis_angle(float axis[3], float *angle, float M[3][3]); void mat4_to_axis_angle(float axis[3], float *angle, float M[4][4]); @@ -100,24 +100,24 @@ void mat4_to_axis_angle(float axis[3], float *angle, float M[4][4]); void mat3_to_vec_rot(float vec[3], float *phi, float mat[3][3]); void mat4_to_vec_rot(float vec[3], float *phi, float mat[4][4]); -void vec_rot_to_quat(float quat[4], float vec[3], float phi); -void vec_rot_to_mat3(float mat[3][3], float vec[3], float phi); -void vec_rot_to_mat4(float mat[4][4], float vec[3], float phi); +void vec_rot_to_quat(float quat[4], const float vec[3], const float phi); +void vec_rot_to_mat3(float mat[3][3], const float vec[3], const float phi); +void vec_rot_to_mat4(float mat[4][4], const float vec[3], const float phi); /******************************** XYZ Eulers *********************************/ -void eul_to_quat(float quat[4], float eul[3]); -void eul_to_mat3(float mat[3][3], float eul[3]); -void eul_to_mat4(float mat[4][4], float eul[3]); +void eul_to_quat(float quat[4], const float eul[3]); +void eul_to_mat3(float mat[3][3], const float eul[3]); +void eul_to_mat4(float mat[4][4], const float eul[3]); -void quat_to_eul(float eul[3], float quat[4]); +void quat_to_eul(float eul[3], const float quat[4]); void mat3_to_eul(float eul[3], float mat[3][3]); void mat4_to_eul(float eul[3], float mat[4][4]); -void compatible_eul(float eul[3], float old[3]); -void mat3_to_compatible_eul(float eul[3], float old[3], float mat[3][3]); +void compatible_eul(float eul[3], const float old[3]); +void mat3_to_compatible_eul(float eul[3], const float old[3], float mat[3][3]); -void rotate_eul(float eul[3], char axis, float angle); +void rotate_eul(float eul[3], const char axis, const float angle); /************************** Arbitrary Order Eulers ***************************/ @@ -135,16 +135,16 @@ typedef enum eEulerRotationOrders { /* there are 6 more entries with dulpicate entries included */ } eEulerRotationOrders; -void eulO_to_quat(float quat[4], float eul[3], short order); -void eulO_to_mat3(float mat[3][3], float eul[3], short order); -void eulO_to_mat4(float mat[4][4], float eul[3], short order); -void eulO_to_axis_angle(float axis[3], float *angle, float eul[3], short order); -void eulO_to_gimbal_axis(float gmat[3][3], float eul[3], short order); +void eulO_to_quat(float quat[4], const float eul[3], const short order); +void eulO_to_mat3(float mat[3][3], const float eul[3], const short order); +void eulO_to_mat4(float mat[4][4], const float eul[3], const short order); +void eulO_to_axis_angle(float axis[3], float *angle, const float eul[3], const short order); +void eulO_to_gimbal_axis(float gmat[3][3], const float eul[3], const short order); -void quat_to_eulO(float eul[3], short order, float quat[4]); -void mat3_to_eulO(float eul[3], short order, float mat[3][3]); -void mat4_to_eulO(float eul[3], short order, float mat[4][4]); -void axis_angle_to_eulO(float eul[3], short order, float axis[3], float angle); +void quat_to_eulO(float eul[3], const short order, const float quat[4]); +void mat3_to_eulO(float eul[3], const short order, float mat[3][3]); +void mat4_to_eulO(float eul[3], const short order, float mat[4][4]); +void axis_angle_to_eulO(float eul[3], const short order, const float axis[3], const float angle); void mat3_to_compatible_eulO(float eul[3], float old[3], short order, float mat[3][3]); void mat4_to_compatible_eulO(float eul[3], float old[3], short order, float mat[4][4]); diff --git a/source/blender/blenlib/BLI_math_vector.h b/source/blender/blenlib/BLI_math_vector.h index 5c17ac6b639..3fceef36e2a 100644 --- a/source/blender/blenlib/BLI_math_vector.h +++ b/source/blender/blenlib/BLI_math_vector.h @@ -165,6 +165,14 @@ MINLINE void normal_float_to_short_v3(short r[3], const float n[3]); void minmax_v3v3_v3(float min[3], float max[3], const float vec[3]); +/***************************** Array Functions *******************************/ +/* attempted to follow fixed length vertex functions. names could be improved*/ +void range_vni(int *array, const int size, const int start); +void mul_vn_fl(float *array, const int size, const float f); +void mul_vn_vn_fl(float *array_tar, const float *array_src, const int size, const float f); +void add_vn_vn(float *array_tar, const float *array_src, const int size); +void fill_vni(int *array_tar, const int size, const int val); + #ifdef __cplusplus } #endif diff --git a/source/blender/blenlib/BLI_winstuff.h b/source/blender/blenlib/BLI_winstuff.h index e8689895735..c9a85cf890e 100644 --- a/source/blender/blenlib/BLI_winstuff.h +++ b/source/blender/blenlib/BLI_winstuff.h @@ -35,12 +35,13 @@ #ifdef _WIN32 #ifndef FREE_WINDOWS -#pragma warning(once: 4761 4305 4244 4018) +#pragma warning(once: 4761 4305 4244) #endif #define WIN32_LEAN_AND_MEAN #ifndef WIN32_SKIP_HKEY_PROTECTION +#undef HKEY #define HKEY WIN32_HKEY // prevent competing definitions #include <windows.h> #undef HKEY diff --git a/source/blender/blenlib/CMakeLists.txt b/source/blender/blenlib/CMakeLists.txt index 0ef2346ded4..2e2ed3c5733 100644 --- a/source/blender/blenlib/CMakeLists.txt +++ b/source/blender/blenlib/CMakeLists.txt @@ -24,8 +24,6 @@ # # ***** END GPL LICENSE BLOCK ***** -FILE(GLOB SRC intern/*.c) - SET(INC . ../makesdna @@ -39,9 +37,52 @@ SET(INC ${ZLIB_INC} ) -# unused -LIST(REMOVE_ITEM SRC "${CMAKE_CURRENT_SOURCE_DIR}/intern/BLI_bfile.c") - +SET(SRC + intern/BLI_args.c + intern/BLI_dynstr.c + intern/BLI_ghash.c + intern/BLI_heap.c + intern/BLI_kdopbvh.c + intern/BLI_kdtree.c + intern/BLI_linklist.c + intern/BLI_memarena.c + intern/BLI_mempool.c + intern/DLRB_tree.c + intern/boxpack2d.c + intern/bpath.c + intern/cpu.c + intern/dynlib.c + intern/edgehash.c + intern/fileops.c + intern/fnmatch.c + intern/freetypefont.c + intern/graph.c + intern/gsqueue.c + intern/jitter.c + intern/listbase.c + intern/math_base.c + intern/math_base_inline.c + intern/math_color.c + intern/math_geom.c + intern/math_geom_inline.c + intern/math_matrix.c + intern/math_rotation.c + intern/math_vector.c + intern/math_vector_inline.c + intern/noise.c + intern/path_util.c + intern/pbvh.c + intern/rand.c + intern/rct.c + intern/scanfill.c + intern/storage.c + intern/string.c + intern/threads.c + intern/time.c + intern/uvproject.c + intern/voxel.c + intern/winstuff.c +) IF(CMAKE_SYSTEM_NAME MATCHES "Linux") LIST(APPEND INC "${BINRELOC_INC}") diff --git a/source/blender/blenlib/SConscript b/source/blender/blenlib/SConscript index 78aecf9936b..9ee03df8d8b 100644 --- a/source/blender/blenlib/SConscript +++ b/source/blender/blenlib/SConscript @@ -3,6 +3,11 @@ Import ('env') sources = env.Glob('intern/*.c') +if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'win64-vc'): + sources.remove('intern\\BLI_bfile.c') +else: + sources.remove('intern/BLI_bfile.c') + cflags='' incs = '. ../makesdna ../blenkernel #/intern/guardedalloc #/intern/ghost ../editors/include ../gpu' incs += ' ' + env['BF_FREETYPE_INC'] diff --git a/source/blender/blenlib/intern/BLI_kdopbvh.c b/source/blender/blenlib/intern/BLI_kdopbvh.c index 4d64f4a50ff..8c0be971682 100644 --- a/source/blender/blenlib/intern/BLI_kdopbvh.c +++ b/source/blender/blenlib/intern/BLI_kdopbvh.c @@ -1126,9 +1126,10 @@ static void traverse(BVHOverlapData *data, BVHNode *node1, BVHNode *node2) return; } -BVHTreeOverlap *BLI_bvhtree_overlap(BVHTree *tree1, BVHTree *tree2, int *result) +BVHTreeOverlap *BLI_bvhtree_overlap(BVHTree *tree1, BVHTree *tree2, unsigned int *result) { - int j, total = 0; + int j; + unsigned int total = 0; BVHTreeOverlap *overlap = NULL, *to = NULL; BVHOverlapData **data; diff --git a/source/blender/blenlib/intern/bpath.c b/source/blender/blenlib/intern/bpath.c index 862df4103a7..8711857f83a 100644 --- a/source/blender/blenlib/intern/bpath.c +++ b/source/blender/blenlib/intern/bpath.c @@ -171,7 +171,7 @@ static struct VFont *vf_stepdata__internal(struct VFont *vf, int step_next) { vf = vf->id.next; while (vf) { - if (vf->packedfile==NULL && BLI_streq(vf->name, "<builtin>")==0) { + if (vf->packedfile==NULL && strcmp(vf->name, FO_BUILTIN_NAME)!=0) { break; } diff --git a/source/blender/blenlib/intern/math_base.c b/source/blender/blenlib/intern/math_base.c index 686b35a878e..df8749c9ddd 100644 --- a/source/blender/blenlib/intern/math_base.c +++ b/source/blender/blenlib/intern/math_base.c @@ -52,7 +52,8 @@ double round(double x) y += 1.0; return copysign(y, x); } - +#else /* OpenSuse 11.1 seems to need this. */ +double round(double x); #endif diff --git a/source/blender/blenlib/intern/math_matrix.c b/source/blender/blenlib/intern/math_matrix.c index 9bbd0fc64ac..86eee4c2202 100644 --- a/source/blender/blenlib/intern/math_matrix.c +++ b/source/blender/blenlib/intern/math_matrix.c @@ -898,7 +898,7 @@ float determinant_m4(float m[][4]) /****************************** Transformations ******************************/ -void size_to_mat3(float mat[][3], float *size) +void size_to_mat3(float mat[][3], const float size[3]) { mat[0][0]= size[0]; mat[0][1]= 0.0f; @@ -911,7 +911,7 @@ void size_to_mat3(float mat[][3], float *size) mat[2][0]= 0.0f; } -void size_to_mat4(float mat[][4], float *size) +void size_to_mat4(float mat[][4], const float size[3]) { float tmat[3][3]; @@ -1078,7 +1078,7 @@ int is_negative_m4(float mat[][4]) /* make a 4x4 matrix out of 3 transform components */ /* matrices are made in the order: scale * rot * loc */ // TODO: need to have a version that allows for rotation order... -void loc_eul_size_to_mat4(float mat[4][4], float loc[3], float eul[3], float size[3]) +void loc_eul_size_to_mat4(float mat[4][4], const float loc[3], const float eul[3], const float size[3]) { float rmat[3][3], smat[3][3], tmat[3][3]; @@ -1101,7 +1101,7 @@ void loc_eul_size_to_mat4(float mat[4][4], float loc[3], float eul[3], float siz /* make a 4x4 matrix out of 3 transform components */ /* matrices are made in the order: scale * rot * loc */ -void loc_eulO_size_to_mat4(float mat[4][4], float loc[3], float eul[3], float size[3], short rotOrder) +void loc_eulO_size_to_mat4(float mat[4][4], const float loc[3], const float eul[3], const float size[3], const short rotOrder) { float rmat[3][3], smat[3][3], tmat[3][3]; @@ -1125,7 +1125,7 @@ void loc_eulO_size_to_mat4(float mat[4][4], float loc[3], float eul[3], float si /* make a 4x4 matrix out of 3 transform components */ /* matrices are made in the order: scale * rot * loc */ -void loc_quat_size_to_mat4(float mat[4][4], float loc[3], float quat[4], float size[3]) +void loc_quat_size_to_mat4(float mat[4][4], const float loc[3], const float quat[4], const float size[3]) { float rmat[3][3], smat[3][3], tmat[3][3]; @@ -1146,6 +1146,13 @@ void loc_quat_size_to_mat4(float mat[4][4], float loc[3], float quat[4], float s mat[3][2] = loc[2]; } +void loc_axisangle_size_to_mat4(float mat[4][4], const float loc[3], const float axis[3], const float angle, const float size[3]) +{ + float q[4]; + axis_angle_to_quat(q, axis, angle); + loc_quat_size_to_mat4(mat, loc, q, size); +} + /*********************************** Other ***********************************/ void print_m3(char *str, float m[][3]) diff --git a/source/blender/blenlib/intern/math_rotation.c b/source/blender/blenlib/intern/math_rotation.c index 3b58fe88bf5..7debdcdb015 100644 --- a/source/blender/blenlib/intern/math_rotation.c +++ b/source/blender/blenlib/intern/math_rotation.c @@ -88,7 +88,7 @@ void conjugate_qt(float *q) q[3] = -q[3]; } -float dot_qtqt(float *q1, float *q2) +float dot_qtqt(const float q1[4], const float q2[4]) { return q1[0]*q2[0] + q1[1]*q2[1] + q1[2]*q2[2] + q1[3]*q2[3]; } @@ -119,11 +119,10 @@ void mul_qt_fl(float *q, const float f) q[3] *= f; } -void sub_qt_qtqt(float *q, float *q1, float *q2) +void sub_qt_qtqt(float q[4], const float q1[4], const float q2[4]) { - q2[0]= -q2[0]; - mul_qt_qtqt(q, q1, q2); - q2[0]= -q2[0]; + const float nq2[4]= {-q2[0], q2[1], q2[2], q2[3]}; + mul_qt_qtqt(q, q1, nq2); } /* angular mult factor */ @@ -138,7 +137,7 @@ void mul_fac_qt_fl(float *q, const float fac) mul_v3_fl(q+1, si); } -void quat_to_mat3(float m[][3], float *q) +void quat_to_mat3(float m[][3], const float q[4]) { double q0, q1, q2, q3, qda,qdb,qdc,qaa,qab,qac,qbb,qbc,qcc; @@ -170,7 +169,7 @@ void quat_to_mat3(float m[][3], float *q) m[2][2]= (float)(1.0-qaa-qbb); } -void quat_to_mat4(float m[][4], float *q) +void quat_to_mat4(float m[][4], const float q[4]) { double q0, q1, q2, q3, qda,qdb,qdc,qaa,qab,qac,qbb,qbc,qcc; @@ -356,7 +355,7 @@ void rotation_between_quats_to_quat(float *q, const float q1[4], const float q2[ } -void vec_to_quat(float *q,float *vec, short axis, short upflag) +void vec_to_quat(float q[4], const float vec[3], short axis, const short upflag) { float q2[4], nor[3], *fp, mat[3][3], angle, si, co, x2, y2, z2, len1; @@ -491,7 +490,7 @@ void QuatInterpolW(float *result, float *quat1, float *quat2, float t) } #endif -void interp_qt_qtqt(float *result, float *quat1, float *quat2, float t) +void interp_qt_qtqt(float result[4], const float quat1[4], const float quat2[4], const float t) { float quat[4], omega, cosom, sinom, sc1, sc2; @@ -528,7 +527,7 @@ void interp_qt_qtqt(float *result, float *quat1, float *quat2, float t) result[3] = sc1 * quat[3] + sc2 * quat2[3]; } -void add_qt_qtqt(float *result, float *quat1, float *quat2, float t) +void add_qt_qtqt(float result[4], const float quat1[4], const float quat2[4], const float t) { result[0]= quat1[0] + t*quat2[0]; result[1]= quat1[1] + t*quat2[1]; @@ -536,7 +535,7 @@ void add_qt_qtqt(float *result, float *quat1, float *quat2, float t) result[3]= quat1[3] + t*quat2[3]; } -void tri_to_quat(float *quat, float *v1, float *v2, float *v3) +void tri_to_quat(float quat[4], const float v1[3], const float v2[3], const float v3[3]) { /* imaginary x-axis, y-axis triangle is being rotated */ float vec[3], q1[4], q2[4], n[3], si, co, angle, mat[3][3], imat[3][3]; @@ -588,7 +587,7 @@ void print_qt(char *str, float q[4]) /******************************** Axis Angle *********************************/ /* Axis angle to Quaternions */ -void axis_angle_to_quat(float q[4], float axis[3], float angle) +void axis_angle_to_quat(float q[4], const float axis[3], float angle) { float nor[3]; float si; @@ -604,7 +603,7 @@ void axis_angle_to_quat(float q[4], float axis[3], float angle) } /* Quaternions to Axis Angle */ -void quat_to_axis_angle(float axis[3], float *angle,float q[4]) +void quat_to_axis_angle(float axis[3], float *angle, const float q[4]) { float ha, si; @@ -625,7 +624,7 @@ void quat_to_axis_angle(float axis[3], float *angle,float q[4]) } /* Axis Angle to Euler Rotation */ -void axis_angle_to_eulO(float eul[3], short order,float axis[3], float angle) +void axis_angle_to_eulO(float eul[3], const short order, const float axis[3], const float angle) { float q[4]; @@ -635,7 +634,7 @@ void axis_angle_to_eulO(float eul[3], short order,float axis[3], float angle) } /* Euler Rotation to Axis Angle */ -void eulO_to_axis_angle(float axis[3], float *angle,float eul[3], short order) +void eulO_to_axis_angle(float axis[3], float *angle, const float eul[3], const short order) { float q[4]; @@ -645,7 +644,7 @@ void eulO_to_axis_angle(float axis[3], float *angle,float eul[3], short order) } /* axis angle to 3x3 matrix - safer version (normalisation of axis performed) */ -void axis_angle_to_mat3(float mat[3][3],float axis[3], float angle) +void axis_angle_to_mat3(float mat[3][3], const float axis[3], const float angle) { float nor[3], nsi[3], co, si, ico; @@ -673,7 +672,7 @@ void axis_angle_to_mat3(float mat[3][3],float axis[3], float angle) } /* axis angle to 4x4 matrix - safer version (normalisation of axis performed) */ -void axis_angle_to_mat4(float mat[4][4],float axis[3], float angle) +void axis_angle_to_mat4(float mat[4][4], const float axis[3], const float angle) { float tmat[3][3]; @@ -730,7 +729,7 @@ void mat4_to_vec_rot(float axis[3], float *angle,float mat[4][4]) } /* axis angle to 3x3 matrix */ -void vec_rot_to_mat3(float mat[][3],float *vec, float phi) +void vec_rot_to_mat3(float mat[][3], const float vec[3], const float phi) { /* rotation of phi radials around vec */ float vx, vx2, vy, vy2, vz, vz2, co, si; @@ -756,7 +755,7 @@ void vec_rot_to_mat3(float mat[][3],float *vec, float phi) } /* axis angle to 4x4 matrix */ -void vec_rot_to_mat4(float mat[][4],float *vec, float phi) +void vec_rot_to_mat4(float mat[][4], const float vec[3], const float phi) { float tmat[3][3]; @@ -766,7 +765,7 @@ void vec_rot_to_mat4(float mat[][4],float *vec, float phi) } /* axis angle to quaternion */ -void vec_rot_to_quat(float *quat,float *vec, float phi) +void vec_rot_to_quat(float *quat, const float vec[3], const float phi) { /* rotation of phi radials around vec */ float si; @@ -790,7 +789,7 @@ void vec_rot_to_quat(float *quat,float *vec, float phi) /******************************** XYZ Eulers *********************************/ /* XYZ order */ -void eul_to_mat3(float mat[][3], float *eul) +void eul_to_mat3(float mat[][3], const float eul[3]) { double ci, cj, ch, si, sj, sh, cc, cs, sc, ss; @@ -818,7 +817,7 @@ void eul_to_mat3(float mat[][3], float *eul) } /* XYZ order */ -void eul_to_mat4(float mat[][4], float *eul) +void eul_to_mat4(float mat[][4], const float eul[3]) { double ci, cj, ch, si, sj, sh, cc, cs, sc, ss; @@ -850,7 +849,7 @@ void eul_to_mat4(float mat[][4], float *eul) /* returns two euler calculation methods, so we can pick the best */ /* XYZ order */ -static void mat3_to_eul2(float tmat[][3], float *eul1, float *eul2) +static void mat3_to_eul2(float tmat[][3], float eul1[3], float eul2[3]) { float cy, quat[4], mat[3][3]; @@ -907,7 +906,7 @@ void mat4_to_eul(float *eul,float tmat[][4]) } /* XYZ order */ -void quat_to_eul(float *eul,float *quat) +void quat_to_eul(float *eul, const float quat[4]) { float mat[3][3]; @@ -916,7 +915,7 @@ void quat_to_eul(float *eul,float *quat) } /* XYZ order */ -void eul_to_quat(float *quat,float *eul) +void eul_to_quat(float *quat, const float eul[3]) { float ti, tj, th, ci, cj, ch, si, sj, sh, cc, cs, sc, ss; @@ -932,7 +931,7 @@ void eul_to_quat(float *quat,float *eul) } /* XYZ order */ -void rotate_eul(float *beul, char axis, float ang) +void rotate_eul(float *beul, const char axis, const float ang) { float eul[3], mat1[3][3], mat2[3][3], totmat[3][3]; @@ -952,7 +951,7 @@ void rotate_eul(float *beul, char axis, float ang) /* exported to transform.c */ /* order independent! */ -void compatible_eul(float *eul, float *oldrot) +void compatible_eul(float eul[3], const float oldrot[3]) { float dx, dy, dz; @@ -1016,7 +1015,7 @@ void compatible_eul(float *eul, float *oldrot) /* uses 2 methods to retrieve eulers, and picks the closest */ /* XYZ order */ -void mat3_to_compatible_eul(float *eul, float *oldrot,float mat[][3]) +void mat3_to_compatible_eul(float eul[3], const float oldrot[3], float mat[][3]) { float eul1[3], eul2[3]; float d1, d2; @@ -1076,17 +1075,17 @@ static RotOrderInfo rotOrders[]= { #define GET_ROTATIONORDER_INFO(order) (((order)>=1) ? &rotOrders[(order)-1] : &rotOrders[0]) /* Construct quaternion from Euler angles (in radians). */ -void eulO_to_quat(float q[4],float e[3], short order) +void eulO_to_quat(float q[4], const float e[3], const short order) { RotOrderInfo *R= GET_ROTATIONORDER_INFO(order); short i=R->axis[0], j=R->axis[1], k=R->axis[2]; double ti, tj, th, ci, cj, ch, si, sj, sh, cc, cs, sc, ss; double a[3]; - ti = e[i]/2; tj = e[j]/2; th = e[k]/2; - - if (R->parity) e[j] = -e[j]; - + ti = e[i] * 0.5f; + tj = e[j] * (R->parity ? -0.5f : 0.5f); + th = e[k] * 0.5f; + ci = cos(ti); cj = cos(tj); ch = cos(th); si = sin(ti); sj = sin(tj); sh = sin(th); @@ -1102,11 +1101,11 @@ void eulO_to_quat(float q[4],float e[3], short order) q[2] = a[1]; q[3] = a[2]; - if (R->parity) q[j] = -q[j]; + if (R->parity) q[j+1] = -q[j+1]; } /* Convert quaternion to Euler angles (in radians). */ -void quat_to_eulO(float e[3], short order,float q[4]) +void quat_to_eulO(float e[3], short const order, const float q[4]) { float M[3][3]; @@ -1115,7 +1114,7 @@ void quat_to_eulO(float e[3], short order,float q[4]) } /* Construct 3x3 matrix from Euler angles (in radians). */ -void eulO_to_mat3(float M[3][3],float e[3], short order) +void eulO_to_mat3(float M[3][3], const float e[3], const short order) { RotOrderInfo *R= GET_ROTATIONORDER_INFO(order); short i=R->axis[0], j=R->axis[1], k=R->axis[2]; @@ -1140,7 +1139,7 @@ void eulO_to_mat3(float M[3][3],float e[3], short order) } /* Construct 4x4 matrix from Euler angles (in radians). */ -void eulO_to_mat4(float M[4][4],float e[3], short order) +void eulO_to_mat4(float M[4][4], const float e[3], const short order) { float m[3][3]; @@ -1176,7 +1175,7 @@ void mat3_to_eulO(float e[3], short order,float M[3][3]) } /* Convert 4x4 matrix to Euler angles (in radians). */ -void mat4_to_eulO(float e[3], short order,float M[4][4]) +void mat4_to_eulO(float e[3], const short order,float M[4][4]) { float m[3][3]; @@ -1281,7 +1280,7 @@ void rotate_eulO(float beul[3], short order, char axis, float ang) } /* the matrix is written to as 3 axis vectors */ -void eulO_to_gimbal_axis(float gmat[][3], float *eul, short order) +void eulO_to_gimbal_axis(float gmat[][3], const float eul[3], const short order) { RotOrderInfo *R= GET_ROTATIONORDER_INFO(order); @@ -1394,7 +1393,7 @@ void mat4_to_dquat(DualQuat *dq,float basemat[][4], float mat[][4]) dq->trans[3]= 0.5f*(t[0]*q[2] - t[1]*q[1] + t[2]*q[0]); } -void dquat_to_mat4(float mat[][4],DualQuat *dq) +void dquat_to_mat4(float mat[][4], DualQuat *dq) { float len, *t, q0[4]; diff --git a/source/blender/blenlib/intern/math_vector.c b/source/blender/blenlib/intern/math_vector.c index e3cb5b37470..35476a8aba9 100644 --- a/source/blender/blenlib/intern/math_vector.c +++ b/source/blender/blenlib/intern/math_vector.c @@ -354,3 +354,43 @@ void minmax_v3v3_v3(float min[3], float max[3], const float vec[3]) if(max[2]<vec[2]) max[2]= vec[2]; } + +/***************************** Array Functions *******************************/ + +void range_vni(int *array_tar, const int size, const int start) +{ + int *array_pt= array_tar + (size-1); + int j= start + (size-1); + int i= size; + while(i--) { *(array_pt--) = j--; } +} + +void mul_vn_fl(float *array_tar, const int size, const float f) +{ + float *array_pt= array_tar + (size-1); + int i= size; + while(i--) { *(array_pt--) *= f; } +} + +void mul_vn_vn_fl(float *array_tar, const float *array_src, const int size, const float f) +{ + float *tar= array_tar + (size-1); + const float *src= array_src + (size-1); + int i= size; + while(i--) { *(tar--) = *(src--) * f; } +} + +void add_vn_vn(float *array_tar, const float *array_src, const int size) +{ + float *tar= array_tar + (size-1); + const float *src= array_src + (size-1); + int i= size; + while(i--) { *(tar--) += *(src--); } +} + +void fill_vni(int *array_tar, const int size, const int val) +{ + int *tar= array_tar + (size-1); + int i= size; + while(i--) { *(tar--) = val; } +} diff --git a/source/blender/blenloader/CMakeLists.txt b/source/blender/blenloader/CMakeLists.txt index cc70d3355f2..144b1d1b1a1 100644 --- a/source/blender/blenloader/CMakeLists.txt +++ b/source/blender/blenloader/CMakeLists.txt @@ -24,8 +24,6 @@ # # ***** END GPL LICENSE BLOCK ***** -FILE(GLOB SRC intern/*.c) - SET(INC . ../blenlib @@ -39,4 +37,11 @@ SET(INC ${ZLIB_INC} ) +SET(SRC + intern/readblenentry.c + intern/readfile.c + intern/undofile.c + intern/writefile.c +) + BLENDERLIB(bf_blenloader "${SRC}" "${INC}") diff --git a/source/blender/blenloader/SConscript b/source/blender/blenloader/SConscript index 88d345290e5..bab08c89b57 100644 --- a/source/blender/blenloader/SConscript +++ b/source/blender/blenloader/SConscript @@ -11,4 +11,7 @@ incs += ' ' + env['BF_ZLIB_INC'] defs = [] -env.BlenderLib ( 'bf_blenloader', sources, Split(incs), defs, libtype=['core','player'], priority = [167,30] ) +if env['OURPLATFORM'] in ('win32-vc', 'win64-vc'): + env.BlenderLib ( 'bf_blenloader', sources, Split(incs), defs, libtype=['core','player'], priority = [167,30], cc_compileflags=['/WX'] ) +else: + env.BlenderLib ( 'bf_blenloader', sources, Split(incs), defs, libtype=['core','player'], priority = [167,30] ) diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index 04304339385..cb39fc0ad37 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -832,8 +832,8 @@ static int fd_read_gzip_from_file(FileData *filedata, void *buffer, unsigned int static int fd_read_from_memory(FileData *filedata, void *buffer, unsigned int size) { - // don't read more bytes then there are available in the buffer - int readsize = MIN2(size, filedata->buffersize - filedata->seek); + // don't read more bytes then there are available in the buffer + int readsize = (int)MIN2(size, (unsigned int)(filedata->buffersize - filedata->seek)); memcpy(buffer, filedata->buffer + filedata->seek, readsize); filedata->seek += readsize; @@ -3142,6 +3142,7 @@ static void direct_link_particlesystems(FileData *fd, ListBase *particles) psys->childcachebufs.first = psys->childcachebufs.last = NULL; psys->frand = NULL; psys->pdd = NULL; + psys->renderdata = NULL; direct_link_pointcache_list(fd, &psys->ptcaches, &psys->pointcache); @@ -3252,10 +3253,21 @@ static void direct_link_mdisps(FileData *fd, int count, MDisps *mdisps, int exte for(i = 0; i < count; ++i) { mdisps[i].disps = newdataadr(fd, mdisps[i].disps); + + if( (fd->flags & FD_FLAGS_SWITCH_ENDIAN) && (mdisps[i].disps) ) { + /* DNA_struct_switch_endian doesn't do endian swap for (*disps)[] */ + /* this does swap for data written at write_mdisps() - readfile.c */ + int x; + float *tmpdisps= *mdisps[i].disps; + for(x=0;x<mdisps[i].totdisp*3;x++) { + SWITCH_INT(*tmpdisps); + tmpdisps++; + } + } if(!external && !mdisps[i].disps) mdisps[i].totdisp = 0; } - } + } } static void direct_link_customdata(FileData *fd, CustomData *data, int count) @@ -6653,23 +6665,23 @@ static void do_version_constraints_radians_degrees_250(ListBase *lb) for (con=lb->first; con; con=con->next) { if(con->type==CONSTRAINT_TYPE_RIGIDBODYJOINT) { bRigidBodyJointConstraint *data = con->data; - data->axX *= M_PI/180.0; - data->axY *= M_PI/180.0; - data->axZ *= M_PI/180.0; + data->axX *= (float)(M_PI/180.0); + data->axY *= (float)(M_PI/180.0); + data->axZ *= (float)(M_PI/180.0); } else if(con->type==CONSTRAINT_TYPE_KINEMATIC) { bKinematicConstraint *data = con->data; - data->poleangle *= M_PI/180.0; + data->poleangle *= (float)(M_PI/180.0); } else if(con->type==CONSTRAINT_TYPE_ROTLIMIT) { bRotLimitConstraint *data = con->data; - data->xmin *= M_PI/180.0; - data->xmax *= M_PI/180.0; - data->ymin *= M_PI/180.0; - data->ymax *= M_PI/180.0; - data->zmin *= M_PI/180.0; - data->zmax *= M_PI/180.0; + data->xmin *= (float)(M_PI/180.0); + data->xmax *= (float)(M_PI/180.0); + data->ymin *= (float)(M_PI/180.0); + data->ymax *= (float)(M_PI/180.0); + data->zmin *= (float)(M_PI/180.0); + data->zmax *= (float)(M_PI/180.0); } } } @@ -7406,8 +7418,8 @@ static void do_versions(FileData *fd, Library *lib, Main *main) Object *ob; for (vf= main->vfont.first; vf; vf= vf->id.next) { - if (BLI_streq(vf->name+strlen(vf->name)-6, ".Bfont")) { - strcpy(vf->name, "<builtin>"); + if (strcmp(vf->name+strlen(vf->name)-6, ".Bfont")==0) { + strcpy(vf->name, FO_BUILTIN_NAME); } } @@ -9694,7 +9706,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main) /* Adjustments needed after Bullets update */ for(ob = main->object.first; ob; ob= ob->id.next) { ob->damping *= 0.635f; - ob->rdamping = 0.1 + (0.8f * ob->rdamping); + ob->rdamping = 0.1f + (0.8f * ob->rdamping); } } @@ -9774,8 +9786,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main) seq->strip->proxy->size = sce->r.size; } else { - seq->strip->proxy->size - = 25.0; + seq->strip->proxy->size = 25; } seq->strip->proxy->quality =90; } @@ -10225,14 +10236,14 @@ static void do_versions(FileData *fd, Library *lib, Main *main) for(sce= main->scene.first; sce; sce= sce->id.next) { - if(sce->audio.main == 0.0) - sce->audio.main = 1.0; + if(sce->audio.main == 0.0f) + sce->audio.main = 1.0f; sce->r.ffcodecdata.audio_mixrate = sce->audio.mixrate; sce->r.ffcodecdata.audio_volume = sce->audio.main; - sce->audio.distance_model = 2.0; - sce->audio.doppler_factor = 1.0; - sce->audio.speed_of_sound = 343.3; + sce->audio.distance_model = 2; + sce->audio.doppler_factor = 1.0f; + sce->audio.speed_of_sound = 343.3f; } /* Add default gravity to scenes */ @@ -10258,11 +10269,11 @@ static void do_versions(FileData *fd, Library *lib, Main *main) for(md= ob->modifiers.first; md; md= md->next) { ClothModifierData *clmd = (ClothModifierData *)modifiers_findByType(ob, eModifierType_Cloth); if(clmd) - clmd->sim_parms->effector_weights->global_gravity = clmd->sim_parms->gravity[2]/-9.81; + clmd->sim_parms->effector_weights->global_gravity = clmd->sim_parms->gravity[2]/-9.81f; } if(ob->soft) - ob->soft->effector_weights->global_gravity = ob->soft->grav/9.81; + ob->soft->effector_weights->global_gravity = ob->soft->grav/9.81f; } /* Normal wind shape is plane */ @@ -10647,7 +10658,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main) /* game engine changes */ for(sce = main->scene.first; sce; sce = sce->id.next) { - sce->gm.eyeseparation = 0.10; + sce->gm.eyeseparation = 0.10f; } /* anim viz changes */ @@ -10752,12 +10763,12 @@ static void do_versions(FileData *fd, Library *lib, Main *main) if (ob->pose) { for (pchan=ob->pose->chanbase.first; pchan; pchan=pchan->next) { - pchan->limitmin[0] *= M_PI/180.0; - pchan->limitmin[1] *= M_PI/180.0; - pchan->limitmin[2] *= M_PI/180.0; - pchan->limitmax[0] *= M_PI/180.0; - pchan->limitmax[1] *= M_PI/180.0; - pchan->limitmax[2] *= M_PI/180.0; + pchan->limitmin[0] *= (float)(M_PI/180.0); + pchan->limitmin[1] *= (float)(M_PI/180.0); + pchan->limitmin[2] *= (float)(M_PI/180.0); + pchan->limitmax[0] *= (float)(M_PI/180.0); + pchan->limitmax[1] *= (float)(M_PI/180.0); + pchan->limitmax[2] *= (float)(M_PI/180.0); do_version_constraints_radians_degrees_250(&pchan->constraints); } @@ -10856,7 +10867,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main) int a; for(a=0; a<PE_TOT_BRUSH; a++) - pset->brush[a].strength /= 100.0; + pset->brush[a].strength /= 100.0f; } for(ma = main->mat.first; ma; ma=ma->id.next) @@ -11137,7 +11148,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main) // bad radius if (brush->unprojected_radius == 0) - brush->unprojected_radius = 0.125; + brush->unprojected_radius = 0.125f; // unusable size if (brush->size == 0) @@ -11179,18 +11190,18 @@ static void do_versions(FileData *fd, Library *lib, Main *main) brush->add_col[1] == 0 && brush->add_col[2] == 0) { - brush->add_col[0] = 1.00; - brush->add_col[1] = 0.39; - brush->add_col[2] = 0.39; + brush->add_col[0] = 1.00f; + brush->add_col[1] = 0.39f; + brush->add_col[2] = 0.39f; } if (brush->sub_col[0] == 0 && brush->sub_col[1] == 0 && brush->sub_col[2] == 0) { - brush->sub_col[0] = 0.39; - brush->sub_col[1] = 0.39; - brush->sub_col[2] = 1.00; + brush->sub_col[0] = 0.39f; + brush->sub_col[1] = 0.39f; + brush->sub_col[2] = 1.00f; } } } diff --git a/source/blender/blenpluginapi/CMakeLists.txt b/source/blender/blenpluginapi/CMakeLists.txt index 3abf1e44449..41ec5864382 100644 --- a/source/blender/blenpluginapi/CMakeLists.txt +++ b/source/blender/blenpluginapi/CMakeLists.txt @@ -24,8 +24,6 @@ # # ***** END GPL LICENSE BLOCK ***** -FILE(GLOB SRC intern/*.c) - SET(INC . .. @@ -35,6 +33,10 @@ SET(INC ../../../intern/guardedalloc ) +SET(SRC + intern/pluginapi.c +) + IF(WIN32) LIST(APPEND INC ${PTHREADS_INC}) ENDIF(WIN32) diff --git a/source/blender/collada/CMakeLists.txt b/source/blender/collada/CMakeLists.txt index a72ecc4be6c..bcc407b6b68 100644 --- a/source/blender/collada/CMakeLists.txt +++ b/source/blender/collada/CMakeLists.txt @@ -24,43 +24,55 @@ # # ***** END GPL LICENSE BLOCK ***** -FILE(GLOB SRC *.cpp) - -IF(APPLE) SET(INC - . - ../blenlib - ../blenkernel - ../windowmanager - ../makesdna - ../makesrna - ../editors/include - ../../../intern/guardedalloc - ${OPENCOLLADA_INC}/COLLADAStreamWriter - ${OPENCOLLADA_INC}/COLLADABaseUtils - ${OPENCOLLADA_INC}/COLLADAFramework - ${OPENCOLLADA_INC}/COLLADASaxFrameworkLoader + . + ../blenlib + ../blenkernel + ../windowmanager + ../makesdna + ../makesrna + ../editors/include + ../../../intern/guardedalloc ) +IF(APPLE) + LIST(APPEND INC + ${OPENCOLLADA_INC}/COLLADAStreamWriter + ${OPENCOLLADA_INC}/COLLADABaseUtils + ${OPENCOLLADA_INC}/COLLADAFramework + ${OPENCOLLADA_INC}/COLLADASaxFrameworkLoader + ) ELSE(APPLE) + LIST(APPEND INC + ${OPENCOLLADA_INC}/COLLADAStreamWriter/include + ${OPENCOLLADA_INC}/COLLADABaseUtils/include + ${OPENCOLLADA_INC}/COLLADAFramework/include + ${OPENCOLLADA_INC}/COLLADASaxFrameworkLoader/include + ) +ENDIF(APPLE) -SET(INC - . - ../blenlib - ../blenkernel - ../windowmanager - ../makesdna - ../makesrna - ../editors/include - ../../../intern/guardedalloc - ${OPENCOLLADA_INC}/COLLADAStreamWriter/include - ${OPENCOLLADA_INC}/COLLADABaseUtils/include - ${OPENCOLLADA_INC}/COLLADAFramework/include - ${OPENCOLLADA_INC}/COLLADASaxFrameworkLoader/include +SET(SRC + AnimationImporter.cpp + ArmatureExporter.cpp + ArmatureImporter.cpp + CameraExporter.cpp + DocumentExporter.cpp + DocumentImporter.cpp + EffectExporter.cpp + GeometryExporter.cpp + ImageExporter.cpp + InstanceWriter.cpp + LightExporter.cpp + MaterialExporter.cpp + MeshImporter.cpp + SkinInfo.cpp + TransformReader.cpp + TransformWriter.cpp + collada.cpp + collada_internal.cpp + collada_utils.cpp ) -ENDIF(APPLE) - IF(WITH_BUILDINFO) ADD_DEFINITIONS(-DNAN_BUILDINFO) ENDIF(WITH_BUILDINFO) diff --git a/source/blender/collada/MaterialExporter.cpp b/source/blender/collada/MaterialExporter.cpp index d155b2196ff..dfb64e383a7 100644 --- a/source/blender/collada/MaterialExporter.cpp +++ b/source/blender/collada/MaterialExporter.cpp @@ -23,9 +23,9 @@ * ***** END GPL LICENSE BLOCK ***** */ -#include "COLLADABUUtils.h" #include "MaterialExporter.h" +#include "COLLADABUUtils.h" #include "collada_internal.h" MaterialsExporter::MaterialsExporter(COLLADASW::StreamWriter *sw): COLLADASW::LibraryMaterials(sw){} diff --git a/source/blender/editors/animation/CMakeLists.txt b/source/blender/editors/animation/CMakeLists.txt index d5eef6bbd34..7954e2c8313 100644 --- a/source/blender/editors/animation/CMakeLists.txt +++ b/source/blender/editors/animation/CMakeLists.txt @@ -19,8 +19,6 @@ # # ***** END GPL LICENSE BLOCK ***** -FILE(GLOB SRC *.c) - SET(INC ../include ../../blenkernel @@ -31,4 +29,22 @@ SET(INC ../../../../intern/guardedalloc ) +SET(SRC + anim_channels_defines.c + anim_channels_edit.c + anim_deps.c + anim_draw.c + anim_filter.c + anim_ipo_utils.c + anim_markers.c + anim_ops.c + drivers.c + fmodifier_ui.c + keyframes_draw.c + keyframes_edit.c + keyframes_general.c + keyframing.c + keyingsets.c +) + BLENDERLIB(bf_editor_animation "${SRC}" "${INC}") diff --git a/source/blender/editors/armature/CMakeLists.txt b/source/blender/editors/armature/CMakeLists.txt index b5634921343..62b76655010 100644 --- a/source/blender/editors/armature/CMakeLists.txt +++ b/source/blender/editors/armature/CMakeLists.txt @@ -19,8 +19,6 @@ # # ***** END GPL LICENSE BLOCK ***** -FILE(GLOB SRC *.c) - SET(INC ../include ../../blenkernel @@ -32,6 +30,20 @@ SET(INC ../../../../intern/opennl/extern ) +SET(SRC + armature_ops.c + editarmature.c + editarmature_generate.c + editarmature_retarget.c + editarmature_sketch.c + meshlaplacian.c + poseSlide.c + poseUtils.c + poselib.c + poseobject.c + reeb.c +) + IF(WIN32) LIST(APPEND INC ${PTHREADS_INC}) ENDIF(WIN32) diff --git a/source/blender/editors/curve/CMakeLists.txt b/source/blender/editors/curve/CMakeLists.txt index ab45d73a2de..8e47dc9c264 100644 --- a/source/blender/editors/curve/CMakeLists.txt +++ b/source/blender/editors/curve/CMakeLists.txt @@ -19,8 +19,6 @@ # # ***** END GPL LICENSE BLOCK ***** -FILE(GLOB SRC *.c) - SET(INC ../include ../../blenkernel @@ -31,4 +29,11 @@ SET(INC ../../../../intern/guardedalloc ) +SET(SRC + curve_ops.c + editcurve.c + editfont.c + lorem.c +) + BLENDERLIB(bf_editor_curve "${SRC}" "${INC}") diff --git a/source/blender/editors/curve/editfont.c b/source/blender/editors/curve/editfont.c index 44a664b5f30..13678b0dfe5 100644 --- a/source/blender/editors/curve/editfont.c +++ b/source/blender/editors/curve/editfont.c @@ -1696,7 +1696,8 @@ static int open_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) cu = ob->data; font = cu->vfont; } - path = (font && font->name)? font->name: U.fontdir; + printf("%s\n", font->name); + path = (font && strcmp(font->name, FO_BUILTIN_NAME) != 0)? font->name: U.fontdir; if(RNA_property_is_set(op->ptr, "filepath")) return open_exec(C, op); @@ -1737,7 +1738,7 @@ static int font_unlink_poll(bContext *C) if (ob->type != OB_FONT) return 0; cu = ob->data; - if (cu && strcmp(cu->vfont->name, "<builtin>")==0) return 0; + if (cu && strcmp(cu->vfont->name, FO_BUILTIN_NAME)==0) return 0; return 1; } @@ -1755,7 +1756,7 @@ static int font_unlink_exec(bContext *C, wmOperator *op) return OPERATOR_CANCELLED; } - if (strcmp(font->name, "<builtin>")==0) { + if (strcmp(font->name, FO_BUILTIN_NAME)==0) { BKE_report(op->reports, RPT_WARNING, "Can't unlink the default builtin font."); return OPERATOR_FINISHED; } diff --git a/source/blender/editors/datafiles/CMakeLists.txt b/source/blender/editors/datafiles/CMakeLists.txt index d37ee338733..7683db8ab7a 100644 --- a/source/blender/editors/datafiles/CMakeLists.txt +++ b/source/blender/editors/datafiles/CMakeLists.txt @@ -19,8 +19,45 @@ # # ***** END GPL LICENSE BLOCK ***** -FILE(GLOB SRC *.c) - SET(INC "") +SET(SRC + Bfont.c + add.png.c + bfont.ttf.c + blenderbuttons.c + blob.png.c + blur.png.c + bmonofont.ttf.c + clay.png.c + clone.png.c + crease.png.c + darken.png.c + draw.png.c + fill.png.c + flatten.png.c + grab.png.c + inflate.png.c + layer.png.c + lighten.png.c + mix.png.c + multiply.png.c + nudge.png.c + pinch.png.c + preview.blend.c + prvicons.c + scrape.png.c + smear.png.c + smooth.png.c + snake_hook.png.c + soften.png.c + splash.png.c + startup.blend.c + subtract.png.c + texdraw.png.c + thumb.png.c + twist.png.c + vertexdraw.png.c +) + BLENDERLIB(bf_editor_datafiles "${SRC}" "${INC}") diff --git a/source/blender/editors/gpencil/CMakeLists.txt b/source/blender/editors/gpencil/CMakeLists.txt index 394418b5688..ab92f0a9b41 100644 --- a/source/blender/editors/gpencil/CMakeLists.txt +++ b/source/blender/editors/gpencil/CMakeLists.txt @@ -19,8 +19,6 @@ # # ***** END GPL LICENSE BLOCK ***** -FILE(GLOB SRC *.c) - SET(INC ../include ../../blenkernel @@ -32,4 +30,13 @@ SET(INC ../../../../intern/guardedalloc ) +SET(SRC + drawgpencil.c + editaction_gpencil.c + gpencil_buttons.c + gpencil_edit.c + gpencil_ops.c + gpencil_paint.c +) + BLENDERLIB(bf_editor_gpencil "${SRC}" "${INC}") diff --git a/source/blender/editors/include/ED_image.h b/source/blender/editors/include/ED_image.h index 1d674112b8d..c5f0983f494 100644 --- a/source/blender/editors/include/ED_image.h +++ b/source/blender/editors/include/ED_image.h @@ -32,7 +32,9 @@ struct SpaceImage; struct bContext; struct Image; struct ImageUser; +struct ToolSettings; struct uiBlock; +struct wmWindowManager; /* space_image.c, exported for transform */ struct Image *ED_space_image(struct SpaceImage *sima); @@ -47,6 +49,8 @@ void ED_space_image_aspect(struct SpaceImage *sima, float *aspx, float *aspy); void ED_space_image_zoom(struct SpaceImage *sima, struct ARegion *ar, float *zoomx, float *zoomy); void ED_space_image_uv_aspect(struct SpaceImage *sima, float *aspx, float *aspy); +void ED_space_image_paint_update(struct wmWindowManager *wm, struct ToolSettings *settings); + void ED_image_size(struct Image *ima, int *width, int *height); void ED_image_aspect(struct Image *ima, float *aspx, float *aspy); void ED_image_uv_aspect(struct Image *ima, float *aspx, float *aspy); diff --git a/source/blender/editors/include/ED_screen.h b/source/blender/editors/include/ED_screen.h index 62243a0e53e..8b8bb75b8e6 100644 --- a/source/blender/editors/include/ED_screen.h +++ b/source/blender/editors/include/ED_screen.h @@ -78,6 +78,7 @@ void ED_area_exit(struct bContext *C, struct ScrArea *sa); int ED_screen_area_active(const struct bContext *C); void ED_area_do_listen(ScrArea *sa, struct wmNotifier *note); void ED_area_tag_redraw(ScrArea *sa); +void ED_area_tag_redraw_regiontype(ScrArea *sa, int type); void ED_area_tag_refresh(ScrArea *sa); void ED_area_do_refresh(struct bContext *C, ScrArea *sa); void ED_area_headerprint(ScrArea *sa, char *str); diff --git a/source/blender/editors/include/ED_view3d.h b/source/blender/editors/include/ED_view3d.h index f5a84aa4c19..fe024be29e0 100644 --- a/source/blender/editors/include/ED_view3d.h +++ b/source/blender/editors/include/ED_view3d.h @@ -63,6 +63,7 @@ typedef struct ViewContext { typedef struct ViewDepths { unsigned short w, h; + short x, y; /* only for temp use for sub-rects, added to ar->winx/y */ float *depths; double depth_range[2]; diff --git a/source/blender/editors/interface/CMakeLists.txt b/source/blender/editors/interface/CMakeLists.txt index 4b4590aeee5..31de4537c24 100644 --- a/source/blender/editors/interface/CMakeLists.txt +++ b/source/blender/editors/interface/CMakeLists.txt @@ -19,8 +19,6 @@ # # ***** END GPL LICENSE BLOCK ***** -FILE(GLOB SRC *.c) - SET(INC ../include ../../blenfont @@ -35,6 +33,25 @@ SET(INC ../../../../intern/guardedalloc ) +SET(SRC + interface.c + interface_anim.c + interface_draw.c + interface_handlers.c + interface_icons.c + interface_layout.c + interface_ops.c + interface_panel.c + interface_regions.c + interface_style.c + interface_templates.c + interface_utils.c + interface_widgets.c + resources.c + view2d.c + view2d_ops.c +) + IF(WITH_INTERNATIONAL) ADD_DEFINITIONS(-DINTERNATIONAL) ENDIF(WITH_INTERNATIONAL) diff --git a/source/blender/editors/interface/interface_draw.c b/source/blender/editors/interface/interface_draw.c index 81b04fea062..768be97f930 100644 --- a/source/blender/editors/interface/interface_draw.c +++ b/source/blender/editors/interface/interface_draw.c @@ -517,7 +517,7 @@ static void ui_draw_but_CHARTAB(uiBut *but) int charmax = G.charmax; /* <builtin> font in use. There are TTF <builtin> and non-TTF <builtin> fonts */ - if(!strcmp(G.selfont->name, "<builtin>")) + if(!strcmp(G.selfont->name, FO_BUILTIN_NAME)) { if(G.ui_international == TRUE) { @@ -548,8 +548,8 @@ static void ui_draw_but_CHARTAB(uiBut *but) cs = G.charstart; - /* Set the font, in case it is not <builtin> font */ - if(G.selfont && strcmp(G.selfont->name, "<builtin>")) + /* Set the font, in case it is not FO_BUILTIN_NAME font */ + if(G.selfont && strcmp(G.selfont->name, FO_BUILTIN_NAME)) { char tmpStr[256]; @@ -605,9 +605,9 @@ static void ui_draw_but_CHARTAB(uiBut *but) memset(wstr, 0, sizeof(wchar_t)*2); memset(ustr, 0, 16); - // Set the font to be either unicode or <builtin> + // Set the font to be either unicode or FO_BUILTIN_NAME wstr[0] = cs; - if(strcmp(G.selfont->name, "<builtin>")) + if(strcmp(G.selfont->name, FO_BUILTIN_NAME)) { wcs2utf8s((char *)ustr, (wchar_t *)wstr); } @@ -624,7 +624,7 @@ static void ui_draw_but_CHARTAB(uiBut *but) } } - if((G.selfont && strcmp(G.selfont->name, "<builtin>")) || (G.selfont && !strcmp(G.selfont->name, "<builtin>") && G.ui_international == TRUE)) + if((G.selfont && strcmp(G.selfont->name, FO_BUILTIN_NAME)) || (G.selfont && !strcmp(G.selfont->name, FO_BUILTIN_NAME) && G.ui_international == TRUE)) { float wid; float llx, lly, llz, urx, ury, urz; diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c index ab8fda85ff2..5dbeb08d45b 100644 --- a/source/blender/editors/interface/interface_handlers.c +++ b/source/blender/editors/interface/interface_handlers.c @@ -4281,7 +4281,12 @@ static int ui_do_button(bContext *C, uiBlock *block, uiBut *but, wmEvent *event) if(but->flag & UI_BUT_DISABLED) return WM_UI_HANDLER_CONTINUE; - if(data->state == BUTTON_STATE_HIGHLIGHT && event->prevval != KM_PRESS) { /* check prevval because of modal operators [#24016] */ + if( (data->state == BUTTON_STATE_HIGHLIGHT) && + /* check prevval because of modal operators [#24016], + * modifier check is to allow Ctrl+C for copy. + * if this causes other problems, remove this check and suffer the bug :) - campbell */ + (event->prevval != KM_PRESS || ISKEYMODIFIER(event->prevtype)) + ) { /* handle copy-paste */ if(ELEM(event->type, CKEY, VKEY) && event->val==KM_PRESS && (event->ctrl || event->oskey)) { ui_but_copy_paste(C, but, data, (event->type == CKEY)? 'c': 'v'); diff --git a/source/blender/editors/interface/resources.c b/source/blender/editors/interface/resources.c index c250cdb1284..b6fa0916443 100644 --- a/source/blender/editors/interface/resources.c +++ b/source/blender/editors/interface/resources.c @@ -956,13 +956,11 @@ void UI_make_axis_color(char *src_col, char *dst_col, char axis) switch(axis) { case 'x': - case 'X': dst_col[0]= src_col[0]>219?255:src_col[0]+36; dst_col[1]= src_col[1]<26?0:src_col[1]-26; dst_col[2]= src_col[2]<26?0:src_col[2]-26; break; case 'y': - case 'Y': dst_col[0]= src_col[0]<46?0:src_col[0]-36; dst_col[1]= src_col[1]>189?255:src_col[1]+66; dst_col[2]= src_col[2]<46?0:src_col[2]-36; diff --git a/source/blender/editors/mesh/CMakeLists.txt b/source/blender/editors/mesh/CMakeLists.txt index 4145f251a64..1e26f273b41 100644 --- a/source/blender/editors/mesh/CMakeLists.txt +++ b/source/blender/editors/mesh/CMakeLists.txt @@ -19,8 +19,6 @@ # # ***** END GPL LICENSE BLOCK ***** -FILE(GLOB SRC *.c) - SET(INC ../include ../../blenkernel @@ -33,6 +31,20 @@ SET(INC ../../../../intern/guardedalloc ) +SET(SRC + editface.c + editmesh.c + editmesh_add.c + editmesh_lib.c + editmesh_loop.c + editmesh_mods.c + editmesh_tools.c + loopcut.c + mesh_data.c + mesh_ops.c + meshtools.c +) + IF(WIN32) LIST(APPEND INC ${PTHREADS_INC}) ENDIF(WIN32) diff --git a/source/blender/editors/mesh/editmesh.c b/source/blender/editors/mesh/editmesh.c index 80df034552d..6665e82af19 100644 --- a/source/blender/editors/mesh/editmesh.c +++ b/source/blender/editors/mesh/editmesh.c @@ -53,6 +53,7 @@ #include "BKE_material.h" #include "BKE_mesh.h" #include "BKE_paint.h" +#include "BKE_report.h" #include "ED_mesh.h" #include "ED_object.h" @@ -1324,7 +1325,7 @@ static EnumPropertyItem prop_separate_types[] = { }; /* return 1: success */ -static int mesh_separate_selected(Main *bmain, Scene *scene, Base *editbase) +static int mesh_separate_selected(wmOperator *op, Main *bmain, Scene *scene, Base *editbase) { EditMesh *em, *emnew; EditVert *eve, *v1; @@ -1340,7 +1341,7 @@ static int mesh_separate_selected(Main *bmain, Scene *scene, Base *editbase) me= obedit->data; em= BKE_mesh_get_editmesh(me); if(me->key) { - error("Can't separate with vertex keys"); + BKE_report(op->reports, RPT_WARNING, "Can't separate mesh with shape keys."); BKE_mesh_end_editmesh(me, em); return 0; } @@ -1435,7 +1436,7 @@ static int mesh_separate_selected(Main *bmain, Scene *scene, Base *editbase) } /* return 1: success */ -static int mesh_separate_material(Main *bmain, Scene *scene, Base *editbase) +static int mesh_separate_material(wmOperator *op, Main *bmain, Scene *scene, Base *editbase) { Mesh *me= editbase->object->data; EditMesh *em= BKE_mesh_get_editmesh(me); @@ -1447,7 +1448,7 @@ static int mesh_separate_material(Main *bmain, Scene *scene, Base *editbase) /* select the material */ EM_select_by_material(em, curr_mat); /* and now separate */ - if(0==mesh_separate_selected(bmain, scene, editbase)) { + if(0==mesh_separate_selected(op, bmain, scene, editbase)) { BKE_mesh_end_editmesh(me, em); return 0; } @@ -1458,7 +1459,7 @@ static int mesh_separate_material(Main *bmain, Scene *scene, Base *editbase) } /* return 1: success */ -static int mesh_separate_loose(Main *bmain, Scene *scene, Base *editbase) +static int mesh_separate_loose(wmOperator *op, Main *bmain, Scene *scene, Base *editbase) { Mesh *me; EditMesh *em; @@ -1498,7 +1499,7 @@ static int mesh_separate_loose(Main *bmain, Scene *scene, Base *editbase) tot= BLI_countlist(&em->verts); /* and now separate */ - doit= mesh_separate_selected(bmain, scene, editbase); + doit= mesh_separate_selected(op, bmain, scene, editbase); /* with hidden verts this can happen */ if(tot == BLI_countlist(&em->verts)) @@ -1518,11 +1519,11 @@ static int mesh_separate_exec(bContext *C, wmOperator *op) int retval= 0, type= RNA_enum_get(op->ptr, "type"); if(type == 0) - retval= mesh_separate_selected(bmain, scene, base); + retval= mesh_separate_selected(op, bmain, scene, base); else if(type == 1) - retval= mesh_separate_material(bmain, scene, base); + retval= mesh_separate_material(op, bmain, scene, base); else if(type == 2) - retval= mesh_separate_loose(bmain, scene, base); + retval= mesh_separate_loose(op, bmain, scene, base); if(retval) { WM_event_add_notifier(C, NC_GEOM|ND_DATA, base->object->data); diff --git a/source/blender/editors/mesh/editmesh_tools.c b/source/blender/editors/mesh/editmesh_tools.c index 66090f14fff..7fbdef7b391 100644 --- a/source/blender/editors/mesh/editmesh_tools.c +++ b/source/blender/editors/mesh/editmesh_tools.c @@ -6769,7 +6769,7 @@ void MESH_OT_subdivide(wmOperatorType *ot) /* properties */ RNA_def_int(ot->srna, "number_cuts", 1, 1, INT_MAX, "Number of Cuts", "", 1, 10); - RNA_def_float(ot->srna, "smoothness", 0.0f, 0.0f, FLT_MAX, "Smoothness", "Smoothness factor.", 0.0f, 1000.0f); + RNA_def_float(ot->srna, "smoothness", 0.0f, 0.0f, FLT_MAX, "Smoothness", "Smoothness factor.", 0.0f, 1.0f); RNA_def_float(ot->srna, "fractal", 0.0, 0.0f, FLT_MAX, "Fractal", "Fractal randomness factor.", 0.0f, 1000.0f); RNA_def_enum(ot->srna, "corner_cut_pattern", corner_type_items, SUBDIV_CORNER_INNERVERT, "Corner Cut Pattern", "Topology pattern to use to fill a face after cutting across its corner"); } diff --git a/source/blender/editors/metaball/CMakeLists.txt b/source/blender/editors/metaball/CMakeLists.txt index 5e821a5c1e8..9b9ca809f25 100644 --- a/source/blender/editors/metaball/CMakeLists.txt +++ b/source/blender/editors/metaball/CMakeLists.txt @@ -19,8 +19,6 @@ # # ***** END GPL LICENSE BLOCK ***** -FILE(GLOB SRC *.c) - SET(INC ../include ../../blenkernel @@ -32,4 +30,9 @@ SET(INC ../../../../intern/guardedalloc ) +SET(SRC + mball_edit.c + mball_ops.c +) + BLENDERLIB(bf_editor_metaball "${SRC}" "${INC}") diff --git a/source/blender/editors/object/CMakeLists.txt b/source/blender/editors/object/CMakeLists.txt index 10fbd62a098..bfcb233e466 100644 --- a/source/blender/editors/object/CMakeLists.txt +++ b/source/blender/editors/object/CMakeLists.txt @@ -19,8 +19,6 @@ # # ***** END GPL LICENSE BLOCK ***** -FILE(GLOB SRC *.c) - SET(INC ../include ../../blenkernel @@ -36,12 +34,29 @@ SET(INC ../../../../intern/guardedalloc ) -IF(NOT WITH_PYTHON) - ADD_DEFINITIONS(-DDISABLE_PYTHON) -ENDIF(NOT WITH_PYTHON) +SET(SRC + object_add.c + object_bake.c + object_constraint.c + object_edit.c + object_group.c + object_hook.c + object_lattice.c + object_modifier.c + object_ops.c + object_relations.c + object_select.c + object_shapekey.c + object_transform.c + object_vgroup.c +) IF(WIN32) LIST(APPEND INC ${PTHREADS_INC}) ENDIF(WIN32) +IF(NOT WITH_PYTHON) + ADD_DEFINITIONS(-DDISABLE_PYTHON) +ENDIF(NOT WITH_PYTHON) + BLENDERLIB(bf_editor_object "${SRC}" "${INC}") diff --git a/source/blender/editors/object/object_constraint.c b/source/blender/editors/object/object_constraint.c index 02c88d4149b..09760a8f51b 100644 --- a/source/blender/editors/object/object_constraint.c +++ b/source/blender/editors/object/object_constraint.c @@ -200,7 +200,10 @@ char *buildmenu_pyconstraints (Text *con_text, int *pyconindex) /* this callback gets called when the 'refresh' button of a pyconstraint gets pressed */ void update_pyconstraint_cb (void *arg1, void *arg2) { -#ifndef DISABLE_PYTHON +#ifdef DISABLE_PYTHON + (void)arg1; /* unused */ + (void)arg2; /* unused */ +#else Object *owner= (Object *)arg1; bConstraint *con= (bConstraint *)arg2; if (owner && con) diff --git a/source/blender/editors/object/object_modifier.c b/source/blender/editors/object/object_modifier.c index c273b375a06..3d36ed9f45e 100644 --- a/source/blender/editors/object/object_modifier.c +++ b/source/blender/editors/object/object_modifier.c @@ -196,6 +196,11 @@ int ED_object_modifier_remove(ReportList *reports, Main *bmain, Scene *scene, Ob CustomData_free_layer_active(&me->fdata, CD_MDISPS, me->totface); } + if(ELEM(md->type, eModifierType_Softbody, eModifierType_Cloth) && + ob->particlesystem.first == NULL) { + ob->mode &= ~OB_MODE_PARTICLE_EDIT; + } + BLI_remlink(&ob->modifiers, md); modifier_free(md); @@ -658,11 +663,18 @@ static int modifier_remove_exec(bContext *C, wmOperator *op) Scene *scene= CTX_data_scene(C); Object *ob = ED_object_active_context(C); ModifierData *md = edit_modifier_property_get(op, ob, 0); + int mode_orig = ob->mode; if(!ob || !md || !ED_object_modifier_remove(op->reports, bmain, scene, ob, md)) return OPERATOR_CANCELLED; WM_event_add_notifier(C, NC_OBJECT|ND_MODIFIER, ob); + + /* if cloth/softbody was removed, particle mode could be cleared */ + if(mode_orig & OB_MODE_PARTICLE_EDIT) + if((ob->mode & OB_MODE_PARTICLE_EDIT)==0) + if(scene->basact && scene->basact->object==ob) + WM_event_add_notifier(C, NC_SCENE|ND_MODE|NS_MODE_OBJECT, NULL); return OPERATOR_FINISHED; } diff --git a/source/blender/editors/object/object_relations.c b/source/blender/editors/object/object_relations.c index 14f88c6d99e..b1c027a2f24 100644 --- a/source/blender/editors/object/object_relations.c +++ b/source/blender/editors/object/object_relations.c @@ -57,6 +57,7 @@ #include "BKE_depsgraph.h" #include "BKE_displist.h" #include "BKE_global.h" +#include "BKE_fcurve.h" #include "BKE_lattice.h" #include "BKE_library.h" #include "BKE_main.h" @@ -82,6 +83,7 @@ #include "ED_armature.h" #include "ED_curve.h" +#include "ED_keyframing.h" #include "ED_object.h" #include "ED_screen.h" #include "ED_view3d.h" @@ -546,6 +548,17 @@ static int parent_set_exec(bContext *C, wmOperator *op) } else cu->flag |= CU_FOLLOW; + /* if follow, add F-Curve for ctime (i.e. "eval_time") so that path-follow works */ + if(partype == PAR_FOLLOW) { + /* get or create F-Curve */ + bAction *act = verify_adt_action(&cu->id, 1); + FCurve *fcu = verify_fcurve(act, NULL, "eval_time", 0, 1); + + /* setup dummy 'generator' modifier here to get 1-1 correspondance still working */ + if (!fcu->bezt && !fcu->fpt && !fcu->modifiers.first) + add_fmodifier(&fcu->modifiers, FMODIFIER_TYPE_GENERATOR); + } + /* fall back on regular parenting now (for follow only) */ if(partype == PAR_FOLLOW) partype= PAR_OBJECT; @@ -668,6 +681,7 @@ static int parent_set_exec(bContext *C, wmOperator *op) DAG_scene_sort(bmain, scene); DAG_ids_flush_update(bmain, 0); WM_event_add_notifier(C, NC_OBJECT|ND_TRANSFORM, NULL); + WM_event_add_notifier(C, NC_OBJECT|ND_PARENT, NULL); return OPERATOR_FINISHED; } diff --git a/source/blender/editors/object/object_select.c b/source/blender/editors/object/object_select.c index a3c65851d3a..29c3ee5c95c 100644 --- a/source/blender/editors/object/object_select.c +++ b/source/blender/editors/object/object_select.c @@ -879,8 +879,11 @@ static int object_select_name_exec(bContext *C, wmOperator *op) short changed = 0; if(!extend) { - CTX_DATA_BEGIN(C, Base*, base, visible_bases) { - ED_base_object_select(base, BA_DESELECT); + CTX_DATA_BEGIN(C, Base*, base, selectable_bases) { + if((base->flag & SELECT) == 0) { + ED_base_object_select(base, BA_DESELECT); + changed= 1; + } } CTX_DATA_END; } diff --git a/source/blender/editors/physics/CMakeLists.txt b/source/blender/editors/physics/CMakeLists.txt index 49f20bb9ed0..481f6d8df44 100644 --- a/source/blender/editors/physics/CMakeLists.txt +++ b/source/blender/editors/physics/CMakeLists.txt @@ -19,8 +19,6 @@ # # ***** END GPL LICENSE BLOCK ***** -FILE(GLOB SRC *.c) - SET(INC ../include ../../blenkernel @@ -32,16 +30,25 @@ SET(INC ../../../../intern/guardedalloc ) -IF(NOT WITH_FLUID) +SET(SRC + particle_boids.c + particle_edit.c + particle_object.c + physics_fluid.c + physics_ops.c + physics_pointcache.c +) + +IF(WIN32) + LIST(APPEND INC ${PTHREADS_INC}) +ENDIF(WIN32) + +IF(NOT WITH_MOD_FLUID) ADD_DEFINITIONS(-DDISABLE_ELBEEM) -ENDIF(NOT WITH_FLUID) +ENDIF(NOT WITH_MOD_FLUID) IF(WITH_OPENMP) ADD_DEFINITIONS(-DPARALLEL=1) ENDIF(WITH_OPENMP) -IF(WIN32) - LIST(APPEND INC ${PTHREADS_INC}) -ENDIF(WIN32) - BLENDERLIB(bf_editor_physics "${SRC}" "${INC}") diff --git a/source/blender/editors/render/CMakeLists.txt b/source/blender/editors/render/CMakeLists.txt index 9a03d12509d..d952d19bc00 100644 --- a/source/blender/editors/render/CMakeLists.txt +++ b/source/blender/editors/render/CMakeLists.txt @@ -19,8 +19,6 @@ # # ***** END GPL LICENSE BLOCK ***** -FILE(GLOB SRC *.c) - SET(INC ../include ../../blenfont @@ -38,6 +36,14 @@ SET(INC ../../freestyle ) +SET(SRC + render_internal.c + render_opengl.c + render_ops.c + render_preview.c + render_shading.c +) + IF(WITH_QUICKTIME) LIST(APPEND INC ../../quicktime ${QUICKTIME_INC}) ADD_DEFINITIONS(-DWITH_QUICKTIME) diff --git a/source/blender/editors/render/render_internal.c b/source/blender/editors/render/render_internal.c index 7f34e6fa333..77fa51aa7b1 100644 --- a/source/blender/editors/render/render_internal.c +++ b/source/blender/editors/render/render_internal.c @@ -401,7 +401,7 @@ static int screen_render_exec(bContext *C, wmOperator *op) Image *ima; View3D *v3d= CTX_wm_view3d(C); Main *mainp= CTX_data_main(C); - int lay= (v3d)? v3d->lay: scene->lay; + unsigned int lay= (v3d)? v3d->lay: scene->lay; if(re==NULL) { re= RE_NewRender(scene->id.name); diff --git a/source/blender/editors/render/render_opengl.c b/source/blender/editors/render/render_opengl.c index 825a6fc7043..ef56a596855 100644 --- a/source/blender/editors/render/render_opengl.c +++ b/source/blender/editors/render/render_opengl.c @@ -157,8 +157,7 @@ static void screen_opengl_render_apply(OGLRender *oglrender) float winmat_jitter[4][4]; float *accum_buffer= MEM_mallocN(sizex * sizey * sizeof(float) * 4, "accum1"); float *accum_tmp= MEM_mallocN(sizex * sizey * sizeof(float) * 4, "accum2"); - int j, i; - float *from, *to; + int j; /* first sample buffer, also initializes 'rv3d->persmat' */ ED_view3d_draw_offscreen(scene, v3d, ar, sizex, sizey, NULL, winmat); @@ -171,19 +170,11 @@ static void screen_opengl_render_apply(OGLRender *oglrender) ED_view3d_draw_offscreen(scene, v3d, ar, sizex, sizey, NULL, winmat_jitter); glReadPixels(0, 0, sizex, sizey, GL_RGBA, GL_FLOAT, accum_tmp); - - i= (sizex*sizey * 4) - 1; - from= accum_tmp; - to= accum_buffer; - do {*to++ += *from++; } while (i--); + add_vn_vn(accum_buffer, accum_tmp, sizex*sizey*sizeof(float)); } - from= accum_buffer; - to= rr->rectf; + mul_vn_vn_fl(rr->rectf, accum_buffer, sizex*sizey*sizeof(float), 1.0/SAMPLES); - i= (sizex * sizey * 4) - 1; - do { *to++= *from++ * (1.0/SAMPLES); } while (i--); - MEM_freeN(accum_buffer); MEM_freeN(accum_tmp); } diff --git a/source/blender/editors/screen/CMakeLists.txt b/source/blender/editors/screen/CMakeLists.txt index f7dfd81dba9..4ea056ac400 100644 --- a/source/blender/editors/screen/CMakeLists.txt +++ b/source/blender/editors/screen/CMakeLists.txt @@ -19,8 +19,6 @@ # # ***** END GPL LICENSE BLOCK ***** -FILE(GLOB SRC *.c) - SET(INC ../include ../../blenfont @@ -33,6 +31,15 @@ SET(INC ../../../../intern/guardedalloc ) +SET(SRC + area.c + glutil.c + screen_context.c + screen_edit.c + screen_ops.c + screendump.c +) + IF(WIN32) LIST(APPEND INC ${PTHREADS_INC}) ENDIF(WIN32) diff --git a/source/blender/editors/screen/area.c b/source/blender/editors/screen/area.c index ae1388fb7f2..7838fbdd5f4 100644 --- a/source/blender/editors/screen/area.c +++ b/source/blender/editors/screen/area.c @@ -405,6 +405,19 @@ void ED_area_tag_redraw(ScrArea *sa) ED_region_tag_redraw(ar); } +void ED_area_tag_redraw_regiontype(ScrArea *sa, int regiontype) +{ + ARegion *ar; + + if(sa) { + for(ar= sa->regionbase.first; ar; ar= ar->next) { + if(ar->regiontype == regiontype) { + ED_region_tag_redraw(ar); + } + } + } +} + void ED_area_tag_refresh(ScrArea *sa) { if(sa) diff --git a/source/blender/editors/screen/screen_context.c b/source/blender/editors/screen/screen_context.c index b619398d985..08cc8ebaa2f 100644 --- a/source/blender/editors/screen/screen_context.c +++ b/source/blender/editors/screen/screen_context.c @@ -48,6 +48,7 @@ int ed_screen_context(const bContext *C, const char *member, bContextDataResult bScreen *sc= CTX_wm_screen(C); Scene *scene= sc->scene; Base *base; + unsigned int lay = scene->lay; #if 0 /* Using the context breaks adding objects in the UI. Need to find out why - campbell */ Object *obact= CTX_data_active_object(C); @@ -61,7 +62,8 @@ int ed_screen_context(const bContext *C, const char *member, bContextDataResult if(CTX_data_dir(member)) { static const char *dir[] = { - "scene", "visible_objects", "visible_bases", "selected_objects", "selected_bases", + "scene", "visible_objects", "visible_bases", "selectable_objects", "selectable_bases", + "selected_objects", "selected_bases", "selected_editable_objects", "selected_editable_bases", "visible_bones", "editable_bones", "selected_bones", "selected_editable_bones", "visible_pose_bones", "selected_pose_bones", "active_bone", "active_pose_bone", @@ -92,6 +94,22 @@ int ed_screen_context(const bContext *C, const char *member, bContextDataResult CTX_data_type_set(result, CTX_DATA_TYPE_COLLECTION); return 1; } + else if(CTX_data_equals(member, "selectable_objects") || CTX_data_equals(member, "selectable_bases")) { + int selectable_objects= CTX_data_equals(member, "selectable_objects"); + + for(base=scene->base.first; base; base=base->next) { + if(base->lay & lay) { + if((base->object->restrictflag & OB_RESTRICT_VIEW)==0 && (base->object->restrictflag & OB_RESTRICT_SELECT)==0) { + if(selectable_objects) + CTX_data_id_list_add(result, &base->object->id); + else + CTX_data_list_add(result, &scene->id, &RNA_ObjectBase, base); + } + } + } + CTX_data_type_set(result, CTX_DATA_TYPE_COLLECTION); + return 1; + } else if(CTX_data_equals(member, "selected_objects") || CTX_data_equals(member, "selected_bases")) { int selected_objects= CTX_data_equals(member, "selected_objects"); diff --git a/source/blender/editors/sculpt_paint/CMakeLists.txt b/source/blender/editors/sculpt_paint/CMakeLists.txt index 3211763b619..364677f9a8d 100644 --- a/source/blender/editors/sculpt_paint/CMakeLists.txt +++ b/source/blender/editors/sculpt_paint/CMakeLists.txt @@ -19,8 +19,6 @@ # # ***** END GPL LICENSE BLOCK ***** -FILE(GLOB SRC *.c) - SET(INC ../include ../../blenkernel @@ -34,6 +32,17 @@ SET(INC ../../../../intern/guardedalloc ) +SET(SRC + paint_image.c + paint_ops.c + paint_stroke.c + paint_undo.c + paint_utils.c + paint_vertex.c + sculpt.c + sculpt_undo.c +) + IF(WIN32) LIST(APPEND INC ${PTHREADS_INC}) ENDIF(WIN32) diff --git a/source/blender/editors/sculpt_paint/paint_image.c b/source/blender/editors/sculpt_paint/paint_image.c index 71754c3589a..a5b5baad4c5 100644 --- a/source/blender/editors/sculpt_paint/paint_image.c +++ b/source/blender/editors/sculpt_paint/paint_image.c @@ -4961,23 +4961,38 @@ static void toggle_paint_cursor(bContext *C, int enable) settings->imapaint.paintcursor= WM_paint_cursor_activate(CTX_wm_manager(C), image_paint_poll, brush_drawcursor, NULL); } +/* enable the paint cursor if it isn't already. + + purpose is to make sure the paint cursor is shown if paint + mode is enabled in the image editor. the paint poll will + ensure that the cursor is hidden when not in paint mode */ +void ED_space_image_paint_update(wmWindowManager *wm, ToolSettings *settings) +{ + ImagePaintSettings *imapaint = &settings->imapaint; + + if(!imapaint->paintcursor) { + imapaint->paintcursor = + WM_paint_cursor_activate(wm, image_paint_poll, + brush_drawcursor, NULL); + } +} + /* ************ image paint radial control *************/ static int paint_radial_control_invoke(bContext *C, wmOperator *op, wmEvent *event) { float zoom; ToolSettings *ts = CTX_data_scene(C)->toolsettings; get_imapaint_zoom(C, &zoom, &zoom); - toggle_paint_cursor(C, !ts->imapaint.paintcursor); + toggle_paint_cursor(C, 0); brush_radial_control_invoke(op, paint_brush(&ts->imapaint.paint), zoom); return WM_radial_control_invoke(C, op, event); } static int paint_radial_control_modal(bContext *C, wmOperator *op, wmEvent *event) { - ToolSettings *ts = CTX_data_scene(C)->toolsettings; int ret = WM_radial_control_modal(C, op, event); if(ret != OPERATOR_RUNNING_MODAL) - toggle_paint_cursor(C, !ts->imapaint.paintcursor); + toggle_paint_cursor(C, 1); return ret; } diff --git a/source/blender/editors/sculpt_paint/paint_ops.c b/source/blender/editors/sculpt_paint/paint_ops.c index 2e0338b370e..6f246692987 100644 --- a/source/blender/editors/sculpt_paint/paint_ops.c +++ b/source/blender/editors/sculpt_paint/paint_ops.c @@ -428,6 +428,9 @@ void ED_keymap_paint(wmKeyConfig *keyconf) keymap= WM_keymap_find(keyconf, "Image Paint", 0, 0); keymap->poll= image_texture_paint_poll; + RNA_enum_set(WM_keymap_add_item(keymap, "PAINT_OT_image_paint_radial_control", FKEY, KM_PRESS, 0, 0)->ptr, "mode", WM_RADIALCONTROL_SIZE); + RNA_enum_set(WM_keymap_add_item(keymap, "PAINT_OT_image_paint_radial_control", FKEY, KM_PRESS, KM_SHIFT, 0)->ptr, "mode", WM_RADIALCONTROL_STRENGTH); + RNA_enum_set(WM_keymap_add_item(keymap, "PAINT_OT_texture_paint_radial_control", FKEY, KM_PRESS, 0, 0)->ptr, "mode", WM_RADIALCONTROL_SIZE); RNA_enum_set(WM_keymap_add_item(keymap, "PAINT_OT_texture_paint_radial_control", FKEY, KM_PRESS, KM_SHIFT, 0)->ptr, "mode", WM_RADIALCONTROL_STRENGTH); diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c index 505e37d95f6..fccee048525 100644 --- a/source/blender/editors/sculpt_paint/sculpt.c +++ b/source/blender/editors/sculpt_paint/sculpt.c @@ -2815,6 +2815,36 @@ static void sculpt_cache_free(StrokeCache *cache) MEM_freeN(cache); } +/* Initialize mirror modifier clipping */ +static void sculpt_init_mirror_clipping(Object *ob, SculptSession *ss) +{ + ModifierData *md; + int i; + + for(md= ob->modifiers.first; md; md= md->next) { + if(md->type==eModifierType_Mirror && + (md->mode & eModifierMode_Realtime)) { + MirrorModifierData *mmd = (MirrorModifierData*)md; + + if(mmd->flag & MOD_MIR_CLIPPING) { + /* check each axis for mirroring */ + for(i = 0; i < 3; ++i) { + if(mmd->flag & (MOD_MIR_AXIS_X << i)) { + /* enable sculpt clipping */ + ss->cache->flag |= CLIP_X << i; + + /* update the clip tolerance */ + if(mmd->tolerance > + ss->cache->clip_tolerance[i]) + ss->cache->clip_tolerance[i] = + mmd->tolerance; + } + } + } + } + } +} + /* Initialize the stroke cache invariants from operator properties */ static void sculpt_update_cache_invariants(bContext* C, Sculpt *sd, SculptSession *ss, wmOperator *op, wmEvent *event) { @@ -2822,7 +2852,6 @@ static void sculpt_update_cache_invariants(bContext* C, Sculpt *sd, SculptSessio Brush *brush = paint_brush(&sd->paint); ViewContext *vc = paint_stroke_view_context(op->customdata); Object *ob= CTX_data_active_object(C); - ModifierData *md; int i; int mode; @@ -2835,22 +2864,9 @@ static void sculpt_update_cache_invariants(bContext* C, Sculpt *sd, SculptSessio ss->cache->plane_trim_squared = brush->plane_trim * brush->plane_trim; - /* Initialize mirror modifier clipping */ - ss->cache->flag = 0; - for(md= ob->modifiers.first; md; md= md->next) { - if(md->type==eModifierType_Mirror && (md->mode & eModifierMode_Realtime)) { - const MirrorModifierData *mmd = (MirrorModifierData*) md; - - /* Mark each axis that needs clipping along with its tolerance */ - if(mmd->flag & MOD_MIR_CLIPPING) { - ss->cache->flag |= CLIP_X << mmd->axis; - if(mmd->tolerance > ss->cache->clip_tolerance[mmd->axis]) - ss->cache->clip_tolerance[mmd->axis] = mmd->tolerance; - } - } - } + sculpt_init_mirror_clipping(ob, ss); /* Initial mouse location */ if (event) { diff --git a/source/blender/editors/sound/CMakeLists.txt b/source/blender/editors/sound/CMakeLists.txt index 456c02d947e..377643a5463 100644 --- a/source/blender/editors/sound/CMakeLists.txt +++ b/source/blender/editors/sound/CMakeLists.txt @@ -19,8 +19,6 @@ # # ***** END GPL LICENSE BLOCK ***** -FILE(GLOB SRC *.c) - SET(INC ../include ../../blenkernel @@ -32,4 +30,8 @@ SET(INC ../../../../intern/audaspace/intern ) +SET(SRC + sound_ops.c +) + BLENDERLIB(bf_editor_sound "${SRC}" "${INC}") diff --git a/source/blender/editors/space_action/CMakeLists.txt b/source/blender/editors/space_action/CMakeLists.txt index 3c0585c31ca..2ddc60a9e59 100644 --- a/source/blender/editors/space_action/CMakeLists.txt +++ b/source/blender/editors/space_action/CMakeLists.txt @@ -19,8 +19,6 @@ # # ***** END GPL LICENSE BLOCK ***** -FILE(GLOB SRC *.c) - SET(INC ../include ../../blenkernel @@ -31,4 +29,12 @@ SET(INC ../../../../intern/guardedalloc ) +SET(SRC + action_draw.c + action_edit.c + action_ops.c + action_select.c + space_action.c +) + BLENDERLIB(bf_editor_space_action "${SRC}" "${INC}") diff --git a/source/blender/editors/space_api/CMakeLists.txt b/source/blender/editors/space_api/CMakeLists.txt index da140fe0982..5436d8207c5 100644 --- a/source/blender/editors/space_api/CMakeLists.txt +++ b/source/blender/editors/space_api/CMakeLists.txt @@ -19,8 +19,6 @@ # # ***** END GPL LICENSE BLOCK ***** -FILE(GLOB SRC *.c) - SET(INC ../include ../../blenkernel @@ -31,4 +29,9 @@ SET(INC ../../../../intern/guardedalloc ) +SET(SRC + space.c + spacetypes.c +) + BLENDERLIB(bf_editor_space_api "${SRC}" "${INC}") diff --git a/source/blender/editors/space_buttons/CMakeLists.txt b/source/blender/editors/space_buttons/CMakeLists.txt index f8e9536ecf8..b92f2051e74 100644 --- a/source/blender/editors/space_buttons/CMakeLists.txt +++ b/source/blender/editors/space_buttons/CMakeLists.txt @@ -19,8 +19,6 @@ # # ***** END GPL LICENSE BLOCK ***** -FILE(GLOB SRC *.c) - SET(INC ../include ../../blenkernel @@ -31,4 +29,11 @@ SET(INC ../../../../intern/guardedalloc ) +SET(SRC + buttons_context.c + buttons_header.c + buttons_ops.c + space_buttons.c +) + BLENDERLIB(bf_editor_space_buttons "${SRC}" "${INC}") diff --git a/source/blender/editors/space_console/CMakeLists.txt b/source/blender/editors/space_console/CMakeLists.txt index 59074bcbb79..b1d9920fed4 100644 --- a/source/blender/editors/space_console/CMakeLists.txt +++ b/source/blender/editors/space_console/CMakeLists.txt @@ -19,8 +19,6 @@ # # ***** END GPL LICENSE BLOCK ***** -FILE(GLOB SRC *.c) - SET(INC ../include ../../blenfont @@ -33,6 +31,13 @@ SET(INC ../../../../intern/guardedalloc ) +SET(SRC + console_draw.c + console_ops.c + console_report.c + space_console.c +) + IF(NOT WITH_PYTHON) ADD_DEFINITIONS(-DDISABLE_PYTHON) ENDIF(NOT WITH_PYTHON) diff --git a/source/blender/editors/space_file/CMakeLists.txt b/source/blender/editors/space_file/CMakeLists.txt index 2a204d67537..3130e6d6c14 100644 --- a/source/blender/editors/space_file/CMakeLists.txt +++ b/source/blender/editors/space_file/CMakeLists.txt @@ -19,8 +19,6 @@ # # ***** END GPL LICENSE BLOCK ***** -FILE(GLOB SRC *.c) - SET(INC ../include ../../blenfont @@ -35,6 +33,17 @@ SET(INC ../../../../intern/guardedalloc ) +SET(SRC + file_draw.c + file_ops.c + file_panels.c + filelist.c + filesel.c + fsmenu.c + space_file.c + writeimage.c +) + IF(WITH_IMAGE_OPENEXR) ADD_DEFINITIONS(-DWITH_OPENEXR) ENDIF(WITH_IMAGE_OPENEXR) diff --git a/source/blender/editors/space_graph/CMakeLists.txt b/source/blender/editors/space_graph/CMakeLists.txt index 33ddbcea019..d5c295cf251 100644 --- a/source/blender/editors/space_graph/CMakeLists.txt +++ b/source/blender/editors/space_graph/CMakeLists.txt @@ -19,8 +19,6 @@ # # ***** END GPL LICENSE BLOCK ***** -FILE(GLOB SRC *.c) - SET(INC ../include ../../blenkernel @@ -32,4 +30,14 @@ SET(INC ../../../../intern/audaspace/intern ) +SET(SRC + graph_buttons.c + graph_draw.c + graph_edit.c + graph_ops.c + graph_select.c + graph_utils.c + space_graph.c +) + BLENDERLIB(bf_editor_space_graph "${SRC}" "${INC}") diff --git a/source/blender/editors/space_image/CMakeLists.txt b/source/blender/editors/space_image/CMakeLists.txt index 750c4b324d6..c2166164b0a 100644 --- a/source/blender/editors/space_image/CMakeLists.txt +++ b/source/blender/editors/space_image/CMakeLists.txt @@ -19,8 +19,6 @@ # # ***** END GPL LICENSE BLOCK ***** -FILE(GLOB SRC *.c) - SET(INC ../include ../../blenkernel @@ -33,6 +31,15 @@ SET(INC ../../../../intern/guardedalloc ) +SET(SRC + image_buttons.c + image_draw.c + image_header.c + image_ops.c + image_render.c + space_image.c +) + IF(WITH_IMAGE_OPENEXR) ADD_DEFINITIONS(-DWITH_OPENEXR) ENDIF(WITH_IMAGE_OPENEXR) diff --git a/source/blender/editors/space_info/CMakeLists.txt b/source/blender/editors/space_info/CMakeLists.txt index 9d439c4ec00..4187afd8df4 100644 --- a/source/blender/editors/space_info/CMakeLists.txt +++ b/source/blender/editors/space_info/CMakeLists.txt @@ -19,8 +19,6 @@ # # ***** END GPL LICENSE BLOCK ***** -FILE(GLOB SRC *.c) - SET(INC ../include ../../blenkernel @@ -32,4 +30,10 @@ SET(INC ../../../../intern/guardedalloc ) +SET(SRC + info_ops.c + info_stats.c + space_info.c +) + BLENDERLIB(bf_editor_space_info "${SRC}" "${INC}") diff --git a/source/blender/editors/space_logic/CMakeLists.txt b/source/blender/editors/space_logic/CMakeLists.txt index 6f0a260124d..64519d606f1 100644 --- a/source/blender/editors/space_logic/CMakeLists.txt +++ b/source/blender/editors/space_logic/CMakeLists.txt @@ -19,8 +19,6 @@ # # ***** END GPL LICENSE BLOCK ***** -FILE(GLOB SRC *.c) - SET(INC ../include ../../blenkernel @@ -32,6 +30,13 @@ SET(INC ../../../../intern/guardedalloc ) +SET(SRC + logic_buttons.c + logic_ops.c + logic_window.c + space_logic.c +) + IF(WITH_GAMEENGINE) ADD_DEFINITIONS(-DGAMEBLENDER) ENDIF(WITH_GAMEENGINE) diff --git a/source/blender/editors/space_nla/CMakeLists.txt b/source/blender/editors/space_nla/CMakeLists.txt index 6bb656cba8c..0a5f484bb05 100644 --- a/source/blender/editors/space_nla/CMakeLists.txt +++ b/source/blender/editors/space_nla/CMakeLists.txt @@ -19,8 +19,6 @@ # # ***** END GPL LICENSE BLOCK ***** -FILE(GLOB SRC *.c) - SET(INC ../include ../../blenkernel @@ -31,4 +29,14 @@ SET(INC ../../../../intern/guardedalloc ) +SET(SRC + nla_buttons.c + nla_channels.c + nla_draw.c + nla_edit.c + nla_ops.c + nla_select.c + space_nla.c +) + BLENDERLIB(bf_editor_space_nla "${SRC}" "${INC}") diff --git a/source/blender/editors/space_node/CMakeLists.txt b/source/blender/editors/space_node/CMakeLists.txt index ae298a611e9..887d79f8fb3 100644 --- a/source/blender/editors/space_node/CMakeLists.txt +++ b/source/blender/editors/space_node/CMakeLists.txt @@ -19,8 +19,6 @@ # # ***** END GPL LICENSE BLOCK ***** -FILE(GLOB SRC *.c) - SET(INC ../include ../../blenkernel @@ -35,6 +33,18 @@ SET(INC ../../../../intern/opennl/extern ) +SET(SRC + drawnode.c + node_buttons.c + node_draw.c + node_edit.c + node_header.c + node_ops.c + node_select.c + node_state.c + space_node.c +) + IF(WIN32) LIST(APPEND INC ${PTHREADS_INC}) ENDIF(WIN32) diff --git a/source/blender/editors/space_outliner/CMakeLists.txt b/source/blender/editors/space_outliner/CMakeLists.txt index 5ebe47f8c5e..33128bde986 100644 --- a/source/blender/editors/space_outliner/CMakeLists.txt +++ b/source/blender/editors/space_outliner/CMakeLists.txt @@ -19,8 +19,6 @@ # # ***** END GPL LICENSE BLOCK ***** -FILE(GLOB SRC *.c) - SET(INC ../include ../../blenkernel @@ -33,4 +31,10 @@ SET(INC ../../../../intern/opennl/extern ) +SET(SRC + outliner.c + outliner_ops.c + space_outliner.c +) + BLENDERLIB(bf_editor_space_outliner "${SRC}" "${INC}") diff --git a/source/blender/editors/space_script/CMakeLists.txt b/source/blender/editors/space_script/CMakeLists.txt index 7abaa4db441..88c0ea56ab2 100644 --- a/source/blender/editors/space_script/CMakeLists.txt +++ b/source/blender/editors/space_script/CMakeLists.txt @@ -19,8 +19,6 @@ # # ***** END GPL LICENSE BLOCK ***** -FILE(GLOB SRC *.c) - SET(INC ../include ../../blenkernel @@ -31,6 +29,13 @@ SET(INC ../../../../intern/guardedalloc ) +SET(SRC + script_edit.c + script_header.c + script_ops.c + space_script.c +) + IF(WITH_PYTHON) LIST(APPEND INC ${PYTHON_INC} ../../python) ELSE(WITH_PYTHON) diff --git a/source/blender/editors/space_script/script_edit.c b/source/blender/editors/space_script/script_edit.c index 7e3b14ca04a..23bc385c758 100644 --- a/source/blender/editors/space_script/script_edit.c +++ b/source/blender/editors/space_script/script_edit.c @@ -60,6 +60,8 @@ static int run_pyfile_exec(bContext *C, wmOperator *op) ED_region_tag_redraw(ar); return OPERATOR_FINISHED; } +#else + (void)C; /* unused */ #endif return OPERATOR_CANCELLED; /* FAIL */ } @@ -89,6 +91,8 @@ static int script_reload_exec(bContext *C, wmOperator *UNUSED(op)) BPY_eval_string(C, "__import__('bpy').utils.load_scripts(reload_scripts=True)"); WM_cursor_wait(0); return OPERATOR_FINISHED; +#else + (void)C; /* unused */ #endif return OPERATOR_CANCELLED; } diff --git a/source/blender/editors/space_sequencer/CMakeLists.txt b/source/blender/editors/space_sequencer/CMakeLists.txt index fa99d35a7cd..673c6af74c7 100644 --- a/source/blender/editors/space_sequencer/CMakeLists.txt +++ b/source/blender/editors/space_sequencer/CMakeLists.txt @@ -19,8 +19,6 @@ # # ***** END GPL LICENSE BLOCK ***** -FILE(GLOB SRC *.c) - SET(INC ../include ../../blenkernel @@ -33,4 +31,15 @@ SET(INC ../../../../intern/audaspace/intern ) +SET(SRC + sequencer_add.c + sequencer_buttons.c + sequencer_draw.c + sequencer_edit.c + sequencer_ops.c + sequencer_scopes.c + sequencer_select.c + space_sequencer.c +) + BLENDERLIB(bf_editor_space_sequencer "${SRC}" "${INC}") diff --git a/source/blender/editors/space_sequencer/sequencer_draw.c b/source/blender/editors/space_sequencer/sequencer_draw.c index c4ae658ce37..bbd18e7c1ee 100644 --- a/source/blender/editors/space_sequencer/sequencer_draw.c +++ b/source/blender/editors/space_sequencer/sequencer_draw.c @@ -728,6 +728,10 @@ void draw_image_seq(const bContext* C, Scene *scene, ARegion *ar, SpaceSeq *sseq UI_view2d_totRect_set(v2d, viewrectx + 0.5f, viewrecty + 0.5f); UI_view2d_curRect_validate(v2d); + /* only initialize the preview if a render is in progress */ + if(G.rendering) + return; + if (special_seq_update) ibuf= give_ibuf_seq_direct(bmain, scene, rectx, recty, cfra + frame_ofs, proxy_size, special_seq_update); else if (!U.prefetchframes) // XXX || (G.f & G_PLAYANIM) == 0) { diff --git a/source/blender/editors/space_sound/CMakeLists.txt b/source/blender/editors/space_sound/CMakeLists.txt index c78fc11a908..0f94e8a518e 100644 --- a/source/blender/editors/space_sound/CMakeLists.txt +++ b/source/blender/editors/space_sound/CMakeLists.txt @@ -19,8 +19,6 @@ # # ***** END GPL LICENSE BLOCK ***** -FILE(GLOB SRC *.c) - SET(INC ../include ../../blenkernel @@ -31,4 +29,9 @@ SET(INC ../../../../intern/guardedalloc ) +SET(SRC + sound_header.c + space_sound.c +) + BLENDERLIB(bf_editor_space_sound "${SRC}" "${INC}") diff --git a/source/blender/editors/space_text/CMakeLists.txt b/source/blender/editors/space_text/CMakeLists.txt index eabf508b5f6..b53a86fbe39 100644 --- a/source/blender/editors/space_text/CMakeLists.txt +++ b/source/blender/editors/space_text/CMakeLists.txt @@ -19,8 +19,6 @@ # # ***** END GPL LICENSE BLOCK ***** -FILE(GLOB SRC *.c) - SET(INC ../include ../../blenfont @@ -32,6 +30,14 @@ SET(INC ../../../../intern/guardedalloc ) +SET(SRC + space_text.c + text_draw.c + text_header.c + text_ops.c + text_python.c +) + IF(WITH_PYTHON) LIST(APPEND INC ${PYTHON_INC} ../../python) ELSE(WITH_PYTHON) diff --git a/source/blender/editors/space_text/text_ops.c b/source/blender/editors/space_text/text_ops.c index 8d4f3f87f66..af29e575482 100644 --- a/source/blender/editors/space_text/text_ops.c +++ b/source/blender/editors/space_text/text_ops.c @@ -558,6 +558,8 @@ static int run_script_poll(bContext *C) static int run_script_exec(bContext *C, wmOperator *op) { #ifdef DISABLE_PYTHON + (void)C; /* unused */ + BKE_report(op->reports, RPT_ERROR, "Python disabled in this build"); return OPERATOR_CANCELLED; diff --git a/source/blender/editors/space_time/CMakeLists.txt b/source/blender/editors/space_time/CMakeLists.txt index 4da42ec1f42..65f71e0b89b 100644 --- a/source/blender/editors/space_time/CMakeLists.txt +++ b/source/blender/editors/space_time/CMakeLists.txt @@ -19,8 +19,6 @@ # # ***** END GPL LICENSE BLOCK ***** -FILE(GLOB SRC *.c) - SET(INC ../include ../../blenkernel @@ -31,4 +29,9 @@ SET(INC ../../../../intern/guardedalloc ) +SET(SRC + space_time.c + time_ops.c +) + BLENDERLIB(bf_editor_space_time "${SRC}" "${INC}") diff --git a/source/blender/editors/space_userpref/CMakeLists.txt b/source/blender/editors/space_userpref/CMakeLists.txt index d57661bb166..b8a04a16edc 100644 --- a/source/blender/editors/space_userpref/CMakeLists.txt +++ b/source/blender/editors/space_userpref/CMakeLists.txt @@ -19,8 +19,6 @@ # # ***** END GPL LICENSE BLOCK ***** -FILE(GLOB SRC *.c) - SET(INC ../include ../../blenkernel @@ -31,4 +29,9 @@ SET(INC ../../../../intern/guardedalloc ) +SET(SRC + space_userpref.c + userpref_ops.c +) + BLENDERLIB(bf_editor_space_userpref "${SRC}" "${INC}") diff --git a/source/blender/editors/space_view3d/CMakeLists.txt b/source/blender/editors/space_view3d/CMakeLists.txt index 48747898981..855d770c784 100644 --- a/source/blender/editors/space_view3d/CMakeLists.txt +++ b/source/blender/editors/space_view3d/CMakeLists.txt @@ -19,8 +19,6 @@ # # ***** END GPL LICENSE BLOCK ***** -FILE(GLOB SRC *.c) - SET(INC ../include ../../blenfont @@ -36,6 +34,24 @@ SET(INC ../../../../intern/smoke/extern ) +SET(SRC + drawanimviz.c + drawarmature.c + drawmesh.c + drawobject.c + drawvolume.c + space_view3d.c + view3d_buttons.c + view3d_draw.c + view3d_edit.c + view3d_header.c + view3d_ops.c + view3d_select.c + view3d_snap.c + view3d_toolbar.c + view3d_view.c +) + IF(WITH_GAMEENGINE) LIST(APPEND INC ../../../kernel/gen_system) ADD_DEFINITIONS(-DGAMEBLENDER) diff --git a/source/blender/editors/space_view3d/drawanimviz.c b/source/blender/editors/space_view3d/drawanimviz.c index 4cce166b36b..52bb90aa8f0 100644 --- a/source/blender/editors/space_view3d/drawanimviz.c +++ b/source/blender/editors/space_view3d/drawanimviz.c @@ -78,7 +78,6 @@ void draw_motion_paths_init(View3D *v3d, ARegion *ar) * - assumes that the viewport has already been initialised properly * i.e. draw_motion_paths_init() has been called */ -// FIXME: the text is still drawn in the wrong space - it includes the current transforms of the object still... void draw_motion_path_instance(Scene *scene, Object *ob, bPoseChannel *pchan, bAnimVizSettings *avs, bMotionPath *mpath) { @@ -201,15 +200,20 @@ void draw_motion_path_instance(Scene *scene, UI_ThemeColor(TH_TEXT_HI); } + // XXX, this isnt up to date but probably should be kept so. + invert_m4_m4(ob->imat, ob->obmat); + /* Draw frame numbers at each framestep value */ if (avs->path_viewflag & MOTIONPATH_VIEW_FNUMS) { for (i=0, mpv=mpv_start; i < len; i+=stepsize, mpv+=stepsize) { char str[32]; + float co[3]; /* only draw framenum if several consecutive highlighted points don't occur on same point */ if (i == 0) { sprintf(str, "%d", (i+sfra)); - view3d_cached_text_draw_add(mpv->co[0], mpv->co[1], mpv->co[2], str, 0, 0); + mul_v3_m4v3(co, ob->imat, mpv->co); + view3d_cached_text_draw_add(co, str, 0, V3D_CACHE_TEXT_WORLDSPACE); } else if ((i > stepsize) && (i < len-stepsize)) { bMotionPathVert *mpvP = (mpv - stepsize); @@ -217,7 +221,8 @@ void draw_motion_path_instance(Scene *scene, if ((equals_v3v3(mpv->co, mpvP->co)==0) || (equals_v3v3(mpv->co, mpvN->co)==0)) { sprintf(str, "%d", (sfra+i)); - view3d_cached_text_draw_add(mpv->co[0], mpv->co[1], mpv->co[2], str, 0, 0); + mul_v3_m4v3(co, ob->imat, mpv->co); + view3d_cached_text_draw_add(co, str, 0, V3D_CACHE_TEXT_WORLDSPACE); } } } @@ -266,6 +271,7 @@ void draw_motion_path_instance(Scene *scene, /* Draw frame numbers of keyframes */ if (avs->path_viewflag & MOTIONPATH_VIEW_KFNOS) { + float co[3]; for (i=0, mpv=mpv_start; i < len; i++, mpv++) { float mframe= (float)(sfra + i); @@ -273,7 +279,8 @@ void draw_motion_path_instance(Scene *scene, char str[32]; sprintf(str, "%d", (sfra+i)); - view3d_cached_text_draw_add(mpv->co[0], mpv->co[1], mpv->co[2], str, 0, 0); + mul_v3_m4v3(co, ob->imat, mpv->co); + view3d_cached_text_draw_add(co, str, 0, V3D_CACHE_TEXT_WORLDSPACE); } } } diff --git a/source/blender/editors/space_view3d/drawarmature.c b/source/blender/editors/space_view3d/drawarmature.c index 6cbfc2cffe4..33776abf4a0 100644 --- a/source/blender/editors/space_view3d/drawarmature.c +++ b/source/blender/editors/space_view3d/drawarmature.c @@ -1892,7 +1892,7 @@ static void draw_pose_bones(Scene *scene, View3D *v3d, ARegion *ar, Base *base, /* Draw names of bone */ if (arm->flag & ARM_DRAWNAMES) { mid_v3_v3v3(vec, pchan->pose_head, pchan->pose_tail); - view3d_cached_text_draw_add(vec[0], vec[1], vec[2], pchan->name, 10, 0); + view3d_cached_text_draw_add(vec, pchan->name, 10, 0); } /* Draw additional axes on the bone tail */ @@ -2086,7 +2086,7 @@ static void draw_ebones(View3D *v3d, ARegion *ar, Object *ob, int dt) if (arm->flag & ARM_DRAWNAMES) { mid_v3_v3v3(vec, eBone->head, eBone->tail); glRasterPos3fv(vec); - view3d_cached_text_draw_add(vec[0], vec[1], vec[2], eBone->name, 10, 0); + view3d_cached_text_draw_add(vec, eBone->name, 10, 0); } /* Draw additional axes */ if (arm->flag & ARM_DRAWAXES) { diff --git a/source/blender/editors/space_view3d/drawmesh.c b/source/blender/editors/space_view3d/drawmesh.c index 0df2888f4a0..f9af8bd5e79 100644 --- a/source/blender/editors/space_view3d/drawmesh.c +++ b/source/blender/editors/space_view3d/drawmesh.c @@ -168,6 +168,7 @@ static int draw_tfaces3D__setSelectOpts(void *userData, int index) return flags & eEdge_Select; } +#if 0 static int draw_tfaces3D__setActiveOpts(void *userData, int index) { struct { Mesh *me; EdgeHash *eh; } *data = userData; @@ -191,8 +192,21 @@ static int draw_tfaces3D__drawFaceOpts(void *userData, int index) else return 0; } +#endif -static void draw_tfaces3D(RegionView3D *rv3d, Mesh *me, DerivedMesh *dm) +/* draws unselected */ +static int draw_tfaces3D__drawFaceOptsInv(void *userData, int index) +{ + Mesh *me = (Mesh*)userData; + + MFace *mface = &me->mface[index]; + if (!(mface->flag&ME_HIDE) && !(mface->flag&ME_FACE_SEL)) + return 2; /* Don't set color */ + else + return 0; +} + +static void draw_tfaces3D(RegionView3D *rv3d, Mesh *me, DerivedMesh *dm, short draw_seams) { struct { Mesh *me; EdgeHash *eh; } data; @@ -203,17 +217,17 @@ static void draw_tfaces3D(RegionView3D *rv3d, Mesh *me, DerivedMesh *dm) glDisable(GL_LIGHTING); bglPolygonOffset(rv3d->dist, 1.0); - /* Draw (Hidden) Edges */ + /* Draw (Hidden) Edges */ + setlinestyle(1); UI_ThemeColor(TH_EDGE_FACESEL); dm->drawMappedEdges(dm, draw_tfaces3D__setHiddenOpts, &data); + setlinestyle(0); - /* Draw Seams */ - if(me->drawflag & ME_DRAWSEAMS) { + /* Draw Seams */ + if(draw_seams && me->drawflag & ME_DRAWSEAMS) { UI_ThemeColor(TH_EDGE_SEAM); glLineWidth(2); - dm->drawMappedEdges(dm, draw_tfaces3D__setSeamOpts, &data); - glLineWidth(1); } @@ -221,10 +235,16 @@ static void draw_tfaces3D(RegionView3D *rv3d, Mesh *me, DerivedMesh *dm) if(me->drawflag & ME_DRAWFACES) { glEnable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); +#if 0 UI_ThemeColor4(TH_FACE_SELECT); dm->drawMappedFacesTex(dm, draw_tfaces3D__drawFaceOpts, (void*)me); - +#else + /* dull unselected faces so as not to get in the way of seeing color */ + glColor4ub(96, 96, 96, 64); + dm->drawMappedFacesTex(dm, draw_tfaces3D__drawFaceOptsInv, (void*)me); +#endif + glDisable(GL_BLEND); } @@ -236,8 +256,6 @@ static void draw_tfaces3D(RegionView3D *rv3d, Mesh *me, DerivedMesh *dm) dm->drawMappedEdges(dm, draw_tfaces3D__setSelectOpts, &data); setlinestyle(0); - dm->drawMappedEdges(dm, draw_tfaces3D__setActiveOpts, &data); - bglPolygonOffset(rv3d->dist, 0.0); // resets correctly now, even after calling accumulated offsets BLI_edgehash_free(data.eh, NULL); @@ -671,7 +689,7 @@ void draw_mesh_textured(Scene *scene, View3D *v3d, RegionView3D *rv3d, Object *o /* draw edges and selected faces over textured mesh */ if(!(ob == scene->obedit) && faceselect) - draw_tfaces3D(rv3d, me, dm); + draw_tfaces3D(rv3d, me, dm, ob->mode & OB_MODE_WEIGHT_PAINT); /* reset from negative scale correction */ glFrontFace(GL_CCW); diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c index e7a69642e9f..bc340ef5b4b 100644 --- a/source/blender/editors/space_view3d/drawobject.c +++ b/source/blender/editors/space_view3d/drawobject.c @@ -571,16 +571,14 @@ void view3d_cached_text_draw_begin() CachedTextLevel++; } -void view3d_cached_text_draw_add(float x, float y, float z, char *str, short xoffs, short flag) +void view3d_cached_text_draw_add(const float co[3], const char *str, short xoffs, short flag) { ListBase *strings= &CachedText[CachedTextLevel-1]; ViewCachedString *vos= MEM_callocN(sizeof(ViewCachedString), "ViewCachedString"); BLI_addtail(strings, vos); BLI_strncpy(vos->str, str, 128); - vos->vec[0]= x; - vos->vec[1]= y; - vos->vec[2]= z; + copy_v3_v3(vos->vec, co); glGetFloatv(GL_CURRENT_COLOR, vos->col); vos->xoffs= xoffs; vos->flag= flag; @@ -2115,7 +2113,7 @@ static void draw_em_measure_stats(View3D *v3d, RegionView3D *rv3d, Object *ob, E else sprintf(val, conv_float, len_v3v3(v1, v2)); - view3d_cached_text_draw_add(vmid[0], vmid[1], vmid[2], val, 0, 0); + view3d_cached_text_draw_add(vmid, val, 0, 0); } } } @@ -2154,7 +2152,7 @@ static void draw_em_measure_stats(View3D *v3d, RegionView3D *rv3d, Object *ob, E else sprintf(val, conv_float, area); - view3d_cached_text_draw_add(efa->cent[0], efa->cent[1], efa->cent[2], val, 0, 0); + view3d_cached_text_draw_add(efa->cent, val, 0, 0); } } } @@ -2196,13 +2194,13 @@ static void draw_em_measure_stats(View3D *v3d, RegionView3D *rv3d, Object *ob, E /* Vec 1 */ sprintf(val,"%.3f", RAD2DEG(angle_v3v3v3(v4, v1, v2))); interp_v3_v3v3(fvec, efa->cent, efa->v1->co, 0.8f); - view3d_cached_text_draw_add(fvec[0], fvec[1], fvec[2], val, 0, 0); + view3d_cached_text_draw_add(fvec, val, 0, 0); } if( (e1->f & e2->f & SELECT) || (do_moving && (efa->v2->f & SELECT)) ) { /* Vec 2 */ sprintf(val,"%.3f", RAD2DEG(angle_v3v3v3(v1, v2, v3))); interp_v3_v3v3(fvec, efa->cent, efa->v2->co, 0.8f); - view3d_cached_text_draw_add(fvec[0], fvec[1], fvec[2], val, 0, 0); + view3d_cached_text_draw_add(fvec, val, 0, 0); } if( (e2->f & e3->f & SELECT) || (do_moving && (efa->v3->f & SELECT)) ) { /* Vec 3 */ @@ -2211,14 +2209,14 @@ static void draw_em_measure_stats(View3D *v3d, RegionView3D *rv3d, Object *ob, E else sprintf(val,"%.3f", RAD2DEG(angle_v3v3v3(v2, v3, v1))); interp_v3_v3v3(fvec, efa->cent, efa->v3->co, 0.8f); - view3d_cached_text_draw_add(fvec[0], fvec[1], fvec[2], val, 0, 0); + view3d_cached_text_draw_add(fvec, val, 0, 0); } /* Vec 4 */ if(efa->v4) { if( (e3->f & e4->f & SELECT) || (do_moving && (efa->v4->f & SELECT)) ) { sprintf(val,"%.3f", RAD2DEG(angle_v3v3v3(v3, v4, v1))); interp_v3_v3v3(fvec, efa->cent, efa->v4->co, 0.8f); - view3d_cached_text_draw_add(fvec[0], fvec[1], fvec[2], val, 0, 0); + view3d_cached_text_draw_add(fvec, val, 0, 0); } } } @@ -3833,7 +3831,7 @@ static void draw_new_particle_system(Scene *scene, View3D *v3d, RegionView3D *rv /* in path drawing state.co is the end point */ /* use worldspace beause object matrix is already applied */ mul_v3_m4v3(vec_txt, ob->imat, state.co); - view3d_cached_text_draw_add(vec_txt[0], vec_txt[1], vec_txt[2], val, 10, V3D_CACHE_TEXT_WORLDSPACE); + view3d_cached_text_draw_add(vec_txt, val, 10, V3D_CACHE_TEXT_WORLDSPACE); } } } @@ -3927,7 +3925,7 @@ static void draw_new_particle_system(Scene *scene, View3D *v3d, RegionView3D *rv sprintf(val, "%i", a); /* use worldspace beause object matrix is already applied */ mul_v3_m4v3(vec_txt, ob->imat, cache[a]->co); - view3d_cached_text_draw_add(vec_txt[0], vec_txt[1], vec_txt[2], val, 10, V3D_CACHE_TEXT_WORLDSPACE); + view3d_cached_text_draw_add(vec_txt, val, 10, V3D_CACHE_TEXT_WORLDSPACE); } } } @@ -5510,11 +5508,11 @@ void drawRBpivot(bRigidBodyJointConstraint *data) glVertex3fv(v); glEnd(); if (axis==0) - view3d_cached_text_draw_add(v[0], v[1], v[2], "px", 0, 0); + view3d_cached_text_draw_add(v, "px", 0, 0); else if (axis==1) - view3d_cached_text_draw_add(v[0], v[1], v[2], "py", 0, 0); + view3d_cached_text_draw_add(v, "py", 0, 0); else - view3d_cached_text_draw_add(v[0], v[1], v[2], "pz", 0, 0); + view3d_cached_text_draw_add(v, "pz", 0, 0); } glLineWidth (1.0f); setlinestyle(0); @@ -5982,7 +5980,7 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag) draw_new_particle_system(scene, v3d, rv3d, base, psys, dt); } - + invert_m4_m4(ob->imat, ob->obmat); view3d_cached_text_draw_end(v3d, ar, 0, NULL); glMultMatrixf(ob->obmat); @@ -6001,6 +5999,7 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag) PTCacheEdit *edit = PE_create_current(scene, ob); if(edit) { glLoadMatrixf(rv3d->viewmat); + draw_update_ptcache_edit(scene, ob, edit); draw_ptcache_edit(scene, v3d, edit); glMultMatrixf(ob->obmat); } @@ -6140,7 +6139,8 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag) /* patch for several 3d cards (IBM mostly) that crash on glSelect with text drawing */ /* but, we also dont draw names for sets or duplicators */ if(flag == 0) { - view3d_cached_text_draw_add(0.0f, 0.0f, 0.0f, ob->id.name+2, 10, 0); + float zero[3]= {0,0,0}; + view3d_cached_text_draw_add(zero, ob->id.name+2, 10, 0); } } /*if(dtx & OB_DRAWIMAGE) drawDispListwire(&ob->disp);*/ @@ -6162,6 +6162,7 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag) } /* return warning, this is cached text draw */ + invert_m4_m4(ob->imat, ob->obmat); view3d_cached_text_draw_end(v3d, ar, 1, NULL); glLoadMatrixf(rv3d->viewmat); diff --git a/source/blender/editors/space_view3d/space_view3d.c b/source/blender/editors/space_view3d/space_view3d.c index 6261ca52564..77f6e63e860 100644 --- a/source/blender/editors/space_view3d/space_view3d.c +++ b/source/blender/editors/space_view3d/space_view3d.c @@ -559,25 +559,9 @@ static void view3d_recalc_used_layers(ARegion *ar, wmNotifier *wmn, Scene *scene } } -static View3D *view3d_from_wmn(ARegion *ar, wmNotifier *wmn) -{ - wmWindow *win= wmn->wm->winactive; - ScrArea *sa; - - for(sa= win->screen->areabase.first; sa; sa= sa->next) { - if(sa->spacetype == SPACE_VIEW3D) - if(BLI_findindex(&sa->regionbase, ar) != -1) { - return (View3D *)sa->spacedata.first; - } - } - - return NULL; -} - static void view3d_main_area_listener(ARegion *ar, wmNotifier *wmn) { bScreen *sc; - View3D *v3d; /* context changes */ switch(wmn->category) { @@ -615,9 +599,7 @@ static void view3d_main_area_listener(ARegion *ar, wmNotifier *wmn) ED_region_tag_redraw(ar); break; case ND_WORLD: - v3d= view3d_from_wmn(ar, wmn); - if(v3d->flag2 & V3D_RENDER_OVERRIDE) - ED_region_tag_redraw(ar); + /* handled by space_view3d_listener() for v3d access */ break; } if (wmn->action == NA_EDITED) @@ -669,9 +651,7 @@ static void view3d_main_area_listener(ARegion *ar, wmNotifier *wmn) case NC_WORLD: switch(wmn->data) { case ND_WORLD_DRAW: - v3d= view3d_from_wmn(ar, wmn); - if(v3d->flag2 & V3D_RENDER_OVERRIDE) - ED_region_tag_redraw(ar); + /* handled by space_view3d_listener() for v3d access */ break; } break; @@ -910,12 +890,53 @@ static void view3d_props_area_listener(ARegion *ar, wmNotifier *wmn) } } +/*area (not region) level listener*/ +void space_view3d_listener(struct ScrArea *sa, struct wmNotifier *wmn) +{ + View3D *v3d = sa->spacedata.first; + + /* context changes */ + switch(wmn->category) { + case NC_SCENE: + switch(wmn->data) { + case ND_WORLD: + if(v3d->flag2 & V3D_RENDER_OVERRIDE) + ED_area_tag_redraw_regiontype(sa, RGN_TYPE_WINDOW); + break; + } + break; + case NC_WORLD: + switch(wmn->data) { + case ND_WORLD_DRAW: + if(v3d->flag2 & V3D_RENDER_OVERRIDE) + ED_area_tag_redraw_regiontype(sa, RGN_TYPE_WINDOW); + break; + } + break; + + } + +#if 0 // removed since BKE_image_user_calc_frame is now called in draw_bgpic because screen_ops doesnt call the notifier. + if (wmn->category == NC_SCENE && wmn->data == ND_FRAME) { + View3D *v3d = area->spacedata.first; + BGpic *bgpic = v3d->bgpicbase.first; + + for (; bgpic; bgpic = bgpic->next) { + if (bgpic->ima) { + Scene *scene = wmn->reference; + BKE_image_user_calc_frame(&bgpic->iuser, scene->r.cfra, 0); + } + } + } +#endif +} + static int view3d_context(const bContext *C, const char *member, bContextDataResult *result) { View3D *v3d= CTX_wm_view3d(C); Scene *scene= CTX_data_scene(C); Base *base; - int lay = v3d ? v3d->lay:scene->lay; /* fallback to the scene layer, allows duplicate and other oject operators to run outside the 3d view */ + unsigned int lay = v3d ? v3d->lay:scene->lay; /* fallback to the scene layer, allows duplicate and other oject operators to run outside the 3d view */ if(CTX_data_dir(member)) { static const char *dir[] = { @@ -1012,23 +1033,6 @@ static int view3d_context(const bContext *C, const char *member, bContextDataRes return -1; /* found but not available */ } -/*area (not region) level listener*/ -#if 0 // removed since BKE_image_user_calc_frame is now called in draw_bgpic because screen_ops doesnt call the notifier. -void space_view3d_listener(struct ScrArea *area, struct wmNotifier *wmn) -{ - if (wmn->category == NC_SCENE && wmn->data == ND_FRAME) { - View3D *v3d = area->spacedata.first; - BGpic *bgpic = v3d->bgpicbase.first; - - for (; bgpic; bgpic = bgpic->next) { - if (bgpic->ima) { - Scene *scene = wmn->reference; - BKE_image_user_calc_frame(&bgpic->iuser, scene->r.cfra, 0); - } - } - } -} -#endif /* only called once, from space/spacetypes.c */ void ED_spacetype_view3d(void) @@ -1042,7 +1046,7 @@ void ED_spacetype_view3d(void) st->new= view3d_new; st->free= view3d_free; st->init= view3d_init; -// st->listener = space_view3d_listener; + st->listener = space_view3d_listener; st->duplicate= view3d_duplicate; st->operatortypes= view3d_operatortypes; st->keymap= view3d_keymap; diff --git a/source/blender/editors/space_view3d/view3d_draw.c b/source/blender/editors/space_view3d/view3d_draw.c index 67c2a4f1c56..30880db0c90 100644 --- a/source/blender/editors/space_view3d/view3d_draw.c +++ b/source/blender/editors/space_view3d/view3d_draw.c @@ -571,93 +571,74 @@ static void drawcursor(Scene *scene, ARegion *ar, View3D *v3d) } } -/* Draw a live substitute of the view icon, which is always shown */ +/* Draw a live substitute of the view icon, which is always shown + * colors copied from transform_manipulator.c, we should keep these matching. */ static void draw_view_axis(RegionView3D *rv3d) { const float k = U.rvisize; /* axis size */ const float toll = 0.5; /* used to see when view is quasi-orthogonal */ const float start = k + 1.0; /* axis center in screen coordinates, x=y */ float ydisp = 0.0; /* vertical displacement to allow obj info text */ - - /* rvibright ranges approx. from original axis icon color to gizmo color */ - float bright = U.rvibright / 15.0f; - - unsigned char col[3]; - unsigned char gridcol[3]; - float colf[3]; - - float vec[4]; + + float vec[3]; float dx, dy; - float h, s, v; /* thickness of lines is proportional to k */ - /* (log(k)-1) gives a more suitable thickness, but fps decreased by about 3 fps */ - glLineWidth(k / 10); - //glLineWidth(log(k)-1); // a bit slow - - UI_GetThemeColor3ubv(TH_GRID, (char *)gridcol); - + glLineWidth(2); + /* X */ - vec[0] = vec[3] = 1; + vec[0] = 1; vec[1] = vec[2] = 0; mul_qt_v3(rv3d->viewquat, vec); - - UI_make_axis_color((char *)gridcol, (char *)col, 'x'); - rgb_to_hsv(col[0]/255.0f, col[1]/255.0f, col[2]/255.0f, &h, &s, &v); - s = s<0.5 ? s+0.5 : 1.0; - v = 0.3; - v = (v<1.0-(bright) ? v+bright : 1.0); - hsv_to_rgb(h, s, v, colf, colf+1, colf+2); - glColor3fv(colf); - dx = vec[0] * k; dy = vec[1] * k; - fdrawline(start, start + ydisp, start + dx, start + dy + ydisp); + + glColor3ub(220, 0, 0); + glBegin(GL_LINES); + glVertex2f(start, start + ydisp); + glVertex2f(start + dx, start + dy + ydisp); + glEnd(); + if (fabs(dx) > toll || fabs(dy) > toll) { BLF_draw_default(start + dx + 2, start + dy + ydisp + 2, 0.0f, "x"); } /* Y */ - vec[1] = vec[3] = 1; + vec[1] = 1; vec[0] = vec[2] = 0; mul_qt_v3(rv3d->viewquat, vec); - - UI_make_axis_color((char *)gridcol, (char *)col, 'y'); - rgb_to_hsv(col[0]/255.0f, col[1]/255.0f, col[2]/255.0f, &h, &s, &v); - s = s<0.5 ? s+0.5 : 1.0; - v = 0.3; - v = (v<1.0-(bright) ? v+bright : 1.0); - hsv_to_rgb(h, s, v, colf, colf+1, colf+2); - glColor3fv(colf); - dx = vec[0] * k; dy = vec[1] * k; - fdrawline(start, start + ydisp, start + dx, start + dy + ydisp); + + glColor3ub(0, 220, 0); + glBegin(GL_LINES); + glVertex2f(start, start + ydisp); + glVertex2f(start + dx, start + dy + ydisp); + glEnd(); + if (fabs(dx) > toll || fabs(dy) > toll) { BLF_draw_default(start + dx + 2, start + dy + ydisp + 2, 0.0f, "y"); } /* Z */ - vec[2] = vec[3] = 1; + vec[2] = 1; vec[1] = vec[0] = 0; mul_qt_v3(rv3d->viewquat, vec); - - UI_make_axis_color((char *)gridcol, (char *)col, 'z'); - rgb_to_hsv(col[0]/255.0f, col[1]/255.0f, col[2]/255.0f, &h, &s, &v); - s = s<0.5 ? s+0.5 : 1.0; - v = 0.5; - v = (v<1.0-(bright) ? v+bright : 1.0); - hsv_to_rgb(h, s, v, colf, colf+1, colf+2); - glColor3fv(colf); - dx = vec[0] * k; dy = vec[1] * k; - fdrawline(start, start + ydisp, start + dx, start + dy + ydisp); + + glColor3ub(30, 30, 220); + glBegin(GL_LINES); + glVertex2f(start, start + ydisp); + glVertex2f(start + dx, start + dy + ydisp); + glEnd(); + if (fabs(dx) > toll || fabs(dy) > toll) { BLF_draw_default(start + dx + 2, start + dy + ydisp + 2, 0.0f, "z"); } - + /* restore line-width */ + glLineWidth(1.0); } @@ -1478,7 +1459,7 @@ static void draw_dupli_objects_color(Scene *scene, ARegion *ar, View3D *v3d, Bas { RegionView3D *rv3d= ar->regiondata; ListBase *lb; - DupliObject *dob_prev= NULL, *dob, *dob_next; + DupliObject *dob_prev= NULL, *dob, *dob_next= NULL; Base tbase; BoundBox bb, *bb_tmp; /* use a copy because draw_object, calls clear_mesh_caches */ GLuint displist=0; @@ -1588,7 +1569,51 @@ static void draw_dupli_objects(Scene *scene, ARegion *ar, View3D *v3d, Base *bas draw_dupli_objects_color(scene, ar, v3d, base, color); } +void view3d_update_depths_rect(ARegion *ar, ViewDepths *d, rcti *rect) +{ + int x, y, w, h; + /* clamp rect by area */ + + /* Constrain rect to depth bounds */ + if (rect->xmin < 0) rect->xmin = 0; + if (rect->ymin < 0) rect->ymin = 0; + if (rect->xmax >= ar->winx) rect->xmax = ar->winx-1; + if (rect->ymax >= ar->winy) rect->ymax = ar->winy-1; + + /* assign values to compare with the ViewDepths */ + x= ar->winrct.xmin + rect->xmin; + y= ar->winrct.ymin + rect->ymin; + + w= rect->xmax - rect->xmin; + h= rect->ymax - rect->ymin; + + if( d->w != w || + d->h != h || + d->x != x || + d->y != y || + d->depths==NULL + ) { + d->x= x; + d->y= y; + d->w= w; + d->h= h; + + if(d->depths) + MEM_freeN(d->depths); + d->depths= MEM_mallocN(sizeof(float)*d->w*d->h,"View depths Subset"); + + d->damaged= 1; + } + + if(d->damaged) { + glReadPixels(ar->winrct.xmin+d->x,ar->winrct.ymin+d->y, d->w,d->h, GL_DEPTH_COMPONENT,GL_FLOAT, d->depths); + glGetDoublev(GL_DEPTH_RANGE,d->depth_range); + d->damaged= 0; + } +} + +/* note, with nouveau drivers the glReadPixels() is very slow. [#24339] */ void view3d_update_depths(ARegion *ar) { RegionView3D *rv3d= ar->regiondata; @@ -1619,6 +1644,30 @@ void view3d_update_depths(ARegion *ar) } } +/* utility function to find the closest Z value, use for autodepth */ +float view3d_depth_near(ViewDepths *d) +{ + /* convert to float for comparisons */ + const float near= (float)d->depth_range[0]; + const float far_real= (float)d->depth_range[1]; + float far= far_real; + + const float *depths= d->depths; + float depth= FLT_MAX; + int i= d->w * d->h; + + /* far is both the starting 'far' value + * and the closest value found. */ + while(i--) { + depth= *depths++; + if((depth < far) && (depth > near)) { + far= depth; + } + } + + return far == far_real ? FLT_MAX : far; +} + void draw_depth_gpencil(Scene *scene, ARegion *ar, View3D *v3d) { short zbuf= v3d->zbuf; diff --git a/source/blender/editors/space_view3d/view3d_edit.c b/source/blender/editors/space_view3d/view3d_edit.c index dc75efcc5ca..a5cca6341f6 100644 --- a/source/blender/editors/space_view3d/view3d_edit.c +++ b/source/blender/editors/space_view3d/view3d_edit.c @@ -63,6 +63,7 @@ #include "ED_screen.h" #include "ED_transform.h" #include "ED_mesh.h" +#include "ED_view3d.h" #include "PIL_time.h" /* smoothview */ @@ -1667,10 +1668,8 @@ static int view3d_zoom_border_exec(bContext *C, wmOperator *op) /* ZBuffer depth vars */ bglMats mats; - float depth, depth_close= FLT_MAX; - int had_depth = 0; + float depth_close= FLT_MAX; double cent[2], p[3]; - int xs, ys; /* note; otherwise opengl won't work */ view3d_operator_needs_opengl(C); @@ -1684,38 +1683,19 @@ static int view3d_zoom_border_exec(bContext *C, wmOperator *op) /* Get Z Depths, needed for perspective, nice for ortho */ bgl_get_mats(&mats); draw_depth(scene, ar, v3d, NULL); + + { + /* avoid allocating the whole depth buffer */ + ViewDepths depth_temp= {0}; - /* force updating */ - if (rv3d->depths) { - had_depth = 1; - rv3d->depths->damaged = 1; - } - - view3d_update_depths(ar); - - /* Constrain rect to depth bounds */ - if (rect.xmin < 0) rect.xmin = 0; - if (rect.ymin < 0) rect.ymin = 0; - if (rect.xmax >= rv3d->depths->w) rect.xmax = rv3d->depths->w-1; - if (rect.ymax >= rv3d->depths->h) rect.ymax = rv3d->depths->h-1; - - /* Find the closest Z pixel */ - for (xs=rect.xmin; xs < rect.xmax; xs++) { - for (ys=rect.ymin; ys < rect.ymax; ys++) { - depth= rv3d->depths->depths[ys*rv3d->depths->w+xs]; - if(depth < rv3d->depths->depth_range[1] && depth > rv3d->depths->depth_range[0]) { - if (depth_close > depth) { - depth_close = depth; - } - } - } - } - - if (had_depth==0) { - MEM_freeN(rv3d->depths->depths); - rv3d->depths->depths = NULL; + /* avoid view3d_update_depths() for speed. */ + view3d_update_depths_rect(ar, &depth_temp, &rect); + + /* find the closest Z pixel */ + depth_close= view3d_depth_near(&depth_temp); + + MEM_freeN(depth_temp.depths); } - rv3d->depths->damaged = 1; cent[0] = (((double)rect.xmin)+((double)rect.xmax)) / 2; cent[1] = (((double)rect.ymin)+((double)rect.ymax)) / 2; @@ -2574,88 +2554,49 @@ void VIEW3D_OT_enable_manipulator(wmOperatorType *ot) static float view_autodist_depth_margin(ARegion *ar, short *mval, int margin) { - RegionView3D *rv3d= ar->regiondata; - float depth= FLT_MAX; + ViewDepths depth_temp= {0}; + rcti rect; + float depth_close; if(margin==0) { - if (mval[0] < 0) return 0; - if (mval[1] < 0) return 0; - if (mval[0] >= rv3d->depths->w) return 0; - if (mval[1] >= rv3d->depths->h) return 0; - /* Get Z Depths, needed for perspective, nice for ortho */ - depth= rv3d->depths->depths[mval[1]*rv3d->depths->w+mval[0]]; - if(depth >= rv3d->depths->depth_range[1] || depth <= rv3d->depths->depth_range[0]) { - depth= FLT_MAX; - } + rect.xmin= mval[0]; + rect.ymin= mval[1]; + rect.xmax= mval[0] + 1; + rect.ymax= mval[1] + 1; } else { - rcti rect; - float depth_close= FLT_MAX; - int xs, ys; - rect.xmax = mval[0] + margin; rect.ymax = mval[1] + margin; rect.xmin = mval[0] - margin; rect.ymin = mval[1] - margin; + } - /* Constrain rect to depth bounds */ - if (rect.xmin < 0) rect.xmin = 0; - if (rect.ymin < 0) rect.ymin = 0; - if (rect.xmax >= rv3d->depths->w) rect.xmax = rv3d->depths->w-1; - if (rect.ymax >= rv3d->depths->h) rect.ymax = rv3d->depths->h-1; - - /* Find the closest Z pixel */ - for (xs=rect.xmin; xs < rect.xmax; xs++) { - for (ys=rect.ymin; ys < rect.ymax; ys++) { - depth= rv3d->depths->depths[ys*rv3d->depths->w+xs]; - if(depth < rv3d->depths->depth_range[1] && depth > rv3d->depths->depth_range[0]) { - if (depth_close > depth) { - depth_close = depth; - } - } - } - } + view3d_update_depths_rect(ar, &depth_temp, &rect); + depth_close= view3d_depth_near(&depth_temp); - depth= depth_close; - } + MEM_freeN(depth_temp.depths); - return depth; + return depth_close; } /* XXX todo Zooms in on a border drawn by the user */ int view_autodist(Scene *scene, ARegion *ar, View3D *v3d, short *mval, float mouse_worldloc[3] ) //, float *autodist ) { - RegionView3D *rv3d= ar->regiondata; bglMats mats; /* ZBuffer depth vars */ float depth_close= FLT_MAX; - int had_depth = 0; double cent[2], p[3]; /* Get Z Depths, needed for perspective, nice for ortho */ bgl_get_mats(&mats); draw_depth(scene, ar, v3d, NULL); - /* force updating */ - if (rv3d->depths) { - had_depth = 1; - rv3d->depths->damaged = 1; - } - - view3d_update_depths(ar); - depth_close= view_autodist_depth_margin(ar, mval, 4); if (depth_close==FLT_MAX) return 0; - if (had_depth==0) { - MEM_freeN(rv3d->depths->depths); - rv3d->depths->depths = NULL; - } - rv3d->depths->damaged = 1; - cent[0] = (double)mval[0]; cent[1] = (double)mval[1]; @@ -2670,8 +2611,6 @@ int view_autodist(Scene *scene, ARegion *ar, View3D *v3d, short *mval, float mou int view_autodist_init(Scene *scene, ARegion *ar, View3D *v3d, int mode) //, float *autodist ) { - RegionView3D *rv3d= ar->regiondata; - /* Get Z Depths, needed for perspective, nice for ortho */ switch(mode) { case 0: @@ -2682,12 +2621,6 @@ int view_autodist_init(Scene *scene, ARegion *ar, View3D *v3d, int mode) //, flo break; } - /* force updating */ - if (rv3d->depths) { - rv3d->depths->damaged = 1; - } - - view3d_update_depths(ar); return 1; } diff --git a/source/blender/editors/space_view3d/view3d_header.c b/source/blender/editors/space_view3d/view3d_header.c index 5ca8843b658..746c6acae1c 100644 --- a/source/blender/editors/space_view3d/view3d_header.c +++ b/source/blender/editors/space_view3d/view3d_header.c @@ -511,7 +511,7 @@ void uiTemplateHeader3D(uiLayout *layout, struct bContext *C) } if(obedit==NULL && v3d->localvd==NULL) { - int ob_lay = ob ? ob->lay : 0; + unsigned int ob_lay = ob ? ob->lay : 0; /* Layers */ if (v3d->scenelock) diff --git a/source/blender/editors/space_view3d/view3d_intern.h b/source/blender/editors/space_view3d/view3d_intern.h index 9d1f5a77a3f..e81d0b87589 100644 --- a/source/blender/editors/space_view3d/view3d_intern.h +++ b/source/blender/editors/space_view3d/view3d_intern.h @@ -109,7 +109,7 @@ void draw_object_backbufsel(Scene *scene, View3D *v3d, RegionView3D *rv3d, struc void drawaxes(float size, char drawtype); void view3d_cached_text_draw_begin(void); -void view3d_cached_text_draw_add(float x, float y, float z, char *str, short xoffs, short flag); +void view3d_cached_text_draw_add(const float co[3], const char *str, short xoffs, short flag); void view3d_cached_text_draw_end(View3D *v3d, ARegion *ar, int depth_write, float mat[][4]); #define V3D_CACHE_TEXT_ZBUF 1 #define V3D_CACHE_TEXT_WORLDSPACE 2 @@ -131,6 +131,8 @@ void add_view3d_after(ListBase *lb, Base *base, int flag); void circf(float x, float y, float rad); void circ(float x, float y, float rad); void view3d_update_depths(struct ARegion *ar); +void view3d_update_depths_rect(struct ARegion *ar, struct ViewDepths *d, struct rcti *rect); +float view3d_depth_near(struct ViewDepths *d); /* view3d_select.c */ void VIEW3D_OT_select(struct wmOperatorType *ot); diff --git a/source/blender/editors/space_view3d/view3d_snap.c b/source/blender/editors/space_view3d/view3d_snap.c index d6778070931..9f6054a5d4f 100644 --- a/source/blender/editors/space_view3d/view3d_snap.c +++ b/source/blender/editors/space_view3d/view3d_snap.c @@ -921,7 +921,7 @@ void VIEW3D_OT_snap_cursor_to_center(wmOperatorType *ot) /* api callbacks */ ot->exec= snap_curs_to_center; - ot->poll= ED_operator_view3d_active; + ot->poll= ED_operator_view3d_active; /* flags */ ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; diff --git a/source/blender/editors/space_view3d/view3d_view.c b/source/blender/editors/space_view3d/view3d_view.c index 8b3d99e355d..15e04f31f2f 100644 --- a/source/blender/editors/space_view3d/view3d_view.c +++ b/source/blender/editors/space_view3d/view3d_view.c @@ -2282,30 +2282,32 @@ static void flyEvent(FlyInfo *fly, wmEvent *event) /* impliment WASD keys */ case FLY_MODAL_DIR_FORWARD: if (fly->speed < 0.0f) fly->speed= -fly->speed; /* flip speed rather then stopping, game like motion */ - else fly->speed += fly->grid; /* increse like mousewheel if were already moving in that difection*/ + else if (fly->axis==2) fly->speed += fly->grid; /* increse like mousewheel if were already moving in that difection*/ fly->axis= 2; break; case FLY_MODAL_DIR_BACKWARD: - if (fly->speed>0) fly->speed= -fly->speed; - else fly->speed -= fly->grid; + if (fly->speed > 0.0f) fly->speed= -fly->speed; + else if (fly->axis==2) fly->speed -= fly->grid; fly->axis= 2; break; case FLY_MODAL_DIR_LEFT: if (fly->speed < 0.0f) fly->speed= -fly->speed; + else if (fly->axis==0) fly->speed += fly->grid; fly->axis= 0; break; case FLY_MODAL_DIR_RIGHT: if (fly->speed > 0.0f) fly->speed= -fly->speed; + else if (fly->axis==0) fly->speed -= fly->grid; fly->axis= 0; break; - - case FLY_MODAL_DIR_UP: - if (fly->speed > 0.0f) fly->speed= -fly->speed; - fly->axis= 1; - break; - case FLY_MODAL_DIR_DOWN: if (fly->speed < 0.0f) fly->speed= -fly->speed; + else if (fly->axis==1) fly->speed += fly->grid; + fly->axis= 1; + break; + case FLY_MODAL_DIR_UP: + if (fly->speed > 0.0f) fly->speed= -fly->speed; + else if (fly->axis==1) fly->speed -= fly->grid; fly->axis= 1; break; diff --git a/source/blender/editors/transform/CMakeLists.txt b/source/blender/editors/transform/CMakeLists.txt index e28ed89c80c..61508a48ecd 100644 --- a/source/blender/editors/transform/CMakeLists.txt +++ b/source/blender/editors/transform/CMakeLists.txt @@ -19,8 +19,6 @@ # # ***** END GPL LICENSE BLOCK ***** -FILE(GLOB SRC *.c) - SET(INC ../include ../../blenkernel @@ -31,4 +29,17 @@ SET(INC ../../../../intern/guardedalloc ) +SET(SRC + transform.c + transform_constraints.c + transform_conversions.c + transform_generics.c + transform_input.c + transform_manipulator.c + transform_ndofinput.c + transform_ops.c + transform_orientations.c + transform_snap.c +) + BLENDERLIB(bf_editor_transform "${SRC}" "${INC}") diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c index ec8121739c4..4c6fb887ebc 100644 --- a/source/blender/editors/transform/transform.c +++ b/source/blender/editors/transform/transform.c @@ -2916,9 +2916,19 @@ static void ElementRotation(TransInfo *t, TransData *td, float mat[3][3], short sub_v3_v3v3(vec, vec, td->center); // Translation needed from the initial location - mul_m3_v3(pmtx, vec); // To Global space - mul_m3_v3(td->smtx, vec);// To Pose space - + /* special exception, see TD_PBONE_LOCAL_MTX definition comments */ + if(td->flag & TD_PBONE_LOCAL_MTX_P) { + /* do nothing */ + } + else if (td->flag & TD_PBONE_LOCAL_MTX_C) { + mul_m3_v3(pmtx, vec); // To Global space + mul_m3_v3(td->ext->l_smtx, vec);// To Pose space (Local Location) + } + else { + mul_m3_v3(pmtx, vec); // To Global space + mul_m3_v3(td->smtx, vec);// To Pose space + } + protectedTransBits(td->protectflag, vec); add_v3_v3v3(td->loc, td->iloc, vec); @@ -3017,7 +3027,7 @@ static void ElementRotation(TransInfo *t, TransData *td, float mat[3][3], short mat3_to_quat( quat,fmat); // Actual transform mul_qt_qtqt(tquat, quat, iquat); - quat_to_axis_angle( td->ext->rotAxis, td->ext->rotAngle,quat); + quat_to_axis_angle( td->ext->rotAxis, td->ext->rotAngle,tquat); /* this function works on end result */ protectedAxisAngleBits(td->protectflag, td->ext->rotAxis, td->ext->rotAngle, td->ext->irotAxis, td->ext->irotAngle); @@ -4563,7 +4573,26 @@ static int createSlideVerts(TransInfo *t) start[0] = t->mval[0]; start[1] = t->mval[1]; add_v3_v3v3(end, start, vec); - + + + /* Ensure minimum screen distance, when looking top down on edge loops */ +#define EDGE_SLIDE_MIN 30 + if (len_squared_v2v2(start, end) < (EDGE_SLIDE_MIN * EDGE_SLIDE_MIN)) { + if(ABS(start[0]-end[0]) + ABS(start[1]-end[1]) < 4.0f) { + /* even more exceptional case, points are ontop of eachother */ + end[0]= start[0]; + end[1]= start[1] + EDGE_SLIDE_MIN; + } + else { + sub_v2_v2(end, start); + normalize_v2(end); + mul_v2_fl(end, EDGE_SLIDE_MIN); + add_v2_v2(end, start); + } + } +#undef EDGE_SLIDE_MIN + + sld->start[0] = (short) start[0]; sld->start[1] = (short) start[1]; sld->end[0] = (short) end[0]; diff --git a/source/blender/editors/transform/transform.h b/source/blender/editors/transform/transform.h index bb6ffe9155f..49ce4d2e0dd 100644 --- a/source/blender/editors/transform/transform.h +++ b/source/blender/editors/transform/transform.h @@ -131,8 +131,8 @@ typedef struct TransCon { typedef struct TransDataExtension { float drot[3]; /* Initial object drot */ - float drotAngle; /* Initial object drotAngle */ - float drotAxis[3]; /* Initial object drotAxis */ + // float drotAngle; /* Initial object drotAngle, TODO: not yet implimented */ + // float drotAxis[3]; /* Initial object drotAxis, TODO: not yet implimented */ float dquat[4]; /* Initial object dquat */ float dsize[3]; /* Initial object dsize */ float *rot; /* Rotation of the data to transform (Faculative) */ @@ -146,6 +146,7 @@ typedef struct TransDataExtension { float *size; /* Size of the data to transform (Faculative) */ float isize[3]; /* Initial size */ float obmat[4][4]; /* Object matrix */ + float l_smtx[3][3]; /* use instead of td->smtx, It is the same but without the 'bone->bone_mat', see TD_PBONE_LOCAL_MTX_C */ } TransDataExtension; typedef struct TransData2D { @@ -432,6 +433,8 @@ typedef struct TransInfo { #define TD_MIRROR_EDGE (1 << 16) /* For editmode mirror, clamp to x = 0 */ #define TD_MOVEHANDLE1 (1 << 17) /* For fcurve handles, move them along with their keyframes */ #define TD_MOVEHANDLE2 (1 << 18) +#define TD_PBONE_LOCAL_MTX_P (1 << 19) /* exceptional case with pose bone rotating when a parent bone has 'Local Location' option enabled and rotating also transforms it. */ +#define TD_PBONE_LOCAL_MTX_C (1 << 20) /* same as above but for a child bone */ /* transsnap->status */ #define SNAP_FORCED 1 diff --git a/source/blender/editors/transform/transform_conversions.c b/source/blender/editors/transform/transform_conversions.c index d723f77f537..818e5c2df66 100644 --- a/source/blender/editors/transform/transform_conversions.c +++ b/source/blender/editors/transform/transform_conversions.c @@ -554,7 +554,7 @@ static void add_pose_transdata(TransInfo *t, bPoseChannel *pchan, Object *ob, Tr /* proper way to get parent transform + own transform + constraints transform */ copy_m3_m4(omat, ob->obmat); - if (t->mode==TFM_TRANSLATION && (pchan->bone->flag & BONE_NO_LOCAL_LOCATION)) + if (ELEM(t->mode, TFM_TRANSLATION, TFM_RESIZE) && (pchan->bone->flag & BONE_NO_LOCAL_LOCATION)) unit_m3(bmat); else copy_m3_m3(bmat, pchan->bone->bone_mat); @@ -585,6 +585,19 @@ static void add_pose_transdata(TransInfo *t, bPoseChannel *pchan, Object *ob, Tr invert_m3_m3(td->smtx, td->mtx); + /* exceptional case: rotate the pose bone which also applies transformation + * when a parentless bone has BONE_NO_LOCAL_LOCATION [] */ + if (!ELEM(t->mode, TFM_TRANSLATION, TFM_RESIZE) && (pchan->bone->flag & BONE_NO_LOCAL_LOCATION)) { + if(pchan->parent) { + /* same as td->smtx but without pchan->bone->bone_mat */ + td->flag |= TD_PBONE_LOCAL_MTX_C; + mul_m3_m3m3(td->ext->l_smtx, pchan->bone->bone_mat, td->smtx); + } + else { + td->flag |= TD_PBONE_LOCAL_MTX_P; + } + } + /* for axismat we use bone's own transform */ copy_m3_m4(pmat, pchan->pose_mat); mul_m3_m3m3(td->axismtx, omat, pmat); @@ -1403,7 +1416,7 @@ static void createTransCurveVerts(bContext *C, TransInfo *t) ) { VECCOPY(td->iloc, bezt->vec[0]); td->loc= bezt->vec[0]; - VECCOPY(td->center, bezt->vec[1]); + VECCOPY(td->center, bezt->vec[(hide_handles || bezt->f2 & SELECT) ? 1:0]); if (hide_handles) { if(bezt->f2 & SELECT) td->flag= TD_SELECTED; else td->flag= 0; @@ -1462,7 +1475,7 @@ static void createTransCurveVerts(bContext *C, TransInfo *t) ) { VECCOPY(td->iloc, bezt->vec[2]); td->loc= bezt->vec[2]; - VECCOPY(td->center, bezt->vec[1]); + VECCOPY(td->center, bezt->vec[(hide_handles || bezt->f2 & SELECT) ? 1:2]); if (hide_handles) { if(bezt->f2 & SELECT) td->flag= TD_SELECTED; else td->flag= 0; @@ -4298,8 +4311,8 @@ static void ObjectToTransData(TransInfo *t, TransData *td, Object *ob) td->ext->irotAngle= ob->rotAngle; VECCOPY(td->ext->irotAxis, ob->rotAxis); - td->ext->drotAngle= ob->drotAngle; - VECCOPY(td->ext->drotAxis, ob->drotAxis); + // td->ext->drotAngle= ob->drotAngle; // XXX, not implimented + // VECCOPY(td->ext->drotAxis, ob->drotAxis); // XXX, not implimented } else { td->ext->rot= NULL; diff --git a/source/blender/editors/transform/transform_generics.c b/source/blender/editors/transform/transform_generics.c index c473d6395ec..cd40cb3bb25 100644 --- a/source/blender/editors/transform/transform_generics.c +++ b/source/blender/editors/transform/transform_generics.c @@ -1177,6 +1177,13 @@ static void restoreElement(TransData *td) { if (td->ext->rot) { VECCOPY(td->ext->rot, td->ext->irot); } + if(td->ext->rotAngle) { + *td->ext->rotAngle= td->ext->irotAngle; + } + if(td->ext->rotAxis) { + VECCOPY(td->ext->rotAxis, td->ext->irotAxis); + } + /* XXX, drotAngle & drotAxis not used yet */ if (td->ext->size) { VECCOPY(td->ext->size, td->ext->isize); } diff --git a/source/blender/editors/transform/transform_manipulator.c b/source/blender/editors/transform/transform_manipulator.c index 030ad190dc3..f3afd5793bc 100644 --- a/source/blender/editors/transform/transform_manipulator.c +++ b/source/blender/editors/transform/transform_manipulator.c @@ -308,7 +308,7 @@ int calc_manipulator_stats(const bContext *C) while(a--) { /* exceptions * if handles are hidden then only check the center points. - * If 2 or more are selected then only use the center point too. + * If the center knot is selected then only use this as the center point. */ if (cu->drawflag & CU_HIDE_HANDLES) { if (bezt->f2 & SELECT) { @@ -316,7 +316,7 @@ int calc_manipulator_stats(const bContext *C) totsel++; } } - else if ( (bezt->f1 & SELECT) + (bezt->f2 & SELECT) + (bezt->f3 & SELECT) > SELECT ) { + else if (bezt->f2 & SELECT) { calc_tw_center(scene, bezt->vec[1]); totsel++; } @@ -325,10 +325,6 @@ int calc_manipulator_stats(const bContext *C) calc_tw_center(scene, bezt->vec[0]); totsel++; } - if(bezt->f2) { - calc_tw_center(scene, bezt->vec[1]); - totsel++; - } if(bezt->f3) { calc_tw_center(scene, bezt->vec[2]); totsel++; diff --git a/source/blender/editors/util/CMakeLists.txt b/source/blender/editors/util/CMakeLists.txt index be700b17b7a..99f0d4bc2b2 100644 --- a/source/blender/editors/util/CMakeLists.txt +++ b/source/blender/editors/util/CMakeLists.txt @@ -19,8 +19,6 @@ # # ***** END GPL LICENSE BLOCK ***** -FILE(GLOB SRC *.c) - SET(INC ../include ../../blenkernel @@ -31,4 +29,11 @@ SET(INC ../../../../intern/guardedalloc ) +SET(SRC + ed_util.c + editmode_undo.c + numinput.c + undo.c +) + BLENDERLIB(bf_editor_util "${SRC}" "${INC}") diff --git a/source/blender/editors/uvedit/CMakeLists.txt b/source/blender/editors/uvedit/CMakeLists.txt index 36cd1274ec7..33251cc6344 100644 --- a/source/blender/editors/uvedit/CMakeLists.txt +++ b/source/blender/editors/uvedit/CMakeLists.txt @@ -19,8 +19,6 @@ # # ***** END GPL LICENSE BLOCK ***** -FILE(GLOB SRC *.c) - SET(INC ../include ../../blenkernel @@ -32,4 +30,11 @@ SET(INC ../../../../intern/opennl/extern ) +SET(SRC + uvedit_draw.c + uvedit_ops.c + uvedit_parametrizer.c + uvedit_unwrap_ops.c +) + BLENDERLIB(bf_editor_uvedit "${SRC}" "${INC}") diff --git a/source/blender/gpu/CMakeLists.txt b/source/blender/gpu/CMakeLists.txt index 5de7b0c5281..02a43abf098 100644 --- a/source/blender/gpu/CMakeLists.txt +++ b/source/blender/gpu/CMakeLists.txt @@ -24,8 +24,6 @@ # # ***** END GPL LICENSE BLOCK ***** -FILE(GLOB SRC intern/*.c) - SET(INC . ../blenlib @@ -39,6 +37,16 @@ SET(INC ../../../intern/smoke/extern ) +SET(SRC + intern/gpu_buffers.c + intern/gpu_codegen.c + intern/gpu_draw.c + intern/gpu_extensions.c + intern/gpu_material.c + intern/gpu_shader_material.glsl.c + intern/gpu_shader_vertex.glsl.c +) + IF(WIN32) INCLUDE_DIRECTORIES(${PTHREADS_INC}) ENDIF(WIN32) diff --git a/source/blender/gpu/intern/gpu_extensions.c b/source/blender/gpu/intern/gpu_extensions.c index c6b8a43918c..70a74aafead 100644 --- a/source/blender/gpu/intern/gpu_extensions.c +++ b/source/blender/gpu/intern/gpu_extensions.c @@ -91,6 +91,11 @@ void GPU_extensions_init() GLint r, g, b; const char *vendor, *renderer; + /* can't avoid calling this multiple times, see wm_window_add_ghostwindow */ + static char init= 0; + if(init) return; + init= 1; + glewInit(); /* glewIsSupported("GL_VERSION_2_0") */ @@ -130,7 +135,7 @@ void GPU_extensions_init() GG.device = GPU_DEVICE_ATI; GG.driver = GPU_DRIVER_OPENSOURCE; } - else if(strstr(renderer, "Nouveau")) { + else if(strstr(renderer, "Nouveau") || strstr(vendor, "nouveau")) { GG.device = GPU_DEVICE_NVIDIA; GG.driver = GPU_DRIVER_OPENSOURCE; } diff --git a/source/blender/ikplugin/CMakeLists.txt b/source/blender/ikplugin/CMakeLists.txt index 79f33effb87..61d5ff4f7fe 100644 --- a/source/blender/ikplugin/CMakeLists.txt +++ b/source/blender/ikplugin/CMakeLists.txt @@ -24,12 +24,6 @@ # # ***** END GPL LICENSE BLOCK ***** - -SET(SRC - ./intern/ikplugin_api.c - ./intern/iksolver_plugin.c -) - SET(INC ../blenlib ../makesdna @@ -40,6 +34,11 @@ SET(INC ../../../intern/iksolver/extern ) +SET(SRC + ./intern/ikplugin_api.c + ./intern/iksolver_plugin.c +) + IF(WITH_IK_ITASC) ADD_DEFINITIONS(-DWITH_IK_ITASC) LIST(APPEND INC ../../../extern/Eigen2) diff --git a/source/blender/imbuf/CMakeLists.txt b/source/blender/imbuf/CMakeLists.txt index 699ed6e1b00..f89ef033d78 100644 --- a/source/blender/imbuf/CMakeLists.txt +++ b/source/blender/imbuf/CMakeLists.txt @@ -24,9 +24,6 @@ # # ***** END GPL LICENSE BLOCK ***** -FILE(GLOB SRC intern/*.c) - - SET(INC . ../avi @@ -40,6 +37,35 @@ SET(INC ${ZLIB_INC} ) +SET(SRC + intern/allocimbuf.c + intern/anim_movie.c + intern/bmp.c + intern/cache.c + intern/divers.c + intern/filetype.c + intern/filter.c + intern/imageprocess.c + intern/iris.c + intern/jp2.c + intern/jpeg.c + intern/md5.c + intern/metadata.c + intern/module.c + intern/png.c + intern/radiance_hdr.c + intern/readimage.c + intern/rectop.c + intern/rotate.c + intern/scaling.c + intern/targa.c + intern/thumbs.c + intern/thumbs_blend.c + intern/tiff.c + intern/util.c + intern/writeimage.c +) + IF(WIN32) LIST(APPEND INC ${PTHREADS_INC}) ENDIF(WIN32) diff --git a/source/blender/imbuf/IMB_imbuf_types.h b/source/blender/imbuf/IMB_imbuf_types.h index 5fbdcf95f13..a12976fa813 100644 --- a/source/blender/imbuf/IMB_imbuf_types.h +++ b/source/blender/imbuf/IMB_imbuf_types.h @@ -71,7 +71,11 @@ typedef struct ImBuf { struct ImBuf *next, *prev; /**< allow lists of ImBufs, for caches or flipbooks */ /* dimensions */ - unsigned int x, y; /* width and Height of our image buffer */ + int x, y; /* width and Height of our image buffer. + * Should be 'unsigned int' since most formats use this. + * but this is problematic with texture math in imagetexture.c + * avoid problems and use int. - campbell */ + unsigned char depth; /* Active amount of bits/bitplanes */ int channels; /* amount of channels in rect_float (0 = 4 channel default) */ diff --git a/source/blender/imbuf/intern/anim.c b/source/blender/imbuf/intern/anim_movie.c index 8df0d69bcfa..8df0d69bcfa 100644 --- a/source/blender/imbuf/intern/anim.c +++ b/source/blender/imbuf/intern/anim_movie.c diff --git a/source/blender/imbuf/intern/cineon/CMakeLists.txt b/source/blender/imbuf/intern/cineon/CMakeLists.txt index 5633d2a66f6..a39235b20ec 100644 --- a/source/blender/imbuf/intern/cineon/CMakeLists.txt +++ b/source/blender/imbuf/intern/cineon/CMakeLists.txt @@ -24,17 +24,24 @@ # # ***** END GPL LICENSE BLOCK ***** -FILE(GLOB SRC *.c) - SET(INC . + intern/include .. ../../ - intern/include ../../../blenkernel ../../../blenlib ../../../makesdna ../../../../../intern/guardedalloc ) +SET(SRC + cineon_dpx.c + cineonlib.c + dpxlib.c + logImageCore.c + logImageLib.c + logmemfile.c +) + BLENDERLIB(bf_cineon "${SRC}" "${INC}") diff --git a/source/blender/imbuf/intern/dds/CMakeLists.txt b/source/blender/imbuf/intern/dds/CMakeLists.txt index 620d4041703..78513b35b87 100644 --- a/source/blender/imbuf/intern/dds/CMakeLists.txt +++ b/source/blender/imbuf/intern/dds/CMakeLists.txt @@ -24,8 +24,6 @@ # # ***** END GPL LICENSE BLOCK ***** -FILE (GLOB SRC *.cpp) - SET(INC . .. @@ -37,6 +35,15 @@ SET(INC ../../../../../intern/guardedalloc ) +SET(SRC + BlockDXT.cpp + ColorBlock.cpp + DirectDrawSurface.cpp + Image.cpp + Stream.cpp + dds_api.cpp +) + if(WITH_IMAGE_DDS) ADD_DEFINITIONS(-DWITH_DDS) ENDIF(WITH_IMAGE_DDS) diff --git a/source/blender/imbuf/intern/openexr/CMakeLists.txt b/source/blender/imbuf/intern/openexr/CMakeLists.txt index cfc977ff155..836958f4b09 100644 --- a/source/blender/imbuf/intern/openexr/CMakeLists.txt +++ b/source/blender/imbuf/intern/openexr/CMakeLists.txt @@ -24,8 +24,6 @@ # # ***** END GPL LICENSE BLOCK ***** -SET(SRC openexr_api.cpp) - SET(INC . ../../../blenkernel @@ -38,6 +36,10 @@ SET(INC ${OPENEXR_INC} ) +SET(SRC + openexr_api.cpp +) + IF(WITH_IMAGE_OPENEXR) ADD_DEFINITIONS(-DWITH_OPENEXR) ENDIF(WITH_IMAGE_OPENEXR) diff --git a/source/blender/makesdna/DNA_armature_types.h b/source/blender/makesdna/DNA_armature_types.h index f7533ff9bde..b244d8277a7 100644 --- a/source/blender/makesdna/DNA_armature_types.h +++ b/source/blender/makesdna/DNA_armature_types.h @@ -91,7 +91,7 @@ typedef struct bArmature { int pad; - int layer, layer_protected; /* for buttons to work, both variables in this order together */ + unsigned int layer, layer_protected; /* for buttons to work, both variables in this order together */ // XXX depreceated... old animaton system (armature only viz) --- short ghostep, ghostsize; /* number of frames to ghosts to show, and step between them */ diff --git a/source/blender/makesdna/DNA_modifier_types.h b/source/blender/makesdna/DNA_modifier_types.h index 27f9c9cd5f3..0708698c40c 100644 --- a/source/blender/makesdna/DNA_modifier_types.h +++ b/source/blender/makesdna/DNA_modifier_types.h @@ -220,7 +220,8 @@ typedef struct ArrayModifierData { typedef struct MirrorModifierData { ModifierData modifier; - short axis, flag; + short axis; /* deprecated, use flag instead */ + short flag; float tolerance; struct Object *mirror_ob; } MirrorModifierData; diff --git a/source/blender/makesdna/DNA_vfont_types.h b/source/blender/makesdna/DNA_vfont_types.h index 0ea60c732cf..e342ef1cd79 100644 --- a/source/blender/makesdna/DNA_vfont_types.h +++ b/source/blender/makesdna/DNA_vfont_types.h @@ -55,5 +55,6 @@ typedef struct VFont { #define FO_PAGEDOWN 9 #define FO_SELCHANGE 10 +#define FO_BUILTIN_NAME "<builtin>" #endif diff --git a/source/blender/makesdna/DNA_view3d_types.h b/source/blender/makesdna/DNA_view3d_types.h index 8c23ef94faf..9de5ad198a6 100644 --- a/source/blender/makesdna/DNA_view3d_types.h +++ b/source/blender/makesdna/DNA_view3d_types.h @@ -153,7 +153,8 @@ typedef struct View3D { char ob_centre_bone[32]; /* optional string for armature bone to define center */ - int lay, layact; + unsigned int lay; + int layact; /** * The drawing mode for the 3d display. Set to OB_WIRE, OB_SOLID, diff --git a/source/blender/makesrna/intern/CMakeLists.txt b/source/blender/makesrna/intern/CMakeLists.txt index 0df9ce877cb..50704b4c45a 100644 --- a/source/blender/makesrna/intern/CMakeLists.txt +++ b/source/blender/makesrna/intern/CMakeLists.txt @@ -24,8 +24,8 @@ # # ***** END GPL LICENSE BLOCK ***** -# this warning on generated files gets annoying -STRING(REGEX REPLACE "-Wunused-parameter" "" CMAKE_C_FLAGS ${CMAKE_C_FLAGS}) +# Generated code has some unused vars we can ignore. +REMOVE_STRICT_FLAGS() FILE(GLOB DEFSRC RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "*.c") FILE(GLOB APISRC RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "*_api.c") @@ -113,9 +113,9 @@ IF(WITH_LCMS) ADD_DEFINITIONS(-DWITH_LCMS) ENDIF(WITH_LCMS) -IF(NOT WITH_FLUID) +IF(NOT WITH_MOD_FLUID) ADD_DEFINITIONS(-DDISABLE_ELBEEM) -ENDIF(NOT WITH_FLUID) +ENDIF(NOT WITH_MOD_FLUID) IF(WITH_FFTW3) ADD_DEFINITIONS(-DFFTW3=1) diff --git a/source/blender/makesrna/intern/rna_ID.c b/source/blender/makesrna/intern/rna_ID.c index 8681067061a..e885fad6b8e 100644 --- a/source/blender/makesrna/intern/rna_ID.c +++ b/source/blender/makesrna/intern/rna_ID.c @@ -29,6 +29,7 @@ #include "RNA_define.h" #include "DNA_ID.h" +#include "DNA_vfont_types.h" #include "WM_types.h" @@ -99,7 +100,8 @@ static int rna_ID_name_editable(PointerRNA *ptr) ID *id= (ID*)ptr->data; if (GS(id->name) == ID_VF) { - if (strcmp(id->name+2, "<builtin>")==0) + VFont *vf= (VFont *)id; + if (strcmp(vf->name, FO_BUILTIN_NAME)==0) return 0; } diff --git a/source/blender/makesrna/intern/rna_armature.c b/source/blender/makesrna/intern/rna_armature.c index d42cf625898..25ac6f5e558 100644 --- a/source/blender/makesrna/intern/rna_armature.c +++ b/source/blender/makesrna/intern/rna_armature.c @@ -414,7 +414,7 @@ static void rna_def_bone_common(StructRNA *srna, int editbone) RNA_def_property_ui_text(prop, "Connected", "When bone has a parent, bone's head is struck to the parent's tail"); RNA_def_property_update(prop, 0, "rna_Armature_update_data"); - prop= RNA_def_property(srna, "use_hinge", PROP_BOOLEAN, PROP_NONE); + prop= RNA_def_property(srna, "use_inherit_rotation", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", BONE_HINGE); RNA_def_property_ui_text(prop, "Inherit Rotation", "Bone inherits rotation or scale from parent bone"); RNA_def_property_update(prop, 0, "rna_Armature_update_data"); diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c index d4dec9277a1..70ccd4f8a6e 100644 --- a/source/blender/makesrna/intern/rna_space.c +++ b/source/blender/makesrna/intern/rna_space.c @@ -373,6 +373,8 @@ static PointerRNA rna_SpaceImageEditor_uvedit_get(PointerRNA *ptr) static void rna_SpaceImageEditor_paint_update(Main *bmain, Scene *scene, PointerRNA *ptr) { paint_init(&scene->toolsettings->imapaint.paint, PAINT_CURSOR_TEXTURE_PAINT); + + ED_space_image_paint_update(bmain->wm.first, scene->toolsettings); } static int rna_SpaceImageEditor_show_render_get(PointerRNA *ptr) diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c index 4196b3585b3..b00afa73ca9 100644 --- a/source/blender/makesrna/intern/rna_userdef.c +++ b/source/blender/makesrna/intern/rna_userdef.c @@ -2094,7 +2094,7 @@ static void rna_def_userdef_edit(BlenderRNA *brna) prop= RNA_def_property(srna, "use_drag_immediately", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", USER_RELEASECONFIRM); - RNA_def_property_ui_text(prop, "Release confirm", "Moving things with a mouse drag confirms when releasing the button"); + RNA_def_property_ui_text(prop, "Release confirms", "Moving things with a mouse drag confirms when releasing the button"); /* Undo */ prop= RNA_def_property(srna, "undo_steps", PROP_INT, PROP_NONE); diff --git a/source/blender/makesrna/intern/rna_wm.c b/source/blender/makesrna/intern/rna_wm.c index 7e54a3b14fa..1bc22b7af25 100644 --- a/source/blender/makesrna/intern/rna_wm.c +++ b/source/blender/makesrna/intern/rna_wm.c @@ -829,6 +829,9 @@ static StructRNA *rna_Operator_register(const bContext *C, ReportList *reports, dummyot.description= _operator_descr; /* only assigne the pointer, string is NULL'd */ RNA_pointer_create(NULL, &RNA_Operator, &dummyop, &dummyotr); + /* clear incase they are left unset */ + _operator_idname[0]= _operator_name[0]= _operator_descr[0]= '\0'; + /* validate the python class */ if(validate(&dummyotr, data, have_function) != 0) return NULL; @@ -1096,7 +1099,7 @@ static void rna_def_operator(BlenderRNA *brna) prop= RNA_def_property(srna, "bl_description", PROP_STRING, PROP_NONE); RNA_def_property_string_sdna(prop, NULL, "type->description"); RNA_def_property_string_maxlength(prop, 1024); /* else it uses the pointer size! */ - RNA_def_property_flag(prop, PROP_REGISTER); + RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL); prop= RNA_def_property(srna, "bl_options", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "type->flag"); @@ -1151,7 +1154,7 @@ static void rna_def_macro_operator(BlenderRNA *brna) prop= RNA_def_property(srna, "bl_description", PROP_STRING, PROP_NONE); RNA_def_property_string_sdna(prop, NULL, "type->description"); RNA_def_property_string_maxlength(prop, 1024); /* else it uses the pointer size! */ - RNA_def_property_flag(prop, PROP_REGISTER); + RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL); prop= RNA_def_property(srna, "bl_options", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "type->flag"); diff --git a/source/blender/modifiers/CMakeLists.txt b/source/blender/modifiers/CMakeLists.txt index b6dcc9c03f9..7524244c701 100644 --- a/source/blender/modifiers/CMakeLists.txt +++ b/source/blender/modifiers/CMakeLists.txt @@ -24,8 +24,6 @@ # # ***** END GPL LICENSE BLOCK ***** -FILE(GLOB SRC intern/*.c) - SET(INC . ./intern ../blenlib @@ -33,16 +31,64 @@ SET(INC ../blenkernel ../blenkernel/intern ../render/extern/include - ../../../intern/guardedalloc - ../../../intern/decimation/extern + ../../../intern/guardedalloc ../../../intern/elbeem/extern - ../../../intern/bsp/extern ${ZLIB_INC} ) -IF(NOT WITH_FLUID) +SET(SRC + intern/MOD_armature.c + intern/MOD_array.c + intern/MOD_bevel.c + intern/MOD_boolean.c + intern/MOD_build.c + intern/MOD_cast.c + intern/MOD_cloth.c + intern/MOD_collision.c + intern/MOD_curve.c + intern/MOD_decimate.c + intern/MOD_displace.c + intern/MOD_edgesplit.c + intern/MOD_explode.c + intern/MOD_fluidsim.c + intern/MOD_fluidsim_util.c + intern/MOD_hook.c + intern/MOD_lattice.c + intern/MOD_mask.c + intern/MOD_meshdeform.c + intern/MOD_mirror.c + intern/MOD_multires.c + intern/MOD_none.c + intern/MOD_particleinstance.c + intern/MOD_particlesystem.c + intern/MOD_screw.c + intern/MOD_shapekey.c + intern/MOD_shrinkwrap.c + intern/MOD_simpledeform.c + intern/MOD_smoke.c + intern/MOD_smooth.c + intern/MOD_softbody.c + intern/MOD_solidify.c + intern/MOD_subsurf.c + intern/MOD_surface.c + intern/MOD_util.c + intern/MOD_uvproject.c + intern/MOD_wave.c +) + +IF(WITH_MOD_BOOLEAN) + ADD_DEFINITIONS(-DWITH_MOD_BOOLEAN) + LIST(APPEND SRC intern/MOD_boolean_util.c) + LIST(APPEND INC ../../../intern/bsp/extern) +ENDIF(WITH_MOD_BOOLEAN) + +IF(WITH_MOD_DECIMATE) + ADD_DEFINITIONS(-DWITH_MOD_DECIMATE) + LIST(APPEND INC ../../../intern/decimation/extern) +ENDIF(WITH_MOD_DECIMATE) + +IF(NOT WITH_MOD_FLUID) ADD_DEFINITIONS(-DDISABLE_ELBEEM) -ENDIF(NOT WITH_FLUID) +ENDIF(NOT WITH_MOD_FLUID) BLENDERLIB(bf_modifiers "${SRC}" "${INC}") - diff --git a/source/blender/modifiers/Makefile b/source/blender/modifiers/Makefile index ddcddb90186..2115e8ac888 100644 --- a/source/blender/modifiers/Makefile +++ b/source/blender/modifiers/Makefile @@ -30,5 +30,5 @@ SOURCEDIR = source/blender/modifiers DIRS = intern - +CFLAGS += -DWITH_MOD_BOOLEAN -DWITH_MOD_BOOLEAN include nan_subdirs.mk diff --git a/source/blender/modifiers/SConscript b/source/blender/modifiers/SConscript index 7aa198f51f0..8d420fcb3b7 100644 --- a/source/blender/modifiers/SConscript +++ b/source/blender/modifiers/SConscript @@ -12,6 +12,10 @@ incs += ' ' + env['BF_ZLIB_INC'] defs = [] +# could be made optional +defs += ['WITH_MOD_BOOLEAN'] +defs += ['WITH_MOD_DECIMATE'] + if env['BF_NO_ELBEEM']: defs.append('DISABLE_ELBEEM') diff --git a/source/blender/modifiers/intern/MOD_armature.c b/source/blender/modifiers/intern/MOD_armature.c index 2f802ee67c8..71be58c9982 100644 --- a/source/blender/modifiers/intern/MOD_armature.c +++ b/source/blender/modifiers/intern/MOD_armature.c @@ -69,7 +69,7 @@ static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *UNUSED( CustomDataMask dataMask = 0; /* ask for vertexgroups */ - dataMask |= (1 << CD_MDEFORMVERT); + dataMask |= CD_MASK_MDEFORMVERT; return dataMask; } diff --git a/source/blender/modifiers/intern/MOD_array.c b/source/blender/modifiers/intern/MOD_array.c index 839bfef6226..9916afcfe55 100644 --- a/source/blender/modifiers/intern/MOD_array.c +++ b/source/blender/modifiers/intern/MOD_array.c @@ -729,26 +729,27 @@ static DerivedMesh *arrayModifier_doArray(ArrayModifierData *amd, return result; } -static DerivedMesh *applyModifier( - ModifierData *md, Object *ob, DerivedMesh *derivedData, - int UNUSED(useRenderParams), int UNUSED(isFinalCalc)) +static DerivedMesh *applyModifier(ModifierData *md, Object *ob, + DerivedMesh *dm, + int UNUSED(useRenderParams), + int UNUSED(isFinalCalc)) { DerivedMesh *result; ArrayModifierData *amd = (ArrayModifierData*) md; - result = arrayModifier_doArray(amd, md->scene, ob, derivedData, 0); + result = arrayModifier_doArray(amd, md->scene, ob, dm, 0); - if(result != derivedData) + if(result != dm) CDDM_calc_normals(result); return result; } -static DerivedMesh *applyModifierEM( - ModifierData *md, Object *ob, struct EditMesh *UNUSED(editData), - DerivedMesh *derivedData) +static DerivedMesh *applyModifierEM(ModifierData *md, Object *ob, + struct EditMesh *UNUSED(editData), + DerivedMesh *dm) { - return applyModifier(md, ob, derivedData, 0, 1); + return applyModifier(md, ob, dm, 0, 1); } diff --git a/source/blender/modifiers/intern/MOD_bevel.c b/source/blender/modifiers/intern/MOD_bevel.c index 937c8cd7eac..a21d27180ba 100644 --- a/source/blender/modifiers/intern/MOD_bevel.c +++ b/source/blender/modifiers/intern/MOD_bevel.c @@ -72,7 +72,7 @@ static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md) CustomDataMask dataMask = 0; /* ask for vertexgroups if we need them */ - if(bmd->defgrp_name[0]) dataMask |= (1 << CD_MDEFORMVERT); + if(bmd->defgrp_name[0]) dataMask |= CD_MASK_MDEFORMVERT; return dataMask; } diff --git a/source/blender/modifiers/intern/MOD_boolean.c b/source/blender/modifiers/intern/MOD_boolean.c index dfcfd55f3d9..07300065659 100644 --- a/source/blender/modifiers/intern/MOD_boolean.c +++ b/source/blender/modifiers/intern/MOD_boolean.c @@ -82,7 +82,7 @@ static void updateDepgraph(ModifierData *md, DagForest *forest, } } - +#ifdef WITH_MOD_BOOLEAN static DerivedMesh *applyModifier(ModifierData *md, Object *ob, DerivedMesh *derivedData, int UNUSED(useRenderParams), @@ -107,12 +107,21 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, return derivedData; } +#else // WITH_MOD_BOOLEAN +static DerivedMesh *applyModifier(ModifierData *UNUSED(md), Object *UNUSED(ob), + DerivedMesh *derivedData, + int UNUSED(useRenderParams), + int UNUSED(isFinalCalc)) +{ + return derivedData; +} +#endif // WITH_MOD_BOOLEAN static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *UNUSED(md)) { - CustomDataMask dataMask = (1 << CD_MTFACE) + (1 << CD_MEDGE); + CustomDataMask dataMask = CD_MASK_MTFACE | CD_MASK_MEDGE; - dataMask |= (1 << CD_MDEFORMVERT); + dataMask |= CD_MASK_MDEFORMVERT; return dataMask; } diff --git a/source/blender/modifiers/intern/MOD_cast.c b/source/blender/modifiers/intern/MOD_cast.c index c39aa288b18..2d45ea19f01 100644 --- a/source/blender/modifiers/intern/MOD_cast.c +++ b/source/blender/modifiers/intern/MOD_cast.c @@ -92,7 +92,7 @@ static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md) CustomDataMask dataMask = 0; /* ask for vertexgroups if we need them */ - if(cmd->defgrp_name[0]) dataMask |= (1 << CD_MDEFORMVERT); + if(cmd->defgrp_name[0]) dataMask |= CD_MASK_MDEFORMVERT; return dataMask; } diff --git a/source/blender/modifiers/intern/MOD_cloth.c b/source/blender/modifiers/intern/MOD_cloth.c index 0c6c1e87a72..97a79cce414 100644 --- a/source/blender/modifiers/intern/MOD_cloth.c +++ b/source/blender/modifiers/intern/MOD_cloth.c @@ -62,7 +62,9 @@ static void initData(ModifierData *md) } static DerivedMesh *applyModifier(ModifierData *md, Object *ob, - DerivedMesh *derivedData, int useRenderParams, int isFinalCalc) + DerivedMesh *dm, + int UNUSED(useRenderParams), + int UNUSED(isFinalCalc)) { ClothModifierData *clmd = (ClothModifierData*) md; DerivedMesh *result=NULL; @@ -73,17 +75,17 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, initData(md); if(!clmd->sim_parms || !clmd->coll_parms) - return derivedData; + return dm; } - result = clothModifier_do(clmd, md->scene, ob, derivedData, useRenderParams, isFinalCalc); + result = clothModifier_do(clmd, md->scene, ob, dm); if(result) { CDDM_calc_normals(result); return result; } - return derivedData; + return dm; } static void updateDepgraph( @@ -118,10 +120,10 @@ static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md) ClothModifierData *clmd = (ClothModifierData*)md; if(cloth_uses_vgroup(clmd)) - dataMask |= (1 << CD_MDEFORMVERT); + dataMask |= CD_MASK_MDEFORMVERT; if(clmd->sim_parms->shapekey_rest != 0) - dataMask |= (1 << CD_CLOTH_ORCO); + dataMask |= CD_MASK_CLOTH_ORCO; return dataMask; } diff --git a/source/blender/modifiers/intern/MOD_curve.c b/source/blender/modifiers/intern/MOD_curve.c index 8009ad0589c..39816d1ff12 100644 --- a/source/blender/modifiers/intern/MOD_curve.c +++ b/source/blender/modifiers/intern/MOD_curve.c @@ -66,7 +66,7 @@ static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md) CustomDataMask dataMask = 0; /* ask for vertexgroups if we need them */ - if(cmd->name[0]) dataMask |= (1 << CD_MDEFORMVERT); + if(cmd->name[0]) dataMask |= CD_MASK_MDEFORMVERT; return dataMask; } diff --git a/source/blender/modifiers/intern/MOD_decimate.c b/source/blender/modifiers/intern/MOD_decimate.c index 8df0c0be3eb..d7e0ff4702b 100644 --- a/source/blender/modifiers/intern/MOD_decimate.c +++ b/source/blender/modifiers/intern/MOD_decimate.c @@ -42,8 +42,9 @@ #include "MEM_guardedalloc.h" +#ifdef WITH_MOD_DECIMATE #include "LOD_decimation.h" - +#endif static void initData(ModifierData *md) { @@ -60,6 +61,7 @@ static void copyData(ModifierData *md, ModifierData *target) tdmd->percent = dmd->percent; } +#ifdef WITH_MOD_DECIMATE static DerivedMesh *applyModifier(ModifierData *md, Object *UNUSED(ob), DerivedMesh *derivedData, int UNUSED(useRenderParams), @@ -176,7 +178,15 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *UNUSED(ob), exit: return result; } - +#else // WITH_MOD_DECIMATE +static DerivedMesh *applyModifier(ModifierData *UNUSED(md), Object *UNUSED(ob), + DerivedMesh *derivedData, + int UNUSED(useRenderParams), + int UNUSED(isFinalCalc)) +{ + return derivedData; +} +#endif // WITH_MOD_DECIMATE ModifierTypeInfo modifierType_Decimate = { /* name */ "Decimate", diff --git a/source/blender/modifiers/intern/MOD_displace.c b/source/blender/modifiers/intern/MOD_displace.c index 95e8a9ce4cc..ce41f6dfc1d 100644 --- a/source/blender/modifiers/intern/MOD_displace.c +++ b/source/blender/modifiers/intern/MOD_displace.c @@ -82,10 +82,10 @@ static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md) CustomDataMask dataMask = 0; /* ask for vertexgroups if we need them */ - if(dmd->defgrp_name[0]) dataMask |= (1 << CD_MDEFORMVERT); + if(dmd->defgrp_name[0]) dataMask |= CD_MASK_MDEFORMVERT; /* ask for UV coordinates if we need them */ - if(dmd->texmapping == MOD_DISP_MAP_UV) dataMask |= (1 << CD_MTFACE); + if(dmd->texmapping == MOD_DISP_MAP_UV) dataMask |= CD_MASK_MTFACE; return dataMask; } diff --git a/source/blender/modifiers/intern/MOD_explode.c b/source/blender/modifiers/intern/MOD_explode.c index 67f1f2a3e59..dd2c4b6efb6 100644 --- a/source/blender/modifiers/intern/MOD_explode.c +++ b/source/blender/modifiers/intern/MOD_explode.c @@ -84,7 +84,7 @@ static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md) CustomDataMask dataMask = 0; if(emd->vgroup) - dataMask |= (1 << CD_MDEFORMVERT); + dataMask |= CD_MASK_MDEFORMVERT; return dataMask; } diff --git a/source/blender/modifiers/intern/MOD_fluidsim.c b/source/blender/modifiers/intern/MOD_fluidsim.c index 14fb09f1c1f..d3cc653d992 100644 --- a/source/blender/modifiers/intern/MOD_fluidsim.c +++ b/source/blender/modifiers/intern/MOD_fluidsim.c @@ -70,9 +70,10 @@ static void copyData(ModifierData *md, ModifierData *target) -static DerivedMesh * applyModifier( - ModifierData *md, Object *ob, DerivedMesh *derivedData, - int useRenderParams, int isFinalCalc) +static DerivedMesh *applyModifier(ModifierData *md, Object *ob, + DerivedMesh *dm, + int useRenderParams, + int isFinalCalc) { FluidsimModifierData *fluidmd= (FluidsimModifierData*) md; DerivedMesh *result = NULL; @@ -83,17 +84,12 @@ static DerivedMesh * applyModifier( initData(md); if(!fluidmd->fss) - return derivedData; + return dm; } - result = fluidsimModifier_do(fluidmd, md->scene, ob, derivedData, useRenderParams, isFinalCalc); + result= fluidsimModifier_do(fluidmd, md->scene, ob, dm, useRenderParams, isFinalCalc); - if(result) - { - return result; - } - - return derivedData; + return result ? result : dm; } static void updateDepgraph( diff --git a/source/blender/modifiers/intern/MOD_fluidsim_util.c b/source/blender/modifiers/intern/MOD_fluidsim_util.c index fb3eb74a919..6e6b9f43c54 100644 --- a/source/blender/modifiers/intern/MOD_fluidsim_util.c +++ b/source/blender/modifiers/intern/MOD_fluidsim_util.c @@ -546,8 +546,7 @@ DerivedMesh *fluidsim_read_cache(DerivedMesh *orgdm, FluidsimModifierData *fluid DerivedMesh *fluidsimModifier_do(FluidsimModifierData *fluidmd, Scene *scene, Object *UNUSED(ob), DerivedMesh *dm, - int useRenderParams, - int UNUSED(isFinalCalc)) + int useRenderParams) { #ifndef DISABLE_ELBEEM DerivedMesh *result = NULL; diff --git a/source/blender/modifiers/intern/MOD_hook.c b/source/blender/modifiers/intern/MOD_hook.c index c26d3ff0967..e29b4b456ae 100644 --- a/source/blender/modifiers/intern/MOD_hook.c +++ b/source/blender/modifiers/intern/MOD_hook.c @@ -75,8 +75,8 @@ static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md) CustomDataMask dataMask = 0; /* ask for vertexgroups if we need them */ - if(hmd->name[0]) dataMask |= (1 << CD_MDEFORMVERT); - // if(hmd->indexar) dataMask |= CD_MASK_ORIGINDEX; + if(hmd->name[0]) dataMask |= CD_MASK_MDEFORMVERT; + if(hmd->indexar) dataMask |= CD_MASK_ORIGINDEX; return dataMask; } @@ -138,7 +138,7 @@ static float hook_falloff(float *co_1, float *co_2, const float falloff_squared, } static void deformVerts(ModifierData *md, Object *ob, - DerivedMesh *derivedData, + DerivedMesh *dm, float (*vertexCos)[3], int numVerts, int UNUSED(useRenderParams), @@ -148,7 +148,6 @@ static void deformVerts(ModifierData *md, Object *ob, bPoseChannel *pchan= get_pose_channel(hmd->object->pose, hmd->subtarget); float vec[3], mat[4][4], dmat[4][4]; int i, *index_pt; - DerivedMesh *dm = derivedData; const float falloff_squared= hmd->falloff * hmd->falloff; /* for faster comparisons */ int max_dvert= 0; diff --git a/source/blender/modifiers/intern/MOD_lattice.c b/source/blender/modifiers/intern/MOD_lattice.c index fdbc3fa0a50..deb4446fa4e 100644 --- a/source/blender/modifiers/intern/MOD_lattice.c +++ b/source/blender/modifiers/intern/MOD_lattice.c @@ -59,7 +59,7 @@ static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md) CustomDataMask dataMask = 0; /* ask for vertexgroups if we need them */ - if(lmd->name[0]) dataMask |= (1 << CD_MDEFORMVERT); + if(lmd->name[0]) dataMask |= CD_MASK_MDEFORMVERT; return dataMask; } diff --git a/source/blender/modifiers/intern/MOD_mask.c b/source/blender/modifiers/intern/MOD_mask.c index eddb21596a6..feaf5d5fd00 100644 --- a/source/blender/modifiers/intern/MOD_mask.c +++ b/source/blender/modifiers/intern/MOD_mask.c @@ -57,7 +57,7 @@ static void copyData(ModifierData *md, ModifierData *target) static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *UNUSED(md)) { - return (1 << CD_MDEFORMVERT); + return CD_MASK_MDEFORMVERT; } static void foreachObjectLink( diff --git a/source/blender/modifiers/intern/MOD_meshdeform.c b/source/blender/modifiers/intern/MOD_meshdeform.c index 587b3b8f053..8000bceb014 100644 --- a/source/blender/modifiers/intern/MOD_meshdeform.c +++ b/source/blender/modifiers/intern/MOD_meshdeform.c @@ -83,7 +83,7 @@ static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md) CustomDataMask dataMask = 0; /* ask for vertexgroups if we need them */ - if(mmd->defgrp_name[0]) dataMask |= (1 << CD_MDEFORMVERT); + if(mmd->defgrp_name[0]) dataMask |= CD_MASK_MDEFORMVERT; return dataMask; } diff --git a/source/blender/modifiers/intern/MOD_multires.c b/source/blender/modifiers/intern/MOD_multires.c index 758809ff7ec..96dcde12180 100644 --- a/source/blender/modifiers/intern/MOD_multires.c +++ b/source/blender/modifiers/intern/MOD_multires.c @@ -59,6 +59,8 @@ static void copyData(ModifierData *md, ModifierData *target) tmmd->sculptlvl = mmd->sculptlvl; tmmd->renderlvl = mmd->renderlvl; tmmd->totlvl = mmd->totlvl; + tmmd->simple = mmd->simple; + tmmd->flags = mmd->flags; } static DerivedMesh *applyModifier(ModifierData *md, Object *ob, DerivedMesh *dm, diff --git a/source/blender/modifiers/intern/MOD_particlesystem.c b/source/blender/modifiers/intern/MOD_particlesystem.c index 0feea3b6bf5..9d99174b7c4 100644 --- a/source/blender/modifiers/intern/MOD_particlesystem.c +++ b/source/blender/modifiers/intern/MOD_particlesystem.c @@ -95,17 +95,17 @@ static CustomDataMask requiredDataMask(Object *ob, ModifierData *md) mtex=ma->mtex[i]; if(mtex && (ma->septex & (1<<i))==0) if(mtex->pmapto && (mtex->texco & TEXCO_UV)) - dataMask |= (1 << CD_MTFACE); + dataMask |= CD_MASK_MTFACE; } } if(psmd->psys->part->tanfac!=0.0) - dataMask |= (1 << CD_MTFACE); + dataMask |= CD_MASK_MTFACE; /* ask for vertexgroups if we need them */ for(i=0; i<PSYS_TOT_VG; i++){ if(psmd->psys->vgroup[i]){ - dataMask |= (1 << CD_MDEFORMVERT); + dataMask |= CD_MASK_MDEFORMVERT; break; } } diff --git a/source/blender/modifiers/intern/MOD_shrinkwrap.c b/source/blender/modifiers/intern/MOD_shrinkwrap.c index 6eebe9b5e5e..417c73eba98 100644 --- a/source/blender/modifiers/intern/MOD_shrinkwrap.c +++ b/source/blender/modifiers/intern/MOD_shrinkwrap.c @@ -79,11 +79,11 @@ static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md) /* ask for vertexgroups if we need them */ if(smd->vgroup_name[0]) - dataMask |= (1 << CD_MDEFORMVERT); + dataMask |= CD_MASK_MDEFORMVERT; if(smd->shrinkType == MOD_SHRINKWRAP_PROJECT && smd->projAxis == MOD_SHRINKWRAP_PROJECT_OVER_NORMAL) - dataMask |= (1 << CD_MVERT); + dataMask |= CD_MASK_MVERT; return dataMask; } diff --git a/source/blender/modifiers/intern/MOD_simpledeform.c b/source/blender/modifiers/intern/MOD_simpledeform.c index 7c47ab02157..9e2d8e16c52 100644 --- a/source/blender/modifiers/intern/MOD_simpledeform.c +++ b/source/blender/modifiers/intern/MOD_simpledeform.c @@ -297,7 +297,7 @@ static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md) /* ask for vertexgroups if we need them */ if(smd->vgroup_name[0]) - dataMask |= (1 << CD_MDEFORMVERT); + dataMask |= CD_MASK_MDEFORMVERT; return dataMask; } diff --git a/source/blender/modifiers/intern/MOD_smoke.c b/source/blender/modifiers/intern/MOD_smoke.c index aee466802ca..a183018da30 100644 --- a/source/blender/modifiers/intern/MOD_smoke.c +++ b/source/blender/modifiers/intern/MOD_smoke.c @@ -76,13 +76,13 @@ static void deformVerts(ModifierData *md, Object *ob, DerivedMesh *derivedData, float (*vertexCos)[3], int UNUSED(numVerts), - int useRenderParams, - int isFinalCalc) + int UNUSED(useRenderParams), + int UNUSED(isFinalCalc)) { SmokeModifierData *smd = (SmokeModifierData*) md; DerivedMesh *dm = dm= get_cddm(ob, NULL, derivedData, vertexCos); - smokeModifier_do(smd, md->scene, ob, dm, useRenderParams, isFinalCalc); + smokeModifier_do(smd, md->scene, ob, dm); if(dm != derivedData) dm->release(dm); diff --git a/source/blender/modifiers/intern/MOD_smooth.c b/source/blender/modifiers/intern/MOD_smooth.c index db7013f53ce..e3740a42fff 100644 --- a/source/blender/modifiers/intern/MOD_smooth.c +++ b/source/blender/modifiers/intern/MOD_smooth.c @@ -85,7 +85,7 @@ static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md) CustomDataMask dataMask = 0; /* ask for vertexgroups if we need them */ - if(smd->defgrp_name[0]) dataMask |= (1 << CD_MDEFORMVERT); + if(smd->defgrp_name[0]) dataMask |= CD_MASK_MDEFORMVERT; return dataMask; } diff --git a/source/blender/modifiers/intern/MOD_solidify.c b/source/blender/modifiers/intern/MOD_solidify.c index 6abe1262c0b..935a3cc627a 100644 --- a/source/blender/modifiers/intern/MOD_solidify.c +++ b/source/blender/modifiers/intern/MOD_solidify.c @@ -185,7 +185,7 @@ static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md) CustomDataMask dataMask = 0; /* ask for vertexgroups if we need them */ - if(smd->defgrp_name[0]) dataMask |= (1 << CD_MDEFORMVERT); + if(smd->defgrp_name[0]) dataMask |= CD_MASK_MDEFORMVERT; return dataMask; } @@ -198,15 +198,15 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, { int i; DerivedMesh *result; - SolidifyModifierData *smd = (SolidifyModifierData*) md; + const SolidifyModifierData *smd = (SolidifyModifierData*) md; MFace *mf, *mface, *orig_mface; MEdge *ed, *medge, *orig_medge; MVert *mv, *mvert, *orig_mvert; - int numVerts = dm->getNumVerts(dm); - int numEdges = dm->getNumEdges(dm); - int numFaces = dm->getNumFaces(dm); + const int numVerts = dm->getNumVerts(dm); + const int numEdges = dm->getNumEdges(dm); + const int numFaces = dm->getNumFaces(dm); /* use for edges */ int *new_vert_arr= NULL; @@ -220,13 +220,13 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, float (*vert_nors)[3]= NULL; - float ofs_orig= - (((-smd->offset_fac + 1.0f) * 0.5f) * smd->offset); - float ofs_new= smd->offset - (((-smd->offset_fac + 1.0f) * 0.5f) * smd->offset); + float const ofs_orig= - (((-smd->offset_fac + 1.0f) * 0.5f) * smd->offset); + float const ofs_new= smd->offset - (((-smd->offset_fac + 1.0f) * 0.5f) * smd->offset); /* weights */ MDeformVert *dvert= NULL, *dv= NULL; - int defgrp_invert = ((smd->flag & MOD_SOLIDIFY_VGROUP_INV) != 0); - int defgrp_index= defgroup_name_index(ob, smd->defgrp_name); + const int defgrp_invert = ((smd->flag & MOD_SOLIDIFY_VGROUP_INV) != 0); + const int defgrp_index= defgroup_name_index(ob, smd->defgrp_name); if (defgrp_index >= 0) dvert = dm->getVertDataArray(dm, CD_MDEFORMVERT); @@ -321,7 +321,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, dm_calc_normal(dm, vert_nors); } - result = CDDM_from_template(dm, numVerts * 2, (numEdges * 2) + newEdges, (numFaces * 2) + newFaces); + result = CDDM_from_template(dm, numVerts * 2, (numEdges * 2) + newEdges, (numFaces * 2) + newFaces); mface = result->getFaceArray(result); medge = result->getEdgeArray(result); diff --git a/source/blender/modifiers/intern/MOD_uvproject.c b/source/blender/modifiers/intern/MOD_uvproject.c index 942b4b0b597..08c6477ead3 100644 --- a/source/blender/modifiers/intern/MOD_uvproject.c +++ b/source/blender/modifiers/intern/MOD_uvproject.c @@ -84,7 +84,7 @@ static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *UNUSED( CustomDataMask dataMask = 0; /* ask for UV coordinates */ - dataMask |= (1 << CD_MTFACE); + dataMask |= CD_MASK_MTFACE; return dataMask; } diff --git a/source/blender/modifiers/intern/MOD_wave.c b/source/blender/modifiers/intern/MOD_wave.c index acd8c29a6dd..255d896fbc0 100644 --- a/source/blender/modifiers/intern/MOD_wave.c +++ b/source/blender/modifiers/intern/MOD_wave.c @@ -149,11 +149,11 @@ static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md) /* ask for UV coordinates if we need them */ if(wmd->texture && wmd->texmapping == MOD_WAV_MAP_UV) - dataMask |= (1 << CD_MTFACE); + dataMask |= CD_MASK_MTFACE; /* ask for vertexgroups if we need them */ if(wmd->defgrp_name[0]) - dataMask |= (1 << CD_MDEFORMVERT); + dataMask |= CD_MASK_MDEFORMVERT; return dataMask; } diff --git a/source/blender/nodes/CMakeLists.txt b/source/blender/nodes/CMakeLists.txt index 8d8423cc19b..d4383f330c4 100644 --- a/source/blender/nodes/CMakeLists.txt +++ b/source/blender/nodes/CMakeLists.txt @@ -23,8 +23,6 @@ # # ***** END GPL LICENSE BLOCK ***** -FILE(GLOB SRC intern/*.c intern/CMP_nodes/*.c intern/SHD_nodes/*.c intern/TEX_nodes/*.c) - SET(INC . ../blenkernel @@ -39,6 +37,109 @@ SET(INC ../../../extern/glew/include ) +SET(SRC + intern/CMP_nodes/CMP_alphaOver.c + intern/CMP_nodes/CMP_bilateralblur.c + intern/CMP_nodes/CMP_blur.c + intern/CMP_nodes/CMP_brightness.c + intern/CMP_nodes/CMP_channelMatte.c + intern/CMP_nodes/CMP_chromaMatte.c + intern/CMP_nodes/CMP_colorMatte.c + intern/CMP_nodes/CMP_colorSpill.c + intern/CMP_nodes/CMP_colorbalance.c + intern/CMP_nodes/CMP_composite.c + intern/CMP_nodes/CMP_crop.c + intern/CMP_nodes/CMP_curves.c + intern/CMP_nodes/CMP_defocus.c + intern/CMP_nodes/CMP_diffMatte.c + intern/CMP_nodes/CMP_dilate.c + intern/CMP_nodes/CMP_directionalblur.c + intern/CMP_nodes/CMP_displace.c + intern/CMP_nodes/CMP_distanceMatte.c + intern/CMP_nodes/CMP_filter.c + intern/CMP_nodes/CMP_flip.c + intern/CMP_nodes/CMP_gamma.c + intern/CMP_nodes/CMP_glare.c + intern/CMP_nodes/CMP_hueSatVal.c + intern/CMP_nodes/CMP_huecorrect.c + intern/CMP_nodes/CMP_idMask.c + intern/CMP_nodes/CMP_image.c + intern/CMP_nodes/CMP_invert.c + intern/CMP_nodes/CMP_lensdist.c + intern/CMP_nodes/CMP_levels.c + intern/CMP_nodes/CMP_lummaMatte.c + intern/CMP_nodes/CMP_mapUV.c + intern/CMP_nodes/CMP_mapValue.c + intern/CMP_nodes/CMP_math.c + intern/CMP_nodes/CMP_mixrgb.c + intern/CMP_nodes/CMP_normal.c + intern/CMP_nodes/CMP_normalize.c + intern/CMP_nodes/CMP_outputFile.c + intern/CMP_nodes/CMP_premulkey.c + intern/CMP_nodes/CMP_rgb.c + intern/CMP_nodes/CMP_rotate.c + intern/CMP_nodes/CMP_scale.c + intern/CMP_nodes/CMP_sepcombHSVA.c + intern/CMP_nodes/CMP_sepcombRGBA.c + intern/CMP_nodes/CMP_sepcombYCCA.c + intern/CMP_nodes/CMP_sepcombYUVA.c + intern/CMP_nodes/CMP_setalpha.c + intern/CMP_nodes/CMP_splitViewer.c + intern/CMP_nodes/CMP_texture.c + intern/CMP_nodes/CMP_tonemap.c + intern/CMP_nodes/CMP_translate.c + intern/CMP_nodes/CMP_valToRgb.c + intern/CMP_nodes/CMP_value.c + intern/CMP_nodes/CMP_vecBlur.c + intern/CMP_nodes/CMP_viewer.c + intern/CMP_nodes/CMP_zcombine.c + intern/CMP_util.c + intern/SHD_nodes/SHD_camera.c + intern/SHD_nodes/SHD_curves.c + intern/SHD_nodes/SHD_dynamic.c + intern/SHD_nodes/SHD_geom.c + intern/SHD_nodes/SHD_hueSatVal.c + intern/SHD_nodes/SHD_invert.c + intern/SHD_nodes/SHD_mapping.c + intern/SHD_nodes/SHD_material.c + intern/SHD_nodes/SHD_math.c + intern/SHD_nodes/SHD_mixRgb.c + intern/SHD_nodes/SHD_normal.c + intern/SHD_nodes/SHD_output.c + intern/SHD_nodes/SHD_rgb.c + intern/SHD_nodes/SHD_sepcombRGB.c + intern/SHD_nodes/SHD_squeeze.c + intern/SHD_nodes/SHD_texture.c + intern/SHD_nodes/SHD_valToRgb.c + intern/SHD_nodes/SHD_value.c + intern/SHD_nodes/SHD_vectMath.c + intern/SHD_util.c + intern/TEX_nodes/TEX_at.c + intern/TEX_nodes/TEX_bricks.c + intern/TEX_nodes/TEX_checker.c + intern/TEX_nodes/TEX_compose.c + intern/TEX_nodes/TEX_coord.c + intern/TEX_nodes/TEX_curves.c + intern/TEX_nodes/TEX_decompose.c + intern/TEX_nodes/TEX_distance.c + intern/TEX_nodes/TEX_hueSatVal.c + intern/TEX_nodes/TEX_image.c + intern/TEX_nodes/TEX_invert.c + intern/TEX_nodes/TEX_math.c + intern/TEX_nodes/TEX_mixRgb.c + intern/TEX_nodes/TEX_output.c + intern/TEX_nodes/TEX_proc.c + intern/TEX_nodes/TEX_rotate.c + intern/TEX_nodes/TEX_scale.c + intern/TEX_nodes/TEX_texture.c + intern/TEX_nodes/TEX_translate.c + intern/TEX_nodes/TEX_valToNor.c + intern/TEX_nodes/TEX_valToRgb.c + intern/TEX_nodes/TEX_viewer.c + intern/TEX_util.c + intern/node_util.c +) + IF(WIN32) LIST(APPEND INC ${PTHREADS_INC}) ENDIF(WIN32) diff --git a/source/blender/python/CMakeLists.txt b/source/blender/python/CMakeLists.txt index 7f4257d3536..7232399a329 100644 --- a/source/blender/python/CMakeLists.txt +++ b/source/blender/python/CMakeLists.txt @@ -25,8 +25,6 @@ ADD_SUBDIRECTORY(generic) -FILE(GLOB SRC intern/*.c) - SET(INC . ../blenlib @@ -41,6 +39,21 @@ SET(INC ${PYTHON_INC} ) +SET(SRC + intern/bpy.c + intern/bpy_app.c + intern/bpy_array.c + intern/bpy_driver.c + intern/bpy_interface.c + intern/bpy_operator.c + intern/bpy_operator_wrap.c + intern/bpy_props.c + intern/bpy_rna.c + intern/bpy_rna_callback.c + intern/bpy_util.c + intern/stubs.c +) + # only to check if buildinfo is available IF(WITH_BUILDINFO) ADD_DEFINITIONS(-DBUILD_DATE) diff --git a/source/blender/python/generic/CMakeLists.txt b/source/blender/python/generic/CMakeLists.txt index 1a91abfbec8..4ac3fc36ebd 100644 --- a/source/blender/python/generic/CMakeLists.txt +++ b/source/blender/python/generic/CMakeLists.txt @@ -18,8 +18,6 @@ # # ***** END GPL LICENSE BLOCK ***** -FILE(GLOB SRC *.c) - SET(INC . ../../blenlib @@ -31,4 +29,20 @@ SET(INC ${PYTHON_INC} ) +SET(SRC + IDProp.c + bgl.c + blf_api.c + bpy_internal_import.c + geometry.c + mathutils.c + mathutils_color.c + mathutils_euler.c + mathutils_matrix.c + mathutils_quat.c + mathutils_vector.c + noise.c + py_capi_utils.c +) + BLENDERLIB(bf_python_ext "${SRC}" "${INC}") diff --git a/source/blender/python/generic/mathutils_color.c b/source/blender/python/generic/mathutils_color.c index 26af8a38f6d..83cea0565cd 100644 --- a/source/blender/python/generic/mathutils_color.c +++ b/source/blender/python/generic/mathutils_color.c @@ -258,7 +258,7 @@ static int Color_ass_slice(ColorObject * self, int begin, int end, PyObject * se for(i= 0; i < COLOR_SIZE; i++) self->col[begin + i] = col[i]; - BaseMath_WriteCallback(self); + (void)BaseMath_WriteCallback(self); return 0; } diff --git a/source/blender/python/generic/mathutils_euler.c b/source/blender/python/generic/mathutils_euler.c index c7091347493..e536bdbe9d4 100644 --- a/source/blender/python/generic/mathutils_euler.c +++ b/source/blender/python/generic/mathutils_euler.c @@ -209,7 +209,7 @@ static PyObject *Euler_Unique(EulerObject * self) heading -= (floor(heading * PI_INV)) * PI_2; heading -= Py_PI; - BaseMath_WriteCallback(self); + (void)BaseMath_WriteCallback(self); Py_INCREF(self); return (PyObject *)self; } @@ -229,7 +229,7 @@ static PyObject *Euler_Zero(EulerObject * self) self->eul[1] = 0.0; self->eul[2] = 0.0; - BaseMath_WriteCallback(self); + (void)BaseMath_WriteCallback(self); Py_INCREF(self); return (PyObject *)self; } @@ -266,7 +266,7 @@ static PyObject *Euler_rotate_axis(EulerObject * self, PyObject *args) if(self->order == EULER_ORDER_XYZ) rotate_eul(self->eul, *axis, angle); else rotate_eulO(self->eul, self->order, *axis, angle); - BaseMath_WriteCallback(self); + (void)BaseMath_WriteCallback(self); Py_INCREF(self); return (PyObject *)self; } @@ -300,7 +300,7 @@ static PyObject *Euler_MakeCompatible(EulerObject * self, EulerObject *value) compatible_eul(self->eul, value->eul); - BaseMath_WriteCallback(self); + (void)BaseMath_WriteCallback(self); Py_INCREF(self); return (PyObject *)self; } @@ -488,7 +488,7 @@ static int Euler_ass_slice(EulerObject * self, int begin, int end, PyObject * se for(i= 0; i < EULER_SIZE; i++) self->eul[begin + i] = eul[i]; - BaseMath_WriteCallback(self); + (void)BaseMath_WriteCallback(self); return 0; } @@ -612,7 +612,7 @@ static int Euler_setOrder(EulerObject *self, PyObject *value, void *UNUSED(closu return -1; self->order= order; - BaseMath_WriteCallback(self); /* order can be written back */ + (void)BaseMath_WriteCallback(self); /* order can be written back */ return 0; } diff --git a/source/blender/python/generic/mathutils_matrix.c b/source/blender/python/generic/mathutils_matrix.c index 9476e8127b6..36a9bf8b55d 100644 --- a/source/blender/python/generic/mathutils_matrix.c +++ b/source/blender/python/generic/mathutils_matrix.c @@ -68,7 +68,7 @@ static int mathutils_matrix_vector_set(BaseMathObject *bmo, int subtype) for(i=0; i < self->colSize; i++) self->matrix[subtype][i]= bmo->data[i]; - BaseMath_WriteCallback(self); + (void)BaseMath_WriteCallback(self); return 1; } @@ -92,7 +92,7 @@ static int mathutils_matrix_vector_set_index(BaseMathObject *bmo, int subtype, i self->matrix[subtype][index]= bmo->data[index]; - BaseMath_WriteCallback(self); + (void)BaseMath_WriteCallback(self); return 1; } @@ -1004,7 +1004,7 @@ PyObject *Matrix_Invert(MatrixObject * self) return NULL; } - BaseMath_WriteCallback(self); + (void)BaseMath_WriteCallback(self); Py_INCREF(self); return (PyObject *)self; } @@ -1066,7 +1066,7 @@ PyObject *Matrix_Transpose(MatrixObject * self) transpose_m4((float (*)[4])self->contigPtr); } - BaseMath_WriteCallback(self); + (void)BaseMath_WriteCallback(self); Py_INCREF(self); return (PyObject *)self; } @@ -1302,7 +1302,7 @@ static int Matrix_ass_item(MatrixObject * self, int i, PyObject * ob) self->matrix[i][y] = vec[y]; } - BaseMath_WriteCallback(self); + (void)BaseMath_WriteCallback(self); return 0; }else{ PyErr_SetString(PyExc_TypeError, "matrix[attribute] = x: expects a sequence of column size\n"); @@ -1403,7 +1403,7 @@ static int Matrix_ass_slice(MatrixObject * self, int begin, int end, PyObject * self->matrix[begin + (int)floor(x / self->colSize)][x % self->colSize] = mat[x]; } - BaseMath_WriteCallback(self); + (void)BaseMath_WriteCallback(self); return 0; }else{ PyErr_SetString(PyExc_TypeError, "matrix[begin:end] = []: illegal argument type for built-in operation\n"); diff --git a/source/blender/python/generic/mathutils_quat.c b/source/blender/python/generic/mathutils_quat.c index 37f20ebbe31..cb6e6fd3ddd 100644 --- a/source/blender/python/generic/mathutils_quat.c +++ b/source/blender/python/generic/mathutils_quat.c @@ -257,7 +257,7 @@ static PyObject *Quaternion_Normalize(QuaternionObject * self) normalize_qt(self->quat); - BaseMath_WriteCallback(self); + (void)BaseMath_WriteCallback(self); Py_INCREF(self); return (PyObject*)self; } @@ -277,7 +277,7 @@ static PyObject *Quaternion_Inverse(QuaternionObject * self) invert_qt(self->quat); - BaseMath_WriteCallback(self); + (void)BaseMath_WriteCallback(self); Py_INCREF(self); return (PyObject*)self; } @@ -297,7 +297,7 @@ static PyObject *Quaternion_Identity(QuaternionObject * self) unit_qt(self->quat); - BaseMath_WriteCallback(self); + (void)BaseMath_WriteCallback(self); Py_INCREF(self); return (PyObject*)self; } @@ -317,7 +317,7 @@ static PyObject *Quaternion_Negate(QuaternionObject * self) mul_qt_fl(self->quat, -1.0f); - BaseMath_WriteCallback(self); + (void)BaseMath_WriteCallback(self); Py_INCREF(self); return (PyObject*)self; } @@ -337,7 +337,7 @@ static PyObject *Quaternion_Conjugate(QuaternionObject * self) conjugate_qt(self->quat); - BaseMath_WriteCallback(self); + (void)BaseMath_WriteCallback(self); Py_INCREF(self); return (PyObject*)self; } @@ -523,7 +523,7 @@ static int Quaternion_ass_slice(QuaternionObject * self, int begin, int end, PyO for(i= 0; i < size; i++) self->quat[begin + i] = quat[i]; - BaseMath_WriteCallback(self); + (void)BaseMath_WriteCallback(self); return 0; } diff --git a/source/blender/python/generic/mathutils_vector.c b/source/blender/python/generic/mathutils_vector.c index 84f41b6e66a..57d7ee659d5 100644 --- a/source/blender/python/generic/mathutils_vector.c +++ b/source/blender/python/generic/mathutils_vector.c @@ -80,7 +80,7 @@ static PyObject *Vector_Zero(VectorObject *self) self->vec[i] = 0.0f; } - BaseMath_WriteCallback(self); + (void)BaseMath_WriteCallback(self); Py_INCREF(self); return (PyObject*)self; } @@ -113,7 +113,7 @@ static PyObject *Vector_Normalize(VectorObject *self) self->vec[i] /= norm; } - BaseMath_WriteCallback(self); + (void)BaseMath_WriteCallback(self); Py_INCREF(self); return (PyObject*)self; } @@ -940,7 +940,7 @@ static PyObject *Vector_iadd(PyObject * v1, PyObject * v2) vec1->vec[i] = vec1->vec[i] + vec2->vec[i]; } - BaseMath_WriteCallback(vec1); + (void)BaseMath_WriteCallback(vec1); Py_INCREF( v1 ); return v1; } @@ -1000,7 +1000,7 @@ static PyObject *Vector_isub(PyObject * v1, PyObject * v2) vec1->vec[i] = vec1->vec[i] - vec2->vec[i]; } - BaseMath_WriteCallback(vec1); + (void)BaseMath_WriteCallback(vec1); Py_INCREF( v1 ); return v1; } @@ -1122,7 +1122,7 @@ static PyObject *Vector_imul(PyObject * v1, PyObject * v2) return NULL; } - BaseMath_WriteCallback(vec); + (void)BaseMath_WriteCallback(vec); Py_INCREF( v1 ); return v1; } @@ -1184,7 +1184,7 @@ static PyObject *Vector_idiv(PyObject * v1, PyObject * v2) vec1->vec[i] /= scalar; } - BaseMath_WriteCallback(vec1); + (void)BaseMath_WriteCallback(vec1); Py_INCREF( v1 ); return v1; @@ -1501,7 +1501,7 @@ static int Vector_setLength(VectorObject *self, PyObject * value ) self->vec[i]= self->vec[i] / (float)dot; } - BaseMath_WriteCallback(self); /* checked already */ + (void)BaseMath_WriteCallback(self); /* checked already */ return 0; } @@ -2067,7 +2067,7 @@ static PyObject *Vector_Negate(VectorObject *self) for(i = 0; i < self->size; i++) self->vec[i] = -(self->vec[i]); - BaseMath_WriteCallback(self); // already checked for error + (void)BaseMath_WriteCallback(self); // already checked for error Py_INCREF(self); return (PyObject*)self; diff --git a/source/blender/python/intern/bpy_app.c b/source/blender/python/intern/bpy_app.c index 39494678a12..b7a277c76b0 100644 --- a/source/blender/python/intern/bpy_app.c +++ b/source/blender/python/intern/bpy_app.c @@ -42,6 +42,7 @@ extern char build_type[]; extern char build_cflags[]; extern char build_cxxflags[]; extern char build_linkflags[]; +extern char build_system[]; #endif static PyTypeObject BlenderAppType; @@ -61,6 +62,7 @@ static PyStructSequence_Field app_info_fields[] = { {"build_cflags", ""}, {"build_cxxflags", ""}, {"build_linkflags", ""}, + {"build_system", ""}, {0} }; @@ -105,6 +107,7 @@ static PyObject *make_app_info(void) SetStrItem(build_cflags); SetStrItem(build_cxxflags); SetStrItem(build_linkflags); + SetStrItem(build_system); #else SetStrItem("Unknown"); SetStrItem("Unknown"); @@ -114,6 +117,7 @@ static PyObject *make_app_info(void) SetStrItem("Unknown"); SetStrItem("Unknown"); SetStrItem("Unknown"); + SetStrItem("Unknown"); #endif #undef SetIntItem diff --git a/source/blender/python/intern/bpy_props.c b/source/blender/python/intern/bpy_props.c index ec5bb595810..25351342402 100644 --- a/source/blender/python/intern/bpy_props.c +++ b/source/blender/python/intern/bpy_props.c @@ -132,6 +132,27 @@ static PyObject *bpy_prop_deferred_return(PyObject *func, PyObject *kw) return bpy_prop_deferred_return((void *)pymeth_##_func, kw); \ } \ +/* terse macros for error checks shared between all funcs cant use function + * calls because of static strins passed to pyrna_set_to_enum_bitfield */ +#define BPY_PROPDEF_CHECK(_func) \ + if(id_len >= MAX_IDPROP_NAME) { \ + PyErr_Format(PyExc_TypeError, #_func"(): '%.200s' too long, max length is %d", id, MAX_IDPROP_NAME-1); \ + return NULL; \ + } \ + if(RNA_def_property_free_identifier(srna, id) == -1) { \ + PyErr_Format(PyExc_TypeError, #_func"(): '%s' is defined as a non-dynamic type.", id); \ + return NULL; \ + } \ + if(pyopts && pyrna_set_to_enum_bitfield(property_flag_items, pyopts, &opts, #_func"(options={...}):")) \ + return NULL; \ + +#define BPY_PROPDEF_SUBTYPE_CHECK(_func, _subtype) \ + BPY_PROPDEF_CHECK(_func) \ + if(pysubtype && RNA_enum_value_from_id(_subtype, pysubtype, &subtype)==0) { \ + PyErr_Format(PyExc_TypeError, #_func"(subtype='%s'): invalid subtype.", pysubtype); \ + return NULL; \ + } \ + #if 0 static int bpy_struct_id_used(StructRNA *srna, char *identifier) @@ -164,6 +185,7 @@ static PyObject *BPy_BoolProperty(PyObject *self, PyObject *args, PyObject *kw) if(srna) { static char *kwlist[] = {"attr", "name", "description", "default", "options", "subtype", NULL}; char *id=NULL, *name="", *description=""; + int id_len; int def=0; PropertyRNA *prop; PyObject *pyopts= NULL; @@ -171,23 +193,11 @@ static PyObject *BPy_BoolProperty(PyObject *self, PyObject *args, PyObject *kw) char *pysubtype= NULL; int subtype= PROP_NONE; - if (!PyArg_ParseTupleAndKeywords(args, kw, "s|ssiO!s:BoolProperty", (char **)kwlist, &id, &name, &description, &def, &PySet_Type, &pyopts, &pysubtype)) + if (!PyArg_ParseTupleAndKeywords(args, kw, "s#|ssiO!s:BoolProperty", (char **)kwlist, &id, &id_len, &name, &description, &def, &PySet_Type, &pyopts, &pysubtype)) return NULL; - if(RNA_def_property_free_identifier(srna, id) == -1) { - PyErr_Format(PyExc_TypeError, "BoolProperty(): '%s' is defined as a non-dynamic type.", id); - return NULL; - } + BPY_PROPDEF_SUBTYPE_CHECK(BoolProperty, property_subtype_number_items) - if(pyopts && pyrna_set_to_enum_bitfield(property_flag_items, pyopts, &opts, "BoolProperty(options={...}):")) - return NULL; - - if(pysubtype && RNA_enum_value_from_id(property_subtype_number_items, pysubtype, &subtype)==0) { - PyErr_Format(PyExc_TypeError, "BoolProperty(subtype='%s'): invalid subtype.", pysubtype); - return NULL; - } - - // prop= RNA_def_boolean(srna, id, def, name, description); prop= RNA_def_property(srna, id, PROP_BOOLEAN, subtype); RNA_def_property_boolean_default(prop, def); RNA_def_property_ui_text(prop, name, description); @@ -220,6 +230,7 @@ static PyObject *BPy_BoolVectorProperty(PyObject *self, PyObject *args, PyObject if(srna) { static const char *kwlist[] = {"attr", "name", "description", "default", "options", "subtype", "size", NULL}; char *id=NULL, *name="", *description=""; + int id_len; int def[PYRNA_STACK_ARRAY]={0}; int size=3; PropertyRNA *prop; @@ -229,21 +240,10 @@ static PyObject *BPy_BoolVectorProperty(PyObject *self, PyObject *args, PyObject char *pysubtype= NULL; int subtype= PROP_NONE; - if (!PyArg_ParseTupleAndKeywords(args, kw, "s|ssOO!si:BoolVectorProperty", (char **)kwlist, &id, &name, &description, &pydef, &PySet_Type, &pyopts, &pysubtype, &size)) + if (!PyArg_ParseTupleAndKeywords(args, kw, "s#|ssOO!si:BoolVectorProperty", (char **)kwlist, &id, &id_len, &name, &description, &pydef, &PySet_Type, &pyopts, &pysubtype, &size)) return NULL; - if(RNA_def_property_free_identifier(srna, id) == -1) { - PyErr_Format(PyExc_TypeError, "BoolVectorProperty(): '%s' is defined as a non-dynamic type.", id); - return NULL; - } - - if(pyopts && pyrna_set_to_enum_bitfield(property_flag_items, pyopts, &opts, "BoolVectorProperty(options={...}):")) - return NULL; - - if(pysubtype && RNA_enum_value_from_id(property_subtype_array_items, pysubtype, &subtype)==0) { - PyErr_Format(PyExc_TypeError, "BoolVectorProperty(subtype='%s'): invalid subtype.", pysubtype); - return NULL; - } + BPY_PROPDEF_SUBTYPE_CHECK(BoolVectorProperty, property_subtype_array_items) if(size < 1 || size > PYRNA_STACK_ARRAY) { PyErr_Format(PyExc_TypeError, "BoolVectorProperty(size=%d): size must be between 0 and " STRINGIFY(PYRNA_STACK_ARRAY), size); @@ -287,6 +287,7 @@ static PyObject *BPy_IntProperty(PyObject *self, PyObject *args, PyObject *kw) if(srna) { static const char *kwlist[] = {"attr", "name", "description", "default", "min", "max", "soft_min", "soft_max", "step", "options", "subtype", NULL}; char *id=NULL, *name="", *description=""; + int id_len; int min=INT_MIN, max=INT_MAX, soft_min=INT_MIN, soft_max=INT_MAX, step=1, def=0; PropertyRNA *prop; PyObject *pyopts= NULL; @@ -294,21 +295,10 @@ static PyObject *BPy_IntProperty(PyObject *self, PyObject *args, PyObject *kw) char *pysubtype= NULL; int subtype= PROP_NONE; - if (!PyArg_ParseTupleAndKeywords(args, kw, "s|ssiiiiiiO!s:IntProperty", (char **)kwlist, &id, &name, &description, &def, &min, &max, &soft_min, &soft_max, &step, &PySet_Type, &pyopts, &pysubtype)) + if (!PyArg_ParseTupleAndKeywords(args, kw, "s#|ssiiiiiiO!s:IntProperty", (char **)kwlist, &id, &id_len, &name, &description, &def, &min, &max, &soft_min, &soft_max, &step, &PySet_Type, &pyopts, &pysubtype)) return NULL; - if(RNA_def_property_free_identifier(srna, id) == -1) { - PyErr_Format(PyExc_TypeError, "IntProperty(): '%s' is defined as a non-dynamic type.", id); - return NULL; - } - - if(pyopts && pyrna_set_to_enum_bitfield(property_flag_items, pyopts, &opts, "IntProperty(options={...}):")) - return NULL; - - if(pysubtype && RNA_enum_value_from_id(property_subtype_number_items, pysubtype, &subtype)==0) { - PyErr_Format(PyExc_TypeError, "IntProperty(subtype='%s'): invalid subtype.", pysubtype); - return NULL; - } + BPY_PROPDEF_SUBTYPE_CHECK(IntProperty, property_subtype_number_items) prop= RNA_def_property(srna, id, PROP_INT, subtype); RNA_def_property_int_default(prop, def); @@ -343,6 +333,7 @@ static PyObject *BPy_IntVectorProperty(PyObject *self, PyObject *args, PyObject if(srna) { static const char *kwlist[] = {"attr", "name", "description", "default", "min", "max", "soft_min", "soft_max", "step", "options", "subtype", "size", NULL}; char *id=NULL, *name="", *description=""; + int id_len; int min=INT_MIN, max=INT_MAX, soft_min=INT_MIN, soft_max=INT_MAX, step=1, def[PYRNA_STACK_ARRAY]={0}; int size=3; PropertyRNA *prop; @@ -352,21 +343,10 @@ static PyObject *BPy_IntVectorProperty(PyObject *self, PyObject *args, PyObject char *pysubtype= NULL; int subtype= PROP_NONE; - if (!PyArg_ParseTupleAndKeywords(args, kw, "s|ssOiiiiiO!si:IntVectorProperty", (char **)kwlist, &id, &name, &description, &pydef, &min, &max, &soft_min, &soft_max, &step, &PySet_Type, &pyopts, &pysubtype, &size)) - return NULL; - - if(RNA_def_property_free_identifier(srna, id) == -1) { - PyErr_Format(PyExc_TypeError, "IntVectorProperty(): '%s' is defined as a non-dynamic type.", id); - return NULL; - } - - if(pyopts && pyrna_set_to_enum_bitfield(property_flag_items, pyopts, &opts, "IntVectorProperty(options={...}):")) + if (!PyArg_ParseTupleAndKeywords(args, kw, "s#|ssOiiiiiO!si:IntVectorProperty", (char **)kwlist, &id, &id_len, &name, &description, &pydef, &min, &max, &soft_min, &soft_max, &step, &PySet_Type, &pyopts, &pysubtype, &size)) return NULL; - if(pysubtype && RNA_enum_value_from_id(property_subtype_array_items, pysubtype, &subtype)==0) { - PyErr_Format(PyExc_TypeError, "IntVectorProperty(subtype='%s'): invalid subtype.", pysubtype); - return NULL; - } + BPY_PROPDEF_SUBTYPE_CHECK(IntVectorProperty, property_subtype_array_items) if(size < 1 || size > PYRNA_STACK_ARRAY) { PyErr_Format(PyExc_TypeError, "IntVectorProperty(size=%d): size must be between 0 and " STRINGIFY(PYRNA_STACK_ARRAY), size); @@ -413,6 +393,7 @@ static PyObject *BPy_FloatProperty(PyObject *self, PyObject *args, PyObject *kw) if(srna) { static const char *kwlist[] = {"attr", "name", "description", "default", "min", "max", "soft_min", "soft_max", "step", "precision", "options", "subtype", "unit", NULL}; char *id=NULL, *name="", *description=""; + int id_len; float min=-FLT_MAX, max=FLT_MAX, soft_min=-FLT_MAX, soft_max=FLT_MAX, step=3, def=0.0f; int precision= 2; PropertyRNA *prop; @@ -423,21 +404,10 @@ static PyObject *BPy_FloatProperty(PyObject *self, PyObject *args, PyObject *kw) char *pyunit= NULL; int unit= PROP_UNIT_NONE; - if (!PyArg_ParseTupleAndKeywords(args, kw, "s|ssffffffiO!ss:FloatProperty", (char **)kwlist, &id, &name, &description, &def, &min, &max, &soft_min, &soft_max, &step, &precision, &PySet_Type, &pyopts, &pysubtype, &pyunit)) + if (!PyArg_ParseTupleAndKeywords(args, kw, "s#|ssffffffiO!ss:FloatProperty", (char **)kwlist, &id, &id_len, &name, &description, &def, &min, &max, &soft_min, &soft_max, &step, &precision, &PySet_Type, &pyopts, &pysubtype, &pyunit)) return NULL; - if(RNA_def_property_free_identifier(srna, id) == -1) { - PyErr_Format(PyExc_TypeError, "FloatProperty(): '%s' is defined as a non-dynamic type.", id); - return NULL; - } - - if(pyopts && pyrna_set_to_enum_bitfield(property_flag_items, pyopts, &opts, "FloatProperty(options={...}):")) - return NULL; - - if(pysubtype && RNA_enum_value_from_id(property_subtype_number_items, pysubtype, &subtype)==0) { - PyErr_Format(PyExc_TypeError, "FloatProperty(subtype='%s'): invalid subtype.", pysubtype); - return NULL; - } + BPY_PROPDEF_SUBTYPE_CHECK(FloatProperty, property_subtype_number_items) if(pyunit && RNA_enum_value_from_id(property_unit_items, pyunit, &unit)==0) { PyErr_Format(PyExc_TypeError, "FloatProperty(unit='%s'): invalid unit."); @@ -477,6 +447,7 @@ static PyObject *BPy_FloatVectorProperty(PyObject *self, PyObject *args, PyObjec if(srna) { static const char *kwlist[] = {"attr", "name", "description", "default", "min", "max", "soft_min", "soft_max", "step", "precision", "options", "subtype", "size", NULL}; char *id=NULL, *name="", *description=""; + int id_len; float min=-FLT_MAX, max=FLT_MAX, soft_min=-FLT_MAX, soft_max=FLT_MAX, step=3, def[PYRNA_STACK_ARRAY]={0.0f}; int precision= 2, size=3; PropertyRNA *prop; @@ -486,21 +457,10 @@ static PyObject *BPy_FloatVectorProperty(PyObject *self, PyObject *args, PyObjec char *pysubtype= NULL; int subtype= PROP_NONE; - if (!PyArg_ParseTupleAndKeywords(args, kw, "s|ssOfffffiO!si:FloatVectorProperty", (char **)kwlist, &id, &name, &description, &pydef, &min, &max, &soft_min, &soft_max, &step, &precision, &PySet_Type, &pyopts, &pysubtype, &size)) + if (!PyArg_ParseTupleAndKeywords(args, kw, "s#|ssOfffffiO!si:FloatVectorProperty", (char **)kwlist, &id, &id_len, &name, &description, &pydef, &min, &max, &soft_min, &soft_max, &step, &precision, &PySet_Type, &pyopts, &pysubtype, &size)) return NULL; - if(RNA_def_property_free_identifier(srna, id) == -1) { - PyErr_Format(PyExc_TypeError, "FloatVectorProperty(): '%s' is defined as a non-dynamic type.", id); - return NULL; - } - - if(pyopts && pyrna_set_to_enum_bitfield(property_flag_items, pyopts, &opts, "FloatVectorProperty(options={...}):")) - return NULL; - - if(pysubtype && RNA_enum_value_from_id(property_subtype_array_items, pysubtype, &subtype)==0) { - PyErr_Format(PyExc_TypeError, "FloatVectorProperty(subtype='%s'): invalid subtype.", pysubtype); - return NULL; - } + BPY_PROPDEF_SUBTYPE_CHECK(FloatVectorProperty, property_subtype_array_items) if(size < 1 || size > PYRNA_STACK_ARRAY) { PyErr_Format(PyExc_TypeError, "FloatVectorProperty(size=%d): size must be between 0 and " STRINGIFY(PYRNA_STACK_ARRAY), size); @@ -544,6 +504,7 @@ static PyObject *BPy_StringProperty(PyObject *self, PyObject *args, PyObject *kw if(srna) { static const char *kwlist[] = {"attr", "name", "description", "default", "maxlen", "options", "subtype", NULL}; char *id=NULL, *name="", *description="", *def=""; + int id_len; int maxlen=0; PropertyRNA *prop; PyObject *pyopts= NULL; @@ -551,21 +512,10 @@ static PyObject *BPy_StringProperty(PyObject *self, PyObject *args, PyObject *kw char *pysubtype= NULL; int subtype= PROP_NONE; - if (!PyArg_ParseTupleAndKeywords(args, kw, "s|sssiO!s:StringProperty", (char **)kwlist, &id, &name, &description, &def, &maxlen, &PySet_Type, &pyopts, &pysubtype)) + if (!PyArg_ParseTupleAndKeywords(args, kw, "s#|sssiO!s:StringProperty", (char **)kwlist, &id, &id_len, &name, &description, &def, &maxlen, &PySet_Type, &pyopts, &pysubtype)) return NULL; - if(RNA_def_property_free_identifier(srna, id) == -1) { - PyErr_Format(PyExc_TypeError, "StringProperty(): '%s' is defined as a non-dynamic type.", id); - return NULL; - } - - if(pyopts && pyrna_set_to_enum_bitfield(property_flag_items, pyopts, &opts, "StringProperty(options={...}):")) - return NULL; - - if(pysubtype && RNA_enum_value_from_id(property_subtype_string_items, pysubtype, &subtype)==0) { - PyErr_Format(PyExc_TypeError, "StringProperty(subtype='%s'): invalid subtype.", pysubtype); - return NULL; - } + BPY_PROPDEF_SUBTYPE_CHECK(StringProperty, property_subtype_string_items) prop= RNA_def_property(srna, id, PROP_STRING, subtype); if(maxlen != 0) RNA_def_property_string_maxlength(prop, maxlen + 1); /* +1 since it includes null terminator */ @@ -645,6 +595,7 @@ static PyObject *BPy_EnumProperty(PyObject *self, PyObject *args, PyObject *kw) if(srna) { static const char *kwlist[] = {"attr", "items", "name", "description", "default", "options", NULL}; char *id=NULL, *name="", *description="", *def=""; + int id_len; int defvalue=0; PyObject *items= Py_None; EnumPropertyItem *eitems; @@ -652,16 +603,10 @@ static PyObject *BPy_EnumProperty(PyObject *self, PyObject *args, PyObject *kw) PyObject *pyopts= NULL; int opts=0; - if (!PyArg_ParseTupleAndKeywords(args, kw, "sO|sssO!:EnumProperty", (char **)kwlist, &id, &items, &name, &description, &def, &PySet_Type, &pyopts)) + if (!PyArg_ParseTupleAndKeywords(args, kw, "s#O|sssO!:EnumProperty", (char **)kwlist, &id, &id_len, &items, &name, &description, &def, &PySet_Type, &pyopts)) return NULL; - if(RNA_def_property_free_identifier(srna, id) == -1) { - PyErr_Format(PyExc_TypeError, "EnumProperty(): '%s' is defined as a non-dynamic type.", id); - return NULL; - } - - if(pyopts && pyrna_set_to_enum_bitfield(property_flag_items, pyopts, &opts, "EnumProperty(options={...}):")) - return NULL; + BPY_PROPDEF_CHECK(EnumProperty) eitems= enum_items_from_py(items, def, &defvalue); if(!eitems) @@ -718,22 +663,17 @@ static PyObject *BPy_PointerProperty(PyObject *self, PyObject *args, PyObject *k if(srna) { static const char *kwlist[] = {"attr", "type", "name", "description", "options", NULL}; char *id=NULL, *name="", *description=""; + int id_len; PropertyRNA *prop; StructRNA *ptype; PyObject *type= Py_None; PyObject *pyopts= NULL; int opts=0; - if (!PyArg_ParseTupleAndKeywords(args, kw, "sO|ssO!:PointerProperty", (char **)kwlist, &id, &type, &name, &description, &PySet_Type, &pyopts)) + if (!PyArg_ParseTupleAndKeywords(args, kw, "s#O|ssO!:PointerProperty", (char **)kwlist, &id, &id_len, &type, &name, &description, &PySet_Type, &pyopts)) return NULL; - if(RNA_def_property_free_identifier(srna, id) == -1) { - PyErr_Format(PyExc_TypeError, "PointerProperty(): '%s' is defined as a non-dynamic type.", id); - return NULL; - } - - if(pyopts && pyrna_set_to_enum_bitfield(property_flag_items, pyopts, &opts, "PointerProperty(options={...}):")) - return NULL; + BPY_PROPDEF_CHECK(PointerProperty) ptype= pointer_type_from_py(type, "PointerProperty(...):"); if(!ptype) @@ -767,22 +707,17 @@ static PyObject *BPy_CollectionProperty(PyObject *self, PyObject *args, PyObject if(srna) { static const char *kwlist[] = {"attr", "type", "name", "description", "options", NULL}; char *id=NULL, *name="", *description=""; + int id_len; PropertyRNA *prop; StructRNA *ptype; PyObject *type= Py_None; PyObject *pyopts= NULL; int opts=0; - if (!PyArg_ParseTupleAndKeywords(args, kw, "sO|ssO!:CollectionProperty", (char **)kwlist, &id, &type, &name, &description, &PySet_Type, &pyopts)) + if (!PyArg_ParseTupleAndKeywords(args, kw, "s#O|ssO!:CollectionProperty", (char **)kwlist, &id, &id_len, &type, &name, &description, &PySet_Type, &pyopts)) return NULL; - if(RNA_def_property_free_identifier(srna, id) == -1) { - PyErr_Format(PyExc_TypeError, "CollectionProperty(): '%s' is defined as a non-dynamic type.", id); - return NULL; - } - - if(pyopts && pyrna_set_to_enum_bitfield(property_flag_items, pyopts, &opts, "CollectionProperty(options={...}):")) - return NULL; + BPY_PROPDEF_CHECK(CollectionProperty) ptype= pointer_type_from_py(type, "CollectionProperty(...):"); if(!ptype) diff --git a/source/blender/quicktime/apple/quicktime_export.c b/source/blender/quicktime/apple/quicktime_export.c index 2623a598d5f..362f17ee945 100644 --- a/source/blender/quicktime/apple/quicktime_export.c +++ b/source/blender/quicktime/apple/quicktime_export.c @@ -621,7 +621,9 @@ void end_qt(void) { //printf("Finished QuickTime movie.\n"); } - ExitMoviesOnThread(); +#ifdef __APPLE__ + ExitMoviesOnThread(); +#endif if(qtexport) { MEM_freeN(qtexport); diff --git a/source/blender/quicktime/apple/quicktime_import.c b/source/blender/quicktime/apple/quicktime_import.c index 699b2c4f6e3..917a75772ce 100644 --- a/source/blender/quicktime/apple/quicktime_import.c +++ b/source/blender/quicktime/apple/quicktime_import.c @@ -48,6 +48,7 @@ #include <QTML.h> #include <TextUtils.h> #include <QuickTimeComponents.h> +#include <QTLoadLibraryUtils.h> #endif /* _WIN32 */ diff --git a/source/blender/readblenfile/CMakeLists.txt b/source/blender/readblenfile/CMakeLists.txt index a6522ffa758..0917599f3d4 100644 --- a/source/blender/readblenfile/CMakeLists.txt +++ b/source/blender/readblenfile/CMakeLists.txt @@ -24,10 +24,18 @@ # # ***** END GPL LICENSE BLOCK ***** -FILE(GLOB SRC intern/*.c) - SET(INC - . ../blenloader ../blenloader/intern ../blenkernel ../blenlib ../makesdna ../../kernel/gen_messaging + . + ../blenloader + ../blenloader/intern + ../blenkernel + ../blenlib + ../makesdna + ../../kernel/gen_messaging +) + +SET(SRC + intern/BLO_readblenfile.c ) BLENDERLIB(bf_readblenfile "${SRC}" "${INC}") diff --git a/source/blender/render/CMakeLists.txt b/source/blender/render/CMakeLists.txt index 5085a371688..10a6d891e42 100644 --- a/source/blender/render/CMakeLists.txt +++ b/source/blender/render/CMakeLists.txt @@ -25,9 +25,7 @@ # ***** END GPL LICENSE BLOCK ***** # remove warning until render branch merged. -STRING(REGEX REPLACE "-Wunused-parameter" "" CMAKE_C_FLAGS ${CMAKE_C_FLAGS}) - -FILE(GLOB SRC intern/source/*.c intern/raytrace/*.cpp) +REMOVE_STRICT_FLAGS() SET(INC intern/include @@ -45,6 +43,42 @@ SET(INC ../freestyle ) +SET(SRC + intern/raytrace/rayobject.cpp + intern/raytrace/rayobject_qbvh.cpp + intern/raytrace/rayobject_rtbuild.cpp + intern/raytrace/rayobject_svbvh.cpp + intern/raytrace/rayobject_vbvh.cpp + intern/source/convertblender.c + intern/source/envmap.c + intern/source/gammaCorrectionTables.c + intern/source/imagetexture.c + intern/source/initrender.c + intern/source/occlusion.c + intern/source/pipeline.c + intern/source/pixelblending.c + intern/source/pixelshading.c + intern/source/pointdensity.c + intern/source/rayobject_blibvh.c + intern/source/rayobject_instance.c + intern/source/rayobject_octree.c + intern/source/rayobject_raycounter.c + intern/source/rayshade.c + intern/source/rendercore.c + intern/source/renderdatabase.c + intern/source/shadbuf.c + intern/source/shadeinput.c + intern/source/shadeoutput.c + intern/source/sss.c + intern/source/strand.c + intern/source/sunsky.c + intern/source/texture.c + intern/source/volume_precache.c + intern/source/volumetric.c + intern/source/voxeldata.c + intern/source/zbuf.c +) + IF(WIN32) LIST(APPEND INC ${PTHREADS_INC}) ENDIF(WIN32) diff --git a/source/blender/render/extern/include/RE_shader_ext.h b/source/blender/render/extern/include/RE_shader_ext.h index 6cab4a7ce03..71ce269fce6 100644 --- a/source/blender/render/extern/include/RE_shader_ext.h +++ b/source/blender/render/extern/include/RE_shader_ext.h @@ -52,7 +52,7 @@ typedef struct ShadeResult float emit[3]; float diff[3]; /* no ramps, shadow, etc */ float spec[3]; - float shad[3]; + float shad[4]; /* shad[3] is shadow intensity */ float ao[3]; float env[3]; float indirect[3]; diff --git a/source/blender/render/intern/raytrace/rayobject.cpp b/source/blender/render/intern/raytrace/rayobject.cpp index 84ec56e131a..119a62ad05a 100644 --- a/source/blender/render/intern/raytrace/rayobject.cpp +++ b/source/blender/render/intern/raytrace/rayobject.cpp @@ -533,7 +533,11 @@ float RE_rayobject_cost(RayObject *r) r = RE_rayobject_align( r ); return r->api->cost( r ); } - else assert(0); + else + { + assert(0); + return 1.0; /* XXX, better default value? */ + } } void RE_rayobject_hint_bb(RayObject *r, RayHint *hint, float *min, float *max) diff --git a/source/blender/render/intern/source/pipeline.c b/source/blender/render/intern/source/pipeline.c index 1299b4f773b..2d072a58b2b 100644 --- a/source/blender/render/intern/source/pipeline.c +++ b/source/blender/render/intern/source/pipeline.c @@ -2527,7 +2527,7 @@ static void do_render_seq(Render * re) { static int recurs_depth = 0; struct ImBuf *ibuf; - RenderResult *rr = re->result; + RenderResult *rr; /* don't assign re->result here as it might change during give_ibuf_seq */ int cfra = re->r.cfra; re->i.cfra= cfra; @@ -2539,9 +2539,11 @@ static void do_render_seq(Render * re) recurs_depth++; - ibuf= give_ibuf_seq(re->main, re->scene, rr->rectx, rr->recty, cfra, 0, 100.0); + ibuf= give_ibuf_seq(re->main, re->scene, re->result->rectx, re->result->recty, cfra, 0, 100.0); recurs_depth--; + + rr = re->result; BLI_rw_mutex_lock(&re->resultmutex, THREAD_LOCK_WRITE); @@ -2604,6 +2606,9 @@ static void do_render_seq(Render * re) } BLI_rw_mutex_unlock(&re->resultmutex); + + /* just in case this flag went missing at some point */ + re->r.scemode |= R_DOSEQ; } /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ diff --git a/source/blender/render/intern/source/shadeoutput.c b/source/blender/render/intern/source/shadeoutput.c index 2676a2236dd..814c4413525 100644 --- a/source/blender/render/intern/source/shadeoutput.c +++ b/source/blender/render/intern/source/shadeoutput.c @@ -1396,6 +1396,7 @@ static void shade_one_light(LampRen *lar, ShadeInput *shi, ShadeResult *shr, int } i*= shadfac[3]; + shr->shad[3] = shadfac[3]; /* store this for possible check in troublesome cases */ } } } @@ -1730,10 +1731,17 @@ void shade_lamp_loop(ShadeInput *shi, ShadeResult *shr) VECCOPY(shr->combined, shr->diff); /* calculate shadow pass, we use a multiplication mask */ - if(passflag & SCE_PASS_SHADOW) { + /* if diff = 0,0,0 it doesn't matter what the shadow pass is, so leave it as is */ + if(passflag & SCE_PASS_SHADOW && !(shr->diff[0]==0.0f && shr->diff[1]==0.0f && shr->diff[2]==0.0f)) { if(shr->diff[0]!=0.0f) shr->shad[0]= shr->shad[0]/shr->diff[0]; + /* can't determine proper shadow from shad/diff (0/0), so use shadow intensity */ + else if(shr->shad[0]==0.0f) shr->shad[0]= shr->shad[3]; + if(shr->diff[1]!=0.0f) shr->shad[1]= shr->shad[1]/shr->diff[1]; + else if(shr->shad[1]==0.0f) shr->shad[1]= shr->shad[3]; + if(shr->diff[2]!=0.0f) shr->shad[2]= shr->shad[2]/shr->diff[2]; + else if(shr->shad[2]==0.0f) shr->shad[2]= shr->shad[3]; } /* exposure correction */ diff --git a/source/blender/windowmanager/CMakeLists.txt b/source/blender/windowmanager/CMakeLists.txt index 1919bf8e571..36d9f2b5c8c 100644 --- a/source/blender/windowmanager/CMakeLists.txt +++ b/source/blender/windowmanager/CMakeLists.txt @@ -24,8 +24,6 @@ # # ***** END GPL LICENSE BLOCK ***** -FILE(GLOB SRC intern/*.c) - SET(INC . ../nodes @@ -50,6 +48,23 @@ SET(INC ${OPENGL_INCLUDE_DIR} ) +SET(SRC + intern/wm.c + intern/wm_apple.c + intern/wm_cursors.c + intern/wm_dragdrop.c + intern/wm_draw.c + intern/wm_event_system.c + intern/wm_files.c + intern/wm_gesture.c + intern/wm_init_exit.c + intern/wm_jobs.c + intern/wm_keymap.c + intern/wm_operators.c + intern/wm_subwindow.c + intern/wm_window.c +) + ADD_DEFINITIONS(-DGLEW_STATIC) IF(WITH_INTERNATIONAL) diff --git a/source/blender/windowmanager/WM_api.h b/source/blender/windowmanager/WM_api.h index 197f99b989e..2a36e91ac66 100644 --- a/source/blender/windowmanager/WM_api.h +++ b/source/blender/windowmanager/WM_api.h @@ -119,7 +119,7 @@ wmKeyMapItem *WM_keymap_add_item(struct wmKeyMap *keymap, char *idname, int type wmKeyMapItem *WM_keymap_add_menu(struct wmKeyMap *keymap, char *idname, int type, int val, int modifier, int keymodifier); -void WM_keymap_remove_item(struct wmKeyMap *keymap, struct wmKeyMapItem *kmi); +void WM_keymap_remove_item(struct wmKeyMap *keymap, struct wmKeyMapItem *kmi); char *WM_keymap_item_to_string(wmKeyMapItem *kmi, char *str, int len); wmKeyMap *WM_keymap_list_find(ListBase *lb, char *idname, int spaceid, int regionid); @@ -220,7 +220,7 @@ struct wmOperatorTypeMacro *WM_operatortype_macro_define(struct wmOperatorType * int WM_operator_poll (struct bContext *C, struct wmOperatorType *ot); int WM_operator_call (struct bContext *C, struct wmOperator *op); int WM_operator_repeat (struct bContext *C, struct wmOperator *op); -int WM_operator_name_call (struct bContext *C, const char *opstring, int context, struct PointerRNA *properties); +int WM_operator_name_call (struct bContext *C, const char *opstring, int context, struct PointerRNA *properties); int WM_operator_call_py(struct bContext *C, struct wmOperatorType *ot, int context, struct PointerRNA *properties, struct ReportList *reports); void WM_operator_properties_alloc(struct PointerRNA **ptr, struct IDProperty **properties, const char *opstring); /* used for keymap and macro items */ @@ -342,6 +342,11 @@ void WM_clipboard_text_set(char *buf, int selection); void WM_progress_set(struct wmWindow *win, float progress); void WM_progress_clear(struct wmWindow *win); +#ifdef WIN32 + /* Windows System Console */ +void WM_toggle_console(struct bContext *C, short show); +#endif + #ifdef __cplusplus } #endif diff --git a/source/blender/windowmanager/intern/wm_files.c b/source/blender/windowmanager/intern/wm_files.c index 00a686c0d74..6db7f2554c4 100644 --- a/source/blender/windowmanager/intern/wm_files.c +++ b/source/blender/windowmanager/intern/wm_files.c @@ -453,10 +453,16 @@ static void write_history(void) { struct RecentFile *recent, *next_recent; char name[FILE_MAXDIR+FILE_MAXFILE]; + char *user_config_dir; FILE *fp; int i; - BLI_make_file_string("/", name, BLI_get_folder_create(BLENDER_USER_CONFIG, NULL), BLENDER_HISTORY_FILE); + /* will be NULL in background mode */ + user_config_dir = BLI_get_folder_create(BLENDER_USER_CONFIG, NULL); + if(!user_config_dir) + return; + + BLI_make_file_string("/", name, user_config_dir, BLENDER_HISTORY_FILE); recent = G.recent_files.first; /* refresh recent-files.txt of recent opened files, when current file was changed */ diff --git a/source/blender/windowmanager/intern/wm_init_exit.c b/source/blender/windowmanager/intern/wm_init_exit.c index b319058ce5c..e373579577d 100644 --- a/source/blender/windowmanager/intern/wm_init_exit.c +++ b/source/blender/windowmanager/intern/wm_init_exit.c @@ -145,6 +145,9 @@ void WM_init(bContext *C, int argc, char **argv) BPY_set_context(C); /* necessary evil */ BPY_start_python(argc, argv); BPY_load_user_modules(C); +#else + (void)argc; /* unused */ + (void)argv; /* unused */ #endif wm_init_reports(C); /* reports cant be initialized before the wm */ @@ -212,7 +215,7 @@ int WM_init_game(bContext *C) wmWindow* win; ScrArea *sa; - ARegion *ar; + ARegion *ar= NULL; Scene *scene= CTX_data_scene(C); diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c index de08c209d06..ccdb19adfce 100644 --- a/source/blender/windowmanager/intern/wm_operators.c +++ b/source/blender/windowmanager/intern/wm_operators.c @@ -31,7 +31,10 @@ #include <ctype.h> #include <stdio.h> #include <stddef.h> - +#ifdef WIN32 +#include <windows.h> +#include <io.h> +#endif #include "DNA_ID.h" #include "DNA_object_types.h" @@ -2007,6 +2010,60 @@ static void WM_OT_quit_blender(wmOperatorType *ot) ot->poll= WM_operator_winactive; } +/* *********************** */ +#ifdef WIN32 +static int console= 1; +void WM_toggle_console(bContext *C, short show) +{ + if(show) { + FILE *fp; + char fn[FILE_MAX]; + char tmp[FILE_MAXDIR]; + BLI_where_is_temp(tmp, 1); + BLI_make_file_string("/", fn, tmp, "blenderlog.txt"); + /* open the console */ + AllocConsole(); + + /* redirect stdin */ + fp= freopen(fn, "r", stdin); + SetStdHandle(STD_INPUT_HANDLE, (HANDLE)_get_osfhandle(_fileno(stdin))); + /* redirect stdout */ + fp= freopen(fn, "w", stdout); + SetStdHandle(STD_OUTPUT_HANDLE, (HANDLE)_get_osfhandle(_fileno(stdout))); + /* redirect stderr */ + fp= freopen(fn, "w", stderr); + SetStdHandle(STD_ERROR_HANDLE, (HANDLE)_get_osfhandle(_fileno(stderr))); + + console= 1; + } + else { + FreeConsole(); + console= 0; + } +} + +static int wm_toggle_console_op(bContext *C, wmOperator *op) +{ + if(console) { + WM_toggle_console(C, 0); + } + else { + WM_toggle_console(C, 1); + } + return OPERATOR_FINISHED; +} + +static void WM_OT_toggle_console(wmOperatorType *ot) +{ + ot->name= "Toggle System Console"; + ot->idname= "WM_OT_toggle_console"; + ot->description= "Toggle System Console"; + + ot->exec= wm_toggle_console_op; + ot->poll= WM_operator_winactive; +} +#endif + /* ************ default paint cursors, draw always around cursor *********** */ /* - returns handler to free @@ -3079,6 +3136,9 @@ void wm_operatortype_init(void) WM_operatortype_append(WM_OT_splash); WM_operatortype_append(WM_OT_search_menu); WM_operatortype_append(WM_OT_call_menu); +#ifdef WIN32 + WM_operatortype_append(WM_OT_toggle_console); +#endif #ifdef WITH_COLLADA /* XXX: move these */ diff --git a/source/blender/windowmanager/intern/wm_window.c b/source/blender/windowmanager/intern/wm_window.c index 69a29092058..bbbe49ce3dd 100644 --- a/source/blender/windowmanager/intern/wm_window.c +++ b/source/blender/windowmanager/intern/wm_window.c @@ -63,6 +63,7 @@ #include "PIL_time.h" #include "GPU_draw.h" +#include "GPU_extensions.h" /* the global to talk to ghost */ GHOST_SystemHandle g_system= NULL; @@ -320,6 +321,8 @@ static void wm_window_add_ghostwindow(bContext *C, char *title, wmWindow *win) 0 /* no AA */); if (ghostwin) { + /* needed so we can detect the graphics card below */ + GPU_extensions_init(); /* set the state*/ GHOST_SetWindowState(ghostwin, initial_state); @@ -332,7 +335,11 @@ static void wm_window_add_ghostwindow(bContext *C, char *title, wmWindow *win) /* until screens get drawn, make it nice grey */ glClearColor(.55, .55, .55, 0.0); - glClear(GL_COLOR_BUFFER_BIT); + /* Crash on OSS ATI: bugs.launchpad.net/ubuntu/+source/mesa/+bug/656100 */ + if(!GPU_type_matches(GPU_DEVICE_ATI, GPU_OS_UNIX, GPU_DRIVER_OPENSOURCE)) { + glClear(GL_COLOR_BUFFER_BIT); + } + wm_window_swap_buffers(win); //GHOST_SetWindowState(ghostwin, GHOST_kWindowStateModified); diff --git a/source/blenderplayer/bad_level_call_stubs/CMakeLists.txt b/source/blenderplayer/bad_level_call_stubs/CMakeLists.txt index 473cc823f12..a242c8b7551 100644 --- a/source/blenderplayer/bad_level_call_stubs/CMakeLists.txt +++ b/source/blenderplayer/bad_level_call_stubs/CMakeLists.txt @@ -25,14 +25,7 @@ # ***** END GPL LICENSE BLOCK ***** # this warning on generated files gets annoying -STRING(REGEX REPLACE "-Wunused-parameter" "" CMAKE_C_FLAGS ${CMAKE_C_FLAGS}) - -FILE(GLOB SRC stubs.c) - -IF(WITH_BUILDINFO) - ADD_DEFINITIONS(-DBUILD_DATE) - FILE(GLOB SRC ${SRC} ../../creator/buildinfo.c) -ENDIF(WITH_BUILDINFO) +REMOVE_STRICT_FLAGS() SET(INC . @@ -43,6 +36,17 @@ SET(INC ../../../source/blender/blenkernel ) +SET(SRC + stubs.c +) + +IF(WITH_BUILDINFO) + ADD_DEFINITIONS(-DBUILD_DATE) + LIST(APPEND SRC + ../../creator/buildinfo.c + ) +ENDIF(WITH_BUILDINFO) + IF(WITH_GAMEENGINE) ADD_DEFINITIONS(-DGAMEBLENDER) ENDIF(WITH_GAMEENGINE) diff --git a/source/blenderplayer/bad_level_call_stubs/stubs.c b/source/blenderplayer/bad_level_call_stubs/stubs.c index 5fa09cebf29..f2970293b05 100644 --- a/source/blenderplayer/bad_level_call_stubs/stubs.c +++ b/source/blenderplayer/bad_level_call_stubs/stubs.c @@ -89,6 +89,7 @@ struct wmKeyMap; struct wmOperator; struct wmWindowManager; struct View3D; +struct ToolSettings; /*new render funcs */ @@ -174,6 +175,7 @@ int ED_pose_channel_in_IK_chain(struct Object *ob, struct bPoseChannel *pchan){r int ED_space_image_show_uvedit(struct SpaceImage *sima, struct Object *obedit){return 0;} int ED_space_image_show_render(struct SpaceImage *sima){return 0;} int ED_space_image_show_paint(struct SpaceImage *sima){return 0;} +void ED_space_image_paint_update(struct wmWindowManager *wm, struct ToolSettings *settings){} void ED_space_image_set(struct bContext *C, struct SpaceImage *sima, struct Scene *scene, struct Object *obedit, struct Image *ima){} struct ImBuf *ED_space_image_buffer(struct SpaceImage *sima){return (struct ImBuf *) NULL;} void ED_screen_set_scene(struct bContext *C, struct Scene *scene){} diff --git a/source/creator/CMakeLists.txt b/source/creator/CMakeLists.txt index 3dfd8755ef2..f0b3ac53343 100644 --- a/source/creator/CMakeLists.txt +++ b/source/creator/CMakeLists.txt @@ -96,15 +96,19 @@ IF(WIN32) ENDIF(WIN32) IF(WITH_BUILDINFO) + STRING(REPLACE " " "\ " BUILDINFO_CFLAGS ${CMAKE_C_FLAGS}) + STRING(REPLACE " " "\ " BUILDINFO_CXXFLAGS ${CMAKE_CXX_FLAGS}) + STRING(REPLACE " " "\ " BUILDINFO_LINKFLAGS ${PLATFORM_LINKFLAGS}) ADD_DEFINITIONS( -DBUILD_DATE="${BUILD_DATE}" -DBUILD_TIME="${BUILD_TIME}" -DBUILD_REV="${BUILD_REV}" -DBUILD_PLATFORM="${CMAKE_SYSTEM_NAME}" -DBUILD_TYPE="${CMAKE_BUILD_TYPE}" - -DBUILD_CFLAGS="${CMAKE_C_FLAGS}" - -DBUILD_CXXFLAGS="${CMAKE_CXX_FLAGS}" - -DBUILD_LINKFLAGS="${PLATFORM_LINKFLAGS}" + -DBUILD_CFLAGS="${BUILDINFO_CFLAGS}" + -DBUILD_CXXFLAGS="${BUILDINFO_CXXFLAGS}" + -DBUILD_LINKFLAGS="${BUILDINFO_LINKFLAGS}" + -DBUILD_SYSTEM="CMake" ) LIST(APPEND EXESRC buildinfo.c) @@ -451,9 +455,9 @@ FILE(READ ${CMAKE_BINARY_DIR}/cmake_blender_libs.txt BLENDER_LINK_LIBS) SET(BLENDER_LINK_LIBS bf_nodes ${BLENDER_LINK_LIBS} bf_windowmanager bf_render) -IF(WITH_FLUID) +IF(WITH_MOD_FLUID) LIST(APPEND BLENDER_LINK_LIBS bf_intern_elbeem) -ENDIF(WITH_FLUID) +ENDIF(WITH_MOD_FLUID) #IF(UNIX) diff --git a/source/creator/buildinfo.c b/source/creator/buildinfo.c index cf6f5a11c45..2203a97aa91 100644 --- a/source/creator/buildinfo.c +++ b/source/creator/buildinfo.c @@ -40,10 +40,12 @@ char build_type[]= STRINGIFY(BUILD_TYPE); char build_cflags[]= STRINGIFY(BUILD_CFLAGS); char build_cxxflags[]= STRINGIFY(BUILD_CXXFLAGS); char build_linkflags[]= STRINGIFY(BUILD_LINKFLAGS); +char build_system[]= STRINGIFY(BUILD_SYSTEM); #else char build_cflags[]= "unmaintained buildsystem alert!"; char build_cxxflags[]= "unmaintained buildsystem alert!"; char build_linkflags[]= "unmaintained buildsystem alert!"; +char build_system[]= "unmaintained buildsystem alert!"; #endif #endif // BUILD_DATE diff --git a/source/creator/creator.c b/source/creator/creator.c index b5ead098e99..a89bef537a9 100644 --- a/source/creator/creator.c +++ b/source/creator/creator.c @@ -123,6 +123,7 @@ extern char build_type[]; extern char build_cflags[]; extern char build_cxxflags[]; extern char build_linkflags[]; +extern char build_system[]; #endif /* Local Function prototypes */ @@ -192,6 +193,7 @@ static int print_version(int UNUSED(argc), char **UNUSED(argv), void *UNUSED(dat printf ("\tbuild c flags: %s\n", build_cflags); printf ("\tbuild c++ flags: %s\n", build_cxxflags); printf ("\tbuild link flags: %s\n", build_linkflags); + printf ("\tbuild system: %s\n", build_system); #endif exit(0); @@ -853,6 +855,7 @@ static int run_python(int argc, char **argv, void *data) return 0; } #else + (void)argc; (void)argv; (void)data; /* unused */ printf("This blender was built without python support\n"); return 0; #endif /* DISABLE_PYTHON */ @@ -868,6 +871,7 @@ static int run_python_console(int UNUSED(argc), char **argv, void *data) return 0; #else + (void)argv; (void)data; /* unused */ printf("This blender was built without python support\n"); return 0; #endif /* DISABLE_PYTHON */ @@ -1048,14 +1052,15 @@ int main(int argc, char **argv) BLI_where_am_i(bprogname, argv[0]); #ifdef BUILD_DATE - strip_quotes(build_date); - strip_quotes(build_time); - strip_quotes(build_rev); - strip_quotes(build_platform); - strip_quotes(build_type); - strip_quotes(build_cflags); - strip_quotes(build_cxxflags); - strip_quotes(build_linkflags); + strip_quotes(build_date); + strip_quotes(build_time); + strip_quotes(build_rev); + strip_quotes(build_platform); + strip_quotes(build_type); + strip_quotes(build_cflags); + strip_quotes(build_cxxflags); + strip_quotes(build_linkflags); + strip_quotes(build_system); #endif BLI_threadapi_init(); diff --git a/source/gameengine/BlenderRoutines/CMakeLists.txt b/source/gameengine/BlenderRoutines/CMakeLists.txt index 853cba543a4..661f9c5b25d 100644 --- a/source/gameengine/BlenderRoutines/CMakeLists.txt +++ b/source/gameengine/BlenderRoutines/CMakeLists.txt @@ -1,6 +1,4 @@ -FILE(GLOB SRC *.cpp) - SET(INC . ../../../source/kernel/gen_system @@ -37,6 +35,17 @@ SET(INC ../../../extern/glew/include ) +SET(SRC + BL_KetsjiEmbedStart.cpp + KX_BlenderCanvas.cpp + KX_BlenderGL.cpp + KX_BlenderInputDevice.cpp + KX_BlenderKeyboardDevice.cpp + KX_BlenderMouseDevice.cpp + KX_BlenderRenderTools.cpp + KX_BlenderSystem.cpp +) + ADD_DEFINITIONS(-DGLEW_STATIC) IF(WITH_FFMPEG) diff --git a/source/gameengine/Converter/CMakeLists.txt b/source/gameengine/Converter/CMakeLists.txt index 87e413c3a44..e6b5f6c81a0 100644 --- a/source/gameengine/Converter/CMakeLists.txt +++ b/source/gameengine/Converter/CMakeLists.txt @@ -24,8 +24,6 @@ # # ***** END GPL LICENSE BLOCK ***** -FILE(GLOB SRC *.cpp) - SET(INC . ../../../source/kernel/gen_system @@ -63,6 +61,30 @@ SET(INC ../../../extern/bullet2/src ) +SET(SRC + BL_ActionActuator.cpp + BL_ArmatureActuator.cpp + BL_ArmatureChannel.cpp + BL_ArmatureConstraint.cpp + BL_ArmatureObject.cpp + BL_BlenderDataConversion.cpp + BL_DeformableGameObject.cpp + BL_MeshDeformer.cpp + BL_ModifierDeformer.cpp + BL_ShapeActionActuator.cpp + BL_ShapeDeformer.cpp + BL_SkinDeformer.cpp + BlenderWorldInfo.cpp + KX_BlenderScalarInterpolator.cpp + KX_BlenderSceneConverter.cpp + KX_ConvertActuators.cpp + KX_ConvertControllers.cpp + KX_ConvertProperties.cpp + KX_ConvertSensors.cpp + KX_IpoConvert.cpp + KX_SoftBodyDeformer.cpp +) + IF(WITH_PYTHON) LIST(APPEND INC ${PYTHON_INC}) ELSE(WITH_PYTHON) diff --git a/source/gameengine/Converter/KX_BlenderSceneConverter.cpp b/source/gameengine/Converter/KX_BlenderSceneConverter.cpp index 6f64f4e33af..7ec7104f1f4 100644 --- a/source/gameengine/Converter/KX_BlenderSceneConverter.cpp +++ b/source/gameengine/Converter/KX_BlenderSceneConverter.cpp @@ -623,12 +623,6 @@ void KX_BlenderSceneConverter::RegisterWorldInfo( m_worldinfos.push_back(pair<KX_Scene*,KX_WorldInfo*>(m_currentScene,worldinfo)); } -//quick hack -extern "C" -{ - void mat3_to_compatible_eul( float *eul, float *oldrot,float mat[][3]); -} - void KX_BlenderSceneConverter::ResetPhysicsObjectsAnimationIpo(bool clearIpo) { diff --git a/source/gameengine/Expressions/CMakeLists.txt b/source/gameengine/Expressions/CMakeLists.txt index 126192d2188..828afa7ae92 100644 --- a/source/gameengine/Expressions/CMakeLists.txt +++ b/source/gameengine/Expressions/CMakeLists.txt @@ -24,8 +24,6 @@ # # ***** END GPL LICENSE BLOCK ***** -FILE(GLOB SRC *.cpp) - SET(INC . ../../../source/kernel/gen_system @@ -36,6 +34,28 @@ SET(INC ../../../source/blender/blenloader ) +SET(SRC + BoolValue.cpp + ConstExpr.cpp + EXP_C-Api.cpp + EmptyValue.cpp + ErrorValue.cpp + Expression.cpp + FloatValue.cpp + IdentifierExpr.cpp + IfExpr.cpp + InputParser.cpp + IntValue.cpp + KX_HashedPtr.cpp + ListValue.cpp + Operator1Expr.cpp + Operator2Expr.cpp + PyObjectPlus.cpp + StringValue.cpp + Value.cpp + VectorValue.cpp +) + IF(WITH_PYTHON) LIST(APPEND INC ${PYTHON_INC}) ELSE(WITH_PYTHON) diff --git a/source/gameengine/GameLogic/CMakeLists.txt b/source/gameengine/GameLogic/CMakeLists.txt index 84d915847e9..57150a90e99 100644 --- a/source/gameengine/GameLogic/CMakeLists.txt +++ b/source/gameengine/GameLogic/CMakeLists.txt @@ -24,8 +24,6 @@ # # ***** END GPL LICENSE BLOCK ***** -FILE(GLOB SRC *.cpp Joystick/*.cpp) - SET(INC . ../../../source/kernel/gen_system @@ -36,6 +34,51 @@ SET(INC ../../../source/gameengine/Rasterizer ) +SET(SRC + Joystick/SCA_Joystick.cpp + Joystick/SCA_JoystickEvents.cpp + SCA_2DFilterActuator.cpp + SCA_ANDController.cpp + SCA_ActuatorEventManager.cpp + SCA_ActuatorSensor.cpp + SCA_AlwaysEventManager.cpp + SCA_AlwaysSensor.cpp + SCA_BasicEventManager.cpp + SCA_DelaySensor.cpp + SCA_EventManager.cpp + SCA_ExpressionController.cpp + SCA_IActuator.cpp + SCA_IController.cpp + SCA_IInputDevice.cpp + SCA_ILogicBrick.cpp + SCA_IObject.cpp + SCA_IScene.cpp + SCA_ISensor.cpp + SCA_JoystickManager.cpp + SCA_JoystickSensor.cpp + SCA_KeyboardManager.cpp + SCA_KeyboardSensor.cpp + SCA_LogicManager.cpp + SCA_MouseManager.cpp + SCA_MouseSensor.cpp + SCA_NANDController.cpp + SCA_NORController.cpp + SCA_ORController.cpp + SCA_PropertyActuator.cpp + SCA_PropertyEventManager.cpp + SCA_PropertySensor.cpp + SCA_PythonController.cpp + SCA_PythonKeyboard.cpp + SCA_PythonMouse.cpp + SCA_RandomActuator.cpp + SCA_RandomEventManager.cpp + SCA_RandomNumberGenerator.cpp + SCA_RandomSensor.cpp + SCA_TimeEventManager.cpp + SCA_XNORController.cpp + SCA_XORController.cpp +) + IF(WITH_SDL) SET(INC ${INC} ${SDL_INCLUDE_DIR}) ELSE(WITH_SDL) diff --git a/source/gameengine/GameLogic/SCA_IInputDevice.h b/source/gameengine/GameLogic/SCA_IInputDevice.h index a13efee1316..0dbfe424e2c 100644 --- a/source/gameengine/GameLogic/SCA_IInputDevice.h +++ b/source/gameengine/GameLogic/SCA_IInputDevice.h @@ -47,7 +47,6 @@ public: KX_JUSTACTIVATED, KX_ACTIVE, KX_JUSTRELEASED, - KX_MAX_INPUTSTATUS }; SCA_InputEvent(SCA_EnumInputs status=KX_NO_INPUTSTATUS,int eventval=0) diff --git a/source/gameengine/GameLogic/SCA_KeyboardSensor.cpp b/source/gameengine/GameLogic/SCA_KeyboardSensor.cpp index c49d65226dc..1a87528e540 100644 --- a/source/gameengine/GameLogic/SCA_KeyboardSensor.cpp +++ b/source/gameengine/GameLogic/SCA_KeyboardSensor.cpp @@ -156,6 +156,9 @@ bool SCA_KeyboardSensor::Evaluate() case SCA_InputEvent::KX_ACTIVE: active = true; break; + case SCA_InputEvent::KX_NO_INPUTSTATUS: + /* do nothing */ + break; } } @@ -221,6 +224,9 @@ bool SCA_KeyboardSensor::Evaluate() break; case SCA_InputEvent::KX_JUSTACTIVATED: qual_change = true; + case SCA_InputEvent::KX_ACTIVE: + /* do nothing */ + break; } } if (m_qual2 > 0 && qual==true) { @@ -236,6 +242,9 @@ bool SCA_KeyboardSensor::Evaluate() break; case SCA_InputEvent::KX_JUSTACTIVATED: qual_change = true; + case SCA_InputEvent::KX_ACTIVE: + /* do nothing */ + break; } } /* done reading qualifiers */ diff --git a/source/gameengine/GamePlayer/common/CMakeLists.txt b/source/gameengine/GamePlayer/common/CMakeLists.txt index 08a4aa50a00..47ac7f73a51 100644 --- a/source/gameengine/GamePlayer/common/CMakeLists.txt +++ b/source/gameengine/GamePlayer/common/CMakeLists.txt @@ -24,19 +24,6 @@ # # ***** END GPL LICENSE BLOCK ***** -SET(SRC - bmfont.cpp - GPC_Canvas.cpp - GPC_Engine.cpp - GPC_KeyboardDevice.cpp - GPC_MouseDevice.cpp - GPC_RawImage.cpp - GPC_RawLoadDotBlendArray.cpp - GPC_RawLogoArrays.cpp - GPC_RenderTools.cpp - GPC_System.cpp -) - SET(INC . ../../../../intern/string @@ -71,6 +58,19 @@ SET(INC ${ZLIB_INC} ) +SET(SRC + bmfont.cpp + GPC_Canvas.cpp + GPC_Engine.cpp + GPC_KeyboardDevice.cpp + GPC_MouseDevice.cpp + GPC_RawImage.cpp + GPC_RawLoadDotBlendArray.cpp + GPC_RawLogoArrays.cpp + GPC_RenderTools.cpp + GPC_System.cpp +) + ADD_DEFINITIONS(-DGLEW_STATIC) BLENDERLIB_NOLIST(gp_common "${SRC}" "${INC}") diff --git a/source/gameengine/GamePlayer/ghost/CMakeLists.txt b/source/gameengine/GamePlayer/ghost/CMakeLists.txt index 8164878762c..6ce9f7be280 100644 --- a/source/gameengine/GamePlayer/ghost/CMakeLists.txt +++ b/source/gameengine/GamePlayer/ghost/CMakeLists.txt @@ -24,14 +24,6 @@ # # ***** END GPL LICENSE BLOCK ***** -SET(SRC - GPG_Application.cpp - GPG_Canvas.cpp - GPG_ghost.cpp - GPG_KeyboardDevice.cpp - GPG_System.cpp -) - SET(INC . ../../../../intern/string @@ -66,6 +58,14 @@ SET(INC ${PYTHON_INC} ) +SET(SRC + GPG_Application.cpp + GPG_Canvas.cpp + GPG_ghost.cpp + GPG_KeyboardDevice.cpp + GPG_System.cpp +) + ADD_DEFINITIONS(-DGLEW_STATIC) IF(WITH_FFMPEG) diff --git a/source/gameengine/Ketsji/CMakeLists.txt b/source/gameengine/Ketsji/CMakeLists.txt index b128f33c6e4..68f0a0de994 100644 --- a/source/gameengine/Ketsji/CMakeLists.txt +++ b/source/gameengine/Ketsji/CMakeLists.txt @@ -24,8 +24,6 @@ # # ***** END GPL LICENSE BLOCK ***** -FILE(GLOB SRC *.cpp) - SET(INC . ../../../source/kernel/gen_system @@ -59,6 +57,76 @@ SET(INC ../../../extern/glew/include ) +SET(SRC + BL_BlenderShader.cpp + BL_Material.cpp + BL_Shader.cpp + BL_Texture.cpp + KX_ArmatureSensor.cpp + KX_BlenderMaterial.cpp + KX_BulletPhysicsController.cpp + KX_Camera.cpp + KX_CameraActuator.cpp + KX_CameraIpoSGController.cpp + KX_ConstraintActuator.cpp + KX_ConstraintWrapper.cpp + KX_ConvertPhysicsObjects.cpp + KX_Dome.cpp + KX_EmptyObject.cpp + KX_GameActuator.cpp + KX_GameObject.cpp + KX_IPO_SGController.cpp + KX_IPhysicsController.cpp + KX_IpoActuator.cpp + KX_KetsjiEngine.cpp + KX_Light.cpp + KX_LightIpoSGController.cpp + KX_MaterialIpoController.cpp + KX_MeshProxy.cpp + KX_MotionState.cpp + KX_MouseFocusSensor.cpp + KX_NearSensor.cpp + KX_ObColorIpoSGController.cpp + KX_ObjectActuator.cpp + KX_OrientationInterpolator.cpp + KX_ParentActuator.cpp + KX_PhysicsObjectWrapper.cpp + KX_PolyProxy.cpp + KX_PolygonMaterial.cpp + KX_PositionInterpolator.cpp + KX_PyConstraintBinding.cpp + KX_PyMath.cpp + KX_PythonInit.cpp + KX_PythonInitTypes.cpp + KX_PythonSeq.cpp + KX_RadarSensor.cpp + KX_RayCast.cpp + KX_RayEventManager.cpp + KX_RaySensor.cpp + KX_SCA_AddObjectActuator.cpp + KX_SCA_DynamicActuator.cpp + KX_SCA_EndObjectActuator.cpp + KX_SCA_ReplaceMeshActuator.cpp + KX_SG_BoneParentNodeRelationship.cpp + KX_SG_NodeRelationships.cpp + KX_ScalarInterpolator.cpp + KX_ScalingInterpolator.cpp + KX_Scene.cpp + KX_SceneActuator.cpp + KX_SoundActuator.cpp + KX_StateActuator.cpp + KX_TimeCategoryLogger.cpp + KX_TimeLogger.cpp + KX_TouchEventManager.cpp + KX_TouchSensor.cpp + KX_TrackToActuator.cpp + KX_VehicleWrapper.cpp + KX_VertexProxy.cpp + KX_VisibilityActuator.cpp + KX_WorldInfo.cpp + KX_WorldIpoController.cpp +) + ADD_DEFINITIONS(-DGLEW_STATIC) IF(WITH_SDL) diff --git a/source/gameengine/Ketsji/KXNetwork/CMakeLists.txt b/source/gameengine/Ketsji/KXNetwork/CMakeLists.txt index 106d1a84a92..2b1c1a698f3 100644 --- a/source/gameengine/Ketsji/KXNetwork/CMakeLists.txt +++ b/source/gameengine/Ketsji/KXNetwork/CMakeLists.txt @@ -24,8 +24,6 @@ # # ***** END GPL LICENSE BLOCK ***** -FILE(GLOB SRC *.cpp) - SET(INC . ../../../../source/kernel/gen_system @@ -38,6 +36,14 @@ SET(INC ../../../../source/gameengine/Network ) +SET(SRC + KX_NetworkEventManager.cpp + KX_NetworkMessageActuator.cpp + KX_NetworkMessageSensor.cpp + KX_NetworkObjectActuator.cpp + KX_NetworkObjectSensor.cpp +) + IF(WITH_PYTHON) LIST(APPEND INC ${PYTHON_INC}) ELSE(WITH_PYTHON) diff --git a/source/gameengine/Ketsji/KX_ConvertPhysicsObjects.cpp b/source/gameengine/Ketsji/KX_ConvertPhysicsObjects.cpp index 1888e7cf7b8..e238d7babec 100644 --- a/source/gameengine/Ketsji/KX_ConvertPhysicsObjects.cpp +++ b/source/gameengine/Ketsji/KX_ConvertPhysicsObjects.cpp @@ -218,6 +218,9 @@ void KX_ConvertBulletObject( class KX_GameObject* gameobj, break; } + case KX_BOUND_DYN_MESH: + /* do nothing */ + break; } diff --git a/source/gameengine/Ketsji/KX_TouchEventManager.cpp b/source/gameengine/Ketsji/KX_TouchEventManager.cpp index eb55d0272f6..95928ac5889 100644 --- a/source/gameengine/Ketsji/KX_TouchEventManager.cpp +++ b/source/gameengine/Ketsji/KX_TouchEventManager.cpp @@ -109,6 +109,13 @@ bool KX_TouchEventManager::newBroadphaseResponse(void *client_data, } } return false; + + // quiet the compiler + case KX_ClientObjectInfo::STATIC: + case KX_ClientObjectInfo::ACTOR: + case KX_ClientObjectInfo::RESERVED1: + /* do nothing*/ + break; } return true; } diff --git a/source/gameengine/Network/CMakeLists.txt b/source/gameengine/Network/CMakeLists.txt index 795e63b47c3..3dde84d29c1 100644 --- a/source/gameengine/Network/CMakeLists.txt +++ b/source/gameengine/Network/CMakeLists.txt @@ -24,8 +24,6 @@ # # ***** END GPL LICENSE BLOCK ***** -FILE(GLOB SRC *.cpp) - SET(INC . ../../../source/kernel/gen_system @@ -33,4 +31,10 @@ SET(INC ../../../intern/moto/include ) +SET(SRC + NG_NetworkMessage.cpp + NG_NetworkObject.cpp + NG_NetworkScene.cpp +) + BLENDERLIB(bf_ngnetwork "${SRC}" "${INC}") diff --git a/source/gameengine/Network/LoopBackNetwork/CMakeLists.txt b/source/gameengine/Network/LoopBackNetwork/CMakeLists.txt index e7c34f5a2a0..eae2971ce6a 100644 --- a/source/gameengine/Network/LoopBackNetwork/CMakeLists.txt +++ b/source/gameengine/Network/LoopBackNetwork/CMakeLists.txt @@ -24,8 +24,6 @@ # # ***** END GPL LICENSE BLOCK ***** -SET(SRC NG_LoopBackNetworkDeviceInterface.cpp) - SET(INC . ../../../../source/kernel/gen_system @@ -33,4 +31,8 @@ SET(INC ../../../../source/gameengine/Network ) +SET(SRC + NG_LoopBackNetworkDeviceInterface.cpp +) + BLENDERLIB(bf_loopbacknetwork "${SRC}" "${INC}") diff --git a/source/gameengine/Physics/Bullet/CMakeLists.txt b/source/gameengine/Physics/Bullet/CMakeLists.txt index ba6f3bef0db..faa9385a745 100644 --- a/source/gameengine/Physics/Bullet/CMakeLists.txt +++ b/source/gameengine/Physics/Bullet/CMakeLists.txt @@ -24,8 +24,6 @@ # # ***** END GPL LICENSE BLOCK ***** -SET(SRC CcdPhysicsEnvironment.cpp CcdPhysicsController.cpp CcdGraphicController.cpp) - SET(INC . ../common @@ -46,6 +44,12 @@ SET(INC ${PYTHON_INC} ) +SET(SRC + CcdPhysicsEnvironment.cpp + CcdPhysicsController.cpp + CcdGraphicController.cpp +) + IF(WITH_BULLET) ADD_DEFINITIONS(-DUSE_BULLET) ENDIF(WITH_BULLET) diff --git a/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp b/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp index 477a2c35d4f..eb525af7dc7 100644 --- a/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp +++ b/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp @@ -287,6 +287,7 @@ void CcdPhysicsEnvironment::setDebugDrawer(btIDebugDraw* debugDrawer) m_debugDrawer = debugDrawer; } +#if 0 static void DrawAabb(btIDebugDraw* debugDrawer,const btVector3& from,const btVector3& to,const btVector3& color) { btVector3 halfExtents = (to-from)* 0.5f; @@ -314,10 +315,8 @@ static void DrawAabb(btIDebugDraw* debugDrawer,const btVector3& from,const btVec if (i<3) edgecoord[i]*=-1.f; } - - } - +#endif diff --git a/source/gameengine/Physics/Dummy/CMakeLists.txt b/source/gameengine/Physics/Dummy/CMakeLists.txt index 18330392cd7..501fbcd94de 100644 --- a/source/gameengine/Physics/Dummy/CMakeLists.txt +++ b/source/gameengine/Physics/Dummy/CMakeLists.txt @@ -24,11 +24,13 @@ # # ***** END GPL LICENSE BLOCK ***** -SET(SRC DummyPhysicsEnvironment.cpp) - SET(INC . ../common ) +SET(SRC + DummyPhysicsEnvironment.cpp +) + BLENDERLIB(bf_dummy "${SRC}" "${INC}") diff --git a/source/gameengine/Physics/common/CMakeLists.txt b/source/gameengine/Physics/common/CMakeLists.txt index 0f8f59f3b78..0389280340f 100644 --- a/source/gameengine/Physics/common/CMakeLists.txt +++ b/source/gameengine/Physics/common/CMakeLists.txt @@ -24,12 +24,19 @@ # # ***** END GPL LICENSE BLOCK ***** -SET(SRC PHY_IMotionState.cpp PHY_IController.cpp PHY_IPhysicsController.cpp PHY_IGraphicController.cpp PHY_IPhysicsEnvironment.cpp PHY_IVehicle.cpp) - SET(INC . ../Dummy ../../../intern/moto/include ) +SET(SRC + PHY_IMotionState.cpp + PHY_IController.cpp + PHY_IPhysicsController.cpp + PHY_IGraphicController.cpp + PHY_IPhysicsEnvironment.cpp + PHY_IVehicle.cpp +) + BLENDERLIB(bf_common "${SRC}" "${INC}") diff --git a/source/gameengine/Rasterizer/CMakeLists.txt b/source/gameengine/Rasterizer/CMakeLists.txt index d718bf3e507..9bbf7e144d5 100644 --- a/source/gameengine/Rasterizer/CMakeLists.txt +++ b/source/gameengine/Rasterizer/CMakeLists.txt @@ -24,8 +24,6 @@ # # ***** END GPL LICENSE BLOCK ***** -FILE(GLOB SRC *.cpp) - SET(INC . ../../../source/kernel/gen_system @@ -40,6 +38,19 @@ SET(INC ${PYTHON_INC} ) +SET(SRC + RAS_2DFilterManager.cpp + RAS_BucketManager.cpp + RAS_FramingManager.cpp + RAS_IPolygonMaterial.cpp + RAS_IRenderTools.cpp + RAS_MaterialBucket.cpp + RAS_MeshObject.cpp + RAS_Polygon.cpp + RAS_TexVert.cpp + RAS_texmatrix.cpp +) + ADD_DEFINITIONS(-DGLEW_STATIC) BLENDERLIB(bf_rasterizer "${SRC}" "${INC}") diff --git a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/CMakeLists.txt b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/CMakeLists.txt index cc48952dc20..a89faae3c73 100644 --- a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/CMakeLists.txt +++ b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/CMakeLists.txt @@ -24,8 +24,6 @@ # # ***** END GPL LICENSE BLOCK ***** -FILE(GLOB SRC *.cpp) - SET(INC ../../../../source/kernel/gen_system ../../../../intern/string @@ -41,6 +39,13 @@ SET(INC ../../../../source/blender/blenloader ) +SET(SRC + RAS_GLExtensionManager.cpp + RAS_ListRasterizer.cpp + RAS_OpenGLRasterizer.cpp + RAS_VAOpenGLRasterizer.cpp +) + ADD_DEFINITIONS(-DGLEW_STATIC) BLENDERLIB(bf_oglrasterizer "${SRC}" "${INC}") diff --git a/source/gameengine/SceneGraph/CMakeLists.txt b/source/gameengine/SceneGraph/CMakeLists.txt index a73130531c0..d1b207b6efa 100644 --- a/source/gameengine/SceneGraph/CMakeLists.txt +++ b/source/gameengine/SceneGraph/CMakeLists.txt @@ -24,11 +24,18 @@ # # ***** END GPL LICENSE BLOCK ***** -FILE(GLOB SRC *.cpp) - SET(INC . ../../../intern/moto/include ) +SET(SRC + SG_BBox.cpp + SG_Controller.cpp + SG_IObject.cpp + SG_Node.cpp + SG_Spatial.cpp + SG_Tree.cpp +) + BLENDERLIB(bf_scenegraph "${SRC}" "${INC}") diff --git a/source/gameengine/VideoTexture/CMakeLists.txt b/source/gameengine/VideoTexture/CMakeLists.txt index 34a32328e29..1c624482d30 100644 --- a/source/gameengine/VideoTexture/CMakeLists.txt +++ b/source/gameengine/VideoTexture/CMakeLists.txt @@ -24,8 +24,6 @@ # # ***** END GPL LICENSE BLOCK ***** -FILE(GLOB SRC *.cpp) - SET(INC . ../../../source/gameengine/Ketsji @@ -51,6 +49,25 @@ SET(INC ../../../extern/glew/include ) +SET(SRC + Exception.cpp + FilterBase.cpp + FilterBlueScreen.cpp + FilterColor.cpp + FilterNormal.cpp + FilterSource.cpp + ImageBase.cpp + ImageBuff.cpp + ImageMix.cpp + ImageRender.cpp + ImageViewport.cpp + PyTypeList.cpp + Texture.cpp + VideoBase.cpp + VideoFFmpeg.cpp + blendVideoTex.cpp +) + IF(WITH_FFMPEG) SET(INC ${INC} ${FFMPEG_INC} ${PTHREADS_INC}) ADD_DEFINITIONS(-DWITH_FFMPEG) diff --git a/source/gameengine/VideoTexture/VideoBase.cpp b/source/gameengine/VideoTexture/VideoBase.cpp index 5de7a9e80a9..322ede7004d 100644 --- a/source/gameengine/VideoTexture/VideoBase.cpp +++ b/source/gameengine/VideoTexture/VideoBase.cpp @@ -82,6 +82,8 @@ void VideoBase::process (BYTE * sample) // finish break; } + case None: + break; /* assert? */ } } } diff --git a/source/kernel/CMakeLists.txt b/source/kernel/CMakeLists.txt index 66d14014587..1665a3c1525 100644 --- a/source/kernel/CMakeLists.txt +++ b/source/kernel/CMakeLists.txt @@ -32,7 +32,7 @@ SET(INC ../../source/blender/blenloader ) -FILE(GLOB SRC +SET(SRC gen_messaging/intern/messaging.c gen_system/GEN_HashedPtr.cpp gen_system/GEN_Matrix4x4.cpp |