Inside Sabertooth
Learn how Sabertooth uses 3ds Max to create 3D interactive projects, including HBO Go’s Game of Thrones interactive experience
  • 1/3
You are here: Forum Home / Autodesk 3ds® Max® / MaxScript / Executing a script when a custom attribute has changed
  RSS 2.0 ATOM  

Executing a script when a custom attribute has changed
Rate this thread
 
63340
 
Permlink of this thread  
avatar
  • KentS
  • Posted: 06 January 2012 07:24 AM
  • Total Posts: 12
  • Joined: 16 March 2011 01:06 PM

I’ve searched for the answer to this as I’m sure it’s easy, but I just don’t think i know how to word the question in the search, as I’m still new to scripting.

I have a dummy with custom attributes in it to control my objects animation.  My objects that are being controlled by the dummy can be on or off depending on what attributes are set in the dummy, (like Cap is on, shirt is off).  I already have a script written that turns on or off objects in the dummy’s hiarchy, that checks drop down boxes and Boolean check boxes.

What I would like to do is when I press a boolean like Shirt is on, I would like it to run the script.  So like a on button click toggle run script.

Thanks for any help.



Replies: 0
avatar

I would suggest putting these custom attributes into the attribute empty modifier on top of your dummy object. That way you can fire off your script functions when toggling the attributes. Plugging Paul Neale as he has already written this up.

http://www.paulneale.com/tutorials/custAttributes/customAttributes.htm



Randall Hess
Senior Technical Animator
THQ, Volition Inc.

Replies: 0
avatar
  • Anubis
  • Posted: 06 January 2012 09:13 AM

ca attributes "Something"
(
    
fn example = (messageBox "xyz")

    
parameters main rollout:params
    
(
        
cap type:#boolean ui:chbxCap default:off

        
on cap set state do
        (
            
format "Cap state changed\n"
            
format "Cur. state is %\n" state
            example
() -- call the local function
        )
    )

    
rollout params "Parameters"
    
(
        
checkbox chbxCap "Cap"
    
)
)


Max 9 through 2009, XP-Pro x64 SP2
ASUS EAH3450 Series (Driver 8.470).
Core 2 Duo E8400 3GHz, 4Gb Ram, DX9.0c.

Replies: 0