Skip to content

Commit

Permalink
Slip in an extra safety for model parent while we wait for PR to be a…
Browse files Browse the repository at this point in the history
…pproved
  • Loading branch information
Tslat committed Oct 6, 2024
1 parent dc10e29 commit cdc4a2e
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 4 deletions.
6 changes: 5 additions & 1 deletion plugins/animation_utils/animation_utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -6902,6 +6902,8 @@ function createProjectSettingsDialog(Project, form) {
}
const modelType = _constants__WEBPACK_IMPORTED_MODULE_0__.GeckoModelType[formResult[_constants__WEBPACK_IMPORTED_MODULE_0__.PROPERTY_MODEL_TYPE]];
Project[_constants__WEBPACK_IMPORTED_MODULE_0__.PROPERTY_MODEL_TYPE] = modelType;
if (modelType == _constants__WEBPACK_IMPORTED_MODULE_0__.GeckoModelType.ITEM)
Project.parent = 'builtin/entity';
if (Project.name === Format.name || Project.name === '')
Project.name = "GeckoLib " + Project[_constants__WEBPACK_IMPORTED_MODULE_0__.PROPERTY_MODEL_TYPE];
switch (modelType) {
Expand Down Expand Up @@ -7465,8 +7467,10 @@ function onProjectSave(e) {
function onSettingsChanged() {
Modes.selected.select();
Format.display_mode = (0,_utils__WEBPACK_IMPORTED_MODULE_0__.hasModelDisplaySettings)();
if (Project instanceof ModelProject && Project[_constants__WEBPACK_IMPORTED_MODULE_1__.PROPERTY_MODEL_TYPE] === _constants__WEBPACK_IMPORTED_MODULE_1__.GeckoModelType.ITEM)
if (Project instanceof ModelProject && Project[_constants__WEBPACK_IMPORTED_MODULE_1__.PROPERTY_MODEL_TYPE] === _constants__WEBPACK_IMPORTED_MODULE_1__.GeckoModelType.ITEM && (!Project.parent || Project.parent !== 'builtin/entity')) {
Project.parent = 'builtin/entity';
Project.saved = false;
}
}
/**
* When opening a project tab, whether from an existing project, creating a new one, or swapping open tabs
Expand Down
4 changes: 2 additions & 2 deletions plugins/animation_utils/src/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions plugins/animation_utils/src/ts/codec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,9 @@ function createProjectSettingsDialog(Project: ModelProject, form: {[formElement:
const modelType = GeckoModelType[formResult[PROPERTY_MODEL_TYPE]]
Project[PROPERTY_MODEL_TYPE] = modelType;

if (modelType == GeckoModelType.ITEM)
Project.parent = 'builtin/entity';

if (Project.name === Format.name || Project.name === '')
Project.name = "GeckoLib " + Project[PROPERTY_MODEL_TYPE];

Expand Down
4 changes: 3 additions & 1 deletion plugins/animation_utils/src/ts/events.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,10 @@ function onSettingsChanged() {

Format.display_mode = hasModelDisplaySettings();

if (Project instanceof ModelProject && Project[PROPERTY_MODEL_TYPE] === GeckoModelType.ITEM)
if (Project instanceof ModelProject && Project[PROPERTY_MODEL_TYPE] === GeckoModelType.ITEM && (!Project.parent || Project.parent !== 'builtin/entity')) {
Project.parent = 'builtin/entity';
Project.saved = false;
}
}

/**
Expand Down

0 comments on commit cdc4a2e

Please sign in to comment.