Exemple #1
0
static void rna_Action_fcurve_remove(bAction *act, ReportList *reports, PointerRNA *fcu_ptr)
{
    FCurve *fcu = fcu_ptr->data;
    if (fcu->grp) {
        if (BLI_findindex(&act->groups, fcu->grp) == -1) {
            BKE_reportf(reports, RPT_ERROR, "F-Curve's action group '%s' not found in action '%s'",
                        fcu->grp->name, act->id.name + 2);
            return;
        }

        action_groups_remove_channel(act, fcu);
        free_fcurve(fcu);
        RNA_POINTER_INVALIDATE(fcu_ptr);
    }
    else {
        if (BLI_findindex(&act->curves, fcu) == -1) {
            BKE_reportf(reports, RPT_ERROR, "F-Curve not found in action '%s'", act->id.name + 2);
            return;
        }

        BLI_remlink(&act->curves, fcu);
        free_fcurve(fcu);
        RNA_POINTER_INVALIDATE(fcu_ptr);
    }
}
Exemple #2
0
// XXX find some header to put this in!
void free_anim_drivers_copybuf(void)
{
	/* free the buffer F-Curve if it exists, as if it were just another F-Curve */
	if (channeldriver_copypaste_buf)
		free_fcurve(channeldriver_copypaste_buf);
	channeldriver_copypaste_buf = NULL;
}
Exemple #3
0
/* Main Driver Management API calls:
 * Remove the driver for the specified property on the given ID block (if available)
 */
bool ANIM_remove_driver(ReportList *UNUSED(reports),
                        ID *id,
                        const char rna_path[],
                        int array_index,
                        short UNUSED(flag))
{
  AnimData *adt;
  FCurve *fcu;
  bool success = false;

  /* we don't check the validity of the path here yet, but it should be ok... */
  adt = BKE_animdata_from_id(id);

  if (adt) {
    if (array_index == -1) {
      /* step through all drivers, removing all of those with the same base path */
      FCurve *fcu_iter = adt->drivers.first;

      while ((fcu = iter_step_fcurve(fcu_iter, rna_path)) != NULL) {
        /* store the next fcurve for looping  */
        fcu_iter = fcu->next;

        /* remove F-Curve from driver stack, then free it */
        BLI_remlink(&adt->drivers, fcu);
        free_fcurve(fcu);

        /* done successfully */
        success = true;
      }
    }
    else {
      /* find the matching driver and remove it only
       * Note: here is one of the places where we don't want new F-Curve + Driver added!
       *      so 'add' var must be 0
       */
      fcu = verify_driver_fcurve(id, rna_path, array_index, 0);
      if (fcu) {
        BLI_remlink(&adt->drivers, fcu);
        free_fcurve(fcu);

        success = true;
      }
    }
  }

  return success;
}
Exemple #4
0
/* This function frees any MEM_calloc'ed copy/paste buffer data */
void ANIM_drivers_copybuf_free(void)
{
  /* free the buffer F-Curve if it exists, as if it were just another F-Curve */
  if (channeldriver_copypaste_buf) {
    free_fcurve(channeldriver_copypaste_buf);
  }
  channeldriver_copypaste_buf = NULL;
}
Exemple #5
0
static void rna_Action_fcurve_remove(bAction *act, ReportList *reports, FCurve *fcu)
{
	if (fcu->grp) {
		if (BLI_findindex(&act->groups, fcu->grp) == -1) {
			BKE_reportf(reports, RPT_ERROR, "F-Curve's ActionGroup '%s' not found in action '%s'", fcu->grp->name, act->id.name+2);
			return;
		}
		
		action_groups_remove_channel(act, fcu);
		free_fcurve(fcu);
	}
	else {
		if (BLI_findindex(&act->curves, fcu) == -1) {
			BKE_reportf(reports, RPT_ERROR, "F-Curve not found in action '%s'", act->id.name+2);
			return;
		}
		
		BLI_remlink(&act->curves, fcu);
		free_fcurve(fcu);
	}
}
Exemple #6
0
static void remove_sequencer_fcurves(Scene *sce)
{
	AnimData *adt = BKE_animdata_from_id(&sce->id);

	if (adt && adt->action) {
		FCurve *fcu, *nextfcu;
		
		for (fcu = adt->action->curves.first; fcu; fcu = nextfcu) {
			nextfcu = fcu->next;
			
			if ((fcu->rna_path) && strstr(fcu->rna_path, "sequences_all")) {
				action_groups_remove_channel(adt->action, fcu);
				free_fcurve(fcu);
			}
		}
	}
}