Threejs structure parser

From XuShuwenn/RedAct · View interactive version

Threejs structure parser is an AI agent skill from the GitHub repository XuShuwenn/RedAct. Parse Three.js object.js file to extract mesh hierarchy, part structure, and export individual part meshes as OBJ files.

How to use this skill

Skill file

Three.js Structure Parser

When to Use

Input

Mandatory parsing discipline

Input

Execution Guardrails

Output Structure

/root/output/
├── part_meshes/
│   ├── <part_name_1>/
│   │   ├── <mesh_name1>.obj
│   │   └── ...
│   └── ...
└── links/
    ├── <part_name_1>.obj
    └── ...

Path rule: write mesh OBJs directly under part_meshes/<part_name>/ and part-level combined files under links/<part_name>.obj.

Requirements for completion:

Approach

  1. Read and inspect the full relevant contents of object.js, including createScene() and related helper code, before naming parts or describing hierarchy
  1. Confirm the runtime/export path before scripting: verify the needed Three.js runtime pieces and exporter/helper modules are present if you plan to evaluate the scene, export OBJ, or combine geometry
  2. Prefer constructing/evaluating the provided scene and traversing the resulting object graph when feasible; otherwise parse the verified source without inferring from imports, comments, or partial snippets
  3. Enumerate all actual THREE.Mesh objects and all THREE.Group nodes created in the verified scene
  1. Record each mesh and its ancestor group path; traverse groups recursively rather than checking only top-level children
  1. Derive confirmed part names from the discovered hierarchy and map each mesh to its requested part output
  1. Export individual meshes as OBJ under /root/output/part_meshes/<part_name>/, calling updateMatrixWorld(true) first and cloning/applying each mesh's matrixWorld so standalone exports preserve assembled-scene placement and orientation
  2. Create one part-level link OBJ per extracted part under /root/output/links/ by exporting/combining the whole part/group in world space, not just a representative child mesh
  3. If helper code is needed, first confirm the module-loading setup required to execute object.js correctly, then keep any script in an allowed location; prefer one reproducible load → traverse → export workflow when feasible instead of separate ad hoc steps
  1. Before finalizing, verify the export command or script actually finished and build a complete inventory of discovered parts and meshes from full source inspection or runtime traversal
  2. Verify the exported outputs against that inventory by direct filesystem inspection: confirm /root/output/part_meshes/ and /root/output/links/ both exist, every discovered part has its directory and links/<part_name>.obj, nested-group meshes were written under their parent part directory, no unauthorized extra subgroup directories were created under part_meshes/, and every discovered mesh/part is represented by the files actually written without omissions or unintended duplication
  3. If any read, listing, export log, or verification output is truncated or ambiguous, rerun narrower checks for specific directories, filenames, counts, or exit status until every claimed artifact is directly observed; otherwise report the missing or unverified artifacts instead of claiming completion
  4. Report part names, counts, and hierarchy details only when they were directly confirmed from source inspection, runtime traversal, or checked filesystem results, and if the task specifies an exact completion token or final-response format, output it exactly

Three.js Components

Tips

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.