当前位置: 首页>>代码示例>>C++>>正文


C++ BLI_findindex函数代码示例

本文整理汇总了C++中BLI_findindex函数的典型用法代码示例。如果您正苦于以下问题:C++ BLI_findindex函数的具体用法?C++ BLI_findindex怎么用?C++ BLI_findindex使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了BLI_findindex函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: rna_Action_fcurve_remove

static void rna_Action_fcurve_remove(bAction *act, ReportList *reports, PointerRNA *fcu_ptr)
{
    FCurve *fcu = fcu_ptr->data;
    if (fcu->grp) {
        if (BLI_findindex(&act->groups, fcu->grp) == -1) {
            BKE_reportf(reports, RPT_ERROR, "F-Curve's action group '%s' not found in action '%s'",
                        fcu->grp->name, act->id.name + 2);
            return;
        }

        action_groups_remove_channel(act, fcu);
        free_fcurve(fcu);
        RNA_POINTER_INVALIDATE(fcu_ptr);
    }
    else {
        if (BLI_findindex(&act->curves, fcu) == -1) {
            BKE_reportf(reports, RPT_ERROR, "F-Curve not found in action '%s'", act->id.name + 2);
            return;
        }

        BLI_remlink(&act->curves, fcu);
        free_fcurve(fcu);
        RNA_POINTER_INVALIDATE(fcu_ptr);
    }
}
开发者ID:Walid-Shouman,项目名称:Blender,代码行数:25,代码来源:rna_action.c

示例2: ANIM_scene_get_keyingset_index

/* Get the index of the Keying Set provided, for the given Scene */
int ANIM_scene_get_keyingset_index(Scene *scene, KeyingSet *ks)
{
	int index;
	
	/* if no KeyingSet provided, have none */
	if (ks == NULL)
		return 0;
	
	/* check if the KeyingSet exists in scene list */
	if (scene) {
		/* get index and if valid, return 
		 *	- (absolute) Scene KeyingSets are from (>= 1)
		 */
		index = BLI_findindex(&scene->keyingsets, ks);
		if (index != -1)
			return (index + 1);
	}
	
	/* still here, so try builtins list too 
	 *	- builtins are from (<= -1)
	 *	- none/invalid is (= 0)
	 */
	index = BLI_findindex(&builtin_keyingsets, ks);
	if (index != -1)
		return -(index + 1);
	else
		return 0;
}
开发者ID:castlelore,项目名称:blender-git,代码行数:29,代码来源:keyingsets.c

示例3: BLI_findindex

static char *rna_MetaElement_path(PointerRNA *ptr)
{
	MetaBall *mb = ptr->id.data;
	MetaElem *ml = ptr->data;
	int index = -1;

	if (mb->editelems)
		index = BLI_findindex(mb->editelems, ml);
	if (index == -1)
		index = BLI_findindex(&mb->elems, ml);
	if (index == -1)
		return NULL;

	return BLI_sprintfN("elements[%d]", index);
}
开发者ID:YasirArafath,项目名称:blender-git,代码行数:15,代码来源:rna_meta.c

示例4: BKE_linestyle_color_modifier_remove

int BKE_linestyle_color_modifier_remove(FreestyleLineStyle *linestyle, LineStyleModifier *m)
{
	if (BLI_findindex(&linestyle->color_modifiers, m) == -1)
		return -1;
	switch (m->type) {
		case LS_MODIFIER_ALONG_STROKE:
			MEM_freeN(((LineStyleColorModifier_AlongStroke *)m)->color_ramp);
			break;
		case LS_MODIFIER_DISTANCE_FROM_CAMERA:
			MEM_freeN(((LineStyleColorModifier_DistanceFromCamera *)m)->color_ramp);
			break;
		case LS_MODIFIER_DISTANCE_FROM_OBJECT:
			MEM_freeN(((LineStyleColorModifier_DistanceFromObject *)m)->color_ramp);
			break;
		case LS_MODIFIER_MATERIAL:
			MEM_freeN(((LineStyleColorModifier_Material *)m)->color_ramp);
			break;
		case LS_MODIFIER_TANGENT:
			MEM_freeN(((LineStyleColorModifier_Tangent *)m)->color_ramp);
			break;
		case LS_MODIFIER_NOISE:
			MEM_freeN(((LineStyleColorModifier_Noise *)m)->color_ramp);
			break;
		case LS_MODIFIER_CREASE_ANGLE:
			MEM_freeN(((LineStyleColorModifier_CreaseAngle *)m)->color_ramp);
			break;
		case LS_MODIFIER_CURVATURE_3D:
			MEM_freeN(((LineStyleColorModifier_Curvature_3D *)m)->color_ramp);
			break;
	}
	BLI_freelinkN(&linestyle->color_modifiers, m);
	return 0;
}
开发者ID:rav66,项目名称:blender,代码行数:33,代码来源:linestyle.c

