void paintface_reveal(bContext *C, Object *ob, const bool select) { Mesh *me; MPoly *mpoly; int a; me = BKE_mesh_from_object(ob); if (me == NULL || me->totpoly == 0) { return; } mpoly = me->mpoly; a = me->totpoly; while (a--) { if (mpoly->flag & ME_HIDE) { SET_FLAG_FROM_TEST(mpoly->flag, select, ME_FACE_SEL); mpoly->flag &= ~ME_HIDE; } mpoly++; } BKE_mesh_flush_hidden_from_polys(me); paintface_flush_flags(C, ob, SELECT | ME_HIDE); }
static void rna_Object_local_view_set(Object *ob, ReportList *reports, PointerRNA *v3d_ptr, bool state) { bScreen *sc = v3d_ptr->id.data; View3D *v3d = v3d_ptr->data; Scene *scene; Base *base = rna_Object_local_view_property_helper(sc, v3d, ob, reports, &scene); if (base == NULL) { return; /* Error reported. */ } const short local_view_bits_prev = base->local_view_bits; SET_FLAG_FROM_TEST(base->local_view_bits, state, v3d->local_view_uuid); if (local_view_bits_prev != base->local_view_bits) { DEG_id_tag_update(&scene->id, ID_RECALC_BASE_FLAGS); ScrArea *sa = ED_screen_area_find_with_spacedata(sc, (SpaceLink *)v3d, true); if (sa) { ED_area_tag_redraw(sa); } } }
static int lattice_select_more_less(bContext *C, const bool select) { Object *obedit = CTX_data_edit_object(C); Lattice *lt = ((Lattice *)obedit->data)->editlatt->latt; BPoint *bp; const int tot = lt->pntsu * lt->pntsv * lt->pntsw; int u, v, w; BLI_bitmap *selpoints; lt->actbp = LT_ACTBP_NONE; selpoints = BLI_BITMAP_NEW(tot, __func__); BKE_lattice_bitmap_from_flag(lt, selpoints, SELECT, false, false); bp = lt->def; for (w = 0; w < lt->pntsw; w++) { for (v = 0; v < lt->pntsv; v++) { for (u = 0; u < lt->pntsu; u++) { if ((bp->hide == 0) && (((bp->f1 & SELECT) == 0) == select)) { if (lattice_test_bitmap_uvw(lt, selpoints, u + 1, v, w, select) || lattice_test_bitmap_uvw(lt, selpoints, u - 1, v, w, select) || lattice_test_bitmap_uvw(lt, selpoints, u, v + 1, w, select) || lattice_test_bitmap_uvw(lt, selpoints, u, v - 1, w, select) || lattice_test_bitmap_uvw(lt, selpoints, u, v, w + 1, select) || lattice_test_bitmap_uvw(lt, selpoints, u, v, w - 1, select)) { SET_FLAG_FROM_TEST(bp->f1, select, SELECT); } } bp++; } } } MEM_freeN(selpoints); WM_event_add_notifier(C, NC_GEOM | ND_SELECT, obedit->data); return OPERATOR_FINISHED; }
static void select_linked_tfaces_with_seams(Mesh *me, const unsigned int index, const bool select) { MPoly *mp; MLoop *ml; int a, b; bool do_it = true; bool mark = false; BLI_bitmap *edge_tag = BLI_BITMAP_NEW(me->totedge, __func__); BLI_bitmap *poly_tag = BLI_BITMAP_NEW(me->totpoly, __func__); if (index != (unsigned int)-1) { /* only put face under cursor in array */ mp = &me->mpoly[index]; BKE_mesh_poly_edgebitmap_insert(edge_tag, mp, me->mloop + mp->loopstart); BLI_BITMAP_ENABLE(poly_tag, index); } else { /* fill array by selection */ mp = me->mpoly; for (a = 0; a < me->totpoly; a++, mp++) { if (mp->flag & ME_HIDE) { /* pass */ } else if (mp->flag & ME_FACE_SEL) { BKE_mesh_poly_edgebitmap_insert(edge_tag, mp, me->mloop + mp->loopstart); BLI_BITMAP_ENABLE(poly_tag, a); } } } while (do_it) { do_it = false; /* expand selection */ mp = me->mpoly; for (a = 0; a < me->totpoly; a++, mp++) { if (mp->flag & ME_HIDE) { continue; } if (!BLI_BITMAP_TEST(poly_tag, a)) { mark = false; ml = me->mloop + mp->loopstart; for (b = 0; b < mp->totloop; b++, ml++) { if ((me->medge[ml->e].flag & ME_SEAM) == 0) { if (BLI_BITMAP_TEST(edge_tag, ml->e)) { mark = true; break; } } } if (mark) { BLI_BITMAP_ENABLE(poly_tag, a); BKE_mesh_poly_edgebitmap_insert(edge_tag, mp, me->mloop + mp->loopstart); do_it = true; } } } } MEM_freeN(edge_tag); for (a = 0, mp = me->mpoly; a < me->totpoly; a++, mp++) { if (BLI_BITMAP_TEST(poly_tag, a)) { SET_FLAG_FROM_TEST(mp->flag, select, ME_FACE_SEL); } } MEM_freeN(poly_tag); }