52 Q_ASSERT(!element.isNull());
68 if (layer->inherits(
"KisReferenceImagesLayer")) {
70 }
else if (layer->inherits(
"KisShapeLayer")) {
71 QDomElement layerElement =
m_doc.createElement(
LAYER);
73 m_elem.appendChild(layerElement);
77 else if (layer->inherits(
"KisFileLayer")) {
78 QDomElement layerElement =
m_doc.createElement(
LAYER);
84 QString path = fileLayer->
path();
86 QDir d(QFileInfo(
m_url).absolutePath());
89 layerElement.setAttribute(
"source", d.relativeFilePath(path));
91 layerElement.setAttribute(
"source", path);
95 layerElement.setAttribute(
"scale",
"true");
98 layerElement.setAttribute(
"scale",
"false");
100 layerElement.setAttribute(
"scalingmethod", (
int)fileLayer->
scalingMethod());
102 layerElement.setAttribute(
"scalingfilter", fileLayer->
scalingFilter());
104 m_elem.appendChild(layerElement);
113 QDomElement element = doc.createElement(
LAYER);
121 if (!saveLayerOffset) {
122 element.removeAttribute(
X);
123 element.removeAttribute(
Y);
131 QDomElement copy = el;
133 if (!loadLayerOffset) {
134 copy.removeAttribute(
X);
135 copy.removeAttribute(
Y);
148 m_elem.appendChild(layerElement);
155 QDomElement layerElement;
165 m_elem.appendChild(layerElement);
168 Q_ASSERT(!layerElement.isNull());
169 layerElement.appendChild(elem);
180 QMapIterator<const KisNode*, QString> i(visitor.
nodeFileNames());
181 while (i.hasNext()) {
187 while (i.hasNext()) {
200 QDomElement layerElement =
m_doc.createElement(
LAYER);
204 m_elem.appendChild(layerElement);
212 QDomElement layerElement =
m_doc.createElement(
LAYER);
216 m_elem.appendChild(layerElement);
224 QDomElement layerElement =
m_doc.createElement(
LAYER);
229 m_elem.appendChild(layerElement);
241 QDomElement el =
m_doc.createElement(
MASK);
256 QDomElement el =
m_doc.createElement(
MASK);
268 QDomElement el =
m_doc.createElement(
MASK);
278 QDomElement el =
m_doc.createElement(
MASK);
289 QDomElement el =
m_doc.createElement(
MASK);
299 if (el.hasAttribute(
NAME)) {
300 QString layerName = el.attribute(
NAME);
301 if (layerName != layer->
name()) {
311 if (el.hasAttribute(
OPACITY)) {
319 if (el.hasAttribute(
VISIBLE)) {
323 if (el.hasAttribute(
LOCKED)) {
327 if (el.hasAttribute(
X)) {
328 layer->
setX(el.attribute(
X).toInt());
331 if (el.hasAttribute(
Y)) {
332 layer->
setY(el.attribute(
Y).toInt());
335 if (el.hasAttribute(
UUID)) {
336 layer->
setUuid(QUuid::fromString(el.attribute(
UUID)));
353 QUuid uuid(uuidString);
354 if (!uuid.isNull()) {
356 dumbLayerStyle->setUuid(uuid);
359 warnKrita <<
"WARNING: Layer style for layer" << layer->
name() <<
"contains invalid UUID" << uuidString;
363 if (layer->inherits(
"KisShapeLayer") && el.hasAttribute(
ANTIALIASED)) {
372 QString keyframeFile = nodeFilename +
".keyframes.xml";
383 el.setAttribute(
NAME, layer->
name());
390 el.setAttribute(
X, layer->
x());
391 el.setAttribute(
Y, layer->
y());
392 el.setAttribute(
UUID, layer->
uuid().toString());
407 if (node.
data() == layer) {
408 el.setAttribute(
"selected",
"true");
419 <<
" of type " << layerType
420 <<
" with filename " <<
LAYER + QString::number(
m_count);
425 QString filename =
MASK + QString::number(
m_count);
427 el.setAttribute(
NAME, mask->
name());
432 el.setAttribute(
X, mask->
x());
433 el.setAttribute(
Y, mask->
y());
434 el.setAttribute(
UUID, mask->
uuid().toString());
464 <<
" of type " << maskType
465 <<
" with filename " << filename;
471 QDomElement elem =
m_doc.createElement(
MASKS);
472 Q_ASSERT(!layerElement.isNull());
473 layerElement.appendChild(elem);
482 QMapIterator<const KisNode*, QString> i(visitor.
nodeFileNames());
483 while (i.hasNext()) {
489 while (i.hasNext()) {
504 QDomElement layerElement =
m_doc.createElement(
LAYER);
508 Q_FOREACH(
KoShape *shape, referencesLayer->shapes()) {
511 reference->saveXml(
m_doc, layerElement, nextId);
515 m_elem.appendChild(layerElement);
bool limitToDeviceBounds() const
qreal cleanUpAmount() const
qreal fuzzyRadius() const
bool useEdgeDetection() const
qreal edgeDetectionSize() const
The KisFileLayer class loads a particular file as a layer into the layer stack.
ScalingMethod scalingMethod() const
QString scalingFilter() const
static const KoID colorizeEditKeyStrokes
static QVariant nodeProperty(KisNodeSP node, const KoID &id, const QVariant &defaultValue)
static const KoID colorizeShowColoring
virtual KisFilterConfigurationSP filter() const
bool visitAllInverse(KisNode *node, bool breakOnFail=false)
const KoColorSpace * colorSpace() const
The KisReferenceImage class represents a single reference image.
KisSaveXmlVisitor(QDomDocument doc, const QDomElement &element, quint32 &count, const QString &url, bool root)
bool saveReferenceImagesLayer(KisExternalLayer *layer)
QStringList m_errorMessages
static void loadPaintLayerAttributes(const QDomElement &el, KisPaintLayer *layer, bool loadLayerOffset)
QMap< const KisNode *, QString > keyframeFileNames()
QMap< const KisNode *, QString > nodeFileNames()
bool visit(KisNode *) override
bool saveMasks(KisNode *node, QDomElement &layerElement)
QStringList errorMessages() const
void saveNodeKeyframes(const KisNode *node, QString filename, QDomElement &el)
QMap< const KisNode *, QString > m_nodeFileNames
void saveLayer(QDomElement &el, const QString &layerType, const KisLayer *layer)
void saveMask(QDomElement &el, const QString &maskType, const KisMaskSP mask)
QDomElement savePaintLayerAttributes(KisPaintLayer *layer, QDomDocument &doc, bool saveLayerOffset)
QMap< const KisNode *, QString > m_keyframeFileNames
static void loadLayerAttributes(const QDomElement &el, KisLayer *layer)
void setSelectedNodes(vKisNodeSP selectedNodes)
vKisNodeSP m_selectedNodes
void setAntialiased(const bool antialiased)
virtual const KoColorProfile * profile() const =0
bool boolProperty(const QString &name, bool defaultValue=false) const
#define KIS_SAFE_ASSERT_RECOVER_RETURN_VALUE(cond, val)
#define KIS_SAFE_ASSERT_RECOVER_NOOP(cond)
const QString COLORIZE_CLEANUP
const QString TRANSPARENCY_MASK
const QString COLORIZE_FUZZY_RADIUS
const QString GENERATOR_NAME
const QString FILTER_NAME
const QString CLONE_FROM_UUID
const QString COLORIZE_EDIT_KEYSTROKES
const QString COLOR_LABEL
QString flagsToString(const QBitArray &flags, int size=-1, char trueToken='1', char falseToken='0', bool defaultTrue=true)
const QString PASS_THROUGH_MODE
const QString COLORIZE_EDGE_DETECTION_SIZE
const QString COMPOSITE_OP
const QString KEYFRAME_FILE
const QString PAINT_LAYER
const QString GROUP_LAYER
const QString VISIBLE_IN_TIMELINE
const QString COLORIZE_MASK
QBitArray stringToFlags(const QString &string, int size=-1, char token='0', bool defaultTrue=true)
const QString CHANNEL_LOCK_FLAGS
const QString GENERATOR_VERSION
const QString TRANSFORM_MASK
const QString COLORIZE_SHOW_COLORING
const QString ONION_SKIN_ENABLED
const QString REFERENCE_IMAGES_LAYER
const QString COLORIZE_USE_EDGE_DETECTION
const QString FILTER_VERSION
const QString ANTIALIASED
const QString FILTER_MASK
const QString CLONE_LAYER
const QString SHAPE_LAYER
const QString GENERATOR_LAYER
const QString COLORSPACE_NAME
const QString SELECTION_MASK
const QString COLORIZE_LIMIT_TO_DEVICE
const QString LAYER_STYLE_UUID
const QString CHANNEL_FLAGS
const QString ADJUSTMENT_LAYER
QString toString(const QString &value)
void setPinnedToTimeline(bool pinned)
virtual void setUserLocked(bool l)
const QString & compositeOpId() const
void setOpacity(quint8 val)
virtual void setVisible(bool visible, bool loading=false)
bool isPinnedToTimeline() const
const KoProperties & nodeProperties() const
void setUuid(const QUuid &id)
void setColorLabelIndex(int index)
void setName(const QString &name)
void setCollapsed(bool collapsed)
int colorLabelIndex() const
void setCompositeOpId(const QString &compositeOpId)
virtual bool visible(bool recursive=false) const
KisNodeUuidInfo copyFromInfo
CopyLayerType copyType() const
const KoColorSpace * colorSpace() const override
qint32 y() const override
const KoCompositeOp * compositeOp() const override
returns the layer's composite op for the colorspace of the layer's parent.
qint32 x() const override
KisPSDLayerStyleSP layerStyle
void setX(qint32 x) override
virtual void setChannelFlags(const QBitArray &channelFlags)
KisPaintDeviceSP original() const override=0
void setLayerStyle(KisPSDLayerStyleSP layerStyle)
void setY(qint32 y) override
qint32 x() const override
qint32 y() const override
const KoColorSpace * colorSpace() const override
quint32 childCount() const
The KisPSDLayerStyle class implements loading, saving and applying the PSD layer effects.
const QBitArray & channelLockFlags() const
void setChannelLockFlags(const QBitArray &channelFlags)
KisPaintDeviceSP paintDevice
bool onionSkinEnabled() const