Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'release/scripts')
-rw-r--r--release/scripts/startup/bl_operators/__init__.py2
-rw-r--r--release/scripts/startup/bl_operators/geometry_nodes.py60
-rw-r--r--release/scripts/startup/bl_operators/simulation.py41
-rw-r--r--release/scripts/startup/bl_ui/space_node.py11
-rw-r--r--release/scripts/startup/nodeitems_builtins.py62
5 files changed, 117 insertions, 59 deletions
diff --git a/release/scripts/startup/bl_operators/__init__.py b/release/scripts/startup/bl_operators/__init__.py
index eff88c835e7..71b2de41d9e 100644
--- a/release/scripts/startup/bl_operators/__init__.py
+++ b/release/scripts/startup/bl_operators/__init__.py
@@ -31,6 +31,7 @@ _modules = [
"console",
"constraint",
"file",
+ "geometry_nodes",
"image",
"mesh",
"node",
@@ -42,7 +43,6 @@ _modules = [
"rigidbody",
"screen_play_rendered_anim",
"sequencer",
- "simulation",
"userpref",
"uvcalc_follow_active",
"uvcalc_lightmap",
diff --git a/release/scripts/startup/bl_operators/geometry_nodes.py b/release/scripts/startup/bl_operators/geometry_nodes.py
new file mode 100644
index 00000000000..374bd4161a7
--- /dev/null
+++ b/release/scripts/startup/bl_operators/geometry_nodes.py
@@ -0,0 +1,60 @@
+# ##### BEGIN GPL LICENSE BLOCK #####
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# ##### END GPL LICENSE BLOCK #####
+
+import bpy
+
+
+def geometry_modifier_poll(context) -> bool:
+ ob = context.object
+
+ # Test object support for geometry node modifier (No volume or hair object support yet)
+ if not ob or ob.type not in {'MESH', 'CURVE', 'SURFACE', 'META', 'FONT', 'POINTCLOUD'}:
+ return False
+
+ return True
+
+
+class NewGeometryNodeTree(bpy.types.Operator):
+ """Create a new geometry node tree"""
+ bl_idname = "node.new_geometry_node_tree"
+ bl_label = "New Geometry Node Tree"
+ bl_options = {'REGISTER', 'UNDO'}
+
+ @classmethod
+ def poll(cls, context):
+ return geometry_modifier_poll(context)
+
+ def execute(self, context):
+ group = bpy.data.node_groups.new("Geometry Nodes", 'GeometryNodeTree')
+ group.inputs.new('NodeSocketGeometry', "Geometry")
+ group.outputs.new('NodeSocketGeometry', "Geometry")
+ input_node = group.nodes.new('NodeGroupInput')
+ output_node = group.nodes.new('NodeGroupOutput')
+ output_node.is_active_output = True
+
+ input_node.location.x = -200 - input_node.width
+ output_node.location.x = 200
+
+ group.links.new(output_node.inputs[0], input_node.outputs[0])
+
+ return {'FINISHED'}
+
+
+classes = (
+ NewGeometryNodeTree,
+)
diff --git a/release/scripts/startup/bl_operators/simulation.py b/release/scripts/startup/bl_operators/simulation.py
deleted file mode 100644
index 0981baa5941..00000000000
--- a/release/scripts/startup/bl_operators/simulation.py
+++ /dev/null
@@ -1,41 +0,0 @@
-# ##### BEGIN GPL LICENSE BLOCK #####
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-#
-# ##### END GPL LICENSE BLOCK #####
-
-import bpy
-
-
-class NewSimulation(bpy.types.Operator):
- """Create a new simulation data block and edit it in the opened simulation editor"""
-
- bl_idname = "simulation.new"
- bl_label = "New Simulation"
- bl_options = {'REGISTER', 'UNDO'}
-
- @classmethod
- def poll(cls, context):
- return context.area.type == 'NODE_EDITOR' and context.space_data.tree_type == 'SimulationNodeTree'
-
- def execute(self, context):
- simulation = bpy.data.simulations.new("Simulation")
- context.space_data.simulation = simulation
- return {'FINISHED'}
-
-
-classes = (
- NewSimulation,
-)
diff --git a/release/scripts/startup/bl_ui/space_node.py b/release/scripts/startup/bl_ui/space_node.py
index c0c38c02c63..4cd38831cdf 100644
--- a/release/scripts/startup/bl_ui/space_node.py
+++ b/release/scripts/startup/bl_ui/space_node.py
@@ -151,13 +151,10 @@ class NODE_HT_header(Header):
if snode_id:
layout.prop(snode_id, "use_nodes")
- elif snode.tree_type == 'SimulationNodeTree':
- row = layout.row(align=True)
- row.prop(snode, "simulation", text="")
- row.operator("simulation.new", text="", icon='ADD')
- simulation = snode.simulation
- if simulation:
- row.prop(snode.simulation, "use_fake_user", text="")
+ elif snode.tree_type == 'GeometryNodeTree':
+ NODE_MT_editor_menus.draw_collapsible(context, layout)
+ layout.separator_spacer()
+ layout.template_ID(snode, "node_tree", new="node.new_geometry_node_tree")
else:
# Custom node tree is edited as independent ID block
diff --git a/release/scripts/startup/nodeitems_builtins.py b/release/scripts/startup/nodeitems_builtins.py
index 8d2b6198fd5..b1789776728 100644
--- a/release/scripts/startup/nodeitems_builtins.py
+++ b/release/scripts/startup/nodeitems_builtins.py
@@ -58,11 +58,11 @@ class TextureNodeCategory(SortedNodeCategory):
context.space_data.tree_type == 'TextureNodeTree')
-class SimulationNodeCategory(SortedNodeCategory):
+class GeometryNodeCategory(SortedNodeCategory):
@classmethod
def poll(cls, context):
return (context.space_data.type == 'NODE_EDITOR' and
- context.space_data.tree_type == 'SimulationNodeTree')
+ context.space_data.tree_type == 'GeometryNodeTree')
# menu entry for node group tools
@@ -77,11 +77,11 @@ node_tree_group_type = {
'CompositorNodeTree': 'CompositorNodeGroup',
'ShaderNodeTree': 'ShaderNodeGroup',
'TextureNodeTree': 'TextureNodeGroup',
- 'SimulationNodeTree': 'SimulationNodeGroup',
+ 'GeometryNodeTree': 'GeometryNodeGroup',
}
-# generic node group items generator for shader, compositor, simulation and texture node groups
+# generic node group items generator for shader, compositor, geometry and texture node groups
def node_group_items(context):
if context is None:
return
@@ -483,13 +483,55 @@ def not_implemented_node(idname):
return NodeItem(idname, label=label)
-simulation_node_categories = [
- # Simulation Nodes
- SimulationNodeCategory("SIM_GROUP", "Group", items=node_group_items),
- SimulationNodeCategory("SIM_LAYOUT", "Layout", items=[
+geometry_node_categories = [
+ # Geometry Nodes
+ GeometryNodeCategory("GEO_ATTRIBUTE", "Attribute", items=[
+ NodeItem("GeometryNodeRandomAttribute"),
+ NodeItem("GeometryNodeAttributeMath"),
+ ]),
+ GeometryNodeCategory("GEO_COLOR", "Color", items=[
+ NodeItem("ShaderNodeValToRGB"),
+ NodeItem("ShaderNodeSeparateRGB"),
+ NodeItem("ShaderNodeCombineRGB"),
+ ]),
+ GeometryNodeCategory("GEO_GEOMETRY", "Geometry", items=[
+ NodeItem("GeometryNodeTransform"),
+ NodeItem("GeometryNodeBoolean"),
+ NodeItem("GeometryNodeJoinGeometry"),
+ ]),
+ GeometryNodeCategory("GEO_INPUT", "Input", items=[
+ NodeItem("GeometryNodeObjectInfo"),
+ NodeItem("FunctionNodeRandomFloat"),
+ NodeItem("ShaderNodeValue"),
+ ]),
+ GeometryNodeCategory("GEO_MESH", "Mesh", items=[
+ NodeItem("GeometryNodeTriangulate"),
+ NodeItem("GeometryNodeEdgeSplit"),
+ NodeItem("GeometryNodeSubdivisionSurface"),
+ ]),
+ GeometryNodeCategory("GEO_POINT", "Point", items=[
+ NodeItem("GeometryNodePointDistribute"),
+ NodeItem("GeometryNodePointInstance"),
+ ]),
+ GeometryNodeCategory("GEO_UTILITIES", "Utilities", items=[
+ NodeItem("ShaderNodeMapRange"),
+ NodeItem("ShaderNodeClamp"),
+ NodeItem("ShaderNodeMath"),
+ NodeItem("FunctionNodeBooleanMath"),
+ NodeItem("FunctionNodeFloatCompare"),
+ ]),
+ GeometryNodeCategory("GEO_VECTOR", "Vector", items=[
+ NodeItem("ShaderNodeSeparateXYZ"),
+ NodeItem("ShaderNodeCombineXYZ"),
+ NodeItem("ShaderNodeVectorMath"),
+ ]),
+ GeometryNodeCategory("GEO_GROUP", "Group", items=node_group_items),
+ GeometryNodeCategory("GEO_LAYOUT", "Layout", items=[
NodeItem("NodeFrame"),
NodeItem("NodeReroute"),
]),
+ # NodeItem("FunctionNodeCombineStrings"),
+ # NodeItem("FunctionNodeGroupInstanceID"),
]
@@ -497,14 +539,14 @@ def register():
nodeitems_utils.register_node_categories('SHADER', shader_node_categories)
nodeitems_utils.register_node_categories('COMPOSITING', compositor_node_categories)
nodeitems_utils.register_node_categories('TEXTURE', texture_node_categories)
- nodeitems_utils.register_node_categories('SIMULATION', simulation_node_categories)
+ nodeitems_utils.register_node_categories('GEOMETRY', geometry_node_categories)
def unregister():
nodeitems_utils.unregister_node_categories('SHADER')
nodeitems_utils.unregister_node_categories('COMPOSITING')
nodeitems_utils.unregister_node_categories('TEXTURE')
- nodeitems_utils.unregister_node_categories('SIMULATION')
+ nodeitems_utils.unregister_node_categories('GEOMETRY')
if __name__ == "__main__":