Two issues with GuiObjectView [Solved]

There are no stupid questions, just stupid answers.

Two issues with GuiObjectView [Solved]

irei1as
Posts: 63
Joined: Fri Feb 27, 2015 5:13 pm
-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.

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
);

Re: Two issues with GuiObjectView [Solved]

Steve_Yorkshire
Posts: 189
Joined: Tue Feb 03, 2015 10:30 pm

Thanks for this @
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");}

Re: Two issues with GuiObjectView [Solved]

Steve_Yorkshire
Posts: 189
Joined: Tue Feb 03, 2015 10:30 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.

Who is online

Users browsing this forum: No registered users and 1 guest