Cycle between Object and Component Mode Through Script

Become a member of the CGSociety

Connect, Share, and Learn with our Large Growing CG Art Community. It's Free!

Thread Tools Search this Thread Display Modes
  01 January 2018
Cycle between Object and Component Mode Through Script

Hi All,

Is there a way to map two keys
One (1) for the switching between Object Mode and Component Mode and the other (2)for switching between Vertex, Edge and Face mode?

So far I got this code for the first one

selectMode -object;
selectMode -component;

The problem with this is that I cannot get the current mode if it is object or component.
Basically, the process would run as:
(1) Check whether object or component
(2) If object, change to component
(3) If component, change to object.

For the second one, thanks to this thread

if (`selectMode -q -o` == 1)
 inViewMessage -pos topCenter -msg "Vert" -fade;
else if (`selectType -q -pv` == 1)
 inViewMessage -pos topCenter -msg "Edge" -fade;
else if (`selectType -q -pe` == 1)
 inViewMessage -pos topCenter -msg "Face" -fade;
else if (`selectType -q -pf` == 1)
 inViewMessage -pos topCenter -msg "Object" -fade;

It works. But the problem is that it maps all the command to one key rather than my preferred two keys.
I tried deleting the last last "else if" statement for the object but after that the script does not work any longer.

Is there a way around this?

Thank you for your time.
reply share thread

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Society of Digital Artists

Powered by vBulletin
Copyright 2000 - 2006,
Jelsoft Enterprises Ltd.
Minimize Ads
Forum Jump

All times are GMT. The time now is 10:22 AM.

Powered by vBulletin
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.