21# include <fmt/format.h>
42static void rna_LatticePoint_co_get(
PointerRNA *ptr,
float *values)
44 Lattice *lt = id_cast<Lattice *>(ptr->owner_id);
46 int index = bp - lt->def;
51 values[0] = lt->fu + u * lt->du;
52 values[1] = lt->fv +
v * lt->dv;
53 values[2] = lt->fw +
w * lt->dw;
58 Lattice *lt = id_cast<Lattice *>(ptr->owner_id);
66 static_cast<void *
>(dvert->dw),
80 int tot = lt->
pntsu * lt->pntsv * lt->pntsw;
82 if (lt->editlatt && lt->editlatt->latt->def) {
84 iter, ptr,
static_cast<void *
>(lt->editlatt->latt->def),
sizeof(
BPoint), tot, 0,
nullptr);
88 iter, ptr,
static_cast<void *
>(lt->def),
sizeof(
BPoint), tot, 0,
nullptr);
97 ID *
id = ptr->owner_id;
109 ID *
id = ptr->owner_id;
110 const Lattice *lt = id_cast<Lattice *>(ptr->owner_id);
122 Lattice *lt = id_cast<Lattice *>(ptr->owner_id);
124 int newu, newv, neww;
127 newu = (lt->opntsu > 0) ? lt->opntsu : lt->pntsu;
128 newv = (lt->opntsv > 0) ? lt->opntsv : lt->pntsv;
129 neww = (lt->opntsw > 0) ? lt->opntsw : lt->pntsw;
132 for (ob = bmain->objects.first(); ob; ob =
static_cast<Object *
>(ob->id.next)) {
133 if (ob->data == id_cast<const ID *>(lt)) {
150 lt->opntsu = lt->opntsv = lt->opntsw = 0;
152 rna_Lattice_update_data(bmain, scene, ptr);
155static void rna_Lattice_use_outside_set(
PointerRNA *ptr,
bool value)
180static int rna_Lattice_size_editable(
const PointerRNA *ptr,
const char ** )
187static int rna_Lattice_points_u_get(
PointerRNA *ptr)
190 return (lt->opntsu > 0) ? lt->
opntsu : lt->pntsu;
193static void rna_Lattice_points_u_set(
PointerRNA *ptr,
int value)
197 lt->
opntsu = std::clamp(value, 1, 64);
200static int rna_Lattice_points_v_get(
PointerRNA *ptr)
203 return (lt->opntsv > 0) ? lt->
opntsv : lt->pntsv;
206static void rna_Lattice_points_v_set(
PointerRNA *ptr,
int value)
210 lt->
opntsv = std::clamp(value, 1, 64);
213static int rna_Lattice_points_w_get(
PointerRNA *ptr)
216 return (lt->opntsw > 0) ? lt->
opntsw : lt->pntsw;
219static void rna_Lattice_points_w_set(
PointerRNA *ptr,
int value)
223 lt->
opntsw = std::clamp(value, 1, 64);
226static void rna_Lattice_vg_name_set(
PointerRNA *ptr,
const char *value)
232 STRNCPY(lt->editlatt->latt->vgroup, value);
237static std::optional<std::string> rna_LatticePoint_path(
const PointerRNA *ptr)
239 const Lattice *lt = id_cast<Lattice *>(ptr->owner_id);
240 const void *point = ptr->data;
241 const BPoint *points =
nullptr;
243 if (lt->editlatt && lt->editlatt->latt->def) {
244 points = lt->editlatt->latt->def;
250 if (points && point) {
251 int tot = lt->pntsu * lt->pntsv * lt->pntsw;
254 if ((point >= (
void *)points) && (point < (
void *)(points + tot))) {
255 int pt_index = int((
BPoint *)point - points);
257 return fmt::format(
"points[{}]", pt_index);
264static bool rna_Lattice_is_editmode_get(
PointerRNA *ptr)
266 Lattice *lt = id_cast<Lattice *>(ptr->owner_id);
267 return (lt->editlatt !=
nullptr);
297 "Original undeformed location used to calculate the strength of the deform effect "
298 "(edit/animate the Deformed Location instead)");
314 "rna_LatticePoint_groups_begin",
315 "rna_iterator_array_next",
316 "rna_iterator_array_end",
317 "rna_iterator_array_get",
324 prop,
"Groups",
"Weights for the vertex groups this point is member of");
334 srna,
"Lattice",
"Lattice data-block defining a grid for deforming other objects");
340 prop,
"rna_Lattice_points_u_get",
"rna_Lattice_points_u_set",
nullptr);
344 prop,
"U",
"Points in U direction (cannot be changed when there are shape keys)");
351 prop,
"rna_Lattice_points_v_get",
"rna_Lattice_points_v_set",
nullptr);
355 prop,
"V",
"Points in V direction (cannot be changed when there are shape keys)");
362 prop,
"rna_Lattice_points_w_get",
"rna_Lattice_points_w_set",
nullptr);
366 prop,
"W",
"Points in W direction (cannot be changed when there are shape keys)");
392 prop,
"Outside",
"Only display and take into account the outer vertices");
398 prop,
"Vertex Group",
"Vertex group to apply the influence of the lattice");
411 "rna_Lattice_points_begin",
412 "rna_iterator_array_next",
413 "rna_iterator_array_end",
414 "rna_iterator_array_get",
Object is a sort of wrapper for general info.
SIMD_FORCE_INLINE const btScalar & w() const
Return the w value.
void WM_main_add_notifier(uint type, void *reference)
void RNA_def_struct_ui_text(StructRNA *srna, const char *name, const char *description)
void RNA_def_property_editable_func(PropertyRNA *prop, const char *editable)
void RNA_def_property_ui_text(PropertyRNA *prop, const char *name, const char *description)
char * STRNCPY(char(&dst)[N], const char *src)
void RNA_def_struct_ui_icon(StructRNA *srna, int icon)
void RNA_def_property_string_sdna(PropertyRNA *prop, const char *structname, const char *propname)
void BKE_lattice_resize(Lattice *lt, int u_new, int v_new, int w_new, Object *lt_ob)
void BKE_lattice_params_copy(Lattice *lt_dst, const Lattice *lt_src)
void RNA_def_property_float_funcs(PropertyRNA *prop, const char *get, const char *set, const char *range)
static void rna_def_lattice(BlenderRNA *brna)
void RNA_def_property_pointer_sdna(PropertyRNA *prop, const char *structname, const char *propname)
void RNA_def_property_boolean_funcs(PropertyRNA *prop, const char *get, const char *set)
void RNA_def_property_struct_type(PropertyRNA *prop, const char *type)
ATTR_WARN_UNUSED_RESULT const BMVert * v
void RNA_def_lattice(BlenderRNA *brna)
void RNA_def_property_float_sdna(PropertyRNA *prop, const char *structname, const char *propname)
void RNA_api_lattice(StructRNA *srna)
@ PROPOVERRIDE_OVERRIDABLE_LIBRARY
void rna_def_animdata_common(StructRNA *srna)
PropertyRNA * RNA_def_property(StructOrFunctionRNA *cont_, const char *identifier_c_str, int type, int subtype)
void RNA_def_struct_sdna(StructRNA *srna, const char *structname)
void RNA_def_property_enum_items(PropertyRNA *prop, const EnumPropertyItem *item)
void RNA_def_property_collection_funcs(PropertyRNA *prop, const char *begin, const char *next, const char *end, const char *get, const char *length, const char *lookupint, const char *lookupstring, const char *assignint)
void RNA_def_property_int_funcs(PropertyRNA *prop, const char *get, const char *set, const char *range)
void DEG_id_tag_update(ID *id, unsigned int flags)
void RNA_def_property_override_flag(PropertyRNA *prop, PropertyOverrideFlag flag)
void outside_lattice(Lattice *lt)
void RNA_def_property_boolean_sdna(PropertyRNA *prop, const char *structname, const char *propname, int64_t booleanbit)
void RNA_def_property_range(PropertyRNA *prop, double min, double max)
void RNA_def_struct_path_func(StructRNA *srna, const char *path)
const EnumPropertyItem rna_enum_keyblock_type_items[]
static void rna_def_latticepoint(BlenderRNA *brna)
void RNA_def_property_enum_sdna(PropertyRNA *prop, const char *structname, const char *propname)
void RNA_def_property_clear_flag(PropertyRNA *prop, PropertyFlag flag)
void BKE_lattice_index_to_uvw(const Lattice *lt, int index, int *r_u, int *r_v, int *r_w)
StructRNA * RNA_def_struct(BlenderRNA *brna, const char *identifier, const char *from)
void RNA_def_property_int_sdna(PropertyRNA *prop, const char *structname, const char *propname)
void RNA_def_property_update(PropertyRNA *prop, int noteflag, const char *func)
void RNA_def_property_string_funcs(PropertyRNA *prop, const char *get, const char *length, const char *set)
void RNA_def_property_array(PropertyRNA *prop, int length)
void rna_iterator_array_begin(CollectionPropertyIterator *iter, PointerRNA *ptr, void *data, size_t itemsize, int64_t length, bool free_ptr, IteratorSkipFunc skip)
struct EditLatt * editlatt