This commit is contained in:
Yeicor
2024-03-10 17:36:48 +01:00
parent 49df7af970
commit f3672202ea
4 changed files with 8 additions and 6 deletions

View File

@@ -68,7 +68,6 @@ jobs:
cache: "poetry"
- run: "SKIP_BUILD_FRONTEND=true poetry install"
- run: "PYTHONPATH=yacv_server YACV_DISABLE_SERVER=true poetry run python example/object.py"
- run: "mv export/object.glb export/example.glb"
- uses: "actions/upload-artifact@v4"
with:
name: "example"

View File

@@ -11,12 +11,12 @@ from yacv_server import show, export_all # Check out other exported methods for
# %%
# Create a simple object
with BuildPart() as obj:
with BuildPart() as example:
Box(10, 10, 5)
Cylinder(4, 5, mode=Mode.SUBTRACT)
# Show it in the frontend with hot-reloading
show(obj)
show(example)
# %%

View File

@@ -126,8 +126,9 @@ function onClipPlanesChange() {
// Global value for all models, once set it cannot be unset (unknown for other models...)
props.viewer.renderer.threeRenderer.localClippingEnabled = true;
// Due to model-viewer's camera manipulation, the bounding box needs to be transformed
bbox = SceneMgr.getBoundingBox(sceneDocument.value);
bbox.translate(scene.getTarget());
let boundingBox = SceneMgr.getBoundingBox(sceneDocument.value);
if (!boundingBox) return; // No models. Should not happen.
bbox = boundingBox.translate(scene.getTarget());
}
sceneModel.traverse((child: MObject3D) => {
if (child.userData[extrasNameKey] === modelName) {

View File

@@ -277,7 +277,9 @@ function updateBoundingBox() {
}
bb.applyMatrix4(new Matrix4().makeTranslation(props.viewer?.scene.getTarget()));
} else {
bb = SceneMgr.getBoundingBox(sceneDocument.value);
let boundingBox = SceneMgr.getBoundingBox(sceneDocument.value);
if (!boundingBox) return; // No models. Should not happen.
bb = boundingBox
}
// Define each edge of the bounding box, to draw a line for each axis
let corners = [