def FilterGenerator():
    class AddBackPm(SimplifyFilter):
        def __init__(self):
            super(AddBackPm, self).__init__('add_back_pm', 'Adds back mesh data from a progressive PDAE file')
            self.arguments.append(FileArgument('pm_file', 'PDAE file to load from'))
            self.arguments.append(FilterArgument('percent', 'Percent of progressive file to add back'))
        def apply(self, mesh, pm_file, percent):
            try:
                pmin = open(pm_file, 'r')
            except IOError:
                raise FilterException("Invalid pm file")
            
            try:
                percent = float(percent)
            except ValueError:
                percent = None
            
            if percent is None or percent < 0.0:
                raise FilterException("Invalid percentage")
            
            mesh = add_back_pm(mesh, pmin, percent)
            return mesh

    return AddBackPm()
dataset/ETHPy150Open pycollada/meshtool/meshtool/filters/simplify_filters/add_back_pm.py/FilterGenerator/original