|
Rex
|
Got it all working great, Dale. Here's what I'm using right now:
--Start Script editChar:ClearOutput(); --Clear the output window
local skel = editChar:GetSkeleton(); local CurBone = editChar:GetSelBone(); if (CurBone:isSet()) then -- if there is a bone currently selected Start_id = CurBone.ID; -- Save the ID in global var Start_id. else Start_id = 0; -- if no bone is selected set Start_id to 0 end -- end if/then statement if Start_id > 0 then --if no bone is selected don't execute the script local mtxLocal = matrix_Array(); local boneMap = BOOL_Array();
BoneID = CurBone.ID; local BoneName = CurBone.Name; skel:BuildLocalTransformList(mtxLocal, boneMap, 256); local WrldX, WrldY, WrldZ = mtxLocal[BoneID].m[12], mtxLocal[BoneID].m[13], mtxLocal[BoneID].m[14]; WrldX =string.format("%.4f", WrldX); --change the 4 in %.4f to 5 if you want 5 decimal places, to 6 for 6 decimal places... WrldY =string.format("%.4f", WrldY); WrldZ =string.format("%.4f", WrldZ); print(BoneName.." Bone: Bind Pose World X = "..WrldX.." Y = "..WrldY.." Z = "..WrldZ); local anim = editChar:GetSelAnimation() --Get current selected animation if (anim:isSet()) then -- if there is an animation currently selected local CurFrame = anim.CurrentFrame; --Get current animiation frame local AnimName = anim.Name; skel:BuildTransformListFrame(CurFrame, anim, mtxLocal, boneMap, 256); local WrldFrmX, WrldFrmY, WrldFrmZ = mtxLocal[BoneID].m[12], mtxLocal[BoneID].m[13], mtxLocal[BoneID].m[14]; WrldFrmX =string.format("%.4f", WrldFrmX); --change the 4 in %.4f to 5 if you want 5 decimal places, to 6 for 6 decimal places... WrldFrmY =string.format("%.4f", WrldFrmY); WrldFrmZ =string.format("%.4f", WrldFrmZ); print(BoneName.." Bone: "..AnimName.." Anim, Frame "..CurFrame..", World X = "..WrldFrmX.." Y = "..WrldFrmY.." Z = "..WrldFrmZ); else print("No Animation selected"); end --end if (anim:isSet()) then else print("No Bone selected"); end --end (if Start_id > 0 then)
--End Script
I limited precision to just 4 places, might bump it up to 6.
Ah...to get a button.
1. Customize User Interface. 2. Bring up Main Toolbar[or where you want the 'hardwireShortcut'] listing. 3. RMB click on Main Toolbar--New--Tool Button--I used a button here, you could use a check/toggle[?] 4. Select new Button[at bottom of list], while holding LMB; move to desired bar location, release LMB. 5. While button is still selected, see Name, Caption, Script in right pane. 6. Navigate to proper script in Tree with click on "..." in Script entry field. 7. Go to script in Customize User Interface to edit Icon entry and Invoke the script to see .ico change, or it should. 8. Done.
Doing those steps put an icon on my Main Tool bar with an icon I chose, along with a Name and Caption. When I want to check a transform, I select a bone and click my button, and the output pane gives my result! Perfect.
|