Jump to content
Hash, Inc. Forums

A custom script examined


robcat2075

Recommended Posts

  • Hash Fellow

Here's some annotation and commentary on a custom TSM2 script

 

My original, unannotated custom finger script is in this post:

 

http://www.hash.com/forums/index.php?s=&am...st&p=273221

 

 

 

but here, I've added comments

 

;like this after the semicolons, this is not allowed in a real TSM2 script.

 

open the "advfinger.mdl" from the Components folder of TSM2 in A:M and follow along as the script refers to the various bones. Be careful not to resave it. It needs to remain in V11 format.

 

hide "advfinger"
hide "advfinger2"
hide "advfinger3"
hide "advfinger4"

 

those were the "metatarsal", first bone, second bone and third bone inthe finger respectively

 

"hide" made all those geometry bones invisible

 

Next, we make our first new control bone, name it and position it

create a bone called "finger control1"  ;  this makes a named bone, TSM will add numbers and "left" or "right" as it repeats this script for separate fingers
with parent the parent of "advfinger" ;this gets the new bone a place in the heirearchy as a child of "hand", which is the parent of the parent of "advfinger"
with start point of "advfinger2";
with end point of "advfinger2";  the bone has the same start and end points as "advfinger2"
with roll of "advfinger2"; and the same roll

 

 

 

 

basically same drill for the next two control bones :

 

create a bone called "finger control2"
with parent "finger control1"; notice that it is child of bone just created
with start point of "advfinger3"
with end point of "advfinger3"
with roll of "advfinger3"

create a bone called "finger control3"
with parent "finger control2"
with start point of "advfinger4"
with end point of "advfinger4"
with roll of "advfinger4"

 

 

 

 

 

Now we can start adding fan bones:

 

	create a bone called "advfinger1fanA"
	with parent "advfinger"; it is a child of that metatarsal bone
	with start point the end of "advfinger" ; it begins at the tip of that bone
	with the rotation of "advfinger" ; it points in the same direction as "advfinger"
	with the length of 3;  why 3?  just a guess, may not be conveniently sized, 
                                           ;but doesn't really matter, the bone will be hidden

that was one fan bone.

 

 

we make two more starting from the same point, but shorter and shorter so all three aren't exactly superimposed:

			create a bone called "advfinger1fanB"
			with parent "advfinger"
			with start point the end of "advfinger"
			with the rotation of "advfinger"
			with the length of 2
			hidden ; this hides the bone, I'm not sure why I didn't do that on the first one

				create a bone called "advfinger1fanC"
					with parent "advfinger"
					with start point the end of "advfinger"
					with the rotation of "advfinger"
					with the length of 1
					hidden

I think I left the first fanbone unhidden so I could click on it in the model window and make the PWS open up to that bone.

I'd manually hide the bone later.

 

 

 

this next section creates similar fan bones on the end of the first finger bone and the end of the second finger bone:

				create a bone called "advfinger2fanA"
				with parent "advfinger2"
				with start point the end of "advfinger2"
				with the rotation of "advfinger2"
				with the length of 3


					create a bone called "advfinger2fanB"
						with parent "advfinger2"
						with start point the end of "advfinger2"
						with the rotation of "advfinger2"
						with the length of 2
						hidden
							create a bone called "advfinger2fanC"
								with parent "advfinger2"
								with start point the end of "advfinger2"
								with the rotation of "advfinger2"
								with the length of 1
								hidden

					create a bone called "advfinger3fanA"
						with parent "advfinger3"
						with start point the end of "advfinger3"
						with the rotation of "advfinger3"
						with the length of 3

							create a bone called "advfinger3fanB"
								with parent "advfinger3"
								with start point the end of "advfinger3"
								with the rotation of "advfinger3"
								with the length of 2
								hidden
									create a bone called "advfinger3fanC"
										with parent "advfinger3"
										with start point the end of "advfinger3"
										with the rotation of "advfinger3"
										with the length of 1
										hidden

The indenting in my script goes unnoticed by TSM2, but it helps me give some visual organization to the script.

 

 

OK, we're done making bones. On to the constraints...

 

 

in on/off pose unprefixed "TSM constraints" ; creates the entry you see in your pose window. 
         ; "unprefixed" means there wont' be a "right" and "left" version of this.
         ; if another script had already created the "TSM Constraints" these new constraints would be added to it
         ; instead of making an additional "TSM Constraints" pose.

orient like constrain "advfinger2" to "finger control1"
orient like constrain "advfinger3" to "finger control2"
orient like constrain "advfinger4" to "finger control3"; those three lines made the geometry bones follow the visible control bones
aim at constrain "advfinger" to "finger control1";  the metatarsal bone isn't directly controlled, it points to the first finger bone and is moved by translating the base of the first finger bone

This section was a bit different from the original TSM2. I abandoned the scheme where the last two bones of the finger are controlled by one bone. Each one has a dedicated control bone now.

 

 

I could have put the fan constraints in TSM2 but decided to keep them separate

in on/off pose unprefixed "finger fans"

compensated orient like constrain "advfinger1fanA" to "advfinger2" ;"compensated" means "use offsets"
at enforcement 70% ; if I didn't use this line the enforcement would be 100%
compensated orient like constrain "advfinger1fanB" to "advfinger1fanA"
at enforcement 60%
compensated orient like constrain "advfinger1fanC" to "advfinger1fanB"
at enforcement 30%

 

I'm not sure why I didn't just constrain those all to "advfinger2" instead of one fanbone to the next. It would have made more sense.

 

 

 

But anyway, we do the same thing for the other fanbone sets...

	compensated orient like constrain "advfinger2fanA" to "advfinger3"
at enforcement 70%
compensated orient like constrain "advfinger2fanB" to "advfinger2fanA"
at enforcement 60%
compensated orient like constrain "advfinger2fanC" to "advfinger2fanB"
at enforcement 30%

compensated orient like constrain "advfinger3fanA" to "advfinger4"
at enforcement 70%
compensated orient like constrain "advfinger3fanB" to "advfinger3fanA"
at enforcement 60%
compensated orient like constrain "advfinger3fanC" to "advfinger3fanB"
at enforcement 30%

 

Even though there wasn't any mention of "right" or "left" or specific finger numbers in this script, TSM2 manages the task of adding those on all the different fingers it creates.

 

 

 

 

 

 

 

When you write your own scripts there are two signs that you have made a mistake:

 

-if you refer to a bonename that doesn't exist (or misspell one) , A:M will crash.

-if you misspell a TSM2 command or even have some stray punctuation mark, TSM2 will stop running the script but give visible sign

You can try to determine where it stopped from what got done and what didn't get done.

 

 

Writing new scripts for TSM2 isn't an official feature and was never recommended or supported by Anzovin, it just happens to be possible to do.

 

Since new scripts need to have an identical name as an existing script, remember to save a copy of your creations in another folder with some additional identifying text in the name.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...