diff options
author | Bastien Montagne <bastien@blender.org> | 2021-05-27 18:26:34 +0300 |
---|---|---|
committer | Bastien Montagne <bastien@blender.org> | 2021-05-27 18:26:34 +0300 |
commit | 73c752effe0d3ac18d50ec39a1431b5cb24cd5c2 (patch) | |
tree | 06761f2667d2f875d10ed0fff1af1bc7c20a2bda /render_povray/render_gui.py | |
parent | ea587cffd123977f5b94ed9cea9e81282b6c9b71 (diff) |
Povray: Fix bunch of issues after recent refactor.
Those were breaking automated tests, since (un)registering was not
working properly. Mainly:
* Use `hasattr` instead of try/except when batch-assigning to a variable
that does not always exist.
* Fix some incorrect call to sub-`register()` from parent `unregister()`
functions.
* Remove double definition (in two different files) of World's pov
textures.
Diffstat (limited to 'render_povray/render_gui.py')
-rwxr-xr-x | render_povray/render_gui.py | 24 |
1 files changed, 4 insertions, 20 deletions
diff --git a/render_povray/render_gui.py b/render_povray/render_gui.py index 5148c0d9..018821cb 100755 --- a/render_povray/render_gui.py +++ b/render_povray/render_gui.py @@ -36,38 +36,26 @@ from bl_ui import properties_output for member in dir(properties_output): subclass = getattr(properties_output, member) - try: + if hasattr(subclass, "COMPAT_ENGINES"): subclass.COMPAT_ENGINES.add('POVRAY_RENDER') - except BaseException as e: - print(e.__doc__) - print('An exception occurred: {}'.format(e)) - pass del properties_output from bl_ui import properties_freestyle for member in dir(properties_freestyle): subclass = getattr(properties_freestyle, member) - try: + if hasattr(subclass, "COMPAT_ENGINES"): if not (subclass.bl_space_type == 'PROPERTIES' and subclass.bl_context == "render"): subclass.COMPAT_ENGINES.add('POVRAY_RENDER') # subclass.bl_parent_id = "RENDER_PT_POV_filter" - except BaseException as e: - print(e.__doc__) - print('An exception occurred: {}'.format(e)) - pass del properties_freestyle from bl_ui import properties_view_layer for member in dir(properties_view_layer): subclass = getattr(properties_view_layer, member) - try: + if hasattr(subclass, "COMPAT_ENGINES"): subclass.COMPAT_ENGINES.add('POVRAY_RENDER') - except BaseException as e: - print(e.__doc__) - print('An exception occurred: {}'.format(e)) - pass del properties_view_layer # Use some of the existing buttons. @@ -452,17 +440,13 @@ if check_render_freestyle_svg(): ''' for member in dir(render_freestyle_svg): subclass = getattr(render_freestyle_svg, member) - try: + if hasattr(subclass, "COMPAT_ENGINES"): subclass.COMPAT_ENGINES.add('POVRAY_RENDER') if subclass.bl_idname == "RENDER_PT_SVGExporterPanel": subclass.bl_parent_id = "RENDER_PT_POV_filter" subclass.bl_options = {'HIDE_HEADER'} # subclass.bl_order = 11 print(subclass.bl_info) - except BaseException as e: - print(e.__doc__) - print('An exception occurred: {}'.format(e)) - pass # del render_freestyle_svg.RENDER_PT_SVGExporterPanel.bl_parent_id |