public override void RenderHandles(TransformGizmoPivotPoint transformPivotPoint) { if (CanTransformObjects()) { Vector3 newScaleAccumulatedByGizmoInteraction = Handles.ScaleHandle(_scaleAccumulatedByGizmoInteraction, _worldPosition, _worldRotation, HandleUtility.GetHandleSize(_worldPosition)); if (newScaleAccumulatedByGizmoInteraction != _scaleAccumulatedByGizmoInteraction) { GameObjectExtensions.RecordObjectTransformsForUndo(_gameObjectsWhichCanBeTransformed); List <GameObject> topParents = GameObjectExtensions.GetTopParentsFromGameObjectCollection(_gameObjectsWhichCanBeTransformed); Vector3 scaleFactor = CalculateScaleFactorUsedToScaleObjects(newScaleAccumulatedByGizmoInteraction); ScaleObjectsBySpecifiedPivotPoint(transformPivotPoint, scaleFactor, topParents); _scaleAccumulatedByGizmoInteraction = newScaleAccumulatedByGizmoInteraction; GizmoTransformedObjectsMessage.SendToInterestedListeners(this); } } }
public override void RenderHandles(TransformGizmoPivotPoint transformPivotPoint) { if (CanTransformObjects()) { Vector3 newGizmoWorldPosition = Handles.PositionHandle(_worldPosition, _worldRotation); if (newGizmoWorldPosition != _worldPosition) { GameObjectExtensions.RecordObjectTransformsForUndo(_targetObjects); List <GameObject> topParents = GameObjectExtensions.GetParents(_targetObjects); MoveObjects(newGizmoWorldPosition, topParents); UndoEx.RecordForToolAction(this); _worldPosition = newGizmoWorldPosition; GizmoTransformedObjectsMessage.SendToInterestedListeners(this); } } }
public override void RenderHandles(TransformGizmoPivotPoint transformPivotPoint) { if (CanTransformObjects()) { Quaternion newWorldRotationAccumulatedByGizmoInteraction = Handles.RotationHandle(_worldRotation, _worldPosition); if (newWorldRotationAccumulatedByGizmoInteraction.eulerAngles != _worldRotation.eulerAngles) { GameObjectExtensions.RecordObjectTransformsForUndo(_targetObjects); List <GameObject> topParents = GameObjectExtensions.GetParents(_targetObjects); Quaternion rotationAmount = CalculateRotationAmount(newWorldRotationAccumulatedByGizmoInteraction); RotateObjectsAroundSpecifiedPivotPoint(transformPivotPoint, rotationAmount, topParents); UndoEx.RecordForToolAction(this); _worldRotation = newWorldRotationAccumulatedByGizmoInteraction; GizmoTransformedObjectsMessage.SendToInterestedListeners(this); } } }