Xcos MVC: fix for Deleted blocks 74/16574/4
Paul Bignier [Fri, 29 May 2015 14:22:35 +0000 (16:22 +0200)]
 * The modification in ModelAdapter.cpp echoes with DiagramAdapter.cpp L 209, setting the ID at 0ll
 * %model_p didn't even mind the Deleted...
 * This is tested by blocks_set.tst when calling GEN_SQR.sci which involves Deleted blocks

Change-Id: I63cbddc4536a4fde1f347e3a27bd1700e8c0817b

scilab/modules/scicos/macros/scicos_scicos/%model_p.sci
scilab/modules/scicos/src/cpp/view_scilab/ModelAdapter.cpp

index f39f9db..6c8e0f8 100644 (file)
@@ -83,6 +83,8 @@ function ml = diagram2mlist(d)
         case "Annotation" then
             t = ml.objs(k);
             listObjs(k) = mlist(["Annotation", "graphics", "model", "void", "gui"], t.graphics, t.model, t.void, t.gui);
+        case "Deleted" then
+            listObjs(k) = mlist(["Deleted"]);
         else
             error(msprintf(_("Wrong type for diagram element #%d: %s %s or %s expected.\n"), k, "Block", "Link", "Annotation"));
         end
index 3d931e9..2f99521 100644 (file)
@@ -437,6 +437,11 @@ bool setInnerBlocksRefs(ModelAdapter& adaptor, const std::vector<ScicosID>& chil
 
     for (std::vector<ScicosID>::const_iterator it = children.begin(); it != children.end(); ++it)
     {
+        if (*it == 0ll)
+        {
+            continue; // Rule out mlists (Deleted or Annotations)
+        }
+
         if (controller.getObject(*it)->kind() == BLOCK) // Rule out Annotations and Links
         {
             std::string name;