Perspective works only with objects converted to path

Bug #186582 reported by Mourad Mokrane
66
This bug affects 4 people
Affects Status Importance Assigned to Milestone
Inkscape
Fix Released
High
Unassigned
inkscape (Ubuntu)
Fix Released
Undecided
Unassigned

Bug Description

Inkscape0801270322, Windows Vista Home Premium

The perspective effect works only when object is converted to path. If I try to apply a perspective by selecting 2 objects (in my case a rectangle and a hand drawn line) I get this error:

-------
Traceback (most recent call last):
  File "share\extensions\perspective.py", line 127, in <module>
    e.affect()
  File "C:\Users\molumen\Desktop\Inkscape0801270322\share\extensions\inkex.py", line 154, in affect
    self.effect()
  File "share\extensions\perspective.py", line 80, in effect
    solmatrix[i][0] = sp[i][0]
UnboundLocalError: local variable 'sp' referenced before assignment
-------

But as soon as I convert the rectangle to path, the error is gone and the perspective effect works as it should.

The user-friendly way to correct that is to make the perspective extention automatically convert selected objects (in case there are any) to path before applying the effect AND tell about the undergoing conversion to the user (a dialog box saying "The selected objects will be converted to path" and OK / CANCEL buttons)

Revision history for this message
Tom Davidson (tjd-mit) wrote :

I agree that this is buggy. If you search on 'perspective' in the bug database you'll find lots of bugs already reported. Rather than starting a new discussion here, how about adding your comments to one of those. Maybe bug 171967 ?

Changed in inkscape:
status: New → Incomplete
Revision history for this message
Mourad Mokrane (momo-lumenstudio) wrote :

bug 171967 addresses a different issue than what I am describing here.
It speaks about live interactivity and it is a feature request.
I am here talking about a usability issue related to the perspective extention limitation with objects not converted to paths and proposing a solution to this problem.

By the way, I thought about another, simplier possibility to fix this issue: if among the selected objects is at least one that is not converted to paths (like a circle or a rectangle) then a dialog window could pop-up to thell the user to convert objects to path. Something like "Please convert selected objects to paths before applying this effect" and an OK button that just closes the dialog and returns the user to the canvas. No error is displayed which is a lot more user friendly that the current behaviour.

Revision history for this message
Mourad Mokrane (momo-lumenstudio) wrote :

Also, why is this now tagged INCOMPLETE???

Revision history for this message
Tom Davidson (tjd-mit) wrote :

'Incomplete' just means that we're waiting to hear back from you. If you had gone and joined another bug, then that status just means this one would have faded away into the sunset after 60 days. It's not a judgment, it's just a way to control 'bloat' in the bug tracker... Anyhow, I've set it back to 'New', since I can't confirm the error you're seeing (I don't get any error on Linux in recent development snapshot--the effect just fails silently on non-path objects).

The reason I made the suggestion that you try to find another bug to add your thoughts is because sometimes the best way to get a feature improved is to try to get a lively discussion going all in one place. In particular, this extension has had a lot of complaints about usability, but they're in bug reports that are spread out all over the place. I think that the problem is that the effect " is not intuitive, to say the least", as mentioned in the bug I referred you to, and that your suggestion is a good one. (It's not quite a bug, though, since the effect is documented as only working on paths...)

Changed in inkscape:
status: Incomplete → New
Revision history for this message
Tom Davidson (tjd-mit) wrote :

Hmm... Bug 174992 reports the same error message as you are getting, but no one over there manages to trace it to the user trying to apply the effect to a non-path object... See what I mean about this extension being a mess! :)

Revision history for this message
Mourad Mokrane (momo-lumenstudio) wrote :

Yep', looks like Bug #174992 is caused by one of the objects being not a path object (probably a circle or a rectangle). Thanks for finding it and posting there a link to my report, hopefully this will help solving the problem faster and close a few reports at once :)

Revision history for this message
Tom Davidson (tjd-mit) wrote :

The perspective extension should give a useful error message when the user attempts to apply it to a non-path object.

Changed in inkscape:
importance: Undecided → Medium
status: New → Confirmed
Revision history for this message
Bryce Harrington (bryce) wrote :

I suspect the issue is we just need a motivated python hacker to whip the perspective extension into shape. Marking as confirmed for now.

Changed in inkscape:
importance: Medium → High
Revision history for this message
Simon Dahlbacka (simon-dahlbacka) wrote :

Attached is a simple patch that at least provides a better error message about object not being a path.

Revision history for this message
Kattekrab (donna) wrote :

Also - the order in which the items are selected is important.

Unless you select the object first, even if it is already a path - you get the error.

See details from my report here:
https://bugs.launchpad.net/inkscape/+bug/168336

Has anyone tested the above patch? does that work? help?

Agree this is a usability issue. The application doesn't crash - but it's an ugly ugly error for a non-technical user.

Revision history for this message
Alvin Penner (apenner) wrote :

I will try to test the above patch within the next week or so, and if it looks promising, and if no one objects, I'll commit it.

Revision history for this message
Kattekrab (donna) wrote :

Hey Alvin - that would be cool!

heathenx has a screencast about using perspective:
http://screencasters.heathenx.org/episode-015/

and in the comments someone notes that the behaviour changed between version .45 and .46

"In Inkscape 0.46, you have to choose the shape to be transformed first and then the perspective path shape - the opposite of 0.45 it seems."

Revision history for this message
Alvin Penner (apenner) wrote :

- the patch by Simon, with a bit more detail added depending on the type of object selected, has been committed to svn rev 20310.
- this does not solve the original issue, which is the need for a path, but it gives the user some indication of what to do next, and why the problem occurred.
- the new python file is attached.

Revision history for this message
Kattekrab (donna) wrote :

This patch has greatly improved usability. It would be even better if it also picked up the selection order issue - selecting the object to be modified first and then the perspective path works, but the reverse doesn't.

Thanks to all for efforts on this.

Also see:
https://bugs.launchpad.net/bugs/168336

Revision history for this message
bbyak (buliabyak) wrote :

looks like this is already committed?

Changed in inkscape:
status: Confirmed → Fix Released
Revision history for this message
Alvin Penner (apenner) wrote :

yes, the patch to avoid the error message has been committed

Changed in inkscape (Ubuntu):
status: New → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.