How to store more than one custom page in a preset dictionnary

Hi to all, based on Mattew Ragan’s preset managing dictionnary technique I’m trying to find a way to store more than one ‘custom page’ into the ‘custom parametres’ comp’s page itself. I can create them but they’re not seen when I store.

I’ve looked at the ‘Page Class’ and the ‘custom pages’ links on the wiki but nothing helped me much. There is one mention of the custom page in the init Preset Class extension code… :

pageOptions = self.BuildFromOp.eval().customPages
self.SourceParPage.menuNames = pageOptions
self.SourceParPage.menuLabels = pageOptions
print(‘par page called’)

I’ve tried
.customPages[0-2]
.customPages.eval()

but obviously it would have been to easy.
If someone could have a tip on that it would be appreciated.

Thanks all

Hi @metametric - do you have a little example file you can share? I’m not totally sure I’m following what you’re looking to do, but I’m sure there’s a way to make it happen :slight_smile:

Oh Mr. Ragan Hi!
That would be awsome to be able to store and recall all those pars…
I hope It is gonna be more obvious with this tox.
Thank you for your time and all the sharing!

base_preset_dicts.tox (139.5 KB)

and I forgot to put a note to hit key #2 on the keyboard to pulse the network…

@metametric so there are a few changes to think about here.

The preset building from this workshop had a few ideas that it looks like you’ll want to change. One idea here was that you might only want to pull custom pars from a single page. If you want to pull them from many pages you have a few options.

If you wanted to pull all of the custom parameters from an op you could check to see if the par object was custom with the isCustom member.

The sudo code here might be:


for eachPar in op('someOperator').pars():
    if eachPar isCustom:
        #store our op
    else:
        pass

That would capture all custom pars. You might also want to capture pars from just a few pages… in that case you could modify the example so the SourceParPage was a python par type, and input a list of pages you’d like to keep:

image

You’d then need to modify your extension to handle that list of pages:

This would only save pars from the pages you’ve specified in your list.

One other note here is that the handles for creating a menu for you to choose from break - so you’ll need to disable those bits of the extension and parameter execute.

Hope that keeps you moving!

If you’d like some more general ideas about capturing custom pars there’s also an article here:

Thank you very much!
Everything is there this is so great.
Going for the second option seems to be better for me.
A couple more snippets in the code that open other door.
I think I cannot find the menus in the parameter execute def
I commented them in the extension at least for now
I will have a nice week-end I think!

Thanks again!

def onValueChange(par, prev):
# use par.eval() to get current value

if par.name == 'Buildfromop':
	op(me.par.op).UpdateParPageList()
return

It is working like a charm thank you for the advice and great video serie!