Skip to content

Importers

unity

Package Contents

kids.kapish.imports.moho

Package Info

FieldValue
Namekids.kapish.imports.moho
Display NameCarrot Imports - Moho
Version0.1.0
Unity6000.0+
NamespaceCarrot.Imports.Moho / Carrot.Imports.Moho.Editor
Editor AssemblyCarrot.Imports.Moho.Editor
Runtime AssemblyCarrot.Imports.Moho
Dependencieskids.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

FileTypeDescription
Editor/MohoImporter.csScriptedImporterMohoImporter -- 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

FileTypeDescription
Editor/Model/MohoBone.csModel ClassesMohoSkeleton, 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.csModel ClassesMohoLayer, 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.csModel ClassesMohoProject, 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

FileTypeDescription
Editor/Pipeline/MohoAnimationBuilder.csStatic BuilderMohoAnimationBuilder -- 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.csStatic BuilderMohoBoneBuilder -- 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.csStatic BuilderMohoCageBuilder -- 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.csStatic ProcessorMohoLayerProcessor -- 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.csHelperMohoMaterialLibrary -- 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.csStatic BuilderMohoMeshBuilder -- 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.csStatic RasterizerMohoMeshRasterizer -- 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.csHelperMohoPsdResolver -- 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

FileTypeDescription
Runtime/MohoCageDeformer.csMonoBehaviourMohoCageDeformer -- 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.csMonoBehaviourMohoImageMeta -- attached to ImageLayer GameObjects to carry PSD reference metadata: psdLayerId, psdLayerIdentifier, imageFileRefPath, layer bounds, and flexiBoneIndices.
Runtime/MohoSwitchMeta.csMonoBehaviourMohoSwitchMeta -- attached to SwitchLayer GameObjects. Stores the array of available stateNames for downstream runtime switching.

Runtime/Shaders

FileTypeDescription
Runtime/Shaders/MohoCageSprite.shaderURP ShaderCarrot/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.shaderURP ShaderCarrot/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

FieldValue
Namekids.kapish.imports.psd
Display NameCarrot Imports - PSD
Version0.1.0
Unity6000.0+
NamespaceCarrot.Imports.Psd / Carrot.Imports.Psd.Editor
Editor AssemblyCarrot.Imports.Psd.Editor
Runtime AssemblyCarrot.Imports.Psd.Runtime
Dependencieskids.kapish 0.1.0
Precompiled DLLsCarrot.Imports.Psd.dll (NetStandard 2.1), Carrot.IO.Binary.dll

Source Files

Editor

FileTypeDescription
Editor/PsdImporter.csAssetPostprocessorPsdPostprocessor -- 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.csStatic PackerPsdAtlasPacker -- 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

FileTypeDescription
Runtime/PsdLayerMap.csScriptableObjectPsdLayerMap -- 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.csSerializable ClassPsdLayerEntry -- serialisable entry with layerId, layerName, atlasIndex, atlasX, atlasY, width, and height.

Runtime/Plugins

FileTypeDescription
Runtime/Plugins/Carrot/Carrot.Imports.Psd.dllPrecompiled DLLNetStandard 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.dllPrecompiled DLLBinary I/O utilities used by the PSD parser.

Carrot