vibrante-node 2.5.1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (487) hide show
  1. src/core/__init__.py +0 -0
  2. src/core/engine.py +484 -0
  3. src/core/events.py +32 -0
  4. src/core/graph.py +74 -0
  5. src/core/integrity.py +925 -0
  6. src/core/loader.py +56 -0
  7. src/core/manifest.py +910 -0
  8. src/core/models.py +59 -0
  9. src/core/persistence.py +27 -0
  10. src/core/python_to_workflow.py +182 -0
  11. src/core/registry.py +314 -0
  12. src/core/workflow_to_python.py +801 -0
  13. src/main.py +188 -0
  14. src/models/__init__.py +0 -0
  15. src/nodes/__init__.py +0 -0
  16. src/nodes/ai/__init__.py +1 -0
  17. src/nodes/base.py +174 -0
  18. src/nodes/builtins/__init__.py +0 -0
  19. src/nodes/builtins/group_node.py +210 -0
  20. src/nodes/builtins/nodes.py +452 -0
  21. src/nodes/print.py +19 -0
  22. src/nodes/test.py +19 -0
  23. src/ui/__init__.py +0 -0
  24. src/ui/canvas/__init__.py +0 -0
  25. src/ui/canvas/backdrop.py +223 -0
  26. src/ui/canvas/canvas_search_bar.py +222 -0
  27. src/ui/canvas/edge.py +98 -0
  28. src/ui/canvas/mini_map.py +138 -0
  29. src/ui/canvas/node_search_popup.py +270 -0
  30. src/ui/canvas/scene.py +1149 -0
  31. src/ui/canvas/sticky_note.py +123 -0
  32. src/ui/canvas/view.py +285 -0
  33. src/ui/code_editor.py +435 -0
  34. src/ui/export_python_dialog.py +490 -0
  35. src/ui/gemini_api_dialog.py +41 -0
  36. src/ui/gemini_chat.py +370 -0
  37. src/ui/import_python_dialog.py +122 -0
  38. src/ui/library_panel.py +246 -0
  39. src/ui/log_panel.py +315 -0
  40. src/ui/node_builder.py +841 -0
  41. src/ui/node_widget.py +1009 -0
  42. src/ui/port_widget.py +116 -0
  43. src/ui/script_editor.py +53 -0
  44. src/ui/scripting_console.py +270 -0
  45. src/ui/settings_window.py +575 -0
  46. src/ui/window.py +2012 -0
  47. src/utils/color_manager.py +50 -0
  48. src/utils/config_manager.py +71 -0
  49. src/utils/env_manager.py +232 -0
  50. src/utils/highlighter.py +110 -0
  51. src/utils/paths.py +30 -0
  52. src/utils/prism_config.py +300 -0
  53. src/utils/prism_core.py +80 -0
  54. src/utils/qt_compat.py +159 -0
  55. src/utils/runtime.py +80 -0
  56. vibrante_node/CLA.md +96 -0
  57. vibrante_node/COMMERCIAL_LICENSE.md +170 -0
  58. vibrante_node/LICENSE +178 -0
  59. vibrante_node/LICENSES/AGPL-3.0.txt +661 -0
  60. vibrante_node/LICENSES/CC-BY-4.0-SCOPE.md +53 -0
  61. vibrante_node/LICENSES/CC-BY-4.0.txt +396 -0
  62. vibrante_node/LICENSES/GPL-3.0.txt +674 -0
  63. vibrante_node/LICENSES/LGPL-3.0.txt +165 -0
  64. vibrante_node/LICENSES/README.md +65 -0
  65. vibrante_node/THIRD_PARTY_NOTICES.txt +3277 -0
  66. vibrante_node/__init__.py +2 -0
  67. vibrante_node/app.py +60 -0
  68. vibrante_node/docs/AUTOMATION_API.html +785 -0
  69. vibrante_node/docs/DEVELOPER.html +891 -0
  70. vibrante_node/docs/DOCUMENTATION.html +2761 -0
  71. vibrante_node/docs/LICENSE.txt +35 -0
  72. vibrante_node/docs/NODE_BUILDER_API.html +1155 -0
  73. vibrante_node/docs/RELEASE_v1.0.5.html +140 -0
  74. vibrante_node/docs/RELEASE_v1.1.0.html +163 -0
  75. vibrante_node/docs/RELEASE_v1.1.5.html +286 -0
  76. vibrante_node/docs/RELEASE_v1.2.0.html +175 -0
  77. vibrante_node/docs/RELEASE_v1.3.0.html +168 -0
  78. vibrante_node/docs/RELEASE_v1.4.0.html +160 -0
  79. vibrante_node/docs/RELEASE_v1.5.0.html +432 -0
  80. vibrante_node/docs/RELEASE_v1.6.0.html +293 -0
  81. vibrante_node/docs/RELEASE_v1.6.1.html +171 -0
  82. vibrante_node/docs/RELEASE_v1.7.0.html +270 -0
  83. vibrante_node/docs/RELEASE_v1.8.0.html +201 -0
  84. vibrante_node/docs/RELEASE_v1.8.1.html +124 -0
  85. vibrante_node/docs/RELEASE_v1.8.2.html +119 -0
  86. vibrante_node/docs/RELEASE_v1.8.3.html +125 -0
  87. vibrante_node/docs/RELEASE_v1.8.4.html +210 -0
  88. vibrante_node/docs/RELEASE_v1.8.5.html +223 -0
  89. vibrante_node/docs/RELEASE_v2.0.0.html +284 -0
  90. vibrante_node/docs/RELEASE_v2.1.0.html +259 -0
  91. vibrante_node/docs/RELEASE_v2.1.1.html +156 -0
  92. vibrante_node/docs/RELEASE_v2.2.0.html +369 -0
  93. vibrante_node/docs/RELEASE_v2.2.1.html +168 -0
  94. vibrante_node/docs/RELEASE_v2.3.0.html +185 -0
  95. vibrante_node/docs/RELEASE_v2.4.0.html +446 -0
  96. vibrante_node/docs/RELEASE_v2.5.0.html +478 -0
  97. vibrante_node/docs/RELEASE_v2.5.1.html +190 -0
  98. vibrante_node/docs/USER_GUIDE.html +1407 -0
  99. vibrante_node/docs/index.html +103 -0
  100. vibrante_node/docs/portal/01_introduction.html +1177 -0
  101. vibrante_node/docs/portal/02_getting_started.html +1267 -0
  102. vibrante_node/docs/portal/03_user_guide.html +1736 -0
  103. vibrante_node/docs/portal/04_workflow_tutorials.html +1473 -0
  104. vibrante_node/docs/portal/05_node_development.html +1562 -0
  105. vibrante_node/docs/portal/06_backend_architecture.html +1373 -0
  106. vibrante_node/docs/portal/07_frontend_architecture.html +1588 -0
  107. vibrante_node/docs/portal/08_api_reference.html +2336 -0
  108. vibrante_node/docs/portal/09_advanced_topics.html +1664 -0
  109. vibrante_node/docs/portal/10_contribution_guide.html +1263 -0
  110. vibrante_node/docs/portal/11_troubleshooting.html +1108 -0
  111. vibrante_node/docs/portal/12_examples_library.html +1498 -0
  112. vibrante_node/docs/portal/13_general_purpose_automation.html +1472 -0
  113. vibrante_node/docs/portal/14_custom_nodes_api.html +1960 -0
  114. vibrante_node/docs/portal/index.html +605 -0
  115. vibrante_node/docs/portal/integrations_blender.html +605 -0
  116. vibrante_node/docs/portal/integrations_deadline.html +536 -0
  117. vibrante_node/docs/portal/integrations_houdini.html +787 -0
  118. vibrante_node/docs/portal/integrations_maya.html +675 -0
  119. vibrante_node/docs/portal/integrations_prism.html +628 -0
  120. vibrante_node/docs/portal/search.json +1 -0
  121. vibrante_node/docs/validation.json +333 -0
  122. vibrante_node/examples/arnold_lighting/orchestration_notes.md +45 -0
  123. vibrante_node/examples/arnold_lighting/prompt.md +47 -0
  124. vibrante_node/examples/automation/01_linear_chain.py +10 -0
  125. vibrante_node/examples/automation/02_batch_update_prefix.py +8 -0
  126. vibrante_node/examples/automation/03_reset_scene.py +5 -0
  127. vibrante_node/examples/automation/04_batch_execution.py +9 -0
  128. vibrante_node/examples/automation/05_git_backup.py +6 -0
  129. vibrante_node/examples/automation/06_reset_math_nodes.py +12 -0
  130. vibrante_node/examples/automation/07_stress_test_grid.py +8 -0
  131. vibrante_node/examples/automation/08_scene_summary.py +8 -0
  132. vibrante_node/examples/automation/09_toggle_bools.py +8 -0
  133. vibrante_node/examples/automation/10_session_report.py +7 -0
  134. vibrante_node/examples/automation/11_simple_math_node.py +7 -0
  135. vibrante_node/examples/cinematic_camera/orchestration_notes.md +56 -0
  136. vibrante_node/examples/cinematic_camera/prompt.md +50 -0
  137. vibrante_node/examples/cinematic_explosion/orchestration_notes.md +76 -0
  138. vibrante_node/examples/cinematic_explosion/prompt.md +47 -0
  139. vibrante_node/examples/cinematic_explosion/review.md +75 -0
  140. vibrante_node/examples/dust_wave/orchestration_notes.md +43 -0
  141. vibrante_node/examples/dust_wave/prompt.md +40 -0
  142. vibrante_node/examples/nodes/async_delay.py +21 -0
  143. vibrante_node/examples/nodes/connection_logger.py +25 -0
  144. vibrante_node/examples/nodes/data_filter.py +19 -0
  145. vibrante_node/examples/nodes/dict_merge.py +20 -0
  146. vibrante_node/examples/nodes/dict_summary.py +21 -0
  147. vibrante_node/examples/nodes/dropdown_selector.py +29 -0
  148. vibrante_node/examples/nodes/env_reader.py +18 -0
  149. vibrante_node/examples/nodes/list_item_picker.py +85 -0
  150. vibrante_node/examples/nodes/list_stats.py +27 -0
  151. vibrante_node/examples/nodes/logic_threshold.py +23 -0
  152. vibrante_node/examples/nodes/math_square.py +30 -0
  153. vibrante_node/examples/nodes/random_list.py +18 -0
  154. vibrante_node/examples/nodes/reactive_config.py +24 -0
  155. vibrante_node/examples/nodes/safety_reset.py +31 -0
  156. vibrante_node/examples/nodes/string_reverse.py +16 -0
  157. vibrante_node/icons/210429_DeadlineFreeOn10RenderMachines.jpg +0 -0
  158. vibrante_node/icons/README.md +39 -0
  159. vibrante_node/icons/blender_icon.png +0 -0
  160. vibrante_node/icons/braces.png +0 -0
  161. vibrante_node/icons/braces.svg +1 -0
  162. vibrante_node/icons/builder.png +0 -0
  163. vibrante_node/icons/check.png +0 -0
  164. vibrante_node/icons/check.svg +1 -0
  165. vibrante_node/icons/chevron-right.svg +3 -0
  166. vibrante_node/icons/code.png +0 -0
  167. vibrante_node/icons/code.svg +4 -0
  168. vibrante_node/icons/computer-window.png +0 -0
  169. vibrante_node/icons/data.png +0 -0
  170. vibrante_node/icons/data.svg +5 -0
  171. vibrante_node/icons/database-search.png +0 -0
  172. vibrante_node/icons/database-search.svg +5 -0
  173. vibrante_node/icons/database-zap.png +0 -0
  174. vibrante_node/icons/database-zap.svg +5 -0
  175. vibrante_node/icons/database.png +0 -0
  176. vibrante_node/icons/database.svg +5 -0
  177. vibrante_node/icons/dice.png +0 -0
  178. vibrante_node/icons/dice.svg +1 -0
  179. vibrante_node/icons/divide.svg +5 -0
  180. vibrante_node/icons/file-input.svg +6 -0
  181. vibrante_node/icons/file-plus.png +0 -0
  182. vibrante_node/icons/file-plus.svg +6 -0
  183. vibrante_node/icons/file-text.png +0 -0
  184. vibrante_node/icons/file-text.svg +7 -0
  185. vibrante_node/icons/folder-plus.png +0 -0
  186. vibrante_node/icons/folder-plus.svg +5 -0
  187. vibrante_node/icons/folder.png +0 -0
  188. vibrante_node/icons/folder.svg +3 -0
  189. vibrante_node/icons/gear.png +0 -0
  190. vibrante_node/icons/gear.svg +1 -0
  191. vibrante_node/icons/git-branch.svg +6 -0
  192. vibrante_node/icons/hash.png +0 -0
  193. vibrante_node/icons/hash.svg +1 -0
  194. vibrante_node/icons/houdini.svg +4 -0
  195. vibrante_node/icons/houdini_icon.png +0 -0
  196. vibrante_node/icons/http.png +0 -0
  197. vibrante_node/icons/list-check.png +0 -0
  198. vibrante_node/icons/list-check.svg +7 -0
  199. vibrante_node/icons/list-plus.svg +10 -0
  200. vibrante_node/icons/list.png +0 -0
  201. vibrante_node/icons/list.svg +8 -0
  202. vibrante_node/icons/logic.png +0 -0
  203. vibrante_node/icons/logic.svg +7 -0
  204. vibrante_node/icons/math.png +0 -0
  205. vibrante_node/icons/math.svg +4 -0
  206. vibrante_node/icons/maya_icon.jpg +0 -0
  207. vibrante_node/icons/message.png +0 -0
  208. vibrante_node/icons/message.svg +3 -0
  209. vibrante_node/icons/minus.svg +3 -0
  210. vibrante_node/icons/multiply.png +0 -0
  211. vibrante_node/icons/multiply.svg +1 -0
  212. vibrante_node/icons/online-library.png +0 -0
  213. vibrante_node/icons/percentage.svg +5 -0
  214. vibrante_node/icons/plus.png +0 -0
  215. vibrante_node/icons/plus.svg +1 -0
  216. vibrante_node/icons/print.png +0 -0
  217. vibrante_node/icons/print.svg +5 -0
  218. vibrante_node/icons/prism_icon.png +0 -0
  219. vibrante_node/icons/refresh.svg +6 -0
  220. vibrante_node/icons/repeat.svg +6 -0
  221. vibrante_node/icons/scales.png +0 -0
  222. vibrante_node/icons/scales.svg +1 -0
  223. vibrante_node/icons/shuffle.svg +7 -0
  224. vibrante_node/icons/string.png +0 -0
  225. vibrante_node/icons/string.svg +5 -0
  226. vibrante_node/icons/terminal.png +0 -0
  227. vibrante_node/icons/terminal.svg +1 -0
  228. vibrante_node/icons/timer.png +0 -0
  229. vibrante_node/icons/timer.svg +4 -0
  230. vibrante_node/icons/toggle-switch.svg +5 -0
  231. vibrante_node/icons/uppercase.png +0 -0
  232. vibrante_node/icons/uppercase.svg +1 -0
  233. vibrante_node/icons/variable-get.svg +4 -0
  234. vibrante_node/icons/variable-set.svg +6 -0
  235. vibrante_node/icons/variable.png +0 -0
  236. vibrante_node/icons/variable.svg +5 -0
  237. vibrante_node/icons/vibrante-node-icon.png +0 -0
  238. vibrante_node/icons/vibrante-node-logo.png +0 -0
  239. vibrante_node/icons/vibrante-node-main_logo.png +0 -0
  240. vibrante_node/icons/vibrante-node-resize_main_logo.png +0 -0
  241. vibrante_node/logo.png +0 -0
  242. vibrante_node/mcp_cli.py +36 -0
  243. vibrante_node/node_examples/Split_String.json +35 -0
  244. vibrante_node/node_examples/async_delay.json +32 -0
  245. vibrante_node/node_examples/delay_timer.json +29 -0
  246. vibrante_node/node_examples/file_reader.json +29 -0
  247. vibrante_node/node_examples/fruit_selector.json +37 -0
  248. vibrante_node/node_examples/json_parser.json +29 -0
  249. vibrante_node/node_examples/line_counter.json +29 -0
  250. vibrante_node/node_examples/list_append.json +32 -0
  251. vibrante_node/node_examples/list_images_recursive.json +55 -0
  252. vibrante_node/node_examples/logic_and.json +34 -0
  253. vibrante_node/node_examples/logic_compare.json +36 -0
  254. vibrante_node/node_examples/math_abs.json +29 -0
  255. vibrante_node/node_examples/math_add.json +32 -0
  256. vibrante_node/node_examples/reactive_config.json +28 -0
  257. vibrante_node/node_examples/string_uppercase.json +29 -0
  258. vibrante_node/nodes/Dropdown_Selector.json +27 -0
  259. vibrante_node/nodes/add_integers.json +34 -0
  260. vibrante_node/nodes/blender_action_bake_animation.json +23 -0
  261. vibrante_node/nodes/blender_action_custom.json +21 -0
  262. vibrante_node/nodes/blender_action_export_alembic.json +22 -0
  263. vibrante_node/nodes/blender_action_export_fbx.json +23 -0
  264. vibrante_node/nodes/blender_action_export_gltf.json +21 -0
  265. vibrante_node/nodes/blender_action_export_obj.json +19 -0
  266. vibrante_node/nodes/blender_action_export_usd.json +23 -0
  267. vibrante_node/nodes/blender_action_import_alembic.json +18 -0
  268. vibrante_node/nodes/blender_action_import_fbx.json +18 -0
  269. vibrante_node/nodes/blender_action_import_gltf.json +18 -0
  270. vibrante_node/nodes/blender_action_import_obj.json +18 -0
  271. vibrante_node/nodes/blender_action_new_blend.json +18 -0
  272. vibrante_node/nodes/blender_action_open_blend.json +18 -0
  273. vibrante_node/nodes/blender_action_render.json +23 -0
  274. vibrante_node/nodes/blender_action_save_blend.json +18 -0
  275. vibrante_node/nodes/blender_action_scene_info.json +17 -0
  276. vibrante_node/nodes/blender_action_set_frame_range.json +20 -0
  277. vibrante_node/nodes/blender_action_set_render_settings.json +27 -0
  278. vibrante_node/nodes/blender_get_action_result.json +22 -0
  279. vibrante_node/nodes/blender_headless.json +86 -0
  280. vibrante_node/nodes/compare.json +48 -0
  281. vibrante_node/nodes/console_print.json +29 -0
  282. vibrante_node/nodes/create_dictionary.json +18 -0
  283. vibrante_node/nodes/create_folder.json +17 -0
  284. vibrante_node/nodes/create_list.json +18 -0
  285. vibrante_node/nodes/deadline_blender_submit.json +38 -0
  286. vibrante_node/nodes/deadline_houdini_submit.json +38 -0
  287. vibrante_node/nodes/deadline_job_status.json +28 -0
  288. vibrante_node/nodes/deadline_maya_submit.json +40 -0
  289. vibrante_node/nodes/delay_timer.json +26 -0
  290. vibrante_node/nodes/example_random_float.json +35 -0
  291. vibrante_node/nodes/file_append.json +18 -0
  292. vibrante_node/nodes/file_write.json +18 -0
  293. vibrante_node/nodes/for_loop.json +46 -0
  294. vibrante_node/nodes/get_dict_value.json +19 -0
  295. vibrante_node/nodes/get_list_item.json +19 -0
  296. vibrante_node/nodes/houdini_action_bake_animation.json +20 -0
  297. vibrante_node/nodes/houdini_action_custom.json +20 -0
  298. vibrante_node/nodes/houdini_action_export_alembic.json +20 -0
  299. vibrante_node/nodes/houdini_action_export_camera_alembic.json +20 -0
  300. vibrante_node/nodes/houdini_action_export_fbx.json +18 -0
  301. vibrante_node/nodes/houdini_action_import_alembic.json +18 -0
  302. vibrante_node/nodes/houdini_action_import_camera.json +17 -0
  303. vibrante_node/nodes/houdini_action_import_fbx.json +18 -0
  304. vibrante_node/nodes/houdini_action_import_obj.json +18 -0
  305. vibrante_node/nodes/houdini_action_new_hip.json +16 -0
  306. vibrante_node/nodes/houdini_action_open_hip.json +17 -0
  307. vibrante_node/nodes/houdini_action_save_hip.json +17 -0
  308. vibrante_node/nodes/houdini_action_scene_info.json +16 -0
  309. vibrante_node/nodes/houdini_action_set_frame_range.json +18 -0
  310. vibrante_node/nodes/houdini_get_action_result.json +21 -0
  311. vibrante_node/nodes/houdini_headless.json +85 -0
  312. vibrante_node/nodes/houdini_scene_snapshot.json +41 -0
  313. vibrante_node/nodes/http_request.json +76 -0
  314. vibrante_node/nodes/if_condition.json +45 -0
  315. vibrante_node/nodes/list_directory.json +17 -0
  316. vibrante_node/nodes/list_images_recursive.json +41 -0
  317. vibrante_node/nodes/list_item_picker.json +41 -0
  318. vibrante_node/nodes/list_length.json +17 -0
  319. vibrante_node/nodes/logical_gate.json +45 -0
  320. vibrante_node/nodes/loop_body.json +62 -0
  321. vibrante_node/nodes/math_add.json +17 -0
  322. vibrante_node/nodes/math_divide.json +17 -0
  323. vibrante_node/nodes/math_modulo.json +17 -0
  324. vibrante_node/nodes/math_multiply.json +36 -0
  325. vibrante_node/nodes/math_subtract.json +17 -0
  326. vibrante_node/nodes/maya_action_assign_material.json +18 -0
  327. vibrante_node/nodes/maya_action_bake_animation.json +21 -0
  328. vibrante_node/nodes/maya_action_create_render_layer.json +19 -0
  329. vibrante_node/nodes/maya_action_custom.json +20 -0
  330. vibrante_node/nodes/maya_action_export_alembic.json +22 -0
  331. vibrante_node/nodes/maya_action_export_camera_alembic.json +20 -0
  332. vibrante_node/nodes/maya_action_export_fbx.json +18 -0
  333. vibrante_node/nodes/maya_action_import_alembic.json +17 -0
  334. vibrante_node/nodes/maya_action_import_camera.json +17 -0
  335. vibrante_node/nodes/maya_action_import_fbx.json +17 -0
  336. vibrante_node/nodes/maya_action_import_obj.json +17 -0
  337. vibrante_node/nodes/maya_action_list_references.json +16 -0
  338. vibrante_node/nodes/maya_action_new_scene.json +16 -0
  339. vibrante_node/nodes/maya_action_open_scene.json +18 -0
  340. vibrante_node/nodes/maya_action_playblast.json +22 -0
  341. vibrante_node/nodes/maya_action_reference_alembic.json +18 -0
  342. vibrante_node/nodes/maya_action_reference_scene.json +18 -0
  343. vibrante_node/nodes/maya_action_save_scene.json +18 -0
  344. vibrante_node/nodes/maya_action_scene_info.json +16 -0
  345. vibrante_node/nodes/maya_action_set_aovs.json +18 -0
  346. vibrante_node/nodes/maya_action_set_frame_range.json +18 -0
  347. vibrante_node/nodes/maya_action_set_render_settings.json +23 -0
  348. vibrante_node/nodes/maya_get_action_result.json +21 -0
  349. vibrante_node/nodes/maya_headless.json +27 -0
  350. vibrante_node/nodes/mcp_call_tool.json +19 -0
  351. vibrante_node/nodes/mcp_list_tools.json +18 -0
  352. vibrante_node/nodes/mcp_server_init.json +23 -0
  353. vibrante_node/nodes/message_node.json +32 -0
  354. vibrante_node/nodes/prism_add_integration.json +49 -0
  355. vibrante_node/nodes/prism_build_entity.json +45 -0
  356. vibrante_node/nodes/prism_change_project.json +37 -0
  357. vibrante_node/nodes/prism_core_info.json +37 -0
  358. vibrante_node/nodes/prism_core_init.json +46 -0
  359. vibrante_node/nodes/prism_create_category.json +44 -0
  360. vibrante_node/nodes/prism_create_entity.json +60 -0
  361. vibrante_node/nodes/prism_create_playblast.json +56 -0
  362. vibrante_node/nodes/prism_create_product_version.json +64 -0
  363. vibrante_node/nodes/prism_create_project.json +50 -0
  364. vibrante_node/nodes/prism_create_scene_from_preset.json +59 -0
  365. vibrante_node/nodes/prism_eval.json +42 -0
  366. vibrante_node/nodes/prism_get_aovs.json +29 -0
  367. vibrante_node/nodes/prism_get_asset_by_name.json +69 -0
  368. vibrante_node/nodes/prism_get_asset_type_by_name.json +62 -0
  369. vibrante_node/nodes/prism_get_asset_types_by_project.json +55 -0
  370. vibrante_node/nodes/prism_get_assets_by_project.json +41 -0
  371. vibrante_node/nodes/prism_get_assets_by_type.json +69 -0
  372. vibrante_node/nodes/prism_get_config.json +48 -0
  373. vibrante_node/nodes/prism_get_current_scene.json +37 -0
  374. vibrante_node/nodes/prism_get_departments.json +37 -0
  375. vibrante_node/nodes/prism_get_entity_info.json +69 -0
  376. vibrante_node/nodes/prism_get_entity_path.json +69 -0
  377. vibrante_node/nodes/prism_get_export_path.json +26 -0
  378. vibrante_node/nodes/prism_get_latest_product_path.json +34 -0
  379. vibrante_node/nodes/prism_get_media.json +29 -0
  380. vibrante_node/nodes/prism_get_media_versions.json +33 -0
  381. vibrante_node/nodes/prism_get_plugin.json +35 -0
  382. vibrante_node/nodes/prism_get_preset_scenes.json +35 -0
  383. vibrante_node/nodes/prism_get_product_versions.json +33 -0
  384. vibrante_node/nodes/prism_get_products.json +29 -0
  385. vibrante_node/nodes/prism_get_project_by_name.json +55 -0
  386. vibrante_node/nodes/prism_get_project_config_path.json +26 -0
  387. vibrante_node/nodes/prism_get_scene_files.json +45 -0
  388. vibrante_node/nodes/prism_get_scene_path.json +23 -0
  389. vibrante_node/nodes/prism_get_sequence_by_project.json +48 -0
  390. vibrante_node/nodes/prism_get_sequences_by_project.json +41 -0
  391. vibrante_node/nodes/prism_get_shot_by_name.json +62 -0
  392. vibrante_node/nodes/prism_get_shot_by_sequence.json +55 -0
  393. vibrante_node/nodes/prism_get_shot_info.json +69 -0
  394. vibrante_node/nodes/prism_get_shots.json +29 -0
  395. vibrante_node/nodes/prism_get_shots_by_project_sequence.json +48 -0
  396. vibrante_node/nodes/prism_get_shots_by_sequence.json +48 -0
  397. vibrante_node/nodes/prism_get_tasks.json +39 -0
  398. vibrante_node/nodes/prism_import_product.json +37 -0
  399. vibrante_node/nodes/prism_list_plugins.json +25 -0
  400. vibrante_node/nodes/prism_list_projects.json +25 -0
  401. vibrante_node/nodes/prism_login_token.json +33 -0
  402. vibrante_node/nodes/prism_monkey_patch.json +46 -0
  403. vibrante_node/nodes/prism_open_scene.json +33 -0
  404. vibrante_node/nodes/prism_popup.json +40 -0
  405. vibrante_node/nodes/prism_register_callback.json +58 -0
  406. vibrante_node/nodes/prism_save_scene_version.json +90 -0
  407. vibrante_node/nodes/prism_send_cmd.json +54 -0
  408. vibrante_node/nodes/prism_set_config.json +55 -0
  409. vibrante_node/nodes/prism_studio_assign_project.json +43 -0
  410. vibrante_node/nodes/prism_trigger_callback.json +42 -0
  411. vibrante_node/nodes/prism_usd_department_layer_path.json +35 -0
  412. vibrante_node/nodes/prism_usd_entity_path.json +29 -0
  413. vibrante_node/nodes/prism_usd_sublayer_path.json +41 -0
  414. vibrante_node/nodes/prism_usd_update_department_layer.json +33 -0
  415. vibrante_node/nodes/prism_usd_update_sublayer.json +33 -0
  416. vibrante_node/nodes/python_script.json +17 -0
  417. vibrante_node/nodes/scene_intent_extractor.json +25 -0
  418. vibrante_node/nodes/set_dict_value.json +20 -0
  419. vibrante_node/nodes/string_concat.json +47 -0
  420. vibrante_node/nodes/string_length.json +16 -0
  421. vibrante_node/nodes/string_lowercase.json +16 -0
  422. vibrante_node/nodes/string_replace.json +18 -0
  423. vibrante_node/nodes/string_split.json +17 -0
  424. vibrante_node/nodes/string_uppercase.json +16 -0
  425. vibrante_node/nodes/variable_node.json +42 -0
  426. vibrante_node/nodes/while_loop.json +18 -0
  427. vibrante_node/splash.png +0 -0
  428. vibrante_node/vfx_workflows/01_prism_project_overview.json +492 -0
  429. vibrante_node/vfx_workflows/02_maya_asset_publish.json +776 -0
  430. vibrante_node/vfx_workflows/03_multi_shot_alembic_export.json +856 -0
  431. vibrante_node/vfx_workflows/04_deadline_render_pipeline.json +994 -0
  432. vibrante_node/vfx_workflows/05_houdini_fx_pipeline.json +1056 -0
  433. vibrante_node/vfx_workflows/06_blender_multi_format_export.json +1206 -0
  434. vibrante_node/website_examples/database_query.json +69 -0
  435. vibrante_node/website_examples/email_notification.json +104 -0
  436. vibrante_node/website_examples/file_batch_processor.json +62 -0
  437. vibrante_node/website_examples/folder_monitor.json +55 -0
  438. vibrante_node/website_examples/hou_sop_chain.json +69 -0
  439. vibrante_node/website_examples/http_request.json +90 -0
  440. vibrante_node/website_examples/image_resizer.json +90 -0
  441. vibrante_node/website_examples/llm_text_generation.json +90 -0
  442. vibrante_node/website_examples/prism_multi_asset_publisher.json +76 -0
  443. vibrante_node/website_examples/regex_replace.json +69 -0
  444. vibrante_node/workflows/If_condition.json +134 -0
  445. vibrante_node/workflows/Maya_WorkFlow.json +464 -0
  446. vibrante_node/workflows/asset_intelligence_pipeline.json +259 -0
  447. vibrante_node/workflows/concat_string_with_loop.json +262 -0
  448. vibrante_node/workflows/delay_time.json +74 -0
  449. vibrante_node/workflows/example_workflow_maya_prism_demo.json +503 -0
  450. vibrante_node/workflows/example_workflow_prism_demo.json +276 -0
  451. vibrante_node/workflows/example_workflow_prism_demo_02.json +221 -0
  452. vibrante_node/workflows/extract_FPS_from_maya_scene.json +265 -0
  453. vibrante_node/workflows/for_each.json +260 -0
  454. vibrante_node/workflows/get_list_item.json +151 -0
  455. vibrante_node/workflows/hou_mcp_scene_context_demo.json +67 -0
  456. vibrante_node/workflows/list_recursive_images.json +103 -0
  457. vibrante_node/workflows/logic_if_example.json +262 -0
  458. vibrante_node/workflows/logic_if_with_variables.json +210 -0
  459. vibrante_node/workflows/loop_break_example.json +197 -0
  460. vibrante_node/workflows/loop_operation_example.json +382 -0
  461. vibrante_node/workflows/mcp_list_tools_demo.json +90 -0
  462. vibrante_node/workflows/prism_assets_workflow.json +131 -0
  463. vibrante_node/workflows/python_script_node.json +89 -0
  464. vibrante_node/workflows/run_in_sequence.json +158 -0
  465. vibrante_node/workflows/scene_intent_pipeline.json +134 -0
  466. vibrante_node/workflows/scene_planning_pipeline.json +258 -0
  467. vibrante_node/workflows/semantic_scene_intent.json +96 -0
  468. vibrante_node/workflows/setup_maya_scene.json +352 -0
  469. vibrante_node/workflows/tutorial_maya_headless_prism_pipeline.json +593 -0
  470. vibrante_node/workflows/two_way_switch.json +341 -0
  471. vibrante_node/workflows/while_loop_class_example.json +192 -0
  472. vibrante_node/workflows/while_loop_example.json +184 -0
  473. vibrante_node/workflows/while_loop_retry_example.json +276 -0
  474. vibrante_node-2.5.1.dist-info/METADATA +715 -0
  475. vibrante_node-2.5.1.dist-info/RECORD +487 -0
  476. vibrante_node-2.5.1.dist-info/WHEEL +5 -0
  477. vibrante_node-2.5.1.dist-info/entry_points.txt +3 -0
  478. vibrante_node-2.5.1.dist-info/licenses/CLA.md +96 -0
  479. vibrante_node-2.5.1.dist-info/licenses/COMMERCIAL_LICENSE.md +170 -0
  480. vibrante_node-2.5.1.dist-info/licenses/LICENSE +178 -0
  481. vibrante_node-2.5.1.dist-info/licenses/LICENSES/AGPL-3.0.txt +661 -0
  482. vibrante_node-2.5.1.dist-info/licenses/LICENSES/CC-BY-4.0-SCOPE.md +53 -0
  483. vibrante_node-2.5.1.dist-info/licenses/LICENSES/CC-BY-4.0.txt +396 -0
  484. vibrante_node-2.5.1.dist-info/licenses/LICENSES/GPL-3.0.txt +674 -0
  485. vibrante_node-2.5.1.dist-info/licenses/LICENSES/LGPL-3.0.txt +165 -0
  486. vibrante_node-2.5.1.dist-info/licenses/LICENSES/README.md +65 -0
  487. vibrante_node-2.5.1.dist-info/top_level.txt +2 -0
