I'm busy developing a prog for DBv1 that animates .x files. This is my very first version, it is very disorganised and unoptimised, but it works, and explains most of the functions.
`By Kentaree
`Setup Program Environment
Sync On: Sync Rate 60
Backdrop Off: `Allow for Viewing of Text
Set Display Mode 800,600,16
Set Window On : Set Window Size 800,600
TitleBar$ = ProjectTitle$+" "+MajorVersion$+MinorVersion$
Set Window Title TitleBar$
Maximize Window
Set Text Font "Arial"
Set Text Size 20
`Setup Program Variables
KeyFrame=1
`Load Object for Animation and Get Object Data
Load Object "Man2.x",1 : `Load the Model
Color Object 1,RGB(255,255,255)
Rotate Object 1,0,Wrapvalue(-90),0 : `Face the Model to the Right (Might Differ)
Set Object 1,0,1,1 : `Set Object to Wireframe Mode
Autocam Off : `Prevent Camera Automatically Moving Somewhere
Remstart
CamX=Camera Position X()
CamY=Camera Position Y()
CamZ=Camera Position Z()-10
Position Camera CamX, CamY, CamZ
Remend
Perform Checklist For Object Limbs 1 : `Get the Amount of Limbs
LimbAmount = Checklist Quantity() : `Variable = Amount of Limbs
Sync
Remstart
For i = 1 to LimbAmount-2
For o = 1 to LimbAmount-2
Link Limb 1, i, 0
Next o
Next i
Remend
`Main Program Loop
Do
Set Cursor 10, 100: Print "Modelling Mode"
SelLimb = Val(Inkey$()) : `Input from Keyboard = Selected Limb
`As Numbers > 9 are Not Possible from Numberpad, + increases SelectedLimb
If Inkey$() = "+"
Inc OldLimb : `OldLimb = OldLimb + 1
If OldLimb > LimbAmount Then OldLimb = LimbAmount : `If OldLimb > Greater Than Amount of Limbs, Prevent Increase
cls
Endif
`Due To a Bit of Ineffiency in This Code, Only by Using - can LimbAmount be Set Back To Zero
`i.e. Deselect Any Limbs
If Inkey$() = "-"
Dec OldLimb : `OldLimb = OldLimb - 1
If OldLimb < 0 Then OldLimb = 0 : `Prevent OldLimb to Be Less Than 0
cls
Endif
`This Piece of Code Prevents The OldLimb Variable to Jump Back to Zero When No More Button is Pressed
If SelLimb > 0 And SelLimb <= Limbamount And SelLimb <> OldLimb
OldLimb = SelLimb : `Due To Some Bad Variable Naming, OldLimb is the Variable Actually Used Outside Calculations
cls
Endif
`Color The Selected Limb Red
If OldLimb <> Limb THEN Color Limb 1,Limb,RGB(255,255,255) : `If a New Limb is Selected, Color the Last Selected Limb White
If OldLimb > 0 Then Color Limb 1,OldLimb,RGB(255,0,0) : `Color Currently Selected Limb
Limb = OldLimb : `Set Value Of Coloured Limb
`On-Screen Info
Set Cursor 10, 60: Print "Selected Limb: ", OldLimb : `Shows the Value of Currently Selected Limb
Set Cursor 10, 40: Print "Amount of Limbs: ", LimbAmount : `Show the Amount of Limbs
Set Cursor 10, 80: Print "KeyFrame: ", KeyFrame : `Show the KeyFrame You're on
`Limb Rotation
XAngle = Limb Angle X(1,OldLimb) : `Get the X Angle of OldLimb
YAngle = Limb Angle Y(1,OldLimb) : `Get the Y Angle of OldLimb
ZAngle = Limb Angle Z(1,OldLimb) : `Get the Z Angle of OldLimb
If OldLimb > 0 : `Make Sure A Limb is Selected
If OldXAngle <> XAngle OR OldYAngle <> YAngle Then cls : `If There is a Change From Last Time, Refresh Screen
OldXAngle = XAngle
OldYAngle = YAngle
If UpKey()=1 Then Rotate Limb 1, OldLimb, OldXAngle, WrapValue(YAngle + 5), ZAngle : `If User Presses Up, Rotate the Limb Up 5°
If DownKey()=1 Then Rotate Limb 1, OldLimb, OldXAngle, WrapValue(YAngle - 5), ZAngle : `If User Presses Down, Rotate the Limb Down 5°
If LeftKey()=1 Then Rotate Limb 1, OldLimb, WrapValue(XAngle - 5), OldYAngle, ZAngle : `If User Presses Left, Rotate the Limb Left 5°
If RightKey()=1 Then Rotate Limb 1, OldLimb, WrapValue(XAngle + 5), OldYAngle, ZAngle : `If User Presses Right, Rotate the Limb Right 5°
Endif
`KeyFramer
If ControlKey()=1 : `If User Presses Control
Color Limb 1,Limb,RGB(255,255,255) : `No Limb is Highlighted in KeyFrame Mode
Gosub KeyFramer : `Go to Sub KeyFramer
Endif
Sync : `Refresh
Loop : `Repeat This All Over Again
`Sub Animation
KeyFramer:
`Main Loop
cls : `Refresh Screen
Do
Set Cursor 10, 40: Print "Amount of Limbs: ", LimbAmount : `Show the Amount of Limbs
Set Cursor 10, 80: Print "KeyFrame: ", KeyFrame : `Show the KeyFrame You're On
If OldKeyFrame <> KeyFrame Then cls : `If Different From Last Time Then Refresh Screen
Set Cursor 10, 100 : Print "Keyframer"
OldKeyFrame = KeyFrame
`User Controls
KF = Val(Inkey$()) : `Input from Keyboard = Selected Limb
If KF > 0 Then KeyFrame = KF : `Input from Keyboard = KeyFrame
`KeyFrame Controls
If Inkey$()="+" Then Inc KeyFrame : `If User Presses + Then KeyFrame = KeyFrame + 1
If Inkey$()="-" Then Dec KeyFrame : `If User Presses - Then KeyFrame = KeyFrame - 1
If KeyFrame < 1 Then KeyFrame = 1 : `Make Sure KeyFrame is Never Less Than 1
If ReturnKey()=1 Then Set Object KeyFrame 1, KeyFrame : `If User Presses the Return Key, Then Set Keyframe
`Save The Animation
If SpaceKey()=1 :`If User Presses Space
Stop Object 1 :`Stop All Object Animations
Set Cursor 10, 120 : Input "Filename: "; File$ : `Get User To Input Filename
Save Object Animation File$, 1 : `Save Animation Data in File$
Set Cursor 10, 120
Print "File Saved"
Suspend for Key
cls
Endif
`Return To Animation Mode
If ShiftKey()=1
cls
Return
Endif
Sync : `Refresh
Loop
The man2.x file is included somewhere with Darkbasic V1.
Whatever I did I didn't do it!