WIP: Brush assets project #106303

Draft
Julian Eisel wants to merge 352 commits from brush-assets-project into main

When changing the target branch, be careful to rebase the branch in your fork to match. See documentation.
2 changed files with 31 additions and 35 deletions
Showing only changes of commit d8fe96d6ce - Show all commits

View File

@ -26,27 +26,24 @@ static void node_declare(NodeDeclarationBuilder &b)
const bNode *node = b.node_or_null();
const bNodeTree *tree = b.tree_or_null();
if (ELEM(nullptr, node, tree)) {
return;
}
const NodeGeometryRepeatInput &storage = node_storage(*node);
const bNode *output_node = tree->node_by_id(storage.output_node_id);
if (output_node == nullptr) {
return;
}
const auto &output_storage = *static_cast<const NodeGeometryRepeatOutput *>(
output_node->storage);
for (const int i : IndexRange(output_storage.items_num)) {
const NodeRepeatItem &item = output_storage.items[i];
const eNodeSocketDatatype socket_type = eNodeSocketDatatype(item.socket_type);
const StringRef name = item.name ? item.name : "";
const std::string identifier = RepeatItemsAccessor::socket_identifier_for_item(item);
auto &input_decl = b.add_input(socket_type, name, identifier);
auto &output_decl = b.add_output(socket_type, name, identifier);
if (socket_type_supports_fields(socket_type)) {
input_decl.supports_field();
output_decl.dependent_field({input_decl.input_index()});
if (node && tree) {
const NodeGeometryRepeatInput &storage = node_storage(*node);
const bNode *output_node = tree->node_by_id(storage.output_node_id);
if (output_node) {
const auto &output_storage = *static_cast<const NodeGeometryRepeatOutput *>(
output_node->storage);
for (const int i : IndexRange(output_storage.items_num)) {
const NodeRepeatItem &item = output_storage.items[i];
const eNodeSocketDatatype socket_type = eNodeSocketDatatype(item.socket_type);
const StringRef name = item.name ? item.name : "";
const std::string identifier = RepeatItemsAccessor::socket_identifier_for_item(item);
auto &input_decl = b.add_input(socket_type, name, identifier);
auto &output_decl = b.add_output(socket_type, name, identifier);
if (socket_type_supports_fields(socket_type)) {
input_decl.supports_field();
output_decl.dependent_field({input_decl.input_index()});
}
}
}
}
b.add_input<decl::Extend>("", "__extend__");

View File

@ -27,20 +27,19 @@ NODE_STORAGE_FUNCS(NodeGeometryRepeatOutput);
static void node_declare(NodeDeclarationBuilder &b)
{
const bNode *node = b.node_or_null();
if (node == nullptr) {
return;
}
const NodeGeometryRepeatOutput &storage = node_storage(*node);
for (const int i : IndexRange(storage.items_num)) {
const NodeRepeatItem &item = storage.items[i];
const eNodeSocketDatatype socket_type = eNodeSocketDatatype(item.socket_type);
const StringRef name = item.name ? item.name : "";
const std::string identifier = RepeatItemsAccessor::socket_identifier_for_item(item);
auto &input_decl = b.add_input(socket_type, name, identifier);
auto &output_decl = b.add_output(socket_type, name, identifier);
if (socket_type_supports_fields(socket_type)) {
input_decl.supports_field();
output_decl.dependent_field({input_decl.input_index()});
if (node) {
const NodeGeometryRepeatOutput &storage = node_storage(*node);
for (const int i : IndexRange(storage.items_num)) {
const NodeRepeatItem &item = storage.items[i];
const eNodeSocketDatatype socket_type = eNodeSocketDatatype(item.socket_type);
const StringRef name = item.name ? item.name : "";
const std::string identifier = RepeatItemsAccessor::socket_identifier_for_item(item);
auto &input_decl = b.add_input(socket_type, name, identifier);
auto &output_decl = b.add_output(socket_type, name, identifier);
if (socket_type_supports_fields(socket_type)) {
input_decl.supports_field();
output_decl.dependent_field({input_decl.input_index()});
}
}
}
b.add_input<decl::Extend>("", "__extend__");