9#define DNA_DEPRECATED_ALLOW
12#define DNA_GENFILE_VERSIONING_MACROS
25#undef DNA_GENFILE_VERSIONING_MACROS
64 constexpr char const *rna_path_prefix =
"collections[";
65 if (!
rna_path.startswith(rna_path_prefix)) {
69 const std::string path_remainder(
rna_path.drop_known_prefix(rna_path_prefix));
70 fcurve->rna_path_set_move(
BLI_sprintfN(
"collections_all[%s", path_remainder.c_str()));
83 bool hide_shadows = *material_len > 0;
86 if (!material || material->blend_shadow !=
MA_BS_NONE) {
205 if (socket->
link ==
nullptr) {
212 switch (
node->type_legacy) {
224 if (socket->
link ==
nullptr) {
226 if ((socket_color_value[0] == 0.0f) && (socket_color_value[1] == 0.0f) &&
227 (socket_color_value[2] == 0.0f))
231 if ((socket_color_value[0] == 1.0f) && (socket_color_value[1] == 1.0f) &&
232 (socket_color_value[2] == 1.0f))
247 if (socket->
link ==
nullptr) {
249 if (socket_float_value == 0.0f) {
252 if (socket_float_value == 1.0f) {
269 if (socket->
link ==
nullptr) {
271 if (socket_value == 0.0f) {
274 if (socket_value == 1.0f) {
283 if (socket->
link ==
nullptr) {
285 if (socket_value == 0.0f) {
288 if (socket_value == 1.0f) {
311 if (output_node ==
nullptr) {
321 if (alpha.
socket ==
nullptr) {
325 bool is_opaque = (threshold == 2.0f);
332 float values[4] = {value, value, value, 1.0f};
375 float sum = default_value[0] + default_value[1] + default_value[2];
377 float avg = (sum >= 3.0f) ? 1.0f : (sum / 3.0f);
380 float values[4] = {value, value, value, 1.0f};
386 (*default_value > threshold));
395 if (!material->use_nodes || material->nodetree ==
nullptr) {
402 if (output_node ==
nullptr) {
408 if (existing_out_sock->
link ==
nullptr && volume_sock->
link) {
424 auto copy_link = [&](
const char *socket_name) {
426 if (sock && sock->
link) {
435 copy_link(
"Displacement");
436 copy_link(
"Thickness");
438 output_node = new_output;
455 if (old_out_sock->
link !=
nullptr) {
461 if (out_sock->
link !=
nullptr) {
477 if (&sock != is_shadow) {
533 if (!material.use_nodes || material.nodetree ==
nullptr) {
539 else if (material.blend_shadow ==
MA_BS_NONE) {
551 RPT_(
"Material %s could not be converted because of different Blend Mode "
552 "and Shadow Mode (need manual adjustment)\n"),
553 material.id.name + 2);
558 float threshold = (material.blend_method ==
MA_BM_CLIP) ? material.alpha_threshold :
564 RPT_(
"Material %s could not be converted because of non-trivial "
565 "alpha blending (need manual adjustment)\n"),
566 material.id.name + 2);
586 constexpr char deprecated_avi_raw_imtype = 15;
587 constexpr char deprecated_avi_jpeg_imtype = 16;
654 new_shelf_region->regiondata = MEM_new<RegionAssetShelf>(__func__);
677 if (thickness_socket ==
nullptr) {
681 bool has_link =
false;
683 if (link.
tosock == thickness_socket) {
713 if (
data->shadow_angle == 0.0f) {
715 data->shadow_offset = 0.04f;
716 data->shadow_blur = 0.0f;
718 if (
data->outline_width == 0.0f) {
719 data->outline_color[3] = 0.7f;
720 data->outline_width = 0.05f;
734 if (layer_index == -1) {
737 float *
data =
static_cast<float *
>(
792 constexpr int NTREE_EXECUTION_MODE_CPU = 0;
793 constexpr int NTREE_EXECUTION_MODE_FULL_FRAME = 1;
803 ntree->flag &= ~(NTREE_COM_GROUPNODE_BUFFER | NTREE_COM_OPENCL);
805 if (ntree->execution_mode == NTREE_EXECUTION_MODE_FULL_FRAME) {
806 ntree->execution_mode = NTREE_EXECUTION_MODE_CPU;
813 if (!DNA_struct_member_exists(fd->
filesdna,
"SpaceImage",
"float",
"stretch_opacity")) {
837 settings->curve_radius = 0.01f;
844 light.shadow_filter_radius = 1.0f;
849 const float default_snap_angle_increment =
DEG2RADF(5.0f);
850 const float default_snap_angle_increment_precision =
DEG2RADF(1.0f);
855 default_snap_angle_increment_precision;
857 default_snap_angle_increment_precision;
862 if (!DNA_struct_member_exists(fd->
filesdna,
"SceneEEVEE",
"int",
"gtao_resolution")) {
876 if (scene.
ed !=
nullptr) {
885 mpath->color_post[0] = 0.1f;
886 mpath->color_post[1] = 1.0f;
887 mpath->color_post[2] = 0.1f;
894 mpath->color_post[0] = 0.1f;
895 mpath->color_post[1] = 1.0f;
896 mpath->color_post[2] = 0.1f;
903 if (!DNA_struct_member_exists(fd->
filesdna,
"Light",
"float",
"transmission_fac")) {
907 light.transmission_fac = 0.0f;
940 if (scene.
ed !=
nullptr) {
947 if (!DNA_struct_member_exists(fd->
filesdna,
"Material",
"char",
"thickness_mode")) {
953 if ((material.blend_flag &
MA_BL_SS_REFRACTION) && material.use_nodes && material.nodetree)
984 const float size_factor = 3.0f / 2.0f;
985 blur_data.
sizex *= size_factor;
986 blur_data.
sizey *= size_factor;
995 if (!DNA_struct_member_exists(fd->
filesdna,
"SceneEEVEE",
"float",
"shadow_resolution_scale"))
1006 if (scene.
ed !=
nullptr) {
1043 lightprobe.grid_surfel_density =
max_ii(20,
1044 2 * std::max({lightprobe.grid_resolution_x,
1045 lightprobe.grid_resolution_y,
1046 lightprobe.grid_resolution_z}));
1051 bool only_uses_eevee_legacy_or_workbench =
true;
1054 only_uses_eevee_legacy_or_workbench =
false;
1059 if (world.nodetree) {
1064 if (volume_input_socket) {
1065 for (
bNodeLink &node_link : world.nodetree->links) {
1066 if (node_link.
tonode == output_node && node_link.
tosock == volume_input_socket) {
1069 if (only_uses_eevee_legacy_or_workbench) {
1072 RPT_(
"%s contains a volume shader that might need to be "
1073 "converted to object (see world volume panel)\n"),
1085 constexpr int NTREE_EXECUTION_MODE_GPU = 2;
1098 float shadow_max_res_sun = 0.001f;
1099 float shadow_max_res_local = 0.001f;
1100 bool shadow_resolution_absolute =
false;
1105 shadow_max_res_local =
ceil(shadow_max_res_local * 1000.0f) / 1000.0f;
1106 shadow_resolution_absolute =
true;
1113 light.shadow_maximum_resolution = shadow_max_res_sun;
1117 light.shadow_maximum_resolution = shadow_max_res_local;
1126 if (
brush.gpencil_settings) {
1136 const World default_world;
1140 world.sun_shadow_maximum_resolution = default_world.sun_shadow_maximum_resolution;
1157 const Light default_light;
1162 clight,
"cast_shadow", default_light.mode &
LA_SHADOW);
1178 const Light default_light;
1180 light.shadow_jitter_overblur = default_light.shadow_jitter_overblur;
1185 const World default_world;
1187 world.sun_shadow_maximum_resolution = default_world.sun_shadow_maximum_resolution;
1193 const Scene default_scene;
1214 const Scene default_scene;
1257 if (
storage->next_identifier > 0) {
1260 storage->capture_items_num = 1;
1261 storage->capture_items = MEM_new_array<NodeGeometryAttributeCaptureItem>(
1262 storage->capture_items_num, __func__);
1303 curve_mapping.
cur = 3;
1349 bool transparent_shadows = material.blend_shadow !=
MA_BS_SOLID;
1366 if (
node.storage ==
nullptr) {
1373 NodeDenoise *ndg = MEM_new<NodeDenoise>(__func__);
CustomData interface, see also DNA_customdata_types.h.
Low-level operations for grease pencil.
#define MAIN_VERSION_FILE_ATLEAST(main, ver, subver)
General operations, lookup, etc. for materials.
#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
#define STRNCPY_UTF8(dst, src)
blenloader genfile private function prototypes
#define SET_FLAG_FROM_TEST(value, test, flag)
constexpr IndexRange()=default
float sun_shadow_filter_radius()
#define storage(slot, qualifiers)
ccl_device_inline float3x3 inverted(const float3x3 m)
constexpr float LEGACY_RADIUS_CONVERSION_FACTOR
void node_remove_link(bNodeTree *ntree, bNodeLink &link)
bNode * node_add_node(const bContext *C, bNodeTree &ntree, UString idname, std::optional< int > unique_identifier=std::nullopt)
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)
bNodeSocket * node_find_socket(bNode &node, eNodeSocketInOut in_out, UString identifier)
BLI_INLINE Texture * wrap(MTLTexture *texture)
void foreach_strip(ListBaseT< Strip > *seqbase, ForEachFunc callback, void *user_data)
SequencerToolSettings * tool_settings_ensure(Scene *scene)
bool version_node_ensure_storage_or_invalidate(bNode &node)
MINLINE float min_ff(float a, float b)
static void versioning_node_hue_correct_set_wrappng(bNodeTree *ntree)
BLI_assert(slot->slot_subtype.map==BMO_OP_SLOT_SUBTYPE_MAP_FLT)
static void hue_correct_set_wrapping(CurveMapping *curve_mapping)
char * STRNCPY(char(&dst)[N], const char *src)
@ LIMIT_ROT_LEGACY_BEHAVIOR
static void image_settings_avi_to_ffmpeg(Scene *scene)
short * BKE_object_material_len_p(Object *ob)
@ RGN_TYPE_ASSET_SHELF_HEADER
@ CONSTRAINT_TYPE_ROTLIMIT
Material * BKE_object_material_get(Object *ob, short act)
static bool versioning_eevee_material_blend_mode_settings(bNodeTree *ntree, float threshold)
static AlphaSource versioning_eevee_alpha_source_get(bNodeSocket *socket, int depth=0)
@ MA_SURFACE_METHOD_FORWARD
@ MA_SURFACE_METHOD_DEFERRED
char * BLI_sprintfN(const char *__restrict format,...) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1) ATTR_MALLOC ATTR_PRINTF_FORMAT(1
@ WO_USE_EEVEE_FINITE_VOLUME
const char * RE_engine_id_CYCLES
MINLINE int max_ii(int a, int b)
static bool strip_hue_correct_set_wrapping(Strip *strip, void *)
@ MA_BL_THICKNESS_FROM_SHADOW
@ MA_BL_TRANSPARENT_SHADOW
float * version_cycles_node_socket_float_value(bNodeSocket *socket)
const char * RE_engine_id_BLENDER_WORKBENCH
@ V3D_SHOW_CAMERA_PASSEPARTOUT
@ BRUSH_CURVES_SCULPT_FLAG_INTERPOLATE_RADIUS
@ RGN_ALIGN_HIDE_WITH_PREV
const char * RE_engine_id_BLENDER_EEVEE
void do_versions_after_linking_402(FileData *fd, Main *bmain)
int version_cycles_property_int(IDProperty *idprop, const char *name, int default_value)
void version_socket_update_is_used(bNodeTree *ntree)
void version_node_output_socket_name(bNodeTree *ntree, const int node_type, const char *old_name, const char *new_name)
AnimData * BKE_animdata_from_id(const ID *id)
@ SCE_EEVEE_MOTION_BLUR_ENABLED_DEPRECATED
@ SCE_EEVEE_VOLUME_CUSTOM_RANGE
@ CMP_NODE_BLUR_TYPE_FAST_GAUSS
void * BLI_findlink(const ListBase *listbase, int number) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
float * version_cycles_node_socket_rgba_value(bNodeSocket *socket)
static bool strip_text_data_update(Strip *strip, void *)
@ SCE_COMPOSITOR_DEVICE_GPU
BMesh const char void * data
static void versioning_eevee_material_shadow_none(Material *material)
@ SEQ_CACHE_SHOW_FINAL_OUT
static void versioning_eevee_shadow_settings(Object *object)
bool all_scenes_use(Main *bmain, const Span< const char * > engines)
bNode * version_eevee_output_node_get(bNodeTree *ntree, int16_t node_type)
void BLO_reportf_wrap(BlendFileReadReport *reports, eReportType type, const char *format,...) ATTR_PRINTF_FORMAT(3
static void version_bonecollection_anim(FCurve *fcurve)
int CustomData_get_named_layer_index(const CustomData *data, eCustomDataType type, StringRef name)
static void convert_grease_pencil_stroke_hardness_to_softness(GreasePencil *grease_pencil)
bool version_cycles_property_boolean(IDProperty *idprop, const char *name, bool default_value)
char * BLI_strdup(const char *str) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1) ATTR_MALLOC
MINLINE void copy_v3_fl(float r[3], float f)
@ SEQ_EDIT_SHOW_MISSING_MEDIA
void blo_do_versions_402(FileData *fd, Library *lib, Main *bmain)
void version_node_input_socket_name(bNodeTree *ntree, const int node_type, const char *old_name, const char *new_name)
void * CustomData_get_layer_named_for_write(CustomData *data, eCustomDataType type, StringRef name, int totelem)
IDProperty * version_cycles_properties_from_ID(ID *id)
MINLINE void copy_v4_v4(float r[4], const float a[4])
ARegion * do_versions_add_region_if_not_found(ListBaseT< ARegion > *regionbase, int region_type, const char *, int link_after_region_type)
static void add_image_editor_asset_shelf(Main &bmain)
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)
@ CMP_NODE_DENOISE_PREFILTER_ACCURATE
@ eSeqModifierType_HueCorrect
static void version_refraction_depth_to_thickness_value(bNodeTree *ntree, float thickness)
@ SN_OVERLAY_SHOW_REROUTE_AUTO_LABELS
KERNEL_FEATURE_LIGHT_PASSES KERNEL_FEATURE_PATH_GUIDING float
bool is_transparent() const
static AlphaSource complex_alpha()
static AlphaSource alpha_source(bNodeSocket *fac, bool inverted=false)
bool is_semi_transparent() const
bool is_fully_transparent() const
static AlphaSource add(const AlphaSource &a, const AlphaSource &b)
@ ALPHA_FULLY_TRANSPARENT
static AlphaSource opaque()
static AlphaSource fully_transparent(bNodeSocket *socket=nullptr, bool inverted=false)
static AlphaSource mix(const AlphaSource &a, const AlphaSource &b, bNodeSocket *fac)
ListBaseT< FCurve > drivers
CustomData curve_data_legacy
eEditingShowMissingMediaFlag show_missing_media_flag
eEditingCacheFlag cache_flag
ListBaseT< Strip > seqbase
BlendFileReadReport * reports
std::unique_ptr< SDNA > filesdna
struct CurveMapping curve_mapping
ListBaseT< bArmature > armatures
ListBaseT< bNodeTree > nodetrees
ListBaseT< Light > lights
ListBaseT< World > worlds
ListBaseT< Brush > brushes
ListBaseT< Material > materials
ListBaseT< Object > objects
ListBaseT< Scene > scenes
ListBaseT< GreasePencil > grease_pencils
ListBaseT< LightProbe > lightprobes
ListBaseT< bScreen > screens
DNA_DEPRECATED short filtertype
DNA_DEPRECATED float percentx
DNA_DEPRECATED short sizex
DNA_DEPRECATED float percenty
DNA_DEPRECATED short sizey
DNA_DEPRECATED char prefilter
ListBaseT< bConstraint > constraints
eCompositorPrecision compositor_precision
ImageFormatData im_format
eCompositorDevice compositor_device
float motion_blur_shutter
float shadow_resolution_scale
DNA_DEPRECATED int shadow_cube_size_deprecated
DNA_DEPRECATED int motion_blur_position_deprecated
float fast_gi_thickness_near
float clamp_surface_indirect
float clamp_volume_indirect
int gi_cubemap_resolution
DNA_DEPRECATED float motion_blur_shutter_deprecated
DNA_DEPRECATED struct bNodeTree * nodetree
struct ToolSettings * toolsettings
ListBaseT< ARegion > regionbase
ListBaseT< SpaceLink > spacedata
eSpaceSeq_SequencerCacheOverlay_Flag flag
ListBaseT< ARegion > regionbase
eSpaceNodeOverlay_Flag flag
struct SequencerCacheOverlay cache_overlay
ListBaseT< FCurve > curves
ListBaseT< bNodeLink > links
DNA_DEPRECATED int execution_mode
DNA_DEPRECATED int precision
ListBaseT< bNodeSocket > outputs
ListBaseT< bNodeSocket > inputs
ListBaseT< struct bConstraint > constraints
float custom_shape_wire_width
ListBaseT< bPoseChannel > chanbase
ListBaseT< struct ScrArea > areabase