コード例 #1
0
ファイル: BehaveMenu.cs プロジェクト: xgrommx/Unity3D
    static void Compile(bool debug)
    {
        BehaveAsset asset = Selection.activeObject as BehaveAsset;

        Compiler.Compile(asset, debug);
        EditorInstance.UpdateCompilerState();
    }
コード例 #2
0
ファイル: EditorTab.cs プロジェクト: LauriM/PropellerEngine
        public EditorTab(EditorView v, EditorInstance i, IntPtr h)
        {
            view = v;
            instance = i;
            handle = h;

            initDone = false;
        }
コード例 #3
0
        /// <summary>
        /// 刷新资源
        /// </summary>
        /// <param name="movedAssetGUIDList">移动资源的GUID,如果移动了资源编辑器需要更新对应的配置里的资源</param>
        public static void RefrshAudioClipSource(List <string> movedAssetGUIDList = null)
        {
            UnLoadAudioClipSource();
            LoadAudioClipSource();

            currentSelectedClipInfo = default(AudioClipInfo);
            currentSelectedConfig   = null;

            AdjustSourceAndConfig(movedAssetGUIDList);
            if (EditorInstance)
            {
                EditorInstance.Repaint();
            }
        }
コード例 #4
0
        public void Save(string filename)
        {
            if (filename == null)
            {
                filename = "";
            }

            filename = filename.Trim();
            filename = filename.ToUpper();

            var terrain = Terrain.Create(filename);

            EditorInstance.RefreshTerrainList();
            EditorInstance.ChangeTerrainSelectedByID(terrain.ID);
        }
コード例 #5
0
        private void openToolStripMenuItem_Click(object sender, EventArgs e)
        {
            OpenFileDialog dialog = new OpenFileDialog();

            dialog.Filter     = @"File Maker XML (*.fmxml)|*.fmxml|All files (*.*)|*.*";
            dialog.DefaultExt = "fmxml";

            switch (dialog.ShowDialog())
            {
            case DialogResult.None:
                return;

            case DialogResult.OK:
                lastFileName = dialog.FileName;
                break;

            case DialogResult.Cancel:
                return;

            case DialogResult.Abort:
                return;

            case DialogResult.Retry:
                return;

            case DialogResult.Ignore:
                return;

            case DialogResult.Yes:
                lastFileName = dialog.FileName;
                break;

            case DialogResult.No:
                return;

            default:
                throw new ArgumentOutOfRangeException();
            }

            m_editorInstance = new EditorInstance(lastFileName, this);
        }
コード例 #6
0
    public override void OnSceneGUI()
    {
        Bounds editBounds       = new Bounds();
        bool   updateVegetation = false;

        _terrain = (Terrain)target;
        int buttonIndex = GetActiveButton();

        Event current          = Event.current;
        int   controlId        = GUIUtility.GetControlID(EditorInstance.GetHashCode(), FocusType.Passive);
        var   currentEventType = current.GetTypeForControl(controlId);

        if (buttonIndex <= 3)
        {
            switch (currentEventType)
            {
            case EventType.MouseDown:
            case EventType.MouseUp:
            case EventType.MouseDrag:
                if (current.button == 0)
                {
                    var        size = EditorPrefs.GetInt("TerrainBrushSize");
                    Ray        ray  = HandleUtility.GUIPointToWorldRay(Event.current.mousePosition);
                    RaycastHit raycastHit;
                    if (_terrain.GetComponent <Collider>().Raycast(ray, out raycastHit, float.PositiveInfinity))
                    {
                        var   pos       = raycastHit.point;
                        float sizeScale = 5f;
                        editBounds       = new Bounds(pos, new Vector3(size * sizeScale, size, size * sizeScale));
                        updateVegetation = true;
                    }
                }
                break;
            }

            if (currentEventType == EventType.MouseDown)
            {
                _combindedBounds = new Bounds(editBounds.center, editBounds.size);
            }
            else if (currentEventType == EventType.MouseDrag || currentEventType == EventType.MouseUp)
            {
                _combindedBounds.Encapsulate(editBounds);
            }
        }

        base.OnSceneGUI();

        if (updateVegetation)
        {
            if (buttonIndex < 3)
            {
                if (currentEventType == EventType.MouseUp)
                {
                    _combindedBounds.Expand(4f);
                    VegetationStudioManager.RefreshTerrainHeightMap(_combindedBounds);
                }
            }
            else
            {
                editBounds.Expand(1f);
                VegetationStudioManager.ClearCache(editBounds);
            }
        }
    }
