本文整理汇总了C++中BLI_listbase_is_empty函数的典型用法代码示例。如果您正苦于以下问题:C++ BLI_listbase_is_empty函数的具体用法?C++ BLI_listbase_is_empty怎么用?C++ BLI_listbase_is_empty使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了BLI_listbase_is_empty函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: WM_check
void WM_check(bContext *C)
{
wmWindowManager *wm = CTX_wm_manager(C);
/* wm context */
if (wm == NULL) {
wm = CTX_data_main(C)->wm.first;
CTX_wm_manager_set(C, wm);
}
if (wm == NULL || BLI_listbase_is_empty(&wm->windows)) {
return;
}
if (!G.background) {
/* case: fileread */
if ((wm->initialized & WM_INIT_WINDOW) == 0) {
WM_keymap_init(C);
WM_autosave_init(wm);
}
/* case: no open windows at all, for old file reads */
wm_window_add_ghostwindows(wm);
}
/* case: fileread */
/* note: this runs in bg mode to set the screen context cb */
if ((wm->initialized & WM_INIT_WINDOW) == 0) {
ED_screens_initialize(wm);
wm->initialized |= WM_INIT_WINDOW;
}
}
示例2: lattice_select_ungrouped_exec
static int lattice_select_ungrouped_exec(bContext *C, wmOperator *op)
{
Object *obedit = CTX_data_edit_object(C);
Lattice *lt = ((Lattice *)obedit->data)->editlatt->latt;
MDeformVert *dv;
BPoint *bp;
int a, tot;
if (BLI_listbase_is_empty(&obedit->defbase) || lt->dvert == NULL) {
BKE_report(op->reports, RPT_ERROR, "No weights/vertex groups on object");
return OPERATOR_CANCELLED;
}
if (!RNA_boolean_get(op->ptr, "extend")) {
ED_lattice_flags_set(obedit, 0);
}
dv = lt->dvert;
tot = lt->pntsu * lt->pntsv * lt->pntsw;
for (a = 0, bp = lt->def; a < tot; a++, bp++, dv++) {
if (bp->hide == 0) {
if (dv->dw == NULL) {
bp->f1 |= SELECT;
}
}
}
WM_event_add_notifier(C, NC_GEOM | ND_SELECT, obedit->data);
return OPERATOR_FINISHED;
}
示例3: 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;
}
}
}
示例4: nlaedit_add_tracks_empty
/* helper - add NLA Tracks to empty (and selected) AnimData blocks */
bool nlaedit_add_tracks_empty(bAnimContext *ac)
{
ListBase anim_data = {NULL, NULL};
bAnimListElem *ale;
int filter;
bool added = false;
/* get a list of the selected AnimData blocks in the NLA */
filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_ANIMDATA | ANIMFILTER_SEL | ANIMFILTER_NODUPLIS);
ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
/* check if selected AnimData blocks are empty, and add tracks if so... */
for (ale = anim_data.first; ale; ale = ale->next) {
AnimData *adt = ale->adt;
/* sanity check */
BLI_assert(adt->flag & ADT_UI_SELECTED);
/* ensure it is empty */
if (BLI_listbase_is_empty(&adt->nla_tracks)) {
/* add new track to this AnimData block then */
add_nlatrack(adt, NULL);
added = true;
}
}
/* cleanup */
ANIM_animdata_freelist(&anim_data);
return added;
}
示例5: ui_node_sock_name
static void ui_node_sock_name(bNodeSocket *sock, char name[UI_MAX_NAME_STR])
{
if (sock->link && sock->link->fromnode) {
bNode *node = sock->link->fromnode;
char node_name[UI_MAX_NAME_STR];
if (node->type == NODE_GROUP) {
if (node->id)
BLI_strncpy(node_name, node->id->name + 2, UI_MAX_NAME_STR);
else
BLI_strncpy(node_name, N_(node->typeinfo->ui_name), UI_MAX_NAME_STR);
}
else
BLI_strncpy(node_name, node->typeinfo->ui_name, UI_MAX_NAME_STR);
if (BLI_listbase_is_empty(&node->inputs) &&
node->outputs.first != node->outputs.last)
{
BLI_snprintf(name, UI_MAX_NAME_STR, "%s | %s", IFACE_(node_name), IFACE_(sock->link->fromsock->name));
}
else {
BLI_strncpy(name, IFACE_(node_name), UI_MAX_NAME_STR);
}
}
else if (sock->type == SOCK_SHADER)
BLI_strncpy(name, IFACE_("None"), UI_MAX_NAME_STR);
else
BLI_strncpy(name, IFACE_("Default"), UI_MAX_NAME_STR);
}
示例6: vpaint_proj_dm_map_cosnos_update
static void vpaint_proj_dm_map_cosnos_update(
struct VertProjHandle *vp_handle,
ARegion *ar, const float mval_fl[2])
{
struct VertProjUpdate vp_update = {vp_handle, ar, mval_fl};
Scene *scene = vp_handle->scene;
Object *ob = vp_handle->ob;
Mesh *me = ob->data;
DerivedMesh *dm;
/* quick sanity check - we shouldn't have to run this if there are no modifiers */
BLI_assert(BLI_listbase_is_empty(&ob->modifiers) == false);
dm = mesh_get_derived_final(scene, ob, CD_MASK_BAREMESH | CD_MASK_ORIGINDEX);
/* highly unlikely this will become unavailable once painting starts (perhaps with animated modifiers) */
if (LIKELY(dm->foreachMappedVert)) {
copy_vn_fl(vp_handle->dists_sq, me->totvert, FLT_MAX);
dm->foreachMappedVert(dm, vpaint_proj_dm_map_cosnos_update__map_cb, &vp_update, DM_FOREACH_USE_NORMAL);
}
dm->release(dm);
}
示例7: rna_KeyingSet_active_ksPath_editable
static int rna_KeyingSet_active_ksPath_editable(PointerRNA *ptr)
{
KeyingSet *ks = (KeyingSet *)ptr->data;
/* only editable if there are some paths to change to */
return (BLI_listbase_is_empty(&ks->paths) == false) ? PROP_EDITABLE : 0;
}
示例8: ED_markers_draw
/* Draw Scene-Markers in time window */
void ED_markers_draw(const bContext *C, int flag)
{
ListBase *markers = ED_context_get_markers(C);
View2D *v2d;
TimeMarker *marker;
Scene *scene;
int select_pass;
int v2d_clip_range_x[2];
float font_width_max;
/* cache values */
float ypixels, xscale, yscale;
if (markers == NULL || BLI_listbase_is_empty(markers)) {
return;
}
scene = CTX_data_scene(C);
v2d = UI_view2d_fromcontext(C);
if (flag & DRAW_MARKERS_MARGIN) {
const unsigned char shade[4] = {0, 0, 0, 16};
glColor4ubv(shade);
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glRectf(v2d->cur.xmin, 0, v2d->cur.xmax, UI_MARKER_MARGIN_Y);
glDisable(GL_BLEND);
}
/* no time correction for framelen! space is drawn with old values */
ypixels = BLI_rcti_size_y(&v2d->mask);
UI_view2d_scale_get(v2d, &xscale, &yscale);
glScalef(1.0f / xscale, 1.0f, 1.0f);
/* x-bounds with offset for text (adjust for long string, avoid checking string width) */
font_width_max = (10 * UI_DPI_FAC) / xscale;
v2d_clip_range_x[0] = v2d->cur.xmin - (sizeof(marker->name) * font_width_max);
v2d_clip_range_x[1] = v2d->cur.xmax + font_width_max;
/* loop [unselected, selected] */
for (select_pass = 0; select_pass <= SELECT; select_pass += SELECT) {
/* unselected markers are drawn at the first time */
for (marker = markers->first; marker; marker = marker->next) {
if ((marker->flag & SELECT) == select_pass) {
/* bounds check */
if ((marker->frame >= v2d_clip_range_x[0]) &&
(marker->frame <= v2d_clip_range_x[1]))
{
draw_marker(v2d, marker, scene->r.cfra, flag,
ypixels, xscale, yscale);
}
}
}
}
glScalef(xscale, 1.0f, 1.0f);
}
示例9: wm_init_reports
static void wm_init_reports(bContext *C)
{
ReportList *reports = CTX_wm_reports(C);
BLI_assert(!reports || BLI_listbase_is_empty(&reports->list));
BKE_reports_init(reports, RPT_STORE);
}
示例10: ANIM_driver_vars_paste
/* Paste the variables in the buffer to the given FCurve */
bool ANIM_driver_vars_paste(ReportList *reports, FCurve *fcu, bool replace)
{
ChannelDriver *driver = (fcu) ? fcu->driver : NULL;
ListBase tmp_list = {NULL, NULL};
/* sanity checks */
if (BLI_listbase_is_empty(&driver_vars_copybuf)) {
BKE_report(reports, RPT_ERROR, "No driver variables in clipboard to paste");
return false;
}
if (ELEM(NULL, fcu, fcu->driver)) {
BKE_report(reports, RPT_ERROR, "Cannot paste driver variables without a driver");
return false;
}
/* 1) Make a new copy of the variables in the buffer - these will get pasted later... */
driver_variables_copy(&tmp_list, &driver_vars_copybuf);
/* 2) Prepare destination array */
if (replace) {
DriverVar *dvar, *dvarn;
/* Free all existing vars first - We aren't retaining anything */
for (dvar = driver->variables.first; dvar; dvar = dvarn) {
dvarn = dvar->next;
driver_free_variable_ex(driver, dvar);
}
BLI_listbase_clear(&driver->variables);
}
/* 3) Add new vars */
if (driver->variables.last) {
DriverVar *last = driver->variables.last;
DriverVar *first = tmp_list.first;
last->next = first;
first->prev = last;
driver->variables.last = tmp_list.last;
}
else {
driver->variables.first = tmp_list.first;
driver->variables.last = tmp_list.last;
}
#ifdef WITH_PYTHON
/* since driver variables are cached, the expression needs re-compiling too */
if (driver->type == DRIVER_TYPE_PYTHON)
driver->flag |= DRIVER_FLAG_RENAMEVAR;
#endif
return true;
}
示例11: BKE_area_region_free
/* not region itself */
void BKE_area_region_free(SpaceType *st, ARegion *ar)
{
uiList *uilst;
if (st) {
ARegionType *art = BKE_regiontype_from_id(st, ar->regiontype);
if (art && art->free)
art->free(ar);
if (ar->regiondata)
printf("regiondata free error\n");
}
else if (ar->type && ar->type->free)
ar->type->free(ar);
if (ar->v2d.tab_offset) {
MEM_freeN(ar->v2d.tab_offset);
ar->v2d.tab_offset = NULL;
}
if (!BLI_listbase_is_empty(&ar->panels)) {
Panel *pa, *pa_next;
for (pa = ar->panels.first; pa; pa = pa_next) {
pa_next = pa->next;
if (pa->activedata) {
MEM_freeN(pa->activedata);
}
MEM_freeN(pa);
}
}
for (uilst = ar->ui_lists.first; uilst; uilst = uilst->next) {
if (uilst->dyn_data) {
uiListDyn *dyn_data = uilst->dyn_data;
if (dyn_data->items_filter_flags) {
MEM_freeN(dyn_data->items_filter_flags);
}
if (dyn_data->items_filter_neworder) {
MEM_freeN(dyn_data->items_filter_neworder);
}
MEM_freeN(dyn_data);
}
if (uilst->properties) {
IDP_FreeProperty(uilst->properties);
MEM_freeN(uilst->properties);
}
}
BLI_freelistN(&ar->ui_lists);
BLI_freelistN(&ar->ui_previews);
BLI_freelistN(&ar->panels_category);
BLI_freelistN(&ar->panels_category_active);
}
示例12: ANIM_driver_vars_copy
/* Copy the given driver's variables to the buffer */
bool ANIM_driver_vars_copy(ReportList *reports, FCurve *fcu)
{
/* sanity checks */
if (ELEM(NULL, fcu, fcu->driver)) {
BKE_report(reports, RPT_ERROR, "No driver to copy variables from");
return false;
}
if (BLI_listbase_is_empty(&fcu->driver->variables)) {
BKE_report(reports, RPT_ERROR, "Driver has no variables to copy");
return false;
}
/* clear buffer */
ANIM_driver_vars_copybuf_free();
/* copy over the variables */
driver_variables_copy(&driver_vars_copybuf, &fcu->driver->variables);
return (BLI_listbase_is_empty(&driver_vars_copybuf) == false);
}
示例13: copy_particle_systems_poll
static int copy_particle_systems_poll(bContext *C)
{
Object *ob;
if (!ED_operator_object_active_editable(C))
return false;
ob = ED_object_active_context(C);
if (BLI_listbase_is_empty(&ob->particlesystem))
return false;
return true;
}
示例14: BKE_mball_minmax
/* basic vertex data functions */
bool BKE_mball_minmax(MetaBall *mb, float min[3], float max[3])
{
MetaElem *ml;
INIT_MINMAX(min, max);
for (ml = mb->elems.first; ml; ml = ml->next) {
minmax_v3v3_v3(min, max, &ml->x);
}
return (BLI_listbase_is_empty(&mb->elems) == false);
}
示例15: vert_select_ungrouped_exec
static int vert_select_ungrouped_exec(bContext *C, wmOperator *op)
{
Object *ob = CTX_data_active_object(C);
Mesh *me = ob->data;
if (BLI_listbase_is_empty(&ob->defbase) || (me->dvert == NULL)) {
BKE_report(op->reports, RPT_ERROR, "No weights/vertex groups on object");
return OPERATOR_CANCELLED;
}
paintvert_select_ungrouped(ob, RNA_boolean_get(op->ptr, "extend"), true);
ED_region_tag_redraw(CTX_wm_region(C));
return OPERATOR_FINISHED;
}