[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 5150: file_get_contents(https://freedomsponsors.org/api/project/294): failed to open stream: HTTP request failed! HTTP/1.1 502 Bad Gateway
Two issues with GuiObjectView [Solved] - Forums | Torque 3D

Two issues with GuiObjectView [Solved]

There are no stupid questions, just stupid answers.
3 posts Page 1 of 1
irei1as
Posts: 66
Joined: Fri Feb 27, 2015 5:13 pm
by irei1as » Fri Mar 18, 2016 11:36 am
-Using basic lightning-
First I start a new mission and open the gui editor so I can change playGui.gui
Then I add a GuiObjectView (child to playgui), choose a model and it displays correctly. I save the gui and close the game (end the application, not just end the mission). No problem this first time.

But after starting the program again, the model then shows no texture. And if you use the model elsewhere (like a TSStatic) it keeps not showing textures. It seems the object.cs is not loaded correctly or something.
Image

Is there any way to fix that? Or should I just add dinamically the GuiObjectView -with script and not save it in playGui.gui-?


My other question is if there is any way to avoid that "fog" inside the GuiObjectView so it's fully transparent.

-------------------------------------------------------------------------
-Edit-
The issues were fixed. Let me post them here as reference for anybody looking for this in the future.

A) The lack of texture comes because the exec("...gui") is loaded before the material.cs of the shape.
Two way to fix it:
1- Manually call exec("art/shapes/...(whatever)/material.cs") before exec("playgui.gui") in the init file.
2- (Better but slower)Save the guiObjectView without the shapes loaded and use the callback
function GuiObjectView_name::onWake(%this)
to load them with setmodel(...). -Note: you may want to use an if statement so it's only loaded once(when %this.shapefile $= "").-

B) The fog it's actually a PostFX enabled in the rendering pass. You could change the PostFX or to totally disable it for the gui:
Change in void GuiObjectView::renderWorld( const RectI& updateRect ) of the c++ code of guiObjectView.cpp

SceneRenderState state
(
gClientSceneGraph,
SPT_Diffuse,
SceneCameraState( GFX->getViewport(), frust, MatrixF::Identity, GFX->getProjectionMatrix() ),
renderPass,
true
);

to

SceneRenderState state
(
gClientSceneGraph,
SPT_Diffuse,
SceneCameraState( GFX->getViewport(), frust, MatrixF::Identity, GFX->getProjectionMatrix() ),
renderPass,
false
);
Steve_Yorkshire
Posts: 191
Joined: Tue Feb 03, 2015 10:30 pm
 
by Steve_Yorkshire » Sun Jan 29, 2017 9:42 pm
Thanks for this @
User avatar
irei1as


Setting the sceneRenderThingy to false stopped the horrible fogging and alpha issues and the material loss was fixed by having the gui element reload itself in playGui.onWake().

function PlayGui::onWake(%this)
{
//...

//yorks make guiObjectView reload it's object to prevent material loss
//easier if we have the gui element named
%viewer = "meshViewer";
if(%viewer.isActive())
{
%mesh = %viewer.getModel();
echo("\c4guiObjectViewer is " @ %viewer SPC %mesh);
if(isFile(%mesh))
%viewer.setModel(%mesh);
else
echo("\c2no model");
}
else
echo("\c2nope - no mesh viewer");
}
Steve_Yorkshire
Posts: 191
Joined: Tue Feb 03, 2015 10:30 pm
 
by Steve_Yorkshire » Mon Jan 30, 2017 6:02 pm
Actually after a bit of experimenting it looks like DAE and CACHED.DTS are where it's having trouble. DAE doesn't seem to grab the material and CACHED.DTS needs a reload for material but can't grab animations.
I'm not seeing any problems using straight up ye olde model.DTS.
3 posts Page 1 of 1

Who is online

Users browsing this forum: No registered users and 2 guests