コード例 #7
0
 protected void RemoveLiveAdornment()
 {
     EditorInstance.VisualElement.Dispatcher.Invoke(() => EditorInstance.GetAdornmentLayer(ContainingLayerName).RemoveAdornmentsByTag(Tag));
     IsAdornmentVisible = false;
 }
コード例 #8
0
 protected void PutLiveAdornment(UIElement adornment)
 {
     EditorInstance.VisualElement.Dispatcher.Invoke(() => EditorInstance.GetAdornmentLayer(ContainingLayerName).AddAdornment(AdornmentPositioningBehavior.ViewportRelative, null, Tag, adornment, (s, a) => { IsAdornmentVisible = false; }));
     IsAdornmentVisible = true;
 }
コード例 #9
0
        protected IAdornmentLayerElement GetLiveAdornment()
        {
            var adornment = EditorInstance.VisualElement.Dispatcher.Invoke(() => EditorInstance.GetAdornmentLayer(ContainingLayerName).Elements.FirstOrDefault(e => e.Tag.Equals(Tag)));

            return(adornment);
        }
コード例 #10
0
 private void MainForm_Load(object sender, EventArgs e)
 {
     m_editorInstance = new EditorInstance(this);
 }
コード例 #11
0
    public override void OnSceneGUI()
    {
        bool LargeTerrain = true;

        Bounds editBounds       = new Bounds();
        bool   updateVegetation = false;

        _terrain = (Terrain)target;
        int buttonIndex = GetActiveButton();

        Event current          = Event.current;
        int   controlId        = GUIUtility.GetControlID(EditorInstance.GetHashCode(), FocusType.Passive);
        var   currentEventType = current.GetTypeForControl(controlId);

        if (buttonIndex <= 3)
        {
            switch (currentEventType)
            {
            case EventType.MouseDown:
            case EventType.MouseUp:
            case EventType.MouseDrag:
                if (current.button == 0)
                {
                    var        size = EditorPrefs.GetInt("TerrainBrushSize");
                    Ray        ray  = HandleUtility.GUIPointToWorldRay(Event.current.mousePosition);
                    RaycastHit raycastHit;
                    if (_terrain.GetComponent <Collider>().Raycast(ray, out raycastHit, float.PositiveInfinity))
                    {
                        var   pos       = raycastHit.point;
                        float sizeScale = 5f;
                        editBounds       = new Bounds(pos, new Vector3(size * sizeScale, size, size * sizeScale));
                        updateVegetation = true;
                    }
                }
                break;
            }

            if (currentEventType == EventType.MouseDown)
            {
                _combindedBounds = new Bounds(editBounds.center, editBounds.size);
            }
            else if (currentEventType == EventType.MouseDrag || currentEventType == EventType.MouseUp)
            {
                _combindedBounds.Encapsulate(editBounds);
            }
            //Handles.color = Color.red;
            //Handles.DrawWireCube(_combindedBounds.center, _combindedBounds.size);
        }

        base.OnSceneGUI();

        if (updateVegetation)
        {
            if (buttonIndex < 3)
            {
                if (LargeTerrain && currentEventType == EventType.MouseUp)
                {
                    _combindedBounds.Expand(4f);
                    if (_terrainSystem && _terrainSystem.AutomaticApply)
                    {
                        _terrainSystem.GenerateTerrainSplatMap(_combindedBounds, true, false);
                    }

                    if (_vegetationSystem)
                    {
                        _vegetationSystem.RefreshHeightMap(_combindedBounds, true, true);
                    }
                }
                else
                {
                    if (!LargeTerrain)
                    {
                        if (_terrainSystem && _terrainSystem.AutomaticApply)
                        {
                            _terrainSystem.GenerateTerrainSplatMap(editBounds, true);
                        }

                        if (_vegetationSystem)
                        {
                            _vegetationSystem.RefreshHeightMap(editBounds, true, true);
                        }
                    }
                }
            }
            else
            {
                editBounds.Expand(1f);
                if (_vegetationSystem)
                {
                    _vegetationSystem.RefreshHeightMap(editBounds, true, false);
                }
            }
        }

        //if (currentEventType == EventType.MouseUp)
        //{
        //    SaveBrushesToDisk();
        //}
    }
コード例 #12
0
 public override void OnInspectorGUI()
 {
     EditorInstance.OnInspectorGUI();
 }