Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions GDevelop.js/Bindings/Bindings.idl
Original file line number Diff line number Diff line change
Expand Up @@ -846,6 +846,9 @@ interface BehaviorsSharedData {
boolean UpdateProperty([Const] DOMString name, [Const] DOMString value);
void InitializeContent();

boolean IsFolded();
void SetFolded(boolean folded);

[Ref] QuickCustomizationVisibilitiesContainer GetPropertiesQuickCustomizationVisibilities();
};

Expand Down
2 changes: 2 additions & 0 deletions GDevelop.js/types.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -742,6 +742,8 @@ export class BehaviorsSharedData extends EmscriptenObject {
getProperties(): MapStringPropertyDescriptor;
updateProperty(name: string, value: string): boolean;
initializeContent(): void;
isFolded(): boolean;
setFolded(folded: boolean): void;
getPropertiesQuickCustomizationVisibilities(): QuickCustomizationVisibilitiesContainer;
}

Expand Down
2 changes: 2 additions & 0 deletions GDevelop.js/types/gdbehaviorsshareddata.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ declare class gdBehaviorsSharedData {
getProperties(): gdMapStringPropertyDescriptor;
updateProperty(name: string, value: string): boolean;
initializeContent(): void;
isFolded(): boolean;
setFolded(folded: boolean): void;
getPropertiesQuickCustomizationVisibilities(): gdQuickCustomizationVisibilitiesContainer;
delete(): void;
ptr: number;
Expand Down
8 changes: 4 additions & 4 deletions newIDE/app/src/EventsSheet/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -541,7 +541,7 @@ export class EventsSheetComponentWithoutHandle extends React.Component<
onToggleSearchPanel={this._toggleSearchPanel}
canMoveEventsIntoNewGroup={hasSomethingSelected(this.state.selection)}
moveEventsIntoNewGroup={this.moveEventsIntoNewGroup}
onOpenSceneVariables={this.editLayoutVariables}
onOpenSceneVariables={this.openSceneVariables}
/>
);
}
Expand Down Expand Up @@ -856,7 +856,7 @@ export class EventsSheetComponentWithoutHandle extends React.Component<
});
};

