[Bf-extensions-cvs] [57c75ddb] master: Amaranth Toolset: Fix registration with current master
lijenstina
noreply at git.blender.org
Fri Sep 29 16:30:44 CEST 2017
Commit: 57c75ddbeb204eecf27bf4af76d9a90af063665a
Author: lijenstina
Date: Fri Sep 29 16:29:52 2017 +0200
Branches: master
https://developer.blender.org/rBAC57c75ddbeb204eecf27bf4af76d9a90af063665a
Amaranth Toolset: Fix registration with current master
Bump version to 1.0.4
Part of T52564:
Fix crash during registration accessing Cycles
in current master (Blender 2.79.1)
- Properties cannot be accessed through types
- Changes to names of cycles classes
- Use versioning code, so 2.79 is supported for now too
===================================================================
M amaranth/__init__.py
M amaranth/render/samples_scene.py
M amaranth/render/unsimplify.py
===================================================================
diff --git a/amaranth/__init__.py b/amaranth/__init__.py
index 81f65384..a40a1058 100644
--- a/amaranth/__init__.py
+++ b/amaranth/__init__.py
@@ -90,7 +90,7 @@ from amaranth.misc import (
bl_info = {
"name": "Amaranth Toolset",
"author": "Pablo Vazquez, Bassam Kurdali, Sergey Sharybin, Lukas Tönne, Cesar Saez",
- "version": (1, 0, 3),
+ "version": (1, 0, 4),
"blender": (2, 74),
"location": "Everywhere!",
"description": "A collection of tools and settings to improve productivity",
diff --git a/amaranth/render/samples_scene.py b/amaranth/render/samples_scene.py
index 00105cd5..8ea216bb 100644
--- a/amaranth/render/samples_scene.py
+++ b/amaranth/render/samples_scene.py
@@ -28,6 +28,10 @@ Developed during Caminandes Open Movie Project
import bpy
from amaranth import utils
+from bpy.props import (
+ BoolProperty,
+ IntProperty,
+ )
class AMTH_RENDER_OT_cycles_samples_percentage_set(bpy.types.Operator):
@@ -60,10 +64,11 @@ class AMTH_RENDER_OT_cycles_samples_percentage(bpy.types.Operator):
bl_idname = "scene.amaranth_cycles_samples_percentage"
bl_label = "Set Render Samples Percentage"
- percent = bpy.props.IntProperty(
- name="Percentage",
- description="Percentage to divide render samples by",
- subtype="PERCENTAGE", default=0)
+ percent = IntProperty(
+ name="Percentage",
+ description="Percentage to divide render samples by",
+ subtype="PERCENTAGE", default=0
+ )
def execute(self, context):
percent = self.percent
@@ -196,11 +201,21 @@ def init():
scene.amaranth_cycles_list_sampling = bpy.props.BoolProperty(
default=False,
name="Samples Per:")
+ # Note: add versioning code to adress changes introduced in 2.79.1
+ if bpy.app.version >= (2, 79, 1):
+ from cycles import properties as _cycles_props
+ _cycles_props.CyclesRenderSettings.use_samples_final = BoolProperty(
+ name="Use Final Render Samples",
+ description="Use current shader samples as final render samples",
+ default=False
+ )
+ else:
+ bpy.types.CyclesRenderSettings.use_samples_final = BoolProperty(
+ name="Use Final Render Samples",
+ description="Use current shader samples as final render samples",
+ default=False
+ )
- bpy.types.CyclesRenderSettings.use_samples_final = bpy.props.BoolProperty(
- name="Use Final Render Samples",
- description="Use current shader samples as final render samples",
- default=False)
def clear():
@@ -215,12 +230,20 @@ def register():
bpy.utils.register_class(AMTH_RENDER_OT_cycles_samples_percentage)
bpy.utils.register_class(AMTH_RENDER_OT_cycles_samples_percentage_set)
if utils.cycles_exists():
- bpy.types.CyclesRender_PT_sampling.append(render_cycles_scene_samples)
+ if bpy.app.version >= (2, 79, 1):
+ bpy.types.CYCLES_RENDER_PT_sampling.append(render_cycles_scene_samples)
+ else:
+ bpy.types.CyclesRender_PT_sampling.append(render_cycles_scene_samples)
def unregister():
bpy.utils.unregister_class(AMTH_RENDER_OT_cycles_samples_percentage)
bpy.utils.unregister_class(AMTH_RENDER_OT_cycles_samples_percentage_set)
if utils.cycles_exists():
- bpy.types.CyclesRender_PT_sampling.remove(render_cycles_scene_samples)
+ if bpy.app.version >= (2, 79, 1):
+ bpy.types.CYCLES_RENDER_PT_sampling.remove(render_cycles_scene_samples)
+ else:
+ bpy.types.CyclesRender_PT_sampling.remove(render_cycles_scene_samples)
+
+
clear()
diff --git a/amaranth/render/unsimplify.py b/amaranth/render/unsimplify.py
index 90b66c07..9d01b088 100644
--- a/amaranth/render/unsimplify.py
+++ b/amaranth/render/unsimplify.py
@@ -64,7 +64,11 @@ def register():
bpy.app.handlers.render_post.append(unsimplify_render_post)
bpy.types.SCENE_PT_simplify.append(unsimplify_ui)
if utils.cycles_exists():
- bpy.types.CyclesScene_PT_simplify.append(unsimplify_ui)
+ if bpy.app.version >= (2, 79, 1):
+ bpy.types.CYCLES_SCENE_PT_simplify.append(unsimplify_ui)
+ else:
+ bpy.types.CyclesScene_PT_simplify.append(unsimplify_ui)
+
def unregister():
@@ -73,4 +77,8 @@ def unregister():
bpy.app.handlers.render_post.remove(unsimplify_render_post)
bpy.types.SCENE_PT_simplify.remove(unsimplify_ui)
if utils.cycles_exists():
- bpy.types.CyclesScene_PT_simplify.remove(unsimplify_ui)
+ if bpy.app.version >= (2, 79, 1):
+ bpy.types.CYCLES_SCENE_PT_simplify.remove(unsimplify_ui)
+ else:
+ bpy.types.CyclesScene_PT_simplify.remove(unsimplify_ui)
+
More information about the Bf-extensions-cvs
mailing list