Home  Previous Next

command (MEL/Python)

MGPickerViewRegion

Go to: Synopsis. MEL examples. Python examples.

Synopsis

MGPickerViewRegion (viewRegionIDString, [activate=boolean] [animation=unsigned int, string] [exist=boolean] [geometry=float, float, float, float]  [getIdFromName=string] [list=boolean] [name=string] [remove=boolean] [select=int]) [view=string])

Note: Strings representing object names and arguments must be separated by commas. This is not depicted in the synopsis.

MGPickerViewRegion is NOT undoable, queryable, and editable.

This command creates / queries / edits picker view regions.

 

 

Long name (short name)

Argument types

Properties

-activate(-act) animatable v2_transparent


createedit


Zoom and pan the picker view to focus on this view region.

-animation(-ani) v2_transparent

unsigned int string

createedit


Edit only flag to turn other edit operation into an animation.

The first argument is animation duration in millisecond, the second argument is the easing curve type of these predefined values, which can be retrieved by `MGPickerAnimation -q -supportedEasingTypes`.

-exist(-ex)v2_transparent


query


This is a query only flag that can be used to query for the existence of a specific view region.

-geometry(-g)v2_transparent

float float float float

createqueryedit


To query/create/edit the geometry of a view region with x, y, width, height.

-getIdFromName(-gin)v2_transparent

string

query


This is a query-only flag that can be used to get the view region ID of the specific name.

Note that although multiple view regions are not supposed to share the same name, this still returns a list of IDs to be consistent with other MGPicker commands.

-list(-ls)v2_transparent


query


This is a query-only only flag return all the view region IDs in the picker view.

-name(-n)v2_transparent

string

createqueryedit


Query or edit the name of view region. Note that to ensure each view region got unique name, it may set the closest name to the input name.

-remove(-rm)v2_transparent


edit


This is a edit only flag that can be used to remove a specific view region.

-select(-sel)v2_transparent

int

createqueryedit


In edit mode this select the picker item. Specify a 0~3 int as the selection mode:

 0 for replace selection,

 1 for add selection,

 2 for deselect,

 3 for toggle selection

In query mode, this will return a boolean to indicate that the view region is currently selected or not.

-view(-v)v2_transparent

string

createqueryedit


This controls which picker view that the view region belongs to, if this flag is not specified, then current view will be used by default. A picker view id string should be specified for this flag in query, create, edit mode.

The picker view id could be retrieved by MGPicker commands such as:  (Please refer to MGPicker command manual for further details.)

   MGPicker -q -currentPickerView;     // Get current script execution view id, eg. picker load command, picker mouse enter command. Only be set during the script being executed.
   MGPicker -q -activePickerView;     // Get current active view id.

   MGPicker -q -findPickerView  "pickerNodeOrFileName"  1 "namespace";             // Find picker view id via picker node name or picker file name and namespace.

   MGPicker -q -listAllPickerViews;          // List ids of all opened picker views.

   MGPicker -e -createTempPicker;     // Create a temporary picker view and return its id.

   MGPicker -e -createPicker "pickerName" "namespace" "filePath" "nodeName";        // Create a picker view and return its id.

   MGPicker -e -readPickerNode "nodeName";       // Read in-scene picker node and return its id.

   MGPicker -e -readScenePicker "nodeName" "pickerName" "namespace" "pickerDataString";       // Read in-scene picker node and return its id.

   MGPicker -e -readPickerFile "pickerFilePath" 1;         // Read a picker file and return its id.




















create Flag can appear in Create mode of command

edit Flag can appear in Edit mode of command

query Flag can appear in Query mode of command

multiuse Flag can be used more than once in a command.

animatable Flag can animated with -animation flag.

 

MEL examples

// Make sure there is an active picker view, run this to create a view region with the specific geometry and name:
string $newViewRegion = `MGPickerViewRegion -name "Body" -geometry 50.0 50.0 300.0 300.0`;

// Activate that view region:
MGPickerViewRegion -e -activate -animation 500 "OutQuad" $newViewRegion;

Python examples

from mgpicker import mgp
 
# Make sure there is an active picker view, run this to create a view region with the specific geometry and name:
newViewRegion = mgp.MGPickerViewRegion(name='Body', geometry=(50.0, 50.0, 300.0, 300.0))
 
# Activate that view region:
mgp.MGPickerViewRegion(newViewRegion, e=True, activate=True, animation=(500, 'OutQuad'))

Home Previous Next