public void Init(AssetTool.PackageInfo package, AssetTool tool)
        {
            if (!initialized)
            {
                FindRequiredElements();
                _assetTool    = tool;
                name          = package.@namespace + " [LibEle]";
                fullFilePath  = package.path;
                myType        = LibraryElementType.Folder;
                fileAndExt    = Path.GetFileName(package.path);
                myIcon.sprite = LibraryManager.Inst.folderIcon;

                playButton.transform.localScale = Vector3.one;
                processIcon.sprite = LibraryManager.Inst.processIcon;

                visual.color = LibraryManager.Inst.folderColor;
                copyButton.transform.parent.parent.gameObject.SetActive(false);
                processButton.transform.parent.parent.gameObject.SetActive(true);
                displayName.text = Path.GetFileName(package.path);
                myNamespace      = package.@namespace;
                fileName         = package.path;
                TooltipDescriptor.AddDescriptor(gameObject, package.@namespace, "Haptic Package: A collection of sequences, patterns and experiences\nDefined by its config.json");
                TooltipDescriptor.AddDescriptor(openLocationButton.gameObject, "<color=#FF4500>Open Folder</color>", "View directories of " + fileName, new Color32(135, 206, 255, 225));

                TooltipDescriptor.AddDescriptor(processButton.gameObject, "<color=#FF4500>Convert Package to HDF</color>", "<b>Used for Unreal Engine Assets</b>\nConverts all elements within the package [" + package.@namespace + "] to standalone HDFs", new Color32(135, 206, 255, 225));

                myPackage = package;

                initialized = true;
            }
        }
Esempio n. 2
0
        //Creates a viewer for the given folder.
        public PackageViewer SelectDirectory(AssetTool.PackageInfo packageInfo, Button button)
        {
            //If we haven't already opened one, make a new one
            if (!ContentsDict.ContainsKey(packageInfo.path))
            {
                //LastOpened = folderSelected;

                PackageViewer pv = ContentContainer.AddPrefabToContainerReturn().GetComponent <PackageViewer>();
                //So we could change the color of opened folder...
                pv.commander = button;

                //Ask the package viewer to do it's own setup.
                pv.Init(assetTool, packageInfo);

                //Hold onto the parent object so we can easily switch between opened ones.
                ContentsDict.Add(packageInfo.path, pv);
            }

            //Open the one we asked for (it was made if it didn't exist, or it already exists)
            //Debug.Log("Entry already exists for: " + folderSelected + "\n");
            Selection = ContentsDict[packageInfo.path];

            //Remember what they had open
            LastPackageAccessed = packageInfo.path;
            //Debug.Log("Opened Directory:" + LastPackageAccessed + "\n");

            return(ContentsDict[packageInfo.path]);
        }
        private void ConvertPackageToHDF(AssetTool.PackageInfo package, SuccessCallback successCallback, ExceptionCallback failCallback)
        {
            AsyncHDFConversionCaller caller = new AsyncHDFConversionCaller(_assetTool.ConvertPackageToHDFs);

            //Using this is easier than splitting on last occurrence of forward slash and going up one directory.
            string targetDirectory = package.path + " - Converted";

            /*IAsyncResult r = */
            caller.BeginInvoke(package, targetDirectory, delegate(IAsyncResult iar)
            {
                AsyncResult result = (AsyncResult)iar;
                AsyncHDFConversionCaller caller2 = (AsyncHDFConversionCaller)result.AsyncDelegate;

                try
                {
                    string errors = caller2.EndInvoke(iar);
                    if (errors.Length > 0)
                    {
                        //Todo: make better broken case
                        Debug.LogError("Encountered errors when converting package [" + package.@namespace + "] to HDFs:\n\t" + errors);
                    }
                }
                catch (Exception whatTheHellMicrosoft)
                {
                    Debug.LogError("Async Delegate Error converting package directory to HDFs - path [" + package.path + "]\n" + whatTheHellMicrosoft.Message);

                    failCallback(whatTheHellMicrosoft);
                }
            }, successCallback);
        }
Esempio n. 4
0
        //When a directory is 'opened'
        public void Init(AssetTool tool, AssetTool.PackageInfo package)
        {
            _assetTool  = tool;
            myName      = Path.GetFileName(package.path);
            myNameSpace = package.@namespace;
            Folder.text = myName + " Contents";

            path = package.path;

            PopulateMyDirectory(path);
        }
        //When a directory is 'opened'
        public void Init(AssetTool tool, AssetTool.PackageInfo package)
        {
            if (!initialized)
            {
                FindRequiredElements();
                initialized = true;
            }
            _assetTool  = tool;
            myName      = Path.GetFileName(package.path);
            myNameSpace = package.@namespace;
            Folder.text = myName + " Contents";

            path = package.path;

            PopulateMyDirectory(path);
        }
Esempio n. 6
0
        private void importAll(object state)
        {
            AssetTool.PackageInfo package = (AssetTool.PackageInfo)(state);

            var allSequences = getFilesWithExtension(package.path + "/sequences/", ".sequence");

            currentProgress   = 0f;
            totalProgress     = allSequences.Count;
            _lastImport.Total = allSequences.Count;
            _fetchQueue       = new Queue <string>(allSequences);
            _fetching         = true;

            //	var results = getAllJsonFromPaths(allSequences);
            //_lastImport.TotalSucceeded = results.Count;
            //	_lastImport.Total = allSequences.Count;
            //	_workQueue = new Queue<KeyValuePair<string, string>>(results);
        }
Esempio n. 7
0
        public void SetupLibraries()
        {
            //Base for the path - has ALL the folders
            string path = Application.streamingAssetsPath;

            assetTool.SetRootHapticsFolder(path + "/Haptics/");
            var packages = assetTool.TryGetPackageInfo();



            for (int i = 0; i < packages.Count; i++)
            {
                //Debug.Log("Directory: " + folders[i] + "\n");
                //A library element represents either a folder or a haptic file. It will configure it's appearance based on its name (if it has .seq/.exp/.pat in its name, it'll adjust accordingly)
                LibraryElement libEle = FolderContainer.AddPrefabToContainerReturn().GetComponent <LibraryElement>();
                libEle.Init(packages[i], assetTool);
                libEle.playButton.transform.localScale = Vector3.one;
                libEle.playButton.name = Path.GetFileName(packages[i].path);
                string folderName           = packages[i].path;
                AssetTool.PackageInfo tempP = packages[i];
                libEle.playButton.onClick.AddListener(
                    () => { SelectDirectory(tempP, libEle.playButton); }
                    );
                tempRef = libEle.gameObject;

                //Debug.Log(Selection == null);
                //string lastAccessed = LastOpened;

                //If we have something that we last accessed
                var found = packages.Find(item => item.path == LastPackageAccessed);
                if (LastPackageAccessed.Length > 0 && found != null)
                {
                    if (folderName == LastPackageAccessed)
                    {
                        SelectDirectory(packages[i], libEle.playButton);
                    }
                }
                else if (packages.Count > 0)
                {
                    //Select the first folder
                    SelectDirectory(packages[i], libEle.playButton);
                }
            }
        }
Esempio n. 8
0
        public void Init(AssetTool.PackageInfo package, AssetTool tool)
        {
            if (!initialized)
            {
                _assetTool    = tool;
                name          = package.path;
                fullFilePath  = package.path;
                myType        = LibraryElementType.Folder;
                fileAndExt    = Path.GetFileName(package.path);
                myIcon.sprite = LibraryManager.Inst.folderIcon;
                visual.color  = LibraryManager.Inst.folderColor;
                copyButton.transform.parent.parent.gameObject.SetActive(false);
                displayName.text = Path.GetFileName(package.path);
                myNamespace      = package.@namespace;
                fileName         = package.path;
                TooltipDescriptor.AddDescriptor(gameObject, fileName, "Haptic Package: A collection of sequences, patterns and experiences\nDefined by its config.json");
                TooltipDescriptor.AddDescriptor(openLocationButton.gameObject, "Open Explorer", "View directories of " + fileName);

                initialized = true;
            }
        }