tcobbs / ldview

Real-time 3D viewer for displaying LDraw models
https://tcobbs.github.io/ldview/
GNU General Public License v2.0
87 stars 17 forks source link

Impossible to save snapshot with LatLong parameters #61

Closed jdevosMagento closed 1 year ago

jdevosMagento commented 2 years ago

Hello,

I can't save an image with latitude and longitude parameters

LDView ~/Downloads/3001.dat -DefaultLatLong=0,0 -SaveSnapshot=./image.jpg

The image is saved but without the latitude and longitude value, it works normally without SaveSnapshot.

I want to do a batch to shoot images in all positions

Thank you

tcobbs commented 2 years ago

I'm not able to reproduce the problem on my Mac using LDView 4.4.1. Are you using 4.4.1? Are you using Linux?

jdevosMagento commented 2 years ago

Hello, yes LDView 4.4.1 on Linux Ubuntu 20.04

With : LDView ~/Téléchargements/3001.dat -DefaultLatLong=0,0 -defaultZoom=0,7 -SaveWidth=367 -SaveHeight=367 -Lighting=1 -LightVector=-1,1,1 -OptionalStandardLight=1 -TextureStuds=1 -PolygonOffset=1 -UseQualityLighting=1 -DefaultLatitude=0 -DefaultLongitude=0 -ExamineMode=1

capture_one

With : LDView ~/Téléchargements/3001.dat -DefaultLatLong=0,0 -defaultZoom=0,7 -SaveWidth=367 -SaveHeight=367 -Lighting=1 -LightVector=-1,1,1 -OptionalStandardLight=1 -TextureStuds=1 -PolygonOffset=1 -UseQualityLighting=1 -DefaultLatitude=0 -DefaultLongitude=0 -ExamineMode=1 -SaveSnapshot=./dataset/3001_Brick_2x4/3001_Brick_2x4_0_0.jpg

capture_two

jdevosMagento commented 2 years ago

For information, without save and without -DefaultLatitude=0 -DefaultLongitude=0 -ExamineMode=1 the result in LDView is incorrect :

capture_three

tcobbs commented 2 years ago

@pbartfai Does the Qt version not properly process all the command line arguments for command line snapshots?

pbartfai commented 2 years ago

@tcobbs Qt passes all parameters to the underlaying layer except a few one which is Qt specific.

tcobbs commented 2 years ago

@pbartfai Can you reproduce the problem using a command line similar to the one here?

@jdevosMagento Not really related, but I notice you are expecting the decimal separator to be comma in your -defaultZoom setting. Please note that LDView uses a period as the decimal separator. Also, I'm not sure if settings are case sensitive or not. (It may actually be platform-specific.) But "defaultZoom" should be "DefaultZoom".

jdevosMagento commented 2 years ago

Hello @tcobbs ,

Its Ok with comma, but not with a point : -DefaultZoom=0,7

3001_Brick_2x4_-90_-360

-DefautZoom=0.7 3001_Brick_2x4_-90_-360

Its OK with defaultZoom or DefaultZoom

tcobbs commented 2 years ago

@pbartfai I don't understand how it can be defaulting to the system decimal separator. The setlocale man page states that "C" is the default, and we never set LC_NUMERIC to "" (which would make it default to the system locale instead of "C"). My LDraw model loading code sets LC_NUMERIC to "C" before loading the first LDraw model, but that shouldn't be necessary. I can add code to do that in the TCUserDefault initialization, but I don't understand why it would be necessary. Any ideas?

@jdevosMagento I'm going to be changing it so that decimal numbers on the command line always use a period as the decimal separator. It was supposed to be that way already. That's definitely preventing correct parsing of -DefaultLatLong, but -DefaultLatitude=0 and -DefaultLongitude=0 in your command line should have made that not matter, so something else is going wrong.

tcobbs commented 2 years ago

@pbartfai I added a setlocale call early in the startup:

https://github.com/tcobbs/ldview/commit/f89053a18735f091592489b63d192756c23cc613

jdevosMagento commented 2 years ago

Hello @tcobbs is it possible to change something at home to make the tool work? Or do I have to wait for a new release?

Thank you

tcobbs commented 2 years ago

@jdevosMagento You could in theory compile from source, but doing so would likely require you to install a bunch of development packages. Also, since you already had -DefaultLatitude=0 and -DefaultLongitude=0 on your command line, and they aren't working, I don't really expect this to truly fix -DefaultLatLong for you. (-DefaultLatLong=0,0 should be equivalent to -DefaultLatitude=0 -DefaultLongitude=0.)

