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 9 additions and 5 deletions
Showing only changes of commit d38e05d48a - Show all commits

View File

@ -320,7 +320,14 @@ void legacy_gpencil_to_grease_pencil(Main &main, GreasePencil &grease_pencil, bG

Put out of line.

Put out of line.
class GreasePencilRuntime {
public:
/**
filedescriptor marked this conversation as resolved Outdated

Same remark as above about commented out code.

Same remark as above about commented out code.
* Allocated and freed by the drawing code. See `DRW_grease_pencil_batch_cache_*` functions.
*/
void *batch_cache = nullptr;

These two functions should never have to be called outside of the ID callbacks in grease_pencil.cc; IMO they make more sense as static functions there. Probably better to keep that storage for DNA thing as localized as possible.

These two functions should never have to be called outside of the `ID` callbacks in `grease_pencil.cc`; IMO they make more sense as static functions there. Probably better to keep that storage for DNA thing as localized as possible.
public:
GreasePencilRuntime() {}
~GreasePencilRuntime() {}
};

Member variables come before functions https://wiki.blender.org/wiki/Style_Guide/C_Cpp#Class_Layout

Member variables come before functions https://wiki.blender.org/wiki/Style_Guide/C_Cpp#Class_Layout
} // namespace blender::bke

View File

@ -109,11 +109,8 @@ static void grease_pencil_copy_data(Main * /*bmain*/,
grease_pencil_src->active_layer->wrap().name());
}
/* Duplicate runtime data. */
if (grease_pencil_src->runtime) {
grease_pencil_dst->runtime = MEM_new<bke::GreasePencilRuntime>(__func__,
*grease_pencil_src->runtime);
}
/* Make sure the runtime pointer exists. */
grease_pencil_dst->runtime = MEM_new<bke::GreasePencilRuntime>(__func__);
}
filedescriptor marked this conversation as resolved Outdated

This cannot be 'just' copied like that, would assign the same batch_cache value to both copies e.g.

In general runtime data should not need to be copied anyway.

This cannot be 'just' copied like that, would assign the same `batch_cache` value to both copies e.g. In general runtime data should not need to be copied anyway.
static void grease_pencil_free_data(ID *id)