imguizmo.pyi 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505
  1. ###############################################################################
  2. # This file is a part of Dear ImGui Bundle, NOT a part of ImGuizmo
  3. # -----------------------------------------------------------------------------
  4. # imguizmo.pyi: auto-generated bindings for ImGuizmo, an Immediate mode 3D gizmo
  5. # for scene editing and other controls based on Dear Imgui
  6. # See https://github.com/CedricGuillemet/ImGuizmo
  7. #
  8. # Most of the code of this file is automatically generated (using https://pthom.github.io/litgen/),
  9. # and is generally very close to the C++ version. Comments, docs are identical.
  10. # Do not manually edit the autogenerated parts (look for "Autogenerated" comments)!
  11. ###############################################################################
  12. # ruff: noqa: F821
  13. from typing import List, Optional, Any, overload
  14. import enum
  15. import numpy as np
  16. from imgui_bundle.imgui import ImU32, ImDrawList, ImVec2Like, Window, ID
  17. ImGuiContext = Any
  18. ImGuiWindow = Window
  19. ImGuiID = ID
  20. # !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! AUTOGENERATED CODE !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
  21. # <litgen_stub> // Autogenerated code below! Do not edit!
  22. #################### <generated_from:ImGuizmoPure.h> ####################
  23. # THIS FILE WAS GENERATED AUTOMATICALLY. DO NOT EDIT.
  24. #////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  25. # ImGuizmoPure/ImGuizmoPure.h //
  26. #//////////////////////////////////////////////////////////////////////////////////////////////////////////////
  27. # Part of ImGui Bundle - MIT License - Copyright (c) 2022-2026 Pascal Thomet - https://github.com/pthom/imgui_bundle
  28. #////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  29. # ImGuizmo.h included by ImGuizmoPure/ImGuizmoPure.h //
  30. #//////////////////////////////////////////////////////////////////////////////////////////////////////////////
  31. # https://github.com/CedricGuillemet/ImGuizmo
  32. # v1.92.5 WIP
  33. #
  34. # The MIT License(MIT)
  35. #
  36. # Copyright(c) 2016-2026 Cedric Guillemet and contributors
  37. #
  38. # Permission is hereby granted, free of charge, to any person obtaining a copy
  39. # of this software and associated documentation files(the "Software"), to deal
  40. # in the Software without restriction, including without limitation the rights
  41. # to use, copy, modify, merge, publish, distribute, sublicense, and / or sell
  42. # copies of the Software, and to permit persons to whom the Software is
  43. # furnished to do so, subject to the following conditions :
  44. #
  45. # The above copyright notice and this permission notice shall be included in all
  46. # copies or substantial portions of the Software.
  47. #
  48. # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  49. # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  50. # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE
  51. # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  52. # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  53. # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  54. # SOFTWARE.
  55. #
  56. # -------------------------------------------------------------------------------------------
  57. # History :
  58. # 2026/05/03 v1.9 release. CMake build system, vcpkg support, many fixes and new features from contributors.
  59. # 2019/11/03 View gizmo
  60. # 2016/09/11 Behind camera culling. Scaling Delta matrix not multiplied by source matrix scales. local/world rotation and translation fixed. Display message is incorrect (X: ... Y:...) in local mode.
  61. # 2016/09/09 Hatched negative axis. Snapping. Documentation update.
  62. # 2016/09/04 Axis switch and translation plan autohiding. Scale transform stability improved
  63. # 2016/09/01 Mogwai changed to Manipulate. Draw debug cube. Fixed inverted scale. Mixing scale and translation/rotation gives bad results.
  64. # 2016/08/31 First version
  65. #
  66. # -------------------------------------------------------------------------------------------
  67. # Future (no order):
  68. #
  69. # - Multi view
  70. # - display rotation/translation/scale infos in local/world space and not only local
  71. # - finish local/world matrix application
  72. # - OPERATION as bitmask
  73. #
  74. # -------------------------------------------------------------------------------------------
  75. # Example
  76. #////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  77. # ImGuizmoPure/ImGuizmoPure.h continued //
  78. #//////////////////////////////////////////////////////////////////////////////////////////////////////////////
  79. # <submodule im_guizmo>
  80. class im_guizmo: # Proxy class that introduces typings for the *submodule* im_guizmo
  81. pass # (This corresponds to a C++ namespace. All methods are static!)
  82. @staticmethod
  83. def set_drawlist(drawlist: Optional[ImDrawList] = None) -> None:
  84. """ call inside your own window and before Manipulate() in order to draw gizmo to that window.
  85. Or pass a specific ImDrawList to draw to (e.g. ImGui::GetForegroundDrawList()).
  86. """
  87. pass
  88. @staticmethod
  89. def begin_frame() -> None:
  90. """ call BeginFrame right after ImGui_XXXX_NewFrame();"""
  91. pass
  92. @staticmethod
  93. def set_im_gui_context(ctx: ImGuiContext) -> None:
  94. """ this is necessary because when imguizmo is compiled into a dll, and imgui into another
  95. globals are not shared between them.
  96. More details at https://stackoverflow.com/questions/19373061/what-happens-to-global-and-static-variables-in-a-shared-library-when-it-is-dynam
  97. expose method to set imgui context
  98. """
  99. pass
  100. @staticmethod
  101. @overload
  102. def is_over() -> bool:
  103. """ return True if mouse cursor is over any gizmo control (axis, plan or screen component)"""
  104. pass
  105. @staticmethod
  106. @overload
  107. def is_over(op: OPERATION) -> bool:
  108. pass
  109. @staticmethod
  110. def is_using() -> bool:
  111. """ return True if mouse IsOver or if the gizmo is in moving state"""
  112. pass
  113. @staticmethod
  114. def is_using_view_manipulate() -> bool:
  115. """ return True if the view gizmo is in moving state"""
  116. pass
  117. @staticmethod
  118. def is_view_manipulate_hovered() -> bool:
  119. """ only check if your mouse is over the view manipulator - no matter whether it's active or not"""
  120. pass
  121. @staticmethod
  122. def is_using_any() -> bool:
  123. """ return True if any gizmo is in moving state"""
  124. pass
  125. @staticmethod
  126. def enable(enable: bool) -> None:
  127. """ enable/disable the gizmo. Stay in the state until next call to Enable.
  128. gizmo is rendered with gray half transparent color when disabled
  129. """
  130. pass
  131. # helper functions for manualy editing translation/rotation/scale with an input float
  132. # translation, rotation and scale float points to 3 floats each
  133. # Angles are in degrees (more suitable for human editing)
  134. # example:
  135. # float matrixTranslation[3], matrixRotation[3], matrixScale[3];
  136. # ImGuizmo::DecomposeMatrixToComponents(gizmoMatrix.m16, matrixTranslation, matrixRotation, matrixScale);
  137. # ImGui::InputFloat3("Tr", matrixTranslation, 3);
  138. # ImGui::InputFloat3("Rt", matrixRotation, 3);
  139. # ImGui::InputFloat3("Sc", matrixScale, 3);
  140. # ImGuizmo::RecomposeMatrixFromComponents(matrixTranslation, matrixRotation, matrixScale, gizmoMatrix.m16);
  141. #
  142. # These functions have some numerical stability issues for now. Use with caution.
  143. @staticmethod
  144. def set_rect(x: float, y: float, width: float, height: float) -> None:
  145. pass
  146. @staticmethod
  147. def set_orthographic(is_orthographic: bool) -> None:
  148. """ default is False"""
  149. pass
  150. # Render a cube with face color corresponding to face normal. Usefull for debug/tests
  151. class OPERATION(enum.IntEnum):
  152. """ call it when you want a gizmo
  153. Needs view and projection matrices.
  154. matrix parameter is the source matrix (where will be gizmo be drawn) and might be transformed by the function. Return deltaMatrix is optional
  155. translation is applied in world space
  156. """
  157. translate_x = enum.auto() # (= (1u << 0))
  158. translate_y = enum.auto() # (= (1u << 1))
  159. translate_z = enum.auto() # (= (1u << 2))
  160. rotate_x = enum.auto() # (= (1u << 3))
  161. rotate_y = enum.auto() # (= (1u << 4))
  162. rotate_z = enum.auto() # (= (1u << 5))
  163. rotate_screen = enum.auto() # (= (1u << 6))
  164. scale_x = enum.auto() # (= (1u << 7))
  165. scale_y = enum.auto() # (= (1u << 8))
  166. scale_z = enum.auto() # (= (1u << 9))
  167. bounds = enum.auto() # (= (1u << 10))
  168. scale_xu = enum.auto() # (= (1u << 11))
  169. scale_yu = enum.auto() # (= (1u << 12))
  170. scale_zu = enum.auto() # (= (1u << 13))
  171. translate = enum.auto() # (= OPERATION.translate_x | OPERATION.translate_y | OPERATION.translate_z)
  172. rotate = enum.auto() # (= OPERATION.rotate_x | OPERATION.rotate_y | OPERATION.rotate_z | OPERATION.rotate_screen)
  173. scale = enum.auto() # (= OPERATION.scale_x | OPERATION.scale_y | OPERATION.scale_z)
  174. scaleu = enum.auto() # (= OPERATION.scale_xu | OPERATION.scale_yu | OPERATION.scale_zu) # universal
  175. universal = enum.auto() # (= OPERATION.translate | OPERATION.rotate | OPERATION.scaleu)
  176. class MODE(enum.IntEnum):
  177. local = enum.auto() # (= 0)
  178. world = enum.auto() # (= 1)
  179. @staticmethod
  180. def set_alternative_window(window: ImGuiWindow) -> None:
  181. pass
  182. # ID stack/scopes
  183. # Read the FAQ (docs/FAQ.md or http://dearimgui.org/faq) for more details about how ID are handled in dear imgui.
  184. # - Those questions are answered and impacted by understanding of the ID stack system:
  185. # - "Q: Why is my widget not reacting when I click on it?"
  186. # - "Q: How can I have widgets with an empty label?"
  187. # - "Q: How can I have multiple widgets with the same label?"
  188. # - Short version: ID are hashes of the entire ID stack. If you are creating widgets in a loop you most likely
  189. # want to push a unique identifier (e.g. object pointer, loop index) to uniquely differentiate them.
  190. # - You can also use the "Label##foobar" syntax within widget label to distinguish them from each others.
  191. # - In this header file we use the "label"/"name" terminology to denote a string that will be displayed + used as an ID,
  192. # whereas "str_id" denote a string that is only used as an ID and not normally displayed.
  193. @staticmethod
  194. @overload
  195. def push_id(str_id: str) -> None:
  196. """ push string into the ID stack (will hash string)."""
  197. pass
  198. @staticmethod
  199. @overload
  200. def push_id(str_id_begin: str, str_id_end: str) -> None:
  201. """ push string into the ID stack (will hash string)."""
  202. pass
  203. @staticmethod
  204. @overload
  205. def push_id(ptr_id: Any) -> None:
  206. """ push pointer into the ID stack (will hash pointer)."""
  207. pass
  208. @staticmethod
  209. @overload
  210. def push_id(int_id: int) -> None:
  211. """ push integer into the ID stack (will hash integer)."""
  212. pass
  213. @staticmethod
  214. def pop_id() -> None:
  215. """ pop from the ID stack."""
  216. pass
  217. @staticmethod
  218. @overload
  219. def get_id(str_id: str) -> ImGuiID:
  220. """ calculate unique ID (hash of whole ID stack + given parameter). e.g. if you want to query into ImGuiStorage yourself"""
  221. pass
  222. @staticmethod
  223. @overload
  224. def get_id(str_id_begin: str, str_id_end: str) -> ImGuiID:
  225. pass
  226. @staticmethod
  227. @overload
  228. def get_id(ptr_id: Any) -> ImGuiID:
  229. pass
  230. # return True if the cursor is over the operation's gizmo
  231. @staticmethod
  232. def set_gizmo_size_clip_space(value: float) -> None:
  233. pass
  234. class MOVETYPE(enum.IntEnum):
  235. """ Handle type used by the translate/rotate/scale gizmos."""
  236. mt_none = enum.auto() # (= 0)
  237. mt_move_x = enum.auto() # (= 1)
  238. mt_move_y = enum.auto() # (= 2)
  239. mt_move_z = enum.auto() # (= 3)
  240. mt_move_yz = enum.auto() # (= 4)
  241. mt_move_zx = enum.auto() # (= 5)
  242. mt_move_xy = enum.auto() # (= 6)
  243. mt_move_screen = enum.auto() # (= 7)
  244. mt_rotate_x = enum.auto() # (= 8)
  245. mt_rotate_y = enum.auto() # (= 9)
  246. mt_rotate_z = enum.auto() # (= 10)
  247. mt_rotate_screen = enum.auto() # (= 11)
  248. mt_scale_x = enum.auto() # (= 12)
  249. mt_scale_y = enum.auto() # (= 13)
  250. mt_scale_z = enum.auto() # (= 14)
  251. mt_scale_xyz = enum.auto() # (= 15)
  252. @staticmethod
  253. def get_active_handle_type() -> MOVETYPE:
  254. """ Returns which handle is actively being dragged, or MT_NONE."""
  255. pass
  256. @staticmethod
  257. def get_hovered_handle_type() -> MOVETYPE:
  258. """ Returns which handle is currently hovered, or MT_NONE."""
  259. pass
  260. # Aliases matching the MOVETYPE enum name.
  261. @staticmethod
  262. def get_active_move_type() -> MOVETYPE:
  263. pass
  264. @staticmethod
  265. def get_hovered_move_type() -> MOVETYPE:
  266. pass
  267. @staticmethod
  268. def allow_axis_flip(value: bool) -> None:
  269. """ Allow axis to flip
  270. When True (default), the guizmo axis flip for better visibility
  271. When False, they always stay along the positive world/local axis
  272. """
  273. pass
  274. @staticmethod
  275. def set_axis_limit(value: float) -> None:
  276. """ Configure the limit where axis are hidden"""
  277. pass
  278. @staticmethod
  279. def set_axis_mask(x: bool, y: bool, z: bool) -> None:
  280. """ Set an axis mask to permanently hide a given axis (True -> hidden, False -> shown)"""
  281. pass
  282. @staticmethod
  283. def set_plane_limit(value: float) -> None:
  284. """ Configure the limit where planes are hiden"""
  285. pass
  286. class COLOR(enum.IntEnum):
  287. direction_x = enum.auto() # (= 0) # directionColor[0]
  288. direction_y = enum.auto() # (= 1) # directionColor[1]
  289. direction_z = enum.auto() # (= 2) # directionColor[2]
  290. plane_x = enum.auto() # (= 3) # planeColor[0]
  291. plane_y = enum.auto() # (= 4) # planeColor[1]
  292. plane_z = enum.auto() # (= 5) # planeColor[2]
  293. selection = enum.auto() # (= 6) # selectionColor
  294. inactive = enum.auto() # (= 7) # inactiveColor
  295. translation_line = enum.auto() # (= 8) # translationLineColor
  296. scale_line = enum.auto() # (= 9)
  297. rotation_using_border = enum.auto() # (= 10)
  298. rotation_using_fill = enum.auto() # (= 11)
  299. hatched_axis_lines = enum.auto() # (= 12)
  300. text = enum.auto() # (= 13)
  301. text_shadow = enum.auto() # (= 14)
  302. count = enum.auto() # (= 15)
  303. class Style:
  304. def __init__(self) -> None:
  305. pass
  306. translation_line_thickness: float # Thickness of lines for translation gizmo
  307. translation_line_arrow_size: float # Size of arrow at the end of lines for translation gizmo
  308. rotation_line_thickness: float # Thickness of lines for rotation gizmo
  309. rotation_outer_line_thickness: float # Thickness of line surrounding the rotation gizmo
  310. scale_line_thickness: float # Thickness of lines for scale gizmo
  311. scale_line_circle_size: float # Size of circle at the end of lines for scale gizmo
  312. hatched_axis_line_thickness: float # Thickness of hatched axis lines
  313. center_circle_size: float # Size of circle at the center of the translate/scale gizmo
  314. @staticmethod
  315. def get_style() -> Style:
  316. pass
  317. class Matrix16:
  318. values: np.ndarray # ndarray[type=float, size=16] default:float()
  319. @overload
  320. def __init__(self) -> None:
  321. pass
  322. @overload
  323. def __init__(self, v: List[float]) -> None:
  324. pass
  325. class Matrix6:
  326. values: np.ndarray # ndarray[type=float, size=6] default:float()
  327. @overload
  328. def __init__(self) -> None:
  329. pass
  330. @overload
  331. def __init__(self, v: List[float]) -> None:
  332. pass
  333. class Matrix3:
  334. values: np.ndarray # ndarray[type=float, size=3] default:float()
  335. @overload
  336. def __init__(self) -> None:
  337. pass
  338. @overload
  339. def __init__(self, v: List[float]) -> None:
  340. pass
  341. class MatrixComponents:
  342. translation: im_guizmo.Matrix3
  343. rotation: im_guizmo.Matrix3
  344. scale: im_guizmo.Matrix3
  345. def __init__(self) -> None:
  346. """Autogenerated default constructor"""
  347. pass
  348. # helper functions for manualy editing translation/rotation/scale with an input float
  349. # translation, rotation and scale float points to 3 floats each
  350. # Angles are in degrees (more suitable for human editing)
  351. # example:
  352. # float matrixTranslation[3], matrixRotation[3], matrixScale[3];
  353. # ImGuizmo::DecomposeMatrixToComponents(gizmoMatrix.m16, matrixTranslation, matrixRotation, matrixScale);
  354. # ImGui::InputFloat3("Tr", matrixTranslation, 3);
  355. # ImGui::InputFloat3("Rt", matrixRotation, 3);
  356. # ImGui::InputFloat3("Sc", matrixScale, 3);
  357. # ImGuizmo::RecomposeMatrixFromComponents(matrixTranslation, matrixRotation, matrixScale, gizmoMatrix.m16);
  358. #
  359. # These functions have some numerical stability issues for now. Use with caution.
  360. @staticmethod
  361. def decompose_matrix_to_components(matrix: Matrix16) -> MatrixComponents:
  362. pass
  363. @staticmethod
  364. def recompose_matrix_from_components(matrix_components: MatrixComponents) -> Matrix16:
  365. pass
  366. # Render a cube with face color corresponding to face normal. Usefull for debug/tests
  367. @staticmethod
  368. def draw_cubes(view: Matrix16, projection: Matrix16, matrices: List[Matrix16]) -> None:
  369. pass
  370. @staticmethod
  371. def draw_grid(
  372. view: Matrix16,
  373. projection: Matrix16,
  374. matrix: Matrix16,
  375. grid_size: float
  376. ) -> None:
  377. pass
  378. @staticmethod
  379. def manipulate(
  380. view: Matrix16,
  381. projection: Matrix16,
  382. operation: OPERATION,
  383. mode: MODE,
  384. object_matrix: Matrix16,
  385. delta_matrix: Optional[Matrix16] = None,
  386. snap: Optional[Matrix3] = None,
  387. local_bounds: Optional[Matrix6] = None,
  388. bounds_snap: Optional[Matrix3] = None
  389. ) -> bool:
  390. """ Manipulate: main API of ImGuizmo
  391. Returns True if the objectMatrix has been modified
  392. Mandatory input parameters:
  393. - view: camera view matrix (array of 16 floats)
  394. - projection: camera projection matrix (array of 16 floats)
  395. - operation: operation to perform (translate, rotate, scale)
  396. - mode: in which space the operation is applied (local or world)
  397. Input / Output parameter:
  398. - object_matrix: matrix of the object to manipulate (array of 16 floats)
  399. (will be modified when using the gizmo)
  400. Optional output parameter:
  401. - delta_matrix: matrix that contains the transformation delta (array of 16 floats)
  402. (useful to retrieve the modification between two frames)
  403. pass a newly created Matrix16, and it will be filled if not None.
  404. Optional input parameters:
  405. - snap: if not None, contains the snap value (array of 3 floats)
  406. (for example, if using TRANSLATE and snap={1,1,1}, the object will be snapped to the next integer position)
  407. - local_bounds: if not None, contains the local bounds of the object (array of 6 floats)
  408. - bounds_snap: if not None, contains the snap value for the bounds (array of 3 floats)
  409. """
  410. pass
  411. @staticmethod
  412. @overload
  413. def view_manipulate(
  414. view: Matrix16,
  415. length: float,
  416. position: ImVec2Like,
  417. size: ImVec2Like,
  418. background_color: ImU32
  419. ) -> None:
  420. """
  421. Please note that this cubeview is patented by Autodesk : https://patents.google.com/patent/US7782319B2/en
  422. It seems to be a defensive patent in the US. I don't think it will bring troubles using it as
  423. other software are using the same mechanics. But just in case, you are now warned!
  424. ViewManipulate may change the view parameter
  425. """
  426. pass
  427. @staticmethod
  428. @overload
  429. def view_manipulate(
  430. view: Matrix16,
  431. projection: Matrix16,
  432. operation: OPERATION,
  433. mode: MODE,
  434. matrix: Matrix16,
  435. length: float,
  436. position: ImVec2Like,
  437. size: ImVec2Like,
  438. background_color: ImU32
  439. ) -> None:
  440. """ use this version if you did not call Manipulate before, and you are just using ViewManipulate.
  441. ViewManipulate may change the view parameter!
  442. """
  443. pass
  444. # </submodule im_guizmo>
  445. #################### </generated_from:ImGuizmoPure.h> ####################
  446. # </litgen_stub> // Autogenerated code end!