Beispiel #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'}
Beispiel #2
0
    def execute(self, context):
        root = sUtils.getRoot(context.selected_objects[0])

        modelsPosesColl = bpy.context.user_preferences.addons[
            'phobos'].preferences.models_poses
        activeModelPoseIndex = bpy.context.scene.active_ModelPose
        selected_robot = modelsPosesColl[
            bpy.data.images[activeModelPoseIndex].name]

        objectlist = sUtils.getChildren(root,
                                        selected_only=True,
                                        include_hidden=False)
        sUtils.selectObjects([root] + objectlist, clear=True, active=0)
        models.loadPose(selected_robot.robot_name, selected_robot.label)
        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'],
                           selected_robot.label,
                           decimate_type=self.decimate_type,
                           decimate_parameter=parameter)
        sUtils.selectObjects([root] + objectlist, clear=True, active=0)
        bpy.ops.scene.reload_models_and_poses_operator()
        return {'FINISHED'}
Beispiel #3
0
    def execute(self, context):
        """

        Args:
          context: 

        Returns:

        """
        root = sUtils.getRoot(context.selected_objects[0])

        modelsPosesColl = bUtils.getPhobosPreferences().models_poses
        activeModelPoseIndex = bpy.context.scene.active_ModelPose
        selected_robot = modelsPosesColl[bpy.data.images[activeModelPoseIndex].name]

        objectlist = sUtils.getChildren(root, selected_only=True, include_hidden=False)
        sUtils.selectObjects([root] + objectlist, clear=True, active=0)
        models.loadPose(selected_robot.robot_name, selected_robot.label)
        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'],
            selected_robot.label,
            decimate_type=self.decimate_type,
            decimate_parameter=parameter,
        )
        sUtils.selectObjects([root] + objectlist, clear=True, active=0)
        bpy.ops.scene.reload_models_and_poses_operator()
        return {'FINISHED'}
Beispiel #4
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'}
Beispiel #5
0
 def execute(self, context):
     global current_robot_name
     current_robot_name = self.robot_name
     models.loadPose(self.robot_name, self.pose_name)
     return {'FINISHED'}