Blender  V3.3
Public Member Functions | Public Attributes | Protected Types | Protected Member Functions | List of all members
ShaderGraph Class Reference

#include <shader_graph.h>

Inheritance diagram for ShaderGraph:
NodeOwner

Public Member Functions

 ShaderGraph ()
 
 ~ShaderGraph ()
 
ShaderNodeadd (ShaderNode *node)
 
OutputNodeoutput ()
 
void connect (ShaderOutput *from, ShaderInput *to)
 
void disconnect (ShaderOutput *from)
 
void disconnect (ShaderInput *to)
 
void relink (ShaderInput *from, ShaderInput *to)
 
void relink (ShaderOutput *from, ShaderOutput *to)
 
void relink (ShaderNode *node, ShaderOutput *from, ShaderOutput *to)
 
void remove_proxy_nodes ()
 
void compute_displacement_hash ()
 
void simplify (Scene *scene)
 
void finalize (Scene *scene, bool do_bump=false, bool do_simplify=false, bool bump_in_object_space=false)
 
int get_num_closures ()
 
void dump_graph (const char *filename)
 
template<typename T , typename... Args>
Tcreate_node (Args &&...args)
 
template<typename T >
void delete_node (T *node)
 
- Public Member Functions inherited from NodeOwner
virtual ~NodeOwner ()
 

Public Attributes

list< ShaderNode * > nodes
 
size_t num_node_ids
 
bool finalized
 
bool simplified
 
string displacement_hash
 

Protected Types

typedef pair< ShaderNode *const, ShaderNode * > NodePair
 

Protected Member Functions

void find_dependencies (ShaderNodeSet &dependencies, ShaderInput *input)
 
void clear_nodes ()
 
void copy_nodes (ShaderNodeSet &nodes, ShaderNodeMap &nnodemap)
 
void break_cycles (ShaderNode *node, vector< bool > &visited, vector< bool > &on_stack)
 
void bump_from_displacement (bool use_object_space)
 
void refine_bump_nodes ()
 
void expand ()
 
void default_inputs (bool do_osl)
 
void transform_multi_closure (ShaderNode *node, ShaderOutput *weight_out, bool volume)
 
void clean (Scene *scene)
 
void constant_fold (Scene *scene)
 
void simplify_settings (Scene *scene)
 
void deduplicate_nodes ()
 
void verify_volume_output ()
 

Detailed Description

Definition at line 297 of file shader_graph.h.

Member Typedef Documentation

◆ NodePair

typedef pair<ShaderNode *const, ShaderNode *> ShaderGraph::NodePair
protected

Definition at line 349 of file shader_graph.h.

Constructor & Destructor Documentation

◆ ShaderGraph()

ShaderGraph::ShaderGraph ( )

Definition at line 206 of file shader_graph.cpp.

References add(), finalized, num_node_ids, and simplified.

◆ ~ShaderGraph()

ShaderGraph::~ShaderGraph ( )

Definition at line 214 of file shader_graph.cpp.

References clear_nodes().

Member Function Documentation

◆ add()

ShaderNode * ShaderGraph::add ( ShaderNode node)

◆ break_cycles()

void ShaderGraph::break_cycles ( ShaderNode node,
vector< bool > &  visited,
vector< bool > &  on_stack 
)
protected

Definition at line 708 of file shader_graph.cpp.

References disconnect(), ShaderNode::id, input, node, and visited.

Referenced by clean().

◆ bump_from_displacement()

void ShaderGraph::bump_from_displacement ( bool  use_object_space)
protected

◆ clean()

void ShaderGraph::clean ( Scene scene)
protected

◆ clear_nodes()

void ShaderGraph::clear_nodes ( )
protected

Definition at line 403 of file shader_graph.cpp.

References delete_node(), node, and nodes.

Referenced by ~ShaderGraph().

◆ compute_displacement_hash()

void ShaderGraph::compute_displacement_hash ( )

◆ connect()

void ShaderGraph::connect ( ShaderOutput from,
ShaderInput to 
)

◆ constant_fold()

void ShaderGraph::constant_fold ( Scene scene)
protected

◆ copy_nodes()

