Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/Ultimaker/Cura.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJaime van Kessel <nallath@gmail.com>2020-04-15 12:02:02 +0300
committerJaime van Kessel <nallath@gmail.com>2020-04-15 12:31:15 +0300
commit28b8ba3748a4efa170fdbedd113c8df328e7c422 (patch)
treebce7c8e325a7f394171ad314e0899e8507eb9491 /plugins/CuraEngineBackend
parent52f01a71c3cc54bbfb1f91b0531006dda7049450 (diff)
Only check changed settings (and whatever it affects) for errors in POS
CURA-7329
Diffstat (limited to 'plugins/CuraEngineBackend')
-rw-r--r--plugins/CuraEngineBackend/StartSliceJob.py36
1 files changed, 25 insertions, 11 deletions
diff --git a/plugins/CuraEngineBackend/StartSliceJob.py b/plugins/CuraEngineBackend/StartSliceJob.py
index a99c559bac..62b0bd16e7 100644
--- a/plugins/CuraEngineBackend/StartSliceJob.py
+++ b/plugins/CuraEngineBackend/StartSliceJob.py
@@ -13,6 +13,8 @@ from UM.Job import Job
from UM.Logger import Logger
from UM.Scene.SceneNode import SceneNode
from UM.Settings.ContainerStack import ContainerStack #For typing.
+from UM.Settings.InstanceContainer import InstanceContainer
+from UM.Settings.SettingDefinition import SettingDefinition
from UM.Settings.SettingRelation import SettingRelation #For typing.
from UM.Scene.Iterator.DepthFirstIterator import DepthFirstIterator
@@ -103,20 +105,33 @@ class StartSliceJob(Job):
## Check if a stack has any errors.
## returns true if it has errors, false otherwise.
def _checkStackForErrors(self, stack: ContainerStack) -> bool:
- if stack is None:
- return False
- # if there are no per-object settings we don't need to check the other settings here
- stack_top = stack.getTop()
- if stack_top is None or not stack_top.getAllKeys():
- return False
+ top_of_stack = cast(InstanceContainer, stack.getTop()) # Cache for efficiency.
+ changed_setting_keys = top_of_stack.getAllKeys()
- for key in stack.getAllKeys():
- validation_state = stack.getProperty(key, "validationState")
- if validation_state in (ValidatorState.Exception, ValidatorState.MaximumError, ValidatorState.MinimumError, ValidatorState.Invalid):
- Logger.log("w", "Setting %s is not valid, but %s. Aborting slicing.", key, validation_state)
+ # Add all relations to changed settings as well.
+ for key in top_of_stack.getAllKeys():
+ instance = top_of_stack.getInstance(key)
+ if instance is None:
+ continue
+ self._addRelations(changed_setting_keys, instance.definition.relations)
+ Job.yieldThread()
+
+ for changed_setting_key in changed_setting_keys:
+ validation_state = stack.getProperty(changed_setting_key, "validationState")
+
+ if validation_state is None:
+ definition = cast(SettingDefinition, stack.getSettingDefinition(changed_setting_key))
+ validator_type = SettingDefinition.getValidatorForType(definition.type)
+ if validator_type:
+ validator = validator_type(changed_setting_key)
+ validation_state = validator(stack)
+ if validation_state in (
+ ValidatorState.Exception, ValidatorState.MaximumError, ValidatorState.MinimumError, ValidatorState.Invalid):
+ Logger.log("w", "Setting %s is not valid, but %s. Aborting slicing.", changed_setting_key, validation_state)
return True
Job.yieldThread()
+
return False
## Runs the job that initiates the slicing.
@@ -511,4 +526,3 @@ class StartSliceJob(Job):
relations_set.add(relation.target.key)
self._addRelations(relations_set, relation.target.relations)
-