Blender  V2.59
Classes | Defines | Typedefs | Functions | Variables
node_edit.c File Reference
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#include <errno.h>
#include "MEM_guardedalloc.h"
#include "DNA_object_types.h"
#include "DNA_material_types.h"
#include "DNA_node_types.h"
#include "DNA_scene_types.h"
#include "BLI_math.h"
#include "BLI_blenlib.h"
#include "BLI_storage_types.h"
#include "BLI_utildefines.h"
#include "BKE_context.h"
#include "BKE_depsgraph.h"
#include "BKE_global.h"
#include "BKE_image.h"
#include "BKE_library.h"
#include "BKE_main.h"
#include "BKE_node.h"
#include "BKE_material.h"
#include "BKE_paint.h"
#include "BKE_screen.h"
#include "BKE_texture.h"
#include "BKE_report.h"
#include "RE_pipeline.h"
#include "IMB_imbuf_types.h"
#include "ED_node.h"
#include "ED_screen.h"
#include "ED_space_api.h"
#include "ED_render.h"
#include "RNA_access.h"
#include "RNA_define.h"
#include "WM_api.h"
#include "WM_types.h"
#include "UI_interface.h"
#include "UI_view2d.h"
#include "IMB_imbuf.h"
#include "RNA_enum_types.h"
#include "node_intern.h"

Go to the source code of this file.

Classes

struct  CompoJob
struct  NodeViewMove
struct  ImageSampleInfo
struct  NodeSizeWidget
struct  bNodeListItem

Defines

#define LINK_RESOL   12

Typedefs

typedef struct CompoJob CompoJob
typedef struct NodeViewMove NodeViewMove
typedef struct ImageSampleInfo ImageSampleInfo
typedef struct NodeSizeWidget NodeSizeWidget
typedef struct bNodeListItem bNodeListItem

Functions

