private TreeViewItem AddAnimatableObjectToHierarchy(GameObject root, EditorCurveBinding[] curveBindings, TreeViewItem parentNode, string path)
        {
            TreeViewItem item = new AddCurvesPopupObjectNode(parentNode, path, GetClassName(root, curveBindings[0]))
            {
                icon = AssetPreview.GetMiniThumbnail(AnimationUtility.GetAnimatedObject(root, curveBindings[0]))
            };
            List <TreeViewItem>       visibleItems = new List <TreeViewItem>();
            List <EditorCurveBinding> list2        = new List <EditorCurveBinding>();

            for (int i = 0; i < curveBindings.Length; i++)
            {
                EditorCurveBinding binding = curveBindings[i];
                list2.Add(binding);
                if ((i == (curveBindings.Length - 1)) || (AnimationWindowUtility.GetPropertyGroupName(curveBindings[i + 1].propertyName) != AnimationWindowUtility.GetPropertyGroupName(binding.propertyName)))
                {
                    TreeViewItem item2 = this.CreateNode(list2.ToArray(), item);
                    if (item2 != null)
                    {
                        visibleItems.Add(item2);
                    }
                    list2.Clear();
                }
            }
            visibleItems.Sort();
            TreeViewUtility.SetChildParentReferences(visibleItems, item);
            return(item);
        }
        private TreeViewItem AddAnimatableObjectToHierarchy(EditorCurveBinding[] curveBindings, TreeViewItem parentNode, string path)
        {
            TreeViewItem treeViewItem = new AddCurvesPopupObjectNode(parentNode, path, AddCurvesPopupHierarchyDataSource.GetClassName(curveBindings[0]));

            treeViewItem.icon = AddCurvesPopupHierarchyDataSource.GetIcon(curveBindings[0]);
            List <TreeViewItem>       list  = new List <TreeViewItem>();
            List <EditorCurveBinding> list2 = new List <EditorCurveBinding>();

            for (int i = 0; i < curveBindings.Length; i++)
            {
                EditorCurveBinding item = curveBindings[i];
                list2.Add(item);
                if (i == curveBindings.Length - 1 || AnimationWindowUtility.GetPropertyGroupName(curveBindings[i + 1].propertyName) != AnimationWindowUtility.GetPropertyGroupName(item.propertyName))
                {
                    TreeViewItem treeViewItem2 = this.CreateNode(list2.ToArray(), treeViewItem);
                    if (treeViewItem2 != null)
                    {
                        list.Add(treeViewItem2);
                    }
                    list2.Clear();
                }
            }
            list.Sort();
            TreeViewUtility.SetChildParentReferences(list, treeViewItem);
            return(treeViewItem);
        }
        private TreeViewItem AddAnimatableObjectToHierarchy(EditorCurveBinding[] curveBindings, TreeViewItem parentNode, string path)
        {
            TreeViewItem node = new AddCurvesPopupObjectNode(parentNode, path, GetClassName(curveBindings[0]));

            node.icon = GetIcon(curveBindings[0]);

            List <TreeViewItem>       childNodes             = new List <TreeViewItem>();
            List <EditorCurveBinding> singlePropertyBindings = new List <EditorCurveBinding>();

            for (int i = 0; i < curveBindings.Length; i++)
            {
                EditorCurveBinding curveBinding = curveBindings[i];

                singlePropertyBindings.Add(curveBinding);

                // We expect curveBindings to come sorted by propertyname
                if (i == curveBindings.Length - 1 || AnimationWindowUtility.GetPropertyGroupName(curveBindings[i + 1].propertyName) != AnimationWindowUtility.GetPropertyGroupName(curveBinding.propertyName))
                {
                    TreeViewItem newNode = CreateNode(singlePropertyBindings.ToArray(), node);
                    if (newNode != null)
                    {
                        childNodes.Add(newNode);
                    }
                    singlePropertyBindings.Clear();
                }
            }

            childNodes.Sort();

            TreeViewUtility.SetChildParentReferences(childNodes, node);
            return(node);
        }
        public override void FetchData()
        {
            m_RootItem = GetEmptyRootNode();
            SetupRootNodeSettings();
            m_NeedRefreshRows = true;

            if (state.selection.disabled)
            {
                root.children = null;
                return;
            }

            List <AnimationWindowHierarchyNode> childNodes = new List <AnimationWindowHierarchyNode>();

            if (state.allCurves.Count > 0)
            {
                AnimationWindowHierarchyMasterNode masterNode = new AnimationWindowHierarchyMasterNode();
                masterNode.curves = state.allCurves.ToArray();

                childNodes.Add(masterNode);
            }

            childNodes.AddRange(CreateTreeFromCurves());
            childNodes.Add(new AnimationWindowHierarchyAddButtonNode());

            TreeViewUtility.SetChildParentReferences(new List <TreeViewItem>(childNodes.ToArray()), root);
        }
Esempio n. 5
0
        private static string GetAssetInfos(bool isFromDataGrid = false)
        {
            StringBuilder sb = new StringBuilder();

            string fullPath = isFromDataGrid ? FWindow.FCurrentAsset : TreeViewUtility.GetFullPath(FWindow.TVItem) + "/" + FWindow.FCurrentAsset;

            PakReader.PakReader reader = AssetsUtility.GetPakReader(fullPath);
            if (reader != null)
            {
                List <FPakEntry> entriesList = AssetsUtility.GetPakEntries(fullPath);
                foreach (FPakEntry entry in entriesList)
                {
                    sb.Append(
                        "\n- PAK File:\t" + Path.GetFileName(reader.Name) +
                        "\n- Path:\t\t" + entry.Name +
                        "\n- Position:\t" + entry.Pos +
                        "\n- Size:\t\t" + AssetsUtility.GetReadableSize(entry.UncompressedSize) +
                        "\n- Encrypted:\t" + entry.Encrypted +
                        "\n"
                        );
                }
            }

            if (isFromDataGrid)
            {
                string selectedName = fullPath.Substring(fullPath.LastIndexOf("/") + 1);
                if (selectedName.EndsWith(".uasset"))
                {
                    selectedName = selectedName.Substring(0, selectedName.LastIndexOf('.'));
                }
                FWindow.FCurrentAsset = selectedName;
            }
            return(sb.ToString());
        }
Esempio n. 6
0
        private TreeViewItem AddAnimatableObjectToHierarchy(GameObject root, EditorCurveBinding[] curveBindings, TreeViewItem parentNode, string path)
        {
            TreeViewItem treeViewItem = (TreeViewItem) new AddCurvesPopupObjectNode(parentNode, path, AddCurvesPopupHierarchyDataSource.GetClassName(root, curveBindings[0]));

            treeViewItem.icon = AssetPreview.GetMiniThumbnail(AnimationUtility.GetAnimatedObject(root, curveBindings[0]));
            List <TreeViewItem>       visibleItems           = new List <TreeViewItem>();
            List <EditorCurveBinding> editorCurveBindingList = new List <EditorCurveBinding>();

            for (int index = 0; index < curveBindings.Length; ++index)
            {
                EditorCurveBinding curveBinding = curveBindings[index];
                editorCurveBindingList.Add(curveBinding);
                if (index == curveBindings.Length - 1 || AnimationWindowUtility.GetPropertyGroupName(curveBindings[index + 1].propertyName) != AnimationWindowUtility.GetPropertyGroupName(curveBinding.propertyName))
                {
                    TreeViewItem node = this.CreateNode(editorCurveBindingList.ToArray(), treeViewItem);
                    if (node != null)
                    {
                        visibleItems.Add(node);
                    }
                    editorCurveBindingList.Clear();
                }
            }
            visibleItems.Sort();
            TreeViewUtility.SetChildParentReferences(visibleItems, treeViewItem);
            return(treeViewItem);
        }
Esempio n. 7
0
        private void RecordSelectedInformation()
        {
            if (m_TreeView == null || m_TreeView.selected.Count == 0)
            {
                return;
            }
            var psdLayers = m_TreeView.selected.ConvertAll(x => x.layer as IPsdLayer).ToArray();

            if (exporter == null)
            {
                exporter = ScriptableObject.CreateInstance <Exporter>();
            }
            exporter.ruleObj = ruleObj;
            exporter.name    = "exporter" + System.DateTime.UtcNow.ToFileTimeUtc();
            ProjectWindowUtil.CreateAsset(exporter, exporter.name + ".asset");
            EditorUtility.SetDirty(exporter);

            ExportUtility.InitPsdExportEnvrioment(exporter, new Vector2(psd.Width, psd.Height));
            var rootNode = new GroupNode(new Rect(Vector2.zero, exporter.ruleObj.defultUISize), 0, -1);

            rootNode.displayName = exporter.name;

            var groupDatas = ExportUtility.CreatePictures(psdLayers, new Vector2(psd.Width, psd.Height), exporter.ruleObj.defultUISize, exporter.ruleObj.forceSprite);

            if (groupDatas != null)
            {
                foreach (var groupData in groupDatas)
                {
                    rootNode.AddChild(groupData);
                    ExportUtility.ChargeTextures(exporter, groupData);
                }
            }
            TreeViewUtility.TreeToList <GroupNode>(rootNode, exporter.groups, true);
            EditorUtility.SetDirty(exporter);
        }
Esempio n. 8
0
        private void RecordAllPsdInformation()
        {
            if (!string.IsNullOrEmpty(exporter.psdFile))
            {
                var psd = PsdDocument.Create(exporter.psdFile);

                if (psd != null)
                {
                    try
                    {
                        var rootSize = new Vector2(psd.Width, psd.Height);
                        ExportUtility.InitPsdExportEnvrioment(exporter, rootSize);
                        rootNode             = new GroupNode(new Rect(Vector2.zero, rootSize), 0, -1);
                        rootNode.displayName = exporter.name;
                        var groupDatas = ExportUtility.CreatePictures(psd.Childs, rootSize, exporter.ruleObj.defultUISize, exporter.ruleObj.forceSprite);
                        if (groupDatas != null)
                        {
                            foreach (var groupData in groupDatas)
                            {
                                rootNode.AddChild(groupData);
                                ExportUtility.ChargeTextures(exporter, groupData);
                            }
                        }
                        TreeViewUtility.TreeToList <GroupNode>(rootNode, exporter.groups, true);
                        EditorUtility.SetDirty(exporter);
                    }
                    catch (Exception e)
                    {
                        psd.Dispose();
                        throw e;
                    }
                    psd.Dispose();
                }
            }
        }
        public override void FetchData()
        {
            this.m_RootItem = this.GetEmptyRootNode();
            this.SetupRootNodeSettings();
            this.m_NeedRefreshVisibleFolders = true;
            if (this.state.activeRootGameObject == null && this.state.activeAnimationClip == null)
            {
                this.root.children = null;
                return;
            }
            List <AnimationWindowHierarchyNode> list = new List <AnimationWindowHierarchyNode>();

            if (this.state.allCurves.Count > 0)
            {
                list.Add(new AnimationWindowHierarchyMasterNode
                {
                    curves = this.state.allCurves.ToArray()
                });
            }
            list.AddRange(this.CreateTreeFromCurves());
            if (this.state.activeRootGameObject != null)
            {
                list.Add(new AnimationWindowHierarchyAddButtonNode());
            }
            TreeViewUtility.SetChildParentReferences(new List <TreeViewItem>(list.ToArray()), this.root);
        }
Esempio n. 10
0
 private async void RC_ExtractFolders_Click(object sender, RoutedEventArgs e)
 {
     if (TreeView_Main.SelectedItem != null)
     {
         string path = TreeViewUtility.GetFullPath(FWindow.TVItem);
         await AssetsLoader.ExtractFoldersAndSub(path);
     }
 }
Esempio n. 11
0
        protected override void ContextClickedItem(int id)
        {
            var i = TreeViewUtility.FindItem(id, rootItem);

            if (i != null)
            {
                GenericMenu menu = new GenericMenu();
                menu.AddItem(new GUIContent("Find issues"), false, OnContextMenuFindIssues, i);
                menu.ShowAsContext();
            }
        }
Esempio n. 12
0
 private void InitTreeView()
 {
     if (exporter.groups != null && exporter.groups.Count > 0)
     {
         if (exporter.groups.Count > 0)
         {
             rootNode        = TreeViewUtility.ListToTree <GroupNode>(exporter.groups);
             m_TreeView      = new ExporterTreeView(m_TreeViewState);
             m_TreeView.root = rootNode;
         }
     }
 }
Esempio n. 13
0
 private void InitTreeView()
 {
     if (exporter.groups != null && exporter.groups.Count > 0)
     {
         if (exporter.groups.Count > 0)
         {
             var list = exporter.groups.ConvertAll(x => new GroupNodeItem(x));
             rootNode           = TreeViewUtility.ListToTree <GroupNodeItem>(list);
             m_TreeView         = new ExporterTreeView(m_TreeViewState);
             m_TreeView.root    = rootNode;
             m_TreeView.ruleObj = (target as Exporter).ruleObj;
         }
     }
 }
Esempio n. 14
0
        protected override void ContextClickedItem(int id)
        {
            var i = TreeViewUtility.FindItem(id, rootItem);

            if (i != null)
            {
                GenericMenu menu = new GenericMenu();
                foreach (var b in AssetBundleDataCache.s_bundleDataMap.Keys)
                {
                    menu.AddItem(new GUIContent("Move to bundle/" + b), false, OnContextMenuFindIssues, b);
                }
                menu.ShowAsContext();
            }
        }
        private AnimationWindowHierarchyPropertyGroupNode AddPropertyGroupToHierarchy(AnimationWindowCurve[] curves, AnimationWindowHierarchyNode parentNode)
        {
            List <AnimationWindowHierarchyNode>       windowHierarchyNodeList = new List <AnimationWindowHierarchyNode>();
            AnimationWindowHierarchyPropertyGroupNode propertyGroupNode       = new AnimationWindowHierarchyPropertyGroupNode(curves[0].type, AnimationWindowUtility.GetPropertyGroupName(curves[0].propertyName), curves[0].path, (TreeViewItem)parentNode);

            propertyGroupNode.icon   = this.GetIcon(curves[0].binding);
            propertyGroupNode.indent = curves[0].depth;
            propertyGroupNode.curves = curves;
            foreach (AnimationWindowCurve curve in curves)
            {
                AnimationWindowHierarchyPropertyNode hierarchy = this.AddPropertyToHierarchy(curve, (AnimationWindowHierarchyNode)propertyGroupNode);
                hierarchy.displayName = AnimationWindowUtility.GetPropertyDisplayName(hierarchy.propertyName);
                windowHierarchyNodeList.Add((AnimationWindowHierarchyNode)hierarchy);
            }
            TreeViewUtility.SetChildParentReferences(new List <TreeViewItem>((IEnumerable <TreeViewItem>)windowHierarchyNodeList.ToArray()), (TreeViewItem)propertyGroupNode);
            return(propertyGroupNode);
        }
Esempio n. 16
0
        private void GoTo_Button_Click(object sender, RoutedEventArgs e)
        {
            if (DataGrid_Search.SelectedIndex >= 0)
            {
                FileInfo item         = (FileInfo)DataGrid_Search.SelectedItem;
                string   selectedName = item.Name;
                if (selectedName.EndsWith(".uasset"))
                {
                    selectedName = selectedName.Substring(0, selectedName.LastIndexOf('.'));
                }

                FWindow.FCurrentAsset = selectedName;
                TreeViewUtility.JumpToFolder(selectedName.Substring(1, selectedName.LastIndexOf("/") - 1));
                FWindow.FMain.ListBox_Main.SelectedValue = selectedName.Substring(selectedName.LastIndexOf("/") + 1);
                Close();
            }
        }
