Skip to content

Commit

Permalink
Added batch_number variable in algorithm scope to allow use it in the…
Browse files Browse the repository at this point in the history
… expression editor in Processing batch context
  • Loading branch information
luipir authored and nyalldawson committed Sep 3, 2019
1 parent 2001e0f commit a4b9ef7
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions python/plugins/processing/gui/BatchPanel.py
Expand Up @@ -217,6 +217,9 @@ def populateByExpression(self, adding=False):
for k, v in params.items():
alg_scope.setVariable(k, v, True)

# add batchCount in the alg scope to be used in the expressions. 0 is only an example value
alg_scope.setVariable('batch_number', 0, True)

expression_context.appendScope(alg_scope)

# mark the parameter variables as highlighted for discoverability
Expand Down Expand Up @@ -253,6 +256,9 @@ def populateByExpression(self, adding=False):
for k, v in params.items():
alg_scope.setVariable(k, v, True)

# add batch row number as evaluable variable in algorithm scope
alg_scope.setVariable('batch_number', row, True)

expression_context.appendScope(alg_scope)

# rebuild a new expression every time -- we don't want the expression compiler to replace
Expand Down

0 comments on commit a4b9ef7

Please sign in to comment.