62 for (
Object *ob : objects) {
63 Lattice *lt = id_cast<Lattice *>(ob->data);
85 Lattice *lt = id_cast<Lattice *>(ob->data);
99 ot->
name =
"Make Regular";
100 ot->
description =
"Set UVW control points a uniform distance apart";
101 ot->
idname =
"LATTICE_OT_make_regular";
152 int numU = lt->
pntsu;
153 int numV = lt->
pntsv;
154 int numW = lt->
pntsw;
205 bool changed =
false;
210 for (
Object *obedit : objects) {
213 int numU, numV, numW;
220 lt = id_cast<Lattice *>(obedit->data);
230 totP = numU * numV * numW;
246 printf(
"lattice_flip(): Unknown flipping axis (%d)\n", axis);
252 float avgInv = 1.0f /
float(totP);
256 for (i = 0, bp = lt->
def; i < totP; i++, bp++) {
257 mid += bp->
vec[axis] * avgInv;
267 for (
w = 0;
w < numW;
w++) {
268 for (
v = 0;
v < numV;
v++) {
270 for (u = 0; u < (numU / 2); u++) {
287 for (
w = 0;
w < numW;
w++) {
288 for (u = 0; u < numU; u++) {
290 for (
v = 0;
v < (numV / 2);
v++) {
306 for (
v = 0;
v < numV;
v++) {
307 for (u = 0; u < numU; u++) {
309 for (
w = 0;
w < (numW / 2);
w++) {
341 {0,
nullptr, 0,
nullptr,
nullptr},
345 ot->
name =
"Flip (Distortion Free)";
346 ot->
description =
"Mirror all control points without inverting the lattice deform";
347 ot->
idname =
"LATTICE_OT_flip";
363 "Coordinates along this axis get flipped");
#define FOREACH_SELECTED_OBJECT_BEGIN(_view_layer, _v3d, _instance)
#define FOREACH_SELECTED_OBJECT_END
Object is a sort of wrapper for general info.
SIMD_FORCE_INLINE const btScalar & w() const
Return the w value.
IMETHOD Vector diff(const Vector &a, const Vector &b, double dt)
bool shape_key_report_if_locked(const Object *obedit, ReportList *reports)
wmOperatorStatus WM_menu_invoke(bContext *C, wmOperator *op, const wmEvent *)
int RNA_enum_get(PointerRNA *ptr, const char *name)
void BKE_lattice_resize(Lattice *lt, int u_new, int v_new, int w_new, Object *lt_ob)
static wmOperatorStatus make_regular_exec(bContext *C, wmOperator *op)
bool ED_operator_editlattice(bContext *C)
void LATTICE_OT_flip(wmOperatorType *ot)
PropertyRNA * RNA_def_enum(StructOrFunctionRNA *cont_, const char *identifier, const EnumPropertyItem *items, const int default_value, const char *ui_name, const char *ui_description)
ATTR_WARN_UNUSED_RESULT const BMVert * v
ViewLayer * CTX_data_view_layer(const bContext *C)
static wmOperatorStatus lattice_flip_exec(bContext *C, wmOperator *op)
void DEG_id_tag_update(ID *id, unsigned int flags)
MINLINE void swap_v3_v3(float a[3], float b[3])
Object * CTX_data_edit_object(const bContext *C)
int BKE_lattice_index_from_uvw(const Lattice *lt, int u, int v, int w)
static void lattice_flip_point_value(Lattice *lt, int u, int v, int w, float mid, eLattice_FlipAxes axis)
void WM_event_add_notifier(const bContext *C, uint type, void *reference)
static void lattice_swap_point_pairs(Lattice *lt, int u, int v, int w, float mid, eLattice_FlipAxes axis)
Main * CTX_data_main(const bContext *C)
static bool make_regular_poll(bContext *C)
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)
Scene * CTX_data_scene(const bContext *C)
void LATTICE_OT_make_regular(wmOperatorType *ot)
Object * CTX_data_active_object(const bContext *C)
View3D * CTX_wm_view3d(const bContext *C)
KERNEL_FEATURE_LIGHT_PASSES KERNEL_FEATURE_PATH_GUIDING float
struct EditLatt * editlatt
wmOperatorStatus(*) exec(bContext *C, wmOperator *op) ATTR_WARN_UNUSED_RESULT
bool(*) poll(bContext *C) ATTR_WARN_UNUSED_RESULT
wmOperatorStatus(*) invoke(bContext *C, wmOperator *op, const wmEvent *event) ATTR_WARN_UNUSED_RESULT
struct ReportList * reports