drecom / drecom/scene-graph-mediator-rt
Identify nodes which have same name
- Dominant language
- JavaScript
- Stars
- 0
- Forks
- 0
- PR merge metrics
- No merged PRs in 30d
Description
# Summary
Shorthand for accessing nodes with the same name would be preferred.
For instance, scene graph with structure as below has nodes with the same name under duplicated slot nodes.
```
Scene
|- Slot1
| |- icon
| - text
|- Slot2
| |- icon
| - text
- Slot3
|- icon
- text
```
User may want to access `Scene/Slot2/icon` but currently there is no smart way to access to it directly.
# Ideas
__NOTE__
- Solve https://github.com/drecom/scene-graph-mediator-rt/issues/1 first.
- Refactor before mass-producing callback properties.
- See PIXI.js importer, its too much even now
- onAddLoaderAsset
- onRestoreNode
- onPixiObjectCreated
- name is __NOT__ an ID
## A. Extend current design
### Interface
```
importer.accessOnComplete('id', (entity) => {
entity.doSome();
});
importer.accessByNamesOnComplete(['Scene', 'Slot2', 'icon'], (entities) => {
entities[0].doSome();
});
```
### Accessor with name(s)
Map objects to avoid iteration overhead.
Present tree as array contains names, objects as array since names can be duplicated.
```
[
{
path: ['Scene', 'Slot1', 'icon'],
objects: [Scene.Slot1.icon]
},
{
path: ['Scene', 'Slot2', 'icon'],
objects: [Scene.Slot2.icon]
},
]
```
## B. New feature for cli
Present additional preference for runtime importer.
Features below are just idea.
All of them requires Editor extension or specific component, so well consider before try any of them.
- Unity-like Serialized Field
- Explicit id setter
Contributor guide
No contributing guide indexed for this repository
Research direction
Resolve issue #1 first, then inspect the current importer access API and the PIXI.js importer callbacks named in this issue. Compare the proposed accessOnComplete and accessByNamesOnComplete approaches, keeping names distinct from IDs. Done means the chosen design can directly reach Scene/Slot2/icon while handling duplicate names.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- game-dev
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100