aframevr / aframevr/aframe

a-cubemap as asset in component

Open
#4,269 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
17.6k
Forks
4.4k
PR merge metrics
No merged PRs in 30d

Description

Description:

  • A-Frame Version: 0.9.2 (Date 2019-05-06, Commit #f57a1fa)
  • Platform / Device: all
  • Reproducible Code Snippet or URL:

When defining a schema type as asset and providing the id of an a-cubemap the asset in the component is null.

Expected:
Expected a node that I could use .srcs and get the cubemap images.

What I've figured out so far.

Updating the assetParse function to include A-CUBEMAP would pass the el through as expected.
https://github.com/aframevr/aframe/blob/f863f01206a25951eb39b389ae7031885153143a/src/core/propertyTypes.js#L90

if (value.charAt(0) === '#') {
    el = document.getElementById(value.substring(1));
    if (el) {
      // Pass through media elements. If we have the elements, we don't have to call
      // three.js loaders which would re-request the assets.
      if (el.tagName === 'CANVAS' || el.tagName === 'VIDEO' || el.tagName === 'IMG' || el.tagName === 'A-CUBEMAP') {
        return el;
      }
      return el.getAttribute('src');
    }
    warn('"' + value + '" asset not found.');
    return;
  }

If there is no specific reason why not to do this, then I will fork and do a pr

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in src/core/propertyTypes.js at the assetParse function and review how an asset reference is resolved for an a-cubemap element. Reproduce the reported schema case and verify that resolving its id returns the a-cubemap node, including its usable srcs property.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, three.js
Domain
computer-graphics, frontend
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.