From f2da87ba9366e5ad1a4ff0369788d61e05c62dd0 Mon Sep 17 00:00:00 2001
From: Whitney Armstrong <warmstrong@anl.gov>
Date: Mon, 26 Jul 2021 12:57:46 -0500
Subject: [PATCH] Do not set defaults when using reference visattrib.

---
 DDCore/src/plugins/Compact2Objects.cpp | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/DDCore/src/plugins/Compact2Objects.cpp b/DDCore/src/plugins/Compact2Objects.cpp
index f4f139214..581f535fe 100644
--- a/DDCore/src/plugins/Compact2Objects.cpp
+++ b/DDCore/src/plugins/Compact2Objects.cpp
@@ -825,7 +825,9 @@ template <> void Converter<VisAttr>::operator()(xml_h e) const {
   float red   = 1.0;
   float green = 1.0;
   float blue  = 1.0;
+  bool use_ref = false;
   if(e.hasAttr(_U(ref))) {
+    use_ref = true;
     auto refName = e.attr<string>(_U(ref));
     const auto refAttr = description.visAttributes(refName);
     if(!refAttr.isValid() )  {
@@ -860,7 +862,8 @@ template <> void Converter<VisAttr>::operator()(xml_h e) const {
       attr.setLineStyle(VisAttr::DASHED);
   }
   else {
-    attr.setLineStyle(VisAttr::SOLID);
+    if (!use_ref)
+      attr.setLineStyle(VisAttr::SOLID);
   }
   if (e.hasAttr(_U(drawingStyle))) {
     string ds = e.attr<string>(_U(drawingStyle));
@@ -870,12 +873,15 @@ template <> void Converter<VisAttr>::operator()(xml_h e) const {
       attr.setDrawingStyle(VisAttr::SOLID);
   }
   else {
-    attr.setDrawingStyle(VisAttr::SOLID);
+    if (!use_ref)
+      attr.setDrawingStyle(VisAttr::SOLID);
   }
   if (e.hasAttr(_U(showDaughters)))
     attr.setShowDaughters(e.attr<bool>(_U(showDaughters)));
-  else
-    attr.setShowDaughters(true);
+  else {
+    if (!use_ref)
+      attr.setShowDaughters(true);
+  }
   description.addVisAttribute(attr);
 }
 
-- 
GitLab