This commit is contained in:
2025-11-23 23:31:18 +08:00
parent d60cdc52fd
commit 9f7667a475
710 changed files with 252869 additions and 6 deletions

View File

@@ -0,0 +1,2 @@
//Switch the camera of current actived 3d view to persp camera.
MGP_SetActiveViewCamera "persp"; //change the camera string to switch to that camera.

View File

@@ -0,0 +1,4 @@
//get attribute float array value. Only works when you query attributes like .translate, .rotate, .scale, etc.
//Input the objectName.attribute without its namespace, the namespace will be replaced by the namespace of picker:
//Error will occur if there is no such object or attribute.
float $theAttVs[] = `MGP_GetAttributeFloatValueArray_ViaPickerNamespace "objNameWithoutNamespace.attr"`;

View File

@@ -0,0 +1,4 @@
//get a attribute float value.
//Input the objectName.attribute without its namespace, the namespace will be replaced by the namespace of picker:
//Error will occur if there is no such object or attribute.
float $theAttV = `MGP_GetAttributeFloatValue_ViaPickerNamespace "objNameWithoutNamespace.attr"`;

View File

@@ -0,0 +1,5 @@
//Get currently attribute button's maya attribute:
//if the attribute is not linked to a maya attribute, this will return empty string.
//the return attribute string is of format: [ns:]nodeName.attributeName.
//0 for no namespace, 1 for has namespace.
string $objDotAttr = `MGP_GetCurrentAttributeButton_Attribute 0`;

View File

@@ -0,0 +1 @@
string $currentPickerDir = `MGP_GetCurrentPickerDirectory`; //get the dierctory path of current picker file.

View File

@@ -0,0 +1 @@
string $currentPickerFileOrNode = `MGP_GetCurrentPickerFileOrNode`; //get the full path of current picker file or the picker node name.

View File

@@ -0,0 +1,4 @@
//get current mouse interactiving picker item name:
//When you want to change the item itself within its script type property, such as color or position, use this to query its id.
string $currentPickerItem = `MGP_GetCurrentInteractiveItem`;

View File

@@ -0,0 +1 @@
string $currentPickerNamespace = `MGP_GetCurrentPickerNamespace`; //get the namespace of current picker file/node.

View File

@@ -0,0 +1 @@
MGP_CancelIsolation; //Cancel the isolation for currently activated model view.

View File

@@ -0,0 +1 @@
MGP_IsolateSelectedObjects; //Isolat selected objects for currently activated model view.

View File

@@ -0,0 +1 @@
MGP_IsolateSelectedRig; //Isolate selected objects' whole rigs for currently activated model view.

View File

@@ -0,0 +1 @@
float $fillColor[] = `MGPickerItem -q -fillColor ""`; //To-Do: input the button id string to get the fill color of it.

View File

@@ -0,0 +1 @@
string $label = `MGPickerItem -q -label ""`; //To-Do: input the button id string to get the label of it.

View File

@@ -0,0 +1 @@
float $labelColor[] = `MGPickerItem -q -labelColor ""`; //To-Do: input the button id string to get the label color of it.

View File

@@ -0,0 +1 @@
float $opacity = `MGPickerItem -q -opacity ""`; //To-Do: input the button id string to get the opacity of it.

View File

@@ -0,0 +1,3 @@
//To-Do: input the button id string to get the 2D position of it:
int $x = `MGPickerItem -q -x ""`;
int $y = `MGPickerItem -q -y ""`;

View File

@@ -0,0 +1,3 @@
//To-Do: input the button id string to get the size of it:
int $width = `MGPickerItem -q -width ""`;
int $height = `MGPickerItem -q -height ""`;

View File

@@ -0,0 +1 @@
float $valueColor[] = `MGPickerItem -q -valueColor ""`; //To-Do: input the button id string to get the value color of it.

View File

@@ -0,0 +1 @@
int $visible = `MGPickerItem -q -visible ""`; //To-Do: input the button id string to get the visibility of it.

View File

