本文整理汇总了Python中mh.redraw函数的典型用法代码示例。如果您正苦于以下问题:Python redraw函数的具体用法?Python redraw怎么用?Python redraw使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了redraw函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: onFileSelected
def onFileSelected(filename):
if self.bgImageFrontRadioButton.selected:
self.filenames["front"] = filename
elif self.bgImageBackRadioButton.selected:
self.filenames["back"] = filename
elif self.bgImageLeftRadioButton.selected:
self.filenames["left"] = filename
elif self.bgImageRightRadioButton.selected:
self.filenames["right"] = filename
elif self.bgImageTopRadioButton.selected:
self.filenames["top"] = filename
elif self.bgImageBottomRadioButton.selected:
self.filenames["bottom"] = filename
self.texture.loadImage(mh.Image(os.path.join(self.backgroundsFolder, filename)))
bg = self.backgroundImage
bg.mesh.setTexture(os.path.join(self.backgroundsFolder, filename))
aspect = 1.0 * self.texture.width / self.texture.height
bg.setPosition([-aspect, -1, 0])
bg.mesh.resize(2.0 * aspect, 2.0)
# Switch to orthogonal view
gui3d.app.modelCamera.switchToOrtho()
bg.show()
self.backgroundImageToggle.setChecked(True)
mh.changeTask("Modelling", "Background")
mh.redraw()
示例2: onShow
def onShow(self, event):
gui3d.TaskView.onShow(self, event)
if gui3d.app.settings.get('cameraAutoZoom', True):
gui3d.app.setGlobalCamera()
# Disable smoothing in skeleton library
self.oldSmoothValue = self.human.isSubdivided()
self.human.setSubdivided(False)
self.oldHumanMat = self.human.material.clone()
self.oldPxyMats = dict()
xray_mat = material.fromFile(mh.getSysDataPath('materials/xray.mhmat'))
self.human.material = xray_mat
for pxy in self.human.getProxies(includeHumanProxy=False):
obj = pxy.object
self.oldPxyMats[pxy.uuid] = obj.material.clone()
obj.material = xray_mat
if self.skelObj:
self.skelObj.show()
#if not self.jointsObj:
# self.drawJointHelpers()
#self.filechooser.refresh()
# Make sure skeleton is updated when human has changed
self.human.getSkeleton()
# Re-draw joints positions if human has changed
if self.humanChanged:
#self.drawJointHelpers()
self.humanChanged = False
mh.redraw()
示例3: updateModelingParameters
def updateModelingParameters(self, dictOfParameterNameAndValue):
log.message("SCRIPT: updateModelingParameters("+str(dictOfParameterNameAndValue)+")")
for key, value in dictOfParameterNameAndValue.iteritems():
modifier = self.human.getModifier(key)
modifier.setValue(value)
self.human.applyAllTargets()
mh.redraw()
示例4: onMouseMoved
def onMouseMoved(self, event):
human = gui3d.app.selectedHuman
groups = []
if self.micro:
log.debug("%s", event.group)
groups.append(event.group)
if human.symmetryModeEnabled:
sg = human.getSymmetryGroup(event.group)
if sg:
groups.append(sg)
else:
part = human.getPartNameForGroupName(event.group.name)
for g in human.mesh.faceGroups:
if part in g.name:
groups.append(g)
if human.symmetryModeEnabled:
sg = human.getSymmetryGroup(g)
if sg:
groups.append(sg)
for g in self.selectedGroups:
if g not in groups:
g.setColor([255, 255, 255, 255])
for g in groups:
if g not in self.selectedGroups:
g.setColor([0, 255, 0, 255])
self.selectedGroups = groups
mh.redraw()
示例5: applyTarget
def applyTarget(self,targetName,power, assumeThreading = False):
self.human.setDetail(mh.getSysDataPath("targets/" + targetName + ".target"), power)
if assumeThreading:
self._threadSafeApplyAllTargets()
else:
self.human.applyAllTargets()
mh.redraw()
示例6: drawSkeleton
def drawSkeleton(self):
self._unloadSkeletonMesh()
skel = self.human.getSkeleton()
if not skel:
return
# Create a mesh from the user-selected skeleton in its current pose (so we use the base skeleton for actually posing)
self.skelMesh = skeleton_drawing.meshFromSkeleton(skel, "Prism")
self.skelMesh.name = self.skelMesh.name + '-skeletonDebug'
self.skelMesh.priority = 100
self.skelMesh.setPickable(False)
self.skelObj = self.addObject(gui3d.Object(self.skelMesh, self.human.getPosition()) )
self.skelObj.setShadeless(0)
self.skelObj.setSolid(0)
self.skelObj.setRotation(self.human.getRotation())
self.skelMesh.setVisibility(self.showBonesTggl.selected)
self.axisMesh = skeleton_drawing.meshFromSkeleton(skel, "axis")
self.axisMesh.name = self.axisMesh.name + '-axis-skeletonDebug'
self.axisMesh.priority = 100
self.axisMesh.setPickable(False)
self.axisObj = self.addObject(gui3d.Object(self.axisMesh, self.human.getPosition()) )
self.axisObj.material.ambientColor = [0.2, 0.2, 0.2]
self.axisObj.material.configureShading(vertexColors=True)
self.axisObj.material.depthless = True
self.axisObj.setRotation(self.human.getRotation())
self.axisObj.setVisibility(self.showAxisTggl.selected)
self.drawPlanes(skel)
mh.redraw()
示例7: drawSkeleton
def drawSkeleton(self, skel):
if self.skelObj:
# Remove old skeleton mesh
self.removeObject(self.skelObj)
self.human.removeBoundMesh(self.skelObj.name)
self.skelObj = None
self.skelMesh = None
if not skel:
return
# Create a mesh from the skeleton in rest pose
skel.setToRestPose() # Make sure skeleton is in rest pose when constructing the skeleton mesh
self.skelMesh = skeleton_drawing.meshFromSkeleton(skel, "Prism")
self.skelMesh.priority = 100
self.skelMesh.setPickable(False)
self.skelObj = self.addObject(gui3d.Object(self.skelMesh, self.human.getPosition()) )
self.skelObj.setShadeless(0)
self.skelObj.setSolid(0)
self.skelObj.setRotation(self.human.getRotation())
# Add the skeleton mesh to the human AnimatedMesh so it animates together with the skeleton
# The skeleton mesh is supposed to be constructed from the skeleton in rest and receives
# rigid vertex-bone weights (for each vertex exactly one weight of 1 to one bone)
mapping = skeleton_drawing.getVertBoneMapping(skel, self.skelMesh)
self.human.addBoundMesh(self.skelMesh, mapping)
mh.redraw()
示例8: onHide
def onHide(self, event):
gui3d.TaskView.onHide(self, event)
self.human.setShadeless(0)
self.human.mesh.configureShading(diffuse = self.oldDiffuseShaderSetting)
mh.redraw()
示例9: projectBackground
def projectBackground(self):
if not self.backgroundChooserView.isBackgroundShowing():
gui3d.app.prompt("Warning", "You need to load a background for the current view before you can project it.", "OK")
return
mesh = self.human.getSeedMesh()
# for all quads, project vertex to screen
# if one vertex falls in bg rect, project screen quad into uv quad
# warp image region into texture
((x0,y0,z0), (x1,y1,z1)) = self.backgroundImage.mesh.calcBBox()
camera = mh.cameras[self.backgroundImage.mesh.cameraMode]
x0, y0, _ = camera.convertToScreen(x0, y0, z0, self.backgroundImage.mesh)
x1, y1, _ = camera.convertToScreen(x1, y1, z1, self.backgroundImage.mesh)
leftTop = (x0, y1)
rightBottom = (x1, y0)
dstImg = projection.mapImage(self.backgroundImage, mesh, leftTop, rightBottom)
texPath = mh.getPath('data/skins/projection.png')
if os.path.isfile(texPath):
oldImg = mh.Image(texPath)
else:
oldImg = None
gui3d.app.do(ProjectionAction("Change projected background texture",
self.human.getTexture(),
texPath,
oldImg,
dstImg))
log.debug("Enabling shadeless rendering on body")
self.shadelessButton.setChecked(True)
self.human.setShadeless(1)
mh.redraw()
示例10: onShow
def onShow(self, event):
gui3d.TaskView.onShow(self, event)
self.human.setShadeless(1 if self.shadelessButton.selected else 0)
self.oldDiffuseShaderSetting = self.human.material.shaderConfig['diffuse']
self.human.mesh.configureShading(diffuse = True)
mh.redraw()
示例11: drawJointHelpers
def drawJointHelpers(self):
"""
Draw the joint helpers from the basemesh that define the default or
reference rig.
"""
if self.jointsObj:
self.removeObject(self.jointsObj)
self.jointsObj = None
self.jointsMesh = None
self.selectedJoint = None
jointPositions = []
# TODO maybe define a getter for this list in the skeleton module
jointGroupNames = [group.name for group in self.human.meshData.faceGroups if group.name.startswith("joint-")]
if self.human.getSkeleton():
jointGroupNames += self.human.getSkeleton().joint_pos_idxs.keys()
for groupName in jointGroupNames:
jointPositions.append(self.human.getSkeleton().getJointPosition(groupName, self.human))
else:
for groupName in jointGroupNames:
jointPositions.append(skeleton._getHumanJointPosition(self.human, groupName))
self.jointsMesh = skeleton_drawing.meshFromJoints(jointPositions, jointGroupNames)
self.jointsMesh.priority = 100
self.jointsMesh.setPickable(False)
self.jointsObj = self.addObject( gui3d.Object(self.jointsMesh, self.human.getPosition()) )
self.jointsObj.setRotation(self.human.getRotation())
color = np.asarray([255, 255, 0, 255], dtype=np.uint8)
self.jointsMesh.color[:] = color[None,:]
self.jointsMesh.markCoords(colr=True)
self.jointsMesh.sync_color()
mh.redraw()
示例12: applyModifier
def applyModifier(self, modifierName, power, assumeThreading = False):
modifier = self.human.getModifier(modifierName)
modifier.setValue(power)
if assumeThreading:
self._threadSafeApplyAllTargets()
else:
self.human.applyAllTargets()
mh.redraw()
示例13: setShowBgInFront
def setShowBgInFront(self, enabled):
if enabled:
priority = 100
else:
priority = -90
for obj in self.planeMeshes.values():
obj.mesh.priority = priority
mh.redraw()
示例14: onHide
def onHide(self, event):
gui3d.TaskView.onHide(self, event)
self.human.material = self.oldHumanMat
for pxy in self.human.getProxies(includeHumanProxy=False):
if pxy.uuid in self.oldPxyMats:
pxy.object.material = self.oldPxyMats[pxy.uuid]
mh.redraw()
示例15: toggleBackground
def toggleBackground(self):
if not self.backgroundImageToggle.isChecked():
self.backgroundImage.hide()
mh.redraw()
elif self.backgroundImage.hasTexture():
self.backgroundImage.show()
mh.redraw()
else:
mh.changeTask("Library", "Background")