Page 1 of 1

How to create a pattern type block from Python ?

Posted: Fri Feb 10, 2017 10:02 am
by gmaxera
Hello,
int the API documentation there is written the following:
Tasks command pattern. When block produces a task it calculates an unique command from this pattern and other parameters, depend on block type - numeric or string, replacing @#@ pattern with a number. Padding is specified by the number of "/" symbols between "@" symbols.
String: block seek for "@#@" string in command and replace it by another string get from Task Command.

Example:

command = myrender some.scene -camera @#@
arguments = ['sun','sky','front','side','bottom']
Result:
1st task command: myrender some.scene -camera sun
2nd task command: myrender some.scene -camera sky
3rd task command: myrender some.scene -camera front
...
But I don't see any way to specify the block type as pattern from Python and where/how to specify the arguments.
I only see af.Block.setNumeric method.
I was expecting something like af.Block.setPattern but there isn't such method.

How can I do it ?

Thanks,
Gianluca.

Re: How to create a pattern type block from Python ?

Posted: Fri Feb 10, 2017 10:42 am
by timurhai
There in documentation:
http://cgru.info/afanasy/job#block_command
- left column, blue text color

Re: How to create a pattern type block from Python ?

Posted: Fri Feb 10, 2017 10:47 am
by gmaxera
Yes, I know.
But I don't see any Python for doing that in to the blue column.
There is only setNumeric.
The documentation I quoted is from that page you linked.

Could you provide a Python snippet code as example ?

Thanks,
Gianluca.

Re: How to create a pattern type block from Python ?

Posted: Fri Feb 10, 2017 12:19 pm
by timurhai
If you copy just 1 more line at top, you should paste here: af.Block.setCommand(str)