@@ -0,0 +1,15 @@
//To-Do: hardcode this button id. The id won't not changed once it is created.
string $pickerButtonID = "";
//below the full edit flags are listed, feel free to remove unwanted lines.
MGPickerItem -e //with/without -e is the same;
-visible 1 //set the visibility of the button;
-label "" //set the label of the button,repace the string with your desired label string;
-x 0 //set the x position of your button;
-y 0 //set the y position of your button;
-w 20 //set the width of your button;
-h 20 //set the height of your button;
-fillColor 1 0 0 1 //set the fill color of your button;
-labelColor 0 0 0 1 //set the label color of your button;
-valueColor 1 1 1 1 //set the value color of your button. only make sense when it is a attribute button;
-opacity 1 //set the opacity of your button, you could also set this through the last parameter of "-fillColor" flag;
$pickerButtonID;

View File

@@ -0,0 +1 @@
MG_SetKeyframeNonDefaultChannels; //Set keyframs at current frame, only on those channels are of non-default values.

View File

@@ -0,0 +1,3 @@
//Popup a prompt dialog, which user could input a frame count to keyframe object at this each frame count.
//arg: 0 for each keytick, 1 for each certain frames.
MGP_SetKeyframeEachKeyOrGap 1;

View File

@@ -0,0 +1,3 @@
//Set keyframe each keytick via time range control.The ensure each selected object all have keys at same frames:
//arg: 0 for each keytick, 1 for each certain frames.
MGP_SetKeyframeEachKeyOrGap 0;

View File

@@ -0,0 +1 @@
MGP_SetKeyframeForOnlyKeyframed; //Set keyframe only if the attribute is already keyframed.

View File

@@ -0,0 +1,3 @@
//Reactivate the model view, so animators could have access to the hotkeys features of Maya, such as set keys,etc.
//but ususually you don't need to do so, cos MG-Picker in animator interactive mode does so automatically after each mouse left mouse button clicking.
MGP_ReactiveModelViewport;

View File

@@ -0,0 +1 @@
MGP_MirrorSelection 1; //Add Mirrored objects into selection via current picker panel's mirror relationship.

View File

@@ -0,0 +1,3 @@
//Add all selectButton & Slider members of current picker panel to scene selection.
//The int arg stands for the selection mode, 0 for replace selection,1 for add selection, 2 for remove selection, 3 for invert selection.
MGP_EvalPanelAllSelectButtons 1;

View File

@@ -0,0 +1,3 @@
//Add all selectButton & Slider members of current picker to scene selection:
//The int arg stands for the selection mode, 0 for replace selection,1 for add selection, 2 for remove selection, 3 for invert selection.
MGP_EvalPickerAllSelectButtons 1;

View File

@@ -0,0 +1,3 @@
//Deselect all selectButton & Slider members of current picker panel from scene selection.
//The int arg stands for the selection mode, 0 for replace selection,1 for add selection, 2 for remove selection, 3 for invert selection.
MGP_EvalPanelAllSelectButtons 2;

View File

@@ -0,0 +1,3 @@
//Deselect all selectButton & Slider members of current picker from scene selection.
//The int arg stands for the selection mode, 0 for replace selection,1 for add selection, 2 for remove selection, 3 for invert selection.
MGP_EvalPickerAllSelectButtons 2;

View File

@@ -0,0 +1,3 @@
//Toggle all selectButton & Slider members selection states of current picker panel.
//The int arg stands for the selection mode, 0 for replace selection,1 for add selection, 2 for remove selection, 3 for invert selection.
MGP_EvalPanelAllSelectButtons 3;

View File

@@ -0,0 +1,3 @@
//Toggle all selectButton & Slider members selection states of current picker.
//The int arg stands for the selection mode, 0 for replace selection,1 for add selection, 2 for remove selection, 3 for invert selection.
MGP_EvalPickerAllSelectButtons 3;

View File

@@ -0,0 +1 @@
MGP_MirrorSelection 0; //Mirror selection via current picker panel's mirror relationship.

View File

@@ -0,0 +1,3 @@
//Select all selectButton & Slider members of current picker panel.
//The int arg stands for the selection mode, 0 for replace selection,1 for add selection, 2 for remove selection, 3 for invert selection.
MGP_EvalPanelAllSelectButtons 0;

View File

@@ -0,0 +1,4 @@
//Select all selectButton & Slider members of the picker panel with the panel index.
//The first int arg stands for the selection mode, 0 for replace selection,1 for add selection, 2 for remove selection, 3 for invert selection.
//the second int arg stands for the target picker panel index.
MGP_EvalPanelAllSelectButtons_viaPanelIndex 0 0;

