-
-
Notifications
You must be signed in to change notification settings - Fork 1
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
Possibility of adding the pretty printing of Custom Resources? #2
Comments
Seems reasonable! I don't use custom resources that much, it's something i really need to learn more about. I'll dig around for an obvious catch-all for what data should be exposed (e.g. for PackedScenes we now show a Either way, if you have a custom resource with a script attached, you can already implement |
Probably makes sense to go through the InheritedBy list here: https://docs.godotengine.org/en/stable/classes/class_resource.html#class-resource I'll take a shot at adding support for a bunch of these soon! |
That would be lovely, if I can help out somewhere I'd be glad to contribute As for the printable that looks useful, I'll look into it, tyvm :D |
I haven't gotten to that list of Resource-derived classes yet - hopefully in the next week or two. In the meantime I've restructured a bit to support more types, which led nicely into an overwrites 'registry' of sorts - on the latest git version you can now register a handler for whatever type. Right now this looks like this unit test: func test_custom_resource_register_overwrite():
var tp = TestPlayer.new()
tp.name = "Hanz"
tp.level = 3
Log.register_overwrite(tp.get_class(), func(msg, _opts):
return Log.to_pretty({name=msg.name, level=msg.level}))
var val = Log.to_pretty(tp)
assert_str(val).is_equal(
"[color=red]{ [/color][color=magenta]\"name\"[/color]: [color=pink]Hanz[/color][color=red], [/color][color=magenta]\"level\"[/color]: [color=green]3[/color][color=red] }[/color]"
) This should let folks add handlers for types they don't own, which should be nice. I expect to refactor the implementation itself to use this registry as well. I also decided to support Feel free to let me know if you think these things are useful, or if you have any related ideas/opinions! |
Hi, this looks very nifty, learned a lot looking through the code :)
I was wondering if the functionality of pretty printing custom resources would be doable to implement?
Thank you 👍
The text was updated successfully, but these errors were encountered: