Blender  V3.3
Classes | Macros | Functions
versioning_cycles.c File Reference
#include <float.h>
#include <string.h>
#include "BLI_listbase.h"
#include "BLI_math.h"
#include "BLI_string.h"
#include "BLI_utildefines.h"
#include "DNA_anim_types.h"
#include "DNA_camera_types.h"
#include "DNA_color_types.h"
#include "DNA_light_types.h"
#include "DNA_node_types.h"
#include "DNA_particle_types.h"
#include "BKE_animsys.h"
#include "BKE_colortools.h"
#include "BKE_idprop.h"
#include "BKE_main.h"
#include "BKE_node.h"
#include "NOD_shader.h"
#include "MEM_guardedalloc.h"
#include "IMB_colormanagement.h"
#include "BLO_readfile.h"
#include "readfile.h"
#include "versioning_common.h"

Go to the source code of this file.

Classes

struct  MappingNodeFCurveCallbackData
 

Macros

#define DNA_DEPRECATED_ALLOW
 

Functions

static bool socket_is_used (bNodeSocket *sock)
 
static floatcycles_node_socket_float_value (bNodeSocket *socket)
 
static floatcycles_node_socket_rgba_value (bNodeSocket *socket)
 
static floatcycles_node_socket_vector_value (bNodeSocket *socket)
 
static IDPropertycycles_properties_from_ID (ID *id)
 
static IDPropertycycles_visibility_properties_from_ID (ID *id)
 
static IDPropertycycles_properties_from_view_layer (ViewLayer *view_layer)
 
static float cycles_property_float (IDProperty *idprop, const char *name, float default_value)
 
static int cycles_property_int (IDProperty *idprop, const char *name, int default_value)
 
static void cycles_property_int_set (IDProperty *idprop, const char *name, int value)
 
static bool cycles_property_boolean (IDProperty *idprop, const char *name, bool default_value)
 
static void cycles_property_boolean_set (IDProperty *idprop, const char *name, bool value)
 
static void displacement_node_insert (bNodeTree *ntree)
 
static void displacement_principled_nodes (bNode *node)
 
static bool node_has_roughness (const bNode *node)
 
static void square_roughness_node_insert (bNodeTree *ntree)
 
static void mapping_node_order_flip (bNode *node)
 
static void vector_curve_node_remap (bNode *node)
 
static void ambient_occlusion_node_relink (bNodeTree *ntree)
 
static void image_node_colorspace (bNode *node)
 
static void light_emission_node_to_energy (Light *light, float *energy, float color[3])
 
static void light_emission_unify (Light *light, const char *engine)
 
static void update_math_node_single_operand_operators (bNodeTree *ntree)
 
static void update_vector_math_node_add_and_subtract_operators (bNodeTree *ntree)
 
static void update_vector_math_node_dot_product_operator (bNodeTree *ntree)
 
static void update_vector_math_node_cross_product_operator (bNodeTree *ntree)
 
static void update_vector_math_node_normalize_operator (bNodeTree *ntree)
 
static void update_vector_math_node_operators_enum_mapping (bNodeTree *ntree)
 
static void update_vector_math_node_average_operator (bNodeTree *ntree)
 
static void update_noise_node_dimensions (bNodeTree *ntree)
 
static void update_mapping_node_fcurve_rna_path_callback (ID *UNUSED(id), FCurve *fcurve, void *_data)
 
static void update_mapping_node_inputs_and_properties (bNodeTree *ntree)
 
static void update_musgrave_node_dimensions (bNodeTree *ntree)
 
static void update_musgrave_node_color_output (bNodeTree *ntree)
 
static void update_voronoi_node_dimensions (bNodeTree *ntree)
 
static void update_voronoi_node_f3_and_f4 (bNodeTree *ntree)
 
static void update_voronoi_node_fac_output (bNodeTree *ntree)
 
static void update_voronoi_node_crackle (bNodeTree *ntree)
 
static void update_voronoi_node_coloring (bNodeTree *ntree)
 
static void update_voronoi_node_square_distance (bNodeTree *ntree)
 
static void update_noise_and_wave_distortion (bNodeTree *ntree)
 
static void update_wave_node_directions_and_offset (bNodeTree *ntree)
 
void blo_do_versions_cycles (FileData *UNUSED(fd), Library *UNUSED(lib), Main *bmain)
 
void do_versions_after_linking_cycles (Main *bmain)
 

Macro Definition Documentation

◆ DNA_DEPRECATED_ALLOW

#define DNA_DEPRECATED_ALLOW

Definition at line 8 of file versioning_cycles.c.

Function Documentation

◆ ambient_occlusion_node_relink()

static void ambient_occlusion_node_relink ( bNodeTree ntree)
static

◆ blo_do_versions_cycles()

