mirror of
https://github.com/aseprite/aseprite.git
synced 2025-03-10 10:13:35 +00:00
Paint groups with a folder icon in the Timeline
This commit is contained in:
parent
389ea666e5
commit
44f44c3126
Binary file not shown.
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 14 KiB |
@ -329,6 +329,10 @@
|
|||||||
<part id="timeline_continuous_active" x="288" y="36" w="12" h="12" />
|
<part id="timeline_continuous_active" x="288" y="36" w="12" h="12" />
|
||||||
<part id="timeline_discontinuous_normal" x="276" y="48" w="12" h="12" />
|
<part id="timeline_discontinuous_normal" x="276" y="48" w="12" h="12" />
|
||||||
<part id="timeline_discontinuous_active" x="288" y="48" w="12" h="12" />
|
<part id="timeline_discontinuous_active" x="288" y="48" w="12" h="12" />
|
||||||
|
<part id="timeline_closed_group_normal" x="276" y="60" w="12" h="12" />
|
||||||
|
<part id="timeline_closed_group_active" x="288" y="60" w="12" h="12" />
|
||||||
|
<part id="timeline_open_group_normal" x="276" y="72" w="12" h="12" />
|
||||||
|
<part id="timeline_open_group_active" x="288" y="72" w="12" h="12" />
|
||||||
<part id="timeline_empty_frame_normal" x="240" y="60" w="12" h="12" />
|
<part id="timeline_empty_frame_normal" x="240" y="60" w="12" h="12" />
|
||||||
<part id="timeline_empty_frame_active" x="252" y="60" w="12" h="12" />
|
<part id="timeline_empty_frame_active" x="252" y="60" w="12" h="12" />
|
||||||
<part id="timeline_keyframe_normal" x="240" y="72" w="12" h="12" />
|
<part id="timeline_keyframe_normal" x="240" y="72" w="12" h="12" />
|
||||||
@ -560,6 +564,20 @@
|
|||||||
<icon part="timeline_discontinuous_active" />
|
<icon part="timeline_discontinuous_active" />
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
|
<!-- timeline_group -->
|
||||||
|
<style id="timeline_closed_group" base="timeline_box">
|
||||||
|
<icon part="timeline_closed_group_normal" align="center" valign="middle" />
|
||||||
|
</style>
|
||||||
|
<style id="timeline_closed_group:active">
|
||||||
|
<icon part="timeline_closed_group_active" />
|
||||||
|
</style>
|
||||||
|
<style id="timeline_open_group" base="timeline_box">
|
||||||
|
<icon part="timeline_open_group_normal" align="center" valign="middle" />
|
||||||
|
</style>
|
||||||
|
<style id="timeline_open_group:active">
|
||||||
|
<icon part="timeline_open_group_active" />
|
||||||
|
</style>
|
||||||
|
|
||||||
<!-- timeline_layer -->
|
<!-- timeline_layer -->
|
||||||
<style id="timeline_layer" base="timeline_box">
|
<style id="timeline_layer" base="timeline_box">
|
||||||
<text align="left" valign="middle" padding-left="4" />
|
<text align="left" valign="middle" padding-left="4" />
|
||||||
|
@ -662,8 +662,13 @@ bool Timeline::onProcessMessage(Message* msg)
|
|||||||
case PART_LAYER_CONTINUOUS_ICON:
|
case PART_LAYER_CONTINUOUS_ICON:
|
||||||
if (m_hot.layer == m_clk.layer && validLayer(m_hot.layer)) {
|
if (m_hot.layer == m_clk.layer && validLayer(m_hot.layer)) {
|
||||||
Layer* layer = m_layers[m_clk.layer];
|
Layer* layer = m_layers[m_clk.layer];
|
||||||
ASSERT(layer != NULL);
|
ASSERT(layer);
|
||||||
layer->setContinuous(!layer->isContinuous());
|
if (layer) {
|
||||||
|
if (layer->isImage())
|
||||||
|
layer->setContinuous(!layer->isContinuous());
|
||||||
|
else if (layer->isGroup())
|
||||||
|
layer->setCollapsed(!layer->isCollapsed());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -1355,13 +1360,22 @@ void Timeline::drawLayer(ui::Graphics* g, LayerIndex layerIdx)
|
|||||||
(hotlayer && m_hot.part == PART_LAYER_PADLOCK_ICON),
|
(hotlayer && m_hot.part == PART_LAYER_PADLOCK_ICON),
|
||||||
(clklayer && m_clk.part == PART_LAYER_PADLOCK_ICON));
|
(clklayer && m_clk.part == PART_LAYER_PADLOCK_ICON));
|
||||||
|
|
||||||
// Draw the continuous flag.
|
// Draw the continuous flag/group icon.
|
||||||
bounds = getPartBounds(Hit(PART_LAYER_CONTINUOUS_ICON, layerIdx));
|
bounds = getPartBounds(Hit(PART_LAYER_CONTINUOUS_ICON, layerIdx));
|
||||||
drawPart(g, bounds, NULL,
|
if (layer->isImage()) {
|
||||||
layer->isContinuous() ? styles.timelineContinuous(): styles.timelineDiscontinuous(),
|
drawPart(g, bounds, NULL,
|
||||||
is_active,
|
layer->isContinuous() ? styles.timelineContinuous(): styles.timelineDiscontinuous(),
|
||||||
(hotlayer && m_hot.part == PART_LAYER_CONTINUOUS_ICON),
|
is_active,
|
||||||
(clklayer && m_clk.part == PART_LAYER_CONTINUOUS_ICON));
|
(hotlayer && m_hot.part == PART_LAYER_CONTINUOUS_ICON),
|
||||||
|
(clklayer && m_clk.part == PART_LAYER_CONTINUOUS_ICON));
|
||||||
|
}
|
||||||
|
else if (layer->isGroup()) {
|
||||||
|
drawPart(g, bounds, NULL,
|
||||||
|
layer->isCollapsed() ? styles.timelineClosedGroup(): styles.timelineOpenGroup(),
|
||||||
|
is_active,
|
||||||
|
(hotlayer && m_hot.part == PART_LAYER_CONTINUOUS_ICON),
|
||||||
|
(clklayer && m_clk.part == PART_LAYER_CONTINUOUS_ICON));
|
||||||
|
}
|
||||||
|
|
||||||
// Get the layer's name bounds.
|
// Get the layer's name bounds.
|
||||||
bounds = getPartBounds(Hit(PART_LAYER_TEXT, layerIdx));
|
bounds = getPartBounds(Hit(PART_LAYER_TEXT, layerIdx));
|
||||||
@ -2179,11 +2193,14 @@ void Timeline::updateStatusBar(ui::Message* msg)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case PART_LAYER_CONTINUOUS_ICON:
|
case PART_LAYER_CONTINUOUS_ICON:
|
||||||
if (layer != NULL) {
|
if (layer) {
|
||||||
sb->setStatusText(0, "Layer '%s' is %s (%s)",
|
if (layer->isImage())
|
||||||
layer->name().c_str(),
|
sb->setStatusText(0, "Layer '%s' is %s (%s)",
|
||||||
layer->isContinuous() ? "continuous": "discontinuous",
|
layer->name().c_str(),
|
||||||
layer->isContinuous() ? "prefer linked cels/frames": "prefer individual cels/frames");
|
layer->isContinuous() ? "continuous": "discontinuous",
|
||||||
|
layer->isContinuous() ? "prefer linked cels/frames": "prefer individual cels/frames");
|
||||||
|
else if (layer->isGroup())
|
||||||
|
sb->setStatusText(0, "Group '%s'", layer->name().c_str());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -35,6 +35,7 @@ namespace doc {
|
|||||||
LockMove = 4, // Cannot be moved
|
LockMove = 4, // Cannot be moved
|
||||||
Background = 8, // Stack order cannot be changed
|
Background = 8, // Stack order cannot be changed
|
||||||
Continuous = 16, // Prefer to link cels when the user copy them
|
Continuous = 16, // Prefer to link cels when the user copy them
|
||||||
|
Collapsed = 32, // Prefer to show this group layer collapsed
|
||||||
|
|
||||||
BackgroundLayerFlags = LockMove | Background,
|
BackgroundLayerFlags = LockMove | Background,
|
||||||
};
|
};
|
||||||
@ -62,17 +63,21 @@ namespace doc {
|
|||||||
bool isImage() const { return type() == ObjectType::LayerImage; }
|
bool isImage() const { return type() == ObjectType::LayerImage; }
|
||||||
bool isGroup() const { return type() == ObjectType::LayerGroup; }
|
bool isGroup() const { return type() == ObjectType::LayerGroup; }
|
||||||
|
|
||||||
bool isBackground() const { return hasFlags(LayerFlags::Background); }
|
bool isBackground() const { return hasFlags(LayerFlags::Background); }
|
||||||
bool isVisible() const { return hasFlags(LayerFlags::Visible); }
|
bool isTransparent() const { return !hasFlags(LayerFlags::Background); }
|
||||||
bool isEditable() const { return hasFlags(LayerFlags::Editable); }
|
bool isVisible() const { return hasFlags(LayerFlags::Visible); }
|
||||||
bool isMovable() const { return !hasFlags(LayerFlags::LockMove); }
|
bool isEditable() const { return hasFlags(LayerFlags::Editable); }
|
||||||
bool isContinuous() const { return hasFlags(LayerFlags::Continuous); }
|
bool isMovable() const { return !hasFlags(LayerFlags::LockMove); }
|
||||||
|
bool isContinuous() const { return hasFlags(LayerFlags::Continuous); }
|
||||||
|
bool isCollapsed() const { return hasFlags(LayerFlags::Collapsed); }
|
||||||
|
bool isExpanded() const { return !hasFlags(LayerFlags::Collapsed); }
|
||||||
|
|
||||||
void setBackground(bool state) { switchFlags(LayerFlags::Background, state); }
|
void setBackground(bool state) { switchFlags(LayerFlags::Background, state); }
|
||||||
void setVisible (bool state) { switchFlags(LayerFlags::Visible, state); }
|
void setVisible (bool state) { switchFlags(LayerFlags::Visible, state); }
|
||||||
void setEditable (bool state) { switchFlags(LayerFlags::Editable, state); }
|
void setEditable (bool state) { switchFlags(LayerFlags::Editable, state); }
|
||||||
void setMovable (bool state) { switchFlags(LayerFlags::LockMove, !state); }
|
void setMovable (bool state) { switchFlags(LayerFlags::LockMove, !state); }
|
||||||
void setContinuous(bool state) { switchFlags(LayerFlags::Continuous, state); }
|
void setContinuous(bool state) { switchFlags(LayerFlags::Continuous, state); }
|
||||||
|
void setCollapsed (bool state) { switchFlags(LayerFlags::Collapsed, state); }
|
||||||
|
|
||||||
LayerFlags flags() const {
|
LayerFlags flags() const {
|
||||||
return m_flags;
|
return m_flags;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user