OnMouseDown, moho.layer, and other topics
Posted: Tue Sep 21, 2010 12:24 am
I beleive it is a common practice to use OnMouseDown as the routine to the functionality into. At least many scripts seem to have this function right under the title "the guts of the script".
Since I can't see anything going on, I use a technique a called 'sound debugging'. I place a 'beep' at locations in the code. If I hear the beep I know it got there, if not... well let's talk about that...
I went into a provided script, Track Layer, and put a Beep in its OnMouseDown. I never hear it. So, either this code isn't ever executed, or during a mouse interrupt one can't use Beep (which I could understand, sound is very interrupt driven itself).
If this is true so much for my 'sound debugging'. Because if I follow the way I see it done (since i have no way of knowing if it can be done another way), I must put my code in OnMouseDown to get a valid 'moho' object... which if I'm right means no beep will ever be heard when in my code.
So my question is... is this the case? OnMouseDown is being called, I just can't hear it with Beep?
NEXT
I noticed these routines in some scripts:
moho.document:PrepMultiUndo()
moho.document:SetDirty()
Does this make it so it becomes part of the UnDo/Redo mechanism (if so, very cool!)? And does SetDirty tell this mechanism a change will be made soon (so it can save a copy first)?
NEXT
By placing my code in DoLayout (as a way of testing it since I can see it IS getting there since it changes the toolbar)... I get a valid 'moho', which I pass to my routine for getting info.
But, I tried mimicking what I saw in other scripts, and use moho.layer for the current layer.
Although it lets me create this, it is always nil for me in my code. At first I tried moho.fLayer, but it too is always nil.
I make sure there is a selected Layer, and I assume what is meant by 'current layer' IS the layer the end-user last selected. I can only assume this.
Well that's my latest batch of hurdles to jump over.... thanks for any help in advance!
Since I can't see anything going on, I use a technique a called 'sound debugging'. I place a 'beep' at locations in the code. If I hear the beep I know it got there, if not... well let's talk about that...
I went into a provided script, Track Layer, and put a Beep in its OnMouseDown. I never hear it. So, either this code isn't ever executed, or during a mouse interrupt one can't use Beep (which I could understand, sound is very interrupt driven itself).
If this is true so much for my 'sound debugging'. Because if I follow the way I see it done (since i have no way of knowing if it can be done another way), I must put my code in OnMouseDown to get a valid 'moho' object... which if I'm right means no beep will ever be heard when in my code.
So my question is... is this the case? OnMouseDown is being called, I just can't hear it with Beep?
NEXT
I noticed these routines in some scripts:
moho.document:PrepMultiUndo()
moho.document:SetDirty()
Does this make it so it becomes part of the UnDo/Redo mechanism (if so, very cool!)? And does SetDirty tell this mechanism a change will be made soon (so it can save a copy first)?
NEXT
By placing my code in DoLayout (as a way of testing it since I can see it IS getting there since it changes the toolbar)... I get a valid 'moho', which I pass to my routine for getting info.
But, I tried mimicking what I saw in other scripts, and use moho.layer for the current layer.
Although it lets me create this, it is always nil for me in my code. At first I tried moho.fLayer, but it too is always nil.
I make sure there is a selected Layer, and I assume what is meant by 'current layer' IS the layer the end-user last selected. I can only assume this.
Well that's my latest batch of hurdles to jump over.... thanks for any help in advance!
