예제 #1
0
    def execute(self, context: bpy.types.Context) -> set:
        """Import a 3D reconstruction.

        Returns:
            set -- {'FINISHED'}
        """
        logger.info("Importing reconstruction form file: %s", self.filepath)
        i_map = ReconstructionBase.get_supported_files()
        path = Path(self.filepath)
        ext = ''.join(path.suffixes)
        recon = i_map[ext](path.stem,
                           self.filepath)  # import the reconstruction file
        #
        # sample ground truth
        if ReconstructionsManager.gt_points is None:
            gt_points = SFMFLOW_OT_sample_geometry_gt.sample_geometry_gt_points(
                context.scene)
            ReconstructionsManager.set_gt_points(gt_points)
        #
        # store the reconstruction
        ReconstructionsManager.add_reconstruction(recon)
        recon.show()
        #
        if len(
                recon.models
        ) == 1:  # if only one model loaded set it as active object in the viewport
            recon.models[0].set_active(context)
        #
        msg = "Reconstruction `{}` imported".format(recon.name)
        logger.info(msg)
        self.report({'INFO'}, msg)
        return {'FINISHED'}
예제 #2
0
    def execute(self, context: bpy.types.Context) -> set:
        """Sample ground truth point cloud.

        Returns:
            set -- {'FINISHED'}
        """
        gt_points = SFMFLOW_OT_sample_geometry_gt.sample_geometry_gt_points(
            context.scene)
        ReconstructionsManager.set_gt_points(gt_points)
        #
        msg = "Sampled {} points".format(len(gt_points))
        logger.info(msg)
        self.report({'INFO'}, msg)
        return {'FINISHED'}