vanadiumlabs / pypose

PyPose and NUKE
9 stars 10 forks source link

YAML as config syntax? #13

Open erazor83 opened 11 years ago

erazor83 commented 11 years ago

Hi,

I was wondering if it'd make sense to convert the project-config format to yaml.

Here are old and new formats compared to each other:

Legs:18:1024:1024:1024:1024:1024:1024:1024:1024:1024:1024:1024:1024:1024:1024:1024:1024:1024:1024
Pose=ik_neutral:512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512
Nuke=Lizard 3DOF,6,++++++++++++++++++,55,66,130,125,60,50,0,0,2,1,4,3,6,5,14,13,16,15,18,17,8,7,10,9,12,11

YAML:

name: Legs
count: 18
resolution: [1024,1024,1024,1024,1024,1024,1024,1024,1024,1024,1024,1024,1024,1024,1024,1024,1024,1024]
poses:
  ik_neutral: [512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512]
Nuke: "Lizard 3DOF,6,++++++++++++++++++,55,66,130,125,60,50,0,0,2,1,4,3,6,5,14,13,16,15,18,17,8,7,10,9,12,11"

The first line could contain "#YAML" so pyPose would distinguish between old and YAML format.

What do you think?

erazor83 commented 11 years ago

Well, I've implemented this in https://github.com/erazor83/pypose/commit/a1d7930a96fa30348b37401c126a4fae8f1d3122 already tested and seems to work nicely. I also added the option to store the connection setup. When the user does not have pyYAML, the old syntax is used. Yaml is used when supported and first char of file is #.