LoginSignup
0
0

シェルフ登録

Last updated at Posted at 2024-04-10

シェルフ作成mel

{ // global化対策
    // ボタン作成Proc
    proc createShelfButton(string $labelName, string $image, string $command, string $doubleClickCommand, string $labelList[]){
        if(!stringArrayContains($labelName, $labelList)){
            shelfButton
                -label $labelName
                -annotation $labelName
                -image $image
                -command $command
                -doubleClickCommand $doubleClickCommand
                ;
        }
    }
    
    string $newShelfName = "Kohaku_DagMenu";
    if(!`shelfLayout -exists $newShelfName`){
        addNewShelfTab $newShelfName;
    }
    string $shelfButtonName[] = `shelfLayout -q -childArray $newShelfName`;
    string $labelList[], $labelName, $command;
    for($name in $shelfButtonName){
        $labelName = `shelfButton -q -label $name`;
        appendStringArray($labelList, {$labelName}, 1);
    }
    
    setParent $newShelfName;
    
    $labelName = uiRes("m_commonSelectOptionsPopup.kClearSelect");
    createShelfButton($labelName, $image = "commandButton.png", $command = "select -clear", $doubleClickCommand = "", $labelList);
    
    $labelName = uiRes("m_defaultRunTimeCommands.kDeselectLbl");
    createShelfButton($labelName, $image = "commandButton.png", $command = "SelectNone;", $doubleClickCommand = "", $labelList);
    
    $labelName = uiRes("m_defaultRunTimeCommands.kEnableSelectToolLbl");
    createShelfButton($labelName, $image = "aselect.png", $command = "SelectTool", $doubleClickCommand = "SelectTool; ToolSettingsWindow", $labelList);
    
    $labelName = uiRes("m_createModelPanelMenu.kFrameSelectionWithoutChildren");
    createShelfButton($labelName, $image = "commandButton.png", $command = "fitPanel -selectedNoChildren", $doubleClickCommand = "", $labelList);

    $labelName = uiRes("s_TtumbleContextStrings.rTumbleToolName");
    createShelfButton($labelName, $image = "tumble.png", $command = "TumbleTool", $doubleClickCommand = "TumbleTool; ToolSettingsWindow", $labelList);

    $labelName = uiRes("s_TtrackContextStrings.rTrackToolName");
    createShelfButton($labelName, $image = "track.png", $command = "TrackTool", $doubleClickCommand = "TrackTool; ToolSettingsWindow", $labelList);
    
    $labelName = uiRes("m_defaultRunTimeCommands.kMoveToolLbl");
    createShelfButton($labelName, $image = "move_M.png", $command = "MoveTool", $doubleClickCommand = "MoveToolOptions", $labelList);

    $labelName = uiRes("m_createModelPanelMenu.kIsolateSelect");
    $command
        = "// Kohaku_dagMenuCheckBoxFlg:Start\n"
        + "proc int isolateSelectFlg(){\n"
        + "    string $currentView = `getPanel -withFocus`;\n"
        + "    return `isolateSelect -q -state $currentView`;\n"
        + "}\n"
        + "isolateSelectFlg;\n"
        + "// Kohaku_dagMenuCheckBoxFlg:End\n"
        + "ToggleIsolateSelect;"
        ;

    createShelfButton($labelName, $image = "commandButton.png", $command, $doubleClickCommand = "", $labelList);
}
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0