jerzyorlowskimim commented 1 year ago

I have the same problem. Linux Version 4.4.1 Qt version 5.12.8. LDView -SaveWidth=1000 -SaveHeight=1000 -DefaultLatLong=0,0 -SaveSnapshot=ldview_snapshots/m1.png 857_motorcycle_c.ldr goves the same output as LDView -SaveWidth=1000 -SaveHeight=1000 -DefaultLatLong=90,90 -SaveSnapshot=ldview_snapshots/m1.png 857_motorcycle_c.ldr

jerzyorlowskimim commented 1 year ago

And guys, This bug is more than one year long.

I have an important business project to do. If You cannot fix it, I might find resource, but You will need to teach me how to debug and compile a new version.

jerzyorlowskimim commented 1 year ago

-DefaultMatrix does not work as well

The terminal gives:


Failed to load translation pl
qt5ct: D-Bus global menu: no```
jerzyorlowskimim commented 1 year ago

I made it work. I had to set -ExamineMode=1 I suggest suggesting updating the help for this option. It is not descibed clearly.

jerzyorlowskimim commented 1 year ago

No, sorry, it is stil not working. LDView -SaveWidth=1000 -SaveHeight=1000 -DefaultLatLong=50,90 -ExamineMode=1 -PreferenceSet=zdjecia1 857_motorcycle_c.ldr gives me: image whereas LDView -SaveWidth=1000 -SaveHeight=1000 -DefaultLatLong=50,90 -ExamineMode=1 -PreferenceSet=zdjecia1 857_motorcycle_c.ldr -SaveSnapshot=ldview_snapshots/m1.png gives:

image

tcobbs-bentley commented 1 year ago

(Sorry, this comment was posted from the wrong account. I redid the comment from my personal account to try to avoid confusion.)

tcobbs commented 1 year ago

@jerzyorlowskimim Some things. First of all, this is a hobby project. Second, I don't run Linux (although Peter does). Third, I'm in the US, and the problem appears to be due to a localization bug. I haven't been able to reproduce it, personally. Finally, try the following (one at a time or together):

pbartfai commented 1 year ago

I have tested the latest source code built on Fedora 37 using Qt 5.15.7 and create different snapshot with different LatLong settings:

./LDView -platform xcb -SaveWidth=1000 -SaveHeight=1000 -DefaultLatLong=0,0 -SaveSnapshot=/tmp/0.png ../../857_motorcycle_c.ldr 0

./LDView -platform xcb -SaveWidth=1000 -SaveHeight=1000 -DefaultLatLong=90,90 -SaveSnapshot=/tmp/90.png ../../857_motorcycle_c.ldr

90

jerzyorlowskimim commented 1 year ago

After setting $LANG to EN_US.utf8.  this doeas not work: LDView -platform xcb -SaveWidth=1000 -SaveHeight=1000 -DefaultLatitude=90 -DefaultLongitude=90 -PreferenceSet=zdjecia1 857_motorcycle_c.ldr  -SaveSnapshot=ldview_snapshots/m1.png

but this does work: LDView -platform xcb -SaveWidth=1000 -SaveHeight=1000 -DefaultLatLong=90,90 -PreferenceSet=zdjecia1 857_motorcycle_c.ldr -SaveSnapshot=ldview_snapshots/m1.png

pbartfai commented 1 year ago

Tested last command with -DefaultLatitude=90 -DefaultLongitude=90 and same problem on both Fedora 37 & Windows. @tcobbs please check.

tcobbs commented 1 year ago

@jerzyorlowskimim Just to confirm: things are working for you with the LANG setting and -DefaultLatLong, correct? I am able to reproduce the problem with -DefaultLatitude and -DefaultLongitude, and will fix it. I believe that the locale-based problem is already fixed in the source code, but that the fix has not yet made it into a release. I'm not sure when the next release will be, but hopefully not too long.

jerzyorlowskimim commented 1 year ago

Yes, I was able to make a correct orientation with corrected LANG settings and -DefaultLatLong.

BTW, I am planning a big R&D project that will combine AI and LEGO design. This will try to use LDView (as well as other LD.com programs) and we would also like to contribute. If any of ld developers is willing to take part of the project, please send me a private messsage.

tcobbs commented 1 year ago

Fixed in LDView 4.5.