Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Middle Mouse Drag to Edit Values #1362

Merged
merged 5 commits into from Nov 20, 2017
Merged

Middle Mouse Drag to Edit Values #1362

merged 5 commits into from Nov 20, 2017

Conversation

ghost
Copy link

@ghost ghost commented Aug 1, 2017

This is for #595

This does a number of changes:

  • All value fields can be middle click and dragged to change their value.
  • All value fields in the tool option bar that don't have a slider can have their label left-clicked on and dragged to change the value.
  • The function editor spreadsheet values can be ctrl + clicked and dragged to change their value. (This also works on empty cells in columns that already have at least one key. This is handy for quickly setting keys.)
  • Alt + click on a key in the function editor will clear they key.

I was torn on using middle mouse for everything except the function editor. I wanted the commands to be the same everywhere. The benefit of middle mouse is that it doesn't require two hands and a tablet pen button can often be set to middle mouse - making it useful for tablet users. However, middle mouse can't be used on the function editor, since it will pan the spreadsheet and that is useful functionality.

Because of this I opted for different commands for the function editor and all other value fields- trying to do what is most convenient for users. ( I realize that remembering two commands isn't convenient, but regularly using two hands for a command isn't also.)

I personally am most excited about the function editor commands as they seem to make adjusting key values and setting/clearing keys a breeze.

@blurymind
Copy link

blurymind commented Aug 1, 2017 via email

@artisteacher
Copy link
Contributor

I'm really excited to have this functionality. I do wish it was left-click and drag like Blender and Krita. I almost always just use a touchpad and am not sure it is possible to middle click and drag on a touchpad.

@blurymind
Copy link

blurymind commented Aug 1, 2017 via email

@artisteacher
Copy link
Contributor

If left-click and drag isn't possible, scrolling would be a great solution. The addition of shift for more precision is a good idea.

@blurymind
Copy link

blurymind commented Aug 1, 2017

@turtleTooth it doesnt have to use labels. Click dragging on input boxes actually makes a lot sense imo

scrolling will be even better, as it is not constrained to the dimensions of the screen/tablet

@ghost
Copy link
Author

ghost commented Aug 2, 2017

Question about the function editor- I currently have it so you can ctrl+click and drag on a value in the function editor spreadsheet to change the value. (This can be used to also set keyframes on unkeyed cells as long as the column has a key.) I also set alt+click to remove keys.

So far this makes editing values much faster than double clicking and typing the value.

The question is "What should the keys be that go with the mouse move?"
Shift + Click
Ctrl + Click
Alt + Click

There needs to be some modifier because click on its own needs to be available for selecting cells, and middle mouse is used to pan the spreadsheet.

@ghost
Copy link
Author

ghost commented Aug 2, 2017

I am also working on getting label click and drag working for only the edit tool and selection tool. It's doable, but tedious. But since I also use tablets alot, it would be a nice option to have. Most other tool values have a slider. Plastic tool seems to be the only other one that doesn't - I'll look at that too.

All values will be able to do the middle mouse button as well.

@ghost
Copy link

ghost commented Aug 2, 2017

First of all, thank you for your work, I don't understand everything, I don't know if it is related or not but i wanted to know 2 things

  • We will always be able to navigate between the different drawings , for example to navigate frame by frame, skipping 3 frames by 3 frames, etc. thanks to the mouse wheel or ctrl+mouse wheel ?
  1. If it will be possible to change the values ​​of the brush and geometry tools with this ? Or if I am completely off topic ?

@ghost
Copy link
Author

ghost commented Aug 3, 2017

Almost done- first post edited to include current functionality.

Todo:

  • Adjust drag value if the measure in a field is inches or cm.
  • Add better comments
  • Squash commits

attempt to make labels clickable

Function Editor Basics Working

All functionality working

Updated comments
@ghost ghost changed the title WIP- Middle Mouse Drag to Edit Values Middle Mouse Drag to Edit Values Aug 4, 2017
@ghost
Copy link
Author

ghost commented Aug 4, 2017

Done - man that was a lot more involved than I thought it would be.

@blurymind
Copy link

@turtleTooth you are on fire! Thank you. It's perfect :D

@blurymind
Copy link

i think ctrl would be a good default modifier, but ideally it should be configurable.
Mid click drag is perfect imo

@RodneyBaker
Copy link
Collaborator

RodneyBaker commented Aug 7, 2017

These are great time savers.
As I click and drag my middle mouse my my fingers and brain simultaneously say, "Smooooooth." :)

Added: This will be another PR but (unless I'm missing something) there needs to be a way to get a field to return to the default value (or the last value before the field was activated.

@ghost
Copy link
Author

ghost commented Aug 7, 2017

Don't forget to try clicking the labels of the edit tool with left click, or ctrl + left click and drag on the function viewer. Lots of fun.

@RodneyBaker
Copy link
Collaborator

@turtleTooth said:
Don't forget to try clicking the labels of the edit tool with left click, or ctrl + left click and drag on the function viewer. Lots of fun.

I think I'm following all of that.
clicking
labels
labels of the edit tool
click with a left click (or ctrl click) and then drag
click and drag on function viewer
...
Okay, I think here is where I get lost.
The function viewer is the pink gnomon in the center of the canvas right?

Aside: And... I never realized we could scale the Table itself. Very interesting.

@shun-iwasawa
Copy link
Member

Jenkins


void MeasuredDoubleLineEdit::mouseMoveEvent(QMouseEvent *e) {
if ((e->buttons() == Qt::MiddleButton) || m_labelClicked) {
m_value->modifyValue((e->x() - m_xMouse) / 2);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In some Fx there are parameters with small value range. For instance, the Opacity parameter of the Over Ino Fx has 0.0-1.0 value range. In such case middle-dragging of the field cannot get the values other than 0 and 1 for now.

How about modifying this line, adding the precision argument like as follows ?:

 int precision = (m_maxValue > 100) ? 0 : ((m_maxValue > 10) ? 1 : 2);
 m_value->modifyValue((e->x() - m_xMouse) / 2, precision);

I once thought of referring MeasuredDoubleLineEdit::m_decimals variable but using the maximum value of the field seems to perform better.

if ((e->buttons() == Qt::NoButton && m_mouseDragEditing) || m_labelClicked) {
m_xMouse = -1;
m_modified = true;
onEditingFinished();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about inserting clearFocus(); just below this line?

@shun-iwasawa
Copy link
Member

Related to this feature, I found a crash problem when dragging the frame field in the console and modified in #1574 .
Anyway this feature is very useful. Thanks @turtleTooth !

@ghost
Copy link
Author

ghost commented Nov 16, 2017

Thanks for the review @shun-iwasawa - I made the requested changes.

@shun-iwasawa
Copy link
Member

Jenkins

@@ -33,6 +33,7 @@ class DVAPI LineEdit : public QLineEdit {

bool m_isReturnPressed;
bool m_forbiddenSpecialChars;
bool m_mouseDragEditing;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@turtleTooth Sorry for the late notice, but it seems that bool m_mouseDragEditing should be initialized to false here or in ctor.

@ghost
Copy link
Author

ghost commented Nov 17, 2017

Done. Thanks @shun-iwasawa

@shun-iwasawa
Copy link
Member

Jenkins again

@shun-iwasawa
Copy link
Member

LGTM Thank you @turtleTooth for addition !

@shun-iwasawa shun-iwasawa merged commit 7712907 into opentoonz:master Nov 20, 2017
@artisteacher
Copy link
Contributor

I love this! It could also be helpful for text size. Just a thought, but replacing the sliders in the tool option bar with the click + drag on the label could save a lot of room in the tool option bar.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants