UV Sets (solved) and Control Bones (bypassed)
I have made a Geo-Graft attachment for Genesis 2, which hides some extreme morphing of the Genesis 2 mesh. Two issues have arisen which I am sure have a simple solution, but my knowledge of scripting is not that advanced, to say the least, and so I hope someone can point me in the right direction.
I want the attachment to automatically load the current Genesis 2 skin, and I have managed to cobble together a script which does this. However I can't find a way of getting it to load the correct UV Set. What it does is load the UV Set of the attachment which corresponds to the ordinal position in the drop-down of the UV Set of Genesis 2. So, for example, if the user has the 'Gianni 6' UV Set loaded, and this is the third one down in his list of UVs, my attachment will just load the third one down in the attachment UV Set, which is 'Michael 5'. Is there a way to get and set this value as a string?
The second issue concerns Control Bones. Because the morphs are extreme, I have had to move some bones. Now the oddities of the morphs on Genesis 2 itself are hidden by the geo-graft, but if Genesis 2 is wearing clothes the clothes themselves will start to deform because the bones have been moved. I have discovered that if I add Control Bones to the clothing, the clothing will start acting normally again, as these bones position themselves in the original place of the moved bones. The only problem is that I don't know how to script this.
What I have managed to do is to call the action from the Joint Editor Window:
var oMgr = MainWindow.getActionMgr();
var oAction = oMgr.findAction("DzJECreateControlBonesAction");
if( oAction ){
oAction.trigger();
}
Unfortunately the dialog box displays. I don't need to enter anything, just press the Accept button. Is there a way to either suppress the dialog box, or add the Control Bone more directly? Thank you.
Comments
Well, following an unrelated redesign of the geograft I found that calling up "DzJEDeleteBoneAction" did the job I needed without bringing up any dialog boxes. So that problem has been bypassed.
Regarding the UV Sets I found that using getUVSetControl() on the Material and then getting the string value, rather than querying the UV Set property itself (which just returned a number value), was the key. I could then designate the UV Set of the geograft by using SetValue(i) on its property, where i corresponds to the UV Set read from an array.