微信公众号 小红书 抖音 B站
小黑屋 渝ICP备2023015870号-1
网信算备88888888号
生成式人工智能服务管理暂行办法
备案号:88888888-20240226
首页 插件专区 Max插件 显示 pieMenu 馅饼菜单 【源码备份】
pieMenu 馅饼菜单 【源码备份】
查看 22 下载 1 收藏 纠错
  • 应用平台: Windows 7 , Windows 8 , Windows 10 , Windows 11
  • 软件支持: 32位/64位
  • 界面语言: 英语

global pieMenu_Tool
global pieMenu_Settings
struct pieMenu_Settings
(
    start_pos                = [0,0],
    slice_amount        = 0.0,
    counter                        = 0,
    labels                        = #("index_1", "index_2", "index_3", "index_4", "index_5", "index_6", "index_7", "index_8"),
    selected                = 0,
    radius                        = 100,
    threshold                = 200,
    color_unsel         = (color 197 197 197),
        color_box                = (color 17 17 17),
    fn drawLabels        = for i = 1 to labels.count do                -- get the point on a circle around the mouse position
    (
                gw.setTransform(Matrix3 1)
                local x = ((Sin (slice_amount * i)) * radius + start_pos.x) -- center text
                local y = -(Cos (slice_amount * i)) * radius + start_pos.y
                local cbox = (box2 (x - 64) (y-18) 96 97)
                cbox.w = 130
                cbox.h=20
                gw.wrect cbox color_box
                        print i
                gw.wText [x-(gw.getTextExtent labels).x *0.5,y,00] labels color:color_unsel
    ),
    fn update =
    (
        local curr_pos = start_pos - mouse.pos
                local s = slice_amount as integer
        local curr_degree = ((atan2 curr_pos.x -curr_pos.y) + 180) as integer
                curr_degree = mod ((curr_degree+(s/2))/s*s) 360        -- round off the angle
        for i = 1 to labels.count do
                (
                        if curr_degree == slice_amount*(i-1)  then
                                selected = i
                        if (distance start_pos mouse.pos) > threshold then
                                stopTool pieMenu_Tool
                )
        drawLabels()
        gw.enlargeUpdateRect #whole
        gw.updateScreen()
    ),
    fn start =
    (
        unRegisterRedrawViewsCallback update
        registerRedrawViewsCallback update
        selected = 0
        start_pos = mouse.pos
        slice_amount = 360.0/labels.count
        update()
    ),
    fn error =
    (
        if (pieMenu_Settings.labels.count < 2) or (pieMenu_Settings.labels.count > 8) then
                (
            messageBox ("pieMenu_Settings() only supports 2 - 8 labels!")
                        return true
                )
        else for i in pieMenu_Settings.labels do
                        if classOf i != String then
                        (
                                messageBox ("pieMenu_Settings() One of the pieMenu_Settings.labels is not of class 'string'")
                                return true
                        )
        return false
    ),
    fn Run =
        (
                if (not pieMenu_Settings.error()) then
                (
                        startTool pieMenu_Tool numPoints:1  --start tool
                        completeRedraw() -- clear any artifacts left over from drawing the text
                )
                pieMenu_Settings.selected
        )
)
tool pieMenu_Tool
(
    on start do
        pieMenu_Settings.start()
        on stop do
                unRegisterRedrawViewsCallback pieMenu_Settings.update
    on freeMove do
        pieMenu_Settings.update()
    on mousePoint clickno do
                stopTool pieMenu_Tool
    on mouseAbort clickno do
    (
                selected = #aborted
                stopTool pieMenu_Tool
        )
)
pieMenu_Settings = pieMenu_Settings()

发表评论
  • 顺带评个分
提交
  • 834544123 在线客服

  • 周一至周五:9:00-21:00

    周末及节日:9:00-18:00

  • QQ&微信:
    834544123
    QQ群:
    16538234