Animators Forum
Animators Forum
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Anime Studio
 Work In Progress
 Sensitive ''LM_PopupDialog'' for tools or so?
 New Topic  Reply to Topic
 Printer Friendly
Next Page
Author Previous Topic Topic Next Topic
Page: of 3

Ramón López
Starting Member



Spain
49 Posts

Posted - 02/22/2010 :  10:02:16 PM  Show Profile  Visit Ramón López's Homepage  Reply with Quote
Hello thereee ...Well, finally I have decided to start here, hmmm... with a scripting question! Of course...

I'll try to be simple at least, I'm trying to finish a "little" tool to can control almost all layer settings directly by means of top tool options bar and, cause is simply not possible to put all the controls there, I wonder if someone here will have tried to make something like a sensitive LM_PopupDialog by chance, I mean, a dialog that when you click on it, show you a different dialog window depending, in example, in what layer type is active in layers window, etc...

The case is I have still tried all the trial & error combinations have passed through my mind like...


self.dlog1 = LM_TranslateLayerMbDialog:new()
if (moho.layer:LayerType() == MOHO.LT_VECTOR) then
	self.popup = LM.GUI.PopupDialog("...", true, self.DLOG1_BEGIN)
	self.popup:SetDialog(self.dlog1)
elseif (moho.layer:LayerType() == MOHO.LT_PARTICLE)
	self.popup = LM.GUI.PopupDialog("...", true, self.DLOG2_BEGIN)
	self.popup:SetDialog(self.dlog2)

end
layout:AddChild(self.popup)


...with no results but errors and AS crashes , well, that is only a part of an example of my multiple tries omitting all other realted stuff, but at this high I start to imagine that could be simply not possible to give that kind of order at the "DoLayout" function level, but, of course, I could be wrong... and cause of that I ask here, where some of you are well known scripters, just in case you know if that could be possible or not, cause I think it could bring a lot of posibilities to improve and extend AS tools, so... if someone had a clue, thank you very much in advance!

Edited by - Ramón López on 02/22/2010 10:06:38 PM

SynthSin75
Administrator



USA
4402 Posts

Posted - 02/22/2010 :  11:46:40 PM  Show Profile  Visit SynthSin75's Homepage  Reply with Quote
I'm still a bit slow with the GUI stuff. Can you give a test script with working code, and one with the failing? At least that way I can try to help without writing a script for scratch just to do so.

And welcome to the AnimatorForums!
Go to Top of Page

Ramón López
Starting Member



Spain
49 Posts

Posted - 02/23/2010 :  04:47:28 AM  Show Profile  Visit Ramón López's Homepage  Reply with Quote
Thank youuu , well I'm not in front ot AS now but as soon as I can I'll try to prepare a workable/tryable example with, at least, the relevant code, or well, at least I'll try to reproduce the most "workable" steps, casue, as always happens, most of them where overwroted during the "Alt GR + F5" testing proccess... I think that of all the things I tried, the most consistent was the one where the "if ... then" part was inside the Updatewidgets funtion (instead DoLayout), using self.variables to try interchange the info into DoLayout just like the DynamicText() funtion do (or I think so...), so I'll try to move me in that way for now...

Of course I still have a lot to learn, about all this (I'm even hardly trying to make out that self. variables meaning...) but, at least, fighting alone with this script I'm starting to understand how scripting tools structure parts interact ones with others and I'm very happy with this little progreses, but I have just realised that working alone is a very slow way of work... So finally I decided to start to ask again to see the difference! That I'm sure will be noticeable so... thanks again for your interest!

Edited by - Ramón López on 02/23/2010 04:53:39 AM
Go to Top of Page

onionskin
Junior Member



182 Posts

Posted - 02/23/2010 :  1:56:10 PM  Show Profile  Reply with Quote
I am so happy to see that somebody work on "one settings for several layers" script, and to see more scriptwriters here!

Welcome to forum Ramón!
Go to Top of Page

SynthSin75
Administrator



USA
4402 Posts

Posted - 02/23/2010 :  5:16:14 PM  Show Profile  Visit SynthSin75's Homepage  Reply with Quote
self.variable is the same as LM_Scriptname.variable. You'll notice that most scripts have a table near the top like LM_Scriptname = {}. self.variable is using 'variable' as an index of a value in the table. self.variable is the same as self[variable]. If you have a table LM_Scriptname = {variable, value1; variable2, value2}, then self.variable = value1.

All this is basically just an easy way to refer to recurring values across every function in a tool.
Go to Top of Page

Ramón López
Starting Member



Spain
49 Posts

Posted - 03/02/2010 :  3:50:51 PM  Show Profile  Visit Ramón López's Homepage  Reply with Quote
Hey, onionskin I like you like all this thing! And thank you SynthSin75 for that brief but, definitely, more understandable explanation about the "self." issue that the Lua manual one! Well, for me at least, so (if you don't mind) I suppose this won't be my last question here about this kind of doubts

Well, first of all... sorry for the delay, I'm a total hopeless managing time, but that's not the worst thing... I'm almost sure now that there is no way to get something like "sensitive" popup dialogues after all... I mean, I thought that it'd be possible to "deceive" AS in someway but it seems like if it be more clever than me! And it always revenge with a crash Of course, I could probably try to solve the problem in many other ways but, from my point of view, that had been the most effective, you'll see...



As you can see in that screen capture, my tool bar it's almost exceeding (taking into account the "Library" button space) the 1280px limit that I imposed myself at first and, although it's not a problem for me cause I used to work at 1920px, that was a large that I really don't wanted to pass to be consequent with other users. Of course, it's the program developer which should have had into account this possibility when designed AS GUI, who knows if with some kind of double bar, pan, little arrow to access the hidden content, or whatever solution like in any other software, but well... the case is in AS when the elements of the bar exceed the window size, the buttons and widgets simply disappears or worse, start to superimpose one with others in a very disconcerting and unwanted way



And, if I add other [...] popup menu like the last one, or one for the settings of each kind of layer, I'll be limiting the proper use of this tool for users with lower resolution monitors so that's basically the cause I had been so stubborn with the sensitive dialog. I have thinking lately in the possibility of inserting popup menus inside other popup menus, but even if it works, the result could be a little tricky and, of course, several clicks would be necessary to achieve your goal, so it wouldn't have too much sense after all...

As I still have not prepared a file to show only the problem with the sensitive popup dialogs (for some reason this became an uphill struggle), I think I'll directly upload the tool for you can see it and even try it, just in case you have any other idea of suggestions about this or any other issue, so I'll try to prepare the the final file (I still have to solve a little icon paths issue) I've been working with an extra dummy popup dialog added just in case someone wants to experiment. After all, I think that at this point all could start to be prepared to start to receive some feedbacks! Thing that never would occur if I continue experimenting on my own... SO LONG!

Edited by - Ramón López on 03/02/2010 5:06:42 PM
Go to Top of Page

SynthSin75
Administrator



USA
4402 Posts

Posted - 03/02/2010 :  6:29:49 PM  Show Profile  Visit SynthSin75's Homepage  Reply with Quote
if (moho:LayerAsBone(moho.layer):Skeleton():CountBones() == 1) then
        self.lockBone = LM.GUI.CheckBox(MOHO.Localize("/Scripts/Tool/SelectBone/LockBone=Lock bone"), self.LOCK)
	layout:AddChild(self.lockBone)
	end


I just tried this out to test, for myself, how difficult it would be to make dynamic tool options. I added this to the select bone's DoLayout function in the tool options.

This looks like it'd work just fine (and may help solve some of your troubles Ramon). With the above addition, the select bone tool options look normal unless there is only one bone on that bone layer. Then it shows a second 'lock bone' checkbox. When you delete this bone, it automatically grays-out this second checkbox, and if you switch tools it's gone entirely unless only one bone exists.

It may even be possible to make it disappear/reappear by doing this in the UpdateWidgets function, but I haven't tested that.


I'm going to need to do something similar myself eventually, but I have several scripts to do first. If you post (or want to send me a link in a PM) what you have, I'll see if I can manage a better example of how to do this. I don't know about you, but it always helps me to see it in a script I am familiar with.

Of course, if you get this all sorted out, I'm going to have to borrow some of your coding.
Go to Top of Page

Ramón López
Starting Member



Spain
49 Posts

Posted - 03/02/2010 :  8:49:43 PM  Show Profile  Visit Ramón López's Homepage  Reply with Quote
...Uhm? So you have finally glimpsed a chance of hope?? :D Cause I still thought I had tried all that "if ... then" possibilities that passed through my mind without any succes! In this case specially, I declared the variable at the top, with the other "Recurring values":


	-- **************************************************
	-- Recurring values
	-- **************************************************
	
	RL_LostLayerTool.sensitiveDialog = nil


Then I putted this into de "function RL_LostLayerTool:DoLayout(moho, layout)"

	if (sensitiveDialog == 1) then
		self.dlog1 = LM_TranslateLayerMbDialog:new()
		self.popup = LM.GUI.PopupDialog("...", true, self.DLOG1_BEGIN)
		self.popup:SetDialog(self.dlog1)
	elseif (sensitiveDialog == 2) then
		self.dlog2 = LM_TranslateLayerParticleDialog:new()
		self.popup = LM.GUI.PopupDialog("...", true, self.DLOG2_BEGIN)
		self.popup:SetDialog(self.dlog2)
	end


And the follow code into the "function RL_LostLayerTool:UpdateWidgets(moho)" to conmute widgets depending on the selected layer type...

	if (moho.layer:LayerType() == MOHO.LT_VECTOR) then
		sensitiveDialog = 1
	else
		sensitiveDialog = 2
	end


And of course I tried the "UpdateWidgets" and "UpdateUI" functions here and there all the time, but the most far I went with this tries, was making a widget appears and disappears but only if you de-select the tool and re-select it again (as you still mentioned), otherwise it never updated in real-time when you selected one type of layer or another in the layers window and, of course, the widgets must be updated immediately or it wouldn't have too much sense to me... plus, the program almost always crashed when I tried to force to make that kind of changes at the GUI level! Cause of that I still was so hopeless :(, although I easily could have had someting to do with that crashes...

But, of course, I have had into account all the time too that I easily could be overlooking the most elemental things! So maybe you easily could see what is not visible or simply unknown to me, more used to use the trial & error method as you soon (glup!) will see... so please! Take it into account when you glance over my code and try not to laugh too much loud! I still know that lot of things could have been resolved in a more "elegant" way but I simply have not the basis! Plus take into account this is even less than a Pre-alpha! With some inactive features and a horrible icons :), so... you are warned, now you can test it if you want and please, don't get frightened!

http://www.mediafire.com/file/y4zammkmnmn/rl_lost_layer_tool_20100303_0047_pa.zip


PS: BTW, thanks for your help and for any feedback! And... don't you get me wrong, at the same time I like very much some of the features, concepts, and behaviors

Edited by - Ramón López on 03/02/2010 9:08:38 PM
Go to Top of Page

SynthSin75
Administrator



USA
4402 Posts

Posted - 03/02/2010 :  9:15:03 PM  Show Profile  Visit SynthSin75's Homepage  Reply with Quote
quote:
Originally posted by Ramón López




	-- **************************************************
	-- Recurring values
	-- **************************************************
	
	RL_LostLayerTool.sensitiveDialog = nil


Then I putted this into de "function RL_LostLayerTool:DoLayout(moho, layout)"

	if (sensitiveDialog == 1) then
		self.dlog1 = LM_TranslateLayerMbDialog:new()
		self.popup = LM.GUI.PopupDialog("...", true, self.DLOG1_BEGIN)
		self.popup:SetDialog(self.dlog1)
	elseif (sensitiveDialog == 2) then
		self.dlog2 = LM_TranslateLayerParticleDialog:new()
		self.popup = LM.GUI.PopupDialog("...", true, self.DLOG2_BEGIN)
		self.popup:SetDialog(self.dlog2)
	end





In this example, 'RL_LostLayerTool.sensitiveDialog' needs to be referred to as 'self.sensitiveDialog' instead of 'sensitiveDialog'. 'sensitiveDialog' is a different variable.


You may be right about not getting changes to actually disappear without changing tools. I'll look at you script and think about it some more.
Go to Top of Page

Ramón López
Starting Member



Spain
49 Posts

Posted - 03/02/2010 :  9:41:07 PM  Show Profile  Visit Ramón López's Homepage  Reply with Quote
Thank you! And about that lines of code... I have really recover it from a backup that I save for some reason, I think cause it did "something", but I'm not really sure cause to make it works now I should have to do some changes in the icon paths that I wanted to avoid, although now that you say that I think I'll test it just for curiosity. BTW, all that make me think too that I still could not have clear enough that self. concept! So if you or someone could let me know about some specific tutorial different than the Lua manual one, more like a "for dummies one" I'll be very grateful :)

Ufff... now I think I'll go to bed hopping to see some kind of solution in my dreams, that wouldn't be the first time , NIGHT!

Go to Top of Page

SynthSin75
Administrator



USA
4402 Posts

Posted - 03/03/2010 :  12:37:49 AM  Show Profile  Visit SynthSin75's Homepage  Reply with Quote
http://www.lua.org/pil/2.5.html

I really don't know of any 'for dummies' resources, but this will show you how many ways there are to represent a table's index, which is all self.variable really is. Self, which here is the tool's name, is a table constructed by toolname = { }. In any tool, 'self' is always that tool's name.
Go to Top of Page

Wena
Gold Member



United Kingdom
1050 Posts

Posted - 03/03/2010 :  04:17:30 AM  Show Profile  Reply with Quote
I have no aids on lua but I did post on another thread an address of a small book on the subject
"http://www.lua.org/docs.html" hope this might help.

Wena

Edited by - Wena on 03/03/2010 04:18:15 AM
Go to Top of Page

onionskin
Junior Member



182 Posts

Posted - 03/03/2010 :  11:44:39 AM  Show Profile  Reply with Quote
This is great! Ramón my man, awesome job! I love this!
Many thanks to Sinth also!

So many things outside on property bar give me more ideas.
I also work on 1920p so everything is fine by me.

I don't know for what is last popup dialog? After vector.
Go to Top of Page

Ramón López
Starting Member



Spain
49 Posts

Posted - 03/03/2010 :  1:53:24 PM  Show Profile  Visit Ramón López's Homepage  Reply with Quote
Thank you for that links guys! I still knew about some of that resources but it force to me to revise and print some of them, that assures that even if I still don't get the concepts, at least, I'll have it on hand! :) I think I still should have clear some elemental concepts, but I'm doing/learning things as I go along, that force to me to continuously put the cart before the horse, that's never good...

