Beispiel #1
0
 private static void ExportSceneAndPrepareForUpload(string customNamespace = null)
 {
     try
     {
         if (shouldBuildUnityPackage)
         {
             AssetExporter.ExportCurrentSceneAsUnityPackage();
         }
         else
         {
             AssetExporter.CleanupUnityPackageExport();
         }
         if (ExportSceneResource(customNamespace))
         {
             if (!APIUser.get_CurrentUser().get_hasScriptingAccess() && CustomDLLMaker.CustomScriptsAvailable())
             {
                 CustomDLLMaker.ClearSavedPluginPrefs();
             }
             EditorAssemblies.AddOnAssemblyReloadCallback("CustomDLLMaker", "Cleanup");
             EditorAssemblies.AddOnAssemblyReloadCallback("VRC_SdkBuilder", "UploadLastExportedSceneBlueprint");
         }
         else
         {
             CustomDLLMaker.ClearSavedPluginPrefs();
             UploadLastExportedSceneBlueprint();
         }
     }
     catch (Exception ex)
     {
         AssetExporter.CleanupTmpFiles();
         EditorAssemblies.ClearAssemblyReloadCallbacks();
         throw ex;
         IL_0083 :;
     }
 }
Beispiel #2
0
    public static bool ConfigureSettings()
    {
        CustomDLLMaker.CreateDirectories();
        if (CheckForFirstInit())
        {
            VRC.AssetExporter.CleanupTmpFiles();
        }

        if (EditorApplication.isPlayingOrWillChangePlaymode || EditorApplication.isUpdating)
        {
            return(false);
        }

        ConfigurePlayerSettings();

        if (!VRC.Core.RemoteConfig.IsInitialized())
        {
            VRC.Core.API.SetOnlineMode(true, "vrchat");
            VRC.Core.RemoteConfig.Init();
        }

        LoadEditorResources();

        return(true);
    }
Beispiel #3
0
 public static bool ExportSceneResource(string customNamespace = null)
 {
     //IL_0015: Unknown result type (might be due to invalid IL or missing references)
     //IL_004e: Unknown result type (might be due to invalid IL or missing references)
     //IL_005f: Unknown result type (might be due to invalid IL or missing references)
     PipelineManager[] array = Object.FindObjectsOfType <PipelineManager>();
     if (array.Length > 0)
     {
         PipelineManager val = array[0];
         val.contentType = 1;
         if (string.IsNullOrEmpty(val.blueprintId))
         {
             val.AssignId();
         }
         EditorPrefs.SetString("lastBuiltAssetBundleBlueprintID", val.blueprintId);
         EditorUtility.SetDirty(array[0]);
         EditorSceneManager.MarkSceneDirty(val.get_gameObject().get_scene());
         EditorSceneManager.SaveScene(val.get_gameObject().get_scene());
     }
     if (CustomDLLMaker.CustomScriptsAvailable())
     {
         ExportCurrentSceneResourceWithPlugin(customNamespace);
         return(true);
     }
     CustomDLLMaker.ClearSavedPluginPrefs();
     AssetExporter.ExportCurrentSceneResource();
     return(false);
 }
Beispiel #4
0
 private static void RecompileSceneScripts()
 {
     if (CustomDLLMaker.CustomScriptsAvailable())
     {
         string @string = EditorPrefs.GetString("lastExternalPluginPath");
         string text    = WWW.UnEscapeURL(EditorPrefs.GetString("lastVRCPath"));
         bool   flag    = false;
         if (string.IsNullOrEmpty(text) || (!string.IsNullOrEmpty(text) && !File.Exists(text)))
         {
             flag = true;
         }
         else if (!string.IsNullOrEmpty(@string) && !File.Exists(@string))
         {
             flag = true;
         }
         if (!flag)
         {
             CustomDLLMaker.BuildAndLoadPlugin(recompileCurrentPlugin: true);
         }
         else
         {
             EditorUtility.DisplayDialog("Could not recompile scripts", "Something went wrong. Please Test/Compile Full Scene (slow)", "OK");
         }
     }
 }
