本文整理汇总了C++中BLI_findlink函数的典型用法代码示例。如果您正苦于以下问题:C++ BLI_findlink函数的具体用法?C++ BLI_findlink怎么用?C++ BLI_findlink使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了BLI_findlink函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: RE_GetRender
void RenderLayersBaseProg::initExecution()
{
Scene *scene = this->getScene();
Render *re = (scene) ? RE_GetRender(scene->id.name) : NULL;
RenderResult *rr = NULL;
if (re)
rr = RE_AcquireResultRead(re);
if (rr) {
SceneRenderLayer *srl = (SceneRenderLayer *)BLI_findlink(&scene->r.layers, getLayerId());
if (srl) {
RenderLayer *rl = RE_GetRenderLayer(rr, srl->name);
if (rl && rl->rectf) {
this->m_inputBuffer = RE_RenderLayerGetPass(rl, this->m_renderpass);
if (this->m_inputBuffer == NULL && this->m_renderpass == SCE_PASS_COMBINED) {
this->m_inputBuffer = rl->rectf;
}
}
}
}
if (re) {
RE_ReleaseResult(re);
re = NULL;
}
}
示例2: add_empty_ks_path_exec
static int add_empty_ks_path_exec (bContext *C, wmOperator *op)
{
Scene *scene= CTX_data_scene(C);
KeyingSet *ks;
KS_Path *ksp;
/* verify the Keying Set to use:
* - use the active one
* - return error if it doesn't exist
*/
if (scene->active_keyingset == 0) {
BKE_report(op->reports, RPT_ERROR, "No active Keying Set to add empty path to");
return OPERATOR_CANCELLED;
}
else
ks= BLI_findlink(&scene->keyingsets, scene->active_keyingset-1);
/* don't use the API method for this, since that checks on values... */
ksp= MEM_callocN(sizeof(KS_Path), "KeyingSetPath Empty");
BLI_addtail(&ks->paths, ksp);
ks->active_path= BLI_countlist(&ks->paths);
ksp->groupmode= KSP_GROUP_KSNAME; // XXX?
return OPERATOR_FINISHED;
}
示例3: BLI_findlink
/* Get the active Keying Set for the Scene provided */
KeyingSet *ANIM_scene_get_active_keyingset (Scene *scene)
{
/* if no scene, we've got no hope of finding the Keying Set */
if (scene == NULL)
return NULL;
/* currently, there are several possibilities here:
* - 0: no active keying set
* - > 0: one of the user-defined Keying Sets, but indices start from 0 (hence the -1)
* - < 0: a builtin keying set
*/
if (scene->active_keyingset > 0)
return BLI_findlink(&scene->keyingsets, scene->active_keyingset-1);
else
return BLI_findlink(&builtin_keyingsets, (-scene->active_keyingset)-1);
}
示例4: BLI_countlist
/* note, must be freed */
int *defgroup_flip_map_single(Object *ob, int *flip_map_len, const bool use_default, int defgroup)
{
int defbase_tot = *flip_map_len = BLI_countlist(&ob->defbase);
if (defbase_tot == 0) {
return NULL;
}
else {
bDeformGroup *dg;
char name_flip[sizeof(dg->name)];
int i, flip_num, *map = MEM_mallocN(defbase_tot * sizeof(int), __func__);
for (i = 0; i < defbase_tot; i++) {
map[i] = use_default ? i : -1;
}
dg = BLI_findlink(&ob->defbase, defgroup);
BKE_deform_flip_side_name(name_flip, dg->name, false);
if (!STREQ(name_flip, dg->name)) {
flip_num = defgroup_name_index(ob, name_flip);
if (flip_num != -1) {
map[defgroup] = flip_num;
map[flip_num] = defgroup;
}
}
return map;
}
}
示例5: isDisabled
static bool isDisabled(ModifierData *md, int useRenderParams)
{
ParticleInstanceModifierData *pimd = (ParticleInstanceModifierData *)md;
ParticleSystem *psys;
ModifierData *ob_md;
if (!pimd->ob)
return true;
psys = BLI_findlink(&pimd->ob->particlesystem, pimd->psys - 1);
if (psys == NULL)
return true;
/* If the psys modifier is disabled we cannot use its data.
* First look up the psys modifier from the object, then check if it is enabled.
*/
for (ob_md = pimd->ob->modifiers.first; ob_md; ob_md = ob_md->next) {
if (ob_md->type == eModifierType_ParticleSystem) {
ParticleSystemModifierData *psmd = (ParticleSystemModifierData *)ob_md;
if (psmd->psys == psys) {
int required_mode;
if (useRenderParams) required_mode = eModifierMode_Render;
else required_mode = eModifierMode_Realtime;
if (!modifier_isEnabled(md->scene, ob_md, required_mode))
return true;
break;
}
}
}
return false;
}
示例6: 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;
}
示例7: wm_method_draw_stereo3d_anaglyph
static void wm_method_draw_stereo3d_anaglyph(wmWindow *win)
{
wmDrawData *drawdata;
int view, bit;
for (view = 0; view < 2; view ++) {
drawdata = BLI_findlink(&win->drawdata, (view * 2) + 1);
bit = view + 1;
switch (win->stereo3d_format->anaglyph_type) {
case S3D_ANAGLYPH_REDCYAN:
glColorMask((1&bit) ? GL_TRUE : GL_FALSE,
(2&bit) ? GL_TRUE : GL_FALSE,
(2&bit) ? GL_TRUE : GL_FALSE,
GL_FALSE);
break;
case S3D_ANAGLYPH_GREENMAGENTA:
glColorMask((2&bit) ? GL_TRUE : GL_FALSE,
(1&bit) ? GL_TRUE : GL_FALSE,
(2&bit) ? GL_TRUE : GL_FALSE,
GL_FALSE);
break;
case S3D_ANAGLYPH_YELLOWBLUE:
glColorMask((1&bit) ? GL_TRUE : GL_FALSE,
(1&bit) ? GL_TRUE : GL_FALSE,
(2&bit) ? GL_TRUE : GL_FALSE,
GL_FALSE);
break;
}
wm_triple_draw_textures(win, drawdata->triple, 1.0f);
glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
}
}
示例8: BLI_countlist
/* note, must be freed */
int *defgroup_flip_map_single(Object *ob, int *flip_map_len, int use_default, int defgroup)
{
int defbase_tot= *flip_map_len= BLI_countlist(&ob->defbase);
if (defbase_tot==0) {
return NULL;
}
else {
bDeformGroup *dg;
char name[sizeof(dg->name)];
int i, flip_num, *map= MEM_mallocN(defbase_tot * sizeof(int), __func__);
for (i=0; i < defbase_tot; i++) {
if (use_default) map[i]= i;
else map[i]= -1;
}
dg= BLI_findlink(&ob->defbase, defgroup);
flip_side_name(name, dg->name, FALSE);
if (strcmp(name, dg->name)) {
flip_num= defgroup_name_index(ob, name);
if (flip_num >= 0) {
map[defgroup]= flip_num;
map[flip_num]= defgroup;
}
}
return map;
}
}
示例9: do_node_add_group
static void do_node_add_group(bContext *C, void *UNUSED(arg), int event)
{
SpaceNode *snode = CTX_wm_space_node(C);
Main *bmain = CTX_data_main(C);
Scene *scene = CTX_data_scene(C);
bNodeTemplate ntemp;
if (event >= 0) {
ntemp.ngroup = BLI_findlink(&G.main->nodetree, event);
ntemp.type = ntemp.ngroup->nodetype;
}
else {
ntemp.type = -event;
switch (ntemp.type) {
case NODE_GROUP:
ntemp.ngroup = ntreeAddTree("Group", snode->treetype, ntemp.type);
break;
default:
ntemp.ngroup = NULL;
}
}
if (!ntemp.ngroup)
return;
ntemp.main = bmain;
ntemp.scene = scene;
do_node_add(C, &ntemp);
}
示例10: ED_text_region_location_from_cursor
/**
* Takes a cursor (row, character) and returns x,y pixel coords.
*/
bool ED_text_region_location_from_cursor(SpaceText *st, ARegion *ar, const int cursor_co[2], int r_pixel_co[2])
{
TextLine *line = NULL;
if (!st->text) {
goto error;
}
line = BLI_findlink(&st->text->lines, cursor_co[0]);
if (!line || (cursor_co[1] < 0) || (cursor_co[1] > line->len)) {
goto error;
}
else {
int offl, offc;
int linenr_offset = st->showlinenrs ? TXT_OFFSET + TEXTXLOC : TXT_OFFSET;
/* handle tabs as well! */
int char_pos = text_get_char_pos(st, line->line, cursor_co[1]);
wrap_offset(st, ar, line, cursor_co[1], &offl, &offc);
r_pixel_co[0] = (char_pos + offc - st->left) * st->cwidth + linenr_offset;
r_pixel_co[1] = (cursor_co[0] + offl - st->top) * (st->lheight_dpi + TXT_LINE_SPACING);
r_pixel_co[1] = (ar->winy - (r_pixel_co[1] + TXT_OFFSET)) - st->lheight_dpi;
}
return true;
error:
r_pixel_co[0] = r_pixel_co[1] = -1;
return false;
}
示例11: BLI_findlink
/* returns the active pose for a poselib */
static TimeMarker *poselib_get_active_pose(bAction *act)
{
if ((act) && (act->active_marker))
return BLI_findlink(&act->markers, act->active_marker - 1);
else
return NULL;
}
示例12: do_node_add_group
static void do_node_add_group(bContext *C, void *UNUSED(arg), int event)
{
SpaceNode *snode= CTX_wm_space_node(C);
bNodeTemplate ntemp;
if (event>=0) {
ntemp.ngroup= BLI_findlink(&G.main->nodetree, event);
ntemp.type = ntemp.ngroup->nodetype;
}
else {
ntemp.type = -event;
switch (ntemp.type) {
case NODE_GROUP:
ntemp.ngroup = ntreeAddTree("Group", snode->treetype, ntemp.type);
break;
case NODE_FORLOOP:
ntemp.ngroup = ntreeAddTree("For Loop", snode->treetype, ntemp.type);
break;
case NODE_WHILELOOP:
ntemp.ngroup = ntreeAddTree("While Loop", snode->treetype, ntemp.type);
break;
default:
ntemp.ngroup = NULL;
}
}
if (!ntemp.ngroup)
return;
do_node_add(C, &ntemp);
}
示例13: poselib_remove_exec
static int poselib_remove_exec(bContext *C, wmOperator *op)
{
Object *ob = get_poselib_object(C);
bAction *act = (ob) ? ob->poselib : NULL;
TimeMarker *marker;
int marker_index;
FCurve *fcu;
PropertyRNA *prop;
/* check if valid poselib */
if (act == NULL) {
BKE_report(op->reports, RPT_ERROR, "Object does not have pose lib data");
return OPERATOR_CANCELLED;
}
prop = RNA_struct_find_property(op->ptr, "pose");
if (RNA_property_is_set(op->ptr, prop)) {
marker_index = RNA_property_enum_get(op->ptr, prop);
}
else {
marker_index = act->active_marker - 1;
}
/* get index (and pointer) of pose to remove */
marker = BLI_findlink(&act->markers, marker_index);
if (marker == NULL) {
BKE_reportf(op->reports, RPT_ERROR, "Invalid pose specified %d", marker_index);
return OPERATOR_CANCELLED;
}
/* remove relevant keyframes */
for (fcu = act->curves.first; fcu; fcu = fcu->next) {
BezTriple *bezt;
unsigned int i;
if (fcu->bezt) {
for (i = 0, bezt = fcu->bezt; i < fcu->totvert; i++, bezt++) {
/* check if remove */
if (IS_EQF(bezt->vec[1][0], (float)marker->frame)) {
delete_fcurve_key(fcu, i, 1);
break;
}
}
}
}
/* remove poselib from list */
BLI_freelinkN(&act->markers, marker);
/* fix active pose number */
act->active_marker = 0;
/* send notifiers for this - using keyframe editing notifiers, since action
* may be being shown in anim editors as active action
*/
WM_event_add_notifier(C, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, NULL);
/* done */
return OPERATOR_FINISHED;
}
示例14: rna_Mesh_assign_verts_to_group
static void rna_Mesh_assign_verts_to_group(Object *ob, bDeformGroup *group, int *indices, int totindex,
float weight, int assignmode)
{
if (ob->type != OB_MESH) {
BKE_report(reports, RPT_ERROR, "Object should be of mesh type");
return;
}
Mesh *me = (Mesh *)ob->data;
int group_index = BLI_findlink(&ob->defbase, group);
if (group_index == -1) {
BKE_report(reports, RPT_ERROR, "No vertex groups assigned to mesh");
return;
}
if (assignmode != WEIGHT_REPLACE && assignmode != WEIGHT_ADD && assignmode != WEIGHT_SUBTRACT) {
BKE_report(reports, RPT_ERROR, "Bad assignment mode");
return;
}
/* makes a set of dVerts corresponding to the mVerts */
if (!me->dvert)
create_dverts(&me->id);
/* loop list adding verts to group */
for (i = 0; i < totindex; i++) {
if (i < 0 || i >= me->totvert) {
BKE_report(reports, RPT_ERROR, "Bad vertex index in list");
return;
}
add_vert_defnr(ob, group_index, i, weight, assignmode);
}
}
示例15: poselib_rename_invoke
static int poselib_rename_invoke(bContext *C, wmOperator *op, const wmEvent *event)
{
Object *ob = get_poselib_object(C);
bAction *act = (ob) ? ob->poselib : NULL;
TimeMarker *marker;
/* check if valid poselib */
if (act == NULL) {
BKE_report(op->reports, RPT_ERROR, "Object does not have pose lib data");
return OPERATOR_CANCELLED;
}
/* get index (and pointer) of pose to remove */
marker = BLI_findlink(&act->markers, act->active_marker - 1);
if (marker == NULL) {
BKE_report(op->reports, RPT_ERROR, "Invalid index for pose");
return OPERATOR_CANCELLED;
}
else {
/* use the existing name of the marker as the name, and use the active marker as the one to rename */
RNA_enum_set(op->ptr, "pose", act->active_marker - 1);
RNA_string_set(op->ptr, "name", marker->name);
}
/* part to sync with other similar operators... */
return WM_operator_props_popup_confirm(C, op, event);
}