static int compo_breakjob (void *cjv)
static void compo_redrawjob (void *cjv, char *UNUSED(str))
static void compo_freejob (void *cjv)
static void compo_initjob (void *cjv)
static void compo_updatejob (void *cjv)
static void compo_progressjob (void *cjv, float progress)
static void compo_startjob (void *cjv, short *stop, short *do_update, float *progress)
void snode_composite_job (const bContext *C, ScrArea *sa)
static int composite_node_active (bContext *C)
static bNodeeditnode_get_active (bNodeTree *ntree)
void snode_dag_update (bContext *UNUSED(C), SpaceNode *snode)
void snode_notify (bContext *C, SpaceNode *snode)
bNodenode_tree_get_editgroup (bNodeTree *nodetree)
void ED_node_shader_default (Material *ma)
void ED_node_composit_default (Scene *sce)
void ED_node_texture_default (Tex *tx)
void node_tree_from_ID (ID *id, bNodeTree **ntree, bNodeTree **edittree, int *treetype)
void snode_set_context (SpaceNode *snode, Scene *scene)
static void snode_tag_changed (SpaceNode *snode, bNode *node)
void node_set_active (SpaceNode *snode, bNode *node)
void node_tree_verify_groups (bNodeTree *nodetree)
void snode_make_group_editable (SpaceNode *snode, bNode *gnode)
static int node_group_edit_exec (bContext *C, wmOperator *UNUSED(op))
static int node_group_edit_invoke (bContext *C, wmOperator *op, wmEvent *UNUSED(event))
void NODE_OT_group_edit (wmOperatorType *ot)
static int node_group_socket_add_exec (bContext *C, wmOperator *op)
void NODE_OT_group_socket_add (wmOperatorType *ot)
static int node_group_socket_remove_exec (bContext *C, wmOperator *op)
void NODE_OT_group_socket_remove (wmOperatorType *ot)
static int node_group_socket_move_up_exec (bContext *C, wmOperator *op)
void NODE_OT_group_socket_move_up (wmOperatorType *ot)
static int node_group_socket_move_down_exec (bContext *C, wmOperator *op)
void NODE_OT_group_socket_move_down (wmOperatorType *ot)
static int node_group_ungroup_exec (bContext *C, wmOperator *op)
void NODE_OT_group_ungroup (wmOperatorType *ot)
bNodenext_node (bNodeTree *ntree)
static bNodevisible_node (SpaceNode *snode, rctf *rct)
static int snode_bg_viewmove_modal (bContext *C, wmOperator *op, wmEvent *event)
static int snode_bg_viewmove_invoke (bContext *C, wmOperator *op, wmEvent *event)
static int snode_bg_viewmove_cancel (bContext *UNUSED(C), wmOperator *op)
void NODE_OT_backimage_move (wmOperatorType *ot)
static int backimage_zoom (bContext *C, wmOperator *op)
void NODE_OT_backimage_zoom (wmOperatorType *ot)
static void sample_draw (const bContext *C, ARegion *ar, void *arg_info)
static void sample_apply (bContext *C, wmOperator *op, wmEvent *event)
static void sample_exit (bContext *C, wmOperator *op)
static int sample_invoke (bContext *C, wmOperator *op, wmEvent *event)
static int sample_modal (bContext *C, wmOperator *op, wmEvent *event)
static int sample_cancel (bContext *C, wmOperator *op)
void NODE_OT_backimage_sample (wmOperatorType *ot)
static int node_resize_modal (bContext *C, wmOperator *op, wmEvent *event)
static int node_resize_invoke (bContext *C, wmOperator *op, wmEvent *event)
static int node_resize_cancel (bContext *UNUSED(C), wmOperator *op)
void NODE_OT_resize (wmOperatorType *ot)
void node_deselectall (SpaceNode *snode)
int node_select_same_type (SpaceNode *snode)
int node_select_same_type_np (SpaceNode *snode, int dir)
int node_has_hidden_sockets (bNode *node)
static void node_link_viewer (SpaceNode *snode, bNode *tonode)
static int node_active_link_viewer (bContext *C, wmOperator *UNUSED(op))
void NODE_OT_link_viewer (wmOperatorType *ot)
static int node_mouse_groupheader (SpaceNode *snode)
static int find_indicated_socket (SpaceNode *snode, bNode **nodep, bNodeSocket **sockp, int in_out)
static int node_socket_hilights (SpaceNode *snode, int in_out)
static int outside_group_rect (SpaceNode *snode)
static int sort_nodes_locx (void *a, void *b)
static int socket_is_available (bNodeTree *ntree, bNodeSocket *sock, int allow_used)
static bNodeSocketbest_socket_output (bNodeTree *ntree, bNode *node, bNodeSocket *sock_target, int allow_multiple)
static bNodeSocketbest_socket_input (bNodeTree *ntree, bNode *node, int num, int replace)
void snode_autoconnect (SpaceNode *snode, int allow_multiple, int replace)
bNodenode_add_node (SpaceNode *snode, Scene *scene, int type, float locx, float locy)
static int node_duplicate_exec (bContext *C, wmOperator *op)
void NODE_OT_duplicate (wmOperatorType *ot)
static void node_remove_extra_links (SpaceNode *snode, bNodeSocket *tsock, bNodeLink *link)
static int node_link_modal (bContext *C, wmOperator *op, wmEvent *event)
static int node_link_init (SpaceNode *snode, bNodeLinkDrag *nldrag)
static int node_link_invoke (bContext *C, wmOperator *op, wmEvent *event)
static int node_link_cancel (bContext *C, wmOperator *op)
void NODE_OT_link (wmOperatorType *ot)
static int node_make_link_exec (bContext *C, wmOperator *op)
void NODE_OT_link_make (wmOperatorType *ot)
static int cut_links_intersect (bNodeLink *link, float mcoords[][2], int tot)
static int cut_links_exec (bContext *C, wmOperator *op)
void NODE_OT_links_cut (wmOperatorType *ot)
static bNodeSocketsocket_best_match (ListBase *sockets, int type)
static SpaceNodeed_node_link_conditions (ScrArea *sa, bNode **select)
void ED_node_link_insert (ScrArea *sa)
void ED_node_link_intersect_test (ScrArea *sa, int test)
static int node_read_renderlayers_exec (bContext *C, wmOperator *UNUSED(op))
void NODE_OT_read_renderlayers (wmOperatorType *ot)
static int node_read_fullsamplelayers_exec (bContext *C, wmOperator *UNUSED(op))
void NODE_OT_read_fullsamplelayers (wmOperatorType *ot)
int node_render_changed_exec (bContext *C, wmOperator *UNUSED(op))
void NODE_OT_render_changed (wmOperatorType *ot)
static int node_group_make_exec (bContext *C, wmOperator *op)
void NODE_OT_group_make (wmOperatorType *ot)
static void node_flag_toggle_exec (SpaceNode *snode, int toggle_flag)
static int node_hide_exec (bContext *C, wmOperator *UNUSED(op))
void NODE_OT_hide_toggle (wmOperatorType *ot)
static int node_preview_exec (bContext *C, wmOperator *UNUSED(op))
void NODE_OT_preview_toggle (wmOperatorType *ot)
static int node_socket_toggle_exec (bContext *C, wmOperator *UNUSED(op))
void NODE_OT_hide_socket_toggle (wmOperatorType *ot)
static int node_mute_exec (bContext *C, wmOperator *UNUSED(op))
void NODE_OT_mute_toggle (wmOperatorType *ot)
static int node_delete_exec (bContext *C, wmOperator *UNUSED(op))
void NODE_OT_delete (wmOperatorType *ot)
static void node_delete_reconnect (bNodeTree *tree, bNode *node)
static int node_delete_reconnect_exec (bContext *C, wmOperator *UNUSED(op))
void NODE_OT_delete_reconnect (wmOperatorType *ot)
static int node_show_cycles_exec (bContext *C, wmOperator *UNUSED(op))
void NODE_OT_show_cyclic_dependencies (wmOperatorType *ot)
static int node_add_file_exec (bContext *C, wmOperator *op)
static int node_add_file_invoke (bContext *C, wmOperator *op, wmEvent *event)
void NODE_OT_add_file (wmOperatorType *ot)

