-
Notifications
You must be signed in to change notification settings - Fork 204
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
Consider supporting user inspector plugins? #523
Comments
In order for plugins to not be disruptive to the current UI I would probably give them their own panel to render themselves. That panel would be invoked by the user. Idea:
|
Yeah, I think the location is not too critical unless it becomes used for a bunch of fancy stuff. Which would be a good problem to have. Could be a third, new panel that pops up from the bottom of the page as well. |
Actually I started with something called |
@donmccurdy @dmarcos do you have any idea that could be simple enough to use it as an example and as a proof of concept of the plugin system? |
I'm sure there are quite a few more examples out there so definitely eager to see this. |
I think a couple of the ideas in my OP would be simple enough. Namely,
|
@donmccurdy I had already added the gltf exporter to the inspector (https://blog.mozvr.com/gltf-exporter-in-three-js-and-a-frame/) but maybe I could just remove it from the main code and use it as a simple use case for the plugin. I'm not sure how to deal with plugins that will need to include UI as they should be using react instead of plain javascript so it's not something straightforward. Proposals for implementation welcome :) |
Ok, I'll start checking the @tomas-polach as it seems that it's the only one that it's really implemented without modifying the core (https://github.com/archilogic-com/3dio-inspector-plugins) |
One question, should we have types of plugins and let the editor have a specific behaviour for it? Let's say:
Just some quick thoughts about it:
|
oh, nice! might as well keep it in the main code then.
IMO that's the only important case; if plugins did not need a UI they wouldn't need to integrate with the inspector.
My vote would be, all plugins are tab plugins (or some sort of UI panel), and there should be an API so that the plugin can listen for events when the selected entity changes. But I don't think there should be separate types of plugins for entities/components/no-ui. So really this requires
|
sry for joining late. this would be a great step forward!! all major editors thrive on community driven plugins. i'm fine with all the proposals as mentioned above and i am looking forward to adapt the 3d.io inspector plugins to fit into the new structure. based on the proposals above, here is my two cents: Using Plugins
Writing Plugins
AFRAME.inspector.registerPlugin('performance-panel', {
init: function () {
// Create Plugin UI
var myPanel = document.createElement('div');
function updatePanel () {
myPanel.innerHTML = AFRAME.inspector.selected.object3D.uuid
}
// Regsiter Plugin UI
this.registerPanel(myPanel, {
type: 'tab' // might be: 'floating', 'tab', 'tab-widget' ?
});
this.registerShortcut(80, () => {
this.togglePanel();
}, false);
this.registerMenuItem('Performance Panel', () => {
this.showPanel();
}, false);
// Plugin Events
this.on('showpanel', () => {
updatePanel()
// bind inspector events when panel becomes visible
AFRAME.inspector.on('selected', updatePanel)
}, false);
this.on('hidepanel', () => {
// unbind events when panel becomes hidden
AFRAME.inspector.off('selected', updatePanel)
}, false);
},
// called once when inspetor is closing or plugin has been disabled
remove: function () {
// clean up
}
}); |
What's the minimum API we can introduce that would let people start experimenting with interesting plugins? I think search/discovery and keybindings might be best left until there are some examples in the wild and plugin authors can perhaps help contribute then. Suggested:
|
Another quick note, more to just keep this in one place... if my plugin needs to scan the scene, filtering the inspector's objects out is a bit of guesswork:
... another nice-to-have would be markings (userData, say?) to identify these objects, or a more predictable prefix on the object names. |
Also, I'm using a helper component to get around the lack of inspector open/close events, and that's working reasonably well: AFRAME.registerComponent('inspector-plugin-mything', {
init: function () {
const tmpEl = document.createElement('div');
tmpEl.innerHTML = panelTpl;
const panelEl = tmpEl.children[0];
document.body.appendChild(panelEl);
this.plugin = new MyPlugin(panelEl, this.el);
},
pause: function () {
this.plugin.setVisible(true);
},
play: function () {
this.plugin.setVisible(false);
}
}); |
Hi @fernandojsg —
What do you think about letting developers write plugins for the inspector, by having a simple API for attaching their DOM element to a tab?
Some example use cases:
These all seem like interesting use cases for the inspector, but not necessarily something we'd build and support ourselves. But maybe we could have an API like this?
The text was updated successfully, but these errors were encountered: