diff --git a/docs/main/contributing/development.md b/docs/main/contributing/development.md index 8fd30f87..3581bf46 100644 --- a/docs/main/contributing/development.md +++ b/docs/main/contributing/development.md @@ -71,10 +71,6 @@ you want to run the unittests on the open app instances. ## Hot reloading from PyCharm These steps must be completed in-order for the addons to hot-reload while you type in PyCharm. 1. If you have the addons already installed, uninstall them and shutdown Blender and PyCharm. -1. Set a static value for `RPC_AUTH_TOKEN` in your system environment variables and restart Pycharm and Blender. - ::: tip Windows - Hit the Windows key then search for `Edit the system environment variables` then add it. - ::: 1. You must symlink the addon folders into the blender addon installation location. Then enable the addons ::: tip Windows Run this from a commandline launched as administrator. Swapping out the last path with your own. diff --git a/docs/main/contributing/testing.md b/docs/main/contributing/testing.md index 1de83654..0f0f4208 100644 --- a/docs/main/contributing/testing.md +++ b/docs/main/contributing/testing.md @@ -86,4 +86,3 @@ specific cases with `EXCLUSIVE_TESTS` can be beneficial. | `CONTAINER_TEST_FOLDER` | The path in the container where the repo tests folder is mounted | `/tmp/blender_tools/tests` | | `RPC_TIME_OUT` | When running a Non-Blocking server, the is a timeout value for command execution. If a command has been sent from the client, the server will try to give the client the response up until 20 seconds has passed. Once the response or timeout has been reached, the server will let the event loop of the DCC continue again. | `20` | | `RPC_EXECUTION_HISTORY_FILE` | Lets you specify a file path to write out the python execution history by the rpc module. This is useful for debugging. | `None` | -| `RPC_AUTH_TOKEN` | Can be used to set a static auth token value for the client and server connection. | `password` | diff --git a/docs/send2ue/extras/addon-preferences.md b/docs/send2ue/extras/addon-preferences.md index ae63bba1..d27f0d8c 100644 --- a/docs/send2ue/extras/addon-preferences.md +++ b/docs/send2ue/extras/addon-preferences.md @@ -15,12 +15,6 @@ It is not recommended to set the timeout too high. The timeout is a safeguard ag indefinitely. ::: -### RPC auth token -This is the auth token that the client uses to connect to the RPC server. A default value is generated -automatically when the addon is registered. If you want to use a static auth token, then you can set the -environment variable `RPC_AUTH_TOKEN` on your system. The addon must be uninstalled and both blender and unreal -restarted and the addon re-installed for this change to take effect. - ### Extensions Repo Path Set this path to the folder that contains your Send to Unreal python extensions. All extensions in this folder will be automatically loaded. diff --git a/docs/send2ue/settings/validations.md b/docs/send2ue/settings/validations.md index 303d9973..9f2cf079 100644 --- a/docs/send2ue/settings/validations.md +++ b/docs/send2ue/settings/validations.md @@ -19,7 +19,7 @@ assigned to a vertex on the mesh object. If there is a unused material, then an ### Check texture references This checks the texture references and sees if they actually exist on disk. -### Check paths: +### Check paths This checks the export and import paths and makes sure they are valid before preforming the operation. @@ -29,13 +29,8 @@ the operation. ### Check blender object names This checks whether the blender object names in the Export collection contain any -invalid special characters or white space. While the following special characters `'".,/.:|&!~\n\r\t@#(){}[]=;^%$\*?<>` or ` have +invalid special characters or white space. While the following special characters ```'".,/.:|&!~\n\r\t@#(){}[]=;^%$\`*?<>``` have valid usage in Blender, they are not valid to use in asset names in Unreal. Send2UE automatically converts any invalid characters to `_` during the export process if this validation is turned off. - -::: tip Note - Checking the unreal paths makes a few remote calls which requires an open Unreal editor instance with remote -execution enabled. Also, if this is disabled it can shave 1 to 5 seconds off the validation step. -::: diff --git a/send2ue/__init__.py b/send2ue/__init__.py index 991a16ad..036e2976 100644 --- a/send2ue/__init__.py +++ b/send2ue/__init__.py @@ -13,7 +13,7 @@ bl_info = { "name": "Send to Unreal", "author": "Epic Games Inc.", - "version": (2, 3, 0), + "version": (2, 3, 1), "blender": (3, 3, 0), "location": "Header > Pipeline > Send to Unreal", "description": "Sends an asset to the first open Unreal Editor instance on your machine.", diff --git a/send2ue/core/settings.py b/send2ue/core/settings.py index 500503a8..896a97f5 100644 --- a/send2ue/core/settings.py +++ b/send2ue/core/settings.py @@ -244,14 +244,6 @@ def set_property_group_with_dictionary(property_group, data): setattr(property_group, attribute, data.get(attribute)) -def set_rpc_auth_token(self, value): - """ - Overrides setter method on rpc_auth_token property to update the - environment variable as well. - """ - os.environ['RPC_AUTH_TOKEN'] = value - - def set_rpc_response_timeout(self, value): """ Overrides setter method on rpc_response_timeout property to update the diff --git a/send2ue/core/utilities.py b/send2ue/core/utilities.py index 09f200e1..902aad05 100644 --- a/send2ue/core/utilities.py +++ b/send2ue/core/utilities.py @@ -1076,7 +1076,6 @@ def setup_project(*args): """ # set the auth token variable addon_properties = bpy.context.preferences.addons.get(ToolInfo.NAME.value) - settings.set_rpc_auth_token(None, addon_properties.preferences.rpc_auth_token) # remove the cached files remove_temp_folder() @@ -1122,8 +1121,13 @@ def report_error(message, details='', raise_exception=True): :param str message: The error message to display to the user. :param str details: The error message details to display to the user. - :param bool raise_exception: Whether or not to raise an exception or report the error in the popup. + :param bool raise_exception: Whether to raise an exception or report the error in the popup. """ + # if a warning is received, then don't raise an error + if message == {'WARNING'}: + print(f'{message} {details}') + return + if os.environ.get('SEND2UE_DEV', raise_exception): raise RuntimeError(message + details) else: diff --git a/send2ue/dependencies/rpc/base_server.py b/send2ue/dependencies/rpc/base_server.py index addf17eb..4bd3e042 100644 --- a/send2ue/dependencies/rpc/base_server.py +++ b/send2ue/dependencies/rpc/base_server.py @@ -71,10 +71,13 @@ def is_authorized(self): :returns: Whether the request is authorized. :rtype: bool """ - for key, value in self.headers.items(): - if key == 'Authorization': - return value and value == os.environ.get('RPC_AUTH_TOKEN', 'password') - return False + # do not allow requests sent cross site + if self.headers.get('Sec-Fetch-Site') == 'cross-site': + return False + # do not allow requests from another origin + if self.headers.get('Origin'): + return False + return True def report_401(self): """ diff --git a/send2ue/dependencies/rpc/client.py b/send2ue/dependencies/rpc/client.py index 098eefed..5f6dcba8 100644 --- a/send2ue/dependencies/rpc/client.py +++ b/send2ue/dependencies/rpc/client.py @@ -78,9 +78,7 @@ def __init__(self, *args, **kwargs): """ Override so we can redefine the ServerProxy to use our custom transport. """ - kwargs['transport'] = RPCTransport(headers=[ - ('Authorization', os.environ.get('RPC_AUTH_TOKEN', 'password')) - ]) + kwargs['transport'] = RPCTransport() ServerProxy.__init__(self, *args, **kwargs) diff --git a/send2ue/dependencies/unreal.py b/send2ue/dependencies/unreal.py index a9d40eac..8367d646 100644 --- a/send2ue/dependencies/unreal.py +++ b/send2ue/dependencies/unreal.py @@ -187,6 +187,8 @@ def bootstrap_unreal_with_rpc_server(): """ if not os.environ.get('TEST_ENVIRONMENT'): if not is_connected(): + import bpy + rpc_response_timeout = bpy.context.preferences.addons["send2ue"].preferences.rpc_response_timeout dependencies_path = os.path.dirname(__file__) result = run_commands( [ @@ -196,7 +198,7 @@ def bootstrap_unreal_with_rpc_server(): 'for thread in threading.enumerate():', '\tif thread.name =="UnrealRPCServer":', '\t\tthread.kill()', - f'os.environ["RPC_AUTH_TOKEN"] = "{os.environ["RPC_AUTH_TOKEN"]}"', + f'os.environ["RPC_TIME_OUT"] = "{rpc_response_timeout}"', f'sys.path.append(r"{dependencies_path}")', 'from rpc import unreal_server', 'rpc_server = unreal_server.RPCServer()', diff --git a/send2ue/properties.py b/send2ue/properties.py index bd559754..e3e5aa32 100644 --- a/send2ue/properties.py +++ b/send2ue/properties.py @@ -27,18 +27,6 @@ class Send2UeAddonProperties: set=settings.set_rpc_response_timeout, get=settings.get_rpc_response_timeout ) - rpc_auth_token: bpy.props.StringProperty( - name="RPC Auth Token", - subtype='PASSWORD', - default=os.environ.get('RPC_AUTH_TOKEN', str(uuid.uuid4().hex)), - description=( - "This is the auth token that the client uses to connect to the RPC server. A default value is generated " - "automatically when the addon is registered. If you want to use a static auth token, then you can set the " - "environment variable 'RPC_AUTH_TOKEN' on your system. The addon must be uninstalled and both blender and " - "unreal restarted and the addon re-installed for this change to take effect" - ), - set=settings.set_rpc_auth_token - ) extensions_repo_path: bpy.props.StringProperty( name="Extensions Repo Path", default="", diff --git a/send2ue/release_notes.md b/send2ue/release_notes.md index 0b8caf29..42142894 100644 --- a/send2ue/release_notes.md +++ b/send2ue/release_notes.md @@ -1,21 +1,14 @@ -## Major Changes -* Send to Unreal is no longer using the blender FBX export operator. Instead, it uses a patched version of the logic in -the `export_fbx_bin` module from Blender's FBX addon. The reasoning for doing this was to fix the scale factor that gets baked into exported FBX files for SkeletalMesh and AnimSequence assets at the FBX level rather than fixing this issue by preforming operations to the blender scene and objects. (This logic was quite complex and still imposed some limitations. Now it can all be removed!). It should be noted that this change is substantial, and while we have done our best to test -this, it could introduce some new bugs that were overlooked. If there are issues with the scale, please report any issues and roll back to version `2.2.1` of the addon in the meantime. -* `Use object origin` is now a core feature. This now uses the FBX export module to set the world location of StaticMesh, SkeletalMesh, and AnimSequence assets. This fixes some common problems that were introduced by moving objects in the blender scene pre-export. -* The `Sync control rig tracks to source rig` option has been added back to the ue2rigify extension. Since the `Automatically scale bones` feature has been removed, it made it easy to add this option back in as an extension. - * [#417](https://github.com/EpicGames/BlenderTools/issues/417) - ## Minor Changes -* "Send to Unreal" button in settings dialog was renamed to "Push Assets" to be more accurate since the tool can also -only export to disk if used in that mode. -* `Check scene scale` no longer has an option for 0.01. It now only checks for a scene scale of 1 since this is the only -recommend way to work. +* Fixed various connection and timeout issues by removing the authorization token in favor of checking CORS. + * [563](https://github.com/EpicGames/BlenderTools/issues/563) + * [564](https://github.com/EpicGames/BlenderTools/issues/564) + * [552](https://github.com/EpicGames/BlenderTools/issues/552) +* Fixed issue with FBX exporter failing to export with warnings. Now the exports finish and warnings are printed to the system console. + * [565](https://github.com/EpicGames/BlenderTools/issues/565) ## Deprecated -* The option `Automatically scale bones` has been removed. This was the default option that fixed the scale factor in -SkeletalMesh and AnimSequence assets by scaling the object, scene, and fcurves. This is no longer needed since this is handled in the FBX export now. -* The `Use object origin` extension has been removed since it is now a core feature. +* The `RPC Auth Token` option has been removed from the addon preferences since it can be cumbersome to configure and +was causing issues. Instead, the same security can be provided by checking CORS in the RPC server. ## Tests Passing On * Blender `3.3`, `3.4` diff --git a/send2ue/ui/addon_preferences.py b/send2ue/ui/addon_preferences.py index a41a3356..30048960 100644 --- a/send2ue/ui/addon_preferences.py +++ b/send2ue/ui/addon_preferences.py @@ -23,10 +23,6 @@ def draw(self, context): row.label(text='RPC Response Timeout') row.prop(self, 'rpc_response_timeout', text='') row = self.layout.row() - row.label(text='RPC Auth Token') - row.enabled = False - row.prop(self, 'rpc_auth_token', text='') - row = self.layout.row() row.label(text='Extensions Repo Path:') row = self.layout.row() row = row.split(factor=0.95, align=True)