private bool Begin(IEnumerable <GameObject> targetObjects) { if (_state != State.Inactive || SharedSettings == null || SharedHotkeys == null || targetObjects == null) { return(false); } _targetObjects = new List <GameObject>(targetObjects); if (_targetObjects.Count == 0) { return(false); } _targetParents = GameObjectEx.FilterParentsOnly(_targetObjects); if (!CalculateTargetAABB() || !IdentifySitSurface()) { _targetObjects.Clear(); _targetParents.Clear(); return(false); } _state = State.Active; _preTargetTransformSnapshots = LocalTransformSnapshot.GetSnapshotCollection(_targetParents); if (SessionBegin != null) { SessionBegin(); } return(true); }
private bool Begin(IEnumerable <GameObject> targetObjects) { if (_state != State.Inactive || SharedSettings == null || _sharedHotkeys == null || targetObjects == null) { return(false); } if ((int)SharedSettings.SurfaceFlags == 0) { return(false); } if (!IdentifyGrabTargets(targetObjects)) { return(false); } if (!IdentifyGrabSurface()) { _grabTargets.Clear(); return(false); } CalculateGrabTargetsAnchorVectors(); _state = State.ActiveSnapToSurface; _preTargetTransformSnapshots = LocalTransformSnapshot.GetSnapshotCollection(_targetParents); SnapTargetsToSurface(); CalculateGrabTargetsAnchorVectors(); if (SessionBegin != null) { SessionBegin(); } return(true); }
public void TakeRedoTargetSnapshots() { if (_wasExecuted) { return; } _redoTargetSnapshots = LocalTransformSnapshot.GetSnapshotCollection(_targetParents); }
public override void OnGizmoDragEnd(int handleId) { if (OwnsHandle(handleId)) { if (BoxUsage == Usage.ObjectScale && _targetHierarchyTransform != null) { var postSnapshot = new LocalTransformSnapshot(); postSnapshot.Snapshot(_targetHierarchyTransform); var action = new PostObjectTransformsChangedAction(new List <LocalTransformSnapshot>() { _dragBeginTargetTransformSnapshot }, new List <LocalTransformSnapshot>() { postSnapshot }); action.Execute(); } } }
public static List <LocalTransformSnapshot> GetSnapshotCollection(IEnumerable <GameObject> gameObjects) { if (gameObjects == null) { return(new List <LocalTransformSnapshot>()); } List <LocalTransformSnapshot> localTransformSnapshots = new List <LocalTransformSnapshot>(20); foreach (GameObject gameObject in gameObjects) { if (gameObject != null) { LocalTransformSnapshot snapshot = new LocalTransformSnapshot(); snapshot.Snapshot(gameObject.transform); localTransformSnapshots.Add(snapshot); } } return(localTransformSnapshots); }
private bool Begin(IEnumerable <GameObject> targetObjects) { if (_state != State.Inactive || _sharedHotkeys == null || targetObjects == null) { return(false); } if (!IdentifyTargetParents(targetObjects) || !IdentifyTargetObjects(targetObjects)) { _targetParents.Clear(); _targetObjects.Clear(); return(false); } _state = State.SelectPivot; _preTargetTransformSnapshots = LocalTransformSnapshot.GetSnapshotCollection(_targetParents); if (SessionBegin != null) { SessionBegin(); } return(true); }
public void End() { if (_state == State.Inactive) { return; } _targetObjects.Clear(); _state = State.Inactive; var postObjectTransformChangedAction = new PostObjectTransformsChangedAction(_preTargetTransformSnapshots, LocalTransformSnapshot.GetSnapshotCollection(_targetParents)); postObjectTransformChangedAction.Execute(); _targetParents.Clear(); if (SessionEnd != null) { SessionEnd(); } }
public void End() { if (_state == State.Inactive) { return; } _grabTargets.Clear(); _state = State.Inactive; _grabSurfaceInfo.SurfaceType = GrabSurfaceType.Invalid; PostObjectTransformsChangedAction postObjectTransformChangedAction = new PostObjectTransformsChangedAction(_preTargetTransformSnapshots, LocalTransformSnapshot.GetSnapshotCollection(_targetParents)); postObjectTransformChangedAction.Execute(); _targetParents.Clear(); if (SessionEnd != null) { SessionEnd(); } }
public override void OnGizmoDragEnd(int handleId) { if (_transformableParents.Count != 0) { var postObjectTransformChangedAction = new PostObjectTransformsChangedAction(_preTransformSnapshots, LocalTransformSnapshot.GetSnapshotCollection(_targetObjects)); postObjectTransformChangedAction.Execute(); } RefreshPositionAndRotation(); }
public override void OnGizmoDragBegin(int handleId) { _preTransformSnapshots = LocalTransformSnapshot.GetSnapshotCollection(_targetObjects); _transformableParents = GetTransformableParentObjects(); _targetGroupAABBOnDragBegin = GetTargetObjectGroupWorldAABB(); }