• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ BLI_listbase_count函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: rna_render_slots_active_index_set

static void rna_render_slots_active_index_set(PointerRNA *ptr, int value)
{
  Image *image = (Image *)ptr->id.data;
  int num_slots = BLI_listbase_count(&image->renderslots);
  image->render_slot = value;
  CLAMP(image->render_slot, 0, num_slots - 1);
}
开发者ID:dfelinto,项目名称:blender,代码行数:7,代码来源:rna_image.c


示例2: rna_render_slots_active_index_range

static void rna_render_slots_active_index_range(
    PointerRNA *ptr, int *min, int *max, int *UNUSED(softmin), int *UNUSED(softmax))
{
  Image *image = (Image *)ptr->id.data;
  *min = 0;
  *max = max_ii(0, BLI_listbase_count(&image->renderslots) - 1);
}
开发者ID:dfelinto,项目名称:blender,代码行数:7,代码来源:rna_image.c


示例3: create_vgroups_from_armature

void create_vgroups_from_armature(ReportList *reports, Scene *scene, Object *ob, Object *par,
                                  const int mode, const bool mirror)
{
	/* Lets try to create some vertex groups 
	 * based on the bones of the parent armature.
	 */
	bArmature *arm = par->data;

	if (mode == ARM_GROUPS_NAME) {
		const int defbase_tot = BLI_listbase_count(&ob->defbase);
		int defbase_add;
		/* Traverse the bone list, trying to create empty vertex 
		 * groups corresponding to the bone.
		 */
		defbase_add = bone_looper(ob, arm->bonebase.first, NULL, vgroup_add_unique_bone_cb);

		if (defbase_add) {
			/* its possible there are DWeight's outside the range of the current
			 * objects deform groups, in this case the new groups wont be empty [#33889] */
			ED_vgroup_data_clamp_range(ob->data, defbase_tot);
		}
	}
	else if (ELEM(mode, ARM_GROUPS_ENVELOPE, ARM_GROUPS_AUTO)) {
		/* Traverse the bone list, trying to create vertex groups 
		 * that are populated with the vertices for which the
		 * bone is closest.
		 */
		add_verts_to_dgroups(reports, scene, ob, par, (mode == ARM_GROUPS_AUTO), mirror);
	}
}
开发者ID:DarkDefender,项目名称:blender-npr-tess2,代码行数:30,代码来源:armature_skinning.c


示例4: gpencil_batch_get_element

/* cache init */
static GpencilBatchCache *gpencil_batch_cache_init(Object *ob, int cfra)
{
  bGPdata *gpd = (bGPdata *)ob->data;

  GpencilBatchCache *cache = gpencil_batch_get_element(ob);

  if (!cache) {
    cache = MEM_callocN(sizeof(*cache), __func__);
    ob->runtime.gpencil_cache = cache;
  }
  else {
    memset(cache, 0, sizeof(*cache));
  }

  cache->is_editmode = GPENCIL_ANY_EDIT_MODE(gpd);

  cache->is_dirty = true;

  cache->cache_frame = cfra;

  /* create array of derived frames equal to number of layers */
  cache->tot_layers = BLI_listbase_count(&gpd->layers);
  CLAMP_MIN(cache->tot_layers, 1);
  cache->derived_array = MEM_callocN(sizeof(struct bGPDframe) * cache->tot_layers, "Derived GPF");

  return cache;
}
开发者ID:dfelinto,项目名称:blender,代码行数:28,代码来源:gpencil_cache_utils.c


示例5: BLI_listbase_count

DupliApplyData *duplilist_apply(Object *ob, Scene *scene, ListBase *duplilist)
{
	DupliApplyData *apply_data = NULL;
	int num_objects = BLI_listbase_count(duplilist);
	
	if (num_objects > 0) {
		DupliObject *dob;
		int i;
		apply_data = MEM_mallocN(sizeof(DupliApplyData), "DupliObject apply data");
		apply_data->num_objects = num_objects;
		apply_data->extra = MEM_mallocN(sizeof(DupliExtraData) * (size_t) num_objects,
		                                "DupliObject apply extra data");

		for (dob = duplilist->first, i = 0; dob; dob = dob->next, ++i) {
			/* copy obmat from duplis */
			copy_m4_m4(apply_data->extra[i].obmat, dob->ob->obmat);

			/* make sure derivedmesh is calculated once, before drawing */
			if (scene && !(dob->ob->transflag & OB_DUPLICALCDERIVED) && dob->ob->type == OB_MESH) {
				mesh_get_derived_final(scene, dob->ob, scene->customdata_mask);
				dob->ob->transflag |= OB_DUPLICALCDERIVED;
			}

			copy_m4_m4(dob->ob->obmat, dob->mat);
			
			/* copy layers from the main duplicator object */
			apply_data->extra[i].lay = dob->ob->lay;
			dob->ob->lay = ob->lay;
		}
	}
	return apply_data;
}
开发者ID:DrangPo,项目名称:blender,代码行数:32,代码来源:object_dupli.c


