TACTIC Open Source
Creating Plugins from templates - Printable Version

+- TACTIC Open Source (http://forum.southpawtech.com)
+-- Forum: TACTIC Open Source (http://forum.southpawtech.com/forumdisplay.php?fid=3)
+--- Forum: TACTIC Discussion (http://forum.southpawtech.com/forumdisplay.php?fid=4)
+--- Thread: Creating Plugins from templates (/showthread.php?tid=222)

Pages: 1 2

Creating Plugins from templates - Nachogor - 06-30-2021

Hi guys!

We are definetly moving to 4.8, so we are polishing our templates into plugins and we have some questions! Excuse if they are too basic.

1. How can we define the Code name of each pipeline to use the {project} as part of the name or be able to autogenerate a number code after the name, something like PP_Planos_0854? If we leave it blanc the name autogenerates as PIPELINE####, but then it`s hard when using the Column "Pipeline Code" to understand which pipeline are we selecting (because all are named PIPELINE0854, PIPELINE0855, etc...) If we just leave PP_Planos as code each project overwrites the previous.

2. Any recommendations about Namespaces when using Plugins?

3. When Columns are thinner than their content all the columns after that one are offseted to their Column Title. Is there anyway to have the title and content behave in the same way? Image attached.

Thanks very much!!!!

RE: Creating Plugins from templates - remkonoteboom - 06-30-2021

There is a project setting:

key = "code_prefix"

and make sure the search_type is filled out for your search_type (in this case sthpw/pipeline).

You can set the value to be whatever you wish. If you enclose the value with parenthesis, you can include an expression:

value = {project.code}

This should give you what you want.

There is also another setting "code_format" which if set to random will make the generated code have a randomly generated alphanumeric key. This is useful if you really don't care what the code is and you need to merge is with other data sets. PIPELINE001 for example could likely clash with another plugin, while a 10 digit random code will not. If this form is set to an integer, it will pad the number by that many digits (instead of the default 5).

Hope this helps.

RE: Creating Plugins from templates - remkonoteboom - 06-30-2021

To answer the question about namespaces, if these are your own search_types, I would just choose one that is common to all projects (as you have done). It just ensures that your search types don't collide with anybody elses, but it's really just a string so you can use anything. I personally would avoid using a namespace as the project because search_types always get scoped by the current project.

For example, we have vfx/shot that can used in any project. The fully scoped project search_type is vfx/shot?project=my_project so if you do ever need to do a search to another project, you can always explicitly put in the project in the search type:

search = Search("vfx/shot?project=my_second_project")

RE: Creating Plugins from templates - Nachogor - 06-30-2021

Awesome answers remkonoteboom!!!! Both are exactly what I needed!

RE: Creating Plugins from templates - Nachogor - 07-01-2021

Thanks remkonoteboom!

I tried with no success. Is the attached image correct if I want to have the prefix in the pipelines?

RE: Creating Plugins from templates - Nachogor - 07-02-2021

My bad, wrong image attached in the previous email.

With Project Settings as seen in the attach  I have 2 problems:

ACTIVATING a plugin uses Code without Prefix when the plugin creates all the Pipelines. All the codes starting with PP_
CREATING a Pipeline from + it does use the prefix, but it uses {project.code} as a string instead of a variable as seen in the purple pipelines in the 2nd image attached.


RE: Creating Plugins from templates - remkonoteboom - 07-05-2021

Had to dig into the code to see what was happening ...

So, my mistake. You have to put in a full expression:


I tried it out on my instance and it worked.

RE: Creating Plugins from templates - Nachogor - 07-05-2021

Thanks remkonoteboom! I used as you mentioned and it works ok when I create a new item with the + (Add New Item) where pipeline_co is ProjectName####, but when I create a Pipelines with the plugin the pipeline_code is the name without prefix: in the pipeline definition below for example is "PP_Assets3D"

#-- Start Entry --#
insert = SearchType.create('sthpw/pipeline')
insert.set_value('code', """PP_Assets3D""")
insert.set_value('data', """{"node_index": 4}""")
insert.set_value('description', """Pipeline Assets 3D""")
insert.set_value('name', """PP_Asset3D""")
insert.set_value('pipeline', """<pipeline>

Would it be possible to do something like this?

insert.set_value('code', {@GET(project.code)} + """PP_Assets3D""")

Cheers and thanks again!

RE: Creating Plugins from templates - remkonoteboom - 07-06-2021

I think it might be because your creation is for "sthpw/pipeline":

insert = SearchType.create('sthpw/pipeline')

but your setting is for "config/pipeline". Long ago, pipelines were thought to be used across multiple projects (which they may be) and were put in the "sthpw" database. This was before the "config" search types existed, which are project specific. I did try to move pipelines to be in the project database at one point, but it was more invasive that I had time for at the time.

So, we are stuck at the moment with "sthpw/pipeline".

RE: Creating Plugins from templates - Nachogor - 07-06-2021

I tried both Stypes (sthpw/pipeline and config/pipeline) in the project preferences but none worked.

key code.prefix
value {@GET(project.code)}
search type sthpw/pipeline
type which one should I use?

and in the plugin
insert = SearchType.create('sthpw/pipeline')
insert.set_value('code', """PP_Assets3D""")

should work? If not can I try to code a rename function inside the pipeline from within the pipeline.spt file?