Skip to content
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

Changed scale for cards to Vector2 #210

Merged
merged 6 commits into from
Jan 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion assets/TabletopClub/cards/config.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ mass = 1.8

; A standard poker playing card is 2.5 inches (= 6.35 cm) wide by 3.5 inches
; tall (= 8.89 cm)
scale = Vector3(6.35, 1, 8.89)
scale = Vector2(6.35, 8.89)

back_face = "Back.png"

Expand Down
5 changes: 4 additions & 1 deletion docs/custom_assets/asset_packs/asset_pack_structure.rst
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,10 @@ Here is the full list of properties you can modify in ``config.cfg``:
+--------------------+------------+------------------+----------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| ``rotation`` | Vector3 | Skyboxes | ``Vector3(0.0, 0.0, 0.0)`` | Rotates the skybox a number of degrees in the X, Y and Z axes. |
+--------------------+------------+------------------+----------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| ``scale`` | Vector3 | Objects | ``Vector3(1.0, 1.0, 1.0)`` | Scales the object in the X, Y and Z axes in centimeters (cm). Note that for objects that use custom 3D models, this value most likely won't reflect the final size of the object. |
| ``scale`` | Vector3 | Objects | ``Vector3(1.0, 1.0, 1.0)`` | Scales the object in the X (width), Y (height) and Z (thickness) axes in centimeters (cm). Note that for objects that use custom 3D models, this value most likely won't reflect |
| | | (except Cards) | | the final size of the object. |
+--------------------+------------+------------------+----------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| ``scale`` | Vector2 | Cards | ``Vector2(1.0, 1.0)`` | Scales the card in the X (width) and Z (height) axes in centimeters (cm). |
elmodor marked this conversation as resolved.
Show resolved Hide resolved
+--------------------+------------+------------------+----------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| ``sfx`` | Text | Objects | ``"generic"`` | Determines what the object sounds like when it collides with the table. Possible values are: ``"generic"``, ``"glass"``, ``"glass_heavy"``, ``"glass_light"``, ``"metal"``, |
| | | | | ``"metal_heavy"``, ``"metal_light"``, ``"soft"``, ``"soft_heavy"``, ``"tin"``, ``"wood"``, ``"wood_heavy"``, ``"wood_light"``. |
Expand Down
7 changes: 7 additions & 0 deletions docs/custom_assets/asset_packs/asset_types.rst
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@ front face, and one for the back face. The game registers each of the textures
in the ``cards/`` folder as the front face of a card, but you need to tell the
game where to find the back face in the ``config.cfg`` file.

Cards also have a fixed thickness, so you only have to set the width and height
value.

Here is a simple example that will apply a back face texture (in this example,
``BackFace.png``) to all of the cards in the folder:

Expand All @@ -53,6 +56,10 @@ Here is a simple example that will apply a back face texture (in this example,
; cards/config.cfg
[*]

; Width (6.35) and height (8.89) in cm
scale = Vector2(6.35, 8.89)

; Set the back_face for all cards
back_face = "BackFace.png"

[BackFace.png]
Expand Down
13 changes: 12 additions & 1 deletion game/Scripts/AssetDB.gd
Original file line number Diff line number Diff line change
Expand Up @@ -826,7 +826,18 @@ func _import_asset(from: String, pack: String, type: String, config: ConfigFile,

# We usually deal with the config values at the end, but some assets need
# these values for the entry initialization.
var scale = _get_file_config_value(config, from.get_file(), "scale", Vector3.ONE)
var scale: Vector3
if type == "cards":
var scale_config = _get_file_config_value(config, from.get_file(), "scale", Vector2.ONE)
if typeof(scale_config) != TYPE_VECTOR2:
push_warning("Scale for type cards has to be Vector2! Default thickness is used!")
scale = Vector3(scale_config.x, 1, scale_config.y)
else:
var scale_config = _get_file_config_value(config, from.get_file(), "scale", Vector3.ONE)
if typeof(scale_config) != TYPE_VECTOR3:
push_error("Scale for type %s has to be Vector3! Default scale is used!" % type)
scale_config = Vector3.ONE
scale = scale_config

var entry = {}
if asset_type == ASSET_AUDIO:
Expand Down