HIK: Getting current character and current source.
class HIK:
def getCurrentCharacter(self):
import maya.cmds as mc;
currentCharacterLabel= False;
currentCharacterIndex= mc.optionMenuGrp("hikCharacterList",q=1,sl=1);
items= mc.optionMenuGrp("hikCharacterList",q=1,itemListLong=1);
currentCharacterItem= items[currentCharacterIndex-1];
currentCharacterLabel= mc.menuItem(currentCharacterItem,q=1,label=1);
if not mc.objExists(currentCharacterLabel): currentCharacterLabel= None;
elif mc.nodeType(currentCharacterLabel)!="HIKCharacterNode": currentCharacterLabel= None;
return(currentCharacterLabel);
def getCurrentSource(self):
import maya.cmds as mc;
currentSourceLabel= False;
currentSourceIndex= mc.optionMenuGrp("hikSourceList",q=1,sl=1);
items= mc.optionMenuGrp("hikSourceList",q=1,itemListLong=1);
currentSourceItem= items[currentSourceIndex-1];
currentSourceLabel= mc.menuItem(currentSourceItem,q=1,label=1);
if not mc.objExists(currentSourceLabel): currentSourceLabel= None;
elif mc.nodeType(currentSourceLabel)!="HIKCharacterNode": currentSourceLabel= None;
else:
if currentSourceLabel[0]==" ":currentSourceLabel= currentSourceLabel[1:len(currentSourceLabel)];
return(currentSourceLabel);
# Current character node in HIK character list
currentCharacter= HIK().getCurrentCharacter();
# Current character node in HIK source list
currentSource= HIK().getCurrentSource();
def getCurrentCharacter(self):
import maya.cmds as mc;
currentCharacterLabel= False;
currentCharacterIndex= mc.optionMenuGrp("hikCharacterList",q=1,sl=1);
items= mc.optionMenuGrp("hikCharacterList",q=1,itemListLong=1);
currentCharacterItem= items[currentCharacterIndex-1];
currentCharacterLabel= mc.menuItem(currentCharacterItem,q=1,label=1);
if not mc.objExists(currentCharacterLabel): currentCharacterLabel= None;
elif mc.nodeType(currentCharacterLabel)!="HIKCharacterNode": currentCharacterLabel= None;
return(currentCharacterLabel);
def getCurrentSource(self):
import maya.cmds as mc;
currentSourceLabel= False;
currentSourceIndex= mc.optionMenuGrp("hikSourceList",q=1,sl=1);
items= mc.optionMenuGrp("hikSourceList",q=1,itemListLong=1);
currentSourceItem= items[currentSourceIndex-1];
currentSourceLabel= mc.menuItem(currentSourceItem,q=1,label=1);
if not mc.objExists(currentSourceLabel): currentSourceLabel= None;
elif mc.nodeType(currentSourceLabel)!="HIKCharacterNode": currentSourceLabel= None;
else:
if currentSourceLabel[0]==" ":currentSourceLabel= currentSourceLabel[1:len(currentSourceLabel)];
return(currentSourceLabel);
# Current character node in HIK character list
currentCharacter= HIK().getCurrentCharacter();
# Current character node in HIK source list
currentSource= HIK().getCurrentSource();
Comments
Post a Comment