Fix: Expose GPv3 RNA only in experimental

The `blender-v4.0-release` branch would not build because some parts of grease pencil v3 were still exposed when experimental features are disabled.

This is hiding the relevant parts behind `#ifdef WITH_GREASE_PENCIL_V3` to make sure they are only built when the experimental features is enabled.

Pull Request: https://projects.blender.org/blender/blender/pulls/112953
This commit is contained in:
Falk David
2023-09-27 15:46:18 +02:00
committed by Falk David
parent 7ec7dac860
commit 4f617bc728
15 changed files with 53 additions and 1 deletions

View File

@@ -7,6 +7,10 @@ if(WITH_BLENDER)
add_definitions(-DWITH_INPUT_NDOF)
endif()
if(WITH_EXPERIMENTAL_FEATURES)
add_definitions(-DWITH_GREASE_PENCIL_V3)
endif()
add_subdirectory(animation)
add_subdirectory(armature)
add_subdirectory(asset)

View File

@@ -54,6 +54,9 @@ if(WITH_PYTHON)
add_definitions(-DWITH_PYTHON)
endif()
if(WITH_EXPERIMENTAL_FEATURES)
add_definitions(-DWITH_GREASE_PENCIL_V3)
endif()
blender_add_lib(bf_editor_animation "${SRC}" "${INC}" "${INC_SYS}" "${LIB}")

View File

@@ -3507,6 +3507,7 @@ static bAnimChannelType ACF_GPL_LEGACY = {
/* Grease Pencil Animation functions ------------------------------------------- */
#ifdef WITH_GREASE_PENCIL_V3
namespace blender::ed::animation::greasepencil {
/* Get pointer to the setting */
@@ -3740,6 +3741,7 @@ static bAnimChannelType ACF_GPLGROUP = {
/*setting_flag*/ greasepencil::layer_setting_flag,
/*setting_ptr*/ greasepencil::layer_group_setting_ptr,
};
#endif
/* Mask Datablock ------------------------------------------- */
@@ -4306,9 +4308,15 @@ static void ANIM_init_channel_typeinfo_data()
animchannelTypeInfo[type++] = &ACF_GPD_LEGACY; /* Grease Pencil Datablock (Legacy) */
animchannelTypeInfo[type++] = &ACF_GPL_LEGACY; /* Grease Pencil Layer (Legacy) */
#ifdef WITH_GREASE_PENCIL_V3
animchannelTypeInfo[type++] = &ACF_GPD; /* Grease Pencil Datablock. */
animchannelTypeInfo[type++] = &ACF_GPLGROUP; /* Grease Pencil Layer Group. */
animchannelTypeInfo[type++] = &ACF_GPL; /* Grease Pencil Layer. */
#else
animchannelTypeInfo[type++] = nullptr;
animchannelTypeInfo[type++] = nullptr;
animchannelTypeInfo[type++] = nullptr;
#endif
animchannelTypeInfo[type++] = &ACF_MASKDATA; /* Mask Datablock */
animchannelTypeInfo[type++] = &ACF_MASKLAYER; /* Mask Layer */
@@ -5422,6 +5430,7 @@ static void draw_setting_widget(bAnimContext *ac,
}
}
#ifdef WITH_GREASE_PENCIL_V3
static void draw_grease_pencil_layer_widgets(bAnimListElem *ale,
uiBlock *block,
const rctf *rect,
@@ -5484,6 +5493,7 @@ static void draw_grease_pencil_layer_widgets(bAnimListElem *ale,
}
MEM_freeN(opacity_rna_path);
}
#endif
void ANIM_channel_draw_widgets(const bContext *C,
bAnimContext *ac,
@@ -5905,9 +5915,11 @@ void ANIM_channel_draw_widgets(const bContext *C,
MEM_freeN(gp_rna_path);
}
}
#ifdef WITH_GREASE_PENCIL_V3
else if (ale->type == ANIMTYPE_GREASE_PENCIL_LAYER) {
draw_grease_pencil_layer_widgets(ale, block, rect, offset, channel_height, array_index);
}
#endif
/* Only if RNA-Path found. */
if (rna_path) {

View File

@@ -2662,7 +2662,9 @@ void uiTemplateLightLinkingCollection(uiLayout *layout,
PointerRNA *ptr,
const char *propname);
#ifdef WITH_GREASE_PENCIL_V3
void uiTemplateGreasePencilLayerTree(uiLayout *layout, bContext *C);
#endif
void uiTemplateNodeTreeInterface(struct uiLayout *layout, struct PointerRNA *ptr);

View File

@@ -69,7 +69,6 @@ set(SRC
interface_style.cc
interface_template_asset_view.cc
interface_template_attribute_search.cc
interface_template_grease_pencil_layer_tree.cc
interface_template_light_linking.cc
interface_template_list.cc
interface_template_node_tree_interface.cc
@@ -123,6 +122,13 @@ if(WIN32 OR APPLE)
endif()
endif()
if(WITH_EXPERIMENTAL_FEATURES)
add_definitions(-DWITH_GREASE_PENCIL_V3)
list(APPEND SRC
interface_template_grease_pencil_layer_tree.cc
)
endif()
blender_add_lib(bf_editor_interface "${SRC}" "${INC}" "${INC_SYS}" "${LIB}")

View File

@@ -42,6 +42,7 @@ endif()
if(WITH_EXPERIMENTAL_FEATURES)
add_definitions(-DWITH_SIMULATION_DATABLOCK)
add_definitions(-DWITH_POINT_CLOUD)
add_definitions(-DWITH_GREASE_PENCIL_V3)
endif()
blender_add_lib(bf_editor_space_buttons "${SRC}" "${INC}" "${INC_SYS}" "${LIB}")

View File

@@ -262,9 +262,11 @@ static bool buttons_context_path_data(ButsContextPath *path, int type)
if (RNA_struct_is_a(ptr->type, &RNA_GreasePencil) && ELEM(type, -1, OB_GPENCIL_LEGACY)) {
return true;
}
#ifdef WITH_GREASE_PENCIL_V3
if (RNA_struct_is_a(ptr->type, &RNA_GreasePencilv3) && ELEM(type, -1, OB_GREASE_PENCIL)) {
return true;
}
#endif
if (RNA_struct_is_a(ptr->type, &RNA_Curves) && ELEM(type, -1, OB_CURVES)) {
return true;
}
@@ -1172,10 +1174,12 @@ int /*eContextResult*/ buttons_context(const bContext *C,
set_pointer_type(path, result, &RNA_GreasePencil);
return CTX_RESULT_OK;
}
#ifdef WITH_GREASE_PENCIL_V3
if (CTX_data_equals(member, "grease_pencil")) {
set_pointer_type(path, result, &RNA_GreasePencilv3);
return CTX_RESULT_OK;
}
#endif
return CTX_RESULT_MEMBER_NOT_FOUND;
}

View File

@@ -1501,6 +1501,7 @@ static void outliner_draw_restrictbuts(uiBlock *block,
UI_but_flag_enable(bt, UI_BUT_DRAG_LOCK);
}
}
#ifdef WITH_GREASE_PENCIL_V3
else if (tselem->type == TSE_GREASE_PENCIL_NODE) {
bke::greasepencil::TreeNode &node =
tree_element_cast<TreeElementGreasePencilNode>(te)->node();
@@ -1538,6 +1539,7 @@ static void outliner_draw_restrictbuts(uiBlock *block,
}
}
}
#endif
else if (outliner_is_collection_tree_element(te)) {
PointerRNA collection_ptr;
PointerRNA layer_collection_ptr;

View File

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

View File

@@ -484,7 +484,9 @@ StructRNA *ID_code_to_RNA_type(short idcode)
case ID_GD_LEGACY:
return &RNA_GreasePencil;
case ID_GP:
# ifdef WITH_GREASE_PENCIL_V3
return &RNA_GreasePencilv3;
# endif
break;
case ID_GR:
return &RNA_Collection;

View File

@@ -158,7 +158,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);
@@ -500,7 +502,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_legacy(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

@@ -98,7 +98,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,12 +342,14 @@ void RNA_def_main(BlenderRNA *brna)
"Grease Pencil data-blocks",
# endif
RNA_def_main_gpencil_legacy},
# 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

