[Bf-extensions-cvs] [180b77ff] master: POV: added doc strings
Maurice Raybaud
noreply at git.blender.org
Fri Dec 13 15:09:56 CET 2019
Commit: 180b77ffa0800fcf7e20cd4403473cb63ceae3b0
Author: Maurice Raybaud
Date: Sun Dec 8 21:41:58 2019 +0100
Branches: master
https://developer.blender.org/rBA180b77ffa0800fcf7e20cd4403473cb63ceae3b0
POV: added doc strings
Hoping it will help the code to be less repulsive to new developers.
===================================================================
M render_povray/ui.py
===================================================================
diff --git a/render_povray/ui.py b/render_povray/ui.py
index 1cb03125..94092121 100644
--- a/render_povray/ui.py
+++ b/render_povray/ui.py
@@ -17,7 +17,7 @@
# ##### END GPL LICENSE BLOCK #####
# <pep8 compliant>
-
+"""User interface for the POV tools"""
import bpy
import sys #really import here and in render.py?
import os #really import here and in render.py?
@@ -191,9 +191,9 @@ from bl_ui import properties_material
for member in dir(properties_material):
subclass = getattr(properties_material, member)
try:
- mat=bpy.context.active_object.active_material
- if (mat and mat.pov.type == "SURFACE"
- and not (mat.pov.material_use_nodes or mat.use_nodes)):
+ # mat=bpy.context.active_object.active_material
+ # if (mat and mat.pov.type == "SURFACE"
+ # and not (mat.pov.material_use_nodes or mat.use_nodes)):
# and (engine in cls.COMPAT_ENGINES)) if subclasses were sorted
subclass.COMPAT_ENGINES.add('POVRAY_RENDER')
except:
@@ -283,16 +283,27 @@ def check_material(mat):
return False
def simple_material(mat):
+ """Test if a material uses nodes"""
if (mat is not None) and (not mat.use_nodes):
return True
return False
def check_add_mesh_extra_objects():
+ """Test if Add mesh extra objects addon is activated
+
+ This addon is currently used to generate the proxy for POV parametric
+ surface which is almost the same priciple as its Math xyz surface
+ """
if "add_mesh_extra_objects" in bpy.context.preferences.addons.keys():
return True
return False
def locate_docpath():
+ """POV can be installed with some include files.
+
+ Get their path as defined in user preferences or registry keys for
+ the user to be able to invoke them."""
+
addon_prefs = bpy.context.preferences.addons[__package__].preferences
# Use the system preference if its set.
pov_documents = addon_prefs.docpath_povray
@@ -326,7 +337,8 @@ def locate_docpath():
return ""
def pov_context_tex_datablock(context):
-
+ """Texture context type recreated as deprecated in blender 2.8"""
+
idblock = context.brush
if idblock and bpy.context.scene.texture_context == 'OTHER':
return idblock
@@ -354,6 +366,9 @@ def pov_context_tex_datablock(context):
return idblock
class RenderButtonsPanel():
+ """Use this class to define buttons from the render tab of
+ properties window."""
+
bl_space_type = 'PROPERTIES'
bl_region_type = 'WINDOW'
bl_context = "render"
@@ -365,6 +380,8 @@ class RenderButtonsPanel():
return (rd.engine in cls.COMPAT_ENGINES)
class ModifierButtonsPanel():
+ """Use this class to define buttons from the modifier tab of
+ properties window."""
bl_space_type = 'PROPERTIES'
bl_region_type = 'WINDOW'
bl_context = "modifier"
@@ -377,6 +394,8 @@ class ModifierButtonsPanel():
return mods and (rd.engine in cls.COMPAT_ENGINES)
class MaterialButtonsPanel():
+ """Use this class to define buttons from the material tab of
+ properties window."""
bl_space_type = 'PROPERTIES'
bl_region_type = 'WINDOW'
bl_context = "material"
@@ -390,6 +409,8 @@ class MaterialButtonsPanel():
class TextureButtonsPanel():
+ """Use this class to define buttons from the texture tab of
+ properties window."""
bl_space_type = 'PROPERTIES'
bl_region_type = 'WINDOW'
bl_context = "texture"
@@ -411,6 +432,8 @@ class TextureButtonsPanel():
class ObjectButtonsPanel():
+ """Use this class to define buttons from the object tab of
+ properties window."""
bl_space_type = 'PROPERTIES'
bl_region_type = 'WINDOW'
bl_context = "object"
@@ -423,6 +446,8 @@ class ObjectButtonsPanel():
return obj and (rd.engine in cls.COMPAT_ENGINES)
class CameraDataButtonsPanel():
+ """Use this class to define buttons from the camera data tab of
+ properties window."""
bl_space_type = 'PROPERTIES'
bl_region_type = 'WINDOW'
bl_context = "data"
@@ -435,6 +460,8 @@ class CameraDataButtonsPanel():
return cam and (rd.engine in cls.COMPAT_ENGINES)
class WorldButtonsPanel():
+ """Use this class to define buttons from the world tab of
+ properties window."""
bl_space_type = 'PROPERTIES'
bl_region_type = 'WINDOW'
bl_context = "world"
@@ -447,6 +474,8 @@ class WorldButtonsPanel():
return wld and (rd.engine in cls.COMPAT_ENGINES)
class TextButtonsPanel():
+ """Use this class to define buttons from the side tab of
+ text window."""
bl_space_type = 'TEXT_EDITOR'
bl_region_type = 'UI'
bl_label = "POV-Ray"
@@ -467,6 +496,8 @@ properties_data_mesh.DATA_PT_context_mesh.COMPAT_ENGINES.add('POVRAY_RENDER')
## by recreating custom panels inheriting their properties
class PovDataButtonsPanel(properties_data_mesh.MeshButtonsPanel):
+ """Use this class to define buttons from the edit data tab of
+ properties window."""
COMPAT_ENGINES = {'POVRAY_RENDER'}
POV_OBJECT_TYPES = {'PLANE', 'BOX', 'SPHERE', 'CYLINDER', 'CONE', 'TORUS', 'BLOB',
'ISOSURFACE', 'SUPERELLIPSOID', 'SUPERTORUS', 'HEIGHT_FIELD',
@@ -551,6 +582,8 @@ properties_data_light.DATA_PT_context_light.COMPAT_ENGINES.add('POVRAY_RENDER')
## make some native panels contextual to some object variable
## by recreating custom panels inheriting their properties
class PovLampButtonsPanel(properties_data_light.DataButtonsPanel):
+ """Use this class to define buttons from the light data tab of
+ properties window."""
COMPAT_ENGINES = {'POVRAY_RENDER'}
POV_OBJECT_TYPES = {'RAINBOW'}
@@ -578,6 +611,8 @@ class LIGHT_PT_POV_light(PovLampButtonsPanel, Panel):
draw = properties_data_light.DATA_PT_light.draw
class LIGHT_MT_POV_presets(bpy.types.Menu):
+ """Use this class to define preset menu for pov lights."""
+
bl_label = "Lamp Presets"
preset_subdir = "pov/lamp"
preset_operator = "script.execute_preset"
@@ -585,6 +620,8 @@ class LIGHT_MT_POV_presets(bpy.types.Menu):
class LIGHT_OT_POV_add_preset(AddPresetBase, Operator):
+ """Use this class to define pov world buttons."""
+
'''Add a Lamp Preset'''
bl_idname = "object.light_preset_add"
bl_label = "Add Lamp Preset"
@@ -843,6 +880,8 @@ class LIGHT_PT_POV_falloff_curve(PovLampButtonsPanel, Panel):
draw = properties_data_light.DATA_PT_falloff_curve.draw
class OBJECT_PT_POV_rainbow(PovLampButtonsPanel, Panel):
+ """Use this class to define buttons from the rainbow panel of
+ properties window. inheriting lamp buttons panel class"""
bl_label = "POV-Ray Rainbow"
COMPAT_ENGINES = {'POVRAY_RENDER'}
#bl_options = {'HIDE_HEADER'}
@@ -886,6 +925,7 @@ del properties_data_light
###############################################################################
class WORLD_PT_POV_world(WorldButtonsPanel, Panel):
+ """Use this class to define pov world buttons."""
bl_label = "World"
COMPAT_ENGINES = {'POVRAY_RENDER'}
@@ -916,6 +956,8 @@ class WORLD_PT_POV_world(WorldButtonsPanel, Panel):
#row.prop(world, "color_range")
class WORLD_PT_POV_mist(WorldButtonsPanel, Panel):
+ """Use this class to define pov mist buttons."""
+
bl_label = "Mist"
bl_options = {'DEFAULT_CLOSED'}
COMPAT_ENGINES = {'POVRAY_RENDER'}
@@ -945,6 +987,8 @@ class WORLD_PT_POV_mist(WorldButtonsPanel, Panel):
layout.prop(world.mist_settings, "falloff")
class RENDER_PT_POV_export_settings(RenderButtonsPanel, Panel):
+ """Use this class to define pov ini settingss buttons."""
+
bl_label = "Start Options"
bl_options = {'DEFAULT_CLOSED'}
COMPAT_ENGINES = {'POVRAY_RENDER'}
@@ -992,6 +1036,8 @@ class RENDER_PT_POV_export_settings(RenderButtonsPanel, Panel):
class RENDER_PT_POV_render_settings(RenderButtonsPanel, Panel):
+ """Use this class to define pov render settings buttons."""
+
bl_label = "Global Settings"
bl_icon = 'SETTINGS'
bl_options = {'DEFAULT_CLOSED'}
@@ -1041,6 +1087,8 @@ class RENDER_PT_POV_render_settings(RenderButtonsPanel, Panel):
row.prop(scene.pov, "alpha_mode")
class RENDER_PT_POV_photons(RenderButtonsPanel, Panel):
+ """Use this class to define pov photons buttons."""
+
bl_label = "Photons"
bl_options = {'DEFAULT_CLOSED'}
COMPAT_ENGINES = {'POVRAY_RENDER'}
@@ -1085,6 +1133,8 @@ class RENDER_PT_POV_photons(RenderButtonsPanel, Panel):
#end main photons
class RENDER_PT_POV_antialias(RenderButtonsPanel, Panel):
+ """Use this class to define pov antialiasing buttons."""
+
bl_label = "Anti-Aliasing"
bl_options = {'DEFAULT_CLOSED'}
COMPAT_ENGINES = {'POVRAY_RENDER'}
@@ -1145,6 +1195,8 @@ class RENDER_PT_POV_antialias(RenderButtonsPanel, Panel):
class RENDER_PT_POV_radiosity(RenderButtonsPanel, Panel):
+ """Use this class to define pov radiosity buttons."""
+
bl_label = "Diffuse Radiosity"
bl_options = {'DEFAULT_CLOSED'}
COMPAT_ENGINES = {'POVRAY_RENDER'}
@@ -1200,6 +1252,8 @@ class RENDER_PT_POV_radiosity(RenderButtonsPanel, Panel):
class POV_RADIOSITY_MT_presets(bpy.types.Menu):
+ """Use this class to define pov radiosity presets menu."""
+
bl_label = "Radiosity Presets"
preset_subdir = "pov/radiosity"
preset_operator = "script.execute_preset"
@@ -1207,6 +1261,8 @@ class POV_RADIOSITY_MT_presets(bpy.types.Menu):
class RENDER_OT_POV_radiosity_add_preset(AddPresetBase, Operator):
+ """Use this class to define pov radiosity add presets button."""
+
'''Add a Radiosity Preset'''
bl_idname = "scene.radiosity_preset_add"
bl_label = "Add Radiosity Preset"
@@ -1255,6 +1311,8 @@ def rad_panel_func(self, context):
row.operator(RENDER_OT_POV_radiosity_add_preset.bl_idname, text="", icon='REMOVE').remove_active = True
class RENDER_PT_POV_media(WorldButtonsPanel, Panel):
+ """Use this class to define a pov global atmospheric media buttons."""
+
bl_label = "Atmosphere Media"
COMPAT_ENGINES = {'POVRAY_RENDER'}
@@ -1304,6 +1362,8 @@ class RENDER_PT_POV_media(Worl
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-extensions-cvs
mailing list