Skip to content

Commit a228929

Browse files
Merge branch 'CURA-4358_buildplate' into 3.0
2 parents fe9a72d + f0e8d26 commit a228929

File tree

2 files changed

+18
-5
lines changed

2 files changed

+18
-5
lines changed

UM/Settings/ContainerStack.py

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ def setDirty(self, dirty: bool) -> None:
196196
# result of evaluating that property with the current stack. If you need the
197197
# actual function, use getRawProperty()
198198
def getProperty(self, key: str, property_name: str, context: Optional[PropertyEvaluationContext] = None):
199-
value = self.getRawProperty(key, property_name)
199+
value = self.getRawProperty(key, property_name, context = context)
200200
if isinstance(value, SettingFunction):
201201
if context is not None:
202202
context.pushContainer(self)
@@ -222,18 +222,28 @@ def getProperty(self, key: str, property_name: str, context: Optional[PropertyEv
222222
# \return The raw property value of the property, or None if not found. Note that
223223
# the value might be a SettingFunction instance.
224224
#
225-
def getRawProperty(self, key, property_name, *, use_next = True, skip_until_container = None):
226-
for container in self._containers:
225+
def getRawProperty(self, key, property_name, *, context: Optional[PropertyEvaluationContext] = None,
226+
use_next = True, skip_until_container = None):
227+
containers = self._containers
228+
if context is not None:
229+
# if context is provided, check if there is any container that needs to be skipped.
230+
start_index = context.context.get("evaluate_from_container_index", 0)
231+
if start_index >= len(self._containers):
232+
return None
233+
containers = self._containers[start_index:]
234+
235+
for container in containers:
227236
if skip_until_container and container.getId() != skip_until_container:
228237
continue #Skip.
229238
skip_until_container = None #When we find the container, stop skipping.
230239

231-
value = container.getProperty(key, property_name)
240+
value = container.getProperty(key, property_name, context)
232241
if value is not None:
233242
return value
234243

235244
if self._next_stack and use_next:
236-
return self._next_stack.getRawProperty(key, property_name, use_next = use_next, skip_until_container = skip_until_container)
245+
return self._next_stack.getRawProperty(key, property_name, context = context,
246+
use_next = use_next, skip_until_container = skip_until_container)
237247
else:
238248
return None
239249

UM/Settings/SettingFunction.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,9 @@ def __call__(self, value_provider: ContainerInterface, context: Optional[Propert
7676
g = {} # type: Dict[str, Any]
7777
g.update(globals())
7878
g.update(self.__operators)
79+
# override operators if there is any in the context
80+
if context is not None:
81+
g.update(context.context.get("override_operators", {}))
7982

8083
try:
8184
return eval(self._compiled, g, locals)

0 commit comments

Comments
 (0)