Variables

static EnumPropertyItem socket_in_out_items []

Detailed Description

Definition in file node_edit.c.


Define Documentation

#define LINK_RESOL   12

Definition at line 2419 of file node_edit.c.

Referenced by cut_links_intersect().


Typedef Documentation

typedef struct bNodeListItem bNodeListItem
typedef struct CompoJob CompoJob
typedef struct NodeViewMove NodeViewMove

Function Documentation

static int backimage_zoom ( bContext C,
wmOperator op 
) [static]
static bNodeSocket* best_socket_input ( bNodeTree ntree,
bNode node,
int  num,
int  replace 
) [static]
static bNodeSocket* best_socket_output ( bNodeTree ntree,
bNode node,
bNodeSocket sock_target,
int  allow_multiple 
) [static]
static int compo_breakjob ( void *  cjv) [static]

Definition at line 108 of file node_edit.c.

References CompoJob::stop.

Referenced by compo_startjob().

static void compo_freejob ( void *  cjv) [static]

Definition at line 123 of file node_edit.c.

References CompoJob::localtree, MEM_freeN(), CompoJob::ntree, and ntreeLocalMerge().

Referenced by snode_composite_job().

static void compo_initjob ( void *  cjv) [static]

Definition at line 135 of file node_edit.c.

References CompoJob::localtree, CompoJob::ntree, and ntreeLocalize().

Referenced by snode_composite_job().

static void compo_progressjob ( void *  cjv,
float  progress 
) [static]

Definition at line 150 of file node_edit.c.

References CompoJob::progress.

Referenced by compo_startjob().

static void compo_redrawjob ( void *  cjv,
char *  UNUSEDstr 
) [static]

Definition at line 116 of file node_edit.c.

References CompoJob::do_update.

Referenced by compo_startjob().

static void compo_startjob ( void *  cjv,
short *  stop,
short *  do_update,
float *  progress 
) [static]
static void compo_updatejob ( void *  cjv) [static]

Definition at line 143 of file node_edit.c.

References CompoJob::localtree, CompoJob::ntree, and ntreeLocalSync().

Referenced by snode_composite_job().

