Simulation nodes: UI for simulation state items in sidebar #106919
|
@ -4092,7 +4092,7 @@ static void rna_SimulationStateItem_update(Main *bmain, Scene *UNUSED(scene), Po
|
|||
{
|
||||
bNodeTree *ntree = (bNodeTree *)ptr->owner_id;
|
||||
NodeSimulationItem *item = (NodeSimulationItem *)ptr->data;
|
||||
bNode *node = node_geo_simulation_output_find_node_by_item(ntree, item);
|
||||
bNode *node = NOD_geometry_simulation_output_find_node_by_item(ntree, item);
|
||||
|
||||
BKE_ntree_update_tag_node_property(ntree, node);
|
||||
ED_node_tree_propagate_change(NULL, bmain, ntree);
|
||||
|
@ -4102,11 +4102,11 @@ static void rna_SimulationStateItem_name_set(PointerRNA *ptr, const char *value)
|
|||
{
|
||||
bNodeTree *ntree = (bNodeTree *)ptr->owner_id;
|
||||
NodeSimulationItem *item = (NodeSimulationItem *)ptr->data;
|
||||
bNode *node = node_geo_simulation_output_find_node_by_item(ntree, item);
|
||||
bNode *node = NOD_geometry_simulation_output_find_node_by_item(ntree, item);
|
||||
NodeGeometrySimulationOutput *sim = (NodeGeometrySimulationOutput *)node->storage;
|
||||
|
||||
const char *defname = nodeStaticSocketLabel(item->socket_type, 0);
|
||||
node_geo_simulation_output_item_set_unique_name(sim, item, value, defname);
|
||||
NOD_geometry_simulation_output_item_set_unique_name(sim, item, value, defname);
|
||||
}
|
||||
|
||||
static void rna_SimulationStateItem_color_get(PointerRNA *ptr, float *values)
|
||||
|
@ -4122,7 +4122,7 @@ static PointerRNA rna_NodeGeometrySimulationInput_paired_output_get(PointerRNA *
|
|||
{
|
||||
bNodeTree *ntree = (bNodeTree *)ptr->owner_id;
|
||||
bNode *node = (bNode *)ptr->data;
|
||||
bNode *output_node = node_geo_simulation_input_get_paired_output(ntree, node);
|
||||
bNode *output_node = NOD_geometry_simulation_input_get_paired_output(ntree, node);
|
||||
PointerRNA r_ptr;
|
||||
RNA_pointer_create(&ntree->id, &RNA_Node, output_node, &r_ptr);
|
||||
return r_ptr;
|
||||
|
@ -4158,7 +4158,7 @@ static NodeSimulationItem *rna_NodeGeometrySimulationOutput_items_new(
|
|||
const char *name)
|
||||
{
|
||||
NodeGeometrySimulationOutput *sim = (NodeGeometrySimulationOutput *)node->storage;
|
||||
NodeSimulationItem *item = node_geo_simulation_output_add_item(sim, (short)socket_type, name);
|
||||
NodeSimulationItem *item = NOD_geometry_simulation_output_add_item(sim, (short)socket_type, name);
|
||||
|
||||
if (item == NULL) {
|
||||
BKE_report(reports, RPT_ERROR, "Unable to create socket");
|
||||
|
@ -4180,11 +4180,11 @@ static void rna_NodeGeometrySimulationOutput_items_remove(ID *id,
|
|||
NodeSimulationItem *item)
|
||||
{
|
||||
NodeGeometrySimulationOutput *sim = (NodeGeometrySimulationOutput *)node->storage;
|
||||
if (!node_geo_simulation_output_contains_item(sim, item)) {
|
||||
if (!NOD_geometry_simulation_output_contains_item(sim, item)) {
|
||||
BKE_reportf(reports, RPT_ERROR, "Unable to locate item '%s' in node", item->name);
|
||||
}
|
||||
else {
|
||||
node_geo_simulation_output_remove_item(sim, item);
|
||||
NOD_geometry_simulation_output_remove_item(sim, item);
|
||||
|
||||
bNodeTree *ntree = (bNodeTree *)id;
|
||||
BKE_ntree_update_tag_node_property(ntree, node);
|
||||
|
@ -4198,7 +4198,7 @@ static void rna_NodeGeometrySimulationOutput_items_clear(ID *id,
|
|||
Main *bmain)
|
||||
{
|
||||
NodeGeometrySimulationOutput *sim = (NodeGeometrySimulationOutput *)node->storage;
|
||||
node_geo_simulation_output_clear_items(sim);
|
||||
NOD_geometry_simulation_output_clear_items(sim);
|
||||
|
||||
bNodeTree *ntree = (bNodeTree *)id;
|
||||
BKE_ntree_update_tag_node_property(ntree, node);
|
||||
|
@ -4218,7 +4218,7 @@ static void rna_NodeGeometrySimulationOutput_items_move(ID *id,
|
|||
return;
|
||||
}
|
||||
|
||||
node_geo_simulation_output_move_item(sim, from_index, to_index);
|
||||
NOD_geometry_simulation_output_move_item(sim, from_index, to_index);
|
||||
|
||||
bNodeTree *ntree = (bNodeTree *)id;
|
||||
BKE_ntree_update_tag_node_property(ntree, node);
|
||||
|
@ -4230,7 +4230,7 @@ static PointerRNA rna_NodeGeometrySimulationOutput_active_item_get(PointerRNA *p
|
|||
{
|
||||
bNode *node = (bNode *)ptr->data;
|
||||
NodeGeometrySimulationOutput *sim = (NodeGeometrySimulationOutput *)node->storage;
|
||||
NodeSimulationItem *item = node_geo_simulation_output_get_active_item(sim);
|
||||
NodeSimulationItem *item = NOD_geometry_simulation_output_get_active_item(sim);
|
||||
PointerRNA r_ptr;
|
||||
RNA_pointer_create(ptr->owner_id, &RNA_SimulationStateItem, item, &r_ptr);
|
||||
return r_ptr;
|
||||
|
@ -4240,7 +4240,7 @@ static void rna_NodeGeometrySimulationOutput_active_item_set(PointerRNA *ptr, Po
|
|||
{
|
||||
bNode *node = (bNode *)ptr->data;
|
||||
NodeGeometrySimulationOutput *sim = (NodeGeometrySimulationOutput *)node->storage;
|
||||
node_geo_simulation_output_set_active_item(sim, (NodeSimulationItem *)value.data);
|
||||
NOD_geometry_simulation_output_set_active_item(sim, (NodeSimulationItem *)value.data);
|
||||
}
|
||||
|
||||
/* ******** Node Socket Types ******** */
|
||||
|
|
|
@ -16,16 +16,16 @@ void register_node_type_geo_custom_group(bNodeType *ntype);
|
|||
/** \name Simulation Input Node
|
||||
* \{ */
|
||||
|
||||
struct bNode *node_geo_simulation_input_get_paired_output(
|
||||
struct bNode *NOD_geometry_simulation_input_get_paired_output(
|
||||
struct bNodeTree *node_tree, const struct bNode *simulation_input_node);
|
||||
|
||||
/**
|
||||
* Pair a simulation input node with an output node.
|
||||
* \return True if pairing the node was successful.
|
||||
*/
|
||||
bool node_geo_simulation_input_pair_with_output(const struct bNodeTree *node_tree,
|
||||
struct bNode *simulation_input_node,
|
||||
const struct bNode *simulation_output_node);
|
||||
bool NOD_geometry_simulation_input_pair_with_output(const struct bNodeTree *node_tree,
|
||||
struct bNode *simulation_input_node,
|
||||
const struct bNode *simulation_output_node);
|
||||
|
||||
/** \} */
|
||||
|
||||
|
@ -36,44 +36,45 @@ bool node_geo_simulation_input_pair_with_output(const struct bNodeTree *node_tre
|
|||
/** Set a unique item name.
|
||||
* @return True if the unique name differs from the original name.
|
||||
*/
|
||||
bool node_geo_simulation_output_item_set_unique_name(struct NodeGeometrySimulationOutput *sim,
|
||||
struct NodeSimulationItem *item,
|
||||
const char *name, const char *defname);
|
||||
bool NOD_geometry_simulation_output_item_set_unique_name(struct NodeGeometrySimulationOutput *sim,
|
||||
|
||||
struct NodeSimulationItem *item,
|
||||
const char *name,
|
||||
const char *defname);
|
||||
|
||||
/** Find the node owning this simulation output data. */
|
||||
bNode *node_geo_simulation_output_find_node_by_data(
|
||||
bNode *NOD_geometry_simulation_output_find_node_by_data(
|
||||
struct bNodeTree *ntree, const struct NodeGeometrySimulationOutput *sim);
|
||||
/** Find the node owning this simulation state item. */
|
||||
bNode *node_geo_simulation_output_find_node_by_item(struct bNodeTree *ntree,
|
||||
const struct NodeSimulationItem *item);
|
||||
bNode *NOD_geometry_simulation_output_find_node_by_item(struct bNodeTree *ntree,
|
||||
const struct NodeSimulationItem *item);
|
||||
|
||||
bool node_geo_simulation_output_contains_item(struct NodeGeometrySimulationOutput *sim,
|
||||
const struct NodeSimulationItem *item);
|
||||
struct NodeSimulationItem *node_geo_simulation_output_get_active_item(
|
||||
bool NOD_geometry_simulation_output_contains_item(struct NodeGeometrySimulationOutput *sim,
|
||||
const struct NodeSimulationItem *item);
|
||||
struct NodeSimulationItem *NOD_geometry_simulation_output_get_active_item(
|
||||
struct NodeGeometrySimulationOutput *sim);
|
||||
void node_geo_simulation_output_set_active_item(struct NodeGeometrySimulationOutput *sim,
|
||||
struct NodeSimulationItem *item);
|
||||
struct NodeSimulationItem *node_geo_simulation_output_find_item(
|
||||
void NOD_geometry_simulation_output_set_active_item(struct NodeGeometrySimulationOutput *sim,
|
||||
struct NodeSimulationItem *item);
|
||||
struct NodeSimulationItem *NOD_geometry_simulation_output_find_item(
|
||||
struct NodeGeometrySimulationOutput *sim, const char *name);
|
||||
struct NodeSimulationItem *node_geo_simulation_output_add_item(
|
||||
struct NodeSimulationItem *NOD_geometry_simulation_output_add_item(
|
||||
struct NodeGeometrySimulationOutput *sim, short socket_type, const char *name);
|
||||
struct NodeSimulationItem *node_geo_simulation_output_insert_item(
|
||||
struct NodeSimulationItem *NOD_geometry_simulation_output_insert_item(
|
||||
struct NodeGeometrySimulationOutput *sim, short socket_type, const char *name, int index);
|
||||
struct NodeSimulationItem *node_geo_simulation_output_add_item_from_socket(
|
||||
struct NodeSimulationItem *NOD_geometry_simulation_output_add_item_from_socket(
|
||||
struct NodeGeometrySimulationOutput *sim,
|
||||
const struct bNode *from_node,
|
||||
const struct bNodeSocket *from_sock);
|
||||
struct NodeSimulationItem *node_geo_simulation_output_insert_item_from_socket(
|
||||
struct NodeSimulationItem *NOD_geometry_simulation_output_insert_item_from_socket(
|
||||
struct NodeGeometrySimulationOutput *sim,
|
||||
const struct bNode *from_node,
|
||||
const struct bNodeSocket *from_sock,
|
||||
int index);
|
||||
void node_geo_simulation_output_remove_item(struct NodeGeometrySimulationOutput *sim,
|
||||
struct NodeSimulationItem *item);
|
||||
void node_geo_simulation_output_clear_items(struct NodeGeometrySimulationOutput *sim);
|
||||
void node_geo_simulation_output_move_item(struct NodeGeometrySimulationOutput *sim,
|
||||
int from_index,
|
||||
int to_index);
|
||||
void NOD_geometry_simulation_output_remove_item(struct NodeGeometrySimulationOutput *sim,
|
||||
struct NodeSimulationItem *item);
|
||||
void NOD_geometry_simulation_output_clear_items(struct NodeGeometrySimulationOutput *sim);
|
||||
void NOD_geometry_simulation_output_move_item(struct NodeGeometrySimulationOutput *sim,
|
||||
int from_index,
|
||||
int to_index);
|
||||
|
||||
/** \} */
|
||||
|
||||
|
|
|
@ -142,7 +142,7 @@ static bool node_insert_link(bNodeTree *ntree, bNode *node, bNodeLink *link)
|
|||
|
||||
if (link->tonode == node) {
|
||||
if (link->tosock->identifier == StringRef("__extend__")) {
|
||||
if (const NodeSimulationItem *item = node_geo_simulation_output_add_item_from_socket(
|
||||
if (const NodeSimulationItem *item = NOD_geometry_simulation_output_add_item_from_socket(
|
||||
&storage, link->fromnode, link->fromsock)) {
|
||||
update_node_declaration_and_sockets(*ntree, *node);
|
||||
link->tosock = nodeFindSocket(node, SOCK_IN, item->name);
|
||||
|
@ -155,7 +155,7 @@ static bool node_insert_link(bNodeTree *ntree, bNode *node, bNodeLink *link)
|
|||
else {
|
||||
BLI_assert(link->fromnode == node);
|
||||
if (link->fromsock->identifier == StringRef("__extend__")) {
|
||||
if (const NodeSimulationItem *item = node_geo_simulation_output_add_item_from_socket(
|
||||
if (const NodeSimulationItem *item = NOD_geometry_simulation_output_add_item_from_socket(
|
||||
&storage, link->tonode, link->tosock)) {
|
||||
update_node_declaration_and_sockets(*ntree, *node);
|
||||
link->fromsock = nodeFindSocket(node, SOCK_OUT, item->name);
|
||||
|
@ -186,8 +186,8 @@ void register_node_type_geo_simulation_input()
|
|||
nodeRegisterType(&ntype);
|
||||
}
|
||||
|
||||
bNode *node_geo_simulation_input_get_paired_output(bNodeTree *node_tree,
|
||||
const bNode *simulation_input_node)
|
||||
bNode *NOD_geometry_simulation_input_get_paired_output(bNodeTree *node_tree,
|
||||
const bNode *simulation_input_node)
|
||||
{
|
||||
namespace file_ns = blender::nodes::node_geo_simulation_input_cc;
|
||||
|
||||
|
|
|
@ -276,7 +276,7 @@ static bool node_insert_link(bNodeTree *ntree, bNode *node, bNodeLink *link)
|
|||
NodeGeometrySimulationOutput &storage = node_storage(*node);
|
||||
if (link->tonode == node) {
|
||||
if (link->tosock->identifier == StringRef("__extend__")) {
|
||||
if (const NodeSimulationItem *item = node_geo_simulation_output_add_item_from_socket(
|
||||
if (const NodeSimulationItem *item = NOD_geometry_simulation_output_add_item_from_socket(
|
||||
&storage, link->fromnode, link->fromsock)) {
|
||||
update_node_declaration_and_sockets(*ntree, *node);
|
||||
link->tosock = nodeFindSocket(node, SOCK_IN, item->name);
|
||||
|
@ -289,7 +289,7 @@ static bool node_insert_link(bNodeTree *ntree, bNode *node, bNodeLink *link)
|
|||
else {
|
||||
BLI_assert(link->fromnode == node);
|
||||
if (link->fromsock->identifier == StringRef("__extend__")) {
|
||||
if (const NodeSimulationItem *item = node_geo_simulation_output_add_item_from_socket(
|
||||
if (const NodeSimulationItem *item = NOD_geometry_simulation_output_add_item_from_socket(
|
||||
&storage, link->fromnode, link->tosock)) {
|
||||
update_node_declaration_and_sockets(*ntree, *node);
|
||||
link->fromsock = nodeFindSocket(node, SOCK_OUT, item->name);
|
||||
|
@ -322,8 +322,8 @@ void register_node_type_geo_simulation_output()
|
|||
nodeRegisterType(&ntype);
|
||||
}
|
||||
|
||||
bNode *node_geo_simulation_output_find_node_by_data(bNodeTree *ntree,
|
||||
const NodeGeometrySimulationOutput *sim)
|
||||
bNode *NOD_geometry_simulation_output_find_node_by_data(bNodeTree *ntree,
|
||||
Hans Goudey
commented
`NOD_geometry_simulation_output_find_node_by_data` is unused, and it doesn't seem like we should need this. If we do, I'd keep it local to RNA.
Lukas Tönne
commented
Downside of putting this in RNA is that we don't have access to the C++ functions like Downside of putting this in RNA is that we don't have access to the C++ functions like `ntree->nodes_by_type` there.
Lukas Tönne
commented
Removed the unused function though. Removed the unused function though.
|
||||
const NodeGeometrySimulationOutput *sim)
|
||||
{
|
||||
Hans Goudey
commented
I guess this is slightly different, but usually a method like this is called I guess this is slightly different, but usually a method like this is called `items_for_write()`. Either way is fine with me.
Lukas Tönne
commented
We already have We already have `NodeSimulationItem *items` for the array, so `Span<NodeSimulationItem> items()` is a conflict, otherwise `items` + `items_for_write` would work.
Lukas Tönne
commented
I opted for I opted for `items_span_for_write` now, if that's ok for you.
|
||||
for (bNode *node : ntree->nodes_by_type("GeometryNodeSimulationOutput")) {
|
||||
if (node->storage == sim) {
|
||||
|
@ -333,22 +333,22 @@ bNode *node_geo_simulation_output_find_node_by_data(bNodeTree *ntree,
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
bNode *node_geo_simulation_output_find_node_by_item(bNodeTree *ntree,
|
||||
const NodeSimulationItem *item)
|
||||
bNode *NOD_geometry_simulation_output_find_node_by_item(bNodeTree *ntree,
|
||||
const NodeSimulationItem *item)
|
||||
{
|
||||
for (bNode *node : ntree->nodes_by_type("GeometryNodeSimulationOutput")) {
|
||||
Hans Goudey
commented
These functions should call These functions should call `ensure_topology_cache()` before they use it.
|
||||
NodeGeometrySimulationOutput *sim = static_cast<NodeGeometrySimulationOutput *>(node->storage);
|
||||
if (node_geo_simulation_output_contains_item(sim, item)) {
|
||||
if (NOD_geometry_simulation_output_contains_item(sim, item)) {
|
||||
return node;
|
||||
}
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
bool node_geo_simulation_output_item_set_unique_name(NodeGeometrySimulationOutput *sim,
|
||||
NodeSimulationItem *item,
|
||||
const char *name,
|
||||
const char *defname)
|
||||
bool NOD_geometry_simulation_output_item_set_unique_name(NodeGeometrySimulationOutput *sim,
|
||||
NodeSimulationItem *item,
|
||||
const char *name,
|
||||
const char *defname)
|
||||
{
|
||||
char unique_name[MAX_NAME + 4];
|
||||
BLI_strncpy(unique_name, name, sizeof(unique_name));
|
||||
|
@ -364,14 +364,15 @@ bool node_geo_simulation_output_item_set_unique_name(NodeGeometrySimulationOutpu
|
|||
return name_changed;
|
||||
}
|
||||
|
||||
bool node_geo_simulation_output_contains_item(NodeGeometrySimulationOutput *sim,
|
||||
const NodeSimulationItem *item)
|
||||
bool NOD_geometry_simulation_output_contains_item(NodeGeometrySimulationOutput *sim,
|
||||
const NodeSimulationItem *item)
|
||||
{
|
||||
const int index = item - sim->items;
|
||||
Hans Goudey
commented
Implement with Implement with `Span::contains_ptr()`
|
||||
return index >= 0 && index < sim->items_num;
|
||||
}
|
||||
|
||||
NodeSimulationItem *node_geo_simulation_output_get_active_item(NodeGeometrySimulationOutput *sim)
|
||||
NodeSimulationItem *NOD_geometry_simulation_output_get_active_item(
|
||||
NodeGeometrySimulationOutput *sim)
|
||||
{
|
||||
if (sim->active_index >= 0 && sim->active_index < sim->items_num) {
|
||||
Hans Goudey
commented
A consistency suggestion: switch to return early in failure case, which is more common, and use
A consistency suggestion: switch to return early in failure case, which is more common, and use `index_range.contains()`:
```
if (!IndexRange(sim->items_num).contains(sim->active_index)) {
return nullptr;
}
return &sim->items[sim->active_index];
```
|
||||
return &sim->items[sim->active_index];
|
||||
|
@ -379,8 +380,8 @@ NodeSimulationItem *node_geo_simulation_output_get_active_item(NodeGeometrySimul
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
void node_geo_simulation_output_set_active_item(NodeGeometrySimulationOutput *sim,
|
||||
NodeSimulationItem *item)
|
||||
void NOD_geometry_simulation_output_set_active_item(NodeGeometrySimulationOutput *sim,
|
||||
NodeSimulationItem *item)
|
||||
{
|
||||
const int index = item - sim->items;
|
||||
if (index >= 0 && index < sim->items_num) {
|
||||
|
@ -388,8 +389,8 @@ void node_geo_simulation_output_set_active_item(NodeGeometrySimulationOutput *si
|
|||
}
|
||||
}
|
||||
|
||||
NodeSimulationItem *node_geo_simulation_output_find_item(NodeGeometrySimulationOutput *sim,
|
||||
const char *name)
|
||||
NodeSimulationItem *NOD_geometry_simulation_output_find_item(NodeGeometrySimulationOutput *sim,
|
||||
const char *name)
|
||||
{
|
||||
for (const int i : blender::IndexRange(sim->items_num)) {
|
||||
Hans Goudey
commented
```
for (NodeSimulationItem &item : blender::Span(sim->items, sim->items_num)) {
if (STREQ(item.name, name)) {
return &item;
}
}
```
|
||||
if (STREQ(sim->items[i].name, name)) {
|
||||
|
@ -399,17 +400,17 @@ NodeSimulationItem *node_geo_simulation_output_find_item(NodeGeometrySimulationO
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
NodeSimulationItem *node_geo_simulation_output_add_item(NodeGeometrySimulationOutput *sim,
|
||||
const short socket_type,
|
||||
const char *name)
|
||||
NodeSimulationItem *NOD_geometry_simulation_output_add_item(NodeGeometrySimulationOutput *sim,
|
||||
const short socket_type,
|
||||
const char *name)
|
||||
{
|
||||
return node_geo_simulation_output_insert_item(sim, socket_type, name, sim->items_num);
|
||||
return NOD_geometry_simulation_output_insert_item(sim, socket_type, name, sim->items_num);
|
||||
}
|
||||
|
||||
NodeSimulationItem *node_geo_simulation_output_insert_item(NodeGeometrySimulationOutput *sim,
|
||||
const short socket_type,
|
||||
const char *name,
|
||||
int index)
|
||||
NodeSimulationItem *NOD_geometry_simulation_output_insert_item(NodeGeometrySimulationOutput *sim,
|
||||
const short socket_type,
|
||||
const char *name,
|
||||
int index)
|
||||
{
|
||||
NodeSimulationItem *old_items = sim->items;
|
||||
sim->items = MEM_cnew_array<NodeSimulationItem>(sim->items_num + 1, __func__);
|
||||
|
@ -423,7 +424,7 @@ NodeSimulationItem *node_geo_simulation_output_insert_item(NodeGeometrySimulatio
|
|||
const char *defname = nodeStaticSocketLabel(socket_type, 0);
|
||||
NodeSimulationItem &added_item = sim->items[index];
|
||||
added_item.identifier = sim->next_identifier++;
|
||||
node_geo_simulation_output_item_set_unique_name(sim, &added_item, name, defname);
|
||||
NOD_geometry_simulation_output_item_set_unique_name(sim, &added_item, name, defname);
|
||||
added_item.socket_type = socket_type;
|
||||
|
||||
sim->items_num++;
|
||||
|
@ -432,28 +433,27 @@ NodeSimulationItem *node_geo_simulation_output_insert_item(NodeGeometrySimulatio
|
|||
return &added_item;
|
||||
}
|
||||
|
||||
NodeSimulationItem *node_geo_simulation_output_add_item_from_socket(
|
||||
NodeSimulationItem *NOD_geometry_simulation_output_add_item_from_socket(
|
||||
NodeGeometrySimulationOutput *sim, const bNode * /*from_node*/, const bNodeSocket *from_sock)
|
||||
{
|
||||
if (from_sock->type != SOCK_GEOMETRY) {
|
||||
return nullptr;
|
||||
}
|
||||
return node_geo_simulation_output_insert_item(
|
||||
return NOD_geometry_simulation_output_insert_item(
|
||||
sim, from_sock->type, from_sock->name, sim->items_num);
|
||||
}
|
||||
|
||||
NodeSimulationItem *node_geo_simulation_output_insert_item_from_socket(
|
||||
NodeSimulationItem *NOD_geometry_simulation_output_insert_item_from_socket(
|
||||
NodeGeometrySimulationOutput *sim,
|
||||
const bNode * /*from_node*/,
|
||||
const bNodeSocket *from_sock,
|
||||
int index)
|
||||
{
|
||||
return node_geo_simulation_output_insert_item(
|
||||
sim, from_sock->type, from_sock->name, index);
|
||||
return NOD_geometry_simulation_output_insert_item(sim, from_sock->type, from_sock->name, index);
|
||||
}
|
||||
|
||||
void node_geo_simulation_output_remove_item(NodeGeometrySimulationOutput *sim,
|
||||
NodeSimulationItem *item)
|
||||
void NOD_geometry_simulation_output_remove_item(NodeGeometrySimulationOutput *sim,
|
||||
NodeSimulationItem *item)
|
||||
{
|
||||
const int index = item - sim->items;
|
||||
if (index < 0 || index >= sim->items_num) {
|
||||
|
@ -475,7 +475,7 @@ void node_geo_simulation_output_remove_item(NodeGeometrySimulationOutput *sim,
|
|||
MEM_SAFE_FREE(old_items);
|
||||
}
|
||||
|
||||
void node_geo_simulation_output_clear_items(struct NodeGeometrySimulationOutput *sim)
|
||||
void NOD_geometry_simulation_output_clear_items(struct NodeGeometrySimulationOutput *sim)
|
||||
{
|
||||
for (NodeSimulationItem &item : blender::MutableSpan(sim->items, sim->items_num)) {
|
||||
MEM_SAFE_FREE(item.name);
|
||||
|
@ -485,9 +485,9 @@ void node_geo_simulation_output_clear_items(struct NodeGeometrySimulationOutput
|
|||
sim->items_num = 0;
|
||||
}
|
||||
|
||||
void node_geo_simulation_output_move_item(NodeGeometrySimulationOutput *sim,
|
||||
int from_index,
|
||||
int to_index)
|
||||
void NOD_geometry_simulation_output_move_item(NodeGeometrySimulationOutput *sim,
|
||||
int from_index,
|
||||
int to_index)
|
||||
{
|
||||
BLI_assert(from_index >= 0 && from_index < sim->items_num);
|
||||
BLI_assert(to_index >= 0 && to_index < sim->items_num);
|
||||
|
|
Blender uses syntax like
\return
rather than@return
. Also for multi-line function docstring comments, the/**
should be on its own line at the start.