Compare commits
29 Commits
2.15.0
...
2.17.2-alpha
| Author | SHA1 | Date | |
|---|---|---|---|
| 92a941a944 | |||
| 0e1ddf2b11 | |||
| b57fa010d1 | |||
| f816452b78 | |||
| 120083bb31 | |||
| a5bb5c4686 | |||
| e5e2729f0a | |||
| ba8b902f48 | |||
| 2d67815ae6 | |||
| ec0c9066d2 | |||
| 58ae858077 | |||
| 613e7938b3 | |||
| e07ff1a445 | |||
| de7dd34ea2 | |||
| 0552f695f9 | |||
| b8d4f3d946 | |||
| fa112a70b1 | |||
| 97309ebb88 | |||
| 556ddc0b6f | |||
| a0dde690ea | |||
| a76dab5be6 | |||
| 2d10bc5bbf | |||
| 4042632e0b | |||
| 7ccf83e1a4 | |||
| 019cd0756f | |||
| 0e5f9f80be | |||
| fc6767860a | |||
| 5b5b4be7b2 | |||
| 45351d082e |
+116
-2
@@ -76,6 +76,99 @@ jobs:
|
||||
paths:
|
||||
- speckle-sharp-ci-tools/Installers
|
||||
|
||||
build-connector-mac:
|
||||
macos:
|
||||
xcode: 12.5.1
|
||||
parameters:
|
||||
projname:
|
||||
type: string
|
||||
default: ""
|
||||
slug:
|
||||
type: string
|
||||
default: ""
|
||||
installer:
|
||||
type: boolean
|
||||
default: false
|
||||
converter-files:
|
||||
type: string
|
||||
default: ""
|
||||
installername:
|
||||
type: string
|
||||
default: ""
|
||||
build-config:
|
||||
type: string
|
||||
default: Release
|
||||
bundlename:
|
||||
type: string
|
||||
default: ""
|
||||
steps:
|
||||
- checkout
|
||||
- attach_workspace:
|
||||
at: ./
|
||||
- run:
|
||||
name: Install dotnet
|
||||
command: |
|
||||
curl -sSL https://dot.net/v1/dotnet-install.sh | bash /dev/stdin --channel Current
|
||||
|
||||
$HOME/.dotnet/dotnet --version
|
||||
$HOME/.dotnet/dotnet --list-runtimes
|
||||
$HOME/.dotnet/dotnet --list-sdks
|
||||
- run:
|
||||
name: Create installer target dir
|
||||
command: |
|
||||
mkdir -p speckle-sharp-ci-tools/Installers/<< parameters.slug >>
|
||||
- run:
|
||||
name: Set Environment Variable
|
||||
command: |
|
||||
TAG=$(if [ "${CIRCLE_TAG}" ]; then echo $CIRCLE_TAG; else echo "2.0.999"; fi;)
|
||||
SEMVER=$(echo "$TAG" | sed -e 's/\/[a-zA-Z-]*//')
|
||||
VER=$(echo "$SEMVER" | sed -e 's/-.*//')
|
||||
VERSION=$(echo $VER.$WORKFLOW_NUM)
|
||||
python3 patch_version.py $SEMVER
|
||||
environment:
|
||||
WORKFLOW_NUM: << pipeline.number >>
|
||||
- run:
|
||||
name: Zip Connector files
|
||||
command: |
|
||||
zip -r << parameters.slug >>-mac.zip "./speckle_connector" "./speckle_connector.rb"
|
||||
# Copy installer files
|
||||
- run:
|
||||
name: Copy files to installer
|
||||
command: |
|
||||
mkdir -p speckle-sharp-ci-tools/Mac/<< parameters.installername >>/.installationFiles/
|
||||
cp << parameters.slug >>-mac.zip speckle-sharp-ci-tools/Mac/<<parameters.installername>>/.installationFiles
|
||||
# Create installer
|
||||
- run:
|
||||
name: Exit if External PR
|
||||
command: if [ "$CIRCLE_PR_REPONAME" ]; then circleci-agent step halt; fi
|
||||
- run:
|
||||
name: Build Mac installer
|
||||
command: ~/.dotnet/dotnet publish speckle-sharp-ci-tools/Mac/<<parameters.installername>>/<<parameters.installername>>.sln -r osx-x64 -c Release
|
||||
- run:
|
||||
name: Zip installer
|
||||
command: |
|
||||
cd speckle-sharp-ci-tools/Mac/<<parameters.installername>>/bin/Release/net6.0/osx-x64/publish/
|
||||
zip -r <<parameters.slug>>.zip ./
|
||||
- store_artifacts:
|
||||
path: speckle-sharp-ci-tools/Mac/<<parameters.installername>>/bin/Release/net6.0/osx-x64/publish/<<parameters.slug>>.zip
|
||||
- run:
|
||||
name: Copy to installer location
|
||||
command: |
|
||||
TAG=$(if [ "${CIRCLE_TAG}" ]; then echo $CIRCLE_TAG; else echo "2.0.999"; fi;)
|
||||
SEMVER=$(echo "$TAG" | sed -e 's/\/[a-zA-Z-]*//')
|
||||
VER=$(echo "$SEMVER" | sed -e 's/-.*//')
|
||||
VERSION=$(echo $VER.$WORKFLOW_NUM)
|
||||
cp speckle-sharp-ci-tools/Mac/<<parameters.installername>>/bin/Release/net6.0/osx-x64/publish/<<parameters.slug>>.zip speckle-sharp-ci-tools/Installers/<< parameters.slug >>/<<parameters.slug>>-$SEMVER.zip
|
||||
environment:
|
||||
WORKFLOW_NUM: << pipeline.number >>
|
||||
- when:
|
||||
condition: << pipeline.git.tag >>
|
||||
steps:
|
||||
- persist_to_workspace:
|
||||
root: ./
|
||||
paths:
|
||||
- speckle-sharp-ci-tools/Installers
|
||||
|
||||
get-ci-tools: # Clones our ci tools and persists them to the workspace
|
||||
docker:
|
||||
- image: cimg/base:2021.01
|
||||
@@ -99,6 +192,7 @@ jobs:
|
||||
root: ./
|
||||
paths:
|
||||
- speckle-sharp-ci-tools
|
||||
|
||||
deploy-manager2:
|
||||
docker:
|
||||
- image: mcr.microsoft.com/dotnet/sdk:6.0
|
||||
@@ -146,17 +240,37 @@ workflows:
|
||||
only: /.*/
|
||||
context: innosetup
|
||||
|
||||
- build-connector-mac:
|
||||
slug: sketchup
|
||||
requires:
|
||||
- get-ci-tools
|
||||
- build-ui
|
||||
filters:
|
||||
tags:
|
||||
only: /.*/
|
||||
installername: SpeckleSketchUpInstall
|
||||
|
||||
- deploy-manager2:
|
||||
context: do-spaces-speckle-releases
|
||||
slug: sketchup
|
||||
os: Win
|
||||
extension: exe
|
||||
requires:
|
||||
- get-ci-tools
|
||||
- build-ui
|
||||
- build-connector
|
||||
filters:
|
||||
tags:
|
||||
only: /([0-9]+)\.([0-9]+)\.([0-9]+)(?:-\w+)?$/
|
||||
branches:
|
||||
ignore: /.*/ # For testing only! /ci\/.*/
|
||||
- deploy-manager2:
|
||||
context: do-spaces-speckle-releases
|
||||
slug: sketchup
|
||||
os: OSX
|
||||
extension: zip
|
||||
requires:
|
||||
- build-connector-mac
|
||||
filters:
|
||||
tags:
|
||||
only: /([0-9]+)\.([0-9]+)\.([0-9]+)(?:-\w+)?$/
|
||||
branches:
|
||||
ignore: /.*/ # For testing only! /ci\/.*/
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
require_relative 'action'
|
||||
require_relative '../convertors/units'
|
||||
require_relative '../convertors/to_native'
|
||||
require_relative '../convertors/clean_up'
|
||||
|
||||
module SpeckleConnector
|
||||
module Actions
|
||||
@@ -26,7 +27,12 @@ module SpeckleConnector
|
||||
converter = Converters::ToNative.new(state, @stream_id, @stream_name, @branch_name, @source_app)
|
||||
# Have side effects on the sketchup model. It effects directly on the entities by adding new objects.
|
||||
start_time = Time.now.to_f
|
||||
state.sketchup_state.sketchup_model.start_operation('Receive Speckle Objects', true)
|
||||
state = converter.receive_commit_object(@base)
|
||||
if state.user_state.model_preferences[:merge_coplanar_faces]
|
||||
Converters::CleanUp.merge_coplanar_faces(converter.converted_faces)
|
||||
end
|
||||
state.sketchup_state.sketchup_model.commit_operation
|
||||
elapsed_time = (Time.now.to_f - start_time).round(3)
|
||||
puts "==== Converting to Native executed in #{elapsed_time} sec ===="
|
||||
puts "==== Source application is #{@source_app}. ===="
|
||||
|
||||
@@ -14,7 +14,7 @@ module SpeckleConnector
|
||||
path = ENV.fetch('APPDATA')
|
||||
Pathname.new(File.join(path, 'Speckle')).cleanpath.to_s
|
||||
when OS_MAC
|
||||
File.join(Dir.home, 'Library/Application Support/Speckle')
|
||||
File.join(Dir.home, '.config/Speckle')
|
||||
else
|
||||
raise 'Speckle could not determine your Appdata path'
|
||||
end
|
||||
|
||||
@@ -11,9 +11,10 @@ module SpeckleConnector
|
||||
# @param entities [Sketchup::Entities] entities to remove edges between that make entities coplanar.
|
||||
# @note Merging coplanar faces idea originated from [CleanUp](https://github.com/thomthom/cleanup) plugin
|
||||
# which is developed by [Thomas Thomassen](https://github.com/thomthom).
|
||||
def self.merge_coplanar_faces(entities)
|
||||
def self.merge_coplanar_entities(entities)
|
||||
edges = []
|
||||
faces = entities.collect { |entity| entity if entity.is_a? Sketchup::Face }.compact
|
||||
faces = merged_faces(faces)
|
||||
faces.each { |face| face.edges.each { |edge| edges << edge } }
|
||||
edges.uniq!
|
||||
edges.each { |edge| remove_edge_have_coplanar_faces(edge, faces, false) }
|
||||
@@ -22,6 +23,22 @@ module SpeckleConnector
|
||||
merged_faces(faces)
|
||||
end
|
||||
|
||||
def self.merge_coplanar_faces(faces)
|
||||
edges = []
|
||||
faces = faces.reject(&:deleted?)
|
||||
|
||||
faces.each { |face| face.edges.each { |edge| edges << edge } }
|
||||
|
||||
edges.uniq!
|
||||
|
||||
edges.each { |edge| remove_edge_have_coplanar_faces(edge) }
|
||||
|
||||
# Remove remaining orphan edges
|
||||
# edges.reject(&:deleted?).select { |edge| edge.faces.empty? }.each(&:erase!)
|
||||
|
||||
merged_faces(faces)
|
||||
end
|
||||
|
||||
def self.merged_faces(faces)
|
||||
faces.reject(&:deleted?)
|
||||
end
|
||||
@@ -35,43 +52,29 @@ module SpeckleConnector
|
||||
# - Whether UV texture map is aligned between faces or not.
|
||||
# - Finally, if faces are coplanar by correcting these checks, then removes edge from Sketchup.active_model.
|
||||
# @param edge [Sketchup::Edge] edge to check.
|
||||
# @param faces [Array<Sketchup::Face>] scoped faces to check 'edge.faces' both (first and second)
|
||||
# belongs to this faces or not. If any of this faces does not involve this scoped faces, then do not delete.
|
||||
# @param ignore_materials [Boolean] whether ignore materials or not.
|
||||
# Returns true if the given edge separating two coplanar faces.
|
||||
# Return false otherwise.
|
||||
# rubocop:disable Metrics/AbcSize
|
||||
def self.remove_edge_have_coplanar_faces(edge, faces, ignore_materials)
|
||||
def self.remove_edge_have_coplanar_faces(edge)
|
||||
return false unless edge.valid? && edge.is_a?(Sketchup::Edge)
|
||||
return false unless edge.faces.size == 2
|
||||
|
||||
# Check scoped faces have this edges
|
||||
if edge.faces.size == 2
|
||||
is_first = faces.include?(edge.faces[0])
|
||||
is_second = faces.include?(edge.faces[1])
|
||||
return false unless is_first && is_second
|
||||
end
|
||||
|
||||
face_1, face_2 = edge.faces
|
||||
|
||||
return false unless face_1.normal.samedirection?(face_2.normal)
|
||||
|
||||
return false if face_duplicate?(face_1, face_2)
|
||||
# Check for troublesome faces which might lead to missing geometry if merged.
|
||||
return false unless edge_safe_to_merge?(edge)
|
||||
|
||||
# Check materials match.
|
||||
unless ignore_materials
|
||||
return false unless (face_1.material == face_2.material) && (face_1.back_material == face_2.back_material)
|
||||
return false unless (face_1.material == face_2.material) && (face_1.back_material == face_2.back_material)
|
||||
|
||||
# Verify UV mapping match.
|
||||
return false if !face_1.material.nil? && !continuous_uv?(face_1, face_2, edge) && face_1.material.texture.nil?
|
||||
end
|
||||
# Check faces are coplanar or not.
|
||||
return false unless faces_coplanar?(face_1, face_2)
|
||||
|
||||
edge.erase!
|
||||
true
|
||||
end
|
||||
# rubocop:enable Metrics/AbcSize
|
||||
|
||||
# Determines if two faces are overlapped.
|
||||
def self.face_duplicate?(face_1, face_2, overlapping: false)
|
||||
|
||||
@@ -32,11 +32,14 @@ module SpeckleConnector
|
||||
# @return [String] source application of received object that will be converted to native
|
||||
attr_reader :source_app
|
||||
|
||||
attr_reader :converted_faces
|
||||
|
||||
def initialize(state, stream_id, stream_name, branch_name, source_app)
|
||||
super(state, stream_id)
|
||||
@stream_name = stream_name
|
||||
@branch_name = branch_name
|
||||
@source_app = source_app.downcase
|
||||
@converted_faces = []
|
||||
end
|
||||
|
||||
# Module aliases
|
||||
@@ -56,6 +59,7 @@ module SpeckleConnector
|
||||
BLOCK_DEFINITION = OTHER::BlockDefinition
|
||||
BLOCK_INSTANCE = OTHER::BlockInstance
|
||||
REVIT_INSTANCE = REVIT::Other::RevitInstance
|
||||
REVIT_WALL = BUILTELEMENTS::RevitWall
|
||||
RENDER_MATERIAL = OTHER::RenderMaterial
|
||||
DISPLAY_VALUE = OTHER::DisplayValue
|
||||
VIEW3D = BUILTELEMENTS::View3d
|
||||
@@ -77,6 +81,7 @@ module SpeckleConnector
|
||||
Objects.Other.RenderMaterial
|
||||
Objects.Other.Instance:Objects.Other.BlockInstance
|
||||
Objects.BuiltElements.View:Objects.BuiltElements.View3D
|
||||
Objects.BuiltElements.Wall:Objects.BuiltElements.Revit.RevitWall
|
||||
Objects.BuiltElements.Network
|
||||
Objects.GIS.PolygonElement
|
||||
Speckle.Core.Models.Collection
|
||||
@@ -294,6 +299,7 @@ module SpeckleConnector
|
||||
OBJECTS_OTHER_REVIT_REVITINSTANCE => REVIT_INSTANCE.method(:to_native),
|
||||
OBJECTS_OTHER_RENDERMATERIAL => RENDER_MATERIAL.method(:to_native),
|
||||
OBJECTS_BUILTELEMENTS_VIEW3D => VIEW3D.method(:to_native),
|
||||
OBJECTS_BUILTELEMENTS_REVIT_WALL => REVIT_WALL.method(:to_native),
|
||||
OBJECTS_BUILTELEMENTS_REVIT_DIRECTSHAPE => BUILTELEMENTS::Revit::DirectShape.method(:to_native),
|
||||
OBJECTS_BUILTELEMENTS_NETWORK => BUILTELEMENTS::Network.method(:to_native),
|
||||
OBJECTS_GIS_POLYGONELEMENT => POLYGON_ELEMENT.method(:to_native),
|
||||
@@ -309,6 +315,8 @@ module SpeckleConnector
|
||||
# Call 'to_native' method by passing this method itself to handle nested 'to_native' conversions.
|
||||
# It returns updated state and converted entities.
|
||||
state, converted_entities = to_native_method.call(state, obj, layer, entities, &convert_to_native)
|
||||
faces = converted_entities.select { |e| e.is_a?(Sketchup::Face) }
|
||||
@converted_faces += faces if faces.any?
|
||||
if from_revit
|
||||
# Create levels as section planes if they exists
|
||||
create_levels(state, obj)
|
||||
|
||||
BIN
Binary file not shown.
@@ -12,9 +12,9 @@ module SpeckleConnector
|
||||
include Immutable::ImmutableUtils
|
||||
DICT_HANDLER = SketchupModel::Dictionary::SpeckleModelDictionaryHandler
|
||||
# rubocop:disable Layout/LineLength
|
||||
DEFAULT_CONFIG = "('configSketchup', '{\"dark_theme\":false, \"diffing\":false, \"register_speckle_entity\":false}');"
|
||||
DEFAULT_CONFIG = "('configSketchup', '{\"dark_theme\":false, \"diffing\":false, \"register_speckle_entity\":false, \"fe2\":false}');"
|
||||
# rubocop:enable Layout/LineLength
|
||||
DEFAULT_PREFERENCES = '{"dark_theme":false, "diffing":false, "register_speckle_entity": false}'
|
||||
DEFAULT_PREFERENCES = '{"dark_theme":false, "diffing":false, "register_speckle_entity": false, "fe2": false}'
|
||||
|
||||
# @param sketchup_model [Sketchup::Model] active model.
|
||||
def self.read_preferences(sketchup_model)
|
||||
@@ -34,10 +34,16 @@ module SpeckleConnector
|
||||
def self.data_complete?(row_data)
|
||||
return false if row_data.empty?
|
||||
|
||||
data = JSON.parse(row_data.first.first)
|
||||
return false if data['dark_theme'].nil? || data['diffing'].nil? || data['register_speckle_entity'].nil?
|
||||
begin
|
||||
data = JSON.parse(row_data.first.first)
|
||||
if data['dark_theme'].nil? || data['fe2'].nil? || data['diffing'].nil? || data['register_speckle_entity'].nil?
|
||||
return false
|
||||
end
|
||||
|
||||
true
|
||||
true
|
||||
rescue StandardError
|
||||
false
|
||||
end
|
||||
end
|
||||
|
||||
# Validates current preferences. If there are incomplete data then this method resets it with default preferences.
|
||||
@@ -65,11 +71,13 @@ module SpeckleConnector
|
||||
data_hash = JSON.parse(row_data).to_h
|
||||
# Get current theme value
|
||||
dark_theme = data_hash['dark_theme']
|
||||
fe2 = data_hash['fe2']
|
||||
diffing = data_hash['diffing']
|
||||
register_speckle_entity = data_hash['register_speckle_entity']
|
||||
|
||||
{
|
||||
dark_theme: dark_theme,
|
||||
fe2: fe2,
|
||||
diffing: diffing,
|
||||
register_speckle_entity: register_speckle_entity
|
||||
}.freeze
|
||||
|
||||
@@ -136,6 +136,15 @@ module SpeckleConnector
|
||||
next if (entity.is_a?(Sketchup::Face) || entity.is_a?(Sketchup::Edge)) &&
|
||||
!state.user_state.user_preferences[:register_speckle_entity]
|
||||
|
||||
if entity.is_a?(Sketchup::ComponentDefinition)
|
||||
definition = speckle_object['definition'] || speckle_object['@block_definition'] ||
|
||||
speckle_object['block_definition']
|
||||
if definition
|
||||
speckle_id = definition['id']
|
||||
speckle_type = definition['speckle_type']
|
||||
end
|
||||
end
|
||||
|
||||
ent = SpeckleEntity.new(entity, speckle_id, application_id, speckle_type, children, [stream_id])
|
||||
ent.write_initial_base_data
|
||||
speckle_state = speckle_state.with_speckle_entity(ent)
|
||||
|
||||
@@ -36,6 +36,27 @@ module SpeckleConnector
|
||||
end
|
||||
# rubocop:enable Metrics/ParameterLists
|
||||
|
||||
def self.to_native(state, wall, layer, entities, &convert_to_native)
|
||||
obj = Other::DisplayValue.collect_definition_geometries(wall)
|
||||
obj['name'] = Other::DisplayValue.get_definition_name(obj)
|
||||
|
||||
state, _definitions = Other::BlockDefinition.to_native(
|
||||
state, obj, layer, entities, &convert_to_native
|
||||
)
|
||||
|
||||
definition = state.sketchup_state.sketchup_model.definitions[Other::BlockDefinition.get_definition_name(obj)]
|
||||
|
||||
Other::BlockInstance.find_and_erase_existing_instance(definition, obj['id'], obj['applicationId'])
|
||||
t_arr = obj['transform']
|
||||
transform = t_arr.nil? ? Geom::Transformation.new : Other::Transform.to_native(t_arr, obj['units'])
|
||||
instance = entities.add_instance(definition, transform)
|
||||
instance.name = Other::DisplayValue.get_instance_name(obj['name']) unless obj['name'].nil?
|
||||
instance.layer = layer unless layer.nil?
|
||||
# Align instance axes that created from display value. (without any transform)
|
||||
# BlockInstance.align_instance_axes(instance)
|
||||
return state, [instance, definition]
|
||||
end
|
||||
|
||||
# @param face [Sketchup::Face] face to get speckle schema for wall.
|
||||
def self.to_speckle_schema(speckle_state, face, units, global_transformation: nil)
|
||||
base_line = Geometry::Line.base_line_from_face(face, units, global_transformation: global_transformation)
|
||||
|
||||
@@ -121,9 +121,9 @@ module SpeckleConnector
|
||||
mesh_layer_name = SketchupModel::Query::Layer.entity_layer_from_path(mesh['layer'])
|
||||
mesh_layer = state.sketchup_state.sketchup_model.layers.to_a.find { |l| l.display_name == mesh_layer_name }
|
||||
# Merge only added faces in this scope
|
||||
if model_preferences[:merge_coplanar_faces]
|
||||
added_faces = Converters::CleanUp.merge_coplanar_faces(added_faces)
|
||||
end
|
||||
# if model_preferences[:merge_coplanar_faces]
|
||||
# added_faces = Converters::CleanUp.merge_coplanar_faces(added_faces)
|
||||
# end
|
||||
added_faces.each do |face|
|
||||
face.layer = mesh_layer unless mesh_layer.nil?
|
||||
# Smooth edges if they already soft
|
||||
|
||||
@@ -83,13 +83,19 @@ module SpeckleConnector
|
||||
|
||||
elements = obj['elements'] || obj['@elements']
|
||||
|
||||
if !elements.nil? && elements.is_a?(Array)
|
||||
elements.each do |element|
|
||||
# Mullions is a special case here, they are extracted as base object with @displayValue from revit..
|
||||
if element['@displayValue'].nil?
|
||||
obj['geometry'].append(element)
|
||||
else
|
||||
obj['geometry'] += element['@displayValue']
|
||||
# if only elements are there then assign only elements, there are some cases that RevitWalls can only
|
||||
# have elements instead of display value
|
||||
if obj['geometry'].nil? && !elements.nil?
|
||||
obj['geometry'] = elements
|
||||
else
|
||||
if !elements.nil? && elements.is_a?(Array)
|
||||
elements.each do |element|
|
||||
# Mullions is a special case here, they are extracted as base object with @displayValue from revit..
|
||||
if element['@displayValue'].nil?
|
||||
obj['geometry'].append(element)
|
||||
else
|
||||
obj['geometry'] += element['@displayValue']
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -15,8 +15,10 @@ module SpeckleConnector
|
||||
family = def_obj['family']
|
||||
type = def_obj['type']
|
||||
category = def_obj['category']
|
||||
element_id = def_obj['elementId']
|
||||
id = def_obj['id']
|
||||
|
||||
return "#{family}-#{type}-#{category}-#{def_obj['elementId']}"
|
||||
return "#{family}-#{type}-#{category}-#{element_id}-#{id}"
|
||||
end
|
||||
|
||||
def self.to_native(state, definition, layer, entities, &convert_to_native)
|
||||
|
||||
@@ -66,6 +66,13 @@ module SpeckleConnector
|
||||
|
||||
def self.to_native(state, model_collection, layer, entities, &convert_to_native)
|
||||
elements = model_collection['elements']
|
||||
views = model_collection['@Views']
|
||||
if views
|
||||
views.each do |view|
|
||||
new_state, _converted_entities = convert_to_native.call(state, view, layer, entities)
|
||||
state = new_state
|
||||
end
|
||||
end
|
||||
|
||||
elements.each do |element|
|
||||
new_state, _converted_entities = convert_to_native.call(state, element, layer, entities)
|
||||
|
||||
+15
-7
@@ -15,7 +15,7 @@
|
||||
>
|
||||
<v-tabs-slider class="mx-sm-1"></v-tabs-slider>
|
||||
<v-tab href="#streams">
|
||||
{{"Streams"}}
|
||||
{{ streamsText }}
|
||||
</v-tab>
|
||||
<v-tab href="#mapper">
|
||||
{{"Mapper"}}
|
||||
@@ -88,7 +88,7 @@
|
||||
<v-text-field
|
||||
v-model="streamSearchQuery"
|
||||
prepend-inner-icon="mdi-magnify"
|
||||
label="Search streams"
|
||||
:label="searchText"
|
||||
background-color="background"
|
||||
hide-details
|
||||
clearable
|
||||
@@ -101,6 +101,7 @@
|
||||
</v-container>
|
||||
<create-stream-dialog
|
||||
v-if="accounts().length !== 0"
|
||||
:is-f-e2="preferences && preferences.user && preferences.user.fe2"
|
||||
:account-id="activeAccount().userInfo.id"
|
||||
:server-url="activeAccount().serverInfo.url"
|
||||
/>
|
||||
@@ -115,7 +116,7 @@
|
||||
</v-tab-item>
|
||||
<v-tab-item :key="2" value="mapper">
|
||||
<v-card flat>
|
||||
<mapper></mapper>
|
||||
<mapper :stream-text="streamText" :branch-text="branchText"></mapper>
|
||||
</v-card>
|
||||
</v-tab-item>
|
||||
</v-tabs-items>
|
||||
@@ -174,7 +175,7 @@ export default {
|
||||
size: {
|
||||
type: Number,
|
||||
default: 42
|
||||
},
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
@@ -183,7 +184,11 @@ export default {
|
||||
createStreamByIdDialog: false,
|
||||
createStreamByIdText: "",
|
||||
preferences: {},
|
||||
tab: "streams"
|
||||
tab: "streams",
|
||||
searchText: '',
|
||||
streamsText: 'Streams',
|
||||
streamText: 'Stream',
|
||||
branchText: 'Branch'
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
@@ -209,8 +214,11 @@ export default {
|
||||
})
|
||||
|
||||
bus.$on('update-preferences', async (preferences) => {
|
||||
let prefs = JSON.parse(preferences)
|
||||
this.preferences = prefs
|
||||
this.preferences = JSON.parse(preferences)
|
||||
this.searchText = this.preferences.user.fe2 ? 'Search projects' : 'Search streams'
|
||||
this.streamsText = this.preferences.user.fe2 ? 'Projects' : 'Streams'
|
||||
this.streamText = this.preferences.user.fe2 ? 'Project' : 'Stream'
|
||||
this.branchText = this.preferences.user.fe2 ? 'Model' : 'Branch'
|
||||
this.$vuetify.theme.dark = this.preferences.user.dark_theme
|
||||
})
|
||||
|
||||
|
||||
@@ -89,7 +89,7 @@
|
||||
</v-container>
|
||||
</v-expansion-panel-header>
|
||||
<v-expansion-panel-content>
|
||||
<mapper-source :source-state="this.sourceState"/>
|
||||
<mapper-source :stream-text="streamText" :branch-text="branchText" :source-state="this.sourceState"/>
|
||||
</v-expansion-panel-content>
|
||||
</v-expansion-panel>
|
||||
|
||||
@@ -300,6 +300,16 @@ global.mappedEntitiesUpdated = function (mappedEntities) {
|
||||
|
||||
export default {
|
||||
name: "Mapper",
|
||||
props: {
|
||||
streamText: {
|
||||
type: String,
|
||||
default: ''
|
||||
},
|
||||
branchText: {
|
||||
type: String,
|
||||
default: ''
|
||||
}
|
||||
},
|
||||
components: {
|
||||
MapperSource: () => import('@/components/MapperSource.vue'),
|
||||
GlobalToast: () => import('@/components/GlobalToast'),
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<v-container class="pa-0">
|
||||
<v-autocomplete
|
||||
v-model="sourceStreamId"
|
||||
label="Stream"
|
||||
:label="streamText"
|
||||
:items="allStreamsList"
|
||||
item-text="name"
|
||||
item-value="id"
|
||||
@@ -12,7 +12,7 @@
|
||||
<v-autocomplete
|
||||
v-model="sourceBranchId"
|
||||
class="pt-0 mb-n5"
|
||||
label="Branch"
|
||||
:label="branchText"
|
||||
:items="allBranchesList"
|
||||
:disabled="sourceStreamId === null"
|
||||
item-text="name"
|
||||
@@ -63,6 +63,14 @@ export default {
|
||||
props: {
|
||||
streamSearchQuery: { type: String, default: null },
|
||||
sourceState: { type: String, default: 'Not Set' },
|
||||
streamText: {
|
||||
type: String,
|
||||
default: ''
|
||||
},
|
||||
branchText: {
|
||||
type: String,
|
||||
default: ''
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
<v-toolbar-title class="ml-0" style="position: relative; left: -10px">
|
||||
<!-- Uncomment when pinning is in place and add style="position: relative; left: -10px" to the element above :) -->
|
||||
<v-btn
|
||||
v-tooltip="'Pin this stream - it will be saved to this file.'"
|
||||
v-tooltip="`Pin this ${streamText.toLowerCase()} - it will be saved to this file.`"
|
||||
icon
|
||||
x-small
|
||||
@click="toggleSavedStream"
|
||||
@@ -66,7 +66,11 @@
|
||||
<template #activator="{ on, attrs }">
|
||||
<v-slide-x-transition>
|
||||
<div v-show="hover">
|
||||
<create-branch-dialog :stream-name="stream.name" :stream-id="streamId"/>
|
||||
<create-branch-dialog
|
||||
:is-f-e2="preferences && preferences.user && preferences.user.fe2"
|
||||
:stream-name="stream.name"
|
||||
:stream-id="streamId"
|
||||
/>
|
||||
</div>
|
||||
</v-slide-x-transition>
|
||||
<v-chip v-if="stream.branches" small v-bind="attrs" class="mr-1" v-on="on">
|
||||
@@ -133,7 +137,7 @@
|
||||
hide-details
|
||||
dense
|
||||
flat
|
||||
placeholder="Write your commit message here"
|
||||
:placeholder="`Write your ${commitText.toLowerCase()} message here`"
|
||||
/>
|
||||
</div>
|
||||
</v-slide-y-transition>
|
||||
@@ -204,7 +208,11 @@ export default {
|
||||
commitId: 'latest',
|
||||
commitMessage: null,
|
||||
invalid: false,
|
||||
diffing: false
|
||||
diffing: false,
|
||||
streamText: '',
|
||||
branchText: '',
|
||||
commitText: '',
|
||||
preferences: {}
|
||||
}
|
||||
},
|
||||
apollo: {
|
||||
@@ -286,6 +294,16 @@ export default {
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
bus.$on('update-preferences', async (preferences) => {
|
||||
const pref = JSON.parse(preferences)
|
||||
this.preferences = pref
|
||||
this.streamText = pref.user.fe2 ? 'Project' : 'Stream'
|
||||
this.branchText = pref.user.fe2 ? 'Model' : 'Branch'
|
||||
this.commitText = pref.user.fe2 ? 'Version' : 'Commit'
|
||||
})
|
||||
// Collect preferences to render UI according to it
|
||||
sketchup.exec({name: "collect_preferences", data: {}})
|
||||
|
||||
bus.$on(`deactivate-diffing-${this.streamId}`, () => {
|
||||
this.diffing = false
|
||||
})
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<v-dialog v-model="showCreateBranch">
|
||||
<template #activator="{ on: dialog, attrs }">
|
||||
<v-btn
|
||||
v-tooltip="'Create Branch'"
|
||||
v-tooltip="`Create ${isFE2 ? 'Model' : 'Branch'}`"
|
||||
icon x-small class="ml-0 mr-1"
|
||||
v-bind="attrs"
|
||||
v-on="{...dialog}"
|
||||
@@ -15,10 +15,10 @@
|
||||
</template>
|
||||
<v-card>
|
||||
<v-card-title class="text-h5 mb-1">
|
||||
Create a New Branch
|
||||
{{ `Create a New ${isFE2 ? 'Model' : 'Branch'}` }}
|
||||
</v-card-title>
|
||||
<v-card-subtitle class="py-0 my-0 font-italic">
|
||||
under {{ streamName }} stream
|
||||
{{ `under ${streamName} ${isFE2 ? 'project' : 'stream'}` }}
|
||||
</v-card-subtitle>
|
||||
<v-container class="px-6" pb-0>
|
||||
<v-text-field
|
||||
@@ -27,7 +27,7 @@
|
||||
hide-details
|
||||
dense
|
||||
flat
|
||||
placeholder="Branch Name"
|
||||
:placeholder="`${isFE2 ? 'Model' : 'Branch'} Name`"
|
||||
/>
|
||||
<v-text-field
|
||||
v-model="description"
|
||||
@@ -75,6 +75,14 @@ export default {
|
||||
streamName: {
|
||||
type: String,
|
||||
default: null
|
||||
},
|
||||
isFE2: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
branchTooltipName: {
|
||||
type: String,
|
||||
default: ''
|
||||
}
|
||||
},
|
||||
data() {
|
||||
|
||||
@@ -16,13 +16,14 @@
|
||||
left
|
||||
>
|
||||
mdi-plus-circle
|
||||
</v-icon>Create New Stream
|
||||
</v-icon>
|
||||
{{ `Create New ${isFE2 ? 'Project': 'Stream'}` }}
|
||||
</v-btn>
|
||||
</template>
|
||||
|
||||
<v-card>
|
||||
<v-card-title class="text-h5">
|
||||
Create a New Stream
|
||||
{{ `Create a New ${isFE2 ? 'Project' : 'Stream'}` }}
|
||||
</v-card-title>
|
||||
<v-container class="px-6" pb-0>
|
||||
<!--
|
||||
@@ -55,7 +56,7 @@
|
||||
hide-details
|
||||
dense
|
||||
flat
|
||||
placeholder="Stream Name (Optional)"
|
||||
:placeholder="`${isFE2 ? 'Project' : 'Stream'} Name (Optional)`"
|
||||
/>
|
||||
<v-text-field
|
||||
v-model="description"
|
||||
@@ -67,7 +68,7 @@
|
||||
/>
|
||||
<v-switch
|
||||
v-model="privateStream"
|
||||
:label="'Private Stream'"
|
||||
:label="`Private ${isFE2 ? 'Project' : 'Stream'}`"
|
||||
></v-switch>
|
||||
</v-container>
|
||||
|
||||
@@ -169,6 +170,10 @@ export default {
|
||||
serverUrl: {
|
||||
type: String,
|
||||
default: null
|
||||
},
|
||||
isFE2: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
}
|
||||
},
|
||||
data() {
|
||||
@@ -200,7 +205,7 @@ export default {
|
||||
},
|
||||
async getStream(){
|
||||
try {
|
||||
const streamWrapper = new StreamWrapper(this.createStreamByIdText, this.accountId, this.serverUrl)
|
||||
const streamWrapper = new StreamWrapper(this.createStreamByIdText, this.accountId, this.serverUrl, this.isFE2)
|
||||
let res = await this.$apollo.query({
|
||||
query: gql`
|
||||
query Stream($id: String!){
|
||||
|
||||
@@ -16,14 +16,25 @@
|
||||
Settings
|
||||
</v-card-title>
|
||||
<v-container class="px-6" pb-0>
|
||||
<!-- Switch Theme -->
|
||||
|
||||
<!-- User preferences -->
|
||||
<div class="sm1 mt-3">User Preferences</div>
|
||||
<v-divider class="mb-2"/>
|
||||
|
||||
<!-- Switch Theme -->
|
||||
<v-btn icon small class="mx-1" @click="switchTheme">
|
||||
<v-icon>mdi-theme-light-dark</v-icon>
|
||||
</v-btn>
|
||||
<span>Color Mode</span>
|
||||
|
||||
<!-- FE2 -->
|
||||
<v-switch
|
||||
:input-value="fe2"
|
||||
class="pt-3 mt-n2 mb-n7"
|
||||
:label="'FE2'"
|
||||
@change="fe2Handler"
|
||||
/>
|
||||
|
||||
<!-- Register objects as Speckle Entity on send/receive -->
|
||||
<v-switch
|
||||
:input-value="registerSpeckleEntity"
|
||||
@@ -133,6 +144,7 @@ export default {
|
||||
includeComponentAttributes: this.preferences.model.include_component_entity_attributes,
|
||||
mergeCoplanarFaces: this.preferences.model.merge_coplanar_faces,
|
||||
diffing: this.preferences.user.diffing,
|
||||
fe2: this.preferences.user.fe2,
|
||||
registerSpeckleEntity: this.preferences.user.register_speckle_entity
|
||||
}
|
||||
},
|
||||
@@ -147,6 +159,7 @@ export default {
|
||||
this.includeComponentAttributes = newValue.model.include_component_entity_attributes
|
||||
this.mergeCoplanarFaces = newValue.model.merge_coplanar_faces
|
||||
this.diffing = newValue.user.diffing
|
||||
this.fe2 = newValue.user.fe2
|
||||
this.registerSpeckleEntity = newValue.user.register_speckle_entity
|
||||
},
|
||||
deep: true,
|
||||
@@ -161,6 +174,15 @@ export default {
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
fe2Handler(newValue){
|
||||
this.fe2 = !!newValue
|
||||
sketchup.exec({
|
||||
name: "user_preferences_updated",
|
||||
data: {preference_hash: "configSketchup", preference: "fe2", value: this.fe2}
|
||||
})
|
||||
this.$mixpanel.track('Connector Action', { name: 'Toggle FE2' })
|
||||
sketchup.exec({name: "collect_preferences", data: {}})
|
||||
},
|
||||
diffingHandler(newValue){
|
||||
this.diffing = !!newValue
|
||||
sketchup.exec({
|
||||
|
||||
@@ -1,7 +1,11 @@
|
||||
require('url')
|
||||
|
||||
export class StreamWrapper {
|
||||
constructor(streamIdOrUrl, accountId, serverUrl) {
|
||||
constructor(streamIdOrUrl, accountId, serverUrl, isFE2) {
|
||||
this.isFE2 = isFE2
|
||||
this.streamsKey = this.isFE2 ? 'projects/': 'streams/'
|
||||
this.branchesKey = this.isFE2 ? 'models/': 'branches/'
|
||||
this.commitsKey = this.isFE2 ? 'versions/': 'commits/'
|
||||
this.originalOutput = streamIdOrUrl
|
||||
try {
|
||||
this.streamWrapperFromUrl(streamIdOrUrl)
|
||||
@@ -18,7 +22,7 @@ export class StreamWrapper {
|
||||
this.segments = this.url.pathname.split('/').map((segment) => segment + '/')
|
||||
this.serverUrl = this.url.origin
|
||||
|
||||
if (this.segments.length >= 4 && this.segments[3]?.toLowerCase() === "branches/"){
|
||||
if (this.segments.length >= 4 && this.segments[3]?.toLowerCase() === this.branchesKey){
|
||||
this.streamId = this.segments[2].replace("/", "")
|
||||
if (this.segments.length > 5)
|
||||
{
|
||||
@@ -32,7 +36,7 @@ export class StreamWrapper {
|
||||
} else {
|
||||
switch (this.segments.length){
|
||||
case 3: // ie http://speckle.server/streams/8fecc9aa6d
|
||||
if (this.segments[1].toLowerCase() === "streams/")
|
||||
if (this.segments[1].toLowerCase() === this.streamsKey)
|
||||
this.streamId = this.segments[2].replace("/", "");
|
||||
else
|
||||
throw new Error(`Cannot parse ${this.originalOutput} into a stream wrapper class`);
|
||||
@@ -48,7 +52,7 @@ export class StreamWrapper {
|
||||
break;
|
||||
case 5: // ie http://speckle.server/streams/8fecc9aa6d/commits/76a23d7179
|
||||
switch (this.segments[3].toLowerCase()){
|
||||
case "commits/":
|
||||
case this.commitsKey:
|
||||
this.streamId = this.segments[2].replace("/", "");
|
||||
this.commitId = this.segments[4].replace("/", "");
|
||||
break;
|
||||
@@ -57,7 +61,7 @@ export class StreamWrapper {
|
||||
this.branchName = this.segments[3].replace("/", "");
|
||||
this.commitId = this.segments[4].replace("/", "");
|
||||
break;
|
||||
case "branches/":
|
||||
case this.branchesKey:
|
||||
this.streamId = this.segments[2].replace("/", "");
|
||||
this.branchName = this.segments[4].replace("/", "");
|
||||
break;
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
elevation="0"
|
||||
@click="showMore"
|
||||
>
|
||||
More Streams
|
||||
{{ `More ${streamsText}` }}
|
||||
</v-btn>
|
||||
</div>
|
||||
</div>
|
||||
@@ -64,7 +64,8 @@ export default {
|
||||
data() {
|
||||
return {
|
||||
showMoreEnabled: true,
|
||||
savedStreams: []
|
||||
savedStreams: [],
|
||||
streamsText: ''
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
@@ -80,6 +81,14 @@ export default {
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
bus.$on('update-preferences', async (preferences) => {
|
||||
const pref = JSON.parse(preferences)
|
||||
this.streamsText = pref.user.fe2 ? 'Projects' : 'Streams'
|
||||
})
|
||||
|
||||
// Collect preferences to render UI according to it
|
||||
sketchup.exec({name: "collect_preferences", data: {}})
|
||||
|
||||
bus.$on("deactivate-diffing-except", (exceptedStreamId) => {
|
||||
this.savedStreams.forEach((streamId) => {
|
||||
if (streamId !== exceptedStreamId){
|
||||
|
||||
Reference in New Issue
Block a user