示例5: BKE_linestyle_thickness_modifier_remove

int BKE_linestyle_thickness_modifier_remove(FreestyleLineStyle *linestyle, LineStyleModifier *m)
{
	if (BLI_findindex(&linestyle->thickness_modifiers, m) == -1)
		return -1;
	switch (m->type) {
		case LS_MODIFIER_ALONG_STROKE:
			curvemapping_free(((LineStyleThicknessModifier_AlongStroke *)m)->curve);
			break;
		case LS_MODIFIER_DISTANCE_FROM_CAMERA:
			curvemapping_free(((LineStyleThicknessModifier_DistanceFromCamera *)m)->curve);
			break;
		case LS_MODIFIER_DISTANCE_FROM_OBJECT:
			curvemapping_free(((LineStyleThicknessModifier_DistanceFromObject *)m)->curve);
			break;
		case LS_MODIFIER_MATERIAL:
			curvemapping_free(((LineStyleThicknessModifier_Material *)m)->curve);
			break;
		case LS_MODIFIER_CALLIGRAPHY:
			break;
		case LS_MODIFIER_TANGENT:
			curvemapping_free(((LineStyleThicknessModifier_Tangent *)m)->curve);
			break;
		case LS_MODIFIER_NOISE:
			break;
		case LS_MODIFIER_CREASE_ANGLE:
			break;
		case LS_MODIFIER_CURVATURE_3D:
			break;
	}
	BLI_freelinkN(&linestyle->thickness_modifiers, m);
	return 0;
}
开发者ID:rav66,项目名称:blender,代码行数:32,代码来源:linestyle.c

示例6: set_vertex_channel

static void set_vertex_channel(float *channel, float time, struct Scene *scene, struct FluidObject *fobj, int i)
{
	Object *ob = fobj->object;
	FluidsimModifierData *fluidmd = (FluidsimModifierData *)modifiers_findByType(ob, eModifierType_Fluidsim);
	float *verts;
	int *tris=NULL, numVerts=0, numTris=0;
	int modifierIndex = BLI_findindex(&ob->modifiers, fluidmd);
	int framesize = (3*fobj->numVerts) + 1;
	int j;
	
	if (channel == NULL)
		return;
	
	initElbeemMesh(scene, ob, &numVerts, &verts, &numTris, &tris, 1, modifierIndex);
	
	/* don't allow mesh to change number of verts in anim sequence */
	if (numVerts != fobj->numVerts) {
		MEM_freeN(channel);
		channel = NULL;
		return;
	}
	
	/* fill frame of channel with vertex locations */
	for (j=0; j < (3*numVerts); j++) {
		channel[i*framesize + j] = verts[j];
	}
	channel[i*framesize + framesize-1] = time;
	
	MEM_freeN(verts);
	MEM_freeN(tris);
}
开发者ID:Bforartists,项目名称:Bforartists,代码行数:31,代码来源:physics_fluid.c

示例7: nodeAddSocket

