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:
authorHans Goudey <h.goudey@me.com>2021-04-26 05:45:33 +0300
committerHans Goudey <h.goudey@me.com>2021-04-26 05:45:33 +0300
commit149078d580cffbfba51eaf62e23b97933a826256 (patch)
treed083452898a94b3cc3c273c7df92d84fc62926c8
parent47b1f9a4d36c67604e2ade584594b356dfdebffd (diff)
parent36c4b79c303e9337b759736b7398c563939c908e (diff)
Merge branch 'master' into geometry-nodes-curve-support
-rw-r--r--source/blender/editors/screen/screen_ops.c75
-rw-r--r--source/blender/editors/space_node/node_edit.c4
-rw-r--r--source/blender/makesrna/intern/rna_userdef.c2
3 files changed, 28 insertions, 53 deletions
diff --git a/source/blender/editors/screen/screen_ops.c b/source/blender/editors/screen/screen_ops.c
index cc920aece0a..5b371ed2caa 100644
--- a/source/blender/editors/screen/screen_ops.c
+++ b/source/blender/editors/screen/screen_ops.c
@@ -3262,8 +3262,9 @@ static void SCREEN_OT_screen_full_area(wmOperatorType *ot)
*/
typedef struct sAreaJoinData {
- ScrArea *sa1; /* first area to be considered */
- ScrArea *sa2; /* second area to be considered */
+ ScrArea *sa1; /* Potential source area (kept). */
+ ScrArea *sa2; /* Potential target area (removed or reduced). */
+ int dir; /* Direction of potential join. */
void *draw_callback; /* call 'ED_screen_draw_join_highlight' */
} sAreaJoinData;
@@ -3273,7 +3274,7 @@ static void area_join_draw_cb(const struct wmWindow *UNUSED(win), void *userdata
const wmOperator *op = userdata;
sAreaJoinData *sd = op->customdata;
- if (sd->sa1 && sd->sa2) {
+ if (sd->sa1 && sd->sa2 && (sd->dir != -1)) {
ED_screen_draw_join_highlight(sd->sa1, sd->sa2);
}
}
@@ -3296,6 +3297,7 @@ static bool area_join_init(bContext *C, wmOperator *op, ScrArea *sa1, ScrArea *s
jd->sa1 = sa1;
jd->sa2 = sa2;
+ jd->dir = -1;
op->customdata = jd;
@@ -3308,7 +3310,7 @@ static bool area_join_init(bContext *C, wmOperator *op, ScrArea *sa1, ScrArea *s
static bool area_join_apply(bContext *C, wmOperator *op)
{
sAreaJoinData *jd = (sAreaJoinData *)op->customdata;
- if (!jd) {
+ if (!jd || (jd->dir == -1)) {
return false;
}
@@ -3410,61 +3412,30 @@ static int area_join_modal(bContext *C, wmOperator *op, const wmEvent *event)
case MOUSEMOVE: {
ScrArea *area = BKE_screen_find_area_xy(screen, SPACE_TYPE_ANY, event->x, event->y);
- int dir = -1;
+ jd->dir = area_getorientation(jd->sa1, jd->sa2);
- if (area) {
- if (jd->sa1 != area) {
- dir = area_getorientation(jd->sa1, area);
- if (dir != -1) {
- jd->sa2 = area;
- }
- else {
- /* we are not bordering on the previously selected area
- * we check if area has common border with the one marked for removal
- * in this case we can swap areas.
- */
- dir = area_getorientation(area, jd->sa2);
- if (dir != -1) {
- jd->sa1 = jd->sa2;
- jd->sa2 = area;
- }
- else {
- jd->sa2 = NULL;
- }
- }
- WM_event_add_notifier(C, NC_WINDOW, NULL);
- }
- else {
- /* we are back in the area previously selected for keeping
- * we swap the areas if possible to allow user to choose */
- if (jd->sa2 != NULL) {
- jd->sa1 = jd->sa2;
- jd->sa2 = area;
- dir = area_getorientation(jd->sa1, jd->sa2);
- if (dir == -1) {
- printf("oops, didn't expect that!\n");
- }
- }
- else {
- dir = area_getorientation(jd->sa1, area);
- if (dir != -1) {
- jd->sa2 = area;
- }
- }
- WM_event_add_notifier(C, NC_WINDOW, NULL);
- }
+ if (area == jd->sa1) {
+ /* Hovering current source, so change direction. */
+ jd->sa1 = jd->sa2;
+ jd->sa2 = area;
+ jd->dir = area_getorientation(jd->sa1, jd->sa2);
}
+ else if (area != jd->sa2) {
+ jd->dir = -1;
+ }
+
+ WM_event_add_notifier(C, NC_WINDOW, NULL);
- if (dir == 1) {
+ if (jd->dir == 1) {
WM_cursor_set(win, WM_CURSOR_N_ARROW);
}
- else if (dir == 3) {
+ else if (jd->dir == 3) {
WM_cursor_set(win, WM_CURSOR_S_ARROW);
}
- else if (dir == 2) {
+ else if (jd->dir == 2) {
WM_cursor_set(win, WM_CURSOR_E_ARROW);
}
- else if (dir == 0) {
+ else if (jd->dir == 0) {
WM_cursor_set(win, WM_CURSOR_W_ARROW);
}
else {
@@ -3475,6 +3446,10 @@ static int area_join_modal(bContext *C, wmOperator *op, const wmEvent *event)
}
case LEFTMOUSE:
if (event->val == KM_RELEASE) {
+ if (jd->dir == -1) {
+ area_join_cancel(C, op);
+ return OPERATOR_CANCELLED;
+ }
ED_area_tag_redraw(jd->sa1);
ED_area_tag_redraw(jd->sa2);
diff --git a/source/blender/editors/space_node/node_edit.c b/source/blender/editors/space_node/node_edit.c
index 7282ed4b667..d4780534a83 100644
--- a/source/blender/editors/space_node/node_edit.c
+++ b/source/blender/editors/space_node/node_edit.c
@@ -1136,8 +1136,8 @@ static bool cursor_isect_multi_input_socket(const float cursor[2], const bNodeSo
* But keep it smaller because for multi-input socket you
* sometimes want to drag the link to the other side, if you may
* accidentally pick the wrong link otherwise. */
- .ymin = socket->locy - node_socket_height * 0.5 - NODE_SOCKSIZE,
- .ymax = socket->locy + node_socket_height * 0.5 + NODE_SOCKSIZE,
+ .ymin = socket->locy - node_socket_height,
+ .ymax = socket->locy + node_socket_height,
};
if (BLI_rctf_isect_pt(&multi_socket_rect, cursor[0], cursor[1])) {
return true;
diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c
index 26887b51f81..bacd3943141 100644
--- a/source/blender/makesrna/intern/rna_userdef.c
+++ b/source/blender/makesrna/intern/rna_userdef.c
@@ -6160,7 +6160,7 @@ static void rna_def_userdef_filepaths(BlenderRNA *brna)
prop,
"Python Scripts Directory",
"Alternate script path, matching the default layout with subdirectories: "
- "startup, add-ons and modules (requires restart)");
+ "startup, addons, modules, and presets (requires restart)");
/* TODO, editing should reset sys.path! */
prop = RNA_def_property(srna, "i18n_branches_directory", PROP_STRING, PROP_DIRPATH);