Can you create libraries of custom objects for Perspective?

Let’s say that I want to customize the functionality of a standard Perspective button by adding some custom parameters and enabling some Events. This creates my specific button that I can then use over an over again where I need the same functionality (with the result differentiated by the parameters).

The changes I have made are functional and not stylistic, so I can’t abstract them with a Perspective style. So where in general do I store the base copy of my modified button? The only solution I can see is to store it in a view that is never exposed to an actual screen. Whereas what I really want to do is to add my new button type to the list of perspective components.

After writing all that I think what I want is Templates for Perspective. Is that a thing?

Just toss it in a view of its own and use it as an embedded view where you need it. Can go further with project inheritance and then share that further across projects that inherent the project.

How does that work for a button? For example I currently have 12 instances of my modified button that only different by parameter values. It sounds like the only way to make that work is to move the parameters out of the actual button and into the embedded view.

Yes, just bind the parameters you care about to an input binding on the view.

Yes, views with parameters are to Perspective as templates are to Vision. Beware of potential performance issues--though those are hopefully going to be resolved in the future.

1 Like

OK this is making my head spin. Are you saying that if I have a view with parameters, and then reference it it using multiple embedded views, that each reference will have a have it's own separate set of parameters?

Anyway, I'm already 1 deep in embedded views, so this doesn't sound nice:

Never use two nested embedded views.

Also this seems counter to what you are suggesting:

For Items which are simple and use a lot in a project like navigation button, don’t use an embedded view and just put all object in a container and re-use it.

Yes, each embedded view has its own set of parameters (i.e. - adjusting the parameter value of one embedded view instance will not change the parameters in other embedded view instances).

One thing to be careful of at the moment is that adding additional custom parameters to the source view will not automatically add the new parameter to all embedded view instances. There is a feature in the pipeline to make “syncing” these new parameters possible: New parameter added to a view does not propagate to instances of that view in Perspective

Yes, it’s not quite ideal, but it’s what we have :man_shrugging: In some areas we presently have to choose between high performance runtime and efficient engineering. I expect this will improve over time.

1 Like

Sorry for taking this post again after a long time, but it is a bit weird solution, isn it?
So, I have used a button with so many custom. In the future, may be I want to add some feature, and I want to avoid edit each instance of button because of its waste of time. Adding embbeded views to this "root" element, will save me a lot of time, but will not affect in a big way the view performance?
I have a view with 100+ icons, and it takes a few seconds load the view. Adding 100+ embbeded views, will not make it even more slower?

Thank you!