irei1as Posted March 18, 2016 Share Posted March 18, 2016 -Using basic lightning-First I start a new mission and open the gui editor so I can change playGui.guiThen 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.http://i.imgur.com/C1c8ig1.pngIs 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 callbackfunction 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 ); Quote Link to comment Share on other sites More sharing options...
Steve_Yorkshire Posted January 29, 2017 Share Posted January 29, 2017 Thanks for this @irei1asSetting 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"); } Quote Link to comment Share on other sites More sharing options...
Steve_Yorkshire Posted January 30, 2017 Share Posted January 30, 2017 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. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.