| … | … | @@ -359,15 +359,33 @@ class IFS_OT_build_graph(Operator): |
| 359 | 359 | |
| 360 | 360 | # tree_type as well as node_tree: assigning the tree alone leaves the |
| 361 | 361 | # editor showing Shader nodes and the graph apparently missing. |
| 362 | shown = False |
| 362 | 363 | for area in context.screen.areas: |
| 363 | 364 | if area.type == 'NODE_EDITOR': |
| 364 | 365 | area.spaces.active.tree_type = IFSNodeTree.bl_idname |
| 365 | 366 | area.spaces.active.node_tree = tree |
| 367 | shown = True |
| 366 | 368 | |
| 367 | 369 | if ifs_viewport.is_running(): |
| 368 | 370 | ifs_viewport.session().bind_tree(tree.name) |
| 371 | |
| 369 | 372 | settings.status = f"Graph built: {len(doc.iterators)} iterators" |
| 370 | | self.report({'INFO'}, settings.status) |
| 373 | if shown: |
| 374 | self.report({'INFO'}, settings.status) |
| 375 | else: |
| 376 | # The panel lives in the 3D viewport sidebar, and the default Layout |
| 377 | # workspace has NO node editor - only Shading, Compositing and Geometry |
| 378 | # Nodes do. So the graph was built into a datablock with nothing on screen |
| 379 | # displaying it, and the operator reported success: indistinguishable from |
| 380 | # the button doing nothing at all. |
| 381 | settings.status = ( |
| 382 | f"Graph '{tree.name}' built ({len(doc.iterators)} iterators) - " |
| 383 | "open a Node Editor to see it") |
| 384 | self.report( |
| 385 | {'WARNING'}, |
| 386 | f"Graph '{tree.name}' built, but this workspace has no Node Editor. " |
| 387 | "Switch to the Geometry Nodes or Shading workspace (or change an area " |
| 388 | "to a Node Editor) and set its type to IFS Fractal.") |
| 371 | 389 | return {'FINISHED'} |
| 372 | 390 | |
| 373 | 391 | |