this repo has no description

add send chatbox node to backend

phaz.uk 6085ed71 2f32a594

verified
Changed files
+45 -3
src-tauri
src
runtime
nodes
oscactions
structs
-1
src-tauri/src/osc.rs
··· 160 160 } 161 161 } 162 162 163 - println!("{:X?}", &buf); 164 163 socket.send_to(&buf, ip_addr).unwrap(); 165 164 }
+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 + pub mod sendchatbox;
+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 + }
+1 -1
src-tauri/src/structs/parameter_types.rs
··· 1 - use anyhow::{Result, bail}; 1 + use anyhow::{ Result, bail }; 2 2 use serde::Serialize; 3 3 4 4 #[derive(Serialize, Clone, Debug, PartialEq)]