Fix extrude glitch where undo state was visible
This commit is contained in:
		@@ -451,11 +451,18 @@ static void manipulator_mesh_extrude_refresh(const bContext *C, wmManipulatorGro
 | 
			
		||||
		wmOperator *op_transform = op->macro.last;
 | 
			
		||||
		wmManipulatorOpElem *mpop = WM_manipulator_operator_get(man->axis_redo, 0);
 | 
			
		||||
 | 
			
		||||
		PointerRNA macroptr = RNA_pointer_get(&mpop->ptr, "TRANSFORM_OT_translate");
 | 
			
		||||
 | 
			
		||||
		float value[4];
 | 
			
		||||
		RNA_float_get_array(op_transform->ptr, "value", value);
 | 
			
		||||
 | 
			
		||||
		PointerRNA macroptr = RNA_pointer_get(&mpop->ptr, "TRANSFORM_OT_translate");
 | 
			
		||||
		RNA_float_set_array(¯optr, "value", value);
 | 
			
		||||
 | 
			
		||||
		/* Currently has glitch in re-applying. */
 | 
			
		||||
#if 0
 | 
			
		||||
		int constraint_axis[3];
 | 
			
		||||
		RNA_boolean_get_array(op_transform->ptr, "constraint_axis", constraint_axis);
 | 
			
		||||
		RNA_boolean_set_array(¯optr, "constraint_axis", constraint_axis);
 | 
			
		||||
#endif
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -2230,6 +2230,33 @@ bool initTransform(bContext *C, TransInfo *t, wmOperator *op, const wmEvent *eve
 | 
			
		||||
	calculatePropRatio(t);
 | 
			
		||||
	calculateCenter(t);
 | 
			
		||||
 | 
			
		||||
	/* Overwrite initial values if operator supplied a non-null vector.
 | 
			
		||||
	 *
 | 
			
		||||
	 * Run before init functions so 'values_modal_offset' can be applied on mouse input.
 | 
			
		||||
	 */
 | 
			
		||||
	BLI_assert(is_zero_v4(t->values_modal_offset));
 | 
			
		||||
	if ((prop = RNA_struct_find_property(op->ptr, "value")) && RNA_property_is_set(op->ptr, prop)) {
 | 
			
		||||
		float values[4] = {0}; /* in case value isn't length 4, avoid uninitialized memory  */
 | 
			
		||||
 | 
			
		||||
		if (RNA_property_array_check(prop)) {
 | 
			
		||||
			RNA_float_get_array(op->ptr, "value", values);
 | 
			
		||||
		}
 | 
			
		||||
		else {
 | 
			
		||||
			values[0] = RNA_float_get(op->ptr, "value");
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		copy_v4_v4(t->values, values);
 | 
			
		||||
 | 
			
		||||
		if (t->flag & T_MODAL) {
 | 
			
		||||
			copy_v4_v4(t->values_modal_offset, values);
 | 
			
		||||
			t->redraw = TREDRAW_HARD;
 | 
			
		||||
		}
 | 
			
		||||
		else {
 | 
			
		||||
			copy_v4_v4(t->auto_values, values);
 | 
			
		||||
			t->flag |= T_AUTOVALUES;
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if (event) {
 | 
			
		||||
		/* Initialize accurate transform to settings requested by keymap. */
 | 
			
		||||
		bool use_accurate = false;
 | 
			
		||||
@@ -2408,33 +2435,6 @@ bool initTransform(bContext *C, TransInfo *t, wmOperator *op, const wmEvent *eve
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	BLI_assert(is_zero_v4(t->values_modal_offset));
 | 
			
		||||
 | 
			
		||||
	/* overwrite initial values if operator supplied a non-null vector
 | 
			
		||||
	 *
 | 
			
		||||
	 * keep last so we can apply the constraints space.
 | 
			
		||||
	 */
 | 
			
		||||
	if ((prop = RNA_struct_find_property(op->ptr, "value")) && RNA_property_is_set(op->ptr, prop)) {
 | 
			
		||||
		float values[4] = {0}; /* in case value isn't length 4, avoid uninitialized memory  */
 | 
			
		||||
 | 
			
		||||
		if (RNA_property_array_check(prop)) {
 | 
			
		||||
			RNA_float_get_array(op->ptr, "value", values);
 | 
			
		||||
		}
 | 
			
		||||
		else {
 | 
			
		||||
			values[0] = RNA_float_get(op->ptr, "value");
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		copy_v4_v4(t->values, values);
 | 
			
		||||
 | 
			
		||||
		if (t->flag & T_MODAL) {
 | 
			
		||||
			copy_v4_v4(t->values_modal_offset, values);
 | 
			
		||||
		}
 | 
			
		||||
		else {
 | 
			
		||||
			copy_v4_v4(t->auto_values, values);
 | 
			
		||||
			t->flag |= T_AUTOVALUES;
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	t->context = NULL;
 | 
			
		||||
 | 
			
		||||
	return 1;
 | 
			
		||||
 
 | 
			
		||||
@@ -490,6 +490,15 @@ static int transform_invoke(bContext *C, wmOperator *op, const wmEvent *event)
 | 
			
		||||
		WM_event_add_modal_handler(C, op);
 | 
			
		||||
 | 
			
		||||
		op->flag |= OP_IS_MODAL_GRAB_CURSOR; // XXX maybe we want this with the manipulator only?
 | 
			
		||||
 | 
			
		||||
		/* Use when modal input has some transformation to begin with. */
 | 
			
		||||
		{
 | 
			
		||||
			TransInfo *t = op->customdata;
 | 
			
		||||
			if (UNLIKELY(!is_zero_v4(t->values_modal_offset))) {
 | 
			
		||||
				transformApply(C, t);
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		return OPERATOR_RUNNING_MODAL;
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user