Skip to content

Commit

Permalink
include Collection as receive object type; exclude View from receivin…
Browse files Browse the repository at this point in the history
…g type
  • Loading branch information
KatKatKateryna committed Apr 6, 2023
1 parent f8a9e98 commit 3b3b323
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
7 changes: 6 additions & 1 deletion plugin_utils/object_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,11 @@ def loopObj(base: Base, baseName: str, streamBranch: str, plugin):
for name in memberNames:
if name in ["id", "applicationId", "units", "speckle_type"]: continue
# skip if traversal goes to displayValue of an object, that will be readable anyway:
if not isinstance(base, Base): continue
try:
if not isinstance(base, Base) and "Objects.Organization.Collection" not in base.speckle_type: continue
except:
if not isinstance(base, Base): continue

if (name == "displayValue" or name == "@displayValue") and base.speckle_type.startswith(tuple(SPECKLE_TYPES_TO_READ)): continue

try: loopVal(base[name], baseName + "/" + name, streamBranch, plugin)
Expand All @@ -97,6 +101,7 @@ def loopVal(value: Any, name: str, streamBranch: str, plugin): # "name" is the p
for i, item in enumerate(value):
loopVal(item, name, streamBranch, plugin)
if not isinstance(item, Base): continue
if "View" in item.speckle_type: continue
if item.speckle_type and item.speckle_type.startswith("IFC"):
# keep traversing infinitely, just don't run repeated conversion for the same list of objects
try:
Expand Down
2 changes: 1 addition & 1 deletion speckle_qgis.py
Original file line number Diff line number Diff line change
Expand Up @@ -550,7 +550,7 @@ def onReceive(self):
findAndClearLayerGroup(self.qgis_project, newGroupName)

if app.lower() == "qgis" or app.lower() == "arcgis": check: Callable[[Base], bool] = lambda base: base.speckle_type and (base.speckle_type.endswith("VectorLayer") or base.speckle_type.endswith("Layer") or base.speckle_type.endswith("RasterLayer") )
else: check: Callable[[Base], bool] = lambda base: (base.speckle_type and base.speckle_type.endswith("Base") )
else: check: Callable[[Base], bool] = lambda base: (base.speckle_type) # and base.speckle_type.endswith("Base") )
traverseObject(self, commitObj, callback, check, str(newGroupName))

#if self.dockwidget.experimental.isChecked(): time.sleep(3)
Expand Down

0 comments on commit 3b3b323

Please sign in to comment.