Esempio n. 17
0
        private static void FillTreeView(bool bAllPAKs = false)
        {
            if (!bAllPAKs)
            {
                FPakEntry[] PAKFileInfos = PAKEntries.PAKToDisplay.Where(x => x.Key == FWindow.FCurrentPAK).Select(x => x.Value).FirstOrDefault();
                if (PAKFileInfos == null)
                {
                    DebugHelper.WriteLine($".PAKs: Wrong key provided for {FWindow.FCurrentPAK}");
                    throw new ArgumentException($"Please, provide a working key in the AES Manager for {FWindow.FCurrentPAK}");
                }

                DebugHelper.WriteLine($".PAKs: Filling Treeview with {FWindow.FCurrentPAK}'s assets");
                FWindow.FMain.Dispatcher.InvokeAsync(() =>
                {
                    foreach (FPakEntry entry in PAKFileInfos)
                    {
                        string onlyFolders = entry.Name.Substring(0, entry.Name.LastIndexOf('/'));
                        TreeViewUtility.PopulateTreeView(srt, onlyFolders.Substring(1));
                    }
                });
            }
            else
            {
                DebugHelper.WriteLine(".PAKs: Filling Treeview with all PAK's assets");
                foreach (FPakEntry[] PAKsFileInfos in PAKEntries.PAKToDisplay.Values)
                {
                    FWindow.FMain.Dispatcher.InvokeAsync(() =>
                    {
                        foreach (FPakEntry entry in PAKsFileInfos)
                        {
                            string onlyFolders = entry.Name.Substring(0, entry.Name.LastIndexOf('/'));
                            TreeViewUtility.PopulateTreeView(srt, onlyFolders.Substring(1));
                        }
                    });
                }
            }

            FWindow.FMain.Dispatcher.InvokeAsync(() =>
            {
                FWindow.FMain.ViewModel = srt;
            });
            DebugHelper.WriteLine(".PAKs: Treeview filled");
            new UpdateMyProcessEvents(!bAllPAKs ? PAK_PATH + "\\" + FWindow.FCurrentPAK : PAK_PATH, "Success").Update();
        }
        public override void FetchData()
        {
            this.m_RootItem = (TreeViewItem)this.GetEmptyRootNode();
            this.SetupRootNodeSettings();
            this.m_NeedRefreshVisibleFolders = true;
            if ((UnityEngine.Object) this.state.activeRootGameObject == (UnityEngine.Object)null && (UnityEngine.Object) this.state.activeAnimationClip == (UnityEngine.Object)null)
            {
                return;
            }
            List <AnimationWindowHierarchyNode> windowHierarchyNodeList = new List <AnimationWindowHierarchyNode>();

            if (this.state.allCurves.Count > 0)
            {
                windowHierarchyNodeList.Add((AnimationWindowHierarchyNode) new AnimationWindowHierarchyMasterNode());
            }
            windowHierarchyNodeList.AddRange((IEnumerable <AnimationWindowHierarchyNode>) this.CreateTreeFromCurves());
            windowHierarchyNodeList.Add((AnimationWindowHierarchyNode) new AnimationWindowHierarchyAddButtonNode());
            TreeViewUtility.SetChildParentReferences(new List <TreeViewItem>((IEnumerable <TreeViewItem>)windowHierarchyNodeList.ToArray()), this.root);
        }
Esempio n. 19
0
        private AnimationWindowHierarchyPropertyGroupNode AddPropertyGroupToHierarchy(AnimationWindowCurve[] curves, AnimationWindowHierarchyNode parentNode)
        {
            List <AnimationWindowHierarchyNode> list = new List <AnimationWindowHierarchyNode>();
            Type type = curves[0].type;
            AnimationWindowHierarchyPropertyGroupNode animationWindowHierarchyPropertyGroupNode = new AnimationWindowHierarchyPropertyGroupNode(type, AnimationWindowUtility.GetPropertyGroupName(curves[0].propertyName), curves[0].path, parentNode);

            animationWindowHierarchyPropertyGroupNode.icon   = this.GetIcon(curves[0].binding);
            animationWindowHierarchyPropertyGroupNode.indent = curves[0].depth;
            animationWindowHierarchyPropertyGroupNode.curves = curves;
            for (int i = 0; i < curves.Length; i++)
            {
                AnimationWindowCurve curve = curves[i];
                AnimationWindowHierarchyPropertyNode animationWindowHierarchyPropertyNode = this.AddPropertyToHierarchy(curve, animationWindowHierarchyPropertyGroupNode);
                animationWindowHierarchyPropertyNode.displayName = AnimationWindowUtility.GetPropertyDisplayName(animationWindowHierarchyPropertyNode.propertyName);
                list.Add(animationWindowHierarchyPropertyNode);
            }
            TreeViewUtility.SetChildParentReferences(new List <TreeViewItem>(list.ToArray()), animationWindowHierarchyPropertyGroupNode);
            return(animationWindowHierarchyPropertyGroupNode);
        }
