mirror of
https://github.com/4ian/GDevelop.git
synced 2025-10-15 10:19:04 +00:00
Compare commits
3 Commits
d41998ec1b
...
child-over
Author | SHA1 | Date | |
---|---|---|---|
![]() |
4e35ed3112 | ||
![]() |
9fcd2f4d27 | ||
![]() |
db66570de1 |
@@ -60,6 +60,7 @@ import {
|
||||
isVariantEditable,
|
||||
duplicateVariant,
|
||||
deleteVariant,
|
||||
ChildrenOverridingDepreciationAlert,
|
||||
} from '../Editors/CustomObjectPropertiesEditor';
|
||||
import NewVariantDialog from '../Editors/CustomObjectPropertiesEditor/NewVariantDialog';
|
||||
import useAlertDialog from '../../UI/Alert/useAlertDialog';
|
||||
@@ -717,6 +718,11 @@ export const CompactObjectPropertiesEditor = ({
|
||||
</CompactSelectField>
|
||||
</ColumnStackLayout>
|
||||
)}
|
||||
{shouldDisplayEventsBasedObjectChildren &&
|
||||
customObjectConfiguration &&
|
||||
!customObjectConfiguration.isForcedToOverrideEventsBasedObjectChildrenConfiguration() && (
|
||||
<ChildrenOverridingDepreciationAlert />
|
||||
)}
|
||||
{customObjectEventsBasedObject &&
|
||||
customObjectConfiguration &&
|
||||
shouldDisplayEventsBasedObjectChildren &&
|
||||
|
@@ -62,6 +62,7 @@ import {
|
||||
unserializeFromJSObject,
|
||||
} from '../../../Utils/Serializer';
|
||||
import useAlertDialog from '../../../UI/Alert/useAlertDialog';
|
||||
import { MarkdownText } from '../../../UI/MarkdownText';
|
||||
|
||||
const gd: libGDevelop = global.gd;
|
||||
|
||||
@@ -69,6 +70,17 @@ const styles = {
|
||||
icon: { width: 16, height: 16 },
|
||||
};
|
||||
|
||||
export const ChildrenOverridingDepreciationAlert = () => {
|
||||
return (
|
||||
<AlertMessage kind="warning">
|
||||
<MarkdownText
|
||||
translatableSource={t`Children configurations are deprecated. This [migration documentation](https://wiki.gdevelop.io/gdevelop5/objects/custom-objects-prefab-template/migrate-to-variants/) can help you use variants instead.`}
|
||||
isStandaloneText
|
||||
/>
|
||||
</AlertMessage>
|
||||
);
|
||||
};
|
||||
|
||||
export const getVariantName = (
|
||||
eventBasedObject: gdEventsBasedObject | null,
|
||||
customObjectConfiguration: gdCustomObjectConfiguration
|
||||
@@ -538,30 +550,7 @@ const CustomObjectPropertiesEditor = (props: Props) => {
|
||||
customObjectConfiguration.isForcedToOverrideEventsBasedObjectChildrenConfiguration()) &&
|
||||
(customObjectEventsBasedObject &&
|
||||
(!customObjectConfiguration.isForcedToOverrideEventsBasedObjectChildrenConfiguration() &&
|
||||
!customObjectConfiguration.isMarkedAsOverridingEventsBasedObjectChildrenConfiguration() ? (
|
||||
<Line alignItems="center">
|
||||
<Column expand noMargin>
|
||||
<Text size="block-title">Children objects</Text>
|
||||
</Column>
|
||||
<Column alignItems="right">
|
||||
<FlatButton
|
||||
label={
|
||||
<Trans>Override children configuration</Trans>
|
||||
}
|
||||
onClick={() => {
|
||||
customObjectConfiguration.setMarkedAsOverridingEventsBasedObjectChildrenConfiguration(
|
||||
true
|
||||
);
|
||||
customObjectConfiguration.clearChildrenConfiguration();
|
||||
if (onObjectUpdated) {
|
||||
onObjectUpdated();
|
||||
}
|
||||
forceUpdate();
|
||||
}}
|
||||
/>
|
||||
</Column>
|
||||
</Line>
|
||||
) : (
|
||||
!customObjectConfiguration.isMarkedAsOverridingEventsBasedObjectChildrenConfiguration() ? null : (
|
||||
<>
|
||||
<Line alignItems="center">
|
||||
<Column expand noMargin>
|
||||
@@ -590,6 +579,9 @@ const CustomObjectPropertiesEditor = (props: Props) => {
|
||||
</Column>
|
||||
)}
|
||||
</Line>
|
||||
{!customObjectConfiguration.isForcedToOverrideEventsBasedObjectChildrenConfiguration() && (
|
||||
<ChildrenOverridingDepreciationAlert />
|
||||
)}
|
||||
{mapFor(
|
||||
0,
|
||||
customObjectEventsBasedObject
|
||||
|
@@ -20,7 +20,7 @@ import {
|
||||
import { type ObjectEditorTab } from '../ObjectEditor/ObjectEditorDialog';
|
||||
import type { ObjectWithContext } from '../ObjectsList/EnumerateObjects';
|
||||
import { type HTMLDataset } from '../Utils/HTMLDataset';
|
||||
import { getVariant } from '../ObjectEditor/Editors/CustomObjectPropertiesEditor';
|
||||
import { isVariantEditable } from '../ObjectEditor/Editors/CustomObjectPropertiesEditor';
|
||||
|
||||
const gd: libGDevelop = global.gd;
|
||||
|
||||
@@ -313,6 +313,14 @@ export class ObjectTreeViewItemContent implements TreeViewItemContent {
|
||||
project.getCurrentPlatform(),
|
||||
object.getType()
|
||||
);
|
||||
const objectExtensionName = gd.PlatformExtension.getExtensionFromFullObjectType(
|
||||
object.getType()
|
||||
);
|
||||
const customObjectExtension = project.hasEventsFunctionsExtensionNamed(
|
||||
objectExtensionName
|
||||
)
|
||||
? project.getEventsFunctionsExtension(objectExtensionName)
|
||||
: null;
|
||||
return [
|
||||
{
|
||||
label: i18n._(t`Copy`),
|
||||
@@ -372,11 +380,11 @@ export class ObjectTreeViewItemContent implements TreeViewItemContent {
|
||||
project.hasEventsBasedObject(object.getType())
|
||||
? {
|
||||
label: i18n._(t`Edit children`),
|
||||
enabled:
|
||||
getVariant(
|
||||
project.getEventsBasedObject(object.getType()),
|
||||
gd.asCustomObjectConfiguration(object.getConfiguration())
|
||||
).getAssetStoreAssetId() === '',
|
||||
enabled: isVariantEditable(
|
||||
gd.asCustomObjectConfiguration(object.getConfiguration()),
|
||||
project.getEventsBasedObject(object.getType()),
|
||||
customObjectExtension
|
||||
),
|
||||
click: () => {
|
||||
const customObjectConfiguration = gd.asCustomObjectConfiguration(
|
||||
object.getConfiguration()
|
||||
|
@@ -81,7 +81,7 @@ import { unserializeFromJSObject } from '../Utils/Serializer';
|
||||
import { ProjectScopedContainersAccessor } from '../InstructionOrExpression/EventsScope';
|
||||
import { type TileMapTileSelection } from '../InstancesEditor/TileSetVisualizer';
|
||||
import { extractAsCustomObject } from './CustomObjectExtractor/CustomObjectExtractor';
|
||||
import { getVariant } from '../ObjectEditor/Editors/CustomObjectPropertiesEditor';
|
||||
import { isVariantEditable } from '../ObjectEditor/Editors/CustomObjectPropertiesEditor';
|
||||
|
||||
const gd: libGDevelop = global.gd;
|
||||
|
||||
@@ -1555,6 +1555,15 @@ export default class SceneEditor extends React.Component<Props, State> {
|
||||
)
|
||||
: null;
|
||||
|
||||
const objectExtensionName = gd.PlatformExtension.getExtensionFromFullObjectType(
|
||||
object.getType()
|
||||
);
|
||||
const customObjectExtension = project.hasEventsFunctionsExtensionNamed(
|
||||
objectExtensionName
|
||||
)
|
||||
? project.getEventsFunctionsExtension(objectExtensionName)
|
||||
: null;
|
||||
|
||||
return [
|
||||
...this.getContextMenuInstancesWiseItems(i18n),
|
||||
{ type: 'separator' },
|
||||
@@ -1582,11 +1591,11 @@ export default class SceneEditor extends React.Component<Props, State> {
|
||||
object && project.hasEventsBasedObject(object.getType())
|
||||
? {
|
||||
label: i18n._(t`Edit children`),
|
||||
enabled:
|
||||
getVariant(
|
||||
project.getEventsBasedObject(object.getType()),
|
||||
gd.asCustomObjectConfiguration(object.getConfiguration())
|
||||
).getAssetStoreAssetId() === '',
|
||||
enabled: isVariantEditable(
|
||||
gd.asCustomObjectConfiguration(object.getConfiguration()),
|
||||
project.getEventsBasedObject(object.getType()),
|
||||
customObjectExtension
|
||||
),
|
||||
click: () => {
|
||||
const customObjectConfiguration = gd.asCustomObjectConfiguration(
|
||||
object.getConfiguration()
|
||||
|
Reference in New Issue
Block a user