Beispiel #5
0
    public static void RunLastExportedSceneResource()
    {
        string @string = EditorPrefs.GetString("lastExternalPluginPath");
        string string2 = EditorPrefs.GetString("lastVRCPath");
        bool   flag    = false;

        if (string.IsNullOrEmpty(string2) || (!string.IsNullOrEmpty(string2) && !File.Exists(string2)))
        {
            flag = true;
        }
        else if (CustomDLLMaker.CustomScriptsAvailable() && !string.IsNullOrEmpty(@string) && !File.Exists(@string))
        {
            flag = true;
        }
        if (!flag)
        {
            if (CustomDLLMaker.CustomScriptsAvailable())
            {
                RecompileSceneScripts();
            }
            AssetExporter.RunScene(string2, @string);
        }
        else
        {
            EditorUtility.DisplayDialog("Could not run VRChat scene", "Last built VRChat scene could not be found. Please Test/Compile Full Scene (slow).", "OK");
        }
    }
    static EnvConfig()
    {
        CustomDLLMaker.CreateDirectories();
        if (EditorApplication.timeSinceStartup < 30f)
        {
            VRC.AssetExporter.CleanupTmpFiles();
            ConfigurePlayerSettings();
#if !VRC_CLIENT
            SDKUpdater.CheckForUpdates(true);
#endif
        }
    }
Beispiel #7
0
 public static void CleanupTmpFiles()
 {
     if (File.Exists(EditorAssemblies.SERIALIZATION_PATH))
     {
         File.Delete(EditorAssemblies.SERIALIZATION_PATH);
     }
     if (File.Exists(EditorAssemblies.TMP_FILE_PATH))
     {
         File.Delete(EditorAssemblies.TMP_FILE_PATH);
     }
     CustomDLLMaker.Cleanup();
 }
Beispiel #8
0
    void OnGUISceneCheck(VRCSDK2.VRC_SceneDescriptor scene)
    {
        CheckUploadChanges(scene);

        EditorGUILayout.InspectorTitlebar(true, scene.gameObject);

        if (VRC.Core.APIUser.CurrentUser != null && VRC.Core.APIUser.CurrentUser.hasScriptingAccess && !CustomDLLMaker.DoesScriptDirExist())
        {
            CustomDLLMaker.CreateDirectories();
        }

        Vector3 g = Physics.gravity;

        if (g.x != 0.0f || g.z != 0.0f)
        {
            OnGUIWarning(scene, "Gravity vector is not straight down. Though we support different gravity, player orientation is always 'upwards' so things don't always behave as you intend.");
        }
        if (g.y > 0)
        {
            OnGUIWarning(scene, "Gravity vector is not straight down, inverted or zero gravity will make walking extremely difficult.");
        }
        if (g.y == 0)
        {
            OnGUIWarning(scene, "Zero gravity will make walking extremely difficult, though we support different gravity, player orientation is always 'upwards' so this may not have the effect you're looking for.");
        }

        scene.useAssignedLayers = true;
        if (scene.useAssignedLayers)
        {
            if (!UpdateLayers.AreLayersSetup())
            {
                OnGUIWarning(scene, "Layers are not setup properly. Please press the button above.");
            }

            if (UpdateLayers.AreLayersSetup() && !UpdateLayers.IsCollisionLayerMatrixSetup())
            {
                OnGUIWarning(scene, "Physics Collision Layer Matrix is not setup correctly. Please press the button above.");
            }
        }

        // warn those without scripting access if they choose to script locally
        if (VRC.Core.APIUser.CurrentUser != null && !VRC.Core.APIUser.CurrentUser.hasScriptingAccess && CustomDLLMaker.DoesScriptDirExist())
        {
            OnGUIWarning(scene, "Your account does not have permissions to upload custom scripts. You can test locally but need to contact VRChat to publish your world with scripts.");
        }

        // auto create VRCScript dir for those with access
        if (VRC.Core.APIUser.CurrentUser != null && VRC.Core.APIUser.CurrentUser.hasScriptingAccess && !CustomDLLMaker.DoesScriptDirExist())
        {
            CustomDLLMaker.CreateDirectories();
        }
    }
