Adding image to Scene - weird scale/sizing

General discussion about the R.U.B.E editor
Post Reply
bsbuser
Posts: 2
Joined: Tue Jan 27, 2015 9:55 pm

Adding image to Scene - weird scale/sizing

Post by bsbuser »

Hello,

Firstly, thank you for this excellent software!

I have a question about the process of adding an Image to the editor:

I see that whatever be the original size of the images, the editor always shrink or expand so that the imported image starts with a height of one "world unit".

Explaining with examples: Suppose I have two images: one for a character's head, and another one for his sunglasses. Let's say the head image is 100x100 pixels and his sunglasses are 80x30 pixels. When I Add these images to the Editor, both of them receive "1" for the property "Height (world units)".
What happens is that the sunglasses look huge compared to the head image, because both images are now stretched vertically to the same size.

This is a bad thing because I have many "image pieces" to assemble my characters and every single piece I import to the editor get this "height of 1 unit". It takes too much time to scale images to their correct sizes, and it is not an easy task.

So... am I missing something? I tried looking at both Tools->Options and Scene->Settings but couldn't find any option to turn this "auto scaling" off.

Thanks in advance!
Last edited by bsbuser on Wed Jan 28, 2015 11:11 am, edited 1 time in total.
iforce2d
Site Admin
Posts: 861
Joined: Sat Dec 22, 2012 7:20 pm

Re: Adding image to Scene - weird scale/sizing

Post by iforce2d »

That's correct - scaling images to match their pixel sizes will require a 'pixel to meter' ratio to be defined. You can find an example of a script that does this here: viewtopic.php?f=7&t=40

There are a few ways you could use that script:
- keep it in the 'scratchpad' of the script panel and hit F5 whenever you need it
- save the script to a file and set up a keyboard hook so that you can hit a number key to run it
- use the 'images dropped' event hook to have it triggered every time images are dropped into the scene

The 'script library' and 'script hooks' section of this video should help explain the last two of those methods.
https://www.youtube.com/watch?v=XM_yYvk3AKk

Note that the script shown in that other post works on the currently selected images, so you would need to select the images you want it to run on before running the script.

For the 'images dropped' event hook case, you can use getDroppedImages() to get a list of the images that were dropped. If you don't always want this image resizing to be done every time you drop images, you could use the queryYesNo() function to ask the user each time whether an automatic resize should be done on the dropped images.
bsbuser
Posts: 2
Joined: Tue Jan 27, 2015 9:55 pm

Re: Adding image to Scene - weird scale/sizing

Post by bsbuser »

Thanks for replying so quick!

I will have a look at those options and video tonight.
I have already considered scripting such conversion but I thought maybe there was a simpler approach (like a preferences option).

I will have a look at those options and video tonight.
Thanks again!
iforce2d wrote:That's correct - scaling images to match their pixel sizes will require a 'pixel to meter' ratio to be defined. You can find an example of a script that does this here: viewtopic.php?f=7&t=40

There are a few ways you could use that script:
- keep it in the 'scratchpad' of the script panel and hit F5 whenever you need it
- save the script to a file and set up a keyboard hook so that you can hit a number key to run it
- use the 'images dropped' event hook to have it triggered every time images are dropped into the scene

The 'script library' and 'script hooks' section of this video should help explain the last two of those methods.
https://www.youtube.com/watch?v=XM_yYvk3AKk

Note that the script shown in that other post works on the currently selected images, so you would need to select the images you want it to run on before running the script.

For the 'images dropped' event hook case, you can use getDroppedImages() to get a list of the images that were dropped. If you don't always want this image resizing to be done every time you drop images, you could use the queryYesNo() function to ask the user each time whether an automatic resize should be done on the dropped images.
Post Reply