/// <summary> /// Updates the data for this node and triggers updates for any connected output nodes. /// </summary> internal override void Update() { var childFolderArrays = GetInputValues(nameof(_childFolders), new object[] { _childFolders }) .OfType <FolderRef[]>() .ToArray(); TempList.Clear(); for (var i = 0; i < childFolderArrays.Length; i++) { var childFolderArray = childFolderArrays[i]; for (var j = 0; j < childFolderArray.Length; j++) { var childFolderRef = childFolderArray[j]; var newFolderRef = new FolderRef { FolderName = Path.Combine(COCEditorConstants.ASSET_ROOT, childFolderRef.FolderName), ShouldGenerateCodeToGetPath = childFolderRef.ShouldGenerateCodeToGetPath }; TempList.Add(newFolderRef); } } TempList.Sort(); _outputFolders = TempList.ToArray(); // Make base call to trigger update on all output ports base.Update(); }
/// <summary> /// Updates the data for this node and triggers updates for any connected output nodes. /// </summary> internal override void Update() { var isFolderNameValid = !string.IsNullOrEmpty(_folderRef.FolderName); var childFolderArrays = GetInputValues(nameof(_childFolders), new object[0]) .OfType <FolderRef[]>() .ToArray(); var length = childFolderArrays.Sum(x => x.Length); // If there are not any child folders from other nodes present, return this folder as the // array of output folders. if (length == 0 && isFolderNameValid) { _outputFolders = new[] { _folderRef }; } else if (length > 0 && isFolderNameValid) { TempList.Clear(); for (var i = 0; i < childFolderArrays.Length; i++) { var childFolderArray = childFolderArrays[i]; for (var j = 0; j < childFolderArray.Length; j++) { var childFolderRef = childFolderArray[j]; var newFolderRef = new FolderRef { FolderName = Path.Combine(_folderRef.FolderName, childFolderRef.FolderName), ShouldGenerateCodeToGetPath = childFolderRef.ShouldGenerateCodeToGetPath }; TempList.Add(newFolderRef); } } if (_folderRef.ShouldGenerateCodeToGetPath) { TempList.Add(_folderRef); } _outputFolders = TempList.ToArray(); } else { _outputFolders = new FolderRef[0]; } // Make base call to trigger update on all output ports base.Update(); }