src/ui/node_widget.py ADDED
@@ -0,0 +1,1009 @@
1
+ from src.utils.qt_compat import QtWidgets, QtCore, QtGui, exec_dialog
2
+
3
+ QGraphicsItem = QtWidgets.QGraphicsItem
4
+ QGraphicsRectItem = QtWidgets.QGraphicsRectItem
5
+ QGraphicsTextItem = QtWidgets.QGraphicsTextItem
6
+ QGraphicsProxyWidget = QtWidgets.QGraphicsProxyWidget
7
+ QLineEdit = QtWidgets.QLineEdit
8
+ QSpinBox = QtWidgets.QSpinBox
9
+ QDoubleSpinBox = QtWidgets.QDoubleSpinBox
10
+ QCheckBox = QtWidgets.QCheckBox
11
+ QLabel = QtWidgets.QLabel
12
+ _QComboBox = QtWidgets.QComboBox
13
+ QSlider = QtWidgets.QSlider
14
+ QTextEdit = QtWidgets.QTextEdit
15
+ QWidget = QtWidgets.QWidget
16
+ QHBoxLayout = QtWidgets.QHBoxLayout
17
+ QPushButton = QtWidgets.QPushButton
18
+ QVBoxLayout = QtWidgets.QVBoxLayout
19
+
20
+ Qt = QtCore.Qt
21
+ QRectF = QtCore.QRectF
22
+
23
+ QColor = QtGui.QColor
24
+ QPen = QtGui.QPen
25
+ QBrush = QtGui.QBrush
26
+ QPixmap = QtGui.QPixmap
27
+ QPainterPath = QtGui.QPainterPath
28
+ class _MenuCloser(QtCore.QObject):
29
+ """App-level event filter that closes a popup QMenu on the first mouse
30
+ press outside it. Needed because QGraphicsView consumes press events
31
+ before Qt's built-in popup-dismiss logic can see them."""
32
+
33
+ def __init__(self, menu):
34
+ super().__init__(menu)
35
+ self._menu = menu
36
+ QtWidgets.QApplication.instance().installEventFilter(self)
37
+ menu.aboutToHide.connect(self._remove)
38
+
39
+ def _remove(self):
40
+ QtWidgets.QApplication.instance().removeEventFilter(self)
41
+
42
+ def eventFilter(self, obj, event):
43
+ if event.type() == QtCore.QEvent.MouseButtonPress:
44
+ menu_rect = QtCore.QRect(
45
+ self._menu.mapToGlobal(QtCore.QPoint(0, 0)),
46
+ self._menu.size()
47
+ )
48
+ if not menu_rect.contains(QtGui.QCursor.pos()):
49
+ self._menu.close()
50
+ return False
51
+
52
+
53
+ class _MainThreadDispatcher(QtCore.QObject):
54
+ """Routes callables from background threads onto the Qt main thread.
55
+
56
+ Emitting a pyqtSignal from a non-main thread with a QueuedConnection
57
+ (Qt's default when receiver and sender live in different threads) posts
58
+ the call to the receiver's thread event loop. NodeWidget uses this to
59
+ dispatch _propagate_all_outputs back to the main thread after
60
+ on_parameter_changed completes in the AsyncRuntime background thread.
61
+ """
62
+ _dispatch = QtCore.pyqtSignal(object)
63
+
64
+ def __init__(self):
65
+ super().__init__()
66
+ self._dispatch.connect(self._run, QtCore.Qt.QueuedConnection)
67
+
68
+ def post(self, fn):
69
+ """Schedule fn() on the main thread from any thread."""
70
+ self._dispatch.emit(fn)
71
+
72
+ def _run(self, fn):
73
+ fn()
74
+
75
+
76
+ _main_dispatcher = _MainThreadDispatcher()
77
+
78
+
79
+ class QComboBox(_QComboBox):
80
+ """QComboBox that works correctly inside a QGraphicsProxyWidget.
81
+
82
+ Qt's default popup is rendered within the proxy's composite layer, so
83
+ sibling proxy widgets that were added later (higher paint order) appear
84
+ on top of it. This override replaces the popup with a QMenu, which is
85
+ always a native OS window and therefore renders above all scene items.
86
+ Position is calculated through the full proxy→scene→view→global chain so
87
+ it lands correctly regardless of zoom or pan.
88
+ """
89
+
90
+ def showPopup(self):
91
+ proxy = self._proxy()
92
+ if proxy is None:
93
+ super().showPopup()
94
+ return
95
+
96
+ scene = proxy.scene()
97
+ if not scene or not scene.views():
98
+ super().showPopup()
99
+ return
100
+
101
+ view = scene.views()[0]
102
+
103
+ # Walk from self up to the proxy container to accumulate the
104
+ # combobox's offset within the proxy's item-local coordinate space.
105
+ offset = QtCore.QPoint(0, 0)
106
+ w = self
107
+ container = proxy.widget()
108
+ while w is not None and w is not container:
109
+ offset += w.pos()
110
+ w = w.parentWidget()
111
+
112
+ # Map the combobox bottom-left through scene→viewport→global.
113
+ combo_bl = QtCore.QPointF(offset.x(), offset.y() + self.height())
114
+ global_pt = view.viewport().mapToGlobal(
115
+ view.mapFromScene(proxy.mapToScene(combo_bl))
116
+ )
117
+
118
+ # Build menu. Stored on self to survive past showPopup() returning
119
+ # (popup() is non-blocking so the local ref would be GC'd immediately).
120
+ self._active_menu = QtWidgets.QMenu()
121
+ self._active_menu.setMinimumWidth(self.width())
122
+ self._active_menu.setStyleSheet(
123
+ "QMenu { background-color: #2b2b2b; color: #ddd;"
124
+ " border: 1px solid #555; }"
125
+ "QMenu::item { padding: 4px 16px; }"
126
+ "QMenu::item:selected { background-color: #4a90d9; color: white; }"
127
+ )
128
+ for i in range(self.count()):
129
+ action = self._active_menu.addAction(self.itemText(i))
130
+ action.setData(i)
131
+
132
+ def _on_triggered(action):
133
+ self.setCurrentIndex(action.data())
134
+
135
+ self._active_menu.triggered.connect(_on_triggered)
136
+ # Defer ref-clear so Qt finishes all signal emission before C++ teardown.
137
+ self._active_menu.aboutToHide.connect(
138
+ lambda: QtCore.QTimer.singleShot(0, lambda: setattr(self, '_active_menu', None))
139
+ )
140
+
141
+ # Install app-level closer so one outside click always dismisses the menu
142
+ # even when QGraphicsView would otherwise consume the press event.
143
+ _MenuCloser(self._active_menu)
144
+
145
+ self._active_menu.popup(global_pt)
146
+ self._active_menu.activateWindow()
147
+
148
+ def _proxy(self):
149
+ w = self
150
+ while w is not None:
151
+ p = w.graphicsProxyWidget()
152
+ if p is not None:
153
+ return p
154
+ w = w.parentWidget()
155
+ return None
156
+
157
+
158
+ from src.ui.port_widget import PortWidget
159
+ from src.ui.script_editor import ScriptEditorDialog
160
+ from src.utils.runtime import AsyncRuntime
161
+ from src.utils.paths import resource_path
162
+ from uuid import uuid4
163
+
164
+ class NodeWidget(QGraphicsItem):
165
+ def __init__(self, node_definition, instance_id=None, parent=None):
166
+ super().__init__(parent)
167
+ self.node_definition = node_definition
168
+ self.instance_id = instance_id or uuid4()
169
+ self.width = 220
170
+ self.height = 140 # Initial minimum
171
+
172
+ self.setFlag(QGraphicsItem.ItemIsMovable)
173
+ self.setFlag(QGraphicsItem.ItemIsSelectable)
174
+ self.setFlag(QGraphicsItem.ItemSendsGeometryChanges)
175
+
176
+ self.input_widgets = []
177
+ self.output_widgets = []
178
+ self.input_labels = []
179
+ self.output_labels = []
180
+ self.param_widgets = {} # name -> proxy_widget (QGraphicsProxyWidget)
181
+ self._param_raw_widgets = {} # name -> raw Qt widget (QLineEdit, QComboBox, etc.)
182
+ self.status = "idle" # idle, running, success, failed
183
+ self.is_dark = True
184
+ self.bypassed = False
185
+ self.init_priority = 0
186
+ self._is_propagating = False # Recursion guard
187
+
188
+ # Default rects so hoverMoveEvent is safe before _auto_size runs
189
+ self.bypass_rect = QRectF(0, 0, 0, 0)
190
+ self.init_rect = QRectF(0, 0, 0, 0)
191
+ self._active_tooltip_region = None # tracks which button tooltip is visible
192
+
193
+ self.setAcceptHoverEvents(True)
194
+ self._init_ui()
195
+
196
+ def apply_theme(self, is_dark=True):
197
+ self.is_dark = is_dark
198
+ q_text_color = QColor(Qt.white) if is_dark else QColor(Qt.black)
199
+
200
+ if hasattr(self, 'title_text') and self.title_text:
201
+ self.title_text.setDefaultTextColor(q_text_color)
202
+
203
+ for label in self.input_labels + self.output_labels:
204
+ label.setDefaultTextColor(q_text_color)
205
+
206
+ # Update parameter labels and widgets via stylesheet
207
+ bg_color = "#333" if is_dark else "#eee"
208
+ border_color = "#555" if is_dark else "#ccc"
209
+ label_color = "#aaa" if is_dark else "#555"
210
+ text_color_name = q_text_color.name()
211
+
212
+ for proxy in self.param_widgets.values():
213
+ container = proxy.widget()
214
+ if not container: continue
215
+
216
+ param_label = container.findChild(QLabel)
217
+ if param_label:
218
+ param_label.setStyleSheet(f"color: {label_color}; font-size: 9px; font-weight: bold; background: transparent;")
219
+
220
+ for w in container.findChildren((QLineEdit, QSpinBox, QDoubleSpinBox, QTextEdit)):
221
+ w.setStyleSheet(f"background-color: {bg_color}; color: {text_color_name}; border: 1px solid {border_color};")
222
+
223
+ for w in container.findChildren(QCheckBox):
224
+ w.setStyleSheet(f"color: {text_color_name}; background: transparent;")
225
+
226
+ # QComboBox: only style the box itself — no ::drop-down or ::down-arrow
227
+ # overrides so Fusion keeps drawing the native arrow icon.
228
+ for w in container.findChildren(QComboBox):
229
+ w.setStyleSheet(
230
+ f"QComboBox {{ background-color: {bg_color}; color: {text_color_name};"
231
+ f" border: 1px solid {border_color}; padding: 1px 4px; }}"
232
+ )
233
+
234
+ # QSlider: provide groove + handle so the track and thumb are visible.
235
+ handle_color = "#6699cc" if is_dark else "#4a90d9"
236
+ groove_bg = "#555555" if is_dark else "#cccccc"
237
+ for w in container.findChildren(QSlider):
238
+ w.setStyleSheet(f"""
239
+ QSlider::groove:horizontal {{
240
+ height: 4px; background: {groove_bg};
241
+ border-radius: 2px; margin: 0px;
242
+ }}
243
+ QSlider::sub-page:horizontal {{
244
+ background: {handle_color}; border-radius: 2px;
245
+ }}
246
+ QSlider::handle:horizontal {{
247
+ background: {handle_color}; border: none;
248
+ width: 12px; height: 12px;
249
+ margin: -4px 0; border-radius: 6px;
250
+ }}
251
+ """)
252
+
253
+ # QsciScintilla-based code editors (text_area widgets) use their own theme API
254
+ try:
255
+ from PyQt5.Qsci import QsciScintilla
256
+ for w in container.findChildren(QsciScintilla):
257
+ if hasattr(w, 'apply_theme'):
258
+ w.apply_theme(is_dark)
259
+ except ImportError:
260
+ pass
261
+
262
+ self.update()
263
+
264
+ def _init_ui(self):
265
+ # Header
266
+ self.title_text = QGraphicsTextItem(self.node_definition.name, self)
267
+ self.title_text.setDefaultTextColor(Qt.white)
268
+ self.title_text.setPos(10, 5)
269
+
270
+ self.rebuild_ports()
271
+
272
+ def rebuild_ports(self):
273
+ """Dynamic port reconstruction."""
274
+ # 1. Identify affected edges BEFORE detaching old ports
275
+ affected_edges_out = [] # (edge, port_name)
276
+ affected_edges_in = [] # (edge, port_name)
277
+
278
+ if self.scene():
279
+ for edge in self.scene().edges:
280
+ if edge.from_port in self.output_widgets:
281
+ affected_edges_out.append((edge, edge.from_port.port_definition.name))
282
+ if edge.to_port in self.input_widgets:
283
+ affected_edges_in.append((edge, edge.to_port.port_definition.name))
284
+
285
+ # 2. Clear old port widgets and labels
286
+ for w in self.input_widgets + self.output_widgets + self.input_labels + self.output_labels:
287
+ if self.scene() and w.scene():
288
+ self.scene().removeItem(w)
289
+ else:
290
+ w.setParentItem(None)
291
+
292
+ self.input_widgets.clear()
293
+ self.output_widgets.clear()
294
+ self.input_labels.clear()
295
+ self.output_labels.clear()
296
+
297
+ # 3. Create Ports (Sorted: exec first)
298
+ y_in = 45
299
+ inputs = self.node_definition.inputs
300
+ input_list = inputs if isinstance(inputs, list) else inputs.values()
301
+
302
+ # Sort so 'exec' type comes first
303
+ sorted_inputs = sorted(input_list, key=lambda x: 0 if getattr(x, 'type', 'any').lower() == 'exec' or getattr(x, 'data_type', 'any').lower() == 'exec' else 1)
304
+
305
+ for p_model in sorted_inputs:
306
+ p = PortWidget(p_model, is_input=True, parent=self)
307
+ p.setPos(0, y_in)
308
+ self.input_widgets.append(p)
309
+
310
+ label_text = p_model.name
311
+ if p.port_type == "exec" and label_text in ["in", "exec_in", "trigger"]:
312
+ label_text = ""
313
+
314
+ label = QGraphicsTextItem(label_text, self)
315
+ label.setDefaultTextColor(Qt.white if self.is_dark else Qt.black)
316
+ label.setFont(self._get_port_font())
317
+ label.setPos(12, y_in - 10)
318
+ self.input_labels.append(label)
319
+ y_in += 25
320
+
321
+ y_out = 45
322
+ outputs = self.node_definition.outputs
323
+ output_list = outputs if isinstance(outputs, list) else outputs.values()
324
+
325
+ # Sort so 'exec' type comes first
326
+ sorted_outputs = sorted(output_list, key=lambda x: 0 if getattr(x, 'type', 'any').lower() == 'exec' or getattr(x, 'data_type', 'any').lower() == 'exec' else 1)
327
+
328
+ for p_model in sorted_outputs:
329
+ p = PortWidget(p_model, is_input=False, parent=self)
330
+ p.setPos(self.width, y_out)
331
+ self.output_widgets.append(p)
332
+
333
+ label_text = p_model.name
334
+ if p.port_type == "exec" and label_text in ["out", "exec_out", "then", "exit"]:
335
+ label_text = ""
336
+
337
+ label = QGraphicsTextItem(label_text, self)
338
+ label.setDefaultTextColor(Qt.white if self.is_dark else Qt.black)
339
+ label.setFont(self._get_port_font())
340
+ self.output_labels.append(label)
341
+ y_out += 25
342
+
343
+ # 4. Parameter Widgets (Only create if not already exists)
344
+ for p_model in input_list:
345
+ if hasattr(p_model, 'widget_type') and p_model.widget_type:
346
+ if p_model.name not in self.param_widgets:
347
+ self._create_param_widget(p_model)
348
+
349
+ # If this is a python_script node, add an "Edit Script" button proxy
350
+ try:
351
+ if getattr(self.node_definition, 'node_id', None) in ('python_script', 'maya_action_custom', 'houdini_action_custom') and '_script_btn' not in self.param_widgets:
352
+ proxy = QGraphicsProxyWidget(self)
353
+ container = QWidget()
354
+ lay = QVBoxLayout(container)
355
+ lay.setContentsMargins(0, 0, 0, 0)
356
+ btn = QPushButton('Edit Script')
357
+ btn.clicked.connect(self._open_script_editor)
358
+ lay.addWidget(btn)
359
+ proxy.setWidget(container)
360
+ self.param_widgets['_script_btn'] = proxy
361
+ except Exception:
362
+ pass
363
+
364
+ # 5. Calculate Dynamic Height
365
+ proxies = list(self.param_widgets.values())
366
+ params_total_height = 0
367
+ for p in proxies:
368
+ params_total_height += p.widget().sizeHint().height() + 10
369
+
370
+ ports_max_y = max(y_in, y_out)
371
+ self.height = max(140, ports_max_y + params_total_height + 20)
372
+
373
+ self._auto_size(ports_max_y)
374
+
375
+ # 6. Reconnect Edges to new PortWidgets
376
+ for edge, name in affected_edges_out:
377
+ new_p = next((p for p in self.output_widgets if p.port_definition.name == name), None)
378
+ if new_p:
379
+ edge.from_port = new_p
380
+ edge.update_path()
381
+ else:
382
+ # Port gone? Remove edge
383
+ if self.scene() and edge in self.scene().edges:
384
+ self.scene().removeItem(edge)
385
+ self.scene().edges.remove(edge)
386
+
387
+ for edge, name in affected_edges_in:
388
+ new_p = next((p for p in self.input_widgets if p.port_definition.name == name), None)
389
+ if new_p:
390
+ edge.to_port = new_p
391
+ edge.update_path()
392
+ else:
393
+ if self.scene() and edge in self.scene().edges:
394
+ self.scene().removeItem(edge)
395
+ self.scene().edges.remove(edge)
396
+
397
+ def _auto_size(self, ports_bottom_y):
398
+ """Dynamically scales the node width and centers children."""
399
+ self.prepareGeometryChange()
400
+
401
+ # 1. Width Calculation
402
+ # Reset text width so we measure the natural (unconstrained) text width.
403
+ if hasattr(self, 'title_text') and self.title_text:
404
+ self.title_text.setTextWidth(-1)
405
+
406
+ min_width = 220
407
+ content_width = 0
408
+ if hasattr(self, 'title_text') and self.title_text:
409
+ # Reserve room for both header buttons (I + B = 58px) plus margins.
410
+ # Use 32px as the conservative title-start offset (icon case).
411
+ content_width = max(content_width, self.title_text.boundingRect().width() + 95)
412
+ for proxy in self.param_widgets.values():
413
+ w = proxy.widget()
414
+ if w:
415
+ content_width = max(content_width, w.sizeHint().width() + 100)
416
+ for i in range(max(len(self.input_labels), len(self.output_labels))):
417
+ w_row = 80
418
+ if i < len(self.input_labels): w_row += self.input_labels[i].boundingRect().width()
419
+ if i < len(self.output_labels): w_row += self.output_labels[i].boundingRect().width()
420
+ content_width = max(content_width, w_row + 20)
421
+ self.width = max(min_width, content_width)
422
+
423
+ # Bypass Button Position (Top Right); Init button sits to its left
424
+ self.bypass_rect = QRectF(self.width - 30, 5, 25, 25)
425
+ self.init_rect = QRectF(self.width - 58, 5, 25, 25)
426
+
427
+ # Clamp title text so it never bleeds into the button area.
428
+ # 10 = left margin; 5 = gap before init button.
429
+ if hasattr(self, 'title_text') and self.title_text:
430
+ max_title_w = max(30, int(self.init_rect.x()) - 10 - 5)
431
+ self.title_text.setTextWidth(max_title_w)
432
+ self.title_text.setFlag(QGraphicsItem.ItemClipsToShape, True)
433
+
434
+ # 2. Vertical Centering for params
435
+ body_top = ports_bottom_y + 10
436
+ body_bottom = self.height - 10
437
+ proxies = list(self.param_widgets.values())
438
+ if proxies:
439
+ total_h = sum([p.widget().sizeHint().height() for p in proxies])
440
+ spacing = max(5, (body_bottom - body_top - total_h) / (len(proxies) + 1))
441
+ current_y = body_top + spacing
442
+ for proxy in proxies:
443
+ w = proxy.widget()
444
+ if w:
445
+ w.setFixedWidth(int(self.width - 100))
446
+ proxy.setPos(50, int(current_y))
447
+ current_y += w.sizeHint().height() + spacing
448
+
449
+ # 3. Reposition Outputs
450
+ for i, p in enumerate(self.output_widgets):
451
+ p.setPos(self.width, p.pos().y())
452
+ if i < len(self.output_labels):
453
+ label = self.output_labels[i]
454
+ label.setPos(self.width - label.boundingRect().width() - 12, p.pos().y() - 10)
455
+
456
+ self._refresh_widget_states()
457
+
458
+ def _refresh_widget_states(self):
459
+ """Disables widgets if their input port has a connection."""
460
+ if not self.scene(): return
461
+ for p_name, proxy in self.param_widgets.items():
462
+ port_widget = next((pw for pw in self.input_widgets if pw.port_definition.name == p_name), None)
463
+ if port_widget:
464
+ is_connected = any(e.to_port == port_widget for e in self.scene().edges)
465
+ container = proxy.widget()
466
+ container.setEnabled(not is_connected)
467
+ for child in container.findChildren(QWidget):
468
+ child.setEnabled(not is_connected)
469
+
470
+ def _get_port_font(self):
471
+ QFont = QtGui.QFont
472
+ f = QFont("Arial", 8)
473
+ return f
474
+
475
+ def _create_param_widget(self, p_model):
476
+ proxy = QGraphicsProxyWidget(self)
477
+ container = QWidget()
478
+ layout = QVBoxLayout(container)
479
+ layout.setContentsMargins(0, 0, 0, 0)
480
+ layout.setSpacing(2)
481
+
482
+ param_label = QLabel(p_model.name)
483
+ param_label.setStyleSheet("color: #aaa; font-size: 9px; font-weight: bold; background: transparent;")
484
+ layout.addWidget(param_label)
485
+
486
+ w = None
487
+ if p_model.widget_type == 'text':
488
+ w = QLineEdit()
489
+ val = self.node_definition.parameters.get(p_model.name)
490
+ w.setText(str(val) if val is not None else "")
491
+ w.textChanged.connect(lambda val: self._update_param(p_model.name, val))
492
+ elif p_model.widget_type == 'text_area':
493
+ from src.ui.code_editor import CodeEditor
494
+ w = CodeEditor()
495
+ # HACK: Disable line numbers for small widget
496
+ w.lineNumberArea.hide()
497
+ w.setViewportMargins(0, 0, 0, 0)
498
+ w.setMaximumHeight(80)
499
+ w.setMinimumWidth(150)
500
+
501
+ # Fetch Houdini completions if this is a Houdini node
502
+ if self.node_definition.category == "Houdini":
503
+ from src.utils.hou_bridge import is_available, get_bridge
504
+ if is_available():
505
+ try:
506
+ bridge = get_bridge()
507
+ w.append_completer_list(bridge.get_completions())
508
+ except: pass
509
+
510
+ val = self.node_definition.parameters.get(p_model.name)
511
+ w.setPlainText(str(val) if val is not None else "")
512
+ w.textChanged.connect(lambda: self._update_param(p_model.name, w.toPlainText()))
513
+ elif p_model.widget_type == 'int':
514
+ w = QSpinBox()
515
+ w.setRange(-999999, 999999)
516
+ val = self.node_definition.parameters.get(p_model.name)
517
+ w.setValue(int(val) if val is not None else 0)
518
+ w.valueChanged.connect(lambda val: self._update_param(p_model.name, val))
519
+ elif p_model.widget_type == 'float':
520
+ w = QDoubleSpinBox()
521
+ w.setRange(-999999.0, 999999.0)
522
+ val = self.node_definition.parameters.get(p_model.name)
523
+ w.setValue(float(val) if val is not None else 0.0)
524
+ w.valueChanged.connect(lambda val: self._update_param(p_model.name, val))
525
+ elif p_model.widget_type == 'bool':
526
+ w = QCheckBox()
527
+ val = self.node_definition.parameters.get(p_model.name)
528
+ w.setChecked(bool(val) if val is not None else False)
529
+ w.stateChanged.connect(lambda val: self._update_param(p_model.name, bool(val)))
530
+ elif p_model.widget_type == 'dropdown':
531
+ w = QComboBox()
532
+ if hasattr(p_model, 'options') and p_model.options:
533
+ w.addItems(p_model.options)
534
+ val = self.node_definition.parameters.get(p_model.name)
535
+ if val is not None:
536
+ w.setCurrentText(str(val))
537
+ elif hasattr(p_model, 'default') and p_model.default is not None:
538
+ w.setCurrentText(str(p_model.default))
539
+ # Always sync parameters to what the combobox actually shows — setCurrentText("")
540
+ # on a non-empty list leaves the widget at index 0 but keeps parameters as "",
541
+ # causing execute to receive "" instead of the displayed item.
542
+ self.node_definition.parameters[p_model.name] = w.currentText()
543
+ w.currentTextChanged.connect(lambda val: self._update_param(p_model.name, val))
544
+ elif p_model.widget_type == 'slider':
545
+ w = QSlider(Qt.Horizontal)
546
+ w.setRange(0, 100)
547
+ val = self.node_definition.parameters.get(p_model.name)
548
+ w.setValue(int(val) if val is not None else 0)
549
+ w.valueChanged.connect(lambda val: self._update_param(p_model.name, val))
550
+ elif p_model.widget_type in ('file', 'file_save'):
551
+ w = QWidget()
552
+ l = QHBoxLayout(w)
553
+ l.setContentsMargins(0, 0, 0, 0)
554
+ l.setSpacing(2)
555
+ path_edit = QLineEdit()
556
+ val = self.node_definition.parameters.get(p_model.name)
557
+ path_edit.setText(str(val) if val is not None else "")
558
+ btn = QPushButton("...")
559
+ btn.setFixedWidth(25)
560
+ is_save = p_model.widget_type == 'file_save'
561
+ def select_file(_checked=None, save=is_save):
562
+ QFileDialog = QtWidgets.QFileDialog
563
+ curr = self.scene().views()[0] if self.scene() and self.scene().views() else None
564
+ if save:
565
+ path, _ = QFileDialog.getSaveFileName(curr, "Save File")
566
+ else:
567
+ path, _ = QFileDialog.getOpenFileName(curr, "Select File")
568
+ if path:
569
+ path_edit.setText(path)
570
+ self._update_param(p_model.name, path)
571
+ btn.clicked.connect(select_file)
572
+ path_edit.textChanged.connect(lambda val: self._update_param(p_model.name, val))
573
+ l.addWidget(path_edit)
574
+ l.addWidget(btn)
575
+ # For file widgets the editable part is path_edit, not the outer QWidget wrapper
576
+ self._param_raw_widgets[p_model.name] = path_edit
577
+
578
+ if w is not None:
579
+ w.setStyleSheet("background-color: #333; color: white; border: 1px solid #555;")
580
+ layout.addWidget(w)
581
+ # Store direct reference; file widgets already stored path_edit above
582
+ if p_model.name not in self._param_raw_widgets:
583
+ self._param_raw_widgets[p_model.name] = w
584
+
585
+ container.setStyleSheet("background: transparent;")
586
+ proxy.setWidget(container)
587
+ self.param_widgets[p_model.name] = proxy
588
+
589
+ def set_parameter(self, name, value, propagate=True):
590
+ """Programmatically set a parameter and update its UI widget."""
591
+ if self._is_propagating: return # Guard against cycles
592
+
593
+ # Type Conversion attempt based on port definition
594
+ inputs = self.node_definition.inputs
595
+ input_list = inputs if isinstance(inputs, list) else inputs.values()
596
+ outputs = self.node_definition.outputs
597
+ output_list = outputs if isinstance(outputs, list) else outputs.values()
598
+
599
+ port_def = next((p for p in input_list if p.name == name), None)
600
+ if not port_def:
601
+ port_def = next((p for p in output_list if p.name == name), None)
602
+
603
+ target_value = value
604
+ if port_def and not isinstance(value, list): # never coerce a list — it may be dropdown options
605
+ try:
606
+ data_type = getattr(port_def, 'data_type', getattr(port_def, 'type', 'any')).lower()
607
+ if data_type == 'int': target_value = int(value)
608
+ elif data_type in ['float', 'number']: target_value = float(value)
609
+ elif data_type == 'string': target_value = str(value)
610
+ elif data_type == 'bool':
611
+ if isinstance(value, str): target_value = value.lower() in ['true', '1', 'yes']
612
+ else: target_value = bool(value)
613
+ except (ValueError, TypeError):
614
+ pass
615
+
616
+ if self.node_definition.parameters.get(name) == target_value:
617
+ return # No change
618
+
619
+ self.node_definition.parameters[name] = target_value
620
+
621
+ # 1. Update UI — use direct widget reference (never findChild)
622
+ w = self._param_raw_widgets.get(name)
623
+ if w is not None:
624
+ w.blockSignals(True)
625
+ if isinstance(w, QLineEdit):
626
+ w.setText(str(target_value) if target_value is not None else "")
627
+ elif isinstance(w, (QSpinBox, QDoubleSpinBox, QSlider)):
628
+ if target_value is not None:
629
+ try:
630
+ w.setValue(target_value)
631
+ except TypeError:
632
+ pass
633
+ elif isinstance(w, QCheckBox):
634
+ w.setChecked(bool(target_value))
635
+ elif isinstance(w, QComboBox):
636
+ if isinstance(target_value, list):
637
+ w.clear()
638
+ w.addItems([str(i) for i in target_value])
639
+ if target_value:
640
+ w.setCurrentIndex(0)
641
+ else:
642
+ w.setCurrentText(str(target_value) if target_value is not None else "")
643
+ elif isinstance(w, QTextEdit):
644
+ w.setPlainText(str(target_value) if target_value is not None else "")
645
+ w.blockSignals(False)
646
+
647
+ # 2. Trigger node logic, then push downstream so on_parameter_changed
648
+ # (which may update output ports via set_output) runs before propagation.
649
+ if propagate:
650
+ async def _run_on_change():
651
+ await self.node_definition.on_parameter_changed(name, target_value)
652
+ # Dispatch Qt widget operations to the main thread — accessing
653
+ # scene().edges and calling w.blockSignals/setText from the
654
+ # background AsyncRuntime thread causes a Qt threading crash.
655
+ _main_dispatcher.post(self._propagate_all_outputs)
656
+ AsyncRuntime.run_coroutine(_run_on_change())
657
+ else:
658
+ AsyncRuntime.run_coroutine(self.node_definition.on_parameter_changed(name, target_value))
659
+
660
+ def _update_param(self, name, value):
661
+ """Internal handler for widget value changes."""
662
+ self.node_definition.parameters[name] = value
663
+
664
+ async def _run_on_change():
665
+ await self.node_definition.on_parameter_changed(name, value)
666
+ _main_dispatcher.post(self._propagate_all_outputs)
667
+
668
+ AsyncRuntime.run_coroutine(_run_on_change())
669
+
670
+ def _propagate_all_outputs(self):
671
+ """Pushes all current output port values to connected downstream nodes.
672
+ Must only run on the Qt main thread (always dispatched via QTimer.singleShot).
673
+ """
674
+ if self._is_propagating: return
675
+ if not self.scene(): return
676
+
677
+ self._is_propagating = True
678
+ try:
679
+ for edge in self.scene().edges:
680
+ if edge.from_port.parentItem() == self:
681
+ out_port_name = edge.from_port.port_definition.name
682
+ current_val = self.node_definition.get_parameter(out_port_name)
683
+
684
+ target_node = edge.to_port.parentItem()
685
+ target_port_name = edge.to_port.port_definition.name
686
+
687
+ target_node.set_parameter(target_port_name, current_val, propagate=True)
688
+ finally:
689
+ self._is_propagating = False
690
+
691
+ def update_dropdown_options(self, name: str, options: list):
692
+ """Update the items of a dropdown (QComboBox) widget for the given parameter name."""
693
+ w = self._param_raw_widgets.get(name)
694
+ if not isinstance(w, QComboBox):
695
+ return
696
+ current = w.currentText()
697
+ w.blockSignals(True)
698
+ w.clear()
699
+ w.addItems([str(o) for o in options])
700
+ idx = w.findText(current)
701
+ w.setCurrentIndex(idx if idx >= 0 else 0)
702
+ w.blockSignals(False)
703
+ self.node_definition.parameters[name] = w.currentText()
704
+
705
+ def set_status(self, status: str):
706
+ self.status = status
707
+ self.update()
708
+
709
+ def set_bypassed(self, bypassed: bool):
710
+ if self.bypassed == bypassed:
711
+ return
712
+ self.bypassed = bypassed
713
+ if self.scene():
714
+ self.scene().push_history()
715
+ self.update()
716
+
717
+ def set_init_priority(self, priority: int):
718
+ if self.init_priority == priority:
719
+ return
720
+ self.init_priority = priority
721
+ if self.scene():
722
+ self.scene().push_history()
723
+ self.update()
724
+
725
+ def reload_definition(self, new_definition):
726
+ """Swap this widget's node_definition for a freshly loaded one and
727
+ rebuild the visual ports / parameter widgets in place.
728
+
729
+ Existing edges are preserved when their port names still exist on the
730
+ new definition; edges to removed ports are dropped (rebuild_ports
731
+ already handles this). Saved parameter values are re-applied where
732
+ the port still exists with the same name.
733
+ """
734
+ # Snapshot current parameter values so we can re-apply them after the
735
+ # ports/widgets are rebuilt against the new definition.
736
+ old_params = dict(getattr(self.node_definition, 'parameters', {}) or {})
737
+
738
+ # Swap the definition reference.
739
+ self.node_definition = new_definition
740
+
741
+ # Clear cached parameter widgets — _create_param_widget only creates
742
+ # a widget when the name isn't already in self.param_widgets, so we
743
+ # must drop the old ones for the new definition's widget_types to
744
+ # take effect.
745
+ for name, proxy in list(self.param_widgets.items()):
746
+ try:
747
+ if self.scene() and proxy.scene():
748
+ self.scene().removeItem(proxy)
749
+ else:
750
+ proxy.setParentItem(None)
751
+ except Exception:
752
+ pass
753
+ self.param_widgets.clear()
754
+ self._param_raw_widgets.clear()
755
+
756
+ # Update the title text with the new definition's name.
757
+ try:
758
+ if hasattr(self, 'title_text') and self.title_text:
759
+ self.title_text.setPlainText(new_definition.name)
760
+ except Exception:
761
+ pass
762
+
763
+ # rebuild_ports() handles port reconstruction AND edge preservation
764
+ # for ports that still exist; edges to removed ports are removed.
765
+ self.rebuild_ports()
766
+
767
+ # Re-apply saved parameter values for ports that still exist on the
768
+ # new definition (set_parameter handles missing ports gracefully).
769
+ for p_name, p_val in old_params.items():
770
+ try:
771
+ self.set_parameter(p_name, p_val, propagate=False)
772
+ except Exception:
773
+ pass
774
+
775
+ if self.scene():
776
+ self.scene().push_history()
777
+ self.update()
778
+
779
+ def is_port_connected(self, port_name, is_input):
780
+ """Checks if a port has any active connections in the scene."""
781
+ if not self.scene(): return False
782
+ for edge in self.scene().edges:
783
+ if is_input:
784
+ if edge.to_port and edge.to_port.parentItem() == self and edge.to_port.port_definition.name == port_name:
785
+ return True
786
+ else:
787
+ if edge.from_port and edge.from_port.parentItem() == self and edge.from_port.port_definition.name == port_name:
788
+ return True
789
+ return False
790
+
791
+ def boundingRect(self):
792
+ margin = 8 # port connectors extend 6px past node edges; +2 for pen and safety
793
+ return QRectF(-margin, 0, self.width + margin * 2, self.height)
794
+
795
+ def shape(self):
796
+ path = QPainterPath()
797
+ path.addRoundedRect(QRectF(0, 0, self.width, self.height), 10, 10)
798
+ return path
799
+
800
+ def itemChange(self, change, value):
801
+ if change == QGraphicsItem.ItemPositionHasChanged:
802
+ if self.scene():
803
+ for edge in self.scene().edges:
804
+ if edge.from_port in self.input_widgets or \
805
+ edge.from_port in self.output_widgets or \
806
+ edge.to_port in self.input_widgets or \
807
+ edge.to_port in self.output_widgets:
808
+ edge.update_path()
809
+ return super().itemChange(change, value)
810
+
811
+ def _open_script_editor(self):
812
+ try:
813
+ parent = None
814
+ if self.scene() and self.scene().views():
815
+ parent = self.scene().views()[0]
816
+ current_code = self.node_definition.get_parameter('python_code', '')
817
+ dlg = ScriptEditorDialog(parent=parent, initial_code=current_code)
818
+ if exec_dialog(dlg) == dlg.Accepted:
819
+ code = dlg.get_code()
820
+ if self.scene():
821
+ self.scene().push_history()
822
+ self.set_parameter('python_code', code, propagate=False)
823
+ except Exception:
824
+ pass
825
+
826
+ def paint(self, painter, option, widget):
827
+ if self.bypassed:
828
+ painter.setOpacity(0.4)
829
+ else:
830
+ painter.setOpacity(1.0)
831
+
832
+ from src.utils.color_manager import ColorManager
833
+ base_color = QColor(40, 40, 40) if self.is_dark else QColor(220, 220, 220)
834
+ if self.status == "running": base_color = QColor(100, 100, 0)
835
+ elif self.status == "success": base_color = QColor(0, 80, 0)
836
+ elif self.status == "failed": base_color = QColor(100, 0, 0)
837
+
838
+ # 1. DRAW BODY
839
+ _r = QRectF(0, 0, self.width, self.height)
840
+ painter.setPen(QPen(Qt.black, 1))
841
+ painter.setBrush(QBrush(base_color))
842
+ painter.drawRoundedRect(_r, 10, 10)
843
+
844
+ # 2. DRAW HEADER
845
+ # Use Category Color from ColorManager
846
+ header_color = ColorManager.get_category_color(self.node_definition.category)
847
+
848
+ painter.setBrush(QBrush(header_color))
849
+ path = QPainterPath()
850
+ path.addRoundedRect(_r, 10, 10)
851
+ painter.save()
852
+ painter.setClipPath(path)
853
+ painter.setPen(Qt.NoPen)
854
+ painter.drawRect(0, 0, int(self.width), 35)
855
+
856
+ # Draw text contrast (black or white)
857
+ if header_color.lightness() > 150:
858
+ self.title_text.setDefaultTextColor(Qt.black)
859
+ else:
860
+ self.title_text.setDefaultTextColor(Qt.white)
861
+
862
+ painter.restore()
863
+
864
+ painter.setPen(QPen(QColor(30, 30, 30), 1))
865
+ painter.drawLine(0, 35, int(self.width), 35)
866
+
867
+ # 3. DRAW BYPASS BUTTON (B)
868
+ painter.save()
869
+ if self.bypassed:
870
+ painter.setBrush(QBrush(QColor(255, 165, 0))) # Orange when bypassed
871
+ painter.setPen(QPen(Qt.black, 1))
872
+ else:
873
+ painter.setBrush(QBrush(QColor(60, 60, 60)))
874
+ painter.setPen(QPen(QColor(200, 200, 200), 1))
875
+
876
+ painter.drawRoundedRect(self.bypass_rect, 4, 4)
877
+ painter.setPen(QPen(Qt.white if not self.bypassed else Qt.black))
878
+ painter.setFont(QtGui.QFont("Arial", 10, QtGui.QFont.Bold))
879
+ painter.drawText(self.bypass_rect, Qt.AlignCenter, "B")
880
+ painter.restore()
881
+
882
+ # 4. DRAW INIT BUTTON (I) — teal when active
883
+ painter.save()
884
+ if self.init_priority > 0:
885
+ painter.setBrush(QBrush(QColor(0, 180, 180)))
886
+ painter.setPen(QPen(Qt.black, 1))
887
+ else:
888
+ painter.setBrush(QBrush(QColor(60, 60, 60)))
889
+ painter.setPen(QPen(QColor(200, 200, 200), 1))
890
+ painter.drawRoundedRect(self.init_rect, 4, 4)
891
+ painter.setPen(QPen(Qt.black if self.init_priority > 0 else Qt.white))
892
+ painter.setFont(QtGui.QFont("Arial", 10, QtGui.QFont.Bold))
893
+ painter.drawText(self.init_rect, Qt.AlignCenter, "I")
894
+ painter.restore()
895
+
896
+ icon_path = self.node_definition.icon_path or getattr(type(self.node_definition), 'icon_path', None)
897
+ if icon_path:
898
+ pixmap = QPixmap(resource_path(icon_path))
899
+ if not pixmap.isNull():
900
+ painter.drawPixmap(8, 8, 20, 20, pixmap)
901
+ self.title_text.setPos(32, 5)
902
+ else: self.title_text.setPos(10, 5)
903
+ else: self.title_text.setPos(10, 5)
904
+
905
+ if self.isSelected():
906
+ painter.setPen(QPen(QColor(255, 165, 0), 2))
907
+ painter.setBrush(Qt.NoBrush)
908
+ painter.drawRoundedRect(_r, 10, 10)
909
+
910
+ def _get_custom_tooltip(self):
911
+ """Lazy-create a shared frameless QLabel acting as a custom tooltip.
912
+ Stored on the QApplication so all NodeWidgets share one instance."""
913
+ app = QtWidgets.QApplication.instance()
914
+ tip = getattr(app, '_node_custom_tooltip', None)
915
+ if tip is None:
916
+ tip = QLabel(
917
+ None,
918
+ Qt.ToolTip | Qt.FramelessWindowHint | Qt.WindowStaysOnTopHint
919
+ )
920
+ tip.setAttribute(Qt.WA_ShowWithoutActivating, True)
921
+ tip.setTextFormat(Qt.RichText)
922
+ tip.setWordWrap(False)
923
+ tip.setMargin(8)
924
+ tip.setStyleSheet(
925
+ "QLabel { background-color: #2b2b2b; color: #ddd;"
926
+ " border: 1px solid #555; }"
927
+ )
928
+ app._node_custom_tooltip = tip
929
+ return tip
930
+
931
+ def _show_button_tooltip(self, screen_pos, text):
932
+ tip = self._get_custom_tooltip()
933
+ tip.setText(text)
934
+ tip.adjustSize()
935
+ # Offset slightly so it doesn't sit under the cursor
936
+ tip.move(int(screen_pos.x()) + 16, int(screen_pos.y()) + 18)
937
+ tip.show()
938
+ tip.raise_()
939
+
940
+ def _hide_button_tooltip(self):
941
+ app = QtWidgets.QApplication.instance()
942
+ tip = getattr(app, '_node_custom_tooltip', None)
943
+ if tip is not None:
944
+ tip.hide()
945
+
946
+ _BYPASS_TOOLTIP_HTML = (
947
+ "<b>Bypass Node</b><br><br>"
948
+ "Skips this node's execution but keeps the exec flow connected,<br>"
949
+ "so all downstream nodes still run normally.<br><br>"
950
+ "Useful for temporarily disabling a node without breaking the graph.<br><br>"
951
+ "<i>Click to toggle &nbsp;|&nbsp; Orange = bypassed</i>"
952
+ )
953
+ _INIT_TOOLTIP_HTML = (
954
+ "<b>Init First Node</b><br><br>"
955
+ "Marks this node to run <i>before</i> the rest of the workflow.<br>"
956
+ "Use this for login, authentication, or data-initialization nodes<br>"
957
+ "that must complete before any dependent node can execute.<br><br>"
958
+ "Init nodes run in descending priority order (highest first),<br>"
959
+ "and their full exec chain completes before the main graph starts.<br><br>"
960
+ "<i>Click to toggle &nbsp;|&nbsp; Teal = active</i>"
961
+ )
962
+
963
+ def _update_button_tooltip(self, item_pos, screen_pos):
964
+ if self.bypass_rect.contains(item_pos):
965
+ region = 'bypass'
966
+ elif self.init_rect.contains(item_pos):
967
+ region = 'init'
968
+ else:
969
+ region = None
970
+
971
+ # Always re-show when over a button — covers the case where the
972
+ # tooltip was hidden by the OS and the region tracker still says
973
+ # we're "in" that region.
974
+ if region == 'bypass':
975
+ if self._active_tooltip_region != 'bypass':
976
+ self._active_tooltip_region = 'bypass'
977
+ self._show_button_tooltip(screen_pos, self._BYPASS_TOOLTIP_HTML)
978
+ elif region == 'init':
979
+ if self._active_tooltip_region != 'init':
980
+ self._active_tooltip_region = 'init'
981
+ self._show_button_tooltip(screen_pos, self._INIT_TOOLTIP_HTML)
982
+ else:
983
+ if self._active_tooltip_region is not None:
984
+ self._active_tooltip_region = None
985
+ self._hide_button_tooltip()
986
+
987
+ def hoverEnterEvent(self, event):
988
+ self._update_button_tooltip(event.pos(), event.screenPos())
989
+ super().hoverEnterEvent(event)
990
+
991
+ def hoverMoveEvent(self, event):
992
+ self._update_button_tooltip(event.pos(), event.screenPos())
993
+ super().hoverMoveEvent(event)
994
+
995
+ def hoverLeaveEvent(self, event):
996
+ self._active_tooltip_region = None
997
+ self._hide_button_tooltip()
998
+ super().hoverLeaveEvent(event)
999
+
1000
+ def mousePressEvent(self, event):
1001
+ if self.bypass_rect.contains(event.pos()):
1002
+ self.set_bypassed(not self.bypassed)
1003
+ event.accept()
1004
+ return
1005
+ if self.init_rect.contains(event.pos()):
1006
+ self.set_init_priority(0 if self.init_priority > 0 else 1)
1007
+ event.accept()
1008
+ return
1009
+ super().mousePressEvent(event)