void ShaderGraph::copy_nodes ( ShaderNodeSet nodes,
ShaderNodeMap nnodemap 
)
protected

◆ create_node()

template<typename T , typename... Args>
T* ShaderGraph::create_node ( Args &&...  args)
inline

Definition at line 333 of file shader_graph.h.

References node, and T.

Referenced by BumpNode::constant_fold().

◆ deduplicate_nodes()

void ShaderGraph::deduplicate_nodes ( )
protected

◆ default_inputs()

void ShaderGraph::default_inputs ( bool  do_osl)
protected

◆ delete_node()

template<typename T >
void ShaderGraph::delete_node ( T node)
inline

Definition at line 342 of file shader_graph.h.

References node.

Referenced by clean(), clear_nodes(), and remove_proxy_nodes().

◆ disconnect() [1/2]

void ShaderGraph::disconnect ( ShaderInput to)

Definition at line 297 of file shader_graph.cpp.

References ShaderInput::disconnect(), finalized, ShaderInput::link, and simplified.

◆ disconnect() [2/2]

void ShaderGraph::disconnect ( ShaderOutput from)

◆ dump_graph()

void ShaderGraph::dump_graph ( const char *  filename)

◆ expand()

void ShaderGraph::expand ( )
protected

Definition at line 818 of file shader_graph.cpp.

References node, and nodes.

Referenced by simplify().

◆ finalize()

void ShaderGraph::finalize ( Scene scene,
bool  do_bump = false,
bool  do_simplify = false,
bool  bump_in_object_space = false 
)

◆ find_dependencies()

void ShaderGraph::find_dependencies ( ShaderNodeSet dependencies,
ShaderInput input 
)
protected

Definition at line 390 of file shader_graph.cpp.

References if(), input, node, and NULL.

Referenced by bump_from_displacement(), compute_displacement_hash(), and refine_bump_nodes().

◆ get_num_closures()

int ShaderGraph::get_num_closures ( )

◆ output()

OutputNode * ShaderGraph::output ( )

◆ refine_bump_nodes()

void ShaderGraph::refine_bump_nodes ( )
protected

◆ relink() [1/3]

void ShaderGraph::relink ( ShaderInput from,
ShaderInput to 
)

◆ relink() [2/3]

void ShaderGraph::relink ( ShaderNode node,
ShaderOutput from,
ShaderOutput to 
)

Definition at line 328 of file shader_graph.cpp.

References connect(), disconnect(), from, ShaderInput::link, node, outputs, and simplified.

◆ relink() [3/3]

void ShaderGraph::relink ( ShaderOutput from,
ShaderOutput to 
)

Definition at line 316 of file shader_graph.cpp.

References connect(), disconnect(), from, and outputs.

◆ remove_proxy_nodes()

void ShaderGraph::remove_proxy_nodes ( )

◆ simplify()

void ShaderGraph::simplify ( Scene scene)

◆ simplify_settings()

void ShaderGraph::simplify_settings ( Scene scene)
protected

Definition at line 583 of file shader_graph.cpp.

References node, nodes, and scene.

Referenced by clean(), and finalize().

◆ transform_multi_closure()

void ShaderGraph::transform_multi_closure ( ShaderNode node,
ShaderOutput weight_out,
bool  volume 
)
protected

◆ verify_volume_output()

void ShaderGraph::verify_volume_output ( )
protected

Member Data Documentation

◆ displacement_hash

string ShaderGraph::displacement_hash

Definition at line 303 of file shader_graph.h.

Referenced by compute_displacement_hash(), and Shader::set_graph().

◆ finalized

bool ShaderGraph::finalized

Definition at line 301 of file shader_graph.h.

Referenced by add(), connect(), disconnect(), finalize(), and ShaderGraph().

◆ nodes

list<ShaderNode *> ShaderGraph::nodes

◆ num_node_ids

size_t ShaderGraph::num_node_ids

Definition at line 300 of file shader_graph.h.

Referenced by add(), clean(), remove_proxy_nodes(), and ShaderGraph().

◆ simplified

bool ShaderGraph::simplified

Definition at line 302 of file shader_graph.h.

Referenced by add(), disconnect(), relink(), ShaderGraph(), and simplify().


The documentation for this class was generated from the following files: