本文整理汇总了C++中BLI_listbase_count函数的典型用法代码示例。如果您正苦于以下问题:C++ BLI_listbase_count函数的具体用法?C++ BLI_listbase_count怎么用?C++ BLI_listbase_count使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了BLI_listbase_count函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
}
示例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);
}
示例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);
}
}
示例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;
}
示例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;
}
示例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;
}
}
示例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;
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
}
示例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");
}
示例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;
}
示例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;
}
示例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);
}