[Bf-funboard] Feature request: Accessing painted brush strokes from Python

Lubos Lenco lubos.lenco at gmail.com
Thu Feb 25 12:22:35 CET 2016


Thanks Jacob, got another idea from your suggestions. I could ‘block’ the brush when user starts painting and simulate the strokes one by one myself. This will probably be slower and I am also not sure about undo system as I will ‘spam’ it with lots of strokes. Should do for a start though! :)

> On 25 Feb 2016, at 01:09, Jacob Merrill <blueprintrandom1 at gmail.com> wrote:
> 
> Don't use the stroke at all ? (make your own stroke with your own script?)
> 
> I am passing my changes in the bge using the video texture module, (trying
> to at least)
> 
> I think you may be able to pass your own changes to the GPU using PyopenGL
> but I don't know about
> for the viewport/ BPY textures etc (I started in the BGE and am working my
> way into BPY)
> 
> either you pass your changes each frame, or just leave a 'stroke line' as
> you paint that stores a list of mouseUV positions?
> 
> Can you detect a keypress event in BPY?
> 
> (if keypress leftMouse +(some other key) -> log stroke ?)
> 
> 
> On Wed, Feb 24, 2016 at 3:44 PM, Lubos Lenco <lubos.lenco at gmail.com> wrote:
> 
>> This would be ideal, but when painting is in progress(ie mouse is being
>> held down and strokes are made), modals are blocked. This is reasonable as
>> you don’t want to accidentally click buttons and interact with other stuff
>> while painting, but in this case it makes it unable to log mouse. And there
>> seems to be no way to access mouse event outside of modal.
>> 
>>> On 25 Feb 2016, at 00:38, Jacob Merrill <blueprintrandom1 at gmail.com>
>> wrote:
>>> 
>>> 
>> http://blender.stackexchange.com/questions/13450/how-to-get-mouse-position-in-a-window-with-python
>>> 
>>> On Wed, Feb 24, 2016 at 2:10 PM, Lubos Lenco <lubos.lenco at gmail.com>
>> wrote:
>>> 
>>>> Hm, how to calculate ray start since I am not able to get mouse
>> position?
>>>> Is there a workaround for this?
>>>> 
>>>>> On 24 Feb 2016, at 23:00, Jacob Merrill <blueprintrandom1 at gmail.com>
>>>> wrote:
>>>>> 
>>>>> Bvtree, cast ray from mouse  at mesh, get hitFace and hitpoint, use
>>>>> vertex.uv and hitpoint to get UV
>>>>> On Feb 24, 2016 1:52 PM, "Lubos Lenco" <lubos.lenco at gmail.com> wrote:
>>>>> 
>>>>>> Hello,
>>>>>> 
>>>>>> I am looking for ability to paint to multiple paint slots at once,
>> using
>>>>>> the same strokes user performs but with different brush texture. This
>>>> would
>>>>>> be handy to create several textures on the fly, while the user only
>>>> paints
>>>>>> to single one.
>>>>>> 
>>>>>> The easiest way that comes to mind is exposing last painted strokes by
>>>>>> user. The painting to other slots can then be performed using
>>>>>> ops.paint.image_paint() operator as usual. There should probably be a
>>>>>> switch and only store strokes if it is enabled.
>>>>>> 
>>>>>> The other way I tried was to log mouse coords and construct strokes
>>>>>> myself, unfortunately the modals are blocked while user is painting
>> and
>>>> I
>>>>>> could not find any other way to access mouse positions apart from
>> modal
>>>>>> events.
>>>>>> 
>>>>>> I had a brief look around and could try to implement this, however I
>>>> would
>>>>>> be thankful if anyone could point me to the right direction, possibly
>>>> with
>>>>>> as much detail.
>>>>>> _______________________________________________
>>>>>> Bf-funboard mailing list
>>>>>> Bf-funboard at blender.org
>>>>>> http://lists.blender.org/mailman/listinfo/bf-funboard
>>>>>> 
>>>>> _______________________________________________
>>>>> Bf-funboard mailing list
>>>>> Bf-funboard at blender.org
>>>>> http://lists.blender.org/mailman/listinfo/bf-funboard
>>>> 
>>>> _______________________________________________
>>>> Bf-funboard mailing list
>>>> Bf-funboard at blender.org
>>>> http://lists.blender.org/mailman/listinfo/bf-funboard
>>>> 
>>> _______________________________________________
>>> Bf-funboard mailing list
>>> Bf-funboard at blender.org
>>> http://lists.blender.org/mailman/listinfo/bf-funboard
>> 
>> _______________________________________________
>> Bf-funboard mailing list
>> Bf-funboard at blender.org
>> http://lists.blender.org/mailman/listinfo/bf-funboard
>> 
> _______________________________________________
> Bf-funboard mailing list
> Bf-funboard at blender.org
> http://lists.blender.org/mailman/listinfo/bf-funboard



More information about the Bf-funboard mailing list