本文整理汇总了C++中BLI_insertlinkbefore函数的典型用法代码示例。如果您正苦于以下问题:C++ BLI_insertlinkbefore函数的具体用法?C++ BLI_insertlinkbefore怎么用?C++ BLI_insertlinkbefore使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了BLI_insertlinkbefore函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: mask_layer_move_exec
static int mask_layer_move_exec(bContext *C, wmOperator *op)
{
Mask *mask = CTX_data_edit_mask(C);
MaskLayer *mask_layer = BLI_findlink(&mask->masklayers, mask->masklay_act);
MaskLayer *mask_layer_other;
int direction = RNA_enum_get(op->ptr, "direction");
if (!mask_layer)
return OPERATOR_CANCELLED;
if (direction == -1) {
mask_layer_other = mask_layer->prev;
if (!mask_layer_other)
return OPERATOR_CANCELLED;
BLI_remlink(&mask->masklayers, mask_layer);
BLI_insertlinkbefore(&mask->masklayers, mask_layer_other, mask_layer);
mask->masklay_act--;
}
else if (direction == 1) {
mask_layer_other = mask_layer->next;
if (!mask_layer_other)
return OPERATOR_CANCELLED;
BLI_remlink(&mask->masklayers, mask_layer);
BLI_insertlinkafter(&mask->masklayers, mask_layer_other, mask_layer);
mask->masklay_act++;
}
return OPERATOR_FINISHED;
}
开发者ID:castlelore,项目名称:blender-git,代码行数:33,代码来源:mask_ops.c
示例2: strip_modifier_move_exec
static int strip_modifier_move_exec(bContext *C, wmOperator *op)
{
Scene *scene = CTX_data_scene(C);
Sequence *seq = BKE_sequencer_active_get(scene);
char name[MAX_NAME];
int direction;
SequenceModifierData *smd;
RNA_string_get(op->ptr, "name", name);
direction = RNA_enum_get(op->ptr, "direction");
smd = BKE_sequence_modifier_find_by_name(seq, name);
if (!smd)
return OPERATOR_CANCELLED;
if (direction == SEQ_MODIFIER_MOVE_UP) {
if (smd->prev) {
BLI_remlink(&seq->modifiers, smd);
BLI_insertlinkbefore(&seq->modifiers, smd->prev, smd);
}
}
else if (direction == SEQ_MODIFIER_MOVE_DOWN) {
if (smd->next) {
BLI_remlink(&seq->modifiers, smd);
BLI_insertlinkafter(&seq->modifiers, smd->next, smd);
}
}
BKE_sequence_invalidate_cache(scene, seq);
WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER, scene);
return OPERATOR_FINISHED;
}
开发者ID:DarkDefender,项目名称:blender-npr-tess2,代码行数:33,代码来源:sequencer_modifier.c
示例3: add_marker_to_cfra_elem
/* Adds a marker to list of cfra elems */
static void add_marker_to_cfra_elem(ListBase *lb, TimeMarker *marker, short only_sel)
{
CfraElem *ce, *cen;
/* should this one only be considered if it is selected? */
if ((only_sel) && ((marker->flag & SELECT) == 0))
return;
/* insertion sort - try to find a previous cfra elem */
for (ce = lb->first; ce; ce = ce->next) {
if (ce->cfra == marker->frame) {
/* do because of double keys */
if (marker->flag & SELECT)
ce->sel = marker->flag;
return;
}
else if (ce->cfra > marker->frame) {
break;
}
}
cen = MEM_callocN(sizeof(CfraElem), "add_to_cfra_elem");
if (ce) BLI_insertlinkbefore(lb, ce, cen);
else BLI_addtail(lb, cen);
cen->cfra = marker->frame;
cen->sel = marker->flag;
}
开发者ID:JasonWilkins,项目名称:blender-wayland,代码行数:29,代码来源:anim_markers.c
示例4: move_modifier
static void move_modifier(ListBase *lb, LineStyleModifier *modifier, int direction)
{
BLI_remlink(lb, modifier);
if (direction > 0)
BLI_insertlinkbefore(lb, modifier->prev, modifier);
else
BLI_insertlinkafter(lb, modifier->next, modifier);
}
开发者ID:Walid-Shouman,项目名称:Blender,代码行数:8,代码来源:linestyle.c
示例5: multiresModifier_join
void multiresModifier_join(Object *ob)
{
Base *base = NULL;
int highest_lvl = 0;
/* First find the highest level of subdivision */
base = FIRSTBASE;
while(base) {
if(TESTBASELIB_BGMODE(v3d, base) && base->object->type==OB_MESH) {
ModifierData *md;
for(md = base->object->modifiers.first; md; md = md->next) {
if(md->type == eModifierType_Multires) {
int totlvl = ((MultiresModifierData*)md)->totlvl;
if(totlvl > highest_lvl)
highest_lvl = totlvl;
/* Ensure that all updates are processed */
multires_force_update(base->object);
}
}
}
base = base->next;
}
/* No multires meshes selected */
if(highest_lvl == 0)
return;
/* Subdivide all the displacements to the highest level */
base = FIRSTBASE;
while(base) {
if(TESTBASELIB_BGMODE(v3d, base) && base->object->type==OB_MESH) {
ModifierData *md = NULL;
MultiresModifierData *mmd = NULL;
for(md = base->object->modifiers.first; md; md = md->next) {
if(md->type == eModifierType_Multires)
mmd = (MultiresModifierData*)md;
}
/* If the object didn't have multires enabled, give it a new modifier */
if(!mmd) {
md = base->object->modifiers.first;
while(md && modifierType_getInfo(md->type)->type == eModifierTypeType_OnlyDeform)
md = md->next;
mmd = (MultiresModifierData*)modifier_new(eModifierType_Multires);
BLI_insertlinkbefore(&base->object->modifiers, md, mmd);
modifier_unique_name(&base->object->modifiers, mmd);
}
if(mmd)
multiresModifier_subdivide(mmd, base->object, highest_lvl - mmd->totlvl, 0, 0);
}
base = base->next;
}
}
开发者ID:jinjoh,项目名称:NOOR,代码行数:58,代码来源:multires.c
示例6: gp_ui_layer_up_cb
/* move layer up */
static void gp_ui_layer_up_cb(bContext *C, void *gpd_v, void *gpl_v)
{
bGPdata *gpd = gpd_v;
bGPDlayer *gpl = gpl_v;
BLI_remlink(&gpd->layers, gpl);
BLI_insertlinkbefore(&gpd->layers, gpl->prev, gpl);
WM_event_add_notifier(C, NC_GPENCIL | ND_DATA | NA_EDITED, NULL);
}
开发者ID:244xiao,项目名称:blender,代码行数:11,代码来源:gpencil_buttons.c
示例7: ED_object_gpencil_modifier_move_up
int ED_object_gpencil_modifier_move_up(ReportList *UNUSED(reports),
Object *ob,
GpencilModifierData *md)
{
if (md->prev) {
BLI_remlink(&ob->greasepencil_modifiers, md);
BLI_insertlinkbefore(&ob->greasepencil_modifiers, md->prev, md);
}
return 1;
}
开发者ID:dfelinto,项目名称:blender,代码行数:11,代码来源:object_gpencil_modifier.c
示例8: addedgetoscanvert
static bool addedgetoscanvert(ScanFillVertLink *sc, ScanFillEdge *eed)
{
/* find first edge to the right of eed, and insert eed before that */
ScanFillEdge *ed;
float fac, fac1, x, y;
if (sc->edge_first == NULL) {
sc->edge_first = sc->edge_last = eed;
eed->prev = eed->next = NULL;
return 1;
}
x = eed->v1->xy[0];
y = eed->v1->xy[1];
fac1 = eed->v2->xy[1] - y;
if (fac1 == 0.0f) {
fac1 = 1.0e10f * (eed->v2->xy[0] - x);
}
else {
fac1 = (x - eed->v2->xy[0]) / fac1;
}
for (ed = sc->edge_first; ed; ed = ed->next) {
if (ed->v2 == eed->v2) {
return false;
}
fac = ed->v2->xy[1] - y;
if (fac == 0.0f) {
fac = 1.0e10f * (ed->v2->xy[0] - x);
}
else {
fac = (x - ed->v2->xy[0]) / fac;
}
if (fac > fac1) {
break;
}
}
if (ed) {
BLI_insertlinkbefore((ListBase *)&(sc->edge_first), ed, eed);
}
else {
BLI_addtail((ListBase *)&(sc->edge_first), eed);
}
return true;
}
开发者ID:dfelinto,项目名称:blender,代码行数:50,代码来源:scanfill.c
示例9: MEM_callocN
/* add a new gp-frame to the given layer */
bGPDframe *gpencil_frame_addnew(bGPDlayer *gpl, int cframe)
{
bGPDframe *gpf = NULL, *gf = NULL;
short state = 0;
/* error checking (neg frame only if they are not allowed in Blender!) */
if (gpl == NULL)
return NULL;
/* allocate memory for this frame */
gpf = MEM_callocN(sizeof(bGPDframe), "bGPDframe");
gpf->framenum = cframe;
/* find appropriate place to add frame */
if (gpl->frames.first) {
for (gf = gpl->frames.first; gf; gf = gf->next) {
/* check if frame matches one that is supposed to be added */
if (gf->framenum == cframe) {
state = -1;
break;
}
/* if current frame has already exceeded the frame to add, add before */
if (gf->framenum > cframe) {
BLI_insertlinkbefore(&gpl->frames, gf, gpf);
state = 1;
break;
}
}
}
/* check whether frame was added successfully */
if (state == -1) {
printf("Error: Frame (%d) existed already for this layer. Using existing frame\n", cframe);
/* free the newly created one, and use the old one instead */
MEM_freeN(gpf);
/* return existing frame instead... */
BLI_assert(gf != NULL);
gpf = gf;
}
else if (state == 0) {
/* add to end then! */
BLI_addtail(&gpl->frames, gpf);
}
/* return frame */
return gpf;
}
开发者ID:mcgrathd,项目名称:blender,代码行数:51,代码来源:gpencil.c
示例10: shape_key_move_exec
static int shape_key_move_exec(bContext *C, wmOperator *op)
{
Object *ob= CTX_data_pointer_get_type(C, "object", &RNA_Object).data;
int type= RNA_enum_get(op->ptr, "type");
Key *key= ob_get_key(ob);
if(key) {
KeyBlock *kb, *kb_other;
int shapenr_act= ob->shapenr-1;
int shapenr_swap= shapenr_act + type;
kb= BLI_findlink(&key->block, shapenr_act);
if((type==-1 && kb->prev==NULL) || (type==1 && kb->next==NULL)) {
return OPERATOR_CANCELLED;
}
for(kb_other= key->block.first; kb_other; kb_other= kb_other->next) {
if(kb_other->relative == shapenr_act) {
kb_other->relative += type;
}
else if(kb_other->relative == shapenr_swap) {
kb_other->relative -= type;
}
}
if(type==-1) {
/* move back */
kb_other= kb->prev;
BLI_remlink(&key->block, kb);
BLI_insertlinkbefore(&key->block, kb_other, kb);
ob->shapenr--;
}
else {
/* move next */
kb_other= kb->next;
BLI_remlink(&key->block, kb);
BLI_insertlinkafter(&key->block, kb_other, kb);
ob->shapenr++;
}
}
DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, ob);
return OPERATOR_FINISHED;
}
开发者ID:OldBrunet,项目名称:BGERTPS,代码行数:47,代码来源:object_shapekey.c
示例11: voronoi_insertEvent
static void voronoi_insertEvent(VoronoiProcess *process, VoronoiEvent *event)
{
VoronoiEvent *current_event = process->queue.first;
while (current_event) {
if (current_event->site[1] < event->site[1]) {
break;
}
if (current_event->site[1] == event->site[1]) {
event->site[1] -= VORONOI_EPS;
}
current_event = current_event->next;
}
BLI_insertlinkbefore(&process->queue, current_event, event);
}
开发者ID:dfelinto,项目名称:blender,代码行数:17,代码来源:voronoi_2d.c
示例12: MEM_callocN
/* add a new gp-frame to the given layer */
bGPDframe *gpencil_frame_addnew(bGPDlayer *gpl, int cframe)
{
bGPDframe *gpf, *gf;
short state = 0;
/* error checking */
if ((gpl == NULL) || (cframe <= 0))
return NULL;
/* allocate memory for this frame */
gpf = MEM_callocN(sizeof(bGPDframe), "bGPDframe");
gpf->framenum = cframe;
/* find appropriate place to add frame */
if (gpl->frames.first) {
for (gf = gpl->frames.first; gf; gf = gf->next) {
/* check if frame matches one that is supposed to be added */
if (gf->framenum == cframe) {
state = -1;
break;
}
/* if current frame has already exceeded the frame to add, add before */
if (gf->framenum > cframe) {
BLI_insertlinkbefore(&gpl->frames, gf, gpf);
state = 1;
break;
}
}
}
/* check whether frame was added successfully */
if (state == -1) {
MEM_freeN(gpf);
printf("Error: frame (%d) existed already for this layer\n", cframe);
}
else if (state == 0) {
/* add to end then! */
BLI_addtail(&gpl->frames, gpf);
}
/* return frame */
return gpf;
}
开发者ID:244xiao,项目名称:blender,代码行数:45,代码来源:gpencil.c
示例13: sca_move_controller
void sca_move_controller(bController *cont_to_move, Object *ob, int move_up)
{
bController *cont, *tmp;
int val;
val = move_up ? 1 : 2;
/* make sure this controller belongs to this object */
cont= ob->controllers.first;
while (cont) {
if (cont == cont_to_move) break;
cont= cont->next;
}
if (!cont) return;
/* move up */
if (val == 1 && cont->prev) {
/* locate the controller that has the same state mask but is earlier in the list */
tmp = cont->prev;
while (tmp) {
if (tmp->state_mask & cont->state_mask)
break;
tmp = tmp->prev;
}
if (tmp) {
BLI_remlink(&ob->controllers, cont);
BLI_insertlinkbefore(&ob->controllers, tmp, cont);
}
}
/* move down */
else if (val == 2 && cont->next) {
tmp = cont->next;
while (tmp) {
if (tmp->state_mask & cont->state_mask)
break;
tmp = tmp->next;
}
BLI_remlink(&ob->controllers, cont);
BLI_insertlinkafter(&ob->controllers, tmp, cont);
}
}
开发者ID:mgschwan,项目名称:blensor,代码行数:42,代码来源:sca.c
示例14: wm_keymap_patch
static void wm_keymap_patch(wmKeyMap *km, wmKeyMap *diff_km)
{
wmKeyMapDiffItem *kmdi;
wmKeyMapItem *kmi_remove, *kmi_add;
for(kmdi=diff_km->diff_items.first; kmdi; kmdi=kmdi->next) {
/* find item to remove */
kmi_remove = NULL;
if(kmdi->remove_item) {
kmi_remove = wm_keymap_find_item_equals(km, kmdi->remove_item);
if(!kmi_remove)
kmi_remove = wm_keymap_find_item_equals_result(km, kmdi->remove_item);
}
/* add item */
if(kmdi->add_item) {
/* only if nothing to remove or item to remove found */
if(!kmdi->remove_item || kmi_remove) {
kmi_add = wm_keymap_item_copy(kmdi->add_item);
kmi_add->flag |= KMI_USER_MODIFIED;
if(kmi_remove) {
kmi_add->flag &= ~KMI_EXPANDED;
kmi_add->flag |= (kmi_remove->flag & KMI_EXPANDED);
kmi_add->id = kmi_remove->id;
BLI_insertlinkbefore(&km->items, kmi_remove, kmi_add);
}
else {
keymap_item_set_id(km, kmi_add);
BLI_addtail(&km->items, kmi_add);
}
}
}
/* remove item */
if(kmi_remove) {
wm_keymap_item_free(kmi_remove);
BLI_freelinkN(&km->items, kmi_remove);
}
}
}
开发者ID:OldBrunet,项目名称:BGERTPS,代码行数:41,代码来源:wm_keymap.c
示例15: constraint_move_up_exec
static int constraint_move_up_exec (bContext *C, wmOperator *op)
{
PointerRNA ptr= CTX_data_pointer_get_type(C, "constraint", &RNA_Constraint);
Object *ob= ptr.id.data;
bConstraint *con= ptr.data;
if (con->prev) {
ListBase *conlist= get_active_constraints(ob);
bConstraint *prevCon= con->prev;
/* insert the nominated constraint before the one that used to be before it */
BLI_remlink(conlist, con);
BLI_insertlinkbefore(conlist, prevCon, con);
WM_event_add_notifier(C, NC_OBJECT|ND_CONSTRAINT, ob);
return OPERATOR_FINISHED;
}
return OPERATOR_CANCELLED;
}
开发者ID:jinjoh,项目名称:NOOR,代码行数:21,代码来源:object_constraint.c
示例16: sca_move_actuator
void sca_move_actuator(bActuator *act_to_move, Object *ob, int move_up)
{
bActuator *act, *tmp;
int val;
val = move_up ? 1 : 2;
/* make sure this actuator belongs to this object */
act= ob->actuators.first;
while (act) {
if (act == act_to_move) break;
act= act->next;
}
if (!act) return;
/* move up */
if (val == 1 && act->prev) {
/* locate the first visible actuators before this one */
for (tmp = act->prev; tmp; tmp=tmp->prev) {
if (tmp->flag & ACT_VISIBLE)
break;
}
if (tmp) {
BLI_remlink(&ob->actuators, act);
BLI_insertlinkbefore(&ob->actuators, tmp, act);
}
}
/* move down */
else if (val == 2 && act->next) {
/* locate the first visible actuators after this one */
for (tmp=act->next; tmp; tmp=tmp->next) {
if (tmp->flag & ACT_VISIBLE)
break;
}
if (tmp) {
BLI_remlink(&ob->actuators, act);
BLI_insertlinkafter(&ob->actuators, tmp, act);
}
}
}
开发者ID:mgschwan,项目名称:blensor,代码行数:40,代码来源:sca.c
示例17: state_move_up_exec
/************************ move up/down boid state operators *********************/
static int state_move_up_exec(bContext *C, wmOperator *UNUSED(op))
{
PointerRNA ptr = CTX_data_pointer_get_type(C, "particle_settings", &RNA_ParticleSettings);
ParticleSettings *part = ptr.data;
BoidSettings *boids;
BoidState *state;
if (!part || part->phystype != PART_PHYS_BOIDS)
return OPERATOR_CANCELLED;
boids = part->boids;
for (state = boids->states.first; state; state=state->next) {
if (state->flag & BOIDSTATE_CURRENT && state->prev) {
BLI_remlink(&boids->states, state);
BLI_insertlinkbefore(&boids->states, state->prev, state);
break;
}
}
return OPERATOR_FINISHED;
}
开发者ID:Andrewson3D,项目名称:blender-for-vray,代码行数:23,代码来源:particle_boids.c
示例18: sca_move_sensor
/* ******************** INTERFACE ******************* */
void sca_move_sensor(bSensor *sens_to_move, Object *ob, int move_up)
{
bSensor *sens, *tmp;
int val;
val = move_up ? 1 : 2;
/* make sure this sensor belongs to this object */
sens= ob->sensors.first;
while (sens) {
if (sens == sens_to_move) break;
sens= sens->next;
}
if (!sens) return;
/* move up */
if (val == 1 && sens->prev) {
for (tmp=sens->prev; tmp; tmp=tmp->prev) {
if (tmp->flag & SENS_VISIBLE)
break;
}
if (tmp) {
BLI_remlink(&ob->sensors, sens);
BLI_insertlinkbefore(&ob->sensors, tmp, sens);
}
}
/* move down */
else if (val == 2 && sens->next) {
for (tmp=sens->next; tmp; tmp=tmp->next) {
if (tmp->flag & SENS_VISIBLE)
break;
}
if (tmp) {
BLI_remlink(&ob->sensors, sens);
BLI_insertlinkafter(&ob->sensors, tmp, sens);
}
}
}
开发者ID:mgschwan,项目名称:blensor,代码行数:39,代码来源:sca.c
示例19: dupliob_move_up_exec
static int dupliob_move_up_exec(bContext *C, wmOperator *UNUSED(op))
{
PointerRNA ptr = CTX_data_pointer_get_type(C, "particle_system", &RNA_ParticleSystem);
ParticleSystem *psys= ptr.data;
ParticleSettings *part;
ParticleDupliWeight *dw;
if (!psys)
return OPERATOR_CANCELLED;
part = psys->part;
for (dw=part->dupliweights.first; dw; dw=dw->next) {
if (dw->flag & PART_DUPLIW_CURRENT && dw->prev) {
BLI_remlink(&part->dupliweights, dw);
BLI_insertlinkbefore(&part->dupliweights, dw->prev, dw);
WM_event_add_notifier(C, NC_OBJECT|ND_PARTICLE, NULL);
break;
}
}
return OPERATOR_FINISHED;
}
开发者ID:flair2005,项目名称:mechanical-blender,代码行数:23,代码来源:particle_object.c
示例20: rule_move_up_exec
/************************ move up/down boid rule operators *********************/
static int rule_move_up_exec(bContext *C, wmOperator *UNUSED(op))
{
PointerRNA ptr = CTX_data_pointer_get_type(C, "particle_settings", &RNA_ParticleSettings);
ParticleSettings *part = ptr.data;
BoidRule *rule;
BoidState *state;
if (!part || part->phystype != PART_PHYS_BOIDS)
return OPERATOR_CANCELLED;
state = boid_get_current_state(part->boids);
for (rule = state->rules.first; rule; rule=rule->next) {
if (rule->flag & BOIDRULE_CURRENT && rule->prev) {
BLI_remlink(&state->rules, rule);
BLI_insertlinkbefore(&state->rules, rule->prev, rule);
DAG_id_tag_update(&part->id, OB_RECALC_DATA|PSYS_RECALC_RESET);
break;
}
}
return OPERATOR_FINISHED;
}
开发者ID:Andrewson3D,项目名称:blender-for-vray,代码行数:24,代码来源:particle_boids.c
注:本文中的BLI_insertlinkbefore函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论