Closed jsantell closed 7 years ago
@dmarcos could you take a look at it? It looks like a problem on getClipboardRepresentation
when calling flushToDOM
here:
https://github.com/aframevr/aframe-inspector/blob/master/src/actions/entity.js#L144
I've just updated to the latest aframe in the example and it seems to fix some of the issues, or at least modify the error :)
So far it works on entities that doesn't have maps, but in the ones that have maps like a-box
or floor
it throws:
aframe.min.js:275 Uncaught TypeError: Cannot read property 'systems' of undefined
at Object.module.exports.updateMap (aframe.min.js:275)
at t.init (aframe.min.js:240)
at i.updateShader (aframe.min.js:79)
at i.update (aframe.min.js:79)
at i.updateProperties (aframe.min.js:145)
at HTMLElement.value (aframe.min.js:137)
at HTMLElement.value (aframe.min.js:137)
at HTMLElement.value (aframe.min.js:137)
at HTMLElement.value (aframe.min.js:143)
at HTMLElement.value (aframe.min.js:143)
This one is trickier than I thought and I'm a bit surprised we did not see the problem before. The issue is that updateMap
relies on sceneEl
being available. The Copy Entity HTML to Clipboard
feature clones the selected entity to avoid undesired modifications and manipulates it to remove default and mixed in values. The cloned entity is not part of a-scene
so updateMap
does not find the reference it needs. The problem is that updateMap
is invoked from the update
method which should not ever be called for a not yet loaded entity. I have to investigate a bit more to figure out a proper solution.
I fixed this on https://github.com/aframevr/aframe/pull/2250. Try https://aframe.io/aframe/dist/aframe-master.js and close the issue if the bug is gone.
Firing the copy for the <a-box>
element with the new aframe master causes a
el.sceneEl is undefined
in aframe's updateMap
and the <a-scene>
element throws:
TypeError: el.getAttribute(...) is null aframe-inspector.js:37000:12
removeDefaultAttributes http://0.0.0.0:3333/dist/aframe-inspector.js:37000:12
getClipboardRepresentation http://0.0.0.0:3333/dist/aframe-inspector.js:36985:4
text http://0.0.0.0:3333/dist/aframe-inspector.js:39532:20
onClick http://0.0.0.0:3333/dist/aframe-inspector.js:38782:28
listenClick/this.listener< http://0.0.0.0:3333/dist/aframe-inspector.js:38767:29
listener/< http://0.0.0.0:3333/dist/aframe-inspector.js:39400:14
I'll dig more into this later
@jsantell <a-box>
is working for me.
There's another problem with <a-scene>
that https://github.com/aframevr/aframe-inspector/pull/418 fixes
I believe everything should be working now.
@jsantell it's working here too, the problem was that it was an error deploying the latest aframe-master.js
now it's deployed correctly and it fixes the issue.
Reopen. It seems that this feature is broken again.
Steps to reproduce:
floor
entity and copy to clipboardThe obtained result is:
<a-entity id="floor" geometry="mergeTo:null;primitive:cylinder;height:0.2;radius:12" material="repeat:[object Object];color:#fafafa;metalness:0.2;normalScale:{"x":1,"y":1};roughness:0.1;src:assets/textures/grasslight-big.jpg"></a-entity>
Material is not properly serialized material="repeat:[object Object];color:#fafafa;metalness:0.2;normalScale:{"x":1,"y":1};roughness:0.1;src:assets/textures/grasslight-big.jpg"
repeat should be repeat: 1 1
and normalScale normalScale: 1 1
It seems that https://github.com/aframevr/aframe/pull/2357 fixed the [object object]
issue, but the "
is still there:
<a-entity id="floor" geometry="mergeTo:null;primitive:cylinder;height:0.2;radius:12" material="repeat:50 20;color:#fafafa;metalness:0.2;normalScale:{"x":1,"y":1};roughness:0.1;src:https://aframe.io/sample-assets/assets/images/terrain/grasslight-big.jpg"></a-entity>
/cc @dmarcos @delapuente
I've just noticed that if you click on an entity and modify the common attributes position
, rotation
and/or scale
they won't appear on the clipboard representation :\
I'll take a look.
mchen [12:55 PM]
with latest inspector, when i create an entity then click the button to copy entity HTML to clipboard, position and scale are not coming across (rotation either, but here I didn't change)... and a few unchanged / superfluous properties are included (mergeTo, normalScale)
<a-entity position="" scale="" id="endtable" geometry="mergeTo:null;depth:10;height:0.1;width:10" material="opacity:0.5;normalScale:{"x":1,"y":1}"></a-entity>
That's the expected behaviour since you are representing double quotes inside double quotes. Try this code to check:
var html = '<a-entity position="" scale="" id="endtable" geometry="mergeTo:null;depth:10;height:0.1;width:10" material="opacity:0.5;normalScale:{"x":1,"y":1}"></a-entity>';
var container = document.createElement('div');
container.innerHTML = html;
var entity = container.querySelector('a-entity');
console.log(entity.getAttribute('material')) // outputs opacity:0.5;normalScale:{"x":1,"y":1}
Problem is that normal scale should not be represented that way if it is an A-Frame vec2
type. Let's keep this bug as solved and see what happens in A-Frame.
no, big problem in that case was actually that position and scale were not correctly included in export, and that mergeTo and normalScale were default so should have been absent
Noted. That's a different problem. Let's open another bug for that.
Closing this. Follow up issues https://github.com/aframevr/aframe-inspector/issues/453 and https://github.com/aframevr/aframe-inspector/issues/452
Haven't dug in why it's only some entities that throw errors, but in the built in example (and some entities in my own scenes and the aframe examples), a few entities throw when copying:
<a-scene />
<a-box />
Have also seen errors with
addEventListener
andremoveChild
when attempting to copy, but on other entities it works fine.