9#define DNA_DEPRECATED_ALLOW
12#define DNA_GENFILE_VERSIONING_MACROS
26#undef DNA_GENFILE_VERSIONING_MACROS
63 constexpr char const *rna_path_prefix =
"collections[";
85 bool hide_shadows = *material_len > 0;
207 if (socket->
link ==
nullptr) {
226 if (socket->
link ==
nullptr) {
228 if ((socket_color_value[0] == 0.0f) && (socket_color_value[1] == 0.0f) &&
229 (socket_color_value[2] == 0.0f))
233 if ((socket_color_value[0] == 1.0f) && (socket_color_value[1] == 1.0f) &&
234 (socket_color_value[2] == 1.0f))
249 if (socket->
link ==
nullptr) {
251 if (socket_float_value == 0.0f) {
254 if (socket_float_value == 1.0f) {
271 if (socket->
link ==
nullptr) {
273 if (socket_value == 0.0f) {
276 if (socket_value == 1.0f) {
285 if (socket->
link ==
nullptr) {
287 if (socket_value == 0.0f) {
290 if (socket_value == 1.0f) {
313 if (output_node ==
nullptr) {
323 if (alpha.
socket ==
nullptr) {
327 bool is_opaque = (threshold == 2.0f);
334 float values[4] = {value, value, value, 1.0f};
377 float sum = default_value[0] + default_value[1] + default_value[2];
379 float avg = (
sum >= 3.0f) ? 1.0f : (
sum / 3.0f);
382 float values[4] = {value, value, value, 1.0f};
388 (*default_value > threshold));
397 if (!material->use_nodes || material->
nodetree ==
nullptr) {
404 if (output_node ==
nullptr) {
409 *output_node,
SOCK_IN,
"Surface");
411 if (existing_out_sock->
link ==
nullptr && volume_sock->
link) {
427 auto copy_link = [&](
const char *socket_name) {
429 if (sock && sock->
link) {
439 copy_link(
"Displacement");
440 copy_link(
"Thickness");
442 output_node = new_output;
459 if (old_out_sock->
link !=
nullptr) {
465 if (out_sock->
link !=
nullptr) {
481 if (sock != is_shadow) {
537 if (!material->use_nodes || material->nodetree ==
nullptr) {
543 else if (material->blend_shadow ==
MA_BS_NONE) {
555 RPT_(
"Material %s could not be converted because of different Blend Mode "
556 "and Shadow Mode (need manual adjustment)\n"),
557 material->id.name + 2);
562 float threshold = (material->blend_method ==
MA_BM_CLIP) ? material->alpha_threshold :
568 RPT_(
"Material %s could not be converted because of non-trivial "
569 "alpha blending (need manual adjustment)\n"),
570 material->id.name + 2);
590 constexpr char deprecated_avi_raw_imtype = 15;
591 constexpr char deprecated_avi_jpeg_imtype = 16;
650 ListBase *regionbase = (sl == area->spacedata.first) ? &area->regionbase : &sl->regionbase;
678 if (thickness_socket ==
nullptr) {
682 bool has_link =
false;
684 if (link->tosock == thickness_socket) {
696 value_node->
locy_legacy = node->locy_legacy - 160.0f;
710 if (
ELEM(*tc, 2, 4)) {
717 if (strip->
data ==
nullptr || strip->
data->
proxy ==
nullptr) {
732 if (
data->shadow_angle == 0.0f) {
734 data->shadow_offset = 0.04f;
735 data->shadow_blur = 0.0f;
737 if (
data->outline_width == 0.0f) {
738 data->outline_color[3] = 0.7f;
739 data->outline_width = 0.05f;
754 if (layer_index == -1) {
757 float *
data =
static_cast<float *
>(
785 for (
Layer *layer : grease_pencil->layers_for_write()) {
799 scene->r.motion_blur_position = order_conversion[std::clamp(cposition, 0, 2)];
805 scene->r.motion_blur_position = scene->eevee.motion_blur_position_deprecated;
806 scene->r.motion_blur_shutter = scene->eevee.motion_blur_shutter_deprecated;
812 constexpr int NTREE_EXECUTION_MODE_CPU = 0;
813 constexpr int NTREE_EXECUTION_MODE_FULL_FRAME = 1;
815 constexpr int NTREE_COM_GROUPNODE_BUFFER = 1 << 3;
816 constexpr int NTREE_COM_OPENCL = 1 << 1;
823 ntree->flag &= ~(NTREE_COM_GROUPNODE_BUFFER | NTREE_COM_OPENCL);
825 if (ntree->execution_mode == NTREE_EXECUTION_MODE_FULL_FRAME) {
826 ntree->execution_mode = NTREE_EXECUTION_MODE_CPU;
833 if (!DNA_struct_member_exists(fd->
filesdna,
"SpaceImage",
"float",
"stretch_opacity")) {
857 settings->curve_radius = 0.01f;
864 light->shadow_filter_radius = 1.0f;
869 const float default_snap_angle_increment =
DEG2RADF(5.0f);
870 const float default_snap_angle_increment_precision =
DEG2RADF(1.0f);
872 scene->toolsettings->snap_angle_increment_2d = default_snap_angle_increment;
873 scene->toolsettings->snap_angle_increment_3d = default_snap_angle_increment;
874 scene->toolsettings->snap_angle_increment_2d_precision =
875 default_snap_angle_increment_precision;
876 scene->toolsettings->snap_angle_increment_3d_precision =
877 default_snap_angle_increment_precision;
882 if (!DNA_struct_member_exists(fd->
filesdna,
"SceneEEVEE",
"int",
"gtao_resolution")) {
884 scene->eevee.fast_gi_resolution = 2;
896 if (scene->ed !=
nullptr) {
905 mpath->color_post[0] = 0.1f;
906 mpath->color_post[1] = 1.0f;
907 mpath->color_post[2] = 0.1f;
914 mpath->color_post[0] = 0.1f;
915 mpath->color_post[1] = 1.0f;
916 mpath->color_post[2] = 0.1f;
923 if (!DNA_struct_member_exists(fd->
filesdna,
"Light",
"float",
"transmission_fac")) {
927 light->transmission_fac = 0.0f;
939 scene->eevee.clamp_surface_indirect = 10.0f;
942 scene->eevee.clamp_volume_indirect = 1e-8f;
960 if (scene->ed !=
nullptr) {
967 if (!DNA_struct_member_exists(fd->
filesdna,
"Material",
"char",
"thickness_mode")) {
1002 const float size_factor = 3.0f / 2.0f;
1003 blur_data.sizex *= size_factor;
1004 blur_data.sizey *= size_factor;
1005 blur_data.percentx *= size_factor;
1006 blur_data.percenty *= size_factor;
1013 if (!DNA_struct_member_exists(fd->
filesdna,
"SceneEEVEE",
"float",
"shadow_resolution_scale"))
1024 if (scene->ed !=
nullptr) {
1043 if (scene->ed !=
nullptr) {
1064 if (scene->nodetree) {
1074 lightprobe->grid_surfel_density =
max_ii(20,
1075 2 *
max_iii(lightprobe->grid_resolution_x,
1076 lightprobe->grid_resolution_y,
1077 lightprobe->grid_resolution_z));
1082 bool only_uses_eevee_legacy_or_workbench =
true;
1085 only_uses_eevee_legacy_or_workbench =
false;
1090 if (world->nodetree) {
1095 if (volume_input_socket) {
1097 if (node_link->tonode == output_node && node_link->tosock == volume_input_socket) {
1100 if (only_uses_eevee_legacy_or_workbench) {
1103 RPT_(
"%s contains a volume shader that might need to be "
1104 "converted to object (see world volume panel)\n"),
1105 world->id.name + 2);
1116 constexpr int NTREE_EXECUTION_MODE_GPU = 2;
1119 if (scene->nodetree) {
1120 if (scene->nodetree->execution_mode == NTREE_EXECUTION_MODE_GPU) {
1123 scene->r.compositor_precision = scene->nodetree->precision;
1129 float shadow_max_res_sun = 0.001f;
1130 float shadow_max_res_local = 0.001f;
1131 bool shadow_resolution_absolute =
false;
1134 shadow_max_res_local = (2.0f *
M_SQRT2) / scene->eevee.shadow_cube_size_deprecated;
1136 shadow_max_res_local =
ceil(shadow_max_res_local * 1000.0f) / 1000.0f;
1137 shadow_resolution_absolute =
true;
1142 if (light->type ==
LA_SUN) {
1144 light->shadow_maximum_resolution = shadow_max_res_sun;
1148 light->shadow_maximum_resolution = shadow_max_res_local;
1157 if (
brush->gpencil_settings) {
1171 world->sun_angle = default_world->
sun_angle;
1258 pchan->custom_shape_wire_width = 1.0;
1330 curve_mapping.
cur = 3;
1368 scene->eevee.gi_cubemap_resolution = std::max(scene->eevee.gi_cubemap_resolution, 128);
1376 bool transparent_shadows = material->blend_shadow !=
MA_BS_SOLID;
1380 mat->surface_render_method = (mat->blend_method ==
MA_BM_BLEND) ?
1394 if (node->storage ==
nullptr) {
1404 node->storage = ndg;
AnimData * BKE_animdata_from_id(const ID *id)
CustomData interface, see also DNA_customdata_types.h.
void * CustomData_get_layer_named_for_write(CustomData *data, eCustomDataType type, blender::StringRef name, int totelem)
int CustomData_get_named_layer_index(const CustomData *data, eCustomDataType type, blender::StringRef name)
Low-level operations for grease pencil.
#define MAIN_VERSION_FILE_ATLEAST(main, ver, subver)
General operations, lookup, etc. for materials.
short * BKE_object_material_len_p(Object *ob)
Material * BKE_object_material_get(Object *ob, short act)
#define FOREACH_NODETREE_END
#define FOREACH_NODETREE_BEGIN(bmain, _nodetree, _id)
#define SH_NODE_MIX_SHADER
#define FN_NODE_SEPARATE_TRANSFORM
#define SH_NODE_OUTPUT_WORLD
#define SH_NODE_BSDF_PRINCIPLED
#define SH_NODE_ADD_SHADER
#define SH_NODE_SUBSURFACE_SCATTERING
#define CMP_NODE_HUECORRECT
#define SH_NODE_BSDF_TRANSPARENT
#define SH_NODE_OUTPUT_MATERIAL
#define CMP_NODE_CURVE_RGB
#define FN_NODE_COMBINE_TRANSFORM
#define SH_NODE_EEVEE_SPECULAR
#define GEO_NODE_CAPTURE_ATTRIBUTE
void * BLI_findlink(const ListBase *listbase, int number) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
#define LISTBASE_FOREACH(type, var, list)
#define LISTBASE_FOREACH_MUTABLE(type, var, list)
MINLINE float min_ff(float a, float b)
MINLINE int max_ii(int a, int b)
MINLINE int max_iii(int a, int b, int c)
MINLINE void copy_v4_v4(float r[4], const float a[4])
MINLINE void copy_v3_fl(float r[3], float f)
char * BLI_sprintfN(const char *__restrict format,...) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1) ATTR_MALLOC ATTR_PRINTF_FORMAT(1
char * BLI_strdup(const char *str) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1) ATTR_MALLOC
char * STRNCPY(char(&dst)[N], const char *src)
#define STRNCPY_UTF8(dst, src)
#define SET_FLAG_FROM_TEST(value, test, flag)
void BLO_reportf_wrap(BlendFileReadReport *reports, eReportType type, const char *format,...) ATTR_PRINTF_FORMAT(3
@ BRUSH_CURVES_SCULPT_FLAG_INTERPOLATE_RADIUS
@ CONSTRAINT_TYPE_ROTLIMIT
@ LIMIT_ROT_LEGACY_BEHAVIOR
#define DNA_struct_default_get(struct_name)
blenloader genfile private function prototypes
@ MA_BL_TRANSPARENT_SHADOW
@ MA_BL_THICKNESS_FROM_SHADOW
@ MA_SURFACE_METHOD_DEFERRED
@ MA_SURFACE_METHOD_FORWARD
@ CMP_NODE_DENOISE_PREFILTER_ACCURATE
@ SCE_EEVEE_VOLUME_CUSTOM_RANGE
@ SCE_EEVEE_MOTION_BLUR_ENABLED_DEPRECATED
@ SCE_COMPOSITOR_DEVICE_GPU
@ RGN_ALIGN_HIDE_WITH_PREV
@ RGN_TYPE_ASSET_SHELF_HEADER
@ eSeqModifierType_HueCorrect
@ SEQ_EDIT_SHOW_MISSING_MEDIA
@ SN_OVERLAY_SHOW_REROUTE_AUTO_LABELS
@ SEQ_CACHE_SHOW_FINAL_OUT
@ V3D_SHOW_CAMERA_PASSEPARTOUT
@ WO_USE_EEVEE_FINITE_VOLUME
BMesh const char void * data
static T sum(const btAlignedObjectArray< T > &items)
constexpr bool startswith(StringRef prefix) const
constexpr StringRef drop_known_prefix(StringRef prefix) const
void * MEM_calloc_arrayN(size_t len, size_t size, const char *str)
void * MEM_callocN(size_t len, const char *str)
void MEM_freeN(void *vmemh)
constexpr float LEGACY_RADIUS_CONVERSION_FACTOR
bNodeSocket * node_find_socket(bNode &node, eNodeSocketInOut in_out, StringRef identifier)
bNode * node_add_node(const bContext *C, bNodeTree &ntree, StringRef idname, std::optional< int > unique_identifier=std::nullopt)
void node_remove_link(bNodeTree *ntree, bNodeLink &link)
bNode * node_add_static_node(const bContext *C, bNodeTree &ntree, int type)
bNodeLink & node_add_link(bNodeTree &ntree, bNode &fromnode, bNodeSocket &fromsock, bNode &tonode, bNodeSocket &tosock)
void foreach_strip(ListBase *seqbase, ForEachFunc callback, void *user_data)
SequencerToolSettings * tool_settings_ensure(Scene *scene)
float wrap(float value, float max, float min)
const char * RE_engine_id_CYCLES
const char * RE_engine_id_BLENDER_WORKBENCH
const char * RE_engine_id_BLENDER_EEVEE
static AlphaSource alpha_source(bNodeSocket *fac, bool inverted=false)
bool is_fully_transparent() const
bool is_transparent() const
static AlphaSource opaque()
bool is_semi_transparent() const
@ ALPHA_FULLY_TRANSPARENT
static AlphaSource mix(const AlphaSource &a, const AlphaSource &b, bNodeSocket *fac)
static AlphaSource fully_transparent(bNodeSocket *socket=nullptr, bool inverted=false)
static AlphaSource complex_alpha()
static AlphaSource add(const AlphaSource &a, const AlphaSource &b)
CustomData curve_data_legacy
BlendFileReadReport * reports
struct CurveMapping curve_mapping
float shadow_jitter_overblur
struct bNodeTree * nodetree
NodeGeometryAttributeCaptureItem * capture_items
struct ImageFormatData im_format
float fast_gi_thickness_near
float shadow_resolution_scale
float fast_gi_thickness_far
struct SequencerCacheOverlay cache_overlay
float sun_shadow_maximum_resolution
float sun_shadow_filter_radius
static bool strip_text_data_update(Strip *strip, void *)
static void versioning_node_hue_correct_set_wrappng(bNodeTree *ntree)
static void versioning_eevee_material_shadow_none(Material *material)
void blo_do_versions_420(FileData *fd, Library *, Main *bmain)
static bool versioning_eevee_material_blend_mode_settings(bNodeTree *ntree, float threshold)
static void version_bonecollection_anim(FCurve *fcurve)
static void image_settings_avi_to_ffmpeg(Scene *scene)
void do_versions_after_linking_420(FileData *fd, Main *bmain)
static void convert_grease_pencil_stroke_hardness_to_softness(GreasePencil *grease_pencil)
static void add_image_editor_asset_shelf(Main &bmain)
static bool strip_hue_correct_set_wrapping(Strip *strip, void *)
static void hue_correct_set_wrapping(CurveMapping *curve_mapping)
static bool strip_proxies_timecode_update(Strip *strip, void *)
static AlphaSource versioning_eevee_alpha_source_get(bNodeSocket *socket, int depth=0)
static void version_refraction_depth_to_thickness_value(bNodeTree *ntree, float thickness)
static void versioning_eevee_shadow_settings(Object *object)
static void versioning_update_timecode(short int *tc)
bNode * version_eevee_output_node_get(bNodeTree *ntree, int16_t node_type)
bool all_scenes_use(Main *bmain, const blender::Span< const char * > engines)
float * version_cycles_node_socket_float_value(bNodeSocket *socket)
IDProperty * version_cycles_properties_from_ID(ID *id)
int version_cycles_property_int(IDProperty *idprop, const char *name, int default_value)
float * version_cycles_node_socket_rgba_value(bNodeSocket *socket)
void version_node_socket_index_animdata(Main *bmain, const int node_tree_type, const int node_type, const int socket_index_orig, const int socket_index_offset, const int total_number_of_sockets)
void version_node_input_socket_name(bNodeTree *ntree, const int node_type, const char *old_name, const char *new_name)
bool version_cycles_property_boolean(IDProperty *idprop, const char *name, bool default_value)
void version_socket_update_is_used(bNodeTree *ntree)
ARegion * do_versions_add_region_if_not_found(ListBase *regionbase, int region_type, const char *, int link_after_region_type)
void version_node_output_socket_name(bNodeTree *ntree, const int node_type, const char *old_name, const char *new_name)