static int composite_node_active ( bContext C) [static]
static int cut_links_exec ( bContext C,
wmOperator op 
) [static]
static int cut_links_intersect ( bNodeLink link,
float  mcoords[][2],
int  tot 
) [static]
void ED_node_composit_default ( Scene sce)
static SpaceNode* ed_node_link_conditions ( ScrArea sa,
bNode **  select 
) [static]
void ED_node_link_insert ( ScrArea sa)
void ED_node_link_intersect_test ( ScrArea sa,
int  test 
)
void ED_node_shader_default ( Material ma)
void ED_node_texture_default ( Tex tx)
static bNode* editnode_get_active ( bNodeTree ntree) [static]
static int find_indicated_socket ( SpaceNode snode,
bNode **  nodep,
bNodeSocket **  sockp,
int  in_out 
) [static]
bNode* next_node ( bNodeTree ntree)
static int node_active_link_viewer ( bContext C,
wmOperator UNUSEDop 
) [static]
static int node_add_file_exec ( bContext C,
wmOperator op 
) [static]
static int node_add_file_invoke ( bContext C,
wmOperator op,
wmEvent event 
) [static]
bNode* node_add_node ( SpaceNode snode,
Scene scene,
int  type,
float  locx,
float  locy 
)
static int node_delete_exec ( bContext C,
wmOperator UNUSEDop 
) [static]
static void node_delete_reconnect ( bNodeTree tree,
bNode node 
) [static]
static int node_delete_reconnect_exec ( bContext C,
wmOperator UNUSEDop 
) [static]
void node_deselectall ( SpaceNode snode)
static int node_duplicate_exec ( bContext C,
wmOperator op 
) [static]
static void node_flag_toggle_exec ( SpaceNode snode,
int  toggle_flag 
) [static]
static int node_group_edit_exec ( bContext C,
wmOperator UNUSEDop 
) [static]
static int node_group_edit_invoke ( bContext C,
wmOperator op,
wmEvent UNUSEDevent 
) [static]
static int node_group_make_exec ( bContext C,
wmOperator op 
) [static]
static int node_group_socket_add_exec ( bContext C,
wmOperator op 
) [static]
static int node_group_socket_move_down_exec ( bContext C,
wmOperator op 
) [static]
static int node_group_socket_move_up_exec ( bContext C,
wmOperator op 
) [static]
static int node_group_socket_remove_exec ( bContext C,
wmOperator op 
) [static]
static int node_group_ungroup_exec ( bContext C,
wmOperator op 
) [static]
int node_has_hidden_sockets ( bNode node)
static int node_hide_exec ( bContext C,
wmOperator UNUSEDop 
) [static]
static int node_link_cancel ( bContext C,
wmOperator op 
) [static]
static int node_link_init ( SpaceNode snode,
bNodeLinkDrag nldrag 
) [static]
static int node_link_invoke ( bContext C,
wmOperator op,
wmEvent event 
) [static]
static int node_link_modal ( bContext C,
wmOperator op,
wmEvent event 
) [static]
static void node_link_viewer ( SpaceNode snode,
bNode tonode 
) [static]
static int node_make_link_exec ( bContext C,
wmOperator op 
) [static]
static int node_mouse_groupheader ( SpaceNode snode) [static]
static int node_mute_exec ( bContext C,
wmOperator UNUSEDop 
) [static]
void NODE_OT_add_file ( wmOperatorType ot)
void NODE_OT_backimage_move ( wmOperatorType ot)
void NODE_OT_backimage_sample ( wmOperatorType ot)
void NODE_OT_backimage_zoom ( wmOperatorType ot)
void NODE_OT_delete ( wmOperatorType ot)
void NODE_OT_delete_reconnect ( wmOperatorType ot)
void NODE_OT_duplicate ( wmOperatorType ot)
void NODE_OT_group_edit ( wmOperatorType ot)
void NODE_OT_group_make ( wmOperatorType ot)
void NODE_OT_group_socket_add ( wmOperatorType ot)
void NODE_OT_group_socket_move_down ( wmOperatorType ot)
void NODE_OT_group_socket_move_up ( wmOperatorType ot)
void NODE_OT_group_socket_remove ( wmOperatorType ot)
void NODE_OT_group_ungroup ( wmOperatorType ot)
void NODE_OT_hide_socket_toggle ( wmOperatorType ot)
void NODE_OT_hide_toggle ( wmOperatorType ot)
void NODE_OT_link ( wmOperatorType ot)
void NODE_OT_link_make ( wmOperatorType ot)
void NODE_OT_link_viewer ( wmOperatorType ot)
void NODE_OT_links_cut ( wmOperatorType ot)
void NODE_OT_mute_toggle ( wmOperatorType ot)
void NODE_OT_preview_toggle ( wmOperatorType ot)
void NODE_OT_read_fullsamplelayers ( wmOperatorType ot)
void NODE_OT_read_renderlayers ( wmOperatorType ot)
void NODE_OT_render_changed ( wmOperatorType ot)
void NODE_OT_resize ( wmOperatorType ot)
void NODE_OT_show_cyclic_dependencies ( wmOperatorType ot)
static int node_preview_exec ( bContext C,
wmOperator UNUSEDop 
) [static]
static int node_read_fullsamplelayers_exec ( bContext C,
wmOperator UNUSEDop 
) [static]
static int node_read_renderlayers_exec ( bContext C,
wmOperator UNUSEDop 
) [static]
static void node_remove_extra_links ( SpaceNode snode,
bNodeSocket tsock,
bNodeLink link 
) [static]
int node_render_changed_exec ( bContext C,
wmOperator UNUSEDop 
)
static int node_resize_cancel ( bContext UNUSEDC,
wmOperator op 
) [static]

