-1
src-tauri/src/osc.rs
-1
src-tauri/src/osc.rs
+4
-1
src-tauri/src/runtime/nodes.rs
+4
-1
src-tauri/src/runtime/nodes.rs
···
1
1
use std::collections::HashMap;
2
2
3
-
use crate::{ runtime::nodes::{ conditional::{ ifequal::ConditionalIfEqual, iffalse::ConditionalIfFalse, iftrue::ConditionalIfTrue }, debug::Debug, osctrigger::OSCTrigger, statics::{ float::StaticFloat, int::StaticInt, string::StaticString } }, structs::{ nodes::Node, parameter_types::ParameterType } };
3
+
use crate::{ runtime::nodes::{ conditional::{ ifequal::ConditionalIfEqual, iffalse::ConditionalIfFalse, iftrue::ConditionalIfTrue }, debug::Debug, oscactions::sendchatbox::OSCActionsSendChatbox, osctrigger::OSCTrigger, statics::{ float::StaticFloat, int::StaticInt, string::StaticString } }, structs::{ nodes::Node, parameter_types::ParameterType } };
4
4
5
5
mod osctrigger;
6
6
mod debug;
7
7
mod statics;
8
8
mod conditional;
9
+
mod oscactions;
9
10
10
11
pub struct RuntimeNodeTree{
11
12
pub nodes: HashMap<String, Box<dyn RuntimeNode>>
···
27
28
"iftrue" => { runtime_nodes.insert(node.id.clone(), ConditionalIfTrue::new(node)); }
28
29
"iffalse" => { runtime_nodes.insert(node.id.clone(), ConditionalIfFalse::new(node)); }
29
30
"ifequal" => { runtime_nodes.insert(node.id.clone(), ConditionalIfEqual::new(node)); }
31
+
32
+
"oscsendchatbox" => { runtime_nodes.insert(node.id.clone(), OSCActionsSendChatbox::new(node)); }
30
33
31
34
"debug" => { runtime_nodes.insert(node.id.clone(), Debug::new(node)); }
32
35
_ => {}
+1
src-tauri/src/runtime/nodes/oscactions/mod.rs
+1
src-tauri/src/runtime/nodes/oscactions/mod.rs
···
1
+
pub mod sendchatbox;
+39
src-tauri/src/runtime/nodes/oscactions/sendchatbox.rs
+39
src-tauri/src/runtime/nodes/oscactions/sendchatbox.rs
···
1
+
use std::vec;
2
+
3
+
use crate::{ osc, runtime::nodes::RuntimeNode, structs::{ nodes::Node, parameter_types::ParameterType } };
4
+
5
+
pub struct OSCActionsSendChatbox{
6
+
to_log: String
7
+
}
8
+
9
+
impl OSCActionsSendChatbox{
10
+
pub fn new( _: Node ) -> Box<Self>{
11
+
Box::new(Self { to_log: "".into() })
12
+
}
13
+
}
14
+
15
+
impl RuntimeNode for OSCActionsSendChatbox{
16
+
fn outputs( &self ) -> Vec<Vec<( String, isize, isize )>> { vec![] }
17
+
fn execute_dry( &mut self, _: &Vec<ParameterType> ) -> Option<Vec<ParameterType>> { Some(vec![]) }
18
+
19
+
fn execute( &mut self ) -> Option<Vec<ParameterType>> {
20
+
osc::send_message("/chatbox/input", vec![
21
+
ParameterType::String(self.to_log.clone()),
22
+
ParameterType::Boolean(true),
23
+
ParameterType::Boolean(false)
24
+
], "127.0.0.1:9000");
25
+
26
+
None
27
+
}
28
+
29
+
fn update_arg( &mut self, index: usize, value: ParameterType ) -> bool {
30
+
if index == 1{
31
+
self.to_log = value.as_string().unwrap();
32
+
true
33
+
} else{
34
+
false
35
+
}
36
+
}
37
+
38
+
fn is_entrypoint( &self ) -> bool { false }
39
+
}