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 84 additions and 2 deletions
Showing only changes of commit 69169e98f2 - Show all commits

View File

@ -198,6 +198,7 @@ typedef struct Main {
ListBase paintcurves;
ListBase wm; /* Singleton (exception). */
ListBase gpencils; /* Legacy Grease Pencil. */
ListBase grease_pencils;
ListBase movieclips;
ListBase masks;
filedescriptor marked this conversation as resolved Outdated

Maybe grease_pencils?

Maybe `grease_pencils`?
ListBase linestyles;
@ -211,7 +212,6 @@ typedef struct Main {
ListBase pointclouds;
ListBase volumes;
ListBase simulations;
ListBase grease_pencils;
/**
* Must be generated, used and freed by same code - never assume this is valid data unless you

View File

@ -90,8 +90,10 @@ set(DEFSRC
if(WITH_EXPERIMENTAL_FEATURES)
add_definitions(-DWITH_SIMULATION_DATABLOCK)
add_definitions(-DWITH_GREASE_PENCIL_V3)
list(APPEND DEFSRC
rna_simulation.c
rna_grease_pencil.c
)
endif()

View File

@ -4509,6 +4509,9 @@ static RNAProcessItem PROCESS_ITEMS[] = {
{"rna_dynamicpaint.c", NULL, RNA_def_dynamic_paint},
{"rna_fcurve.c", "rna_fcurve_api.c", RNA_def_fcurve},
{"rna_gpencil_legacy.c", NULL, RNA_def_gpencil},
#ifdef WITH_GREASE_PENCIL_V3
{"rna_grease_pencil.c", NULL, RNA_def_grease_pencil},
#endif
{"rna_curves.c", NULL, RNA_def_curves},
{"rna_image.c", "rna_image_api.c", RNA_def_image},
{"rna_key.c", NULL, RNA_def_key},

View File

@ -489,7 +489,11 @@ StructRNA *ID_code_to_RNA_type(short idcode)
case ID_GD_LEGACY:
return &RNA_GreasePencil;
case ID_GP:
/* TODO. */
# ifdef WITH_GREASE_PENCIL_V3

Should not be ifdef'd

Should not be ifdef'd
return &RNA_GreasePencilv3;
# else
return &RNA_ID;
# endif
break;
case ID_GR:
return &RNA_Collection;

View File

@ -0,0 +1,38 @@
/* SPDX-License-Identifier: GPL-2.0-or-later
* Copyright 2023 Blender Foundation. */
/** \file
* \ingroup RNA
*/
#include "DNA_grease_pencil_types.h"
#include "RNA_access.h"
#include "RNA_define.h"
#include "RNA_enum_types.h"
#include "rna_internal.h"
#ifdef RNA_RUNTIME
#else
static void rna_def_grease_pencil_data(BlenderRNA *brna)
{
StructRNA *srna;
srna = RNA_def_struct(brna, "GreasePencilv3", "ID");
RNA_def_struct_sdna(srna, "GreasePencil");
RNA_def_struct_ui_text(srna, "Grease Pencil", "Grease Pencil data-block");
RNA_def_struct_ui_icon(srna, ICON_OUTLINER_DATA_GREASEPENCIL);
/* Animation Data */
rna_def_animdata_common(srna);
}
void RNA_def_grease_pencil(BlenderRNA *brna)
{
rna_def_grease_pencil_data(brna);
}
#endif

View File

@ -156,6 +156,9 @@ void RNA_def_depsgraph(struct BlenderRNA *brna);
void RNA_def_dynamic_paint(struct BlenderRNA *brna);
void RNA_def_fcurve(struct BlenderRNA *brna);
void RNA_def_gpencil(struct BlenderRNA *brna);
#ifdef WITH_GREASE_PENCIL_V3
void RNA_def_grease_pencil(struct BlenderRNA *brna);
#endif
void RNA_def_greasepencil_modifier(struct BlenderRNA *brna);
void RNA_def_shader_fx(struct BlenderRNA *brna);
void RNA_def_curves(struct BlenderRNA *brna);
@ -502,6 +505,9 @@ void RNA_def_main_actions(BlenderRNA *brna, PropertyRNA *cprop);
void RNA_def_main_particles(BlenderRNA *brna, PropertyRNA *cprop);
void RNA_def_main_palettes(BlenderRNA *brna, PropertyRNA *cprop);
void RNA_def_main_gpencil(BlenderRNA *brna, PropertyRNA *cprop);
#ifdef WITH_GREASE_PENCIL_V3
void RNA_def_main_grease_pencil(BlenderRNA *brna, PropertyRNA *cprop);
#endif
void RNA_def_main_movieclips(BlenderRNA *brna, PropertyRNA *cprop);
void RNA_def_main_masks(BlenderRNA *brna, PropertyRNA *cprop);
void RNA_def_main_linestyles(BlenderRNA *brna, PropertyRNA *cprop);

View File

@ -96,6 +96,9 @@ RNA_MAIN_LISTBASE_FUNCS_DEF(collections)
RNA_MAIN_LISTBASE_FUNCS_DEF(curves)
RNA_MAIN_LISTBASE_FUNCS_DEF(fonts)
RNA_MAIN_LISTBASE_FUNCS_DEF(gpencils)
# ifdef WITH_GREASE_PENCIL_V3
RNA_MAIN_LISTBASE_FUNCS_DEF(grease_pencils)
# endif
RNA_MAIN_LISTBASE_FUNCS_DEF(hair_curves)
RNA_MAIN_LISTBASE_FUNCS_DEF(images)
RNA_MAIN_LISTBASE_FUNCS_DEF(lattices)
@ -340,6 +343,14 @@ void RNA_def_main(BlenderRNA *brna)
"Grease Pencil data-blocks",
# endif
RNA_def_main_gpencil},
# ifdef WITH_GREASE_PENCIL_V3
{"grease_pencils_v3",
"GreasePencilv3",
"rna_Main_grease_pencils_begin",
"Grease Pencil",
"Grease Pencil data-blocks",
RNA_def_main_grease_pencil},
# endif
{"movieclips",
"MovieClip",
"rna_Main_movieclips_begin",

View File

@ -2058,6 +2058,18 @@ void RNA_def_main_gpencil(BlenderRNA *brna, PropertyRNA *cprop)
func, "do_ui_user", true, "", "Make sure interface does not reference this grease pencil");
}
#ifdef WITH_GREASE_PENCIL_V3
void RNA_def_main_grease_pencil(BlenderRNA *brna, PropertyRNA *cprop)
{
StructRNA *srna;
RNA_def_property_srna(cprop, "BlendDataGreasePencilsV3");
srna = RNA_def_struct(brna, "BlendDataGreasePencilsV3", NULL);
RNA_def_struct_sdna(srna, "Main");
RNA_def_struct_ui_text(srna, "Main Grease Pencils", "Collection of grease pencils");
}
#endif
void RNA_def_main_movieclips(BlenderRNA *brna, PropertyRNA *cprop)
{
StructRNA *srna;

View File

@ -606,6 +606,12 @@ static StructRNA *rna_Object_data_typef(PointerRNA *ptr)
return &RNA_LightProbe;
case OB_GPENCIL_LEGACY:
return &RNA_GreasePencil;
case OB_GREASE_PENCIL:
# ifdef WITH_GREASE_PENCIL_V3
return &RNA_GreasePencilv3;
# else
return &RNA_ID;
# endif
case OB_CURVES:
return &RNA_Curves;
case OB_POINTCLOUD: