Multi-Objects: LATTICE_OT_flip
This commit is contained in:
@@ -40,6 +40,7 @@
|
|||||||
|
|
||||||
#include "BKE_context.h"
|
#include "BKE_context.h"
|
||||||
#include "BKE_lattice.h"
|
#include "BKE_lattice.h"
|
||||||
|
#include "BKE_layer.h"
|
||||||
|
|
||||||
#include "DEG_depsgraph.h"
|
#include "DEG_depsgraph.h"
|
||||||
|
|
||||||
@@ -191,10 +192,16 @@ static void lattice_swap_point_pairs(Lattice *lt, int u, int v, int w, float mid
|
|||||||
|
|
||||||
static int lattice_flip_exec(bContext *C, wmOperator *op)
|
static int lattice_flip_exec(bContext *C, wmOperator *op)
|
||||||
{
|
{
|
||||||
Object *obedit = CTX_data_edit_object(C);
|
ViewLayer *view_layer = CTX_data_view_layer(C);
|
||||||
|
uint objects_len;
|
||||||
|
bool changed = false;
|
||||||
|
const eLattice_FlipAxes axis = RNA_enum_get(op->ptr, "axis");
|
||||||
|
|
||||||
|
Object **objects = BKE_view_layer_array_from_objects_in_edit_mode_unique_data(view_layer, &objects_len);
|
||||||
|
for (uint ob_index = 0; ob_index < objects_len; ob_index++) {
|
||||||
|
Object *obedit = objects[ob_index];
|
||||||
Lattice *lt;
|
Lattice *lt;
|
||||||
|
|
||||||
eLattice_FlipAxes axis = RNA_enum_get(op->ptr, "axis");
|
|
||||||
int numU, numV, numW;
|
int numU, numV, numW;
|
||||||
int totP;
|
int totP;
|
||||||
|
|
||||||
@@ -309,8 +316,10 @@ static int lattice_flip_exec(bContext *C, wmOperator *op)
|
|||||||
/* updates */
|
/* updates */
|
||||||
DEG_id_tag_update(&obedit->id, OB_RECALC_DATA);
|
DEG_id_tag_update(&obedit->id, OB_RECALC_DATA);
|
||||||
WM_event_add_notifier(C, NC_GEOM | ND_DATA, obedit->data);
|
WM_event_add_notifier(C, NC_GEOM | ND_DATA, obedit->data);
|
||||||
|
changed = true;
|
||||||
|
}
|
||||||
|
|
||||||
return OPERATOR_FINISHED;
|
return changed ? OPERATOR_FINISHED : OPERATOR_CANCELLED;
|
||||||
}
|
}
|
||||||
|
|
||||||
void LATTICE_OT_flip(wmOperatorType *ot)
|
void LATTICE_OT_flip(wmOperatorType *ot)
|
||||||
|
|||||||
Reference in New Issue
Block a user