Пример #1
0
void BKE_pose_bone_done(EvaluationContext *UNUSED(eval_ctx),
                        bPoseChannel *pchan)
{
	float imat[4][4];
	DEG_debug_print_eval(__func__, pchan->name, pchan);
	if (pchan->bone) {
		invert_m4_m4(imat, pchan->bone->arm_mat);
		mul_m4_m4m4(pchan->chan_mat, pchan->pose_mat, imat);
	}
}
Пример #2
0
void BKE_pose_eval_proxy_copy(EvaluationContext *UNUSED(eval_ctx), Object *ob)
{
	BLI_assert(ID_IS_LINKED(ob) && ob->proxy_from != NULL);
	DEG_debug_print_eval(__func__, ob->id.name, ob);
	if (BKE_pose_copy_result(ob->pose, ob->proxy_from->pose) == false) {
		printf("Proxy copy error, lib Object: %s proxy Object: %s\n",
		       ob->id.name + 2, ob->proxy_from->id.name + 2);
	}
	/* Rest of operations are NO-OP in depsgraph, so can clear
	 * flag now.
	 */
	ob->recalc &= ~OB_RECALC_ALL;
}
Пример #3
0
void BKE_pose_eval_flush(EvaluationContext *UNUSED(eval_ctx),
                         Scene *scene,
                         Object *ob,
                         bPose *UNUSED(pose))
{
	float ctime = BKE_scene_frame_get(scene); /* not accurate... */
	DEG_debug_print_eval(__func__, ob->id.name, ob);
	BLI_assert(ob->type == OB_ARMATURE);

	/* 6. release the IK tree */
	BIK_release_tree(scene, ob, ctime);

	ob->recalc &= ~OB_RECALC_ALL;
}
Пример #4
0
static void layer_eval_view_layer(struct Depsgraph *depsgraph,
                                  struct Scene *UNUSED(scene),
                                  ViewLayer *view_layer)
{
  DEG_debug_print_eval(depsgraph, __func__, view_layer->name, view_layer);

  /* Create array of bases, for fast index-based lookup. */
  const int num_object_bases = BLI_listbase_count(&view_layer->object_bases);
  MEM_SAFE_FREE(view_layer->object_bases_array);
  view_layer->object_bases_array = MEM_malloc_arrayN(
      num_object_bases, sizeof(Base *), "view_layer->object_bases_array");
  int base_index = 0;
  for (Base *base = view_layer->object_bases.first; base; base = base->next) {
    view_layer->object_bases_array[base_index++] = base;
  }
}
Пример #5
0
void BKE_pose_eval_init_ik(EvaluationContext *UNUSED(eval_ctx),
                           Scene *scene,
                           Object *ob,
                           bPose *UNUSED(pose))
{
	DEG_debug_print_eval(__func__, ob->id.name, ob);
	BLI_assert(ob->type == OB_ARMATURE);
	const float ctime = BKE_scene_frame_get(scene); /* not accurate... */
	bArmature *arm = (bArmature *)ob->data;
	if (arm->flag & ARM_RESTPOS) {
		return;
	}
	/* 2a. construct the IK tree (standard IK) */
	BIK_initialize_tree(scene, ob, ctime);
	/* 2b. construct the Spline IK trees
	 *  - this is not integrated as an IK plugin, since it should be able
	 *	  to function in conjunction with standard IK
	 */
	BKE_pose_splineik_init_tree(scene, ob, ctime);
}
Пример #6
0
void BKE_pose_eval_init(EvaluationContext *UNUSED(eval_ctx),
                        Scene *UNUSED(scene),
                        Object *ob,
                        bPose *pose)
{
	bPoseChannel *pchan;

	DEG_debug_print_eval(__func__, ob->id.name, ob);

	BLI_assert(ob->type == OB_ARMATURE);

	/* We demand having proper pose. */
	BLI_assert(ob->pose != NULL);
	BLI_assert((ob->pose->flag & POSE_RECALC) == 0);

	/* imat is needed for solvers. */
	invert_m4_m4(ob->imat, ob->obmat);

	/* 1. clear flags */
	for (pchan = pose->chanbase.first; pchan != NULL; pchan = pchan->next) {
		pchan->flag &= ~(POSE_DONE | POSE_CHAIN | POSE_IKTREE | POSE_IKSPLINE);
	}
}