Blender V4.3
ShaderGraph Class Reference

#include <shader_graph.h>

Inherits 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 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 294 of file shader_graph.h.

Member Typedef Documentation

◆ NodePair

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

Definition at line 343 of file shader_graph.h.

Constructor & Destructor Documentation

◆ ShaderGraph()

ShaderGraph::ShaderGraph ( )

Definition at line 214 of file shader_graph.cpp.

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

◆ ~ShaderGraph()

ShaderGraph::~ShaderGraph ( )

Definition at line 222 of file shader_graph.cpp.

References clear_nodes().

Member Function Documentation

◆ add()

◆ break_cycles()

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

Definition at line 725 of file shader_graph.cpp.

References break_cycles(), disconnect(), ShaderNode::id, and visited.

Referenced by break_cycles(), and clean().

◆ bump_from_displacement()

void ShaderGraph::bump_from_displacement ( bool use_object_space)
protected

◆ clean()

◆ clear_nodes()

void ShaderGraph::clear_nodes ( )
protected

Definition at line 415 of file shader_graph.cpp.

References delete_node().

Referenced by ~ShaderGraph().

◆ compute_displacement_hash()

◆ connect()

◆ constant_fold()

void ShaderGraph::constant_fold ( Scene * scene)
protected

◆ copy_nodes()

◆ create_node()

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

◆ deduplicate_nodes()

void ShaderGraph::deduplicate_nodes ( )
protected

Definition at line 608 of file shader_graph.cpp.

References ShaderNode::equals(), NULL, ShaderNode::outputs, relink(), and VLOG_DEBUG.

Referenced by clean().

◆ default_inputs()

◆ delete_node()

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

Definition at line 336 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 306 of file shader_graph.cpp.

References finalized, 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 837 of file shader_graph.cpp.

Referenced by simplify().

◆ finalize()

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

◆ find_dependencies()

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

◆ get_num_closures()

◆ output()

◆ refine_bump_nodes()

void ShaderGraph::refine_bump_nodes ( )
protected

◆ relink() [1/3]

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

Definition at line 315 of file shader_graph.cpp.

References connect(), and disconnect().

Referenced by deduplicate_nodes(), and remove_proxy_nodes().

◆ relink() [2/3]

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

Definition at line 338 of file shader_graph.cpp.

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

◆ relink() [3/3]

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

Definition at line 325 of file shader_graph.cpp.

References connect(), and disconnect().

◆ remove_proxy_nodes()

◆ simplify()

void ShaderGraph::simplify ( Scene * scene)

Definition at line 360 of file shader_graph.cpp.

References clean(), default_inputs(), expand(), refine_bump_nodes(), and simplified.

Referenced by finalize().

◆ simplify_settings()

void ShaderGraph::simplify_settings ( Scene * scene)
protected

Definition at line 600 of file shader_graph.cpp.

Referenced by clean().

◆ transform_multi_closure()

◆ verify_volume_output()

void ShaderGraph::verify_volume_output ( )
protected

Member Data Documentation

◆ displacement_hash

string ShaderGraph::displacement_hash

Definition at line 300 of file shader_graph.h.

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

◆ finalized

bool ShaderGraph::finalized

Definition at line 298 of file shader_graph.h.

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

◆ nodes

list<ShaderNode *> ShaderGraph::nodes

Definition at line 296 of file shader_graph.h.

◆ num_node_ids

size_t ShaderGraph::num_node_ids

Definition at line 297 of file shader_graph.h.

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

◆ simplified

bool ShaderGraph::simplified

Definition at line 299 of file shader_graph.h.

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


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