model_viewer: force absolute path for models passed on the command line
[nit.git] / contrib / model_viewer / src / model_viewer.nit
index 578f660..64c5cba 100644 (file)
@@ -55,12 +55,12 @@ redef class App
                var logo = new Texture("splash.png")
                show_splash_screen logo
 
-               if args.length > 0 then
-                       # Load a model passed as the first command line argument
-                       var model_path = args.first
-                       if model_path.has_prefix("assets/") then model_path = model_path.substring_from(7)
+               # Load all models passed as command line argument
+               for arg in args.to_a.reversed do
+                       # Force an absolute path, this only works on desktop, but so does command args
+                       arg = getcwd / arg
 
-                       var model = new Model(model_path)
+                       var model = new Model(arg)
                        models.unshift model
                end
 
@@ -78,12 +78,12 @@ redef class App
                ui_camera.reset_height 800.0
 
                var prev_sprite = new Sprite(ui_prev,
-                       ui_camera.bottom_left.offset(200, -40, 0))
+                       ui_camera.bottom_left.offset(200, 40, 0))
                prev_sprite.scale = 0.5
                ui_sprites.add prev_sprite
 
                var next_sprite = new Sprite(ui_next,
-                       ui_camera.bottom_right.offset(-165, -40, 0))
+                       ui_camera.bottom_right.offset(-165, 40, 0))
                next_sprite.scale = 0.5
                ui_sprites.add next_sprite
        end