@@ -68,7 +68,7 @@ void moMessage::newObject(){
6868
6969// --------------------------------------------------------------
7070void moMessage::setupObjectContent (shared_ptr<ofAppGLFWWindow> &mainWindow){
71-
71+ loadMessageSetting ();
7272}
7373
7474// --------------------------------------------------------------
@@ -119,7 +119,9 @@ void moMessage::drawObjectNodeGui( ImGuiEx::NodeCanvas& _nodeCanvas ){
119119 ImGui::Dummy (ImVec2 (-1 ,ImGui::GetWindowSize ().y /2 - (40 *scaleFactor))); // Padding top
120120 ImGui::PushItemWidth (-24 *scaleFactor);
121121 ImGui::PushStyleColor (ImGuiCol_FrameBg, VHS_DGRAY);
122- ImGui::InputText (" ##source" , &actualMessage);
122+ if (ImGui::InputText (" ##source" , &actualMessage)){
123+ saveMessageSetting ();
124+ }
123125 ImGui::PopStyleColor (1 );
124126 ImGui::PopItemWidth ();
125127 ImGui::SameLine (); ImGuiEx::HelpMarker (" Always check receiving objects reference for UPPERCASE/LOWERCASE messages." );
@@ -148,6 +150,41 @@ void moMessage::removeObjectContent(bool removeFileFromData){
148150
149151}
150152
153+ // --------------------------------------------------------------
154+ void moMessage::loadMessageSetting (){
155+ ofxXmlSettings XML;
156+
157+ if (XML.loadFile (patchFile)){
158+ int totalObjects = XML.getNumTags (" object" );
159+ for (int i=0 ;i<totalObjects;i++){
160+ if (XML.pushTag (" object" , i)){
161+ if (XML.getValue (" id" , -1 ) == this ->nId ){
162+ actualMessage = XML.getValue (" text" ," none" );
163+ }
164+ XML.popTag ();
165+ }
166+ }
167+ }
168+ }
169+
170+ // --------------------------------------------------------------
171+ void moMessage::saveMessageSetting (){
172+ ofxXmlSettings XML;
173+
174+ if (XML.loadFile (patchFile)){
175+ int totalObjects = XML.getNumTags (" object" );
176+ for (int i=0 ;i<totalObjects;i++){
177+ if (XML.pushTag (" object" , i)){
178+ if (XML.getValue (" id" , -1 ) == this ->nId ){
179+ XML.setValue (" text" ,actualMessage);
180+ }
181+ XML.popTag ();
182+ }
183+ }
184+ XML.saveFile ();
185+ }
186+ }
187+
151188
152189OBJECT_REGISTER ( moMessage, " message" , OFXVP_OBJECT_CAT_GUI)
153190
0 commit comments