Change Wirecolor on object selected ? //ScriptedModifier//?

Hi !

May I ask you (you, all the MXS masters ;)) some things ?

I want to create a ScriptedModifier which changes the wirecolor of the object when it gets selected.

Is that possible with a ScriptedModifier ?

( Omg, my english is quite bad... :( sorry about that, I hope you can read me..)

Comments

Comment viewing options

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

Done

Hi !

So, the code you gave me works well, after a bit of tweaking I am able to achieve exactly what I wanted.

I'll release the script as soon as Im sure it is clean.

Thanks again miauu :)

benjaminF's picture

Thanks

Hey ! Thanks a lot for the answer, Im at school right now, I'll look at your code when I come back home.

Thanks again.

miauu's picture

You want to change the

You want to change the wirecolor of the object when you select it?
What will be the new color?
Whay you need modifier?

This script will change the wirecolor of selected object.

(
	global rol_ChangeWirecolor
	try(destroyDialog rol_ChangeWirecolor)catch()
	rollout rol_ChangeWirecolor "Change Wirecolor"
	(
		checkButton chkbtn_Do "Start"
 
		function ChangeWirecolorOfSelectedObject =
		(
			if selection.count == 1 do
				selection[1].wirecolor = color (random 0 255) (random 0 255) (random 0 255)
		)
 
		on chkbtn_Do changed theState do
		(
			if theState then
			(
				deleteAllChangeHandlers id:#ChangeWirecolorOfSelectedObjectID
				callbacks.removescripts id:#ChangeWirecolorOfSelectedObjectID			
				callbacks.addscript #selectionSetChanged "rol_ChangeWirecolor.ChangeWirecolorOfSelectedObject()" id:#ChangeWirecolorOfSelectedObjectID	
			)
			else
			(
				deleteAllChangeHandlers id:#ChangeWirecolorOfSelectedObjectID
				callbacks.removescripts id:#ChangeWirecolorOfSelectedObjectID
			)
		)
 
		on rol_ChangeWirecolor close do
		(
			deleteAllChangeHandlers id:#ChangeWirecolorOfSelectedObjectID
			callbacks.removescripts id:#ChangeWirecolorOfSelectedObjectID
		)
	)
	createdialog rol_ChangeWirecolor
)

Comment viewing options

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