It is no safer than a direct self-reference, but Maxscript doesn't balk at it.Īs for the workaround you described (referencing the child), this doesn't work as well At least not in what I wanted, same problem, same error. You can create a variable in the script controller pointing to the child (such as a dummy object) and then reference it's parent property in your code to then access the object itself. One trick that might allow you to keep thinking in OOP (mostly), is to reference a child object of the object holding the script controller. I can expand into OOP after learning Maxscript, but you'll actually have to forget some major aspects of it. Your transition will definitely be more frustrating. We're both crossing the same barrier between OOP and Maxscript, but in opposite directions. The OOP approach and the concept of "this" were completely alien to me, but eventually seemed much more logical and direct. However, I've spent the past year expanding into ActionScript from MaxScript (my first scripting/programming language), and i've been trading knowledge constantly with an ace programmer who is just starting to use 3ds Max. All controllers (with the exception of wire controllers) react to other objects this way in 3ds Max.Ī year ago, I would not have even understood what you were talking about. What you described as workarounds are really just the default workflow when using 3ds Max itself. That isn't really a bug.just a major distinction and limitation. Maxscript has never been and will never be an Object Oriented Programming language. It should only throw an error when you're trying to create a dependency loop, not a reference to the object! From an OOP point of view, this could be considered a bug.įrom an OOP point of view, this could be considered a bug.īingo. Yeah, as I said, there are numerous ways to get it working, but I consider those being rather "work-arounds" than actual techniques.ītw: There is a "this" variable, but it only stores the current instance of the object you're accessing the variable from, which doesn't help much unfortunately.īesides, the whole "self-reference" error is actually much deeper than just when used in the script controller's body! For example, I have a function that weak-references the object I need to pass to, let's say, another function, but as soon as I put the function call in the script controller's body, it throws the same error! This is bull*hit in my opinion and should be possible as well as allowed to self-reference. Why not put the script on an unused controller on a dummy? That way both the controlled and controlling objects are easily referenced because they aren't "this" object. Sure, a "This" or a "Self" variable would be nice, but as there isn't this method works acceptably.
0 Comments
Leave a Reply. |