Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Manipulate instances in the embedded game editor #7286

Open
wants to merge 21 commits into
base: feature/embedded-game
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions Core/GDCore/Project/InitialInstance.h
Original file line number Diff line number Diff line change
Expand Up @@ -365,6 +365,12 @@ class GD_CORE_API InitialInstance {
* the same initial instance between serialization.
*/
InitialInstance& ResetPersistentUuid();

/**
* \brief Reset the persistent UUID used to recognize
* the same initial instance between serialization.
*/
const gd::String& GetPersistentUuid() { return persistentUuid; };
///@}

private:
Expand Down
8 changes: 8 additions & 0 deletions Extensions/3D/A_RuntimeObject3DRenderer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,14 @@ namespace gdjs {
);
}

getObjectPositionFrom3DRendererObject() {
return {
x: this._threeObject3D.position.x - this._object.getWidth() / 2,
y: this._threeObject3D.position.y - this._object.getHeight() / 2,
z: this._threeObject3D.position.z - this._object.getDepth() / 2,
};
}

updateRotation() {
this._threeObject3D.rotation.set(
gdjs.toRad(this._object.getRotationX()),
Expand Down
18 changes: 16 additions & 2 deletions GDJS/Runtime/debugger-client/abstract-debugger-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,8 @@ namespace gdjs {
that.sendProfilerStarted();
} else if (data.command === 'profiler.stop') {
runtimeGame.stopCurrentSceneProfiler();
} else if (data.command === 'instances.updated') {
runtimeGame._editor.reloadInstances(data.payload);
} else if (data.command === 'hotReload') {
that._hotReloader.hotReload().then((logs) => {
that.sendHotReloaderLogs(logs);
Expand Down Expand Up @@ -636,11 +638,23 @@ namespace gdjs {
);
}

sendInstancesUpdated(runtimeObjects: gdjs.RuntimeObject[]): void {
sendInstancesUpdated(
objectUpdates: Array<{
object: RuntimeObject3D;
position: { x: number; y: number; z: number };
}>,
layoutName: string
): void {
this._sendMessage(
circularSafeStringify({
command: 'instances.updated',
payload: 'TODO',
payload: {
layoutName,
instances: objectUpdates.map((objectUpdate) => ({
persistentUuid: objectUpdate.object.persistentUuid,
position: objectUpdate.position,
})),
},
})
);
}
Expand Down
3 changes: 2 additions & 1 deletion GDJS/Runtime/pixi-renderers/ThreeAddons.js

Large diffs are not rendered by default.

Loading
Loading