本文整理汇总了C++中BLI_freelinkN函数的典型用法代码示例。如果您正苦于以下问题:C++ BLI_freelinkN函数的具体用法?C++ BLI_freelinkN怎么用?C++ BLI_freelinkN使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了BLI_freelinkN函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: poselib_remove_exec
static int poselib_remove_exec(bContext *C, wmOperator *op)
{
Object *ob = get_poselib_object(C);
bAction *act = (ob) ? ob->poselib : NULL;
TimeMarker *marker;
int marker_index;
FCurve *fcu;
PropertyRNA *prop;
/* check if valid poselib */
if (act == NULL) {
BKE_report(op->reports, RPT_ERROR, "Object does not have pose lib data");
return OPERATOR_CANCELLED;
}
prop = RNA_struct_find_property(op->ptr, "pose");
if (RNA_property_is_set(op->ptr, prop)) {
marker_index = RNA_property_enum_get(op->ptr, prop);
}
else {
marker_index = act->active_marker - 1;
}
/* get index (and pointer) of pose to remove */
marker = BLI_findlink(&act->markers, marker_index);
if (marker == NULL) {
BKE_reportf(op->reports, RPT_ERROR, "Invalid pose specified %d", marker_index);
return OPERATOR_CANCELLED;
}
/* remove relevant keyframes */
for (fcu = act->curves.first; fcu; fcu = fcu->next) {
BezTriple *bezt;
unsigned int i;
if (fcu->bezt) {
for (i = 0, bezt = fcu->bezt; i < fcu->totvert; i++, bezt++) {
/* check if remove */
if (IS_EQF(bezt->vec[1][0], (float)marker->frame)) {
delete_fcurve_key(fcu, i, 1);
break;
}
}
}
}
/* remove poselib from list */
BLI_freelinkN(&act->markers, marker);
/* fix active pose number */
act->active_marker = 0;
/* send notifiers for this - using keyframe editing notifiers, since action
* may be being shown in anim editors as active action
*/
WM_event_add_notifier(C, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, NULL);
/* done */
return OPERATOR_FINISHED;
}
示例2: free_anim_copybuf
// XXX find some header to put this in!
void free_anim_copybuf (void)
{
tAnimCopybufItem *aci, *acn;
/* free each buffer element */
for (aci= animcopybuf.first; aci; aci= acn) {
acn= aci->next;
/* free keyframes */
if (aci->bezt)
MEM_freeN(aci->bezt);
/* free RNA-path */
if (aci->rna_path)
MEM_freeN(aci->rna_path);
/* free ourself */
BLI_freelinkN(&animcopybuf, aci);
}
/* restore initial state */
animcopybuf.first= animcopybuf.last= NULL;
animcopy_firstframe= 999999999.0f;
animcopy_lastframe= -999999999.0f;
}
示例3: clip_delete_track
void clip_delete_track(bContext *C, MovieClip *clip, MovieTrackingTrack *track)
{
MovieTracking *tracking= &clip->tracking;
MovieTrackingStabilization *stab= &tracking->stabilization;
int has_bundle= 0, update_stab= 0;
if(track==tracking->act_track)
tracking->act_track= NULL;
if(track==stab->rot_track) {
stab->rot_track= NULL;
update_stab= 1;
}
/* handle reconstruction display in 3d viewport */
if(track->flag&TRACK_HAS_BUNDLE)
has_bundle= 1;
BKE_tracking_free_track(track);
BLI_freelinkN(&tracking->tracks, track);
WM_event_add_notifier(C, NC_MOVIECLIP|NA_EDITED, clip);
if(update_stab) {
tracking->stabilization.ok= 0;
DAG_id_tag_update(&clip->id, 0);
WM_event_add_notifier(C, NC_MOVIECLIP|ND_DISPLAY, clip);
}
if(has_bundle)
WM_event_add_notifier(C, NC_SPACE|ND_SPACE_VIEW3D, NULL);
}
示例4: splineik_execute_tree
/* Evaluate the chain starting from the nominated bone */
static void splineik_execute_tree(Scene *scene, Object *ob, bPoseChannel *pchan_root, float ctime)
{
tSplineIK_Tree *tree;
/* for each pose-tree, execute it if it is spline, otherwise just free it */
while ((tree = pchan_root->siktree.first) != NULL) {
int i;
/* walk over each bone in the chain, calculating the effects of spline IK
* - the chain is traversed in the opposite order to storage order (i.e. parent to children)
* so that dependencies are correct
*/
for (i = tree->chainlen - 1; i >= 0; i--) {
bPoseChannel *pchan = tree->chain[i];
splineik_evaluate_bone(tree, scene, ob, pchan, i, ctime);
}
/* free the tree info specific to SplineIK trees now */
if (tree->chain)
MEM_freeN(tree->chain);
if (tree->free_points)
MEM_freeN(tree->points);
/* free this tree */
BLI_freelinkN(&pchan_root->siktree, tree);
}
}
示例5: remove_active_keyingset_exec
static int remove_active_keyingset_exec (bContext *C, wmOperator *op)
{
Scene *scene= CTX_data_scene(C);
KeyingSet *ks;
/* verify the Keying Set to use:
* - use the active one
* - return error if it doesn't exist
*/
if (scene->active_keyingset == 0) {
BKE_report(op->reports, RPT_ERROR, "No active Keying Set to remove");
return OPERATOR_CANCELLED;
}
else
ks= BLI_findlink(&scene->keyingsets, scene->active_keyingset-1);
/* free KeyingSet's data, then remove it from the scene */
BKE_keyingset_free(ks);
BLI_freelinkN(&scene->keyingsets, ks);
/* the active one should now be the previously second-to-last one */
scene->active_keyingset--;
/* send notifiers */
WM_event_add_notifier(C, NC_SCENE|ND_KEYINGSET, NULL);
return OPERATOR_FINISHED;
}
示例6: undo_stack_push_end
static void undo_stack_push_end(UndoStack *stack)
{
UndoElem *uel;
uintptr_t totmem, maxmem;
if(U.undomemory != 0) {
/* limit to maximum memory (afterwards, we can't know in advance) */
totmem= 0;
maxmem= ((uintptr_t)U.undomemory)*1024*1024;
uel= stack->elems.last;
while(uel) {
totmem+= uel->undosize;
if(totmem>maxmem) break;
uel= uel->prev;
}
if(uel) {
while(stack->elems.first!=uel) {
UndoElem *first= stack->elems.first;
undo_elem_free(stack, first);
BLI_freelinkN(&stack->elems, first);
}
}
}
}
示例7: BKE_pose_remove_group
/* Remove the active bone-group */
void BKE_pose_remove_group(Object *ob)
{
bPose *pose = (ob) ? ob->pose : NULL;
bActionGroup *grp = NULL;
bPoseChannel *pchan;
/* sanity checks */
if (ELEM(NULL, ob, pose))
return;
if (pose->active_group <= 0)
return;
/* get group to remove */
grp = BLI_findlink(&pose->agroups, pose->active_group - 1);
if (grp) {
/* adjust group references (the trouble of using indices!):
* - firstly, make sure nothing references it
* - also, make sure that those after this item get corrected
*/
for (pchan = pose->chanbase.first; pchan; pchan = pchan->next) {
if (pchan->agrp_index == pose->active_group)
pchan->agrp_index = 0;
else if (pchan->agrp_index > pose->active_group)
pchan->agrp_index--;
}
/* now, remove it from the pose */
BLI_freelinkN(&pose->agroups, grp);
pose->active_group--;
if (pose->active_group < 0 || pose->agroups.first == NULL) {
pose->active_group = 0;
}
}
}
示例8: remove_active_ks_path_exec
static int remove_active_ks_path_exec (bContext *C, wmOperator *op)
{
Scene *scene= CTX_data_scene(C);
KeyingSet *ks= BLI_findlink(&scene->keyingsets, scene->active_keyingset-1);
/* if there is a KeyingSet, find the nominated path to remove */
if (ks) {
KS_Path *ksp= BLI_findlink(&ks->paths, ks->active_path-1);
if (ksp) {
/* NOTE: sync this code with BKE_keyingset_free() */
{
/* free RNA-path info */
MEM_freeN(ksp->rna_path);
/* free path itself */
BLI_freelinkN(&ks->paths, ksp);
}
/* the active path should now be the previously second-to-last active one */
ks->active_path--;
}
else {
BKE_report(op->reports, RPT_ERROR, "No active Keying Set Path to remove");
return OPERATOR_CANCELLED;
}
}
else {
BKE_report(op->reports, RPT_ERROR, "No active Keying Set to remove a path from");
return OPERATOR_CANCELLED;
}
return OPERATOR_FINISHED;
}
示例9: ANIM_fcurves_copybuf_free
/* This function frees any MEM_calloc'ed copy/paste buffer data */
void ANIM_fcurves_copybuf_free(void)
{
tAnimCopybufItem *aci, *acn;
/* free each buffer element */
for (aci = animcopybuf.first; aci; aci = acn) {
acn = aci->next;
/* free keyframes */
if (aci->bezt)
MEM_freeN(aci->bezt);
/* free RNA-path */
if (aci->rna_path)
MEM_freeN(aci->rna_path);
/* free ourself */
BLI_freelinkN(&animcopybuf, aci);
}
/* restore initial state */
BLI_listbase_clear(&animcopybuf);
animcopy_firstframe = 999999999.0f;
animcopy_lastframe = -999999999.0f;
}
示例10: BLI_replaceNode
void BLI_replaceNode(BGraph *graph, BNode *node_src, BNode *node_replaced)
{
BArc *arc, *next_arc;
for (arc = graph->arcs.first; arc; arc = next_arc) {
next_arc = arc->next;
if (arc->head == node_replaced) {
arc->head = node_src;
node_replaced->degree--;
node_src->degree++;
}
if (arc->tail == node_replaced) {
arc->tail = node_src;
node_replaced->degree--;
node_src->degree++;
}
if (arc->head == arc->tail) {
node_src->degree -= 2;
graph->free_arc(arc);
BLI_freelinkN(&graph->arcs, arc);
}
}
if (node_replaced->degree == 0) {
BLI_removeNode(graph, node_replaced);
}
}
示例11: ANIM_keyingset_info_unregister
/* Remove the given KeyingSetInfo from the list of type infos, and also remove the builtin set if appropriate */
void ANIM_keyingset_info_unregister (Main *bmain, KeyingSetInfo *ksi)
{
KeyingSet *ks, *ksn;
/* find relevant builtin KeyingSets which use this, and remove them */
// TODO: this isn't done now, since unregister is really only used atm when we
// reload the scripts, which kindof defeats the purpose of "builtin"?
for (ks= builtin_keyingsets.first; ks; ks= ksn) {
ksn = ks->next;
/* remove if matching typeinfo name */
if (strcmp(ks->typeinfo, ksi->idname) == 0) {
Scene *scene;
BKE_keyingset_free(ks);
BLI_remlink(&builtin_keyingsets, ks);
for(scene= bmain->scene.first; scene; scene= scene->id.next)
BLI_remlink_safe(&scene->keyingsets, ks);
MEM_freeN(ks);
}
}
/* free the type info */
BLI_freelinkN(&keyingset_type_infos, ksi);
}
示例12: BKE_pose_remove_group
/* Remove the given bone-group (expects 'virtual' index (+1 one, used by active_group etc.))
* index might be invalid ( < 1), in which case it will be find from grp. */
void BKE_pose_remove_group(bPose *pose, bActionGroup *grp, const int index)
{
bPoseChannel *pchan;
int idx = index;
if (idx < 1) {
idx = BLI_findindex(&pose->agroups, grp) + 1;
}
BLI_assert(idx > 0);
/* adjust group references (the trouble of using indices!):
* - firstly, make sure nothing references it
* - also, make sure that those after this item get corrected
*/
for (pchan = pose->chanbase.first; pchan; pchan = pchan->next) {
if (pchan->agrp_index == idx)
pchan->agrp_index = 0;
else if (pchan->agrp_index > idx)
pchan->agrp_index--;
}
/* now, remove it from the pose */
BLI_freelinkN(&pose->agroups, grp);
if (pose->active_group >= idx) {
pose->active_group--;
if (pose->active_group < 0 || BLI_listbase_is_empty(&pose->agroups)) {
pose->active_group = 0;
}
}
}
示例13: task_scheduler_clear
static void task_scheduler_clear(TaskScheduler *scheduler, TaskPool *pool)
{
Task *task, *nexttask;
size_t done = 0;
BLI_mutex_lock(&scheduler->queue_mutex);
/* free all tasks from this pool from the queue */
for (task = scheduler->queue.first; task; task = nexttask) {
nexttask = task->next;
if (task->pool == pool) {
if (task->free_taskdata)
MEM_freeN(task->taskdata);
BLI_freelinkN(&scheduler->queue, task);
done++;
}
}
BLI_mutex_unlock(&scheduler->queue_mutex);
/* notify done */
task_pool_num_decrease(pool, done);
}
示例14: BLI_removeArc
void BLI_removeArc(BGraph *graph, BArc *arc)
{
if (graph->free_arc) {
graph->free_arc(arc);
}
BLI_freelinkN(&graph->arcs, arc);
}
示例15: remove_keyingset_button_exec
static int remove_keyingset_button_exec (bContext *C, wmOperator *op)
{
Scene *scene= CTX_data_scene(C);
KeyingSet *ks = NULL;
PropertyRNA *prop= NULL;
PointerRNA ptr;
char *path = NULL;
short success= 0;
int index=0;
/* verify the Keying Set to use:
* - use the active one for now (more control over this can be added later)
* - return error if it doesn't exist
*/
if (scene->active_keyingset == 0) {
BKE_report(op->reports, RPT_ERROR, "No active Keying Set to remove property from");
return OPERATOR_CANCELLED;
}
else
ks= BLI_findlink(&scene->keyingsets, scene->active_keyingset-1);
/* try to add to keyingset using property retrieved from UI */
memset(&ptr, 0, sizeof(PointerRNA));
uiAnimContextProperty(C, &ptr, &prop, &index);
if (ptr.data && prop) {
path= RNA_path_from_ID_to_property(&ptr, prop);
if (path) {
KS_Path *ksp;
/* try to find a path matching this description */
ksp= BKE_keyingset_find_destination(ks, ptr.id.data, ks->name, path, index, KSP_GROUP_KSNAME);
if (ksp) {
/* just free it... */
MEM_freeN(ksp->rna_path);
BLI_freelinkN(&ks->paths, ksp);
success= 1;
}
/* free temp path used */
MEM_freeN(path);
}
}
if (success) {
/* send updates */
ED_anim_dag_flush_update(C);
/* for now, only send ND_KEYS for KeyingSets */
WM_event_add_notifier(C, NC_SCENE|ND_KEYINGSET, NULL);
}
return (success)? OPERATOR_FINISHED: OPERATOR_CANCELLED;
}