Example #1
0
 void Initialize()
 {
     lineButton   = gameObject.GetComponent <Button>();
     buttonText   = lineButton.GetComponentInChildren <Text>();
     buttonColor  = lineButton.GetComponent <Image>().color;
     buttonString = buttonText.text;
     vs           = camera.GetComponent <VertexSelector>();
 }
Example #2
0
 void Start()
 {
     vertexSelector = userObject.GetComponent <VertexSelector>();
     feature        = new Feature();
     attribute      = new AttributesTable();
     fpsCDB         = FilePanelCDB.GetComponent <FilePanel_SelectCDB>();
     cdbDatabase    = fpsCDB.GetCDBDatabase();
     userScript     = userObject.GetComponent <User>();
     SaveToNTS();
 }
 void Start()
 {
     ConsoleRedirector.Apply();
     directoryViewButton.onClick.AddListener(OnClick);
     if (DebugCanvas)
     {
         DebugPanelText = DebugCanvas.transform.Find("DebugPanel").Find("Text").GetComponent <Text>();
     }
     vertexSelector = UserObject.GetComponent <VertexSelector>();
 }
Example #4
0
        public TerrainManipulatorTool(GameController input, GameUI ui, CameraMover camera, IntRect iconRectangle)
            : base(input, iconRectangle)
        {
            this.input        = input;
            this.ui           = ui;
            this.checkBoxes   = new ExclusiveCheckBoxes();
            this.camera       = camera;
            this.manipulators = new Dictionary <UIElement, TerrainManipulator>();
            this.enabled      = false;

            var selectorCheckBox = ui.SelectionBar.CreateCheckBox();

            selectorCheckBox.Name = "Selector";
            selectorCheckBox.SetStyle("VertexHeightToolSelectingBox");

            VertexSelector selector = new VertexSelector(Map, input);

            checkBoxes.AddCheckBox(selectorCheckBox);
            manipulators.Add(selectorCheckBox, selector);

            var moverCheckBox = ui.SelectionBar.CreateCheckBox();

            moverCheckBox.Name = "Mover";
            moverCheckBox.SetStyle("VertexHeightToolMovingBox");

            checkBoxes.AddCheckBox(moverCheckBox);
            manipulators.Add(moverCheckBox, new VertexMover(this, selector, input, Map));


            var tileHeightCheckBox = ui.SelectionBar.CreateCheckBox();

            tileHeightCheckBox.Name = "TileHeight";
            tileHeightCheckBox.SetStyle("TileHeightToolTileHeightBox");

            checkBoxes.AddCheckBox(tileHeightCheckBox);
            manipulators.Add(tileHeightCheckBox, new TileHeightManipulator(input, ui, camera, Map));

            var terrainSmoothingCheckBox = ui.SelectionBar.CreateCheckBox();

            terrainSmoothingCheckBox.Name = "TerrainSmoothing";
            terrainSmoothingCheckBox.SetStyle("TerrainSmoothingToolCheckBox");

            checkBoxes.AddCheckBox(terrainSmoothingCheckBox);
            manipulators.Add(terrainSmoothingCheckBox, new TerrainSmoothingManipulator(input, ui, camera, Map));

            checkBoxes.SelectedChanged += OnToggled;
        }
    static void BoneMode()
    {
        _active = !_active;
        if (_active)
        {
            Transform trans = Selection.activeTransform;
            if (trans == null ||
                trans.GetComponent <MeshRenderer>() == null && trans.GetComponent <SkinnedMeshRenderer>() == null)
            {
                Debug.LogError("Please select some MeshRenderer or SkinnedMeshRenderer");
                _active = false;
                return;
            }
            _selectedTransform = trans;
            _idx = -1;
            VertexSelector com = _selectedTransform.GetOrAddComponent <VertexSelector>();
            EditorApplication.update += Update;
#if DEBUG_VERTEX_SELECTOR
            SceneView view = SceneView.lastActiveSceneView;
            if (null != view)
            {
                _shader = Shader.Find("Hidden/VertexSelector");
                view.SetSceneViewShaderReplace(_shader, null);
            }
#if UNITY_2018_1_OR_NEWER
            EditorApplication.quitting += SceneViewClearSceneView;
#endif
#endif
        }
        else
        {
            _selectedTransform.DestroyComponentImmediate <VertexSelector>();
            EditorApplication.update -= Update;

#if DEBUG_VERTEX_SELECTOR
            SceneViewClearSceneView();
#endif
        }
    }
        public PrimitiveRect(Level pointer, Point createPoint)
            : base(pointer)
        {
            shape = new Rectangle();
            x = createPoint.X;
            y = createPoint.Y;
            w = 0;
            h = 0;
            shape.RenderTransform = new RotateTransform();
            shape.Stroke = new SolidColorBrush((Color)MainWindow.window.lineColorSelect.SelectedColor);
            shape.StrokeThickness = MainWindow.window.lineThickness.SelectedIndex;
            shape.Fill = new SolidColorBrush((Color)MainWindow.window.fillColorSelect.SelectedColor);
            shape.ContextMenu = new ContextMenu();

            MenuItem menuItem1 = new MenuItem();
            menuItem1.Header = "Bring to front";
            menuItem1.Click += delegate { pointer.MovePrimToFront(this); };

            MenuItem menuItem2 = new MenuItem();
            menuItem2.Header = "Bring forward";
            menuItem2.Click += delegate { pointer.MovePrimForward(this); };

            MenuItem menuItem3 = new MenuItem();
            menuItem3.Header = "Bring backward";
            menuItem3.Click += delegate { pointer.MovePrimBackward(this); };

            MenuItem menuItem4 = new MenuItem();
            menuItem4.Header = "Bring to back";
            menuItem4.Click += delegate { pointer.MovePrimToBack(this); };

            shape.ContextMenu.Items.Add(menuItem1);
            shape.ContextMenu.Items.Add(menuItem2);
            shape.ContextMenu.Items.Add(menuItem3);
            shape.ContextMenu.Items.Add(menuItem4);

            //Vertices
            topLeftVS = new VertexSelector(canvas, x, y);
            topRightVS = new VertexSelector(canvas, x, y);
            botLeftVS = new VertexSelector(canvas, x, y);
            botRightVS = new VertexSelector(canvas, x, y);

            topLeftVS.rect.Cursor = Cursors.SizeNWSE;
            topRightVS.rect.Cursor = Cursors.SizeNESW;
            botLeftVS.rect.Cursor = Cursors.SizeNESW;
            botRightVS.rect.Cursor = Cursors.SizeNWSE;

            vertexSelectors.Add(topLeftVS);
            vertexSelectors.Add(topRightVS);
            vertexSelectors.Add(botLeftVS);
            vertexSelectors.Add(botRightVS);

            //Edges
            topES = new EdgeSelector(canvas, 0, 0);
            botES = new EdgeSelector(canvas, 0, 0);
            leftES = new EdgeSelector(canvas, 0, 0);
            rightES = new EdgeSelector(canvas, 0, 0);

            topES.line.Cursor = Cursors.SizeNS;
            botES.line.Cursor = Cursors.SizeNS;
            leftES.line.Cursor = Cursors.SizeWE;
            rightES.line.Cursor = Cursors.SizeWE;

            edgeSelectors.Add(topES);
            edgeSelectors.Add(botES);
            edgeSelectors.Add(leftES);
            edgeSelectors.Add(rightES);

            canvas.Children.Add(shape);
        }