Skip to content

Commit

Permalink
Fix extension not regenerated after extracting instances to a custom …
Browse files Browse the repository at this point in the history
…object
  • Loading branch information
4ian committed Oct 11, 2024
1 parent 82a6aba commit 7a4aea6
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 16 deletions.
10 changes: 8 additions & 2 deletions newIDE/app/src/MainFrame/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2056,6 +2056,12 @@ const MainFrame = (props: Props) => {
}
const eventsBasedObject = eventsBasedObjects.get(eventsBasedObjectName);
openCustomObjectEditor(eventsFunctionsExtension, eventsBasedObject);
// Trigger reloading of extensions as an extension was modified (or even added)
// to create the custom object.
eventsFunctionsExtensionsState.loadProjectEventsFunctionsExtensions(
currentProject
);
};
const onEventsBasedObjectChildrenEdited = React.useCallback(
Expand Down Expand Up @@ -3587,9 +3593,9 @@ const MainFrame = (props: Props) => {
onOpenPreferences: () => openPreferencesDialog(true),
onOpenAbout: () => openAboutDialog(true),
selectInAppTutorial: selectInAppTutorial,
onLoadEventsFunctionsExtensions: () => {
onLoadEventsFunctionsExtensions: async () => {
if (isProjectClosedSoAvoidReloadingExtensions) {
return Promise.resolve();
return;
}
return eventsFunctionsExtensionsState.loadProjectEventsFunctionsExtensions(
currentProject
Expand Down
36 changes: 22 additions & 14 deletions newIDE/app/src/SceneEditor/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -1398,6 +1398,12 @@ export default class SceneEditor extends React.Component<Props, State> {
},
accelerator: 'CmdOrCtrl+D',
},
{
label: i18n._(t`Delete`),
click: () => this.deleteSelection(),
enabled: hasSelectedInstances,
accelerator: 'Delete',
},
{ type: 'separator' },
{
label: i18n._(t`Bring to front`),
Expand All @@ -1415,26 +1421,28 @@ export default class SceneEditor extends React.Component<Props, State> {
},
{ type: 'separator' },
{
label: i18n._(t`Extract as a custom object`),
click: () => this.setState({ extractAsCustomObjectDialogOpen: true }),
enabled: hasSelectedInstances,
},
this.props.layout && {
label: i18n._(t`Extract as an external layout`),
click: () => this.setState({ extractAsExternalLayoutDialogOpen: true }),
enabled: hasSelectedInstances,
label: i18n._(t`Extract`),
submenu: [
{
label: i18n._(t`Extract as a custom object`),
click: () =>
this.setState({ extractAsCustomObjectDialogOpen: true }),
enabled: hasSelectedInstances,
},
this.props.layout && {
label: i18n._(t`Extract as an external layout`),
click: () =>
this.setState({ extractAsExternalLayoutDialogOpen: true }),
enabled: hasSelectedInstances,
},
].filter(Boolean),
},
{ type: 'separator' },
{
label: i18n._(t`Show/Hide instance properties`),
click: () => this.toggleProperties(),
enabled: hasSelectedInstances,
},
{
label: i18n._(t`Delete`),
click: () => this.deleteSelection(),
enabled: hasSelectedInstances,
accelerator: 'Delete',
},
].filter(Boolean);
};

Expand Down

0 comments on commit 7a4aea6

Please sign in to comment.