ScriptSpot home

Forum topic · General Scripting

extract maxscript from attribute holder

By Gspoutnik · 2011-02-03

Description

Hello maxscript friend's
I would like to know if it's possible to "extract" maxscript from custom attribute for refine or re-edit it.
i do a lot of rigs with maxscript custom attribute but i don't know how tweaks them when i want to reused them i new projet.
All i know is how to rebuild all from scratch...

Thank's !!!

Comments (3)
Panayot Karabakalov

If you know the name of your CAs and its owner, just use custAttributes.getDef
Lets say you have CA named "camControls" and it added to the top modifier...

-- example CA:
ca = attributes camControls ( ... )

-- added to top modifier:
custAttributes.add $.modifiers[1] ca

-- so, get the def back:
ca = custAttributes.getDef $.modifiers[1].camControls
-- and redefine:
attributes camControls redefine:ca
(
	-- new contens here...
)
Reply to Panayot Karabakalov
tronotrond

I'm wondering about the same thing

I have the same issue as the original poster and I'm not sure if I understand your solution, Anubis. I'm fairly new to maxscript so that's probably why. ;)

I got the original Custom Attribute code extracted. It consists of several sliders in one Custom_Attributes rollout. I want to look up the sliders already there and adjust the width and alignment of them - without breaking any wire parameters that I've added earlier.

The reason I want to do this is to add a "Set Key" button to the right of each slider. I can code this from scratch, but I can't figure out how to modify the old code..
I have several rigs I want to do this with, so automating this with a script would save me tons of time.

Any help is highly appreciated :)

Reply to tronotrond
Panayot Karabakalov

I'm sure you'll do this more quickly by hand
than making a script to automatize it.

Lets say you have something like...

slider s1 "S1..." range:[-30,30,0]
slider s2 "S2..." range:[-30,30,0]

...and the editing w'd been...

slider s1 "S1..." range:[-30,30,0] width:110 across:2
button b1 "A" width:20 align:#right
slider s2 "S2..." range:[-30,30,0] width:110 across:2
button b2 "A" width:20 align:#right

Also s'd add events to this buttons:

on b1 pressed do (...)