@@ -43,9 +43,9 @@ def MainWork():
4343
4444 be_paths = BEUtils .BEPaths ()
4545
46- process_obj , geom_mod , bengine_GN = BEUtils .LoadGN (context , be_paths )
46+ process_gn_obj , geom_mod , node_tree = BEUtils .LoadNodesTreeFromJSON (context , be_paths )
4747
48- if ( process_obj and bengine_GN ) :
48+ if node_tree :
4949
5050 # ORIGINAL STUFF
5151 with open (be_paths .be_tmp_folder + "BEngineInputs.json" ) as js_file :
@@ -56,30 +56,47 @@ def MainWork():
5656
5757 engine_type = js_input_data ["BEngineType" ]
5858
59- # Set Transform
60- process_obj .location = js_input_data ["Pos" ]
61- BEUtils .SetRotationFromJSON (process_obj , js_input_data ["Rot" ], engine_type )
62- process_obj .scale = js_input_data ["Scale" ]
59+ # If GN
60+ if node_tree .bl_idname == BEUtils .TYPE_GN and process_gn_obj :
61+ # Set Transform
62+ process_gn_obj .location = js_input_data ["Pos" ]
63+ BEUtils .SetRotationFromJSON (process_gn_obj , js_input_data ["Rot" ], engine_type )
64+ process_gn_obj .scale = js_input_data ["Scale" ]
6365
64- # Setup inputs
65- BEUtils .SetupInputsFromJSON (context , bengine_GN , geom_mod ,
66- js_input_data ["BEngineInputs" ], be_paths , engine_type )
67- # geom_mod.show_viewport = True
66+ # Setup inputs
67+ BEUtils .SetupInputsFromJSON (context , node_tree , geom_mod ,
68+ js_input_data ["BEngineInputs" ], be_paths , engine_type )
69+ # geom_mod.show_viewport = True
6870
69- # Set the GN Object Active and Selected
70- bpy .ops .object .select_all (action = 'DESELECT' )
71- process_obj .select_set (True )
72- context .view_layer .objects .active = process_obj
71+ # Set the GN Object Active and Selected
72+ bpy .ops .object .select_all (action = 'DESELECT' )
73+ process_gn_obj .select_set (True )
74+ context .view_layer .objects .active = process_gn_obj
7375
74- process_obj .data .update ()
76+ process_gn_obj .data .update ()
7577
76- # Save Node Outputs
77- BEUtils .SaveBlenderOutputs (context , process_obj , be_paths , engine_type )
78+ # Save Node Outputs
79+ BEUtils .SaveBlenderOutputs (context , process_gn_obj , be_paths , engine_type )
80+
81+ # If SV
82+ elif node_tree .bl_idname == BEUtils .TYPE_SV :
83+ # Setup inputs
84+ BEUtils .SetupInputsFromJSON (context , node_tree , None ,
85+ js_input_data ["BEngineInputs" ], be_paths , engine_type )
86+
87+ process_gn_obj .data .update ()
88+
89+ # Save Node Outputs
90+ BEUtils .SaveBlenderOutputs (context , None , be_paths , engine_type )
91+
92+ else :
93+ print ("Nodes were not Loaded! Please check Paths and NodeTree Name!" )
94+ return False
7895
7996 return True
8097
8198 else :
82- print ("Geometry Nodes were not Loaded! Please check Paths!" )
99+ print ("Nodes were not Loaded! Please check Paths and NodeTree Name !" )
83100 return False
84101
85102
0 commit comments