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
@@ -0,0 +1,801 @@
1
+ """
2
+ Converts a WorkflowModel into a standalone Python script.
3
+
4
+ The generated script replicates the workflow logic using plain Python
5
+ and can run independently without Vibrante-Node.
6
+ """
7
+
8
+ from typing import Dict, List, Set, Tuple, Any, Optional
9
+ from uuid import UUID
10
+ from collections import defaultdict
11
+ from src.core.models import WorkflowModel, NodeInstanceModel, ConnectionModel
12
+ from src.core.graph import GraphManager
13
+ from src.core.registry import NodeRegistry
14
+
15
+
16
+ class WorkflowToPythonConverter:
17
+ def __init__(self, workflow: WorkflowModel):
18
+ self.workflow = workflow
19
+ self.nodes: Dict[UUID, NodeInstanceModel] = {
20
+ n.instance_id: n for n in workflow.nodes
21
+ }
22
+ self.connections = workflow.connections
23
+
24
+ # Index connections for fast lookup
25
+ self.data_conns_to: Dict[UUID, List[ConnectionModel]] = defaultdict(list)
26
+ self.data_conns_from: Dict[UUID, List[ConnectionModel]] = defaultdict(list)
27
+ self.exec_conns_from: Dict[UUID, List[ConnectionModel]] = defaultdict(list)
28
+ self.exec_conns_to: Dict[UUID, List[ConnectionModel]] = defaultdict(list)
29
+
30
+ for conn in self.connections:
31
+ if conn.is_exec:
32
+ self.exec_conns_from[conn.from_node].append(conn)
33
+ self.exec_conns_to[conn.to_node].append(conn)
34
+ else:
35
+ self.data_conns_to[conn.to_node].append(conn)
36
+ self.data_conns_from[conn.from_node].append(conn)
37
+
38
+ # Variable naming state
39
+ self._var_map: Dict[Tuple[UUID, str], str] = {}
40
+ self._node_counters: Dict[str, int] = defaultdict(int)
41
+ self._emitted: Set[UUID] = set()
42
+ self._lines: List[str] = []
43
+
44
+ def convert(self) -> str:
45
+ has_exec = any(c.is_exec for c in self.connections)
46
+
47
+ header = self._generate_header()
48
+ if has_exec:
49
+ body = self._generate_flow_based()
50
+ else:
51
+ body = self._generate_data_flow()
52
+
53
+ return header + "\n" + body + "\n"
54
+
55
+ # ── Header ──────────────────────────────────────────────────
56
+
57
+ def _generate_header(self) -> str:
58
+ lines = [
59
+ '"""',
60
+ 'Auto-generated Python script from Vibrante-Node workflow.',
61
+ '"""',
62
+ ]
63
+
64
+ # Detect which imports are needed
65
+ node_ids = {n.node_id for n in self.workflow.nodes}
66
+ imports = set()
67
+ if node_ids & {"delay_timer"}:
68
+ imports.add("import time")
69
+ if node_ids & {"example_random_float"}:
70
+ imports.add("import random")
71
+ if node_ids & {"file_write", "append_file", "File Loader", "list_directory", "create_folder"}:
72
+ imports.add("import os")
73
+ if node_ids & {"create_folder"}:
74
+ imports.add("from pathlib import Path")
75
+ if any(nid.startswith("prism_") for nid in node_ids):
76
+ imports.add("import os")
77
+ imports.add("import sys")
78
+
79
+ if imports:
80
+ lines.append("")
81
+ lines.extend(sorted(imports))
82
+
83
+ # Shared variable store for Set/Get Variable nodes
84
+ if node_ids & {"Set Variable", "Get Variable", "List Append"}:
85
+ lines.append("")
86
+ lines.append("variables = {}")
87
+
88
+ lines.append("")
89
+ return "\n".join(lines)
90
+
91
+ # ── Data-flow mode (topological) ────────────────────────────
92
+
93
+ def _generate_data_flow(self) -> str:
94
+ gm = GraphManager()
95
+ gm.from_model(self.workflow)
96
+ try:
97
+ layers = gm.get_topological_sort()
98
+ except Exception:
99
+ # Fallback: emit nodes in arbitrary order
100
+ layers = [{nid for nid in self.nodes}]
101
+
102
+ lines = []
103
+ for layer in layers:
104
+ for node_id in layer:
105
+ if node_id not in self._emitted:
106
+ lines.extend(self._emit_node(node_id, indent=0))
107
+ return "\n".join(lines)
108
+
109
+ # ── Flow-based mode (exec chains) ──────────────────────────
110
+
111
+ def _generate_flow_based(self) -> str:
112
+ has_exec_in_conn = {c.to_node for c in self.connections if c.is_exec}
113
+ entry_nodes = []
114
+
115
+ for node_id, node in self.nodes.items():
116
+ has_exec_out = bool(self.exec_conns_from.get(node_id))
117
+ has_exec_in = node_id in has_exec_in_conn
118
+ if has_exec_out and not has_exec_in:
119
+ entry_nodes.append(node_id)
120
+
121
+ # Also include orphan data-only nodes that no flow node depends on
122
+ # (they'll be pulled as dependencies)
123
+
124
+ lines = []
125
+ for entry in entry_nodes:
126
+ lines.extend(self._follow_exec_chain(entry, indent=0))
127
+ return "\n".join(lines)
128
+
129
+ def _follow_exec_chain(self, node_id: UUID, indent: int) -> List[str]:
130
+ if node_id in self._emitted:
131
+ return []
132
+
133
+ node = self.nodes.get(node_id)
134
+ if node is None:
135
+ return []
136
+
137
+ lines = []
138
+
139
+ # First resolve any upstream data-only dependencies
140
+ self._resolve_data_deps(node_id, indent, lines)
141
+
142
+ # Control flow nodes get special treatment (unless bypassed)
143
+ is_bypassed = getattr(node, 'bypassed', False)
144
+
145
+ if node.node_id == "if_condition" and not is_bypassed:
146
+ lines.extend(self._emit_if(node_id, indent))
147
+ elif node.node_id == "For Each" and not is_bypassed:
148
+ lines.extend(self._emit_for_each(node_id, indent))
149
+ elif node.node_id in ("While Loop", "while_loop") and not is_bypassed:
150
+ lines.extend(self._emit_while(node_id, indent))
151
+ elif node.node_id == "loop_body" and not is_bypassed:
152
+ lines.extend(self._emit_loop_body(node_id, indent))
153
+ else:
154
+ # Regular node or BYPASSED control flow node
155
+ # Note: for_loop is now handled as a data dependency for loop_body
156
+ lines.extend(self._emit_node(node_id, indent))
157
+
158
+ # Follow ALL exec outputs
159
+ # Standard chain pins
160
+ for conn in self.exec_conns_from.get(node_id, []):
161
+ if conn.from_port in ("exec_out", "exec_false", "exec_on_finished", "then", "exit"):
162
+ lines.extend(self._follow_exec_chain(conn.to_node, indent))
163
+
164
+ return lines
165
+
166
+ def _resolve_data_deps(self, node_id: UUID, indent: int, lines: List[str]):
167
+ """Emit any upstream data-only nodes that haven't been emitted yet."""
168
+ for conn in self.data_conns_to.get(node_id, []):
169
+ src = conn.from_node
170
+ if src not in self._emitted and src in self.nodes:
171
+ # Only auto-emit if the source is NOT driven by exec flow
172
+ # Exception: for_loop is always emitted as a dependency if needed
173
+ is_driven_by_exec = any(c.to_node == src for c in self.connections if c.is_exec)
174
+ if not is_driven_by_exec or self.nodes[src].node_id == "for_loop":
175
+ self._resolve_data_deps(src, indent, lines)
176
+ lines.extend(self._emit_node(src, indent))
177
+
178
+ # ── Node emission ──────────────────────────────────────────
179
+
180
+ def _emit_node(self, node_id: UUID, indent: int) -> List[str]:
181
+ if node_id in self._emitted:
182
+ return []
183
+ self._emitted.add(node_id)
184
+
185
+ node = self.nodes.get(node_id)
186
+ if node is None:
187
+ return []
188
+
189
+ prefix = " " * indent
190
+
191
+ # Bypass support: map outputs to first input
192
+ if getattr(node, 'bypassed', False):
193
+ lines = [f"{prefix}# Node {node.node_id} is bypassed"]
194
+
195
+ # Find first data input
196
+ first_input_val = "None"
197
+ for p_name in node.parameters:
198
+ if p_name not in ('exec_in', 'exec_out', 'exec_false', 'exec_on_finished', 'then', 'exit'):
199
+ first_input_val = self._inp(node_id, p_name)
200
+ break
201
+
202
+ # Assign to all outputs that are used
203
+ for conn in self.data_conns_from.get(node_id, []):
204
+ var = self._var(node_id, conn.from_port)
205
+ lines.append(f"{prefix}{var} = {first_input_val}")
206
+
207
+ return lines
208
+
209
+ try:
210
+ return self._emit_node_impl(node_id, node, prefix)
211
+ except Exception as e:
212
+ return [f"{prefix}# ERROR generating code for {node.node_id}: {e}"]
213
+
214
+ def _emit_node_impl(self, node_id: UUID, node: NodeInstanceModel, prefix: str) -> List[str]:
215
+ nid = node.node_id
216
+
217
+ # ── Flow ──
218
+ if nid == "for_loop":
219
+ # Just generate the indices list
220
+ start = self._inp(node_id, 'start')
221
+ end = self._inp(node_id, 'end')
222
+ step = self._inp(node_id, 'step')
223
+ return [f"{prefix}{self._var(node_id, 'indices')} = list(range(int({start}), int({end}), int({step})))"]
224
+ if nid == "add_integers":
225
+ return [f"{prefix}{self._var(node_id, 'result')} = int({self._inp(node_id, 'a')}) + int({self._inp(node_id, 'b')})"]
226
+ if nid == "math_subtract":
227
+ return [f"{prefix}{self._var(node_id, 'result')} = float({self._inp(node_id, 'a')}) - float({self._inp(node_id, 'b')})"]
228
+ if nid == "math_multiply":
229
+ return [f"{prefix}{self._var(node_id, 'result')} = float({self._inp(node_id, 'a')}) * float({self._inp(node_id, 'b')})"]
230
+ if nid == "math_divide":
231
+ b = self._inp(node_id, 'b')
232
+ return [f"{prefix}{self._var(node_id, 'result')} = float({self._inp(node_id, 'a')}) / float({b}) if float({b}) != 0 else 0"]
233
+ if nid == "math_modulo":
234
+ b = self._inp(node_id, 'b')
235
+ return [f"{prefix}{self._var(node_id, 'result')} = float({self._inp(node_id, 'a')}) % float({b}) if float({b}) != 0 else 0"]
236
+ if nid == "example_random_float":
237
+ return [f"{prefix}{self._var(node_id, 'value')} = random.uniform(float({self._inp(node_id, 'min')}), float({self._inp(node_id, 'max')}))"]
238
+
239
+ # ── String ──
240
+ if nid == "string_concat":
241
+ # Two variants exist (concat.json and string_concat.json)
242
+ params = node.parameters
243
+ if "str1" in params or "str2" in params:
244
+ sep = self._inp(node_id, 'separator')
245
+ return [f"{prefix}{self._var(node_id, 'combined')} = str({self._inp(node_id, 'str1')}) + str({sep}) + str({self._inp(node_id, 'str2')})"]
246
+ else:
247
+ sep = self._inp(node_id, 'sep')
248
+ return [f"{prefix}{self._var(node_id, 'result')} = str({self._inp(node_id, 'a')}) + str({sep}) + str({self._inp(node_id, 'b')})"]
249
+ if nid == "string_uppercase":
250
+ return [f"{prefix}{self._var(node_id, 'result')} = str({self._inp(node_id, 'text')}).upper()"]
251
+ if nid == "string_lowercase":
252
+ return [f"{prefix}{self._var(node_id, 'result')} = str({self._inp(node_id, 'text')}).lower()"]
253
+ if nid == "string_replace":
254
+ return [f"{prefix}{self._var(node_id, 'result')} = str({self._inp(node_id, 'text')}).replace(str({self._inp(node_id, 'old')}), str({self._inp(node_id, 'new')}))"]
255
+ if nid == "string_split":
256
+ sep = self._inp(node_id, 'separator')
257
+ return [f"{prefix}{self._var(node_id, 'items')} = str({self._inp(node_id, 'text')}).split({sep} or None)"]
258
+ if nid == "string_length":
259
+ return [f"{prefix}{self._var(node_id, 'length')} = len(str({self._inp(node_id, 'text')}))"]
260
+ if nid == "message_node":
261
+ var = self._var(node_id, 'out')
262
+ msg = self._inp(node_id, 'msg')
263
+ return [f"{prefix}{var} = str({msg})"]
264
+
265
+ # ── Logic ──
266
+ if nid == "compare":
267
+ op = node.parameters.get("operation", "==")
268
+ return [f"{prefix}{self._var(node_id, 'result')} = ({self._inp(node_id, 'a')} {op} {self._inp(node_id, 'b')})"]
269
+ if nid == "logical_gate":
270
+ op = node.parameters.get("operation", "AND")
271
+ a = self._inp(node_id, 'a')
272
+ b = self._inp(node_id, 'b')
273
+ var = self._var(node_id, 'result')
274
+ if op == "AND":
275
+ return [f"{prefix}{var} = bool({a}) and bool({b})"]
276
+ elif op == "OR":
277
+ return [f"{prefix}{var} = bool({a}) or bool({b})"]
278
+ elif op == "NOT":
279
+ return [f"{prefix}{var} = not bool({a})"]
280
+ return [f"{prefix}{var} = bool({a})"]
281
+
282
+ # ── Variables / Data ──
283
+ if nid == "variable_node":
284
+ vtype = node.parameters.get("type", "string")
285
+ val = self._inp(node_id, 'value')
286
+ cast_fn = {"int": "int", "float": "float", "bool": "bool"}.get(vtype, "str")
287
+ return [f"{prefix}{self._var(node_id, 'out')} = {cast_fn}({val})"]
288
+ if nid == "Set Variable":
289
+ return [f"{prefix}variables[{self._inp(node_id, 'name')}] = {self._inp(node_id, 'value')}"]
290
+ if nid == "Get Variable":
291
+ return [f"{prefix}{self._var(node_id, 'value')} = variables.get({self._inp(node_id, 'name')})"]
292
+ if nid == "List Append":
293
+ return [
294
+ f"{prefix}variables.setdefault({self._inp(node_id, 'list_name')}, []).append({self._inp(node_id, 'item')})",
295
+ f"{prefix}{self._var(node_id, 'current_list')} = variables[{self._inp(node_id, 'list_name')}]",
296
+ ]
297
+ if nid == "Two Way Switch":
298
+ cond = self._inp(node_id, 'condition')
299
+ return [f"{prefix}{self._var(node_id, 'output')} = {self._inp(node_id, 'input_1')} if bool({cond}) else {self._inp(node_id, 'input_2')}"]
300
+
301
+ # ── Lists / Dicts ──
302
+ if nid == "create_list":
303
+ return [f"{prefix}{self._var(node_id, 'current_list')} = list({self._inp(node_id, 'items')} or [])"]
304
+ if nid == "get_list_item":
305
+ lst = self._inp(node_id, 'list')
306
+ idx = self._inp(node_id, 'index')
307
+ var = self._var(node_id, 'item')
308
+ return [
309
+ f"{prefix}try:",
310
+ f"{prefix} {var} = {lst}[int({idx})]",
311
+ f"{prefix}except (IndexError, TypeError):",
312
+ f"{prefix} {var} = None",
313
+ ]
314
+ if nid == "list_length":
315
+ return [f"{prefix}{self._var(node_id, 'length')} = len({self._inp(node_id, 'list')} or [])"]
316
+ if nid == "create_dictionary":
317
+ return [f"{prefix}{self._var(node_id, 'current_dict')} = dict({self._inp(node_id, 'entries')} or {{}})"]
318
+ if nid == "get_dict_value":
319
+ d = self._inp(node_id, 'dict')
320
+ key = self._inp(node_id, 'key')
321
+ return [f"{prefix}{self._var(node_id, 'value')} = ({d} or {{}}).get({key})"]
322
+ if nid == "set_dict_value":
323
+ d = self._inp(node_id, 'dict')
324
+ key = self._inp(node_id, 'key')
325
+ val = self._inp(node_id, 'value')
326
+ return [
327
+ f"{prefix}{d}[{key}] = {val}",
328
+ f"{prefix}{self._var(node_id, 'result_dict')} = {d}",
329
+ ]
330
+
331
+ # ── IO ──
332
+ if nid == "console_print":
333
+ data = self._inp(node_id, 'data')
334
+ var = self._var(node_id, 'out')
335
+ return [f"{prefix}print({data})", f"{prefix}{var} = {data}"]
336
+ if nid == "Console Sink":
337
+ return [f"{prefix}print({self._inp(node_id, 'data')})"]
338
+ if nid == "file_write":
339
+ return [
340
+ f"{prefix}with open(str({self._inp(node_id, 'path')}), 'w', encoding=str({self._inp(node_id, 'encoding')} or 'utf-8')) as _f:",
341
+ f"{prefix} _f.write(str({self._inp(node_id, 'content')}))",
342
+ f"{prefix}{self._var(node_id, 'result')} = True",
343
+ ]
344
+ if nid == "append_file":
345
+ return [
346
+ f"{prefix}with open(str({self._inp(node_id, 'path')}), 'a', encoding=str({self._inp(node_id, 'encoding')} or 'utf-8')) as _f:",
347
+ f"{prefix} _f.write(str({self._inp(node_id, 'content')}))",
348
+ f"{prefix}{self._var(node_id, 'result')} = True",
349
+ ]
350
+ if nid == "File Loader":
351
+ return [
352
+ f"{prefix}with open(str({self._inp(node_id, 'file_path')}), 'r') as _f:",
353
+ f"{prefix} {self._var(node_id, 'file_data')} = _f.read()",
354
+ ]
355
+ if nid == "list_directory":
356
+ path = self._inp(node_id, 'path')
357
+ var = self._var(node_id, 'result')
358
+ return [f"{prefix}{var} = os.listdir(str({path}))"]
359
+ if nid == "create_folder":
360
+ return [f"{prefix}Path(str({self._inp(node_id, 'path')})).mkdir(parents=True, exist_ok=True)"]
361
+
362
+ # ── Control ──
363
+ if nid == "delay_timer":
364
+ return [f"{prefix}time.sleep(float({self._inp(node_id, 'delay')}))"]
365
+
366
+ # ── Scripting ──
367
+ if nid == "python_script":
368
+ return self._emit_python_script(node_id, prefix)
369
+
370
+ # ── Data Processor (builtin) ──
371
+ if nid == "Data Processor":
372
+ return [f"{prefix}{self._var(node_id, 'data_out')} = f\"Processed: {{{self._inp(node_id, 'data_in')}}}\""]
373
+
374
+ # ── Sequencer ──
375
+ if nid == "Sequencer":
376
+ # Sequencer just passes data through steps; treat as pass-through
377
+ return [f"{prefix}# Sequencer (pass-through)"]
378
+
379
+ # ── Prism ──
380
+ if nid == "prism_core_init":
381
+ scripts_path = self._inp(node_id, 'prism_scripts_path')
382
+ show_ui = self._inp(node_id, 'show_ui')
383
+ load_project = self._inp(node_id, 'load_project')
384
+ core_var = self._var(node_id, 'core')
385
+ ver_var = self._var(node_id, 'version')
386
+ return [
387
+ f"{prefix}_prism_path = str({scripts_path})",
388
+ f"{prefix}if _prism_path and os.path.isdir(_prism_path) and _prism_path not in sys.path:",
389
+ f"{prefix} sys.path.append(_prism_path)",
390
+ f"{prefix}import PrismCore as _PrismCore",
391
+ f"{prefix}_prism_args = ([] if bool({show_ui}) else ['noUI']) + (['loadProject'] if bool({load_project}) else [])",
392
+ f"{prefix}{core_var} = _PrismCore.create(prismArgs=_prism_args)",
393
+ f"{prefix}{ver_var} = str({core_var}.version) if {core_var} else ''",
394
+ ]
395
+
396
+ if nid == "prism_list_projects":
397
+ core = self._inp(node_id, 'core')
398
+ projects_var = self._var(node_id, 'projects')
399
+ count_var = self._var(node_id, 'count')
400
+ return [
401
+ f"{prefix}_pm = getattr({core}, 'projects', None)",
402
+ f"{prefix}{projects_var} = []",
403
+ f"{prefix}if _pm:",
404
+ f"{prefix} for _m in ('getAvailableProjects', 'getRecentProjects'):",
405
+ f"{prefix} _fn = getattr(_pm, _m, None)",
406
+ f"{prefix} if callable(_fn):",
407
+ f"{prefix} try:",
408
+ f"{prefix} _r = _fn()",
409
+ f"{prefix} if _r: {projects_var} = list(_r); break",
410
+ f"{prefix} except Exception: pass",
411
+ f"{prefix}{count_var} = len({projects_var})",
412
+ ]
413
+
414
+ if nid == "prism_get_project_by_name":
415
+ core = self._inp(node_id, 'core')
416
+ name = self._inp(node_id, 'name')
417
+ project_var = self._var(node_id, 'project')
418
+ project_path_var = self._var(node_id, 'project_path')
419
+ config_path_var = self._var(node_id, 'config_path')
420
+ found_var = self._var(node_id, 'found')
421
+ return [
422
+ f"{prefix}_pm = getattr({core}, 'projects', None)",
423
+ f"{prefix}_all_prjs = []",
424
+ f"{prefix}if _pm:",
425
+ f"{prefix} for _m in ('getAvailableProjects', 'getRecentProjects'):",
426
+ f"{prefix} _fn = getattr(_pm, _m, None)",
427
+ f"{prefix} if callable(_fn):",
428
+ f"{prefix} try:",
429
+ f"{prefix} _r = _fn()",
430
+ f"{prefix} if _r: _all_prjs = list(_r); break",
431
+ f"{prefix} except Exception: pass",
432
+ f"{prefix}{project_var}, {project_path_var}, {config_path_var}, {found_var} = {{}}, '', '', False",
433
+ f"{prefix}_tgt = str({name}).lower()",
434
+ f"{prefix}for _p in _all_prjs:",
435
+ f"{prefix} if str(_p.get('name', '')).lower() == _tgt:",
436
+ f"{prefix} _cfg = _p.get('configPath', '')",
437
+ f"{prefix} {project_var} = _p",
438
+ f"{prefix} {config_path_var} = _cfg",
439
+ f"{prefix} {project_path_var} = os.path.dirname(os.path.dirname(_cfg)) if _cfg else ''",
440
+ f"{prefix} {found_var} = True",
441
+ f"{prefix} break",
442
+ ]
443
+
444
+ if nid == "prism_get_shots":
445
+ core = self._inp(node_id, 'core')
446
+ sequences_var = self._var(node_id, 'sequences')
447
+ shots_var = self._var(node_id, 'shots')
448
+ count_var = self._var(node_id, 'shot_count')
449
+ return [
450
+ f"{prefix}{shots_var} = list(({core}).entities.getShots() or [])",
451
+ f"{prefix}{sequences_var} = list(dict.fromkeys(str(s.get('sequence', '')) for s in {shots_var} if isinstance(s, dict) and s.get('sequence')))",
452
+ f"{prefix}{count_var} = len({shots_var})",
453
+ ]
454
+
455
+ if nid == "prism_get_sequences_by_project":
456
+ core = self._inp(node_id, 'core')
457
+ project = self._inp(node_id, 'project')
458
+ sequences_var = self._var(node_id, 'sequences')
459
+ count_var = self._var(node_id, 'count')
460
+ return [
461
+ f"{prefix}_prj = {project} or {{}}",
462
+ f"{prefix}_prj_path = _prj.get('project_path', '') or (os.path.dirname(os.path.dirname(_prj['configPath'])) if _prj.get('configPath') else '')",
463
+ f"{prefix}{core}.changeProject(_prj_path)",
464
+ f"{prefix}_shots_raw = list({core}.entities.getShots() or [])",
465
+ f"{prefix}_seq_names = list(dict.fromkeys(str(s.get('sequence', '')) for s in _shots_raw if isinstance(s, dict) and s.get('sequence')))",
466
+ f"{prefix}{sequences_var} = [{{'name': s, 'project_path': _prj_path, 'project_name': _prj.get('name', '')}} for s in _seq_names]",
467
+ f"{prefix}{count_var} = len({sequences_var})",
468
+ ]
469
+
470
+ if nid == "prism_get_assets_by_project":
471
+ core = self._inp(node_id, 'core')
472
+ project = self._inp(node_id, 'project')
473
+ assets_var = self._var(node_id, 'assets')
474
+ count_var = self._var(node_id, 'count')
475
+ return [
476
+ f"{prefix}_prj = {project} or {{}}",
477
+ f"{prefix}_prj_path = _prj.get('project_path', '') or (os.path.dirname(os.path.dirname(_prj['configPath'])) if _prj.get('configPath') else '')",
478
+ f"{prefix}{core}.changeProject(_prj_path)",
479
+ f"{prefix}{assets_var} = list({core}.entities.getAssets() or [])",
480
+ f"{prefix}{count_var} = len({assets_var})",
481
+ ]
482
+
483
+ if nid == "prism_get_asset_types_by_project":
484
+ core = self._inp(node_id, 'core')
485
+ project = self._inp(node_id, 'project')
486
+ types_var = self._var(node_id, 'asset_types')
487
+ type_var = self._var(node_id, 'asset_type')
488
+ count_var = self._var(node_id, 'count')
489
+ found_var = self._var(node_id, 'found')
490
+ return [
491
+ f"{prefix}_prj = {project} or {{}}",
492
+ f"{prefix}_prj_path = _prj.get('project_path', '') or (os.path.dirname(os.path.dirname(_prj['configPath'])) if _prj.get('configPath') else '')",
493
+ f"{prefix}{core}.changeProject(_prj_path)",
494
+ f"{prefix}_all_assets = list({core}.entities.getAssets() or [])",
495
+ f"{prefix}_seen = {{}}",
496
+ f"{prefix}for _a in _all_assets:",
497
+ f"{prefix} _ap = _a.get('asset_path', _a.get('name', ''))",
498
+ f"{prefix} _cat = _ap.replace('\\\\', '/').split('/')[0] if _ap else ''",
499
+ f"{prefix} if _cat and _cat.lower() not in _seen: _seen[_cat.lower()] = _cat",
500
+ f"{prefix}{types_var} = [{{'type': 'asset_type', 'name': n, 'project_path': _prj_path}} for n in _seen.values()]",
501
+ f"{prefix}{type_var} = {types_var}[0] if {types_var} else {{}}",
502
+ f"{prefix}{count_var} = len({types_var})",
503
+ f"{prefix}{found_var} = bool({types_var})",
504
+ ]
505
+
506
+ if nid == "prism_get_asset_type_by_name":
507
+ core = self._inp(node_id, 'core')
508
+ project = self._inp(node_id, 'project')
509
+ name = self._inp(node_id, 'name')
510
+ type_var = self._var(node_id, 'asset_type')
511
+ entity_var = self._var(node_id, 'entity')
512
+ matches_var = self._var(node_id, 'matches')
513
+ found_var = self._var(node_id, 'found')
514
+ return [
515
+ f"{prefix}_prj = {project} or {{}}",
516
+ f"{prefix}_prj_path = _prj.get('project_path', '') or (os.path.dirname(os.path.dirname(_prj['configPath'])) if _prj.get('configPath') else '')",
517
+ f"{prefix}{core}.changeProject(_prj_path)",
518
+ f"{prefix}_all_assets = list({core}.entities.getAssets() or [])",
519
+ f"{prefix}_seen = {{}}",
520
+ f"{prefix}for _a in _all_assets:",
521
+ f"{prefix} _ap = _a.get('asset_path', _a.get('name', ''))",
522
+ f"{prefix} _cat = _ap.replace('\\\\', '/').split('/')[0] if _ap else ''",
523
+ f"{prefix} if _cat and _cat.lower() not in _seen: _seen[_cat.lower()] = _cat",
524
+ f"{prefix}_tgt = str({name}).lower()",
525
+ f"{prefix}{matches_var} = [{{'type': 'asset_type', 'name': n, 'project_path': _prj_path}} for k, n in _seen.items() if not _tgt or k == _tgt]",
526
+ f"{prefix}{type_var} = {matches_var}[0] if {matches_var} else {{}}",
527
+ f"{prefix}{entity_var} = {type_var}",
528
+ f"{prefix}{found_var} = bool({matches_var})",
529
+ ]
530
+
531
+ if nid == "prism_get_shot_by_name":
532
+ core = self._inp(node_id, 'core')
533
+ shots = self._inp(node_id, 'shots')
534
+ sequence = self._inp(node_id, 'sequence')
535
+ shot_name = self._inp(node_id, 'shot')
536
+ shot_var = self._var(node_id, 'shot')
537
+ entity_var = self._var(node_id, 'entity')
538
+ found_var = self._var(node_id, 'found')
539
+ return [
540
+ f"{prefix}_shots_src = list({shots} or [])",
541
+ f"{prefix}if not _shots_src: _shots_src = list({core}.entities.getShots() or [])",
542
+ f"{prefix}_seq_lower = str({sequence}).lower()",
543
+ f"{prefix}_shot_lower = str({shot_name}).lower()",
544
+ f"{prefix}{shot_var}, {entity_var}, {found_var} = {{}}, {{}}, False",
545
+ f"{prefix}for _s in _shots_src:",
546
+ f"{prefix} _s_seq = str(_s.get('sequence', '')).lower()",
547
+ f"{prefix} _s_shot = str(_s.get('shot', _s.get('name', ''))).lower()",
548
+ f"{prefix} if (not _seq_lower or _s_seq == _seq_lower) and (not _shot_lower or _s_shot == _shot_lower):",
549
+ f"{prefix} {shot_var} = _s",
550
+ f"{prefix} {entity_var} = {{'type': 'shot', 'sequence': _s.get('sequence', ''), 'shot': _s.get('shot', _s.get('name', '')), 'path': _s.get('path', ''), 'location': _s.get('location', 'global')}}",
551
+ f"{prefix} {found_var} = True",
552
+ f"{prefix} break",
553
+ ]
554
+
555
+ if nid == "prism_get_sequence_by_project":
556
+ core = self._inp(node_id, 'core')
557
+ project = self._inp(node_id, 'project')
558
+ name = self._inp(node_id, 'name')
559
+ sequence_var = self._var(node_id, 'sequence')
560
+ found_var = self._var(node_id, 'found')
561
+ return [
562
+ f"{prefix}_prj = {project} or {{}}",
563
+ f"{prefix}_prj_path = _prj.get('project_path', '') or (os.path.dirname(os.path.dirname(_prj['configPath'])) if _prj.get('configPath') else '')",
564
+ f"{prefix}{core}.changeProject(_prj_path)",
565
+ f"{prefix}_all_shots = list({core}.entities.getShots() or [])",
566
+ f"{prefix}_seqs = list(dict.fromkeys(str(s.get('sequence', '')) for s in _all_shots if isinstance(s, dict) and s.get('sequence')))",
567
+ f"{prefix}_tgt = str({name}).lower()",
568
+ f"{prefix}{sequence_var}, {found_var} = {{}}, False",
569
+ f"{prefix}for _seq in _seqs:",
570
+ f"{prefix} if str(_seq).lower() == _tgt:",
571
+ f"{prefix} {sequence_var} = {{'name': str(_seq), 'project_path': _prj_path, 'project_name': _prj.get('name', '')}}",
572
+ f"{prefix} {found_var} = True",
573
+ f"{prefix} break",
574
+ ]
575
+
576
+ if nid.startswith("prism_"):
577
+ lines = [f"{prefix}# Prism node: {nid}"]
578
+ for conn in self.data_conns_from.get(node_id, []):
579
+ var = self._var(node_id, conn.from_port)
580
+ lines.append(f"{prefix}{var} = None # {conn.from_port}")
581
+ return lines
582
+
583
+ # ── Unknown ──
584
+ return [f"{prefix}# Unsupported node: {nid} ({node_id})"]
585
+
586
+ # ── Control flow emitters ──────────────────────────────────
587
+
588
+ def _emit_if(self, node_id: UUID, indent: int) -> List[str]:
589
+ self._emitted.add(node_id)
590
+ prefix = " " * indent
591
+ node = self.nodes[node_id]
592
+ cond = self._inp(node_id, 'condition')
593
+ result_var = self._var(node_id, 'result')
594
+
595
+ lines = [f"{prefix}{result_var} = bool({cond})"]
596
+
597
+ # True branch (exec_out)
598
+ true_targets = [c.to_node for c in self.exec_conns_from.get(node_id, []) if c.from_port == "exec_out"]
599
+ false_targets = [c.to_node for c in self.exec_conns_from.get(node_id, []) if c.from_port == "exec_false"]
600
+
601
+ lines.append(f"{prefix}if {result_var}:")
602
+ if true_targets:
603
+ for t in true_targets:
604
+ lines.extend(self._follow_exec_chain(t, indent + 1))
605
+ else:
606
+ lines.append(f"{prefix} pass")
607
+
608
+ if false_targets:
609
+ lines.append(f"{prefix}else:")
610
+ for t in false_targets:
611
+ lines.extend(self._follow_exec_chain(t, indent + 1))
612
+
613
+ return lines
614
+
615
+ def _emit_for_loop(self, node_id: UUID, indent: int) -> List[str]:
616
+ self._emitted.add(node_id)
617
+ prefix = " " * indent
618
+
619
+ start = self._inp(node_id, 'start')
620
+ end = self._inp(node_id, 'end')
621
+ step = self._inp(node_id, 'step')
622
+ indices_var = self._var(node_id, 'indices')
623
+ index_var = self._var(node_id, 'current_index')
624
+
625
+ lines = [f"{prefix}{indices_var} = list(range(int({start}), int({end}), int({step})))"]
626
+
627
+ body_targets = [c.to_node for c in self.exec_conns_from.get(node_id, []) if c.from_port == "exec_out"]
628
+ if body_targets:
629
+ lines.append(f"{prefix}for {index_var} in {indices_var}:")
630
+ for t in body_targets:
631
+ lines.extend(self._follow_exec_chain(t, indent + 1))
632
+ else:
633
+ lines.append(f"{prefix}for {index_var} in {indices_var}:")
634
+ lines.append(f"{prefix} pass")
635
+
636
+ return lines
637
+
638
+ def _emit_loop_body(self, node_id: UUID, indent: int) -> List[str]:
639
+ self._emitted.add(node_id)
640
+ prefix = " " * indent
641
+
642
+ indices = self._inp(node_id, 'indices')
643
+ index_var = self._var(node_id, 'current_index')
644
+
645
+ lines = [f"{prefix}for {index_var} in ({indices} or []):"]
646
+
647
+ body_targets = [c.to_node for c in self.exec_conns_from.get(node_id, []) if c.from_port == "exec_out"]
648
+ if body_targets:
649
+ for t in body_targets:
650
+ lines.extend(self._follow_exec_chain(t, indent + 1))
651
+ else:
652
+ lines.append(f"{prefix} pass")
653
+
654
+ # Check break condition
655
+ break_cond = self._inp(node_id, 'break_condition')
656
+ if break_cond != "False":
657
+ lines.append(f"{prefix} if {break_cond}: break")
658
+
659
+ # exec_on_finished follows after the loop
660
+ finished_targets = [c.to_node for c in self.exec_conns_from.get(node_id, []) if c.from_port == "exec_on_finished"]
661
+ for t in finished_targets:
662
+ lines.extend(self._follow_exec_chain(t, indent))
663
+
664
+ return lines
665
+
666
+ def _emit_for_each(self, node_id: UUID, indent: int) -> List[str]:
667
+ self._emitted.add(node_id)
668
+ prefix = " " * indent
669
+
670
+ collection = self._inp(node_id, 'collection')
671
+ item_var = self._var(node_id, 'current_item')
672
+ index_var = self._var(node_id, 'current_index')
673
+
674
+ lines = [f"{prefix}for {index_var}, {item_var} in enumerate({collection} or []):"]
675
+
676
+ # Check continue_condition
677
+ cont_cond = self._inp(node_id, 'continue_condition')
678
+ if cont_cond != "False":
679
+ lines.append(f"{prefix} if {cont_cond}: continue")
680
+
681
+ body_targets = [c.to_node for c in self.exec_conns_from.get(node_id, []) if c.from_port == "each_item"]
682
+ if body_targets:
683
+ for t in body_targets:
684
+ lines.extend(self._follow_exec_chain(t, indent + 1))
685
+ else:
686
+ lines.append(f"{prefix} pass")
687
+
688
+ # Check break condition
689
+ break_cond = self._inp(node_id, 'break_condition')
690
+ if break_cond != "False":
691
+ lines.append(f"{prefix} if {break_cond}: break")
692
+
693
+ # exec_on_finished follows after the loop
694
+ finished_targets = [c.to_node for c in self.exec_conns_from.get(node_id, []) if c.from_port == "exec_on_finished"]
695
+ for t in finished_targets:
696
+ lines.extend(self._follow_exec_chain(t, indent))
697
+
698
+ return lines
699
+
700
+ def _emit_while(self, node_id: UUID, indent: int) -> List[str]:
701
+ self._emitted.add(node_id)
702
+ prefix = " " * indent
703
+ node = self.nodes[node_id]
704
+
705
+ max_iter = self._inp(node_id, 'max_iterations')
706
+ index_var = self._var(node_id, 'current_index')
707
+
708
+ lines = [
709
+ f"{prefix}{index_var} = 0",
710
+ f"{prefix}while {index_var} < int({max_iter}):",
711
+ ]
712
+
713
+ # Inner checks
714
+ cond = self._inp(node_id, 'condition')
715
+ lines.append(f"{prefix} if not {cond}: break")
716
+
717
+ cont_cond = self._inp(node_id, 'continue_condition')
718
+ if cont_cond != "False":
719
+ lines.append(f"{prefix} if {cont_cond}:")
720
+ lines.append(f"{prefix} {index_var} += 1")
721
+ lines.append(f"{prefix} continue")
722
+
723
+ # Body targets from each_iteration exec
724
+ body_targets = [c.to_node for c in self.exec_conns_from.get(node_id, []) if c.from_port in ("each_iteration", "exec_out")]
725
+ if body_targets:
726
+ for t in body_targets:
727
+ lines.extend(self._follow_exec_chain(t, indent + 1))
728
+ else:
729
+ lines.append(f"{prefix} pass")
730
+
731
+ # Check break condition
732
+ break_cond = self._inp(node_id, 'break_condition')
733
+ if break_cond != "False":
734
+ lines.append(f"{prefix} if {break_cond}: break")
735
+
736
+ lines.append(f"{prefix} {index_var} += 1")
737
+
738
+ # exec_on_finished follows after the loop
739
+ finished_targets = [c.to_node for c in self.exec_conns_from.get(node_id, []) if c.from_port == "exec_on_finished"]
740
+ for t in finished_targets:
741
+ lines.extend(self._follow_exec_chain(t, indent))
742
+
743
+ return lines
744
+
745
+ # ── Python script node (inline user code) ──────────────────
746
+
747
+ def _emit_python_script(self, node_id: UUID, prefix: str) -> List[str]:
748
+ node = self.nodes[node_id]
749
+ user_code = node.parameters.get("python_code", "")
750
+ if not user_code.strip():
751
+ return [f"{prefix}# (empty python_script node)"]
752
+
753
+ data_input = self._inp(node_id, 'data')
754
+ result_var = self._var(node_id, 'result')
755
+
756
+ lines = [f"{prefix}# --- Inline Python Script ---"]
757
+ lines.append(f"{prefix}inputs = {{'data': {data_input}}}")
758
+ lines.append(f"{prefix}params = {repr(node.parameters)}")
759
+ for line in user_code.splitlines():
760
+ lines.append(f"{prefix}{line}")
761
+ lines.append(f"{prefix}{result_var} = locals().get('result')")
762
+ lines.append(f"{prefix}# --- End Inline Script ---")
763
+ return lines
764
+
765
+ # ── Input resolution helpers ───────────────────────────────
766
+
767
+ def _inp(self, node_id: UUID, port_name: str) -> str:
768
+ """Resolve an input: return variable reference if connected, else literal."""
769
+ for conn in self.data_conns_to.get(node_id, []):
770
+ if conn.to_port == port_name:
771
+ return self._var(conn.from_node, conn.from_port)
772
+
773
+ # Fall back to parameter literal
774
+ node = self.nodes[node_id]
775
+ val = node.parameters.get(port_name)
776
+ if val is None:
777
+ return "None"
778
+ return repr(val)
779
+
780
+ def _var(self, node_id: UUID, port_name: str) -> str:
781
+ """Get or create a variable name for a node output port."""
782
+ key = (node_id, port_name)
783
+ if key not in self._var_map:
784
+ node = self.nodes.get(node_id)
785
+ if node is None:
786
+ base = "unknown"
787
+ else:
788
+ base = node.node_id.replace(" ", "_").lower()
789
+ count = self._node_counters[base]
790
+ self._node_counters[base] += 1
791
+ if port_name in ("result", "out", "output", "value"):
792
+ self._var_map[key] = f"{base}_{count}"
793
+ else:
794
+ self._var_map[key] = f"{base}_{count}_{port_name}"
795
+ return self._var_map[key]
796
+
797
+
798
+ def convert_workflow_to_python(workflow: WorkflowModel) -> str:
799
+ """Public API: converts a WorkflowModel to a standalone Python script string."""
800
+ converter = WorkflowToPythonConverter(workflow)
801
+ return converter.convert()