[Bf-blender-cvs] [8355978eb9e] cycles-x: Cycles X: Allow nodes to define `type` socket

Sergey Sharybin noreply at git.blender.org
Wed Sep 8 18:00:02 CEST 2021


Commit: 8355978eb9ed7c821292216a796d99567fcfd7d1
Author: Sergey Sharybin
Date:   Wed Sep 8 17:51:47 2021 +0200
Branches: cycles-x
https://developer.blender.org/rB8355978eb9ed7c821292216a796d99567fcfd7d1

Cycles X: Allow nodes to define `type` socket

Do explicit access to `Node::type` from code-generation macro.

Differential Revision: https://developer.blender.org/D12429

===================================================================

M	intern/cycles/graph/node.h

===================================================================

diff --git a/intern/cycles/graph/node.h b/intern/cycles/graph/node.h
index b2dc1a65006..b2c5129b440 100644
--- a/intern/cycles/graph/node.h
+++ b/intern/cycles/graph/node.h
@@ -34,7 +34,10 @@ struct Transform;
 #define NODE_SOCKET_API_BASE_METHODS(type_, name, string_name) \
   const SocketType *get_##name##_socket() const \
   { \
-    static const SocketType *socket = type->find_input(ustring(string_name)); \
+    /* Explicitly cast to base class to use `Node::type` even if the derived class defines \
+     * `type`. */ \
+    const Node *self_node = this; \
+    static const SocketType *socket = self_node->type->find_input(ustring(string_name)); \
     return socket; \
   } \
   bool name##_is_modified() const \



More information about the Bf-blender-cvs mailing list