Hi There guys,
I was trying to be smart ass and copied a code from someone else to try to make it work as I need it but I can't do it.
Can you guys help me out?
Basically I need a code to decrease or increase incrementally the opacity of the selected brush.
What I have is this:
bOppacity = 10 <- My problem is how to make this not 10 but the actual opacity + 10 or -10
tv_GetActiveTool
Parse Result TT dummy
tv_Cmd TT Opacity bOppacity
tnx,
Leandro
Increase Brush Opacity
Re: Increase Brush Opacity
Here you go
Make an action paste this code into embedded george script
you can change delta to for instance -2 if you want a script that decreases the opacity with -2
Enjoy
Mads
Make an action paste this code into embedded george script
you can change delta to for instance -2 if you want a script that decreases the opacity with -2
Code: Select all
Param none
delta = 10
tv_getActiveShape
activeShape=result
tv_setActiveShape activeShape backup
values = result
PARSE values tool restValues
IF CMP(tool,"tv_setactiveshape")==1
PARSE restValues shape mode modeVAL vector vectorA vectorB vectorC vectorC aaliasing aaliasingVAL map_xbrush map_xbrushVAL map_xbrushz map_xbrushzVAL map_gradient map_gradientVAL map_xopacity map_xopacityVAL map_yopacity map_yopacityVAL opacity opacityVAL gap gapVAL expand expandVAL range rangeVAL src srcVAL autopickcolor autopickcolorVAL smooth smoothVAL
IF CMP(opacity,"opacity")==1
newOpacity = opacityVAL+delta
tv_setactiveshape shape 'opacity' newOpacity
END
EXIT
END
IF CMP(tool,"tv_restorebrush")==1
parse restValues mode modeVAL width widthVAL height heightVAL step stepVAL opacity opacityVAL rest
newOpacity = opacityVAL+delta
tv_cmd tool opacity newOpacity
EXIT
END
IF CMP(tool,"tv_setactiveshape")==0
parse restValues one oneVal two twoVal three threeVal four fourVal five fiveVal six sixVal seven sevenVal eight eightVal
newOpacity = fourVal+delta
tv_cmd tool opacity newOpacity
END

Re: Increase Brush Opacity
I just made a edit so it also works with custom brushes.
it is a little trick because as far as I know the different tools have different george commands. If anyone knows a smarter way to obtain this please let me know
-Mads
it is a little trick because as far as I know the different tools have different george commands. If anyone knows a smarter way to obtain this please let me know
-Mads
Re: Increase Brush Opacity
Thanks a lot madsjuul!!
That's exactly what I was looking for. Already use this code to set up my tablet.
I hope this hadn't given you too much work in the end.
Took a look at your site by the way.. Great stuff there... I am studying storyboard myself. So you draw and do programming right?
That's rare talent!
Take care,

Leandro
That's exactly what I was looking for. Already use this code to set up my tablet.
I hope this hadn't given you too much work in the end.
Took a look at your site by the way.. Great stuff there... I am studying storyboard myself. So you draw and do programming right?
That's rare talent!
Take care,

Leandro
Re: Increase Brush Opacity
Hi Mads,
A few simplifications I think (tv_AreaInit command helps)...
Sven
A few simplifications I think (tv_AreaInit command helps)...
Code: Select all
// OpacityShift.grg
Param None
delta = 10 // set increment or decrement
tv_GetActiveShape
ShapeMode = result // preserve shapemode
tv_AreaInit Opacity
parse result d AreaOpac // get opacity setting for shape
tv_GetActiveTool
parse result ToolMode d // get active tool
tv_cmd ToolMode Opacity
parse result d ToolOpac // get opacity setting for active tool
AreaOpac = AreaOpac + Delta // calculate opacity increment or decrement for fill
ToolOpac = ToolOpac + Delta // calculate opacity increment or decrement for tool
tv_cmd ToolMode Opacity ToolOpac // set new opacity for tool
tv_AreaInit Opacity AreaOpac // set new opacity for fill
tv_SetActiveShape ShapeMode // restores shapemode (lost whenever retrieving info about tool)
Re: Increase Brush Opacity
You'r welcome glad you can use itleandro wrote:Thanks a lot madsjuul!!
That's exactly what I was looking for. Already use this code to set up my tablet.
No problem I needed a break from the storyboard I was sitting doing.leandro wrote: I hope this hadn't given you too much work in the end.
Thank you.leandro wrote: Took a look at your site by the way.. Great stuff there... I am studying storyboard myself. So you draw and do programming right?
That's rare talent!
I really like to draw especially storyboards. But I also have an old interest in mathematics and physics, as a child I dreamed about being an inventor. Later came the thought
about doing animation, So the scripting is me as an 'inventor'

You toleandro wrote: Take care,
Leandro
-Mads
Re: Increase Brush Opacity
thank you for sharing Sven I'm not familiar with the tv_areaInit command I will look into it.Svengali wrote:Hi Mads,
A few simplifications I think (tv_AreaInit command helps)...
It nice to learn from how others approach the same problem.
One thing your script does that wasn't intended by mine(but maybe Leandro better like this?) is that it increases the opacity of the fill and the line tools simultaniously.
MIne was supposed only to increase the current tool.
-mads
Re: Increase Brush Opacity
Thank you Sven and Mads,
I got both Scripts saved here in any case.

I got both Scripts saved here in any case.
