nklbdev / godot-enchanced-tile-map-editor

The addon fot Godot 3.5 that adds alternative rich tile map editor
MIT License
20 stars 5 forks source link

Asking for some usefull Improvements :) #34

Open letsgamedev opened 1 year ago

letsgamedev commented 1 year ago

Hello nklbdev!

We using your plugin for a while now and have some improvements to ask for.

  1. The current scale step is 1.25. That feels too much. 1.1 feels smoother we think :)

  2. With the native tile mapping tools you can hold down CMD+Shift+RightClick to erase an area with a rectangle. Would be super handy in your plugin as well.

  3. The Orange Brush is a bit distracting. It would be nicer if it would be more transparent and more important to see the actual graphic we are about to draw.

  4. Sometimes we use a brush by marking several tiles in the tilemap editor but if we want to erase by right-clicking the brush size of that eraser is still 1x1 tile. That is a bit inconvenient. Would be great if the eraser would have the same size as the brush.

  5. And in general Autotiling support would be great (or did we just not find it?^^)

We know that is a lot. But that would improve the Plugin in our eyes enormously.

Greetings!

nklbdev commented 1 year ago

Hello, Tom!

I'm happy that my plugin helps you in your work. I made some of the changes you asked for.

  1. The current scale step is *1.25. That feels too much. *1.1 feels smoother we think :)

    I've added a palette_zoom_step_factor setting to the project settings so you can choose your preferred palette zoom speed

  2. With the native tile mapping tools you can hold down CMD+Shift+RightClick to erase an area with a rectangle. Would be super handy in your plugin as well.

    I've added line-, rectangle- and fill-behaviors to eraser tool. It works both with an explicitly selected eraser by clicking eraser button and with the eraser on the right mouse button.

  3. The Orange Brush is a bit distracting. It would be nicer if it would be more transparent and more important to see the actual graphic we are about to draw.

    Plugin section in Project Settings There is a plugin settings block in project settings called Enchanced Tile Map Editor (I'm sorry, yes, i know that there is a typo in the word "Enhanced". This was not done on purpose.). In this section you can tune:

    • Сursor Сolor
    • Selection Color
    • Drawn Cells Color
    • Pattern Grid Color
    • Palette Zoom Step Factor (Just added at your request!!! 🎉)
    • Grid Fragment Radius
    • Pattern Grid Fragment Radius
    • Axis Fragment Radius
    • Drawing_area_limit (I do not recommend increasing this number.)

    And the Godot Editor has its own tilemap grid color settings in Editor Settings -> General -> Editors -> TileMap called Grid Color and Axis Color, which is not related to plugins and projects. This plugin uses colors from their values to draw the grid and axes

  4. Sometimes we use a brush by marking several tiles in the tilemap editor but if we want to erase by right-clicking the brush size of that eraser is still 1x1 tile. That is a bit inconvenient. Would be great if the eraser would have the same size as the brush.

    Unfortunately, I cannot currently develop tools that change their size. I'm very busy at my main job right now. I hope the new eraser features described above will be enough for you.

  5. And in general Autotiling support would be great (or did we just not find it?^^)

    Yes, I have implemented these algorithms, but I haven't perfected them to the right degree, and I haven't been able to devote enough time to implement them into the plugin. Forgive me please, I'm too tired now at my main job, and I can't do it. In addition, a fairly stable version of Godot 4 is now out, and I switched to it.

    If you have developers who could understand my code, perhaps they could make this integration for you. This code is commented out. Just select the entire contents of the file and uncomment it with Ctrl+K. The code is very raw. Please don't judge him too harshly. If you manage to integrate it into the plugin, I will be very happy to pull-request!!! 🎉🎉🎉 The source code is in the files:

    • res://addons/nklbdev.enchanced_tilemap_editor/brushes/classic_autotiler.gd
    • res://addons/nklbdev.enchanced_tilemap_editor/brushes/older_terrain.gd
    • res://addons/nklbdev.enchanced_tilemap_editor/brushes/terrain.gd

    And here are experiments on drawing filled polygons on a grid with the possibility of self-intersection:

    • res://addons/nklbdev.enchanced_tilemap_editor/algorithms_polygon.gd
    • res://addons/nklbdev.enchanced_tilemap_editor/algorithms_polygon_my.gd
letsgamedev commented 1 year ago

Very nice, I now try to do a few improvements by myself. Currently, I try to draw the tile texture where the orange rectangle would be. In general, this works, kind of^^ I just need a way to figure out in _single.gd in the draw_pattern_hint_at function the coordinate of the currently selected cell. So I can then draw this part of the texture:

    var pattern_size: Vector2 = _pattern_layout_map.pattern_size
    var pattern_position: Vector2 = _pattern_grid_origin_map_cell_position + \
        _pattern_layout_map.map_to_world(pattern_grid_cell * pattern_size)
    var cell: Vector2
    var color = _settings.cursor_color
    for y in pattern_size.y: for x in pattern_size.x:
        cell = Vector2(x, y)
        prints(y, pattern_grid_cell, pattern_position, cell)
        # TODO: draw the real cell graphics they would be placed
        var texture = _paper.get_tile_set().tile_get_texture(0)
        overlay.draw_texture_rect_region(texture, Rect2(pattern_position + _pattern_layout_map.map_to_world(cell), Vector2.ONE), Rect2(Vector2(0,0), Vector2(1,1) * 16))
        #overlay.draw_rect(Rect2(pattern_position + _pattern_layout_map.map_to_world(cell), Vector2.ONE), color * (Color.white if _pattern_layout_map.cells_data.has(cell) else Color(1, 1, 1, 0.5)))

There in the draw_texture_rect_region I use Vector(0,0) for now.

letsgamedev commented 1 year ago

Ok never mind, I got it^^Will to make a pull-request for you in the next few days. But the changes must be reviewed very well I guess XD

nklbdev commented 1 year ago

Cool!

Sorry, my English is not so good. I use Google Translate sometimes.

I recommend you to use TileMap like i used pattern_layout_map and so on in code to help me to calculate some data for current user's TileMap.

If you create tile map, and move it following the cursor by grid steps, you can set some tiles to it and show it for user.

Try to learn how I use "pattern_layout_map". Perhaps it is this tile map that should be used for this.