diff options
Diffstat (limited to 'source/blender')
54 files changed, 475 insertions, 386 deletions
diff --git a/source/blender/blenkernel/BKE_cloth.h b/source/blender/blenkernel/BKE_cloth.h index 3475ef532da..bcda970e60c 100644 --- a/source/blender/blenkernel/BKE_cloth.h +++ b/source/blender/blenkernel/BKE_cloth.h @@ -69,8 +69,7 @@ struct CollisionTree; * own connectivity of the mesh based on the actual edges in the mesh. * */ -typedef struct Cloth -{ +typedef struct Cloth { struct ClothVertex *verts; /* The vertices that represent this cloth. */ struct LinkNode *springs; /* The springs connecting the mesh. */ unsigned int numverts; /* The number of verts == m * n. */ @@ -91,8 +90,7 @@ typedef struct Cloth /** * The definition of a cloth vertex. */ -typedef struct ClothVertex -{ +typedef struct ClothVertex { int flags; /* General flags per vertex. */ float v[3]; /* The velocity of the point. */ float xconst[3]; /* constrained position */ @@ -117,8 +115,7 @@ ClothVertex; /** * The definition of a spring. */ -typedef struct ClothSpring -{ +typedef struct ClothSpring { int ij; /* Pij from the paper, one end of the spring. */ int kl; /* Pkl from the paper, one end of the spring. */ float restlen; /* The original length of the spring. */ @@ -149,8 +146,7 @@ ClothSpring; /* SIMULATION FLAGS: goal flags,.. */ /* These are the bits used in SimSettings.flags. */ -typedef enum -{ +typedef enum { CLOTH_SIMSETTINGS_FLAG_COLLOBJ = ( 1 << 2 ),// object is only collision object, no cloth simulation is done CLOTH_SIMSETTINGS_FLAG_GOAL = ( 1 << 3 ), // we have goals enabled CLOTH_SIMSETTINGS_FLAG_TEARING = ( 1 << 4 ),// true if tearing is enabled @@ -160,15 +156,13 @@ typedef enum } CLOTH_SIMSETTINGS_FLAGS; /* COLLISION FLAGS */ -typedef enum -{ +typedef enum { CLOTH_COLLSETTINGS_FLAG_ENABLED = ( 1 << 1 ), /* enables cloth - object collisions */ CLOTH_COLLSETTINGS_FLAG_SELF = ( 1 << 2 ), /* enables selfcollisions */ } CLOTH_COLLISIONSETTINGS_FLAGS; /* Spring types as defined in the paper.*/ -typedef enum -{ +typedef enum { CLOTH_SPRING_TYPE_STRUCTURAL = (1 << 1), CLOTH_SPRING_TYPE_SHEAR = (1 << 2), CLOTH_SPRING_TYPE_BENDING = (1 << 3), @@ -176,8 +170,7 @@ typedef enum } CLOTH_SPRING_TYPES; /* SPRING FLAGS */ -typedef enum -{ +typedef enum { CLOTH_SPRING_FLAG_DEACTIVATE = ( 1 << 1 ), CLOTH_SPRING_FLAG_NEEDED = ( 1 << 2 ), // springs has values to be applied } CLOTH_SPRINGS_FLAGS; @@ -230,16 +223,14 @@ int cloth_add_spring (struct ClothModifierData *clmd, unsigned int indexA, unsig /* This enum provides the IDs for our solvers. */ // only one available in the moment -typedef enum -{ +typedef enum { CM_IMPLICIT = 0, } CM_SOLVER_ID; /* This structure defines how to call the solver. */ -typedef struct -{ +typedef struct { const char *name; CM_SOLVER_ID id; int ( *init ) (struct Object *ob, struct ClothModifierData *clmd ); diff --git a/source/blender/blenkernel/BKE_collision.h b/source/blender/blenkernel/BKE_collision.h index 191056571c0..ec257a2f394 100644 --- a/source/blender/blenkernel/BKE_collision.h +++ b/source/blender/blenkernel/BKE_collision.h @@ -59,8 +59,7 @@ struct LinkNode; //////////////////////////////////////// /* COLLISION FLAGS */ -typedef enum -{ +typedef enum { COLLISION_IN_FUTURE = (1 << 1), #ifdef WITH_ELTOPO COLLISION_USE_COLLFACE = (1 << 2), diff --git a/source/blender/blenkernel/BKE_customdata.h b/source/blender/blenkernel/BKE_customdata.h index bbe68db8bfe..3dc68edf12b 100644 --- a/source/blender/blenkernel/BKE_customdata.h +++ b/source/blender/blenkernel/BKE_customdata.h @@ -321,6 +321,7 @@ void CustomData_to_bmeshpoly(struct CustomData *fdata, struct CustomData *pdata, struct CustomData *ldata, int totloop, int totpoly); void CustomData_from_bmeshpoly(struct CustomData *fdata, struct CustomData *pdata, struct CustomData *ldata, int total); void CustomData_bmesh_update_active_layers(struct CustomData *fdata, struct CustomData *pdata, struct CustomData *ldata); +void CustomData_bmesh_do_versions_update_active_layers(struct CustomData *fdata, struct CustomData *pdata, struct CustomData *ldata); void CustomData_bmesh_init_pool(struct CustomData *data, int totelem, const char htype); /* External file storage */ diff --git a/source/blender/blenkernel/BKE_mask.h b/source/blender/blenkernel/BKE_mask.h index 19feb4d8f2e..a93e811557a 100644 --- a/source/blender/blenkernel/BKE_mask.h +++ b/source/blender/blenkernel/BKE_mask.h @@ -122,15 +122,17 @@ void BKE_mask_update_display(struct Mask *mask, float ctime); void BKE_mask_evaluate_all_masks(struct Main *bmain, float ctime, const int do_newframe); void BKE_mask_update_scene(struct Main *bmain, struct Scene *scene, const int do_newframe); void BKE_mask_parent_init(struct MaskParent *parent); -void BKE_mask_calc_handle_adjacent_interp(struct Mask *mask, struct MaskSpline *spline, struct MaskSplinePoint *point, - const float u); -void BKE_mask_calc_tangent_polyline(struct Mask *mask, struct MaskSpline *spline, struct MaskSplinePoint *point, float t[2]); -void BKE_mask_calc_handle_point(struct Mask *mask, struct MaskSpline *spline, struct MaskSplinePoint *point); -void BKE_mask_calc_handle_point_auto(struct Mask *mask, struct MaskSpline *spline, struct MaskSplinePoint *point, +void BKE_mask_calc_handle_adjacent_interp(struct MaskSpline *spline, struct MaskSplinePoint *point, const float u); +void BKE_mask_calc_tangent_polyline(struct MaskSpline *spline, struct MaskSplinePoint *point, float t[2]); +void BKE_mask_calc_handle_point(struct MaskSpline *spline, struct MaskSplinePoint *point); +void BKE_mask_calc_handle_point_auto(struct MaskSpline *spline, struct MaskSplinePoint *point, const short do_recalc_length); -void BKE_mask_get_handle_point_adjacent(struct Mask *mask, struct MaskSpline *spline, struct MaskSplinePoint *point, +void BKE_mask_get_handle_point_adjacent(struct MaskSpline *spline, struct MaskSplinePoint *point, struct MaskSplinePoint **r_point_prev, struct MaskSplinePoint **r_point_next); +void BKE_mask_layer_calc_handles(struct MaskLayer *masklay); +void BKE_mask_layer_calc_handles_deform(struct MaskLayer *masklay); void BKE_mask_calc_handles(struct Mask *mask); +void BKE_mask_calc_handles_deform(struct Mask *mask); void BKE_mask_spline_ensure_deform(struct MaskSpline *spline); /* animation */ diff --git a/source/blender/blenkernel/BKE_mesh.h b/source/blender/blenkernel/BKE_mesh.h index 1878e43f577..887340622ad 100644 --- a/source/blender/blenkernel/BKE_mesh.h +++ b/source/blender/blenkernel/BKE_mesh.h @@ -151,6 +151,7 @@ void copy_dverts(struct MDeformVert *dst, struct MDeformVert *src, int totvert); void BKE_mesh_delete_material_index(struct Mesh *me, short index); void BKE_mesh_smooth_flag_set(struct Object *meshOb, int enableSmooth); void BKE_mesh_convert_mfaces_to_mpolys(struct Mesh *mesh); +void BKE_mesh_do_versions_convert_mfaces_to_mpolys(struct Mesh *mesh); void BKE_mesh_convert_mfaces_to_mpolys_ex(struct ID *id, struct CustomData *fdata, struct CustomData *ldata, struct CustomData *pdata, int totedge_i, int totface_i, int totloop_i, int totpoly_i, diff --git a/source/blender/blenkernel/BKE_node.h b/source/blender/blenkernel/BKE_node.h index 351cb7dbb8b..eaaa1d8b62e 100644 --- a/source/blender/blenkernel/BKE_node.h +++ b/source/blender/blenkernel/BKE_node.h @@ -266,8 +266,7 @@ struct bNodeTreeExec; typedef void (*bNodeTreeCallback)(void *calldata, struct ID *owner_id, struct bNodeTree *ntree); typedef void (*bNodeClassCallback)(void *calldata, int nclass, const char *name); -typedef struct bNodeTreeType -{ +typedef struct bNodeTreeType { int type; /* type identifier */ char idname[64]; /* id name for RNA identification */ diff --git a/source/blender/blenkernel/BKE_sketch.h b/source/blender/blenkernel/BKE_sketch.h index 50ee1184b3e..ed7ce05506d 100644 --- a/source/blender/blenkernel/BKE_sketch.h +++ b/source/blender/blenkernel/BKE_sketch.h @@ -26,14 +26,12 @@ * \ingroup bke */ -typedef enum SK_PType -{ +typedef enum SK_PType { PT_CONTINUOUS, PT_EXACT, } SK_PType; -typedef enum SK_PMode -{ +typedef enum SK_PMode { PT_SNAP, PT_PROJECT, } SK_PMode; diff --git a/source/blender/blenkernel/intern/customdata.c b/source/blender/blenkernel/intern/customdata.c index 5dc50dca45a..f551b2d18a4 100644 --- a/source/blender/blenkernel/intern/customdata.c +++ b/source/blender/blenkernel/intern/customdata.c @@ -2219,6 +2219,48 @@ void CustomData_bmesh_update_active_layers(CustomData *fdata, CustomData *pdata, } } +/* update active indices for active/render/clone/stencil custom data layers + * based on indices from fdata layers + * used by do_versions in readfile.c when creating pdata and ldata for pre-bmesh + * meshes and needed to preserve active/render/clone/stencil flags set in pre-bmesh files + */ +void CustomData_bmesh_do_versions_update_active_layers(CustomData *fdata, CustomData *pdata, CustomData *ldata) +{ + int act; + + if (CustomData_has_layer(fdata, CD_MTFACE)) { + act = CustomData_get_active_layer(fdata, CD_MTFACE); + CustomData_set_layer_active(pdata, CD_MTEXPOLY, act); + CustomData_set_layer_active(ldata, CD_MLOOPUV, act); + + act = CustomData_get_render_layer(fdata, CD_MTFACE); + CustomData_set_layer_render(pdata, CD_MTEXPOLY, act); + CustomData_set_layer_render(ldata, CD_MLOOPUV, act); + + act = CustomData_get_clone_layer(fdata, CD_MTFACE); + CustomData_set_layer_clone(pdata, CD_MTEXPOLY, act); + CustomData_set_layer_clone(ldata, CD_MLOOPUV, act); + + act = CustomData_get_stencil_layer(fdata, CD_MTFACE); + CustomData_set_layer_stencil(pdata, CD_MTEXPOLY, act); + CustomData_set_layer_stencil(ldata, CD_MLOOPUV, act); + } + + if (CustomData_has_layer(fdata, CD_MCOL)) { + act = CustomData_get_active_layer(fdata, CD_MCOL); + CustomData_set_layer_active(ldata, CD_MLOOPCOL, act); + + act = CustomData_get_render_layer(fdata, CD_MCOL); + CustomData_set_layer_render(ldata, CD_MLOOPCOL, act); + + act = CustomData_get_clone_layer(fdata, CD_MCOL); + CustomData_set_layer_clone(ldata, CD_MLOOPCOL, act); + + act = CustomData_get_stencil_layer(fdata, CD_MCOL); + CustomData_set_layer_stencil(ldata, CD_MLOOPCOL, act); + } +} + void CustomData_bmesh_init_pool(CustomData *data, int totelem, const char htype) { int chunksize; diff --git a/source/blender/blenkernel/intern/implicit.c b/source/blender/blenkernel/intern/implicit.c index d4861a27057..4aef47159df 100644 --- a/source/blender/blenkernel/intern/implicit.c +++ b/source/blender/blenkernel/intern/implicit.c @@ -695,8 +695,7 @@ DO_INLINE void subadd_bfmatrixS_bfmatrixS( fmatrix3x3 *to, fmatrix3x3 *from, flo /////////////////////////////////////////////////////////////////// // simulator start /////////////////////////////////////////////////////////////////// -typedef struct Implicit_Data -{ +typedef struct Implicit_Data { lfVector *X, *V, *Xnew, *Vnew, *olddV, *F, *B, *dV, *z; fmatrix3x3 *A, *dFdV, *dFdX, *S, *P, *Pinv, *bigI, *M; } Implicit_Data; diff --git a/source/blender/blenkernel/intern/mask.c b/source/blender/blenkernel/intern/mask.c index aaefa558c9b..0a6063a6b21 100644 --- a/source/blender/blenkernel/intern/mask.c +++ b/source/blender/blenkernel/intern/mask.c @@ -1228,26 +1228,25 @@ static void mask_calc_point_handle(MaskSplinePoint *point, MaskSplinePoint *poin #endif } -void BKE_mask_get_handle_point_adjacent(Mask *UNUSED(mask), MaskSpline *spline, MaskSplinePoint *point, +void BKE_mask_get_handle_point_adjacent(MaskSpline *spline, MaskSplinePoint *point, MaskSplinePoint **r_point_prev, MaskSplinePoint **r_point_next) { - int i = (int)(point - spline->points); - BLI_assert(i >= i && i < spline->tot_point); - (void)i; /* quiet release builds */ + /* TODO, could avoid calling this at such low level */ + MaskSplinePoint *points_array = BKE_mask_spline_point_array_from_point(spline, point); - *r_point_prev = mask_spline_point_prev(spline, spline->points, point); - *r_point_next = mask_spline_point_next(spline, spline->points, point); + *r_point_prev = mask_spline_point_prev(spline, points_array, point); + *r_point_next = mask_spline_point_next(spline, points_array, point); } /* calculates the tanget of a point by its previous and next * (ignoring handles - as if its a poly line) */ -void BKE_mask_calc_tangent_polyline(Mask *mask, MaskSpline *spline, MaskSplinePoint *point, float t[2]) +void BKE_mask_calc_tangent_polyline(MaskSpline *spline, MaskSplinePoint *point, float t[2]) { float tvec_a[2], tvec_b[2]; MaskSplinePoint *point_prev, *point_next; - BKE_mask_get_handle_point_adjacent(mask, spline, point, + BKE_mask_get_handle_point_adjacent(spline, point, &point_prev, &point_next); if (point_prev) { @@ -1270,11 +1269,11 @@ void BKE_mask_calc_tangent_polyline(Mask *mask, MaskSpline *spline, MaskSplinePo normalize_v2(t); } -void BKE_mask_calc_handle_point(Mask *mask, MaskSpline *spline, MaskSplinePoint *point) +void BKE_mask_calc_handle_point(MaskSpline *spline, MaskSplinePoint *point) { MaskSplinePoint *point_prev, *point_next; - BKE_mask_get_handle_point_adjacent(mask, spline, point, + BKE_mask_get_handle_point_adjacent(spline, point, &point_prev, &point_next); mask_calc_point_handle(point, point_prev, point_next); @@ -1291,7 +1290,7 @@ static void enforce_dist_v2_v2fl(float v1[2], const float v2[2], const float dis } } -void BKE_mask_calc_handle_adjacent_interp(Mask *mask, MaskSpline *spline, MaskSplinePoint *point, const float u) +void BKE_mask_calc_handle_adjacent_interp(MaskSpline *spline, MaskSplinePoint *point, const float u) { /* TODO! - make this interpolate between siblings - not always midpoint! */ int length_tot = 0; @@ -1303,7 +1302,7 @@ void BKE_mask_calc_handle_adjacent_interp(Mask *mask, MaskSpline *spline, MaskSp BLI_assert(u >= 0.0f && u <= 1.0f); - BKE_mask_get_handle_point_adjacent(mask, spline, point, + BKE_mask_get_handle_point_adjacent(spline, point, &point_prev, &point_next); if (point_prev && point_next) { @@ -1344,7 +1343,7 @@ void BKE_mask_calc_handle_adjacent_interp(Mask *mask, MaskSpline *spline, MaskSp * * Useful for giving sane defaults. */ -void BKE_mask_calc_handle_point_auto(Mask *mask, MaskSpline *spline, MaskSplinePoint *point, +void BKE_mask_calc_handle_point_auto(MaskSpline *spline, MaskSplinePoint *point, const short do_recalc_length) { MaskSplinePoint *point_prev, *point_next; @@ -1353,7 +1352,7 @@ void BKE_mask_calc_handle_point_auto(Mask *mask, MaskSpline *spline, MaskSplineP (len_v3v3(point->bezt.vec[0], point->bezt.vec[1]) + len_v3v3(point->bezt.vec[1], point->bezt.vec[2])) / 2.0f; - BKE_mask_get_handle_point_adjacent(mask, spline, point, + BKE_mask_get_handle_point_adjacent(spline, point, &point_prev, &point_next); point->bezt.h1 = HD_AUTO; @@ -1370,25 +1369,33 @@ void BKE_mask_calc_handle_point_auto(Mask *mask, MaskSpline *spline, MaskSplineP } } +void BKE_mask_layer_calc_handles(MaskLayer *masklay) +{ + MaskSpline *spline; + for (spline = masklay->splines.first; spline; spline = spline->next) { + int i; + for (i = 0; i < spline->tot_point; i++) { + BKE_mask_calc_handle_point(spline, &spline->points[i]); + } + } +} + +void BKE_mask_layer_calc_handles_deform(MaskLayer *masklay) +{ + MaskSpline *spline; + for (spline = masklay->splines.first; spline; spline = spline->next) { + int i; + for (i = 0; i < spline->tot_point; i++) { + BKE_mask_calc_handle_point(spline, &spline->points_deform[i]); + } + } +} + void BKE_mask_calc_handles(Mask *mask) { MaskLayer *masklay; - for (masklay = mask->masklayers.first; masklay; masklay = masklay->next) { - MaskSpline *spline; - - for (spline = masklay->splines.first; spline; spline = spline->next) { - int i; - - for (i = 0; i < spline->tot_point; i++) { - BKE_mask_calc_handle_point(mask, spline, &spline->points[i]); - - /* could be done in a different function... */ - if (spline->points_deform) { - BKE_mask_calc_handle_point(mask, spline, &spline->points[i]); - } - } - } + BKE_mask_layer_calc_handles(masklay); } } @@ -1501,9 +1508,10 @@ void BKE_mask_evaluate(Mask *mask, float ctime, const int do_newframe) for (masklay = mask->masklayers.first; masklay; masklay = masklay->next) { MaskSpline *spline; - int i; for (spline = masklay->splines.first; spline; spline = spline->next) { + int i; + int has_auto = FALSE; BKE_mask_spline_ensure_deform(spline); @@ -1522,7 +1530,22 @@ void BKE_mask_evaluate(Mask *mask, float ctime, const int do_newframe) add_v2_v2(point_deform->bezt.vec[1], delta); add_v2_v2(point_deform->bezt.vec[2], delta); } + + if (point->bezt.h1 == HD_AUTO) { + has_auto = TRUE; + } + } + + /* if the spline has auto handles, these need to be recalculated after deformation */ + if (has_auto) { + for (i = 0; i < spline->tot_point; i++) { + MaskSplinePoint *point_deform = &spline->points_deform[i]; + if (point_deform->bezt.h1 == HD_AUTO) { + BKE_mask_calc_handle_point(spline, point_deform); + } + } } + /* end extra calc handles loop */ } } } diff --git a/source/blender/blenkernel/intern/mesh.c b/source/blender/blenkernel/intern/mesh.c index ed93f27fe5c..d0b9e73e295 100644 --- a/source/blender/blenkernel/intern/mesh.c +++ b/source/blender/blenkernel/intern/mesh.c @@ -2038,6 +2038,28 @@ void BKE_mesh_convert_mfaces_to_mpolys(Mesh *mesh) mesh_update_customdata_pointers(mesh, TRUE); } +/* the same as BKE_mesh_convert_mfaces_to_mpolys but oriented to be used in do_versions from readfile.c + * the difference is how active/render/clone/stencil indices are handled here + * + * normally thay're being set from pdata which totally makes sense for meshes which are already + * converted to bmesh structures, but when loading older files indices shall be updated in other + * way around, so newly added pdata and ldata would have this indices set based on fdata layer + * + * this is normally only needed when reading older files, in all other cases BKE_mesh_convert_mfaces_to_mpolys + * shall be always used + */ +void BKE_mesh_do_versions_convert_mfaces_to_mpolys(Mesh *mesh) +{ + BKE_mesh_convert_mfaces_to_mpolys_ex(&mesh->id, &mesh->fdata, &mesh->ldata, &mesh->pdata, + mesh->totedge, mesh->totface, mesh->totloop, mesh->totpoly, + mesh->medge, mesh->mface, + &mesh->totloop, &mesh->totpoly, &mesh->mloop, &mesh->mpoly); + + CustomData_bmesh_do_versions_update_active_layers(&mesh->fdata, &mesh->pdata, &mesh->ldata); + + mesh_update_customdata_pointers(mesh, TRUE); +} + void BKE_mesh_convert_mfaces_to_mpolys_ex(ID *id, CustomData *fdata, CustomData *ldata, CustomData *pdata, int totedge_i, int totface_i, int totloop_i, int totpoly_i, MEdge *medge, MFace *mface, diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c index 04631729d7a..a01024acfd3 100644 --- a/source/blender/blenkernel/intern/object.c +++ b/source/blender/blenkernel/intern/object.c @@ -115,8 +115,6 @@ #include "GPU_material.h" /* Local function protos */ -static void solve_parenting(Scene *scene, Object *ob, Object *par, float obmat[][4], float slowmat[][4], int simul); - float originmat[3][3]; /* after BKE_object_where_is_calc(), can be used in other functions (bad!) */ void BKE_object_workob_clear(Object *workob) @@ -1904,109 +1902,6 @@ static void ob_parvert3(Object *ob, Object *par, float mat[][4]) } } -static int where_is_object_parslow(Object *ob, float obmat[4][4], float slowmat[4][4]) -{ - float *fp1, *fp2; - float fac1, fac2; - int a; - - // include framerate - fac1 = (1.0f / (1.0f + fabsf(ob->sf)) ); - if (fac1 >= 1.0f) return 0; - fac2 = 1.0f - fac1; - - fp1 = obmat[0]; - fp2 = slowmat[0]; - for (a = 0; a < 16; a++, fp1++, fp2++) { - fp1[0] = fac1 * fp1[0] + fac2 * fp2[0]; - } - - return 1; -} - -void BKE_object_where_is_calc_time(Scene *scene, Object *ob, float ctime) -{ - float slowmat[4][4] = MAT4_UNITY; - float stime = ctime; - - /* new version: correct parent+vertexparent and track+parent */ - /* this one only calculates direct attached parent and track */ - /* is faster, but should keep track of timeoffs */ - - if (ob == NULL) return; - - /* execute drivers only, as animation has already been done */ - BKE_animsys_evaluate_animdata(scene, &ob->id, ob->adt, ctime, ADT_RECALC_DRIVERS); - - if (ob->parent) { - Object *par = ob->parent; - - /* hurms, code below conflicts with depgraph... (ton) */ - /* and even worse, it gives bad effects for NLA stride too (try ctime != par->ctime, with MBlur) */ - if (stime != par->ctime) { - // only for ipo systems? - Object tmp = *par; - - if (par->proxy_from) ; // was a copied matrix, no where_is! bad... - else BKE_object_where_is_calc_time(scene, par, ctime); - - solve_parenting(scene, ob, par, ob->obmat, slowmat, 0); - - *par = tmp; - } - else - solve_parenting(scene, ob, par, ob->obmat, slowmat, 0); - - /* "slow parent" is definitely not threadsafe, and may also give bad results jumping around - * An old-fashioned hack which probably doesn't really cut it anymore - */ - if (ob->partype & PARSLOW) { - if (!where_is_object_parslow(ob, ob->obmat, slowmat)) - return; - } - } - else { - BKE_object_to_mat4(ob, ob->obmat); - } - - /* solve constraints */ - if (ob->constraints.first && !(ob->transflag & OB_NO_CONSTRAINTS)) { - bConstraintOb *cob; - - cob = constraints_make_evalob(scene, ob, NULL, CONSTRAINT_OBTYPE_OBJECT); - - /* constraints need ctime, not stime. Some call BKE_object_where_is_calc_time and bsystem_time */ - solve_constraints(&ob->constraints, cob, ctime); - - constraints_clear_evalob(cob); - } - - /* set negative scale flag in object */ - if (is_negative_m4(ob->obmat)) ob->transflag |= OB_NEG_SCALE; - else ob->transflag &= ~OB_NEG_SCALE; -} - -/* get object transformation matrix without recalculating dependencies and - * constraints -- assume dependencies are already solved by depsgraph. - * no changes to object and it's parent would be done. - * used for bundles orientation in 3d space relative to parented blender camera */ -void BKE_object_where_is_calc_mat4(Scene *scene, Object *ob, float obmat[4][4]) -{ - float slowmat[4][4] = MAT4_UNITY; - - if (ob->parent) { - Object *par = ob->parent; - - solve_parenting(scene, ob, par, obmat, slowmat, 1); - - if (ob->partype & PARSLOW) - where_is_object_parslow(ob, obmat, slowmat); - } - else { - BKE_object_to_mat4(ob, obmat); - } -} - static void solve_parenting(Scene *scene, Object *ob, Object *par, float obmat[][4], float slowmat[][4], int simul) { float totmat[4][4]; @@ -2028,11 +1923,11 @@ static void solve_parenting(Scene *scene, Object *ob, Object *par, float obmat[] ok = 1; } } - + if (ok) mul_serie_m4(totmat, par->obmat, tmat, NULL, NULL, NULL, NULL, NULL, NULL); else copy_m4_m4(totmat, par->obmat); - + break; case PARBONE: ob_parbone(ob, par, tmat); @@ -2052,7 +1947,7 @@ static void solve_parenting(Scene *scene, Object *ob, Object *par, float obmat[] break; case PARVERT3: ob_parvert3(ob, par, tmat); - + mul_serie_m4(totmat, par->obmat, tmat, NULL, NULL, NULL, NULL, NULL, NULL); break; @@ -2083,7 +1978,87 @@ static void solve_parenting(Scene *scene, Object *ob, Object *par, float obmat[] copy_v3_v3(ob->orig, totmat[3]); } } +} + +static int where_is_object_parslow(Object *ob, float obmat[4][4], float slowmat[4][4]) +{ + float *fp1, *fp2; + float fac1, fac2; + int a; + + // include framerate + fac1 = (1.0f / (1.0f + fabsf(ob->sf)) ); + if (fac1 >= 1.0f) return 0; + fac2 = 1.0f - fac1; + + fp1 = obmat[0]; + fp2 = slowmat[0]; + for (a = 0; a < 16; a++, fp1++, fp2++) { + fp1[0] = fac1 * fp1[0] + fac2 * fp2[0]; + } + + return 1; +} + +void BKE_object_where_is_calc_time(Scene *scene, Object *ob, float ctime) +{ + if (ob == NULL) return; + + /* execute drivers only, as animation has already been done */ + BKE_animsys_evaluate_animdata(scene, &ob->id, ob->adt, ctime, ADT_RECALC_DRIVERS); + + if (ob->parent) { + Object *par = ob->parent; + float slowmat[4][4] = MAT4_UNITY; + + /* calculate parent matrix */ + solve_parenting(scene, ob, par, ob->obmat, slowmat, 0); + + /* "slow parent" is definitely not threadsafe, and may also give bad results jumping around + * An old-fashioned hack which probably doesn't really cut it anymore + */ + if (ob->partype & PARSLOW) { + if (!where_is_object_parslow(ob, ob->obmat, slowmat)) + return; + } + } + else { + BKE_object_to_mat4(ob, ob->obmat); + } + + /* solve constraints */ + if (ob->constraints.first && !(ob->transflag & OB_NO_CONSTRAINTS)) { + bConstraintOb *cob; + + cob = constraints_make_evalob(scene, ob, NULL, CONSTRAINT_OBTYPE_OBJECT); + solve_constraints(&ob->constraints, cob, ctime); + constraints_clear_evalob(cob); + } + + /* set negative scale flag in object */ + if (is_negative_m4(ob->obmat)) ob->transflag |= OB_NEG_SCALE; + else ob->transflag &= ~OB_NEG_SCALE; +} +/* get object transformation matrix without recalculating dependencies and + * constraints -- assume dependencies are already solved by depsgraph. + * no changes to object and it's parent would be done. + * used for bundles orientation in 3d space relative to parented blender camera */ +void BKE_object_where_is_calc_mat4(Scene *scene, Object *ob, float obmat[4][4]) +{ + float slowmat[4][4] = MAT4_UNITY; + + if (ob->parent) { + Object *par = ob->parent; + + solve_parenting(scene, ob, par, obmat, slowmat, 1); + + if (ob->partype & PARSLOW) + where_is_object_parslow(ob, obmat, slowmat); + } + else { + BKE_object_to_mat4(ob, obmat); + } } void BKE_object_where_is_calc(struct Scene *scene, Object *ob) @@ -2091,7 +2066,6 @@ void BKE_object_where_is_calc(struct Scene *scene, Object *ob) BKE_object_where_is_calc_time(scene, ob, (float)scene->r.cfra); } - void BKE_object_where_is_calc_simul(Scene *scene, Object *ob) /* was written for the old game engine (until 2.04) */ /* It seems that this function is only called diff --git a/source/blender/blenkernel/intern/particle_system.c b/source/blender/blenkernel/intern/particle_system.c index f19dfe74a36..6c7336958b5 100644 --- a/source/blender/blenkernel/intern/particle_system.c +++ b/source/blender/blenkernel/intern/particle_system.c @@ -2363,13 +2363,12 @@ static EdgeHash *sph_springhash_build(ParticleSystem *psys) } #define SPH_NEIGHBORS 512 -typedef struct SPHNeighbor -{ +typedef struct SPHNeighbor { ParticleSystem *psys; int index; } SPHNeighbor; -typedef struct SPHRangeData -{ + +typedef struct SPHRangeData { SPHNeighbor neighbors[SPH_NEIGHBORS]; int tot_neighbors; @@ -2641,8 +2640,7 @@ static void sph_integrate(ParticleSimulationData *sim, ParticleData *pa, float d /************************************************/ /* Basic physics */ /************************************************/ -typedef struct EfData -{ +typedef struct EfData { ParticleTexture ptex; ParticleSimulationData *sim; ParticleData *pa; diff --git a/source/blender/blenkernel/intern/scene.c b/source/blender/blenkernel/intern/scene.c index d9f1a6372ee..1113555e3bf 100644 --- a/source/blender/blenkernel/intern/scene.c +++ b/source/blender/blenkernel/intern/scene.c @@ -610,8 +610,6 @@ void BKE_scene_set_background(Main *bmain, Scene *scene) /* not too nice... for recovering objects with lost data */ //if (ob->pose == NULL) base->flag &= ~OB_POSEMODE; ob->flag = base->flag; - - ob->ctime = -1234567.0; /* force ipo to be calculated later */ } /* no full animation update, this to enable render code to work (render code calls own animation updates) */ } diff --git a/source/blender/blenkernel/intern/seqcache.c b/source/blender/blenkernel/intern/seqcache.c index f1f3dd47d8b..ea4699f8495 100644 --- a/source/blender/blenkernel/intern/seqcache.c +++ b/source/blender/blenkernel/intern/seqcache.c @@ -38,8 +38,7 @@ #include "IMB_moviecache.h" -typedef struct seqCacheKey -{ +typedef struct seqCacheKey { struct Sequence * seq; SeqRenderData context; float cfra; diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index 588a6826919..cc5abce64f3 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -3684,7 +3684,7 @@ static void lib_link_mesh(FileData *fd, Main *main) Main *gmain = G.main; G.main = main; - BKE_mesh_convert_mfaces_to_mpolys(me); + BKE_mesh_do_versions_convert_mfaces_to_mpolys(me); G.main = gmain; } diff --git a/source/blender/bmesh/intern/bmesh_marking.h b/source/blender/bmesh/intern/bmesh_marking.h index 12ebaedac60..406971652dc 100644 --- a/source/blender/bmesh/intern/bmesh_marking.h +++ b/source/blender/bmesh/intern/bmesh_marking.h @@ -27,8 +27,7 @@ * \ingroup bmesh */ -typedef struct BMEditSelection -{ +typedef struct BMEditSelection { struct BMEditSelection *next, *prev; BMElem *ele; char htype; @@ -82,7 +81,7 @@ void BM_editselection_plane(BMEditSelection *ese, float r_plane[3]); #define BM_select_history_store_notest(bm, ele) _bm_select_history_store_notest(bm, &(ele)->head) #define BM_select_history_store(bm, ele) _bm_select_history_store(bm, &(ele)->head) -int _bm_select_history_check(BMesh *bm, const BMHeader *ele); +int _bm_select_history_check(BMesh *bm, const BMHeader *ele); int _bm_select_history_remove(BMesh *bm, BMHeader *ele); void _bm_select_history_store_notest(BMesh *bm, BMHeader *ele); void _bm_select_history_store(BMesh *bm, BMHeader *ele); diff --git a/source/blender/editors/armature/editarmature_retarget.c b/source/blender/editors/armature/editarmature_retarget.c index d90bd96a6f1..91c342ec070 100644 --- a/source/blender/editors/armature/editarmature_retarget.c +++ b/source/blender/editors/armature/editarmature_retarget.c @@ -81,20 +81,17 @@ typedef struct RetargetParam { bContext *context; } RetargetParam; -typedef enum -{ +typedef enum { RETARGET_LENGTH, RETARGET_AGGRESSIVE } RetargetMode; -typedef enum -{ +typedef enum { METHOD_BRUTE_FORCE = 0, METHOD_MEMOIZE = 1 } RetargetMethod; -typedef enum -{ +typedef enum { ARC_FREE = 0, ARC_TAKEN = 1, ARC_USED = 2 diff --git a/source/blender/editors/include/ED_transform.h b/source/blender/editors/include/ED_transform.h index c4d7197bfa1..42036d1ea17 100644 --- a/source/blender/editors/include/ED_transform.h +++ b/source/blender/editors/include/ED_transform.h @@ -168,8 +168,7 @@ typedef struct DepthPeel { struct ListBase; -typedef enum SnapMode -{ +typedef enum SnapMode { SNAP_ALL = 0, SNAP_NOT_SELECTED = 1, SNAP_NOT_OBEDIT = 2 diff --git a/source/blender/editors/mask/mask_add.c b/source/blender/editors/mask/mask_add.c index f8c36e866d7..7ffff2b06e5 100644 --- a/source/blender/editors/mask/mask_add.c +++ b/source/blender/editors/mask/mask_add.c @@ -235,7 +235,7 @@ static void setup_vertex_point(bContext *C, Mask *mask, MaskSpline *spline, Mask add_v2_v2(bezt->vec[2], vec); if (reference_adjacent) { - BKE_mask_calc_handle_adjacent_interp(mask, spline, new_point, u); + BKE_mask_calc_handle_adjacent_interp(spline, new_point, u); } } else { @@ -287,8 +287,8 @@ static void setup_vertex_point(bContext *C, Mask *mask, MaskSpline *spline, Mask add_v2_v2(bezt->vec[0], vec); sub_v2_v2(bezt->vec[2], vec); #else - BKE_mask_calc_handle_point_auto(mask, spline, new_point, TRUE); - BKE_mask_calc_handle_adjacent_interp(mask, spline, new_point, u); + BKE_mask_calc_handle_point_auto(spline, new_point, TRUE); + BKE_mask_calc_handle_adjacent_interp(spline, new_point, u); #endif } @@ -425,7 +425,7 @@ static int add_vertex_extrude(bContext *C, Mask *mask, MaskLayer *masklay, const if ((spline->flag & MASK_SPLINE_CYCLIC) || (point_index > 0 && point_index != spline->tot_point - 1)) { - BKE_mask_calc_tangent_polyline(mask, spline, point, tangent_point); + BKE_mask_calc_tangent_polyline(spline, point, tangent_point); sub_v2_v2v2(tangent_co, co, point->bezt.vec[1]); if (dot_v2v2(tangent_point, tangent_co) < 0.0f) { @@ -487,7 +487,7 @@ static int add_vertex_extrude(bContext *C, Mask *mask, MaskLayer *masklay, const if (do_recalc_src) { /* TODO, update keyframes in time */ - BKE_mask_calc_handle_point_auto(mask, spline, ref_point, FALSE); + BKE_mask_calc_handle_point_auto(spline, ref_point, FALSE); } WM_event_add_notifier(C, NC_MASK | NA_EDITED, mask); @@ -572,8 +572,8 @@ static int add_vertex_exec(bContext *C, wmOperator *op) spline->flag |= MASK_SPLINE_CYCLIC; /* TODO, update keyframes in time */ - BKE_mask_calc_handle_point_auto(mask, spline, point, FALSE); - BKE_mask_calc_handle_point_auto(mask, spline, point_other, FALSE); + BKE_mask_calc_handle_point_auto(spline, point, FALSE); + BKE_mask_calc_handle_point_auto(spline, point_other, FALSE); /* TODO: only update this spline */ BKE_mask_update_display(mask, CTX_data_scene(C)->r.cfra); diff --git a/source/blender/editors/space_file/filelist.c b/source/blender/editors/space_file/filelist.c index d84214413da..a535e888156 100644 --- a/source/blender/editors/space_file/filelist.c +++ b/source/blender/editors/space_file/filelist.c @@ -102,8 +102,7 @@ typedef struct ThumbnailJob { ReportList reports; } ThumbnailJob; -typedef struct FileList -{ +typedef struct FileList { struct direntry *filelist; int *fidx; int numfiles; @@ -124,8 +123,7 @@ typedef struct FileList } FileList; -typedef struct FolderList -{ +typedef struct FolderList { struct FolderList *next, *prev; char *foldername; } FolderList; diff --git a/source/blender/editors/space_file/filelist.h b/source/blender/editors/space_file/filelist.h index fac6a387b9f..7a37c5fb3c5 100644 --- a/source/blender/editors/space_file/filelist.h +++ b/source/blender/editors/space_file/filelist.h @@ -53,8 +53,7 @@ typedef enum FileSelType { FILE_SEL_TOGGLE = 2 } FileSelType; -typedef enum FileCheckType -{ +typedef enum FileCheckType { CHECK_DIRS = 1, CHECK_FILES = 2, CHECK_ALL = 3 diff --git a/source/blender/editors/space_node/node_intern.h b/source/blender/editors/space_node/node_intern.h index 35b1583b24e..9e873799f1c 100644 --- a/source/blender/editors/space_node/node_intern.h +++ b/source/blender/editors/space_node/node_intern.h @@ -50,8 +50,7 @@ struct bNodeLink; struct Main; /* temp data to pass on to modal */ -typedef struct bNodeLinkDrag -{ +typedef struct bNodeLinkDrag { struct bNodeLinkDrag *next, *prev; /* List of links dragged by the operator. diff --git a/source/blender/editors/space_outliner/outliner_draw.c b/source/blender/editors/space_outliner/outliner_draw.c index 547e8288d20..483016b7e00 100644 --- a/source/blender/editors/space_outliner/outliner_draw.c +++ b/source/blender/editors/space_outliner/outliner_draw.c @@ -69,6 +69,9 @@ #include "outliner_intern.h" +/* disable - this is far too slow - campbell */ +// #define USE_GROUP_SELECT + /* ****************************************************** */ /* Tree Size Functions */ @@ -207,6 +210,7 @@ static int group_restrict_flag(Group *gr, int flag) return 1; } +#ifdef USE_GROUP_SELECT static int group_select_flag(Group *gr) { GroupObject *gob; @@ -217,6 +221,7 @@ static int group_select_flag(Group *gr) return 0; } +#endif void restrictbutton_gr_restrict_flag(void *poin, void *poin2, int flag) { @@ -422,16 +427,26 @@ static void outliner_draw_restrictbuts(uiBlock *block, Scene *scene, ARegion *ar gr = (Group *)tselem->id; uiBlockSetEmboss(block, UI_EMBOSSN); - + +#ifndef USE_GROUP_SELECT + restrict_bool = FALSE; +#endif + +#ifdef USE_GROUP_SELECT restrict_bool = group_restrict_flag(gr, OB_RESTRICT_VIEW); +#endif bt = uiDefIconBut(block, ICONTOG, 0, restrict_bool ? ICON_RESTRICT_VIEW_ON : ICON_RESTRICT_VIEW_OFF, (int)ar->v2d.cur.xmax - OL_TOG_RESTRICT_VIEWX, (int)te->ys, UI_UNIT_X - 1, UI_UNIT_Y - 1, NULL, 0, 0, 0, 0, "Restrict/Allow visibility in the 3D View"); uiButSetFunc(bt, restrictbutton_gr_restrict_view, scene, gr); +#ifdef USE_GROUP_SELECT restrict_bool = group_restrict_flag(gr, OB_RESTRICT_SELECT); +#endif bt = uiDefIconBut(block, ICONTOG, 0, restrict_bool ? ICON_RESTRICT_SELECT_ON : ICON_RESTRICT_SELECT_OFF, (int)ar->v2d.cur.xmax - OL_TOG_RESTRICT_SELECTX, (int)te->ys, UI_UNIT_X - 1, UI_UNIT_Y - 1, NULL, 0, 0, 0, 0, "Restrict/Allow selection in the 3D View"); uiButSetFunc(bt, restrictbutton_gr_restrict_select, scene, gr); - + +#ifdef USE_GROUP_SELECT restrict_bool = group_restrict_flag(gr, OB_RESTRICT_RENDER); +#endif bt = uiDefIconBut(block, ICONTOG, 0, restrict_bool ? ICON_RESTRICT_RENDER_ON : ICON_RESTRICT_RENDER_OFF, (int)ar->v2d.cur.xmax - OL_TOG_RESTRICT_RENDERX, (int)te->ys, UI_UNIT_X - 1, UI_UNIT_Y - 1, NULL, 0, 0, 0, 0, "Restrict/Allow renderability"); uiButSetFunc(bt, restrictbutton_gr_restrict_render, scene, gr); @@ -1274,8 +1289,8 @@ static void outliner_draw_tree_element(bContext *C, uiBlock *block, Scene *scene } } else if (te->idcode == ID_GR) { +#ifdef USE_GROUP_SELECT Group *gr = (Group *)tselem->id; - if (group_select_flag(gr)) { char col[4]; UI_GetThemeColorType4ubv(TH_SELECT, SPACE_VIEW3D, col); @@ -1284,6 +1299,7 @@ static void outliner_draw_tree_element(bContext *C, uiBlock *block, Scene *scene active = 2; } +#endif } else if (te->idcode == ID_OB) { Object *ob = (Object *)tselem->id; diff --git a/source/blender/editors/space_outliner/outliner_tools.c b/source/blender/editors/space_outliner/outliner_tools.c index b556fbf5c9d..e656b1242ab 100644 --- a/source/blender/editors/space_outliner/outliner_tools.c +++ b/source/blender/editors/space_outliner/outliner_tools.c @@ -385,6 +385,18 @@ static void group_linkobs2scene_cb(bContext *UNUSED(C), Scene *scene, TreeElemen } } +static void group_instance_cb(bContext *C, Scene *scene, TreeElement *UNUSED(te), + TreeStoreElem *UNUSED(tsep), TreeStoreElem *tselem) +{ + Group *group = (Group *)tselem->id; + + Object *ob = ED_object_add_type(C, OB_EMPTY, scene->cursor, NULL, FALSE, scene->layact); + rename_id(&ob->id, group->id.name + 2); + ob->dup_group = group; + ob->transflag |= OB_DUPLIGROUP; + id_lib_extern(&group->id); +} + void outliner_do_object_operation(bContext *C, Scene *scene_act, SpaceOops *soops, ListBase *lb, void (*operation_cb)(bContext *C, Scene *scene, TreeElement *, TreeStoreElem *, TreeStoreElem *)) @@ -636,13 +648,14 @@ void OUTLINER_OT_object_operation(wmOperatorType *ot) /* **************************************** */ static EnumPropertyItem prop_group_op_types[] = { - {1, "UNLINK", 0, "Unlink", ""}, - {2, "LOCAL", 0, "Make Local", ""}, - {3, "LINK", 0, "Link Group Objects to Scene", ""}, - {4, "TOGVIS", 0, "Toggle Visible", ""}, - {5, "TOGSEL", 0, "Toggle Selectable", ""}, - {6, "TOGREN", 0, "Toggle Renderable", ""}, - {7, "RENAME", 0, "Rename", ""}, + {0, "UNLINK", 0, "Unlink Group", ""}, + {1, "LOCAL", 0, "Make Local Group", ""}, + {2, "LINK", 0, "Link Group Objects to Scene", ""}, + {3, "INSTANCE", 0, "Instance Group in Scene", ""}, + {4, "TOGVIS", 0, "Toggle Visible Group", ""}, + {5, "TOGSEL", 0, "Toggle Selectable", ""}, + {6, "TOGREN", 0, "Toggle Renderable", ""}, + {7, "RENAME", 0, "Rename", ""}, {0, NULL, 0, NULL, NULL} }; @@ -651,45 +664,36 @@ static int outliner_group_operation_exec(bContext *C, wmOperator *op) Scene *scene = CTX_data_scene(C); SpaceOops *soops = CTX_wm_space_outliner(C); int event; - const char *str = NULL; /* check for invalid states */ if (soops == NULL) return OPERATOR_CANCELLED; event = RNA_enum_get(op->ptr, "type"); - - if (event == 1) { - outliner_do_libdata_operation(C, scene, soops, &soops->tree, unlink_group_cb); - str = "Unlink group"; - } - else if (event == 2) { - outliner_do_libdata_operation(C, scene, soops, &soops->tree, id_local_cb); - str = "Localized Data"; - } - else if (event == 3) { - outliner_do_libdata_operation(C, scene, soops, &soops->tree, group_linkobs2scene_cb); - str = "Link Group Objects to Scene"; - } - else if (event == 4) { - outliner_do_libdata_operation(C, scene, soops, &soops->tree, group_toggle_visibility_cb); - str = "Toggle Visibility"; - } - else if (event == 5) { - outliner_do_libdata_operation(C, scene, soops, &soops->tree, group_toggle_selectability_cb); - str = "Toggle Selectability"; - } - else if (event == 6) { - outliner_do_libdata_operation(C, scene, soops, &soops->tree, group_toggle_renderability_cb); - str = "Toggle Renderability"; - } - else if (event == 7) { - outliner_do_libdata_operation(C, scene, soops, &soops->tree, item_rename_cb); - str = "Rename"; + + switch (event) { + case 0: outliner_do_libdata_operation(C, scene, soops, &soops->tree, unlink_group_cb); break; + case 1: outliner_do_libdata_operation(C, scene, soops, &soops->tree, id_local_cb); break; + case 2: outliner_do_libdata_operation(C, scene, soops, &soops->tree, group_linkobs2scene_cb); break; + case 3: outliner_do_libdata_operation(C, scene, soops, &soops->tree, group_instance_cb); break; + case 4: outliner_do_libdata_operation(C, scene, soops, &soops->tree, group_toggle_visibility_cb); break; + case 5: outliner_do_libdata_operation(C, scene, soops, &soops->tree, group_toggle_selectability_cb); break; + case 6: outliner_do_libdata_operation(C, scene, soops, &soops->tree, group_toggle_renderability_cb); break; + case 7: outliner_do_libdata_operation(C, scene, soops, &soops->tree, item_rename_cb); break; + default: + BLI_assert(0); + return OPERATOR_CANCELLED; } + + if (event == 3) { /* instance */ + Main *bmain = CTX_data_main(C); + + /* works without this except if you try render right after, see: 22027 */ + DAG_scene_sort(bmain, scene); + } - ED_undo_push(C, str); + ED_undo_push(C, prop_group_op_types[event].name); WM_event_add_notifier(C, NC_GROUP, NULL); return OPERATOR_FINISHED; diff --git a/source/blender/editors/space_view3d/drawarmature.c b/source/blender/editors/space_view3d/drawarmature.c index cb8b309dc72..7edf18136d2 100644 --- a/source/blender/editors/space_view3d/drawarmature.c +++ b/source/blender/editors/space_view3d/drawarmature.c @@ -1658,7 +1658,7 @@ static void bone_matrix_translate_y(float mat[][4], float y) /* assumes object is Armature with pose */ static void draw_pose_bones(Scene *scene, View3D *v3d, ARegion *ar, Base *base, int dt, const unsigned char ob_wire_col[4], - const short is_ghost, const short is_outline) + const short do_const_color, const short is_outline) { RegionView3D *rv3d = ar->regiondata; Object *ob = base->object; @@ -1753,8 +1753,13 @@ static void draw_pose_bones(Scene *scene, View3D *v3d, ARegion *ar, Base *base, if (bone == arm->act_bone) flag |= BONE_DRAW_ACTIVE; - /* set color-set to use */ - set_pchan_colorset(ob, pchan); + if (do_const_color) { + /* keep color */ + } + else { + /* set color-set to use */ + set_pchan_colorset(ob, pchan); + } if (use_custom) { /* if drawwire, don't try to draw in solid */ @@ -1828,10 +1833,10 @@ static void draw_pose_bones(Scene *scene, View3D *v3d, ARegion *ar, Base *base, } /* prepare colors */ - if (is_ghost) { + if (do_const_color) { /* 13 October 2009, Disabled this to make ghosting show the right colors (Aligorith) */ } - else if (arm->flag & ARM_POSEMODE) + else if (arm->flag & ARM_POSEMODE) set_pchan_colorset(ob, pchan); else { glColor3ubv(ob_wire_col); @@ -1950,7 +1955,12 @@ static void draw_pose_bones(Scene *scene, View3D *v3d, ARegion *ar, Base *base, /* extra draw service for pose mode */ /* set color-set to use */ - set_pchan_colorset(ob, pchan); + if (do_const_color) { + /* keep color */ + } + else { + set_pchan_colorset(ob, pchan); + } if ((pchan->custom) && !(arm->flag & ARM_NO_CUSTOM)) { /* custom bone shapes should not be drawn here! */ @@ -1985,20 +1995,35 @@ static void draw_pose_bones(Scene *scene, View3D *v3d, ARegion *ar, Base *base, glDisable(GL_CULL_FACE); /* draw DoFs */ - if (arm->flag & ARM_POSEMODE) - draw_pose_dofs(ob); + if (arm->flag & ARM_POSEMODE) { + if (((base->flag & OB_FROMDUPLI) == 0)) { + draw_pose_dofs(ob); + } + } /* finally names and axes */ - if ((arm->flag & (ARM_DRAWNAMES | ARM_DRAWAXES)) && (is_outline == 0)) { + if ((arm->flag & (ARM_DRAWNAMES | ARM_DRAWAXES)) && + (is_outline == 0) && + ((base->flag & OB_FROMDUPLI) == 0)) + { /* patch for several 3d cards (IBM mostly) that crash on GL_SELECT with text drawing */ if ((G.f & G_PICKSEL) == 0) { float vec[3]; - + unsigned char col[4]; - col[0] = ob_wire_col[0]; - col[1] = ob_wire_col[1]; - col[2] = ob_wire_col[2]; - col[3] = 255; + if (do_const_color) { + /* so we can draw bone names in current const color */ + float tcol[4]; + glGetFloatv(GL_CURRENT_COLOR, tcol); + rgb_float_to_uchar(col, tcol); + col[3] = 255; + } + else { + col[0] = ob_wire_col[0]; + col[1] = ob_wire_col[1]; + col[2] = ob_wire_col[2]; + col[3] = 255; + } if (v3d->zbuf) glDisable(GL_DEPTH_TEST); @@ -2546,11 +2571,8 @@ int draw_armature(Scene *scene, View3D *v3d, ARegion *ar, Base *base, if (dt > OB_WIRE && !ELEM(arm->drawtype, ARM_LINE, ARM_WIRE)) { /* we use color for solid lighting */ - glColorMaterial(GL_FRONT_AND_BACK, GL_SPECULAR); - glEnable(GL_COLOR_MATERIAL); - glColor3ub(255, 255, 255); // clear spec - glDisable(GL_COLOR_MATERIAL); - + const float white[4] = {1.0f, 1.0f, 1.0f, 1.0f}; + glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, white); glColorMaterial(GL_FRONT_AND_BACK, GL_DIFFUSE); glFrontFace((ob->transflag & OB_NEG_SCALE) ? GL_CW : GL_CCW); // only for lighting... } @@ -2602,7 +2624,7 @@ int draw_armature(Scene *scene, View3D *v3d, ARegion *ar, Base *base, } } } - draw_pose_bones(scene, v3d, ar, base, dt, ob_wire_col, FALSE, is_outline); + draw_pose_bones(scene, v3d, ar, base, dt, ob_wire_col, (flag & DRAW_CONSTCOLOR), is_outline); arm->flag &= ~ARM_POSEMODE; if (ob->mode & OB_MODE_POSE) diff --git a/source/blender/editors/space_view3d/drawmesh.c b/source/blender/editors/space_view3d/drawmesh.c index de1d9f22667..19696b2b0e0 100644 --- a/source/blender/editors/space_view3d/drawmesh.c +++ b/source/blender/editors/space_view3d/drawmesh.c @@ -1015,14 +1015,14 @@ void draw_mesh_paint(View3D *v3d, RegionView3D *rv3d, Object *ob, DerivedMesh *d if (ob && ob->mode & OB_MODE_WEIGHT_PAINT) { if (do_light) { + const float spec[4] = {0.47f, 0.47f, 0.47f, 0.47f}; + /* enforce default material settings */ GPU_enable_material(0, NULL); /* but set default spec */ glColorMaterial(GL_FRONT_AND_BACK, GL_SPECULAR); - glEnable(GL_COLOR_MATERIAL); /* according manpages needed */ - glColor3ub(120, 120, 120); - glDisable(GL_COLOR_MATERIAL); + glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, spec); /* diffuse */ glColorMaterial(GL_FRONT_AND_BACK, GL_DIFFUSE); diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c index 63dc6c21863..63780ebbd20 100644 --- a/source/blender/editors/space_view3d/drawobject.c +++ b/source/blender/editors/space_view3d/drawobject.c @@ -1231,19 +1231,23 @@ static void drawlamp(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base, /* lamp center */ copy_v3_v3(vec, ob->obmat[3]); - - /* for AA effects */ - curcol[0] = ob_wire_col[0]; - curcol[1] = ob_wire_col[1]; - curcol[2] = ob_wire_col[2]; - curcol[3] = 154; - glColor4ubv(curcol); + + if ((flag & DRAW_CONSTCOLOR) == 0) { + /* for AA effects */ + curcol[0] = ob_wire_col[0]; + curcol[1] = ob_wire_col[1]; + curcol[2] = ob_wire_col[2]; + curcol[3] = 154; + glColor4ubv(curcol); + } if (lampsize > 0.0f) { - if (ob->id.us > 1) { - if (ob == OBACT || (ob->flag & SELECT)) glColor4ub(0x88, 0xFF, 0xFF, 155); - else glColor4ub(0x77, 0xCC, 0xCC, 155); + if ((flag & DRAW_CONSTCOLOR) == 0) { + if (ob->id.us > 1) { + if (ob == OBACT || (ob->flag & SELECT)) glColor4ub(0x88, 0xFF, 0xFF, 155); + else glColor4ub(0x77, 0xCC, 0xCC, 155); + } } /* Inner Circle */ @@ -1253,8 +1257,10 @@ static void drawlamp(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base, drawcircball(GL_POLYGON, vec, lampsize, imat); /* restore */ - if (ob->id.us > 1) - glColor4ubv(curcol); + if ((flag & DRAW_CONSTCOLOR) == 0) { + if (ob->id.us > 1) + glColor4ubv(curcol); + } /* Outer circle */ circrad = 3.0f * lampsize; @@ -1486,9 +1492,10 @@ static void drawlamp(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base, glDisable(GL_BLEND); - /* restore for drawing extra stuff */ - glColor3ubv(ob_wire_col); - + if ((flag & DRAW_CONSTCOLOR) == 0) { + /* restore for drawing extra stuff */ + glColor3ubv(ob_wire_col); + } } static void draw_limit_line(float sta, float end, unsigned int col) @@ -3427,6 +3434,8 @@ static void draw_mesh_fancy(Scene *scene, ARegion *ar, View3D *v3d, RegionView3D dm->drawFacesSolid(dm, NULL, 0, GPU_enable_material); } else { + const float spec[4] = {0.47f, 0.47f, 0.47f, 0.47f}; + /* draw outline */ if ( (v3d->flag & V3D_SELECT_OUTLINE) && ((v3d->flag2 & V3D_RENDER_OVERRIDE) == 0) && @@ -3444,9 +3453,7 @@ static void draw_mesh_fancy(Scene *scene, ARegion *ar, View3D *v3d, RegionView3D /* set default spec */ glColorMaterial(GL_FRONT_AND_BACK, GL_SPECULAR); - glEnable(GL_COLOR_MATERIAL); /* according manpages needed */ - glColor3ub(120, 120, 120); - glDisable(GL_COLOR_MATERIAL); + glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, spec); /* diffuse */ glColorMaterial(GL_FRONT_AND_BACK, GL_DIFFUSE); glEnable(GL_LIGHTING); @@ -6540,7 +6547,8 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag) RegionView3D *rv3d = ar->regiondata; float vec1[3], vec2[3]; unsigned int col = 0; - unsigned char ob_wire_col[4]; + unsigned char _ob_wire_col[4]; /* dont initialize this */ + unsigned char *ob_wire_col = NULL; /* dont initialize this, use NULL crashes as a way to find invalid use */ int i, selstart, selend, empty_object = 0; short dt, dtx, zbufoff = 0; const short is_obact = (ob == OBACT); @@ -6578,9 +6586,6 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag) /* no return after this point, otherwise leaks */ view3d_cached_text_draw_begin(); - /* patch? children objects with a timeoffs change the parents. How to solve! */ - /* if ( ((int)ob->ctime) != F_(scene->r.cfra)) BKE_object_where_is_calc(scene, ob); */ - /* draw motion paths (in view space) */ if (ob->mpath && (v3d->flag2 & V3D_RENDER_OVERRIDE) == 0) { bAnimVizSettings *avs = &ob->avs; @@ -6604,7 +6609,8 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag) project_short(ar, ob->obmat[3], &base->sx); - draw_object_wire_color(scene, base, ob_wire_col, warning_recursive); + draw_object_wire_color(scene, base, _ob_wire_col, warning_recursive); + ob_wire_col = _ob_wire_col; glColor3ubv(ob_wire_col); } diff --git a/source/blender/editors/space_view3d/view3d_draw.c b/source/blender/editors/space_view3d/view3d_draw.c index 7c12816741d..a36c14151e6 100644 --- a/source/blender/editors/space_view3d/view3d_draw.c +++ b/source/blender/editors/space_view3d/view3d_draw.c @@ -1146,7 +1146,6 @@ static void drawviewborder(Scene *scene, ARegion *ar, View3D *v3d) /* border */ if (scene->r.mode & R_BORDER) { - cpack(0); x3 = x1 + scene->r.border.xmin * (x2 - x1); y3 = y1 + scene->r.border.ymin * (y2 - y1); @@ -2735,12 +2734,15 @@ static void draw_viewport_fps(Scene *scene, ARegion *ar) BLF_draw_default_ascii(22, ar->winy - 17, 0.0f, printable, sizeof(printable)); } -static int view3d_main_area_draw_engine(const bContext *C, ARegion *ar) +static void view3d_main_area_draw_objects(const bContext *C, ARegion *ar, const char **grid_unit); + +static int view3d_main_area_draw_engine(const bContext *C, ARegion *ar, int draw_border) { Scene *scene = CTX_data_scene(C); View3D *v3d = CTX_wm_view3d(C); RegionView3D *rv3d = CTX_wm_region_view3d(C); RenderEngineType *type; + GLint scissor[4]; /* create render engine */ if (!rv3d->render_engine) { @@ -2757,17 +2759,48 @@ static int view3d_main_area_draw_engine(const bContext *C, ARegion *ar) view3d_main_area_setup_view(scene, v3d, ar, NULL, NULL); /* background draw */ + ED_region_pixelspace(ar); + + if (draw_border) { + /* for border draw, we only need to clear a subset of the 3d view */ + rctf viewborder; + rcti cliprct; + + ED_view3d_calc_camera_border(scene, ar, v3d, rv3d, &viewborder, FALSE); + + cliprct.xmin = viewborder.xmin + scene->r.border.xmin * (viewborder.xmax - viewborder.xmin); + cliprct.ymin = viewborder.ymin + scene->r.border.ymin * (viewborder.ymax - viewborder.ymin); + cliprct.xmax = viewborder.xmin + scene->r.border.xmax * (viewborder.xmax - viewborder.xmin); + cliprct.ymax = viewborder.ymin + scene->r.border.ymax * (viewborder.ymax - viewborder.ymin); + + cliprct.xmin += ar->winrct.xmin; + cliprct.xmax += ar->winrct.xmin; + cliprct.ymin += ar->winrct.ymin; + cliprct.ymax += ar->winrct.ymin; + + cliprct.xmin = MAX2(cliprct.xmin, ar->winrct.xmin); + cliprct.ymin = MAX2(cliprct.ymin, ar->winrct.ymin); + cliprct.xmax = MIN2(cliprct.xmax, ar->winrct.xmax); + cliprct.ymax = MIN2(cliprct.ymax, ar->winrct.ymax); + + glGetIntegerv(GL_SCISSOR_BOX, scissor); + glScissor(cliprct.xmin, cliprct.ymin, cliprct.xmax - cliprct.xmin, cliprct.ymax - cliprct.ymin); + } + glClearColor(0.0f, 0.0f, 0.0f, 0.0f); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); - ED_region_pixelspace(ar); - - /* render result draw */ if (v3d->flag & V3D_DISPBGPICS) view3d_draw_bgpic(scene, ar, v3d, FALSE, TRUE); else fdrawcheckerboard(0, 0, ar->winx, ar->winy); + if (draw_border) { + /* restore scissor as it was before */ + glScissor(scissor[0], scissor[1], scissor[2], scissor[3]); + } + + /* render result draw */ type = rv3d->render_engine->type; type->view_draw(rv3d->render_engine, C); @@ -3028,15 +3061,21 @@ static void view3d_main_area_draw_info(const bContext *C, ARegion *ar, const cha void view3d_main_area_draw(const bContext *C, ARegion *ar) { + Scene *scene = CTX_data_scene(C); View3D *v3d = CTX_wm_view3d(C); + RegionView3D *rv3d = CTX_wm_region_view3d(C); const char *grid_unit = NULL; + int draw_border = (rv3d->persp == RV3D_CAMOB && (scene->r.mode & R_BORDER)); - /* draw viewport using external renderer? */ - if (!(v3d->drawtype == OB_RENDER && view3d_main_area_draw_engine(C, ar))) { - /* draw viewport using opengl */ + /* draw viewport using opengl */ + if (v3d->drawtype != OB_RENDER || draw_border) { view3d_main_area_draw_objects(C, ar, &grid_unit); ED_region_pixelspace(ar); } + + /* draw viewport using external renderer */ + if (v3d->drawtype == OB_RENDER) + view3d_main_area_draw_engine(C, ar, draw_border); view3d_main_area_draw_info(C, ar, grid_unit); diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c index c99c4b8a50c..fb28afbbdd9 100644 --- a/source/blender/editors/transform/transform.c +++ b/source/blender/editors/transform/transform.c @@ -5216,7 +5216,7 @@ void initEdgeSlide(TransInfo *t) int handleEventEdgeSlide(struct TransInfo *t, struct wmEvent *event) { - if (t->flag & TFM_EDGE_SLIDE) { + if (t->mode == TFM_EDGE_SLIDE) { SlideData *sld = t->customData; if (sld) { @@ -5258,7 +5258,7 @@ int handleEventEdgeSlide(struct TransInfo *t, struct wmEvent *event) void drawNonPropEdge(const struct bContext *C, TransInfo *t) { - if (t->flag & TFM_EDGE_SLIDE) { + if (t->mode == TFM_EDGE_SLIDE) { SlideData *sld = (SlideData *)t->customData; /* Non-Prop mode */ if (sld && sld->is_proportional == FALSE) { diff --git a/source/blender/editors/transform/transform_conversions.c b/source/blender/editors/transform/transform_conversions.c index 2637d9e3b9b..38ac8c2999c 100644 --- a/source/blender/editors/transform/transform_conversions.c +++ b/source/blender/editors/transform/transform_conversions.c @@ -5878,7 +5878,7 @@ void flushTransTracking(TransInfo *t) /* * masking * */ -typedef struct TransDataMasking{ +typedef struct TransDataMasking { int is_handle; float handle[2], orig_handle[2]; diff --git a/source/blender/editors/transform/transform_ops.c b/source/blender/editors/transform/transform_ops.c index 4ea89de9070..52b32ae66fc 100644 --- a/source/blender/editors/transform/transform_ops.c +++ b/source/blender/editors/transform/transform_ops.c @@ -51,8 +51,7 @@ #include "transform.h" -typedef struct TransformModeItem -{ +typedef struct TransformModeItem { char *idname; int mode; void (*opfunc)(wmOperatorType*); diff --git a/source/blender/gpu/shaders/gpu_shader_material.glsl b/source/blender/gpu/shaders/gpu_shader_material.glsl index b9bd7e961f8..fb248f1b016 100644 --- a/source/blender/gpu/shaders/gpu_shader_material.glsl +++ b/source/blender/gpu/shaders/gpu_shader_material.glsl @@ -1261,8 +1261,8 @@ void mtex_bump_bicubic( vec3 texco, sampler2D ima, float hScale, mat4 H; - for(int i = 0; i < 4; i++){ - for(int j = 0; j < 4; j++){ + for(int i = 0; i < 4; i++) { + for(int j = 0; j < 4; j++) { ivec2 iTexTmp = iTexLocMod + ivec2(i,j); // wrap texture coordinates manually for texelFetch to work on uvs oitside the 0,1 range. diff --git a/source/blender/ikplugin/CMakeLists.txt b/source/blender/ikplugin/CMakeLists.txt index 87b0c6c671a..f37b254d719 100644 --- a/source/blender/ikplugin/CMakeLists.txt +++ b/source/blender/ikplugin/CMakeLists.txt @@ -57,8 +57,5 @@ if(WITH_IK_ITASC) ) endif() -if(WIN32) - add_definitions(-DEIGEN_DONT_ALIGN_STATICALLY) -endif() blender_add_lib(bf_ikplugin "${SRC}" "${INC}" "${INC_SYS}") diff --git a/source/blender/ikplugin/SConscript b/source/blender/ikplugin/SConscript index 4cff3399fdc..38c53894df8 100644 --- a/source/blender/ikplugin/SConscript +++ b/source/blender/ikplugin/SConscript @@ -8,7 +8,4 @@ incs += ' ../blenkernel ../include ../ikplugin #/intern/itasc #/extern/Eigen3' defs.append('WITH_IK_ITASC') -if env['PLATFORM'] == 'win32': - defs.append('EIGEN_DONT_ALIGN_STATICALLY') - env.BlenderLib ( 'bf_ikplugin', sources, Split(incs), defs, libtype=['core','player'], priority=[180, 190] ) diff --git a/source/blender/ikplugin/intern/itasc_plugin.cpp b/source/blender/ikplugin/intern/itasc_plugin.cpp index ebbb201de8e..048dd955726 100644 --- a/source/blender/ikplugin/intern/itasc_plugin.cpp +++ b/source/blender/ikplugin/intern/itasc_plugin.cpp @@ -1000,7 +1000,7 @@ static void convert_pose(IK_Scene *ikscene) // assume uniform scaling and take Y scale as general scale for the armature scale = len_v3(ikscene->blArmature->obmat[1]); - rot = (ikscene->jointArray.rows() > 0) ? &ikscene->jointArray(0) : NULL; + rot = ikscene->jointArray(0); for (joint=a=0, ikchan = ikscene->channels; a<ikscene->numchan && joint<ikscene->numjoint; ++a, ++ikchan) { pchan= ikchan->pchan; bone= pchan->bone; @@ -1041,7 +1041,7 @@ static void BKE_pose_rest(IK_Scene *ikscene) // rest pose is 0 SetToZero(ikscene->jointArray); // except for transY joints - rot = (ikscene->jointArray.rows() > 0) ? &ikscene->jointArray(0) : NULL; + rot = ikscene->jointArray(0); for (joint=a=0, ikchan = ikscene->channels; a<ikscene->numchan && joint<ikscene->numjoint; ++a, ++ikchan) { pchan= ikchan->pchan; bone= pchan->bone; @@ -1140,7 +1140,7 @@ static IK_Scene* convert_tree(Scene *blscene, Object *ob, bPoseChannel *pchan) // in Blender, the rest pose is always 0 for joints BKE_pose_rest(ikscene); } - rot = (ikscene->jointArray.rows() > 0) ? &ikscene->jointArray(0) : NULL; + rot = ikscene->jointArray(0); for (a=0, ikchan = ikscene->channels; a<tree->totchannel; ++a, ++ikchan) { pchan= ikchan->pchan; bone= pchan->bone; diff --git a/source/blender/imbuf/intern/openexr/openexr_api.cpp b/source/blender/imbuf/intern/openexr/openexr_api.cpp index 93a5f8eca7c..baea18d4898 100644 --- a/source/blender/imbuf/intern/openexr/openexr_api.cpp +++ b/source/blender/imbuf/intern/openexr/openexr_api.cpp @@ -904,8 +904,7 @@ static ExrHandle *imb_exr_begin_read_mem(InputFile *file, int width, int height) /* ********************************************************* */ -typedef struct RGBA -{ +typedef struct RGBA { float r; float g; float b; diff --git a/source/blender/makesdna/DNA_actuator_types.h b/source/blender/makesdna/DNA_actuator_types.h index f4e06455c63..4a5ad69cb91 100644 --- a/source/blender/makesdna/DNA_actuator_types.h +++ b/source/blender/makesdna/DNA_actuator_types.h @@ -62,8 +62,7 @@ typedef struct bActionActuator { float layer_weight; /* How much of the previous layer to use for blending. (<0 = disable, 0 = add mode) */ } bActionActuator; -typedef struct Sound3D -{ +typedef struct Sound3D { float min_gain; float max_gain; float reference_distance; diff --git a/source/blender/makesdna/DNA_cloth_types.h b/source/blender/makesdna/DNA_cloth_types.h index b214186fee6..4928a88b33e 100644 --- a/source/blender/makesdna/DNA_cloth_types.h +++ b/source/blender/makesdna/DNA_cloth_types.h @@ -44,8 +44,7 @@ * variables with different names to minimize confusion. */ -typedef struct ClothSimSettings -{ +typedef struct ClothSimSettings { struct LinkNode *cache; /* UNUSED atm */ float mingoal; /* see SB */ float Cdis; /* Mechanical damping of springs. */ @@ -89,8 +88,7 @@ typedef struct ClothSimSettings } ClothSimSettings; -typedef struct ClothCollSettings -{ +typedef struct ClothCollSettings { struct LinkNode *collision_list; /* e.g. pointer to temp memory for collisions */ float epsilon; /* min distance for collisions. */ float self_friction; /* Fiction/damping with self contact. */ diff --git a/source/blender/makesdna/DNA_listBase.h b/source/blender/makesdna/DNA_listBase.h index 35549aee3d2..333e414278d 100644 --- a/source/blender/makesdna/DNA_listBase.h +++ b/source/blender/makesdna/DNA_listBase.h @@ -41,22 +41,19 @@ extern "C" { #endif /* generic - all structs which are used in linked-lists used this */ -typedef struct Link -{ +typedef struct Link { struct Link *next, *prev; } Link; /* use this when it is not worth defining a custom one... */ -typedef struct LinkData -{ +typedef struct LinkData { struct LinkData *next, *prev; void *data; } LinkData; /* never change the size of this! genfile.c detects pointerlen with it */ -typedef struct ListBase -{ +typedef struct ListBase { void *first, *last; } ListBase; diff --git a/source/blender/makesdna/DNA_mask_types.h b/source/blender/makesdna/DNA_mask_types.h index c036369c692..23f33729f69 100644 --- a/source/blender/makesdna/DNA_mask_types.h +++ b/source/blender/makesdna/DNA_mask_types.h @@ -43,9 +43,9 @@ typedef struct Mask { ID id; struct AnimData *adt; - ListBase masklayers; /* mask layers */ - int masklay_act; /* index of active mask layer (-1 == None) */ - int masklay_tot; /* total number of mask layers */ + ListBase masklayers; /* mask layers */ + int masklay_act; /* index of active mask layer (-1 == None) */ + int masklay_tot; /* total number of mask layers */ } Mask; typedef struct MaskParent { @@ -166,5 +166,4 @@ enum { MASK_BLENDFLAG_INVERT = (1 << 0) }; - #endif // __DNA_MASK_TYPES_H__ diff --git a/source/blender/makesdna/DNA_particle_types.h b/source/blender/makesdna/DNA_particle_types.h index f5d525d47b5..0853df87a35 100644 --- a/source/blender/makesdna/DNA_particle_types.h +++ b/source/blender/makesdna/DNA_particle_types.h @@ -234,8 +234,8 @@ typedef struct ParticleSettings { struct PartDeflect *pd2; } ParticleSettings; -typedef struct ParticleSystem -{ /* note1: make sure all (runtime) are NULL's in 'copy_particlesystem' XXX, this function is no more! - need to invstigate */ +typedef struct ParticleSystem { + /* note1: make sure all (runtime) are NULL's in 'copy_particlesystem' XXX, this function is no more! - need to invstigate */ /* note2: make sure any uses of this struct in DNA are accounted for in 'BKE_object_copy_particlesystems' */ struct ParticleSystem *next, *prev; diff --git a/source/blender/python/intern/bpy_interface.c b/source/blender/python/intern/bpy_interface.c index 0c88c7d9c81..73188b3f830 100644 --- a/source/blender/python/intern/bpy_interface.c +++ b/source/blender/python/intern/bpy_interface.c @@ -421,7 +421,7 @@ static int python_script_exec(bContext *C, const char *fn, struct Text *text, fclose(fp); - pystring = MEM_mallocN(strlen(fn) + 36, "pystring"); + pystring = MEM_mallocN(strlen(fn) + 37, "pystring"); pystring[0] = '\0'; sprintf(pystring, "f=open(r'%s');exec(f.read());f.close()", fn); py_result = PyRun_String(pystring, Py_file_input, py_dict, py_dict); diff --git a/source/blender/render/extern/include/RE_shader_ext.h b/source/blender/render/extern/include/RE_shader_ext.h index cf9e6f7966f..26a1b9908b3 100644 --- a/source/blender/render/extern/include/RE_shader_ext.h +++ b/source/blender/render/extern/include/RE_shader_ext.h @@ -45,8 +45,7 @@ typedef struct TexResult { } TexResult; /* localized shade result data */ -typedef struct ShadeResult -{ +typedef struct ShadeResult { float combined[4]; float col[4]; float alpha, mist, z; @@ -95,8 +94,7 @@ typedef struct ShadeInputCol { } ShadeInputCol; /* localized renderloop data */ -typedef struct ShadeInput -{ +typedef struct ShadeInput { /* copy from face, also to extract tria from quad */ /* note it mirrors a struct above for quick copy */ diff --git a/source/blender/render/intern/include/render_types.h b/source/blender/render/intern/include/render_types.h index f84b00451a6..e5af51cf2d7 100644 --- a/source/blender/render/intern/include/render_types.h +++ b/source/blender/render/intern/include/render_types.h @@ -65,16 +65,14 @@ struct Main; #define TABLEINITSIZE 1024 #define LAMPINITSIZE 256 -typedef struct SampleTables -{ +typedef struct SampleTables { float centLut[16]; float *fmask1[9], *fmask2[9]; char cmask[256], *centmask; } SampleTables; -typedef struct QMCSampler -{ +typedef struct QMCSampler { struct QMCSampler *next, *prev; int type; int tot; @@ -88,8 +86,7 @@ typedef struct QMCSampler #define SAMP_TYPE_HAMMERSLEY 2 /* this is handed over to threaded hiding/passes/shading engine */ -typedef struct RenderPart -{ +typedef struct RenderPart { struct RenderPart *next, *prev; RenderResult *result; /* result of part rendering */ @@ -347,8 +344,7 @@ typedef struct ObjectInstanceRen { /* ------------------------------------------------------------------------- */ -typedef struct VertRen -{ +typedef struct VertRen { float co[3]; float n[3]; float *orco; @@ -384,8 +380,7 @@ typedef struct VlakRen { int index; } VlakRen; -typedef struct HaloRen -{ +typedef struct HaloRen { short miny, maxy; float alfa, xs, ys, rad, radsq, sin, cos, co[3], no[3]; float hard, b, g, r; @@ -456,8 +451,7 @@ typedef struct StrandRen { /* ------------------------------------------------------------------------- */ -typedef struct VolumeOb -{ +typedef struct VolumeOb { struct VolumeOb *next, *prev; struct Material *ma; struct ObjectRen *obr; @@ -469,8 +463,7 @@ typedef struct MatInside { struct ObjectInstanceRen *obi; } MatInside; -typedef struct VolPrecachePart -{ +typedef struct VolPrecachePart { struct VolPrecachePart *next, *prev; struct RayObject *tree; struct ShadeInput *shi; @@ -486,8 +479,7 @@ typedef struct VolPrecachePart struct Render *re; } VolPrecachePart; -typedef struct VolumePrecache -{ +typedef struct VolumePrecache { int res[3]; float *bbmin, *bbmax; float *data_r; diff --git a/source/blender/render/intern/include/rendercore.h b/source/blender/render/intern/include/rendercore.h index 284b386ca33..0fbbf52e613 100644 --- a/source/blender/render/intern/include/rendercore.h +++ b/source/blender/render/intern/include/rendercore.h @@ -46,16 +46,14 @@ struct RayObject; /* ------------------------------------------------------------------------- */ -typedef struct PixStr -{ +typedef struct PixStr { struct PixStr *next; int obi, facenr, z, maskz; unsigned short mask; short shadfac; } PixStr; -typedef struct PixStrMain -{ +typedef struct PixStrMain { struct PixStrMain *next, *prev; struct PixStr *ps; int counter; diff --git a/source/blender/render/intern/include/sunsky.h b/source/blender/render/intern/include/sunsky.h index 0afd9246150..4bb7d99ba16 100644 --- a/source/blender/render/intern/include/sunsky.h +++ b/source/blender/render/intern/include/sunsky.h @@ -31,8 +31,7 @@ #define SPECTRUM_START 350.0 #define SPECTRUM_END 800.0 -typedef struct SunSky -{ +typedef struct SunSky { short effect_type, skyblendtype, sky_colorspace; float turbidity; float theta, phi; diff --git a/source/blender/render/intern/include/voxeldata.h b/source/blender/render/intern/include/voxeldata.h index 63620331c85..dd2262e0357 100644 --- a/source/blender/render/intern/include/voxeldata.h +++ b/source/blender/render/intern/include/voxeldata.h @@ -35,8 +35,7 @@ struct Render; struct TexResult; -typedef struct VoxelDataHeader -{ +typedef struct VoxelDataHeader { int resolX, resolY, resolZ; int frames; } VoxelDataHeader; diff --git a/source/blender/render/intern/include/zbuf.h b/source/blender/render/intern/include/zbuf.h index 77cee59a83a..cdf171443d7 100644 --- a/source/blender/render/intern/include/zbuf.h +++ b/source/blender/render/intern/include/zbuf.h @@ -80,8 +80,7 @@ typedef struct APixstrand { struct APixstrand *next; } APixstrand; -typedef struct APixstrMain -{ +typedef struct APixstrMain { struct APixstrMain *next, *prev; void *ps; } APixstrMain; diff --git a/source/blender/render/intern/raytrace/rayobject_instance.cpp b/source/blender/render/intern/raytrace/rayobject_instance.cpp index ce88bac1587..92a412103ba 100644 --- a/source/blender/render/intern/raytrace/rayobject_instance.cpp +++ b/source/blender/render/intern/raytrace/rayobject_instance.cpp @@ -62,8 +62,7 @@ static RayObjectAPI instance_api = RE_rayobject_instance_hint_bb }; -typedef struct InstanceRayObject -{ +typedef struct InstanceRayObject { RayObject rayobj; RayObject *target; diff --git a/source/blender/render/intern/source/convertblender.c b/source/blender/render/intern/source/convertblender.c index a2b911911d0..a48a6b75049 100644 --- a/source/blender/render/intern/source/convertblender.c +++ b/source/blender/render/intern/source/convertblender.c @@ -520,8 +520,7 @@ static void calc_tangent_vector(ObjectRen *obr, VertexTangent **vtangents, MemAr ************ tangent space generation interface **************** ****************************************************************/ -typedef struct -{ +typedef struct { ObjectRen *obr; } SRenderMeshToTangent; @@ -1011,8 +1010,7 @@ static Material *give_render_material(Render *re, Object *ob, short nr) /* ------------------------------------------------------------------------- */ /* Particles */ /* ------------------------------------------------------------------------- */ -typedef struct ParticleStrandData -{ +typedef struct ParticleStrandData { struct MCol *mcol; float *orco, *uvco, *surfnor; float time, adapt_angle, adapt_pix, size; diff --git a/source/blender/render/intern/source/pointdensity.c b/source/blender/render/intern/source/pointdensity.c index 96a1a13b75f..3c1a18316ca 100644 --- a/source/blender/render/intern/source/pointdensity.c +++ b/source/blender/render/intern/source/pointdensity.c @@ -325,8 +325,7 @@ void free_pointdensities(Render *re) } } -typedef struct PointDensityRangeData -{ +typedef struct PointDensityRangeData { float *density; float squared_radius; float *point_data; diff --git a/source/blender/windowmanager/WM_types.h b/source/blender/windowmanager/WM_types.h index 25abc171057..a15d020c230 100644 --- a/source/blender/windowmanager/WM_types.h +++ b/source/blender/windowmanager/WM_types.h @@ -385,7 +385,7 @@ typedef struct wmTabletData { float Ytilt; /* as above */ } wmTabletData; -typedef enum { // motion progress, for modal handlers +typedef enum { /* motion progress, for modal handlers */ P_NOT_STARTED, P_STARTING, // <-- P_IN_PROGRESS, // <-- only these are sent for NDOF motion diff --git a/source/blender/windowmanager/intern/wm_window.c b/source/blender/windowmanager/intern/wm_window.c index 7361e74755e..265a3c11377 100644 --- a/source/blender/windowmanager/intern/wm_window.c +++ b/source/blender/windowmanager/intern/wm_window.c @@ -577,12 +577,11 @@ int wm_window_fullscreen_toggle_exec(bContext *C, wmOperator *UNUSED(op)) /* ************ events *************** */ -typedef enum -{ - SHIFT = 's', - CONTROL = 'c', - ALT = 'a', - OS = 'C' +typedef enum { + SHIFT = 's', + CONTROL = 'c', + ALT = 'a', + OS = 'C' } modifierKeyType; /* check if specified modifier key type is pressed */ |