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:
authorJoseph Eagar <joeedh@gmail.com>2022-03-07 11:17:59 +0300
committerJoseph Eagar <joeedh@gmail.com>2022-03-07 11:17:59 +0300
commitba410bb416b931fb09698810f2eabbe882220389 (patch)
tree7105657c4ccc6237d3ef752822b74f6f6344a5af /source/blender/blenloader
parent011fca7f7672bebf71fc2efc82c734863f508057 (diff)
parentad2948face07abdfb11e236f7f4db08c5dbcac5a (diff)
Merge branch 'master' into temp-sculpt-colors
Diffstat (limited to 'source/blender/blenloader')
-rw-r--r--source/blender/blenloader/intern/versioning_250.c2
-rw-r--r--source/blender/blenloader/intern/versioning_userdef.c51
-rw-r--r--source/blender/blenloader/intern/writefile.c18
3 files changed, 59 insertions, 12 deletions
diff --git a/source/blender/blenloader/intern/versioning_250.c b/source/blender/blenloader/intern/versioning_250.c
index ac59e3efc72..67b6ad25d8b 100644
--- a/source/blender/blenloader/intern/versioning_250.c
+++ b/source/blender/blenloader/intern/versioning_250.c
@@ -1723,7 +1723,7 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
brush->crease_pinch_factor = 0.5f;
}
- /* will sculpt no vertexes */
+ /* will sculpt no vertices */
if (brush->plane_trim == 0) {
brush->plane_trim = 0.5f;
}
diff --git a/source/blender/blenloader/intern/versioning_userdef.c b/source/blender/blenloader/intern/versioning_userdef.c
index 10160e9aadc..3b966fe5358 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,40 @@ static bool keymap_item_has_invalid_wm_context_data_path(wmKeyMapItem *kmi,
return false;
}
+/** Tweak event types have been removed, replace with click-drag. */
+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. */
@@ -952,6 +989,16 @@ void blo_do_versions_userdef(UserDef *userdef)
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)