EpicGamesExt / BlenderTools

Blender addons that improve the game development workflow between Blender and Unreal.
https://epicgamesext.github.io/BlenderTools/
MIT License
2.81k stars 61 forks source link

Send to Unreal - Unreal Paths validation fails when no RPC server is running #419

Closed ryobg closed 2 years ago

ryobg commented 2 years ago

Using Blender 3.1.2, UE 5.0 and Send to Unreal 2.0.2

I have created Inbound and Outbound rules. UDP 6766 (I tried also 9998, read below). image

I have enabled in the UE project settings, the remote execution. image

I have verified that before starting UE's project, the port is free and then allocated (9998 shows nothing, read below):

image

The problem:

When I go to Blender's Pipeline -> Export -> Settings Dialog, it auto closes, no Error Message in the Blender's console.

When I quickly try to change value in that Settings dialog, then I get the following error in the console:

Traceback (most recent call last):
  File "C:\Users\User\AppData\Roaming\Blender Foundation\Blender\3.1\scripts\addons\send2ue\dependencies\rpc\factory.py", line 113, in _register
    response = self.rpc_client.proxy.add_new_callable(
  File "C:\Program Files\Blender Foundation\Blender 3.1\3.1\python\lib\xmlrpc\client.py", line 1122, in __call__
    return self.__send(self.__name, args)
  File "C:\Program Files\Blender Foundation\Blender 3.1\3.1\python\lib\xmlrpc\client.py", line 1464, in __request
    response = self.__transport.request(
  File "C:\Program Files\Blender Foundation\Blender 3.1\3.1\python\lib\xmlrpc\client.py", line 1166, in request
    return self.single_request(host, handler, request_body, verbose)
  File "C:\Program Files\Blender Foundation\Blender 3.1\3.1\python\lib\xmlrpc\client.py", line 1178, in single_request
    http_conn = self.send_request(host, handler, request_body, verbose)
  File "C:\Program Files\Blender Foundation\Blender 3.1\3.1\python\lib\xmlrpc\client.py", line 1291, in send_request
    self.send_content(connection, request_body)
  File "C:\Program Files\Blender Foundation\Blender 3.1\3.1\python\lib\xmlrpc\client.py", line 1321, in send_content
    connection.endheaders(request_body)
  File "C:\Program Files\Blender Foundation\Blender 3.1\3.1\python\lib\http\client.py", line 1277, in endheaders
    self._send_output(message_body, encode_chunked=encode_chunked)
  File "C:\Program Files\Blender Foundation\Blender 3.1\3.1\python\lib\http\client.py", line 1037, in _send_output
    self.send(msg)
  File "C:\Program Files\Blender Foundation\Blender 3.1\3.1\python\lib\http\client.py", line 975, in send
    self.connect()
  File "C:\Program Files\Blender Foundation\Blender 3.1\3.1\python\lib\http\client.py", line 941, in connect
    self.sock = self._create_connection(
  File "C:\Program Files\Blender Foundation\Blender 3.1\3.1\python\lib\socket.py", line 845, in create_connection
    raise err
  File "C:\Program Files\Blender Foundation\Blender 3.1\3.1\python\lib\socket.py", line 833, in create_connection
    sock.connect(sa)
ConnectionRefusedError: [WinError 10061] No connection could be made because the target machine actively refused it

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\User\AppData\Roaming\Blender Foundation\Blender\3.1\scripts\addons\send2ue\core\formatting.py", line 214, in update_unreal_mesh_folder_path
    auto_format_unreal_folder_path('unreal_mesh_folder_path', self)
  File "C:\Users\User\AppData\Roaming\Blender Foundation\Blender\3.1\scripts\addons\send2ue\core\formatting.py", line 116, in auto_format_unreal_folder_path
    elif not error_message and not UnrealRemoteCalls.directory_exists('/'.join(formatted_value.split('/')[:2])):
  File "C:\Users\User\AppData\Roaming\Blender Foundation\Blender\3.1\scripts\addons\send2ue\dependencies\rpc\factory.py", line 178, in wrapper
    return rpc_factory.run_function_remotely(function, args)
  File "C:\Users\User\AppData\Roaming\Blender Foundation\Blender\3.1\scripts\addons\send2ue\dependencies\rpc\factory.py", line 135, in run_function_remotely
    self._register(function)
  File "C:\Users\User\AppData\Roaming\Blender Foundation\Blender\3.1\scripts\addons\send2ue\dependencies\rpc\factory.py", line 122, in _register
    raise ConnectionRefusedError(f'No connection could be made with "{server_name}"')
ConnectionRefusedError: No connection could be made with "9998"
File "C:\Users\User\AppData\Roaming\Blender Foundation\Blender\3.1\scripts\addons\send2ue\core\formatting.py", line 207, in update_unreal_mesh_folder_path

I have no more ideas how to solve this. Thank you for your attention and time.

james-baber commented 2 years ago

When I quickly try to change value in that Settings dialog, then I get the following error in the console

Hey @ryobg which value specifically? Is it just when the Unreal path values are changed, or any property?

The RPC module communicates with Unreal over port 9998, but needs to have the server started initially. If the unreal RPC server isn't already running it uses unreal's remote execution over port 6766 to start the Unreal RPC server. However it seems in your case the server is never getting started. Can you try Pipeline > Utilities > Start RPC Servers and see if you receive an error in the unreal output logs? I would expect this is where the failure might occur if for some reason port 9998 is already in use. Or there could be another issue.

If the Start RPC Servers was successful id expected youd be able to see UDP 6766 and TCP 9998 (Unreal) TCP 9997 (Blender) when running netstat

ryobg commented 2 years ago

Hi James,

Not sure whether it is relevant, but I restarted Blender and Started again the RPC servers, seems there are too many ports opened? Issue of auto-closing persists though. image

ryobg commented 2 years ago

Okay... shame is on me, but apart from the Start RPC servers fix, I somehow never expected that moving my cursor outside the Settings dialogue window to trigger random timeout and auto-close it. Apparently, it was too counter-intuitive to me.

On other hand, I found a bug. The custom JSON settings are actually never applied even if showing as selected when opening a New Scene.

james-baber commented 2 years ago

@ryobg ah yea the dialog closes when your mouse isn't on it. Thats just blender's default dialog behavior, whether that can be changed or not I dont know.

The initial stack trace you got I think is related to the path validations. Since unreal was not connected this I think failed. These should be handled better, so Ill change this to a validation bug.

On other hand, I found a bug. The custom JSON settings are actually never applied even if showing as selected when opening a New Scene.

This might not be a bug, because all data in the dialog is the scene data, meaning if you saved it that way it loads that way. (also if not loading a saved file it will be the default settings) However when you select the active template they should update, otherwise that would be a bug.

ryobg commented 2 years ago

I'm looking at this on user level.

If I see that my Custom Settings being active, I expect that the settings reflects it. Therefore, we can see in many apps (Blender too?) that when you do a change, you get an Asterisk (dirty flag) or just a switch to "Custom" or else setting's name. I do understand that there is coding reason behind the current behaviour :)

As for the Path validation issue, what I missed somehow is maybe a hint in the Guidelines that a person need to start the RPC servers manually if there is no connection? Just my 2c.

Btw the link to Quickstart in the FAQ page is broken.

Anyway, thank you for your time!

james-baber commented 2 years ago

path validation should be fixed in latest release