Bug 325424 - Fuzzy Parameter of Rotation rotates in one direction [Feature Request].
Summary: Fuzzy Parameter of Rotation rotates in one direction [Feature Request].
Status: RESOLVED FIXED
Alias: None
Product: krita
Classification: Applications
Component: Brush engines (show other bugs)
Version: git master (please specify the git hash!)
Platform: unspecified Linux
: NOR wishlist
Target Milestone: ---
Assignee: Krita Bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-09-29 14:31 UTC by Paul Geraskin
Modified: 2014-02-14 10:26 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
Positive and Negative Rotation for Fuzzy (54.30 KB, image/jpeg)
2014-01-31 21:35 UTC, Mohit Goyal
Details
Screenshot (167.09 KB, image/png)
2014-02-04 12:17 UTC, Mohit Goyal
Details
First patch submitted for this Feature Request. (3.42 MB, patch)
2014-02-05 09:30 UTC, Mohit Goyal
Details
Second Patch submitted (11.72 KB, patch)
2014-02-05 16:17 UTC, Mohit Goyal
Details
consists of files to be replaced (2.78 KB, application/zip)
2014-02-10 22:16 UTC, Mohit Goyal
Details
Patch for Random Positive Negative Rotation (2.18 KB, patch)
2014-02-11 07:54 UTC, Mohit Goyal
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Paul Geraskin 2013-09-29 14:31:28 UTC
Hi devs!

Fuzzy Parameter for Brush rotation rotates in one direction (positive). But in many cases we need a rotation in positive and negative directions. 

Here is my screenshot:
http://i.imgur.com/DC2L2u8.png

Here is my video explanation:
https://docs.google.com/file/d/0B-0uFh8DG9inVkZRR0RaX2RhX1k/edit?usp=sharing


Possible solution:
make a CheckBox for Fuzzy parameter "Rotate in Positive and Negative Direction".
Comment 1 animtim 2013-09-29 15:36:46 UTC
As I told you on IRC, that's not really necessary.. You can get exactly the effect you describe in the video just changing the initial brush rotation.
Adding a negative fuzzy rotation would just make it slightly faster to set the effect you want, but would have the exact same result.

I'm not completly opposed to this idea, just I'm wondering if it's worth adding a redundant setting there.
Comment 2 Paul Geraskin 2013-09-29 16:32:21 UTC
AnimTim,

Specially for you I downloaded PS C4 and checked Fuzzy parameter of the PS Engine. And it has variation in positive and negative direction.
See screenshot:
http://i.imgur.com/Z6KsRNV.png

You can check it too:
http://thepiratebay.sx/torrent/5588508/Photoshop_Portable_CS4

This is logically correct that Fuzzy parameter should be in both directions. Or you think that PS devs are wrong too? :)

It will not harm you if this feature will be as a Checkbox.
Comment 3 Halla Rempt 2013-09-29 17:18:41 UTC
Er... Not only shouldn't we link to pirated software... But, worse, I cannot access that link since it's blocked by law in my country!

I'm stuck with CS2 :P
Comment 4 animtim 2013-09-29 19:13:45 UTC
Paul,
I'm not saying photoshop devs (or you) are wrong, just they do it differently.
And so you can already do what you ask for, just using different settings as in the case of Fuzzy sensors it can be any value between initial angle and defined rotation angle, no matter where it starts from.
But maybe for some more "controlled" sensors then it could be really useful in the way that it would allow to make strokes not possible now.

So in the end I agree with you, but for different reasons , héhé ;)
So it enlarge the topic from just fuzzy sensor to other sensors on rotation.
I agree a checkbox to switch the curve grid from 0°/360° mode to -180°/+180+ mode.
Comment 5 Paul Geraskin 2013-09-30 07:32:57 UTC
Hello Animtim,

Good that we have agreement even if you see it differently. It's difficult and non-sensable to get the degree i need if i do it manually. That's why i did this request. :)

CheckBox would be cool to add.

