public void CreateTestAsset()
        {
            var directoryPath = Path.GetDirectoryName(testAssetName);

            if (!Directory.Exists(directoryPath))
            {
                Directory.CreateDirectory(directoryPath);
            }
            if (File.Exists(testAssetName))
            {
                AssetDatabase.DeleteAsset(testAssetName);
            }

            var asset    = VisualEffectResource.CreateNewAsset(testAssetName);
            var resource = asset.GetResource(); // force resource creation

            m_ViewController = VFXViewController.GetController(resource);
            m_ViewController.useCount++;

            m_StartUndoGroupId = Undo.GetCurrentGroup();


            experimental = EditorPrefs.GetBool(VFXViewPreference.experimentalOperatorKey, false);
            if (!experimental)
            {
                EditorPrefs.SetBool(VFXViewPreference.experimentalOperatorKey, true);
            }
        }
        VFXGraph MakeTemporaryGraph()
        {
            var tempFilePath = MakeTempFilePath("vfx");
            var asset        = VisualEffectResource.CreateNewAsset(tempFilePath);
            var resource     = asset.GetResource(); // force resource creation
            var graph        = ScriptableObject.CreateInstance <VFXGraph>();

            graph.visualEffectResource = resource;

            return(graph);
        }
Exemplo n.º 3
0
        VFXGraph MakeTemporaryGraph()
        {
            if (System.IO.File.Exists(tempFilePath))
            {
                AssetDatabase.DeleteAsset(tempFilePath);
            }

            var asset = VisualEffectResource.CreateNewAsset(tempFilePath);
            VisualEffectResource resource = asset.GetResource(); // force resource creation
            VFXGraph             graph    = ScriptableObject.CreateInstance <VFXGraph>();

            graph.visualEffectResource = resource;
            return(graph);
        }
        VFXGraph MakeTemporaryGraph()
        {
            m_Asset = VisualEffectResource.CreateNewAsset(tempFilePath);
            VisualEffectResource resource = m_Asset.GetResource(); // force resource creation
            VFXGraph graph = ScriptableObject.CreateInstance<VFXGraph>();
            graph.visualEffectResource = resource;

            var window = EditorWindow.GetWindow<VFXViewWindow>();
            window.Close();
            window = EditorWindow.GetWindow<VFXViewWindow>();
            m_ViewController = VFXViewController.GetController(m_Asset.GetResource(), true);
            m_View = window.graphView;
            m_View.controller = m_ViewController;

            return graph;
        }
Exemplo n.º 5
0
        public void CreateTestAsset(string name)
        {
            var filePath      = string.Format(testAssetName, name);
            var directoryPath = Path.GetDirectoryName(filePath);

            if (!Directory.Exists(directoryPath))
            {
                Directory.CreateDirectory(directoryPath);
            }


            m_Asset = VisualEffectResource.CreateNewAsset(filePath);
            VFXViewWindow window = EditorWindow.GetWindow <VFXViewWindow>();

            window.Close();
            window                      = EditorWindow.GetWindow <VFXViewWindow>();
            m_ViewController            = VFXViewController.GetController(m_Asset.GetResource(), true);
            window.graphView.controller = m_ViewController;
        }
        public void CreateTestAsset()
        {
            var directoryPath = Path.GetDirectoryName(testAssetName);

            if (!Directory.Exists(directoryPath))
            {
                Directory.CreateDirectory(directoryPath);
            }
            if (File.Exists(testAssetName))
            {
                AssetDatabase.DeleteAsset(testAssetName);
            }

            VisualEffectAsset    asset    = VisualEffectResource.CreateNewAsset(testAssetName);
            VisualEffectResource resource = asset.GetResource(); // force resource creation

            m_ViewController = VFXViewController.GetController(resource);
            m_ViewController.useCount++;

            m_StartUndoGroupId = Undo.GetCurrentGroup();
        }
Exemplo n.º 7
0
 private VisualEffectAsset CreateAssetAtPath(string path)
 {
     return(VisualEffectResource.CreateNewAsset(path));
 }