Esempio n. 1
0
    def __init__(self):
        from Utility.Config     import Config
        from Utility.MNG_JSON   import MNG_JSON

        config_obj              = Config()
        self.__json_obj         = MNG_JSON()
        self.__print_screen_typ = config_obj.get_value('print_screen_typ')
Esempio n. 2
0
    def __init__(self):
        from Utility.Config         import Config
        from Utility.MNG_JSON       import MNG_JSON
        from Utility.Print_Control  import Print_Control

        config_obj                  = Config()
        self.__json_obj             = MNG_JSON()
        self.__print_control_obj    = Print_Control()
        self.__deflt_end_score      = config_obj.get_value('deflt_end_score')
Esempio n. 3
0
    def __init__(self):
        from Utility.Config     import Config
        from Utility.MNG_JSON   import MNG_JSON

        config_obj              = Config()
        self.__json_obj         = MNG_JSON()

        self.__playr1_symbol    = config_obj.get_value('playr1_symbol')
        self.__playr2_symbol    = config_obj.get_value('playr2_symbol')
        self.__empty_spc        = config_obj.get_value('empty_spc')
        self.__board_height     = config_obj.get_value('board_height')
        self.__board_width      = config_obj.get_value('board_width')
Esempio n. 4
0
    def __init__(self):
        from Utility.Config     import Config
        from Utility.MNG_JSON   import MNG_JSON
        from MNG_Player         import MNG_Player
        from MNG_Game_Status    import MNG_Game_Status

        config_obj              = Config()
        self.__json_obj         = MNG_JSON()
        self.__player_obj       = MNG_Player()
        self.__game_status_obj  = MNG_Game_Status()

        self.__board_width      = config_obj.get_value('board_width')
        self.__board_height     = config_obj.get_value('board_height')
        self.__empty_spc        = config_obj.get_value('empty_spc')
Esempio n. 5
0
    def test_Logout(self, action):
        '''
        This test case create for logout user successfully
        :param action:
        :return:
        '''
        conf = Config()
        data = LoginFlow()

        test = Asserts.Assertions()
        request = APIRequest.APIRequest(action)

        host = conf.loginHost_debug
        req_url = 'https://' + host
        urls = data.url
        headers = data.header

        api_url = req_url + urls[2]

        response = request.get_request_methods(api_url, None, headers[2])

        assert test.assert_code(response['code'], 200)
        assert test.assert_body(response['body'], 'success', 'True')
        assert test.assert_text(response['body']['response'], 'Successfully Logged out')
        assert test.assert_time(response['consuming_time'], 1000)
Esempio n. 6
0
    def test_LoginCheck(self, action):
        '''
        This test case create for login user after check login success full
        :param action:
        :return:
        '''
        conf = Config()
        data = LoginFlow()

        test = Asserts.Assertions()
        request = APIRequest.APIRequest(action)

        host = conf.loginHost_debug
        req_url = 'https://' + host
        urls = data.url
        params = data.data
        headers = data.header

        api_url = req_url + urls[1]
        response = request.get_request_methods(api_url, params[1], headers[1])

        assert test.assert_code(response['code'], 200)
        assert test.assert_body(response['body'], 'success', 'True')
        assert test.assert_text(response['body']['response']['email'], params[1]['username'])
        assert test.assert_time(response['consuming_time'], 1000)
def action():
    conf = Config()
    env = conf.environment_debug
    host = conf.host_debug
    tester = conf.tester_debug
    # allure.environment(environment=env)
    # allure.environment(hostname=host)
    # allure.environment(tester=tester)
    return env
