Beispiel #1
0
 public bool IsVisible()
 {
     if (ObjectEraserSettings.Get().EraseMode != ObjectEraseMode.ObjectMass3D)
     {
         return(false);
     }
     return(true);
 }
Beispiel #2
0
        public ObjectEraserSettingsView(ObjectEraserSettings settings)
        {
            _settings = settings;

            ToggleVisibilityBeforeRender = true;
            VisibilityToggleLabel        = "Object Eraser Settings";
            SurroundWithBox = true;
        }
Beispiel #3
0
        private void AdjustCircleRadiusIfNecessary()
        {
            float desiredCircleRadius = ObjectEraserSettings.Get().Mass3DEraseSettings.CircleShapeRadius;

            if (_circleShape.MaxModelSpaceRadius != desiredCircleRadius)
            {
                _circleShape.ModelSpaceRadii = new Vector2(desiredCircleRadius, desiredCircleRadius);
            }
        }
Beispiel #4
0
        public override void Render()
        {
            ObjectEraserSettings.Get().View.Render();

            EditorGUILayout.Separator();
            ObjectEraser.Get().EraseMask.View.Render();

            EditorGUILayout.Separator();
            _lookAndFeelSettingsView.Render();
        }
        public bool IsVisible()
        {
            if (ObjectEraserSettings.Get().EraseMode != ObjectEraseMode.ObjectMass2D)
            {
                return(false);
            }
            if (!SceneViewCamera.Camera.pixelRect.Contains(Event.current.mousePosition))
            {
                return(false);
            }

            return(true);
        }
Beispiel #6
0
        public static void EraseEntireGameObjectHierarchy(GameObject gameObject)
        {
            if (!CanGameObjectBeErased(gameObject))
            {
                return;
            }

            ObjectEraserSettings eraserSettings = ObjectEraserSettings.Get();
            GameObject           root           = Octave3DWorldBuilder.ActiveInstance.GetRoot(gameObject);

            if (root != null)
            {
                DestroyGameObject(root, eraserSettings.AllowUndoRedo);
            }
        }
