diff options
author | Tamito Kajiyama <rd6t-kjym@asahi-net.or.jp> | 2012-10-29 05:09:12 +0400 |
---|---|---|
committer | Tamito Kajiyama <rd6t-kjym@asahi-net.or.jp> | 2012-10-29 05:09:12 +0400 |
commit | 15ed8343437c6b304de72cd14591455da1d5b3ec (patch) | |
tree | cbe40f76668f5e8539744c4d2f8aeaa0ded72f52 /source/blender/blenkernel | |
parent | 5acd5d14970c829c2873623716a67beeb6da5278 (diff) | |
parent | dd106b5c7a129e00bebe121c4da8cb90a16d48cb (diff) |
Merged changes in the trunk up to revision 51718.
Conflicts resolved:
source/blender/blenloader/intern/readfile.c
source/blender/makesrna/intern/rna_scene.c
release/datafiles/startup.blend
Diffstat (limited to 'source/blender/blenkernel')
83 files changed, 1070 insertions, 1027 deletions
diff --git a/source/blender/blenkernel/BKE_blender.h b/source/blender/blenkernel/BKE_blender.h index cf67899dfb0..fbdbf052878 100644 --- a/source/blender/blenkernel/BKE_blender.h +++ b/source/blender/blenkernel/BKE_blender.h @@ -42,11 +42,10 @@ extern "C" { * and keep comment above the defines. * Use STRINGIFY() rather than defining with quotes */ #define BLENDER_VERSION 264 -#define BLENDER_SUBVERSION 4 +#define BLENDER_SUBVERSION 6 -/* 262 was the last editmesh release but its has compatibility code for bmesh data, - * so set the minversion to 2.61 */ -#define BLENDER_MINVERSION 261 +/* 262 was the last editmesh release but it has compatibility code for bmesh data */ +#define BLENDER_MINVERSION 262 #define BLENDER_MINSUBVERSION 0 /* used by packaging tools */ diff --git a/source/blender/blenkernel/BKE_bmesh.h b/source/blender/blenkernel/BKE_bmesh.h index 67b21eb764c..8bfee836c0d 100644 --- a/source/blender/blenkernel/BKE_bmesh.h +++ b/source/blender/blenkernel/BKE_bmesh.h @@ -99,7 +99,7 @@ typedef struct BME_Glob { /* stored in Global G for Transform() purposes */ struct BME_TransData *BME_get_transdata(struct BME_TransData_Head *td, struct BMVert *v); void BME_free_transdata(struct BME_TransData_Head *td); -struct BMesh *BME_bevel(struct BMEditMesh *em, float value, int res, int options, int defgrp_index, float angle, - BME_TransData_Head **rtd, int do_tessface); +struct BMesh *BME_bevel(struct BMesh *bm, float value, int res, int options, int defgrp_index, float angle, + BME_TransData_Head **rtd); #endif diff --git a/source/blender/blenkernel/BKE_cdderivedmesh.h b/source/blender/blenkernel/BKE_cdderivedmesh.h index d7882d8e7ec..2b2497f3f50 100644 --- a/source/blender/blenkernel/BKE_cdderivedmesh.h +++ b/source/blender/blenkernel/BKE_cdderivedmesh.h @@ -55,8 +55,10 @@ int CDDM_Check(struct DerivedMesh *dm); * data to not overwrite the original */ struct DerivedMesh *CDDM_from_mesh(struct Mesh *mesh, struct Object *ob); +struct DerivedMesh *CDDM_from_bmesh(struct BMesh *bm, int use_mdisps); + /* creates a CDDerivedMesh from the given BMEditMesh */ -DerivedMesh *CDDM_from_BMEditMesh(struct BMEditMesh *em, struct Mesh *me, int use_mdisps, int use_tessface); +DerivedMesh *CDDM_from_editbmesh(struct BMEditMesh *em, int use_mdisps, int use_tessface); /* merge verts */ DerivedMesh *CDDM_merge_verts(DerivedMesh *dm, const int *vtargetmap); diff --git a/source/blender/blenkernel/BKE_customdata.h b/source/blender/blenkernel/BKE_customdata.h index 33361b9921c..e387fc5f97c 100644 --- a/source/blender/blenkernel/BKE_customdata.h +++ b/source/blender/blenkernel/BKE_customdata.h @@ -80,6 +80,13 @@ void customData_mask_layers__print(CustomDataMask mask); * the below operations. */ int CustomData_layer_has_math(struct CustomData *data, int layer_n); +int CustomData_layer_has_interp(struct CustomData *data, int layer_n); + +/** + * Checks if any of the customdata layers has math. + */ +int CustomData_has_math(struct CustomData *data); +int CustomData_has_interp(struct CustomData *data); /* copies the "value" (e.g. mloopuv uv or mloopcol colors) from one block to * another, while not overwriting anything else (e.g. flags). probably only @@ -205,8 +212,8 @@ void CustomData_free_elem(struct CustomData *data, int index, int count); void CustomData_interp(const struct CustomData *source, struct CustomData *dest, int *src_indices, float *weights, float *sub_weights, int count, int dest_index); -void CustomData_bmesh_interp(struct CustomData *data, void **src_blocks, - float *weights, float *sub_weights, int count, +void CustomData_bmesh_interp(struct CustomData *data, void **src_blocks, + const float *weights, const float *sub_weights, int count, void *dest_block); diff --git a/source/blender/blenkernel/BKE_global.h b/source/blender/blenkernel/BKE_global.h index 2656495a918..f7af534c2c2 100644 --- a/source/blender/blenkernel/BKE_global.h +++ b/source/blender/blenkernel/BKE_global.h @@ -130,8 +130,9 @@ enum { G_DEBUG_FFMPEG = (1 << 1), G_DEBUG_PYTHON = (1 << 2), /* extra python info */ G_DEBUG_EVENTS = (1 << 3), /* input/window/screen events */ - G_DEBUG_WM = (1 << 4), /* operator, undo */ - G_DEBUG_JOBS = (1 << 5) /* jobs time profiling */ + G_DEBUG_HANDLERS = (1 << 4), /* events handling */ + G_DEBUG_WM = (1 << 5), /* operator, undo */ + G_DEBUG_JOBS = (1 << 6) /* jobs time profiling */ }; #define G_DEBUG_ALL (G_DEBUG | G_DEBUG_FFMPEG | G_DEBUG_PYTHON | G_DEBUG_EVENTS | G_DEBUG_WM | G_DEBUG_JOBS) @@ -145,17 +146,17 @@ enum { #define G_FILE_ENABLE_ALL_FRAMES (1 << 3) /* deprecated */ #define G_FILE_SHOW_DEBUG_PROPS (1 << 4) /* deprecated */ #define G_FILE_SHOW_FRAMERATE (1 << 5) /* deprecated */ -/* #define G_FILE_SHOW_PROFILE (1 << 6) */ /* deprecated */ +/* #define G_FILE_SHOW_PROFILE (1 << 6) */ /* deprecated */ #define G_FILE_LOCK (1 << 7) #define G_FILE_SIGN (1 << 8) -/* #define G_FILE_PUBLISH (1 << 9) */ /* deprecated */ +/* #define G_FILE_PUBLISH (1 << 9) */ /* deprecated */ #define G_FILE_NO_UI (1 << 10) -/* #define G_FILE_GAME_TO_IPO (1 << 11) */ /* deprecated */ +/* #define G_FILE_GAME_TO_IPO (1 << 11) */ /* deprecated */ #define G_FILE_GAME_MAT (1 << 12) /* deprecated */ -/* #define G_FILE_DISPLAY_LISTS (1 << 13) */ /* deprecated */ +/* #define G_FILE_DISPLAY_LISTS (1 << 13) */ /* deprecated */ #define G_FILE_SHOW_PHYSICS (1 << 14) /* deprecated */ #define G_FILE_GAME_MAT_GLSL (1 << 15) /* deprecated */ -/* #define G_FILE_GLSL_NO_LIGHTS (1 << 16) */ /* deprecated */ +/* #define G_FILE_GLSL_NO_LIGHTS (1 << 16) */ /* deprecated */ #define G_FILE_GLSL_NO_SHADERS (1 << 17) /* deprecated */ #define G_FILE_GLSL_NO_SHADOWS (1 << 18) /* deprecated */ #define G_FILE_GLSL_NO_RAMPS (1 << 19) /* deprecated */ diff --git a/source/blender/blenkernel/BKE_image.h b/source/blender/blenkernel/BKE_image.h index 5e5f58f73fe..1875fd66628 100644 --- a/source/blender/blenkernel/BKE_image.h +++ b/source/blender/blenkernel/BKE_image.h @@ -127,6 +127,7 @@ enum { #define IMA_SIGNAL_SRC_CHANGE 5 /* image-user gets a new image, check settings */ #define IMA_SIGNAL_USER_NEW_IMAGE 6 +#define IMA_SIGNAL_COLORMANAGE 7 #define IMA_CHAN_FLAG_BW 1 #define IMA_CHAN_FLAG_RGB 2 diff --git a/source/blender/blenkernel/BKE_library.h b/source/blender/blenkernel/BKE_library.h index 91756448297..bc081b7f308 100644 --- a/source/blender/blenkernel/BKE_library.h +++ b/source/blender/blenkernel/BKE_library.h @@ -81,6 +81,7 @@ int set_listbasepointers(struct Main *main, struct ListBase **lb); void BKE_libblock_free(struct ListBase *lb, void *idv); void BKE_libblock_free_us(struct ListBase *lb, void *idv); +void BKE_libblock_free_data(struct ID *id); void free_main(struct Main *mainvar); void tag_main_idcode(struct Main *mainvar, const short type, const short tag); diff --git a/source/blender/blenkernel/BKE_mesh.h b/source/blender/blenkernel/BKE_mesh.h index 9fffb71785b..2f889084d0e 100644 --- a/source/blender/blenkernel/BKE_mesh.h +++ b/source/blender/blenkernel/BKE_mesh.h @@ -292,6 +292,7 @@ void create_vert_edge_map(MeshElemMap **map, int **mem, int BKE_mesh_minmax(struct Mesh *me, float r_min[3], float r_max[3]); int BKE_mesh_center_median(struct Mesh *me, float cent[3]); int BKE_mesh_center_bounds(struct Mesh *me, float cent[3]); +int BKE_mesh_center_centroid(struct Mesh *me, float cent[3]); void BKE_mesh_translate(struct Mesh *me, float offset[3], int do_keys); /* mesh_validate.c */ diff --git a/source/blender/blenkernel/BKE_node.h b/source/blender/blenkernel/BKE_node.h index 4ee5c894b5c..cd1875f848b 100644 --- a/source/blender/blenkernel/BKE_node.h +++ b/source/blender/blenkernel/BKE_node.h @@ -193,10 +193,8 @@ typedef struct bNodeType { struct bNodeTree *(*group_edit_set)(struct bNode *node, int edit); void (*group_edit_clear)(struct bNode *node); - /* Generate a temporary list of internal links (bNodeLink), for muting and disconnect operators. - * Result must be freed by caller! - */ - ListBase (*internal_connect)(struct bNodeTree *, struct bNode *node); + /* Update the internal links list, for muting and disconnect operators. */ + void (*update_internal_links)(struct bNodeTree *, struct bNode *node); /* **** execution callbacks **** */ void *(*initexecfunc)(struct bNode *node); @@ -293,7 +291,7 @@ typedef struct bNodeTreeType { int (*validate_link)(struct bNodeTree *ntree, struct bNodeLink *link); /* Default internal linking. */ - ListBase (*internal_connect)(struct bNodeTree *, struct bNode *node); + void (*update_internal_links)(struct bNodeTree *, struct bNode *node); } bNodeTreeType; /* ************** GENERIC API, TREES *************** */ @@ -389,6 +387,7 @@ struct bNode *nodeGetActiveTexture(struct bNodeTree *ntree); void nodeUpdate(struct bNodeTree *ntree, struct bNode *node); int nodeUpdateID(struct bNodeTree *ntree, struct ID *id); +void nodeUpdateInternalLinks(struct bNodeTree *ntree, struct bNode *node); void nodeFreePreview(struct bNode *node); @@ -445,7 +444,7 @@ void node_type_exec_new(struct bNodeType *ntype, void (*freeexecfunc)(struct bNode *node, void *nodedata), void (*newexecfunc)(void *data, int thread, struct bNode *, void *nodedata, struct bNodeStack **, struct bNodeStack **)); -void node_type_internal_connect(struct bNodeType *ntype, ListBase (*internal_connect)(struct bNodeTree *, struct bNode *)); +void node_type_internal_links(struct bNodeType *ntype, void (*update_internal_links)(struct bNodeTree *, struct bNode *)); void node_type_gpu(struct bNodeType *ntype, int (*gpufunc)(struct GPUMaterial *mat, struct bNode *node, struct GPUNodeStack *in, struct GPUNodeStack *out)); void node_type_gpu_ext(struct bNodeType *ntype, int (*gpuextfunc)(struct GPUMaterial *mat, struct bNode *node, @@ -456,8 +455,8 @@ void node_type_compatibility(struct bNodeType *ntype, short compatibi /* ************** COMMON NODES *************** */ #define NODE_GROUP 2 -#define NODE_FORLOOP 3 -#define NODE_WHILELOOP 4 +#define __NODE_FORLOOP 3 /* deprecated */ +#define __NODE_WHILELOOP 4 /* deprecated */ #define NODE_FRAME 5 #define NODE_REROUTE 6 @@ -699,6 +698,7 @@ void ntreeGPUMaterialNodes(struct bNodeTree *ntree, struct GPUMateria #define CMP_NODE_BOKEHIMAGE 315 #define CMP_NODE_BOKEHBLUR 316 #define CMP_NODE_SWITCH 317 +#define CMP_NODE_PIXELATE 318 /* channel toggles */ #define CMP_CHAN_RGB 1 diff --git a/source/blender/blenkernel/BKE_paint.h b/source/blender/blenkernel/BKE_paint.h index a93e542fe15..c452c177143 100644 --- a/source/blender/blenkernel/BKE_paint.h +++ b/source/blender/blenkernel/BKE_paint.h @@ -94,6 +94,7 @@ typedef struct SculptSession { /* PBVH acceleration structure */ struct PBVH *pbvh; + int show_diffuse_color; /* Paiting on deformed mesh */ int modifiers_active; /* object is deformed with some modifiers */ diff --git a/source/blender/blenkernel/CMakeLists.txt b/source/blender/blenkernel/CMakeLists.txt index f690c9dcda4..11ff3930ffb 100644 --- a/source/blender/blenkernel/CMakeLists.txt +++ b/source/blender/blenkernel/CMakeLists.txt @@ -358,12 +358,6 @@ if(WITH_MOD_OCEANSIM) add_definitions(-DWITH_OCEANSIM) endif() -if(WITH_MOD_DECIMATE) - list(APPEND INC - ../../../intern/decimation/extern - ) -endif() - if(WITH_MOD_BOOLEAN) list(APPEND INC ../../../intern/bsp/extern diff --git a/source/blender/blenkernel/SConscript b/source/blender/blenkernel/SConscript index 8a656c735f6..155d4068c9a 100644 --- a/source/blender/blenkernel/SConscript +++ b/source/blender/blenkernel/SConscript @@ -10,7 +10,7 @@ sources_mask = env.Glob('intern/mask*.c') incs = '. #/intern/guardedalloc #/intern/memutil' incs += ' ../blenlib ../blenfont ../makesdna ../windowmanager' -incs += ' ../render/extern/include #/intern/decimation/extern ../makesrna' +incs += ' ../render/extern/include ../makesrna' incs += ' ../imbuf ../ikplugin ../avi #/intern/elbeem/extern ../nodes ../modifiers' incs += ' #/intern/iksolver/extern ../blenloader ../freestyle' incs += ' #/extern/bullet2/src' diff --git a/source/blender/blenkernel/depsgraph_private.h b/source/blender/blenkernel/depsgraph_private.h index 512b799aeed..12c111f5f16 100644 --- a/source/blender/blenkernel/depsgraph_private.h +++ b/source/blender/blenkernel/depsgraph_private.h @@ -61,7 +61,7 @@ typedef struct DagAdjList { typedef struct DagNode { int color; short type; - float x, y, k; + float x, y, k; void *ob; void *first_ancestor; int ancestor_count; diff --git a/source/blender/blenkernel/intern/CCGSubSurf.c b/source/blender/blenkernel/intern/CCGSubSurf.c index 82ac0736b07..cc20470b4d5 100644 --- a/source/blender/blenkernel/intern/CCGSubSurf.c +++ b/source/blender/blenkernel/intern/CCGSubSurf.c @@ -868,7 +868,7 @@ CCGSubSurf *ccgSubSurf_new(CCGMeshIFC *ifc, int subdivLevels, CCGAllocatorIFC *a ss->oldVMap = ss->oldEMap = ss->oldFMap = NULL; ss->lenTempArrays = 0; ss->tempVerts = NULL; - ss->tempEdges = NULL; + ss->tempEdges = NULL; return ss; } diff --git a/source/blender/blenkernel/intern/DerivedMesh.c b/source/blender/blenkernel/intern/DerivedMesh.c index 30804518e1d..ddbd4588778 100644 --- a/source/blender/blenkernel/intern/DerivedMesh.c +++ b/source/blender/blenkernel/intern/DerivedMesh.c @@ -51,8 +51,6 @@ #include "BLI_utildefines.h" #include "BLI_linklist.h" -#include "BLF_translation.h" - #include "BKE_cdderivedmesh.h" #include "BKE_displist.h" #include "BKE_key.h" @@ -903,7 +901,7 @@ static DerivedMesh *create_orco_dm(Object *ob, Mesh *me, BMEditMesh *em, int lay float (*orco)[3]; int free; - if (em) dm = CDDM_from_BMEditMesh(em, me, FALSE, FALSE); + if (em) dm = CDDM_from_editbmesh(em, FALSE, FALSE); else dm = CDDM_from_mesh(me, ob); orco = get_orco_coords_dm(ob, em, layer, &free); @@ -1270,7 +1268,7 @@ static void shapekey_layers_to_keyblocks(DerivedMesh *dm, Mesh *me, int actshape int i, j, tot; if (!me->key) - return; + return; tot = CustomData_number_of_layers(&dm->vertData, CD_SHAPEKEY); for (i = 0; i < tot; i++) { @@ -1507,7 +1505,7 @@ static void mesh_calc_modifiers(Scene *scene, Object *ob, float (*inputVertexCos if (!modifier_isEnabled(scene, md, required_mode)) continue; if (mti->type == eModifierTypeType_OnlyDeform && !useDeform) continue; if ((mti->flags & eModifierTypeFlag_RequiresOriginalData) && dm) { - modifier_setError(md, "%s", TIP_("Modifier requires original data, bad stack position.")); + modifier_setError(md, "Modifier requires original data, bad stack position"); continue; } if (sculpt_mode && (!has_multires || multires_applied)) { @@ -1520,7 +1518,7 @@ static void mesh_calc_modifiers(Scene *scene, Object *ob, float (*inputVertexCos unsupported |= multires_applied; if (unsupported) { - modifier_setError(md, "%s", TIP_("Not supported in sculpt mode.")); + modifier_setError(md, "Not supported in sculpt mode"); continue; } } @@ -1881,7 +1879,7 @@ int editbmesh_modifier_is_enabled(Scene *scene, ModifierData *md, DerivedMesh *d if (!modifier_isEnabled(scene, md, required_mode)) return 0; if ((mti->flags & eModifierTypeFlag_RequiresOriginalData) && dm) { - modifier_setError(md, "%s", TIP_("Modifier requires original data, bad stack position.")); + modifier_setError(md, "Modifier requires original data, bad stack position"); return 0; } @@ -1976,7 +1974,7 @@ static void editbmesh_calc_modifiers(Scene *scene, Object *ob, BMEditMesh *em, D } else { - dm = CDDM_from_BMEditMesh(em, ob->data, FALSE, FALSE); + dm = CDDM_from_editbmesh(em, FALSE, FALSE); if (deformedVerts) { CDDM_apply_vert_coords(dm, deformedVerts); @@ -2067,12 +2065,18 @@ static void editbmesh_calc_modifiers(Scene *scene, Object *ob, BMEditMesh *em, D } else if (dm) { *final_r = dm; - (*final_r)->calcNormals(*final_r); /* BMESH_ONLY - BMESH_TODO. check if this is needed */ + + /* once we support skipping normal calculation with modifiers we may want to add this back */ +#if 0 // was added for bmesh but is not needed + (*final_r)->calcNormals(*final_r); +#endif } else if (!deformedVerts && cage_r && *cage_r) { /* cage should already have up to date normals */ *final_r = *cage_r; - (*final_r)->calcNormals(*final_r); /* BMESH_ONLY - BMESH_TODO. check if this is needed */ +#if 0 // was added for bmesh but is not needed + (*final_r)->calcNormals(*final_r); +#endif } else { /* this is just a copy of the editmesh, no need to calc normals */ @@ -2428,7 +2432,7 @@ static int GetNumVertsOfFace(const SMikkTSpaceContext *pContext, const int face_ static void GetPosition(const SMikkTSpaceContext *pContext, float fPos[], const int face_num, const int vert_index) { - //assert(vert_index>=0 && vert_index<4); + //assert(vert_index >= 0 && vert_index < 4); SGLSLMeshToTangent *pMesh = (SGLSLMeshToTangent *) pContext->m_pUserData; const float *co = pMesh->mvert[(&pMesh->mface[face_num].v1)[vert_index]].co; copy_v3_v3(fPos, co); @@ -2436,7 +2440,7 @@ static void GetPosition(const SMikkTSpaceContext *pContext, float fPos[], const static void GetTextureCoordinate(const SMikkTSpaceContext *pContext, float fUV[], const int face_num, const int vert_index) { - //assert(vert_index>=0 && vert_index<4); + //assert(vert_index >= 0 && vert_index < 4); SGLSLMeshToTangent *pMesh = (SGLSLMeshToTangent *) pContext->m_pUserData; if (pMesh->mtface != NULL) { @@ -2451,7 +2455,7 @@ static void GetTextureCoordinate(const SMikkTSpaceContext *pContext, float fUV[] static void GetNormal(const SMikkTSpaceContext *pContext, float fNorm[], const int face_num, const int vert_index) { - //assert(vert_index>=0 && vert_index<4); + //assert(vert_index >= 0 && vert_index < 4); SGLSLMeshToTangent *pMesh = (SGLSLMeshToTangent *) pContext->m_pUserData; const int smoothnormal = (pMesh->mface[face_num].flag & ME_SMOOTH); @@ -2481,7 +2485,7 @@ static void GetNormal(const SMikkTSpaceContext *pContext, float fNorm[], const i } static void SetTSpace(const SMikkTSpaceContext *pContext, const float fvTangent[], const float fSign, const int face_num, const int iVert) { - //assert(vert_index>=0 && vert_index<4); + //assert(vert_index >= 0 && vert_index < 4); SGLSLMeshToTangent *pMesh = (SGLSLMeshToTangent *) pContext->m_pUserData; float *pRes = pMesh->tangent[4 * face_num + iVert]; copy_v3_v3(pRes, fvTangent); @@ -2492,15 +2496,11 @@ static void SetTSpace(const SMikkTSpaceContext *pContext, const float fvTangent[ void DM_add_tangent_layer(DerivedMesh *dm) { /* mesh vars */ - MTFace *mtface, *tf; - MFace *mface, *mf; - MVert *mvert, *v1, *v2, *v3, *v4; - MemArena *arena = NULL; - VertexTangent **vtangents = NULL; + MVert *mvert; + MTFace *mtface; + MFace *mface; float (*orco)[3] = NULL, (*tangent)[4]; - float *uv1, *uv2, *uv3, *uv4, *vtang; - float fno[3], tang[3], uv[4][2]; - int i, j, len, mf_vi[4], totvert, totface, iCalcNewMethod; + int /* totvert, */ totface; float *nors; if (CustomData_get_layer_index(&dm->faceData, CD_TANGENT) != -1) @@ -2509,7 +2509,7 @@ void DM_add_tangent_layer(DerivedMesh *dm) nors = dm->getTessFaceDataArray(dm, CD_NORMAL); /* check we have all the needed layers */ - totvert = dm->getNumVerts(dm); + /* totvert = dm->getNumVerts(dm); */ /* UNUSED */ totface = dm->getNumTessFaces(dm); mvert = dm->getVertArray(dm); @@ -2526,14 +2526,8 @@ void DM_add_tangent_layer(DerivedMesh *dm) DM_add_tessface_layer(dm, CD_TANGENT, CD_CALLOC, NULL); tangent = DM_get_tessface_data_layer(dm, CD_TANGENT); - /* allocate some space */ - arena = BLI_memarena_new(BLI_MEMARENA_STD_BUFSIZE, "tangent layer arena"); - BLI_memarena_use_calloc(arena); - vtangents = MEM_callocN(sizeof(VertexTangent *) * totvert, "VertexTangent"); - /* new computation method */ - iCalcNewMethod = 1; - if (iCalcNewMethod != 0) { + { SGLSLMeshToTangent mesh2tangent = {0}; SMikkTSpaceContext sContext = {0}; SMikkTSpaceInterface sInterface = {0}; @@ -2556,87 +2550,13 @@ void DM_add_tangent_layer(DerivedMesh *dm) sInterface.m_setTSpaceBasic = SetTSpace; /* 0 if failed */ - iCalcNewMethod = genTangSpaceDefault(&sContext); + genTangSpaceDefault(&sContext); } - - if (!iCalcNewMethod) { - /* sum tangents at connected vertices */ - for (i = 0, tf = mtface, mf = mface; i < totface; mf++, tf++, i++) { - v1 = &mvert[mf->v1]; - v2 = &mvert[mf->v2]; - v3 = &mvert[mf->v3]; - - if (mf->v4) { - v4 = &mvert[mf->v4]; - normal_quad_v3(fno, v4->co, v3->co, v2->co, v1->co); - } - else { - v4 = NULL; - normal_tri_v3(fno, v3->co, v2->co, v1->co); - } - - if (mtface) { - uv1 = tf->uv[0]; - uv2 = tf->uv[1]; - uv3 = tf->uv[2]; - uv4 = tf->uv[3]; - } - else { - uv1 = uv[0]; uv2 = uv[1]; uv3 = uv[2]; uv4 = uv[3]; - map_to_sphere(&uv[0][0], &uv[0][1], orco[mf->v1][0], orco[mf->v1][1], orco[mf->v1][2]); - map_to_sphere(&uv[1][0], &uv[1][1], orco[mf->v2][0], orco[mf->v2][1], orco[mf->v2][2]); - map_to_sphere(&uv[2][0], &uv[2][1], orco[mf->v3][0], orco[mf->v3][1], orco[mf->v3][2]); - if (v4) - map_to_sphere(&uv[3][0], &uv[3][1], orco[mf->v4][0], orco[mf->v4][1], orco[mf->v4][2]); - } - - tangent_from_uv(uv1, uv2, uv3, v1->co, v2->co, v3->co, fno, tang); - sum_or_add_vertex_tangent(arena, &vtangents[mf->v1], tang, uv1); - sum_or_add_vertex_tangent(arena, &vtangents[mf->v2], tang, uv2); - sum_or_add_vertex_tangent(arena, &vtangents[mf->v3], tang, uv3); - - if (mf->v4) { - v4 = &mvert[mf->v4]; - - tangent_from_uv(uv1, uv3, uv4, v1->co, v3->co, v4->co, fno, tang); - sum_or_add_vertex_tangent(arena, &vtangents[mf->v1], tang, uv1); - sum_or_add_vertex_tangent(arena, &vtangents[mf->v3], tang, uv3); - sum_or_add_vertex_tangent(arena, &vtangents[mf->v4], tang, uv4); - } - } - - /* write tangent to layer */ - for (i = 0, tf = mtface, mf = mface; i < totface; mf++, tf++, i++, tangent += 4) { - len = (mf->v4) ? 4 : 3; - - if (mtface == NULL) { - map_to_sphere(&uv[0][0], &uv[0][1], orco[mf->v1][0], orco[mf->v1][1], orco[mf->v1][2]); - map_to_sphere(&uv[1][0], &uv[1][1], orco[mf->v2][0], orco[mf->v2][1], orco[mf->v2][2]); - map_to_sphere(&uv[2][0], &uv[2][1], orco[mf->v3][0], orco[mf->v3][1], orco[mf->v3][2]); - if (len == 4) - map_to_sphere(&uv[3][0], &uv[3][1], orco[mf->v4][0], orco[mf->v4][1], orco[mf->v4][2]); - } - - mf_vi[0] = mf->v1; - mf_vi[1] = mf->v2; - mf_vi[2] = mf->v3; - mf_vi[3] = mf->v4; - - for (j = 0; j < len; j++) { - vtang = find_vertex_tangent(vtangents[mf_vi[j]], mtface ? tf->uv[j] : uv[j]); - normalize_v3_v3(tangent[j], vtang); - ((float *) tangent[j])[3] = 1.0f; - } - } - } - - BLI_memarena_free(arena); - MEM_freeN(vtangents); } void DM_calc_auto_bump_scale(DerivedMesh *dm) { - /* int totvert= dm->getNumVerts(dm); */ /* UNUSED */ + /* int totvert = dm->getNumVerts(dm); */ /* UNUSED */ int totface = dm->getNumTessFaces(dm); MVert *mvert = dm->getVertArray(dm); diff --git a/source/blender/blenkernel/intern/action.c b/source/blender/blenkernel/intern/action.c index 66df7eccbd0..e95451252d0 100644 --- a/source/blender/blenkernel/intern/action.c +++ b/source/blender/blenkernel/intern/action.c @@ -224,7 +224,7 @@ bActionGroup *get_active_actiongroup(bAction *act) { bActionGroup *agrp = NULL; - if (act && act->groups.first) { + if (act && act->groups.first) { for (agrp = act->groups.first; agrp; agrp = agrp->next) { if (agrp->flag & AGRP_ACTIVE) break; @@ -301,7 +301,7 @@ bActionGroup *action_groups_add_new(bAction *act, const char name[]) /* add to action, and validate */ BLI_addtail(&act->groups, agrp); - BLI_uniquename(&act->groups, agrp, "Group", '.', offsetof(bActionGroup, name), sizeof(agrp->name)); + BLI_uniquename(&act->groups, agrp, "Group", '.', offsetof(bActionGroup, name), sizeof(agrp->name)); /* return the new group */ return agrp; @@ -380,7 +380,7 @@ void action_groups_add_channel(bAction *act, bActionGroup *agrp, FCurve *fcurve) void action_groups_remove_channel(bAction *act, FCurve *fcu) { /* sanity checks */ - if (ELEM(NULL, act, fcu)) + if (ELEM(NULL, act, fcu)) return; /* check if any group used this directly */ @@ -906,8 +906,8 @@ void calc_action_range(const bAction *act, float *start, float *end, short incl_ calc_fcurve_range(fcu, &nmin, &nmax, FALSE, TRUE); /* compare to the running tally */ - min = MIN2(min, nmin); - max = MAX2(max, nmax); + min = min_ff(min, nmin); + max = max_ff(max, nmax); foundvert = 1; } @@ -925,10 +925,10 @@ void calc_action_range(const bAction *act, float *start, float *end, short incl_ FMod_Limits *fmd = (FMod_Limits *)fcm->data; if (fmd->flag & FCM_LIMIT_XMIN) { - min = MIN2(min, fmd->rect.xmin); + min = min_ff(min, fmd->rect.xmin); } if (fmd->flag & FCM_LIMIT_XMAX) { - max = MAX2(max, fmd->rect.xmax); + max = max_ff(max, fmd->rect.xmax); } } break; @@ -955,7 +955,7 @@ void calc_action_range(const bAction *act, float *start, float *end, short incl_ foundmod = 1; } } - } + } if (foundvert || foundmod) { if (min == max) max += 1.0f; diff --git a/source/blender/blenkernel/intern/anim.c b/source/blender/blenkernel/intern/anim.c index 622658e0a49..dffe26bd782 100644 --- a/source/blender/blenkernel/intern/anim.c +++ b/source/blender/blenkernel/intern/anim.c @@ -176,7 +176,7 @@ bMotionPath *animviz_verify_motionpaths(ReportList *reports, Scene *scene, Objec /* avoid 0 size allocs */ if (avs->path_sf >= avs->path_ef) { BKE_reportf(reports, RPT_ERROR, - "Motion Path frame extents invalid for %s (%d to %d)%s", + "Motion path frame extents invalid for %s (%d to %d)%s", (pchan) ? pchan->name : ob->id.name, avs->path_sf, avs->path_ef, (avs->path_sf == avs->path_ef) ? TIP_(", cannot have single-frame paths") : ""); @@ -824,7 +824,7 @@ static void frames_duplilist(ListBase *lb, Scene *scene, Object *ob, int par_ind ok = (ok < ob->dupon); } - if (ok) { + if (ok) { DupliObject *dob; /* WARNING: doing animation updates in this way is not terribly accurate, as the dependencies @@ -970,7 +970,7 @@ static void vertex_duplilist(ListBase *lb, ID *id, Scene *scene, Object *par, fl } /* Start looping on Scene OR Group objects */ - while (base || go) { + while (base || go) { if (sce) { ob_iter = base->object; oblay = base->lay; @@ -1104,7 +1104,7 @@ static void face_duplilist(ListBase *lb, ID *id, Scene *scene, Object *par, floa } /* Start looping on Scene OR Group objects */ - while (base || go) { + while (base || go) { if (sce) { ob_iter = base->object; oblay = base->lay; diff --git a/source/blender/blenkernel/intern/anim_sys.c b/source/blender/blenkernel/intern/anim_sys.c index d685edfcda2..d3b7b3852fc 100644 --- a/source/blender/blenkernel/intern/anim_sys.c +++ b/source/blender/blenkernel/intern/anim_sys.c @@ -189,9 +189,9 @@ short BKE_animdata_set_action(ReportList *reports, ID *id, bAction *act) else { /* cannot set */ BKE_reportf(reports, RPT_ERROR, - "Couldn't set Action '%s' onto ID '%s', as it doesn't have suitably rooted paths for this purpose", - act->id.name + 2, id->name); - //ok = 0; + "Could not set action '%s' onto ID '%s', as it does not have suitably rooted paths " + "for this purpose", act->id.name + 2, id->name); + /* ok = 0; */ } } else { @@ -420,7 +420,7 @@ void action_move_fcurves_by_basepath(bAction *srcAct, bAction *dstAct, const cha /* should F-Curve be moved over? * - we only need the start of the path to match basepath */ - if (animpath_matches_basepath(fcu->rna_path, basepath)) { + if (animpath_matches_basepath(fcu->rna_path, basepath)) { bActionGroup *agrp = NULL; /* if grouped... */ @@ -575,7 +575,7 @@ static char *rna_path_rename_fix(ID *owner_id, const char *prefix, const char *o */ if ( (prefixPtr && oldNamePtr) && (prefixPtr + prefixLen == oldNamePtr) ) { /* if we haven't aren't able to resolve the path now, try again after fixing it */ - if (!verify_paths || check_rna_path_is_valid(owner_id, oldpath) == 0) { + if (!verify_paths || check_rna_path_is_valid(owner_id, oldpath) == 0) { DynStr *ds = BLI_dynstr_new(); char *postfixPtr = oldNamePtr + oldNameLen; char *newPath = NULL; @@ -725,7 +725,7 @@ void BKE_animdata_fix_paths_rename(ID *owner_id, AnimData *adt, ID *ref_id, cons /* pad the names with [" "] so that only exact matches are made */ oldN = BLI_sprintfN("[\"%s\"]", oldName); newN = BLI_sprintfN("[\"%s\"]", newName); - } + } else { oldN = BLI_sprintfN("[%d]", oldSubscript); newN = BLI_sprintfN("[%d]", newSubscript); @@ -1246,7 +1246,7 @@ static short animsys_write_rna_setting(PointerRNA *ptr, char *path, int array_in if (new_ptr.type == &RNA_PoseBone) { /* bone transforms - update pose (i.e. tag depsgraph) */ skip_updates_hack = 1; - } + } if (skip_updates_hack == 0) RNA_property_update_cache_add(&new_ptr, prop); diff --git a/source/blender/blenkernel/intern/armature.c b/source/blender/blenkernel/intern/armature.c index f5c7cab6019..b3cbc1f2b16 100644 --- a/source/blender/blenkernel/intern/armature.c +++ b/source/blender/blenkernel/intern/armature.c @@ -947,7 +947,7 @@ void armature_deform_verts(Object *armOb, Object *target, DerivedMesh *dm, float } } - if (use_dverts || armature_def_nr >= 0) { + if (use_dverts || armature_def_nr != -1) { if (dm) dvert = dm->getVertData(dm, i, CD_MDEFORMVERT); else if (dverts && i < target_totvert) @@ -958,7 +958,7 @@ void armature_deform_verts(Object *armOb, Object *target, DerivedMesh *dm, float else dvert = NULL; - if (armature_def_nr >= 0 && dvert) { + if (armature_def_nr != -1 && dvert) { armature_weight = defvert_find_weight(dvert, armature_def_nr); if (invert_vgroup) @@ -1462,7 +1462,7 @@ void vec_roll_to_mat3(const float vec[3], const float roll, float mat[][3]) * so a value inbetween these is needed. * * was 0.000001, causes bug [#30438] (which is same as [#27675, imho). - * Reseting it to org value seems to cause no more [#23954]... + * Resetting it to org value seems to cause no more [#23954]... * * was 0.0000000000001, caused bug [#31333], smaller values give unstable * roll when toggling editmode again... @@ -1593,7 +1593,7 @@ static void pose_proxy_synchronize(Object *ob, Object *from, int layer_protected if (UNLIKELY(pchanp == NULL)) { /* happens for proxies that become invalid because of a missing link - * for regulat cases it shouldn't happen at all */ + * for regular cases it shouldn't happen at all */ } else if (pchan->bone->layer & layer_protected) { ListBase proxylocal_constraints = {NULL, NULL}; diff --git a/source/blender/blenkernel/intern/blender.c b/source/blender/blenkernel/intern/blender.c index 197e38ac778..c6fa2de6545 100644 --- a/source/blender/blenkernel/intern/blender.c +++ b/source/blender/blenkernel/intern/blender.c @@ -119,7 +119,7 @@ void free_blender(void) BKE_sequencer_cache_destruct(); IMB_moviecache_destruct(); - free_nodesystem(); + free_nodesystem(); } void initglobals(void) @@ -237,7 +237,7 @@ static void setup_app_data(bContext *C, BlendFileData *bfd, const char *filepath /* free G.main Main database */ // CTX_wm_manager_set(C, NULL); - clear_global(); + clear_global(); /* clear old property update cache, in case some old references are left dangling */ RNA_property_update_cache_free(); @@ -338,7 +338,7 @@ static int handle_subversion_warning(Main *main, ReportList *reports) (main->minversionfile == BLENDER_VERSION && main->minsubversionfile > BLENDER_SUBVERSION)) { - BKE_reportf(reports, RPT_ERROR, "File written by newer Blender binary: %d.%d, expect loss of data!", + BKE_reportf(reports, RPT_ERROR, "File written by newer Blender binary (%d.%d), expect loss of data!", main->minversionfile, main->minsubversionfile); } @@ -407,9 +407,9 @@ int BKE_read_file(bContext *C, const char *filepath, ReportList *reports) } else setup_app_data(C, bfd, filepath); // frees BFD - } + } else - BKE_reports_prependf(reports, "Loading %s failed: ", filepath); + BKE_reports_prependf(reports, "Loading '%s' failed: ", filepath); return (bfd ? retval : BKE_READ_FILE_FAIL); } @@ -612,7 +612,7 @@ void BKE_write_undo(bContext *C, const char *name) } } -/* 1= an undo, -1 is a redo. we have to make sure 'curundo' remains at current situation */ +/* 1 = an undo, -1 is a redo. we have to make sure 'curundo' remains at current situation */ void BKE_undo_step(bContext *C, int step) { diff --git a/source/blender/blenkernel/intern/bmfont.c b/source/blender/blenkernel/intern/bmfont.c index a7d90f09160..df7fb2c1807 100644 --- a/source/blender/blenkernel/intern/bmfont.c +++ b/source/blender/blenkernel/intern/bmfont.c @@ -102,7 +102,7 @@ void readBitmapFontVersion0(ImBuf * ibuf, unsigned char * rect, int step) buffer = MEM_mallocN(bytes, "readBitmapFontVersion0:buffer"); - index = 0; + index = 0; for (i = 0; i < bytes; i++) { buffer[i] = rect[index]; index += step; diff --git a/source/blender/blenkernel/intern/boids.c b/source/blender/blenkernel/intern/boids.c index aafc7fe89b4..b6f1b88c912 100644 --- a/source/blender/blenkernel/intern/boids.c +++ b/source/blender/blenkernel/intern/boids.c @@ -956,7 +956,8 @@ void boid_brain(BoidBrainData *bbd, int p, ParticleData *pa) // } //} - bbd->wanted_co[0]=bbd->wanted_co[1]=bbd->wanted_co[2]=bbd->wanted_speed=0.0f; + zero_v3(bbd->wanted_co); + bbd->wanted_speed = 0.0f; /* create random seed for every particle & frame */ rand = (int)(PSYS_FRAND(psys->seed + p) * 1000); @@ -990,7 +991,8 @@ void boid_brain(BoidBrainData *bbd, int p, ParticleData *pa) add_v3_v3(wanted_co, bbd->wanted_co); wanted_speed += bbd->wanted_speed; n++; - bbd->wanted_co[0]=bbd->wanted_co[1]=bbd->wanted_co[2]=bbd->wanted_speed=0.0f; + zero_v3(bbd->wanted_co); + bbd->wanted_speed = 0.0f; } } @@ -1170,7 +1172,7 @@ void boid_body(BoidBrainData *bbd, ParticleData *pa) /* constrain direction with maximum angular velocity */ angle = saacos(dot_v3v3(old_dir, wanted_dir)); - angle = minf(angle, val.max_ave); + angle = min_ff(angle, val.max_ave); cross_v3_v3v3(nor, old_dir, wanted_dir); axis_angle_to_quat(q, nor, angle); @@ -1266,9 +1268,9 @@ void boid_body(BoidBrainData *bbd, ParticleData *pa) { float grav[3]; - grav[0]= 0.0f; - grav[1]= 0.0f; - grav[2]= bbd->sim->scene->physics_settings.gravity[2] < 0.0f ? -1.0f : 0.0f; + grav[0] = 0.0f; + grav[1] = 0.0f; + grav[2] = bbd->sim->scene->physics_settings.gravity[2] < 0.0f ? -1.0f : 0.0f; /* don't take forward acceleration into account (better banking) */ if (dot_v3v3(bpa->data.acc, pa->state.vel) > 0.0f) { @@ -1309,9 +1311,9 @@ void boid_body(BoidBrainData *bbd, ParticleData *pa) { float grav[3]; - grav[0]= 0.0f; - grav[1]= 0.0f; - grav[2]= bbd->sim->scene->physics_settings.gravity[2] < 0.0f ? -1.0f : 0.0f; + grav[0] = 0.0f; + grav[1] = 0.0f; + grav[2] = bbd->sim->scene->physics_settings.gravity[2] < 0.0f ? -1.0f : 0.0f; /* gather apparent gravity */ diff --git a/source/blender/blenkernel/intern/booleanops_mesh.c b/source/blender/blenkernel/intern/booleanops_mesh.c index be79077bb58..461b945282f 100644 --- a/source/blender/blenkernel/intern/booleanops_mesh.c +++ b/source/blender/blenkernel/intern/booleanops_mesh.c @@ -142,7 +142,7 @@ CSG_AddMeshToBlender( /* Create a new blender mesh object - using 'base' as * a template for the new object. */ - ob_new= AddNewBlenderMesh(mesh->base); + ob_new = AddNewBlenderMesh(mesh->base); me_new = ob_new->data; @@ -180,7 +180,7 @@ CSG_PerformOp( if ((mesh1 == NULL) || (mesh2 == NULL) || (output == NULL)) { return 0; - } + } if ((int_op_type < 1) || (int_op_type > 3)) return 0; switch (int_op_type) { @@ -203,8 +203,8 @@ CSG_PerformOp( mesh1->m_face_iterator, mesh1->m_vertex_iterator, mesh2->m_face_iterator, - mesh2->m_vertex_iterator, - InterpFaceVertexData + mesh2->m_vertex_iterator, + InterpFaceVertexData ); } else { @@ -215,8 +215,8 @@ CSG_PerformOp( mesh1->m_face_iterator, mesh1->m_vertex_iterator, mesh2->m_face_iterator, - mesh2->m_vertex_iterator, - InterpNoUserData + mesh2->m_vertex_iterator, + InterpNoUserData ); } diff --git a/source/blender/blenkernel/intern/brush.c b/source/blender/blenkernel/intern/brush.c index f4efc30068c..98b206712d6 100644 --- a/source/blender/blenkernel/intern/brush.c +++ b/source/blender/blenkernel/intern/brush.c @@ -618,18 +618,18 @@ void BKE_brush_imbuf_new(const Scene *scene, Brush *brush, short flt, short texf /* Unified Size and Strength */ -// XXX: be careful about setting size and unprojected radius -// because they depend on one another -// these functions do not set the other corresponding value -// this can lead to odd behavior if size and unprojected -// radius become inconsistent. -// the biggest problem is that it isn't possible to change -// unprojected radius because a view context is not -// available. my ussual solution to this is to use the -// ratio of change of the size to change the unprojected -// radius. Not completely convinced that is correct. -// In anycase, a better solution is needed to prevent -// inconsistency. +/* XXX: be careful about setting size and unprojected radius + * because they depend on one another + * these functions do not set the other corresponding value + * this can lead to odd behavior if size and unprojected + * radius become inconsistent. + * the biggest problem is that it isn't possible to change + * unprojected radius because a view context is not + * available. my ussual solution to this is to use the + * ratio of change of the size to change the unprojected + * radius. Not completely convinced that is correct. + * In anycase, a better solution is needed to prevent + * inconsistency. */ void BKE_brush_size_set(Scene *scene, Brush *brush, int size) { @@ -876,8 +876,8 @@ static void brush_painter_do_partial(BrushPainter *painter, ImBuf *oldtexibuf, /* not sure if it's actually needed or it's a mistake in coords/sizes * calculation in brush_painter_fixed_tex_partial_update(), but without this * limitation memory gets corrupted at fast strokes with quite big spacing (sergey) */ - w = MIN2(w, ibuf->x); - h = MIN2(h, ibuf->y); + w = min_ii(w, ibuf->x); + h = min_ii(h, ibuf->y); if (painter->cache.flt) { for (; y < h; y++) { @@ -1052,13 +1052,13 @@ void BKE_brush_painter_break_stroke(BrushPainter *painter) static void brush_pressure_apply(BrushPainter *painter, Brush *brush, float pressure) { if (BKE_brush_use_alpha_pressure(painter->scene, brush)) - brush_alpha_set(painter->scene, brush, maxf(0.0f, painter->startalpha * pressure)); + brush_alpha_set(painter->scene, brush, max_ff(0.0f, painter->startalpha * pressure)); if (BKE_brush_use_size_pressure(painter->scene, brush)) - BKE_brush_size_set(painter->scene, brush, maxf(1.0f, painter->startsize * pressure)); + BKE_brush_size_set(painter->scene, brush, max_ff(1.0f, painter->startsize * pressure)); if (brush->flag & BRUSH_JITTER_PRESSURE) - brush->jitter = maxf(0.0f, painter->startjitter * pressure); + brush->jitter = max_ff(0.0f, painter->startjitter * pressure); if (brush->flag & BRUSH_SPACING_PRESSURE) - brush->spacing = maxf(1.0f, painter->startspacing * (1.5f - pressure)); + brush->spacing = max_ff(1.0f, painter->startspacing * (1.5f - pressure)); } void BKE_brush_jitter_pos(const Scene *scene, Brush *brush, const float pos[2], float jitterpos[2]) @@ -1158,7 +1158,7 @@ int BKE_brush_painter_paint(BrushPainter *painter, BrushFunc func, const float p /* compute brush spacing adapted to brush radius, spacing may depend * on pressure, so update it */ brush_pressure_apply(painter, brush, painter->lastpressure); - spacing = maxf(1.0f, radius) * brush->spacing * 0.01f; + spacing = max_ff(1.0f, radius) * brush->spacing * 0.01f; /* setup starting distance, direction vector and accumulated distance */ startdistance = painter->accumdistance; @@ -1176,7 +1176,7 @@ int BKE_brush_painter_paint(BrushPainter *painter, BrushFunc func, const float p t = step / len; press = (1.0f - t) * painter->lastpressure + t * pressure; brush_pressure_apply(painter, brush, press); - spacing = maxf(1.0f, radius) * brush->spacing * 0.01f; + spacing = max_ff(1.0f, radius) * brush->spacing * 0.01f; BKE_brush_jitter_pos(scene, brush, paintpos, finalpos); diff --git a/source/blender/blenkernel/intern/bullet.c b/source/blender/blenkernel/intern/bullet.c index 7defa7e1be3..088031e16a7 100644 --- a/source/blender/blenkernel/intern/bullet.c +++ b/source/blender/blenkernel/intern/bullet.c @@ -54,7 +54,7 @@ BulletSoftBody *bsbNew(void) bsb->viterations = 0; - bsb->piterations = 2; + bsb->piterations = 2; bsb->diterations = 0; bsb->citerations = 4; diff --git a/source/blender/blenkernel/intern/bvhutils.c b/source/blender/blenkernel/intern/bvhutils.c index 32ae6d04934..ad828a70dd8 100644 --- a/source/blender/blenkernel/intern/bvhutils.c +++ b/source/blender/blenkernel/intern/bvhutils.c @@ -358,8 +358,8 @@ float nearest_point_in_tri_surface(const float v0[3], const float v1[3], const f * BVH from meshs callbacks */ -// Callback to bvh tree nearest point. The tree must bust have been built using bvhtree_from_mesh_faces. -// userdata must be a BVHMeshCallbackUserdata built from the same mesh as the tree. +/* Callback to bvh tree nearest point. The tree must bust have been built using bvhtree_from_mesh_faces. + * userdata must be a BVHMeshCallbackUserdata built from the same mesh as the tree. */ static void mesh_faces_nearest_point(void *userdata, int index, const float co[3], BVHTreeNearest *nearest) { const BVHTreeFromMesh *data = (BVHTreeFromMesh *) userdata; @@ -395,8 +395,8 @@ static void mesh_faces_nearest_point(void *userdata, int index, const float co[3 } while (t2); } -// Callback to bvh tree raycast. The tree must bust have been built using bvhtree_from_mesh_faces. -// userdata must be a BVHMeshCallbackUserdata built from the same mesh as the tree. +/* Callback to bvh tree raycast. The tree must bust have been built using bvhtree_from_mesh_faces. + * userdata must be a BVHMeshCallbackUserdata built from the same mesh as the tree. */ static void mesh_faces_spherecast(void *userdata, int index, const BVHTreeRay *ray, BVHTreeRayHit *hit) { const BVHTreeFromMesh *data = (BVHTreeFromMesh *) userdata; @@ -435,8 +435,8 @@ static void mesh_faces_spherecast(void *userdata, int index, const BVHTreeRay *r } while (t2); } -// Callback to bvh tree nearest point. The tree must bust have been built using bvhtree_from_mesh_edges. -// userdata must be a BVHMeshCallbackUserdata built from the same mesh as the tree. +/* Callback to bvh tree nearest point. The tree must bust have been built using bvhtree_from_mesh_edges. + * userdata must be a BVHMeshCallbackUserdata built from the same mesh as the tree. */ static void mesh_edges_nearest_point(void *userdata, int index, const float co[3], BVHTreeNearest *nearest) { const BVHTreeFromMesh *data = (BVHTreeFromMesh *) userdata; @@ -463,12 +463,12 @@ static void mesh_edges_nearest_point(void *userdata, int index, const float co[3 /* * BVH builders */ -// Builds a bvh tree.. where nodes are the vertexs of the given mesh +/* Builds a bvh tree.. where nodes are the vertexs of the given mesh */ BVHTree *bvhtree_from_mesh_verts(BVHTreeFromMesh *data, DerivedMesh *mesh, float epsilon, int tree_type, int axis) { BVHTree *tree = bvhcache_find(&mesh->bvhCache, BVHTREE_FROM_VERTICES); - //Not in cache + /* Not in cache */ if (tree == NULL) { int i; int numVerts = mesh->getNumVerts(mesh); @@ -484,7 +484,7 @@ BVHTree *bvhtree_from_mesh_verts(BVHTreeFromMesh *data, DerivedMesh *mesh, float BLI_bvhtree_balance(tree); - //Save on cache for later use + /* Save on cache for later use */ // printf("BVHTree built and saved on cache\n"); bvhcache_insert(&mesh->bvhCache, tree, BVHTREE_FROM_VERTICES); } @@ -495,15 +495,15 @@ BVHTree *bvhtree_from_mesh_verts(BVHTreeFromMesh *data, DerivedMesh *mesh, float } - //Setup BVHTreeFromMesh + /* Setup BVHTreeFromMesh */ memset(data, 0, sizeof(*data)); data->tree = tree; if (data->tree) { data->cached = TRUE; - //a NULL nearest callback works fine - //remeber the min distance to point is the same as the min distance to BV of point + /* a NULL nearest callback works fine + * remeber the min distance to point is the same as the min distance to BV of point */ data->nearest_callback = NULL; data->raycast_callback = NULL; @@ -517,12 +517,12 @@ BVHTree *bvhtree_from_mesh_verts(BVHTreeFromMesh *data, DerivedMesh *mesh, float return data->tree; } -// Builds a bvh tree.. where nodes are the faces of the given mesh. +/* Builds a bvh tree.. where nodes are the faces of the given mesh. */ BVHTree *bvhtree_from_mesh_faces(BVHTreeFromMesh *data, DerivedMesh *mesh, float epsilon, int tree_type, int axis) { BVHTree *tree = bvhcache_find(&mesh->bvhCache, BVHTREE_FROM_FACES); - //Not in cache + /* Not in cache */ if (tree == NULL) { int i; int numFaces = mesh->getNumTessFaces(mesh); @@ -616,7 +616,7 @@ BVHTree *bvhtree_from_mesh_faces(BVHTreeFromMesh *data, DerivedMesh *mesh, float } BLI_bvhtree_balance(tree); - //Save on cache for later use + /* Save on cache for later use */ // printf("BVHTree built and saved on cache\n"); bvhcache_insert(&mesh->bvhCache, tree, BVHTREE_FROM_FACES); } @@ -627,7 +627,7 @@ BVHTree *bvhtree_from_mesh_faces(BVHTreeFromMesh *data, DerivedMesh *mesh, float } - //Setup BVHTreeFromMesh + /* Setup BVHTreeFromMesh */ memset(data, 0, sizeof(*data)); data->tree = tree; @@ -647,12 +647,12 @@ BVHTree *bvhtree_from_mesh_faces(BVHTreeFromMesh *data, DerivedMesh *mesh, float } -// Builds a bvh tree.. where nodes are the faces of the given mesh. +/* Builds a bvh tree.. where nodes are the faces of the given mesh. */ BVHTree *bvhtree_from_mesh_edges(BVHTreeFromMesh *data, DerivedMesh *mesh, float epsilon, int tree_type, int axis) { BVHTree *tree = bvhcache_find(&mesh->bvhCache, BVHTREE_FROM_EDGES); - //Not in cache + /* Not in cache */ if (tree == NULL) { int i; int numEdges = mesh->getNumEdges(mesh); @@ -672,7 +672,7 @@ BVHTree *bvhtree_from_mesh_edges(BVHTreeFromMesh *data, DerivedMesh *mesh, float } BLI_bvhtree_balance(tree); - //Save on cache for later use + /* Save on cache for later use */ // printf("BVHTree built and saved on cache\n"); bvhcache_insert(&mesh->bvhCache, tree, BVHTREE_FROM_EDGES); } @@ -683,7 +683,7 @@ BVHTree *bvhtree_from_mesh_edges(BVHTreeFromMesh *data, DerivedMesh *mesh, float } - //Setup BVHTreeFromMesh + /* Setup BVHTreeFromMesh */ memset(data, 0, sizeof(*data)); data->tree = tree; @@ -703,7 +703,7 @@ BVHTree *bvhtree_from_mesh_edges(BVHTreeFromMesh *data, DerivedMesh *mesh, float } -// Frees data allocated by a call to bvhtree_from_mesh_*. +/* Frees data allocated by a call to bvhtree_from_mesh_*. */ void free_bvhtree_from_mesh(struct BVHTreeFromMesh *data) { if (data->tree) { @@ -728,7 +728,7 @@ static void bvhcacheitem_set_if_match(void *_cached, void *_search) BVHCacheItem *search = (BVHCacheItem *)_search; if (search->type == cached->type) { - search->tree = cached->tree; + search->tree = cached->tree; } } diff --git a/source/blender/blenkernel/intern/camera.c b/source/blender/blenkernel/intern/camera.c index ed7ac0e1a32..9118baeae6f 100644 --- a/source/blender/blenkernel/intern/camera.c +++ b/source/blender/blenkernel/intern/camera.c @@ -151,7 +151,7 @@ float BKE_camera_object_dof_distance(Object *ob) Camera *cam = (Camera *)ob->data; if (ob->type != OB_CAMERA) return 0.0f; - if (cam->dof_ob) { + if (cam->dof_ob) { /* too simple, better to return the distance on the view axis only * return len_v3v3(ob->obmat[3], cam->dof_ob->obmat[3]); */ float mat[4][4], imat[4][4], obmat[4][4]; @@ -262,11 +262,12 @@ void BKE_camera_params_from_view3d(CameraParams *params, View3D *v3d, RegionView } else if (rv3d->persp == RV3D_ORTHO) { /* orthographic view */ + int sensor_size = BKE_camera_sensor_size(params->sensor_fit, params->sensor_x, params->sensor_y); params->clipend *= 0.5f; // otherwise too extreme low zbuffer quality params->clipsta = -params->clipend; params->is_ortho = TRUE; - params->ortho_scale = rv3d->dist; + params->ortho_scale = rv3d->dist * sensor_size / v3d->lens; params->zoom = 2.0f; } else { diff --git a/source/blender/blenkernel/intern/cdderivedmesh.c b/source/blender/blenkernel/intern/cdderivedmesh.c index b176ed429f8..1f02ad1ea5a 100644 --- a/source/blender/blenkernel/intern/cdderivedmesh.c +++ b/source/blender/blenkernel/intern/cdderivedmesh.c @@ -273,6 +273,8 @@ static PBVH *cdDM_getPBVH(Object *ob, DerivedMesh *dm) cddm->pbvh = BLI_pbvh_new(); cddm->pbvh_draw = can_pbvh_draw(ob, dm); + pbvh_show_diffuse_color_set(cddm->pbvh, ob->sculpt->show_diffuse_color); + BKE_mesh_tessface_ensure(me); BLI_pbvh_build_mesh(cddm->pbvh, me->mface, me->mvert, @@ -379,7 +381,7 @@ static void cdDM_drawUVEdges(DerivedMesh *dm) for (i = 0; i < dm->numTessFaceData; i++, mf++) { if (!(mf->flag & ME_HIDE)) { draw = 1; - } + } else { draw = 0; } @@ -438,7 +440,7 @@ static void cdDM_drawEdges(DerivedMesh *dm, int drawLooseEdges, int drawAllEdges (drawLooseEdges || !(medge->flag & ME_LOOSEEDGE))) { draw = TRUE; - } + } else { draw = FALSE; } @@ -486,7 +488,7 @@ static void cdDM_drawLooseEdges(DerivedMesh *dm) for (i = 0; i < dm->numEdgeData; i++, medge++) { if (medge->flag & ME_LOOSEEDGE) { draw = 1; - } + } else { draw = 0; } @@ -552,7 +554,7 @@ static void cdDM_drawFacesSolid(DerivedMesh *dm, glShadeModel(shademodel = new_shademodel); glBegin(glmode = new_glmode); - } + } if (drawCurrentMat) { if (shademodel == GL_FLAT) { @@ -1176,13 +1178,13 @@ static void cdDM_drawMappedFacesGLSL(DerivedMesh *dm, datatypes[numdata].size = 2; datatypes[numdata].type = GL_FLOAT; numdata++; - } + } for (b = 0; b < attribs.totmcol; b++) { datatypes[numdata].index = attribs.mcol[b].gl_index; datatypes[numdata].size = 4; datatypes[numdata].type = GL_UNSIGNED_BYTE; numdata++; - } + } if (attribs.tottang) { datatypes[numdata].index = attribs.tang.gl_index; datatypes[numdata].size = 4; @@ -1242,7 +1244,7 @@ static void cdDM_drawMappedFacesGLSL(DerivedMesh *dm, col[0] = cp->b; col[1] = cp->g; col[2] = cp->r; col[3] = cp->a; copy_v4_v4_char((char *)&varray[elementsize * curface * 3 + offset + elementsize * 2], (char *)col); offset += sizeof(unsigned char) * 4; - } + } if (attribs.tottang) { float *tang = attribs.tang.array[a * 4 + 0]; copy_v4_v4((float *)&varray[elementsize * curface * 3 + offset], tang); @@ -1283,7 +1285,7 @@ static void cdDM_drawMappedFacesGLSL(DerivedMesh *dm, col[0] = cp->b; col[1] = cp->g; col[2] = cp->r; col[3] = cp->a; copy_v4_v4_char((char *)&varray[elementsize * curface * 3 + offset + elementsize * 2], (char *)col); offset += sizeof(unsigned char) * 4; - } + } if (attribs.tottang) { float *tang = attribs.tang.array[a * 4 + 2]; copy_v4_v4((float *)&varray[elementsize * curface * 3 + offset], tang); @@ -1789,10 +1791,10 @@ DerivedMesh *CDDM_from_curve_displist(Object *ob, ListBase *dispbase, int **orco } static void loops_to_customdata_corners(BMesh *bm, CustomData *facedata, - int cdindex, BMLoop *l3[3], + int cdindex, const BMLoop *l3[3], int numCol, int numTex) { - BMLoop *l; + const BMLoop *l; BMFace *f = l3[0]->f; MTFace *texface; MTexPoly *texpoly; @@ -1835,13 +1837,16 @@ static void loops_to_customdata_corners(BMesh *bm, CustomData *facedata, } } -DerivedMesh *CDDM_from_BMEditMesh(BMEditMesh *em, Mesh *UNUSED(me), int use_mdisps, int use_tessface) +/* used for both editbmesh and bmesh */ +static DerivedMesh *cddm_from_bmesh_ex(struct BMesh *bm, int use_mdisps, + /* EditBMesh vars for use_tessface */ + int use_tessface, + const int em_tottri, const BMLoop *(*em_looptris)[3] + ) { - BMesh *bm = em->bm; - DerivedMesh *dm = CDDM_new(bm->totvert, bm->totedge, - use_tessface ? em->tottri : 0, + use_tessface ? em_tottri : 0, bm->totloop, bm->totface); @@ -1887,7 +1892,7 @@ DerivedMesh *CDDM_from_BMEditMesh(BMEditMesh *em, Mesh *UNUSED(me), int use_mdis /* add tessellation mface layers */ if (use_tessface) { - CustomData_from_bmeshpoly(&dm->faceData, &dm->polyData, &dm->loopData, em->tottri); + CustomData_from_bmeshpoly(&dm->faceData, &dm->polyData, &dm->loopData, em_tottri); } index = dm->getVertDataArray(dm, CD_ORIGINDEX); @@ -1953,7 +1958,7 @@ DerivedMesh *CDDM_from_BMEditMesh(BMEditMesh *em, Mesh *UNUSED(me), int use_mdis index = dm->getTessFaceDataArray(dm, CD_ORIGINDEX); for (i = 0; i < dm->numTessFaceData; i++, index++, polyindex++) { MFace *mf = &mface[i]; - BMLoop **l = em->looptris[i]; + const BMLoop **l = em_looptris[i]; efa = l[0]->f; mf->v1 = BM_elem_index_get(l[0]->v); @@ -2003,6 +2008,20 @@ DerivedMesh *CDDM_from_BMEditMesh(BMEditMesh *em, Mesh *UNUSED(me), int use_mdis return dm; } +struct DerivedMesh *CDDM_from_bmesh(struct BMesh *bm, int use_mdisps) +{ + return cddm_from_bmesh_ex(bm, use_mdisps, FALSE, + /* these vars are for editmesh only */ + 0, NULL); +} + +DerivedMesh *CDDM_from_editbmesh(BMEditMesh *em, int use_mdisps, int use_tessface) +{ + return cddm_from_bmesh_ex(em->bm, use_mdisps, + /* editmesh */ + use_tessface, em->tottri, (const BMLoop *(*)[3])em->looptris); +} + static DerivedMesh *cddm_copy_ex(DerivedMesh *source, int faces_from_tessfaces) { CDDerivedMesh *cddm = cdDM_create("CDDM_copy cddm"); @@ -2339,7 +2358,7 @@ DerivedMesh *CDDM_merge_verts(DerivedMesh *dm, const int *vtargetmap) BLI_array_append(oldp, i); } - /*create new cddm*/ + /*create new cddm*/ cddm2 = (CDDerivedMesh *) CDDM_from_template((DerivedMesh *)cddm, BLI_array_count(mvert), BLI_array_count(medge), 0, BLI_array_count(mloop), BLI_array_count(mpoly)); /*update edge indices and copy customdata*/ @@ -2364,7 +2383,7 @@ DerivedMesh *CDDM_merge_verts(DerivedMesh *dm, const int *vtargetmap) CustomData_copy_data(&dm->loopData, &cddm2->dm.loopData, oldl[i], i, 1); } - /*copy vertex customdata*/ + /*copy vertex customdata*/ mv = mvert; for (i = 0; i < cddm2->dm.numVertData; i++, mv++) { CustomData_copy_data(&dm->vertData, &cddm2->dm.vertData, oldv[i], i, 1); diff --git a/source/blender/blenkernel/intern/cloth.c b/source/blender/blenkernel/intern/cloth.c index da162ab37d0..f1d73c7777a 100644 --- a/source/blender/blenkernel/intern/cloth.c +++ b/source/blender/blenkernel/intern/cloth.c @@ -41,8 +41,6 @@ #include "BLI_utildefines.h" #include "BLI_linklist.h" -#include "BLF_translation.h" - #include "BKE_cdderivedmesh.h" #include "BKE_cloth.h" #include "BKE_effect.h" @@ -331,7 +329,7 @@ static int do_init_cloth(Object *ob, ClothModifierData *clmd, DerivedMesh *resul cache= clmd->point_cache; /* initialize simulation data if it didn't exist already */ - if (clmd->clothObject == NULL) { + if (clmd->clothObject == NULL) { if (!cloth_from_object(ob, clmd, result, framenr, 1)) { BKE_ptcache_invalidate(cache); return 0; @@ -824,7 +822,7 @@ static int cloth_from_object(Object *ob, ClothModifierData *clmd, DerivedMesh *d int i = 0; MVert *mvert = NULL; ClothVertex *verts = NULL; - float (*shapekey_rest)[3]= NULL; + float (*shapekey_rest)[3] = NULL; float tnull[3] = {0, 0, 0}; Cloth *cloth = NULL; float maxdist = 0; @@ -845,7 +843,7 @@ static int cloth_from_object(Object *ob, ClothModifierData *clmd, DerivedMesh *d clmd->clothObject->edgehash = NULL; } else if (!clmd->clothObject) { - modifier_setError(&(clmd->modifier), "%s", TIP_("Out of memory on allocating clmd->clothObject.")); + modifier_setError(&(clmd->modifier), "Out of memory on allocating clmd->clothObject"); return 0; } @@ -907,7 +905,7 @@ static int cloth_from_object(Object *ob, ClothModifierData *clmd, DerivedMesh *d if ( !cloth_build_springs ( clmd, dm ) ) { cloth_free_modifier ( clmd ); - modifier_setError(&(clmd->modifier), "%s", TIP_("Can't build springs.")); + modifier_setError(&(clmd->modifier), "Cannot build springs"); printf("cloth_free_modifier cloth_build_springs\n"); return 0; } @@ -949,7 +947,7 @@ static void cloth_from_mesh ( ClothModifierData *clmd, DerivedMesh *dm ) clmd->clothObject->verts = MEM_callocN ( sizeof ( ClothVertex ) * clmd->clothObject->numverts, "clothVertex" ); if ( clmd->clothObject->verts == NULL ) { cloth_free_modifier ( clmd ); - modifier_setError(&(clmd->modifier), "%s", TIP_("Out of memory on allocating clmd->clothObject->verts.")); + modifier_setError(&(clmd->modifier), "Out of memory on allocating clmd->clothObject->verts"); printf("cloth_free_modifier clmd->clothObject->verts\n"); return; } @@ -959,7 +957,7 @@ static void cloth_from_mesh ( ClothModifierData *clmd, DerivedMesh *dm ) clmd->clothObject->mfaces = MEM_callocN ( sizeof ( MFace ) * clmd->clothObject->numfaces, "clothMFaces" ); if ( clmd->clothObject->mfaces == NULL ) { cloth_free_modifier ( clmd ); - modifier_setError(&(clmd->modifier), "%s", TIP_("Out of memory on allocating clmd->clothObject->mfaces.")); + modifier_setError(&(clmd->modifier), "Out of memory on allocating clmd->clothObject->mfaces"); printf("cloth_free_modifier clmd->clothObject->mfaces\n"); return; } @@ -1050,29 +1048,25 @@ static void cloth_update_springs( ClothModifierData *clmd ) spring->stiffness = 0.0f; - if(spring->type == CLOTH_SPRING_TYPE_STRUCTURAL) - { + if (spring->type == CLOTH_SPRING_TYPE_STRUCTURAL) { spring->stiffness = (cloth->verts[spring->kl].struct_stiff + cloth->verts[spring->ij].struct_stiff) / 2.0f; } - else if(spring->type == CLOTH_SPRING_TYPE_SHEAR) - { + else if (spring->type == CLOTH_SPRING_TYPE_SHEAR) { spring->stiffness = (cloth->verts[spring->kl].shear_stiff + cloth->verts[spring->ij].shear_stiff) / 2.0f; } - else if(spring->type == CLOTH_SPRING_TYPE_BENDING) - { + else if (spring->type == CLOTH_SPRING_TYPE_BENDING) { spring->stiffness = (cloth->verts[spring->kl].bend_stiff + cloth->verts[spring->ij].bend_stiff) / 2.0f; } - else if(spring->type == CLOTH_SPRING_TYPE_GOAL) - { + else if (spring->type == CLOTH_SPRING_TYPE_GOAL) { /* Warning: Appending NEW goal springs does not work because implicit solver would need reset! */ /* Activate / Deactivate existing springs */ - if ((!(cloth->verts[spring->ij].flags & CLOTH_VERT_FLAG_PINNED)) && (cloth->verts[spring->ij].goal > ALMOST_ZERO)) + if ((!(cloth->verts[spring->ij].flags & CLOTH_VERT_FLAG_PINNED)) && + (cloth->verts[spring->ij].goal > ALMOST_ZERO)) { spring->flags &= ~CLOTH_SPRING_FLAG_DEACTIVATE; } - else - { + else { spring->flags |= CLOTH_SPRING_FLAG_DEACTIVATE; } } diff --git a/source/blender/blenkernel/intern/collision.c b/source/blender/blenkernel/intern/collision.c index 05c916f9362..8da0538a08d 100644 --- a/source/blender/blenkernel/intern/collision.c +++ b/source/blender/blenkernel/intern/collision.c @@ -272,7 +272,7 @@ static int cloth_collision_response_static ( ClothModifierData *clmd, CollisionM /* Decrease in magnitude of relative tangential velocity due to coulomb friction * in original formula "magrelVel" should be the "change of relative velocity in normal direction" */ - magtangent = minf(clmd->coll_parms->friction * 0.01f * magrelVel, sqrtf(dot_v3v3(vrel_t_pre, vrel_t_pre))); + magtangent = min_ff(clmd->coll_parms->friction * 0.01f * magrelVel, sqrtf(dot_v3v3(vrel_t_pre, vrel_t_pre))); /* Apply friction impulse. */ if ( magtangent > ALMOST_ZERO ) { @@ -312,8 +312,8 @@ static int cloth_collision_response_static ( ClothModifierData *clmd, CollisionM /* stay on the safe side and clamp repulse */ if ( impulse > ALMOST_ZERO ) - repulse = MIN2 ( repulse, 5.0*impulse ); - repulse = MAX2 ( impulse, repulse ); + repulse = min_ff( repulse, 5.0*impulse ); + repulse = max_ff(impulse, repulse); impulse = repulse / ( 1.0f + w1*w1 + w2*w2 + w3*w3 ); /* original 2.0 / 0.25 */ VECADDMUL ( i1, collpair->normal, impulse ); @@ -515,7 +515,7 @@ static void add_collision_object(Object ***objs, unsigned int *numobj, unsigned if (((modifier_type == eModifierType_Collision) && ob->pd && ob->pd->deflect) || (modifier_type != eModifierType_Collision)) cmd= (CollisionModifierData *)modifiers_findByType(ob, modifier_type); - if (cmd) { + if (cmd) { /* extend array */ if (*numobj >= *maxobj) { *maxobj *= 2; @@ -534,7 +534,7 @@ static void add_collision_object(Object ***objs, unsigned int *numobj, unsigned /* add objects */ for (go= group->gobject.first; go; go= go->next) add_collision_object(objs, numobj, maxobj, go->ob, self, level+1, modifier_type); - } + } } // return all collision objects in scene @@ -580,7 +580,7 @@ static void add_collider_cache_object(ListBase **objs, Object *ob, Object *self, if (ob->pd && ob->pd->deflect) cmd =(CollisionModifierData *)modifiers_findByType(ob, eModifierType_Collision); - if (cmd && cmd->bvhtree) { + if (cmd && cmd->bvhtree) { if (*objs == NULL) *objs = MEM_callocN(sizeof(ListBase), "ColliderCache array"); @@ -738,8 +738,7 @@ int cloth_bvh_objcollision(Object *ob, ClothModifierData * clmd, float step, flo collision_move_object ( collmd, step + dt, step ); } - do - { + do { CollPair **collisions, **collisions_index; ret2 = 0; diff --git a/source/blender/blenkernel/intern/colortools.c b/source/blender/blenkernel/intern/colortools.c index d5d6d31b1e1..0c369a463d5 100644 --- a/source/blender/blenkernel/intern/colortools.c +++ b/source/blender/blenkernel/intern/colortools.c @@ -65,10 +65,10 @@ void curvemapping_set_defaults(CurveMapping *cumap, int tot, float minx, float m cumap->flag = CUMA_DO_CLIP; if (tot == 4) cumap->cur = 3; /* rhms, hack for 'col' curve? */ - clipminx = minf(minx, maxx); - clipminy = minf(miny, maxy); - clipmaxx = maxf(minx, maxx); - clipmaxy = maxf(miny, maxy); + clipminx = min_ff(minx, maxx); + clipminy = min_ff(miny, maxy); + clipmaxx = max_ff(minx, maxx); + clipmaxy = max_ff(miny, maxy); BLI_rctf_init(&cumap->curr, clipminx, clipmaxx, clipminy, clipmaxy); cumap->clipr = cumap->curr; @@ -85,7 +85,7 @@ void curvemapping_set_defaults(CurveMapping *cumap, int tot, float minx, float m cumap->cm[a].curve[0].y = miny; cumap->cm[a].curve[1].x = maxx; cumap->cm[a].curve[1].y = maxy; - } + } cumap->changed_timestamp = 0; } @@ -160,7 +160,7 @@ void curvemapping_set_black_white_ex(const float black[3], const float white[3], int a; for (a = 0; a < 3; a++) { - const float delta = maxf(white[a] - black[a], 1e-5f); + const float delta = max_ff(white[a] - black[a], 1e-5f); r_bwmul[a] = 1.0f / delta; } } @@ -498,8 +498,8 @@ static void curvemap_make_table(CurveMap *cuma, const rctf *clipr) bezt = MEM_callocN(cuma->totpoint * sizeof(BezTriple), "beztarr"); for (a = 0; a < cuma->totpoint; a++) { - cuma->mintable = minf(cuma->mintable, cmp[a].x); - cuma->maxtable = maxf(cuma->maxtable, cmp[a].x); + cuma->mintable = min_ff(cuma->mintable, cmp[a].x); + cuma->maxtable = max_ff(cuma->maxtable, cmp[a].x); bezt[a].vec[1][0] = cmp[a].x; bezt[a].vec[1][1] = cmp[a].y; if (cmp[a].flag & CUMA_VECTOR) @@ -555,7 +555,7 @@ static void curvemap_make_table(CurveMap *cuma, const rctf *clipr) sub_v3_v3v3(bezt[a].vec[2], bezt[a].vec[1], vec); } } - } + } /* make the bezier curve */ if (cuma->table) MEM_freeN(cuma->table); @@ -690,13 +690,13 @@ void curvemapping_changed(CurveMapping *cumap, int rem_doubles) for (a = 0; a < cuma->totpoint; a++) { if (cmp[a].flag & CUMA_SELECT) { if (cmp[a].x < clipr->xmin) - dx = minf(dx, cmp[a].x - clipr->xmin); + dx = min_ff(dx, cmp[a].x - clipr->xmin); else if (cmp[a].x > clipr->xmax) - dx = maxf(dx, cmp[a].x - clipr->xmax); + dx = max_ff(dx, cmp[a].x - clipr->xmax); if (cmp[a].y < clipr->ymin) - dy = minf(dy, cmp[a].y - clipr->ymin); + dy = min_ff(dy, cmp[a].y - clipr->ymin); else if (cmp[a].y > clipr->ymax) - dy = maxf(dy, cmp[a].y - clipr->ymax); + dy = max_ff(dy, cmp[a].y - clipr->ymax); } } for (a = 0; a < cuma->totpoint; a++) { @@ -731,7 +731,7 @@ void curvemapping_changed(CurveMapping *cumap, int rem_doubles) } if (a != cuma->totpoint - 1) curvemap_remove(cuma, 2); - } + } curvemap_make_table(cuma, clipr); } diff --git a/source/blender/blenkernel/intern/constraint.c b/source/blender/blenkernel/intern/constraint.c index e3f7ae1b1c7..e300b5e0f19 100644 --- a/source/blender/blenkernel/intern/constraint.c +++ b/source/blender/blenkernel/intern/constraint.c @@ -221,51 +221,6 @@ void constraints_clear_evalob(bConstraintOb *cob) /* -------------- Space-Conversion API -------------- */ -#if 0 /* XXX Old code, does the same as one in armature.c, will remove it later. */ -static void constraint_pchan_diff_mat(bPoseChannel *pchan, float diff_mat[4][4]) -{ - if (pchan->parent) { - float offs_bone[4][4]; - - /* construct offs_bone the same way it is done in armature.c */ - copy_m4_m3(offs_bone, pchan->bone->bone_mat); - copy_v3_v3(offs_bone[3], pchan->bone->head); - offs_bone[3][1] += pchan->bone->parent->length; - - if (pchan->bone->flag & BONE_HINGE) { - /* pose_mat = par_pose-space_location * chan_mat */ - float tmat[4][4]; - - /* the rotation of the parent restposition */ - copy_m4_m4(tmat, pchan->bone->parent->arm_mat); - - /* the location of actual parent transform */ - copy_v3_v3(tmat[3], offs_bone[3]); - zero_v3(offs_bone[3]); - mul_m4_v3(pchan->parent->pose_mat, tmat[3]); - - mult_m4_m4m4(diff_mat, tmat, offs_bone); - } - else { - /* pose_mat = par_pose_mat * bone_mat * chan_mat */ - if (pchan->bone->flag & BONE_NO_SCALE) { - float tmat[4][4]; - copy_m4_m4(tmat, pchan->parent->pose_mat); - normalize_m4(tmat); - mult_m4_m4m4(diff_mat, tmat, offs_bone); - } - else { - mult_m4_m4m4(diff_mat, pchan->parent->pose_mat, offs_bone); - } - } - } - else { - /* pose_mat = chan_mat * arm_mat */ - copy_m4_m4(diff_mat, pchan->bone->arm_mat); - } -} -#endif - /* This function is responsible for the correct transformations/conversions * of a matrix from one space to another for constraint evaluation. * For now, this is only implemented for Objects and PoseChannels. @@ -307,18 +262,6 @@ void constraint_mat_convertspace(Object *ob, bPoseChannel *pchan, float mat[][4] else if (to == CONSTRAINT_SPACE_LOCAL) { if (pchan->bone) { BKE_armature_mat_pose_to_bone(pchan, mat, mat); -#if 0 /* XXX Old code, will remove it later. */ - constraint_pchan_diff_mat(pchan, diff_mat); - - invert_m4_m4(imat, diff_mat); - mult_m4_m4m4(mat, imat, mat); - - /* override with local location */ - if ((pchan->parent) && (pchan->bone->flag & BONE_NO_LOCAL_LOCATION)) { - BKE_armature_mat_pose_to_bone_ex(ob, pchan, pchan->pose_mat, tempmat); - copy_v3_v3(mat[3], tempmat[3]); - } -#endif } } /* pose to local with parent */ @@ -336,24 +279,19 @@ void constraint_mat_convertspace(Object *ob, bPoseChannel *pchan, float mat[][4] if (pchan->bone) { /* we need the posespace_matrix = local_matrix + (parent_posespace_matrix + restpos) */ BKE_armature_mat_bone_to_pose(pchan, mat, mat); -#if 0 - constraint_pchan_diff_mat(pchan, diff_mat); - - mult_m4_m4m4(mat, diff_mat, mat); -#endif } /* use pose-space as stepping stone for other spaces */ if (ELEM(to, CONSTRAINT_SPACE_WORLD, CONSTRAINT_SPACE_PARLOCAL)) { /* call self with slightly different values */ constraint_mat_convertspace(ob, pchan, mat, CONSTRAINT_SPACE_POSE, to); - } + } } break; case CONSTRAINT_SPACE_PARLOCAL: /* -------------- FROM LOCAL WITH PARENT ---------- */ { /* local + parent to pose */ - if (pchan->bone) { + if (pchan->bone) { copy_m4_m4(diff_mat, pchan->bone->arm_mat); mult_m4_m4m4(mat, mat, diff_mat); } @@ -432,7 +370,7 @@ static void contarget_get_mesh_mat(Object *ob, const char *substring, float mat[ /* get DerivedMesh */ if (em) { /* target is in editmode, so get a special derived mesh */ - dm = CDDM_from_BMEditMesh(em, ob->data, FALSE, FALSE); + dm = CDDM_from_editbmesh(em, FALSE, FALSE); freeDM = 1; } else { @@ -604,15 +542,15 @@ static void constraint_target_to_mat4(Object *ob, const char *substring, float m float tempmat[4][4], loc[3]; /* interpolate along length of bone */ - interp_v3_v3v3(loc, pchan->pose_head, pchan->pose_tail, headtail); + interp_v3_v3v3(loc, pchan->pose_head, pchan->pose_tail, headtail); /* use interpolated distance for subtarget */ - copy_m4_m4(tempmat, pchan->pose_mat); + copy_m4_m4(tempmat, pchan->pose_mat); copy_v3_v3(tempmat[3], loc); mult_m4_m4m4(mat, ob->obmat, tempmat); } - } + } else copy_m4_m4(mat, ob->obmat); @@ -976,11 +914,11 @@ static void vectomat(const float vec[3], const float target_up[3], short axis, s else negate_v3(n); /* n specifies the transformation of the track axis */ - if (flags & TARGET_Z_UP) { + if (flags & TARGET_Z_UP) { /* target Z axis is the global up axis */ copy_v3_v3(u, target_up); } - else { + else { /* world Z axis is the global up axis */ u[0] = 0; u[1] = 0; @@ -1034,7 +972,7 @@ static void trackto_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *tar /* Get size property, since ob->size is only the object's own relative size, not its global one */ mat4_to_size(size, cob->matrix); - /* Clear the object's rotation */ + /* Clear the object's rotation */ cob->matrix[0][0] = size[0]; cob->matrix[0][1] = 0; cob->matrix[0][2] = 0; @@ -1468,7 +1406,7 @@ static void sizelimit_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *U if (data->flag & LIMIT_XMIN) { if (size[0] < data->xmin) - size[0] = data->xmin; + size[0] = data->xmin; } if (data->flag & LIMIT_XMAX) { if (size[0] > data->xmax) @@ -1476,7 +1414,7 @@ static void sizelimit_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *U } if (data->flag & LIMIT_YMIN) { if (size[1] < data->ymin) - size[1] = data->ymin; + size[1] = data->ymin; } if (data->flag & LIMIT_YMAX) { if (size[1] > data->ymax) @@ -1484,7 +1422,7 @@ static void sizelimit_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *U } if (data->flag & LIMIT_ZMIN) { if (size[2] < data->zmin) - size[2] = data->zmin; + size[2] = data->zmin; } if (data->flag & LIMIT_ZMAX) { if (size[2] > data->zmax) @@ -2002,7 +1940,7 @@ static void pycon_get_tarmat(bConstraint *con, bConstraintOb *cob, bConstraintTa /* this check is to make sure curve objects get updated on file load correctly.*/ if (cu->path == NULL || cu->path->data == NULL) /* only happens on reload file, but violates depsgraph still... fix! */ - BKE_displist_make_curveTypes(cob->scene, ct->tar, 0); + BKE_displist_make_curveTypes(cob->scene, ct->tar, 0); } /* firstly calculate the matrix the normal way, then let the py-function override @@ -2764,7 +2702,7 @@ static void stretchto_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *t default: /* should not happen, but in case*/ return; } /* switch (data->volmode) */ - + /* Clear the object's rotation and scale */ cob->matrix[0][0] = size[0] * scale[0]; cob->matrix[0][1] = 0; @@ -2787,10 +2725,10 @@ static void stretchto_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *t /* othogonal to "new Y" "old X! plane */ cross_v3_v3v3(orth, vec, xx); normalize_v3(orth); - + /* new Z*/ copy_v3_v3(totmat[2], orth); - + /* we decided to keep X plane*/ cross_v3_v3v3(xx, orth, vec); normalize_v3_v3(totmat[0], xx); @@ -2800,16 +2738,16 @@ static void stretchto_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *t /* othogonal to "new Y" "old Z! plane */ cross_v3_v3v3(orth, vec, zz); normalize_v3(orth); - + /* new X */ negate_v3_v3(totmat[0], orth); - + /* we decided to keep Z */ cross_v3_v3v3(zz, orth, vec); normalize_v3_v3(totmat[2], zz); break; } /* switch (data->plane) */ - + mul_m4_m3m4(cob->matrix, totmat, cob->matrix); } } @@ -2937,7 +2875,7 @@ static void minmax_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *targ if (data->flag & MINMAX_STICKY) { if (data->flag & MINMAX_STUCK) { copy_v3_v3(obmat[3], data->cache); - } + } else { copy_v3_v3(data->cache, obmat[3]); data->flag |= MINMAX_STUCK; @@ -2947,11 +2885,11 @@ static void minmax_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *targ /* get out of localspace */ mult_m4_m4m4(tmat, ct->matrix, obmat); copy_m4_m4(cob->matrix, tmat); - } - else { + } + else { copy_v3_v3(cob->matrix[3], obmat[3]); } - } + } else { data->flag &= ~MINMAX_STUCK; } @@ -3291,7 +3229,7 @@ static void transform_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *t /* extract components of owner's matrix */ copy_v3_v3(loc, cob->matrix[3]); mat4_to_eulO(eul, cob->rotOrder, cob->matrix); - mat4_to_size(size, cob->matrix); + mat4_to_size(size, cob->matrix); /* determine where in range current transforms lie */ if (data->expo) { @@ -3615,7 +3553,7 @@ static void damptrack_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *t cross_v3_v3v3(raxis, obvec, tarvec); rangle = dot_v3v3(obvec, tarvec); - rangle = acos(maxf(-1.0f, minf(1.0f, rangle))); + rangle = acos(max_ff(-1.0f, min_ff(1.0f, rangle))); /* construct rotation matrix from the axis-angle rotation found above * - this call takes care to make sure that the axis provided is a unit vector first @@ -4663,7 +4601,7 @@ short proxylocked_constraints_owner(Object *ob, bPoseChannel *pchan) else { /* FIXME: constraints on object-level are not handled well yet */ return 1; - } + } } return 0; @@ -4703,7 +4641,7 @@ void get_constraint_target_matrix(struct Scene *scene, bConstraint *con, int n, unit_m4(cob->matrix); unit_m4(cob->startmat); } - } + } break; case CONSTRAINT_OBTYPE_BONE: /* this may occur in some cases */ { @@ -4839,7 +4777,7 @@ void solve_constraints(ListBase *conlist, bConstraintOb *cob, float ctime) * since some constraints may not convert the solution back to the input space before blending * but all are guaranteed to end up in good "worldspace" result */ - /* Note: all kind of stuff here before (caused trouble), much easier to just interpolate, or did I miss something? -jahka */ + /* Note: all kind of stuff here before (caused trouble), much easier to just interpolate, or did I miss something? -jahka (r.32105) */ if (enf < 1.0f) { float solution[4][4]; copy_m4_m4(solution, cob->matrix); diff --git a/source/blender/blenkernel/intern/context.c b/source/blender/blenkernel/intern/context.c index be81c70f261..719ae7357b4 100644 --- a/source/blender/blenkernel/intern/context.c +++ b/source/blender/blenkernel/intern/context.c @@ -234,9 +234,8 @@ struct bContextDataResult { static void *ctx_wm_python_context_get(const bContext *C, const char *member, void *fall_through) { #ifdef WITH_PYTHON - bContextDataResult result; - - if (C && CTX_py_dict_get(C)) { + if (UNLIKELY(C && CTX_py_dict_get(C))) { + bContextDataResult result; memset(&result, 0, sizeof(bContextDataResult)); BPY_context_member_get((bContext *)C, member, &result); if (result.ptr.data) diff --git a/source/blender/blenkernel/intern/curve.c b/source/blender/blenkernel/intern/curve.c index e09e2eeb493..06dad495d81 100644 --- a/source/blender/blenkernel/intern/curve.c +++ b/source/blender/blenkernel/intern/curve.c @@ -1050,10 +1050,13 @@ void BKE_nurb_makeFaces(Nurb *nu, float *coord_array, int rowstride, int resolu, MEM_freeN(jend); } +/** + * \param coord_array Has to be 3 * 4 * pntsu * resolu in size and zero-ed + * \param tilt_array set when non-NULL + * \param radius_array set when non-NULL + */ void BKE_nurb_makeCurve(Nurb *nu, float *coord_array, float *tilt_array, float *radius_array, float *weight_array, int resolu, int stride) -/* coord_array has to be 3*4*pntsu*resolu in size and zero-ed - * tilt_array and radius_array will be written to if valid */ { BPoint *bp; float u, ustart, uend, ustep, sumdiv; @@ -1476,7 +1479,7 @@ void BKE_curve_bevel_make(Scene *scene, Object *ob, ListBase *disp, int forRende } } else if (cu->ext1 == 0.0f && cu->ext2 == 0.0f) { - ; + /* pass */ } else if (cu->ext2 == 0.0f) { dl = MEM_callocN(sizeof(DispList), "makebevelcurve2"); @@ -1945,7 +1948,7 @@ static void bevel_list_smooth(BevList *bl, int smooth_iter) if (bl->poly == -1) { /* check its not cyclic */ /* skip the first point */ - /* bevp0= bevp1; */ + /* bevp0 = bevp1; */ bevp1 = bevp2; bevp2++; nr--; @@ -1974,7 +1977,7 @@ static void bevel_list_smooth(BevList *bl, int smooth_iter) interp_qt_qtqt(bevp1->quat, bevp1->quat, q, 0.5); normalize_qt(bevp1->quat); - /* bevp0= bevp1; */ /* UNUSED */ + /* bevp0 = bevp1; */ /* UNUSED */ bevp1 = bevp2; bevp2++; } @@ -2151,7 +2154,7 @@ static void make_bevel_list_3D_tangent(BevList *bl) normalize_v3(cross_tmp); tri_to_quat(bevp1->quat, zero, cross_tmp, bevp1->tan); /* XXX - could be faster */ - /* bevp0= bevp1; */ /* UNUSED */ + /* bevp0 = bevp1; */ /* UNUSED */ bevp1 = bevp2; bevp2++; } diff --git a/source/blender/blenkernel/intern/customdata.c b/source/blender/blenkernel/intern/customdata.c index 423bd93c70f..d8082902a44 100644 --- a/source/blender/blenkernel/intern/customdata.c +++ b/source/blender/blenkernel/intern/customdata.c @@ -65,6 +65,12 @@ /* number of layers to add when growing a CustomData object */ #define CUSTOMDATA_GROW 5 +/* ensure typemap size is ok */ +BLI_STATIC_ASSERT(sizeof(((CustomData *)NULL)->typemap) / + sizeof(((CustomData *)NULL)->typemap[0]) == CD_NUMTYPES, + "size mismatch"); + + /********************* Layer type information **********************/ typedef struct LayerTypeInfo { int size; /* the memory size of one element of this layer's data */ @@ -1076,7 +1082,7 @@ static const LayerTypeInfo LAYERTYPEINFO[CD_NUMTYPES] = { layerEqual_mloopuv, layerMultiply_mloopuv, layerInitMinMax_mloopuv, layerAdd_mloopuv, layerDoMinMax_mloopuv, layerCopyValue_mloopuv}, /* 17: CD_MLOOPCOL */ - {sizeof(MLoopCol), "MLoopCol", 1, "Col", NULL, NULL, layerInterp_mloopcol, NULL, + {sizeof(MLoopCol), "MLoopCol", 1, "Col", NULL, NULL, layerInterp_mloopcol, NULL, layerDefault_mloopcol, layerEqual_mloopcol, layerMultiply_mloopcol, layerInitMinMax_mloopcol, layerAdd_mloopcol, layerDoMinMax_mloopcol, layerCopyValue_mloopcol}, /* 18: CD_TANGENT */ @@ -1221,9 +1227,6 @@ void CustomData_update_typemap(CustomData *data) { int i, lasttype = -1; - /* since we cant do in a pre-processor do here as an assert */ - BLI_assert(sizeof(data->typemap) / sizeof(int) >= CD_NUMTYPES); - for (i = 0; i < CD_NUMTYPES; i++) { data->typemap[i] = -1; } @@ -2477,10 +2480,49 @@ int CustomData_layer_has_math(struct CustomData *data, int layer_n) if (typeInfo->equal && typeInfo->add && typeInfo->multiply && typeInfo->initminmax && typeInfo->dominmax) { - return 1; + return TRUE; } - return 0; + return FALSE; +} + +int CustomData_layer_has_interp(struct CustomData *data, int layer_n) +{ + const LayerTypeInfo *typeInfo = layerType_getInfo(data->layers[layer_n].type); + + if (typeInfo->interp) { + return TRUE; + } + + return FALSE; +} + +int CustomData_has_math(struct CustomData *data) +{ + int i; + + /* interpolates a layer at a time */ + for (i = 0; i < data->totlayer; ++i) { + if (CustomData_layer_has_math(data, i)) { + return TRUE; + } + } + + return FALSE; +} + +int CustomData_has_interp(struct CustomData *data) +{ + int i; + + /* interpolates a layer at a time */ + for (i = 0; i < data->totlayer; ++i) { + if (CustomData_layer_has_interp(data, i)) { + return TRUE; + } + } + + return FALSE; } /* copies the "value" (e.g. mloopuv uv or mloopcol colors) from one block to @@ -2580,8 +2622,8 @@ void CustomData_bmesh_set_layer_n(CustomData *data, void *block, int n, void *so memcpy(dest, source, typeInfo->size); } -void CustomData_bmesh_interp(CustomData *data, void **src_blocks, float *weights, - float *sub_weights, int count, void *dest_block) +void CustomData_bmesh_interp(CustomData *data, void **src_blocks, const float *weights, + const float *sub_weights, int count, void *dest_block) { int i, j; void *source_buf[SOURCE_BUF_SIZE]; diff --git a/source/blender/blenkernel/intern/deform.c b/source/blender/blenkernel/intern/deform.c index 4110d4565b2..82938ed1d39 100644 --- a/source/blender/blenkernel/intern/deform.c +++ b/source/blender/blenkernel/intern/deform.c @@ -278,7 +278,7 @@ void defvert_normalize_lock_map(MDeformVert *dvert, const char *lock_flags, cons } } - lock_iweight = maxf(0.0f, 1.0f - lock_iweight); + lock_iweight = max_ff(0.0f, 1.0f - lock_iweight); if (tot_weight > 0.0f) { /* paranoid, should be 1.0 but in case of float error clamp anyway */ @@ -431,7 +431,7 @@ int *defgroup_flip_map_single(Object *ob, int *flip_map_len, int use_default, in if (strcmp(name, dg->name)) { flip_num = defgroup_name_index(ob, name); - if (flip_num >= 0) { + if (flip_num != -1) { map[defgroup] = flip_num; map[flip_num] = defgroup; } diff --git a/source/blender/blenkernel/intern/depsgraph.c b/source/blender/blenkernel/intern/depsgraph.c index 20b029371f1..950a0ca3d60 100644 --- a/source/blender/blenkernel/intern/depsgraph.c +++ b/source/blender/blenkernel/intern/depsgraph.c @@ -150,8 +150,8 @@ void queue_delete(DagNodeQueue *queue) MEM_freeN(temp); } - MEM_freeN(queue->freenodes); - MEM_freeN(queue); + MEM_freeN(queue->freenodes); + MEM_freeN(queue); } /* insert in queue, remove in front */ @@ -190,8 +190,8 @@ void push_queue(DagNodeQueue *queue, DagNode *node) } queue->freenodes->count = DAGQUEUEALLOC; - elem = queue->freenodes->first; - queue->freenodes->first = elem->next; + elem = queue->freenodes->first; + queue->freenodes->first = elem->next; } elem->next = NULL; elem->node = node; @@ -211,7 +211,7 @@ void push_stack(DagNodeQueue *queue, DagNode *node) DagNodeQueueElem *elem; int i; - elem = queue->freenodes->first; + elem = queue->freenodes->first; if (elem != NULL) { queue->freenodes->first = elem->next; if (queue->freenodes->last == elem) { @@ -235,8 +235,8 @@ void push_stack(DagNodeQueue *queue, DagNode *node) } queue->freenodes->count = DAGQUEUEALLOC; - elem = queue->freenodes->first; - queue->freenodes->first = elem->next; + elem = queue->freenodes->first; + queue->freenodes->first = elem->next; } elem->next = queue->first; elem->node = node; @@ -302,7 +302,7 @@ DagForest *dag_init(void) } /* isdata = object data... */ -// XXX this needs to be extended to be more flexible (so that not only objects are evaluated via depsgraph)... +/* XXX this needs to be extended to be more flexible (so that not only objects are evaluated via depsgraph)... */ static void dag_add_driver_relation(AnimData *adt, DagForest *dag, DagNode *node, int isdata) { FCurve *fcu; @@ -412,7 +412,7 @@ static void dag_add_collision_field_relation(DagForest *dag, Scene *scene, Objec if ((ob1->pd->deflect || ob1->pd->forcefield) && (ob1 != ob)) { if (skip_forcefield && ob1->pd->forcefield == skip_forcefield) continue; - node2 = dag_get_node(dag, ob1); + node2 = dag_get_node(dag, ob1); dag_add_relation(dag, node2, node, DAG_RL_DATA_DATA | DAG_RL_OB_DATA, "Field Collision"); } } @@ -464,7 +464,7 @@ static void build_dag_object(DagForest *dag, DagNode *scenenode, Scene *scene, O if (ct->tar->type == OB_MESH) node3->customdata_mask |= CD_MASK_MDEFORMVERT; } - else if (ELEM3(con->type, CONSTRAINT_TYPE_FOLLOWPATH, CONSTRAINT_TYPE_CLAMPTO, CONSTRAINT_TYPE_SPLINEIK)) + else if (ELEM3(con->type, CONSTRAINT_TYPE_FOLLOWPATH, CONSTRAINT_TYPE_CLAMPTO, CONSTRAINT_TYPE_SPLINEIK)) dag_add_relation(dag, node3, node, DAG_RL_DATA_DATA | DAG_RL_OB_DATA, cti->name); else dag_add_relation(dag, node3, node, DAG_RL_OB_DATA, cti->name); @@ -606,7 +606,7 @@ static void build_dag_object(DagForest *dag, DagNode *scenenode, Scene *scene, O if (mom != ob) { node2 = dag_get_node(dag, mom); - dag_add_relation(dag, node, node2, DAG_RL_DATA_DATA | DAG_RL_OB_DATA, "Metaball"); // mom depends on children! + dag_add_relation(dag, node, node2, DAG_RL_DATA_DATA | DAG_RL_OB_DATA, "Metaball"); /* mom depends on children! */ } } break; @@ -818,7 +818,7 @@ DagForest *build_dag(Main *bmain, Scene *sce, short mask) tag_main_idcode(bmain, ID_MA, FALSE); /* add base node for scene. scene is always the first node in DAG */ - scenenode = dag_add_node(dag, sce); + scenenode = dag_add_node(dag, sce); /* add current scene objects */ for (base = sce->base.first; base; base = base->next) { @@ -872,7 +872,7 @@ DagForest *build_dag(Main *bmain, Scene *sce, short mask) } /* cycle detection and solving */ - // solve_cycles(dag); + // solve_cycles(dag); return dag; } @@ -881,23 +881,23 @@ DagForest *build_dag(Main *bmain, Scene *sce, short mask) void free_forest(DagForest *Dag) { /* remove all nodes and deps */ DagNode *tempN; - DagAdjList *tempA; + DagAdjList *tempA; DagAdjList *itA; DagNode *itN = Dag->DagNode.first; while (itN) { - itA = itN->child; + itA = itN->child; while (itA) { tempA = itA; itA = itA->next; - MEM_freeN(tempA); + MEM_freeN(tempA); } - itA = itN->parent; + itA = itN->parent; while (itA) { tempA = itA; itA = itA->next; - MEM_freeN(tempA); + MEM_freeN(tempA); } tempN = itN; @@ -921,8 +921,8 @@ DagNode *dag_find_node(DagForest *forest, void *fob) return NULL; } -static int ugly_hack_sorry = 1; // prevent type check -static int dag_print_dependencies = 0; // debugging +static int ugly_hack_sorry = 1; /* prevent type check */ +static int dag_print_dependencies = 0; /* debugging */ /* no checking of existence, use dag_find_node first or dag_get_node */ DagNode *dag_add_node(DagForest *forest, void *fob) @@ -934,7 +934,7 @@ DagNode *dag_add_node(DagForest *forest, void *fob) node->ob = fob; node->color = DAG_WHITE; - if (ugly_hack_sorry) node->type = GS(((ID *) fob)->name); // sorry, done for pose sorting + if (ugly_hack_sorry) node->type = GS(((ID *) fob)->name); /* sorry, done for pose sorting */ if (forest->numNodes) { ((DagNode *) forest->DagNode.last)->next = node; forest->DagNode.last = node; @@ -1153,7 +1153,7 @@ static void dag_check_cycle(DagForest *dag) for (node = dag->DagNode.first; node; node = node->next) { while (node->parent) { itA = node->parent->next; - MEM_freeN(node->parent); + MEM_freeN(node->parent); node->parent = itA; } } @@ -1242,7 +1242,7 @@ void graph_bfs(void) itA = itA->next; } if (pos[node->BFS_dist] > node->k) { - pos[node->BFS_dist] += 1; + pos[node->BFS_dist] += 1; node->k = (float) pos[node->BFS_dist]; } else { @@ -1303,7 +1303,7 @@ int pre_and_post_source_BFS(DagForest *dag, short mask, DagNode *source, graph_a pre_func(node->ob, data); } - else { // back or cross edge + else { /* back or cross edge */ retval = 1; } itA = itA->next; @@ -1334,7 +1334,7 @@ DagNodeQueue *graph_dfs(void) /* int is_cycle = 0; */ /* UNUSED */ /* *fprintf(stderr, "starting DFS\n ------------\n"); - */ + */ nqueue = queue_create(DAGQUEUEALLOC); retqueue = queue_create(MainDag->numNodes); for (i = 0; i < 50; i++) @@ -1386,7 +1386,7 @@ DagNodeQueue *graph_dfs(void) break; } else { - if (itA->node->color == DAG_GRAY) { // back edge + if (itA->node->color == DAG_GRAY) { /* back edge */ fprintf(stderr, "dfs back edge :%15s %15s\n", ((ID *) node->ob)->name, ((ID *) itA->node->ob)->name); /* is_cycle = 1; */ /* UNUSED */ } @@ -1464,7 +1464,7 @@ int pre_and_post_source_DFS(DagForest *dag, short mask, DagNode *source, graph_a int retval = 0; /* * fprintf(stderr, "starting DFS\n ------------\n"); - */ + */ nqueue = queue_create(DAGQUEUEALLOC); /* Init @@ -1518,7 +1518,7 @@ int pre_and_post_source_DFS(DagForest *dag, short mask, DagNode *source, graph_a // } } itA = itA->next; - } + } if (!skip) { node = pop_queue(nqueue); @@ -1537,7 +1537,7 @@ int pre_and_post_source_DFS(DagForest *dag, short mask, DagNode *source, graph_a } -// used to get the obs owning a datablock +/* used to get the obs owning a datablock */ DagNodeQueue *get_obparents(struct DagForest *dag, void *ob) { DagNode *node, *node1; @@ -1548,7 +1548,7 @@ DagNodeQueue *get_obparents(struct DagForest *dag, void *ob) if (node == NULL) { return NULL; } - else if (node->ancestor_count == 1) { // simple case + else if (node->ancestor_count == 1) { /* simple case */ nqueue = queue_create(1); push_queue(nqueue, node); } @@ -1557,7 +1557,7 @@ DagNodeQueue *get_obparents(struct DagForest *dag, void *ob) node1 = dag->DagNode.first; do { - if (node1->DFS_fntm > node->DFS_fntm) { // a parent is finished after child. must check adj list + if (node1->DFS_fntm > node->DFS_fntm) { /* a parent is finished after child. must check adj list */ itA = node->child; while (itA != NULL) { if ((itA->node == node) && (itA->type == DAG_RL_DATA)) { @@ -1585,7 +1585,7 @@ DagNodeQueue *get_first_ancestors(struct DagForest *dag, void *ob) node1 = dag->DagNode.first; do { - if (node1->DFS_fntm > node->DFS_fntm) { + if (node1->DFS_fntm > node->DFS_fntm) { itA = node->child; while (itA != NULL) { if (itA->node == node) { @@ -1597,10 +1597,10 @@ DagNodeQueue *get_first_ancestors(struct DagForest *dag, void *ob) node1 = node1->next; } while (node1); - return nqueue; + return nqueue; } -// standard DFS list +/* standard DFS list */ DagNodeQueue *get_all_childs(struct DagForest *dag, void *ob) { DagNode *node; @@ -1611,7 +1611,7 @@ DagNodeQueue *get_all_childs(struct DagForest *dag, void *ob) int skip = 0; nqueue = queue_create(DAGQUEUEALLOC); - retqueue = queue_create(dag->numNodes); // was MainDag... why? (ton) + retqueue = queue_create(dag->numNodes); /* was MainDag... why? (ton) */ node = dag->DagNode.first; while (node) { @@ -1621,8 +1621,8 @@ DagNodeQueue *get_all_childs(struct DagForest *dag, void *ob) time = 1; - node = dag_find_node(dag, ob); // could be done in loop above (ton) - if (node) { // can be null for newly added objects + node = dag_find_node(dag, ob); /* could be done in loop above (ton) */ + if (node) { /* can be null for newly added objects */ node->color = DAG_GRAY; time++; @@ -1643,9 +1643,9 @@ DagNodeQueue *get_all_childs(struct DagForest *dag, void *ob) push_stack(nqueue, itA->node); skip = 1; break; - } + } itA = itA->next; - } + } if (!skip) { node = pop_queue(nqueue); @@ -1673,7 +1673,7 @@ short are_obs_related(struct DagForest *dag, void *ob1, void *ob2) while (itA != NULL) { if (itA->node->ob == ob2) { return itA->node->type; - } + } itA = itA->next; } return DAG_NO_RELATION; @@ -1701,7 +1701,7 @@ void graph_print_queue(DagNodeQueue *nqueue) queueElem = nqueue->first; while (queueElem) { fprintf(stderr, "** %s %i %i-%i ", ((ID *) queueElem->node->ob)->name, queueElem->node->color, queueElem->node->DFS_dvtm, queueElem->node->DFS_fntm); - queueElem = queueElem->next; + queueElem = queueElem->next; } fprintf(stderr, "\n"); } @@ -1721,7 +1721,7 @@ void graph_print_queue_dist(DagNodeQueue *nqueue) fputc('|', stderr); fputc('\n', stderr); count = 0; - queueElem = queueElem->next; + queueElem = queueElem->next; } fprintf(stderr, "\n"); } @@ -1859,14 +1859,14 @@ void DAG_scene_sort(Main *bmain, Scene *sce) push_stack(nqueue, itA->node); skip = 1; break; - } + } itA = itA->next; - } + } if (!skip) { if (node) { node = pop_queue(nqueue); - if (node->ob == sce) // we are done + if (node->ob == sce) /* we are done */ break; node->color = DAG_BLACK; @@ -1878,7 +1878,7 @@ void DAG_scene_sort(Main *bmain, Scene *sce) BLI_remlink(&sce->base, base); BLI_addhead(&tempbase, base); } - } + } } } @@ -2023,7 +2023,7 @@ static unsigned int flush_layer_node(Scene *sce, DagNode *node, int curtime) for (itA = node->child; itA; itA = itA->next) { if (itA->node->type == ID_OB) { if (itA->node->lasttime != curtime) { - itA->lay = flush_layer_node(sce, itA->node, curtime); // lay is only set once for each relation + itA->lay = flush_layer_node(sce, itA->node, curtime); /* lay is only set once for each relation */ } else itA->lay = itA->node->lay; @@ -2071,12 +2071,12 @@ static void dag_scene_flush_layers(Scene *sce, int lay) Base *base; int lasttime; - firstnode = sce->theDag->DagNode.first; // always scene node + firstnode = sce->theDag->DagNode.first; /* always scene node */ for (itA = firstnode->child; itA; itA = itA->next) itA->lay = 0; - sce->theDag->time++; // so we know which nodes were accessed + sce->theDag->time++; /* so we know which nodes were accessed */ lasttime = sce->theDag->time; /* update layer flags in nodes */ @@ -2148,13 +2148,13 @@ void DAG_scene_flush_update(Main *bmain, Scene *sce, unsigned int lay, const sho DAG_scene_sort(bmain, sce); } - firstnode = sce->theDag->DagNode.first; // always scene node + firstnode = sce->theDag->DagNode.first; /* always scene node */ /* first we flush the layer flags */ dag_scene_flush_layers(sce, lay); /* then we use the relationships + layer info to flush update events */ - sce->theDag->time++; // so we know which nodes were accessed + sce->theDag->time++; /* so we know which nodes were accessed */ lasttime = sce->theDag->time; for (itA = firstnode->child; itA; itA = itA->next) if (itA->node->lasttime != lasttime && itA->node->type == ID_OB) @@ -2162,7 +2162,7 @@ void DAG_scene_flush_update(Main *bmain, Scene *sce, unsigned int lay, const sho /* if update is not due to time change, do pointcache clears */ if (!time) { - sce->theDag->time++; // so we know which nodes were accessed + sce->theDag->time++; /* so we know which nodes were accessed */ lasttime = sce->theDag->time; for (itA = firstnode->child; itA; itA = itA->next) { if (itA->node->lasttime != lasttime && itA->node->type == ID_OB) { @@ -2380,7 +2380,7 @@ static void dag_object_time_update_flags(Object *ob) } } } - } + } if (ob->recalc & OB_RECALC_OB) lib_id_recalc_tag(G.main, &ob->id); @@ -2930,9 +2930,9 @@ void DAG_pose_sort(Object *ob) int skip = 0; dag = dag_init(); - ugly_hack_sorry = 0; // no ID structs + ugly_hack_sorry = 0; /* no ID structs */ - rootnode = dag_add_node(dag, NULL); // node->ob becomes NULL + rootnode = dag_add_node(dag, NULL); /* node->ob becomes NULL */ /* we add the hierarchy and the constraints */ for (pchan = pose->chanbase.first; pchan; pchan = pchan->next) { @@ -2977,7 +2977,7 @@ void DAG_pose_sort(Object *ob) dag_add_relation(dag, node2, node3, 0, "IK Constraint"); segcount++; - if (segcount == data->rootbone || segcount > 255) break; // 255 is weak + if (segcount == data->rootbone || segcount > 255) break; /* 255 is weak */ parchan = parchan->parent; } } @@ -3020,21 +3020,21 @@ void DAG_pose_sort(Object *ob) push_stack(nqueue, itA->node); skip = 1; break; - } + } itA = itA->next; - } + } if (!skip) { if (node) { node = pop_queue(nqueue); - if (node->ob == NULL) // we are done + if (node->ob == NULL) /* we are done */ break; node->color = DAG_BLACK; /* put node in new list */ BLI_remlink(&pose->chanbase, node->ob); BLI_addhead(&tempbase, node->ob); - } + } } } diff --git a/source/blender/blenkernel/intern/displist.c b/source/blender/blenkernel/intern/displist.c index 10c9f30f5ee..e13d05d0a2f 100644 --- a/source/blender/blenkernel/intern/displist.c +++ b/source/blender/blenkernel/intern/displist.c @@ -1386,8 +1386,8 @@ static void do_makeDispListCurveTypes(Scene *scene, Object *ob, ListBase *dispba ListBase top_capbase = {NULL, NULL}; for (dlb = dlbev.first; dlb; dlb = dlb->next) { - const float bevfac1 = minf(cu->bevfac1, cu->bevfac2); - const float bevfac2 = maxf(cu->bevfac1, cu->bevfac2); + const float bevfac1 = min_ff(cu->bevfac1, cu->bevfac2); + const float bevfac2 = max_ff(cu->bevfac1, cu->bevfac2); float firstblend = 0.0f, lastblend = 0.0f; int i, start, steps; diff --git a/source/blender/blenkernel/intern/dynamicpaint.c b/source/blender/blenkernel/intern/dynamicpaint.c index d55848514cc..f34a0150c79 100644 --- a/source/blender/blenkernel/intern/dynamicpaint.c +++ b/source/blender/blenkernel/intern/dynamicpaint.c @@ -32,6 +32,8 @@ #include "BLI_threads.h" #include "BLI_utildefines.h" +#include "BLF_translation.h" + #include "DNA_anim_types.h" #include "DNA_armature_types.h" #include "DNA_constraint_types.h" @@ -569,7 +571,7 @@ static void scene_setSubframe(Scene *scene, float subframe) static int surface_getBrushFlags(DynamicPaintSurface *surface, Scene *scene) { Base *base = NULL; - GroupObject *go = NULL; + GroupObject *go = NULL; Object *brushObj = NULL; ModifierData *md = NULL; @@ -848,7 +850,7 @@ static void surfaceGenerateGrid(struct DynamicPaintSurface *surface) grid->s_num = MEM_reallocN(grid->s_num, sizeof(int) * grid_cells); if (error || !grid->s_num) { - setError(surface->canvas, "Not enough free memory."); + setError(surface->canvas, N_("Not enough free memory")); freeGrid(sData); } } @@ -1235,7 +1237,7 @@ static void dynamicPaint_allocateSurfaceType(DynamicPaintSurface *surface) break; } - if (sData->type_data == NULL) setError(surface->canvas, "Not enough free memory!"); + if (sData->type_data == NULL) setError(surface->canvas, N_("Not enough free memory")); } static int surface_usesAdjDistance(DynamicPaintSurface *surface) @@ -1292,7 +1294,7 @@ static void dynamicPaint_initAdjacencyData(DynamicPaintSurface *surface, int for if (!ad->n_index || !ad->n_num || !ad->n_target || !temp_data) { dynamicPaint_freeAdjData(sData); if (temp_data) MEM_freeN(temp_data); - setError(surface->canvas, "Not enough free memory."); + setError(surface->canvas, N_("Not enough free memory")); return; } @@ -1762,10 +1764,10 @@ static DerivedMesh *dynamicPaint_Modifier_apply(DynamicPaintModifierData *pmd, } /* apply weights into a vertex group, if doesnt exists add a new layer */ - if (defgrp_index >= 0 && !dvert && (surface->output_name[0] != '\0')) + if (defgrp_index != -1 && !dvert && (surface->output_name[0] != '\0')) dvert = CustomData_add_layer_named(&result->vertData, CD_MDEFORMVERT, CD_CALLOC, NULL, sData->total_points, surface->output_name); - if (defgrp_index >= 0 && dvert) { + if (defgrp_index != -1 && dvert) { int i; for (i = 0; i < sData->total_points; i++) { MDeformVert *dv = &dvert[i]; @@ -2165,8 +2167,10 @@ int dynamicPaint_createUVSurface(DynamicPaintSurface *surface) int *final_index; int aa_samples; - if (!dm) return setError(canvas, "Canvas mesh not updated."); - if (surface->format != MOD_DPAINT_SURFACE_F_IMAGESEQ) return setError(canvas, "Can't bake non-\"image sequence\" formats."); + if (!dm) + return setError(canvas, N_("Canvas mesh not updated")); + if (surface->format != MOD_DPAINT_SURFACE_F_IMAGESEQ) + return setError(canvas, N_("Cannot bake non-'image sequence' formats")); numOfFaces = dm->getNumTessFaces(dm); mface = dm->getTessFaceArray(dm); @@ -2176,8 +2180,10 @@ int dynamicPaint_createUVSurface(DynamicPaintSurface *surface) tface = CustomData_get_layer_named(&dm->faceData, CD_MTFACE, uvname); /* Check for validity */ - if (!tface) return setError(canvas, "No UV data on canvas."); - if (surface->image_resolution < 16 || surface->image_resolution > 8192) return setError(canvas, "Invalid resolution."); + if (!tface) + return setError(canvas, N_("No UV data on canvas")); + if (surface->image_resolution < 16 || surface->image_resolution > 8192) + return setError(canvas, N_("Invalid resolution")); w = h = surface->image_resolution; @@ -2189,7 +2195,8 @@ int dynamicPaint_createUVSurface(DynamicPaintSurface *surface) /* Init data struct */ if (surface->data) dynamicPaint_freeSurfaceData(surface); sData = surface->data = MEM_callocN(sizeof(PaintSurfaceData), "PaintSurfaceData"); - if (!surface->data) return setError(canvas, "Not enough free memory."); + if (!surface->data) + return setError(canvas, N_("Not enough free memory")); aa_samples = (surface->flags & MOD_DPAINT_ANTIALIAS) ? 5 : 1; tempPoints = (struct PaintUVPoint *) MEM_callocN(w * h * sizeof(struct PaintUVPoint), "Temp PaintUVPoint"); @@ -2547,7 +2554,8 @@ int dynamicPaint_createUVSurface(DynamicPaintSurface *surface) } } } - if (error == 1) setError(canvas, "Not enough free memory."); + if (error == 1) + setError(canvas, N_("Not enough free memory")); if (faceBB) MEM_freeN(faceBB); if (tempPoints) MEM_freeN(tempPoints); @@ -2598,7 +2606,10 @@ void dynamicPaint_outputSurfaceImage(DynamicPaintSurface *surface, char *filenam int format = (surface->image_fileformat & MOD_DPAINT_IMGFORMAT_OPENEXR) ? R_IMF_IMTYPE_OPENEXR : R_IMF_IMTYPE_PNG; char output_file[FILE_MAX]; - if (!sData->type_data) { setError(surface->canvas, "Image save failed: Invalid surface."); return; } + if (!sData->type_data) { + setError(surface->canvas, N_("Image save failed: invalid surface")); + return; + } /* if selected format is openexr, but current build doesnt support one */ #ifndef WITH_OPENEXR if (format == R_IMF_IMTYPE_OPENEXR) format = R_IMF_IMTYPE_PNG; @@ -2612,7 +2623,10 @@ void dynamicPaint_outputSurfaceImage(DynamicPaintSurface *surface, char *filenam /* Init image buffer */ ibuf = IMB_allocImBuf(surface->image_resolution, surface->image_resolution, 32, IB_rectfloat); - if (ibuf == NULL) { setError(surface->canvas, "Image save failed: Not enough free memory."); return; } + if (ibuf == NULL) { + setError(surface->canvas, N_("Image save failed: not enough free memory")); + return; + } #pragma omp parallel for schedule(static) for (index = 0; index < sData->total_points; index++) { @@ -4649,7 +4663,7 @@ static int dynamicPaint_generateBakeData(DynamicPaintSurface *surface, Scene *sc if (bData->realCoord) MEM_freeN(bData->realCoord); if (canvas_verts) MEM_freeN(canvas_verts); - return setError(surface->canvas, "Not enough free memory."); + return setError(surface->canvas, N_("Not enough free memory")); } new_bdata = 1; @@ -4811,7 +4825,7 @@ static int dynamicPaint_doStep(Scene *scene, Object *ob, DynamicPaintSurface *su */ { Base *base = NULL; - GroupObject *go = NULL; + GroupObject *go = NULL; Object *brushObj = NULL; ModifierData *md = NULL; @@ -4878,7 +4892,7 @@ static int dynamicPaint_doStep(Scene *scene, Object *ob, DynamicPaintSurface *su /* Apply brush on the surface depending on it's collision type */ /* Particle brush: */ if (brush->collision == MOD_DPAINT_COL_PSYS) { - if (brush->psys && brush->psys->part && brush->psys->part->type == PART_EMITTER && + if (brush->psys && brush->psys->part && ELEM(brush->psys->part->type, PART_EMITTER, PART_FLUID) && psys_check_enabled(brushObj, brush->psys)) { @@ -4934,7 +4948,7 @@ static int dynamicPaint_doStep(Scene *scene, Object *ob, DynamicPaintSurface *su /* Allocate memory for surface previous points to read unchanged values from */ prevPoint = MEM_mallocN(sData->total_points * sizeof(struct PaintPoint), "PaintSurfaceDataCopy"); if (!prevPoint) - return setError(canvas, "Not enough free memory."); + return setError(canvas, N_("Not enough free memory")); /* Prepare effects and get number of required steps */ steps = dynamicPaint_prepareEffectStep(surface, scene, ob, &force, timescale); diff --git a/source/blender/blenkernel/intern/effect.c b/source/blender/blenkernel/intern/effect.c index 7c0b43c24df..1f6db19ac27 100644 --- a/source/blender/blenkernel/intern/effect.c +++ b/source/blender/blenkernel/intern/effect.c @@ -166,7 +166,7 @@ void free_partdeflect(PartDeflect *pd) pd->tex->id.us--; if (pd->rng) - rng_free(pd->rng); + BLI_rng_free(pd->rng); MEM_freeN(pd); } @@ -175,9 +175,9 @@ static void precalculate_effector(EffectorCache *eff) { unsigned int cfra = (unsigned int)(eff->scene->r.cfra >= 0 ? eff->scene->r.cfra : -eff->scene->r.cfra); if (!eff->pd->rng) - eff->pd->rng = rng_new(eff->pd->seed + cfra); + eff->pd->rng = BLI_rng_new(eff->pd->seed + cfra); else - rng_srandom(eff->pd->rng, eff->pd->seed + cfra); + BLI_rng_srandom(eff->pd->rng, eff->pd->seed + cfra); if (eff->pd->forcefield == PFIELD_GUIDE && eff->ob->type==OB_CURVE) { Curve *cu= eff->ob->data; @@ -205,7 +205,7 @@ static void precalculate_effector(EffectorCache *eff) float old_vel[3]; BKE_object_where_is_calc_time(eff->scene, eff->ob, cfra - 1.0f); - copy_v3_v3(old_vel, eff->ob->obmat[3]); + copy_v3_v3(old_vel, eff->ob->obmat[3]); BKE_object_where_is_calc_time(eff->scene, eff->ob, cfra); sub_v3_v3v3(eff->velocity, eff->ob->obmat[3], old_vel); } @@ -455,8 +455,8 @@ static float eff_calc_visibility(ListBase *colliders, EffectorCache *eff, Effect // noise function for wind e.g. static float wind_func(struct RNG *rng, float strength) { - int random = (rng_getInt(rng)+1) % 128; // max 2357 - float force = rng_getFloat(rng) + 1.0f; + int random = (BLI_rng_get_int(rng)+1) % 128; // max 2357 + float force = BLI_rng_get_float(rng) + 1.0f; float ret; float sign = 0; @@ -718,8 +718,8 @@ static void get_effector_tot(EffectorCache *eff, EffectorData *efd, EffectedPoin if (eff->pd->forcefield == PFIELD_CHARGE) { /* Only the charge of the effected particle is used for - * interaction, not fall-offs. If the fall-offs aren't the - * same this will be unphysical, but for animation this + * interaction, not fall-offs. If the fall-offs aren't the + * same this will be unphysical, but for animation this * could be the wanted behavior. If you want physical * correctness the fall-off should be spherical 2.0 anyways. */ @@ -828,7 +828,7 @@ static void do_physical_effector(EffectorCache *eff, EffectorData *efd, Effected { PartDeflect *pd = eff->pd; RNG *rng = pd->rng; - float force[3]={0, 0, 0}; + float force[3] = {0, 0, 0}; float temp[3]; float fac; float strength = pd->f_strength; @@ -1020,7 +1020,7 @@ void pdDoEffectors(ListBase *effectors, ListBase *colliders, EffectorWeights *we do_texture_effector(eff, &efd, point, force); } else { - float temp1[3]={0, 0, 0}, temp2[3]; + float temp1[3] = {0, 0, 0}, temp2[3]; copy_v3_v3(temp1, force); do_physical_effector(eff, &efd, point, force); diff --git a/source/blender/blenkernel/intern/fcurve.c b/source/blender/blenkernel/intern/fcurve.c index 2dbc63e6944..ec61311d89e 100644 --- a/source/blender/blenkernel/intern/fcurve.c +++ b/source/blender/blenkernel/intern/fcurve.c @@ -504,14 +504,14 @@ short calc_fcurve_bounds(FCurve *fcu, float *xmin, float *xmax, float *ymin, flo xmaxv = MAX3(xmaxv, bezt_last->vec[1][0], bezt_last->vec[2][0]); } else { - xminv = minf(xminv, bezt_first->vec[1][0]); - xmaxv = maxf(xmaxv, bezt_last->vec[1][0]); + xminv = min_ff(xminv, bezt_first->vec[1][0]); + xmaxv = max_ff(xmaxv, bezt_last->vec[1][0]); } } } /* only loop over keyframes to find extents for values if needed */ - if (ymin || ymax) { + if (ymin || ymax) { BezTriple *bezt; for (bezt = fcu->bezt, i = 0; i < fcu->totvert; bezt++, i++) { @@ -521,8 +521,8 @@ short calc_fcurve_bounds(FCurve *fcu, float *xmin, float *xmax, float *ymin, flo ymaxv = MAX4(ymaxv, bezt->vec[1][1], bezt->vec[0][1], bezt->vec[2][1]); } else { - yminv = minf(yminv, bezt->vec[1][1]); - ymaxv = maxf(ymaxv, bezt->vec[1][1]); + yminv = min_ff(yminv, bezt->vec[1][1]); + ymaxv = max_ff(ymaxv, bezt->vec[1][1]); } foundvert = TRUE; @@ -533,8 +533,8 @@ short calc_fcurve_bounds(FCurve *fcu, float *xmin, float *xmax, float *ymin, flo else if (fcu->fpt) { /* frame range can be directly calculated from end verts */ if (xmin || xmax) { - xminv = minf(xminv, fcu->fpt[0].vec[0]); - xmaxv = maxf(xmaxv, fcu->fpt[fcu->totvert - 1].vec[0]); + xminv = min_ff(xminv, fcu->fpt[0].vec[0]); + xmaxv = max_ff(xmaxv, fcu->fpt[fcu->totvert - 1].vec[0]); } /* only loop over keyframes to find extents for values if needed */ @@ -591,15 +591,15 @@ void calc_fcurve_range(FCurve *fcu, float *start, float *end, if (bezt_first) { BLI_assert(bezt_last != NULL); - min = minf(min, bezt_first->vec[1][0]); - max = maxf(max, bezt_last->vec[1][0]); + min = min_ff(min, bezt_first->vec[1][0]); + max = max_ff(max, bezt_last->vec[1][0]); foundvert = TRUE; } } else if (fcu->fpt) { - min = minf(min, fcu->fpt[0].vec[0]); - max = maxf(max, fcu->fpt[fcu->totvert - 1].vec[0]); + min = min_ff(min, fcu->fpt[0].vec[0]); + max = max_ff(max, fcu->fpt[fcu->totvert - 1].vec[0]); foundvert = TRUE; } @@ -1039,7 +1039,7 @@ static float dtar_get_prop_val(ChannelDriver *driver, DriverTarget *dtar) if (RNA_path_resolve_full(&id_ptr, dtar->rna_path, &ptr, &prop, &index)) { if (RNA_property_array_check(prop)) { /* array */ - if (index < RNA_property_array_length(&ptr, prop)) { + if (index < RNA_property_array_length(&ptr, prop)) { switch (RNA_property_type(prop)) { case PROP_BOOLEAN: value = (float)RNA_property_boolean_get_index(&ptr, prop, index); @@ -1143,7 +1143,7 @@ static float dvar_eval_rotDiff(ChannelDriver *driver, DriverVar *dvar) /* stop here... */ return 0.0f; - } + } /* use the final posed locations */ mat4_to_quat(q1, pchan->pose_mat); @@ -1549,7 +1549,7 @@ ChannelDriver *fcurve_copy_driver(ChannelDriver *driver) for (dvar = ndriver->variables.first; dvar; dvar = dvar->next) { /* need to go over all targets so that we don't leave any dangling paths */ DRIVER_TARGETS_LOOPER(dvar) - { + { /* make a copy of target's rna path if available */ if (dtar->rna_path) dtar->rna_path = MEM_dupallocN(dtar->rna_path); @@ -1832,7 +1832,7 @@ static int findzero(float x, float q0, float q1, float q2, float q3, float *o) return 1; } - return 0; + return 0; } } @@ -1916,7 +1916,7 @@ static float fcurve_eval_keyframes(FCurve *fcu, BezTriple *bezts, float evaltime cvalue = prevbezt->vec[1][1]; } } - } + } else { /* Use the first handle (earlier) of first BezTriple to calculate the * gradient and thus the value of the curve at evaltime @@ -1968,7 +1968,7 @@ static float fcurve_eval_keyframes(FCurve *fcu, BezTriple *bezts, float evaltime cvalue = lastbezt->vec[1][1]; } } - } + } else { /* Use the gradient of the second handle (later) of last BezTriple to calculate the * gradient and thus the value of the curve at evaltime diff --git a/source/blender/blenkernel/intern/fluidsim.c b/source/blender/blenkernel/intern/fluidsim.c index 9be599ac66c..efc9869c5ca 100644 --- a/source/blender/blenkernel/intern/fluidsim.c +++ b/source/blender/blenkernel/intern/fluidsim.c @@ -41,7 +41,7 @@ #include "DNA_mesh_types.h" #include "DNA_meshdata_types.h" #include "DNA_object_fluidsim.h" -#include "DNA_object_force.h" // for pointcache +#include "DNA_object_force.h" // for pointcache #include "DNA_object_types.h" #include "DNA_particle_types.h" #include "DNA_scene_types.h" // N_T @@ -66,14 +66,14 @@ //------------------------------------------------------------------------------- void initElbeemMesh(struct Scene *scene, struct Object *ob, - int *numVertices, float **vertices, - int *numTriangles, int **triangles, - int useGlobalCoords, int modifierIndex) + int *numVertices, float **vertices, + int *numTriangles, int **triangles, + int useGlobalCoords, int modifierIndex) { DerivedMesh *dm = NULL; MVert *mvert; MFace *mface; - int countTris=0, i, totvert, totface; + int countTris = 0, i, totvert, totface; float *verts; int *tris; @@ -87,35 +87,35 @@ void initElbeemMesh(struct Scene *scene, struct Object *ob, totface = dm->getNumTessFaces(dm); *numVertices = totvert; - verts = MEM_callocN(totvert*3*sizeof(float), "elbeemmesh_vertices"); - for (i=0; i<totvert; i++) { - copy_v3_v3(&verts[i*3], mvert[i].co); - if (useGlobalCoords) { mul_m4_v3(ob->obmat, &verts[i*3]); } + verts = MEM_callocN(totvert * 3 * sizeof(float), "elbeemmesh_vertices"); + for (i = 0; i < totvert; i++) { + copy_v3_v3(&verts[i * 3], mvert[i].co); + if (useGlobalCoords) { mul_m4_v3(ob->obmat, &verts[i * 3]); } } *vertices = verts; - for (i=0; i<totface; i++) { + for (i = 0; i < totface; i++) { countTris++; if (mface[i].v4) { countTris++; } } *numTriangles = countTris; - tris = MEM_callocN(countTris*3*sizeof(int), "elbeemmesh_triangles"); + tris = MEM_callocN(countTris * 3 * sizeof(int), "elbeemmesh_triangles"); countTris = 0; - for (i=0; i<totface; i++) { + for (i = 0; i < totface; i++) { int face[4]; face[0] = mface[i].v1; face[1] = mface[i].v2; face[2] = mface[i].v3; face[3] = mface[i].v4; - tris[countTris*3+0] = face[0]; - tris[countTris*3+1] = face[1]; - tris[countTris*3+2] = face[2]; + tris[countTris * 3 + 0] = face[0]; + tris[countTris * 3 + 1] = face[1]; + tris[countTris * 3 + 2] = face[2]; countTris++; if (face[3]) { - tris[countTris*3+0] = face[0]; - tris[countTris*3+1] = face[2]; - tris[countTris*3+2] = face[3]; + tris[countTris * 3 + 0] = face[0]; + tris[countTris * 3 + 1] = face[2]; + tris[countTris * 3 + 2] = face[3]; countTris++; } } diff --git a/source/blender/blenkernel/intern/fmodifier.c b/source/blender/blenkernel/intern/fmodifier.c index 1e6eb77f666..2b393b4d90b 100644 --- a/source/blender/blenkernel/intern/fmodifier.c +++ b/source/blender/blenkernel/intern/fmodifier.c @@ -156,7 +156,7 @@ static void fcm_generator_verify(FModifier *fcm) /* free the old data */ MEM_freeN(data->coefficients); - } + } /* set the new data */ data->coefficients = nc; @@ -182,7 +182,7 @@ static void fcm_generator_verify(FModifier *fcm) /* free the old data */ MEM_freeN(data->coefficients); - } + } /* set the new data */ data->coefficients = nc; @@ -276,7 +276,7 @@ static FModifierTypeInfo FMI_GENERATOR = { /* Built-In Function Generator F-Curve Modifier --------------------------- */ /* This uses the general equation for equations: - * y = amplitude * fn(phase_multiplier*x + phase_offset) + y_offset + * y = amplitude * fn(phase_multiplier * x + phase_offset) + y_offset * * where amplitude, phase_multiplier/offset, y_offset are user-defined coefficients, * x is the evaluation 'time', and 'y' is the resultant value @@ -316,7 +316,7 @@ static void fcm_fn_generator_evaluate(FCurve *UNUSED(fcu), FModifier *fcm, float * WARNING: must perform special argument validation hereto guard against crashes */ switch (data->type) { - /* simple ones */ + /* simple ones */ case FCM_GENERATOR_FN_SIN: /* sine wave */ fn = sin; break; @@ -1022,7 +1022,7 @@ FModifier *add_fmodifier(ListBase *modifiers, int type) fcm->data = MEM_callocN(fmi->size, fmi->structName); /* init custom settings if necessary */ - if (fmi->new_data) + if (fmi->new_data) fmi->new_data(fcm->data); /* return modifier for further editing */ @@ -1099,7 +1099,7 @@ int remove_fmodifier(ListBase *modifiers, FModifier *fcm) if (modifiers) { BLI_freelinkN(modifiers, fcm); return 1; - } + } else { /* XXX this case can probably be removed some day, as it shouldn't happen... */ printf("remove_fmodifier() - no modifier stack given\n"); diff --git a/source/blender/blenkernel/intern/font.c b/source/blender/blenkernel/intern/font.c index 06b21fbbd29..d4634748c71 100644 --- a/source/blender/blenkernel/intern/font.c +++ b/source/blender/blenkernel/intern/font.c @@ -177,7 +177,7 @@ static VFontData *vfont_get_data(Main *bmain, VFont *vfont) } } - return vfont->data; + return vfont->data; } VFont *BKE_vfont_load(Main *bmain, const char *name) @@ -306,23 +306,23 @@ static void build_underline(Curve *cu, float x1, float y1, float x2, float y2, i nu2->bp = bp; nu2->bp[0].vec[0] = x1; - nu2->bp[0].vec[1] = y1; + nu2->bp[0].vec[1] = y1; nu2->bp[0].vec[2] = 0; nu2->bp[0].vec[3] = 1.0f; nu2->bp[1].vec[0] = x2; nu2->bp[1].vec[1] = y1; - nu2->bp[1].vec[2] = 0; + nu2->bp[1].vec[2] = 0; nu2->bp[1].vec[3] = 1.0f; nu2->bp[2].vec[0] = x2; - nu2->bp[2].vec[1] = y2; + nu2->bp[2].vec[1] = y2; nu2->bp[2].vec[2] = 0; nu2->bp[2].vec[3] = 1.0f; nu2->bp[3].vec[0] = x1; nu2->bp[3].vec[1] = y2; - nu2->bp[3].vec[2] = 0; + nu2->bp[3].vec[2] = 0; nu2->bp[3].vec[3] = 1.0f; - BLI_addtail(&(cu->nurb), nu2); + BLI_addtail(&(cu->nurb), nu2); } @@ -545,7 +545,7 @@ struct CharTrans *BKE_vfont_to_curve(Main *bmain, Scene *scene, Object *ob, int /* The VFont Data can not be found */ if (!vfd) { if (mem) - MEM_freeN(mem); + MEM_freeN(mem); return NULL; } @@ -671,7 +671,7 @@ makebreak: yof -= linedist; - maxlen = maxf(maxlen, (xof - tb->x / cu->fsize)); + maxlen = max_ff(maxlen, (xof - tb->x / cu->fsize)); linedata[lnr] = xof - tb->x / cu->fsize; linedata2[lnr] = cnr; linedata3[lnr] = tb->w / cu->fsize; @@ -731,7 +731,7 @@ makebreak: if (ascii == 32) { wsfac = cu->wordspace; wsnr++; - } + } else { wsfac = 1.0f; } @@ -754,7 +754,7 @@ makebreak: for (i = 0; i <= slen; i++, tmp++, ct++) { ascii = *tmp; if (ascii == '\n' || ascii == '\r' || ct->dobreak) cu->lines++; - } + } /* linedata is now: width of line * linedata2 is now: number of characters @@ -792,7 +792,7 @@ makebreak: // } ct++; } - } + } else if ((cu->spacemode == CU_JUSTIFY) && (cu->tb[0].w != 0.0f)) { float curofs = 0.0f; for (i = 0; i <= slen; i++) { diff --git a/source/blender/blenkernel/intern/gpencil.c b/source/blender/blenkernel/intern/gpencil.c index 76b00ffdb1c..a7d0152a799 100644 --- a/source/blender/blenkernel/intern/gpencil.c +++ b/source/blender/blenkernel/intern/gpencil.c @@ -517,7 +517,7 @@ void gpencil_layer_delete(bGPdata *gpd, bGPDlayer *gpl) if (ELEM(NULL, gpd, gpl)) return; - /* free layer */ + /* free layer */ free_gpencil_frames(gpl); BLI_freelinkN(&gpd->layers, gpl); } diff --git a/source/blender/blenkernel/intern/group.c b/source/blender/blenkernel/intern/group.c index 3392f6f109b..d3545cd2720 100644 --- a/source/blender/blenkernel/intern/group.c +++ b/source/blender/blenkernel/intern/group.c @@ -99,7 +99,7 @@ void BKE_group_unlink(Group *group) base->object->flag &= ~OB_FROMGROUP; base->flag &= ~OB_FROMGROUP; } - } + } for (srl = sce->r.layers.first; srl; srl = srl->next) { if (srl->light_override == group) diff --git a/source/blender/blenkernel/intern/image.c b/source/blender/blenkernel/intern/image.c index 9a1ea15da97..ef751ce3493 100644 --- a/source/blender/blenkernel/intern/image.c +++ b/source/blender/blenkernel/intern/image.c @@ -1063,6 +1063,7 @@ char BKE_imtype_valid_channels(const char imtype) case R_IMF_IMTYPE_DDS: case R_IMF_IMTYPE_JP2: case R_IMF_IMTYPE_QUICKTIME: + case R_IMF_IMTYPE_DPX: chan_flag |= IMA_CHAN_FLAG_ALPHA; } @@ -1091,10 +1092,11 @@ char BKE_imtype_valid_depths(const char imtype) return R_IMF_CHAN_DEPTH_16 | R_IMF_CHAN_DEPTH_32; case R_IMF_IMTYPE_MULTILAYER: return R_IMF_CHAN_DEPTH_32; - /* eeh, cineone does some strange 10bits per channel */ + /* eeh, cineon does some strange 10bits per channel */ case R_IMF_IMTYPE_DPX: + return R_IMF_CHAN_DEPTH_8 | R_IMF_CHAN_DEPTH_10 | R_IMF_CHAN_DEPTH_12 | R_IMF_CHAN_DEPTH_16; case R_IMF_IMTYPE_CINEON: - return R_IMF_CHAN_DEPTH_12; + return R_IMF_CHAN_DEPTH_10; case R_IMF_IMTYPE_JP2: return R_IMF_CHAN_DEPTH_8 | R_IMF_CHAN_DEPTH_12 | R_IMF_CHAN_DEPTH_16; /* most formats are 8bit only */ @@ -1825,9 +1827,33 @@ int BKE_imbuf_write(ImBuf *ibuf, const char *name, ImageFormatData *imf) #ifdef WITH_CINEON else if (imtype == R_IMF_IMTYPE_CINEON) { ibuf->ftype = CINEON; + if (imf->cineon_flag & R_IMF_CINEON_FLAG_LOG) { + ibuf->ftype |= CINEON_LOG; + } + if (imf->depth == R_IMF_CHAN_DEPTH_16) { + ibuf->ftype |= CINEON_16BIT; + } + else if (imf->depth == R_IMF_CHAN_DEPTH_12) { + ibuf->ftype |= CINEON_12BIT; + } + else if (imf->depth == R_IMF_CHAN_DEPTH_10) { + ibuf->ftype |= CINEON_10BIT; + } } else if (imtype == R_IMF_IMTYPE_DPX) { ibuf->ftype = DPX; + if (imf->cineon_flag & R_IMF_CINEON_FLAG_LOG) { + ibuf->ftype |= CINEON_LOG; + } + if (imf->depth == R_IMF_CHAN_DEPTH_16) { + ibuf->ftype |= CINEON_16BIT; + } + else if (imf->depth == R_IMF_CHAN_DEPTH_12) { + ibuf->ftype |= CINEON_12BIT; + } + else if (imf->depth == R_IMF_CHAN_DEPTH_10) { + ibuf->ftype |= CINEON_10BIT; + } } #endif else if (imtype == R_IMF_IMTYPE_TARGA) { @@ -2120,6 +2146,15 @@ void BKE_image_signal(Image *ima, ImageUser *iuser, int signal) } } break; + case IMA_SIGNAL_COLORMANAGE: + image_free_buffers(ima); + + ima->ok = 1; + + if (iuser) + iuser->ok = 1; + + break; } /* don't use notifiers because they are not 100% sure to succeeded diff --git a/source/blender/blenkernel/intern/image_gen.c b/source/blender/blenkernel/intern/image_gen.c index 37572eebed6..468a88775c6 100644 --- a/source/blender/blenkernel/intern/image_gen.c +++ b/source/blender/blenkernel/intern/image_gen.c @@ -244,7 +244,7 @@ static void checker_board_color_tint(unsigned char *rect, float *rect_float, int } } - } + } } static void checker_board_grid_fill(unsigned char *rect, float *rect_float, int width, int height, float blend) diff --git a/source/blender/blenkernel/intern/implicit.c b/source/blender/blenkernel/intern/implicit.c index 235d7858e17..39dcd73e0e5 100644 --- a/source/blender/blenkernel/intern/implicit.c +++ b/source/blender/blenkernel/intern/implicit.c @@ -590,7 +590,7 @@ DO_INLINE void mul_bfmatrix_lfvector( float (*to)[3], fmatrix3x3 *from, lfVector for (i = from[0].vcount; i < from[0].vcount+from[0].scount; i++) { muladd_fmatrix_fvector(to[from[i].c], from[i].m, fLongVector[from[i].r]); } - } + } #pragma omp section { for (i = 0; i < from[0].vcount+from[0].scount; i++) { @@ -623,7 +623,7 @@ DO_INLINE void add_bfmatrix_bfmatrix( fmatrix3x3 *to, fmatrix3x3 *from, fmatrix /* process diagonal elements */ for (i = 0; i < matrix[0].vcount+matrix[0].scount; i++) { - add_fmatrix_fmatrix(to[i].m, from[i].m, matrix[i].m); + add_fmatrix_fmatrix(to[i].m, from[i].m, matrix[i].m); } } @@ -634,7 +634,7 @@ DO_INLINE void addadd_bfmatrix_bfmatrix( fmatrix3x3 *to, fmatrix3x3 *from, fmat /* process diagonal elements */ for (i = 0; i < matrix[0].vcount+matrix[0].scount; i++) { - addadd_fmatrix_fmatrix(to[i].m, from[i].m, matrix[i].m); + addadd_fmatrix_fmatrix(to[i].m, from[i].m, matrix[i].m); } } @@ -645,7 +645,7 @@ DO_INLINE void subadd_bfmatrix_bfmatrix( fmatrix3x3 *to, fmatrix3x3 *from, fmat /* process diagonal elements */ for (i = 0; i < matrix[0].vcount+matrix[0].scount; i++) { - subadd_fmatrix_fmatrix(to[i].m, from[i].m, matrix[i].m); + subadd_fmatrix_fmatrix(to[i].m, from[i].m, matrix[i].m); } } @@ -656,7 +656,7 @@ DO_INLINE void sub_bfmatrix_bfmatrix( fmatrix3x3 *to, fmatrix3x3 *from, fmatrix /* process diagonal elements */ for (i = 0; i < matrix[0].vcount+matrix[0].scount; i++) { - sub_fmatrix_fmatrix(to[i].m, from[i].m, matrix[i].m); + sub_fmatrix_fmatrix(to[i].m, from[i].m, matrix[i].m); } } @@ -667,7 +667,7 @@ DO_INLINE void sub_bfmatrix_Smatrix( fmatrix3x3 *to, fmatrix3x3 *from, fmatrix3 /* process diagonal elements */ for (i = 0; i < matrix[0].vcount; i++) { - sub_fmatrix_fmatrix(to[matrix[i].c].m, from[matrix[i].c].m, matrix[i].m); + sub_fmatrix_fmatrix(to[matrix[i].c].m, from[matrix[i].c].m, matrix[i].m); } } @@ -678,7 +678,7 @@ DO_INLINE void addsub_bfmatrix_bfmatrix( fmatrix3x3 *to, fmatrix3x3 *from, fmat /* process diagonal elements */ for (i = 0; i < matrix[0].vcount+matrix[0].scount; i++) { - addsub_fmatrix_fmatrix(to[i].m, from[i].m, matrix[i].m); + addsub_fmatrix_fmatrix(to[i].m, from[i].m, matrix[i].m); } } @@ -691,7 +691,7 @@ DO_INLINE void subadd_bfmatrixS_bfmatrixS( fmatrix3x3 *to, fmatrix3x3 *from, flo /* process diagonal elements */ for (i = 0; i < matrix[0].vcount+matrix[0].scount; i++) { - subadd_fmatrixS_fmatrixS(to[i].m, from[i].m, aS, matrix[i].m, bS); + subadd_fmatrixS_fmatrixS(to[i].m, from[i].m, aS, matrix[i].m, bS); } } @@ -711,7 +711,7 @@ static void update_matrixS(ClothVertex *verts, int numverts, fmatrix3x3 *S) int i = 0; /* Clear matrix from old vertex constraints */ - for(i = 0; i < S[0].vcount; i++) + for (i = 0; i < S[0].vcount; i++) S[i].c = S[i].r = 0; /* Set new vertex constraints */ @@ -749,7 +749,7 @@ int implicit_init(Object *UNUSED(ob), ClothModifierData *clmd) id = (Implicit_Data *)MEM_callocN(sizeof(Implicit_Data), "implicit vecmat"); cloth->implicit = id; - /* process diagonal elements */ + /* process diagonal elements */ id->A = create_bfmatrix(cloth->numverts, cloth->numsprings); id->dFdV = create_bfmatrix(cloth->numverts, cloth->numsprings); id->dFdX = create_bfmatrix(cloth->numverts, cloth->numsprings); @@ -876,8 +876,8 @@ DO_INLINE float fbstar_jacobi(float length, float L, float kb, float cb) return cb; } else { - return kb * fbderiv(length, L); - } + return kb * fbderiv(length, L); + } } DO_INLINE void filter(lfVector *V, fmatrix3x3 *S) @@ -1148,7 +1148,7 @@ DO_INLINE void dfdx_spring_type1(float to[3][3], float extent[3], float length, // dir is unit length direction, rest is spring's restlength, k is spring constant. // return (outerprod(dir, dir)*k + (I - outerprod(dir, dir))*(k - ((k*L)/length))); float temp[3][3]; - float temp1 = k*(1.0 - (L/length)); + float temp1 = k*(1.0 - (L/length)); mul_fvectorT_fvectorS(temp, extent, extent, 1.0 / dot); sub_fmatrix_fmatrix(to, I, temp); @@ -1218,7 +1218,7 @@ DO_INLINE void cloth_calc_spring_force(ClothModifierData *clmd, ClothSpring *s, float stretch_force[3] = {0, 0, 0}; float bending_force[3] = {0, 0, 0}; float damping_force[3] = {0, 0, 0}; - float nulldfdx[3][3]={ {0, 0, 0}, {0, 0, 0}, {0, 0, 0}}; + float nulldfdx[3][3] = {{0, 0, 0}, {0, 0, 0}, {0, 0, 0}}; float scaling = 0.0; @@ -1246,7 +1246,7 @@ DO_INLINE void cloth_calc_spring_force(ClothModifierData *clmd, ClothSpring *s, s->flags |= CSPRING_FLAG_DEACTIVATE; return; } - } + } */ mul_fvector_S(dir, extent, 1.0f/length); } @@ -1318,9 +1318,9 @@ DO_INLINE void cloth_calc_spring_force(ClothModifierData *clmd, ClothSpring *s, if (length < L) { s->flags |= CLOTH_SPRING_FLAG_NEEDED; - k = clmd->sim_parms->bending; + k = clmd->sim_parms->bending; - scaling = k + s->stiffness * ABS(clmd->sim_parms->max_bend-k); + scaling = k + s->stiffness * ABS(clmd->sim_parms->max_bend-k); cb = k = scaling / (20.0*(clmd->sim_parms->avg_spring_len + FLT_EPSILON)); mul_fvector_S(bending_force, dir, fbstar(length, L, k, cb)); @@ -1337,7 +1337,7 @@ DO_INLINE void cloth_apply_spring_force(ClothModifierData *UNUSED(clmd), ClothSp if (!(s->type & CLOTH_SPRING_TYPE_BENDING)) { sub_fmatrix_fmatrix(dFdV[s->ij].m, dFdV[s->ij].m, s->dfdv); sub_fmatrix_fmatrix(dFdV[s->kl].m, dFdV[s->kl].m, s->dfdv); - add_fmatrix_fmatrix(dFdV[s->matrix_index].m, dFdV[s->matrix_index].m, s->dfdv); + add_fmatrix_fmatrix(dFdV[s->matrix_index].m, dFdV[s->matrix_index].m, s->dfdv); } VECADD(lF[s->ij], lF[s->ij], s->f); @@ -1348,7 +1348,7 @@ DO_INLINE void cloth_apply_spring_force(ClothModifierData *UNUSED(clmd), ClothSp sub_fmatrix_fmatrix(dFdX[s->kl].m, dFdX[s->kl].m, s->dfdx); sub_fmatrix_fmatrix(dFdX[s->ij].m, dFdX[s->ij].m, s->dfdx); add_fmatrix_fmatrix(dFdX[s->matrix_index].m, dFdX[s->matrix_index].m, s->dfdx); - } + } } @@ -1356,15 +1356,15 @@ static void CalcFloat( float *v1, float *v2, float *v3, float *n) { float n1[3], n2[3]; - n1[0]= v1[0]-v2[0]; - n2[0]= v2[0]-v3[0]; - n1[1]= v1[1]-v2[1]; - n2[1]= v2[1]-v3[1]; - n1[2]= v1[2]-v2[2]; - n2[2]= v2[2]-v3[2]; - n[0]= n1[1]*n2[2]-n1[2]*n2[1]; - n[1]= n1[2]*n2[0]-n1[0]*n2[2]; - n[2]= n1[0]*n2[1]-n1[1]*n2[0]; + n1[0] = v1[0]-v2[0]; + n2[0] = v2[0]-v3[0]; + n1[1] = v1[1]-v2[1]; + n2[1] = v2[1]-v3[1]; + n1[2] = v1[2]-v2[2]; + n2[2] = v2[2]-v3[2]; + n[0] = n1[1]*n2[2]-n1[2]*n2[1]; + n[1] = n1[2]*n2[0]-n1[0]*n2[2]; + n[2] = n1[0]*n2[1]-n1[1]*n2[0]; } static void CalcFloat4( float *v1, float *v2, float *v3, float *v4, float *n) @@ -1372,17 +1372,17 @@ static void CalcFloat4( float *v1, float *v2, float *v3, float *v4, float *n) /* real cross! */ float n1[3], n2[3]; - n1[0]= v1[0]-v3[0]; - n1[1]= v1[1]-v3[1]; - n1[2]= v1[2]-v3[2]; + n1[0] = v1[0]-v3[0]; + n1[1] = v1[1]-v3[1]; + n1[2] = v1[2]-v3[2]; - n2[0]= v2[0]-v4[0]; - n2[1]= v2[1]-v4[1]; - n2[2]= v2[2]-v4[2]; + n2[0] = v2[0]-v4[0]; + n2[1] = v2[1]-v4[1]; + n2[2] = v2[2]-v4[2]; - n[0]= n1[1]*n2[2]-n1[2]*n2[1]; - n[1]= n1[2]*n2[0]-n1[0]*n2[2]; - n[2]= n1[0]*n2[1]-n1[1]*n2[0]; + n[0] = n1[1]*n2[2]-n1[2]*n2[1]; + n[1] = n1[2]*n2[0]-n1[0]*n2[2]; + n[2] = n1[0]*n2[1]-n1[1]*n2[0]; } static float calculateVertexWindForce(float wind[3], float vertexnormal[3]) @@ -1544,7 +1544,7 @@ static void cloth_calc_force(ClothModifierData *clmd, float UNUSED(frame), lfVec lfVector *winvec; EffectedPoint epoint; - tm2[0][0]= tm2[1][1]= tm2[2][2]= -spring_air; + tm2[0][0] = tm2[1][1] = tm2[2][2] = -spring_air; /* global acceleration (gravitation) */ if (clmd->scene->physics_settings.flag & PHYS_GLOBAL_GRAVITY) { @@ -1588,9 +1588,9 @@ static void cloth_calc_force(ClothModifierData *clmd, float UNUSED(frame), lfVec } for (i = 0; i < cloth->numfaces; i++) { - float trinormal[3]={0, 0, 0}; // normalized triangle normal - float triunnormal[3]={0, 0, 0}; // not-normalized-triangle normal - float tmp[3]={0, 0, 0}; + float trinormal[3] = {0, 0, 0}; // normalized triangle normal + float triunnormal[3] = {0, 0, 0}; // not-normalized-triangle normal + float tmp[3] = {0, 0, 0}; float factor = (mfaces[i].v4) ? 0.25 : 1.0 / 3.0; factor *= 0.02; @@ -1628,9 +1628,9 @@ static void cloth_calc_force(ClothModifierData *clmd, float UNUSED(frame), lfVec /* Hair has only edges */ if (cloth->numfaces == 0) { ClothSpring *spring; - float edgevec[3]={0, 0, 0}; //edge vector - float edgeunnormal[3]={0, 0, 0}; // not-normalized-edge normal - float tmp[3]={0, 0, 0}; + float edgevec[3] = {0, 0, 0}; //edge vector + float edgeunnormal[3] = {0, 0, 0}; // not-normalized-edge normal + float tmp[3] = {0, 0, 0}; float factor = 0.01; search = cloth->springs; @@ -1662,7 +1662,7 @@ static void cloth_calc_force(ClothModifierData *clmd, float UNUSED(frame), lfVec while (search) { // only handle active springs ClothSpring *spring = search->link; - if( !(spring->flags & CLOTH_SPRING_FLAG_DEACTIVATE)) + if (!(spring->flags & CLOTH_SPRING_FLAG_DEACTIVATE)) cloth_calc_spring_force(clmd, search->link, lF, lX, lV, dFdV, dFdX, time); search = search->next; @@ -1730,8 +1730,8 @@ static int UNUSED_FUNCTION(cloth_calc_helper_forces)(Object *UNUSED(ob), ClothMo for (i=0; i<cloth->numverts; i++, cv++) { copy_v3_v3(cos[i], cv->tx); - if (cv->goal == 1.0f || len_v3v3(initial_cos[i], cv->tx) != 0.0) { - masses[i] = 1e+10; + if (cv->goal == 1.0f || len_squared_v3v3(initial_cos[i], cv->tx) != 0.0) { + masses[i] = 1e+10; } else { masses[i] = cv->mass; @@ -1814,7 +1814,7 @@ int implicit_solver(Object *ob, float frame, ClothModifierData *clmd, ListBase * sub_v3_v3v3(id->V[i], verts[i].xconst, verts[i].xold); // mul_v3_fl(id->V[i], clmd->sim_parms->stepsPerFrame); } - } + } } while (step < tf) { @@ -1839,7 +1839,7 @@ int implicit_solver(Object *ob, float frame, ClothModifierData *clmd, ListBase * mul_fvector_S(tvect, tvect, step+dt); VECADD(tvect, tvect, verts[i].xold); copy_v3_v3(id->Xnew[i], tvect); - } + } } copy_v3_v3(verts[i].txold, id->X[i]); @@ -1897,7 +1897,7 @@ int implicit_solver(Object *ob, float frame, ClothModifierData *clmd, ListBase * cp_lfvector(id->V, id->Vnew, numverts); // calculate - cloth_calc_force(clmd, frame, id->F, id->X, id->V, id->dFdV, id->dFdX, effectors, step+dt, id->M); + cloth_calc_force(clmd, frame, id->F, id->X, id->V, id->dFdV, id->dFdX, effectors, step+dt, id->M); simulate_implicit_euler(id->Vnew, id->X, id->V, id->F, id->dFdV, id->dFdX, dt / 2.0f, id->A, id->B, id->dV, id->S, id->z, id->olddV, id->P, id->Pinv, id->M, id->bigI); } @@ -1946,6 +1946,6 @@ void implicit_set_positions(ClothModifierData *clmd) copy_v3_v3(id->V[i], verts[i].v); } if (G.debug_value > 0) - printf("implicit_set_positions\n"); + printf("implicit_set_positions\n"); } diff --git a/source/blender/blenkernel/intern/ipo.c b/source/blender/blenkernel/intern/ipo.c index b7e33f1cf71..3b08e3d2fa1 100644 --- a/source/blender/blenkernel/intern/ipo.c +++ b/source/blender/blenkernel/intern/ipo.c @@ -569,7 +569,7 @@ static const char *material_adrcodes_to_paths(int adrcode, int *array_index) return mtex_adrcodes_to_paths(adrcode, array_index); } - return NULL; + return NULL; } /* Camera Types */ @@ -727,7 +727,7 @@ static const char *world_adrcodes_to_paths(int adrcode, int *array_index) return mtex_adrcodes_to_paths(adrcode, array_index); } - return NULL; + return NULL; } /* Particle Types */ @@ -873,7 +873,7 @@ static char *get_rna_access(int blocktype, int adrcode, char actname[], char con propname = "eval_time"; break; - /* XXX problematic blocktypes */ + /* XXX problematic blocktypes */ case ID_SEQ: /* sequencer strip */ //SEQ_FAC1: switch (adrcode) { @@ -981,21 +981,21 @@ static char *get_rna_access(int blocktype, int adrcode, char actname[], char con static short adrcode_to_dtar_transchan(short adrcode) { switch (adrcode) { - case OB_LOC_X: + case OB_LOC_X: return DTAR_TRANSCHAN_LOCX; case OB_LOC_Y: return DTAR_TRANSCHAN_LOCY; case OB_LOC_Z: return DTAR_TRANSCHAN_LOCZ; - case OB_ROT_X: + case OB_ROT_X: return DTAR_TRANSCHAN_ROTX; case OB_ROT_Y: return DTAR_TRANSCHAN_ROTY; case OB_ROT_Z: return DTAR_TRANSCHAN_ROTZ; - case OB_SIZE_X: + case OB_SIZE_X: return DTAR_TRANSCHAN_SCALEX; case OB_SIZE_Y: return DTAR_TRANSCHAN_SCALEX; @@ -1645,7 +1645,7 @@ static void nlastrips_to_animdata(ID *id, ListBase *strips) /* by default, we now always extrapolate, while in the past this was optional */ if ((as->flag & ACTSTRIP_HOLDLASTFRAME) == 0) strip->extendmode = NLASTRIP_EXTEND_NOTHING; - } + } /* try to add this strip to the current NLA-Track (i.e. the 'last' one on the stack atm) */ if (BKE_nlatrack_add_strip(nlt, strip) == 0) { diff --git a/source/blender/blenkernel/intern/key.c b/source/blender/blenkernel/intern/key.c index b9bf2fd01a3..782d796b8a7 100644 --- a/source/blender/blenkernel/intern/key.c +++ b/source/blender/blenkernel/intern/key.c @@ -389,7 +389,7 @@ static int setkeys(float fac, ListBase *lb, KeyBlock *k[], float t[4], int cycl) if (k1->next == NULL) k[0] = k1; k1 = k1->next; } - /* k1= k[1]; */ /* UNUSED */ + /* k1 = k[1]; */ /* UNUSED */ t[0] = k[0]->pos; t[1] += dpos; t[2] = k[2]->pos + dpos; @@ -609,7 +609,7 @@ static void cp_key(const int start, int end, const int tot, char *poin, Key *key } } else k1 += start * key->elemsize; - } + } if (mode == KEY_MODE_BEZTRIPLE) { elemstr[0] = 1; @@ -691,8 +691,8 @@ static void cp_cu_key(Curve *cu, Key *key, KeyBlock *actkb, KeyBlock *kb, const if (nu->bp) { step = nu->pntsu * nu->pntsv; - a1 = maxi(a, start); - a2 = mini(a + step, end); + a1 = max_ii(a, start); + a2 = min_ii(a + step, end); if (a1 < a2) cp_key(a1, a2, tot, out, key, actkb, kb, NULL, KEY_MODE_BPOINT); } @@ -700,8 +700,8 @@ static void cp_cu_key(Curve *cu, Key *key, KeyBlock *actkb, KeyBlock *kb, const step = 3 * nu->pntsu; /* exception because keys prefer to work with complete blocks */ - a1 = maxi(a, start); - a2 = mini(a + step, end); + a1 = max_ii(a, start); + a2 = min_ii(a + step, end); if (a1 < a2) cp_key(a1, a2, tot, out, key, actkb, kb, NULL, KEY_MODE_BEZTRIPLE); } @@ -1043,7 +1043,7 @@ static float *get_weights_array(Object *ob, char *vgroup) /* find the group (weak loop-in-loop) */ defgrp_index = defgroup_name_index(ob, vgroup); - if (defgrp_index >= 0) { + if (defgrp_index != -1) { float *weights; int i; @@ -1217,7 +1217,7 @@ static void do_curve_key(Scene *scene, Object *ob, Key *key, char *out, const in remain = step; } - count = mini(remain, estep); + count = min_ii(remain, estep); if (mode == KEY_MODE_BEZTRIPLE) { count += 3 - count % 3; } @@ -1268,7 +1268,7 @@ static void do_latt_key(Scene *scene, Object *ob, Key *key, char *out, const int do_key(a, a + 1, tot, out, key, actkb, k, t, KEY_MODE_DUMMY); else cp_key(a, a + 1, tot, out, key, actkb, k[2], NULL, KEY_MODE_DUMMY); - } + } } else { if (key->type == KEY_RELATIVE) { @@ -1584,7 +1584,7 @@ void BKE_key_convert_to_lattice(KeyBlock *kb, Lattice *lt) fp = kb->data; tot = lt->pntsu * lt->pntsv * lt->pntsw; - tot = mini(kb->totelem, tot); + tot = min_ii(kb->totelem, tot); for (a = 0; a < tot; a++, fp += 3, bp++) { copy_v3_v3(bp->vec, fp); @@ -1656,7 +1656,7 @@ void BKE_key_convert_to_curve(KeyBlock *kb, Curve *UNUSED(cu), ListBase *nurb) tot = BKE_nurbList_verts_count(nurb); - tot = mini(kb->totelem, tot); + tot = min_ii(kb->totelem, tot); while (nu && tot > 0) { @@ -1724,7 +1724,7 @@ void BKE_key_convert_to_mesh(KeyBlock *kb, Mesh *me) mvert = me->mvert; fp = kb->data; - tot = mini(kb->totelem, me->totvert); + tot = min_ii(kb->totelem, me->totvert); for (a = 0; a < tot; a++, fp += 3, mvert++) { copy_v3_v3(mvert->co, fp); diff --git a/source/blender/blenkernel/intern/lattice.c b/source/blender/blenkernel/intern/lattice.c index 5382ea453eb..a15ca7cb5ce 100644 --- a/source/blender/blenkernel/intern/lattice.c +++ b/source/blender/blenkernel/intern/lattice.c @@ -348,7 +348,7 @@ void calc_latt_deform(Object *ob, float co[3], float weight) int ui, vi, wi, uu, vv, ww; /* vgroup influence */ - int defgroup_nr = -1; + int defgrp_index = -1; float co_prev[3], weight_blend = 0.0f; MDeformVert *dvert = BKE_lattice_deform_verts_get(ob); @@ -357,7 +357,7 @@ void calc_latt_deform(Object *ob, float co[3], float weight) if (lt->latticedata == NULL) return; if (lt->vgroup[0] && dvert) { - defgroup_nr = defgroup_name_index(ob, lt->vgroup); + defgrp_index = defgroup_name_index(ob, lt->vgroup); copy_v3_v3(co_prev, co); } @@ -431,8 +431,8 @@ void calc_latt_deform(Object *ob, float co[3], float weight) madd_v3_v3fl(co, <->latticedata[idx_u * 3], u); - if (defgroup_nr != -1) - weight_blend += (u * defvert_find_weight(dvert + idx_u, defgroup_nr)); + if (defgrp_index != -1) + weight_blend += (u * defvert_find_weight(dvert + idx_u, defgrp_index)); } } } @@ -440,7 +440,7 @@ void calc_latt_deform(Object *ob, float co[3], float weight) } } - if (defgroup_nr != -1) + if (defgrp_index != -1) interp_v3_v3v3(co, co_prev, co, weight_blend); } @@ -669,9 +669,9 @@ void curve_deform_verts(Scene *scene, Object *cuOb, Object *target, if (vgroup && vgroup[0] && use_vgroups) { Mesh *me = target->data; - int index = defgroup_name_index(target, vgroup); + const int defgrp_index = defgroup_name_index(target, vgroup); - if (index != -1 && (me->dvert || dm)) { + if (defgrp_index != -1 && (me->dvert || dm)) { MDeformVert *dvert = me->dvert; float vec[3]; float weight; @@ -681,7 +681,7 @@ void curve_deform_verts(Scene *scene, Object *cuOb, Object *target, dvert = me->dvert; for (a = 0; a < numVerts; a++, dvert++) { if (dm) dvert = dm->getVertData(dm, a, CD_MDEFORMVERT); - weight = defvert_find_weight(dvert, index); + weight = defvert_find_weight(dvert, defgrp_index); if (weight > 0.0f) { mul_m4_v3(cd.curvespace, vertexCos[a]); @@ -699,7 +699,7 @@ void curve_deform_verts(Scene *scene, Object *cuOb, Object *target, for (a = 0; a < numVerts; a++, dvert++) { if (dm) dvert = dm->getVertData(dm, a, CD_MDEFORMVERT); - if (defvert_find_weight(dvert, index) > 0.0f) { + if (defvert_find_weight(dvert, defgrp_index) > 0.0f) { mul_m4_v3(cd.curvespace, vertexCos[a]); minmax_v3v3_v3(cd.dmin, cd.dmax, vertexCos[a]); } @@ -709,7 +709,7 @@ void curve_deform_verts(Scene *scene, Object *cuOb, Object *target, for (a = 0; a < numVerts; a++, dvert++) { if (dm) dvert = dm->getVertData(dm, a, CD_MDEFORMVERT); - weight = defvert_find_weight(dvert, index); + weight = defvert_find_weight(dvert, defgrp_index); if (weight > 0.0f) { /* already in 'cd.curvespace', prev for loop */ @@ -815,16 +815,16 @@ void lattice_deform_verts(Object *laOb, Object *target, DerivedMesh *dm, if (vgroup && vgroup[0] && use_vgroups) { Mesh *me = target->data; - int index = defgroup_name_index(target, vgroup); + const int defgrp_index = defgroup_name_index(target, vgroup); float weight; - if (index >= 0 && (me->dvert || dm)) { + if (defgrp_index >= 0 && (me->dvert || dm)) { MDeformVert *dvert = me->dvert; for (a = 0; a < numVerts; a++, dvert++) { if (dm) dvert = dm->getVertData(dm, a, CD_MDEFORMVERT); - weight = defvert_find_weight(dvert, index); + weight = defvert_find_weight(dvert, defgrp_index); if (weight > 0.0f) calc_latt_deform(laOb, vertexCos[a], weight * fac); diff --git a/source/blender/blenkernel/intern/library.c b/source/blender/blenkernel/intern/library.c index f6e86bdbb5a..7a33d94b3dc 100644 --- a/source/blender/blenkernel/intern/library.c +++ b/source/blender/blenkernel/intern/library.c @@ -808,6 +808,18 @@ static void animdata_dtar_clear_cb(ID *UNUSED(id), AnimData *adt, void *userdata } } +void BKE_libblock_free_data(ID *id) +{ + Main *bmain = G.main; /* should eventually be an arg */ + + if (id->properties) { + IDP_FreeProperty(id->properties); + MEM_freeN(id->properties); + } + + /* this ID may be a driver target! */ + BKE_animdata_main_cb(bmain, animdata_dtar_clear_cb, (void *)id); +} /* used in headerbuttons.c image.c mesh.c screen.c sound.c and library.c */ void BKE_libblock_free(ListBase *lb, void *idv) @@ -919,15 +931,9 @@ void BKE_libblock_free(ListBase *lb, void *idv) break; } - if (id->properties) { - IDP_FreeProperty(id->properties); - MEM_freeN(id->properties); - } - BLI_remlink(lb, id); - /* this ID may be a driver target! */ - BKE_animdata_main_cb(bmain, animdata_dtar_clear_cb, (void *)id); + BKE_libblock_free_data(id); MEM_freeN(id); } @@ -1215,7 +1221,7 @@ static int check_for_dupid(ListBase *lb, ID *id, char *name) char left[MAX_ID_NAME + 8], leftest[MAX_ID_NAME + 8]; /* make sure input name is terminated properly */ - /* if ( strlen(name) > MAX_ID_NAME-3 ) name[MAX_ID_NAME-3]= 0; */ + /* if ( strlen(name) > MAX_ID_NAME-3 ) name[MAX_ID_NAME-3] = 0; */ /* removed since this is only ever called from one place - campbell */ while (1) { @@ -1562,7 +1568,7 @@ void rename_id(ID *id, const char *name) BLI_strncpy(id->name + 2, name, sizeof(id->name) - 2); lb = which_libbase(G.main, GS(id->name) ); - new_id(lb, id, name); + new_id(lb, id, name); } void name_uiprefix_id(char *name, ID *id) diff --git a/source/blender/blenkernel/intern/mask.c b/source/blender/blenkernel/intern/mask.c index aa19350c456..da0fb895ec2 100644 --- a/source/blender/blenkernel/intern/mask.c +++ b/source/blender/blenkernel/intern/mask.c @@ -1955,5 +1955,5 @@ void BKE_mask_layer_shape_changed_remove(MaskLayer *masklay, int index, int coun int BKE_mask_get_duration(Mask *mask) { - return maxi(1, mask->efra - mask->sfra); + return max_ii(1, mask->efra - mask->sfra); } diff --git a/source/blender/blenkernel/intern/mask_evaluate.c b/source/blender/blenkernel/intern/mask_evaluate.c index 4a8601df0b8..e67df9c6419 100644 --- a/source/blender/blenkernel/intern/mask_evaluate.c +++ b/source/blender/blenkernel/intern/mask_evaluate.c @@ -69,7 +69,7 @@ unsigned int BKE_mask_spline_resolution(MaskSpline *spline, int width, int heigh unsigned int i, resol = 1; if (width != 0 && height != 0) { - max_segment = 1.0f / (float)maxi(width, height); + max_segment = 1.0f / (float)max_ii(width, height); } for (i = 0; i < spline->tot_point; i++) { @@ -131,7 +131,7 @@ unsigned int BKE_mask_spline_feather_resolution(MaskSpline *spline, int width, i if (u_diff > FLT_EPSILON) { float jump = fabsf(w_diff / u_diff); - max_jump = MAX2(max_jump, jump); + max_jump = max_ff(max_jump, jump); } prev_u = point->uw[j].u; @@ -418,7 +418,7 @@ void BKE_mask_spline_feather_collapse_inner_loops(MaskSpline *spline, float (*fe max_delta = MAX2(max_delta_x, max_delta_y); - buckets_per_side = MIN2(512, 0.9f / max_delta); + buckets_per_side = min_ii(512, 0.9f / max_delta); if (buckets_per_side == 0) { /* happens when some segment fills the whole bounding box across some of dimension */ diff --git a/source/blender/blenkernel/intern/mask_rasterize.c b/source/blender/blenkernel/intern/mask_rasterize.c index 13ad9962aff..3561d5db9c0 100644 --- a/source/blender/blenkernel/intern/mask_rasterize.c +++ b/source/blender/blenkernel/intern/mask_rasterize.c @@ -428,7 +428,7 @@ static void layer_bucket_init(MaskRasterLayer *layer, const float pixel_size) /* width and height of each bucket */ const float bucket_size_x = (bucket_dim_x + FLT_EPSILON) / layer->buckets_x; const float bucket_size_y = (bucket_dim_y + FLT_EPSILON) / layer->buckets_y; - const float bucket_max_rad = (maxf(bucket_size_x, bucket_size_y) * M_SQRT2) + FLT_EPSILON; + const float bucket_max_rad = (max_ff(bucket_size_x, bucket_size_y) * M_SQRT2) + FLT_EPSILON; const float bucket_max_rad_squared = bucket_max_rad * bucket_max_rad; unsigned int *face = &layer->face_array[0][0]; @@ -451,10 +451,10 @@ static void layer_bucket_init(MaskRasterLayer *layer, const float pixel_size) const float *v2 = cos[face[1]]; const float *v3 = cos[face[2]]; - xmin = minf(v1[0], minf(v2[0], v3[0])); - xmax = maxf(v1[0], maxf(v2[0], v3[0])); - ymin = minf(v1[1], minf(v2[1], v3[1])); - ymax = maxf(v1[1], maxf(v2[1], v3[1])); + xmin = min_ff(v1[0], min_ff(v2[0], v3[0])); + xmax = max_ff(v1[0], max_ff(v2[0], v3[0])); + ymin = min_ff(v1[1], min_ff(v2[1], v3[1])); + ymax = max_ff(v1[1], max_ff(v2[1], v3[1])); } else { const float *v1 = cos[face[0]]; @@ -462,10 +462,10 @@ static void layer_bucket_init(MaskRasterLayer *layer, const float pixel_size) const float *v3 = cos[face[2]]; const float *v4 = cos[face[3]]; - xmin = minf(v1[0], minf(v2[0], minf(v3[0], v4[0]))); - xmax = maxf(v1[0], maxf(v2[0], maxf(v3[0], v4[0]))); - ymin = minf(v1[1], minf(v2[1], minf(v3[1], v4[1]))); - ymax = maxf(v1[1], maxf(v2[1], maxf(v3[1], v4[1]))); + xmin = min_ff(v1[0], min_ff(v2[0], min_ff(v3[0], v4[0]))); + xmax = max_ff(v1[0], max_ff(v2[0], max_ff(v3[0], v4[0]))); + ymin = min_ff(v1[1], min_ff(v2[1], min_ff(v3[1], v4[1]))); + ymax = max_ff(v1[1], max_ff(v2[1], max_ff(v3[1], v4[1]))); } @@ -503,7 +503,7 @@ static void layer_bucket_init(MaskRasterLayer *layer, const float pixel_size) BLI_assert(bucket_index < bucket_tot); /* check if the bucket intersects with the face */ - /* note: there is a tradeoff here since checking box/tri intersections isn't + /* note: there is a trade off here since checking box/tri intersections isn't * as optimal as it could be, but checking pixels against faces they will never intersect * with is likely the greater slowdown here - so check if the cell intersects the face */ if (layer_bucket_isect_test(layer, face_index, @@ -560,7 +560,7 @@ void BKE_maskrasterize_handle_init(MaskRasterHandle *mr_handle, struct Mask *mas const short do_feather) { const rctf default_bounds = {0.0f, 1.0f, 0.0f, 1.0f}; - const float pixel_size = 1.0f / MIN2(width, height); + const float pixel_size = 1.0f / (float)min_ii(width, height); const float asp_xy[2] = {(do_aspect_correct && width > height) ? (float)height / (float)width : 1.0f, (do_aspect_correct && width < height) ? (float)width / (float)height : 1.0f}; @@ -1335,10 +1335,10 @@ float BKE_maskrasterize_handle_sample(MaskRasterHandle *mr_handle, const float x value -= value_layer; break; case MASK_BLEND_LIGHTEN: - value = maxf(value, value_layer); + value = max_ff(value, value_layer); break; case MASK_BLEND_DARKEN: - value = minf(value, value_layer); + value = min_ff(value, value_layer); break; case MASK_BLEND_MUL: value *= value_layer; diff --git a/source/blender/blenkernel/intern/material.c b/source/blender/blenkernel/intern/material.c index ad28e3a6d79..445ea2d4b3b 100644 --- a/source/blender/blenkernel/intern/material.c +++ b/source/blender/blenkernel/intern/material.c @@ -216,7 +216,7 @@ Material *BKE_material_add(const char *name) init_material(ma); - return ma; + return ma; } /* XXX keep synced with next function */ @@ -905,7 +905,7 @@ short find_material_index(Object *ob, Material *ma) break; if (a < *totcolp) return a + 1; - return 0; + return 0; } int object_add_material_slot(Object *ob) @@ -971,7 +971,7 @@ static void do_init_render_material(Material *ma, int r_mode, float *amb) ma->ambr = ma->amb * amb[0]; ma->ambg = ma->amb * amb[1]; ma->ambb = ma->amb * amb[2]; - } + } /* will become or-ed result of all node modes */ ma->mode_l = ma->mode; ma->mode_l &= ~MA_SHLESS; @@ -983,14 +983,16 @@ static void do_init_render_material(Material *ma, int r_mode, float *amb) if (ma->nodetree && ma->use_nodes) ntreeShaderGetTexcoMode(ma->nodetree, r_mode, &ma->texco, &ma->mode_l); - /* local group override */ - if((ma->shade_flag & MA_GROUP_LOCAL) && ma->id.lib && ma->group && ma->group->id.lib) { - Group *group; + /* local group override */ + if ((ma->shade_flag & MA_GROUP_LOCAL) && ma->id.lib && ma->group && ma->group->id.lib) { + Group *group; - for(group= G.main->group.first; group; group= group->id.next) - if(!group->id.lib && strcmp(group->id.name, ma->group->id.name) == 0) - ma->group = group; - } + for (group = G.main->group.first; group; group = group->id.next) { + if (!group->id.lib && strcmp(group->id.name, ma->group->id.name) == 0) { + ma->group = group; + } + } + } } static void init_render_nodetree(bNodeTree *ntree, Material *basemat, int r_mode, float *amb) @@ -1158,7 +1160,7 @@ void material_drivers_update(Scene *scene, Material *ma, float ctime) /* ****************** */ #if 0 /* UNUSED */ -static char colname_array[125][20]= { +static char colname_array[125][20] = { "Black", "DarkRed", "HalfRed", "Red", "Red", "DarkGreen", "DarkOlive", "Brown", "Chocolate", "OrangeRed", "HalfGreen", "GreenOlive", "DryOlive", "Goldenrod", "DarkOrange", @@ -1614,7 +1616,7 @@ static int encode_tfaceflag(MTFace *tf, int convertall) /* calculate the flag */ int flag = tf->mode; - /* options that change the material offline render */ + /* options that change the material offline render */ if (!convertall) { flag &= ~TF_OBCOL; } @@ -1638,7 +1640,7 @@ static int encode_tfaceflag(MTFace *tf, int convertall) /* set the material options based in the tface flag */ static void decode_tfaceflag(Material *ma, int flag, int convertall) { - int alphablend; + int alphablend; GameSettings *game = &ma->game; /* flag is shifted in 1 to make 0 != no flag yet (see encode_tfaceflag) */ @@ -1797,13 +1799,13 @@ static short convert_tfacenomaterial(Main *main, Mesh *me, MTFace *tf, int flag) * for now store the flag into the material and change light/tex/collision * store the flag as a negative number */ ma->game.flag = -flag; - id_us_min((ID *)ma); + id_us_min((ID *)ma); } else printf("Error: Unable to create Material \"%s\" for Mesh \"%s\".", idname + 2, me->id.name + 2); } /* set as converted, no need to go bad to this face */ - tf->mode |= TF_CONVERTED; + tf->mode |= TF_CONVERTED; return mat_nr; } @@ -1856,7 +1858,7 @@ static void convert_tfacematerial(Main *main, Material *ma) if (mat_new) { /* rename the material*/ strcpy(mat_new->id.name, idname); - id_us_min((ID *)mat_new); + id_us_min((ID *)mat_new); mat_nr = mesh_addmaterial(me, mat_new); decode_tfaceflag(mat_new, flag, 1); @@ -2044,7 +2046,7 @@ int do_version_tface(Main *main, int fileload) nowarning = 0; } else - convert_tfacematerial(main, ma); continue; + convert_tfacematerial(main, ma); continue; } /* no conflicts in this material - 90% of cases diff --git a/source/blender/blenkernel/intern/mesh.c b/source/blender/blenkernel/intern/mesh.c index c244317ccb7..26120b771bf 100644 --- a/source/blender/blenkernel/intern/mesh.c +++ b/source/blender/blenkernel/intern/mesh.c @@ -735,7 +735,7 @@ float *BKE_mesh_orco_verts_get(Object *ob) /* Get appropriate vertex coordinates */ vcos = MEM_callocN(sizeof(*vcos) * me->totvert, "orco mesh"); mvert = tme->mvert; - totvert = MIN2(tme->totvert, me->totvert); + totvert = min_ii(tme->totvert, me->totvert); for (a = 0; a < totvert; a++, mvert++) { copy_v3_v3(vcos[a], mvert->co); @@ -3175,6 +3175,32 @@ int BKE_mesh_center_bounds(Mesh *me, float cent[3]) return 0; } +int BKE_mesh_center_centroid(Mesh *me, float cent[3]) +{ + int i = me->totpoly; + MPoly *mpoly; + float poly_area; + float total_area = 0.0f; + float poly_cent[3]; + + zero_v3(cent); + + /* calculate a weighted average of polygon centroids */ + for (mpoly = me->mpoly; i--; mpoly++) { + BKE_mesh_calc_poly_center(mpoly, me->mloop + mpoly->loopstart, me->mvert, poly_cent); + poly_area = BKE_mesh_calc_poly_area(mpoly, me->mloop + mpoly->loopstart, me->mvert, NULL); + + madd_v3_v3fl(cent, poly_cent, poly_area); + total_area += poly_area; + } + /* otherwise we get NAN for 0 polys */ + if (me->totpoly) { + mul_v3_fl(cent, 1.0f / total_area); + } + + return (me->totpoly != 0); +} + void BKE_mesh_translate(Mesh *me, float offset[3], int do_keys) { int i = me->totvert; diff --git a/source/blender/blenkernel/intern/modifier.c b/source/blender/blenkernel/intern/modifier.c index 0afd048e7f2..9c7cbc42bdd 100644 --- a/source/blender/blenkernel/intern/modifier.c +++ b/source/blender/blenkernel/intern/modifier.c @@ -55,6 +55,8 @@ #include "BLI_linklist.h" #include "BLI_string.h" +#include "BLF_translation.h" + #include "BKE_cloth.h" #include "BKE_key.h" #include "BKE_multires.h" @@ -259,12 +261,13 @@ int modifier_nonGeometrical(ModifierData *md) return (mti->type == eModifierTypeType_NonGeometrical); } -void modifier_setError(ModifierData *md, const char *format, ...) +void modifier_setError(ModifierData *md, const char *_format, ...) { char buffer[512]; va_list ap; + const char *format = TIP_(_format); - va_start(ap, format); + va_start(ap, _format); vsnprintf(buffer, sizeof(buffer), format, ap); va_end(ap); buffer[sizeof(buffer) - 1] = '\0'; diff --git a/source/blender/blenkernel/intern/multires.c b/source/blender/blenkernel/intern/multires.c index 58348483c61..d34bb99ab98 100644 --- a/source/blender/blenkernel/intern/multires.c +++ b/source/blender/blenkernel/intern/multires.c @@ -1045,7 +1045,7 @@ static void multiresModifier_disp_run(DerivedMesh *dm, Mesh *me, DerivedMesh *dm k = 0; /*current loop/mdisp index within the mloop array*/ - #pragma omp parallel for private(i) if (totloop*gridSize*gridSize >= CCG_OMP_LIMIT) + #pragma omp parallel for private(i) if (totloop * gridSize * gridSize >= CCG_OMP_LIMIT) for (i = 0; i < totpoly; ++i) { const int numVerts = mpoly[i].totloop; @@ -1325,7 +1325,7 @@ void multires_set_space(DerivedMesh *dm, Object *ob, int from, int to) k = 0; /*current loop/mdisp index within the mloop array*/ - //#pragma omp parallel for private(i) if (dm->numLoopData*gridSize*gridSize >= CCG_OMP_LIMIT) + //#pragma omp parallel for private(i) if (dm->numLoopData * gridSize * gridSize >= CCG_OMP_LIMIT) for (i = 0; i < dm->numPolyData; ++i) { const int numVerts = mpoly[i].totloop; @@ -1630,7 +1630,7 @@ void multires_free(Multires *mr) } while (lvl) { - multires_free_level(lvl); + multires_free_level(lvl); lvl = lvl->next; } @@ -2200,7 +2200,7 @@ static void multires_apply_smat(Scene *scene, Object *ob, float smat[3][3]) dGridSize = multires_side_tot[high_mmd.totlvl]; dSkip = (dGridSize - 1) / (gridSize - 1); - #pragma omp parallel for private(i) if (me->totface*gridSize*gridSize*4 >= CCG_OMP_LIMIT) + #pragma omp parallel for private(i) if (me->totface * gridSize * gridSize * 4 >= CCG_OMP_LIMIT) for (i = 0; i < me->totpoly; ++i) { const int numVerts = mpoly[i].totloop; MDisps *mdisp = &mdisps[mpoly[i].loopstart]; diff --git a/source/blender/blenkernel/intern/nla.c b/source/blender/blenkernel/intern/nla.c index 9590160c8f3..6f585198524 100644 --- a/source/blender/blenkernel/intern/nla.c +++ b/source/blender/blenkernel/intern/nla.c @@ -423,7 +423,7 @@ static float nlastrip_get_frame_actionclip(NlaStrip *strip, float cframe, short return strip->actstart; } else { - /* - the 'fmod(..., actlength*scale)' is needed to get the repeats working + /* - the 'fmod(..., actlength * scale)' is needed to get the repeats working * - the '/ scale' is needed to ensure that scaling influences the timing within the repeat */ return strip->actend - fmodf(cframe - strip->start, actlength * scale) / scale; @@ -446,7 +446,7 @@ static float nlastrip_get_frame_actionclip(NlaStrip *strip, float cframe, short return strip->actend; } else { - /* - the 'fmod(..., actlength*scale)' is needed to get the repeats working + /* - the 'fmod(..., actlength * scale)' is needed to get the repeats working * - the '/ scale' is needed to ensure that scaling influences the timing within the repeat */ return strip->actstart + fmodf(cframe - strip->start, actlength * scale) / scale; @@ -496,7 +496,7 @@ float nlastrip_get_frame(NlaStrip *strip, float cframe, short mode) case NLASTRIP_TYPE_CLIP: /* action-clip (default) */ default: return nlastrip_get_frame_actionclip(strip, cframe, mode); - } + } } @@ -1162,7 +1162,7 @@ static short nlastrip_is_first(AnimData *adt, NlaStrip *strip) if (ns->start < strip->start) return 0; } - } + } /* should be first now */ return 1; @@ -1491,7 +1491,7 @@ void BKE_nla_action_pushdown(AnimData *adt) /* add a new NLA strip to the track, which references the active action */ strip = add_nlastrip_to_stack(adt, adt->action); - /* do other necessary work on strip */ + /* do other necessary work on strip */ if (strip) { /* clear reference to action now that we've pushed it onto the stack */ id_us_min(&adt->action->id); @@ -1545,7 +1545,7 @@ short BKE_nla_tweakmode_enter(AnimData *adt) /* now try to find active strip */ activeStrip = BKE_nlastrip_find_active(nlt); break; - } + } } /* There are situations where we may have multiple strips selected and we want to enter tweakmode on all @@ -1563,7 +1563,7 @@ short BKE_nla_tweakmode_enter(AnimData *adt) activeStrip = BKE_nlastrip_find_active(nlt); break; } - } + } } if ((activeTrack) && (activeStrip == NULL)) { /* no active strip in active or last selected track; compromise for first selected (assuming only single)... */ diff --git a/source/blender/blenkernel/intern/node.c b/source/blender/blenkernel/intern/node.c index 0ff6b7abbca..3112e8dc13d 100644 --- a/source/blender/blenkernel/intern/node.c +++ b/source/blender/blenkernel/intern/node.c @@ -147,6 +147,7 @@ static bNodeSocket *make_socket(bNodeTree *UNUSED(ntree), int in_out, const char sock->limit = (in_out == SOCK_IN ? 1 : 0xFFF); sock->type = type; sock->storage = NULL; + sock->flag |= SOCK_COLLAPSED; sock->default_value = node_socket_make_default_value(type); node_socket_init_default_value(type, sock->default_value); @@ -346,6 +347,7 @@ bNode *nodeCopyNode(struct bNodeTree *ntree, struct bNode *node) { bNode *nnode = MEM_callocN(sizeof(bNode), "dupli node"); bNodeSocket *sock, *oldsock; + bNodeLink *link, *oldlink; *nnode = *node; /* can be called for nodes outside a node tree (e.g. clipboard) */ @@ -385,6 +387,15 @@ bNode *nodeCopyNode(struct bNodeTree *ntree, struct bNode *node) sock->cache = NULL; } + BLI_duplicatelist(&nnode->internal_links, &node->internal_links); + oldlink = node->internal_links.first; + for (link = nnode->internal_links.first; link; link = link->next, oldlink = oldlink->next) { + link->fromnode = nnode; + link->tonode = nnode; + link->fromsock = link->fromsock->new_sock; + link->tosock = link->tosock->new_sock; + } + /* don't increase node->id users, freenode doesn't decrement either */ if (node->typeinfo->copystoragefunc) @@ -392,7 +403,13 @@ bNode *nodeCopyNode(struct bNodeTree *ntree, struct bNode *node) node->new_node = nnode; nnode->new_node = NULL; - nnode->preview = NULL; + + /* only shader nodes get pleasant preview updating this way, compo uses own system */ + if (node->preview && ntree->type == NTREE_SHADER) { + nnode->preview = MEM_dupallocN(node->preview); + if (node->preview->rect) + nnode->preview->rect = MEM_dupallocN(node->preview->rect); + } if (ntree) ntree->update |= NTREE_UPDATE_NODES; @@ -523,15 +540,12 @@ void nodeRemSocketLinks(bNodeTree *ntree, bNodeSocket *sock) void nodeInternalRelink(bNodeTree *ntree, bNode *node) { bNodeLink *link, *link_next; - ListBase intlinks; - if (!node->typeinfo->internal_connect) + if (node->internal_links.first == NULL) return; - intlinks = node->typeinfo->internal_connect(ntree, node); - /* store link pointers in output sockets, for efficient lookup */ - for (link = intlinks.first; link; link = link->next) + for (link = node->internal_links.first; link; link = link->next) link->tosock->link = link; /* redirect downstream links */ @@ -565,8 +579,6 @@ void nodeInternalRelink(bNodeTree *ntree, bNode *node) if (link->tonode == node) nodeRemLink(ntree, link); } - - BLI_freelistN(&intlinks); } void nodeToView(bNode *node, float x, float y, float *rx, float *ry) @@ -713,7 +725,7 @@ static bNodeTree *ntreeCopyTree_internal(bNodeTree *ntree, const short do_id_use } node->new_node = NULL; - /* nnode= */ nodeCopyNode(newtree, node); /* sets node->new */ + /* nnode = */ nodeCopyNode(newtree, node); /* sets node->new */ /* make sure we don't copy new nodes again! */ if (node == last) @@ -818,7 +830,7 @@ void nodeFreePreview(bNode *node) MEM_freeN(node->preview->rect); MEM_freeN(node->preview); node->preview = NULL; - } + } } static void node_init_preview(bNode *node, int xsize, int ysize) @@ -861,7 +873,7 @@ void ntreeInitPreview(bNodeTree *ntree, int xsize, int ysize) node_init_preview(node, xsize, ysize); if (node->type == NODE_GROUP && (node->flag & NODE_GROUP_EDIT)) ntreeInitPreview((bNodeTree *)node->id, xsize, ysize); - } + } } static void nodeClearPreview(bNode *node) @@ -883,7 +895,7 @@ void ntreeClearPreview(bNodeTree *ntree) nodeClearPreview(node); if (node->type == NODE_GROUP && (node->flag & NODE_GROUP_EDIT)) ntreeClearPreview((bNodeTree *)node->id); - } + } } /* hack warning! this function is only used for shader previews, and @@ -988,6 +1000,8 @@ void nodeFreeNode(bNodeTree *ntree, bNode *node) MEM_freeN(sock); } + BLI_freelistN(&node->internal_links); + nodeFreePreview(node); MEM_freeN(node); @@ -999,6 +1013,7 @@ void nodeFreeNode(bNodeTree *ntree, bNode *node) /* do not free ntree itself here, BKE_libblock_free calls this function too */ void ntreeFreeTree_ex(bNodeTree *ntree, const short do_id_user) { + bNodeTree *tntree; bNode *node, *next; bNodeSocket *sock; @@ -1055,6 +1070,14 @@ void ntreeFreeTree_ex(bNodeTree *ntree, const short do_id_user) for (sock = ntree->outputs.first; sock; sock = sock->next) node_socket_free_default_value(sock->type, sock->default_value); BLI_freelistN(&ntree->outputs); + + /* if ntree is not part of library, free the libblock data explicitly */ + for (tntree = G.main->nodetree.first; tntree; tntree = tntree->id.next) + if (tntree == ntree) + break; + if (tntree == NULL) { + BKE_libblock_free_data(&ntree->id); + } } /* same as ntreeFreeTree_ex but always manage users */ void ntreeFreeTree(bNodeTree *ntree) @@ -1816,6 +1839,8 @@ void ntreeUpdateTree(bNodeTree *ntree) ntreetype->update_node(ntree, node); else if (node->typeinfo->updatefunc) node->typeinfo->updatefunc(ntree, node); + + nodeUpdateInternalLinks(ntree, node); } } @@ -1853,6 +1878,9 @@ void nodeUpdate(bNodeTree *ntree, bNode *node) ntreetype->update_node(ntree, node); else if (node->typeinfo->updatefunc) node->typeinfo->updatefunc(ntree, node); + + nodeUpdateInternalLinks(ntree, node); + /* clear update flag */ node->update = 0; } @@ -1892,9 +1920,21 @@ int nodeUpdateID(bNodeTree *ntree, ID *id) } } + for (node = ntree->nodes.first; node; node = node->next) { + nodeUpdateInternalLinks(ntree, node); + } + return change; } +void nodeUpdateInternalLinks(bNodeTree *ntree, bNode *node) +{ + BLI_freelistN(&node->internal_links); + + if (node->typeinfo && node->typeinfo->update_internal_links) + node->typeinfo->update_internal_links(ntree, node); +} + /* ************* node type access ********** */ @@ -1967,7 +2007,7 @@ void node_type_base(bNodeTreeType *ttype, bNodeType *ntype, int type, const char /* Default muting stuff. */ if (ttype) - ntype->internal_connect = ttype->internal_connect; + ntype->update_internal_links = ttype->update_internal_links; /* default size values */ ntype->width = 140; @@ -2063,9 +2103,9 @@ void node_type_exec_new(struct bNodeType *ntype, ntype->newexecfunc = newexecfunc; } -void node_type_internal_connect(bNodeType *ntype, ListBase (*internal_connect)(bNodeTree *, bNode *)) +void node_type_internal_links(bNodeType *ntype, void (*update_internal_links)(bNodeTree *, bNode *)) { - ntype->internal_connect = internal_connect; + ntype->update_internal_links = update_internal_links; } void node_type_gpu(struct bNodeType *ntype, int (*gpufunc)(struct GPUMaterial *mat, struct bNode *node, struct GPUNodeStack *in, struct GPUNodeStack *out)) @@ -2198,6 +2238,7 @@ static void registerCompositNodes(bNodeTreeType *ttype) register_node_type_cmp_bokehimage(ttype); register_node_type_cmp_bokehblur(ttype); register_node_type_cmp_switch(ttype); + register_node_type_cmp_pixelate(ttype); register_node_type_cmp_mask(ttype); register_node_type_cmp_trackpos(ttype); diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c index ff778a4b71b..549d4e2d126 100644 --- a/source/blender/blenkernel/intern/object.c +++ b/source/blender/blenkernel/intern/object.c @@ -302,11 +302,11 @@ void BKE_object_free(Object *ob) BKE_object_free_display(ob); - /* disconnect specific data */ + /* disconnect specific data, but not for lib data (might be indirect data, can get relinked) */ if (ob->data) { ID *id = ob->data; id->us--; - if (id->us == 0) { + if (id->us == 0 && id->lib==NULL) { switch (ob->type) { case OB_MESH: BKE_mesh_unlink((Mesh *)id); @@ -456,7 +456,7 @@ void BKE_object_unlink(Object *ob) if (pchan->custom == ob) pchan->custom = NULL; } - } + } else if (ELEM(OB_MBALL, ob->type, obt->type)) { if (BKE_mball_is_basis_for(obt, ob)) obt->recalc |= OB_RECALC_DATA; @@ -2581,9 +2581,7 @@ void BKE_object_handle_update(Scene *scene, Object *ob) if (ob->recalc & OB_RECALC_DATA) { ID *data_id = (ID *)ob->data; AnimData *adt = BKE_animdata_from_id(data_id); - float ctime = (float)scene->r.cfra; // XXX this is bad... - ListBase pidlist; - PTCacheID *pid; + float ctime = (float)scene->r.cfra; /* XXX this is bad... */ if (G.debug & G_DEBUG) printf("recalcdata %s\n", ob->id.name + 2); @@ -2706,26 +2704,8 @@ void BKE_object_handle_update(Scene *scene, Object *ob) psys_get_modifier(ob, psys)->flag &= ~eParticleSystemFlag_psys_updated; } } - - /* check if quick cache is needed */ - BKE_ptcache_ids_from_object(&pidlist, ob, scene, MAX_DUPLI_RECUR); - - for (pid = pidlist.first; pid; pid = pid->next) { - if ((pid->cache->flag & PTCACHE_BAKED) || - (pid->cache->flag & PTCACHE_QUICK_CACHE) == 0) - { - continue; - } - - if (pid->cache->flag & PTCACHE_OUTDATED || (pid->cache->flag & PTCACHE_SIMULATION_VALID) == 0) { - scene->physics_settings.quick_cache_step = - scene->physics_settings.quick_cache_step ? - mini(scene->physics_settings.quick_cache_step, pid->cache->step) : - pid->cache->step; - } - } - - BLI_freelistN(&pidlist); + + /* quick cache removed */ } /* the no-group proxy case, we call update */ diff --git a/source/blender/blenkernel/intern/ocean.c b/source/blender/blenkernel/intern/ocean.c index 4f3921936e8..7bc736d394e 100644 --- a/source/blender/blenkernel/intern/ocean.c +++ b/source/blender/blenkernel/intern/ocean.c @@ -475,7 +475,7 @@ void BKE_ocean_eval_ij(struct Ocean *oc, struct OceanResult *ocr, int i, int j) if (oc->_do_normals) { ocr->normal[0] = oc->_N_x[i * oc->_N + j]; - ocr->normal[1] = oc->_N_y /*oc->_N_y[i*oc->_N+j] (MEM01)*/; + ocr->normal[1] = oc->_N_y /* oc->_N_y[i * oc->_N + j] (MEM01) */; ocr->normal[2] = oc->_N_z[i * oc->_N + j]; normalize_v3(ocr->normal); diff --git a/source/blender/blenkernel/intern/packedFile.c b/source/blender/blenkernel/intern/packedFile.c index f16748bf20a..dec49f417ae 100644 --- a/source/blender/blenkernel/intern/packedFile.c +++ b/source/blender/blenkernel/intern/packedFile.c @@ -201,7 +201,7 @@ PackedFile *newPackedFile(ReportList *reports, const char *filename, const char file = BLI_open(name, O_BINARY | O_RDONLY, 0); if (file <= 0) { - BKE_reportf(reports, RPT_ERROR, "Unable to pack file, source path not found: \"%s\"", name); + BKE_reportf(reports, RPT_ERROR, "Unable to pack file, source path '%s' not found", name); } else { filelen = BLI_file_descriptor_size(file); @@ -311,20 +311,20 @@ int writePackedFile(ReportList *reports, const char *filename, PackedFile *pf, i file = BLI_open(name, O_BINARY + O_WRONLY + O_CREAT + O_TRUNC, 0666); if (file >= 0) { if (write(file, pf->data, pf->size) != pf->size) { - BKE_reportf(reports, RPT_ERROR, "Error writing file: %s", name); + BKE_reportf(reports, RPT_ERROR, "Error writing file '%s'", name); ret_value = RET_ERROR; } close(file); } else { - BKE_reportf(reports, RPT_ERROR, "Error creating file: %s", name); + BKE_reportf(reports, RPT_ERROR, "Error creating file '%s'", name); ret_value = RET_ERROR; } if (remove_tmp) { if (ret_value == RET_ERROR) { if (BLI_rename(tempname, name) != 0) { - BKE_reportf(reports, RPT_ERROR, "Error restoring temp file. Check files: '%s' '%s'", tempname, name); + BKE_reportf(reports, RPT_ERROR, "Error restoring temp file (check files '%s' '%s')", tempname, name); } } else { diff --git a/source/blender/blenkernel/intern/particle.c b/source/blender/blenkernel/intern/particle.c index 60d3b7a8846..9e37cc95b8c 100644 --- a/source/blender/blenkernel/intern/particle.c +++ b/source/blender/blenkernel/intern/particle.c @@ -336,7 +336,7 @@ void psys_check_group_weights(ParticleSettings *part) BLI_addtail(&part->dupliweights, dw); } - go = go->next; + go = go->next; } dw = part->dupliweights.first; @@ -561,7 +561,7 @@ void psys_free(Object *ob, ParticleSystem *psys) ob->transflag &= ~OB_DUPLIPARTS; if (psys->part) { - psys->part->id.us--; + psys->part->id.us--; psys->part = NULL; } @@ -899,7 +899,7 @@ int psys_render_simplify_distribution(ParticleThreadContext *ctx, int tot) elem->scalemax = sqrt(elem->scalemax); /* clamp scaling */ - scaleclamp = MIN2(elem->totchild, 10.0f); + scaleclamp = (float)min_ii(elem->totchild, 10); elem->scalemin = MIN2(scaleclamp, elem->scalemin); elem->scalemax = MIN2(scaleclamp, elem->scalemax); @@ -2464,7 +2464,7 @@ static int psys_threads_init_path(ParticleThread *threads, Scene *scene, float c totthread = 1; for (i = 0; i < totthread; i++) { - threads[i].rng_path = rng_new(seed); + threads[i].rng_path = BLI_rng_new(seed); threads[i].tot = totthread; } diff --git a/source/blender/blenkernel/intern/particle_system.c b/source/blender/blenkernel/intern/particle_system.c index 154c8cca75d..19ef83d53cf 100644 --- a/source/blender/blenkernel/intern/particle_system.c +++ b/source/blender/blenkernel/intern/particle_system.c @@ -369,10 +369,10 @@ void psys_calc_dmcache(Object *ob, DerivedMesh *dm, ParticleSystem *psys) if (nodearray[*origindex]) { /* prepend */ node->next = nodearray[*origindex]; - nodearray[*origindex]= node; + nodearray[*origindex] = node; } else - nodearray[*origindex]= node; + nodearray[*origindex] = node; } } @@ -556,8 +556,7 @@ static void distribute_grid(DerivedMesh *dm, ParticleSystem *psys) else /* store number of intersections */ (pa+(int)(lambda*size[a])*a0mul)->hair_index++; } - - if (mface->v4) { + else if (mface->v4) { copy_v3_v3(v4, mvert[mface->v4].co); if (isect_axial_line_tri_v3(a, co1, co2, v4, v1, v3, &lambda)) { @@ -632,10 +631,10 @@ static void hammersley_create(float *out, int n, int seed, float amount) double p, t, offs[2]; int k, kk; - rng = rng_new(31415926 + n + seed); - offs[0]= rng_getDouble(rng) + (double)amount; - offs[1]= rng_getDouble(rng) + (double)amount; - rng_free(rng); + rng = BLI_rng_new(31415926 + n + seed); + offs[0] = BLI_rng_get_double(rng) + (double)amount; + offs[1] = BLI_rng_get_double(rng) + (double)amount; + BLI_rng_free(rng); for (k = 0; k < n; k++) { t = 0; @@ -643,8 +642,8 @@ static void hammersley_create(float *out, int n, int seed, float amount) if (kk & 1) /* kk mod 2 = 1 */ t += p; - out[2*k + 0]= fmod((double)k/(double)n + offs[0], 1.0); - out[2*k + 1]= fmod(t + offs[1], 1.0); + out[2*k + 0] = fmod((double)k/(double)n + offs[0], 1.0); + out[2*k + 1] = fmod(t + offs[1], 1.0); } } @@ -661,13 +660,13 @@ static void init_mv_jit(float *jit, int num, int seed2, float amount) rad2= (float)(1.0f/((float)num)); rad3= (float)sqrt((float)num)/((float)num); - rng = rng_new(31415926 + num + seed2); + rng = BLI_rng_new(31415926 + num + seed2); x= 0; num2 = 2 * num; for (i=0; i<num2; i+=2) { - jit[i]= x + amount*rad1*(0.5f - rng_getFloat(rng)); - jit[i+1]= i/(2.0f*num) + amount*rad1*(0.5f - rng_getFloat(rng)); + jit[i] = x + amount*rad1*(0.5f - BLI_rng_get_float(rng)); + jit[i+1] = i/(2.0f*num) + amount*rad1*(0.5f - BLI_rng_get_float(rng)); jit[i]-= (float)floor(jit[i]); jit[i+1]-= (float)floor(jit[i+1]); @@ -684,7 +683,7 @@ static void init_mv_jit(float *jit, int num, int seed2, float amount) BLI_jitterate2(jit, jit2, num, rad2); } MEM_freeN(jit2); - rng_free(rng); + BLI_rng_free(rng); } static void psys_uv_to_w(float u, float v, int quad, float *w) @@ -698,21 +697,21 @@ static void psys_uv_to_w(float u, float v, int quad, float *w) u= 1.0f-u; } - vert[0][0]= 0.0f; vert[0][1]= 0.0f; vert[0][2]= 0.0f; - vert[1][0]= 1.0f; vert[1][1]= 0.0f; vert[1][2]= 0.0f; - vert[2][0]= 1.0f; vert[2][1]= 1.0f; vert[2][2]= 0.0f; + vert[0][0] = 0.0f; vert[0][1] = 0.0f; vert[0][2] = 0.0f; + vert[1][0] = 1.0f; vert[1][1] = 0.0f; vert[1][2] = 0.0f; + vert[2][0] = 1.0f; vert[2][1] = 1.0f; vert[2][2] = 0.0f; - co[0]= u; - co[1]= v; - co[2]= 0.0f; + co[0] = u; + co[1] = v; + co[2] = 0.0f; if (quad) { - vert[3][0]= 0.0f; vert[3][1]= 1.0f; vert[3][2]= 0.0f; + vert[3][0] = 0.0f; vert[3][1] = 1.0f; vert[3][2] = 0.0f; interp_weights_poly_v3( w,vert, 4, co); } else { interp_weights_poly_v3( w,vert, 3, co); - w[3]= 0.0f; + w[3] = 0.0f; } } @@ -804,8 +803,8 @@ static void distribute_threads_exec(ParticleThread *thread, ParticleData *pa, Ch } break; case PART_DISTR_RAND: - randu= rng_getFloat(thread->rng); - randv= rng_getFloat(thread->rng); + randu= BLI_rng_get_float(thread->rng); + randv= BLI_rng_get_float(thread->rng); rng_skip_tot -= 2; psys_uv_to_w(randu, randv, mface->v4, pa->fuv); @@ -881,8 +880,8 @@ static void distribute_threads_exec(ParticleThread *thread, ParticleData *pa, Ch mf= dm->getTessFaceData(dm, ctx->index[p], CD_MFACE); - randu= rng_getFloat(thread->rng); - randv= rng_getFloat(thread->rng); + randu= BLI_rng_get_float(thread->rng); + randv= BLI_rng_get_float(thread->rng); rng_skip_tot -= 2; psys_uv_to_w(randu, randv, mf->v4, cpa->fuv); @@ -934,7 +933,7 @@ static void distribute_threads_exec(ParticleThread *thread, ParticleData *pa, Ch } if (rng_skip_tot > 0) /* should never be below zero */ - rng_skip(thread->rng, rng_skip_tot); + BLI_rng_skip(thread->rng, rng_skip_tot); } static void *distribute_threads_exec_cb(void *data) @@ -951,12 +950,12 @@ static void *distribute_threads_exec_cb(void *data) for (p=0; p<totpart; p++, cpa++) { if (thread->ctx->skip) /* simplification skip */ - rng_skip(thread->rng, PSYS_RND_DIST_SKIP * thread->ctx->skip[p]); + BLI_rng_skip(thread->rng, PSYS_RND_DIST_SKIP * thread->ctx->skip[p]); if ((p+thread->num) % thread->tot == 0) distribute_threads_exec(thread, NULL, cpa, p); else /* thread skip */ - rng_skip(thread->rng, PSYS_RND_DIST_SKIP); + BLI_rng_skip(thread->rng, PSYS_RND_DIST_SKIP); } } else { @@ -973,8 +972,8 @@ static void *distribute_threads_exec_cb(void *data) static int *COMPARE_ORIG_INDEX = NULL; static int distribute_compare_orig_index(const void *p1, const void *p2) { - int index1 = COMPARE_ORIG_INDEX[*(const int*)p1]; - int index2 = COMPARE_ORIG_INDEX[*(const int*)p2]; + int index1 = COMPARE_ORIG_INDEX[*(const int *)p1]; + int index2 = COMPARE_ORIG_INDEX[*(const int *)p2]; if (index1 < index2) return -1; @@ -1000,7 +999,7 @@ static void distribute_invalid(Scene *scene, ParticleSystem *psys, int from) if (psys->child && totchild) { for (p=0,cpa=psys->child; p<totchild; p++,cpa++) { - cpa->fuv[0]=cpa->fuv[1]=cpa->fuv[2]=cpa->fuv[3]= 0.0; + cpa->fuv[0]=cpa->fuv[1]=cpa->fuv[2]=cpa->fuv[3] = 0.0; cpa->foffset= 0.0f; cpa->parent=0; cpa->pa[0]=cpa->pa[1]=cpa->pa[2]=cpa->pa[3]=0; @@ -1011,7 +1010,7 @@ static void distribute_invalid(Scene *scene, ParticleSystem *psys, int from) else { PARTICLE_P; LOOP_PARTICLES { - pa->fuv[0]=pa->fuv[1]=pa->fuv[2]= pa->fuv[3]= 0.0; + pa->fuv[0] = pa->fuv[1] = pa->fuv[2] = pa->fuv[3] = 0.0; pa->foffset= 0.0f; pa->num= -1; } @@ -1113,7 +1112,7 @@ static int distribute_threads_init_data(ParticleThread *threads, Scene *scene, D if (from == PART_FROM_VERT) { MVert *mv= dm->getVertDataArray(dm, CD_MVERT); - float (*orcodata)[3]= dm->getVertDataArray(dm, CD_ORCO); + float (*orcodata)[3] = dm->getVertDataArray(dm, CD_ORCO); int totvert = dm->getNumVerts(dm); tree=BLI_kdtree_new(totvert); @@ -1245,9 +1244,9 @@ static int distribute_threads_init_data(ParticleThread *threads, Scene *scene, D inv_totweight = (totweight > 0.f ? 1.f/totweight : 0.f); /* Calculate cumulative weights */ - element_sum[0]= 0.0f; + element_sum[0] = 0.0f; for (i=0; i<totelem; i++) - element_sum[i+1]= element_sum[i] + element_weight[i] * inv_totweight; + element_sum[i+1] = element_sum[i] + element_weight[i] * inv_totweight; /* Finally assign elements to particles */ if ((part->flag&PART_TRAND) || (part->simplify_flag&PART_SIMPLIFY_ENABLE)) { @@ -1256,9 +1255,9 @@ static int distribute_threads_init_data(ParticleThread *threads, Scene *scene, D for (p=0; p<totpart; p++) { /* In theory element_sum[totelem] should be 1.0, but due to float errors this is not necessarily always true, so scale pos accordingly. */ pos= BLI_frand() * element_sum[totelem]; - particle_element[p]= distribute_binary_search(element_sum, totelem, pos); - particle_element[p]= MIN2(totelem-1, particle_element[p]); - jitter_offset[particle_element[p]]= pos; + particle_element[p] = distribute_binary_search(element_sum, totelem, pos); + particle_element[p] = MIN2(totelem-1, particle_element[p]); + jitter_offset[particle_element[p]] = pos; } } else { @@ -1272,13 +1271,13 @@ static int distribute_threads_init_data(ParticleThread *threads, Scene *scene, D while ((i < totelem) && (pos > element_sum[i+1])) i++; - particle_element[p]= MIN2(totelem-1, i); + particle_element[p] = MIN2(totelem-1, i); /* avoid zero weight face */ if (p == totpart-1 && element_weight[particle_element[p]] == 0.0f) - particle_element[p]= particle_element[p-1]; + particle_element[p] = particle_element[p-1]; - jitter_offset[particle_element[p]]= pos; + jitter_offset[particle_element[p]] = pos; } } @@ -1353,7 +1352,7 @@ static int distribute_threads_init_data(ParticleThread *threads, Scene *scene, D seed= 31415926 + ctx->sim.psys->seed; for (i=0; i<totthread; i++) { - threads[i].rng= rng_new(seed); + threads[i].rng= BLI_rng_new(seed); threads[i].tot= totthread; } @@ -1492,9 +1491,9 @@ void psys_threads_free(ParticleThread *threads) /* threads */ for (i=0; i<totthread; i++) { if (threads[i].rng) - rng_free(threads[i].rng); + BLI_rng_free(threads[i].rng); if (threads[i].rng_path) - rng_free(threads[i].rng_path); + BLI_rng_free(threads[i].rng_path); } MEM_freeN(ctx); @@ -1583,7 +1582,7 @@ static void get_angular_velocity_vector(short avemode, ParticleKey *state, float switch (avemode) { case PART_AVE_VELOCITY: copy_v3_v3(vec, state->vel); - break; + break; case PART_AVE_HORIZONTAL: { float zvec[3]; @@ -1622,9 +1621,9 @@ void psys_get_birth_coordinates(ParticleSimulationData *sim, ParticleData *pa, P ParticleSystem *psys = sim->psys; ParticleSettings *part; ParticleTexture ptex; - float fac, phasefac, nor[3]={0,0,0},loc[3],vel[3]={0.0,0.0,0.0},rot[4],q2[4]; - float r_vel[3],r_ave[3],r_rot[4],vec[3],p_vel[3]={0.0,0.0,0.0}; - float x_vec[3]={1.0,0.0,0.0}, utan[3]={0.0,1.0,0.0}, vtan[3]={0.0,0.0,1.0}, rot_vec[3]={0.0,0.0,0.0}; + float fac, phasefac, nor[3] = {0,0,0},loc[3],vel[3] = {0.0,0.0,0.0},rot[4],q2[4]; + float r_vel[3],r_ave[3],r_rot[4],vec[3],p_vel[3] = {0.0,0.0,0.0}; + float x_vec[3] = {1.0,0.0,0.0}, utan[3] = {0.0,1.0,0.0}, vtan[3] = {0.0,0.0,1.0}, rot_vec[3] = {0.0,0.0,0.0}; float q_phase[4]; int p = pa - psys->particles; part=psys->part; @@ -2537,7 +2536,7 @@ static void sph_force_cb(void *sphdata_v, ParticleKey *state, float *force, floa madd_v3_v3fl(force, vec, -(pressure + near_pressure*q)*q); /* Viscosity */ - if (visc > 0.f || stiff_visc > 0.f) { + if (visc > 0.f || stiff_visc > 0.f) { sub_v3_v3v3(dv, vel, state->vel); u = dot_v3v3(vec, dv); @@ -2736,7 +2735,7 @@ static void basic_integrate(ParticleSimulationData *sim, int p, float dfra, floa } static void basic_rotate(ParticleSettings *part, ParticleData *pa, float dfra, float timestep) { - float rotfac, rot1[4], rot2[4]={1.0,0.0,0.0,0.0}, dtime=dfra*timestep, extrotfac; + float rotfac, rot1[4], rot2[4] = {1.0,0.0,0.0,0.0}, dtime=dfra*timestep, extrotfac; if ((part->flag & PART_ROTATIONS) == 0) { unit_qt(pa->state.rot); @@ -3166,8 +3165,7 @@ void BKE_psys_collision_neartest_cb(void *userdata, int index, const BVHTreeRay if (col->hit == col->current && col->pce.index == index && col->pce.tot == 3) return; - do - { + do { collision = collision_sphere_to_tri(col, ray->radius, &pce, &t); if (col->pce.inside == 0) { collision += collision_sphere_to_edges(col, ray->radius, &pce, &t); @@ -4076,7 +4074,7 @@ static void particles_fluid_step(ParticleSimulationData *sim, int UNUSED(cfra)) { FluidsimModifierData *fluidmd = (FluidsimModifierData *)modifiers_findByType(sim->ob, eModifierType_Fluidsim); - if ( fluidmd && fluidmd->fss) { + if ( fluidmd && fluidmd->fss) { FluidsimSettings *fss= fluidmd->fss; ParticleSettings *part = psys->part; ParticleData *pa=NULL; @@ -4121,7 +4119,7 @@ static void particles_fluid_step(ParticleSimulationData *sim, int UNUSED(cfra)) int ptype=0; gzread(gzf, &ptype, sizeof( ptype )); - if (ptype&readMask) { + if (ptype & readMask) { activeParts++; gzread(gzf, &(pa->size), sizeof(float)); diff --git a/source/blender/blenkernel/intern/pointcache.c b/source/blender/blenkernel/intern/pointcache.c index 84301972ddf..cec676162f3 100644 --- a/source/blender/blenkernel/intern/pointcache.c +++ b/source/blender/blenkernel/intern/pointcache.c @@ -249,9 +249,9 @@ static int ptcache_particle_write(int index, void *psys_v, void **data, int cfr if (data[BPHYS_DATA_INDEX] && (cfra < pa->time - step || cfra > pa->dietime + step)) return 0; - times[0]= pa->time; - times[1]= pa->dietime; - times[2]= pa->lifetime; + times[0] = pa->time; + times[1] = pa->dietime; + times[2] = pa->lifetime; PTCACHE_DATA_FROM(data, BPHYS_DATA_INDEX, &index); PTCACHE_DATA_FROM(data, BPHYS_DATA_LOCATION, pa->state.co); @@ -691,7 +691,7 @@ static int ptcache_smoke_read(PTCacheFile *pf, void *smoke_v) sds->dx = ch_dx; VECCOPY(sds->res, ch_res); sds->total_cells = ch_res[0]*ch_res[1]*ch_res[2]; - if(sds->flags & MOD_SMOKE_HIGHRES) { + if (sds->flags & MOD_SMOKE_HIGHRES) { smoke_reallocate_highres_fluid(sds, ch_dx, ch_res, 1); } } @@ -705,25 +705,25 @@ static int ptcache_smoke_read(PTCacheFile *pf, void *smoke_v) smoke_export(sds->fluid, &dt, &dx, &dens, &react, &flame, &fuel, &heat, &heatold, &vx, &vy, &vz, &r, &g, &b, &obstacles); ptcache_file_compressed_read(pf, (unsigned char *)sds->shadow, out_len); - ptcache_file_compressed_read(pf, (unsigned char*)dens, out_len); + ptcache_file_compressed_read(pf, (unsigned char *)dens, out_len); if (cache_fields & SM_ACTIVE_HEAT) { - ptcache_file_compressed_read(pf, (unsigned char*)heat, out_len); - ptcache_file_compressed_read(pf, (unsigned char*)heatold, out_len); + ptcache_file_compressed_read(pf, (unsigned char *)heat, out_len); + ptcache_file_compressed_read(pf, (unsigned char *)heatold, out_len); } if (cache_fields & SM_ACTIVE_FIRE) { - ptcache_file_compressed_read(pf, (unsigned char*)flame, out_len); - ptcache_file_compressed_read(pf, (unsigned char*)fuel, out_len); - ptcache_file_compressed_read(pf, (unsigned char*)react, out_len); + ptcache_file_compressed_read(pf, (unsigned char *)flame, out_len); + ptcache_file_compressed_read(pf, (unsigned char *)fuel, out_len); + ptcache_file_compressed_read(pf, (unsigned char *)react, out_len); } if (cache_fields & SM_ACTIVE_COLORS) { - ptcache_file_compressed_read(pf, (unsigned char*)r, out_len); - ptcache_file_compressed_read(pf, (unsigned char*)g, out_len); - ptcache_file_compressed_read(pf, (unsigned char*)b, out_len); - } - ptcache_file_compressed_read(pf, (unsigned char*)vx, out_len); - ptcache_file_compressed_read(pf, (unsigned char*)vy, out_len); - ptcache_file_compressed_read(pf, (unsigned char*)vz, out_len); - ptcache_file_compressed_read(pf, (unsigned char*)obstacles, (unsigned int)res); + ptcache_file_compressed_read(pf, (unsigned char *)r, out_len); + ptcache_file_compressed_read(pf, (unsigned char *)g, out_len); + ptcache_file_compressed_read(pf, (unsigned char *)b, out_len); + } + ptcache_file_compressed_read(pf, (unsigned char *)vx, out_len); + ptcache_file_compressed_read(pf, (unsigned char *)vy, out_len); + ptcache_file_compressed_read(pf, (unsigned char *)vz, out_len); + ptcache_file_compressed_read(pf, (unsigned char *)obstacles, (unsigned int)res); ptcache_file_read(pf, &dt, 1, sizeof(float)); ptcache_file_read(pf, &dx, 1, sizeof(float)); ptcache_file_read(pf, &sds->p0, 3, sizeof(float)); @@ -751,20 +751,20 @@ static int ptcache_smoke_read(PTCacheFile *pf, void *smoke_v) smoke_turbulence_export(sds->wt, &dens, &react, &flame, &fuel, &r, &g, &b, &tcu, &tcv, &tcw); - ptcache_file_compressed_read(pf, (unsigned char*)dens, out_len_big); + ptcache_file_compressed_read(pf, (unsigned char *)dens, out_len_big); if (cache_fields & SM_ACTIVE_FIRE) { - ptcache_file_compressed_read(pf, (unsigned char*)flame, out_len_big); - ptcache_file_compressed_read(pf, (unsigned char*)fuel, out_len_big); + ptcache_file_compressed_read(pf, (unsigned char *)flame, out_len_big); + ptcache_file_compressed_read(pf, (unsigned char *)fuel, out_len_big); } if (cache_fields & SM_ACTIVE_COLORS) { - ptcache_file_compressed_read(pf, (unsigned char*)r, out_len_big); - ptcache_file_compressed_read(pf, (unsigned char*)g, out_len_big); - ptcache_file_compressed_read(pf, (unsigned char*)b, out_len_big); + ptcache_file_compressed_read(pf, (unsigned char *)r, out_len_big); + ptcache_file_compressed_read(pf, (unsigned char *)g, out_len_big); + ptcache_file_compressed_read(pf, (unsigned char *)b, out_len_big); } - ptcache_file_compressed_read(pf, (unsigned char*)tcu, out_len); - ptcache_file_compressed_read(pf, (unsigned char*)tcv, out_len); - ptcache_file_compressed_read(pf, (unsigned char*)tcw, out_len); + ptcache_file_compressed_read(pf, (unsigned char *)tcu, out_len); + ptcache_file_compressed_read(pf, (unsigned char *)tcv, out_len); + ptcache_file_compressed_read(pf, (unsigned char *)tcw, out_len); } return 1; @@ -859,7 +859,7 @@ static int ptcache_dynamicpaint_read(PTCacheFile *pf, void *dp_v) return 0; } - ptcache_file_compressed_read(pf, (unsigned char*)surface->data->type_data, data_len*surface->data->total_points); + ptcache_file_compressed_read(pf, (unsigned char *)surface->data->type_data, data_len*surface->data->total_points); } return 1; @@ -1363,7 +1363,7 @@ static int ptcache_file_compressed_write(PTCacheFile *pf, unsigned char *in, uns if (mode == 1) { LZO_HEAP_ALLOC(wrkmem, LZO1X_MEM_COMPRESS); - r = lzo1x_1_compress(in, (lzo_uint)in_len, out, (lzo_uint *)&out_len, wrkmem); + r = lzo1x_1_compress(in, (lzo_uint)in_len, out, (lzo_uint *)&out_len, wrkmem); if (!(r == LZO_E_OK) || (out_len >= in_len)) compressed = 0; else @@ -1699,7 +1699,7 @@ static PTCacheMem *ptcache_disk_frame_to_mem(PTCacheID *pid, int cfra) for (i=0; i<BPHYS_TOT_DATA; i++) { unsigned int out_len = pm->totpoint*ptcache_data_size[i]; if (pf->data_types & (1<<i)) - ptcache_file_compressed_read(pf, (unsigned char*)(pm->data[i]), out_len); + ptcache_file_compressed_read(pf, (unsigned char *)(pm->data[i]), out_len); } } else { @@ -1730,7 +1730,7 @@ static PTCacheMem *ptcache_disk_frame_to_mem(PTCacheID *pid, int cfra) extra->data = MEM_callocN(extra->totdata * ptcache_extra_datasize[extra->type], "Pointcache extradata->data"); if (pf->flag & PTCACHE_TYPEFLAG_COMPRESS) - ptcache_file_compressed_read(pf, (unsigned char*)(extra->data), extra->totdata*ptcache_extra_datasize[extra->type]); + ptcache_file_compressed_read(pf, (unsigned char *)(extra->data), extra->totdata*ptcache_extra_datasize[extra->type]); else ptcache_file_read(pf, extra->data, extra->totdata, ptcache_extra_datasize[extra->type]); @@ -1787,7 +1787,7 @@ static int ptcache_mem_frame_to_disk(PTCacheID *pid, PTCacheMem *pm) if (pm->data[i]) { unsigned int in_len = pm->totpoint*ptcache_data_size[i]; unsigned char *out = (unsigned char *)MEM_callocN(LZO_OUT_LEN(in_len)*4, "pointcache_lzo_buffer"); - ptcache_file_compressed_write(pf, (unsigned char*)(pm->data[i]), in_len, out, pid->cache->compression); + ptcache_file_compressed_write(pf, (unsigned char *)(pm->data[i]), in_len, out, pid->cache->compression); MEM_freeN(out); } } @@ -1820,7 +1820,7 @@ static int ptcache_mem_frame_to_disk(PTCacheID *pid, PTCacheMem *pm) if (pid->cache->compression) { unsigned int in_len = extra->totdata * ptcache_extra_datasize[extra->type]; unsigned char *out = (unsigned char *)MEM_callocN(LZO_OUT_LEN(in_len)*4, "pointcache_lzo_buffer"); - ptcache_file_compressed_write(pf, (unsigned char*)(extra->data), in_len, out, pid->cache->compression); + ptcache_file_compressed_write(pf, (unsigned char *)(extra->data), in_len, out, pid->cache->compression); MEM_freeN(out); } else { @@ -2031,18 +2031,16 @@ int BKE_ptcache_read(PTCacheID *pid, float cfra) pid->cache->simframe = cfra2; } - if ((pid->cache->flag & PTCACHE_QUICK_CACHE)==0) { - cfrai = (int)cfra; - /* clear invalid cache frames so that better stuff can be simulated */ - if (pid->cache->flag & PTCACHE_OUTDATED) { - BKE_ptcache_id_clear(pid, PTCACHE_CLEAR_AFTER, cfrai); - } - else if (pid->cache->flag & PTCACHE_FRAMES_SKIPPED) { - if (cfra <= pid->cache->last_exact) - pid->cache->flag &= ~PTCACHE_FRAMES_SKIPPED; + cfrai = (int)cfra; + /* clear invalid cache frames so that better stuff can be simulated */ + if (pid->cache->flag & PTCACHE_OUTDATED) { + BKE_ptcache_id_clear(pid, PTCACHE_CLEAR_AFTER, cfrai); + } + else if (pid->cache->flag & PTCACHE_FRAMES_SKIPPED) { + if (cfra <= pid->cache->last_exact) + pid->cache->flag &= ~PTCACHE_FRAMES_SKIPPED; - BKE_ptcache_id_clear(pid, PTCACHE_CLEAR_AFTER, MAX2(cfrai, pid->cache->last_exact)); - } + BKE_ptcache_id_clear(pid, PTCACHE_CLEAR_AFTER, MAX2(cfrai, pid->cache->last_exact)); } return ret; @@ -2273,7 +2271,7 @@ void BKE_ptcache_id_clear(PTCacheID *pid, int mode, unsigned int cfra) /* clear all files in the temp dir with the prefix of the ID and the ".bphys" suffix */ switch (mode) { case PTCACHE_CLEAR_ALL: - case PTCACHE_CLEAR_BEFORE: + case PTCACHE_CLEAR_BEFORE: case PTCACHE_CLEAR_AFTER: if (pid->cache->flag & PTCACHE_DISK_CACHE) { ptcache_path(pid, path); @@ -2377,7 +2375,7 @@ void BKE_ptcache_id_clear(PTCacheID *pid, int mode, unsigned int cfra) } } } - if (pid->cache->cached_frames && cfra>=sta && cfra<=end) + if (pid->cache->cached_frames && cfra >= sta && cfra <= end) pid->cache->cached_frames[cfra-sta] = 0; break; } @@ -2464,7 +2462,7 @@ void BKE_ptcache_id_time(PTCacheID *pid, Scene *scene, float cfra, int *startfra if (MEM_allocN_len(cache->cached_frames) != sizeof(char) * (cache->endframe-cache->startframe+1)) { MEM_freeN(cache->cached_frames); cache->cached_frames = NULL; - } + } } if (cache->cached_frames==NULL && cache->endframe > cache->startframe) { @@ -2537,8 +2535,6 @@ int BKE_ptcache_id_reset(Scene *scene, PTCacheID *pid, int mode) if (mode == PTCACHE_RESET_DEPSGRAPH) { if (!(cache->flag & PTCACHE_BAKED) && !BKE_ptcache_get_continue_physics()) { - if (cache->flag & PTCACHE_QUICK_CACHE) - clear= 1; after= 1; } @@ -2602,7 +2598,7 @@ int BKE_ptcache_object_reset(Scene *scene, Object *ob, int mode) } for (psys=ob->particlesystem.first; psys; psys=psys->next) { - /* children or just redo can be calculated without reseting anything */ + /* children or just redo can be calculated without resetting anything */ if (psys->recalc & PSYS_RECALC_REDO || psys->recalc & PSYS_RECALC_CHILD) skip = 1; /* Baked cloth hair has to be checked too, because we don't want to reset */ @@ -2826,6 +2822,8 @@ PointCache *BKE_ptcache_copy_list(ListBase *ptcaches_new, ListBase *ptcaches_old return ptcaches_new->first; } +/* Disabled this code; this is being called on scene_update_tagged, and that in turn gets called on + every user action changing stuff, and then it runs a complete bake??? (ton) */ /* Baking */ void BKE_ptcache_quick_cache_all(Main *bmain, Scene *scene) @@ -3009,7 +3007,7 @@ void BKE_ptcache_bake(PTCacheBaker* baker) } if ((cache->flag & PTCACHE_REDO_NEEDED || (cache->flag & PTCACHE_SIMULATION_VALID)==0) && - ((cache->flag & PTCACHE_QUICK_CACHE)==0 || render || bake)) + (render || bake)) { BKE_ptcache_id_clear(pid, PTCACHE_CLEAR_ALL, 0); } @@ -3378,7 +3376,7 @@ void BKE_ptcache_update_info(PTCacheID *pid) if (cache->flag & PTCACHE_EXTERNAL) { int cfra = cache->startframe; - for (; cfra<=cache->endframe; cfra++) { + for (; cfra <= cache->endframe; cfra++) { if (BKE_ptcache_id_exist(pid, cfra)) totframes++; } @@ -3405,7 +3403,7 @@ void BKE_ptcache_update_info(PTCacheID *pid) else { int cfra = cache->startframe; - for (; cfra<=cache->endframe; cfra++) { + for (; cfra <= cache->endframe; cfra++) { if (BKE_ptcache_id_exist(pid, cfra)) totframes++; } @@ -3414,7 +3412,7 @@ void BKE_ptcache_update_info(PTCacheID *pid) } } else { - PTCacheMem *pm = cache->mem_cache.first; + PTCacheMem *pm = cache->mem_cache.first; float bytes = 0.0f; int i, mb; diff --git a/source/blender/blenkernel/intern/sca.c b/source/blender/blenkernel/intern/sca.c index 6c1fbbfa9a0..eb4e0d9c679 100644 --- a/source/blender/blenkernel/intern/sca.c +++ b/source/blender/blenkernel/intern/sca.c @@ -552,7 +552,7 @@ void set_sca_new_poins_ob(Object *ob) if (sens->flag & SENS_NEW) { for (a=0; a<sens->totlinks; a++) { if (sens->links[a] && sens->links[a]->mynew) - sens->links[a]= sens->links[a]->mynew; + sens->links[a] = sens->links[a]->mynew; } } sens= sens->next; @@ -563,7 +563,7 @@ void set_sca_new_poins_ob(Object *ob) if (cont->flag & CONT_NEW) { for (a=0; a<cont->totlinks; a++) { if ( cont->links[a] && cont->links[a]->mynew) - cont->links[a]= cont->links[a]->mynew; + cont->links[a] = cont->links[a]->mynew; } } cont= cont->next; diff --git a/source/blender/blenkernel/intern/scene.c b/source/blender/blenkernel/intern/scene.c index 628a251ed26..721117d739f 100644 --- a/source/blender/blenkernel/intern/scene.c +++ b/source/blender/blenkernel/intern/scene.c @@ -332,7 +332,7 @@ void BKE_scene_free(Scene *sce) BKE_paint_free(&sce->toolsettings->imapaint.paint); MEM_freeN(sce->toolsettings); - sce->toolsettings = NULL; + sce->toolsettings = NULL; } if (sce->theDag) { @@ -443,7 +443,7 @@ Scene *BKE_scene_add(const char *name) sce->toolsettings->cornertype = 1; sce->toolsettings->degr = 90; sce->toolsettings->step = 9; - sce->toolsettings->turn = 1; + sce->toolsettings->turn = 1; sce->toolsettings->extr_offs = 1; sce->toolsettings->doublimit = 0.001; sce->toolsettings->segments = 32; @@ -965,7 +965,7 @@ float BKE_scene_frame_get_from_ctime(Scene *scene, const float frame) { float ctime = frame; ctime += scene->r.subframe; - ctime *= scene->r.framelen; + ctime *= scene->r.framelen; return ctime; } @@ -1049,7 +1049,7 @@ void BKE_scene_update_tagged(Main *bmain, Scene *scene) /* flush recalc flags to dependencies */ DAG_ids_flush_tagged(bmain); - scene->physics_settings.quick_cache_step = 0; + /* removed calls to quick_cache, see pointcache.c */ /* clear "LIB_DOIT" flag from all materials, to prevent infinite recursion problems later * when trying to find materials with drivers that need evaluating [#32017] @@ -1072,10 +1072,6 @@ void BKE_scene_update_tagged(Main *bmain, Scene *scene) BKE_animsys_evaluate_animdata(scene, &scene->id, adt, ctime, 0); } - /* quick point cache updates */ - if (scene->physics_settings.quick_cache_step) - BKE_ptcache_quick_cache_all(bmain, scene); - /* notify editors and python about recalc */ BLI_callback_exec(bmain, &scene->id, BLI_CB_EVT_SCENE_UPDATE_POST); DAG_ids_check_recalc(bmain, scene, FALSE); @@ -1124,6 +1120,11 @@ void BKE_scene_update_for_newframe(Main *bmain, Scene *sce, unsigned int lay) BKE_animsys_evaluate_all_animation(bmain, sce, ctime); /*...done with recusrive funcs */ + /* clear "LIB_DOIT" flag from all materials, to prevent infinite recursion problems later + * when trying to find materials with drivers that need evaluating [#32017] + */ + tag_main_idcode(bmain, ID_MA, FALSE); + /* BKE_object_handle_update() on all objects, groups and sets */ scene_update_tagged_recursive(bmain, sce, sce); @@ -1201,7 +1202,7 @@ int BKE_scene_remove_render_layer(Main *bmain, Scene *scene, SceneRenderLayer *s int get_render_subsurf_level(RenderData *r, int lvl) { if (r->mode & R_SIMPLIFY) - return MIN2(r->simplify_subsurf, lvl); + return min_ii(r->simplify_subsurf, lvl); else return lvl; } @@ -1217,7 +1218,7 @@ int get_render_child_particle_number(RenderData *r, int num) int get_render_shadow_samples(RenderData *r, int samples) { if ((r->mode & R_SIMPLIFY) && samples > 0) - return MIN2(r->simplify_shadowsamples, samples); + return min_ii(r->simplify_shadowsamples, samples); else return samples; } diff --git a/source/blender/blenkernel/intern/seqeffects.c b/source/blender/blenkernel/intern/seqeffects.c index 33519483843..469881020c1 100644 --- a/source/blender/blenkernel/intern/seqeffects.c +++ b/source/blender/blenkernel/intern/seqeffects.c @@ -62,14 +62,14 @@ static void slice_get_byte_buffers(const SeqRenderData *context, const ImBuf *ib { int offset = 4 * start_line * context->rectx; - *rect1 = (unsigned char*) ibuf1->rect + offset; - *rect_out = (unsigned char*) out->rect + offset; + *rect1 = (unsigned char *)ibuf1->rect + offset; + *rect_out = (unsigned char *)out->rect + offset; if (ibuf2) - *rect2 = (unsigned char*) ibuf2->rect + offset; + *rect2 = (unsigned char *)ibuf2->rect + offset; if (ibuf3) - *rect3 = (unsigned char*) ibuf3->rect + offset; + *rect3 = (unsigned char *)ibuf3->rect + offset; } static void slice_get_float_buffers(const SeqRenderData *context, const ImBuf *ibuf1, const ImBuf *ibuf2, @@ -600,7 +600,7 @@ static void makeGammaTables(float gamma) color_step = 1.0f / RE_GAMMA_TABLE_SIZE; inv_color_step = (float) RE_GAMMA_TABLE_SIZE; - /* We could squeeze out the two range tables to gain some memory */ + /* We could squeeze out the two range tables to gain some memory */ for (i = 0; i < RE_GAMMA_TABLE_SIZE; i++) { color_domain_table[i] = i * color_step; gamma_range_table[i] = pow(color_domain_table[i], valid_gamma); @@ -1178,7 +1178,7 @@ static void do_mul_effect_float(float facf0, float facf1, int x, int y, float *r fac3 = facf1; /* formula: - * fac*(a*b) + (1-fac)*a => fac*a*(b-1)+a + * fac * (a * b) + (1 - fac) * a => fac * a * (b - 1) + a */ while (y--) { @@ -1353,7 +1353,7 @@ static float check_zone(WipeZone *wipezone, int x, int y, Sequence *seq, float f hyp2 = fabsf(angle * x + y + (-(yo - posy * 0.5f) - angle * (xo - posx * 0.5f))) * wipezone->pythangle; } - hwidth = minf(hwidth, fabsf(b3 - b1) / 2.0f); + hwidth = min_ff(hwidth, fabsf(b3 - b1) / 2.0f); if (b2 < b1 && b2 < b3) { output = in_band(hwidth, hyp, 0, 1); @@ -2373,7 +2373,7 @@ static ImBuf *do_solid_color(SeqRenderData context, Sequence *seq, float UNUSED( rect[1] = col1[1]; rect[2] = col1[2]; rect[3] = 255; - } + } } } @@ -2609,7 +2609,7 @@ static void store_icu_yrange_speed(Sequence *seq, short UNUSED(adrcode), float * *ymin = 0.0; *ymax = seq->len; } - } + } } void BKE_sequence_effect_speed_rebuild_map(Scene *scene, Sequence *seq, int force) diff --git a/source/blender/blenkernel/intern/sequencer.c b/source/blender/blenkernel/intern/sequencer.c index 49ed7f80be3..b6ebc42fcf6 100644 --- a/source/blender/blenkernel/intern/sequencer.c +++ b/source/blender/blenkernel/intern/sequencer.c @@ -53,6 +53,8 @@ #include "BLI_threads.h" #include "BLI_utildefines.h" +#include "BLF_translation.h" + #include "BKE_animsys.h" #include "BKE_global.h" #include "BKE_image.h" @@ -507,8 +509,8 @@ static void seq_update_sound_bounds_recursive_rec(Scene *scene, Sequence *metase * since sound is played outside of evaluating the imbufs, */ for (seq = metaseq->seqbase.first; seq; seq = seq->next) { if (seq->type == SEQ_TYPE_META) { - seq_update_sound_bounds_recursive_rec(scene, seq, maxi(start, metaseq_start(seq)), - mini(end, metaseq_end(seq))); + seq_update_sound_bounds_recursive_rec(scene, seq, max_ii(start, metaseq_start(seq)), + min_ii(end, metaseq_end(seq))); } else if (ELEM(seq->type, SEQ_TYPE_SOUND_RAM, SEQ_TYPE_SCENE)) { if (seq->scene_sound) { @@ -991,7 +993,7 @@ static float give_stripelem_index(Sequence *seq, float cfra) if (seq->type & SEQ_TYPE_EFFECT) { end = seq->enddisp; - } + } if (end < sta) { return -1; @@ -1882,7 +1884,7 @@ static ImBuf *input_preprocess(SeqRenderData context, Sequence *seq, float cfra, ibuf = i; } - } + } if (seq->flag & SEQ_FLIPX) { IMB_flipx(ibuf); @@ -1978,7 +1980,7 @@ static void copy_to_ibuf_still(SeqRenderData context, Sequence *seq, float nr, I if (nr == 0) { BKE_sequencer_cache_put(context, seq, seq->start, SEQ_STRIPELEM_IBUF_STARTSTILL, ibuf); - } + } if (nr == seq->len - 1) { BKE_sequencer_cache_put(context, seq, seq->start, SEQ_STRIPELEM_IBUF_ENDSTILL, ibuf); @@ -2337,9 +2339,11 @@ static ImBuf *seq_render_scene_strip(SeqRenderData context, Sequence *seq, float * -jahka */ - int rendering = G.is_rendering; - int doseq; - int doseq_gl = G.is_rendering ? /*(scene->r.seq_flag & R_SEQ_GL_REND)*/ 0 : /*(scene->r.seq_flag & R_SEQ_GL_PREV)*/ 1; + const short is_rendering = G.is_rendering; + const int do_seq_gl = G.is_rendering ? + 0 /* (context.scene->r.seq_flag & R_SEQ_GL_REND) */ : + (context.scene->r.seq_flag & R_SEQ_GL_PREV); + int do_seq; int have_seq = FALSE; Scene *scene; @@ -2356,9 +2360,10 @@ static ImBuf *seq_render_scene_strip(SeqRenderData context, Sequence *seq, float oldcfra = scene->r.cfra; scene->r.cfra = frame; - if (seq->scene_camera) + if (seq->scene_camera) { camera = seq->scene_camera; - else { + } + else { BKE_scene_camera_switch_update(scene); camera = scene->camera; } @@ -2369,7 +2374,7 @@ static ImBuf *seq_render_scene_strip(SeqRenderData context, Sequence *seq, float } /* prevent eternal loop */ - doseq = context.scene->r.scemode & R_DOSEQ; + do_seq = context.scene->r.scemode & R_DOSEQ; context.scene->r.scemode &= ~R_DOSEQ; #ifdef DURIAN_CAMERA_SWITCH @@ -2379,8 +2384,11 @@ static ImBuf *seq_render_scene_strip(SeqRenderData context, Sequence *seq, float #else (void)oldmarkers; #endif - - if (sequencer_view3d_cb && BLI_thread_is_main() && doseq_gl && (scene == context.scene || have_seq == 0) && camera) { + + if ((sequencer_view3d_cb && do_seq_gl && camera) && + (BLI_thread_is_main() == TRUE) && + ((have_seq == FALSE) || (scene == context.scene))) + { char err_out[256] = "unknown"; /* for old scened this can be uninitialized, * should probably be added to do_versions at some point if the functionality stays */ @@ -2400,14 +2408,14 @@ static ImBuf *seq_render_scene_strip(SeqRenderData context, Sequence *seq, float RenderResult rres; /* XXX: this if can be removed when sequence preview rendering uses the job system */ - if (rendering || context.scene != scene) { + if (is_rendering || context.scene != scene) { if (re == NULL) re = RE_NewRender(scene->id.name); RE_BlenderFrame(re, context.bmain, scene, NULL, camera, scene->lay, frame, FALSE); /* restore previous state after it was toggled on & off by RE_BlenderFrame */ - G.is_rendering = rendering; + G.is_rendering = is_rendering; } RE_AcquireResultImage(re, &rres); @@ -2434,7 +2442,7 @@ static ImBuf *seq_render_scene_strip(SeqRenderData context, Sequence *seq, float } /* restore */ - context.scene->r.scemode |= doseq; + context.scene->r.scemode |= do_seq; scene->r.cfra = oldcfra; @@ -2825,7 +2833,7 @@ ImBuf *BKE_sequencer_give_ibuf(SeqRenderData context, float cfra, int chanshown) count = BLI_countlist(&ed->metastack); if ((chanshown < 0) && (count > 0)) { - count = MAX2(count + chanshown, 0); + count = max_ii(count + chanshown, 0); seqbasep = ((MetaStack *)BLI_findlink(&ed->metastack, count))->oldbasep; } else { @@ -3194,7 +3202,7 @@ int BKE_sequence_tx_get_final_left(Sequence *seq, int metaclip) { if (metaclip && seq->tmp) { /* return the range clipped by the parents range */ - return maxi(BKE_sequence_tx_get_final_left(seq, 0), BKE_sequence_tx_get_final_left((Sequence *)seq->tmp, TRUE)); + return max_ii(BKE_sequence_tx_get_final_left(seq, 0), BKE_sequence_tx_get_final_left((Sequence *)seq->tmp, TRUE)); } else { return (seq->start - seq->startstill) + seq->startofs; @@ -3205,7 +3213,7 @@ int BKE_sequence_tx_get_final_right(Sequence *seq, int metaclip) { if (metaclip && seq->tmp) { /* return the range clipped by the parents range */ - return mini(BKE_sequence_tx_get_final_right(seq, 0), BKE_sequence_tx_get_final_right((Sequence *)seq->tmp, TRUE)); + return min_ii(BKE_sequence_tx_get_final_right(seq, 0), BKE_sequence_tx_get_final_right((Sequence *)seq->tmp, TRUE)); } else { return ((seq->start + seq->len) + seq->endstill) - seq->endofs; @@ -3457,7 +3465,7 @@ int BKE_sequence_base_shuffle(ListBase *seqbasep, Sequence *test, Scene *evil_sc for (seq = seqbasep->first; seq; seq = seq->next) { if (seq->machine == orig_machine) - new_frame = MAX2(new_frame, seq->enddisp); + new_frame = max_ii(new_frame, seq->enddisp); } test->machine = orig_machine; @@ -3482,10 +3490,10 @@ static int shuffle_seq_time_offset_test(ListBase *seqbasep, char dir) for (seq_other = seqbasep->first; seq_other; seq_other = seq_other->next) { if (!seq_other->tmp && seq_overlap(seq, seq_other)) { if (dir == 'L') { - offset = MIN2(offset, seq_other->startdisp - seq->enddisp); + offset = min_ii(offset, seq_other->startdisp - seq->enddisp); } else { - offset = MAX2(offset, seq_other->enddisp - seq->startdisp); + offset = max_ii(offset, seq_other->enddisp - seq->startdisp); } } } @@ -3670,26 +3678,26 @@ int BKE_sequence_swap(Sequence *seq_a, Sequence *seq_b, const char **error_str) char name[sizeof(seq_a->name)]; if (seq_a->len != seq_b->len) { - *error_str = "Strips must be the same length"; + *error_str = N_("Strips must be the same length"); return 0; } - /* type checking, could be more advanced but disalow sound vs non-sound copy */ + /* type checking, could be more advanced but disallow sound vs non-sound copy */ if (seq_a->type != seq_b->type) { if (seq_a->type == SEQ_TYPE_SOUND_RAM || seq_b->type == SEQ_TYPE_SOUND_RAM) { - *error_str = "Strips were not compatible"; + *error_str = N_("Strips were not compatible"); return 0; } /* disallow effects to swap with non-effects strips */ if ((seq_a->type & SEQ_TYPE_EFFECT) != (seq_b->type & SEQ_TYPE_EFFECT)) { - *error_str = "Strips were not compatible"; + *error_str = N_("Strips were not compatible"); return 0; } if ((seq_a->type & SEQ_TYPE_EFFECT) && (seq_b->type & SEQ_TYPE_EFFECT)) { if (BKE_sequence_effect_get_num_inputs(seq_a->type) != BKE_sequence_effect_get_num_inputs(seq_b->type)) { - *error_str = "Strips must have the same number of inputs"; + *error_str = N_("Strips must have the same number of inputs"); return 0; } } diff --git a/source/blender/blenkernel/intern/shrinkwrap.c b/source/blender/blenkernel/intern/shrinkwrap.c index 9a8bcaabe0c..5586d8e4c29 100644 --- a/source/blender/blenkernel/intern/shrinkwrap.c +++ b/source/blender/blenkernel/intern/shrinkwrap.c @@ -84,7 +84,7 @@ #endif /* get derived mesh */ -//TODO is anyfunction that does this? returning the derivedFinal without we caring if its in edit mode or not? +/* TODO is anyfunction that does this? returning the derivedFinal without we caring if its in edit mode or not? */ DerivedMesh *object_get_derived_final(Object *ob) { Mesh *me = ob->data; @@ -149,7 +149,7 @@ static void shrinkwrap_calc_nearest_vertex(ShrinkwrapCalcData *calc) return; } - //Setup nearest + /* Setup nearest */ nearest.index = -1; nearest.dist = FLT_MAX; #ifndef __APPLE__ @@ -162,7 +162,7 @@ static void shrinkwrap_calc_nearest_vertex(ShrinkwrapCalcData *calc) if (weight == 0.0f) continue; - //Convert the vertex to tree coordinates + /* Convert the vertex to tree coordinates */ if (calc->vert) { copy_v3_v3(tmp_co, calc->vert[i].co); } @@ -171,11 +171,11 @@ static void shrinkwrap_calc_nearest_vertex(ShrinkwrapCalcData *calc) } space_transform_apply(&calc->local2target, tmp_co); - //Use local proximity heuristics (to reduce the nearest search) - // - //If we already had an hit before.. we assume this vertex is going to have a close hit to that other vertex - //so we can initiate the "nearest.dist" with the expected value to that last hit. - //This will lead in prunning of the search tree. + /* Use local proximity heuristics (to reduce the nearest search) + * + * If we already had an hit before.. we assume this vertex is going to have a close hit to that other vertex + * so we can initiate the "nearest.dist" with the expected value to that last hit. + * This will lead in prunning of the search tree. */ if (nearest.index != -1) nearest.dist = len_squared_v3v3(tmp_co, nearest.co); else @@ -184,17 +184,18 @@ static void shrinkwrap_calc_nearest_vertex(ShrinkwrapCalcData *calc) BLI_bvhtree_find_nearest(treeData.tree, tmp_co, &nearest, treeData.nearest_callback, &treeData); - //Found the nearest vertex + /* Found the nearest vertex */ if (nearest.index != -1) { - //Adjusting the vertex weight, so that after interpolating it keeps a certain distance from the nearest position + /* Adjusting the vertex weight, + * so that after interpolating it keeps a certain distance from the nearest position */ float dist = sasqrt(nearest.dist); if (dist > FLT_EPSILON) weight *= (dist - calc->keepDist) / dist; - //Convert the coordinates back to mesh coordinates + /* Convert the coordinates back to mesh coordinates */ copy_v3_v3(tmp_co, nearest.co); space_transform_invert(&calc->local2target, tmp_co); - interp_v3_v3v3(co, co, tmp_co, weight); //linear interpolation + interp_v3_v3v3(co, co, tmp_co, weight); /* linear interpolation */ } } @@ -215,10 +216,10 @@ int normal_projection_project_vertex(char options, const float vert[3], const fl const float *co, *no; BVHTreeRayHit hit_tmp; - //Copy from hit (we need to convert hit rays from one space coordinates to the other + /* Copy from hit (we need to convert hit rays from one space coordinates to the other */ memcpy(&hit_tmp, hit, sizeof(hit_tmp)); - //Apply space transform (TODO readjust dist) + /* Apply space transform (TODO readjust dist) */ if (transf) { copy_v3_v3(tmp_co, vert); space_transform_apply(transf, tmp_co); @@ -272,39 +273,39 @@ static void shrinkwrap_calc_normal_projection(ShrinkwrapCalcData *calc) { int i; - //Options about projection direction + /* Options about projection direction */ const char use_normal = calc->smd->shrinkOpts; float proj_axis[3] = {0.0f, 0.0f, 0.0f}; - //Raycast and tree stuff + /* Raycast and tree stuff */ BVHTreeRayHit hit; BVHTreeFromMesh treeData = NULL_BVHTreeFromMesh; - //auxiliary target + /* auxiliary target */ DerivedMesh *auxMesh = NULL; BVHTreeFromMesh auxData = NULL_BVHTreeFromMesh; SpaceTransform local2aux; - //If the user doesn't allows to project in any direction of projection axis - //then theres nothing todo. + /* If the user doesn't allows to project in any direction of projection axis + * then theres nothing todo. */ if ((use_normal & (MOD_SHRINKWRAP_PROJECT_ALLOW_POS_DIR | MOD_SHRINKWRAP_PROJECT_ALLOW_NEG_DIR)) == 0) return; - //Prepare data to retrieve the direction in which we should project each vertex + /* Prepare data to retrieve the direction in which we should project each vertex */ if (calc->smd->projAxis == MOD_SHRINKWRAP_PROJECT_OVER_NORMAL) { if (calc->vert == NULL) return; } else { - //The code supports any axis that is a combination of X,Y,Z - //although currently UI only allows to set the 3 different axis + /* The code supports any axis that is a combination of X,Y,Z + * although currently UI only allows to set the 3 different axis */ if (calc->smd->projAxis & MOD_SHRINKWRAP_PROJECT_OVER_X_AXIS) proj_axis[0] = 1.0f; if (calc->smd->projAxis & MOD_SHRINKWRAP_PROJECT_OVER_Y_AXIS) proj_axis[1] = 1.0f; if (calc->smd->projAxis & MOD_SHRINKWRAP_PROJECT_OVER_Z_AXIS) proj_axis[2] = 1.0f; normalize_v3(proj_axis); - //Invalid projection direction + /* Invalid projection direction */ if (dot_v3v3(proj_axis, proj_axis) < FLT_EPSILON) return; } @@ -316,7 +317,7 @@ static void shrinkwrap_calc_normal_projection(ShrinkwrapCalcData *calc) SPACE_TRANSFORM_SETUP(&local2aux, calc->ob, calc->smd->auxTarget); } - //After sucessufuly build the trees, start projection vertexs + /* After sucessufuly build the trees, start projection vertexs */ if (bvhtree_from_mesh_faces(&treeData, calc->target, 0.0, 4, 6) && (auxMesh == NULL || bvhtree_from_mesh_faces(&auxData, auxMesh, 0.0, 4, 6))) { @@ -351,9 +352,9 @@ static void shrinkwrap_calc_normal_projection(ShrinkwrapCalcData *calc) hit.index = -1; - hit.dist = 10000.0f; //TODO: we should use FLT_MAX here, but sweepsphere code isn't prepared for that + hit.dist = 10000.0f; /* TODO: we should use FLT_MAX here, but sweepsphere code isn't prepared for that */ - //Project over positive direction of axis + /* Project over positive direction of axis */ if (use_normal & MOD_SHRINKWRAP_PROJECT_ALLOW_POS_DIR) { if (auxData.tree) @@ -362,7 +363,7 @@ static void shrinkwrap_calc_normal_projection(ShrinkwrapCalcData *calc) normal_projection_project_vertex(calc->smd->shrinkOpts, tmp_co, tmp_no, &calc->local2target, treeData.tree, &hit, treeData.raycast_callback, &treeData); } - //Project over negative direction of axis + /* Project over negative direction of axis */ if (use_normal & MOD_SHRINKWRAP_PROJECT_ALLOW_NEG_DIR && hit.index == -1) { float inv_no[3]; negate_v3_v3(inv_no, tmp_no); @@ -381,7 +382,7 @@ static void shrinkwrap_calc_normal_projection(ShrinkwrapCalcData *calc) } } - //free data structures + /* free data structures */ free_bvhtree_from_mesh(&treeData); free_bvhtree_from_mesh(&auxData); } @@ -399,19 +400,19 @@ static void shrinkwrap_calc_nearest_surface_point(ShrinkwrapCalcData *calc) BVHTreeFromMesh treeData = NULL_BVHTreeFromMesh; BVHTreeNearest nearest = NULL_BVHTreeNearest; - //Create a bvh-tree of the given target + /* Create a bvh-tree of the given target */ BENCH(bvhtree_from_mesh_faces(&treeData, calc->target, 0.0, 2, 6)); if (treeData.tree == NULL) { OUT_OF_MEMORY(); return; } - //Setup nearest + /* Setup nearest */ nearest.index = -1; nearest.dist = FLT_MAX; - //Find the nearest vertex + /* Find the nearest vertex */ #ifndef __APPLE__ #pragma omp parallel for default(none) private(i) firstprivate(nearest) shared(calc,treeData) schedule(static) #endif @@ -421,7 +422,7 @@ static void shrinkwrap_calc_nearest_surface_point(ShrinkwrapCalcData *calc) float weight = defvert_array_find_weight_safe(calc->dvert, i, calc->vgroup); if (weight == 0.0f) continue; - //Convert the vertex to tree coordinates + /* Convert the vertex to tree coordinates */ if (calc->vert) { copy_v3_v3(tmp_co, calc->vert[i].co); } @@ -430,11 +431,11 @@ static void shrinkwrap_calc_nearest_surface_point(ShrinkwrapCalcData *calc) } space_transform_apply(&calc->local2target, tmp_co); - //Use local proximity heuristics (to reduce the nearest search) - // - //If we already had an hit before.. we assume this vertex is going to have a close hit to that other vertex - //so we can initiate the "nearest.dist" with the expected value to that last hit. - //This will lead in prunning of the search tree. + /* Use local proximity heuristics (to reduce the nearest search) + * + * If we already had an hit before.. we assume this vertex is going to have a close hit to that other vertex + * so we can initiate the "nearest.dist" with the expected value to that last hit. + * This will lead in prunning of the search tree. */ if (nearest.index != -1) nearest.dist = len_squared_v3v3(tmp_co, nearest.co); else @@ -442,24 +443,25 @@ static void shrinkwrap_calc_nearest_surface_point(ShrinkwrapCalcData *calc) BLI_bvhtree_find_nearest(treeData.tree, tmp_co, &nearest, treeData.nearest_callback, &treeData); - //Found the nearest vertex + /* Found the nearest vertex */ if (nearest.index != -1) { if (calc->smd->shrinkOpts & MOD_SHRINKWRAP_KEEP_ABOVE_SURFACE) { - //Make the vertex stay on the front side of the face + /* Make the vertex stay on the front side of the face */ madd_v3_v3v3fl(tmp_co, nearest.co, nearest.no, calc->keepDist); } else { - //Adjusting the vertex weight, so that after interpolating it keeps a certain distance from the nearest position + /* Adjusting the vertex weight, + * so that after interpolating it keeps a certain distance from the nearest position */ float dist = sasqrt(nearest.dist); if (dist > FLT_EPSILON) - interp_v3_v3v3(tmp_co, tmp_co, nearest.co, (dist - calc->keepDist) / dist); //linear interpolation + interp_v3_v3v3(tmp_co, tmp_co, nearest.co, (dist - calc->keepDist) / dist); /* linear interpolation */ else copy_v3_v3(tmp_co, nearest.co); } - //Convert the coordinates back to mesh coordinates + /* Convert the coordinates back to mesh coordinates */ space_transform_invert(&calc->local2target, tmp_co); - interp_v3_v3v3(co, co, tmp_co, weight); //linear interpolation + interp_v3_v3v3(co, co, tmp_co, weight); /* linear interpolation */ } } @@ -473,18 +475,18 @@ void shrinkwrapModifier_deform(ShrinkwrapModifierData *smd, Object *ob, DerivedM DerivedMesh *ss_mesh = NULL; ShrinkwrapCalcData calc = NULL_ShrinkwrapCalcData; - //remove loop dependencies on derived meshs (TODO should this be done elsewhere?) + /* remove loop dependencies on derived meshs (TODO should this be done elsewhere?) */ if (smd->target == ob) smd->target = NULL; if (smd->auxTarget == ob) smd->auxTarget = NULL; - //Configure Shrinkwrap calc data + /* Configure Shrinkwrap calc data */ calc.smd = smd; calc.ob = ob; calc.numVerts = numVerts; calc.vertexCos = vertexCos; - //DeformVertex + /* DeformVertex */ calc.vgroup = defgroup_name_index(calc.ob, calc.smd->vgroup_name); if (dm) { calc.dvert = dm->getVertDataArray(dm, CD_MDEFORMVERT); @@ -497,12 +499,12 @@ void shrinkwrapModifier_deform(ShrinkwrapModifierData *smd, Object *ob, DerivedM if (smd->target) { calc.target = object_get_derived_final(smd->target); - //TODO there might be several "bugs" on non-uniform scales matrixs - //because it will no longer be nearest surface, not sphere projection - //because space has been deformed + /* TODO there might be several "bugs" on non-uniform scales matrixs + * because it will no longer be nearest surface, not sphere projection + * because space has been deformed */ SPACE_TRANSFORM_SETUP(&calc.local2target, ob, smd->target); - //TODO: smd->keepDist is in global units.. must change to local + /* TODO: smd->keepDist is in global units.. must change to local */ calc.keepDist = smd->keepDist; } @@ -511,15 +513,15 @@ void shrinkwrapModifier_deform(ShrinkwrapModifierData *smd, Object *ob, DerivedM calc.vgroup = defgroup_name_index(calc.ob, smd->vgroup_name); if (dm != NULL && smd->shrinkType == MOD_SHRINKWRAP_PROJECT) { - //Setup arrays to get vertexs positions, normals and deform weights + /* Setup arrays to get vertexs positions, normals and deform weights */ calc.vert = dm->getVertDataArray(dm, CD_MVERT); calc.dvert = dm->getVertDataArray(dm, CD_MDEFORMVERT); - //Using vertexs positions/normals as if a subsurface was applied + /* Using vertexs positions/normals as if a subsurface was applied */ if (smd->subsurfLevels) { SubsurfModifierData ssmd = {{NULL}}; - ssmd.subdivType = ME_CC_SUBSURF; //catmull clark - ssmd.levels = smd->subsurfLevels; //levels + ssmd.subdivType = ME_CC_SUBSURF; /* catmull clark */ + ssmd.levels = smd->subsurfLevels; /* levels */ ss_mesh = subsurf_make_derived_from_derived(dm, &ssmd, NULL, (ob->mode & OB_MODE_EDIT) ? SUBSURF_IN_EDIT_MODE : 0); @@ -532,13 +534,13 @@ void shrinkwrapModifier_deform(ShrinkwrapModifierData *smd, Object *ob, DerivedM } } - //Just to make sure we are not leaving any memory behind + /* Just to make sure we are not leaving any memory behind */ assert(ssmd.emCache == NULL); assert(ssmd.mCache == NULL); } } - //Projecting target defined - lets work! + /* Projecting target defined - lets work! */ if (calc.target) { switch (smd->shrinkType) { case MOD_SHRINKWRAP_NEAREST_SURFACE: @@ -555,7 +557,7 @@ void shrinkwrapModifier_deform(ShrinkwrapModifierData *smd, Object *ob, DerivedM } } - //free memory + /* free memory */ if (ss_mesh) ss_mesh->release(ss_mesh); } diff --git a/source/blender/blenkernel/intern/smoke.c b/source/blender/blenkernel/intern/smoke.c index c8d6ec73d28..443aed1fc41 100644 --- a/source/blender/blenkernel/intern/smoke.c +++ b/source/blender/blenkernel/intern/smoke.c @@ -640,7 +640,6 @@ void smokeModifier_copy(struct SmokeModifierData *smd, struct SmokeModifierData tsmd->flow->flags = smd->flow->flags; } else if (tsmd->coll) { - ; /* leave it as initialized, collision settings is mostly caches */ } } @@ -699,7 +698,7 @@ static void obstacles_from_derivedmesh(Object *coll_ob, SmokeDomainSettings *sds numverts = dm->getNumVerts(dm); // DG TODO - // if(scs->type > SM_COLL_STATIC) + // if (scs->type > SM_COLL_STATIC) // if line above is used, the code is in trouble if the object moves but is declared as "does not move" { @@ -952,7 +951,7 @@ static void em_freeData(EmissionMap *em) { static void emit_from_particles(Object *flow_ob, SmokeDomainSettings *sds, SmokeFlowSettings *sfs, EmissionMap *em, Scene *scene, float time, float dt) { - if (sfs && sfs->psys && sfs->psys->part && sfs->psys->part->type == PART_EMITTER) // is particle system selected + if (sfs && sfs->psys && sfs->psys->part && ELEM(sfs->psys->part->type, PART_EMITTER, PART_FLUID)) // is particle system selected { ParticleSimulationData sim; ParticleSystem *psys = sfs->psys; @@ -1239,7 +1238,7 @@ static void emit_from_derivedmesh(Object *flow_ob, SmokeDomainSettings *sds, Smo } /* apply vertex group influence if used */ - if (defgrp_index >= 0 && dvert) { + if (defgrp_index != -1 && dvert) { float weight_mask = defvert_find_weight(&dvert[v1], defgrp_index) * weights[0] + defvert_find_weight(&dvert[v2], defgrp_index) * weights[1] + defvert_find_weight(&dvert[v3], defgrp_index) * weights[2]; diff --git a/source/blender/blenkernel/intern/softbody.c b/source/blender/blenkernel/intern/softbody.c index f47c931e309..3a16158c374 100644 --- a/source/blender/blenkernel/intern/softbody.c +++ b/source/blender/blenkernel/intern/softbody.c @@ -1598,7 +1598,7 @@ static void _scan_for_ext_spring_forces(Scene *scene, Object *ob, float timenow, /*see if we have wind*/ if (do_effector) { EffectedPoint epoint; - float speed[3]={0.0f, 0.0f, 0.0f}; + float speed[3] = {0.0f, 0.0f, 0.0f}; float pos[3]; mid_v3_v3v3(pos, sb->bpoint[bs->v1].pos, sb->bpoint[bs->v2].pos); mid_v3_v3v3(vel, sb->bpoint[bs->v1].vec, sb->bpoint[bs->v2].vec); @@ -1749,8 +1749,8 @@ static int sb_detect_vertex_collisionCached(float opco[3], float facenormal[3], Object *ob= NULL; GHash *hash; GHashIterator *ihash; - float nv1[3], nv2[3], nv3[3], nv4[3], edge1[3], edge2[3], d_nvect[3], dv1[3], ve[3], avel[3]={0.0, 0.0, 0.0}, - vv1[3], vv2[3], vv3[3], vv4[3], coledge[3]={0.0f, 0.0f, 0.0f}, mindistedge = 1000.0f, + float nv1[3], nv2[3], nv3[3], nv4[3], edge1[3], edge2[3], d_nvect[3], dv1[3], ve[3], avel[3] = {0.0, 0.0, 0.0}, + vv1[3], vv2[3], vv3[3], vv4[3], coledge[3] = {0.0f, 0.0f, 0.0f}, mindistedge = 1000.0f, outerforceaccu[3], innerforceaccu[3], facedist, /* n_mag, */ /* UNUSED */ force_mag_norm, minx, miny, minz, maxx, maxy, maxz, innerfacethickness = -0.5f, outerfacethickness = 0.2f, @@ -2209,7 +2209,7 @@ static int _softbody_calc_forces_slice_in_a_thread(Scene *scene, Object *ob, flo bp = &sb->bpoint[ifirst]; for (bb=number_of_points_here; bb>0; bb--, bp++) { /* clear forces accumulator */ - bp->force[0]= bp->force[1]= bp->force[2]= 0.0; + bp->force[0] = bp->force[1] = bp->force[2] = 0.0; /* naive ball self collision */ /* needs to be done if goal snaps or not */ if (do_selfcollision) { @@ -2304,8 +2304,8 @@ static int _softbody_calc_forces_slice_in_a_thread(Scene *scene, Object *ob, flo if (do_effector) { EffectedPoint epoint; float kd; - float force[3]= {0.0f, 0.0f, 0.0f}; - float speed[3]= {0.0f, 0.0f, 0.0f}; + float force[3] = {0.0f, 0.0f, 0.0f}; + float speed[3] = {0.0f, 0.0f, 0.0f}; float eval_sb_fric_force_scale = sb_fric_force_scale(ob); /* just for calling function once */ pd_point_from_soft(scene, bp->pos, bp->vec, sb->bpoint-bp, &epoint); pdDoEffectors(do_effector, NULL, sb->effector_weights, &epoint, force, speed); @@ -2557,7 +2557,7 @@ static void softbody_calc_forces(Scene *scene, Object *ob, float forcetime, floa for (a=sb->totpoint, bp= sb->bpoint; a>0; a--, bp++) { /* clear forces accumulator */ - bp->force[0]= bp->force[1]= bp->force[2]= 0.0; + bp->force[0] = bp->force[1] = bp->force[2] = 0.0; if (nl_flags & NLF_BUILD) { //int ia =3*(sb->totpoint-a); //int op =3*sb->totpoint; @@ -2712,8 +2712,8 @@ static void softbody_calc_forces(Scene *scene, Object *ob, float forcetime, floa /* particle field & vortex */ if (do_effector) { EffectedPoint epoint; - float force[3]= {0.0f, 0.0f, 0.0f}; - float speed[3]= {0.0f, 0.0f, 0.0f}; + float force[3] = {0.0f, 0.0f, 0.0f}; + float speed[3] = {0.0f, 0.0f, 0.0f}; float eval_sb_fric_force_scale = sb_fric_force_scale(ob); /* just for calling function once */ pd_point_from_soft(scene, bp->pos, bp->vec, sb->bpoint-bp, &epoint); pdDoEffectors(do_effector, NULL, sb->effector_weights, &epoint, force, speed); @@ -2905,7 +2905,7 @@ static void softbody_apply_forces(Object *ob, float forcetime, int mode, float * /* or heun ~ 2nd order runge-kutta steps, mode 1, 2 */ SoftBody *sb= ob->soft; /* is supposed to be there */ BodyPoint *bp; - float dx[3]={0}, dv[3], aabbmin[3], aabbmax[3], cm[3]={0.0f, 0.0f, 0.0f}; + float dx[3] = {0}, dv[3], aabbmin[3], aabbmax[3], cm[3] = {0.0f, 0.0f, 0.0f}; float timeovermass/*, freezeloc=0.00001f, freezeforce=0.00000000001f*/; float maxerrpos= 0.0f, maxerrvel = 0.0f; int a, fuzzy=0; @@ -3194,7 +3194,7 @@ static void interpolate_exciter(Object *ob, int timescale, int time) - xxxx_to_softbody(Object *ob) : a full (new) copy, creates SB geometry */ -static void get_scalar_from_vertexgroup(Object *ob, int vertID, short groupindex, float *target) +static void get_scalar_from_vertexgroup(Object *ob, int vertID, int groupindex, float *target) /* result 0 on success, else indicates error number -- kind of *inverse* result defintion, -- but this way we can signal error condition to caller @@ -3297,7 +3297,7 @@ static void mesh_to_softbody(Scene *scene, Object *ob) if ((ob->softflag & OB_SB_GOAL) && sb->vertgroup) { /* even this is a deprecated evil hack */ /* I'd like to have it .. if (sb->namedVG_Goal[0]) */ - get_scalar_from_vertexgroup(ob, a, (short) (sb->vertgroup-1), &bp->goal); + get_scalar_from_vertexgroup(ob, a, sb->vertgroup - 1, &bp->goal); /* do this always, regardless successful read from vertex group */ /* this is where '2.5 every thing is animatable' goes wrong in the first place jow_go_for2_5 */ /* 1st coding action to take : move this to frame level */ @@ -3316,10 +3316,10 @@ static void mesh_to_softbody(Scene *scene, Object *ob) */ if (sb->namedVG_Mass[0]) { - int grp= defgroup_name_index (ob, sb->namedVG_Mass); - /* printf("VGN %s %d\n", sb->namedVG_Mass, grp); */ - if (grp > -1) { - get_scalar_from_vertexgroup(ob, a, (short) (grp), &bp->mass); + int defgrp_index = defgroup_name_index (ob, sb->namedVG_Mass); + /* printf("VGN %s %d\n", sb->namedVG_Mass, defgrp_index); */ + if (defgrp_index != -1) { + get_scalar_from_vertexgroup(ob, a, defgrp_index, &bp->mass); /* 2.5 bp->mass = bp->mass * sb->nodemass; */ /* printf("bp->mass %f\n", bp->mass); */ @@ -3329,10 +3329,10 @@ static void mesh_to_softbody(Scene *scene, Object *ob) bp->springweight = 1.0f; if (sb->namedVG_Spring_K[0]) { - int grp= defgroup_name_index (ob, sb->namedVG_Spring_K); - //printf("VGN %s %d\n", sb->namedVG_Spring_K, grp); - if (grp > -1) { - get_scalar_from_vertexgroup(ob, a, (short) (grp), &bp->springweight); + int defgrp_index = defgroup_name_index (ob, sb->namedVG_Spring_K); + //printf("VGN %s %d\n", sb->namedVG_Spring_K, defgrp_index); + if (defgrp_index != -1) { + get_scalar_from_vertexgroup(ob, a, defgrp_index , &bp->springweight); //printf("bp->springweight %f\n", bp->springweight); } @@ -3865,7 +3865,7 @@ static void softbody_reset(Object *ob, SoftBody *sb, float (*vertexCos)[3], int copy_v3_v3(bp->origS, bp->pos); copy_v3_v3(bp->origE, bp->pos); copy_v3_v3(bp->origT, bp->pos); - bp->vec[0]= bp->vec[1]= bp->vec[2]= 0.0f; + bp->vec[0] = bp->vec[1] = bp->vec[2] = 0.0f; /* the bp->prev*'s are for rolling back from a canceled try to propagate in time * adaptive step size algo in a nutshell: diff --git a/source/blender/blenkernel/intern/subsurf_ccg.c b/source/blender/blenkernel/intern/subsurf_ccg.c index facf0793f87..33350a80928 100644 --- a/source/blender/blenkernel/intern/subsurf_ccg.c +++ b/source/blender/blenkernel/intern/subsurf_ccg.c @@ -3020,6 +3020,9 @@ static struct PBVH *ccgDM_getPBVH(Object *ob, DerivedMesh *dm) me->totface, me->totvert, &me->vdata); } + if (ccgdm->pbvh) + pbvh_show_diffuse_color_set(ccgdm->pbvh, ob->sculpt->show_diffuse_color); + return ccgdm->pbvh; } diff --git a/source/blender/blenkernel/intern/text.c b/source/blender/blenkernel/intern/text.c index 05d0705107d..b9ca3c9cc63 100644 --- a/source/blender/blenkernel/intern/text.c +++ b/source/blender/blenkernel/intern/text.c @@ -314,7 +314,7 @@ int BKE_text_reload(Text *text) fseek(fp, 0L, SEEK_END); len = ftell(fp); - fseek(fp, 0L, SEEK_SET); + fseek(fp, 0L, SEEK_SET); text->undo_pos = -1; @@ -370,7 +370,7 @@ int BKE_text_reload(Text *text) text->curl = text->sell = text->lines.first; text->curc = text->selc = 0; - MEM_freeN(buffer); + MEM_freeN(buffer); return 1; } @@ -404,7 +404,7 @@ Text *BKE_text_load(const char *file, const char *relpath) fseek(fp, 0L, SEEK_END); len = ftell(fp); - fseek(fp, 0L, SEEK_SET); + fseek(fp, 0L, SEEK_SET); ta->name = MEM_mallocN(strlen(file) + 1, "text_name"); strcpy(ta->name, file); @@ -469,7 +469,7 @@ Text *BKE_text_load(const char *file, const char *relpath) ta->curl = ta->sell = ta->lines.first; ta->curc = ta->selc = 0; - MEM_freeN(buffer); + MEM_freeN(buffer); return ta; } @@ -683,7 +683,7 @@ void txt_clean_text(Text *text) if (!text->lines.first) { if (text->lines.last) text->lines.first = text->lines.last; else text->lines.first = text->lines.last = txt_new_line(NULL); - } + } if (!text->lines.last) text->lines.last = text->lines.first; @@ -732,7 +732,7 @@ int txt_get_span(TextLine *from, TextLine *to) if (!tmp) ret = 0; } - return ret; + return ret; } static void txt_make_dirty(Text *text) @@ -934,7 +934,7 @@ void txt_move_right(Text *text, short sel) txt_move_down(text, sel); *charp = 0; } - } + } else { // do nice right only if there are only spaces // spaces hardcoded in DNA_text_types.h @@ -1376,7 +1376,7 @@ int txt_find_string(Text *text, const char *findstr, int wrap, int match_case) int newc = (int)(s - tl->line); txt_move_to(text, newl, newc, 0); txt_move_to(text, newl, newc + strlen(findstr), 1); - return 1; + return 1; } else return 0; @@ -1458,7 +1458,7 @@ char *txt_sel_to_buf(Text *text) length += charl; buf[length] = 0; - } + } return buf; } @@ -2078,7 +2078,7 @@ void txt_do_undo(Text *text) charp = op - UNDO_BS_1 + 1; txt_add_char(text, txt_undo_read_unicode(text->undo_buf, &text->undo_pos, charp)); text->undo_pos--; - break; + break; case UNDO_DEL_1: case UNDO_DEL_2: case UNDO_DEL_3: case UNDO_DEL_4: charp = op - UNDO_DEL_1 + 1; @@ -2104,7 +2104,7 @@ void txt_do_undo(Text *text) txt_curs_first(text, &holdl, &holdc); holdln = txt_get_span(text->lines.first, holdl); - txt_insert_buf(text, buf); + txt_insert_buf(text, buf); MEM_freeN(buf); text->curl = text->lines.first; @@ -2235,7 +2235,7 @@ void txt_do_redo(Text *text) unsigned short charp; char *buf; - text->undo_pos++; + text->undo_pos++; op = text->undo_buf[text->undo_pos]; if (!op) { @@ -2351,7 +2351,7 @@ void txt_do_redo(Text *text) text->undo_pos += linep; buf[linep] = 0; - txt_insert_buf(text, buf); + txt_insert_buf(text, buf); MEM_freeN(buf); text->undo_pos++; @@ -2369,7 +2369,7 @@ void txt_do_redo(Text *text) //charp is the first char selected or 0 linep = txt_redo_read_uint32(text->undo_buf, &text->undo_pos); - //linep is now the first line of the selection + //linep is now the first line of the selection //set the selcetion for this now text->curc = charp; text->curl = text->lines.first; @@ -2476,7 +2476,7 @@ void txt_split_curline(Text *text) text->curl->format = NULL; text->curl->len = text->curl->len - text->curc; - BLI_insertlinkbefore(&text->lines, text->curl, ins); + BLI_insertlinkbefore(&text->lines, text->curl, ins); text->curc = 0; diff --git a/source/blender/blenkernel/intern/texture.c b/source/blender/blenkernel/intern/texture.c index 300d272b86b..efc7a281636 100644 --- a/source/blender/blenkernel/intern/texture.c +++ b/source/blender/blenkernel/intern/texture.c @@ -646,7 +646,7 @@ MTex *add_mtex_id(ID *id, int slot) if (slot == -1) { /* find first free */ - int i; + int i; for (i = 0; i < MAX_MTEX; i++) { if (!mtex_ar[i]) { slot = i; diff --git a/source/blender/blenkernel/intern/tracking.c b/source/blender/blenkernel/intern/tracking.c index 0d304482060..e39ad4a08c0 100644 --- a/source/blender/blenkernel/intern/tracking.c +++ b/source/blender/blenkernel/intern/tracking.c @@ -51,6 +51,8 @@ #include "BLI_string.h" #include "BLI_threads.h" +#include "BLF_translation.h" + #include "BKE_global.h" #include "BKE_tracking.h" #include "BKE_movieclip.h" @@ -221,7 +223,7 @@ void BKE_tracking_get_projection_matrix(MovieTracking *tracking, MovieTrackingOb float viewfac, pixsize, left, right, bottom, top, clipsta, clipend; float winmat[4][4]; float ycor = 1.0f / tracking->camera.pixel_aspect; - float shiftx, shifty, winside = MAX2(winx, winy); + float shiftx, shifty, winside = (float)min_ii(winx, winy); BKE_tracking_camera_shift_get(tracking, winx, winy, &shiftx, &shifty); @@ -997,8 +999,8 @@ void BKE_tracking_marker_clamp(MovieTrackingMarker *marker, int event) if (event == CLAMP_PAT_DIM) { for (a = 0; a < 2; a++) { /* search shouldn't be resized smaller than pattern */ - marker->search_min[a] = minf(pat_min[a], marker->search_min[a]); - marker->search_max[a] = maxf(pat_max[a], marker->search_max[a]); + marker->search_min[a] = min_ff(pat_min[a], marker->search_min[a]); + marker->search_max[a] = max_ff(pat_max[a], marker->search_max[a]); } } else if (event == CLAMP_PAT_POS) { @@ -1022,8 +1024,8 @@ void BKE_tracking_marker_clamp(MovieTrackingMarker *marker, int event) else if (event == CLAMP_SEARCH_DIM) { for (a = 0; a < 2; a++) { /* search shouldn't be resized smaller than pattern */ - marker->search_min[a] = minf(pat_min[a], marker->search_min[a]); - marker->search_max[a] = maxf(pat_max[a], marker->search_max[a]); + marker->search_min[a] = min_ff(pat_min[a], marker->search_min[a]); + marker->search_max[a] = max_ff(pat_max[a], marker->search_max[a]); } } else if (event == CLAMP_SEARCH_POS) { @@ -2138,7 +2140,7 @@ void BKE_tracking_context_sync(MovieTrackingContext *context) context->sync_frame = newframe; - tracking->dopesheet.ok = FALSE; + BKE_tracking_dopesheet_tag_update(tracking); } void BKE_tracking_context_sync_user(const MovieTrackingContext *context, MovieClipUser *user) @@ -2345,10 +2347,10 @@ static int tracking_check_marker_margin(MovieTrackingTrack *track, MovieTracking /* margin from frame boundaries */ BKE_tracking_marker_pattern_minmax(marker, pat_min, pat_max); sub_v2_v2v2(dim, pat_max, pat_min); - margin[0] = margin[1] = maxf(dim[0], dim[1]) / 2.0f; + margin[0] = margin[1] = max_ff(dim[0], dim[1]) / 2.0f; - margin[0] = maxf(margin[0], (float)track->margin / frame_width); - margin[1] = maxf(margin[1], (float)track->margin / frame_height); + margin[0] = max_ff(margin[0], (float)track->margin / frame_width); + margin[1] = max_ff(margin[1], (float)track->margin / frame_height); /* do not track markers which are too close to boundary */ if (marker->pos[0] < margin[0] || marker->pos[0] > 1.0f - margin[0] || @@ -2787,7 +2789,7 @@ int BKE_tracking_reconstruction_check(MovieTracking *tracking, MovieTrackingObje return TRUE; } else if (reconstruct_count_tracks_on_both_keyframes(tracking, object) < 8) { - BLI_strncpy(error_msg, "At least 8 common tracks on both of keyframes are needed for reconstruction", + BLI_strncpy(error_msg, N_("At least 8 common tracks on both of keyframes are needed for reconstruction"), error_size); return FALSE; @@ -2795,7 +2797,7 @@ int BKE_tracking_reconstruction_check(MovieTracking *tracking, MovieTrackingObje return TRUE; #else - BLI_strncpy(error_msg, "Blender is compiled without motion tracking library", error_size); + BLI_strncpy(error_msg, N_("Blender is compiled without motion tracking library"), error_size); (void) tracking; (void) object; @@ -2848,10 +2850,10 @@ MovieReconstructContext *BKE_tracking_reconstruction_context_new(MovieTracking * } if (first < track->markersnr - 1) - sfra = MIN2(sfra, first_marker->framenr); + sfra = min_ii(sfra, first_marker->framenr); if (last >= 0) - efra = MAX2(efra, last_marker->framenr); + efra = max_ii(efra, last_marker->framenr); tracks_map_insert(context->tracks_map, track, NULL); @@ -2953,6 +2955,7 @@ int BKE_tracking_reconstruction_finish(MovieReconstructContext *context, MovieTr MovieTrackingReconstruction *reconstruction; tracks_map_merge(context->tracks_map, tracking); + BKE_tracking_dopesheet_tag_update(tracking); if (context->is_camera) { reconstruction = &tracking->reconstruction; @@ -3198,8 +3201,8 @@ static float stabilization_calculate_autoscale_factor(MovieTracking *tracking, i if (track->flag & TRACK_USE_2D_STAB || ((stab->flag & TRACKING_STABILIZE_ROTATION) && track == stab->rot_track)) { - sfra = MIN2(sfra, track->markers[0].framenr); - efra = MAX2(efra, track->markers[track->markersnr - 1].framenr); + sfra = min_ii(sfra, track->markers[0].framenr); + efra = max_ii(efra, track->markers[track->markersnr - 1].framenr); } track = track->next; @@ -3275,7 +3278,7 @@ static float stabilization_calculate_autoscale_factor(MovieTracking *tracking, i S = (-w * I - h * J) / (dx * I + dy * J + K); - scale = maxf(scale, S); + scale = max_ff(scale, S); } } } @@ -3284,7 +3287,7 @@ static float stabilization_calculate_autoscale_factor(MovieTracking *tracking, i stab->scale = scale; if (stab->maxscale > 0.0f) - stab->scale = minf(stab->scale, stab->maxscale); + stab->scale = min_ff(stab->scale, stab->maxscale); } else { stab->scale = 1.0f; @@ -3643,7 +3646,7 @@ static void channels_segments_calc(MovieTrackingDopesheetChannel *channel) channel->segments[2 * segment] = start_marker->framenr; channel->segments[2 * segment + 1] = start_marker->framenr + len; - channel->max_segment = MAX2(channel->max_segment, len); + channel->max_segment = max_ii(channel->max_segment, len); segment++; } @@ -3651,7 +3654,7 @@ static void channels_segments_calc(MovieTrackingDopesheetChannel *channel) } } -static void tracking_dopesheet_sort(MovieTracking *tracking, int sort_method, int inverse) +static void tracking_dopesheet_sort(MovieTracking *tracking, int sort_method, int inverse) { MovieTrackingDopesheet *dopesheet = &tracking->dopesheet; diff --git a/source/blender/blenkernel/intern/world.c b/source/blender/blenkernel/intern/world.c index 434bfe19c1f..4bde895cf7d 100644 --- a/source/blender/blenkernel/intern/world.c +++ b/source/blender/blenkernel/intern/world.c @@ -107,7 +107,7 @@ World *add_world(const char *name) wrld->ao_indirect_energy = 1.0f; wrld->ao_indirect_bounces = 1; wrld->aobias = 0.05f; - wrld->ao_samp_method = WO_AOSAMP_HAMMERSLEY; + wrld->ao_samp_method = WO_AOSAMP_HAMMERSLEY; wrld->ao_approx_error = 0.25f; wrld->preview = NULL; diff --git a/source/blender/blenkernel/intern/writeavi.c b/source/blender/blenkernel/intern/writeavi.c index 9f29cb8b137..d4428be3faf 100644 --- a/source/blender/blenkernel/intern/writeavi.c +++ b/source/blender/blenkernel/intern/writeavi.c @@ -162,7 +162,7 @@ static int start_avi(Scene *scene, RenderData *rd, int rectx, int recty, ReportL else format = AVI_FORMAT_MJPEG; if (AVI_open_compress(name, avi, 1, format) != AVI_ERROR_NONE) { - BKE_report(reports, RPT_ERROR, "Cannot open or start AVI movie file."); + BKE_report(reports, RPT_ERROR, "Cannot open or start AVI movie file"); MEM_freeN(avi); avi = NULL; return 0; @@ -175,8 +175,8 @@ static int start_avi(Scene *scene, RenderData *rd, int rectx, int recty, ReportL avi->interlace = 0; avi->odd_fields = 0; -/* avi->interlace= rd->mode & R_FIELDS; */ -/* avi->odd_fields= (rd->mode & R_ODDFIELD)?1:0; */ +/* avi->interlace = rd->mode & R_FIELDS; */ +/* avi->odd_fields = (rd->mode & R_ODDFIELD) ? 1 : 0; */ printf("Created avi: %s\n", name); return 1; diff --git a/source/blender/blenkernel/intern/writeffmpeg.c b/source/blender/blenkernel/intern/writeffmpeg.c index ff1fdebb728..3a8a14290dc 100644 --- a/source/blender/blenkernel/intern/writeffmpeg.c +++ b/source/blender/blenkernel/intern/writeffmpeg.c @@ -289,7 +289,7 @@ static int write_video_frame(RenderData *rd, int cfra, AVFrame *frame, ReportLis } if (!success) - BKE_report(reports, RPT_ERROR, "Error writing frame."); + BKE_report(reports, RPT_ERROR, "Error writing frame"); return success; } @@ -307,7 +307,7 @@ static AVFrame *generate_video_frame(uint8_t *pixels, ReportList *reports) if (c->pix_fmt != PIX_FMT_BGR32) { rgb_frame = alloc_picture(PIX_FMT_BGR32, width, height); if (!rgb_frame) { - BKE_report(reports, RPT_ERROR, "Couldn't allocate temporary frame."); + BKE_report(reports, RPT_ERROR, "Could not allocate temporary frame"); return NULL; } } @@ -695,12 +695,12 @@ static int start_ffmpeg_impl(struct RenderData *rd, int rectx, int recty, Report exts = get_file_extensions(ffmpeg_type); if (!exts) { - BKE_report(reports, RPT_ERROR, "No valid formats found."); + BKE_report(reports, RPT_ERROR, "No valid formats found"); return 0; } fmt = av_guess_format(NULL, exts[0], NULL); if (!fmt) { - BKE_report(reports, RPT_ERROR, "No valid formats found."); + BKE_report(reports, RPT_ERROR, "No valid formats found"); return 0; } @@ -795,7 +795,7 @@ static int start_ffmpeg_impl(struct RenderData *rd, int rectx, int recty, Report if (error[0]) BKE_report(reports, RPT_ERROR, error); else - BKE_report(reports, RPT_ERROR, "Error initializing video stream."); + BKE_report(reports, RPT_ERROR, "Error initializing video stream"); av_dict_free(&opts); return 0; @@ -805,20 +805,20 @@ static int start_ffmpeg_impl(struct RenderData *rd, int rectx, int recty, Report if (ffmpeg_audio_codec != CODEC_ID_NONE) { audio_stream = alloc_audio_stream(rd, fmt->audio_codec, of); if (!audio_stream) { - BKE_report(reports, RPT_ERROR, "Error initializing audio stream."); + BKE_report(reports, RPT_ERROR, "Error initializing audio stream"); av_dict_free(&opts); return 0; } } if (!(fmt->flags & AVFMT_NOFILE)) { if (avio_open(&of->pb, name, AVIO_FLAG_WRITE) < 0) { - BKE_report(reports, RPT_ERROR, "Could not open file for writing."); + BKE_report(reports, RPT_ERROR, "Could not open file for writing"); av_dict_free(&opts); return 0; } } if (avformat_write_header(of, NULL) < 0) { - BKE_report(reports, RPT_ERROR, "Could not initialize streams. Probably unsupported codec combination."); + BKE_report(reports, RPT_ERROR, "Could not initialize streams, probably unsupported codec combination"); av_dict_free(&opts); return 0; } @@ -982,7 +982,7 @@ int BKE_ffmpeg_append(RenderData *rd, int start_frame, int frame, int *pixels, i PRINT("Writing frame %i, render width=%d, render height=%d\n", frame, rectx, recty); -// why is this done before writing the video frame and again at end_ffmpeg? +/* why is this done before writing the video frame and again at end_ffmpeg? */ // write_audio_frames(frame / (((double)rd->frs_sec) / rd->frs_sec_base)); if (video_stream) { @@ -1225,7 +1225,7 @@ int BKE_ffmpeg_property_add_string(RenderData *rd, const char *type, const char while (*param == ' ') param++; } - o = my_av_find_opt(&c, name, NULL, 0, 0); + o = my_av_find_opt(&c, name, NULL, 0, 0); if (!o) { return 0; } @@ -1233,7 +1233,7 @@ int BKE_ffmpeg_property_add_string(RenderData *rd, const char *type, const char return 0; } if (param && o->type != FF_OPT_TYPE_CONST && o->unit) { - p = my_av_find_opt(&c, param, o->unit, 0, 0); + p = my_av_find_opt(&c, param, o->unit, 0, 0); if (p) { prop = BKE_ffmpeg_property_add(rd, (char *) type, p - c.av_class->option, o - c.av_class->option); } diff --git a/source/blender/blenkernel/intern/writeframeserver.c b/source/blender/blenkernel/intern/writeframeserver.c index d8fddb9851a..acbbcb0b043 100644 --- a/source/blender/blenkernel/intern/writeframeserver.c +++ b/source/blender/blenkernel/intern/writeframeserver.c @@ -118,13 +118,13 @@ int BKE_frameserver_start(struct Scene *scene, RenderData *UNUSED(rd), int rectx (void)scene; /* unused */ if (!startup_socket_system()) { - BKE_report(reports, RPT_ERROR, "Can't startup socket system"); + BKE_report(reports, RPT_ERROR, "Cannot startup socket system"); return 0; } if ((sock = socket(AF_INET, SOCK_STREAM, 0)) < 0) { shutdown_socket_system(); - BKE_report(reports, RPT_ERROR, "Can't open socket"); + BKE_report(reports, RPT_ERROR, "Cannot open socket"); return 0; } @@ -136,13 +136,13 @@ int BKE_frameserver_start(struct Scene *scene, RenderData *UNUSED(rd), int rectx if (bind(sock, (struct sockaddr *)&addr, sizeof(addr)) < 0) { shutdown_socket_system(); - BKE_report(reports, RPT_ERROR, "Can't bind to socket"); + BKE_report(reports, RPT_ERROR, "Cannot bind to socket"); return 0; } if (listen(sock, SOMAXCONN) < 0) { shutdown_socket_system(); - BKE_report(reports, RPT_ERROR, "Can't establish listen backlog"); + BKE_report(reports, RPT_ERROR, "Cannot establish listen backlog"); return 0; } connsock = -1; |