Comments (9)
For your single mixin feature, you should just keep your workaround, that's fine. It indeed force it to remove the gltf-model component and create another one.
from aframe-inspector.
PR #696 fixes the issue.
For UI parts that are not updated, I created another issue #697 and #698.
from aframe-inspector.
@3DStreet sponsored me to work on this issue. Thank you! c-frame/sponsorship#3
from aframe-inspector.
aframevr/aframe#2823 is probably related to this issue.
from aframe-inspector.
Removing the mixin is removing the gltf-model component but you don't see it disappears in the right panel (that's another issue, a forceUpdate is missing on the ComponentsContainer React component for the entityupdate event with component "mixin"), you can select another entity and select the previous entity back to see it. Another issue is the UI is not updating with the mixin name at the top of the right panel and in the left panel when you add or remove a mixin.
When you add the mixin back, it adds the gltf-model component again. That's why your workaround work.
I see in the DOM that when gltf-model is set with a mixin, that gltf-model (empty) is shown.
If I set a gltf-model component with an url on an entity without mixin, the DOM shows the gltf-model="theurl"
The main issue I think may be that gltf-model="" appears in the DOM.
I don't know at this point if this is something we can fix in aframe, related to mixin, to not show components in DOM so that native cloneNode(true)
api works correctly, or if we'll need workaround like you did after cloning. I need to dig this further.
Also currently in the right panel we don't visualize that a component is coming from a mixin and that removing a mixin will remove associated components.
from aframe-inspector.
You said that you reproduce the issue sometimes, but not always. I reproduce it every time. Maybe you don't reproduce it when the gltf-model component is really set on the entity, overriding the mixin, even if it's the same url, you can see it in with Chrome inspector, if you see the url, then the gltf-model component is set directly and duplicating the entity will show the model.
from aframe-inspector.
Some other notes:
In the DOM it shows
<a-entity position="0 0 -9" mixin="fire-truck-rig" gltf-model=""></a-entity>
or
<a-entity position="0 0 -9" mixin="fire-truck-rig" gltf-model="thesameurlasmixin"></a-entity>
if you touched the url via the right panel
If you use "copy entity HTML to clipboard" button, you get
<a-entity position="0 0 -9" mixin="fire-truck-rig"></a-entity>
from aframe-inspector.
@kfarr Looking at getEntityClipboardRepresentation
function that is used for the "copy entity HTML to clipboard" feature, that is using prepareForSerialization
and optimizeComponents
functions
aframe-inspector/src/lib/entity.js
Lines 157 to 219 in 72fd461
it does all the logic of removing attributes if it's inherited from mixin (so the gltf-model component).
The function documentation is exactly this: "Removes from copy those components or components' properties that comes from
primitive attributes, mixins, injected default components or schema defaults."
It actually does a clone of each child one by one and getting the outerHTML of the clone.
I think for the duplicate feature we should really just change the line
const clone = entity.cloneNode(true);
by
const clone = prepareForSerialization(entity);
This solves the issue completely.
from aframe-inspector.
confirming this works as expected for me, can close once @dmarcos merges #696
from aframe-inspector.
Related Issues (20)
- Regressions to fix after the React upgrade HOT 3
- Remaining style issues with tailwindcss in the site HOT 2
- Update hosted examples HOT 3
- Copy component values to clipboard wrong
- Error "Cannot use 'in' operator to search" throwed after click in some elements HOT 4
- suggestion: remove texture dialog HOT 1
- Crashes when physics object selected HOT 4
- History lib doesn't account for some types of changes HOT 1
- Selecting an entity and pressing escape to unselect gives an error HOT 1
- flushtodom() called during inspector session outputs old values (values prior to inspector changes) HOT 7
- Cloning an entity with animation animates, it shouldn't HOT 2
- Use icons from @fortawesome/react-fontawesome
- [feature request] Browse/edit model sub-meshes and their materials HOT 1
- Using mapped properties in primitive give an error when selecting the entity HOT 1
- Removing and adding mixin doesn't update the UI properly
- Visualize that a component is coming from a mixin HOT 1
- TypeError: Cannot read properties of undefined (reading 'schemaChange') HOT 4
- Global variable to serve texture assets locally
- Avoid having NaN in position field if you type a letter inadvertently HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from aframe-inspector.