Skip to content

Commit

Permalink
Prehash all Defold tween properties
Browse files Browse the repository at this point in the history
  • Loading branch information
Insality committed Oct 5, 2024
1 parent 18295c0 commit c3e16b6
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 54 deletions.
44 changes: 22 additions & 22 deletions panthera/adapters/adapter_go.lua
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
local PROPERTY_TO_TWEEN_PROPERTY = {
["position_x"] = "position.x",
["position_y"] = "position.y",
["position_z"] = "position.z",
["rotation_x"] = "euler.x",
["rotation_y"] = "euler.y",
["rotation_z"] = "euler.z",
["scale_x"] = "scale.x",
["scale_y"] = "scale.y",
["scale_z"] = "scale.z",
["size_x"] = "size.x",
["size_y"] = "size.y",
["size_z"] = "size.z",
["color_r"] = "color.x",
["color_g"] = "color.y",
["color_b"] = "color.z",
["color_a"] = "color.w",
["slice9_left"] = "slice.x",
["slice9_top"] = "slice.y",
["slice9_right"] = "slice.z",
["slice9_bottom"] = "slice.w"
["position_x"] = hash("position.x"),
["position_y"] = hash("position.y"),
["position_z"] = hash("position.z"),
["rotation_x"] = hash("euler.x"),
["rotation_y"] = hash("euler.y"),
["rotation_z"] = hash("euler.z"),
["scale_x"] = hash("scale.x"),
["scale_y"] = hash("scale.y"),
["scale_z"] = hash("scale.z"),
["size_x"] = hash("size.x"),
["size_y"] = hash("size.y"),
["size_z"] = hash("size.z"),
["color_r"] = hash("color.x"),
["color_g"] = hash("color.y"),
["color_b"] = hash("color.z"),
["color_a"] = hash("color.w"),
["slice9_left"] = hash("slice.x"),
["slice9_top"] = hash("slice.y"),
["slice9_right"] = hash("slice.z"),
["slice9_bottom"] = hash("slice.w"),
}

local PROPERTY_TO_TRIGGER_PROPERTY = {
Expand Down Expand Up @@ -196,7 +196,7 @@ local function set_node_property(node, property_id, value)
stop_tween(node, property_id)
defold_property_id = PROPERTY_TO_TWEEN_PROPERTY[property_id]
if not defold_property_id then
print("Unknown property_id: " .. property_id, debug.traceback())
print("Unknown property_id: ", property_id, debug.traceback())
return false
end

Expand All @@ -217,7 +217,7 @@ local function get_node_property(node, property_id)

local defold_number_property_id = PROPERTY_TO_TWEEN_PROPERTY[property_id]
if not defold_number_property_id then
print("Unknown property_id: " .. property_id, debug.traceback())
print("Unknown property_id: ", property_id, debug.traceback())
return nil
end

Expand Down
64 changes: 32 additions & 32 deletions panthera/adapters/adapter_gui.lua
Original file line number Diff line number Diff line change
Expand Up @@ -10,38 +10,38 @@ local gui_get_node = gui.get_node
local IS_DEFOLD_180 = gui_set and gui_get

local PROPERTY_TO_DEFOLD_TWEEN_PROPERTY = {
["position_x"] = "position.x",
["position_y"] = "position.y",
["position_z"] = "position.z",
["rotation_x"] = IS_DEFOLD_180 and "euler.x" or "rotation.x",
["rotation_y"] = IS_DEFOLD_180 and "euler.y" or "rotation.y",
["rotation_z"] = IS_DEFOLD_180 and "euler.z" or "rotation.z",
["scale_x"] = "scale.x",
["scale_y"] = "scale.y",
["scale_z"] = "scale.z",
["size_x"] = "size.x",
["size_y"] = "size.y",
["size_z"] = "size.z",
["color_r"] = "color.x",
["color_g"] = "color.y",
["color_b"] = "color.z",
["color_a"] = "color.w",
["outline_r"] = "outline.x",
["outline_g"] = "outline.y",
["outline_b"] = "outline.z",
["outline_a"] = "outline.w",
["shadow_r"] = "shadow.x",
["shadow_g"] = "shadow.y",
["shadow_b"] = "shadow.z",
["shadow_a"] = "shadow.w",
["slice9_left"] = "slice9.x",
["slice9_top"] = "slice9.y",
["slice9_right"] = "slice9.z",
["slice9_bottom"] = "slice9.w",
["inner_radius"] = "inner_radius",
["fill_angle"] = "fill_angle",
["text_tracking"] = "tracking",
["text_leading"] = "leading",
["position_x"] = hash("position.x"),
["position_y"] = hash("position.y"),
["position_z"] = hash("position.z"),
["rotation_x"] = IS_DEFOLD_180 and hash("euler.x") or hash("rotation.x"),
["rotation_y"] = IS_DEFOLD_180 and hash("euler.y") or hash("rotation.y"),
["rotation_z"] = IS_DEFOLD_180 and hash("euler.z") or hash("rotation.z"),
["scale_x"] = hash("scale.x"),
["scale_y"] = hash("scale.y"),
["scale_z"] = hash("scale.z"),
["size_x"] = hash("size.x"),
["size_y"] = hash("size.y"),
["size_z"] = hash("size.z"),
["color_r"] = hash("color.x"),
["color_g"] = hash("color.y"),
["color_b"] = hash("color.z"),
["color_a"] = hash("color.w"),
["outline_r"] = hash("outline.x"),
["outline_g"] = hash("outline.y"),
["outline_b"] = hash("outline.z"),
["outline_a"] = hash("outline.w"),
["shadow_r"] = hash("shadow.x"),
["shadow_g"] = hash("shadow.y"),
["shadow_b"] = hash("shadow.z"),
["shadow_a"] = hash("shadow.w"),
["slice9_left"] = hash("slice9.x"),
["slice9_top"] = hash("slice9.y"),
["slice9_right"] = hash("slice9.z"),
["slice9_bottom"] = hash("slice9.w"),
["inner_radius"] = hash("inner_radius"),
["fill_angle"] = hash("fill_angle"),
["text_tracking"] = hash("tracking"),
["text_leading"] = hash("leading"),
}

local PROPERTY_TO_DEFOLD_TRIGGER_PROPERTY = {
Expand Down

0 comments on commit c3e16b6

Please sign in to comment.