Show pixel coordinates

General Moho topics.

Moderators: Víctor Paredes, Belgarath, slowtiger

Post Reply
User avatar
Jkoseattle
Posts: 433
Joined: Tue Nov 08, 2016 6:39 pm

Show pixel coordinates

Post by Jkoseattle »

Is it possible for Moho to give me an object's position and size using pixel coordinates and the width and height of an object using pixels instead of this less useful decimal system they use? I'm having to match Moho objects up precisely with non-Moho objects from other applications, and they all speak pixels, but Moho doesn't.

Made exponentially more inconvenient, I might add, by the resize handles only moving an object from the center, which means I can work all I want to get it in precisely the right spot, only to have to start over if the object isn't the exact right size.
Most of the time I'm doing music stuff. Check me out at http://www.jimofseattle.com/music.

Thing I did for work: https://www.youtube.com/watch?v=LgFYGqifLYw
User avatar
Greenlaw
Posts: 9269
Joined: Mon Jun 19, 2006 5:45 pm
Location: Los Angeles
Contact:

Re: Show pixel coordinates

Post by Greenlaw »

Jkoseattle wrote: Thu Jan 19, 2023 10:41 pm Is it possible for Moho to give me an object's position and size using pixel coordinates and the width and height of an object using pixels instead of this less useful decimal system they use?
I don't think so because when you scale an image layer in Moho, you're not actually changing the image's resolution. For example, a 1280x720 image scaled to 25% is still a 1280x720 image, it's just scaled down smaller but not actually reduced in resolution to 320x180.

And the layers themselves don't have pixel dimensions because they don't have edges. Technically a Moho layer might be considered infinite in size (although I'm sure there's a practical limit.)

I think what you want is the current screen area of the bounding box of an image or vector art but I don't think there's a native way to get Moho to report that. Maybe it's possible to script that but I'm not aware of an existing third party tool for that.

For something like this, I like to use a third party program called FastStone Capture which has multiple tools for measuring what I see on my screen: a traditional ruler, a drag out line (like a tape measure), or a rectangular area selection tool (this last one is probably the one you'd use.) BTW, I highly recommend this tool; It also has tools for capturing windows that are larger than the screen, a color sampler, a general purpose drawing program, screen recorder, etc. It's what I use for most of the Images I post to this forum. I've been a fan of FastStone Capture for a couple of decades and I use many of its tools all the time. For me, it's a Swiss Army knife designed for digital artists. :D
User avatar
SimplSam
Posts: 1048
Joined: Thu Mar 13, 2014 5:09 pm
Location: London, UK
Contact:

Re: Show pixel coordinates

Post by SimplSam »

Moho's canvas / world dimensions are:

Center: 0, 0
Height: -1 to 1 (bot to top)
Ratio: Project Pixel Width / Project Pixel Height
Width: -Ratio to Ratio (left to right)

You mentioned objects, but I assume you are talking about images.
Each image (bitmap) that is imported has a Pixel size (actual) and Display size (Project world dims).
One can therefore calculate the Pixel equivalent of the screen representation - using the Image Pixel, Image Display & Project dims, and this can be scripted.

.. and Moho resizes Image layers about the Origin - so you can change that to change how it is resized.
Moho 14.1 » Win 11 Pro 64GB » NVIDIA GTX 1080ti 11GB
Moho 14.1 » Mac mini 2012 8GB » macOS 10.15 Catalina
Tube: SimplSam


Sam
User avatar
hayasidist
Posts: 3526
Joined: Wed Feb 16, 2011 8:12 pm
Location: Kent, England

Re: Show pixel coordinates

Post by hayasidist »

SimplSam wrote: Fri Jan 20, 2023 3:52 am Moho's canvas / world dimensions are:

Center: 0, 0
Height: -1 to 1 (bot to top)
Ratio: Project Pixel Width / Project Pixel Height
Width: -Ratio to Ratio (left to right)
only works like that at default camera / default layer position ... (e.g) zoom the camera or rotate the layer or ... the centre (but not layer origin) and height change -- IOW canvas (render area and/or work area) bounds could be any moho coordinates.

the _screen_ pixel location (as returned in mouseEvent) is dependent on the monitor. Top left of the work area (not the render area) is 0,0; bottom right depends on how wide / tall the window is (IOW depends on (e.g.) size / if docked styles of other windows such as styles / timeline...)

Please correct me if the following is just so much bs, but:
these are the coordinate systems that are used in ScreenToWorld (and vv) conversions;
I don't know of (haven't ever looked for) a "world to render area" conversion (or, indeed, a "give me the render area bounds")
User avatar
hayasidist
Posts: 3526
Joined: Wed Feb 16, 2011 8:12 pm
Location: Kent, England

Re: Show pixel coordinates

Post by hayasidist »

Jkoseattle wrote: Thu Jan 19, 2023 10:41 pm Is it possible for Moho to give me an object's position and size using pixel coordinates and the width and height of an object using pixels instead of this less useful decimal system they use? I'm having to match Moho objects up precisely with non-Moho objects from other applications, and they all speak pixels, but Moho doesn't.
might be easier to do it the other way: pixel to moho once you've imported an image -- there are functions for an ImageLayer class that look as though they'll give you vector data (nope - never used them!)
User avatar
slowtiger
Posts: 6081
Joined: Thu Feb 16, 2006 6:53 pm
Location: Berlin, Germany
Contact:

Re: Show pixel coordinates

Post by slowtiger »

Yes, I struggled with that myself. Strategies I use:

- import everything in one go, or do all the importing before I start any rigging or animating. This way all images are imported at the exact same scale.
- line up stuff by eye, working in deep zoom in view. While the manipulate tool is selected, I can nudge things by 1 or 10 increments with cmd-arrow and cmd-shift-arrow.
- import one reference image as well to line up all stuff to it.
- large background images I construct in several parts, with a bit of overlay (say 10 px) and a fuzzy edge.

You will nearly never get pixel-exact results, to get these you'd need a pixel-based program. But I found Moho exact enough. To avoid blinking gaps I sometimes add another layer with plain black behind the bitmaps.
AS 9.5 MacPro Quadcore 3GHz 16GB OS 10.6.8 Quicktime 7.6.6
AS 11 MacPro 12core 3GHz 32GB OS 10.11 Quicktime 10.7.3
Moho 13.5 iMac Quadcore 2,9GHz 16GB OS 10.15

Moho 14.1 Mac Mini Plus OS 13.5
User avatar
Greenlaw
Posts: 9269
Joined: Mon Jun 19, 2006 5:45 pm
Location: Los Angeles
Contact:

Re: Show pixel coordinates

Post by Greenlaw »

slowtiger wrote: Fri Jan 20, 2023 2:36 pm ...You will nearly never get pixel-exact results, to get these you'd need a pixel-based program. But I found Moho exact enough....
Yeah, I just eyeball things myself, or use non-rendering guides when I need them.

In my line of work--animation and vfx for entertainment media--if it looks right, it's all good. That's very different from my first job, which was a tech artist at Cape Canaveral working on the space program. For some reason, I was expected to be more fussy about measurements back then. :D

Speaking of guides, if you need them in Moho, I highly recommend installing MR_Guides. This is way better than drawing my own guides in a non-rendering layer.
User avatar
SimplSam
Posts: 1048
Joined: Thu Mar 13, 2014 5:09 pm
Location: London, UK
Contact:

Re: Show pixel coordinates

Post by SimplSam »

hayasidist wrote: Fri Jan 20, 2023 11:20 am
SimplSam wrote: Fri Jan 20, 2023 3:52 am Moho's canvas / world dimensions are:
Center: 0, 0
Height: -1 to 1 (bot to top)
Ratio: Project Pixel Width / Project Pixel Height
Width: -Ratio to Ratio (left to right)
only works like that at default camera / default layer position ... (e.g) zoom the camera or rotate the layer or ... the centre (but not layer origin) and height change -- IOW canvas (render area and/or work area) bounds could be any moho coordinates.

the _screen_ pixel location (as returned in mouseEvent) is dependent on the monitor. Top left of the work area (not the render area) is 0,0; bottom right depends on how wide / tall the window is (IOW depends on (e.g.) size / if docked styles of other windows such as styles / timeline...)

Please correct me if the following is just so much bs, but:
these are the coordinate systems that are used in ScreenToWorld (and vv) conversions;
I don't know of (haven't ever looked for) a "world to render area" conversion (or, indeed, a "give me the render area bounds")
Guilty. I should have referenced Render area (purble box), not referenced World coordinates, and also noted the effects of transformations.
Moho 14.1 » Win 11 Pro 64GB » NVIDIA GTX 1080ti 11GB
Moho 14.1 » Mac mini 2012 8GB » macOS 10.15 Catalina
Tube: SimplSam


Sam
User avatar
hayasidist
Posts: 3526
Joined: Wed Feb 16, 2011 8:12 pm
Location: Kent, England

Re: Show pixel coordinates

Post by hayasidist »

hayasidist wrote: Fri Jan 20, 2023 11:38 am
Jkoseattle wrote: Thu Jan 19, 2023 10:41 pm Is it possible for Moho to give me an object's position and size using pixel coordinates and the width and height of an object using pixels instead of this less useful decimal system they use? I'm having to match Moho objects up precisely with non-Moho objects from other applications, and they all speak pixels, but Moho doesn't.
might be easier to do it the other way: pixel to moho once you've imported an image -- there are functions for an ImageLayer class that look as though they'll give you vector data (nope - never used them!)
Now I've had a few moments to look into the API for an image layer... yep -- there are functions in there that (reliably!) convert between pixel and moho coords.


What exactly is the "matching up objects" problem you're trying to solve where the "by eye" method is really not good enough?

e.g. in your bitmap program, you know that (e.g.) a hand (reference point) is at px (400,200) and you want a vector object precisely centred on that. But (e.g. where a PSD is imported in individual layers) the frame 0 layer translations of individual layers are all different and non-zero, so px(400,200) in the bitmap program is actually px(100,10) wrt to the specific image layer once it's been imported into moho...


I can imagine a few situations, such as where you need to sync the animation on an image and vector layer, in which even a small mismatch on frame 0 can lead to wild behaviours later on... but these could possibly be resolved by (e.g.) harmonising the layer transforms of the image and vector layer???
User avatar
Jkoseattle
Posts: 433
Joined: Tue Nov 08, 2016 6:39 pm

Re: Show pixel coordinates

Post by Jkoseattle »

(BTW, I installed FastStone Capture based on your recommendation and I really love it. Thanks! I'm paying for it when my trial runs out.)

I am creating a training course using Articulate Storyline, which includes many slides of content, most of which involve some Moho video. As the user navigates from slide to slide, they should perceive that the video simply picks up from where the previous slide left off. Occasionally objects will move around within one video, and need to remain in the same spot as the subsequent video begins. This ties into one of my most hoped-for Moho features: The ability to create a new project based on a source project, in which the layers are copied into the new project AND the ending positions of all layers are transferred to frame 1 in the new project. This way I can create a project which will pick up exactly where the one before it left off.

If you look at my course, you can see how that is not happening. As the user clicks the Next button, the video shifts slightly. Not a big deal usually, but sometimes it is, and in any case, it's something I always need to work around.

Also, here's a chance to show off what I've been working on! :-) Here's a GIF montage of some of the more interesting moments from the training:
https://drive.google.com/open?id=18ycKo ... p=drive_fs

And here's the whole enchilada:
https://360.articulate.com/review/conte ... 851/review
Most of the time I'm doing music stuff. Check me out at http://www.jimofseattle.com/music.

Thing I did for work: https://www.youtube.com/watch?v=LgFYGqifLYw
User avatar
hayasidist
Posts: 3526
Joined: Wed Feb 16, 2011 8:12 pm
Location: Kent, England

Re: Show pixel coordinates

Post by hayasidist »

