Ejemplo n.º 1
0
        public static bool OnBaseGraphOpened(int instanceID, int line)
        {
            var asset = EditorUtility.InstanceIDToObject(instanceID);

            if (asset is Texture)
            {
                // Check if the CustomRenderTexture we're opening is a Mixture graph
                var path    = AssetDatabase.GetAssetPath(EditorUtility.InstanceIDToObject(instanceID));
                var graph   = MixtureEditorUtils.GetGraphAtPath(path);
                var variant = MixtureEditorUtils.GetVariantAtPath(path);

                graph ??= variant?.parentGraph;

                if (graph == null)
                {
                    return(false);
                }

                MixtureGraphWindow.Open(graph);
                return(true);
            }
            else if (asset is MixtureVariant variant)
            {
                MixtureGraphWindow.Open(variant.parentGraph);
            }
            return(false);
        }
Ejemplo n.º 2
0
 public static void ToggleMode(MixtureGraph mixture)
 {
     mixture.isRealtime = !mixture.isRealtime;
     AssetDatabase.SaveAssets();
     mixture.UpdateOutputTexture(true);
     AssetDatabase.ImportAsset(AssetDatabase.GetAssetPath(mixture), ImportAssetOptions.ForceUpdate | ImportAssetOptions.ImportRecursive | ImportAssetOptions.DontDownloadFromCacheServer);
     AssetDatabase.Refresh();
     MixtureGraphWindow.Open(mixture);
 }
Ejemplo n.º 3
0
 public static void ToggleMixtureGraphMode(MixtureGraph mixture)
 {
     mixture.type = mixture.type == MixtureGraphType.Realtime ? MixtureGraphType.Baked : MixtureGraphType.Realtime;
     AssetDatabase.SaveAssets();
     mixture.UpdateOutputTextures();
     mixture.FlushTexturesToDisk();
     AssetDatabase.ImportAsset(AssetDatabase.GetAssetPath(mixture), ImportAssetOptions.ForceUpdate | ImportAssetOptions.ImportRecursive | ImportAssetOptions.DontDownloadFromCacheServer);
     AssetDatabase.Refresh();
     MixtureGraphWindow.Open(mixture);
 }
Ejemplo n.º 4
0
        public static bool OnBaseGraphOpened(int instanceID, int line)
        {
            var asset = EditorUtility.InstanceIDToObject(instanceID);

            if (asset is Texture)
            {
                // Check if the CustomRenderTexture we're opening is a Mixture graph
                var path  = AssetDatabase.GetAssetPath(EditorUtility.InstanceIDToObject(instanceID));
                var graph = AssetDatabase.LoadAllAssetsAtPath(path).FirstOrDefault(o => o is MixtureGraph) as MixtureGraph;

                if (graph == null)
                {
                    return(false);
                }

                MixtureGraphWindow.Open(graph);
                return(true);
            }
            return(false);
        }