这篇教程C++ BLI_insertlinkbefore函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中BLI_insertlinkbefore函数的典型用法代码示例。如果您正苦于以下问题:C++ BLI_insertlinkbefore函数的具体用法?C++ BLI_insertlinkbefore怎么用?C++ BLI_insertlinkbefore使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了BLI_insertlinkbefore函数的25个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: mask_layer_move_execstatic 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,
示例2: strip_modifier_move_execstatic 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,
示例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,
示例4: move_modifierstatic 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,
示例5: multiresModifier_joinvoid 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,
示例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,
示例7: ED_object_gpencil_modifier_move_upint 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,
示例8: addedgetoscanvertstatic 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,
示例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,
示例10: shape_key_move_execstatic 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,
示例11: voronoi_insertEventstatic 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,
示例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,
示例13: sca_move_controllervoid 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,
示例14: wm_keymap_patchstatic 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,
示例15: constraint_move_up_execstatic 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,
示例16: sca_move_actuatorvoid 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,
示例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,
示例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,
示例19: dupliob_move_up_execstatic 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,
示例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,
示例21: target_move_up_execstatic int target_move_up_exec(bContext *C, wmOperator *UNUSED(op)){ PointerRNA ptr = CTX_data_pointer_get_type(C, "particle_system", &RNA_ParticleSystem); ParticleSystem *psys= ptr.data; Object *ob = ptr.id.data; ParticleTarget *pt; if (!psys) return OPERATOR_CANCELLED; pt = psys->targets.first; for (; pt; pt=pt->next) { if (pt->flag & PTARGET_CURRENT && pt->prev) { BLI_remlink(&psys->targets, 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); break; } } return OPERATOR_FINISHED;}
开发者ID:flair2005,项目名称:mechanical-blender,代码行数:24,
示例22: modifierType_getInfoModifierData *ED_object_modifier_add(ReportList *reports, Main *bmain, Scene *scene, Object *ob, const char *name, int type){ ModifierData *md=NULL, *new_md=NULL; ModifierTypeInfo *mti = modifierType_getInfo(type); /* only geometry objects should be able to get modifiers [#25291] */ if(!ELEM5(ob->type, OB_MESH, OB_CURVE, OB_SURF, OB_FONT, OB_LATTICE)) { BKE_reportf(reports, RPT_WARNING, "Modifiers cannot be added to Object '%s'", ob->id.name+2); return NULL; } if(mti->flags&eModifierTypeFlag_Single) { if(modifiers_findByType(ob, type)) { BKE_report(reports, RPT_WARNING, "Only one modifier of this type allowed"); return NULL; } } if(type == eModifierType_ParticleSystem) { /* don't need to worry about the new modifier's name, since that is set to the number * of particle systems which shouldn't have too many duplicates */ new_md = object_add_particle_system(scene, ob, name); } else { /* get new modifier data to add */ new_md= modifier_new(type); if(mti->flags&eModifierTypeFlag_RequiresOriginalData) { md = ob->modifiers.first; while(md && modifierType_getInfo(md->type)->type==eModifierTypeType_OnlyDeform) md = md->next; BLI_insertlinkbefore(&ob->modifiers, md, new_md); } else BLI_addtail(&ob->modifiers, new_md); if(name) BLI_strncpy(new_md->name, name, sizeof(new_md->name)); /* make sure modifier data has unique name */ modifier_unique_name(&ob->modifiers, new_md); /* special cases */ if(type == eModifierType_Softbody) { if(!ob->soft) { ob->soft= sbNew(scene); ob->softflag |= OB_SB_GOAL|OB_SB_EDGES; } } else if(type == eModifierType_Collision) { if(!ob->pd) ob->pd= object_add_collision_fields(0); ob->pd->deflect= 1; DAG_scene_sort(bmain, scene); } else if(type == eModifierType_Surface) DAG_scene_sort(bmain, scene); else if(type == eModifierType_Multires) /* set totlvl from existing MDISPS layer if object already had it */ multiresModifier_set_levels_from_disps((MultiresModifierData *)new_md, ob); } DAG_id_tag_update(&ob->id, OB_RECALC_DATA); return new_md;}
开发者ID:ryden,项目名称:blender-mirror,代码行数:71,
示例23: loop_syncstatic void loop_sync(bNodeTree *ntree, int sync_in_out){ bNodeSocket *sock, *sync, *nsync, *mirror; ListBase *sync_lb; if (sync_in_out==SOCK_IN) { sock = ntree->outputs.first; sync = ntree->inputs.first; sync_lb = &ntree->inputs; } else { sock = ntree->inputs.first; sync = ntree->outputs.first; sync_lb = &ntree->outputs; } /* NB: the sock->storage pointer is used here directly to store the own_index int * out the mirrored socket counterpart! */ while (sock) { /* skip static and internal sockets on the sync side (preserves socket order!) */ while (sync && ((sync->flag & SOCK_INTERNAL) || !(sync->flag & SOCK_DYNAMIC))) sync = sync->next; if (sync && !(sync->flag & SOCK_INTERNAL) && (sync->flag & SOCK_DYNAMIC)) { if (sock->storage==NULL) { /* if mirror index is 0, the sockets is newly added and a new mirror must be created. */ mirror = node_group_expose_socket(ntree, sock, sync_in_out); /* store the mirror index */ sock->storage = SET_INT_IN_POINTER(mirror->own_index); mirror->storage = SET_INT_IN_POINTER(sock->own_index); /* move mirror to the right place */ BLI_remlink(sync_lb, mirror); if (sync) BLI_insertlinkbefore(sync_lb, sync, mirror); else BLI_addtail(sync_lb, mirror); } else { /* look up the mirror socket */ for (mirror=sync; mirror; mirror=mirror->next) if (mirror->own_index == GET_INT_FROM_POINTER(sock->storage)) break; /* make sure the name is the same (only for identification by user, no deeper meaning) */ BLI_strncpy(mirror->name, sock->name, sizeof(mirror->name)); /* fix the socket order if necessary */ if (mirror != sync) { BLI_remlink(sync_lb, mirror); BLI_insertlinkbefore(sync_lb, sync, mirror); } else sync = sync->next; } } sock = sock->next; } /* remaining sockets in sync_lb are leftovers from deleted sockets, remove them */ while (sync) { nsync = sync->next; if (!(sync->flag & SOCK_INTERNAL) && (sync->flag & SOCK_DYNAMIC)) node_group_remove_socket(ntree, sync, sync_in_out); sync = nsync; }}
开发者ID:vanangamudi,项目名称:blender-main,代码行数:69,
示例24: action_groups_add_channel/* Add given channel into (active) group * - assumes that channel is not linked to anything anymore * - always adds at the end of the group */void action_groups_add_channel(bAction *act, bActionGroup *agrp, FCurve *fcurve){ /* sanity checks */ if (ELEM(NULL, act, agrp, fcurve)) return; /* if no channels anywhere, just add to two lists at the same time */ if (BLI_listbase_is_empty(&act->curves)) { fcurve->next = fcurve->prev = NULL; agrp->channels.first = agrp->channels.last = fcurve; act->curves.first = act->curves.last = fcurve; } /* if the group already has channels, the F-Curve can simply be added to the list * (i.e. as the last channel in the group) */ else if (agrp->channels.first) { /* if the group's last F-Curve is the action's last F-Curve too, * then set the F-Curve as the last for the action first so that * the lists will be in sync after linking */ if (agrp->channels.last == act->curves.last) act->curves.last = fcurve; /* link in the given F-Curve after the last F-Curve in the group, * which means that it should be able to fit in with the rest of the * list seamlessly */ BLI_insertlinkafter(&agrp->channels, agrp->channels.last, fcurve); } /* otherwise, need to find the nearest F-Curve in group before/after current to link with */ else { bActionGroup *grp; /* firstly, link this F-Curve to the group */ agrp->channels.first = agrp->channels.last = fcurve; /* step through the groups preceding this one, finding the F-Curve there to attach this one after */ for (grp = agrp->prev; grp; grp = grp->prev) { /* if this group has F-Curves, we want weave the given one in right after the last channel there, * but via the Action's list not this group's list * - this is so that the F-Curve is in the right place in the Action, * but won't be included in the previous group */ if (grp->channels.last) { /* once we've added, break here since we don't need to search any further... */ BLI_insertlinkafter(&act->curves, grp->channels.last, fcurve); break; } } /* if grp is NULL, that means we fell through, and this F-Curve should be added as the new first * since group is (effectively) the first group. Thus, the existing first F-Curve becomes the * second in the chain, etc. etc. */ if (grp == NULL) BLI_insertlinkbefore(&act->curves, act->curves.first, fcurve); } /* set the F-Curve's new group */ fcurve->grp = agrp;}
开发者ID:UPBGE,项目名称:blender,代码行数:68,
示例25: scanfill//.........这里部分代码省略......... if (best_sc == NULL) { /* even without holes we need to keep checking [#35861] */ best_sc = sc1; } else { float angle; /* prevent angle calc for the simple cases only 1 vertex is found */ if (firsttime == false) { best_angle = angle_v2v2v2(v2->xy, v1->xy, best_sc->vert->xy); firsttime = true; } angle = angle_v2v2v2(v2->xy, v1->xy, sc1->vert->xy); if (angle < best_angle) { best_sc = sc1; best_angle = angle; } } } } } } } if (best_sc) { /* make new edge, and start over */ /* printf("add new edge %d %d and start again/n", v2->tmp.u, best_sc->vert->tmp.u); */ ed3 = BLI_scanfill_edge_add(sf_ctx, v2, best_sc->vert); BLI_remlink(&sf_ctx->filledgebase, ed3); BLI_insertlinkbefore((ListBase *)&(sc->edge_first), ed2, ed3); ed3->v2->f = SF_VERT_AVAILABLE; ed3->f = SF_EDGE_INTERNAL; ed3->v1->edge_tot++; ed3->v2->edge_tot++; } else { /* new triangle */ /* printf("add face %d %d %d/n", v1->tmp.u, v2->tmp.u, v3->tmp.u); */ addfillface(sf_ctx, v1, v2, v3); totface++; BLI_remlink((ListBase *)&(sc->edge_first), ed1); BLI_addtail(&sf_ctx->filledgebase, ed1); ed1->v2->f = SF_VERT_NEW; ed1->v1->edge_tot--; ed1->v2->edge_tot--; /* ed2 can be removed when it's a boundary edge */ if (((ed2->f == SF_EDGE_NEW) && twoconnected) /* || (ed2->f == SF_EDGE_BOUNDARY) */) { BLI_remlink((ListBase *)&(sc->edge_first), ed2); BLI_addtail(&sf_ctx->filledgebase, ed2); ed2->v2->f = SF_VERT_NEW; ed2->v1->edge_tot--; ed2->v2->edge_tot--; } /* new edge */ ed3 = BLI_scanfill_edge_add(sf_ctx, v1, v3); BLI_remlink(&sf_ctx->filledgebase, ed3); ed3->f = SF_EDGE_INTERNAL; ed3->v1->edge_tot++; ed3->v2->edge_tot++; /* printf("add new edge %x %x/n", v1, v3); */
开发者ID:sftd,项目名称:blender,代码行数:67,
注:本文中的BLI_insertlinkbefore函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ BLI_join_dirfile函数代码示例 C++ BLI_ghash_lookup函数代码示例 |