override protected NPVoxModel CreateProduct(NPVoxModel reuse = null) { if (Input == null) { return(NPVoxModel.NewInvalidInstance(reuse, "No Input Setup")); } NPVoxModel model = ((NPVoxIModelFactory)Input).GetProduct(); // backwards compatibility if (TryToResolveConflicts == false) { TryToResolveConflicts = true; ResolveConflictMethod = NPVoxModelTransformationUtil.ResolveConflictMethodType.NONE; } // shift afftected area if the parent bounding box changed { NPVoxBox parentBounds = model.BoundingBox; if (!lastParentModelBounds.Equals(NPVoxBox.INVALID) && !lastParentModelBounds.Equals(parentBounds)) { sbyte deltaX = (sbyte)((parentBounds.Right - lastParentModelBounds.Right) / 2); sbyte deltaY = (sbyte)((parentBounds.Up - lastParentModelBounds.Up) / 2); sbyte deltaZ = (sbyte)((parentBounds.Forward - lastParentModelBounds.Forward) / 2); NPVoxCoord delta = new NPVoxCoord(deltaX, deltaY, deltaZ); AffectedArea = new NPVoxBox(AffectedArea.LeftDownBack + delta, AffectedArea.RightUpForward + delta); // Debug.Log("Moving affected area by + " + deltaX + " " + deltaY + " " + deltaZ); } lastParentModelBounds = parentBounds; } return(NPVoxModelTransformationUtil.MatrixTransform(model, AffectedArea, Matrix, PivotOffset, ResolveConflictMethod, reuse)); }
override public bool DrawInspector(NPipeEditFlags flags) { bool changed = base.DrawInspector(flags & ~NPipeEditFlags.INPUT); GUILayout.BeginHorizontal(); UnityEditor.EditorGUILayout.LabelField("Resolve Conflicts"); NPVoxModelTransformationUtil.ResolveConflictMethodType newSelected = (NPVoxModelTransformationUtil.ResolveConflictMethodType)GUILayout.SelectionGrid((int)ResolveConflictMethod, new string[] { "NONE", "CLOSEST", "FILL_GAPS" }, 3); if (newSelected != this.ResolveConflictMethod) { changed = true; ResolveConflictMethod = newSelected; } GUILayout.EndHorizontal(); return(changed); }