10-30-2008, 08:02 AM
it's hard to tell without seeing what you are doing and the script.
is it top secret or paid/covered work or can you post the offending snippet?
10-31-2008, 03:10 AM
Thanks for the Response.
The code I'm using is a mix of my own and some from some tutorials I bought. I don't really want to post code I didn't write, so I'm going to try to narrow down the problem to a smaller section and see if I can clean it up or optimize it a bit. After looking through it a bit, I think I can reduce the large amount of code used in some areas. If I still have problems I will post here again and try to include the problem bits of code.
11-02-2008, 08:14 AM
OK, I've rewritten the main part of the bone generation based on some SDK examples which cuts the amount of code needed in half. I would love to get some feedback on if this can be cleaned up even more to be even more efficient.
This will generate the curve the bones will be aligned to:
SICreateCurve "crvlist", 1, 1
SIAddPointOnCurveAtEnd "crvlist", -5.56400247283325, 15.5115341097636, 4.4254119186418, False, 0
SIAddPointOnCurveAtEnd "crvlist", -7.54199935613224, 15.3638670622132, 2.89084056715819, False, 0
SIAddPointOnCurveAtEnd "crvlist", -9.07458678847619, 14.8604566728363, 3.20805546316486, False, 0
SetValue "crvlist.Name", "R_Arm_Crv"
This will Generate the bones:
Dim oRoot, oArmCrv_1, oGeometry, oPos1, oPos2, oPos3, oChain, oBone2, ort, CurSel, bn2Sel, oEff
'**** Start Timer ****
time_in = timer
set oRoot = application.activeproject.activescene.root
set oArmCrv_1 = oRoot.FindChild(Side & Name & "_Crv")
set oGeometry = oArmCrv_1.activeprimitive.geometry
set oPos1 = oGeometry.Points(0).position
set oPos2 = oGeometry.Points(1).position
set oPos3 = oGeometry.Points(2).position
set oChain = oRoot.Add2DChain( array(oPos1.x,oPos1.y,oPos1.z), array(oPos2.x,oPos2.y,oPos2.z), , view, Side&Name&"_Root" )
Set oBone2 = oChain.AddBone (array(oPos3.x,oPos3.y,oPos3.z), siChainBonePin, Side & Name&"_Bone2")
'**** End timer ****
time_out = timer
logmessage "elapsed time: " & round(time_out - time_in,3)
What I found to take a huge amount of time is renaming the bones.
The code I'm using basically finds the root bone (using oRoot.FindChild()), then finds the neighbor (using SelectNeighborObj)and renames it.
Time without renaming the bones:0.078
Time with renaming the bones:0.506
If anyone know a more efficient way to rename the bones I would realy appreciate it.
11-02-2008, 08:14 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.
vBulletin v3.0.5, Copyright ©2000-2013, Jelsoft Enterprises Ltd.