Esempio n. 8
0
def configure_libs_for_blender():
    """
    This method is called by "Blender_Script_Executor"
    :return:
    """

    # Add the parent folder of the BlenderUtility to the python path
    # in order to enable acess the BlenderUtility package and all subpackages (e.g. Utility)
    sys.path.insert(
        0, os.path.dirname(os.path.dirname(os.path.realpath(__file__))))

    from Utility.Logging_Extension import logger
    from Utility.Config import Config

    additional_system_paths = []

    parent_dp = os.path.dirname(os.path.realpath(__file__))
    example_config_path = os.path.join(parent_dp, 'Config',
                                       'blender_script_executor_example.cfg')
    config_path = os.path.join(parent_dp, 'Config',
                               'blender_script_executor.cfg')
    if not os.path.isfile(config_path):
        copyfile(example_config_path, config_path)

    blender_script_config = Config(path_to_config_file=config_path)
    custom_paths = blender_script_config.get_option_value('custom_paths', list)

    additional_system_paths += custom_paths

    python_type = blender_script_config.get_option_value('python_type', str)

    assert python_type in [DEFAULT, ANACONDA]

    if python_type == DEFAULT:
        logger.info(
            'Adding Default Python Paths to Blender Executable (No Anaconda Paths)'
        )
        python_sys_path_default_list = blender_script_config.get_option_value(
            'python_sys_path_default', list)
        additional_system_paths += python_sys_path_default_list

        python_sys_path_local_list = blender_script_config.get_option_value(
            'python_sys_path_local', list)
        additional_system_paths += python_sys_path_local_list

    elif python_type == ANACONDA:

        logger.info('Adding ANACONDA3 Paths to Blender Executable')
        python_anaconda_path_list = blender_script_config.get_option_value(
            'python_anaconda_path', list)
        additional_system_paths += python_anaconda_path_list
    else:
        assert False

    add_paths_to_system_path_if_necessary(additional_system_paths)
Esempio n. 9
0
class FFmpeg:

    parent_dp = os.path.dirname(os.path.realpath(__file__))
    path_to_config = os.path.join(parent_dp, 'FFmpeg.cfg')
    path_to_config_example = os.path.join(parent_dp, 'FFmpeg_example.cfg')
    if not os.path.isfile(path_to_config):
        copyfile(path_to_config_example, path_to_config)
    cloud_compare_config = Config(path_to_config)

    if platform.system() == 'Windows':
        path_to_executable = cloud_compare_config.get_option_value(
            'ffmpeg_path_windows', str)
    else:
        # this points to cloud compare 2.10 (with qt 5.7)
        path_to_executable = cloud_compare_config.get_option_value(
            'ffmpeg_path_linux', str)

    if not os.path.isfile(path_to_executable):
        path_to_executable = 'ffmpeg'

    @staticmethod
    def get_exec_path():
        return FFmpeg.path_to_executable