View File

@@ -0,0 +1,3 @@
//Select all selectButton & Slider members of current picker.
//The int arg stands for the selection mode, 0 for replace selection,1 for add selection, 2 for remove selection, 3 for invert selection.
MGP_EvalPickerAllSelectButtons 0;

View File

@@ -0,0 +1,3 @@
//set a attribute with a value. Input the objectName.attribute without its namespace, the namespace will be replaced by the namespace of picker:
//Error will occur if there is no such object or attribute.
MGP_SetAttributeViaPickerNamespace "objNameWithoutNamespace.attr" 0;

View File

@@ -0,0 +1 @@
MGP_SetCurrentPickerNamespace ""; //To-Do: replace the "" with your namespace to set current picker namespace.

View File

@@ -0,0 +1,2 @@
//pop up set namespace ui:
MGP_SetCurrentPickerNamespace_WithUI;

View File

@@ -0,0 +1 @@
MGP_GoToPanel 0; //To-Do: replace the int with the target panel index, 0 is usually the first panel.

View File

@@ -0,0 +1,5 @@
# Switch the camera of current actived 3d view to persp camera.
import maya.mel as mel
mel.eval('MGP_SetActiveViewCamera "persp"')
# To-Do: replace the string with the camera name you wanna switch to.

View File

@@ -0,0 +1,7 @@
# Get currently interactive attribute button's maya attribute:
# if the attribute is not linked to a maya attribute, this will return empty string.
# the return attribute string is of format: nodeName.attributeName.
# argument: 0 for no namespace, 1 for has namespace.
import maya.mel as mel
attribute = mel.eval("MGP_GetCurrentAttributeButton_Attribute 0")

View File

@@ -0,0 +1,4 @@
# get the dierctory path of current picker file.
import maya.mel as mel
pickerDir = mel.eval("MGP_GetCurrentPickerDirectory")

View File

@@ -0,0 +1,4 @@
# get the full path of current picker file/node.
import maya.mel as mel
pickerFileOrNode = mel.eval("MGP_GetCurrentPickerFileOrNode")

View File

@@ -0,0 +1,4 @@
# get the namespace of current picker file.
import maya.mel as mel
currentPickerNamespace = mel.eval("MGP_GetCurrentPickerNamespace")

View File

@@ -0,0 +1,4 @@
# Cancel the isolation for currently activated model view.
import maya.mel as mel
mel.eval("MGP_CancelIsolation")

View File

@@ -0,0 +1,4 @@
# Isolate selected objects for currently activated model view.
import maya.mel as mel
mel.eval("MGP_IsolateSelectedObjects")

View File

@@ -0,0 +1,4 @@
# Isolate selected objects' whole rigs for currently activated model view.
import maya.mel as mel
mel.eval("MGP_IsolateSelectedRig")

View File

@@ -0,0 +1,4 @@
# Set keyframs at current frame, only on those channels are of non-default values.
import maya.mel as mel
mel.eval("MG_SetKeyframeNonDefaultChannels")

View File

@@ -0,0 +1,6 @@
# Popup a prompt dialog, which user could input a frame count to keyframe object at this each frame count.
import maya.mel as mel
mel.eval(
"MGP_SetKeyframeEachKeyOrGap 1"
) # arg: 0 for each keytick, 1 for each certain frames.

View File

@@ -0,0 +1,6 @@
# Set keyframe each keytick via time range control.The ensure each selected object all have keys at same frames.
import maya.mel as mel
mel.eval(
"MGP_SetKeyframeEachKeyOrGap 0"
) # arg: 0 for each keytick, 1 for each certain frames.

View File

@@ -0,0 +1,4 @@
# Set keyframe only if the attribute is already keyframed.
import maya.mel as mel
mel.eval("MGP_SetKeyframeForOnlyKeyframed")

View File

@@ -0,0 +1,5 @@
# Reactivate the model view, so animators could have access to the hotkeys features of Maya, such as set keys,etc.
# but ususually you don't need to do so, cos MG-Picker in animator interactive mode does so automatically after each mouse left mouse button clicking.
import maya.mel as mel
mel.eval("MGP_ReactiveModelViewport")

