Skip to content

pardeike/ModelWorkbench

Repository files navigation

ModelWorkbench

ModelWorkbench is a macOS app for editing procedural Swift-based 3D models and generating the matching artifact files in the same folder.

Model Folder Layout

Each model lives in its own folder anywhere on disk:

MyModel/
  MyModel.swift
  MyModel.3mf
  MyModel.usda
  MyModel.usdc
  MyModel.usdz

You can start with only MyModel.swift. Saving in the app regenerates the rest of the files into that same folder.

What The App Opens

ModelWorkbench can open either:

  • a model folder, or
  • the .swift file inside that folder

When you create a new model, the app asks for a parent folder and a model name, then creates:

  • a new folder named after the model
  • a starter Swift source file inside it

Source File Contract

The model source file must define a type named WorkbenchEntryPoint that conforms to WorkbenchModelDefinition.

Starter files created by the app already use that shape:

import Foundation
import WorkbenchModelRuntime

enum WorkbenchEntryPoint: WorkbenchModelDefinition {
    static func generate3MF(named modelName: String, at outputURL: URL) async throws {
        try FileManager.default.createDirectory(
            at: outputURL.deletingLastPathComponent(),
            withIntermediateDirectories: true
        )

        let modelFile = try await ModelFileGenerator.build(named: modelName, options: .format3D(.threeMF)) {
            Metadata(title: modelName, author: "ModelWorkbench")
            Environment { $0.segmentation = .fixed(96) }
            Box(40)
        }

        try await modelFile.write(to: outputURL)
    }
}

Build Behavior

  • Typing edits only the in-app buffer.
  • Save formats the source when possible, writes it to disk, and rebuilds the artifacts.
  • Format updates the editor buffer without saving.
  • Opening a model performs an initial sync build so preview files stay current.
  • External file saves are detected and rebuilt after the file changes on disk.

Standalone App

The app no longer depends on repo-local scripts or a fixed repo layout.

The built .app bundles:

  • the runtime framework used by model source files
  • Swift module metadata needed by runtime compilation
  • header and module-map support files needed by the Cadova dependency stack

That makes it suitable to copy into /Applications and use against model folders stored anywhere on disk.

Requirements

ModelWorkbench still uses the system Swift toolchain and Apple USD command-line tools at runtime. In practice that means:

  • Xcode or the Xcode command line tools must be installed
  • /usr/bin/usdchecker
  • /usr/bin/usdcat
  • /usr/bin/usdzip

Development

Repo structure:

  • ModelWorkbench/Sources contains the macOS app target.
  • Packages/ThreeDModels/Sources contains the local Swift package targets used by the app.
  • Design/AppIcon contains the icon source artwork.
  • Tools contains repo maintenance scripts such as icon generation.

Regenerate the Xcode project after editing project.yml:

xcodegen generate

Build the app:

xcodebuild -project ModelWorkbench.xcodeproj \
  -scheme ModelWorkbench \
  -configuration Debug \
  build CODE_SIGNING_ALLOWED=NO

About

Standalone macOS workbench for editing and generating procedural 3D model folders

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages