before_code
stringlengths
83
9.98k
reviewer_comment
stringlengths
50
25.5k
language
stringclasses
37 values
diff_context
stringlengths
21
28.7k
after_code
stringlengths
102
9.96k
repo_name
stringclasses
406 values
file_path
stringlengths
6
186
comment_type
stringclasses
5 values
quality_score
float32
0.5
1
} setCustomCenter(customCenterX, customCenterY) { this._customCenterX = customCenterX; this._customCenterY = customCenterY; this.invalidateHitboxes(); } getRendererObject() { return null; } getWidth() { return this._customWidth; } getHeight() { return this._customHeight; } ...
```suggestion this._customHeight = height; ```
JavaScript
@@ -62,6 +62,14 @@ return this._customHeight; } + setWidth(width) { + this._customWidth = width; + } + + setHeight(height) { + return this._customHeight = height;
} setCustomCenter(customCenterX, customCenterY) { this._customCenterX = customCenterX; this._customCenterY = customCenterY; this.invalidateHitboxes(); } getRendererObject() { return null; } getWidth() { return this._customWidth; } getHeight() { return this._customHeight; } ...
4ian/GDevelop
GDJS/tests/tests/Extensions/testspriteruntimeobject.js
suggestion
0.571
case 'RotateCamera': case 'ZoomCamera': case 'FixCamera': case 'CentreCamera': return ['smooth-camera-movement']; case 'ChangeTimeScale': return ['pause-menu']; case 'EcrireFichierExp': case 'EcrireFichierTxt': case 'LireFichierExp': case 'LireFichierTxt': case 'ReadN...
```suggestion return ['intermediate-toggle-states-with-variable']; ```
JavaScript
@@ -124,6 +126,8 @@ export const getInstructionTutorialIds = (type: string): Array<string> => { case 'ToggleObjectVariableAsBoolean': case 'ToggleGlobalVariableAsBoolean': case 'ToggleSceneVariableAsBoolean': + case 'SetBooleanObjectVariable': + case 'SetBooleanVariable': return ['iIntermedi...
case 'RotateCamera': case 'ZoomCamera': case 'FixCamera': case 'CentreCamera': return ['smooth-camera-movement']; case 'ChangeTimeScale': return ['pause-menu']; case 'EcrireFichierExp': case 'EcrireFichierTxt': case 'LireFichierExp': case 'LireFichierTxt': case 'ReadN...
4ian/GDevelop
newIDE/app/src/Utils/GDevelopServices/Tutorial.js
suggestion
0.571
// @flow export default function getObjectByName( globalObjectsContainer: gdObjectsContainer | null, objectsContainer?: ?gdObjectsContainer, objectName: string ): ?gdObject { if (objectsContainer && objectsContainer.hasObjectNamed(objectName)) return objectsContainer.getObject(objectName); else if ( ...
`ObjectsContainersList` should be used instead. You can pass a `ProjectScopedContainersAccessor` to your component.
JavaScript
@@ -15,3 +15,18 @@ export default function getObjectByName( return null; } + +export const hasObjectWithName = ( + globalObjectsContainer: gdObjectsContainer | null, + objectsContainer?: ?gdObjectsContainer, + objectName: string +): boolean => {
// @flow export default function getObjectByName( globalObjectsContainer: gdObjectsContainer | null, objectsContainer?: ?gdObjectsContainer, objectName: string ): ?gdObject { if (objectsContainer && objectsContainer.hasObjectNamed(objectName)) return objectsContainer.getObject(objectName); else if ( ...
4ian/GDevelop
newIDE/app/src/Utils/GetObjectByName.js
suggestion
0.571
> <QuickPublish project={testProject.project} gameAndBuildsManager={fakeEmptyGameAndBuildsManager} isSavingProject={false} isRequiredToSaveAsNewCloudProject={() => // Indicates that the project is already saved, there will be // no need to sa...
I feel like this comment should be next to the props type in QuickPublish. I was not sure what it meant before reading this comment
JavaScript
@@ -119,6 +124,39 @@ export const AuthenticatedWithTooManyCloudProjects = () => { </Template> ); }; + +export const AuthenticatedWithCloudProjectsMaximumReachedButSavedAlready = () => { + return ( + <Template> + <AuthenticatedUserContext.Provider + value={{ + ...fakeAuthenticatedUserWi...
onClose={action('onClose')} onContinueQuickCustomization={action('onContinueQuickCustomization')} onTryAnotherGame={action('onTryAnotherGame')} /> </AuthenticatedUserContext.Provider> </Template> ); }; export const AuthenticatedWithCloudProjectsMaximumReachedButSavedAl...
4ian/GDevelop
newIDE/app/src/stories/componentStories/QuickCustomization/QuickPublish.stories.js
suggestion
0.571
if (!selectedItem) return; if (selectedItem.content.isDescendantOf(item.content)) { selectObjectFolderOrObjectWithContext(null); } }, [selectObjectFolderOrObjectWithContext, selectedItems] ); // Force List component to be mounted again if project or objectsContaine...
Removing the column, you removed the margin, you should maybe remove the `noMargin` in the child Column
JavaScript
@@ -1363,28 +1393,16 @@ const ObjectsList = React.forwardRef<Props, ObjectsListInterface>( return ( <Background maxWidth> - <Column>
* does not stay selected and not visible to the user. */ const onCollapseItem = React.useCallback( (item: TreeViewItem) => { if (!selectedItems || selectedItems.length !== 1) return; const selectedItem = selectedItems[0]; if (!selectedItem) return; if (selectedItem.co...
4ian/GDevelop
newIDE/app/src/ObjectsList/index.js
suggestion
0.571
this._loadedTextures.clear(); const threeTextures: THREE.Texture[] = []; this._loadedThreeTextures.values(threeTextures); this._loadedThreeTextures.clear(); for (const threeTexture of threeTextures) { threeTexture.dispose(); } const threeMaterials: THREE.Material[] = ...
Will this work? ``` for (const pixiTexture of this._diskTextures.values()) { if (pixiTexture.destroyed) { continue; } pixiTexture.destroy(); } this._diskTextures.clear(); ``` Minus new array creation.
TypeScript
@@ -463,6 +463,54 @@ namespace gdjs { } return particleTexture; } + + dispose(): void { + this._loadedTextures.clear(); + + const threeTextures: THREE.Texture[] = []; + this._loadedThreeTextures.values(threeTextures); + this._loadedThreeTextures.clear(); + for (const three...
* To be called when the game is disposed. * Clear caches of loaded textures and materials. */ dispose(): void { this._loadedTextures.clear(); const threeTextures: THREE.Texture[] = []; this._loadedThreeTextures.values(threeTextures); this._loadedThreeTextures.clear(); f...
4ian/GDevelop
GDJS/Runtime/pixi-renderers/pixi-image-manager.ts
suggestion
0.786
/** * @brief Return the scene variables of the current scene or the current * extension. It allows legacy "scenevar" parameters to accept extension * variables. */ const gd::VariablesContainer &GetLegacySceneVariables() const { return legacySceneVariables; }; const gd::PropertiesContainersList ...
These are not references/pointers but values, meaning that ProjectScopedContainers moved from "I'm just a set of lists pointing to things in your project" to "I actually hold stuff, and you will have a bad time if you destroyed me and kept references to things".
C/C++
@@ -236,6 +230,8 @@ class ProjectScopedContainers { private: gd::ObjectsContainersList objectsContainersList; gd::VariablesContainersList variablesContainersList; + gd::VariablesContainer legacyGlobalVariables; + gd::VariablesContainer legacySceneVariables;
/** * @brief Return the scene variables of the current scene or the current * extension. It allows legacy "scenevar" parameters to accept extension * variables. */ const gd::VariablesContainer *GetLegacySceneVariables() const { return legacySceneVariables; }; const gd::PropertiesContainersList ...
4ian/GDevelop
Core/GDCore/Project/ProjectScopedContainers.h
suggestion
0.5
// We could pass it a string, but lets do it right this.removeJoint(parseInt(jId, 10)); } } } } // Remove the joint this.world.DestroyJoint(joint); delete this.joints[jointId]; } } } gdjs.registerRuntimeSc...
In the future, a `destroy()` method on the shared data would be I think safer (in the sense: it's part of the class, so there is less chance you forget to update it when needed) and we we should probably made the "shared data" something first class that is handled by the runtime scene (rather than something that is man...
TypeScript
@@ -300,14 +309,11 @@ namespace gdjs { } } gdjs.registerRuntimeSceneUnloadedCallback(function (runtimeScene) { - if ( - // @ts-ignore - runtimeScene.physics2SharedData && - // @ts-ignore - runtimeScene.physics2SharedData.world - ) { - // @ts-ignore - Box2D.destroy(runtimeS...
if ( this.joints[jId].GetType() === Box2D.e_gearJoint && (Box2D.getPointer( (this.joints[jId] as Box2D.b2GearJoint).GetJoint1() ) === Box2D.getPointer(joint) || Box2D.getPointer( (this.joints[jId] as Bo...
4ian/GDevelop
Extensions/Physics2Behavior/physics2runtimebehavior.ts
suggestion
0.786
} catch (error) { console.error('Error while login:', error); throw error; } } async loginOrSignupWithProvider({ provider, signal, }: {| provider: IdentityProvider, signal?: AbortSignal, |}) { if (signal && signal.aborted) { return Promise.reject( new UserC...
this seemed duplicated in this file and the browser one. This was always causing an error in the console because the signal always aborts (we trigger it when we close the dialog) I don't think this deserves to raise an error as it's the expected path?
JavaScript
@@ -61,11 +61,6 @@ class LocalLoginProvider implements LoginProvider, FirebaseBasedLoginProvider { if (signal) { signal.addEventListener('abort', () => { terminateWebSocket(); - reject(
} catch (error) { console.error('Error while login:', error); throw error; } } async loginOrSignupWithProvider({ provider, signal, }: {| provider: IdentityProvider, signal?: AbortSignal, |}) { if (signal && signal.aborted) { return Promise.reject( new UserC...
4ian/GDevelop
newIDE/app/src/LoginProvider/LocalLoginProvider.js
refactor
0.643
}, }); } } this.setState({ createAccountInProgress: false, loginInProgress: false, authenticatedUser: { ...this.state.authenticatedUser, creatingOrLoggingInAccount: false, }, }); this._automaticallyUpdateUserProfile = true; }; _cancelL...
I don't like doing this here. It looks like we're trying to "finish a process". But the process is already there: <img width="776" alt="image" src="https://github.com/user-attachments/assets/6fe5b8b4-8d4c-4124-b83a-34f6d90bbd83"> There is already a catch (ensuring that an exception will never stop the end to run)...
JavaScript
@@ -996,11 +996,19 @@ export default class AuthenticatedUserProvider extends React.Component< this._automaticallyUpdateUserProfile = true; }; - _cancelLogin = () => { + _cancelLoginOrSignUp = () => { if (this._abortController) { this._abortController.abort(); this._abortController = null;...
}, }); } } this.setState({ createAccountInProgress: false, loginInProgress: false, authenticatedUser: { ...this.state.authenticatedUser, creatingOrLoggingInAccount: false, }, }); this._automaticallyUpdateUserProfile = true; }; _cancelL...
4ian/GDevelop
newIDE/app/src/Profile/AuthenticatedUserProvider.js
suggestion
0.643
preferences.getIsMenuBarHiddenInPreview, preferences.getIsAlwaysOnTopInPreview, preferences.values.openDiagnosticReportAutomatically, currentlyRunningInAppTutorial, getAuthenticatedPlayerForPreview, quickCustomizationDialogOpenedFromGameId, onCaptureFinished, createCaptur...
Consider not adding yet-another-way-to-launch-preview and instead: - Make the logic related to the timing inside the existing function. - delayTimeInSeconds can also be in the function - forcing a screenshot, bypassing the check for timing, is "just" a "forceScreenshot: true". But this is only used for quick customi...
JavaScript
@@ -1723,13 +1724,31 @@ const MainFrame = (props: Props) => { const launchNewPreview = React.useCallback( async options => { const numberOfWindows = options ? options.numberOfWindows : 1; - launchPreview({ networkPreview: false, numberOfWindows }); + await launchPreview({ networkPreview: false,...
preferences.getIsMenuBarHiddenInPreview, preferences.getIsAlwaysOnTopInPreview, preferences.values.openDiagnosticReportAutomatically, currentlyRunningInAppTutorial, getAuthenticatedPlayerForPreview, quickCustomizationDialogOpenedFromGameId, onCaptureFinished, createCaptur...
4ian/GDevelop
newIDE/app/src/MainFrame/index.js
suggestion
0.5
for (std::size_t c = 0; c < GetCameraCount(); ++c) { SerializerElement& cameraElement = camerasElement.AddChild("camera"); cameraElement.SetAttribute("defaultSize", GetCamera(c).UseDefaultSize()); cameraElement.SetAttribute("width", GetCamera(c).GetWidth()); cameraElement.SetAttribute("height", Ge...
to make it a bit shorter ```suggestion SetDefaultCameraBehavior(element.GetStringAttribute("defaultCameraBehavior", "top-left-anchored-if-never-moved")); ```
C++
@@ -80,6 +84,7 @@ void Layer::UnserializeFrom(const SerializerElement& element) { SetName(element.GetStringAttribute("name", "", "Name")); SetRenderingType(element.GetStringAttribute("renderingType", "")); SetCameraType(element.GetStringAttribute("cameraType", "perspective")); + SetDefaultCameraBehavior(el...
for (std::size_t c = 0; c < GetCameraCount(); ++c) { SerializerElement& cameraElement = camerasElement.AddChild("camera"); cameraElement.SetAttribute("defaultSize", GetCamera(c).UseDefaultSize()); cameraElement.SetAttribute("width", GetCamera(c).GetWidth()); cameraElement.SetAttribute("height", Ge...
4ian/GDevelop
Core/GDCore/Project/Layer.cpp
suggestion
0.786
// Handle scale mode. if (this._game.getScaleMode() === 'nearest') { gameCanvas.style['image-rendering'] = '-moz-crisp-edges'; gameCanvas.style['image-rendering'] = '-webkit-optimize-contrast'; gameCanvas.style['image-rendering'] = '-webkit-crisp-edges'; gameCanvas.style['im...
There is a lot of copy from the `createStandardCanvas` function. Could you rework `createStandardCanvas` so that it's using `useCanvas` under the hood? Also, the name is probably not showing this is an important operation enough, that just can't be redone a second time. So I think it should be called `initializeForC...
TypeScript
@@ -189,6 +189,120 @@ namespace gdjs { gameCanvas.focus(); } + useCanvas(gameCanvas: HTMLCanvasElement): void {
// Prevent magnifying glass on iOS with a long press. // Note that there are related bugs on iOS 15 (see https://bugs.webkit.org/show_bug.cgi?id=231161) // but it seems not to affect us as the `domElementsContainer` has `pointerEvents` set to `none`. domElementsContainer.style['-webkit-user-sel...
4ian/GDevelop
GDJS/Runtime/pixi-renderers/runtimegame-pixi-renderer.ts
suggestion
0.643
} else { outputObjectsContainer.InsertNewObject( project, parameter.GetExtraInfo(), objectName, outputObjectsContainer.GetObjectsCount()); } // Memorize the last object name. By convention, parameters that require // an object (mainly, "ob...
I wonder if the name can be confusing because a free function could have an object parameter without object type and the following behavior parameters be some capabilities (default behavior). It also won't be "all" the behaviors of the actual objects. I guess it's kind of the required behavior for objects passed in pa...
C++
@@ -71,7 +75,7 @@ void ParameterMetadataTools::ParametersToObjectsContainer( const gd::String& behaviorType = parameter.GetExtraInfo(); gd::Object& object = outputObjectsContainer.GetObject(lastObjectName); - allObjectBehaviorNames[lastObjectName].insert(behaviorName); + allObj...
// are all present (and no more than required by the object type). // Non default behaviors coming from parameters will be added or removed later. project.EnsureObjectDefaultBehaviors(outputObjectsContainer.GetObject(objectName)); } else { // Create a new object (and its default be...
4ian/GDevelop
Core/GDCore/Extensions/Metadata/ParameterMetadataTools.cpp
suggestion
1
parameters.removeParameter('MySpriteObject2'); expect(parameters.getParametersCount()).toBe(7); objectsContainer = new gd.ObjectsContainer(gd.ObjectsContainer.Function); gd.ParameterMetadataTools.parametersToObjectsContainer( project, parameters, objectsContainer ...
Maybe `ObjectMetadata::AddDefaultBehavior` can be used to simulate a change of capability in a custom object.
JavaScript
@@ -4295,19 +4295,37 @@ describe('libGD.js', function () { expect(objectsContainer.hasObjectNamed('MyObjectWithoutType')).toBe(true); expect(objectsContainer.hasObjectNamed('MySpriteObject')).toBe(true); - const objectWithoutType = objectsContainer.getObject('MyObjectWithoutType'); - expect(ob...
parameters.removeParameter('MySpriteObject2'); expect(parameters.getParametersCount()).toBe(7); objectsContainer = new gd.ObjectsContainer(); gd.ParameterMetadataTools.parametersToObjectsContainer( project, parameters, objectsContainer ); // Check that obje...
4ian/GDevelop
GDevelop.js/__tests__/Core.js
suggestion
0.571
std::set<gd::String> objectNamesInContainer = outputObjectsContainer.GetAllObjectNames(); for (const auto& objectName : objectNamesInContainer) { if (allObjectNames.find(objectName) == allObjectNames.end()) { outputObjectsContainer.RemoveObject(objectName); } } // Remove behaviors of object...
Actually, I think it's legit to add behavior parameters to require capabilities on an object without any specified type.
C++
@@ -108,8 +112,14 @@ void ParameterMetadataTools::ParametersToObjectsContainer( } auto& object = outputObjectsContainer.GetObject(objectName); + const auto& allBehaviorNames = allObjectNonDefaultBehaviorNames[objectName]; for (const auto& behaviorName : object.GetAllBehaviorNames()) { - const a...
} } // Remove objects that are not in the parameters anymore. std::set<gd::String> objectNamesInContainer = outputObjectsContainer.GetAllObjectNames(); for (const auto& objectName : objectNamesInContainer) { if (allObjectNames.find(objectName) == allObjectNames.end()) { outputObjectsContain...
4ian/GDevelop
Core/GDCore/Extensions/Metadata/ParameterMetadataTools.cpp
suggestion
0.5
import { getRelativeOrAbsoluteDisplayDate } from '../Utils/DateDisplay'; const electron = optionalRequire('electron'); const path = optionalRequire('path'); export const getThumbnailWidth = ({ isMobile }: {| isMobile: boolean |}) => isMobile ? undefined : Math.min(245, Math.max(130, window.innerWidth / 4)); export ...
I'd rather say `Your project must be stored on your computer` rather than surely, it feels more english
JavaScript
@@ -50,13 +51,37 @@ import PreferencesContext from '../MainFrame/Preferences/PreferencesContext'; import { textEllipsisStyle } from '../UI/TextEllipsis'; import FileWithLines from '../UI/CustomSvgIcons/FileWithLines'; import TextButton from '../UI/TextButton'; -import { Tooltip } from '@material-ui/core'; +import { ...
import { getRelativeOrAbsoluteDisplayDate } from '../Utils/DateDisplay'; const electron = optionalRequire('electron'); const path = optionalRequire('path'); export const getThumbnailWidth = ({ isMobile }: {| isMobile: boolean |}) => isMobile ? undefined : Math.min(245, Math.max(130, window.innerWidth / 4)); export ...
4ian/GDevelop
newIDE/app/src/GameDashboard/GameDashboardCard.js
suggestion
0.5
onChange(); }} /> <Checkbox label={<Trans>Expand inner area with parent</Trans>} checked={eventsBasedObject.isInnerAreaFollowingParentSize()} onCheck={(e, checked) => { eventsBasedObject.markAsInnerAreaFollowingParentSize(checked); onChange(); ...
```suggestion label={<Trans>Private (can only be used inside the extension)</Trans>} ```
JavaScript
@@ -141,6 +141,15 @@ export default function EventsBasedObjectEditor({ }} /> )} + <Checkbox + label={<Trans>Private</Trans>}
eventsBasedObject.markAsTextContainer(checked); onChange(); }} /> <Checkbox label={<Trans>Expand inner area with parent</Trans>} checked={eventsBasedObject.isInnerAreaFollowingParentSize()} onCheck={(e, checked) => { eventsBasedObject.markAsInner...
4ian/GDevelop
newIDE/app/src/EventsBasedObjectEditor/index.js
suggestion
0.643
type: 'separator', }, { label: i18n._(t`Copy`), click: () => this.copy(), accelerator: 'CmdOrCtrl+C', }, { label: i18n._(t`Cut`), click: () => this.cut(), accelerator: 'CmdOrCtrl+X', }, { label: i18n._(t`Paste`), ...
```suggestion <Trans>This object won't be visible in the scene editor.</Trans> ```
JavaScript
@@ -193,7 +206,21 @@ export class EventsBasedObjectTreeViewItemContent } renderRightComponent(i18n: I18nType): ?React.Node { - return null; + return this.eventsBasedObject.isPrivate() ? ( + <Tooltip + title={ + <Trans>This object won't be visible in the events editor.</Trans>
type: 'separator', }, { label: i18n._(t`Copy`), click: () => this.copy(), accelerator: 'CmdOrCtrl+C', }, { label: i18n._(t`Cut`), click: () => this.cut(), accelerator: 'CmdOrCtrl+X', }, { label: i18n._(t`Paste`), ...
4ian/GDevelop
newIDE/app/src/EventsFunctionsList/EventsBasedObjectTreeViewItemContent.js
suggestion
0.571
onUpdateProperty(instance, name, newValue); }, getLabel, getDescription, }; } else if (valueType === 'textarea') { return { name, valueType: 'textarea', getValue: (instance: Instance): string => { return getProperties(instance) .get(name) ...
The editor should ensure it never happens. If we only allow to define "AnimationName" properties in the "Behavior properties" tab here (and not in "Scene properties"): ![image](https://github.com/user-attachments/assets/099c544f-9d8d-4b86-b78e-0494f1d43319) There should always be an object when a behavior propeti...
JavaScript
@@ -220,7 +220,40 @@ const createField = ( getLabel, getDescription, }; - } else { + } else if(valueType ==='animationname') + { + function getChoices() + { + if(!object) + { return [{value:"Object is not valid !", label:"Object is not valid !"}] }
onUpdateProperty(instance, name, newValue); }, getLabel, getDescription, }; } else if (valueType === 'textarea') { return { name, valueType: 'textarea', getValue: (instance: Instance): string => { return getProperties(instance) .get(name) ...
4ian/GDevelop
newIDE/app/src/PropertiesEditor/PropertiesMapToSchema.js
suggestion
0.5
name, valueType: 'textarea', getValue: (instance: Instance): string => { return getProperties(instance) .get(name) .getValue(); }, setValue: (instance: Instance, newValue: string) => { onUpdateProperty(instance, name, newValue); }, getLabel, ...
You can use the `mapFor` fonction to shorten the code a bit. The empty string should be added to the list.
JavaScript
@@ -220,7 +220,40 @@ const createField = ( getLabel, getDescription, }; - } else { + } else if(valueType ==='animationname') + { + function getChoices() + { + if(!object) + { return [{value:"Object is not valid !", label:"Object is not valid !"}] } + + let animationArray =...
name, valueType: 'textarea', getValue: (instance: Instance): string => { return getProperties(instance) .get(name) .getValue(); }, setValue: (instance: Instance, newValue: string) => { onUpdateProperty(instance, name, newValue); }, getLabel, ...
4ian/GDevelop
newIDE/app/src/PropertiesEditor/PropertiesMapToSchema.js
suggestion
0.571
forceUpdate(); onPropertiesUpdated && onPropertiesUpdated(); }} fullWidth ...
I wonder if it should be below the "Choice" type as it's a bit more specific. ```suggestion <SelectOption key="property-type-animationname" value="AnimationName" ...
JavaScript
@@ -729,6 +729,11 @@ export default function EventsBasedBehaviorPropertiesEditor({ value="Boolean" label={t`Boolean (checkbox)`} /> + <SelectOption + ...
forceUpdate(); onPropertiesUpdated && onPropertiesUpdated(); }} fullWidth ...
4ian/GDevelop
newIDE/app/src/EventsBasedBehaviorEditor/EventsBasedBehaviorPropertiesEditor.js
suggestion
1
.setGroup(_('Border appearance')); objectProperties .getOrCreate('padding') .setValue((objectContent.padding || 0).toString()) .setType('number') .setLabel(_('Padding')) .setGroup(_('Border appearance')); objectProperties .getOrCreate('maxLength') ...
I think that the order is important here. I see that the text uses the order `left, center right`, so we might as well use the same here
JavaScript
@@ -200,6 +209,30 @@ module.exports = { .setLabel(_('Width')) .setGroup(_('Border appearance')); + objectProperties + .getOrCreate('padding') + .setValue((objectContent.padding || 0).toString()) + .setType('number') + .setLabel(_('Padding')) + .setGroup(_('Bor...
.setGroup(_('Border appearance')); objectProperties .getOrCreate('padding') .setValue((objectContent.padding || 0).toString()) .setType('number') .setLabel(_('Padding')) .setGroup(_('Font')); objectProperties .getOrCreate('maxLength') .setValu...
4ian/GDevelop
Extensions/TextInput/JsExtension.js
suggestion
0.571
) ) .setFunctionName('setOpacity') .setGetter('getOpacity') .setHidden(); object .addScopedCondition( 'Focused', _('Focused'), _( 'Check if the text input is focused (the cursor is in the field and player can type text in).' ), ...
```suggestion _('Input is submitted'), ``` I think it's better not mentioning any platform specific detail in the name
JavaScript
@@ -572,6 +609,22 @@ module.exports = { .getCodeExtraInformation() .setFunctionName('isFocused'); + object + .addScopedCondition( + 'IsInputSubmitted', + _('Input is Submitted (Enter pressed'),
'number', gd.ParameterOptions.makeNewOptions().setDescription( _('Opacity (0-255)') ) ) .setFunctionName('setOpacity') .setGetter('getOpacity') .setHidden(); object .addScopedCondition( 'Focused', _('Focused'), _( 'Ch...
4ian/GDevelop
Extensions/TextInput/JsExtension.js
suggestion
0.786
.setHidden(); object .addScopedCondition( 'Focused', _('Focused'), _( 'Check if the text input is focused (the cursor is in the field and player can type text in).' ), _('_PARAM0_ is focused'), '', 'res/conditions/surObjet24.png', ...
```suggestion _('_PARAM0_ value was submitted'), ```
JavaScript
@@ -572,6 +609,22 @@ module.exports = { .getCodeExtraInformation() .setFunctionName('isFocused'); + object + .addScopedCondition( + 'IsInputSubmitted', + _('Input is Submitted (Enter pressed'), + _( + 'Check if the input is submitted, which usually happens when the ...
) .setFunctionName('setOpacity') .setGetter('getOpacity') .setHidden(); object .addScopedCondition( 'Focused', _('Focused'), _( 'Check if the text input is focused (the cursor is in the field and player can type text in).' ), _('_PARAM...
4ian/GDevelop
Extensions/TextInput/JsExtension.js
suggestion
0.571
}; const formatRgbAndOpacityToCssRgba = ( rgbColor: [float, float, float], opacity: float ) => { return ( 'rgba(' + rgbColor[0] + ',' + rgbColor[1] + ',' + rgbColor[2] + ',' + opacity / 255 + ')' ); }; class TextInputRuntimeObjectPixiRend...
```suggestion private _isSubmitted: boolean; ```
TypeScript
@@ -31,6 +37,8 @@ namespace gdjs { private _input: HTMLInputElement | HTMLTextAreaElement | null = null; private _instanceContainer: gdjs.RuntimeInstanceContainer; private _runtimeGame: gdjs.RuntimeGame; + private _form: HTMLFormElement | null = null; + private _isSubmited: boolean;
return ( 'rgba(' + rgbColor[0] + ',' + rgbColor[1] + ',' + rgbColor[2] + ',' + opacity / 255 + ')' ); }; class TextInputRuntimeObjectPixiRenderer { private _object: gdjs.TextInputRuntimeObject; private _input: HTMLInputElement | HTMLTextAreaElem...
4ian/GDevelop
Extensions/TextInput/textinputruntimeobject-pixi-renderer.ts
suggestion
0.571
} getText() { return this._string; } setText(newString: string) { if (newString === this._string) return; this._string = newString; this._renderer.updateString(); } /** * Called by the renderer when the value of the input shown on the screen * was changed (b...
```suggestion onRendererFormSubmitted() { ```
TypeScript
@@ -348,6 +379,10 @@ namespace gdjs { onRendererInputValueChanged(inputValue: string) { this._string = inputValue; } + + onRendererFormSubmitted(inputValue: boolean) {
* @deprecated use `getText` instead */ getString() { return this.getText(); } /** * Replace the text inside the text input. * @deprecated use `setText` instead */ setString(text: string) { this.setText(text); } getText() { return this._string; } ...
4ian/GDevelop
Extensions/TextInput/textinputruntimeobject.ts
suggestion
0.571
this._input.style.borderColor = formatRgbAndOpacityToCssRgba( this._object._getRawBorderColor(), this._object.getBorderOpacity() ); } updateBorderWidth() { if (!this._input) return; this._input.style.borderWidth = this._object.getBorderWidth() + 'px'; } updateDi...
to avoid having the `?`, you could do this: ```js const input = this._input; if (!input) return; // From then on, you can use `input` without TS complaining ```
TypeScript
@@ -297,14 +317,36 @@ namespace gdjs { this._input.style.borderWidth = this._object.getBorderWidth() + 'px'; } updateDisabled() { - if (!this._input) return; + if (!this._form) return; - this._input.disabled = this._object.isDisabled(); + this._form.disabled = this._object.isDisab...
); } updateBorderColorAndOpacity() { if (!this._input) return; this._input.style.borderColor = formatRgbAndOpacityToCssRgba( this._object._getRawBorderColor(), this._object.getBorderOpacity() ); } updateBorderWidth() { if (!this._input) return; this...
4ian/GDevelop
Extensions/TextInput/textinputruntimeobject-pixi-renderer.ts
suggestion
0.786
: 255 ).toString() ) .setType('number') .setLabel(_('Opacity')) .setGroup(_('Border appearance')); objectProperties .getOrCreate('borderWidth') .setValue((objectContent.borderWidth || 0).toString()) .setType('number') .setLabel...
I added a comment on the PR, I think you should add in the description that this property will not be used if the input type is a number.
JavaScript
@@ -200,6 +209,30 @@ module.exports = { .setLabel(_('Width')) .setGroup(_('Border appearance')); + objectProperties + .getOrCreate('padding') + .setValue((objectContent.padding || 0).toString()) + .setType('number') + .setLabel(_('Padding')) + .setGroup(_('Fon...
: 255 ).toString() ) .setType('number') .setLabel(_('Opacity')) .setGroup(_('Border appearance')); objectProperties .getOrCreate('borderWidth') .setValue((objectContent.borderWidth || 0).toString()) .setType('number') .setLabel...
4ian/GDevelop
Extensions/TextInput/JsExtension.js
suggestion
0.571
// Display after the object is positioned. this._form.style.display = 'initial'; } updateString() { if (!this._input) return; this._input.value = this._object.getString(); } updatePlaceholder() { if (!this._input) return; this._input.placeholder = this._object.getP...
I think you could use `(this._object.getOpacity() / 255).toFixed(3)` instead. The result of the division could be `0.59200000000005`, and I'm not sure if CSS has some limitations about that.
TypeScript
@@ -246,8 +271,8 @@ namespace gdjs { } updateOpacity() { - if (!this._input) return; - this._input.style.opacity = '' + this._object.getOpacity() / 255; + if (!this._form) return; + this._form.style.opacity = '' + this._object.getOpacity() / 255;
// Display after the object is positioned. this._form.style.display = 'initial'; } updateString() { if (!this._input) return; this._input.value = this._object.getString(); } updatePlaceholder() { if (!this._input) return; this._input.placeholder = this._object.getP...
4ian/GDevelop
Extensions/TextInput/textinputruntimeobject-pixi-renderer.ts
suggestion
0.571
updateReadOnly() { if (!this._form) return; this._form.readOnly = this._object.isReadOnly(); } updateMaxLength() { const input = this._input; if (!input) return; if (this._object.getMaxLength() <= 0) { input.removeAttribute('maxLength'); return; } ...
Is the `|| 'left'` necessary? I think we can be confident that the object only stores correct values
TypeScript
@@ -297,14 +322,37 @@ namespace gdjs { this._input.style.borderWidth = this._object.getBorderWidth() + 'px'; } updateDisabled() { - if (!this._input) return; + if (!this._form) return; - this._input.disabled = this._object.isDisabled(); + this._form.disabled = this._object.isDisab...
updateReadOnly() { if (!this._form) return; this._form.readOnly = this._object.isReadOnly(); } updateMaxLength() { const input = this._input; if (!input) return; if (this._object.getMaxLength() <= 0) { input.removeAttribute('maxLength'); return; } ...
4ian/GDevelop
Extensions/TextInput/textinputruntimeobject-pixi-renderer.ts
suggestion
0.5
) .setType('number') .setLabel(_('Opacity')) .setGroup(_('Border appearance')); objectProperties .getOrCreate('borderWidth') .setValue((objectContent.borderWidth || 0).toString()) .setType('number') .setLabel(_('Width')) .setGroup(_('Border ...
```suggestion 'The maximum length of the input value (this property will be ignored if the input type is a number).' ```
JavaScript
@@ -200,6 +209,34 @@ module.exports = { .setLabel(_('Width')) .setGroup(_('Border appearance')); + objectProperties + .getOrCreate('padding') + .setValue((objectContent.padding || 0).toString()) + .setType('number') + .setLabel(_('Padding')) + .setGroup(_('Fon...
) .setType('number') .setLabel(_('Opacity')) .setGroup(_('Border appearance')); objectProperties .getOrCreate('borderWidth') .setValue((objectContent.borderWidth || 0).toString()) .setType('number') .setLabel(_('Width')) .setGroup(_('Border ...
4ian/GDevelop
Extensions/TextInput/JsExtension.js
suggestion
0.857
// Display after the object is positioned. this._form.style.display = 'initial'; } updateString() { if (!this._input) return; this._input.value = this._object.getString(); } updatePlaceholder() { if (!this._input) return; this._input.placeholder = this._object.getPl...
```suggestion (this._object.getOpacity() / 255).toFixed(3); ``` toFixed returns as string already
TypeScript
@@ -246,8 +271,9 @@ namespace gdjs { } updateOpacity() { - if (!this._input) return; - this._input.style.opacity = '' + this._object.getOpacity() / 255; + if (!this._form) return; + this._form.style.opacity = + '' + (this._object.getOpacity() / 255).toFixed(3);
// Display after the object is positioned. this._form.style.display = 'initial'; } updateString() { if (!this._input) return; this._input.value = this._object.getString(); } updatePlaceholder() { if (!this._input) return; this._input.placeholder = this._object.getPl...
4ian/GDevelop
Extensions/TextInput/textinputruntimeobject-pixi-renderer.ts
suggestion
0.714
import { LineStackLayout } from '../../UI/Layout'; import GlobalVariableIcon from '../../UI/CustomSvgIcons/GlobalVariable'; import SceneVariableIcon from '../../UI/CustomSvgIcons/SceneVariable'; import ObjectVariableIcon from '../../UI/CustomSvgIcons/ObjectVariable'; import LocalVariableIcon from '../../UI/CustomSvgIco...
Let's call this: ```suggestion getVariableSourceFromIdentifierName: ( identifierName: string, projectScopedContainers: gdProjectScopedContainers ) => VariablesContainer_SourceType, ``` to emphasis that we don't know if it's a variable name, a property name or a parameter name, and it could be a m...
JavaScript
@@ -55,6 +54,10 @@ type Props = { ...ParameterFieldProps, isObjectVariable: boolean, variablesContainers: Array<gdVariablesContainer>, + getVariableSourceFromVariableName: ( + variableRootName: string, + projectScopedContainers: gdProjectScopedContainers + ) => VariablesContainer_SourceType,
import { LineStackLayout } from '../../UI/Layout'; import GlobalVariableIcon from '../../UI/CustomSvgIcons/GlobalVariable'; import SceneVariableIcon from '../../UI/CustomSvgIcons/SceneVariable'; import ObjectVariableIcon from '../../UI/CustomSvgIcons/ObjectVariable'; import LocalVariableIcon from '../../UI/CustomSvgIco...
4ian/GDevelop
newIDE/app/src/EventsSheet/ParameterFields/VariableField.js
suggestion
1
otherProjectFile.fileMetadata.fileIdentifier ); }); } return false; }; const getDashboardItemsToDisplay = ({ project, currentFileMetadata, allDashboardItems, searchText, searchClient, currentPage, orderBy, }: {| project: ?gdProject, currentFileMetadata: ?FileMetadata, allDas...
I don't know if this array should be copied with a destructuring operation because it can be sorted below, affecting both `itemsToDisplay` and `allDashboardItems` I think
JavaScript
@@ -146,13 +146,7 @@ const getDashboardItemsToDisplay = ({ orderBy: GamesDashboardOrderBy, |}): ?Array<DashboardItem> => { if (!allDashboardItems) return null; - let itemsToDisplay: DashboardItem[] = allDashboardItems.filter( - item => - // First, filter out unsaved games, unless they are the opened pro...
otherProjectFile.fileMetadata.fileIdentifier ); }); } return false; }; const getDashboardItemsToDisplay = ({ project, currentFileMetadata, allDashboardItems, searchText, searchClient, currentPage, orderBy, }: {| project: ?gdProject, currentFileMetadata: ?FileMetadata, allDas...
4ian/GDevelop
newIDE/app/src/GameDashboard/GamesList.js
suggestion
0.571
/** Base parameters for {@link gdjs.Cube3DRuntimeObject} */ export interface Cube3DObjectData extends Object3DData { /** The base parameters of the Cube3D object */ content: Object3DDataContent & { enableTextureTransparency: boolean; facesOrientation: 'Y' | 'Z'; frontFaceResourceName: stri...
You should be able to go back to where content comes from. Long story short, it comes from the project serialized in JSON, meaning that the possible types of this object can only be `null`, `string` or `number`, or an array of those, or a child JSON. So it cannot be a `THREE.Color`. You can find examples in the textIn...
TypeScript
@@ -24,10 +24,10 @@ namespace gdjs { rightFaceVisible: boolean; topFaceVisible: boolean; bottomFaceVisible: boolean; + color: THREE.Color;
/** Base parameters for {@link gdjs.Cube3DRuntimeObject} */ export interface Cube3DObjectData extends Object3DData { /** The base parameters of the Cube3D object */ content: Object3DDataContent & { enableTextureTransparency: boolean; facesOrientation: 'Y' | 'Z'; frontFaceResourceName: stri...
4ian/GDevelop
Extensions/3D/Cube3DRuntimeObject.ts
suggestion
0.786
return this.isFaceAtIndexVisible(faceIndex); } /** @internal */ isFaceAtIndexVisible(faceIndex): boolean { return (this._visibleFacesBitmask & (1 << faceIndex)) !== 0; } /** @internal */ shouldRepeatTextureOnFaceAtIndex(faceIndex): boolean { return (this._textureRepeatFacesB...
This method is part of a public interface. We don't want to rely THREE objects for inputs. You can check `setFillColor` int he codebase to see how it's done in other objects.
TypeScript
@@ -203,10 +206,13 @@ namespace gdjs { if (this._faceResourceNames[faceIndex] === resourceName) { return; } - this._faceResourceNames[faceIndex] = resourceName; this._renderer.updateFace(faceIndex); } + setCubeColor(color: THREE.Color): void {
if (faceIndex === undefined) { return false; } return this.isFaceAtIndexVisible(faceIndex); } /** @internal */ isFaceAtIndexVisible(faceIndex): boolean { return (this._visibleFacesBitmask & (1 << faceIndex)) !== 0; } /** @internal */ shouldRepeatTextureOnFaceAt...
4ian/GDevelop
Extensions/3D/Cube3DRuntimeObject.ts
suggestion
0.5
} return runtimeObject .getInstanceContainer() .getGame() .getImageManager() .getThreeMaterial(runtimeObject.getFaceAtIndexResourceName(faceIndex), { useTransparentTexture: runtimeObject.shouldUseTransparentTexture(), forceBasicMaterial: runtimeObject._materialT...
Good idea to use a loop! In JS, there's a more elegant way to do this, with a `map`. So you could write: ```js const materials = new Array(6).fill(0).map((_, index) => { return material; }) ```
TypeScript
@@ -75,14 +80,37 @@ namespace gdjs { ) { const geometry = new THREE.BoxGeometry(1, 1, 1); // TODO (3D) - feature: support color instead of texture? - const materials = [ - getFaceMaterial(runtimeObject, materialIndexToFaceIndex[0]), - getFaceMaterial(runtimeObject, materialIndexToF...
.getThreeMaterial(runtimeObject.getFaceAtIndexResourceName(faceIndex), { useTransparentTexture: runtimeObject.shouldUseTransparentTexture(), forceBasicMaterial: runtimeObject._materialType === gdjs.Cube3DRuntimeObject.MaterialType.Basic, }); }; class Cube3DRuntimeObj...
4ian/GDevelop
Extensions/3D/Cube3DRuntimeObjectPixiRenderer.ts
suggestion
0.857
}; class Cube3DRuntimeObjectPixiRenderer extends gdjs.RuntimeObject3DRenderer { private _cube3DRuntimeObject: gdjs.Cube3DRuntimeObject; private _boxMesh: THREE.Mesh; constructor( runtimeObject: gdjs.Cube3DRuntimeObject, instanceContainer: gdjs.RuntimeInstanceContainer ) { const g...
This seems unnecessary to me. I feel like you could just do: ```js const material = ... materials.push(material) ``` since `getFaceMaterial` already returns a `MeshBasicMaterial` if no resource
TypeScript
@@ -75,14 +80,36 @@ namespace gdjs { ) { const geometry = new THREE.BoxGeometry(1, 1, 1); // TODO (3D) - feature: support color instead of texture? - const materials = [ - getFaceMaterial(runtimeObject, materialIndexToFaceIndex[0]), - getFaceMaterial(runtimeObject, materialIndexToF...
constructor( runtimeObject: gdjs.Cube3DRuntimeObject, instanceContainer: gdjs.RuntimeInstanceContainer ) { const geometry = new THREE.BoxGeometry(1, 1, 1); const materials: THREE.Material[] = new Array(6) .fill(0) .map((_, index) => getFaceMaterial(runtimeObje...
4ian/GDevelop
Extensions/3D/Cube3DRuntimeObjectPixiRenderer.ts
suggestion
0.857
// Delete actions. // Don't allow removing project if opened, as it would not result in any change in the list. // (because an opened project is always displayed) if (isCurrentProjectOpened || projectsList.length > 1) { // No delete action possible. } else {...
I would change the text because here you can have a case: `You're deleting a game that has: ... - is published` I would suggest: `You're deleting a game which: - has x views... - is published...`
JavaScript
@@ -513,9 +518,34 @@ const GameDashboardCard = ({ // Extract word translation to ensure it is not wrongly translated in the sentence. const translatedConfirmText = i18n._(t`delete`); + const hasPlayerMessage = countOfSessionsLastWeek + ? t`${countOfSes...
// (because an opened project is always displayed) if (isCurrentProjectOpened || projectsList.length > 1) { // No delete action possible. } else { if (actions.length > 0) { actions.push({ type: 'separator', }); ...
4ian/GDevelop
newIDE/app/src/GameDashboard/GameDashboardCard.js
suggestion
0.643
.setFunctionName('isAnimationPaused'); // Deprecated object .addCondition( 'HasAnimationEnded', _('Animation finished'), _( 'Check if the animation being played by the Sprite object is finished.' ), _('The animation of _PARAM0_ i...
I think in english it's a single word usually: ```suggestion _('Set crossfade duration'), _('Set the crossfade duration when switching to a new animation.'), 'Set crossfade duration of _PARAM0_ to _PARAM1_', ```
JavaScript
@@ -800,6 +800,20 @@ module.exports = { .markAsSimple() .setHidden() .setFunctionName('hasAnimationEnded'); + + object + .addScopedAction( + 'SetCrossfadeDuration', + _('Set cross fade duration'), + _('Set the duration of the cross fading between two ani...
.setFunctionName('isAnimationPaused'); // Deprecated object .addCondition( 'HasAnimationEnded', _('Animation finished'), _( 'Check if the animation being played by the Sprite object is finished.' ), _('The animation of _PARAM0_ i...
4ian/GDevelop
Extensions/3D/JsExtension.js
suggestion
0.786
_('Animation finished'), _( 'Check if the animation being played by the Sprite object is finished.' ), _('The animation of _PARAM0_ is finished'), _('Animations and images'), 'res/conditions/animation24.png', 'res/conditions/animation.png...
```suggestion .addParameter('number', _('Crossfade duration'), '', false) ```
JavaScript
@@ -800,6 +800,20 @@ module.exports = { .markAsSimple() .setHidden() .setFunctionName('hasAnimationEnded'); + + object + .addScopedAction( + 'SetCrossfadeDuration', + _('Set cross fade duration'), + _('Set the duration of the cross fading between two ani...
_('Animation finished'), _( 'Check if the animation being played by the Sprite object is finished.' ), _('The animation of _PARAM0_ is finished'), _('Animations and images'), 'res/conditions/animation24.png', 'res/conditions/animation.png...
4ian/GDevelop
Extensions/3D/JsExtension.js
suggestion
0.571
/** GDevelop - Particle System Extension Copyright (c) 2010-2016 Florian Rival (Florian.Rival@gmail.com) This project is released under the MIT License. */ #include "Model3DObjectConfiguration.h" #include "GDCore/CommonTools.h" #include "GDCore/IDE/Project/ArbitraryResourceWorker.h" #include "GDCore/Project/InitialI...
Nitpicking, here and everywhere: `crossfadeDuration` (your PR contains a mix of crossFade and crossfade). Let's use crossfade everywhere it's possible.
C++
@@ -23,7 +23,7 @@ Model3DObjectConfiguration::Model3DObjectConfiguration() : width(100), height(100), depth(100), rotationX(0), rotationY(0), rotationZ(0), modelResourceName(""), materialType("StandardWithoutMetalness"), originLocation("ModelOrigin"), centerLocation("ModelOrigin"), - keepAspectR...
/** GDevelop - Particle System Extension Copyright (c) 2010-2016 Florian Rival (Florian.Rival@gmail.com) This project is released under the MIT License. */ #include "Model3DObjectConfiguration.h" #include "GDCore/CommonTools.h" #include "GDCore/IDE/Project/ArbitraryResourceWorker.h" #include "GDCore/Project/InitialI...
4ian/GDevelop
Extensions/3D/Model3DObjectConfiguration.cpp
suggestion
0.571
let rewardedVideoLoading = false; // Becomes true when the video is loading. let rewardedVideoReady = false; // Becomes true when the video is loaded and ready to be shown. let rewardedVideoShowing = false; // Becomes true when the video is showing. let rewardedVideoRewardReceived = false; // Becomes tr...
I wonder if it's a good idea to delay this by 2 seconds, and offer: - an action to cancel automatic consent dialog/tracking authorization display. - an action to do it manually. So that if I want to postpone this (because it's better if my player plays a bit or click a button in the menu, so I have the opportunity...
TypeScript
@@ -108,22 +109,53 @@ namespace gdjs { let rewardedVideoRewardReceived = false; // Becomes true when the video is closed and the reward is received. let rewardedVideoErrored = false; // Becomes true when the video fails to load. - let npaValue = '0'; // TODO: expose an API to change this and also an auto...
let rewardedVideoLoading = false; // Becomes true when the video is loading. let rewardedVideoReady = false; // Becomes true when the video is loaded and ready to be shown. let rewardedVideoShowing = false; // Becomes true when the video is showing. let rewardedVideoRewardReceived = false; // Becomes tr...
4ian/GDevelop
Extensions/AdMob/admobtools.ts
security
0.5
'SetTestMode', _('Enable test mode'), _( 'Activate or deactivate the test mode ("development" mode).\n' + 'When activated, tests ads will be served instead of real ones.\n' + '\n' + 'It is important to enable test ads during development so that you c...
```suggestion 'Prevent AdMob from initializing automatically. You will need to call the "Initialize AdMob" action instead.\n' + ```
JavaScript
@@ -93,6 +93,41 @@ module.exports = { .setIncludeFile('Extensions/AdMob/admobtools.js') .setFunctionName('gdjs.adMob.setTestMode'); + extension + .addAction( + 'PreventAdmobAutoInitialization', + _('Prevent Admob auto initialization'), + _( + 'Prevent Admob from ini...
'SetTestMode', _('Enable test mode'), _( 'Activate or deactivate the test mode ("development" mode).\n' + 'When activated, tests ads will be served instead of real ones.\n' + '\n' + 'It is important to enable test ads during development so that you c...
4ian/GDevelop
Extensions/AdMob/JsExtension.js
suggestion
0.786
return sound; } /** * Creates a new gdjs.HowlerSound using preloaded/cached Howl instances. * @param soundName The name of the file or resource to play. * @param isMusic True if a music, false if a sound. * @param volume Between 0 and 1. * @param loop True if it should be played ...
here it seems the logic has changed, it's using resource (so `resource.file`) where it used to be that or `soundName` if not defined. The resource is created from the soundName, I'm actually unsure if this case can happen or not
TypeScript
@@ -539,11 +586,12 @@ namespace gdjs { howl = new Howl( Object.assign( { - src: [this._resourceLoader.getFullUrl(fileName)], + src: this._getSoundUrlsFromResource(resource),
} /** * Creates a new gdjs.HowlerSound using preloaded/cached Howl instances. * @param soundName The name of the file or resource to play. * @param isMusic True if a music, false if a sound. * @param volume Between 0 and 1. * @param loop True if it should be played looping. * @par...
4ian/GDevelop
GDJS/Runtime/howler-sound-manager/howler-sound-manager.ts
suggestion
0.643
value="Boolean" label={t`Boolean (checkbox)`} /> <SelectOption key="property-type-choice" ...
I wonder if we should call this MultilineString, because: - "Text Area" is a UI result - Whereas "MultilineString" is more a data type.
JavaScript
@@ -754,6 +754,11 @@ export default function EventsBasedBehaviorPropertiesEditor({ value="KeyboardKey" label={t`Keyboard key (text)`} /> + <SelectOption +...
value="Boolean" label={t`Boolean (checkbox)`} /> <SelectOption key="property-type-choice" ...
4ian/GDevelop
newIDE/app/src/EventsBasedBehaviorEditor/EventsBasedBehaviorPropertiesEditor.js
suggestion
0.571
const showProjectNeedToBeSaved = useProjectNeedToBeSavedAlertDialog( resourceManagementProps.canInstallPrivateAsset ); return async ( assetShortHeader: AssetShortHeader ): Promise<InstallAssetOutput | null> => { try { if (await showProjectNeedToBeSaved(assetShortHeader)) { return null...
```suggestion message: t`Please upgrade the editor to the latest version.`, ```
JavaScript
@@ -161,6 +161,16 @@ export const useInstallAsset = ({ project, } ); + if ( + requiredExtensionInstallation.incompatibleWithIdeExtensionShortHeaders + .length > 0 + ) { + showAlert({ + title: t`Could not install the asset`, + message: t`Pleas...
const showProjectNeedToBeSaved = useProjectNeedToBeSavedAlertDialog( resourceManagementProps.canInstallPrivateAsset ); return async ( assetShortHeader: AssetShortHeader ): Promise<InstallAssetOutput | null> => { try { if (await showProjectNeedToBeSaved(assetShortHeader)) { return null...
4ian/GDevelop
newIDE/app/src/AssetStore/NewObjectDialog.js
suggestion
0.571
if (installAssetOutput) onObjectsAddedFromAssets(installAssetOutput.createdObjects); return !!installAssetOutput; }, [installAsset, onObjectsAddedFromAssets] ); const onInstallEmptyCustomObject = React.useCallback( async (enumeratedObjectMetadata: EnumeratedObjectMetadata) => { ...
```suggestion message: t`Please upgrade the editor to the latest version.`, ```
JavaScript
@@ -331,6 +341,16 @@ function NewObjectDialog({ project, } ); + if ( + requiredExtensionInstallation.incompatibleWithIdeExtensionShortHeaders + .length > 0 + ) { + showAlert({ + title: t`Could not install the asset`, + mes...
if (installAssetOutput) onObjectsAddedFromAssets(installAssetOutput.createdObjects); return !!installAssetOutput; }, [installAsset, onObjectsAddedFromAssets] ); const onInstallEmptyCustomObject = React.useCallback( async (enumeratedObjectMetadata: EnumeratedObjectMetadata) => { ...
4ian/GDevelop
newIDE/app/src/AssetStore/NewObjectDialog.js
suggestion
0.571
|}; export type UserCourseProgress = {| userId: string, courseId: string, progress: {| chapterId: string, completedTasks: number[] |}[], |}; export type Environment = 'staging' | 'live'; export const client = axios.create({ baseURL: GDevelopAssetApi.baseUrl, }); export const isAssetPackAudioOnly = (assetPac...
```suggestion export const isCompatibleWithGDevelopVersion = ( ```
JavaScript
@@ -243,10 +243,10 @@ export const doesAssetPackContainAudio = ( */ export const isCompatibleWithAsset = (
|}; export type UserCourseProgress = {| userId: string, courseId: string, progress: {| chapterId: string, completedTasks: number[] |}[], |}; export type Environment = 'staging' | 'live'; export const client = axios.create({ baseURL: GDevelopAssetApi.baseUrl, }); export const isAssetPackAudioOnly = (assetPac...
4ian/GDevelop
newIDE/app/src/Utils/GDevelopServices/Asset.js
suggestion
0.571
gameId.current ? `/app-embedded/${gamesPlatformEmbeddedVersion}/games/${gameId.current}` : isMobile ? // On mobile, go directly to a random game if none is specified. `/app-embedded/${gamesPlatformEmbeddedVersion}/games/random` : // On desktop, access the homepage. `/app-embe...
I would probably add a check on `!loaded` too. The iframe may be here without gd.games being loaded yet, or not loaded at all . This component and the iframe is always in the DOM, but the `src` changes when a user arrives on the Play section, and the `loaded` becomes true when gd.games tells the editor it's ready.
JavaScript
@@ -68,6 +71,20 @@ const GamesPlatformFrame = ({ initialGameId, loaded, visible }: Props) => { [loaded, initialGameId] ); + React.useEffect( + () => { + if (!iframeRef.current) return;
? // On mobile, go directly to a random game if none is specified. `/app-embedded/${gamesPlatformEmbeddedVersion}/games/random` : // On desktop, access the homepage. `/app-embedded/${gamesPlatformEmbeddedVersion}/${paletteType}`, gdGamesHost ); if (gameId.current || isMobile) url.sea...
4ian/GDevelop
newIDE/app/src/MainFrame/EditorContainers/HomePage/PlaySection/GamesPlatformFrame.js
suggestion
0.643
? // On mobile, go directly to a random game if none is specified. `/app-embedded/${gamesPlatformEmbeddedVersion}/games/random` : // On desktop, access the homepage. `/app-embedded/${gamesPlatformEmbeddedVersion}/${paletteType}`, gdGamesHost ); if (gameId.current || isMobile) url.sea...
```suggestion type: 'setKeyboardOffset', ``` ? I think we prefer verbs like a function would be called
JavaScript
@@ -68,6 +71,20 @@ const GamesPlatformFrame = ({ initialGameId, loaded, visible }: Props) => { [loaded, initialGameId] ); + React.useEffect( + () => { + if (!iframeRef.current) return; + iframeRef.current.contentWindow.postMessage( + { + type: 'keyboardOffset',
`/app-embedded/${gamesPlatformEmbeddedVersion}/${paletteType}`, gdGamesHost ); if (gameId.current || isMobile) url.searchParams.set('theme', paletteType); const src = loaded ? url.toString() : ''; React.useEffect( () => { if (!loaded && initialGameId) { // Every time the frame is...
4ian/GDevelop
newIDE/app/src/MainFrame/EditorContainers/HomePage/PlaySection/GamesPlatformFrame.js
suggestion
0.929
const url = new URL( gameId.current ? `/app-embedded/${gamesPlatformEmbeddedVersion}/games/${gameId.current}` : isMobile ? // On mobile, go directly to a random game if none is specified. `/app-embedded/${gamesPlatformEmbeddedVersion}/games/random` : // On desktop, access the home...
as discussed, this should probably be moved to the top component `GamesPlatformFrameContext` to do a logic similar to `sendUserCustomTokenToFrame()`
JavaScript
@@ -68,6 +71,24 @@ const GamesPlatformFrame = ({ initialGameId, loaded, visible }: Props) => { [loaded, initialGameId] ); + React.useEffect(
? `/app-embedded/${gamesPlatformEmbeddedVersion}/games/${gameId.current}` : isMobile ? // On mobile, go directly to a random game if none is specified. `/app-embedded/${gamesPlatformEmbeddedVersion}/games/random` : // On desktop, access the homepage. `/app-embedded/${gamesPlatfor...
4ian/GDevelop
newIDE/app/src/MainFrame/EditorContainers/HomePage/PlaySection/GamesPlatformFrame.js
suggestion
0.571
...state, currentFileMetadata: fileMetadata, })); }, ensureResourcesAreMoved, onGameRegistered: gamesList.fetchGames, }); const { onSelectExampleShortHeader, onSelectPrivateGameTemplateListingData, renderNewProjectDialog, fetchAndOpenNewProjectSetupDialogForExample...
```suggestion const gamesPlatformFrameTools = useGamesPlatformFrame({ ```
JavaScript
@@ -1235,6 +1233,11 @@ const MainFrame = (props: Props) => { storageProviders: props.storageProviders, }); + const gamesPlatformFrameTools = UseGamesPlatformFrame({
...state, currentFileMetadata: fileMetadata, })); }, ensureResourcesAreMoved, onGameRegistered: gamesList.fetchGames, }); const { onSelectExampleShortHeader, onSelectPrivateGameTemplateListingData, renderNewProjectDialog, fetchAndOpenNewProjectSetupDialogForExample...
4ian/GDevelop
newIDE/app/src/MainFrame/index.js
suggestion
0.643
import CustomDragLayer from '../UI/DragAndDrop/CustomDragLayer'; import CloudProjectRecoveryDialog from '../ProjectsStorage/CloudStorageProvider/CloudProjectRecoveryDialog'; import CloudProjectSaveChoiceDialog from '../ProjectsStorage/CloudStorageProvider/CloudProjectSaveChoiceDialog'; import CloudStorageProvider from ...
Avoid this error by preferring named exports: ```suggestion import { useGamesPlatformFrame } from './EditorContainers/HomePage/PlaySection/UseGamesPlatformFrame'; ```
JavaScript
@@ -197,8 +198,8 @@ import { type ObjectWithContext } from '../ObjectsList/EnumerateObjects'; import useGamesList from '../GameDashboard/UseGamesList'; import useCapturesManager from './UseCapturesManager'; import useHomepageWitchForRouting from './UseHomepageWitchForRouting'; -import { GamesPlatformFrameContext } f...
import CustomDragLayer from '../UI/DragAndDrop/CustomDragLayer'; import CloudProjectRecoveryDialog from '../ProjectsStorage/CloudStorageProvider/CloudProjectRecoveryDialog'; import CloudProjectSaveChoiceDialog from '../ProjectsStorage/CloudStorageProvider/CloudProjectSaveChoiceDialog'; import CloudStorageProvider from ...
4ian/GDevelop
newIDE/app/src/MainFrame/index.js
suggestion
0.929
})); }, ensureResourcesAreMoved, onGameRegistered: gamesList.fetchGames, }); const { onSelectExampleShortHeader, onSelectPrivateGameTemplateListingData, renderNewProjectDialog, fetchAndOpenNewProjectSetupDialogForExample, openNewProjectDialog, } = useNewProjectDialog({ i...
useCallback the onOpenProfileDialog, otherwise this means that `handleIframeMessage` is unstable and will be disconnected/reconnected at every single render 😱 This would probably be worth a log in the code doing the `addEventListener` so we can see the console filling with logs if we break the stability in the futu...
JavaScript
@@ -1235,6 +1233,11 @@ const MainFrame = (props: Props) => { storageProviders: props.storageProviders, }); + const gamesPlatformFrameTools = UseGamesPlatformFrame({ + fetchAndOpenNewProjectSetupDialogForExample, + onOpenProfileDialog: () => openProfileDialog(true),
})); }, ensureResourcesAreMoved, onGameRegistered: gamesList.fetchGames, }); const { onSelectExampleShortHeader, onSelectPrivateGameTemplateListingData, renderNewProjectDialog, fetchAndOpenNewProjectSetupDialogForExample, openNewProjectDialog, } = useNewProjectDialog({ i...
4ian/GDevelop
newIDE/app/src/MainFrame/index.js
suggestion
0.786
currentProject ); }} onExtensionInstalled={onExtensionInstalled} onShareProject={() => openShareDialog()} isOpen={projectManagerOpen} hotReloadPreviewButtonProps={hotReloadPreviewButtonProps} resourceManagementProps={resourceManagemen...
Let's name this: ```suggestion onEditorTabClosing(); ``` to show it's being done (while traditionnally, something that is "ed" is when the thing is finished and it's the very last thing you call)
JavaScript
@@ -3728,21 +3728,31 @@ const MainFrame = (props: Props) => { <TabsTitlebar hidden={tabsTitleBarAndEditorToolbarHidden} toggleProjectManager={toggleProjectManager} - renderTabs={onHoverEditorTab => ( + renderTabs={(onEditorTabHovered, onEditorTabClosed) => ( <DraggableE...
currentProject ); }} onExtensionInstalled={onExtensionInstalled} onShareProject={() => openShareDialog()} isOpen={projectManagerOpen} hotReloadPreviewButtonProps={hotReloadPreviewButtonProps} resourceManagementProps={resourceManagemen...
4ian/GDevelop
newIDE/app/src/MainFrame/index.js
suggestion
0.786
onChange={(e, i, period: string) => { setDataPeriod(period); }} disableUnderline > <SelectOption key="month" value="month" label={t`Month`} /> <SelectOption key="year" value="year" label={t`Year`} /> ...
```suggestion Visitors are considered players when they stayed at least 60 seconds including loading screens. ```
JavaScript
@@ -142,6 +144,19 @@ export const GameAnalyticsPanel = ({ <Column noMargin alignItems="center" expand> <Text size="block-title" align="center"> <Trans>{chartData.overview.playersCount} sessions</Trans> + <Tooltip + title={ ...
onChange={(e, i, period: string) => { setDataPeriod(period); }} disableUnderline > <SelectOption key="month" value="month" label={t`Month`} /> <SelectOption key="year" value="year" label={t`Year`} /> ...
4ian/GDevelop
newIDE/app/src/GameDashboard/GameAnalyticsPanel.js
suggestion
0.786
{recommendedMarketingPlan && gameFeaturings && fetchGameFeaturings && ( <Grid item xs={12} sm={5} md={4}> <MarketingPlanSingleDisplay fetchGameFeaturings={fetchGameFeaturings} gameFeaturings={...
```suggestion Percentage of people who leave before 60 seconds including loading screens. ```
JavaScript
@@ -169,6 +184,19 @@ export const GameAnalyticsPanel = ({ {Math.round(chartData.overview.bounceRatePercent)}% bounce rate </Trans> + <Tooltip + title={ + <Text> + <T...
</Grid> {recommendedMarketingPlan && gameFeaturings && fetchGameFeaturings && ( <Grid item xs={12} sm={5} md={4}> <MarketingPlanSingleDisplay fetchGameFeaturings={fetchGameFeaturings} ...
4ian/GDevelop
newIDE/app/src/GameDashboard/GameAnalyticsPanel.js
suggestion
0.714
</Text> <BounceRateChart chartData={chartData} height={chartHeight} i18n={i18n} /> </Column> </Grid> <Grid item xs={12} sm={6}> <Column expand noM...
I think it's obvious when reading the title and the hover tooltip: ![image](https://github.com/user-attachments/assets/698e4da6-69e4-4afb-8918-03980eb5db07) ```suggestion ```
JavaScript
@@ -186,6 +214,17 @@ export const GameAnalyticsPanel = ({ )}{' '} minutes per player </Trans> + <Tooltip + title={ + <Text> + <Trans> + Is...
</Tooltip> </Text> <BounceRateChart chartData={chartData} height={chartHeight} i18n={i18n} /> </Column> </Grid> <Grid item xs={12} sm={6}> ...
4ian/GDevelop
newIDE/app/src/GameDashboard/GameAnalyticsPanel.js
suggestion
0.786
<Trans> { chartData.overview.greaterDurationPlayerSurface .playersCount }{' '} players with more than{' '} { chartData.overview.greaterDur...
I think this graph is obvious. If people don't know how to read axes, I doubt an explanation will help them. ```suggestion ```
JavaScript
@@ -209,6 +248,20 @@ export const GameAnalyticsPanel = ({ }{' '} minutes </Trans> + <Tooltip + title={ + <Text> + <Trans> + Average of pla...
<Column expand noMargin alignItems="center"> <Text size="block-title" align="center"> <Trans> { chartData.overview.greaterDurationPlayerSurface .playersCount }{' '} ...
4ian/GDevelop
newIDE/app/src/GameDashboard/GameAnalyticsPanel.js
suggestion
0.714
chartData.overview.nearestToMedianDuration .playersPercent )} % of players with more than{' '} { chartData.overview.nearestToMedianDuration .durationInMin...
This graph is obvious too. The curves have already titles when you hover. ![image](https://github.com/user-attachments/assets/7ae84eab-c7e3-41f5-9707-87abd7ddd9ed) ```suggestion ```
JavaScript
@@ -232,6 +285,22 @@ export const GameAnalyticsPanel = ({ }{' '} minutes </Trans> + <Tooltip + title={ + <Text> + <Trans> + Shows how long...
<Text size="block-title" align="center"> <Trans> {Math.round( chartData.overview.nearestToMedianDuration .playersPercent )} % of players with more than{' '} ...
4ian/GDevelop
newIDE/app/src/GameDashboard/GameAnalyticsPanel.js
suggestion
0.786
}} disableUnderline > <SelectOption key="month" value="month" label={t`Month`} /> <SelectOption key="year" value="year" label={t`Year`} /> </SelectField> </Line> <Grid container spacing={2}> ...
Tooltips must as short as possible. ```suggestion <Trans> Viewers are considered players when they stayed at least 60 seconds including loading screens. </Trans> ```
JavaScript
@@ -142,6 +144,19 @@ export const GameAnalyticsPanel = ({ <Column noMargin alignItems="center" expand> <Text size="block-title" align="center"> <Trans>{chartData.overview.playersCount} sessions</Trans> + <Tooltip + title={ ...
}} disableUnderline > <SelectOption key="month" value="month" label={t`Month`} /> <SelectOption key="year" value="year" label={t`Year`} /> </SelectField> </Line> <Grid container spacing={2}> ...
4ian/GDevelop
newIDE/app/src/GameDashboard/GameAnalyticsPanel.js
suggestion
0.857
fetchGameFeaturings && ( <Grid item xs={12} sm={5} md={4}> <MarketingPlanSingleDisplay fetchGameFeaturings={fetchGameFeaturings} gameFeaturings={gameFeaturings} marketingPlan={recommendedMarketingPlan...
Stating the obvious only adds noise. People won't read it if it's 2 long sentences. ```suggestion <Trans> Percentage of people who leave before 60 seconds including loading screens. </Trans> ```
JavaScript
@@ -169,6 +184,20 @@ export const GameAnalyticsPanel = ({ {Math.round(chartData.overview.bounceRatePercent)}% bounce rate </Trans> + <Tooltip + title={ + <Text> + <T...
gameFeaturings && fetchGameFeaturings && ( <Grid item xs={12} sm={5} md={4}> <MarketingPlanSingleDisplay fetchGameFeaturings={fetchGameFeaturings} gameFeaturings={gameFeaturings} marke...
4ian/GDevelop
newIDE/app/src/GameDashboard/GameAnalyticsPanel.js
suggestion
0.786
runtimeScene.renderAndStep(1000 / 60); expect(object.getY()).to.be.within( -229.5833333333333 - epsilon, -229.5833333333333 + epsilon ); for (let i = 0; i < 4; ++i) { // Verify that pressing the jump key does not change anything object.getBehavior('auto1').simulat...
```suggestion it('can only jump once while the jump key is held', function () { ```
JavaScript
@@ -644,6 +653,48 @@ describe('gdjs.PlatformerObjectRuntimeBehavior', function () { expect(object.getY()).to.be(-30); }); + it('can jump only jump once while the jump key is held', function () {
runtimeScene.renderAndStep(1000 / 60); expect(object.getY()).to.be.within( -229.5833333333333 - epsilon, -229.5833333333333 + epsilon ); for (let i = 0; i < 4; ++i) { // Verify that pressing the jump key does not change anything object.getBehavior('auto1').simulat...
4ian/GDevelop
Extensions/PlatformBehavior/tests/JumpAndFallingPlatformer.spec.js
suggestion
0.571
.SetQuickCustomizationVisibility(gd::QuickCustomization::Hidden) .SetGroup(_("Ledge")) .SetType("Number") .SetMeasurementUnit(gd::MeasurementUnit::GetPixel()) .SetValue( gd::String::From(behaviorContent.GetDoubleAttribute("yGrabOffset"))); properties["XGrabTolerance"] .Se...
```suggestion .SetLabel(_("Allows repeated jumps while holding the jump key (deprecated — best left unchecked)")) ```
C++
@@ -164,6 +165,15 @@ PlatformerObjectBehavior::GetProperties( ? "true" : "false") .SetType("Boolean"); + properties["UseRepeatedJump"] + .SetLabel(_("Allow the character to jump again when the key is held (deprecated, it's " + "recommended to leave...
.SetQuickCustomizationVisibility(gd::QuickCustomization::Hidden) .SetGroup(_("Ledge")) .SetType("Number") .SetMeasurementUnit(gd::MeasurementUnit::GetPixel()) .SetValue( gd::String::From(behaviorContent.GetDoubleAttribute("yGrabOffset"))); properties["XGrabTolerance"] .Se...
4ian/GDevelop
Extensions/PlatformBehavior/PlatformerObjectBehavior.cpp
suggestion
0.714
this._innerArea = { min: [0, 0, 0], max: [0, 0, 0], }; } this._innerArea.min[0] = usedVariantData.areaMinX; this._innerArea.min[1] = usedVariantData.areaMinY; this._innerArea.min[2] = usedVariantData.areaMinZ; this._innerArea.max[0] = u...
`_reinitializeRenderer` clear the layer rendered objects `_initializeFromObjectData` add the new ones
TypeScript
@@ -154,8 +154,8 @@ namespace gdjs { override reinitialize(objectData: ObjectData & CustomObjectConfiguration) { super.reinitialize(objectData); - this._initializeFromObjectData(objectData); this._reinitializeRenderer(); + this._initializeFromObjectData(objectData);
if (!this._innerArea) { this._innerArea = { min: [0, 0, 0], max: [0, 0, 0], }; } this._innerArea.min[0] = usedVariantData.areaMinX; this._innerArea.min[1] = usedVariantData.areaMinY; this._innerArea.min[2] = usedVariantData.areaMinZ; ...
4ian/GDevelop
GDJS/Runtime/CustomRuntimeObject.ts
suggestion
0.5
onLobbyQuickJoinFinished(runtimeScene); if (openLobbiesPageIfFailure) { openLobbiesWindow(runtimeScene); } } }; export const getLobbyID = (): string => { return _lobbyId || ""; }; export const authenticateAndQuickJoinWithLobbyID = async( runtimeSce...
This looks fine, just one thing, the current quickJoin action differentiates between 'JOIN_GAME' and 'START_GAME'. I think that if the LobbyId corresponds to a lobby that hasn't started, then the action will fail (nothing will happen). Do you want to handle that case?
TypeScript
@@ -1696,7 +1696,35 @@ namespace gdjs { } } }; + + export const getLobbyID = (): string => { + return _lobbyId || ""; + }; + + export const authenticateAndQuickJoinWithLobbyID = async( + runtimeScene: gdjs.RuntimeScene, + lobbyID: string + ) => { + const playerId =...
_actionAfterJoiningLobby = 'JOIN_GAME'; } else { throw new Error( `Lobby in wrong status: ${quickJoinLobbyResponse.status}` ); } } else { if (_connectionId) { // Already connected to a lobby. onLobbyQuickJoin...
4ian/GDevelop
Extensions/Multiplayer/multiplayertools.ts
bug
0.571
</AlertMessage> ))} </ColumnStackLayout> </Line> ) : null} <PropertiesEditor unsavedChanges={unsavedChanges} schema={propertiesSchema} ...
```suggestion // Avoid to lose user changes by forcing them ```
JavaScript
@@ -342,12 +360,22 @@ const CustomObjectPropertiesEditor = (props: Props) => { label={<Trans>Edit</Trans>} leftIcon={<Edit />} onClick={editVariant} + // Avoid to loss user changes by forcing them
</AlertMessage> ))} </ColumnStackLayout> </Line> ) : null} <PropertiesEditor unsavedChanges={unsavedChanges} schema={propertiesSchema} ...
4ian/GDevelop
newIDE/app/src/ObjectEditor/Editors/CustomObjectPropertiesEditor/index.js
suggestion
0.643
</AlertMessage> ))} </ColumnStackLayout> </Line> ) : null} <PropertiesEditor unsavedChanges={unsavedChanges} schema={propertiesSchema} ...
```suggestion // Avoid to lose user changes by forcing them ```
JavaScript
@@ -342,12 +360,22 @@ const CustomObjectPropertiesEditor = (props: Props) => { label={<Trans>Edit</Trans>} leftIcon={<Edit />} onClick={editVariant} + // Avoid to loose user changes by forcing them
</AlertMessage> ))} </ColumnStackLayout> </Line> ) : null} <PropertiesEditor unsavedChanges={unsavedChanges} schema={propertiesSchema} ...
4ian/GDevelop
newIDE/app/src/ObjectEditor/Editors/CustomObjectPropertiesEditor/index.js
suggestion
0.643
gd::ExpressionCodeGenerator::GenerateExpressionCode( codeGenerator, context, "string", instruction.GetParameter(0).GetPlainString()); gd::String operatorString = instruction.GetParameter(1).GetPlainString(); gd::String operandCode = gd::Expressio...
The opening parenthesis was in the `leftOperand` parameter. While it was working, it's now easier to follow.
C++
@@ -210,12 +220,13 @@ AdvancedExtension::AdvancedExtension() { codeGenerator.GenerateUpperScopeBooleanFullName("isConditionTrue", context); return resultingBoolean + " = " + - gd::String(instruction.IsInverted() ? "!" : "") + + gd::String(instruction.IsInverted() ? "!...
return "\"\" + eventsFunctionContext.getArgument(" + parameterNameCode + ")"; }); GetAllConditions()["CompareArgumentAsNumber"] .SetCustomCodeGenerator([](gd::Instruction &instruction, gd::EventsCodeGenerator &codeGenerator, ...
4ian/GDevelop
GDJS/GDJS/Extensions/Builtin/AdvancedExtension.cpp
suggestion
0.5
/** * Process the specified resource. * * This method will only be run while loading screen is shown. It can do * heavy tasks like parsing data. */ processResource(resourceName: string): Promise<void>; /** * Return the kind of resources handled by this manager. */ get...
```suggestion * @param resourceData The resource to clear ```
TypeScript
@@ -31,19 +31,19 @@ namespace gdjs { getResourceKinds(): Array<ResourceKind>; /** - * Should clear all resources, data, loaders stored by this manager. + * Clear all resources, data, loaders stored by this manager. * Using the manager after calling this method is undefined behavior. */ ...
/** * Process the specified resource. * * This method will only be run while loading screen is shown. It can do * heavy tasks like parsing data. */ processResource(resourceName: string): Promise<void>; /** * Return the kind of resources handled by this manager. */ get...
4ian/GDevelop
GDJS/Runtime/ResourceManager.ts
suggestion
0.571
const serializedExtension = await eventsFunctionsExtensionOpener.readEventsFunctionExtensionFile( pathOrUrl ); if (project.hasEventsFunctionsExtensionNamed(serializedExtension.name)) { const answer = await showConfirmation({ title: t`Replace existing extension`, message: t`An ex...
```suggestion message: t`The extension can't be imported because it has the same name as a built-in extension.`, ```
JavaScript
@@ -65,13 +69,31 @@ export const importExtension = async ( ); if (project.hasEventsFunctionsExtensionNamed(serializedExtension.name)) { - const answer = Window.showConfirmDialog( - i18n._( - t`An extension with this name already exists in the project. Importing this extension will repla...
try { const pathOrUrl = await eventsFunctionsExtensionOpener.chooseEventsFunctionExtensionFile(); if (!pathOrUrl) return null; const serializedExtension = await eventsFunctionsExtensionOpener.readEventsFunctionExtensionFile( pathOrUrl ); if (project.hasEventsFunctionsExtensionNamed(seriali...
4ian/GDevelop
newIDE/app/src/AssetStore/ExtensionStore/InstallExtension.js
suggestion
0.786
// @flow import { Trans } from '@lingui/macro'; import { t } from '@lingui/macro'; import * as React from 'react'; import { ResponsiveLineStackLayout, LineStackLayout, ColumnStackLayout, } from '../UI/Layout'; import { Line } from '../UI/Grid'; import SemiControlledTextField from '../UI/SemiControlledTextField'; ...
```suggestion export type Choice = {| value: string, label: string, |}; ```
JavaScript
@@ -0,0 +1,99 @@ +// @flow +import { Trans } from '@lingui/macro'; +import { t } from '@lingui/macro'; +import * as React from 'react'; +import { + ResponsiveLineStackLayout, + LineStackLayout, + ColumnStackLayout, +} from '../UI/Layout'; +import { Line } from '../UI/Grid'; +import SemiControlledTextField from '../U...
// @flow import { Trans } from '@lingui/macro'; import { t } from '@lingui/macro'; import * as React from 'react'; import { ResponsiveLineStackLayout, LineStackLayout, ColumnStackLayout, } from '../UI/Layout'; import { Line } from '../UI/Grid'; import SemiControlledTextField from '../UI/SemiControlledTextField'; ...
4ian/GDevelop
newIDE/app/src/ChoicesEditor/index.js
suggestion
0.714
// @flow import * as React from 'react'; import { type I18n as I18nType } from '@lingui/core'; import { type FiltersState, useFilters } from '../../UI/Search/FiltersChooser'; import { getBehaviorsRegistry, type BehaviorsRegistry, type BehaviorShortHeader, } from '../../Utils/GDevelopServices/Extension'; import { ...
Should that be: ```suggestion const excludedExperimentalTiers = new Set(['community', 'experimental']); ```
JavaScript
@@ -20,7 +20,7 @@ const gd: libGDevelop = global.gd; const emptySearchText = ''; const noExcludedTiers = new Set(); -const excludedCommunityTiers = new Set(['community']); +const excludedExperimentalTiers = new Set(['experimental']);
// @flow import * as React from 'react'; import { type I18n as I18nType } from '@lingui/core'; import { type FiltersState, useFilters } from '../../UI/Search/FiltersChooser'; import { getBehaviorsRegistry, type BehaviorsRegistry, type BehaviorShortHeader, } from '../../Utils/GDevelopServices/Extension'; import { ...
4ian/GDevelop
newIDE/app/src/AssetStore/BehaviorStore/BehaviorStoreContext.js
suggestion
0.786
bool isAnyBehaviorMissing = false; gd::ParameterMetadataTools::IterateOverParametersWithIndex( instruction.GetParameters(), instrInfos.parameters, [this, &isAnyBehaviorMissing, &instrInfos](const gd::ParameterMetadata &parameterMetadata, const gd::Expression &parameterVal...
I think it's safe to stop generating the instruction in this case because: - the only built-in functions which has an `objectList` and a `behavior` are Physics collision conditions - the diagnostic report bullied users to make them fix their groups - the events-functions crashed so it was not usable for them
C++
@@ -506,13 +512,24 @@ void EventsCodeGenerator::CheckBehaviorParameters( if (!expectedBehaviorType.empty() && actualBehaviorType != expectedBehaviorType) { + const auto &objectParameterMetadata = + instrInfos.GetParameter(lastObjectIndex); + // Event...
bool isAnyBehaviorMissing = false; gd::ParameterMetadataTools::IterateOverParametersWithIndex( instruction.GetParameters(), instrInfos.parameters, [this, &isAnyBehaviorMissing, &instrInfos](const gd::ParameterMetadata &parameterMetadata, const gd::Expression &parameterVal...
4ian/GDevelop
Core/GDCore/Events/CodeGeneration/EventsCodeGenerator.cpp
bug
0.643
bool EventsCodeGenerator::CheckBehaviorParameters( const gd::Instruction &instruction, const gd::InstructionMetadata &instrInfos) { bool isAnyBehaviorMissing = false; gd::ParameterMetadataTools::IterateOverParametersWithIndex( instruction.GetParameters(), instrInfos.parameters, [this, &isA...
"Lose sight" is not super clear. Maybe: ```suggestion // Event functions crash if some objects in a group are missing // the required behaviors, since they lose reference to the original objects. // Missing behaviors are considered "fatal" only for ObjectList parameters, ...
C++
@@ -506,13 +512,24 @@ void EventsCodeGenerator::CheckBehaviorParameters( if (!expectedBehaviorType.empty() && actualBehaviorType != expectedBehaviorType) { + const auto &objectParameterMetadata = + instrInfos.GetParameter(lastObjectIndex); + // Event...
bool EventsCodeGenerator::CheckBehaviorParameters( const gd::Instruction &instruction, const gd::InstructionMetadata &instrInfos) { bool isAnyBehaviorMissing = false; gd::ParameterMetadataTools::IterateOverParametersWithIndex( instruction.GetParameters(), instrInfos.parameters, [this, &isA...
4ian/GDevelop
Core/GDCore/Events/CodeGeneration/EventsCodeGenerator.cpp
bug
0.857
} return makeGenericFailure( `Could not find an object in the asset store to replace "${object_name}" in scene "${scene_name}". Instead, inspect properties of the object and modify it until it matches what you want it to be.` ); }; const duplicateExistingObject = (duplicatedObjectNam...
```suggestion `Duplicated object "${duplicatedObjectName}" as "${newObject.getName()}". The new object "{newObject.getName()}" has the same type, behaviors, properties and effects as the one it was duplicated from.` ```
JavaScript
@@ -662,7 +691,45 @@ const createOrReplaceObject: EditorFunction = { ); }; - if (!shouldReplaceExistingObject) { + const duplicateExistingObject = (duplicatedObjectName: string) => { + const object = objectsContainer.getObject(duplicatedObjectName); + const serializedObject = serializeToJS...
} return makeGenericFailure( `Could not find an object in the asset store to replace "${object_name}" in scene "${scene_name}". Instead, inspect properties of the object and modify it until it matches what you want it to be.` ); }; const duplicateExistingObject = (duplicatedObjectNam...
4ian/GDevelop
newIDE/app/src/EditorFunctions/index.js
refactor
0.929
logger.warn( 'Unable to find bitmap font for resource "' + resourceName + '".' ); return; } if (this._loadedFontsData.get(resource)) { return; } try { const response = await fetch( this._resourceLoader.getFullUrl(resource.file), ...
```suggestion // Sanitize: remove lines starting with # (acting as comments) ```
TypeScript
@@ -278,8 +278,15 @@ namespace gdjs { 'same-origin', } ); - const fontData = await response.text(); - this._loadedFontsData.set(resource, fontData); + const fontDataRaw = await response.text(); + + // Sanitize : remove the lines staring with #
logger.warn( 'Unable to find bitmap font for resource "' + resourceName + '".' ); return; } if (this._loadedFontsData.get(resource)) { return; } try { const response = await fetch( this._resourceLoader.getFullUrl(resource.file), ...
4ian/GDevelop
GDJS/Runtime/pixi-renderers/pixi-bitmapfont-manager.ts
security
0.643
); const deleteThisGroup = SafeExtractor.extractBooleanProperty( changed_group, 'delete_this_group' ); const objects = SafeExtractor.extractArrayProperty( changed_group, 'objects' ); if (groupName === null) { warnings.push...
This will probably crash the app/mess up the memory because you release an object that is still owned by the list of groups. You need to call `remove` on the ObjectGroupsContainer
JavaScript
@@ -3891,6 +3934,94 @@ const changeScenePropertiesLayersEffects: EditorFunction = { }); } + if (changed_groups) { + const groups = project + .getLayout(scene_name) + .getObjects() + .getObjectGroups(); + changed_groups.forEach(changed_group => { + const groupName =...
} changes.push( `Modified "${propertyName}" property of the "${effectName}" effect to "${newValue}".` ); }); } if (newlyCreatedEffect) { const effectMetadata = gd.MetadataProvider.getEffectMetadata( project.getCurrentPla...
4ian/GDevelop
newIDE/app/src/EditorFunctions/index.js
bug
0.714
foundGroup.getName(), newGroupName, /* isObjectGroup=*/ true ); foundGroup.setName(newGroupName); changes.push( `Renamed group "${groupName}" to "${newGroupName}" in scene "${scene_name}".` ); } i...
You already have it? ```suggestion const sceneObjects = scene.getObjects(); ``` I see any get as suspicious if I don't see a check before for existence.
JavaScript
@@ -3891,6 +3978,103 @@ const changeScenePropertiesLayersEffects: EditorFunction = { }); } + if (changed_groups) { + const groups = scene.getObjects().getObjectGroups(); + changed_groups.forEach(changed_group => { + const groupName = SafeExtractor.extractStringProperty( + chan...
foundGroup.getName(), newGroupName, /* isObjectGroup=*/ true ); foundGroup.setName(newGroupName); changes.push( `Renamed group "${groupName}" to "${newGroupName}" in scene "${scene_name}".` ); } i...
4ian/GDevelop
newIDE/app/src/EditorFunctions/index.js
suggestion
0.714
return makeGenericFailure( `Object with name "${object_name}" already exists in scene "${scene_name}" but with a different type ("${object_type}").` ); } // /!\ Tell the editor that some objects have potentially been modified (and even removed). // This will forc...
For me, this scope should not be needed here: the function itself should do the work of searching the object wherever it is. This is similar to events btw, you search in scene then in global objects.
JavaScript
@@ -790,15 +817,22 @@ const createOrReplaceObject: EditorFunction = { }; /** - * Retrieves the properties of a specific object in a scene + * Retrieves the properties of a specific object (global or in a scene) */ const inspectObjectProperties: EditorFunction = { renderForEditor: ({ args, editorCallbacks }) =...
if (!existingObject) { // No existing object to duplicate, create a new one. return createNewObject(); } const objectsContainerWhereObjectWasFound = isGlobalObject ? globalObjects : layoutObjects; const targetObjectsContainer = target_object_scope === 'g...
4ian/GDevelop
newIDE/app/src/EditorFunctions/index.js
suggestion
0.5
', ' )}.`; return propertiesText; }; const createNewObject = async () => { // Check if object already exists. let existingObject: gdObject | null = null; if (layoutObjects.hasObjectNamed(object_name)) { existingObject = layoutObjects.getObject(object_name); ...
Might be worth writing something like ```suggestion `Object with name "${object_name}" already exists globally but with a different type ("${object_type}").` ``` (needs a boolean to remember or check where it's coming from, but worth it I think for a LLM that is freaking out)
JavaScript
@@ -553,11 +558,39 @@ const createOrReplaceObject: EditorFunction = { }; const createNewObject = async () => { + // Check if object already exists. + let existingObject: gdObject | null = null; + + if (layoutObjects.hasObjectNamed(object_name)) { + existingObject = layoutObjects.getObj...
', ' )}.`; return propertiesText; }; const createNewObject = async () => { // Check if object already exists. let existingObject: gdObject | null = null; let isGlobalObject = false; if (layoutObjects.hasObjectNamed(object_name)) { existingObject = layoutObje...
4ian/GDevelop
newIDE/app/src/EditorFunctions/index.js
suggestion
0.929
} } /** * To be called when the game is disposed. * Uninstall all the fonts from memory and clear cache of loaded fonts. */ dispose(): void { for (const bitmapFontInstallKey in this._pixiBitmapFontsInUse) { PIXI.BitmapFont.uninstall(bitmapFontInstallKey); } f...
I think that should be ```suggestion if (bitmapFontInstallKey.startsWith(resourceData.name + '@')) { ``` to avoid issues when a resource name is a prefix of another (not that unlikely, it can happen if a resource name is "MyBitmapText" and another is "MyBitmapTextSpecial" or "MyBitmapText2", etc...)
TypeScript
@@ -316,19 +316,27 @@ namespace gdjs { } unloadResource(resourceData: ResourceData): void { - const loadedFont = this._loadedFontsData.getFromName(resourceData.name); - if (loadedFont) { - this._loadedFontsData.delete(resourceData); - } + this._loadedFontsData.delete(resourceData)...
} } /** * To be called when the game is disposed. * Uninstall all the fonts from memory and clear cache of loaded fonts. */ dispose(): void { for (const bitmapFontInstallKey in this._pixiBitmapFontsInUse) { PIXI.BitmapFont.uninstall(bitmapFontInstallKey); } f...
4ian/GDevelop
GDJS/Runtime/pixi-renderers/pixi-bitmapfont-manager.ts
suggestion
0.857
PIXI.BitmapFont.uninstall(bitmapFontInstallKey); } this._pixiBitmapFontsInUse = {}; this._pixiBitmapFontsToUninstall.length = 0; this._loadedFontsData.clear(); } unloadResource(resourceData: ResourceData): void { this._loadedFontsData.delete(resourceData); for (con...
Same, probably safer to add the delimiter: ```suggestion if (bitmapFontInstallKey.startsWith(resourceData.name + '@')) { ```
TypeScript
@@ -316,19 +316,27 @@ namespace gdjs { } unloadResource(resourceData: ResourceData): void { - const loadedFont = this._loadedFontsData.getFromName(resourceData.name); - if (loadedFont) { - this._loadedFontsData.delete(resourceData); - } + this._loadedFontsData.delete(resourceData)...
PIXI.BitmapFont.uninstall(bitmapFontInstallKey); } this._pixiBitmapFontsInUse = {}; this._pixiBitmapFontsToUninstall.length = 0; this._loadedFontsData.clear(); } unloadResource(resourceData: ResourceData): void { this._loadedFontsData.delete(resourceData); for (con...
4ian/GDevelop
GDJS/Runtime/pixi-renderers/pixi-bitmapfont-manager.ts
suggestion
0.714
#include "GDCore/Extensions/Metadata/AbstractFunctionMetadata.h" #include "GDCore/Extensions/Metadata/BehaviorMetadata.h" #include "GDCore/Extensions/Metadata/InstructionMetadata.h" #include "GDCore/Extensions/Metadata/MetadataProvider.h" #include "GDCore/Extensions/Platform.h" #include "GDCore/IDE/Events/ExpressionVa...
GetParameter does not do any bound checking nor return a "null object", so let's check the bound to avoid a crash in case a wrong parameterIndex is passed. Better be safe.
C++
@@ -0,0 +1,141 @@ +/* + * GDevelop Core + * Copyright 2008-2025 Florian Rival (Florian.Rival@gmail.com). All rights + * reserved. This project is released under the MIT License. + */ +#include "InstructionValidator.h" + +#include "GDCore/Extensions/Metadata/AbstractFunctionMetadata.h" +#include "GDCore/Extensions/Metad...
#include "GDCore/Extensions/Metadata/AbstractFunctionMetadata.h" #include "GDCore/Extensions/Metadata/BehaviorMetadata.h" #include "GDCore/Extensions/Metadata/InstructionMetadata.h" #include "GDCore/Extensions/Metadata/MetadataProvider.h" #include "GDCore/Extensions/Platform.h" #include "GDCore/IDE/Events/ExpressionVa...
4ian/GDevelop
Core/GDCore/IDE/InstructionValidator.cpp
bug
0.571
#include "GDCore/Extensions/Metadata/AbstractFunctionMetadata.h" #include "GDCore/Extensions/Metadata/BehaviorMetadata.h" #include "GDCore/Extensions/Metadata/InstructionMetadata.h" #include "GDCore/Extensions/Metadata/MetadataProvider.h" #include "GDCore/Extensions/Platform.h" #include "GDCore/IDE/Events/ExpressionVal...
```suggestion // TODO Remove the ternary when all parameter declarations use ```
C++
@@ -0,0 +1,141 @@ +/* + * GDevelop Core + * Copyright 2008-2025 Florian Rival (Florian.Rival@gmail.com). All rights + * reserved. This project is released under the MIT License. + */ +#include "InstructionValidator.h" + +#include "GDCore/Extensions/Metadata/AbstractFunctionMetadata.h" +#include "GDCore/Extensions/Metad...
#include "GDCore/Extensions/Metadata/AbstractFunctionMetadata.h" #include "GDCore/Extensions/Metadata/BehaviorMetadata.h" #include "GDCore/Extensions/Metadata/InstructionMetadata.h" #include "GDCore/Extensions/Metadata/MetadataProvider.h" #include "GDCore/Extensions/Platform.h" #include "GDCore/IDE/Events/ExpressionVal...
4ian/GDevelop
Core/GDCore/IDE/InstructionValidator.cpp
suggestion
0.643
std::size_t parameterIndex, const gd::String &value) { auto &parameterMetadata = metadata.GetParameter(parameterIndex); // TODO Remove the ternary when any parameter declaration uses // "number" instead of "expression". auto &parameterType = parameterMetadata.GetType() == "expression" ...
```suggestion // declared while legacy ones don't. // This is why it's done here instead of in the parser directly. ```
C++
@@ -0,0 +1,141 @@ +/* + * GDevelop Core + * Copyright 2008-2025 Florian Rival (Florian.Rival@gmail.com). All rights + * reserved. This project is released under the MIT License. + */ +#include "InstructionValidator.h" + +#include "GDCore/Extensions/Metadata/AbstractFunctionMetadata.h" +#include "GDCore/Extensions/Metad...
std::size_t parameterIndex, const gd::String &value) { if (parameterIndex >= instruction.GetParametersCount() || parameterIndex >= metadata.GetParametersCount()) { return false; } const auto &parameterMetadata = metadata.GetParameter(parameterIndex); // TODO Remove the ternary when all parameter d...
4ian/GDevelop
Core/GDCore/IDE/InstructionValidator.cpp
suggestion
0.786
auto &parameterType = parameterMetadata.GetType() == "expression" ? "number" : parameterMetadata.GetType(); bool shouldNotBeValidated = parameterType == "layer" && value.empty(); if (shouldNotBeValidated) { return true; } if (gd::ParameterMetadata::I...
```suggestion // Check at least the name of the root variable, it's the best we can ```
C++
@@ -0,0 +1,141 @@ +/* + * GDevelop Core + * Copyright 2008-2025 Florian Rival (Florian.Rival@gmail.com). All rights + * reserved. This project is released under the MIT License. + */ +#include "InstructionValidator.h" + +#include "GDCore/Extensions/Metadata/AbstractFunctionMetadata.h" +#include "GDCore/Extensions/Metad...
} const auto &parameterMetadata = metadata.GetParameter(parameterIndex); // TODO Remove the ternary when all parameter declarations use // "number" instead of "expression". const auto &parameterType = parameterMetadata.GetType() == "expression" ? "number" ...
4ian/GDevelop
Core/GDCore/IDE/InstructionValidator.cpp
suggestion
0.571
} return true; } gd::String InstructionValidator::GetRootVariableName(const gd::String &name) { auto dotPosition = name.find('.'); auto squareBracketPosition = name.find('['); if (dotPosition == gd::String::npos && squareBracketPosition == gd::String::npos) { return name; } return name.substr(0...
Here and below, try to const everything: ```suggestion const auto &behaviorParameter = instructionMetadata.GetParameter(index); ```
C++
@@ -0,0 +1,141 @@ +/* + * GDevelop Core + * Copyright 2008-2025 Florian Rival (Florian.Rival@gmail.com). All rights + * reserved. This project is released under the MIT License. + */ +#include "InstructionValidator.h" + +#include "GDCore/Extensions/Metadata/AbstractFunctionMetadata.h" +#include "GDCore/Extensions/Metad...
const auto &resourceName = instruction.GetParameter(parameterIndex).GetPlainString(); return projectScopedContainers.GetResourcesContainersList() .HasResourceNamed(resourceName); } return true; } gd::String InstructionValidator::GetRootVariableName(const gd::String &name) { const auto dot...
4ian/GDevelop
Core/GDCore/IDE/InstructionValidator.cpp
suggestion
0.714
logger.warn( 'There was an error while preloading an audio file: ' + error ); throw error; } } else if ( resource.preloadInCache || // Force downloading of sounds. // TODO Decide if sounds should be allowed to be downloaded after the scene ...
I suggest an exception that gives more context to ease debugging: ```suggestion reject(`HTTP error while preloading audio file in cache. Status is ${sound.status}.`); ```
TypeScript
@@ -1059,7 +1068,13 @@ namespace gdjs { const sound = new XMLHttpRequest(); sound.withCredentials = this._resourceLoader.checkIfCredentialsRequired(file); - sound.addEventListener('load', resolve); + sound.addEventListener('load', () => { + if ...
logger.warn( 'There was an error while preloading an audio file: ' + error ); throw error; } } else if ( resource.preloadInCache || // Force downloading of sounds. // TODO Decide if sounds should be allowed to be downloaded after the scene ...
4ian/GDevelop
GDJS/Runtime/howler-sound-manager/howler-sound-manager.ts
bug
0.857
if (!resource) { logger.warn( 'Unable to find bitmap font for resource "' + resourceName + '".' ); return; } if (this._loadedFontsData.get(resource)) { return; } try { const response = await fetch( this._resourceLoader.getFullUrl...
```suggestion throw new Error(`HTTP error while loading bitmap font. Status is ${sound.status}.`); ```
TypeScript
@@ -278,6 +278,10 @@ namespace gdjs { 'same-origin', } ); + if (!response.ok) { + throw new Error(`HTTP error! status: ${response.status}`);
if (!resource) { logger.warn( 'Unable to find bitmap font for resource "' + resourceName + '".' ); return; } if (this._loadedFontsData.get(resource)) { return; } try { const response = await fetch( this._resourceLoader.getFullUrl...
4ian/GDevelop
GDJS/Runtime/pixi-renderers/pixi-bitmapfont-manager.ts
suggestion
0.857
// @flow import { type ProjectSettings } from './ProjectSettingsReader'; import { type Preferences } from '../MainFrame/Preferences/PreferencesContext'; /** * Applies project-specific settings from a settings.ini file to the editor preferences. * This allows projects to override certain editor preferences when they ...
This is fairly verbose. I wonder if we could reduce everything to a few key concepts: - ProjectSettings renamed to "ProjectSpecificPreferences". It can be a "Partial<Preferences>" (or in Flow, I think it's `$Shape<Preferences>`). - An "allowlist" of names of preferences that can be overwritten. - When a project is loa...
JavaScript
@@ -0,0 +1,117 @@ +// @flow +import { type ProjectSettings } from './ProjectSettingsReader'; +import { type Preferences } from '../MainFrame/Preferences/PreferencesContext'; + +/** + * Applies project-specific settings from a settings.ini file to the editor preferences. + * This allows projects to override certain edit...
// @flow import { type ParsedProjectSettings } from './ProjectSettingsReader'; import { type Preferences, type ProjectSpecificPreferencesValues, } from '../MainFrame/Preferences/PreferencesContext'; /** Allowlist of preference keys that can be overridden per-project. */ const allowedPreferenceKeys: $ReadOnlyArray<...
4ian/GDevelop
newIDE/app/src/Utils/ApplyProjectSettings.js
suggestion
0.643
}); test('ignores non-boolean values', () => { const rawSettings = { autosaveOnPreview: 'true', use3DEditor: 42, showDeprecatedInstructionWarning: null, }; expect(convertToProjectSettings(rawSettings)).toEqual({}); }); test('handles all valid preference keys',...
These tests are a bit of a "tautology". I would rather reduce the noise-to-signal ratio by not having them, as "testing a Set" is not super interesting and will actually make the codebase less flexible (because you have to remember updating these if at some point you rework the set to be something else). In other words...
JavaScript
@@ -0,0 +1,265 @@ +// @flow +import { + flattenIniObject, + convertToProjectSettings, + VALID_PREFERENCE_KEYS, +} from './ProjectSettingsReader'; +import ini from 'ini'; + +describe('ProjectSettingsReader', () => { + describe('ini library parsing', () => { + test('parses true/false as native booleans', () => { +...
// @flow import { filterAllowedPreferences, applyProjectSettings, } from './ApplyProjectSettings'; import YAML from 'yaml'; describe('ProjectSettingsReader', () => { describe('end-to-end: YAML content applied to preferences', () => { test('gdevelop-settings.yaml content is properly parsed, filtered, and appl...
4ian/GDevelop
newIDE/app/src/Utils/ProjectSettingsReader.spec.js
suggestion
0.5
// @flow import optionalRequire from './OptionalRequire'; import YAML from 'yaml'; const fs = optionalRequire('node:fs'); const fsPromises = fs ? fs.promises : null; const path = optionalRequire('node:path'); export type RawProjectSettings = { preferences?: { [string]: mixed }, }; export type ParsedProjectSettings...
I suggest we use a slightly more specific name to avoid conflicts: ```suggestion const SETTINGS_FILE_NAME = 'gdevelop-settings.yaml'; ```
JavaScript
@@ -0,0 +1,97 @@ +// @flow +import optionalRequire from './OptionalRequire'; +import YAML from 'yaml'; + +const fs = optionalRequire('node:fs'); +const fsPromises = fs ? fs.promises : null; +const path = optionalRequire('node:path'); + +export type RawProjectSettings = { + preferences?: { [string]: mixed }, +}; + +exp...
// @flow import optionalRequire from './OptionalRequire'; import YAML from 'yaml'; import { SafeExtractor } from './SafeExtractor'; const fs = optionalRequire('fs'); const fsPromises = fs ? fs.promises : null; const path = optionalRequire('path'); export type ParsedProjectSettings = { preferences: { [string]: boole...
4ian/GDevelop
newIDE/app/src/Utils/ProjectSettingsReader.js
suggestion
0.786
} componentWillUnmount() { unregisterOnResourceExternallyChangedCallback( this.resourceExternallyChangedCallbackId ); } _onKeyDown = (event: KeyboardEvent) => { if (event.key === 'ArrowDown' || event.key === 'ArrowUp') { this._moveSelection(event.key === 'ArrowDown' ? 1 : -1); ev...
Same as the other, I think it would be worth exposing Count and using GetResourcePosition rather than everytime getting getAllResourceNames + calling to JSArray which creates useless copies of the list of names in memory.
JavaScript
@@ -84,12 +84,43 @@ export default class ResourcesEditor extends React.Component<Props, State> { this.onResourceExternallyChanged.bind(this) ); } + componentWillUnmount() { unregisterOnResourceExternallyChangedCallback( this.resourceExternallyChangedCallbackId ); } + _onKeyDown ...
componentDidMount() { this.resourceExternallyChangedCallbackId = registerOnResourceExternallyChangedCallback( this.onResourceExternallyChanged.bind(this) ); } componentWillUnmount() { unregisterOnResourceExternallyChangedCallback( this.resourceExternallyChangedCallbackId ); } ref...
4ian/GDevelop
newIDE/app/src/ResourcesEditor/index.js
suggestion
0.643
clipboardContent, 'actionsCount' ); if (actionsCount === null) return false; return actionsCount > 0; }; export const copySelectionToClipboard = (selection: SelectionState) => { const eventsList = new gd.EventsList(); const actionsList = new gd.InstructionsList(); const conditionsList = new gd.Ins...
Not sure if useful, but could you use contains: https://github.com/4ian/GDevelop/blob/6377ece6f97ec3dc4d323066afdab8b28ff82ea6/Core/GDCore/Events/EventsList.h#L138-L144 (maybe not because you don't have an EventsList).
JavaScript
@@ -56,12 +56,43 @@ export const hasClipboardActions = () => { return actionsCount > 0; }; +const addAllSubEvents = ( + event: gdBaseEvent, + events: Set<gdBaseEvent> +): void => { + const subEvents = event.getSubEvents(); + for (let i = 0; i < subEvents.getEventsCount(); i++) { + const subEvent = subEvent...
clipboardContent, 'actionsCount' ); if (actionsCount === null) return false; return actionsCount > 0; }; const addAllSubEvents = ( event: gdBaseEvent, events: Set<gdBaseEvent> ): void => { const subEvents = event.getSubEvents(); for (let i = 0; i < subEvents.getEventsCount(); i++) { const su...
4ian/GDevelop
newIDE/app/src/EventsSheet/ClipboardKind.js
suggestion
0.5
// @flow import * as React from 'react'; import SoundPlayer, { type SoundPlayerInterface } from '../../UI/SoundPlayer'; import GenericIconPreview from './GenericIconPreview'; import Music from '../../UI/CustomSvgIcons/Music'; type Props = {| resourceName: string, audioResourceSource: string, |}; const AudioPrevie...
This ref is unused -> remove it. ```suggestion ```
JavaScript
@@ -0,0 +1,41 @@ +// @flow +import * as React from 'react'; +import SoundPlayer, { type SoundPlayerInterface } from '../../UI/SoundPlayer'; +import GenericIconPreview from './GenericIconPreview'; +import Music from '../../UI/CustomSvgIcons/Music'; + +type Props = {| + resourceName: string, + audioResourceSource: stri...
// @flow import * as React from 'react'; import SoundPlayer from '../../UI/SoundPlayer'; import GenericIconPreview from './GenericIconPreview'; import Music from '../../UI/CustomSvgIcons/Music'; type Props = {| resourceName: string, audioResourceSource: string, |}; const AudioPreview = ({ resourceName, audioResou...
4ian/GDevelop
newIDE/app/src/ResourcesList/ResourcePreview/AudioPreview.js
suggestion
0.643
const mobileAudioRef = React.useRef<?Audio>(null); const [isPlaying, setIsPlaying] = React.useState(false); const onPlayPause = React.useCallback( (forcePlay?: boolean) => { if (!soundSrc) return; setIsPlaying(_isPlaying => forcePlay || !_isPlaying); }, [soundSrc] ); ...
You only use onPlayPause in this file. No reason to expose it to the outside world. ```suggestion ```
JavaScript
@@ -0,0 +1,91 @@ +// @flow + +import * as React from 'react'; +import IconButton from '@material-ui/core/IconButton'; +import Play from '../CustomSvgIcons/Play'; +import Pause from '../CustomSvgIcons/Pause'; + +type Props = {| + soundSrc: string | null, + onSoundLoaded?: () => void, + onSoundError?: () => void, +|};...
}: Props) => { const audioRef = React.useRef<?HTMLAudioElement>(null); const [isPlaying, setIsPlaying] = React.useState(false); const [isLoading, setIsLoading] = React.useState(false); const [isAudioLoaded, setIsAudioLoaded] = React.useState(false); const isMountedRef = useIsMounted(); const abortController...
4ian/GDevelop
newIDE/app/src/UI/SoundPlayer/CompactSoundPlayer.js
suggestion
0.786
// @flow import * as React from 'react'; import IconButton from '@material-ui/core/IconButton'; import Play from '../CustomSvgIcons/Play'; import Pause from '../CustomSvgIcons/Pause'; type Props = {| soundSrc: string | null, onSoundLoaded?: () => void, onSoundError?: () => void, |}; export type CompactSoundPla...
Interface "playPause" is used nowhere by other components, so no need to complexify the component. ```suggestion const CompactSoundPlayer = ({ soundSrc, onSoundLoaded, onSoundError }: Props) => { ```
JavaScript
@@ -0,0 +1,91 @@ +// @flow + +import * as React from 'react'; +import IconButton from '@material-ui/core/IconButton'; +import Play from '../CustomSvgIcons/Play'; +import Pause from '../CustomSvgIcons/Pause'; + +type Props = {| + soundSrc: string | null, + onSoundLoaded?: () => void, + onSoundError?: () => void, +|};...
// @flow import * as React from 'react'; import IconButton from '@material-ui/core/IconButton'; import CircularProgress from '@material-ui/core/CircularProgress'; import Play from '../CustomSvgIcons/Play'; import Pause from '../CustomSvgIcons/Pause'; import { useIsMounted } from '../../Utils/UseIsMounted'; type Props...
4ian/GDevelop
newIDE/app/src/UI/SoundPlayer/CompactSoundPlayer.js
suggestion
1