Changeset View
Changeset View
Standalone View
Standalone View
intern/cycles/graph/node_type.h
| Show All 11 Lines | |||||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||||
| * See the License for the specific language governing permissions and | * See the License for the specific language governing permissions and | ||||
| * limitations under the License. | * limitations under the License. | ||||
| */ | */ | ||||
| #pragma once | #pragma once | ||||
| #include "graph/node_enum.h" | #include "graph/node_enum.h" | ||||
| #include "util/util_api.h" | |||||
| #include "util/util_array.h" | #include "util/util_array.h" | ||||
| #include "util/util_map.h" | #include "util/util_map.h" | ||||
| #include "util/util_param.h" | #include "util/util_param.h" | ||||
| #include "util/util_string.h" | #include "util/util_string.h" | ||||
| #include "util/util_vector.h" | #include "util/util_vector.h" | ||||
| CCL_NAMESPACE_BEGIN | CCL_NAMESPACE_BEGIN | ||||
| ▲ Show 20 Lines • Show All 49 Lines • ▼ Show 20 Lines | enum Flags { | ||||
| LINK_TEXTURE_UV = (1 << 6), | LINK_TEXTURE_UV = (1 << 6), | ||||
| LINK_INCOMING = (1 << 7), | LINK_INCOMING = (1 << 7), | ||||
| LINK_NORMAL = (1 << 8), | LINK_NORMAL = (1 << 8), | ||||
| LINK_POSITION = (1 << 9), | LINK_POSITION = (1 << 9), | ||||
| LINK_TANGENT = (1 << 10), | LINK_TANGENT = (1 << 10), | ||||
| DEFAULT_LINK_MASK = (1 << 4) | (1 << 5) | (1 << 6) | (1 << 7) | (1 << 8) | (1 << 9) | (1 << 10) | DEFAULT_LINK_MASK = (1 << 4) | (1 << 5) | (1 << 6) | (1 << 7) | (1 << 8) | (1 << 9) | (1 << 10) | ||||
| }; | }; | ||||
| ustring name; | private: | ||||
| Type type; | GET_SET(ustring, name) | ||||
| int struct_offset; | GET_SET(Type, type) | ||||
| const void *default_value; | GET_SET(int, struct_offset) | ||||
| const NodeEnum *enum_values; | GET_SET(const void *, default_value) | ||||
| const NodeType **node_type; | GET_SET(const NodeEnum *, enum_values) | ||||
| int flags; | GET_SET(const NodeType **, node_type) | ||||
| ustring ui_name; | GET_SET(int, flags) | ||||
| SocketModifiedFlags modified_flag_bit; | GET_SET(ustring, ui_name) | ||||
| GET_SET(SocketModifiedFlags, modified_flag_bit) | |||||
| public: | |||||
| size_t size() const; | size_t size() const; | ||||
| bool is_array() const; | bool is_array() const; | ||||
| static size_t size(Type type); | static size_t size(Type type); | ||||
| static size_t max_size(); | static size_t max_size(); | ||||
| static ustring type_name(Type type); | static ustring type_name(Type type); | ||||
| static void *zero_default_value(); | static void *zero_default_value(); | ||||
| static bool is_float3(Type type); | static bool is_float3(Type type); | ||||
| }; | }; | ||||
| Show All 17 Lines | void register_input(ustring name, | ||||
| int extra_flags = 0); | int extra_flags = 0); | ||||
| void register_output(ustring name, ustring ui_name, SocketType::Type type); | void register_output(ustring name, ustring ui_name, SocketType::Type type); | ||||
| const SocketType *find_input(ustring name) const; | const SocketType *find_input(ustring name) const; | ||||
| const SocketType *find_output(ustring name) const; | const SocketType *find_output(ustring name) const; | ||||
| typedef Node *(*CreateFunc)(const NodeType *type); | typedef Node *(*CreateFunc)(const NodeType *type); | ||||
| ustring name; | private: | ||||
| Type type; | GET_READ_ONLY(ustring, name) | ||||
| const NodeType *base; | GET_READ_ONLY(Type, type) | ||||
| vector<SocketType, std::allocator<SocketType>> inputs; | GET_READ_ONLY(const NodeType *, base) | ||||
| vector<SocketType, std::allocator<SocketType>> outputs; | |||||
| CreateFunc create; | using SocketTypeVector = vector<SocketType, std::allocator<SocketType>>; | ||||
| GET_READ_ONLY(SocketTypeVector, inputs) | |||||
| GET_READ_ONLY(SocketTypeVector, outputs) | |||||
| GET_READ_ONLY(CreateFunc, create) | |||||
| public: | |||||
| static NodeType *add(const char *name, | static NodeType *add(const char *name, | ||||
| CreateFunc create, | CreateFunc create, | ||||
| Type type = NONE, | Type type = NONE, | ||||
| const NodeType *base = NULL); | const NodeType *base = NULL); | ||||
| static const NodeType *find(ustring name); | static const NodeType *find(ustring name); | ||||
| static unordered_map<ustring, NodeType, ustringHash> &types(); | static unordered_map<ustring, NodeType, ustringHash> &types(); | ||||
| }; | }; | ||||
| ▲ Show 20 Lines • Show All 251 Lines • Show Last 20 Lines | |||||