Page MenuHome

Patch for T57723 Add all Material options to Material Editor
ClosedPublic

Authored by Lucas Boutrot (thornydre) on Nov 10 2018, 12:31 AM.

Details

Summary

This duplicates the "Options" and "Viewport Display" panel of the Material properties into the sidebar of the Material node editor.

I got this working, don't know if it is right so let me know so I can fix the issues.

Diff Detail

Repository
rB Blender

Event Timeline

Thanks.

However, we should not actually duplicate the code for the panel twice. This would make the code difficult to maintain over time. Instead, I believe there is a way to import panels from other areas.

An example is in space_view3d_toolbar.py:

from .properties_paint_common import (
    UnifiedPaintPanel,
    brush_texture_settings,
    brush_texpaint_common,
    brush_mask_texture_settings,
)

You should be able to do the same here too.

William Reynish (billreynish) requested changes to this revision.Nov 10 2018, 12:43 AM
This revision now requires changes to proceed.Nov 10 2018, 12:43 AM

Thank you for the feedback, here is my second attempt, I got it working without duplicating the code, I didn't know if I had to keep the Panels headers duplicated or not, but if not, I can do it.

At the moment the only thing that doesn't work really good is that the preview is not refreshing unless you resize the sidebar, is their a way to force it to refresh when changing the render engine, the preview mesh or any material data ?

Brecht Van Lommel (brecht) requested changes to this revision.Nov 12 2018, 11:30 AM

The preview render updates are handled in the properties editor C code, through the sbuts->preview. This system would need to be updated to work for the node editor as well, or be rewritten to not be tied to a specific editor so much. Unless you want to deeply dive into the C code I would leave the preview panel out of this patch.

This also only does the panels for Eevee, not Cycles.

release/scripts/startup/bl_ui/space_node.py
570

This is hardcoded to use a material named "Material". It should instead use the active ID in the node editor, and check in the poll function if it is a material. This is context.space_data.id.

This revision now requires changes to proceed.Nov 12 2018, 11:30 AM

Thanks a lot for your feedbacks, I just have a few questions about this patch :

  • Can I do a first pass without the Preview panel ? I would like to give it a try, but maybe after this first pass is done ?
  • I noticed that in EEVEE has a panel named Options, and Cycles a panel named Settings, maybe they should have the same name right ?
  • Is there a reason why the Viewport Display panel is at the bottom in EEVEE and at the top in Cycles ?

I removed the Preview panel for now, and added the Cycles panels.

As I asked above, should I rename the Options panel of EEVEE for "Settings" ?

Yes it's inconsistent that this panel is called Options in Eevee, but Settings in Cycles. Ideally we should pick the same name. I slightly prefer 'Options' here, because everything else is also a setting. These things are like extra options.

Patch looks ok to me - @Brecht Van Lommel (brecht): Do you want to check if the code is ok?

Brecht Van Lommel (brecht) requested changes to this revision.Nov 17 2018, 2:55 AM
Brecht Van Lommel (brecht) added inline comments.
intern/cycles/blender/addon/ui.py
2008

This bl_context line should be left out, it does nothing in the node editor.

2013

You are not testing if this ID is a material datablock rather than e.g. a scene or texture datablock.

This revision now requires changes to proceed.Nov 17 2018, 2:55 AM
Lucas Boutrot (thornydre) marked 3 inline comments as done.

I updated the name of the Settings Panel to Options for Cycles, hope this is ok, I can change it back if not.

I also added bl_category for the Panels in the node editor because they were showing in another tab (could be the way to go ?)

I hope the rest is fine :) Cheers !

Functionality seems ok to me.

This revision was not accepted when it landed; it landed in state Needs Review.Fri, Dec 7, 12:59 AM
This revision was automatically updated to reflect the committed changes.

Committed now, with some modifications to reduce code, fix poll functions, and use consistent settings/options naming.

Just saw the blender today video, the viewport display for the world node editor is empty, and still use the panels from the material nod editor, I can fix it tonight :)