View File

@@ -0,0 +1,6 @@
# Add Mirrored objects into selection via current picker's mirror relationship.
import maya.mel as mel
mel.eval(
"MGP_MirrorSelection 1"
) # arg: 0 for replace selection, 1 for add to selection.

View File

@@ -0,0 +1,5 @@
# Add all selectButton & slider members of current picker panel to scene selection.
# The int arg stands for the selection mode, 0 for replace selection,1 for add selection, 2 for remove selection, 3 for invert selection.
import maya.mel as mel
mel.eval("MGP_EvalPanelAllSelectButtons 1")

View File

@@ -0,0 +1,5 @@
# Add all selectButton & slider members of current picker to scene selection:
# The int arg stands for the selection mode, 0 for replace selection,1 for add selection, 2 for remove selection, 3 for invert selection.
import maya.mel as mel
mel.eval("MGP_EvalPickerAllSelectButtons 1")

View File

@@ -0,0 +1,5 @@
# Deselect all selectButton & slider members of current picker panel from scene selection.
# The int arg stands for the selection mode, 0 for replace selection,1 for add selection, 2 for remove selection, 3 for invert selection.
import maya.mel as mel
mel.eval("MGP_EvalPanelAllSelectButtons 2")

View File

@@ -0,0 +1,5 @@
# Deselect all selectButton & slider members of current picker from scene selection.
# The int arg stands for the selection mode, 0 for replace selection,1 for add selection, 2 for remove selection, 3 for invert selection.
import maya.mel as mel
mel.eval("MGP_EvalPickerAllSelectButtons 2")

View File

@@ -0,0 +1,5 @@
# Toggle all selectButton & slider members selection states of current picker panel.
# The int arg stands for the selection mode, 0 for replace selection,1 for add selection, 2 for remove selection, 3 for invert selection.
import maya.mel as mel
mel.eval("MGP_EvalPanelAllSelectButtons 3")

View File

@@ -0,0 +1,5 @@
# Toggle all selectButton & slider members selection states of current picker.
# The int arg stands for the selection mode, 0 for replace selection,1 for add selection, 2 for remove selection, 3 for invert selection.
import maya.mel as mel
mel.eval("MGP_EvalPickerAllSelectButtons 3")

View File

@@ -0,0 +1,4 @@
# Mirror selection & slider via current picker's mirror relationship.
import maya.mel as mel
mel.eval("MGP_MirrorSelection 0") # arg: 0 for replace selection,1 for add selection.

View File

@@ -0,0 +1,5 @@
# Select all selectButton & slider members of current picker panel.
# The int arg stands for the selection mode, 0 for replace selection,1 for add selection, 2 for remove selection, 3 for invert selection.
import maya.mel as mel
mel.eval("MGP_EvalPanelAllSelectButtons 0")

View File

@@ -0,0 +1,6 @@
# Select all selectButton & slider members of the picker panel with the panel index.
# The first int arg stands for the selection mode, 0 for replace selection,1 for add selection, 2 for remove selection, 3 for invert selection.
# The second int arg stands for the panel index.
import maya.mel as mel
mel.eval("MGP_EvalPanelAllSelectButtons_viaPanelIndex 0 0")

View File

@@ -0,0 +1,5 @@
# Select all selectButton & slider members of current picker.
# The int arg stands for the selection mode, 0 for replace selection,1 for add selection, 2 for remove selection, 3 for invert selection.
import maya.mel as mel
mel.eval("MGP_EvalPickerAllSelectButtons 0")

View File

@@ -0,0 +1,6 @@
import maya.mel as mel
newNamespace = "" # To-Do: replace the "newNamespace" variable with your value.
mel.eval(
'MGP_SetCurrentPickerNamespace "' + newNamespace + '"'
) # set current picker namespace.

View File

@@ -0,0 +1,4 @@
# pop up set namespace ui:
import maya.mel as mel
mel.eval("MGP_SetCurrentPickerNamespace_WithUI")

View File

@@ -0,0 +1,4 @@
# To-Do: replace the int with the target panel index, 0 is usually the first panel.
import maya.mel as mel
mel.eval("MGP_GoToPanel 0")