use super::Node;
use crate::types::*;
use derive_new::new;
use derive_setters::Setters;
use serde::{Deserialize, Serialize};
pub type MFNode = Vec<Node>;
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, new, Setters)]
#[serde(rename_all = "camelCase")]
#[setters(prefix = "with_", strip_option, into)]
pub struct Group {
#[serde(default, skip_serializing_if = "Option::is_none")]
#[new(default)]
pub children: Option<crate::types::ProtoField<MFNode>>,
}
impl crate::proto::schema::WebotsNode for Group {
fn node_name() -> &'static str {
"Group"
}
fn all_fields() -> &'static [(&'static str, crate::proto::ast::FieldType)] {
&[("children", crate::proto::ast::FieldType::MFNode)]
}
}
define_node!(
Pose {
translation: SFVec3f,
rotation: SFRotation,
children: MFNode,
});
define_node!(
Billboard {
children: MFNode,
});
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn test_group_new() {
let group_node = Group::new();
assert!(group_node.children.is_none());
}
#[test]
fn test_pose_new() {
let pose_node = Pose::new();
assert!(pose_node.rotation.is_none());
}
#[test]
fn test_billboard_new() {
let billboard_node = Billboard::new();
assert!(billboard_node.children.is_none());
}
}