Skip to content

Commit

Permalink
networking fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
mifth committed Feb 15, 2023
1 parent f3935b4 commit 44cb92e
Showing 1 changed file with 20 additions and 7 deletions.
27 changes: 20 additions & 7 deletions BEngine-Py/bengine/BENetworking.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

import json
import pickle
import traceback

# MAX_BYTES = 4096
# host = socket.gethostname() # get name of local machine
Expand Down Expand Up @@ -40,17 +41,29 @@ def handle_client(client_socket, addr):

be_base_stuff = BEUtils.BaseStuff(js_base_stuff["BaseValues"])

process_gn_obj, geom_mod, node_tree = BEUtils.LoadNodesTreeFromJSON(context, be_paths, be_base_stuff)
# Load Nodes
try:
process_gn_obj, geom_mod, node_tree = BEUtils.LoadNodesTreeFromJSON(context, be_paths, be_base_stuff)
except Exception as e:
print("There was a Problem During LoadNodesTreeFromJSON.")
print(traceback.format_exc())

if be_base_stuff.run_type == BESettings.RunNodesType.RunNodes:
js_inputs = js_base_stuff["BEngineInputs"]
js_output_data = BERunNodes.RunNodes(context, be_paths, js_inputs, node_tree,
process_gn_obj, geom_mod, be_base_stuff)

# Get Data
try:
js_inputs = js_base_stuff["BEngineInputs"]
js_output_data = BERunNodes.RunNodes(context, be_paths, js_inputs, node_tree,
process_gn_obj, geom_mod, be_base_stuff)

except Exception as e:
print("There was a Problem During RunNodes.")
print(traceback.format_exc())

js_output_data = {}

# Send
if js_output_data:
# SendAll(client_socket, str.encode(json.dumps(js_output_data)))
client_socket.sendall(str.encode(json.dumps(js_output_data)))
client_socket.sendall(str.encode(json.dumps(js_output_data)))

elif be_base_stuff.run_type == BESettings.RunNodesType.UpdateNodes:
BERunNodes.SaveBlenderInputs(be_base_stuff, node_tree)
Expand Down

0 comments on commit 44cb92e

Please sign in to comment.