Is there a way to get a permanent XYZ coordinate display/input UI like 3DS Max?

Is there a way to get a permanent XYZ coordinate display/input UI like 3DS Max?

MANIAKRA
Contributor Contributor
3,707件の閲覧回数
12件の返信
メッセージ1/13

Is there a way to get a permanent XYZ coordinate display/input UI like 3DS Max?

MANIAKRA
Contributor
Contributor

Hi there,

 

I'm desperately looking for a solution for a permanent XYZ coordinate display/input for objects/components on the main Maya UI like is standard with 3DS Max. The channel box has what I want, but it's a waste of UI space to keep the channel box open at all times. Is there a way to dock the channel box into a shelf or detach it somehow? I'm aware of the little XYZ reference display on the bottom left corner near the MEL button but that's pretty useless.

 

maxmayaxyz.jpg

 

Despite how simple this inconvenience seems, it really snowballs into discomfort and impedes workflow. Any scripts, plugins, or tips you may have would be much appreciated!

 

Cheers

0 件のいいね
3,708件の閲覧回数
12件の返信
返信 (12)
メッセージ2/13

Roland.Reyer
Alumni
Alumni

Hi,

 

the help for the MEL command headsUpDisplay includes an example for the display of the current object transforms:

http://help.autodesk.com/cloudhelp/2018/ENU/Maya-Tech-Docs/Commands/headsUpDisplay.html

 

 

grafik.png

 

You can aslo detach the Channel Box and put it on a second moitor or dock it somewhere else (Maya 2017+).

 

メッセージ3/13

Anonymous
適用対象外

Hi,

 

can you please write me exact MEL script please? 

0 件のいいね
メッセージ4/13

Anonymous
適用対象外

sry i found it, but I am getting this error: No object matches name: .translateX any help? :), I am running Maya 2018.2

0 件のいいね
メッセージ5/13

Roland.Reyer
Alumni
Alumni

Is there a line number in the error message?

It sounds like there's an error in the procedure that transfers the position data to the HUD. If the object name is not properly set then the "getAttr" commands don't work.

 

0 件のいいね
メッセージ6/13

Anonymous
適用対象外

yes it´s on line 14, at thius part of script: 

 

        $position[0] = `getAttr $mainObject.translateX`;

 i´ve just copy and paste it (whole script, so it should work):

 

//
//Define a procedure that returns a value to be used by the Heads Up Display
//
global proc float[] objectPosition ()
{
    string $selectedNodes[] = `selectedNodes`;

    float $position[3];

    if (size($selectedNodes) > 0)
    {
        string $mainObject = $selectedNodes[ (size($selectedNodes) - 1) ];

        $position[0] = `getAttr $mainObject.translateX`;
        $position[1] = `getAttr $mainObject.translateY`;
        $position[2] = `getAttr $mainObject.translateZ`;
    }
    else
    {
        $position[0] = 0;
        $position[1] = 0;
        $position[2] = 0;
    }

    return $position;
}

//
//Now, create a HUD object to display the return value of the above procedure
//
//Attributes:
//
//		- Section 1, block 0, represents the top second slot of the view.
//		- Set the blockSize to "medium", instead of the default "small"
//		- Assigned the HUD the label: "Position"
//		- Defined the label font size to be large
//		- Assigned the HUD a command to run on a SelectionChanged trigger
//		- Attached the attributeChange node change to the SelectionChanged trigger
//		  to allow the update of the data on attribute changes.
//
headsUpDisplay -section          1
               -block            0
               -blockSize        "medium"
               -label            "Position"
               -labelFontSize    "large"
               -command          "objectPosition()"
               -event            "SelectionChanged"
               -nodeChanges      "attributeChange"
               HUDObjectPosition;
//
//Result: 1//
//

//
//Create a preset HUD object to display the camera names.
//
//Attributes:
//
//    - Section 2, block 0, represents the top middle slot of the view.
//    - Using blockalign, the HUD object is centered in the middle of the block
//    - Setting a dw of 50, allocates a space of 50 pixels for the data to reside in.
//    - Finally setting the preset to "cameraNames", selects a preset which will
//      automatically insert the associated data into the data field.
//
headsUpDisplay -s        2
               -b        0
               -ba       "center"
               -dw       50
               -pre      "cameraNames"
               HUDCameraName;
//
//Result: 2//
//
0 件のいいね
メッセージ7/13

Roland.Reyer
Alumni
Alumni

Yes, I see.

It won't work when you select something that is not a transform node.

 

Change

string $selectedNodes[] = `selectedNodes`;

to

string $selectedNodes[] = `ls -sl -tr`;

 

That should work better.

Also, you only need to change the "global proc ..." and re-execute it to make the HUD work.

The script below has two HUD commands, you need only the first one.

 

0 件のいいね
メッセージ8/13

Anonymous
適用対象外

ok, i´ll try it after a get home and let you know if it´s working :), thanks lot for help 🙂 and global proc... is what exactly and where i find it? 😄

0 件のいいね
メッセージ9/13

Roland.Reyer
Alumni
Alumni

 

That "global proc ..." is a procedure that you define once and that is called (in this case) by the HUD function to update the display.

 

After you have *defined* the block

 

global proc myOwnFunction()
{
some code here
}

 you can execute the code (this example) with the command "myOwnFunction()".

 

To *define* it there are several ways.

One way is to paste the whole block into the script editor, then select it (optional) and hit CTRL-ENTER (or ENTER on the numercal keypad).

 

 

 grafik.png

 

(When you select the code first it will stay in the input section of the Script Editor for changes - selecting the code also makes sure that you execute just that portion of code).

When you have to make changes to the function, just mark and CTRL-ENTER it again to overwrite the stored version.

 

The actual HUD command then calls (executes) this funcion whenever theres a display refresh:

 

headsUpDisplay -section          1
               -block            0
               -blockSize        "medium"
               -label            "Position"
               -labelFontSize    "large"
               -command          "objectPosition()"
               -event            "SelectionChanged"
               -nodeChanges      "attributeChange"
               HUDObjectPosition;

 

メッセージ10/13

Anonymous
適用対象外

aha ok i get it, also there is one function or part of script made for removing this whole block of code (way i was removing it) it´s this one: 

//
//Now, remove these two HUDs. Both can be removed in three ways: name, ID or position.
//The following examples will demonstrate removal by name and position
//
headsUpDisplay -rem HUDObjectPosition;
//
//Result: 1//
//
headsUpDisplay -rp 7 0;
//
//Result: 7 0//
//
0 件のいいね
メッセージ11/13

Roland.Reyer
Alumni
Alumni

That's correct.

 

headsUpDisplay -rem HUDObjectPosition;

will remove the HUD.

 

There is no way (and no need) to remove the function.

There are literally thousands of functions defined in Maya at all times.

Next time you restart Maya the function will be gone.

 

 

メッセージ12/13

Anonymous
適用対象外

yeah, i was thinking about it how make it show up permanently..., but it becomes handy to remove it what you experimenting and trying it to make it working, maybe... For me it was just copying and pasting it 😄 

0 件のいいね
メッセージ13/13

Anonymous
適用対象外

ok so i´ve try that and it´s working but only if i am in Object mode, for vertex, edge and face mode it shows up 0 nothing else... but there are no errors whatsoever 

0 件のいいね