Esempio n. 1
0
 /**
  * true iff model successfully written
  */
 public bool SaveModel(string path)
 {
     if (!FileSystemOps.PathIsValid(path))
     {
         return(false);
     }
     ImporterOps.ExportModel(path, 1);
     updateLog();
     return(true);
 }
Esempio n. 2
0
        /*
         * private void readMeshFields(int meshIdx)
         * {
         *      if (meshIdx < 0)
         *      {
         *              return;
         *      }
         *      DiffuseColorBox.SetValues(LColor.FromNativeArray(NativeFunctions.GetMeshMaterialDiffuseColor(1, meshIdx)));
         *      SpecularColorBox.SetValues(LColor.FromNativeArray(NativeFunctions.GetMeshMaterialSpecularColor(1, meshIdx)));
         *      EmissiveColorBox.SetValues(LColor.FromNativeArray(NativeFunctions.GetMeshMaterialEmissiveColor(1, meshIdx)));
         *
         *      DiffuseTexGUIDBox.Text = NativeFunctions.GetMeshMaterialDiffuseMapGUID(1, meshIdx);
         *      SpecularTexGUIDBox.Text = NativeFunctions.GetMeshMaterialSpecularMapGUID(1, meshIdx);
         *      NormalMapGUIDBox.Text = NativeFunctions.GetMeshMaterialDiffuseMapGUID(1, meshIdx);
         *      GlowMapGUIDBox.Text = NativeFunctions.GetMeshMaterialEmissiveMapGUID(1, meshIdx);
         * }
         *
         * private void populateMeshSubsec(int numMeshes)
         * {
         *      selectorElems.Clear();
         *      for (int i = 0; i < numMeshes; ++i)
         *      {
         *              selectorElems.Add(i);
         *      }
         *      MeshSelector.SelectedIndex = 0;
         *      readMeshFields(MeshSelector.SelectedIndex);
         * }
         *
         * private void populateEditorFields()
         * {
         *      if (NativeFunctions.GetNumModelsLoaded() > 0)
         *      {
         *              Vector3 aabbBnd = Vector3.FromNativeArray(NativeFunctions.GetModelAABBBounds(1));
         *              float bndRad = NativeFunctions.GetModelRadius(1);
         *              int numMeshes = NativeFunctions.GetMeshCount(1);
         *
         *              AABBBoundsBox.SetValues(aabbBnd);
         *              BoundingRadiusBox.Text = bndRad.ToString();
         *
         *              populateMeshSubsec(numMeshes);
         *      }
         * }
         */

        /**
         * Return value is an enum; its values are self explanatory
         */
        public async Task <OpenFSElemResult> OpenFSElement(FileSystemInfo elem)
        {
            if (elem != null)
            {
                if (FileSystemOps.IsDirectory(elem))
                {
                    //move into the directory
                    cwd = new DirectoryInfo(elem.FullName);
                    //refreshWindow();
                    updateLog();
                    return(OpenFSElemResult.DirectoryChanged);
                }
                //else it must be some kind of file.
                //may need to reset the loaded model,
                //or (in the future) ask the user
                //if they want to export the current model.
                //check file:
                //is it a .lmdl?
                openedFileName = elem.Name;
                if (elem.Extension.Equals(FileFilters.EngineModel))
                {
                    //...have to quit, since there's no exposed function for
                    //LOADING a .lmdl.
                    updateLog();
                    isModelLoaded = true;
                    return(OpenFSElemResult.FileOpened);
                }
                else
                {
                    //try importing it?
                    int modelIdx = await ImporterOps.ImportModelAsync(elem.FullName, fileProgress);

                    if (modelIdx < 0)
                    {
                        //import failed!
                        openedFileName = "";
                        updateLog();
                        return(OpenFSElemResult.Failure);
                    }
                    buildModelInfo(modelIdx, currVer);
                    updateLog();
                    isModelLoaded = true;
                    return(OpenFSElemResult.FileOpened);
                }
            }
            return(OpenFSElemResult.NoAction);
        }