Ey, onionskin! That last dialogue, is only the dummy popup dialogue I was referring above that I'm using in my sensitive dialogue tests, I decided to include it just in case someone wants to experiment with this too or try new ideas or different point of views about the issue, cause as I still said, although I'm a little hopeless about all this, I try to not give up hope until last moment, cause it seems to be more people that I thought at first with very limited resolution monitors... BTW! I love you like it :), as far as I have seen, for your interests (I wanted to mean "inquietudes" in english) you well could be my other self that I always have been looking for! Only you seems to be less "shy" than my, fortunately for you :), jeje... Well! Now I think it's time to my to continue keep going over the issue... THANKS again for your comments!


PS: And don't forget this is still an incomplete job (over all) for testing/suggestion purposes...

Edited by - Ramón López on 03/03/2010 1:54:23 PM
Go to Top of Page

ulrik
Junior Member

Sweden
358 Posts

Posted - 03/04/2010 :  03:10:46 AM  Show Profile  Visit ulrik's Homepage  Reply with Quote
Ramon, this looks fantastic, you must have worked in this for a looooong time? and you share this with us that's very kind of you!
Go to Top of Page

SynthSin75
Administrator



USA
4402 Posts

Posted - 03/05/2010 :  01:11:59 AM  Show Profile  Visit SynthSin75's Homepage  Reply with Quote
Sorry Ramon, I've tried everything I could think of so far, but cannot get it to update the options without changing tools. It appears that the DoLayout function is only evaluated when the tool is initially selected.

I guess the next thing to try would be to put those layer specific settings in pop up dialogs. You should be able to just have a single button on the tool options that calls the dialog for the current layer type.
Go to Top of Page
Page: of 3 Previous Topic Topic Next Topic  
Next Page
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
Animators Forum © Kelleytoons Go To Top Of Page
Powered By: Snitz Forums 2000 Version 3.4.07