示例6: BLI_listbase_count

/* 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_listbase_count(&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;
	}
}
开发者ID:Brachi,项目名称:blender,代码行数:32,代码来源:deform.c


示例7: rna_Surface_active_point_range

static void rna_Surface_active_point_range(PointerRNA *ptr, int *min, int *max,
                                           int *UNUSED(softmin), int *UNUSED(softmax))
{
	DynamicPaintCanvasSettings *canvas = (DynamicPaintCanvasSettings *)ptr->data;

	*min = 0;
	*max = BLI_listbase_count(&canvas->surfaces) - 1;
}
开发者ID:Ichthyostega,项目名称:blender,代码行数:8,代码来源:rna_dynamicpaint.c


示例8: rna_KeyingSet_active_ksPath_index_range

static void rna_KeyingSet_active_ksPath_index_range(PointerRNA *ptr, int *min, int *max,
        int *UNUSED(softmin), int *UNUSED(softmax))
{
    KeyingSet *ks = (KeyingSet *)ptr->data;

    *min = 0;
    *max = max_ii(0, BLI_listbase_count(&ks->paths) - 1);
}
开发者ID:RiazAhamed,项目名称:NewBlender,代码行数:8,代码来源:rna_animation.c


示例9: rna_Action_active_pose_marker_index_range

static void rna_Action_active_pose_marker_index_range(PointerRNA *ptr, int *min, int *max,
                                                      int *UNUSED(softmin), int *UNUSED(softmax))
{
	bAction *act = (bAction *)ptr->data;

	*min = 0;
	*max = max_ii(0, BLI_listbase_count(&act->markers) - 1);
}
开发者ID:JasonWilkins,项目名称:blender-viewport_fx,代码行数:8,代码来源:rna_action.c


示例10: console_scrollback_limit

static void console_scrollback_limit(SpaceConsole *sc)
{
	int tot;
	
	if (U.scrollback < 32) U.scrollback = 256;  // XXX - save in user defaults
	
	for (tot = BLI_listbase_count(&sc->scrollback); tot > U.scrollback; tot--)
		console_scrollback_free(sc, sc->scrollback.first);
}
开发者ID:mistajuliax,项目名称:OctaneBlender,代码行数:9,代码来源:console_ops.c


示例11: pose_groups_menu_invoke

/* invoke callback which presents a list of bone-groups for the user to choose from */
static int pose_groups_menu_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event))
{
	Object *ob = ED_pose_object_from_context(C);
	bPose *pose;
	PropertyRNA *prop = RNA_struct_find_property(op->ptr, "type");

	uiPopupMenu *pup;
	uiLayout *layout;
	bActionGroup *grp;
	int i;

	/* only continue if there's an object, and a pose there too */
	if (ELEM(NULL, ob, ob->pose))
		return OPERATOR_CANCELLED;
	pose = ob->pose;

	/* If group index is set, try to use it! */
	if (RNA_property_is_set(op->ptr, prop)) {
		const int num_groups = BLI_listbase_count(&pose->agroups);
		const int group = RNA_property_int_get(op->ptr, prop);

		/* just use the active group index, and call the exec callback for the calling operator */
		if (group > 0 && group <= num_groups) {
			return op->type->exec(C, op);
		}
	}

	/* if there's no active group (or active is invalid), create a new menu to find it */
	if (pose->active_group <= 0) {
		/* create a new menu, and start populating it with group names */
		pup = UI_popup_menu_begin(C, op->type->name, ICON_NONE);
		layout = UI_popup_menu_layout(pup);

		/* special entry - allow to create new group, then use that
		 *	(not to be used for removing though)
		 */
		if (strstr(op->idname, "assign")) {
			uiItemIntO(layout, "New Group", ICON_NONE, op->idname, "type", 0);
			uiItemS(layout);
		}

		/* add entries for each group */
		for (grp = pose->agroups.first, i = 1; grp; grp = grp->next, i++)
			uiItemIntO(layout, grp->name, ICON_NONE, op->idname, "type", i);

		/* finish building the menu, and process it (should result in calling self again) */
		UI_popup_menu_end(C, pup);

		return OPERATOR_INTERFACE;
	}
	else {
		/* just use the active group index, and call the exec callback for the calling operator */
		RNA_int_set(op->ptr, "type", pose->active_group);
		return op->type->exec(C, op);
	}
}
开发者ID:Ichthyostega,项目名称:blender,代码行数:57,代码来源:pose_group.c


示例12: console_lb_debug__internal

static void console_lb_debug__internal(ListBase *lb)
{
	ConsoleLine *cl;

	printf("%d: ", BLI_listbase_count(lb));
	for (cl = lb->first; cl; cl = cl->next)
		printf("<%s> ", cl->line);
	printf("\n");

}
开发者ID:mistajuliax,项目名称:OctaneBlender,代码行数:10,代码来源:console_ops.c


示例13: text_drawcache_init

static void text_drawcache_init(SpaceText *st)
{
	DrawCache *drawcache = MEM_callocN(sizeof(DrawCache), "text draw cache");

	drawcache->winx = -1;
	drawcache->nlines = BLI_listbase_count(&st->text->lines);
	drawcache->text_id[0] = '\0';

	st->drawcache = drawcache;
}
开发者ID:jonntd,项目名称:blender,代码行数:10,代码来源:text_draw.c


示例14: rna_GPencil_active_layer_index_range

static void rna_GPencil_active_layer_index_range(PointerRNA *ptr, int *min, int *max, int *softmin, int *softmax)
{
	bGPdata *gpd = (bGPdata *)ptr->id.data;

	*min = 0;
	*max = max_ii(0, BLI_listbase_count(&gpd->layers) - 1);

	*softmin = *min;
	*softmax = *max;
}
开发者ID:Andrewson3D,项目名称:blender-for-vray,代码行数:10,代码来源:rna_gpencil.c


示例15: BKE_collection_new_name_get

/**
 * The automatic/fallback name of a new collection.
 */
void BKE_collection_new_name_get(Collection *collection_parent, char *rname)
{
  char *name;

  if (!collection_parent) {
    name = BLI_strdup("Collection");
  }
  else if (collection_parent->flag & COLLECTION_IS_MASTER) {
    name = BLI_sprintfN("Collection %d", BLI_listbase_count(&collection_parent->children) + 1);
  }
  else {
    const int number = BLI_listbase_count(&collection_parent->children) + 1;
    const int digits = integer_digits_i(number);
    const int max_len = sizeof(collection_parent->id.name) - 1 /* NULL terminator */ -
                        (1 + digits) /* " %d" */ - 2 /* ID */;
    name = BLI_sprintfN("%.*s %d", max_len, collection_parent->id.name + 2, number);
  }

  BLI_strncpy(rname, name, MAX_NAME);
  MEM_freeN(name);
}
开发者ID:wangyxuan,项目名称:blender,代码行数:24,代码来源:collection.c


示例16: BKE_mask_layer_evaluate_animation

void BKE_mask_layer_evaluate_animation(MaskLayer *masklay, const float ctime)
{
	/* animation if available */
	MaskLayerShape *masklay_shape_a;
	MaskLayerShape *masklay_shape_b;
	int found;
	if ((found = BKE_mask_layer_shape_find_frame_range(
	        masklay, ctime, &masklay_shape_a, &masklay_shape_b)))
	{
		if (found == 1) {
#if 0
			printf("%s: exact %d %d (%d)\n",
			       __func__,
			       (int)ctime,
			       BLI_listbase_count(&masklay->splines_shapes),
			       masklay_shape_a->frame);
#endif
			BKE_mask_layer_shape_to_mask(masklay, masklay_shape_a);
		}
		else if (found == 2) {
			float w = masklay_shape_b->frame - masklay_shape_a->frame;
#if 0
			printf("%s: tween %d %d (%d %d)\n",
			       __func__,
			       (int)ctime,
			       BLI_listbase_count(&masklay->splines_shapes),
			       masklay_shape_a->frame, masklay_shape_b->frame);
#endif
			BKE_mask_layer_shape_to_mask_interp(
			        masklay,
			        masklay_shape_a, masklay_shape_b,
			        (ctime - masklay_shape_a->frame) / w);
		}
		else {
			/* always fail, should never happen */
			BLI_assert(found == 2);
		}
	}
}
开发者ID:wisaac407,项目名称:blender,代码行数:39,代码来源:mask_evaluate.c