Beispiel #9
0
    public static bool ConfigureSettings()
    {
        CustomDLLMaker.CreateDirectories();
        if (CheckForFirstInit())
        {
            VRC.AssetExporter.CleanupTmpFiles();
        }

        if (EditorApplication.isPlayingOrWillChangePlaymode || EditorApplication.isUpdating)
        {
            return(false);
        }

        ConfigurePlayerSettings();
        return(true);
    }
Beispiel #10
0
 public static void FinishExportCurrentSceneResourceWithPlugin()
 {
     try
     {
         ExportCurrentSceneResource();
         if (!CustomDLLMaker.Cleanup())
         {
             EditorAssemblies.AddOnAssemblyReloadCallback("CustomDLLMaker", "Cleanup");
             EditorAssemblies.ReloadAssemblies();
         }
     }
     catch (Exception ex)
     {
         Debug.LogError((object)(ex.ToString() + "\n" + ex.StackTrace));
         throw ex;
         IL_0047 :;
     }
 }
Beispiel #11
0
        public static void LaunchSceneBlueprintUploader()
        {
            //IL_0043: Unknown result type (might be due to invalid IL or missing references)
            string @string = EditorPrefs.GetString("currentBuildingAssetBundlePath");

            if (!string.IsNullOrEmpty(@string))
            {
                EditorApplication.set_isPlaying(true);
                VRCPipelineManagerEditor.launchedFromSDKPipeline = true;
                PipelineManager[] array = Object.FindObjectsOfType <PipelineManager>();
                if (array.Length > 0)
                {
                    PipelineManager val  = array[0];
                    PipelineSaver   val2 = val.get_gameObject().AddComponent <PipelineSaver>();
                    val2.contentType = 1;
                }
            }
            CustomDLLMaker.Cleanup();
        }
Beispiel #12
0
 public static void UploadLastExportedSceneBlueprint()
 {
     if (VerifyCredentials())
     {
         string @string = EditorPrefs.GetString("lastExternalPluginPath");
         string text    = WWW.UnEscapeURL(EditorPrefs.GetString("lastVRCPath"));
         if (string.IsNullOrEmpty(text) || (!string.IsNullOrEmpty(text) && !File.Exists(text)) || (CustomDLLMaker.CustomScriptsAvailable() && !string.IsNullOrEmpty(@string) && !File.Exists(@string)))
         {
             EditorUtility.DisplayDialog("Could not run VRChat scene", "Last built VRChat scene could not be found. Please Test/Compile Full Scene (slow).", "OK");
         }
         else
         {
             int num = 0;
             if (ValidationHelpers.CheckIfAssetBundleFileTooLarge(1, text, ref num))
             {
                 EditorUtility.DisplayDialog("Could not publish VRChat scene", ValidationHelpers.GetAssetBundleOverSizeLimitMessage(1, num), "OK");
             }
             else
             {
                 EditorPrefs.SetString("currentBuildingAssetBundlePath", text);
                 if (APIUser.get_CurrentUser().get_hasScriptingAccess() && CustomDLLMaker.CustomScriptsAvailable())
                 {
                     EditorPrefs.SetString("externalPluginPath", @string);
                 }
                 else
                 {
                     CustomDLLMaker.ClearSavedPluginPrefs();
                 }
                 if (shouldBuildUnityPackage)
                 {
                     AssetExporter.ExportCurrentSceneAsUnityPackageIfNotExist();
                 }
                 else
                 {
                     AssetExporter.CleanupUnityPackageExport();
                 }
                 AssetExporter.LaunchSceneBlueprintUploader();
             }
         }
     }
 }
