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
9 changed files with 26 additions and 10 deletions
Showing only changes of commit 53fa7c7945 - Show all commits

View File

@ -1989,7 +1989,7 @@ class _defs_gpencil_paint:
operator="gpencil.draw",
),
)

Picky detail, but there should not be extra spaces on this empty line ;)

Picky detail, but there should not be extra spaces on this empty line ;)
@ToolDef.from_fn
def cutter():
def draw_settings(_context, layout, tool):

View File

@ -114,7 +114,7 @@ class Layer : public TreeNode, public ::GreasePencilLayer {
* {0: 0, 5: 1, 10: -1, 12: 2, 16: -1}
*
* In this example there are three drawings (drawing #0, drawing #1 and drawing #2). The first
* drawing starts at frame 0 and ends at frame 5 (excusive). The second drawing starts at
* drawing starts at frame 0 and ends at frame 5 (exclusive). The second drawing starts at

exclusive

`exclusive`
* frame 5 and ends at frame 10. Finally, the third drawing starts at frame 12 and ends at
* frame 16.
*

I am a bit confused here.

Following the text, it seems it should be Frame and Drawing (not Time and Frame).

Or, the description needs to be updated (and a good argument made why the common terms Time and Frame are redefined in the grease pencil).

I am a bit confused here. Following the text, it seems it should be `Frame` and `Drawing` (not `Time` and `Frame`). Or, the description needs to be updated (and a good argument made why the common terms `Time` and `Frame` are redefined in the grease pencil).

Ah yes, Frame is the term we use for a Drawing at a particular time. I agree that this is very confusing here. I am not sure what a better term would be.

Ah yes, `Frame` is the term we use for a `Drawing` at a particular time. I agree that this is very confusing here. I am not sure what a better term would be.

I see. The GreasePencilFrame is nice and unambiguous. And within a context of GP it is not bad to stick to general rule "frame means grease pencil frame".

But when you refer to frame as a moment in time, is the best to use "scene frame". So, it will be something rhe first drawing starts at scene frame 0 and ends at scene frame 5 (exclusive) (btw exclusive not excusive)`.

Also use the same "scene frame" in diagram below. Generally time in Blender is scene frame number divided by the scene fps, and is measured in seconds.

I see. The `GreasePencilFrame` is nice and unambiguous. And within a context of GP it is not bad to stick to general rule "frame means grease pencil frame". But when you refer to frame as a moment in time, is the best to use "scene frame". So, it will be something `rhe first drawing starts at scene frame 0 and ends at scene frame 5 (exclusive)` (btw exclusive not excusive)`. Also use the same "scene frame" in diagram below. Generally time in Blender is scene frame number divided by the scene fps, and is measured in seconds.
@ -207,11 +207,11 @@ class LayerGroup : public TreeNode {
*/
mutable CacheMutex children_cache_mutex_;

Put out of line.

Put out of line.
/**
* Caches all the children of this group in a single pre-order vector.
* Caches all the children of this group in a single pre-ordered vector.

Not sure what is a 'pre-order vector'? or is a typo? Like pre-ordered vector? Same below.

Not sure what is a 'pre-order vector'? or is a typo? Like `pre-ordered vector`? Same below.
*/
mutable Vector<TreeNode *> children_cache_;
/**
* Caches all the layers in this group in a single pre-order vector.
* Caches all the layers in this group in a single pre-ordered vector.
*/
mutable Vector<Layer *> layer_cache_;

View File

@ -684,7 +684,6 @@ GreasePencil *BKE_grease_pencil_new_nomain()
{
GreasePencil *grease_pencil = reinterpret_cast<GreasePencil *>(
BKE_id_new_nomain(ID_GP, nullptr));
grease_pencil_init_data(&grease_pencil->id);
return grease_pencil;

This should not be needed, BKE_id_new_nomain already calls BKE_libblock_init_empty which calls the relevant initi_data callback.

This should not be needed, `BKE_id_new_nomain` already calls `BKE_libblock_init_empty` which calls the relevant `initi_data` callback.
}

View File

@ -454,6 +454,8 @@ uint64_t BKE_library_id_can_use_filter_id(const ID *id_owner)
return FILTER_ID_IM;
case ID_GD_LEGACY:
return FILTER_ID_MA;
case ID_GP:
return FILTER_ID_GP | FILTER_ID_MA;
case ID_WS:
return FILTER_ID_SCE;
case ID_CV:
@ -480,8 +482,6 @@ uint64_t BKE_library_id_can_use_filter_id(const ID *id_owner)
case ID_IP:
/* Deprecated... */

Would rather add the new case immediately after the legacy GP one... At the very least before the generic 'do nothing' block of cases, and the deprecated ones.

Would rather add the new case immediately after the legacy GP one... At the very least before the generic 'do nothing' block of cases, and the deprecated ones.
return 0;
case ID_GP:
return FILTER_ID_GP | FILTER_ID_MA;
}
BLI_assert_unreachable();

View File

@ -632,6 +632,8 @@ ListBase *which_libbase(Main *bmain, short type)
return &(bmain->wm);
case ID_GD_LEGACY:
return &(bmain->gpencils);
case ID_GP:
return &(bmain->grease_pencils);
case ID_MC:
return &(bmain->movieclips);
case ID_MSK:
@ -654,8 +656,6 @@ ListBase *which_libbase(Main *bmain, short type)
return &(bmain->volumes);
case ID_SIM:

Same as above.

Same as above.
return &(bmain->simulations);
case ID_GP:
return &(bmain->grease_pencils);
}
return NULL;
}
@ -677,6 +677,7 @@ int set_listbasepointers(Main *bmain, ListBase *lb[/*INDEX_ID_MAX*/])
/* Referenced by nodes, objects, view, scene etc, before to free after. */
lb[INDEX_ID_GD_LEGACY] = &(bmain->gpencils);
lb[INDEX_ID_GP] = &(bmain->grease_pencils);
lb[INDEX_ID_NT] = &(bmain->nodetrees);
lb[INDEX_ID_IM] = &(bmain->images);
@ -721,7 +722,6 @@ int set_listbasepointers(Main *bmain, ListBase *lb[/*INDEX_ID_MAX*/])
lb[INDEX_ID_WM] = &(bmain->wm);
lb[INDEX_ID_MSK] = &(bmain->masks);
lb[INDEX_ID_SIM] = &(bmain->simulations);

Same as above.

Same as above.
lb[INDEX_ID_GP] = &(bmain->grease_pencils);
lb[INDEX_ID_NULL] = NULL;

View File

@ -1109,7 +1109,11 @@ static const char *template_id_browse_tip(const StructRNA *type)
case ID_PA:
return N_("Browse Particle Settings to be linked");
case ID_GD_LEGACY:
#ifdef WITH_GREASE_PENCIL_V3

Shouldn't this change also be conditioned by the #ifdef WITH_GREASE_PENCIL_V3?

Shouldn't this change also be conditioned by the `#ifdef WITH_GREASE_PENCIL_V3`?
return N_("Browse Grease Pencil (legacy) Data to be linked");
#else
return N_("Browse Grease Pencil Data to be linked");
#endif
case ID_MC:
return N_("Browse Movie Clip to be linked");
case ID_MSK:

View File

@ -40,7 +40,11 @@ const EnumPropertyItem rna_enum_id_type_items[] = {
{ID_CU_LEGACY, "CURVE", ICON_CURVE_DATA, "Curve", ""},
{ID_CV, "CURVES", ICON_CURVES_DATA, "Curves", ""},
{ID_VF, "FONT", ICON_FONT_DATA, "Font", ""},
#ifdef WITH_GREASE_PENCIL_V3

This change should also be conditioned to #ifdef WITH_GREASE_PENCIL_V3 ?

This change should also be conditioned to `#ifdef WITH_GREASE_PENCIL_V3` ?

Should not be ifdef'd, and missing entry for the new GP RNA type

Should not be ifdef'd, and missing entry for the new GP RNA type
{ID_GD_LEGACY, "GREASEPENCIL", ICON_GREASEPENCIL, "Grease Pencil (legacy)", ""},
#else
{ID_GD_LEGACY, "GREASEPENCIL", ICON_GREASEPENCIL, "Grease Pencil", ""},
#endif
{ID_IM, "IMAGE", ICON_IMAGE_DATA, "Image", ""},
{ID_KE, "KEY", ICON_SHAPEKEY_DATA, "Key", ""},
{ID_LT, "LATTICE", ICON_LATTICE_DATA, "Lattice", ""},

View File

@ -332,8 +332,13 @@ void RNA_def_main(BlenderRNA *brna)
{"grease_pencils",
"GreasePencil",
"rna_Main_gpencils_begin",
# ifdef WITH_GREASE_PENCIL_V3
"Grease Pencil (legacy)",
"Grease Pencil (legacy) data-blocks",
# else
"Grease Pencil",
"Grease Pencil data-blocks",
# endif
RNA_def_main_gpencil},
{"movieclips",
"MovieClip",

View File

@ -254,7 +254,11 @@ const EnumPropertyItem rna_enum_object_type_items[] = {
{OB_CURVES, "CURVES", ICON_OUTLINER_OB_CURVES, "Hair Curves", ""},
{OB_POINTCLOUD, "POINTCLOUD", ICON_OUTLINER_OB_POINTCLOUD, "Point Cloud", ""},
{OB_VOLUME, "VOLUME", ICON_OUTLINER_OB_VOLUME, "Volume", ""},
#ifdef WITH_GREASE_PENCIL_V3

This change should also be conditioned to #ifdef WITH_GREASE_PENCIL_V3 ?

This change should also be conditioned to `#ifdef WITH_GREASE_PENCIL_V3` ?
{OB_GPENCIL_LEGACY, "GPENCIL", ICON_OUTLINER_OB_GREASEPENCIL, "Grease Pencil (legacy)", ""},
#else
{OB_GPENCIL_LEGACY, "GPENCIL", ICON_OUTLINER_OB_GREASEPENCIL, "Grease Pencil", ""},
#endif
{OB_GREASE_PENCIL, "GREASEPENCIL", ICON_OUTLINER_OB_GREASEPENCIL, "Grease Pencil", ""},
RNA_ENUM_ITEM_SEPR,
{OB_ARMATURE, "ARMATURE", ICON_OUTLINER_OB_ARMATURE, "Armature", ""},