Initial Grease Pencil 3.0 stage #106848

Merged
Falk David merged 224 commits from filedescriptor/blender:grease-pencil-v3 into main 2023-05-30 11:14:22 +02:00
2 changed files with 22 additions and 0 deletions
Showing only changes of commit 30abf241bb - Show all commits

View File

@ -153,6 +153,15 @@ class Layer : public TreeNode, public ::GreasePencilLayer {
const Vector<LayerMask> &masks() const;
Vector<LayerMask> &masks_for_write();
/**

Better to return a span here maybe?

Better to return a span here maybe?
* \return true if the layer is visible.
*/
bool is_visible() const;
/**
* \return true if the layer is locked.
*/
bool is_locked() const;

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.

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.

View File

@ -390,6 +390,16 @@ Vector<LayerMask> &Layer::masks_for_write()
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)
{
return this->frames_for_write().add(frame_number, frame);
@ -1153,6 +1163,9 @@ void GreasePencil::foreach_visible_drawing(
blender::Span<GreasePencilDrawingBase *> drawings = this->drawings();
for (const Layer *layer : this->layers()) {
if (!layer->is_visible()) {
continue;
}
int index = layer->drawing_index_at(frame);
if (index == -1) {
continue;