I have converted the add-on Flares Wizard to run on Blender 2.8. I am not the original author of the add-on. The add-on ran on Blender 2.79, but it appears that the author has not responded to questions to update it to 2.8, so I took it upon myself to do an update, as it’s a really fantastic add-on.
I have all but two things working. One of them involves the Lens Fare Elements list:
In the v
dropdown button to the right of the list, there are options to Show All, Hide All, and Solo the selected list element. I have gotten these three options to work. Here is an example of how the Solo option works (which both shows and hides flare elements):
def solo_selected_element():
obj = bpy.context.scene.objects
elements = get_flare_elements()
coll, index = get_element_group()
if len(coll) > 0:
active_element = obj[coll[index].object]
for element in elements:
element.hide_set(True)
active_element.hide_set(False)
if len(elements) > 0:
elements[0].animation_data.drivers[0].driver.expression = elements[0].animation_data.drivers[0].driver.expression
What I can’t figure out is how to make the individual elements in the list hide/show by clicking on its associated eyeball icon to the right of the element name. I can click on the eyeball icons and it appears something happens (Cycles redraws the image), but nothing really happens. Likewise, when I perform one of the Show All, Hide All, or Solo options, it doesn’t change the eyeball icon status for the individual elements.
Here is where the Lens Flare Elements list is set up:
# Lens Flare Elements
class FLARES_WIZARD_PT_LensFlaresElements(Panel):
bl_space_type = "VIEW_3D"
bl_region_type = "UI"
bl_category = "Lens Flares"
bl_label = "Lens Flare Elements"
bl_context = "objectmode"
@classmethod
def poll(self, context):
return len(context.scene.flare_group.coll)>0
def draw(self, context):
scn = context.scene
layout = self.layout
row = layout.row()
row.template_list("UI_UL_element", "coll", scn.element_group, "coll", scn.element_group, "index", rows = 2)
col = row.column(align=True)
col.menu("FLARES_WIZARD_MT_add_element_menu", icon="ADD", text="")
col.operator("flare.delete_flare_element", icon='REMOVE', text="")
col.menu("FLARES_WIZARD_MT_element_settings_menu", icon="DOWNARROW_HLT", text="")
It appears that I’m missing some sort of link between the items in the template list and the objects behind the scenes…but I don’t know what it is, or even what to look for.
I’m thinking that it has something to do with this…
def register():
for cls in classes:
bpy.utils.register_class(cls)
bpy.types.Scene.flare_group = bpy.props.PointerProperty(type=FlareGroup)
…where flare_group
is attached to FlareGroup
. I’ve gone down this rabbit hole and haven’t been able to see anything that looks wrong.
Here is my altered code for 2.8: http://sundriftproductions.com/blenderartists/Flares-Wizard-demo-for-2-8.zip
Also, you can download the original script that worked on 2.79 here as a reference (it also includes all of the flare graphics).