-
Notifications
You must be signed in to change notification settings - Fork 0
Home
Elastic Clothing Fit is a Blender add-on that fits clothing meshes onto body meshes. It uses a proxy-based shrinkwrap pipeline to deform the clothing so it conforms to the body surface while preserving the clothing's original UV coordinates and silhouette as much as possible.
This wiki is written for developers who are new to the codebase. It explains not just what each piece of code does but why it works the way it does.
| Page | What it covers |
|---|---|
| Architecture | How the modules fit together, data flow, key data structures |
| Fitting Pipeline | Step-by-step walkthrough of the core fit algorithm |
| Live Preview | How slider changes update the mesh in real time without re-running the full fit |
| Properties | Every user-facing property, what it controls, and which callbacks it triggers |
| Operators | Every operator: what it does, when it is available, and how it works |
| Panel UI | How the sidebar panel is built and how it responds to add-on state |
| Updater | The background update checker, download system, and one-shot startup installer |
A user selects a body mesh and a clothing mesh. They click Fit Clothing. The add-on:
- Creates a temporary high-resolution copy of the clothing (the proxy).
- Shrinkwraps the proxy onto the body surface.
- Measures how each proxy vertex moved and transfers that displacement to the real clothing mesh using a weighted average.
- Optionally smooths sharp creases in tight areas.
- Enters preview mode - the clothing now sits on the body, and the user can adjust sliders to fine-tune the result in real time without re-running the full fit.
- The user clicks Apply to finalize or Cancel to restore the original shape.
elastic_fit/
├── __init__.py Registration, bl_info, add-on preferences
├── state.py Shared globals and pure utility functions
├── preview.py Live preview engine and all property update callbacks
├── properties.py Every user-facing property (PropertyGroup definitions)
├── operators.py Every Blender operator (Fit, Apply, Cancel, Remove, etc.)
├── panels.py The sidebar panel UI
└── updater.py Background update checker, downloader, and restart logic
An operator in Blender is a unit of work that can be undone. Every button in the panel corresponds to an operator. Operators have a poll() class method that controls whether the button is greyed out, and an execute() method that does the actual work.
Properties are the sliders, checkboxes, and dropdowns in the panel. When you register a FloatProperty with an update= argument, Blender calls that function every time the value changes. The add-on uses this to refresh the 3D view live when a slider moves during preview.
After a fit runs, the displacement data is stored in a dict called state._efit_cache. When a slider changes, instead of re-running the full fit (which takes seconds), the preview engine reads the cached displacement and reapplies it with the new slider values in milliseconds. This is what makes the sliders feel interactive.
Before fitting, the clothing's original vertex positions are saved as a flat list: [x0, y0, z0, x1, y1, z1, ...]. This gets stored both in a Python dict (state._efit_originals) and as a custom property on the object (obj["_efit_originals"]). The Python dict is fast and reliable within a session; the custom property survives saving and reopening a .blend file.
- Why a proxy?
- Step 1: Validation
- Step 2: Save originals
- Step 3: Create proxy
- Step 4: Hull proxy
- Step 5: Classify vertices
- Step 6: Shrinkwrap
- Step 7: BVH transfer
- Step 8: Proximity weights
- Step 9: Smoothing
- Step 10: Apply displacement
- Step 11: Offset tuning
- Step 12: Preserve follow
- Step 13: Populate cache
- Replace Previous path
- _efit_save_originals
- _efit_create_proxy
- _efit_create_hull_proxy
- _efit_classify_vertices
- _efit_shrinkwrap_proxy
- _efit_transfer_displacements
- _efit_apply_smoothing
- _efit_apply_offset_tuning
- _efit_apply_preserve_follow
- What triggers an update
- Re-entrant guard
- Preview update steps
- Live smooth modifiers
- Apply vs Cancel
- Viewport redraw
- What is an operator?
- Fitting operators
- Utility operators
- Vertex group lists
- Armature operators
- Mesh operators
- Update operators
- PropertyGroup overview
- Mesh selection
- Fit mode and exclusive toggle
- Fit settings
- Shape preservation
- Proximity falloff
- Post-fit options
- Preserve group
- Advanced adjustments
- Tools tab properties
- Update properties
- Panel registration
- Panel state
- Tab row
- Fit tab
- Tools tab
- Update tab
- Shared drawing helpers
- Layout reference
- Update flow overview
- State dict
- Version detection
- Checking for updates
- Nightly channel
- Downloading
- Security
- Installing and restarting
- Developer testing mode