add constructors for VmcExtRootPos
This commit is contained in:
parent
e385ffe5e9
commit
d6d74353bd
20
src/lib.rs
20
src/lib.rs
|
@ -419,6 +419,26 @@ impl VmcMessage for VmcExtRootPos {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl VmcExtRootPos {
|
||||||
|
fn new(name: String, transform: Transform3D, mr_scale: Option<Vector3>, mr_offset: Option<Vector3>) -> Result<Self, MessageCreationErr> {
|
||||||
|
if mr_scale.is_some() && mr_offset.is_none() {
|
||||||
|
return Err(MessageCreationErr::OptionalArgs(CreateOptionalArgsErr { expected_sets: vec![String::from("None"), String::from("mr_scale, mr_offset")], actual: String::from("mr_scale"), calling_func: String::from("VmcExtRootPos::new")}));
|
||||||
|
}
|
||||||
|
if mr_scale.is_none() && mr_offset.is_some() {
|
||||||
|
return Err(MessageCreationErr::OptionalArgs(CreateOptionalArgsErr { expected_sets: vec![String::from("None"), String::from("mr_scale, mr_offset")], actual: String::from("mr_offset"), calling_func: String::from("VmcExtRootPos::new")}))
|
||||||
|
}
|
||||||
|
return Ok(VmcExtRootPos { name, transform, mr_scale, mr_offset});
|
||||||
|
}
|
||||||
|
fn new_vmc_message(name: String, transform: Transform3D, mr_scale: Option<Vector3>, mr_offset: Option<Vector3>) -> Result<Box<dyn VmcMessage>, MessageCreationErr> {
|
||||||
|
let message = Self::new(name, transform, mr_scale, mr_offset);
|
||||||
|
if message.is_ok() {
|
||||||
|
let boxed_result: Box<dyn VmcMessage> = Box::new(message.ok().unwrap());
|
||||||
|
return Ok(boxed_result);
|
||||||
|
}
|
||||||
|
return Err(message.err().unwrap());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
struct VmcExtBonePos {
|
struct VmcExtBonePos {
|
||||||
name: String,
|
name: String,
|
||||||
|
|
Loading…
Reference in New Issue
Block a user