Skip to content

Commit 354e009

Browse files
NBForgeLab4ianD8HLuniMoonGleb Volkov
authored
Last almost stable (#54)
* Make the home page navigation sidebar collapsible * Fix potential crashes in the scene editor * Improve logs in case of UseAfterFreeError Only show in developer changelog * Fix potential crashes in the scene editor Don't show in changelog * Display extension details side by side with the extension list on large screens (4ian#8482) * Fix hot-reloading of global object instances (4ian#8489) * Fix "Add or edit variables" button always creating variables for object variables (4ian#8493) * Fix "Add or edit variables" button opening scene variables instead of local variables (4ian#8496) * Add save/restore support for linked object relationships (4ian#8499) Fix 4ian#8497 * Fix potential crash during resource reloading (4ian#8500) * Make clear in Storage actions if a number or text is being written (4ian#8498) * Add "Reload Project" menu action (4ian#8501) Co-authored-by: Gleb Volkov <glebusheg@playtika.com> * Remove deprecated, unused GitHub workflow Don't show in changelog * Fix scene properties not usable via the variable action and condition (4ian#8504) * [Auto PR] Update translations (4ian#8474) * Bump newIDE version * Add experimental option in tabs context menu to open some editors (Event Sheets, Extensions...) into separate windows (4ian#8492) * Fix wavesurfer version (4ian#8508) * Allow AI to create objects via exact asset ID without specifying type (4ian#8509) * Fix crashes when using invalid object names in object folders * Support partial asset ID matching in asset search (4ian#8512) Don't show in changelog * Fix missing globally used resources when unloading a scene that uses these resources (4ian#8513) - It only happens when "Unload at scene exit" is selected in project settings and a global object share some resources with a scene object. * Fix tentatively crash in popped-out window when a theme is missing a color (4ian#8518) Fix 4ian#8517 --------- Co-authored-by: Florian Rival <Florian.rival@gmail.com> Co-authored-by: D8H <Davy.Helard@gmail.com> Co-authored-by: LuniMoon <103995399+LuniMoon@users.noreply.github.com> Co-authored-by: Gleb Volkov <glebusheg@playtika.com> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
1 parent 7815318 commit 354e009

File tree

150 files changed

+3733
-796
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

150 files changed

+3733
-796
lines changed

.circleci/config.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -375,22 +375,26 @@ jobs:
375375
# setuptools will make distutils available again (but we should migrate our packages probably).
376376
command: |
377377
pip install setuptools
378+
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
378379
379380
cd newIDE\app
380381
381382
npm -v
383+
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
382384
383385
Remove-Item package-lock.json
384386
385387
$Env:REQUIRES_EXACT_LIBGD_JS_VERSION = "true"
386388
387389
npm install
390+
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
388391
389392
cd ..\electron-app
390393
391394
Remove-Item package-lock.json
392395
393396
npm install
397+
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
394398
395399
cd ..\..
396400

.github/workflows/pull-requests.yml

Lines changed: 0 additions & 53 deletions
This file was deleted.

Core/GDCore/Extensions/Builtin/FileExtension.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsFileExtension(
7979
"specified element.\nSpecify the structure leading to the "
8080
"element using / (example : Root/Level/Current)\nSpaces are "
8181
"forbidden in element names."),
82-
_("Save _PARAM2_ in _PARAM1_ of storage _PARAM0_"),
82+
_("Save value _PARAM2_ in _PARAM1_ of storage _PARAM0_"),
8383
"",
8484
"res/actions/fichier24.png",
8585
"res/actions/fichier.png")
@@ -95,7 +95,7 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsFileExtension(
9595
"element.\nSpecify "
9696
"the structure leading to the element using / (example : "
9797
"Root/Level/Current)\nSpaces are forbidden in element names."),
98-
_("Save _PARAM2_ in _PARAM1_ of storage _PARAM0_"),
98+
_("Save text _PARAM2_ in _PARAM1_ of storage _PARAM0_"),
9999
"",
100100
"res/actions/fichier24.png",
101101
"res/actions/fichier.png")

Core/GDCore/IDE/EventsFunctionTools.cpp

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,14 +140,34 @@ void EventsFunctionTools::ParametersToVariablesContainer(
140140
void EventsFunctionTools::PropertiesToVariablesContainer(
141141
const PropertiesContainer &properties,
142142
gd::VariablesContainer &outputVariablesContainer) {
143+
outputVariablesContainer.Clear();
144+
AddPropertiesToVariablesContainer(
145+
properties,
146+
outputVariablesContainer);
147+
}
148+
149+
void EventsFunctionTools::PropertiesToVariablesContainer(
150+
const PropertiesContainer &properties,
151+
const PropertiesContainer &sharedProperties,
152+
gd::VariablesContainer &outputVariablesContainer) {
153+
outputVariablesContainer.Clear();
154+
AddPropertiesToVariablesContainer(
155+
properties,
156+
outputVariablesContainer);
157+
AddPropertiesToVariablesContainer(
158+
sharedProperties,
159+
outputVariablesContainer);
160+
}
161+
162+
void EventsFunctionTools::AddPropertiesToVariablesContainer(
163+
const PropertiesContainer &properties,
164+
gd::VariablesContainer &outputVariablesContainer) {
143165
if (outputVariablesContainer.GetSourceType() !=
144166
gd::VariablesContainer::SourceType::Properties) {
145167
throw std::logic_error("Tried to generate a variables container from "
146168
"properties with the wrong source type.");
147169
}
148-
outputVariablesContainer.Clear();
149170

150-
gd::String lastObjectName;
151171
for (std::size_t i = 0; i < properties.GetCount(); ++i) {
152172
const auto &property = properties.Get(i);
153173
if (property.GetName().empty())

Core/GDCore/IDE/EventsFunctionTools.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,12 +81,22 @@ class GD_CORE_API EventsFunctionTools {
8181
const PropertiesContainer &properties,
8282
gd::VariablesContainer &outputVariablesContainer);
8383

84+
static void PropertiesToVariablesContainer(
85+
const PropertiesContainer &properties,
86+
const PropertiesContainer &sharedProperties,
87+
gd::VariablesContainer &outputVariablesContainer);
88+
8489
static void ParametersToResourcesContainer(
8590
const ParameterMetadataContainer &parameters,
8691
gd::ResourcesContainer &outputResourcesContainer);
8792

8893
static void PropertiesToResourcesContainer(
8994
const PropertiesContainer &properties,
9095
gd::ResourcesContainer &outputResourcesContainer);
96+
97+
private:
98+
static void AddPropertiesToVariablesContainer(
99+
const PropertiesContainer &properties,
100+
gd::VariablesContainer &outputVariablesContainer);
91101
};
92102
} // namespace gd

Core/GDCore/Project/ObjectFolderOrObject.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -263,6 +263,12 @@ void ObjectFolderOrObject::UnserializeFrom(
263263
make_unique<ObjectFolderOrObject>();
264264
childObjectFolderOrObject->UnserializeFrom(
265265
project, childrenElements.GetChild(i), objectsContainer);
266+
if (!childObjectFolderOrObject->IsFolder() &&
267+
childObjectFolderOrObject->object == nullptr) {
268+
// Ignore invalid references to missing objects, that can happen
269+
// after manual edits or merges.
270+
continue;
271+
}
266272
childObjectFolderOrObject->parent = this;
267273
children.push_back(std::move(childObjectFolderOrObject));
268274
}
@@ -289,4 +295,4 @@ void ObjectFolderOrObject::UnserializeFrom(
289295
}
290296
};
291297

292-
} // namespace gd
298+
} // namespace gd

Core/GDCore/Project/VariablesContainersList.cpp

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -72,11 +72,9 @@ VariablesContainersList VariablesContainersList::
7272
variablesContainersList.Push(extension.GetSceneVariables());
7373

7474
gd::EventsFunctionTools::PropertiesToVariablesContainer(
75-
eventsBasedBehavior.GetSharedPropertyDescriptors(), propertyVariablesContainer);
76-
variablesContainersList.Push(propertyVariablesContainer);
77-
78-
gd::EventsFunctionTools::PropertiesToVariablesContainer(
79-
eventsBasedBehavior.GetPropertyDescriptors(), propertyVariablesContainer);
75+
eventsBasedBehavior.GetPropertyDescriptors(),
76+
eventsBasedBehavior.GetSharedPropertyDescriptors(),
77+
propertyVariablesContainer);
8078
variablesContainersList.Push(propertyVariablesContainer);
8179

8280
gd::EventsFunctionTools::ParametersToVariablesContainer(
@@ -85,7 +83,7 @@ VariablesContainersList VariablesContainersList::
8583
parameterVariablesContainer);
8684
variablesContainersList.Push(parameterVariablesContainer);
8785

88-
variablesContainersList.firstLocalVariableContainerIndex = 5;
86+
variablesContainersList.firstLocalVariableContainerIndex = 4;
8987
return variablesContainersList;
9088
}
9189

Core/tests/ObjectSerialization.cpp

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,42 @@ TEST_CASE("ObjectSerialization", "[common]") {
216216
CheckCustomObjectConfiguration(readProject);
217217
}
218218

