Crash by a layer script

Discuss Moho bugs (or suspected bugs) with other users. To report bugs to Smith Micro, please visit support.smithmicro.com

Moderators: Víctor Paredes, Belgarath, slowtiger

Post Reply
User avatar
Rasheed
Posts: 2008
Joined: Tue May 17, 2005 8:30 am
Location: The Netherlands

Crash by a layer script

Post by Rasheed »

I tried to create a layer script that dynamically translates a layer inside a bone layer, based on specifically named bones. However, for some reason, the script keeps crashing on me consistently. It could be that I'm asking too much of the layer script, or perhaps (even worse) there is a bug involved.

I have put the relevant files in this zip archive on my .Mac account:

MoveByBoneCrashes.zip (12 KB)

Crash Procedure

The crash occurs both in Anime Studio Pro and Moho 5.3.
  1. Open Anime Studio Pro
  2. Load test.anme
  3. Embed the .lua script in the box layer
  4. Go to any frame other than zero
  5. Select the bone layer
  6. Go to another frame
  7. crash...
The same thing happens if you embed in the circle layer.

The test.anme file has three layers: a bone layer, and two child vector layers, circle and box.

The crash only appears when using MoveByBone.lua and MoveByBoneModded-1.lua, not with MoveByBoneModded-2.lua

If I comment out this piece of code (in lines 70 - 82, as done in MoveByBoneModded-2.lua) the crash does not occur:

Code: Select all

--            moho:SetSelLayer(parent)
--            local skel = moho:Skeleton()
--            local angle = { x = 0, y = 0, z = 0 }
--            if ( bone.x >= 0 ) then
--                angle.x = skel:Bone(bone.x).fAngle - bAng.x
--            end
--            if ( bone.y >= 0 ) then
--                angle.y = skel:Bone(bone.y).fAngle - bAng.y
--            end
--            if ( bone.z >= 0 ) then
--                angle.z = skel:Bone(bone.z).fAngle - bAng.z
--            end
--            moho:SetSelLayer(layer)
If I include the layer selection with the SetSelLayer function (in line 70 and 82, as done in MoveByBoneModded-1.lua), the crash does occur:

Code: Select all

            moho:SetSelLayer(parent)
--            local skel = moho:Skeleton()
--            local angle = { x = 0, y = 0, z = 0 }
--            if ( bone.x >= 0 ) then
--                angle.x = skel:Bone(bone.x).fAngle - bAng.x
--            end
--            if ( bone.y >= 0 ) then
--                angle.y = skel:Bone(bone.y).fAngle - bAng.y
--            end
--            if ( bone.z >= 0 ) then
--                angle.z = skel:Bone(bone.z).fAngle - bAng.z
--            end
            moho:SetSelLayer(layer)
This leads me to think that layer selection is somewhat unstable when used in layer scripts, although I can't rule out that I made a mistake in the script. However, that shouldn't lead to a program crash, should it?

I have also included the crash report with the zip archive.
Post Reply