How to create a pattern type block from Python ?

General discussions and questions.
Post Reply
gmaxera
Posts: 10
Joined: Thu Feb 09, 2017 3:59 pm

How to create a pattern type block from Python ?

Post 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.
User avatar
timurhai
Site Admin
Posts: 916
Joined: Sun Jan 15, 2017 8:40 pm
Location: Russia, Korolev
Contact:

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

Post by timurhai »

There in documentation:
http://cgru.info/afanasy/job#block_command
- left column, blue text color
Timur Hairulin
CGRU 3.3.1, Ubuntu 20.04, 22.04, MS Windows 10 (clients only).
gmaxera
Posts: 10
Joined: Thu Feb 09, 2017 3:59 pm

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

Post 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.
User avatar
timurhai
Site Admin
Posts: 916
Joined: Sun Jan 15, 2017 8:40 pm
Location: Russia, Korolev
Contact:

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

Post by timurhai »

If you copy just 1 more line at top, you should paste here: af.Block.setCommand(str)
Timur Hairulin
CGRU 3.3.1, Ubuntu 20.04, 22.04, MS Windows 10 (clients only).
Post Reply