Skip to content
New issue

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

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

Already on GitHub? # to your account

Add a BitMap preview to the inspector #4307

Closed
Tracked by #7
fire-forge opened this issue Mar 30, 2022 · 10 comments · Fixed by godotengine/godot#60008
Closed
Tracked by #7

Add a BitMap preview to the inspector #4307

fire-forge opened this issue Mar 30, 2022 · 10 comments · Fixed by godotengine/godot#60008

Comments

@fire-forge
Copy link

Describe the project you are working on

Implementing marching squares for use in a 2D level generator

Describe the problem or limitation you are having in your project

The BitMap resource doesn't have any way to preview it without writing any code. Being able to visually see the BitMap in the inspector would be useful for debugging or testing code in the remote inspector, and for previewing TextureButton.texture_click_mask and TouchScreenButton.bitmask (which are the only two properties of built-in nodes that use BitMap).

Describe the feature / enhancement and how it helps to overcome the problem or limitation

The preview will be very similar to the Texture2D preview, but with an option to switch between image and polygon preview mode. Image mode uses BitMap.convert_to_image() and polygon mode uses BitMap.opaque_to_polygons().

Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams

I made an example of this as a GDScript plugin. It has a polygon mode toggle button at the top and a label that displays the BitMap's size in the bottom right.

Image Mode Polygon Mode
Image mode Polygon mode

After this is discussed, I can convert this plugin to C++ and open a pull request.

If this enhancement will not be used often, can it be worked around with a few lines of script?

You can create an in-game preview with GDScript, but that doesn't help much in the case of TextureButton/TouchScreenButton click masks.

Is there a reason why this should be core and not an add-on in the asset library?

BitMap is core, and most other visual resources (such as Texture, Mesh, Font, Gradient, StyleBox, etc.) have previews in the inspector.

@fire-forge
Copy link
Author

After thinking about it some more, I don't think the polygon mode is needed. It's seems like a gimmick that would probably almost never be used.

When I open a PR for this, it will only be able to display the BitMap as an image. That will also cut down on the lines of code needed by a lot, because I can just use a TextureRect instead of having to make a custom node that can handle both image and polygon display modes.

@Xrayez
Copy link
Contributor

Xrayez commented Apr 11, 2022

That's a very handy and simple feature! I'd import images as BitMap more often if Godot had this.

If interested, feel free to implement this in https://github.com/goostengine/goost (Godot 3.x), and lets get this merged right away. 🙂

@fire-forge
Copy link
Author

@Xrayez I have a PR open for it already (godotengine/godot#60008). It has 2 reviewers so far, so it shouldn't take long enough for it to get merged to justify adding it in Goost first. But thanks for asking! I'm open to possibly contributing to Goost in the future.

@Xrayez
Copy link
Contributor

Xrayez commented Apr 12, 2022

Yeah, I'm aware that you have a PR already opened in Godot, that's why I'm asking. Reviews do not guarantee a merge in Godot. I've literally had PRs that were one year old before they got finally merged in Godot godotengine/godot#19936 (comment).

If you really want to wait for Godot, then I recommend waiting a maximum of one month. But considering that this proposal does not seem to gain much user support, I suggest alternative ways to contribute in a more community-driven way. 🙂

@Calinou
Copy link
Member

Calinou commented Apr 12, 2022

If you really want to wait for Godot, then I recommend waiting a maximum of one month. But considering that this proposal does not seem to gain much user support, I suggest alternative ways to contribute in a more community-driven way. slightly_smiling_face

On a conceptual level, I don't see much reason not to merge godotengine/godot#60008. The feature seems useful enough and it's self-contained. Merging will probably take some time to happen, but I don't think that PR will be rejected.

@fire-forge
Copy link
Author

@Xrayez If you'd like to, you can implement this into Goost using godotengine/godot#60008 as a starting point. I don't think I'll have time to do it myself soon.

@Xrayez
Copy link
Contributor

Xrayez commented Apr 16, 2022

Merging will probably take some time to happen, but I don't think that PR will be rejected.

I did not say that PR will be rejected, it's more about the lack of action. But yeah, the lack of action could be considered as a form of rejection, I agree here.

I recommend pinging Akien at Godot contributors chat to speed up merging. But depending on his mood, he might get annoyed and will kick you from Godot. 😄 j/k

If you'd like to, you can implement this into Goost using godotengine/godot#60008 as a starting point

@fire-forge thanks, I don't have much incentive to integrate this now either due to the war in Ukraine, but that's definitely something I'd like to have added in the future (hopefully). 🙂

@fire-forge
Copy link
Author

fire-forge commented Apr 16, 2022

Well, that's quite a negative way to think about it. I don't think they're necessarily rejecting it by taking a long time to merge, more like they just don't have nearly enough reviewers for the number of PRs Godot gets every day. It seems that finances are tight for the Godot developers right now, so I can't blame them. They do a great job with what they have. If someone leaves a suggestion, I'll respond to it, but I'm not going to ping Akien as that probably would be annoying.

Also, I'm sorry to hear about how the war in Ukraine is affecting you.

@Xrayez
Copy link
Contributor

Xrayez commented Apr 16, 2022

Well, that's quite a negative way to think about it.

Well, I haven't asked you to evaluate my way of thinking, so it isn't pretty from your part to say this.

I don't think they're necessarily rejecting it by taking a long time to merge, more like they just don't have nearly enough reviewers for the number of PRs Godot gets every day.

That's not the only time I hear something like this to be honest. But yeah, lets see how long it will take for this feature to get merged, only time will tell. 🙂

I don't think they're necessarily rejecting it by taking a long time to merge

I did not say this.

Also, I'm sorry to hear about how the war in Ukraine is affecting you.

I also hope that you're sorry about the war itself, not just the way it may or may not affect me. But thanks regardless.

@fire-forge
Copy link
Author

I also hope that you're sorry about the war itself, not just the way it may or may not affect me. But thanks regardless.

Yes, I'm sorry about the war itself and all of the Ukrainians who are being hurt so badly by it. I don't believe war is a good thing, ever. It's my mistake for not making that clear in my original message.

# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants