Skip to content

Commit

Permalink
Add Transform operator
Browse files Browse the repository at this point in the history
  • Loading branch information
satoruhiga committed Dec 19, 2019
1 parent 73ee26e commit 5114fd2
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 0 deletions.
Binary file modified ShaderBuilder.tox
Binary file not shown.
Binary file modified example.toe
Binary file not shown.
23 changes: 23 additions & 0 deletions src/Expression.py
@@ -0,0 +1,23 @@
def onCook(scriptOp):
scriptOp.copy(scriptOp.inputs[0])

args = {}
co = op.ShaderBuilder.Context()

for i in range(1, len(scriptOp.inputs)):
s = scriptOp.inputs[i].text
k = 'in%i' % i

if not s:
args[k] = ''
continue

c = op.ShaderBuilder.Context.fromJson(s)
args[k] = c.expression
co.update(c)

exp = scriptOp.inputs[0].text
co.expression = exp.format(**args)

scriptOp.text = co.toJson()
scriptOp.store('output', co.expression)

0 comments on commit 5114fd2

Please sign in to comment.