[Maya] How can l control locator handle size

Hi everyone,

I’m working on the scene file having the setting of working unit, meter,
and having a problem because the scale of maya locator is affected by the working unit settings.
(basically, it is scaled too big when importing a character model )

Ideally, a locator of the size created by a working unit of centimeters is just fine.
So every time, I have to change the scale manually, and don’t have a good solution for now.

I was wondering if someone could help me about this.

Thanks!

Hey @pandarocket, welcome to the forum! Just to get my bearings lets clarify:

  1. You have a locator in the scene with working units of centimetre.

  2. Your importing a character with a working unit of meter.

Is the expectation that the scenes units match the imported character?

Or …

The imported character matches the scene units?

If the locator is 1 cm, when the character is imported in meters should it become 0.01 meters or 1?

Two ways I can think of off the bat - maybe hijack the import callback with an MMessageEvent or scriptJob, or build a loader tool that does the fix-ups on import. I think import can respect the scene units on import too.

-c

Hi @chalk,

Thank you for your reply and advice, and sorry to confuse you.

Currently, I’ m working on the scene with working units of meter for specific reason, and I used to work on the scene with working units of centimeter before.

Current problems are what the locator size is much bigger than the imported character model and when created new locator in the scene as well.

I need to adjust the local scale each time and Maya locator creation menu has no option to adjust it.

What I expect is the locator to be scaled automatically with the same display size as centimeters regardless of the working unit.

Your advice would works for me, when importing character model, and I guess the way hijack a callback would works for when created new locator as well.

I’ll start off with your advice. If you know a reference to start it please le me know.

Thanks!

@pandarocket, you could, write a tool that makes a locator in cm regardless of the units, roughly speaking…:

import maya.cmds as cmds

loc = cmds.spaceLocator()[0]

scale_factor = cmds.convertUnit("1.0", 
     fromUnit="cm", toUnit=cmd.currentUnit(q=True))

cmds.setAttr("{0}.localScale".format(loc), *[scale_factor] * 3)

*note - I’m unpacking a instanced variable on the setAttr - Maya might barf… :nauseated_face::nerd_face:

This could be wrapped to a sciptJob on node creation - query the nodeType and if its a locator fix-up its scale based on the scenes. All you want is the LocalScale i.e the shape scale of the locator.

-c

1 Like