示例17: ui_imageuser_slot_menu

static void ui_imageuser_slot_menu(bContext *UNUSED(C), uiLayout *layout, void *image_p)
{
  uiBlock *block = uiLayoutGetBlock(layout);
  Image *image = image_p;
  int slot_id;

  uiDefBut(block,
           UI_BTYPE_LABEL,
           0,
           IFACE_("Slot"),
           0,
           0,
           UI_UNIT_X * 5,
           UI_UNIT_Y,
           NULL,
           0.0,
           0.0,
           0,
           0,
           "");
  uiItemS(layout);

  slot_id = BLI_listbase_count(&image->renderslots) - 1;
  for (RenderSlot *slot = image->renderslots.last; slot; slot = slot->prev) {
    char str[64];
    if (slot->name[0] != '\0') {
      BLI_strncpy(str, slot->name, sizeof(str));
    }
    else {
      BLI_snprintf(str, sizeof(str), IFACE_("Slot %d"), slot_id + 1);
    }
    uiDefButS(block,
              UI_BTYPE_BUT_MENU,
              B_NOP,
              str,
              0,
              0,
              UI_UNIT_X * 5,
              UI_UNIT_X,
              &image->render_slot,
              (float)slot_id,
              0.0,
              0,
              -1,
              "");
    slot_id--;
  }
}
开发者ID:dfelinto,项目名称:blender,代码行数:48,代码来源:image_buttons.c


示例18: layer_eval_view_layer

static void layer_eval_view_layer(struct Depsgraph *depsgraph,
                                  struct Scene *UNUSED(scene),
                                  ViewLayer *view_layer)
{
  DEG_debug_print_eval(depsgraph, __func__, view_layer->name, view_layer);

  /* Create array of bases, for fast index-based lookup. */
  const int num_object_bases = BLI_listbase_count(&view_layer->object_bases);
  MEM_SAFE_FREE(view_layer->object_bases_array);
  view_layer->object_bases_array = MEM_malloc_arrayN(
      num_object_bases, sizeof(Base *), "view_layer->object_bases_array");
  int base_index = 0;
  for (Base *base = view_layer->object_bases.first; base; base = base->next) {
    view_layer->object_bases_array[base_index++] = base;
  }
}
开发者ID:dfelinto,项目名称:blender,代码行数:16,代码来源:layer.c


示例19: buttons_texture_user_node_add

static void buttons_texture_user_node_add(ListBase *users, ID *id, 
                                          bNodeTree *ntree, bNode *node,
                                          const char *category, int icon, const char *name)
{
	ButsTextureUser *user = MEM_callocN(sizeof(ButsTextureUser), "ButsTextureUser");

	user->id = id;
	user->ntree = ntree;
	user->node = node;
	user->category = category;
	user->icon = icon;
	user->name = name;
	user->index = BLI_listbase_count(users);

	BLI_addtail(users, user);
}
开发者ID:Andrewson3D,项目名称:blender-for-vray,代码行数:16,代码来源:buttons_texture.c


示例20: buttons_texture_user_property_add

static void buttons_texture_user_property_add(ListBase *users, ID *id, 
                                              PointerRNA ptr, PropertyRNA *prop,
                                              const char *category, int icon, const char *name)
{
	ButsTextureUser *user = MEM_callocN(sizeof(ButsTextureUser), "ButsTextureUser");

	user->id = id;
	user->ptr = ptr;
	user->prop = prop;
	user->category = category;
	user->icon = icon;
	user->name = name;
	user->index = BLI_listbase_count(users);

	BLI_addtail(users, user);
}
开发者ID:Andrewson3D,项目名称:blender-for-vray,代码行数:16,代码来源:buttons_texture.c



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ BLI_listbase_is_empty函数代码示例发布时间:2022-05-30
下一篇:
C++ BLI_listbase_clear函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap