Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Author
Message
xplosys
18
Years of Service
User Offline
Joined: 5th Jan 2006
Playing: FPSC Multiplayer Games
Posted: 22nd Sep 2017 16:13
I have been looking for a very simple .x model viewer that accepts command line arguments. Does such a thing exist in this forum?
Characters. You build them a world and what do they do? They moonwalk, get stuck in the walls and fall through the floors!
Ortu
DBPro Master
16
Years of Service
User Offline
Joined: 21st Nov 2007
Location: Austin, TX
Posted: 22nd Sep 2017 17:56
Easy enough to make, what arguments are you wanting to pass?

I have a super basic one that you just drop a .x file on the .exe it will open and loop all the animation. Can rotate and zoom and not much else, I mainly use it to test that the animation in general runs properly
http://games.joshkirklin.com/sulium

A single player RPG featuring a branching, player driven storyline of meaningful choices and multiple endings alongside challenging active combat and intelligent AI.
xplosys
18
Years of Service
User Offline
Joined: 5th Jan 2006
Playing: FPSC Multiplayer Games
Posted: 22nd Sep 2017 18:34
Ortu, thanks for your response.

The only arguments I need are model (.x) and texture. If multiple texture types can be used (.bmp, .dds, .jpg, .png, .tga) that would be great; I can convert, but if not then just .dds would be fine.

It would be nice if it were a "run once" program and I could pass those arguments as a refresh and not a new instance, but I can probably get past that.

I will not be using animated models to begin with but your standard loop animation will be a plus. Beyond that, rotate and zoom would be all, and the plainer the interface the better. All operations other than viewing will be handled by my program. I don't even need the standard close - minimize - maximize boxes.

I am attempting to update/improve some FPSC apps and having a viewer would really help.
Characters. You build them a world and what do they do? They moonwalk, get stuck in the walls and fall through the floors!
Kuper
16
Years of Service
User Offline
Joined: 25th Feb 2008
Playing: Planescape:Torment
Posted: 23rd Sep 2017 18:09
xplosys
18
Years of Service
User Offline
Joined: 5th Jan 2006
Playing: FPSC Multiplayer Games
Posted: 23rd Sep 2017 20:18
Quote: "Pretty simple"

I have used that one, but the interface is much too busy for what I'm doing and it doesn't accept command line arguments.
Characters. You build them a world and what do they do? They moonwalk, get stuck in the walls and fall through the floors!
zero32
7
Years of Service
User Offline
Joined: 28th Jul 2016
Location:
Posted: 24th Sep 2017 16:37
this is what i came up with:



you can call it with the windows command line. it just takes 2 arguments. the first is the path and filename of the object file (X, DBO, 3DS, MDL, MD2 or MD3 should work) and the second is the path and filename of a texture file (BMP, JPG, TGA, DDS, DIB or PNG)
i can't make it a single-instance application because i have no idea how mutex work. you could make it so that the app closes if it looses focus, just an idea.
xplosys
18
Years of Service
User Offline
Joined: 5th Jan 2006
Playing: FPSC Multiplayer Games
Posted: 24th Sep 2017 18:38 Edited at: 24th Sep 2017 18:59
@zero32

Cool. Sounds like exactly what I need. Any chance you can compile it as "viewer.exe"? I don't have DBP.
Characters. You build them a world and what do they do? They moonwalk, get stuck in the walls and fall through the floors!
zero32
7
Years of Service
User Offline
Joined: 28th Jul 2016
Location:
Posted: 24th Sep 2017 22:17
sure.

Attachments

Login to view attachments
xplosys
18
Years of Service
User Offline
Joined: 5th Jan 2006
Playing: FPSC Multiplayer Games
Posted: 24th Sep 2017 23:20
I'm going to test this later. I trying to finish a launcher for FPSC tonight. Thank you very much. At first glance I see two things that could change.
One is the title. Would you like to put your name or handle up there? I'll credit you anyway but you may want it up there. Like zero32 Viewer? If not I would rather have just "Viewer" instead of "VerySimpleModelViewer".

Two is the size - it's a little bigger than I need. I'll let you know if I can call it with size after I play around with it.

If you feel I'm being picky just tell me to get lost. I really do appreciate it.
Thanks again.
Brian.
Characters. You build them a world and what do they do? They moonwalk, get stuck in the walls and fall through the floors!
xplosys
18
Years of Service
User Offline
Joined: 5th Jan 2006
Playing: FPSC Multiplayer Games
Posted: 25th Sep 2017 04:07
@zero32
It works great! Thanks for doing this. I can use it as is...
But... If you could make a few changes, it would be better.
1. The name as I mentioned above. "VerySimpleModelViewer" just doesn't seem too professional.
2. I can't call it with size and it covers too much of my program when it opens. If you could make it initially smaller, say half what it is now.
3. Zoom if possible with mouse scroll or button drag?

