How to add a macroScript command to a quadmenu in 3dsmax 2025?

How to add a macroScript command to a quadmenu in 3dsmax 2025?

flyingc007
Explorer Explorer
424 Views
1 Reply
Message 1 of 2

How to add a macroScript command to a quadmenu in 3dsmax 2025?

flyingc007
Explorer
Explorer

Hi,guys

Because the old menu system was replaced ,I am trying to use the new one to add my macroscripts to a quadmenu.

But the rhelp document  gives little information and after running  sample codes ,nothing happend.

So how to implement it?

Thanks  in advance

 

0 Likes
425 Views
1 Reply
Reply (1)
Message 2 of 2

flyingc007
Explorer
Explorer

Here is a code I find in the help doc

function quadMenuCallback =
(
    function populateMenuWithManyItems menu =
    (
        -- Add existing actions from autobackup action table
        local autobackupTableId = -889262067
        -- Menu item ids need to be consistent at all times. Other menu customizations might rely on these ids.
        -- However, since this is a demo plugin plugin and we just want some filler content, just generate random ids on every run.
        -- This is not recommended for production code.
        menu.CreateAction (genGUID()) autobackupTableId "0"
        menu.CreateAction (genGUID()) autobackupTableId "1"
        menu.CreateAction (genGUID()) autobackupTableId "2"
        menu.CreateAction (genGUID()) autobackupTableId "3" title:"Custom Title"

        menu.CreateSeparator (genGUID())

        -- Insert dynamic menu defined in mxsDynamicMenuExample.ms
        menu.CreateAction (genGUID()) 647394 "MXS_Demo_Action_Item`Menu Demo Category"
    )

    print "quadMenuCallback"
    local quadMenuMgr = callbacks.notificationParam() 

    local viewportContextId = "ac7c70f8-3f86-4ff5-a510-e4fd6a9c368e" -- from ICuiQuadMenuManager.h
    local viewportContext = quadMenuMgr.GetContextById viewportContextId

    local mxsQuad = viewportContext.CreateQuadMenu "7A021F1D-3AEC-4398-9C84-60E48EE81F83" "Demo Quad Menu MXS"
    -- This will override the existing viewport quad assigned to this right click modifier
    viewportContext.SetRightClickModifiers mxsQuad #shiftAndControlPressed

    local topRightMenu = mxsQuad.CreateMenu "2B5DCB81-E4D5-49B6-B693-2213E594B557" "MXS Top Right Quad" #TopRight
    local bottomLeftMenu = mxsQuad.CreateMenu "EC6FBB46-E450-4F8F-AB13-A4A48A92FAF6" "MXS Bottom Left Quad" #BottomLeft

    PopulateMenuWithManyItems topRightMenu
    PopulateMenuWithManyItems bottomLeftMenu
)
callbacks.removeScripts id:#quadMenuDemo
callbacks.addScript #cuiRegisterQuadMenus quadMenuCallback id:#quadMenuDemo
0 Likes