本文整理匯總了C++中BLI_countlist函數的典型用法代碼示例。如果您正苦於以下問題:C++ BLI_countlist函數的具體用法?C++ BLI_countlist怎麽用?C++ BLI_countlist使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了BLI_countlist函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C++代碼示例。
示例1: vertex_group_menu_exec
static int vertex_group_menu_exec(bContext *C, wmOperator *op)
{
Object *ob= CTX_data_pointer_get_type(C, "object", &RNA_Object).data;
uiPopupMenu *pup;
uiLayout *layout;
pup= uiPupMenuBegin(C, "Vertex Groups", 0);
layout= uiPupMenuLayout(pup);
uiLayoutSetOperatorContext(layout, WM_OP_INVOKE_REGION_WIN);
if(vgroup_object_in_edit_mode(ob)) {
uiItemBooleanO(layout, "Assign to New Group", 0, "OBJECT_OT_vertex_group_assign", "new", 1);
if(BLI_countlist(&ob->defbase) && ob->actdef) {
uiItemO(layout, "Assign to Group", 0, "OBJECT_OT_vertex_group_assign");
uiItemO(layout, "Remove from Group", 0, "OBJECT_OT_vertex_group_remove_from");
uiItemBooleanO(layout, "Remove from All", 0, "OBJECT_OT_vertex_group_remove_from", "all", 1);
}
}
if(BLI_countlist(&ob->defbase) && ob->actdef) {
if(vgroup_object_in_edit_mode(ob))
uiItemS(layout);
uiItemO(layout, "Set Active Group", 0, "OBJECT_OT_vertex_group_set_active");
uiItemO(layout, "Remove Group", 0, "OBJECT_OT_vertex_group_remove");
uiItemBooleanO(layout, "Remove All Groups", 0, "OBJECT_OT_vertex_group_remove", "all", 1);
}
uiPupMenuEnd(C, pup);
return OPERATOR_FINISHED;
}
示例2: rna_Surface_active_point_range
static void rna_Surface_active_point_range(PointerRNA *ptr, int *min, int *max, int *softmin, int *softmax)
{
DynamicPaintCanvasSettings *canvas = (DynamicPaintCanvasSettings *)ptr->data;
*min = 0;
*max = BLI_countlist(&canvas->surfaces) - 1;
}
示例3: rna_BoidSettings_active_boid_state_index_range
static void rna_BoidSettings_active_boid_state_index_range(PointerRNA *ptr, int *min, int *max,
int *UNUSED(softmin), int *UNUSED(softmax))
{
BoidSettings *boids = (BoidSettings *)ptr->data;
*min = 0;
*max = max_ii(0, BLI_countlist(&boids->states) - 1);
}
示例4: rna_BoidState_active_boid_rule_index_range
static void rna_BoidState_active_boid_rule_index_range(PointerRNA *ptr, int *min, int *max,
int *UNUSED(softmin), int *UNUSED(softmax))
{
BoidState *state = (BoidState *)ptr->data;
*min = 0;
*max = max_ii(0, BLI_countlist(&state->rules) - 1);
}
示例5: add_default_keyingset_exec
static int add_default_keyingset_exec (bContext *C, wmOperator *op)
{
Scene *scene= CTX_data_scene(C);
short flag=0, keyingflag=0;
/* validate flags
* - absolute KeyingSets should be created by default
*/
flag |= KEYINGSET_ABSOLUTE;
if (IS_AUTOKEY_FLAG(AUTOMATKEY))
keyingflag |= INSERTKEY_MATRIX;
if (IS_AUTOKEY_FLAG(INSERTNEEDED))
keyingflag |= INSERTKEY_NEEDED;
/* call the API func, and set the active keyingset index */
BKE_keyingset_add(&scene->keyingsets, NULL, flag, keyingflag);
scene->active_keyingset= BLI_countlist(&scene->keyingsets);
/* send notifiers */
WM_event_add_notifier(C, NC_SCENE|ND_KEYINGSET, NULL);
return OPERATOR_FINISHED;
}
示例6: set_constraint_nth_target
/* helper function for add_constriant - sets the last target for the active constraint */
static void set_constraint_nth_target (bConstraint *con, Object *target, char subtarget[], int index)
{
bConstraintTypeInfo *cti= constraint_get_typeinfo(con);
ListBase targets = {NULL, NULL};
bConstraintTarget *ct;
int num_targets, i;
if (cti && cti->get_constraint_targets) {
cti->get_constraint_targets(con, &targets);
num_targets= BLI_countlist(&targets);
if (index < 0) {
if (abs(index) < num_targets)
index= num_targets - abs(index);
else
index= num_targets - 1;
}
else if (index >= num_targets) {
index= num_targets - 1;
}
for (ct=targets.first, i=0; ct; ct= ct->next, i++) {
if (i == index) {
ct->tar= target;
strcpy(ct->subtarget, subtarget);
break;
}
}
if (cti->flush_constraint_targets)
cti->flush_constraint_targets(con, &targets, 0);
}
}
示例7: ui_imageuser_layer_menu
static void ui_imageuser_layer_menu(bContext *UNUSED(C), uiLayout *layout, void *rnd_pt)
{
void **rnd_data = rnd_pt;
uiBlock *block = uiLayoutGetBlock(layout);
RenderResult *rr = rnd_data[0];
ImageUser *iuser = rnd_data[1];
RenderLayer *rl;
RenderLayer rl_fake = {NULL};
const char *fake_name;
int nr;
uiBlockSetCurLayout(block, layout);
uiLayoutColumn(layout, false);
uiDefBut(block, LABEL, 0, IFACE_("Layer"),
0, 0, UI_UNIT_X * 5, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 0, "");
uiItemS(layout);
nr = BLI_countlist(&rr->layers) - 1;
fake_name = ui_imageuser_layer_fake_name(rr);
if (fake_name) {
BLI_strncpy(rl_fake.name, fake_name, sizeof(rl_fake.name));
nr += 1;
}
for (rl = rr->layers.last; rl; rl = rl->prev, nr--) {
final:
uiDefButS(block, BUTM, B_NOP, IFACE_(rl->name), 0, 0,
UI_UNIT_X * 5, UI_UNIT_X, &iuser->layer, (float) nr, 0.0, 0, -1, "");
}
示例8: BLI_countlist
/* rl==NULL means composite result */
static char *pass_menu(RenderLayer *rl, short *curpass)
{
RenderPass *rpass;
int len = 64 + 32 * (rl ? BLI_countlist(&rl->passes) : 1);
short a, nr = 0;
char *str = MEM_callocN(len, "menu layers");
strcpy(str, IFACE_("Pass %t"));
a = strlen(str);
/* rendered results don't have a Combined pass */
if (rl == NULL || rl->rectf) {
a += sprintf(str + a, "|%s %%x0", IFACE_("Combined"));
nr = 1;
}
if (rl)
for (rpass = rl->passes.first; rpass; rpass = rpass->next, nr++)
a += sprintf(str + a, "|%s %%x%d", IFACE_(rpass->name), nr);
if (*curpass >= nr)
*curpass = 0;
return str;
}
示例9: BKE_rigidbody_rebuild_world
/* NOTE: this needs to be called before frame update to work correctly */
void BKE_rigidbody_rebuild_world(Scene *scene, float ctime)
{
RigidBodyWorld *rbw = scene->rigidbody_world;
PointCache *cache;
PTCacheID pid;
int startframe, endframe;
BKE_ptcache_id_from_rigidbody(&pid, NULL, rbw);
BKE_ptcache_id_time(&pid, scene, ctime, &startframe, &endframe, NULL);
cache = rbw->pointcache;
/* flag cache as outdated if we don't have a world or number of objects in the simulation has changed */
if (rbw->physics_world == NULL || rbw->numbodies != BLI_countlist(&rbw->group->gobject)) {
cache->flag |= PTCACHE_OUTDATED;
}
if (ctime == startframe + 1 && rbw->ltime == startframe) {
if (cache->flag & PTCACHE_OUTDATED) {
BKE_ptcache_id_reset(scene, &pid, PTCACHE_RESET_OUTDATED);
rigidbody_update_simulation(scene, rbw, true);
BKE_ptcache_validate(cache, (int)ctime);
cache->last_exact = 0;
cache->flag &= ~PTCACHE_REDO_NEEDED;
}
}
}
示例10: 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?
ksp->idtype = ID_OB;
ksp->flag = KSP_FLAG_WHOLE_ARRAY;
return OPERATOR_FINISHED;
}
示例11: rna_KeyingSet_active_ksPath_index_range
static void rna_KeyingSet_active_ksPath_index_range(PointerRNA *ptr, int *min, int *max, int *softmin, int *softmax)
{
KeyingSet *ks = (KeyingSet *)ptr->data;
*min = 0;
*max = max_ii(0, BLI_countlist(&ks->paths) - 1);
}
示例12: 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_countlist(&act->markers) - 1);
}
示例13: ED_object_shape_key_add
static void ED_object_shape_key_add(bContext *C, Scene *scene, Object *ob, int from_mix)
{
if(object_insert_shape_key(scene, ob, NULL, from_mix)) {
Key *key= ob_get_key(ob);
ob->shapenr= BLI_countlist(&key->block);
WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, ob);
}
}
示例14: 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_countlist(&st->text->lines);
drawcache->text_id[0] = '\0';
st->drawcache = drawcache;
}
示例15: ctx_data_list_count
int ctx_data_list_count(const bContext *C, int (*func)(const bContext*, ListBase*))
{
ListBase list;
if(func(C, &list)) {
int tot= BLI_countlist(&list);
BLI_freelistN(&list);
return tot;
}
else
return 0;
}