GuiObjectView, guiPlayerView
by Claude-Alain Fournier · in Torque Game Engine Advanced · 03/02/2007 (4:18 am) · 64 replies
Hi all,
No I don't have a solution. I am restarting this discussion because that's one of the last problem we have in our project after port from TGE to TGEA.
We had this working in a previous TSE release (before MSE 3.5) then after that it does not work and sofar I could not find any one who could make it work.
So I have 2 questions here :
1) Is GG planning to make one of these 2 class work in TGEA one day ? if yes, when (approx...)
2) Is anyone in the GG community who have one of these class working with latest TGEA release ?
If yes, would you care releasing this as a ressource. If not, please contact me to see if we can find an agreement either financial or with code/art exchange.
Thanks in advance.
CAF
No I don't have a solution. I am restarting this discussion because that's one of the last problem we have in our project after port from TGE to TGEA.
We had this working in a previous TSE release (before MSE 3.5) then after that it does not work and sofar I could not find any one who could make it work.
So I have 2 questions here :
1) Is GG planning to make one of these 2 class work in TGEA one day ? if yes, when (approx...)
2) Is anyone in the GG community who have one of these class working with latest TGEA release ?
If yes, would you care releasing this as a ressource. If not, please contact me to see if we can find an agreement either financial or with code/art exchange.
Thanks in advance.
CAF
#43
Funny actually only a couple of lines differ from your code and my code. here is the part that I missed in the render function :
And now it work perfectly.
07/13/2007 (6:03 am)
Woa, thanks for the post James. Funny actually only a couple of lines differ from your code and my code. here is the part that I missed in the render function :
MatrixF ident;
ident.identity();
TSMesh::setCamTrans(ident);
...
gClientSceneGraph->renderScene(DefaultObjectType);And now it work perfectly.
#44
07/24/2007 (4:41 pm)
Darnit. seems to be a snag somewhere in the pipeline this end... after adding in dynamiccubemapping as discussed www.garagegames.com/mg/forums/result.thread.php?qt=65095 getting crashes after loading into game, poping back out, and going back into our lil 'garage'... wonder if has anything to do with the scenegraph...
#45
http://www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=3659
Everything seems to load just fine and the renderworld function is being called but the models aren't rendering to the target area. For now I'm just loading the default player orc. I'm not sure if it has to do with changing some camera parameters or what. Any ideas or an example of setting this up would be greatly appreciated.
08/02/2007 (3:53 pm)
I setup James Laker's Resource (thanks for that) and I was wondering if anyone has an example of using it in the script. I used the script example in the guiObjectView - Mountable Animated DTS Viewer, located here:http://www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=3659
Everything seems to load just fine and the renderworld function is being called but the models aren't rendering to the target area. For now I'm just loading the default player orc. I'm not sure if it has to do with changing some camera parameters or what. Any ideas or an example of setting this up would be greatly appreciated.
#46
http://www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=3659
Everything seems to load just fine and the renderworld function is being called but the models aren't rendering to the target area. For now I'm just loading the default player orc. I'm not sure if it has to do with changing some camera parameters or what. Any ideas or an example of setting this up would be greatly appreciated.
08/02/2007 (4:38 pm)
I setup James Laker's Resource (thanks for that) and I was wondering if anyone has an example of using it in the script. I used the script example in the guiObjectView - Mountable Animated DTS Viewer, located here:http://www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=3659
Everything seems to load just fine and the renderworld function is being called but the models aren't rendering to the target area. For now I'm just loading the default player orc. I'm not sure if it has to do with changing some camera parameters or what. Any ideas or an example of setting this up would be greatly appreciated.
#47
08/03/2007 (10:04 am)
Okay the model (orc) model managed to load once for me in the 100x that I tried viewing it. The rest of the time it doesn't render. I wondering if anyone else has this problem?
#48
if (mBGVisible)
GFX->clear( GFXClearZBuffer | GFXClearStencil | GFXClearTarget, mBGColour, 1.0f, 0);
I had to comment that out in the engine because for some reason the script isn't picking up the visible variable.
08/03/2007 (10:22 am)
Okay fixed. I commented out these 2 lines of code:if (mBGVisible)
GFX->clear( GFXClearZBuffer | GFXClearStencil | GFXClearTarget, mBGColour, 1.0f, 0);
I had to comment that out in the engine because for some reason the script isn't picking up the visible variable.
#49
Thanks very much!
I use your version of guiObjectView, now it's ok!
08/17/2007 (3:36 am)
@ James Laker:Thanks very much!
I use your version of guiObjectView, now it's ok!
#50
The resource works fine for me. First I had problems but I set the orbit modeto an acceptable distance and my model appeared.
@Everyone
I wanted to change the model skins in order to load other materials on the model but nothing worked. So I entered the code and found that in the GuiObjectView::meshObjects::load method all the section which loads the skin is commented out.
So I'm now trying to load the skin. I guess I have two options:
a. Get a reference to the loaded object and hope that the setSkinName works.
b. Fix the skin loading code.
If you have any suggestion (or if you already know how to make this work) please help me.
Luck!
Guimo
08/21/2007 (7:57 am)
@DaveThe resource works fine for me. First I had problems but I set the orbit modeto an acceptable distance and my model appeared.
@Everyone
I wanted to change the model skins in order to load other materials on the model but nothing worked. So I entered the code and found that in the GuiObjectView::meshObjects::load method all the section which loads the skin is commented out.
So I'm now trying to load the skin. I guess I have two options:
a. Get a reference to the loaded object and hope that the setSkinName works.
b. Fix the skin loading code.
If you have any suggestion (or if you already know how to make this work) please help me.
Luck!
Guimo
#51
a. Implement this. It really works and allows you to change materials for models (I never managed to make the default setSkinName work:
http://www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=10957
Note that this method implements:
TSShapeInstance::reSkin(StringHandle& oldMaterial,StringHandle& newMaterial)
This reSkin method will help in GUIObjectView as it depends on the TSShapeInstance.
b. In the GUIObjectView.h add this declaration:
void setSkinName(const char* name, const char* stdMaterial, const char* newMaterial);
c. In the GUIObjectView.cpp add this method (dont forget to add the appropiate declaration in GUIObjectView.h):
Also add this:
In order to use it, write this in your script (sphere is a simple test object):
Guimo
08/21/2007 (10:06 am)
It works now. I may point you in the right direction.a. Implement this. It really works and allows you to change materials for models (I never managed to make the default setSkinName work:
http://www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=10957
Note that this method implements:
TSShapeInstance::reSkin(StringHandle& oldMaterial,StringHandle& newMaterial)
This reSkin method will help in GUIObjectView as it depends on the TSShapeInstance.
b. In the GUIObjectView.h add this declaration:
void setSkinName(const char* name, const char* stdMaterial, const char* newMaterial);
c. In the GUIObjectView.cpp add this method (dont forget to add the appropiate declaration in GUIObjectView.h):
void GuiObjectView::setSkinName(const char* name, const char* stdMaterial, const char* newMaterial)
{
S32 index = mMeshObjects.findMeshByName(name);
if (index != -1)
{ StringHandle stdHandle;
StringHandle newHandle;
if (stdMaterial[0] != '[[4f3e43ad33c9f]]') {
if(stdMaterial[0] == StringTagPrefixByte) {
stdHandle = StringHandle(U32(dAtoi(stdMaterial + 1)));
}
else {
stdHandle = StringHandle(stdMaterial);
}
}
else {
stdHandle = StringHandle();
}
if (newMaterial[0] != '[[4f3e43ad33c9f]]') {
// Use tags for better network performance
// Should be a tag, but we'll convert to one if it isn't.
if (newMaterial[0] == StringTagPrefixByte) {
newHandle = StringHandle(U32(dAtoi(newMaterial + 1)));
}
else {
newHandle = StringHandle(newMaterial);
}
}
else {
newHandle = StringHandle();
}
mMeshObjects.mMesh[index].mesh->reSkin(stdHandle, newHandle);
}
else
{
Con::printf("Error: Could not find object %s", name);
}
} Also add this:
ConsoleMethod( GuiObjectView, setSkinName, void, 5, 5, "ObjectView.setSkinName(name, standarMaterial, newMaterial)" ) {
argc;
GuiObjectView* view = static_cast<GuiObjectView*>( object );
view->setSkinName(argv[2], argv[3], argv[4]);
}In order to use it, write this in your script (sphere is a simple test object):
ObjectView.setObject("sphere", "starter.fps/data/shapes/sphere/sphere.dts", "moai/data/shapes/sphere/base.sphere.png", 0);
//Notice that in the previous line the skin parameter has no effect.
//You cannot force the object to load another material.
//The object will load with its default material which in this case is base.sphere
//Now, change the skin. Here is the catch, the SphereGlow is the Material name, not the mapTo redefinition.
//The setSkinName functions will only accept material names.
ObjectView.setSkinName("sphere", "base.sphere", SphereGlow);Luck!Guimo
#52
....
sirschmoopie/client/ui/objectViewExample.gui (0): Unable to instantiate non-conobject class GuiObjectView.
....
sirschmoopie/client/scripts/objectViewExample.cs (18): Unable to find object: 'view' attempting to call function 'setObject'
sirschmoopie/client/scripts/objectViewExample.cs (21): Unable to find object: 'view' attempting to call function 'loadDSQ'
sirschmoopie/client/scripts/objectViewExample.cs (22): Unable to find object: 'view' attempting to call function 'loadDSQ'
sirschmoopie/client/scripts/objectViewExample.cs (23): Unable to find object: 'Objectview' attempting to call function 'loadDSQ'
sirschmoopie/client/scripts/objectViewExample.cs (24): Unable to find object: 'Objectview' attempting to call function 'loadDSQ'
sirschmoopie/client/scripts/objectViewExample.cs (27): Unable to find object: 'Objectview' attempting to call function 'setSequence'
sirschmoopie/client/scripts/objectViewExample.cs (33): Unable to find object: 'view' attempting to call function 'setEmpty'
Exporting client prefs
I wonder if this issue is VC2005 not connecting the project together or even really compiling it. I mean this is one of the mods to the engine I did and none of them are working. Some of the mods were on existing files too.
vc : ========== Build: 7 succeeded, 0 failed, 0 up-to-date, 6 skipped ==========
08/27/2007 (3:17 pm)
Hi I was coding stuff like this, and then I found it here. This is a great resource :), and compiles fine but I'm getting the following code on console:....
sirschmoopie/client/ui/objectViewExample.gui (0): Unable to instantiate non-conobject class GuiObjectView.
....
sirschmoopie/client/scripts/objectViewExample.cs (18): Unable to find object: 'view' attempting to call function 'setObject'
sirschmoopie/client/scripts/objectViewExample.cs (21): Unable to find object: 'view' attempting to call function 'loadDSQ'
sirschmoopie/client/scripts/objectViewExample.cs (22): Unable to find object: 'view' attempting to call function 'loadDSQ'
sirschmoopie/client/scripts/objectViewExample.cs (23): Unable to find object: 'Objectview' attempting to call function 'loadDSQ'
sirschmoopie/client/scripts/objectViewExample.cs (24): Unable to find object: 'Objectview' attempting to call function 'loadDSQ'
sirschmoopie/client/scripts/objectViewExample.cs (27): Unable to find object: 'Objectview' attempting to call function 'setSequence'
sirschmoopie/client/scripts/objectViewExample.cs (33): Unable to find object: 'view' attempting to call function 'setEmpty'
Exporting client prefs
I wonder if this issue is VC2005 not connecting the project together or even really compiling it. I mean this is one of the mods to the engine I did and none of them are working. Some of the mods were on existing files too.
vc : ========== Build: 7 succeeded, 0 failed, 0 up-to-date, 6 skipped ==========
#53
Now, make sure you compile the Release version of the engine. You may want to compile the Optimized version too for debugging. When you compile, check the cpp has compiled by reading the output. If all was fine, you should have a new TGEA.exe in your example directory.
Luck!
08/28/2007 (8:07 am)
Delete the TGEA.exe and TGEA_debug.exe from the example directory. Then rebuild all your project. Make sure the GUIObjectView.cpp and .h are in the engine/game/hud folder and included in your project using the same folder structure. Now, make sure you compile the Release version of the engine. You may want to compile the Optimized version too for debugging. When you compile, check the cpp has compiled by reading the output. If all was fine, you should have a new TGEA.exe in your example directory.
Luck!
#54
08/28/2007 (3:29 pm)
Thanks Guimo, It worked perfectly seems that VC wasn't actually cleaning the builds and manually deleting the files fixed everything. :)
#55
Is this how it's supposed to work? Meaning: was this meant for missionless gui use only? If so, is there a way to make this work within a mission?
As always, any response is much appreciated!
06/29/2008 (4:02 pm)
I have tried to integrate this resource into TGEA 1.7.1, and use it as a selected object view, but the view always shows my current scene - except scaled. (Picture in picture effect) Is this how it's supposed to work? Meaning: was this meant for missionless gui use only? If so, is there a way to make this work within a mission?
As always, any response is much appreciated!
#56
@Konrad - Are you saying you removed the existing GuiObjectView and replaced it with this one, or that you are trying to use the existing GuiObjectView in 1.7.1?
If you are using the existing one, did you set the model using GuiObjectView.SetModel()? There is a complete working example in the T3D application - see ObjectPickerGUI.cs and ObjectPickerGUI.gui.
If you are trying to use this version of GuiObjectView, then I have no input. Sorry.
06/29/2008 (6:41 pm)
Quote: I have tried to integrate this resource into TGEA 1.7.1
@Konrad - Are you saying you removed the existing GuiObjectView and replaced it with this one, or that you are trying to use the existing GuiObjectView in 1.7.1?
If you are using the existing one, did you set the model using GuiObjectView.SetModel()? There is a complete working example in the T3D application - see ObjectPickerGUI.cs and ObjectPickerGUI.gui.
If you are trying to use this version of GuiObjectView, then I have no input. Sorry.
#57
Forgive me, I wasn't aware of 1.7.1 having a guiObjectView. Thank you for the info and the examples!
06/29/2008 (11:34 pm)
@JaimiForgive me, I wasn't aware of 1.7.1 having a guiObjectView. Thank you for the info and the examples!
#58
I might still require some help if you don't mind. I am using the guiObjectView to view a selected target (for now, the player character) in-game. Is this possible?
Gui:
Init:
and I still get the same in-game results after using the built-in guiObjectView:

I am not sure if it was meant to be used within a missionless gui only, whether the way I am trying to use it is a reasonable one.
06/30/2008 (12:43 am)
@JaimiI might still require some help if you don't mind. I am using the guiObjectView to view a selected target (for now, the player character) in-game. Is this possible?
Gui:
new GuiObjectView(ovPlayer) {
profile = "GuiDefaultProfile";
horizSizing = "relative";
vertSizing = "relative";
position = "200 200";
extent = "100 100";
};Init:
ovPlayer.setModel(%player.shapeFile); ovPlayer.setOrbitDistance(3);
and I still get the same in-game results after using the built-in guiObjectView:

I am not sure if it was meant to be used within a missionless gui only, whether the way I am trying to use it is a reasonable one.
#59
06/30/2008 (2:12 am)
FYI, I use the guiObjectView in AFXA without any problem.
#60
Do you mean you use it in PlayGui? That's where I need it - with a preferably transparent background. I also have AFXA, but that screenshot is all I get. If you got it working over a mission, can you lend me a hand please?
06/30/2008 (6:08 am)
@StevenDo you mean you use it in PlayGui? That's where I need it - with a preferably transparent background. I also have AFXA, but that screenshot is all I get. If you got it working over a mission, can you lend me a hand please?
Torque Owner James Laker (BurNinG)