68 bool changed_multi =
false;
69 for (
Base *base : bases) {
70 Object *ob_iter = base->object;
104 Object *obedit = objects[ob_index];
105 Lattice *lt = (id_cast<Lattice *>(obedit->
data))->editlatt->latt;
106 int seed_iter = seed;
114 int elem_map_len = 0;
120 elem_map[elem_map_len++] = bp;
126 const int count_select = elem_map_len * randfac;
127 for (
int i = 0; i < count_select; i++) {
130 MEM_delete(elem_map);
146 ot->
name =
"Select Random";
147 ot->
description =
"Randomly select UVW control points";
148 ot->
idname =
"LATTICE_OT_select_random";
171 bool flip_uvw[3] = {
false};
172 flip_uvw[axis] =
true;
184 for (
int i = 0; i < tot; i++) {
199 MEM_delete(selpoints);
213 for (
Object *obedit : objects) {
214 Lattice *lt = (id_cast<Lattice *>(obedit->data))->editlatt->latt;
216 for (
int axis = 0; axis < 3; axis++) {
217 if ((1 << axis) & axis_flag) {
233 ot->
name =
"Select Mirror";
234 ot->
description =
"Select mirrored lattice points";
235 ot->
idname =
"LATTICE_OT_select_mirror";
275 bool changed =
false;
279 for (
Object *obedit : objects) {
280 Lattice *lt = (id_cast<Lattice *>(obedit->data))->editlatt->latt;
294 for (u = 0; u < lt->
pntsu; u++) {
311 MEM_delete(selpoints);
334 ot->
name =
"Select More";
335 ot->
description =
"Select vertices directly linked to already selected ones";
336 ot->
idname =
"LATTICE_OT_select_more";
349 ot->
name =
"Select Less";
350 ot->
description =
"Deselect vertices at the boundary of each selection region";
351 ot->
idname =
"LATTICE_OT_select_less";
372 bool changed =
false;
385 if (bp->
f1 != flag) {
407 for (
Object *obedit : objects) {
408 Lattice *lt = id_cast<Lattice *>(obedit->data);
416 bool changed_multi =
false;
417 for (
Object *obedit : objects) {
421 bool changed =
false;
431 lt = id_cast<Lattice *>(obedit->data);
446 changed_multi =
true;
461 ot->
name =
"(De)select All";
462 ot->
description =
"Change selection of all UVW control points";
463 ot->
idname =
"LATTICE_OT_select_all";
487 bool changed =
false;
491 for (
Object *obedit : objects) {
492 Lattice *lt = (id_cast<Lattice *>(obedit->data))->editlatt->latt;
508 for (a = 0, bp = lt->
def; a < tot; a++, bp++, dv++) {
510 if (dv->
dw ==
nullptr) {
531 ot->
name =
"Select Ungrouped";
532 ot->
idname =
"LATTICE_OT_select_ungrouped";
533 ot->
description =
"Select vertices without a group";
572 if (dist_test < data->dist) {
573 data->dist = dist_test;
575 data->is_changed =
true;
590 for (
Base *base : bases) {
591 data.is_changed =
false;
598 if (
data.is_changed) {
609 Base *basact =
nullptr;
610 bool changed =
false;
613 vc.
mval[0] = mval[0];
614 vc.
mval[1] = mval[1];
617 bool found = (bp !=
nullptr);
627 for (
Object *ob : objects) {
682 return changed || found;
#define BLI_BITMAP_NEW(_num, _alloc_string)
#define BLI_BITMAP_TEST(_bitmap, _index)
Object is a sort of wrapper for general info.
#define V3D_PROJ_TEST_CLIP_DEFAULT
Read Blender memory allocation and freeing.
#define BLI_assert_unreachable()
#define SET_FLAG_FROM_TEST(value, test, flag)
SIMD_FORCE_INLINE const btScalar & w() const
Return the w value.
IndexRange index_range() const
void base_activate(bContext *C, Base *base)
void LATTICE_OT_select_mirror(wmOperatorType *ot)
int RNA_enum_get(PointerRNA *ptr, const char *name)
bool ED_lattice_deselect_all_multi(bContext *C)
void WM_operator_properties_select_random(wmOperatorType *ot)
ViewContext ED_view3d_viewcontext_init(bContext *C, Depsgraph *depsgraph)
void * MEM_new_array_uninitialized(size_t len, size_t size, const char *str) ATTR_WARN_UNUSED_RESULT ATTR_ALLOC_SIZE(1
void BKE_lattice_bitmap_from_flag(const Lattice *lt, unsigned int *bitmap, uint8_t flag, bool clear, bool respecthide)
bool ED_operator_editlattice(bContext *C)
static wmOperatorStatus lattice_select_all_exec(bContext *C, wmOperator *op)
int WM_operator_properties_select_random_seed_increment_get(wmOperator *op)
const EnumPropertyItem rna_enum_axis_flag_xyz_items[]
void LATTICE_OT_select_all(wmOperatorType *ot)
static void findnearestLattvert__doClosest(void *user_data, BPoint *bp, const float screen_co[2])
Base * BKE_view_layer_active_base_get(ViewLayer *view_layer)
static wmOperatorStatus lattice_select_more_less(bContext *C, const bool select)
ATTR_WARN_UNUSED_RESULT const BMVert * v
static wmOperatorStatus lattice_select_mirror_exec(bContext *C, wmOperator *op)
static wmOperatorStatus lattice_select_more_exec(bContext *C, wmOperator *)
static bool lattice_test_bitmap_uvw(const Lattice *lt, const BLI_bitmap *selpoints, int u, int v, int w, const bool selected)
ViewLayer * CTX_data_view_layer(const bContext *C)
void WM_operator_properties_select_all(wmOperatorType *ot)
void BLI_array_randomize(void *data, unsigned int elem_size, unsigned int elem_num, unsigned int seed)
void LATTICE_OT_select_random(wmOperatorType *ot)
void ED_view3d_viewcontext_init_object(ViewContext *vc, Object *obact)
static bool lattice_deselect_all_multi(const Span< Base * > bases)
static wmOperatorStatus lattice_select_ungrouped_exec(bContext *C, wmOperator *op)
static void ed_lattice_select_mirrored(Lattice *lt, const int axis, const bool extend)
static void bpoint_select_set(BPoint *bp, bool select)
void DEG_id_tag_update(ID *id, unsigned int flags)
void BKE_report(ReportList *reports, eReportType type, const char *message)
BMesh const char void * data
Depsgraph * CTX_data_ensure_evaluated_depsgraph(const bContext *C, bool rna_write_check=false)
int BKE_lattice_index_from_uvw(const Lattice *lt, int u, int v, int w)
bool BKE_view_layer_synced_ensure(const Main &bmain, const Scene *scene, ViewLayer *view_layer)
int BKE_lattice_index_flip(const Lattice *lt, int index, bool flip_u, bool flip_v, bool flip_w)
void LATTICE_OT_select_less(wmOperatorType *ot)
bool RNA_boolean_get(PointerRNA *ptr, const char *name)
void ED_view3d_init_mats_rv3d(const Object *ob, RegionView3D *rv3d)
void WM_event_add_notifier(const bContext *C, uint type, void *reference)
MINLINE float len_manhattan_v2v2(const float a[2], const float b[2]) ATTR_WARN_UNUSED_RESULT
bool BKE_lattice_is_any_selected(const Lattice *lt)
Main * CTX_data_main(const bContext *C)
void LATTICE_OT_select_more(wmOperatorType *ot)
void LATTICE_OT_select_ungrouped(wmOperatorType *ot)
Vector< Object * > BKE_view_layer_array_from_objects_in_edit_mode_unique_data(const Main &bmain, const Scene *scene, ViewLayer *view_layer, const View3D *v3d)
PropertyRNA * RNA_def_enum_flag(StructOrFunctionRNA *cont_, const char *identifier, const EnumPropertyItem *items, const int default_value, const char *ui_name, const char *ui_description)
Vector< Base * > BKE_view_layer_array_from_bases_in_edit_mode_unique_data(const Main &bmain, const Scene *scene, ViewLayer *view_layer, const View3D *v3d)
unsigned int BLI_ghashutil_strhash_p(const void *ptr)
bool ED_lattice_select_pick(bContext *C, const int mval[2], const SelectPick_Params ¶ms)
Scene * CTX_data_scene(const bContext *C)
PropertyRNA * RNA_def_boolean(StructOrFunctionRNA *cont_, const char *identifier, const bool default_value, const char *ui_name, const char *ui_description)
float ED_view3d_select_dist_px()
static wmOperatorStatus lattice_select_less_exec(bContext *C, wmOperator *)
static BPoint * findnearestLattvert(ViewContext *vc, bool select, Base **r_base)
float RNA_float_get(PointerRNA *ptr, const char *name)
bool ED_lattice_flags_set(Object *obedit, int flag)
View3D * CTX_wm_view3d(const bContext *C)
void lattice_foreachScreenVert(const ViewContext *vc, void(*func)(void *user_data, BPoint *bp, const float screen_co[2]), void *user_data, eV3DProjTest clip_flag)
static wmOperatorStatus lattice_select_random_exec(bContext *C, wmOperator *op)
struct EditLatt * editlatt
struct MDeformVert * dvert
ListBaseT< struct bDeformGroup > vertex_group_names
wmOperatorStatus(*) exec(bContext *C, wmOperator *op) ATTR_WARN_UNUSED_RESULT
bool(*) poll(bContext *C) ATTR_WARN_UNUSED_RESULT
struct ReportList * reports