[Bf-extensions-cvs] [573847ca] master: Pass 5 of 2.8 syntax update...

Maurice Raybaud noreply at git.blender.org
Sat Apr 27 20:12:38 CEST 2019


Commit: 573847caa34747a163d15b0410025d6bcda02663
Author: Maurice Raybaud
Date:   Sat Apr 27 20:12:29 2019 +0200
Branches: master
https://developer.blender.org/rBA573847caa34747a163d15b0410025d6bcda02663

Pass 5 of 2.8 syntax update...

===================================================================

M	render_povray/__init__.py
M	render_povray/nodes.py
M	render_povray/primitives.py
M	render_povray/ui.py

===================================================================

diff --git a/render_povray/__init__.py b/render_povray/__init__.py
index fdec7d37..cbf7b4c0 100644
--- a/render_povray/__init__.py
+++ b/render_povray/__init__.py
@@ -3563,10 +3563,10 @@ class RenderPovSettingsWorld(PropertyGroup):
             name="Blend Sky", description="Render background with natural progression from horizon to zenith",
             default=False)
     use_sky_paper: BoolProperty(
-            name="Blend Sky", description="Flatten blend or texture coordinates",
+            name="Paper Sky", description="Flatten blend or texture coordinates",
             default=False)
     use_sky_real: BoolProperty(
-            name="Blend Sky", description="Render background with a real horizon, relative to the camera angle",
+            name="Real Sky", description="Render background with a real horizon, relative to the camera angle",
             default=False)
             
     horizon_color: FloatVectorProperty(
@@ -3690,6 +3690,7 @@ def register():
 def unregister():
     del bpy.types.Scene.pov
     del bpy.types.Material.pov
+    del bpy.types.Material.pov_subsurface_scattering
     #del bpy.types.Modifier.pov
     del bpy.types.Texture.pov
     del bpy.types.Object.pov
diff --git a/render_povray/nodes.py b/render_povray/nodes.py
index 79c38a78..a3267565 100644
--- a/render_povray/nodes.py
+++ b/render_povray/nodes.py
@@ -1265,13 +1265,13 @@ class UpdatePreviewMaterial(bpy.types.Operator):
     bl_label = "Update preview"
 
     def execute(self, context):
-        scene=context.scene
+        scene=context.view_layer
         ob=context.object
         for obj in scene.objects:
             if obj != ob:
-                scene.objects.active=obj
+                scene.objects.active = ob
                 break
-        scene.objects.active=ob
+        scene.objects.active = ob
 
     def modal(self, context, event):
         if event.type == 'RIGHTMOUSE':
diff --git a/render_povray/primitives.py b/render_povray/primitives.py
index f9d3cd39..416c1db1 100644
--- a/render_povray/primitives.py
+++ b/render_povray/primitives.py
@@ -585,7 +585,7 @@ class POVRAY_OT_loft_add(bpy.types.Operator):
         ob = bpy.data.objects.new('Loft_shape', loftData)
         scn = bpy.context.scene
         scn.objects.link(ob)
-        scn.objects.active = ob
+        context.view_layer.objects.active = ob
         ob.select_set(True)
         ob.pov.curveshape = "loft"
         return {'FINISHED'}
@@ -1296,7 +1296,7 @@ class POVRAY_OT_prism_add(bpy.types.Operator):
         ob = bpy.data.objects.new('Prism_shape', loftData)
         scn = bpy.context.scene
         scn.objects.link(ob)
-        scn.objects.active = ob
+        context.view_layer.objects.active = ob
         ob.select_set(True)
         ob.pov.curveshape = "prism"
         ob.name = ob.data.name = "Prism"
@@ -1908,7 +1908,7 @@ class ImportPOV(bpy.types.Operator, ImportHelper):
                                     # ob.data.materials.append(bpy.data.materials[matNames[i]])
 
         ##To keep Avogadro Camera angle:
-        # for obj in bpy.context.scene.objects:
+        # for obj in bpy.context.view_layer.objects:
             # if obj.type == "CAMERA":
                 # track = obj.constraints.new(type = "TRACK_TO")
                 # track.target = ob
diff --git a/render_povray/ui.py b/render_povray/ui.py
index ce282134..cfb0051c 100644
--- a/render_povray/ui.py
+++ b/render_povray/ui.py
@@ -104,10 +104,10 @@ class AddPresetWorld(AddPresetBase, bpy.types.Operator):
     preset_subdir = "pov/world"
 
 
-classes = (
-    POV_WORLD_MT_presets,
-    AddPresetWorld,
-    )
+# classes = (
+    # POV_WORLD_MT_presets,
+    # AddPresetWorld,
+    # )
 
 # Example of wrapping every class 'as is'
 from bl_ui import properties_texture
@@ -558,7 +558,7 @@ class AddPresetLamp(AddPresetBase, bpy.types.Operator):
 
 
 
-# Draw into an existing panel
+# Draw into the existing light panel
 def light_panel_func(self, context):
     layout = self.layout
 
@@ -568,10 +568,10 @@ def light_panel_func(self, context):
     row.operator(AddPresetLamp.bl_idname, text="", icon='REMOVE').remove_active = True
 
 
-classes = (
-    POV_LIGHT_MT_presets,
-    AddPresetLamp,
-    )
+# classes = (
+    # POV_LIGHT_MT_presets,
+    # AddPresetLamp,
+    # )
 '''#TORECREATE##DEPRECATED#
 class LIGHT_PT_POV_sunsky(PovLampButtonsPanel, bpy.types.Panel):
     bl_label = properties_data_light.DATA_PT_sunsky.bl_label
@@ -1001,10 +1001,10 @@ def rad_panel_func(self, context):
     row.operator(AddPresetRadiosity.bl_idname, text="", icon='REMOVE').remove_active = True
 
 
-classes = (
-    POV_RADIOSITY_MT_presets,
-    AddPresetRadiosity,
-    )
+# classes = (
+    # POV_RADIOSITY_MT_presets,
+    # AddPresetRadiosity,
+    # )
 
 
 class RENDER_PT_povray_media(WorldButtonsPanel, bpy.types.Panel):
@@ -1085,6 +1085,33 @@ class MODIFIERS_PT_povray_modifiers(ModifierButtonsPanel, bpy.types.Panel):
                         # Inside Vector for CSG
                         col.prop(ob.pov, "inside_vector")
 
+class MATERIAL_MT_POV_sss_presets(bpy.types.Menu):
+    bl_label = "SSS Presets"
+    preset_subdir = "pov/material/sss"
+    preset_operator = "script.execute_preset"
+    draw = bpy.types.Menu.draw_preset
+
+class AddPresetSSS(AddPresetBase, bpy.types.Operator):
+    '''Add an SSS Preset'''
+    bl_idname = "material.sss_preset_add"
+    bl_label = "Add SSS Preset"
+    preset_menu = "MATERIAL_MT_POV_sss_presets"
+
+    # variable used for all preset values
+    preset_defines = [
+        "material = bpy.context.material"
+        ]
+
+    # properties to store in the preset
+    preset_values = [
+        "material.pov_subsurface_scattering.radius",
+        "material.pov_subsurface_scattering.color",
+        ]
+
+    # where to store the preset
+    preset_subdir = "pov/material/sss"
+
+    
 class MATERIAL_PT_POV_sss(MaterialButtonsPanel, bpy.types.Panel):
     bl_label = "Subsurface Scattering"
     bl_options = {'DEFAULT_CLOSED'}
@@ -1112,10 +1139,10 @@ class MATERIAL_PT_POV_sss(MaterialButtonsPanel, bpy.types.Panel):
         layout.active = (sss.use) and (not mat.pov.use_shadeless)
 
         row = layout.row().split()
-        sub = row.row(align=True).split(align=True, percentage=0.75)
-        sub.menu("MATERIAL_MT_sss_presets", text=bpy.types.MATERIAL_MT_sss_presets.bl_label)
-        sub.operator("material.sss_preset_add", text="", icon='ADD')
-        sub.operator("material.sss_preset_add", text="", icon='REMOVE').remove_active = True
+        sub = row.row(align=True).split(align=True, factor=0.75)
+        sub.menu("MATERIAL_MT_POV_sss_presets", text=MATERIAL_MT_POV_sss_presets.bl_label)
+        sub.operator("AddPresetSSS.bl_idname", text="", icon='ADD')
+        sub.operator("AddPresetSSS.bl_idname", text="", icon='REMOVE').remove_active = True
 
         split = layout.split()
 
@@ -2367,6 +2394,8 @@ classes = (
     RENDER_PT_povray_media,
     MODIFIERS_PT_povray_modifiers,
     MATERIAL_PT_POV_sss,
+    MATERIAL_MT_POV_sss_presets,
+    AddPresetSSS,
     MATERIAL_PT_povray_activate_node,
     MATERIAL_PT_povray_active_node,
     MATERIAL_PT_POV_mirror,



More information about the Bf-extensions-cvs mailing list