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
654 stars 201 forks source link

INSPECTOR BROKEN - 'asset' type schema property objects being re-parsed as URLs #476

Closed NNskelly closed 7 years ago

NNskelly commented 7 years ago

re-filed from https://github.com/aframevr/aframe/issues/2662

Description: The latest a-frame inspector min.js as retrieved from unpkg.com e.g. by the A-Painter demo is throwing errors whenever an entity is selected which has a material component with a src or other map (or asset?) property. The error manifests as a "e.match is not a function" js error in an obscurely nested minified block in which e appears to be the actual parsed asset object, and the function appears to be attempting to re-parse it as a URL or asset ID, e.g. comparing "#"===e[0] and then looking it up as a # id if true, or attempting to parse it as a URL (using string .match) if false.

As a side-effect, many inspector fields for map/asset properties now show as empty boxes with [object] as the source, rather than as previews with the corresponding asset #id as the source.

Edit: in fact, upon further experiments with debugging off, the errors derail the whole Inspector and Scene refresh flow to the point where any material updates in the inspector become impossible. Definitely a priority bug, I would think.

a variety of other issues, likely related, also show up, some suggesting a corrupted/misfiled canvas context, others that sound like somewhere that is expecting a valid parsed object are instead getting some earlier state e.g. a raw string, although I am having difficulty isolating deterministic repro steps. Clicking between entities with different types of shader, or with and without materials, seems to re-trigger most types of error, somewhat arbitrarily.

match_not_a_function callstack

A locally-linked (e.g. inspector="url: scripts/aframe-inspector.min.js" in the scene tag) inspector latest-zip-downloaded from the inspector github does not, at least initially, appear to be exhibiting this issue, so it may be tangled up in how the latest-version auto-URL is being resolved. However, latest listed release does appear to be 0.5.2, which looks like what is being remotely loaded, so... no explanation as of yet :-P

Edit 2: locally-sourced 0.5.2 just threw the match error. crisis not averted.

fernandojsg commented 7 years ago

@NNskelly could you give it a try with the latest deployed version 0.5.3?

NNskelly commented 7 years ago

@fernandojsg Current live A-Painter https://aframe.io/examples/showcase/a-painter/ looks like it is now loading 0.5.3 inspector; error still occurs. 0_5_3_match

popped open the inspector, occurred right away when I clicked the .

e in this case looks like it is an HTMLImageElement img#floor

fernandojsg commented 7 years ago

I think I found it thanks: https://github.com/aframevr/aframe-inspector/pull/481