Geometry Nodes: Material Index, Set Material

Add Get/Set Nodes for Material Index
Rename Assign Material to Set Material

Differential Revision: https://developer.blender.org/D12837
This commit is contained in:
2021-10-13 08:39:54 -05:00
parent d4e8390e95
commit 24cc552cf4
10 changed files with 180 additions and 19 deletions

View File

@@ -180,6 +180,29 @@ def geometry_input_node_items(context):
yield NodeItem("GeometryNodeInputPosition")
yield NodeItem("GeometryNodeInputRadius")
# Custom Menu for Material Node Input Nodes
def geometry_material_node_items(context):
if context is None:
return
space = context.space_data
if not space:
return
if not space.edit_tree:
return
if geometry_nodes_legacy_poll(context):
yield NodeItem("GeometryNodeLegacyMaterialAssign")
yield NodeItem("GeometryNodeLegacySelectByMaterial")
yield NodeItemCustom(draw=lambda self, layout, context: layout.separator())
yield NodeItem("GeometryNodeMaterialReplace")
yield NodeItemCustom(draw=lambda self, layout, context: layout.separator())
yield NodeItem("GeometryNodeInputMaterialIndex")
yield NodeItem("GeometryNodeMaterialSelection")
yield NodeItemCustom(draw=lambda self, layout, context: layout.separator())
yield NodeItem("GeometryNodeSetMaterial")
yield NodeItem("GeometryNodeSetMaterialIndex")
# Custom Menu for Geometry Node Curves
def point_node_items(context):
if context is None:
@@ -662,14 +685,7 @@ geometry_node_categories = [
NodeItem("GeometryNodeRealizeInstances"),
]),
GeometryNodeCategory("GEO_INPUT", "Input", items=geometry_input_node_items),
GeometryNodeCategory("GEO_MATERIAL", "Material", items=[
NodeItem("GeometryNodeLegacyMaterialAssign", poll=geometry_nodes_legacy_poll),
NodeItem("GeometryNodeLegacySelectByMaterial", poll=geometry_nodes_legacy_poll),
NodeItem("GeometryNodeMaterialAssign"),
NodeItem("GeometryNodeMaterialSelection"),
NodeItem("GeometryNodeMaterialReplace"),
]),
GeometryNodeCategory("GEO_MATERIAL", "Material", items=geometry_material_node_items),
GeometryNodeCategory("GEO_MESH", "Mesh", items=mesh_node_items),
GeometryNodeCategory("GEO_PRIMITIVES_MESH", "Mesh Primitives", items=[
NodeItem("GeometryNodeMeshCircle"),