Exemple #1
0
static void rna_Action_groups_remove(bAction *act, ReportList *reports, PointerRNA *agrp_ptr)
{
    bActionGroup *agrp = agrp_ptr->data;
    FCurve *fcu, *fcn;

    /* try to remove the F-Curve from the action */
    if (BLI_remlink_safe(&act->groups, agrp) == false) {
        BKE_reportf(reports, RPT_ERROR, "Action group '%s' not found in action '%s'", agrp->name, act->id.name + 2);
        return;
    }

    /* move every one one of the group's F-Curves out into the Action again */
    for (fcu = agrp->channels.first; (fcu) && (fcu->grp == agrp); fcu = fcn) {
        fcn = fcu->next;

        /* remove from group */
        action_groups_remove_channel(act, fcu);

        /* tack onto the end */
        BLI_addtail(&act->curves, fcu);
    }

    MEM_freeN(agrp);
    RNA_POINTER_INVALIDATE(agrp_ptr);
}
Exemple #2
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 #3
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);
			}
		}
	}
}
Exemple #4
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 #5
0
static void rna_Action_groups_remove(bAction *act, ReportList *reports, bActionGroup *agrp)
{
	FCurve *fcu, *fcn;
	
	/* try to remove the F-Curve from the action */
	if (!BLI_remlink_safe(&act->groups, agrp)) {
		BKE_reportf(reports, RPT_ERROR, "ActionGroup '%s' not found in action '%s'", agrp->name, act->id.name+2);
		return;
	}

	/* move every one one of the group's F-Curves out into the Action again */
	for (fcu= agrp->channels.first; (fcu) && (fcu->grp==agrp); fcu=fcn) {
		fcn= fcu->next;
		
		/* remove from group */
		action_groups_remove_channel(act, fcu);
		
		/* tack onto the end */
		BLI_addtail(&act->curves, fcu);
	}
	
	/* XXX, invalidates PyObject */
	MEM_freeN(agrp); 
}