XLIVE99 / AutoGrid

Autotile system for gridmap in godot engine
MIT License
55 stars 3 forks source link

Bug: Can set bitmasks while parent mesh is invisible. #7

Open programnoir opened 1 month ago

programnoir commented 1 month ago

image

Here in this screenshot you'll notice that one of my tiles is visible while another tile isn't. So I believe I'm editing the bitmasks for the visible tile. However, because I happen to have the hidden tile selected, my changes are actually being made to the bitmasks of the hidden tileset, and not the bitmasks I want to edit.

The main way I can think of to mitigate this confusion would be to block the change from occurring (likely by checking if the parent is visible). On my end, I also have it set so that when you select a MeshInstance3D with an AutoGrid_Bitmask node, it enables and shows the bitmask until you choose another MeshInstance3D tile. Doing so will hide and deactivate the previous tile's bitmask, making it a little easy to switch between tiles.

from core.gd:

func _handles(object) -> bool:
    if is_instance_valid(currentMeshInstance) && currentMeshInstance.has_node("AutoGrid_Bitmask"):
        currentMeshInstance.hide()
        currentMeshInstance.get_node("AutoGrid_Bitmask").deactivate()
    if object is GridMap:
        activateButton.hide()
        return true
    elif editMode && object is MeshInstance3D:
        object.show()
        activateButton.show()
        if( object.has_node("AutoGrid_Bitmask") ):
            #   .activate() is handled in _edit()
            object.get_node("AutoGrid_Bitmask").show()
        return true
    activateButton.hide()
    return false

I also noticed a mild user issue if you happen to misclick. If you don't click on the bitmask boxes and then click them again, the AutoGrid_Bitmask node gets selected, and you apparently cannot adjust the bitmask that way. It'd be an excellent improvement if the plugin was flexible enough to just helpfully set the bitmask the user is going for, when this happens.

XLIVE99 commented 4 weeks ago

Bitmask should less visible when not selected, like this (Godot 3.4): image I might forgot something while upgrading the plugin to support godot 4.x. Thanks for reporting, I will fix this issue shortly.

XLIVE99 commented 3 weeks ago

Can you try newly published (v1.3) version?