本文整理汇总了Python中kraken.core.profiler.Profiler.getInstance方法的典型用法代码示例。如果您正苦于以下问题:Python Profiler.getInstance方法的具体用法?Python Profiler.getInstance怎么用?Python Profiler.getInstance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类kraken.core.profiler.Profiler
的用法示例。
在下文中一共展示了Profiler.getInstance方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: loadRigDefinition
# 需要导入模块: from kraken.core.profiler import Profiler [as 别名]
# 或者: from kraken.core.profiler.Profiler import getInstance [as 别名]
def loadRigDefinition(self, jsonData):
"""Load a rig definition from a JSON structure.
Arguments:
jsonData -- dict, the JSON data containing the rig definition.
Return:
True if successful.
"""
Profiler.getInstance().push("loadRigDefinition:" + self.getName())
krakenSystem = KrakenSystem.getInstance()
if 'name' in jsonData:
self.setName(jsonData['name'])
if 'components' in jsonData:
self._loadComponents(jsonData['components'])
if 'connections' in jsonData:
self._makeConnections(jsonData['connections'])
if 'graphPositions' in jsonData:
self._loadGraphPositions(jsonData['graphPositions'])
Profiler.getInstance().pop()
示例2: __init__
# 需要导入模块: from kraken.core.profiler import Profiler [as 别名]
# 或者: from kraken.core.profiler.Profiler import getInstance [as 别名]
def __init__(self, name='Tentacle', parent=None, data=None):
Profiler.getInstance().push("Construct Tentacle Guide Component:" + name)
super(TentacleComponentGuide, self).__init__(name, parent)
# =========
# Controls
# =========
guideSettingsAttrGrp = AttributeGroup("GuideSettings", parent=self)
self.numJoints = IntegerAttribute('numJoints', value=5, minValue=2, maxValue=20, parent=guideSettingsAttrGrp)
self.numJoints.setValueChangeCallback(self.updateNumControls)
self.jointCtrls = []
self.tentacleOutputs = []
if data is None:
numJoints = self.numJoints.getValue()
jointPositions = self.generateGuidePositions(numJoints)
for i in xrange(numJoints):
self.jointCtrls.append(Control('tentacle' + str(i + 1).zfill(2), parent=self.ctrlCmpGrp, shape="sphere"))
self.tentacleOutputs.append(ComponentOutput('tentacle' + str(i + 1).zfill(2), parent=self.outputHrcGrp))
self.boneOutputs.setTarget(self.tentacleOutputs)
data = {
"location": "L",
"jointPositions": jointPositions,
"numJoints": self.numJoints.getValue()
}
self.loadData(data)
Profiler.getInstance().pop()
示例3: __init__
# 需要导入模块: from kraken.core.profiler import Profiler [as 别名]
# 或者: from kraken.core.profiler.Profiler import getInstance [as 别名]
def __init__(self, name='leg', parent=None, data=None):
Profiler.getInstance().push("Construct Leg Guide Component:" + name)
super(LegComponentGuide, self).__init__(name, parent)
# =========
# Controls
# ========
guideSettingsAttrGrp = AttributeGroup("GuideSettings", parent=self)
# Guide Controls
self.femurCtrl = Control('femur', parent=self.ctrlCmpGrp, shape="sphere")
self.kneeCtrl = Control('knee', parent=self.ctrlCmpGrp, shape="sphere")
self.ankleCtrl = Control('ankle', parent=self.ctrlCmpGrp, shape="sphere")
self.toeCtrl = Control('toe', parent=self.ctrlCmpGrp, shape="sphere")
self.toeTipCtrl = Control('toeTip', parent=self.ctrlCmpGrp, shape="sphere")
if data is None:
data = {
"name": name,
"location": "L",
"femurXfo": Xfo(Vec3(0.9811, 9.769, -0.4572)),
"kneeXfo": Xfo(Vec3(1.4488, 5.4418, -0.5348)),
"ankleXfo": Xfo(Vec3(1.841, 1.1516, -1.237)),
"toeXfo": Xfo(Vec3(1.85, 0.4, 0.25)),
"toeTipXfo": Xfo(Vec3(1.85, 0.4, 1.5))
}
self.loadData(data)
Profiler.getInstance().pop()
示例4: __init__
# 需要导入模块: from kraken.core.profiler import Profiler [as 别名]
# 或者: from kraken.core.profiler.Profiler import getInstance [as 别名]
def __init__(self, name='spine', parent=None, *args, **kwargs):
Profiler.getInstance().push("Construct Spine Guide Component:" + name)
super(SpineComponentGuide, self).__init__(name, parent, *args, **kwargs)
# =========
# Controls
# ========
guideSettingsAttrGrp = AttributeGroup("GuideSettings", parent=self)
self.numDeformersAttr = IntegerAttribute('numDeformers', value=1, minValue=0, maxValue=20, parent=guideSettingsAttrGrp)
# Guide Controls
self.cog = Control('cogPosition', parent=self.ctrlCmpGrp, shape="sphere")
self.cog.scalePoints(Vec3(1.2, 1.2, 1.2))
self.cog.setColor('red')
self.spine01Ctrl = Control('spine01Position', parent=self.ctrlCmpGrp, shape='sphere')
self.spine02Ctrl = Control('spine02Position', parent=self.ctrlCmpGrp, shape='sphere')
self.spine03Ctrl = Control('spine03Position', parent=self.ctrlCmpGrp, shape='sphere')
self.spine04Ctrl = Control('spine04Position', parent=self.ctrlCmpGrp, shape='sphere')
data = {
'name': name,
'location': 'M',
'cogPosition': Vec3(0.0, 11.1351, -0.1382),
'spine01Position': Vec3(0.0, 11.1351, -0.1382),
'spine02Position': Vec3(0.0, 11.8013, -0.1995),
'spine03Position': Vec3(0.0, 12.4496, -0.3649),
'spine04Position': Vec3(0.0, 13.1051, -0.4821),
'numDeformers': 6
}
self.loadData(data)
Profiler.getInstance().pop()
示例5: __init__
# 需要导入模块: from kraken.core.profiler import Profiler [as 别名]
# 或者: from kraken.core.profiler.Profiler import getInstance [as 别名]
def __init__(self, name='clavicle', parent=None, data=None):
Profiler.getInstance().push("Construct Clavicle Guide Component:" + name)
super(ClavicleComponentGuide, self).__init__(name, parent)
# =========
# Controls
# =========
# Guide Controls
guideSettingsAttrGrp = AttributeGroup("GuideSettings", parent=self)
self.clavicleCtrl = Control('clavicle', parent=self.ctrlCmpGrp, shape="sphere")
self.clavicleUpVCtrl = Control('clavicleUpV', parent=self.ctrlCmpGrp, shape="triangle")
self.clavicleUpVCtrl.setColor('red')
self.clavicleEndCtrl = Control('clavicleEnd', parent=self.ctrlCmpGrp, shape="sphere")
if data is None:
data = {
"name": name,
"location": "L",
"clavicleXfo": Xfo(Vec3(0.1322, 15.403, -0.5723)),
"clavicleUpVXfo": Xfo(Vec3(0.0, 1.0, 0.0)),
"clavicleEndXfo": Xfo(Vec3(2.27, 15.295, -0.753))
}
self.loadData(data)
Profiler.getInstance().pop()
示例6: __init__
# 需要导入模块: from kraken.core.profiler import Profiler [as 别名]
# 或者: from kraken.core.profiler.Profiler import getInstance [as 别名]
def __init__(self, name="mainSrt", parent=None, data=None):
Profiler.getInstance().push("Construct MainSrt Guide Component:" + name)
super(MainSrtComponentGuide, self).__init__(name, parent)
# =========
# Attributes
# =========
# Add Component Params to IK control
guideSettingsAttrGrp = AttributeGroup("GuideSettings", parent=self)
self.mainSrtSizeInputAttr = ScalarAttribute(
"mainSrtSize", value=5.0, minValue=1.0, maxValue=50.0, parent=guideSettingsAttrGrp
)
# =========
# Controls
# =========
# Guide Controls
self.mainSrtCtrl = Control("mainSrt", parent=self.ctrlCmpGrp, shape="circle")
if data is None:
data = {
"location": "M",
"mainSrtSize": self.mainSrtSizeInputAttr.getValue(),
"mainSrtXfo": Xfo(tr=Vec3(0.0, 0.0, 0.0)),
}
self.loadData(data)
Profiler.getInstance().pop()
示例7: _loadComponents
# 需要导入模块: from kraken.core.profiler import Profiler [as 别名]
# 或者: from kraken.core.profiler.Profiler import getInstance [as 别名]
def _loadComponents(self, componentsJson):
"""Loads components from a JSON dict.
Args:
componentsJson (dict): Dictionary of components to load.
"""
Profiler.getInstance().push("__loadComponents")
krakenSystem = KrakenSystem.getInstance()
for componentData in componentsJson:
# trim off the class name to get the module path.
modulePath = '.'.join(componentData['class'].split('.')[:-1])
if modulePath is not "":
importlib.import_module(modulePath)
componentClass = krakenSystem.getComponentClass(componentData['class'])
if 'name' in componentData:
component = componentClass(name=componentData['name'], parent=self)
else:
component = componentClass(parent=self)
component.loadData(componentData)
Profiler.getInstance().pop()
示例8: loadRigDefinition
# 需要导入模块: from kraken.core.profiler import Profiler [as 别名]
# 或者: from kraken.core.profiler.Profiler import getInstance [as 别名]
def loadRigDefinition(self, jsonData):
"""Load a rig definition from a JSON structure.
Args:
jsonData (dict): JSON data containing the rig definition.
Returns:
bool: True if successful.
"""
Profiler.getInstance().push("loadRigDefinition:" + self.getName())
krakenSystem = KrakenSystem.getInstance()
if 'name' in jsonData:
self.setName(jsonData['name'])
if 'components' in jsonData:
self._loadComponents(jsonData['components'])
if 'connections' in jsonData:
self._makeConnections(jsonData['connections'])
if 'metaData' in jsonData:
for k, v in jsonData['metaData'].iteritems():
self.setMetaData(k, v)
Profiler.getInstance().pop()
示例9: __init__
# 需要导入模块: from kraken.core.profiler import Profiler [as 别名]
# 或者: from kraken.core.profiler.Profiler import getInstance [as 别名]
def __init__(self, name='head', parent=None):
Profiler.getInstance().push("Construct Head Guide Component:" + name)
super(FabriceHeadGuide, self).__init__(name, parent)
# =========
# Controls
# =========
guideSettingsAttrGrp = AttributeGroup("GuideSettings", parent=self)
self.headCtrl = Control('head', parent=self.ctrlCmpGrp, shape="circle")
self.headCtrl.rotatePoints(90.0, 0.0, 0.0)
self.headCtrl.scalePoints(Vec3(3.5, 3.5, 3.5))
self.jawCtrl = Control('jaw', parent=self.ctrlCmpGrp, shape="cube")
self.jawCtrl.alignOnZAxis()
self.jawCtrl.scalePoints(Vec3(2.0, 0.5, 2.0))
self.jawCtrl.alignOnYAxis(negative=True)
self.jawCtrl.setColor('orange')
data = {
"name": name,
"location": "M",
"headXfo": Xfo(Vec3(0.0, 1.67, 1.75)),
"headCtrlCrvData": self.headCtrl.getCurveData(),
"jawPosition": Vec3(0.0, 1.2787, 2.0078),
"jawCtrlCrvData": self.jawCtrl.getCurveData(),
}
self.loadData(data)
Profiler.getInstance().pop()
示例10: __init__
# 需要导入模块: from kraken.core.profiler import Profiler [as 别名]
# 或者: from kraken.core.profiler.Profiler import getInstance [as 别名]
def __init__(self, name='neck', parent=None, data=None):
Profiler.getInstance().push("Construct Neck Component:" + name)
super(NeckComponentGuide, self).__init__(name, parent)
# =========
# Controls
# ========
guideSettingsAttrGrp = AttributeGroup("GuideSettings", parent=self)
# Guide Controls
self.neckCtrl = Control('neck', parent=self.ctrlCmpGrp, shape="sphere")
self.neckEndCtrl = Control('neckEnd', parent=self.ctrlCmpGrp, shape="sphere")
if data is None:
data = {
"name": name,
"location": "M",
"neckPosition": Vec3(0.0, 16.5572, -0.6915),
"neckEndPosition": Vec3(0.0, 17.4756, -0.421)
}
self.loadData(data)
Profiler.getInstance().pop()
示例11: _makeConnections
# 需要导入模块: from kraken.core.profiler import Profiler [as 别名]
# 或者: from kraken.core.profiler.Profiler import getInstance [as 别名]
def _makeConnections(self, connectionsJson):
Profiler.getInstance().push("__makeConnections")
for connectionData in connectionsJson:
sourceComponentDecoratedName, outputName = connectionData['source'].split('.')
targetComponentDecoratedName, inputName = connectionData['target'].split('.')
sourceComponent = self.getChildByDecoratedName(sourceComponentDecoratedName)
if sourceComponent is None:
raise Exception("Error making connection:" + connectionData['source'] + " -> " + \
connectionData['target']+". Source component not found:" + sourceComponentDecoratedName)
targetComponent = self.getChildByDecoratedName(targetComponentDecoratedName)
if targetComponent is None:
raise Exception("Error making connection:" + connectionData['source'] + " -> " + \
connectionData['target']+". Target component not found:" + targetComponentDecoratedName)
outputPort = sourceComponent.getOutputByName(outputName)
if outputPort is None:
raise Exception("Error making connection:" + connectionData['source'] + " -> " + \
connectionData['target']+". Output '" + outputName + "' not found on Component:" + sourceComponent.getPath())
inputPort = targetComponent.getInputByName(inputName)
if inputPort is None:
raise Exception("Error making connection:" + connectionData['source'] + " -> " + \
connectionData['target']+". Input '" + inputName + "' not found on Component:" + targetComponent.getPath())
inputPort.setConnection(outputPort)
inputPort.setIndex(connectionData.get('targetIndex', 0))
Profiler.getInstance().pop()
示例12: __init__
# 需要导入模块: from kraken.core.profiler import Profiler [as 别名]
# 或者: from kraken.core.profiler.Profiler import getInstance [as 别名]
def __init__(self, name='clavicle', parent=None):
Profiler.getInstance().push("Construct Clavicle Guide Component:" + name)
super(FabriceClavicleGuide, self).__init__(name, parent)
# =========
# Controls
# =========
# Guide Controls
guideSettingsAttrGrp = AttributeGroup("GuideSettings", parent=self)
self.clavicleCtrl = Control('clavicle', parent=self.ctrlCmpGrp, shape="cube")
self.clavicleCtrl.alignOnXAxis()
self.clavicleCtrl.scalePoints(Vec3(1.0, 0.25, 0.25))
data = {
"name": name,
"location": "L",
"clavicleXfo": Xfo(Vec3(0.1322, 15.403, -0.5723)),
'clavicleCtrlCrvData': self.clavicleCtrl.getCurveData()
}
self.loadData(data)
Profiler.getInstance().pop()
示例13: __init__
# 需要导入模块: from kraken.core.profiler import Profiler [as 别名]
# 或者: from kraken.core.profiler.Profiler import getInstance [as 别名]
def __init__(self, name='head', parent=None, data=None):
Profiler.getInstance().push("Construct Head Guide Component:" + name)
super(HeadComponentGuide, self).__init__(name, parent)
# =========
# Controls
# =========
guideSettingsAttrGrp = AttributeGroup("GuideSettings", parent=self)
self.headCtrl = Control('head', parent=self.ctrlCmpGrp, shape="cube")
self.headEndCtrl = Control('headEnd', parent=self.ctrlCmpGrp, shape="sphere")
self.eyeLeftCtrl = Control('eyeLeft', parent=self.ctrlCmpGrp, shape="sphere")
self.eyeRightCtrl = Control('eyeRight', parent=self.ctrlCmpGrp, shape="sphere")
self.jawCtrl = Control('jaw', parent=self.ctrlCmpGrp, shape="cube")
if data is None:
data = {
"name": name,
"location": "M",
"headPosition": Vec3(0.0, 17.4756, -0.421),
"headEndPosition": Vec3(0.0, 19.5, -0.421),
"eyeLeftPosition": Vec3(0.3497, 18.0878, 0.6088),
"eyeRightPosition": Vec3(-0.3497, 18.0878, 0.6088),
"jawPosition": Vec3(0.0, 17.613, -0.2731)
}
self.loadData(data)
Profiler.getInstance().pop()
示例14: build
# 需要导入模块: from kraken.core.profiler import Profiler [as 别名]
# 或者: from kraken.core.profiler.Profiler import getInstance [as 别名]
def build(self, kSceneItem):
"""Builds the supplied kSceneItem into a DCC representation.
Args:
kSceneItem (object): kraken kSceneItem object to build.
Returns:
object: The DCC scene item of the kSceneItem that was passed to the builder.
"""
Profiler.getInstance().push("build:" + kSceneItem.getName())
try:
self._preBuild(kSceneItem)
self._build(kSceneItem)
finally:
self._postBuild()
# Clear Config when finished.
self.config.clearInstance()
Profiler.getInstance().pop()
return self.getDCCSceneItem(kSceneItem)
示例15: __init__
# 需要导入模块: from kraken.core.profiler import Profiler [as 别名]
# 或者: from kraken.core.profiler.Profiler import getInstance [as 别名]
def __init__(self, name):
Profiler.getInstance().push("Construct SpineClavRig:" + name)
super(SpineClavRig, self).__init__(name)
# Add Components to Layers
spineComponent = SpineComponentRig("spine", self)
spineComponent.loadData(data={
'cogPosition': Vec3(0.0, 11.1351, -0.1382),
'spine01Position': Vec3(0.0, 11.1351, -0.1382),
'spine02Position': Vec3(0.0, 11.8013, -0.1995),
'spine03Position': Vec3(0.0, 12.4496, -0.3649),
'spine04Position': Vec3(0.0, 13.1051, -0.4821),
'numDeformers': 4
})
clavicleLeftComponentGuide = ClavicleComponentGuide("clavicleGuide",
data={
"location": "L",
"clavicleXfo": Xfo(Vec3(0.1322, 15.403, -0.5723)),
"clavicleUpVXfo": Xfo(Vec3(0.0, 1.0, 0.0)),
"clavicleEndXfo": Xfo(Vec3(2.27, 15.295, -0.753))
})
clavicleLeftComponent = ClavicleComponentRig("clavicle", self)
clavicleLeftComponent.loadData(data=clavicleLeftComponentGuide.getRigBuildData())
# Clavicle to Spine
vertebraeOutputs = spineComponent.getOutputByName('spineVertebrae')
clavicleLeftSpineEndInput = clavicleLeftComponent.getInputByName('spineEnd')
clavicleLeftSpineEndInput.setConnection(vertebraeOutputs)
clavicleLeftSpineEndInput.setIndex(2)
Profiler.getInstance().pop()