9#define DNA_DEPRECATED_ALLOW
11#include <fmt/format.h>
14#define DNA_GENFILE_VERSIONING_MACROS
26#undef DNA_GENFILE_VERSIONING_MACROS
116 auto mix_to_strength = [](
const float mix) {
132 auto size_to_linear = [&](
const int size) {
150 char escaped_node_name[
sizeof(node->
name) * 2 + 1];
152 const std::string node_rna_path = fmt::format(
"nodes[\"{}\"]", escaped_node_name);
157 if (!blender::StringRef(fcurve->rna_path).startswith(node_rna_path)) {
163 char *old_rna_path = fcurve->
rna_path;
165 fcurve->rna_path = BLI_sprintfN(
"%s.%s", node_rna_path.c_str(),
"inputs[1].default_value");
168 fcurve->rna_path = BLI_sprintfN(
"%s.%s", node_rna_path.c_str(),
"inputs[2].default_value");
169 adjust_fcurve_key_frame_values(
170 fcurve, PROP_FLOAT, [&](const float value) { return mix_to_strength(value); });
173 fcurve->rna_path =
BLI_sprintfN(
"%s.%s", node_rna_path.c_str(),
"inputs[3].default_value");
175 fcurve,
PROP_FLOAT, [&](
const float value) {
return size_to_linear(value); });
178 fcurve->rna_path =
BLI_sprintfN(
"%s.%s", node_rna_path.c_str(),
"inputs[4].default_value");
181 fcurve->rna_path =
BLI_sprintfN(
"%s.%s", node_rna_path.c_str(),
"inputs[5].default_value");
184 fcurve->rna_path =
BLI_sprintfN(
"%s.%s", node_rna_path.c_str(),
"inputs[6].default_value");
187 fcurve->rna_path =
BLI_sprintfN(
"%s.%s", node_rna_path.c_str(),
"inputs[7].default_value");
190 fcurve->rna_path =
BLI_sprintfN(
"%s.%s", node_rna_path.c_str(),
"inputs[8].default_value");
194 if (fcurve->rna_path != old_rna_path) {
201 if (storage->mix > 0.5f) {
208 if (link->fromsock != image_output) {
224 if (node_trees_already_versioned.
contains(node_tree)) {
232 else if (node->is_group()) {
236 scene, child_tree, node_trees_already_versioned);
241 node_trees_already_versioned.
add_new(node_tree);
262 const int quality_factor = 1 << storage->
quality;
274 const blender::int2 highlights_size = render_size / quality_factor;
282 const float scaled_dimension = smaller_dimension * size_value;
285 auto scale_strength = [chain_length](
const float strength) {
return strength * chain_length; };
293 char escaped_node_name[
sizeof(node->
name) * 2 + 1];
295 const std::string strength_rna_path = fmt::format(
"nodes[\"{}\"].inputs[4].default_value",
300 if (strength_rna_path == fcurve->rna_path) {
301 adjust_fcurve_key_frame_values(
302 fcurve, PROP_FLOAT, [&](const float value) { return scale_strength(value); });
312 if (node_trees_already_versioned.
contains(node_tree)) {
320 else if (node->is_group()) {
324 scene, child_tree, node_trees_already_versioned);
329 node_trees_already_versioned.
add_new(node_tree);
366 dot_product_node->
location[0] = link->fromnode->location[0] + link->fromnode->width + 10.0f;
367 dot_product_node->
location[1] = link->fromnode->location[1];
373 *node_tree, *link->fromnode, *link->fromsock, *dot_product_node, *dot_product_input);
396 *node_tree, *dot_product_node, *dot_product_dot_output, *multiply_node, *multiply_input_a);
408 *node_tree, *multiply_node, *multiply_output, *link->tonode, *link->tosock);
411 color_to_float_links.
add_new(link->fromsock, final_link);
426 *node,
SOCK_IN,
"Filter Width");
427 if (filter_width_input) {
442 constexpr char SCE_SNAP_TO_NODE_X = (1 << 0);
443 constexpr char SCE_SNAP_TO_NODE_Y = (1 << 1);
445 if (scene->toolsettings->snap_node_mode & SCE_SNAP_TO_NODE_X ||
446 scene->toolsettings->snap_node_mode & SCE_SNAP_TO_NODE_Y)
461 scene, node_tree, node_trees_already_versioned);
469 if (node_trees_already_versioned.
contains(node_tree)) {
478 node_trees_already_versioned.
add_new(node_tree);
500 scene, node_tree, node_trees_already_versioned);
508 if (node_trees_already_versioned.
contains(node_tree)) {
517 node_trees_already_versioned.
add_new(node_tree);
527 auto replace_rna_path_prefix =
538 if (scene->adt->action) {
540 replace_rna_path_prefix(fcurve,
"sequence_editor.sequences",
"sequence_editor.strips");
544 replace_rna_path_prefix(*driver,
"sequence_editor.sequences",
"sequence_editor.strips");
597 triangulate_nodes.
add(node);
603 if (triangulate_nodes.
contains(link->tonode)) {
604 input_links.
add_new(link->tosock, link);
608 for (
bNode *triangulate : triangulate_nodes) {
616 if (!input_links.
contains(min_verts) && old_min_verts <= 4) {
630 corners_of_face.
locx_legacy = triangulate->locx_legacy - 200;
631 corners_of_face.
locy_legacy = triangulate->locy_legacy - 50;
632 corners_of_face.
parent = triangulate->parent;
637 if (!
STREQ(socket->identifier,
"Total")) {
645 compare_storage->data_type =
SOCK_INT;
646 greater_or_equal.
storage = compare_storage;
653 greater_or_equal.
locx_legacy = triangulate->locx_legacy - 100;
654 greater_or_equal.
locy_legacy = triangulate->locy_legacy - 50;
655 greater_or_equal.
parent = triangulate->parent;
663 (*min_verts_link)->tonode = &greater_or_equal;
679 boolean_and.
locx_legacy = triangulate->locx_legacy - 75;
680 boolean_and.
locy_legacy = triangulate->locy_legacy - 50;
681 boolean_and.
parent = triangulate->parent;
685 (*selection_link)->tonode = &boolean_and;
719 data->lacunarity = 2.0f;
720 data->roughness = 0.5f;
721 data->legacy_noise =
true;
728 node->location[0] = node->locx_legacy;
729 node->location[1] = node->locy_legacy;
731 node->location[0] += parent->locx_legacy;
732 node->location[1] += parent->locy_legacy;
735 node->location[0] += node->offsetx_legacy;
736 node->location[1] += node->offsety_legacy;
737 node->offsetx_legacy = 0.0f;
738 node->offsety_legacy = 0.0f;
750 if (!node->is_group_input()) {
754 switch (socket->type) {
777 strip->
flag &= ~(1 << 6);
785 if (
STREQ(node->idname,
"GeometryNodeInputNormal")) {
869 STRNCPY(tref->idname,
"builtin.brush");
897 if (prop_name.
endswith(
"_attribute_name") || prop_name.
endswith(
"_use_attribute")) {
927 if (
STREQ(socket->identifier,
"Shader.001")) {
928 STRNCPY(socket->identifier,
"Shader_001");
939 if (!DNA_struct_member_exists(
940 fd->
filesdna,
"RenderData",
"RenderSettings",
"compositor_denoise_preview_quality"))
946 if (!DNA_struct_member_exists(
947 fd->
filesdna,
"RenderData",
"RenderSettings",
"compositor_denoise_final_quality"))
968 if (!DNA_struct_member_exists(fd->
filesdna,
"Curves",
"float",
"surface_collision_distance")) {
970 curves->surface_collision_distance = 0.005f;
984 if ((brush->mask_stencil_dimension[0] == 0) && (brush->mask_stencil_dimension[1] == 0)) {
988 if ((brush->mask_stencil_pos[0] == 0) && (brush->mask_stencil_pos[1] == 0)) {
1023 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
void BKE_render_resolution(const RenderData *r, const bool use_crop, int *r_width, int *r_height)
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)
#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
char * STRNCPY(char(&dst)[N], const char *src)
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
@ IDP_FLAG_OVERRIDABLE_LIBRARY
#define DNA_struct_default_get(struct_name)
blenloader genfile private function prototypes
@ 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)
Editing * editing_get(const Scene *scene)
void for_each_callback(ListBase *seqbase, ForEachFunc callback, void *user_data)
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)