DAZ Script (DS4) - Identifying the node that's just been loaded
3dcheapskate
Posts: 2,719
So I've managed to get my Prop Asset DUF to automatically run my DSA script after the prop's loaded...
...but how can I identify the prop that's just been loaded?
I need to select it so I can do stuff with it in my script, but:
- there doesn't seem to be any parameter in the DUF to set the prop as 'selected'.
- there isn't (as far as I can tell) any guaranteed way to identify the node that's just been added (the highest index seems to work, but after you've deleted a few items... ?)
Advice please?
(This is a follow on to "Can I automatically run a DSA script when I load a prop from a DUF/DSF file?")
Comments
A correction and a piece of advice.
In the other thread, you mentioned you used 'maclean's ‘collectNodes()’. The script isn't mine. It was written for me by Richard Haseltine. (Not that you could possibly have known this, but I don't want to steal the credit from Richard).
That leads me to my advice. Over the years, I've had a lot of special requirements in scripting. For example, loading a figure with multiple props with same-name materials, but different textures. Or loading multiple parented figures with same-name materials. And so on. I've paid Richard to figure it all out for me, and it's been worth it. He always comes up with a solution.
So if you're really stuck, contact him and see what he says. Paying someone to deal with the hassle leaves you more time to concentrate on the product, so I reckon it's worth the money.
mac
PS This is no reflection on your scripting ability. You obviously know a lot more than I do.
Node.select( true ) makes Node selected (and Node.select( False ) deselects ). I don't know a guaranteed way to identify the most recent node, however.
Ah, I see Rob did tell you how to get the new node in your other thread.
If you can figure it out yourself, all the better. I'd love to dedicate time to learning scripting, but making content is a full-time occupation, and to be honest, something in my brain doesn't really 'get' code. I wish it did.
Hope you get it worked out.
mac
PS The other day, I happened to be reading up on POVRay and was fascinated to discover that it doesn't use geometry like other 3d programs. You write code for all the objects, cameras, lights, etc. Quite amazing really.
I'm glad you guys found a solution. In forums it is useful to mention the solution you have found so that others can benefit from it.