Scripted Plugin, Spinners, and Auto Key problem

Hi. I consider myself to be a noob as far as maxscript goes. I did a couple of scripts for my 3d artist at my studio, but maxscript docs still confuse me.

Here's what I'm doing. I'm writing a scripted Helper plugin (at least thats what the docs call it) that extends the Dummy class.

I create the parameters, and a rollout with spinners. What I'm trying to achieve is to be able to animate the Spinners, so they move the objects created in the Tool Create method.

It all seems to work, however when I do so and take a look at the Track View, I see that the spinners have keyframes, but since my 3d artist is using Auto Key a lot, the objects that get moved with the spinners also get the keyframes.

I removed the leyframes from the objects to see if the spinners will still move them, but they don't, eventhough the spinners still have keyframes.

What am I missing here? It's probably some "on" event. At this point I'm only using "on changed". Even if that's it, I still have a problem of "additional keyframes".

Thank you for your time guys. Below you will find a sample code that behaves exactly as I described.

Everything up to THIS point is the most important for me and I could really use some help. Anhything that follows is just me being curious. So...

1) Is it possible to "cast" the properties of the object created in the Tool Create into my own rollout?
2) How can I make it so that no matter which object of the ones created in the Tool Crearte gets selected I will always see my rollout (in the modify panel of course)?
3) How can I make it so that if one of the created objects gets deleted, all of them will be deleated as well?


Sample code.
Once you Evaluate it, it will appear in the Helpers section of the Create tab under Standard category.

plugin Helper TestHelper
	name:"Example" ;
	classID:#(0x2f560483, 0x589c0d0a);
	local thisObj, gBox
	tool create 
		on mousePoint click do 
			thisObj = $;
			gBox = Box();
			delegate.boxsize = [10,10,10];
			gBox.parent = thisObj;
	parameters pParams rollout:params
		XPos type:#float animatable:true ui:XPos default:0.0
	rollout params "Simple Camera Rig"
		Spinner XPos "X:" range:[-1e9, 1e9, 0]
		on XPos changed val do 		(	in coordsys parent gBox.pos = [val,0,0]	)


I really hope someone can help me solve this.
Thanks in advance.


Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
explorer-pl's picture

Ok. Solved the main issue

I was right. The use of any "on" statements was a bad approach.
I simply liked the Spinner with a paramWire to the controller.

explorer-pl's picture


I tried to loose the "on change" event on the spinner and link the spinner controller to the controller for the box position, but I couldn't make it work as well. Maybe I'm approaching the problem from the wrong angle. Guys... Help please.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.