aframevr / aframe-inspector

:mag: Visual inspector tool for A-Frame. Hit *<ctrl> + <alt> + i* on any A-Frame scene.
https://aframe.io/aframe-inspector/examples/
MIT License
647 stars 198 forks source link

[Feature Request] Customizable save endpoint #709

Open alenaksu opened 3 months ago

alenaksu commented 3 months ago

The save endpoint is currently hardcoded and not configurable, so it only works when used with aframe-watcher running on the default port.

In my case, I was looking to implement a Vite plugin to seamlessly integrate the save functionality with its dev server, but this is unfortunately not possible without hacks. Having such endpoint configurable, would make it easier the integration with other tools, without having to rely only on the aframe-watcher tool.

It would be nice to pass the configuration to the inspector somehow, for example by defining a global variable like in the example below:

const inspectorOptions = {
  // Defaults
  saveEndpoint: 'http://localhost:51234/save',

  // User-defined
  ...window.__AFRAME_INSPECTOR__
};

xhr.open('POST', inspectorOptions.saveEndpoint);
vincentfretin commented 3 months ago

See also #523 for an interesting discussion about plugins. I'm also interested into saving and loading from my own json format. @kfarr did that with https://github.com/3DStreet/3dstreet-editor (the editor core is aframe-inspector) and saving/loading json with firebase. See also https://github.com/c-frame/aframe-editor issues for some of discussions we had around more advanced features for an editor. I don't have the bandwidth to work on it currently though.