From 9b439327b8da1044e13657c0d33bedc0d2e406f1 Mon Sep 17 00:00:00 2001 From: Emmanouil Papadeas Date: Sat, 24 Feb 2024 15:25:54 +0200 Subject: [PATCH] Fix ExtensionsAPI's `new_project()` not working, and add a new `new_empty_project()` method --- src/Autoload/ExtensionsApi.gd | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/Autoload/ExtensionsApi.gd b/src/Autoload/ExtensionsApi.gd index c49ce97dc..ae5d579cf 100644 --- a/src/Autoload/ExtensionsApi.gd +++ b/src/Autoload/ExtensionsApi.gd @@ -532,9 +532,9 @@ class ProjectAPI: ## Creates a new project (with new tab) with name [param name], size [param size], ## fill color [param fill_color] and frames [param frames]. The created project also ## gets returned.[br][br] - ## [param frames] is an [Array] of type Frames. Usually it can be left as [code][][/code]. + ## [param frames] is an [Array] of type [Frame]. Usually it can be left as [code][][/code]. func new_project( - frames := [], + frames: Array[Frame] = [], name := tr("untitled"), size := Vector2(64, 64), fill_color := Color.TRANSPARENT @@ -551,6 +551,12 @@ class ProjectAPI: Global.projects.append(new_proj) return new_proj + ## Creates and returns a new [Project], with an optional [param name]. + func new_empty_project(name := tr("untitled")) -> Project: + var new_proj := Project.new([], name) + Global.projects.append(new_proj) + return new_proj + ## Returns a dictionary containing all the project information. func get_project_info(project: Project) -> Dictionary: return project.serialize()