Repositioning
This commit is contained in:
16
Cargo.lock
generated
16
Cargo.lock
generated
@@ -66,12 +66,6 @@ dependencies = [
|
|||||||
"serde_derive",
|
"serde_derive",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "anyhow"
|
|
||||||
version = "1.0.68"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "2cb2f989d18dd141ab8ae82f64d1a8cdd37e0840f73a406896cf5e99502fab61"
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "arrayref"
|
name = "arrayref"
|
||||||
version = "0.3.6"
|
version = "0.3.6"
|
||||||
@@ -1976,11 +1970,11 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "stardust-xr-fusion"
|
name = "stardust-xr-fusion"
|
||||||
version = "0.38.0"
|
version = "0.38.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "b7f6c2945a8246880297b1f059e48a8eeb6ba39c58f67e83c05725b86f869149"
|
checksum = "45a0a1ee96c4be1d4866e1920feb4fb732b810a6cc2e9f7eeff66f07f9c2f496"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"color-eyre",
|
||||||
"color-rs",
|
"color-rs",
|
||||||
"enum_dispatch",
|
"enum_dispatch",
|
||||||
"flagset",
|
"flagset",
|
||||||
@@ -1999,9 +1993,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "stardust-xr-molecules"
|
name = "stardust-xr-molecules"
|
||||||
version = "0.21.0"
|
version = "0.21.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "2ae6569520bc27bd6fc015e4e0a687bb730631dc039bb5c5c14c2ad40457cfac"
|
checksum = "4c16d448b75aff896519f94910a525bf5588a53cf54d5256a7eef05f604ffce4"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"color-rs",
|
"color-rs",
|
||||||
"glam 0.23.0",
|
"glam 0.23.0",
|
||||||
|
|||||||
@@ -19,8 +19,8 @@ mint = "0.5.9"
|
|||||||
nix = "0.26.1"
|
nix = "0.26.1"
|
||||||
resvg = "0.29.0"
|
resvg = "0.29.0"
|
||||||
rustc-hash = "1.1.0"
|
rustc-hash = "1.1.0"
|
||||||
stardust-xr-fusion = "0.38.0"
|
stardust-xr-fusion = "0.38.1"
|
||||||
stardust-xr-molecules = "0.21.0"
|
stardust-xr-molecules = "0.21.1"
|
||||||
tokio = { version = "1.24.1", features = ["full"] }
|
tokio = { version = "1.24.1", features = ["full"] }
|
||||||
tracing-subscriber = { version = "0.3.16", features = ["env-filter"] }
|
tracing-subscriber = { version = "0.3.16", features = ["env-filter"] }
|
||||||
tween = "2.0.0"
|
tween = "2.0.0"
|
||||||
|
|||||||
@@ -95,7 +95,7 @@ impl App {
|
|||||||
text_align: Alignment::XCenter | Alignment::YCenter,
|
text_align: Alignment::XCenter | Alignment::YCenter,
|
||||||
..Default::default()
|
..Default::default()
|
||||||
};
|
};
|
||||||
let protostar = ProtoStar::create_from_desktop_file(parent, desktop_file.clone()).ok()?;
|
let protostar = ProtoStar::create_from_desktop_file(parent, position, desktop_file.clone()).ok()?;
|
||||||
let text = Text::create(
|
let text = Text::create(
|
||||||
protostar.content_parent(),
|
protostar.content_parent(),
|
||||||
Transform::from_position_rotation(
|
Transform::from_position_rotation(
|
||||||
@@ -106,10 +106,6 @@ impl App {
|
|||||||
style,
|
style,
|
||||||
)
|
)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
protostar
|
|
||||||
.content_parent()
|
|
||||||
.set_position(None, position)
|
|
||||||
.unwrap();
|
|
||||||
Some(App {
|
Some(App {
|
||||||
_text: text,
|
_text: text,
|
||||||
_desktop_file: desktop_file,
|
_desktop_file: desktop_file,
|
||||||
|
|||||||
@@ -155,10 +155,6 @@ impl App {
|
|||||||
style,
|
style,
|
||||||
)
|
)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
protostar
|
|
||||||
.content_parent()
|
|
||||||
.set_position(None, position)
|
|
||||||
.unwrap();
|
|
||||||
Some(App {
|
Some(App {
|
||||||
_text: text,
|
_text: text,
|
||||||
_desktop_file: desktop_file,
|
_desktop_file: desktop_file,
|
||||||
|
|||||||
@@ -104,7 +104,7 @@ impl ProtoStar {
|
|||||||
)?;
|
)?;
|
||||||
let grabbable = Grabbable::new(
|
let grabbable = Grabbable::new(
|
||||||
parent,
|
parent,
|
||||||
Transform::default(),
|
Transform::from_position(position),
|
||||||
&field,
|
&field,
|
||||||
GrabData {
|
GrabData {
|
||||||
max_distance: 0.01,
|
max_distance: 0.01,
|
||||||
@@ -151,6 +151,9 @@ impl RootHandler for ProtoStar {
|
|||||||
} else {
|
} else {
|
||||||
self.icon_grow = Some(Tweener::quart_in_out(0.0001, 0.03, 0.25)); //TODO make the scale a parameter
|
self.icon_grow = Some(Tweener::quart_in_out(0.0001, 0.03, 0.25)); //TODO make the scale a parameter
|
||||||
self.icon_shrink = None;
|
self.icon_shrink = None;
|
||||||
|
self.grabbable.content_parent().set_position(Some(self.client.get_root()) , self.position).unwrap();
|
||||||
|
self.grabbable.content_parent().set_rotation(Some(self.client.get_root()), Quat::default()).unwrap();
|
||||||
|
self.icon.set_rotation(None, Quat::from_rotation_x(PI / 2.0) * Quat::from_rotation_y(PI) ).unwrap();
|
||||||
}
|
}
|
||||||
} else if let Some(icon_grow) = &mut self.icon_grow {
|
} else if let Some(icon_grow) = &mut self.icon_grow {
|
||||||
if !icon_grow.is_finished() {
|
if !icon_grow.is_finished() {
|
||||||
@@ -159,8 +162,6 @@ impl RootHandler for ProtoStar {
|
|||||||
.set_scale(None, Vector3::from([scale; 3]))
|
.set_scale(None, Vector3::from([scale; 3]))
|
||||||
.unwrap();
|
.unwrap();
|
||||||
} else {
|
} else {
|
||||||
self.icon.set_position(None, [0.0,0.0,0.0]).unwrap();
|
|
||||||
self.icon.set_rotation(None, Quat::from_rotation_x(PI / 2.0) * Quat::from_rotation_y(PI) ).unwrap();
|
|
||||||
self.icon_grow = None;
|
self.icon_grow = None;
|
||||||
}
|
}
|
||||||
}else if self.grabbable.grab_action().actor_stopped() {
|
}else if self.grabbable.grab_action().actor_stopped() {
|
||||||
@@ -179,22 +180,31 @@ impl RootHandler for ProtoStar {
|
|||||||
.set_root(self.grabbable.content_parent())
|
.set_root(self.grabbable.content_parent())
|
||||||
.unwrap();
|
.unwrap();
|
||||||
self.icon_shrink = Some(Tweener::quart_in_out(0.03, 0.0001, 0.25)); //TODO make the scale a parameter
|
self.icon_shrink = Some(Tweener::quart_in_out(0.03, 0.0001, 0.25)); //TODO make the scale a parameter
|
||||||
let future = startup_settings.generate_startup_token().unwrap();
|
let distance_future = self.grabbable.content_parent().get_position_rotation_scale(self.client.get_root()).unwrap();
|
||||||
|
|
||||||
let executable = dbg!(self.execute_command.clone());
|
let executable = dbg!(self.execute_command.clone());
|
||||||
|
|
||||||
//TODO: split the executable string for the args
|
//TODO: split the executable string for the args
|
||||||
tokio::task::spawn(async move {
|
tokio::task::spawn(async move {
|
||||||
std::env::set_var("STARDUST_STARTUP_TOKEN", future.await.unwrap());
|
let distance_vector = distance_future.await.ok().unwrap().0;
|
||||||
unsafe {
|
let distance = distance_vector.x.abs() + distance_vector.y.abs() + distance_vector.z.abs();
|
||||||
Command::new(executable)
|
if dbg!(distance) > 1.0 {
|
||||||
.stdin(Stdio::null())
|
let future = startup_settings.generate_startup_token().unwrap();
|
||||||
.stdout(Stdio::null())
|
|
||||||
.stderr(Stdio::null())
|
std::env::set_var("STARDUST_STARTUP_TOKEN", future.await.unwrap());
|
||||||
.pre_exec(|| {
|
|
||||||
_ = setsid();
|
unsafe {
|
||||||
Ok(())
|
Command::new(executable)
|
||||||
})
|
.stdin(Stdio::null())
|
||||||
.spawn()
|
.stdout(Stdio::null())
|
||||||
.expect("Failed to start child process")
|
.stderr(Stdio::null())
|
||||||
|
.pre_exec(|| {
|
||||||
|
_ = setsid();
|
||||||
|
Ok(())
|
||||||
|
})
|
||||||
|
.spawn()
|
||||||
|
.expect("Failed to start child process");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user