Skip to content

Commit 86fc92f

Browse files
committed
Added parameter to specify chart attribute in unglue_charts()
Added mechanism to override command invokation protection
1 parent 0c0e184 commit 86fc92f

File tree

3 files changed

+29
-28
lines changed

3 files changed

+29
-28
lines changed

src/lib/OGF/mesh/commands/mesh_grob_surface_commands.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1193,11 +1193,11 @@ namespace OGF {
11931193
mesh_grob()->update();
11941194
}
11951195

1196-
void MeshGrobSurfaceCommands::unglue_charts() {
1196+
void MeshGrobSurfaceCommands::unglue_charts(const std::string& attrib_name) {
11971197
Attribute<index_t> chart;
1198-
chart.bind_if_is_defined(mesh_grob()->facets.attributes(), "chart");
1198+
chart.bind_if_is_defined(mesh_grob()->facets.attributes(), attrib_name);
11991199
if(!chart.is_bound()) {
1200-
Logger::err("Unglue") << "chart: no such facet attribute"
1200+
Logger::err("Unglue") << attrib_name << ": no such facet attribute"
12011201
<< std::endl;
12021202
return;
12031203
}

src/lib/OGF/mesh/commands/mesh_grob_surface_commands.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -460,8 +460,9 @@ namespace OGF {
460460
/**
461461
* \menu Atlas/Segmentation
462462
* \brief Unglues facet edges adjacent to two different charts
463+
* \param[in] attrib_name name of the attribute that stores chart ids
463464
*/
464-
void unglue_charts();
465+
void unglue_charts(const std::string& attrib_name = "chart");
465466

466467
/**
467468
* \menu Atlas/Parameterization

src/lib/OGF/scene_graph/commands/commands.cpp

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -25,16 +25,16 @@
2525
2626
*
2727
* ISA Project
28-
* LORIA, INRIA Lorraine,
28+
* LORIA, INRIA Lorraine,
2929
* Campus Scientifique, BP 239
30-
* 54506 VANDOEUVRE LES NANCY CEDEX
30+
* 54506 VANDOEUVRE LES NANCY CEDEX
3131
* FRANCE
3232
*
3333
* Note that the GNU General Public License does not permit incorporating
34-
* the Software into proprietary programs.
34+
* the Software into proprietary programs.
3535
*/
36-
37-
36+
37+
3838
#include <OGF/scene_graph/commands/commands.h>
3939
#include <OGF/scene_graph/grob/grob.h>
4040
#include <OGF/scene_graph/types/scene_graph.h>
@@ -55,8 +55,8 @@ namespace OGF {
5555
Interface::~Interface() {
5656
}
5757

58-
void Interface::set_grob(Grob* grob) {
59-
grob_ = grob ;
58+
void Interface::set_grob(Grob* grob) {
59+
grob_ = grob ;
6060
}
6161

6262
SceneGraph* Interface::scene_graph() const {
@@ -67,7 +67,7 @@ namespace OGF {
6767
/**************************************************/
6868

6969
bool Commands::command_is_running_ = false;
70-
70+
7171
Commands::Commands() : chrono_(true) {
7272
}
7373

@@ -79,8 +79,8 @@ namespace OGF {
7979
const ArgList& args_in, Any& ret_val
8080
) {
8181

82-
if(command_is_running_) {
83-
Logger::warn("Commands")
82+
if(!args_in.has_arg("override_lock") && command_is_running_) {
83+
Logger::warn("Commands")
8484
<< "Tryed to invoke command from locked Commands class"
8585
<< std::endl ;
8686
return false ;
@@ -95,7 +95,7 @@ namespace OGF {
9595

9696

9797
bool invoked_from_gui = false;
98-
98+
9999
// Copy argument list, ignore arguments that start with '_'
100100
ArgList args;
101101
for(index_t i=0; i<args_in.nb_args(); ++i) {
@@ -106,29 +106,29 @@ namespace OGF {
106106
invoked_from_gui = true;
107107
}
108108
continue;
109-
}
109+
}
110110
args.create_arg(name, value);
111111
}
112112

113-
113+
114114
if(interpreter() != nullptr) {
115115

116116
if(invoked_from_gui) {
117117
Object* main = interpreter()->resolve_object("main");
118118
main->invoke_method("save_state");
119119
}
120-
120+
121121
bool interp_is_lua = (CmdLine::get_arg("gel") == "Lua");
122122
std::ostringstream out ;
123123

124124
// TODO: use new .I.xxx. instead of query_interface()
125125
if(get_grob()->meta_class()->name() == "OGF::SceneGraph") {
126-
out << "scene_graph.query_interface(\""
127-
<< meta_class()->name()
126+
out << "scene_graph.query_interface(\""
127+
<< meta_class()->name()
128128
<< "\")" ;
129129
} else {
130-
out << "scene_graph.current().query_interface(\""
131-
<< meta_class()->name()
130+
out << "scene_graph.current().query_interface(\""
131+
<< meta_class()->name()
132132
<< "\")" ;
133133
}
134134
out << "." << method_name;
@@ -142,13 +142,13 @@ namespace OGF {
142142
// TODO: do not add quotes around integers, floating point
143143
// numbers and truth values.
144144
for(unsigned int i=0; i<args.nb_args(); i++) {
145-
out << args.ith_arg_name(i) << "="
145+
out << args.ith_arg_name(i) << "="
146146
<< "\"" << args.ith_arg_value(i).as_string() << "\"" ;
147147
if(i != args.nb_args() - 1) {
148148
out << ", " ;
149149
}
150150
}
151-
151+
152152
if(interp_is_lua) {
153153
// name-value pairs call: '}' = create LUA table.
154154
out << "})" << std::endl ;
@@ -161,7 +161,7 @@ namespace OGF {
161161
// Do not display timings for methods with continuous updates
162162
// (e.g. set_multiresolution_level)
163163
MetaMethod* mmethod = meta_class()->find_method(method_name) ;
164-
bool do_timings = chrono_ && mmethod != nullptr &&
164+
bool do_timings = chrono_ && mmethod != nullptr &&
165165
!mmethod->has_custom_attribute("continuous_update") ;
166166

167167
if(get_grob() != nullptr) {
@@ -179,14 +179,14 @@ namespace OGF {
179179
method_name, args, ret_val
180180
) ;
181181
Logger::out("timings")
182-
<< "(" << full_name << ") Elapsed time: "
182+
<< "(" << full_name << ") Elapsed time: "
183183
<< timer.elapsed_time() << std::endl ;
184184

185185
// TODO: re-enable changing current object here.
186186

187187
// If the user clicked on the object list attempting
188188
// to change current object, restore selected item.
189-
189+
190190
// TODO: take into account user changed object here
191191

192192
command_is_running_ = false ;
@@ -207,5 +207,5 @@ namespace OGF {
207207
}
208208
return get_grob()->interpreter();
209209
}
210-
210+
211211
}

0 commit comments

Comments
 (0)