Beispiel #13
0
    void OnGUISceneCheck(VRCSDK2.VRC_SceneDescriptor scene)
    {
        CheckUploadChanges(scene);

        EditorGUILayout.InspectorTitlebar(true, scene.gameObject);

        if (VRC.Core.APIUser.CurrentUser != null && VRC.Core.APIUser.CurrentUser.hasScriptingAccess && !CustomDLLMaker.DoesScriptDirExist())
        {
            CustomDLLMaker.CreateDirectories();
        }

        Vector3 g = Physics.gravity;

        if (g.x != 0.0f || g.z != 0.0f)
        {
            OnGUIWarning(scene, "Gravity vector is not straight down. Though we support different gravity, player orientation is always 'upwards' so things don't always behave as you intend.");
        }
        if (g.y > 0)
        {
            OnGUIWarning(scene, "Gravity vector is not straight down, inverted or zero gravity will make walking extremely difficult.");
        }
        if (g.y == 0)
        {
            OnGUIWarning(scene, "Zero gravity will make walking extremely difficult, though we support different gravity, player orientation is always 'upwards' so this may not have the effect you're looking for.");
        }

        #if PLAYMAKER
        if (VRCSDK2.VRC_PlaymakerHelper.ValidatePlaymaker() == false)
        {
            OnGUIError(scene, VRCSDK2.VRC_PlaymakerHelper.GetErrors());
        }
        #endif

        if (!UpdateLayers.AreLayersSetup())
        {
            OnGUIError(scene, "Layers are not yet configured for VRChat. Please press the 'Setup Layers for VRChat' button above to apply layer settings and enable Test/Publish.");
        }

        if (UpdateLayers.AreLayersSetup() && !UpdateLayers.IsCollisionLayerMatrixSetup())
        {
            OnGUIError(scene, "Physics Collision Layer Matrix is not yet configured for VRChat. Please press the 'Setup Collision Layer Matrix for VRChat' button above to apply collision settings and enable Test/Publish.");
        }

        // warn those without scripting access if they choose to script locally
        if (VRC.Core.APIUser.CurrentUser != null && !VRC.Core.APIUser.CurrentUser.hasScriptingAccess && CustomDLLMaker.DoesScriptDirExist())
        {
            OnGUIWarning(scene, "Your account does not have permissions to upload custom scripts. You can test locally but need to contact VRChat to publish your world with scripts.");
        }

        foreach (VRCSDK2.VRC_DataStorage ds in GameObject.FindObjectsOfType <VRCSDK2.VRC_DataStorage>())
        {
            VRCSDK2.VRC_ObjectSync os = ds.GetComponent <VRCSDK2.VRC_ObjectSync>();
            if (os != null && os.SynchronizePhysics)
            {
                OnGUIWarning(scene, ds.name + " has a VRC_DataStorage and VRC_ObjectSync, with SynchronizePhysics enabled.");
            }
        }

        // auto create VRCScript dir for those with access
        if (VRC.Core.APIUser.CurrentUser != null && VRC.Core.APIUser.CurrentUser.hasScriptingAccess && !CustomDLLMaker.DoesScriptDirExist())
        {
            CustomDLLMaker.CreateDirectories();
        }

        if (scene.UpdateTimeInMS < (int)(1000f / 90f * 3f))
        {
            OnGUIWarning(scene, "Room has a very fast update rate; experience may suffer with many users.");
        }
    }
Beispiel #14
0
 private static void ExportCurrentSceneResourceWithPlugin(string customNamespace = null)
 {
     CustomDLLMaker.PrepareSceneForExport(customNamespace);
     EditorAssemblies.AddOnAssemblyReloadCallback("VRC.AssetExporter", "FinishExportCurrentSceneResourceWithPlugin");
 }
Beispiel #15
0
 public static void RunExportedSceneResourceAndCleanupPlugin()
 {
     RunExportedSceneResource();
     CustomDLLMaker.Cleanup();
 }