Bug 393035 - [API] Get Layer Top Left Position?
Summary: [API] Get Layer Top Left Position?
Status: RESOLVED FIXED
Alias: None
Product: krita
Classification: Applications
Component: Scripting (show other bugs)
Version: 4.0
Platform: Microsoft Windows Microsoft Windows
: NOR normal
Target Milestone: ---
Assignee: Krita Bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-04-12 09:41 UTC by X-Raym
Modified: 2019-09-05 08:15 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description X-Raym 2018-04-12 09:41:41 UTC
Hi,

I don't know if it is a bug or not, but I'm trying to get top left x and y layer position with Scripter but I only get 0 0, even if I simply have a shape in the middle of a transparent layer (small than the canvas size).

You can find a code snippet there: https://forum.kde.org/viewtopic.php?f=139&t=151787

Thanks for taking a look !
Comment 1 Scott Petrovic 2018-04-17 16:21:34 UTC
I am not sure exactly what that property is supposed to be returning, but it is not very obvious. 

When I run your script from the forum I get values returned that are not 0, but I can't tell what it is getting back. The node position might be getting a value that is outside the image region. Sometimes when I resize with the crop tool and run that command I get negative numbers.
Comment 2 Halla Rempt 2018-08-13 14:59:59 UTC
Git commit e54fb7a2173e61661d22fedabbad6573386c4ddc by Boudewijn Rempt.
Committed on 13/08/2018 at 14:59.
Pushed by rempt into branch 'master'.

Clarify apidox for Node.position()

M  +3    -1    libs/libkis/Node.h

https://commits.kde.org/krita/e54fb7a2173e61661d22fedabbad6573386c4ddc
Comment 3 Halla Rempt 2018-08-13 15:00:37 UTC
This returns the position of the layer: that is the offset in the image stack, not the topleft of the bounds around the visible pixels. The position only changes if you move the layer.

I've clarified the apidox.
Comment 4 Halla Rempt 2018-09-07 14:16:03 UTC
Git commit 7a7b45847a07d3b20fc21b9980a9f8bbbee16f8a by Boudewijn Rempt.
Committed on 07/09/2018 at 12:36.
Pushed by rempt into branch 'krita/4.1'.

Clarify apidox for Node.position()

M  +3    -1    libs/libkis/Node.h

https://commits.kde.org/krita/7a7b45847a07d3b20fc21b9980a9f8bbbee16f8a
Comment 5 X-Raym 2018-09-07 14:45:25 UTC
@Boudewijn Rempt
Thanks !

But then, how to get "the topleft of the bounds around the visible pixels." ?