예제 #1
0
        private void publishModel(string zipPath)
        {
            byte[]  data     = File.ReadAllBytes(zipPath);
            WWWForm postForm = new WWWForm();
            Dictionary <string, string> parameters = buildParameterDictWWW();

            foreach (string param in parameters.Keys)
            {
                postForm.AddField(param, parameters[param]);
            }

            postForm.AddBinaryData("modelFile", data, zipPath, "application /zip");
            postForm.AddField("source", "unity-exporter");

            UnityWebRequest ure = UnityWebRequest.Post(SketchfabPlugin.Urls.postModel, postForm);

            ure.SetRequestHeader("Authorization", _logger.getHeader()["Authorization"]);
            SketchfabRequest request = new SketchfabRequest(ure);

            request.setCallback(onModelPublished);
            request.setProgressCallback(handleUploadCallback);
            request.setFailedCallback(handleUploadError);
            _api.registerRequest(request);
            _uploadRequest = request;
        }
예제 #2
0
        void requestArchive()
        {
            SketchfabRequest request = new SketchfabRequest(_archiveUrl);

            request.setCallback(handleArchive);
            request.setProgressCallback(handleDownloadCallback);
            SketchfabPlugin.getAPI().registerRequest(request);
        }
        void requestArchive(string modelUrl)
        {
            SketchfabRequest request = new SketchfabRequest(_currentModel.tempDownloadUrl);

            request.setCallback(handleArchive);
            request.setProgressCallback(handleDownloadCallback);
            SketchfabPlugin.getAPI().registerRequest(request);
        }