Esempio n. 20
0
        private AnimationWindowHierarchyPropertyGroupNode AddPropertyGroupToHierarchy(AnimationWindowCurve[] curves, AnimationWindowHierarchyNode parentNode)
        {
            List <AnimationWindowHierarchyNode>       list = new List <AnimationWindowHierarchyNode>();
            AnimationWindowHierarchyPropertyGroupNode node = new AnimationWindowHierarchyPropertyGroupNode(curves[0].type, AnimationWindowUtility.GetPropertyGroupName(curves[0].propertyName), curves[0].path, parentNode)
            {
                icon   = this.GetIcon(curves[0].binding),
                indent = curves[0].depth,
                curves = curves
            };

            foreach (AnimationWindowCurve curve in curves)
            {
                AnimationWindowHierarchyPropertyNode item = this.AddPropertyToHierarchy(curve, node);
                item.displayName = AnimationWindowUtility.GetPropertyDisplayName(item.propertyName);
                list.Add(item);
            }
            TreeViewUtility.SetChildParentReferences(new List <TreeViewItem>(list.ToArray()), node);
            return(node);
        }
Esempio n. 21
0
        private TreeViewItem AddAnimatableObjectToHierarchy(EditorCurveBinding[] curveBindings, TreeViewItem parentNode, string path)
        {
            TreeViewItem node = new AddCurvesPopupObjectNode(parentNode, path, GetClassName(curveBindings[0]));

            node.icon = GetIcon(curveBindings[0]);

            List <TreeViewItem>       childNodes             = new List <TreeViewItem>();
            List <EditorCurveBinding> singlePropertyBindings = new List <EditorCurveBinding>();
            SerializedObject          so = null;

            for (int i = 0; i < curveBindings.Length; i++)
            {
                EditorCurveBinding curveBinding = curveBindings[i];
                if (curveBinding.isSerializeReferenceCurve)
                {
                    var animatedObject = AnimationUtility.GetAnimatedObject(AddCurvesPopup.s_State.activeRootGameObject, curveBinding);
                    if (animatedObject != null && (so == null || so.targetObject != animatedObject))
                    {
                        so = new SerializedObject(animatedObject);
                    }
                }

                singlePropertyBindings.Add(curveBinding);

                // We expect curveBindings to come sorted by propertyname
                if (i == curveBindings.Length - 1 || AnimationWindowUtility.GetPropertyGroupName(curveBindings[i + 1].propertyName) != AnimationWindowUtility.GetPropertyGroupName(curveBinding.propertyName))
                {
                    TreeViewItem newNode = CreateNode(singlePropertyBindings.ToArray(), node, so);
                    if (newNode != null)
                    {
                        childNodes.Add(newNode);
                    }
                    singlePropertyBindings.Clear();
                }
            }

            childNodes.Sort();

            TreeViewUtility.SetChildParentReferences(childNodes, node);
            return(node);
        }
Esempio n. 22
0
        public static async Task LoadSelectedAsset()
        {
            new UpdateMyProcessEvents("", "").Update();
            FWindow.FMain.Button_Extract.IsEnabled     = false;
            FWindow.FMain.Button_Stop.IsEnabled        = true;
            FWindow.FMain.AssetPropertiesBox_Main.Text = string.Empty;
            FWindow.FMain.AssetPropertiesBox_Main.SyntaxHighlighting = ResourceLoader.LoadHighlightingDefinition("Json.xshd");
            FWindow.FMain.ImageBox_Main.Source = null;

            string[] selectedItems = FWindow.FMain.ListBox_Main.SelectedItems.OfType <string>().ToArray(); //store selected items, doesn't crash if user select another item while extracting
            string   treePath      = TreeViewUtility.GetFullPath(FWindow.TVItem);                          //never change in the loop, in case user wanna see other folders while extracting

            TasksUtility.CancellableTaskTokenSource = new CancellationTokenSource();
            CancellationToken cToken = TasksUtility.CancellableTaskTokenSource.Token;
            await Task.Run(() =>
            {
                isRunning = true;
                foreach (string item in selectedItems)
                {
                    DebugHelper.WriteLine("Assets: User selected " + item);

                    cToken.ThrowIfCancellationRequested(); //if clicked on 'Stop' it breaks at the following item
                    while (!string.Equals(FWindow.FCurrentAsset, item))
                    {
                        FWindow.FCurrentAsset = item;
                    }

                    LoadAsset(treePath + "/" + item);
                }
            }, cToken).ContinueWith(TheTask =>
            {
                TasksUtility.TaskCompleted(TheTask.Exception);
                TasksUtility.CancellableTaskTokenSource.Dispose();
                isRunning = false;
            });

            FWindow.FMain.Button_Extract.IsEnabled = true;
            FWindow.FMain.Button_Stop.IsEnabled    = false;
        }
        private AnimationWindowHierarchyPropertyGroupNode AddPropertyGroupToHierarchy(AnimationWindowCurve[] curves, AnimationWindowHierarchyNode parentNode)
        {
            List <AnimationWindowHierarchyNode> childNodes = new List <AnimationWindowHierarchyNode>();

            System.Type animatableObjectType = curves[0].type;
            AnimationWindowHierarchyPropertyGroupNode node = new AnimationWindowHierarchyPropertyGroupNode(animatableObjectType, 0, AnimationWindowUtility.GetPropertyGroupName(curves[0].propertyName), curves[0].path, parentNode);

            node.icon = GetIcon(curves[0].binding);

            node.indent = curves[0].depth;
            node.curves = curves;

            foreach (AnimationWindowCurve curve in curves)
            {
                AnimationWindowHierarchyPropertyNode childNode = AddPropertyToHierarchy(curve, node);
                // For child nodes we do not want to display the type in front (It is already shown by the group node)
                childNode.displayName = AnimationWindowUtility.GetPropertyDisplayName(childNode.propertyName);
                childNodes.Add(childNode);
            }

            TreeViewUtility.SetChildParentReferences(new List <TreeViewItem>(childNodes.ToArray()), node);
            return(node);
        }
