Skip to content

Commit

Permalink
Updates to prepare for submission
Browse files Browse the repository at this point in the history
  • Loading branch information
dfego committed Feb 18, 2024
1 parent 9393298 commit 4732a70
Show file tree
Hide file tree
Showing 7 changed files with 174 additions and 0 deletions.
21 changes: 21 additions & 0 deletions addons/table_container/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2024 Dan Fego

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
39 changes: 39 additions & 0 deletions addons/table_container/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# Godot Table Container

A Godot plugin that provides a container type that serves as a table.
I wrote this because the current options for tabular data were insufficient for my use cases.

`GridContainer` was close, but the fact that all the elements must be children of the container created some limitations.
First, there is no concept of discrete rows, so it was awkward to add sets of nodes as a row to it.
Second, because of the above, while I was able to instantiate a row scene and then reparent the children to it, the row itself, with any scripting I might have, would be lost.

Combining `VBoxContainer` and `HBoxContainer` is effectively what I do here, but the initial limitation is that the columns do not stay in alignment.
That's basically what this does.

## Features

* Keeps columns (i.e. `Control` nodes within each `HBoxContainer`) in alignment
* Has optional auto-update in the game and in the editor
* Has property to seet horizontal and vertical spacing overrides to the entire table

## Usage

To use, simply create a new `TableContainer` node in your scene tree.
Add `HBoxContainer` nodes to represent the rows, and ensure that all rows have the same number of columns (children).

The `TableContainer` node has four exported properties:

* `update_interval_editor`, if not `null`, updates the table's alignment in `_process` in the editor every number of frames specified.
* `update_interval_game`, if not `null`, updates the table's alignment in `_process` in the game every number of frames specified.
* `separation_horizontal`, if not `null`, applies a value to each row's `HBoxContainer` `theme_override_constants/separation` property.
* `separation_vertical`, if not `null,` applies a value to the `TableContainer` `theme_override_constants/separation` property.

## Limitations

Anything that's not listed above.
Rows must be the same length.

## Development

I'm planning to put this to use in another project, and as I see the need, I may extend this.
It's primarily for my own use, but since I didn't see anything quite like it out there and I've seen it asked about, I figured I'd share!
Binary file added addons/table_container/icons/TableContainer.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
34 changes: 34 additions & 0 deletions addons/table_container/icons/TableContainer.png.import
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
[remap]

importer="texture"
type="CompressedTexture2D"
uid="uid://ciddy4yxgo1je"
path="res://.godot/imported/TableContainer.png-a92c2112f3cec2b085b3f9308e07afbb.ctex"
metadata={
"vram_texture": false
}

[deps]

source_file="res://addons/table_container/icons/TableContainer.png"
dest_files=["res://.godot/imported/TableContainer.png-a92c2112f3cec2b085b3f9308e07afbb.ctex"]

[params]

compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1
42 changes: 42 additions & 0 deletions addons/table_container/icons/TableContainer.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
37 changes: 37 additions & 0 deletions addons/table_container/icons/TableContainer.svg.import
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
[remap]

importer="texture"
type="CompressedTexture2D"
uid="uid://cwa02140jtg3s"
path="res://.godot/imported/TableContainer.svg-79c2d3b9c908b48ad9365d44843014a5.ctex"
metadata={
"vram_texture": false
}

[deps]

source_file="res://addons/table_container/icons/TableContainer.svg"
dest_files=["res://.godot/imported/TableContainer.svg-79c2d3b9c908b48ad9365d44843014a5.ctex"]

[params]

compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1
svg/scale=1.0
editor/scale_with_editor_scale=false
editor/convert_colors_with_editor_theme=false
1 change: 1 addition & 0 deletions addons/table_container/table_container.gd
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
@tool
@icon("res://addons/table_container/icons/TableContainer.svg")
class_name TableContainer extends VBoxContainer
## A basic extension of [VBoxContainer] that treats [HBoxContainer] children like rows.
##
Expand Down

0 comments on commit 4732a70

Please sign in to comment.