Cleanup: rename DNA_genfile.h functions
Rename for clarity in preparation for further refactoring. Remove the need for `_nr` in function names. - Rename *_find() functions to *_exists() since they returned a boolean. - Rename *_find_nr() functions to *_find(). - Rename *_struct_elem_* to *_struct_member_*. - Rename DNA_elem_size_nr -> DNA_struct_member_size. - Rename DNA_elem_offset -> DNA_struct_member_offset_by_name.
This commit is contained in:
@@ -158,7 +158,7 @@ LinkNode *BLO_blendhandle_get_datablock_info(BlendHandle *bh,
|
||||
BHead *bhead;
|
||||
int tot = 0;
|
||||
|
||||
const int sdna_nr_preview_image = DNA_struct_find_nr(fd->filesdna, "PreviewImage");
|
||||
const int sdna_nr_preview_image = DNA_struct_find(fd->filesdna, "PreviewImage");
|
||||
|
||||
for (bhead = blo_bhead_first(fd); bhead; bhead = blo_bhead_next(fd, bhead)) {
|
||||
if (bhead->code == BLO_CODE_ENDB) {
|
||||
@@ -261,7 +261,7 @@ PreviewImage *BLO_blendhandle_get_preview_for_id(BlendHandle *bh,
|
||||
{
|
||||
FileData *fd = (FileData *)bh;
|
||||
bool looking = false;
|
||||
const int sdna_preview_image = DNA_struct_find_nr(fd->filesdna, "PreviewImage");
|
||||
const int sdna_preview_image = DNA_struct_find(fd->filesdna, "PreviewImage");
|
||||
|
||||
for (BHead *bhead = blo_bhead_first(fd); bhead; bhead = blo_bhead_next(fd, bhead)) {
|
||||
if (bhead->code == BLO_CODE_DATA) {
|
||||
@@ -331,7 +331,7 @@ LinkNode *BLO_blendhandle_get_previews(BlendHandle *bh, int ofblocktype, int *r_
|
||||
}
|
||||
else if (bhead->code == BLO_CODE_DATA) {
|
||||
if (looking) {
|
||||
if (bhead->SDNAnr == DNA_struct_find_nr(fd->filesdna, "PreviewImage")) {
|
||||
if (bhead->SDNAnr == DNA_struct_find(fd->filesdna, "PreviewImage")) {
|
||||
prv = static_cast<PreviewImage *>(BLO_library_read_struct(fd, bhead, "PreviewImage"));
|
||||
|
||||
if (prv) {
|
||||
|
||||
@@ -995,9 +995,10 @@ static bool read_file_dna(FileData *fd, const char **r_error_message)
|
||||
fd->reconstruct_info = DNA_reconstruct_info_create(
|
||||
fd->filesdna, fd->memsdna, fd->compflags);
|
||||
/* used to retrieve ID names from (bhead+1) */
|
||||
fd->id_name_offset = DNA_elem_offset(fd->filesdna, "ID", "char", "name[]");
|
||||
fd->id_name_offset = DNA_struct_member_offset_by_name(
|
||||
fd->filesdna, "ID", "char", "name[]");
|
||||
BLI_assert(fd->id_name_offset != -1);
|
||||
fd->id_asset_data_offset = DNA_elem_offset(
|
||||
fd->id_asset_data_offset = DNA_struct_member_offset_by_name(
|
||||
fd->filesdna, "ID", "AssetMetaData", "*asset_data");
|
||||
|
||||
return true;
|
||||
|
||||
@@ -2410,7 +2410,7 @@ void blo_do_versions_260(FileData *fd, Library * /*lib*/, Main *bmain)
|
||||
}
|
||||
|
||||
if (bmain->versionfile < 267) {
|
||||
// if (!DNA_struct_elem_find(fd->filesdna, "Brush", "int", "stencil_pos")) {
|
||||
// if (!DNA_struct_member_exists(fd->filesdna, "Brush", "int", "stencil_pos")) {
|
||||
LISTBASE_FOREACH (Brush *, brush, &bmain->brushes) {
|
||||
if (brush->stencil_dimension[0] == 0) {
|
||||
brush->stencil_dimension[0] = 256;
|
||||
@@ -2428,10 +2428,10 @@ void blo_do_versions_260(FileData *fd, Library * /*lib*/, Main *bmain)
|
||||
|
||||
/**
|
||||
* TIP: to initialize new variables added, use the new function:
|
||||
* `DNA_struct_elem_find(fd->filesdna, "structname", "typename", "varname")`, example:
|
||||
* `DNA_struct_member_exists(fd->filesdna, "structname", "typename", "varname")`, example:
|
||||
*
|
||||
* \code{.cc}
|
||||
* if (!DNA_struct_elem_find(fd->filesdna, "UserDef", "short", "image_gpubuffer_limit")) {
|
||||
* if (!DNA_struct_member_exists(fd->filesdna, "UserDef", "short", "image_gpubuffer_limit")) {
|
||||
* user->image_gpubuffer_limit = 10;
|
||||
* }
|
||||
* \endcode
|
||||
@@ -2717,7 +2717,7 @@ void blo_do_versions_260(FileData *fd, Library * /*lib*/, Main *bmain)
|
||||
}
|
||||
}
|
||||
|
||||
if (!DNA_struct_elem_find(fd->filesdna, "MovieTrackingTrack", "float", "weight")) {
|
||||
if (!DNA_struct_member_exists(fd->filesdna, "MovieTrackingTrack", "float", "weight")) {
|
||||
LISTBASE_FOREACH (MovieClip *, clip, &bmain->movieclips) {
|
||||
const MovieTracking *tracking = &clip->tracking;
|
||||
LISTBASE_FOREACH (MovieTrackingObject *, tracking_object, &tracking->objects) {
|
||||
@@ -2731,7 +2731,7 @@ void blo_do_versions_260(FileData *fd, Library * /*lib*/, Main *bmain)
|
||||
}
|
||||
}
|
||||
|
||||
if (!DNA_struct_elem_find(fd->filesdna, "TriangulateModifierData", "int", "quad_method")) {
|
||||
if (!DNA_struct_member_exists(fd->filesdna, "TriangulateModifierData", "int", "quad_method")) {
|
||||
LISTBASE_FOREACH (Object *, ob, &bmain->objects) {
|
||||
LISTBASE_FOREACH (ModifierData *, md, &ob->modifiers) {
|
||||
if (md->type == eModifierType_Triangulate) {
|
||||
@@ -2817,7 +2817,8 @@ void blo_do_versions_260(FileData *fd, Library * /*lib*/, Main *bmain)
|
||||
FOREACH_NODETREE_END;
|
||||
}
|
||||
|
||||
if (!DNA_struct_elem_find(fd->filesdna, "MovieTrackingPlaneTrack", "float", "image_opacity")) {
|
||||
if (!DNA_struct_member_exists(
|
||||
fd->filesdna, "MovieTrackingPlaneTrack", "float", "image_opacity")) {
|
||||
LISTBASE_FOREACH (MovieClip *, clip, &bmain->movieclips) {
|
||||
LISTBASE_FOREACH (
|
||||
MovieTrackingPlaneTrack *, plane_track, &clip->tracking.plane_tracks_legacy) {
|
||||
|
||||
@@ -462,7 +462,7 @@ void blo_do_versions_270(FileData *fd, Library * /*lib*/, Main *bmain)
|
||||
{
|
||||
if (!MAIN_VERSION_FILE_ATLEAST(bmain, 270, 0)) {
|
||||
|
||||
if (!DNA_struct_elem_find(fd->filesdna, "BevelModifierData", "float", "profile")) {
|
||||
if (!DNA_struct_member_exists(fd->filesdna, "BevelModifierData", "float", "profile")) {
|
||||
LISTBASE_FOREACH (Object *, ob, &bmain->objects) {
|
||||
LISTBASE_FOREACH (ModifierData *, md, &ob->modifiers) {
|
||||
if (md->type == eModifierType_Bevel) {
|
||||
@@ -499,7 +499,8 @@ void blo_do_versions_270(FileData *fd, Library * /*lib*/, Main *bmain)
|
||||
}
|
||||
}
|
||||
|
||||
if (!DNA_struct_elem_find(fd->filesdna, "MovieTrackingSettings", "float", "default_weight")) {
|
||||
if (!DNA_struct_member_exists(
|
||||
fd->filesdna, "MovieTrackingSettings", "float", "default_weight")) {
|
||||
LISTBASE_FOREACH (MovieClip *, clip, &bmain->movieclips) {
|
||||
clip->tracking.settings.default_weight = 1.0f;
|
||||
}
|
||||
@@ -567,7 +568,7 @@ void blo_do_versions_270(FileData *fd, Library * /*lib*/, Main *bmain)
|
||||
}
|
||||
|
||||
if (!MAIN_VERSION_FILE_ATLEAST(bmain, 271, 0)) {
|
||||
if (!DNA_struct_elem_find(fd->filesdna, "RenderData", "BakeData", "bake")) {
|
||||
if (!DNA_struct_member_exists(fd->filesdna, "RenderData", "BakeData", "bake")) {
|
||||
LISTBASE_FOREACH (Scene *, sce, &bmain->scenes) {
|
||||
sce->r.bake.flag = R_BAKE_CLEAR;
|
||||
sce->r.bake.width = 512;
|
||||
@@ -587,7 +588,7 @@ void blo_do_versions_270(FileData *fd, Library * /*lib*/, Main *bmain)
|
||||
}
|
||||
}
|
||||
|
||||
if (!DNA_struct_elem_find(fd->filesdna, "FreestyleLineStyle", "float", "texstep")) {
|
||||
if (!DNA_struct_member_exists(fd->filesdna, "FreestyleLineStyle", "float", "texstep")) {
|
||||
LISTBASE_FOREACH (FreestyleLineStyle *, linestyle, &bmain->linestyles) {
|
||||
linestyle->flag |= LS_TEXTURE;
|
||||
linestyle->texstep = 1.0;
|
||||
@@ -603,7 +604,7 @@ void blo_do_versions_270(FileData *fd, Library * /*lib*/, Main *bmain)
|
||||
}
|
||||
|
||||
if (!MAIN_VERSION_FILE_ATLEAST(bmain, 271, 1)) {
|
||||
if (!DNA_struct_elem_find(fd->filesdna, "Material", "float", "line_col[4]")) {
|
||||
if (!DNA_struct_member_exists(fd->filesdna, "Material", "float", "line_col[4]")) {
|
||||
LISTBASE_FOREACH (Material *, mat, &bmain->materials) {
|
||||
mat->line_col[0] = mat->line_col[1] = mat->line_col[2] = 0.0f;
|
||||
mat->line_col[3] = mat->alpha;
|
||||
@@ -616,7 +617,7 @@ void blo_do_versions_270(FileData *fd, Library * /*lib*/, Main *bmain)
|
||||
br->fill_threshold = 0.2f;
|
||||
}
|
||||
|
||||
if (!DNA_struct_elem_find(fd->filesdna, "BevelModifierData", "int", "mat")) {
|
||||
if (!DNA_struct_member_exists(fd->filesdna, "BevelModifierData", "int", "mat")) {
|
||||
LISTBASE_FOREACH (Object *, ob, &bmain->objects) {
|
||||
LISTBASE_FOREACH (ModifierData *, md, &ob->modifiers) {
|
||||
if (md->type == eModifierType_Bevel) {
|
||||
@@ -652,13 +653,13 @@ void blo_do_versions_270(FileData *fd, Library * /*lib*/, Main *bmain)
|
||||
}
|
||||
|
||||
if (!MAIN_VERSION_FILE_ATLEAST(bmain, 272, 2)) {
|
||||
if (!DNA_struct_elem_find(fd->filesdna, "Image", "float", "gen_color")) {
|
||||
if (!DNA_struct_member_exists(fd->filesdna, "Image", "float", "gen_color")) {
|
||||
LISTBASE_FOREACH (Image *, image, &bmain->images) {
|
||||
image->gen_color[3] = 1.0f;
|
||||
}
|
||||
}
|
||||
|
||||
if (!DNA_struct_elem_find(fd->filesdna, "bStretchToConstraint", "float", "bulge_min")) {
|
||||
if (!DNA_struct_member_exists(fd->filesdna, "bStretchToConstraint", "float", "bulge_min")) {
|
||||
/* Update Transform constraint (again :|). */
|
||||
LISTBASE_FOREACH (Object *, ob, &bmain->objects) {
|
||||
do_version_constraints_stretch_to_limits(&ob->constraints);
|
||||
@@ -696,7 +697,7 @@ void blo_do_versions_270(FileData *fd, Library * /*lib*/, Main *bmain)
|
||||
|
||||
/* Customizable Safe Areas */
|
||||
if (!MAIN_VERSION_FILE_ATLEAST(bmain, 273, 2)) {
|
||||
if (!DNA_struct_elem_find(fd->filesdna, "Scene", "DisplaySafeAreas", "safe_areas")) {
|
||||
if (!DNA_struct_member_exists(fd->filesdna, "Scene", "DisplaySafeAreas", "safe_areas")) {
|
||||
LISTBASE_FOREACH (Scene *, scene, &bmain->scenes) {
|
||||
copy_v2_fl2(scene->safe_areas.title, 3.5f / 100.0f, 3.5f / 100.0f);
|
||||
copy_v2_fl2(scene->safe_areas.action, 10.0f / 100.0f, 5.0f / 100.0f);
|
||||
@@ -718,7 +719,7 @@ void blo_do_versions_270(FileData *fd, Library * /*lib*/, Main *bmain)
|
||||
}
|
||||
|
||||
if (!MAIN_VERSION_FILE_ATLEAST(bmain, 273, 6)) {
|
||||
if (!DNA_struct_elem_find(fd->filesdna, "ClothSimSettings", "float", "bending_damping")) {
|
||||
if (!DNA_struct_member_exists(fd->filesdna, "ClothSimSettings", "float", "bending_damping")) {
|
||||
LISTBASE_FOREACH (Object *, ob, &bmain->objects) {
|
||||
LISTBASE_FOREACH (ModifierData *, md, &ob->modifiers) {
|
||||
if (md->type == eModifierType_Cloth) {
|
||||
@@ -735,19 +736,19 @@ void blo_do_versions_270(FileData *fd, Library * /*lib*/, Main *bmain)
|
||||
}
|
||||
}
|
||||
|
||||
if (!DNA_struct_elem_find(fd->filesdna, "ParticleSettings", "float", "clump_noise_size")) {
|
||||
if (!DNA_struct_member_exists(fd->filesdna, "ParticleSettings", "float", "clump_noise_size")) {
|
||||
LISTBASE_FOREACH (ParticleSettings *, part, &bmain->particles) {
|
||||
part->clump_noise_size = 1.0f;
|
||||
}
|
||||
}
|
||||
|
||||
if (!DNA_struct_elem_find(fd->filesdna, "ParticleSettings", "int", "kink_extra_steps")) {
|
||||
if (!DNA_struct_member_exists(fd->filesdna, "ParticleSettings", "int", "kink_extra_steps")) {
|
||||
LISTBASE_FOREACH (ParticleSettings *, part, &bmain->particles) {
|
||||
part->kink_extra_steps = 4;
|
||||
}
|
||||
}
|
||||
|
||||
if (!DNA_struct_elem_find(fd->filesdna, "MTex", "float", "kinkampfac")) {
|
||||
if (!DNA_struct_member_exists(fd->filesdna, "MTex", "float", "kinkampfac")) {
|
||||
LISTBASE_FOREACH (ParticleSettings *, part, &bmain->particles) {
|
||||
for (int a = 0; a < MAX_MTEX; a++) {
|
||||
MTex *mtex = part->mtex[a];
|
||||
@@ -758,7 +759,7 @@ void blo_do_versions_270(FileData *fd, Library * /*lib*/, Main *bmain)
|
||||
}
|
||||
}
|
||||
|
||||
if (!DNA_struct_elem_find(fd->filesdna, "HookModifierData", "char", "flag")) {
|
||||
if (!DNA_struct_member_exists(fd->filesdna, "HookModifierData", "char", "flag")) {
|
||||
LISTBASE_FOREACH (Object *, ob, &bmain->objects) {
|
||||
LISTBASE_FOREACH (ModifierData *, md, &ob->modifiers) {
|
||||
if (md->type == eModifierType_Hook) {
|
||||
@@ -769,7 +770,7 @@ void blo_do_versions_270(FileData *fd, Library * /*lib*/, Main *bmain)
|
||||
}
|
||||
}
|
||||
|
||||
if (!DNA_struct_elem_find(fd->filesdna, "NodePlaneTrackDeformData", "char", "flag")) {
|
||||
if (!DNA_struct_member_exists(fd->filesdna, "NodePlaneTrackDeformData", "char", "flag")) {
|
||||
FOREACH_NODETREE_BEGIN (bmain, ntree, id) {
|
||||
if (ntree->type == NTREE_COMPOSIT) {
|
||||
LISTBASE_FOREACH (bNode *, node, &ntree->nodes) {
|
||||
@@ -786,7 +787,7 @@ void blo_do_versions_270(FileData *fd, Library * /*lib*/, Main *bmain)
|
||||
FOREACH_NODETREE_END;
|
||||
}
|
||||
|
||||
if (!DNA_struct_elem_find(fd->filesdna, "Camera", "GPUDOFSettings", "gpu_dof")) {
|
||||
if (!DNA_struct_member_exists(fd->filesdna, "Camera", "GPUDOFSettings", "gpu_dof")) {
|
||||
LISTBASE_FOREACH (Camera *, ca, &bmain->cameras) {
|
||||
ca->gpu_dof.fstop = 128.0f;
|
||||
ca->gpu_dof.focal_length = 1.0f;
|
||||
@@ -909,7 +910,7 @@ void blo_do_versions_270(FileData *fd, Library * /*lib*/, Main *bmain)
|
||||
}
|
||||
|
||||
if (!MAIN_VERSION_FILE_ATLEAST(bmain, 274, 6)) {
|
||||
if (!DNA_struct_elem_find(fd->filesdna, "FileSelectParams", "int", "thumbnail_size")) {
|
||||
if (!DNA_struct_member_exists(fd->filesdna, "FileSelectParams", "int", "thumbnail_size")) {
|
||||
LISTBASE_FOREACH (bScreen *, screen, &bmain->screens) {
|
||||
LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) {
|
||||
LISTBASE_FOREACH (SpaceLink *, sl, &area->spacedata) {
|
||||
@@ -925,14 +926,16 @@ void blo_do_versions_270(FileData *fd, Library * /*lib*/, Main *bmain)
|
||||
}
|
||||
}
|
||||
|
||||
if (!DNA_struct_elem_find(fd->filesdna, "RenderData", "short", "simplify_subsurf_render")) {
|
||||
if (!DNA_struct_member_exists(fd->filesdna, "RenderData", "short", "simplify_subsurf_render"))
|
||||
{
|
||||
LISTBASE_FOREACH (Scene *, scene, &bmain->scenes) {
|
||||
scene->r.simplify_subsurf_render = scene->r.simplify_subsurf;
|
||||
scene->r.simplify_particles_render = scene->r.simplify_particles;
|
||||
}
|
||||
}
|
||||
|
||||
if (!DNA_struct_elem_find(fd->filesdna, "DecimateModifierData", "float", "defgrp_factor")) {
|
||||
if (!DNA_struct_member_exists(fd->filesdna, "DecimateModifierData", "float", "defgrp_factor"))
|
||||
{
|
||||
LISTBASE_FOREACH (Object *, ob, &bmain->objects) {
|
||||
LISTBASE_FOREACH (ModifierData *, md, &ob->modifiers) {
|
||||
if (md->type == eModifierType_Decimate) {
|
||||
@@ -953,7 +956,7 @@ void blo_do_versions_270(FileData *fd, Library * /*lib*/, Main *bmain)
|
||||
}
|
||||
|
||||
if (!MAIN_VERSION_FILE_ATLEAST(bmain, 276, 2)) {
|
||||
if (!DNA_struct_elem_find(fd->filesdna, "bPoseChannel", "float", "custom_scale")) {
|
||||
if (!DNA_struct_member_exists(fd->filesdna, "bPoseChannel", "float", "custom_scale")) {
|
||||
LISTBASE_FOREACH (Object *, ob, &bmain->objects) {
|
||||
if (ob->pose) {
|
||||
LISTBASE_FOREACH (bPoseChannel *, pchan, &ob->pose->chanbase) {
|
||||
@@ -996,7 +999,8 @@ void blo_do_versions_270(FileData *fd, Library * /*lib*/, Main *bmain)
|
||||
}
|
||||
|
||||
if (!MAIN_VERSION_FILE_ATLEAST(bmain, 276, 3)) {
|
||||
if (!DNA_struct_elem_find(fd->filesdna, "RenderData", "CurveMapping", "mblur_shutter_curve")) {
|
||||
if (!DNA_struct_member_exists(
|
||||
fd->filesdna, "RenderData", "CurveMapping", "mblur_shutter_curve")) {
|
||||
LISTBASE_FOREACH (Scene *, scene, &bmain->scenes) {
|
||||
CurveMapping *curve_mapping = &scene->r.mblur_shutter_curve;
|
||||
BKE_curvemapping_set_defaults(curve_mapping, 1, 0.0f, 0.0f, 1.0f, 1.0f, HD_AUTO);
|
||||
@@ -1010,7 +1014,7 @@ void blo_do_versions_270(FileData *fd, Library * /*lib*/, Main *bmain)
|
||||
if (!MAIN_VERSION_FILE_ATLEAST(bmain, 276, 4)) {
|
||||
LISTBASE_FOREACH (Scene *, scene, &bmain->scenes) {
|
||||
ToolSettings *ts = scene->toolsettings;
|
||||
if (!DNA_struct_elem_find(fd->filesdna, "ToolSettings", "char", "gpencil_v3d_align")) {
|
||||
if (!DNA_struct_member_exists(fd->filesdna, "ToolSettings", "char", "gpencil_v3d_align")) {
|
||||
ts->gpencil_v3d_align = GP_PROJECT_VIEWSPACE;
|
||||
ts->gpencil_v2d_align = GP_PROJECT_VIEWSPACE;
|
||||
}
|
||||
@@ -1137,12 +1141,12 @@ void blo_do_versions_270(FileData *fd, Library * /*lib*/, Main *bmain)
|
||||
}
|
||||
|
||||
if (!MAIN_VERSION_FILE_ATLEAST(bmain, 277, 2)) {
|
||||
if (!DNA_struct_elem_find(fd->filesdna, "Bone", "float", "scaleIn")) {
|
||||
if (!DNA_struct_member_exists(fd->filesdna, "Bone", "float", "scaleIn")) {
|
||||
LISTBASE_FOREACH (bArmature *, arm, &bmain->armatures) {
|
||||
do_version_bones_super_bbone(&arm->bonebase);
|
||||
}
|
||||
}
|
||||
if (!DNA_struct_elem_find(fd->filesdna, "bPoseChannel", "float", "scaleIn")) {
|
||||
if (!DNA_struct_member_exists(fd->filesdna, "bPoseChannel", "float", "scaleIn")) {
|
||||
LISTBASE_FOREACH (Object *, ob, &bmain->objects) {
|
||||
if (ob->pose) {
|
||||
LISTBASE_FOREACH (bPoseChannel *, pchan, &ob->pose->chanbase) {
|
||||
@@ -1171,7 +1175,7 @@ void blo_do_versions_270(FileData *fd, Library * /*lib*/, Main *bmain)
|
||||
}
|
||||
}
|
||||
|
||||
if (!DNA_struct_elem_find(fd->filesdna, "NormalEditModifierData", "float", "mix_limit")) {
|
||||
if (!DNA_struct_member_exists(fd->filesdna, "NormalEditModifierData", "float", "mix_limit")) {
|
||||
LISTBASE_FOREACH (Object *, ob, &bmain->objects) {
|
||||
LISTBASE_FOREACH (ModifierData *, md, &ob->modifiers) {
|
||||
if (md->type == eModifierType_NormalEdit) {
|
||||
@@ -1182,7 +1186,8 @@ void blo_do_versions_270(FileData *fd, Library * /*lib*/, Main *bmain)
|
||||
}
|
||||
}
|
||||
|
||||
if (!DNA_struct_elem_find(fd->filesdna, "BooleanModifierData", "float", "double_threshold")) {
|
||||
if (!DNA_struct_member_exists(
|
||||
fd->filesdna, "BooleanModifierData", "float", "double_threshold")) {
|
||||
LISTBASE_FOREACH (Object *, ob, &bmain->objects) {
|
||||
LISTBASE_FOREACH (ModifierData *, md, &ob->modifiers) {
|
||||
if (md->type == eModifierType_Boolean) {
|
||||
@@ -1199,7 +1204,7 @@ void blo_do_versions_270(FileData *fd, Library * /*lib*/, Main *bmain)
|
||||
}
|
||||
}
|
||||
|
||||
if (!DNA_struct_elem_find(fd->filesdna, "ClothSimSettings", "float", "time_scale")) {
|
||||
if (!DNA_struct_member_exists(fd->filesdna, "ClothSimSettings", "float", "time_scale")) {
|
||||
LISTBASE_FOREACH (Object *, ob, &bmain->objects) {
|
||||
LISTBASE_FOREACH (ModifierData *, md, &ob->modifiers) {
|
||||
if (md->type == eModifierType_Cloth) {
|
||||
@@ -1219,7 +1224,7 @@ void blo_do_versions_270(FileData *fd, Library * /*lib*/, Main *bmain)
|
||||
|
||||
if (!MAIN_VERSION_FILE_ATLEAST(bmain, 277, 3)) {
|
||||
/* ------- init of grease pencil initialization --------------- */
|
||||
if (!DNA_struct_elem_find(fd->filesdna, "bGPDstroke", "bGPDpalettecolor", "*palcolor")) {
|
||||
if (!DNA_struct_member_exists(fd->filesdna, "bGPDstroke", "bGPDpalettecolor", "*palcolor")) {
|
||||
/* Convert Grease Pencil to new palettes/brushes
|
||||
* Loop all strokes and create the palette and all colors
|
||||
*/
|
||||
@@ -1276,7 +1281,7 @@ void blo_do_versions_270(FileData *fd, Library * /*lib*/, Main *bmain)
|
||||
}
|
||||
|
||||
if (!MAIN_VERSION_FILE_ATLEAST(bmain, 278, 0)) {
|
||||
if (!DNA_struct_elem_find(fd->filesdna, "MovieTrackingTrack", "float", "weight_stab")) {
|
||||
if (!DNA_struct_member_exists(fd->filesdna, "MovieTrackingTrack", "float", "weight_stab")) {
|
||||
LISTBASE_FOREACH (MovieClip *, clip, &bmain->movieclips) {
|
||||
const MovieTracking *tracking = &clip->tracking;
|
||||
LISTBASE_FOREACH (MovieTrackingObject *, tracking_object, &tracking->objects) {
|
||||
@@ -1290,8 +1295,8 @@ void blo_do_versions_270(FileData *fd, Library * /*lib*/, Main *bmain)
|
||||
}
|
||||
}
|
||||
|
||||
if (!DNA_struct_elem_find(fd->filesdna, "MovieTrackingStabilization", "int", "tot_rot_track"))
|
||||
{
|
||||
if (!DNA_struct_member_exists(
|
||||
fd->filesdna, "MovieTrackingStabilization", "int", "tot_rot_track")) {
|
||||
LISTBASE_FOREACH (MovieClip *, clip, &bmain->movieclips) {
|
||||
if (clip->tracking.stabilization.rot_track_legacy) {
|
||||
migrate_single_rot_stabilization_track_settings(&clip->tracking.stabilization);
|
||||
@@ -1311,20 +1316,21 @@ void blo_do_versions_270(FileData *fd, Library * /*lib*/, Main *bmain)
|
||||
}
|
||||
}
|
||||
if (!MAIN_VERSION_FILE_ATLEAST(bmain, 278, 2)) {
|
||||
if (!DNA_struct_elem_find(fd->filesdna, "FFMpegCodecData", "int", "ffmpeg_preset")) {
|
||||
if (!DNA_struct_member_exists(fd->filesdna, "FFMpegCodecData", "int", "ffmpeg_preset")) {
|
||||
LISTBASE_FOREACH (Scene *, scene, &bmain->scenes) {
|
||||
/* "medium" is the preset FFmpeg uses when no presets are given. */
|
||||
scene->r.ffcodecdata.ffmpeg_preset = FFM_PRESET_MEDIUM;
|
||||
}
|
||||
}
|
||||
if (!DNA_struct_elem_find(fd->filesdna, "FFMpegCodecData", "int", "constant_rate_factor")) {
|
||||
if (!DNA_struct_member_exists(fd->filesdna, "FFMpegCodecData", "int", "constant_rate_factor"))
|
||||
{
|
||||
LISTBASE_FOREACH (Scene *, scene, &bmain->scenes) {
|
||||
/* fall back to behavior from before we introduced CRF for old files */
|
||||
scene->r.ffcodecdata.constant_rate_factor = FFM_CRF_NONE;
|
||||
}
|
||||
}
|
||||
|
||||
if (!DNA_struct_elem_find(fd->filesdna, "FluidModifierData", "float", "slice_per_voxel")) {
|
||||
if (!DNA_struct_member_exists(fd->filesdna, "FluidModifierData", "float", "slice_per_voxel")) {
|
||||
LISTBASE_FOREACH (Object *, ob, &bmain->objects) {
|
||||
LISTBASE_FOREACH (ModifierData *, md, &ob->modifiers) {
|
||||
if (md->type == eModifierType_Fluid) {
|
||||
@@ -1353,7 +1359,8 @@ void blo_do_versions_270(FileData *fd, Library * /*lib*/, Main *bmain)
|
||||
}
|
||||
}
|
||||
|
||||
if (!DNA_struct_elem_find(fd->filesdna, "RigidBodyCon", "float", "spring_stiffness_ang_x")) {
|
||||
if (!DNA_struct_member_exists(fd->filesdna, "RigidBodyCon", "float", "spring_stiffness_ang_x"))
|
||||
{
|
||||
LISTBASE_FOREACH (Object *, ob, &bmain->objects) {
|
||||
RigidBodyCon *rbc = ob->rigidbody_constraint;
|
||||
if (rbc) {
|
||||
@@ -1386,7 +1393,7 @@ void blo_do_versions_270(FileData *fd, Library * /*lib*/, Main *bmain)
|
||||
}
|
||||
|
||||
/* Custom motion paths */
|
||||
if (!DNA_struct_elem_find(fd->filesdna, "bMotionPath", "int", "line_thickness")) {
|
||||
if (!DNA_struct_member_exists(fd->filesdna, "bMotionPath", "int", "line_thickness")) {
|
||||
LISTBASE_FOREACH (Object *, ob, &bmain->objects) {
|
||||
if (bMotionPath *mpath = ob->mpath) {
|
||||
mpath->color[0] = 1.0f;
|
||||
@@ -1428,7 +1435,7 @@ void blo_do_versions_270(FileData *fd, Library * /*lib*/, Main *bmain)
|
||||
}
|
||||
|
||||
/* Fix for #50736, Glare comp node using same var for two different things. */
|
||||
if (!DNA_struct_elem_find(fd->filesdna, "NodeGlare", "char", "star_45")) {
|
||||
if (!DNA_struct_member_exists(fd->filesdna, "NodeGlare", "char", "star_45")) {
|
||||
FOREACH_NODETREE_BEGIN (bmain, ntree, id) {
|
||||
if (ntree->type == NTREE_COMPOSIT) {
|
||||
ntreeSetTypes(nullptr, ntree);
|
||||
@@ -1452,7 +1459,8 @@ void blo_do_versions_270(FileData *fd, Library * /*lib*/, Main *bmain)
|
||||
FOREACH_NODETREE_END;
|
||||
}
|
||||
|
||||
if (!DNA_struct_elem_find(fd->filesdna, "SurfaceDeformModifierData", "float", "mat[4][4]")) {
|
||||
if (!DNA_struct_member_exists(fd->filesdna, "SurfaceDeformModifierData", "float", "mat[4][4]"))
|
||||
{
|
||||
LISTBASE_FOREACH (Object *, ob, &bmain->objects) {
|
||||
LISTBASE_FOREACH (ModifierData *, md, &ob->modifiers) {
|
||||
if (md->type == eModifierType_SurfaceDeform) {
|
||||
@@ -1485,7 +1493,7 @@ void blo_do_versions_270(FileData *fd, Library * /*lib*/, Main *bmain)
|
||||
}
|
||||
|
||||
if (!MAIN_VERSION_FILE_ATLEAST(bmain, 279, 3)) {
|
||||
if (!DNA_struct_elem_find(fd->filesdna, "FluidDomainSettings", "float", "clipping")) {
|
||||
if (!DNA_struct_member_exists(fd->filesdna, "FluidDomainSettings", "float", "clipping")) {
|
||||
LISTBASE_FOREACH (Object *, ob, &bmain->objects) {
|
||||
LISTBASE_FOREACH (ModifierData *, md, &ob->modifiers) {
|
||||
if (md->type == eModifierType_Fluid) {
|
||||
@@ -1509,7 +1517,7 @@ void blo_do_versions_270(FileData *fd, Library * /*lib*/, Main *bmain)
|
||||
}
|
||||
}
|
||||
|
||||
if (!DNA_struct_elem_find(fd->filesdna, "Brush", "float", "falloff_angle")) {
|
||||
if (!DNA_struct_member_exists(fd->filesdna, "Brush", "float", "falloff_angle")) {
|
||||
LISTBASE_FOREACH (Brush *, br, &bmain->brushes) {
|
||||
br->falloff_angle = DEG2RADF(80);
|
||||
/* These flags are used for new features. They are not related to `falloff_angle`. */
|
||||
@@ -1531,7 +1539,8 @@ void blo_do_versions_270(FileData *fd, Library * /*lib*/, Main *bmain)
|
||||
|
||||
/* Simple deform modifier no longer assumes Z axis (X for bend type).
|
||||
* Must set previous defaults. */
|
||||
if (!DNA_struct_elem_find(fd->filesdna, "SimpleDeformModifierData", "char", "deform_axis")) {
|
||||
if (!DNA_struct_member_exists(fd->filesdna, "SimpleDeformModifierData", "char", "deform_axis"))
|
||||
{
|
||||
LISTBASE_FOREACH (Object *, ob, &bmain->objects) {
|
||||
LISTBASE_FOREACH (ModifierData *, md, &ob->modifiers) {
|
||||
if (md->type == eModifierType_SimpleDeform) {
|
||||
@@ -1559,7 +1568,7 @@ void blo_do_versions_270(FileData *fd, Library * /*lib*/, Main *bmain)
|
||||
scene->r.ffcodecdata.ffmpeg_preset = preset;
|
||||
}
|
||||
|
||||
if (!DNA_struct_elem_find(
|
||||
if (!DNA_struct_member_exists(
|
||||
fd->filesdna, "ParticleInstanceModifierData", "float", "particle_amount"))
|
||||
{
|
||||
LISTBASE_FOREACH (Object *, ob, &bmain->objects) {
|
||||
@@ -1594,7 +1603,7 @@ void do_versions_after_linking_270(Main *bmain)
|
||||
|
||||
if (!MAIN_VERSION_FILE_ATLEAST(bmain, 279, 2)) {
|
||||
/* B-Bones (bbone_in/out -> bbone_easein/out) + Stepped FMod Frame Start/End fix */
|
||||
/* if (!DNA_struct_elem_find(fd->filesdna, "Bone", "float", "bbone_easein")) */
|
||||
/* if (!DNA_struct_member_exists(fd->filesdna, "Bone", "float", "bbone_easein")) */
|
||||
BKE_fcurves_main_cb(bmain, do_version_bbone_easing_fcurve_fix, nullptr);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3002,14 +3002,14 @@ void blo_do_versions_280(FileData *fd, Library * /*lib*/, Main *bmain)
|
||||
}
|
||||
|
||||
if (!MAIN_VERSION_FILE_ATLEAST(bmain, 280, 1)) {
|
||||
if (!DNA_struct_elem_find(fd->filesdna, "GPUDOFSettings", "float", "ratio")) {
|
||||
if (!DNA_struct_member_exists(fd->filesdna, "GPUDOFSettings", "float", "ratio")) {
|
||||
LISTBASE_FOREACH (Camera *, ca, &bmain->cameras) {
|
||||
ca->gpu_dof.ratio = 1.0f;
|
||||
}
|
||||
}
|
||||
|
||||
/* MTexPoly now removed. */
|
||||
if (DNA_struct_find(fd->filesdna, "MTexPoly")) {
|
||||
if (DNA_struct_exists(fd->filesdna, "MTexPoly")) {
|
||||
LISTBASE_FOREACH (Mesh *, me, &bmain->meshes) {
|
||||
/* If we have UVs, so this file will have MTexPoly layers too! */
|
||||
if (CustomData_has_layer(&me->loop_data, CD_MLOOPUV) ||
|
||||
@@ -3023,7 +3023,7 @@ void blo_do_versions_280(FileData *fd, Library * /*lib*/, Main *bmain)
|
||||
}
|
||||
|
||||
if (!MAIN_VERSION_FILE_ATLEAST(bmain, 280, 2)) {
|
||||
if (!DNA_struct_elem_find(fd->filesdna, "Lamp", "float", "cascade_max_dist")) {
|
||||
if (!DNA_struct_member_exists(fd->filesdna, "Lamp", "float", "cascade_max_dist")) {
|
||||
LISTBASE_FOREACH (Light *, la, &bmain->lights) {
|
||||
la->cascade_max_dist = 1000.0f;
|
||||
la->cascade_count = 4;
|
||||
@@ -3032,7 +3032,7 @@ void blo_do_versions_280(FileData *fd, Library * /*lib*/, Main *bmain)
|
||||
}
|
||||
}
|
||||
|
||||
if (!DNA_struct_elem_find(fd->filesdna, "Lamp", "float", "contact_dist")) {
|
||||
if (!DNA_struct_member_exists(fd->filesdna, "Lamp", "float", "contact_dist")) {
|
||||
LISTBASE_FOREACH (Light *, la, &bmain->lights) {
|
||||
la->contact_dist = 0.2f;
|
||||
la->contact_bias = 0.03f;
|
||||
@@ -3040,7 +3040,7 @@ void blo_do_versions_280(FileData *fd, Library * /*lib*/, Main *bmain)
|
||||
}
|
||||
}
|
||||
|
||||
if (!DNA_struct_elem_find(fd->filesdna, "LightProbe", "float", "vis_bias")) {
|
||||
if (!DNA_struct_member_exists(fd->filesdna, "LightProbe", "float", "vis_bias")) {
|
||||
LISTBASE_FOREACH (LightProbe *, probe, &bmain->lightprobes) {
|
||||
probe->vis_bias = 1.0f;
|
||||
probe->vis_blur = 0.2f;
|
||||
@@ -3115,22 +3115,22 @@ void blo_do_versions_280(FileData *fd, Library * /*lib*/, Main *bmain)
|
||||
|
||||
{
|
||||
/* Init grease pencil edit line color */
|
||||
if (!DNA_struct_elem_find(fd->filesdna, "bGPdata", "float", "line_color[4]")) {
|
||||
if (!DNA_struct_member_exists(fd->filesdna, "bGPdata", "float", "line_color[4]")) {
|
||||
LISTBASE_FOREACH (bGPdata *, gpd, &bmain->gpencils) {
|
||||
ARRAY_SET_ITEMS(gpd->line_color, 0.6f, 0.6f, 0.6f, 0.5f);
|
||||
}
|
||||
}
|
||||
|
||||
/* Init grease pencil pixel size factor */
|
||||
if (!DNA_struct_elem_find(fd->filesdna, "bGPdata", "float", "pixfactor")) {
|
||||
if (!DNA_struct_member_exists(fd->filesdna, "bGPdata", "float", "pixfactor")) {
|
||||
LISTBASE_FOREACH (bGPdata *, gpd, &bmain->gpencils) {
|
||||
gpd->pixfactor = GP_DEFAULT_PIX_FACTOR;
|
||||
}
|
||||
}
|
||||
|
||||
/* Grease pencil multi-frame falloff curve. */
|
||||
if (!DNA_struct_elem_find(fd->filesdna, "GP_Sculpt_Settings", "CurveMapping", "cur_falloff"))
|
||||
{
|
||||
if (!DNA_struct_member_exists(
|
||||
fd->filesdna, "GP_Sculpt_Settings", "CurveMapping", "cur_falloff")) {
|
||||
LISTBASE_FOREACH (Scene *, scene, &bmain->scenes) {
|
||||
/* sculpt brushes */
|
||||
GP_Sculpt_Settings *gset = &scene->toolsettings->gp_sculpt;
|
||||
@@ -3169,7 +3169,8 @@ void blo_do_versions_280(FileData *fd, Library * /*lib*/, Main *bmain)
|
||||
|
||||
if (!MAIN_VERSION_FILE_ATLEAST(bmain, 280, 3)) {
|
||||
/* init grease pencil grids and paper */
|
||||
if (!DNA_struct_elem_find(fd->filesdna, "View3DOverlay", "float", "gpencil_paper_color[3]")) {
|
||||
if (!DNA_struct_member_exists(
|
||||
fd->filesdna, "View3DOverlay", "float", "gpencil_paper_color[3]")) {
|
||||
LISTBASE_FOREACH (bScreen *, screen, &bmain->screens) {
|
||||
LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) {
|
||||
LISTBASE_FOREACH (SpaceLink *, sl, &area->spacedata) {
|
||||
@@ -3185,7 +3186,7 @@ void blo_do_versions_280(FileData *fd, Library * /*lib*/, Main *bmain)
|
||||
}
|
||||
|
||||
if (!MAIN_VERSION_FILE_ATLEAST(bmain, 280, 6)) {
|
||||
if (DNA_struct_elem_find(fd->filesdna, "SpaceOutliner", "int", "filter") == false) {
|
||||
if (DNA_struct_member_exists(fd->filesdna, "SpaceOutliner", "int", "filter") == false) {
|
||||
/* Update files using invalid (outdated) outlinevis Outliner values. */
|
||||
LISTBASE_FOREACH (bScreen *, screen, &bmain->screens) {
|
||||
LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) {
|
||||
@@ -3208,7 +3209,7 @@ void blo_do_versions_280(FileData *fd, Library * /*lib*/, Main *bmain)
|
||||
}
|
||||
}
|
||||
|
||||
if (!DNA_struct_elem_find(fd->filesdna, "LightProbe", "float", "intensity")) {
|
||||
if (!DNA_struct_member_exists(fd->filesdna, "LightProbe", "float", "intensity")) {
|
||||
LISTBASE_FOREACH (LightProbe *, probe, &bmain->lightprobes) {
|
||||
probe->intensity = 1.0f;
|
||||
}
|
||||
@@ -3347,7 +3348,7 @@ void blo_do_versions_280(FileData *fd, Library * /*lib*/, Main *bmain)
|
||||
|
||||
if (!MAIN_VERSION_FILE_ATLEAST(bmain, 280, 13)) {
|
||||
/* Initialize specular factor. */
|
||||
if (!DNA_struct_elem_find(fd->filesdna, "Lamp", "float", "spec_fac")) {
|
||||
if (!DNA_struct_member_exists(fd->filesdna, "Lamp", "float", "spec_fac")) {
|
||||
LISTBASE_FOREACH (Light *, la, &bmain->lights) {
|
||||
la->spec_fac = 1.0f;
|
||||
}
|
||||
@@ -3374,26 +3375,26 @@ void blo_do_versions_280(FileData *fd, Library * /*lib*/, Main *bmain)
|
||||
}
|
||||
|
||||
if (!MAIN_VERSION_FILE_ATLEAST(bmain, 280, 14)) {
|
||||
if (!DNA_struct_elem_find(fd->filesdna, "Scene", "SceneDisplay", "display")) {
|
||||
if (!DNA_struct_member_exists(fd->filesdna, "Scene", "SceneDisplay", "display")) {
|
||||
/* Initialize new scene.SceneDisplay */
|
||||
LISTBASE_FOREACH (Scene *, scene, &bmain->scenes) {
|
||||
const float vector[3]{-M_SQRT1_3, -M_SQRT1_3, M_SQRT1_3};
|
||||
copy_v3_v3(scene->display.light_direction, vector);
|
||||
}
|
||||
}
|
||||
if (!DNA_struct_elem_find(fd->filesdna, "SceneDisplay", "float", "shadow_shift")) {
|
||||
if (!DNA_struct_member_exists(fd->filesdna, "SceneDisplay", "float", "shadow_shift")) {
|
||||
LISTBASE_FOREACH (Scene *, scene, &bmain->scenes) {
|
||||
scene->display.shadow_shift = 0.1;
|
||||
}
|
||||
}
|
||||
|
||||
if (!DNA_struct_elem_find(fd->filesdna, "ToolSettings", "char", "transform_pivot_point")) {
|
||||
if (!DNA_struct_member_exists(fd->filesdna, "ToolSettings", "char", "transform_pivot_point")) {
|
||||
LISTBASE_FOREACH (Scene *, scene, &bmain->scenes) {
|
||||
scene->toolsettings->transform_pivot_point = V3D_AROUND_CENTER_MEDIAN;
|
||||
}
|
||||
}
|
||||
|
||||
if (!DNA_struct_find(fd->filesdna, "SceneEEVEE")) {
|
||||
if (!DNA_struct_exists(fd->filesdna, "SceneEEVEE")) {
|
||||
LISTBASE_FOREACH (Scene *, scene, &bmain->scenes) {
|
||||
/* First set the default for all the properties. */
|
||||
|
||||
@@ -3663,7 +3664,7 @@ void blo_do_versions_280(FileData *fd, Library * /*lib*/, Main *bmain)
|
||||
}
|
||||
|
||||
if (!MAIN_VERSION_FILE_ATLEAST(bmain, 280, 18)) {
|
||||
if (!DNA_struct_elem_find(fd->filesdna, "Material", "float", "roughness")) {
|
||||
if (!DNA_struct_member_exists(fd->filesdna, "Material", "float", "roughness")) {
|
||||
LISTBASE_FOREACH (Material *, mat, &bmain->materials) {
|
||||
if (mat->use_nodes) {
|
||||
if (MAIN_VERSION_FILE_ATLEAST(bmain, 280, 0)) {
|
||||
@@ -3691,7 +3692,7 @@ void blo_do_versions_280(FileData *fd, Library * /*lib*/, Main *bmain)
|
||||
}
|
||||
}
|
||||
|
||||
if (!DNA_struct_elem_find(fd->filesdna, "View3DShading", "float", "xray_alpha")) {
|
||||
if (!DNA_struct_member_exists(fd->filesdna, "View3DShading", "float", "xray_alpha")) {
|
||||
LISTBASE_FOREACH (bScreen *, screen, &bmain->screens) {
|
||||
LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) {
|
||||
LISTBASE_FOREACH (SpaceLink *, sl, &area->spacedata) {
|
||||
@@ -3703,7 +3704,7 @@ void blo_do_versions_280(FileData *fd, Library * /*lib*/, Main *bmain)
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!DNA_struct_elem_find(fd->filesdna, "View3DShading", "char", "matcap[256]")) {
|
||||
if (!DNA_struct_member_exists(fd->filesdna, "View3DShading", "char", "matcap[256]")) {
|
||||
StudioLight *default_matcap = BKE_studiolight_find_default(STUDIOLIGHT_TYPE_MATCAP);
|
||||
/* when loading the internal file is loaded before the matcaps */
|
||||
if (default_matcap) {
|
||||
@@ -3719,7 +3720,7 @@ void blo_do_versions_280(FileData *fd, Library * /*lib*/, Main *bmain)
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!DNA_struct_elem_find(fd->filesdna, "View3DOverlay", "float", "wireframe_threshold")) {
|
||||
if (!DNA_struct_member_exists(fd->filesdna, "View3DOverlay", "float", "wireframe_threshold")) {
|
||||
LISTBASE_FOREACH (bScreen *, screen, &bmain->screens) {
|
||||
LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) {
|
||||
LISTBASE_FOREACH (SpaceLink *, sl, &area->spacedata) {
|
||||
@@ -3731,7 +3732,8 @@ void blo_do_versions_280(FileData *fd, Library * /*lib*/, Main *bmain)
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!DNA_struct_elem_find(fd->filesdna, "View3DShading", "float", "cavity_valley_factor")) {
|
||||
if (!DNA_struct_member_exists(fd->filesdna, "View3DShading", "float", "cavity_valley_factor"))
|
||||
{
|
||||
LISTBASE_FOREACH (bScreen *, screen, &bmain->screens) {
|
||||
LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) {
|
||||
LISTBASE_FOREACH (SpaceLink *, sl, &area->spacedata) {
|
||||
@@ -3744,7 +3746,7 @@ void blo_do_versions_280(FileData *fd, Library * /*lib*/, Main *bmain)
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!DNA_struct_elem_find(fd->filesdna, "View3DOverlay", "float", "xray_alpha_bone")) {
|
||||
if (!DNA_struct_member_exists(fd->filesdna, "View3DOverlay", "float", "xray_alpha_bone")) {
|
||||
LISTBASE_FOREACH (bScreen *, screen, &bmain->screens) {
|
||||
LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) {
|
||||
LISTBASE_FOREACH (SpaceLink *, sl, &area->spacedata) {
|
||||
@@ -3759,7 +3761,7 @@ void blo_do_versions_280(FileData *fd, Library * /*lib*/, Main *bmain)
|
||||
}
|
||||
|
||||
if (!MAIN_VERSION_FILE_ATLEAST(bmain, 280, 19)) {
|
||||
if (!DNA_struct_elem_find(fd->filesdna, "Image", "ListBase", "renderslot")) {
|
||||
if (!DNA_struct_member_exists(fd->filesdna, "Image", "ListBase", "renderslot")) {
|
||||
LISTBASE_FOREACH (Image *, ima, &bmain->images) {
|
||||
if (ima->type == IMA_TYPE_R_RESULT) {
|
||||
for (int i = 0; i < 8; i++) {
|
||||
@@ -3771,7 +3773,7 @@ void blo_do_versions_280(FileData *fd, Library * /*lib*/, Main *bmain)
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!DNA_struct_elem_find(fd->filesdna, "SpaceAction", "char", "mode_prev")) {
|
||||
if (!DNA_struct_member_exists(fd->filesdna, "SpaceAction", "char", "mode_prev")) {
|
||||
LISTBASE_FOREACH (bScreen *, screen, &bmain->screens) {
|
||||
LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) {
|
||||
LISTBASE_FOREACH (SpaceLink *, sl, &area->spacedata) {
|
||||
@@ -3811,8 +3813,9 @@ void blo_do_versions_280(FileData *fd, Library * /*lib*/, Main *bmain)
|
||||
}
|
||||
}
|
||||
|
||||
if (!DNA_struct_elem_find(
|
||||
fd->filesdna, "View3DOverlay", "float", "texture_paint_mode_opacity")) {
|
||||
if (!DNA_struct_member_exists(
|
||||
fd->filesdna, "View3DOverlay", "float", "texture_paint_mode_opacity"))
|
||||
{
|
||||
LISTBASE_FOREACH (bScreen *, screen, &bmain->screens) {
|
||||
LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) {
|
||||
LISTBASE_FOREACH (SpaceLink *, sl, &area->spacedata) {
|
||||
@@ -3831,7 +3834,7 @@ void blo_do_versions_280(FileData *fd, Library * /*lib*/, Main *bmain)
|
||||
}
|
||||
}
|
||||
|
||||
if (!DNA_struct_elem_find(fd->filesdna, "View3DShading", "char", "background_type")) {
|
||||
if (!DNA_struct_member_exists(fd->filesdna, "View3DShading", "char", "background_type")) {
|
||||
LISTBASE_FOREACH (bScreen *, screen, &bmain->screens) {
|
||||
LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) {
|
||||
LISTBASE_FOREACH (SpaceLink *, sl, &area->spacedata) {
|
||||
@@ -3844,15 +3847,15 @@ void blo_do_versions_280(FileData *fd, Library * /*lib*/, Main *bmain)
|
||||
}
|
||||
}
|
||||
|
||||
if (!DNA_struct_elem_find(fd->filesdna, "SceneEEVEE", "float", "gi_cubemap_draw_size")) {
|
||||
if (!DNA_struct_member_exists(fd->filesdna, "SceneEEVEE", "float", "gi_cubemap_draw_size")) {
|
||||
LISTBASE_FOREACH (Scene *, scene, &bmain->scenes) {
|
||||
scene->eevee.gi_irradiance_draw_size = 0.1f;
|
||||
scene->eevee.gi_cubemap_draw_size = 0.3f;
|
||||
}
|
||||
}
|
||||
|
||||
if (!DNA_struct_elem_find(fd->filesdna, "RigidBodyWorld", "RigidBodyWorld_Shared", "*shared"))
|
||||
{
|
||||
if (!DNA_struct_member_exists(
|
||||
fd->filesdna, "RigidBodyWorld", "RigidBodyWorld_Shared", "*shared")) {
|
||||
LISTBASE_FOREACH (Scene *, scene, &bmain->scenes) {
|
||||
RigidBodyWorld *rbw = scene->rigidbody_world;
|
||||
|
||||
@@ -3878,7 +3881,7 @@ void blo_do_versions_280(FileData *fd, Library * /*lib*/, Main *bmain)
|
||||
}
|
||||
}
|
||||
|
||||
if (!DNA_struct_elem_find(fd->filesdna, "SoftBody", "SoftBody_Shared", "*shared")) {
|
||||
if (!DNA_struct_member_exists(fd->filesdna, "SoftBody", "SoftBody_Shared", "*shared")) {
|
||||
LISTBASE_FOREACH (Object *, ob, &bmain->objects) {
|
||||
SoftBody *sb = ob->soft;
|
||||
if (sb == nullptr) {
|
||||
@@ -3898,7 +3901,7 @@ void blo_do_versions_280(FileData *fd, Library * /*lib*/, Main *bmain)
|
||||
}
|
||||
}
|
||||
|
||||
if (!DNA_struct_elem_find(fd->filesdna, "View3DShading", "short", "type")) {
|
||||
if (!DNA_struct_member_exists(fd->filesdna, "View3DShading", "short", "type")) {
|
||||
LISTBASE_FOREACH (bScreen *, screen, &bmain->screens) {
|
||||
LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) {
|
||||
LISTBASE_FOREACH (SpaceLink *, sl, &area->spacedata) {
|
||||
@@ -3915,13 +3918,13 @@ void blo_do_versions_280(FileData *fd, Library * /*lib*/, Main *bmain)
|
||||
}
|
||||
}
|
||||
|
||||
if (!DNA_struct_elem_find(fd->filesdna, "SceneDisplay", "View3DShading", "shading")) {
|
||||
if (!DNA_struct_member_exists(fd->filesdna, "SceneDisplay", "View3DShading", "shading")) {
|
||||
LISTBASE_FOREACH (Scene *, scene, &bmain->scenes) {
|
||||
BKE_screen_view3d_shading_init(&scene->display.shading);
|
||||
}
|
||||
}
|
||||
/* initialize grease pencil view data */
|
||||
if (!DNA_struct_elem_find(fd->filesdna, "SpaceView3D", "float", "vertex_opacity")) {
|
||||
if (!DNA_struct_member_exists(fd->filesdna, "SpaceView3D", "float", "vertex_opacity")) {
|
||||
LISTBASE_FOREACH (bScreen *, screen, &bmain->screens) {
|
||||
LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) {
|
||||
LISTBASE_FOREACH (SpaceLink *, sl, &area->spacedata) {
|
||||
@@ -3937,13 +3940,13 @@ void blo_do_versions_280(FileData *fd, Library * /*lib*/, Main *bmain)
|
||||
}
|
||||
|
||||
if (!MAIN_VERSION_FILE_ATLEAST(bmain, 280, 22)) {
|
||||
if (!DNA_struct_elem_find(fd->filesdna, "ToolSettings", "char", "annotate_v3d_align")) {
|
||||
if (!DNA_struct_member_exists(fd->filesdna, "ToolSettings", "char", "annotate_v3d_align")) {
|
||||
LISTBASE_FOREACH (Scene *, scene, &bmain->scenes) {
|
||||
scene->toolsettings->annotate_v3d_align = GP_PROJECT_VIEWSPACE | GP_PROJECT_CURSOR;
|
||||
scene->toolsettings->annotate_thickness = 3;
|
||||
}
|
||||
}
|
||||
if (!DNA_struct_elem_find(fd->filesdna, "bGPDlayer", "short", "line_change")) {
|
||||
if (!DNA_struct_member_exists(fd->filesdna, "bGPDlayer", "short", "line_change")) {
|
||||
LISTBASE_FOREACH (bGPdata *, gpd, &bmain->gpencils) {
|
||||
LISTBASE_FOREACH (bGPDlayer *, gpl, &gpd->layers) {
|
||||
gpl->line_change = gpl->thickness;
|
||||
@@ -3953,7 +3956,8 @@ void blo_do_versions_280(FileData *fd, Library * /*lib*/, Main *bmain)
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!DNA_struct_elem_find(fd->filesdna, "View3DOverlay", "float", "gpencil_paper_opacity")) {
|
||||
if (!DNA_struct_member_exists(fd->filesdna, "View3DOverlay", "float", "gpencil_paper_opacity"))
|
||||
{
|
||||
LISTBASE_FOREACH (bScreen *, screen, &bmain->screens) {
|
||||
LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) {
|
||||
LISTBASE_FOREACH (SpaceLink *, sl, &area->spacedata) {
|
||||
@@ -3965,7 +3969,8 @@ void blo_do_versions_280(FileData *fd, Library * /*lib*/, Main *bmain)
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!DNA_struct_elem_find(fd->filesdna, "View3DOverlay", "float", "gpencil_grid_opacity")) {
|
||||
if (!DNA_struct_member_exists(fd->filesdna, "View3DOverlay", "float", "gpencil_grid_opacity"))
|
||||
{
|
||||
LISTBASE_FOREACH (bScreen *, screen, &bmain->screens) {
|
||||
LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) {
|
||||
LISTBASE_FOREACH (SpaceLink *, sl, &area->spacedata) {
|
||||
@@ -3979,7 +3984,7 @@ void blo_do_versions_280(FileData *fd, Library * /*lib*/, Main *bmain)
|
||||
}
|
||||
|
||||
/* default loc axis */
|
||||
if (!DNA_struct_elem_find(fd->filesdna, "GP_Sculpt_Settings", "int", "lock_axis")) {
|
||||
if (!DNA_struct_member_exists(fd->filesdna, "GP_Sculpt_Settings", "int", "lock_axis")) {
|
||||
LISTBASE_FOREACH (Scene *, scene, &bmain->scenes) {
|
||||
/* lock axis */
|
||||
GP_Sculpt_Settings *gset = &scene->toolsettings->gp_sculpt;
|
||||
@@ -3990,7 +3995,7 @@ void blo_do_versions_280(FileData *fd, Library * /*lib*/, Main *bmain)
|
||||
}
|
||||
|
||||
/* Versioning code for Subsurf modifier. */
|
||||
if (!DNA_struct_elem_find(fd->filesdna, "SubsurfModifier", "short", "uv_smooth")) {
|
||||
if (!DNA_struct_member_exists(fd->filesdna, "SubsurfModifier", "short", "uv_smooth")) {
|
||||
LISTBASE_FOREACH (Object *, object, &bmain->objects) {
|
||||
LISTBASE_FOREACH (ModifierData *, md, &object->modifiers) {
|
||||
if (md->type == eModifierType_Subsurf) {
|
||||
@@ -4006,7 +4011,7 @@ void blo_do_versions_280(FileData *fd, Library * /*lib*/, Main *bmain)
|
||||
}
|
||||
}
|
||||
|
||||
if (!DNA_struct_elem_find(fd->filesdna, "SubsurfModifier", "short", "quality")) {
|
||||
if (!DNA_struct_member_exists(fd->filesdna, "SubsurfModifier", "short", "quality")) {
|
||||
LISTBASE_FOREACH (Object *, object, &bmain->objects) {
|
||||
LISTBASE_FOREACH (ModifierData *, md, &object->modifiers) {
|
||||
if (md->type == eModifierType_Subsurf) {
|
||||
@@ -4017,7 +4022,7 @@ void blo_do_versions_280(FileData *fd, Library * /*lib*/, Main *bmain)
|
||||
}
|
||||
}
|
||||
/* Versioning code for Multires modifier. */
|
||||
if (!DNA_struct_elem_find(fd->filesdna, "MultiresModifier", "short", "quality")) {
|
||||
if (!DNA_struct_member_exists(fd->filesdna, "MultiresModifier", "short", "quality")) {
|
||||
LISTBASE_FOREACH (Object *, object, &bmain->objects) {
|
||||
LISTBASE_FOREACH (ModifierData *, md, &object->modifiers) {
|
||||
if (md->type == eModifierType_Multires) {
|
||||
@@ -4034,7 +4039,7 @@ void blo_do_versions_280(FileData *fd, Library * /*lib*/, Main *bmain)
|
||||
}
|
||||
}
|
||||
|
||||
if (!DNA_struct_elem_find(fd->filesdna, "ClothSimSettings", "short", "bending_model")) {
|
||||
if (!DNA_struct_member_exists(fd->filesdna, "ClothSimSettings", "short", "bending_model")) {
|
||||
LISTBASE_FOREACH (Object *, ob, &bmain->objects) {
|
||||
LISTBASE_FOREACH (ModifierData *, md, &ob->modifiers) {
|
||||
ClothModifierData *clmd = nullptr;
|
||||
@@ -4063,7 +4068,8 @@ void blo_do_versions_280(FileData *fd, Library * /*lib*/, Main *bmain)
|
||||
}
|
||||
}
|
||||
|
||||
if (!DNA_struct_elem_find(fd->filesdna, "BrushGpencilSettings", "float", "era_strength_f")) {
|
||||
if (!DNA_struct_member_exists(fd->filesdna, "BrushGpencilSettings", "float", "era_strength_f"))
|
||||
{
|
||||
LISTBASE_FOREACH (Brush *, brush, &bmain->brushes) {
|
||||
if (brush->gpencil_settings != nullptr) {
|
||||
BrushGpencilSettings *gp = brush->gpencil_settings;
|
||||
@@ -4118,7 +4124,7 @@ void blo_do_versions_280(FileData *fd, Library * /*lib*/, Main *bmain)
|
||||
}
|
||||
}
|
||||
|
||||
if (!DNA_struct_elem_find(fd->filesdna, "ShrinkwrapModifierData", "char", "shrinkMode")) {
|
||||
if (!DNA_struct_member_exists(fd->filesdna, "ShrinkwrapModifierData", "char", "shrinkMode")) {
|
||||
LISTBASE_FOREACH (Object *, ob, &bmain->objects) {
|
||||
LISTBASE_FOREACH (ModifierData *, md, &ob->modifiers) {
|
||||
if (md->type == eModifierType_Shrinkwrap) {
|
||||
@@ -4132,7 +4138,7 @@ void blo_do_versions_280(FileData *fd, Library * /*lib*/, Main *bmain)
|
||||
}
|
||||
}
|
||||
|
||||
if (!DNA_struct_elem_find(fd->filesdna, "PartDeflect", "float", "pdef_cfrict")) {
|
||||
if (!DNA_struct_member_exists(fd->filesdna, "PartDeflect", "float", "pdef_cfrict")) {
|
||||
LISTBASE_FOREACH (Object *, ob, &bmain->objects) {
|
||||
if (ob->pd) {
|
||||
ob->pd->pdef_cfrict = 5.0f;
|
||||
@@ -4148,7 +4154,7 @@ void blo_do_versions_280(FileData *fd, Library * /*lib*/, Main *bmain)
|
||||
}
|
||||
}
|
||||
|
||||
if (!DNA_struct_elem_find(fd->filesdna, "View3DShading", "float", "xray_alpha_wire")) {
|
||||
if (!DNA_struct_member_exists(fd->filesdna, "View3DShading", "float", "xray_alpha_wire")) {
|
||||
LISTBASE_FOREACH (bScreen *, screen, &bmain->screens) {
|
||||
LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) {
|
||||
LISTBASE_FOREACH (SpaceLink *, sl, &area->spacedata) {
|
||||
@@ -4258,7 +4264,7 @@ void blo_do_versions_280(FileData *fd, Library * /*lib*/, Main *bmain)
|
||||
}
|
||||
|
||||
/* grease pencil fade layer opacity */
|
||||
if (!DNA_struct_elem_find(fd->filesdna, "View3DOverlay", "float", "gpencil_fade_layer")) {
|
||||
if (!DNA_struct_member_exists(fd->filesdna, "View3DOverlay", "float", "gpencil_fade_layer")) {
|
||||
LISTBASE_FOREACH (bScreen *, screen, &bmain->screens) {
|
||||
LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) {
|
||||
LISTBASE_FOREACH (SpaceLink *, sl, &area->spacedata) {
|
||||
@@ -4284,7 +4290,7 @@ void blo_do_versions_280(FileData *fd, Library * /*lib*/, Main *bmain)
|
||||
|
||||
if (!MAIN_VERSION_FILE_ATLEAST(bmain, 280, 33)) {
|
||||
|
||||
if (!DNA_struct_elem_find(fd->filesdna, "SceneEEVEE", "float", "overscan")) {
|
||||
if (!DNA_struct_member_exists(fd->filesdna, "SceneEEVEE", "float", "overscan")) {
|
||||
LISTBASE_FOREACH (Scene *, scene, &bmain->scenes) {
|
||||
scene->eevee.overscan = 3.0f;
|
||||
}
|
||||
@@ -4297,31 +4303,32 @@ void blo_do_versions_280(FileData *fd, Library * /*lib*/, Main *bmain)
|
||||
}
|
||||
}
|
||||
|
||||
if (!DNA_struct_elem_find(fd->filesdna, "SceneEEVEE", "float", "light_threshold")) {
|
||||
if (!DNA_struct_member_exists(fd->filesdna, "SceneEEVEE", "float", "light_threshold")) {
|
||||
LISTBASE_FOREACH (Scene *, scene, &bmain->scenes) {
|
||||
scene->eevee.light_threshold = 0.01f;
|
||||
}
|
||||
}
|
||||
|
||||
if (!DNA_struct_elem_find(fd->filesdna, "SceneEEVEE", "float", "gi_irradiance_smoothing")) {
|
||||
if (!DNA_struct_member_exists(fd->filesdna, "SceneEEVEE", "float", "gi_irradiance_smoothing"))
|
||||
{
|
||||
LISTBASE_FOREACH (Scene *, scene, &bmain->scenes) {
|
||||
scene->eevee.gi_irradiance_smoothing = 0.1f;
|
||||
}
|
||||
}
|
||||
|
||||
if (!DNA_struct_elem_find(fd->filesdna, "SceneEEVEE", "float", "gi_filter_quality")) {
|
||||
if (!DNA_struct_member_exists(fd->filesdna, "SceneEEVEE", "float", "gi_filter_quality")) {
|
||||
LISTBASE_FOREACH (Scene *, scene, &bmain->scenes) {
|
||||
scene->eevee.gi_filter_quality = 1.0f;
|
||||
}
|
||||
}
|
||||
|
||||
if (!DNA_struct_elem_find(fd->filesdna, "Lamp", "float", "att_dist")) {
|
||||
if (!DNA_struct_member_exists(fd->filesdna, "Lamp", "float", "att_dist")) {
|
||||
LISTBASE_FOREACH (Light *, la, &bmain->lights) {
|
||||
la->att_dist = la->clipend;
|
||||
}
|
||||
}
|
||||
|
||||
if (!DNA_struct_elem_find(fd->filesdna, "Brush", "char", "weightpaint_tool")) {
|
||||
if (!DNA_struct_member_exists(fd->filesdna, "Brush", "char", "weightpaint_tool")) {
|
||||
/* Magic defines from old files (2.7x) */
|
||||
|
||||
#define PAINT_BLEND_MIX 0
|
||||
@@ -4492,7 +4499,8 @@ void blo_do_versions_280(FileData *fd, Library * /*lib*/, Main *bmain)
|
||||
}
|
||||
|
||||
if (!MAIN_VERSION_FILE_ATLEAST(bmain, 280, 36)) {
|
||||
if (!DNA_struct_elem_find(fd->filesdna, "View3DShading", "float", "curvature_ridge_factor")) {
|
||||
if (!DNA_struct_member_exists(
|
||||
fd->filesdna, "View3DShading", "float", "curvature_ridge_factor")) {
|
||||
LISTBASE_FOREACH (bScreen *, screen, &bmain->screens) {
|
||||
LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) {
|
||||
LISTBASE_FOREACH (SpaceLink *, sl, &area->spacedata) {
|
||||
@@ -4514,7 +4522,7 @@ void blo_do_versions_280(FileData *fd, Library * /*lib*/, Main *bmain)
|
||||
}
|
||||
|
||||
/* init Annotations onion skin */
|
||||
if (!DNA_struct_elem_find(fd->filesdna, "bGPDlayer", "int", "gstep")) {
|
||||
if (!DNA_struct_member_exists(fd->filesdna, "bGPDlayer", "int", "gstep")) {
|
||||
LISTBASE_FOREACH (bGPdata *, gpd, &bmain->gpencils) {
|
||||
LISTBASE_FOREACH (bGPDlayer *, gpl, &gpd->layers) {
|
||||
ARRAY_SET_ITEMS(gpl->gcolor_prev, 0.302f, 0.851f, 0.302f);
|
||||
@@ -4524,7 +4532,7 @@ void blo_do_versions_280(FileData *fd, Library * /*lib*/, Main *bmain)
|
||||
}
|
||||
|
||||
/* Move studio_light selection to lookdev_light. */
|
||||
if (!DNA_struct_elem_find(fd->filesdna, "View3DShading", "char", "lookdev_light[256]")) {
|
||||
if (!DNA_struct_member_exists(fd->filesdna, "View3DShading", "char", "lookdev_light[256]")) {
|
||||
LISTBASE_FOREACH (bScreen *, screen, &bmain->screens) {
|
||||
LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) {
|
||||
LISTBASE_FOREACH (SpaceLink *, sl, &area->spacedata) {
|
||||
@@ -4538,7 +4546,7 @@ void blo_do_versions_280(FileData *fd, Library * /*lib*/, Main *bmain)
|
||||
}
|
||||
|
||||
/* Change Solid mode shadow orientation. */
|
||||
if (!DNA_struct_elem_find(fd->filesdna, "SceneDisplay", "float", "shadow_focus")) {
|
||||
if (!DNA_struct_member_exists(fd->filesdna, "SceneDisplay", "float", "shadow_focus")) {
|
||||
LISTBASE_FOREACH (Scene *, scene, &bmain->scenes) {
|
||||
float *dir = scene->display.light_direction;
|
||||
SWAP(float, dir[2], dir[1]);
|
||||
@@ -4554,8 +4562,8 @@ void blo_do_versions_280(FileData *fd, Library * /*lib*/, Main *bmain)
|
||||
}
|
||||
|
||||
/* Grease pencil primitive curve */
|
||||
if (!DNA_struct_elem_find(fd->filesdna, "GP_Sculpt_Settings", "CurveMapping", "cur_primitive"))
|
||||
{
|
||||
if (!DNA_struct_member_exists(
|
||||
fd->filesdna, "GP_Sculpt_Settings", "CurveMapping", "cur_primitive")) {
|
||||
LISTBASE_FOREACH (Scene *, scene, &bmain->scenes) {
|
||||
GP_Sculpt_Settings *gset = &scene->toolsettings->gp_sculpt;
|
||||
if ((gset) && (gset->cur_primitive == nullptr)) {
|
||||
@@ -4571,7 +4579,7 @@ void blo_do_versions_280(FileData *fd, Library * /*lib*/, Main *bmain)
|
||||
}
|
||||
|
||||
if (!MAIN_VERSION_FILE_ATLEAST(bmain, 280, 38)) {
|
||||
if (DNA_struct_elem_find(fd->filesdna, "Object", "char", "empty_image_visibility_flag")) {
|
||||
if (DNA_struct_member_exists(fd->filesdna, "Object", "char", "empty_image_visibility_flag")) {
|
||||
LISTBASE_FOREACH (Object *, ob, &bmain->objects) {
|
||||
ob->empty_image_visibility_flag ^= (OB_EMPTY_IMAGE_HIDE_PERSPECTIVE |
|
||||
OB_EMPTY_IMAGE_HIDE_ORTHOGRAPHIC |
|
||||
@@ -4682,7 +4690,8 @@ void blo_do_versions_280(FileData *fd, Library * /*lib*/, Main *bmain)
|
||||
}
|
||||
|
||||
if (!MAIN_VERSION_FILE_ATLEAST(bmain, 280, 40)) {
|
||||
if (!DNA_struct_elem_find(fd->filesdna, "ToolSettings", "char", "snap_transform_mode_flag")) {
|
||||
if (!DNA_struct_member_exists(
|
||||
fd->filesdna, "ToolSettings", "char", "snap_transform_mode_flag")) {
|
||||
LISTBASE_FOREACH (Scene *, scene, &bmain->scenes) {
|
||||
scene->toolsettings->snap_transform_mode_flag = SCE_SNAP_TRANSFORM_MODE_TRANSLATE;
|
||||
}
|
||||
@@ -4706,7 +4715,7 @@ void blo_do_versions_280(FileData *fd, Library * /*lib*/, Main *bmain)
|
||||
}
|
||||
}
|
||||
|
||||
if (!DNA_struct_find(fd->filesdna, "TransformOrientationSlot")) {
|
||||
if (!DNA_struct_exists(fd->filesdna, "TransformOrientationSlot")) {
|
||||
LISTBASE_FOREACH (Scene *, scene, &bmain->scenes) {
|
||||
for (int i = 0; i < ARRAY_SIZE(scene->orientation_slots); i++) {
|
||||
scene->orientation_slots[i].index_custom = -1;
|
||||
@@ -4715,7 +4724,8 @@ void blo_do_versions_280(FileData *fd, Library * /*lib*/, Main *bmain)
|
||||
}
|
||||
|
||||
/* Grease pencil cutter/select segment intersection threshold. */
|
||||
if (!DNA_struct_elem_find(fd->filesdna, "GP_Sculpt_Settings", "float", "isect_threshold")) {
|
||||
if (!DNA_struct_member_exists(fd->filesdna, "GP_Sculpt_Settings", "float", "isect_threshold"))
|
||||
{
|
||||
LISTBASE_FOREACH (Scene *, scene, &bmain->scenes) {
|
||||
GP_Sculpt_Settings *gset = &scene->toolsettings->gp_sculpt;
|
||||
if (gset) {
|
||||
@@ -4765,7 +4775,7 @@ void blo_do_versions_280(FileData *fd, Library * /*lib*/, Main *bmain)
|
||||
}
|
||||
|
||||
if (!MAIN_VERSION_FILE_ATLEAST(bmain, 280, 44)) {
|
||||
if (!DNA_struct_elem_find(fd->filesdna, "Material", "float", "a")) {
|
||||
if (!DNA_struct_member_exists(fd->filesdna, "Material", "float", "a")) {
|
||||
LISTBASE_FOREACH (Material *, mat, &bmain->materials) {
|
||||
mat->a = 1.0f;
|
||||
}
|
||||
@@ -4790,7 +4800,7 @@ void blo_do_versions_280(FileData *fd, Library * /*lib*/, Main *bmain)
|
||||
|
||||
if (!MAIN_VERSION_FILE_ATLEAST(bmain, 280, 46)) {
|
||||
/* Add wireframe color. */
|
||||
if (!DNA_struct_elem_find(fd->filesdna, "View3DShading", "char", "wire_color_type")) {
|
||||
if (!DNA_struct_member_exists(fd->filesdna, "View3DShading", "char", "wire_color_type")) {
|
||||
LISTBASE_FOREACH (bScreen *, screen, &bmain->screens) {
|
||||
LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) {
|
||||
LISTBASE_FOREACH (SpaceLink *, sl, &area->spacedata) {
|
||||
@@ -4803,7 +4813,7 @@ void blo_do_versions_280(FileData *fd, Library * /*lib*/, Main *bmain)
|
||||
}
|
||||
}
|
||||
|
||||
if (!DNA_struct_elem_find(fd->filesdna, "View3DCursor", "short", "rotation_mode")) {
|
||||
if (!DNA_struct_member_exists(fd->filesdna, "View3DCursor", "short", "rotation_mode")) {
|
||||
LISTBASE_FOREACH (Scene *, scene, &bmain->scenes) {
|
||||
if (is_zero_v3(scene->cursor.rotation_axis)) {
|
||||
scene->cursor.rotation_mode = ROT_MODE_XYZ;
|
||||
@@ -4892,7 +4902,8 @@ void blo_do_versions_280(FileData *fd, Library * /*lib*/, Main *bmain)
|
||||
}
|
||||
}
|
||||
|
||||
if (!DNA_struct_elem_find(fd->filesdna, "TriangulateModifierData", "int", "min_vertices")) {
|
||||
if (!DNA_struct_member_exists(fd->filesdna, "TriangulateModifierData", "int", "min_vertices"))
|
||||
{
|
||||
LISTBASE_FOREACH (Object *, ob, &bmain->objects) {
|
||||
LISTBASE_FOREACH (ModifierData *, md, &ob->modifiers) {
|
||||
if (md->type == eModifierType_Triangulate) {
|
||||
@@ -5025,7 +5036,7 @@ void blo_do_versions_280(FileData *fd, Library * /*lib*/, Main *bmain)
|
||||
}
|
||||
|
||||
/* init grease pencil brush gradients */
|
||||
if (!DNA_struct_elem_find(fd->filesdna, "BrushGpencilSettings", "float", "hardeness")) {
|
||||
if (!DNA_struct_member_exists(fd->filesdna, "BrushGpencilSettings", "float", "hardeness")) {
|
||||
LISTBASE_FOREACH (Brush *, brush, &bmain->brushes) {
|
||||
if (brush->gpencil_settings != nullptr) {
|
||||
BrushGpencilSettings *gp = brush->gpencil_settings;
|
||||
@@ -5036,7 +5047,7 @@ void blo_do_versions_280(FileData *fd, Library * /*lib*/, Main *bmain)
|
||||
}
|
||||
|
||||
/* init grease pencil stroke gradients */
|
||||
if (!DNA_struct_elem_find(fd->filesdna, "bGPDstroke", "float", "hardeness")) {
|
||||
if (!DNA_struct_member_exists(fd->filesdna, "bGPDstroke", "float", "hardeness")) {
|
||||
LISTBASE_FOREACH (bGPdata *, gpd, &bmain->gpencils) {
|
||||
LISTBASE_FOREACH (bGPDlayer *, gpl, &gpd->layers) {
|
||||
LISTBASE_FOREACH (bGPDframe *, gpf, &gpl->frames) {
|
||||
@@ -5094,7 +5105,7 @@ void blo_do_versions_280(FileData *fd, Library * /*lib*/, Main *bmain)
|
||||
}
|
||||
|
||||
if (!MAIN_VERSION_FILE_ATLEAST(bmain, 280, 60)) {
|
||||
if (!DNA_struct_elem_find(fd->filesdna, "bSplineIKConstraint", "short", "yScaleMode")) {
|
||||
if (!DNA_struct_member_exists(fd->filesdna, "bSplineIKConstraint", "short", "yScaleMode")) {
|
||||
LISTBASE_FOREACH (Object *, ob, &bmain->objects) {
|
||||
if (ob->pose) {
|
||||
LISTBASE_FOREACH (bPoseChannel *, pchan, &ob->pose->chanbase) {
|
||||
@@ -5111,8 +5122,8 @@ void blo_do_versions_280(FileData *fd, Library * /*lib*/, Main *bmain)
|
||||
}
|
||||
}
|
||||
|
||||
if (!DNA_struct_elem_find(fd->filesdna, "View3DOverlay", "float", "sculpt_mode_mask_opacity"))
|
||||
{
|
||||
if (!DNA_struct_member_exists(
|
||||
fd->filesdna, "View3DOverlay", "float", "sculpt_mode_mask_opacity")) {
|
||||
LISTBASE_FOREACH (bScreen *, screen, &bmain->screens) {
|
||||
LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) {
|
||||
LISTBASE_FOREACH (SpaceLink *, sl, &area->spacedata) {
|
||||
@@ -5124,7 +5135,7 @@ void blo_do_versions_280(FileData *fd, Library * /*lib*/, Main *bmain)
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!DNA_struct_elem_find(fd->filesdna, "SceneDisplay", "char", "render_aa")) {
|
||||
if (!DNA_struct_member_exists(fd->filesdna, "SceneDisplay", "char", "render_aa")) {
|
||||
LISTBASE_FOREACH (Scene *, scene, &bmain->scenes) {
|
||||
scene->display.render_aa = SCE_DISPLAY_AA_SAMPLES_8;
|
||||
scene->display.viewport_aa = SCE_DISPLAY_AA_FXAA;
|
||||
@@ -5132,7 +5143,7 @@ void blo_do_versions_280(FileData *fd, Library * /*lib*/, Main *bmain)
|
||||
}
|
||||
|
||||
/* Split bbone_scalein/bbone_scaleout into x and y fields. */
|
||||
if (!DNA_struct_elem_find(fd->filesdna, "bPoseChannel", "float", "scale_out_y")) {
|
||||
if (!DNA_struct_member_exists(fd->filesdna, "bPoseChannel", "float", "scale_out_y")) {
|
||||
/* Update armature data and pose channels. */
|
||||
LISTBASE_FOREACH (bArmature *, arm, &bmain->armatures) {
|
||||
do_version_bones_split_bbone_scale(&arm->bonebase);
|
||||
@@ -5166,7 +5177,7 @@ void blo_do_versions_280(FileData *fd, Library * /*lib*/, Main *bmain)
|
||||
|
||||
if (!MAIN_VERSION_FILE_ATLEAST(bmain, 280, 61)) {
|
||||
/* Added a power option to Copy Scale. */
|
||||
if (!DNA_struct_elem_find(fd->filesdna, "bSizeLikeConstraint", "float", "power")) {
|
||||
if (!DNA_struct_member_exists(fd->filesdna, "bSizeLikeConstraint", "float", "power")) {
|
||||
LISTBASE_FOREACH (Object *, ob, &bmain->objects) {
|
||||
do_version_constraints_copy_scale_power(&ob->constraints);
|
||||
if (ob->pose) {
|
||||
@@ -5237,7 +5248,7 @@ void blo_do_versions_280(FileData *fd, Library * /*lib*/, Main *bmain)
|
||||
}
|
||||
|
||||
/* Initializes sun lights with the new angular diameter property */
|
||||
if (!DNA_struct_elem_find(fd->filesdna, "Lamp", "float", "sun_angle")) {
|
||||
if (!DNA_struct_member_exists(fd->filesdna, "Lamp", "float", "sun_angle")) {
|
||||
LISTBASE_FOREACH (Light *, light, &bmain->lights) {
|
||||
light->sun_angle = 2.0f * atanf(light->area_size);
|
||||
}
|
||||
@@ -5465,14 +5476,14 @@ void blo_do_versions_280(FileData *fd, Library * /*lib*/, Main *bmain)
|
||||
}
|
||||
|
||||
/* Convert the BONE_NO_SCALE flag to inherit_scale_mode enum. */
|
||||
if (!DNA_struct_elem_find(fd->filesdna, "Bone", "char", "inherit_scale_mode")) {
|
||||
if (!DNA_struct_member_exists(fd->filesdna, "Bone", "char", "inherit_scale_mode")) {
|
||||
LISTBASE_FOREACH (bArmature *, arm, &bmain->armatures) {
|
||||
do_version_bones_inherit_scale(&arm->bonebase);
|
||||
}
|
||||
}
|
||||
|
||||
/* Convert the Offset flag to the mix mode enum. */
|
||||
if (!DNA_struct_elem_find(fd->filesdna, "bRotateLikeConstraint", "char", "mix_mode")) {
|
||||
if (!DNA_struct_member_exists(fd->filesdna, "bRotateLikeConstraint", "char", "mix_mode")) {
|
||||
LISTBASE_FOREACH (Object *, ob, &bmain->objects) {
|
||||
do_version_constraints_copy_rotation_mix_mode(&ob->constraints);
|
||||
if (ob->pose) {
|
||||
@@ -5484,7 +5495,8 @@ void blo_do_versions_280(FileData *fd, Library * /*lib*/, Main *bmain)
|
||||
}
|
||||
|
||||
/* Added studio-light intensity. */
|
||||
if (!DNA_struct_elem_find(fd->filesdna, "View3DShading", "float", "studiolight_intensity")) {
|
||||
if (!DNA_struct_member_exists(fd->filesdna, "View3DShading", "float", "studiolight_intensity"))
|
||||
{
|
||||
LISTBASE_FOREACH (bScreen *, screen, &bmain->screens) {
|
||||
LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) {
|
||||
LISTBASE_FOREACH (SpaceLink *, sl, &area->spacedata) {
|
||||
@@ -5531,8 +5543,8 @@ void blo_do_versions_280(FileData *fd, Library * /*lib*/, Main *bmain)
|
||||
}
|
||||
}
|
||||
|
||||
if (!DNA_struct_elem_find(fd->filesdna, "LayerCollection", "short", "local_collections_bits"))
|
||||
{
|
||||
if (!DNA_struct_member_exists(
|
||||
fd->filesdna, "LayerCollection", "short", "local_collections_bits")) {
|
||||
LISTBASE_FOREACH (Scene *, scene, &bmain->scenes) {
|
||||
LISTBASE_FOREACH (ViewLayer *, view_layer, &scene->view_layers) {
|
||||
LISTBASE_FOREACH (LayerCollection *, layer_collection, &view_layer->layer_collections) {
|
||||
@@ -5605,7 +5617,8 @@ void blo_do_versions_280(FileData *fd, Library * /*lib*/, Main *bmain)
|
||||
}
|
||||
|
||||
/* Add custom curve profile to toolsettings for bevel tool */
|
||||
if (!DNA_struct_elem_find(fd->filesdna, "ToolSettings", "CurveProfile", "custom_profile")) {
|
||||
if (!DNA_struct_member_exists(fd->filesdna, "ToolSettings", "CurveProfile", "custom_profile"))
|
||||
{
|
||||
LISTBASE_FOREACH (Scene *, scene, &bmain->scenes) {
|
||||
ToolSettings *ts = scene->toolsettings;
|
||||
if ((ts) && (ts->custom_bevel_profile_preset == nullptr)) {
|
||||
@@ -5615,7 +5628,8 @@ void blo_do_versions_280(FileData *fd, Library * /*lib*/, Main *bmain)
|
||||
}
|
||||
|
||||
/* Add custom curve profile to bevel modifier */
|
||||
if (!DNA_struct_elem_find(fd->filesdna, "BevelModifier", "CurveProfile", "custom_profile")) {
|
||||
if (!DNA_struct_member_exists(fd->filesdna, "BevelModifier", "CurveProfile", "custom_profile"))
|
||||
{
|
||||
LISTBASE_FOREACH (Object *, ob, &bmain->objects) {
|
||||
LISTBASE_FOREACH (ModifierData *, md, &ob->modifiers) {
|
||||
if (md->type == eModifierType_Bevel) {
|
||||
@@ -5629,7 +5643,7 @@ void blo_do_versions_280(FileData *fd, Library * /*lib*/, Main *bmain)
|
||||
}
|
||||
|
||||
/* Dash Ratio and Dash Samples */
|
||||
if (!DNA_struct_elem_find(fd->filesdna, "Brush", "float", "dash_ratio")) {
|
||||
if (!DNA_struct_member_exists(fd->filesdna, "Brush", "float", "dash_ratio")) {
|
||||
LISTBASE_FOREACH (Brush *, br, &bmain->brushes) {
|
||||
br->dash_ratio = 1.0f;
|
||||
br->dash_samples = 20;
|
||||
@@ -5637,7 +5651,7 @@ void blo_do_versions_280(FileData *fd, Library * /*lib*/, Main *bmain)
|
||||
}
|
||||
|
||||
/* Pose brush smooth iterations */
|
||||
if (!DNA_struct_elem_find(fd->filesdna, "Brush", "float", "pose_smooth_iterations")) {
|
||||
if (!DNA_struct_member_exists(fd->filesdna, "Brush", "float", "pose_smooth_iterations")) {
|
||||
LISTBASE_FOREACH (Brush *, br, &bmain->brushes) {
|
||||
br->pose_smooth_iterations = 4;
|
||||
}
|
||||
@@ -5664,7 +5678,7 @@ void blo_do_versions_280(FileData *fd, Library * /*lib*/, Main *bmain)
|
||||
}
|
||||
|
||||
/* Set the default render pass in the viewport to Combined. */
|
||||
if (!DNA_struct_elem_find(fd->filesdna, "View3DShading", "int", "render_pass")) {
|
||||
if (!DNA_struct_member_exists(fd->filesdna, "View3DShading", "int", "render_pass")) {
|
||||
LISTBASE_FOREACH (Scene *, scene, &bmain->scenes) {
|
||||
scene->display.shading.render_pass = SCE_PASS_COMBINED;
|
||||
}
|
||||
@@ -5746,7 +5760,7 @@ void blo_do_versions_280(FileData *fd, Library * /*lib*/, Main *bmain)
|
||||
}
|
||||
|
||||
/* Add primary tile to images. */
|
||||
if (!DNA_struct_elem_find(fd->filesdna, "Image", "ListBase", "tiles")) {
|
||||
if (!DNA_struct_member_exists(fd->filesdna, "Image", "ListBase", "tiles")) {
|
||||
LISTBASE_FOREACH (Image *, ima, &bmain->images) {
|
||||
ImageTile *tile = static_cast<ImageTile *>(MEM_callocN(sizeof(ImageTile), "Image Tile"));
|
||||
tile->tile_number = 1001;
|
||||
@@ -5755,7 +5769,7 @@ void blo_do_versions_280(FileData *fd, Library * /*lib*/, Main *bmain)
|
||||
}
|
||||
|
||||
/* UDIM Image Editor change. */
|
||||
if (!DNA_struct_elem_find(fd->filesdna, "SpaceImage", "int", "tile_grid_shape[2]")) {
|
||||
if (!DNA_struct_member_exists(fd->filesdna, "SpaceImage", "int", "tile_grid_shape[2]")) {
|
||||
LISTBASE_FOREACH (bScreen *, screen, &bmain->screens) {
|
||||
LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) {
|
||||
LISTBASE_FOREACH (SpaceLink *, sl, &area->spacedata) {
|
||||
@@ -5789,7 +5803,7 @@ void blo_do_versions_280(FileData *fd, Library * /*lib*/, Main *bmain)
|
||||
}
|
||||
|
||||
/* Tip Roundness. */
|
||||
if (!DNA_struct_elem_find(fd->filesdna, "Brush", "float", "tip_roundness")) {
|
||||
if (!DNA_struct_member_exists(fd->filesdna, "Brush", "float", "tip_roundness")) {
|
||||
LISTBASE_FOREACH (Brush *, br, &bmain->brushes) {
|
||||
if (br->ob_mode & OB_MODE_SCULPT && br->sculpt_tool == SCULPT_TOOL_CLAY_STRIPS) {
|
||||
br->tip_roundness = 0.18f;
|
||||
@@ -5818,7 +5832,7 @@ void blo_do_versions_280(FileData *fd, Library * /*lib*/, Main *bmain)
|
||||
}
|
||||
|
||||
/* Add 2D transform to UV Warp modifier. */
|
||||
if (!DNA_struct_elem_find(fd->filesdna, "UVWarpModifierData", "float", "scale[2]")) {
|
||||
if (!DNA_struct_member_exists(fd->filesdna, "UVWarpModifierData", "float", "scale[2]")) {
|
||||
LISTBASE_FOREACH (Object *, ob, &bmain->objects) {
|
||||
LISTBASE_FOREACH (ModifierData *, md, &ob->modifiers) {
|
||||
if (md->type == eModifierType_UVWarp) {
|
||||
@@ -5830,7 +5844,7 @@ void blo_do_versions_280(FileData *fd, Library * /*lib*/, Main *bmain)
|
||||
}
|
||||
|
||||
/* Add Lookdev blur property. */
|
||||
if (!DNA_struct_elem_find(fd->filesdna, "View3DShading", "float", "studiolight_blur")) {
|
||||
if (!DNA_struct_member_exists(fd->filesdna, "View3DShading", "float", "studiolight_blur")) {
|
||||
LISTBASE_FOREACH (bScreen *, screen, &bmain->screens) {
|
||||
LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) {
|
||||
LISTBASE_FOREACH (SpaceLink *, sl, &area->spacedata) {
|
||||
@@ -5846,8 +5860,9 @@ void blo_do_versions_280(FileData *fd, Library * /*lib*/, Main *bmain)
|
||||
|
||||
if (!MAIN_VERSION_FILE_ATLEAST(bmain, 283, 7)) {
|
||||
/* Init default Grease Pencil Vertex paint mix factor for Viewport. */
|
||||
if (!DNA_struct_elem_find(
|
||||
fd->filesdna, "View3DOverlay", "float", "gpencil_vertex_paint_opacity")) {
|
||||
if (!DNA_struct_member_exists(
|
||||
fd->filesdna, "View3DOverlay", "float", "gpencil_vertex_paint_opacity"))
|
||||
{
|
||||
LISTBASE_FOREACH (bScreen *, screen, &bmain->screens) {
|
||||
LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) {
|
||||
LISTBASE_FOREACH (SpaceLink *, sl, &area->spacedata) {
|
||||
@@ -5863,7 +5878,7 @@ void blo_do_versions_280(FileData *fd, Library * /*lib*/, Main *bmain)
|
||||
/* Update Grease Pencil after drawing engine and code refactor.
|
||||
* It uses the seed variable of Array modifier to avoid double patching for
|
||||
* files created with a development version. */
|
||||
if (!DNA_struct_elem_find(fd->filesdna, "ArrayGpencilModifierData", "int", "seed")) {
|
||||
if (!DNA_struct_member_exists(fd->filesdna, "ArrayGpencilModifierData", "int", "seed")) {
|
||||
/* Init new Grease Pencil Paint tools. */
|
||||
{
|
||||
LISTBASE_FOREACH (Brush *, brush, &bmain->brushes) {
|
||||
@@ -6035,7 +6050,7 @@ void blo_do_versions_280(FileData *fd, Library * /*lib*/, Main *bmain)
|
||||
break;
|
||||
}
|
||||
case eGpencilModifierType_Thick: {
|
||||
if (!DNA_struct_elem_find(
|
||||
if (!DNA_struct_member_exists(
|
||||
fd->filesdna, "ThickGpencilModifierData", "float", "thickness_fac")) {
|
||||
ThickGpencilModifierData *mmd = (ThickGpencilModifierData *)md;
|
||||
mmd->thickness_fac = mmd->thickness;
|
||||
@@ -6101,8 +6116,9 @@ void blo_do_versions_280(FileData *fd, Library * /*lib*/, Main *bmain)
|
||||
}
|
||||
|
||||
if (!MAIN_VERSION_FILE_ATLEAST(bmain, 283, 8)) {
|
||||
if (!DNA_struct_elem_find(
|
||||
fd->filesdna, "View3DOverlay", "float", "sculpt_mode_face_sets_opacity")) {
|
||||
if (!DNA_struct_member_exists(
|
||||
fd->filesdna, "View3DOverlay", "float", "sculpt_mode_face_sets_opacity"))
|
||||
{
|
||||
LISTBASE_FOREACH (bScreen *, screen, &bmain->screens) {
|
||||
LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) {
|
||||
LISTBASE_FOREACH (SpaceLink *, sl, &area->spacedata) {
|
||||
@@ -6125,7 +6141,7 @@ void blo_do_versions_280(FileData *fd, Library * /*lib*/, Main *bmain)
|
||||
}
|
||||
|
||||
/* Boundary Edges Auto-masking. */
|
||||
if (!DNA_struct_elem_find(
|
||||
if (!DNA_struct_member_exists(
|
||||
fd->filesdna, "Brush", "int", "automasking_boundary_edges_propagation_steps"))
|
||||
{
|
||||
LISTBASE_FOREACH (Brush *, br, &bmain->brushes) {
|
||||
@@ -6134,7 +6150,8 @@ void blo_do_versions_280(FileData *fd, Library * /*lib*/, Main *bmain)
|
||||
}
|
||||
|
||||
/* Corrective smooth modifier scale. */
|
||||
if (!DNA_struct_elem_find(fd->filesdna, "CorrectiveSmoothModifierData", "float", "scale")) {
|
||||
if (!DNA_struct_member_exists(fd->filesdna, "CorrectiveSmoothModifierData", "float", "scale"))
|
||||
{
|
||||
LISTBASE_FOREACH (Object *, ob, &bmain->objects) {
|
||||
LISTBASE_FOREACH (ModifierData *, md, &ob->modifiers) {
|
||||
if (md->type == eModifierType_CorrectiveSmooth) {
|
||||
@@ -6158,7 +6175,7 @@ void blo_do_versions_280(FileData *fd, Library * /*lib*/, Main *bmain)
|
||||
}
|
||||
|
||||
if (!MAIN_VERSION_FILE_ATLEAST(bmain, 283, 11)) {
|
||||
if (!DNA_struct_elem_find(fd->filesdna, "OceanModifierData", "float", "fetch_jonswap")) {
|
||||
if (!DNA_struct_member_exists(fd->filesdna, "OceanModifierData", "float", "fetch_jonswap")) {
|
||||
LISTBASE_FOREACH (Object *, object, &bmain->objects) {
|
||||
LISTBASE_FOREACH (ModifierData *, md, &object->modifiers) {
|
||||
if (md->type == eModifierType_Ocean) {
|
||||
@@ -6169,7 +6186,7 @@ void blo_do_versions_280(FileData *fd, Library * /*lib*/, Main *bmain)
|
||||
}
|
||||
}
|
||||
|
||||
if (!DNA_struct_find(fd->filesdna, "XrSessionSettings")) {
|
||||
if (!DNA_struct_exists(fd->filesdna, "XrSessionSettings")) {
|
||||
LISTBASE_FOREACH (wmWindowManager *, wm, &bmain->wm) {
|
||||
const View3D *v3d_default = DNA_struct_default_get(View3D);
|
||||
|
||||
@@ -6184,7 +6201,8 @@ void blo_do_versions_280(FileData *fd, Library * /*lib*/, Main *bmain)
|
||||
}
|
||||
|
||||
/* Surface deform modifier strength. */
|
||||
if (!DNA_struct_elem_find(fd->filesdna, "SurfaceDeformModifierData", "float", "strength")) {
|
||||
if (!DNA_struct_member_exists(fd->filesdna, "SurfaceDeformModifierData", "float", "strength"))
|
||||
{
|
||||
LISTBASE_FOREACH (Object *, ob, &bmain->objects) {
|
||||
LISTBASE_FOREACH (ModifierData *, md, &ob->modifiers) {
|
||||
if (md->type == eModifierType_SurfaceDeform) {
|
||||
@@ -6210,7 +6228,7 @@ void blo_do_versions_280(FileData *fd, Library * /*lib*/, Main *bmain)
|
||||
}
|
||||
|
||||
/* Remesh Modifier Voxel Mode. */
|
||||
if (!DNA_struct_elem_find(fd->filesdna, "RemeshModifierData", "float", "voxel_size")) {
|
||||
if (!DNA_struct_member_exists(fd->filesdna, "RemeshModifierData", "float", "voxel_size")) {
|
||||
LISTBASE_FOREACH (Object *, ob, &bmain->objects) {
|
||||
LISTBASE_FOREACH (ModifierData *, md, &ob->modifiers) {
|
||||
if (md->type == eModifierType_Remesh) {
|
||||
@@ -6225,7 +6243,8 @@ void blo_do_versions_280(FileData *fd, Library * /*lib*/, Main *bmain)
|
||||
|
||||
if (!MAIN_VERSION_FILE_ATLEAST(bmain, 283, 14)) {
|
||||
/* Solidify modifier merge tolerance. */
|
||||
if (!DNA_struct_elem_find(fd->filesdna, "SolidifyModifierData", "float", "merge_tolerance")) {
|
||||
if (!DNA_struct_member_exists(
|
||||
fd->filesdna, "SolidifyModifierData", "float", "merge_tolerance")) {
|
||||
LISTBASE_FOREACH (Object *, ob, &bmain->objects) {
|
||||
LISTBASE_FOREACH (ModifierData *, md, &ob->modifiers) {
|
||||
if (md->type == eModifierType_Solidify) {
|
||||
@@ -6306,7 +6325,7 @@ void blo_do_versions_280(FileData *fd, Library * /*lib*/, Main *bmain)
|
||||
/* Old forgotten versioning code. */
|
||||
if (!MAIN_VERSION_FILE_ATLEAST(bmain, 300, 39)) {
|
||||
/* Set the cloth wind factor to 1 for old forces. */
|
||||
if (!DNA_struct_elem_find(fd->filesdna, "PartDeflect", "float", "f_wind_factor")) {
|
||||
if (!DNA_struct_member_exists(fd->filesdna, "PartDeflect", "float", "f_wind_factor")) {
|
||||
LISTBASE_FOREACH (Object *, ob, &bmain->objects) {
|
||||
if (ob->pd) {
|
||||
ob->pd->f_wind_factor = 1.0f;
|
||||
|
||||
@@ -861,7 +861,7 @@ void blo_do_versions_290(FileData *fd, Library * /*lib*/, Main *bmain)
|
||||
}
|
||||
}
|
||||
|
||||
if (!DNA_struct_elem_find(fd->filesdna, "SpaceImage", "float", "uv_opacity")) {
|
||||
if (!DNA_struct_member_exists(fd->filesdna, "SpaceImage", "float", "uv_opacity")) {
|
||||
LISTBASE_FOREACH (bScreen *, screen, &bmain->screens) {
|
||||
LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) {
|
||||
LISTBASE_FOREACH (SpaceLink *, sl, &area->spacedata) {
|
||||
@@ -875,7 +875,7 @@ void blo_do_versions_290(FileData *fd, Library * /*lib*/, Main *bmain)
|
||||
}
|
||||
|
||||
/* Init Grease Pencil new random curves. */
|
||||
if (!DNA_struct_elem_find(fd->filesdna, "BrushGpencilSettings", "float", "random_hue")) {
|
||||
if (!DNA_struct_member_exists(fd->filesdna, "BrushGpencilSettings", "float", "random_hue")) {
|
||||
LISTBASE_FOREACH (Brush *, brush, &bmain->brushes) {
|
||||
if ((brush->gpencil_settings) && (brush->gpencil_settings->curve_rand_pressure == nullptr))
|
||||
{
|
||||
@@ -907,7 +907,7 @@ void blo_do_versions_290(FileData *fd, Library * /*lib*/, Main *bmain)
|
||||
}
|
||||
|
||||
/* Initialize parameters of the new Nishita sky model. */
|
||||
if (!DNA_struct_elem_find(fd->filesdna, "NodeTexSky", "float", "sun_size")) {
|
||||
if (!DNA_struct_member_exists(fd->filesdna, "NodeTexSky", "float", "sun_size")) {
|
||||
FOREACH_NODETREE_BEGIN (bmain, ntree, id) {
|
||||
if (ntree->type == NTREE_SHADER) {
|
||||
LISTBASE_FOREACH (bNode *, node, &ntree->nodes) {
|
||||
@@ -981,7 +981,7 @@ void blo_do_versions_290(FileData *fd, Library * /*lib*/, Main *bmain)
|
||||
|
||||
if (!MAIN_VERSION_FILE_ATLEAST(bmain, 290, 6)) {
|
||||
/* Transition to saving expansion for all of a modifier's sub-panels. */
|
||||
if (!DNA_struct_elem_find(fd->filesdna, "ModifierData", "short", "ui_expand_flag")) {
|
||||
if (!DNA_struct_member_exists(fd->filesdna, "ModifierData", "short", "ui_expand_flag")) {
|
||||
LISTBASE_FOREACH (Object *, object, &bmain->objects) {
|
||||
LISTBASE_FOREACH (ModifierData *, md, &object->modifiers) {
|
||||
if (md->mode & eModifierMode_Expanded_DEPRECATED) {
|
||||
@@ -995,21 +995,22 @@ void blo_do_versions_290(FileData *fd, Library * /*lib*/, Main *bmain)
|
||||
}
|
||||
|
||||
/* EEVEE Motion blur new parameters. */
|
||||
if (!DNA_struct_elem_find(fd->filesdna, "SceneEEVEE", "float", "motion_blur_depth_scale")) {
|
||||
if (!DNA_struct_member_exists(fd->filesdna, "SceneEEVEE", "float", "motion_blur_depth_scale"))
|
||||
{
|
||||
LISTBASE_FOREACH (Scene *, scene, &bmain->scenes) {
|
||||
scene->eevee.motion_blur_depth_scale = 100.0f;
|
||||
scene->eevee.motion_blur_max = 32;
|
||||
}
|
||||
}
|
||||
|
||||
if (!DNA_struct_elem_find(fd->filesdna, "SceneEEVEE", "int", "motion_blur_steps")) {
|
||||
if (!DNA_struct_member_exists(fd->filesdna, "SceneEEVEE", "int", "motion_blur_steps")) {
|
||||
LISTBASE_FOREACH (Scene *, scene, &bmain->scenes) {
|
||||
scene->eevee.motion_blur_steps = 1;
|
||||
}
|
||||
}
|
||||
|
||||
/* Transition to saving expansion for all of a constraint's sub-panels. */
|
||||
if (!DNA_struct_elem_find(fd->filesdna, "bConstraint", "short", "ui_expand_flag")) {
|
||||
if (!DNA_struct_member_exists(fd->filesdna, "bConstraint", "short", "ui_expand_flag")) {
|
||||
LISTBASE_FOREACH (Object *, object, &bmain->objects) {
|
||||
LISTBASE_FOREACH (bConstraint *, con, &object->constraints) {
|
||||
if (con->flag & CONSTRAINT_EXPAND_DEPRECATED) {
|
||||
@@ -1023,7 +1024,8 @@ void blo_do_versions_290(FileData *fd, Library * /*lib*/, Main *bmain)
|
||||
}
|
||||
|
||||
/* Transition to saving expansion for all of grease pencil modifier's sub-panels. */
|
||||
if (!DNA_struct_elem_find(fd->filesdna, "GpencilModifierData", "short", "ui_expand_flag")) {
|
||||
if (!DNA_struct_member_exists(fd->filesdna, "GpencilModifierData", "short", "ui_expand_flag"))
|
||||
{
|
||||
LISTBASE_FOREACH (Object *, object, &bmain->objects) {
|
||||
LISTBASE_FOREACH (GpencilModifierData *, md, &object->greasepencil_modifiers) {
|
||||
if (md->mode & eGpencilModifierMode_Expanded_DEPRECATED) {
|
||||
@@ -1037,7 +1039,7 @@ void blo_do_versions_290(FileData *fd, Library * /*lib*/, Main *bmain)
|
||||
}
|
||||
|
||||
/* Transition to saving expansion for all of an effect's sub-panels. */
|
||||
if (!DNA_struct_elem_find(fd->filesdna, "ShaderFxData", "short", "ui_expand_flag")) {
|
||||
if (!DNA_struct_member_exists(fd->filesdna, "ShaderFxData", "short", "ui_expand_flag")) {
|
||||
LISTBASE_FOREACH (Object *, object, &bmain->objects) {
|
||||
LISTBASE_FOREACH (ShaderFxData *, fx, &object->shader_fx) {
|
||||
if (fx->mode & eShaderFxMode_Expanded_DEPRECATED) {
|
||||
@@ -1051,7 +1053,7 @@ void blo_do_versions_290(FileData *fd, Library * /*lib*/, Main *bmain)
|
||||
}
|
||||
|
||||
/* Refactor bevel profile type to use an enum. */
|
||||
if (!DNA_struct_elem_find(fd->filesdna, "BevelModifierData", "short", "profile_type")) {
|
||||
if (!DNA_struct_member_exists(fd->filesdna, "BevelModifierData", "short", "profile_type")) {
|
||||
LISTBASE_FOREACH (Object *, object, &bmain->objects) {
|
||||
LISTBASE_FOREACH (ModifierData *, md, &object->modifiers) {
|
||||
if (md->type == eModifierType_Bevel) {
|
||||
@@ -1079,7 +1081,7 @@ void blo_do_versions_290(FileData *fd, Library * /*lib*/, Main *bmain)
|
||||
if (!MAIN_VERSION_FILE_ATLEAST(bmain, 291, 1)) {
|
||||
|
||||
/* Initialize additional parameter of the Nishita sky model and change altitude unit. */
|
||||
if (!DNA_struct_elem_find(fd->filesdna, "NodeTexSky", "float", "sun_intensity")) {
|
||||
if (!DNA_struct_member_exists(fd->filesdna, "NodeTexSky", "float", "sun_intensity")) {
|
||||
FOREACH_NODETREE_BEGIN (bmain, ntree, id) {
|
||||
if (ntree->type == NTREE_SHADER) {
|
||||
LISTBASE_FOREACH (bNode *, node, &ntree->nodes) {
|
||||
@@ -1095,7 +1097,7 @@ void blo_do_versions_290(FileData *fd, Library * /*lib*/, Main *bmain)
|
||||
}
|
||||
|
||||
/* Refactor bevel affect type to use an enum. */
|
||||
if (!DNA_struct_elem_find(fd->filesdna, "BevelModifierData", "char", "affect_type")) {
|
||||
if (!DNA_struct_member_exists(fd->filesdna, "BevelModifierData", "char", "affect_type")) {
|
||||
LISTBASE_FOREACH (Object *, object, &bmain->objects) {
|
||||
LISTBASE_FOREACH (ModifierData *, md, &object->modifiers) {
|
||||
if (md->type == eModifierType_Bevel) {
|
||||
@@ -1109,8 +1111,8 @@ void blo_do_versions_290(FileData *fd, Library * /*lib*/, Main *bmain)
|
||||
}
|
||||
|
||||
/* Initialize additional velocity parameter for #CacheFile's. */
|
||||
if (!DNA_struct_elem_find(fd->filesdna, "MeshSeqCacheModifierData", "float", "velocity_scale"))
|
||||
{
|
||||
if (!DNA_struct_member_exists(
|
||||
fd->filesdna, "MeshSeqCacheModifierData", "float", "velocity_scale")) {
|
||||
LISTBASE_FOREACH (Object *, object, &bmain->objects) {
|
||||
LISTBASE_FOREACH (ModifierData *, md, &object->modifiers) {
|
||||
if (md->type == eModifierType_MeshSequenceCache) {
|
||||
@@ -1121,14 +1123,15 @@ void blo_do_versions_290(FileData *fd, Library * /*lib*/, Main *bmain)
|
||||
}
|
||||
}
|
||||
|
||||
if (!DNA_struct_elem_find(fd->filesdna, "CacheFile", "char", "velocity_unit")) {
|
||||
if (!DNA_struct_member_exists(fd->filesdna, "CacheFile", "char", "velocity_unit")) {
|
||||
LISTBASE_FOREACH (CacheFile *, cache_file, &bmain->cachefiles) {
|
||||
STRNCPY(cache_file->velocity_name, ".velocities");
|
||||
cache_file->velocity_unit = CACHEFILE_VELOCITY_UNIT_SECOND;
|
||||
}
|
||||
}
|
||||
|
||||
if (!DNA_struct_elem_find(fd->filesdna, "OceanModifierData", "int", "viewport_resolution")) {
|
||||
if (!DNA_struct_member_exists(fd->filesdna, "OceanModifierData", "int", "viewport_resolution"))
|
||||
{
|
||||
LISTBASE_FOREACH (Object *, object, &bmain->objects) {
|
||||
LISTBASE_FOREACH (ModifierData *, md, &object->modifiers) {
|
||||
if (md->type == eModifierType_Ocean) {
|
||||
@@ -1243,7 +1246,7 @@ void blo_do_versions_290(FileData *fd, Library * /*lib*/, Main *bmain)
|
||||
}
|
||||
|
||||
/* Add custom profile and bevel mode to curve bevels. */
|
||||
if (!DNA_struct_elem_find(fd->filesdna, "Curve", "char", "bevel_mode")) {
|
||||
if (!DNA_struct_member_exists(fd->filesdna, "Curve", "char", "bevel_mode")) {
|
||||
LISTBASE_FOREACH (Curve *, curve, &bmain->curves) {
|
||||
if (curve->bevobj != nullptr) {
|
||||
curve->bevel_mode = CU_BEV_MODE_OBJECT;
|
||||
@@ -1276,7 +1279,7 @@ void blo_do_versions_290(FileData *fd, Library * /*lib*/, Main *bmain)
|
||||
|
||||
if (!MAIN_VERSION_FILE_ATLEAST(bmain, 291, 6)) {
|
||||
/* Darken Inactive Overlay. */
|
||||
if (!DNA_struct_elem_find(fd->filesdna, "View3DOverlay", "float", "fade_alpha")) {
|
||||
if (!DNA_struct_member_exists(fd->filesdna, "View3DOverlay", "float", "fade_alpha")) {
|
||||
LISTBASE_FOREACH (bScreen *, screen, &bmain->screens) {
|
||||
LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) {
|
||||
LISTBASE_FOREACH (SpaceLink *, sl, &area->spacedata) {
|
||||
@@ -1291,7 +1294,7 @@ void blo_do_versions_290(FileData *fd, Library * /*lib*/, Main *bmain)
|
||||
}
|
||||
|
||||
/* Unify symmetry as a mesh property. */
|
||||
if (!DNA_struct_elem_find(fd->filesdna, "Mesh", "char", "symmetry")) {
|
||||
if (!DNA_struct_member_exists(fd->filesdna, "Mesh", "char", "symmetry")) {
|
||||
LISTBASE_FOREACH (Mesh *, mesh, &bmain->meshes) {
|
||||
/* The previous flags used to store mesh symmetry in edit-mode match the new ones that are
|
||||
* used in #Mesh.symmetry. */
|
||||
@@ -1319,7 +1322,7 @@ void blo_do_versions_290(FileData *fd, Library * /*lib*/, Main *bmain)
|
||||
}
|
||||
|
||||
if (!MAIN_VERSION_FILE_ATLEAST(bmain, 291, 8)) {
|
||||
if (!DNA_struct_elem_find(fd->filesdna, "WorkSpaceDataRelation", "int", "parentid")) {
|
||||
if (!DNA_struct_member_exists(fd->filesdna, "WorkSpaceDataRelation", "int", "parentid")) {
|
||||
LISTBASE_FOREACH (WorkSpace *, workspace, &bmain->workspaces) {
|
||||
LISTBASE_FOREACH_MUTABLE (
|
||||
WorkSpaceDataRelation *, relation, &workspace->hook_layout_relations) {
|
||||
@@ -1347,7 +1350,7 @@ void blo_do_versions_290(FileData *fd, Library * /*lib*/, Main *bmain)
|
||||
}
|
||||
|
||||
/* UV/Image show overlay option. */
|
||||
if (!DNA_struct_find(fd->filesdna, "SpaceImageOverlay")) {
|
||||
if (!DNA_struct_exists(fd->filesdna, "SpaceImageOverlay")) {
|
||||
LISTBASE_FOREACH (bScreen *, screen, &bmain->screens) {
|
||||
LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) {
|
||||
LISTBASE_FOREACH (SpaceLink *, space, &area->spacedata) {
|
||||
@@ -1385,7 +1388,8 @@ void blo_do_versions_290(FileData *fd, Library * /*lib*/, Main *bmain)
|
||||
}
|
||||
}
|
||||
|
||||
if (!DNA_struct_elem_find(fd->filesdna, "FluidModifierData", "float", "fractions_distance")) {
|
||||
if (!DNA_struct_member_exists(
|
||||
fd->filesdna, "FluidModifierData", "float", "fractions_distance")) {
|
||||
LISTBASE_FOREACH (Object *, ob, &bmain->objects) {
|
||||
LISTBASE_FOREACH (ModifierData *, md, &ob->modifiers) {
|
||||
if (md->type == eModifierType_Fluid) {
|
||||
@@ -1430,7 +1434,7 @@ void blo_do_versions_290(FileData *fd, Library * /*lib*/, Main *bmain)
|
||||
|
||||
if (!MAIN_VERSION_FILE_ATLEAST(bmain, 292, 5)) {
|
||||
/* Initialize the opacity of the overlay wireframe */
|
||||
if (!DNA_struct_elem_find(fd->filesdna, "View3DOverlay", "float", "wireframe_opacity")) {
|
||||
if (!DNA_struct_member_exists(fd->filesdna, "View3DOverlay", "float", "wireframe_opacity")) {
|
||||
LISTBASE_FOREACH (bScreen *, screen, &bmain->screens) {
|
||||
LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) {
|
||||
LISTBASE_FOREACH (SpaceLink *, sl, &area->spacedata) {
|
||||
@@ -1476,7 +1480,7 @@ void blo_do_versions_290(FileData *fd, Library * /*lib*/, Main *bmain)
|
||||
}
|
||||
|
||||
/* Cryptomatte render pass */
|
||||
if (!DNA_struct_elem_find(fd->filesdna, "ViewLayer", "short", "cryptomatte_levels")) {
|
||||
if (!DNA_struct_member_exists(fd->filesdna, "ViewLayer", "short", "cryptomatte_levels")) {
|
||||
LISTBASE_FOREACH (Scene *, scene, &bmain->scenes) {
|
||||
LISTBASE_FOREACH (ViewLayer *, view_layer, &scene->view_layers) {
|
||||
view_layer->cryptomatte_levels = 6;
|
||||
@@ -1525,7 +1529,7 @@ void blo_do_versions_290(FileData *fd, Library * /*lib*/, Main *bmain)
|
||||
}
|
||||
|
||||
/* Convert `NodeCryptomatte->storage->matte_id` to `NodeCryptomatte->storage->entries` */
|
||||
if (!DNA_struct_find(fd->filesdna, "CryptomatteEntry")) {
|
||||
if (!DNA_struct_exists(fd->filesdna, "CryptomatteEntry")) {
|
||||
LISTBASE_FOREACH (Scene *, scene, &bmain->scenes) {
|
||||
if (scene->nodetree) {
|
||||
LISTBASE_FOREACH (bNode *, node, &scene->nodetree->nodes) {
|
||||
@@ -1586,7 +1590,7 @@ void blo_do_versions_290(FileData *fd, Library * /*lib*/, Main *bmain)
|
||||
}
|
||||
|
||||
/* Ensure that new viscosity strength field is initialized correctly. */
|
||||
if (!DNA_struct_elem_find(fd->filesdna, "FluidModifierData", "float", "viscosity_value")) {
|
||||
if (!DNA_struct_member_exists(fd->filesdna, "FluidModifierData", "float", "viscosity_value")) {
|
||||
LISTBASE_FOREACH (Object *, ob, &bmain->objects) {
|
||||
LISTBASE_FOREACH (ModifierData *, md, &ob->modifiers) {
|
||||
if (md->type == eModifierType_Fluid) {
|
||||
@@ -1601,7 +1605,7 @@ void blo_do_versions_290(FileData *fd, Library * /*lib*/, Main *bmain)
|
||||
}
|
||||
|
||||
if (!MAIN_VERSION_FILE_ATLEAST(bmain, 292, 10)) {
|
||||
if (!DNA_struct_find(fd->filesdna, "NodeSetAlpha")) {
|
||||
if (!DNA_struct_exists(fd->filesdna, "NodeSetAlpha")) {
|
||||
FOREACH_NODETREE_BEGIN (bmain, ntree, id) {
|
||||
if (ntree->type != NTREE_COMPOSIT) {
|
||||
continue;
|
||||
@@ -1657,14 +1661,14 @@ void blo_do_versions_290(FileData *fd, Library * /*lib*/, Main *bmain)
|
||||
FOREACH_NODETREE_END;
|
||||
|
||||
/* Init grease pencil default curve resolution. */
|
||||
if (!DNA_struct_elem_find(fd->filesdna, "bGPdata", "int", "curve_edit_resolution")) {
|
||||
if (!DNA_struct_member_exists(fd->filesdna, "bGPdata", "int", "curve_edit_resolution")) {
|
||||
LISTBASE_FOREACH (bGPdata *, gpd, &bmain->gpencils) {
|
||||
gpd->curve_edit_resolution = GP_DEFAULT_CURVE_RESOLUTION;
|
||||
gpd->flag |= GP_DATA_CURVE_ADAPTIVE_RESOLUTION;
|
||||
}
|
||||
}
|
||||
/* Init grease pencil curve editing error threshold. */
|
||||
if (!DNA_struct_elem_find(fd->filesdna, "bGPdata", "float", "curve_edit_threshold")) {
|
||||
if (!DNA_struct_member_exists(fd->filesdna, "bGPdata", "float", "curve_edit_threshold")) {
|
||||
LISTBASE_FOREACH (bGPdata *, gpd, &bmain->gpencils) {
|
||||
gpd->curve_edit_threshold = GP_DEFAULT_CURVE_ERROR;
|
||||
gpd->curve_edit_corner_angle = GP_DEFAULT_CURVE_EDIT_CORNER_ANGLE;
|
||||
@@ -1693,7 +1697,7 @@ void blo_do_versions_290(FileData *fd, Library * /*lib*/, Main *bmain)
|
||||
|
||||
if (!MAIN_VERSION_FILE_ATLEAST(bmain, 293, 1)) {
|
||||
/* Grease pencil layer transform matrix. */
|
||||
if (!DNA_struct_elem_find(fd->filesdna, "bGPDlayer", "float", "location[0]")) {
|
||||
if (!DNA_struct_member_exists(fd->filesdna, "bGPDlayer", "float", "location[0]")) {
|
||||
LISTBASE_FOREACH (bGPdata *, gpd, &bmain->gpencils) {
|
||||
LISTBASE_FOREACH (bGPDlayer *, gpl, &gpd->layers) {
|
||||
zero_v3(gpl->location);
|
||||
@@ -1751,7 +1755,7 @@ void blo_do_versions_290(FileData *fd, Library * /*lib*/, Main *bmain)
|
||||
}
|
||||
|
||||
if (!MAIN_VERSION_FILE_ATLEAST(bmain, 293, 9)) {
|
||||
if (!DNA_struct_elem_find(fd->filesdna, "SceneEEVEE", "float", "bokeh_overblur")) {
|
||||
if (!DNA_struct_member_exists(fd->filesdna, "SceneEEVEE", "float", "bokeh_overblur")) {
|
||||
LISTBASE_FOREACH (Scene *, scene, &bmain->scenes) {
|
||||
scene->eevee.bokeh_neighbor_max = 10.0f;
|
||||
scene->eevee.bokeh_denoise_fac = 0.75f;
|
||||
@@ -1760,7 +1764,7 @@ void blo_do_versions_290(FileData *fd, Library * /*lib*/, Main *bmain)
|
||||
}
|
||||
|
||||
/* Add sub-panels for FModifiers, which requires a field to store expansion. */
|
||||
if (!DNA_struct_elem_find(fd->filesdna, "FModifier", "short", "ui_expand_flag")) {
|
||||
if (!DNA_struct_member_exists(fd->filesdna, "FModifier", "short", "ui_expand_flag")) {
|
||||
LISTBASE_FOREACH (bAction *, act, &bmain->actions) {
|
||||
LISTBASE_FOREACH (FCurve *, fcu, &act->curves) {
|
||||
LISTBASE_FOREACH (FModifier *, fcm, &fcu->modifiers) {
|
||||
@@ -1854,7 +1858,7 @@ void blo_do_versions_290(FileData *fd, Library * /*lib*/, Main *bmain)
|
||||
}
|
||||
|
||||
if (!MAIN_VERSION_FILE_ATLEAST(bmain, 293, 14)) {
|
||||
if (!DNA_struct_elem_find(fd->filesdna, "Lamp", "float", "diff_fac")) {
|
||||
if (!DNA_struct_member_exists(fd->filesdna, "Lamp", "float", "diff_fac")) {
|
||||
LISTBASE_FOREACH (Light *, light, &bmain->lights) {
|
||||
light->diff_fac = 1.0f;
|
||||
light->volume_fac = 1.0f;
|
||||
@@ -1904,7 +1908,7 @@ void blo_do_versions_290(FileData *fd, Library * /*lib*/, Main *bmain)
|
||||
}
|
||||
|
||||
if (!MAIN_VERSION_FILE_ATLEAST(bmain, 293, 18)) {
|
||||
if (!DNA_struct_elem_find(fd->filesdna, "bArmature", "float", "axes_position")) {
|
||||
if (!DNA_struct_member_exists(fd->filesdna, "bArmature", "float", "axes_position")) {
|
||||
/* Convert the axes draw position to its old default (tip of bone). */
|
||||
LISTBASE_FOREACH (bArmature *, arm, &bmain->armatures) {
|
||||
arm->axes_position = 1.0;
|
||||
@@ -1912,7 +1916,7 @@ void blo_do_versions_290(FileData *fd, Library * /*lib*/, Main *bmain)
|
||||
}
|
||||
|
||||
/* Initialize the spread parameter for area lights. */
|
||||
if (!DNA_struct_elem_find(fd->filesdna, "Lamp", "float", "area_spread")) {
|
||||
if (!DNA_struct_member_exists(fd->filesdna, "Lamp", "float", "area_spread")) {
|
||||
LISTBASE_FOREACH (Light *, la, &bmain->lights) {
|
||||
la->area_spread = DEG2RADF(180.0f);
|
||||
}
|
||||
|
||||
@@ -2396,7 +2396,8 @@ void blo_do_versions_300(FileData *fd, Library * /*lib*/, Main *bmain)
|
||||
|
||||
if (!MAIN_VERSION_FILE_ATLEAST(bmain, 300, 1)) {
|
||||
/* Set default value for the new bisect_threshold parameter in the mirror modifier. */
|
||||
if (!DNA_struct_elem_find(fd->filesdna, "MirrorModifierData", "float", "bisect_threshold")) {
|
||||
if (!DNA_struct_member_exists(fd->filesdna, "MirrorModifierData", "float", "bisect_threshold"))
|
||||
{
|
||||
LISTBASE_FOREACH (Object *, ob, &bmain->objects) {
|
||||
LISTBASE_FOREACH (ModifierData *, md, &ob->modifiers) {
|
||||
if (md->type == eModifierType_Mirror) {
|
||||
@@ -2408,7 +2409,7 @@ void blo_do_versions_300(FileData *fd, Library * /*lib*/, Main *bmain)
|
||||
}
|
||||
}
|
||||
/* Grease Pencil: Set default value for dilate pixels. */
|
||||
if (!DNA_struct_elem_find(fd->filesdna, "BrushGpencilSettings", "int", "dilate_pixels")) {
|
||||
if (!DNA_struct_member_exists(fd->filesdna, "BrushGpencilSettings", "int", "dilate_pixels")) {
|
||||
LISTBASE_FOREACH (Brush *, brush, &bmain->brushes) {
|
||||
if (brush->gpencil_settings) {
|
||||
brush->gpencil_settings->dilate_pixels = 1;
|
||||
@@ -2420,7 +2421,7 @@ void blo_do_versions_300(FileData *fd, Library * /*lib*/, Main *bmain)
|
||||
if (!MAIN_VERSION_FILE_ATLEAST(bmain, 300, 2)) {
|
||||
version_switch_node_input_prefix(bmain);
|
||||
|
||||
if (!DNA_struct_elem_find(fd->filesdna, "bPoseChannel", "float", "custom_scale_xyz[3]")) {
|
||||
if (!DNA_struct_member_exists(fd->filesdna, "bPoseChannel", "float", "custom_scale_xyz[3]")) {
|
||||
LISTBASE_FOREACH (Object *, ob, &bmain->objects) {
|
||||
if (ob->pose == nullptr) {
|
||||
continue;
|
||||
@@ -2470,7 +2471,7 @@ void blo_do_versions_300(FileData *fd, Library * /*lib*/, Main *bmain)
|
||||
}
|
||||
FOREACH_NODETREE_END;
|
||||
|
||||
if (!DNA_struct_elem_find(fd->filesdna, "FileAssetSelectParams", "short", "import_type")) {
|
||||
if (!DNA_struct_member_exists(fd->filesdna, "FileAssetSelectParams", "short", "import_type")) {
|
||||
LISTBASE_FOREACH (bScreen *, screen, &bmain->screens) {
|
||||
LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) {
|
||||
LISTBASE_FOREACH (SpaceLink *, sl, &area->spacedata) {
|
||||
@@ -2486,7 +2487,7 @@ void blo_do_versions_300(FileData *fd, Library * /*lib*/, Main *bmain)
|
||||
}
|
||||
|
||||
/* Initialize length-wise scale B-Bone settings. */
|
||||
if (!DNA_struct_elem_find(fd->filesdna, "Bone", "int", "bbone_flag")) {
|
||||
if (!DNA_struct_member_exists(fd->filesdna, "Bone", "int", "bbone_flag")) {
|
||||
/* Update armature data and pose channels. */
|
||||
LISTBASE_FOREACH (bArmature *, arm, &bmain->armatures) {
|
||||
do_version_bones_bbone_len_scale(&arm->bonebase);
|
||||
@@ -2630,8 +2631,8 @@ void blo_do_versions_300(FileData *fd, Library * /*lib*/, Main *bmain)
|
||||
|
||||
if (!MAIN_VERSION_FILE_ATLEAST(bmain, 300, 13)) {
|
||||
/* Convert Surface Deform to sparse-capable bind structure. */
|
||||
if (!DNA_struct_elem_find(fd->filesdna, "SurfaceDeformModifierData", "int", "num_mesh_verts"))
|
||||
{
|
||||
if (!DNA_struct_member_exists(
|
||||
fd->filesdna, "SurfaceDeformModifierData", "int", "num_mesh_verts")) {
|
||||
LISTBASE_FOREACH (Object *, ob, &bmain->objects) {
|
||||
LISTBASE_FOREACH (ModifierData *, md, &ob->modifiers) {
|
||||
if (md->type == eModifierType_SurfaceDeform) {
|
||||
@@ -2657,14 +2658,14 @@ void blo_do_versions_300(FileData *fd, Library * /*lib*/, Main *bmain)
|
||||
}
|
||||
}
|
||||
|
||||
if (!DNA_struct_elem_find(fd->filesdna, "WorkSpace", "AssetLibraryReference", "asset_library"))
|
||||
{
|
||||
if (!DNA_struct_member_exists(
|
||||
fd->filesdna, "WorkSpace", "AssetLibraryReference", "asset_library")) {
|
||||
LISTBASE_FOREACH (WorkSpace *, workspace, &bmain->workspaces) {
|
||||
BKE_asset_library_reference_init_default(&workspace->asset_library_ref);
|
||||
}
|
||||
}
|
||||
|
||||
if (!DNA_struct_elem_find(
|
||||
if (!DNA_struct_member_exists(
|
||||
fd->filesdna, "FileAssetSelectParams", "AssetLibraryReference", "asset_library_ref"))
|
||||
{
|
||||
LISTBASE_FOREACH (bScreen *, screen, &bmain->screens) {
|
||||
@@ -2716,8 +2717,9 @@ void blo_do_versions_300(FileData *fd, Library * /*lib*/, Main *bmain)
|
||||
}
|
||||
|
||||
if (!MAIN_VERSION_FILE_ATLEAST(bmain, 300, 17)) {
|
||||
if (!DNA_struct_elem_find(
|
||||
fd->filesdna, "View3DOverlay", "float", "normals_constant_screen_size")) {
|
||||
if (!DNA_struct_member_exists(
|
||||
fd->filesdna, "View3DOverlay", "float", "normals_constant_screen_size"))
|
||||
{
|
||||
LISTBASE_FOREACH (bScreen *, screen, &bmain->screens) {
|
||||
LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) {
|
||||
LISTBASE_FOREACH (SpaceLink *, sl, &area->spacedata) {
|
||||
@@ -2782,14 +2784,15 @@ void blo_do_versions_300(FileData *fd, Library * /*lib*/, Main *bmain)
|
||||
}
|
||||
|
||||
if (!MAIN_VERSION_FILE_ATLEAST(bmain, 300, 18)) {
|
||||
if (!DNA_struct_elem_find(
|
||||
fd->filesdna, "WorkSpace", "AssetLibraryReference", "asset_library_ref")) {
|
||||
if (!DNA_struct_member_exists(
|
||||
fd->filesdna, "WorkSpace", "AssetLibraryReference", "asset_library_ref"))
|
||||
{
|
||||
LISTBASE_FOREACH (WorkSpace *, workspace, &bmain->workspaces) {
|
||||
BKE_asset_library_reference_init_default(&workspace->asset_library_ref);
|
||||
}
|
||||
}
|
||||
|
||||
if (!DNA_struct_elem_find(
|
||||
if (!DNA_struct_member_exists(
|
||||
fd->filesdna, "FileAssetSelectParams", "AssetLibraryReference", "asset_library_ref"))
|
||||
{
|
||||
LISTBASE_FOREACH (bScreen *, screen, &bmain->screens) {
|
||||
@@ -2877,7 +2880,7 @@ void blo_do_versions_300(FileData *fd, Library * /*lib*/, Main *bmain)
|
||||
}
|
||||
|
||||
if (!MAIN_VERSION_FILE_ATLEAST(bmain, 300, 22)) {
|
||||
if (!DNA_struct_elem_find(
|
||||
if (!DNA_struct_member_exists(
|
||||
fd->filesdna, "LineartGpencilModifierData", "bool", "use_crease_on_smooth"))
|
||||
{
|
||||
LISTBASE_FOREACH (Object *, ob, &bmain->objects) {
|
||||
@@ -3170,7 +3173,7 @@ void blo_do_versions_300(FileData *fd, Library * /*lib*/, Main *bmain)
|
||||
|
||||
if (!MAIN_VERSION_FILE_ATLEAST(bmain, 300, 37)) {
|
||||
/* Node Editor: toggle overlays on. */
|
||||
if (!DNA_struct_find(fd->filesdna, "SpaceNodeOverlay")) {
|
||||
if (!DNA_struct_exists(fd->filesdna, "SpaceNodeOverlay")) {
|
||||
LISTBASE_FOREACH (bScreen *, screen, &bmain->screens) {
|
||||
LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) {
|
||||
LISTBASE_FOREACH (SpaceLink *, space, &area->spacedata) {
|
||||
@@ -3427,7 +3430,7 @@ void blo_do_versions_300(FileData *fd, Library * /*lib*/, Main *bmain)
|
||||
}
|
||||
|
||||
/* Initialize the bone wireframe opacity setting. */
|
||||
if (!DNA_struct_elem_find(fd->filesdna, "View3DOverlay", "float", "bone_wire_alpha")) {
|
||||
if (!DNA_struct_member_exists(fd->filesdna, "View3DOverlay", "float", "bone_wire_alpha")) {
|
||||
LISTBASE_FOREACH (bScreen *, screen, &bmain->screens) {
|
||||
LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) {
|
||||
LISTBASE_FOREACH (SpaceLink *, sl, &area->spacedata) {
|
||||
@@ -3847,7 +3850,7 @@ void blo_do_versions_300(FileData *fd, Library * /*lib*/, Main *bmain)
|
||||
}
|
||||
}
|
||||
|
||||
if (!DNA_struct_elem_find(fd->filesdna, "Sculpt", "float", "automasking_cavity_factor")) {
|
||||
if (!DNA_struct_member_exists(fd->filesdna, "Sculpt", "float", "automasking_cavity_factor")) {
|
||||
LISTBASE_FOREACH (Scene *, scene, &bmain->scenes) {
|
||||
if (scene->toolsettings && scene->toolsettings->sculpt) {
|
||||
scene->toolsettings->sculpt->automasking_cavity_factor = 0.5f;
|
||||
@@ -3879,7 +3882,7 @@ void blo_do_versions_300(FileData *fd, Library * /*lib*/, Main *bmain)
|
||||
}
|
||||
|
||||
/* UDIM Packing. */
|
||||
if (!DNA_struct_elem_find(fd->filesdna, "ImagePackedFile", "int", "tile_number")) {
|
||||
if (!DNA_struct_member_exists(fd->filesdna, "ImagePackedFile", "int", "tile_number")) {
|
||||
LISTBASE_FOREACH (Image *, ima, &bmain->images) {
|
||||
int view;
|
||||
LISTBASE_FOREACH_INDEX (ImagePackedFile *, imapf, &ima->packedfiles, view) {
|
||||
@@ -4040,7 +4043,7 @@ void blo_do_versions_300(FileData *fd, Library * /*lib*/, Main *bmain)
|
||||
|
||||
if (!MAIN_VERSION_FILE_ATLEAST(bmain, 304, 1)) {
|
||||
/* Image generation information transferred to tiles. */
|
||||
if (!DNA_struct_elem_find(fd->filesdna, "ImageTile", "int", "gen_x")) {
|
||||
if (!DNA_struct_member_exists(fd->filesdna, "ImageTile", "int", "gen_x")) {
|
||||
LISTBASE_FOREACH (Image *, ima, &bmain->images) {
|
||||
LISTBASE_FOREACH (ImageTile *, tile, &ima->tiles) {
|
||||
tile->gen_x = ima->gen_x;
|
||||
@@ -4195,7 +4198,7 @@ void blo_do_versions_300(FileData *fd, Library * /*lib*/, Main *bmain)
|
||||
}
|
||||
|
||||
/* UVSeam fixing distance. */
|
||||
if (!DNA_struct_elem_find(fd->filesdna, "Image", "short", "seam_margin")) {
|
||||
if (!DNA_struct_member_exists(fd->filesdna, "Image", "short", "seam_margin")) {
|
||||
LISTBASE_FOREACH (Image *, image, &bmain->images) {
|
||||
image->seam_margin = 8;
|
||||
}
|
||||
@@ -4228,8 +4231,10 @@ void blo_do_versions_300(FileData *fd, Library * /*lib*/, Main *bmain)
|
||||
}
|
||||
/* Grease Pencil Build modifier:
|
||||
* Set default value for new natural draw-speed factor and maximum gap. */
|
||||
if (!DNA_struct_elem_find(fd->filesdna, "BuildGpencilModifierData", "float", "speed_fac") ||
|
||||
!DNA_struct_elem_find(fd->filesdna, "BuildGpencilModifierData", "float", "speed_maxgap"))
|
||||
if (!DNA_struct_member_exists(
|
||||
fd->filesdna, "BuildGpencilModifierData", "float", "speed_fac") ||
|
||||
!DNA_struct_member_exists(
|
||||
fd->filesdna, "BuildGpencilModifierData", "float", "speed_maxgap"))
|
||||
{
|
||||
LISTBASE_FOREACH (Object *, ob, &bmain->objects) {
|
||||
LISTBASE_FOREACH (GpencilModifierData *, md, &ob->greasepencil_modifiers) {
|
||||
@@ -4321,7 +4326,7 @@ void blo_do_versions_300(FileData *fd, Library * /*lib*/, Main *bmain)
|
||||
}
|
||||
}
|
||||
|
||||
if (!DNA_struct_elem_find(fd->filesdna, "SceneEEVEE", "int", "shadow_pool_size")) {
|
||||
if (!DNA_struct_member_exists(fd->filesdna, "SceneEEVEE", "int", "shadow_pool_size")) {
|
||||
LISTBASE_FOREACH (Scene *, scene, &bmain->scenes) {
|
||||
scene->eevee.flag |= SCE_EEVEE_SHADOW_ENABLED;
|
||||
scene->eevee.shadow_pool_size = 512;
|
||||
@@ -4362,7 +4367,7 @@ void blo_do_versions_300(FileData *fd, Library * /*lib*/, Main *bmain)
|
||||
|
||||
if (!MAIN_VERSION_FILE_ATLEAST(bmain, 306, 3)) {
|
||||
/* Z bias for retopology overlay. */
|
||||
if (!DNA_struct_elem_find(fd->filesdna, "View3DOverlay", "float", "retopology_offset")) {
|
||||
if (!DNA_struct_member_exists(fd->filesdna, "View3DOverlay", "float", "retopology_offset")) {
|
||||
LISTBASE_FOREACH (bScreen *, screen, &bmain->screens) {
|
||||
LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) {
|
||||
LISTBASE_FOREACH (SpaceLink *, sl, &area->spacedata) {
|
||||
|
||||
@@ -288,11 +288,11 @@ void do_versions_after_linking_400(FileData *fd, Main *bmain)
|
||||
}
|
||||
|
||||
if (!MAIN_VERSION_FILE_ATLEAST(bmain, 400, 21)) {
|
||||
if (!DNA_struct_elem_find(fd->filesdna, "bPoseChannel", "BoneColor", "color")) {
|
||||
if (!DNA_struct_member_exists(fd->filesdna, "bPoseChannel", "BoneColor", "color")) {
|
||||
version_bonegroup_migrate_color(bmain);
|
||||
}
|
||||
|
||||
if (!DNA_struct_elem_find(fd->filesdna, "bArmature", "ListBase", "collections")) {
|
||||
if (!DNA_struct_member_exists(fd->filesdna, "bArmature", "ListBase", "collections")) {
|
||||
version_bonelayers_to_bonecollections(bmain);
|
||||
version_bonegroups_to_bonecollections(bmain);
|
||||
}
|
||||
@@ -998,7 +998,7 @@ void blo_do_versions_400(FileData *fd, Library * /*lib*/, Main *bmain)
|
||||
}
|
||||
|
||||
if (!MAIN_VERSION_FILE_ATLEAST(bmain, 400, 12)) {
|
||||
if (!DNA_struct_elem_find(fd->filesdna, "LightProbe", "int", "grid_bake_samples")) {
|
||||
if (!DNA_struct_member_exists(fd->filesdna, "LightProbe", "int", "grid_bake_samples")) {
|
||||
LISTBASE_FOREACH (LightProbe *, lightprobe, &bmain->lightprobes) {
|
||||
lightprobe->grid_bake_samples = 2048;
|
||||
lightprobe->surfel_density = 1.0f;
|
||||
@@ -1011,19 +1011,19 @@ void blo_do_versions_400(FileData *fd, Library * /*lib*/, Main *bmain)
|
||||
}
|
||||
|
||||
/* Set default bake resolution. */
|
||||
if (!DNA_struct_elem_find(fd->filesdna, "LightProbe", "int", "resolution")) {
|
||||
if (!DNA_struct_member_exists(fd->filesdna, "LightProbe", "int", "resolution")) {
|
||||
LISTBASE_FOREACH (LightProbe *, lightprobe, &bmain->lightprobes) {
|
||||
lightprobe->resolution = LIGHT_PROBE_RESOLUTION_1024;
|
||||
}
|
||||
}
|
||||
|
||||
if (!DNA_struct_elem_find(fd->filesdna, "World", "int", "probe_resolution")) {
|
||||
if (!DNA_struct_member_exists(fd->filesdna, "World", "int", "probe_resolution")) {
|
||||
LISTBASE_FOREACH (World *, world, &bmain->worlds) {
|
||||
world->probe_resolution = LIGHT_PROBE_RESOLUTION_1024;
|
||||
}
|
||||
}
|
||||
|
||||
if (!DNA_struct_elem_find(fd->filesdna, "LightProbe", "float", "grid_surface_bias")) {
|
||||
if (!DNA_struct_member_exists(fd->filesdna, "LightProbe", "float", "grid_surface_bias")) {
|
||||
LISTBASE_FOREACH (LightProbe *, lightprobe, &bmain->lightprobes) {
|
||||
lightprobe->grid_surface_bias = 0.05f;
|
||||
lightprobe->grid_escape_bias = 0.1f;
|
||||
@@ -1091,7 +1091,8 @@ void blo_do_versions_400(FileData *fd, Library * /*lib*/, Main *bmain)
|
||||
}
|
||||
|
||||
if (!MAIN_VERSION_FILE_ATLEAST(bmain, 400, 14)) {
|
||||
if (!DNA_struct_elem_find(fd->filesdna, "SceneEEVEE", "RaytraceEEVEE", "reflection_options")) {
|
||||
if (!DNA_struct_member_exists(
|
||||
fd->filesdna, "SceneEEVEE", "RaytraceEEVEE", "reflection_options")) {
|
||||
LISTBASE_FOREACH (Scene *, scene, &bmain->scenes) {
|
||||
scene->eevee.reflection_options.flag = RAYTRACE_EEVEE_USE_DENOISE;
|
||||
scene->eevee.reflection_options.denoise_stages = RAYTRACE_EEVEE_DENOISE_SPATIAL |
|
||||
@@ -1109,7 +1110,7 @@ void blo_do_versions_400(FileData *fd, Library * /*lib*/, Main *bmain)
|
||||
}
|
||||
}
|
||||
|
||||
if (!DNA_struct_find(fd->filesdna, "RegionAssetShelf")) {
|
||||
if (!DNA_struct_exists(fd->filesdna, "RegionAssetShelf")) {
|
||||
LISTBASE_FOREACH (bScreen *, screen, &bmain->screens) {
|
||||
LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) {
|
||||
LISTBASE_FOREACH (SpaceLink *, sl, &area->spacedata) {
|
||||
@@ -1157,7 +1158,7 @@ void blo_do_versions_400(FileData *fd, Library * /*lib*/, Main *bmain)
|
||||
}
|
||||
|
||||
if (!MAIN_VERSION_FILE_ATLEAST(bmain, 400, 17)) {
|
||||
if (!DNA_struct_find(fd->filesdna, "NodeShaderHairPrincipled")) {
|
||||
if (!DNA_struct_exists(fd->filesdna, "NodeShaderHairPrincipled")) {
|
||||
FOREACH_NODETREE_BEGIN (bmain, ntree, id) {
|
||||
if (ntree->type == NTREE_SHADER) {
|
||||
version_replace_principled_hair_model(ntree);
|
||||
@@ -1167,7 +1168,7 @@ void blo_do_versions_400(FileData *fd, Library * /*lib*/, Main *bmain)
|
||||
}
|
||||
|
||||
/* Panorama properties shared with Eevee. */
|
||||
if (!DNA_struct_elem_find(fd->filesdna, "Camera", "float", "fisheye_fov")) {
|
||||
if (!DNA_struct_member_exists(fd->filesdna, "Camera", "float", "fisheye_fov")) {
|
||||
Camera default_cam = *DNA_struct_default_get(Camera);
|
||||
LISTBASE_FOREACH (Camera *, camera, &bmain->cameras) {
|
||||
IDProperty *ccam = version_cycles_properties_from_ID(&camera->id);
|
||||
@@ -1216,7 +1217,7 @@ void blo_do_versions_400(FileData *fd, Library * /*lib*/, Main *bmain)
|
||||
}
|
||||
}
|
||||
|
||||
if (!DNA_struct_elem_find(fd->filesdna, "LightProbe", "float", "grid_flag")) {
|
||||
if (!DNA_struct_member_exists(fd->filesdna, "LightProbe", "float", "grid_flag")) {
|
||||
LISTBASE_FOREACH (LightProbe *, lightprobe, &bmain->lightprobes) {
|
||||
/* Keep old behavior of baking the whole lighting. */
|
||||
lightprobe->grid_flag = LIGHTPROBE_GRID_CAPTURE_WORLD | LIGHTPROBE_GRID_CAPTURE_INDIRECT |
|
||||
@@ -1224,7 +1225,7 @@ void blo_do_versions_400(FileData *fd, Library * /*lib*/, Main *bmain)
|
||||
}
|
||||
}
|
||||
|
||||
if (!DNA_struct_elem_find(fd->filesdna, "SceneEEVEE", "int", "gi_irradiance_pool_size")) {
|
||||
if (!DNA_struct_member_exists(fd->filesdna, "SceneEEVEE", "int", "gi_irradiance_pool_size")) {
|
||||
LISTBASE_FOREACH (Scene *, scene, &bmain->scenes) {
|
||||
scene->eevee.gi_irradiance_pool_size = 16;
|
||||
}
|
||||
|
||||
@@ -745,7 +745,7 @@ static void writelist_id(WriteData *wd, int filecode, const char *structname, co
|
||||
const Link *link = lb->first;
|
||||
if (link) {
|
||||
|
||||
const int struct_nr = DNA_struct_find_nr(wd->sdna, structname);
|
||||
const int struct_nr = DNA_struct_find(wd->sdna, structname);
|
||||
if (struct_nr == -1) {
|
||||
printf("error: can't find SDNA code <%s>\n", structname);
|
||||
return;
|
||||
@@ -1745,7 +1745,7 @@ void blo_write_id_struct(BlendWriter *writer, int struct_id, const void *id_addr
|
||||
|
||||
int BLO_get_struct_id_by_name(BlendWriter *writer, const char *struct_name)
|
||||
{
|
||||
int struct_id = DNA_struct_find_nr(writer->wd->sdna, struct_name);
|
||||
int struct_id = DNA_struct_find(writer->wd->sdna, struct_name);
|
||||
return struct_id;
|
||||
}
|
||||
|
||||
|
||||
@@ -97,8 +97,8 @@ void DNA_reconstruct_info_free(struct DNA_ReconstructInfo *reconstruct_info);
|
||||
/**
|
||||
* Returns the index of the struct info for the struct with the specified name.
|
||||
*/
|
||||
int DNA_struct_find_nr_ex(const struct SDNA *sdna, const char *str, unsigned int *index_last);
|
||||
int DNA_struct_find_nr(const struct SDNA *sdna, const char *str);
|
||||
int DNA_struct_find_ex(const struct SDNA *sdna, const char *str, unsigned int *index_last);
|
||||
int DNA_struct_find(const struct SDNA *sdna, const char *str);
|
||||
/**
|
||||
* Does endian swapping on the fields of a struct value.
|
||||
*
|
||||
@@ -128,7 +128,10 @@ void *DNA_struct_reconstruct(const struct DNA_ReconstructInfo *reconstruct_info,
|
||||
* Returns the offset of the field with the specified name and type within the specified
|
||||
* struct type in #SDNA, -1 on failure.
|
||||
*/
|
||||
int DNA_elem_offset(struct SDNA *sdna, const char *stype, const char *vartype, const char *name);
|
||||
int DNA_struct_member_offset_by_name(struct SDNA *sdna,
|
||||
const char *stype,
|
||||
const char *vartype,
|
||||
const char *name);
|
||||
|
||||
/**
|
||||
* Returns the size of struct fields of the specified type and name.
|
||||
@@ -137,13 +140,13 @@ int DNA_elem_offset(struct SDNA *sdna, const char *stype, const char *vartype, c
|
||||
* \param name: Index into sdna->names,
|
||||
* needed to extract possible pointer/array information.
|
||||
*/
|
||||
int DNA_elem_size_nr(const struct SDNA *sdna, short type, short name);
|
||||
int DNA_struct_member_size(const struct SDNA *sdna, short type, short name);
|
||||
|
||||
bool DNA_struct_find(const struct SDNA *sdna, const char *stype);
|
||||
bool DNA_struct_elem_find(const struct SDNA *sdna,
|
||||
const char *stype,
|
||||
const char *vartype,
|
||||
const char *name);
|
||||
bool DNA_struct_exists(const struct SDNA *sdna, const char *stype);
|
||||
bool DNA_struct_member_exists(const struct SDNA *sdna,
|
||||
const char *stype,
|
||||
const char *vartype,
|
||||
const char *name);
|
||||
|
||||
/**
|
||||
* Returns the size in bytes of a primitive type.
|
||||
@@ -173,23 +176,21 @@ void DNA_sdna_alias_data_ensure(struct SDNA *sdna);
|
||||
/**
|
||||
* \note requires #DNA_sdna_alias_data_ensure_structs_map to be called.
|
||||
*/
|
||||
int DNA_struct_alias_find_nr_ex(const struct SDNA *sdna,
|
||||
const char *str,
|
||||
unsigned int *index_last);
|
||||
int DNA_struct_alias_find_ex(const struct SDNA *sdna, const char *str, unsigned int *index_last);
|
||||
/**
|
||||
* \note requires #DNA_sdna_alias_data_ensure_structs_map to be called.
|
||||
*/
|
||||
int DNA_struct_alias_find_nr(const struct SDNA *sdna, const char *str);
|
||||
int DNA_struct_alias_find(const struct SDNA *sdna, const char *str);
|
||||
/**
|
||||
* \note requires #DNA_sdna_alias_data_ensure_structs_map to be called.
|
||||
*/
|
||||
bool DNA_struct_alias_elem_find(const struct SDNA *sdna,
|
||||
const char *stype,
|
||||
const char *vartype,
|
||||
const char *name);
|
||||
bool DNA_struct_alias_member_exists(const struct SDNA *sdna,
|
||||
const char *stype,
|
||||
const char *vartype,
|
||||
const char *name);
|
||||
/**
|
||||
* Separated from #DNA_sdna_alias_data_ensure because it's not needed
|
||||
* unless we want to lookup aliased struct names (#DNA_struct_alias_find_nr and friends).
|
||||
* unless we want to lookup aliased struct names (#DNA_struct_alias_find and friends).
|
||||
*/
|
||||
void DNA_sdna_alias_data_ensure_structs_map(struct SDNA *sdna);
|
||||
|
||||
|
||||
@@ -69,7 +69,7 @@
|
||||
* **Remember to read/write integer and short aligned!**
|
||||
*
|
||||
* While writing a file, the names of a struct is indicated with a type number,
|
||||
* to be found with: `type = DNA_struct_find_nr(SDNA *, const char *)`
|
||||
* to be found with: `type = DNA_struct_find(SDNA *, const char *)`
|
||||
* The value of `type` corresponds with the index within the structs array
|
||||
*
|
||||
* For the moment: the complete DNA file is included in a .blend file. For
|
||||
@@ -162,7 +162,7 @@ static bool ispointer(const char *name)
|
||||
return (name[0] == '*' || (name[0] == '(' && name[1] == '*'));
|
||||
}
|
||||
|
||||
int DNA_elem_size_nr(const SDNA *sdna, short type, short name)
|
||||
int DNA_struct_member_size(const SDNA *sdna, short type, short name)
|
||||
{
|
||||
const char *cp = sdna->names[name];
|
||||
int len = 0;
|
||||
@@ -241,7 +241,7 @@ static int dna_struct_find_nr_ex_impl(
|
||||
return -1;
|
||||
}
|
||||
|
||||
int DNA_struct_find_nr_ex(const SDNA *sdna, const char *str, uint *index_last)
|
||||
int DNA_struct_find_ex(const SDNA *sdna, const char *str, uint *index_last)
|
||||
{
|
||||
return dna_struct_find_nr_ex_impl(
|
||||
/* Expand SDNA. */
|
||||
@@ -257,7 +257,7 @@ int DNA_struct_find_nr_ex(const SDNA *sdna, const char *str, uint *index_last)
|
||||
index_last);
|
||||
}
|
||||
|
||||
int DNA_struct_alias_find_nr_ex(const SDNA *sdna, const char *str, uint *index_last)
|
||||
int DNA_struct_alias_find_ex(const SDNA *sdna, const char *str, uint *index_last)
|
||||
{
|
||||
#ifdef WITH_DNA_GHASH
|
||||
BLI_assert(sdna->alias.structs_map != nullptr);
|
||||
@@ -276,16 +276,16 @@ int DNA_struct_alias_find_nr_ex(const SDNA *sdna, const char *str, uint *index_l
|
||||
index_last);
|
||||
}
|
||||
|
||||
int DNA_struct_find_nr(const SDNA *sdna, const char *str)
|
||||
int DNA_struct_find(const SDNA *sdna, const char *str)
|
||||
{
|
||||
uint index_last_dummy = UINT_MAX;
|
||||
return DNA_struct_find_nr_ex(sdna, str, &index_last_dummy);
|
||||
return DNA_struct_find_ex(sdna, str, &index_last_dummy);
|
||||
}
|
||||
|
||||
int DNA_struct_alias_find_nr(const SDNA *sdna, const char *str)
|
||||
int DNA_struct_alias_find(const SDNA *sdna, const char *str)
|
||||
{
|
||||
uint index_last_dummy = UINT_MAX;
|
||||
return DNA_struct_alias_find_nr_ex(sdna, str, &index_last_dummy);
|
||||
return DNA_struct_alias_find_ex(sdna, str, &index_last_dummy);
|
||||
}
|
||||
|
||||
/* ************************* END DIV ********************** */
|
||||
@@ -485,7 +485,7 @@ static bool init_structDNA(SDNA *sdna, bool do_endian_swap, const char **r_error
|
||||
|
||||
/* Calculate 'sdna->pointer_size' */
|
||||
{
|
||||
const int nr = DNA_struct_find_nr(sdna, "ListBase");
|
||||
const int nr = DNA_struct_find(sdna, "ListBase");
|
||||
|
||||
/* should never happen, only with corrupt file for example */
|
||||
if (UNLIKELY(nr == -1)) {
|
||||
@@ -599,7 +599,7 @@ static void set_compare_flags_for_struct(const SDNA *oldsdna,
|
||||
SDNA_Struct *old_struct = oldsdna->structs[old_struct_index];
|
||||
const char *struct_name = oldsdna->types[old_struct->type];
|
||||
|
||||
const int new_struct_index = DNA_struct_find_nr(newsdna, struct_name);
|
||||
const int new_struct_index = DNA_struct_find(newsdna, struct_name);
|
||||
if (new_struct_index == -1) {
|
||||
/* Didn't find a matching new struct, so it has been removed. */
|
||||
compare_flags[old_struct_index] = SDNA_CMP_REMOVED;
|
||||
@@ -648,7 +648,7 @@ static void set_compare_flags_for_struct(const SDNA *oldsdna,
|
||||
}
|
||||
}
|
||||
else {
|
||||
const int old_member_struct_index = DNA_struct_find_nr(oldsdna, old_type_name);
|
||||
const int old_member_struct_index = DNA_struct_find(oldsdna, old_type_name);
|
||||
if (old_member_struct_index >= 0) {
|
||||
set_compare_flags_for_struct(oldsdna, newsdna, compare_flags, old_member_struct_index);
|
||||
if (compare_flags[old_member_struct_index] != SDNA_CMP_EQUAL) {
|
||||
@@ -972,7 +972,7 @@ static int elem_offset(const SDNA *sdna,
|
||||
}
|
||||
break; /* Fail below. */
|
||||
}
|
||||
offset += DNA_elem_size_nr(sdna, member->type, member->name);
|
||||
offset += DNA_struct_member_size(sdna, member->type, member->name);
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
@@ -992,7 +992,7 @@ static eStructMemberCategory get_struct_member_category(const SDNA *sdna,
|
||||
return STRUCT_MEMBER_CATEGORY_POINTER;
|
||||
}
|
||||
const char *member_type_name = sdna->types[member->type];
|
||||
if (DNA_struct_find(sdna, member_type_name)) {
|
||||
if (DNA_struct_exists(sdna, member_type_name)) {
|
||||
return STRUCT_MEMBER_CATEGORY_STRUCT;
|
||||
}
|
||||
return STRUCT_MEMBER_CATEGORY_PRIMITIVE;
|
||||
@@ -1028,7 +1028,7 @@ void DNA_struct_switch_endian(const SDNA *sdna, int struct_nr, char *data)
|
||||
switch (member_category) {
|
||||
case STRUCT_MEMBER_CATEGORY_STRUCT: {
|
||||
const int substruct_size = sdna->types_size[member->type];
|
||||
const int substruct_nr = DNA_struct_find_nr(sdna, member_type_name);
|
||||
const int substruct_nr = DNA_struct_find(sdna, member_type_name);
|
||||
BLI_assert(substruct_nr != -1);
|
||||
for (int a = 0; a < member_array_length; a++) {
|
||||
DNA_struct_switch_endian(sdna, substruct_nr, member_data + a * substruct_size);
|
||||
@@ -1224,7 +1224,7 @@ void *DNA_struct_reconstruct(const DNA_ReconstructInfo *reconstruct_info,
|
||||
|
||||
const SDNA_Struct *old_struct = oldsdna->structs[old_struct_nr];
|
||||
const char *type_name = oldsdna->types[old_struct->type];
|
||||
const int new_struct_nr = DNA_struct_find_nr(newsdna, type_name);
|
||||
const int new_struct_nr = DNA_struct_find(newsdna, type_name);
|
||||
|
||||
if (new_struct_nr == -1) {
|
||||
return nullptr;
|
||||
@@ -1305,7 +1305,7 @@ static void init_reconstruct_step_for_member(const SDNA *oldsdna,
|
||||
switch (new_category) {
|
||||
case STRUCT_MEMBER_CATEGORY_STRUCT: {
|
||||
if (STREQ(new_type_name, old_type_name)) {
|
||||
const int old_struct_nr = DNA_struct_find_nr(oldsdna, old_type_name);
|
||||
const int old_struct_nr = DNA_struct_find(oldsdna, old_type_name);
|
||||
BLI_assert(old_struct_nr != -1);
|
||||
enum eSDNA_StructCompare compare_flag = eSDNA_StructCompare(compare_flags[old_struct_nr]);
|
||||
BLI_assert(compare_flag != SDNA_CMP_REMOVED);
|
||||
@@ -1317,7 +1317,7 @@ static void init_reconstruct_step_for_member(const SDNA *oldsdna,
|
||||
r_step->data.memcpy.size = newsdna->types_size[new_member->type] * shared_array_length;
|
||||
}
|
||||
else {
|
||||
const int new_struct_nr = DNA_struct_find_nr(newsdna, new_type_name);
|
||||
const int new_struct_nr = DNA_struct_find(newsdna, new_type_name);
|
||||
BLI_assert(new_struct_nr != -1);
|
||||
|
||||
/* The old and new members are different, use recursion to reconstruct the
|
||||
@@ -1536,7 +1536,7 @@ DNA_ReconstructInfo *DNA_reconstruct_info_create(const SDNA *oldsdna,
|
||||
for (int new_struct_nr = 0; new_struct_nr < newsdna->structs_len; new_struct_nr++) {
|
||||
const SDNA_Struct *new_struct = newsdna->structs[new_struct_nr];
|
||||
const char *new_struct_name = newsdna->types[new_struct->type];
|
||||
const int old_struct_nr = DNA_struct_find_nr(oldsdna, new_struct_name);
|
||||
const int old_struct_nr = DNA_struct_find(oldsdna, new_struct_name);
|
||||
if (old_struct_nr < 0) {
|
||||
reconstruct_info->steps[new_struct_nr] = nullptr;
|
||||
reconstruct_info->step_counts[new_struct_nr] = 0;
|
||||
@@ -1578,25 +1578,28 @@ void DNA_reconstruct_info_free(DNA_ReconstructInfo *reconstruct_info)
|
||||
MEM_freeN(reconstruct_info);
|
||||
}
|
||||
|
||||
int DNA_elem_offset(SDNA *sdna, const char *stype, const char *vartype, const char *name)
|
||||
int DNA_struct_member_offset_by_name(SDNA *sdna,
|
||||
const char *stype,
|
||||
const char *vartype,
|
||||
const char *name)
|
||||
{
|
||||
const int SDNAnr = DNA_struct_find_nr(sdna, stype);
|
||||
const int SDNAnr = DNA_struct_find(sdna, stype);
|
||||
BLI_assert(SDNAnr != -1);
|
||||
const SDNA_Struct *const spo = sdna->structs[SDNAnr];
|
||||
return elem_offset(sdna, vartype, name, spo);
|
||||
}
|
||||
|
||||
bool DNA_struct_find(const SDNA *sdna, const char *stype)
|
||||
bool DNA_struct_exists(const SDNA *sdna, const char *stype)
|
||||
{
|
||||
return DNA_struct_find_nr(sdna, stype) != -1;
|
||||
return DNA_struct_find(sdna, stype) != -1;
|
||||
}
|
||||
|
||||
bool DNA_struct_elem_find(const SDNA *sdna,
|
||||
const char *stype,
|
||||
const char *vartype,
|
||||
const char *name)
|
||||
bool DNA_struct_member_exists(const SDNA *sdna,
|
||||
const char *stype,
|
||||
const char *vartype,
|
||||
const char *name)
|
||||
{
|
||||
const int SDNAnr = DNA_struct_find_nr(sdna, stype);
|
||||
const int SDNAnr = DNA_struct_find(sdna, stype);
|
||||
|
||||
if (SDNAnr != -1) {
|
||||
const SDNA_Struct *const spo = sdna->structs[SDNAnr];
|
||||
@@ -1609,12 +1612,12 @@ bool DNA_struct_elem_find(const SDNA *sdna,
|
||||
return false;
|
||||
}
|
||||
|
||||
bool DNA_struct_alias_elem_find(const SDNA *sdna,
|
||||
const char *stype,
|
||||
const char *vartype,
|
||||
const char *name)
|
||||
bool DNA_struct_alias_member_exists(const SDNA *sdna,
|
||||
const char *stype,
|
||||
const char *vartype,
|
||||
const char *name)
|
||||
{
|
||||
const int SDNAnr = DNA_struct_alias_find_nr(sdna, stype);
|
||||
const int SDNAnr = DNA_struct_alias_find(sdna, stype);
|
||||
|
||||
if (SDNAnr != -1) {
|
||||
const SDNA_Struct *const spo = sdna->structs[SDNAnr];
|
||||
@@ -1659,7 +1662,7 @@ static bool DNA_sdna_patch_struct_nr(SDNA *sdna,
|
||||
const int struct_name_old_nr,
|
||||
const char *struct_name_new)
|
||||
{
|
||||
BLI_assert(DNA_struct_find_nr(DNA_sdna_current_get(), struct_name_new) != -1);
|
||||
BLI_assert(DNA_struct_find(DNA_sdna_current_get(), struct_name_new) != -1);
|
||||
const SDNA_Struct *struct_info = sdna->structs[struct_name_old_nr];
|
||||
#ifdef WITH_DNA_GHASH
|
||||
BLI_ghash_remove(sdna->structs_map, (void *)sdna->types[struct_info->type], nullptr, nullptr);
|
||||
@@ -1671,7 +1674,7 @@ static bool DNA_sdna_patch_struct_nr(SDNA *sdna,
|
||||
}
|
||||
bool DNA_sdna_patch_struct(SDNA *sdna, const char *struct_name_old, const char *struct_name_new)
|
||||
{
|
||||
const int struct_name_old_nr = DNA_struct_find_nr(sdna, struct_name_old);
|
||||
const int struct_name_old_nr = DNA_struct_find(sdna, struct_name_old);
|
||||
if (struct_name_old_nr != -1) {
|
||||
return DNA_sdna_patch_struct_nr(sdna, struct_name_old_nr, struct_name_new);
|
||||
}
|
||||
@@ -1732,7 +1735,7 @@ bool DNA_sdna_patch_struct_member(SDNA *sdna,
|
||||
const char *elem_old,
|
||||
const char *elem_new)
|
||||
{
|
||||
const int struct_name_nr = DNA_struct_find_nr(sdna, struct_name);
|
||||
const int struct_name_nr = DNA_struct_find(sdna, struct_name);
|
||||
if (struct_name_nr != -1) {
|
||||
return DNA_sdna_patch_struct_member_nr(sdna, struct_name_nr, elem_old, elem_new);
|
||||
}
|
||||
|
||||
@@ -364,7 +364,7 @@ static int add_name(const char *str)
|
||||
/* We handle function pointer and special array cases here, e.g.
|
||||
* `void (*function)(...)` and `float (*array)[..]`. the array case
|
||||
* name is still converted to (array *)() though because it is that
|
||||
* way in old DNA too, and works correct with #DNA_elem_size_nr. */
|
||||
* way in old DNA too, and works correct with #DNA_struct_member_size. */
|
||||
int isfuncptr = (strchr(str + 1, '(')) != nullptr;
|
||||
|
||||
DEBUG_PRINTF(3, "\t\t\t\t*** Function pointer or multidim array pointer found\n");
|
||||
|
||||
@@ -212,7 +212,7 @@ static int DNA_struct_find_nr_wrapper(const SDNA *sdna, const char *struct_name)
|
||||
struct_name = static_cast<const char *>(BLI_ghash_lookup_default(
|
||||
g_version_data.struct_map_static_from_alias, struct_name, (void *)struct_name));
|
||||
#endif
|
||||
return DNA_struct_find_nr(sdna, struct_name);
|
||||
return DNA_struct_find(sdna, struct_name);
|
||||
}
|
||||
|
||||
StructDefRNA *rna_find_struct_def(StructRNA *srna)
|
||||
@@ -461,7 +461,7 @@ static int rna_find_sdna_member(SDNA *sdna,
|
||||
const SDNA_Struct *struct_info = sdna->structs[structnr];
|
||||
for (int a = 0; a < struct_info->members_len; a++) {
|
||||
const SDNA_StructMember *member = &struct_info->members[a];
|
||||
const int size = DNA_elem_size_nr(sdna, member->type, member->name);
|
||||
const int size = DNA_struct_member_size(sdna, member->type, member->name);
|
||||
dnaname = sdna->alias.names[member->name];
|
||||
cmp = rna_member_cmp(dnaname, membername);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user