Esempio n. 24
0
    private void FinalizeDragPerformed(bool revertExpanded)
    {
        DragCleanup(revertExpanded);
        DragAndDrop.AcceptDrag();
        List <UnityEngine.Object> list = new List <UnityEngine.Object>(DragAndDrop.objectReferences);

        bool draggedItemsFromOwnTreeView = true;

        if (list.Count > 0 && list[0] != null && TreeViewUtility.FindItemInList(list[0].GetInstanceID(), m_TreeView.data.GetRows()) == null)
        {
            draggedItemsFromOwnTreeView = false;
        }

        int[] draggedIDs = new int[list.Count];
        for (int index = 0; index < list.Count; ++index)
        {
            if (list[index] != null)
            {
                draggedIDs[index] = list[index].GetInstanceID();
            }
        }
        m_TreeView.NotifyListenersThatDragEnded(draggedIDs, draggedItemsFromOwnTreeView);
    }
Esempio n. 25
0
 public override void FetchData()
 {
     this.m_RootItem = this.GetEmptyRootNode();
     this.SetupRootNodeSettings();
     this.m_NeedRefreshRows = true;
     if (this.state.selection.disabled)
     {
         base.root.children = null;
     }
     else
     {
         List <AnimationWindowHierarchyNode> list = new List <AnimationWindowHierarchyNode>();
         if (this.state.allCurves.Count > 0)
         {
             list.Add(new AnimationWindowHierarchyMasterNode
             {
                 curves = this.state.allCurves.ToArray()
             });
         }
         list.AddRange(this.CreateTreeFromCurves());
         list.Add(new AnimationWindowHierarchyAddButtonNode());
         TreeViewUtility.SetChildParentReferences(new List <TreeViewItem>(list.ToArray()), base.root);
     }
 }