bNodeSocket *ntreeCompositOutputFileAddSocket(bNodeTree *ntree, bNode *node, const char *name, ImageFormatData *im_format)
{
	NodeImageMultiFile *nimf = node->storage;
	bNodeSocket *sock = nodeAddSocket(ntree, node, SOCK_IN, "", SOCK_RGBA);
	
	/* create format data for the input socket */
	NodeImageMultiFileSocket *sockdata = MEM_callocN(sizeof(NodeImageMultiFileSocket), "socket image format");
	sock->storage = sockdata;
	
	BLI_strncpy_utf8(sockdata->path, name, sizeof(sockdata->path));
	ntreeCompositOutputFileUniquePath(&node->inputs, sock, name, '_');
	BLI_strncpy_utf8(sockdata->layer, name, sizeof(sockdata->layer));
	ntreeCompositOutputFileUniqueLayer(&node->inputs, sock, name, '_');
	
	if (im_format) {
		sockdata->format= *im_format;
		if (BKE_imtype_is_movie(sockdata->format.imtype)) {
			sockdata->format.imtype= R_IMF_IMTYPE_OPENEXR;
		}
	}
	else
		BKE_imformat_defaults(&sockdata->format);
	/* use node data format by default */
	sockdata->use_node_format = TRUE;
	
	nimf->active_input = BLI_findindex(&node->inputs, sock);
	
	return sock;
}
开发者ID:vanangamudi,项目名称:blender-main,代码行数:29,代码来源:node_composite_outputFile.c

示例8: BKE_pose_remove_group

/* Remove the given bone-group (expects 'virtual' index (+1 one, used by active_group etc.))
 * index might be invalid ( < 1), in which case it will be find from grp. */
void BKE_pose_remove_group(bPose *pose, bActionGroup *grp, const int index)
{
	bPoseChannel *pchan;
	int idx = index;
	
	if (idx < 1) {
		idx = BLI_findindex(&pose->agroups, grp) + 1;
	}
	
	BLI_assert(idx > 0);
	
	/* adjust group references (the trouble of using indices!):
	 *  - firstly, make sure nothing references it
	 *  - also, make sure that those after this item get corrected
	 */
	for (pchan = pose->chanbase.first; pchan; pchan = pchan->next) {
		if (pchan->agrp_index == idx)
			pchan->agrp_index = 0;
		else if (pchan->agrp_index > idx)
			pchan->agrp_index--;
	}

	/* now, remove it from the pose */
	BLI_freelinkN(&pose->agroups, grp);
	if (pose->active_group >= idx) {
		const bool has_groups = !BLI_listbase_is_empty(&pose->agroups);
		pose->active_group--;
		if (pose->active_group == 0 && has_groups) {
			pose->active_group = 1;
		}
		else if (pose->active_group < 0 || !has_groups) {
			pose->active_group = 0;
		}
	}
}
开发者ID:UPBGE,项目名称:blender,代码行数:37,代码来源:action.c

示例9: rna_GPencil_active_layer_index_get

static int rna_GPencil_active_layer_index_get(PointerRNA *ptr)
{
	bGPdata *gpd = (bGPdata *)ptr->id.data;
	bGPDlayer *gpl = gpencil_layer_getactive(gpd);
	
	return BLI_findindex(&gpd->layers, gpl);
}
开发者ID:Andrewson3D,项目名称:blender-for-vray,代码行数:7,代码来源:rna_gpencil.c

示例10: tree_element_active_sequence

static int tree_element_active_sequence(bContext *C, Scene *scene, TreeElement *te, TreeStoreElem *UNUSED(tselem), int set)
{
	Sequence *seq = (Sequence *) te->directdata;
	Editing *ed = BKE_sequencer_editing_get(scene, FALSE);

	if (set) {
		/* only check on setting */
		if (BLI_findindex(ed->seqbasep, seq) != -1) {
			if (set == 2) {
				BKE_sequencer_active_set(scene, NULL);
			}
			ED_sequencer_deselect_all(scene);

			if (set == 2 && seq->flag & SELECT) {
				seq->flag &= ~SELECT;
			}
			else {
				seq->flag |= SELECT;
				BKE_sequencer_active_set(scene, seq);
			}
		}

		WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER | NA_SELECTED, scene);
	}
	else {
		if (ed->act_seq == seq && seq->flag & SELECT) {
			return 1;
		}
	}
	return(0);
}
开发者ID:danielmarg,项目名称:blender-main,代码行数:31,代码来源:outliner_select.c

示例11:

