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 4 additions and 42 deletions
Showing only changes of commit 0504c6a5a3 - Show all commits

View File

@ -251,7 +251,7 @@ class LayerGroupRuntime {
class LayerGroup : public ::GreasePencilLayerTreeGroup {
public:
LayerGroup();
explicit LayerGroup(const StringRefNull name);
explicit LayerGroup(StringRefNull name);
LayerGroup(const LayerGroup &other);
~LayerGroup();
@ -279,7 +279,8 @@ class LayerGroup : public ::GreasePencilLayerTreeGroup {
int64_t num_nodes_total() const;
/**
* Removes a child from the group by index.
* Removes a child from the group by index. Does not free the memory.
* \note: Assumes the removed child is not the active layer.
*/
void remove_child(int64_t index);
@ -318,13 +319,6 @@ void legacy_gpencil_to_grease_pencil(Main &main, GreasePencil &grease_pencil, bG
class GreasePencilRuntime {
public:
void *batch_cache = nullptr;
public:
// bool has_active_layer() const;
// const greasepencil::Layer &active_layer() const;
// greasepencil::Layer &active_layer_for_write();
// void set_active_layer_index(int index);
// int active_layer_index() const;
};
} // namespace blender::bke

View File

@ -17,7 +17,7 @@ namespace blender::bke::greasepencil::tests {
/* Grease Pencil ID Tests. */
/* Note: Using a struct with constructor and destructor instead of a fixture here, to have all the
* tests in the same group. */
* tests in the same group (`greasepencil`). */
struct GreasePencilIDTestContext {
Main *bmain = nullptr;
@ -41,38 +41,6 @@ TEST(greasepencil, create_grease_pencil_id)
EXPECT_EQ(grease_pencil.root_group.wrap().num_nodes_total(), 0);
}
// TEST(greasepencil, set_active_layer_index)
// {
// GreasePencilIDTestContext ctx;
// GreasePencil &grease_pencil = *static_cast<GreasePencil *>(BKE_id_new(ctx.bmain, ID_GP,
// "GP")); grease_pencil.add_empty_drawings(3);
// const Layer &layer1 = grease_pencil.root_group.wrap().add_layer("Layer1");
// const Layer &layer2 = grease_pencil.root_group.wrap().add_layer("Layer2");
// grease_pencil.runtime->set_active_layer_index(0);
// EXPECT_TRUE(grease_pencil.runtime->has_active_layer());
// EXPECT_STREQ(layer1.name, grease_pencil.runtime->active_layer().name);
// grease_pencil.runtime->set_active_layer_index(1);
// EXPECT_TRUE(grease_pencil.runtime->has_active_layer());
// EXPECT_STREQ(layer2.name, grease_pencil.runtime->active_layer().name);
// /* Save to storage. */
// grease_pencil.free_layer_tree_storage();
// grease_pencil.save_layer_tree_to_storage();
// MEM_delete(grease_pencil.runtime);
// /* Load from storage. */
// grease_pencil.runtime = MEM_new<blender::bke::GreasePencilRuntime>(__func__);
// grease_pencil.load_layer_tree_from_storage();
// /* Check if the active layer is still the second one. */
// EXPECT_TRUE(grease_pencil.runtime->has_active_layer());
// EXPECT_STREQ(grease_pencil.runtime->active_layer().name, "Layer2");
// }
/* --------------------------------------------------------------------------------------------- */
/* Drawing Array Tests. */