本文整理汇总了Python中mh.redraw函数的典型用法代码示例。如果您正苦于以下问题:Python redraw函数的具体用法?Python redraw怎么用?Python redraw使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了redraw函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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()
开发者ID:RuliLG,项目名称:makehuman,代码行数:32,代码来源:0_modeling_background.py
示例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()
开发者ID:kingomyths,项目名称:mhx_os,代码行数:34,代码来源:skeletonlibrary.py
示例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()
开发者ID:TeoTwawki,项目名称:makehuman,代码行数:7,代码来源:7_scripting.py
示例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()
开发者ID:Iffar,项目名称:makehuman_datagen,代码行数:32,代码来源:0_modeling_4_microdetails.py
示例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()
开发者ID:mistajuliax,项目名称:community-plugins,代码行数:7,代码来源:_modifiers.py
示例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()
开发者ID:severin-lemaignan,项目名称:makehuman-commandline,代码行数:32,代码来源:debugtab.py
示例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()
开发者ID:TeoTwawki,项目名称:makehuman,代码行数:28,代码来源:skeletonlibrary.py
示例8: onHide
def onHide(self, event):
gui3d.TaskView.onHide(self, event)
self.human.setShadeless(0)
self.human.mesh.configureShading(diffuse = self.oldDiffuseShaderSetting)
mh.redraw()
开发者ID:orezpraw,项目名称:unnaturalcode,代码行数:7,代码来源:0_modeling_background.py
示例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()
开发者ID:orezpraw,项目名称:unnaturalcode,代码行数:33,代码来源:0_modeling_background.py
示例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()
开发者ID:orezpraw,项目名称:unnaturalcode,代码行数:7,代码来源:0_modeling_background.py
示例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()
开发者ID:TeoTwawki,项目名称:makehuman,代码行数:34,代码来源:skeletonlibrary.py
示例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()
开发者ID:mistajuliax,项目名称:community-plugins,代码行数:8,代码来源:_modifiers.py
示例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()
开发者ID:orezpraw,项目名称:unnaturalcode,代码行数:8,代码来源:0_modeling_background.py
示例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()
开发者ID:TeoTwawki,项目名称:makehuman,代码行数:9,代码来源:skeletonlibrary.py
示例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")
开发者ID:RuliLG,项目名称:makehuman,代码行数:9,代码来源:0_modeling_background.py
示例16: refresh
def refresh(self, keepSelections=True):
self.clearList()
files = set(self.sort.sort(self.sortBy, list(self.search())))
self.loadHandler.refresh(files)
self.applyTagFilter()
mh.redraw()
self.callEvent('onRefresh', self)
开发者ID:ihavenick,项目名称:MakeHuman,代码行数:10,代码来源:filechooser.py
示例17: onShow
def onShow(self, event):
# When the task gets shown, set the focus to the file chooser
gui3d.app.selectedHuman.hide()
gui3d.TaskView.onShow(self, event)
self.filechooser.setFocus()
# HACK: otherwise the toolbar background disappears for some weird reason
mh.redraw()
开发者ID:RuliLG,项目名称:makehuman,代码行数:11,代码来源:guiload.py
示例18: setBackgroundEnabled
def setBackgroundEnabled(self, enable):
if enable:
if self.isBackgroundSet():
self.setBackgroundImage(self.getCurrentSide())
self.backgroundImageToggle.setChecked(True)
mh.redraw()
else:
gui3d.app.prompt('Background', 'No background image is set.\nTo show a background, choose an image from the Background tab\nin Settings.', 'Ok', None, None, None, 'backgroundChooseInfo')
else: # Disable
self.backgroundImage.hide()
self.backgroundImageToggle.setChecked(False)
mh.redraw()
开发者ID:orezpraw,项目名称:unnaturalcode,代码行数:12,代码来源:0_modeling_background.py
示例19: symmetrize
def symmetrize(self, direction='r'):
"""
This method applies either left to right or right to left symmetry to
the currently selected body parts.
Parameters
----------
direction:
*string*. A string indicating whether to apply left to right
symmetry (\"r\") or right to left symmetry (\"l\").
"""
if direction == 'l':
prefix1 = 'l-'
prefix2 = 'r-'
else:
prefix1 = 'r-'
prefix2 = 'l-'
# Remove current values
for target in list(self.targetsDetailStack.keys()):
targetName = os.path.basename(target)
# Reset previous targets on symm side
if targetName[:2] == prefix2:
targetVal = self.targetsDetailStack[target]
algos3d.loadTranslationTarget(self.meshData, target, -targetVal, None, 1, 0)
del self.targetsDetailStack[target]
# Apply symm target. For horiz movement the value must be inverted
for target in list(self.targetsDetailStack.keys()):
targetName = os.path.basename(target)
if targetName[:2] == prefix1:
targetSym = os.path.join(os.path.dirname(target), prefix2 + targetName[2:])
targetSymVal = self.targetsDetailStack[target]
if 'trans-in' in targetSym:
targetSym = targetSym.replace('trans-in', 'trans-out')
elif 'trans-out' in targetSym:
targetSym = targetSym.replace('trans-out', 'trans-in')
algos3d.loadTranslationTarget(self.meshData, targetSym, targetSymVal, None, 1, 1)
self.targetsDetailStack[targetSym] = targetSymVal
self.updateProxyMesh()
if self.isSubdivided():
self.getSubdivisionMesh()
mh.redraw()
开发者ID:ihavenick,项目名称:MakeHuman,代码行数:53,代码来源:human.py
示例20: setBackgroundEnabled
def setBackgroundEnabled(self, enable):
if enable:
if self.isBackgroundSet():
self.setBackgroundImage(self.getCurrentSide())
self.backgroundImageToggle.setChecked(True)
mh.redraw()
else:
mh.changeTask('Textures', 'Background')
else: # Disable
self.backgroundImage.hide()
self.backgroundImageToggle.setChecked(False)
mh.redraw()
开发者ID:Iffar,项目名称:makehuman_datagen,代码行数:12,代码来源:0_modeling_background.py
注:本文中的mh.redraw函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论