small style changes

This commit is contained in:
Cassandra de la Cruz-Munoz 2024-01-01 12:32:38 -05:00
parent c1d21415ba
commit c3193e2fbc
Signed by: cassdlcm
GPG Key ID: BFEBACEA812DDA70

View File

@ -567,8 +567,7 @@ impl VmcExtBlendVal {
pub fn new_vmc_message(name: String, value: f32) -> Result<Box<dyn VmcMessage>, MessageCreationErr> {
let message = Self::new(name, value);
if message.is_ok() {
let boxed_result = Box::new(message.ok().unwrap());
return Ok(boxed_result);
return Ok(Box::new(message.ok().unwrap()));
}
return Err(message.err().unwrap());
}
@ -643,12 +642,11 @@ impl VmcMessage for VmcExtCam {
OscType::Float(f) => fov = f,
_ => return Err(FromMessageErr::ArgType(ArgTypeErr { expected: vec![OscType::Float(0.0)], actual: msg.args[8].to_owned(), addr: msg.addr, arg_count: 8})),
}
let boxed_result = Box::new(VmcExtCam {
return Ok(Box::new(Self {
name,
transform: Transform3D::new(Basis::from_quat(quat), origin),
fov,
});
return Ok(boxed_result);
}));
}
fn get_addr(&self) -> String {
return String::from("/VMC/Ext/Cam");
@ -662,8 +660,7 @@ impl VmcExtCam {
pub fn new_vmc_message(name: String, transform: Transform3D, fov: f32) -> Result<Box<dyn VmcMessage>, MessageCreationErr> {
let message = Self::new(name, transform, fov);
if message.is_ok() {
let boxed_result = Box::new(message.ok().unwrap());
return Ok(boxed_result);
return Ok(Box::new(message.ok().unwrap()));
}
return Err(message.err().unwrap());
}
@ -836,12 +833,11 @@ impl VmcMessage for VmcExtKey {
OscType::Int(i) => keycode = i,
_ => return Err(FromMessageErr::ArgType(ArgTypeErr { expected: vec![OscType::Int(0)], actual: msg.args[2].to_owned(), addr: msg.addr, arg_count: 2})),
}
let boxed_result = Box::new(VmcExtKey {
return Ok(Box::new(Self {
active,
name,
keycode,
});
return Ok(boxed_result);
}));
}
fn get_addr(&self) -> String {
return String::from("/VMC/Ext/Key");
@ -906,13 +902,12 @@ impl VmcMessage for VmcExtMidiNote {
OscType::Float(f) => velocity = f,
_ => return Err(FromMessageErr::ArgType(ArgTypeErr { expected: vec![OscType::Float(0.0)], actual: msg.args[3].to_owned(), addr: msg.addr, arg_count: 3})),
}
let boxed_result = Box::new(VmcExtMidiNote {
return Ok(Box::new(Self {
active,
channel,
note,
velocity,
});
return Ok(boxed_result);
}));
}
fn get_addr(&self) -> String {
return String::from("/VMC/Ext/Midi/Note");
@ -946,8 +941,7 @@ impl VmcMessage for VmcExtMidiCcVal {
OscType::Float(f) => value = f,
_ => return Err(FromMessageErr::ArgType(ArgTypeErr { expected: vec![OscType::Float(0.0)], actual: msg.args[1].to_owned(), addr: msg.addr, arg_count: 1})),
}
let boxed_result = Box::new(VmcExtMidiCcVal { knob, value });
return Ok(boxed_result);
return Ok(Box::new(Self { knob, value }));
}
fn get_addr(&self) -> String {
return String::from("/VMC/Ext/Midi/CC/Val");
@ -995,8 +989,7 @@ impl VmcMessage for VmcExtMidiCcBit {
}
_ => return Err(FromMessageErr::ArgType(ArgTypeErr { expected: vec![OscType::Int(0)], actual: msg.args[1].to_owned(), addr: msg.addr, arg_count: 1})),
}
let boxed_result = Box::new(VmcExtMidiCcBit { knob, active });
return Ok(boxed_result);
return Ok(Box::new(Self { knob, active }));
}
fn get_addr(&self) -> String {
return String::from("/VMC/Ext/Midi/CC/Bit");
@ -1066,12 +1059,11 @@ impl VmcMessage for DeviceTranform {
OscType::Float(f) => quat.w = f,
_ => return Err(FromMessageErr::ArgType(ArgTypeErr { expected: vec![OscType::Float(0.0)], actual: msg.args[7].to_owned(), addr: msg.addr, arg_count: 7})),
}
let boxed_result = Box::new(DeviceTranform {
return Ok(Box::new(Self {
addr: msg.addr.to_owned(),
serial,
transform: Transform3D::new(Basis::from_quat(quat), origin),
});
return Ok(boxed_result);
}));
}
fn get_addr(&self) -> String {
return self.addr.to_owned();
@ -1137,12 +1129,11 @@ impl VmcMessage for VmcExtRvc {
_ => return Err(FromMessageErr::ArgType(ArgTypeErr { expected: vec![OscType::String(String::new())], actual: msg.args[2].to_owned(), addr: msg.addr, arg_count: 2})),
}
}
let boxed_result = Box::new(VmcExtRvc {
return Ok(Box::new(Self {
enable,
port,
ip_addr,
});
return Ok(boxed_result);
}));
}
fn get_addr(&self) -> String {
return String::from("/VMC/Ext/Rvc");
@ -1233,12 +1224,11 @@ impl VmcMessage for VmcExtLight {
OscType::Float(f) => color.a = f,
_ => return Err(FromMessageErr::ArgType(ArgTypeErr { expected: vec![OscType::Float(0.0)], actual: msg.args[11].to_owned(), addr: msg.addr, arg_count: 11})),
}
let boxed_result = Box::new(VmcExtLight {
return Ok(Box::new(Self {
name,
transform: Transform3D::new(Basis::from_quat(quat), origin),
color,
});
return Ok(boxed_result);
}));
}
fn get_addr(&self) -> String {
return String::from("/VMC/Ext/Light");
@ -1287,8 +1277,7 @@ impl VmcMessage for VmcExtVrm {
_ => return Err(FromMessageErr::ArgType(ArgTypeErr { expected: vec![OscType::String(String::new())], actual: msg.args[2].to_owned(), addr: msg.addr, arg_count: 2})),
}
}
let boxed_result = Box::new(VmcExtVrm { path, title, hash });
return Ok(boxed_result);
return Ok(Box::new(Self { path, title, hash }));
}
fn get_addr(&self) -> String {
return String::from("/Vmc/Ext/VRM");
@ -1325,8 +1314,7 @@ impl VmcMessage for VmcExtRemote {
OscType::String(s) => json = s.to_owned(),
_ => return Err(FromMessageErr::ArgType(ArgTypeErr { expected: vec![OscType::String(String::new())], actual: msg.args[1].to_owned(), addr: msg.addr, arg_count: 1})),
}
let boxed_result = Box::new(VmcExtRemote{ service, json });
return Ok(boxed_result);
return Ok(Box::new(Self{ service, json }));
}
fn get_addr(&self) -> String {
return String::from("/VMC/Ext/Remote");
@ -1356,8 +1344,7 @@ impl VmcMessage for VmcExtOpt {
_ => return Err(FromMessageErr::ArgType(ArgTypeErr { expected: vec![OscType::String(String::new())], actual: msg.args[0].to_owned(), addr: msg.addr, arg_count: 0})),
}
let boxed_result = Box::new(VmcExtOpt{option});
return Ok(boxed_result);
return Ok(Box::new(Self{option}));
}
fn get_addr(&self) -> String {
return String::from("/VMC/Ext/Opt");
@ -1402,8 +1389,7 @@ impl VmcMessage for VmcExtSettingColor {
OscType::Float(f) => color.a = f,
_ => return Err(FromMessageErr::ArgType(ArgTypeErr { expected: vec![OscType::Float(0.0)], actual: msg.args[3].to_owned(), addr: msg.addr, arg_count: 3})),
}
let boxed_result = Box::new(VmcExtSettingColor{color});
return Ok(boxed_result);
return Ok(Box::new(Self{color}));
}
fn get_addr(&self) -> String {
return String::from("/VMC/Ext/Setting/Color");
@ -1478,8 +1464,7 @@ impl VmcMessage for VmcExtSettingWin {
OscType::Int(i) => result.hide_border = i,
_ => return Err(FromMessageErr::ArgType(ArgTypeErr { expected: vec![OscType::Int(0)], actual: msg.args[3].to_owned(), addr: msg.addr, arg_count: 3})),
}
let boxed_result = Box::new(result);
return Ok(boxed_result);
return Ok(Box::new(result));
}
fn get_addr(&self) -> String {
return String::from("/VMC/Ext/Setting/Win");
@ -1507,8 +1492,7 @@ impl VmcMessage for VmcExtConfig {
OscType::String(s) => path = s.to_owned(),
_ => return Err(FromMessageErr::ArgType(ArgTypeErr { expected: vec![OscType::String(String::new())], actual: msg.args[0].to_owned(), addr: msg.addr, arg_count: 0})),
}
let boxed_result = Box::new(VmcExtConfig{path});
return Ok(boxed_result);
return Ok(Box::new(Self{path}));
}
fn get_addr(&self) -> String {
return String::from("/VMC/Ext/Config");
@ -1557,8 +1541,7 @@ impl VmcMessage for VmcThru {
_ => return Err(FromMessageErr::ArgType(ArgTypeErr { expected: vec![OscType::Int(0), OscType::Float(0.0)], actual: msg.args[1].to_owned(), addr: msg.addr, arg_count: 1}))
}
}
let boxed_result = Box::new(VmcThru { addr: msg.addr, arg1 , arg2 });
return Ok(boxed_result);
return Ok(Box::new(Self { addr: msg.addr, arg1 , arg2 }));
}
fn get_addr(&self) -> String {
return self.addr.to_owned();
@ -1620,8 +1603,7 @@ impl VmcMessage for VmcExtSetPeriod {
OscType::Int(i) => devices = i,
_ => return Err(FromMessageErr::ArgType(ArgTypeErr { expected: vec![OscType::Int(0)], actual: msg.args[5].to_owned(), addr: msg.addr, arg_count: 5}))
}
let boxed_result = Box::new(VmcExtSetPeriod { status, root, bone, blendshape, camera, devices});
return Ok(boxed_result);
return Ok(Box::new(Self { status, root, bone, blendshape, camera, devices}));
}
fn get_addr(&self) -> String {
return String::from("/VMC/Ext/Set/Period");
@ -1669,8 +1651,7 @@ impl VmcMessage for VmcExtSetEye {
OscType::Float(f) => z = f,
_ => return Err(FromMessageErr::ArgType(ArgTypeErr { expected: vec![OscType::Float(0.0)], actual: msg.args[3].to_owned(), addr: msg.addr, arg_count: 3}))
}
let boxed_result = Box::new(VmcExtSetEye { enable, position: Vector3::new(x, y, z)});
return Ok(boxed_result);
return Ok(Box::new(VmcExtSetEye { enable, position: Vector3::new(x, y, z)}));
}
fn get_addr(&self) -> String {
return String::from("/VMC/Ext/Set/Eye");
@ -1695,8 +1676,7 @@ impl VmcMessage for VmcExtSetRes {
OscType::String(s) => response = s.to_owned(),
_ => return Err(FromMessageErr::ArgType(ArgTypeErr { expected: vec![OscType::String(String::new())], actual: msg.args[0].to_owned(), addr: msg.addr, arg_count: 0}))
}
let boxed_result = Box::new(VmcExtSetRes{response});
return Ok(boxed_result);
return Ok(Box::new(Self{response}));
}
fn get_addr(&self) -> String {
return String::from("/VMC/Ext/Set/Res");
@ -1721,8 +1701,7 @@ impl VmcMessage for VmcExtSetCalibExec {
OscType::Int(i) => mode = i,
_ => return Err(FromMessageErr::ArgType(ArgTypeErr { expected: vec![OscType::Int(0)], actual: msg.args[0].to_owned(), addr: msg.addr, arg_count: 0}))
}
let boxed_result = Box::new(VmcExtSetCalibExec{mode});
return Ok(boxed_result);
return Ok(Box::new(Self{mode}));
}
fn get_addr(&self) -> String {
return String::from("/VMC/Ext/Set/Calib/Exec");
@ -1747,8 +1726,7 @@ impl VmcMessage for VmcExtSetConfig {
OscType::String(s) => path = s.to_owned(),
_ => return Err(FromMessageErr::ArgType(ArgTypeErr { expected: vec![OscType::String(String::new())], actual: msg.args[0].to_owned(), addr: msg.addr, arg_count: 0}))
}
let boxed_result = Box::new(VmcExtSetConfig{path});
return Ok(boxed_result);
return Ok(Box::new(Self{path}));
}
fn get_addr(&self) -> String {
return String::from("/VMC/Ext/Set/Res");
@ -1768,8 +1746,7 @@ impl VmcMessage for VmcMessageNoArgs {
if msg.args.len() != 0 {
return Err(FromMessageErr::ArgCount(ArgCountErr { expected_in: vec![0], actual: msg.args.len(), addr: msg.addr}))
}
let boxed_result = Box::new(VmcMessageNoArgs { addr: msg.addr });
return Ok(boxed_result);
return Ok(Box::new(Self { addr: msg.addr }));
}
fn get_addr(&self) -> String {
return self.addr.to_owned();