SDK PLugin development - painting tool
Re: SDK PLugin development - painting tool
OK, so instead of calling TVExecute I call a single function of my own. I also changed the flags.
The undo problem is still there. When I press undo several times it changes the order of the layers. It doesn't know the user has made a brush stroke, because it the layer is updated by my code.
The undo problem is still there. When I press undo several times it changes the order of the layers. It doesn't know the user has made a brush stroke, because it the layer is updated by my code.
Re: SDK PLugin development - painting tool
Would it be possible that you post again your last version of your code and the dll to test it please, as you do some modification.
TVPaint Team
Re: SDK PLugin development - painting tool
Sure, I think I fixed the flags problem. Im pretty busy these days so Im not working on it too much.
https://www.dropbox.com/s/umeauwo59ml02 ... plugin.rar
https://www.dropbox.com/s/umeauwo59ml02 ... plugin.rar
Re: SDK PLugin development - painting tool
Hi, a quick question. I want to duplicate a layer like the Layer:Duplicate Instances button do. Is there a script command or SDK function to do that?
Thanks.
Thanks.
Re: SDK PLugin development - painting tool
tv_LayerDuplicate name ...?
Re: SDK PLugin development - painting tool
But it will duplicate the layer including its contents, no? I want the one the creates a layer with empty images. Maybe tv_layrDuplicate does that, Ill try
Re: SDK PLugin development - painting tool
I know that, but there is no george function in there only "key: ...." how do I do that in my plugin?
Re: SDK PLugin development - painting tool
oh sorry, I missed the "empty images" part of your question ...oferk wrote:But it will duplicate the layer including its contents, no? I want the one the creates a layer with empty images. Maybe tv_layrDuplicate does that, Ill try
well, you can firstly duplicate the layer, then "Clear Heads" with this command :
Code: Select all
tv_cmd Layerheads tv_clear 0
Re: SDK PLugin development - painting tool
So, I took a look at your code.oferk wrote:Sure, I think I fixed the flags problem. Im pretty busy these days so Im not working on it too much.
https://www.dropbox.com/s/umeauwo59ml02 ... plugin.rar
Could you try that:
_ when you want draw your brush in the PI_Msg function with
Code: Select all
for (int i = -brushSize; i < brushSize; ++i)
{
for (int j = -brushSize; j < brushSize; ++j)
{
int tmpX = MAX(x + i, 0);
tmpX = MIN(tmpX, iFilter->ImageWidth);
int tmpY = MAX(y + j, 0);
tmpY = MIN(tmpY, iFilter->ImageHeight);
int index = tmpX + iFilter->ImageWidth*tmpY;
iFilter->Current->Data[index].l = Data.mParams.color;
}
}
TVWriteLayerData(iFilter, NULL, 0, 0, iFilter->ImageWidth, iFilter->ImageHeight, 0, CB_WRITE_UPDATE);
Code: Select all
PIPixel b[10*10]; //the brush of size 10*10
PIPixel c;
c.l = Data.mParams.color;
for( int i = 0; i < 10*10; i++ )
b[i] = c;
TVWriteLayerData(iFilter, b, x-5, y-5, 10, 10, 0, CB_WRITE_UPDATE);
TVPaint Team
Re: SDK PLugin development - painting tool
yes! it works better! Great, thanks a lot. But it is not yet perfect. what happens now is the when I draw the first scribble I can undo it (because the plugin hasn't done anything). But after the second one the plugin does all his stuff, and then undoing causes weird things happen. I guess it is all because Im changing the current layer, and maybe writing to iFilter->Current in the end and this is wrong. I will continue to work on it.
What I would like to happen is that after the plugin paints and the user undos, only the last drawn scribble will be deleted, and the plugin will re-paint the image, but undoing the paint process doesn't make much sense.
I guess Im not clear enough but I need to think about this some more.
Here is a windows 32-bit binary:
https://www.dropbox.com/s/8hefp2hlrfpi7 ... ushTVP.dll" onclick="window.open(this.href);return false;
Thanks a lot!
What I would like to happen is that after the plugin paints and the user undos, only the last drawn scribble will be deleted, and the plugin will re-paint the image, but undoing the paint process doesn't make much sense.
I guess Im not clear enough but I need to think about this some more.
Here is a windows 32-bit binary:
https://www.dropbox.com/s/8hefp2hlrfpi7 ... ushTVP.dll" onclick="window.open(this.href);return false;
Thanks a lot!
Re: SDK PLugin development - painting tool
I just tried it out. But It dont seem to work at all.(Besides it of course makes TVPaint crash all the time and the undo is wrong). Is the purpose of this plugin to make a fill? And if it is possible for me to make it fill somehow how can I do this?
-Mads
-Mads
Re: SDK PLugin development - painting tool
Ok, I will give you some instructions, but if it crashes and you can tell me what exactly you are doing it will be great and I will fix the issue.
Usage:
This plug-in is a fill tool, but it works differently then a paint bucket. It will always fill the whole image with at least two colors. you use it like this:
1. draw your image on a layer, lets assume you draw a circle.
2. create two new layers below the drawing layer (you can do so quickly with the create layers button i have added to the plugin, it will also color and name the layers, and select the middle layer for you)
3. select the middle layer, if it is not already selected.
4. Now you need to start drawing scribbles to mark regions of different colors in your drawing. You paint a scribble using the "Add Scribble" button, and then painting a stroke. Paint a red stroke inside the circle.
5. Nothing should happen, because the algorithm needs at least two scribbles to work, so choose a second color and paint another scribble outside of the circle. Now the algorithm should work and paint the whole image. The colors are written to the third, lowest layer.
6. Now, depending on your drawing, you can add more scribble in more regions and the plug in will re-calculate the result and write it to the third layer.
Basically you must have three layers, the top one with the drawing (alpha based, so if you scanned a drawing, clean it with Basic Scan Cleaner), the second one for drawing scribbles and the third one for the result.
The algorithm takes into account the amount of "paint" in a region relative to other colors in the region, so if you a small shape you want to color you need not worry to paint a little outside the lines as other bigger scribbles will over come it.
I tested this usage on 4 computers, so it should work. of course there are still bugs and crashes that I need to find and fix.
Thanks a lot.
Usage:
This plug-in is a fill tool, but it works differently then a paint bucket. It will always fill the whole image with at least two colors. you use it like this:
1. draw your image on a layer, lets assume you draw a circle.
2. create two new layers below the drawing layer (you can do so quickly with the create layers button i have added to the plugin, it will also color and name the layers, and select the middle layer for you)
3. select the middle layer, if it is not already selected.
4. Now you need to start drawing scribbles to mark regions of different colors in your drawing. You paint a scribble using the "Add Scribble" button, and then painting a stroke. Paint a red stroke inside the circle.
5. Nothing should happen, because the algorithm needs at least two scribbles to work, so choose a second color and paint another scribble outside of the circle. Now the algorithm should work and paint the whole image. The colors are written to the third, lowest layer.
6. Now, depending on your drawing, you can add more scribble in more regions and the plug in will re-calculate the result and write it to the third layer.
Basically you must have three layers, the top one with the drawing (alpha based, so if you scanned a drawing, clean it with Basic Scan Cleaner), the second one for drawing scribbles and the third one for the result.
The algorithm takes into account the amount of "paint" in a region relative to other colors in the region, so if you a small shape you want to color you need not worry to paint a little outside the lines as other bigger scribbles will over come it.
I tested this usage on 4 computers, so it should work. of course there are still bugs and crashes that I need to find and fix.
Thanks a lot.
Re: SDK PLugin development - painting tool
Ok it works as you described. Is this the work flow for the final plugin?
It seems a little strange to me.
3 layers?
2 colors?
why not do a scribble on the outline layer and then the plugin would make a laxybrush fill on the layer below? with the current acolor?
or that is maybe the plan when this alpha version of the plugin is developed?
-Mads
It seems a little strange to me.
3 layers?
2 colors?
why not do a scribble on the outline layer and then the plugin would make a laxybrush fill on the layer below? with the current acolor?
or that is maybe the plan when this alpha version of the plugin is developed?
-Mads