refactor(startup): auto acceptor on item add to
This commit is contained in:
@@ -105,6 +105,17 @@ impl Item {
|
||||
ui.handle_create_item(&item);
|
||||
}
|
||||
let _ = node.item.set(item.clone());
|
||||
|
||||
if let Some(auto_acceptor) = node.get_client().and_then(|client| {
|
||||
client
|
||||
.startup_settings
|
||||
.as_ref()
|
||||
.and_then(|settings| settings.acceptors.get(type_info))
|
||||
.and_then(|acceptor| acceptor.upgrade())
|
||||
}) {
|
||||
capture(&item, &auto_acceptor);
|
||||
}
|
||||
|
||||
item
|
||||
}
|
||||
fn make_alias_named(
|
||||
|
||||
@@ -21,7 +21,16 @@ impl Root {
|
||||
node.add_local_signal("subscribe_logic_step", Root::subscribe_logic_step);
|
||||
node.add_local_signal("set_base_prefixes", Root::set_base_prefixes);
|
||||
let node = node.add_to_scenegraph();
|
||||
let _ = Spatial::add_to(&node, None, Mat4::IDENTITY, false);
|
||||
let _ = Spatial::add_to(
|
||||
&node,
|
||||
None,
|
||||
client
|
||||
.startup_settings
|
||||
.as_ref()
|
||||
.map(|settings| settings.transform)
|
||||
.unwrap_or(Mat4::IDENTITY),
|
||||
false,
|
||||
);
|
||||
|
||||
ROOT_REGISTRY.add(Root {
|
||||
node,
|
||||
@@ -29,10 +38,6 @@ impl Root {
|
||||
})
|
||||
}
|
||||
|
||||
pub fn spatial(&self) -> &Arc<Spatial> {
|
||||
self.node.spatial.get().unwrap()
|
||||
}
|
||||
|
||||
fn subscribe_logic_step(_node: &Node, calling_client: Arc<Client>, _data: &[u8]) -> Result<()> {
|
||||
calling_client
|
||||
.root
|
||||
|
||||
Reference in New Issue
Block a user