Initial Grease Pencil 3.0 stage #106848
|
@ -153,6 +153,15 @@ class Layer : public TreeNode, public ::GreasePencilLayer {
|
||||||
const Vector<LayerMask> &masks() const;
|
const Vector<LayerMask> &masks() const;
|
||||||
Vector<LayerMask> &masks_for_write();
|
Vector<LayerMask> &masks_for_write();
|
||||||
|
|
||||||
|
/**
|
||||||
|
|||||||
|
* \return true if the layer is visible.
|
||||||
|
*/
|
||||||
|
bool is_visible() const;
|
||||||
|
/**
|
||||||
|
* \return true if the layer is locked.
|
||||||
|
*/
|
||||||
|
bool is_locked() const;
|
||||||
Falk David
commented
Put out of line. Put out of line.
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Inserts the frame into the layer. Fails if there exists a frame at \a frame_number already.
|
* Inserts the frame into the layer. Fails if there exists a frame at \a frame_number already.
|
||||||
Hans Goudey
commented
The function is "is_locked" and the comment says "return if it is locked". This sort of comment doesn't add anything IMO, just wastes space. If there is a comment, maybe it should use a different word besides "locked" to describe the state. Or there doesn't need to be a comment at all. The function is "is_locked" and the comment says "return if it is locked". This sort of comment doesn't add anything IMO, just wastes space. If there is a comment, maybe it should use a different word besides "locked" to describe the state. Or there doesn't need to be a comment at all.
|
|||||||
* \returns true on success.
|
* \returns true on success.
|
||||||
|
|
|
@ -390,6 +390,16 @@ Vector<LayerMask> &Layer::masks_for_write()
|
||||||
return this->masks_;
|
return this->masks_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Layer::is_visible() const
|
||||||
|
{
|
||||||
|
return (this->flag & GP_LAYER_TREE_NODE_HIDE) == 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool Layer::is_locked() const
|
||||||
|
{
|
||||||
|
return (this->flag & GP_LAYER_TREE_NODE_LOCKED) != 0;
|
||||||
|
}
|
||||||
|
|
||||||
bool Layer::insert_frame(int frame_number, GreasePencilFrame &frame)
|
bool Layer::insert_frame(int frame_number, GreasePencilFrame &frame)
|
||||||
{
|
{
|
||||||
return this->frames_for_write().add(frame_number, frame);
|
return this->frames_for_write().add(frame_number, frame);
|
||||||
|
@ -1153,6 +1163,9 @@ void GreasePencil::foreach_visible_drawing(
|
||||||
|
|
||||||
blender::Span<GreasePencilDrawingBase *> drawings = this->drawings();
|
blender::Span<GreasePencilDrawingBase *> drawings = this->drawings();
|
||||||
for (const Layer *layer : this->layers()) {
|
for (const Layer *layer : this->layers()) {
|
||||||
|
if (!layer->is_visible()) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
int index = layer->drawing_index_at(frame);
|
int index = layer->drawing_index_at(frame);
|
||||||
if (index == -1) {
|
if (index == -1) {
|
||||||
continue;
|
continue;
|
||||||
|
|
Loading…
Reference in New Issue
Better to return a span here maybe?