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/core/models.py ADDED
@@ -0,0 +1,59 @@
1
+ from typing import List, Dict, Any, Tuple, Optional
2
+ from pydantic import BaseModel, Field
3
+ from uuid import UUID, uuid4
4
+
5
+ class PortModel(BaseModel):
6
+ name: str
7
+ type: str = "any"
8
+ widget_type: Optional[str] = None # 'text', 'int', 'float', 'bool', 'dropdown', 'slider', 'text_area', 'file', 'file_save'
9
+ options: Optional[List[str]] = None # For dropdown
10
+ default: Optional[Any] = None
11
+
12
+ class StickyNoteModel(BaseModel):
13
+ id: UUID = Field(default_factory=uuid4)
14
+ position: Tuple[float, float]
15
+ size: Tuple[float, float] = (200.0, 150.0)
16
+ text: str = "New Note"
17
+ color: str = "#ffffcc"
18
+
19
+ class BackdropModel(BaseModel):
20
+ id: UUID = Field(default_factory=uuid4)
21
+ position: Tuple[float, float]
22
+ size: Tuple[float, float] = (400.0, 300.0)
23
+ title: str = "Network Box"
24
+ color: str = "#444444"
25
+
26
+ class NodeDefinitionJSON(BaseModel):
27
+ node_id: str
28
+ name: str
29
+ description: str = ""
30
+ category: str = "General"
31
+ icon_path: Optional[str] = None
32
+ use_exec: bool = True
33
+ inputs: List[PortModel] = Field(default_factory=list)
34
+ outputs: List[PortModel] = Field(default_factory=list)
35
+ python_code: str
36
+
37
+ class NodeInstanceModel(BaseModel):
38
+ instance_id: UUID = Field(default_factory=uuid4)
39
+ node_id: str # Reference to NodeDefinitionJSON.node_id
40
+ position: Tuple[float, float]
41
+ parameters: Dict[str, Any] = Field(default_factory=dict)
42
+ state: str = "idle"
43
+ bypassed: bool = False
44
+ init_priority: int = 0 # >0 means run before the main graph; higher = earlier
45
+
46
+ class ConnectionModel(BaseModel):
47
+ id: UUID = Field(default_factory=uuid4)
48
+ from_node: UUID
49
+ from_port: str
50
+ to_node: UUID
51
+ to_port: str
52
+ is_exec: bool = False
53
+
54
+ class WorkflowModel(BaseModel):
55
+ nodes: List[NodeInstanceModel] = Field(default_factory=list)
56
+ connections: List[ConnectionModel] = Field(default_factory=list)
57
+ sticky_notes: List[StickyNoteModel] = Field(default_factory=list)
58
+ backdrops: List[BackdropModel] = Field(default_factory=list)
59
+ metadata: Dict[str, Any] = Field(default_factory=dict)
@@ -0,0 +1,27 @@
1
+ import json
2
+ import os
3
+ from typing import Optional
4
+ from src.core.models import WorkflowModel
5
+
6
+ class PersistenceManager:
7
+ @staticmethod
8
+ def save_workflow(model: WorkflowModel, file_path: str) -> bool:
9
+ try:
10
+ with open(file_path, "w") as f:
11
+ f.write(model.model_dump_json(indent=4))
12
+ return True
13
+ except Exception as e:
14
+ print(f"Error saving workflow to {file_path}: {e}")
15
+ return False
16
+
17
+ @staticmethod
18
+ def load_workflow(file_path: str) -> Optional[WorkflowModel]:
19
+ try:
20
+ if not os.path.exists(file_path):
21
+ return None
22
+ with open(file_path, "r") as f:
23
+ data = f.read()
24
+ return WorkflowModel.model_validate_json(data)
25
+ except Exception as e:
26
+ print(f"Error loading workflow from {file_path}: {e}")
27
+ return None
@@ -0,0 +1,182 @@
1
+ """
2
+ Converts Python code into a WorkflowModel using Gemini AI.
3
+
4
+ Sends the Python source along with the full node catalog to Gemini,
5
+ which returns a WorkflowModel JSON that can be loaded into the scene.
6
+ """
7
+
8
+ import json
9
+ import re
10
+ import threading
11
+ from src.utils.qt_compat import QtCore, Signal
12
+ QObject = QtCore.QObject
13
+ from src.utils.config_manager import config
14
+ from src.core.models import WorkflowModel
15
+ from src.core.registry import NodeRegistry
16
+
17
+
18
+ GEMINI_SYSTEM_PROMPT = """
19
+ You are an expert at converting Python scripts into Vibrante-Node visual workflow definitions.
20
+
21
+ Your task: Given a Python script, produce a JSON object matching the WorkflowModel schema that
22
+ recreates the script's logic using the available nodes.
23
+
24
+ ## WorkflowModel JSON Schema:
25
+ {{
26
+ "nodes": [
27
+ {{
28
+ "instance_id": "<uuid4 string>",
29
+ "node_id": "<must match one of the available node_ids below>",
30
+ "position": [x, y],
31
+ "parameters": {{ "<port_name>": <value>, ... }},
32
+ "state": "idle"
33
+ }}
34
+ ],
35
+ "connections": [
36
+ {{
37
+ "id": "<uuid4 string>",
38
+ "from_node": "<instance_id of source node>",
39
+ "from_port": "<output port name>",
40
+ "to_node": "<instance_id of target node>",
41
+ "to_port": "<input port name>",
42
+ "is_exec": <true if both ports are exec type, false for data>
43
+ }}
44
+ ],
45
+ "sticky_notes": [],
46
+ "backdrops": [],
47
+ "metadata": {{}}
48
+ }}
49
+
50
+ ## Available Nodes:
51
+ {node_catalog}
52
+
53
+ ## Rules:
54
+ 1. Every instance_id and connection id must be a valid UUID4 string (e.g. "550e8400-e29b-41d4-a716-446655440000").
55
+ 2. node_id MUST exactly match one from the available nodes listed above.
56
+ 3. For nodes with use_exec=True, create exec connections (is_exec: true) between exec_out of the
57
+ previous node and exec_in of the next to define execution order.
58
+ 4. Data connections (is_exec: false) connect output data ports to input data ports.
59
+ 5. Set parameter values in "parameters" for inputs NOT connected to another node.
60
+ Include exec ports as null in parameters.
61
+ 6. Position nodes left-to-right with ~350px horizontal spacing and sensible vertical layout.
62
+ 7. For loops: use "for_loop" (generates range) connected to "loop_body" via exec and data,
63
+ or use the builtin "For Each" for iterating collections.
64
+ 8. For if/else: use "if_condition". Connect exec_out for true branch, exec_false for false.
65
+ 9. For constants/variables: use "variable_node" with type and value parameters.
66
+ 10. For print: use "console_print" with a "data" input.
67
+ 11. For code that does not map to any node: use "python_script" with the code in "python_code" param.
68
+ 12. Only use nodes from the available list. Do NOT invent node_ids.
69
+ 13. Return ONLY the JSON inside a ```json``` code block. No extra text outside the block.
70
+ """
71
+
72
+
73
+ class PythonToWorkflowConverter(QObject):
74
+ conversion_finished = Signal(object, str) # (WorkflowModel or None, error_message)
75
+ status_update = Signal(str)
76
+
77
+ def __init__(self):
78
+ super().__init__()
79
+
80
+ def convert(self, python_code: str):
81
+ """Start conversion in a background thread."""
82
+ self.status_update.emit("Preparing node catalog...")
83
+ thread = threading.Thread(
84
+ target=self._run_conversion,
85
+ args=(python_code,),
86
+ daemon=True,
87
+ )
88
+ thread.start()
89
+
90
+ def _build_node_catalog(self) -> str:
91
+ catalog_lines = []
92
+ for node_id in NodeRegistry.list_node_ids():
93
+ defn = NodeRegistry.get_definition(node_id)
94
+ if defn is None:
95
+ continue
96
+ inputs_desc = ", ".join(
97
+ f"{p.name}:{p.type}" + (f"={p.default}" if p.default is not None else "")
98
+ for p in defn.inputs if p.type != "exec"
99
+ )
100
+ outputs_desc = ", ".join(
101
+ f"{p.name}:{p.type}"
102
+ for p in defn.outputs if p.type != "exec"
103
+ )
104
+ catalog_lines.append(
105
+ f"- node_id=\"{defn.node_id}\", name=\"{defn.name}\", "
106
+ f"inputs=[{inputs_desc}], outputs=[{outputs_desc}], "
107
+ f"use_exec={defn.use_exec}"
108
+ )
109
+
110
+ # Also list builtin nodes that may not have JSON definitions
111
+ builtins_extra = [
112
+ '- node_id="File Loader", name="File Loader", inputs=[file_path:string], outputs=[file_data:string], use_exec=True',
113
+ '- node_id="Console Sink", name="Console Sink", inputs=[data:any], outputs=[], use_exec=True',
114
+ '- node_id="Sequencer", name="Sequencer", inputs=[step_0:any], outputs=[result:any], use_exec=True',
115
+ '- node_id="Set Variable", name="Set Variable", inputs=[name:string, value:any], outputs=[value_out:any], use_exec=True',
116
+ '- node_id="Get Variable", name="Get Variable", inputs=[name:string], outputs=[value:any], use_exec=False',
117
+ '- node_id="Two Way Switch", name="Two Way Switch", inputs=[condition:bool, input_1:any, input_2:any], outputs=[output:any], use_exec=True',
118
+ '- node_id="For Each", name="For Each", inputs=[collection:any, break_condition:bool, continue_condition:bool], outputs=[current_item:any, current_index:int, indices:list, completed:bool, broken:bool], use_exec=True',
119
+ '- node_id="While Loop", name="While Loop", inputs=[condition:bool, break_condition:bool, continue_condition:bool, max_iterations:int], outputs=[current_index:int, completed:bool, broken:bool], use_exec=True',
120
+ '- node_id="List Append", name="List Append", inputs=[list_name:string, item:any], outputs=[current_list:list], use_exec=True',
121
+ ]
122
+ catalog_lines.extend(builtins_extra)
123
+ return "\n".join(catalog_lines)
124
+
125
+ def _run_conversion(self, python_code: str):
126
+ try:
127
+ # Optional dependency: import lazily so the module is importable
128
+ # without the `google-generativeai` extra (see audit F-09).
129
+ try:
130
+ import google.generativeai as genai
131
+ except ImportError:
132
+ self.conversion_finished.emit(
133
+ None,
134
+ "Gemini support requires the optional 'google-generativeai' "
135
+ "package. Install with: pip install \"vibrante-node[ai]\"",
136
+ )
137
+ return
138
+
139
+ api_key = config.get_gemini_api_key()
140
+ if not api_key:
141
+ self.conversion_finished.emit(None, "Gemini API key not configured.\nGo to Help -> Link to Gemini.")
142
+ return
143
+
144
+ self.status_update.emit("Building node catalog...")
145
+ catalog = self._build_node_catalog()
146
+ system_prompt = GEMINI_SYSTEM_PROMPT.format(node_catalog=catalog)
147
+
148
+ self.status_update.emit("Sending to Gemini AI...")
149
+ genai.configure(api_key=api_key)
150
+ model = genai.GenerativeModel('gemini-2.0-flash')
151
+
152
+ full_prompt = (
153
+ system_prompt
154
+ + "\n\n## Python Code to Convert:\n```python\n"
155
+ + python_code
156
+ + "\n```"
157
+ )
158
+ response = model.generate_content(full_prompt)
159
+ text = response.text
160
+
161
+ self.status_update.emit("Parsing Gemini response...")
162
+
163
+ # Extract JSON from response
164
+ json_match = re.search(r"```json\s*(.*?)\s*```", text, re.DOTALL)
165
+ if not json_match:
166
+ self.conversion_finished.emit(
167
+ None,
168
+ f"Gemini did not return valid JSON.\n\nResponse:\n{text[:500]}"
169
+ )
170
+ return
171
+
172
+ json_str = json_match.group(1)
173
+ data = json.loads(json_str)
174
+ workflow = WorkflowModel.model_validate(data)
175
+
176
+ self.status_update.emit("Conversion complete!")
177
+ self.conversion_finished.emit(workflow, "")
178
+
179
+ except json.JSONDecodeError as e:
180
+ self.conversion_finished.emit(None, f"Failed to parse JSON from Gemini response:\n{e}")
181
+ except Exception as e:
182
+ self.conversion_finished.emit(None, f"Conversion failed:\n{e}")
src/core/registry.py ADDED
@@ -0,0 +1,314 @@
1
+ import os
2
+ import json
3
+ from typing import Dict, List, Type, Optional
4
+ from pydantic import ValidationError
5
+ from src.core.models import NodeDefinitionJSON, PortModel
6
+ from src.nodes.base import BaseNode
7
+
8
+ class NodeRegistry:
9
+ _definitions: Dict[str, NodeDefinitionJSON] = {}
10
+ _classes: Dict[str, Type[BaseNode]] = {}
11
+ _source_paths: Dict[str, str] = {} # node_id -> json file path (for reload-from-disk)
12
+ last_error: Optional[str] = None
13
+
14
+ @classmethod
15
+ def _prepare_definition(cls, definition: NodeDefinitionJSON) -> NodeDefinitionJSON:
16
+ """
17
+ Normalize selected node families before class generation.
18
+ Prism nodes can auto-resolve the active PrismCore from shared memory,
19
+ so users don't have to wire the `core` output through every node.
20
+ """
21
+ if not definition.python_code:
22
+ return definition
23
+
24
+ if definition.node_id.startswith("prism_") and definition.node_id != "prism_core_init":
25
+ code = definition.python_code
26
+ if "resolve_prism_core" not in code:
27
+ code = "from src.utils.prism_core import resolve_prism_core\n" + code
28
+ code = code.replace("core = inputs.get('core')", "core = resolve_prism_core(inputs)")
29
+ code = code.replace('core = inputs.get("core")', "core = resolve_prism_core(inputs)")
30
+ definition.python_code = code
31
+
32
+ return definition
33
+
34
+ @classmethod
35
+ def load_all(cls, directory: str) -> None:
36
+ """
37
+ Scans directory and subdirectories for .json files and registers them.
38
+ """
39
+ # First register builtins
40
+ cls.register_builtins()
41
+
42
+ if not os.path.exists(directory):
43
+ os.makedirs(directory)
44
+ return
45
+
46
+ cls._load_directory(directory)
47
+
48
+ @classmethod
49
+ def load_all_with_extras(cls, default_directory: str) -> None:
50
+ """
51
+ Load nodes from the default directory plus any directories
52
+ specified in the v_nodes_dir environment variable.
53
+ """
54
+ cls.load_all(default_directory)
55
+
56
+ extra_dirs = os.environ.get('v_nodes_dir', '')
57
+ if extra_dirs:
58
+ for extra_dir in extra_dirs.split(os.pathsep):
59
+ extra_dir = extra_dir.strip()
60
+ if extra_dir and os.path.isdir(extra_dir):
61
+ print(f"Loading extra nodes from: {extra_dir}")
62
+ cls._load_directory(extra_dir)
63
+
64
+ @classmethod
65
+ def _load_directory(cls, directory: str):
66
+ """Walk a single directory for .json node files and load them."""
67
+ for root, _, filenames in os.walk(directory):
68
+ for filename in filenames:
69
+ if filename.endswith(".json"):
70
+ path = os.path.join(root, filename)
71
+ cls.load_node(path)
72
+
73
+ @classmethod
74
+ def register_builtins(cls) -> None:
75
+ from src.nodes.builtins.nodes import (
76
+ FileLoaderNode, DataProcessorNode, ConsoleSinkNode,
77
+ SequenceNode, SetVariableNode, GetVariableNode,
78
+ TwoWaySwitchNode, ForEachNode, ListAppendNode, WhileLoopNode
79
+ )
80
+ cls._register_builtin_class(FileLoaderNode)
81
+ cls._register_builtin_class(DataProcessorNode)
82
+ cls._register_builtin_class(ConsoleSinkNode)
83
+ cls._register_builtin_class(SequenceNode)
84
+ cls._register_builtin_class(SetVariableNode)
85
+ cls._register_builtin_class(GetVariableNode)
86
+ cls._register_builtin_class(TwoWaySwitchNode)
87
+ cls._register_builtin_class(ForEachNode)
88
+ cls._register_builtin_class(WhileLoopNode)
89
+ cls._register_builtin_class(ListAppendNode)
90
+
91
+ # Group nodes — registered in _classes only so they stay hidden from the
92
+ # node search popup but remain executable and loadable from saved workflows.
93
+ from src.nodes.builtins.group_node import GroupInNode, GroupOutNode, GroupNode
94
+ for _cls in (GroupInNode, GroupOutNode, GroupNode):
95
+ _cls.node_id = _cls.name
96
+ cls._classes[_cls.name] = _cls
97
+
98
+ @classmethod
99
+ def _register_builtin_class(cls, node_class: Type[BaseNode]):
100
+ # Create a definition for builtins
101
+ node_class.node_id = node_class.name # Set node_id
102
+ instance = node_class()
103
+
104
+ inputs = []
105
+ for p in instance.inputs.values():
106
+ default = p.default
107
+ if default is None:
108
+ if p.data_type == "string": default = ""
109
+ elif p.data_type == "list": default = []
110
+ elif p.data_type == "bool": default = False
111
+ elif p.data_type in ["int", "float", "number"]: default = 0
112
+ inputs.append(PortModel(name=p.name, type=p.data_type, widget_type=p.widget_type, options=p.options, default=default))
113
+
114
+ definition = NodeDefinitionJSON(
115
+ node_id=node_class.name,
116
+ name=node_class.name,
117
+ description=node_class.description,
118
+ category=node_class.category,
119
+ icon_path=node_class.icon_path,
120
+ inputs=inputs,
121
+ outputs=[PortModel(name=p.name, type=p.data_type) for p in instance.outputs.values()],
122
+ python_code="" # Not used for builtins
123
+ )
124
+
125
+ # Normalize and store
126
+ cls.register_definition(definition)
127
+ cls._classes[definition.node_id] = node_class
128
+
129
+ @classmethod
130
+ def load_node(cls, file_path: str) -> bool:
131
+ cls.last_error = None
132
+ try:
133
+ with open(file_path, "r") as f:
134
+ data = json.load(f)
135
+ definition = NodeDefinitionJSON.model_validate(data)
136
+ ok = cls.register_definition(definition)
137
+ if ok:
138
+ cls._source_paths[definition.node_id] = file_path
139
+ return ok
140
+ except (json.JSONDecodeError, ValidationError, Exception) as e:
141
+ cls.last_error = f"Error loading node from {file_path}: {e}"
142
+ print(cls.last_error)
143
+ return False
144
+
145
+ @classmethod
146
+ def get_source_path(cls, node_id: str) -> Optional[str]:
147
+ """Return the on-disk JSON path the node was loaded from (None for builtins)."""
148
+ return cls._source_paths.get(node_id)
149
+
150
+ @classmethod
151
+ def reload_node_definition(cls, node_id: str) -> bool:
152
+ """Re-read a node's JSON from disk and re-register it.
153
+
154
+ Returns True on success. After this, callers should refresh any live
155
+ NodeWidget instances bound to this node_id so the new ports/code are
156
+ reflected in the scene.
157
+ """
158
+ path = cls._source_paths.get(node_id)
159
+ if not path:
160
+ cls.last_error = f"Node '{node_id}' has no on-disk source (builtin or never loaded)."
161
+ return False
162
+ return cls.load_node(path)
163
+
164
+ @classmethod
165
+ def register_definition(cls, definition: NodeDefinitionJSON) -> bool:
166
+ definition = cls._prepare_definition(definition)
167
+
168
+ # 1. Normalize pins: Ensure at least 'exec_in' and 'exec_out' exist if use_exec is True
169
+ # But allow other 'exec' type pins as well.
170
+ if definition.use_exec:
171
+ # Inputs
172
+ has_exec_in = any(p.name == "exec_in" for p in definition.inputs)
173
+ if not has_exec_in:
174
+ definition.inputs.insert(0, PortModel(name="exec_in", type="exec"))
175
+
176
+ # Outputs
177
+ has_exec_out = any(p.name == "exec_out" for p in definition.outputs)
178
+ if not has_exec_out:
179
+ definition.outputs.insert(0, PortModel(name="exec_out", type="exec"))
180
+
181
+ cls._definitions[definition.node_id] = definition
182
+ if not definition.python_code:
183
+ return True # Builtin already registered
184
+
185
+ try:
186
+ namespace = {}
187
+ exec(definition.python_code, namespace)
188
+
189
+ node_class = None
190
+ if 'register_node' in namespace:
191
+ node_class = namespace['register_node']()
192
+ elif 'execute' in namespace:
193
+ # Simplified format: just execute function
194
+ # Create a closure to capture namespace
195
+ local_namespace = namespace.copy()
196
+
197
+ class DynamicNode(BaseNode):
198
+ def __init__(self):
199
+ super().__init__(use_exec=definition.use_exec)
200
+ # Set metadata on instance
201
+ self.name = definition.name
202
+ self.node_id = definition.node_id
203
+ self.category = definition.category
204
+ self.description = definition.description
205
+ self.icon_path = definition.icon_path
206
+
207
+ for inp in definition.inputs:
208
+ # Skip if already added by super().__init__() via auto-normalize
209
+ if inp.name in self.inputs: continue
210
+ self.add_input(inp.name, inp.type, inp.widget_type, inp.options, inp.default)
211
+ for out in definition.outputs:
212
+ # Skip if already added by super().__init__()
213
+ if out.name in self.outputs: continue
214
+ self.add_output(out.name, out.type)
215
+
216
+ async def execute(self, inputs):
217
+ return await local_namespace['execute'](self, inputs)
218
+
219
+ async def on_parameter_changed(self, name, value):
220
+ if 'on_parameter_changed' in local_namespace:
221
+ await local_namespace['on_parameter_changed'](self, name, value)
222
+
223
+ def on_plug_sync(self, port_name, is_input, other_node, other_port_name):
224
+ if 'on_plug_sync' in local_namespace:
225
+ local_namespace['on_plug_sync'](self, port_name, is_input, other_node, other_port_name)
226
+
227
+ # Move helper functions to class level
228
+ for key, func in local_namespace.items():
229
+ if key.startswith('_') and callable(func):
230
+ setattr(DynamicNode, key, func)
231
+
232
+ # Assign a name to the dynamic class for better debugging
233
+ class_name = "".join(x for x in definition.name.title() if not x.isspace())
234
+ if not class_name.endswith("Node"): class_name += "Node"
235
+ DynamicNode.__name__ = class_name
236
+ node_class = DynamicNode
237
+
238
+ if node_class and issubclass(node_class, BaseNode):
239
+ # Set class attributes
240
+ node_class.name = definition.name
241
+ node_class.node_id = definition.node_id
242
+ node_class.category = definition.category
243
+ node_class.description = definition.description
244
+ node_class.icon_path = definition.icon_path
245
+
246
+ cls._classes[definition.node_id] = node_class
247
+ return True
248
+
249
+ cls.last_error = f"Definition '{definition.node_id}' does not have 'register_node' or 'execute' function."
250
+ return False
251
+ except Exception as e:
252
+ cls.last_error = f"Error generating class for {definition.node_id}: {e}"
253
+ print(cls.last_error)
254
+ return False
255
+
256
+ @classmethod
257
+ def get_definition(cls, node_id: str) -> Optional[NodeDefinitionJSON]:
258
+ return cls._definitions.get(node_id)
259
+
260
+ @classmethod
261
+ def get_class(cls, node_id: str) -> Optional[Type[BaseNode]]:
262
+ return cls._classes.get(node_id)
263
+
264
+ @classmethod
265
+ def list_node_ids(cls) -> List[str]:
266
+ return list(cls._definitions.keys())
267
+
268
+ # ------------------------------------------------------------------
269
+ # Backward-compatible class-registry API
270
+ # (the class-registry surface formerly on ``src.nodes.base.NodeRegistry``)
271
+ #
272
+ # Registration and UI visibility are intentionally decoupled: ``register``
273
+ # only populates ``_classes`` (like the group-node registration in
274
+ # ``register_builtins``), so class-only nodes stay executable and loadable
275
+ # from saved workflows while remaining hidden from node discovery (the node
276
+ # search popup and library panel enumerate ``list_node_ids``/_definitions).
277
+ # ------------------------------------------------------------------
278
+ @classmethod
279
+ def register(cls, node_class: Type[BaseNode]) -> None:
280
+ """Register a node *class* directly (class-registry compatibility API).
281
+
282
+ The class is stored under ``node_class.name`` and its ``node_id`` is set
283
+ to the same value so the engine can resolve saved workflows by node id.
284
+ No ``NodeDefinitionJSON`` is created, so the node is **not** exposed to
285
+ the node search popup or the library panel.
286
+ """
287
+ node_class.node_id = node_class.name
288
+ cls._classes[node_class.name] = node_class
289
+
290
+ @classmethod
291
+ def get_node_class(cls, name: str) -> Optional[Type[BaseNode]]:
292
+ """Legacy alias for :meth:`get_class` (keyed by class name)."""
293
+ return cls._classes.get(name)
294
+
295
+ @classmethod
296
+ def list_nodes(cls) -> List[str]:
297
+ """Legacy listing of every registered *class* (includes hidden nodes).
298
+
299
+ Returns ``_classes`` keys — a superset of :meth:`list_node_ids` that also
300
+ contains hidden registrations (group nodes, script-loaded classes). Use
301
+ :meth:`list_node_ids` for the UI-visible definition list.
302
+ """
303
+ return list(cls._classes.keys())
304
+
305
+ @classmethod
306
+ def delete_node(cls, node_id: str, directory: str) -> None:
307
+ if node_id in cls._definitions:
308
+ del cls._definitions[node_id]
309
+ if node_id in cls._classes:
310
+ del cls._classes[node_id]
311
+
312
+ file_path = os.path.join(directory, f"{node_id}.json")
313
+ if os.path.exists(file_path):
314
+ os.remove(file_path)