def onCopyPointCloud(): global lastRandomColor polyData = vtk.vtkPolyData() polyData.DeepCopy(pointCloudObj.polyData) if pointCloudObj.getChildFrame(): polyData = segmentation.transformPolyData( polyData, pointCloudObj.getChildFrame().transform) polyData = segmentation.addCoordArraysToPolyData(polyData) # generate random color, and average with a common color to make them generally similar lastRandomColor = lastRandomColor + 0.1 + 0.1 * random.random() rgb = colorsys.hls_to_rgb(lastRandomColor, 0.7, 1.0) obj = vis.showPolyData(polyData, pointCloudObj.getProperty('Name') + ' copy', color=rgb, parent='point clouds') #t = vtk.vtkTransform() #t.PostMultiply() #t.Translate(filterUtils.computeCentroid(polyData)) #segmentation.makeMovable(obj, t) om.setActiveObject(obj) pickedObj.setProperty('Visible', False)
def cycleEndEffector(self): if len(self.endEffectorFrames) is not 0: self.clearKeyframePoses() self.endEffectorFrames[self.endEffectorIndex].setProperty('Edit', False) self.endEffectorIndex = (self.endEffectorIndex + 1) % len(self.endEffectorFrames) self.endEffectorFrames[self.endEffectorIndex].setProperty('Edit', True) om.setActiveObject(self.endEffectorFrames[self.endEffectorIndex]) self.baseFrame = self.endEffectorFrames[self.endEffectorIndex] self.baseTransform = transformUtils.copyFrame(self.baseFrame.transform) self.resetDeltas() self.addKeyframePose()
def cycleEndEffector(self): if len(self.endEffectorFrames) is not 0: self.clearKeyframePoses() self.endEffectorFrames[self.endEffectorIndex].setProperty( 'Edit', False) self.endEffectorIndex = (self.endEffectorIndex + 1) % len( self.endEffectorFrames) self.endEffectorFrames[self.endEffectorIndex].setProperty( 'Edit', True) om.setActiveObject(self.endEffectorFrames[self.endEffectorIndex]) self.baseFrame = self.endEffectorFrames[self.endEffectorIndex] self.baseTransform = transformUtils.copyFrame( self.baseFrame.transform) self.resetDeltas() self.addKeyframePose()
def onCopyPointCloud(): global lastRandomColor polyData = vtk.vtkPolyData() polyData.DeepCopy(pointCloudObj.polyData) if pointCloudObj.getChildFrame(): polyData = segmentation.transformPolyData(polyData, pointCloudObj.getChildFrame().transform) polyData = segmentation.addCoordArraysToPolyData(polyData) # generate random color, and average with a common color to make them generally similar lastRandomColor = lastRandomColor + 0.1 + 0.1*random.random() rgb = colorsys.hls_to_rgb(lastRandomColor, 0.7, 1.0) obj = vis.showPolyData(polyData, pointCloudObj.getProperty('Name') + ' copy', color=rgb, parent='point clouds') t = vtk.vtkTransform() t.PostMultiply() t.Translate(filterUtils.computeCentroid(polyData)) segmentation.makeMovable(obj, t) om.setActiveObject(obj) pickedObj.setProperty('Visible', False)
def onDiskGlyph(): result = segmentation.applyDiskGlyphs(pointCloudObj.polyData) obj = vis.showPolyData(result, 'disks', color=[0.8,0.8,0.8]) om.setActiveObject(obj) pickedObj.setProperty('Visible', False)
def onSelect(): om.setActiveObject(pickedObj)