CGTalk > Software > Autodesk Miscellaneous > Autodesk Softimage > XSI: Programming
Login register
Thread Closed share thread « Previous Thread | Next Thread »  
Thread Tools Search this Thread Display Modes
Old 10-29-2008, 03:26 AM   #1
Lord of the posts
Join Date: May 2002
Posts: 1,095
VBS scripting Lag

I'm working on an auto-rig type of script and I'm having trouble with XSI seeming to lag out for a second while running the script. The script is about 300 lines long and takes a few seconds to run and basically creates a skeleton using a guide I created with a different script.

The problem always seems to happen near the end of the script when the screen goes blank for a second and screws up the bone alignment. Rearranging the order the skeleton is being created in doesn't seem to make a difference (other than where the problem happens) and running each section on it's own causes no problems.

Any ideas on how to get around this problem would be appreciated.
Old 10-30-2008, 07:02 AM   #2
ThE_JacO's Avatar
CGSociety Member
Raffaele Fragapane
That Creature Dude
Animal Logic
Sydney, Australia
Join Date: Jul 2002
Posts: 10,954
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?
"As an online CG discussion grows longer, the probability of the topic being shifted to subsidies approaches 1"

Free Maya Nodes
Old 10-31-2008, 02:10 AM   #3
Lord of the posts
Join Date: May 2002
Posts: 1,095
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.
Old 11-02-2008, 08:14 AM   #4
Lord of the posts
Join Date: May 2002
Posts: 1,095
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:

Option Explicit Dim oRoot, oArmCrv_1, oGeometry, oPos1, oPos2, oPos3, oChain, oBone2, ort, CurSel, bn2Sel, oEff Dim time_in,LinearNonInterpolated,Time_Out '**** Start Timer **** time_in = timer Function Create2boneChain(Side,Name,view) 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 Logmessage oPos1.x Logmessage oPos2.x Logmessage oPos3.x 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 Function Create2boneChain "R_","Arm","0" '**** 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.
Old 11-02-2008, 08:14 AM   #5
CGTalk Moderation
CGTalk Forum Leader
Join Date: Sep 2003
Posts: 1,066,478
Thread automatically closed

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.
CGTalk Policy/Legalities
Note that as CGTalk Members, you agree to the terms and conditions of using this website.
Thread Closed share thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Society of Digital Artists

Powered by vBulletin
Copyright 2000 - 2006,
Jelsoft Enterprises Ltd.
Minimize Ads
Forum Jump

All times are GMT. The time now is 08:15 AM.

Powered by vBulletin
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.