Yes, you can relatively easily modify seltrans to draw one more handle, indicating the coordinate origin. The code should not be too difficult to figure out.
I am sorry to bother you again with this, but I couldn't find the right method to retrieve the item's coordinate origin I was referring to. Maybe someone can point me to the right functions again?
What I want to achieve is that a small dot appears at the translation x and y coordinates of the selected item's global transform. So, if the item is newly created, it would be at (0,0) at the upper left corner. When you drag the item around, the point gets dragged too, but it doesn't change when you scale or rotate.
Here's what I did in seltrans.cpp, but it's probably all wrong, so if you know the solution, don't bother reading it:
_myhandle = sp_knot_new(_desktop, _("Translation point of the selected object")); ... SPItem *item = (SPItem*)sp_object_ref(SP_OBJECT(itemList->data), NULL); NR::Matrix globalTransform = item->getRelativeTransform(_desktop->currentRoot()); NR::Coord coords[6]; globalTransform.copyto( coords ); sp_knot_show(_myhandle); sp_knot_moveto(_myhandle, &NR::Point( coords[4], coords[5]) );
The first problem is that I didn't find a method to get a global transform, so I used SPItem::getRelativeTransform and passed _desktop->currentRoot().
Then, I'm not very good with C++ pointers. I couldn't find a way to access the numbers that make up the NR::Matrix. I tried to use NR::Matrix::copyTo to copy the values to a Coord array, but I still don't even know how to pass the Coord values to the NR::Point constructor or printf functions. When I printed the array out, it never changed, so apparently nothing gets copied at all the way I coded it.
But I'm honestly not sure this feature needs to be in the Inkscape trunk even as an option - I don't see how it's useful. Can you provide a few use cases?
I totally agree that this doesn't belong into the trunk. I am trying to create Flash assets with Inkscape and then arrange and animate them dynamically with ActionScript and statically with a tool I am writing right know. For this, I need to know where the actual origin of a shape is, not the center of the bounding box, because the other APIs apply their transformations that way. But since most people use Inkscape to create static graphics, I doubt anyone besides me needs this feature.
_________________________________________________________________ Invite your mail contacts to join your friends list with Windows Live Spaces. It's easy! http://spaces.live.com/spacesapi.aspx?wx_action=create&wx_url=/friends.a...