Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 760d8a033d | |||
| 96cd122645 | |||
| 533768eb14 |
@@ -109,13 +109,12 @@ module SpeckleConnector3
|
||||
next
|
||||
end
|
||||
|
||||
# 3.3. Determine prop is dynamically detached or not
|
||||
# 3.3. Check prop needs to split into chunks
|
||||
chunked_detach_match = prop.match(/^@\((\d*)\)/)
|
||||
|
||||
# 3.4. Determine prop is dynamically detached or not
|
||||
is_detach_prop = prop[0] == '@'
|
||||
is_dynamically_detached = prop[0] == '@' && prop.length > 2 && prop[1] == '@'
|
||||
prop = prop[2..-1] if is_dynamically_detached
|
||||
|
||||
# 3.4. Check prop needs to split into chunks
|
||||
chunked_detach_match = prop.match(/^@\((\d*)\)/)
|
||||
|
||||
# 3.5. If split chunk is needed and prop value is array, then run chunking process
|
||||
if value.is_a?(Array) && chunked_detach_match
|
||||
@@ -165,11 +164,18 @@ module SpeckleConnector3
|
||||
next
|
||||
end
|
||||
|
||||
# 3.6 we cleanup the semantic @ or @@ we used so far for detaching or chunking
|
||||
if is_dynamically_detached
|
||||
prop = prop[2..-1]
|
||||
else
|
||||
prop = prop[1..-1] if is_detach_prop
|
||||
end
|
||||
|
||||
child = traverse_value(value, is_detach_prop)
|
||||
|
||||
is_base = value.is_a?(Hash) && !value[:speckle_type].nil?
|
||||
|
||||
# 3.6. traverse value according to value is a speckle object or not
|
||||
# 3.7. traverse value according to value is a speckle object or not
|
||||
traversed_base[prop] = if is_base
|
||||
if child[:referencedId] && child[:speckle_type] == 'reference'
|
||||
is_detach_prop ? detach_helper(child[:referencedId]) : child
|
||||
|
||||
@@ -105,9 +105,6 @@ module SpeckleConnector3
|
||||
|
||||
# @param entity [Sketchup::Entity]
|
||||
def entity_has_changed?(entity)
|
||||
# We do not necessarily consider grouped meshes for caching?
|
||||
return false if entity.is_a?(SpeckleObjects::Geometry::GroupedMesh)
|
||||
|
||||
speckle_state.changed_entity_persistent_ids.include?(entity.persistent_id.to_s) ||
|
||||
speckle_state.changed_entity_ids.include?(entity.entityID.to_s)
|
||||
end
|
||||
|
||||
@@ -48,7 +48,9 @@ module SpeckleConnector3
|
||||
|
||||
instance_dictionaries = SketchupModel::Dictionary::BaseDictionaryHandler
|
||||
.attribute_dictionaries_to_speckle(entity)
|
||||
instance_att = instance_dictionaries.any? ? { dictionaries: instance_dictionaries } : {}
|
||||
definition_dictionaries = SketchupModel::Dictionary::BaseDictionaryHandler
|
||||
.attribute_dictionaries_to_speckle(entity.definition)
|
||||
instance_att = instance_dictionaries.any? ? { "Instance Attributes": instance_dictionaries, "Definition Attributes": definition_dictionaries } : {}
|
||||
|
||||
instance_proxies[instance_id] = SpeckleObjects::InstanceProxy.new(
|
||||
definition_id,
|
||||
@@ -100,8 +102,8 @@ module SpeckleConnector3
|
||||
grouped_meshes = faces.group_by { |face| [face.layer, face.material || face.back_material] }
|
||||
grouped_meshes.each do |(layer, mat), faces|
|
||||
material_id = mat.nil? ? 'none' : mat.persistent_id.to_s
|
||||
grouped_mesh_id = "#{layer.name} - #{material_id} - #{entity.definition.persistent_id.to_s}"
|
||||
grouped_mesh = SpeckleObjects::Geometry::GroupedMesh.new(faces, layer, mat, grouped_mesh_id)
|
||||
# grouped_mesh_id = "#{layer.name} - #{material_id} - #{entity.definition.persistent_id.to_s}"
|
||||
grouped_mesh = SpeckleObjects::Geometry::GroupedMesh.new(faces, layer, mat)
|
||||
flat_atomic_objects[grouped_mesh.persistent_id.to_s] = grouped_mesh
|
||||
definition_proxy.add_object_id(grouped_mesh.faces.first.persistent_id.to_s)
|
||||
end
|
||||
|
||||
@@ -28,15 +28,19 @@ module SpeckleConnector3
|
||||
# @return [Sketchup::Material] material that faces belong to
|
||||
attr_reader :material
|
||||
|
||||
# @return [String] structured id for grouped mesh
|
||||
# @return [String] fake id for grouped mesh
|
||||
attr_reader :persistent_id
|
||||
|
||||
# @return [String] fake id for grouped mesh
|
||||
attr_reader :entityID
|
||||
|
||||
# @return Hash{String=>Sketchup::Face}
|
||||
attr_reader :mesh_groups
|
||||
|
||||
def initialize(faces, layer, material, persistent_id)
|
||||
def initialize(faces, layer, material)
|
||||
@faces = faces
|
||||
@persistent_id = persistent_id
|
||||
@persistent_id = faces.first.persistent_id.to_s
|
||||
@entityID = faces.first.persistent_id.to_s
|
||||
@layer = layer
|
||||
@material = material
|
||||
@mesh_groups = {}
|
||||
|
||||
Reference in New Issue
Block a user