MCPcopy Create free account
hub / github.com/MrNeRF/LichtFeld-Studio / dispatch_modal_event

Function dispatch_modal_event

src/python/python_runtime.cpp:1032–1057  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1030 int get_selection_submode() { return g_selection_submode.load(); }
1031
1032 bool dispatch_modal_event(const ModalEvent& event) {
1033 auto* callbacks = g_operator_callbacks.load();
1034 if (!callbacks || !callbacks->hasModalEventCallback()) {
1035 return false;
1036 }
1037
1038 // Convert python::ModalEvent to core::ModalEvent
1039 lfs::core::ModalEvent core_evt{};
1040 core_evt.type = static_cast<lfs::core::ModalEvent::Type>(event.type);
1041 core_evt.x = event.x;
1042 core_evt.y = event.y;
1043 core_evt.delta_x = event.delta_x;
1044 core_evt.delta_y = event.delta_y;
1045 core_evt.button = event.button;
1046 core_evt.action = event.action;
1047 core_evt.key = event.key;
1048 core_evt.mods = event.mods;
1049 core_evt.scroll_x = event.scroll_x;
1050 core_evt.scroll_y = event.scroll_y;
1051 core_evt.over_gui = event.over_gui;
1052
1053 if (!can_acquire_gil())
1054 return false;
1055 const GilAcquire gil;
1056 return callbacks->dispatchModalEvent(core_evt);
1057 }
1058
1059 void set_viewport_bounds(float x, float y, float w, float h) {
1060 std::lock_guard lock(g_viewport.mutex);

Callers 4

dispatchKeyToModalsFunction · 0.85
dispatchScrollToModalsFunction · 0.85

Calls 3

can_acquire_gilFunction · 0.85
dispatchModalEventMethod · 0.80
loadMethod · 0.45

Tested by

no test coverage detected