Geometry Nodes: add simulation support #104924
|
@ -56,7 +56,7 @@ class NodeAddOperator:
|
||||||
else:
|
else:
|
||||||
space.cursor_location = tree.view_center
|
space.cursor_location = tree.view_center
|
||||||
|
|
||||||
# Deselect all nodes in the tree
|
# Deselect all nodes in the tree.
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def deselect_nodes(context):
|
def deselect_nodes(context):
|
||||||
space = context.space_data
|
space = context.space_data
|
||||||
|
@ -120,7 +120,7 @@ class NodeAddOperator:
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
|
||||||
# Simple basic operator for adding a node
|
# Simple basic operator for adding a node.
|
||||||
class NODE_OT_add_node(NodeAddOperator, Operator):
|
class NODE_OT_add_node(NodeAddOperator, Operator):
|
||||||
'''Add a node to the active tree'''
|
'''Add a node to the active tree'''
|
||||||
bl_idname = "node.add_node"
|
bl_idname = "node.add_node"
|
||||||
|
@ -132,7 +132,7 @@ class NODE_OT_add_node(NodeAddOperator, Operator):
|
||||||
description="Node type",
|
description="Node type",
|
||||||
)
|
)
|
||||||
|
|
||||||
# Default execute simply adds a node
|
# Default execute simply adds a node.
|
||||||
def execute(self, context):
|
def execute(self, context):
|
||||||
if self.properties.is_property_set("type"):
|
if self.properties.is_property_set("type"):
|
||||||
self.deselect_nodes(context)
|
self.deselect_nodes(context)
|
||||||
|
|
|
@ -261,7 +261,8 @@ static Vector<const bNode *> get_implicit_origin_nodes(const bNodeTree &ntree, b
|
||||||
if (node.type == GEO_NODE_SIMULATION_OUTPUT) {
|
if (node.type == GEO_NODE_SIMULATION_OUTPUT) {
|
||||||
for (const bNode *sim_input_node :
|
for (const bNode *sim_input_node :
|
||||||
ntree.runtime->nodes_by_type.lookup(nodeTypeFind("GeometryNodeSimulationInput"))) {
|
ntree.runtime->nodes_by_type.lookup(nodeTypeFind("GeometryNodeSimulationInput"))) {
|
||||||
const auto &storage = *static_cast<NodeGeometrySimulationInput *>(sim_input_node->storage);
|
const auto &storage = *static_cast<const NodeGeometrySimulationInput *>(
|
||||||
|
sim_input_node->storage);
|
||||||
if (storage.output_node_id == node.identifier) {
|
if (storage.output_node_id == node.identifier) {
|
||||||
origin_nodes.append(sim_input_node);
|
origin_nodes.append(sim_input_node);
|
||||||
}
|
}
|
||||||
|
@ -274,7 +275,7 @@ static Vector<const bNode *> get_implicit_target_nodes(const bNodeTree &ntree, b
|
||||||
{
|
{
|
||||||
Vector<const bNode *> target_nodes;
|
Vector<const bNode *> target_nodes;
|
||||||
if (node.type == GEO_NODE_SIMULATION_INPUT) {
|
if (node.type == GEO_NODE_SIMULATION_INPUT) {
|
||||||
const auto &storage = *static_cast<NodeGeometrySimulationInput *>(node.storage);
|
const auto &storage = *static_cast<const NodeGeometrySimulationInput *>(node.storage);
|
||||||
if (const bNode *sim_output_node = ntree.node_by_id(storage.output_node_id)) {
|
if (const bNode *sim_output_node = ntree.node_by_id(storage.output_node_id)) {
|
||||||
target_nodes.append(sim_output_node);
|
target_nodes.append(sim_output_node);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue