Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/blenloader/intern')
-rw-r--r--source/blender/blenloader/intern/blend_validate.c15
-rw-r--r--source/blender/blenloader/intern/readfile.c22
-rw-r--r--source/blender/blenloader/intern/versioning_250.c2
-rw-r--r--source/blender/blenloader/intern/versioning_300.c15
-rw-r--r--source/blender/blenloader/intern/versioning_common.cc2
-rw-r--r--source/blender/blenloader/intern/versioning_legacy.c2
-rw-r--r--source/blender/blenloader/intern/versioning_userdef.c54
-rw-r--r--source/blender/blenloader/intern/writefile.c18
8 files changed, 109 insertions, 21 deletions
diff --git a/source/blender/blenloader/intern/blend_validate.c b/source/blender/blenloader/intern/blend_validate.c
index 10150f56098..e1527201e22 100644
--- a/source/blender/blenloader/intern/blend_validate.c
+++ b/source/blender/blenloader/intern/blend_validate.c
@@ -181,5 +181,20 @@ bool BLO_main_validate_shapekeys(Main *bmain, ReportList *reports)
BKE_main_unlock(bmain);
+ /* NOTE: #BKE_id_delete also locks `bmain`, so we need to do this loop outside of the lock here.
+ */
+ LISTBASE_FOREACH_MUTABLE (Key *, shapekey, &bmain->shapekeys) {
+ if (shapekey->from != NULL) {
+ continue;
+ }
+
+ BKE_reportf(reports,
+ RPT_ERROR,
+ "Shapekey %s has an invalid 'from' pointer (%p), it will be deleted",
+ shapekey->id.name,
+ shapekey->from);
+ BKE_id_delete(bmain, shapekey);
+ }
+
return is_valid;
}
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c
index 84625fea6fc..9539436cf69 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -320,15 +320,22 @@ static void oldnewmap_increase_size(OldNewMap *onm)
/* Public OldNewMap API */
-static OldNewMap *oldnewmap_new(void)
+static void oldnewmap_init_data(OldNewMap *onm, const int capacity_exp)
{
- OldNewMap *onm = MEM_callocN(sizeof(*onm), "OldNewMap");
+ memset(onm, 0x0, sizeof(*onm));
- onm->capacity_exp = DEFAULT_SIZE_EXP;
+ onm->capacity_exp = capacity_exp;
onm->entries = MEM_malloc_arrayN(
ENTRIES_CAPACITY(onm), sizeof(*onm->entries), "OldNewMap.entries");
onm->map = MEM_malloc_arrayN(MAP_CAPACITY(onm), sizeof(*onm->map), "OldNewMap.map");
oldnewmap_clear_map(onm);
+}
+
+static OldNewMap *oldnewmap_new(void)
+{
+ OldNewMap *onm = MEM_mallocN(sizeof(*onm), "OldNewMap");
+
+ oldnewmap_init_data(onm, DEFAULT_SIZE_EXP);
return onm;
}
@@ -395,9 +402,10 @@ static void oldnewmap_clear(OldNewMap *onm)
}
}
- onm->capacity_exp = DEFAULT_SIZE_EXP;
- oldnewmap_clear_map(onm);
- onm->nentries = 0;
+ MEM_freeN(onm->entries);
+ MEM_freeN(onm->map);
+
+ oldnewmap_init_data(onm, DEFAULT_SIZE_EXP);
}
static void oldnewmap_free(OldNewMap *onm)
@@ -2913,7 +2921,7 @@ static const char *dataname(short id_code)
return "Data from MA";
case ID_TE:
return "Data from TE";
- case ID_CU:
+ case ID_CU_LEGACY:
return "Data from CU";
case ID_GR:
return "Data from GR";
diff --git a/source/blender/blenloader/intern/versioning_250.c b/source/blender/blenloader/intern/versioning_250.c
index 6bf3402eafe..ac59e3efc72 100644
--- a/source/blender/blenloader/intern/versioning_250.c
+++ b/source/blender/blenloader/intern/versioning_250.c
@@ -1644,7 +1644,7 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
BLI_addtail((ListBase *)&ob->modifiers, lmd);
ob->partype = PAROBJECT;
}
- else if (parent->type == OB_CURVE && ob->partype == PARCURVE) {
+ else if (parent->type == OB_CURVES_LEGACY && ob->partype == PARCURVE) {
CurveModifierData *cmd;
cmd = (CurveModifierData *)BKE_modifier_new(eModifierType_Curve);
diff --git a/source/blender/blenloader/intern/versioning_300.c b/source/blender/blenloader/intern/versioning_300.c
index f14029d6555..2a840ea585a 100644
--- a/source/blender/blenloader/intern/versioning_300.c
+++ b/source/blender/blenloader/intern/versioning_300.c
@@ -2544,6 +2544,21 @@ void blo_do_versions_300(FileData *fd, Library *UNUSED(lib), Main *bmain)
}
}
+ if (!MAIN_VERSION_ATLEAST(bmain, 301, 7) ||
+ (bmain->versionfile == 302 && !MAIN_VERSION_ATLEAST(bmain, 302, 4))) {
+ /* Duplicate value for two flags that mistakenly had the same numeric value. */
+ LISTBASE_FOREACH (Object *, ob, &bmain->objects) {
+ LISTBASE_FOREACH (ModifierData *, md, &ob->modifiers) {
+ if (md->type == eModifierType_WeightVGProximity) {
+ WeightVGProximityModifierData *wpmd = (WeightVGProximityModifierData *)md;
+ if (wpmd->proximity_flags & MOD_WVG_PROXIMITY_INVERT_VGROUP_MASK) {
+ wpmd->proximity_flags |= MOD_WVG_PROXIMITY_WEIGHTS_NORMALIZE;
+ }
+ }
+ }
+ }
+ }
+
if (!MAIN_VERSION_ATLEAST(bmain, 302, 2)) {
LISTBASE_FOREACH (Scene *, scene, &bmain->scenes) {
if (scene->ed != NULL) {
diff --git a/source/blender/blenloader/intern/versioning_common.cc b/source/blender/blenloader/intern/versioning_common.cc
index 6aac76642d5..281769410bd 100644
--- a/source/blender/blenloader/intern/versioning_common.cc
+++ b/source/blender/blenloader/intern/versioning_common.cc
@@ -56,7 +56,7 @@ ID *do_versions_rename_id(Main *bmain,
ListBase *lb = which_libbase(bmain, id_type);
ID *id = nullptr;
LISTBASE_FOREACH (ID *, idtest, lb) {
- if (idtest->lib == nullptr) {
+ if (!ID_IS_LINKED(idtest)) {
if (STREQ(idtest->name + 2, name_src)) {
id = idtest;
}
diff --git a/source/blender/blenloader/intern/versioning_legacy.c b/source/blender/blenloader/intern/versioning_legacy.c
index cd4efa95d5e..2908b2b151b 100644
--- a/source/blender/blenloader/intern/versioning_legacy.c
+++ b/source/blender/blenloader/intern/versioning_legacy.c
@@ -1356,7 +1356,7 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
bFollowPathConstraint *data = con->data;
Object *obc = blo_do_versions_newlibadr(fd, lib, data->tar);
- if (obc && obc->type == OB_CURVE) {
+ if (obc && obc->type == OB_CURVES_LEGACY) {
Curve *cu = blo_do_versions_newlibadr(fd, lib, obc->data);
if (cu) {
cu->flag |= CU_PATH;
diff --git a/source/blender/blenloader/intern/versioning_userdef.c b/source/blender/blenloader/intern/versioning_userdef.c
index 8685a0fa62d..e933964221b 100644
--- a/source/blender/blenloader/intern/versioning_userdef.c
+++ b/source/blender/blenloader/intern/versioning_userdef.c
@@ -33,6 +33,7 @@
#include "readfile.h" /* Own include. */
+#include "WM_types.h"
#include "wm_event_types.h"
/* Don't use translation strings in versioning!
@@ -363,10 +364,12 @@ static void do_version_select_mouse(UserDef *userdef, wmKeyMapItem *kmi)
kmi->type = (left) ? RIGHTMOUSE : LEFTMOUSE;
break;
case EVT_TWEAK_S:
- kmi->type = (left) ? EVT_TWEAK_L : EVT_TWEAK_R;
+ kmi->type = (left) ? LEFTMOUSE : RIGHTMOUSE;
+ kmi->val = KM_CLICK_DRAG;
break;
case EVT_TWEAK_A:
- kmi->type = (left) ? EVT_TWEAK_R : EVT_TWEAK_L;
+ kmi->type = (left) ? RIGHTMOUSE : LEFTMOUSE;
+ kmi->val = KM_CLICK_DRAG;
break;
default:
break;
@@ -385,6 +388,39 @@ static bool keymap_item_has_invalid_wm_context_data_path(wmKeyMapItem *kmi,
return false;
}
+static bool keymap_item_update_tweak_event(wmKeyMapItem *kmi, void *UNUSED(user_data))
+{
+ /* Tweak events for L M R mouse-buttons. */
+ enum {
+ EVT_TWEAK_L = 0x5002,
+ EVT_TWEAK_M = 0x5003,
+ EVT_TWEAK_R = 0x5004,
+ };
+ switch (kmi->type) {
+ case EVT_TWEAK_L:
+ kmi->type = LEFTMOUSE;
+ break;
+ case EVT_TWEAK_M:
+ kmi->type = MIDDLEMOUSE;
+ break;
+ case EVT_TWEAK_R:
+ kmi->type = RIGHTMOUSE;
+ break;
+ default:
+ kmi->direction = KM_ANY;
+ return false;
+ }
+
+ if (kmi->val >= KM_DIRECTION_N && kmi->val <= KM_DIRECTION_NW) {
+ kmi->direction = kmi->val;
+ }
+ else {
+ kmi->direction = KM_ANY;
+ }
+ kmi->val = KM_CLICK_DRAG;
+ return false;
+}
+
void blo_do_versions_userdef(UserDef *userdef)
{
/* #UserDef & #Main happen to have the same struct member. */
@@ -948,6 +984,20 @@ void blo_do_versions_userdef(UserDef *userdef)
}
}
+ if (!USER_VERSION_ATLEAST(300, 43)) {
+ userdef->ndof_flag |= NDOF_CAMERA_PAN_ZOOM;
+ }
+
+ if (!USER_VERSION_ATLEAST(302, 5)) {
+ BKE_keyconfig_pref_filter_items(userdef,
+ &((struct wmKeyConfigFilterItemParams){
+ .check_item = true,
+ .check_diff_item_add = true,
+ }),
+ keymap_item_update_tweak_event,
+ NULL);
+ }
+
/**
* Versioning code until next subversion bump goes here.
*
diff --git a/source/blender/blenloader/intern/writefile.c b/source/blender/blenloader/intern/writefile.c
index 495054923f9..490328106ca 100644
--- a/source/blender/blenloader/intern/writefile.c
+++ b/source/blender/blenloader/intern/writefile.c
@@ -580,7 +580,7 @@ static WriteData *mywrite_begin(WriteWrap *ww, MemFile *compare, MemFile *curren
/**
* END the mywrite wrapper
- * \return 1 if write failed
+ * \return True if write failed
* \return unknown global variable otherwise
* \warning Talks to other functions with global parameters
*/
@@ -1256,12 +1256,12 @@ static bool do_history(const char *name, ReportList *reports)
int hisnr = U.versions;
if (U.versions == 0) {
- return 0;
+ return false;
}
if (strlen(name) < 2) {
BKE_report(reports, RPT_ERROR, "Unable to make version backup: filename too short");
- return 1;
+ return true;
}
while (hisnr > 1) {
@@ -1287,7 +1287,7 @@ static bool do_history(const char *name, ReportList *reports)
}
}
- return 0;
+ return false;
}
/** \} */
@@ -1334,7 +1334,7 @@ bool BLO_write_file(Main *mainvar,
if (ww.open(&ww, tempname) == false) {
BKE_reportf(
reports, RPT_ERROR, "Cannot open file %s for writing: %s", tempname, strerror(errno));
- return 0;
+ return false;
}
if (remap_mode == BLO_WRITE_PATH_REMAP_ABSOLUTE) {
@@ -1426,7 +1426,7 @@ bool BLO_write_file(Main *mainvar,
BKE_report(reports, RPT_ERROR, strerror(errno));
remove(tempname);
- return 0;
+ return false;
}
/* file save to temporary file was successful */
@@ -1435,13 +1435,13 @@ bool BLO_write_file(Main *mainvar,
const bool err_hist = do_history(filepath, reports);
if (err_hist) {
BKE_report(reports, RPT_ERROR, "Version backup failed (file saved with @)");
- return 0;
+ return false;
}
}
if (BLI_rename(tempname, filepath) != 0) {
BKE_report(reports, RPT_ERROR, "Cannot change old file (file saved with @)");
- return 0;
+ return false;
}
if (G.debug & G_DEBUG_IO && mainvar->lock != NULL) {
@@ -1449,7 +1449,7 @@ bool BLO_write_file(Main *mainvar,
BLO_main_validate_libraries(mainvar, reports);
}
- return 1;
+ return true;
}
bool BLO_write_file_mem(Main *mainvar, MemFile *compare, MemFile *current, int write_flags)