Remove code to support Blender 2.79 and older

This commit is contained in:
2021-02-16 11:33:48 +01:00
parent 8b49c5505e
commit 14778e5c08
9 changed files with 65 additions and 459 deletions

View File

@@ -34,13 +34,12 @@ if "bpy" in locals():
bat_interface = importlib.reload(bat_interface)
sdk = importlib.reload(sdk)
blender = importlib.reload(blender)
compatibility = importlib.reload(compatibility)
except NameError:
from . import bat_interface, sdk
from .. import blender, compatibility
from .. import blender
else:
from . import bat_interface, sdk
from .. import blender, compatibility
from .. import blender
import bpy
from bpy.types import AddonPreferences, Operator, WindowManager, Scene, PropertyGroup
@@ -130,31 +129,20 @@ def manager_updated(self: "FlamencoManagerGroup", context):
def silently_quit_blender():
"""Quit Blender without any confirmation popup."""
try:
prefs = bpy.context.preferences
except AttributeError:
# Backward compatibility with Blender < 2.80
prefs = bpy.context.user_preferences
try:
prefs.view.use_save_prompt = False
except AttributeError:
# Backward compatibility with Blender < 2.80
prefs.view.use_quit_dialog = False
prefs = bpy.context.preferences
prefs.view.use_save_prompt = False
bpy.ops.wm.quit_blender()
@compatibility.convert_properties
class FlamencoManagerGroup(PropertyGroup):
manager = EnumProperty(
manager: EnumProperty(
items=available_managers,
name="Flamenco Manager",
description="Which Flamenco Manager to use for jobs",
update=manager_updated,
)
status = EnumProperty(
status: EnumProperty(
items=[
("NONE", "NONE", "We have done nothing at all yet"),
(
@@ -293,7 +281,6 @@ def is_file_inside_job_storage(prefs, current_file: typing.Union[str, Path]) ->
return True
@compatibility.convert_properties
class FLAMENCO_OT_render(
async_loop.AsyncModalOperatorMixin,
pillar.AuthenticatedPillarOperatorMixin,
@@ -309,7 +296,7 @@ class FLAMENCO_OT_render(
stop_upon_exception = True
log = logging.getLogger("%s.FLAMENCO_OT_render" % __name__)
quit_after_submit = BoolProperty()
quit_after_submit: BoolProperty()
async def async_execute(self, context):
# Refuse to start if the file hasn't been saved. It's okay if
@@ -864,7 +851,6 @@ class FLAMENCO_OT_abort(Operator, FlamencoPollMixin):
return {"FINISHED"}
@compatibility.convert_properties
class FLAMENCO_OT_explore_file_path(FlamencoPollMixin, Operator):
"""Opens the Flamenco job storage path in a file explorer.
@@ -875,9 +861,7 @@ class FLAMENCO_OT_explore_file_path(FlamencoPollMixin, Operator):
bl_label = "Open in file explorer"
bl_description = __doc__.rstrip(".")
path = StringProperty(
name="Path", description="Path to explore", subtype="DIR_PATH"
)
path: StringProperty(name="Path", description="Path to explore", subtype="DIR_PATH")
def execute(self, context):
import platform
@@ -940,13 +924,12 @@ class FLAMENCO_OT_disable_output_path_override(Operator):
return {"FINISHED"}
@compatibility.convert_properties
class FLAMENCO_OT_set_recommended_sample_cap(Operator):
bl_idname = "flamenco.set_recommended_sample_cap"
bl_label = "Set Recommended Maximum Sample Count"
bl_description = "Set the recommended maximum samples per render task"
sample_cap = IntProperty()
sample_cap: IntProperty()
def execute(self, context):
context.scene.flamenco_render_chunk_sample_cap = self.sample_cap
@@ -1112,7 +1095,7 @@ class FLAMENCO_PT_render(bpy.types.Panel, FlamencoPollMixin):
prefs = preferences()
labeled_row = layout.split(**compatibility.factor(0.25), align=True)
labeled_row = layout.split(factor=0.25, align=True)
labeled_row.label(text="Manager:")
prop_btn_row = labeled_row.row(align=True)
@@ -1130,7 +1113,7 @@ class FLAMENCO_PT_render(bpy.types.Panel, FlamencoPollMixin):
else:
prop_btn_row.label(text="Fetching available managers.")
labeled_row = layout.split(**compatibility.factor(0.25), align=True)
labeled_row = layout.split(factor=0.25, align=True)
labeled_row.label(text="Job Type:")
labeled_row.prop(context.scene, "flamenco_render_job_type", text="")
@@ -1160,7 +1143,7 @@ class FLAMENCO_PT_render(bpy.types.Panel, FlamencoPollMixin):
sample_count = scene_sample_count(context.scene)
recommended_cap = sample_count // 4
split = box.split(**compatibility.factor(0.4))
split = box.split(factor=0.4)
split.label(text="Total Sample Count: %d" % sample_count)
props = split.operator(
"flamenco.set_recommended_sample_cap",
@@ -1181,7 +1164,7 @@ class FLAMENCO_PT_render(bpy.types.Panel, FlamencoPollMixin):
else:
box.prop(context.scene, "flamenco_render_fchunk_size")
labeled_row = layout.split(**compatibility.factor(0.25), align=True)
labeled_row = layout.split(factor=0.25, align=True)
labeled_row.label(text="Frame Range:")
prop_btn_row = labeled_row.row(align=True)
prop_btn_row.prop(context.scene, "flamenco_render_frame_range", text="")
@@ -1194,7 +1177,7 @@ class FLAMENCO_PT_render(bpy.types.Panel, FlamencoPollMixin):
paths_layout = layout.column(align=True)
labeled_row = paths_layout.split(**compatibility.factor(0.25), align=True)
labeled_row = paths_layout.split(factor=0.25, align=True)
labeled_row.label(text="Storage:")
prop_btn_row = labeled_row.row(align=True)
prop_btn_row.label(text=prefs.flamenco_job_file_path)
@@ -1217,7 +1200,7 @@ class FLAMENCO_PT_render(bpy.types.Panel, FlamencoPollMixin):
)
return
labeled_row = paths_layout.split(**compatibility.factor(0.25), align=True)
labeled_row = paths_layout.split(factor=0.25, align=True)
labeled_row.label(text="Output:")
prop_btn_row = labeled_row.row(align=True)
@@ -1237,7 +1220,7 @@ class FLAMENCO_PT_render(bpy.types.Panel, FlamencoPollMixin):
props.path = str(render_output.parent)
if context.scene.flamenco_do_override_output_path:
labeled_row = paths_layout.split(**compatibility.factor(0.25), align=True)
labeled_row = paths_layout.split(factor=0.25, align=True)
labeled_row.label(text="Effective Output Path:")
labeled_row.label(text=str(render_output))
@@ -1247,7 +1230,7 @@ class FLAMENCO_PT_render(bpy.types.Panel, FlamencoPollMixin):
flamenco_status = context.window_manager.flamenco_status
if flamenco_status in {"IDLE", "ABORTED", "DONE"}:
if prefs.flamenco_show_quit_after_submit_button:
ui = layout.split(**compatibility.factor(0.75), align=True)
ui = layout.split(factor=0.75, align=True)
else:
ui = layout
ui.operator(