Exemplo n.º 1
0
        void OnEnable()
        {
            if (!editObject)
            {
                editObject = ((PrimitivesPro.MeshEditor.MeshEditorObject) target);
            }

            if (!editObject)
            {
                Instance = null;
                return;
            }

            editObject.Init();

            if (Toolbar.Instance)
            {
                selectionType = Toolbar.Instance.MeshSelection;
            }

            vertexSelection = new HashSet<int>();
            faceSelection = new HashSet<PPMesh.Face>();
            edgeSelection = new HashSet<PPMesh.HalfEdge>();

			settings = new MeshEditorSettings();
			settings.Deserialize();

            if (grid == null)
            {
                grid = new Grid(settings);
            }

            editCommand = new EditCommand
            {
                Command = EditCommand.CommandType.None,
                Face = null
            };

            defaultTool = Tools.current;
            if (defaultTool == Tool.None)
            {
                defaultTool = Tool.Move;
            }

            handlesRotation = Quaternion.identity;

            Instance = this;
        }