Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2019-02-02 07:14:51 +0300
committerCampbell Barton <ideasman42@gmail.com>2019-02-02 07:23:55 +0300
commit141c6073ca39f0d59c67ebef89b094395b903a4a (patch)
tree372d9246e92117f7d74ef7688848b28710e906fd /source/creator/creator_args.c
parent99b8eef6a534c2c9846b48736cb9eb007c120ec7 (diff)
WM: Event simulation support for Python
This feature is intended only for testing, to automate simulating user input. - Enabled by '--enable-event-simulate'. - Disables handling all real input events. - Access by calling `Window.event_simulate(..)` - Disabling `bpy.app.use_event_simulate` to allow handling real events (can only disable). Currently only mouse & keyboard events work well, NDOF, IME... etc could be added as needed. See D4286 for example usage.
Diffstat (limited to 'source/creator/creator_args.c')
-rw-r--r--source/creator/creator_args.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/source/creator/creator_args.c b/source/creator/creator_args.c
index 294944f0d8d..4040b09f618 100644
--- a/source/creator/creator_args.c
+++ b/source/creator/creator_args.c
@@ -565,6 +565,7 @@ static int arg_handle_print_help(int UNUSED(argc), const char **UNUSED(argv), vo
BLI_argsPrintArgDoc(ba, "--app-template");
BLI_argsPrintArgDoc(ba, "--factory-startup");
BLI_argsPrintArgDoc(ba, "--enable-static-override");
+ BLI_argsPrintArgDoc(ba, "--enable-event-simulate");
printf("\n");
BLI_argsPrintArgDoc(ba, "--env-system-datafiles");
BLI_argsPrintArgDoc(ba, "--env-system-scripts");
@@ -1016,6 +1017,15 @@ static int arg_handle_enable_static_override(int UNUSED(argc), const char **UNUS
return 0;
}
+static const char arg_handle_enable_event_simulate_doc[] =
+"\n\tEnable event simulation testing feature 'bpy.types.Window.event_simulate'."
+;
+static int arg_handle_enable_event_simulate(int UNUSED(argc), const char **UNUSED(argv), void *UNUSED(data))
+{
+ G.f |= G_FLAG_EVENT_SIMULATE;
+ return 0;
+}
+
static const char arg_handle_env_system_set_doc_datafiles[] =
"\n\tSet the "STRINGIFY_ARG (BLENDER_SYSTEM_DATAFILES)" environment variable.";
static const char arg_handle_env_system_set_doc_scripts[] =
@@ -1950,6 +1960,7 @@ void main_args_setup(bContext *C, bArgs *ba)
BLI_argsAdd(ba, 1, NULL, "--app-template", CB(arg_handle_app_template), NULL);
BLI_argsAdd(ba, 1, NULL, "--factory-startup", CB(arg_handle_factory_startup_set), NULL);
BLI_argsAdd(ba, 1, NULL, "--enable-static-override", CB(arg_handle_enable_static_override), NULL);
+ BLI_argsAdd(ba, 1, NULL, "--enable-event-simulate", CB(arg_handle_enable_event_simulate), NULL);
/* TODO, add user env vars? */
BLI_argsAdd(ba, 1, NULL, "--env-system-datafiles", CB_EX(arg_handle_env_system_set, datafiles), NULL);