コード例 #1
0
ファイル: Package.cs プロジェクト: kiki-zhang/Dynamo
 private void LoadCustomNodesIntoDynamo(CustomNodeManager loader, bool isTestMode)
 {
     foreach (var info in loader.AddUninitializedCustomNodesInPath(CustomNodeDirectory, isTestMode))
     {
         LoadedCustomNodes.Add(info);
     }
 }
コード例 #2
0
 /// <summary>
 /// This method is called when custom nodes and packages need to be reloaded if there are new package paths.
 /// </summary>
 /// <param name="loadPackageParams"></param>
 /// <param name="customNodeManager"></param>
 public void LoadCustomNodesAndPackages(LoadPackageParams loadPackageParams, CustomNodeManager customNodeManager)
 {
     foreach (var path in loadPackageParams.Preferences.CustomPackageFolders)
     {
         customNodeManager.AddUninitializedCustomNodesInPath(path, false, false);
     }
     LoadAll(loadPackageParams);
 }
コード例 #3
0
        internal void RefreshCustomNodesFromDirectory(CustomNodeManager customNodeManager, bool isTestMode)
        {
            LoadedCustomNodes.Clear();

            foreach (var x in customNodeManager.AddUninitializedCustomNodesInPath(CustomNodeDirectory, isTestMode))
            {
                LoadedCustomNodes.Add(x);
            }
        }
コード例 #4
0
 public void LoadCustomNodesAndPackages(LoadPackageParams loadPackageParams, CustomNodeManager customNodeManager)
 {
     foreach (var path in loadPackageParams.Preferences.CustomPackageFolders)
     {
         customNodeManager.AddUninitializedCustomNodesInPath(path, false);
         if (!this.packagesDirectories.Contains(path))
         {
             this.packagesDirectories.Add(path);
         }
     }
 }
コード例 #5
0
        internal void RefreshCustomNodesFromDirectory(CustomNodeManager customNodeManager, bool isTestMode)
        {
            LoadedCustomNodes.Clear();

            var reloadedCustomNodes = customNodeManager.AddUninitializedCustomNodesInPath(
                CustomNodeDirectory,
                isTestMode,
                new PackageInfo(Name, new Version(versionName)));

            foreach (var x in reloadedCustomNodes)
            {
                LoadedCustomNodes.Add(x);
            }
        }
コード例 #6
0
        /// <summary>
        /// Helper function to load new custom nodes and packages.
        /// </summary>
        /// <param name="newPaths">New package paths to load custom nodes and packages from.</param>
        /// <param name="preferences">Can be a temporary local preferences object.</param>
        /// <param name="customNodeManager"></param>
        private void LoadCustomNodesAndPackagesHelper(IEnumerable <string> newPaths, IPreferences preferences,
                                                      CustomNodeManager customNodeManager)
        {
            foreach (var path in preferences.CustomPackageFolders)
            {
                // Append the definitions subdirectory for custom nodes.
                var dir = path == DynamoModel.BuiltInPackagesToken ? PathManager.BuiltinPackagesDirectory : path;
                dir = TransformPath(dir, PathManager.DefinitionsDirectoryName);

                customNodeManager.AddUninitializedCustomNodesInPath(dir, false, false);
            }
            foreach (var path in newPaths)
            {
                if (DynamoModel.IsDisabledPath(path, preferences))
                {
                    Log(string.Format(Resources.PackagesDirectorySkipped, path));
                    continue;
                }
                else
                {
                    ScanPackageDirectories(path, preferences);
                }
            }

            if (pathManager != null)
            {
                foreach (var pkg in LocalPackages)
                {
                    if (Directory.Exists(pkg.BinaryDirectory))
                    {
                        pathManager.AddResolutionPath(pkg.BinaryDirectory);
                    }
                }
            }

            if (LocalPackages.Any())
            {
                // Load only those recently addeed local packages (that are located in any of the new paths)
                var newPackages = LocalPackages.Where(x => newPaths.Any(y => x.RootDirectory.Contains(y)));
                LoadPackages(newPackages);
            }
        }
コード例 #7
0
        // Use this for initialization
        void Start()
        {
            WorkModels       = new List <GraphModel>();
            LoadedNodeModels = new List <Type>();
            LoadedFunctions  = new Dictionary <string, FunctionDescription>();
            //create a nodeModelloader for this instance of appmodel
            var nodeloaderinst   = new NodeModelLoader();
            var ZTnodeloaderinst = new ZTsubsetLoader();


            //on program start, we load a home screen into the main canvas
            //var maincanvas = GameObject.Find("Canvas");
            //the home screen comtains, run, save(possibly), and the library component

            //TODO for now find the object, but we should load it here instead
            var homescreen = GameObject.Find("HomeCanvas");

            NodeLibrary           = homescreen.GetComponentInChildren <Library>();
            this.PropertyChanged += NodeLibrary.HandleAppModelChanges;

            LoadedNodeModels = nodeloaderinst.LoadNodeModels("Nodes", true);
            Debug.Log("loaded " + LoadedNodeModels.Count.ToString() + " nodes");

            LoadedNodeModels = LoadedNodeModels.Concat(ZTnodeloaderinst.LoadNodeModels("ZTNodes", false)).ToList();
            Debug.Log("loaded " + LoadedNodeModels.Count.ToString() + " nodes");

            LoadedFunctions = LoadedFunctions.Concat(ZTnodeloaderinst.functions).ToDictionary(x => x.Key, x => x.Value);
            Debug.Log("loaded " + LoadedFunctions.Keys.Count.ToString() + " function pointers");
            //the load screen will have some callbacks here that create graphmodels
            // either by loading them and passing the string to parse back, or by creating a new one
            CollapsedCustomGraphNodeManager              = new CustomNodeManager(this);
            CollapsedCustomGraphNodeManager.InfoUpdated += HandleInfoUpdated;
            CollapsedCustomGraphNodeManager.AddUninitializedCustomNodesInPath(Path.Combine(Application.dataPath, "testGraphs/customnodes"), false);
            Debug.Log("loaded " + CollapsedCustomGraphNodeManager.LoadedDefinitions.Count().ToString() + "cusotm node functions");
            //TODO inspect logic for firing repopulation of library...
        }