static OnCompileHandler()
 {
     VRCInterface.OnCompile();
     Config.OnCompile();
     ModuleHandler.OnCompile();
     Helper.TashHandler.EmptyThryTrash();
 }
Example #2
0
 private static void CheckVRCSDK()
 {
     if (!Settings.is_changing_vrc_sdk)
     {
         Helper.SetDefineSymbol(DEFINE_SYMBOLE_VRC_SDK_INSTALLED, VRCInterface.Get().sdk_is_installed);
     }
 }
Example #3
0
 private void GUIVRC()
 {
     if (VRCInterface.Get().sdk_information.type != VRCInterface.VRC_SDK_Type.NONE)
     {
         GUILayout.BeginHorizontal();
         string sdkUptodateString = (VRCInterface.Get().sdk_information.is_sdk_up_to_date ? " (" + Locale.editor.Get("newest") + " " + Locale.editor.Get("version") + ")" : "");
         GUILayout.Label("VRC Sdk " + Locale.editor.Get("version") + ": " + VRCInterface.Get().sdk_information.installed_version + sdkUptodateString);
         RemoveVRCSDKButton();
         GUILayout.EndHorizontal();
         if (!VRCInterface.Get().sdk_information.is_sdk_up_to_date)
         {
             GUILayout.Label(Locale.editor.Get("newest") + " VRC SDK " + Locale.editor.Get("version") + ": " + VRCInterface.Get().sdk_information.available_version);
             UpdateVRCSDKButton();
         }
         if (VRCInterface.Get().sdk_information.is_user_logged_in)
         {
             GUILayout.Label("VRChat " + Locale.editor.Get("user") + ": " + EditorPrefs.GetString("sdk#username"));
         }
     }
     else
     {
         InstallVRCSDKButton();
     }
     drawLine();
 }
Example #4
0
        void InitVRCSDKVersion()
        {
            if (VRCInterface.Get().Sdk_information.type == VRCInterface.VRC_SDK_Type.NONE)
            {
                _constantValue = false;
                return;
            }
            int c_vrc = Helper.CompareVersions(VRCInterface.Get().Sdk_information.installed_version, _value);

            if (_compareType == CompareType.EQUAL)
            {
                _constantValue = c_vrc == 0;
            }
            if (_compareType == CompareType.NOT_EQUAL)
            {
                _constantValue = c_vrc != 0;
            }
            if (_compareType == CompareType.SMALLER)
            {
                _constantValue = c_vrc == 1;
            }
            if (_compareType == CompareType.BIGGER)
            {
                _constantValue = c_vrc == -1;
            }
            if (_compareType == CompareType.BIGGER_EQ)
            {
                _constantValue = c_vrc == -1 || c_vrc == 0;
            }
            if (_compareType == CompareType.SMALLER_EQ)
            {
                _constantValue = c_vrc == 1 || c_vrc == 0;
            }
        }
Example #5
0
 public static VRCInterface Get()
 {
     if (instance == null)
     {
         instance = new VRCInterface();
     }
     return(instance);
 }
Example #6
0
 private void UpdateVRCSDKButton()
 {
     EditorGUI.BeginDisabledGroup(is_changing_vrc_sdk);
     if (GUILayout.Button("Update VRC SDK"))
     {
         is_changing_vrc_sdk = true;
         VRCInterface.Get().UpdateVRCSDK();
     }
     EditorGUI.EndDisabledGroup();
 }
Example #7
0
 private void RemoveVRCSDKButton()
 {
     EditorGUI.BeginDisabledGroup(is_changing_vrc_sdk);
     if (GUILayout.Button(Locale.editor.Get("button_remove_vrc_sdk"), GUILayout.ExpandWidth(false)))
     {
         is_changing_vrc_sdk = true;
         VRCInterface.RemoveVRCSDK();
     }
     EditorGUI.EndDisabledGroup();
 }
Example #8
0
 private void UpdateVRCSDKButton()
 {
     EditorGUI.BeginDisabledGroup(is_changing_vrc_sdk);
     if (GUILayout.Button(Locale.editor.Get("button_update_vrc_sdk")))
     {
         is_changing_vrc_sdk = true;
         VRCInterface.UpdateVRCSDK();
     }
     EditorGUI.EndDisabledGroup();
 }
Example #9
0
 private void RemoveVRCSDKButton()
 {
     EditorGUI.BeginDisabledGroup(is_changing_vrc_sdk);
     if (GUILayout.Button("Remove VRC SDK", GUILayout.ExpandWidth(false)))
     {
         is_changing_vrc_sdk = true;
         VRCInterface.Get().RemoveVRCSDK(true);
     }
     EditorGUI.EndDisabledGroup();
 }
