PDA

View Full Version : One-Click Immobilise?



MrFurious
08-22-2014, 09:01 PM
Hi all I was trying to find a way to 'lock' or immobilise an object quickly preferably a one-click solution. The way I'm doing it now is to select an object, go tot he bottom left corner and unselect 'position' xyz, rotation hpb, and scale xyz. Must be a faster way..?

Ryan Roye
08-22-2014, 09:15 PM
a macro-scripting way to go about it would be to enter this into lscript commander, then save it so you can have it as a menu button:

MoveTool
EnableXH
EnableYP
EnableZB
RotateTool
EnableXH
EnableYP
EnableZB
StretchTool
EnableXH
EnableYP
EnableZB

This works as a toggle, you'd need direct scripting in order to explicitly disable or enable them rather than toggling as far as I know.

ernpchan
08-22-2014, 09:15 PM
You could make a script to toggle off the channels. Unfortunately the code just toggles the current state. There's no way to check the state to check if it's in a current state you want to toggle on or off.

MrFurious
08-22-2014, 09:54 PM
Brilliant.. thanks guys. My first macro/script, was always afraid to go there. Shame it's just a toggle though but this will work perfectly for newly created parenting nulls.

cheers.

ernpchan
08-22-2014, 10:10 PM
My first macro/script, was always afraid to go there.

Don't be. Once you get the hang of it you'll see limitless possibilities with what you can accomplish more efficiently. I was once intimidated by scripting but when I encounter something repetitive I immediately wonder if it's something I can script.

jeric_synergy
08-23-2014, 12:14 AM
There's no way to check the state to check if it's in a current state you want to toggle on or off.
::sigh:: It's obvious to everybody (right devs?) that there SHOULD be a function to check the state, right?

(I'm assuming ernpchan is correct.)

ernpchan
08-23-2014, 12:15 AM
Submit a feature request. I actually submitted one this morning because I was trying to build a script at work. The more requests the better.

RebelHill
08-23-2014, 03:23 AM
You can check via the axislocks[] method...


item = Scene().firstSelect();
LockAxis(1,1) if !item.axislocks[1];

for instance will lock the X if X is currently unlocked.

You can also quickly run through locking all axes if you like, thus;

for(i=1;i<=9;i++) LockAxis(i,1);

ernpchan
08-23-2014, 08:32 AM
Oh nice. Did not know about this.

RebelHill
08-23-2014, 08:56 AM
It's also one of the weird ones that catches folks... since axisLocks is an array which is an attribute of an item, but... which WONT return that array.

Hence...

locks = item.axisLocks;
info(locks[1]);

Wont actually work, you have to index directly into the object agent attribute.

ernpchan
08-23-2014, 09:10 AM
Ah ok, thanks for pointing that out.

jeric_synergy
08-23-2014, 09:12 AM
It's also one of the weird ones that catches folks... since axisLocks is an array which is an attribute of an item, but... which WONT return that array.

So, if one wanted to get the full array, one would have to query each attribute separately?

RebelHill
08-23-2014, 09:22 AM
Yep... but that's easy enough to build out in a similar way to performing the locks...

lockArray;
for(i=1;i<=9;i++) lockArray[i] = item.axisLocks[i];