Skip to content

Instantly share code, notes, and snippets.

@selfsame
Last active March 3, 2016 22:03
Show Gist options
  • Select an option

  • Save selfsame/e1c85a97e01b45ca83b2 to your computer and use it in GitHub Desktop.

Select an option

Save selfsame/e1c85a97e01b45ca83b2 to your computer and use it in GitHub Desktop.
os.makedirs(dump_path)
for s in bpy.data.scenes:
print(" - scene: ", s.name)
for o in s.objects:
o.select = False
for o in s.objects:
print(" - object: ", o.name)
o.select = True
record_name = o.name + ".fbx"
try: os.remove(dump_path + record_name)
except: 0
bpy.ops.export_scene.fbx(filepath=dump_path + record_name, use_selection=True, use_metadata=False, apply_unit_scale=True, axis_forward="Y", axis_up="Z",version="ASCII6100", object_types={'EMPTY', 'CAMERA', 'LAMP', 'ARMATURE', 'MESH', 'OTHER'}, use_anim_optimize=True, )
o.select = False
print("#FINE\n")
Expression = (Comment / Pair)*
Comment = _ (";" [^\n]+ [\n])+ {
return {"comment": text()} }
Map = _ "{" _ val:(Pair)* _ [\n]? _ "}" _
{return val;}
Pair = p:(Key (Value)*) {
var value = p[1];
if (value.length == 0) {value = undefined}
else if (value.length == 1) {value = value[0]}
var res = {};
res[p[0]] = value;
return res}
Key = (_ [\,\n])* _ val:([^:\{\}]+) _ ":" {
return val.join(""); }
Value = _ val:(Float / Integer / Symbol / String / Map) _ {
return val; }
Symbol = ([A-Za-z0-9]+) {return text();}
String = [\"] val:( "\\\"" / [^"])* [\"] {
return "\"" + val.join("") + "\""; }
Float = _ col:(("-" / "" ) [0-9]+ "." [0-9]+) _ {
var res = "";
for (i=0; i < col.length; i++) {
try { res += col[i].join("");}
catch (Error) { res += String(col[i]);}}
return res; }
Integer "integer" = _ col:(("-" / "" )[0-9]+) _ {
var res = "";
for (i=0; i < col.length; i++) {
if (col[i]){
try { res += col[i].join("");}
catch (Error) {res += String(col[i]);}}}
return res;}
_ "whitespace" = [ \t\,\n]*
peg = require("./parser.js");
moon3 = require("./moon-collection-2.json");
fs = require('fs');
fbx = "";
target = process.argv[2];
output = process.argv[3] || "" + target + ".json";
fs.readFile(target, function (err, data) {
if (err) {
throw err;
}
fs.writeFile(output, JSON.stringify(peg.parse(data.toString())),
function(err) {
if(err) {return console.log(err);}});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment