Appearance
Importers
unity
Package Contents
kids.kapish.imports.moho
Package Info
| Field | Value |
|---|---|
| Name | kids.kapish.imports.moho |
| Display Name | Carrot Imports - Moho |
| Version | 0.1.0 |
| Unity | 6000.0+ |
| Namespace | Carrot.Imports.Moho / Carrot.Imports.Moho.Editor |
| Editor Assembly | Carrot.Imports.Moho.Editor |
| Runtime Assembly | Carrot.Imports.Moho |
| Dependencies | kids.kapish 0.1.0, kids.kapish.maths 0.1.0, kids.kapish.meshes 0.1.0, kids.kapish.imports.psd 0.1.0, com.unity.nuget.newtonsoft-json 3.2.1 |
Source Files
Editor
| File | Type | Description |
|---|---|---|
Editor/MohoImporter.cs | ScriptedImporter | MohoImporter -- ScriptedImporter for .moho files. Unzips the archive, parses Project.mohoproj JSON via Newtonsoft, builds the bone hierarchy, processes the layer tree (images, groups, switches, meshes, cages), generates animation clips per skeleton including cage vertex curves, and registers all sub-assets (prefab root, clips, thumbnail). Validates format version against MohoProject.FormatVersions. |
Editor/Model
| File | Type | Description |
|---|---|---|
Editor/Model/MohoBone.cs | Model Classes | MohoSkeleton, MohoBone, MohoVec2, MohoVec3, MohoAnimChannel, MohoChannelAction, MohoInterpKey -- JSON-deserialised bone and animation channel data. Bones carry parent index, length, strength, offset, constraints, and animated channels for position (Vec2), angle (Val/float), and scale (Val/float). Channels use parallel when[]/val[]/interp[] arrays. Actions are per-channel named poses with independent keyframes. |
Editor/Model/MohoLayer.cs | Model Classes | MohoLayer, MohoImageRef, MohoBounds, MohoMeshData, MohoCagePoint, MohoAction -- recursive layer tree. Supports BoneLayer, ImageLayer, GroupLayer, SwitchLayer, MeshLayer, and TextLayer types. Image layers carry PSD references (image_fileref, psd_layerid, psd_layer_identifier, psd_layer_bounds, psd_layer_translation). Mesh layers carry cage/vector mesh data with animated MohoCagePoint control points. |
Editor/Model/MohoProject.cs | Model Classes | MohoProject, MohoProjectData, MohoColor, MohoStyle, MohoAnimatedValues -- top-level project structure. Contains format version, dimensions, FPS, camera animation channels, and the root layer array. FormatVersions defines MinSupported (1045) and MaxTested (9999). |
Editor/Pipeline
| File | Type | Description |
|---|---|---|
Editor/Pipeline/MohoAnimationBuilder.cs | Static Builder | MohoAnimationBuilder -- converts per-bone Moho animation channels into Unity AnimationClip assets. Build() creates the main timeline clip from bone pos/angle/scale channels. BuildActions() creates per-action clips from named action poses. AddCageCurves() / AddCageActionCurves() append cage vertex position curves targeting MohoCageDeformer.vertexX/vertexY arrays. Handles Vec2, Val, and step/linear/smooth interpolation modes. |
Editor/Pipeline/MohoBoneBuilder.cs | Static Builder | MohoBoneBuilder -- converts a flat MohoSkeleton bone array into a Unity Transform hierarchy. Two-pass approach: first computes world positions using Moho's rotated bone chain, then creates GameObjects with correct local rotations. Also provides ParseFlexiBoneSubset() for pipe-delimited bone index strings. |
Editor/Pipeline/MohoCageBuilder.cs | Static Builder | MohoCageBuilder -- parses triangulated Moho MeshLayer deformation cages into Unity meshes. Resolves triangle connectivity from shape edges and shared curve endpoints. ComputeUVs() maps cage vertex positions into sprite texture space for atlas-aware sampling. Returns CageResult with mesh, animated cage points, and rest positions. |
Editor/Pipeline/MohoLayerProcessor.cs | Static Processor | MohoLayerProcessor -- recursive layer tree walker. Creates GameObjects and components for each layer type: SpriteRenderer for images, SortingGroup for groups, MohoSwitchMeta for switches, meshes for vector art and cages. Handles bone parenting via flexi_bone_subset, switch layer state activation, stencil mask groups, deferred raster atlas packing, and cage-to-image wiring. |
Editor/Pipeline/MohoMaterialLibrary.cs | Helper | MohoMaterialLibrary -- deduplicates materials during import by keying on (Shader, Texture) pairs. RegisterAssets() adds all created materials as sub-assets on the import context. |
Editor/Pipeline/MohoMeshBuilder.cs | Static Builder | MohoMeshBuilder -- converts Moho MeshLayer vector data into Unity meshes. Handles Moho's auto-smooth bezier curve format with configurable subdivision. ParsePointPositions() extracts rest positions, ParseCurves() builds curve topology with smoothness and weight data, BuildPolygonFromEdges() evaluates cubic bezier segments into polylines, ParseFillColor() reads style fill colours. |
Editor/Pipeline/MohoMeshRasterizer.cs | Static Rasterizer | MohoMeshRasterizer -- rasterises Moho MeshLayer vector shapes into RGBA textures at 1024 pixels/unit. Three-pass rendering: filled shapes with scanline fill and clip masking, variable-width outlines on filled shapes, and stroke-only open curves with per-vertex width interpolation. Supports fill clipping, alpha compositing, and segments_on edge visibility. |
Editor/Pipeline/MohoPsdResolver.cs | Helper | MohoPsdResolver -- resolves PSD layer sprites from imported PSD assets. Loads sub-assets from the PSD path, parses sprite names matching psd_{layerId}_{name}, and caches results per PSD file. Used by MohoLayerProcessor to bind image layers to their corresponding PSD sprites. |
Runtime
| File | Type | Description |
|---|---|---|
Runtime/MohoCageDeformer.cs | MonoBehaviour | MohoCageDeformer -- drives mesh deformation for Moho cages at runtime. vertexX[] and vertexY[] arrays are animated by AnimationClip curves and written to all child MeshFilter vertices each frame in LateUpdate. Multiple sprites can share the same cage via separate child meshes with different UVs. |
Runtime/MohoImageMeta.cs | MonoBehaviour | MohoImageMeta -- attached to ImageLayer GameObjects to carry PSD reference metadata: psdLayerId, psdLayerIdentifier, imageFileRefPath, layer bounds, and flexiBoneIndices. |
Runtime/MohoSwitchMeta.cs | MonoBehaviour | MohoSwitchMeta -- attached to SwitchLayer GameObjects. Stores the array of available stateNames for downstream runtime switching. |
Runtime/Shaders
| File | Type | Description |
|---|---|---|
Runtime/Shaders/MohoCageSprite.shader | URP Shader | Carrot/MohoCageSprite -- transparent sprite shader for cage-deformed meshes. Samples atlas texture via UV1, clips fragments outside [0,1] range using UV2 (uvClip). Two passes: Universal2D and SRPDefaultUnlit fallback. |
Runtime/Shaders/MohoVertexColor.shader | URP Shader | Carrot/MohoVertexColor -- transparent vertex-colour shader for rasterised vector meshes. Supports configurable stencil operations for mask group rendering. Two passes: Universal2D and SRPDefaultUnlit fallback. |
kids.kapish.imports.psd
Package Info
| Field | Value |
|---|---|
| Name | kids.kapish.imports.psd |
| Display Name | Carrot Imports - PSD |
| Version | 0.1.0 |
| Unity | 6000.0+ |
| Namespace | Carrot.Imports.Psd / Carrot.Imports.Psd.Editor |
| Editor Assembly | Carrot.Imports.Psd.Editor |
| Runtime Assembly | Carrot.Imports.Psd.Runtime |
| Dependencies | kids.kapish 0.1.0 |
| Precompiled DLLs | Carrot.Imports.Psd.dll (NetStandard 2.1), Carrot.IO.Binary.dll |
Source Files
Editor
| File | Type | Description |
|---|---|---|
Editor/PsdImporter.cs | AssetPostprocessor | PsdPostprocessor -- hooks into Unity's native texture import pipeline for .psd files. In OnPreprocessTexture, forces isReadable = true. In OnPostprocessTexture, parses the PSD via PsdFile.Read() from the precompiled DLL, packs layers with pixel data into atlas textures via PsdAtlasPacker, creates named Sprite sub-assets as psd_{layerId}_{name}, and generates a composite (flattened) texture sub-asset. |
Editor/PsdAtlasPacker.cs | Static Packer | PsdAtlasPacker -- packs PSD layers into power-of-two atlas textures using a shelf/row packing algorithm. Sorts layers by height descending, estimates initial atlas size from total area, then shelf-packs with configurable padding. Handles multi-atlas overflow. Blits layer RGBA pixels into atlas buffers and flips vertically for Unity's bottom-up texture space. Returns PsdAtlasResult with Texture2D atlases and PsdAtlasEntry rects. |
Runtime
| File | Type | Description |
|---|---|---|
Runtime/PsdLayerMap.cs | ScriptableObject | PsdLayerMap -- companion asset mapping PSD layer IDs to atlas rects. Stores arrays of Texture2D atlases and PsdLayerEntry entries. CreateSprite() generates a Sprite on demand for a given layer ID. FindEntry() looks up an entry by layer ID. |
Runtime/PsdLayerMap.cs | Serializable Class | PsdLayerEntry -- serialisable entry with layerId, layerName, atlasIndex, atlasX, atlasY, width, and height. |
Runtime/Plugins
| File | Type | Description |
|---|---|---|
Runtime/Plugins/Carrot/Carrot.Imports.Psd.dll | Precompiled DLL | NetStandard 2.1 PSD parser. Provides PsdFile.Read() for parsing PSD binary format and PsdLayer with extracted RGBA pixel data, dimensions, layer IDs, and names. |
Runtime/Plugins/Carrot/Carrot.IO.Binary.dll | Precompiled DLL | Binary I/O utilities used by the PSD parser. |