219+
SECTION(
220+
"Save and load a project with an objects folder structure containing "
221+
"missing object references") {
222+
gd::Platform platform;
223+
gd::Project writtenProject;
224+
SetupProjectWithSprite(writtenProject, platform);
225+
226+
SerializerElement projectElement;
227+
writtenProject.SerializeTo(projectElement);
228+
auto& layoutsElement = projectElement.GetChild("layouts");
229+
layoutsElement.ConsiderAsArrayOf("layout");
230+
auto& layoutElement = layoutsElement.GetChild(0);
231+
232+
auto& objectsFolderStructureElement =
233+
layoutElement.GetChild("objectsFolderStructure");
234+
auto& rootChildrenElement = objectsFolderStructureElement.GetChild("children");
235+
rootChildrenElement.ConsiderAsArrayOf("objectFolderOrObject");
236+
237+
auto& folderElement = rootChildrenElement.AddChild("objectFolderOrObject");
238+
folderElement.SetAttribute("folderName", "Background");
239+
auto& folderChildrenElement = folderElement.AddChild("children");
240+
folderChildrenElement.ConsiderAsArrayOf("objectFolderOrObject");
241+
auto& invalidObjectElement =
242+
folderChildrenElement.AddChild("objectFolderOrObject");
243+
invalidObjectElement.SetAttribute("objectName", "DoesNotExist");
244+
245+
gd::Project readProject;
246+
readProject.AddPlatform(platform);
247+
readProject.UnserializeFrom(projectElement);
248+
249+
auto& readLayout = readProject.GetLayout("Scene");
250+
auto& rootFolder = readLayout.GetObjects().GetRootFolder();
251+
REQUIRE(rootFolder.HasObjectNamed("MyObject"));
252+
REQUIRE(!rootFolder.HasObjectNamed("DoesNotExist"));
253+
}
254+
219255
SECTION("Clone a custom object") {
220256
gd::Platform platform;
221257
gd::Project project;

GDJS/GDJS/Events/CodeGeneration/MetadataDeclarationHelper.cpp

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1132,9 +1132,7 @@ void MetadataDeclarationHelper::DeclarePropertyInstructionAndExpression(
11321132
iconURL, iconURL);
11331133
addObjectAndBehaviorParameters(conditionMetadata);
11341134
conditionMetadata.SetFunctionName(getterName);
1135-
if (!isSharedProperty) {
1136-
conditionMetadata.SetHidden();
1137-
}
1135+
conditionMetadata.SetHidden();
11381136

11391137
auto &setterActionMetadata = entityMetadata.AddScopedAction(
11401138
actionName, propertyLabel,
@@ -1152,9 +1150,7 @@ void MetadataDeclarationHelper::DeclarePropertyInstructionAndExpression(
11521150
setterActionMetadata
11531151
.AddParameter("yesorno", _("New value to set"), "", false)
11541152
.SetFunctionName(setterName);
1155-
if (!isSharedProperty) {
1156-
setterActionMetadata.SetHidden();
1157-
}
1153+
setterActionMetadata.SetHidden();
11581154

11591155
auto &toggleActionMetadata = entityMetadata.AddScopedAction(
11601156
toggleActionName, _("Toggle") + " " + propertyLabel,
@@ -1168,9 +1164,7 @@ void MetadataDeclarationHelper::DeclarePropertyInstructionAndExpression(
11681164
iconURL, iconURL);
11691165
addObjectAndBehaviorParameters(toggleActionMetadata);
11701166
toggleActionMetadata.SetFunctionName(toggleFunctionName);
1171-
if (!isSharedProperty) {
1172-
toggleActionMetadata.SetHidden();
1173-
}
1167+
toggleActionMetadata.SetHidden();
11741168
} else {
11751169
auto typeExtraInfo = GetStringifiedExtraInfo(property);
11761170
auto parameterOptions = gd::ParameterOptions::MakeNewOptions();
@@ -1194,9 +1188,7 @@ void MetadataDeclarationHelper::DeclarePropertyInstructionAndExpression(
11941188
parameterOptions)
11951189
.SetFunctionName(setterName)
11961190
.SetGetter(getterName);
1197-
if (!isSharedProperty) {
1198-
propertyInstructionMetadata.SetHidden();
1199-
}
1191+
propertyInstructionMetadata.SetHidden();
12001192
}
12011193
}
12021194

GDJS/GDJS/IDE/ExporterHelper.cpp

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -574,11 +574,15 @@ void ExporterHelper::StripAndSerializeProjectData(
574574
}
575575

576576
std::unordered_map<gd::String, std::set<gd::String>> scenesUsedResources;
577-
for (std::size_t layoutIndex = 0;
578-
layoutIndex < project.GetLayoutsCount(); layoutIndex++) {
577+
for (std::size_t layoutIndex = 0; layoutIndex < project.GetLayoutsCount();
578+
layoutIndex++) {
579579
auto &layout = project.GetLayout(layoutIndex);
580-
scenesUsedResources[layout.GetName()] =
581-
gd::SceneResourcesFinder::FindSceneResources(project, layout);
580+
auto sceneUsedResources = gd::SceneResourcesFinder::FindSceneResources(
581+
project, layout);
582+
for (auto &&resourceName : projectUsedResources) {
583+
sceneUsedResources.erase(resourceName);
584+
}
585+
scenesUsedResources[layout.GetName()] = sceneUsedResources;
582586
}
583587

584588
std::unordered_map<gd::String, std::set<gd::String>>

0 commit comments

Comments
 (0)