Skip to content

Commit 37deefe

Browse files
authored
Forward compatibility for alternate events generation (#8834)
Don't show in changelog
1 parent 8216394 commit 37deefe

2 files changed

Lines changed: 47 additions & 14 deletions

File tree

newIDE/app/src/EditorFunctions/index.js

Lines changed: 46 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,7 @@ export type EventsGenerationResult =
200200

201201
export type EventBatch = {|
202202
eventsDescription: string,
203+
eventsScript: string | null,
203204
placementRelation: string,
204205
placementTargetEventId: string | null,
205206
placementExpectedParentEventId: string | null,
@@ -4705,6 +4706,10 @@ const addSceneEvents: EditorFunction = {
47054706
batch,
47064707
'events_description'
47074708
);
4709+
const eventsScript = SafeExtractor.extractStringProperty(
4710+
batch,
4711+
'events_script'
4712+
);
47084713
const placementRelation = SafeExtractor.extractStringProperty(
47094714
batch,
47104715
'placement_relation'
@@ -4724,18 +4729,34 @@ const addSceneEvents: EditorFunction = {
47244729

47254730
return (
47264731
<ColumnStackLayout noMargin>
4727-
<Text
4728-
noMargin
4729-
allowSelection
4730-
color="secondary"
4731-
size="body-small"
4732-
style={{ whiteSpace: 'pre-wrap', overflowWrap: 'anywhere' }}
4733-
>
4734-
<b>
4735-
<Trans>Description</Trans>
4736-
</b>
4737-
: {eventsDescription}
4738-
</Text>
4732+
{eventsDescription && (
4733+
<Text
4734+
noMargin
4735+
allowSelection
4736+
color="secondary"
4737+
size="body-small"
4738+
style={{ whiteSpace: 'pre-wrap', overflowWrap: 'anywhere' }}
4739+
>
4740+
<b>
4741+
<Trans>Description</Trans>
4742+
</b>
4743+
: {eventsDescription}
4744+
</Text>
4745+
)}
4746+
{eventsScript && (
4747+
<Text
4748+
noMargin
4749+
allowSelection
4750+
color="secondary"
4751+
size="body-small"
4752+
style={{ whiteSpace: 'pre-wrap', overflowWrap: 'anywhere' }}
4753+
>
4754+
<b>
4755+
<Trans>Events script</Trans>
4756+
</b>
4757+
: {eventsScript}
4758+
</Text>
4759+
)}
47394760
{placementRelation && (
47404761
<Text
47414762
noMargin
@@ -4961,6 +4982,10 @@ const addSceneEvents: EditorFunction = {
49614982
batch,
49624983
'events_description'
49634984
) || '',
4985+
eventsScript: SafeExtractor.extractStringProperty(
4986+
batch,
4987+
'events_script'
4988+
),
49644989
placementRelation:
49654990
SafeExtractor.extractStringProperty(
49664991
batch,
@@ -4988,9 +5013,16 @@ const addSceneEvents: EditorFunction = {
49885013
'No event batches provided. Provide one or more with a description of events to generate.'
49895014
);
49905015
}
4991-
if (parsedEventBatches.some(batch => !batch.eventsDescription)) {
5016+
if (
5017+
parsedEventBatches.some(
5018+
batch =>
5019+
!batch.eventsDescription &&
5020+
!batch.eventsScript &&
5021+
batch.placementRelation !== 'delete'
5022+
)
5023+
) {
49925024
return makeGenericFailure(
4993-
'No events description provided for some event batches. Provide a description for each event(s) to generate.'
5025+
'No events description/events script provided for some event batches. Provide one for each event(s) to generate.'
49945026
);
49955027
}
49965028
} else if (!eventsDescription) {

newIDE/app/src/Utils/GDevelopServices/Generation.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,7 @@ export type AiGeneratedEventChange = {
199199

200200
export type AiGeneratedEventBatch = {
201201
eventsDescription: string,
202+
eventsScript: string | null,
202203
placementRelation: string,
203204
placementTargetEventId: string | null,
204205
placementExpectedParentEventId: string | null,

0 commit comments

Comments
 (0)