Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added Perf-Info button to Dump a system to systemeditor compatible JSON #5888

Merged
merged 3 commits into from
Aug 12, 2024

Conversation

fluffyfreak
Copy link
Contributor

Whilst debugging #5885 and #5830 today I wanted a quick way of getting a dumped system into the system editor so I've added a 2nd button to the Perf-Info screen which already allowed dumping the JSON to the output log.

Instead it now generates a JSON file which can be directly loaded into the system editor for viewing / modification and outputs it into the users pioneer directory where screenshots, savefiles, etc folders are located.

This should also make it easier for people to create custom systems based on generated ones they've found interesting to make that process a little easier.

@fluffyfreak
Copy link
Contributor Author

I apologise for the terrible grammar / phrasing above, it's the weekend, clearly my brains know that! 😆

@impaktor
Copy link
Member

Welcome back!

I assume it then deprecates the code snippet I have on my local copy for adding system export (to lua!) from debug screen (adds a "system" tab with an export button)

-- Copyright © 2008-2024 Pioneer Developers. See AUTHORS.txt for details
-- Licensed under the terms of the GPL v3. See licenses/GPL-3.txt

local Game = require 'Game'
local ui = require 'pigui'
local debugView = require 'pigui.views.debug'

local Lang = require 'Lang'
local l = Lang.GetResource("ui-core")


debugView.registerTab("System-debug", function()
	if Game.player == nil then return end
	if not ui.beginTabItem("System") then return end

	if ui.button("Export system", Vector2(100, 0)) then
		Game.system:ExportToLua()
	end
end)

@fluffyfreak
Copy link
Contributor Author

Different results but the same idea, one is to Lua the other to JSON 🤷

@Web-eWorks
Copy link
Member

I completely forgot I originally added the button to the perf info window, or I'd have updated it myself - thanks, this will be useful.

The original plan was for the system editor to have an embedded sector map and be able to visually pick systems to edit, but this way means you don't have to load the editor and remember the system you wanted to edit.

I'll take a look at the comment field - it "should" be entirely optional and if it's not that's my bad.

src/pigui/PerfInfo.cpp Outdated Show resolved Hide resolved
@Web-eWorks Web-eWorks merged commit 255d5d7 into pioneerspacesim:master Aug 12, 2024
5 checks passed
@fluffyfreak fluffyfreak deleted the ExportSystemToJSON branch August 12, 2024 20:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants