patch [#34103] - listbase.patch, insertlinkbefore.patch
from Lawrence D'Oliveiro (ldo) notes from tracker: use bool for return type from BLI_remlink_safe, necessitating including BLI_utildefines.h in BLI_listbase.h get rid of duplicate BLI_insertlink, use BLI_insertlinkafter instead. A few places which were using BLI_insertlinkafter (actually BLI_insertlink), when it would be simpler to use BLI_insertlinkbefore instead.
This commit is contained in:
parent
7ad0790189
commit
4df5b943ed
|
@ -454,7 +454,7 @@ void IDP_ReplaceGroupInGroup(IDProperty *dest, IDProperty *src)
|
|||
if (strcmp(loop->name, prop->name) == 0) {
|
||||
IDProperty *copy = IDP_CopyProperty(prop);
|
||||
|
||||
BLI_insertlink(&dest->data.group, loop, copy);
|
||||
BLI_insertlinkafter(&dest->data.group, loop, copy);
|
||||
|
||||
BLI_remlink(&dest->data.group, loop);
|
||||
IDP_FreeProperty(loop);
|
||||
|
@ -479,7 +479,7 @@ void IDP_ReplaceInGroup(IDProperty *group, IDProperty *prop)
|
|||
{
|
||||
IDProperty *loop;
|
||||
if ((loop = IDP_GetPropertyFromGroup(group, prop->name))) {
|
||||
BLI_insertlink(&group->data.group, loop, prop);
|
||||
BLI_insertlinkafter(&group->data.group, loop, prop);
|
||||
|
||||
BLI_remlink(&group->data.group, loop);
|
||||
IDP_FreeProperty(loop);
|
||||
|
@ -532,7 +532,7 @@ int IDP_InsertToGroup(IDProperty *group, IDProperty *previous, IDProperty *pnew)
|
|||
{
|
||||
if (IDP_GetPropertyFromGroup(group, pnew->name) == NULL) {
|
||||
group->len++;
|
||||
BLI_insertlink(&group->data.group, previous, pnew);
|
||||
BLI_insertlinkafter(&group->data.group, previous, pnew);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
|
|
@ -246,7 +246,7 @@ void BKE_key_sort(Key *key)
|
|||
/* find the right location and insert before */
|
||||
for (kb2 = key->block.first; kb2; kb2 = kb2->next) {
|
||||
if (kb2->pos > kb->pos) {
|
||||
BLI_insertlink(&key->block, kb2->prev, kb);
|
||||
BLI_insertlinkafter(&key->block, kb2->prev, kb);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -734,7 +734,7 @@ void sca_move_sensor(bSensor *sens_to_move, Object *ob, int move_up)
|
|||
}
|
||||
if (tmp) {
|
||||
BLI_remlink(&ob->sensors, sens);
|
||||
BLI_insertlink(&ob->sensors, tmp, sens);
|
||||
BLI_insertlinkafter(&ob->sensors, tmp, sens);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -778,7 +778,7 @@ void sca_move_controller(bController *cont_to_move, Object *ob, int move_up)
|
|||
tmp = tmp->next;
|
||||
}
|
||||
BLI_remlink(&ob->controllers, cont);
|
||||
BLI_insertlink(&ob->controllers, tmp, cont);
|
||||
BLI_insertlinkafter(&ob->controllers, tmp, cont);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -818,7 +818,7 @@ void sca_move_actuator(bActuator *act_to_move, Object *ob, int move_up)
|
|||
}
|
||||
if (tmp) {
|
||||
BLI_remlink(&ob->actuators, act);
|
||||
BLI_insertlink(&ob->actuators, tmp, act);
|
||||
BLI_insertlinkafter(&ob->actuators, tmp, act);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -32,6 +32,7 @@
|
|||
* \ingroup bli
|
||||
*/
|
||||
|
||||
#include "BLI_utildefines.h"
|
||||
#include "DNA_listBase.h"
|
||||
//struct ListBase;
|
||||
//struct LinkData;
|
||||
|
@ -40,7 +41,6 @@
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
void BLI_insertlink(struct ListBase *listbase, void *vprevlink, void *vnewlink);
|
||||
int BLI_findindex(const struct ListBase *listbase, const void *vlink);
|
||||
int BLI_findstringindex(const struct ListBase *listbase, const char *id, const int offset);
|
||||
|
||||
|
@ -59,7 +59,7 @@ void *BLI_rfindptr(const struct ListBase *listbase, const void *ptr, const int o
|
|||
void BLI_freelistN(struct ListBase *listbase);
|
||||
void BLI_addtail(struct ListBase *listbase, void *vlink);
|
||||
void BLI_remlink(struct ListBase *listbase, void *vlink);
|
||||
int BLI_remlink_safe(struct ListBase *listbase, void *vlink);
|
||||
bool BLI_remlink_safe(struct ListBase *listbase, void *vlink);
|
||||
|
||||
void BLI_addhead(struct ListBase *listbase, void *vlink);
|
||||
void BLI_insertlinkbefore(struct ListBase *listbase, void *vnextlink, void *vnewlink);
|
||||
|
|
|
@ -28,9 +28,10 @@
|
|||
|
||||
/** \file blender/blenlib/intern/listbase.c
|
||||
* \ingroup bli
|
||||
*
|
||||
* Manipulations on ListBase structs
|
||||
*/
|
||||
|
||||
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
|
@ -41,10 +42,11 @@
|
|||
|
||||
#include "BLI_listbase.h"
|
||||
|
||||
|
||||
/* implementation */
|
||||
|
||||
/* Ripped this from blender.c */
|
||||
/**
|
||||
* moves the entire contents of \a src onto the end of \a dst.
|
||||
*/
|
||||
void BLI_movelisttolist(ListBase *dst, ListBase *src)
|
||||
{
|
||||
if (src->first == NULL) return;
|
||||
|
@ -61,6 +63,9 @@ void BLI_movelisttolist(ListBase *dst, ListBase *src)
|
|||
src->first = src->last = NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepends \a vlink (assumed to begin with a Link) onto listbase.
|
||||
*/
|
||||
void BLI_addhead(ListBase *listbase, void *vlink)
|
||||
{
|
||||
Link *link = vlink;
|
||||
|
@ -77,6 +82,9 @@ void BLI_addhead(ListBase *listbase, void *vlink)
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* Appends \a vlink (assumed to begin with a Link) onto listbase.
|
||||
*/
|
||||
void BLI_addtail(ListBase *listbase, void *vlink)
|
||||
{
|
||||
Link *link = vlink;
|
||||
|
@ -93,6 +101,9 @@ void BLI_addtail(ListBase *listbase, void *vlink)
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* Removes \a vlink from \a listbase. Assumes it is linked into there!
|
||||
*/
|
||||
void BLI_remlink(ListBase *listbase, void *vlink)
|
||||
{
|
||||
Link *link = vlink;
|
||||
|
@ -107,18 +118,24 @@ void BLI_remlink(ListBase *listbase, void *vlink)
|
|||
if (listbase->first == link) listbase->first = link->next;
|
||||
}
|
||||
|
||||
int BLI_remlink_safe(ListBase *listbase, void *vlink)
|
||||
/**
|
||||
* Checks that \a vlink is linked into listbase, removing it from there if so.
|
||||
*/
|
||||
bool BLI_remlink_safe(ListBase *listbase, void *vlink)
|
||||
{
|
||||
if (BLI_findindex(listbase, vlink) != -1) {
|
||||
BLI_remlink(listbase, vlink);
|
||||
return 1;
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
return 0;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Removes \a vlink from listbase and disposes of it. Assumes it is linked into there!
|
||||
*/
|
||||
void BLI_freelinkN(ListBase *listbase, void *vlink)
|
||||
{
|
||||
Link *link = vlink;
|
||||
|
@ -131,43 +148,11 @@ void BLI_freelinkN(ListBase *listbase, void *vlink)
|
|||
}
|
||||
|
||||
|
||||
void BLI_insertlink(ListBase *listbase, void *vprevlink, void *vnewlink)
|
||||
{
|
||||
Link *prevlink = vprevlink;
|
||||
Link *newlink = vnewlink;
|
||||
|
||||
/* newlink comes after prevlink */
|
||||
if (newlink == NULL) return;
|
||||
if (listbase == NULL) return;
|
||||
|
||||
/* empty list */
|
||||
if (listbase->first == NULL) {
|
||||
|
||||
listbase->first = newlink;
|
||||
listbase->last = newlink;
|
||||
return;
|
||||
}
|
||||
|
||||
/* insert before first element */
|
||||
if (prevlink == NULL) {
|
||||
newlink->next = listbase->first;
|
||||
newlink->prev = NULL;
|
||||
newlink->next->prev = newlink;
|
||||
listbase->first = newlink;
|
||||
return;
|
||||
}
|
||||
|
||||
/* at end of list */
|
||||
if (listbase->last == prevlink)
|
||||
listbase->last = newlink;
|
||||
|
||||
newlink->next = prevlink->next;
|
||||
prevlink->next = newlink;
|
||||
if (newlink->next) newlink->next->prev = newlink;
|
||||
newlink->prev = prevlink;
|
||||
}
|
||||
|
||||
/* This uses insertion sort, so NOT ok for large list */
|
||||
/**
|
||||
* Sorts the elements of listbase into the order defined by cmp
|
||||
* (which should return 1 iff its first arg should come after its second arg).
|
||||
* This uses insertion sort, so NOT ok for large list.
|
||||
*/
|
||||
void BLI_sortlist(ListBase *listbase, int (*cmp)(void *, void *))
|
||||
{
|
||||
Link *current = NULL;
|
||||
|
@ -193,6 +178,10 @@ void BLI_sortlist(ListBase *listbase, int (*cmp)(void *, void *))
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Inserts \a vnewlink immediately following \a vprevlink in \a listbase.
|
||||
* Or, if \a vprevlink is NULL, puts \a vnewlink at the front of the list.
|
||||
*/
|
||||
void BLI_insertlinkafter(ListBase *listbase, void *vprevlink, void *vnewlink)
|
||||
{
|
||||
Link *prevlink = vprevlink;
|
||||
|
@ -213,21 +202,28 @@ void BLI_insertlinkafter(ListBase *listbase, void *vprevlink, void *vnewlink)
|
|||
if (prevlink == NULL) {
|
||||
newlink->prev = NULL;
|
||||
newlink->next = listbase->first;
|
||||
((Link *)listbase->first)->prev = newlink;
|
||||
newlink->next->prev = newlink;
|
||||
listbase->first = newlink;
|
||||
return;
|
||||
}
|
||||
|
||||
/* at end of list */
|
||||
if (listbase->last == prevlink)
|
||||
if (listbase->last == prevlink) {
|
||||
listbase->last = newlink;
|
||||
}
|
||||
|
||||
newlink->next = prevlink->next;
|
||||
newlink->prev = prevlink;
|
||||
prevlink->next = newlink;
|
||||
if (newlink->next) newlink->next->prev = newlink;
|
||||
if (newlink->next) {
|
||||
newlink->next->prev = newlink;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Inserts \a vnewlink immediately preceding \a vnextlink in listbase.
|
||||
* Or, if \a vnextlink is NULL, puts \a vnewlink at the end of the list.
|
||||
*/
|
||||
void BLI_insertlinkbefore(ListBase *listbase, void *vnextlink, void *vnewlink)
|
||||
{
|
||||
Link *nextlink = vnextlink;
|
||||
|
@ -254,16 +250,22 @@ void BLI_insertlinkbefore(ListBase *listbase, void *vnextlink, void *vnewlink)
|
|||
}
|
||||
|
||||
/* at beginning of list */
|
||||
if (listbase->first == nextlink)
|
||||
if (listbase->first == nextlink) {
|
||||
listbase->first = newlink;
|
||||
}
|
||||
|
||||
newlink->next = nextlink;
|
||||
newlink->prev = nextlink->prev;
|
||||
nextlink->prev = newlink;
|
||||
if (newlink->prev) newlink->prev->next = newlink;
|
||||
if (newlink->prev) {
|
||||
newlink->prev->next = newlink;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Removes and disposes of the entire contents of listbase using direct free(3).
|
||||
*/
|
||||
void BLI_freelist(ListBase *listbase)
|
||||
{
|
||||
Link *link, *next;
|
||||
|
@ -282,6 +284,9 @@ void BLI_freelist(ListBase *listbase)
|
|||
listbase->last = NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes and disposes of the entire contents of \a listbase using guardedalloc.
|
||||
*/
|
||||
void BLI_freelistN(ListBase *listbase)
|
||||
{
|
||||
Link *link, *next;
|
||||
|
@ -300,6 +305,9 @@ void BLI_freelistN(ListBase *listbase)
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the number of elements in \a listbase.
|
||||
*/
|
||||
int BLI_countlist(const ListBase *listbase)
|
||||
{
|
||||
Link *link;
|
||||
|
@ -315,6 +323,9 @@ int BLI_countlist(const ListBase *listbase)
|
|||
return count;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the nth element of \a listbase, numbering from 1.
|
||||
*/
|
||||
void *BLI_findlink(const ListBase *listbase, int number)
|
||||
{
|
||||
Link *link = NULL;
|
||||
|
@ -330,6 +341,9 @@ void *BLI_findlink(const ListBase *listbase, int number)
|
|||
return link;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the nth-last element of \a listbase, numbering from 1.
|
||||
*/
|
||||
void *BLI_rfindlink(const ListBase *listbase, int number)
|
||||
{
|
||||
Link *link = NULL;
|
||||
|
@ -345,6 +359,9 @@ void *BLI_rfindlink(const ListBase *listbase, int number)
|
|||
return link;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the position of \a vlink within \a listbase, numbering from 1, or -1 if not found.
|
||||
*/
|
||||
int BLI_findindex(const ListBase *listbase, const void *vlink)
|
||||
{
|
||||
Link *link = NULL;
|
||||
|
@ -365,6 +382,10 @@ int BLI_findindex(const ListBase *listbase, const void *vlink)
|
|||
return -1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Finds the first element of \a listbase which contains the null-terminated
|
||||
* string \a id at the specified offset, returning NULL if not found.
|
||||
*/
|
||||
void *BLI_findstring(const ListBase *listbase, const char *id, const int offset)
|
||||
{
|
||||
Link *link = NULL;
|
||||
|
@ -383,6 +404,10 @@ void *BLI_findstring(const ListBase *listbase, const char *id, const int offset)
|
|||
return NULL;
|
||||
}
|
||||
/* same as above but find reverse */
|
||||
/**
|
||||
* Finds the last element of \a listbase which contains the
|
||||
* null-terminated string \a id at the specified offset, returning NULL if not found.
|
||||
*/
|
||||
void *BLI_rfindstring(const ListBase *listbase, const char *id, const int offset)
|
||||
{
|
||||
Link *link = NULL;
|
||||
|
@ -401,6 +426,10 @@ void *BLI_rfindstring(const ListBase *listbase, const char *id, const int offset
|
|||
return NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
* Finds the first element of \a listbase which contains a pointer to the
|
||||
* null-terminated string \a id at the specified offset, returning NULL if not found.
|
||||
*/
|
||||
void *BLI_findstring_ptr(const ListBase *listbase, const char *id, const int offset)
|
||||
{
|
||||
Link *link = NULL;
|
||||
|
@ -420,6 +449,10 @@ void *BLI_findstring_ptr(const ListBase *listbase, const char *id, const int off
|
|||
return NULL;
|
||||
}
|
||||
/* same as above but find reverse */
|
||||
/**
|
||||
* Finds the last element of \a listbase which contains a pointer to the
|
||||
* null-terminated string \a id at the specified offset, returning NULL if not found.
|
||||
*/
|
||||
void *BLI_rfindstring_ptr(const ListBase *listbase, const char *id, const int offset)
|
||||
{
|
||||
Link *link = NULL;
|
||||
|
@ -440,6 +473,8 @@ void *BLI_rfindstring_ptr(const ListBase *listbase, const char *id, const int of
|
|||
}
|
||||
|
||||
void *BLI_findptr(const ListBase *listbase, const void *ptr, const int offset)
|
||||
/* finds the first element of listbase which contains the specified pointer value
|
||||
at the specified offset, returning NULL if not found. */
|
||||
{
|
||||
Link *link = NULL;
|
||||
const void *ptr_iter;
|
||||
|
@ -448,7 +483,7 @@ void *BLI_findptr(const ListBase *listbase, const void *ptr, const int offset)
|
|||
|
||||
for (link = listbase->first; link; link = link->next) {
|
||||
/* exact copy of BLI_findstring(), except for this line */
|
||||
ptr_iter = *((const char **)(((const char *)link) + offset));
|
||||
ptr_iter = *((const void **)(((const char *)link) + offset));
|
||||
|
||||
if (ptr == ptr_iter) {
|
||||
return link;
|
||||
|
@ -459,6 +494,8 @@ void *BLI_findptr(const ListBase *listbase, const void *ptr, const int offset)
|
|||
}
|
||||
/* same as above but find reverse */
|
||||
void *BLI_rfindptr(const ListBase *listbase, const void *ptr, const int offset)
|
||||
/* finds the last element of listbase which contains the specified pointer value
|
||||
at the specified offset, returning NULL if not found. */
|
||||
{
|
||||
Link *link = NULL;
|
||||
const void *ptr_iter;
|
||||
|
@ -467,7 +504,7 @@ void *BLI_rfindptr(const ListBase *listbase, const void *ptr, const int offset)
|
|||
|
||||
for (link = listbase->last; link; link = link->prev) {
|
||||
/* exact copy of BLI_rfindstring(), except for this line */
|
||||
ptr_iter = *((const char **)(((const char *)link) + offset));
|
||||
ptr_iter = *((const void **)(((const char *)link) + offset));
|
||||
|
||||
if (ptr == ptr_iter) {
|
||||
return link;
|
||||
|
@ -478,6 +515,8 @@ void *BLI_rfindptr(const ListBase *listbase, const void *ptr, const int offset)
|
|||
}
|
||||
|
||||
int BLI_findstringindex(const ListBase *listbase, const char *id, const int offset)
|
||||
/* returns the 1-based index of the first element of listbase which contains the specified
|
||||
null-terminated string at the specified offset, or -1 if not found. */
|
||||
{
|
||||
Link *link = NULL;
|
||||
const char *id_iter;
|
||||
|
@ -499,6 +538,7 @@ int BLI_findstringindex(const ListBase *listbase, const char *id, const int offs
|
|||
}
|
||||
|
||||
void BLI_duplicatelist(ListBase *dst, const ListBase *src)
|
||||
/* sets dst to a duplicate of the entire contents of src. dst may be the same as src. */
|
||||
{
|
||||
struct Link *dst_link, *src_link;
|
||||
|
||||
|
|
|
@ -636,7 +636,7 @@ static int ui_but_update_from_old_block(const bContext *C, uiBlock *block, uiBut
|
|||
|
||||
/* move button over from oldblock to new block */
|
||||
BLI_remlink(&oldblock->buttons, oldbut);
|
||||
BLI_insertlink(&block->buttons, but, oldbut);
|
||||
BLI_insertlinkafter(&block->buttons, but, oldbut);
|
||||
oldbut->block = block;
|
||||
*butpp = oldbut;
|
||||
|
||||
|
|
|
@ -385,7 +385,7 @@ int ED_object_modifier_move_up(ReportList *reports, Object *ob, ModifierData *md
|
|||
}
|
||||
|
||||
BLI_remlink(&ob->modifiers, md);
|
||||
BLI_insertlink(&ob->modifiers, md->prev->prev, md);
|
||||
BLI_insertlinkbefore(&ob->modifiers, md->prev, md);
|
||||
}
|
||||
|
||||
return 1;
|
||||
|
@ -406,7 +406,7 @@ int ED_object_modifier_move_down(ReportList *reports, Object *ob, ModifierData *
|
|||
}
|
||||
|
||||
BLI_remlink(&ob->modifiers, md);
|
||||
BLI_insertlink(&ob->modifiers, md->next, md);
|
||||
BLI_insertlinkafter(&ob->modifiers, md->next, md);
|
||||
}
|
||||
|
||||
return 1;
|
||||
|
@ -722,7 +722,7 @@ int ED_object_modifier_copy(ReportList *UNUSED(reports), Object *ob, ModifierDat
|
|||
|
||||
nmd = modifier_new(md->type);
|
||||
modifier_copyData(md, nmd);
|
||||
BLI_insertlink(&ob->modifiers, md, nmd);
|
||||
BLI_insertlinkafter(&ob->modifiers, md, nmd);
|
||||
modifier_unique_name(&ob->modifiers, nmd);
|
||||
|
||||
return 1;
|
||||
|
|
|
@ -157,7 +157,7 @@ static int rule_move_up_exec(bContext *C, wmOperator *UNUSED(op))
|
|||
for (rule = state->rules.first; rule; rule=rule->next) {
|
||||
if (rule->flag & BOIDRULE_CURRENT && rule->prev) {
|
||||
BLI_remlink(&state->rules, rule);
|
||||
BLI_insertlink(&state->rules, rule->prev->prev, rule);
|
||||
BLI_insertlinkbefore(&state->rules, rule->prev, rule);
|
||||
|
||||
DAG_id_tag_update(&part->id, OB_RECALC_DATA|PSYS_RECALC_RESET);
|
||||
break;
|
||||
|
@ -193,7 +193,7 @@ static int rule_move_down_exec(bContext *C, wmOperator *UNUSED(op))
|
|||
for (rule = state->rules.first; rule; rule=rule->next) {
|
||||
if (rule->flag & BOIDRULE_CURRENT && rule->next) {
|
||||
BLI_remlink(&state->rules, rule);
|
||||
BLI_insertlink(&state->rules, rule->next, rule);
|
||||
BLI_insertlinkafter(&state->rules, rule->next, rule);
|
||||
|
||||
DAG_id_tag_update(&part->id, OB_RECALC_DATA|PSYS_RECALC_RESET);
|
||||
break;
|
||||
|
@ -314,7 +314,7 @@ static int state_move_up_exec(bContext *C, wmOperator *UNUSED(op))
|
|||
for (state = boids->states.first; state; state=state->next) {
|
||||
if (state->flag & BOIDSTATE_CURRENT && state->prev) {
|
||||
BLI_remlink(&boids->states, state);
|
||||
BLI_insertlink(&boids->states, state->prev->prev, state);
|
||||
BLI_insertlinkbefore(&boids->states, state->prev, state);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -349,7 +349,7 @@ static int state_move_down_exec(bContext *C, wmOperator *UNUSED(op))
|
|||
for (state = boids->states.first; state; state=state->next) {
|
||||
if (state->flag & BOIDSTATE_CURRENT && state->next) {
|
||||
BLI_remlink(&boids->states, state);
|
||||
BLI_insertlink(&boids->states, state->next, state);
|
||||
BLI_insertlinkafter(&boids->states, state->next, state);
|
||||
DAG_id_tag_update(&part->id, OB_RECALC_DATA|PSYS_RECALC_RESET);
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -310,7 +310,7 @@ static int target_move_up_exec(bContext *C, wmOperator *UNUSED(op))
|
|||
for (; pt; pt=pt->next) {
|
||||
if (pt->flag & PTARGET_CURRENT && pt->prev) {
|
||||
BLI_remlink(&psys->targets, pt);
|
||||
BLI_insertlink(&psys->targets, pt->prev->prev, pt);
|
||||
BLI_insertlinkbefore(&psys->targets, pt->prev, pt);
|
||||
|
||||
DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
|
||||
WM_event_add_notifier(C, NC_OBJECT|ND_PARTICLE, ob);
|
||||
|
@ -348,7 +348,7 @@ static int target_move_down_exec(bContext *C, wmOperator *UNUSED(op))
|
|||
for (; pt; pt=pt->next) {
|
||||
if (pt->flag & PTARGET_CURRENT && pt->next) {
|
||||
BLI_remlink(&psys->targets, pt);
|
||||
BLI_insertlink(&psys->targets, pt->next, pt);
|
||||
BLI_insertlinkafter(&psys->targets, pt->next, pt);
|
||||
|
||||
DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
|
||||
WM_event_add_notifier(C, NC_OBJECT|ND_PARTICLE, ob);
|
||||
|
@ -387,7 +387,7 @@ static int dupliob_move_up_exec(bContext *C, wmOperator *UNUSED(op))
|
|||
for (dw=part->dupliweights.first; dw; dw=dw->next) {
|
||||
if (dw->flag & PART_DUPLIW_CURRENT && dw->prev) {
|
||||
BLI_remlink(&part->dupliweights, dw);
|
||||
BLI_insertlink(&part->dupliweights, dw->prev->prev, dw);
|
||||
BLI_insertlinkbefore(&part->dupliweights, dw->prev, dw);
|
||||
|
||||
WM_event_add_notifier(C, NC_OBJECT|ND_PARTICLE, NULL);
|
||||
break;
|
||||
|
@ -509,7 +509,7 @@ static int dupliob_move_down_exec(bContext *C, wmOperator *UNUSED(op))
|
|||
for (dw=part->dupliweights.first; dw; dw=dw->next) {
|
||||
if (dw->flag & PART_DUPLIW_CURRENT && dw->next) {
|
||||
BLI_remlink(&part->dupliweights, dw);
|
||||
BLI_insertlink(&part->dupliweights, dw->next, dw);
|
||||
BLI_insertlinkafter(&part->dupliweights, dw->next, dw);
|
||||
|
||||
WM_event_add_notifier(C, NC_OBJECT|ND_PARTICLE, NULL);
|
||||
break;
|
||||
|
|
|
@ -180,13 +180,13 @@ static int strip_modifier_move_exec(bContext *C, wmOperator *op)
|
|||
if (direction == SEQ_MODIFIER_MOVE_UP) {
|
||||
if (smd->prev) {
|
||||
BLI_remlink(&seq->modifiers, smd);
|
||||
BLI_insertlink(&seq->modifiers, smd->prev->prev, smd);
|
||||
BLI_insertlinkbefore(&seq->modifiers, smd->prev, smd);
|
||||
}
|
||||
}
|
||||
else if (direction == SEQ_MODIFIER_MOVE_DOWN) {
|
||||
if (smd->next) {
|
||||
BLI_remlink(&seq->modifiers, smd);
|
||||
BLI_insertlink(&seq->modifiers, smd->next, smd);
|
||||
BLI_insertlinkafter(&seq->modifiers, smd->next, smd);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -31,6 +31,9 @@
|
|||
* \ingroup DNA
|
||||
* \brief These structs are the foundation for all linked lists in the
|
||||
* library system.
|
||||
*
|
||||
* Doubly-linked lists start from a ListBase and contain elements beginning
|
||||
* with Link.
|
||||
*/
|
||||
|
||||
#ifndef __DNA_LISTBASE_H__
|
||||
|
@ -40,13 +43,13 @@
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* generic - all structs which are used in linked-lists used this */
|
||||
/* generic - all structs which are put into linked lists begin with this */
|
||||
typedef struct Link {
|
||||
struct Link *next, *prev;
|
||||
} Link;
|
||||
|
||||
|
||||
/* use this when it is not worth defining a custom one... */
|
||||
/* simple subclass of Link--use this when it is not worth defining a custom one... */
|
||||
typedef struct LinkData {
|
||||
struct LinkData *next, *prev;
|
||||
void *data;
|
||||
|
|
|
@ -159,7 +159,7 @@ static TimeMarker *rna_Action_pose_markers_new(bAction *act, const char name[])
|
|||
static void rna_Action_pose_markers_remove(bAction *act, ReportList *reports, PointerRNA *marker_ptr)
|
||||
{
|
||||
TimeMarker *marker = marker_ptr->data;
|
||||
if (BLI_remlink_safe(&act->markers, marker) == FALSE) {
|
||||
if (!BLI_remlink_safe(&act->markers, marker)) {
|
||||
BKE_reportf(reports, RPT_ERROR, "Timeline marker '%s' not found in action '%s'", marker->name, act->id.name + 2);
|
||||
return;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue