torontoqert.blogg.se

Krita duplicate selection
Krita duplicate selection






I will continue to tweak and improve this script.

KRITA DUPLICATE SELECTION CODE

  • Is there a way to use continuous selection without click action? If there is another, the code might run faster.
  • Can’t I use shrink() for selections without tSelection()?.
  • There are small areas that fail to be painted.
  • It does not respond when the active layer is a group layer.Why does it work when used in Scripter…?.
  • Slow operation when targeting images larger than 1000Pix.
  • However, it is not yet a practical script for the following reasonsĬurrent problems and suggestions for improvement (If you enable time.sleep(2) on line 246, you can also use it in the scripter, since execution will be after two seconds.) RootNodepix = rootNode.projectionPixelData(0, 0, w, h) RootCopy = activeDoc.createNode("rootCopy", "paintlayer") #Avoid having the same tool twice in a row.Īpplication.action('PanTool').trigger()#連続で同じツールを持たないよう回避Īpplication.action('KisToolSelectContiguous').trigger()#select tool TopNode = activeDoc.topLevelNodes().pop() RootNode.addChildNode(closerNode, topNode)Īpplication.action('deselect').trigger()#変な選択あるから一旦掃除 ProcessedLineSe2 = processedLineSe.duplicate()ĪtSelection(processedLineSe2)#最も狭い隙間を閉じるもの RedNode = activeDoc.createNode("redNode", "paintlayer")ĬloserNode = activeDoc.createNode("closerNode", "paintlayer")ĬtBlendingMode("not_converse")#否定逆論理 SelectionP元 = processedLineSe.duplicate()ĭef fillExpantion():#Expand the selection inside the line SelectionPL2 = processedLineSe.duplicate()

    krita duplicate selection

    SelectionPL1 = processedLineSe.duplicate() #Scope for eliminating unwanted parts of the lid. ReactsToGapSe = processedLineSe.duplicate()ĮraseLineSe = processedLineSe.duplicate() ProcessedLineSe = createSelection(lineNode, transparentFilter) Pixels = bytes(pixel_ptr.asarray(teCount())) Image = QImage(w, h, QImage.Format_ARGB32) #使い方selection = createSelection(doc.activeNode(), transparentFilter)ĭef fillColor(node, colorx):#選択範囲に関係なく全面が色づく tPixelData(selectionData, x, y, width, height)ĭef transparentFilter(r, g, b, a):#不透明度の閾値を数値で決める SelectionData = bytearray(width * height)įor i, rgba in enumerate(iter_unpack('>BBBB', pixelData)): PixelData = bytes(node.projectionPixelData(x, y, width, height)) Width, height = bounds.width(), bounds.height() ndEvent(canvas, table_release)įilt = application.filter('edge detection')ĭef createSelection(node, filterFunc):#Converting an image to selection PosF = QPointF(canvas.mapFromGlobal(global_pos)) If c.metaObject().className() = 'KisCanvasController':ĭef click_canvas(global_pos=None):#click action Q_mdi_sub_window = q_mdi_area.currentSubWindow() Q_mdi_area = q_stacked_widget.currentWidget() Q_stacked_widget = q_window.centralWidget() Q_window = application.activeWindow().qwindow() (coloring is not included in the code) from struct import iter_unpack

    krita duplicate selection

    If it works correctly, you can make the selections shown in the image above. You can try it out by setting up this script in Ten Scripts and running the script at any cursor position.






    Krita duplicate selection