Jkoseattle wrote: Fri Jan 27, 2023 6:14 pm I am creating a training course using Articulate Storyline, which includes many slides of content, most of which involve some Moho video. As the user navigates from slide to slide, they should perceive that the video simply picks up from where the previous slide left off. Occasionally objects will move around within one video, and need to remain in the same spot as the subsequent video begins. ...
ok. A thought or two.

I didn't see any non-linearity in the "whole enchilada" ... if so: are you using the videos directly output from separate moho projects? If so, is it feasible for you to collect all the video elements into one moho file and then chop the video into separate files using a video editor?

Or.

in moho project 1: move to a frame just after the end and then: animation / copy current frame / (whole document to <current frame>); save file
copy that file to make moho project 2 and open it.
in moho project 2 move to the "all keys" frame you just created then: animation / copy current frame / (whole document to frame 0); move to frame 0; animation / clear animation > from document

???
User avatar
Jkoseattle
Posts: 433
Joined: Tue Nov 08, 2016 6:39 pm

Re: Show pixel coordinates

Post by Jkoseattle »

I didn't know about the second option, and there are definitely places I could use that; there are a few places where the character intentionally freezes before the user hits the Next button, and that would work for those moments. It's probably worthwhile to try that.

The idea of making one long video and then chopping it up occurred to me as well, but the course was under such flux during its creation that I might be kind of asking for trouble doing it that way. As slide order shifted and new slides got added and others removed, it wouldn't be long before the long Moho project's snippets would be out of sequence, or I'd need multiple versions of a slide, or there would be animation I no longer needed... However, now that you've suggested it, I'm thinking more about it, and if I plan ahead a little, I could do it that way in the future. Most slides have "idle loops" after the character is done speaking, so there's really no way to know the exact position when they go to the next slide, so a little unnatural jumping is inevitable in any case.

BTW what I'm trying to do here is make a portfolio for instructional design work, and this is my flagship project to sell myself. I'm hoping to distinguish myself by using more dynamic animation than other instructional designers who rely on Vyond and its ilk. So these ideas could definitely serve me well moving forward by cutting down on development time. (See brand new thread that this thread has just now inspired me to post....)
Most of the time I'm doing music stuff. Check me out at http://www.jimofseattle.com/music.

Thing I did for work: https://www.youtube.com/watch?v=LgFYGqifLYw
User avatar
Greenlaw
Posts: 9269
Joined: Mon Jun 19, 2006 5:45 pm
Location: Los Angeles
Contact:

Re: Show pixel coordinates

Post by Greenlaw »

Jkoseattle wrote: Fri Jan 27, 2023 6:14 pm (BTW, I installed FastStone Capture based on your recommendation and I really love it. Thanks! I'm paying for it when my trial runs out.)
It's surprising how many features are packed in this tool. Some of my favorites are...

1. Auto-Scrolling Screen Capture. This will auto-scroll your browser or program windows as it captures the image. I use this when I need to capture a long list of items or an entire webpage that's too big to see all at once.
2. Drawing tools. Nothing fancy but great for marking up example images, like the ones I post here in the LM forums.
3. Docking. This is a feature I discovered only last year even though I've been using this tool for almost a couple of decades. I think you need to enable it and when it's on, it auto-docks to the top of your screen, like this...

Image

This makes FastStone always available on-screen, even I'm working remotely through a VPN.

4. The Rulers and Color Picker are super handy too.

This is trivial but I only wish it had modern looking skins because it looks like a Windows XP app...which is probably about when it originally came out I guess. I should contact the developer to see if they can update that. :)
Last edited by Greenlaw on Sun Jan 29, 2023 5:30 pm, edited 1 time in total.
User avatar
Jkoseattle
Posts: 433
Joined: Tue Nov 08, 2016 6:39 pm

Re: Show pixel coordinates

Post by Jkoseattle »

I noticed that right away as well. They certainly aren’t doing themselves any favors by not updating, because if it hasn’t been recommended by you, that wouldn’t have come across as an immediate red flag.
Most of the time I'm doing music stuff. Check me out at http://www.jimofseattle.com/music.

Thing I did for work: https://www.youtube.com/watch?v=LgFYGqifLYw
Post Reply