diff options
author | Lukas Tönne <lukas.toenne@gmail.com> | 2016-05-11 12:16:48 +0300 |
---|---|---|
committer | Lukas Tönne <lukas.toenne@gmail.com> | 2016-05-11 12:47:42 +0300 |
commit | f49b698e87d43553009c3a5ef19cd742511f1a7c (patch) | |
tree | 9b00ba3d15abd6d4d403db39e819091a755bb894 /source/blender/blenkernel | |
parent | e23c508f1c79cfea7af1cbf6dfef18806a8978b8 (diff) | |
parent | de72dcadbbea1fe8689f76d1a579066abb22944b (diff) |
Merge branch 'master' into object_nodes
Diffstat (limited to 'source/blender/blenkernel')
-rw-r--r-- | source/blender/blenkernel/BKE_action.h | 2 | ||||
-rw-r--r-- | source/blender/blenkernel/BKE_blender_version.h | 2 | ||||
-rw-r--r-- | source/blender/blenkernel/BKE_node.h | 4 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/action.c | 45 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/armature_update.c | 8 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/constraint.c | 15 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/dynamicpaint.c | 7 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/gpencil.c | 10 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/pbvh.c | 11 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/seqeffects.c | 2 |
10 files changed, 63 insertions, 43 deletions
diff --git a/source/blender/blenkernel/BKE_action.h b/source/blender/blenkernel/BKE_action.h index 3fceef5d95d..c164cd542f3 100644 --- a/source/blender/blenkernel/BKE_action.h +++ b/source/blender/blenkernel/BKE_action.h @@ -144,6 +144,8 @@ void BKE_pose_channels_remove( struct Object *ob, bool (*filter_fn)(const char *bone_name, void *user_data), void *user_data); +void BKE_pose_free_data_ex(struct bPose *pose, bool do_id_user); +void BKE_pose_free_data(struct bPose *pose); void BKE_pose_free(struct bPose *pose); void BKE_pose_free_ex(struct bPose *pose, bool do_id_user); void BKE_pose_copy_data(struct bPose **dst, struct bPose *src, const bool copy_constraints); diff --git a/source/blender/blenkernel/BKE_blender_version.h b/source/blender/blenkernel/BKE_blender_version.h index 5e7fdb91645..618b36c5851 100644 --- a/source/blender/blenkernel/BKE_blender_version.h +++ b/source/blender/blenkernel/BKE_blender_version.h @@ -28,7 +28,7 @@ * and keep comment above the defines. * Use STRINGIFY() rather than defining with quotes */ #define BLENDER_VERSION 277 -#define BLENDER_SUBVERSION 0 +#define BLENDER_SUBVERSION 1 /* Several breakages with 270, e.g. constraint deg vs rad */ #define BLENDER_MINVERSION 270 #define BLENDER_MINSUBVERSION 6 diff --git a/source/blender/blenkernel/BKE_node.h b/source/blender/blenkernel/BKE_node.h index e69af8f69f8..4ae175fcf7b 100644 --- a/source/blender/blenkernel/BKE_node.h +++ b/source/blender/blenkernel/BKE_node.h @@ -643,12 +643,12 @@ void BKE_node_tree_unlink_id(ID *id, struct bNodeTree *ntree); * Examples: * * \code{.c} - * FOREACH_NODETREE(bmain, nodetree) { + * FOREACH_NODETREE(bmain, nodetree, id) { * if (id == nodetree) * printf("This is a linkable node tree"); * } FOREACH_NODETREE_END * - * FOREACH_NODETREE(bmain, nodetree) { + * FOREACH_NODETREE(bmain, nodetree, id) { * if (nodetree->idname == "ShaderNodeTree") * printf("This is a shader node tree); * if (GS(id) == ID_MA) diff --git a/source/blender/blenkernel/intern/action.c b/source/blender/blenkernel/intern/action.c index 5b1bb8cb2bb..b969c9ec787 100644 --- a/source/blender/blenkernel/intern/action.c +++ b/source/blender/blenkernel/intern/action.c @@ -824,26 +824,35 @@ void BKE_pose_channels_free(bPose *pose) BKE_pose_channels_free_ex(pose, true); } +void BKE_pose_free_data_ex(bPose *pose, bool do_id_user) +{ + /* free pose-channels */ + BKE_pose_channels_free_ex(pose, do_id_user); + + /* free pose-groups */ + if (pose->agroups.first) + BLI_freelistN(&pose->agroups); + + /* free IK solver state */ + BIK_clear_data(pose); + + /* free IK solver param */ + if (pose->ikparam) + MEM_freeN(pose->ikparam); +} + +void BKE_pose_free_data(bPose *pose) +{ + BKE_pose_free_data_ex(pose, true); +} + /** * Removes and deallocates all data from a pose, and also frees the pose. */ void BKE_pose_free_ex(bPose *pose, bool do_id_user) { if (pose) { - /* free pose-channels */ - BKE_pose_channels_free_ex(pose, do_id_user); - - /* free pose-groups */ - if (pose->agroups.first) - BLI_freelistN(&pose->agroups); - - /* free IK solver state */ - BIK_clear_data(pose); - - /* free IK solver param */ - if (pose->ikparam) - MEM_freeN(pose->ikparam); - + BKE_pose_free_data_ex(pose, do_id_user); /* free pose */ MEM_freeN(pose); } @@ -1415,7 +1424,13 @@ void what_does_obaction(Object *ob, Object *workob, bPose *pose, bAction *act, c workob->pose = pose; /* need to set pose too, since this is used for both types of Action Constraint */ if (pose) { - BKE_pose_channels_hash_make(pose); + /* This function is most likely to be used with a temporary pose with a single bone in there. + * For such cases it makes no sense to create hash since it'll only waste CPU ticks on memory + * allocation and also will make lookup slower. + */ + if (pose->chanbase.first != pose->chanbase.last) { + BKE_pose_channels_hash_make(pose); + } if (pose->flag & POSE_CONSTRAINTS_NEED_UPDATE_FLAGS) { BKE_pose_update_constraint_flags(pose); } diff --git a/source/blender/blenkernel/intern/armature_update.c b/source/blender/blenkernel/intern/armature_update.c index ceda9f056bb..34d9962139c 100644 --- a/source/blender/blenkernel/intern/armature_update.c +++ b/source/blender/blenkernel/intern/armature_update.c @@ -619,7 +619,9 @@ void BKE_pose_eval_bone(EvaluationContext *UNUSED(eval_ctx), else { /* TODO(sergey): Use time source node for time. */ float ctime = BKE_scene_frame_get(scene); /* not accurate... */ - BKE_pose_where_is_bone(scene, ob, pchan, ctime, 1); + if ((pchan->flag & POSE_DONE) == 0) { + BKE_pose_where_is_bone(scene, ob, pchan, ctime, 1); + } } } } @@ -636,7 +638,9 @@ void BKE_pose_constraints_evaluate(EvaluationContext *UNUSED(eval_ctx), } else { float ctime = BKE_scene_frame_get(scene); /* not accurate... */ - BKE_pose_where_is_bone(scene, ob, pchan, ctime, 1); + if ((pchan->flag & POSE_DONE) == 0) { + BKE_pose_where_is_bone(scene, ob, pchan, ctime, 1); + } } } diff --git a/source/blender/blenkernel/intern/constraint.c b/source/blender/blenkernel/intern/constraint.c index 1b9ac499e1f..7144e25ba7f 100644 --- a/source/blender/blenkernel/intern/constraint.c +++ b/source/blender/blenkernel/intern/constraint.c @@ -538,7 +538,7 @@ static void contarget_get_lattice_mat(Object *ob, const char *substring, float m static void constraint_target_to_mat4(Object *ob, const char *substring, float mat[4][4], short from, short to, float headtail) { /* Case OBJECT */ - if (!strlen(substring)) { + if (substring[0] == '\0') { copy_m4_m4(mat, ob->obmat); BKE_constraint_mat_convertspace(ob, NULL, mat, from, to, false); } @@ -2143,29 +2143,26 @@ static void actcon_get_tarmat(bConstraint *con, bConstraintOb *cob, bConstraintT } else if (cob->type == CONSTRAINT_OBTYPE_BONE) { Object workob; - bPose *pose; + bPose pose = {0}; bPoseChannel *pchan, *tchan; - - /* make a temporary pose and evaluate using that */ - pose = MEM_callocN(sizeof(bPose), "pose"); - + /* make a copy of the bone of interest in the temp pose before evaluating action, so that it can get set * - we need to manually copy over a few settings, including rotation order, otherwise this fails */ pchan = cob->pchan; - tchan = BKE_pose_channel_verify(pose, pchan->name); + tchan = BKE_pose_channel_verify(&pose, pchan->name); tchan->rotmode = pchan->rotmode; /* evaluate action using workob (it will only set the PoseChannel in question) */ - what_does_obaction(cob->ob, &workob, pose, data->act, pchan->name, t); + what_does_obaction(cob->ob, &workob, &pose, data->act, pchan->name, t); /* convert animation to matrices for use here */ BKE_pchan_calc_mat(tchan); copy_m4_m4(ct->matrix, tchan->chan_mat); /* Clean up */ - BKE_pose_free(pose); + BKE_pose_free_data(&pose); } else { /* behavior undefined... */ diff --git a/source/blender/blenkernel/intern/dynamicpaint.c b/source/blender/blenkernel/intern/dynamicpaint.c index bae059ed1b5..f4a07539218 100644 --- a/source/blender/blenkernel/intern/dynamicpaint.c +++ b/source/blender/blenkernel/intern/dynamicpaint.c @@ -3466,8 +3466,11 @@ static int dynamicPaint_paintMesh(DynamicPaintSurface *surface, sampleColor[2] = brush->b; /* Get material+textures color on hit point if required */ - if (brush_usesMaterial(brush, scene)) - dynamicPaint_doMaterialTex(bMats, sampleColor, &alpha_factor, brushOb, bData->realCoord[bData->s_pos[index] + ss].v, hitCoord, hitTri, brush->dm); + if (brush_usesMaterial(brush, scene)) { + dynamicPaint_doMaterialTex(bMats, sampleColor, &alpha_factor, brushOb, + bData->realCoord[bData->s_pos[index] + ss].v, + hitCoord, hitTri, dm); + } /* Sample proximity colorband if required */ if ((hit_found == HIT_PROXIMITY) && (brush->proximity_falloff == MOD_DPAINT_PRFALL_RAMP)) { diff --git a/source/blender/blenkernel/intern/gpencil.c b/source/blender/blenkernel/intern/gpencil.c index 485c4f5b29f..f3eb5430bce 100644 --- a/source/blender/blenkernel/intern/gpencil.c +++ b/source/blender/blenkernel/intern/gpencil.c @@ -68,6 +68,7 @@ bool free_gpencil_strokes(bGPDframe *gpf) /* free stroke memory arrays, then stroke itself */ if (gps->points) MEM_freeN(gps->points); + if (gps->triangles) MEM_freeN(gps->triangles); BLI_freelinkN(&gpf->strokes, gps); } @@ -261,6 +262,11 @@ bGPDlayer *gpencil_layer_addnew(bGPdata *gpd, const char *name, bool setactive) ARRAY_SET_ITEMS(gpl->gcolor_prev, 0.145098f, 0.419608f, 0.137255f); /* green */ ARRAY_SET_ITEMS(gpl->gcolor_next, 0.125490f, 0.082353f, 0.529412f); /* blue */ + /* high quality fill by default */ + gpl->flag |= GP_LAYER_HQ_FILL; + + /* default smooth iterations */ + gpl->draw_smoothlvl = 1; /* auto-name */ BLI_strncpy(gpl->info, name, sizeof(gpl->info)); @@ -315,7 +321,8 @@ bGPDframe *gpencil_frame_duplicate(bGPDframe *src) /* make copy of source stroke, then adjust pointer to points too */ gpsd = MEM_dupallocN(gps); gpsd->points = MEM_dupallocN(gps->points); - + gpsd->triangles = MEM_dupallocN(gps->triangles); + gpsd->flag |= GP_STROKE_RECALC_CACHES; BLI_addtail(&dst->strokes, gpsd); } @@ -424,6 +431,7 @@ void gpencil_frame_delete_laststroke(bGPDlayer *gpl, bGPDframe *gpf) /* free the stroke and its data */ MEM_freeN(gps->points); + MEM_freeN(gps->triangles); BLI_freelinkN(&gpf->strokes, gps); /* if frame has no strokes after this, delete it */ diff --git a/source/blender/blenkernel/intern/pbvh.c b/source/blender/blenkernel/intern/pbvh.c index 330b5922c9a..d73f087a3fe 100644 --- a/source/blender/blenkernel/intern/pbvh.c +++ b/source/blender/blenkernel/intern/pbvh.c @@ -979,16 +979,7 @@ static void pbvh_update_normals_accum_task_cb(void *userdata, const int n) * Not exact equivalent though, since atomicity is only ensured for one component * of the vector at a time, but here it shall not make any sensible difference. */ for (int k = 3; k--; ) { - /* Atomic float addition. - * Note that since collision are unlikely, loop will nearly always run once. */ - float oldval, newval; - uint32_t prevval; - do { - oldval = vnors[v][k]; - newval = oldval + fn[k]; - prevval = atomic_cas_uint32( - (uint32_t *)&vnors[v][k], *(uint32_t *)(&oldval), *(uint32_t *)(&newval)); - } while (UNLIKELY(prevval != *(uint32_t *)(&oldval))); + atomic_add_fl(&vnors[v][k], fn[k]); } } } diff --git a/source/blender/blenkernel/intern/seqeffects.c b/source/blender/blenkernel/intern/seqeffects.c index 4086fc2b0f3..3de4a426973 100644 --- a/source/blender/blenkernel/intern/seqeffects.c +++ b/source/blender/blenkernel/intern/seqeffects.c @@ -3060,7 +3060,7 @@ static ImBuf *do_gaussian_blur_effect(const SeqRenderData *context, ibuf1 = out; init_data.ibuf = ibuf1; - out = prepare_effect_imbufs(context, ibuf1, NULL, NULL);; + out = prepare_effect_imbufs(context, ibuf1, NULL, NULL); init_data.out = out; IMB_processor_apply_threaded(out->y, |