I’m writing a render engine of sorts. I’ve got a basic addon working that populates the list of render engines and I’ve got a basic panel showing. In fact as soon as I enable my addon my panel shows up in the render tab of the properties editor. When I disable my addon the panel is removed.
What I want is for my panel to be added and removed when I change the render engine. When I switch to my render engine I see only my panel. When I switch to a different render engine I see all the panels for the other engine AND I still see mine.
How do I get the behavior I want (which seems like the obvious right behavior)?
My programming is strong, my Python is fair and my Blender API is probably weak. I’m happy to look at tutorials and such but mostly what I see is basic (and about operators) and I’ve covered that.
if bpy.context.scene.render.engine==‘BLENDER_RENDER’:
print (‘Render is = BLENDER_RENDER’)
bpy.context.scene.render.engine=“CYCLES”
print (‘Converted to BLENDER_CYCLES’)
else:
print (‘Render is = CYCLES’)
Thanks for chiming in, Ricky, I’m confused though. Where what I put the test and what do I do in response? Is there an event handler I need to implement when my render engine is selected or deselected? Once I determine my render engine is selected or deselected, how do I add/remove my panel?
Thanks CoDEmanX, that looks to be exactly what I was looking for. For the benefit of others who might read this, I found this documentation on the nature of the poll() method (which I had seen in tutorials but didn’t understand fully what it was for):