Esempio n. 10
0
class CloudCompare:
    """
    This is an interface to the cloudcompare command line mode

    For more information visit:
        http://www.cloudcompare.org/doc/wiki/index.php?title=Command_line_mode
            By default, this mode only opens a small console window, applies the requested actions,
            and eventually saves the result in a file in the same directory(ies) as the input file(s).

        http://www.cloudcompare.org/doc/qCC/CloudCompare%20v2.6.1%20-%20User%20manual.pdf
            CloudCompare Version 2.6.1
            Command line mode is documented on Page 171 (Appendix)

    There are two modes:
        1. Use static methods for a specific purpose
        2. Use non-static methods to build dynamically (long) point cloud commands.
           The final execution is called using "execute_previous_commands".
    """

    SUPPORTED_CLOUD_FILE_FORMATS = [
        'ASC', 'BIN', 'PLY', 'LAS', 'E57', 'VTK', 'PCD', 'SOI', 'PN', 'PV'
    ]
    SUPPORTED_MESH_FILE_FORMATS = [
        'BIN', 'OBJ', 'PLY', 'STL', 'VTK', 'MA', 'FBX'
    ]

    parent_dp = os.path.dirname(os.path.realpath(__file__))
    path_to_config = os.path.join(parent_dp, 'CloudCompare.cfg')
    path_to_config_example = os.path.join(parent_dp,
                                          'CloudCompare_example.cfg')
    if not os.path.isfile(path_to_config):
        copyfile(path_to_config_example, path_to_config)
    cloud_compare_config = Config(path_to_config)

    if platform.system() == 'Windows':
        path_to_executable = cloud_compare_config.get_option_value(
            'cloud_compare_path_windows', str)
    else:
        # this points to cloud compare 2.10 (with qt 5.7)
        path_to_executable = cloud_compare_config.get_option_value(
            'cloud_compare_path_linux', str)

    def __init__(self):
        self.cmd_options = ['-SILENT'
                            ]  # enables silent mode (no console will appear)
        self.cc_auto_save(
            save_flag='OFF'
        )  # we do not want to enable auto save, this could produce multiple models

        # 'BIN' is the default output file format of cloudcompare
        self.cloud_output_file_format = '.BIN'  # this can be changed by using cc_set_cloud_export_format(format_str)
        self.mesh_output_file_format = '.BIN'  # this can be changed by using cc_set_mesh_export_format(format_str)

        # Output File Name Structure of CloudCompare:

        # Output point cloud files are stored in the folder
        #   of the first loaded point cloud
        #   of the first loaded mesh if no point cloud was loaded
        # Output mesh files are stored in the folder
        #   of the first loaded mesh
        #   of the first loaded point cloud if no mesh was loaded

        # Since there are "overlapping" file formats (like .bin, .ply. .vtk) we do not know in advance, if the loaded
        # object is a point cloud or a mesh. Thus, there are two possible folders, where the output will be created.

        self.loaded_file_path_list = []
        self.output_suffix = ''

    def cc_open(self, file_path):
        if not os.path.isfile(file_path):
            logger.vinfo('file_path', file_path)
            assert False  # Input File does not exist!
        self.cmd_options += ['-O', file_path]
        self.loaded_file_path_list.append(file_path)

    def cc_statistical_outlier_removal(self,
                                       number_of_neighbors=6,
                                       sigma_multiplier=1.0):
        self.cmd_options += [
            '-SOR', str(number_of_neighbors),
            str(sigma_multiplier)
        ]

    def cc_subsampling(self,
                       subsampling_mode='OCTREE',
                       subsampling_parameter=9):
        """
        -SS {algorithm} {parameter}
        """
        self.cmd_options += [
            '-SS', subsampling_mode,
            str(subsampling_parameter)
        ]

    def cc_apply_trans(self, matrix_transformation_file_path):
        """
        The matrix is read from a simple text file with the matrix rows on each line (4 values per lines, 4 lines).
        Each entity will be replaced in memory by its transformed version

        IMPORTANT: Apply_trans was added in 2.6.1 (Ubuntu is running 2.6.0)
            http://cloudcompare.org/forum/viewtopic.php?t=1153

        :param matrix_transformation_file_path:
        :return:
        """
        self.cmd_options += ['-APPLY_TRANS', matrix_transformation_file_path]

    def cc_compute_cloud_to_cloud_distance(self):
        """
        See documentation of compute_cloud_to_mesh_distance()
        :return:
        """
        self.cmd_options += ['-C2C_DIST']
        self.output_suffix += '_C2C_DIST'

    def cc_compute_cloud_to_mesh_distance(self):
        """
        CC will load cloud1.bin and mesh.obj, then compute the distance from cloud1 (compared) relatively to mesh
        (reference). On output a file cloud1_C2M_DIST_YYYY-MM-DD_HHhMM.bin will be generated (with the resulting
        distances as scalar field). Note: this cloud stays in memory and can be processed further
        (with -FILTER_SF for instance).

        Results are stored as scalar field (SF), which is a property of the point cloud. The scalar field is a property
        of the (automatically) saved point cloud (e.g. is a property in the .asc. or .ply file)

        In addition, the scalar field (SF) can be processed within cloudcompare using for example
            'STAT_TEST {distrib} {distrib parameters} {p-value} {neighbors count}'
            '-FILTER_SF {minVal} {maxVal}'
            '-SF_ARITHMETIC {SF index} {operation}'
            '-SF_OP {SF index} {operation} {value}'
            '-SET_ACTIVE_SF {index}'
            '-REMOVE_ALL_SFS'

        """
        self.cmd_options += ['-C2M_DIST']
        self.output_suffix += '_C2M_DIST'

    def cc_auto_save(self, save_flag='OFF'):
        """
        By default clouds/meshes are saved automatically in the input folder. The automatically saved files contain
        the names of the operation, which were applied to these objects.
        Calling the method again with a different parameter will overwrite the previous call.
        :param save_flag: ON or OFF
        :return:
        """
        self.cmd_options += ['-AUTO_SAVE', save_flag]

    def _cc_set_cloud_export_format(self, format_str='BIN', prepend=True):
        """
        Specifies the default output format for clouds.
        Format can be one of the following: ASC, BIN, PLY, LAS, E57, VTK, PCD, SOI, PN, PV.
        -C_EXPORT_FMT {format}
        :return:
        """

        self.cmd_options += ['-C_EXPORT_FMT', format_str]
        self.cloud_output_file_format = '.' + format_str

    def _cc_set_mesh_export_format(self, format_str='BIN'):
        """
        Specifies the default output format for clouds.
        Format can be one of the following: BIN, OBJ, PLY, STL, VTK, MA, FBX.
        :param format_str:
        :return:
        """
        self.cmd_options += ['-M_EXPORT_FMT', format_str]
        self.mesh_output_file_format = '.' + format_str

    def _cc_save_clouds(self, ofp):
        user_ext = (os.path.splitext(ofp)[1])[1:].upper()
        # necessary to define the output file format,
        # since cloud compare uses by default .bin
        self._cc_set_cloud_export_format(user_ext)
        # https://github.com/CloudCompare/CloudCompare/pull/667
        self.cmd_options += ['-SAVE_CLOUDS', 'FILE', ofp]

    def _cc_save_meshes(self, ofp):
        user_ext = (os.path.splitext(ofp)[1])[1:].upper()
        # necessary to define the output file format,
        # since cloud compare uses by default .bin
        self._cc_set_mesh_export_format(user_ext)
        # https://github.com/CloudCompare/CloudCompare/pull/667
        self.cmd_options += ['-SAVE_MESHES', 'FILE', ofp]

    def cc_save_clouds_and_meshes(self):
        self.cmd_options += ['-SAVE_CLOUDS']
        self.cmd_options += ['-SAVE_MESHES']

    def execute_and_save_result_to_disc(self,
                                        ofp,
                                        save_clouds=False,
                                        save_meshes=False,
                                        reset_options=True,
                                        lazy=False):
        """
        The output file format must support the output object type (i.e. mesh / cloud).

        Remark: Executing cloudcompare may throw the following error message:
            QInotifyFileSystemWatcherEngine::addPaths: inotify_add_watch failed: No space left on device
            QFileSystemWatcher: failed to add paths: /home/sebastian/.config/ibus/bus
            QInotifyFileSystemWatcherEngine::addPaths: inotify_add_watch failed: No space left on device
            QFileSystemWatcher: failed to add paths: /home/sebastian/.config/ibus/bus/d3d562ee6c50f192ecc2af5d55bb69ab-unix-0

            However, it works as expected (i.e. ignore this error message)

        :param reset_options:
        :return:
        """

        logger.info('execute_and_save_result_to_disc: ...')

        if not (save_clouds ^ save_meshes):
            logger.info('Either save_clouds or save_meshes must be True')
            assert False

        if save_clouds:
            self._cc_save_clouds(ofp)
        if save_meshes:
            self._cc_save_meshes(ofp)

        if not lazy or not os.path.isfile(ofp):
            cc_call = [CloudCompare.path_to_executable] + self.cmd_options
            logger.info('CloudCompare call: ' + str(cc_call))
            subprocess.call(cc_call)

        if reset_options:
            self.cmd_options = ['-SILENT']

        logger.info('execute_and_save_result_to_disc: Done')

    @staticmethod
    def statistical_outlier_removal(ifp,
                                    ofp,
                                    number_of_neighbors=6,
                                    lazy=False):

        # https://www.cloudcompare.org/doc/wiki/index.php?title=SOR_filter
        # The 'SOR filter' tool resembles a lot the S.O.R. (Statistical Outlier Removal) of the PCL library
        # http://pointclouds.org/documentation/tutorials/statistical_outlier.php

        cloud_compare = CloudCompare()
        # cc_open checks presence of file
        cloud_compare.cc_open(ifp)
        cloud_compare.cc_statistical_outlier_removal(
            number_of_neighbors=number_of_neighbors, sigma_multiplier=1.0)
        cloud_compare.execute_and_save_result_to_disc(ofp,
                                                      save_clouds=True,
                                                      lazy=lazy)

    @staticmethod
    def apply_transformation(ifp_model,
                             transformation_mat,
                             ofp_model,
                             save_point_clouds,
                             save_meshes,
                             lazy=False):

        if not isinstance(transformation_mat, np.ndarray):
            logger.vinfo('type(transformation_mat)', type(transformation_mat))
            assert False

        unique_filename = uuid.uuid4().hex
        transformation_fp = os.path.join(
            os.path.dirname(CloudCompare.path_to_executable), unique_filename)
        np.savetxt(transformation_fp, transformation_mat)
        CloudCompare.apply_transformation_from_file(ifp_model,
                                                    transformation_fp,
                                                    ofp_model,
                                                    save_point_clouds,
                                                    save_meshes, lazy)
        os.remove(transformation_fp)
        assert not os.path.isfile(transformation_fp)

    @staticmethod
    def apply_transformation_from_file(ifp_model,
                                       ifp_transformation,
                                       ofp_model,
                                       save_point_clouds,
                                       save_meshes,
                                       lazy=False):
        """
        :param ifp_model:
        :param ifp_transformation:
                The transformation is stored in a plain txt file.
                Spaces separate columns and new lines separate rows.
                For example, use np.savetxt(some_path, some_mat) to create the desired file.
        :param ofp_model:
        :param save_point_clouds:
        :param save_meshes:
        :param lazy:
        :return:
        """

        cloud_compare = CloudCompare()
        # cc_open checks presence of file
        cloud_compare.cc_open(ifp_model)
        cloud_compare.cc_apply_trans(ifp_transformation)
        cloud_compare.execute_and_save_result_to_disc(
            ofp_model,
            save_clouds=save_point_clouds,
            save_meshes=save_meshes,
            lazy=lazy)

    @staticmethod
    def cloud_to_mesh_distance(ifp_mesh, ifp_cloud, ofp_cloud, lazy=False):

        cloud_compare = CloudCompare()
        # cc_open checks presence of file
        cloud_compare.cc_open(ifp_mesh)
        cloud_compare.cc_open(ifp_cloud)
        cloud_compare.cc_compute_cloud_to_mesh_distance()
        cloud_compare.execute_and_save_result_to_disc(ofp_cloud,
                                                      save_clouds=True,
                                                      lazy=lazy)
Esempio n. 11
0
    #
    # path_to_environment_output_with_suffix = path_to_environment_output + output_suffix
    # logger.vinfo('path_to_environment_output_with_suffix', path_to_environment_output_with_suffix)
    # perform_post_processing(path_to_environment_output_with_suffix, lazy=True)

    # Option 2

    parent_dp = os.path.dirname(os.path.realpath(__file__))
    example_config_path = os.path.join(parent_dp, 'Config',
                                       'config_example.cfg')
    config_path = os.path.join(parent_dp, 'Config', 'config.cfg')

    if not os.path.isfile(config_path):
        copyfile(example_config_path, config_path)

    post_processing_config = Config(path_to_config_file=config_path)

    dp = post_processing_config.get_option_value('dataset_path', str)
    lazy = post_processing_config.get_option_value('lazy', bool)

    remove_stereo_files = post_processing_config.get_option_value(
        'remove_stereo_files', bool)

    create_object_files = post_processing_config.get_option_value(
        'create_object_files', bool)
    create_background_files = post_processing_config.get_option_value(
        'create_background_files', bool)
    create_ground_files = post_processing_config.get_option_value(
        'create_ground_files', bool)
    create_depth_files = post_processing_config.get_option_value(
        'create_depth_files', bool)
Esempio n. 12
0
 def __init__(self):
     from Utility.Config     import Config
     config_obj              = Config()
     self.__playr1_symbol    = config_obj.get_value('playr1_symbol')
     self.__playr2_symbol    = config_obj.get_value('playr2_symbol')
