Page 1 of 1

Is there possiblity how to get from custom menu to painter?

Posted: 05 Aug 2017, 18:31
by adamkooo2
Is there possiblity how to get from custom menu to painter? Or other things that we have access from menu. I think yes, Nadeo has done it in their MP4 titles. Can you give us the action name? In docs there are only few actions.

Isn't it something like

Code: Select all

editors_paint
?


Thanks :thx:

Re: Is there possiblity how to get from custom menu to painter?

Posted: 07 Aug 2017, 10:09
by Qlex
Hi,

The documentation regarding class CTitleFlow generally gives you all these tools :

https://maniaplanet.github.io/maniascri ... _flow.html

In your example :

Code: Select all

TitleFlow.EditSkins();
Should work :)

Hope that helps!

Re: Is there possiblity how to get from custom menu to painter?

Posted: 07 Aug 2017, 17:47
by adamkooo2
Qlex wrote: 07 Aug 2017, 10:09 Hi,

The documentation regarding class CTitleFlow generally gives you all these tools :

https://maniaplanet.github.io/maniascri ... _flow.html

In your example :

Code: Select all

TitleFlow.EditSkins();
Should work :)

Hope that helps!
Thank you very much!!! :thx:
That was thing I needed a long time :thumbsup:

Re: Is there possiblity how to get from custom menu to painter?

Posted: 12 Aug 2017, 18:29
by adamkooo2
Qlex wrote: 07 Aug 2017, 10:09 Hope that helps!
Just

Code: Select all

TitleFlow.EditSkins();
doesn't work, I had to declare CTitleFlow

I have created test menu manialink with default buttons and added my paint button
After some time of trying, I've got this:
Image


Can you tell me where I am wrong please?
I will try to get it working

Re: Is there possiblity how to get from custom menu to painter?

Posted: 12 Aug 2017, 19:30
by zocka
I expect you to have the context CManiaAppTitle (https://maniaplanet.github.io/maniascri ... title.html) which should have to property TitleFlow so you would call
TitleFlow.EditSkins();
(In the screenshot you missed the () as well)
Maybe this helps

Re: Is there possiblity how to get from custom menu to painter?

Posted: 12 Aug 2017, 19:36
by adamkooo2
zocka wrote: 12 Aug 2017, 19:30 I expect you to have the context CManiaAppTitle (https://maniaplanet.github.io/maniascri ... title.html) which should have to property TitleFlow so you would call
TitleFlow.EditSkins();
(In the screenshot you missed the () as well)
Maybe this helps
Thanks, I've tried it. In ML editor it shows no errors, but after click on my paint button in my menu it shows this:

Code: Select all

ERR [8, 15] Invalid access to parameter (Null object or elem not found in array) : >EditSkins
	media::Main() [8, 15]
EDIT: Same happens if I try other class members, I've tried:

Code: Select all

TitleFlow.PlayMap("A01", "", ""); 

Re: Is there possiblity how to get from custom menu to painter?

Posted: 12 Aug 2017, 21:00
by zocka
[I haden't done anything with titlepacks before so this might not be the best way to do things]

I created a main-script, which I set as menu in the titlepack xml (/maniaplanet_title/menu/manialink) looking like this:

Code: Select all

#RequireContext CManiaAppTitle

#Const ScriptName "Menu.Script.txt"

Text MainView() {
	return """
	<manialink version="3">
		<label text="skins" scriptaction="openeditor'skins"/>
	</manialink>
	""";
}

main() {
	declare Layer = UILayerCreate();
	Layer.ManialinkPage = MainView();
	while(True) {
		yield;
		foreach (Event in PendingEvents) {
			if (Event.Type == CManiaAppEvent::EType::LayerCustomEvent) {
				if (Event.CustomEventType == "openeditor") {
					switch (Event.CustomEventData[0]) {
						case "skins": {
							TitleFlow.EditSkins();
						}
					}
				}
			}
		}
	}
}
This does what I understand is what you want to achieve. Again I don't know if there are better ways to handle such events rather than catching every little thing in the parent app.

Re: Is there possiblity how to get from custom menu to painter?

Posted: 13 Aug 2017, 09:08
by adamkooo2
Thank you, it works! :thx:
Now, I will try some experiments with the code :mrgreen: