Skip to content

Material assets support: property widget, materials modal, asset deletion#859

Open
vincentfretin wants to merge 6 commits into
aframevr:masterfrom
vincentfretin:material-property-type
Open

Material assets support: property widget, materials modal, asset deletion#859
vincentfretin wants to merge 6 commits into
aframevr:masterfrom
vincentfretin:material-property-type

Conversation

@vincentfretin

@vincentfretin vincentfretin commented Jul 4, 2026

Copy link
Copy Markdown
Contributor

Description

Companion to aframevr/aframe#5846 (materials as assets and property type).

Material property widget

The new material property type references an <a-material> asset by selector (#myMaterial) or an inline material(...) definition, and its parsed value is a THREE.Material. Without these changes, the property fell through to the generic InputWidget, which parses and commits on every keystroke — typing a partial selector like #crate immediately committed a null material and detached the entity from its shared material while typing.

The property is now rendered by a dedicated MaterialWidget: the raw reference string committed on blur (like selector/selectorAll), plus a swatch previewing the referenced material's color/texture.

Material Assets modal (picker + live editor)

Clicking the swatch opens a Material Assets modal that:

  • lists every <a-material> in the scene with a color/texture swatch,
  • applies the selected asset to the property (USE SELECTED button or double-click),
  • edits the selected material's properties with schema-driven widgets (base material + shader schema, shader shown read-only since it cannot change after creation) — edits apply live to every entity sharing the material; map properties use the texture picker, stacked on top of the materials modal (Modal is now stacking-aware: only the topmost open modal reacts to ESC/outside clicks),
  • creates new <a-material> assets under <a-assets> (NEW MATERIAL button),
  • deletes the selected material asset (DELETE button, disabled for inline materials; the confirmation mentions how many entities use the material).

The textures modal also gets a trash button on each asset image to remove it from <a-assets>.

The example scene includes two shared <a-material> assets, an inline definition, and entities using them (requires an A-Frame build with aframevr/aframe#5846; with older builds these entities render with a default material and a warning).

Verified against an aframe build of the PR branch: picking switches the entity's shared material (textures included), editing roughness/color in the modal updates all entities sharing the material live, the reset button returns the entity to its own component-managed material, and typing partial selectors no longer detaches the material.

🤖 Generated with Claude Code

vincentfretin and others added 5 commits July 4, 2026 10:21
A-Frame's upcoming `material` property type (aframevr/aframe#5846)
references an <a-material> asset by selector (`#myMaterial`) or an
inline `material(...)` definition. Edit it as a raw string committed on
blur, like selector/selectorAll: committing on each keystroke would
parse partial selectors and detach the entity from its shared material
while typing.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Two <a-material> assets (PBR and textured) shared across entities, plus
an inline material(...) definition, to test the material property type.
Requires an A-Frame build with aframevr/aframe#5846; with older builds
these entities render with a default material and a warning.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The material property type now renders a MaterialWidget: the reference
string (committed on blur) plus a swatch previewing the referenced
material's color/texture. Clicking the swatch opens a Material Assets
modal that:

- lists every <a-material> in the scene with a color/texture swatch,
- applies the selected asset to the property (USE SELECTED or
  double-click),
- edits the selected material's properties (schema-driven widgets,
  shader read-only) live for every entity sharing it,
- creates new <a-material> assets under <a-assets>.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
When the material component's `material` property references an
<a-material> asset, all other properties are ignored (the asset fully
defines the material), so only show the material property row. Also
prevent text selection when double-clicking a material in the modal
gallery to apply it.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Map-type properties of an <a-material> now use TextureWidget, opening
the textures modal stacked on top of the materials modal. Modal gains
stacking awareness: only the topmost open modal reacts to ESC and
outside clicks, so interacting with the textures modal no longer
closes the materials modal beneath it. ModalTextures is rendered after
ModalMaterials so it paints on top, and material swatches refresh when
textures finish loading.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@vincentfretin

Copy link
Copy Markdown
Contributor Author
Capture d’écran du 2026-07-04 11-10-53 Capture d’écran du 2026-07-04 11-11-25

DELETE button in the materials modal (disabled for inline materials,
confirmation mentions how many entities use the material) and a trash
button on each asset image in the textures modal.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@vincentfretin vincentfretin changed the title Treat the material property type like selector types Material assets support: property widget, materials modal, asset deletion Jul 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant