public override FILEERROR Save(BaseSceneSaver node, Filename name, BaseDocument doc, SCENEFILTER filterflags)
        {
            BaseDocument polyDoc = doc.Polygonize();

            Logger.Debug("Fuseefy Me!");

            SceneContainer root = new SceneContainer()
            {
                Header = new SceneHeader()
                {
                    CreatedBy = "",
                    Generator = "FUSEE Export Plugin for Cinema4D",
                    Version = 1
                },
                Children = FuseefyOb(polyDoc.GetFirstObject())
            };

            var ser = new Serializer();
            using (var file = File.Create(name.GetString()))
            {
                ser.Serialize(file, root);
            }

            return FILEERROR.FILEERROR_NONE;
        }
Esempio n. 2
0
        public override FILEERROR Save(BaseSceneSaver node, Filename name, BaseDocument doc, SCENEFILTER filterflags)
        {
            List<string> textureFiles;
            string fileName = name.GetString();
            string sceneRoot = Path.GetDirectoryName(fileName);
            var root = new FusConverter().FuseefyScene(doc, sceneRoot, out textureFiles);

            var ser = new Serializer();
            using (var file = File.Create(fileName))
            {
                ser.Serialize(file, root);
            }

            return FILEERROR.FILEERROR_NONE;
        }
Esempio n. 3
0
        public override FILEERROR Save(BaseSceneSaver node, Filename name, BaseDocument doc, SCENEFILTER filterflags)
        {
            List <string> textureFiles;
            string        fileName  = name.GetString();
            string        sceneRoot = Path.GetDirectoryName(fileName);
            var           root      = new FusConverter().FuseefyScene(doc, sceneRoot, out textureFiles);

            var ser = new Fusee.Serialization.Serializer();

            using (var file = File.Create(fileName))
            {
                ser.Serialize(file, root);
            }

            return(FILEERROR.FILEERROR_NONE);
        }
