Duplicate with Transform when you deselect the object?


#1

Hi,

Duplicate with Transform seems to be working only when you have objects selected, as soon as you do Duplicate with Transform, deselect the object and select it again then again use Duplicate with Transform nothing happens since Maya “forgot” transformation when object was deselected.

Anyone knows if there is a way to still do Duplicate with Transform even after you deselect and select the same object again?

The script i have is something like in this form:

[B]duplicate -rr -renameChildren -st;

.
.
// some commands that do something to the duplicated object as well as deselect it
.
.

select -r $object // select duplicated object again[/B]

Now with the object selected again i moved it a bit and repeat script again from the start but object doesn’t move since the objects was deselected in the middle of the script. Hope i was clear enough with this.

Is there any workaround using MEL? …if it’s even possible.

Thanks in advance for any help!!


#2

Having scripts rely on selection is usually not a solid option. One of my favourite flags is “skipSelect” from the createNode command as it prevents the selection from being changed. I do not know the specifics of your case but maybe it can help here. Otherwise I would store the selection/duplicated objects in a variable and restore it whenever needed. So in your case this could look like:

Save the duplicate objects in a string array:

string $myDuplicates[] = `duplicate -rr -renameChildren -st`;
// .. do stuff
// retrieve selection at a relevant point
select -r $myDuplicates;

I hope this makes sense.
Cheers!


#3

I think createNode command is not quite what I need but I’ll see once I look more into it.

Saving duplicate object in string array is something I already tried but it doesn’t work since once I move duplicated object and then duplicate it again it will not do it with transformation.

Thanks for the suggestions. This gave me some ideas to try.