{"id":13743929,"url":"https://github.com/timknip/asblender","last_synced_at":"2025-03-22T10:33:16.886Z","repository":{"id":787905,"uuid":"484070","full_name":"timknip/asblender","owner":"timknip","description":"Actionscript 3 library for reading Blender .blend files","archived":false,"fork":false,"pushed_at":"2010-01-25T00:05:40.000Z","size":2389,"stargazers_count":38,"open_issues_count":4,"forks_count":7,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-10-18T07:30:23.489Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"http://wiki.github.com/timknip/asblender/","language":"ActionScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/timknip.png","metadata":{"files":{"readme":"README","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2010-01-22T16:58:43.000Z","updated_at":"2021-09-10T18:00:41.000Z","dependencies_parsed_at":"2022-07-14T18:47:12.818Z","dependency_job_id":null,"html_url":"https://github.com/timknip/asblender","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/timknip%2Fasblender","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/timknip%2Fasblender/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/timknip%2Fasblender/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/timknip%2Fasblender/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/timknip","download_url":"https://codeload.github.com/timknip/asblender/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244944374,"owners_count":20536290,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-03T05:00:59.863Z","updated_at":"2025-03-22T10:33:16.867Z","avatar_url":"https://github.com/timknip.png","language":"ActionScript","funding_links":[],"categories":["File Formats"],"sub_categories":["3D Formats"],"readme":"ASBLENDER\n=========================================\n\nASBlender is an Actionscript 3 library to read Blender .blend files.\n\nSee http://www.blender.org/development/architecture/blender-file-format/ for an explanation of the .blend format.\n\nThe complete .blend is read into simple AS3 Object's which map to the structures defined in the so-called DNA.\n\nDisadvantage of this approach is that you have to \"know\" how the structures look like.\n=\u003e check \"printDNA\" in USAGE below\n\nUSAGE\n=========================================\n\n[Embed (source=\"/assets/crystal_cube.blend\", mimeType=\"application/octet-stream\")]\npublic var BlenderData:Class;\n\nvar blend:BlendFile = new BlendFile();\n\nblend.read(new BlenderData());\n\t\t\t\nif (blend.scenes.length) {\n    // Blender can have multiple scenes, don't know yet how to grab the \"active\" scene.\n\tbuildScene(blend.scenes[0]);\n}\n\n/**\n * Prints out the DNA as contained in the .blend\n */\nprivate function printDNA(blend:BlendFile):void {\n\tvar struct:DNAStruct;\n\tvar field:DNAField;\n\t\n\tfor each (struct in blend.dna.structs) {\n\t\tvar type:String = blend.dna.types[ struct.type ];\n\t\t\n\t\ttrace(type);\n\t\t\n\t\tfor each (field in struct.fields) {\n\t\t\ttrace(field.type + \" \" + field.name);\n\t\t}\n\t}\n}\n\nprivate function buildScene(scene:Object):void {\n\n\tvar obj:Object = scene.base.first;\n\t\n\twhile (obj) {\n\t\t// grab the Blender Object.\n\t\t// The Blender Object defines rotation, scale, translation etc.\n\t\tvar object:Object = obj.object; \n\t\t\n\t\ttrace(\"Object name: \" + object.id.name + \" type: \" + object.type + \" matrix: \" + object.obmat);\n\t\t\n\t\t//for (var key:String in object) {\n\t\t//\ttrace(key);\n\t\t//}\n\t\t\n\t\tif (object.data) {\n\t\t\tswitch (object.type) {\n\t\t\t\tcase 1:\t// Mesh\n\t\t\t\t\ttrace (\" -\u003e Mesh: \" + object.data.id.name);\n\t\t\t\t\tbuildMesh(object.data);\n\t\t\t\t\tbreak;\n\t\t\t\tcase 10: // Lamp\n\t\t\t\t\ttrace (\" -\u003e Lamp: \" + object.data.id.name);\n\t\t\t\t\tbreak;\n\t\t\t\tcase 11: // Camera\n\t\t\t\t\ttrace (\" -\u003e Camera: \" + object.data.id.name);\n\t\t\t\t\tbreak;\n\t\t\t\tdefault:\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\t\n\t\tobj = obj.next;\n\t}\n}\n\nprivate function buildMesh(mesh:Object):void {\n\tvar numVertices:int = mesh.totvert;\n\tvar numFaces:int = mesh.totface;\n\tvar i:int;\n\t\n\ttrace(\" -\u003e #verts : \" + numVertices);\n\n\tfor (i = 0; i \u003c numVertices; i++) {\t\n\t\tvar v:Object = mesh.mvert[i];\n\t\t\n\t\tvar x:Number = v.co[0];\n\t\tvar y:Number = v.co[1];\n\t\tvar z:Number = v.co[2];\n\t\t\n\t\ttrace(\" -\u003e -\u003e vertex: \" + x + \" \" + y + \" \" + z);\n\t}\n\t\n\ttrace(\" -\u003e #faces : \" + numFaces);\n\t\n\tfor (i = 0; i \u003c numFaces; i++) {\t\n\t\tvar f:Object = mesh.mface[i];\n\t\t\n\t\tvar v1:int = f.v1;\n\t\tvar v2:int = f.v2;\n\t\tvar v3:int = f.v3;\n\t\tvar v4:int = f.v4;\n\t\t\n\t\ttrace(\" -\u003e -\u003e indices: \" + v1 + \" \" + v2 + \" \" + v3 + \" \" + v4);\n\t\t\n\t\tif (mesh.mtface) {\n\t\t\t// UV coords are defined\n\t\t\tvar tf:Object = mesh.mtface[i];\n\t\t\t\n\t\t\ttrace(\" -\u003e -\u003e -\u003e uv: \" + tf.uv);\n\t\t}\n\t}\n}\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftimknip%2Fasblender","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftimknip%2Fasblender","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftimknip%2Fasblender/lists"}