static void clean_action_keys (bAnimContext *ac, float thresh) { ListBase anim_data = {NULL, NULL}; bAnimListElem *ale; int filter; /* filter data */ filter= (ANIMFILTER_VISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_SEL | ANIMFILTER_CURVESONLY | ANIMFILTER_NODUPLIS); ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype); /* loop through filtered data and clean curves */ for (ale= anim_data.first; ale; ale= ale->next) clean_fcurve((FCurve *)ale->key_data, thresh); /* free temp data */ BLI_freelistN(&anim_data); }
static short paste_action_keys (bAnimContext *ac) { ListBase anim_data = {NULL, NULL}; int filter, ok=0; /* filter data */ filter= (ANIMFILTER_VISIBLE | ANIMFILTER_SEL | ANIMFILTER_FOREDIT | ANIMFILTER_CURVESONLY); ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype); /* paste keyframes */ ok= paste_animedit_keys(ac, &anim_data); /* clean up */ BLI_freelistN(&anim_data); return ok; }
/* Evaluates the curves between each selected keyframe on each frame, and keys the value */ static void sample_action_keys (bAnimContext *ac) { ListBase anim_data = {NULL, NULL}; bAnimListElem *ale; int filter; /* filter data */ filter= (ANIMFILTER_VISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_CURVESONLY | ANIMFILTER_NODUPLIS); ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype); /* loop through filtered data and add keys between selected keyframes on every frame */ for (ale= anim_data.first; ale; ale= ale->next) sample_fcurve((FCurve *)ale->key_data); /* admin and redraws */ BLI_freelistN(&anim_data); }
static void node_group_output_update(bNodeTree *ntree, bNode *node) { bNodeSocket *extsock = node->inputs.last; bNodeLink *link; /* Adding a tree socket and verifying will remove the extension socket! * This list caches the existing links to the extension socket * so they can be recreated after verification. */ ListBase tmplinks; /* find links to the extension socket and store them */ tmplinks.first = tmplinks.last = NULL; for (link = ntree->links.first; link; link = link->next) { if (nodeLinkIsHidden(link)) continue; if (link->tosock == extsock) { bNodeLink *tlink = MEM_callocN(sizeof(bNodeLink), "temporary link"); *tlink = *link; BLI_addtail(&tmplinks, tlink); } } if (tmplinks.first) { bNodeSocket *gsock, *newsock; /* XXX Multiple sockets can be connected to the extension socket at once, * in that case the arbitrary first link determines name and type. * This could be improved by choosing the "best" type among all links, * whatever that means. */ bNodeLink *exposelink = tmplinks.first; /* XXX what if connecting virtual to virtual socket?? */ gsock = ntreeAddSocketInterfaceFromSocket(ntree, exposelink->fromnode, exposelink->fromsock); node_group_output_verify(ntree, node, (ID *)ntree); newsock = node_group_output_find_socket(node, gsock->identifier); /* redirect links to the extension socket */ for (link = tmplinks.first; link; link = link->next) { nodeAddLink(ntree, link->fromnode, link->fromsock, node, newsock); } BLI_freelistN(&tmplinks); } }
/* Auto-keys/tags bones affected by the pose used from the poselib */ static void poselib_keytag_pose (bContext *C, Scene *scene, tPoseLib_PreviewData *pld) { bPose *pose= pld->pose; bPoseChannel *pchan; bAction *act= pld->act; bActionGroup *agrp; KeyingSet *ks = ANIM_get_keyingset_for_autokeying(scene, ANIM_KS_WHOLE_CHARACTER_ID); ListBase dsources = {NULL, NULL}; short autokey = autokeyframe_cfra_can_key(scene, &pld->ob->id); /* start tagging/keying */ for (agrp= act->groups.first; agrp; agrp= agrp->next) { /* only for selected bones unless there aren't any selected, in which case all are included */ pchan= get_pose_channel(pose, agrp->name); if (pchan) { if ( (pld->selcount == 0) || ((pchan->bone) && (pchan->bone->flag & BONE_SELECTED)) ) { if (autokey) { /* add datasource override for the PoseChannel, to be used later */ ANIM_relative_keyingset_add_source(&dsources, &pld->ob->id, &RNA_PoseBone, pchan); /* clear any unkeyed tags */ if (pchan->bone) pchan->bone->flag &= ~BONE_UNKEYED; } else { /* add unkeyed tags */ if (pchan->bone) pchan->bone->flag |= BONE_UNKEYED; } } } } /* perform actual auto-keying now */ if (autokey) { /* insert keyframes for all relevant bones in one go */ ANIM_apply_keyingset(C, &dsources, NULL, ks, MODIFYKEY_MODE_INSERT, (float)CFRA); BLI_freelistN(&dsources); } /* send notifiers for this */ WM_event_add_notifier(C, NC_ANIMATION|ND_KEYFRAME|NA_EDITED, NULL); }
static short paste_action_keys (bAnimContext *ac, const eKeyPasteOffset offset_mode, const eKeyMergeMode merge_mode) { ListBase anim_data = {NULL, NULL}; int filter, ok=0; /* filter data */ filter= (ANIMFILTER_VISIBLE | ANIMFILTER_SEL | ANIMFILTER_FOREDIT | ANIMFILTER_CURVESONLY | ANIMFILTER_NODUPLIS); ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype); /* paste keyframes */ ok= paste_animedit_keys(ac, &anim_data, offset_mode, merge_mode); /* clean up */ BLI_freelistN(&anim_data); return ok; }
void BLI_mempool_destroy(BLI_mempool *pool) { BLI_mempool_chunk *mpchunk=NULL; if(pool->use_sysmalloc) { for(mpchunk = pool->chunks.first; mpchunk; mpchunk = mpchunk->next) { free(mpchunk->data); } BLI_freelist(&(pool->chunks)); free(pool); } else { for(mpchunk = pool->chunks.first; mpchunk; mpchunk = mpchunk->next) { MEM_freeN(mpchunk->data); } BLI_freelistN(&(pool->chunks)); MEM_freeN(pool); } }
void ED_preview_icon_render(Scene *scene, ID *id, unsigned int *rect, int sizex, int sizey) { IconPreview ip = {NULL}; short stop = false, update = false; float progress = 0.0f; ip.scene = scene; ip.owner = id; ip.id = id; icon_preview_add_size(&ip, rect, sizex, sizey); icon_preview_startjob_all_sizes(&ip, &stop, &update, &progress); icon_preview_endjob(&ip); BLI_freelistN(&ip.sizes); }
void ntreeShaderEndExecTree_internal(bNodeTreeExec *exec) { bNodeThreadStack *nts; int a; if (exec->threadstack) { for (a = 0; a < BLENDER_MAX_THREADS; a++) { for (nts = exec->threadstack[a].first; nts; nts = nts->next) if (nts->stack) MEM_freeN(nts->stack); BLI_freelistN(&exec->threadstack[a]); } MEM_freeN(exec->threadstack); exec->threadstack = NULL; } ntree_exec_end(exec); }
/* Option 3) Selects all visible keyframes in the same frame as the mouse click */ static void actkeys_mselect_column(bAnimContext *ac, short select_mode, float selx) { ListBase anim_data = {NULL, NULL}; bAnimListElem *ale; int filter; KeyframeEditFunc select_cb, ok_cb; KeyframeEditData ked = {{NULL}}; /* set up BezTriple edit callbacks */ select_cb = ANIM_editkeyframes_select(select_mode); ok_cb = ANIM_editkeyframes_ok(BEZT_OK_FRAME); /* loop through all of the keys and select additional keyframes * based on the keys found to be selected above */ if (ELEM(ac->datatype, ANIMCONT_GPENCIL, ANIMCONT_MASK)) filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE /*| ANIMFILTER_CURVESONLY */ | ANIMFILTER_NODUPLIS); else filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_NODUPLIS); ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype); for (ale = anim_data.first; ale; ale = ale->next) { AnimData *adt = ANIM_nla_mapping_get(ac, ale); /* set frame for validation callback to refer to */ if (adt) ked.f1 = BKE_nla_tweakedit_remap(adt, selx, NLATIME_CONVERT_UNMAP); else ked.f1 = selx; /* select elements with frame number matching cfra */ if (ale->type == ANIMTYPE_GPLAYER) ED_gpencil_select_frame(ale->key_data, selx, select_mode); else if (ale->type == ANIMTYPE_MASKLAYER) ED_mask_select_frame(ale->key_data, selx, select_mode); else ANIM_fcurve_keyframes_loop(&ked, ale->key_data, ok_cb, select_cb, NULL); } /* free elements */ BLI_freelistN(&ked.list); ANIM_animdata_freelist(&anim_data); }
/* Selects all visible keyframes between the specified markers */ static void markers_selectkeys_between (bAnimContext *ac) { ListBase anim_data = {NULL, NULL}; bAnimListElem *ale; int filter; KeyframeEditFunc ok_cb, select_cb; KeyframeEditData ked; float min, max; /* get extreme markers */ ED_markers_get_minmax(ac->markers, 1, &min, &max); min -= 0.5f; max += 0.5f; /* get editing funcs + data */ ok_cb= ANIM_editkeyframes_ok(BEZT_OK_FRAMERANGE); select_cb= ANIM_editkeyframes_select(SELECT_ADD); memset(&ked, 0, sizeof(KeyframeEditData)); ked.f1= min; ked.f2= max; /* filter data */ filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVEVISIBLE | ANIMFILTER_CURVESONLY | ANIMFILTER_NODUPLIS); ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype); /* select keys in-between */ for (ale= anim_data.first; ale; ale= ale->next) { AnimData *adt= ANIM_nla_mapping_get(ac, ale); if (adt) { ANIM_nla_mapping_apply_fcurve(adt, ale->key_data, 0, 1); ANIM_fcurve_keyframes_loop(&ked, ale->key_data, ok_cb, select_cb, NULL); ANIM_nla_mapping_apply_fcurve(adt, ale->key_data, 1, 1); } else { ANIM_fcurve_keyframes_loop(&ked, ale->key_data, ok_cb, select_cb, NULL); } } /* Cleanup */ BLI_freelistN(&anim_data); }
/* snap current-frame indicator to 'average time' of selected keyframe */ static int actkeys_framejump_exec(bContext *C, wmOperator *op) { bAnimContext ac; ListBase anim_data= {NULL, NULL}; bAnimListElem *ale; int filter; BeztEditData bed; /* get editor data */ if (ANIM_animdata_get_context(C, &ac) == 0) return OPERATOR_CANCELLED; /* init edit data */ memset(&bed, 0, sizeof(BeztEditData)); /* loop over action data, averaging values */ filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVESONLY); ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype); for (ale= anim_data.first; ale; ale= ale->next) { AnimData *adt= ANIM_nla_mapping_get(&ac, ale); if (adt) { ANIM_nla_mapping_apply_fcurve(adt, ale->key_data, 0, 1); ANIM_fcurve_keys_bezier_loop(&bed, ale->key_data, NULL, bezt_calc_average, NULL); ANIM_nla_mapping_apply_fcurve(adt, ale->key_data, 1, 1); } else ANIM_fcurve_keys_bezier_loop(&bed, ale->key_data, NULL, bezt_calc_average, NULL); } BLI_freelistN(&anim_data); /* set the new current frame value, based on the average time */ if (bed.i1) { Scene *scene= ac.scene; CFRA= (int)floor((bed.f1 / bed.i1) + 0.5f); } /* set notifier that things have changed */ WM_event_add_notifier(C, NC_SCENE|ND_FRAME, ac.scene); return OPERATOR_FINISHED; }
/* this function is responsible for setting extrapolation mode for keyframes */ static void setexpo_action_keys(bAnimContext *ac, short mode) { ListBase anim_data = {NULL, NULL}; bAnimListElem *ale; int filter; /* filter data */ filter= (ANIMFILTER_VISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_SEL | ANIMFILTER_CURVESONLY | ANIMFILTER_NODUPLIS); ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype); /* loop through setting mode per F-Curve */ for (ale= anim_data.first; ale; ale= ale->next) { FCurve *fcu= (FCurve *)ale->data; fcu->extend= mode; } /* cleanup */ BLI_freelistN(&anim_data); }
/* option 1) select keyframe directly under mouse */ static void actkeys_mselect_single(bAnimContext *ac, bAnimListElem *ale, short select_mode, float selx) { KeyframeEditData ked = {{NULL}}; KeyframeEditFunc select_cb, ok_cb; /* get functions for selecting keyframes */ select_cb = ANIM_editkeyframes_select(select_mode); ok_cb = ANIM_editkeyframes_ok(BEZT_OK_FRAME); ked.f1 = selx; /* select the nominated keyframe on the given frame */ if (ale->type == ANIMTYPE_GPLAYER) { ED_gpencil_select_frame(ale->data, selx, select_mode); } else if (ale->type == ANIMTYPE_MASKLAYER) { ED_mask_select_frame(ale->data, selx, select_mode); } else { if (ELEM(ac->datatype, ANIMCONT_GPENCIL, ANIMCONT_MASK) && (ale->type == ANIMTYPE_SUMMARY) && (ale->datatype == ALE_ALL)) { ListBase anim_data = {NULL, NULL}; int filter; filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE /*| ANIMFILTER_CURVESONLY */ | ANIMFILTER_NODUPLIS); ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype); for (ale = anim_data.first; ale; ale = ale->next) { if (ale->type == ANIMTYPE_GPLAYER) { ED_gpencil_select_frame(ale->data, selx, select_mode); } else if (ale->type == ANIMTYPE_MASKLAYER) { ED_mask_select_frame(ale->data, selx, select_mode); } } BLI_freelistN(&anim_data); } else { ANIM_animchannel_keyframes_loop(&ked, ac->ads, ale, ok_cb, select_cb, NULL); } } }
/* This function is used to loop over the keyframe data in an Object */ static short ob_keyframes_loop(KeyframeEditData *ked, bDopeSheet *ads, Object *ob, KeyframeEditFunc key_ok, KeyframeEditFunc key_cb, FcuEditFunc fcu_cb) { bAnimContext ac = {NULL}; ListBase anim_data = {NULL, NULL}; bAnimListElem *ale; int filter; int ret = 0; bAnimListElem dummychan = {NULL}; Base dummybase = {NULL}; if (ob == NULL) return 0; /* create a dummy wrapper data to work with */ dummybase.object = ob; dummychan.type = ANIMTYPE_OBJECT; dummychan.data = &dummybase; dummychan.id = &ob->id; dummychan.adt = ob->adt; ac.ads = ads; ac.data = &dummychan; ac.datatype = ANIMCONT_CHANNEL; /* get F-Curves to take keyframes from */ filter = ANIMFILTER_DATA_VISIBLE; // curves only ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype); /* loop through each F-Curve, applying the operation as required, but stopping on the first one */ for (ale = anim_data.first; ale; ale = ale->next) { if (ANIM_fcurve_keyframes_loop(ked, (FCurve *)ale->data, key_ok, key_cb, fcu_cb)) { ret = 1; break; } } BLI_freelistN(&anim_data); /* return return code - defaults to zero if nothing happened */ return ret; }
/** * Free the mempool its self (and all elements). */ void BLI_mempool_destroy(BLI_mempool *pool) { BLI_mempool_chunk *mpchunk = NULL; if (pool->flag & BLI_MEMPOOL_SYSMALLOC) { for (mpchunk = pool->chunks.first; mpchunk; mpchunk = mpchunk->next) { free(mpchunk->data); } BLI_freelist(&(pool->chunks)); free(pool); } else { for (mpchunk = pool->chunks.first; mpchunk; mpchunk = mpchunk->next) { MEM_freeN(mpchunk->data); } BLI_freelistN(&(pool->chunks)); MEM_freeN(pool); } }
/* this function is responsible for snapping keyframes to frame-times */ static void insert_action_keys(bAnimContext *ac, short mode) { ListBase anim_data = {NULL, NULL}; bAnimListElem *ale; int filter; Scene *scene= ac->scene; float cfra= (float)CFRA; short flag = 0; /* filter data */ filter= (ANIMFILTER_VISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_CURVESONLY); if (mode == 2) filter |= ANIMFILTER_SEL; else if (mode == 3) filter |= ANIMFILTER_ACTGROUPED; ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype); /* init keyframing flag */ if (IS_AUTOKEY_FLAG(AUTOMATKEY)) flag |= INSERTKEY_MATRIX; if (IS_AUTOKEY_FLAG(INSERTNEEDED)) flag |= INSERTKEY_NEEDED; if (IS_AUTOKEY_MODE(scene, EDITKEYS)) flag |= INSERTKEY_REPLACE; /* insert keyframes */ for (ale= anim_data.first; ale; ale= ale->next) { AnimData *adt= ANIM_nla_mapping_get(ac, ale); FCurve *fcu= (FCurve *)ale->key_data; /* adjust current frame for NLA-scaling */ if (adt) cfra= BKE_nla_tweakedit_remap(adt, (float)CFRA, NLATIME_CONVERT_UNMAP); else cfra= (float)CFRA; /* if there's an id */ if (ale->id) insert_keyframe(ale->id, NULL, ((fcu->grp)?(fcu->grp->name):(NULL)), fcu->rna_path, fcu->array_index, cfra, flag); else insert_vert_fcurve(fcu, cfra, fcu->curval, 0); } BLI_freelistN(&anim_data); }
/* this function is responsible for snapping keyframes to frame-times */ static void snap_action_keys(bAnimContext *ac, short mode) { ListBase anim_data = {NULL, NULL}; bAnimListElem *ale; int filter; KeyframeEditData ked= {{NULL}}; KeyframeEditFunc edit_cb; /* filter data */ if (ac->datatype == ANIMCONT_GPENCIL) filter= (ANIMFILTER_VISIBLE | ANIMFILTER_FOREDIT); else filter= (ANIMFILTER_VISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_CURVESONLY | ANIMFILTER_NODUPLIS); ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype); /* get beztriple editing callbacks */ edit_cb= ANIM_editkeyframes_snap(mode); ked.scene= ac->scene; if (mode == ACTKEYS_SNAP_NEAREST_MARKER) { ked.list.first= (ac->markers) ? ac->markers->first : NULL; ked.list.last= (ac->markers) ? ac->markers->last : NULL; } /* snap keyframes */ for (ale= anim_data.first; ale; ale= ale->next) { AnimData *adt= ANIM_nla_mapping_get(ac, ale); if (adt) { ANIM_nla_mapping_apply_fcurve(adt, ale->key_data, 0, 1); ANIM_fcurve_keyframes_loop(&ked, ale->key_data, NULL, edit_cb, calchandles_fcurve); ANIM_nla_mapping_apply_fcurve(adt, ale->key_data, 1, 1); } //else if (ale->type == ACTTYPE_GPLAYER) // snap_gplayer_frames(ale->data, mode); else ANIM_fcurve_keyframes_loop(&ked, ale->key_data, NULL, edit_cb, calchandles_fcurve); } BLI_freelistN(&anim_data); }
void BLI_end_threads(ListBase *threadbase) { ThreadSlot *tslot; /* only needed if there's actually some stuff to end * this way we don't end up decrementing thread_levels on an empty threadbase * */ if (threadbase && (BLI_listbase_is_empty(threadbase) == false)) { for (tslot = threadbase->first; tslot; tslot = tslot->next) { if (tslot->avail == 0) { pthread_join(tslot->pthread, NULL); } } BLI_freelistN(threadbase); } thread_levels--; if (thread_levels == 0) MEM_set_lock_callback(NULL, NULL); }
/* Free the given tree's data but not the tree itself */ void BLI_dlrbTree_free (DLRBT_Tree *tree) { if (tree == NULL) return; /* if the list-base stuff is set, just use that (and assume its set), * otherwise, we'll need to traverse the tree... */ if (tree->first) { /* free list */ BLI_freelistN((ListBase *)tree); } else { /* traverse tree, freeing sub-nodes */ recursive_tree_free_nodes(tree->root); } /* clear pointers */ tree->first= tree->last= tree->root= NULL; }
static short copy_action_keys(bAnimContext *ac) { ListBase anim_data = {NULL, NULL}; int filter, ok = 0; /* clear buffer first */ free_anim_copybuf(); /* filter data */ filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE /*| ANIMFILTER_CURVESONLY*/ | ANIMFILTER_NODUPLIS); ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype); /* copy keyframes */ ok = copy_animedit_keys(ac, &anim_data); /* clean up */ BLI_freelistN(&anim_data); return ok; }
/* this function is responsible for setting interpolation mode for keyframes */ static void setkeytype_action_keys(bAnimContext *ac, short mode) { ListBase anim_data = {NULL, NULL}; bAnimListElem *ale; int filter; KeyframeEditFunc set_cb = ANIM_editkeyframes_keytype(mode); /* filter data */ filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_FOREDIT /*| ANIMFILTER_CURVESONLY*/ | ANIMFILTER_NODUPLIS); ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype); /* loop through setting BezTriple interpolation * Note: we do not supply KeyframeEditData to the looper yet. Currently that's not necessary here... */ for (ale = anim_data.first; ale; ale = ale->next) ANIM_fcurve_keyframes_loop(NULL, ale->key_data, NULL, set_cb, NULL); /* cleanup */ BLI_freelistN(&anim_data); }
void ntreeTexEndExecTree_internal(bNodeTreeExec *exec) { bNodeThreadStack *nts; int a; if (exec->threadstack) { tex_free_delegates(exec); for (a = 0; a < exec->tot_thread; a++) { for (nts = exec->threadstack[a].first; nts; nts = nts->next) if (nts->stack) MEM_freeN(nts->stack); BLI_freelistN(&exec->threadstack[a]); } MEM_freeN(exec->threadstack); exec->threadstack = NULL; } ntree_exec_end(exec); }
BlenderStrokeRenderer::~BlenderStrokeRenderer() { if (0 != _textureManager) { delete _textureManager; _textureManager = NULL; } // The freestyle_scene object is not released here. Instead, // the scene is released in free_all_freestyle_renders() in // source/blender/render/intern/source/pipeline.c, after the // compositor has finished. // release objects and data blocks for (Base *b = (Base *)freestyle_scene->base.first; b; b = b->next) { Object *ob = b->object; void *data = ob->data; char *name = ob->id.name; #if 0 if (G.debug & G_DEBUG_FREESTYLE) { cout << "removing " << name[0] << name[1] << ":" << (name+2) << endl; } #endif switch (ob->type) { case OB_MESH: BKE_libblock_free(&freestyle_bmain->object, ob); BKE_libblock_free(&freestyle_bmain->mesh, data); break; case OB_CAMERA: BKE_libblock_free(&freestyle_bmain->object, ob); BKE_libblock_free(&freestyle_bmain->camera, data); freestyle_scene->camera = NULL; break; default: cerr << "Warning: unexpected object in the scene: " << name[0] << name[1] << ":" << (name + 2) << endl; } } BLI_freelistN(&freestyle_scene->base); // release material BKE_libblock_free(&freestyle_bmain->mat, material); }
/* this function is responsible for snapping keyframes to frame-times */ static void insert_action_keys(bAnimContext *ac, short mode) { ListBase anim_data = {NULL, NULL}; bAnimListElem *ale; int filter; ReportList *reports = ac->reports; Scene *scene = ac->scene; short flag = 0; /* filter data */ filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_FOREDIT /*| ANIMFILTER_CURVESONLY*/ | ANIMFILTER_NODUPLIS); if (mode == 2) filter |= ANIMFILTER_SEL; else if (mode == 3) filter |= ANIMFILTER_ACTGROUPED; ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype); /* init keyframing flag */ flag = ANIM_get_keyframing_flags(scene, 1); /* insert keyframes */ for (ale = anim_data.first; ale; ale = ale->next) { AnimData *adt = ANIM_nla_mapping_get(ac, ale); FCurve *fcu = (FCurve *)ale->key_data; float cfra; /* adjust current frame for NLA-scaling */ if (adt) cfra = BKE_nla_tweakedit_remap(adt, (float)CFRA, NLATIME_CONVERT_UNMAP); else cfra = (float)CFRA; /* if there's an id */ if (ale->id) insert_keyframe(reports, ale->id, NULL, ((fcu->grp) ? (fcu->grp->name) : (NULL)), fcu->rna_path, fcu->array_index, cfra, flag); else insert_vert_fcurve(fcu, cfra, fcu->curval, 0); } BLI_freelistN(&anim_data); }
void free_pose(bPose *pose) { if (pose) { /* free pose-channels */ free_pose_channels(pose); /* 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); /* free pose */ MEM_freeN(pose); } }
/* not region itself */ void BKE_area_region_free(SpaceType *st, ARegion *ar) { if (st) { ARegionType *art= BKE_regiontype_from_id(st, ar->regiontype); if (art && art->free) art->free(ar); if (ar->regiondata) printf("regiondata free error\n"); } else if (ar->type && ar->type->free) ar->type->free(ar); if (ar->v2d.tab_offset) { MEM_freeN(ar->v2d.tab_offset); ar->v2d.tab_offset= NULL; } BLI_freelistN(&ar->panels); }
static void fluidbake_free_data(FluidAnimChannels *channels, ListBase *fobjects, elbeemSimulationSettings *fsset, FluidBakeJob *fb) { free_domain_channels(channels); MEM_freeN(channels); channels = NULL; free_all_fluidobject_channels(fobjects); BLI_freelistN(fobjects); MEM_freeN(fobjects); fobjects = NULL; if (fsset) { MEM_freeN(fsset); fsset = NULL; } if (fb) { MEM_freeN(fb); fb = NULL; } }
void ED_armature_edit_free(struct bArmature *arm) { EditBone *eBone; /* Clear the editbones list */ if (arm->edbo) { if (arm->edbo->first) { for (eBone = arm->edbo->first; eBone; eBone = eBone->next) { if (eBone->prop) { IDP_FreeProperty(eBone->prop); MEM_freeN(eBone->prop); } } BLI_freelistN(arm->edbo); } MEM_freeN(arm->edbo); arm->edbo = NULL; arm->act_edbone = NULL; } }
/** * 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); /* free pose */ MEM_freeN(pose); } }