switch to new sketch mode api (#2295)

* swtch to new api

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* updates

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* fix ts

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* fix

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* small changes

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* updates

Signed-off-by: Jess Frazelle <github@jessfraz.com>

---------

Signed-off-by: Jess Frazelle <github@jessfraz.com>
This commit is contained in:
Jess Frazelle
2024-05-03 14:45:39 -07:00
committed by GitHub
parent 44f0d7c25c
commit 570d0473c6
20 changed files with 36 additions and 31 deletions

File diff suppressed because one or more lines are too long

View File

@ -10,7 +10,7 @@
"@fortawesome/react-fontawesome": "^0.2.0", "@fortawesome/react-fontawesome": "^0.2.0",
"@headlessui/react": "^1.7.19", "@headlessui/react": "^1.7.19",
"@headlessui/tailwindcss": "^0.2.0", "@headlessui/tailwindcss": "^0.2.0",
"@kittycad/lib": "^0.0.58", "@kittycad/lib": "^0.0.60",
"@lezer/javascript": "^1.4.9", "@lezer/javascript": "^1.4.9",
"@open-rpc/client-js": "^1.8.1", "@open-rpc/client-js": "^1.8.1",
"@react-hook/resize-observer": "^1.2.6", "@react-hook/resize-observer": "^1.2.6",

6
src-tauri/Cargo.lock generated
View File

@ -2536,7 +2536,7 @@ dependencies = [
[[package]] [[package]]
name = "kcl-lib" name = "kcl-lib"
version = "0.1.53" version = "0.1.54"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"approx", "approx",
@ -2595,9 +2595,9 @@ dependencies = [
[[package]] [[package]]
name = "kittycad" name = "kittycad"
version = "0.3.0" version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ddc922f0da3abc22661bf49423c9bfcc02ce6ae92dae007ede6990874789545b" checksum = "2c6e12eb45fd9a28c8e99dbdef54556246b39acee14e4aa6f0fc43636caa62d9"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"async-trait", "async-trait",

View File

@ -356,6 +356,7 @@ fn open_url_sync(app: &tauri::AppHandle, url: &url::Url) {
let cloned_url = url.clone(); let cloned_url = url.clone();
let runner: tauri::async_runtime::JoinHandle<Result<ProjectState>> = tauri::async_runtime::spawn(async move { let runner: tauri::async_runtime::JoinHandle<Result<ProjectState>> = tauri::async_runtime::spawn(async move {
let url_str = cloned_url.path().to_string(); let url_str = cloned_url.path().to_string();
log::debug!("Opening URL path : {}", url_str); log::debug!("Opening URL path : {}", url_str);
let path = Path::new(url_str.as_str()); let path = Path::new(url_str.as_str());
ProjectState::new_from_path(path.to_path_buf()).await ProjectState::new_from_path(path.to_path_buf()).await

View File

@ -873,7 +873,7 @@ export const modelingMachine = createMachine(
type: 'modeling_cmd_req', type: 'modeling_cmd_req',
cmd_id: uuidv4(), cmd_id: uuidv4(),
cmd: { cmd: {
type: 'default_camera_disable_sketch_mode', type: 'sketch_mode_disable',
}, },
}) })
.then(async () => { .then(async () => {

View File

@ -1895,7 +1895,7 @@ dependencies = [
[[package]] [[package]]
name = "kcl-lib" name = "kcl-lib"
version = "0.1.53" version = "0.1.54"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"approx 0.5.1", "approx 0.5.1",
@ -1964,9 +1964,9 @@ dependencies = [
[[package]] [[package]]
name = "kittycad" name = "kittycad"
version = "0.3.0" version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ddc922f0da3abc22661bf49423c9bfcc02ce6ae92dae007ede6990874789545b" checksum = "2c6e12eb45fd9a28c8e99dbdef54556246b39acee14e4aa6f0fc43636caa62d9"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"async-trait", "async-trait",
@ -2003,9 +2003,9 @@ dependencies = [
[[package]] [[package]]
name = "kittycad-execution-plan" name = "kittycad-execution-plan"
version = "0.1.5" version = "0.1.6"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ae99665cd699f8800da8ea4b01889c0c9c61619d2a9dc62d1d5028f1b21110bd" checksum = "0936396491f132c163e9411a3dd699e5b2daa49c19436691c5153f7ad2d4953d"
dependencies = [ dependencies = [
"bytes", "bytes",
"gltf-json", "gltf-json",
@ -2048,9 +2048,9 @@ dependencies = [
[[package]] [[package]]
name = "kittycad-modeling-cmds" name = "kittycad-modeling-cmds"
version = "0.2.22" version = "0.2.23"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ef6326553271cfb08d0143d9329f38cde162d5a0dcba1bd717c763d5361700d7" checksum = "1c1f8bdab7f09b4f4a954dafe0694e96f6f2b73733cf7cddccc42ee493e2c1e9"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"chrono", "chrono",

View File

@ -62,11 +62,11 @@ members = [
] ]
[workspace.dependencies] [workspace.dependencies]
kittycad = { version = "0.3.0", default-features = false, features = ["js", "requests"] } kittycad = { version = "0.3.1", default-features = false, features = ["js", "requests"] }
kittycad-execution-plan = "0.1.5" kittycad-execution-plan = "0.1.6"
kittycad-execution-plan-macros = "0.1.9" kittycad-execution-plan-macros = "0.1.9"
kittycad-execution-plan-traits = "0.1.14" kittycad-execution-plan-traits = "0.1.14"
kittycad-modeling-cmds = "0.2.22" kittycad-modeling-cmds = "0.2.23"
kittycad-modeling-session = "0.1.4" kittycad-modeling-session = "0.1.4"
[[test]] [[test]]

Binary file not shown.

Before

Width:  |  Height:  |  Size: 78 KiB

After

Width:  |  Height:  |  Size: 80 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 80 KiB

After

Width:  |  Height:  |  Size: 82 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 78 KiB

After

Width:  |  Height:  |  Size: 79 KiB

View File

@ -642,14 +642,15 @@ impl Callable for StartSketchAt {
// Next, enter sketch mode. // Next, enter sketch mode.
stack_api_call( stack_api_call(
&mut instructions, &mut instructions,
ModelingCmdEndpoint::SketchModeEnable, ModelingCmdEndpoint::EnableSketchMode,
None, None,
Uuid::new_v4().into(), Uuid::new_v4().into(),
[ [
Some(axes.z).into_parts(), Some(axes.z).into_parts(),
vec![false.into()], // animated vec![false.into()], // adjust camera
vec![false.into()], // ortho mode vec![false.into()], // animated
vec![plane_id.into()], vec![false.into()], // ortho mode
vec![plane_id.into()], // entity id (plane in this case)
], ],
); );

View File

@ -1,7 +1,7 @@
[package] [package]
name = "kcl-lib" name = "kcl-lib"
description = "KittyCAD Language implementation and tools" description = "KittyCAD Language implementation and tools"
version = "0.1.53" version = "0.1.54"
edition = "2021" edition = "2021"
license = "MIT" license = "MIT"
repository = "https://github.com/KittyCAD/modeling-app" repository = "https://github.com/KittyCAD/modeling-app"

View File

@ -947,6 +947,7 @@ async fn start_sketch_on_face(
ortho: false, ortho: false,
entity_id: extrude_plane_id, entity_id: extrude_plane_id,
adjust_camera: false, adjust_camera: false,
planar_normal: None,
}, },
) )
.await?; .await?;
@ -1005,12 +1006,13 @@ async fn start_sketch_on_plane(data: PlaneData, args: Args) -> Result<Box<Plane>
// Enter sketch mode on the plane. // Enter sketch mode on the plane.
args.send_modeling_cmd( args.send_modeling_cmd(
uuid::Uuid::new_v4(), uuid::Uuid::new_v4(),
ModelingCmd::SketchModeEnable { ModelingCmd::EnableSketchMode {
animated: false, animated: false,
ortho: false, ortho: false,
plane_id: plane.id, entity_id: plane.id,
// We pass in the normal for the plane here. // We pass in the normal for the plane here.
disable_camera_with_plane: Some(plane.z_axis.clone().into()), planar_normal: Some(plane.z_axis.clone().into()),
adjust_camera: false,
}, },
) )
.await?; .await?;

Binary file not shown.

Before

Width:  |  Height:  |  Size: 137 KiB

After

Width:  |  Height:  |  Size: 138 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 121 KiB

After

Width:  |  Height:  |  Size: 108 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 102 KiB

After

Width:  |  Height:  |  Size: 104 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 102 KiB

After

Width:  |  Height:  |  Size: 104 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 102 KiB

After

Width:  |  Height:  |  Size: 104 KiB

View File

@ -67,11 +67,12 @@ async fn setup(code: &str, name: &str) -> Result<(ExecutorContext, Program, uuid
.send_modeling_cmd( .send_modeling_cmd(
uuid::Uuid::new_v4(), uuid::Uuid::new_v4(),
SourceRange::default(), SourceRange::default(),
ModelingCmd::SketchModeEnable { ModelingCmd::EnableSketchMode {
animated: false, animated: false,
ortho: true, ortho: true,
plane_id, entity_id: plane_id,
disable_camera_with_plane: Some(Point3D { x: 0.0, y: 0.0, z: 1.0 }), planar_normal: Some(Point3D { x: 0.0, y: 0.0, z: 1.0 }),
adjust_camera: false,
}, },
) )
.await?; .await?;

View File

@ -1831,10 +1831,10 @@
resolved "https://registry.yarnpkg.com/@juggle/resize-observer/-/resize-observer-3.4.0.tgz#08d6c5e20cf7e4cc02fd181c4b0c225cd31dbb60" resolved "https://registry.yarnpkg.com/@juggle/resize-observer/-/resize-observer-3.4.0.tgz#08d6c5e20cf7e4cc02fd181c4b0c225cd31dbb60"
integrity sha512-dfLbk+PwWvFzSxwk3n5ySL0hfBog779o8h68wK/7/APo/7cgyWp5jcXockbxdk5kFRkbeXWm4Fbi9FrdN381sA== integrity sha512-dfLbk+PwWvFzSxwk3n5ySL0hfBog779o8h68wK/7/APo/7cgyWp5jcXockbxdk5kFRkbeXWm4Fbi9FrdN381sA==
"@kittycad/lib@^0.0.58": "@kittycad/lib@^0.0.60":
version "0.0.58" version "0.0.60"
resolved "https://registry.yarnpkg.com/@kittycad/lib/-/lib-0.0.58.tgz#4b47a295d8238e64d30d855336e4bcc4aab380f9" resolved "https://registry.yarnpkg.com/@kittycad/lib/-/lib-0.0.60.tgz#478aa1f750ab05cd4e67503de96f2f3bbc075329"
integrity sha512-iSkJNXumtlEjey/K1Lsl/j1aVlcjcPONW7+6YwqccioKJ6zwSCgXF4AFB3oxVmM27Gm8YjEmaHxbcOhGP02X9g== integrity sha512-LW9NFy2gv0pm1GJyquMXPiFKOBSdJJxYGkmacDton6jluGhAa8Qtcuj3O5vqUEeq9ObSM1Jt8gp39P9nvXG9yg==
dependencies: dependencies:
node-fetch "3.3.2" node-fetch "3.3.2"
openapi-types "^12.0.0" openapi-types "^12.0.0"