Weld vertex (Python)

[QUOTE=rgkovach123;26249]It is stored in Preferences. I don’t believe it defaults to True, but I could be wrong (it is a performance hit to track the selection order).
As far as I can remember the “ls” command always returns the selection sorted, not in the order it was selected.

selection(sl) boolean create

List objects that are currently selected.

orderedSelection(os) boolean create

List objects and components that are currently selected in their order of selection. This flag depends on the value of the -tso/trackSelectionOrder flag of the selectPref command. If that flag is not enabled than this flag will return the same thing as the -sl/selection flag would.[/QUOTE]

Ok, this is super weird. I queried the trackSelectionOrder and got False. Still, I have never had a problem with ls(selection=True) not being sorted in order of selection. Both for pymel and cmds module.

Object selection order is always tracked. trackSelectionOrder refers to the tracking component selection order and would be queried using ls(orderedSelection=True)

[QUOTE=bcottage;26286]So a mate of mine taught me how to call mel commands in python. The following does the merge vertex tool.

import pymel.core as pm
from functools import partial

def launchVertexTool(*args):
    mel.eval('MergeVertexTool')
bt2 = cmds.button( label='Target Weld', width=100, command=launchVertexTool)

Thankyou guys for all your help :)[/QUOTE]

This is unnecessary. MergeVertexTool is a RunTimeCommand, and just calls setToolTo “polyMergeVertexContext”, which you can call with python (as my previous example showed).

runTimeCommand -q -c MergeVertexTool;
// Result: setToolTo polyMergeVertexContext //