Skip to content

Commit 11fbfab

Browse files
authored
Merge pull request #12 from Insality/develop
Release v4
2 parents b5bfc89 + d651cd5 commit 11fbfab

21 files changed

+581
-276
lines changed

.vscode/settings.json

+3-1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818
"sprite",
1919
"update",
2020
"on_message",
21-
"final"
21+
"final",
22+
"editor",
23+
"html5"
2224
]
2325
}

CHANGELOG.md

+8-1
Original file line numberDiff line numberDiff line change
@@ -33,4 +33,11 @@ Initial resease!
3333
- The `animation_state` table now contains `animation_id`, instead of `animation` table data. It will be better to log or `pprint` the animation state.
3434
- Rename file `panthera_system` to `panthera_internal`.
3535
- Add support for `is_editor_only` timeline key property
36-
- Add support for `easing_custom` timeline key property
36+
- Add support for `easing_custom` timeline key property
37+
38+
39+
## Version v4
40+
41+
- Add Defold Editor scripts to create and edit Panthera animations directly from the Defold Editor
42+
- Panthera Editor should be started before using the scripts.
43+
- Add time overflow handling for more precise animation playback.

README.md

+11-9
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ https://github.com/Insality/defold-tweener/archive/refs/tags/3.zip
3636
**[Panthera Runtime](https://github.com/Insality/panthera)**
3737

3838
```
39-
https://github.com/Insality/panthera/archive/refs/tags/runtime.3.zip
39+
https://github.com/Insality/panthera/archive/refs/tags/runtime.4.zip
4040
```
4141

4242
After that, select `Project ▸ Fetch Libraries` to update [library dependencies]((https://defold.com/manuals/libraries/#setting-up-library-dependencies)). This happens automatically whenever you open a project so you will only need to do this if the dependencies change without re-opening the project.
@@ -47,11 +47,13 @@ After that, select `Project ▸ Fetch Libraries` to update [library dependencies
4747
4848
| Platform | Library Size |
4949
| ---------------- | ------------ |
50-
| HTML5 | **11.51 KB** |
51-
| Desktop / Mobile | **19.53 KB** |
50+
| HTML5 | **12.42 KB** |
51+
| Desktop / Mobile | **21.35 KB** |
5252

5353

54-
### Hot Reloading Animations for Development
54+
### Hot Reloading Animations for Development [Optional]
55+
56+
> **Note:** Hot reloading is designed for use in development environments only. Hot reloading only works for animations from JSON files. If you using a lua table for animations, hot reloading will not work.
5557
5658
Panthera Runtime supports hot reloading of animations for a more efficient development workflow. This feature allows animations to be reloaded automatically without restarting your Defold game, facilitating rapid iteration on animation assets.
5759

@@ -81,9 +83,6 @@ window.set_listener(function(_, event)
8183
end)
8284
```
8385

84-
> **Note:** Hot reloading is designed for use in development environments only. Hot reloading only works for animations from JSON files. If you using a lua table for animations, hot reloading will not work.
85-
86-
8786
## API Reference
8887

8988
### Quick API Reference
@@ -120,9 +119,10 @@ Load and play a animation file using the GO adapter.
120119

121120
```lua
122121
local panthera = require("panthera.panthera")
122+
local animation = require("path.to.panthera_animation")
123123

124124
function init(self)
125-
self.animation = panthera.create_go("/animations/animation.json")
125+
self.animation = panthera.create_go(animation)
126126
panthera.play(self.animation, "run", { is_loop = true })
127127
end
128128
```
@@ -134,9 +134,10 @@ Load and play a animation file using the GUI adapter.
134134

135135
```lua
136136
local panthera = require("panthera.panthera")
137+
local animation = require("path.to.panthera_animation")
137138

138139
function init(self)
139-
self.animation = panthera.create_gui("/animations/animation.json")
140+
self.animation = panthera.create_gui(animation)
140141
panthera.play(self.animation, "fade_in")
141142
end
142143
```
@@ -151,6 +152,7 @@ Check if an animation is currently playing and retrieve the current animation ID
151152
local panthera = require("panthera.panthera")
152153

153154
function init(self)
155+
-- You can use JSON instead of Lua tables, but it should be accessible with sys.load_resource()
154156
self.animation = panthera.create_gui("/animations/animation.json")
155157
local is_playing = panthera.is_playing(self.animation)
156158
local animation_id = panthera.get_latest_animation_id(self.animation)

docs_editor/getting_started.md

+40-3
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ Quickly dive into creating animations with **Panthera Editor 2.0** using this st
2525
- [Export Animation Data](#export-animation-data)
2626
* [How to Find Animation File](#how-to-find-animation-file)
2727
- [Import Defold GUI Layout](#import-defold-gui-layout)
28+
- [Create Animations from Defold Editor](#create-animations-from-defold-editor)
2829
- [Working with Node Properties](#working-with-node-properties)
2930
* [Copy and Paste Properties](#copy-and-paste-properties)
3031
* [Discarding Changes](#discarding-changes)
@@ -40,6 +41,7 @@ Quickly dive into creating animations with **Panthera Editor 2.0** using this st
4041
- [Working with Nested Animations](#working-with-nested-animations)
4142
* [Add Nested Animation](#add-nested-animation)
4243
* [Cyclic References](#cyclic-references)
44+
- [Workflow Example](#workflow-example)
4345
- [Adjust Gizmo Settings](#adjust-gizmo-settings)
4446
* [Scene Gizmo Settings](#scene-gizmo-settings)
4547
* [Timeline Gizmo Settings](#timeline-gizmo-settings)
@@ -86,6 +88,8 @@ Contains the information, latest news and quick access buttons to leave feedback
8688
---
8789
List of all your projects. Here you can open, delete, or create a new project. Projects are sorted by the last modified date. After creation you can rename the project by right click -> Rename. This rename is not affecting the saved file name and can be used for better navigation.
8890

91+
To create first animation project, click on the "Plus" button and select "New Animation". As file extension use `.lua` or `.json`.
92+
8993
> Project Tabs
9094
---
9195
All currently opened projects are displayed here. You can switch between them by clicking on the tab.
@@ -138,6 +142,16 @@ Displays the properties of the selected node. You can view the properties here.
138142
Contains all the images in the atlas. You can add new images here.
139143

140144

145+
## Interface adjustments
146+
147+
You can change the UI scale by pressing `Ctrl` + `Shift` + `-` to scale down and `Ctrl` + `Shift` + `+` to scale up.
148+
149+
https://github.com/user-attachments/assets/f6f94120-56c1-4abb-a5fc-acdedbe6127c
150+
151+
You can adjust the width of the Node panel and Timeline panel by dragging the splitter between them.
152+
153+
https://github.com/user-attachments/assets/ef0e9d38-eb39-4001-83de-5bdbaf9cc47d
154+
141155
# Create a New Project
142156

143157
https://github.com/Insality/panthera/assets/3294627/cf59240b-2279-4791-843f-3ea6ebcbc813
@@ -277,22 +291,38 @@ Panthera Editor used a JSON file for animation data. This file serves a dual pur
277291

278292
The file will be opened in the file explorer window.
279293

280-
# Import Defold GUI Layout
294+
# Import Defold Layout
281295
<!-- animation file should be placed inside your Defold Project folder -->
282296

283297
https://github.com/Insality/panthera/assets/3294627/ed082b26-cfaf-4567-93ac-41d2169b2444
284298

285-
You can import the Defold GUI layout to the Panthera Editor. The animation file should be placed inside your Defold project folder to correct reloading in the future.
299+
You can import the Defold GUI/Collection/GO layout to the Panthera Editor. The animation file should be placed inside your Defold project folder to correct reloading in the future (it uses relative path's from `game.project` file).
286300

287301
1. Open animation project.
288302
2. Click on the plus icon in the Nodes panel.
289303
3. Select "Bind Defold File".
290304
4. Choose the `.gui` file from your Defold project.
291305

292-
The GUI layout will be imported and displayed in the Editor View. The file state is changed to linked. The GUI will be reloaded automatically when the project is opened, or manually by clicking the "Reload Binded File" button.
306+
The layout will be imported and displayed in the Editor View. The file state is changed to linked. The file will be reloaded automatically when the project is opened, or manually by clicking the "Reload Binded File" button.
293307

294308
The layout nodes can't be modified. But you can animate them. Nodes layout data will be not stored in the animation file. Only the animation data will be stored.
295309

310+
# Create Animations from Defold Editor
311+
312+
> Panthera Runtime v4 is required for this feature.
313+
314+
You can create and open animations directly from Defold Editor. Prerequisites:
315+
316+
- The Panthera Editor should be opened.
317+
- The Panthera Runtime library should be included in your Defold project.
318+
319+
To create new animation from Defold Editor, press right click on the `.gui`, `.go` or `.collection` file in the Defold Editor and select "Create Panthera Animation". The Panthera Editor will be opened with the new animation project. The new file will be created in the same folder as the `.gui`, `.go` or `.collection` file. The name will be `{file_name}_panthera.lua`.
320+
321+
https://github.com/user-attachments/assets/b39445d1-ebe8-4f02-ac54-418e952d9b84
322+
323+
To open Panthera animation (both in json or lua formars) from Defold Editor, press right click on the Panthera animation file and select "Open Panthera Animation". The Panthera Editor will be opened with the selected animation project.
324+
325+
https://github.com/user-attachments/assets/5e649807-f030-4c81-8264-a0e54191da2a
296326

297327
# Working with Node Properties
298328

@@ -410,6 +440,13 @@ You can add a nested animation to the scene. Nested animations can be created in
410440
In the current version, the cyclic references are not protected. The cyclic references can cause the infinite loop in the animation playback. Be careful with it.
411441

412442

443+
# Workflow Example
444+
445+
Here is a 4 minutes of making simple appear/disappear animations in Panthera Editor.
446+
447+
https://github.com/user-attachments/assets/18615ed3-3b09-47c3-a677-411ffa7d6600
448+
449+
413450
# Adjust Gizmo Settings
414451

415452
https://github.com/Insality/panthera/assets/3294627/53b1de58-84eb-4a20-800f-c4bcf13cc78b

docs_editor/hotkeys.md

+16-2
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
| `Shift + A` | Move animation time backward on time step |
3232
| `Shift + D` | Move animation time forward on time step |
3333
| `Shift + Enter` | Commit all changes in animation of selected nodes |
34+
| `U` | Reset all changed properties of selected nodes. If no changes - reset all properties to initial values |
3435
| `Ctrl` + `C` | Copy selected nodes or animation keys |
3536
| `Ctrl` + `V` | **Layout Mode**: Paste copied nodes |
3637
| `Ctrl` + `V` | **Animation Mode**: Paste copied keys |
@@ -41,7 +42,8 @@
4142
| `Ctrl` + `N` | Create new box node |
4243
| `Ctrl` + `A` | **Layout Mode** Select all nodes |
4344
| `Ctrl` + `A` | **Animation Mode** Select all keys |
44-
| `Ctrl` + `E` | Hide/Show Node. Hidden node is non-selectable from Editor View |
45+
| `Ctrl` + `E` | Hide/Show selected nodes. Hidden node is non-selectable from Editor View |
46+
| `Ctrl` + `Shift` + `E` | Hide/Show not selected nodes. |
4547
| `Arrows (Up, Down, Left, Right)` | Move selected nodes +1px |
4648
| `Shift` + `Arrows (Up, Down, Left, Right)` | Move selected nodes +10px |
4749
| `Ctrl` + `Arrows (Up, Down, Left, Right)` | Change selected nodes size +1px |
@@ -56,7 +58,7 @@
5658
| `Alt` + `Arrow Up` | Move selected nodes up in hierarcy |
5759
| `Alt` + `Arrow Down` | Move selected nodes down in hierarcy |
5860
| `Right Click` | Show context menu of element |
59-
| `Ctrl` + `Left Click` | Select Animation with keeping nodes selection |
61+
| `Ctrl` + `Left Click` | Select Animation with keeping current nodes selection |
6062

6163
## Properties View
6264

@@ -70,6 +72,17 @@
7072
| `Mouse Hover` + `0-9` | Set opacity of color picker widget to [10% .. 100%] |
7173
| `Mouse Hover` + `Left Shift` + `0` | Set opacity of color picker widget 0% |
7274

75+
## Node List View
76+
77+
| Key | Description |
78+
| --- | --- |
79+
| `Alt` + `Left Click` | (_on arrow icon_) Fold/Unfold node and all children |
80+
| `Shift` + `[` | Select parent node |
81+
| `Shift` + `]` | Select child node |
82+
| `Shift` + `P` | Select next node |
83+
| `Shift` + `Alt` + `P` | Select previous node |
84+
85+
7386
## Timeline View
7487

7588
| Key | Description |
@@ -84,6 +97,7 @@
8497
| `Hold Shift` + `Drag` | Add or remove keys from selection |
8598
| `Left Click` | Select key (or key behind selected if multiple selection) |
8699

100+
87101
## Transform Gizmo
88102

89103
| Key | Description |

docs_editor/media/convert_videos.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ for input_file in "$input_dir"/*.mov; do
2121
output_file="$output_dir/$base_name.mp4"
2222

2323
# Run FFmpeg command to convert the video
24-
ffmpeg -i "$input_file" -vf "scale=1280:-1" -c:v libx264 -preset slow -crf 22 -an "$output_file"
24+
ffmpeg -i "$input_file" -vf "scale=1280:-2" -c:v libx264 -preset slow -crf 22 -an "$output_file"
2525

2626
# Check if the conversion was successful
2727
if [ $? -eq 0 ]; then
Binary file not shown.
Binary file not shown.
826 KB
Binary file not shown.

docs_editor/media/video/ui_scale.mp4

624 KB
Binary file not shown.
Binary file not shown.

example/example_druid_component/druid_component.gui

+9-3
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ nodes {
5252
yanchor: YANCHOR_NONE
5353
pivot: PIVOT_CENTER
5454
adjust_mode: ADJUST_MODE_FIT
55-
layer: ""
55+
layer: "gui"
5656
inherit_alpha: true
5757
slice9 {
5858
x: 16.0
@@ -111,7 +111,7 @@ nodes {
111111
pivot: PIVOT_CENTER
112112
adjust_mode: ADJUST_MODE_FIT
113113
parent: "root"
114-
layer: ""
114+
layer: "gui"
115115
inherit_alpha: true
116116
slice9 {
117117
x: 0.0
@@ -184,7 +184,7 @@ nodes {
184184
adjust_mode: ADJUST_MODE_FIT
185185
line_break: false
186186
parent: "root"
187-
layer: ""
187+
layer: "text"
188188
inherit_alpha: true
189189
alpha: 1.0
190190
outline_alpha: 0.0
@@ -197,6 +197,12 @@ nodes {
197197
visible: true
198198
material: ""
199199
}
200+
layers {
201+
name: "gui"
202+
}
203+
layers {
204+
name: "text"
205+
}
200206
material: "/builtins/materials/gui.material"
201207
adjust_reference: ADJUST_REFERENCE_PARENT
202208
max_nodes: 512

0 commit comments

Comments
 (0)