Sunday, 27 November 2011

python dictionaries

Python dictionaries are really, really damn useful in a pipeline. As you store information in a "key: value" type structure, like storing information on a character they repeatedly needs to be called throughout the pipeline, like its rig file path or characterId number. eg "chaInfo={'johnnyId':564,'davidId':565}", so when you call "character['johnnyId']", "564" is returned. Which can then be taken much further... "chaInfo={'johnny':{'num':'cha01','id':546,'file':{'mesh':'johnny_mesh_master.ma','rig':'johnny_rig_master.ma'}}}", so to get the right information you step through them, so for the rig file path you'd call "chaInfo['johnny']['path']['rig']", or the id number "chaInfo['johnny']['id']". So you could have all the information you need regarding an entity or object within a single file, which is very easily called as and when you need it.