Solved -- button instead of tool for run event
Moderators: Víctor Paredes, Belgarath, slowtiger
Solved -- button instead of tool for run event
I'd like to get back the flip layer tool which seems like an easy thing to do except when you have no error checking in AS 6. This is what *doesn't* work:
-- **************************************************
-- Provide Moho with the name of this script object
-- **************************************************
ScriptName = "MK_FlipLayerH"
-- **************************************************
-- General information about this script
-- **************************************************
MK_FlipLayerH = {}
MK_FlipLayerH.BASE_STR = 2085
function MK_FlipLayerH:Name()
return "Flip Layer Horizontally"
end
function MK_FlipLayerH:Version()
return "1.0"
end
function MK_FlipLayerH:Description()
return MOHO.Localize("/Scripts/Tool/TranslateLayer/Description=Flips Layer Horizontally)")
end
function MK_FlipLayerH:Creator()
return "Mike Kelley"
end
function MK_FlipLayerH:UILabel()
return(MOHO.Localize("/Scripts/Tool/TranslateLayer/TranslateLayer=FlipLayerH"))
end
-- **************************************************
-- The guts of this script
-- **************************************************
function MK_FlipLayerH:Run(moho)
local newVal = LM.Vector3:new_local()
local selCount = moho.document:CountSelectedLayers()
moho.document:PrepMultiUndo()
moho.document:SetDirty()
for i = 0, selCount - 1 do
local layer = moho.document:GetSelectedLayer(i)
layer.fFlipH:SetValue(moho.frame + layer:TotalTimingOffset(), not layer.fFlipH.value)
moho:NewKeyframe(CHANNEL_LAYER_FLIP_H)
end
end
which is basically just cut and paste from the old tool and your new way of doing it. But it doesn't do anything and I must be missing something really really stupid here. Please help -- this is a tool I really really need back.
-- **************************************************
-- Provide Moho with the name of this script object
-- **************************************************
ScriptName = "MK_FlipLayerH"
-- **************************************************
-- General information about this script
-- **************************************************
MK_FlipLayerH = {}
MK_FlipLayerH.BASE_STR = 2085
function MK_FlipLayerH:Name()
return "Flip Layer Horizontally"
end
function MK_FlipLayerH:Version()
return "1.0"
end
function MK_FlipLayerH:Description()
return MOHO.Localize("/Scripts/Tool/TranslateLayer/Description=Flips Layer Horizontally)")
end
function MK_FlipLayerH:Creator()
return "Mike Kelley"
end
function MK_FlipLayerH:UILabel()
return(MOHO.Localize("/Scripts/Tool/TranslateLayer/TranslateLayer=FlipLayerH"))
end
-- **************************************************
-- The guts of this script
-- **************************************************
function MK_FlipLayerH:Run(moho)
local newVal = LM.Vector3:new_local()
local selCount = moho.document:CountSelectedLayers()
moho.document:PrepMultiUndo()
moho.document:SetDirty()
for i = 0, selCount - 1 do
local layer = moho.document:GetSelectedLayer(i)
layer.fFlipH:SetValue(moho.frame + layer:TotalTimingOffset(), not layer.fFlipH.value)
moho:NewKeyframe(CHANNEL_LAYER_FLIP_H)
end
end
which is basically just cut and paste from the old tool and your new way of doing it. But it doesn't do anything and I must be missing something really really stupid here. Please help -- this is a tool I really really need back.
Last edited by mkelley on Sun Jun 07, 2009 11:34 pm, edited 1 time in total.
Check you other post about this. It took about a minute to restore the old tools to 6. I included a zip file with the new tools.
http://www.lowrestv.com/anime_studio/as ... uttons.zip
Double posting this stuff isn't necessary.
p.s. Error checking worked fine for me.
-vern
http://www.lowrestv.com/anime_studio/as ... uttons.zip
Double posting this stuff isn't necessary.
p.s. Error checking worked fine for me.
-vern
Thanks, Vern, but this wasn't a double post. I asked in the other thread how to get the functionality back, but THIS thread was about why my code to do so wasn't working (and I still didn't get an answer about that -- are you telling me you get an error when you run this? Because I sure don't and therefore there isn't any error checking available to me).
Basically Mike has merely put the flip layer code inside the layer tools. When that tool is selected the flip layer functionality is built in. It saves on tool palette space. Let me know if you need help with flip points as well. that was also removed from the tool palette.
There is no "new way of doing it". It's just that the code to do it has been moved. Putting the old tools back in worked fine. The only part that needed changing was the "string localization" at the top. that was it.
p.s. On "double posting"... uh... gee I don't know... the subject kind of looked like the exact same "topic" to me. It doesn't say anything about help with the code. It's just another commentary. That is why I call it "double posting".
-vern
There is no "new way of doing it". It's just that the code to do it has been moved. Putting the old tools back in worked fine. The only part that needed changing was the "string localization" at the top. that was it.
p.s. On "double posting"... uh... gee I don't know... the subject kind of looked like the exact same "topic" to me. It doesn't say anything about help with the code. It's just another commentary. That is why I call it "double posting".
-vern
Well, I think you betray your agenda here, Vern.
Once again, you've either purposefully or ignorantly ignored the point of my post. I do appreciate the help with the tools you provided, but that doesn't answer the question I raised here which is why doesn't my code work?
Let me splain this a little clearer since you don't seem to understand -- I need to understand coding if I am to write any other useful tools that you might even want. Simply taking the old tool and modding it is only helpful if in that mod it tells me why my own code doesn't work -- which it does not do (I purposefully did not use the exact code as the old tool because I noted that Mike increased functionality by including all selected layer changing here).
So -- unless you can tell me what's wrong with my code, may I respectfully ask you to shut the fuck up and not post to this thread anymore (once again, I do appreciate your response in that other thread).
Once again, you've either purposefully or ignorantly ignored the point of my post. I do appreciate the help with the tools you provided, but that doesn't answer the question I raised here which is why doesn't my code work?
Let me splain this a little clearer since you don't seem to understand -- I need to understand coding if I am to write any other useful tools that you might even want. Simply taking the old tool and modding it is only helpful if in that mod it tells me why my own code doesn't work -- which it does not do (I purposefully did not use the exact code as the old tool because I noted that Mike increased functionality by including all selected layer changing here).
So -- unless you can tell me what's wrong with my code, may I respectfully ask you to shut the fuck up and not post to this thread anymore (once again, I do appreciate your response in that other thread).
I told you that all I changed was the "localized strings" at the top. I don't even bother with those. I just plug in "raw" text in quotes.
Here's your fixed code. It's basically the same as the original tool in 5.6 but now there is checking for multiple selected layers...
The only change I made was in the localized strings in the ui feed back stuff at the top.
You have an "attitude" mike. Everything you say has a second meaning. Sorry that's just the way it is. Every post has some "jab". Some undercurrent of "how could you do this stupid thing." "Why was this horrible thing done to me". For example this issue regarding the flip tool. It wasn't the disaster you made it out to be. I fixed it for you in less than a few minutes. It took me longer to zip it up and upload it than to actually fix the code.
You aren't capable of just asking for help or advice or guidance or express an opinion about a change or a feature without some unneeded comment about how SM and Mike have "done you wrong". You would get much more feedback and help if you just toned it down a bit.
I keep trying to be "neutral" but It doesn't seem to help. You want me to shut the hell up but you want to say whatever you please.
You accuse me of hidden motives? I have no hidden motives. They are as clear as yours... PROMOTE THE HELL OUT OF ANIME STUDIO!
-vern
Here's your fixed code. It's basically the same as the original tool in 5.6 but now there is checking for multiple selected layers...
The only change I made was in the localized strings in the ui feed back stuff at the top.
Code: Select all
-- **************************************************
-- Provide Moho with the name of this script object
-- **************************************************
ScriptName = "MK_FlipLayerH"
-- **************************************************
-- General information about this script
-- **************************************************
MK_FlipLayerH = {}
MK_FlipLayerH.BASE_STR = 2085
function MK_FlipLayerH:Name()
return "Flip Layer Horizontally"
end
function MK_FlipLayerH:Version()
return "1.0"
end
function MK_FlipLayerH:Description()
return "Flip layers horizontally"
end
function MK_FlipLayerH:Creator()
return "Mike Kelley"
end
function MK_FlipLayerH:UILabel()
return "Flip horizontally"
end
-- **************************************************
-- The guts of this script
-- **************************************************
function MK_FlipLayerH:Run(moho)
local newVal = LM.Vector3:new_local()
local selCount = moho.document:CountSelectedLayers()
moho.document:PrepMultiUndo()
moho.document:SetDirty()
for i = 0, selCount - 1 do
local layer = moho.document:GetSelectedLayer(i)
layer.fFlipH:SetValue(moho.frame + layer:TotalTimingOffset(), not layer.fFlipH.value)
moho:NewKeyframe(CHANNEL_LAYER_FLIP_H)
end
end
You aren't capable of just asking for help or advice or guidance or express an opinion about a change or a feature without some unneeded comment about how SM and Mike have "done you wrong". You would get much more feedback and help if you just toned it down a bit.
I keep trying to be "neutral" but It doesn't seem to help. You want me to shut the hell up but you want to say whatever you please.
You accuse me of hidden motives? I have no hidden motives. They are as clear as yours... PROMOTE THE HELL OUT OF ANIME STUDIO!
-vern
- synthsin75
- Posts: 10280
- Joined: Mon Jan 14, 2008 11:20 pm
- Location: Oklahoma
- Contact:
Re: Mike -- help me restore AS 5.6 functionality
Vern, "doesn't work" is valid. Every newbie that comes here says something doesn't work, and guess what, this time it actually doesn't (lua error reporting, as MC already verified in another post). You need to read what is written in a post instead of what you assume to be some secret, hidden meaning.mkelley wrote:I'd like to get back the flip layer tool which seems like an easy thing to do except when you have no error checking in AS 6. This is what *doesn't* work:
...
which is basically just cut and paste from the old tool and your new way of doing it. But it doesn't do anything and I must be missing something really really stupid here. Please help -- this is a tool I really really need back.
So you've already gotten plenty of experience with fixing old scripts to work in v6. Why the hell would you assume everyone would share that experience? Can't people still make mistakes around here?
It is obvious that you are not trying to remain neutral. If you were, you wouldn't go off on this rant at the barest mention of any little thing wrong with AS. Quit jumping at ghosts.
I can only assume that you'd most like to weed out these AS "upstarts" and have done with it. That's the only reason I can see why you continually want to make a bigger deal out of these things than they actually are.
Well, it's giving me a clue although it still doesn't answer my question.
Apparently there is something about the localize command I don't understand. Mike writes (and it works):
return(MOHO.Localize("/Scripts/Tool/TranslateLayer/TranslateLayer=Translate Layer"))
But when I write (and it doesn't):
return(MOHO.Localize("/Scripts/Tool/FlipLayerH/FlipLayerH=FlipLayerH"))
so there appears to be something in the localization function that I don't understand (actually, there is a LOT in that function I don't understand, not the least is what the heck it does).
In the original (which I posted) I did not change the directories that that command points to, but even with it changed it doesn't work. I'm not sure what it's saying -- that somewhere in that directory is a command called (in this case) FlipLayersH? Because that's not strictly true. Everything about that command is tagged as "LM_TranslateLayer", not just "TranslateLayer". All of which I was trying to do the same thing with my own version.
So -- thanks for narrowing my question down. Now my question is this: how, exactly, do we call the localize command and what is it doing? I'll check with online Lua 5.1 sources to see if I can gain a clue here.
Apparently there is something about the localize command I don't understand. Mike writes (and it works):
return(MOHO.Localize("/Scripts/Tool/TranslateLayer/TranslateLayer=Translate Layer"))
But when I write (and it doesn't):
return(MOHO.Localize("/Scripts/Tool/FlipLayerH/FlipLayerH=FlipLayerH"))
so there appears to be something in the localization function that I don't understand (actually, there is a LOT in that function I don't understand, not the least is what the heck it does).
In the original (which I posted) I did not change the directories that that command points to, but even with it changed it doesn't work. I'm not sure what it's saying -- that somewhere in that directory is a command called (in this case) FlipLayersH? Because that's not strictly true. Everything about that command is tagged as "LM_TranslateLayer", not just "TranslateLayer". All of which I was trying to do the same thing with my own version.
So -- thanks for narrowing my question down. Now my question is this: how, exactly, do we call the localize command and what is it doing? I'll check with online Lua 5.1 sources to see if I can gain a clue here.
Doh!
I can't find *exactly* what localize does, but from reading other Lua type programs it's clear that it's an effort to internationalize the program. So I guess "localize" means "look up in the strings table somewhere and translate if this is another language".
Which, of course, is why my stuff doesn't work -- can't use Localize if those strings aren't in the directory. So at least now I know never to use that.
So thanks, Vern -- in a very roundabout way you gave me the answer I want (namely: NEVER use localize because I can't add strings to what Mike has, so if I use any copy and paste stuff I always need to remove that function).
(And, yes, all of that would have been apparent in two seconds if we had syntax error checking in 6.0. We don't, so all this anguish).
I can't find *exactly* what localize does, but from reading other Lua type programs it's clear that it's an effort to internationalize the program. So I guess "localize" means "look up in the strings table somewhere and translate if this is another language".
Which, of course, is why my stuff doesn't work -- can't use Localize if those strings aren't in the directory. So at least now I know never to use that.
So thanks, Vern -- in a very roundabout way you gave me the answer I want (namely: NEVER use localize because I can't add strings to what Mike has, so if I use any copy and paste stuff I always need to remove that function).
(And, yes, all of that would have been apparent in two seconds if we had syntax error checking in 6.0. We don't, so all this anguish).
Sigh. No, that still doesn't work for me.
Vern, let me get you straight here -- I took the code you just posted (just cut and paste it, really) and used it and it STILL doesn't work for me.
Okay -- so I took the tool you zipped up (sent me), put it in the scripts/tool directory (along with the png) edited the toolbar and, yes, I do see it, but it doesn't work either.
So... neither the tool I wrote nor the one you did work in my version of AS 6.0 Pro demo. Could someone please try this with the demo to see if I'm not the only one? (I'm off to try it on another machine but I have to install the demo on that machine first).
Just to be clear -- the icon shows up (based on my past experience with AS 6 scripting so far, that does mean the script at least compiled more or less properly) but pressing on it does nothing other than change the info bar above the working window -- doesn't flip anything, and doesn't add any keys no matter what frame I'm on.
Vern, let me get you straight here -- I took the code you just posted (just cut and paste it, really) and used it and it STILL doesn't work for me.
Okay -- so I took the tool you zipped up (sent me), put it in the scripts/tool directory (along with the png) edited the toolbar and, yes, I do see it, but it doesn't work either.
So... neither the tool I wrote nor the one you did work in my version of AS 6.0 Pro demo. Could someone please try this with the demo to see if I'm not the only one? (I'm off to try it on another machine but I have to install the demo on that machine first).
Just to be clear -- the icon shows up (based on my past experience with AS 6 scripting so far, that does mean the script at least compiled more or less properly) but pressing on it does nothing other than change the info bar above the working window -- doesn't flip anything, and doesn't add any keys no matter what frame I'm on.
Okay, now I'm *trying* not to post this in two places (in the other thread, though, it appeared as if Greykid was either using or going to use the script you provided, so I asked them a question there). I won't post to that other thread unless someone directly asks me a question.
I've tried your code now on three different machines -- still no go. The icon shows up, and it's definitely doing *something* which is to say the status bar above the work area changes to show the icon for the tool as well as the text description of "flip layer") but it does NOT flip layers.
Since I assume it IS working for you Vern there apparently is a difference between the build you have and my build OR there is something about it being a trial that prevents this (the latter I'm skeptical because it DOES correctly process my inherit transforms tool -- it's not as if the demo doesn't allow custom scripting).
Vern -- can you at least bring this to Mike's attention via email? I know he's extremely busy, and if this is just a case of "it will be solved when you get your serial number this week" or a case of "here's the download version you really need to have" then I'm not worried. But otherwise I'm nervous (sorry, but this is a tool I really need to have -- I didn't go into too much detail, but in the past I had this assigned a hot key so I can use my shuttle to control animation, that's how much I use it. I can't do that with the present setup at all which is a HUGE change for my workflow).
I've tried your code now on three different machines -- still no go. The icon shows up, and it's definitely doing *something* which is to say the status bar above the work area changes to show the icon for the tool as well as the text description of "flip layer") but it does NOT flip layers.
Since I assume it IS working for you Vern there apparently is a difference between the build you have and my build OR there is something about it being a trial that prevents this (the latter I'm skeptical because it DOES correctly process my inherit transforms tool -- it's not as if the demo doesn't allow custom scripting).
Vern -- can you at least bring this to Mike's attention via email? I know he's extremely busy, and if this is just a case of "it will be solved when you get your serial number this week" or a case of "here's the download version you really need to have" then I'm not worried. But otherwise I'm nervous (sorry, but this is a tool I really need to have -- I didn't go into too much detail, but in the past I had this assigned a hot key so I can use my shuttle to control animation, that's how much I use it. I can't do that with the present setup at all which is a HUGE change for my workflow).
I don't know what the localize functions do either. I have NEVER known what they do. Some magical fiddly thing within Moho, AS, AS 6. It's always been there in every version and I've always ignored it and used "strings" in quotes.
All these are are those "pop up" tool tips when you hover over the button or tool, or the text that appears at the top of the document when a tool selected. The text strings have NO EFFECT ON THE FUNCTION of the tool. You don't need them for the tool to work.
-vern
All these are are those "pop up" tool tips when you hover over the button or tool, or the text that appears at the top of the document when a tool selected. The text strings have NO EFFECT ON THE FUNCTION of the tool. You don't need them for the tool to work.
-vern