def setup(self): self.nb = netblend.open('NetBlendAddon.netblend') self.obj = None for o in self.nb.walk(): if isinstance(o, netblend.standard.Mesh): self.obj = o break
o = StrayLinker(o) n.add(o) print('adding lots of empty types') for i in range(5): o = SimpleType() n.add(o) print('adding circlic dependancy') o = StrayLinker() o.addi = o n.add(o) print('saving netblend as test.netblend') with open('test.netblend', 'wb+') as f: n.write(defs, f) print('cleaning up') del n del o print('opening test.netblend as a netblend') n = netblend.open(defs, 'test.netblend') print('printing objects') for o in n.walk(): print(' \033[1;33m' + o.__class__.__name__ + '\033[0m' + ' @ ' + str(id(o))) print(o) print('')
#! /usr/bin/env python3 # Tool to inspect the contents of a NetBlend. import netblend import sys, os if len(sys.argv) < 2 or not sys.argv[1].strip(): exit('Usage: inspect.py <file>') if not os.path.isfile(sys.argv[1]): exit('Wrong file') n = netblend.open(sys.argv[1]) print('') for o in n.walk(): print(' \033[1;33m' + o.__class__.__name__ + '\033[0m' + ' @ ' + str(id(o))) print(o) print('')