Skip to content

Commit

Permalink
Always show custom objects in the extension editor (#6974)
Browse files Browse the repository at this point in the history
  • Loading branch information
D8H authored Sep 18, 2024
1 parent 27b71b0 commit 6d597a4
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 65 deletions.
46 changes: 21 additions & 25 deletions newIDE/app/src/EventsFunctionsList/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -557,7 +557,6 @@ const EventsFunctionsList = React.forwardRef<

const preferences = React.useContext(PreferencesContext);
const gdevelopTheme = React.useContext(GDevelopThemeContext);
const { getShowEventBasedObjectsEditor } = preferences;
const { currentlyRunningInAppTutorial } = React.useContext(
InAppTutorialContext
);
Expand Down Expand Up @@ -1089,30 +1088,28 @@ const EventsFunctionsList = React.forwardRef<
];
},
},
getShowEventBasedObjectsEditor()
? {
isRoot: true,
content: new LabelTreeViewItemContent(
extensionObjectsRootFolderId,
i18n._(t`Objects`),
{
icon: <Add />,
label: i18n._(t`Add an object`),
click: addNewEventsBasedObject,
}
),
getChildren(i18n: I18nType): ?Array<TreeViewItem> {
return objectTreeViewItems.length === 0
? [
new PlaceHolderTreeViewItem(
extensionObjectsEmptyPlaceholderId,
i18n._(t`Start by adding a new object.`)
),
]
: objectTreeViewItems;
},
{
isRoot: true,
content: new LabelTreeViewItemContent(
extensionObjectsRootFolderId,
i18n._(t`Objects`),
{
icon: <Add />,
label: i18n._(t`Add an object`),
click: addNewEventsBasedObject,
}
: null,
),
getChildren(i18n: I18nType): ?Array<TreeViewItem> {
return objectTreeViewItems.length === 0
? [
new PlaceHolderTreeViewItem(
extensionObjectsEmptyPlaceholderId,
i18n._(t`Start by adding a new object.`)
),
]
: objectTreeViewItems;
},
},
{
isRoot: true,
content: new LabelTreeViewItemContent(
Expand Down Expand Up @@ -1190,7 +1187,6 @@ const EventsFunctionsList = React.forwardRef<
].filter(Boolean);
},
[
getShowEventBasedObjectsEditor,
addNewEventsBasedObject,
addNewEventsBehavior,
onSelectExtensionProperties,
Expand Down
6 changes: 0 additions & 6 deletions newIDE/app/src/MainFrame/Preferences/PreferencesContext.js
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,6 @@ export type PreferencesValues = {|
eventsSheetCancelInlineParameter: 'cancel' | 'apply',
showCommunityExtensions: boolean,
showGetStartedSectionByDefault: boolean,
showEventBasedObjectsEditor: boolean,
showInAppTutorialDeveloperMode: boolean,
showDeprecatedInstructionWarning: boolean,
openDiagnosticReportAutomatically: boolean,
Expand Down Expand Up @@ -293,8 +292,6 @@ export type Preferences = {|
setEventsSheetCancelInlineParameter: (value: string) => void,
setShowCommunityExtensions: (enabled: boolean) => void,
setShowGetStartedSectionByDefault: (enabled: boolean) => void,
setShowEventBasedObjectsEditor: (enabled: boolean) => void,
getShowEventBasedObjectsEditor: () => boolean,
setShowInAppTutorialDeveloperMode: (enabled: boolean) => void,
setOpenDiagnosticReportAutomatically: (enabled: boolean) => void,
getOpenDiagnosticReportAutomatically: () => boolean,
Expand Down Expand Up @@ -368,7 +365,6 @@ export const initialPreferences = {
eventsSheetCancelInlineParameter: 'apply',
showCommunityExtensions: false,
showGetStartedSectionByDefault: true,
showEventBasedObjectsEditor: false,
showInAppTutorialDeveloperMode: false,
openDiagnosticReportAutomatically: true,
showDeprecatedInstructionWarning: false,
Expand Down Expand Up @@ -433,8 +429,6 @@ export const initialPreferences = {
setEventsSheetCancelInlineParameter: () => {},
setShowCommunityExtensions: () => {},
setShowGetStartedSectionByDefault: (enabled: boolean) => {},
setShowEventBasedObjectsEditor: (enabled: boolean) => {},
getShowEventBasedObjectsEditor: () => false,
setShowInAppTutorialDeveloperMode: (enabled: boolean) => {},
setShowDeprecatedInstructionWarning: (enabled: boolean) => {},
getOpenDiagnosticReportAutomatically: () => true,
Expand Down
11 changes: 0 additions & 11 deletions newIDE/app/src/MainFrame/Preferences/PreferencesDialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ const PreferencesDialog = ({
setIsAlwaysOnTopInPreview,
setEventsSheetCancelInlineParameter,
setShowCommunityExtensions,
setShowEventBasedObjectsEditor,
setShowInAppTutorialDeveloperMode,
setOpenDiagnosticReportAutomatically,
setShowDeprecatedInstructionWarning,
Expand Down Expand Up @@ -507,16 +506,6 @@ const PreferencesDialog = ({
<Text size="block-title">
<Trans>Contributor options</Trans>
</Text>
<Toggle
onToggle={(e, check) => setShowEventBasedObjectsEditor(check)}
toggled={values.showEventBasedObjectsEditor}
labelPosition="right"
label={
<Trans>
Show custom objects in the extension editor (experimental)
</Trans>
}
/>
<Toggle
onToggle={(e, check) => setShowInAppTutorialDeveloperMode(check)}
toggled={values.showInAppTutorialDeveloperMode}
Expand Down
22 changes: 0 additions & 22 deletions newIDE/app/src/MainFrame/Preferences/PreferencesProvider.js
Original file line number Diff line number Diff line change
Expand Up @@ -152,12 +152,6 @@ export default class PreferencesProvider extends React.Component<Props, State> {
setShowGetStartedSectionByDefault: this._setShowGetStartedSection.bind(
this
),
setShowEventBasedObjectsEditor: this._setShowEventBasedObjectsEditor.bind(
this
),
getShowEventBasedObjectsEditor: this._getShowEventBasedObjectsEditor.bind(
this
),
setShowInAppTutorialDeveloperMode: this._setShowInAppTutorialDeveloperMode.bind(
this
),
Expand Down Expand Up @@ -453,22 +447,6 @@ export default class PreferencesProvider extends React.Component<Props, State> {
);
}

_setShowEventBasedObjectsEditor(showEventBasedObjectsEditor: boolean) {
this.setState(
state => ({
values: {
...state.values,
showEventBasedObjectsEditor,
},
}),
() => this._persistValuesToLocalStorage(this.state)
);
}

_getShowEventBasedObjectsEditor() {
return this.state.values.showEventBasedObjectsEditor;
}

_setShowInAppTutorialDeveloperMode(showInAppTutorialDeveloperMode: boolean) {
this.setState(
state => ({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ export const Default = () => (
export const WithObjectEditor = () => {
const preferences: Preferences = {
...initialPreferences,
getShowEventBasedObjectsEditor: () => true,
};

return (
Expand Down

0 comments on commit 6d597a4

Please sign in to comment.