RageLeague Posted May 24, 2020 Share Posted May 24, 2020 Is there a way of exporting .tex file to .png file? .tex file in Griftlands doesn't work with any general purpose image editing tool like photoshop, so I want to export it to .png. I saw there's an in-game function for exporting textures(engine.inst:SaveTextureToPNG), but I didn't get it to work. Maybe because I put the wrong parameters? Moreover, this function works for exporting card images, but does not work for exporting portraits(if it worked, I have no idea where the exported portrait went). There is no way for me to debug this function's behavior, and there is no indication whether this function succeeded or not other than the fact that lua didn't crash, so I really don't know what this function does. Link to comment Share on other sites More sharing options...
SpicyNiceCream Posted May 24, 2020 Share Posted May 24, 2020 I recall there's a tool somewhere in the DST forums which I'm DEFINITELY too dumb to figure out how to use. Link to comment Share on other sites More sharing options...
RageLeague Posted May 24, 2020 Author Share Posted May 24, 2020 There is a tool, and I tried it. It didn't work for Griftlands. That one file that is larger than the others caused a System.OutOfMemoryException, and the rest tells me it's the wrong format. Link to comment Share on other sites More sharing options...
wangyi041228 Posted May 24, 2020 Share Posted May 24, 2020 Try https://github.com/nsimplex/ktools Link to comment Share on other sites More sharing options...
RageLeague Posted May 24, 2020 Author Share Posted May 24, 2020 3 hours ago, wangyi041228 said: Try https://github.com/nsimplex/ktools Have you tried this on Griftlands and did it work? Link to comment Share on other sites More sharing options...
Developer ricardopinto Posted June 5, 2020 Developer Share Posted June 5, 2020 On 5/23/2020 at 7:30 PM, RageLeague said: I saw there's an in-game function for exporting textures(engine.inst:SaveTextureToPNG), but I didn't get it to work. Maybe because I put the wrong parameters? Moreover, this function works for exporting card images, but does not work for exporting portraits(if it worked, I have no idea where the exported portrait went). If you run the MainMenu:ExportPortraits() function, it goes through all the named agents in the game, instantiates their anim, positions them correctly, crops them and exports a PNG of their portrait to contentsrc\images\portraits (in the game's installation folder). That's how we generate updated portrait textures for each character. You can tweak that to be able to export other widgets. Link to comment Share on other sites More sharing options...
RageLeague Posted June 5, 2020 Author Share Posted June 5, 2020 13 hours ago, ricardopinto said: If you run the MainMenu:ExportPortraits() function, it goes through all the named agents in the game, instantiates their anim, positions them correctly, crops them and exports a PNG of their portrait to contentsrc\images\portraits (in the game's installation folder). That's how we generate updated portrait textures for each character. You can tweak that to be able to export other widgets. I assume that the button under tools does the same thing? My problem is that nothing is generated under my game installation folder, at least in the experimental version, even though I pressed "export portrait" Link to comment Share on other sites More sharing options...
Developer Kevin Posted June 5, 2020 Developer Share Posted June 5, 2020 I looked into it, and there are a couple of things stopping the engine savetopng from working the way you're expecting. I'll wrap it in something that will make it useable and push it out in experimental tonight. (edit) If you're keen, this is the code: function UIHelpers.SaveTextureAsPNG(texture, filename) local w, h = texture:GetSize() local scene = engine.rendering.Scene() local capture = Widget.CaptureImage(scene):SetSize( w, h ) local container = Widget() local anim = container:AddChild(Widget.Image(texture):SetSize(w,h)) local root = engine.rendering.SceneGraphNode() root:SetScene(scene) root:AddChild(container.node) capture:RenderToScene( container, -w/2, -h/2, w/2, h/2 ) engine.inst:SaveTextureToPNG( capture:GetTexture(), "SETTINGS:"..filename .. ".png" ); end It saves stuff one directory up from where your save files usually go. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.
Please be aware that the content of this thread may be outdated and no longer applicable.