Пример #1
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);
 }
Пример #2
0
        protected override VisualElement CreateSettingsView()
        {
            var sv = base.CreateSettingsView();

            OutputDimension currentDim = nodeTarget.rtSettings.dimension;

            settingsView.RegisterChangedCallback(() => {
                // Reflect the changes on the graph output texture but not on the asset to avoid stalls.
                graph.UpdateOutputTextures();
                RefreshOutputPortSettings();

                // When the dimension is updated, we need to update all the node ports in the graph
                var newDim = nodeTarget.rtSettings.dimension;
                if (currentDim != newDim)
                {
                    // We delay the port refresh to let the settings finish it's update
                    schedule.Execute(() => {
                        owner.ProcessGraph();
                        // Refresh ports on all the nodes in the graph
                        foreach (var nodeView in owner.nodeViews)
                        {
                            nodeView.nodeTarget.UpdateAllPortsLocal();
                            nodeView.RefreshPorts();
                        }
                    }).ExecuteLater(1);
                    currentDim = newDim;
                    NodeProvider.LoadGraph(graph);
                }
                else
                {
                    schedule.Execute(() => {
                        owner.ProcessGraph();
                    }).ExecuteLater(1);
                }
            });

            return(sv);
        }