DNA: remove Object.display struct
We have a display flag already, use it instead. Object.display is kept in RNA, exposed via a nested struct, we can move other display options there.
This commit is contained in:
parent
ffd0fee97c
commit
69b2f52681
Notes:
blender-bot
2023-02-14 05:53:42 +01:00
Referenced by issue #64645, Camera Background Images not visibile in Wireframe nor Rendered Display Referenced by issue #62712, Light Path node seems to be broken Referenced by issue #62196, Blender 2.8 Beta: Freestyle Lineset drawing order breaks when using textures Referenced by issue #61451, Sometimes when clearing keyframes, the animation remains Referenced by issue #61454, Some shortcuts don't work Referenced by issue #61426, Boolean Modifier Cancels UV Mapping Referenced by issue #61408, NormalMap input causing Material Viewport issue in dual 3DView Layout Referenced by issue #61403, zoom/translate of viewport locks up Referenced by issue #61373, Often crashes in edit mode
|
@ -866,8 +866,6 @@ void BKE_object_init(Object *ob)
|
|||
|
||||
/* Animation Visualization defaults */
|
||||
animviz_settings_init(&ob->avs);
|
||||
|
||||
ob->display.flag = OB_SHOW_SHADOW;
|
||||
}
|
||||
|
||||
/* more general add: creates minimum required data, but without vertices etc. */
|
||||
|
|
|
@ -1360,13 +1360,6 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain)
|
|||
}
|
||||
}
|
||||
|
||||
if (!DNA_struct_elem_find(fd->filesdna, "Object", "ObjectDisplay", "display")) {
|
||||
/* Initialize new object.ObjectDisplay */
|
||||
for (Object *ob = bmain->object.first; ob; ob = ob->id.next) {
|
||||
ob->display.flag = OB_SHOW_SHADOW;
|
||||
}
|
||||
}
|
||||
|
||||
if (!DNA_struct_elem_find(fd->filesdna, "ToolSettings", "char", "transform_pivot_point")) {
|
||||
for (Scene *scene = bmain->scene.first; scene; scene = scene->id.next) {
|
||||
scene->toolsettings->transform_pivot_point = V3D_AROUND_CENTER_MEDIAN;
|
||||
|
|
|
@ -987,7 +987,7 @@ void workbench_deferred_solid_cache_populate(WORKBENCH_Data *vedata, Object *ob)
|
|||
}
|
||||
}
|
||||
|
||||
if (SHADOW_ENABLED(wpd) && (ob->display.flag & OB_SHOW_SHADOW)) {
|
||||
if (SHADOW_ENABLED(wpd) && !(ob->dtx & OB_DRAW_NO_SHADOW_CAST)) {
|
||||
bool is_manifold;
|
||||
struct GPUBatch *geom_shadow = DRW_cache_object_edge_detection_get(ob, &is_manifold);
|
||||
if (geom_shadow) {
|
||||
|
|
|
@ -114,10 +114,6 @@ typedef struct LodLevel {
|
|||
int obhysteresis;
|
||||
} LodLevel;
|
||||
|
||||
typedef struct ObjectDisplay {
|
||||
int flag;
|
||||
} ObjectDisplay;
|
||||
|
||||
/* Forward declaration for cache bbone deformation information.
|
||||
*
|
||||
* TODO(sergey): Consider moving it to more appropriate place. */
|
||||
|
@ -380,12 +376,8 @@ typedef struct Object {
|
|||
int pad6;
|
||||
int select_color;
|
||||
|
||||
/* Runtime evaluation data. */
|
||||
/* Runtime evaluation data (keep last). */
|
||||
Object_Runtime runtime;
|
||||
|
||||
/* Object Display */
|
||||
struct ObjectDisplay display;
|
||||
int pad9;
|
||||
} Object;
|
||||
|
||||
/* Warning, this is not used anymore because hooks are now modifiers */
|
||||
|
@ -444,11 +436,6 @@ enum {
|
|||
OB_TYPE_MAX,
|
||||
};
|
||||
|
||||
/* ObjectDisplay.flag */
|
||||
enum {
|
||||
OB_SHOW_SHADOW = (1 << 0),
|
||||
};
|
||||
|
||||
/* check if the object type supports materials */
|
||||
#define OB_TYPE_SUPPORT_MATERIAL(_type) \
|
||||
(((_type) >= OB_MESH && (_type) <= OB_MBALL) || ((_type) == OB_GPENCIL))
|
||||
|
@ -545,6 +532,7 @@ enum {
|
|||
/* enable transparent draw */
|
||||
OB_DRAWTRANSP = 1 << 7,
|
||||
OB_DRAW_ALL_EDGES = 1 << 8, /* only for meshes currently */
|
||||
OB_DRAW_NO_SHADOW_CAST = 1 << 9,
|
||||
};
|
||||
|
||||
/* empty_drawtype: no flags */
|
||||
|
|
|
@ -1097,6 +1097,11 @@ static char *rna_MaterialSlot_path(PointerRNA *ptr)
|
|||
return BLI_sprintfN("material_slots[%d]", index);
|
||||
}
|
||||
|
||||
static PointerRNA rna_Object_display_get(PointerRNA *ptr)
|
||||
{
|
||||
return rna_pointer_inherit_refine(ptr, &RNA_ObjectDisplay, ptr->data);
|
||||
}
|
||||
|
||||
static char *rna_ObjectDisplay_path(PointerRNA *UNUSED(ptr))
|
||||
{
|
||||
return BLI_strdup("display");
|
||||
|
@ -2073,11 +2078,12 @@ static void rna_def_object_display(BlenderRNA *brna)
|
|||
|
||||
srna = RNA_def_struct(brna, "ObjectDisplay", NULL);
|
||||
RNA_def_struct_ui_text(srna, "Object Display", "Object display settings for 3d viewport");
|
||||
RNA_def_struct_sdna(srna, "ObjectDisplay");
|
||||
RNA_def_struct_sdna(srna, "Object");
|
||||
RNA_def_struct_nested(brna, srna, "Object");
|
||||
RNA_def_struct_path_func(srna, "rna_ObjectDisplay_path");
|
||||
|
||||
prop = RNA_def_property(srna, "show_shadows", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, NULL, "flag", OB_SHOW_SHADOW);
|
||||
RNA_def_property_boolean_negative_sdna(prop, NULL, "dtx", OB_DRAW_NO_SHADOW_CAST);
|
||||
RNA_def_property_boolean_default(prop, true);
|
||||
RNA_def_property_ui_text(prop, "Shadow", "Object cast shadows in the 3d viewport");
|
||||
RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL);
|
||||
|
@ -2753,8 +2759,9 @@ static void rna_def_object(BlenderRNA *brna)
|
|||
|
||||
/* Object Display */
|
||||
prop = RNA_def_property(srna, "display", PROP_POINTER, PROP_NONE);
|
||||
RNA_def_property_pointer_sdna(prop, NULL, "display");
|
||||
RNA_def_property_flag(prop, PROP_NEVER_NULL);
|
||||
RNA_def_property_struct_type(prop, "ObjectDisplay");
|
||||
RNA_def_property_pointer_funcs(prop, "rna_Object_display_get", NULL, NULL, NULL);
|
||||
RNA_def_property_ui_text(prop, "Object Display", "Object display settings for 3d viewport");
|
||||
|
||||
RNA_api_object(srna);
|
||||
|
|
Loading…
Reference in New Issue