Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 9aea5ddc97 | |||
| 4d1333c302 | |||
| 9ca55f6f0e |
@@ -87,6 +87,30 @@ jobs:
|
||||
from: '"speckle-sharp-ci-tools/Installers/"'
|
||||
to: s3://speckle-releases/installers/
|
||||
|
||||
deploy-manager2:
|
||||
docker:
|
||||
- image: mcr.microsoft.com/dotnet/sdk:6.0
|
||||
parameters:
|
||||
slug:
|
||||
type: string
|
||||
os:
|
||||
type: string
|
||||
extension:
|
||||
type: string
|
||||
steps:
|
||||
- checkout
|
||||
- attach_workspace:
|
||||
at: ./
|
||||
- run:
|
||||
name: Install Manager Feed CLI
|
||||
command: dotnet tool install --global Speckle.Manager.Feed
|
||||
- run:
|
||||
name: Upload new version
|
||||
command: |
|
||||
TAG=$(if [ "${CIRCLE_TAG}" ]; then echo $CIRCLE_TAG; else echo "0.0.0"; fi;)
|
||||
SEMVER=$(echo "$TAG" | sed -e 's/\/[a-zA-Z-]*//')
|
||||
/root/.dotnet/tools/Speckle.Manager.Feed deploy -s << parameters.slug >> -v ${SEMVER} -u https://releases.speckle.dev/installers/<< parameters.slug >>/<< parameters.slug >>-${SEMVER}.<< parameters.extension >> -o << parameters.os >> -f speckle-sharp-ci-tools/Installers/<< parameters.slug >>/<< parameters.slug >>-${SEMVER}.<< parameters.extension >>
|
||||
|
||||
workflows:
|
||||
build-and-deploy:
|
||||
jobs:
|
||||
@@ -119,3 +143,17 @@ workflows:
|
||||
only: /([0-9]+)\.([0-9]+)\.([0-9]+)(?:-\w+)?$/
|
||||
branches:
|
||||
ignore: /.*/ # For testing only! /ci\/.*/
|
||||
|
||||
- deploy-manager2:
|
||||
slug: sketchup
|
||||
os: Win
|
||||
extension: exe
|
||||
requires:
|
||||
- get-ci-tools
|
||||
- build-ui
|
||||
- deploy
|
||||
filters:
|
||||
tags:
|
||||
only: /([0-9]+)\.([0-9]+)\.([0-9]+)(?:-\w+)?$/
|
||||
branches:
|
||||
ignore: /.*/ # For testing only! /ci\/.*/
|
||||
|
||||
@@ -24,6 +24,9 @@ speckle_connector/html
|
||||
/test/version_tmp/
|
||||
/tmp/
|
||||
|
||||
# IDE
|
||||
.idea
|
||||
|
||||
# Used by dotenv library to load environment variables.
|
||||
.env
|
||||
|
||||
|
||||
@@ -2,15 +2,13 @@
|
||||
|
||||
source "https://rubygems.org"
|
||||
|
||||
# gem "rake", "~> 13.0"
|
||||
|
||||
gem "rubocop", "~> 1.7"
|
||||
|
||||
|
||||
group :development do
|
||||
gem "minitest"
|
||||
gem 'pry' # ruby console and debugger
|
||||
gem "sketchup-api-stubs"
|
||||
gem 'rake' # ruby make
|
||||
gem 'rubycritic', '~> 4.3', '>= 4.3.3', require: false
|
||||
gem "solargraph"
|
||||
gem "rubocop"
|
||||
gem 'skippy', '~> 0.4.1.a' # Aid with common SketchUp extension tasks.
|
||||
end
|
||||
|
||||
gem "sqlite3", "~> 1.4"
|
||||
|
||||
+112
-45
@@ -1,74 +1,141 @@
|
||||
GEM
|
||||
remote: https://rubygems.org/
|
||||
specs:
|
||||
addressable (2.8.0)
|
||||
public_suffix (>= 2.0.2, < 5.0)
|
||||
ast (2.4.2)
|
||||
axiom-types (0.1.1)
|
||||
descendants_tracker (~> 0.0.4)
|
||||
ice_nine (~> 0.11.0)
|
||||
thread_safe (~> 0.3, >= 0.3.1)
|
||||
backport (1.2.0)
|
||||
benchmark (0.1.1)
|
||||
diff-lcs (1.4.4)
|
||||
e2mmap (0.1.0)
|
||||
coderay (1.1.3)
|
||||
coercible (1.0.0)
|
||||
descendants_tracker (~> 0.0.1)
|
||||
descendants_tracker (0.0.4)
|
||||
thread_safe (~> 0.3, >= 0.3.1)
|
||||
docile (1.4.0)
|
||||
equalizer (0.0.11)
|
||||
erubi (1.11.0)
|
||||
flay (2.13.0)
|
||||
erubi (~> 1.10)
|
||||
path_expander (~> 1.0)
|
||||
ruby_parser (~> 3.0)
|
||||
sexp_processor (~> 4.0)
|
||||
flog (4.6.6)
|
||||
path_expander (~> 1.0)
|
||||
ruby_parser (~> 3.1, > 3.1.0)
|
||||
sexp_processor (~> 4.8)
|
||||
git (1.11.0)
|
||||
rchardet (~> 1.8)
|
||||
ice_nine (0.11.2)
|
||||
jaro_winkler (1.5.4)
|
||||
kramdown (2.3.1)
|
||||
rexml
|
||||
kramdown-parser-gfm (1.1.0)
|
||||
kramdown (~> 2.0)
|
||||
minitest (5.14.4)
|
||||
nokogiri (1.12.5-x64-mingw32)
|
||||
kwalify (0.7.2)
|
||||
launchy (2.5.0)
|
||||
addressable (~> 2.7)
|
||||
maruku (0.7.3)
|
||||
method_source (1.0.0)
|
||||
minitest (5.16.2)
|
||||
naturally (2.2.1)
|
||||
nokogiri (1.13.8-x64-mingw32)
|
||||
racc (~> 1.4)
|
||||
nokogiri (1.12.5-x86_64-linux)
|
||||
racc (~> 1.4)
|
||||
parallel (1.20.1)
|
||||
parser (3.0.2.0)
|
||||
parallel (1.22.1)
|
||||
parser (2.7.2.0)
|
||||
ast (~> 2.4.1)
|
||||
path_expander (1.1.1)
|
||||
pry (0.14.1)
|
||||
coderay (~> 1.1)
|
||||
method_source (~> 1.0)
|
||||
psych (3.3.2)
|
||||
public_suffix (4.0.7)
|
||||
racc (1.6.0)
|
||||
rainbow (3.0.0)
|
||||
regexp_parser (2.1.1)
|
||||
reverse_markdown (2.0.0)
|
||||
rainbow (3.1.1)
|
||||
rake (13.0.6)
|
||||
rchardet (1.8.0)
|
||||
reek (6.0.2)
|
||||
kwalify (~> 0.7.0)
|
||||
parser (>= 2.5.0.0, < 2.8, != 2.5.1.1)
|
||||
psych (~> 3.1)
|
||||
rainbow (>= 2.0, < 4.0)
|
||||
regexp_parser (2.5.0)
|
||||
reverse_markdown (1.4.0)
|
||||
nokogiri
|
||||
rexml (3.2.5)
|
||||
rubocop (1.19.1)
|
||||
rubocop (0.93.1)
|
||||
parallel (~> 1.10)
|
||||
parser (>= 3.0.0.0)
|
||||
parser (>= 2.7.1.5)
|
||||
rainbow (>= 2.2.2, < 4.0)
|
||||
regexp_parser (>= 1.8, < 3.0)
|
||||
regexp_parser (>= 1.8)
|
||||
rexml
|
||||
rubocop-ast (>= 1.9.1, < 2.0)
|
||||
rubocop-ast (>= 0.6.0)
|
||||
ruby-progressbar (~> 1.7)
|
||||
unicode-display_width (>= 1.4.0, < 3.0)
|
||||
rubocop-ast (1.11.0)
|
||||
parser (>= 3.0.1.1)
|
||||
unicode-display_width (>= 1.4.0, < 2.0)
|
||||
rubocop-ast (1.4.1)
|
||||
parser (>= 2.7.1.5)
|
||||
ruby-progressbar (1.11.0)
|
||||
sketchup-api-stubs (0.7.7)
|
||||
solargraph (0.43.0)
|
||||
backport (~> 1.2)
|
||||
benchmark
|
||||
ruby_parser (3.19.1)
|
||||
sexp_processor (~> 4.16)
|
||||
rubycritic (4.7.0)
|
||||
flay (~> 2.8)
|
||||
flog (~> 4.4)
|
||||
launchy (>= 2.0.0)
|
||||
parser (>= 2.6.0)
|
||||
rainbow (~> 3.0)
|
||||
reek (~> 6.0, < 7.0)
|
||||
ruby_parser (~> 3.8)
|
||||
simplecov (>= 0.17.0)
|
||||
tty-which (~> 0.4.0)
|
||||
virtus (~> 1.0)
|
||||
sexp_processor (4.16.1)
|
||||
simplecov (0.21.2)
|
||||
docile (~> 1.1)
|
||||
simplecov-html (~> 0.11)
|
||||
simplecov_json_formatter (~> 0.1)
|
||||
simplecov-html (0.12.3)
|
||||
simplecov_json_formatter (0.1.4)
|
||||
sketchup-api-stubs (0.7.8)
|
||||
skippy (0.4.3.a)
|
||||
git (~> 1.3)
|
||||
naturally (~> 2.1)
|
||||
thor (~> 0.19)
|
||||
solargraph (0.38.0)
|
||||
backport (~> 1.1)
|
||||
bundler (>= 1.17.2)
|
||||
diff-lcs (~> 1.4)
|
||||
e2mmap
|
||||
jaro_winkler (~> 1.5)
|
||||
kramdown (~> 2.3)
|
||||
kramdown-parser-gfm (~> 1.1)
|
||||
parser (~> 3.0)
|
||||
reverse_markdown (>= 1.0.5, < 3)
|
||||
rubocop (>= 0.52)
|
||||
thor (~> 1.0)
|
||||
maruku (~> 0.7, >= 0.7.3)
|
||||
nokogiri (~> 1.9, >= 1.9.1)
|
||||
parser (~> 2.3)
|
||||
reverse_markdown (~> 1.0, >= 1.0.5)
|
||||
rubocop (~> 0.52)
|
||||
thor (~> 0.19, >= 0.19.4)
|
||||
tilt (~> 2.0)
|
||||
yard (~> 0.9, >= 0.9.24)
|
||||
sqlite3 (1.4.2)
|
||||
thor (1.1.0)
|
||||
tilt (2.0.10)
|
||||
unicode-display_width (2.0.0)
|
||||
yard (0.9.26)
|
||||
yard (~> 0.9)
|
||||
thor (0.20.3)
|
||||
thread_safe (0.3.6)
|
||||
tilt (2.0.11)
|
||||
tty-which (0.4.2)
|
||||
unicode-display_width (1.8.0)
|
||||
virtus (1.0.5)
|
||||
axiom-types (~> 0.1)
|
||||
coercible (~> 1.0)
|
||||
descendants_tracker (~> 0.0, >= 0.0.3)
|
||||
equalizer (~> 0.0, >= 0.0.9)
|
||||
webrick (1.7.0)
|
||||
yard (0.9.28)
|
||||
webrick (~> 1.7.0)
|
||||
|
||||
PLATFORMS
|
||||
x64-mingw32
|
||||
x86_64-linux
|
||||
|
||||
DEPENDENCIES
|
||||
minitest
|
||||
rubocop (~> 1.7)
|
||||
pry
|
||||
rake
|
||||
rubocop
|
||||
rubycritic (~> 4.3, >= 4.3.3)
|
||||
sketchup-api-stubs
|
||||
skippy (~> 0.4.1.a)
|
||||
solargraph
|
||||
sqlite3 (~> 1.4)
|
||||
|
||||
BUNDLED WITH
|
||||
2.2.26
|
||||
2.3.20
|
||||
|
||||
@@ -28,14 +28,6 @@ module SpeckleSystems::SpeckleConnector
|
||||
accts.select { |acc| acc["isDefault"] }[0] || accts[0]
|
||||
end
|
||||
|
||||
def self.get_suuid
|
||||
dir = _get_speckle_dir
|
||||
suuid_path = File.join(dir, "suuid")
|
||||
return unless File.exist?(suuid_path)
|
||||
|
||||
File.read(suuid_path)
|
||||
end
|
||||
|
||||
def self._get_speckle_dir
|
||||
speckle_dir =
|
||||
case Sketchup.platform
|
||||
|
||||
@@ -119,9 +119,127 @@ module SpeckleSystems::SpeckleConnector::ToNative
|
||||
native_mesh.add_polygon(indices.map { |index| points[index] })
|
||||
end
|
||||
entities.add_faces_from_mesh(native_mesh, 4, material_to_native(mesh["renderMaterial"]))
|
||||
merge_coplanar_faces(entities)
|
||||
native_mesh
|
||||
end
|
||||
|
||||
# Removes coplanar entities from the given entities.
|
||||
# @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 merge_coplanar_faces(entities)
|
||||
edges = []
|
||||
faces = entities.collect { |entity| entity if entity.is_a? Sketchup::Face }.compact
|
||||
faces.each { |face| face.edges.each { |edge| edges << edge } }
|
||||
edges.compact!
|
||||
edges.each { |edge| remove_edge_have_coplanar_faces(edge, false ) }
|
||||
end
|
||||
|
||||
# Detect edges to remove by checking following controls respectively;
|
||||
# - Upcoming Sketchup entity is Sketchup::Edge or not.
|
||||
# - Whether edge has 2 face or not.
|
||||
# - Whether faces are duplicated or not.
|
||||
# - Whether edges safe to merge or not.
|
||||
# - Whether faces have same material or not.
|
||||
# - 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 ignore_materials [Boolean] whether ignore materials or not.
|
||||
# Returns true if the given edge separating two coplanar faces.
|
||||
# Return false otherwise.
|
||||
def remove_edge_have_coplanar_faces(edge, ignore_materials)
|
||||
return false unless edge.valid? && edge.is_a?(Sketchup::Edge)
|
||||
return false unless edge.faces.size == 2
|
||||
|
||||
face1, face2 = edge.faces
|
||||
|
||||
return false if face_duplicate?(face1, face2)
|
||||
# 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
|
||||
if face1.material == face2.material && face1.back_material == face2.back_material
|
||||
# Verify UV mapping match.
|
||||
unless face1.material.nil? || face1.material.texture.nil?
|
||||
return false unless continuous_uv?(face1, face2, edge)
|
||||
end
|
||||
else
|
||||
return false
|
||||
end
|
||||
end
|
||||
# Check faces are coplanar or not.
|
||||
return false unless faces_coplanar?(face1, face2)
|
||||
edge.erase!
|
||||
true
|
||||
end
|
||||
|
||||
# Determines if two faces are overlapped.
|
||||
def face_duplicate?(face1, face2, overlapping = false)
|
||||
return false if face1 == face2
|
||||
|
||||
v1 = face1.outer_loop.vertices
|
||||
v2 = face2.outer_loop.vertices
|
||||
return true if (v1 - v2).empty? && (v2 - v1).empty?
|
||||
|
||||
if overlapping && (v2 - v1).empty?
|
||||
edges = (face2.outer_loop.edges - face1.outer_loop.edges)
|
||||
unless edges.empty?
|
||||
point = edges[0].start.position.offset(edges[0].line[1], 0.01)
|
||||
return true if face1.classify_point(point) <= 4
|
||||
end
|
||||
end
|
||||
false
|
||||
end
|
||||
|
||||
# Checks the given edge for potential problems if the connected faces would
|
||||
# be merged.
|
||||
def edge_safe_to_merge?(edge)
|
||||
edge.faces.all? { |face| self.face_safe_to_merge?(face) }
|
||||
end
|
||||
|
||||
# Returns true if the two faces connected by the edge has continuous UV mapping.
|
||||
# UV's are normalized to 0.0..1.0 before comparison.
|
||||
def continuous_uv?(face1, face2, edge)
|
||||
tw = Sketchup.create_texture_writer
|
||||
uvh1 = face1.get_UVHelper(true, true, tw)
|
||||
uvh2 = face2.get_UVHelper(true, true, tw)
|
||||
p1 = edge.start.position
|
||||
p2 = edge.end.position
|
||||
self.uv_equal?(uvh1.get_front_UVQ(p1), uvh2.get_front_UVQ(p1)) &&
|
||||
self.uv_equal?(uvh1.get_front_UVQ(p2), uvh2.get_front_UVQ(p2)) &&
|
||||
self.uv_equal?(uvh1.get_back_UVQ(p1), uvh2.get_back_UVQ(p1)) &&
|
||||
self.uv_equal?(uvh1.get_back_UVQ(p2), uvh2.get_back_UVQ(p2))
|
||||
end
|
||||
|
||||
# Normalize UV's to 0.0..1.0 and compare them.
|
||||
def uv_equal?(uvq1, uvq2)
|
||||
uv1 = uvq1.to_a.map { |n| n % 1 }
|
||||
uv2 = uvq2.to_a.map { |n| n % 1 }
|
||||
uv1 == uv2
|
||||
end
|
||||
|
||||
# Validates that the given face can be merged with other faces without causing
|
||||
# problems.
|
||||
def face_safe_to_merge?(face)
|
||||
stack = face.outer_loop.edges
|
||||
edge = stack.shift
|
||||
direction = edge.line[1]
|
||||
until stack.empty?
|
||||
edge = stack.shift
|
||||
return true unless edge.line[1].parallel?(direction)
|
||||
end
|
||||
false
|
||||
end
|
||||
|
||||
# Determines if two faces are coplanar.
|
||||
def faces_coplanar?(face1, face2)
|
||||
vertices = face1.vertices + face2.vertices
|
||||
plane = Geom.fit_plane_to_points(vertices)
|
||||
vertices.all? { |v| v.position.on_plane?(plane) }
|
||||
end
|
||||
|
||||
|
||||
def _hidden_edges_mesh_to_native_mesh(mesh, entities)
|
||||
native_mesh = Geom::PolygonMesh.new(mesh["vertices"].count / 3)
|
||||
points = []
|
||||
|
||||
@@ -147,7 +147,7 @@ module SpeckleSystems::SpeckleConnector
|
||||
|
||||
def self.init_local_accounts
|
||||
puts("Initialisation of Speckle accounts requested by plugin")
|
||||
@dialog.execute_script("loadAccounts(#{Accounts.load_accounts.to_json}, #{Accounts.get_suuid.to_json})")
|
||||
@dialog.execute_script("loadAccounts(#{Accounts.load_accounts.to_json})")
|
||||
end
|
||||
|
||||
def self.reload_accounts
|
||||
|
||||
Generated
+1
@@ -5,6 +5,7 @@
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "ui",
|
||||
"version": "0.1.0",
|
||||
"dependencies": {
|
||||
"@speckle/objectloader": "^2.6.0",
|
||||
|
||||
+6
-8
@@ -96,16 +96,14 @@ import { bus } from './main'
|
||||
import userQuery from './graphql/user.gql'
|
||||
import { onLogin } from './vue-apollo'
|
||||
|
||||
global.loadAccounts = function (accounts, suuid) {
|
||||
console.log('>>> SpeckleSketchup: Loading accounts', accounts, `suuid: ${suuid}`)
|
||||
global.loadAccounts = function (accounts) {
|
||||
console.log('>>> SpeckleSketchup: Loading accounts', accounts)
|
||||
localStorage.setItem('localAccounts', JSON.stringify(accounts))
|
||||
if (suuid) {
|
||||
localStorage.setItem('suuid', suuid)
|
||||
global.setSelectedAccount(accounts.find((acct) => acct['isDefault']))
|
||||
let uuid = localStorage.getItem('uuid')
|
||||
if (uuid) {
|
||||
global.setSelectedAccount(accounts.find((acct) => acct['userInfo']['id'] == uuid))
|
||||
} else {
|
||||
global.setSelectedAccount(
|
||||
accounts.find((acct) => acct['userInfo']['id'] == localStorage.getItem('uuid'))
|
||||
)
|
||||
global.setSelectedAccount(accounts.find((acct) => acct['isDefault']))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -9,7 +9,6 @@ query {
|
||||
verified
|
||||
profiles
|
||||
role
|
||||
suuid
|
||||
streams {
|
||||
totalCount
|
||||
}
|
||||
|
||||
@@ -9,6 +9,5 @@ query User($id: String!) {
|
||||
verified
|
||||
profiles
|
||||
role
|
||||
suuid
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user