Getting Source Code

Hey...

New to the forum, and scripting. I wanna learn some more and trying to decipher others scripting.

But how do you get the source code of a script in an attribute holder??

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
pacermike's picture

Yeah, I wanted to know the

Yeah, I wanted to know the same thing! With some help I got it figured out though so thought I'd share.
First you have to find out the definition of the custom attribute, so you need to run the .getDefs property:

custAttributes.getDefs $.modifiers[#Attribute_Holder]

For me, this got in to the selected object's Attribute Holder modifier.
Which returned this array:

#(<AttributeDef:LeftEye>)

So my definition is LeftEye. Now you use .getDef with .getDefSource and it should return the source.

def = custAttributes.getDef $.modifiers[#Attribute_Holder].LeftEye
custAttributes.getDefSource def

And ka-BAM! It barfs out the source code.

There's probably a more eloquent way to do this but I'm a noob so the fact that I got it to do anything at all made me dance a little.

Hope that helps somebody.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.