Example #1
0
 static AssetDeleteResult OnWillDeleteAsset(string assetPath, RemoveAssetOptions options)
 {
     if (AssetWatcher.AssetAtPathIsVsGraphAsset(assetPath))
     {
         Version++;
     }
     return(AssetDeleteResult.DidNotDelete);
 }
Example #2
0
 static AssetMoveResult OnWillMoveAsset(string sourcePath, string destinationPath)
 {
     if (AssetWatcher.AssetAtPathIsVsGraphAsset(sourcePath))
     {
         Version++;
     }
     return(AssetMoveResult.DidNotMove);
 }
        static AssetWatcher()
        {
            s_Instance = new AssetWatcher();
            Instance.m_ProjectAssetPaths = new Dictionary <string, string>();

            var graphAssetGUIDs = AssetDatabase.FindAssets("t:" + typeof(VSGraphAssetModel).Name);

            foreach (var guid in graphAssetGUIDs)
            {
                var path            = AssetDatabase.GUIDToAssetPath(guid);
                var graphAssetModel = AssetDatabase.LoadMainAssetAtPath(path) as GraphAssetModel;
                s_Instance.WatchGraphAssetAtPath(path, graphAssetModel);
            }
            // TODO: be smarter
            AssetDatabase.importPackageCompleted += name =>
            {
                EditorReducers.BuildAll(null);
            };
        }
Example #4
0
        static AssetWatcher()
        {
            s_Instance = new AssetWatcher();
            Instance.m_ProjectAssetPaths = new HashSet <string>();

            var graphAssetGUIDs = AssetDatabase.FindAssets("t:" + typeof(VSGraphAssetModel).Name);

            foreach (var guid in graphAssetGUIDs)
            {
                var assetPath       = AssetDatabase.GUIDToAssetPath(guid);
                var graphAssetModel = AssetDatabase.LoadMainAssetAtPath(assetPath) as VSGraphAssetModel;
                if (graphAssetModel)
                {
                    // HACK: should not hardcode the Script suffix
                    Instance.m_ProjectAssetPaths.Add(assetPath);
                }
            }
            // TODO: be smarter
            AssetDatabase.importPackageCompleted += name =>
            {
                EditorReducers.BuildAll(null);
            };
        }