Cleanup
[carla.git] / source / frontend / carla-control
blob3039f6de592dbc2b7f6336095b33b271440cc3f4
1 #!/usr/bin/env python3
2 # SPDX-FileCopyrightText: 2011-2024 Filipe Coelho <falktx@falktx.com>
3 # SPDX-License-Identifier: GPL-2.0-or-later
5 # ----------------------------------------------------------------------------------------------------------------------
6 # Imports (Custom Stuff)
8 from carla_host_control import (
9     ENGINE_PROCESS_MODE_BRIDGE,
10     CarlaApplication,
11     CarlaHostOSC,
12     HostWindowOSC,
13     handleInitialCommandLineArguments,
14     initHost,
15     loadHostSettings,
16     setUpSignals,
19 import sys
21 # ----------------------------------------------------------------------------------------------------------------------
22 # Main
24 if __name__ == '__main__':
25     import resources_rc
27     # ------------------------------------------------------------------------------------------------------------------
28     # Read CLI args
30     initName, libPrefix = handleInitialCommandLineArguments(__file__ if "__file__" in dir() else None)
32     for arg in sys.argv:
33         if arg.startswith("osc."):
34             oscAddr = arg
35             break
36     else:
37         oscAddr = None
39     # ------------------------------------------------------------------------------------------------------------------
40     # App initialization
42     app = CarlaApplication("Carla2-Control", libPrefix)
44     # ------------------------------------------------------------------------------------------------------------------
45     # Set-up custom signal handling
47     setUpSignals()
49     # ------------------------------------------------------------------------------------------------------------------
50     # Init host backend
52     host = initHost(initName, libPrefix, True, False, True, CarlaHostOSC)
53     host.processMode       = ENGINE_PROCESS_MODE_BRIDGE
54     host.processModeForced = True
55     loadHostSettings(host)
57     # ------------------------------------------------------------------------------------------------------------------
58     # Create GUI
60     gui = HostWindowOSC(host, oscAddr)
62     # ------------------------------------------------------------------------------------------------------------------
63     # Show GUI
65     gui.show()
67     # ------------------------------------------------------------------------------------------------------------------
68     # App-Loop
70     app.exit_exec()