diff --git a/plugins/workflow.cpp b/plugins/workflow.cpp index a8ace1b02..9040ffc1a 100644 --- a/plugins/workflow.cpp +++ b/plugins/workflow.cpp @@ -701,6 +701,19 @@ static ItemConstraint *get_constraint(Core *c, const std::string &str, Persisten return nct; } +static void delete_all_constraints(Core *c) +{ + for(std::vector::iterator iter = constraints.begin(); + iter != constraints.end(); + ++iter) + { + c->getWorld()->DeletePersistentData((*iter)->config); + delete (*iter); + } + + constraints.clear(); +} + static void delete_constraint(Core *c, ItemConstraint *cv) { int idx = linear_index(constraints, cv); @@ -1557,6 +1570,15 @@ static command_result workflow_cmd(Core *c, vector & parameters) c->con.printerr("Constraint not found: %s\n", parameters[1].c_str()); return CR_FAILURE; } + else if (cmd == "clear") + { + if(parameters.size() == 1 && parameters[0] == "all") + { + delete_all_constraints(c); + return CR_OK; + } + return CR_WRONG_USAGE; + } else return CR_WRONG_USAGE; }