public void LaunchProjectEditor(ProjectLink project)
        {
            this.Hide();
            Window editorWindowRef = new AssetEditorWindow(project);

            editorWindowRef.Owner = this.Owner;
            editorWindowRef.ShowDialog();
            this.Close();
        }
Exemplo n.º 2
0
        //
        public AssetEditorWindow()
        {
            ProjectLink project = new ProjectLink()
            {
                Src = "C:\\Repos\\TestProject\\TestProject.cceproj",
            };

            CommonInitialize(project);
        }
 public void LoadProject(ProjectLink project, bool AndRun)
 {
     if (project == null || !LoadProject(project.Src) || !AndRun)
     {
         return;
     }
     StatusText = "Project loading...";
     Console.WriteLine("Run project {0}, EngineVersion: {1}\nPath: {2}",
                       project.Name, project.EngineVersion, project.Src);
     OnProjectLoadRequest?.Invoke(project);
 }
Exemplo n.º 4
0
        public AssetEditorModelView(ProjectLink project)
        {
            AssetsManagerInstance.GetManager().RootPath = Path.GetDirectoryName(project.Src);
            //AssetsManagerInstance.GetManager().ImportAsset("PBR/DefferedPBRShader.hlsl", "DefferedPBRShader");
            //AssetsManagerInstance.GetManager().ImportAsset("PBR/DefferedPBRQuadShader.hlsl", "DefferedPBRQuadShader");
            EngineRef = new PreviewEngine();

            EngineRef.OnSetViewsControlsEnabled += (bool zoom, bool yaw, bool pitch, bool viewPos, bool meshType) => {
                ControlsVisibleFlags = new bool[] { zoom, yaw, pitch, viewPos, meshType };
            };
        }
 public LaunchWindowModelView()
 {
     EngineName        = ProjectFilesWorker.Instance.GetEngineName();
     StatusText        = EngineName;
     EngineVersion     = "v" + ProjectFilesWorker.Instance.GetEngineVersion();
     IsNewProjectState = false;
     NewProject        = new ProjectLink()
     {
         Name          = "NewProject",
         EngineVersion = EngineVersion,
         Src           = "",
     };
     ProjectsList = ProjectFilesWorker.Instance.RecentProjectsList;
 }
Exemplo n.º 6
0
        private void CommonInitialize(ProjectLink project)
        {
            AssetsManagerInstance.GetManager().RootPath = Path.GetDirectoryName(project.Src);
            InitializeComponent();
            AssetEditorModelView ModelView = new AssetEditorModelView(project);

            DataContext = ModelView;
            RendererElement.EngineRef = ModelView.EngineRef;
            (AssetsTree.DataContext as AssetsTreeViewModel).OnAssetSelect += ModelView.SetPreviewAsset;
            ModelView.MAMV += (MaterialAssetModelView assetView) => {
                PropertyGridRef.SelectedObject = null;
                PropertyGridRef.SelectedObject = assetView;
            };
        }
        public bool CreateNewProject(string Name, string Location, out ProjectLink project)
        {
            string path = Path.Combine(Location, Name + ".cceproj");

            if (File.Exists(path))
            {
                project = null;
                return(false);
            }

            ProjectData data = new ProjectData()
            {
                Name          = Name,
                EngineVersion = GetEngineVersion(),
            };

            using (StreamWriter file = File.CreateText(path)) {
                JsonSerializer serializer = new JsonSerializer();
                serializer.Serialize(file, data);
            }

            CachedProjectsSrc.Add(path);
            SaveCachedProjectsList();
            project = new ProjectLink()
            {
                Name          = data.Name,
                EngineVersion = data.EngineVersion,
                Src           = path,
            };
            RecentProjectsList.Add(project);

            string sourceDir = Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location);

            sourceDir = Path.Combine(sourceDir, "Assets");
            string targetDir = Path.GetDirectoryName(path);

            targetDir = Path.Combine(targetDir, "Assets");
            Copy(sourceDir, targetDir);

            return(true);
        }
Exemplo n.º 8
0
 public AssetEditorWindow(ProjectLink project)
 {
     CommonInitialize(project);
 }