void blo_do_versions_cycles ( FileData UNUSEDfd,
Library UNUSEDlib,
Main bmain 
)

◆ cycles_node_socket_float_value()

static float* cycles_node_socket_float_value ( bNodeSocket socket)
static

◆ cycles_node_socket_rgba_value()

static float* cycles_node_socket_rgba_value ( bNodeSocket socket)
static

◆ cycles_node_socket_vector_value()

static float* cycles_node_socket_vector_value ( bNodeSocket socket)
static

◆ cycles_properties_from_ID()

static IDProperty* cycles_properties_from_ID ( ID id)
static

◆ cycles_properties_from_view_layer()

static IDProperty* cycles_properties_from_view_layer ( ViewLayer view_layer)
static

◆ cycles_property_boolean()

static bool cycles_property_boolean ( IDProperty idprop,
const char *  name,
bool  default_value 
)
static

◆ cycles_property_boolean_set()

static void cycles_property_boolean_set ( IDProperty idprop,
const char *  name,
bool  value 
)
static

Definition at line 112 of file versioning_cycles.c.

References cycles_property_int_set().

Referenced by do_versions_after_linking_cycles().

◆ cycles_property_float()

static float cycles_property_float ( IDProperty idprop,
const char *  name,
float  default_value 
)
static

◆ cycles_property_int()

static int cycles_property_int ( IDProperty idprop,
const char *  name,
int  default_value 
)
static

◆ cycles_property_int_set()

static void cycles_property_int_set ( IDProperty idprop,
const char *  name,
int  value 
)
static

◆ cycles_visibility_properties_from_ID()

static IDProperty* cycles_visibility_properties_from_ID ( ID id)
static

◆ displacement_node_insert()

static void displacement_node_insert ( bNodeTree ntree)
static

◆ displacement_principled_nodes()

static void displacement_principled_nodes ( bNode node)
static

◆ do_versions_after_linking_cycles()

void do_versions_after_linking_cycles ( Main bmain)

Definition at line 1363 of file versioning_cycles.c.

References ambient_occlusion_node_relink(), CAM_DOF_ENABLED, CAM_ORTHO, camera, Main::cameras, cycles_properties_from_ID(), cycles_properties_from_view_layer(), cycles_property_boolean(), cycles_property_boolean_set(), cycles_property_float(), cycles_property_int(), cycles_property_int_set(), cycles_visibility_properties_from_ID(), DENOISER_OPENIMAGEDENOISE, DENOISER_OPTIX, displacement_node_insert(), displacement_principled_nodes(), RenderData::engine, ListBase::first, FOREACH_NODETREE_BEGIN, FOREACH_NODETREE_END, Scene::id, if(), image_node_colorspace(), light_emission_unify(), Main::lights, LISTBASE_FOREACH, MAIN_VERSION_ATLEAST, mapping_node_order_flip(), ID::next, node, bNodeTree::nodes, ntree, NTREE_SHADER, OB_HIDE_CAMERA, OB_HIDE_DIFFUSE, OB_HIDE_GLOSSY, OB_HIDE_RENDER, OB_HIDE_SELECT, OB_HIDE_SHADOW, OB_HIDE_TRANSMISSION, OB_HIDE_VIEWPORT, OB_HIDE_VOLUME_SCATTER, OB_HOLDOUT, OB_LAMP, OB_SHADOW_CATCHER, Main::objects, Scene::r, RE_engine_id_CYCLES, scene, Main::scenes, square_roughness_node_insert(), STREQ, bNodeTree::type, update_mapping_node_inputs_and_properties(), update_math_node_single_operand_operators(), update_musgrave_node_dimensions(), update_noise_and_wave_distortion(), update_noise_node_dimensions(), update_vector_math_node_add_and_subtract_operators(), update_vector_math_node_average_operator(), update_vector_math_node_cross_product_operator(), update_vector_math_node_dot_product_operator(), update_vector_math_node_normalize_operator(), update_voronoi_node_coloring(), update_voronoi_node_crackle(), update_voronoi_node_dimensions(), update_voronoi_node_square_distance(), update_wave_node_directions_and_offset(), vector_curve_node_remap(), and Scene::view_layers.

Referenced by do_versions_after_linking().

◆ image_node_colorspace()

static void image_node_colorspace ( bNode node)
static

◆ light_emission_node_to_energy()

static void light_emission_node_to_energy ( Light light,
float energy,
float  color[3] 
)
static

◆ light_emission_unify()

static void light_emission_unify ( Light light,
const char *  engine 
)
static

◆ mapping_node_order_flip()

static void mapping_node_order_flip ( bNode node)
static

◆ node_has_roughness()

static bool node_has_roughness ( const bNode node)
static

◆ socket_is_used()

