Skip to content

Commit

Permalink
Update to latest SwiftUSD, cleanup code.
Browse files Browse the repository at this point in the history
- Release Kraken v1.0.3.
  • Loading branch information
furby-tm committed Jan 11, 2024
1 parent da5999a commit f35545a
Show file tree
Hide file tree
Showing 4 changed files with 66 additions and 91 deletions.
9 changes: 6 additions & 3 deletions Kraken.usda
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
#usda 1.0
(
doc = "Kraken v1.0.3"
)

def "Hello"
def Xform "Hello"
{
def "Metaverse"
def Xform "Metaverse"
{
def Sphere "World"
def Cylinder "Kraken"
{
}
}
Expand Down
66 changes: 33 additions & 33 deletions Package.resolved
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/wabiverse/MetaverseKit.git",
"state" : {
"revision" : "35be6bb25945346031f15f1d6e44e347e9318070",
"version" : "1.3.7"
"revision" : "d54cecb09aee115361d635134471e5b7dceb72a8",
"version" : "1.4.2"
}
},
{
Expand Down Expand Up @@ -93,28 +93,28 @@
{
"identity" : "swift-arg-parser",
"kind" : "remoteSourceControl",
"location" : "https://github.com/stackotter/swift-arg-parser",
"location" : "https://github.com/wabiverse/swift-arg-parser",
"state" : {
"revision" : "8e0533b4fef5380274cdeca5167f99b318372cb5",
"version" : "1.2.3"
"revision" : "41fc1c8f8482e321d46164df28c6ef672a42bc85",
"version" : "1.2.4"
}
},
{
"identity" : "swift-argument-parser",
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-argument-parser.git",
"state" : {
"revision" : "9f39744e025c7d377987f30b03770805dcb0bcd1",
"version" : "1.1.4"
"revision" : "c8ed701b513cf5177118a175d85fbbbcd707ab41",
"version" : "1.3.0"
}
},
{
"identity" : "swift-bundler",
"kind" : "remoteSourceControl",
"location" : "https://github.com/furby-tm/swift-bundler",
"state" : {
"revision" : "b72140213ab7135922287a48837ced1b2da1457d",
"version" : "2.0.8"
"revision" : "42d095fd8501e4df5b8a6439771f9912f31b8741",
"version" : "2.0.9"
}
},
{
Expand All @@ -126,13 +126,22 @@
"version" : "1.0.0"
}
},
{
"identity" : "swift-cmark",
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-cmark.git",
"state" : {
"revision" : "f218e5d7691f78b55bfa39b367763f4612486c35",
"version" : "0.3.0"
}
},
{
"identity" : "swift-format",
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-format",
"state" : {
"revision" : "9bd7b6df27be3a7887a34073aa519c0dcdfab976",
"version" : "0.50800.0-SNAPSHOT-2022-12-29-a"
"revision" : "83248b4fa37919f78ffbd4650946759bcc54c2b5",
"version" : "509.0.0"
}
},
{
Expand All @@ -144,6 +153,15 @@
"version" : "1.5.3"
}
},
{
"identity" : "swift-markdown",
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-markdown.git",
"state" : {
"revision" : "e4f95e2dc23097a1a9a1dfdfe3fe3ee44de77378",
"version" : "0.3.0"
}
},
{
"identity" : "swift-overture",
"kind" : "remoteSourceControl",
Expand All @@ -167,26 +185,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-syntax",
"state" : {
"revision" : "edd2d0cdb988ac45e2515e0dd0624e4a6de54a94",
"version" : "0.50800.0-SNAPSHOT-2022-12-29-a"
}
},
{
"identity" : "swift-system",
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-system.git",
"state" : {
"revision" : "836bc4557b74fe6d2660218d56e3ce96aff76574",
"version" : "1.1.1"
}
},
{
"identity" : "swift-tools-support-core",
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-tools-support-core.git",
"state" : {
"revision" : "284a41800b7c5565512ec6ae21ee818aac1f84ac",
"version" : "0.4.0"
"revision" : "6ad4ea24b01559dde0773e3d091f1b9e36175036",
"version" : "509.0.2"
}
},
{
Expand All @@ -203,8 +203,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/wabiverse/SwiftUSD.git",
"state" : {
"revision" : "94ab5da67515599fecf5a03940d3b8b8fef5f49a",
"version" : "23.11.8"
"revision" : "d2befe11b3be2742849591444548cb139835cb79",
"version" : "23.11.19"
}
},
{
Expand Down
8 changes: 4 additions & 4 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ let package = Package(

// --- 🦄 Package Dependencies. ---
dependencies: [
.package(url: "https://github.com/furby-tm/swift-bundler", from: "2.0.8"),
.package(url: "https://github.com/wabiverse/SwiftUSD.git", from: "23.11.8")
.package(url: "https://github.com/furby-tm/swift-bundler", from: "2.0.9"),
.package(url: "https://github.com/wabiverse/SwiftUSD.git", from: "23.11.19")
],

// --- 🎯 Package Targets. ---
Expand All @@ -39,7 +39,7 @@ let package = Package(
.target(
name: "KrakenUI",
dependencies: [
.product(name: "Pixar", package: "SwiftUSD"),
.product(name: "PixarUSD", package: "SwiftUSD"),
.target(name: "KrakenKit"),
],
swiftSettings: [
Expand All @@ -51,7 +51,7 @@ let package = Package(
.executableTarget(
name: "Kraken",
dependencies: [
.product(name: "Pixar", package: "SwiftUSD"),
.product(name: "PixarUSD", package: "SwiftUSD"),
.target(name: "KrakenKit"),
.target(name: "KrakenUI"),
],
Expand Down
74 changes: 23 additions & 51 deletions Sources/Kraken/Creator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
import Foundation
import KrakenKit
import KrakenUI
import Pixar
import PixarUSD
import PyBundle
import Python
import SwiftUI
Expand All @@ -37,63 +37,35 @@ import SwiftUI
@main
struct Kraken: App
{
static let version = "1.0.3"

init()
{
/* Setup usd plugins & resources. */
Pixar.Bundle.shared.setup(.resources)
/* setup usd plugins & resources. */
Pixar.Bundler.shared.setup(.resources)

/* Embed & init python. */
/* embed & init python. */
PyBundle.shared.pyInit()
PyBundle.shared.pyInfo()

/* Using Pixar's USD (Arch) from Swift. */
let cwd = Pixar.Arch.getCwd()
let exePath = Pixar.Arch.getExecutablePath()
let isMain = Pixar.Arch.isMainThread()
let threadId = Pixar.Arch.getMainThreadId()
let pageSize = Pixar.Arch.getPageSize()

Msg.Log.point("Current working directory", to: cwd)
Msg.Log.point("Path to running executable", to: exePath)
Msg.Log.point("Are we on the main thread?", to: isMain)
Msg.Log.point("The id of the main thread", to: threadId)
Msg.Log.point("System memory paging size", to: pageSize)

/* Using Pixar's USD (Gf) from Swift (no namespace). */
let vecA = GfVec2f(1, 2)
let vecB = GfVec2f(3, 4)
var vecC = vecA + vecB
vecC *= 2

Msg.Log.point("The value of vecC", to: vecC)

/* Using Pixar's USD (Gf) from Swift (Pixar.Gf namespace). */
let pxrVecA = Pixar.Gf.Vec2f(1, 2)
let pxrVecB = Pixar.Gf.Vec2f(3, 4)
var pxrVecC = pxrVecA + pxrVecB
pxrVecC *= 2

Msg.Log.point("The value of pxrVecC", to: pxrVecC)

/* Using Pixar's USD (Js) from Swift (no namespace). */
let jsonvalue = JsValue(true)

Msg.Log.point("The value of jsonvalue", to: jsonvalue.GetBool())

/* Using Pixar's USD (Js) from Swift (Pixar.Js namespace). */
let pxrValue = Pixar.Js.Value(true)

Msg.Log.point("The value of pxrValue", to: pxrValue.GetBool())

/* Create a new USD stage. */
var stage = Pixar.Usd.Stage.createNew("Kraken.usda")

/* & hello metaverse. */
Pixar.UsdGeom.Sphere.define(&stage, path: "/Hello/Metaverse/World")

stage.save()
/* hello metaverse. */
UsdStage("Kraken.usda")
{
// 👋.
UsdPrim("Hello", type: .xform)
{
// 🌌.
UsdPrim("Metaverse", type: .xform)
{
// 🦑.
UsdPrim("Kraken", type: .cylinder)
}
}
}
.set(doc: "Kraken v\(Kraken.version)")
.save()

print("Kraken launched.")
Msg.logger.log(level: .info, "Kraken launched.")
}

/* --- xxx --- */
Expand Down

0 comments on commit f35545a

Please sign in to comment.