PDA

View Full Version : Reference a scripted plugin's transform/name from within it's own body of code


googlo
08-23-2003, 03:45 AM
LIke say you make a simpleobject scripted plugin and would like to know from code within the plugin the name and transformation of itself. Anyone know how to go about doing this?

using 'this' only seems to refernce the custom properties of the object, but not the object itself.

Like saying a=this.name or a=this.transform doesn't give you the tranform or name of the scripted object, it just gives and error that the 'name' and 'transform' are properties for an udefined thing.

And delegate.name or .transform doesn't work because it's not an instance of a pre-existing object like box, sphere, or whatever.

magicm
08-23-2003, 12:07 PM
googlo,

I think you can use refs.dependents to find the actual object.. Excerpt from online reference:

---------------------------------------------------------------
Dependencies
An important internal mechanism in 3ds max defines the dependency relationship between 3ds max objects. For example, a material depends on its various maps, a path controller depends on its percent controller, a scene node depends on its base object, etc. The following method returns the MAXWrapper objects that depend on a specified MAXWrapper object.

refs.dependents <MAXWrapper_object>
---------------------------------------------------------------

I'm not sure if this works for simpleobject plugins, but you could try:
refs.dependents this.


good luck
Martijn

googlo
08-23-2003, 02:01 PM
Magicm,

Do you remember in the movie "Goonies" when Sloth is finally able to reach the tray of vegetables and food from where he is chained up in the basement and he goes ape scat? That's exactly how I felt when (refs.dependents this)[1].transform succesfully returned the transform matrix of the object! :)

Thanks. It also works for finding it's name, amongst a bunch of other things too.

magicm
08-23-2003, 11:33 PM
well last time i saw the goonies is a very loooong time ago

glad it worked for you tho ;)


Martijn

CGTalk Moderation
01-15-2006, 10:00 PM
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.