Notifications
Clear all

[Closed] Set controller on creation of plugin helper

 PEN

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()
			)
		)
	)
)
8 Replies

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

Max 5?? Wow and I thought I was behind with a Max 8 project.

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

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

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?

We have two customers still on R3. We dropped R3 support with v2, of course.

 PEN

R3…Oh my, well it was very stable.

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

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.