Skip to content

Commit

Permalink
Revert "POV : fix registering"
Browse files Browse the repository at this point in the history
This reverts commit a885950.
  • Loading branch information
Maurice Raybaud committed May 27, 2021
1 parent a885950 commit e25068e
Show file tree
Hide file tree
Showing 16 changed files with 189 additions and 263 deletions.
14 changes: 5 additions & 9 deletions render_povray/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -250,8 +250,7 @@ def recursive_overwrite(src, dest, ignore=None):
with tempfile.TemporaryDirectory() as temp_dir_path:
temp_zip_path = os.path.join(temp_dir_path, 'master.zip')

# Download zip archive of latest addons master branch commit
# More work needed so we also get the pov presets from addons shared folder.
# Download zip archive of latest addons master branch commit (So we also get presets)
# switch this URL back to the BF hosted one as soon as gitweb snapshot gets fixed
url = 'https://github.com/blender/blender-addons/archive/refs/heads/master.zip'
try:
Expand Down Expand Up @@ -398,10 +397,7 @@ def draw(self, context):
layout.operator("pov.update_addon", icon='FILE_REFRESH')


classes = (
POV_OT_update_addon, # already registered as a subclass
PovrayPreferences
)
classes = (POV_OT_update_addon, PovrayPreferences)


def register():
Expand All @@ -414,7 +410,7 @@ def register():
texturing_properties.register()
object_properties.register()
scripting_properties.register()
#scenography.register()
scenography.register()
render.register()
base_ui.register()
scripting.register()
Expand All @@ -426,15 +422,15 @@ def unregister():
scripting.unregister()
base_ui.unregister()
render.unregister()
#scenography.unregister()
scenography.unregister()
scripting_properties.unregister()
object_properties.unregister()
texturing_properties.unregister()
shading_properties.unregister()
scenography_properties.unregister()
render_properties.unregister()

for cls in classes:
for cls in reversed(classes):
unregister_class(cls)


Expand Down
5 changes: 1 addition & 4 deletions render_povray/object_gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,8 @@

for member in dir(properties_data_modifier):
subclass = getattr(properties_data_modifier, 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))
del properties_data_modifier


Expand Down
2 changes: 1 addition & 1 deletion render_povray/object_primitives.py
Original file line number Diff line number Diff line change
Expand Up @@ -1769,5 +1769,5 @@ def register():


def unregister():
for cls in reversed(classes):
for cls in classes:
unregister_class(cls)
8 changes: 1 addition & 7 deletions render_povray/render.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,7 @@
# #**** END GPL LICENSE BLOCK #****

# <pep8 compliant>

"""Wirte the POV file using this file's functions and some from other modules then render it."""

import bpy
import subprocess
import os
Expand Down Expand Up @@ -1809,11 +1807,7 @@ def execute(self, context):
return {'FINISHED'}


classes = (
PovrayRender,
RenderPovTexturePreview,
RunPovTextRender,
)
classes = (PovrayRender, RenderPovTexturePreview, RunPovTextRender)


def register():
Expand Down
28 changes: 6 additions & 22 deletions render_povray/render_gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,38 +36,26 @@

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.
Expand Down Expand Up @@ -452,17 +440,13 @@ def rad_panel_func(self, context):
'''
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

Expand Down Expand Up @@ -553,10 +537,10 @@ def draw(self, context):
def register():
for cls in classes:
register_class(cls)
RENDER_PT_POV_radiosity.prepend(rad_panel_func)
bpy.types.RENDER_PT_POV_radiosity.prepend(rad_panel_func)


def unregister():
RENDER_PT_POV_radiosity.remove(rad_panel_func)
bpy.types.RENDER_PT_POV_radiosity.remove(rad_panel_func)
for cls in reversed(classes):
unregister_class(cls)
4 changes: 1 addition & 3 deletions render_povray/render_properties.py
Original file line number Diff line number Diff line change
Expand Up @@ -672,9 +672,7 @@ class RenderPovSettingsScene(PropertyGroup):
)


classes = (
RenderPovSettingsScene,
)
classes = (RenderPovSettingsScene,)


def register():
Expand Down
15 changes: 14 additions & 1 deletion render_povray/scenography.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
with world, sky, atmospheric effects such as rainbows or smoke """

import bpy

from bpy.utils import register_class, unregister_class
import os
from imghdr import what # imghdr is a python lib to identify image file types
from math import atan, pi, sqrt, degrees
Expand Down Expand Up @@ -832,3 +832,16 @@ def export_smoke(file, smoke_obj_name, smoke_path, comments, global_matrix, writ
# file.write(" frequency 0\n")
# file.write(" }\n")
# file.write("}\n")


classes = ()


def register():
for cls in classes:
register_class(cls)


def unregister():
for cls in classes:
unregister_class(cls)
66 changes: 14 additions & 52 deletions render_povray/scenography_gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,8 @@

for member in dir(properties_data_camera):
subclass = getattr(properties_data_camera, 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_data_camera

# ##################################
Expand All @@ -54,115 +50,79 @@

for member in dir(properties_physics_common):
subclass = getattr(properties_physics_common, 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_physics_common

# Physics Rigid Bodies wrapping every class 'as is'
from bl_ui import properties_physics_rigidbody

for member in dir(properties_physics_rigidbody):
subclass = getattr(properties_physics_rigidbody, 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_physics_rigidbody

# Physics Rigid Body Constraint wrapping every class 'as is'
from bl_ui import properties_physics_rigidbody_constraint

for member in dir(properties_physics_rigidbody_constraint):
subclass = getattr(properties_physics_rigidbody_constraint, 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_physics_rigidbody_constraint

# Physics Smoke and fluids wrapping every class 'as is'
from bl_ui import properties_physics_fluid

for member in dir(properties_physics_fluid):
subclass = getattr(properties_physics_fluid, 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_physics_fluid

# Physics softbody wrapping every class 'as is'
from bl_ui import properties_physics_softbody

for member in dir(properties_physics_softbody):
subclass = getattr(properties_physics_softbody, 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_physics_softbody

# Physics Field wrapping every class 'as is'
from bl_ui import properties_physics_field

for member in dir(properties_physics_field):
subclass = getattr(properties_physics_field, 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_physics_field

# Physics Cloth wrapping every class 'as is'
from bl_ui import properties_physics_cloth

for member in dir(properties_physics_cloth):
subclass = getattr(properties_physics_cloth, 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_physics_cloth

# Physics Dynamic Paint wrapping every class 'as is'
from bl_ui import properties_physics_dynamicpaint

for member in dir(properties_physics_dynamicpaint):
subclass = getattr(properties_physics_dynamicpaint, 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_physics_dynamicpaint

from bl_ui import properties_particle

for member in dir(properties_particle): # add all "particle" panels from blender
subclass = getattr(properties_particle, 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_particle


Expand Down Expand Up @@ -790,10 +750,12 @@ def register():

for cls in classes:
register_class(cls)
LIGHT_PT_POV_light.prepend(light_panel_func)
bpy.types.LIGHT_PT_POV_light.prepend(light_panel_func)


def unregister():
LIGHT_PT_POV_light.remove(light_panel_func)

bpy.types.LIGHT_PT_POV_light.remove(light_panel_func)
for cls in reversed(classes):
unregister_class(cls)

Loading

0 comments on commit e25068e

Please sign in to comment.