Esempio n. 26
0
        private static async Task LoadBackupFile(bool updateMode = false)
        {
            OpenFileDialog openFiledialog = new OpenFileDialog();

            openFiledialog.Title            = "Choose your Backup File";
            openFiledialog.InitialDirectory = FProp.Default.FOutput_Path + "\\Backups\\";
            openFiledialog.Multiselect      = false;
            openFiledialog.Filter           = "FBKP Files (*.fbkp)|*.fbkp|All Files (*.*)|*.*";
            if (openFiledialog.ShowDialog() == true)
            {
                DebugHelper.WriteLine($".PAKs: Loading {openFiledialog.FileName} as the backup file");
                new UpdateMyProcessEvents("Comparing Files", "Waiting").Update();

                FPakEntry[] BackupEntries;
                using (FileStream fileStream = new FileStream(openFiledialog.FileName, FileMode.Open))
                    using (BinaryReader reader = new BinaryReader(fileStream))
                    {
                        DebugHelper.WriteLine(".PAKs: Populating FPakEntry[] for the backup file");

                        List <FPakEntry> entries = new List <FPakEntry>();
                        while (reader.BaseStream.Position < reader.BaseStream.Length)
                        {
                            // we must follow this order
                            long   offset                 = reader.ReadInt64();
                            long   size                   = reader.ReadInt64();
                            long   uncompressedSize       = reader.ReadInt64();
                            bool   encrypted              = reader.ReadBoolean();
                            long   structSize             = reader.ReadInt32();
                            string name                   = reader.ReadString();
                            long   compressionMethodIndex = reader.ReadInt32();

                            // we actually only need name and uncompressedSize to compare
                            FPakEntry entry = new FPakEntry(name, offset, size, uncompressedSize, new byte[20], null, 0, 0, 0);
                            entries.Add(entry);
                        }
                        BackupEntries = entries.ToArray();
                    }

                if (BackupEntries.Any())
                {
                    DebugHelper.WriteLine(".PAKs: FPakEntry[] for the backup file is populated");

                    List <FPakEntry> LocalEntries = new List <FPakEntry>();
                    foreach (FPakEntry[] PAKsFileInfos in PAKEntries.PAKToDisplay.Values)
                    {
                        PAKsFileInfos.ToList().ForEach(x => LocalEntries.Add(x));
                    }
                    PAKEntries.PAKToDisplay.Clear();
                    DebugHelper.WriteLine(".PAKs: FPakEntry[] for the local .PAKs is populated");

                    //FILTER WITH THE OVERRIDED EQUALS METHOD (CHECKING FILE NAME AND FILE UNCOMPRESSED SIZE)
                    DebugHelper.WriteLine($".PAKs: Comparing...\t File Size Check: {FProp.Default.FDiffFileSize}");
                    IEnumerable <FPakEntry> newAssets = LocalEntries.Except(BackupEntries);
                    DebugHelper.WriteLine(".PAKs: Compared");

                    //ADD TO TREE
                    DebugHelper.WriteLine(".PAKs: Filling Treeview with differentiated assets");
                    foreach (FPakEntry entry in newAssets)
                    {
                        string onlyFolders = entry.Name.Substring(0, entry.Name.LastIndexOf('/'));
                        await FWindow.FMain.Dispatcher.InvokeAsync(() =>
                        {
                            TreeViewUtility.PopulateTreeView(srt, onlyFolders.Substring(1));
                        });
                    }

                    //ONLY LOAD THE DIFFERENCE WHEN WE CLICK ON A FOLDER
                    FWindow.FCurrentPAK = "ComparedPAK-WindowsClient.pak";
                    PAKEntries.PAKToDisplay.Add("ComparedPAK-WindowsClient.pak", newAssets.ToArray());
                    await FWindow.FMain.Dispatcher.InvokeAsync(() =>
                    {
                        FWindow.FMain.ViewModel = srt;
                    });

                    DebugHelper.WriteLine(".PAKs: Treeview filled");

                    await FWindow.FMain.Dispatcher.InvokeAsync(() =>
                    {
                        FWindow.FMain.TreeView_Main.IsEnabled     = true;
                        FWindow.FMain.MI_LoadAllPAKs.IsEnabled    = true;
                        FWindow.FMain.MI_BackupPAKs.IsEnabled     = true;
                        FWindow.FMain.MI_DifferenceMode.IsEnabled = true;
                        if (updateMode)
                        {
                            FWindow.FMain.MI_UpdateMode.IsEnabled = true;
                        }
                    });

                    //PRINT REMOVED IF NO FILE SIZE CHECK
                    if (!FProp.Default.FDiffFileSize)
                    {
                        DebugHelper.WriteLine(".PAKs: Checking deleted items");
                        new UpdateMyProcessEvents("Checking deleted items", "Waiting").Update();
                        IEnumerable <FPakEntry> removedAssets = BackupEntries.Except(LocalEntries.ToArray());

                        List <string> removedItems = new List <string>();
                        foreach (FPakEntry entry in removedAssets)
                        {
                            if (entry.Name.StartsWith("/FortniteGame/Content/Athena/Items/Cosmetics/"))
                            {
                                removedItems.Add(entry.Name.Substring(0, entry.Name.LastIndexOf(".")));
                            }
                        }

                        if (removedItems.Count > 0)
                        {
                            DebugHelper.WriteLine(".PAKs: Items Removed/Renamed:");
                            new UpdateMyConsole("Items Removed/Renamed:", CColors.Red, true).Append();
                            removedItems.Distinct().ToList().ForEach(e => {
                                new UpdateMyConsole($"    - {e.Substring(1)}", CColors.White, true).Append();
                                DebugHelper.WriteLine($"    - {e.Substring(1)}");
                            });
                        }
                    }

                    DebugHelper.WriteLine(".PAKs: PAK files have been compared successfully");
                    new UpdateMyProcessEvents("All PAK files have been compared successfully", "Success").Update();
                    umIsOk = true;
                }
                else
                {
                    DebugHelper.WriteLine(".PAKs: FPakEntry[] for the backup file is empty");
                }
            }
            else
            {
                DebugHelper.WriteLine(".PAKs: User canceled when he got asked to select a backup file");

                new UpdateMyConsole("You change your mind pretty fast but it's fine ", CColors.White).Append();
                new UpdateMyConsole("all paks have been loaded instead", CColors.Blue, true).Append();
                FillTreeView(true);

                await FWindow.FMain.Dispatcher.InvokeAsync(() =>
                {
                    FWindow.FMain.TreeView_Main.IsEnabled     = true;
                    FWindow.FMain.MI_LoadAllPAKs.IsEnabled    = true;
                    FWindow.FMain.MI_BackupPAKs.IsEnabled     = true;
                    FWindow.FMain.MI_DifferenceMode.IsEnabled = true;
                    FWindow.FMain.MI_DifferenceMode.IsChecked = false;
                    if (updateMode)
                    {
                        FWindow.FMain.MI_UpdateMode.IsEnabled = true;
                        FWindow.FMain.MI_UpdateMode.IsChecked = false;
                    }
                });
            }
        }
