[Bf-extensions-cvs] [82a6aba] master: io_blend_utils: added BlendFileBlock.dna_type_name property

Sybren A. Stüvel noreply at git.blender.org
Fri Sep 9 12:22:45 CEST 2016


Commit: 82a6aba1c73942b112c3b279faec1e7eea28f7a9
Author: Sybren A. Stüvel
Date:   Fri Sep 9 12:14:48 2016 +0200
Branches: master
https://developer.blender.org/rBA82a6aba1c73942b112c3b279faec1e7eea28f7a9

io_blend_utils: added BlendFileBlock.dna_type_name property

Just to make it easier to get to the name of the DNA type from other
Python scripts.

===================================================================

M	io_blend_utils/blend/blendfile.py

===================================================================

diff --git a/io_blend_utils/blend/blendfile.py b/io_blend_utils/blend/blendfile.py
index 516524a..2e98544 100644
--- a/io_blend_utils/blend/blendfile.py
+++ b/io_blend_utils/blend/blendfile.py
@@ -297,7 +297,7 @@ class BlendFileBlock:
         return ("<%s.%s (%s), size=%d at %s>" %
                 # fields=[%s]
                 (self.__class__.__name__,
-                 self.dna_type.dna_type_id.decode('ascii'),
+                 self.dna_type_name,
                  self.code.decode(),
                  self.size,
                  # b", ".join(f.dna_name.name_only for f in self.dna_type.fields).decode('ascii'),
@@ -345,6 +345,10 @@ class BlendFileBlock:
     def dna_type(self):
         return self.file.structs[self.sdna_index]
 
+    @property
+    def dna_type_name(self):
+        return self.dna_type.dna_type_id.decode('ascii')
+
     def refine_type_from_index(self, sdna_index_next):
         assert(type(sdna_index_next) is int)
         sdna_index_curr = self.sdna_index



More information about the Bf-extensions-cvs mailing list