Skip to content
Ciwb

Export

Republishing into Godot

A character is never finished on the first export. You fix the hands, slow the walk down, move the sword grip, and export again. This page shows how to set up a Godot project so that each new export from Ciwb replaces the model and its clips while everything you built around it in Godot stays: the gameplay script, the props held in a hand, the level that places the character, and any values you changed on it.

It takes three things: a saved export target in Ciwb, a small Godot addon, and one rule about which scene belongs to whom.

The rule: Ciwb owns the model, you own the wrapper

When Godot reimports a .glb it rebuilds the imported scene from scratch. Anything you add inside it by hand is lost on the next export. So split the character in two:

SceneWho edits itWhat it holds
hero.glbCiwb. Never edit it in Godot.Meshes, parts, attachment points, clips
hero.tscnYou. Ciwb never writes it.The .glb as a child called Model, your gameplay script, collision for the player body, props, sounds

Levels and other scenes reference hero.tscn, never the .glb directly. When the .glb changes, hero.tscn and everything that points at it keep working.

How it stays matched up

Every game export from Ciwb writes stable ids into the file:

  • each part and attachment point gets a ciwb_id (its object id in the project, which never changes when you rename or move it),
  • the root gets a ciwb_asset id for the project and a ciwb_clips table from clip id to animation name,
  • each animation's extras carry its clip id too.

Godot imports these as node metadata. The addon reads them after every import and gives the imported scene an index from id to node. Your wrapper finds things by id instead of by name or path, so renaming hand_r to grip in Ciwb, or moving it to another part, doesn't break anything.

Set up the addon

  1. Copy the addons/ciwb folder from docs/engines/godot/addons/ciwb into your Godot project, so you have res://addons/ciwb/plugin.cfg.
  2. In Godot, open Project > Project Settings > Plugins and enable Ciwb Reimport.
  3. Reimport any Ciwb .glb you already have (select it in the FileSystem dock and click Reimport), so it picks up the ids.

The addon adds two helpers you use from your own scenes and scripts:

  • CiwbModel: CiwbModel.find(model, id) returns the part or socket with that id, CiwbModel.clip(model, clip_id) returns the animation name for a clip, and CiwbModel.player(model) returns the model's AnimationPlayer.
  • CiwbSocketAttach: a Node3D that follows an attachment point inside the model, found by id. Parent props to it.

Files from other tools pass through the addon untouched.

Publish from Ciwb

  1. Open File > Export for Game, choose the Godot preset and leave colours on Texture atlas. Godot's default material ignores vertex colours.
  2. Open the Targets tab and click Save as target. Name it, for example "Godot character".
  3. Open the target's row, set File name to hero and choose your Godot project's characters folder as its Folder.
  4. Use File > Publish All (Ctrl+Alt+P) whenever you want the game to catch up. It writes hero.glb and hero.animations.json into that folder without asking again.

Godot notices the changed file and reimports it on its own when you switch back to the editor.

Build the wrapper

Create characters/hero.tscn with a Node3D root, and give it:

  1. Your gameplay script.
  2. The imported hero.glb as a child. Rename the child to Model.
  3. A child Node3D with addons/ciwb/ciwb_socket_attach.gd attached. Set Model to ../Model and Socket Id to the id of the attachment point (open the imported scene once and read the ciwb_id metadata on the socket node, or copy it from Ciwb's Object panel).
  4. Your prop, for example a sword mesh, as a child of that attach node.

Play clips by id so a renamed clip still plays:

extends Node3D

@export var walk_clip_id := ""   # the clip's id from the Ciwb project

func _ready() -> void:
	var model := $Model
	CiwbModel.player(model).play(CiwbModel.clip(model, walk_clip_id))

A complete example (wrapper, gameplay script, level and a check script) is in docs/engines/godot/example.

What survives a republish

We tested this with Godot 4.7.1. The character was published three times: first as built, then with a taller head, the hand socket renamed to grip and moved, and the walk slowed from 1 to 1.5 seconds, then with a hat added and the walk sped up to 0.75 seconds. After each reimport, without touching any Godot file:

  • the level still loaded the character, with its changed speed value kept,
  • the gameplay script was still attached and playing the walk, at the new length,
  • the sword still followed the hand socket exactly, under its new name,
  • the new mesh (taller head, then the hat) showed up.

Things to keep in mind

  • Don't edit the imported scene. Godot offers "Editable Children" and "New Inherited Scene" for a .glb. Changes made that way are tied to node names and paths, which can change in Ciwb. Put them in the wrapper.
  • Deleting a part in Ciwb deletes its id. A socket you delete and recreate gets a new id. Rename or move it instead.
  • Looping clips. Ciwb names looping clips with a _loop suffix for Godot, which Godot turns into a looping animation and removes from the name. CiwbModel.clip handles both names.
  • Check before you publish. Set required clip and attachment point names under Limits in Export for Game, so a target fails before it writes a file the game can't use. See Import and export.