[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [15465] branches/soc-2008-djd/release/ scripts/dump_libdata.py: updated the script to work in case of duplicate names, to avoid incorrect nesting
Dhanannjay Deo
dhandeo at gmail.com
Mon Jul 7 08:14:16 CEST 2008
Revision: 15465
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=15465
Author: djd
Date: 2008-07-07 08:13:58 +0200 (Mon, 07 Jul 2008)
Log Message:
-----------
updated the script to work in case of duplicate names, to avoid incorrect nesting
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-07 04:17:03 UTC (rev 15464)
+++ branches/soc-2008-djd/release/scripts/dump_libdata.py 2008-07-07 06:13:58 UTC (rev 15465)
@@ -10,7 +10,7 @@
__license__ = "GPL"
#import unittest
-#import Blender
+import Blender
import bpy
#import sys
@@ -35,6 +35,9 @@
# id is also name
def AddToTree(id, type, parent):
+ if id == parent:
+ id = '%s_2'%(id)
+
if not id in treeMap:
treeMap[id] = Node(id, type)
#~ print 'creating node %s as child to %s'%(type,treeMap[parent].type)
@@ -51,7 +54,7 @@
def print_map(node, lvl=0):
#~ print node.type, node.id, node.children
for n in node.children:
- print ' ' * lvl + '%s, %s'%(n.id,n.type)
+ print ' ' * lvl + '%s, %s, %d'%(n.id,n.type, len(n.children))
if len(n.children) > 0:
print_map(n, lvl+1)
@@ -79,7 +82,7 @@
for anObject in ob.objects:
#~ print " %s child of %s"%(anObject.getName(), anObject.getParent())
Name = anObject.getName();
-
+
if anObject.getParent() == None :
parentID = Scene.id
else:
@@ -89,11 +92,19 @@
if anObject.getData():
dblock = anObject.getData(0,1)
-
+ print dblock.name
+ try:
+ print dblock.getParent()
+ except:
+ a = 0
+
+ innerParent = AddToTree(dblock.name, '?' , Parent.id)
+ print innerParent.id
+
if anObject.getType() == 'Mesh':
# do processing with the materials
for aMat in dblock.materials:
- AddToTree(aMat.getName(), 'Material', Parent.id)
+ AddToTree(aMat.getName(), 'Material', innerParent.id)
if anObject.getIpo():
print " \tIPO%s"%anObject.getIpo().getName()
@@ -123,6 +134,6 @@
#~ print ob.getIpo()
#~ for ob in bpy.data.meshes:
- #~ print ob
+ #~ print ob.name
print_map(Root)
\ No newline at end of file
More information about the Bf-blender-cvs
mailing list