Very simple script help please :)

I’d like to create a very simple button so that when I click it, it will change the selected objects properties to be from “By Object” to “By Layer” for its Display Properties, Rendering Control and Motion Blur.

Maybe even if it were a toggle so that it could switch from By Object to By Layer and back again etc, that’d would be great too.

Can someone help me with the script code needed for all of that :slight_smile:

Many thanks.

Does this work for you?

(
    try (destroyDialog sdpRoll);catch()

    global sdpRoll = rollout sdp "Switch Display Props." width:190 height:30
    (
        fn switchProps opt =
        (
            if opt == 1 then state = false else state = true
            for obj in getCurrentSelection() where isProperty obj #displayByLayer and isProperty obj #motionByLayer and isProperty obj #renderByLayer  do
            (
                obj.displayByLayer = obj.motionByLayer = obj.renderByLayer = state
            )
        )
        radiobuttons copyInst pos:[5,5] columns:2 default:0 align:#left labels:#("By Object", "By Layer") offsets:#([15,0], [5,0])
        on copyInst changed opt do switchProps opt
    )
    createdialog ::sdpRoll
)