9#define DNA_DEPRECATED_ALLOW
11#include <fmt/format.h>
14#define DNA_GENFILE_VERSIONING_MACROS
26#undef DNA_GENFILE_VERSIONING_MACROS
117 auto mix_to_strength = [](
const float mix) {
133 auto size_to_linear = [&](
const int size) {
151 char escaped_node_name[
sizeof(node->
name) * 2 + 1];
153 const std::string node_rna_path = fmt::format(
"nodes[\"{}\"]", escaped_node_name);
158 if (!blender::StringRef(fcurve->rna_path).startswith(node_rna_path)) {
164 char *old_rna_path = fcurve->
rna_path;
166 fcurve->rna_path = BLI_sprintfN(
"%s.%s", node_rna_path.c_str(),
"inputs[1].default_value");
169 fcurve->rna_path = BLI_sprintfN(
"%s.%s", node_rna_path.c_str(),
"inputs[2].default_value");
170 adjust_fcurve_key_frame_values(
171 fcurve, PROP_FLOAT, [&](const float value) { return mix_to_strength(value); });
174 fcurve->rna_path =
BLI_sprintfN(
"%s.%s", node_rna_path.c_str(),
"inputs[3].default_value");
176 fcurve,
PROP_FLOAT, [&](
const float value) {
return size_to_linear(value); });
179 fcurve->rna_path =
BLI_sprintfN(
"%s.%s", node_rna_path.c_str(),
"inputs[4].default_value");
182 fcurve->rna_path =
BLI_sprintfN(
"%s.%s", node_rna_path.c_str(),
"inputs[5].default_value");
185 fcurve->rna_path =
BLI_sprintfN(
"%s.%s", node_rna_path.c_str(),
"inputs[6].default_value");
188 fcurve->rna_path =
BLI_sprintfN(
"%s.%s", node_rna_path.c_str(),
"inputs[7].default_value");
191 fcurve->rna_path =
BLI_sprintfN(
"%s.%s", node_rna_path.c_str(),
"inputs[8].default_value");
195 if (fcurve->rna_path != old_rna_path) {
202 if (storage->mix > 0.5f) {
209 if (link->fromsock != image_output) {
225 if (node_trees_already_versioned.
contains(node_tree)) {
233 else if (node->is_group()) {
237 scene, child_tree, node_trees_already_versioned);
242 node_trees_already_versioned.
add_new(node_tree);
263 const int quality_factor = 1 << storage->quality;
275 const blender::int2 highlights_size = render_size / quality_factor;
283 const float scaled_dimension = smaller_dimension * size_value;
286 auto scale_strength = [chain_length](
const float strength) {
return strength * chain_length; };
294 char escaped_node_name[
sizeof(node->
name) * 2 + 1];
296 const std::string strength_rna_path = fmt::format(
"nodes[\"{}\"].inputs[4].default_value",
301 if (strength_rna_path == fcurve->rna_path) {
302 adjust_fcurve_key_frame_values(
303 fcurve, PROP_FLOAT, [&](const float value) { return scale_strength(value); });
313 if (node_trees_already_versioned.
contains(node_tree)) {
321 else if (node->is_group()) {
325 scene, child_tree, node_trees_already_versioned);
330 node_trees_already_versioned.
add_new(node_tree);
364 dot_product_node->
location[0] = link->fromnode->location[0] + link->fromnode->width + 10.0f;
365 dot_product_node->
location[1] = link->fromnode->location[1];
369 *dot_product_node,
SOCK_IN,
"Vector");
371 *node_tree, *link->fromnode, *link->fromsock, *dot_product_node, *dot_product_a_input);
375 *dot_product_node,
SOCK_IN,
"Vector_001");
381 *dot_product_node,
SOCK_OUT,
"Value");
383 *node_tree, *dot_product_node, *dot_product_output, *link->tonode, *link->tosock);
386 color_to_float_links.
add_new(link->fromsock, output_link);
401 *node,
SOCK_IN,
"Filter Width");
402 if (filter_width_input) {
417 constexpr char SCE_SNAP_TO_NODE_X = (1 << 0);
418 constexpr char SCE_SNAP_TO_NODE_Y = (1 << 1);
420 if (scene->toolsettings->snap_node_mode & SCE_SNAP_TO_NODE_X ||
421 scene->toolsettings->snap_node_mode & SCE_SNAP_TO_NODE_Y)
436 scene, node_tree, node_trees_already_versioned);
444 if (node_trees_already_versioned.
contains(node_tree)) {
453 node_trees_already_versioned.
add_new(node_tree);
475 scene, node_tree, node_trees_already_versioned);
483 if (node_trees_already_versioned.
contains(node_tree)) {
492 node_trees_already_versioned.
add_new(node_tree);
502 auto replace_rna_path_prefix =
513 if (scene->adt->action) {
515 replace_rna_path_prefix(fcurve,
"sequence_editor.sequences",
"sequence_editor.strips");
519 replace_rna_path_prefix(*driver,
"sequence_editor.sequences",
"sequence_editor.strips");
545 data->anchor_y =
data->align_y_legacy;
572 triangulate_nodes.
add(node);
578 if (triangulate_nodes.
contains(link->tonode)) {
579 input_links.
add_new(link->tosock, link);
583 for (
bNode *triangulate : triangulate_nodes) {
591 if (!input_links.
contains(min_verts) && old_min_verts <= 4) {
605 corners_of_face.
locx_legacy = triangulate->locx_legacy - 200;
606 corners_of_face.
locy_legacy = triangulate->locy_legacy - 50;
607 corners_of_face.
parent = triangulate->parent;
612 if (!
STREQ(socket->identifier,
"Total")) {
620 compare_storage->data_type =
SOCK_INT;
621 greater_or_equal.
storage = compare_storage;
628 greater_or_equal.
locx_legacy = triangulate->locx_legacy - 100;
629 greater_or_equal.
locy_legacy = triangulate->locy_legacy - 50;
630 greater_or_equal.
parent = triangulate->parent;
638 (*min_verts_link)->tonode = &greater_or_equal;
654 boolean_and.
locx_legacy = triangulate->locx_legacy - 75;
655 boolean_and.
locy_legacy = triangulate->locy_legacy - 50;
656 boolean_and.
parent = triangulate->parent;
660 (*selection_link)->tonode = &boolean_and;
694 data->lacunarity = 2.0f;
695 data->roughness = 0.5f;
696 data->legacy_noise =
true;
703 node->location[0] = node->locx_legacy;
704 node->location[1] = node->locy_legacy;
706 node->location[0] += parent->locx_legacy;
707 node->location[1] += parent->locy_legacy;
710 node->location[0] += node->offsetx_legacy;
711 node->location[1] += node->offsety_legacy;
712 node->offsetx_legacy = 0.0f;
713 node->offsety_legacy = 0.0f;
725 if (!node->is_group_input()) {
729 switch (socket->type) {
752 strip->
flag &= ~(1 << 6);
760 if (
STREQ(node->idname,
"GeometryNodeInputNormal")) {
872 if (prop_name.
endswith(
"_attribute_name") || prop_name.
endswith(
"_use_attribute")) {
902 if (
STREQ(socket->identifier,
"Shader.001")) {
914 if (!DNA_struct_member_exists(
915 fd->
filesdna,
"RenderData",
"RenderSettings",
"compositor_denoise_preview_quality"))
921 if (!DNA_struct_member_exists(
922 fd->
filesdna,
"RenderData",
"RenderSettings",
"compositor_denoise_final_quality"))
943 if (!DNA_struct_member_exists(fd->
filesdna,
"Curves",
"float",
"surface_collision_distance")) {
945 curves->surface_collision_distance = 0.005f;
959 if ((brush->mask_stencil_dimension[0] == 0) && (brush->mask_stencil_dimension[1] == 0)) {
963 if ((brush->mask_stencil_pos[0] == 0) && (brush->mask_stencil_pos[1] == 0)) {
998 ListBase *regionbase = (sl == area->spacedata.first) ? &area->regionbase :
Functions and classes to work with Actions.
Functionality to iterate an Action in various ways.
Versioning of old animation data. Most animation versioning code lives in the versioning_xxx....
AnimData * BKE_animdata_from_id(const ID *id)
void BKE_fcurves_id_cb(struct ID *id, blender::FunctionRef< void(ID *, FCurve *)> func)
#define FOREACH_MAIN_ID_END
#define MAIN_VERSION_FILE_ATLEAST(main, ver, subver)
#define FOREACH_MAIN_ID_BEGIN(_bmain, _id)
#define FOREACH_NODETREE_END
#define FOREACH_NODETREE_BEGIN(bmain, _nodetree, _id)
#define GEO_NODE_TRIANGULATE
#define SH_NODE_MIX_SHADER
#define GEO_NODE_SUBDIVISION_SURFACE
#define SH_NODE_VECTOR_MATH
void BKE_render_resolution(const RenderData *r, const bool use_crop, int *r_width, int *r_height)
#define LISTBASE_FOREACH(type, var, list)
#define LISTBASE_FOREACH_MUTABLE(type, var, list)
#define LISTBASE_FOREACH_BACKWARD_MUTABLE(type, var, list)
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_strdupcat(const char *__restrict str1, const char *__restrict str2) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1
int bool bool BLI_str_endswith(const char *__restrict str, const char *__restrict end) ATTR_NONNULL(1
size_t BLI_str_escape(char *__restrict dst, const char *__restrict src, size_t dst_maxncpy) ATTR_NONNULL(1
#define STRNCPY_UTF8(dst, src)
@ IDP_FLAG_OVERRIDABLE_LIBRARY
#define DNA_struct_default_get(struct_name)
blenloader genfile private function prototypes
@ NODE_VECTOR_MATH_DOT_PRODUCT
@ NODE_VIEWER_SHORTCUT_NONE
@ NODE_COMPARE_GREATER_EQUAL
@ SCE_COMPOSITOR_DENOISE_BALANCED
@ SCE_COMPOSITOR_DENOISE_HIGH
@ FILE_SORT_ASSET_CATALOG
@ V2D_SCROLL_VERTICAL_HIDE
BMesh const char void * data
static DBVT_INLINE btScalar size(const btDbvtVolume &a)
const Value * lookup_ptr(const Key &key) const
void add_new(const Key &key, const Value &value)
bool contains(const Key &key) const
bool contains(const Key &key) const
constexpr StringRef drop_prefix(int64_t n) const
Value lookup_default(const Key &key, const Value &default_value) const
void add_new(const Key &key, const Value &value)
bool contains(const Key &key) const
void add_new(const Key &key)
constexpr bool startswith(StringRef prefix) const
constexpr bool endswith(StringRef suffix) const
constexpr const char * data() const
void * MEM_callocN(size_t len, const char *str)
void MEM_freeN(void *vmemh)
void convert_legacy_action_assignments(Main &bmain, ReportList *reports)
void convert_legacy_animato_actions(Main &bmain)
void tag_action_users_for_slotted_actions_conversion(Main &bmain)
void foreach_fcurve_in_action(Action &action, FunctionRef< void(FCurve &fcurve)> callback)
bNodeSocket * node_find_socket(bNode &node, eNodeSocketInOut in_out, StringRef identifier)
void node_remove_socket(bNodeTree &ntree, bNode &node, bNodeSocket &sock)
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)
T pow(const T &x, const T &power)
T clamp(const T &a, const T &min, const T &max)
T reduce_max(const VecBase< T, Size > &a)
T reduce_min(const VecBase< T, Size > &a)
T min(const T &a, const T &b)
T max(const T &a, const T &b)
void foreach_strip(ListBase *seqbase, ForEachFunc callback, void *user_data)
Editing * editing_get(const Scene *scene)
SequencerToolSettings * tool_settings_ensure(Scene *scene)
VecBase< int32_t, 2 > int2
CCL_NAMESPACE_BEGIN ccl_device float fade(const float t)
float mask_stencil_pos[2]
float mask_stencil_dimension[2]
FileSelectParams base_params
BlendFileReadReport * reports
struct NodesModifierSettings settings
struct IDProperty * properties
FileAssetSelectParams * asset_params
static bool versioning_convert_seq_text_anchor(Strip *strip, void *)
static void version_node_locations_to_global(bNodeTree &ntree)
static bool versioning_clear_strip_unused_flag(Strip *strip, void *)
static void do_version_bump_filter_width(bNodeTree *node_tree)
void do_versions_after_linking_440(FileData *fd, Main *bmain)
static void remove_triangulate_node_min_size_input(bNodeTree *tree)
static void do_version_color_to_float_conversion(bNodeTree *node_tree)
void blo_do_versions_440(FileData *fd, Library *, Main *bmain)
static void do_version_glare_node_bloom_strength_recursive(const Scene *scene, bNodeTree *node_tree, blender::Set< bNodeTree * > &node_trees_already_versioned)
static void do_version_glare_node_options_to_inputs(const Scene *scene, bNodeTree *node_tree, bNode *node)
static void version_geometry_normal_input_node(bNodeTree &ntree)
static void add_subsurf_node_limit_surface_option(Main &bmain)
static void version_group_input_socket_data_block_reference(bNodeTree &ntree)
static void do_version_glare_node_options_to_inputs_recursive(const Scene *scene, bNodeTree *node_tree, blender::Set< bNodeTree * > &node_trees_already_versioned)
static void do_version_glare_node_bloom_strength(const Scene *scene, bNodeTree *node_tree, bNode *node)
static void do_version_viewer_shortcut(bNodeTree *node_tree)
static void version_fcurve_noise_modifier(FCurve &fcurve)
float * version_cycles_node_socket_float_value(bNodeSocket *socket)
void version_cycles_property_int_set(IDProperty *idprop, const char *name, int value)
IDProperty * version_cycles_properties_from_ID(ID *id)
int version_cycles_property_int(IDProperty *idprop, const char *name, int default_value)
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)
bNode & version_node_add_empty(bNodeTree &ntree, const char *idname)
bNodeLink & version_node_add_link(bNodeTree &ntree, bNode &node_a, bNodeSocket &socket_a, bNode &node_b, bNodeSocket &socket_b)
bNodeSocket * version_node_add_socket_if_not_exist(bNodeTree *ntree, bNode *node, int in_out, int type, int subtype, const char *identifier, const char *name)
void version_cycles_property_boolean_set(IDProperty *idprop, const char *name, bool value)
static void adjust_fcurve_key_frame_values(FCurve *fcurve, const PropertyType property_type, const Function &function)