def GenerateDictionaryFBXAndHierarchyFromFolder(directoryPath):
    """Iterate over files @ directoryPath and return Dict of filename:List(Fbx hierarchy)

    Args:
        directoryPath (string): An os.path.isdir valid formatted path to a direcotry with .fbx files

    Raises:
        TypeError: if the directoryPath != str
        ValueError: if directoryPath not a valid direcotry formatted path str

    Returns:
        dict(): fbx filename: List(File Hierarchy}
    """
    if(isinstance(directoryPath,str)):
        if(os.path.isdir(directoryPath)):
            outputDictionary = dict()
            count = 0
            totalFiles = len(os.listdir(directoryPath))
            ProgressBarUpdate(count,totalFiles,"Generating Dictionary from FBX's Hierarchy From Folder")
            for entry in scandir.scandir(directoryPath):
                if (entry.path.endswith(".fbx")):
                    fbxName = entry.name.replace(".fbx","")
                    outputDictionary[fbxName] = GetHierarchyListFromFBXFile(entry.path)
                count += 1
                ProgressBarUpdate(count,totalFiles,"Generating Dictionary from FBX's Hierarchy From Folder")
            return outputDictionary
        else:
            raise(ValueError("directoryPath needs to be directory formatted str. Got {}".format(directoryPath)))
    else:
        raise(TypeError("expecting a str for directoryPath got {}".format(type(directoryPath))))
Exemple #2
0
 def test_negative_value(self):
     with self.assertRaises(ValueError):
         ProgressBarUpdate(-1,0,'TestBar') # this is ValueError (value needs to be > 0)
Exemple #3
0
 def test_bar_length_exceed_internal_max(self):
     with self.assertRaises(ValueError):
         print('__bar_length_max__ = {}'.format(__bar_length_max__))
         ProgressBarUpdate(-1,0,'TestBar',__bar_length_max__+1) # this is a ValueError (value of bar_length needs to be < __bar_length_max__)
Exemple #4
0
 def test_bar_length_not_string(self):
     with self.assertRaises(TypeError):
         ProgressBarUpdate(0,1,'TestBar','20') #this is TypeError (bar_length needs to be int)
Exemple #5
0
 def test_negative_bar_length(self):
     with self.assertRaises(ValueError):
         ProgressBarUpdate(0,1,'TestBar',-1) #What returns when bar_length is < 0?
Exemple #6
0
 def test_value_not_string(self):
     with self.assertRaises(TypeError):
         ProgressBarUpdate('0',1,'TestBar') #this is TypeError (value needs to be int)
Exemple #7
0
 def test_title_type_not_string(self):
     with self.assertRaises(TypeError):
         ProgressBarUpdate(0,1,5243) #this is TypeError (operation_title needs to be str)
Exemple #8
0
 def test_no_fill_no_bar(self):
     self.assertEqual(ProgressBarUpdate(0,1,'TestBar',0),'\rTestBar: [>] 0%') # What returns when bar_length is set to 0?
Exemple #9
0
 def test_overfill(self):
     self.assertEqual(ProgressBarUpdate(100,1,'TestBar',20),'\rTestBar: [------------------->] 100%') # What happens when value is set over end_value
Exemple #10
0
 def test_no_fill(self):
     self.assertEqual(ProgressBarUpdate(0,1,'TestBar',20),'\rTestBar: [>                   ] 0%') # What happens when value is set < end_value & bar_length = 20