Custom Script

How do i make a script to : ctrl shift + a → ctrl+x → [ctrl+v “auto on the colorart layer”?]

Hi Nicky,

Would that be automatically from the Line Art and would it be based on a selection, or the entire content of the Line Art without a selection necessary?

Marie-Eve

Voila. This takes everything in the current Line Art and pastes it in the Colour Art.
There is no selection involved or Art layer selection. It’s straight forward. You can add this script to your Camera or Drawing view toolbar.
Make sure your Camera or Drawing view is active.

Test it first! :slight_smile: It works on my side, but you never know.

function cutFromLineArtToColourArt(){

//This sets the Line Art as the currently selected art layer.
DrawingTools.setCurrentArt(4);


//This starts the event culumation to undo in one operation.
scene.beginUndoRedoAccum("Cut from Line Art - Paste to Colour Art");

//Selects all the content of the Line Art
Action.perform("selectAll()", "drawingView,cameraView");

//Cuts the selection
Action.perform("cut()", "drawingView,cameraView");

//This sets the Colour Art as the currently selected art layer.
DrawingTools.setCurrentArt(2);

//Pastes the selection in the Colour art
Action.perform("paste()", "drawingView,cameraView");

//This ends the undo cummulation.
scene.endUndoRedoAccum();

//This sets the Line Art back as the currently selected art layer.
DrawingTools.setCurrentArt(4);

}//END OF FUNCTION

thank you so much I plan to use this for auto-patching

It works but not 100% I have to be in the drawing view for it to work with multiple drawings, i.e if I’m in the camera view then it only works with the first drawing no matter if I select drawing 5 it copies and paste “not cut” the first drawing to color-art-layer of drawing 5 but if I’m in the draw view it works 99% because i don’t want the lineart to be cut only the fill / color.

Hi Marie-Eve,

thank you for the scripting support, here on the forum!!!

Ah! I see, i see.

It’s strange… For me it works for any drawing in the camera view. I scroll my playhead to the drawing i want to transfer and it does it.

The script requires a few adjustments. At this time, I used the action selectAll() to grab everything in line art.

Since it’s for auto-patching, I guess you are using pencil lines right?

Is the outline colour always the same? In Harmony 14, we added hooks to script with the palettes, which could be an option; select everything else but the current colour.

http://docs.toonboom.com/help/harmony-14/scripting/script/a00042.html

I would have to review the script a bit later.

Marie-Eve

ok thank you,
if possible I would like it to select fill only.

Hi,

I reactivate this topic as I’m trying to do the same thing.
I would like to know if there is a way to select/deselect strokes (which would mean fills) independently from pencil lines and vice versa.

I know that I should separate Line Art and Colour Art. But, sometimes I don’t want to do that. :slight_smile:

Hello stefman,

When you ask for this feature, are you talking about inside a script or outside a script?

Both. :slight_smile:

It would like it to be an Option and/or Operation used in combination with the ‘Select Tool’.

As I don’t find it, I would like to have the possibility to do it via a script.

Hello,

Unfortunately there is no way to do that this way even in a script.

But it exists an option called “Select Strokes painted With Current Colour” (http://docs.toonboom.com/help/harmony-14/premium/colour/select-stroke-current-colour.html?Highlight=Select%20by%20colour)
This allow you to select all the drawings in your layer that’s using a particular colour, so if your fill is different than your line, it will select only the fill.

Thank you Alexis.

This will work in my present case as I use separate colours for Lines and Fills and as I didn’t create different line colours yet.

So, I’ll be able to select all my Lines via their colour.

But, I think that it would be a good feature if one could select according to if they are Pencil Lines or Fills, if this was an option for the Select Tool and even the Cutter Tool, Eraser Tool and Paint Tool.

Hi Marie-Eve,

how would you do the

select everything else but the current colour
that you mentioned?

Best regards

Hi nickyb2k16 and Marie-Eve,

I slidely modified Marie-Eve’s script to cut/paste the Fills only.

Actually. it doesn’t know if it deals with strokes or pencil lines.
It uses the '‘Select Strokes With Current Colour’ command and then simply inverts the selection before cutting/pasting it.

So, what you have to to before running the script is select in the palette view the colour swatch of the colour of your outlines (the Line Art). In other words, you select the colour of the lines you would like to remain on the level where they are.

The script will transfer the rest to the ‘Colour Art’ Level.

function cutFromLineArtToColourArt(){

//This sets the Line Art as the currently selected art layer.
DrawingTools.setCurrentArt(4);

//This starts the event culumation to undo in one operation.
scene.beginUndoRedoAccum(“Cut from Line Art - Paste to Colour Art”);

//Selects all the content of the Line Art
Action.perform(“onActionSelectAllCurrentColor()”, “drawingView,cameraView”);
Action.perform(“invertSelection()”, “drawingView,cameraView”);

//Cuts the selection
Action.perform(“cut()”, “drawingView,cameraView”);

//This sets the Colour Art as the currently selected art layer.
DrawingTools.setCurrentArt(2);

//Pastes the selection in the Colour art
Action.perform(“paste()”, “drawingView,cameraView”);

//This ends the undo cummulation.
scene.endUndoRedoAccum();

//This sets the Line Art back as the currently selected art layer.
//DrawingTools.setCurrentArt(4);

}//END OF FUNCTION

thank you stefman,
I tweaked your tweak from "Action.perform(“invertSelection()” to Action.perform(“invertSelectall()”
and now it works just like i wanted from the beginning without having to click or select anything but the layer.

function cutFromLineArtToColourArt(){

//This sets the Line Art as the currently selected art layer.
DrawingTools.setCurrentArt(4);

//This starts the event culumation to undo in one operation.
scene.beginUndoRedoAccum(“Cut from Line Art - Paste to Colour Art”);

//Selects all the content of the Line Art
Action.perform(“onActionSelectAllCurrentColor()”, “drawingView,cameraView”);
Action.perform(“invertSelectall()”, “drawingView,cameraView”);

//Cuts the selection
Action.perform(“cut()”, “drawingView,cameraView”);

//This sets the Colour Art as the currently selected art layer.
DrawingTools.setCurrentArt(2);

//Pastes the selection in the Colour art
Action.perform(“paste()”, “drawingView,cameraView”);

//This ends the undo cummulation.
scene.endUndoRedoAccum();

//This sets the Line Art back as the currently selected art layer.
//DrawingTools.setCurrentArt(4);

}//END OF FUNCTION

Cool,

I didn’t know this action.

I’ll have to look at that again to understand the difference between “invertSelection()” and “invertSelectall()”. :slight_smile:

Or, can you tell me what the difference is?

i have no idea my mind just told me to change it base on what little i know about code language.