@@ -2041,6 +2041,7 @@ void RNA_def_main_gpencil_legacy(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;
@@ -2050,6 +2051,7 @@ void RNA_def_main_grease_pencil(BlenderRNA *brna, PropertyRNA *cprop)
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)
{

View File

@@ -607,8 +607,10 @@ static StructRNA *rna_Object_data_typef(PointerRNA *ptr)
return &RNA_LightProbe;
case OB_GPENCIL_LEGACY:
return &RNA_GreasePencil;
# ifdef WITH_GREASE_PENCIL_V3
case OB_GREASE_PENCIL:
return &RNA_GreasePencilv3;
# endif
case OB_CURVES:
return &RNA_Curves;
case OB_POINTCLOUD:

View File

@@ -2114,10 +2114,12 @@ void RNA_api_ui_layout(StructRNA *srna)
RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
api_ui_item_rna_common(func);
# ifdef WITH_GREASE_PENCIL_V3
func = RNA_def_function(
srna, "template_grease_pencil_layer_tree", "uiTemplateGreasePencilLayerTree");
RNA_def_function_ui_description(func, "View of the active grease pencil layer tree");
RNA_def_function_flag(func, FUNC_USE_CONTEXT);
# endif
func = RNA_def_function(srna, "template_node_tree_interface", "uiTemplateNodeTreeInterface");
RNA_def_function_ui_description(func, "Show a node tree interface");