From f706c9905975f8ec711c527ba23c382f1488827e Mon Sep 17 00:00:00 2001 From: dfighter1985 Date: Sun, 2 Dec 2012 19:47:12 +0100 Subject: [PATCH] MODIFIED: #1471 Forgot to remove parents' properties before saving the node properties. --- .../src/plugins/gui_editor/widget_info.h | 10 ++++++++ .../gui_editor/widget_info_serializer.cpp | 23 ++++++++++++++++++- 2 files changed, 32 insertions(+), 1 deletion(-) diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/widget_info.h b/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/widget_info.h index eb6c35c81..bd14e1471 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/widget_info.h +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/widget_info.h @@ -37,6 +37,16 @@ namespace GUIEditor entry.propDefault = propdefault; return entry; } + + bool operator==( const SPropEntry &other ) const + { + if( ( propName == other.propName ) && + ( propType == other.propType ) && + ( propDefault == other.propDefault ) ) + return true; + else + return false; + } }; struct SWidgetInfo diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/widget_info_serializer.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/widget_info_serializer.cpp index fdde2c04c..fdcf70120 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/widget_info_serializer.cpp +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/widget_info_serializer.cpp @@ -30,6 +30,27 @@ namespace GUIEditor std::fstream f; std::string filename = "widgets/" + node->getInfo().name + ".xml"; SWidgetInfo &info = node->getInfo(); + + // Make a copy of the properties, then remove all the parents' properties, since we only want to save the properties of this node + std::vector< SPropEntry > props; + props.resize( info.props.size() ); + std::copy( info.props.begin(), info.props.end(), props.begin() ); + + CWidgetInfoTreeNode *parent = node->getParent(); + if( parent != NULL ) + { + SWidgetInfo &parentInfo = parent->getInfo(); + std::vector< SPropEntry >::const_iterator itr = parentInfo.props.begin(); + while( itr != parentInfo.props.end() ) + { + std::vector< SPropEntry >::const_iterator fItr; + fItr = std::find( props.begin(), props.end(), *itr ); + if( fItr == props.end() ) + continue; + props.erase( fItr ); + ++itr; + } + } f.open( filename.c_str(), std::ios_base::out ); if( !f.is_open() ) @@ -55,7 +76,7 @@ namespace GUIEditor f << "\t" << std::endl; f << "\t" << std::endl; - for( std::vector< SPropEntry >::const_iterator itr = info.props.begin(); itr != info.props.end(); ++itr ) + for( std::vector< SPropEntry >::const_iterator itr = props.begin(); itr != props.end(); ++itr ) { f << "\t\t" << std::endl;