{"id":240,"date":"2011-02-27T06:08:37","date_gmt":"2011-02-27T06:08:37","guid":{"rendered":"http:\/\/www.funkboxing.com\/wordpress\/?p=240"},"modified":"2021-08-26T19:51:16","modified_gmt":"2021-08-26T19:51:16","slug":"dance-bvh-blender-fixer","status":"publish","type":"post","link":"http:\/\/funkboxing.com\/wordpress\/?p=240","title":{"rendered":"DANCE BVH -> Blender converter thing"},"content":{"rendered":"<p>This is a very simple script I wrote to make BVH&#8217;s exported from <a href=\"http:\/\/www.arishapiro.com\/dance\/\" target=\"_blank\" rel=\"noopener noreferrer\">DANCE<\/a> (Dynamic Animation and Control Environment) able to be imported into Blender.<\/p>\n<p>It just adds blank channels to joints if there are less than 3.<\/p>\n<pre class=\"brush:py\">\"\"\"\nDANCE BVH EXPORT THING\n-Simple BVH file thing that adds blank channels of\n    position to JOINTS and FRAMES to allow BVH Exports from \n    DANCE (Dynamic Animation and Control Environment) to be\n    imported into Blender.\nwww.funkboxing.com\n\"\"\"\n\ninfile = \"c:\\workspace\\bvhMINE\\bvhdata\\skelORIG2.bvh\"\noutfile = \"c:\\workspace\\bvhMINE\\bvhdata\\skelTESTOUT.bvh\"\n\ndef loadDANCEBVH(fin, fout):\n    tab = chr(9)\n    f = open(fin, 'r')\n    lines = f.readlines()\n    f.close()\n    \n    newlines = list(lines)\n    newlines[16] = str(tab+tab+tab+tab+\"CHANNELS 3 Xrotation Yrotation Zrotationn\")\n    newlines[30] = str(tab+tab+tab+tab+\"CHANNELS 3 Yrotation Xrotation Zrotationn\")\n    newlines[34] = str(tab+tab+tab+tab+\"CHANNELS 3 Yrotation Zrotation Xrotationn\")\n    newlines[49] = str(tab+tab+tab+tab+\"CHANNELS 3 Yrotation Xrotation Zrotationn\")    \n    newlines[53] = str(tab+tab+tab+tab+\"CHANNELS 3 Yrotation Zrotation Xrotationn\")    \n    newlines[69] = str(tab+tab+tab+tab+\"CHANNELS 3 Xrotation Yrotation Zrotationn\")    \n    newlines[73] = str(tab+tab+tab+tab+\"CHANNELS 3 Xrotation Zrotation Yrotationn\")    \n    newlines[88] = str(tab+tab+tab+tab+\"CHANNELS 3 Xrotation Yrotation Zrotationn\")\n    newlines[92] = str(tab+tab+tab+tab+\"CHANNELS 3 Xrotation Zrotation Yrotationn\")    \n\n    for li in range(104, len(lines)):\n        vals = lines[li].split(\" \")\n        vals.insert(12, '0')\n        vals.insert(12, '0')\n        vals.insert(19, '0')\n        vals.insert(21, '0')\n        vals.insert(27, '0')\n        vals.insert(30, '0')\n        vals.insert(30, '0')\n        vals.insert(35, '0')\n        vals.insert(35, '0')\n        vals.insert(39, '0')\n        vals.insert(44, '0')\n        vals.insert(44, '0')\n        vals.insert(48, '0')\n        newlines[li] = \" \".join(vals) \n    \n    fo = open(fout, 'w')\n    fo.writelines(newlines)\n        \n        \n        \n        \nloadDANCEBVH(infile, outfile)\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>This is a very simple script I wrote to make BVH&#8217;s exported from DANCE (Dynamic Animation and Control Environment) able to be imported into Blender. It just adds blank channels to joints if there are less than 3. &#8220;&#8221;&#8221; DANCE BVH EXPORT THING -Simple BVH file thing that adds blank channels of position to JOINTS <a href='http:\/\/funkboxing.com\/wordpress\/?p=240' class='excerpt-more'>[&#8230;]<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[3,5,47],"tags":[24,28],"_links":{"self":[{"href":"http:\/\/funkboxing.com\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/240"}],"collection":[{"href":"http:\/\/funkboxing.com\/wordpress\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/funkboxing.com\/wordpress\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/funkboxing.com\/wordpress\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/funkboxing.com\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=240"}],"version-history":[{"count":2,"href":"http:\/\/funkboxing.com\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/240\/revisions"}],"predecessor-version":[{"id":2726,"href":"http:\/\/funkboxing.com\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/240\/revisions\/2726"}],"wp:attachment":[{"href":"http:\/\/funkboxing.com\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=240"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/funkboxing.com\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=240"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/funkboxing.com\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=240"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}