Is it hard to make a plug-in?

I was wondering how hard it is to make a plug-in, specifically for Krita. I am very lightly entertaining the idea to make one, not even seriously considering it. Just curious to know the general process and how many headaches it’s going to induce if I ever even try.

1 Like

I’m going to take a big leap in assumption because I know squat zero about plug-ins, but is there a lot of coding involved? (This feels like a dumb question lmao)

Have you studied plugins at all?
You can download one from here (chosen at random):
Compact Brush Toggler - #142 by kaichi1342
The GDrive link will be the easiest to download.

Here is a small extract from some of the code:

 def selectBrushContainer(self,br_property):
        editor = self.get_brush_editor()
        option_widget_container = editor.findChild(QWidget, 'frmOptionWidgetContainer')
        current_view = None
        selectedRow  = None 

        tra_property = self.translate(br_property)

        for view in option_widget_container.findChildren(QListView):
            if view.metaObject().className() == 'KisCategorizedListView':
                if view.isVisibleTo(option_widget_container):
                    current_view = view
                    break
                
        if current_view:
            current_settings_widget = current_view.parent()
            s_model = current_view.selectionModel()
            model = current_view.model()
            target_index = None
            for row in range(model.rowCount()):
                index = model.index(row,0)   
                if index.data() == tra_property: 
                    target_index = index
                    selectedRow = row
                    break
                    
            if target_index is not None: 
                s_model.clear()
                s_model.select(target_index, QItemSelectionModel.SelectCurrent)
                s_model.setCurrentIndex(target_index, QItemSelectionModel.SelectCurrent)
                current_view.setCurrentIndex(target_index)
                current_view.activated.emit(target_index)
2 Likes

Additional information and materials you would need if you want to tap your toes into the sea of code:

Krita scripting school:
https://scripting.krita.org/lessons/introduction

Krita scripting school action dictionary:
https://scripting.krita.org/action-dictionary

Krita scripting school icon library:
https://scripting.krita.org/icon-library

This is the most important tool to support you in coding extensions for Krita:
Python Plugin Developer Tools

Krita’s source code:

… and if you not only tap your toes but jump into the sea of Krita’s code, you’ll be happy to have access to →
Krita’s class hierarchy:

By the way, there are other ways to access this, but I don’t want to overwhelm you with that.

Michelist

3 Likes

If you have no coding experience, it will be significantly more difficult than say, writing a quick toy program in Python that only works with text input and output.

The best idea would be to start with that first, write a few small Python programs (unrelated to Krita), and see if it’s your cup of tea.

Once you get to writing a plugin, you can definitely ask for pointers here and overcome obstacles with the help of experienced users on the forums.

Another observation, something very important – even if you have zero coding experience, as long as you have a clear and strong goal of what you want to achieve in Krita, then you will likely succeed, or at least have a good shot at it :slight_smile: So maybe even better, start with fleshing out your idea in words and mockups and decide if it’s something that you really want to commit to.

4 Likes