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:
| Scene | Who edits it | What it holds |
|---|---|---|
hero.glb | Ciwb. Never edit it in Godot. | Meshes, parts, attachment points, clips |
hero.tscn | You. 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_assetid for the project and aciwb_clipstable 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
- Copy the
addons/ciwbfolder from docs/engines/godot/addons/ciwb into your Godot project, so you haveres://addons/ciwb/plugin.cfg. - In Godot, open Project > Project Settings > Plugins and enable Ciwb Reimport.
- Reimport any Ciwb
.glbyou 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, andCiwbModel.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
- Open File > Export for Game, choose the Godot preset and leave colours on Texture atlas. Godot's default material ignores vertex colours.
- Open the Targets tab and click Save as target. Name it, for example "Godot character".
- Open the target's row, set File name to
heroand choose your Godot project'scharactersfolder as its Folder. - Use File > Publish All (Ctrl+Alt+P) whenever you want the game to catch up. It writes
hero.glbandhero.animations.jsoninto 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:
- Your gameplay script.
- The imported
hero.glbas a child. Rename the child toModel. - A child Node3D with
addons/ciwb/ciwb_socket_attach.gdattached. Set Model to../Modeland Socket Id to the id of the attachment point (open the imported scene once and read theciwb_idmetadata on the socket node, or copy it from Ciwb's Object panel). - 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
speedvalue 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
_loopsuffix for Godot, which Godot turns into a looping animation and removes from the name.CiwbModel.cliphandles 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.