Changeset View
Changeset View
Standalone View
Standalone View
source/blender/blenloader/intern/versioning_common.cc
| /* SPDX-License-Identifier: GPL-2.0-or-later */ | /* SPDX-License-Identifier: GPL-2.0-or-later */ | ||||
| /** \file | /** \file | ||||
| * \ingroup blenloader | * \ingroup blenloader | ||||
| */ | */ | ||||
| /* allow readfile to use deprecated functionality */ | /* allow readfile to use deprecated functionality */ | ||||
| #define DNA_DEPRECATED_ALLOW | #define DNA_DEPRECATED_ALLOW | ||||
| #include <cstring> | #include <cstring> | ||||
| #include "DNA_node_types.h" | #include "DNA_node_types.h" | ||||
| #include "DNA_screen_types.h" | #include "DNA_screen_types.h" | ||||
| #include "BLI_listbase.h" | #include "BLI_listbase.h" | ||||
| #include "BLI_string.h" | #include "BLI_string.h" | ||||
| #include "BLI_string_ref.hh" | #include "BLI_string_ref.hh" | ||||
| #include "BLI_vector.hh" | |||||
| #include "BKE_animsys.h" | #include "BKE_animsys.h" | ||||
| #include "BKE_attribute_math.hh" | |||||
| #include "BKE_lib_id.h" | #include "BKE_lib_id.h" | ||||
| #include "BKE_main.h" | #include "BKE_main.h" | ||||
| #include "BKE_node.h" | #include "BKE_node.h" | ||||
| #include "MEM_guardedalloc.h" | #include "MEM_guardedalloc.h" | ||||
| #include "versioning_common.h" | #include "versioning_common.h" | ||||
| ▲ Show 20 Lines • Show All 200 Lines • ▼ Show 20 Lines | |||||
| } | } | ||||
| ARegion *do_versions_add_region(int regiontype, const char *name) | ARegion *do_versions_add_region(int regiontype, const char *name) | ||||
| { | { | ||||
| ARegion *region = (ARegion *)MEM_callocN(sizeof(ARegion), name); | ARegion *region = (ARegion *)MEM_callocN(sizeof(ARegion), name); | ||||
| region->regiontype = regiontype; | region->regiontype = regiontype; | ||||
| return region; | return region; | ||||
| } | } | ||||
| /* In_Out : true - input, false - output. */ | |||||
| void socket_naming_attribute_defualt(ListBase inputs_list, int node_type, bool in_out) | |||||
| { | |||||
| printf("DO\n"); | |||||
| blender::Vector<bNodeSocket *> list(inputs_list); | |||||
| switch (node_type) { | |||||
| case (GEO_NODE_CAPTURE_ATTRIBUTE): { | |||||
| printf("GEO_NODE_CAPTURE_ATTRIBUTE: %d\n", list.size()); | |||||
| blender::attribute_math::default_name<blender::float3>().copy(list[1]->identifier, 64); | |||||
| blender::attribute_math::default_name<float>().copy(list[2]->identifier, 64); | |||||
| blender::attribute_math::default_name<blender::ColorGeometry4f>().copy(list[3]->identifier, | |||||
| 64); | |||||
HooglyBoogly: I think this is a prefix rather than a suffix | |||||
| blender::attribute_math::default_name<bool>().copy(list[4]->identifier, 64); | |||||
| blender::attribute_math::default_name<int>().copy(list[5]->identifier, 64); | |||||
| break; | |||||
| } | |||||
| case (GEO_NODE_INPUT_NAMED_ATTRIBUTE): { | |||||
| if (!in_out) { | |||||
| printf("GEO_NODE_INPUT_NAMED_ATTRIBUTE: %d\n", list.size()); | |||||
| blender::attribute_math::default_name<blender::float3>().copy(list[0]->identifier, 64); | |||||
| blender::attribute_math::default_name<float>().copy(list[1]->identifier, 64); | |||||
| blender::attribute_math::default_name<blender::ColorGeometry4f>().copy(list[2]->identifier, | |||||
| 64); | |||||
| blender::attribute_math::default_name<bool>().copy(list[3]->identifier, 64); | |||||
| blender::attribute_math::default_name<int>().copy(list[4]->identifier, 64); | |||||
| } | |||||
| break; | |||||
| } | |||||
| case (GEO_NODE_FIELD_ON_DOMAIN): { | |||||
| printf("GEO_NODE_FIELD_ON_DOMAIN: %d\n", list.size()); | |||||
| blender::attribute_math::default_name<float>().copy(list[0]->identifier, 64); | |||||
| blender::attribute_math::default_name<int>().copy(list[1]->identifier, 64); | |||||
| blender::attribute_math::default_name<blender::float3>().copy(list[2]->identifier, 64); | |||||
| blender::attribute_math::default_name<blender::ColorGeometry4f>().copy(list[3]->identifier, | |||||
| 64); | |||||
| blender::attribute_math::default_name<bool>().copy(list[4]->identifier, 64); | |||||
| break; | |||||
| } | |||||
| case (GEO_NODE_FIELD_AT_INDEX): { | |||||
| printf("GEO_NODE_FIELD_AT_INDEX: %d\n", list.size()); | |||||
| int pointer = int(in_out); | |||||
| blender::attribute_math::default_name<float>().copy(list[pointer]->identifier, 64); | |||||
| pointer++; | |||||
| blender::attribute_math::default_name<int>().copy(list[pointer]->identifier, 64); | |||||
| pointer++; | |||||
| blender::attribute_math::default_name<blender::float3>().copy(list[pointer]->identifier, 64); | |||||
| pointer++; | |||||
| blender::attribute_math::default_name<blender::ColorGeometry4f>().copy( | |||||
| list[pointer]->identifier, 64); | |||||
| pointer++; | |||||
| blender::attribute_math::default_name<bool>().copy(list[pointer]->identifier, 64); | |||||
| break; | |||||
| } | |||||
| case (GEO_NODE_TRANSFER_ATTRIBUTE): { | |||||
| printf("GEO_NODE_TRANSFER_ATTRIBUTE: %d\n", list.size()); | |||||
| int pointer = int(in_out); | |||||
| blender::attribute_math::default_name<blender::float3>().copy(list[pointer]->identifier, 64); | |||||
| pointer++; | |||||
| blender::attribute_math::default_name<float>().copy(list[pointer]->identifier, 64); | |||||
| pointer++; | |||||
| blender::attribute_math::default_name<blender::ColorGeometry4f>().copy( | |||||
| list[pointer]->identifier, 64); | |||||
| pointer++; | |||||
| blender::attribute_math::default_name<bool>().copy(list[pointer]->identifier, 64); | |||||
| pointer++; | |||||
| blender::attribute_math::default_name<int>().copy(list[pointer]->identifier, 64); | |||||
| break; | |||||
| } | |||||
| default: { | |||||
| } | |||||
| } | |||||
| } | |||||
| void version_node_socket_naming_attribute_defualt_input(ListBase inputs_list, int node_type) | |||||
| { | |||||
| if (node_type == GEO_NODE_SWITCH) { | |||||
| blender::Vector<bNodeSocket *> list(inputs_list); | |||||
| STRNCPY(list[0]->identifier, "Switch_Field"); | |||||
| STRNCPY(list[1]->identifier, "Switch_Single"); | |||||
| int pointer = 2; | |||||
| { | |||||
| static const std::string false_ = "False_" + blender::attribute_math::default_name<float>(); | |||||
| STRNCPY(list[pointer]->identifier, false_.c_str()); | |||||
| pointer++; | |||||
| static const std::string true_ = "True_" + blender::attribute_math::default_name<float>(); | |||||
| STRNCPY(list[pointer]->identifier, true_.c_str()); | |||||
| pointer++; | |||||
| } | |||||
| printf("14367e5BBBBBB\n"); | |||||
| { | |||||
| static const std::string false_ = "False_" + blender::attribute_math::default_name<int>(); | |||||
| STRNCPY(list[pointer]->identifier, false_.c_str()); | |||||
| pointer++; | |||||
| static const std::string true_ = "True_" + blender::attribute_math::default_name<int>(); | |||||
| STRNCPY(list[pointer]->identifier, true_.c_str()); | |||||
| pointer++; | |||||
| } | |||||
| { | |||||
| static const std::string false_ = "False_" + blender::attribute_math::default_name<bool>(); | |||||
| STRNCPY(list[pointer]->identifier, false_.c_str()); | |||||
| pointer++; | |||||
| static const std::string true_ = "True_" + blender::attribute_math::default_name<bool>(); | |||||
| STRNCPY(list[pointer]->identifier, true_.c_str()); | |||||
| pointer++; | |||||
| } | |||||
| printf("000BBBBBB\n"); | |||||
| { | |||||
| static const std::string false_ = "False_" + | |||||
| blender::attribute_math::default_name<blender::float3>(); | |||||
| STRNCPY(list[pointer]->identifier, false_.c_str()); | |||||
| pointer++; | |||||
| static const std::string true_ = "True_" + | |||||
| blender::attribute_math::default_name<blender::float3>(); | |||||
| STRNCPY(list[pointer]->identifier, true_.c_str()); | |||||
| pointer++; | |||||
| } | |||||
| { | |||||
| static const std::string false_ = | |||||
| "False_" + blender::attribute_math::default_name<blender::ColorGeometry4f>(); | |||||
| STRNCPY(list[pointer]->identifier, false_.c_str()); | |||||
| pointer++; | |||||
| static const std::string true_ = | |||||
| "True_" + blender::attribute_math::default_name<blender::ColorGeometry4f>(); | |||||
| STRNCPY(list[pointer]->identifier, true_.c_str()); | |||||
| pointer++; | |||||
| } | |||||
| { | |||||
| static const std::string false_ = "False_" + | |||||
| blender::attribute_math::default_name<std::string>(); | |||||
| STRNCPY(list[pointer]->identifier, false_.c_str()); | |||||
| pointer++; | |||||
| static const std::string true_ = "True_" + | |||||
| blender::attribute_math::default_name<std::string>(); | |||||
| STRNCPY(list[pointer]->identifier, true_.c_str()); | |||||
| pointer++; | |||||
| } | |||||
| printf("BBBBBB\n"); | |||||
| STRNCPY(list[pointer]->identifier, "False_Geometry"); | |||||
| pointer++; | |||||
| STRNCPY(list[pointer]->identifier, "True_Geometry"); | |||||
| pointer++; | |||||
| STRNCPY(list[pointer]->identifier, "False_Geometry"); | |||||
| pointer++; | |||||
| STRNCPY(list[pointer]->identifier, "True_Object"); | |||||
| pointer++; | |||||
| STRNCPY(list[pointer]->identifier, "False_Geometry"); | |||||
| pointer++; | |||||
| STRNCPY(list[pointer]->identifier, "True_Collection"); | |||||
| pointer++; | |||||
| STRNCPY(list[pointer]->identifier, "False_Geometry"); | |||||
| pointer++; | |||||
| STRNCPY(list[pointer]->identifier, "True_Texture"); | |||||
| pointer++; | |||||
| STRNCPY(list[pointer]->identifier, "False_Geometry"); | |||||
| pointer++; | |||||
| STRNCPY(list[pointer]->identifier, "True_Material"); | |||||
| pointer++; | |||||
| STRNCPY(list[pointer]->identifier, "False_Geometry"); | |||||
| pointer++; | |||||
| STRNCPY(list[pointer]->identifier, "True_Image"); | |||||
| pointer++; | |||||
| printf("BBBBBB444\n"); | |||||
| } | |||||
| else { | |||||
| socket_naming_attribute_defualt(inputs_list, node_type, true); | |||||
| } | |||||
| } | |||||
| void version_node_socket_naming_attribute_defualt_output(ListBase inputs_list, int node_type) | |||||
| { | |||||
| if (node_type == GEO_NODE_SWITCH) { | |||||
| blender::Vector<bNodeSocket *> list(inputs_list); | |||||
| int pointer = 0; | |||||
| blender::attribute_math::default_name<float>().copy(list[pointer]->identifier, 64); | |||||
| pointer++; | |||||
| blender::attribute_math::default_name<int>().copy(list[pointer]->identifier, 64); | |||||
| pointer++; | |||||
| blender::attribute_math::default_name<bool>().copy(list[pointer]->identifier, 64); | |||||
| pointer++; | |||||
| blender::attribute_math::default_name<blender::float3>().copy(list[pointer]->identifier, 64); | |||||
| pointer++; | |||||
| blender::attribute_math::default_name<blender::ColorGeometry4f>().copy( | |||||
| list[pointer]->identifier, 64); | |||||
| pointer++; | |||||
| blender::attribute_math::default_name<std::string>().copy(list[pointer]->identifier, 64); | |||||
| pointer++; | |||||
| STRNCPY(list[pointer]->identifier, "Geometry"); | |||||
| pointer++; | |||||
| STRNCPY(list[pointer]->identifier, "Object"); | |||||
| pointer++; | |||||
| STRNCPY(list[pointer]->identifier, "Collection"); | |||||
| pointer++; | |||||
| STRNCPY(list[pointer]->identifier, "Texture"); | |||||
| pointer++; | |||||
| STRNCPY(list[pointer]->identifier, "Material"); | |||||
| pointer++; | |||||
| STRNCPY(list[pointer]->identifier, "Image"); | |||||
| pointer++; | |||||
| } | |||||
| else { | |||||
| socket_naming_attribute_defualt(inputs_list, node_type, false); | |||||
| } | |||||
| } | |||||
I think this is a prefix rather than a suffix