File tree Expand file tree Collapse file tree 1 file changed +5
-7
lines changed
src/compas/datastructures/tree Expand file tree Collapse file tree 1 file changed +5
-7
lines changed Original file line number Diff line number Diff line change 11from compas .datastructures import Tree
22from compas .datastructures import TreeNode
3+ from compas .data import Data
34from compas .data import json_dumps
45import hashlib
56
@@ -165,13 +166,10 @@ def from_dict(cls, data_dict):
165166
166167 @classmethod
167168 def from_object (cls , obj ):
168- """Construct a HashTree from a COMPAS object."""
169- raise NotImplementedError
170-
171- @classmethod
172- def from_scene (cls , scene ):
173- """Construct a HashTree from a COMPAS scene."""
174- raise NotImplementedError
169+ """Construct a HashTree from a COMPAS data object."""
170+ if not isinstance (obj , Data ):
171+ raise TypeError ("The object must be a COMPAS data object." )
172+ return cls .from_dict (obj .data )
175173
176174 def node_signature (self , node , parent_path = "" ):
177175 """Compute the SHA256 signature of a node. The computed nodes are cached in `self.signatures` dictionary.
You can’t perform that action at this time.
0 commit comments