Game Development Community

dev|Pro Game Development Curriculum

GuiObjectView Update

by Xavier "eXoDuS" Amado · 03/31/2003 (11:15 am) · 37 comments

Download Code File

I won't go into much explanations here, because I really don't have the time to do so now.
To install this simply copy the two provided files (guiObjectView.cc and guiObjectView.h) to the engine/gui/ directory and add them to your Visual Studio Project or your Gcc makefiles or whatever you are using.
I've added a new parameter callled parentName, here you have to pass in the parent's name you specified when loading the object. Here's an example:
View.setObject("Block", "base/data/shapes/engine/block.dts", "", "");
View.mountObject("Intake", "base/data/shapes/engine/intake.dts", "", "Block", "mount0", 0);
View.mountObject("Carb", "base/data/shapes/engine/carb.dts", "", "Intake", "mount0", 0);
View.mountObject("Alternator", "base/data/shapes/engine/alternator.dts", "", "Block", "mount1", 0);

Technically, I've added a new member variable to the mesh structure to store the parent index and made it use the parent object to obtain the translation matrix when drawing instead of using the main object's translation. This change allows you to mount objects on top of each other to do... dunno... complex illustrations in an object view. I've personally done this to be able to put together an engine. The picture shows a very rudimentary engine (programmer art) with 4 pieces: Block, Intake Manifold (mounted on Block), Carburator (mounted on Intake) and Alternator (mounted on Block).
I had to change a bit more of code in the already mounted checks and some more bits of code, but nothing fancy, you can compare both files to see all the changes.

Have fun and report any bugs.
Credits given to all the people that worked on this, in the source files.
Page «Previous 1 2
#1
03/27/2003 (3:47 pm)
Forgot to mention I did this in barely 30 minutes aproximately, so It might contain bugs or might not work at all in certain situations. Please let me know if this happens, It's working for me until now.
#2
03/31/2003 (2:28 pm)
Is there any differance from this GuiObjectView and the one Loonatik and I made Here ?
#3
03/31/2003 (4:25 pm)
Can you read the resource again?
#4
04/02/2003 (11:28 am)
I made some updates to this object also (adding skin swapping support, exposed the camera to the scripting system, fixed some mounting issues, etc).

We should roll all these changes into one resource I think. I asked Loonatik about posting my version already, and he said ok.

But I am out of the loop right now, when I get back in I'll post mine.
#5
03/31/2005 (9:25 pm)
Soo... How goes it, do we have resource yet?
#6
05/26/2005 (10:41 pm)
To get this to compile with CVS HEAD (aka 1.4rc1) I had to make the following changes...

1) I copied the .cc and .h files into engine/gui/utility.

2) In engine/gui/utility/guiObjectView.h find:
#include "gui/guiTSControl.h"
and replace it with:
#include "gui/core/guiTSControl.h"

3) In engine/gui/utility/guiObjectView.cc find:
#include "gui/guiCanvas.h"
#include "gui/guiObjectView.h"
and replace it with:
#include "gui/core/guiCanvas.h"
#include "gui/utility/guiObjectView.h"
#7
06/27/2005 (10:59 pm)
Getting this error during clean..

make -k
--> Compiling gui/guiObjectView.cc
In file included from gui/guiObjectView.cc:13:
gui/guiObjectView.h:127:28: warning: no newline at end of file
gui/guiObjectView.cc: In member function `void
GuiObjectView::meshObjects::unLoad(int)':
gui/guiObjectView.cc:495: warning: assignment of negative value `-1' to `U32'
gui/guiObjectView.cc:495: warning: argument of negative value `-1' to `unsigned
int'
gui/guiObjectView.cc: In member function `void
GuiObjectView::meshObjects::Clear()':
gui/guiObjectView.cc:563: warning: assignment of negative value `-1' to `U32'
gui/guiObjectView.cc:563: warning: argument of negative value `-1' to `unsigned
int'
--> Linking out.GCC3.RELEASE/torqueDemo.exe


Is that cool?

PS: Im still on 1.3
#8
07/07/2005 (8:17 am)
If you check the assignment for [detail], you will see it is created as a U32 not a S32,
TSMesh is expecting a S32 value...

Just change it in guiObjectView.h

