2011-02-23 10:52:22 +00:00
|
|
|
/*
|
2008-12-13 18:09:49 +00:00
|
|
|
* ***** BEGIN GPL LICENSE BLOCK *****
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software Foundation,
|
2010-02-12 13:34:04 +00:00
|
|
|
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
2008-12-13 18:09:49 +00:00
|
|
|
*
|
|
|
|
* The Original Code is Copyright (C) 2008 Blender Foundation.
|
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* Contributor(s): Blender Foundation
|
|
|
|
*
|
|
|
|
* ***** END GPL LICENSE BLOCK *****
|
|
|
|
*/
|
2011-02-27 20:29:51 +00:00
|
|
|
|
|
|
|
/** \file blender/editors/space_node/node_intern.h
|
|
|
|
* \ingroup spnode
|
|
|
|
*/
|
|
|
|
|
2012-02-17 18:59:41 +00:00
|
|
|
#ifndef __NODE_INTERN_H__
|
|
|
|
#define __NODE_INTERN_H__
|
2008-12-13 18:09:49 +00:00
|
|
|
|
2011-09-27 01:32:27 +00:00
|
|
|
#include <stddef.h> /* for size_t */
|
2011-09-05 21:01:50 +00:00
|
|
|
#include "UI_interface.h"
|
|
|
|
|
2008-12-13 18:09:49 +00:00
|
|
|
/* internal exports only */
|
|
|
|
|
2008-12-24 10:33:10 +00:00
|
|
|
struct ARegion;
|
2009-08-19 00:55:30 +00:00
|
|
|
struct ARegionType;
|
2008-12-24 10:33:10 +00:00
|
|
|
struct View2D;
|
|
|
|
struct bContext;
|
2012-05-22 14:13:33 +00:00
|
|
|
struct wmWindow;
|
2008-12-28 00:08:34 +00:00
|
|
|
struct wmWindowManager;
|
2012-05-22 14:13:33 +00:00
|
|
|
struct wmEvent;
|
2011-09-05 21:01:50 +00:00
|
|
|
struct bNodeTemplate;
|
2011-03-13 22:07:55 +00:00
|
|
|
struct bNode;
|
|
|
|
struct bNodeSocket;
|
|
|
|
struct bNodeLink;
|
2011-08-12 18:27:48 +00:00
|
|
|
struct Main;
|
2011-03-13 22:07:55 +00:00
|
|
|
|
|
|
|
/* temp data to pass on to modal */
|
2012-06-06 22:38:39 +00:00
|
|
|
typedef struct bNodeLinkDrag {
|
2011-03-13 22:07:55 +00:00
|
|
|
struct bNodeLinkDrag *next, *prev;
|
|
|
|
|
2012-05-15 12:40:43 +00:00
|
|
|
/* List of links dragged by the operator.
|
|
|
|
* Note: This is a list of LinkData structs on top of the actual bNodeLinks.
|
|
|
|
* This way the links can be added to the node tree while being stored in this list.
|
|
|
|
*/
|
|
|
|
ListBase links;
|
2011-03-13 22:07:55 +00:00
|
|
|
int in_out;
|
|
|
|
} bNodeLinkDrag;
|
2008-12-28 00:08:34 +00:00
|
|
|
|
2009-11-11 08:12:54 +00:00
|
|
|
/* space_node.c */
|
|
|
|
ARegion *node_has_buttons_region(ScrArea *sa);
|
|
|
|
|
2008-12-13 18:09:49 +00:00
|
|
|
/* node_header.c */
|
2010-10-15 09:07:19 +00:00
|
|
|
void node_menus_register(void);
|
2008-12-13 18:09:49 +00:00
|
|
|
|
2008-12-24 10:33:10 +00:00
|
|
|
/* node_draw.c */
|
2012-05-22 14:13:33 +00:00
|
|
|
int node_get_colorid(struct bNode *node);
|
2012-06-01 12:38:03 +00:00
|
|
|
void node_socket_circle_draw(struct bNodeTree *ntree, struct bNodeSocket *sock, float size, int highlight);
|
2012-05-22 14:13:33 +00:00
|
|
|
int node_get_resize_cursor(int directions);
|
2012-06-01 14:42:21 +00:00
|
|
|
void node_draw_shadow(struct SpaceNode *snode, struct bNode *node, float radius, float alpha);
|
2011-09-05 21:01:50 +00:00
|
|
|
void node_draw_default(const struct bContext *C, struct ARegion *ar, struct SpaceNode *snode, struct bNodeTree *ntree, struct bNode *node);
|
|
|
|
void node_update_default(const struct bContext *C, struct bNodeTree *ntree, struct bNode *node);
|
2012-06-01 12:38:03 +00:00
|
|
|
int node_select_area_default(struct bNode *node, int x, int y);
|
|
|
|
int node_tweak_area_default(struct bNode *node, int x, int y);
|
2011-09-05 21:01:50 +00:00
|
|
|
void node_update_nodetree(const struct bContext *C, struct bNodeTree *ntree, float offsetx, float offsety);
|
|
|
|
void node_draw_nodetree(const struct bContext *C, struct ARegion *ar, struct SpaceNode *snode, struct bNodeTree *ntree);
|
2008-12-24 10:33:10 +00:00
|
|
|
void drawnodespace(const bContext *C, ARegion *ar, View2D *v2d);
|
|
|
|
|
2012-05-22 14:13:33 +00:00
|
|
|
void node_set_cursor(struct wmWindow *win, struct SpaceNode *snode);
|
|
|
|
|
2009-11-11 08:12:54 +00:00
|
|
|
/* node_buttons.c */
|
|
|
|
void node_buttons_register(struct ARegionType *art);
|
|
|
|
void NODE_OT_properties(struct wmOperatorType *ot);
|
|
|
|
|
2008-12-28 00:08:34 +00:00
|
|
|
/* node_ops.c */
|
|
|
|
void node_operatortypes(void);
|
Key Configuration
Keymaps are now saveable and configurable from the user preferences, note
that editing one item in a keymap means the whole keymap is now defined by
the user and will not be updated by Blender, an option for syncing might be
added later. The outliner interface is still there, but I will probably
remove it.
There's actually 3 levels now:
* Default builtin key configuration.
* Key configuration loaded from .py file, for configs like Blender 2.4x
or other 3D applications.
* Keymaps edited by the user and saved in .B.blend. These can be saved
to .py files as well to make creating distributable configurations
easier.
Also, user preferences sections were reorganized a bit, now there is:
Interface, Editing, Input, Files and System.
Implementation notes:
* wmKeyConfig was added which represents a key configuration containing
keymaps.
* wmKeymapItem was renamed to wmKeyMapItem for consistency with wmKeyMap.
* Modal maps are not wrapped yet.
* User preferences DNA file reading did not support newdataadr() yet,
added this now for reading keymaps.
* Key configuration related settings are now RNA wrapped.
* is_property_set and is_property_hidden python methods were added.
2009-10-08 18:40:03 +00:00
|
|
|
void node_keymap(wmKeyConfig *keyconf);
|
2008-12-28 00:08:34 +00:00
|
|
|
|
|
|
|
/* node_select.c */
|
2012-03-14 18:10:57 +00:00
|
|
|
void node_select(struct bNode *node);
|
|
|
|
void node_deselect(struct bNode *node);
|
2011-12-18 12:51:50 +00:00
|
|
|
void node_deselect_all(struct SpaceNode *snode);
|
2012-03-14 18:10:57 +00:00
|
|
|
void node_socket_select(struct bNode *node, struct bNodeSocket *sock);
|
|
|
|
void node_socket_deselect(struct bNode *node, struct bNodeSocket *sock, int deselect_node);
|
2012-03-09 10:16:41 +00:00
|
|
|
void node_deselect_all_input_sockets(struct SpaceNode *snode, int deselect_nodes);
|
|
|
|
void node_deselect_all_output_sockets(struct SpaceNode *snode, int deselect_nodes);
|
2011-12-18 12:51:50 +00:00
|
|
|
int node_select_same_type(struct SpaceNode *snode);
|
|
|
|
int node_select_same_type_np(struct SpaceNode *snode, int dir);
|
|
|
|
void node_select_single(struct bContext *C, struct bNode *node);
|
|
|
|
|
2008-12-28 00:08:34 +00:00
|
|
|
void NODE_OT_select(struct wmOperatorType *ot);
|
2009-09-14 08:47:13 +00:00
|
|
|
void NODE_OT_select_all(wmOperatorType *ot);
|
|
|
|
void NODE_OT_select_linked_to(wmOperatorType *ot);
|
|
|
|
void NODE_OT_select_linked_from(wmOperatorType *ot);
|
2009-03-29 02:15:13 +00:00
|
|
|
void NODE_OT_select_border(struct wmOperatorType *ot);
|
2010-05-12 12:03:38 +00:00
|
|
|
void NODE_OT_select_same_type(struct wmOperatorType *ot);
|
2010-05-12 13:55:09 +00:00
|
|
|
void NODE_OT_select_same_type_next(wmOperatorType *ot);
|
|
|
|
void NODE_OT_select_same_type_prev(wmOperatorType *ot);
|
2008-12-28 00:08:34 +00:00
|
|
|
|
2011-12-18 12:51:50 +00:00
|
|
|
/* node_state.c */
|
|
|
|
void NODE_OT_view_all(struct wmOperatorType *ot);
|
|
|
|
|
2008-12-24 10:33:10 +00:00
|
|
|
/* drawnode.c */
|
|
|
|
void node_draw_link(View2D *v2d, SpaceNode *snode, bNodeLink *link);
|
2011-01-09 18:59:35 +00:00
|
|
|
void node_draw_link_bezier(View2D *v2d, SpaceNode *snode, bNodeLink *link, int th_col1, int do_shaded, int th_col2, int do_triple, int th_col3 );
|
2009-02-07 14:03:34 +00:00
|
|
|
int node_link_bezier_points(View2D *v2d, SpaceNode *snode, bNodeLink *link, float coord_array[][2], int resol);
|
2011-09-05 21:01:50 +00:00
|
|
|
void node_draw_link_straight(View2D *v2d, SpaceNode *snode, bNodeLink *link, int th_col1, int do_shaded, int th_col2, int do_triple, int th_col3 );
|
2009-10-07 22:05:30 +00:00
|
|
|
void draw_nodespace_back_pix(ARegion *ar, SpaceNode *snode, int color_manage);
|
2008-12-24 10:33:10 +00:00
|
|
|
|
|
|
|
/* node_edit.c */
|
2009-10-07 22:05:30 +00:00
|
|
|
void node_tree_from_ID(ID *id, bNodeTree **ntree, bNodeTree **edittree, int *treetype);
|
2010-01-21 01:42:28 +00:00
|
|
|
void snode_notify(bContext *C, SpaceNode *snode);
|
2011-05-02 12:31:09 +00:00
|
|
|
void snode_dag_update(bContext *C, SpaceNode *snode);
|
2011-09-05 21:01:50 +00:00
|
|
|
bNode *node_add_node(struct SpaceNode *snode, struct Main *bmain, struct Scene *scene, struct bNodeTemplate *ntemp, float locx, float locy);
|
2008-12-24 10:33:10 +00:00
|
|
|
void snode_set_context(SpaceNode *snode, Scene *scene);
|
2008-12-28 00:08:34 +00:00
|
|
|
void snode_make_group_editable(SpaceNode *snode, bNode *gnode);
|
2009-01-27 17:12:40 +00:00
|
|
|
void snode_composite_job(const struct bContext *C, ScrArea *sa);
|
2009-09-15 11:35:10 +00:00
|
|
|
bNode *node_tree_get_editgroup(bNodeTree *ntree);
|
2010-01-05 06:49:29 +00:00
|
|
|
void snode_autoconnect(SpaceNode *snode, int allow_multiple, int replace);
|
2012-04-16 10:50:57 +00:00
|
|
|
int node_has_hidden_sockets(bNode *node);
|
|
|
|
void node_set_hidden_sockets(SpaceNode *snode, bNode *node, int set);
|
2011-02-07 16:41:57 +00:00
|
|
|
int node_render_changed_exec(bContext *, wmOperator *);
|
2012-03-09 10:16:41 +00:00
|
|
|
int node_find_indicated_socket(struct SpaceNode *snode, struct bNode **nodep, struct bNodeSocket **sockp, int in_out);
|
2008-12-13 18:09:49 +00:00
|
|
|
|
2009-07-08 21:41:35 +00:00
|
|
|
void NODE_OT_duplicate(struct wmOperatorType *ot);
|
2009-03-29 02:15:13 +00:00
|
|
|
void NODE_OT_delete(struct wmOperatorType *ot);
|
2011-07-12 18:59:54 +00:00
|
|
|
void NODE_OT_delete_reconnect(struct wmOperatorType *ot);
|
2009-04-15 15:40:31 +00:00
|
|
|
void NODE_OT_resize(struct wmOperatorType *ot);
|
2009-11-20 06:31:49 +00:00
|
|
|
|
|
|
|
void NODE_OT_link(struct wmOperatorType *ot);
|
|
|
|
void NODE_OT_link_make(struct wmOperatorType *ot);
|
2009-02-07 14:03:34 +00:00
|
|
|
void NODE_OT_links_cut(struct wmOperatorType *ot);
|
2012-02-27 17:38:16 +00:00
|
|
|
void NODE_OT_links_detach(struct wmOperatorType *ot);
|
2012-06-01 12:38:03 +00:00
|
|
|
void NODE_OT_add_reroute(struct wmOperatorType *ot);
|
2009-11-20 06:31:49 +00:00
|
|
|
|
2009-09-15 11:35:10 +00:00
|
|
|
void NODE_OT_group_make(struct wmOperatorType *ot);
|
|
|
|
void NODE_OT_group_ungroup(struct wmOperatorType *ot);
|
|
|
|
void NODE_OT_group_edit(struct wmOperatorType *ot);
|
2011-02-21 13:47:49 +00:00
|
|
|
void NODE_OT_group_socket_add(struct wmOperatorType *ot);
|
|
|
|
void NODE_OT_group_socket_remove(struct wmOperatorType *ot);
|
|
|
|
void NODE_OT_group_socket_move_up(struct wmOperatorType *ot);
|
|
|
|
void NODE_OT_group_socket_move_down(struct wmOperatorType *ot);
|
2009-02-06 16:34:05 +00:00
|
|
|
|
2010-06-07 20:03:40 +00:00
|
|
|
void NODE_OT_mute_toggle(struct wmOperatorType *ot);
|
|
|
|
void NODE_OT_hide_toggle(struct wmOperatorType *ot);
|
|
|
|
void NODE_OT_hide_socket_toggle(struct wmOperatorType *ot);
|
|
|
|
void NODE_OT_preview_toggle(struct wmOperatorType *ot);
|
2011-12-18 12:51:50 +00:00
|
|
|
void NODE_OT_options_toggle(struct wmOperatorType *ot);
|
2012-05-22 14:13:33 +00:00
|
|
|
void NODE_OT_node_copy_color(struct wmOperatorType *ot);
|
2009-11-20 06:31:49 +00:00
|
|
|
|
2009-11-20 21:17:17 +00:00
|
|
|
void NODE_OT_show_cyclic_dependencies(struct wmOperatorType *ot);
|
2010-04-05 18:34:18 +00:00
|
|
|
void NODE_OT_link_viewer(struct wmOperatorType *ot);
|
2010-04-06 17:47:21 +00:00
|
|
|
void NODE_OT_read_fullsamplelayers(struct wmOperatorType *ot);
|
|
|
|
void NODE_OT_read_renderlayers(struct wmOperatorType *ot);
|
2011-02-07 16:41:57 +00:00
|
|
|
void NODE_OT_render_changed(struct wmOperatorType *ot);
|
2011-01-31 14:42:55 +00:00
|
|
|
|
2010-04-07 17:06:22 +00:00
|
|
|
void NODE_OT_backimage_move(struct wmOperatorType *ot);
|
2010-04-08 16:36:50 +00:00
|
|
|
void NODE_OT_backimage_zoom(struct wmOperatorType *ot);
|
2011-01-31 14:42:55 +00:00
|
|
|
void NODE_OT_backimage_sample(wmOperatorType *ot);
|
2009-11-20 21:17:17 +00:00
|
|
|
|
2010-05-12 04:25:33 +00:00
|
|
|
void NODE_OT_add_file(struct wmOperatorType *ot);
|
|
|
|
|
2011-09-05 21:01:50 +00:00
|
|
|
void NODE_OT_new_node_tree(struct wmOperatorType *ot);
|
|
|
|
|
2012-03-01 07:56:15 +00:00
|
|
|
void NODE_OT_output_file_add_socket(struct wmOperatorType *ot);
|
|
|
|
void NODE_OT_output_file_remove_active_socket(struct wmOperatorType *ot);
|
2012-05-02 07:18:51 +00:00
|
|
|
void NODE_OT_output_file_move_active_socket(struct wmOperatorType *ot);
|
Adds a new node type for saving multiple image files from a single node.
Unlike the existing file output node this node has an arbitrary number of
possible input slots. It has a base path string that can be set to a general
base folder. Every input socket then uses its name as an extension of the base
path for file organization. This can include further subfolders on top of the
base path. Example:
Base path: '/home/user/myproject'
Input 1: 'Compo'
Input 2: 'Diffuse/'
Input 3: 'details/Normals'
would create output files
in /home/user/myproject: Compo0001.png, Compo0002.png, ...
in /home/user/myproject/Diffuse: 0001.png, 0002.png, ... (no filename base
given)
in /home/user/myproject/details: Normals0001.png, Normals0002.png, ...
Most settings for the node can be found in the sidebar (NKEY). New input sockets
can be added with the "Add Input" button. There is a list of input sockets and
below that the details for each socket can be changed, including the sub-path
and filename. Sockets can be removed here as well. By default each socket uses
the render settings file output format, but each can use its own format if
necessary.
To my knowledge this is the first node making use of such dynamic sockets in
trunk. So this is also a design test, other nodes might use this in the future.
Adding operator buttons on top of a node is a bit unwieldy atm, because all node
operators generally work on selected and/or active node(s). The operator button
would therefore either have to make sure the node is activated before the
operator is called (block callback maybe?) OR it has to store the node name
(risky, weak reference). For now it is only used in the sidebar, where only the
active node's buttons are displayed.
Also adds a new struct_type value to bNodeSocket, in order to distinguish
different socket types with the same data type (file inputs are SOCK_RGBA color
sockets). Would be nicer to use data type only for actual data evaluation, but
used in too many places, this works ok for now.
2012-02-22 12:24:04 +00:00
|
|
|
|
2012-05-22 14:13:33 +00:00
|
|
|
void NODE_OT_parent_set(struct wmOperatorType *ot);
|
|
|
|
void NODE_OT_parent_clear(struct wmOperatorType *ot);
|
|
|
|
void NODE_OT_join(struct wmOperatorType *ot);
|
|
|
|
void NODE_OT_attach(struct wmOperatorType *ot);
|
|
|
|
void NODE_OT_detach(struct wmOperatorType *ot);
|
|
|
|
|
2011-02-15 14:38:43 +00:00
|
|
|
extern const char *node_context_dir[];
|
|
|
|
|
2008-12-29 00:55:23 +00:00
|
|
|
// XXXXXX
|
|
|
|
|
|
|
|
// XXX from BSE_node.h
|
|
|
|
#define HIDDEN_RAD 15.0f
|
|
|
|
#define BASIS_RAD 8.0f
|
2011-06-14 15:55:46 +00:00
|
|
|
#define NODE_DYS (U.widget_unit/2)
|
|
|
|
#define NODE_DY U.widget_unit
|
2008-12-29 00:55:23 +00:00
|
|
|
#define NODE_SOCKSIZE 5
|
2008-12-13 18:09:49 +00:00
|
|
|
|
2008-12-29 00:55:23 +00:00
|
|
|
// XXX button events (butspace)
|
|
|
|
enum {
|
|
|
|
B_NOP = 0,
|
|
|
|
B_REDR = 1,
|
|
|
|
B_NODE_USEMAT,
|
|
|
|
B_NODE_USESCENE,
|
|
|
|
B_NODE_USETEX,
|
|
|
|
B_TEXBROWSE,
|
|
|
|
B_TEXALONE,
|
|
|
|
B_TEXLOCAL,
|
|
|
|
B_TEXDELETE,
|
|
|
|
B_TEXPRV,
|
|
|
|
B_AUTOTEXNAME,
|
|
|
|
B_KEEPDATA,
|
|
|
|
B_NODE_EXEC,
|
|
|
|
B_MATPRV,
|
|
|
|
B_NODE_LOADIMAGE,
|
|
|
|
B_NODE_SETIMAGE,
|
2009-11-11 08:12:54 +00:00
|
|
|
} eNodeSpace_ButEvents;
|
2008-12-29 00:55:23 +00:00
|
|
|
|
2012-02-17 18:59:41 +00:00
|
|
|
#endif /* __NODE_INTERN_H__ */
|