Search found 107 matches

by lehtiniemi
Mon Mar 21, 2016 12:33 pm
Forum: Scripting
Topic: Saving tool button states when switching between tools?
Replies: 3
Views: 1648

Re: Saving tool button states when switching between tools?

yes. load and save prefs for example function HS_Real_Time:SavePrefs(prefs) self.useIK = prefs:GetBool("HS_Real_Time.useIK", true) self.boneFBF = prefs:GetBool("HS_Real_Time.boneFBF", false) end function HS_Real_Time:LoadPrefs(prefs) prefs:SetBool("HS_Real_Time.useIK",...
by lehtiniemi
Mon Mar 21, 2016 11:40 am
Forum: Scripting
Topic: Saving tool button states when switching between tools?
Replies: 3
Views: 1648

Saving tool button states when switching between tools?

When I have for example a checkbox in my tool top bar, its value gets reset when I switch to another tool and back.

Is it possible to save this state so that the value stays the same even if I switch to other tools inbetween?
by lehtiniemi
Mon Mar 21, 2016 12:19 am
Forum: Scripting
Topic: Copying/moving keyframes within the same layer channel?
Replies: 17
Views: 5710

Re: Copying/moving keyframes within the same layer channel?

Ooh thanks! The animestudioscripting.com didn't have this, but then again, it says there it's for version 10. (or if it did, then I missed this) Thanks again!
synthsin75 wrote:Get key interpolation:

Code: Select all

	local Interp = 0
	local ch = moho.layer.fTranslation
	ch:GetKeyInterp(moho.frame, Interp)
by lehtiniemi
Sun Mar 20, 2016 11:31 pm
Forum: Scripting
Topic: Script for lip sync I'm working on
Replies: 52
Views: 30091

Re: Script for lip sync I'm working on

Oh btw, did you ever update the script with the consonant-length-thingy you mentioned somewhere earlier?
by lehtiniemi
Sun Mar 20, 2016 11:09 pm
Forum: Scripting
Topic: Copying/moving keyframes within the same layer channel?
Replies: 17
Views: 5710

Copying/moving keyframes within the same layer channel?

I thought I'd write a tool to easily cut and insert "time" so that you could drag the tool and add/remove the corresponding amount of frames. This means moving around keyframes. Is there a way to do this easily? The current scripting interface doesn't provide a way to read the interpolatio...
by lehtiniemi
Sun Mar 20, 2016 8:50 pm
Forum: Scripting
Topic: Getting position for bone that's moved by other bones
Replies: 7
Views: 2425

Re: Getting position for bone that's moved by other bones

Anyone who looks for answer to this, here's how you do it. This function returns the position of the bone in the current layer coordinates. If you want global coordinates, there's a change in the Transform-sentence at the end, just switch from GetLayerTransform to GetFullTransform and add moho.docum...
by lehtiniemi
Sun Mar 20, 2016 8:47 pm
Forum: Scripting
Topic: Coordinates of the tip of the bone
Replies: 20
Views: 5058

Re: Coordinates of the tip of the bone

Thanks! Got it to work now, here's the resulting script: http://www.lostmarble.com/forum/viewtopic.php?f=12&t=29029 My biggest mistake, however was that I went through the fMovedMatrix recursively. You only need to read the fMovedMatrix from the first parent. That matrix includes all the transfo...
by lehtiniemi
Sun Mar 20, 2016 8:26 pm
Forum: Scripting
Topic: Walk tool BETA
Replies: 0
Views: 1946

Walk tool BETA

Hey! Here's a BETA version of a tool that I wrote. This makes it incredibly fast to attach walk cycles to floor. You load a walk cycle, then give this tool heel/toe bone to follow and it moves the Bone layer to counter the bone base movement. Result is that the bone appears to be locked during the s...
by lehtiniemi
Fri Mar 18, 2016 11:00 pm
Forum: Scripting
Topic: Coordinates of the tip of the bone
Replies: 20
Views: 5058

Re: Coordinates of the tip of the bone

I'm trying to use the coordinates of the bone to move the same Bone layer accordingly in opposite direction so that the bone tip appears to stay still ok so you want to translate the bone layer? (and not move the camera?) and it's all in just the x/y plane? This is correct. Well, it would be a plus...
by lehtiniemi
Fri Mar 18, 2016 10:44 pm
Forum: Scripting
Topic: Two scripts for you: "Maintain pose" and "Toggle visibility"
Replies: 24
Views: 8070

Re: Two scripts for you: "Maintain pose" and "Toggle visibil

Here's code that gets both next and last keyframe (point motion here), whether the current frame is keyed or not: local pos = 1 local neg = -1 local frame = moho.frame local ch = moho.layer:Channel(2, 1, moho.document) if (ch:GetKeyWhen(ch:GetClosestKeyID(frame)) ~= frame) then neg = 0 end local ne...
by lehtiniemi
Fri Mar 18, 2016 3:20 pm
Forum: Scripting
Topic: Coordinates of the tip of the bone
Replies: 20
Views: 5058

Re: Coordinates of the tip of the bone

this is why I said what I said about frames of reference. where in the hierarchy is the layer in which you want to use the calculated coordinates? e.g. Bone <-- calculate here >vector Group >vector <-- use here? fPos as stored is not changed when the layer / camera transforms change but the place o...
by lehtiniemi
Fri Mar 18, 2016 2:01 pm
Forum: Scripting
Topic: Coordinates of the tip of the bone
Replies: 20
Views: 5058

Re: Coordinates of the tip of the bone

Try this... ... this will give "world" coordinates of the tip in the same transform space as the bone -- IOW the vector layer in which the coordinates will be at the tip needs to be a child of the bone layer. By using your code and mixing it with another example I found, I'm now so far th...
by lehtiniemi
Fri Mar 18, 2016 12:58 pm
Forum: Scripting
Topic: Coordinates of the tip of the bone
Replies: 20
Views: 5058

Re: Coordinates of the tip of the bone

Try this... local i local vec = LM.Vector2:new_local() local tip = LM.Vector2:new_local() local angle, scale local bone, boneId local parent local pAngle boneId = moho:Skeleton():BoneID(bone) vec:Set(bone.fPos) angle = bone.fAngle length = bone.fLength scale = bone.fScale parent = bone.fParent pAng...
by lehtiniemi
Fri Mar 18, 2016 12:11 pm
Forum: Scripting
Topic: Getting position for bone that's moved by other bones
Replies: 7
Views: 2425

Re: Getting position for bone that's moved by other bones

Temporarily select the frame, get the .fPos, and select the original frame again. Thanks for the idea! I tried this, but this doesn't return the absolute position of the bone either. It also only returns values if the bone is animated with keyframes: for i = newStartFrame, newEndFrame do moho:SetCu...
by lehtiniemi
Fri Mar 18, 2016 4:03 am
Forum: Scripting
Topic: Getting position for bone that's moved by other bones
Replies: 7
Views: 2425

Re: Getting position for bone that's moved by other bones

Here's modified code that I found on the forum. It should do something like what I'm trying to achieve: when you give it bone and atFrame, it should calculate the position of the bone at that frame. But bone base coordinates (vec1) doesn't seem to return anything and bone tip (vec2) coordinates are ...