예제 #1
0
    def check(self, context):
        '''
        This is a modified version of the ExportHelper check() method
        This one provides automatic checking for the file extension
         based on what 'target_format' is (through 'format_ext_map')
        '''
        import os
        from bpy_extras.io_utils import _check_axis_conversion
        change_ext = False
        change_axis = _check_axis_conversion(self)

        check_extension = self.check_extension

        if check_extension is not None:
            filepath = self.filepath
            if os.path.basename(filepath):
                # If the current extension is one of the valid extensions
                #  (as defined by this class), strip the extension, and ensure
                #  that it has the correct one
                # (needed when switching extensions)
                base, ext = os.path.splitext(filepath)
                if ext[1:] in self.format_ext_map:
                    filepath = base
                target_ext = self.format_ext_map[self.target_format]
                filepath = bpy.path.ensure_ext(filepath,
                                               target_ext
                                               if check_extension
                                               else "")

                if filepath != self.filepath:
                    self.filepath = filepath
                    change_ext = True

        return (change_ext or change_axis)
예제 #2
0
    def check(self, context):
        '''
        This is a modified version of the ExportHelper check() method
        This one provides automatic checking for the file extension
         based on what 'target_format' is (through 'format_ext_map')
        '''
        import os
        from bpy_extras.io_utils import _check_axis_conversion
        change_ext = False
        change_axis = _check_axis_conversion(self)

        check_extension = self.check_extension

        if check_extension is not None:
            filepath = self.filepath
            if os.path.basename(filepath):
                # If the current extension is one of the valid extensions
                #  (as defined by this class), strip the extension, and ensure
                #  that it has the correct one
                # (needed when switching extensions)
                base, ext = os.path.splitext(filepath)
                if ext[1:] in self.format_ext_map:
                    filepath = base
                target_ext = self.format_ext_map[self.target_format]
                filepath = bpy.path.ensure_ext(
                    filepath, target_ext if check_extension else "")

                if filepath != self.filepath:
                    self.filepath = filepath
                    change_ext = True

        return (change_ext or change_axis)
예제 #3
0
    def check(self, context):
        import os
        change_ext = False
        change_axis = _check_axis_conversion(self)

        check_extension = self.check_extension

        if check_extension is not None:
            filepath = self.filepath
            if os.path.basename(filepath):
                filepath = bpy.path.ensure_ext(filepath,
                                               self.filename_ext
                                               if check_extension
                                               else "")

                if filepath != self.filepath:

                    head, tail = os.path.split(self.filepath)
                    filepath = os.path.splitext(tail)[0]
                    filepath = bpy.path.ensure_ext(filepath,
                                                   self.filename_ext
                                                   if check_extension
                                                   else "")
                    self.filepath = os.path.join(head, filepath)
                    change_ext = True

        return (change_ext or change_axis)
    def check(self, context):
        change = _check_axis_conversion(self)

        for tag, prop in self.override_props:
            val = getattr(self, prop)
            newval = re.sub(r'[^0-9,]','',val)
            newval = re.sub(r'(^,+|,+$)','',newval)
            newval = re.sub(r',,+',',',newval)
            if newval != val:
                setattr(self, prop, newval)
                change = True

        return change