static bool socket_is_used ( bNodeSocket sock)
static

◆ square_roughness_node_insert()

static void square_roughness_node_insert ( bNodeTree ntree)
static

◆ update_mapping_node_fcurve_rna_path_callback()

static void update_mapping_node_fcurve_rna_path_callback ( ID UNUSEDid,
FCurve fcurve,
void _data 
)
static

◆ update_mapping_node_inputs_and_properties()

static void update_mapping_node_inputs_and_properties ( bNodeTree ntree)
static

◆ update_math_node_single_operand_operators()

static void update_math_node_single_operand_operators ( bNodeTree ntree)
static

◆ update_musgrave_node_color_output()

static void update_musgrave_node_color_output ( bNodeTree ntree)
static

◆ update_musgrave_node_dimensions()

static void update_musgrave_node_dimensions ( bNodeTree ntree)
static

◆ update_noise_and_wave_distortion()

static void update_noise_and_wave_distortion ( bNodeTree ntree)
static

◆ update_noise_node_dimensions()

static void update_noise_node_dimensions ( bNodeTree ntree)
static

◆ update_vector_math_node_add_and_subtract_operators()

static void update_vector_math_node_add_and_subtract_operators ( bNodeTree ntree)
static

◆ update_vector_math_node_average_operator()

static void update_vector_math_node_average_operator ( bNodeTree ntree)
static

◆ update_vector_math_node_cross_product_operator()

static void update_vector_math_node_cross_product_operator ( bNodeTree ntree)
static

◆ update_vector_math_node_dot_product_operator()

static void update_vector_math_node_dot_product_operator ( bNodeTree ntree)
static

◆ update_vector_math_node_normalize_operator()

static void update_vector_math_node_normalize_operator ( bNodeTree ntree)
static

◆ update_vector_math_node_operators_enum_mapping()

static void update_vector_math_node_operators_enum_mapping ( bNodeTree ntree)
static

Definition at line 694 of file versioning_cycles.c.

References LISTBASE_FOREACH, node, bNodeTree::nodes, ntree, and SH_NODE_VECTOR_MATH.

Referenced by blo_do_versions_cycles().

◆ update_voronoi_node_coloring()

static void update_voronoi_node_coloring ( bNodeTree ntree)
static

The coloring property of the Voronoi node was removed. Previously, if the coloring enum was set to Intensity (0), the voronoi distance was returned in all outputs, otherwise, the Cell ID was returned. Since we remapped the Fac output in update_voronoi_node_fac_output, then to fix this, we relink the Color output to the Distance output if coloring was set to 0, and the other way around otherwise.

Definition at line 1153 of file versioning_cycles.c.

References if(), bNodeTree::links, LISTBASE_FOREACH_BACKWARD_MUTABLE, node, nodeAddLink(), nodeFindSocket(), nodeRemLink(), ntree, SH_NODE_TEX_VORONOI, SOCK_OUT, tex, and version_socket_update_is_used().

Referenced by do_versions_after_linking_cycles().

◆ update_voronoi_node_crackle()

static void update_voronoi_node_crackle ( bNodeTree ntree)
static

◆ update_voronoi_node_dimensions()

static void update_voronoi_node_dimensions ( bNodeTree ntree)
static

◆ update_voronoi_node_f3_and_f4()

static void update_voronoi_node_f3_and_f4 ( bNodeTree ntree)
static

◆ update_voronoi_node_fac_output()

static void update_voronoi_node_fac_output ( bNodeTree ntree)
static

◆ update_voronoi_node_square_distance()

static void update_voronoi_node_square_distance ( bNodeTree ntree)
static

◆ update_wave_node_directions_and_offset()

static void update_wave_node_directions_and_offset ( bNodeTree ntree)
static

Wave Texture node: Restore previous texture directions and offset.

  1. In 2.81, Wave texture had fixed diagonal direction (Bands) or mapping along distance (Rings). Now, directions are customizable properties, with X axis being new default. To fix this we set new direction options to Diagonal and Spherical.
  2. Sine profile is now negatively offset by PI/2 to better match other profiles. To fix this we set new Phase Offset input to PI/2 in nodes with Sine profile.

Definition at line 1285 of file versioning_cycles.c.

References cycles_node_socket_float_value(), if(), LISTBASE_FOREACH, M_PI_2, node, nodeFindSocket(), bNodeTree::nodes, ntree, SH_NODE_TEX_WAVE, SHD_WAVE_BANDS_DIRECTION_DIAGONAL, SHD_WAVE_PROFILE_SIN, SHD_WAVE_RINGS_DIRECTION_SPHERICAL, SOCK_IN, and tex.

Referenced by do_versions_after_linking_cycles().

◆ vector_curve_node_remap()

static void vector_curve_node_remap ( bNode node)
static