Thanks.
Comment 6 Mohit Goyal 2014-01-27 14:03:09 UTC
Hi,
I am a newbie here and hoped to start out with this bug. I was able to add a checkbox and added the following code attached to the checkbox where m_defaultangle = m_defaultangle - 180 whenever the checkbox is enabled.
However as it might be obvious -- it isn't working this way. Can anybody help out ?
Thanks
Comment 7 Mohit Goyal 2014-01-27 14:17:59 UTC
Obvious in the sense I knew I was doing something wrong but don't understand what :(
Comment 8 Paul Geraskin 2014-01-28 12:02:34 UTC
Hello Mohit Goyal.

Thank you for taking time to check this issue. 
Ok, what we can do:

Logic: 
brush has rotation from 0 to 360 degrees. I think there should be no

For example, a brush has rotationValue=30 and and fuzzyValue=20.
anglePositiveRotation= rotationValue + fuzzyValue;
or
angleNegativeRotation= rotationValue - fuzzyValue; // NEGATIVE ROTATION
if (angleNegativeRotation < 0) angleNegativeRotation = 360 + angleNegativeRotation; // WRAP TO 360 DEGREES

All you need is to rotate one frame to anglePositiveRotation then next to angleNegativeRotation.
And loop it all the time of rotation.

Also, make sure that Krita uses degrees. There is also RADIANS. If krita uses radians then you need to add mutiplier to convert degrees to radians.
Comment 9 Paul Geraskin 2014-01-28 12:09:00 UTC
UPDATED!

Thank you for taking time to check this issue. 
Ok, what we can do:

Logic: 
brush has rotation from 0 to 360 degrees. I think there should be no negative angles

For example, a brush has rotationValue=30 and and fuzzyValue=20.
anglePositiveRotation= rotationValue + fuzzyValue;
if (anglePositiveRotation > 360) anglePositiveRotation = anglePositiveRotation % 360; // WRAP TO 360 DEGREES

or for negative value

angleNegativeRotation= rotationValue - fuzzyValue; // NEGATIVE ROTATION
if (angleNegativeRotation < 0) angleNegativeRotation = 360 + angleNegativeRotation; // WRAP TO 360 DEGREES

All you need is to rotate one frame to anglePositiveRotation then next frame to angleNegativeRotation.
And loop it all the time of rotation.

Also, make sure that Krita uses degrees. There is also RADIANS. If krita uses radians then you need to add mutiplier to convert degrees to radians.
Comment 10 Mohit Goyal 2014-01-28 12:20:50 UTC
Hi Paul,
That gave me great insight. However, In the previous comments, Animtim was
talking about adding the checkbox for all aspects of rotation and not only
Fuzzy. As of now I have added a checkbox with certain properties to the
rotation option as a whole to a different widget. What should I do there ?
I am very much willing to change it.

Thanks :)


On Tue, Jan 28, 2014 at 5:39 PM, Paul Geraskin <paulgeraskin@gmail.com>wrote:

> https://bugs.kde.org/show_bug.cgi?id=325424
>
> --- Comment #9 from Paul Geraskin <paulgeraskin@gmail.com> ---
> UPDATED!
>
> Thank you for taking time to check this issue.
> Ok, what we can do:
>
> Logic:
> brush has rotation from 0 to 360 degrees. I think there should be no
> negative
> angles
>
> For example, a brush has rotationValue=30 and and fuzzyValue=20.
> anglePositiveRotation= rotationValue + fuzzyValue;
> if (anglePositiveRotation > 360) anglePositiveRotation =
> anglePositiveRotation
> % 360; // WRAP TO 360 DEGREES
>
> or for negative value
>
> angleNegativeRotation= rotationValue - fuzzyValue; // NEGATIVE ROTATION
> if (angleNegativeRotation < 0) angleNegativeRotation = 360 +
> angleNegativeRotation; // WRAP TO 360 DEGREES
>
> All you need is to rotate one frame to anglePositiveRotation then next
> frame to
> angleNegativeRotation.
> And loop it all the time of rotation.
>
> Also, make sure that Krita uses degrees. There is also RADIANS. If krita
> uses
> radians then you need to add mutiplier to convert degrees to radians.
>
> --
> You are receiving this mail because:
> You are on the CC list for the bug.
>
Comment 11 Paul Geraskin 2014-01-28 12:26:01 UTC
Actually i dunno know about other aspects. You/we can talk about it in IRC channel. 
http://krita.org/join-krita/irc-chat

