本文整理汇总了C++中BLI_freelistN函数的典型用法代码示例。如果您正苦于以下问题:C++ BLI_freelistN函数的具体用法?C++ BLI_freelistN怎么用?C++ BLI_freelistN使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了BLI_freelistN函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: clean_action_keys
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);
}
示例2: paste_action_keys
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;
}
示例3: sample_action_keys
/* 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);
}
示例4: node_group_output_update
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);
}
}
示例5: paste_action_keys
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;
}
示例6: BLI_mempool_destroy
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);
}
}
示例7: ED_preview_icon_render
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);
}
示例8: ntreeShaderEndExecTree_internal
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);
}
示例9: actkeys_mselect_column
/* 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);
}
示例10: actkeys_framejump_exec
/* 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;
}
示例11: setexpo_action_keys
/* 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);
}
示例12: actkeys_mselect_single
/* 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);
}
}
}
示例13: ob_keyframes_loop
/* 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;
}
示例14: insert_action_keys
/* 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);
}
示例15: snap_action_keys
/* 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);
}