diff --git a/loom.py b/loom.py index 3a4e9aa..ec0ed6e 100644 --- a/loom.py +++ b/loom.py @@ -2175,7 +2175,7 @@ def display_popup(self, context): bpy.ops.loom.batch_render_dialog('INVOKE_DEFAULT') def cancel(self, context): - self.display_popup(context) + if bpy.app.version < (4, 1, 0): self.display_popup(context) def invoke(self, context, event): self.cursor_pos = [event.mouse_x, event.mouse_y] @@ -2221,7 +2221,7 @@ def execute(self, context): self.report({'INFO'}, "Nothing selected") lum.batch_render_idx = len(lum.batch_render_coll)-1 - self.display_popup(context) + if bpy.app.version < (4, 1, 0): self.display_popup(context) return {'FINISHED'} @@ -2275,7 +2275,7 @@ def execute(self, context): blend_files = self.blend_files(self.directory, self.sub_folders) if next(blend_files, None) is None: - self.display_popup(context) + if bpy.app.version < (4, 1, 0): self.display_popup(context) self.report({'WARNING'},"No blend files found in {}".format(self.directory)) return {'CANCELLED'} @@ -2304,11 +2304,11 @@ def execute(self, context): self.report({'WARNING'}, "Skipped {}, invalid .blend file(s)".format(", ".join(invalid_files))) lum.batch_render_idx = len(lum.batch_render_coll)-1 - self.display_popup(context) + if bpy.app.version < (4, 1, 0): self.display_popup(context) return {'FINISHED'} def cancel(self, context): - self.display_popup(context) + if bpy.app.version < (4, 1, 0): self.display_popup(context) def invoke(self, context, event): self.cursor_pos = [event.mouse_x, event.mouse_y] @@ -3139,12 +3139,12 @@ def execute(self, context): if not os.path.isfile(self.filepath): self.report({'WARNING'},"Please select one image of an image sequence") - self.display_popup(context) + if bpy.app.version < (4, 1, 0): self.display_popup(context) return {"CANCELLED"} if not frame_suff: self.report({'WARNING'},"No valid image sequence") - self.display_popup(context) + if bpy.app.version < (4, 1, 0): self.display_popup(context) return {"CANCELLED"} sequence_name = filename.replace(frame_suff,'#'*len(frame_suff)) @@ -3201,11 +3201,11 @@ def execute(self, context): lum.sequence_rename = name_real lum.sequence_encode = sequence_path - self.display_popup(context) + if bpy.app.version < (4, 1, 0): self.display_popup(context) return {'FINISHED'} def cancel(self, context): - self.display_popup(context) + if bpy.app.version < (4, 1, 0): self.display_popup(context) def invoke(self, context, event): s = context.scene.loom.sequence_encode @@ -3258,11 +3258,11 @@ def execute(self, context): lum.movie_path = os.path.join(folder, "{}{}.mov".format(filename,ext)) else: lum.movie_path = self.filepath #self.report({'WARNING'},"No valid file type") - self.display_popup(context) + if bpy.app.version < (4, 1, 0): self.display_popup(context) return {'FINISHED'} def cancel(self, context): - self.display_popup(context) + if bpy.app.version < (4, 1, 0): self.display_popup(context) def invoke(self, context, event): self.filename = self.name_from_sequence(context) @@ -5182,7 +5182,7 @@ def display_popup(self, context): bpy.ops.loom.set_project_dialog('INVOKE_DEFAULT') def cancel(self, context): - self.display_popup(context) + if bpy.app.version < (4, 1, 0): self.display_popup(context) def invoke(self, context, event): self.cursor_pos = [event.mouse_x, event.mouse_y] @@ -5193,7 +5193,7 @@ def execute(self, context): scn = context.scene lum = scn.loom lum.project_directory = os.path.dirname(self.filepath) - self.display_popup(context) + if bpy.app.version < (4, 1, 0): self.display_popup(context) return {'FINISHED'} @@ -5202,9 +5202,9 @@ class LOOM_OT_project_dialog(bpy.types.Operator): bl_idname = "loom.set_project_dialog" bl_label = "Setup Project Directory" bl_options = {'REGISTER'} - - directory: bpy.props.StringProperty(name="Project Directory") + directory: bpy.props.StringProperty(name="Project Directory") + @classmethod def poll(cls, context): return True @@ -5218,7 +5218,11 @@ def execute(self, context): bpy.ops.wm.save_as_mainfile('INVOKE_DEFAULT') return {'CANCELLED'} - if not self.directory or not os.path.isdir(self.directory): + project_dir = lum.project_directory + if not self.options.is_invoke: + project_dir = self.directory + + if not project_dir or not os.path.isdir(project_dir): self.report({'ERROR'}, "Please specify a valid Project Directory") bpy.ops.loom.set_project_dialog('INVOKE_DEFAULT') return {'CANCELLED'} @@ -5227,7 +5231,7 @@ def execute(self, context): prefs = context.preferences.addons[__name__].preferences for d in prefs.project_directory_coll: if d.creation_flag and d.name: - pdir = os.path.join(self.directory, d.name) + pdir = os.path.join(project_dir, d.name) bpy.ops.loom.create_directory(directory=pdir) if not os.path.isdir(bpy.path.abspath(pdir)): errors.append(d.name) @@ -5251,7 +5255,6 @@ def invoke(self, context, event): lum = context.scene.loom if not context.scene.loom.project_directory: lum.project_directory = bpy.path.abspath('//') - self.directory = lum.project_directory return context.window_manager.invoke_props_dialog(self, width=prefs.project_dialog_width) def check(self, context): @@ -5278,7 +5281,7 @@ def draw(self, context): col.operator(LOOM_OT_directories_ui.bl_idname, icon='REMOVE', text="").action = 'REMOVE' layout.separator() row = layout.row(align=True) - row.prop(self, "directory") + row.prop(lum, "project_directory") row.operator(LOOM_OT_select_project_directory.bl_idname, icon='FILE_FOLDER', text="") layout.separator()