Again, if you're not interested I understand. Thank you.
[href=http://brianjlizotte.x10host.com/[/href]
Content and tools for games
smerf
19
Years of Service
User Offline
Joined: 24th Feb 2005
Location: nm usa
Posted: 25th Sep 2017 04:13
what are u using it for exactly seems simple enough to make something for you. built a simple editor in the past image attached.
A child's dream never dies.





Attachments

Login to view attachments
xplosys
18
Years of Service
User Offline
Joined: 5th Jan 2006
Playing: FPSC Multiplayer Games
Posted: 25th Sep 2017 04:50
Hi smerf, thanks for your interest.

I'm using it simply as a verification tool for the user to see that he has selected the correct model and texture and what it will look like. It should be painfully plain (viewport only) with no info, labels, buttons, or controls of any kind except rotate and zoom by mouse control. My program will handle all other functions. It just needs to allow 2 command line arguments; model and texture. It should open fairly small (about 400x400 pixels) initially with standard mouse grab resize.

As for the title, please feel free to give it your name (smerf Viewer) or real name or just "Viewer". It should be compiled with the name "Viewer".

If possible, it should be a "run once" program so that I can repeatedly pass models to it in the same window. It should refresh instead of opening a new instance, but that's not critical.

That's all I can think of. Thanks for your consideration.

Brian.

Content and tools for games
smerf
19
Years of Service
User Offline
Joined: 24th Feb 2005
Location: nm usa
Posted: 25th Sep 2017 06:58 Edited at: 25th Sep 2017 07:04
Want to chat my discord server. 1 day invite to accept it. https://discord.gg/swkrTk

should be pretty easy to make a nice simple viewer that take args
A child's dream never dies.





zero32
7
Years of Service
User Offline
Joined: 28th Jul 2016
Location:
Posted: 25th Sep 2017 08:29 Edited at: 25th Sep 2017 13:31
alright i made some changes.

xplosys wrote: "
1. The name as I mentioned above. "VerySimpleModelViewer" just doesn't seem too professional.
2. I can't call it with size and it covers too much of my program when it opens. If you could make it initially smaller, say half what it is now.
3. Zoom if possible with mouse scroll or button drag?
"


1. i removed the title bar completely and made a custom one.
2. the window size is now 480x320px. if i make it 400x400 the model will look stretched.
3. added zoom with mouse scroll

i also added a flag that if set to 1, the window will close if it is not the top window. you can enable it in the command line as a third parameter.
it is 0 by default.

edit: i made some more changes:
now you can pass the following parameters:

so you have more options to play around.

examples:


added some controlls:
rotate,zoom and move, reset view with the [r] key.

tell my if you find bugs or need anything added/changed.

Attachments

Login to view attachments
xplosys
18
Years of Service
User Offline
Joined: 5th Jan 2006
Playing: FPSC Multiplayer Games
Posted: 25th Sep 2017 13:50
@zero32,

This new one doesn't run/show up at all. Wait cursor spins for a few seconds and stops but your window never shows. Maybe because it has no title bar?

Content and tools for games
zero32
7
Years of Service
User Offline
Joined: 28th Jul 2016
Location:
Posted: 25th Sep 2017 15:49 Edited at: 25th Sep 2017 16:12
hm, i made it so that the programm will exit if there are no arguments (if you just doubleclick on the exe) or the path to the model is invalid. if the path to the model contains any space characters then you will need those "" characters.
if i have a path like this:
C:\Tools\Dark Basic Professional\Projects\coin_pusher\coin.x
i would need to run
viewer.exe "C:\Tools\Dark Basic Professional\Projects\coin_pusher\coin.x"
and the app will read the path correctly.

if i run
viewer.exe C:\Tools\Dark Basic Professional\Projects\coin_pusher\coin.x
then the app will try to load
C:\Tools\Dark
because of the space character it thinks the path stops here and cannot load the object and will exit.

in any other case it should atleast give an error message.

if you still have problems, please post the exact command you try to run. maybe i have a bug i don't know of.


edit:
i added a -debug argument.
it will show if my app can parse all arguments correctly.
use it as the first argument. example:
viewer.exe -debug -o "path\to\model"
or
viewer.exe -debug "path\to\model"

Attachments

Login to view attachments
xplosys
18
Years of Service
User Offline
Joined: 5th Jan 2006
Playing: FPSC Multiplayer Games
Posted: 25th Sep 2017 16:04 Edited at: 25th Sep 2017 16:22
Thanks again.
This is what I am calling, straight from the windows run command, and your first app works fine with it.

No spaces in the file name and it's in root dir. There are no errors, just the wait cursor for a moment and then nothing.

I have your first one working through VB and it's great, except for the name and size as I mentioned. I am able to check if it's already running and recycle it each time I send it a new model/texture, so that's fine. I am not able to manipulate the size. I like the idea of the zoom control. I don't know what "help" would be, but remember this is not for the end user. It will be part of another program and my program will handle that. That's why I need it as plain as possible.

Thanks again.

EDIT: Added image in case you ask if files are in folder.

...and I ran the debug version with the same result. The window never appears.

Content and tools for games

Attachments

Login to view attachments
zero32
7
Years of Service
User Offline
Joined: 28th Jul 2016
Location:
Posted: 25th Sep 2017 16:43 Edited at: 25th Sep 2017 17:38
i think i found the error.
try this version and use this command:

i hope this works now


edit:
ok the error must be something different. you say the old version does work and the only thing i could imagine is something in my app that your system does not support, which i think maybe could be the matrix1 commands. i removed them now. that means i also removed the -c argument.


edit 2:
i made a new version based on the first code without all this stuff around it. i just added the controlls and made the window 480x320 by default. this should work.

Attachments

Login to view attachments
smerf
19
Years of Service
User Offline
Joined: 24th Feb 2005
Location: nm usa
Posted: 25th Sep 2017 17:14
should add args for window size, position, resize yes no ,window on off, resolution ect maybe a a byte for a window outline color + a title name if u want it and some error handling.


A child's dream never dies.





xplosys
18
Years of Service
User Offline
Joined: 5th Jan 2006
Playing: FPSC Multiplayer Games
Posted: 25th Sep 2017 19:32
@zero32,
Yes, it works fine.
Quote: "that means i also removed the -c argument."

So what are the arguments now. Just model and texture?
I notice that the port zooms with mouse scroll and button drag. Is it possible to change button drag to re-position the view (drag the model up,down, left, right in the port) or a mouse button key combo (RMB + CRTL) ? What is normally used for that?

@smerf,
Quote: "should add args for window size, position, resize yes no ,window on off, resolution ect maybe a a byte for a window outline color + a title name if u want it and some error handling.
"

Window size and position arguments would be useful. In VB the issue with "window position" is that it can differ from 32 to 64 bit and different systems. It's not reliable. With window size I could get desktop size and start the viewer in a size that wouldn't cover up too much of my program.
I like just the standard "mouse corner grab" for manual resizing. It's what people expect.
I don't know what "window on off is or what it would do.
Resolution, colors not necessary.
Title should just say "Viewer" unless you want to put your name on it.
My program will handle the errors.

Thanks.

Content and tools for games
smerf
19
Years of Service
User Offline
Joined: 24th Feb 2005
Location: nm usa
Posted: 25th Sep 2017 20:36
looks likes zeros on it for the moment, just offering some advice. dbpro will load model textures that are included in the model and usually texture an object decently but the texture obj command is very sloppy since theirs no uv data. recommended just to have and load good models with textures paths .
A child's dream never dies.





xplosys
18
Years of Service
User Offline
Joined: 5th Jan 2006
Playing: FPSC Multiplayer Games
Posted: 25th Sep 2017 20:44
@smerf
Understood and thanks.

Content and tools for games
zero32
7
Years of Service
User Offline
Joined: 28th Jul 2016
Location:
Posted: 25th Sep 2017 22:30
so i added some arguments to change the window position and the size. since it is a 3d app, you cannot simply use any custom size, because the models will look distorted and i am not sure how i could fix this.
but windowed, almost any 4:3 or 16:9 resolution should work. resizing the window by the window border will also distort the view.

now you can rotate the model with LMB, reposition the view with RMB and the middle mouse button and zoom with the mouse wheel or CTRL+LMB (just in case, if, for whatever reason, someone uses a mouse without a scroll wheel)

these are the current arguments:

try this command and insert your values:


i hope it didn't break again...

Attachments

Login to view attachments
xplosys
18
Years of Service
User Offline
Joined: 5th Jan 2006
Playing: FPSC Multiplayer Games
Posted: 25th Sep 2017 23:09
Quote: "i hope it didn't break again..."

Nope. It works well. The rotate-zoom-move is perfect. The size works but no matter what I set the position to, it always opens in the same place. I assume that position (x,y) is based on the top left corner of the window/form? it looks like it opens at about 160,0 give or take.

Also, when you changed the initial window size, did you do it after the window opens? It looks like it opens larger and then kinda jumps to a smaller size. It's a visible resize after it appears.

Content and tools for games
zero32
7
Years of Service
User Offline
Joined: 28th Jul 2016
Location:
Posted: 25th Sep 2017 23:24
ups, i did read the values in, but i didn't reposition the window.
this one should work now.

just for the record and if anyone is interested here is the full sourcecode:

Attachments

Login to view attachments
xplosys
18
Years of Service
User Offline
Joined: 5th Jan 2006
Playing: FPSC Multiplayer Games
Posted: 25th Sep 2017 23:43
Perfect. Thanks so much for all your consideration.
Brian.

Content and tools for games

Login to post a reply

Server time is: 2024-03-29 11:02:31
Your offset time is: 2024-03-29 11:02:31