mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-25 05:14:40 +01:00
specific the time for the process event
This commit is contained in:
parent
1229311d67
commit
ede44ea0fb
2 changed files with 5 additions and 9 deletions
|
|
@ -549,7 +549,7 @@ def _get_new_project_action():
|
|||
return new_action
|
||||
|
||||
|
||||
def prompt_new_file_with_mesh(mesh_filepath, allow_user_setting=True):
|
||||
def prompt_new_file_with_mesh(mesh_filepath):
|
||||
"""Prompts the user for a new file using Substance Painter's own dialog.
|
||||
|
||||
This will set the mesh path to load to the given mesh and disables the
|
||||
|
|
@ -577,7 +577,7 @@ def prompt_new_file_with_mesh(mesh_filepath, allow_user_setting=True):
|
|||
assert isinstance(file_dialog, QtWidgets.QFileDialog)
|
||||
|
||||
# Quickly hide the dialog
|
||||
# file_dialog.hide()
|
||||
file_dialog.hide()
|
||||
app.processEvents(QtCore.QEventLoop.ExcludeUserInputEvents, 1000)
|
||||
|
||||
file_dialog.setDirectory(os.path.dirname(mesh_filepath))
|
||||
|
|
@ -586,7 +586,7 @@ def prompt_new_file_with_mesh(mesh_filepath, allow_user_setting=True):
|
|||
# TODO: find a way to improve the process event to
|
||||
# load more complicated mesh
|
||||
app.processEvents(QtCore.QEventLoop.ExcludeUserInputEvents, 3000)
|
||||
# file_dialog.done(file_dialog.Accepted)
|
||||
file_dialog.done(file_dialog.Accepted)
|
||||
app.processEvents(QtCore.QEventLoop.AllEvents)
|
||||
|
||||
def _setup_prompt():
|
||||
|
|
@ -605,7 +605,7 @@ def prompt_new_file_with_mesh(mesh_filepath, allow_user_setting=True):
|
|||
mesh_select.setVisible(False)
|
||||
|
||||
# Ensure UI is visually up-to-date
|
||||
app.processEvents(QtCore.QEventLoop.ExcludeUserInputEvents)
|
||||
app.processEvents(QtCore.QEventLoop.ExcludeUserInputEvents, 8000)
|
||||
|
||||
# Trigger the 'select file' dialog to set the path and have the
|
||||
# new file dialog to use the path.
|
||||
|
|
@ -622,9 +622,6 @@ def prompt_new_file_with_mesh(mesh_filepath, allow_user_setting=True):
|
|||
"Failed to set mesh path with the prompt dialog:"
|
||||
f"{mesh_filepath}\n\n"
|
||||
"Creating new project directly with the mesh path instead.")
|
||||
else:
|
||||
if not allow_user_setting:
|
||||
dialog.done(dialog.Accepted)
|
||||
|
||||
new_action = _get_new_project_action()
|
||||
if not new_action:
|
||||
|
|
|
|||
|
|
@ -67,8 +67,7 @@ class SubstanceLoadProjectMesh(load.LoaderPlugin):
|
|||
path = self.filepath_from_context(context)
|
||||
# TODO: improve the prompt dialog function to not
|
||||
# only works for simple polygon scene
|
||||
result = prompt_new_file_with_mesh(
|
||||
mesh_filepath=path, allow_user_setting=allow_user_setting)
|
||||
result = prompt_new_file_with_mesh(mesh_filepath=path)
|
||||
if not result:
|
||||
self.log.info("User cancelled new project prompt."
|
||||
"Creating new project directly from"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue