Blender  V2.93
deg_node_factory_impl.h
Go to the documentation of this file.
1 /*
2  * This program is free software; you can redistribute it and/or
3  * modify it under the terms of the GNU General Public License
4  * as published by the Free Software Foundation; either version 2
5  * of the License, or (at your option) any later version.
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10  * GNU General Public License for more details.
11  *
12  * You should have received a copy of the GNU General Public License
13  * along with this program; if not, write to the Free Software Foundation,
14  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
15  *
16  * The Original Code is Copyright (C) 2019 Blender Foundation.
17  * All rights reserved.
18  */
19 
24 #pragma once
25 
27 
28 struct ID;
29 
30 namespace blender {
31 namespace deg {
32 
33 template<class ModeObjectType> NodeType DepsNodeFactoryImpl<ModeObjectType>::type() const
34 {
35  return ModeObjectType::typeinfo.type;
36 }
37 
38 template<class ModeObjectType> const char *DepsNodeFactoryImpl<ModeObjectType>::type_name() const
39 {
40  return ModeObjectType::typeinfo.type_name;
41 }
42 
43 template<class ModeObjectType> int DepsNodeFactoryImpl<ModeObjectType>::id_recalc_tag() const
44 {
45  return ModeObjectType::typeinfo.id_recalc_tag;
46 }
47 
48 template<class ModeObjectType>
50  const char *subdata,
51  const char *name) const
52 {
53  Node *node = new ModeObjectType();
54  /* Populate base node settings. */
55  node->type = type();
56  /* Set name if provided, or use default type name. */
57  if (name[0] != '\0') {
58  node->name = name;
59  }
60  else {
61  node->name = type_name();
62  }
63  node->init(id, subdata);
64  return node;
65 }
66 
67 } // namespace deg
68 } // namespace blender
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum type
OperationNode * node
Definition: DNA_ID.h:273
Type type
Definition: node_type.h:129
virtual Node * create_node(const ID *id, const char *subdata, const char *name) const override
virtual const char * type_name() const override
virtual NodeType type() const override
virtual int id_recalc_tag() const override
virtual void init(const ID *, const char *)
Definition: deg_node.h:191