Create palette in a new slot with Web API

Discussion and chat related to developing interfaces to the Titan software using the web API.

Moderator: Moderators

iaguilera
Posts: 8
Joined: 19 Apr 2024, 09:28

Create palette in a new slot with Web API

Postby iaguilera » 09 Jul 2024, 11:42

Hello

How can create a palette in an empty slot with Web API?

I have find that I can create the palette with the API
http://[ip]:4430/titan/script/2/Palette/StoreMenu/StoreOnButton?group={string}&index={titanId}

But this API only seems to work with port 4431.

¿What's the right way to do it with other APIs using the standard por 4430?

Thanks!
User avatar
Gregory
Posts: 1350
Joined: 14 Dec 2007, 15:25
Location: London, United Kingdom
Contact:

Re: Create palette in a new slot with Web API

Postby Gregory » 09 Jul 2024, 16:53

From what I can tell it appears that the StoreOnButton function is expecting various properties to be initialised which would normally happen when the record palette menu is opened on the console (specifically via the EnterMenu function). Thus if using the WebAPI interface which is part of the main interface (i.e. port 4431) as long as the Store Palette menu has been entered at some point there is a chance of it working, the regular WebAPI interface (port 4430) essentially operates separately to the main UI so it will never have entered the menu.

The main property that needs to be set prior to calling StoreOnButton is CurrentPaletteNumber, this needs to be set to a user number that is not currently in use. This can be done using the following command:
http://localhost:4430/titan/script/2/Handles/SetProperty/UserNumber?propertyId=Palette.CurrentPaletteNumber&userNumber=2

Once a palette is successfully recorded the CurrentPaletteNumber will be automatically incremented to the next available user number so from that point onwards it should not be necessary to set it again.
iaguilera
Posts: 8
Joined: 19 Apr 2024, 09:28

Re: Create palette in a new slot with Web API

Postby iaguilera » 09 Jul 2024, 19:12

Thanks Gregory!

To get a non used user number, I could get all the palettes handles, so then I have all palettes user numbers, and then choose one that is not in this list? Is this right?
iaguilera
Posts: 8
Joined: 19 Apr 2024, 09:28

Re: Create palette in a new slot with Web API

Postby iaguilera » 10 Jul 2024, 09:18

Sorry Gregory

I have tried to set CurrentPaletteNumber as you said, and after that use the StoreOnButton but it didn't create a palette.

Maybe I have to set any other property?

Thanks
iaguilera
Posts: 8
Joined: 19 Apr 2024, 09:28

Re: Create palette in a new slot with Web API

Postby iaguilera » 10 Jul 2024, 09:23

Sorry, it worked!!!! Of course I have to select some fixtures and make changes in attributes before setting user number and executing StoreOnButton.

It works fine, thanks a lot Gregory :-)
icke_siegen
Posts: 1122
Joined: 02 Jul 2010, 10:29
Location: Siegen, Germany
Contact:

Re: Create palette in a new slot with Web API

Postby icke_siegen » 10 Jul 2024, 12:14

Would you mind sharing your code here? May I post it in the wiki?
iaguilera
Posts: 8
Joined: 19 Apr 2024, 09:28

Re: Create palette in a new slot with Web API

Postby iaguilera » 11 Jul 2024, 11:42

Not a problem I have made a very simple html/javascript example, where you can load groups and fixtures in the UI, select some of them, change pan and tilt, and then create a position palette on a free slot.

You must follow that sequence of steps. The example is very simple.

I don't know how to attach here the files with the code, you can download with this link:
https://drive.google.com/file/d/1L-ffDB ... sp=sharing
icke_siegen
Posts: 1122
Joined: 02 Jul 2010, 10:29
Location: Siegen, Germany
Contact:

Re: Create palette in a new slot with Web API

Postby icke_siegen » 11 Jul 2024, 21:24

WOOOOOOOW - this is really neat. Thanks a lot! And I love this clean and readable programming!

May I post this in the wiki? This will take a time, and of course I will let you know, you can check, alter or completely have it removed. But this is really a proper example.
iaguilera
Posts: 8
Joined: 19 Apr 2024, 09:28

Re: Create palette in a new slot with Web API

Postby iaguilera » 12 Jul 2024, 07:54

Yes of course, you can post it in the wiki if you like it, of course.

Who is online

Users browsing this forum: No registered users and 1 guest