Esempio n. 13
0
                'car_rig_name: ' + car_rig_name +
                '. Rig has incorrect name. Expected name: <CarRigName>CarRig')
            assert False  # Expected name: <CarRigName>CarRig'

    return car_rig_names


if __name__ == '__main__':

    from CarRigAutomization.Car_Rig_to_Curve import configure_car_rig_for_path_and_ground
    parent_dp = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))

    attach_car_rig_to_curve_config_fp = os.path.join(
        parent_dp, 'configs/attach_car_rig_to_curve.cfg')

    attach_car_rig_to_curve_config = Config(
        path_to_config_file=attach_car_rig_to_curve_config_fp)
    path_object_name = attach_car_rig_to_curve_config.get_option_value(
        'path_object_name', str)
    ground_object_name = attach_car_rig_to_curve_config.get_option_value(
        'ground_object_name', str)

    rigged_vehicle_blend_file_path = attach_car_rig_to_curve_config.get_option_value(
        'rigged_vehicle_blend_file_path', target_type=str)

    high_level_object_import_from_other_blend_file(
        blend_file=rigged_vehicle_blend_file_path,
        folder_name='Group',
        target_name='CarRig')

    # ======== IMPORTANT TO AVOID POLL ERRORS ========
    configure_scene_for_basic_ops()
def execute_blender_script(blender_script_ifp,
                           background_mode=True,
                           path_to_blend_file=None,
                           debug_output=False):
    # ****
    # IF THE SCRIPT IS RUNNING IN FOREGROUND MODE NO PRINT INFORMATION
    # IS FLUSHED TO COMMAND LINE DURING EXECUTION
    # ****

    logger.info('execute_blender_script: ...')
    logger.vinfo('blender_script_ifp', blender_script_ifp)

    parent_dp = os.path.dirname(os.path.realpath(__file__))
    example_config_path = os.path.join(parent_dp, 'Config',
                                       'blender_script_executor_example.cfg')
    config_path = os.path.join(parent_dp, 'Config',
                               'blender_script_executor.cfg')
    if not os.path.isfile(config_path):
        copyfile(example_config_path, config_path)

    blender_script_config = Config(path_to_config_file=config_path)
    path_to_blender_list = blender_script_config.get_option_value(
        'path_to_blender', list)
    path_to_blender = get_first_valid_path(path_to_blender_list)

    if path_to_blender is None:
        logger.info('No valid blender path provided!')
        logger.info('Adjust the value in Config/blender_script_executor.cfg')
        assert False

    options = []

    if path_to_blend_file is not None:
        logger.info('path_to_blend_file: ' + path_to_blend_file)
        options += [path_to_blend_file]

    if background_mode:
        options += ['--background']  # without gui

    # https://docs.blender.org/api/blender_python_api_2_61_release/info_tips_and_tricks.html#show-all-operators
    if debug_output:
        options += ['--debug']

    path_to_blender_scripts_parent_folder = os.path.dirname(
        os.path.realpath(__file__))

    # This calls the script Blender.BlenderUtility.Config_Blender_Environment.py,
    # which will add additional modules to the python path
    path_to_module_loader = os.path.join(path_to_blender_scripts_parent_folder,
                                         'Blender_Library_Configuration.py')

    options += ['--python', path_to_module_loader]

    options += ['--python', blender_script_ifp]

    # options += ['--']  # this tells blender to treat the following arguments as custom arguments
    # options += ['--module_path_1', str('some_path')]

    logger.info('Call scripts in blender ... (' + path_to_blender + ')')
    subprocess.call([path_to_blender] + options)

    logger.info('execute_blender_script: Done')
from Utility.Config import Config
from Utility.Logging_Extension import logger

path_rigging_scripts = os.path.dirname(
    os.path.dirname(os.path.realpath(__file__)))

attach_rig_to_car_model_config_ifp = os.path.join(
    path_rigging_scripts, 'configs/attach_rig_to_car_model.cfg')
attach_rig_to_car_model_example_config_ifp = os.path.join(
    path_rigging_scripts, 'configs/attach_rig_to_car_model_example.cfg')

if not os.path.isfile(attach_rig_to_car_model_config_ifp):
    copyfile(attach_rig_to_car_model_example_config_ifp,
             attach_rig_to_car_model_config_ifp)

attach_rig_to_car_model_config = Config(
    path_to_config_file=attach_rig_to_car_model_config_ifp)

vehicle_blend_ifp = attach_rig_to_car_model_config.get_option_value(
    'vehicle_blend_ifp', target_type=str)
vehicle_config_ifp = attach_rig_to_car_model_config.get_option_value(
    'vehicle_config_ifp', target_type=str)
car_rig_prefix = attach_rig_to_car_model_config.get_option_value(
    'car_rig_prefix', target_type=str)
rig_blend_ifp = attach_rig_to_car_model_config.get_option_value(
    'rig_blend_ifp', target_type=str)

check_axle = attach_rig_to_car_model_config.get_option_value('check_axle',
                                                             target_type=bool)


def log_tire_names(tire_fl_name, tire_fr_name, tire_bl_name, tire_br_name):
Esempio n. 16
0
import os
from shutil import copyfile

from Utility.Config import Config
from BlenderUtility.Blender_Script_Executor import execute_blender_script

path_to_scripts = os.path.dirname(os.path.realpath(__file__))
path_to_render_trajectory = os.path.join(path_to_scripts, 'CarRigAutomization',
                                         'Attach_Car_Rig_To_Curve.py')

attach_car_rig_to_curve_config_ifp = os.path.join(
    path_to_scripts, 'configs/attach_car_rig_to_curve.cfg')
attach_car_rig_to_curve_config_example_ifp = os.path.join(
    path_to_scripts, 'configs/attach_car_rig_to_curve_example.cfg')

if not os.path.isfile(attach_car_rig_to_curve_config_ifp):
    copyfile(attach_car_rig_to_curve_config_example_ifp,
             attach_car_rig_to_curve_config_ifp)

car_rig_config = Config(path_to_config_file=attach_car_rig_to_curve_config_ifp)
environment_blend_ifp = car_rig_config.get_option_value(
    'environment_blend_ifp', str)

execute_blender_script(path_to_render_trajectory,
                       background_mode=False,
                       path_to_blend_file=environment_blend_ifp,
                       debug_output=False)