editLayoutVariables = (open: boolean = true) => {
openSceneVariables = (open: boolean = true) => {
this.setState({ layoutVariablesDialogOpen: open });
};

Expand Down Expand Up @@ -2765,8 +2765,8 @@ export class EventsSheetComponentWithoutHandle extends React.Component<
<GlobalAndSceneVariablesDialog
projectScopedContainersAccessor={projectScopedContainersAccessor}
open
onCancel={() => this.editLayoutVariables(false)}
onApply={() => this.editLayoutVariables(false)}
onCancel={() => this.openSceneVariables(false)}
onApply={() => this.openSceneVariables(false)}
hotReloadPreviewButtonProps={hotReloadPreviewButtonProps}
isListLocked={false}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,6 @@ export const CompactLayerPropertiesEditor = ({
schema={layerPropertiesSchema}
instances={[layer]}
onInstancesModified={onLayersModified}
// $FlowFixMe[incompatible-type]
onRefreshAllFields={forceRecomputeSchema}
/>
</ColumnStackLayout>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,6 @@ export const ChildObjectPropertiesEditor = ({
onInstancesModified={() => {
// TODO: undo/redo?
}}
// $FlowFixMe[incompatible-type]
onRefreshAllFields={forceRecomputeSchema}
placeholder={<Trans>This object has no properties.</Trans>}
customizeBasicSchema={schema =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,6 @@ export const CompactBehaviorPropertiesEditor = ({
onBehaviorUpdated,
resourceManagementProps,
}: CompactBehaviorPropertiesEditorProps): React.Node => {
const fullEditorLabel = behaviorMetadata.getOpenFullEditorLabel();

const [schemaRecomputeTrigger, forceRecomputeSchema] = useForceRecompute();

const propertiesSchema = React.useMemo(
Expand Down Expand Up @@ -194,13 +192,12 @@ export const CompactBehaviorPropertiesEditor = ({
? schema =>
getSchemaWithOpenFullEditorButton({
schema,
fullEditorLabel,
fullEditorLabel: behaviorMetadata.getOpenFullEditorLabel(),
behavior,
onOpenFullEditor,
})
: null
}
// $FlowFixMe[incompatible-type]
onRefreshAllFields={forceRecomputeSchema}
/>
</ColumnStackLayout>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export type CompactBehaviorPropertiesEditorProps = {|
project: gdProject,
behaviorMetadata: gdBehaviorMetadata,
behavior: gdBehavior,
object: gdObject,
object: gdObject | null,
behaviorOverriding: gdBehavior | null,
initialInstance: gdInitialInstance | null,
onOpenFullEditor?: () => void,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -605,7 +605,6 @@ export const CompactObjectPropertiesEditor = ({
onEditObject,
})
}
// $FlowFixMe[incompatible-type]
onRefreshAllFields={forceRecomputeSchema}
/>
{shouldDisplayVariant && (
Expand Down
4 changes: 2 additions & 2 deletions newIDE/app/src/ProjectManager/SceneTreeViewItemContent.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export type SceneTreeViewItemProps = {|
...SceneTreeViewItemCommonProps,
project: gdProject,
onOpenLayoutProperties: (layout: ?gdLayout) => void,
onOpenLayoutVariables: (layout: ?gdLayout) => void,
openSceneVariables: (layout: ?gdLayout) => void,
|};

export const getSceneTreeViewItemId = (scene: gdLayout): string => {
Expand Down Expand Up @@ -153,7 +153,7 @@ export class SceneTreeViewItemContent implements TreeViewItemContent {
{
label: i18n._(t`Edit scene variables`),
enabled: true,
click: () => this.props.onOpenLayoutVariables(this.scene),
click: () => this.props.openSceneVariables(this.scene),
},
{
label: i18n._(t`Set as start scene`),
Expand Down
12 changes: 6 additions & 6 deletions newIDE/app/src/ProjectManager/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -600,7 +600,7 @@ const ProjectManager = React.forwardRef<Props, ProjectManagerInterface>(
const onOpenLayoutProperties = React.useCallback((layout: ?gdLayout) => {
setEditedPropertiesLayout(layout);
}, []);
const onOpenLayoutVariables = React.useCallback((layout: ?gdLayout) => {
const openSceneVariables = React.useCallback((layout: ?gdLayout) => {
setEditedVariablesLayout(layout);
}, []);

Expand Down Expand Up @@ -906,7 +906,7 @@ const ProjectManager = React.forwardRef<Props, ProjectManagerInterface>(
onRenameLayout,
onOpenLayout,
onOpenLayoutProperties,
onOpenLayoutVariables,
openSceneVariables,
}
: null,
[
Expand All @@ -924,7 +924,7 @@ const ProjectManager = React.forwardRef<Props, ProjectManagerInterface>(
onRenameLayout,
onOpenLayout,
onOpenLayoutProperties,
onOpenLayoutVariables,
openSceneVariables,
]
);

Expand Down Expand Up @@ -1480,7 +1480,7 @@ const ProjectManager = React.forwardRef<Props, ProjectManagerInterface>(
}}
onClose={() => onOpenLayoutProperties(null)}
onEditVariables={() => {
onOpenLayoutVariables(editedPropertiesLayout);
openSceneVariables(editedPropertiesLayout);
onOpenLayoutProperties(null);
}}
resourceManagementProps={resourceManagementProps}
Expand All @@ -1497,10 +1497,10 @@ const ProjectManager = React.forwardRef<Props, ProjectManagerInterface>(
open
project={project}
layout={editedVariablesLayout}
onCancel={() => onOpenLayoutVariables(null)}
onCancel={() => openSceneVariables(null)}
onApply={() => {
triggerUnsavedChanges();
onOpenLayoutVariables(null);
openSceneVariables(null);
}}
hotReloadPreviewButtonProps={hotReloadPreviewButtonProps}
isListLocked={false}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ const QuickBehaviorPropertiesEditor = ({
instances={[behavior]}
onInstancesModified={onBehaviorUpdated}
resourceManagementProps={resourceManagementProps}
// $FlowFixMe[incompatible-type]
onRefreshAllFields={forceRecomputeSchema}
/>
</Column>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
// @flow
import * as React from 'react';
import { ColumnStackLayout } from '../../UI/Layout';
import { Trans } from '@lingui/macro';
import { CompactPropertiesEditorByVisibility } from '../../CompactPropertiesEditor/CompactPropertiesEditorByVisibility';
import propertiesMapToSchema from '../../PropertiesEditor/PropertiesMapToSchema';
import { useForceRecompute } from '../../Utils/UseForceUpdate';
import { type ResourceManagementProps } from '../../ResourcesList/ResourceSource';

type CompactBehaviorPropertiesEditorProps = {|
project: gdProject,
behaviorMetadata: gdBehaviorMetadata,
behaviorSharedData: gdBehaviorsSharedData,
resourceManagementProps: ResourceManagementProps,
isAdvancedSectionInitiallyUncollapsed?: boolean,
|};

export const CompactBehaviorSharedDataPropertiesEditor = ({
project,
behaviorMetadata,
behaviorSharedData,
resourceManagementProps,
}: CompactBehaviorPropertiesEditorProps): React.Node => {
const [schemaRecomputeTrigger, forceRecomputeSchema] = useForceRecompute();

const propertiesSchema = React.useMemo(
() => {
if (schemaRecomputeTrigger) {
// schemaRecomputeTrigger allows to invalidate the schema when required.
}
const behaviorMetadataSharedProperties = behaviorMetadata.getSharedProperties();
return propertiesMapToSchema({
properties: behaviorMetadataSharedProperties,
defaultValueProperties: behaviorMetadataSharedProperties,
getPropertyValue: (instance, name) =>
instance
.getProperties()
.get(name)
.getValue(),
onUpdateProperty: (instance, name, value) => {
instance.updateProperty(name, value);
},
object: null,
visibility: 'All',
});
},
[schemaRecomputeTrigger, behaviorMetadata]
);

return (
<ColumnStackLayout expand noMargin noOverflowParent>
<CompactPropertiesEditorByVisibility
project={project}
object={null}
schema={propertiesSchema}
instances={[behaviorSharedData]}
resourceManagementProps={resourceManagementProps}
placeholder={<Trans>Nothing to configure for this behavior.</Trans>}
onRefreshAllFields={forceRecomputeSchema}
/>
</ColumnStackLayout>
);
};
Loading
Loading