Beispiel #7
0
        public static void EraseGameObject(GameObject gameObject)
        {
            if (!CanGameObjectBeErased(gameObject))
            {
                return;
            }

            ObjectEraserSettings eraserSettings = ObjectEraserSettings.Get();
            bool isPivotWorkingObject           = Octave3DWorldBuilder.ActiveInstance.IsPivotWorkingObject(gameObject);

            if (isPivotWorkingObject)
            {
                List <GameObject> immediateChildren = gameObject.GetImmediateChildren();
                gameObject.MoveImmediateChildrenUpOneLevel(eraserSettings.AllowUndoRedo);
                DestroyGameObject(gameObject, eraserSettings.AllowUndoRedo);

                for (int childIndex = 0; childIndex < immediateChildren.Count; ++childIndex)
                {
                    if (ObjectQueries.IsGameObjectHierarchyEmpty(immediateChildren[childIndex]))
                    {
                        DestroyGameObject(immediateChildren[childIndex], eraserSettings.AllowUndoRedo);
                    }
                }
            }
            else
            {
                GameObject root = Octave3DWorldBuilder.ActiveInstance.GetRoot(gameObject);
                if (root == gameObject)
                {
                    List <GameObject> immediateChildren = gameObject.GetImmediateChildren();
                    gameObject.MoveImmediateChildrenUpOneLevel(eraserSettings.AllowUndoRedo);
                    DestroyGameObject(gameObject, eraserSettings.AllowUndoRedo);

                    foreach (GameObject child in immediateChildren)
                    {
                        if (ObjectQueries.IsGameObjectHierarchyEmpty(child))
                        {
                            DestroyGameObject(child, eraserSettings.AllowUndoRedo);
                        }
                    }
                }
                else
                {
                    GameObject immediateParent = gameObject.transform.parent.gameObject;

                    gameObject.MoveImmediateChildrenUpOneLevel(eraserSettings.AllowUndoRedo);
                    DestroyGameObject(gameObject, eraserSettings.AllowUndoRedo);

                    if (ObjectQueries.IsGameObjectHierarchyEmpty(root) && CanGameObjectBeErased(root))
                    {
                        DestroyGameObject(root, eraserSettings.AllowUndoRedo);
                    }
                    else
                    if (immediateParent.transform.childCount == 0 &&
                        ObjectQueries.IsGameObjectEmpty(immediateParent) &&
                        !Octave3DWorldBuilder.ActiveInstance.IsPivotWorkingObject(immediateParent))
                    {
                        DestroyGameObject(immediateParent, eraserSettings.AllowUndoRedo);
                    }
                }
            }
        }
        private static void SaveObjectErasingSettings(XmlTextWriter xmlWriter, Octave3DConfigSaveLoadSettings saveSettings)
        {
            if (saveSettings.ObjectErasingSettings)
            {
                ObjectEraserSettings eraserSettings = ObjectEraserSettings.Get();

                xmlWriter.WriteNewLine(1);
                xmlWriter.WriteStartElement(Octave3DConfigXMLInfo.ObjectErasingSettingsNode);

                xmlWriter.WriteNewLine(2);
                xmlWriter.WriteStartElement(Octave3DConfigXMLInfo.ObjectErasingAllowUndoRedoNode);
                xmlWriter.WriteString(eraserSettings.AllowUndoRedo.ToString());
                xmlWriter.WriteEndElement();

                xmlWriter.WriteNewLine(2);
                xmlWriter.WriteStartElement(Octave3DConfigXMLInfo.ObjectEraseDelayNode);
                xmlWriter.WriteString(eraserSettings.EraseDelayInSeconds.ToString());
                xmlWriter.WriteEndElement();

                xmlWriter.WriteNewLine(2);
                xmlWriter.WriteStartElement(Octave3DConfigXMLInfo.ObjectEraseModeNode);
                xmlWriter.WriteString(eraserSettings.EraseMode.ToString());
                xmlWriter.WriteEndElement();

                xmlWriter.WriteNewLine(2);
                xmlWriter.WriteStartElement(Octave3DConfigXMLInfo.ObjectEraseOnlyMeshObjectsNode);
                xmlWriter.WriteString(eraserSettings.EraseOnlyMeshObjects.ToString());
                xmlWriter.WriteEndElement();

                xmlWriter.WriteNewLine(2);
                xmlWriter.WriteStartElement(Octave3DConfigXMLInfo.ObjectMassErase2D_CircleRadiusNode);
                xmlWriter.WriteString(eraserSettings.Mass2DEraseSettings.CircleShapeRadius.ToString());
                xmlWriter.WriteEndElement();

                xmlWriter.WriteNewLine(2);
                xmlWriter.WriteStartElement(Octave3DConfigXMLInfo.ObjectMassErase2D_RadiusAdjustmentSpeedScrollWheelNode);
                xmlWriter.WriteString(eraserSettings.Mass2DEraseSettings.ScrollWheelCircleRadiusAdjustmentSpeed.ToString());
                xmlWriter.WriteEndElement();

                xmlWriter.WriteNewLine(2);
                xmlWriter.WriteStartElement(Octave3DConfigXMLInfo.ObjectMassErase2D_AllowPartialOverlap);
                xmlWriter.WriteString(eraserSettings.Mass2DEraseSettings.AllowPartialOverlap.ToString());
                xmlWriter.WriteEndElement();

                xmlWriter.WriteNewLine(2);
                xmlWriter.WriteStartElement(Octave3DConfigXMLInfo.ObjectMassErase3D_CircleRadiusNode);
                xmlWriter.WriteString(eraserSettings.Mass3DEraseSettings.CircleShapeRadius.ToString());
                xmlWriter.WriteEndElement();

                xmlWriter.WriteNewLine(2);
                xmlWriter.WriteStartElement(Octave3DConfigXMLInfo.ObjectMassErase3D_RadiusAdjustmentSpeedScrollWheelNode);
                xmlWriter.WriteString(eraserSettings.Mass3DEraseSettings.ScrollWheelCircleRadiusAdjustmentSpeed.ToString());
                xmlWriter.WriteEndElement();

                xmlWriter.WriteNewLine(2);
                xmlWriter.WriteStartElement(Octave3DConfigXMLInfo.ObjectMassErase3D_AllowPartialOverlap);
                xmlWriter.WriteString(eraserSettings.Mass3DEraseSettings.AllowPartialOverlap.ToString());
                xmlWriter.WriteEndElement();

                xmlWriter.WriteNewLine(1);
                xmlWriter.WriteEndElement();
            }
        }
        private void EnsureWidthAndHeightAreUpToDate()
        {
            Object2DMassEraseSettings objectMassEraseSettings = ObjectEraserSettings.Get().Mass2DEraseSettings;

            SetWidthHeight(objectMassEraseSettings.CircleShapeRadius, objectMassEraseSettings.CircleShapeRadius);
        }
 public List <GameObject> GetOverlappedGameObjectsForEraseOperation()
 {
     return(GetShape().GetOverlappedGameObjects(ObjectEraserSettings.Get().Mass2DEraseSettings.AllowPartialOverlap));
 }
Beispiel #11
0
        public List <GameObject> GetOverlappedGameObjectsForEraseOperation()
        {
            List <GameObject> objectsForEraseOperation = _circleShape.GetOverlappedGameObjects(ObjectEraserSettings.Get().Mass3DEraseSettings.AllowPartialOverlap);

            if (_circleShape.HasCursorPickedObject())
            {
                // Filter the elements in the list so that we don't erase objects which reside in the same hierarchy
                // as the object on which the erase shape reisdes.
                GameObject pickedGameObject = _circleShape.GetGameObjectPickedByCursor();
                if (!Octave3DWorldBuilder.ActiveInstance.IsPivotWorkingObject(pickedGameObject))
                {
                    GameObject root = Octave3DWorldBuilder.ActiveInstance.GetRoot(pickedGameObject);
                    if (pickedGameObject != null && root != null)
                    {
                        Transform parentTransform = root.transform;
                        objectsForEraseOperation.RemoveAll(item => item.transform.IsChildOf(parentTransform));
                    }
                }
            }

            return(objectsForEraseOperation);
        }