our nicks: AnimTim, mifth(me), boud, DmitryK.

Your code also should review boud/DmitryK.
Comment 12 Mohit Goyal 2014-01-31 21:35:39 UTC
Created attachment 84928 [details]
Positive and Negative Rotation for Fuzzy

This is a rudimentary fix I just started out with.
The first line displays the brush I am using. Its a simple arrow pointing left.
I then check Rotation and in that Fuzzy sensor with the curve at 90 degrees as was done in your video.
The next two lines actually show the Fuzzy Rotation for the same. As you can see, positive and negative rotation alternating after every frame.
I am yet to put a checkbox. The code changes I have done as of now are for the general case and not for Fuzzy specifically. I have to learn how to detect whether the Fuzzy checkbox is checked or not and if yes, whether the user wants Positive and Negative Rotation both.
Comment 13 Paul Geraskin 2014-02-03 13:19:36 UTC
Hi!

Looks cool. Can you make a patch so that Dmitry or Boud reviewed it and added to Krita?
Comment 14 Mohit Goyal 2014-02-04 12:10:05 UTC
Hi,
I finally got the checkbox to work. It is fully functional now. However I don't know how to submit the patch as I have made changes in multiple files and have made two new files. I have attached two screenshots of the same.
In the drawing, the row above is positive and negative rotation when the checkbox is checked
and the row below is when the checkbox is not checked hence giving only positive rotation.
I'll also ask on IRC how to submit the patch but if someone can help me out here it will be cool :)
Comment 15 Halla Rempt 2014-02-04 12:16:06 UTC
The easiest way to make the patch is to do this:

use "git add" to add the new and changed files
"git commit" to create a commit with all the changes
"git show > bug_325424.patch" to create the full patch

you can then attach the patch to this bug or on git.reviewboard.kde.org.
Comment 16 Mohit Goyal 2014-02-04 12:17:50 UTC
Created attachment 84988 [details]
Screenshot
Comment 17 Mohit Goyal 2014-02-04 12:20:24 UTC
Thanks :)
And one last thing. I should remove all the random spaces and everything
that is showing up in git diff before I send the patch right ?


On Tue, Feb 4, 2014 at 5:46 PM, Boudewijn Rempt <boud@valdyas.org> wrote:

