Fixed an issue which was driving me crazy regarding the progressive AO. The high depth delta limit was set as a uniform parameter which did not work well for all possible stream dimensions and sizes. One of the consequences were some ghastly halos around poles of any kind in streams of a particular range of dimensions. We dropped the uniform parameter and replaced it with the normalized sampling ray length. This works well in general, the halos are gone. There's only one downside, when the camera gets really close to objects, the AO range drops more than we'd want. However it's not very visible and it's something I can live with
This commit is contained in:
@@ -1,12 +1,6 @@
|
||||
#!/bin/bash
|
||||
set -eo pipefail
|
||||
|
||||
SHOULD_BUILD="${SHOULD_BUILD:-false}"
|
||||
if [[ "${SHOULD_BUILD}" != "true" ]]; then
|
||||
echo "Not building as the SHOULD_BUILD environment variable is not 'true'."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# enables building the test-deployment container with the same script
|
||||
# defaults to packages for minimal intervention in the ci config
|
||||
FOLDER="${FOLDER:-packages}"
|
||||
|
||||
@@ -5,3 +5,11 @@ DOCKER_IMAGE_TAG="speckle/speckle-${SPECKLE_SERVER_PACKAGE}"
|
||||
IMAGE_VERSION_TAG="${IMAGE_VERSION_TAG:-${CIRCLE_SHA1}}"
|
||||
# shellcheck disable=SC2034,SC2086
|
||||
DOCKER_FILE_NAME="$(echo ${DOCKER_IMAGE_TAG}_${IMAGE_VERSION_TAG} | sed -e 's/[^A-Za-z0-9._-]/_/g')"
|
||||
# shellcheck disable=SC2068,SC2046
|
||||
LAST_RELEASE="$(git describe --always --tags $(git rev-list --tags) | grep -E '^[0-9]+\.[0-9]+\.[0-9]+$' | head -n 1)"
|
||||
# shellcheck disable=SC2034
|
||||
NEXT_RELEASE="$(echo "${LAST_RELEASE}" | python -c "parts = input().split('.'); parts[-1] = str(int(parts[-1])+1); print('.'.join(parts))")"
|
||||
# shellcheck disable=SC2034
|
||||
BRANCH_NAME_TRUNCATED="$(echo "${CIRCLE_BRANCH}" | cut -c -50 | sed 's/[^a-zA-Z0-9_.-]/_/g')" # docker has a 128 character tag limit, so ensuring the branch name will be short enough
|
||||
# shellcheck disable=SC2034
|
||||
COMMIT_SHA1_TRUNCATED="$(echo "${CIRCLE_SHA1}" | cut -c -7)"
|
||||
|
||||
+24
-77
@@ -6,22 +6,16 @@ workflows:
|
||||
test-build:
|
||||
jobs:
|
||||
- test-server:
|
||||
filters: &filters-everything
|
||||
filters: &filters-allow-all
|
||||
tags:
|
||||
# run tests for any commit on any branch, including any tags
|
||||
only: /.*/
|
||||
|
||||
- get-version:
|
||||
filters: *filters-everything
|
||||
|
||||
- should-build:
|
||||
filters: *filters-everything
|
||||
|
||||
- should-publish:
|
||||
filters: *filters-everything
|
||||
filters: *filters-allow-all
|
||||
|
||||
- pre-commit:
|
||||
filters: *filters-everything
|
||||
filters: *filters-allow-all
|
||||
|
||||
- docker-build-server:
|
||||
filters: &filters-build
|
||||
@@ -30,47 +24,48 @@ workflows:
|
||||
requires:
|
||||
- test-server
|
||||
- get-version
|
||||
- should-build
|
||||
|
||||
- docker-build-frontend:
|
||||
filters: *filters-build
|
||||
requires:
|
||||
- get-version
|
||||
- should-build
|
||||
|
||||
- docker-build-webhooks:
|
||||
filters: *filters-build
|
||||
requires:
|
||||
- get-version
|
||||
- test-server
|
||||
- should-build
|
||||
|
||||
- docker-build-file-imports:
|
||||
filters: *filters-build
|
||||
requires:
|
||||
- get-version
|
||||
- test-server
|
||||
- should-build
|
||||
|
||||
- docker-build-previews:
|
||||
filters: *filters-build
|
||||
requires:
|
||||
- get-version
|
||||
- test-server
|
||||
- should-build
|
||||
|
||||
- docker-build-test-container:
|
||||
filters: *filters-build
|
||||
requires:
|
||||
- get-version
|
||||
- test-server
|
||||
- should-build
|
||||
|
||||
- docker-build-monitor-container:
|
||||
filters: *filters-build
|
||||
requires:
|
||||
- get-version
|
||||
- should-build
|
||||
|
||||
- publish-approval:
|
||||
type: approval
|
||||
filters: &filters-ignore-main-branch-or-all-tags
|
||||
branches:
|
||||
ignore: main
|
||||
tags:
|
||||
ignore: /.*/
|
||||
|
||||
- docker-publish-server:
|
||||
context: &docker-hub-context
|
||||
@@ -82,7 +77,7 @@ workflows:
|
||||
only: /.*/
|
||||
requires:
|
||||
- get-version
|
||||
- should-publish
|
||||
- publish-approval
|
||||
- docker-build-server
|
||||
- pre-commit
|
||||
|
||||
@@ -91,7 +86,7 @@ workflows:
|
||||
filters: *filters-publish
|
||||
requires:
|
||||
- get-version
|
||||
- should-publish
|
||||
- publish-approval
|
||||
- docker-build-frontend
|
||||
- pre-commit
|
||||
|
||||
@@ -100,7 +95,7 @@ workflows:
|
||||
filters: *filters-publish
|
||||
requires:
|
||||
- get-version
|
||||
- should-publish
|
||||
- publish-approval
|
||||
- docker-build-webhooks
|
||||
- pre-commit
|
||||
|
||||
@@ -109,7 +104,7 @@ workflows:
|
||||
filters: *filters-publish
|
||||
requires:
|
||||
- get-version
|
||||
- should-publish
|
||||
- publish-approval
|
||||
- docker-build-file-imports
|
||||
- pre-commit
|
||||
|
||||
@@ -118,7 +113,7 @@ workflows:
|
||||
filters: *filters-publish
|
||||
requires:
|
||||
- get-version
|
||||
- should-publish
|
||||
- publish-approval
|
||||
- docker-build-previews
|
||||
- pre-commit
|
||||
|
||||
@@ -127,7 +122,7 @@ workflows:
|
||||
filters: *filters-publish
|
||||
requires:
|
||||
- get-version
|
||||
- should-publish
|
||||
- publish-approval
|
||||
- docker-build-test-container
|
||||
- pre-commit
|
||||
|
||||
@@ -136,7 +131,7 @@ workflows:
|
||||
filters: *filters-publish
|
||||
requires:
|
||||
- get-version
|
||||
- should-publish
|
||||
- publish-approval
|
||||
- docker-build-monitor-container
|
||||
- pre-commit
|
||||
|
||||
@@ -150,7 +145,7 @@ workflows:
|
||||
only: &filters-tag /^[0-9]+\.[0-9]+\.[0-9]+$/
|
||||
requires:
|
||||
- get-version
|
||||
- should-publish
|
||||
- publish-approval
|
||||
- docker-publish-server
|
||||
- docker-publish-frontend
|
||||
- docker-publish-webhooks
|
||||
@@ -189,47 +184,6 @@ jobs:
|
||||
paths:
|
||||
- env-vars
|
||||
|
||||
should-publish:
|
||||
docker:
|
||||
- image: cimg/base:2022.08
|
||||
working_directory: *work-dir
|
||||
environment: &publishable-tags-branches
|
||||
PUBLISHABLE_TAGS: '^[0-9]+\.[0-9]+\.[0-9]+$'
|
||||
# £ delimited strings of regex for matches which should be published
|
||||
PUBLISHABLE_BRANCHES: '^main$£^hotfix.*£^alpha.*'
|
||||
steps:
|
||||
- checkout
|
||||
- run: mkdir -p workspace
|
||||
- run:
|
||||
name: determine whether to publish
|
||||
command: |
|
||||
echo "export SHOULD_PUBLISH=$(.circleci/should_publish.sh)" >> workspace/should-publish
|
||||
- run: cat workspace/should-publish >> $BASH_ENV
|
||||
- run: echo "SHOULD_PUBLISH=${SHOULD_PUBLISH}"
|
||||
- persist_to_workspace:
|
||||
root: workspace
|
||||
paths:
|
||||
- should-publish
|
||||
|
||||
should-build:
|
||||
docker:
|
||||
- image: cimg/base:2022.08
|
||||
working_directory: *work-dir
|
||||
environment: *publishable-tags-branches
|
||||
steps:
|
||||
- checkout
|
||||
- run: mkdir -p workspace
|
||||
- run:
|
||||
name: determine whether to build
|
||||
command: |
|
||||
echo "export SHOULD_BUILD=$(.circleci/should_build.sh)" >> workspace/should-build
|
||||
- run: cat workspace/should-build >> $BASH_ENV
|
||||
- run: echo "SHOULD_BUILD=${SHOULD_BUILD}"
|
||||
- persist_to_workspace:
|
||||
root: workspace
|
||||
paths:
|
||||
- should-build
|
||||
|
||||
pre-commit:
|
||||
parameters:
|
||||
config_file:
|
||||
@@ -363,7 +317,7 @@ jobs:
|
||||
|
||||
docker-build: &build-job
|
||||
docker: &docker-image
|
||||
- image: cimg/node:16.15
|
||||
- image: cimg/python:3.9.15-node
|
||||
resource_class: medium
|
||||
working_directory: *work-dir
|
||||
steps:
|
||||
@@ -371,19 +325,18 @@ jobs:
|
||||
- attach_workspace:
|
||||
at: /tmp/ci/workspace
|
||||
- run: cat workspace/env-vars >> $BASH_ENV
|
||||
- run: cat workspace/should-build >> $BASH_ENV
|
||||
- run:
|
||||
name: 'Check if should proceed'
|
||||
command: |
|
||||
[[ "${SHOULD_BUILD}" != true ]] && echo "Should not build, stopping" && circleci-agent step halt
|
||||
echo 'Proceeding with build'
|
||||
[[ "${CIRCLE_BRANCH}" != "main" && -z "${CIRCLE_PULL_REQUEST}" ]] && echo "Should not build, stopping" && circleci-agent step halt && exit 1
|
||||
echo "proceeding"
|
||||
- setup_remote_docker:
|
||||
# a weird issue with yarn installing packages throwing EPERM errors
|
||||
# this fixes it
|
||||
version: 20.10.12
|
||||
docker_layer_caching: true
|
||||
- run:
|
||||
name: Build and Publish
|
||||
name: Build and Save
|
||||
command: ./.circleci/build.sh
|
||||
- persist_to_workspace:
|
||||
root: workspace
|
||||
@@ -429,7 +382,7 @@ jobs:
|
||||
|
||||
docker-publish: &publish-job
|
||||
docker: &base-image
|
||||
- image: cimg/base:2022.08
|
||||
- image: cimg/python:3.9.15-node
|
||||
resource_class: medium
|
||||
working_directory: *work-dir
|
||||
steps:
|
||||
@@ -437,12 +390,6 @@ jobs:
|
||||
- attach_workspace:
|
||||
at: /tmp/ci/workspace
|
||||
- run: cat workspace/env-vars >> $BASH_ENV
|
||||
- run: cat workspace/should-publish >> $BASH_ENV
|
||||
- run:
|
||||
name: 'Check if should proceed'
|
||||
command: |
|
||||
[[ "${SHOULD_PUBLISH}" != true ]] && echo "Should not publish, stopping" && circleci-agent step halt
|
||||
echo 'Proceeding with publish'
|
||||
- setup_remote_docker:
|
||||
# a weird issue with yarn installing packages throwing EPERM errors
|
||||
# this fixes it
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
#!/bin/bash
|
||||
set -eo pipefail
|
||||
|
||||
# shellcheck disable=SC2068,SC2046
|
||||
LAST_RELEASE="$(git describe --always --tags $(git rev-list --tags) | grep -E '^[0-9]+\.[0-9]+\.[0-9]+$' | head -n 1)"
|
||||
NEXT_RELEASE="$(echo "${LAST_RELEASE}" | python -c "parts = input().split('.'); parts[-1] = str(int(parts[-1])+1); print('.'.join(parts))")"
|
||||
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
|
||||
# shellcheck disable=SC1090,SC1091
|
||||
source "${SCRIPT_DIR}/common.sh"
|
||||
|
||||
if [[ "${CIRCLE_TAG}" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
|
||||
echo "${CIRCLE_TAG}"
|
||||
@@ -15,7 +15,5 @@ if [[ "${CIRCLE_BRANCH}" == "main" ]]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
BRANCH_NAME_TRUNCATED="$(echo "${CIRCLE_BRANCH}" | cut -c -50 | sed 's/[^a-zA-Z0-9_.-]/_/g')" # docker has a 128 character tag limit, so ensuring the branch name will be short enough
|
||||
COMMIT_SHA1_TRUNCATED="$(echo "${CIRCLE_SHA1}" | cut -c -7)"
|
||||
echo "$NEXT_RELEASE-branch.${BRANCH_NAME_TRUNCATED}.${COMMIT_SHA1_TRUNCATED}.${CIRCLE_BUILD_NUM}"
|
||||
exit 0
|
||||
|
||||
+21
-14
@@ -1,28 +1,35 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail
|
||||
|
||||
SHOULD_PUBLISH="${SHOULD_PUBLISH:-false}"
|
||||
|
||||
if [[ "${SHOULD_PUBLISH}" != "true" ]]; then
|
||||
echo "Not publishing as the SHOULD_PUBLISH environment variable is not 'true'."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
|
||||
# shellcheck disable=SC1090,SC1091
|
||||
source "${SCRIPT_DIR}/common.sh"
|
||||
|
||||
echo "Publishing: ${DOCKER_IMAGE_TAG}:${IMAGE_VERSION_TAG}"
|
||||
echo "Starting tagging & publishing of image: ${DOCKER_IMAGE_TAG}:${IMAGE_VERSION_TAG}"
|
||||
|
||||
echo "💾 Loading image"
|
||||
docker load --input "/tmp/ci/workspace/${DOCKER_FILE_NAME}"
|
||||
|
||||
echo "🐳 Publishing image"
|
||||
docker tag "${DOCKER_IMAGE_TAG}:${IMAGE_VERSION_TAG}" "${DOCKER_IMAGE_TAG}:latest"
|
||||
echo "🐳 Logging into Docker"
|
||||
echo "${DOCKER_REG_PASS}" | docker login -u "${DOCKER_REG_USER}" --password-stdin "${DOCKER_REG_URL}"
|
||||
echo "⏫ Pushing loaded image: '${DOCKER_IMAGE_TAG}:${IMAGE_VERSION_TAG}'"
|
||||
docker push "${DOCKER_IMAGE_TAG}:${IMAGE_VERSION_TAG}"
|
||||
|
||||
if [[ "${IMAGE_VERSION_TAG}" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
|
||||
docker tag "${DOCKER_IMAGE_TAG}:${IMAGE_VERSION_TAG}" "${DOCKER_IMAGE_TAG}:2"
|
||||
if [[ "${IMAGE_VERSION_TAG}" =~ ^[0-9]+\.[0-9]+\.[0-9]+(-alpha\.[0-9]+)?$ ]]; then
|
||||
echo "🏷 Tagging and pushing image as '${DOCKER_IMAGE_TAG}:latest'"
|
||||
docker tag "${DOCKER_IMAGE_TAG}:${IMAGE_VERSION_TAG}" "${DOCKER_IMAGE_TAG}:latest"
|
||||
docker push "${DOCKER_IMAGE_TAG}:latest"
|
||||
|
||||
if [[ "${IMAGE_VERSION_TAG}" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
|
||||
echo "🏷 Tagging and pushing image as '${DOCKER_IMAGE_TAG}:2'"
|
||||
docker tag "${DOCKER_IMAGE_TAG}:${IMAGE_VERSION_TAG}" "${DOCKER_IMAGE_TAG}:2"
|
||||
docker push "${DOCKER_IMAGE_TAG}:2"
|
||||
fi
|
||||
else
|
||||
BRANCH_TAG="${NEXT_RELEASE}-branch.${BRANCH_NAME_TRUNCATED}"
|
||||
echo "🏷 Tagging and pushing image as '${DOCKER_IMAGE_TAG}:${BRANCH_TAG}'"
|
||||
docker tag "${DOCKER_IMAGE_TAG}:${IMAGE_VERSION_TAG}" "${DOCKER_IMAGE_TAG}:${BRANCH_TAG}"
|
||||
docker push "${DOCKER_IMAGE_TAG}:${BRANCH_TAG}"
|
||||
fi
|
||||
|
||||
echo "${DOCKER_REG_PASS}" | docker login -u "${DOCKER_REG_USER}" --password-stdin "${DOCKER_REG_URL}"
|
||||
docker push --all-tags "${DOCKER_IMAGE_TAG}"
|
||||
echo "✅ Publishing completed."
|
||||
|
||||
@@ -1,17 +0,0 @@
|
||||
#!/bin/bash
|
||||
set -eo pipefail
|
||||
|
||||
IFS='£' read -r -a PUB_TAGS <<< "${PUBLISHABLE_TAGS}"
|
||||
# shellcheck disable=SC2068
|
||||
for item in ${PUB_TAGS[@]}; do
|
||||
[[ "${CIRCLE_TAG}" =~ ${item} ]] && echo "true" && exit 0
|
||||
done
|
||||
|
||||
# it's on the main branch
|
||||
[[ "${CIRCLE_BRANCH}" == "main" ]] && echo "true" && exit 0
|
||||
|
||||
# or it is on a branch with a Pull Request
|
||||
[[ -n "${CIRCLE_PULL_REQUEST}" ]] && echo "true" && exit 0
|
||||
|
||||
echo "false"
|
||||
exit 0
|
||||
@@ -1,17 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail
|
||||
|
||||
IFS='£' read -r -a PUB_TAGS <<< "${PUBLISHABLE_TAGS}"
|
||||
# shellcheck disable=SC2068
|
||||
for item in ${PUB_TAGS[@]}; do
|
||||
[[ "${CIRCLE_TAG}" =~ ${item} ]] && echo "true" && exit 0
|
||||
done
|
||||
|
||||
IFS='£' read -r -a PUB_BRANCHES <<< "${PUBLISHABLE_BRANCHES}"
|
||||
# shellcheck disable=SC2068
|
||||
for item in ${PUB_BRANCHES[@]}; do
|
||||
[[ "${CIRCLE_BRANCH}" =~ ${item} ]] && echo "true" && exit 0
|
||||
done
|
||||
|
||||
echo "false"
|
||||
exit 0
|
||||
@@ -1,53 +1,58 @@
|
||||
|
||||
import sys, os
|
||||
import json
|
||||
from specklepy.objects import Base
|
||||
from specklepy.objects.other import RenderMaterial
|
||||
from specklepy.objects.geometry import Mesh, Point, Line
|
||||
from specklepy.objects.geometry import Mesh
|
||||
from specklepy.transports.server import ServerTransport
|
||||
from specklepy.api.client import SpeckleClient
|
||||
from specklepy.api.credentials import get_default_account
|
||||
from specklepy.api import operations
|
||||
|
||||
import sys, os
|
||||
|
||||
from obj_file import ObjFile
|
||||
|
||||
TMP_RESULTS_PATH = '/tmp/import_result.json'
|
||||
DEFAULT_BRANCH = 'uploads'
|
||||
|
||||
TMP_RESULTS_PATH = "/tmp/import_result.json"
|
||||
DEFAULT_BRANCH = "uploads"
|
||||
|
||||
|
||||
def convert_material(obj_mat):
|
||||
speckle_mat = RenderMaterial()
|
||||
speckle_mat.name = obj_mat['name']
|
||||
if 'diffuse' in obj_mat:
|
||||
argb = [1,] + obj_mat['diffuse']
|
||||
speckle_mat.diffuse = int.from_bytes([int(val * 255) for val in argb], byteorder="big", signed=True)
|
||||
if 'dissolved' in obj_mat:
|
||||
speckle_mat.opacity = obj_mat['dissolved']
|
||||
speckle_mat.name = obj_mat["name"]
|
||||
if "diffuse" in obj_mat:
|
||||
argb = [
|
||||
1,
|
||||
] + obj_mat["diffuse"]
|
||||
speckle_mat.diffuse = int.from_bytes(
|
||||
[int(val * 255) for val in argb], byteorder="big", signed=True
|
||||
)
|
||||
if "dissolved" in obj_mat:
|
||||
speckle_mat.opacity = obj_mat["dissolved"]
|
||||
return speckle_mat
|
||||
|
||||
|
||||
def import_obj():
|
||||
file_path, user_id, stream_id, branch_name, commit_message = sys.argv[1:]
|
||||
print(f'ImportOBJ argv[1:]: {sys.argv[1:]}')
|
||||
file_path, _, stream_id, branch_name, commit_message = sys.argv[1:]
|
||||
print(f"ImportOBJ argv[1:]: {sys.argv[1:]}")
|
||||
|
||||
# Parse input
|
||||
obj = ObjFile(file_path)
|
||||
print(f'Parsed obj with {len(obj.faces)} faces ({len(obj.vertices) * 3} vertices)')
|
||||
print(f"Parsed obj with {len(obj.faces)} faces ({len(obj.vertices) * 3} vertices)")
|
||||
|
||||
speckle_root = Base()
|
||||
speckle_root['@objects'] = []
|
||||
speckle_root["@objects"] = []
|
||||
|
||||
for objname in obj.objects:
|
||||
print(f' Converting {objname}...')
|
||||
print(f" Converting {objname}...")
|
||||
|
||||
speckle_obj = Base()
|
||||
speckle_obj.name = objname
|
||||
speckle_obj['@displayValue'] = []
|
||||
speckle_root['@objects'].append(speckle_obj)
|
||||
|
||||
speckle_obj["@displayValue"] = []
|
||||
speckle_root["@objects"].append(speckle_obj)
|
||||
|
||||
for obj_mesh in obj.objects[objname]:
|
||||
speckle_vertices = [coord for point in obj_mesh['vertices'] for coord in point]
|
||||
speckle_vertices = [
|
||||
coord for point in obj_mesh["vertices"] for coord in point
|
||||
]
|
||||
speckle_faces = []
|
||||
for obj_face in obj_mesh['faces']:
|
||||
for obj_face in obj_mesh["faces"]:
|
||||
if len(obj_face) == 3:
|
||||
speckle_faces.append(0)
|
||||
elif len(obj_face) == 4:
|
||||
@@ -57,64 +62,75 @@ def import_obj():
|
||||
speckle_faces.extend(obj_face)
|
||||
|
||||
has_vertex_colors = False
|
||||
for vc in obj_mesh['vertex_colors']:
|
||||
for vc in obj_mesh["vertex_colors"]:
|
||||
if vc is not None:
|
||||
has_vertex_colors = True
|
||||
colors = []
|
||||
if has_vertex_colors:
|
||||
for vc in obj_mesh['vertex_colors']:
|
||||
for vc in obj_mesh["vertex_colors"]:
|
||||
if vc is None:
|
||||
r, g, b = (1.0, 1.0, 1.0)
|
||||
else:
|
||||
r, g, b = vc
|
||||
argb = (1.0, r, g, b)
|
||||
color = int.from_bytes([int(val * 255) for val in argb], byteorder="big", signed=True)
|
||||
color = int.from_bytes(
|
||||
[int(val * 255) for val in argb], byteorder="big", signed=True
|
||||
)
|
||||
colors.append(color)
|
||||
|
||||
speckle_mesh = Mesh(
|
||||
vertices=speckle_vertices,
|
||||
faces=speckle_faces,
|
||||
colors=colors,
|
||||
textureCoordinates=[]
|
||||
textureCoordinates=[],
|
||||
)
|
||||
|
||||
obj_material = obj_mesh['material']
|
||||
obj_material = obj_mesh["material"]
|
||||
if obj_material:
|
||||
speckle_mesh['renderMaterial'] = convert_material(obj_material)
|
||||
speckle_mesh["renderMaterial"] = convert_material(obj_material)
|
||||
|
||||
speckle_obj['@displayValue'].append(speckle_mesh)
|
||||
speckle_obj["@displayValue"].append(speckle_mesh)
|
||||
|
||||
# Commit
|
||||
|
||||
client = SpeckleClient(host=os.getenv('SPECKLE_SERVER_URL', 'localhost:3000'), use_ssl=False)
|
||||
client.authenticate(os.environ['USER_TOKEN'])
|
||||
client = SpeckleClient(
|
||||
host=os.getenv("SPECKLE_SERVER_URL", "localhost:3000"), use_ssl=False
|
||||
)
|
||||
client.authenticate_with_token(os.environ["USER_TOKEN"])
|
||||
|
||||
if not client.branch.get(stream_id, branch_name):
|
||||
client.branch.create(stream_id, branch_name, 'File upload branch' if branch_name == 'uploads' else '')
|
||||
client.branch.create(
|
||||
stream_id,
|
||||
branch_name,
|
||||
"File upload branch" if branch_name == "uploads" else "",
|
||||
)
|
||||
|
||||
transport = ServerTransport(client=client, stream_id=stream_id)
|
||||
id = operations.send(base=speckle_root, transports=[transport], use_default_cache=False)
|
||||
id = operations.send(
|
||||
base=speckle_root, transports=[transport], use_default_cache=False
|
||||
)
|
||||
|
||||
commit_id = client.commit.create(
|
||||
stream_id=stream_id,
|
||||
object_id=id,
|
||||
branch_name=(branch_name or DEFAULT_BRANCH),
|
||||
message=(commit_message or 'OBJ file upload'),
|
||||
source_application='OBJ'
|
||||
message=(commit_message or "OBJ file upload"),
|
||||
source_application="OBJ",
|
||||
)
|
||||
|
||||
return commit_id
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
if __name__ == "__main__":
|
||||
from pathlib import Path
|
||||
|
||||
try:
|
||||
commit_id = import_obj()
|
||||
if not commit_id:
|
||||
raise Exception("Can't create commit")
|
||||
results = {'success': True, 'commitId': commit_id}
|
||||
results = {"success": True, "commitId": commit_id}
|
||||
except Exception as ex:
|
||||
print('ERROR: ' + str(ex))
|
||||
results = {'success': False, 'error': str(ex)}
|
||||
print("ERROR: " + str(ex))
|
||||
results = {"success": False, "error": str(ex)}
|
||||
|
||||
with open(TMP_RESULTS_PATH, 'w') as f:
|
||||
json.dump(results, f)
|
||||
Path(TMP_RESULTS_PATH).write_text(json.dumps(results))
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
numpy-stl==2.16.3
|
||||
specklepy==2.5.1
|
||||
numpy-stl==2.17.1
|
||||
specklepy==2.9.1
|
||||
|
||||
@@ -1,46 +1,50 @@
|
||||
|
||||
import json
|
||||
import stl
|
||||
from specklepy.objects.geometry import Mesh, Point
|
||||
from specklepy.objects.geometry import Mesh
|
||||
from specklepy.transports.server import ServerTransport
|
||||
from specklepy.api.client import SpeckleClient
|
||||
from specklepy.api.credentials import get_default_account
|
||||
from specklepy.api import operations
|
||||
|
||||
import sys, os
|
||||
|
||||
TMP_RESULTS_PATH = '/tmp/import_result.json'
|
||||
DEFAULT_BRANCH = 'uploads'
|
||||
TMP_RESULTS_PATH = "/tmp/import_result.json"
|
||||
DEFAULT_BRANCH = "uploads"
|
||||
|
||||
|
||||
def import_stl():
|
||||
file_path, user_id, stream_id, branch_name, commit_message = sys.argv[1:]
|
||||
print(f'ImportSTL argv[1:]: {sys.argv[1:]}')
|
||||
file_path, _, stream_id, branch_name, commit_message = sys.argv[1:]
|
||||
print(f"ImportSTL argv[1:]: {sys.argv[1:]}")
|
||||
|
||||
# Parse input
|
||||
stl_mesh = stl.mesh.Mesh.from_file(file_path)
|
||||
print(f'Parsed mesh with {stl_mesh.points.shape[0]} faces ({stl_mesh.points.shape[0] * 3} vertices)')
|
||||
print(
|
||||
f"Parsed mesh with {stl_mesh.points.shape[0]} faces ({stl_mesh.points.shape[0] * 3} vertices)"
|
||||
)
|
||||
|
||||
# Construct speckle obj
|
||||
vertices = stl_mesh.points.flatten().tolist()
|
||||
faces = []
|
||||
for i in range(stl_mesh.points.shape[0]):
|
||||
faces.extend([0, 3*i, 3*i+1, 3*i+2])
|
||||
faces.extend([0, 3 * i, 3 * i + 1, 3 * i + 2])
|
||||
|
||||
speckle_mesh = Mesh(
|
||||
vertices=vertices,
|
||||
faces=faces,
|
||||
colors=[],
|
||||
textureCoordinates=[]
|
||||
vertices=vertices, faces=faces, colors=[], textureCoordinates=[]
|
||||
)
|
||||
print('Constructed Speckle Mesh object')
|
||||
print("Constructed Speckle Mesh object")
|
||||
|
||||
# Commit
|
||||
|
||||
client = SpeckleClient(host=os.getenv('SPECKLE_SERVER_URL', 'localhost:3000'), use_ssl=False)
|
||||
client.authenticate(os.environ['USER_TOKEN'])
|
||||
client = SpeckleClient(
|
||||
host=os.getenv("SPECKLE_SERVER_URL", "localhost:3000"), use_ssl=False
|
||||
)
|
||||
client.authenticate_with_token(os.environ["USER_TOKEN"])
|
||||
|
||||
if not client.branch.get(stream_id, branch_name):
|
||||
client.branch.create(stream_id, branch_name, 'File upload branch' if branch_name == 'uploads' else '')
|
||||
client.branch.create(
|
||||
stream_id,
|
||||
branch_name,
|
||||
"File upload branch" if branch_name == "uploads" else "",
|
||||
)
|
||||
|
||||
transport = ServerTransport(client=client, stream_id=stream_id)
|
||||
id = operations.send(
|
||||
@@ -53,19 +57,22 @@ def import_stl():
|
||||
stream_id=stream_id,
|
||||
object_id=id,
|
||||
branch_name=(branch_name or DEFAULT_BRANCH),
|
||||
message=(commit_message or 'STL file upload'),
|
||||
source_application='STL'
|
||||
message=(commit_message or "STL file upload"),
|
||||
source_application="STL",
|
||||
)
|
||||
|
||||
return commit_id
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
if __name__ == "__main__":
|
||||
from pathlib import Path
|
||||
|
||||
try:
|
||||
commit_id = import_stl()
|
||||
results = {'success': True, 'commitId': commit_id}
|
||||
results = {"success": True, "commitId": commit_id}
|
||||
except Exception as ex:
|
||||
results = {'success': False, 'error': str(ex)}
|
||||
print(ex)
|
||||
|
||||
with open(TMP_RESULTS_PATH, 'w') as f:
|
||||
json.dump(results, f)
|
||||
print(results)
|
||||
Path(TMP_RESULTS_PATH).write_text(json.dumps(results))
|
||||
|
||||
@@ -28,7 +28,7 @@ COPY packages/viewer ./packages/viewer/
|
||||
COPY packages/preview-service ./packages/preview-service/
|
||||
|
||||
# This way the foreach only builds the frontend and its deps
|
||||
RUN yarn workspaces foreach -pt run build
|
||||
RUN yarn workspaces foreach run build
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -97,7 +97,7 @@ await sandbox.loadUrl(
|
||||
// AutoCAD
|
||||
// 'https://latest.speckle.dev/streams/3ed8357f29/commits/d10f2af1ce'
|
||||
//Blizzard world
|
||||
// 'https://latest.speckle.dev/streams/0c6ad366c4/commits/aa1c393aec'
|
||||
'https://latest.speckle.dev/streams/0c6ad366c4/commits/aa1c393aec'
|
||||
//Car
|
||||
// 'https://latest.speckle.dev/streams/17d2e25a97/commits/6b6cf3d43e'
|
||||
// Jonathon's
|
||||
@@ -127,5 +127,9 @@ await sandbox.loadUrl(
|
||||
// Luis sphere
|
||||
// 'https://speckle.xyz/streams/b85d53c3b4/commits/b47f21b707'
|
||||
// Building AO params
|
||||
'https://latest.speckle.dev/streams/0dd74866d0/commits/317e210afa'
|
||||
// 'https://latest.speckle.dev/streams/0dd74866d0/commits/317e210afa'
|
||||
// Murder Cube
|
||||
// 'https://latest.speckle.dev/streams/c1faab5c62/commits/7f0c4d2fc1/'
|
||||
// Classroom
|
||||
// 'https://speckle.xyz/streams/0208ffb67b/commits/a980292728'
|
||||
)
|
||||
|
||||
@@ -179,7 +179,7 @@ export default class SpeckleRenderer {
|
||||
|
||||
this.input = new Input(this._renderer.domElement, InputOptionsDefault)
|
||||
this.input.on(ViewerEvent.ObjectClicked, this.onObjectClick.bind(this))
|
||||
this.input.on('object-clicked-debug', this.onObjectClickDebug.bind(this))
|
||||
// this.input.on('object-clicked-debug', this.onObjectClickDebug.bind(this))
|
||||
this.input.on(ViewerEvent.ObjectDoubleClicked, this.onObjectDoubleClick.bind(this))
|
||||
|
||||
this.addDirectLights()
|
||||
|
||||
@@ -264,6 +264,7 @@ export const speckleStaticAoGenerateFrag = /* glsl */ `
|
||||
mat3 kernelMatrix = mat3( tangent, bitangent, viewNormal );
|
||||
float occlusion = 0.0;
|
||||
float kernelSize_ws = computeKernelSize(-viewPosition.z, kernelRadius);
|
||||
float div = float( KERNEL_SIZE);
|
||||
for ( int i = 0; i < KERNEL_SIZE; i ++ ) {
|
||||
vec3 sampleVector = kernelMatrix * kernel[ i ]; // reorient sample vector in view space
|
||||
vec3 samplePoint = viewPosition + ( sampleVector * kernelSize_ws ); // calculate sample point
|
||||
@@ -273,11 +274,11 @@ export const speckleStaticAoGenerateFrag = /* glsl */ `
|
||||
float realDepth = getLinearDepth( samplePointUv ); // get linear depth from depth texture
|
||||
float sampleDepth = viewZToOrthographicDepth( samplePoint.z + bias, cameraNear, cameraFar ); // compute linear depth of the sample view Z value
|
||||
float delta = sampleDepth - realDepth;
|
||||
if ( delta > minDistance && delta < maxDistance ) { // if fragment is before sample point, increase occlusion
|
||||
if ( delta > minDistance && delta < kernelSize_ws / (cameraFar - cameraNear) ) { // if fragment is before sample point, increase occlusion
|
||||
occlusion += 1.0;
|
||||
}
|
||||
}
|
||||
return clamp( occlusion * intensity / float( KERNEL_SIZE ), 0.0, 1.0 );
|
||||
return clamp( occlusion * intensity / div, 0.0, 1.0 );
|
||||
#endif
|
||||
}
|
||||
void main() {
|
||||
|
||||
@@ -54,7 +54,7 @@ export const DefaultStaticAoPassParams = {
|
||||
kernelSize: 16,
|
||||
bias: 0.01,
|
||||
minDistance: 0,
|
||||
maxDistance: 1 //0.008
|
||||
maxDistance: 0.008
|
||||
}
|
||||
|
||||
export class StaticAOPass extends Pass implements SpeckleProgressivePass {
|
||||
|
||||
@@ -70,7 +70,7 @@ spec:
|
||||
command:
|
||||
- node
|
||||
- -e
|
||||
- require('request')('http://localhost:3000/graphql?query={serverInfo{version}}', (e,r,b) => process.exit(b.toLowerCase().includes('error')))
|
||||
- "require('request')({headers: {'Content-Type': 'application/json'}, uri: 'http://localhost:3000/graphql?query={serverInfo{version}}', method: 'GET' }, (e,r,b) => process.exit(r.statusCode != 200 || b.toLowerCase().includes('error')))"
|
||||
|
||||
readinessProbe:
|
||||
initialDelaySeconds: 5
|
||||
@@ -80,7 +80,7 @@ spec:
|
||||
command:
|
||||
- node
|
||||
- -e
|
||||
- require('request')('http://localhost:3000/graphql?query={serverInfo{version}}', (e,r,b) => process.exit(b.toLowerCase().includes('error')))
|
||||
- "require('request')({headers: {'Content-Type': 'application/json'}, uri: 'http://localhost:3000/graphql?query={serverInfo{version}}', method: 'GET' }, (e,r,b) => process.exit(r.statusCode != 200 || b.toLowerCase().includes('error')))"
|
||||
|
||||
env:
|
||||
- name: CANONICAL_URL
|
||||
|
||||
@@ -1,49 +1,53 @@
|
||||
{{- if .Values.helm_test_enabled }}
|
||||
apiVersion: v1
|
||||
kind: Pod
|
||||
|
||||
apiVersion: batch/v1
|
||||
kind: Job
|
||||
metadata:
|
||||
name: "speckle-test-deployment"
|
||||
name: "speckle-test"
|
||||
namespace: {{ .Values.namespace }}
|
||||
annotations:
|
||||
"helm.sh/hook": test
|
||||
helm.sh/hook: test
|
||||
labels:
|
||||
{{ include "test.labels" . | indent 4 }}
|
||||
spec:
|
||||
containers:
|
||||
- name: test-deployment
|
||||
image: speckle/speckle-test-deployment:{{ .Values.docker_image_tag }}
|
||||
env:
|
||||
- name: SPECKLE_SERVER
|
||||
value: https://{{ .Values.domain }}
|
||||
- name: SERVER_VERSION
|
||||
value: {{ .Values.docker_image_tag }}
|
||||
resources:
|
||||
requests:
|
||||
cpu: {{ .Values.test.requests.cpu }}
|
||||
memory: {{ .Values.test.requests.memory }}
|
||||
limits:
|
||||
cpu: {{ .Values.test.limits.cpu }}
|
||||
memory: {{ .Values.test.limits.memory }}
|
||||
backoffLimit: 1
|
||||
parallelism: 1
|
||||
completions: 1
|
||||
template:
|
||||
spec:
|
||||
containers:
|
||||
- name: test-deployment
|
||||
image: speckle/speckle-test-deployment:{{ .Values.docker_image_tag }}
|
||||
env:
|
||||
- name: SPECKLE_SERVER
|
||||
value: https://{{ .Values.domain }}
|
||||
- name: SERVER_VERSION
|
||||
value: {{ .Values.docker_image_tag }}
|
||||
resources:
|
||||
requests:
|
||||
cpu: {{ .Values.test.requests.cpu }}
|
||||
memory: {{ .Values.test.requests.memory }}
|
||||
limits:
|
||||
cpu: {{ .Values.test.limits.cpu }}
|
||||
memory: {{ .Values.test.limits.memory }}
|
||||
securityContext:
|
||||
allowPrivilegeEscalation: false
|
||||
capabilities:
|
||||
drop:
|
||||
- ALL
|
||||
privileged: false
|
||||
readOnlyRootFilesystem: true
|
||||
runAsNonRoot: true
|
||||
runAsUser: 20000
|
||||
restartPolicy: Never
|
||||
securityContext:
|
||||
allowPrivilegeEscalation: false
|
||||
capabilities:
|
||||
drop:
|
||||
- ALL
|
||||
privileged: false
|
||||
readOnlyRootFilesystem: true
|
||||
runAsNonRoot: true
|
||||
runAsUser: 20000
|
||||
runAsGroup: 30000
|
||||
seccompProfile:
|
||||
type: RuntimeDefault
|
||||
|
||||
restartPolicy: Never
|
||||
|
||||
securityContext:
|
||||
runAsNonRoot: true
|
||||
runAsUser: 20000
|
||||
runAsGroup: 30000
|
||||
seccompProfile:
|
||||
type: RuntimeDefault
|
||||
|
||||
{{- if .Values.test.serviceAccount.create }}
|
||||
serviceAccountName: {{ include "test.name" $ }}
|
||||
{{- end }}
|
||||
{{- if .Values.test.serviceAccount.create }}
|
||||
serviceAccountName: {{ include "test.name" $ }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
psycopg2-binary
|
||||
prometheus-client
|
||||
psycopg2-binary==2.9.4
|
||||
prometheus-client==0.15.0
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
specklepy
|
||||
requests
|
||||
specklepy==2.9.0
|
||||
requests==2.28.1
|
||||
|
||||
Reference in New Issue
Block a user