public void RenamePattern(ObjectPlacementPathHeightPattern pathHeightPattern, string newName) { if (ContainsPattern(pathHeightPattern)) { _pathHeightPatterns.RenameEntity(pathHeightPattern, newName); } }
public void AddPattern(ObjectPlacementPathHeightPattern pathHeightPattern) { if (!ContainsPattern(pathHeightPattern)) { _pathHeightPatterns.AddEntity(pathHeightPattern); } }
private static ObjectPlacementPathHeightPattern CreateNewPatternWithUniqueName(string name, List <string> existingPatternNames) { ObjectPlacementPathHeightPattern newPattern = Octave3DWorldBuilder.ActiveInstance.CreateScriptableObject <ObjectPlacementPathHeightPattern>(); newPattern.Name = UniqueEntityNameGenerator.GenerateUniqueName(name, existingPatternNames); return(newPattern); }
public void SetActivePattern(ObjectPlacementPathHeightPattern newActivePattern) { if (!ContainsPattern(newActivePattern)) { return; } _pathHeightPatterns.MarkEntity(newActivePattern); NewObjectPlacementPathHeightPatternWasActivatedMessage.SendToInterestedListeners(newActivePattern); }
public void RemoveAndDestroyPattern(ObjectPlacementPathHeightPattern pathHeightPattern) { if (ContainsPattern(pathHeightPattern)) { _pathHeightPatterns.RemoveEntity(pathHeightPattern); ObjectPlacementPathHeightPatternWasRemovedFromDatabaseMessage.SendToInterestedListeners(pathHeightPattern); UndoEx.DestroyObjectImmediate(pathHeightPattern); } }
public ObjectPlacementPathHeightPattern CreateHeightPattern(string patternName) { if (!string.IsNullOrEmpty(patternName)) { ObjectPlacementPathHeightPattern newHeightPattern = ObjectPlacementPathHeightPatternFactory.Create(patternName, GetAllHeightPatternNames()); _pathHeightPatterns.AddEntity(newHeightPattern); if (NumberOfPatterns == 1) { SetActivePattern(newHeightPattern); } return(newHeightPattern); } return(null); }
public void OnHeightPatternRemoved() { if (_isActive && _heightAdjustmentSettings.HeightAdjustmentMode == ObjectPlacementPathHeightAdjustmentMode.AutomaticPattern) { ObjectPlacementPathHeightPattern activePattern = ObjectPlacementPathHeightPatternDatabase.Get().ActivePattern; if (activePattern != null) { AdjustHeightForAllStacksInPath(); if (_borderSettings.UseBorders) { _borderApplyOperation.ApplyBordersToAllPathSegments(_pathSegments, _borderSettings); } } else { Debug.LogWarning("There is no height pattern currently available. Path construction was cancelled."); End(); } SceneView.RepaintAll(); } }
private List <ObjectPlacementPathHeightPattern> FilterPatternsByFilterProperties(List <INamedEntity> namedPatternEntities) { var filteredPatterns = new List <ObjectPlacementPathHeightPattern>(); ObjectPlacementPathHeightPattern activePattern = ObjectPlacementPathHeightPatternDatabase.Get().ActivePattern; foreach (ObjectPlacementPathHeightPattern pattern in namedPatternEntities) { if (_onlyActive.IsActive) { if (pattern == activePattern) { filteredPatterns.Add(pattern); return(filteredPatterns); } } else { filteredPatterns.Add(pattern); } } return(filteredPatterns); }
public ObjectPlacementPathHeightPatternView(ObjectPlacementPathHeightPattern heightPattern) { _heightPattern = heightPattern; SurroundWithBox = true; }
public void AdjustHeightForAllSegmentsInPath(List <ObjectPlacementBoxStackSegment> allPathSegments, ObjectPlacementPathAutomaticPatternHeightAdjustmentSettings automaticPatternHeightAdjustmentSettings, ObjectPlacementPathHeightPattern heightPattern) { bool wrapPattern = automaticPatternHeightAdjustmentSettings.WrapPatterns; if (automaticPatternHeightAdjustmentSettings.ApplyPatternsContinuously) { int numberOfTraversedStacks = 0; foreach (ObjectPlacementBoxStackSegment segment in allPathSegments) { for (int stackIndex = 0; stackIndex < segment.NumberOfStacks; ++stackIndex) { segment.GetStackByIndex(stackIndex).SetHeight(heightPattern.GetHeightValue(numberOfTraversedStacks + stackIndex, wrapPattern)); } numberOfTraversedStacks += segment.NumberOfStacks; } } else { foreach (ObjectPlacementBoxStackSegment segment in allPathSegments) { for (int stackIndex = 0; stackIndex < segment.NumberOfStacks; ++stackIndex) { segment.GetStackByIndex(stackIndex).SetHeight(heightPattern.GetHeightValue(stackIndex, wrapPattern)); } } } }
public bool ContainsPattern(ObjectPlacementPathHeightPattern pathHeightPattern) { return(_pathHeightPatterns.ContainsEntity(pathHeightPattern)); }
public int GetPatternIndex(ObjectPlacementPathHeightPattern pathHeightPattern) { return(_pathHeightPatterns.GetEntityIndex(pathHeightPattern)); }
public static void SendToInterestedListeners(ObjectPlacementPathHeightPattern newActivePattern) { var message = new NewObjectPlacementPathHeightPatternWasActivatedMessage(newActivePattern); MessageListenerDatabase.Instance.SendMessageToInterestedListeners(message); }
public NewObjectPlacementPathHeightPatternWasActivatedMessage(ObjectPlacementPathHeightPattern newActivePattern) : base(MessageType.NewObjectPlacementPathHeightPatternWasActivated) { _newActivePattern = newActivePattern; }
public static void SendToInterestedListeners(ObjectPlacementPathHeightPattern removedPattern) { var message = new ObjectPlacementPathHeightPatternWasRemovedFromDatabaseMessage(removedPattern); MessageListenerDatabase.Instance.SendMessageToInterestedListeners(message); }
public ObjectPlacementPathHeightPatternWasRemovedFromDatabaseMessage(ObjectPlacementPathHeightPattern removedPattern) : base(MessageType.ObjectPlacementPathHeightPatternWasRemovedFromDatabase) { _removedPattern = removedPattern; }
public void AdjustSegmentHeight(ObjectPlacementBoxStackSegment segment, List <ObjectPlacementBoxStackSegment> allPathSegments, ObjectPlacementPathAutomaticPatternHeightAdjustmentSettings automaticPatternHeightAdjustmentSettings, ObjectPlacementPathHeightPattern heightPattern) { int initialHeightValueIndex = 0; if (automaticPatternHeightAdjustmentSettings.ApplyPatternsContinuously) { int indexOfSegmentToAdjust = allPathSegments.FindIndex(0, item => item == segment); if (indexOfSegmentToAdjust >= 0) { initialHeightValueIndex = ObjectPlacementBoxStackSegmentQueries.GetTotalNumberOfStacksInSegments(allPathSegments, indexOfSegmentToAdjust - 1); } } bool wrapPattern = automaticPatternHeightAdjustmentSettings.WrapPatterns; for (int stackIndex = 0; stackIndex < segment.NumberOfStacks; ++stackIndex) { segment.GetStackByIndex(stackIndex).SetHeight(heightPattern.GetHeightValue(initialHeightValueIndex + stackIndex, wrapPattern)); } }