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

Function apply

newIDE/app/src/VariablesList/ObjectGroupVariablesDialog.js:75–116  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

73 });
74
75 const apply = async () => {
76 onApply(
77 lastSelectedVariableNodeId.current &&
78 getVariablePathFromNodeId(
79 lastSelectedVariableNodeId.current,
80 groupVariablesContainer
81 )
82 );
83 if (!initialInstances) {
84 // This can only happens for legacy function object groups.
85 // In this case, we don't do any refactoring.
86 return;
87 }
88
89 const originalSerializedVariables = getOriginalVariablesSerializedElement();
90 const changeset = gd.WholeProjectRefactorer.computeChangesetForVariablesContainer(
91 originalSerializedVariables,
92 groupVariablesContainer
93 );
94
95 gd.WholeProjectRefactorer.applyRefactoringForGroupVariablesContainer(
96 project,
97 globalObjectsContainer || objectsContainer,
98 objectsContainer,
99 initialInstances,
100 groupVariablesContainer,
101 objectGroup,
102 changeset,
103 originalSerializedVariables
104 );
105 const { eventsBasedObject } = projectScopedContainersAccessor.getScope();
106 if (eventsBasedObject) {
107 for (const objectName of objectGroup.getAllObjectsNames().toJSArray()) {
108 gd.ObjectRefactorer.applyChangesToVariants(
109 eventsBasedObject,
110 objectName,
111 changeset
112 );
113 }
114 }
115 groupVariablesContainer.clearPersistentUuid();
116 };
117
118 const lastSelectedVariableNodeId = React.useRef<string | null>(null);
119 const onSelectedVariableChange = React.useCallback((nodes: Array<string>) => {

Callers

nothing calls this directly

Calls 3

getScopeMethod · 0.80
onApplyFunction · 0.50

Tested by

no test coverage detected