Okay, i've looked at the macros and their output quite a bit, and i can understand why this is so difficult.
The call to SceneComponent::scene() or scenefn() happens directly while the macro is being called, inside a block.
{
(
scene_function(),
Foo::patch(move |value, _context| {
value.entity = EntityTemplate::ScopedEntityIndex(
ScopedEntityIndex {
scope: _context.current_entity_scope(),
index: 0usize,
},
);
}),
)
}
This means all it does is add a template patch to be called with context later to the list of scene items. The way EntityTemplate handles this is by resolving during the time templates are applied.
I think a "solution" to this might actually be a compromise between making it as easy to use as it could be, somehow getting the #Name resolved to Entity before the scene call, and the current stat of it being impossible: By providing tools for impl Scene functions to take not the Entity itself, but something that can expand to it later. The main difficutly here, i would think, is that whichever this new NamedEntity (just my idea for a name) or whatever is, it would have to somehow store the context of the outer scene.