From 7c76bf5b1198f6a3c0c04fc1d736d7d405e76687 Mon Sep 17 00:00:00 2001 From: Marlin Frickenschmidt Date: Mon, 31 Jan 2011 16:14:45 +0000 Subject: [PATCH] Fixed a critical bug that made it impossible to use conditions or loops (is nobody using them? :P). Added some visual scripting functions for Mesh Repair plugin. git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@10784 383ad7c9-94d9-4d36-a494-682f7c89f535 --- VsiMetadata/loopsConditions.xml | 8 +-- VsiMetadata/repair.xml | 119 ++++++++++++++++++++++++++++++++ parser/context.cc | 2 +- vsiPlugin.cc | 2 +- 4 files changed, 125 insertions(+), 6 deletions(-) create mode 100644 VsiMetadata/repair.xml diff --git a/VsiMetadata/loopsConditions.xml b/VsiMetadata/loopsConditions.xml index 7ecbc57..047fdd9 100644 --- a/VsiMetadata/loopsConditions.xml +++ b/VsiMetadata/loopsConditions.xml @@ -18,8 +18,8 @@ - while ([function="test"]().out) - [function="content"]() + while ([function="condition"]().out) + [function="content"](); @@ -29,7 +29,7 @@ IF condition true - + Test @@ -42,7 +42,7 @@ - if ([input="test"]) + if ([input="condition"]) [function="true"](); else [function="false"](); diff --git a/VsiMetadata/repair.xml b/VsiMetadata/repair.xml new file mode 100644 index 0000000..66d94fc --- /dev/null +++ b/VsiMetadata/repair.xml @@ -0,0 +1,119 @@ + + + Mesh Repair + Select long edges + true + + + ID of an object + ID of an object + + + Minimal edge length + Minimal length of edges that will be selected + 0.0 + 100.0 + 0.0001 + + + + meshrepair.selectEdgesLongerThan ([input="obj"], [input="length"]); + + + + Mesh Repair + Select short edges + true + + + ID of an object + ID of an object + + + Maximal edge length + Maximal length of edges that will be selected + 0.0 + 100.0 + 0.0001 + + + + meshrepair.selectEdgesShorterThan ([input="obj"], [input="length"]); + + + + Mesh Repair + Merge selected edges + true + + + ID of an object + ID of an object + + + + meshrepair.removeSelectedEdges ([input="obj"]); + + + + Mesh Repair + Flips selected face normals + true + + + ID of an object + ID of an object + + + + meshrepair.flipOrientation ([input="obj"]); + + + + Mesh Repair + Detect/Repair skinny triangles by angle + true + + + ID of an object + ID of an object + + + Minimal angle + Minimal angle between adjacent faces such that an edge is selected/flipped + 0.0 + 180.0 + 0.0001 + + + Flip found edges? + True if found sharp edges should be flipped, false to only select them + + + + meshrepair.detectSkinnyTriangleByAngle ([input="obj"], [input="angle"], [input="remove"]); + + + + Mesh Repair + Detect flat triangles + Detect flat triangles of valence 3 + true + + + ID of an object + ID of an object + + + Maximal angle + Maximal angle difference to adjacent triangles such that a triangle is selected + 0.0 + 180.0 + 0.0001 + + + + meshrepair.detectFlatTriangles ([input="obj"], [input="angle"]); + + + diff --git a/parser/context.cc b/parser/context.cc index d17b8ea..148a569 100644 --- a/parser/context.cc +++ b/parser/context.cc @@ -519,7 +519,7 @@ Function* Context::parseFunction (QXmlQuery &_xml, Element *_e) QString endCode = "return { "; foreach (Input *i, f->end_->inputs ()) - endCode += i->name () + " : '[input=\"" + i->name () + "\"]', "; + endCode += i->name () + " : [input=\"" + i->name () + "\"], "; endCode.remove (endCode.length () - 2, 2); endCode += " };\n"; diff --git a/vsiPlugin.cc b/vsiPlugin.cc index 5c907da..dc2cae6 100644 --- a/vsiPlugin.cc +++ b/vsiPlugin.cc @@ -202,7 +202,7 @@ QScriptValue VsiPlugin::askForInputs(QString _element, QString _inputs) QString script = "inputs = { "; foreach (QString s, _inputs.split (",", QString::SkipEmptyParts)) - script += s + ": '" + results[s] + "',"; + script += s + ": " + results[s] + ","; script.remove (script.length () - 1, 1); -- GitLab