~ubuntu-branches/ubuntu/trusty/blender/trusty

« back to all changes in this revision

Viewing changes to release/scripts/modules/bpy_extras/io_utils.py

  • Committer: Package Import Robot
  • Author(s): Jeremy Bicha
  • Date: 2013-03-06 12:08:47 UTC
  • mfrom: (1.5.1) (14.1.8 experimental)
  • Revision ID: package-import@ubuntu.com-20130306120847-frjfaryb2zrotwcg
Tags: 2.66a-1ubuntu1
* Resynchronize with Debian (LP: #1076930, #1089256, #1052743, #999024,
  #1122888, #1147084)
* debian/control:
  - Lower build-depends on libavcodec-dev since we're not
    doing the libav9 transition in Ubuntu yet

Show diffs side-by-side

added added

removed removed

Lines of Context:
79
79
        return {'RUNNING_MODAL'}
80
80
 
81
81
    def check(self, context):
 
82
        import os
82
83
        change_ext = False
83
84
        change_axis = _check_axis_conversion(self)
84
85
 
85
86
        check_extension = self.check_extension
86
87
 
87
88
        if check_extension is not None:
88
 
            filepath = bpy.path.ensure_ext(self.filepath,
89
 
                                           self.filename_ext
90
 
                                           if check_extension
91
 
                                           else "")
 
89
            filepath = self.filepath
 
90
            if os.path.basename(filepath):
 
91
                filepath = bpy.path.ensure_ext(filepath,
 
92
                                               self.filename_ext
 
93
                                               if check_extension
 
94
                                               else "")
92
95
 
93
 
            if filepath != self.filepath:
94
 
                self.filepath = filepath
95
 
                change_ext = True
 
96
                if filepath != self.filepath:
 
97
                    self.filepath = filepath
 
98
                    change_ext = True
96
99
 
97
100
        return (change_ext or change_axis)
98
101
 
330
333
        description="Method used to reference paths",
331
334
        items=(('AUTO', "Auto", "Use Relative paths with subdirectories only"),
332
335
               ('ABSOLUTE', "Absolute", "Always write absolute paths"),
333
 
               ('RELATIVE', "Relative", "Always write relative patsh "
 
336
               ('RELATIVE', "Relative", "Always write relative paths "
334
337
                                        "(where possible)"),
335
338
               ('MATCH', "Match", "Match Absolute/Relative "
336
339
                                  "setting with input path"),
338
341
               ('COPY', "Copy", "Copy the file to the destination path "
339
342
                                "(or subdirectory)"),
340
343
               ),
341
 
        default='AUTO'
 
344
        default='AUTO',
342
345
        )
343
346
 
344
347
 
433
436
            pass
434
437
        else:
435
438
            dir_to = os.path.dirname(file_dst)
436
 
 
437
 
            if not os.path.isdir(dir_to):
438
 
                os.makedirs(dir_to)
439
 
 
 
439
            os.makedirs(dir_to, exist_ok=True)
440
440
            shutil.copy(file_src, file_dst)
441
441
 
442
442
 
477
477
            while name_new in name_dict_values:
478
478
                count_str = "%03d" % count
479
479
                name_new = "%.*s%s%s" % (name_max - (len(count_str) + 1),
480
 
                                        name_new_orig,
481
 
                                        sep,
482
 
                                        count_str,
483
 
                                        )
 
480
                                         name_new_orig,
 
481
                                         sep,
 
482
                                         count_str,
 
483
                                         )
484
484
                count += 1
485
485
 
486
486
        name_dict[key] = name_new