Multiple issues with the filter dialog
Hello
I noticed there are several issues with the filter effects dialog:
1. Wrong initial value for the "Type" combo box of feColorMatrix when adding a new filter effect or loading an existing one (patch snippet attached, please apply to 0.48 as well). 2. Undo does not work correctly: when modifying a parameter using a slider, undo does not restore the slider to its value at the start of the drag, but to intermediate positions during the drag. (Fixing this likely requires a substantial rewrite.) 3. It says feComponentTransfer is not implemented in Inkscape, but in fact it is. 4. Some sliders have completely bogus ranges. For example the surface scale slider on feDiffuseLighting operates in the absurd range [-1000, 1000] with a step of 0.1, whereas 90% of the useful values lie in the range [-1, 1]. [-5, 5] is a more appropriate choice. (I'll follow up with a ptach that fixes some of the more outrageous ranges.)
Issues 2 and 3 could be worked on in the 0.49 dev cycle.
Regards, Krzysztof
Additional problem: there is no horizontal scrolling in the connection editor widget, so with large filters (e.g. 20 primitives or more) the dialog gets very wide.
Regards, Krzysztof
The current dialog should really be replaced by something more intuitive and less "rigid" feeling at some point. I personally like the way they do the compositor nodes in Blender and think that perhaps something more like that could be easier to work with.
Here's one screenshot with it for those who aren't familiar. http://www.blender.org/typo3temp/pics/61389a332f.jpg
Cheers, Josh
On Tue, 2010-07-27 at 01:50 +0200, Krzysztof Kosiński wrote:
Additional problem: there is no horizontal scrolling in the connection editor widget, so with large filters (e.g. 20 primitives or more) the dialog gets very wide.
Regards, Krzysztof
The Palm PDK Hot Apps Program offers developers who use the Plug-In Development Kit to bring their C/C++ apps to Palm for a share of $1 Million in cash or HP Products. Visit us here for more details: http://ad.doubleclick.net/clk;226879339;13503038;l? http://clk.atdmt.com/CRS/go/247765532/direct/01/ _______________________________________________ Inkscape-devel mailing list Inkscape-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/inkscape-devel
W dniu 27 lipca 2010 02:04 użytkownik Joshua A. Andler <scislac@...400...> napisał:
Here's one screenshot with it for those who aren't familiar. http://www.blender.org/typo3temp/pics/61389a332f.jpg
Cheers, Josh
Wow, this is really nice. We would need a really complex custom widget though.
Regards, Krzysztof
On 7/27/10, Krzysztof Kosiński wrote:
W dniu 27 lipca 2010 02:04 użytkownik Joshua A. Andler <scislac@...400...> napisał:
Here's one screenshot with it for those who aren't familiar. http://www.blender.org/typo3temp/pics/61389a332f.jpg
Wow, this is really nice. We would need a really complex custom widget though.
Actually we have at least two bluepapers exactly on alternative UI for SVG filters: one suggests a simpler UI and the other one goes for Blender-like UI.
We don't exactly have to write our own widget from scratch. MathMap (http://www.complang.tuwien.ac.at/schani/mathmap/) already has one (GTK+, C, Cairo) which is quite similar to the one from Quartz Composer, even though it doesn't have per-node preview to the best of my knowledge.
Alexandre Prokoudine http://libregraphicsworld.org
On Tue, 2010-07-27 at 06:08 +0400, Alexandre Prokoudine wrote:
Actually we have at least two bluepapers exactly on alternative UI for SVG filters: one suggests a simpler UI and the other one goes for Blender-like UI.
I think that once our effects will store/load the settings between uses (as in you pull up an effect on an object with it applied, it loads what was already done), the simple UI for filters is easily doable for the canned ones.
We don't exactly have to write our own widget from scratch. MathMap (http://www.complang.tuwien.ac.at/schani/mathmap/) already has one (GTK+, C, Cairo) which is quite similar to the one from Quartz Composer, even though it doesn't have per-node preview to the best of my knowledge.
Awesome find! Hopefully it's mostly reusable, because that would be sweet.
Cheers, Josh
This patch uses more sensible ranges for sliders in feDiffuseLighting and feSpecularLighting. Specular and diffuse constants are in the range [0,5], surface scale is [-5,5] and specular exponent is [1, 50].
Regards, Krzysztof
On Tue, 2010-07-27 at 01:29 +0200, Krzysztof Kosiński wrote:
- Some sliders have completely bogus ranges. For example the surface
scale slider on feDiffuseLighting operates in the absurd range [-1000, 1000] with a step of 0.1, whereas 90% of the useful values lie in the range [-1, 1]. [-5, 5] is a more appropriate choice. (I'll follow up with a ptach that fixes some of the more outrageous ranges.)
You need to be careful about choosing ranges. It is hard to predict what people will find useful. We have in our own preset filters values outside the ranges you have proposed. For example, we have filters with surfaceScale values of 10, 10.5, and 50. I have in my book examples with surfaceScale of 60 and 300.
It is a problem with our current interface that you cannot allow all reasonable values and have the slider cover the potentially most used range. Currently, the only way you can set values outside the slider/entry box range is to use the XML editor so it is better to error on the side of too large ranges than too small.
Tav
W dniu 27 lipca 2010 10:32 użytkownik Tavmjong Bah <tavmjong@...8...> napisał:
It is a problem with our current interface that you cannot allow all reasonable values and have the slider cover the potentially most used range. Currently, the only way you can set values outside the slider/entry box range is to use the XML editor so it is better to error on the side of too large ranges than too small.
It would be best if the slider had a limited range, but you could input an arbitrary value (or a value from a much larger range) using the spinbox.
579932 Too much states saved for undo/redo when using sliders https://bugs.launchpad.net/inkscape/+bug/579932
The easiest fix is to set the sliders to Gtk::UPDATE_DISCONTINUOUS update policy, but this will prevent the display from updating during the drag. Apparently there is no way in GTK right now to get the correct behavior!
Regards, Krzysztof
On Jul 27, 2010, at 8:00 AM, Krzysztof Kosiński wrote:
579932 Too much states saved for undo/redo when using sliders https://bugs.launchpad.net/inkscape/+bug/579932
The easiest fix is to set the sliders to Gtk::UPDATE_DISCONTINUOUS update policy, but this will prevent the display from updating during the drag. Apparently there is no way in GTK right now to get the correct behavior!
There are a few ways to get good behavior. Some of these have come up for the color sliders. For this area the two big things to look at are using the might-be-more calls for undo and also to "debounce" the input from the slider so as to not trigger as many changes as the user moves things quickly.
While the former will probably give some of the best 'fix' for this bug, the latter has potential to significantly improve the user experience. When I applied this to the color sliders it technically became slower, but to the users it felt much faster. It trades of raw numeric crunching speed for improved responsiveness to the user.
But again, the root cause of the bug report appears to be from not using our proper under system calls. This may be direct or indirect. If it is the latter (function triggers events that calls functions that in turn register undo changes, etc.) then it might take a bit of cleanup to fix without breaking other cases.
2010/7/27 Krzysztof Kosiński <tweenk.pl@...400...>:
The easiest fix is to set the sliders to Gtk::UPDATE_DISCONTINUOUS update policy, but this will prevent the display from updating during the drag. Apparently there is no way in GTK right now to get the correct behavior!
There is. See how the color sliders in Fill&Stroke deal with this. They also update repr continuously during drag, which enables live display update, but all these updates are committed with the same undo key. As a result, when you undo, the entire drag is undone. Once you release, the key is flipped to another value so the next drag is not lumped together with previous one.
On 7/27/10, Tavmjong Bah wrote:
It is a problem with our current interface that you cannot allow all reasonable values and have the slider cover the potentially most used range.
The other problem, as many times pointed out before, is that we do not tell users what some particular options mean (e.g. most of Turbulence or "Kernel Unit Length") and what units are used. Some tooltips are absolutely unhelpful, e.g. the one for Constant says "This constant affects Phong lighting model".
This could be solved in part if we had a GIMP-style context sensitive on-line reference. But that's another story.
Alexandre Prokoudine http://libregraphicsworld.org
Links to the bug tracker:
On 27/7/10 01:29, Krzysztof Kosiński wrote:
I noticed there are several issues with the filter effects dialog:
- Wrong initial value for the "Type" combo box of feColorMatrix when
adding a new filter effect or loading an existing one (patch snippet attached, please apply to 0.48 as well).
similar issues with Effect Parameters UI tab: 386627 Data display remanence in filters Color matrix dialog https://bugs.launchpad.net/inkscape/+bug/386627
216945 Filter Effects - editing text control problem https://bugs.launchpad.net/inkscape/+bug/216945
194408 Filters don't always use parameters as displayed in dialog https://bugs.launchpad.net/inkscape/+bug/194408
- Undo does not work correctly: when modifying a parameter using a
slider, undo does not restore the slider to its value at the start of the drag, but to intermediate positions during the drag. (Fixing this likely requires a substantial rewrite.)
579932 Too much states saved for undo/redo when using sliders https://bugs.launchpad.net/inkscape/+bug/579932
- It says feComponentTransfer is not implemented in Inkscape, but in
fact it is.
190063 filter component transfert don't work https://bugs.launchpad.net/inkscape/+bug/190063
- Some sliders have completely bogus ranges. For example the surface
scale slider on feDiffuseLighting operates in the absurd range [-1000, 1000] with a step of 0.1, whereas 90% of the useful values lie in the range [-1, 1]. [-5, 5] is a more appropriate choice. (I'll follow up with a ptach that fixes some of the more outrageous ranges.)
related(?) - default value not representable with slider 193924 limiting cone attribute settings UI https://bugs.launchpad.net/inkscape/+bug/193924 193926 divisor attribute for feconvolvematrix (default value UI) https://bugs.launchpad.net/inkscape/+bug/193926
related(?) - improved slider increments: 178336 spin boxes increment values on filters UI need tweaking before 0.46 release https://bugs.launchpad.net/inkscape/+bug/178336
On 27/7/10 02:04, Joshua A. Andler wrote:
The current dialog should really be replaced by something more intuitive and less "rigid" feeling at some point. I personally like the way they do the compositor nodes in Blender and think that perhaps something more like that could be easier to work with.
Here's one screenshot with it for those who aren't familiar. http://www.blender.org/typo3temp/pics/61389a332f.jpg
308773 filters UI versus blender nodes https://bugs.launchpad.net/inkscape/+bug/308773
506580 filter : thumbnails of each step + disable operations after step n https://bugs.launchpad.net/inkscape/+bug/506580
Blueprint: "Improving the Filter Effects Dialog with better visualization and flow" https://blueprints.launchpad.net/inkscape/+spec/improved-filter-effects-dialog
~suv
W dniu 27 lipca 2010 10:57 użytkownik ~suv <suv-sf@...58...> napisał:
- Undo does not work correctly: when modifying a parameter using a
slider, undo does not restore the slider to its value at the start of the drag, but to intermediate positions during the drag. (Fixing this likely requires a substantial rewrite.)
579932 Too much states saved for undo/redo when using sliders https://bugs.launchpad.net/inkscape/+bug/579932
It turns out that the author of the dialog was thinking correctly but did not know that some Inkscape APIs were braindead. The undo spam was triggered because the undo key passed to sp_document_maybe_done was dynamically created in a Glib::ustring, and that function expects a constant string. I fixed it to store a duplicate of the last undo action key in SPDocument (via g_strdup), rather than simply assigning a char pointer. The destructor was adjusted as well.
The patch can be applied to 0.48 branch as well.
Regards, Krzysztof
On Jul 27, 2010, at 3:35 PM, Krzysztof Kosiński wrote:
It turns out that the author of the dialog was thinking correctly but did not know that some Inkscape APIs were braindead. The undo spam was triggered because the undo key passed to sp_document_maybe_done was dynamically created in a Glib::ustring, and that function expects a constant string. I fixed it to store a duplicate of the last undo action key in SPDocument (via g_strdup), rather than simply assigning a char pointer. The destructor was adjusted as well.
Good catch.
There are a few things about the code, though. First of all the API was not "braindead", there was just an improper bit of implementation code. But more important is that the fix needs a few things. First of all is g_strdup(). We really need to avoid having that in any C++ code. Next is that you had an if statement without any braces around its body.
Aside from those code safety points, though, the fix looks good and we probably want a cleaned up version going into 0.48.
2010/7/27 Krzysztof Kosiński <tweenk.pl@...400...>:
It turns out that the author of the dialog was thinking correctly but did not know that some Inkscape APIs were braindead. The undo spam was triggered because the undo key passed to sp_document_maybe_done was dynamically created in a Glib::ustring, and that function expects a constant string. I fixed it to store a duplicate of the last undo action key in SPDocument (via g_strdup), rather than simply assigning a char pointer. The destructor was adjusted as well.
Why do you think that this is where this has to be fixed, instead of switching the filters dialog to static strings? Fill&stroke uses static strings just fine.
I don't see any necessity for dynamic generation of keys, and doing a string dup on each undo event sounds unnecessarily wasteful.
In any case, this is a nontrivial change in a very sensitive area, so I would prefer to err on the side of caution and not apply it to 0.48, given that the problem it fixes is relatively cosmetic.
On Jul 27, 2010, at 9:52 PM, bulia byak wrote:
Why do you think that this is where this has to be fixed, instead of switching the filters dialog to static strings? Fill&stroke uses static strings just fine.
I don't see any necessity for dynamic generation of keys, and doing a string dup on each undo event sounds unnecessarily wasteful.
In any case, this is a nontrivial change in a very sensitive area, so I would prefer to err on the side of caution and not apply it to 0.48, given that the problem it fixes is relatively cosmetic.
I think Krzysztof might have miscommunicated some of what he was seeing. From his email I also got the same impression, but once I looked at the actual diff it was clear there were problems in the implementation of sp_document_maybe_done().
It's not such much that dynamic generation of keys was the main issue, but that SPDocument was holding onto a temporary pointer retuned from Glib::ustring, which in turn is just std::string::c_str().
So the problem comes up that later on when we go to compare things to the next string, the pointer is invalid and could be pointing anywhere. Holding stale pointers can easily cause crashes. Some OS's are also more susceptible to these.. Erring on the side of caution would probably say not to hold stale pointers.
If we're really concerned about performance, we should take a look at passing in a reference to a Glib::ustring. The C++ classes usually have been optimized to share buffers, etc. Of course we could probably search through all the calls to sp_document_maybe_done() and ensure they only use static persistent strings, but we still should look for ways to keep the code safe.
W dniu 28 lipca 2010 06:52 użytkownik bulia byak <buliabyak@...400...> napisał:
I don't see any necessity for dynamic generation of keys, and doing a string dup on each undo event sounds unnecessarily wasteful.
~50 bytes of extra memory consumption per document looks like a reasonable price to pay to fix undo in the filter dialog, and possible future places that will need to use dynamic generation of undo keys. It's also much lower than the memory required to store all the static strings. Only the last undo key is stored.
In any case, this is a nontrivial change in a very sensitive area, so I would prefer to err on the side of caution and not apply it to 0.48, given that the problem it fixes is relatively cosmetic.
The change is safe, because we are enlarging the valid domain of arguments, not shrinking it.
Regards, Krzysztof
2010/7/28 Krzysztof Kosiński <tweenk.pl@...400...>:
W dniu 28 lipca 2010 06:52 użytkownik bulia byak <buliabyak@...400...> napisał:
I don't see any necessity for dynamic generation of keys, and doing a string dup on each undo event sounds unnecessarily wasteful.
~50 bytes of extra memory consumption per document looks like a reasonable price to pay to fix undo in the filter dialog, and possible future places that will need to use dynamic generation of undo keys.
Once again: we don't need dynamic generation of keys. Look a fill&stroke: it just flips between two static strings. It's faster and easier.
It's also much lower than the memory required to store all the static strings. Only the last undo key is stored.
If you're counting static memory, then I'm quite certain that the extra ustring calls and related overhead will easily eat those several bytes of economy you get from eliminating two static strings. On top of which, ustring also allocates dynamic memory, while static strings do not.
On Jul 28, 2010, at 9:15 AM, bulia byak wrote:
Once again: we don't need dynamic generation of keys. Look a fill&stroke: it just flips between two static strings. It's faster and easier.
Yes, but the problem we hit was that the code holding it was not safe. To safely hold the pointer it requires limitations on the input that the C++ language just is not able to provide.
Faster is good, but code safety wins if it comes into play.
W dniu 28 lipca 2010 18:15 użytkownik bulia byak <buliabyak@...400...> napisał:
2010/7/28 Krzysztof Kosiński <tweenk.pl@...400...>:
W dniu 28 lipca 2010 06:52 użytkownik bulia byak <buliabyak@...972.....> napisał:
I don't see any necessity for dynamic generation of keys, and doing a string dup on each undo event sounds unnecessarily wasteful.
~50 bytes of extra memory consumption per document looks like a reasonable price to pay to fix undo in the filter dialog, and possible future places that will need to use dynamic generation of undo keys.
Once again: we don't need dynamic generation of keys. Look a fill&stroke: it just flips between two static strings. It's faster and easier.
Here's why we can't use static strings in the filter dialog:
Let's say you have two Color Matrix primitives with type Hue Rotate, adjust one of them, then select the second one and adjust it as well. The two events should not be coalesced, which means they should have different undo keys. Since there is no limit on the number of Color Matrix primitives in a filter, we must generate the undo key string dynamically.
Of course you could hack around it by storing the undo key string in the filter dialog and changing the argument to maybe_done between e.g. "filter:1" and "filter:2" whenever the actual undo key string changes, but doesn't it make more sense to fix the API limitation instead of papering over it?
PS: This might be a small inefficiency, but it uses much simpler code than alternative solutions.
Regards, Krzysztof
participants (7)
-
Alexandre Prokoudine
-
bulia byak
-
Jon Cruz
-
Joshua A. Andler
-
Krzysztof Kosiński
-
Tavmjong Bah
-
~suv