Example #10
0
 private void InstallVRCSDKButton()
 {
     EditorGUI.BeginDisabledGroup(is_changing_vrc_sdk);
     if (GUILayout.Button("Install VRC SDK"))
     {
         is_changing_vrc_sdk = true;
         VRCInterface.DownloadAndInstallVRCSDK();
     }
     EditorGUI.EndDisabledGroup();
 }
Example #11
0
        public override void OnGUI(MaterialEditor materialEditor, MaterialProperty[] props)
        {
            IsDrawing = true;
            //Init
            bool reloadUI = _isFirstOnGUICall || (_doReloadNextDraw && Event.current.type == EventType.Layout) || (materialEditor.target as Material).shader != Shader;

            if (reloadUI)
            {
                InitEditorData(materialEditor);
                Properties = props;
                InitlizeThryUI();
            }

            //Update Data
            Properties = props;
            Shader     = Materials[0].shader;
            Input.Update(IsLockedMaterial);
            ActiveRenderer    = Selection.activeTransform?.GetComponent <Renderer>();
            IsInAnimationMode = AnimationMode.InAnimationMode();

            Active = this;

            GUIManualReloadButton();
            GUIShaderVersioning();

            GUITopBar();
            GUISearchBar();
            Presets.PresetEditorGUI(this);
            ShaderTranslator.SuggestedTranslationButtonGUI(this);

            //PROPERTIES
            foreach (ShaderPart part in MainGroup.parts)
            {
                part.Draw();
            }

            //Render Queue selection
            if (VRCInterface.IsVRCSDKInstalled())
            {
                _vRCFallbackProperty.Draw();
            }
            if (Config.Singleton.showRenderQueue)
            {
                _renderQueueProperty.Draw();
            }

            BetterTooltips.DrawActive();

            GUIFooters();

            HandleEvents();

            IsDrawing = false;
        }
Example #12
0
        static OnCompileHandler()
        {
            //Init Editor Variables with paths
            ThryEditor.GetThryEditorDirectoryPath();

            VRCInterface.OnCompile();
            Config.OnCompile();
            ModuleHandler.OnCompile();
            TrashHandler.EmptyThryTrash();

            UnityFixer.CheckAPICompatibility(); //check that Net_2.0 is ApiLevel
            UnityFixer.CheckDrawingDll();       //check that drawing.dll is imported
        }
Example #13
0
 private static void AssetsDeleted(string[] assets)
 {
     VRCInterface.SetVRCDefineSybolIfSDKDeleted(assets);
     ShaderHelper.AssetsDeleted(assets);
     UnityFixer.OnAssetDeleteCheckDrawingDLL(assets);
     if (CheckForEditorRemove(assets))
     {
         Debug.Log("ThryEditor is being deleted.");
         Config.Get().verion = "0";
         Config.Get().save();
         ModuleHandler.OnEditorRemove();
     }
 }
Example #14
0
 private void InstallVRCSDKButton()
 {
     EditorGUI.BeginDisabledGroup(is_changing_vrc_sdk);
     GUILayout.BeginHorizontal();
     if (GUILayout.Button(Locale.editor.Get("button_install_vrc_sdk") + "(v2)(Avatars)"))
     {
         is_changing_vrc_sdk = true;
         VRCInterface.DownloadAndInstallVRCSDK(VRCInterface.VRC_SDK_Type.SDK_2);
     }
     if (GUILayout.Button(Locale.editor.Get("button_install_vrc_sdk") + "(v3)(Udon)"))
     {
         is_changing_vrc_sdk = true;
         VRCInterface.DownloadAndInstallVRCSDK(VRCInterface.VRC_SDK_Type.SDK_3);
     }
     GUILayout.EndHorizontal();
     EditorGUI.EndDisabledGroup();
 }
Example #15
0
        private static void CheckVRCSDK(string[] importedAssets)
        {
            bool vrcImported = false;

            foreach (string s in importedAssets)
            {
                if (s.Contains("VRCSDK2.dll"))
                {
                    vrcImported = true;
                }
            }

            bool currently_deleteing_sdk = (Helper.LoadValueFromFile("delete_vrc_sdk", ".thry_after_compile_data") == "true");

            if (!Settings.is_changing_vrc_sdk && !currently_deleteing_sdk)
            {
                Helper.SetDefineSymbol(DEFINE_SYMBOLE_VRC_SDK_INSTALLED, VRCInterface.Get().sdk_is_installed | vrcImported);
            }
        }
