Skip to main content

Module copy

Module copy 

Source
Expand description

Copying layers from another .clip (from name-studio’s clip-core).

A layer is copied with the rows its row links to, following the id links ParamScheme lists (LinkTable, for example Layer → VectorObjectList), as CSP itself links them. Every copied row gets a new MainId (see ClipFile::next_main_id), columns owned by the canvas or the layer (OwnerType 2 and 4) get the target’s ids, and external chunks (vector data) are copied under new ids.

The target file may lack the tables and columns the copied rows use (CSP creates VectorObjectList only when a file first has a vector layer): merge_schema and merge_columns add them with their ParamScheme and ElemScheme rows. Vector objects name their brush by BrushStyle.MainId, so brush styles are copied keeping their ids (share_rows) when the target has none, together with the rows brush styles link to (tip and texture images, spray shapes, effector graphs): CSP crashes on opening a file whose brush style names a texture that is not there.

Structs§

ColumnInfo
What ParamScheme says about one column.
CopyLayer
Options for ClipFile::copy_layer_from.
RowCopier
Copies rows, and everything they link to, from one file’s database to another’s.

Constants§

DROPPED_LAYER_LINKS
Layer columns that would tie a copy to data that is not copied: masks, frame images, 3D, rulers and the like. A copy gets NULL in them, as CSP’s own layers without these have: CSP crashes drawing a vector layer whose ComicFrameLineMipmap is 0 rather than NULL.
LAYER_CANVAS_COLUMNS
The Canvas columns copied with the tables of LAYER_TABLES.
LAYER_TABLES
Tables (and Canvas columns) a vector or text layer copied from another file needs: vector lines find their brush styles through Canvas.BrushStyleManager, and without it CSP opens them empty. Canvas.BrushStyleReadProtect070 (1 in newer files) comes with the brush styles: it seems to tell CSP how to read them (not needed by any file tried so far, but the styles were saved with it).
OWNER_CANVAS
ParamScheme.OwnerType of a column holding the canvas id.
OWNER_LAYER
ParamScheme.OwnerType of a column holding the owning layer’s id.
SHARED_TABLES
Rows vector objects refer to by id, copied keeping their ids: the brush styles and every table BrushStyleManager and BrushStyle link to.

Functions§

brush_style_in
id when target has that brush style, else its first brush style (or id when it has none): the brush a copied vector object should name.
column_infos
ParamScheme information for the columns of table.
external_columns
(table, column) pairs whose values are external chunk ids.
insert_row
Insert row into table, keeping only the columns the table has.
merge_columns
Give target’s existing table the columns source has (only those in only, when given), with their ParamScheme rows.
merge_schema
Give target every table and column of tables that source has, with their ParamScheme and ElemScheme rows.
share_rows
Copy the rows of tables keeping their ids, for each table that is empty in target, and point Canvas.BrushStyleManager at the copied manager when the target has none. When brush styles are copied, the source’s Canvas.BrushStyleReadProtect070 comes with them. Returns the tables copied. Links out of the copied rows are left as they are (see ClipFile::prepare_copy_from for brush textures).

Type Aliases§

PayloadHook
Rewrites an external payload while it is copied: (table, column, payload).
RowHook
Rewrites the copied Layer row before it is inserted.