Quote:
struct meshObjects {
private:

public:
meshObjects();
~meshObjects();

struct meshs {
private:

public:
meshs();
~meshs();

TSShapeInstance* mesh;
char name[32];
U32 mode; // 0 = normal, 1 = animated
S32 node;
S32 parentNode;
S32 parentIndex;
S32 detail;

This should fix it...
#9
07/30/2005 (7:00 pm)
Do I have to #include the guiObjectView.h to any other .h file?
#10
08/05/2005 (9:02 am)
Figured it out... "Make Clean" will create new make files with the new files included.
#12
10/18/2005 (2:18 am)
I'm using the guiObjectView control to display a segmented model and I've found some odd positioning problems.

1st of all, I was under the impression (for some reason) that a node called MountPoint on the mounting object would be used when mounting to node mountX on the base object, but it's not. It uses the mounting objects' 0,0,0 origin point.

2nd, strange things happen when the model I'm using as the base model is above the origin... My example is simple.
I have a Hover Tank made from 3 parts. A base unit, a Turret and a weapon. The base unit is positioned above the origin.
The base unit is the main object added using AddObject,
the turret is mounted to the base unit via MountObject onon mount0..
then the Weapon is mounted onto the turret using MountObject on mount0

The turret is in the correct place, but the weapon appears underneath the mainbody. I've checked and double checked the mount points, I've tried adding new mount points and using those.. When I move the mount point on the turret, the weapon's position is altered accordingly, but it's still too low in the Y-axis, still appearing below the tank.

Yet I have another segmented model of a soldier, made from armour, head and helmet.. this appears fine (once I'd figure out the origin was used instead of mountpoint) so it has to be something to do with the arrangement of the bones, but I don't know what.

Has anyone else found this problem or has a fix for it?
#13
10/22/2005 (10:18 am)
I'm having a small problem with this. When I load in my own model, it flickers, and, once I enter the GUI editor, in the console it gives a "Set::getObject Index out of range." What is that and how do I fix the flickering? When I run the example that comes with the source, the thing works great, but when I sub the model for my own it gives me the flickering again.
#14
10/24/2005 (2:26 am)
Does it flicker constantly or just once?

Where are you loading your model?
In the wake event of the form?.. that's where I'm loading mine and i don't have a problem. In fact, I've never seen it flicker at all.
Are you loading using a scheduled function?
What are you building your models using?
Does your object show up OK in game?
#15
10/25/2005 (6:49 am)
I want to be able to position my base model independantly to the cameras view..

I know this is a fairly simple change, but I'm crap with matrixes and I was wondering if anyone else has done the same...

I'm imagining a function called SetBaseOffset( X,Y,Z ); which alters the origin of the main model.

Also, If anyone else's managed to look into the mounting mounted objects of mounted objects problem I discussed above, I'd appreciate some feedback.
#16
10/30/2005 (1:56 am)
How do you go about creating a background color for the object viewer? Such as having you objects appear against a black background?
#17
10/31/2005 (1:50 am)
Create a bitmap control behind the object viewer on the form. The GuiObjectViewer does not render anything apart from 3D objects. If you want to place a graphic or a solid colour behind it, you can do that easily in the GUI editor.

This approach whilst initially looking like a failing of the object viewer is in fact a good thing.
If the GUI object viewer provided a facility to have a solid colour background then you can guarentee that someone else would want a bitmap background and then someone else would want an animated bitmap background and someone else would want a movie.... Adding all of these features would bloat out the control and all of these things exist in the GUI editor anyway, just have to apply the one you want behind the ObjectViewer and Bob's your Uncle...

I have GuiObject viewers on top of other GuiObject Viewers, A background would certainly not work for me.

(apologies for any implied negaitive tone, It's monday morning and I've got a cold :-) )

Hope this helps.
#18
10/31/2005 (6:10 am)
Actually, Jason that is exactly what I needed to hear. Thank you and I hope get well soon.
#19
11/01/2005 (11:36 pm)
Hmm this is weird. when i first do an object set, my object fills the extent of the guiobject, however, if i press f10, the model shrinks to about 1/2 it's size and stays that way even if i exit the gui editor.... the extent of the gui element stays the same.... is it just me?

Also, are there any ways to adjust were the focus point of the camera is and the zoom and all that other stuff?
#20
11/11/2005 (11:47 am)
Ok, sorry for replying so far after my first post. Kinda forgot about it. Anyway, the object's are created using 3D Studio Max 6. I've done everything that the tutorials tell me to do to make it work in-game, and they work fine in-game, it's just that when using the guiobjectview, the model flickers constantly. I thought it might be because it isn't textured, but even applying a texture does nothing.
Page «Previous 1 2