Material Override¶
A popup panel and operator set for managing the active view layer's material_override slot. It lists every material in the file, lets you apply or clear the override in one click, and offers utilities to refresh or pre-generate material previews so the panel can be browsed quickly.
Overview¶
Blender's view layer material override is buried in Properties > View Layer. This operator surfaces it as a floating panel callable from the 3D View, showing all scene materials in either a compact list or a grid ("Fancy Mode") and applying the override on click. Companion operators clear the override, force a refresh of cached previews, or pre-generate all previews so they survive a .blend save.
Use this when you want to swap the whole render to a clay/AO/checker material per view layer without manually selecting objects.
Usage¶
- Works in the 3D Viewport (the panel operator's
pollrequiresVIEW_3D). - No default keymap binding — invoke via menu / F3 search / Pie.
- The panel header offers a
Clearbutton next to the current override and aFancy Modetoggle that switches between a list and an icon grid (grid columns are auto-fit to a 5:3 aspect ratio). - Clicking a material name in the panel calls
iops.material_override_applywith that material; the active material is shown depressed with a check mark.
Properties¶
iops.material_override_apply¶
| Name | Type | Default | Description |
|---|---|---|---|
| material_name | StringProperty | "" | Name of the material to set as the view layer override. Must exist in bpy.data.materials. |
The other registered operators (iops.material_override_clear, iops.material_override_refresh_previews, iops.material_override_generate_previews, iops.material_override_clear_rendering_flag, iops.call_panel_material_override) take no properties.
Notes¶
- Registered alongside the popup operator:
IOPS_OT_Material_Override_Apply(iops.material_override_apply) — setsview_layer.material_overrideto the named material. REGISTER, UNDO.IOPS_OT_Material_Override_Clear(iops.material_override_clear) — sets the override toNone. REGISTER, UNDO.IOPS_OT_Material_Override_Refresh_Previews(iops.material_override_refresh_previews) — callsmat.preview.reload()on every material so caches re-render lazily.IOPS_OT_Material_Override_Generate_Previews(iops.material_override_generate_previews) — callsmat.preview_ensure()on every material to pre-bake previews so they save with the file.IOPS_OT_Material_Override_Clear_Rendering_Flag(iops.material_override_clear_rendering_flag) — resetsis_renderingon the settings PropertyGroup. INTERNAL.IOPS_PT_Material_Override_Panel— the popup panel drawn bywm.call_panel.IOPS_MaterialOverrideSettings— scene PropertyGroup attached asscene.iops_material_override_settings; storesfancy_mode(BoolProperty, defaultFalse).
- The panel draws static
SHADING_RENDERED/MATERIAL_DATAicons rather than live material previews to avoid blocking the UI during draw. UseRefresh Previews/Generate All Previewsoperators explicitly if you need preview thumbnails. - The invoke path catches the
drawing/renderingRuntimeError thatwm.call_panelraises when Blender is mid-redraw and reports a friendly "try again in a moment" message instead of failing. - The override is per view layer — switching view layers shows that layer's own override state.