Blender 2.8 - Panel Location

Hi All

I am writing an add-on for Blender 2.8. I am trying to get the panel to display in the render tab of the properties section.

In Blender 2.79, I believe this would have been as simple as:

bl_space_type = ‘PROPERTIES’
bl_region_type = ‘WINDOW’
bl_context = “render”

That doesn’t seem to work in Blender 2.8. I suspect it’s because the render tab now completely changes depending on what render engine you select. I don’t get an error, just no panel.

I suspect I need a different string for bl_context. I’ve tried everything I can think of - “rendercycles, render_cycles etc. etc.”. Nothing seems to work.

Can anyone help?

Cheers

It should still work, we use identical code in Blender itself still. The render properties got split into render and output but it should appear in the first still.

Hard to say what might be the problem without more context, maybe the poll function is checking for Blender Internal or something like that.

1 Like

@brecht - Thanks for the extremely speedy response!

I am not using a poll() function. The only values I can get to work for bl_context are “material” and “object”.

bl_context = “render”, “output”, “world” etc. do not work for me (and I’ve tried them all). I must be doing something else wrong.

Full file is here in case it helps shed light on the situation.

I tested “render” yesterday and it does still work. Load the “Simple Panel” example and change the bl_context to render.

@brecht is there a way to find all the bl_context options with python? Bl_context options not listed in the API and the only way I know to get those is browse the source code.

@AFWS Sorry, but got to disagree with you there.

At your suggestion, I just did exactly that. Used the Simple Panel example from the Blender 2.8 API reference.

Same problem I have with my add-on. It will only appear in Object or Material. Every other value (“render”, “output” etc.) definitely doesn’t work (for me).

Bit out of my depth, but I assume it wouldn’t be Linux specific?

@brecht @AFWS Screenshot just to provide I am not (completely) insane. I can only post one image as a new user, so I can’t show you that it does work with “object”.

This is using the Simple Panel example from the Blender 2.8 API.

I am using 609d4f5c92c7.

Well, for starters you selected “scene” and not “render” in the Properties. If you tested the Simple Panel example, you will see it adds the “label” ,but not the other properties. I think this is because you might have to have your properties be the same context as the bl_context. I might be completely wrong about this.

@AFWS No, that’s wrong. If you look closely at the screen shot, that’s the render tab in properties not scene (I circled it in Red). You will note that it always says “Scene” at the top, regardless of what tab you are on.

Again, if you look at the screen shot, I am using the Simple Panel example from here, and it defines all of the following (where I have changed bl_context to render as advised):

bl_idname = "OBJECT_PT_select"
bl_label = "Select"
bl_space_type = 'PROPERTIES'
bl_region_type = 'WINDOW'
bl_context = "render"
bl_options = {'DEFAULT_CLOSED'}

It still does not work. It only works if I change bl_context to “material” or “object”

So, sorry, that’s not correct. There is still an issue here.

Yeah, you’re right. I was reading the “Scene” and thinking it wasn’t on the right tab. You can see here it creates a panel ,but doesn’t add anything with “bpy.context.object”. You start of with trying to add properties with "bpy.context.object, so I think this is why you don’t get anything. This is why I’m thinking, you can only draw properties as the same context as the bl_context.

@AFWS thanks.

I think I understand your theory, but I can’t quite reconcile it. Especially as I can’t get the Simple Panel example to work (putting my own code aside for a moment).

Can you do me a favour? Can you just copy and paste that exact file somewhere I can get it? Pastebin or something?

Just want to check I’m not losing my mind.

Right, I’m an idiot.

It was the sodding poll() function after all, just like @brecht originally suggested.

I created the file from an example, and I forgot the stupid thing was even there.

Deleting:

@classmethod
def poll(cls, context):
return (context.object is not None)

Solves my issue.

Thank you for the help everyone. Really appreciated.

@lewis2e,

easiest way to check things. Hover over the item > right click (with pythin info enabled) > edit
than open a text editor panel and select the *.py file which shows. The first time the highlighter could not show the proper location. So do it another time, than it will scroll in to view. To view it more clear enable those handy new 3 icons. Line numbers, word wrapping, syntax hightlight

As you can see in my example, there is a function added RenderButtonsPanel. Thats simple an easy method to reuse repetitive functions/operators. At least as far as i understand that part :slight_smile:

If you scroll to the top or use find, they must add backwards here as well. Search is always forwards and return dialog at the end. It should loop, thats my idea :wink:

Anyways …
at the top is the RenderButtonsPanel
The code you used looks the same and should work

My guess your context is wrong. As you are in the render section. Perhaps try obj = context.scene.object instead of obj = context.object
you probably had an error stating Render does not contain blablaala… object

Without the poll it will also show when old object is highlighted in the outliner. Im not 100% sure about that. But a poll is handy when you dont want the function/panel or what to show or execute.

I was wrong, but context.object return None object. It should be context.active_object

Than it will show the rest as well