Example #16
0
 private void GUIVRC()
 {
     if (VRCInterface.Get().sdk_is_installed)
     {
         GUILayout.BeginHorizontal();
         GUILayout.Label("VRC Sdk " + Locale.editor.Get("version") + ": " + VRCInterface.Get().installed_sdk_version + (VRCInterface.Get().sdk_is_up_to_date ? " (" + Locale.editor.Get("newest") + " " + Locale.editor.Get("version") + ")(not reliably reported in 2018)" : ""));
         RemoveVRCSDKButton();
         GUILayout.EndHorizontal();
         if (!VRCInterface.Get().sdk_is_up_to_date)
         {
             GUILayout.Label(Locale.editor.Get("newest") + " VRC SDK " + Locale.editor.Get("version") + ": " + VRCInterface.Get().newest_sdk_version);
             UpdateVRCSDKButton();
         }
         if (VRCInterface.Get().user_logged_in)
         {
             GUILayout.Label("VRChat " + Locale.editor.Get("user") + ": " + EditorPrefs.GetString("sdk#username"));
         }
     }
     else
     {
         InstallVRCSDKButton();
     }
     drawLine();
 }
Example #17
0
 private void GUIVRC()
 {
     if (VRCInterface.Get().sdk_is_installed)
     {
         GUILayout.BeginHorizontal();
         GUILayout.Label("VRC Sdk version: " + VRCInterface.Get().installed_sdk_version + (VRCInterface.Get().sdk_is_up_to_date ? " (newest version)" : ""));
         RemoveVRCSDKButton();
         GUILayout.EndHorizontal();
         if (!VRCInterface.Get().sdk_is_up_to_date)
         {
             GUILayout.Label("Newest VRC SDK version: " + VRCInterface.Get().newest_sdk_version);
             UpdateVRCSDKButton();
         }
         if (VRCInterface.Get().user_logged_in)
         {
             GUILayout.Label("VRChat user: "******"sdk#username"));
         }
     }
     else
     {
         InstallVRCSDKButton();
     }
     drawLine();
 }
        public bool Test()
        {
            string comparator = GetComparetor();

            string[] parts = Regex.Split(data, comparator);
            string   obj   = parts[0];
            string   value = parts[parts.Length - 1];

            switch (type)
            {
            case DefineableConditionType.PROPERTY_BOOL:
                ThryEditor.ShaderProperty prop = ThryEditor.currentlyDrawing.propertyDictionary[obj];
                if (prop == null)
                {
                    return(false);
                }
                if (comparator == "##")
                {
                    return(prop.materialProperty.floatValue == 1);
                }
                if (comparator == "==")
                {
                    return("" + prop.materialProperty.floatValue == parts[1]);
                }
                if (comparator == "!=")
                {
                    return("" + prop.materialProperty.floatValue != parts[1]);
                }
                break;

            case DefineableConditionType.EDITOR_VERSION:
                int c_ev = Helper.compareVersions(Config.Get().verion, value);
                if (comparator == "==")
                {
                    return(c_ev == 0);
                }
                if (comparator == "!=")
                {
                    return(c_ev != 0);
                }
                if (comparator == "<")
                {
                    return(c_ev == 1);
                }
                if (comparator == ">")
                {
                    return(c_ev == -1);
                }
                break;

            case DefineableConditionType.VRC_SDK_VERSION:
                int c_vrc = Helper.compareVersions(VRCInterface.Get().installed_sdk_version, value);
                if (comparator == "==")
                {
                    return(c_vrc == 0);
                }
                if (comparator == "!=")
                {
                    return(c_vrc != 0);
                }
                if (comparator == "<")
                {
                    return(c_vrc == 1);
                }
                if (comparator == ">")
                {
                    return(c_vrc == -1);
                }
                break;

            case DefineableConditionType.AND:
                if (condition1 != null && condition2 != null)
                {
                    return(condition1.Test() && condition2.Test());
                }
                break;

            case DefineableConditionType.OR:
                if (condition1 != null && condition2 != null)
                {
                    return(condition1.Test() || condition2.Test());
                }
                break;
            }

            return(true);
        }
Example #19
0
 public static void Update()
 {
     instance = new VRCInterface();
 }
