Page 1 of 1

Is it possible to invoke DrawMe() of an inactive tool?

Posted: Wed Jan 31, 2024 1:05 am
by KuzKuz
Hello, is it possible to call the DrawMe() function of an inactive tool in such a way that it can draw its graphics in the viewport?

Re: Is it possible to invoke DrawMe() of an inactive tool?

Posted: Wed Jan 31, 2024 1:37 am
by SimplSam
There are a number of tools that already do this like TransformPoints:

Code: Select all

function LM_TransformPoints:DrawMe(moho, view)
...
    if (self.mode == self.selectMode and self.dragging) then
        LM_SelectPoints:DrawMe(moho, view)
        ...
    end
...
end

Re: Is it possible to invoke DrawMe() of an inactive tool?

Posted: Wed Jan 31, 2024 1:56 am
by KuzKuz
Sorry, I might have asked the question incorrectly. I meant that the tool itself could invoke its DrawMe() even when it's not active. So that its graphics could be visible when any other tool is active, without the need to modify all tools.

Re: Is it possible to invoke DrawMe() of an inactive tool?

Posted: Tue Feb 06, 2024 9:40 am
by Lukas
KuzKuz wrote: Wed Jan 31, 2024 1:56 am[...] modify all tools.
This is how I've always achieved what I needed. But it would be nice to have it invoked on its own for sure...

Re: Is it possible to invoke DrawMe() of an inactive tool?

Posted: Tue Feb 06, 2024 12:22 pm
by hayasidist
A thought --- DrawMe needs a MohoView. Is there any way that the "guts of the script" could provide the script's "IsEnabled" with a view that could be usable in its DrawMe() function???


I've had a go at this, and I can get IsEnabled to call DrawMe with a view object that I saved from the mainline run -- but right now I'm actually failing to get DrawMe to draw anything, even when in the tool's normal run-mode, so I've obviously screwed up somewhere in my DrawMe function... Sorry, but sorting that out is for another day - in the meantime, I'm logging this in the hope that it helps you guys make progress