Esempio n. 4
0
        public override FILEERROR Save(BaseSceneSaver node, Filename name, BaseDocument doc, SCENEFILTER filterflags)
        {
            if (_newVersionExists)
            {
                if (!C4dApi.QuestionDialog(
                        "A newer version of the FUSEE export plugin is available at fusee3d.org/c4dexporter.\n\n" +
                        "Would you like to \n" +
                        " - complete this export operation using the existing plugin [Yes]\n" +
                        "or\n" +
                        " - cancel this export operation and download the newer version [No]?"))
                {
                    C4dApi.GeOpenHTML("http://fusee3d.org/c4dexporter");
                    return(FILEERROR.FILEERROR_NONE);
                }
                _newVersionExists = false; // stop annoying the user...
            }
            List <string> textureFiles;
            string        htmlFilePath   = name.GetString();
            string        htmlFileDir    = Path.GetDirectoryName(htmlFilePath);
            string        sceneRoot      = Path.Combine(htmlFileDir, "Assets");
            string        fuseePlayerDir = Path.Combine(GetThisPluginPath(), "Viewer");

            DirCopy.DirectoryCopy(fuseePlayerDir, htmlFileDir, true, true);


            string origHtmlFilePath = Path.Combine(htmlFileDir, "SceneViewer.html");

            if (File.Exists(htmlFilePath))
            {
                File.Delete(htmlFilePath);
            }

            File.Move(origHtmlFilePath, htmlFilePath);

            string sceneFileDir  = Path.Combine(htmlFileDir, "Assets");
            string sceneFilePath = Path.Combine(sceneFileDir, "Model.fus");

            var root = new FusConverter().FuseefyScene(doc, sceneFileDir, out textureFiles);

            var ser = new Serializer();

            using (var file = File.Create(sceneFilePath))
            {
                ser.Serialize(file, root);
            }

            for (int i = 0; i < textureFiles.Count; i++)
            {
                textureFiles[i] = Path.Combine("Assets", textureFiles[i]);
            }
            if (textureFiles != null)
            {
                CreateAssetManifest(htmlFileDir, textureFiles);
            }


            StartServer(htmlFileDir);
            C4dApi.GeOpenHTML("http://*****:*****@"C:\Program Files (x86)\Google\Chrome\Application\chrome.exe", "http://localhost:4655/" + Path.GetFileName(htmlFilePath));

            return(FILEERROR.FILEERROR_NONE);
        }
Esempio n. 5
0
        public virtual FILEERROR Load(BaseSceneLoader node, Filename name, BaseDocument doc, SCENEFILTER filterflags, SWIGTYPE_p_String error, BaseThread bt)
        {
            FILEERROR ret = (FILEERROR)C4dApiPINVOKE.SceneLoaderData_Load(swigCPtr, BaseSceneLoader.getCPtr(node), Filename.getCPtr(name), BaseDocument.getCPtr(doc), (int)filterflags, SWIGTYPE_p_String.getCPtr(error), BaseThread.getCPtr(bt));

            if (C4dApiPINVOKE.SWIGPendingException.Pending)
            {
                throw C4dApiPINVOKE.SWIGPendingException.Retrieve();
            }
            return(ret);
        }
Esempio n. 6
0
        public virtual FILEERROR Save(BaseSceneSaver node, Filename name, BaseDocument doc, SCENEFILTER filterflags)
        {
            FILEERROR ret = (FILEERROR)C4dApiPINVOKE.SceneSaverData_Save(swigCPtr, BaseSceneSaver.getCPtr(node), Filename.getCPtr(name), BaseDocument.getCPtr(doc), (int)filterflags);

            if (C4dApiPINVOKE.SWIGPendingException.Pending)
            {
                throw C4dApiPINVOKE.SWIGPendingException.Retrieve();
            }
            return(ret);
        }
Esempio n. 7
0
        public override FILEERROR Save(BaseSceneSaver node, Filename name, BaseDocument doc, SCENEFILTER filterflags)
        {
            if (_newVersionExists)
            {
                if (!C4dApi.QuestionDialog(
                    "A newer version of the FUSEE export plugin is available at fusee3d.org/c4dexporter.\n\n" +
                    "Would you like to \n" +
                    " - complete this export operation using the existing plugin [Yes]\n" +
                    "or\n" +
                    " - cancel this export operation and download the newer version [No]?"))
                {
                    C4dApi.GeOpenHTML("http://fusee3d.org/c4dexporter");
                    return FILEERROR.FILEERROR_NONE;
                }
                _newVersionExists = false; // stop annoying the user...
            }
            List<string> textureFiles;
            string htmlFilePath = name.GetString();
            string htmlFileDir = Path.GetDirectoryName(htmlFilePath);
            string sceneRoot = Path.Combine(htmlFileDir, "Assets");
            string fuseePlayerDir = Path.Combine(GetThisPluginPath(), "Viewer");

            DirCopy.DirectoryCopy(fuseePlayerDir, htmlFileDir, true, true);

            string origHtmlFilePath = Path.Combine(htmlFileDir, "SceneViewer.html");
            if (File.Exists(htmlFilePath))
                File.Delete(htmlFilePath);

            File.Move(origHtmlFilePath, htmlFilePath);

            string sceneFileDir = Path.Combine(htmlFileDir, "Assets");
            string sceneFilePath = Path.Combine(sceneFileDir,  "Model.fus");

            var root = new FusConverter().FuseefyScene(doc, sceneFileDir, out textureFiles);

            var ser = new Serializer();
            using (var file = File.Create(sceneFilePath))
            {
                ser.Serialize(file, root);
            }

            for (int i = 0; i < textureFiles.Count; i++)
            {
                textureFiles[i] = Path.Combine("Assets", textureFiles[i]);
            }
            if (textureFiles != null)
                CreateAssetManifest(htmlFileDir, textureFiles);

            StartServer(htmlFileDir);
            C4dApi.GeOpenHTML("http://localhost:4655/" + Path.GetFileName(htmlFilePath));

            return FILEERROR.FILEERROR_NONE;
        }
Esempio n. 8
0
 public static bool MergeDocument(BaseDocument doc, SWIGTYPE_p_Filename name, SCENEFILTER loadflags, BaseThread thread) {
   bool ret = C4dApiPINVOKE.MergeDocument(BaseDocument.getCPtr(doc), SWIGTYPE_p_Filename.getCPtr(name), (int)loadflags, BaseThread.getCPtr(thread));
   if (C4dApiPINVOKE.SWIGPendingException.Pending) throw C4dApiPINVOKE.SWIGPendingException.Retrieve();
   return ret;
 }
Esempio n. 9
0
 public static BaseDocument LoadDocument(SWIGTYPE_p_Filename name, SCENEFILTER loadflags, BaseThread thread) {
   IntPtr cPtr = C4dApiPINVOKE.LoadDocument(SWIGTYPE_p_Filename.getCPtr(name), (int)loadflags, BaseThread.getCPtr(thread));
   BaseDocument ret = (cPtr == IntPtr.Zero) ? null : new BaseDocument(cPtr, false);
   if (C4dApiPINVOKE.SWIGPendingException.Pending) throw C4dApiPINVOKE.SWIGPendingException.Retrieve();
   return ret;
 }