Example #20
0
        public bool Test()
        {
            switch (type)
            {
            case DefineableConditionType.NONE:
                return(true);

            case DefineableConditionType.TRUE:
                return(true);

            case DefineableConditionType.FALSE:
                return(false);
            }
            string comparator = GetComparetor();

            string[] parts = Regex.Split(data, comparator);
            string   obj   = parts[0];
            string   value = parts[parts.Length - 1];

            switch (type)
            {
            case DefineableConditionType.PROPERTY_BOOL:
                ShaderProperty prop = ShaderEditor.active.propertyDictionary[obj];
                if (prop == null)
                {
                    return(false);
                }
                if (comparator == "##")
                {
                    return(prop.materialProperty.floatValue == 1);
                }
                float f = Parser.ParseFloat(parts[1]);
                if (comparator == "==")
                {
                    return(prop.materialProperty.floatValue == f);
                }
                if (comparator == "!=")
                {
                    return(prop.materialProperty.floatValue != f);
                }
                if (comparator == "<")
                {
                    return(prop.materialProperty.floatValue < f);
                }
                if (comparator == ">")
                {
                    return(prop.materialProperty.floatValue > f);
                }
                if (comparator == ">=")
                {
                    return(prop.materialProperty.floatValue >= f);
                }
                if (comparator == "<=")
                {
                    return(prop.materialProperty.floatValue <= f);
                }
                break;

            case DefineableConditionType.EDITOR_VERSION:
                int c_ev = Helper.compareVersions(Config.Singleton.verion, value);
                if (comparator == "==")
                {
                    return(c_ev == 0);
                }
                if (comparator == "!=")
                {
                    return(c_ev != 0);
                }
                if (comparator == "<")
                {
                    return(c_ev == 1);
                }
                if (comparator == ">")
                {
                    return(c_ev == -1);
                }
                if (comparator == ">=")
                {
                    return(c_ev == -1 || c_ev == 0);
                }
                if (comparator == "<=")
                {
                    return(c_ev == 1 || c_ev == 0);
                }
                break;

            case DefineableConditionType.VRC_SDK_VERSION:
                if (VRCInterface.Get().sdk_information.type == VRCInterface.VRC_SDK_Type.NONE)
                {
                    return(false);
                }
                int c_vrc = Helper.compareVersions(VRCInterface.Get().sdk_information.installed_version, value);
                if (comparator == "==")
                {
                    return(c_vrc == 0);
                }
                if (comparator == "!=")
                {
                    return(c_vrc != 0);
                }
                if (comparator == "<")
                {
                    return(c_vrc == 1);
                }
                if (comparator == ">")
                {
                    return(c_vrc == -1);
                }
                if (comparator == ">=")
                {
                    return(c_vrc == -1 || c_vrc == 0);
                }
                if (comparator == "<=")
                {
                    return(c_vrc == 1 || c_vrc == 0);
                }
                break;

            case DefineableConditionType.TEXTURE_SET:
                ShaderProperty shaderProperty = ShaderEditor.active.propertyDictionary[data];
                if (shaderProperty == null)
                {
                    return(false);
                }
                return(shaderProperty.materialProperty.textureValue != null);

            case DefineableConditionType.DROPDOWN:
                ShaderProperty dropdownProperty = ShaderEditor.active.propertyDictionary[obj];
                if (dropdownProperty == null)
                {
                    return(false);
                }
                if (comparator == "##")
                {
                    return(dropdownProperty.materialProperty.floatValue == 1);
                }
                if (comparator == "==")
                {
                    return("" + dropdownProperty.materialProperty.floatValue == parts[1]);
                }
                if (comparator == "!=")
                {
                    return("" + dropdownProperty.materialProperty.floatValue != parts[1]);
                }
                break;

            case DefineableConditionType.AND:
                if (condition1 != null && condition2 != null)
                {
                    return(condition1.Test() && condition2.Test());
                }
                break;

            case DefineableConditionType.OR:
                if (condition1 != null && condition2 != null)
                {
                    return(condition1.Test() || condition2.Test());
                }
                break;
            }

            return(true);
        }
Example #21
0
 private static void AssetsImported(string[] assets)
 {
     VRCInterface.SetVRCDefineSybolIfSDKImported(assets);
     ShaderHelper.AssetsImported(assets);
 }
 public static void UpdateVRCSDK()
 {
     FileHelper.SaveValueToFile("update_vrc_sdk", "true", PATH.AFTER_COMPILE_DATA);
     FileHelper.SaveValueToFile("update_vrc_sdk_type", "" + (int)VRCInterface.Get().GetInstalledSDKType(), PATH.AFTER_COMPILE_DATA);
     RemoveVRCSDK();
 }
Example #23
0
 static void OnPostprocessAllAssets(string[] importedAssets, string[] deletedAssets, string[] movedAssets, string[] movedFromAssetPaths)
 {
     CheckVRCSDK(importedAssets);
     VRCInterface.Update();
 }