Definition at line 1395 of file node_edit.c.

References wmOperator::customdata, MEM_freeN(), NULL, and OPERATOR_CANCELLED.

Referenced by NODE_OT_resize().

static int node_resize_invoke ( bContext C,
wmOperator op,
wmEvent event 
) [static]
static int node_resize_modal ( bContext C,
wmOperator op,
wmEvent event 
) [static]
int node_select_same_type ( SpaceNode snode)
int node_select_same_type_np ( SpaceNode snode,
int  dir 
)
void node_set_active ( SpaceNode snode,
bNode node 
)
static int node_show_cycles_exec ( bContext C,
wmOperator UNUSEDop 
) [static]
static int node_socket_hilights ( SpaceNode snode,
int  in_out 
) [static]
static int node_socket_toggle_exec ( bContext C,
wmOperator UNUSEDop 
) [static]
void node_tree_from_ID ( ID id,
bNodeTree **  ntree,
bNodeTree **  edittree,
int *  treetype 
)
bNode* node_tree_get_editgroup ( bNodeTree nodetree)
void node_tree_verify_groups ( bNodeTree nodetree)
static int outside_group_rect ( SpaceNode snode) [static]
static void sample_apply ( bContext C,
wmOperator op,
wmEvent event 
) [static]
static int sample_cancel ( bContext C,
wmOperator op 
) [static]

Definition at line 1278 of file node_edit.c.

References OPERATOR_CANCELLED, and sample_exit().

Referenced by NODE_OT_backimage_sample().

static void sample_draw ( const bContext C,
ARegion ar,
void *  arg_info 
) [static]
static void sample_exit ( bContext C,
wmOperator op 
) [static]
static int sample_invoke ( bContext C,
wmOperator op,
wmEvent event 
) [static]
static int sample_modal ( bContext C,
wmOperator op,
wmEvent event 
) [static]
void snode_autoconnect ( SpaceNode snode,
int  allow_multiple,
int  replace 
)
static int snode_bg_viewmove_cancel ( bContext UNUSEDC,
wmOperator op 
) [static]

Definition at line 1082 of file node_edit.c.

References wmOperator::customdata, MEM_freeN(), NULL, and OPERATOR_CANCELLED.

Referenced by NODE_OT_backimage_move().

static int snode_bg_viewmove_invoke ( bContext C,
wmOperator op,
wmEvent event 
) [static]
static int snode_bg_viewmove_modal ( bContext C,
wmOperator op,
wmEvent event 
) [static]
void snode_composite_job ( const bContext C,
ScrArea sa 
)
void snode_dag_update ( bContext UNUSEDC,
SpaceNode snode 
)
void snode_make_group_editable ( SpaceNode snode,
bNode gnode 
)
void snode_notify ( bContext C,
SpaceNode snode 
)
void snode_set_context ( SpaceNode snode,
Scene scene 
)
static void snode_tag_changed ( SpaceNode snode,
bNode node 
) [static]
static bNodeSocket* socket_best_match ( ListBase sockets,
int  type 
) [static]
static int socket_is_available ( bNodeTree ntree,
bNodeSocket sock,
int  allow_used 
) [static]
static int sort_nodes_locx ( void *  a,
void *  b 
) [static]

Definition at line 1794 of file node_edit.c.

References bNode::locx, and bNodeListItem::node.

Referenced by snode_autoconnect().

static bNode* visible_node ( SpaceNode snode,
rctf rct 
) [static]

Definition at line 992 of file node_edit.c.

References BLI_isect_rctf(), SpaceNode::edittree, next_node(), NULL, and bNode::totr.

Referenced by find_indicated_socket().


Variable Documentation

Initial value:
 {
        { SOCK_IN, "IN", 0, "In", "" },
        { SOCK_OUT, "OUT", 0, "Out", "" },
        { 0, NULL, 0, NULL, NULL}
}

Definition at line 90 of file node_edit.c.