PDA

View Full Version : Set controller on creation of plugin helper


PEN
04-24-2008, 03:28 PM
Here is the sort of thing that I'm after but this doesn't work. Any one have a solution to this? I have tried using the postCreate handler as well and that fails to.

plugin helper test
name:"test"
classId:#(0x6065b6c9, 0x79283734)
category:"test"
extends: point
(
tool create
(
on mousePoint num do
(
if num==2 then
(
this.controller=transform_script()
)
)
)
)

ZeBoxx2
04-24-2008, 05:15 PM
Hi Paul,

That that point in time, 'this' merely refers to the plugin as created in memory, not to the specific instance you're creating in the scene.

Try:
(refs.dependents this)[1].transform.controller = transform_script()

( This assumes that the first dependent is the node. That's true enough in 3ds Max 5 (which I'm working in atm) but I think may differ in later max versions. )

PEN
04-24-2008, 10:28 PM
Max 5?? Wow and I thought I was behind with a Max 8 project.

Thanks, I'll test it and see what I get.

ZeBoxx2
04-24-2008, 11:00 PM
It forces me to consider the limitations of the lower end of software we support; though there's several features available only in newer versions of max... not going so far as to let older software support hinder progress altogether :)

That said - right now I'm tweaking script files so that they'll work with 3ds Max 4. Oie. Did you know that it doesn't have .width and .height properties for rollouts (and thus dialogs)? There's no renderSceneDialog structure either. Yipe.

Anyway.. </rant>

good luck - scripted plugins of most kinds can be pretty difficult to work with :)

PEN
04-24-2008, 11:31 PM
I have written a pile of scripted plugins but not had to do this. Max 4? common, people can't still be on Max 4....can they?

ZeBoxx2
04-24-2008, 11:40 PM
We have two customers still on R3. We dropped R3 support with v2, of course.

PEN
04-25-2008, 12:08 AM
R3...Oh my, well it was very stable.

magicm
05-21-2008, 12:49 AM
Hi Paul,

I know it's been more than a month since you posted this, but in case you still need it:

on attachedToNode obj do obj.controller = transform_script()
As the name implies, this event (available to all scripted plugins) will get fired whenever a plugin instance is attached to a node (ie. when a scene node is created).

Cheers,
Martijn

PEN
05-21-2008, 12:53 AM
Well thanks. How about that, I would have never tried it as I thought that attached to would be for something like a script modifier only. Thanks.

CGTalk Moderation
05-21-2008, 12:53 AM
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.