示例#1
0
    def handleDuplis(self, obj, particle_system=None):
        try:
            #if obj in self.ExportedDuplis:
            #    indigo_log('Duplis for object %s already exported'%obj)
            #    return

            try:
                obj.dupli_list_create(self.scene, 'RENDER')
                if not obj.dupli_list:
                    raise Exception('cannot create dupli list for object %s' % obj.name)
            except Exception as err:
                indigo_log('%s'%err)
                return
                
            exported_objects = 0

            # Create our own DupliOb list to work around incorrect layers
            # attribute when inside create_dupli_list()..free_dupli_list()
            for dupli_ob in obj.dupli_list:
                if dupli_ob.object.type not in self.supported_mesh_types:
                    continue
                if not indigo_visible(self.scene, dupli_ob.object, is_dupli=True):
                    continue

                do = dupli_ob.object
                dm = dupli_ob.matrix.copy()
                
                # Check for group layer visibility, if the object is in a group
                gviz = len(do.users_group) == 0
                for grp in do.users_group:
                    gviz |= True in [a&b for a,b in zip(do.layers, grp.layers)]
                if not gviz:
                    continue

                exported_objects += 1
                
                self.exportModelElements(
                    do,
                    self.buildMesh(do),
                    dm,
                    dupli_ob,
                    particle_system
                )

            obj.dupli_list_clear()
            
            self.ExportedDuplis[obj] = True
            
            if self.verbose: indigo_log('... done, exported %s duplis' % exported_objects)

        except SystemError as err:
            indigo_log('Error with handleDuplis and object %s: %s' % (obj, err))
示例#2
0
 def handleDuplis(self, obj, particle_system=None):
     if self.CheckedDuplis.have(obj): return
     self.CheckedDuplis.add(obj, obj)
     
     try:
         obj.dupli_list_create(self.scene, 'RENDER')
         if not obj.dupli_list:
             raise Exception('cannot create dupli list for object %s' % obj.name)
     except Exception as err:
         indigo_log('%s'%err)
         return
     
     for dupli_ob in obj.dupli_list:
         if dupli_ob.object.type not in self.supported_mesh_types:
             continue
         if not indigo_visible(self.scene, dupli_ob.object, is_dupli=True):
             continue
         
         self.handleMesh(dupli_ob.object)
     
     obj.dupli_list_clear()
示例#3
0
 def handleDuplis(self, obj, particle_system=None):
     if self.CheckedDuplis.have(obj): return
     self.CheckedDuplis.add(obj, obj)
     
     try:
         obj.dupli_list_create(self.scene, 'RENDER')
         if not obj.dupli_list:
             raise Exception('cannot create dupli list for object %s' % obj.name)
     except Exception as err:
         indigo_log('%s'%err)
         return
     
     for dupli_ob in obj.dupli_list:
         if dupli_ob.object.type not in self.supported_mesh_types:
             continue
         if not indigo_visible(self.scene, dupli_ob.object, is_dupli=True):
             continue
         
         self.handleMesh(dupli_ob.object)
     
     obj.dupli_list_clear()