MCPcopy
hub / github.com/4ian/GDevelop / onApply

Function onApply

newIDE/app/src/ObjectEditor/ObjectEditorDialog.js:184–226  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

182 props.editorComponent;
183
184 const onApply = async () => {
185 props.onApply(hasResourceChanged, hasAnyEffectBeenAdded);
186
187 const initialInstances =
188 (layout && layout.getInitialInstances()) ||
189 (eventsBasedObject && eventsBasedObject.getInitialInstances()) ||
190 null;
191 if (!initialInstances) {
192 // This can't actually happen.
193 return;
194 }
195
196 const originalSerializedVariables = getOriginalContentSerializedElement().getChild(
197 'variables'
198 );
199 const changeset = gd.WholeProjectRefactorer.computeChangesetForVariablesContainer(
200 originalSerializedVariables,
201 object.getVariables()
202 );
203 gd.WholeProjectRefactorer.applyRefactoringForObjectVariablesContainer(
204 project,
205 object.getVariables(),
206 initialInstances,
207 object.getName(),
208 changeset,
209 originalSerializedVariables
210 );
211 if (eventsBasedObject) {
212 gd.ObjectRefactorer.applyChangesToVariants(
213 eventsBasedObject,
214 object.getName(),
215 changeset
216 );
217 }
218
219 // Clear variable UUIDs to avoid them being persisted in the project file.
220 object.getVariables().clearPersistentUuid();
221
222 // Do the renaming *after* applying changes, as "withSerializableObject"
223 // HOC will unserialize the object to apply modifications, which will
224 // override the name.
225 onRename(objectName);
226 };
227
228 const { DismissableTutorialMessage } = useDismissableTutorialMessage(
229 'intro-variables'

Callers 15

InlineParameterEditorFunction · 0.50
handleMouseUpFunction · 0.50
applyFunction · 0.50
applyFunction · 0.50
onSaveFunction · 0.50
onSubmitFunction · 0.50
onSubmitFunction · 0.50

Calls 3

getNameMethod · 0.65
getChildMethod · 0.45
getVariablesMethod · 0.45

Tested by

no test coverage detected