diff options
author | Tamito Kajiyama <rd6t-kjym@asahi-net.or.jp> | 2012-07-07 03:46:48 +0400 |
---|---|---|
committer | Tamito Kajiyama <rd6t-kjym@asahi-net.or.jp> | 2012-07-07 03:46:48 +0400 |
commit | b7b50298148ef502d14143b0a5fa01dfac2ecce4 (patch) | |
tree | 7c47cc7777b79bb375bc2f939c34233e6671e10d /source/blender | |
parent | 98a7ca61fa905792bd3fdfa6c29f44691c9582ac (diff) | |
parent | 3a0593cc3d5de33248b3a7b913a45729c37dc1b4 (diff) |
Merged changes in the trunk up to revision 48695.
Diffstat (limited to 'source/blender')
280 files changed, 1965 insertions, 913 deletions
diff --git a/source/blender/blenkernel/BKE_action.h b/source/blender/blenkernel/BKE_action.h index 527d85c7cf3..7df491c0fef 100644 --- a/source/blender/blenkernel/BKE_action.h +++ b/source/blender/blenkernel/BKE_action.h @@ -113,7 +113,7 @@ struct bActionGroup *get_active_actiongroup(struct bAction *act); void set_active_action_group(struct bAction *act, struct bActionGroup *agrp, short select); /* Sync colors used for action/bone group with theme settings */ -void action_group_colors_sync(struct bActionGroup *grp); +void action_group_colors_sync(struct bActionGroup *grp, const struct bActionGroup *ref_grp); /* Add a new action group with the given name to the action */ struct bActionGroup *action_groups_add_new(struct bAction *act, const char name[]); diff --git a/source/blender/blenkernel/BKE_anim.h b/source/blender/blenkernel/BKE_anim.h index d605776ed50..acb9234b2d4 100644 --- a/source/blender/blenkernel/BKE_anim.h +++ b/source/blender/blenkernel/BKE_anim.h @@ -43,7 +43,7 @@ struct bPoseChannel; struct ReportList; /* ---------------------------------------------------- */ -/* Animation Visualisation */ +/* Animation Visualization */ void animviz_settings_init(struct bAnimVizSettings *avs); diff --git a/source/blender/blenkernel/BKE_image.h b/source/blender/blenkernel/BKE_image.h index 699eb0a9f02..909ed471081 100644 --- a/source/blender/blenkernel/BKE_image.h +++ b/source/blender/blenkernel/BKE_image.h @@ -157,7 +157,7 @@ void BKE_image_assign_ibuf(struct Image *ima, struct ImBuf *ibuf); /* called on frame change or before render */ void BKE_image_user_frame_calc(struct ImageUser *iuser, int cfra, int fieldnr); void BKE_image_user_check_frame_calc(struct ImageUser *iuser, int cfra, int fieldnr); -int BKE_image_user_frame_get(const struct ImageUser *iuser, int cfra, int fieldnr); +int BKE_image_user_frame_get(const struct ImageUser *iuser, int cfra, int fieldnr, short *r_is_in_range); void BKE_image_user_file_path(struct ImageUser *iuser, struct Image *ima, char *path); /* sets index offset for multilayer files */ diff --git a/source/blender/blenkernel/BKE_mask.h b/source/blender/blenkernel/BKE_mask.h index 0682b16536c..ee7c13ba7cb 100644 --- a/source/blender/blenkernel/BKE_mask.h +++ b/source/blender/blenkernel/BKE_mask.h @@ -27,6 +27,7 @@ #ifndef __BKE_MASK_H__ #define __BKE_MASK_H__ +struct ListBase; struct Main; struct Mask; struct MaskParent; @@ -50,12 +51,16 @@ void BKE_mask_layer_remove(struct Mask *mask, struct MaskLayer *masklay); void BKE_mask_layer_free_shapes(struct MaskLayer *masklay); void BKE_mask_layer_free(struct MaskLayer *masklay); +void BKE_mask_layer_free_list(struct ListBase *masklayers); void BKE_mask_spline_free(struct MaskSpline *spline); struct MaskSpline *BKE_mask_spline_copy(struct MaskSpline *spline); void BKE_mask_point_free(struct MaskSplinePoint *point); void BKE_mask_layer_unique_name(struct Mask *mask, struct MaskLayer *masklay); +struct MaskLayer *BKE_mask_layer_copy(struct MaskLayer *layer); +void BKE_mask_layer_copy_list(struct ListBase *masklayers_new, struct ListBase *masklayers); + /* splines */ struct MaskSpline *BKE_mask_spline_add(struct MaskLayer *masklay); @@ -170,6 +175,11 @@ void BKE_mask_layer_shape_changed_remove(struct MaskLayer *masklay, int index, i /* rasterization */ int BKE_mask_get_duration(struct Mask *mask); + +void BKE_mask_rasterize_layers(struct ListBase *masklayers, int width, int height, float *buffer, + const short do_aspect_correct, const short do_mask_aa, + const short do_feather); + void BKE_mask_rasterize(struct Mask *mask, int width, int height, float *buffer, const short do_aspect_correct, const short do_mask_aa, const short do_feather); diff --git a/source/blender/blenkernel/BKE_material.h b/source/blender/blenkernel/BKE_material.h index 8aa25a235a8..2407330a237 100644 --- a/source/blender/blenkernel/BKE_material.h +++ b/source/blender/blenkernel/BKE_material.h @@ -42,6 +42,7 @@ struct ID; struct Object; struct Mesh; struct MTFace; +struct Scene; /* materials */ @@ -92,6 +93,9 @@ int material_in_material(struct Material *parmat, struct Material *mat); void ramp_blend(int type, float r_col[3], const float fac, const float col[3]); +/* driver update hacks */ +void material_drivers_update(struct Scene *scene, struct Material *mat, float ctime); + /* copy/paste */ void clear_matcopybuf(void); void free_matcopybuf(void); diff --git a/source/blender/blenkernel/BKE_modifier.h b/source/blender/blenkernel/BKE_modifier.h index 551a31509a3..3b675f3b620 100644 --- a/source/blender/blenkernel/BKE_modifier.h +++ b/source/blender/blenkernel/BKE_modifier.h @@ -345,6 +345,7 @@ void modifiers_clearErrors(struct Object *ob); int modifiers_getCageIndex(struct Scene *scene, struct Object *ob, int *lastPossibleCageIndex_r, int virtual_); +int modifiers_isModifierEnabled(struct Object *ob, int modifierType); int modifiers_isSoftbodyEnabled(struct Object *ob); int modifiers_isClothEnabled(struct Object *ob); int modifiers_isParticleEnabled(struct Object *ob); diff --git a/source/blender/blenkernel/CMakeLists.txt b/source/blender/blenkernel/CMakeLists.txt index 558db1c8742..723a0e32605 100644 --- a/source/blender/blenkernel/CMakeLists.txt +++ b/source/blender/blenkernel/CMakeLists.txt @@ -320,9 +320,6 @@ if(WITH_PYTHON) list(APPEND INC ../python ) - list(APPEND INC_SYS - ${PYTHON_INCLUDE_DIRS} - ) add_definitions(-DWITH_PYTHON) if(WITH_PYTHON_SECURITY) diff --git a/source/blender/blenkernel/SConscript b/source/blender/blenkernel/SConscript index 819632414d9..1b150848b7e 100644 --- a/source/blender/blenkernel/SConscript +++ b/source/blender/blenkernel/SConscript @@ -32,7 +32,6 @@ if env['WITH_BF_FRAMESERVER']: if env['WITH_BF_PYTHON']: incs += ' ../python' - incs += ' ' + env['BF_PYTHON_INC'] defs.append('WITH_PYTHON') if env['BF_DEBUG']: defs.append('DEBUG') diff --git a/source/blender/blenkernel/intern/action.c b/source/blender/blenkernel/intern/action.c index b3d2e3371f4..8d1707725b5 100644 --- a/source/blender/blenkernel/intern/action.c +++ b/source/blender/blenkernel/intern/action.c @@ -253,7 +253,7 @@ void set_active_action_group(bAction *act, bActionGroup *agrp, short select) } /* Sync colors used for action/bone group with theme settings */ -void action_group_colors_sync(bActionGroup *grp) +void action_group_colors_sync(bActionGroup *grp, const bActionGroup *ref_grp) { /* only do color copying if using a custom color (i.e. not default color) */ if (grp->customCol) { @@ -265,9 +265,15 @@ void action_group_colors_sync(bActionGroup *grp) memcpy(&grp->cs, col_set, sizeof(ThemeWireColor)); } else { - /* init custom colors with a generic multi-color rgb set, if not initialized already - * (for custom color set) */ - if (grp->cs.solid[0] == 0) { + /* if a reference group is provided, use the custom color from there... */ + if (ref_grp) { + /* assumption: reference group has a color set */ + memcpy(&grp->cs, &ref_grp->cs, sizeof(ThemeWireColor)); + } + /* otherwise, init custom color with a generic/placeholder color set if + * no previous theme color was used that we can just keep using + */ + else if (grp->cs.solid[0] == 0) { /* define for setting colors in theme below */ rgba_char_args_set(grp->cs.solid, 0xff, 0x00, 0x00, 255); rgba_char_args_set(grp->cs.select, 0x81, 0xe6, 0x14, 255); diff --git a/source/blender/blenkernel/intern/anim.c b/source/blender/blenkernel/intern/anim.c index a0cfc4295ef..52399801691 100644 --- a/source/blender/blenkernel/intern/anim.c +++ b/source/blender/blenkernel/intern/anim.c @@ -78,9 +78,9 @@ static void object_duplilist_recursive(ID *id, Scene *scene, Object *ob, ListBase *duplilist, float par_space_mat[][4], int par_index, int level, int animated); /* ******************************************************************** */ -/* Animation Visualisation */ +/* Animation Visualization */ -/* Initialize the default settings for animation visualisation */ +/* Initialize the default settings for animation visualization */ void animviz_settings_init(bAnimVizSettings *avs) { /* sanity check */ diff --git a/source/blender/blenkernel/intern/anim_sys.c b/source/blender/blenkernel/intern/anim_sys.c index e5701927b07..e4ecdf245d1 100644 --- a/source/blender/blenkernel/intern/anim_sys.c +++ b/source/blender/blenkernel/intern/anim_sys.c @@ -1864,7 +1864,7 @@ static void nlastrip_evaluate_transition(PointerRNA *ptr, ListBase *channels, Li /* prepare template for 'evaluation strip' * - based on the transition strip's evaluation strip data * - strip_mode is NES_TIME_TRANSITION_* based on which endpoint - * - strip_time is the 'normalised' (i.e. in-strip) time for evaluation, + * - strip_time is the 'normalized' (i.e. in-strip) time for evaluation, * which doubles up as an additional weighting factor for the strip influences * which allows us to appear to be 'interpolating' between the two extremes */ diff --git a/source/blender/blenkernel/intern/armature.c b/source/blender/blenkernel/intern/armature.c index 96959398bc2..c10b1e2d4f4 100644 --- a/source/blender/blenkernel/intern/armature.c +++ b/source/blender/blenkernel/intern/armature.c @@ -2049,7 +2049,8 @@ static void splineik_evaluate_bone(tSplineIK_Tree *tree, Scene *scene, Object *o cross_v3_v3v3(raxis, rmat[1], splineVec); rangle = dot_v3v3(rmat[1], splineVec); - rangle = acos(MAX2(-1.0f, MIN2(1.0f, rangle))); + CLAMP(rangle, -1.0f, 1.0f); + rangle = acosf(rangle); /* multiply the magnitude of the angle by the influence of the constraint to * control the influence of the SplineIK effect @@ -2207,7 +2208,7 @@ void BKE_pchan_to_mat4(bPoseChannel *pchan, float chan_mat[4][4]) axis_angle_to_mat3(rmat, pchan->rotAxis, pchan->rotAngle); } else { - /* quats are normalised before use to eliminate scaling issues */ + /* quats are normalized before use to eliminate scaling issues */ float quat[4]; /* NOTE: we now don't normalize the stored values anymore, since this was kindof evil in some cases diff --git a/source/blender/blenkernel/intern/collision.c b/source/blender/blenkernel/intern/collision.c index d99c36b6c91..7acbcbf6c93 100644 --- a/source/blender/blenkernel/intern/collision.c +++ b/source/blender/blenkernel/intern/collision.c @@ -274,7 +274,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 = MIN2(clmd->coll_parms->friction * 0.01f * magrelVel, sqrtf(dot_v3v3(vrel_t_pre, vrel_t_pre))); + magtangent = minf(clmd->coll_parms->friction * 0.01f * magrelVel, sqrtf(dot_v3v3(vrel_t_pre, vrel_t_pre))); // Apply friction impulse. if ( magtangent > ALMOST_ZERO ) { diff --git a/source/blender/blenkernel/intern/depsgraph.c b/source/blender/blenkernel/intern/depsgraph.c index a1e67ebd414..05a2cfee8e6 100644 --- a/source/blender/blenkernel/intern/depsgraph.c +++ b/source/blender/blenkernel/intern/depsgraph.c @@ -66,6 +66,7 @@ #include "BKE_library.h" #include "BKE_main.h" #include "BKE_node.h" +#include "BKE_material.h" #include "BKE_mball.h" #include "BKE_modifier.h" #include "BKE_object.h" @@ -311,7 +312,7 @@ static void dag_add_driver_relation(AnimData *adt, DagForest *dag, DagNode *node for (fcu = adt->drivers.first; fcu; fcu = fcu->next) { ChannelDriver *driver = fcu->driver; DriverVar *dvar; - int isdata_fcu = isdata || (fcu->rna_path && strstr(fcu->rna_path, "modifiers[")); + int isdata_fcu = (isdata) || (fcu->rna_path && strstr(fcu->rna_path, "modifiers[")); /* loop over variables to get the target relationships */ for (dvar = driver->variables.first; dvar; dvar = dvar->next) { @@ -347,6 +348,52 @@ static void dag_add_driver_relation(AnimData *adt, DagForest *dag, DagNode *node } } +/* XXX: forward def for material driver handling... */ +static void dag_add_material_driver_relations(DagForest *dag, DagNode *node, Material *ma); + +/* recursive handling for material nodetree drivers */ +static void dag_add_material_nodetree_driver_relations(DagForest *dag, DagNode *node, bNodeTree *ntree, Material *rootma) +{ + bNode *n; + Material *ma; + + /* nodetree itself */ + if (ntree->adt) { + dag_add_driver_relation(ntree->adt, dag, node, 1); + } + + /* nodetree's nodes... */ + for (n = ntree->nodes.first; n; n = n->next) { + if (n->id && GS(n->id->name) == ID_MA) { + ma = (Material *)n->id; + if (ma != rootma) { + dag_add_material_driver_relations(dag, node, ma); + } + } + else if (n->type == NODE_GROUP && n->id) { + dag_add_material_nodetree_driver_relations(dag, node, (bNodeTree *)n->id, rootma); + } + } +} + +/* recursive handling for material drivers */ +static void dag_add_material_driver_relations(DagForest *dag, DagNode *node, Material *ma) +{ + /* material itself */ + if (ma->adt) { + dag_add_driver_relation(ma->adt, dag, node, 1); + } + + /* textures */ + // TODO... + //dag_add_texture_driver_relations(DagForest *dag, DagNode *node, ID *id); + + /* material's nodetree */ + if (ma->nodetree) { + dag_add_material_nodetree_driver_relations(dag, node, ma->nodetree, ma); + } +} + static void dag_add_collision_field_relation(DagForest *dag, Scene *scene, Object *ob, DagNode *node) { Base *base; @@ -516,7 +563,11 @@ static void build_dag_object(DagForest *dag, DagNode *scenenode, Scene *scene, O /* softbody collision */ if ((ob->type == OB_MESH) || (ob->type == OB_CURVE) || (ob->type == OB_LATTICE)) { - if (modifiers_isSoftbodyEnabled(ob) || modifiers_isClothEnabled(ob) || ob->particlesystem.first) + if (modifiers_isModifierEnabled(ob, eModifierType_Softbody) + || modifiers_isModifierEnabled(ob, eModifierType_Cloth) + || modifiers_isModifierEnabled(ob, eModifierType_Smoke) + || modifiers_isModifierEnabled(ob, eModifierType_DynamicPaint) + || ob->particlesystem.first) dag_add_collision_field_relation(dag, scene, ob, node); /* TODO: use effectorweight->group */ } @@ -572,6 +623,20 @@ static void build_dag_object(DagForest *dag, DagNode *scenenode, Scene *scene, O break; } + /* material drivers */ + if (ob->totcol) { + int a; + + for (a = 1; a <= ob->totcol; a++) { + Material *ma = give_current_material(ob, a); + + if (ma) { + /* recursively figure out if there are drivers, and hook these up to this object */ + dag_add_material_driver_relations(dag, node, ma); + } + } + } + /* particles */ psys = ob->particlesystem.first; if (psys) { @@ -605,15 +670,15 @@ static void build_dag_object(DagForest *dag, DagNode *scenenode, Scene *scene, O /* note that this relation actually runs in the wrong direction, the problem * is that dupli system all have this (due to parenting), and the render * engine instancing assumes particular ordering of objects in list */ - dag_add_relation(dag, node, node2, DAG_RL_OB_OB, "Particle Object Visualisation"); + dag_add_relation(dag, node, node2, DAG_RL_OB_OB, "Particle Object Visualization"); if (part->dup_ob->type == OB_MBALL) - dag_add_relation(dag, node2, node, DAG_RL_DATA_DATA, "Particle Object Visualisation"); + dag_add_relation(dag, node2, node, DAG_RL_DATA_DATA, "Particle Object Visualization"); } if (part->ren_as == PART_DRAW_GR && part->dup_group) { for (go = part->dup_group->gobject.first; go; go = go->next) { node2 = dag_get_node(dag, go->ob); - dag_add_relation(dag, node2, node, DAG_RL_OB_OB, "Particle Group Visualisation"); + dag_add_relation(dag, node2, node, DAG_RL_OB_OB, "Particle Group Visualization"); } } diff --git a/source/blender/blenkernel/intern/displist.c b/source/blender/blenkernel/intern/displist.c index 2493507dca4..6e5d6ffb0e9 100644 --- a/source/blender/blenkernel/intern/displist.c +++ b/source/blender/blenkernel/intern/displist.c @@ -1386,17 +1386,18 @@ static void do_makeDispListCurveTypes(Scene *scene, Object *ob, ListBase *dispba ListBase top_capbase = {NULL, NULL}; for (dlb = dlbev.first; dlb; dlb = dlb->next) { - int i, start, steps; - float bevfac1 = MIN2(cu->bevfac1, cu->bevfac2), bevfac2 = MAX2(cu->bevfac1, cu->bevfac2); + const float bevfac1 = minf(cu->bevfac1, cu->bevfac2); + const float bevfac2 = maxf(cu->bevfac1, cu->bevfac2); float firstblend = 0.0f, lastblend = 0.0f; + int i, start, steps; - if (cu->bevfac1 - cu->bevfac2 == 0.0f) + if (bevfac2 - bevfac1 == 0.0f) continue; start = (int)(bevfac1 * (bl->nr - 1)); steps = 2 + (int)((bevfac2) * (bl->nr - 1)) - start; - firstblend = 1.0f - ((float)bevfac1 * (bl->nr - 1) - (int)((float)bevfac1 * (bl->nr - 1))); - lastblend = (float)bevfac2 * (bl->nr - 1) - (int)((float)bevfac2 * (bl->nr - 1)); + firstblend = 1.0f - (bevfac1 * (bl->nr - 1) - (int)(bevfac1 * (bl->nr - 1))); + lastblend = bevfac2 * (bl->nr - 1) - (int)(bevfac2 * (bl->nr - 1)); if (steps > bl->nr) { steps = bl->nr; diff --git a/source/blender/blenkernel/intern/dynamicpaint.c b/source/blender/blenkernel/intern/dynamicpaint.c index a6467af2773..dd5751c5d1f 100644 --- a/source/blender/blenkernel/intern/dynamicpaint.c +++ b/source/blender/blenkernel/intern/dynamicpaint.c @@ -1686,7 +1686,7 @@ struct DerivedMesh *dynamicPaint_Modifier_apply(DynamicPaintModifierData *pmd, c[1] = material->g; c[2] = material->b; } - else { /* default grey */ + else { /* default gray */ c[0] = 0.65f; c[1] = 0.65f; c[2] = 0.65f; diff --git a/source/blender/blenkernel/intern/fmodifier.c b/source/blender/blenkernel/intern/fmodifier.c index b7ede15d00b..f981ecaf810 100644 --- a/source/blender/blenkernel/intern/fmodifier.c +++ b/source/blender/blenkernel/intern/fmodifier.c @@ -285,7 +285,7 @@ static FModifierTypeInfo FMI_GENERATOR = { * x is the evaluation 'time', and 'y' is the resultant value * * Functions available are - * sin, cos, tan, sinc (normalised sin), natural log, square root + * sin, cos, tan, sinc (normalized sin), natural log, square root */ static void fcm_fn_generator_new_data(void *mdata) @@ -297,7 +297,7 @@ static void fcm_fn_generator_new_data(void *mdata) data->phase_multiplier = 1.0f; } -/* Unary 'normalised sine' function +/* Unary 'normalized sine' function * y = sin(PI + x) / (PI * x), * except for x = 0 when y = 1. */ @@ -326,7 +326,7 @@ static void fcm_fn_generator_evaluate(FCurve *UNUSED(fcu), FModifier *fcm, float case FCM_GENERATOR_FN_COS: /* cosine wave */ fn = cos; break; - case FCM_GENERATOR_FN_SINC: /* normalised sine wave */ + case FCM_GENERATOR_FN_SINC: /* normalized sine wave */ fn = sinc; break; diff --git a/source/blender/blenkernel/intern/font.c b/source/blender/blenkernel/intern/font.c index 061530965ef..5d33c8fbcbf 100644 --- a/source/blender/blenkernel/intern/font.c +++ b/source/blender/blenkernel/intern/font.c @@ -699,7 +699,7 @@ makebreak: yof -= linedist; - maxlen = MAX2(maxlen, (xof - tb->x / cu->fsize)); + maxlen = maxf(maxlen, (xof - tb->x / cu->fsize)); linedata[lnr] = xof - tb->x / cu->fsize; linedata2[lnr] = cnr; linedata3[lnr] = tb->w / cu->fsize; diff --git a/source/blender/blenkernel/intern/image.c b/source/blender/blenkernel/intern/image.c index beaf8f719e3..d2a2412843a 100644 --- a/source/blender/blenkernel/intern/image.c +++ b/source/blender/blenkernel/intern/image.c @@ -2784,10 +2784,14 @@ ImBuf *BKE_image_get_ibuf(Image *ima, ImageUser *iuser) return BKE_image_acquire_ibuf(ima, iuser, NULL); } -int BKE_image_user_frame_get(const ImageUser *iuser, int cfra, int fieldnr) +int BKE_image_user_frame_get(const ImageUser *iuser, int cfra, int fieldnr, short *r_is_in_range) { const int len = (iuser->fie_ima * iuser->frames) / 2; + if (r_is_in_range) { + *r_is_in_range = FALSE; + } + if (len == 0) { return 0; } @@ -2800,10 +2804,23 @@ int BKE_image_user_frame_get(const ImageUser *iuser, int cfra, int fieldnr) cfra = ((cfra) % len); if (cfra < 0) cfra += len; if (cfra == 0) cfra = len; + + if (r_is_in_range) { + *r_is_in_range = TRUE; + } } - if (cfra < 0) cfra = 0; - else if (cfra > len) cfra = len; + if (cfra < 0) { + cfra = 0; + } + else if (cfra > len) { + cfra = len; + } + else { + if (r_is_in_range) { + *r_is_in_range = TRUE; + } + } /* convert current frame to current field */ cfra = 2 * (cfra); @@ -2812,7 +2829,6 @@ int BKE_image_user_frame_get(const ImageUser *iuser, int cfra, int fieldnr) /* transform to images space */ framenr = (cfra + iuser->fie_ima - 2) / iuser->fie_ima; if (framenr > iuser->frames) framenr = iuser->frames; - framenr += iuser->offset; if (iuser->cycl) { framenr = ((framenr) % len); @@ -2820,6 +2836,9 @@ int BKE_image_user_frame_get(const ImageUser *iuser, int cfra, int fieldnr) if (framenr == 0) framenr = len; } + /* important to apply after else we cant loop on frames 100 - 110 for eg. */ + framenr += iuser->offset; + return framenr; } } @@ -2827,7 +2846,15 @@ int BKE_image_user_frame_get(const ImageUser *iuser, int cfra, int fieldnr) void BKE_image_user_frame_calc(ImageUser *iuser, int cfra, int fieldnr) { if (iuser) { - const int framenr = BKE_image_user_frame_get(iuser, cfra, fieldnr); + short is_in_range; + const int framenr = BKE_image_user_frame_get(iuser, cfra, fieldnr, &is_in_range); + + if (is_in_range) { + iuser->flag |= IMA_USER_FRAME_IN_RANGE; + } + else { + iuser->flag &= ~IMA_USER_FRAME_IN_RANGE; + } /* allows image users to handle redraws */ if (iuser->flag & IMA_ANIM_ALWAYS) diff --git a/source/blender/blenkernel/intern/mask.c b/source/blender/blenkernel/intern/mask.c index 2767a67086b..b400332db81 100644 --- a/source/blender/blenkernel/intern/mask.c +++ b/source/blender/blenkernel/intern/mask.c @@ -188,6 +188,41 @@ void BKE_mask_layer_unique_name(Mask *mask, MaskLayer *masklay) BLI_uniquename(&mask->masklayers, masklay, "MaskLayer", '.', offsetof(MaskLayer, name), sizeof(masklay->name)); } +MaskLayer *BKE_mask_layer_copy(MaskLayer *layer) +{ + MaskLayer *layer_new; + MaskSpline *spline; + + layer_new = MEM_callocN(sizeof(MaskLayer), "new mask layer"); + + BLI_strncpy(layer_new->name, layer->name, sizeof(layer_new->name)); + + layer_new->alpha = layer->alpha; + layer_new->blend = layer->blend; + layer_new->blend_flag = layer->blend_flag; + layer_new->flag = layer->flag; + layer_new->restrictflag = layer->restrictflag; + + for (spline = layer->splines.first; spline; spline = spline->next) { + MaskSpline *spline_new = BKE_mask_spline_copy(spline); + + BLI_addtail(&layer_new->splines, spline_new); + } + + return layer_new; +} + +void BKE_mask_layer_copy_list(ListBase *masklayers_new, ListBase *masklayers) +{ + MaskLayer *layer; + + for (layer = masklayers->first; layer; layer = layer->next) { + MaskLayer *layer_new = BKE_mask_layer_copy(layer); + + BLI_addtail(masklayers_new, layer_new); + } +} + /* splines */ MaskSpline *BKE_mask_spline_add(MaskLayer *masklay) @@ -988,21 +1023,34 @@ void BKE_mask_spline_free(MaskSpline *spline) MEM_freeN(spline); } +static MaskSplinePoint *mask_spline_points_copy(MaskSplinePoint *points, int tot_point) +{ + MaskSplinePoint *npoints; + int i; + + npoints = MEM_dupallocN(points); + + for (i = 0; i < tot_point; i++) { + MaskSplinePoint *point = &npoints[i]; + + if (point->uw) + point->uw = MEM_dupallocN(point->uw); + } + + return npoints; +} + MaskSpline *BKE_mask_spline_copy(MaskSpline *spline) { MaskSpline *nspline = MEM_callocN(sizeof(MaskSpline), "new spline"); - int i; *nspline = *spline; nspline->points_deform = NULL; - nspline->points = MEM_dupallocN(nspline->points); - - for (i = 0; i < nspline->tot_point; i++) { - MaskSplinePoint *point = &nspline->points[i]; + nspline->points = mask_spline_points_copy(spline->points, spline->tot_point); - if (point->uw) - point->uw = MEM_dupallocN(point->uw); + if (spline->points_deform) { + nspline->points_deform = mask_spline_points_copy(spline->points_deform, spline->tot_point); } return nspline; @@ -1068,20 +1116,25 @@ void BKE_mask_layer_free(MaskLayer *masklay) MEM_freeN(masklay); } -void BKE_mask_free(Mask *mask) +void BKE_mask_layer_free_list(ListBase *masklayers) { - MaskLayer *masklay = mask->masklayers.first; + MaskLayer *masklay = masklayers->first; while (masklay) { - MaskLayer *next_masklay = masklay->next; + MaskLayer *masklay_next = masklay->next; - BLI_remlink(&mask->masklayers, masklay); + BLI_remlink(masklayers, masklay); BKE_mask_layer_free(masklay); - masklay = next_masklay; + masklay = masklay_next; } } +void BKE_mask_free(Mask *mask) +{ + BKE_mask_layer_free_list(&mask->masklayers); +} + void BKE_mask_unlink(Main *bmain, Mask *mask) { bScreen *scr; @@ -2093,9 +2146,9 @@ int BKE_mask_get_duration(Mask *mask) } /* rasterization */ -void BKE_mask_rasterize(Mask *mask, int width, int height, float *buffer, - const short do_aspect_correct, const short do_mask_aa, - const short do_feather) +void BKE_mask_rasterize_layers(ListBase *masklayers, int width, int height, float *buffer, + const short do_aspect_correct, const short do_mask_aa, + const short do_feather) { MaskLayer *masklay; @@ -2103,7 +2156,7 @@ void BKE_mask_rasterize(Mask *mask, int width, int height, float *buffer, const int buffer_size = width * height; float *buffer_tmp = MEM_mallocN(sizeof(float) * buffer_size, __func__); - for (masklay = mask->masklayers.first; masklay; masklay = masklay->next) { + for (masklay = masklayers->first; masklay; masklay = masklay->next) { MaskSpline *spline; float alpha; @@ -2226,3 +2279,10 @@ void BKE_mask_rasterize(Mask *mask, int width, int height, float *buffer, MEM_freeN(buffer_tmp); } + +void BKE_mask_rasterize(Mask *mask, int width, int height, float *buffer, + const short do_aspect_correct, const short do_mask_aa, + const short do_feather) +{ + BKE_mask_rasterize_layers(&mask->masklayers, width, height, buffer, do_aspect_correct, do_mask_aa, do_feather); +} diff --git a/source/blender/blenkernel/intern/material.c b/source/blender/blenkernel/intern/material.c index c59948532ac..e0761311c98 100644 --- a/source/blender/blenkernel/intern/material.c +++ b/source/blender/blenkernel/intern/material.c @@ -36,6 +36,7 @@ #include "MEM_guardedalloc.h" +#include "DNA_anim_types.h" #include "DNA_curve_types.h" #include "DNA_material_types.h" #include "DNA_mesh_types.h" @@ -1051,6 +1052,57 @@ int material_in_material(Material *parmat, Material *mat) else return 0; } + + +/* ****************** */ + +/* Update drivers for materials in a nodetree */ +static void material_node_drivers_update(Scene *scene, bNodeTree *ntree, float ctime, Material *rootma) +{ + bNode *node; + Material *ma; + + /* nodetree itself */ + if (ntree->adt && ntree->adt->drivers.first) { + BKE_animsys_evaluate_animdata(scene, &ntree->id, ntree->adt, ctime, ADT_RECALC_DRIVERS); + } + + /* nodes... */ + for (node = ntree->nodes.first; node; node = node->next) { + if (node->id && GS(node->id->name) == ID_MA) { + /* TODO: prevent infinite recursion here... */ + ma = (Material *)node->id; + if (ma != rootma) { + material_drivers_update(scene, ma, ctime); + } + } + else if (node->type == NODE_GROUP && node->id) { + material_node_drivers_update(scene, (bNodeTree *)node->id, + ctime, rootma); + } + } +} + +/* Calculate all drivers for materials + * FIXME: this is really a terrible method which may result in some things being calculated + * multiple times. However, without proper despgraph support for these things, we are forced + * into this sort of thing... + */ +void material_drivers_update(Scene *scene, Material *ma, float ctime) +{ + //if (G.f & G_DEBUG) + // printf("material_drivers_update(%s, %s)\n", scene->id.name, ma->id.name); + + /* material itself */ + if (ma->adt && ma->adt->drivers.first) { + BKE_animsys_evaluate_animdata(scene, &ma->id, ma->adt, ctime, ADT_RECALC_DRIVERS); + } + + /* nodes */ + if (ma->nodetree) { + material_node_drivers_update(scene, ma->nodetree, ctime, ma); + } +} /* ****************** */ #if 0 /* UNUSED */ @@ -1061,19 +1113,19 @@ static char colname_array[125][20]= { "LightGreen", "Chartreuse", "YellowGreen", "Yellow", "Gold", "Green", "LawnGreen", "GreenYellow", "LightOlive", "Yellow", "DarkBlue", "DarkPurple", "HotPink", "VioletPink", "RedPink", -"SlateGray", "DarkGrey", "PalePurple", "IndianRed", "Tomato", +"SlateGray", "DarkGray", "PalePurple", "IndianRed", "Tomato", "SeaGreen", "PaleGreen", "GreenKhaki", "LightBrown", "LightSalmon", "SpringGreen", "PaleGreen", "MediumOlive", "YellowBrown", "LightGold", "LightGreen", "LightGreen", "LightGreen", "GreenYellow", "PaleYellow", "HalfBlue", "DarkSky", "HalfMagenta", "VioletRed", "DeepPink", "SteelBlue", "SkyBlue", "Orchid", "LightHotPink", "HotPink", -"SeaGreen", "SlateGray", "MediumGrey", "Burlywood", "LightPink", +"SeaGreen", "SlateGray", "MediumGray", "Burlywood", "LightPink", "SpringGreen", "Aquamarine", "PaleGreen", "Khaki", "PaleOrange", "SpringGreen", "SeaGreen", "PaleGreen", "PaleWhite", "YellowWhite", "LightBlue", "Purple", "MediumOrchid", "Magenta", "Magenta", "RoyalBlue", "SlateBlue", "MediumOrchid", "Orchid", "Magenta", "DeepSkyBlue", "LightSteelBlue", "LightSkyBlue", "Violet", "LightPink", -"Cyan", "DarkTurquoise", "SkyBlue", "Grey", "Snow", +"Cyan", "DarkTurquoise", "SkyBlue", "Gray", "Snow", "Mint", "Mint", "Aquamarine", "MintCream", "Ivory", "Blue", "Blue", "DarkMagenta", "DarkOrchid", "Magenta", "SkyBlue", "RoyalBlue", "LightSlateBlue", "MediumOrchid", "Magenta", diff --git a/source/blender/blenkernel/intern/mesh.c b/source/blender/blenkernel/intern/mesh.c index e3b13ca0f17..8d81e7b595d 100644 --- a/source/blender/blenkernel/intern/mesh.c +++ b/source/blender/blenkernel/intern/mesh.c @@ -2153,7 +2153,7 @@ void BKE_mesh_convert_mfaces_to_mpolys_ex(ID *id, CustomData *fdata, CustomData } } - /* note, we don't convert FGons at all, these are not even real ngons, + /* note, we don't convert NGons at all, these are not even real ngons, * they have their own UV's, colors etc - its more an editing feature. */ BLI_edgehash_free(eh, NULL); @@ -3146,19 +3146,17 @@ void BKE_mesh_translate(Mesh *me, float offset[3], int do_keys) } } - void BKE_mesh_ensure_navmesh(Mesh *me) { if (!CustomData_has_layer(&me->pdata, CD_RECAST)) { int i; int numFaces = me->totpoly; int *recastData; - CustomData_add_layer_named(&me->pdata, CD_RECAST, CD_CALLOC, NULL, numFaces, "recastData"); - recastData = (int *)CustomData_get_layer(&me->pdata, CD_RECAST); + recastData = (int *)MEM_mallocN(numFaces * sizeof(int), __func__); for (i = 0; i < numFaces; i++) { recastData[i] = i + 1; } - CustomData_add_layer_named(&me->pdata, CD_RECAST, CD_REFERENCE, recastData, numFaces, "recastData"); + CustomData_add_layer_named(&me->pdata, CD_RECAST, CD_ASSIGN, recastData, numFaces, "recastData"); } } diff --git a/source/blender/blenkernel/intern/mesh_validate.c b/source/blender/blenkernel/intern/mesh_validate.c index 4528b748412..79e3fc19d20 100644 --- a/source/blender/blenkernel/intern/mesh_validate.c +++ b/source/blender/blenkernel/intern/mesh_validate.c @@ -223,7 +223,7 @@ int BKE_mesh_validate_arrays(Mesh *mesh, __func__, totvert, totedge, totloop, totpoly); if (totedge == 0 && totpoly != 0) { - PRINT(" logical error, %u polygons and 0 edges\n", totpoly); + PRINT("\tLogical error, %u polygons and 0 edges\n", totpoly); do_edge_recalc = do_fixes; } @@ -233,7 +233,7 @@ int BKE_mesh_validate_arrays(Mesh *mesh, for (j = 0; j < 3; j++) { if (!finite(mv->co[j])) { - PRINT(" vertex %u: has invalid coordinate\n", i); + PRINT("\tVertex %u: has invalid coordinate\n", i); if (do_fixes) { zero_v3(mv->co); @@ -247,7 +247,7 @@ int BKE_mesh_validate_arrays(Mesh *mesh, } if (fix_normal) { - PRINT(" vertex %u: has zero normal, assuming Z-up normal\n", i); + PRINT("\tVertex %u: has zero normal, assuming Z-up normal\n", i); if (do_fixes) { mv->no[2] = SHRT_MAX; verts_fixed = TRUE; @@ -258,20 +258,20 @@ int BKE_mesh_validate_arrays(Mesh *mesh, for (i = 0, me = medges; i < totedge; i++, me++) { int remove = FALSE; if (me->v1 == me->v2) { - PRINT(" edge %u: has matching verts, both %u\n", i, me->v1); + PRINT("\tEdge %u: has matching verts, both %u\n", i, me->v1); remove = do_fixes; } if (me->v1 >= totvert) { - PRINT(" edge %u: v1 index out of range, %u\n", i, me->v1); + PRINT("\tEdge %u: v1 index out of range, %u\n", i, me->v1); remove = do_fixes; } if (me->v2 >= totvert) { - PRINT(" edge %u: v2 index out of range, %u\n", i, me->v2); + PRINT("\tEdge %u: v2 index out of range, %u\n", i, me->v2); remove = do_fixes; } if (BLI_edgehash_haskey(edge_hash, me->v1, me->v2)) { - PRINT(" edge %u: is a duplicate of %d\n", i, + PRINT("\tEdge %u: is a duplicate of %d\n", i, GET_INT_FROM_POINTER(BLI_edgehash_lookup(edge_hash, me->v1, me->v2))); remove = do_fixes; } @@ -296,7 +296,7 @@ int BKE_mesh_validate_arrays(Mesh *mesh, PRINT(" face %u: edge " STRINGIFY(a) "/" STRINGIFY(b) \ " (%u,%u) is missing egde data\n", i, mf->a, mf->b); \ do_edge_recalc = TRUE; \ - } + } (void)0 MFace *mf; MFace *mf_prev; @@ -306,6 +306,8 @@ int BKE_mesh_validate_arrays(Mesh *mesh, SortFace *sf_prev; unsigned int totsortface = 0; + PRINT("No Polys, only tesselated Faces\n"); + for (i = 0, mf = mfaces, sf = sort_faces; i < totface; i++, mf++) { int remove = FALSE; int fidx; @@ -315,7 +317,7 @@ int BKE_mesh_validate_arrays(Mesh *mesh, do { fv[fidx] = *(&(mf->v1) + fidx); if (fv[fidx] >= totvert) { - PRINT(" face %u: 'v%d' index out of range, %u\n", i, fidx + 1, fv[fidx]); + PRINT("\tFace %u: 'v%d' index out of range, %u\n", i, fidx + 1, fv[fidx]); remove = do_fixes; } } while (fidx--); @@ -392,12 +394,12 @@ int BKE_mesh_validate_arrays(Mesh *mesh, mf_prev = mfaces + sf_prev->index; if (mf->v4) { - PRINT(" face %u & %u: are duplicates (%u,%u,%u,%u) (%u,%u,%u,%u)\n", + PRINT("\tFace %u & %u: are duplicates (%u,%u,%u,%u) (%u,%u,%u,%u)\n", sf->index, sf_prev->index, mf->v1, mf->v2, mf->v3, mf->v4, mf_prev->v1, mf_prev->v2, mf_prev->v3, mf_prev->v4); } else { - PRINT(" face %u & %u: are duplicates (%u,%u,%u) (%u,%u,%u)\n", + PRINT("\tFace %u & %u: are duplicates (%u,%u,%u) (%u,%u,%u)\n", sf->index, sf_prev->index, mf->v1, mf->v2, mf->v3, mf_prev->v1, mf_prev->v2, mf_prev->v3); } @@ -433,7 +435,7 @@ int BKE_mesh_validate_arrays(Mesh *mesh, * * Also, loops not used by polys can be discarded. * And "intersecting" loops (i.e. loops used by more than one poly) are invalid, - * so be sure to leave at most one poly/loop! + * so be sure to leave at most one poly per loop! */ { SortPoly *sort_polys = MEM_callocN(sizeof(SortPoly) * totpoly, "mesh validate's sort_polys"); @@ -444,12 +446,12 @@ int BKE_mesh_validate_arrays(Mesh *mesh, if (mp->loopstart < 0 || mp->totloop < 3) { /* Invalid loop data. */ - PRINT(" poly %u is invalid (loopstart: %u, totloop: %u)\n", sp->index, mp->loopstart, mp->totloop); + PRINT("\tPoly %u is invalid (loopstart: %u, totloop: %u)\n", sp->index, mp->loopstart, mp->totloop); sp->invalid = TRUE; } else if (mp->loopstart + mp->totloop > totloop) { /* Invalid loop data. */ - PRINT(" poly %u uses loops out of range (loopstart: %u, loopend: %u, max nbr of loops: %u)\n", + PRINT("\tPoly %u uses loops out of range (loopstart: %u, loopend: %u, max nbr of loops: %u)\n", sp->index, mp->loopstart, mp->loopstart + mp->totloop - 1, totloop - 1); sp->invalid = TRUE; } @@ -465,7 +467,7 @@ int BKE_mesh_validate_arrays(Mesh *mesh, for (j = 0, ml = &mloops[sp->loopstart]; j < mp->totloop; j++, ml++, v++) { if (ml->v >= totvert) { /* Invalid vert idx. */ - PRINT(" loop %u has invalid vert reference (%u)\n", sp->loopstart + j, ml->v); + PRINT("\tLoop %u has invalid vert reference (%u)\n", sp->loopstart + j, ml->v); sp->invalid = TRUE; } @@ -478,7 +480,7 @@ int BKE_mesh_validate_arrays(Mesh *mesh, v = sp->verts; for (j = 0; j < mp->totloop; j++, v++) { if ((mverts[*v].flag & ME_VERT_TMP_TAG) == 0) { - PRINT(" poly %u has duplicate vert reference at corner (%u)\n", i, j); + PRINT("\tPoly %u has duplicate vert reference at corner (%u)\n", i, j); sp->invalid = TRUE; } mverts[*v].flag &= ~ME_VERT_TMP_TAG; @@ -494,7 +496,7 @@ int BKE_mesh_validate_arrays(Mesh *mesh, v2 = mloops[sp->loopstart + (j + 1) % mp->totloop].v; if (!BLI_edgehash_haskey(edge_hash, v1, v2)) { /* Edge not existing. */ - PRINT(" poly %u needs missing edge (%u, %u)\n", sp->index, v1, v2); + PRINT("\tPoly %u needs missing edge (%u, %u)\n", sp->index, v1, v2); if (do_fixes) do_edge_recalc = TRUE; else @@ -506,11 +508,11 @@ int BKE_mesh_validate_arrays(Mesh *mesh, if (do_fixes) { int prev_e = ml->e; ml->e = GET_INT_FROM_POINTER(BLI_edgehash_lookup(edge_hash, v1, v2)); - PRINT(" loop %u has invalid edge reference (%u), fixed using edge %u\n", + PRINT("\tLoop %u has invalid edge reference (%u), fixed using edge %u\n", sp->loopstart + j, prev_e, ml->e); } else { - PRINT(" loop %u has invalid edge reference (%u)\n", sp->loopstart + j, ml->e); + PRINT("\tLoop %u has invalid edge reference (%u)\n", sp->loopstart + j, ml->e); sp->invalid = TRUE; } } @@ -522,11 +524,11 @@ int BKE_mesh_validate_arrays(Mesh *mesh, if (do_fixes) { int prev_e = ml->e; ml->e = GET_INT_FROM_POINTER(BLI_edgehash_lookup(edge_hash, v1, v2)); - PRINT(" poly %u has invalid edge reference (%u), fixed using edge %u\n", + PRINT("\tPoly %u has invalid edge reference (%u), fixed using edge %u\n", sp->index, prev_e, ml->e); } else { - PRINT(" poly %u has invalid edge reference (%u)\n", sp->index, ml->e); + PRINT("\tPoly %u has invalid edge reference (%u)\n", sp->index, ml->e); sp->invalid = TRUE; } } @@ -544,7 +546,7 @@ int BKE_mesh_validate_arrays(Mesh *mesh, if (*v != *prev_v) { int dlt = v - prev_v; if (dlt > 1) { - PRINT(" poly %u is invalid, it multi-uses vertex %u (%u times)\n", + PRINT("\tPoly %u is invalid, it multi-uses vertex %u (%u times)\n", sp->index, *prev_v, dlt); sp->invalid = TRUE; } @@ -552,7 +554,7 @@ int BKE_mesh_validate_arrays(Mesh *mesh, } } if (v - prev_v > 1) { /* Don't forget final verts! */ - PRINT(" poly %u is invalid, it multi-uses vertex %u (%u times)\n", + PRINT("\tPoly %u is invalid, it multi-uses vertex %u (%u times)\n", sp->index, *prev_v, (int)(v - prev_v)); sp->invalid = TRUE; } @@ -610,17 +612,17 @@ int BKE_mesh_validate_arrays(Mesh *mesh, p2_sub = FALSE; if (p1_sub && p2_sub) { - PRINT(" polys %u and %u use same vertices, considering poly %u as invalid.\n", + PRINT("\tPolys %u and %u use same vertices, considering poly %u as invalid.\n", prev_sp->index, sp->index, sp->index); sp->invalid = TRUE; } /* XXX In fact, these might be valid? :/ */ else if (p1_sub) { - PRINT(" %u is a sub-poly of %u, considering it as invalid.\n", sp->index, prev_sp->index); + PRINT("\t%u is a sub-poly of %u, considering it as invalid.\n", sp->index, prev_sp->index); sp->invalid = TRUE; } else if (p2_sub) { - PRINT(" %u is a sub-poly of %u, considering it as invalid.\n", prev_sp->index, sp->index); + PRINT("\t%u is a sub-poly of %u, considering it as invalid.\n", prev_sp->index, sp->index); prev_sp->invalid = TRUE; prev_sp = sp; /* sp is new reference poly. */ } @@ -631,7 +633,7 @@ int BKE_mesh_validate_arrays(Mesh *mesh, } if ((p1_nv == p2_nv) && (memcmp(p1_v, p2_v, p1_nv * sizeof(*p1_v)) == 0)) { if (do_verbose) { - PRINT(" polys %u and %u use same vertices (%u", + PRINT("\tPolys %u and %u use same vertices (%u", prev_sp->index, sp->index, *p1_v); for (j = 1; j < p1_nv; j++) PRINT(", %u", p1_v[j]); @@ -671,7 +673,7 @@ int BKE_mesh_validate_arrays(Mesh *mesh, /* Unused loops. */ if (prev_end < sp->loopstart) { for (j = prev_end, ml = &mloops[prev_end]; j < sp->loopstart; j++, ml++) { - PRINT(" loop %u is unused.\n", j); + PRINT("\tLoop %u is unused.\n", j); if (do_fixes) REMOVE_LOOP_TAG(ml); } @@ -680,7 +682,7 @@ int BKE_mesh_validate_arrays(Mesh *mesh, } /* Multi-used loops. */ else if (prev_end > sp->loopstart) { - PRINT(" polys %u and %u share loops from %u to %u, considering poly %u as invalid.\n", + PRINT("\tPolys %u and %u share loops from %u to %u, considering poly %u as invalid.\n", prev_sp->index, sp->index, sp->loopstart, prev_end, sp->index); if (do_fixes) { REMOVE_POLY_TAG((&mpolys[sp->index])); @@ -699,7 +701,7 @@ int BKE_mesh_validate_arrays(Mesh *mesh, /* We may have some remaining unused loops to get rid of! */ if (prev_end < totloop) { for (j = prev_end, ml = &mloops[prev_end]; j < totloop; j++, ml++) { - PRINT(" loop %u is unused.\n", j); + PRINT("\tLoop %u is unused.\n", j); if (do_fixes) REMOVE_LOOP_TAG(ml); } @@ -720,14 +722,14 @@ int BKE_mesh_validate_arrays(Mesh *mesh, for (j = 0, dw = dv->dw; j < dv->totweight; j++, dw++) { /* note, greater then max defgroups is accounted for in our code, but not < 0 */ if (!finite(dw->weight)) { - PRINT(" vertex deform %u, group %d has weight: %f\n", i, dw->def_nr, dw->weight); + PRINT("\tVertex deform %u, group %d has weight: %f\n", i, dw->def_nr, dw->weight); if (do_fixes) { dw->weight = 0.0f; vert_weights_fixed = TRUE; } } else if (dw->weight < 0.0f || dw->weight > 1.0f) { - PRINT(" vertex deform %u, group %d has weight: %f\n", i, dw->def_nr, dw->weight); + PRINT("\tVertex deform %u, group %d has weight: %f\n", i, dw->def_nr, dw->weight); if (do_fixes) { CLAMP(dw->weight, 0.0f, 1.0f); vert_weights_fixed = TRUE; @@ -735,7 +737,7 @@ int BKE_mesh_validate_arrays(Mesh *mesh, } if (dw->def_nr < 0) { - PRINT(" vertex deform %u, has invalid group %d\n", i, dw->def_nr); + PRINT("\tVertex deform %u, has invalid group %d\n", i, dw->def_nr); if (do_fixes) { defvert_remove_group(dv, dw); if (dv->dw) { @@ -783,10 +785,10 @@ int BKE_mesh_validate_arrays(Mesh *mesh, int free_msel = FALSE; for (i = 0, msel = mesh->mselect; i < mesh->totselect; i++, msel++) { - int tot_elem; + int tot_elem = 0; if (msel->index < 0) { - PRINT("Mesh select element %d type %d index is negative, " + PRINT("\tMesh select element %d type %d index is negative, " "resetting selection stack.\n", i, msel->type); free_msel = TRUE; break; @@ -805,7 +807,7 @@ int BKE_mesh_validate_arrays(Mesh *mesh, } if (msel->index > tot_elem) { - PRINT("Mesh select element %d type %d index %d is larger than data array size %d, " + PRINT("\tMesh select element %d type %d index %d is larger than data array size %d, " "resetting selection stack.\n", i, msel->type, msel->index, tot_elem); free_msel = TRUE; @@ -820,7 +822,7 @@ int BKE_mesh_validate_arrays(Mesh *mesh, } } - PRINT("BKE_mesh_validate: finished\n\n"); + PRINT("%s: finished\n\n", __func__); return (verts_fixed || vert_weights_fixed || do_polyloop_free || do_edge_free || do_edge_recalc || msel_fixed); } @@ -829,13 +831,15 @@ static int mesh_validate_customdata(CustomData *data, short do_verbose, const sh { int i = 0, has_fixes = 0; + PRINT("%s: Checking %d CD layers...\n", __func__, data->totlayer); + while (i < data->totlayer) { CustomDataLayer *layer = &data->layers[i]; CustomDataMask mask = CD_TYPE_AS_MASK(layer->type); int ok = 1; if ((mask & CD_MASK_MESH) == 0) { - PRINT("CustomDataLayer type %d which isn't in CD_MASK_MESH is stored in Mehs structure\n", layer->type); + PRINT("\tCustomDataLayer type %d which isn't in CD_MASK_MESH is stored in Mesh structure\n", layer->type); if (do_fixes) { CustomData_free_layer(data, layer->type, 0, i); @@ -848,6 +852,8 @@ static int mesh_validate_customdata(CustomData *data, short do_verbose, const sh i++; } + PRINT("%s: Finished\n\n", __func__); + return has_fixes; } diff --git a/source/blender/blenkernel/intern/modifier.c b/source/blender/blenkernel/intern/modifier.c index b4c30203000..65538e5bea2 100644 --- a/source/blender/blenkernel/intern/modifier.c +++ b/source/blender/blenkernel/intern/modifier.c @@ -331,6 +331,13 @@ int modifiers_isClothEnabled(Object *ob) return (md && md->mode & (eModifierMode_Realtime | eModifierMode_Render)); } +int modifiers_isModifierEnabled(Object *ob, int modifierType) +{ + ModifierData *md = modifiers_findByType(ob, modifierType); + + return (md && md->mode & (eModifierMode_Realtime | eModifierMode_Render)); +} + int modifiers_isParticleEnabled(Object *ob) { ModifierData *md = modifiers_findByType(ob, eModifierType_ParticleSystem); diff --git a/source/blender/blenkernel/intern/nla.c b/source/blender/blenkernel/intern/nla.c index 2b4fe72e8bb..fb15aa82fa2 100644 --- a/source/blender/blenkernel/intern/nla.c +++ b/source/blender/blenkernel/intern/nla.c @@ -1391,7 +1391,7 @@ static void BKE_nlastrip_validate_autoblends(NlaTrack *nlt, NlaStrip *nls) /* set overlaps for this strip * - don't use the values obtained though if the end in question - * is directly followed/preceeded by another strip, forming an + * is directly followed/preceded by another strip, forming an * 'island' of continuous strips */ if ((ps || ns) && ((nls->prev == NULL) || IS_EQF(nls->prev->end, nls->start) == 0)) { diff --git a/source/blender/blenkernel/intern/node.c b/source/blender/blenkernel/intern/node.c index a5e081d122d..33df8e4b503 100644 --- a/source/blender/blenkernel/intern/node.c +++ b/source/blender/blenkernel/intern/node.c @@ -633,8 +633,12 @@ bNodeTree *ntreeAddTree(const char *name, int type, int nodetype) * - this gets called when executing compositing updates (for threaded previews) * - when the nodetree datablock needs to be copied (i.e. when users get copied) * - for scene duplication use ntreeSwapID() after so we don't have stale pointers. + * + * do_make_extern: keep enabled for general use, only reason _not_ to enable is when + * copying for internal use (threads for eg), where you wont want it to modify the + * scene data. */ -bNodeTree *ntreeCopyTree(bNodeTree *ntree) +static bNodeTree *ntreeCopyTree_internal(bNodeTree *ntree, const short do_make_extern) { bNodeTree *newtree; bNode *node /*, *nnode */ /* UNUSED */, *last; @@ -664,6 +668,11 @@ bNodeTree *ntreeCopyTree(bNodeTree *ntree) last = ntree->nodes.last; for (node= ntree->nodes.first; node; node= node->next) { + + if (do_make_extern) { + id_lib_extern(node->id); + } + node->new_node= NULL; /* nnode= */ nodeCopyNode(newtree, node); /* sets node->new */ @@ -709,6 +718,11 @@ bNodeTree *ntreeCopyTree(bNodeTree *ntree) return newtree; } +bNodeTree *ntreeCopyTree(bNodeTree *ntree) +{ + return ntreeCopyTree_internal(ntree, TRUE); +} + /* use when duplicating scenes */ void ntreeSwitchID(bNodeTree *ntree, ID *id_from, ID *id_to) { @@ -1131,7 +1145,7 @@ bNodeTree *ntreeLocalize(bNodeTree *ntree) } /* node copy func */ - ltree= ntreeCopyTree(ntree); + ltree = ntreeCopyTree_internal(ntree, FALSE); if (adt) { AnimData *ladt= BKE_animdata_from_id(<ree->id); diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c index 877563ddd53..cd53bf01a67 100644 --- a/source/blender/blenkernel/intern/object.c +++ b/source/blender/blenkernel/intern/object.c @@ -853,7 +853,7 @@ Object *BKE_object_add_only_object(int type, const char *name) ob->pc_ids.first = ob->pc_ids.last = NULL; - /* Animation Visualisation defaults */ + /* Animation Visualization defaults */ animviz_settings_init(&ob->avs); return ob; @@ -1470,7 +1470,7 @@ void BKE_object_rot_to_mat3(Object *ob, float mat[][3]) axis_angle_to_mat3(dmat, ob->drotAxis, ob->drotAngle); } else { - /* quats are normalised before use to eliminate scaling issues */ + /* quats are normalized before use to eliminate scaling issues */ float tquat[4]; normalize_qt_qt(tquat, ob->quat); @@ -2548,7 +2548,7 @@ void BKE_object_handle_update(Scene *scene, Object *ob) printf("recalcdata %s\n", ob->id.name + 2); if (adt) { - /* evaluate drivers */ + /* evaluate drivers - datalevel */ // XXX: for mesh types, should we push this to derivedmesh instead? BKE_animsys_evaluate_animdata(scene, data_id, adt, ctime, ADT_RECALC_DRIVERS); } @@ -2605,8 +2605,26 @@ void BKE_object_handle_update(Scene *scene, Object *ob) BKE_lattice_modifiers_calc(scene, ob); break; } - - + + /* related materials */ + /* XXX: without depsgraph tagging, this will always need to be run, which will be slow! + * However, not doing anything (or trying to hack around this lack) is not an option + * anymore, especially due to Cycles [#31834] + */ + if (ob->totcol) { + int a; + + for (a = 1; a <= ob->totcol; a++) { + Material *ma = give_current_material(ob, a); + + if (ma) { + /* recursively update drivers for this material */ + material_drivers_update(scene, ma, ctime); + } + } + } + + /* particles */ if (ob->particlesystem.first) { ParticleSystem *tpsys, *psys; DerivedMesh *dm; diff --git a/source/blender/blenkernel/intern/particle_system.c b/source/blender/blenkernel/intern/particle_system.c index 569e69f2d51..65f22ebc88f 100644 --- a/source/blender/blenkernel/intern/particle_system.c +++ b/source/blender/blenkernel/intern/particle_system.c @@ -3320,7 +3320,7 @@ static int collision_response(ParticleData *pa, ParticleCollision *col, BVHTreeR } } - /* stickness was possibly added before, so cancel that before calculating new normal velocity */ + /* stickiness was possibly added before, so cancel that before calculating new normal velocity */ /* otherwise particles go flying out of the surface because of high reversed sticky velocity */ if (v0_dot < 0.0f) { v0_dot += pd->pdef_stickness; @@ -3379,7 +3379,7 @@ static int collision_response(ParticleData *pa, ParticleCollision *col, BVHTreeR madd_v3_v3fl(pa->state.vel, nor, -dot); } - /* add stickness to surface */ + /* add stickiness to surface */ madd_v3_v3fl(pa->state.vel, pce->nor, -pd->pdef_stickness); /* set coordinates for next iteration */ diff --git a/source/blender/blenkernel/intern/smoke.c b/source/blender/blenkernel/intern/smoke.c index 32def1be647..ddcba509301 100644 --- a/source/blender/blenkernel/intern/smoke.c +++ b/source/blender/blenkernel/intern/smoke.c @@ -141,7 +141,7 @@ struct SmokeModifierData; /* forward declerations */ static void calcTriangleDivs(Object *ob, MVert *verts, int numverts, MFace *tris, int numfaces, int numtris, int **tridivs, float cell_len); -static void get_cell(float *p0, int res[3], float dx, float *pos, int *cell, int correct); +static void get_cell(const float p0[3], const int res[3], float dx, const float pos[3], int cell[3], int correct); static void fill_scs_points(Object *ob, DerivedMesh *dm, SmokeCollSettings *scs); #else /* WITH_SMOKE */ @@ -1977,7 +1977,7 @@ static void bresenham_linie_3D(int x1, int y1, int z1, int x2, int y2, int z2, f cb(result, input, res, pixel, tRay, correct); } -static void get_cell(float *p0, int res[3], float dx, float *pos, int *cell, int correct) +static void get_cell(const float p0[3], const int res[3], float dx, const float pos[3], int cell[3], int correct) { float tmp[3]; diff --git a/source/blender/blenkernel/intern/softbody.c b/source/blender/blenkernel/intern/softbody.c index 63f0a29821f..1d6895a8c71 100644 --- a/source/blender/blenkernel/intern/softbody.c +++ b/source/blender/blenkernel/intern/softbody.c @@ -1718,15 +1718,15 @@ static int choose_winner(float*w, float* pos, float*a, float*b, float*c, float*c { float mindist, cp; int winner =1; - mindist = ABS(dot_v3v3(pos, a)); + mindist = fabsf(dot_v3v3(pos, a)); - cp = ABS(dot_v3v3(pos, b)); + cp = fabsf(dot_v3v3(pos, b)); if ( mindist < cp ) { mindist = cp; winner =2; } - cp = ABS(dot_v3v3(pos, c)); + cp = fabsf(dot_v3v3(pos, c)); if (mindist < cp ) { mindist = cp; winner =3; diff --git a/source/blender/blenkernel/intern/tracking.c b/source/blender/blenkernel/intern/tracking.c index 3dea8a85915..4342eb20d55 100644 --- a/source/blender/blenkernel/intern/tracking.c +++ b/source/blender/blenkernel/intern/tracking.c @@ -2315,10 +2315,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] = MAX2(dim[0], dim[1]) / 2.0f; + margin[0] = margin[1] = maxf(dim[0], dim[1]) / 2.0f; - margin[0] = MAX2(margin[0], (float)track->margin / frame_width); - margin[1] = MAX2(margin[1], (float)track->margin / frame_height); + margin[0] = maxf(margin[0], (float)track->margin / frame_width); + margin[1] = maxf(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] || @@ -3028,9 +3028,9 @@ static unsigned char *detect_get_frame_ucharbuf(ImBuf *ibuf) if (ibuf->rect_float) { const float *rrgbf = ibuf->rect_float + pixel * 4; - const float grey_f = 0.2126f * rrgbf[0] + 0.7152f * rrgbf[1] + 0.0722f * rrgbf[2]; + const float gray_f = 0.2126f * rrgbf[0] + 0.7152f * rrgbf[1] + 0.0722f * rrgbf[2]; - *cp = FTOCHAR(grey_f); + *cp = FTOCHAR(gray_f); } else { const unsigned char *rrgb = (unsigned char *)ibuf->rect + pixel * 4; diff --git a/source/blender/blenkernel/intern/unit.c b/source/blender/blenkernel/intern/unit.c index 1180d2c72d5..df4d2d8cc38 100644 --- a/source/blender/blenkernel/intern/unit.c +++ b/source/blender/blenkernel/intern/unit.c @@ -108,107 +108,107 @@ static struct bUnitCollection buDummyCollecton = {buDummyDef, 0, 0, sizeof(buDum /* Lengths */ static struct bUnitDef buMetricLenDef[] = { - {"kilometer", "kilometers", "km", NULL, "Kilometers", UN_SC_KM, 0.0, B_UNIT_DEF_NONE}, - {"hectometer", "hectometers", "hm", NULL, "100 Meters", UN_SC_HM, 0.0, B_UNIT_DEF_SUPPRESS}, - {"dekameter", "dekameters", "dam",NULL, "10 Meters", UN_SC_DAM, 0.0, B_UNIT_DEF_SUPPRESS}, - {"meter", "meters", "m", NULL, "Meters", UN_SC_M, 0.0, B_UNIT_DEF_NONE}, /* base unit */ - {"decimetre", "decimetres", "dm", NULL, "10 Centimeters", UN_SC_DM, 0.0, B_UNIT_DEF_SUPPRESS}, - {"centimeter", "centimeters", "cm", NULL, "Centimeters", UN_SC_CM, 0.0, B_UNIT_DEF_NONE}, - {"millimeter", "millimeters", "mm", NULL, "Millimeters", UN_SC_MM, 0.0, B_UNIT_DEF_NONE}, - {"micrometer", "micrometers", "µm", "um", "Micrometers", UN_SC_UM, 0.0, B_UNIT_DEF_NONE}, // micron too? + {"kilometer", "kilometers", "km", NULL, "Kilometers", UN_SC_KM, 0.0, B_UNIT_DEF_NONE}, + {"hectometer", "hectometers", "hm", NULL, "100 Meters", UN_SC_HM, 0.0, B_UNIT_DEF_SUPPRESS}, + {"dekameter", "dekameters", "dam", NULL, "10 Meters", UN_SC_DAM, 0.0, B_UNIT_DEF_SUPPRESS}, + {"meter", "meters", "m", NULL, "Meters", UN_SC_M, 0.0, B_UNIT_DEF_NONE}, /* base unit */ + {"decimeter", "decimeters", "dm", NULL, "10 Centimeters", UN_SC_DM, 0.0, B_UNIT_DEF_SUPPRESS}, + {"centimeter", "centimeters", "cm", NULL, "Centimeters", UN_SC_CM, 0.0, B_UNIT_DEF_NONE}, + {"millimeter", "millimeters", "mm", NULL, "Millimeters", UN_SC_MM, 0.0, B_UNIT_DEF_NONE}, + {"micrometer", "micrometers", "µm", "um", "Micrometers", UN_SC_UM, 0.0, B_UNIT_DEF_NONE}, // micron too? /* These get displayed because of float precision problems in the transform header, * could work around, but for now probably people wont use these */ #if 0 - {"nanometer", "Nanometers", "nm", NULL, 0.000000001, 0.0, B_UNIT_DEF_NONE}, - {"picometer", "Picometers", "pm", NULL, 0.000000000001, 0.0,B_UNIT_DEF_NONE}, + {"nanometer", "Nanometers", "nm", NULL, 0.000000001, 0.0, B_UNIT_DEF_NONE}, + {"picometer", "Picometers", "pm", NULL, 0.000000000001, 0.0, B_UNIT_DEF_NONE}, #endif {NULL, NULL, NULL, NULL, NULL, 0.0, 0.0} }; static struct bUnitCollection buMetricLenCollecton = {buMetricLenDef, 3, 0, sizeof(buMetricLenDef) / sizeof(bUnitDef)}; static struct bUnitDef buImperialLenDef[] = { - {"mile", "miles", "mi", "m", "Miles", UN_SC_MI, 0.0, B_UNIT_DEF_NONE}, - {"furlong", "furlongs", "fur", NULL, "Furlongs",UN_SC_FUR, 0.0, B_UNIT_DEF_SUPPRESS}, - {"chain", "chains", "ch", NULL, "Chains", UN_SC_CH, 0.0, B_UNIT_DEF_SUPPRESS}, - {"yard", "yards", "yd", NULL, "Yards", UN_SC_YD, 0.0, B_UNIT_DEF_SUPPRESS}, - {"foot", "feet", "'", "ft", "Feet", UN_SC_FT, 0.0, B_UNIT_DEF_NONE}, /* base unit */ - {"inch", "inches", "\"", "in", "Inches", UN_SC_IN, 0.0, B_UNIT_DEF_NONE}, - {"thou", "thou", "thou", "mil", "Thou", UN_SC_MIL, 0.0, B_UNIT_DEF_NONE}, /* plural for thou has no 's' */ + {"mile", "miles", "mi", "m", "Miles", UN_SC_MI, 0.0, B_UNIT_DEF_NONE}, + {"furlong", "furlongs", "fur", NULL, "Furlongs", UN_SC_FUR, 0.0, B_UNIT_DEF_SUPPRESS}, + {"chain", "chains", "ch", NULL, "Chains", UN_SC_CH, 0.0, B_UNIT_DEF_SUPPRESS}, + {"yard", "yards", "yd", NULL, "Yards", UN_SC_YD, 0.0, B_UNIT_DEF_SUPPRESS}, + {"foot", "feet", "'", "ft", "Feet", UN_SC_FT, 0.0, B_UNIT_DEF_NONE}, /* base unit */ + {"inch", "inches", "\"", "in", "Inches", UN_SC_IN, 0.0, B_UNIT_DEF_NONE}, + {"thou", "thou", "thou", "mil", "Thou", UN_SC_MIL, 0.0, B_UNIT_DEF_NONE}, /* plural for thou has no 's' */ {NULL, NULL, NULL, NULL, NULL, 0.0, 0.0} }; static struct bUnitCollection buImperialLenCollecton = {buImperialLenDef, 4, 0, sizeof(buImperialLenDef) / sizeof(bUnitDef)}; /* Areas */ static struct bUnitDef buMetricAreaDef[] = { - {"square kilometer", "square kilometers", "km²", "km2", "Square Kilometers", UN_SC_KM*UN_SC_KM, 0.0, B_UNIT_DEF_NONE}, - {"square hectometer","square hectometers", "hm²", "hm2", "Square Hectometers", UN_SC_HM*UN_SC_HM, 0.0, B_UNIT_DEF_NONE}, /* hectare */ - {"square dekameter", "square dekameters", "dam²","dam2", "Square Dekameters", UN_SC_DAM*UN_SC_DAM, 0.0, B_UNIT_DEF_SUPPRESS}, /* are */ - {"square meter", "square meters", "m²", "m2", "Square Meters", UN_SC_M*UN_SC_M, 0.0, B_UNIT_DEF_NONE}, /* base unit */ - {"square decimetre", "square decimetres", "dm²", "dm2", "Square Decimetres", UN_SC_DM*UN_SC_DM, 0.0, B_UNIT_DEF_SUPPRESS}, - {"square centimeter", "square centimeters", "cm²", "cm2", "Square Centimeters", UN_SC_CM*UN_SC_CM, 0.0, B_UNIT_DEF_NONE}, - {"square millimeter", "square millimeters", "mm²", "mm2", "Square Millimeters", UN_SC_MM*UN_SC_MM, 0.0, B_UNIT_DEF_NONE}, - {"square micrometer", "square micrometers", "µm²", "um2", "Square Micrometers", UN_SC_UM*UN_SC_UM, 0.0, B_UNIT_DEF_NONE}, - {NULL, NULL, NULL, NULL, NULL, 0.0, 0.0} + {"square kilometer", "square kilometers", "km²", "km2", "Square Kilometers", UN_SC_KM * UN_SC_KM, 0.0, B_UNIT_DEF_NONE}, + {"square hectometer", "square hectometers", "hm²", "hm2", "Square Hectometers", UN_SC_HM * UN_SC_HM, 0.0, B_UNIT_DEF_NONE}, /* hectare */ + {"square dekameter", "square dekameters", "dam²", "dam2", "Square Dekameters", UN_SC_DAM * UN_SC_DAM, 0.0, B_UNIT_DEF_SUPPRESS}, /* are */ + {"square meter", "square meters", "m²", "m2", "Square Meters", UN_SC_M * UN_SC_M, 0.0, B_UNIT_DEF_NONE}, /* base unit */ + {"square decimeter", "square decimetees", "dm²", "dm2", "Square Decimeters", UN_SC_DM * UN_SC_DM, 0.0, B_UNIT_DEF_SUPPRESS}, + {"square centimeter", "square centimeters", "cm²", "cm2", "Square Centimeters", UN_SC_CM * UN_SC_CM, 0.0, B_UNIT_DEF_NONE}, + {"square millimeter", "square millimeters", "mm²", "mm2", "Square Millimeters", UN_SC_MM * UN_SC_MM, 0.0, B_UNIT_DEF_NONE}, + {"square micrometer", "square micrometers", "µm²", "um2", "Square Micrometers", UN_SC_UM * UN_SC_UM, 0.0, B_UNIT_DEF_NONE}, + {NULL, NULL, NULL, NULL, NULL, 0.0, 0.0} }; static struct bUnitCollection buMetricAreaCollecton = {buMetricAreaDef, 3, 0, sizeof(buMetricAreaDef) / sizeof(bUnitDef)}; static struct bUnitDef buImperialAreaDef[] = { - {"square mile", "square miles", "sq mi", "sq m","Square Miles", UN_SC_MI*UN_SC_MI, 0.0, B_UNIT_DEF_NONE}, - {"square furlong", "square furlongs", "sq fur",NULL, "Square Furlongs", UN_SC_FUR*UN_SC_FUR, 0.0,B_UNIT_DEF_SUPPRESS}, - {"square chain", "square chains", "sq ch", NULL, "Square Chains", UN_SC_CH*UN_SC_CH, 0.0, B_UNIT_DEF_SUPPRESS}, - {"square yard", "square yards", "sq yd", NULL, "Square Yards", UN_SC_YD*UN_SC_YD, 0.0, B_UNIT_DEF_NONE}, - {"square foot", "square feet", "sq ft", NULL, "Square Feet", UN_SC_FT*UN_SC_FT, 0.0, B_UNIT_DEF_NONE}, /* base unit */ - {"square inch", "square inches", "sq in", NULL, "Square Inches", UN_SC_IN*UN_SC_IN, 0.0, B_UNIT_DEF_NONE}, - {"square thou", "square thous", "sq mil",NULL, "Square Thous", UN_SC_MIL*UN_SC_MIL, 0.0, B_UNIT_DEF_NONE}, + {"square mile", "square miles", "sq mi", "sq m", "Square Miles", UN_SC_MI * UN_SC_MI, 0.0, B_UNIT_DEF_NONE}, + {"square furlong", "square furlongs", "sq fur", NULL, "Square Furlongs", UN_SC_FUR * UN_SC_FUR, 0.0, B_UNIT_DEF_SUPPRESS}, + {"square chain", "square chains", "sq ch", NULL, "Square Chains", UN_SC_CH * UN_SC_CH, 0.0, B_UNIT_DEF_SUPPRESS}, + {"square yard", "square yards", "sq yd", NULL, "Square Yards", UN_SC_YD * UN_SC_YD, 0.0, B_UNIT_DEF_NONE}, + {"square foot", "square feet", "sq ft", NULL, "Square Feet", UN_SC_FT * UN_SC_FT, 0.0, B_UNIT_DEF_NONE}, /* base unit */ + {"square inch", "square inches", "sq in", NULL, "Square Inches", UN_SC_IN * UN_SC_IN, 0.0, B_UNIT_DEF_NONE}, + {"square thou", "square thous", "sq mil", NULL, "Square Thous", UN_SC_MIL * UN_SC_MIL, 0.0, B_UNIT_DEF_NONE}, {NULL, NULL, NULL, NULL, NULL, 0.0, 0.0} }; static struct bUnitCollection buImperialAreaCollecton = {buImperialAreaDef, 4, 0, sizeof(buImperialAreaDef) / sizeof(bUnitDef)}; /* Volumes */ static struct bUnitDef buMetricVolDef[] = { - {"cubic kilometer", "cubic kilometers", "km³", "km3", "Cubic Kilometers", UN_SC_KM*UN_SC_KM*UN_SC_KM, 0.0, B_UNIT_DEF_NONE}, - {"cubic hectometer","cubic hectometers", "hm³", "hm3", "Cubic Hectometers", UN_SC_HM*UN_SC_HM*UN_SC_HM, 0.0, B_UNIT_DEF_NONE}, - {"cubic dekameter", "cubic dekameters", "dam³","dam3", "Cubic Dekameters", UN_SC_DAM*UN_SC_DAM*UN_SC_DAM, 0.0, B_UNIT_DEF_SUPPRESS}, - {"cubic meter", "cubic meters", "m³", "m3", "Cubic Meters", UN_SC_M*UN_SC_M*UN_SC_M, 0.0, B_UNIT_DEF_NONE}, /* base unit */ - {"cubic decimetre", "cubic decimetres", "dm³", "dm3", "Cubic Decimetres", UN_SC_DM*UN_SC_DM*UN_SC_DM, 0.0, B_UNIT_DEF_SUPPRESS}, - {"cubic centimeter", "cubic centimeters", "cm³", "cm3", "Cubic Centimeters", UN_SC_CM*UN_SC_CM*UN_SC_CM, 0.0, B_UNIT_DEF_NONE}, - {"cubic millimeter", "cubic millimeters", "mm³", "mm3", "Cubic Millimeters", UN_SC_MM*UN_SC_MM*UN_SC_MM, 0.0, B_UNIT_DEF_NONE}, - {"cubic micrometer", "cubic micrometers", "µm³", "um3", "Cubic Micrometers", UN_SC_UM*UN_SC_UM*UN_SC_UM, 0.0, B_UNIT_DEF_NONE}, - {NULL, NULL, NULL, NULL, NULL, 0.0, 0.0} + {"cubic kilometer", "cubic kilometers", "km³", "km3", "Cubic Kilometers", UN_SC_KM * UN_SC_KM * UN_SC_KM, 0.0, B_UNIT_DEF_NONE}, + {"cubic hectometer", "cubic hectometers", "hm³", "hm3", "Cubic Hectometers", UN_SC_HM * UN_SC_HM * UN_SC_HM, 0.0, B_UNIT_DEF_NONE}, + {"cubic dekameter", "cubic dekameters", "dam³", "dam3", "Cubic Dekameters", UN_SC_DAM * UN_SC_DAM * UN_SC_DAM, 0.0, B_UNIT_DEF_SUPPRESS}, + {"cubic meter", "cubic meters", "m³", "m3", "Cubic Meters", UN_SC_M * UN_SC_M * UN_SC_M, 0.0, B_UNIT_DEF_NONE}, /* base unit */ + {"cubic decimeter", "cubic decimeters", "dm³", "dm3", "Cubic Decimeters", UN_SC_DM * UN_SC_DM * UN_SC_DM, 0.0, B_UNIT_DEF_SUPPRESS}, + {"cubic centimeter", "cubic centimeters", "cm³", "cm3", "Cubic Centimeters", UN_SC_CM * UN_SC_CM * UN_SC_CM, 0.0, B_UNIT_DEF_NONE}, + {"cubic millimeter", "cubic millimeters", "mm³", "mm3", "Cubic Millimeters", UN_SC_MM * UN_SC_MM * UN_SC_MM, 0.0, B_UNIT_DEF_NONE}, + {"cubic micrometer", "cubic micrometers", "µm³", "um3", "Cubic Micrometers", UN_SC_UM * UN_SC_UM * UN_SC_UM, 0.0, B_UNIT_DEF_NONE}, + {NULL, NULL, NULL, NULL, NULL, 0.0, 0.0} }; static struct bUnitCollection buMetricVolCollecton = {buMetricVolDef, 3, 0, sizeof(buMetricVolDef) / sizeof(bUnitDef)}; static struct bUnitDef buImperialVolDef[] = { - {"cubic mile", "cubic miles", "cu mi", "cu m","Cubic Miles", UN_SC_MI*UN_SC_MI*UN_SC_MI, 0.0, B_UNIT_DEF_NONE}, - {"cubic furlong", "cubic furlongs", "cu fur",NULL, "Cubic Furlongs", UN_SC_FUR*UN_SC_FUR*UN_SC_FUR, 0.0,B_UNIT_DEF_SUPPRESS}, - {"cubic chain", "cubic chains", "cu ch", NULL, "Cubic Chains", UN_SC_CH*UN_SC_CH*UN_SC_CH, 0.0, B_UNIT_DEF_SUPPRESS}, - {"cubic yard", "cubic yards", "cu yd", NULL, "Cubic Yards", UN_SC_YD*UN_SC_YD*UN_SC_YD, 0.0, B_UNIT_DEF_NONE}, - {"cubic foot", "cubic feet", "cu ft", NULL, "Cubic Feet", UN_SC_FT*UN_SC_FT*UN_SC_FT, 0.0, B_UNIT_DEF_NONE}, /* base unit */ - {"cubic inch", "cubic inches", "cu in", NULL, "Cubic Inches", UN_SC_IN*UN_SC_IN*UN_SC_IN, 0.0, B_UNIT_DEF_NONE}, - {"cubic thou", "cubic thous", "cu mil",NULL, "Cubic Thous", UN_SC_MIL*UN_SC_MIL*UN_SC_MIL, 0.0, B_UNIT_DEF_NONE}, + {"cubic mile", "cubic miles", "cu mi", "cu m", "Cubic Miles", UN_SC_MI * UN_SC_MI * UN_SC_MI, 0.0, B_UNIT_DEF_NONE}, + {"cubic furlong", "cubic furlongs", "cu fur", NULL, "Cubic Furlongs", UN_SC_FUR * UN_SC_FUR * UN_SC_FUR, 0.0, B_UNIT_DEF_SUPPRESS}, + {"cubic chain", "cubic chains", "cu ch", NULL, "Cubic Chains", UN_SC_CH * UN_SC_CH * UN_SC_CH, 0.0, B_UNIT_DEF_SUPPRESS}, + {"cubic yard", "cubic yards", "cu yd", NULL, "Cubic Yards", UN_SC_YD * UN_SC_YD * UN_SC_YD, 0.0, B_UNIT_DEF_NONE}, + {"cubic foot", "cubic feet", "cu ft", NULL, "Cubic Feet", UN_SC_FT * UN_SC_FT * UN_SC_FT, 0.0, B_UNIT_DEF_NONE}, /* base unit */ + {"cubic inch", "cubic inches", "cu in", NULL , "Cubic Inches", UN_SC_IN * UN_SC_IN * UN_SC_IN, 0.0, B_UNIT_DEF_NONE}, + {"cubic thou", "cubic thous", "cu mil", NULL, "Cubic Thous", UN_SC_MIL * UN_SC_MIL * UN_SC_MIL, 0.0, B_UNIT_DEF_NONE}, {NULL, NULL, NULL, NULL, NULL, 0.0, 0.0} }; static struct bUnitCollection buImperialVolCollecton = {buImperialVolDef, 4, 0, sizeof(buImperialVolDef) / sizeof(bUnitDef)}; /* Mass */ static struct bUnitDef buMetricMassDef[] = { - {"ton", "tonnes", "ton", "t", "1000 Kilograms", UN_SC_MTON, 0.0, B_UNIT_DEF_NONE}, - {"quintal", "quintals", "ql", "q", "100 Kilograms", UN_SC_QL, 0.0, B_UNIT_DEF_NONE}, - {"kilogram", "kilograms", "kg", NULL, "Kilograms", UN_SC_KG, 0.0, B_UNIT_DEF_NONE}, /* base unit */ - {"hectogram", "hectograms", "hg", NULL, "Hectograms", UN_SC_HG, 0.0, B_UNIT_DEF_NONE}, - {"dekagram", "dekagrams", "dag",NULL, "10 Grams", UN_SC_DAG, 0.0, B_UNIT_DEF_SUPPRESS}, - {"gram", "grams", "g", NULL, "Grams", UN_SC_G, 0.0, B_UNIT_DEF_NONE}, - {NULL, NULL, NULL, NULL, NULL, 0.0, 0.0} + {"ton", "tonnes", "ton", "t", "1000 Kilograms", UN_SC_MTON, 0.0, B_UNIT_DEF_NONE}, + {"quintal", "quintals", "ql", "q", "100 Kilograms", UN_SC_QL, 0.0, B_UNIT_DEF_NONE}, + {"kilogram", "kilograms", "kg", NULL, "Kilograms", UN_SC_KG, 0.0, B_UNIT_DEF_NONE}, /* base unit */ + {"hectogram", "hectograms", "hg", NULL, "Hectograms", UN_SC_HG, 0.0, B_UNIT_DEF_NONE}, + {"dekagram", "dekagrams", "dag", NULL, "10 Grams", UN_SC_DAG, 0.0, B_UNIT_DEF_SUPPRESS}, + {"gram", "grams", "g", NULL, "Grams", UN_SC_G, 0.0, B_UNIT_DEF_NONE}, + {NULL, NULL, NULL, NULL, NULL, 0.0, 0.0} }; static struct bUnitCollection buMetricMassCollecton = {buMetricMassDef, 2, 0, sizeof(buMetricMassDef) / sizeof(bUnitDef)}; static struct bUnitDef buImperialMassDef[] = { - {"ton", "tonnes", "ton", "t", "Tonnes", UN_SC_ITON, 0.0, B_UNIT_DEF_NONE}, + {"ton", "tonnes", "ton", "t", "Tonnes", UN_SC_ITON, 0.0, B_UNIT_DEF_NONE}, {"centum weight", "centum weights", "cwt", NULL, "Centum weights", UN_SC_CWT, 0.0, B_UNIT_DEF_NONE}, - {"stone", "stones", "st", NULL, "Stones", UN_SC_ST, 0.0, B_UNIT_DEF_NONE}, - {"pound", "pounds", "lb", NULL, "Pounds", UN_SC_LB, 0.0, B_UNIT_DEF_NONE}, /* base unit */ - {"ounce", "ounces", "oz", NULL, "Ounces", UN_SC_OZ, 0.0, B_UNIT_DEF_NONE}, + {"stone", "stones", "st", NULL, "Stones", UN_SC_ST, 0.0, B_UNIT_DEF_NONE}, + {"pound", "pounds", "lb", NULL, "Pounds", UN_SC_LB, 0.0, B_UNIT_DEF_NONE}, /* base unit */ + {"ounce", "ounces", "oz", NULL, "Ounces", UN_SC_OZ, 0.0, B_UNIT_DEF_NONE}, {NULL, NULL, NULL, NULL, NULL, 0.0, 0.0} }; static struct bUnitCollection buImperialMassCollecton = {buImperialMassDef, 3, 0, sizeof(buImperialMassDef) / sizeof(bUnitDef)}; @@ -218,15 +218,15 @@ static struct bUnitCollection buImperialMassCollecton = {buImperialMassDef, 3, 0 /* Velocity */ static struct bUnitDef buMetricVelDef[] = { - {"meter per second", "meters per second", "m/s", NULL, "Meters per second", UN_SC_M, 0.0, B_UNIT_DEF_NONE}, /* base unit */ - {"kilometer per hour", "kilometers per hour", "km/h", NULL, "Kilometers per hour", UN_SC_KM/3600.0f, 0.0, B_UNIT_DEF_SUPPRESS}, - {NULL, NULL, NULL, NULL, NULL, 0.0, 0.0} + {"meter per second", "meters per second", "m/s", NULL, "Meters per second", UN_SC_M, 0.0, B_UNIT_DEF_NONE}, /* base unit */ + {"kilometer per hour", "kilometers per hour", "km/h", NULL, "Kilometers per hour", UN_SC_KM / 3600.0f, 0.0, B_UNIT_DEF_SUPPRESS}, + {NULL, NULL, NULL, NULL, NULL, 0.0, 0.0} }; static struct bUnitCollection buMetricVelCollecton = {buMetricVelDef, 0, 0, sizeof(buMetricVelDef) / sizeof(bUnitDef)}; static struct bUnitDef buImperialVelDef[] = { - {"foot per second", "feet per second", "ft/s", "fps", "Feet per second", UN_SC_FT, 0.0, B_UNIT_DEF_NONE}, /* base unit */ - {"mile per hour", "miles per hour", "mph", NULL, "Miles per hour", UN_SC_MI/3600.0f, 0.0,B_UNIT_DEF_SUPPRESS}, + {"foot per second", "feet per second", "ft/s", "fps", "Feet per second", UN_SC_FT, 0.0, B_UNIT_DEF_NONE}, /* base unit */ + {"mile per hour", "miles per hour", "mph", NULL, "Miles per hour", UN_SC_MI / 3600.0f, 0.0, B_UNIT_DEF_SUPPRESS}, {NULL, NULL, NULL, NULL, NULL, 0.0, 0.0} }; static struct bUnitCollection buImperialVelCollecton = {buImperialVelDef, 0, 0, sizeof(buImperialVelDef) / sizeof(bUnitDef)}; @@ -234,7 +234,7 @@ static struct bUnitCollection buImperialVelCollecton = {buImperialVelDef, 0, 0, /* Acceleration */ static struct bUnitDef buMetricAclDef[] = { {"meter per second squared", "meters per second squared", "m/s²", "m/s2", "Meters per second squared", UN_SC_M, 0.0, B_UNIT_DEF_NONE}, /* base unit */ - {NULL, NULL, NULL, NULL, NULL, 0.0, 0.0} + {NULL, NULL, NULL, NULL, NULL, 0.0, 0.0} }; static struct bUnitCollection buMetricAclCollecton = {buMetricAclDef, 0, 0, sizeof(buMetricAclDef) / sizeof(bUnitDef)}; @@ -247,12 +247,12 @@ static struct bUnitCollection buImperialAclCollecton = {buImperialAclDef, 0, 0, /* Time */ static struct bUnitDef buNaturalTimeDef[] = { /* weeks? - probably not needed for blender */ - {"day", "days", "d", NULL, "Days", 90000.0, 0.0, B_UNIT_DEF_NONE}, - {"hour", "hours", "hr", "h", "Hours", 3600.0, 0.0, B_UNIT_DEF_NONE}, - {"minute", "minutes", "min", "m", "Minutes", 60.0, 0.0, B_UNIT_DEF_NONE}, - {"second", "seconds", "sec", "s", "Seconds", 1.0, 0.0, B_UNIT_DEF_NONE}, /* base unit */ - {"millisecond", "milliseconds", "ms", NULL, "Milliseconds", 0.001, 0.0, B_UNIT_DEF_NONE}, - {"microsecond", "microseconds", "µs", "us", "Microseconds", 0.000001, 0.0, B_UNIT_DEF_NONE}, + {"day", "days", "d", NULL, "Days", 90000.0, 0.0, B_UNIT_DEF_NONE}, + {"hour", "hours", "hr", "h", "Hours", 3600.0, 0.0, B_UNIT_DEF_NONE}, + {"minute", "minutes", "min", "m", "Minutes", 60.0, 0.0, B_UNIT_DEF_NONE}, + {"second", "seconds", "sec", "s", "Seconds", 1.0, 0.0, B_UNIT_DEF_NONE}, /* base unit */ + {"millisecond", "milliseconds", "ms", NULL, "Milliseconds", 0.001, 0.0, B_UNIT_DEF_NONE}, + {"microsecond", "microseconds", "µs", "us", "Microseconds", 0.000001, 0.0, B_UNIT_DEF_NONE}, {NULL, NULL, NULL, NULL, NULL, 0.0, 0.0} }; static struct bUnitCollection buNaturalTimeCollecton = {buNaturalTimeDef, 3, 0, sizeof(buNaturalTimeDef) / sizeof(bUnitDef)}; diff --git a/source/blender/blenlib/BLI_args.h b/source/blender/blenlib/BLI_args.h index 7a240e0e08a..6758fa399a4 100644 --- a/source/blender/blenlib/BLI_args.h +++ b/source/blender/blenlib/BLI_args.h @@ -36,18 +36,31 @@ struct bArgs; typedef struct bArgs bArgs; -/* returns the number of extra arguments consumed by the function. 0 is normal value, -1 stops parsing arguments, other negative indicates skip */ +/** + * Returns the number of extra arguments consumed by the function. + * - 0 is normal value, + * - -1 stops parsing arguments, other negative indicates skip + */ typedef int (*BA_ArgCallback)(int argc, const char **argv, void *data); struct bArgs *BLI_argsInit(int argc, const char **argv); void BLI_argsFree(struct bArgs *ba); -/* pass starts at 1, -1 means valid all the time +/** + * Pass starts at 1, -1 means valid all the time * short_arg or long_arg can be null to specify no short or long versions - * */ -void BLI_argsAdd(struct bArgs *ba, int pass, const char *short_arg, const char *long_arg, const char *doc, BA_ArgCallback cb, void *data); -/* short_case and long_case specify if those arguments are case specific */ -void BLI_argsAddCase(struct bArgs *ba, int pass, const char *short_arg, int short_case, const char *long_arg, int long_case, const char *doc, BA_ArgCallback cb, void *data); + */ +void BLI_argsAdd(struct bArgs *ba, int pass, + const char *short_arg, const char *long_arg, + const char *doc, BA_ArgCallback cb, void *data); + +/** + * Short_case and long_case specify if those arguments are case specific + */ +void BLI_argsAddCase(struct bArgs *ba, int pass, + const char *short_arg, int short_case, + const char *long_arg, int long_case, + const char *doc, BA_ArgCallback cb, void *data); void BLI_argsParse(struct bArgs *ba, int pass, BA_ArgCallback default_cb, void *data); diff --git a/source/blender/blenlib/BLI_math_geom.h b/source/blender/blenlib/BLI_math_geom.h index 93599dee63d..8ccc3159f78 100644 --- a/source/blender/blenlib/BLI_math_geom.h +++ b/source/blender/blenlib/BLI_math_geom.h @@ -159,6 +159,18 @@ void isect_point_quad_uv_v2(const float v0[2], const float v1[2], const float v2 void isect_point_face_uv_v2(const int isquad, const float v0[2], const float v1[2], const float v2[2], const float v3[2], const float pt[2], float r_uv[2]); +/* axis-aligned bounding box */ +int isect_aabb_aabb_v3(const float min1[3], const float max1[3], const float min2[3], const float max2[3]); + +typedef struct { + float ray_start[3]; + float ray_inv_dir[3]; + int sign[3]; +} IsectRayAABBData; + +void isect_ray_aabb_initialize(IsectRayAABBData *data, const float ray_start[3], const float ray_direction[3]); +int isect_ray_aabb(const IsectRayAABBData *data, const float bb_min[3], const float bb_max[3], float *tmin); + /* other */ int isect_sweeping_sphere_tri_v3(const float p1[3], const float p2[3], const float radius, const float v0[3], const float v1[3], const float v2[3], float *r_lambda, float ipoint[3]); @@ -166,8 +178,6 @@ int isect_sweeping_sphere_tri_v3(const float p1[3], const float p2[3], const flo int isect_axial_line_tri_v3(const int axis, const float co1[3], const float co2[3], const float v0[3], const float v1[3], const float v2[3], float *r_lambda); -int isect_aabb_aabb_v3(const float min1[3], const float max1[3], const float min2[3], const float max2[3]); - int clip_line_plane(float p1[3], float p2[3], const float plane[4]); void plot_line_v2v2i(const int p1[2], const int p2[2], int (*callback)(int, int, void *), void *userData); diff --git a/source/blender/blenlib/intern/BLI_args.c b/source/blender/blenlib/intern/BLI_args.c index 785c9f9f32b..22b93948512 100644 --- a/source/blender/blenlib/intern/BLI_args.c +++ b/source/blender/blenlib/intern/BLI_args.c @@ -173,7 +173,8 @@ static bArgDoc *internalDocs(struct bArgs *ba, const char *short_arg, const char return d; } -static void internalAdd(struct bArgs *ba, const char *arg, int pass, int case_str, BA_ArgCallback cb, void *data, bArgDoc *d) +static void internalAdd(struct bArgs *ba, const char *arg, int pass, + int case_str, BA_ArgCallback cb, void *data, bArgDoc *d) { bArgument *a; bAKey *key; @@ -182,8 +183,10 @@ static void internalAdd(struct bArgs *ba, const char *arg, int pass, int case_st if (a) { printf("WARNING: conflicting argument\n"); - printf("\ttrying to add '%s' on pass %i, %scase sensitive\n", arg, pass, case_str == 1 ? "not " : ""); - printf("\tconflict with '%s' on pass %i, %scase sensitive\n\n", a->key->arg, (int)a->key->pass, a->key->case_str == 1 ? "not " : ""); + printf("\ttrying to add '%s' on pass %i, %scase sensitive\n", + arg, pass, case_str == 1 ? "not " : ""); + printf("\tconflict with '%s' on pass %i, %scase sensitive\n\n", + a->key->arg, (int)a->key->pass, a->key->case_str == 1 ? "not " : ""); } a = MEM_callocN(sizeof(bArgument), "bArgument"); @@ -201,7 +204,10 @@ static void internalAdd(struct bArgs *ba, const char *arg, int pass, int case_st BLI_ghash_insert(ba->items, key, a); } -void BLI_argsAddCase(struct bArgs *ba, int pass, const char *short_arg, int short_case, const char *long_arg, int long_case, const char *doc, BA_ArgCallback cb, void *data) +void BLI_argsAddCase(struct bArgs *ba, int pass, + const char *short_arg, int short_case, + const char *long_arg, int long_case, + const char *doc, BA_ArgCallback cb, void *data) { bArgDoc *d = internalDocs(ba, short_arg, long_arg, doc); @@ -214,7 +220,9 @@ void BLI_argsAddCase(struct bArgs *ba, int pass, const char *short_arg, int shor } -void BLI_argsAdd(struct bArgs *ba, int pass, const char *short_arg, const char *long_arg, const char *doc, BA_ArgCallback cb, void *data) +void BLI_argsAdd(struct bArgs *ba, int pass, + const char *short_arg, const char *long_arg, + const char *doc, BA_ArgCallback cb, void *data) { BLI_argsAddCase(ba, pass, short_arg, 0, long_arg, 0, doc, cb, data); } diff --git a/source/blender/blenlib/intern/freetypefont.c b/source/blender/blenlib/intern/freetypefont.c index eb2070bce76..10eeda96b5d 100644 --- a/source/blender/blenlib/intern/freetypefont.c +++ b/source/blender/blenlib/intern/freetypefont.c @@ -266,17 +266,19 @@ static void freetypechar_to_vchar(FT_Face face, FT_ULong charcode, VFontData *vf } } - // get the handles that are aligned, tricky... - // dist_to_line_v2, check if the three beztriple points are on one line - // len_squared_v2v2, see if there's a distance between the three points - // len_squared_v2v2 again, to check the angle between the handles - // finally, check if one of them is a vector handle - if ((dist_to_line_v2(bezt->vec[0], bezt->vec[1], bezt->vec[2]) < 0.001f) && + /* get the handles that are aligned, tricky... + * dist_to_line_v2, check if the three beztriple points are on one line + * len_squared_v2v2, see if there's a distance between the three points + * len_squared_v2v2 again, to check the angle between the handles + * finally, check if one of them is a vector handle */ + if ((bezt->h1 != HD_VECT && bezt->h2 != HD_VECT) && + (dist_to_line_v2(bezt->vec[0], bezt->vec[1], bezt->vec[2]) < 0.001f) && (len_squared_v2v2(bezt->vec[0], bezt->vec[1]) > 0.0001f * 0.0001f) && (len_squared_v2v2(bezt->vec[1], bezt->vec[2]) > 0.0001f * 0.0001f) && (len_squared_v2v2(bezt->vec[0], bezt->vec[2]) > 0.0002f * 0.0001f) && - (len_squared_v2v2(bezt->vec[0], bezt->vec[2]) > MAX2(len_squared_v2v2(bezt->vec[0], bezt->vec[1]), len_squared_v2v2(bezt->vec[1], bezt->vec[2]))) && - bezt->h1 != HD_VECT && bezt->h2 != HD_VECT) + (len_squared_v2v2(bezt->vec[0], bezt->vec[2]) > + maxf(len_squared_v2v2(bezt->vec[0], bezt->vec[1]), + len_squared_v2v2(bezt->vec[1], bezt->vec[2])))) { bezt->h1 = bezt->h2 = HD_ALIGN; } diff --git a/source/blender/blenlib/intern/math_color_inline.c b/source/blender/blenlib/intern/math_color_inline.c index 58ee898ea28..a3835b5bb4a 100644 --- a/source/blender/blenlib/intern/math_color_inline.c +++ b/source/blender/blenlib/intern/math_color_inline.c @@ -225,7 +225,7 @@ MINLINE void cpack_cpy_3ub(unsigned char r_col[3], const unsigned int pack) /* TODO: * * regarding #rgb_to_bw vs #rgb_to_grayscale, - * it seems nobody knows why we have both functions which convert color to greys + * it seems nobody knows why we have both functions which convert color to grays * but with different influences, this is quite stupid, and should be resolved * by someone who knows this stuff: see this thread * http://lists.blender.org/pipermail/bf-committers/2012-June/037180.html diff --git a/source/blender/blenlib/intern/math_geom.c b/source/blender/blenlib/intern/math_geom.c index e51d0d2645f..402aacf369a 100644 --- a/source/blender/blenlib/intern/math_geom.c +++ b/source/blender/blenlib/intern/math_geom.c @@ -1284,6 +1284,63 @@ int isect_aabb_aabb_v3(const float min1[3], const float max1[3], const float min min2[0] < max1[0] && min2[1] < max1[1] && min2[2] < max1[2]); } +void isect_ray_aabb_initialize(IsectRayAABBData *data, const float ray_start[3], const float ray_direction[3]) +{ + copy_v3_v3(data->ray_start, ray_start); + + data->ray_inv_dir[0] = 1.0f / ray_direction[0]; + data->ray_inv_dir[1] = 1.0f / ray_direction[1]; + data->ray_inv_dir[2] = 1.0f / ray_direction[2]; + + data->sign[0] = data->ray_inv_dir[0] < 0; + data->sign[1] = data->ray_inv_dir[1] < 0; + data->sign[2] = data->ray_inv_dir[2] < 0; +} + +/* Adapted from http://www.gamedev.net/community/forums/topic.asp?topic_id=459973 */ +int isect_ray_aabb(const IsectRayAABBData *data, const float bb_min[3], + const float bb_max[3], float *tmin_out) +{ + float bbox[2][3]; + float tmin, tmax, tymin, tymax, tzmin, tzmax; + + copy_v3_v3(bbox[0], bb_min); + copy_v3_v3(bbox[1], bb_max); + + tmin = (bbox[data->sign[0]][0] - data->ray_start[0]) * data->ray_inv_dir[0]; + tmax = (bbox[1 - data->sign[0]][0] - data->ray_start[0]) * data->ray_inv_dir[0]; + + tymin = (bbox[data->sign[1]][1] - data->ray_start[1]) * data->ray_inv_dir[1]; + tymax = (bbox[1 - data->sign[1]][1] - data->ray_start[1]) * data->ray_inv_dir[1]; + + if ((tmin > tymax) || (tymin > tmax)) + return FALSE; + + if (tymin > tmin) + tmin = tymin; + + if (tymax < tmax) + tmax = tymax; + + tzmin = (bbox[data->sign[2]][2] - data->ray_start[2]) * data->ray_inv_dir[2]; + tzmax = (bbox[1 - data->sign[2]][2] - data->ray_start[2]) * data->ray_inv_dir[2]; + + if ((tmin > tzmax) || (tzmin > tmax)) + return FALSE; + + if (tzmin > tmin) + tmin = tzmin; + + // XXX jwilkins: tmax does not need to be updated since we don't use it + // keeping this here for future reference + //if (tzmax < tmax) tmax = tzmax; + + if (tmin_out) + (*tmin_out) = tmin; + + return TRUE; +} + /* find closest point to p on line through l1,l2 and return lambda, * where (0 <= lambda <= 1) when cp is in the line segement l1,l2 */ diff --git a/source/blender/blenlib/intern/pbvh.c b/source/blender/blenlib/intern/pbvh.c index 409a9f88f39..14f9001814c 100644 --- a/source/blender/blenlib/intern/pbvh.c +++ b/source/blender/blenlib/intern/pbvh.c @@ -1424,56 +1424,21 @@ void BLI_pbvh_node_get_proxies(PBVHNode *node, PBVHProxyNode **proxies, int *pro /********************************* Raycast ***********************************/ typedef struct { - /* Ray */ - float start[3]; - int sign[3]; - float inv_dir[3]; + IsectRayAABBData ray; int original; } RaycastData; -/* Adapted from here: http://www.gamedev.net/community/forums/topic.asp?topic_id=459973 */ static int ray_aabb_intersect(PBVHNode *node, void *data_v) { - RaycastData *ray = data_v; - float bbox[2][3]; - float tmin, tmax, tymin, tymax, tzmin, tzmax; + RaycastData *rcd = data_v; + float bb_min[3], bb_max[3]; - if (ray->original) - BLI_pbvh_node_get_original_BB(node, bbox[0], bbox[1]); + if (rcd->original) + BLI_pbvh_node_get_original_BB(node, bb_min, bb_max); else - BLI_pbvh_node_get_BB(node, bbox[0], bbox[1]); - - tmin = (bbox[ray->sign[0]][0] - ray->start[0]) * ray->inv_dir[0]; - tmax = (bbox[1 - ray->sign[0]][0] - ray->start[0]) * ray->inv_dir[0]; - - tymin = (bbox[ray->sign[1]][1] - ray->start[1]) * ray->inv_dir[1]; - tymax = (bbox[1 - ray->sign[1]][1] - ray->start[1]) * ray->inv_dir[1]; - - if ((tmin > tymax) || (tymin > tmax)) - return 0; - - if (tymin > tmin) - tmin = tymin; - - if (tymax < tmax) - tmax = tymax; + BLI_pbvh_node_get_BB(node, bb_min, bb_max); - tzmin = (bbox[ray->sign[2]][2] - ray->start[2]) * ray->inv_dir[2]; - tzmax = (bbox[1 - ray->sign[2]][2] - ray->start[2]) * ray->inv_dir[2]; - - if ((tmin > tzmax) || (tzmin > tmax)) - return 0; - - if (tzmin > tmin) - tmin = tzmin; - - // XXX jwilkins: tmax does not need to be updated since we don't use it - // keeping this here for future reference - //if (tzmax < tmax) tmax = tzmax; - - node->tmin = tmin; - - return 1; + return isect_ray_aabb(&rcd->ray, bb_min, bb_max, &node->tmin); } void BLI_pbvh_raycast(PBVH *bvh, BLI_pbvh_HitOccludedCallback cb, void *data, @@ -1482,13 +1447,7 @@ void BLI_pbvh_raycast(PBVH *bvh, BLI_pbvh_HitOccludedCallback cb, void *data, { RaycastData rcd; - copy_v3_v3(rcd.start, ray_start); - rcd.inv_dir[0] = 1.0f / ray_normal[0]; - rcd.inv_dir[1] = 1.0f / ray_normal[1]; - rcd.inv_dir[2] = 1.0f / ray_normal[2]; - rcd.sign[0] = rcd.inv_dir[0] < 0; - rcd.sign[1] = rcd.inv_dir[1] < 0; - rcd.sign[2] = rcd.inv_dir[2] < 0; + isect_ray_aabb_initialize(&rcd.ray, ray_start, ray_normal); rcd.original = original; BLI_pbvh_search_callback_occluded(bvh, ray_aabb_intersect, &rcd, cb, data); diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index d8b2ce8680b..735f1fcaa55 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -5547,6 +5547,11 @@ void lib_link_screen_restore(Main *newmain, bScreen *curscreen, Scene *curscene) if (ads->filter_grp) ads->filter_grp = restore_pointer_by_name(newmain, (ID *)ads->filter_grp, 0); } + + /* force recalc of list of channels (i.e. includes calculating F-Curve colors) + * thus preventing the "black curves" problem post-undo + */ + sipo->flag |= SIPO_TEMP_NEEDCHANSYNC; } else if (sl->spacetype == SPACE_BUTS) { SpaceButs *sbuts = (SpaceButs *)sl; @@ -5561,10 +5566,10 @@ void lib_link_screen_restore(Main *newmain, bScreen *curscreen, Scene *curscene) SpaceAction *saction = (SpaceAction *)sl; saction->action = restore_pointer_by_name(newmain, (ID *)saction->action, 1); - saction->ads.source= restore_pointer_by_name(newmain, (ID *)saction->ads.source, 1); + saction->ads.source = restore_pointer_by_name(newmain, (ID *)saction->ads.source, 1); if (saction->ads.filter_grp) - saction->ads.filter_grp= restore_pointer_by_name(newmain, (ID *)saction->ads.filter_grp, 0); + saction->ads.filter_grp = restore_pointer_by_name(newmain, (ID *)saction->ads.filter_grp, 0); /* force recalc of list of channels, potentially updating the active action diff --git a/source/blender/bmesh/intern/bmesh_opdefines.c b/source/blender/bmesh/intern/bmesh_opdefines.c index 931937263e4..b6d9fbc85a2 100644 --- a/source/blender/bmesh/intern/bmesh_opdefines.c +++ b/source/blender/bmesh/intern/bmesh_opdefines.c @@ -1039,7 +1039,7 @@ static BMOpDefine bmo_bevel_def = { {BMO_OP_SLOT_BOOL, "use_dist"}, /* corner vert placement: evaluate percent as a distance, * modifier uses this. We could do this as another float setting */ {BMO_OP_SLOT_INT, "lengthlayer"}, /* which PROP_FLT layer to us */ - {BMO_OP_SLOT_FLT, "percent"}, /* percentage to expand bevelled edge */ + {BMO_OP_SLOT_FLT, "percent"}, /* percentage to expand beveled edge */ {0} /* null-terminating sentinel */}, bmo_bevel_exec, BMO_OP_FLAG_UNTAN_MULTIRES diff --git a/source/blender/bmesh/intern/bmesh_polygon.c b/source/blender/bmesh/intern/bmesh_polygon.c index 094b5af9a00..6b9abfb3e20 100644 --- a/source/blender/bmesh/intern/bmesh_polygon.c +++ b/source/blender/bmesh/intern/bmesh_polygon.c @@ -320,7 +320,14 @@ void poly_rotate_plane(const float normal[3], float (*verts)[3], const int nvert angle = saacos(dot_v3v3(normal, up)); - if (angle == 0.0) return; + if (angle < FLT_EPSILON) + return; + + if (len_v3(axis) < FLT_EPSILON) { + axis[0] = 0.0f; + axis[1] = 1.0f; + axis[2] = 0.0f; + } axis_angle_to_quat(q, axis, (float)angle); quat_to_mat3(mat, q); @@ -611,39 +618,42 @@ int BM_face_point_inside_test(BMFace *f, const float co[3]) return crosses % 2 != 0; } -static int bm_face_goodline(float const (*projectverts)[3], BMFace *f, - int v1i, int v2i, int v3i, - int UNUSED(nvert)) +static int bm_face_goodline(float const (*projectverts)[3], BMFace *f, int v1i, int v2i, int v3i) { BMLoop *l_iter; BMLoop *l_first; - float v1[3], v2[3], v3[3], pv1[3], pv2[3]; + float v1[3], v2[3], v3[3], pv1[3]; int i; copy_v3_v3(v1, projectverts[v1i]); copy_v3_v3(v2, projectverts[v2i]); copy_v3_v3(v3, projectverts[v3i]); - + + /* v3 must be on the left side of [v1, v2] line, else we know [v1, v3] is outside of f! */ if (testedgesidef(v1, v2, v3)) { return FALSE; } - //for (i = 0; i < nvert; i++) { l_iter = l_first = BM_FACE_FIRST_LOOP(f); do { i = BM_elem_index_get(l_iter->v); - if (i == v1i || i == v2i || i == v3i) { + copy_v3_v3(pv1, projectverts[i]); + + if (ELEM3(i, v1i, v2i, v3i)) { +#if 0 + printf("%d in (%d, %d, %d) tri (from indices!), continuing\n", i, v1i, v2i, v3i); +#endif continue; } - - copy_v3_v3(pv1, projectverts[BM_elem_index_get(l_iter->v)]); - copy_v3_v3(pv2, projectverts[BM_elem_index_get(l_iter->next->v)]); - - //if (linecrossesf(pv1, pv2, v1, v3)) return FALSE; - if (isect_point_tri_v2(pv1, v1, v2, v3) || - isect_point_tri_v2(pv2, v3, v2, v1)) + if (isect_point_tri_v2(pv1, v1, v2, v3) || isect_point_tri_v2(pv1, v3, v2, v1)) { +#if 0 + if (isect_point_tri_v2(pv1, v1, v2, v3)) + printf("%d in (%d, %d, %d)\n", v3i, i, v1i, v2i); + else + printf("%d in (%d, %d, %d)\n", v1i, i, v3i, v2i); +#endif return FALSE; } } while ((l_iter = l_iter->next) != l_first); @@ -653,15 +663,13 @@ static int bm_face_goodline(float const (*projectverts)[3], BMFace *f, /** * \brief Find Ear * - * Used by tessellator to find - * the next triangle to 'clip off' - * of a polygon while tessellating. + * Used by tessellator to find the next triangle to 'clip off' of a polygon while tessellating. * * \param use_beauty Currently only applies to quads, can be extended later on. * \param abscoss Must be allocated by caller, and at least f->len length * (allow to avoid allocating a new one for each tri!). */ -static BMLoop *find_ear(BMFace *f, float (*verts)[3], const int nvert, const int use_beauty, float *abscoss) +static BMLoop *find_ear(BMFace *f, float (*verts)[3], const int use_beauty, float *abscoss) { BMLoop *bestear = NULL; @@ -706,8 +714,8 @@ static BMLoop *find_ear(BMFace *f, float (*verts)[3], const int nvert, const int /* Last check we do not get overlapping triangles * (as much as possible, ther are some cases with no good solution!) */ i4 = (i + 3) % 4; - if (!bm_face_goodline((float const (*)[3])verts, f, BM_elem_index_get(larr[i4]->v), BM_elem_index_get(larr[i]->v), - BM_elem_index_get(larr[i + 1]->v), nvert)) + if (!bm_face_goodline((float const (*)[3])verts, f, BM_elem_index_get(larr[i4]->v), + BM_elem_index_get(larr[i]->v), BM_elem_index_get(larr[i + 1]->v))) { i = !i; } @@ -750,10 +758,13 @@ static BMLoop *find_ear(BMFace *f, float (*verts)[3], const int nvert, const int if (BM_edge_exists(v1, v3)) { isear = FALSE; } - else if (!bm_face_goodline((float const (*)[3])verts, f, - BM_elem_index_get(v1), BM_elem_index_get(v2), BM_elem_index_get(v3), - nvert)) + else if (!bm_face_goodline((float const (*)[3])verts, f, BM_elem_index_get(v1), + BM_elem_index_get(v2), BM_elem_index_get(v3))) { +#if 0 + printf("(%d, %d, %d) would not be a valid tri!\n", + BM_elem_index_get(v1), BM_elem_index_get(v2), BM_elem_index_get(v3)); +#endif isear = FALSE; } @@ -836,9 +847,8 @@ static BMLoop *find_ear(BMFace *f, float (*verts)[3], const int nvert, const int * * \note newedgeflag sets a flag layer flag, obviously not the header flag. */ -void BM_face_triangulate(BMesh *bm, BMFace *f, float (*projectverts)[3], - const short newedge_oflag, const short newface_oflag, BMFace **newfaces, - const short use_beauty) +void BM_face_triangulate(BMesh *bm, BMFace *f, float (*projectverts)[3], const short newedge_oflag, + const short newface_oflag, BMFace **newfaces, const short use_beauty) { int i, done, nvert, nf_i = 0; BMLoop *newl; @@ -847,7 +857,7 @@ void BM_face_triangulate(BMesh *bm, BMFace *f, float (*projectverts)[3], float *abscoss = NULL; BLI_array_fixedstack_declare(abscoss, 16, f->len, "BM_face_triangulate: temp absolute cosines of face corners"); - /* copy vertex coordinates to vertspace arra */ + /* copy vertex coordinates to vertspace area */ i = 0; l_iter = l_first = BM_FACE_FIRST_LOOP(f); do { @@ -873,13 +883,11 @@ void BM_face_triangulate(BMesh *bm, BMFace *f, float (*projectverts)[3], done = FALSE; while (!done && f->len > 3) { done = TRUE; - l_iter = find_ear(f, projectverts, nvert, use_beauty, abscoss); + l_iter = find_ear(f, projectverts, use_beauty, abscoss); if (l_iter) { done = FALSE; /* printf("Subdividing face...\n");*/ - f = BM_face_split(bm, l_iter->f, l_iter->prev->v, - l_iter->next->v, - &newl, NULL, TRUE); + f = BM_face_split(bm, l_iter->f, l_iter->prev->v, l_iter->next->v, &newl, NULL, TRUE); if (UNLIKELY(!f)) { fprintf(stderr, "%s: triangulator failed to split face! (bmesh internal error)\n", __func__); @@ -890,7 +898,8 @@ void BM_face_triangulate(BMesh *bm, BMFace *f, float (*projectverts)[3], BMO_elem_flag_enable(bm, newl->e, newedge_oflag); BMO_elem_flag_enable(bm, f, newface_oflag); - if (newfaces) newfaces[nf_i++] = f; + if (newfaces) + newfaces[nf_i++] = f; #if 0 l = f->loopbase; @@ -933,7 +942,8 @@ void BM_face_triangulate(BMesh *bm, BMFace *f, float (*projectverts)[3], BLI_array_fixedstack_free(abscoss); /* NULL-terminate */ - if (newfaces) newfaces[nf_i] = NULL; + if (newfaces) + newfaces[nf_i] = NULL; } /** diff --git a/source/blender/bmesh/operators/bmo_hull.c b/source/blender/bmesh/operators/bmo_hull.c index 1bd2f41209b..b22bdf60210 100644 --- a/source/blender/bmesh/operators/bmo_hull.c +++ b/source/blender/bmesh/operators/bmo_hull.c @@ -31,12 +31,24 @@ #include "BLI_math.h" #include "BLI_utildefines.h" +/*XXX: This operator doesn't work well (at all?) for flat surfaces with + * >3 sides - creating overlapping faces at times. + * An easy workaround is to add in some noise but this is + * weak and unreliable, ideally this would detect flat surfaces + * (possibly making them into ngons) - see + */ + /* XXX: using 128 for totelem and pchunk of mempool, no idea what good * values would be though */ #include "BLI_mempool.h" #include "bmesh.h" +#define HULL_EPSILON_FLT 0.0001f +/* values above 0.0001 cause errors, see below for details, don't increase + * without checking against bug [#32027] */ +#define HULL_EPSILON_DOT_FLT 0.00000001f + /* Internal operator flags */ typedef enum { HULL_FLAG_INPUT = (1 << 0), @@ -70,23 +82,23 @@ typedef struct HullBoundaryEdge { /*************************** Boundary Edges ***************************/ -static int edge_match(BMVert *e1_0, BMVert *e1_1, BMVert *e2[2]) +static int edge_match(BMVert *e1_v1, BMVert *e1_v2, BMVert *e2[2]) { - return (e1_0 == e2[0] && e1_1 == e2[1]) || - (e1_0 == e2[1] && e1_1 == e2[0]); + return (e1_v1 == e2[0] && e1_v2 == e2[1]) || + (e1_v1 == e2[1] && e1_v2 == e2[0]); } /* Returns true if the edge (e1, e2) is already in edges; that edge is * deleted here as well. if not found just returns 0 */ static int check_for_dup(ListBase *edges, BLI_mempool *pool, - BMVert *e1, BMVert *e2) + BMVert *v1, BMVert *v2) { - HullBoundaryEdge *e, *next; + HullBoundaryEdge *e, *e_next; - for (e = edges->first; e; e = next) { - next = e->next; + for (e = edges->first; e; e = e_next) { + e_next = e->next; - if (edge_match(e1, e2, e->v)) { + if (edge_match(v1, v2, e->v)) { /* remove the interior edge */ BLI_remlink(edges, e); BLI_mempool_free(pool, e); @@ -100,17 +112,17 @@ static int check_for_dup(ListBase *edges, BLI_mempool *pool, static void expand_boundary_edges(ListBase *edges, BLI_mempool *edge_pool, const HullTriangle *t) { - HullBoundaryEdge *new; + HullBoundaryEdge *e_new; int i; /* Insert each triangle edge into the boundary list; if any of * its edges are already in there, remove the edge entirely */ for (i = 0; i < 3; i++) { if (!check_for_dup(edges, edge_pool, t->v[i], t->v[(i + 1) % 3])) { - new = BLI_mempool_calloc(edge_pool); - new->v[0] = t->v[i]; - new->v[1] = t->v[(i + 1) % 3]; - BLI_addtail(edges, new); + e_new = BLI_mempool_calloc(edge_pool); + e_new->v[0] = t->v[i]; + e_new->v[1] = t->v[(i + 1) % 3]; + BLI_addtail(edges, e_new); } } } @@ -142,12 +154,16 @@ static int hull_point_tri_side(const HullTriangle *t, const float co[3]) { /* Added epsilon to fix bug [#31941], improves output when some * vertices are nearly coplanar. Might need further tweaking for - * other cases though. */ - float p[3], d, epsilon = 0.0001; + * other cases though. + * ... + * Update: epsilon of 0.0001 causes [#32027], use HULL_EPSILON_DOT_FLT + * and give it a much smaller value + * */ + float p[3], d; sub_v3_v3v3(p, co, t->v[0]->co); d = dot_v3v3(t->no, p); - if (d < -epsilon) return -1; - else if (d > epsilon) return 1; + if (d < -HULL_EPSILON_DOT_FLT) return -1; + else if (d > HULL_EPSILON_DOT_FLT) return 1; else return 0; } @@ -177,7 +193,7 @@ static void add_point(BMesh *bm, GHash *hull_triangles, BLI_mempool *hull_pool, BLI_mempool *edge_pool, GHash *outside, BMVert *v) { ListBase edges = {NULL, NULL}; - HullBoundaryEdge *e, *next; + HullBoundaryEdge *e, *e_next; GHashIterator iter; GHASH_ITER (iter, outside) { @@ -196,8 +212,8 @@ static void add_point(BMesh *bm, GHash *hull_triangles, BLI_mempool *hull_pool, } /* Fill hole boundary with triangles to new point */ - for (e = edges.first; e; e = next) { - next = e->next; + for (e = edges.first; e; e = e_next) { + e_next = e->next; hull_add_triangle(bm, hull_triangles, hull_pool, e->v[0], e->v[1], v); BLI_mempool_free(edge_pool, e); } @@ -354,7 +370,8 @@ static void hull_add_tetrahedron(BMesh *bm, GHash *hull_triangles, BLI_mempool * {0, 1, 2}, {0, 2, 3}, {1, 0, 3}, - {2, 1, 3}}; + {2, 1, 3} + }; /* Calculate center */ zero_v3(center); @@ -464,7 +481,7 @@ static int hull_find_large_tetrahedron(BMesh *bm, BMOperator *op, } /* Check for colinear vertices */ - if (largest_dist < 0.0001f) + if (largest_dist < HULL_EPSILON_FLT) return TRUE; /* Choose fourth point farthest from existing plane */ @@ -487,7 +504,7 @@ static int hull_find_large_tetrahedron(BMesh *bm, BMOperator *op, return TRUE; } - if (largest_dist < 0.0001f) + if (largest_dist < HULL_EPSILON_FLT) return TRUE; return FALSE; diff --git a/source/blender/collada/GeometryExporter.h b/source/blender/collada/GeometryExporter.h index f14775b9f44..7161bb751dd 100644 --- a/source/blender/collada/GeometryExporter.h +++ b/source/blender/collada/GeometryExporter.h @@ -119,8 +119,7 @@ struct GeometryFunctor { LinkNode *node; for (node=export_set; node; node = node->next) { Object *ob = (Object *)node->link; - if (ob->type == OB_MESH) - { + if (ob->type == OB_MESH) { f(ob); } } diff --git a/source/blender/collada/ImageExporter.cpp b/source/blender/collada/ImageExporter.cpp index f789cfe3660..b9e96445dcb 100644 --- a/source/blender/collada/ImageExporter.cpp +++ b/source/blender/collada/ImageExporter.cpp @@ -135,7 +135,7 @@ void ImagesExporter::export_UV_Image(Image *image, bool use_copies) COLLADASW::Image img(COLLADABU::URI(COLLADABU::URI::nativePathToUri(export_path)), translated_name, translated_name); /* set name also to mNameNC. This helps other viewers import files exported from Blender better */ img.add(mSW); - fprintf(stdout, "Collada export: Added image: %s\n",export_file); + fprintf(stdout, "Collada export: Added image: %s\n", export_file); mImages.push_back(translated_name); } } @@ -145,7 +145,7 @@ void ImagesExporter::export_UV_Images() std::set<Image *> uv_textures; LinkNode *node; bool use_copies = this->export_settings->use_texture_copies; - for (node=this->export_settings->export_set; node; node=node->next) { + for (node = this->export_settings->export_set; node; node = node->next) { Object *ob = (Object *)node->link; if (ob->type == OB_MESH && ob->totcol) { Mesh *me = (Mesh *) ob->data; @@ -160,7 +160,7 @@ void ImagesExporter::export_UV_Images() if (ima == NULL) continue; - bool not_in_list = uv_textures.find(ima)==uv_textures.end(); + bool not_in_list = uv_textures.find(ima) == uv_textures.end(); if (not_in_list) { uv_textures.insert(ima); export_UV_Image(ima, use_copies); @@ -177,7 +177,7 @@ bool ImagesExporter::hasImages(Scene *sce) { LinkNode *node; - for (node=this->export_settings->export_set; node; node=node->next) { + for (node = this->export_settings->export_set; node; node = node->next) { Object *ob = (Object *)node->link; int a; for (a = 0; a < ob->totcol; a++) { diff --git a/source/blender/compositor/CMakeLists.txt b/source/blender/compositor/CMakeLists.txt index 653e11c80a7..9bad1b55d95 100644 --- a/source/blender/compositor/CMakeLists.txt +++ b/source/blender/compositor/CMakeLists.txt @@ -419,10 +419,10 @@ set(SRC operations/COM_PreviewOperation.cpp operations/COM_SplitViewerOperation.h operations/COM_SplitViewerOperation.cpp - operations/COM_ConvertValueToColourProg.h - operations/COM_ConvertValueToColourProg.cpp - operations/COM_ConvertColourToValueProg.h - operations/COM_ConvertColourToValueProg.cpp + operations/COM_ConvertValueToColorProg.h + operations/COM_ConvertValueToColorProg.cpp + operations/COM_ConvertColorToValueProg.h + operations/COM_ConvertColorToValueProg.cpp operations/COM_ConvertColorToBWOperation.h operations/COM_ConvertColorToBWOperation.cpp operations/COM_ConvertColorToVectorOperation.h diff --git a/source/blender/compositor/intern/COM_CompositorContext.cpp b/source/blender/compositor/intern/COM_CompositorContext.cpp index 56335630b80..fbdb4cd6b28 100644 --- a/source/blender/compositor/intern/COM_CompositorContext.cpp +++ b/source/blender/compositor/intern/COM_CompositorContext.cpp @@ -30,6 +30,7 @@ CompositorContext::CompositorContext() this->m_quality = COM_QUALITY_HIGH; this->m_hasActiveOpenCLDevices = false; this->m_activegNode = NULL; + this->m_fastCalculation = false; } const int CompositorContext::getFramenumber() const diff --git a/source/blender/compositor/intern/COM_CompositorContext.h b/source/blender/compositor/intern/COM_CompositorContext.h index 49acda811f1..2f6abf39985 100644 --- a/source/blender/compositor/intern/COM_CompositorContext.h +++ b/source/blender/compositor/intern/COM_CompositorContext.h @@ -73,6 +73,11 @@ private: * @brief does this system have active opencl devices? */ bool m_hasActiveOpenCLDevices; + + /** + * @brief Skip slow nodes + */ + bool m_fastCalculation; public: /** @@ -148,6 +153,9 @@ public: int getChunksize() { return this->getbNodeTree()->chunksize; } const int isColorManaged() const; + + void setFastCalculation(bool fastCalculation) {this->m_fastCalculation = fastCalculation;} + bool isFastCalculation() {return this->m_fastCalculation;} }; diff --git a/source/blender/compositor/intern/COM_Converter.cpp b/source/blender/compositor/intern/COM_Converter.cpp index 38c514d8e99..4ed7ae7ca8a 100644 --- a/source/blender/compositor/intern/COM_Converter.cpp +++ b/source/blender/compositor/intern/COM_Converter.cpp @@ -48,8 +48,8 @@ #include "COM_CompositorNode.h" #include "COM_ConvertAlphaNode.h" #include "COM_ConvertColorToVectorOperation.h" -#include "COM_ConvertColourToValueProg.h" -#include "COM_ConvertValueToColourProg.h" +#include "COM_ConvertColorToValueProg.h" +#include "COM_ConvertValueToColorProg.h" #include "COM_ConvertValueToVectorOperation.h" #include "COM_ConvertVectorToColorOperation.h" #include "COM_ConvertVectorToValueOperation.h" @@ -117,7 +117,7 @@ #include "COM_ViewerNode.h" #include "COM_ZCombineNode.h" -Node *Converter::convert(bNode *b_node) +Node *Converter::convert(bNode *b_node, bool fast) { Node *node; @@ -125,6 +125,22 @@ Node *Converter::convert(bNode *b_node) node = new MuteNode(b_node); return node; } + if (fast) { + if (b_node->type == CMP_NODE_BLUR || + b_node->type == CMP_NODE_VECBLUR || + b_node->type == CMP_NODE_BILATERALBLUR || + b_node->type == CMP_NODE_DEFOCUS || + b_node->type == CMP_NODE_BOKEHBLUR || + b_node->type == CMP_NODE_GLARE || + b_node->type == CMP_NODE_DBLUR || + b_node->type == CMP_NODE_MOVIEDISTORTION || + b_node->type == CMP_NODE_LENSDIST || + b_node->type == CMP_NODE_DOUBLEEDGEMASK || + b_node->type == CMP_NODE_DILATEERODE) + { + return new MuteNode(b_node); + } + } switch (b_node->type) { case CMP_NODE_COMPOSITE: @@ -137,7 +153,7 @@ Node *Converter::convert(bNode *b_node) node = new TextureNode(b_node); break; case CMP_NODE_RGBTOBW: - node = new ColourToBWNode(b_node); + node = new ColorToBWNode(b_node); break; case CMP_NODE_MIX_RGB: node = new MixNode(b_node); @@ -376,13 +392,13 @@ void Converter::convertDataType(SocketConnection *connection, ExecutionSystem *s DataType toDatatype = inputSocket->getDataType(); NodeOperation *converter = NULL; if (fromDatatype == COM_DT_VALUE && toDatatype == COM_DT_COLOR) { - converter = new ConvertValueToColourProg(); + converter = new ConvertValueToColorProg(); } else if (fromDatatype == COM_DT_VALUE && toDatatype == COM_DT_VECTOR) { converter = new ConvertValueToVectorOperation(); } else if (fromDatatype == COM_DT_COLOR && toDatatype == COM_DT_VALUE) { - converter = new ConvertColourToValueProg(); + converter = new ConvertColorToValueProg(); } else if (fromDatatype == COM_DT_COLOR && toDatatype == COM_DT_VECTOR) { converter = new ConvertColorToVectorOperation(); diff --git a/source/blender/compositor/intern/COM_Converter.h b/source/blender/compositor/intern/COM_Converter.h index dbe98871c50..15bda0839fa 100644 --- a/source/blender/compositor/intern/COM_Converter.h +++ b/source/blender/compositor/intern/COM_Converter.h @@ -42,7 +42,7 @@ public: * @see Node * @see MuteNode */ - static Node *convert(bNode *b_node); + static Node *convert(bNode *b_node, bool fast); /** * @brief This method will add a datetype conversion rule when the to-socket does not support the from-socket actual data type. diff --git a/source/blender/compositor/intern/COM_ExecutionGroup.cpp b/source/blender/compositor/intern/COM_ExecutionGroup.cpp index 2d3d24b296f..90f4ba85c78 100644 --- a/source/blender/compositor/intern/COM_ExecutionGroup.cpp +++ b/source/blender/compositor/intern/COM_ExecutionGroup.cpp @@ -25,9 +25,6 @@ #include <sstream> #include <stdlib.h> -#include "BLI_math.h" -#include "PIL_time.h" - #include "COM_ExecutionGroup.h" #include "COM_InputSocket.h" #include "COM_SocketConnection.h" @@ -41,6 +38,11 @@ #include "COM_ChunkOrder.h" #include "COM_ExecutionSystemHelper.h" +#include "BLI_math.h" +#include "PIL_time.h" +#include "WM_api.h" +#include "WM_types.h" + ExecutionGroup::ExecutionGroup() { this->m_isOutput = false; @@ -347,6 +349,8 @@ void ExecutionGroup::execute(ExecutionSystem *graph) finished = false; startEvaluated = true; numberEvaluated++; + + WM_main_add_notifier(NC_WINDOW | ND_DRAW, NULL); } else if (state == COM_ES_SCHEDULED) { finished = false; diff --git a/source/blender/compositor/intern/COM_ExecutionSystem.cpp b/source/blender/compositor/intern/COM_ExecutionSystem.cpp index 23e243187d5..ff841092848 100644 --- a/source/blender/compositor/intern/COM_ExecutionSystem.cpp +++ b/source/blender/compositor/intern/COM_ExecutionSystem.cpp @@ -44,9 +44,10 @@ #include "MEM_guardedalloc.h" #endif -ExecutionSystem::ExecutionSystem(RenderData *rd, bNodeTree *editingtree, bool rendering) +ExecutionSystem::ExecutionSystem(RenderData *rd, bNodeTree *editingtree, bool rendering, bool fastcalculation) { this->m_context.setbNodeTree(editingtree); + this->m_context.setFastCalculation(fastcalculation); bNode *gnode; for (gnode = (bNode *)editingtree->nodes.first; gnode; gnode = (bNode *)gnode->next) { if (gnode->type == NODE_GROUP && gnode->typeinfo->group_edit_get(gnode)) { @@ -137,8 +138,10 @@ void ExecutionSystem::execute() WorkScheduler::start(this->m_context); executeGroups(COM_PRIORITY_HIGH); - executeGroups(COM_PRIORITY_MEDIUM); - executeGroups(COM_PRIORITY_LOW); + if (!this->getContext().isFastCalculation()) { + executeGroups(COM_PRIORITY_MEDIUM); + executeGroups(COM_PRIORITY_LOW); + } WorkScheduler::finish(); WorkScheduler::stop(); diff --git a/source/blender/compositor/intern/COM_ExecutionSystem.h b/source/blender/compositor/intern/COM_ExecutionSystem.h index e51bd7f3026..209358ec786 100644 --- a/source/blender/compositor/intern/COM_ExecutionSystem.h +++ b/source/blender/compositor/intern/COM_ExecutionSystem.h @@ -156,7 +156,7 @@ public: * @param editingtree [bNodeTree*] * @param rendering [true false] */ - ExecutionSystem(RenderData *rd, bNodeTree *editingtree, bool rendering); + ExecutionSystem(RenderData *rd, bNodeTree *editingtree, bool rendering, bool fastcalculation); /** * Destructor diff --git a/source/blender/compositor/intern/COM_ExecutionSystemHelper.cpp b/source/blender/compositor/intern/COM_ExecutionSystemHelper.cpp index 0f6ba1f4ac9..4627d20ab2f 100644 --- a/source/blender/compositor/intern/COM_ExecutionSystemHelper.cpp +++ b/source/blender/compositor/intern/COM_ExecutionSystemHelper.cpp @@ -49,7 +49,7 @@ void ExecutionSystemHelper::addbNodeTree(ExecutionSystem &system, int nodes_star /* add all nodes of the tree to the node list */ bNode *node = (bNode *)tree->nodes.first; while (node != NULL) { - addNode(nodes, node, isActiveGroup); + addNode(nodes, node, isActiveGroup, system.getContext().isFastCalculation()); node = (bNode *)node->next; } @@ -77,11 +77,10 @@ void ExecutionSystemHelper::addNode(vector<Node *>& nodes, Node *node) nodes.push_back(node); } -Node *ExecutionSystemHelper::addNode(vector<Node *>& nodes, bNode *b_node, bool inActiveGroup) +Node *ExecutionSystemHelper::addNode(vector<Node *>& nodes, bNode *b_node, bool inActiveGroup, bool fast) { - Converter converter; Node *node; - node = converter.convert(b_node); + node = Converter::convert(b_node, fast); node->setIsInActiveGroup(inActiveGroup); if (node != NULL) { addNode(nodes, node); diff --git a/source/blender/compositor/intern/COM_ExecutionSystemHelper.h b/source/blender/compositor/intern/COM_ExecutionSystemHelper.h index 4b65ed15577..bd34fe8ab02 100644 --- a/source/blender/compositor/intern/COM_ExecutionSystemHelper.h +++ b/source/blender/compositor/intern/COM_ExecutionSystemHelper.h @@ -58,7 +58,7 @@ public: * @param bNode node to add * @return Node that represents the bNode or null when not able to convert. */ - static Node *addNode(vector<Node *>& nodes, bNode *b_node, bool isInActiveGroup); + static Node *addNode(vector<Node *>& nodes, bNode *b_node, bool isInActiveGroup, bool fast); /** * @brief Add a Node to a list diff --git a/source/blender/compositor/intern/COM_Node.cpp b/source/blender/compositor/intern/COM_Node.cpp index 15b8a3933a7..320baacb669 100644 --- a/source/blender/compositor/intern/COM_Node.cpp +++ b/source/blender/compositor/intern/COM_Node.cpp @@ -39,9 +39,9 @@ //#include <stdio.h> #include "COM_defines.h" -Node::Node(bNode *editorNode, bool create_sockets) +Node::Node(bNode *editorNode, bool create_sockets): NodeBase() { - this->m_editorNode = editorNode; + setbNode(editorNode); if (create_sockets) { bNodeSocket *input = (bNodeSocket *)editorNode->inputs.first; @@ -64,15 +64,6 @@ Node::Node(bNode *editorNode, bool create_sockets) } } } -Node::Node() -{ - this->m_editorNode = NULL; -} - -bNode *Node::getbNode() -{ - return this->m_editorNode; -} void Node::addSetValueOperation(ExecutionSystem *graph, InputSocket *inputsocket, int editorNodeInputSocketIndex) { diff --git a/source/blender/compositor/intern/COM_Node.h b/source/blender/compositor/intern/COM_Node.h index 5d6d232f37a..bc4a25db605 100644 --- a/source/blender/compositor/intern/COM_Node.h +++ b/source/blender/compositor/intern/COM_Node.h @@ -48,10 +48,6 @@ typedef pair<NodeIterator, NodeIterator> NodeRange; */ class Node : public NodeBase { private: - /** - * @brief stores the reference to the SDNA bNode struct - */ - bNode *m_editorNode; /** * @brief Is this node part of the active group @@ -60,12 +56,7 @@ private: public: Node(bNode *editorNode, bool create_sockets = true); - - /** - * @brief get the reference to the SDNA bNode struct - */ - bNode *getbNode(); - + /** * @brief Is this node in the active group (the group that is being edited) * @param isInActiveGroup @@ -137,9 +128,6 @@ public: */ OutputSocket *findOutputSocketBybNodeSocket(bNodeSocket *socket); protected: - - Node(); - void addPreviewOperation(ExecutionSystem *system, InputSocket *inputSocket); void addPreviewOperation(ExecutionSystem *system, OutputSocket *outputSocket); diff --git a/source/blender/compositor/intern/COM_NodeBase.cpp b/source/blender/compositor/intern/COM_NodeBase.cpp index 8dbda5f649c..5c2ce37bdea 100644 --- a/source/blender/compositor/intern/COM_NodeBase.cpp +++ b/source/blender/compositor/intern/COM_NodeBase.cpp @@ -33,7 +33,7 @@ NodeBase::NodeBase() { - /* pass */ + this->m_editorNode = NULL; } diff --git a/source/blender/compositor/intern/COM_NodeBase.h b/source/blender/compositor/intern/COM_NodeBase.h index 7095cda39e3..3c390f6bcdb 100644 --- a/source/blender/compositor/intern/COM_NodeBase.h +++ b/source/blender/compositor/intern/COM_NodeBase.h @@ -54,6 +54,11 @@ private: */ vector<OutputSocket *> m_outputsockets; + /** + * @brief stores the reference to the SDNA bNode struct + */ + bNode *m_editorNode; + protected: /** * @brief get access to the vector of input sockets @@ -74,6 +79,18 @@ public: virtual ~NodeBase(); /** + * @brief get the reference to the SDNA bNode struct + */ + bNode *getbNode() {return m_editorNode;} + + /** + * @brief set the reference to the bNode + * @note used in Node instances to receive the storage/settings and complex node for highlight during execution + * @param bNode + */ + void setbNode(bNode *bNode) {this->m_editorNode = bNode;} + + /** * @brief is this node an operation? * This is true when the instance is of the subclass NodeOperation. * @return [true:false] diff --git a/source/blender/compositor/intern/COM_NodeOperation.cpp b/source/blender/compositor/intern/COM_NodeOperation.cpp index 6ef8a5ff078..c3fa308971c 100644 --- a/source/blender/compositor/intern/COM_NodeOperation.cpp +++ b/source/blender/compositor/intern/COM_NodeOperation.cpp @@ -28,7 +28,7 @@ #include "COM_SocketConnection.h" #include "COM_defines.h" -NodeOperation::NodeOperation() +NodeOperation::NodeOperation() : NodeBase() { this->m_resolutionInputSocketIndex = 0; this->m_complex = false; diff --git a/source/blender/compositor/intern/COM_WorkScheduler.cpp b/source/blender/compositor/intern/COM_WorkScheduler.cpp index c49ac24e018..120b4d6d0f2 100644 --- a/source/blender/compositor/intern/COM_WorkScheduler.cpp +++ b/source/blender/compositor/intern/COM_WorkScheduler.cpp @@ -30,6 +30,7 @@ #include "COM_OpenCLDevice.h" #include "COM_OpenCLKernels.cl.h" #include "OCL_opencl.h" +#include "COM_WriteBufferOperation.h" #include "PIL_time.h" #include "BLI_threads.h" @@ -65,6 +66,25 @@ static bool g_openclActive = false; #endif #endif +#define HIGHLIGHT(wp) \ +{ \ + ExecutionGroup* group = wp->getExecutionGroup(); \ + if (group->isComplex()) { \ + NodeOperation* operation = group->getOutputNodeOperation(); \ + if (operation->isWriteBufferOperation()) {\ + WriteBufferOperation *writeOperation = (WriteBufferOperation*)operation;\ + NodeOperation *complexOperation = writeOperation->getInput(); \ + bNode *node = complexOperation->getbNode(); \ + if (node) { \ + if (node->original) { \ + node->original->highlight = 1;\ + } else {\ + node->highlight = 1; \ + }\ + } \ + } \ + } \ +} #if COM_CURRENT_THREADING_MODEL == COM_TM_QUEUE void *WorkScheduler::thread_execute_cpu(void *data) @@ -73,6 +93,7 @@ void *WorkScheduler::thread_execute_cpu(void *data) WorkPackage *work; while ((work = (WorkPackage *)BLI_thread_queue_pop(g_cpuqueue))) { + HIGHLIGHT(work); device->execute(work); delete work; } @@ -86,6 +107,7 @@ void *WorkScheduler::thread_execute_gpu(void *data) WorkPackage *work; while ((work = (WorkPackage *)BLI_thread_queue_pop(g_gpuqueue))) { + HIGHLIGHT(work); device->execute(work); delete work; } diff --git a/source/blender/compositor/intern/COM_compositor.cpp b/source/blender/compositor/intern/COM_compositor.cpp index 7282cf65bc3..ab64f8f7bf1 100644 --- a/source/blender/compositor/intern/COM_compositor.cpp +++ b/source/blender/compositor/intern/COM_compositor.cpp @@ -57,8 +57,23 @@ void COM_execute(RenderData *rd, bNodeTree *editingtree, int rendering) /* set progress bar to 0% and status to init compositing*/ editingtree->progress(editingtree->prh, 0.0); + bool twopass = (editingtree->flag&NTREE_TWO_PASS) > 0 && !rendering; /* initialize execution system */ - ExecutionSystem *system = new ExecutionSystem(rd, editingtree, rendering); + if (twopass) { + ExecutionSystem *system = new ExecutionSystem(rd, editingtree, rendering, twopass); + system->execute(); + delete system; + + if (editingtree->test_break(editingtree->tbh)) { + // during editing multiple calls to this method can be triggered. + // make sure one the last one will be doing the work. + BLI_mutex_unlock(&compositorMutex); + return; + } + } + + + ExecutionSystem *system = new ExecutionSystem(rd, editingtree, rendering, false); system->execute(); delete system; diff --git a/source/blender/compositor/nodes/COM_BilateralBlurNode.cpp b/source/blender/compositor/nodes/COM_BilateralBlurNode.cpp index f96a92068f4..683093302c1 100644 --- a/source/blender/compositor/nodes/COM_BilateralBlurNode.cpp +++ b/source/blender/compositor/nodes/COM_BilateralBlurNode.cpp @@ -35,6 +35,7 @@ void BilateralBlurNode::convertToOperations(ExecutionSystem *graph, CompositorCo { NodeBilateralBlurData *data = (NodeBilateralBlurData *)this->getbNode()->storage; BilateralBlurOperation *operation = new BilateralBlurOperation(); + operation->setbNode(this->getbNode()); operation->setQuality(context->getQuality()); operation->setData(data); this->getInputSocket(0)->relinkConnections(operation->getInputSocket(0), 0, graph); diff --git a/source/blender/compositor/nodes/COM_BlurNode.cpp b/source/blender/compositor/nodes/COM_BlurNode.cpp index 1b541d81c33..5447652c238 100644 --- a/source/blender/compositor/nodes/COM_BlurNode.cpp +++ b/source/blender/compositor/nodes/COM_BlurNode.cpp @@ -49,6 +49,7 @@ void BlurNode::convertToOperations(ExecutionSystem *graph, CompositorContext *co if (data->filtertype == R_FILTER_FAST_GAUSS) { FastGaussianBlurOperation *operationfgb = new FastGaussianBlurOperation(); operationfgb->setData(data); + operationfgb->setbNode(editorNode); this->getInputSocket(0)->relinkConnections(operationfgb->getInputSocket(0), 0, graph); this->getInputSocket(1)->relinkConnections(operationfgb->getInputSocket(1), 1, graph); this->getOutputSocket(0)->relinkConnections(operationfgb->getOutputSocket(0)); @@ -58,12 +59,14 @@ void BlurNode::convertToOperations(ExecutionSystem *graph, CompositorContext *co else if (!data->bokeh) { GaussianXBlurOperation *operationx = new GaussianXBlurOperation(); operationx->setData(data); + operationx->setbNode(editorNode); operationx->setQuality(quality); this->getInputSocket(0)->relinkConnections(operationx->getInputSocket(0), 0, graph); this->getInputSocket(1)->relinkConnections(operationx->getInputSocket(1), 1, graph); graph->addOperation(operationx); GaussianYBlurOperation *operationy = new GaussianYBlurOperation(); operationy->setData(data); + operationy->setbNode(editorNode); operationy->setQuality(quality); this->getOutputSocket(0)->relinkConnections(operationy->getOutputSocket()); graph->addOperation(operationy); @@ -79,6 +82,7 @@ void BlurNode::convertToOperations(ExecutionSystem *graph, CompositorContext *co else { GaussianBokehBlurOperation *operation = new GaussianBokehBlurOperation(); operation->setData(data); + operation->setbNode(editorNode); this->getInputSocket(0)->relinkConnections(operation->getInputSocket(0), 0, graph); this->getInputSocket(1)->relinkConnections(operation->getInputSocket(1), 1, graph); operation->setQuality(quality); diff --git a/source/blender/compositor/nodes/COM_BokehBlurNode.cpp b/source/blender/compositor/nodes/COM_BokehBlurNode.cpp index 59ec9525fa6..0ea4b20c793 100644 --- a/source/blender/compositor/nodes/COM_BokehBlurNode.cpp +++ b/source/blender/compositor/nodes/COM_BokehBlurNode.cpp @@ -61,6 +61,7 @@ void BokehBlurNode::convertToOperations(ExecutionSystem *graph, CompositorContex this->getInputSocket(3)->relinkConnections(operation->getInputSocket(2), 3, graph); operation->setSize(((bNodeSocketValueFloat *)this->getInputSocket(2)->getbNodeSocket()->default_value)->value); operation->setQuality(context->getQuality()); + operation->setbNode(this->getbNode()); graph->addOperation(operation); this->getOutputSocket(0)->relinkConnections(operation->getOutputSocket()); // } diff --git a/source/blender/compositor/nodes/COM_ColorToBWNode.cpp b/source/blender/compositor/nodes/COM_ColorToBWNode.cpp index 430f317eae2..511fdf09f41 100644 --- a/source/blender/compositor/nodes/COM_ColorToBWNode.cpp +++ b/source/blender/compositor/nodes/COM_ColorToBWNode.cpp @@ -25,18 +25,18 @@ #include "COM_ConvertColorToBWOperation.h" #include "COM_ExecutionSystem.h" -ColourToBWNode::ColourToBWNode(bNode *editorNode) : Node(editorNode) +ColorToBWNode::ColorToBWNode(bNode *editorNode) : Node(editorNode) { /* pass */ } -void ColourToBWNode::convertToOperations(ExecutionSystem *graph, CompositorContext *context) +void ColorToBWNode::convertToOperations(ExecutionSystem *graph, CompositorContext *context) { - InputSocket *colourSocket = this->getInputSocket(0); + InputSocket *colorSocket = this->getInputSocket(0); OutputSocket *valueSocket = this->getOutputSocket(0); ConvertColorToBWOperation *convertProg = new ConvertColorToBWOperation(); - colourSocket->relinkConnections(convertProg->getInputSocket(0), 0, graph); + colorSocket->relinkConnections(convertProg->getInputSocket(0), 0, graph); valueSocket->relinkConnections(convertProg->getOutputSocket(0)); graph->addOperation(convertProg); } diff --git a/source/blender/compositor/nodes/COM_ColorToBWNode.h b/source/blender/compositor/nodes/COM_ColorToBWNode.h index 9262634edda..f21c6ecef52 100644 --- a/source/blender/compositor/nodes/COM_ColorToBWNode.h +++ b/source/blender/compositor/nodes/COM_ColorToBWNode.h @@ -20,18 +20,18 @@ * Monique Dewanchand */ -#ifndef _COM_ColourToBWNode_h_ -#define _COM_ColourToBWNode_h_ +#ifndef _COM_ColorToBWNode_h_ +#define _COM_ColorToBWNode_h_ #include "COM_Node.h" #include "DNA_node_types.h" /** - * @brief ColourToBWNode + * @brief ColorToBWNode * @ingroup Node */ -class ColourToBWNode : public Node { +class ColorToBWNode : public Node { public: - ColourToBWNode(bNode *editorNode); + ColorToBWNode(bNode *editorNode); void convertToOperations(ExecutionSystem *graph, CompositorContext *context); }; #endif diff --git a/source/blender/compositor/nodes/COM_CompositorNode.cpp b/source/blender/compositor/nodes/COM_CompositorNode.cpp index 6a6f2d1b4ff..28e466203c4 100644 --- a/source/blender/compositor/nodes/COM_CompositorNode.cpp +++ b/source/blender/compositor/nodes/COM_CompositorNode.cpp @@ -34,12 +34,12 @@ void CompositorNode::convertToOperations(ExecutionSystem *graph, CompositorConte InputSocket *imageSocket = this->getInputSocket(0); InputSocket *alphaSocket = this->getInputSocket(1); if (imageSocket->isConnected()) { - CompositorOperation *colourAlphaProg = new CompositorOperation(); - colourAlphaProg->setRenderData(context->getRenderData()); - colourAlphaProg->setbNodeTree(context->getbNodeTree()); - imageSocket->relinkConnections(colourAlphaProg->getInputSocket(0)); - alphaSocket->relinkConnections(colourAlphaProg->getInputSocket(1)); - graph->addOperation(colourAlphaProg); - addPreviewOperation(graph, colourAlphaProg->getInputSocket(0)); + CompositorOperation *colorAlphaProg = new CompositorOperation(); + colorAlphaProg->setRenderData(context->getRenderData()); + colorAlphaProg->setbNodeTree(context->getbNodeTree()); + imageSocket->relinkConnections(colorAlphaProg->getInputSocket(0)); + alphaSocket->relinkConnections(colorAlphaProg->getInputSocket(1)); + graph->addOperation(colorAlphaProg); + addPreviewOperation(graph, colorAlphaProg->getInputSocket(0)); } } diff --git a/source/blender/compositor/nodes/COM_DefocusNode.cpp b/source/blender/compositor/nodes/COM_DefocusNode.cpp index 461505871c6..4c6b3ad137b 100644 --- a/source/blender/compositor/nodes/COM_DefocusNode.cpp +++ b/source/blender/compositor/nodes/COM_DefocusNode.cpp @@ -46,6 +46,7 @@ void DefocusNode::convertToOperations(ExecutionSystem *graph, CompositorContext NodeDefocus *data = (NodeDefocus *)node->storage; NodeOperation *radiusOperation; + OutputSocket * depthOperation; if (data->no_zbuf) { MathMultiplyOperation *multiply = new MathMultiplyOperation(); SetValueOperation *multiplier = new SetValueOperation(); @@ -63,6 +64,7 @@ void DefocusNode::convertToOperations(ExecutionSystem *graph, CompositorContext graph->addOperation(maxRadius); graph->addOperation(minimize); radiusOperation = minimize; + depthOperation = minimize->getOutputSocket(0); } else { ConvertDepthToRadiusOperation *converter = new ConvertDepthToRadiusOperation(); @@ -72,6 +74,7 @@ void DefocusNode::convertToOperations(ExecutionSystem *graph, CompositorContext this->getInputSocket(1)->relinkConnections(converter->getInputSocket(0), 1, graph); graph->addOperation(converter); radiusOperation = converter; + depthOperation = converter->getInputSocket(0)->getConnection()->getFromSocket(); } BokehImageOperation *bokeh = new BokehImageOperation(); @@ -89,7 +92,15 @@ void DefocusNode::convertToOperations(ExecutionSystem *graph, CompositorContext bokeh->setData(bokehdata); bokeh->deleteDataOnFinish(); graph->addOperation(bokeh); - + +#ifdef COM_DEFOCUS_SEARCH + InverseSearchRadiusOperation *search = new InverseSearchRadiusOperation(); + addLink(graph, radiusOperation->getOutputSocket(0), search->getInputSocket(0)); + addLink(graph, depthOperation, search->getInputSocket(1)); + search->setMaxBlur(data->maxblur); + search->setThreshold(data->bthresh); + graph->addOperation(search); +#endif VariableSizeBokehBlurOperation *operation = new VariableSizeBokehBlurOperation(); if (data->preview) { operation->setQuality(COM_QUALITY_LOW); @@ -97,10 +108,14 @@ void DefocusNode::convertToOperations(ExecutionSystem *graph, CompositorContext operation->setQuality(context->getQuality()); } operation->setMaxBlur(data->maxblur); + operation->setbNode(node); operation->setThreshold(data->bthresh); addLink(graph, bokeh->getOutputSocket(), operation->getInputSocket(1)); addLink(graph, radiusOperation->getOutputSocket(), operation->getInputSocket(2)); - addLink(graph, radiusOperation->getInputSocket(0)->getConnection()->getFromSocket(), operation->getInputSocket(3)); + addLink(graph, depthOperation, operation->getInputSocket(3)); +#ifdef COM_DEFOCUS_SEARCH + addLink(graph, search->getOutputSocket(), operation->getInputSocket(4)); +#endif if (data->gamco) { GammaCorrectOperation *correct = new GammaCorrectOperation(); GammaUncorrectOperation *inverse = new GammaUncorrectOperation(); @@ -115,6 +130,5 @@ void DefocusNode::convertToOperations(ExecutionSystem *graph, CompositorContext this->getInputSocket(0)->relinkConnections(operation->getInputSocket(0), 0, graph); this->getOutputSocket()->relinkConnections(operation->getOutputSocket()); } - graph->addOperation(operation); } diff --git a/source/blender/compositor/nodes/COM_DilateErodeNode.cpp b/source/blender/compositor/nodes/COM_DilateErodeNode.cpp index 3f4e3736bbe..043ae367fbb 100644 --- a/source/blender/compositor/nodes/COM_DilateErodeNode.cpp +++ b/source/blender/compositor/nodes/COM_DilateErodeNode.cpp @@ -40,6 +40,7 @@ void DilateErodeNode::convertToOperations(ExecutionSystem *graph, CompositorCont bNode *editorNode = this->getbNode(); if (editorNode->custom1 == CMP_NODE_DILATEERODE_DISTANCE_THRESH) { DilateErodeThresholdOperation *operation = new DilateErodeThresholdOperation(); + operation->setbNode(editorNode); operation->setDistance(editorNode->custom2); operation->setInset(editorNode->custom3); @@ -59,6 +60,7 @@ void DilateErodeNode::convertToOperations(ExecutionSystem *graph, CompositorCont else if (editorNode->custom1 == CMP_NODE_DILATEERODE_DISTANCE) { if (editorNode->custom2 > 0) { DilateDistanceOperation *operation = new DilateDistanceOperation(); + operation->setbNode(editorNode); operation->setDistance(editorNode->custom2); this->getInputSocket(0)->relinkConnections(operation->getInputSocket(0), 0, graph); this->getOutputSocket(0)->relinkConnections(operation->getOutputSocket(0)); @@ -66,6 +68,7 @@ void DilateErodeNode::convertToOperations(ExecutionSystem *graph, CompositorCont } else { ErodeDistanceOperation *operation = new ErodeDistanceOperation(); + operation->setbNode(editorNode); operation->setDistance(-editorNode->custom2); this->getInputSocket(0)->relinkConnections(operation->getInputSocket(0), 0, graph); this->getOutputSocket(0)->relinkConnections(operation->getOutputSocket(0)); @@ -90,12 +93,14 @@ void DilateErodeNode::convertToOperations(ExecutionSystem *graph, CompositorCont } GaussianAlphaXBlurOperation *operationx = new GaussianAlphaXBlurOperation(); + operationx->setbNode(editorNode); operationx->setData(data); operationx->setQuality(quality); this->getInputSocket(0)->relinkConnections(operationx->getInputSocket(0), 0, graph); // this->getInputSocket(1)->relinkConnections(operationx->getInputSocket(1), 1, graph); // no size input yet graph->addOperation(operationx); GaussianAlphaYBlurOperation *operationy = new GaussianAlphaYBlurOperation(); + operationy->setbNode(editorNode); operationy->setData(data); operationy->setQuality(quality); this->getOutputSocket(0)->relinkConnections(operationy->getOutputSocket()); @@ -127,6 +132,7 @@ void DilateErodeNode::convertToOperations(ExecutionSystem *graph, CompositorCont else { if (editorNode->custom2 > 0) { DilateStepOperation *operation = new DilateStepOperation(); + operation->setbNode(editorNode); operation->setIterations(editorNode->custom2); this->getInputSocket(0)->relinkConnections(operation->getInputSocket(0), 0, graph); this->getOutputSocket(0)->relinkConnections(operation->getOutputSocket(0)); @@ -134,6 +140,7 @@ void DilateErodeNode::convertToOperations(ExecutionSystem *graph, CompositorCont } else { ErodeStepOperation *operation = new ErodeStepOperation(); + operation->setbNode(editorNode); operation->setIterations(-editorNode->custom2); this->getInputSocket(0)->relinkConnections(operation->getInputSocket(0), 0, graph); this->getOutputSocket(0)->relinkConnections(operation->getOutputSocket(0)); diff --git a/source/blender/compositor/nodes/COM_DoubleEdgeMaskNode.cpp b/source/blender/compositor/nodes/COM_DoubleEdgeMaskNode.cpp index 57c319e7630..ab1d83385c7 100644 --- a/source/blender/compositor/nodes/COM_DoubleEdgeMaskNode.cpp +++ b/source/blender/compositor/nodes/COM_DoubleEdgeMaskNode.cpp @@ -36,6 +36,7 @@ void DoubleEdgeMaskNode::convertToOperations(ExecutionSystem *system, Compositor bNode *bnode = this->getbNode(); operation = new DoubleEdgeMaskOperation(); + operation->setbNode(bnode); operation->setAdjecentOnly(bnode->custom1); operation->setKeepInside(bnode->custom2); diff --git a/source/blender/compositor/nodes/COM_FilterNode.cpp b/source/blender/compositor/nodes/COM_FilterNode.cpp index 23f87805821..021ec6c2508 100644 --- a/source/blender/compositor/nodes/COM_FilterNode.cpp +++ b/source/blender/compositor/nodes/COM_FilterNode.cpp @@ -73,7 +73,7 @@ void FilterNode::convertToOperations(ExecutionSystem *graph, CompositorContext * operation->set3x3Filter(0, 0, 0, 0, 1, 0, 0, 0, 0); break; } - + operation->setbNode(this->getbNode()); inputImageSocket->relinkConnections(operation->getInputSocket(0), 1, graph); inputSocket->relinkConnections(operation->getInputSocket(1), 0, graph); outputSocket->relinkConnections(operation->getOutputSocket()); diff --git a/source/blender/compositor/nodes/COM_GlareNode.cpp b/source/blender/compositor/nodes/COM_GlareNode.cpp index 7b34fa4d286..8782e6bb6d9 100644 --- a/source/blender/compositor/nodes/COM_GlareNode.cpp +++ b/source/blender/compositor/nodes/COM_GlareNode.cpp @@ -63,6 +63,8 @@ void GlareNode::convertToOperations(ExecutionSystem *system, CompositorContext * SetValueOperation *mixvalueoperation = new SetValueOperation(); MixGlareOperation *mixoperation = new MixGlareOperation(); mixoperation->getInputSocket(2)->setResizeMode(COM_SC_FIT); + thresholdOperation->setbNode(node); + glareoperation->setbNode(node); this->getInputSocket(0)->relinkConnections(thresholdOperation->getInputSocket(0), 0, system); addLink(system, thresholdOperation->getOutputSocket(), glareoperation->getInputSocket(0)); diff --git a/source/blender/compositor/nodes/COM_HueSaturationValueCorrectNode.cpp b/source/blender/compositor/nodes/COM_HueSaturationValueCorrectNode.cpp index df125403f98..fd961030ebf 100644 --- a/source/blender/compositor/nodes/COM_HueSaturationValueCorrectNode.cpp +++ b/source/blender/compositor/nodes/COM_HueSaturationValueCorrectNode.cpp @@ -22,7 +22,7 @@ #include "COM_HueSaturationValueCorrectNode.h" -#include "COM_ConvertColourToValueProg.h" +#include "COM_ConvertColorToValueProg.h" #include "COM_ExecutionSystem.h" #include "COM_ConvertRGBToHSVOperation.h" #include "COM_ConvertHSVToRGBOperation.h" @@ -41,7 +41,7 @@ HueSaturationValueCorrectNode::HueSaturationValueCorrectNode(bNode *editorNode) void HueSaturationValueCorrectNode::convertToOperations(ExecutionSystem *graph, CompositorContext *context) { InputSocket *valueSocket = this->getInputSocket(0); - InputSocket *colourSocket = this->getInputSocket(1); + InputSocket *colorSocket = this->getInputSocket(1); OutputSocket *outputSocket = this->getOutputSocket(0); bNode *editorsnode = getbNode(); CurveMapping *storage = (CurveMapping *)editorsnode->storage; @@ -51,7 +51,7 @@ void HueSaturationValueCorrectNode::convertToOperations(ExecutionSystem *graph, HueSaturationValueCorrectOperation *changeHSV = new HueSaturationValueCorrectOperation(); MixBlendOperation *blend = new MixBlendOperation(); - colourSocket->relinkConnections(rgbToHSV->getInputSocket(0), 1, graph); + colorSocket->relinkConnections(rgbToHSV->getInputSocket(0), 1, graph); addLink(graph, rgbToHSV->getOutputSocket(), changeHSV->getInputSocket(0)); addLink(graph, changeHSV->getOutputSocket(), hsvToRGB->getInputSocket(0)); addLink(graph, hsvToRGB->getOutputSocket(), blend->getInputSocket(2)); diff --git a/source/blender/compositor/nodes/COM_HueSaturationValueNode.cpp b/source/blender/compositor/nodes/COM_HueSaturationValueNode.cpp index ef501317e48..9b55b809212 100644 --- a/source/blender/compositor/nodes/COM_HueSaturationValueNode.cpp +++ b/source/blender/compositor/nodes/COM_HueSaturationValueNode.cpp @@ -22,7 +22,7 @@ #include "COM_HueSaturationValueNode.h" -#include "COM_ConvertColourToValueProg.h" +#include "COM_ConvertColorToValueProg.h" #include "COM_ExecutionSystem.h" #include "COM_ConvertRGBToHSVOperation.h" #include "COM_ConvertHSVToRGBOperation.h" @@ -40,7 +40,7 @@ HueSaturationValueNode::HueSaturationValueNode(bNode *editorNode) : Node(editorN void HueSaturationValueNode::convertToOperations(ExecutionSystem *graph, CompositorContext *context) { InputSocket *valueSocket = this->getInputSocket(0); - InputSocket *colourSocket = this->getInputSocket(1); + InputSocket *colorSocket = this->getInputSocket(1); OutputSocket *outputSocket = this->getOutputSocket(0); bNode *editorsnode = getbNode(); NodeHueSat *storage = (NodeHueSat *)editorsnode->storage; @@ -50,7 +50,7 @@ void HueSaturationValueNode::convertToOperations(ExecutionSystem *graph, Composi ChangeHSVOperation *changeHSV = new ChangeHSVOperation(); MixBlendOperation *blend = new MixBlendOperation(); - colourSocket->relinkConnections(rgbToHSV->getInputSocket(0), 0, graph); + colorSocket->relinkConnections(rgbToHSV->getInputSocket(0), 0, graph); addLink(graph, rgbToHSV->getOutputSocket(), changeHSV->getInputSocket(0)); addLink(graph, changeHSV->getOutputSocket(), hsvToRGB->getInputSocket(0)); addLink(graph, hsvToRGB->getOutputSocket(), blend->getInputSocket(2)); diff --git a/source/blender/compositor/nodes/COM_KeyingNode.cpp b/source/blender/compositor/nodes/COM_KeyingNode.cpp index cc6fc6e1236..7c39765fbf1 100644 --- a/source/blender/compositor/nodes/COM_KeyingNode.cpp +++ b/source/blender/compositor/nodes/COM_KeyingNode.cpp @@ -74,9 +74,11 @@ OutputSocket *KeyingNode::setupPreBlur(ExecutionSystem *graph, InputSocket *inpu blurXOperation->setSize(size); blurXOperation->setAxis(KeyingBlurOperation::BLUR_AXIS_X); + blurXOperation->setbNode(this->getbNode()); blurYOperation->setSize(size); blurYOperation->setAxis(KeyingBlurOperation::BLUR_AXIS_Y); + blurYOperation->setbNode(this->getbNode()); addLink(graph, separateOperation->getOutputSocket(), blurXOperation->getInputSocket(0)); addLink(graph, blurXOperation->getOutputSocket(), blurYOperation->getInputSocket(0)); @@ -104,9 +106,11 @@ OutputSocket *KeyingNode::setupPostBlur(ExecutionSystem *graph, OutputSocket *po blurXOperation->setSize(size); blurXOperation->setAxis(KeyingBlurOperation::BLUR_AXIS_X); + blurXOperation->setbNode(this->getbNode()); blurYOperation->setSize(size); blurYOperation->setAxis(KeyingBlurOperation::BLUR_AXIS_Y); + blurYOperation->setbNode(this->getbNode()); addLink(graph, postBlurInput, blurXOperation->getInputSocket(0)); addLink(graph, blurXOperation->getOutputSocket(), blurYOperation->getInputSocket(0)); @@ -129,6 +133,7 @@ OutputSocket *KeyingNode::setupDilateErode(ExecutionSystem *graph, OutputSocket dilateErodeOperation = new ErodeDistanceOperation(); dilateErodeOperation->setDistance(-distance); } + dilateErodeOperation->setbNode(this->getbNode()); addLink(graph, dilateErodeInput, dilateErodeOperation->getInputSocket(0)); @@ -161,14 +166,16 @@ OutputSocket *KeyingNode::setupFeather(ExecutionSystem *graph, CompositorContext operationx->setSize(1.0f); operationx->setSubtract(distance < 0); operationx->setFalloff(falloff); + operationx->setbNode(this->getbNode()); graph->addOperation(operationx); - + GaussianAlphaYBlurOperation *operationy = new GaussianAlphaYBlurOperation(); operationy->setData(data); operationy->setQuality(quality); operationy->setSize(1.0f); operationy->setSubtract(distance < 0); operationy->setFalloff(falloff); + operationy->setbNode(this->getbNode()); graph->addOperation(operationy); addLink(graph, featherInput, operationx->getInputSocket(0)); diff --git a/source/blender/compositor/nodes/COM_KeyingScreenNode.cpp b/source/blender/compositor/nodes/COM_KeyingScreenNode.cpp index 0fb8d45d066..cd1f79235ea 100644 --- a/source/blender/compositor/nodes/COM_KeyingScreenNode.cpp +++ b/source/blender/compositor/nodes/COM_KeyingScreenNode.cpp @@ -45,6 +45,7 @@ void KeyingScreenNode::convertToOperations(ExecutionSystem *graph, CompositorCon // always connect the output image KeyingScreenOperation *operation = new KeyingScreenOperation(); + operation->setbNode(editorNode); if (outputScreen->isConnected()) { outputScreen->relinkConnections(operation->getOutputSocket()); diff --git a/source/blender/compositor/nodes/COM_LensDistortionNode.cpp b/source/blender/compositor/nodes/COM_LensDistortionNode.cpp index 0319e66ee22..3913b4ac2b6 100644 --- a/source/blender/compositor/nodes/COM_LensDistortionNode.cpp +++ b/source/blender/compositor/nodes/COM_LensDistortionNode.cpp @@ -37,7 +37,7 @@ void LensDistortionNode::convertToOperations(ExecutionSystem *graph, CompositorC NodeLensDist *data = (NodeLensDist *)editorNode->storage; if (data->proj) { ProjectorLensDistortionOperation *operation = new ProjectorLensDistortionOperation(); - + operation->setbNode(editorNode); this->getInputSocket(0)->relinkConnections(operation->getInputSocket(0), 0, graph); this->getInputSocket(2)->relinkConnections(operation->getInputSocket(1), 2, graph); this->getOutputSocket(0)->relinkConnections(operation->getOutputSocket(0)); @@ -48,13 +48,21 @@ void LensDistortionNode::convertToOperations(ExecutionSystem *graph, CompositorC } else { ScreenLensDistortionOperation *operation = new ScreenLensDistortionOperation(); + operation->setbNode(editorNode); + operation->setData(data); + if (!(this->getInputSocket(1)->isConnected() || this->getInputSocket(2)->isConnected())) { + // no nodes connected to the distortion and dispersion. We can precalculate some values + float distortion = ((const bNodeSocketValueFloat *)this->getInputSocket(1)->getbNodeSocket()->default_value)->value; + float dispersion = ((const bNodeSocketValueFloat *)this->getInputSocket(2)->getbNodeSocket()->default_value)->value; + operation->setDistortionAndDispersion(distortion, dispersion); + } this->getInputSocket(0)->relinkConnections(operation->getInputSocket(0), 0, graph); this->getInputSocket(1)->relinkConnections(operation->getInputSocket(1), 1, graph); this->getInputSocket(2)->relinkConnections(operation->getInputSocket(2), 2, graph); + this->getOutputSocket(0)->relinkConnections(operation->getOutputSocket(0)); - operation->setData(data); graph->addOperation(operation); } diff --git a/source/blender/compositor/nodes/COM_MapValueNode.cpp b/source/blender/compositor/nodes/COM_MapValueNode.cpp index ba2fc804f42..ac57ffed9da 100644 --- a/source/blender/compositor/nodes/COM_MapValueNode.cpp +++ b/source/blender/compositor/nodes/COM_MapValueNode.cpp @@ -32,12 +32,12 @@ MapValueNode::MapValueNode(bNode *editorNode) : Node(editorNode) void MapValueNode::convertToOperations(ExecutionSystem *graph, CompositorContext *context) { - InputSocket *colourSocket = this->getInputSocket(0); + InputSocket *colorSocket = this->getInputSocket(0); OutputSocket *valueSocket = this->getOutputSocket(0); TexMapping *storage = (TexMapping *)this->getbNode()->storage; MapValueOperation *convertProg = new MapValueOperation(); convertProg->setSettings(storage); - colourSocket->relinkConnections(convertProg->getInputSocket(0), 0, graph); + colorSocket->relinkConnections(convertProg->getInputSocket(0), 0, graph); valueSocket->relinkConnections(convertProg->getOutputSocket(0)); graph->addOperation(convertProg); } diff --git a/source/blender/compositor/nodes/COM_MaskNode.cpp b/source/blender/compositor/nodes/COM_MaskNode.cpp index 13037b61a56..b6300300f6f 100644 --- a/source/blender/compositor/nodes/COM_MaskNode.cpp +++ b/source/blender/compositor/nodes/COM_MaskNode.cpp @@ -45,7 +45,7 @@ void MaskNode::convertToOperations(ExecutionSystem *graph, CompositorContext *co // always connect the output image MaskOperation *operation = new MaskOperation(); - + operation->setbNode(editorNode); operation->setMaskWidth(data->xsch * data->size / 100.0f); operation->setMaskHeight(data->ysch * data->size / 100.0f); diff --git a/source/blender/compositor/nodes/COM_RenderLayersNode.cpp b/source/blender/compositor/nodes/COM_RenderLayersNode.cpp index 95e759fde24..dfb46af841c 100644 --- a/source/blender/compositor/nodes/COM_RenderLayersNode.cpp +++ b/source/blender/compositor/nodes/COM_RenderLayersNode.cpp @@ -82,7 +82,7 @@ void RenderLayersNode::testSocketConnection(ExecutionSystem *system, int outputS void RenderLayersNode::convertToOperations(ExecutionSystem *graph, CompositorContext *context) { - testSocketConnection(graph, 0, new RenderLayersColourProg()); + testSocketConnection(graph, 0, new RenderLayersColorProg()); testSocketConnection(graph, 1, new RenderLayersAlphaProg()); testSocketConnection(graph, 2, new RenderLayersDepthProg()); testSocketConnection(graph, 3, new RenderLayersNormalOperation()); diff --git a/source/blender/compositor/nodes/COM_TonemapNode.cpp b/source/blender/compositor/nodes/COM_TonemapNode.cpp index a1f33ed464b..68e322e9dcf 100644 --- a/source/blender/compositor/nodes/COM_TonemapNode.cpp +++ b/source/blender/compositor/nodes/COM_TonemapNode.cpp @@ -34,7 +34,7 @@ void TonemapNode::convertToOperations(ExecutionSystem *system, CompositorContext { NodeTonemap *data = (NodeTonemap *)this->getbNode()->storage; TonemapOperation *operation = data->type == 1 ? new PhotoreceptorTonemapOperation() : new TonemapOperation(); - + operation->setbNode(this->getbNode()); operation->setData(data); this->getInputSocket(0)->relinkConnections(operation->getInputSocket(0), 0, system); this->getOutputSocket(0)->relinkConnections(operation->getOutputSocket(0)); diff --git a/source/blender/compositor/nodes/COM_VectorBlurNode.cpp b/source/blender/compositor/nodes/COM_VectorBlurNode.cpp index 5ef384a9984..07c8120b1d2 100644 --- a/source/blender/compositor/nodes/COM_VectorBlurNode.cpp +++ b/source/blender/compositor/nodes/COM_VectorBlurNode.cpp @@ -34,6 +34,7 @@ void VectorBlurNode::convertToOperations(ExecutionSystem *system, CompositorCont bNode *node = this->getbNode(); NodeBlurData *vectorBlurSettings = (NodeBlurData *)node->storage; VectorBlurOperation *operation = new VectorBlurOperation(); + operation->setbNode(node); operation->setVectorBlurSettings(vectorBlurSettings); operation->setQuality(context->getQuality()); this->getInputSocket(0)->relinkConnections(operation->getInputSocket(0), 0, system); diff --git a/source/blender/compositor/operations/COM_AlphaOverKeyOperation.h b/source/blender/compositor/operations/COM_AlphaOverKeyOperation.h index e5b1f56f06c..113ec245ee6 100644 --- a/source/blender/compositor/operations/COM_AlphaOverKeyOperation.h +++ b/source/blender/compositor/operations/COM_AlphaOverKeyOperation.h @@ -26,8 +26,8 @@ /** - * this program converts an input colour to an output value. - * it assumes we are in sRGB colour space. + * this program converts an input color to an output value. + * it assumes we are in sRGB color space. */ class AlphaOverKeyOperation : public MixBaseOperation { public: diff --git a/source/blender/compositor/operations/COM_AlphaOverMixedOperation.h b/source/blender/compositor/operations/COM_AlphaOverMixedOperation.h index 24a991da17b..3c0b955e360 100644 --- a/source/blender/compositor/operations/COM_AlphaOverMixedOperation.h +++ b/source/blender/compositor/operations/COM_AlphaOverMixedOperation.h @@ -26,8 +26,8 @@ /** - * this program converts an input colour to an output value. - * it assumes we are in sRGB colour space. + * this program converts an input color to an output value. + * it assumes we are in sRGB color space. */ class AlphaOverMixedOperation : public MixBaseOperation { private: diff --git a/source/blender/compositor/operations/COM_AlphaOverPremultiplyOperation.h b/source/blender/compositor/operations/COM_AlphaOverPremultiplyOperation.h index bba3b714f6b..7b7b9238794 100644 --- a/source/blender/compositor/operations/COM_AlphaOverPremultiplyOperation.h +++ b/source/blender/compositor/operations/COM_AlphaOverPremultiplyOperation.h @@ -26,8 +26,8 @@ /** - * this program converts an input colour to an output value. - * it assumes we are in sRGB colour space. + * this program converts an input color to an output value. + * it assumes we are in sRGB color space. */ class AlphaOverPremultiplyOperation : public MixBaseOperation { public: diff --git a/source/blender/compositor/operations/COM_ChangeHSVOperation.h b/source/blender/compositor/operations/COM_ChangeHSVOperation.h index 9c343db9c3c..ee35fbe01d4 100644 --- a/source/blender/compositor/operations/COM_ChangeHSVOperation.h +++ b/source/blender/compositor/operations/COM_ChangeHSVOperation.h @@ -26,8 +26,8 @@ /** - * this program converts an input colour to an output value. - * it assumes we are in sRGB colour space. + * this program converts an input color to an output value. + * it assumes we are in sRGB color space. */ class ChangeHSVOperation : public NodeOperation { private: diff --git a/source/blender/compositor/operations/COM_ChannelMatteOperation.h b/source/blender/compositor/operations/COM_ChannelMatteOperation.h index 5bc13736dda..ee17036a78d 100644 --- a/source/blender/compositor/operations/COM_ChannelMatteOperation.h +++ b/source/blender/compositor/operations/COM_ChannelMatteOperation.h @@ -25,8 +25,8 @@ /** - * this program converts an input colour to an output value. - * it assumes we are in sRGB colour space. + * this program converts an input color to an output value. + * it assumes we are in sRGB color space. */ class ChannelMatteOperation : public NodeOperation { private: diff --git a/source/blender/compositor/operations/COM_ChromaMatteOperation.h b/source/blender/compositor/operations/COM_ChromaMatteOperation.h index 472a797fa28..eaca05e66ca 100644 --- a/source/blender/compositor/operations/COM_ChromaMatteOperation.h +++ b/source/blender/compositor/operations/COM_ChromaMatteOperation.h @@ -25,8 +25,8 @@ /** - * this program converts an input colour to an output value. - * it assumes we are in sRGB colour space. + * this program converts an input color to an output value. + * it assumes we are in sRGB color space. */ class ChromaMatteOperation : public NodeOperation { private: diff --git a/source/blender/compositor/operations/COM_ColorBalanceASCCDLOperation.h b/source/blender/compositor/operations/COM_ColorBalanceASCCDLOperation.h index 479927d30d1..a9c0dff9ad4 100644 --- a/source/blender/compositor/operations/COM_ColorBalanceASCCDLOperation.h +++ b/source/blender/compositor/operations/COM_ColorBalanceASCCDLOperation.h @@ -25,8 +25,8 @@ #include "COM_NodeOperation.h" /** - * this program converts an input colour to an output value. - * it assumes we are in sRGB colour space. + * this program converts an input color to an output value. + * it assumes we are in sRGB color space. */ class ColorBalanceASCCDLOperation : public NodeOperation { protected: diff --git a/source/blender/compositor/operations/COM_ColorBalanceLGGOperation.h b/source/blender/compositor/operations/COM_ColorBalanceLGGOperation.h index ec3652da09e..ffc78fae6f1 100644 --- a/source/blender/compositor/operations/COM_ColorBalanceLGGOperation.h +++ b/source/blender/compositor/operations/COM_ColorBalanceLGGOperation.h @@ -26,8 +26,8 @@ /** - * this program converts an input colour to an output value. - * it assumes we are in sRGB colour space. + * this program converts an input color to an output value. + * it assumes we are in sRGB color space. */ class ColorBalanceLGGOperation : public NodeOperation { protected: diff --git a/source/blender/compositor/operations/COM_ColorMatteOperation.h b/source/blender/compositor/operations/COM_ColorMatteOperation.h index ae904f8f938..d996ce34667 100644 --- a/source/blender/compositor/operations/COM_ColorMatteOperation.h +++ b/source/blender/compositor/operations/COM_ColorMatteOperation.h @@ -25,8 +25,8 @@ /** - * this program converts an input colour to an output value. - * it assumes we are in sRGB colour space. + * this program converts an input color to an output value. + * it assumes we are in sRGB color space. */ class ColorMatteOperation : public NodeOperation { private: diff --git a/source/blender/compositor/operations/COM_ColorSpillOperation.h b/source/blender/compositor/operations/COM_ColorSpillOperation.h index 6e3156819b2..7aac612cb8c 100644 --- a/source/blender/compositor/operations/COM_ColorSpillOperation.h +++ b/source/blender/compositor/operations/COM_ColorSpillOperation.h @@ -25,8 +25,8 @@ #include "COM_NodeOperation.h" /** - * this program converts an input colour to an output value. - * it assumes we are in sRGB colour space. + * this program converts an input color to an output value. + * it assumes we are in sRGB color space. */ class ColorSpillOperation : public NodeOperation { protected: diff --git a/source/blender/compositor/operations/COM_ConvertColorProfileOperation.h b/source/blender/compositor/operations/COM_ConvertColorProfileOperation.h index 0b9a07a57ca..b237448d16e 100644 --- a/source/blender/compositor/operations/COM_ConvertColorProfileOperation.h +++ b/source/blender/compositor/operations/COM_ConvertColorProfileOperation.h @@ -26,8 +26,8 @@ /** - * this program converts an input colour to an output value. - * it assumes we are in sRGB colour space. + * this program converts an input color to an output value. + * it assumes we are in sRGB color space. */ class ConvertColorProfileOperation : public NodeOperation { private: diff --git a/source/blender/compositor/operations/COM_ConvertColorToBWOperation.h b/source/blender/compositor/operations/COM_ConvertColorToBWOperation.h index 2a57c997196..9c62ad8dd39 100644 --- a/source/blender/compositor/operations/COM_ConvertColorToBWOperation.h +++ b/source/blender/compositor/operations/COM_ConvertColorToBWOperation.h @@ -26,8 +26,8 @@ /** - * this program converts an input colour to an output value. - * it assumes we are in sRGB colour space. + * this program converts an input color to an output value. + * it assumes we are in sRGB color space. */ class ConvertColorToBWOperation : public NodeOperation { private: diff --git a/source/blender/compositor/operations/COM_ConvertColourToValueProg.cpp b/source/blender/compositor/operations/COM_ConvertColorToValueProg.cpp index c872f3e85bb..c09842b1aa9 100644 --- a/source/blender/compositor/operations/COM_ConvertColourToValueProg.cpp +++ b/source/blender/compositor/operations/COM_ConvertColorToValueProg.cpp @@ -20,28 +20,28 @@ * Monique Dewanchand */ -#include "COM_ConvertColourToValueProg.h" +#include "COM_ConvertColorToValueProg.h" -ConvertColourToValueProg::ConvertColourToValueProg() : NodeOperation() +ConvertColorToValueProg::ConvertColorToValueProg() : NodeOperation() { this->addInputSocket(COM_DT_COLOR); this->addOutputSocket(COM_DT_VALUE); this->m_inputOperation = NULL; } -void ConvertColourToValueProg::initExecution() +void ConvertColorToValueProg::initExecution() { this->m_inputOperation = this->getInputSocketReader(0); } -void ConvertColourToValueProg::executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) +void ConvertColorToValueProg::executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) { float inputColor[4]; this->m_inputOperation->read(&inputColor[0], x, y, sampler, inputBuffers); outputValue[0] = (inputColor[0] + inputColor[1] + inputColor[2]) / 3.0f; } -void ConvertColourToValueProg::deinitExecution() +void ConvertColorToValueProg::deinitExecution() { this->m_inputOperation = NULL; } diff --git a/source/blender/compositor/operations/COM_ConvertColourToValueProg.h b/source/blender/compositor/operations/COM_ConvertColorToValueProg.h index ebd4bcbd59b..c1ac7ca69ce 100644 --- a/source/blender/compositor/operations/COM_ConvertColourToValueProg.h +++ b/source/blender/compositor/operations/COM_ConvertColorToValueProg.h @@ -20,16 +20,16 @@ * Monique Dewanchand */ -#ifndef _COM_ConvertColourToValueProg_h -#define _COM_ConvertColourToValueProg_h +#ifndef _COM_ConvertColorToValueProg_h +#define _COM_ConvertColorToValueProg_h #include "COM_NodeOperation.h" /** - * this program converts an input colour to an output value. - * it assumes we are in sRGB colour space. + * this program converts an input color to an output value. + * it assumes we are in sRGB color space. */ -class ConvertColourToValueProg : public NodeOperation { +class ConvertColorToValueProg : public NodeOperation { private: /** * Cached reference to the inputProgram @@ -39,7 +39,7 @@ public: /** * Default constructor */ - ConvertColourToValueProg(); + ConvertColorToValueProg(); /** * the inner loop of this program diff --git a/source/blender/compositor/operations/COM_ConvertColorToVectorOperation.h b/source/blender/compositor/operations/COM_ConvertColorToVectorOperation.h index f9170dfc7aa..51fa3a677cd 100644 --- a/source/blender/compositor/operations/COM_ConvertColorToVectorOperation.h +++ b/source/blender/compositor/operations/COM_ConvertColorToVectorOperation.h @@ -26,8 +26,8 @@ /** - * this program converts an input colour to an output value. - * it assumes we are in sRGB colour space. + * this program converts an input color to an output value. + * it assumes we are in sRGB color space. */ class ConvertColorToVectorOperation : public NodeOperation { private: diff --git a/source/blender/compositor/operations/COM_ConvertDepthToRadiusOperation.h b/source/blender/compositor/operations/COM_ConvertDepthToRadiusOperation.h index 966a74c04ad..415befea168 100644 --- a/source/blender/compositor/operations/COM_ConvertDepthToRadiusOperation.h +++ b/source/blender/compositor/operations/COM_ConvertDepthToRadiusOperation.h @@ -26,8 +26,8 @@ #include "DNA_object_types.h" /** - * this program converts an input colour to an output value. - * it assumes we are in sRGB colour space. + * this program converts an input color to an output value. + * it assumes we are in sRGB color space. */ class ConvertDepthToRadiusOperation : public NodeOperation { private: diff --git a/source/blender/compositor/operations/COM_ConvertHSVToRGBOperation.h b/source/blender/compositor/operations/COM_ConvertHSVToRGBOperation.h index f8b6a4c11fa..3babbfb7c1d 100644 --- a/source/blender/compositor/operations/COM_ConvertHSVToRGBOperation.h +++ b/source/blender/compositor/operations/COM_ConvertHSVToRGBOperation.h @@ -26,8 +26,8 @@ /** - * this program converts an input colour to an output value. - * it assumes we are in sRGB colour space. + * this program converts an input color to an output value. + * it assumes we are in sRGB color space. */ class ConvertHSVToRGBOperation : public NodeOperation { private: diff --git a/source/blender/compositor/operations/COM_ConvertKeyToPremulOperation.h b/source/blender/compositor/operations/COM_ConvertKeyToPremulOperation.h index 2b5e1871972..50b39928305 100644 --- a/source/blender/compositor/operations/COM_ConvertKeyToPremulOperation.h +++ b/source/blender/compositor/operations/COM_ConvertKeyToPremulOperation.h @@ -25,8 +25,8 @@ /** - * this program converts an input colour to an output value. - * it assumes we are in sRGB colour space. + * this program converts an input color to an output value. + * it assumes we are in sRGB color space. */ class ConvertKeyToPremulOperation : public NodeOperation { private: diff --git a/source/blender/compositor/operations/COM_ConvertPremulToKeyOperation.h b/source/blender/compositor/operations/COM_ConvertPremulToKeyOperation.h index 05c6b26b171..173cbb4fc0a 100644 --- a/source/blender/compositor/operations/COM_ConvertPremulToKeyOperation.h +++ b/source/blender/compositor/operations/COM_ConvertPremulToKeyOperation.h @@ -25,8 +25,8 @@ /** - * this program converts an input colour to an output value. - * it assumes we are in sRGB colour space. + * this program converts an input color to an output value. + * it assumes we are in sRGB color space. */ class ConvertPremulToKeyOperation : public NodeOperation { private: diff --git a/source/blender/compositor/operations/COM_ConvertRGBToHSVOperation.h b/source/blender/compositor/operations/COM_ConvertRGBToHSVOperation.h index af8a7f78a61..42bd439c8c2 100644 --- a/source/blender/compositor/operations/COM_ConvertRGBToHSVOperation.h +++ b/source/blender/compositor/operations/COM_ConvertRGBToHSVOperation.h @@ -26,8 +26,8 @@ /** - * this program converts an input colour to an output value. - * it assumes we are in sRGB colour space. + * this program converts an input color to an output value. + * it assumes we are in sRGB color space. */ class ConvertRGBToHSVOperation : public NodeOperation { private: diff --git a/source/blender/compositor/operations/COM_ConvertRGBToYCCOperation.h b/source/blender/compositor/operations/COM_ConvertRGBToYCCOperation.h index 97fbdb29874..744e0657dc6 100644 --- a/source/blender/compositor/operations/COM_ConvertRGBToYCCOperation.h +++ b/source/blender/compositor/operations/COM_ConvertRGBToYCCOperation.h @@ -25,8 +25,8 @@ /** - * this program converts an input colour to an output value. - * it assumes we are in sRGB colour space. + * this program converts an input color to an output value. + * it assumes we are in sRGB color space. */ class ConvertRGBToYCCOperation : public NodeOperation { private: diff --git a/source/blender/compositor/operations/COM_ConvertRGBToYUVOperation.h b/source/blender/compositor/operations/COM_ConvertRGBToYUVOperation.h index 89998897782..b470378704e 100644 --- a/source/blender/compositor/operations/COM_ConvertRGBToYUVOperation.h +++ b/source/blender/compositor/operations/COM_ConvertRGBToYUVOperation.h @@ -25,8 +25,8 @@ /** - * this program converts an input colour to an output value. - * it assumes we are in sRGB colour space. + * this program converts an input color to an output value. + * it assumes we are in sRGB color space. */ class ConvertRGBToYUVOperation : public NodeOperation { private: diff --git a/source/blender/compositor/operations/COM_ConvertValueToColourProg.cpp b/source/blender/compositor/operations/COM_ConvertValueToColorProg.cpp index a29a381938f..100a4931d69 100644 --- a/source/blender/compositor/operations/COM_ConvertValueToColourProg.cpp +++ b/source/blender/compositor/operations/COM_ConvertValueToColorProg.cpp @@ -20,20 +20,20 @@ * Monique Dewanchand */ -#include "COM_ConvertValueToColourProg.h" +#include "COM_ConvertValueToColorProg.h" -ConvertValueToColourProg::ConvertValueToColourProg() : NodeOperation() +ConvertValueToColorProg::ConvertValueToColorProg() : NodeOperation() { this->addInputSocket(COM_DT_VALUE); this->addOutputSocket(COM_DT_COLOR); this->m_inputProgram = NULL; } -void ConvertValueToColourProg::initExecution() +void ConvertValueToColorProg::initExecution() { this->m_inputProgram = this->getInputSocketReader(0); } -void ConvertValueToColourProg::executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) +void ConvertValueToColorProg::executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) { float inputValue[4]; this->m_inputProgram->read(inputValue, x, y, sampler, inputBuffers); @@ -43,7 +43,7 @@ void ConvertValueToColourProg::executePixel(float *color, float x, float y, Pixe color[3] = 1.0f; } -void ConvertValueToColourProg::deinitExecution() +void ConvertValueToColorProg::deinitExecution() { this->m_inputProgram = NULL; } diff --git a/source/blender/compositor/operations/COM_ConvertValueToColourProg.h b/source/blender/compositor/operations/COM_ConvertValueToColorProg.h index 69ce7e9afea..d59964dd400 100644 --- a/source/blender/compositor/operations/COM_ConvertValueToColourProg.h +++ b/source/blender/compositor/operations/COM_ConvertValueToColorProg.h @@ -20,19 +20,19 @@ * Monique Dewanchand */ -#ifndef _COM_ConvertValueToColourProg_h -#define _COM_ConvertValueToColourProg_h +#ifndef _COM_ConvertValueToColorProg_h +#define _COM_ConvertValueToColorProg_h #include "COM_NodeOperation.h" -class ConvertValueToColourProg : public NodeOperation { +class ConvertValueToColorProg : public NodeOperation { private: /** * Cached reference to the inputProgram */ SocketReader *m_inputProgram; public: - ConvertValueToColourProg(); + ConvertValueToColorProg(); /** * the inner loop of this program diff --git a/source/blender/compositor/operations/COM_ConvertValueToVectorOperation.h b/source/blender/compositor/operations/COM_ConvertValueToVectorOperation.h index 781b31f7fce..0e79c1ff3df 100644 --- a/source/blender/compositor/operations/COM_ConvertValueToVectorOperation.h +++ b/source/blender/compositor/operations/COM_ConvertValueToVectorOperation.h @@ -26,8 +26,8 @@ /** - * this program converts an input colour to an output value. - * it assumes we are in sRGB colour space. + * this program converts an input color to an output value. + * it assumes we are in sRGB color space. */ class ConvertValueToVectorOperation : public NodeOperation { private: diff --git a/source/blender/compositor/operations/COM_ConvertVectorToColorOperation.h b/source/blender/compositor/operations/COM_ConvertVectorToColorOperation.h index 2f1173ba4e8..8225d03d58e 100644 --- a/source/blender/compositor/operations/COM_ConvertVectorToColorOperation.h +++ b/source/blender/compositor/operations/COM_ConvertVectorToColorOperation.h @@ -26,8 +26,8 @@ /** - * this program converts an input colour to an output value. - * it assumes we are in sRGB colour space. + * this program converts an input color to an output value. + * it assumes we are in sRGB color space. */ class ConvertVectorToColorOperation : public NodeOperation { private: diff --git a/source/blender/compositor/operations/COM_ConvertVectorToValueOperation.h b/source/blender/compositor/operations/COM_ConvertVectorToValueOperation.h index 8770992c69c..a7981e8dc59 100644 --- a/source/blender/compositor/operations/COM_ConvertVectorToValueOperation.h +++ b/source/blender/compositor/operations/COM_ConvertVectorToValueOperation.h @@ -26,8 +26,8 @@ /** - * this program converts an input colour to an output value. - * it assumes we are in sRGB colour space. + * this program converts an input color to an output value. + * it assumes we are in sRGB color space. */ class ConvertVectorToValueOperation : public NodeOperation { private: diff --git a/source/blender/compositor/operations/COM_ConvertYCCToRGBOperation.h b/source/blender/compositor/operations/COM_ConvertYCCToRGBOperation.h index a595fc19bc7..e23dfd8a985 100644 --- a/source/blender/compositor/operations/COM_ConvertYCCToRGBOperation.h +++ b/source/blender/compositor/operations/COM_ConvertYCCToRGBOperation.h @@ -25,8 +25,8 @@ /** - * this program converts an input colour to an output value. - * it assumes we are in sRGB colour space. + * this program converts an input color to an output value. + * it assumes we are in sRGB color space. */ class ConvertYCCToRGBOperation : public NodeOperation { private: diff --git a/source/blender/compositor/operations/COM_ConvertYUVToRGBOperation.h b/source/blender/compositor/operations/COM_ConvertYUVToRGBOperation.h index e89f1500d69..3368e0a24df 100644 --- a/source/blender/compositor/operations/COM_ConvertYUVToRGBOperation.h +++ b/source/blender/compositor/operations/COM_ConvertYUVToRGBOperation.h @@ -25,8 +25,8 @@ /** - * this program converts an input colour to an output value. - * it assumes we are in sRGB colour space. + * this program converts an input color to an output value. + * it assumes we are in sRGB color space. */ class ConvertYUVToRGBOperation : public NodeOperation { private: diff --git a/source/blender/compositor/operations/COM_DifferenceMatteOperation.cpp b/source/blender/compositor/operations/COM_DifferenceMatteOperation.cpp index 75f909e2198..3c4bdfe8e5b 100644 --- a/source/blender/compositor/operations/COM_DifferenceMatteOperation.cpp +++ b/source/blender/compositor/operations/COM_DifferenceMatteOperation.cpp @@ -49,7 +49,7 @@ void DifferenceMatteOperation::executePixel(float *outputValue, float x, float y float inColor1[4]; float inColor2[4]; - const float tolerence = this->m_settings->t1; + const float tolerance = this->m_settings->t1; const float falloff = this->m_settings->t2; float difference; float alpha; @@ -65,12 +65,12 @@ void DifferenceMatteOperation::executePixel(float *outputValue, float x, float y difference = difference / 3.0f; /*make 100% transparent*/ - if (difference < tolerence) { + if (difference < tolerance) { outputValue[0] = 0.0f; } /*in the falloff region, make partially transparent */ - else if (difference < falloff + tolerence) { - difference = difference - tolerence; + else if (difference < falloff + tolerance) { + difference = difference - tolerance; alpha = difference / falloff; /*only change if more transparent than before */ if (alpha < inColor1[3]) { diff --git a/source/blender/compositor/operations/COM_DifferenceMatteOperation.h b/source/blender/compositor/operations/COM_DifferenceMatteOperation.h index 48eb2626f02..c35550560e1 100644 --- a/source/blender/compositor/operations/COM_DifferenceMatteOperation.h +++ b/source/blender/compositor/operations/COM_DifferenceMatteOperation.h @@ -26,8 +26,8 @@ /** - * this program converts an input colour to an output value. - * it assumes we are in sRGB colour space. + * this program converts an input color to an output value. + * it assumes we are in sRGB color space. */ class DifferenceMatteOperation : public NodeOperation { private: diff --git a/source/blender/compositor/operations/COM_DistanceMatteOperation.cpp b/source/blender/compositor/operations/COM_DistanceMatteOperation.cpp index 19cca3d25bb..5bdc616fed7 100644 --- a/source/blender/compositor/operations/COM_DistanceMatteOperation.cpp +++ b/source/blender/compositor/operations/COM_DistanceMatteOperation.cpp @@ -49,7 +49,7 @@ void DistanceMatteOperation::executePixel(float *outputValue, float x, float y, float inKey[4]; float inImage[4]; - const float tolerence = this->m_settings->t1; + const float tolerance = this->m_settings->t1; const float falloff = this->m_settings->t2; float distance; @@ -67,12 +67,12 @@ void DistanceMatteOperation::executePixel(float *outputValue, float x, float y, */ /*make 100% transparent */ - if (distance < tolerence) { + if (distance < tolerance) { outputValue[0] = 0.f; } /*in the falloff region, make partially transparent */ - else if (distance < falloff + tolerence) { - distance = distance - tolerence; + else if (distance < falloff + tolerance) { + distance = distance - tolerance; alpha = distance / falloff; /*only change if more transparent than before */ if (alpha < inImage[3]) { diff --git a/source/blender/compositor/operations/COM_DistanceMatteOperation.h b/source/blender/compositor/operations/COM_DistanceMatteOperation.h index 51e139d179e..267aa1fca7a 100644 --- a/source/blender/compositor/operations/COM_DistanceMatteOperation.h +++ b/source/blender/compositor/operations/COM_DistanceMatteOperation.h @@ -25,8 +25,8 @@ /** - * this program converts an input colour to an output value. - * it assumes we are in sRGB colour space. + * this program converts an input color to an output value. + * it assumes we are in sRGB color space. */ class DistanceMatteOperation : public NodeOperation { private: diff --git a/source/blender/compositor/operations/COM_LuminanceMatteOperation.h b/source/blender/compositor/operations/COM_LuminanceMatteOperation.h index 7da56465cd8..041fd0d7ee9 100644 --- a/source/blender/compositor/operations/COM_LuminanceMatteOperation.h +++ b/source/blender/compositor/operations/COM_LuminanceMatteOperation.h @@ -25,8 +25,8 @@ /** - * this program converts an input colour to an output value. - * it assumes we are in sRGB colour space. + * this program converts an input color to an output value. + * it assumes we are in sRGB color space. */ class LuminanceMatteOperation : public NodeOperation { private: diff --git a/source/blender/compositor/operations/COM_MapValueOperation.h b/source/blender/compositor/operations/COM_MapValueOperation.h index 53157c39938..fb50d0fbe4d 100644 --- a/source/blender/compositor/operations/COM_MapValueOperation.h +++ b/source/blender/compositor/operations/COM_MapValueOperation.h @@ -26,8 +26,8 @@ #include "DNA_texture_types.h" /** - * this program converts an input colour to an output value. - * it assumes we are in sRGB colour space. + * this program converts an input color to an output value. + * it assumes we are in sRGB color space. */ class MapValueOperation : public NodeOperation { private: diff --git a/source/blender/compositor/operations/COM_MaskOperation.cpp b/source/blender/compositor/operations/COM_MaskOperation.cpp index aa16ecf5d09..2b45cd53fd5 100644 --- a/source/blender/compositor/operations/COM_MaskOperation.cpp +++ b/source/blender/compositor/operations/COM_MaskOperation.cpp @@ -49,11 +49,19 @@ MaskOperation::MaskOperation() : NodeOperation() void MaskOperation::initExecution() { initMutex(); + this->m_rasterizedMask = NULL; + this->m_maskLayers.first = this->m_maskLayers.last = NULL; + + if (this->m_mask) { + BKE_mask_layer_copy_list(&this->m_maskLayers, &this->m_mask->masklayers); + } } void MaskOperation::deinitExecution() { + BKE_mask_layer_free_list(&this->m_maskLayers); + if (this->m_rasterizedMask) { MEM_freeN(this->m_rasterizedMask); this->m_rasterizedMask = NULL; @@ -75,7 +83,10 @@ void *MaskOperation::initializeTileData(rcti *rect, MemoryBuffer **memoryBuffers float *buffer; buffer = (float *)MEM_callocN(sizeof(float) * width * height, "rasterized mask"); - BKE_mask_rasterize(this->m_mask, width, height, buffer, TRUE, this->m_do_smooth, this->m_do_feather); + + BKE_mask_rasterize_layers(&this->m_maskLayers, width, height, buffer, TRUE, + this->m_do_smooth, this->m_do_feather); + if (this->m_do_smooth) { PLX_antialias_buffer(buffer, width, height); } diff --git a/source/blender/compositor/operations/COM_MaskOperation.h b/source/blender/compositor/operations/COM_MaskOperation.h index d50f5c619bb..df1cad3c0f6 100644 --- a/source/blender/compositor/operations/COM_MaskOperation.h +++ b/source/blender/compositor/operations/COM_MaskOperation.h @@ -43,6 +43,7 @@ protected: bool m_do_smooth; bool m_do_feather; float *m_rasterizedMask; + ListBase m_maskLayers; /** * Determine the output resolution. The resolution is retrieved from the Renderer diff --git a/source/blender/compositor/operations/COM_MathBaseOperation.h b/source/blender/compositor/operations/COM_MathBaseOperation.h index bf77223e26f..be06537cbf0 100644 --- a/source/blender/compositor/operations/COM_MathBaseOperation.h +++ b/source/blender/compositor/operations/COM_MathBaseOperation.h @@ -26,8 +26,8 @@ /** - * this program converts an input colour to an output value. - * it assumes we are in sRGB colour space. + * this program converts an input color to an output value. + * it assumes we are in sRGB color space. */ class MathBaseOperation : public NodeOperation { protected: diff --git a/source/blender/compositor/operations/COM_MixAddOperation.h b/source/blender/compositor/operations/COM_MixAddOperation.h index 7b03802cf7e..c5eaf0a4d77 100644 --- a/source/blender/compositor/operations/COM_MixAddOperation.h +++ b/source/blender/compositor/operations/COM_MixAddOperation.h @@ -26,8 +26,8 @@ /** - * this program converts an input colour to an output value. - * it assumes we are in sRGB colour space. + * this program converts an input color to an output value. + * it assumes we are in sRGB color space. */ class MixAddOperation : public MixBaseOperation { public: diff --git a/source/blender/compositor/operations/COM_MixBaseOperation.h b/source/blender/compositor/operations/COM_MixBaseOperation.h index 8e9bb283533..268d4832243 100644 --- a/source/blender/compositor/operations/COM_MixBaseOperation.h +++ b/source/blender/compositor/operations/COM_MixBaseOperation.h @@ -26,8 +26,8 @@ /** - * this program converts an input colour to an output value. - * it assumes we are in sRGB colour space. + * this program converts an input color to an output value. + * it assumes we are in sRGB color space. */ class MixBaseOperation : public NodeOperation { protected: diff --git a/source/blender/compositor/operations/COM_MixBlendOperation.h b/source/blender/compositor/operations/COM_MixBlendOperation.h index b906134f5cb..16ad635bebd 100644 --- a/source/blender/compositor/operations/COM_MixBlendOperation.h +++ b/source/blender/compositor/operations/COM_MixBlendOperation.h @@ -26,8 +26,8 @@ /** - * this program converts an input colour to an output value. - * it assumes we are in sRGB colour space. + * this program converts an input color to an output value. + * it assumes we are in sRGB color space. */ class MixBlendOperation : public MixBaseOperation { public: diff --git a/source/blender/compositor/operations/COM_MixBurnOperation.h b/source/blender/compositor/operations/COM_MixBurnOperation.h index af09772edde..7412f651ab3 100644 --- a/source/blender/compositor/operations/COM_MixBurnOperation.h +++ b/source/blender/compositor/operations/COM_MixBurnOperation.h @@ -26,8 +26,8 @@ /** - * this program converts an input colour to an output value. - * it assumes we are in sRGB colour space. + * this program converts an input color to an output value. + * it assumes we are in sRGB color space. */ class MixBurnOperation : public MixBaseOperation { public: diff --git a/source/blender/compositor/operations/COM_MixColorOperation.h b/source/blender/compositor/operations/COM_MixColorOperation.h index 9b0d93f934d..028ff517132 100644 --- a/source/blender/compositor/operations/COM_MixColorOperation.h +++ b/source/blender/compositor/operations/COM_MixColorOperation.h @@ -26,8 +26,8 @@ /** - * this program converts an input colour to an output value. - * it assumes we are in sRGB colour space. + * this program converts an input color to an output value. + * it assumes we are in sRGB color space. */ class MixColorOperation : public MixBaseOperation { public: diff --git a/source/blender/compositor/operations/COM_MixDarkenOperation.h b/source/blender/compositor/operations/COM_MixDarkenOperation.h index 69fb4450458..337fa1a7024 100644 --- a/source/blender/compositor/operations/COM_MixDarkenOperation.h +++ b/source/blender/compositor/operations/COM_MixDarkenOperation.h @@ -26,8 +26,8 @@ /** - * this program converts an input colour to an output value. - * it assumes we are in sRGB colour space. + * this program converts an input color to an output value. + * it assumes we are in sRGB color space. */ class MixDarkenOperation : public MixBaseOperation { public: diff --git a/source/blender/compositor/operations/COM_MixDifferenceOperation.h b/source/blender/compositor/operations/COM_MixDifferenceOperation.h index c71b22214cc..503fbb691d3 100644 --- a/source/blender/compositor/operations/COM_MixDifferenceOperation.h +++ b/source/blender/compositor/operations/COM_MixDifferenceOperation.h @@ -26,8 +26,8 @@ /** - * this program converts an input colour to an output value. - * it assumes we are in sRGB colour space. + * this program converts an input color to an output value. + * it assumes we are in sRGB color space. */ class MixDifferenceOperation : public MixBaseOperation { public: diff --git a/source/blender/compositor/operations/COM_MixDivideOperation.h b/source/blender/compositor/operations/COM_MixDivideOperation.h index 375e7129e8b..db60a39f93f 100644 --- a/source/blender/compositor/operations/COM_MixDivideOperation.h +++ b/source/blender/compositor/operations/COM_MixDivideOperation.h @@ -26,8 +26,8 @@ /** - * this program converts an input colour to an output value. - * it assumes we are in sRGB colour space. + * this program converts an input color to an output value. + * it assumes we are in sRGB color space. */ class MixDivideOperation : public MixBaseOperation { public: diff --git a/source/blender/compositor/operations/COM_MixDodgeOperation.h b/source/blender/compositor/operations/COM_MixDodgeOperation.h index a4adf6fde47..32aa8593657 100644 --- a/source/blender/compositor/operations/COM_MixDodgeOperation.h +++ b/source/blender/compositor/operations/COM_MixDodgeOperation.h @@ -26,8 +26,8 @@ /** - * this program converts an input colour to an output value. - * it assumes we are in sRGB colour space. + * this program converts an input color to an output value. + * it assumes we are in sRGB color space. */ class MixDodgeOperation : public MixBaseOperation { public: diff --git a/source/blender/compositor/operations/COM_MixGlareOperation.h b/source/blender/compositor/operations/COM_MixGlareOperation.h index 1a025eb3edd..1c715d7414b 100644 --- a/source/blender/compositor/operations/COM_MixGlareOperation.h +++ b/source/blender/compositor/operations/COM_MixGlareOperation.h @@ -26,8 +26,8 @@ /** - * this program converts an input colour to an output value. - * it assumes we are in sRGB colour space. + * this program converts an input color to an output value. + * it assumes we are in sRGB color space. */ class MixGlareOperation : public MixBaseOperation { public: diff --git a/source/blender/compositor/operations/COM_MixHueOperation.h b/source/blender/compositor/operations/COM_MixHueOperation.h index 56310e253c0..ff1ef369440 100644 --- a/source/blender/compositor/operations/COM_MixHueOperation.h +++ b/source/blender/compositor/operations/COM_MixHueOperation.h @@ -26,8 +26,8 @@ /** - * this program converts an input colour to an output value. - * it assumes we are in sRGB colour space. + * this program converts an input color to an output value. + * it assumes we are in sRGB color space. */ class MixHueOperation : public MixBaseOperation { public: diff --git a/source/blender/compositor/operations/COM_MixLightenOperation.h b/source/blender/compositor/operations/COM_MixLightenOperation.h index bb251a44653..dd51215b26a 100644 --- a/source/blender/compositor/operations/COM_MixLightenOperation.h +++ b/source/blender/compositor/operations/COM_MixLightenOperation.h @@ -26,8 +26,8 @@ /** - * this program converts an input colour to an output value. - * it assumes we are in sRGB colour space. + * this program converts an input color to an output value. + * it assumes we are in sRGB color space. */ class MixLightenOperation : public MixBaseOperation { public: diff --git a/source/blender/compositor/operations/COM_MixLinearLightOperation.h b/source/blender/compositor/operations/COM_MixLinearLightOperation.h index 39d5b6495d1..e96e2b7eaf7 100644 --- a/source/blender/compositor/operations/COM_MixLinearLightOperation.h +++ b/source/blender/compositor/operations/COM_MixLinearLightOperation.h @@ -26,8 +26,8 @@ /** - * this program converts an input colour to an output value. - * it assumes we are in sRGB colour space. + * this program converts an input color to an output value. + * it assumes we are in sRGB color space. */ class MixLinearLightOperation : public MixBaseOperation { public: diff --git a/source/blender/compositor/operations/COM_MixMultiplyOperation.h b/source/blender/compositor/operations/COM_MixMultiplyOperation.h index 2c12854bfa6..4c89a8f2957 100644 --- a/source/blender/compositor/operations/COM_MixMultiplyOperation.h +++ b/source/blender/compositor/operations/COM_MixMultiplyOperation.h @@ -26,8 +26,8 @@ /** - * this program converts an input colour to an output value. - * it assumes we are in sRGB colour space. + * this program converts an input color to an output value. + * it assumes we are in sRGB color space. */ class MixMultiplyOperation : public MixBaseOperation { public: diff --git a/source/blender/compositor/operations/COM_MixOverlayOperation.h b/source/blender/compositor/operations/COM_MixOverlayOperation.h index 48d1d10a697..7de955b9f4f 100644 --- a/source/blender/compositor/operations/COM_MixOverlayOperation.h +++ b/source/blender/compositor/operations/COM_MixOverlayOperation.h @@ -26,8 +26,8 @@ /** - * this program converts an input colour to an output value. - * it assumes we are in sRGB colour space. + * this program converts an input color to an output value. + * it assumes we are in sRGB color space. */ class MixOverlayOperation : public MixBaseOperation { public: diff --git a/source/blender/compositor/operations/COM_MixSaturationOperation.h b/source/blender/compositor/operations/COM_MixSaturationOperation.h index ccb95e2f00f..241009e2645 100644 --- a/source/blender/compositor/operations/COM_MixSaturationOperation.h +++ b/source/blender/compositor/operations/COM_MixSaturationOperation.h @@ -26,8 +26,8 @@ /** - * this program converts an input colour to an output value. - * it assumes we are in sRGB colour space. + * this program converts an input color to an output value. + * it assumes we are in sRGB color space. */ class MixSaturationOperation : public MixBaseOperation { public: diff --git a/source/blender/compositor/operations/COM_MixScreenOperation.h b/source/blender/compositor/operations/COM_MixScreenOperation.h index 6b9fa302325..4d0c1fded3d 100644 --- a/source/blender/compositor/operations/COM_MixScreenOperation.h +++ b/source/blender/compositor/operations/COM_MixScreenOperation.h @@ -26,8 +26,8 @@ /** - * this program converts an input colour to an output value. - * it assumes we are in sRGB colour space. + * this program converts an input color to an output value. + * it assumes we are in sRGB color space. */ class MixScreenOperation : public MixBaseOperation { public: diff --git a/source/blender/compositor/operations/COM_MixSoftLightOperation.h b/source/blender/compositor/operations/COM_MixSoftLightOperation.h index 4189066de2c..bcb718027b2 100644 --- a/source/blender/compositor/operations/COM_MixSoftLightOperation.h +++ b/source/blender/compositor/operations/COM_MixSoftLightOperation.h @@ -26,8 +26,8 @@ /** - * this program converts an input colour to an output value. - * it assumes we are in sRGB colour space. + * this program converts an input color to an output value. + * it assumes we are in sRGB color space. */ class MixSoftLightOperation : public MixBaseOperation { public: diff --git a/source/blender/compositor/operations/COM_MixSubtractOperation.h b/source/blender/compositor/operations/COM_MixSubtractOperation.h index b820fb1e5e1..3c8112b0e36 100644 --- a/source/blender/compositor/operations/COM_MixSubtractOperation.h +++ b/source/blender/compositor/operations/COM_MixSubtractOperation.h @@ -26,8 +26,8 @@ /** - * this program converts an input colour to an output value. - * it assumes we are in sRGB colour space. + * this program converts an input color to an output value. + * it assumes we are in sRGB color space. */ class MixSubtractOperation : public MixBaseOperation { public: diff --git a/source/blender/compositor/operations/COM_MixValueOperation.h b/source/blender/compositor/operations/COM_MixValueOperation.h index d12a2d2b3d6..c0f3ce10f29 100644 --- a/source/blender/compositor/operations/COM_MixValueOperation.h +++ b/source/blender/compositor/operations/COM_MixValueOperation.h @@ -26,8 +26,8 @@ /** - * this program converts an input colour to an output value. - * it assumes we are in sRGB colour space. + * this program converts an input color to an output value. + * it assumes we are in sRGB color space. */ class MixValueOperation : public MixBaseOperation { public: diff --git a/source/blender/compositor/operations/COM_MovieClipAttributeOperation.h b/source/blender/compositor/operations/COM_MovieClipAttributeOperation.h index ba104d07572..c6422fbbfc2 100644 --- a/source/blender/compositor/operations/COM_MovieClipAttributeOperation.h +++ b/source/blender/compositor/operations/COM_MovieClipAttributeOperation.h @@ -32,8 +32,8 @@ typedef enum MovieClipAttribute { MCA_ANGLE } MovieClipAttribute; /** - * this program converts an input colour to an output value. - * it assumes we are in sRGB colour space. + * this program converts an input color to an output value. + * it assumes we are in sRGB color space. */ class MovieClipAttributeOperation : public NodeOperation { private: diff --git a/source/blender/compositor/operations/COM_OpenCLKernels.cl b/source/blender/compositor/operations/COM_OpenCLKernels.cl index 0f8e543de7f..ce197915360 100644 --- a/source/blender/compositor/operations/COM_OpenCLKernels.cl +++ b/source/blender/compositor/operations/COM_OpenCLKernels.cl @@ -51,6 +51,68 @@ __kernel void bokehBlurKernel(__read_only image2d_t boundingBox, __read_only ima write_imagef(output, coords, color); } +//KERNEL --- DEFOCUS /VARIABLESIZEBOKEHBLUR --- +__kernel void defocusKernel(__read_only image2d_t inputImage, __read_only image2d_t bokehImage, + __read_only image2d_t inputDepth, __read_only image2d_t inputSize, + __write_only image2d_t output, int2 offsetInput, int2 offsetOutput, + int step, int maxBlur, float threshold, int2 dimension, int2 offset) +{ + float4 color = {1.0f, 0.0f, 0.0f, 1.0f}; + int2 coords = {get_global_id(0), get_global_id(1)}; + coords += offset; + const int2 realCoordinate = coords + offsetOutput; + + float4 readColor; + float4 bokeh; + float tempSize; + float tempDepth; + float4 multiplier_accum = {1.0f, 1.0f, 1.0f, 1.0f}; + float4 color_accum; + + int minx = max(realCoordinate.s0 - maxBlur, 0); + int miny = max(realCoordinate.s1 - maxBlur, 0); + int maxx = min(realCoordinate.s0 + maxBlur, dimension.s0); + int maxy = min(realCoordinate.s1 + maxBlur, dimension.s1); + + { + int2 inputCoordinate = realCoordinate - offsetInput; + float size = read_imagef(inputSize, SAMPLER_NEAREST, inputCoordinate).s0; + float depth = read_imagef(inputDepth, SAMPLER_NEAREST, inputCoordinate).s0 + threshold; + color_accum = read_imagef(inputImage, SAMPLER_NEAREST, inputCoordinate); + + for (int ny = miny; ny < maxy; ny += step) { + for (int nx = minx; nx < maxx; nx += step) { + if (nx >= 0 && nx < dimension.s0 && ny >= 0 && ny < dimension.s1) { + inputCoordinate.s0 = nx - offsetInput.s0; + inputCoordinate.s1 = ny - offsetInput.s1; + tempDepth = read_imagef(inputDepth, SAMPLER_NEAREST, inputCoordinate).s0; + if (tempDepth < depth) { + tempSize = read_imagef(inputSize, SAMPLER_NEAREST, inputCoordinate).s0; + + if ((size > threshold && tempSize > threshold) || tempSize <= threshold) { + float dx = nx - realCoordinate.s0; + float dy = ny - realCoordinate.s1; + if (dx != 0 || dy != 0) { + if (tempSize >= fabs(dx) && tempSize >= fabs(dy)) { + float2 uv = { 256.0f + dx * 256.0f / tempSize, 256.0f + dy * 256.0f / tempSize}; + bokeh = read_imagef(bokehImage, SAMPLER_NEAREST, uv); + readColor = read_imagef(inputImage, SAMPLER_NEAREST, inputCoordinate); + color_accum += bokeh*readColor; + multiplier_accum += bokeh; + } + } + } + } + } + } + } + } + + color = color_accum * (1.0f / multiplier_accum); + write_imagef(output, coords, color); +} + + // KERNEL --- DILATE --- __kernel void dilateKernel(__read_only image2d_t inputImage, __write_only image2d_t output, int2 offsetInput, int2 offsetOutput, int scope, int distanceSquared, int2 dimension, diff --git a/source/blender/compositor/operations/COM_OpenCLKernels.cl.h b/source/blender/compositor/operations/COM_OpenCLKernels.cl.h index e064b7511cb..ca66ab85802 100644 --- a/source/blender/compositor/operations/COM_OpenCLKernels.cl.h +++ b/source/blender/compositor/operations/COM_OpenCLKernels.cl.h @@ -16,7 +16,7 @@ const char * clkernelstoh_COM_OpenCLKernels_cl = "/// This file contains all ope " coords += offset;\n" \ " float tempBoundingBox;\n" \ " float4 color = {0.0f,0.0f,0.0f,0.0f};\n" \ -" float4 multiplier = {0.0f,0.0f,0.0f,0.0f};\n" \ +" float4 multiplyer = {0.0f,0.0f,0.0f,0.0f};\n" \ " float4 bokeh;\n" \ " const float radius2 = radius*2.0f;\n" \ " const int2 realCoordinate = coords + offsetOutput;\n" \ @@ -40,10 +40,10 @@ const char * clkernelstoh_COM_OpenCLKernels_cl = "/// This file contains all ope " uv.x = ((realCoordinate.x-nx)/radius2)*bokehImageDim.x+bokehImageCenter.x;\n" \ " bokeh = read_imagef(bokehImage, SAMPLER_NEAREST, uv);\n" \ " color += bokeh * read_imagef(inputImage, SAMPLER_NEAREST, inputXy);\n" \ -" multiplier += bokeh;\n" \ +" multiplyer += bokeh;\n" \ " }\n" \ " }\n" \ -" color /= multiplier;\n" \ +" color /= multiplyer;\n" \ "\n" \ " } else {\n" \ " int2 imageCoordinates = realCoordinate - offsetInput;\n" \ @@ -53,6 +53,68 @@ const char * clkernelstoh_COM_OpenCLKernels_cl = "/// This file contains all ope " write_imagef(output, coords, color);\n" \ "}\n" \ "\n" \ +"//KERNEL --- DEFOCUS /VARIABLESIZEBOKEHBLUR ---\n" \ +"__kernel void defocusKernel(__read_only image2d_t inputImage, __read_only image2d_t bokehImage,\n" \ +" __read_only image2d_t inputDepth, __read_only image2d_t inputSize,\n" \ +" __write_only image2d_t output, int2 offsetInput, int2 offsetOutput,\n" \ +" int step, int maxBlur, float threshold, int2 dimension, int2 offset)\n" \ +"{\n" \ +" float4 color = {1.0f, 0.0f, 0.0f, 1.0f};\n" \ +" int2 coords = {get_global_id(0), get_global_id(1)};\n" \ +" coords += offset;\n" \ +" const int2 realCoordinate = coords + offsetOutput;\n" \ +"\n" \ +" float4 readColor;\n" \ +" float4 bokeh;\n" \ +" float tempSize;\n" \ +" float tempDepth;\n" \ +" float4 multiplier_accum = {1.0f, 1.0f, 1.0f, 1.0f};\n" \ +" float4 color_accum;\n" \ +"\n" \ +" int minx = max(realCoordinate.s0 - maxBlur, 0);\n" \ +" int miny = max(realCoordinate.s1 - maxBlur, 0);\n" \ +" int maxx = min(realCoordinate.s0 + maxBlur, dimension.s0);\n" \ +" int maxy = min(realCoordinate.s1 + maxBlur, dimension.s1);\n" \ +"\n" \ +" {\n" \ +" int2 inputCoordinate = realCoordinate - offsetInput;\n" \ +" float size = read_imagef(inputSize, SAMPLER_NEAREST, inputCoordinate).s0;\n" \ +" float depth = read_imagef(inputDepth, SAMPLER_NEAREST, inputCoordinate).s0 + threshold;\n" \ +" color_accum = read_imagef(inputImage, SAMPLER_NEAREST, inputCoordinate);\n" \ +"\n" \ +" for (int ny = miny; ny < maxy; ny += step) {\n" \ +" for (int nx = minx; nx < maxx; nx += step) {\n" \ +" if (nx >= 0 && nx < dimension.s0 && ny >= 0 && ny < dimension.s1) {\n" \ +" inputCoordinate.s0 = nx - offsetInput.s0;\n" \ +" inputCoordinate.s1 = ny - offsetInput.s1;\n" \ +" tempDepth = read_imagef(inputDepth, SAMPLER_NEAREST, inputCoordinate).s0;\n" \ +" if (tempDepth < depth) {\n" \ +" tempSize = read_imagef(inputSize, SAMPLER_NEAREST, inputCoordinate).s0;\n" \ +"\n" \ +" if ((size > threshold && tempSize > threshold) || tempSize <= threshold) {\n" \ +" float dx = nx - realCoordinate.s0;\n" \ +" float dy = ny - realCoordinate.s1;\n" \ +" if (dx != 0 || dy != 0) {\n" \ +" if (tempSize >= fabs(dx) && tempSize >= fabs(dy)) {\n" \ +" float2 uv = { 256.0f + dx * 256.0f / tempSize, 256.0f + dy * 256.0f / tempSize};\n" \ +" bokeh = read_imagef(bokehImage, SAMPLER_NEAREST, uv);\n" \ +" readColor = read_imagef(inputImage, SAMPLER_NEAREST, inputCoordinate);\n" \ +" color_accum += bokeh*readColor;\n" \ +" multiplier_accum += bokeh;\n" \ +" }\n" \ +" }\n" \ +" }\n" \ +" }\n" \ +" }\n" \ +" }\n" \ +" }\n" \ +" }\n" \ +"\n" \ +" color = color_accum * (1.0f / multiplier_accum);\n" \ +" write_imagef(output, coords, color);\n" \ +"}\n" \ +"\n" \ +"\n" \ "// KERNEL --- DILATE ---\n" \ "__kernel void dilateKernel(__read_only image2d_t inputImage, __write_only image2d_t output,\n" \ " int2 offsetInput, int2 offsetOutput, int scope, int distanceSquared, int2 dimension,\n" \ @@ -70,9 +132,9 @@ const char * clkernelstoh_COM_OpenCLKernels_cl = "/// This file contains all ope " int2 inputXy;\n" \ "\n" \ " for (ny = minXY.y, inputXy.y = ny - offsetInput.y ; ny < maxXY.y ; ny ++, inputXy.y++) {\n" \ +" const float deltaY = (realCoordinate.y - ny);\n" \ " for (nx = minXY.x, inputXy.x = nx - offsetInput.x; nx < maxXY.x ; nx ++, inputXy.x++) {\n" \ " const float deltaX = (realCoordinate.x - nx);\n" \ -" const float deltaY = (realCoordinate.y - ny);\n" \ " const float measuredDistance = deltaX*deltaX+deltaY*deltaY;\n" \ " if (measuredDistance <= distanceSquared) {\n" \ " value = max(value, read_imagef(inputImage, SAMPLER_NEAREST, inputXy).s0);\n" \ diff --git a/source/blender/compositor/operations/COM_ProjectorLensDistortionOperation.cpp b/source/blender/compositor/operations/COM_ProjectorLensDistortionOperation.cpp index 74145c52a5d..12674153bc8 100644 --- a/source/blender/compositor/operations/COM_ProjectorLensDistortionOperation.cpp +++ b/source/blender/compositor/operations/COM_ProjectorLensDistortionOperation.cpp @@ -79,10 +79,10 @@ bool ProjectorLensDistortionOperation::determineDependingAreaOfInterest(rcti *in newInput.xmin = input->xmin - this->m_kr2 - 2; newInput.xmax = input->xmax + this->m_kr2 + 2; } else { - newInput.xmin = input->xmin-7; //(0.25f*20*1)+2 == worse case dispersion + newInput.xmin = input->xmin - 7; //(0.25f*20*1)+2 == worse case dispersion newInput.ymin = input->ymin; newInput.ymax = input->ymax; - newInput.xmax = input->xmax+7; //(0.25f*20*1)+2 == worse case dispersion + newInput.xmax = input->xmax + 7; //(0.25f*20*1)+2 == worse case dispersion } return NodeOperation::determineDependingAreaOfInterest(&newInput, readOperation, output); } diff --git a/source/blender/compositor/operations/COM_RenderLayersImageProg.cpp b/source/blender/compositor/operations/COM_RenderLayersImageProg.cpp index 14c3d652c42..f21585844ff 100644 --- a/source/blender/compositor/operations/COM_RenderLayersImageProg.cpp +++ b/source/blender/compositor/operations/COM_RenderLayersImageProg.cpp @@ -22,7 +22,7 @@ #include "COM_RenderLayersImageProg.h" -RenderLayersColourProg::RenderLayersColourProg() : RenderLayersBaseProg(SCE_PASS_COMBINED, 4) +RenderLayersColorProg::RenderLayersColorProg() : RenderLayersBaseProg(SCE_PASS_COMBINED, 4) { this->addOutputSocket(COM_DT_COLOR); } diff --git a/source/blender/compositor/operations/COM_RenderLayersImageProg.h b/source/blender/compositor/operations/COM_RenderLayersImageProg.h index b6ddac425cb..2d63bad235b 100644 --- a/source/blender/compositor/operations/COM_RenderLayersImageProg.h +++ b/source/blender/compositor/operations/COM_RenderLayersImageProg.h @@ -20,15 +20,15 @@ * Monique Dewanchand */ -#ifndef _COM_RenderLayersColourProg_h -#define _COM_RenderLayersColourProg_h +#ifndef _COM_RenderLayersColorProg_h +#define _COM_RenderLayersColorProg_h #include "COM_RenderLayersBaseProg.h" /// @TODO rename to image operation -class RenderLayersColourProg : public RenderLayersBaseProg { +class RenderLayersColorProg : public RenderLayersBaseProg { public: - RenderLayersColourProg(); + RenderLayersColorProg(); }; #endif diff --git a/source/blender/compositor/operations/COM_ScreenLensDistortionOperation.cpp b/source/blender/compositor/operations/COM_ScreenLensDistortionOperation.cpp index e3abf2aa70b..e70185f8fba 100644 --- a/source/blender/compositor/operations/COM_ScreenLensDistortionOperation.cpp +++ b/source/blender/compositor/operations/COM_ScreenLensDistortionOperation.cpp @@ -42,6 +42,10 @@ ScreenLensDistortionOperation::ScreenLensDistortionOperation() : NodeOperation() void ScreenLensDistortionOperation::initExecution() { this->m_inputProgram = this->getInputSocketReader(0); + this->initMutex(); + this->m_cx = 0.5f * (float)getWidth(); + this->m_cy = 0.5f * (float)getHeight(); + } void *ScreenLensDistortionOperation::initializeTileData(rcti *rect, MemoryBuffer **memoryBuffers) @@ -139,52 +143,192 @@ void ScreenLensDistortionOperation::executePixel(float *outputColor, int x, int void ScreenLensDistortionOperation::deinitExecution() { + this->deinitMutex(); this->m_inputProgram = NULL; } -void ScreenLensDistortionOperation::determineUV(float result[2], float x, float y) const +void ScreenLensDistortionOperation::determineUV(float result[4], float x, float y, float distortion, float dispersion) +{ + if (!this->m_valuesAvailable) { + updateVariables(distortion, dispersion); + } + determineUV(result, x, y); +} + +void ScreenLensDistortionOperation::determineUV(float result[4], float x, float y) const { + const float height = this->getHeight(); + const float width = this->getWidth(); + + float d, t, ln[6] = {0, 0, 0, 0, 0, 0}; const float v = this->m_sc * ((y + 0.5f) - this->m_cy) / this->m_cy; const float u = this->m_sc * ((x + 0.5f) - this->m_cx) / this->m_cx; - const float t = ABS(MIN3(this->m_kr, this->m_kg, this->m_kb) * 4); - float d = 1.f / (1.f + sqrtf(t)); - result[0] = (u * d + 0.5f) * getWidth() - 0.5f; - result[1] = (v * d + 0.5f) * getHeight() - 0.5f; + const float uv_dot = u * u + v * v; + + if ((t = 1.f - this->m_kr4 * uv_dot) >= 0.f) { + d = 1.f / (1.f + sqrtf(t)); + ln[0] = (u * d + 0.5f) * width - 0.5f, ln[1] = (v * d + 0.5f) * height - 0.5f; + } + if ((t = 1.f - this->m_kg4 * uv_dot) >= 0.f) { + d = 1.f / (1.f + sqrtf(t)); + ln[2] = (u * d + 0.5f) * width - 0.5f, ln[3] = (v * d + 0.5f) * height - 0.5f; + } + if ((t = 1.f - this->m_kb4 * uv_dot) >= 0.f) { + d = 1.f / (1.f + sqrtf(t)); + ln[4] = (u * d + 0.5f) * width - 0.5f, ln[5] = (v * d + 0.5f) * height - 0.5f; + } + + float jit = this->m_data->jit; + float z; + { + // RG + const int dx = ln[2] - ln[0], dy = ln[3] - ln[1]; + const float dsf = sqrtf((float)dx * dx + dy * dy) + 1.f; + const int ds = (int)(jit ? ((dsf < 4.f) ? 2.f : sqrtf(dsf)) : dsf); + const float sd = 1.f / (float)ds; + + z = ds; + const float tz = ((float)z + (1.0f)) * sd; + t = 1.0f - (this->m_kr4 + tz * this->m_drg) * uv_dot; + d = 1.0f / (1.f + sqrtf(t)); + const float nx = (u * d + 0.5f) * width - 0.5f; + const float ny = (v * d + 0.5f) * height - 0.5f; + result[0] = nx; + result[1] = ny; + } + { + // GB + const int dx = ln[4] - ln[2], dy = ln[5] - ln[3]; + const float dsf = sqrtf((float)dx * dx + dy * dy) + 1.f; + const int ds = (int)(jit ? ((dsf < 4.f) ? 2.f : sqrtf(dsf)) : dsf); + const float sd = 1.f / (float)ds; + + z = ds; + const float tz = ((float)z + (1.0f)) * sd; + t = 1.f - (this->m_kg4 + tz * this->m_dgb) * uv_dot; + d = 1.f / (1.f + sqrtf(t)); + const float nx = (u * d + 0.5f) * width - 0.5f; + const float ny = (v * d + 0.5f) * height - 0.5f; + result[2] = nx; + result[3] = ny; + } } bool ScreenLensDistortionOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output) { + rcti newInputValue; + newInputValue.xmin = 0; + newInputValue.ymin = 0; + newInputValue.xmax = 2; + newInputValue.ymax = 2; + + NodeOperation *operation = getInputOperation(1); + if (operation->determineDependingAreaOfInterest(&newInputValue, readOperation, output) ) { + return true; + } + + operation = getInputOperation(2); + if (operation->determineDependingAreaOfInterest(&newInputValue, readOperation, output) ) { + return true; + } + +#define MARGIN 96 + +#define UPDATE_INPUT \ + newInput.xmin = MIN3(newInput.xmin, coords[0], coords[2]); \ + newInput.ymin = MIN3(newInput.ymin, coords[1], coords[3]); \ + newInput.xmax = MAX3(newInput.xmax, coords[0], coords[2]); \ + newInput.ymax = MAX3(newInput.ymax, coords[1], coords[3]); + rcti newInput; - newInput.xmin = 0; - newInput.ymin = 0; - newInput.ymax = this->m_inputProgram->getHeight(); - newInput.xmax = this->m_inputProgram->getWidth(); - return NodeOperation::determineDependingAreaOfInterest(&newInput, readOperation, output); + float margin; + float coords[4]; + if (m_valuesAvailable) { + determineUV(coords, input->xmin, input->ymin); + newInput.xmin = coords[0]; + newInput.ymin = coords[1]; + newInput.xmax = coords[0]; + newInput.ymax = coords[1]; + UPDATE_INPUT; + determineUV(coords, input->xmin, input->ymax); + UPDATE_INPUT; + determineUV(coords, input->xmax, input->ymax); + UPDATE_INPUT; + determineUV(coords, input->xmax, input->ymin); + UPDATE_INPUT; + margin = (ABS(this->m_distortion) + this->m_dispersion) * MARGIN + 2.0f; + } + else + { + determineUV(coords, input->xmin, input->ymin, 1.0f, 1.0f); + newInput.xmin = coords[0]; + newInput.ymin = coords[1]; + newInput.xmax = coords[0]; + newInput.ymax = coords[1]; + UPDATE_INPUT; + determineUV(coords, input->xmin, input->ymin, -1.0f, 1.0f); + UPDATE_INPUT; + + determineUV(coords, input->xmin, input->ymax, -1.0f, 1.0f); + UPDATE_INPUT; + determineUV(coords, input->xmin, input->ymax, 1.0f, 1.0f); + UPDATE_INPUT; + + determineUV(coords, input->xmax, input->ymax, -1.0f, 1.0f); + UPDATE_INPUT; + determineUV(coords, input->xmax, input->ymax, 1.0f, 1.0f); + UPDATE_INPUT; + + determineUV(coords, input->xmax, input->ymin, -1.0f, 1.0f); + UPDATE_INPUT; + determineUV(coords, input->xmax, input->ymin, 1.0f, 1.0f); + UPDATE_INPUT; + margin = MARGIN; + } + +#undef UPDATE_INPUT + newInput.xmin -= margin; + newInput.ymin -= margin; + newInput.xmax += margin; + newInput.ymax += margin; + + operation = getInputOperation(0); + if (operation->determineDependingAreaOfInterest(&newInput, readOperation, output) ) { + return true; + } + return false; +} + +void ScreenLensDistortionOperation::updateVariables(float distortion, float dispersion) +{ + this->m_kg = MAX2(MIN2(distortion, 1.f), -0.999f); + // smaller dispersion range for somewhat more control + const float d = 0.25f * MAX2(MIN2(dispersion, 1.f), 0.f); + this->m_kr = MAX2(MIN2((this->m_kg + d), 1.0f), -0.999f); + this->m_kb = MAX2(MIN2((this->m_kg - d), 1.0f), -0.999f); + this->m_maxk = MAX3(this->m_kr, this->m_kg, this->m_kb); + this->m_sc = (this->m_data->fit && (this->m_maxk > 0.f)) ? (1.f / (1.f + 2.f * this->m_maxk)) : (1.f / (1.f + this->m_maxk)); + this->m_drg = 4.f * (this->m_kg - this->m_kr); + this->m_dgb = 4.f * (this->m_kb - this->m_kg); + + this->m_kr4 = this->m_kr * 4.0f; + this->m_kg4 = this->m_kg * 4.0f; + this->m_kb4 = this->m_kb * 4.0f; } void ScreenLensDistortionOperation::updateDispersionAndDistortion(MemoryBuffer **inputBuffers) { + if (this->m_valuesAvailable) return; + + this->lockMutex(); if (!this->m_valuesAvailable) { float result[4]; this->getInputSocketReader(1)->read(result, 0, 0, COM_PS_NEAREST, inputBuffers); this->m_distortion = result[0]; this->getInputSocketReader(2)->read(result, 0, 0, COM_PS_NEAREST, inputBuffers); this->m_dispersion = result[0]; - this->m_kg = MAX2(MIN2(this->m_distortion, 1.f), -0.999f); - // smaller dispersion range for somewhat more control - const float d = 0.25f * MAX2(MIN2(this->m_dispersion, 1.f), 0.f); - this->m_kr = MAX2(MIN2((this->m_kg + d), 1.0f), -0.999f); - this->m_kb = MAX2(MIN2((this->m_kg - d), 1.0f), -0.999f); - this->m_maxk = MAX3(this->m_kr, this->m_kg, this->m_kb); - this->m_sc = (this->m_data->fit && (this->m_maxk > 0.f)) ? (1.f / (1.f + 2.f * this->m_maxk)) : (1.f / (1.f + this->m_maxk)); - this->m_drg = 4.f * (this->m_kg - this->m_kr); - this->m_dgb = 4.f * (this->m_kb - this->m_kg); - - this->m_kr4 = this->m_kr * 4.0f; - this->m_kg4 = this->m_kg * 4.0f; - this->m_kb4 = this->m_kb * 4.0f; - this->m_cx = 0.5f * (float)getWidth(); - this->m_cy = 0.5f * (float)getHeight(); + updateVariables(this->m_distortion, this->m_dispersion); this->m_valuesAvailable = true; } + this->unlockMutex(); } diff --git a/source/blender/compositor/operations/COM_ScreenLensDistortionOperation.h b/source/blender/compositor/operations/COM_ScreenLensDistortionOperation.h index 7e4fda0f755..f80b938818c 100644 --- a/source/blender/compositor/operations/COM_ScreenLensDistortionOperation.h +++ b/source/blender/compositor/operations/COM_ScreenLensDistortionOperation.h @@ -66,9 +66,23 @@ public: bool determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output); + /** + * @brief Set the distortion and dispersion and precalc some values + * @param distortion + * @param dispersion + */ + void setDistortionAndDispersion(float distortion, float dispersion) { + this->m_distortion = distortion; + this->m_dispersion = dispersion; + updateVariables(distortion, dispersion); + this->m_valuesAvailable = true; + } + private: - void determineUV(float *result, float x, float y) const; + void determineUV(float result[4], float x, float y) const; + void determineUV(float result[4], float x, float y, float distortion, float dispersion); void updateDispersionAndDistortion(MemoryBuffer **inputBuffers); + void updateVariables(float distortion, float dispersion); }; #endif diff --git a/source/blender/compositor/operations/COM_SetAlphaOperation.h b/source/blender/compositor/operations/COM_SetAlphaOperation.h index 857bd08bfbf..21968c930e7 100644 --- a/source/blender/compositor/operations/COM_SetAlphaOperation.h +++ b/source/blender/compositor/operations/COM_SetAlphaOperation.h @@ -26,8 +26,8 @@ /** - * this program converts an input colour to an output value. - * it assumes we are in sRGB colour space. + * this program converts an input color to an output value. + * it assumes we are in sRGB color space. */ class SetAlphaOperation : public NodeOperation { private: diff --git a/source/blender/compositor/operations/COM_SetColorOperation.h b/source/blender/compositor/operations/COM_SetColorOperation.h index abfa2b9538a..a51311837ee 100644 --- a/source/blender/compositor/operations/COM_SetColorOperation.h +++ b/source/blender/compositor/operations/COM_SetColorOperation.h @@ -26,8 +26,8 @@ /** - * this program converts an input colour to an output value. - * it assumes we are in sRGB colour space. + * this program converts an input color to an output value. + * it assumes we are in sRGB color space. */ class SetColorOperation : public NodeOperation { private: diff --git a/source/blender/compositor/operations/COM_SetSamplerOperation.h b/source/blender/compositor/operations/COM_SetSamplerOperation.h index 24e0c5e2ef5..273eac159bc 100644 --- a/source/blender/compositor/operations/COM_SetSamplerOperation.h +++ b/source/blender/compositor/operations/COM_SetSamplerOperation.h @@ -26,8 +26,8 @@ /** - * this program converts an input colour to an output Sampler. - * it assumes we are in sRGB colour space. + * this program converts an input color to an output Sampler. + * it assumes we are in sRGB color space. */ class SetSamplerOperation : public NodeOperation { private: diff --git a/source/blender/compositor/operations/COM_SetValueOperation.h b/source/blender/compositor/operations/COM_SetValueOperation.h index dce0c3299ac..642940e03cd 100644 --- a/source/blender/compositor/operations/COM_SetValueOperation.h +++ b/source/blender/compositor/operations/COM_SetValueOperation.h @@ -26,8 +26,8 @@ /** - * this program converts an input colour to an output value. - * it assumes we are in sRGB colour space. + * this program converts an input color to an output value. + * it assumes we are in sRGB color space. */ class SetValueOperation : public NodeOperation { private: diff --git a/source/blender/compositor/operations/COM_SetVectorOperation.h b/source/blender/compositor/operations/COM_SetVectorOperation.h index dc2a05ceff4..d1b9fe25085 100644 --- a/source/blender/compositor/operations/COM_SetVectorOperation.h +++ b/source/blender/compositor/operations/COM_SetVectorOperation.h @@ -26,8 +26,8 @@ /** - * this program converts an input colour to an output value. - * it assumes we are in sRGB colour space. + * this program converts an input color to an output value. + * it assumes we are in sRGB color space. */ class SetVectorOperation : public NodeOperation { private: diff --git a/source/blender/compositor/operations/COM_VariableSizeBokehBlurOperation.cpp b/source/blender/compositor/operations/COM_VariableSizeBokehBlurOperation.cpp index 9eb004b3686..7ddcb78b61f 100644 --- a/source/blender/compositor/operations/COM_VariableSizeBokehBlurOperation.cpp +++ b/source/blender/compositor/operations/COM_VariableSizeBokehBlurOperation.cpp @@ -22,6 +22,7 @@ #include "COM_VariableSizeBokehBlurOperation.h" #include "BLI_math.h" +#include "COM_OpenCLDevice.h" extern "C" { #include "RE_pipeline.h" @@ -33,8 +34,12 @@ VariableSizeBokehBlurOperation::VariableSizeBokehBlurOperation() : NodeOperation this->addInputSocket(COM_DT_COLOR, COM_SC_NO_RESIZE); // do not resize the bokeh image. this->addInputSocket(COM_DT_VALUE); // radius this->addInputSocket(COM_DT_VALUE); // depth +#ifdef COM_DEFOCUS_SEARCH + this->addInputSocket(COM_DT_COLOR, COM_SC_NO_RESIZE); // inverse search radius optimization structure. +#endif this->addOutputSocket(COM_DT_COLOR); this->setComplex(true); + this->setOpenCL(true); this->m_inputProgram = NULL; this->m_inputBokehProgram = NULL; @@ -42,6 +47,9 @@ VariableSizeBokehBlurOperation::VariableSizeBokehBlurOperation() : NodeOperation this->m_inputDepthProgram = NULL; this->m_maxBlur = 32.0f; this->m_threshold = 1.0f; +#ifdef COM_DEFOCUS_SEARCH + this->m_inputSearchProgram = NULL; +#endif } @@ -51,6 +59,9 @@ void VariableSizeBokehBlurOperation::initExecution() this->m_inputBokehProgram = getInputSocketReader(1); this->m_inputSizeProgram = getInputSocketReader(2); this->m_inputDepthProgram = getInputSocketReader(3); +#ifdef COM_DEFOCUS_SEARCH + this->m_inputSearchProgram = getInputSocketReader(4); +#endif QualityStepHelper::initExecution(COM_QH_INCREASE); } @@ -63,10 +74,19 @@ void VariableSizeBokehBlurOperation::executePixel(float *color, int x, int y, Me float multiplier_accum[4] = {0.0f, 0.0f, 0.0f, 0.0f}; float color_accum[4] = {0.0f, 0.0f, 0.0f, 0.0f}; - int miny = y - this->m_maxBlur; - int maxy = y + this->m_maxBlur; - int minx = x - this->m_maxBlur; - int maxx = x + this->m_maxBlur; +#ifdef COM_DEFOCUS_SEARCH + float search[4]; + this->inputSearchProgram->read(search, x/InverseSearchRadiusOperation::DIVIDER, y / InverseSearchRadiusOperation::DIVIDER, inputBuffers, NULL); + int minx = search[0]; + int miny = search[1]; + int maxx = search[2]; + int maxy = search[3]; +#else + int minx = MAX2(x - this->m_maxBlur, 0.0f); + int miny = MAX2(y - this->m_maxBlur, 0.0f); + int maxx = MIN2(x + this->m_maxBlur, m_width); + int maxy = MIN2(y + this->m_maxBlur, m_height); +#endif { this->m_inputSizeProgram->read(tempSize, x, y, COM_PS_NEAREST, inputBuffers); this->m_inputDepthProgram->read(tempDepth, x, y, COM_PS_NEAREST, inputBuffers); @@ -80,9 +100,9 @@ void VariableSizeBokehBlurOperation::executePixel(float *color, int x, int y, Me for (int nx = minx; nx < maxx; nx += QualityStepHelper::getStep()) { if (nx >= 0 && nx < this->getWidth() && ny >= 0 && ny < getHeight()) { this->m_inputDepthProgram->read(tempDepth, nx, ny, COM_PS_NEAREST, inputBuffers); - this->m_inputSizeProgram->read(tempSize, nx, ny, COM_PS_NEAREST, inputBuffers); - float size = tempSize[0]; if (tempDepth[0] < centerDepth) { + this->m_inputSizeProgram->read(tempSize, nx, ny, COM_PS_NEAREST, inputBuffers); + float size = tempSize[0]; if ((sizeCenter > this->m_threshold && size > this->m_threshold) || size <= this->m_threshold) { float dx = nx - x; float dy = ny - y; @@ -110,11 +130,42 @@ void VariableSizeBokehBlurOperation::executePixel(float *color, int x, int y, Me } +static cl_kernel defocusKernel = 0; +void VariableSizeBokehBlurOperation::executeOpenCL(OpenCLDevice* device, + MemoryBuffer *outputMemoryBuffer, cl_mem clOutputBuffer, + MemoryBuffer **inputMemoryBuffers, list<cl_mem> *clMemToCleanUp, + list<cl_kernel> *clKernelsToCleanUp) +{ + if (!defocusKernel) { + defocusKernel = device->COM_clCreateKernel("defocusKernel", NULL); + } + cl_int step = this->getStep(); + cl_int maxBlur = this->m_maxBlur; + cl_float threshold = this->m_threshold; + + device->COM_clAttachMemoryBufferToKernelParameter(defocusKernel, 0, -1, clMemToCleanUp, inputMemoryBuffers, this->m_inputProgram); + device->COM_clAttachMemoryBufferToKernelParameter(defocusKernel, 1, -1, clMemToCleanUp, inputMemoryBuffers, this->m_inputBokehProgram); + device->COM_clAttachMemoryBufferToKernelParameter(defocusKernel, 2, 5, clMemToCleanUp, inputMemoryBuffers, this->m_inputDepthProgram); + device->COM_clAttachMemoryBufferToKernelParameter(defocusKernel, 3, -1, clMemToCleanUp, inputMemoryBuffers, this->m_inputSizeProgram); + device->COM_clAttachOutputMemoryBufferToKernelParameter(defocusKernel, 4, clOutputBuffer); + device->COM_clAttachMemoryBufferOffsetToKernelParameter(defocusKernel, 6, outputMemoryBuffer); + clSetKernelArg(defocusKernel, 7, sizeof(cl_int), &step); + clSetKernelArg(defocusKernel, 8, sizeof(cl_int), &maxBlur); + clSetKernelArg(defocusKernel, 9, sizeof(cl_float), &threshold); + device->COM_clAttachSizeToKernelParameter(defocusKernel, 10, this); + + device->COM_clEnqueueRange(defocusKernel, outputMemoryBuffer, 11, this); +} + void VariableSizeBokehBlurOperation::deinitExecution() { this->m_inputProgram = NULL; this->m_inputBokehProgram = NULL; this->m_inputSizeProgram = NULL; + this->m_inputDepthProgram = NULL; +#ifdef COM_DEFOCUS_SEARCH + this->m_inputSearchProgram = NULL; +#endif } bool VariableSizeBokehBlurOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output) @@ -130,6 +181,7 @@ bool VariableSizeBokehBlurOperation::determineDependingAreaOfInterest(rcti *inpu bokehInput.xmin = 0; bokehInput.ymax = 512; bokehInput.ymin = 0; + NodeOperation *operation = getInputOperation(2); if (operation->determineDependingAreaOfInterest(&newInput, readOperation, output) ) { @@ -143,9 +195,118 @@ bool VariableSizeBokehBlurOperation::determineDependingAreaOfInterest(rcti *inpu if (operation->determineDependingAreaOfInterest(&newInput, readOperation, output) ) { return true; } +#ifdef COM_DEFOCUS_SEARCH + rcti searchInput; + searchInput.xmax = (input->xmax / InverseSearchRadiusOperation::DIVIDER) + 1; + searchInput.xmin = (input->xmin / InverseSearchRadiusOperation::DIVIDER) - 1; + searchInput.ymax = (input->ymax / InverseSearchRadiusOperation::DIVIDER) + 1; + searchInput.ymin = (input->ymin / InverseSearchRadiusOperation::DIVIDER) - 1; + operation = getInputOperation(4); + if (operation->determineDependingAreaOfInterest(&searchInput, readOperation, output) ) { + return true; + } +#endif operation = getInputOperation(0); if (operation->determineDependingAreaOfInterest(&newInput, readOperation, output) ) { return true; } return false; } + +#ifdef COM_DEFOCUS_SEARCH +// InverseSearchRadiusOperation +InverseSearchRadiusOperation::InverseSearchRadiusOperation() : NodeOperation() +{ + this->addInputSocket(COM_DT_VALUE, COM_SC_NO_RESIZE); // radius + this->addInputSocket(COM_DT_VALUE, COM_SC_NO_RESIZE); // depth + this->addOutputSocket(COM_DT_COLOR); + this->setComplex(true); + this->inputRadius = NULL; + this->inputDepth = NULL; +} + +void InverseSearchRadiusOperation::initExecution() +{ + this->inputRadius = this->getInputSocketReader(0); + this->inputDepth = this->getInputSocketReader(1); +} + +void* InverseSearchRadiusOperation::initializeTileData(rcti *rect, MemoryBuffer **memoryBuffers) +{ + MemoryBuffer * data = new MemoryBuffer(NULL, rect); + int x, y; + float width = this->inputRadius->getWidth(); + float height = this->inputRadius->getHeight(); + + for (x = rect->xmin; x < rect->xmax ; x++) { + for (y = rect->ymin; y < rect->ymax ; y++) { + float[4] temp; + int rx = x * DIVIDER; + int ry = y * DIVIDER; + this->inputRadius->read(temp, rx, ry, memoryBuffers, NULL); + float centerRadius = temp[0]; + this->inputDepth->read(temp, rx, ry, memoryBuffers, NULL); + float centerDepth = temp[0]; + t[0] = MAX2(rx - this->maxBlur, 0.0f); + t[1] = MAX2(ry - this->maxBlur, 0.0f); + t[2] = MIN2(rx + this->maxBlur, width); + t[3] = MIN2(ry + this->maxBlur, height); + int minx = t[0]; + int miny = t[1]; + int maxx = t[2]; + int maxy = t[3]; + int sminx = rx; + int smaxx = rx; + int sminy = ry; + int smaxy = ry; + for (int nx = minx ; nx < maxx ; nx ++) { + for (int ny = miny ; ny < maxy ; ny ++) { + this->inputRadius->read(temp, nx, ny, memoryBuffers, NULL); + if (nx < rx && temp[0]) + + } + } + float t[4]; + data->writePixel(x, y, t); + } + } + return data; +} + +void InverseSearchRadiusOperation::executePixel(float *color, int x, int y, MemoryBuffer *inputBuffers[], void *data) +{ + MemoryBuffer *buffer = (MemoryBuffer*)data; + buffer->read(color, x, y); +} + +void InverseSearchRadiusOperation::deinitializeTileData(rcti *rect, MemoryBuffer **memoryBuffers, void *data) +{ + if (data) { + MemoryBuffer* mb = (MemoryBuffer*)data; + delete mb; + } +} + +void InverseSearchRadiusOperation::deinitExecution() +{ + this->inputRadius = NULL; + this->inputDepth = NULL; +} + +void InverseSearchRadiusOperation::determineResolution(unsigned int resolution[], unsigned int preferredResolution[]) +{ + NodeOperation::determineResolution(resolution, preferredResolution); + resolution[0] = resolution[0] / DIVIDER; + resolution[1] = resolution[1] / DIVIDER; +} + +bool InverseSearchRadiusOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output) +{ + rcti newRect; + newRect.ymin = input->ymin*DIVIDER; + newRect.ymax = input->ymax*DIVIDER; + newRect.xmin = input->xmin*DIVIDER; + newRect.xmax = input->xmax*DIVIDER; + return NodeOperation::determineDependingAreaOfInterest(&newRect, readOperation, output); +} +#endif diff --git a/source/blender/compositor/operations/COM_VariableSizeBokehBlurOperation.h b/source/blender/compositor/operations/COM_VariableSizeBokehBlurOperation.h index 8e59a43fcb1..8e5589fafec 100644 --- a/source/blender/compositor/operations/COM_VariableSizeBokehBlurOperation.h +++ b/source/blender/compositor/operations/COM_VariableSizeBokehBlurOperation.h @@ -25,6 +25,7 @@ #include "COM_NodeOperation.h" #include "COM_QualityStepHelper.h" + class VariableSizeBokehBlurOperation : public NodeOperation, public QualityStepHelper { private: int m_maxBlur; @@ -33,6 +34,9 @@ private: SocketReader *m_inputBokehProgram; SocketReader *m_inputSizeProgram; SocketReader *m_inputDepthProgram; +#ifdef COM_DEFOCUS_SEARCH + SocketReader *inputSearchProgram; +#endif public: VariableSizeBokehBlurOperation(); @@ -58,6 +62,44 @@ public: void setThreshold(float threshold) { this->m_threshold = threshold; } + void executeOpenCL(OpenCLDevice* device, MemoryBuffer *outputMemoryBuffer, cl_mem clOutputBuffer, MemoryBuffer **inputMemoryBuffers, list<cl_mem> *clMemToCleanUp, list<cl_kernel> *clKernelsToCleanUp); +}; + +#ifdef COM_DEFOCUS_SEARCH +class InverseSearchRadiusOperation : public NodeOperation { +private: + int maxBlur; + float threshold; + SocketReader *inputDepth; + SocketReader *inputRadius; +public: + static const int DIVIDER = 4; + + InverseSearchRadiusOperation(); + + /** + * the inner loop of this program + */ + void executePixel(float *color, int x, int y, MemoryBuffer * inputBuffers[], void *data); + + /** + * Initialize the execution + */ + void initExecution(); + void* initializeTileData(rcti *rect, MemoryBuffer **memoryBuffers); + void deinitializeTileData(rcti *rect, MemoryBuffer **memoryBuffers, void *data); + + /** + * Deinitialize the execution + */ + void deinitExecution(); + + bool determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output); + void determineResolution(unsigned int resolution[], unsigned int preferredResolution[]); + + void setMaxBlur(int maxRadius) { this->maxBlur = maxRadius; } + void setThreshold(float threshold) { this->threshold = threshold; } }; #endif +#endif diff --git a/source/blender/compositor/operations/COM_WriteBufferOperation.cpp b/source/blender/compositor/operations/COM_WriteBufferOperation.cpp index 7259db34134..8decb73615b 100644 --- a/source/blender/compositor/operations/COM_WriteBufferOperation.cpp +++ b/source/blender/compositor/operations/COM_WriteBufferOperation.cpp @@ -156,10 +156,8 @@ void WriteBufferOperation::executeOpenCLRegion(OpenCLDevice* device, rcti *rect, if (error != CL_SUCCESS) { printf("CLERROR[%d]: %s\n", error, clewErrorString(error)); } this->getMemoryProxy()->getBuffer()->copyContentFrom(outputBuffer); - - // STEP 4 - + // STEP 4 while (clMemToCleanUp->size() > 0) { cl_mem mem = clMemToCleanUp->front(); error = clReleaseMemObject(mem); diff --git a/source/blender/compositor/operations/COM_WriteBufferOperation.h b/source/blender/compositor/operations/COM_WriteBufferOperation.h index 24bfdecd124..d77814a9dc4 100644 --- a/source/blender/compositor/operations/COM_WriteBufferOperation.h +++ b/source/blender/compositor/operations/COM_WriteBufferOperation.h @@ -46,6 +46,9 @@ public: void deinitExecution(); void executeOpenCLRegion(OpenCLDevice* device, rcti *rect, unsigned int chunkNumber, MemoryBuffer **memoryBuffers, MemoryBuffer *outputBuffer); void readResolutionFromInputSocket(); + inline NodeOperation *getInput() { + return m_input; + } }; #endif diff --git a/source/blender/compositor/operations/COM_ZCombineOperation.h b/source/blender/compositor/operations/COM_ZCombineOperation.h index 2ade3f599ad..422a946b98f 100644 --- a/source/blender/compositor/operations/COM_ZCombineOperation.h +++ b/source/blender/compositor/operations/COM_ZCombineOperation.h @@ -26,8 +26,8 @@ /** - * this program converts an input colour to an output value. - * it assumes we are in sRGB colour space. + * this program converts an input color to an output value. + * it assumes we are in sRGB color space. */ class ZCombineOperation : public NodeOperation { protected: diff --git a/source/blender/editors/animation/drivers.c b/source/blender/editors/animation/drivers.c index 4a5966948ae..672e11ac613 100644 --- a/source/blender/editors/animation/drivers.c +++ b/source/blender/editors/animation/drivers.c @@ -416,6 +416,7 @@ static char *get_driver_path_hack(bContext *C, PointerRNA *ptr, PropertyRNA *pro char *basepath = RNA_path_from_ID_to_property(ptr, prop); char *path = basepath; /* in case no remapping is needed */ + /* Remapping will only be performed in the Properties Editor, as only this * restricts the subspace of options to the 'active' data (a manageable state) */ @@ -426,23 +427,6 @@ static char *get_driver_path_hack(bContext *C, PointerRNA *ptr, PropertyRNA *pro if (ob && id) { /* only id-types which can be remapped to go through objects should be considered */ switch (GS(id->name)) { - case ID_MA: /* materials */ - { - Material *ma = give_current_material(ob, ob->actcol); - - /* assumes: material will only be shown if it is active objects's active material it's ok */ - if ((ID *)ma == id) { - /* create new path */ - // TODO: use RNA path functions to construct instead? - path = BLI_sprintfN("material_slots[\"%s\"].material.%s", - ma->id.name + 2, basepath); - - /* free old one */ - MEM_freeN(basepath); - } - } - break; - case ID_TE: /* textures */ { Material *ma = give_current_material(ob, ob->actcol); @@ -452,6 +436,7 @@ static char *get_driver_path_hack(bContext *C, PointerRNA *ptr, PropertyRNA *pro if ((ID *)tex == id) { /* create new path */ // TODO: use RNA path functions to construct step by step instead? + // FIXME: maybe this isn't even needed anymore... path = BLI_sprintfN("material_slots[\"%s\"].material.texture_slots[\"%s\"].texture.%s", ma->id.name + 2, tex->id.name + 2, basepath); diff --git a/source/blender/editors/animation/keyframing.c b/source/blender/editors/animation/keyframing.c index 6250424d655..0c9a6ff6bf1 100644 --- a/source/blender/editors/animation/keyframing.c +++ b/source/blender/editors/animation/keyframing.c @@ -201,7 +201,7 @@ FCurve *verify_fcurve(bAction *act, const char group[], PointerRNA *ptr, grp = (bActionGroup *)BLI_findlink(&pose->agroups, (pchan->agrp_index - 1)); if (grp) { agrp->customCol = grp->customCol; - action_group_colors_sync(agrp); + action_group_colors_sync(agrp, grp); } } } @@ -1581,7 +1581,7 @@ void ANIM_OT_keyframe_delete_button(wmOperatorType *ot) ot->flag = OPTYPE_UNDO; /* properties */ - RNA_def_boolean(ot->srna, "all", 1, "All", "Delete keyfames from all elements of the array"); + RNA_def_boolean(ot->srna, "all", 1, "All", "Delete keyframes from all elements of the array"); } /* ******************************************* */ diff --git a/source/blender/editors/armature/armature_intern.h b/source/blender/editors/armature/armature_intern.h index 0760b384ecd..ddf66a6169b 100644 --- a/source/blender/editors/armature/armature_intern.h +++ b/source/blender/editors/armature/armature_intern.h @@ -183,7 +183,7 @@ LinkData *poseAnim_mapping_getNextFCurve(ListBase *fcuLinks, LinkData *prev, con void POSELIB_OT_new(struct wmOperatorType *ot); void POSELIB_OT_unlink(struct wmOperatorType *ot); -void POSELIB_OT_action_sanitise(struct wmOperatorType *ot); +void POSELIB_OT_action_sanitize(struct wmOperatorType *ot); void POSELIB_OT_pose_add(struct wmOperatorType *ot); void POSELIB_OT_pose_remove(struct wmOperatorType *ot); diff --git a/source/blender/editors/armature/armature_ops.c b/source/blender/editors/armature/armature_ops.c index f3461f71391..59ee90c553b 100644 --- a/source/blender/editors/armature/armature_ops.c +++ b/source/blender/editors/armature/armature_ops.c @@ -159,7 +159,7 @@ void ED_operatortypes_armature(void) WM_operatortype_append(POSELIB_OT_new); WM_operatortype_append(POSELIB_OT_unlink); - WM_operatortype_append(POSELIB_OT_action_sanitise); + WM_operatortype_append(POSELIB_OT_action_sanitize); /* POSE SLIDING */ WM_operatortype_append(POSE_OT_push); diff --git a/source/blender/editors/armature/editarmature.c b/source/blender/editors/armature/editarmature.c index d4755fc95cd..6cef843d828 100644 --- a/source/blender/editors/armature/editarmature.c +++ b/source/blender/editors/armature/editarmature.c @@ -4563,7 +4563,7 @@ int ED_do_pose_selectbuffer(Scene *scene, Base *base, unsigned int *buffer, shor DAG_id_tag_update(&ob_act->id, OB_RECALC_DATA); } } - /* if there are some dependencies for visualising armature state + /* if there are some dependencies for visualizing armature state * (e.g. Mask Modifier in 'Armature' mode), force update */ else if (arm->flag & ARM_HAS_VIZ_DEPS) { diff --git a/source/blender/editors/armature/poseSlide.c b/source/blender/editors/armature/poseSlide.c index 824a39374fd..51700793791 100644 --- a/source/blender/editors/armature/poseSlide.c +++ b/source/blender/editors/armature/poseSlide.c @@ -220,7 +220,7 @@ static void pose_slide_apply_val(tPoseSlideOp *pso, FCurve *fcu, float *val) else { /* - these weights are derived from the relative distance of these * poses from the current frame - * - they then get normalised so that they only sum up to 1 + * - they then get normalized so that they only sum up to 1 */ float wtot; diff --git a/source/blender/editors/armature/poselib.c b/source/blender/editors/armature/poselib.c index 18e3d967835..ee54fc2c6fe 100644 --- a/source/blender/editors/armature/poselib.c +++ b/source/blender/editors/armature/poselib.c @@ -288,7 +288,7 @@ void POSELIB_OT_unlink(wmOperatorType *ot) /* This tool automagically generates/validates poselib data so that it corresponds to the data * in the action. This is for use in making existing actions usable as poselibs. */ -static int poselib_sanitise_exec(bContext *C, wmOperator *op) +static int poselib_sanitize_exec(bContext *C, wmOperator *op) { Object *ob = get_poselib_object(C); bAction *act = (ob) ? ob->poselib : NULL; @@ -353,15 +353,15 @@ static int poselib_sanitise_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -void POSELIB_OT_action_sanitise(wmOperatorType *ot) +void POSELIB_OT_action_sanitize(wmOperatorType *ot) { /* identifiers */ - ot->name = "Sanitise Pose Library Action"; - ot->idname = "POSELIB_OT_action_sanitise"; + ot->name = "Sanitize Pose Library Action"; + ot->idname = "POSELIB_OT_action_sanitize"; ot->description = "Make action suitable for use as a Pose Library"; /* callbacks */ - ot->exec = poselib_sanitise_exec; + ot->exec = poselib_sanitize_exec; ot->poll = has_poselib_pose_data_poll; /* flags */ diff --git a/source/blender/editors/curve/editcurve.c b/source/blender/editors/curve/editcurve.c index 032b999c60f..e8a71a35576 100644 --- a/source/blender/editors/curve/editcurve.c +++ b/source/blender/editors/curve/editcurve.c @@ -2368,7 +2368,7 @@ void CURVE_OT_smooth_radius(wmOperatorType *ot) { /* identifiers */ ot->name = "Smooth Curve Radius"; - ot->description = "Flatten radiuses of selected points"; + ot->description = "Flatten radii of selected points"; ot->idname = "CURVE_OT_smooth_radius"; /* api clastbacks */ @@ -3932,7 +3932,8 @@ static int make_segment_exec(bContext *C, wmOperator *op) ListBase *nubase = object_editcurve_get(obedit); Nurb *nu, *nu1 = NULL, *nu2 = NULL; BPoint *bp; - int a, ok = 0; + int ok = 0; + /* int a; */ /* UNUSED */ /* first decide if this is a surface merge! */ if (obedit->type == OB_SURF) nu = nubase->first; @@ -4040,7 +4041,7 @@ static int make_segment_exec(bContext *C, wmOperator *op) MEM_freeN(nu1->bp); nu1->bp = bp; - a = nu1->pntsu + nu1->orderu; + /* a = nu1->pntsu + nu1->orderu; */ /* UNUSED */ nu1->pntsu += nu2->pntsu; BLI_remlink(nubase, nu2); diff --git a/source/blender/editors/gpencil/drawgpencil.c b/source/blender/editors/gpencil/drawgpencil.c index fa555b0ddb8..6d113cbb924 100644 --- a/source/blender/editors/gpencil/drawgpencil.c +++ b/source/blender/editors/gpencil/drawgpencil.c @@ -281,7 +281,7 @@ static void gp_draw_stroke(bGPDspoint *points, int totpoints, short thickness_s, } /* tessellation code - draw stroke as series of connected quads with connection - * edges rotated to minimise shrinking artifacts, and rounded endcaps + * edges rotated to minimize shrinking artifacts, and rounded endcaps */ else { bGPDspoint *pt1, *pt2; diff --git a/source/blender/editors/gpencil/editaction_gpencil.c b/source/blender/editors/gpencil/editaction_gpencil.c index a7beaa74eb7..b69db0040b5 100644 --- a/source/blender/editors/gpencil/editaction_gpencil.c +++ b/source/blender/editors/gpencil/editaction_gpencil.c @@ -399,7 +399,7 @@ void paste_gpdata(Scene *scene) /* this should be the right frame... as it may be a pre-existing frame, * must make sure that only compatible stroke types get copied over * - we cannot just add a duplicate frame, as that would cause errors - * - need to check for compatible types to minimise memory usage (copying 'junk' over) + * - need to check for compatible types to minimize memory usage (copying 'junk' over) */ for (gps = gpfs->strokes.first; gps; gps = gps->next) { short stroke_ok; diff --git a/source/blender/editors/include/ED_screen_types.h b/source/blender/editors/include/ED_screen_types.h index c53dca47da9..6b9d8385ac3 100644 --- a/source/blender/editors/include/ED_screen_types.h +++ b/source/blender/editors/include/ED_screen_types.h @@ -76,10 +76,10 @@ typedef struct ScreenFrameRateInfo { /* Enum for Action Zone Edges. Which edge of area is action zone. */ typedef enum { - AE_RIGHT_TO_TOPLEFT, /* Region located on the left, _right_ edge is action zone. Region minimised to the top left */ - AE_LEFT_TO_TOPRIGHT, /* Region located on the right, _left_ edge is action zone. Region minimised to the top right */ - AE_TOP_TO_BOTTOMRIGHT, /* Region located at the bottom, _top_ edge is action zone. Region minimised to the bottom right */ - AE_BOTTOM_TO_TOPLEFT /* Region located at the top, _bottom_edge is action zone. Region minimised to the top left */ + AE_RIGHT_TO_TOPLEFT, /* Region located on the left, _right_ edge is action zone. Region minimized to the top left */ + AE_LEFT_TO_TOPRIGHT, /* Region located on the right, _left_ edge is action zone. Region minimized to the top right */ + AE_TOP_TO_BOTTOMRIGHT, /* Region located at the bottom, _top_ edge is action zone. Region minimized to the bottom right */ + AE_BOTTOM_TO_TOPLEFT /* Region located at the top, _bottom_edge is action zone. Region minimized to the top left */ } AZEdge; /* for editing areas/regions */ diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c index d26c8cefdf0..49d56d427ba 100644 --- a/source/blender/editors/interface/interface.c +++ b/source/blender/editors/interface/interface.c @@ -498,7 +498,7 @@ static int ui_but_float_precision(uiBut *but, double value) return prec; } -static void ui_draw_linkline(uiLinkLine *line, int hilightActiveLines) +static void ui_draw_linkline(uiLinkLine *line, int highlightActiveLines) { rcti rect; @@ -511,7 +511,7 @@ static void ui_draw_linkline(uiLinkLine *line, int hilightActiveLines) if (line->flag & UI_SELECT) glColor3ub(100, 100, 100); - else if (hilightActiveLines && ((line->from->flag & UI_ACTIVE) || (line->to->flag & UI_ACTIVE))) + else if (highlightActiveLines && ((line->from->flag & UI_ACTIVE) || (line->to->flag & UI_ACTIVE))) UI_ThemeColor(TH_TEXT_HI); else glColor3ub(0, 0, 0); @@ -919,7 +919,7 @@ void uiEndBlock(const bContext *C, uiBlock *block) if (ui_but_update_from_old_block(C, block, &but)) ui_check_but(but); - /* temp? Proper check for greying out */ + /* temp? Proper check for graying out */ if (but->optype) { wmOperatorType *ot = but->optype; diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c index b82e7c3a1e2..3a64ad22062 100644 --- a/source/blender/editors/interface/interface_handlers.c +++ b/source/blender/editors/interface/interface_handlers.c @@ -3362,7 +3362,7 @@ static void ui_ndofedit_but_HSVCIRCLE(uiBut *but, uiHandleButtonData *data, wmND ui_get_but_vectorf(but, rgb); rgb_to_hsv_compat_v(rgb, hsv); - /* Convert current colour on hue/sat disc to circular coordinates phi, r */ + /* Convert current color on hue/sat disc to circular coordinates phi, r */ phi = fmodf(hsv[0] + 0.25f, 1.0f) * -2.0f * (float)M_PI; r = hsv[1]; /* sqr= r>0.f?sqrtf(r):1; */ /* UNUSED */ @@ -3833,7 +3833,7 @@ static int ui_numedit_but_HISTOGRAM(uiBut *but, uiHandleButtonData *data, int mx } else { /* scale histogram values */ - const float yfac = MIN2(powf(hist->ymax, 2.f), 1.f) * 0.5f; + const float yfac = minf(powf(hist->ymax, 2.0f), 1.0f) * 0.5f; hist->ymax += dy * yfac; CLAMP(hist->ymax, 1.f, 100.f); @@ -5009,7 +5009,7 @@ static uiBut *ui_but_find_mouse_over(ARegion *ar, int x, int y) ui_window_to_block(ar, block, &mx, &my); for (but = block->buttons.first; but; but = but->next) { - /* note, LABEL is included for hilights, this allows drags */ + /* note, LABEL is included for highlights, this allows drags */ if (but->type == LABEL && but->dragpoin == NULL) continue; if (ELEM3(but->type, ROUNDBOX, SEPR, LISTBOX)) diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c index 40d530a13d4..eb89fd66b77 100644 --- a/source/blender/editors/interface/interface_templates.c +++ b/source/blender/editors/interface/interface_templates.c @@ -783,7 +783,7 @@ static uiLayout *draw_modifier(uiLayout *layout, Scene *scene, Object *ob, if (modifier_couldBeCage(scene, md) && (index <= lastCageIndex)) { /* -- convert to rna ? */ but = uiDefIconButBitI(block, TOG, eModifierMode_OnCage, 0, ICON_MESH_DATA, 0, 0, UI_UNIT_X - 2, UI_UNIT_Y, &md->mode, 0.0, 0.0, 0.0, 0.0, - TIP_("Apply modifier to editing cage during Editmode")); + TIP_("Apply modifier to editing cage during Edit mode")); if (index < cageIndex) uiButSetFlag(but, UI_BUT_DISABLED); uiButSetFunc(but, modifiers_setOnCage, ob, md); @@ -1052,7 +1052,7 @@ static uiLayout *draw_constraint(uiLayout *layout, Object *ob, bConstraint *con) * as that poses problems when restoring them, so disable the "up" button where * it may cause this situation. * - * Up/Down buttons should only be shown (or not greyed - todo) if they serve some purpose. + * Up/Down buttons should only be shown (or not grayed - todo) if they serve some purpose. */ if (proxylocked_constraints_owner(ob, pchan)) { if (con->prev) { @@ -2680,7 +2680,7 @@ void uiTemplateReportsBanner(uiLayout *layout, bContext *C) but->col[3] = 255; but = uiDefBut(block, ROUNDBOX, 0, "", UI_UNIT_X + 10, 0, UI_UNIT_X + width, UI_UNIT_Y, NULL, 0.0f, 0.0f, 0, 0, ""); - but->col[0] = but->col[1] = but->col[2] = FTOCHAR(rti->greyscale); + but->col[0] = but->col[1] = but->col[2] = FTOCHAR(rti->grayscale); but->col[3] = 255; uiBlockEndAlign(block); @@ -2700,7 +2700,8 @@ void uiTemplateReportsBanner(uiLayout *layout, bContext *C) uiBlockSetEmboss(block, UI_EMBOSSN); if (reports->list.first != reports->list.last) - uiDefIconButO(block, BUT, "UI_OT_reports_to_textblock", WM_OP_INVOKE_REGION_WIN, icon, 2, 0, UI_UNIT_X, UI_UNIT_Y, TIP_("Click to see rest of reports in textblock: 'Recent Reports'")); + uiDefIconButO(block, BUT, "UI_OT_reports_to_textblock", WM_OP_INVOKE_REGION_WIN, icon, 2, 0, + UI_UNIT_X, UI_UNIT_Y, TIP_("Click to see the remaining reports in text block: 'Recent Reports'")); else uiDefIconBut(block, LABEL, 0, icon, 2, 0, UI_UNIT_X, UI_UNIT_Y, NULL, 0.0f, 0.0f, 0, 0, ""); diff --git a/source/blender/editors/interface/interface_widgets.c b/source/blender/editors/interface/interface_widgets.c index 07b1217b1bd..5ee89bb418f 100644 --- a/source/blender/editors/interface/interface_widgets.c +++ b/source/blender/editors/interface/interface_widgets.c @@ -1434,7 +1434,7 @@ static struct uiWidgetColors wcol_menu_back = { 25, -20 }; -/* tooltip colour */ +/* tooltip color */ static struct uiWidgetColors wcol_tooltip = { {0, 0, 0, 255}, {25, 25, 25, 230}, diff --git a/source/blender/editors/interface/view2d.c b/source/blender/editors/interface/view2d.c index 6dbf53cba72..392aae1632d 100644 --- a/source/blender/editors/interface/view2d.c +++ b/source/blender/editors/interface/view2d.c @@ -431,7 +431,7 @@ void UI_view2d_curRect_validate_resize(View2D *v2d, int resize) /* curRatio = height / width; */ /* UNUSED */ winRatio = winy / winx; - /* both sizes change (area/region maximised) */ + /* both sizes change (area/region maximized) */ if (do_x == do_y) { if (do_x && do_y) { /* here is 1,1 case, so all others must be 0,0 */ diff --git a/source/blender/editors/io/io_collada.c b/source/blender/editors/io/io_collada.c index 20ac3333115..77808d0a00d 100644 --- a/source/blender/editors/io/io_collada.c +++ b/source/blender/editors/io/io_collada.c @@ -276,7 +276,7 @@ void WM_OT_collada_export(wmOperatorType *ot) RNA_def_boolean(ot->srna, "include_material_textures", 0, "Include Material Textures", "Export textures assigned to the object Materials"); - RNA_def_boolean(ot->srna, "use_texture_copies", 1, "copy", + RNA_def_boolean(ot->srna, "use_texture_copies", 1, "Copy", "Copy textures to same folder where the .dae file is exported"); diff --git a/source/blender/editors/mask/mask_draw.c b/source/blender/editors/mask/mask_draw.c index 83337a18223..f080b9f96e7 100644 --- a/source/blender/editors/mask/mask_draw.c +++ b/source/blender/editors/mask/mask_draw.c @@ -192,9 +192,9 @@ static void draw_spline_points(MaskLayer *masklay, MaskSpline *spline, /* this could be split into its own loop */ if (draw_type == MASK_DT_OUTLINE) { - const unsigned char rgb_grey[4] = {0x60, 0x60, 0x60, 0xff}; + const unsigned char rgb_gray[4] = {0x60, 0x60, 0x60, 0xff}; glLineWidth(3); - glColor4ubv(rgb_grey); + glColor4ubv(rgb_gray); glBegin(GL_LINES); glVertex3fv(vert); glVertex3fv(handle); diff --git a/source/blender/editors/mask/mask_edit.c b/source/blender/editors/mask/mask_edit.c index 6e0da5fd756..cce7e26115e 100644 --- a/source/blender/editors/mask/mask_edit.c +++ b/source/blender/editors/mask/mask_edit.c @@ -310,7 +310,8 @@ void ED_keymap_mask(wmKeyConfig *keyconf) WM_keymap_add_item(keymap, "MASK_OT_normals_make_consistent", NKEY, KM_PRESS, KM_CTRL, 0); // WM_keymap_add_item(keymap, "MASK_OT_feather_weight_clear", SKEY, KM_PRESS, KM_ALT, 0); /* ... matches curve editmode */ - RNA_enum_set(WM_keymap_add_item(keymap, "TRANSFORM_OT_transform", SKEY, KM_PRESS, KM_ALT, 0)->ptr, "mode", TFM_MASK_SHRINKFATTEN); + RNA_enum_set(WM_keymap_add_item(keymap, "TRANSFORM_OT_transform", SKEY, KM_PRESS, KM_ALT, 0)->ptr, + "mode", TFM_MASK_SHRINKFATTEN); /* relationships */ WM_keymap_add_item(keymap, "MASK_OT_parent_set", PKEY, KM_PRESS, KM_CTRL, 0); @@ -329,13 +330,15 @@ void ED_operatormacros_mask(void) wmOperatorType *ot; wmOperatorTypeMacro *otmacro; - ot = WM_operatortype_append_macro("MASK_OT_add_vertex_slide", "Add Vertex and Slide", "Add new vertex and slide it", OPTYPE_UNDO | OPTYPE_REGISTER); + ot = WM_operatortype_append_macro("MASK_OT_add_vertex_slide", "Add Vertex and Slide", + "Add new vertex and slide it", OPTYPE_UNDO | OPTYPE_REGISTER); ot->description = "Add new vertex and slide it"; WM_operatortype_macro_define(ot, "MASK_OT_add_vertex"); otmacro = WM_operatortype_macro_define(ot, "TRANSFORM_OT_translate"); RNA_boolean_set(otmacro->ptr, "release_confirm", TRUE); - ot = WM_operatortype_append_macro("MASK_OT_add_feather_vertex_slide", "Add Feather Vertex and Slide", "Add new vertex to feater and slide it", OPTYPE_UNDO | OPTYPE_REGISTER); + ot = WM_operatortype_append_macro("MASK_OT_add_feather_vertex_slide", "Add Feather Vertex and Slide", + "Add new vertex to feather and slide it", OPTYPE_UNDO | OPTYPE_REGISTER); ot->description = "Add new feather vertex and slide it"; WM_operatortype_macro_define(ot, "MASK_OT_add_feather_vertex"); otmacro = WM_operatortype_macro_define(ot, "MASK_OT_slide_point"); diff --git a/source/blender/editors/mask/mask_shapekey.c b/source/blender/editors/mask/mask_shapekey.c index a619ac7e3cd..c5b9fc33a9b 100644 --- a/source/blender/editors/mask/mask_shapekey.c +++ b/source/blender/editors/mask/mask_shapekey.c @@ -229,7 +229,7 @@ void MASK_OT_shape_key_feather_reset(wmOperatorType *ot) { /* identifiers */ ot->name = "Feather Reset Animation"; - ot->description = "Resets fearther weights on all selected points animation values"; + ot->description = "Reset feather weights on all selected points animation values"; ot->idname = "MASK_OT_shape_key_feather_reset"; /* api callbacks */ @@ -394,7 +394,7 @@ void MASK_OT_shape_key_rekey(wmOperatorType *ot) { /* identifiers */ ot->name = "Re-Key Points of Selected Shapes"; - ot->description = "Recalculates animation data on selected points for frames selected in the dopesheet"; + ot->description = "Recalculate animation data on selected points for frames selected in the dopesheet"; ot->idname = "MASK_OT_shape_key_rekey"; /* api callbacks */ diff --git a/source/blender/editors/mesh/editmesh_knife.c b/source/blender/editors/mesh/editmesh_knife.c index 2ceb8aeef26..882d3115ba0 100644 --- a/source/blender/editors/mesh/editmesh_knife.c +++ b/source/blender/editors/mesh/editmesh_knife.c @@ -1400,9 +1400,10 @@ static float knife_snap_size(KnifeTool_OpData *kcd, float maxsize) { float density = (float)knife_sample_screen_density(kcd, maxsize * 2.0f); - density = MAX2(density, 1); + if (density < 1.0f) + density = 1.0f; - return MIN2(maxsize / (density * 0.5f), maxsize); + return minf(maxsize / (density * 0.5f), maxsize); } /* p is closest point on edge to the mouse cursor */ diff --git a/source/blender/editors/mesh/editmesh_tools.c b/source/blender/editors/mesh/editmesh_tools.c index 3e68e18d956..208aa2f9b12 100644 --- a/source/blender/editors/mesh/editmesh_tools.c +++ b/source/blender/editors/mesh/editmesh_tools.c @@ -2892,11 +2892,9 @@ static int mesh_separate_material(Main *bmain, Scene *scene, Base *editbase, wmO static int mesh_separate_loose(Main *bmain, Scene *scene, Base *editbase, wmOperator *wmop) { int i; - BMVert *v; BMEdge *e; BMVert *v_seed; BMWalker walker; - BMIter iter; int result = FALSE; Object *obedit = editbase->object; BMEditMesh *em = BMEdit_FromObject(obedit); @@ -2913,11 +2911,7 @@ static int mesh_separate_loose(Main *bmain, Scene *scene, Base *editbase, wmOper * original mesh.*/ for (i = 0; i < max_iter; i++) { /* Get a seed vertex to start the walk */ - v_seed = NULL; - BM_ITER_MESH (v, &iter, bm, BM_VERTS_OF_MESH) { - v_seed = v; - break; - } + v_seed = BM_iter_at_index(bm, BM_VERTS_OF_MESH, NULL, 0); /* No vertices available, can't do anything */ if (v_seed == NULL) { @@ -4187,11 +4181,11 @@ void MESH_OT_sort_elements(wmOperatorType *ot) { static EnumPropertyItem type_items[] = { {SRT_VIEW_ZAXIS, "VIEW_ZAXIS", 0, "View Z Axis", - "Sort selected elements from farest to nearest one in current view"}, + "Sort selected elements from farthest to nearest one in current view"}, {SRT_VIEW_XAXIS, "VIEW_XAXIS", 0, "View X Axis", "Sort selected elements from left to right one in current view"}, {SRT_CURSOR_DISTANCE, "CURSOR_DISTANCE", 0, "Cursor Distance", - "Sort selected elements from nearest to farest from 3D cursor"}, + "Sort selected elements from nearest to farthest from 3D cursor"}, {SRT_MATERIAL, "MATERIAL", 0, "Material", "Sort selected elements from smallest to greatest material index (faces only!)"}, {SRT_SELECTED, "SELECTED", 0, "Selected", diff --git a/source/blender/editors/metaball/mball_edit.c b/source/blender/editors/metaball/mball_edit.c index 7b7aaf5a3db..50d5569c483 100644 --- a/source/blender/editors/metaball/mball_edit.c +++ b/source/blender/editors/metaball/mball_edit.c @@ -228,7 +228,8 @@ void MBALL_OT_select_random_metaelems(struct wmOperatorType *ot) ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; /* properties */ - RNA_def_float_percentage(ot->srna, "percent", 0.5f, 0.0f, 1.0f, "Percent", "Percentage of metaelems to select randomly", 0.0001f, 1.0f); + RNA_def_float_percentage(ot->srna, "percent", 0.5f, 0.0f, 1.0f, "Percent", + "Percentage of metaelements to select randomly", 0.0001f, 1.0f); } /***************************** Duplicate operator *****************************/ diff --git a/source/blender/editors/object/object_relations.c b/source/blender/editors/object/object_relations.c index fc0aa39e733..d7c882ba51e 100644 --- a/source/blender/editors/object/object_relations.c +++ b/source/blender/editors/object/object_relations.c @@ -1732,6 +1732,13 @@ static void make_local_makelocalmaterial(Material *ma) /* nodetree? XXX */ } +enum { + MAKE_LOCAL_SELECT_OB, + MAKE_LOCAL_SELECT_OBDATA, + MAKE_LOCAL_SELECT_OBDATA_MATERIAL, + MAKE_LOCAL_ALL +}; + static int make_local_exec(bContext *C, wmOperator *op) { Main *bmain = CTX_data_main(C); @@ -1742,7 +1749,7 @@ static int make_local_exec(bContext *C, wmOperator *op) ID *id; int a, b, mode = RNA_enum_get(op->ptr, "type"); - if (mode == 3) { + if (mode == MAKE_LOCAL_ALL) { BKE_library_make_local(bmain, NULL, 0); /* NULL is all libs */ WM_event_add_notifier(C, NC_WINDOW, NULL); return OPERATOR_FINISHED; @@ -1770,7 +1777,7 @@ static int make_local_exec(bContext *C, wmOperator *op) { id = ob->data; - if (id && mode > 1) { + if (id && (ELEM(mode, MAKE_LOCAL_SELECT_OBDATA, MAKE_LOCAL_SELECT_OBDATA_MATERIAL))) { id_make_local(id, 0); adt = BKE_animdata_from_id(id); if (adt) BKE_animdata_make_local(adt); @@ -1794,7 +1801,7 @@ static int make_local_exec(bContext *C, wmOperator *op) } CTX_DATA_END; - if (mode > 1) { + if (mode == MAKE_LOCAL_SELECT_OBDATA_MATERIAL) { CTX_DATA_BEGIN (C, Object *, ob, selected_objects) { if (ob->type == OB_LAMP) { @@ -1832,10 +1839,12 @@ static int make_local_exec(bContext *C, wmOperator *op) void OBJECT_OT_make_local(wmOperatorType *ot) { static EnumPropertyItem type_items[] = { - {1, "SELECTED_OBJECTS", 0, "Selected Objects", ""}, - {2, "SELECTED_OBJECTS_DATA", 0, "Selected Objects and Data", ""}, - {3, "ALL", 0, "All", ""}, - {0, NULL, 0, NULL, NULL}}; + {MAKE_LOCAL_SELECT_OB, "SELECT_OBJECT", 0, "Selected Objects", ""}, + {MAKE_LOCAL_SELECT_OBDATA, "SELECT_OBDATA", 0, "Selected Objects and Data", ""}, + {MAKE_LOCAL_SELECT_OBDATA_MATERIAL, "SELECT_OBDATA_MATERIAL", 0, "Selected Objects, Data and Materials", ""}, + {MAKE_LOCAL_ALL, "ALL", 0, "All", ""}, + {0, NULL, 0, NULL, NULL} + }; /* identifiers */ ot->name = "Make Local"; diff --git a/source/blender/editors/physics/physics_fluid.c b/source/blender/editors/physics/physics_fluid.c index b31e5c0aea3..2e58fa85a11 100644 --- a/source/blender/editors/physics/physics_fluid.c +++ b/source/blender/editors/physics/physics_fluid.c @@ -567,11 +567,14 @@ static void export_fluid_objects(ListBase *fobjects, Scene *scene, int length) if (deform) { fsmesh.channelSizeVertices = length; fsmesh.channelVertices = fobj->VertexCache; - - // remove channels + + /* remove channels */ fsmesh.channelTranslation = fsmesh.channelRotation = - fsmesh.channelScale = NULL; + fsmesh.channelScale = NULL; + + /* Override user settings, only noslip is supported here! */ + fsmesh.obstacleType = FLUIDSIM_OBSTACLE_NOSLIP; } elbeemAddMesh(&fsmesh); diff --git a/source/blender/editors/render/render_opengl.c b/source/blender/editors/render/render_opengl.c index de3d2d4e871..d37a16cb1bb 100644 --- a/source/blender/editors/render/render_opengl.c +++ b/source/blender/editors/render/render_opengl.c @@ -518,7 +518,7 @@ static int screen_opengl_render_anim_step(bContext *C, wmOperator *op) ibuf = BKE_image_acquire_ibuf(oglrender->ima, &oglrender->iuser, &lock); if (ibuf) { - /* color -> greyscale */ + /* color -> grayscale */ /* editing directly would alter the render view */ if (scene->r.im_format.planes == R_IMF_PLANES_BW) { ImBuf *ibuf_bw = IMB_dupImBuf(ibuf); diff --git a/source/blender/editors/screen/screen_edit.c b/source/blender/editors/screen/screen_edit.c index 3533a337aa1..a638aac9423 100644 --- a/source/blender/editors/screen/screen_edit.c +++ b/source/blender/editors/screen/screen_edit.c @@ -862,7 +862,7 @@ static void draw_join_shape(ScrArea *sa, char dir) draw_horizontal_join_shape(sa, dir); } -/* draw screen area darker with arrow (visualisation of future joining) */ +/* draw screen area darker with arrow (visualization of future joining) */ static void scrarea_draw_shape_dark(ScrArea *sa, char dir) { glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); diff --git a/source/blender/editors/screen/screen_ops.c b/source/blender/editors/screen/screen_ops.c index 6782cd55a8b..6be276dea14 100644 --- a/source/blender/editors/screen/screen_ops.c +++ b/source/blender/editors/screen/screen_ops.c @@ -2826,7 +2826,7 @@ static int header_toolbox_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent *U uiItemS(layout); - /* file browser should be fullscreen all the time, but other regions can be maximised/restored... */ + /* file browser should be fullscreen all the time, but other regions can be maximized/restored... */ if (sa->spacetype != SPACE_FILE) { if (sa->full) uiItemO(layout, "Tile Area", ICON_NONE, "SCREEN_OT_screen_full_area"); diff --git a/source/blender/editors/sculpt_paint/paint_vertex.c b/source/blender/editors/sculpt_paint/paint_vertex.c index 3c37ad8cf2a..1b62ba8a7e0 100644 --- a/source/blender/editors/sculpt_paint/paint_vertex.c +++ b/source/blender/editors/sculpt_paint/paint_vertex.c @@ -3045,7 +3045,7 @@ static int weight_from_bones_exec(bContext *C, wmOperator *op) void PAINT_OT_weight_from_bones(wmOperatorType *ot) { static EnumPropertyItem type_items[] = { - {ARM_GROUPS_AUTO, "AUTOMATIC", 0, "Automatic", "Automatic weights froms bones"}, + {ARM_GROUPS_AUTO, "AUTOMATIC", 0, "Automatic", "Automatic weights from bones"}, {ARM_GROUPS_ENVELOPE, "ENVELOPES", 0, "From Envelopes", "Weights from envelopes with user defined radius"}, {0, NULL, 0, NULL, NULL}}; diff --git a/source/blender/editors/space_clip/clip_ops.c b/source/blender/editors/space_clip/clip_ops.c index e76edcf0290..9d1f52568b4 100644 --- a/source/blender/editors/space_clip/clip_ops.c +++ b/source/blender/editors/space_clip/clip_ops.c @@ -654,7 +654,7 @@ void CLIP_OT_view_zoom_out(wmOperatorType *ot) /* properties */ RNA_def_float_vector(ot->srna, "location", 2, NULL, -FLT_MAX, FLT_MAX, "Location", - "Cursor location in normalised (0.0-1.0) coordinates", -10.0f, 10.0f); + "Cursor location in normalized (0.0-1.0) coordinates", -10.0f, 10.0f); } /********************** view zoom ratio operator *********************/ diff --git a/source/blender/editors/space_file/file_intern.h b/source/blender/editors/space_file/file_intern.h index 3ad6614d356..a07a560328c 100644 --- a/source/blender/editors/space_file/file_intern.h +++ b/source/blender/editors/space_file/file_intern.h @@ -91,7 +91,7 @@ int file_directory_exec(bContext *C, struct wmOperator *unused); int file_directory_new_exec(bContext *C, struct wmOperator *unused); int file_delete_exec(bContext *C, struct wmOperator *unused); -int file_hilight_set(struct SpaceFile *sfile, struct ARegion *ar, int mx, int my); +int file_highlight_set(struct SpaceFile *sfile, struct ARegion *ar, int mx, int my); void file_sfile_to_operator(struct wmOperator *op, struct SpaceFile *sfile, char *filepath); void file_operator_to_sfile(struct SpaceFile *sfile, struct wmOperator *op); diff --git a/source/blender/editors/space_file/file_ops.c b/source/blender/editors/space_file/file_ops.c index 0cf3586e659..2d778b94216 100644 --- a/source/blender/editors/space_file/file_ops.c +++ b/source/blender/editors/space_file/file_ops.c @@ -515,7 +515,7 @@ void FILE_OT_delete_bookmark(wmOperatorType *ot) RNA_def_int(ot->srna, "index", -1, -1, 20000, "Index", "", -1, 20000); } -int file_hilight_set(SpaceFile *sfile, ARegion *ar, int mx, int my) +int file_highlight_set(SpaceFile *sfile, ARegion *ar, int mx, int my) { View2D *v2d = &ar->v2d; FileSelectParams *params; @@ -555,7 +555,7 @@ static int file_highlight_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent *e ARegion *ar = CTX_wm_region(C); SpaceFile *sfile = CTX_wm_space_file(C); - if (!file_hilight_set(sfile, ar, event->x, event->y)) + if (!file_highlight_set(sfile, ar, event->x, event->y)) return OPERATOR_CANCELLED; ED_area_tag_redraw(CTX_wm_area(C)); diff --git a/source/blender/editors/space_file/space_file.c b/source/blender/editors/space_file/space_file.c index 79979603f54..95d5483b42c 100644 --- a/source/blender/editors/space_file/space_file.c +++ b/source/blender/editors/space_file/space_file.c @@ -356,7 +356,7 @@ static void file_main_area_draw(const bContext *C, ARegion *ar) /* on first read, find active file */ if (params->active_file == -1) { wmEvent *event = CTX_wm_window(C)->eventstate; - file_hilight_set(sfile, ar, event->x, event->y); + file_highlight_set(sfile, ar, event->x, event->y); } file_draw_list(C, ar); diff --git a/source/blender/editors/space_graph/graph_draw.c b/source/blender/editors/space_graph/graph_draw.c index ddca0030cf5..870e9bb8168 100644 --- a/source/blender/editors/space_graph/graph_draw.c +++ b/source/blender/editors/space_graph/graph_draw.c @@ -276,7 +276,7 @@ static void draw_fcurve_vertices(SpaceIpo *sipo, ARegion *ar, FCurve *fcu, short View2D *v2d = &ar->v2d; /* only draw points if curve is visible - * - draw unselected points before selected points as separate passes to minimise color-changing overhead + * - draw unselected points before selected points as separate passes to minimize color-changing overhead * (XXX dunno if this is faster than drawing all in one pass though) * and also to make sure in the case of overlapping points that the selected is always visible * - draw handles before keyframes, so that keyframes will overlap handles (keyframes are more important for users) @@ -851,7 +851,7 @@ void graph_draw_curves(bAnimContext *ac, SpaceIpo *sipo, ARegion *ar, View2DGrid setlinestyle(2); } if ( ((fcu->grp) && (fcu->grp->flag & AGRP_MUTED)) || (fcu->flag & FCURVE_MUTED) ) { - /* muted curves are drawn in a greyish hue */ + /* muted curves are drawn in a grayish hue */ // XXX should we have some variations? UI_ThemeColorShade(TH_HEADER, 50); } diff --git a/source/blender/editors/space_graph/space_graph.c b/source/blender/editors/space_graph/space_graph.c index 756e6997fc8..f4cb4ec3d05 100644 --- a/source/blender/editors/space_graph/space_graph.c +++ b/source/blender/editors/space_graph/space_graph.c @@ -189,6 +189,8 @@ static void graph_init(struct wmWindowManager *UNUSED(wm), ScrArea *sa) sipo->ads->source = (ID *)(G.main->scene.first); // FIXME: this is a really nasty hack here for now... } + /* force immediate init of any invalid F-Curve colors */ + sipo->flag |= SIPO_TEMP_NEEDCHANSYNC; ED_area_tag_refresh(sa); } @@ -477,7 +479,13 @@ static void graph_listener(ScrArea *sa, wmNotifier *wmn) if (wmn->data == ND_SPACE_GRAPH) ED_area_tag_redraw(sa); break; - + case NC_WINDOW: + if (sipo->flag & SIPO_TEMP_NEEDCHANSYNC) { + /* force redraw/refresh after undo/redo - prevents "black curve" problem */ + ED_area_tag_refresh(sa); + } + break; + // XXX: restore the case below if not enough updates occur... //default: // if (wmn->data==ND_KEYS) diff --git a/source/blender/editors/space_image/image_buttons.c b/source/blender/editors/space_image/image_buttons.c index aa596b8b635..92c339d7672 100644 --- a/source/blender/editors/space_image/image_buttons.c +++ b/source/blender/editors/space_image/image_buttons.c @@ -148,7 +148,7 @@ static void image_info(Scene *scene, ImageUser *iuser, Image *ima, ImBuf *ibuf, /* the frame number, even if we cant */ if (ima->source == IMA_SRC_SEQUENCE) { /* don't use iuser->framenr directly because it may not be updated if auto-refresh is off */ - const int framenr = BKE_image_user_frame_get(iuser, CFRA, 0); + const int framenr = BKE_image_user_frame_get(iuser, CFRA, 0, NULL); ofs += sprintf(str + ofs, IFACE_(", Frame: %d"), framenr); } diff --git a/source/blender/editors/space_info/info_ops.c b/source/blender/editors/space_info/info_ops.c index 080f12bf35b..33a2d5c18c5 100644 --- a/source/blender/editors/space_info/info_ops.c +++ b/source/blender/editors/space_info/info_ops.c @@ -340,7 +340,7 @@ static int update_reports_display_invoke(bContext *C, wmOperator *UNUSED(op), wm ReportTimerInfo *rti; float progress = 0.0, color_progress = 0.0; float neutral_col[3] = {0.35, 0.35, 0.35}; - float neutral_grey = 0.6; + float neutral_gray = 0.6; float timeout = 0.0, color_timeout = 0.0; int send_note = 0; @@ -385,7 +385,7 @@ static int update_reports_display_invoke(bContext *C, wmOperator *UNUSED(op), wm rti->col[1] = 0.45; rti->col[2] = 0.7; } - rti->greyscale = 0.75; + rti->grayscale = 0.75; rti->widthfac = 1.0; } @@ -398,7 +398,7 @@ static int update_reports_display_invoke(bContext *C, wmOperator *UNUSED(op), wm /* fade colors out sharply according to progress through fade-out duration */ interp_v3_v3v3(rti->col, rti->col, neutral_col, color_progress); - rti->greyscale = interpf(neutral_grey, rti->greyscale, color_progress); + rti->grayscale = interpf(neutral_gray, rti->grayscale, color_progress); } /* collapse report at end of timeout */ diff --git a/source/blender/editors/space_nla/nla_draw.c b/source/blender/editors/space_nla/nla_draw.c index 7eb0f676707..92f014fd804 100644 --- a/source/blender/editors/space_nla/nla_draw.c +++ b/source/blender/editors/space_nla/nla_draw.c @@ -89,7 +89,7 @@ static void nla_action_get_color(AnimData *adt, bAction *act, float color[4]) UI_GetThemeColor4fv(TH_ANIM_ACTIVE, color); } else { - /* greyish-red color */ + /* grayish-red color */ UI_GetThemeColor4fv(TH_ANIM_INACTIVE, color); } } @@ -217,7 +217,7 @@ static void nla_draw_strip_curves(NlaStrip *strip, float yminc, float ymaxc) { const float yheight = ymaxc - yminc; - /* drawing color is simply a light-grey */ + /* drawing color is simply a light-gray */ // TODO: is this color suitable? // XXX nasty hacked color for now... which looks quite bad too... glColor3f(0.7f, 0.7f, 0.7f); @@ -480,7 +480,7 @@ static void nla_draw_strip_text(AnimData *adt, NlaTrack *nlt, NlaStrip *strip, i static void nla_draw_strip_frames_text(NlaTrack *UNUSED(nlt), NlaStrip *strip, View2D *v2d, float UNUSED(yminc), float ymaxc) { const float ytol = 1.0f; /* small offset to vertical positioning of text, for legibility */ - const char col[4] = {220, 220, 220, 255}; /* light grey */ + const char col[4] = {220, 220, 220, 255}; /* light gray */ char numstr[32] = ""; @@ -551,7 +551,7 @@ void draw_nla_main_data(bAnimContext *ac, SpaceNla *snla, ARegion *ar) /* draw each strip in the track (if visible) */ for (strip = nlt->strips.first, index = 1; strip; strip = strip->next, index++) { if (BKE_nlastrip_within_bounds(strip, v2d->cur.xmin, v2d->cur.xmax)) { - /* draw the visualisation of the strip */ + /* draw the visualization of the strip */ nla_draw_strip(snla, adt, nlt, strip, v2d, yminc, ymaxc); /* add the text for this strip to the cache */ diff --git a/source/blender/editors/space_node/drawnode.c b/source/blender/editors/space_node/drawnode.c index a4fb4d7dfee..218d11f3035 100644 --- a/source/blender/editors/space_node/drawnode.c +++ b/source/blender/editors/space_node/drawnode.c @@ -1213,7 +1213,7 @@ static void node_buts_image_user(uiLayout *layout, bContext *C, PointerRNA *ptr, Scene *scene = CTX_data_scene(C); ImageUser *iuser = iuserptr->data; char numstr[32]; - const int framenr = BKE_image_user_frame_get(iuser, CFRA, 0); + const int framenr = BKE_image_user_frame_get(iuser, CFRA, 0, NULL); BLI_snprintf(numstr, sizeof(numstr), IFACE_("Frame: %d"), framenr); uiItemL(layout, numstr, ICON_NONE); } @@ -2951,15 +2951,37 @@ void draw_nodespace_back_pix(ARegion *ar, SpaceNode *snode, int color_manage) } if (ibuf->rect) { - if (snode->flag & SNODE_SHOW_ALPHA) { + if (snode->flag & (SNODE_SHOW_R | SNODE_SHOW_G | SNODE_SHOW_B)) { + int ofs; + +#ifdef __BIG_ENDIAN__ + if (snode->flag & SNODE_SHOW_R) ofs = 2; + else if (snode->flag & SNODE_SHOW_G) ofs = 1; + else ofs = 0; +#else + if (snode->flag & SNODE_SHOW_R) ofs = 1; + else if (snode->flag & SNODE_SHOW_G) ofs = 2; + else ofs = 3; +#endif + glPixelZoom(snode->zoom, snode->zoom); /* swap bytes, so alpha is most significant one, then just draw it as luminance int */ - if (ENDIAN_ORDER == B_ENDIAN) - glPixelStorei(GL_UNPACK_SWAP_BYTES, 1); - + + glaDrawPixelsSafe(x, y, ibuf->x, ibuf->y, ibuf->x, GL_LUMINANCE, GL_UNSIGNED_INT, ((unsigned char *)ibuf->rect) + ofs); + + glPixelZoom(1.0f, 1.0f); + } + else if (snode->flag & SNODE_SHOW_ALPHA) { + glPixelZoom(snode->zoom, snode->zoom); + /* swap bytes, so alpha is most significant one, then just draw it as luminance int */ +#ifdef __BIG_ENDIAN__ + glPixelStorei(GL_UNPACK_SWAP_BYTES, 1); +#endif glaDrawPixelsSafe(x, y, ibuf->x, ibuf->y, ibuf->x, GL_LUMINANCE, GL_UNSIGNED_INT, ibuf->rect); - + +#ifdef __BIG_ENDIAN__ glPixelStorei(GL_UNPACK_SWAP_BYTES, 0); +#endif glPixelZoom(1.0f, 1.0f); } else if (snode->flag & SNODE_USE_ALPHA) { diff --git a/source/blender/editors/space_node/node_draw.c b/source/blender/editors/space_node/node_draw.c index 17d7530d2a7..65646c855b7 100644 --- a/source/blender/editors/space_node/node_draw.c +++ b/source/blender/editors/space_node/node_draw.c @@ -724,6 +724,12 @@ static void node_draw_basis(const bContext *C, ARegion *ar, SpaceNode *snode, bN if (node->flag & NODE_MUTED) UI_ThemeColorBlend(color_id, TH_REDALERT, 0.5f); + if (ntree->type == NTREE_COMPOSIT && (snode->flag&SNODE_SHOW_HIGHLIGHT)) { + if (node->highlight) { + UI_ThemeColorBlend(color_id, TH_ACTIVE, 0.5f); + node->highlight = 0; + } + } uiSetRoundBox(UI_CNR_TOP_LEFT | UI_CNR_TOP_RIGHT); uiRoundBox(rct->xmin, rct->ymax-NODE_DY, rct->xmax, rct->ymax, BASIS_RAD); @@ -805,7 +811,7 @@ static void node_draw_basis(const bContext *C, ARegion *ar, SpaceNode *snode, bN glDisable(GL_BLEND); /* outline active and selected emphasis */ - if ( node->flag & (NODE_ACTIVE|SELECT) ) { + if ( node->flag & (NODE_ACTIVE|SELECT)) { glEnable(GL_BLEND); glEnable(GL_LINE_SMOOTH); @@ -862,7 +868,7 @@ static void node_draw_basis(const bContext *C, ARegion *ar, SpaceNode *snode, bN node->block= NULL; } -static void node_draw_hidden(const bContext *C, ARegion *ar, SpaceNode *snode, bNode *node) +static void node_draw_hidden(const bContext *C, ARegion *ar, SpaceNode *snode, bNodeTree *ntree, bNode *node) { bNodeSocket *sock; rctf *rct= &node->totr; @@ -879,10 +885,18 @@ static void node_draw_hidden(const bContext *C, ARegion *ar, SpaceNode *snode, b UI_ThemeColor(color_id); if (node->flag & NODE_MUTED) UI_ThemeColorBlend(color_id, TH_REDALERT, 0.5f); + + if (ntree->type == NTREE_COMPOSIT && (snode->flag&SNODE_SHOW_HIGHLIGHT)) { + if (node->highlight) { + UI_ThemeColorBlend(color_id, TH_ACTIVE, 0.5f); + node->highlight = 0; + } + } + uiRoundBox(rct->xmin, rct->ymin, rct->xmax, rct->ymax, hiddenrad); /* outline active and selected emphasis */ - if ( node->flag & (NODE_ACTIVE|SELECT) ) { + if ( node->flag & (NODE_ACTIVE|SELECT)) { glEnable(GL_BLEND); glEnable(GL_LINE_SMOOTH); @@ -1005,7 +1019,7 @@ void node_set_cursor(wmWindow *win, SpaceNode *snode) void node_draw_default(const bContext *C, ARegion *ar, SpaceNode *snode, bNodeTree *ntree, bNode *node) { if (node->flag & NODE_HIDDEN) - node_draw_hidden(C, ar, snode, node); + node_draw_hidden(C, ar, snode, ntree, node); else node_draw_basis(C, ar, snode, ntree, node); } diff --git a/source/blender/editors/space_node/node_edit.c b/source/blender/editors/space_node/node_edit.c index 48f772e8008..9a6906c43bc 100644 --- a/source/blender/editors/space_node/node_edit.c +++ b/source/blender/editors/space_node/node_edit.c @@ -1643,7 +1643,7 @@ void NODE_OT_backimage_zoom(wmOperatorType *ot) /* identifiers */ ot->name = "Background Image Zoom"; ot->idname = "NODE_OT_backimage_zoom"; - ot->description = "Zoom in/out the brackground image"; + ot->description = "Zoom in/out the background image"; /* api callbacks */ ot->exec = backimage_zoom; diff --git a/source/blender/editors/space_node/space_node.c b/source/blender/editors/space_node/space_node.c index 3a834ef6331..349259ad71b 100644 --- a/source/blender/editors/space_node/space_node.c +++ b/source/blender/editors/space_node/space_node.c @@ -448,8 +448,15 @@ static void node_region_listener(ARegion *ar, wmNotifier *wmn) ED_region_tag_redraw(ar); break; case NC_SCREEN: - if (wmn->data == ND_GPENCIL) - ED_region_tag_redraw(ar); + switch (wmn->data) { + case ND_GPENCIL: + ED_region_tag_redraw(ar); + break; + case ND_SCREENCAST: + case ND_ANIMPLAY: + ED_region_tag_redraw(ar); + break; + } break; case NC_SCENE: case NC_MATERIAL: diff --git a/source/blender/editors/space_outliner/outliner_draw.c b/source/blender/editors/space_outliner/outliner_draw.c index 2f5e32c61d1..42fdd5173d4 100644 --- a/source/blender/editors/space_outliner/outliner_draw.c +++ b/source/blender/editors/space_outliner/outliner_draw.c @@ -1541,7 +1541,7 @@ static void outliner_draw_tree(bContext *C, uiBlock *block, Scene *scene, ARegio starty = (int)ar->v2d.tot.ymax - UI_UNIT_Y - OL_Y_OFFSET; outliner_draw_selection(ar, soops, &soops->tree, &starty); - // grey hierarchy lines + // gray hierarchy lines UI_ThemeColorBlend(TH_BACK, TH_TEXT, 0.4f); starty = (int)ar->v2d.tot.ymax - UI_UNIT_Y / 2 - OL_Y_OFFSET; startx = 6; diff --git a/source/blender/editors/space_outliner/outliner_edit.c b/source/blender/editors/space_outliner/outliner_edit.c index eb740e441b7..449914feae4 100644 --- a/source/blender/editors/space_outliner/outliner_edit.c +++ b/source/blender/editors/space_outliner/outliner_edit.c @@ -1360,7 +1360,7 @@ void OUTLINER_OT_keyingset_add_selected(wmOperatorType *ot) /* identifiers */ ot->idname = "OUTLINER_OT_keyingset_add_selected"; ot->name = "Keying Set Add Selected"; - ot->description = "Add selected items (blue-grey rows) to active Keying Set"; + ot->description = "Add selected items (blue-gray rows) to active Keying Set"; /* api callbacks */ ot->exec = outliner_keyingset_additems_exec; @@ -1397,7 +1397,7 @@ void OUTLINER_OT_keyingset_remove_selected(wmOperatorType *ot) /* identifiers */ ot->idname = "OUTLINER_OT_keyingset_remove_selected"; ot->name = "Keying Set Remove Selected"; - ot->description = "Remove selected items (blue-grey rows) from active Keying Set"; + ot->description = "Remove selected items (blue-gray rows) from active Keying Set"; /* api callbacks */ ot->exec = outliner_keyingset_removeitems_exec; diff --git a/source/blender/editors/space_outliner/outliner_select.c b/source/blender/editors/space_outliner/outliner_select.c index 812fba50295..096713f9cd3 100644 --- a/source/blender/editors/space_outliner/outliner_select.c +++ b/source/blender/editors/space_outliner/outliner_select.c @@ -69,7 +69,7 @@ #include "outliner_intern.h" /* ****************************************************** */ -/* Outliner Selection (grey-blue highlight for rows) */ +/* Outliner Selection (gray-blue highlight for rows) */ static int outliner_select(SpaceOops *soops, ListBase *lb, int *index, short *selecting) { diff --git a/source/blender/editors/space_sequencer/sequencer_draw.c b/source/blender/editors/space_sequencer/sequencer_draw.c index 9148373cb2d..38f29e8816e 100644 --- a/source/blender/editors/space_sequencer/sequencer_draw.c +++ b/source/blender/editors/space_sequencer/sequencer_draw.c @@ -1076,7 +1076,7 @@ static void draw_seq_backdrop(View2D *v2d) { int i; - /* darker grey overlay over the view backdrop */ + /* darker gray overlay over the view backdrop */ UI_ThemeColorShade(TH_BACK, -20); glRectf(v2d->cur.xmin, -1.0, v2d->cur.xmax, 1.0); diff --git a/source/blender/editors/space_sequencer/sequencer_edit.c b/source/blender/editors/space_sequencer/sequencer_edit.c index 7ed5c77ed1f..1c3d2b61488 100644 --- a/source/blender/editors/space_sequencer/sequencer_edit.c +++ b/source/blender/editors/space_sequencer/sequencer_edit.c @@ -2805,7 +2805,7 @@ void SEQUENCER_OT_rebuild_proxy(wmOperatorType *ot) /* identifiers */ ot->name = "Rebuild Proxy and Timecode Indices"; ot->idname = "SEQUENCER_OT_rebuild_proxy"; - ot->description = "Rebuild all selected proxies and timecode indeces using the job system"; + ot->description = "Rebuild all selected proxies and timecode indices using the job system"; /* api callbacks */ ot->exec = sequencer_rebuild_proxy_exec; diff --git a/source/blender/editors/space_sequencer/space_sequencer.c b/source/blender/editors/space_sequencer/space_sequencer.c index b8bf764fabc..cabc761161e 100644 --- a/source/blender/editors/space_sequencer/space_sequencer.c +++ b/source/blender/editors/space_sequencer/space_sequencer.c @@ -454,6 +454,10 @@ static void sequencer_main_area_listener(ARegion *ar, wmNotifier *wmn) if (wmn->action == NA_RENAME) ED_region_tag_redraw(ar); break; + case NC_SCREEN: + if (ELEM(wmn->data, ND_SCREENCAST, ND_ANIMPLAY)) + ED_region_tag_redraw(ar); + break; } } diff --git a/source/blender/editors/space_time/space_time.c b/source/blender/editors/space_time/space_time.c index 01d27aaa0b3..a9315313d26 100644 --- a/source/blender/editors/space_time/space_time.c +++ b/source/blender/editors/space_time/space_time.c @@ -208,6 +208,9 @@ static void time_draw_cache(SpaceTime *stime, Object *ob) if (pid->cache->flag & PTCACHE_BAKED) { col[0] -= 0.4f; col[1] -= 0.4f; col[2] -= 0.4f; } + else if (pid->cache->flag & PTCACHE_OUTDATED) { + col[0] += 0.4f; col[1] += 0.4f; col[2] += 0.4f; + } glColor4fv(col); glEnableClientState(GL_VERTEX_ARRAY); @@ -699,4 +702,3 @@ void ED_spacetype_time(void) BKE_spacetype_register(st); } - diff --git a/source/blender/editors/space_view3d/drawarmature.c b/source/blender/editors/space_view3d/drawarmature.c index e51f7a312eb..cdaf7d5690f 100644 --- a/source/blender/editors/space_view3d/drawarmature.c +++ b/source/blender/editors/space_view3d/drawarmature.c @@ -709,9 +709,9 @@ static void draw_sphere_bone_dist(float smat[][4], float imat[][4], bPoseChannel glBegin(GL_QUAD_STRIP); for (a = 0; a < 16; a++) { - vec[0] = -*(si + a) * dirvec[0] + *(co + a) * norvec[0]; - vec[1] = -*(si + a) * dirvec[1] + *(co + a) * norvec[1]; - vec[2] = -*(si + a) * dirvec[2] + *(co + a) * norvec[2]; + vec[0] = -si[a] * dirvec[0] + co[a] * norvec[0]; + vec[1] = -si[a] * dirvec[1] + co[a] * norvec[1]; + vec[2] = -si[a] * dirvec[2] + co[a] * norvec[2]; madd_v3_v3v3fl(vec1, headvec, vec, head); madd_v3_v3v3fl(vec2, headvec, vec, head + dist); @@ -723,9 +723,9 @@ static void draw_sphere_bone_dist(float smat[][4], float imat[][4], bPoseChannel } for (a = 15; a >= 0; a--) { - vec[0] = *(si + a) * dirvec[0] + *(co + a) * norvec[0]; - vec[1] = *(si + a) * dirvec[1] + *(co + a) * norvec[1]; - vec[2] = *(si + a) * dirvec[2] + *(co + a) * norvec[2]; + vec[0] = si[a] * dirvec[0] + co[a] * norvec[0]; + vec[1] = si[a] * dirvec[1] + co[a] * norvec[1]; + vec[2] = si[a] * dirvec[2] + co[a] * norvec[2]; madd_v3_v3v3fl(vec1, tailvec, vec, tail); madd_v3_v3v3fl(vec2, tailvec, vec, tail + dist); @@ -737,9 +737,9 @@ static void draw_sphere_bone_dist(float smat[][4], float imat[][4], bPoseChannel } /* make it cyclic... */ - vec[0] = -*(si) * dirvec[0] + *(co) * norvec[0]; - vec[1] = -*(si) * dirvec[1] + *(co) * norvec[1]; - vec[2] = -*(si) * dirvec[2] + *(co) * norvec[2]; + vec[0] = -si[0] * dirvec[0] + co[0] * norvec[0]; + vec[1] = -si[0] * dirvec[1] + co[0] * norvec[1]; + vec[2] = -si[0] * dirvec[2] + co[0] * norvec[2]; madd_v3_v3v3fl(vec1, headvec, vec, head); madd_v3_v3v3fl(vec2, headvec, vec, head + dist); @@ -2269,7 +2269,7 @@ static void draw_ebones(View3D *v3d, ARegion *ar, Object *ob, const short dt) } } -/* ****************************** Armature Visualisation ******************************** */ +/* ****************************** Armature Visualization ******************************** */ /* ---------- Paths --------- */ diff --git a/source/blender/editors/space_view3d/drawvolume.c b/source/blender/editors/space_view3d/drawvolume.c index 7d39a89a130..60b3b911b1b 100644 --- a/source/blender/editors/space_view3d/drawvolume.c +++ b/source/blender/editors/space_view3d/drawvolume.c @@ -373,7 +373,7 @@ void draw_volume(ARegion *ar, GPUTexture *tex, float min[3], float max[3], int r /* d0 = (viewnormal[0]*cv[i][0] + viewnormal[1]*cv[i][1] + viewnormal[2]*cv[i][2]); */ /* UNUSED */ ds = (ABS(viewnormal[0]) * size[0] + ABS(viewnormal[1]) * size[1] + ABS(viewnormal[2]) * size[2]); - dd = ds/96.f; + dd = ds / 96.f; n = 0; good_index = i; diff --git a/source/blender/editors/space_view3d/view3d_buttons.c b/source/blender/editors/space_view3d/view3d_buttons.c index a9941dc326a..6cfa828024d 100644 --- a/source/blender/editors/space_view3d/view3d_buttons.c +++ b/source/blender/editors/space_view3d/view3d_buttons.c @@ -856,7 +856,7 @@ static void view3d_panel_vgroup(const bContext *C, Panel *pa) uiDefBut(block, BUT, B_VGRP_PNL_NORMALIZE, IFACE_("Normalize"), 0, yco, 100, 20, NULL, 0, 0, 0, 0, TIP_("Normalize active vertex weights")); uiDefBut(block, BUT, B_VGRP_PNL_COPY, IFACE_("Copy"), 100, yco, 100, 20, - NULL, 0, 0, 0, 0, TIP_("Copy active vertex to other seleted verts")); + NULL, 0, 0, 0, 0, TIP_("Copy active vertex to other selected verts")); uiBlockEndAlign(block); } } diff --git a/source/blender/editors/space_view3d/view3d_draw.c b/source/blender/editors/space_view3d/view3d_draw.c index 2d4fbb90ae1..3079719efe0 100644 --- a/source/blender/editors/space_view3d/view3d_draw.c +++ b/source/blender/editors/space_view3d/view3d_draw.c @@ -1561,7 +1561,12 @@ static void view3d_draw_bgpic(Scene *scene, ARegion *ar, View3D *v3d, if (ima == NULL) continue; BKE_image_user_frame_calc(&bgpic->iuser, CFRA, 0); - ibuf = BKE_image_get_ibuf(ima, &bgpic->iuser); + if (ima->source == IMA_SRC_SEQUENCE && !(bgpic->iuser.flag & IMA_USER_FRAME_IN_RANGE)) { + ibuf = NULL; /* frame is out of range, dont show */ + } + else { + ibuf = BKE_image_get_ibuf(ima, &bgpic->iuser); + } image_aspect[0] = ima->aspx; image_aspect[1] = ima->aspx; @@ -1569,6 +1574,8 @@ static void view3d_draw_bgpic(Scene *scene, ARegion *ar, View3D *v3d, else if (bgpic->source == V3D_BGPIC_MOVIE) { clip = NULL; + /* TODO: skip drawing when out of frame range (as image sequences do above) */ + if (bgpic->flag & V3D_BGPIC_CAMERACLIP) { if (scene->camera) clip = BKE_object_movieclip_get(scene, scene->camera, 1); diff --git a/source/blender/editors/space_view3d/view3d_edit.c b/source/blender/editors/space_view3d/view3d_edit.c index cc3d2d383b8..218aa71d621 100644 --- a/source/blender/editors/space_view3d/view3d_edit.c +++ b/source/blender/editors/space_view3d/view3d_edit.c @@ -2873,7 +2873,7 @@ static int viewnumpad_exec(bContext *C, wmOperator *op) break; case RV3D_VIEW_BACK: - axis_set_view(C, v3d, ar, 0.0, 0.0, (float)-cos(M_PI / 4.0), (float)-cos(M_PI / 4.0), + axis_set_view(C, v3d, ar, 0.0, 0.0, -cosf(M_PI / 4.0), -cosf(M_PI / 4.0), viewnum, nextperspo, align_active); break; @@ -2888,7 +2888,7 @@ static int viewnumpad_exec(bContext *C, wmOperator *op) break; case RV3D_VIEW_FRONT: - axis_set_view(C, v3d, ar, (float)cos(M_PI / 4.0), (float)-sin(M_PI / 4.0), 0.0, 0.0, + axis_set_view(C, v3d, ar, cosf(M_PI / 4.0), -sinf(M_PI / 4.0), 0.0, 0.0, viewnum, nextperspo, align_active); break; diff --git a/source/blender/editors/space_view3d/view3d_view.c b/source/blender/editors/space_view3d/view3d_view.c index 4782b95ba1c..b4350847552 100644 --- a/source/blender/editors/space_view3d/view3d_view.c +++ b/source/blender/editors/space_view3d/view3d_view.c @@ -1125,7 +1125,7 @@ int ED_view3d_lock(RegionView3D *rv3d) break; case RV3D_VIEW_BACK: - QUATSET(rv3d->viewquat, 0.0, 0.0, (float)-cos(M_PI / 4.0), (float)-cos(M_PI / 4.0)); + QUATSET(rv3d->viewquat, 0.0, 0.0, -cosf(M_PI / 4.0), -cosf(M_PI / 4.0)); break; case RV3D_VIEW_LEFT: @@ -1137,7 +1137,7 @@ int ED_view3d_lock(RegionView3D *rv3d) break; case RV3D_VIEW_FRONT: - QUATSET(rv3d->viewquat, (float)cos(M_PI / 4.0), (float)-sin(M_PI / 4.0), 0.0, 0.0); + QUATSET(rv3d->viewquat, (float)cos(M_PI / 4.0), -sinf(M_PI / 4.0), 0.0, 0.0); break; case RV3D_VIEW_RIGHT: diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c index 0f5f8970190..f20fa035d32 100644 --- a/source/blender/editors/transform/transform.c +++ b/source/blender/editors/transform/transform.c @@ -1389,8 +1389,8 @@ static void drawHelpline(bContext *UNUSED(C), int x, int y, void *customdata) float dx = t->mval[0] - cent[0], dy = t->mval[1] - cent[1]; float angle = atan2f(dy, dx); float dist = sqrtf(dx * dx + dy * dy); - float delta_angle = MIN2(15.0f / dist, (float)M_PI / 4.0f); - float spacing_angle = MIN2(5.0f / dist, (float)M_PI / 12.0f); + float delta_angle = minf(15.0f / dist, (float)M_PI / 4.0f); + float spacing_angle = minf(5.0f / dist, (float)M_PI / 12.0f); UI_ThemeColor(TH_WIRE); setlinestyle(3); @@ -5114,7 +5114,7 @@ void projectSVData(TransInfo *t, int final) } - if(!affected) + if (!affected) continue; /* only loop data, no vertex data since that contains shape keys, diff --git a/source/blender/editors/transform/transform_conversions.c b/source/blender/editors/transform/transform_conversions.c index af0b33d58ae..d7241555cc7 100644 --- a/source/blender/editors/transform/transform_conversions.c +++ b/source/blender/editors/transform/transform_conversions.c @@ -1829,7 +1829,7 @@ static void editmesh_set_connectivity_distance(BMEditMesh *em, float mtx[][3], f d2 = d + len_v3(vec); if (dists[BM_elem_index_get(v3)] != FLT_MAX) - dists[BM_elem_index_get(v3)] = MIN2(d2, dists[BM_elem_index_get(v3)]); + dists[BM_elem_index_get(v3)] = minf(d2, dists[BM_elem_index_get(v3)]); else dists[BM_elem_index_get(v3)] = d2; diff --git a/source/blender/editors/transform/transform_manipulator.c b/source/blender/editors/transform/transform_manipulator.c index b3ccf004810..1507dbfddda 100644 --- a/source/blender/editors/transform/transform_manipulator.c +++ b/source/blender/editors/transform/transform_manipulator.c @@ -745,7 +745,7 @@ static char axisBlendAngle(float angle) } /* three colors can be set; - * grey for ghosting + * gray for ghosting * moving: in transform theme color * else the red/green/blue */ diff --git a/source/blender/editors/transform/transform_snap.c b/source/blender/editors/transform/transform_snap.c index c49e1715f34..3847087111e 100644 --- a/source/blender/editors/transform/transform_snap.c +++ b/source/blender/editors/transform/transform_snap.c @@ -463,12 +463,10 @@ static void initSnappingMode(TransInfo *t) t->tsnap.mode = SCE_SNAP_MODE_INCREMENT; } } - else if (t->spacetype == SPACE_NODE) - { + else if (t->spacetype == SPACE_NODE) { setSnappingCallback(t); - if (t->tsnap.applySnap != NULL) - { + if (t->tsnap.applySnap != NULL) { t->tsnap.modeSelect = SNAP_NOT_SELECTED; } else { diff --git a/source/blender/editors/uvedit/uvedit_draw.c b/source/blender/editors/uvedit/uvedit_draw.c index d52463cf406..17c57b1f6e4 100644 --- a/source/blender/editors/uvedit/uvedit_draw.c +++ b/source/blender/editors/uvedit/uvedit_draw.c @@ -133,7 +133,7 @@ static void draw_uvs_shadow(Object *obedit) BMIter iter, liter; MLoopUV *luv; - /* draws the grey mesh when painting */ + /* draws the gray mesh when painting */ glColor3ub(112, 112, 112); BM_ITER_MESH (efa, &iter, bm, BM_FACES_OF_MESH) { diff --git a/source/blender/editors/uvedit/uvedit_ops.c b/source/blender/editors/uvedit/uvedit_ops.c index b15df9c3e89..216ac61b628 100644 --- a/source/blender/editors/uvedit/uvedit_ops.c +++ b/source/blender/editors/uvedit/uvedit_ops.c @@ -3402,7 +3402,8 @@ static void UV_OT_cursor_set(wmOperatorType *ot) ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; /* properties */ - RNA_def_float_vector(ot->srna, "location", 2, NULL, -FLT_MAX, FLT_MAX, "Location", "Cursor location in normalised (0.0-1.0) coordinates", -10.0f, 10.0f); + RNA_def_float_vector(ot->srna, "location", 2, NULL, -FLT_MAX, FLT_MAX, "Location", + "Cursor location in normalized (0.0-1.0) coordinates", -10.0f, 10.0f); } /********************** set tile operator **********************/ diff --git a/source/blender/editors/uvedit/uvedit_smart_stitch.c b/source/blender/editors/uvedit/uvedit_smart_stitch.c index 43f3e81ae92..5c2e57cf27f 100644 --- a/source/blender/editors/uvedit/uvedit_smart_stitch.c +++ b/source/blender/editors/uvedit/uvedit_smart_stitch.c @@ -403,7 +403,9 @@ static void stitch_island_calculate_edge_rotation(UvEdge *edge, StitchState *sta edgecos = uv1[0] * uv2[0] + uv1[1] * uv2[1]; edgesin = uv1[0] * uv2[1] - uv2[0] * uv1[1]; - rotation = (edgesin > 0.0f) ? acosf(MAX2(-1.0f, MIN2(1.0f, edgecos))) : -acosf(MAX2(-1.0f, MIN2(1.0f, edgecos))); + rotation = (edgesin > 0.0f) ? + +acosf(maxf(-1.0f, minf(1.0f, edgecos))) : + -acosf(maxf(-1.0f, minf(1.0f, edgecos))); island_stitch_data[element1->island].num_rot_elements++; island_stitch_data[element1->island].rotation += rotation; diff --git a/source/blender/gpu/intern/gpu_draw.c b/source/blender/gpu/intern/gpu_draw.c index 9d3463d3d19..8a31a454633 100644 --- a/source/blender/gpu/intern/gpu_draw.c +++ b/source/blender/gpu/intern/gpu_draw.c @@ -537,7 +537,7 @@ int GPU_verify_image(Image *ima, ImageUser *iuser, int tftile, int compare, int IMB_buffer_float_from_float(srgb_frect, ibuf->rect_float, ibuf->channels, IB_PROFILE_SRGB, ibuf->profile, 0, ibuf->x, ibuf->y, ibuf->x, ibuf->x); - /* clamp buffer colours to 1.0 to avoid artifacts due to glu for hdr images */ + /* clamp buffer colors to 1.0 to avoid artifacts due to glu for hdr images */ IMB_buffer_float_clamp(srgb_frect, ibuf->x, ibuf->y); frect= srgb_frect + texwinsy*ibuf->x + texwinsx; } @@ -562,7 +562,7 @@ int GPU_verify_image(Image *ima, ImageUser *iuser, int tftile, int compare, int IMB_buffer_float_from_float(srgb_frect, ibuf->rect_float, ibuf->channels, IB_PROFILE_SRGB, ibuf->profile, 0, ibuf->x, ibuf->y, ibuf->x, ibuf->x); - /* clamp buffer colours to 1.0 to avoid artifacts due to glu for hdr images */ + /* clamp buffer colors to 1.0 to avoid artifacts due to glu for hdr images */ IMB_buffer_float_clamp(srgb_frect, ibuf->x, ibuf->y); } else diff --git a/source/blender/ikplugin/intern/itasc_plugin.cpp b/source/blender/ikplugin/intern/itasc_plugin.cpp index 93934b41f28..a0d7bfbaaf6 100644 --- a/source/blender/ikplugin/intern/itasc_plugin.cpp +++ b/source/blender/ikplugin/intern/itasc_plugin.cpp @@ -812,7 +812,7 @@ static bool joint_callback(const iTaSC::Timestamp& timestamp, iTaSC::ConstraintV axis_angle_to_mat3(rmat, &chan->quat[1], chan->quat[0]); } else { - /* quats are normalised before use to eliminate scaling issues */ + /* quats are normalized before use to eliminate scaling issues */ normalize_qt(chan->quat); quat_to_mat3(rmat, chan->quat); } diff --git a/source/blender/imbuf/intern/cineon/cineon_dpx.c b/source/blender/imbuf/intern/cineon/cineon_dpx.c index 8e996b97622..182e0a7e29d 100644 --- a/source/blender/imbuf/intern/cineon/cineon_dpx.c +++ b/source/blender/imbuf/intern/cineon/cineon_dpx.c @@ -83,7 +83,7 @@ static ImBuf *imb_load_dpx_cineon(unsigned char *mem, int use_cineon, int size, logImageGetSize(image, &width, &height, &depth); - if (depth != 3) { /*need to do greyscale loading eventually.*/ + if (depth != 3) { /*need to do grayscale loading eventually.*/ logImageClose(image); return NULL; } diff --git a/source/blender/imbuf/intern/cineon/dpxfile.h b/source/blender/imbuf/intern/cineon/dpxfile.h index 8846c7418d5..e1d95268a80 100644 --- a/source/blender/imbuf/intern/cineon/dpxfile.h +++ b/source/blender/imbuf/intern/cineon/dpxfile.h @@ -62,7 +62,7 @@ typedef struct { R32 ref_high_quantity;/* reference high quantity represented */ U8 designator1; U8 transfer_characteristics; - U8 colourimetry; + U8 colorimetry; U8 bits_per_pixel; U16 packing; U16 encoding; diff --git a/source/blender/imbuf/intern/cineon/dpxlib.c b/source/blender/imbuf/intern/cineon/dpxlib.c index a4b8c9d3f36..c1138225e93 100644 --- a/source/blender/imbuf/intern/cineon/dpxlib.c +++ b/source/blender/imbuf/intern/cineon/dpxlib.c @@ -53,7 +53,7 @@ fillDpxChannelInfo(DpxFile* dpx, DpxChannelInformation* chan, int des) { chan->ref_high_quantity = htonf(2.046); chan->designator1 = des; chan->transfer_characteristics = 0; - chan->colourimetry = 0; + chan->colorimetry = 0; chan->bits_per_pixel = 10; chan->packing = htons(1); chan->encoding = 0; diff --git a/source/blender/imbuf/intern/jp2.c b/source/blender/imbuf/intern/jp2.c index 053d88c8c32..3008c233718 100644 --- a/source/blender/imbuf/intern/jp2.c +++ b/source/blender/imbuf/intern/jp2.c @@ -175,13 +175,13 @@ struct ImBuf *imb_jp2_decode(unsigned char *mem, size_t size, int flags) h = image->comps[0].h; switch (image->numcomps) { - case 1: /* Greyscale */ + case 1: /* Grayscale */ case 3: /* Color */ planes = 24; use_alpha = FALSE; break; - default: /* 2 or 4 - Greyscale or Color + alpha */ - planes = 32; /* greyscale + alpha */ + default: /* 2 or 4 - Grayscale or Color + alpha */ + planes = 32; /* grayscale + alpha */ use_alpha = TRUE; break; } @@ -220,7 +220,7 @@ struct ImBuf *imb_jp2_decode(unsigned char *mem, size_t size, int flags) r = image->comps[0].data; a = (use_alpha) ? image->comps[1].data : NULL; - /* greyscale 12bits+ */ + /* grayscale 12bits+ */ if (use_alpha) { a = image->comps[1].data; PIXEL_LOOPER_BEGIN(rect_float) { @@ -272,7 +272,7 @@ struct ImBuf *imb_jp2_decode(unsigned char *mem, size_t size, int flags) r = image->comps[0].data; a = (use_alpha) ? image->comps[1].data : NULL; - /* greyscale */ + /* grayscale */ if (use_alpha) { a = image->comps[3].data; PIXEL_LOOPER_BEGIN(rect_uchar) { diff --git a/source/blender/imbuf/intern/readimage.c b/source/blender/imbuf/intern/readimage.c index e78c4a55843..cb6cc2c082b 100644 --- a/source/blender/imbuf/intern/readimage.c +++ b/source/blender/imbuf/intern/readimage.c @@ -90,7 +90,7 @@ ImBuf *IMB_loadifffile(int file, int flags, const char *descr) size = BLI_file_descriptor_size(file); mem = mmap(NULL, size, PROT_READ, MAP_SHARED, file, 0); - if (mem == (unsigned char *)-1) { + if (mem == (unsigned char *) -1) { fprintf(stderr, "%s: couldn't get mapping %s\n", __func__, descr); return NULL; } @@ -178,7 +178,7 @@ static void imb_loadtilefile(ImBuf *ibuf, int file, int tx, int ty, unsigned int size = BLI_file_descriptor_size(file); mem = mmap(NULL, size, PROT_READ, MAP_SHARED, file, 0); - if (mem == (unsigned char *)-1) { + if (mem == (unsigned char *) -1) { fprintf(stderr, "Couldn't get memory mapping for %s\n", ibuf->cachename); return; } diff --git a/source/blender/imbuf/intern/tiff.c b/source/blender/imbuf/intern/tiff.c index 30dc61544b4..615b420429a 100644 --- a/source/blender/imbuf/intern/tiff.c +++ b/source/blender/imbuf/intern/tiff.c @@ -36,7 +36,7 @@ * high-level routine that loads all images as 32-bit RGBA, handling all the * required conversions between many different TIFF types internally. * - * Saving supports RGB, RGBA and BW (greyscale) images correctly, with + * Saving supports RGB, RGBA and BW (grayscale) images correctly, with * 8 bits per channel in all cases. The "deflate" compression algorithm is * used to compress images. */ @@ -765,7 +765,7 @@ int imb_savetiff(ImBuf *ibuf, const char *name, int flags) PHOTOMETRIC_RGB); } else if (samplesperpixel == 1) { - /* greyscale images, 1 channel */ + /* grayscale images, 1 channel */ TIFFSetField(image, TIFFTAG_PHOTOMETRIC, PHOTOMETRIC_MINISBLACK); } diff --git a/source/blender/makesdna/DNA_action_types.h b/source/blender/makesdna/DNA_action_types.h index a3918c3ca26..618590509b1 100644 --- a/source/blender/makesdna/DNA_action_types.h +++ b/source/blender/makesdna/DNA_action_types.h @@ -43,7 +43,7 @@ struct Group; struct GHash; /* ************************************************ */ -/* Visualisation */ +/* Visualization */ /* Motion Paths ------------------------------------ */ /* (used for Pose Channels and Objects) */ @@ -83,10 +83,10 @@ typedef enum eMotionPath_Flag { MOTIONPATH_FLAG_EDIT = (1 << 1) } eMotionPath_Flag; -/* Visualisation General --------------------------- */ +/* Visualization General --------------------------- */ /* for Objects or Poses (but NOT PoseChannels) */ -/* Animation Visualisation Settings (avs) */ +/* Animation Visualization Settings (avs) */ typedef struct bAnimVizSettings { /* Onion-Skinning Settings ----------------- */ int ghost_sf, ghost_ef; /* start and end frames of ghost-drawing range (only used for GHOST_TYPE_RANGE) */ @@ -254,7 +254,7 @@ typedef enum ePchan_Flag { /* IK/Pose solving*/ POSE_CHAIN = (1 << 9), POSE_DONE = (1 << 10), - /* visualisation */ + /* visualization */ POSE_KEY = (1 << 11), POSE_STRIDE = (1 << 12), /* standard IK solving */ @@ -680,7 +680,7 @@ typedef struct bActionChannel { /* Action Channel flags (ONLY USED FOR DO_VERSIONS...) */ typedef enum ACHAN_FLAG { ACHAN_SELECTED = (1 << 0), - ACHAN_HILIGHTED = (1 << 1), + ACHAN_HIGHLIGHTED = (1 << 1), ACHAN_HIDDEN = (1 << 2), ACHAN_PROTECTED = (1 << 3), ACHAN_EXPANDED = (1 << 4), diff --git a/source/blender/makesdna/DNA_armature_types.h b/source/blender/makesdna/DNA_armature_types.h index cc08d0e92bd..0afe3773c94 100644 --- a/source/blender/makesdna/DNA_armature_types.h +++ b/source/blender/makesdna/DNA_armature_types.h @@ -127,9 +127,9 @@ typedef enum eArmature_Flag { ARM_AUTO_IK = (1<<9), ARM_NO_CUSTOM = (1<<10), /* made option negative, for backwards compat */ ARM_COL_CUSTOM = (1<<11), /* draw custom colors */ - ARM_GHOST_ONLYSEL = (1<<12), /* when ghosting, only show selected bones (this should belong to ghostflag instead) */ // XXX depreceated + ARM_GHOST_ONLYSEL = (1<<12), /* when ghosting, only show selected bones (this should belong to ghostflag instead) */ /* XXX depreceated */ ARM_DS_EXPAND = (1<<13), /* dopesheet channel is expanded */ - ARM_HAS_VIZ_DEPS = (1<<14), /* other objects are used for visualising various states (hack for efficient updates) */ + ARM_HAS_VIZ_DEPS = (1<<14), /* other objects are used for visualizing various states (hack for efficient updates) */ } eArmature_Flag; /* armature->drawtype */ diff --git a/source/blender/makesdna/DNA_constraint_types.h b/source/blender/makesdna/DNA_constraint_types.h index 40362424532..b6036840401 100644 --- a/source/blender/makesdna/DNA_constraint_types.h +++ b/source/blender/makesdna/DNA_constraint_types.h @@ -464,7 +464,7 @@ typedef enum eBConstraint_Types { CONSTRAINT_TYPE_CLAMPTO = 18, /* clampto constraint */ CONSTRAINT_TYPE_TRANSFORM = 19, /* transformation (loc/rot/size -> loc/rot/size) constraint */ CONSTRAINT_TYPE_SHRINKWRAP = 20, /* shrinkwrap (loc/rot) constraint */ - CONSTRAINT_TYPE_DAMPTRACK = 21, /* New Tracking constraint that minimises twisting */ + CONSTRAINT_TYPE_DAMPTRACK = 21, /* New Tracking constraint that minimizes twisting */ CONSTRAINT_TYPE_SPLINEIK = 22, /* Spline-IK - Align 'n' bones to a curve */ CONSTRAINT_TYPE_TRANSLIKE = 23, /* Copy transform matrix */ CONSTRAINT_TYPE_SAMEVOL = 24, /* Maintain volume during scaling */ diff --git a/source/blender/makesdna/DNA_curve_types.h b/source/blender/makesdna/DNA_curve_types.h index f5c0148d9d0..56cf90d3d9d 100644 --- a/source/blender/makesdna/DNA_curve_types.h +++ b/source/blender/makesdna/DNA_curve_types.h @@ -116,7 +116,7 @@ typedef struct BPoint { float vec[4]; float alfa, weight; /* alfa: tilt in 3D View, weight: used for softbody goal weight */ short f1, hide; /* f1: selection status, hide: is point hidden or not */ - float radius, pad; /* user-set radius per point for bevelling etc */ + float radius, pad; /* user-set radius per point for beveling etc */ } BPoint; typedef struct Nurb { diff --git a/source/blender/makesdna/DNA_image_types.h b/source/blender/makesdna/DNA_image_types.h index f6c4822bb55..4a4b21017db 100644 --- a/source/blender/makesdna/DNA_image_types.h +++ b/source/blender/makesdna/DNA_image_types.h @@ -122,6 +122,7 @@ typedef struct Image { #define IMA_OLD_PREMUL 128 #define IMA_CM_PREDIVIDE 256 #define IMA_USED_FOR_RENDER 512 +#define IMA_USER_FRAME_IN_RANGE 1024 /* for image user, but these flags are mixed */ /* Image.tpageflag */ #define IMA_TILES 1 diff --git a/source/blender/makesdna/DNA_node_types.h b/source/blender/makesdna/DNA_node_types.h index 15641d97709..e4b5a264ba3 100644 --- a/source/blender/makesdna/DNA_node_types.h +++ b/source/blender/makesdna/DNA_node_types.h @@ -166,6 +166,7 @@ typedef struct bNode { struct bNode *parent; /* parent node */ struct ID *id; /* optional link to libdata */ void *storage; /* custom data, must be struct, for storage in file */ + struct bNode *original; /* the original node in the tree (for localized tree) */ float locx, locy; /* root offset for drawing */ float width, height; /* node custom width and height */ @@ -177,10 +178,11 @@ typedef struct bNode { char label[64]; /* custom user-defined label, MAX_NAME */ short custom1, custom2; /* to be abused for buttons */ float custom3, custom4; + int highlight; /* 0 = not highlighted, 1-N = highlighted*/ + int pad; short need_exec, exec; /* need_exec is set as UI execution event, exec is flag during exec */ void *threaddata; /* optional extra storage for use in thread (read only then!) */ - rctf totr; /* entire boundbox */ rctf butr; /* optional buttons area */ rctf prvr; /* optional preview area */ @@ -302,6 +304,7 @@ typedef struct bNodeTree { /* ntree->flag */ #define NTREE_DS_EXPAND 1 /* for animation editors */ #define NTREE_COM_OPENCL 2 /* use opencl */ +#define NTREE_TWO_PASS 4 /* two pass */ /* XXX not nice, but needed as a temporary flags * for group updates after library linking. */ diff --git a/source/blender/makesdna/DNA_object_force.h b/source/blender/makesdna/DNA_object_force.h index 854087b3b5b..1dd2aa6c59b 100644 --- a/source/blender/makesdna/DNA_object_force.h +++ b/source/blender/makesdna/DNA_object_force.h @@ -89,7 +89,7 @@ typedef struct PartDeflect { float pdef_perm; /* Chance of particle passing through mesh */ float pdef_frict; /* Friction factor for particle deflection */ float pdef_rfrict; /* Random element of friction for deflection */ - float pdef_stickness;/* surface particle stickness */ + float pdef_stickness;/* surface particle stickiness */ float absorption; /* used for forces */ diff --git a/source/blender/makesdna/DNA_object_types.h b/source/blender/makesdna/DNA_object_types.h index 1b42d889c1d..3da6d0fc99d 100644 --- a/source/blender/makesdna/DNA_object_types.h +++ b/source/blender/makesdna/DNA_object_types.h @@ -122,7 +122,7 @@ typedef struct Object { struct bGPdata *gpd; /* Grease Pencil data */ - bAnimVizSettings avs; /* settings for visualisation of object-transform animation */ + bAnimVizSettings avs; /* settings for visualization of object-transform animation */ bMotionPath *mpath; /* motion path cache for this object */ ListBase constraintChannels DNA_DEPRECATED; // XXX depreceated... old animation system diff --git a/source/blender/makesdna/DNA_space_types.h b/source/blender/makesdna/DNA_space_types.h index 2f6ea861cba..b3f0950fa75 100644 --- a/source/blender/makesdna/DNA_space_types.h +++ b/source/blender/makesdna/DNA_space_types.h @@ -875,11 +875,15 @@ typedef struct SpaceNode { /* snode->flag */ typedef enum eSpaceNode_Flag { - SNODE_BACKDRAW = (1 << 1), -/* SNODE_DISPGP = (1 << 2), */ /* XXX: Grease Pencil - deprecated? */ - SNODE_USE_ALPHA = (1 << 3), - SNODE_SHOW_ALPHA = (1 << 4), - SNODE_AUTO_RENDER = (1 << 5), + SNODE_BACKDRAW = (1 << 1), +/* SNODE_DISPGP = (1 << 2), */ /* XXX: Grease Pencil - deprecated? */ + SNODE_USE_ALPHA = (1 << 3), + SNODE_SHOW_ALPHA = (1 << 4), + SNODE_SHOW_R = (1 << 7), + SNODE_SHOW_G = (1 << 8), + SNODE_SHOW_B = (1 << 9), + SNODE_AUTO_RENDER = (1 << 5), + SNODE_SHOW_HIGHLIGHT = (1 << 6), } eSpaceNode_Flag; /* snode->texfrom */ diff --git a/source/blender/makesdna/DNA_windowmanager_types.h b/source/blender/makesdna/DNA_windowmanager_types.h index 5a49e45cf5e..780ca0b5878 100644 --- a/source/blender/makesdna/DNA_windowmanager_types.h +++ b/source/blender/makesdna/DNA_windowmanager_types.h @@ -112,7 +112,7 @@ typedef struct ReportList { # typedef struct ReportTimerInfo { float col[3]; - float greyscale; + float grayscale; float widthfac; } ReportTimerInfo; diff --git a/source/blender/makesrna/intern/rna_animviz.c b/source/blender/makesrna/intern/rna_animviz.c index 990d7c43309..68075823a86 100644 --- a/source/blender/makesrna/intern/rna_animviz.c +++ b/source/blender/makesrna/intern/rna_animviz.c @@ -183,7 +183,7 @@ static void rna_def_animviz_ghosts(BlenderRNA *brna) srna = RNA_def_struct(brna, "AnimVizOnionSkinning", NULL); RNA_def_struct_sdna(srna, "bAnimVizSettings"); RNA_def_struct_nested(brna, srna, "AnimViz"); - RNA_def_struct_ui_text(srna, "Onion Skinning Settings", "Onion Skinning settings for animation visualisation"); + RNA_def_struct_ui_text(srna, "Onion Skinning Settings", "Onion Skinning settings for animation visualization"); /* Enums */ prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE); @@ -256,7 +256,7 @@ static void rna_def_animviz_paths(BlenderRNA *brna) srna = RNA_def_struct(brna, "AnimVizMotionPaths", NULL); RNA_def_struct_sdna(srna, "bAnimVizSettings"); RNA_def_struct_nested(brna, srna, "AnimViz"); - RNA_def_struct_ui_text(srna, "Motion Path Settings", "Motion Path settings for animation visualisation"); + RNA_def_struct_ui_text(srna, "Motion Path Settings", "Motion Path settings for animation visualization"); /* Enums */ prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE); @@ -343,10 +343,10 @@ void rna_def_animviz_common(StructRNA *srna) { PropertyRNA *prop; - prop = RNA_def_property(srna, "animation_visualisation", PROP_POINTER, PROP_NONE); + prop = RNA_def_property(srna, "animation_visualization", PROP_POINTER, PROP_NONE); RNA_def_property_flag(prop, PROP_NEVER_NULL); RNA_def_property_pointer_sdna(prop, NULL, "avs"); - RNA_def_property_ui_text(prop, "Animation Visualisation", "Animation data for this datablock"); + RNA_def_property_ui_text(prop, "Animation Visualization", "Animation data for this datablock"); } static void rna_def_animviz(BlenderRNA *brna) @@ -356,21 +356,21 @@ static void rna_def_animviz(BlenderRNA *brna) srna = RNA_def_struct(brna, "AnimViz", NULL); RNA_def_struct_sdna(srna, "bAnimVizSettings"); - RNA_def_struct_ui_text(srna, "Animation Visualisation", "Settings for the visualisation of motion"); + RNA_def_struct_ui_text(srna, "Animation Visualization", "Settings for the visualization of motion"); /* onion-skinning settings (nested struct) */ prop = RNA_def_property(srna, "onion_skin_frames", PROP_POINTER, PROP_NONE); RNA_def_property_flag(prop, PROP_NEVER_NULL); RNA_def_property_struct_type(prop, "AnimVizOnionSkinning"); RNA_def_property_pointer_funcs(prop, "rna_AnimViz_onion_skinning_get", NULL, NULL, NULL); - RNA_def_property_ui_text(prop, "Onion Skinning", "Onion Skinning (ghosting) settings for visualisation"); + RNA_def_property_ui_text(prop, "Onion Skinning", "Onion Skinning (ghosting) settings for visualization"); /* motion path settings (nested struct) */ prop = RNA_def_property(srna, "motion_path", PROP_POINTER, PROP_NONE); RNA_def_property_flag(prop, PROP_NEVER_NULL); RNA_def_property_struct_type(prop, "AnimVizMotionPaths"); RNA_def_property_pointer_funcs(prop, "rna_AnimViz_motion_paths_get", NULL, NULL, NULL); - RNA_def_property_ui_text(prop, "Motion Paths", "Motion Path settings for visualisation"); + RNA_def_property_ui_text(prop, "Motion Paths", "Motion Path settings for visualization"); } /* --- */ diff --git a/source/blender/makesrna/intern/rna_boid.c b/source/blender/makesrna/intern/rna_boid.c index f803a8b67ea..2a6ea2994fa 100644 --- a/source/blender/makesrna/intern/rna_boid.c +++ b/source/blender/makesrna/intern/rna_boid.c @@ -50,7 +50,7 @@ EnumPropertyItem boidrule_type_items[] = { {eBoidRuleType_Goal, "GOAL", 0, "Goal", "Go to assigned object or loudest assigned signal source"}, {eBoidRuleType_Avoid, "AVOID", 0, "Avoid", "Get away from assigned object or loudest assigned signal source"}, {eBoidRuleType_AvoidCollision, "AVOID_COLLISION", 0, "Avoid Collision", - "Manoeuvre to avoid collisions with other boids and deflector objects in " + "Maneuver to avoid collisions with other boids and deflector objects in " "near future"}, {eBoidRuleType_Separate, "SEPARATE", 0, "Separate", "Keep from going through other boids"}, {eBoidRuleType_Flock, "FLOCK", 0, "Flock", "Move to center of neighbors and match their velocity"}, diff --git a/source/blender/makesrna/intern/rna_constraint.c b/source/blender/makesrna/intern/rna_constraint.c index e44d6a11136..8d718715e5b 100644 --- a/source/blender/makesrna/intern/rna_constraint.c +++ b/source/blender/makesrna/intern/rna_constraint.c @@ -109,7 +109,7 @@ static EnumPropertyItem owner_space_pchan_items[] = { "The constraint is applied relative to the local coordinate system of the object, " "with the parent transformation added"}, {CONSTRAINT_SPACE_LOCAL, "LOCAL", 0, "Local Space", - "The constraint is applied relative to the local coordinate sytem of the object"}, + "The constraint is applied relative to the local coordinate system of the object"}, {0, NULL, 0, NULL, NULL} }; diff --git a/source/blender/makesrna/intern/rna_curve.c b/source/blender/makesrna/intern/rna_curve.c index e74d192b13f..c333c56a6b8 100644 --- a/source/blender/makesrna/intern/rna_curve.c +++ b/source/blender/makesrna/intern/rna_curve.c @@ -754,7 +754,7 @@ static void rna_def_bpoint(BlenderRNA *brna) prop = RNA_def_property(srna, "radius", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "radius"); RNA_def_property_range(prop, 0.0f, FLT_MAX); - RNA_def_property_ui_text(prop, "Bevel Radius", "Radius for bevelling"); + RNA_def_property_ui_text(prop, "Bevel Radius", "Radius for beveling"); RNA_def_property_update(prop, 0, "rna_Curve_update_data"); RNA_def_struct_path_func(srna, "rna_Curve_spline_point_path"); @@ -840,7 +840,7 @@ static void rna_def_beztriple(BlenderRNA *brna) prop = RNA_def_property(srna, "radius", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "radius"); RNA_def_property_range(prop, 0.0f, FLT_MAX); - RNA_def_property_ui_text(prop, "Bevel Radius", "Radius for bevelling"); + RNA_def_property_ui_text(prop, "Bevel Radius", "Radius for beveling"); RNA_def_property_update(prop, 0, "rna_Curve_update_data"); RNA_def_struct_path_func(srna, "rna_Curve_spline_point_path"); @@ -1003,7 +1003,7 @@ static void rna_def_font(BlenderRNA *UNUSED(brna), StructRNA *srna) RNA_def_property_string_maxlength(prop, MAX_ID_NAME - 2); RNA_def_property_ui_text(prop, "Object Font", "Use Blender Objects as font characters (give font objects a common name " - "followed by the character they represent, eg. familya, familyb, etc, " + "followed by the character they represent, eg. family_a, family_b, etc, " "and turn on Verts Duplication)"); RNA_def_property_update(prop, 0, "rna_Curve_update_data"); @@ -1436,7 +1436,7 @@ static void rna_def_curve(BlenderRNA *brna) prop = RNA_def_property(srna, "use_fill_caps", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", CU_FILL_CAPS); - RNA_def_property_ui_text(prop, "Fill Caps", "Fill caps for bevelled curves"); + RNA_def_property_ui_text(prop, "Fill Caps", "Fill caps for beveled curves"); RNA_def_property_update(prop, 0, "rna_Curve_update_data"); /* texture space */ @@ -1640,7 +1640,7 @@ static void rna_def_curve_nurb(BlenderRNA *brna) prop = RNA_def_property(srna, "hide", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "hide", 1); - RNA_def_property_ui_text(prop, "Hide", "Hide this curve in editmode"); + RNA_def_property_ui_text(prop, "Hide", "Hide this curve in Edit mode"); RNA_def_property_update(prop, 0, "rna_Curve_update_data"); prop = RNA_def_property(srna, "material_index", PROP_INT, PROP_UNSIGNED); diff --git a/source/blender/makesrna/intern/rna_dynamicpaint.c b/source/blender/makesrna/intern/rna_dynamicpaint.c index 4bfcabc935b..6739e5b71fa 100644 --- a/source/blender/makesrna/intern/rna_dynamicpaint.c +++ b/source/blender/makesrna/intern/rna_dynamicpaint.c @@ -469,7 +469,7 @@ static void rna_def_canvas_surface(BlenderRNA *brna) prop = RNA_def_property(srna, "use_antialiasing", PROP_BOOLEAN, PROP_NONE); RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_DPAINT_ANTIALIAS); - RNA_def_property_ui_text(prop, "Anti-aliasing", "Use 5x multisampling to smoothen paint edges"); + RNA_def_property_ui_text(prop, "Anti-aliasing", "Use 5x multisampling to smooth paint edges"); RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_DynamicPaintSurface_reset"); prop = RNA_def_property(srna, "brush_influence_scale", PROP_FLOAT, PROP_FACTOR); @@ -677,7 +677,7 @@ static void rna_def_canvas_surface(BlenderRNA *brna) prop = RNA_def_property(srna, "wave_speed", PROP_FLOAT, PROP_NONE); RNA_def_property_range(prop, 0.01, 5.0); RNA_def_property_ui_range(prop, 0.20, 4.0, 1, 2); - RNA_def_property_ui_text(prop, "Speed", "Wave propogation speed"); + RNA_def_property_ui_text(prop, "Speed", "Wave propagation speed"); prop = RNA_def_property(srna, "wave_timescale", PROP_FLOAT, PROP_NONE); RNA_def_property_range(prop, 0.01, 3.0); diff --git a/source/blender/makesrna/intern/rna_fcurve.c b/source/blender/makesrna/intern/rna_fcurve.c index 144b8a7f90c..5eb15cf31b6 100644 --- a/source/blender/makesrna/intern/rna_fcurve.c +++ b/source/blender/makesrna/intern/rna_fcurve.c @@ -688,7 +688,7 @@ static void rna_def_fmodifier_function_generator(BlenderRNA *brna) {2, "TAN", 0, "Tangent", ""}, {3, "SQRT", 0, "Square Root", ""}, {4, "LN", 0, "Natural Logarithm", ""}, - {5, "SINC", 0, "Normalised Sine", "sin(x) / x"}, + {5, "SINC", 0, "Normalized Sine", "sin(x) / x"}, {0, NULL, 0, NULL, NULL} }; diff --git a/source/blender/makesrna/intern/rna_fluidsim.c b/source/blender/makesrna/intern/rna_fluidsim.c index 8dd1bc86ca1..e84a290acb8 100644 --- a/source/blender/makesrna/intern/rna_fluidsim.c +++ b/source/blender/makesrna/intern/rna_fluidsim.c @@ -349,7 +349,7 @@ static void rna_def_fluidsim_domain(BlenderRNA *brna) prop = RNA_def_property(srna, "simulation_scale", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "realsize"); RNA_def_property_range(prop, 0.001, 10); - RNA_def_property_ui_text(prop, "Real World Size", "Size of the simulation domain in metres"); + RNA_def_property_ui_text(prop, "Real World Size", "Size of the simulation domain in meters"); prop = RNA_def_property(srna, "simulation_rate", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "animRate"); @@ -461,8 +461,9 @@ static void rna_def_fluidsim_volume(StructRNA *srna) RNA_def_property_boolean_sdna(prop, NULL, "domainNovecgen", 0); RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); RNA_def_property_ui_text(prop, "Export Animated Mesh", - "Export this mesh as an animated one (slower, only use if really necessary [e.g. " - "armatures or parented objects], animated pos/rot/scale F-Curves do not require it)"); + "Export this mesh as an animated one (slower and enforces No Slip, only use if really " + "necessary [e.g. armatures or parented objects], animated pos/rot/scale F-Curves " + "do not require it)"); } static void rna_def_fluidsim_active(StructRNA *srna) diff --git a/source/blender/makesrna/intern/rna_key.c b/source/blender/makesrna/intern/rna_key.c index c2d730f5ed9..5334c10c4c6 100644 --- a/source/blender/makesrna/intern/rna_key.c +++ b/source/blender/makesrna/intern/rna_key.c @@ -639,7 +639,7 @@ static void rna_def_key(BlenderRNA *brna) RNA_def_property_int_sdna(prop, NULL, "slurph"); RNA_def_property_range(prop, -500, 500); RNA_def_property_ui_text(prop, "Slurph", - "Create a delay (in frames) in applying keypositions, first vertex goes first"); + "Create a delay (in frames) in applying key positions, first vertex goes first"); RNA_def_property_update(prop, 0, "rna_Key_update_data"); } diff --git a/source/blender/makesrna/intern/rna_material.c b/source/blender/makesrna/intern/rna_material.c index 3cee8ca271c..4523858d639 100644 --- a/source/blender/makesrna/intern/rna_material.c +++ b/source/blender/makesrna/intern/rna_material.c @@ -776,7 +776,7 @@ static void rna_def_material_gamesettings(BlenderRNA *brna) }; static EnumPropertyItem prop_face_orientation_items[] = { - {GEMAT_NORMAL, "NORMAL", 0, "Normal", "No tranformation"}, + {GEMAT_NORMAL, "NORMAL", 0, "Normal", "No transformation"}, {GEMAT_HALO, "HALO", 0, "Halo", "Screen aligned billboard"}, {GEMAT_BILLBOARD, "BILLBOARD", 0, "Billboard", "Billboard with Z-axis constraint"}, {GEMAT_SHADOW, "SHADOW", 0, "Shadow", "Faces are used for shadow"}, diff --git a/source/blender/makesrna/intern/rna_mesh.c b/source/blender/makesrna/intern/rna_mesh.c index 9dd58dd780e..74eaca99507 100644 --- a/source/blender/makesrna/intern/rna_mesh.c +++ b/source/blender/makesrna/intern/rna_mesh.c @@ -1939,7 +1939,7 @@ static void rna_def_msticky(BlenderRNA *brna) srna = RNA_def_struct(brna, "MeshSticky", NULL); RNA_def_struct_sdna(srna, "MSticky"); - RNA_def_struct_ui_text(srna, "Mesh Vertex Sticky Texture Coordinate", "Stricky texture coordinate"); + RNA_def_struct_ui_text(srna, "Mesh Vertex Sticky Texture Coordinate", "Sticky texture coordinate"); RNA_def_struct_path_func(srna, "rna_MeshSticky_path"); prop = RNA_def_property(srna, "co", PROP_FLOAT, PROP_XYZ); @@ -2874,7 +2874,8 @@ static void rna_def_mesh(BlenderRNA *brna) prop = RNA_def_property(srna, "show_edges", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "drawflag", ME_DRAWEDGES); - RNA_def_property_ui_text(prop, "Draw Edges", "Display selected edges using hilights in the 3D view and UV editor"); + RNA_def_property_ui_text(prop, "Draw Edges", + "Display selected edges using highlights in the 3D view and UV editor"); RNA_def_property_update(prop, 0, "rna_Mesh_update_draw"); prop = RNA_def_property(srna, "show_all_edges", PROP_BOOLEAN, PROP_NONE); diff --git a/source/blender/makesrna/intern/rna_modifier.c b/source/blender/makesrna/intern/rna_modifier.c index e9b3faa2c86..084cda87507 100644 --- a/source/blender/makesrna/intern/rna_modifier.c +++ b/source/blender/makesrna/intern/rna_modifier.c @@ -2811,8 +2811,8 @@ static void rna_def_modifier_weightvgmix(BlenderRNA *brna) {MOD_WVG_MIX_SUB, "SUB", 0, "Subtract", "Subtract VGroup B's weights from VGroup A's ones"}, {MOD_WVG_MIX_MUL, "MUL", 0, "Multiply", "Multiply VGroup A's weights by VGroup B's ones"}, {MOD_WVG_MIX_DIV, "DIV", 0, "Divide", "Divide VGroup A's weights by VGroup B's ones"}, - {MOD_WVG_MIX_DIF, "DIF", 0, "Difference", "Difference between VGroup A's and VGroup B's weigths"}, - {MOD_WVG_MIX_AVG, "AVG", 0, "Average", "Average value of VGroup A's and VGroup B's weigths"}, + {MOD_WVG_MIX_DIF, "DIF", 0, "Difference", "Difference between VGroup A's and VGroup B's weights"}, + {MOD_WVG_MIX_AVG, "AVG", 0, "Average", "Average value of VGroup A's and VGroup B's weights"}, {0, NULL, 0, NULL, NULL} }; @@ -3236,17 +3236,17 @@ static void rna_def_modifier_skin(BlenderRNA *brna) prop = RNA_def_property(srna, "use_x_symmetry", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "symmetry_axes", MOD_SKIN_SYMM_X); - RNA_def_property_ui_text(prop, "X", "Avoid making unsymmetric quads across the X axis"); + RNA_def_property_ui_text(prop, "X", "Avoid making unsymmetrical quads across the X axis"); RNA_def_property_update(prop, 0, "rna_Modifier_update"); prop = RNA_def_property(srna, "use_y_symmetry", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "symmetry_axes", MOD_SKIN_SYMM_Y); - RNA_def_property_ui_text(prop, "Y", "Avoid making unsymmetric quads across the Y axis"); + RNA_def_property_ui_text(prop, "Y", "Avoid making unsymmetrical quads across the Y axis"); RNA_def_property_update(prop, 0, "rna_Modifier_update"); prop = RNA_def_property(srna, "use_z_symmetry", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "symmetry_axes", MOD_SKIN_SYMM_Z); - RNA_def_property_ui_text(prop, "Z", "Avoid making unsymmetric quads across the Z axis"); + RNA_def_property_ui_text(prop, "Z", "Avoid making unsymmetrical quads across the Z axis"); RNA_def_property_update(prop, 0, "rna_Modifier_update"); } @@ -3292,7 +3292,7 @@ void RNA_def_modifier(BlenderRNA *brna) prop = RNA_def_property(srna, "show_in_editmode", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "mode", eModifierMode_Editmode); - RNA_def_property_ui_text(prop, "Editmode", "Use modifier while in the edit mode"); + RNA_def_property_ui_text(prop, "Edit Mode", "Use modifier while in the Edit mode"); RNA_def_property_update(prop, 0, "rna_Modifier_update"); RNA_def_property_ui_icon(prop, ICON_EDITMODE_HLT, 0); diff --git a/source/blender/makesrna/intern/rna_nodetree.c b/source/blender/makesrna/intern/rna_nodetree.c index cb1a45ed971..a39c168c594 100644 --- a/source/blender/makesrna/intern/rna_nodetree.c +++ b/source/blender/makesrna/intern/rna_nodetree.c @@ -3259,7 +3259,7 @@ static void def_cmp_ellipsemask(StructRNA *srna) RNA_def_property_float_sdna(prop, NULL, "rotation"); RNA_def_property_float_default(prop, 0.0f); RNA_def_property_range(prop, -1000.0f, 1000.0f); - RNA_def_property_ui_text(prop, "Rotation", "Rotationangle of the box"); + RNA_def_property_ui_text(prop, "Rotation", "Rotation angle of the box"); RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update"); } @@ -4267,6 +4267,11 @@ static void rna_def_composite_nodetree(BlenderRNA *brna) prop = RNA_def_property(srna, "use_opencl", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", NTREE_COM_OPENCL); RNA_def_property_ui_text(prop, "OpenCL", "Enable GPU calculations"); + + prop = RNA_def_property(srna, "two_pass", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flag", NTREE_TWO_PASS); + RNA_def_property_ui_text(prop, "Two Pass", "Use two pass execution during editing: first calculate fast nodes, " + "second pass calculate all nodes"); } static void rna_def_shader_nodetree(BlenderRNA *brna) diff --git a/source/blender/makesrna/intern/rna_object.c b/source/blender/makesrna/intern/rna_object.c index 51c49cf9e53..ce6b028beb5 100644 --- a/source/blender/makesrna/intern/rna_object.c +++ b/source/blender/makesrna/intern/rna_object.c @@ -1449,7 +1449,8 @@ static void rna_def_object_game_settings(BlenderRNA *brna) "Collision Sensor, detects static and dynamic objects but not the other " "collision sensor objects"}, {OB_BODY_TYPE_NAVMESH, "NAVMESH", 0, "Navigation Mesh", "Navigation mesh"}, - {OB_BODY_TYPE_CHARACTER, "CHARACTER", 0, "Character", "Simple kinematic physics appropiate for game characters"}, + {OB_BODY_TYPE_CHARACTER, "CHARACTER", 0, "Character", + "Simple kinematic physics appropriate for game characters"}, {0, NULL, 0, NULL, NULL} }; @@ -1507,7 +1508,7 @@ static void rna_def_object_game_settings(BlenderRNA *brna) prop = RNA_def_property(srna, "use_ghost", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "gameflag", OB_GHOST); - RNA_def_property_ui_text(prop, "Ghost", "Object does not restitute collisions, like a ghost"); + RNA_def_property_ui_text(prop, "Ghost", "Object does not react to collisions, like a ghost"); prop = RNA_def_property(srna, "mass", PROP_FLOAT, PROP_NONE); RNA_def_property_range(prop, 0.01, 10000.0); diff --git a/source/blender/makesrna/intern/rna_object_force.c b/source/blender/makesrna/intern/rna_object_force.c index 25866dd996f..1c896133408 100644 --- a/source/blender/makesrna/intern/rna_object_force.c +++ b/source/blender/makesrna/intern/rna_object_force.c @@ -901,10 +901,10 @@ static void rna_def_collision(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Kill Particles", "Kill collided particles"); RNA_def_property_update(prop, 0, "rna_CollisionSettings_update"); - prop = RNA_def_property(srna, "stickness", PROP_FLOAT, PROP_NONE); + prop = RNA_def_property(srna, "stickiness", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "pdef_stickness"); RNA_def_property_range(prop, 0.0f, 10.0f); - RNA_def_property_ui_text(prop, "Stickness", "Amount of stickness to surface collision"); + RNA_def_property_ui_text(prop, "Stickiness", "Amount of stickiness to surface collision"); RNA_def_property_update(prop, 0, "rna_CollisionSettings_update"); /* Soft Body and Cloth Interaction */ diff --git a/source/blender/makesrna/intern/rna_pose.c b/source/blender/makesrna/intern/rna_pose.c index bb8a29f8fe4..35c85f0f40e 100644 --- a/source/blender/makesrna/intern/rna_pose.c +++ b/source/blender/makesrna/intern/rna_pose.c @@ -142,9 +142,9 @@ void rna_ActionGroup_colorset_set(PointerRNA *ptr, int value) /* ensure only valid values get set */ if ((value >= -1) && (value < 21)) { grp->customCol = value; - + /* sync colors stored with theme colors based on the index specified */ - action_group_colors_sync(grp); + action_group_colors_sync(grp, NULL); } } diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c index 550463a947a..75baba7156a 100644 --- a/source/blender/makesrna/intern/rna_scene.c +++ b/source/blender/makesrna/intern/rna_scene.c @@ -766,7 +766,7 @@ static EnumPropertyItem *rna_ImageFormatSettings_color_mode_itemf(bContext *C, P const char is_render = (id && GS(id->name) == ID_SCE); /* note, we need to act differently for render - * where 'BW' will force greyscale even if the output format writes + * where 'BW' will force grayscale even if the output format writes * as RGBA, this is age old blender convention and not sure how useful * it really is but keep it for now - campbell */ char chan_flag = BKE_imtype_valid_channels(imf->imtype) | (is_render ? IMA_CHAN_FLAG_BW : 0); @@ -2896,7 +2896,7 @@ static void rna_def_scene_game_data(BlenderRNA *brna) prop = RNA_def_property(srna, "use_desktop", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "playerflag", GAME_PLAYER_DESKTOP_RESOLUTION); - RNA_def_property_ui_text(prop, "Desktop", "Uses the current desktop resultion in fullscreen mode"); + RNA_def_property_ui_text(prop, "Desktop", "Use the current desktop resolution in fullscreen mode"); RNA_def_property_update(prop, NC_SCENE, NULL); /* Framing */ @@ -3301,7 +3301,7 @@ static void rna_def_scene_image_format_data(BlenderRNA *brna) RNA_def_property_enum_items(prop, image_color_mode_items); RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_ImageFormatSettings_color_mode_itemf"); RNA_def_property_ui_text(prop, "Color Mode", - "Choose BW for saving greyscale images, RGB for saving red, green and blue channels, " + "Choose BW for saving grayscale images, RGB for saving red, green and blue channels, " "and RGBA for saving red, green, blue and alpha channels"); RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL); diff --git a/source/blender/makesrna/intern/rna_screen.c b/source/blender/makesrna/intern/rna_screen.c index 6e5aa78b8bd..d405cba6607 100644 --- a/source/blender/makesrna/intern/rna_screen.c +++ b/source/blender/makesrna/intern/rna_screen.c @@ -296,7 +296,7 @@ static void rna_def_screen(BlenderRNA *brna) prop = RNA_def_property(srna, "show_fullscreen", PROP_BOOLEAN, PROP_NONE); RNA_def_property_clear_flag(prop, PROP_EDITABLE); RNA_def_property_boolean_funcs(prop, "rna_Screen_fullscreen_get", NULL); - RNA_def_property_ui_text(prop, "Fullscreen", "An area is maximised, filling this screen"); + RNA_def_property_ui_text(prop, "Fullscreen", "An area is maximized, filling this screen"); /* Define Anim Playback Areas */ prop = RNA_def_property(srna, "use_play_top_left_3d_editor", PROP_BOOLEAN, PROP_NONE); diff --git a/source/blender/makesrna/intern/rna_smoke.c b/source/blender/makesrna/intern/rna_smoke.c index 4224b3936c6..e8818248609 100644 --- a/source/blender/makesrna/intern/rna_smoke.c +++ b/source/blender/makesrna/intern/rna_smoke.c @@ -296,7 +296,7 @@ static void rna_def_smoke_domain_settings(BlenderRNA *brna) prop = RNA_def_property(srna, "smooth_emitter", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_SMOKE_HIGH_SMOOTH); - RNA_def_property_ui_text(prop, "Smooth Emitter", "Smoothen emitted smoke to avoid blockiness"); + RNA_def_property_ui_text(prop, "Smooth Emitter", "Smooth emitted smoke to avoid blockiness"); RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_reset"); prop = RNA_def_property(srna, "time_scale", PROP_FLOAT, PROP_NONE); diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c index e4af06a5012..d5bac7a8c26 100644 --- a/source/blender/makesrna/intern/rna_space.c +++ b/source/blender/makesrna/intern/rna_space.c @@ -2303,7 +2303,7 @@ static void rna_def_space_dopesheet(BlenderRNA *brna) prop = RNA_def_property(srna, "show_group_colors", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", SACTION_NODRAWGCOLORS); RNA_def_property_ui_text(prop, "Show Group Colors", - "Draw groups and channels with colours matching their corresponding groups"); + "Draw groups and channels with colors matching their corresponding groups"); RNA_def_property_update(prop, NC_SPACE | ND_SPACE_DOPESHEET, NULL); /* editing */ @@ -2414,7 +2414,7 @@ static void rna_def_space_graph(BlenderRNA *brna) prop = RNA_def_property(srna, "show_group_colors", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", SIPO_NODRAWGCOLORS); RNA_def_property_ui_text(prop, "Show Group Colors", - "Draw groups and channels with colours matching their corresponding groups"); + "Draw groups and channels with colors matching their corresponding groups"); RNA_def_property_update(prop, NC_SPACE | ND_SPACE_GRAPH, NULL); /* editing */ @@ -2852,6 +2852,10 @@ static void rna_def_space_node(BlenderRNA *brna) {SNODE_USE_ALPHA, "COLOR_ALPHA", ICON_IMAGE_RGB_ALPHA, "Color and Alpha", "Draw image with RGB colors and alpha transparency"}, {SNODE_SHOW_ALPHA, "ALPHA", ICON_IMAGE_ALPHA, "Alpha", "Draw alpha transparency channel"}, + /* XXX, we could use better icons here */ + {SNODE_SHOW_R, "RED", ICON_COLOR, "Red", ""}, + {SNODE_SHOW_G, "GREEN", ICON_COLOR, "Green", ""}, + {SNODE_SHOW_B, "BLUE", ICON_COLOR, "Blue", ""}, {0, NULL, 0, NULL, NULL} }; @@ -2926,6 +2930,11 @@ static void rna_def_space_node(BlenderRNA *brna) RNA_def_property_enum_items(prop, backdrop_channels_items); RNA_def_property_ui_text(prop, "Draw Channels", "Channels of the image to draw"); RNA_def_property_update(prop, NC_SPACE | ND_SPACE_NODE_VIEW, NULL); + + prop = RNA_def_property(srna, "show_highlight", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flag", SNODE_SHOW_HIGHLIGHT); + RNA_def_property_ui_text(prop, "Highlight", "Highlight nodes that are being calculated"); + RNA_def_property_update(prop, NC_SPACE | ND_SPACE_NODE_VIEW, NULL); } static void rna_def_space_logic(BlenderRNA *brna) diff --git a/source/blender/makesrna/intern/rna_texture.c b/source/blender/makesrna/intern/rna_texture.c index 9b709e9ace1..0270a7643a6 100644 --- a/source/blender/makesrna/intern/rna_texture.c +++ b/source/blender/makesrna/intern/rna_texture.c @@ -841,7 +841,7 @@ static void rna_def_texture_clouds(BlenderRNA *brna) PropertyRNA *prop; static EnumPropertyItem prop_clouds_stype[] = { - {TEX_DEFAULT, "GREYSCALE", 0, "Greyscale", ""}, + {TEX_DEFAULT, "GRAYSCALE", 0, "Grayscale", ""}, {TEX_COLOR, "COLOR", 0, "Color", ""}, {0, NULL, 0, NULL, NULL} }; @@ -1783,7 +1783,7 @@ static void rna_def_texture_voxeldata(BlenderRNA *brna) static EnumPropertyItem file_format_items[] = { {TEX_VD_BLENDERVOXEL, "BLENDER_VOXEL", 0, "Blender Voxel", "Default binary voxel file format"}, - {TEX_VD_RAW_8BIT, "RAW_8BIT", 0, "8 bit RAW", "8 bit greyscale binary data"}, + {TEX_VD_RAW_8BIT, "RAW_8BIT", 0, "8 bit RAW", "8 bit grayscale binary data"}, /*{TEX_VD_RAW_16BIT, "RAW_16BIT", 0, "16 bit RAW", ""}, */ {TEX_VD_IMAGE_SEQUENCE, "IMAGE_SEQUENCE", 0, "Image Sequence", "Generate voxels from a sequence of image slices"}, diff --git a/source/blender/makesrna/intern/rna_tracking.c b/source/blender/makesrna/intern/rna_tracking.c index 801bec30ecf..63e650d5867 100644 --- a/source/blender/makesrna/intern/rna_tracking.c +++ b/source/blender/makesrna/intern/rna_tracking.c @@ -636,7 +636,7 @@ static void rna_def_trackingSettings(BlenderRNA *brna) RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); RNA_def_property_int_sdna(prop, NULL, "default_margin"); RNA_def_property_range(prop, 0, 300); - RNA_def_property_ui_text(prop, "Margin", "Default distance from image boudary at which marker stops tracking"); + RNA_def_property_ui_text(prop, "Margin", "Default distance from image boundary at which marker stops tracking"); /* default_tracking_motion_model */ prop = RNA_def_property(srna, "default_motion_model", PROP_ENUM, PROP_NONE); @@ -952,7 +952,7 @@ static void rna_def_trackingTrack(BlenderRNA *brna) RNA_def_property_int_sdna(prop, NULL, "margin"); RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); RNA_def_property_range(prop, 0, 300); - RNA_def_property_ui_text(prop, "Margin", "Distance from image boudary at which marker stops tracking"); + RNA_def_property_ui_text(prop, "Margin", "Distance from image boundary at which marker stops tracking"); /* tracking motion model */ prop = RNA_def_property(srna, "motion_model", PROP_ENUM, PROP_NONE); @@ -1170,7 +1170,7 @@ static void rna_def_trackingStabilization(BlenderRNA *brna) RNA_def_property_boolean_sdna(prop, NULL, "flag", TRACKING_AUTOSCALE); RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); RNA_def_property_ui_text(prop, "Autoscale", - "Automatically scale footage to cover unfilled areas when stabilizating"); + "Automatically scale footage to cover unfilled areas when stabilizing"); RNA_def_property_update(prop, NC_MOVIECLIP | ND_DISPLAY, "rna_tracking_flushUpdate"); /* max scale */ @@ -1242,7 +1242,7 @@ static void rna_def_reconstructedCamera(BlenderRNA *brna) prop = RNA_def_property(srna, "average_error", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "error"); RNA_def_property_clear_flag(prop, PROP_EDITABLE); - RNA_def_property_ui_text(prop, "Average Error", "Average error of resonctruction"); + RNA_def_property_ui_text(prop, "Average Error", "Average error of reconstruction"); } static void rna_def_trackingReconstruction(BlenderRNA *brna) @@ -1266,7 +1266,7 @@ static void rna_def_trackingReconstruction(BlenderRNA *brna) prop = RNA_def_property(srna, "average_error", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "error"); RNA_def_property_clear_flag(prop, PROP_EDITABLE); - RNA_def_property_ui_text(prop, "Average Error", "Average error of resonctruction"); + RNA_def_property_ui_text(prop, "Average Error", "Average error of reconstruction"); /* cameras */ prop = RNA_def_property(srna, "cameras", PROP_COLLECTION, PROP_NONE); diff --git a/source/blender/makesrna/intern/rna_ui.c b/source/blender/makesrna/intern/rna_ui.c index 7c9cb04b66a..70d94bfc7ed 100644 --- a/source/blender/makesrna/intern/rna_ui.c +++ b/source/blender/makesrna/intern/rna_ui.c @@ -617,7 +617,7 @@ static void rna_def_ui_layout(BlenderRNA *brna) prop = RNA_def_property(srna, "enabled", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_funcs(prop, "rna_UILayout_enabled_get", "rna_UILayout_enabled_set"); - RNA_def_property_ui_text(prop, "Enabled", "When false, this (sub)layout is greyed out"); + RNA_def_property_ui_text(prop, "Enabled", "When false, this (sub)layout is grayed out"); prop = RNA_def_property(srna, "alert", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_funcs(prop, "rna_UILayout_alert_get", "rna_UILayout_alert_set"); diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c index 99d5d5ca462..b4703c06eb7 100644 --- a/source/blender/makesrna/intern/rna_userdef.c +++ b/source/blender/makesrna/intern/rna_userdef.c @@ -463,7 +463,7 @@ static void rna_def_userdef_theme_ui_font_style(BlenderRNA *brna) prop = RNA_def_property(srna, "shadowcolor", PROP_FLOAT, PROP_NONE); RNA_def_property_range(prop, 0.0f, 1.0f); - RNA_def_property_ui_text(prop, "Shadow Brightness", "Shadow color in grey value"); + RNA_def_property_ui_text(prop, "Shadow Brightness", "Shadow color in gray value"); RNA_def_property_update(prop, 0, "rna_userdef_update"); } @@ -2103,7 +2103,7 @@ static void rna_def_userdef_theme_space_clip(BlenderRNA *brna) prop = RNA_def_property(srna, "marker_outline", PROP_FLOAT, PROP_COLOR_GAMMA); RNA_def_property_float_sdna(prop, NULL, "marker_outline"); RNA_def_property_array(prop, 3); - RNA_def_property_ui_text(prop, "Marker Outline Color", "Color of marker's outile"); + RNA_def_property_ui_text(prop, "Marker Outline Color", "Color of marker's outline"); RNA_def_property_update(prop, 0, "rna_userdef_update"); prop = RNA_def_property(srna, "marker", PROP_FLOAT, PROP_COLOR_GAMMA); @@ -2766,7 +2766,7 @@ static void rna_def_userdef_edit(BlenderRNA *brna) RNA_def_property_enum_sdna(prop, NULL, "ipo_new"); RNA_def_property_ui_text(prop, "New Interpolation Type", "Interpolation mode used for first keyframe on newly added F-Curves " - "(subsequent keyframes take interpolation from preceeding keyframe)"); + "(subsequent keyframes take interpolation from preceding keyframe)"); prop = RNA_def_property(srna, "keyframe_new_handle_type", PROP_ENUM, PROP_NONE); RNA_def_property_enum_items(prop, keyframe_handle_type_items); @@ -2989,10 +2989,12 @@ static void rna_def_userdef_system(BlenderRNA *brna) { 1, "ENGLISH", 0, "English (English)", "en_US"}, { 8, "FRENCH", 0, "French (Français)", "fr_FR"}, { 4, "ITALIAN", 0, "Italian (Italiano)", "it_IT"}, + { 2, "JAPANESE", 0, "Japanese (日本語)", "ja_JP"}, {15, "RUSSIAN", 0, "Russian (Русский)", "ru_RU"}, {13, "SIMPLIFIED_CHINESE", 0, "Simplified Chinese (简体中文)", "zh_CN"}, { 9, "SPANISH", 0, "Spanish (Español)", "es"}, {14, "TRADITIONAL_CHINESE", 0, "Traditional Chinese (繁體中文)", "zh_TW"}, + {18, "UKRAINIAN", 0, "Ukrainian (Український)", "uk_UA"}, { 0, "", 0, N_("In progress"), ""}, /* using the utf8 flipped form of Arabic (العربية) */ {21, "ARABIC", 0, "Arabic (ﺔﻴﺑﺮﻌﻟﺍ)", "ar_EG"}, @@ -3006,7 +3008,6 @@ static void rna_def_userdef_system(BlenderRNA *brna) {23, "GREEK", 0, "Greek (Ελληνικά)", "el_GR"}, {31, "HUNGARIAN", 0, "Hungarian (magyar)", "hu_HU"}, {27, "INDONESIAN", 0, "Indonesian (Bahasa indonesia)", "id_ID"}, - { 2, "JAPANESE", 0, "Japanese (日本語)", "ja_JP"}, {29, "KYRGYZ", 0, "Kyrgyz (Кыргыз тили)", "ky_KG"}, /* {24, "KOREAN", 0, "Korean (한국 언어)", "ko_KR"}, */ /* XXX No po's yet. */ {25, "NEPALI", 0, "Nepali (नेपाली)", "ne_NP"}, @@ -3019,7 +3020,6 @@ static void rna_def_userdef_system(BlenderRNA *brna) {28, "SERBIAN_LATIN", 0, "Serbian latin (Srpski latinica)", "sr_RS@latin"}, { 7, "SWEDISH", 0, "Swedish (Svenska)", "sv_SE"}, {30, "TURKISH", 0, "Turkish (Türkçe)", "tr_TR"}, - {18, "UKRAINIAN", 0, "Ukrainian (Український)", "uk_UA"}, { 0, NULL, 0, NULL, NULL} }; diff --git a/source/blender/makesrna/intern/rna_wm.c b/source/blender/makesrna/intern/rna_wm.c index 8c6a2809ef8..61c75e306cb 100644 --- a/source/blender/makesrna/intern/rna_wm.c +++ b/source/blender/makesrna/intern/rna_wm.c @@ -183,7 +183,7 @@ EnumPropertyItem event_type_items[] = { {SELECTMOUSE, "SELECTMOUSE", 0, "Select Mouse", ""}, {0, "", 0, NULL, NULL}, {MOUSEMOVE, "MOUSEMOVE", 0, "Mouse Move", ""}, - {INBETWEEN_MOUSEMOVE, "INBETWEEN_MOUSEMOVE", 0, "Inbetween Move", ""}, + {INBETWEEN_MOUSEMOVE, "INBETWEEN_MOUSEMOVE", 0, "In-between Move", ""}, {MOUSEPAN, "TRACKPADPAN", 0, "Mouse/Trackpad Pan", ""}, {MOUSEZOOM, "TRACKPADZOOM", 0, "Mouse/Trackpad Zoom", ""}, {MOUSEROTATE, "MOUSEROTATE", 0, "Mouse/Trackpad Rotate", ""}, diff --git a/source/blender/makesrna/intern/rna_world.c b/source/blender/makesrna/intern/rna_world.c index cec66831916..a84b1124d44 100644 --- a/source/blender/makesrna/intern/rna_world.c +++ b/source/blender/makesrna/intern/rna_world.c @@ -316,7 +316,7 @@ static void rna_def_lighting(BlenderRNA *brna) prop = RNA_def_property(srna, "passes", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "ao_approx_passes"); RNA_def_property_range(prop, 0, 10); - RNA_def_property_ui_text(prop, "Passes", "Number of preprocessing passes to reduce overocclusion"); + RNA_def_property_ui_text(prop, "Passes", "Number of preprocessing passes to reduce over-occlusion"); RNA_def_property_update(prop, 0, "rna_World_update"); prop = RNA_def_property(srna, "distance", PROP_FLOAT, PROP_DISTANCE); diff --git a/source/blender/modifiers/intern/MOD_particleinstance.c b/source/blender/modifiers/intern/MOD_particleinstance.c index 82ab8db9c36..74026efecc5 100644 --- a/source/blender/modifiers/intern/MOD_particleinstance.c +++ b/source/blender/modifiers/intern/MOD_particleinstance.c @@ -114,15 +114,14 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, ParticleSimulationData sim; ParticleSystem *psys = NULL; ParticleData *pa = NULL, *pars = NULL; - MFace *mface, *orig_mface; + MPoly *mpoly, *orig_mpoly; + MLoop *mloop, *orig_mloop; MVert *mvert, *orig_mvert; - int i, totvert, totpart = 0, totface, maxvert, maxface, first_particle = 0; + int i, totvert, totpoly, totloop, maxvert, maxpoly, maxloop, totpart = 0, first_particle = 0; short track = ob->trackflag % 3, trackneg, axis = pimd->axis; float max_co = 0.0, min_co = 0.0, temp_co[3], cross[3]; float *size = NULL; - DM_ensure_tessface(dm); /* BMESH - UNTIL MODIFIER IS UPDATED FOR MPoly */ - trackneg = ((ob->trackflag > 2) ? 1 : 0); if (pimd->ob == ob) { @@ -175,15 +174,16 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, pars = psys->particles; totvert = dm->getNumVerts(dm); - totface = dm->getNumTessFaces(dm); + totpoly = dm->getNumPolys(dm); + totloop = dm->getNumLoops(dm); maxvert = totvert * totpart; - maxface = totface * totpart; + maxpoly = totpoly * totpart; + maxloop = totloop * totpart; psys->lattice = psys_get_lattice(&sim); if (psys->flag & (PSYS_HAIR_DONE | PSYS_KEYED) || psys->pointcache->flag & PTCACHE_BAKED) { - float min_r[3], max_r[3]; INIT_MINMAX(min_r, max_r); dm->getMinMax(dm, min_r, max_r); @@ -191,7 +191,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, max_co = max_r[track]; } - result = CDDM_from_template(dm, maxvert, dm->getNumEdges(dm) * totpart, maxface, 0, 0); + result = CDDM_from_template(dm, maxvert, dm->getNumEdges(dm) * totpart, 0, maxloop, maxpoly); mvert = result->getVertArray(result); orig_mvert = dm->getVertArray(dm); @@ -263,29 +263,31 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, add_v3_v3(mv->co, state.co); } - mface = result->getTessFaceArray(result); - orig_mface = dm->getTessFaceArray(dm); + mpoly = result->getPolyArray(result); + orig_mpoly = dm->getPolyArray(dm); + mloop = result->getLoopArray(result); + orig_mloop = dm->getLoopArray(dm); - for (i = 0; i < maxface; i++) { - MFace *inMF; - MFace *mf = mface + i; + for (i = 0; i < maxpoly; i++) { + MPoly *inMP = orig_mpoly + i % totpoly; + MPoly *mp = mpoly + i; if (pimd->flag & eParticleInstanceFlag_Parents) { - if (i / totface >= psys->totpart) { + if (i / totpoly >= psys->totpart) { if (psys->part->childtype == PART_CHILD_PARTICLES) { - pa = psys->particles + (psys->child + i / totface - psys->totpart)->parent; + pa = psys->particles + (psys->child + i / totpoly - psys->totpart)->parent; } else { pa = NULL; } } else { - pa = pars + i / totface; + pa = pars + i / totpoly; } } else { if (psys->part->childtype == PART_CHILD_PARTICLES) { - pa = psys->particles + (psys->child + i / totface)->parent; + pa = psys->particles + (psys->child + i / totpoly)->parent; } else { pa = NULL; @@ -298,19 +300,23 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, if (pa->alive == PARS_DEAD && (pimd->flag & eParticleInstanceFlag_Dead) == 0) continue; } - inMF = orig_mface + i % totface; - DM_copy_poly_data(dm, result, i % totface, i, 1); - *mf = *inMF; + DM_copy_poly_data(dm, result, i % totpoly, i, 1); + *mp = *inMP; + mp->loopstart += (i / totpoly) * totloop; - mf->v1 += (i / totface) * totvert; - mf->v2 += (i / totface) * totvert; - mf->v3 += (i / totface) * totvert; - if (mf->v4) { - mf->v4 += (i / totface) * totvert; + { + MLoop *inML = orig_mloop + inMP->loopstart; + MLoop *ml = mloop + mp->loopstart; + int j = mp->totloop; + + DM_copy_loop_data(dm, result, inMP->loopstart, mp->loopstart, j); + for (; j; j--, ml++, inML++) { + ml->v = inML->v + ((i / totpoly) * totvert); + } } } - CDDM_calc_edges_tessface(result); + CDDM_calc_edges(result); if (psys->lattice) { end_latt_deform(psys->lattice); @@ -320,7 +326,6 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, if (size) MEM_freeN(size); - CDDM_tessfaces_to_faces(result); /*builds ngon faces from tess (mface) faces*/ CDDM_calc_normals(result); return result; diff --git a/source/blender/nodes/composite/node_composite_tree.c b/source/blender/nodes/composite/node_composite_tree.c index 72112180bc8..b9acf821efe 100644 --- a/source/blender/nodes/composite/node_composite_tree.c +++ b/source/blender/nodes/composite/node_composite_tree.c @@ -118,7 +118,6 @@ static void update_node(bNodeTree *ntree, bNode *node) } } node->need_exec= 1; - /* individual node update call */ if (node->typeinfo->updatefunc) node->typeinfo->updatefunc(ntree, node); @@ -133,6 +132,7 @@ static void localize(bNodeTree *localtree, bNodeTree *ntree) for (node= ntree->nodes.first; node; node= node->next) { /* ensure new user input gets handled ok */ node->need_exec= 0; + node->new_node->original = node; /* move over the compbufs */ /* right after ntreeCopyTree() oldsock pointers are valid */ @@ -200,6 +200,7 @@ static void local_sync(bNodeTree *localtree, bNodeTree *ntree) lnode->new_node->preview= lnode->preview; lnode->preview= NULL; } + } } } diff --git a/source/blender/nodes/composite/nodes/node_composite_diffMatte.c b/source/blender/nodes/composite/nodes/node_composite_diffMatte.c index 33e6de8ea6e..53061366b8b 100644 --- a/source/blender/nodes/composite/nodes/node_composite_diffMatte.c +++ b/source/blender/nodes/composite/nodes/node_composite_diffMatte.c @@ -48,10 +48,10 @@ static bNodeSocketTemplate cmp_node_diff_matte_out[]={ static void do_diff_matte(bNode *node, float *outColor, float *inColor1, float *inColor2) { NodeChroma *c= (NodeChroma *)node->storage; - float tolerence=c->t1; + float tolerance=c->t1; float fper=c->t2; - /* get falloff amount over tolerence size */ - float falloff=(1.0f-fper) * tolerence; + /* get falloff amount over tolerance size */ + float falloff=(1.0f-fper) * tolerance; float difference; float alpha; float maxInputAlpha; @@ -64,13 +64,13 @@ static void do_diff_matte(bNode *node, float *outColor, float *inColor1, float * copy_v3_v3(outColor, inColor1); - if (difference <= tolerence) { + if (difference <= tolerance) { if (difference <= falloff) { alpha = 0.0f; } else { /* alpha as percent (distance / tolerance), each modified by falloff amount (in pixels)*/ - alpha=(difference-falloff)/(tolerence-falloff); + alpha=(difference-falloff)/(tolerance-falloff); } /*only change if more transparent than either image */ diff --git a/source/blender/nodes/composite/nodes/node_composite_distanceMatte.c b/source/blender/nodes/composite/nodes/node_composite_distanceMatte.c index f365ee58f59..86634487776 100644 --- a/source/blender/nodes/composite/nodes/node_composite_distanceMatte.c +++ b/source/blender/nodes/composite/nodes/node_composite_distanceMatte.c @@ -50,10 +50,10 @@ static bNodeSocketTemplate cmp_node_distance_matte_out[]={ static void do_distance_matte(bNode *node, float *out, float *in) { NodeChroma *c= (NodeChroma *)node->storage; - float tolerence=c->t1; + float tolerance=c->t1; float fper=c->t2; - /* get falloff amount over tolerence size */ - float falloff=(1.0f-fper) * tolerence; + /* get falloff amount over tolerance size */ + float falloff=(1.0f-fper) * tolerance; float distance; float alpha; @@ -63,13 +63,13 @@ static void do_distance_matte(bNode *node, float *out, float *in) copy_v3_v3(out, in); - if (distance <= tolerence) { + if (distance <= tolerance) { if (distance <= falloff) { alpha = 0.0f; } else { /* alpha as percent (distance / tolerance), each modified by falloff amount (in pixels)*/ - alpha=(distance-falloff)/(tolerence-falloff); + alpha=(distance-falloff)/(tolerance-falloff); } /*only change if more transparent than before */ @@ -88,10 +88,10 @@ static void do_distance_matte(bNode *node, float *out, float *in) static void do_chroma_distance_matte(bNode *node, float *out, float *in) { NodeChroma *c= (NodeChroma *)node->storage; - float tolerence=c->t1; + float tolerance=c->t1; float fper=c->t2; - /* get falloff amount over tolerence size */ - float falloff=(1.0f-fper) * tolerence; + /* get falloff amount over tolerance size */ + float falloff=(1.0f-fper) * tolerance; float y_key, cb_key, cr_key; float y_pix, cb_pix, cr_pix; float distance; @@ -114,13 +114,13 @@ static void do_chroma_distance_matte(bNode *node, float *out, float *in) copy_v3_v3(out, in); - if (distance <= tolerence) { + if (distance <= tolerance) { if (distance <= falloff) { alpha = 0.0f; } else { /* alpha as percent (distance / tolerance), each modified by falloff amount (in pixels)*/ - alpha=(distance-falloff)/(tolerence-falloff); + alpha=(distance-falloff)/(tolerance-falloff); } /*only change if more transparent than before */ diff --git a/source/blender/nodes/intern/node_socket.c b/source/blender/nodes/intern/node_socket.c index b5400244efe..8b393dd740a 100644 --- a/source/blender/nodes/intern/node_socket.c +++ b/source/blender/nodes/intern/node_socket.c @@ -319,7 +319,7 @@ void node_socket_copy_default_value(int type, void *to_default_value, void *from * In the interface this could be implemented by a pseudo-script textbox on linked inputs, * with quick selection from a predefined list of conversion options. Some Examples: * - vector component 'z' (vector->float): "z" - * - greyscale color (float->color): "grey" + * - grayscale color (float->color): "gray" * - color luminance (color->float): "lum" * - matrix column 2 length (matrix->vector->float): "col[1].len" * - mesh vertex coordinate 'y' (mesh->vertex->vector->float): "vertex.co.y" diff --git a/source/blender/nodes/texture/nodes/node_texture_viewer.c b/source/blender/nodes/texture/nodes/node_texture_viewer.c index 03a94d1df67..bc31bef59d8 100644 --- a/source/blender/nodes/texture/nodes/node_texture_viewer.c +++ b/source/blender/nodes/texture/nodes/node_texture_viewer.c @@ -34,11 +34,11 @@ #include "NOD_texture.h" #include <math.h> -static bNodeSocketTemplate inputs[]= { +static bNodeSocketTemplate inputs[] = { { SOCK_RGBA, 1, N_("Color"), 1.0f, 0.0f, 0.0f, 1.0f }, { -1, 0, "" } }; -static bNodeSocketTemplate outputs[]= { +static bNodeSocketTemplate outputs[] = { { -1, 0, "" } }; diff --git a/source/blender/python/bmesh/bmesh_py_api.c b/source/blender/python/bmesh/bmesh_py_api.c index b2fd1d3d61c..f3e5b300ced 100644 --- a/source/blender/python/bmesh/bmesh_py_api.c +++ b/source/blender/python/bmesh/bmesh_py_api.c @@ -73,7 +73,7 @@ PyDoc_STRVAR(bpy_bm_from_edit_mesh_doc, "\n" " Return a BMesh from this mesh, currently the mesh must already be in editmode.\n" "\n" -" :return: the BMesh assosiated with this mesh.\n" +" :return: the BMesh associated with this mesh.\n" " :rtype: :class:`bmesh.types.BMesh`\n" ); static PyObject *bpy_bm_from_edit_mesh(PyObject *UNUSED(self), PyObject *value) diff --git a/source/blender/python/bmesh/bmesh_py_types.c b/source/blender/python/bmesh/bmesh_py_types.c index 053dac71fe6..f7a7d379ba4 100644 --- a/source/blender/python/bmesh/bmesh_py_types.c +++ b/source/blender/python/bmesh/bmesh_py_types.c @@ -1024,7 +1024,7 @@ PyDoc_STRVAR(bpy_bm_elem_select_set_doc, ".. method:: select_set(select)\n" "\n" " Set the selection.\n" -" This is different from the *select* attribute because it updates the selection state of assosiated geometry.\n" +" This is different from the *select* attribute because it updates the selection state of associated geometry.\n" "\n" " :arg select: Select or de-select.\n" " :type select: boolean\n" @@ -1057,7 +1057,7 @@ PyDoc_STRVAR(bpy_bm_elem_hide_set_doc, ".. method:: hide_set(hide)\n" "\n" " Set the hide state.\n" -" This is different from the *hide* attribute because it updates the selection and hide state of assosiated geometry.\n" +" This is different from the *hide* attribute because it updates the selection and hide state of associated geometry.\n" "\n" " :arg hide: Hidden or visible.\n" " :type hide: boolean\n" diff --git a/source/blender/python/intern/bpy_rna.c b/source/blender/python/intern/bpy_rna.c index 04f9a90f0d2..4bba7ba6838 100644 --- a/source/blender/python/intern/bpy_rna.c +++ b/source/blender/python/intern/bpy_rna.c @@ -873,7 +873,7 @@ static PyObject *pyrna_struct_repr(BPy_StructRNA *self) if (path) { if (GS(id->name) == ID_NT) { /* nodetree paths are not accurate */ ret = PyUnicode_FromFormat("bpy.data...%s", - path); + path); } else { ret = PyUnicode_FromFormat("bpy.data.%s[%R].%s", @@ -980,7 +980,7 @@ static PyObject *pyrna_prop_repr(BPy_PropertyRNA *self) if (path) { if (GS(id->name) == ID_NT) { /* nodetree paths are not accurate */ ret = PyUnicode_FromFormat("bpy.data...%s", - path); + path); } else { ret = PyUnicode_FromFormat("bpy.data.%s[%R].%s", @@ -2040,12 +2040,12 @@ static int pyrna_prop_collection_bool(BPy_PropertyRNA *self) * This is done for faster lookups. */ #define PYRNA_PROP_COLLECTION_ABS_INDEX(ret_err) \ if (keynum < 0) { \ - keynum_abs += RNA_property_collection_length(&self->ptr, self->prop); \ - if (keynum_abs < 0) { \ - PyErr_Format(PyExc_IndexError, \ - "bpy_prop_collection[%d]: out of range.", keynum); \ - return ret_err; \ - } \ + keynum_abs += RNA_property_collection_length(&self->ptr, self->prop); \ + if (keynum_abs < 0) { \ + PyErr_Format(PyExc_IndexError, \ + "bpy_prop_collection[%d]: out of range.", keynum); \ + return ret_err; \ + } \ } (void)0 @@ -3508,8 +3508,8 @@ static PyObject *pyrna_struct_getattro(BPy_StructRNA *self, PyObject *pyname) PyList_Append(ret, linkptr); Py_DECREF(linkptr); } + break; } - break; default: /* should never happen */ BLI_assert(!"Invalid context type"); diff --git a/source/blender/python/mathutils/mathutils_Matrix.c b/source/blender/python/mathutils/mathutils_Matrix.c index 5c4c6414f39..5f372abcc69 100644 --- a/source/blender/python/mathutils/mathutils_Matrix.c +++ b/source/blender/python/mathutils/mathutils_Matrix.c @@ -1640,7 +1640,7 @@ static PyObject *Matrix_richcmpr(PyObject *a, PyObject *b, int op) * sequence length */ static int Matrix_len(MatrixObject *self) { - return (self->num_row); + return self->num_row; } /*----------------------------object[]--------------------------- * sequence accessor (get) diff --git a/source/blender/render/intern/source/external_engine.c b/source/blender/render/intern/source/external_engine.c index 5bb3e4605a2..e3eab0c3b34 100644 --- a/source/blender/render/intern/source/external_engine.c +++ b/source/blender/render/intern/source/external_engine.c @@ -173,12 +173,16 @@ RenderResult *RE_engine_begin_result(RenderEngine *engine, int x, int y, int w, disprect.ymax = y + h; result = render_result_new(re, &disprect, 0, RR_USE_MEM); - BLI_addtail(&engine->fullresult, result); - - result->tilerect.xmin += re->disprect.xmin; - result->tilerect.xmax += re->disprect.xmin; - result->tilerect.ymin += re->disprect.ymin; - result->tilerect.ymax += re->disprect.ymin; + + /* can be NULL if we CLAMP the width or height to 0 */ + if (result) { + BLI_addtail(&engine->fullresult, result); + + result->tilerect.xmin += re->disprect.xmin; + result->tilerect.xmax += re->disprect.xmin; + result->tilerect.ymin += re->disprect.ymin; + result->tilerect.ymax += re->disprect.ymin; + } return result; } diff --git a/source/blender/render/intern/source/render_result.c b/source/blender/render/intern/source/render_result.c index 745ce77bdda..3fd59b5e67c 100644 --- a/source/blender/render/intern/source/render_result.c +++ b/source/blender/render/intern/source/render_result.c @@ -1044,7 +1044,7 @@ ImBuf *render_result_rect_to_ibuf(RenderResult *rr, RenderData *rd) } } - /* color -> greyscale */ + /* color -> grayscale */ /* editing directly would alter the render view */ if (rd->im_format.planes == R_IMF_PLANES_BW) { ImBuf *ibuf_bw = IMB_dupImBuf(ibuf); diff --git a/source/blender/render/intern/source/shadeoutput.c b/source/blender/render/intern/source/shadeoutput.c index b75b9e5bf1f..c2e21af4ad2 100644 --- a/source/blender/render/intern/source/shadeoutput.c +++ b/source/blender/render/intern/source/shadeoutput.c @@ -798,7 +798,6 @@ static float OrenNayar_Diff(float nl, const float n[3], const float l[3], const /* Minnaert diffuse */ static float Minnaert_Diff(float nl, const float n[3], const float v[3], float darkness) { - float i, nv; /* nl = dot product between surface normal and light vector */ @@ -806,12 +805,12 @@ static float Minnaert_Diff(float nl, const float n[3], const float v[3], float d return 0.0f; /* nv = dot product between surface normal and view vector */ - nv = n[0]*v[0]+n[1]*v[1]+n[2]*v[2]; + nv = dot_v3v3(n, v); if (nv < 0.0f) nv = 0.0f; if (darkness <= 1.0f) - i = nl * pow(MAX2(nv*nl, 0.1f), (darkness - 1.0f) ); /*The Real model*/ + i = nl * pow(maxf(nv * nl, 0.1f), (darkness - 1.0f) ); /*The Real model*/ else i = nl * pow( (1.001f - nv), (darkness - 1.0f) ); /*Nvidia model*/ diff --git a/source/blender/windowmanager/intern/wm_apple.c b/source/blender/windowmanager/intern/wm_apple.c index 161725386c5..71d074e340f 100644 --- a/source/blender/windowmanager/intern/wm_apple.c +++ b/source/blender/windowmanager/intern/wm_apple.c @@ -41,7 +41,7 @@ #include <Carbon/Carbon.h> /* To avoid killing small end comps, we want to allow - * blender to start maximised if all the followings are true : + * blender to start maximized if all the followings are true : * - Renderer is OpenGL capable * - Hardware acceleration * - VRAM > 16 Mo diff --git a/source/blender/windowmanager/intern/wm_gesture.c b/source/blender/windowmanager/intern/wm_gesture.c index e4b7d1c5d5f..b280b979280 100644 --- a/source/blender/windowmanager/intern/wm_gesture.c +++ b/source/blender/windowmanager/intern/wm_gesture.c @@ -224,7 +224,7 @@ static void wm_gesture_draw_circle(wmGesture *gt) glutil_draw_lined_arc(0.0, M_PI * 2.0, rect->xmax, 40); glDisable(GL_LINE_STIPPLE); - glTranslatef((float)-rect->xmin, (float)-rect->ymin, 0.0f); + glTranslatef(-rect->xmin, -rect->ymin, 0.0f); } diff --git a/source/blender/windowmanager/intern/wm_window.c b/source/blender/windowmanager/intern/wm_window.c index dd501e6d880..28e50f1655e 100644 --- a/source/blender/windowmanager/intern/wm_window.c +++ b/source/blender/windowmanager/intern/wm_window.c @@ -368,7 +368,7 @@ static void wm_window_add_ghostwindow(const char *title, wmWindow *win) if (win->eventstate == NULL) win->eventstate = MEM_callocN(sizeof(wmEvent), "window event state"); - /* until screens get drawn, make it nice grey */ + /* until screens get drawn, make it nice gray */ glClearColor(0.55, 0.55, 0.55, 0.0); /* Crash on OSS ATI: bugs.launchpad.net/ubuntu/+source/mesa/+bug/656100 */ if (!GPU_type_matches(GPU_DEVICE_ATI, GPU_OS_UNIX, GPU_DRIVER_OPENSOURCE)) { |