Cleanup: Used derived node in geometry exec params
Since the derived node tree is already build for the evaluation system, it's simpler to pass a derived node to the params struct. This will also allow context lookups in nested node groups for node error messages, since the derived node has that information readily accessible.
This commit is contained in:
parent
c075b8bff2
commit
eb2e260540
|
@ -331,7 +331,6 @@ class GeometryNodesEvaluator {
|
|||
void compute_output_and_forward(const DOutputSocket &socket_to_compute)
|
||||
{
|
||||
const DNode &node = socket_to_compute.node();
|
||||
const bNode &bnode = *node.bnode();
|
||||
|
||||
if (!socket_to_compute.is_available()) {
|
||||
/* If the output is not available, use a default value. */
|
||||
|
@ -360,7 +359,7 @@ class GeometryNodesEvaluator {
|
|||
/* Execute the node. */
|
||||
GValueMap<StringRef> node_outputs_map{allocator_};
|
||||
GeoNodeExecParams params{
|
||||
bnode, node_inputs_map, node_outputs_map, handle_map_, self_object_, depsgraph_};
|
||||
node, node_inputs_map, node_outputs_map, handle_map_, self_object_, depsgraph_};
|
||||
this->execute_node(node, params);
|
||||
|
||||
/* Forward computed outputs to linked input sockets. */
|
||||
|
|
|
@ -25,6 +25,8 @@
|
|||
|
||||
#include "DNA_node_types.h"
|
||||
|
||||
#include "NOD_derived_node_tree.hh"
|
||||
|
||||
struct Depsgraph;
|
||||
|
||||
namespace blender::nodes {
|
||||
|
@ -55,7 +57,7 @@ using fn::GValueMap;
|
|||
|
||||
class GeoNodeExecParams {
|
||||
private:
|
||||
const bNode &node_;
|
||||
const DNode &node_;
|
||||
GValueMap<StringRef> &input_values_;
|
||||
GValueMap<StringRef> &output_values_;
|
||||
const PersistentDataHandleMap &handle_map_;
|
||||
|
@ -63,7 +65,7 @@ class GeoNodeExecParams {
|
|||
Depsgraph *depsgraph_;
|
||||
|
||||
public:
|
||||
GeoNodeExecParams(const bNode &node,
|
||||
GeoNodeExecParams(const DNode &node,
|
||||
GValueMap<StringRef> &input_values,
|
||||
GValueMap<StringRef> &output_values,
|
||||
const PersistentDataHandleMap &handle_map,
|
||||
|
@ -178,7 +180,7 @@ class GeoNodeExecParams {
|
|||
*/
|
||||
const bNode &node() const
|
||||
{
|
||||
return node_;
|
||||
return *node_.bnode();
|
||||
}
|
||||
|
||||
const PersistentDataHandleMap &handle_map() const
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#include "NOD_derived_node_tree.hh"
|
||||
#include "NOD_geometry_exec.hh"
|
||||
#include "NOD_type_callbacks.hh"
|
||||
|
||||
|
@ -23,12 +24,9 @@ namespace blender::nodes {
|
|||
|
||||
const bNodeSocket *GeoNodeExecParams::find_available_socket(const StringRef name) const
|
||||
{
|
||||
LISTBASE_FOREACH (const bNodeSocket *, socket, &node_.inputs) {
|
||||
if ((socket->flag & SOCK_UNAVAIL) != 0) {
|
||||
continue;
|
||||
}
|
||||
if (name == socket->name) {
|
||||
return socket;
|
||||
for (const DSocket *socket : node_.inputs()) {
|
||||
if (socket->is_available() && socket->name() == name) {
|
||||
return socket->bsocket();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -144,18 +142,19 @@ void GeoNodeExecParams::check_extract_input(StringRef identifier,
|
|||
const CPPType *requested_type) const
|
||||
{
|
||||
bNodeSocket *found_socket = nullptr;
|
||||
LISTBASE_FOREACH (bNodeSocket *, socket, &node_.inputs) {
|
||||
if (identifier == socket->identifier) {
|
||||
found_socket = socket;
|
||||
for (const DSocket *socket : node_.inputs()) {
|
||||
if (socket->identifier() == identifier) {
|
||||
found_socket = socket->bsocket();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (found_socket == nullptr) {
|
||||
std::cout << "Did not find an input socket with the identifier '" << identifier << "'.\n";
|
||||
std::cout << "Possible identifiers are: ";
|
||||
LISTBASE_FOREACH (bNodeSocket *, socket, &node_.inputs) {
|
||||
if ((socket->flag & SOCK_UNAVAIL) == 0) {
|
||||
std::cout << "'" << socket->identifier << "', ";
|
||||
for (const DSocket *socket : node_.inputs()) {
|
||||
if (socket->is_available()) {
|
||||
std::cout << "'" << socket->identifier() << "', ";
|
||||
}
|
||||
}
|
||||
std::cout << "\n";
|
||||
|
@ -185,18 +184,19 @@ void GeoNodeExecParams::check_extract_input(StringRef identifier,
|
|||
void GeoNodeExecParams::check_set_output(StringRef identifier, const CPPType &value_type) const
|
||||
{
|
||||
bNodeSocket *found_socket = nullptr;
|
||||
LISTBASE_FOREACH (bNodeSocket *, socket, &node_.outputs) {
|
||||
if (identifier == socket->identifier) {
|
||||
found_socket = socket;
|
||||
for (const DSocket *socket : node_.outputs()) {
|
||||
if (socket->identifier() == identifier) {
|
||||
found_socket = socket->bsocket();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (found_socket == nullptr) {
|
||||
std::cout << "Did not find an output socket with the identifier '" << identifier << "'.\n";
|
||||
std::cout << "Possible identifiers are: ";
|
||||
LISTBASE_FOREACH (bNodeSocket *, socket, &node_.outputs) {
|
||||
if ((socket->flag & SOCK_UNAVAIL) == 0) {
|
||||
std::cout << "'" << socket->identifier << "', ";
|
||||
for (const DSocket *socket : node_.outputs()) {
|
||||
if (socket->is_available()) {
|
||||
std::cout << "'" << socket->identifier() << "', ";
|
||||
}
|
||||
}
|
||||
std::cout << "\n";
|
||||
|
|
Loading…
Reference in New Issue