The current behavior of the drag and drop of items in the inspector is a hardcoded logic:
Create an entity
Create a Tranform for the new entity with the x,y,z where the user dropped the item
Create a GltfContainer
We need to change it to be something like this:
Create an entity
Create a Tranform for the new entity with the x,y,z where the user dropped the item
Loop over all the components in the item and create them for the new entity with the values provided
Add the dependencies from the item to the project. We could add them to the package.json, since the dependencies are going to be npm packages. So we could use the data layer to read the current package.json, parse it, add the dependency and overwrite it.
Compile a javascript file of the dependencies (for now we can just call a function like this getCode(dependencies: Record<string, string>): Promise<string> that resolves to an empty scene:
module.exports = {
onStart() {},
onUpdate() {},
}
Store the file using the data layer a bin/index.js
The current behavior of the drag and drop of items in the inspector is a hardcoded logic:
Tranform
for the new entity with the x,y,z where the user dropped the itemGltfContainer
We need to change it to be something like this:
Tranform
for the new entity with the x,y,z where the user dropped the itemcomponents
in the item and create them for the new entity with the values provideddependencies
from the item to the project. We could add them to thepackage.json
, since the dependencies are going to be npm packages. So we could use the data layer to read the current package.json, parse it, add the dependency and overwrite it.getCode(dependencies: Record<string, string>): Promise<string>
that resolves to an empty scene:bin/index.js