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??
Forum topic · General Scripting
By Poker · 2009-08-17
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??
pacermike · 2009-12-16
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.