> https://bugs.kde.org/show_bug.cgi?id=325424
>
> --- Comment #15 from Boudewijn Rempt <boud@valdyas.org> ---
> The easiest way to make the patch is to do this:
>
> use "git add" to add the new and changed files
> "git commit" to create a commit with all the changes
> "git show > bug_325424.patch" to create the full patch
>
> you can then attach the patch to this bug or on git.reviewboard.kde.org.
>
> --
> You are receiving this mail because:
> You are on the CC list for the bug.
>
Comment 18 Halla Rempt 2014-02-04 12:25:35 UTC
Ideally, yes. You should make sure you didn't add random whitespace, and 
that your code follows the coding conventions 
(http://techbase.kde.org/Policies/Kdelibs_Coding_Style) and that the new 
files have copyright headers with your copyright,
Comment 19 Mohit Goyal 2014-02-05 09:30:41 UTC
Created attachment 84998 [details]
First patch submitted for this Feature Request.

bug325424.patch is the first patch submitted for this bug. However, I am not sure whether we are supposed to submit so many files in one go. When I did git add --all, it added quite a lot of new files, many of which I didn't even know about. So please tell me where I am going wrong. Thanks :)
Comment 20 Mohit Goyal 2014-02-05 10:15:42 UTC
Also, I saw other bugs were assigned to other devs. Is it necessary to get a bug assigned ? Thanks
Comment 21 Halla Rempt 2014-02-05 10:50:59 UTC
No, assigning a bug is something people do themselves when they want to be sure nobody else is working on it. I'll check your patch during my lunch hour.
Comment 22 Halla Rempt 2014-02-05 10:56:23 UTC
No, assigning a bug is something people do themselves when they want to be sure nobody else is working on it. There are quite a few files that don't belong in your patch, btw.
Comment 23 Mohit Goyal 2014-02-05 10:59:04 UTC
Yes. I saw that. However I didn't know whether they were important for the
patch or not. Cmake generated a lot of files. Should i submit a new one
with just my modified files ?
On Feb 5, 2014 4:26 PM, "Boudewijn Rempt" <boud@valdyas.org> wrote:

> https://bugs.kde.org/show_bug.cgi?id=325424
>
> --- Comment #22 from Boudewijn Rempt <boud@valdyas.org> ---
> No, assigning a bug is something people do themselves when they want to be
> sure
> nobody else is working on it. There are quite a few files that don't
> belong in
> your patch, btw.
>
> --
> You are receiving this mail because:
> You are on the CC list for the bug.
>
Comment 24 Halla Rempt 2014-02-05 11:05:02 UTC
Yes, please. The files cmake generates shouldn't be in a patch. The presence of the files shows that you're not following http://community.kde.org/Calligra/Building/Building_Calligra -- the directory structure that is recommended in that page keeps your source directory clean and it's very much recommended to work that way.
Comment 25 Mohit Goyal 2014-02-05 11:33:32 UTC
Yes. I realize I had tried to build inside my source directory once and never realized that all these files had been generated. I am cleaning up Calligra right now though it is taking a lot of time. I'll send the patch in by tonight with only the requisite files. Sorry for all the inconvenience
Comment 26 Mohit Goyal 2014-02-05 16:17:30 UTC
Created attachment 85006 [details]
Second Patch submitted

Hopefully this should work
Comment 27 Mohit Goyal 2014-02-07 13:14:43 UTC
Hi,
Can you please check the patch out and tell the errors. I am sorry for sounding impatient but its really my first open contribution so hoping it goes well. Thanks for your time :)
Comment 28 Halla Rempt 2014-02-07 13:16:09 UTC
No, not a problem! I've been lazy... So thanks for the reminder, and I'll 
take a look now.
Comment 29 Halla Rempt 2014-02-07 13:28:47 UTC
Yes, this looks good. The results seems okay to me, and the code is neatly done, too. I'll push it right away.
Comment 30 Paul Geraskin 2014-02-07 14:23:17 UTC
Good job! 

Congratulations with the first commit! 

I have the only one remark: at present values go pos, neg, pos, neg, pos, neg. But for real random we should to randomize positive and negative direction too.

Check my screenshot: http://i.imgur.com/QMzCQeu.png

Boud, i will not reopen the bug. But could you check it out?

Thanks.
Comment 31 Mohit Goyal 2014-02-07 14:58:31 UTC
I can try that as well. Its not very difficult to implement in the current
code.
On Feb 7, 2014 7:53 PM, "Paul Geraskin" <paulgeraskin@gmail.com> wrote:

> https://bugs.kde.org/show_bug.cgi?id=325424
>
> --- Comment #30 from Paul Geraskin <paulgeraskin@gmail.com> ---
> Good job!
>
> Congratulations with the first commit!
>
> I have the only one remark: at present values go pos, neg, pos, neg, pos,
> neg.
> But for real random we should to randomize positive and negative direction
> too.
>
> Check my screenshot: http://i.imgur.com/QMzCQeu.png
>
> Boud, i will not reopen the bug. But could you check it out?
>
> Thanks.
>
> --
> You are receiving this mail because:
> You are on the CC list for the bug.
>
Comment 32 Paul Geraskin 2014-02-07 15:01:09 UTC
Ok, do it man!

As PS has this value randomized too http://i.imgur.com/Z6KsRNV.png
Comment 33 Paul Geraskin 2014-02-10 12:24:30 UTC
Hi Mohit! 

Do you have any news about randomizing positive and negative values?

I'll reopen the bug for a while. Just not to forget.

Thanks.
Comment 34 Mohit Goyal 2014-02-10 12:32:15 UTC
Yes. I did it. However I was not being able to generate a git patch in the
same. Its just a one line code change. Ill submit it by tonight
On Feb 10, 2014 5:54 PM, "Paul Geraskin" <paulgeraskin@gmail.com> wrote:

> https://bugs.kde.org/show_bug.cgi?id=325424
>
> Paul Geraskin <paulgeraskin@gmail.com> changed:
>
>            What    |Removed                     |Added
>
> ----------------------------------------------------------------------------
>              Status|RESOLVED                    |REOPENED
>          Resolution|FIXED                       |---
>
> --- Comment #33 from Paul Geraskin <paulgeraskin@gmail.com> ---
> Hi Mohit!
>
> Do you have any news about randomizing positive and negative values?
>
> I'll reopen the bug for a while. Just not to forget.
>
> Thanks.
>
> --
> You are receiving this mail because:
> You are on the CC list for the bug.
>
Comment 35 Paul Geraskin 2014-02-10 12:49:01 UTC
Super! Waiting for your patch. :)
Comment 36 Paul Geraskin 2014-02-10 12:52:21 UTC
Btw, do you want to participate in GSoC'14?
Comment 37 Mohit Goyal 2014-02-10 22:04:39 UTC
Yes I would like to :)
Comment 38 Mohit Goyal 2014-02-10 22:16:59 UTC
Created attachment 85092 [details]
consists of files to be replaced

Hi,
I am not able to create a clean git patch without downloading the code again. Since I have a download limit here, I can only do that tomorrow. I have however uploaded the concerning source files. They just have two lines of code changed. They belong to krita/plugins/paintops/libpaintop/ .
I will try to get the git patch but till then this is what I have. Sorry :(
Comment 39 Mohit Goyal 2014-02-11 07:54:39 UTC
Created attachment 85098 [details]
Patch for Random Positive Negative Rotation

Hi,
I think this should work
Comment 40 Halla Rempt 2014-02-11 09:14:36 UTC
Hi Mohit!

Awesome :-). I'm working right now on https://bugs.kde.org/show_bug.cgi?id=330661 which means I needed to refactor away the KisDynamicSensorList class. When that's done, I'll apply your patch.
Comment 41 Mohit Goyal 2014-02-11 09:36:47 UTC
Hi,
Yeah sure :). Can I help in any way on that ? Thanks :)
Comment 42 Halla Rempt 2014-02-13 15:02:12 UTC
Git commit 6c3762578ead640f60cd75404400e2ab6553e211 by Boudewijn Rempt.
Committed on 13/02/2014 at 15:00.
Pushed by rempt into branch 'calligra/2.8'.

Patch by Mohit Goyal. Thanks!
CCMAIL:mohit.bits2011@gmail.com

M  +8    -21   krita/plugins/paintops/libpaintop/kis_pressure_rotation_option.cpp
M  +0    -1    krita/plugins/paintops/libpaintop/kis_pressure_rotation_option.h

http://commits.kde.org/calligra/6c3762578ead640f60cd75404400e2ab6553e211
Comment 43 Halla Rempt 2014-02-14 08:11:08 UTC
Git commit f5aa69e113cd0fc097ff7983b8dfb3673553dfa6 by Boudewijn Rempt.
Committed on 13/02/2014 at 15:00.
Pushed by rempt into branch 'master'.

Patch by Mohit Goyal. Thanks!
CCMAIL:mohit.bits2011@gmail.com

M  +8    -21   krita/plugins/paintops/libpaintop/kis_pressure_rotation_option.cpp
M  +0    -1    krita/plugins/paintops/libpaintop/kis_pressure_rotation_option.h

http://commits.kde.org/calligra/f5aa69e113cd0fc097ff7983b8dfb3673553dfa6
Comment 44 Paul Geraskin 2014-02-14 09:59:55 UTC
I want to say BIG THANKS!!!!!
THANK YOU THANK YOU! 
No we have really cool random brush engine for rotation. http://i.imgur.com/d7TnfEf.png

Boud is it possible to add this checkBox for Hue/Saturation/Size change (Fuzzy)?
Comment 45 Halla Rempt 2014-02-14 10:01:58 UTC
It's not me you should ask, but Mohit :-). He's done the good work!
Comment 46 Paul Geraskin 2014-02-14 10:07:09 UTC
Mohit how you think to add it? Possibly for GSoC?
Comment 47 Mohit Goyal 2014-02-14 10:26:54 UTC
I think it should be possible. I'll discuss it with you in IRC for whatever other related features we can put in.
Also, I just wanted to say, its pretty fun working with you people :) So the real thanks is to you guys :)