SOLVED Make EditingTool select only certain objects



  • Hi,

    I'm creating a tool for mark positioning and I want to only select anchors while the tool is active. Sometimes points and anchors overlap in position. I can make it based on BaseEventTool but then I have to create more methods to select and move the anchors which already exist in EditingTool. It would be cool if EditingTool only accepted anchors for selection so I don't accidentally select other objects. This way I don't have to reinvent methods that already exist.

    Thanks



  • Thank you very much Frederik, this is very useful!


  • admin

    In the next beta and release an subclass of an EditingTool could overwrite:

    from mojo.events import EditingTool
    
    
    class MyTool(EditingTool):
    
        def canSelectAnchors(self):
            return True
    
        def canSelectImage(self):
            return False
    
        def canSelectComponents(self):
            return False
    
        def canSelectGuidelines(self):
            return False
    
        def canSelectPoints(self):
            return False
        
        def canSelectSidebearing(self):
            return False
    

  • admin

    This could idd be handy to have flags in a the EditingTool to allow to select/edit specific objects, like on curves, off curves, anchors, guidelines, image, components...



  • At the end, I made all the methods from scratch. After publishing I will post the link here.


Log in to reply