Esempio n. 27
0
        private static async Task LoadBackupFile()
        {
            OpenFileDialog openFiledialog = new OpenFileDialog();

            openFiledialog.Title            = "Choose your Backup File";
            openFiledialog.InitialDirectory = FProp.Default.FOutput_Path + "\\Backups\\";
            openFiledialog.Multiselect      = false;
            openFiledialog.Filter           = "FBKP Files (*.fbkp)|*.fbkp|All Files (*.*)|*.*";
            if (openFiledialog.ShowDialog() == true)
            {
                new UpdateMyProcessEvents("Comparing Files", "Waiting").Update();

                FPakEntry[] BackupEntries;
                using (FileStream fileStream = new FileStream(openFiledialog.FileName, FileMode.Open))
                    using (BinaryReader reader = new BinaryReader(fileStream))
                    {
                        List <FPakEntry> entries = new List <FPakEntry>();
                        while (reader.BaseStream.Position < reader.BaseStream.Length)
                        {
                            FPakEntry entry = new FPakEntry();
                            entry.Pos               = reader.ReadInt64();
                            entry.Size              = reader.ReadInt64();
                            entry.UncompressedSize  = reader.ReadInt64();
                            entry.Encrypted         = reader.ReadBoolean();
                            entry.StructSize        = reader.ReadInt32();
                            entry.Name              = reader.ReadString();
                            entry.CompressionMethod = reader.ReadInt32();
                            entries.Add(entry);
                        }
                        BackupEntries = entries.ToArray();
                    }

                if (BackupEntries.Any())
                {
                    List <FPakEntry> LocalEntries = new List <FPakEntry>();
                    foreach (FPakEntry[] PAKsFileInfos in PAKEntries.PAKToDisplay.Values)
                    {
                        PAKsFileInfos.ToList().ForEach(x => LocalEntries.Add(x));
                    }
                    PAKEntries.PAKToDisplay.Clear();

                    //FILTER WITH THE OVERRIDED EQUALS METHOD (CHECKING FILE NAME AND FILE UNCOMPRESSED SIZE)
                    IEnumerable <FPakEntry> newAssets = LocalEntries.ToArray().Except(BackupEntries);

                    //ADD TO TREE
                    foreach (FPakEntry entry in newAssets)
                    {
                        string onlyFolders = entry.Name.Substring(0, entry.Name.LastIndexOf('/'));
                        await FWindow.FMain.Dispatcher.InvokeAsync(() =>
                        {
                            TreeViewUtility.PopulateTreeView(srt, onlyFolders.Substring(1));
                        });
                    }

                    //ONLY LOAD THE DIFFERENCE WHEN WE CLICK ON A FOLDER
                    FWindow.FCurrentPAK = "ComparedPAK-WindowsClient.pak";
                    PAKEntries.PAKToDisplay.Add("ComparedPAK-WindowsClient.pak", newAssets.ToArray());
                    await FWindow.FMain.Dispatcher.InvokeAsync(() =>
                    {
                        FWindow.FMain.ViewModel = srt;
                    });

                    new UpdateMyProcessEvents("All PAK files have been compared successfully", "Success").Update();
                }
            }
            else
            {
                new UpdateMyConsole("You change your mind pretty fast but it's fine ", CColors.White).Append();
                new UpdateMyConsole("all paks have been loaded instead", CColors.Blue, true).Append();
                FillTreeView(true);
            }
        }
        private TreeViewItem AddGameObjectToHierarchy(GameObject gameObject, GameObject rootGameObject, AnimationClip animationClip, TreeViewItem parent)
        {
            string              path       = AnimationUtility.CalculateTransformPath(gameObject.transform, rootGameObject.transform);
            TreeViewItem        node       = new AddCurvesPopupGameObjectNode(gameObject, parent, gameObject.name);
            List <TreeViewItem> childNodes = new List <TreeViewItem>();

            if (m_RootItem == null)
            {
                m_RootItem = node;
            }

            // Iterate over all animatable objects
            EditorCurveBinding[]      allCurveBindings     = AnimationUtility.GetAnimatableBindings(gameObject, rootGameObject);
            List <EditorCurveBinding> singleObjectBindings = new List <EditorCurveBinding>();

            for (int i = 0; i < allCurveBindings.Length; i++)
            {
                EditorCurveBinding curveBinding = allCurveBindings[i];

                singleObjectBindings.Add(curveBinding);

                // Don't create group for GameObject.m_IsActive. It looks messy
                if (curveBinding.propertyName == "m_IsActive")
                {
                    // Don't show for the root go
                    if (curveBinding.path != "")
                    {
                        TreeViewItem newNode = CreateNode(singleObjectBindings.ToArray(), node);
                        if (newNode != null)
                        {
                            childNodes.Add(newNode);
                        }
                        singleObjectBindings.Clear();
                    }
                    else
                    {
                        singleObjectBindings.Clear();
                    }
                }
                else
                {
                    // We expect allCurveBindings to come sorted by type

                    bool isLastItemOverall     = (i == allCurveBindings.Length - 1);
                    bool isLastItemOnThisGroup = false;

                    if (!isLastItemOverall)
                    {
                        isLastItemOnThisGroup = (allCurveBindings[i + 1].type != curveBinding.type);
                    }

                    // Let's not add those that already have a existing curve.
                    if (AnimationWindowUtility.IsCurveCreated(animationClip, curveBinding))
                    {
                        singleObjectBindings.Remove(curveBinding);
                    }

                    // Remove animator enabled property which shouldn't be animated.
                    if (curveBinding.type == typeof(Animator) && curveBinding.propertyName == "m_Enabled")
                    {
                        singleObjectBindings.Remove(curveBinding);
                    }

                    if ((isLastItemOverall || isLastItemOnThisGroup) && singleObjectBindings.Count > 0)
                    {
                        childNodes.Add(AddAnimatableObjectToHierarchy(singleObjectBindings.ToArray(), node, path));
                        singleObjectBindings.Clear();
                    }
                }
            }

            if (showEntireHierarchy)
            {
                // Iterate over all child GOs
                for (int i = 0; i < gameObject.transform.childCount; i++)
                {
                    Transform    childTransform = gameObject.transform.GetChild(i);
                    TreeViewItem childNode      = AddGameObjectToHierarchy(childTransform.gameObject, rootGameObject, animationClip, node);
                    if (childNode != null)
                    {
                        childNodes.Add(childNode);
                    }
                }
            }

            TreeViewUtility.SetChildParentReferences(childNodes, node);
            return(node);
        }
Esempio n. 29
0
 internal static void SetChildParentReferences(IList <TreeViewItem> m_Items, TreeViewItem root)
 {
     TreeViewUtility.SetChildParentReferences(m_Items, root);
 }
Esempio n. 30
0
 private List <TreeViewItem> GetItemsFromIDs(IEnumerable <int> draggedItemIDs)
 {
     return(TreeViewUtility.FindItemsInList(draggedItemIDs, this.m_TreeView.data.GetRows()));
 }