[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [15456] branches/soc-2008-djd/release/ scripts/dump_libdata.py: Commit from office, tested working version of dumping library data into dictionary files, now time to add direct data information to some of the leaves, like mesh
Dhanannjay Deo
dhandeo at gmail.com
Sun Jul 6 17:52:29 CEST 2008
Revision: 15456
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=15456
Author: djd
Date: 2008-07-06 17:52:29 +0200 (Sun, 06 Jul 2008)
Log Message:
-----------
Commit from office, tested working version of dumping library data into dictionary files, now time to add direct data information to some of the leaves, like mesh
Modified Paths:
--------------
branches/soc-2008-djd/release/scripts/dump_libdata.py
Modified: branches/soc-2008-djd/release/scripts/dump_libdata.py
===================================================================
--- branches/soc-2008-djd/release/scripts/dump_libdata.py 2008-07-06 15:38:51 UTC (rev 15455)
+++ branches/soc-2008-djd/release/scripts/dump_libdata.py 2008-07-06 15:52:29 UTC (rev 15456)
@@ -37,7 +37,7 @@
def AddToTree(id, type, parent):
if not id in treeMap:
treeMap[id] = Node(id, type)
- print 'creating node %s as child to %s'%(type,treeMap[parent].type)
+ #~ print 'creating node %s as child to %s'%(type,treeMap[parent].type)
else:
treeMap[id].id = id
treeMap[id].type = type
@@ -46,10 +46,12 @@
treeMap[parent] = Node(0, '')
treeMap[parent].children.append(treeMap[id])
+ return treeMap[id]
+
def print_map(node, lvl=0):
#~ print node.type, node.id, node.children
for n in node.children:
- print ' ' * lvl + n.type + n.id
+ print ' ' * lvl + '%s, %s'%(n.id,n.type)
if len(n.children) > 0:
print_map(n, lvl+1)
@@ -72,26 +74,27 @@
print ob;
# add the scene
- AddToTree(ob.name, 'Scene', 'Library_root')
+ Scene = AddToTree(ob.name, 'Scene', 'Library_root')
for anObject in ob.objects:
- print " %s"%anObject.getName()
+ #~ print " %s child of %s"%(anObject.getName(), anObject.getParent())
Name = anObject.getName();
-
- AddToTree(Name,'Scene','Library_root')
+
+ if anObject.getParent() == None :
+ parentID = Scene.id
+ else:
+ parentID = anObject.getParent().getName()
+ Parent = AddToTree(anObject.getName(),anObject.getType(), parentID)
+
if anObject.getData():
dblock = anObject.getData(0,1)
- try:
- print " \tData%s"%dblock.getName()
-
- except:
- print " \tMesh%s"%dblock
- try:
- print " \tMeshMaterials%s"%dblock.materials
- except:
- print " \tName%s"%dblock.name
-
+
+ if anObject.getType() == 'Mesh':
+ # do processing with the materials
+ for aMat in dblock.materials:
+ AddToTree(aMat.getName(), 'Material', Parent.id)
+
if anObject.getIpo():
print " \tIPO%s"%anObject.getIpo().getName()
@@ -105,8 +108,8 @@
if anObject.getTracked():
print " \tTracked%s"%anObject.getTracked().getName()
- if anObject.getParent():
- print ' \tParent:%s'%anObject.getParent().getName()
+ #~ if anObject.getParent():
+ #~ print ' \tParent:%s'%anObject.getParent().getName()
#~ for aProperty in anObject.getAllProperties()
@@ -114,13 +117,12 @@
print 'Members of materials ..%d objects'%len(bpy.data.materials)
-for ob in bpy.data.materials:
- print ob.getName()
- if ob.getIpo():
- print ob.getIpo()
+#~ for ob in bpy.data.materials:
+ #~ print ob.getName()
+ #~ if ob.getIpo():
+ #~ print ob.getIpo()
-
-for ob in bpy.data.meshes:
- print ob
+#~ for ob in bpy.data.meshes:
+ #~ print ob
print_map(Root)
\ No newline at end of file
More information about the Bf-blender-cvs
mailing list