Blender  V2.93
node_geo_is_viewport.cc
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 
17 #include "DEG_depsgraph_query.h"
18 
19 #include "node_geometry_util.hh"
20 
22  {SOCK_BOOLEAN, N_("Is Viewport")},
23  {-1, ""},
24 };
25 
26 namespace blender::nodes {
27 
29 {
30  const Depsgraph *depsgraph = params.depsgraph();
32  const bool is_viewport = mode == DAG_EVAL_VIEWPORT;
33 
34  params.set_output("Is Viewport", is_viewport);
35 }
36 
37 } // namespace blender::nodes
38 
40 {
41  static bNodeType ntype;
42 
43  geo_node_type_base(&ntype, GEO_NODE_IS_VIEWPORT, "Is Viewport", NODE_CLASS_INPUT, 0);
46  nodeRegisterType(&ntype);
47 }
void node_type_socket_templates(struct bNodeType *ntype, struct bNodeSocketTemplate *inputs, struct bNodeSocketTemplate *outputs)
Definition: node.cc:4527
#define GEO_NODE_IS_VIEWPORT
Definition: BKE_node.h:1400
#define NODE_CLASS_INPUT
Definition: BKE_node.h:334
void nodeRegisterType(struct bNodeType *ntype)
Definition: node.cc:1298
#define N_(msgid)
struct Depsgraph Depsgraph
Definition: DEG_depsgraph.h:51
eEvaluationMode
Definition: DEG_depsgraph.h:60
@ DAG_EVAL_VIEWPORT
Definition: DEG_depsgraph.h:61
eEvaluationMode DEG_get_mode(const Depsgraph *graph)
@ SOCK_BOOLEAN
const Depsgraph * depsgraph
uiWidgetBaseParameters params[MAX_WIDGET_BASE_BATCH]
static void geo_node_is_viewport_exec(GeoNodeExecParams params)
static bNodeSocketTemplate geo_node_is_viewport_out[]
void register_node_type_geo_is_viewport()
void geo_node_type_base(bNodeType *ntype, int type, const char *name, short nclass, short flag)
Compact definition of a node socket.
Definition: BKE_node.h:95
Defines a node type.
Definition: BKE_node.h:221
NodeGeometryExecFunction geometry_node_execute
Definition: BKE_node.h:327