static uiBlock *ui_block_func_PIE(bContext *UNUSED(C), uiPopupBlockHandle *handle, void *arg_pie)
{
	uiBlock *block;
	uiPieMenu *pie = arg_pie;
	int minwidth, width, height;

	minwidth = 50;
	block = pie->block_radial;

	/* in some cases we create the block before the region,
	 * so we set it delayed here if necessary */
	if (BLI_findindex(&handle->region->uiblocks, block) == -1)
		UI_block_region_set(block, handle->region);

	UI_block_layout_resolve(block, &width, &height);

	UI_block_flag_enable(block, UI_BLOCK_LOOP | UI_BLOCK_NUMSELECT);

	block->minbounds = minwidth;
	block->bounds = 1;
	block->mx = 0;
	block->my = 0;
	block->bounds_type = UI_BLOCK_BOUNDS_PIE_CENTER;

	block->pie_data.pie_center_spawned[0] = pie->mx;
	block->pie_data.pie_center_spawned[1] = pie->my;

	return pie->block_radial;
}
开发者ID:wisaac407,项目名称:blender,代码行数:29,代码来源:interface_region_menu_pie.c

示例12: BKE_linestyle_geometry_modifier_remove

int BKE_linestyle_geometry_modifier_remove(FreestyleLineStyle *linestyle, LineStyleModifier *m)
{
	if (BLI_findindex(&linestyle->geometry_modifiers, m) == -1)
		return -1;
	BLI_freelinkN(&linestyle->geometry_modifiers, m);
	return 0;
}
开发者ID:rav66,项目名称:blender,代码行数:7,代码来源:linestyle.c

示例13: buttons_texture_context_compute

void buttons_texture_context_compute(const bContext *C, SpaceProperties *sbuts)
{
  /* gather available texture users in context. runs on every draw of
   * properties editor, before the buttons are created. */
  ButsContextTexture *ct = sbuts->texuser;
  ID *pinid = sbuts->pinid;

  if (!ct) {
    ct = MEM_callocN(sizeof(ButsContextTexture), "ButsContextTexture");
    sbuts->texuser = ct;
  }
  else {
    BLI_freelistN(&ct->users);
  }

  buttons_texture_users_from_context(&ct->users, C, sbuts);

  if (pinid && GS(pinid->name) == ID_TE) {
    ct->user = NULL;
    ct->texture = (Tex *)pinid;
  }
  else {
    /* set one user as active based on active index */
    if (ct->index >= BLI_listbase_count_at_most(&ct->users, ct->index + 1)) {
      ct->index = 0;
    }

    ct->user = BLI_findlink(&ct->users, ct->index);
    ct->texture = NULL;

    if (ct->user) {
      if (ct->user->ptr.data) {
        PointerRNA texptr;
        Tex *tex;

        /* get texture datablock pointer if it's a property */
        texptr = RNA_property_pointer_get(&ct->user->ptr, ct->user->prop);
        tex = (RNA_struct_is_a(texptr.type, &RNA_Texture)) ? texptr.data : NULL;

        ct->texture = tex;
      }
      else if (ct->user->node && !(ct->user->node->flag & NODE_ACTIVE_TEXTURE)) {
        ButsTextureUser *user;

        /* detect change of active texture node in same node tree, in that
         * case we also automatically switch to the other node */
        for (user = ct->users.first; user; user = user->next) {
          if (user->ntree == ct->user->ntree && user->node != ct->user->node) {
            if (user->node->flag & NODE_ACTIVE_TEXTURE) {
              ct->user = user;
              ct->index = BLI_findindex(&ct->users, user);
              break;
            }
          }
        }
      }
    }
  }
}
开发者ID:dfelinto,项目名称:blender,代码行数:59,代码来源:buttons_texture.c

示例14: rna_RenderSlot_clear

static void rna_RenderSlot_clear(ID *id, RenderSlot *slot, ImageUser *iuser)
{
  Image *image = (Image *)id;
  int index = BLI_findindex(&image->renderslots, slot);
  BKE_image_clear_renderslot(image, iuser, index);

  WM_main_add_notifier(NC_IMAGE | ND_DISPLAY, image);
}
开发者ID:dfelinto,项目名称:blender,代码行数:8,代码来源:rna_image.c

示例15: BLI_remlink_safe

/**
 * 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 true;
	}
	else {
		return false;
	}
}
开发者ID:floored,项目名称:blender,代码行数:13,代码来源:listbase.c


注:本文中的BLI_findindex函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。