Forum: Poser Python Scripting


Subject: Parsing Class for Poser files - Comments/Suggestions

tromnek opened this issue on Jan 06, 2005 ยท 11 posts


tromnek posted Fri, 07 January 2005 at 9:51 PM

Here is an example for materials. It's using a function to pick only the Torso and Head materials

      def pickonlysome(rtn):
        if rtn['materials'][0] in ( 'SkinTorso', 'SkinHead' ):
          return 1
        return 0
      reMAT   = re.compile( r'bmaterials+(.+)b', re.IGNORECASE )
      reValue = re.compile( r'(.+)', re.IGNORECASE )
      Materials= ParmList( 'value', reValue, dosomethingimportant )
      Materials.newparent( 'materials', reMAT, pickonlysome )

      # Pass the linked list to the class and let it rip.
      junk = ParmExecuter( inStr, Materials )

Searching a big cr2 file takes some time. The above example took 25 seconds for a 41MB file.