Пример #1
0
 def execute(self, context):
     root = sUtils.getRoot(context.selected_objects[0])
     objectlist = sUtils.getChildren(root,
                                     selected_only=True,
                                     include_hidden=False)
     sUtils.selectObjects(objectlist)
     poses = models.getPoses(root['modelname'])
     i = 1
     for pose in poses:
         sUtils.selectObjects([root] + objectlist, clear=True, active=0)
         models.loadPose(root['modelname'], pose)
         parameter = self.decimate_ratio
         if self.decimate_type == 'UNSUBDIV':
             parameter = self.decimate_iteration
         elif self.decimate_type == 'DISSOLVE':
             parameter = self.decimate_angle_limit
         exporter.bakeModel(objectlist,
                            root['modelname'],
                            pose,
                            decimate_type=self.decimate_type,
                            decimate_parameter=parameter)
         display.setProgress(i / len(poses))
         i += 1
     sUtils.selectObjects([root] + objectlist, clear=True, active=0)
     bpy.ops.scene.reload_models_and_poses_operator()
     return {'FINISHED'}
Пример #2
0
    def execute(self, context):
        """

        Args:
          context: 

        Returns:

        """
        root = sUtils.getRoot(context.selected_objects[0])
        objectlist = sUtils.getChildren(root, selected_only=True, include_hidden=False)
        sUtils.selectObjects(objectlist)
        poses = models.getPoses(root['model/name'])
        i = 1
        for pose in poses:
            sUtils.selectObjects([root] + objectlist, clear=True, active=0)
            models.loadPose(root['model/name'], pose)
            parameter = self.decimate_ratio
            if self.decimate_type == 'UNSUBDIV':
                parameter = self.decimate_iteration
            elif self.decimate_type == 'DISSOLVE':
                parameter = self.decimate_angle_limit
            exporter.bakeModel(
                objectlist,
                root['model/name'],
                pose,
                decimate_type=self.decimate_type,
                decimate_parameter=parameter,
            )
            display.setProgress(i / len(poses))
            i += 1
        sUtils.selectObjects([root] + objectlist, clear=True, active=0)
        bpy.ops.scene.reload_models_and_poses_operator()
        return {'FINISHED'}