diff options
35 files changed, 204 insertions, 675 deletions
diff --git a/release/scripts/startup/bl_ui/properties_collection.py b/release/scripts/startup/bl_ui/properties_collection.py index 2d032e7f95d..80598632714 100644 --- a/release/scripts/startup/bl_ui/properties_collection.py +++ b/release/scripts/startup/bl_ui/properties_collection.py @@ -86,94 +86,9 @@ class COLLECTION_PT_clay_settings(CollectionButtonsPanel, Panel): col.template_override_property(collection_props, scene_props, "hair_brightness_randomness") -class COLLECTION_PT_object_mode_settings(CollectionButtonsPanel, Panel): - bl_label = "Object Mode Settings" - - @classmethod - def poll(cls, context): - ob = context.object - return ob and ob.mode == 'OBJECT' - - def draw(self, context): - layout = self.layout - scene_props = context.scene.collection_properties['ObjectMode'] - collection = get_collection_from_context(context) - collection_props = collection.engine_overrides['ObjectMode'] - - col = layout.column() - col.template_override_property(collection_props, scene_props, "show_wire") - col.template_override_property(collection_props, scene_props, "show_backface_culling") - - -class COLLECTION_PT_edit_mode_settings(CollectionButtonsPanel, Panel): - bl_label = "Edit Mode Settings" - - @classmethod - def poll(cls, context): - ob = context.object - return ob and ob.mode == 'EDIT' - - def draw(self, context): - layout = self.layout - scene_props = context.scene.collection_properties['EditMode'] - collection = get_collection_from_context(context) - collection_props = collection.engine_overrides['EditMode'] - - col = layout.column() - col.template_override_property(collection_props, scene_props, "show_occlude_wire") - col.template_override_property(collection_props, scene_props, "backwire_opacity") - col.template_override_property(collection_props, scene_props, "face_normals_show") - col.template_override_property(collection_props, scene_props, "vert_normals_show") - col.template_override_property(collection_props, scene_props, "loop_normals_show") - col.template_override_property(collection_props, scene_props, "normals_length") - col.template_override_property(collection_props, scene_props, "show_weight") - - -class COLLECTION_PT_paint_weight_mode_settings(CollectionButtonsPanel, Panel): - bl_label = "Weight Paint Mode Settings" - - @classmethod - def poll(cls, context): - ob = context.object - return ob and ob.mode == 'WEIGHT_PAINT' - - def draw(self, context): - layout = self.layout - scene_props = context.scene.collection_properties['WeightPaintMode'] - collection = get_collection_from_context(context) - collection_props = collection.engine_overrides['WeightPaintMode'] - - col = layout.column() - col.template_override_property(collection_props, scene_props, "use_shading") - col.template_override_property(collection_props, scene_props, "use_wire") - - -class COLLECTION_PT_paint_vertex_mode_settings(CollectionButtonsPanel, Panel): - bl_label = "Vertex Paint Mode Settings" - - @classmethod - def poll(cls, context): - ob = context.object - return ob and ob.mode == 'VERTEX_PAINT' - - def draw(self, context): - layout = self.layout - scene_props = context.scene.collection_properties['VertexPaintMode'] - collection = get_collection_from_context(context) - collection_props = collection.engine_overrides['VertexPaintMode'] - - col = layout.column() - col.template_override_property(collection_props, scene_props, "use_shading") - col.template_override_property(collection_props, scene_props, "use_wire") - - classes = ( COLLECTION_PT_context_collection, COLLECTION_PT_clay_settings, - COLLECTION_PT_object_mode_settings, - COLLECTION_PT_edit_mode_settings, - COLLECTION_PT_paint_weight_mode_settings, - COLLECTION_PT_paint_vertex_mode_settings, ) if __name__ == "__main__": # only for live edit. diff --git a/release/scripts/startup/bl_ui/space_view3d.py b/release/scripts/startup/bl_ui/space_view3d.py index 3a35990fd60..d73fdb2e750 100644 --- a/release/scripts/startup/bl_ui/space_view3d.py +++ b/release/scripts/startup/bl_ui/space_view3d.py @@ -3555,7 +3555,7 @@ class VIEW3D_PT_shading(Panel): col.separator() col.row().prop(shading, "light", expand=True) if shading.light == 'STUDIO': - col.row().template_icon_view(shading, "studiolight") + col.row().template_icon_view(shading, "studio_light") col.separator() col.prop(shading, "show_shadows") @@ -3592,23 +3592,13 @@ class VIEW3D_PT_overlay(Panel): col.active = display_all col.prop(overlay, "show_cursor") - if context.mode in {'PAINT_WEIGHT', 'PAINT_VERTEX'}: - engine_type = { - 'PAINT_WEIGHT': 'WeightPaintMode', - 'PAINT_VERTEX': 'VertexPaintMode', - }.get(context.mode) - engine_props = scene.collection_properties[engine_type] - col.prop(engine_props, "use_wire") - - if context.mode in {'PAINT_WEIGHT', 'PAINT_VERTEX', 'PAINT_TEXTURE'}: - col.prop(view, "show_mode_shade_override") - col = layout.column() col.active = display_all col.prop(overlay, "show_outline_selected") col.prop(overlay, "show_all_objects_origin") col.prop(overlay, "show_relationship_lines") col.prop(overlay, "show_face_orientation") + col.prop(overlay, "show_backface_culling") col = layout.column() col.active = display_all @@ -3630,6 +3620,32 @@ class VIEW3D_PT_overlay(Panel): subsub.active = scene.unit_settings.system == 'NONE' subsub.prop(overlay, "grid_subdivisions", text="Subdivisions") + if context.mode == 'EDIT_MESH': + col.separator() + col.label(text="Edit Mode:") + + col.prop(overlay, "show_occlude_wire") + + col.label(text="Normals:") + row = col.row(align=True) + + row.prop(overlay, "show_vertex_normals", text="", icon='VERTEXSEL') + row.prop(overlay, "show_split_normals", text="", icon='LOOPSEL') + row.prop(overlay, "show_face_normals", text="", icon='FACESEL') + + sub = row.row(align=True) + sub.active = overlay.show_vertex_normals or overlay.show_face_normals or overlay.show_split_normals + sub.prop(overlay, "normals_length", text="Size") + + elif context.mode in {'PAINT_WEIGHT', 'PAINT_VERTEX', 'PAINT_TEXTURE'}: + col.separator() + col.label(text="Paint Mode:") + + if context.mode in {'PAINT_WEIGHT', 'PAINT_VERTEX'}: + col.prop(overlay, "show_paint_wire") + + col.prop(view, "show_mode_shade_override") + class VIEW3D_PT_quad_view(Panel): bl_space_type = 'VIEW_3D' @@ -3771,18 +3787,6 @@ class VIEW3D_PT_view3d_meshdisplay(Panel): col = layout.column() col.separator() - col.label(text="Normals:") - row = col.row(align=True) - - row.prop(mesh, "show_normal_vertex", text="", icon='VERTEXSEL') - row.prop(mesh, "show_normal_loop", text="", icon='LOOPSEL') - row.prop(mesh, "show_normal_face", text="", icon='FACESEL') - - sub = row.row(align=True) - sub.active = mesh.show_normal_vertex or mesh.show_normal_face or mesh.show_normal_loop - sub.prop(scene.tool_settings, "normal_size", text="Size") - - col.separator() split = layout.split() col = split.column() col.label(text="Edge Info:") diff --git a/source/blender/blenkernel/BKE_layer.h b/source/blender/blenkernel/BKE_layer.h index 27e3d32a510..5c84dbf160e 100644 --- a/source/blender/blenkernel/BKE_layer.h +++ b/source/blender/blenkernel/BKE_layer.h @@ -135,18 +135,18 @@ void BKE_override_layer_collection_boolean_add(struct LayerCollection *layer_col /* engine settings */ typedef void (*EngineSettingsCB)(struct RenderEngine *engine, struct IDProperty *props); -struct IDProperty *BKE_layer_collection_engine_evaluated_get(struct Object *ob, const int type, const char *engine_name); -struct IDProperty *BKE_layer_collection_engine_collection_get(struct LayerCollection *lc, const int type, const char *engine_name); -struct IDProperty *BKE_layer_collection_engine_scene_get(struct Scene *scene, const int type, const char *engine_name); +struct IDProperty *BKE_layer_collection_engine_evaluated_get(struct Object *ob, const char *engine_name); +struct IDProperty *BKE_layer_collection_engine_collection_get(struct LayerCollection *lc, const char *engine_name); +struct IDProperty *BKE_layer_collection_engine_scene_get(struct Scene *scene, const char *engine_name); void BKE_layer_collection_engine_settings_callback_register(struct Main *bmain, const char *engine_name, EngineSettingsCB func); void BKE_layer_collection_engine_settings_callback_free(void); void BKE_layer_collection_engine_settings_create(struct IDProperty *root); void BKE_layer_collection_engine_settings_validate_scene(struct Scene *scene); void BKE_layer_collection_engine_settings_validate_collection(struct LayerCollection *lc); -struct IDProperty *BKE_view_layer_engine_evaluated_get(struct ViewLayer *view_layer, const int type, const char *engine_name); -struct IDProperty *BKE_view_layer_engine_layer_get(struct ViewLayer *view_layer, const int type, const char *engine_name); -struct IDProperty *BKE_view_layer_engine_scene_get(struct Scene *scene, const int type, const char *engine_name); +struct IDProperty *BKE_view_layer_engine_evaluated_get(struct ViewLayer *view_layer, const char *engine_name); +struct IDProperty *BKE_view_layer_engine_layer_get(struct ViewLayer *view_layer, const char *engine_name); +struct IDProperty *BKE_view_layer_engine_scene_get(struct Scene *scene, const char *engine_name); void BKE_view_layer_engine_settings_callback_register(struct Main *bmain, const char *engine_name, EngineSettingsCB func); void BKE_view_layer_engine_settings_callback_free(void); void BKE_view_layer_engine_settings_validate_scene(struct Scene *scene); diff --git a/source/blender/blenkernel/intern/layer.c b/source/blender/blenkernel/intern/layer.c index d3b47681a75..fda14657f3b 100644 --- a/source/blender/blenkernel/intern/layer.c +++ b/source/blender/blenkernel/intern/layer.c @@ -69,7 +69,7 @@ static void layer_collection_objects_populate(ViewLayer *view_layer, LayerCollec static LayerCollection *layer_collection_add(ViewLayer *view_layer, LayerCollection *parent, SceneCollection *sc); static LayerCollection *find_layer_collection_by_scene_collection(LayerCollection *lc, const SceneCollection *sc); static IDProperty *collection_engine_settings_create(struct EngineSettingsCB_Type *ces_type, const bool populate); -static IDProperty *collection_engine_get(IDProperty *root, const int type, const char *engine_name); +static IDProperty *collection_engine_get(IDProperty *root, const char *engine_name); static void collection_engine_settings_init(IDProperty *root, const bool populate); static void layer_engine_settings_init(IDProperty *root, const bool populate); static void object_bases_iterator_next(BLI_Iterator *iter, const int flag); @@ -1458,7 +1458,7 @@ typedef struct EngineSettingsCB_Type { static void create_engine_settings_scene(IDProperty *root, EngineSettingsCB_Type *es_type) { - if (collection_engine_get(root, COLLECTION_MODE_NONE, es_type->name)) { + if (collection_engine_get(root, es_type->name)) { return; } @@ -1478,7 +1478,7 @@ static void create_view_layer_engine_settings_scene(Scene *scene, EngineSettings static void create_layer_collection_engine_settings_collection(LayerCollection *lc, EngineSettingsCB_Type *es_type) { - if (BKE_layer_collection_engine_collection_get(lc, COLLECTION_MODE_NONE, es_type->name)) { + if (BKE_layer_collection_engine_collection_get(lc, es_type->name)) { return; } @@ -1510,7 +1510,7 @@ static void create_view_layer_engines_settings_scene(Scene *scene, EngineSetting static void create_view_layer_engines_settings_layer(ViewLayer *view_layer, EngineSettingsCB_Type *es_type) { - if (BKE_view_layer_engine_layer_get(view_layer, COLLECTION_MODE_NONE, es_type->name)) { + if (BKE_view_layer_engine_layer_get(view_layer, es_type->name)) { return; } @@ -1601,70 +1601,6 @@ static IDProperty *collection_engine_settings_create(EngineSettingsCB_Type *es_t return props; } -static void layer_collection_create_mode_settings_object(IDProperty *root, const bool populate) -{ - IDProperty *props; - IDPropertyTemplate val = {0}; - - props = IDP_New(IDP_GROUP, &val, "ObjectMode"); - props->subtype = IDP_GROUP_SUB_MODE_OBJECT; - - /* properties */ - if (populate) { - OBJECT_collection_settings_create(props); - } - - IDP_AddToGroup(root, props); -} - -static void layer_collection_create_mode_settings_edit(IDProperty *root, const bool populate) -{ - IDProperty *props; - IDPropertyTemplate val = {0}; - - props = IDP_New(IDP_GROUP, &val, "EditMode"); - props->subtype = IDP_GROUP_SUB_MODE_EDIT; - - /* properties */ - if (populate) { - EDIT_MESH_collection_settings_create(props); - } - - IDP_AddToGroup(root, props); -} - -static void layer_collection_create_mode_settings_paint_weight(IDProperty *root, const bool populate) -{ - IDProperty *props; - IDPropertyTemplate val = {0}; - - props = IDP_New(IDP_GROUP, &val, "WeightPaintMode"); - props->subtype = IDP_GROUP_SUB_MODE_PAINT_WEIGHT; - - /* properties */ - if (populate) { - PAINT_WEIGHT_collection_settings_create(props); - } - - IDP_AddToGroup(root, props); -} - -static void layer_collection_create_mode_settings_paint_vertex(IDProperty *root, const bool populate) -{ - IDProperty *props; - IDPropertyTemplate val = {0}; - - props = IDP_New(IDP_GROUP, &val, "VertexPaintMode"); - props->subtype = IDP_GROUP_SUB_MODE_PAINT_VERTEX; - - /* properties */ - if (populate) { - PAINT_VERTEX_collection_settings_create(props); - } - - IDP_AddToGroup(root, props); -} - static void layer_collection_create_render_settings(IDProperty *root, const bool populate) { EngineSettingsCB_Type *es_type; @@ -1683,117 +1619,59 @@ static void view_layer_create_render_settings(IDProperty *root, const bool popul } } -static void collection_create_mode_settings(IDProperty *root, const bool populate) -{ - /* XXX TODO: put all those engines in the R_engines_settings_callbacks - * and have IDP_AddToGroup outside the callbacks */ - layer_collection_create_mode_settings_object(root, populate); - layer_collection_create_mode_settings_edit(root, populate); - layer_collection_create_mode_settings_paint_weight(root, populate); - layer_collection_create_mode_settings_paint_vertex(root, populate); -} - -static void layer_create_mode_settings(IDProperty *root, const bool populate) -{ - TODO_LAYER; /* XXX like collection_create_mode_settings */ - UNUSED_VARS(root, populate); -} - -static int idproperty_group_subtype(const int mode_type) -{ - int idgroup_type; - - switch (mode_type) { - case COLLECTION_MODE_OBJECT: - idgroup_type = IDP_GROUP_SUB_MODE_OBJECT; - break; - case COLLECTION_MODE_EDIT: - idgroup_type = IDP_GROUP_SUB_MODE_EDIT; - break; - case COLLECTION_MODE_PAINT_WEIGHT: - idgroup_type = IDP_GROUP_SUB_MODE_PAINT_WEIGHT; - break; - case COLLECTION_MODE_PAINT_VERTEX: - idgroup_type = IDP_GROUP_SUB_MODE_PAINT_VERTEX; - break; - default: - case COLLECTION_MODE_NONE: - return IDP_GROUP_SUB_ENGINE_RENDER; - break; - } - - return idgroup_type; -} - /** * Return collection enginne settings for either Object s of LayerCollection s */ -static IDProperty *collection_engine_get( - IDProperty *root, const int type, const char *engine_name) +static IDProperty *collection_engine_get(IDProperty *root, const char *engine_name) { - const int subtype = idproperty_group_subtype(type); - - if (subtype == IDP_GROUP_SUB_ENGINE_RENDER) { - return IDP_GetPropertyFromGroup(root, engine_name); - } - else { - IDProperty *prop; - for (prop = root->data.group.first; prop; prop = prop->next) { - if (prop->subtype == subtype) { - return prop; - } - } - } - - BLI_assert(false); - return NULL; + return IDP_GetPropertyFromGroup(root, engine_name); } /** * Return collection engine settings from Object for specified engine of mode */ -IDProperty *BKE_layer_collection_engine_evaluated_get(Object *ob, const int type, const char *engine_name) +IDProperty *BKE_layer_collection_engine_evaluated_get(Object *ob, const char *engine_name) { - return collection_engine_get(ob->base_collection_properties, type, engine_name); + return collection_engine_get(ob->base_collection_properties, engine_name); } /** * Return layer collection engine settings for specified engine */ -IDProperty *BKE_layer_collection_engine_collection_get(LayerCollection *lc, const int type, const char *engine_name) +IDProperty *BKE_layer_collection_engine_collection_get(LayerCollection *lc, const char *engine_name) { - return collection_engine_get(lc->properties, type, engine_name); + return collection_engine_get(lc->properties, engine_name); } /** * Return layer collection engine settings for specified engine in the scene */ -IDProperty *BKE_layer_collection_engine_scene_get(Scene *scene, const int type, const char *engine_name) +IDProperty *BKE_layer_collection_engine_scene_get(Scene *scene, const char *engine_name) { - return collection_engine_get(scene->collection_properties, type, engine_name); + return collection_engine_get(scene->collection_properties, engine_name); } /** * Return scene layer engine settings for specified engine in the scene */ -IDProperty *BKE_view_layer_engine_scene_get(Scene *scene, const int type, const char *engine_name) +IDProperty *BKE_view_layer_engine_scene_get(Scene *scene, const char *engine_name) { - return collection_engine_get(scene->layer_properties, type, engine_name); + return collection_engine_get(scene->layer_properties, engine_name); } /** * Return scene layer engine settings for specified engine */ -IDProperty *BKE_view_layer_engine_layer_get(ViewLayer *view_layer, const int type, const char *engine_name) +IDProperty *BKE_view_layer_engine_layer_get(ViewLayer *view_layer, const char *engine_name) { - return collection_engine_get(view_layer->properties, type, engine_name); + return collection_engine_get(view_layer->properties, engine_name); } /** * Return scene layer evaluated engine settings for specified engine */ -IDProperty *BKE_view_layer_engine_evaluated_get(ViewLayer *view_layer, const int type, const char *engine_name) +IDProperty *BKE_view_layer_engine_evaluated_get(ViewLayer *view_layer, const char *engine_name) { - return collection_engine_get(view_layer->properties_evaluated, type, engine_name); + return collection_engine_get(view_layer->properties_evaluated, engine_name); } /* ---------------------------------------------------------------------- */ @@ -1887,9 +1765,6 @@ static void collection_engine_settings_init(IDProperty *root, const bool populat { /* render engines */ layer_collection_create_render_settings(root, populate); - - /* mode engines */ - collection_create_mode_settings(root, populate); } /* get all the default settings defined in scene and merge them here */ @@ -1897,9 +1772,6 @@ static void layer_engine_settings_init(IDProperty *root, const bool populate) { /* render engines */ view_layer_create_render_settings(root, populate); - - /* mode engines */ - layer_create_mode_settings(root, populate); } /** diff --git a/source/blender/blenkernel/intern/scene.c b/source/blender/blenkernel/intern/scene.c index a11c7320da5..1c8d153d0d1 100644 --- a/source/blender/blenkernel/intern/scene.c +++ b/source/blender/blenkernel/intern/scene.c @@ -653,7 +653,6 @@ void BKE_scene_init(Scene *sce) sce->toolsettings->selectmode = SCE_SELECT_VERTEX; sce->toolsettings->uv_selectmode = UV_SELECT_VERTEX; - sce->toolsettings->normalsize = 0.1; sce->toolsettings->autokey_mode = U.autokey_mode; sce->toolsettings->snap_node_mode = SCE_SNAP_MODE_GRID; diff --git a/source/blender/blenloader/intern/versioning_250.c b/source/blender/blenloader/intern/versioning_250.c index 780abb693a3..b7108c882a2 100644 --- a/source/blender/blenloader/intern/versioning_250.c +++ b/source/blender/blenloader/intern/versioning_250.c @@ -838,8 +838,7 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *main) for (sce = main->scene.first; sce; sce = sce->id.next) { ts = sce->toolsettings; - if (ts->normalsize == 0.0f || !ts->uv_selectmode || ts->vgroup_weight == 0.0f) { - ts->normalsize = 0.1f; + if (!ts->uv_selectmode || ts->vgroup_weight == 0.0f) { ts->selectmode = SCE_SELECT_VERTEX; /* autokeying - setting should be taken from the user-prefs diff --git a/source/blender/blenloader/intern/versioning_280.c b/source/blender/blenloader/intern/versioning_280.c index 10c2e7cb3fb..8e56caca308 100644 --- a/source/blender/blenloader/intern/versioning_280.c +++ b/source/blender/blenloader/intern/versioning_280.c @@ -1088,9 +1088,14 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *main) for (SpaceLink *sl = sa->spacedata.first; sl; sl = sl->next) { if (sl->spacetype == SPACE_VIEW3D) { View3D *v3d = (View3D *)sl; - v3d->shading.ambient_intensity = 0.5; + v3d->shading.light = V3D_LIGHTING_STUDIO; + v3d->shading.color_type = V3D_SHADING_MATERIAL_COLOR; copy_v3_fl(v3d->shading.single_color, 1.0f); + v3d->shading.ambient_intensity = 0.5; + v3d->overlay.flag |= V3D_OVERLAY_HIDE_CURSOR; + v3d->overlay.backwire_opacity = 0.5f; + v3d->overlay.normals_length = 0.1f; } } } diff --git a/source/blender/draw/DRW_engine.h b/source/blender/draw/DRW_engine.h index 22dc116d4a6..3afbe3b66e2 100644 --- a/source/blender/draw/DRW_engine.h +++ b/source/blender/draw/DRW_engine.h @@ -128,13 +128,6 @@ void DRW_pass_free(struct DRWPass *pass); struct DRWInstanceDataList *DRW_instance_data_list_create(void); void DRW_instance_data_list_free(struct DRWInstanceDataList *idatalist); -/* Mode engines initialization */ -void OBJECT_collection_settings_create(struct IDProperty *properties); -void EDIT_MESH_collection_settings_create(struct IDProperty *properties); -void EDIT_ARMATURE_collection_settings_create(struct IDProperty *properties); -void PAINT_WEIGHT_collection_settings_create(struct IDProperty *properties); -void PAINT_VERTEX_collection_settings_create(struct IDProperty *properties); - void DRW_opengl_context_create(void); void DRW_opengl_context_destroy(void); void DRW_opengl_context_enable(void); diff --git a/source/blender/draw/engines/clay/clay_engine.c b/source/blender/draw/engines/clay/clay_engine.c index e9e24b348f9..d7af8fb5398 100644 --- a/source/blender/draw/engines/clay/clay_engine.c +++ b/source/blender/draw/engines/clay/clay_engine.c @@ -24,6 +24,7 @@ #include "BLI_rand.h" #include "DNA_particle_types.h" +#include "DNA_view3d_types.h" #include "BKE_icons.h" #include "BKE_idprop.h" @@ -485,7 +486,7 @@ static void clay_engine_init(void *vedata) const DRWContextState *draw_ctx = DRW_context_state_get(); ViewLayer *view_layer = draw_ctx->view_layer; IDProperty *props = BKE_view_layer_engine_evaluated_get( - view_layer, COLLECTION_MODE_NONE, RE_engine_id_BLENDER_CLAY); + view_layer, RE_engine_id_BLENDER_CLAY); int ssao_samples = BKE_collection_engine_property_value_get_int(props, "ssao_samples"); float invproj[4][4]; @@ -684,7 +685,7 @@ static int hair_mat_in_ubo(CLAY_Storage *storage, const CLAY_HAIR_UBO_Material * static void ubo_mat_from_object(CLAY_Storage *storage, Object *ob, bool *r_needs_ao, int *r_id) { - IDProperty *props = BKE_layer_collection_engine_evaluated_get(ob, COLLECTION_MODE_NONE, RE_engine_id_BLENDER_CLAY); + IDProperty *props = BKE_layer_collection_engine_evaluated_get(ob, RE_engine_id_BLENDER_CLAY); int matcap_icon = BKE_collection_engine_property_value_get_int(props, "matcap_icon"); float matcap_rot = BKE_collection_engine_property_value_get_float(props, "matcap_rotation"); @@ -726,7 +727,7 @@ static void ubo_mat_from_object(CLAY_Storage *storage, Object *ob, bool *r_needs static void hair_ubo_mat_from_object(Object *ob, CLAY_HAIR_UBO_Material *r_ubo) { - IDProperty *props = BKE_layer_collection_engine_evaluated_get(ob, COLLECTION_MODE_NONE, RE_engine_id_BLENDER_CLAY); + IDProperty *props = BKE_layer_collection_engine_evaluated_get(ob, RE_engine_id_BLENDER_CLAY); int matcap_icon = BKE_collection_engine_property_value_get_int(props, "matcap_icon"); float matcap_rot = BKE_collection_engine_property_value_get_float(props, "matcap_rotation"); @@ -920,8 +921,7 @@ static void clay_cache_populate(void *vedata, Object *ob) struct Gwn_Batch *geom = DRW_cache_object_surface_get(ob); if (geom) { - IDProperty *ces_mode_ob = BKE_layer_collection_engine_evaluated_get(ob, COLLECTION_MODE_OBJECT, ""); - const bool do_cull = BKE_collection_engine_property_value_get_bool(ces_mode_ob, "show_backface_culling"); + const bool do_cull = (draw_ctx->v3d && (draw_ctx->v3d->flag2 & V3D_BACKFACE_CULLING)); const bool is_sculpt_mode = is_active && (draw_ctx->object_mode & OB_MODE_SCULPT) != 0; const bool use_flat = is_sculpt_mode && DRW_object_is_flat_normal(ob); diff --git a/source/blender/draw/engines/eevee/eevee_bloom.c b/source/blender/draw/engines/eevee/eevee_bloom.c index 3648a56cd8b..2b0cdf846b4 100644 --- a/source/blender/draw/engines/eevee/eevee_bloom.c +++ b/source/blender/draw/engines/eevee/eevee_bloom.c @@ -88,7 +88,7 @@ int EEVEE_bloom_init(EEVEE_ViewLayerData *UNUSED(sldata), EEVEE_Data *vedata) const DRWContextState *draw_ctx = DRW_context_state_get(); ViewLayer *view_layer = draw_ctx->view_layer; - IDProperty *props = BKE_view_layer_engine_evaluated_get(view_layer, COLLECTION_MODE_NONE, RE_engine_id_BLENDER_EEVEE); + IDProperty *props = BKE_view_layer_engine_evaluated_get(view_layer, RE_engine_id_BLENDER_EEVEE); if (BKE_collection_engine_property_value_get_bool(props, "bloom_enable")) { const float *viewport_size = DRW_viewport_size_get(); diff --git a/source/blender/draw/engines/eevee/eevee_depth_of_field.c b/source/blender/draw/engines/eevee/eevee_depth_of_field.c index be7b51f7018..393dbede00f 100644 --- a/source/blender/draw/engines/eevee/eevee_depth_of_field.c +++ b/source/blender/draw/engines/eevee/eevee_depth_of_field.c @@ -83,7 +83,7 @@ int EEVEE_depth_of_field_init(EEVEE_ViewLayerData *UNUSED(sldata), EEVEE_Data *v const DRWContextState *draw_ctx = DRW_context_state_get(); ViewLayer *view_layer = draw_ctx->view_layer; - IDProperty *props = BKE_view_layer_engine_evaluated_get(view_layer, COLLECTION_MODE_NONE, RE_engine_id_BLENDER_EEVEE); + IDProperty *props = BKE_view_layer_engine_evaluated_get(view_layer, RE_engine_id_BLENDER_EEVEE); if (BKE_collection_engine_property_value_get_bool(props, "dof_enable")) { Scene *scene = draw_ctx->scene; diff --git a/source/blender/draw/engines/eevee/eevee_lightprobes.c b/source/blender/draw/engines/eevee/eevee_lightprobes.c index ee9a70d5eab..22eeab55598 100644 --- a/source/blender/draw/engines/eevee/eevee_lightprobes.c +++ b/source/blender/draw/engines/eevee/eevee_lightprobes.c @@ -302,7 +302,7 @@ void EEVEE_lightprobes_init(EEVEE_ViewLayerData *sldata, EEVEE_Data *UNUSED(veda bool update_all = false; const DRWContextState *draw_ctx = DRW_context_state_get(); ViewLayer *view_layer = draw_ctx->view_layer; - IDProperty *props = BKE_view_layer_engine_evaluated_get(view_layer, COLLECTION_MODE_NONE, RE_engine_id_BLENDER_EEVEE); + IDProperty *props = BKE_view_layer_engine_evaluated_get(view_layer, RE_engine_id_BLENDER_EEVEE); /* Shaders */ if (!e_data.probe_filter_glossy_sh) { diff --git a/source/blender/draw/engines/eevee/eevee_lights.c b/source/blender/draw/engines/eevee/eevee_lights.c index a00488c66db..15d813e56c6 100644 --- a/source/blender/draw/engines/eevee/eevee_lights.c +++ b/source/blender/draw/engines/eevee/eevee_lights.c @@ -101,7 +101,7 @@ void EEVEE_lights_init(EEVEE_ViewLayerData *sldata) const DRWContextState *draw_ctx = DRW_context_state_get(); ViewLayer *view_layer = draw_ctx->view_layer; - IDProperty *props = BKE_view_layer_engine_evaluated_get(view_layer, COLLECTION_MODE_NONE, RE_engine_id_BLENDER_EEVEE); + IDProperty *props = BKE_view_layer_engine_evaluated_get(view_layer, RE_engine_id_BLENDER_EEVEE); if (!e_data.shadow_sh) { e_data.shadow_sh = DRW_shader_create( diff --git a/source/blender/draw/engines/eevee/eevee_materials.c b/source/blender/draw/engines/eevee/eevee_materials.c index d7595b1a090..a33c1e9bb67 100644 --- a/source/blender/draw/engines/eevee/eevee_materials.c +++ b/source/blender/draw/engines/eevee/eevee_materials.c @@ -1298,8 +1298,7 @@ void EEVEE_materials_cache_populate(EEVEE_Data *vedata, EEVEE_ViewLayerData *sld Scene *scene = draw_ctx->scene; GHash *material_hash = stl->g_data->material_hash; - IDProperty *ces_mode_ob = BKE_layer_collection_engine_evaluated_get(ob, COLLECTION_MODE_OBJECT, ""); - const bool do_cull = BKE_collection_engine_property_value_get_bool(ces_mode_ob, "show_backface_culling"); + const bool do_cull = (draw_ctx->v3d && (draw_ctx->v3d->flag2 & V3D_BACKFACE_CULLING)); const bool is_active = (ob == draw_ctx->obact); const bool is_sculpt_mode = is_active && (draw_ctx->object_mode & OB_MODE_SCULPT) != 0; #if 0 diff --git a/source/blender/draw/engines/eevee/eevee_motion_blur.c b/source/blender/draw/engines/eevee/eevee_motion_blur.c index 31f3986a1fb..0c8f929ec0e 100644 --- a/source/blender/draw/engines/eevee/eevee_motion_blur.c +++ b/source/blender/draw/engines/eevee/eevee_motion_blur.c @@ -114,7 +114,6 @@ int EEVEE_motion_blur_init(EEVEE_ViewLayerData *UNUSED(sldata), EEVEE_Data *veda RegionView3D *rv3d = draw_ctx->rv3d; ARegion *ar = draw_ctx->ar; IDProperty *props = BKE_view_layer_engine_evaluated_get(view_layer, - COLLECTION_MODE_NONE, RE_engine_id_BLENDER_EEVEE); if (BKE_collection_engine_property_value_get_bool(props, "motion_blur_enable")) { diff --git a/source/blender/draw/engines/eevee/eevee_occlusion.c b/source/blender/draw/engines/eevee/eevee_occlusion.c index f4eca07a3d8..7ad56327251 100644 --- a/source/blender/draw/engines/eevee/eevee_occlusion.c +++ b/source/blender/draw/engines/eevee/eevee_occlusion.c @@ -75,7 +75,6 @@ int EEVEE_occlusion_init(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata) const DRWContextState *draw_ctx = DRW_context_state_get(); ViewLayer *view_layer = draw_ctx->view_layer; IDProperty *props = BKE_view_layer_engine_evaluated_get(view_layer, - COLLECTION_MODE_NONE, RE_engine_id_BLENDER_EEVEE); if (BKE_collection_engine_property_value_get_bool(props, "gtao_enable")) { @@ -141,7 +140,7 @@ void EEVEE_occlusion_output_init(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata const DRWContextState *draw_ctx = DRW_context_state_get(); ViewLayer *view_layer = draw_ctx->view_layer; - IDProperty *props = BKE_view_layer_engine_evaluated_get(view_layer, COLLECTION_MODE_NONE, RE_engine_id_BLENDER_EEVEE); + IDProperty *props = BKE_view_layer_engine_evaluated_get(view_layer, RE_engine_id_BLENDER_EEVEE); if (BKE_collection_engine_property_value_get_bool(props, "gtao_enable")) { DefaultTextureList *dtxl = DRW_viewport_texture_list_get(); diff --git a/source/blender/draw/engines/eevee/eevee_render.c b/source/blender/draw/engines/eevee/eevee_render.c index 5c4744987dd..da42f84baa2 100644 --- a/source/blender/draw/engines/eevee/eevee_render.c +++ b/source/blender/draw/engines/eevee/eevee_render.c @@ -435,7 +435,7 @@ void EEVEE_render_draw(EEVEE_Data *vedata, RenderEngine *engine, RenderLayer *rl EEVEE_occlusion_output_init(sldata, vedata); } - IDProperty *props = BKE_view_layer_engine_evaluated_get(view_layer, COLLECTION_MODE_NONE, RE_engine_id_BLENDER_EEVEE); + IDProperty *props = BKE_view_layer_engine_evaluated_get(view_layer, RE_engine_id_BLENDER_EEVEE); unsigned int tot_sample = BKE_collection_engine_property_value_get_int(props, "taa_render_samples"); unsigned int render_samples = 0; diff --git a/source/blender/draw/engines/eevee/eevee_screen_raytrace.c b/source/blender/draw/engines/eevee/eevee_screen_raytrace.c index 55d9484c213..56cc905d701 100644 --- a/source/blender/draw/engines/eevee/eevee_screen_raytrace.c +++ b/source/blender/draw/engines/eevee/eevee_screen_raytrace.c @@ -113,7 +113,6 @@ int EEVEE_screen_raytrace_init(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata) const DRWContextState *draw_ctx = DRW_context_state_get(); ViewLayer *view_layer = draw_ctx->view_layer; IDProperty *props = BKE_view_layer_engine_evaluated_get(view_layer, - COLLECTION_MODE_NONE, RE_engine_id_BLENDER_EEVEE); /* Compute pixel size, (shared with contact shadows) */ diff --git a/source/blender/draw/engines/eevee/eevee_subsurface.c b/source/blender/draw/engines/eevee/eevee_subsurface.c index b69b05a917b..5ccc182a54a 100644 --- a/source/blender/draw/engines/eevee/eevee_subsurface.c +++ b/source/blender/draw/engines/eevee/eevee_subsurface.c @@ -70,7 +70,7 @@ int EEVEE_subsurface_init(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata) const DRWContextState *draw_ctx = DRW_context_state_get(); ViewLayer *view_layer = draw_ctx->view_layer; - IDProperty *props = BKE_view_layer_engine_evaluated_get(view_layer, COLLECTION_MODE_NONE, RE_engine_id_BLENDER_EEVEE); + IDProperty *props = BKE_view_layer_engine_evaluated_get(view_layer, RE_engine_id_BLENDER_EEVEE); if (BKE_collection_engine_property_value_get_bool(props, "sss_enable")) { effects->sss_sample_count = 1 + BKE_collection_engine_property_value_get_int(props, "sss_samples") * 2; @@ -148,7 +148,7 @@ void EEVEE_subsurface_output_init(EEVEE_ViewLayerData *UNUSED(sldata), EEVEE_Dat const DRWContextState *draw_ctx = DRW_context_state_get(); ViewLayer *view_layer = draw_ctx->view_layer; - IDProperty *props = BKE_view_layer_engine_evaluated_get(view_layer, COLLECTION_MODE_NONE, RE_engine_id_BLENDER_EEVEE); + IDProperty *props = BKE_view_layer_engine_evaluated_get(view_layer, RE_engine_id_BLENDER_EEVEE); if (BKE_collection_engine_property_value_get_bool(props, "sss_enable")) { DRW_texture_ensure_fullscreen_2D(&txl->sss_dir_accum, GPU_RGBA16F, 0); diff --git a/source/blender/draw/engines/eevee/eevee_temporal_sampling.c b/source/blender/draw/engines/eevee/eevee_temporal_sampling.c index b7f9af92673..d9db7e45400 100644 --- a/source/blender/draw/engines/eevee/eevee_temporal_sampling.c +++ b/source/blender/draw/engines/eevee/eevee_temporal_sampling.c @@ -193,7 +193,7 @@ int EEVEE_temporal_sampling_init(EEVEE_ViewLayerData *UNUSED(sldata), EEVEE_Data const DRWContextState *draw_ctx = DRW_context_state_get(); ViewLayer *view_layer = draw_ctx->view_layer; - IDProperty *props = BKE_view_layer_engine_evaluated_get(view_layer, COLLECTION_MODE_NONE, RE_engine_id_BLENDER_EEVEE); + IDProperty *props = BKE_view_layer_engine_evaluated_get(view_layer, RE_engine_id_BLENDER_EEVEE); if ((BKE_collection_engine_property_value_get_int(props, "taa_samples") != 1 && /* FIXME the motion blur camera evaluation is tagging view_updated diff --git a/source/blender/draw/engines/eevee/eevee_volumes.c b/source/blender/draw/engines/eevee/eevee_volumes.c index 2fc480ca36b..9b039345fce 100644 --- a/source/blender/draw/engines/eevee/eevee_volumes.c +++ b/source/blender/draw/engines/eevee/eevee_volumes.c @@ -156,7 +156,7 @@ int EEVEE_volumes_init(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata) const DRWContextState *draw_ctx = DRW_context_state_get(); ViewLayer *view_layer = draw_ctx->view_layer; - IDProperty *props = BKE_view_layer_engine_evaluated_get(view_layer, COLLECTION_MODE_NONE, RE_engine_id_BLENDER_EEVEE); + IDProperty *props = BKE_view_layer_engine_evaluated_get(view_layer, RE_engine_id_BLENDER_EEVEE); const float *viewport_size = DRW_viewport_size_get(); diff --git a/source/blender/draw/engines/workbench/workbench_materials.c b/source/blender/draw/engines/workbench/workbench_materials.c index 1ee4aa88c8d..0538eb4b60a 100644 --- a/source/blender/draw/engines/workbench/workbench_materials.c +++ b/source/blender/draw/engines/workbench/workbench_materials.c @@ -289,7 +289,7 @@ void workbench_materials_cache_init(WORKBENCH_Data *vedata) DRWShadingGroup *grp; const DRWContextState *draw_ctx = DRW_context_state_get(); ViewLayer *view_layer = draw_ctx->view_layer; - IDProperty *props = BKE_view_layer_engine_evaluated_get(view_layer, COLLECTION_MODE_NONE, RE_engine_id_BLENDER_WORKBENCH); + IDProperty *props = BKE_view_layer_engine_evaluated_get(view_layer, RE_engine_id_BLENDER_WORKBENCH); static float light_multiplier = 1.0f; const DRWContextState *DCS = DRW_context_state_get(); @@ -431,7 +431,7 @@ void workbench_materials_solid_cache_populate(WORKBENCH_Data *vedata, Object *ob if (!DRW_object_is_renderable(ob)) return; - IDProperty *props = BKE_layer_collection_engine_evaluated_get(ob, COLLECTION_MODE_NONE, RE_engine_id_BLENDER_WORKBENCH); + IDProperty *props = BKE_layer_collection_engine_evaluated_get(ob, RE_engine_id_BLENDER_WORKBENCH); if (ob->type == OB_MESH) { workbench_cache_populate_particles(vedata, props, ob); } diff --git a/source/blender/draw/intern/draw_manager.c b/source/blender/draw/intern/draw_manager.c index 7e595d7fcdd..907c62d091e 100644 --- a/source/blender/draw/intern/draw_manager.c +++ b/source/blender/draw/intern/draw_manager.c @@ -150,13 +150,10 @@ bool DRW_object_is_renderable(Object *ob) if (ob->type == OB_MESH) { if (ob == DST.draw_ctx.object_edit) { - IDProperty *props = BKE_layer_collection_engine_evaluated_get(ob, COLLECTION_MODE_EDIT, ""); - bool do_show_occlude_wire = BKE_collection_engine_property_value_get_bool(props, "show_occlude_wire"); - if (do_show_occlude_wire) { - return false; - } - bool do_show_weight = BKE_collection_engine_property_value_get_bool(props, "show_weight"); - if (do_show_weight) { + View3D *v3d = DST.draw_ctx.v3d; + const int mask = (V3D_OVERLAY_EDIT_OCCLUDE_WIRE | V3D_OVERLAY_EDIT_WEIGHT); + + if (v3d && v3d->overlay.edit_flag & mask) { return false; } } diff --git a/source/blender/draw/modes/edit_curve_mode.c b/source/blender/draw/modes/edit_curve_mode.c index f5db49877a7..2a383530523 100644 --- a/source/blender/draw/modes/edit_curve_mode.c +++ b/source/blender/draw/modes/edit_curve_mode.c @@ -27,6 +27,7 @@ #include "DRW_render.h" #include "DNA_curve_types.h" +#include "DNA_view3d_types.h" #include "BKE_object.h" @@ -230,7 +231,7 @@ static void EDIT_CURVE_cache_populate(void *vedata, Object *ob) EDIT_CURVE_PassList *psl = ((EDIT_CURVE_Data *)vedata)->psl; EDIT_CURVE_StorageList *stl = ((EDIT_CURVE_Data *)vedata)->stl; const DRWContextState *draw_ctx = DRW_context_state_get(); - const Scene *scene = draw_ctx->scene; + View3D *v3d = draw_ctx->v3d; UNUSED_VARS(psl, stl); @@ -249,7 +250,7 @@ static void EDIT_CURVE_cache_populate(void *vedata, Object *ob) DRW_shgroup_call_add(stl->g_data->wire_shgrp, geom, ob->obmat); if ((cu->flag & CU_3D) && (cu->drawflag & CU_HIDE_NORMALS) == 0) { - geom = DRW_cache_curve_edge_normal_get(ob, scene->toolsettings->normalsize); + geom = DRW_cache_curve_edge_normal_get(ob, v3d->overlay.normals_length); DRW_shgroup_call_add(stl->g_data->wire_shgrp, geom, ob->obmat); } diff --git a/source/blender/draw/modes/edit_mesh_mode.c b/source/blender/draw/modes/edit_mesh_mode.c index 278f67e75bb..cf5d36bded6 100644 --- a/source/blender/draw/modes/edit_mesh_mode.c +++ b/source/blender/draw/modes/edit_mesh_mode.c @@ -452,18 +452,17 @@ static void EDIT_MESH_cache_populate(void *vedata, Object *ob) if (ob->type == OB_MESH) { if ((ob == draw_ctx->object_edit) || BKE_object_is_in_editmode_and_selected(ob)) { const Mesh *me = ob->data; - IDProperty *ces_mode_ed = BKE_layer_collection_engine_evaluated_get(ob, COLLECTION_MODE_EDIT, ""); - bool do_occlude_wire = BKE_collection_engine_property_value_get_bool(ces_mode_ed, "show_occlude_wire"); - bool do_show_weight = BKE_collection_engine_property_value_get_bool(ces_mode_ed, "show_weight"); + bool do_occlude_wire = (v3d->overlay.edit_flag & V3D_OVERLAY_EDIT_OCCLUDE_WIRE) != 0; + bool do_show_weight = (v3d->overlay.edit_flag & V3D_OVERLAY_EDIT_WEIGHT) != 0; /* Updating uniform */ - backwire_opacity = BKE_collection_engine_property_value_get_float(ces_mode_ed, "backwire_opacity"); + backwire_opacity = v3d->overlay.backwire_opacity; - bool fnormals_do = BKE_collection_engine_property_value_get_bool(ces_mode_ed, "face_normals_show"); - bool vnormals_do = BKE_collection_engine_property_value_get_bool(ces_mode_ed, "vert_normals_show"); - bool lnormals_do = BKE_collection_engine_property_value_get_bool(ces_mode_ed, "loop_normals_show"); + bool fnormals_do = (v3d->overlay.edit_flag & V3D_OVERLAY_EDIT_FACE_NORMALS) != 0; + bool vnormals_do = (v3d->overlay.edit_flag & V3D_OVERLAY_EDIT_VERT_NORMALS) != 0; + bool lnormals_do = (v3d->overlay.edit_flag & V3D_OVERLAY_EDIT_LOOP_NORMALS) != 0; /* Updating uniform */ - size_normal = BKE_collection_engine_property_value_get_float(ces_mode_ed, "normals_length"); + size_normal = v3d->overlay.normals_length; face_mod = (do_occlude_wire) ? 0.0f : 1.0f; @@ -553,20 +552,6 @@ static void EDIT_MESH_draw_scene(void *vedata) } } -void EDIT_MESH_collection_settings_create(IDProperty *properties) -{ - BLI_assert(properties && - properties->type == IDP_GROUP && - properties->subtype == IDP_GROUP_SUB_MODE_EDIT); - BKE_collection_engine_property_add_int(properties, "show_occlude_wire", false); - BKE_collection_engine_property_add_int(properties, "show_weight", false); - BKE_collection_engine_property_add_int(properties, "face_normals_show", false); - BKE_collection_engine_property_add_int(properties, "vert_normals_show", false); - BKE_collection_engine_property_add_int(properties, "loop_normals_show", false); - BKE_collection_engine_property_add_float(properties, "normals_length", 0.1); - BKE_collection_engine_property_add_float(properties, "backwire_opacity", 0.5); -} - static void EDIT_MESH_engine_free(void) { DRW_SHADER_FREE_SAFE(e_data.overlay_tri_sh); diff --git a/source/blender/draw/modes/object_mode.c b/source/blender/draw/modes/object_mode.c index 5449a6c13bc..41b3d176437 100644 --- a/source/blender/draw/modes/object_mode.c +++ b/source/blender/draw/modes/object_mode.c @@ -1996,9 +1996,6 @@ static void OBJECT_cache_populate(void *vedata, Object *ob) return; } - //CollectionEngineSettings *ces_mode_ob = BKE_layer_collection_engine_evaluated_get(ob, COLLECTION_MODE_OBJECT, ""); - - //bool do_wire = BKE_collection_engine_property_value_get_bool(ces_mode_ob, "show_wire"); bool do_outlines = ((ob->base_flag & BASE_SELECTED) != 0); if (do_outlines) { @@ -2236,15 +2233,6 @@ static void OBJECT_draw_scene(void *vedata) } } -void OBJECT_collection_settings_create(IDProperty *props) -{ - BLI_assert(props && - props->type == IDP_GROUP && - props->subtype == IDP_GROUP_SUB_MODE_OBJECT); - BKE_collection_engine_property_add_int(props, "show_wire", false); - BKE_collection_engine_property_add_int(props, "show_backface_culling", false); -} - static const DrawEngineDataSize OBJECT_data_size = DRW_VIEWPORT_DATA_SIZE(OBJECT_Data); DrawEngineType draw_engine_object_type = { diff --git a/source/blender/draw/modes/paint_vertex_mode.c b/source/blender/draw/modes/paint_vertex_mode.c index 9ff49a27645..7efa13f1312 100644 --- a/source/blender/draw/modes/paint_vertex_mode.c +++ b/source/blender/draw/modes/paint_vertex_mode.c @@ -34,6 +34,7 @@ #include "draw_mode_engines.h" #include "DNA_mesh_types.h" +#include "DNA_view3d_types.h" extern struct GPUUniformBuffer *globals_ubo; /* draw_common.c */ extern struct GlobalsUboStorage ts; /* draw_common.c */ @@ -139,11 +140,11 @@ static void PAINT_VERTEX_cache_populate(void *vedata, Object *ob) { PAINT_VERTEX_StorageList *stl = ((PAINT_VERTEX_Data *)vedata)->stl; const DRWContextState *draw_ctx = DRW_context_state_get(); + const View3D *v3d = draw_ctx->v3d; if ((ob->type == OB_MESH) && (ob == draw_ctx->obact)) { - IDProperty *ces_mode_pw = BKE_layer_collection_engine_evaluated_get(ob, COLLECTION_MODE_PAINT_VERTEX, ""); const Mesh *me = ob->data; - const bool use_wire = BKE_collection_engine_property_value_get_bool(ces_mode_pw, "use_wire"); + const bool use_wire = (v3d->overlay.paint_flag & V3D_OVERLAY_PAINT_WIRE) != 0; const bool use_surface = DRW_object_is_mode_shade(ob) == true; const bool use_face_sel = (me->editflag & ME_EDIT_PAINT_FACE_SEL) != 0; struct Gwn_Batch *geom; @@ -180,15 +181,6 @@ static void PAINT_VERTEX_engine_free(void) DRW_SHADER_FREE_SAFE(e_data.wire_overlay_shader); } -void PAINT_VERTEX_collection_settings_create(IDProperty *properties) -{ - BLI_assert(properties && - properties->type == IDP_GROUP && - properties->subtype == IDP_GROUP_SUB_MODE_PAINT_VERTEX); - - BKE_collection_engine_property_add_bool(properties, "use_wire", false); -} - static const DrawEngineDataSize PAINT_VERTEX_data_size = DRW_VIEWPORT_DATA_SIZE(PAINT_VERTEX_Data); DrawEngineType draw_engine_paint_vertex_type = { diff --git a/source/blender/draw/modes/paint_weight_mode.c b/source/blender/draw/modes/paint_weight_mode.c index a5a9f355dc6..d7ad3e93af7 100644 --- a/source/blender/draw/modes/paint_weight_mode.c +++ b/source/blender/draw/modes/paint_weight_mode.c @@ -34,6 +34,7 @@ #include "draw_mode_engines.h" #include "DNA_mesh_types.h" +#include "DNA_view3d_types.h" #include "BKE_mesh.h" @@ -176,11 +177,11 @@ static void PAINT_WEIGHT_cache_populate(void *vedata, Object *ob) { PAINT_WEIGHT_StorageList *stl = ((PAINT_WEIGHT_Data *)vedata)->stl; const DRWContextState *draw_ctx = DRW_context_state_get(); + const View3D *v3d = draw_ctx->v3d; if ((ob->type == OB_MESH) && (ob == draw_ctx->obact)) { - IDProperty *ces_mode_pw = BKE_layer_collection_engine_evaluated_get(ob, COLLECTION_MODE_PAINT_WEIGHT, ""); const Mesh *me = ob->data; - const bool use_wire = BKE_collection_engine_property_value_get_bool(ces_mode_pw, "use_wire"); + const bool use_wire = (v3d->overlay.paint_flag & V3D_OVERLAY_PAINT_WIRE) != 0; const bool use_surface = DRW_object_is_mode_shade(ob) == true; const bool use_face_sel = (me->editflag & ME_EDIT_PAINT_FACE_SEL) != 0; const bool use_vert_sel = (me->editflag & ME_EDIT_PAINT_VERT_SEL) != 0; @@ -224,15 +225,6 @@ static void PAINT_WEIGHT_engine_free(void) DRW_SHADER_FREE_SAFE(e_data.vert_overlay_shader); } -void PAINT_WEIGHT_collection_settings_create(IDProperty *properties) -{ - BLI_assert(properties && - properties->type == IDP_GROUP && - properties->subtype == IDP_GROUP_SUB_MODE_PAINT_WEIGHT); - - BKE_collection_engine_property_add_bool(properties, "use_wire", false); -} - static const DrawEngineDataSize PAINT_WEIGHT_data_size = DRW_VIEWPORT_DATA_SIZE(PAINT_WEIGHT_Data); DrawEngineType draw_engine_paint_weight_type = { diff --git a/source/blender/makesdna/DNA_layer_types.h b/source/blender/makesdna/DNA_layer_types.h index 2ee0eff7a9c..b3309a2e10f 100644 --- a/source/blender/makesdna/DNA_layer_types.h +++ b/source/blender/makesdna/DNA_layer_types.h @@ -141,21 +141,6 @@ enum { COLLECTION_TYPE_GROUP_INTERNAL = 1, }; -/* *************************************************************** */ -/* Engine Settings */ - -/* CollectionEngineSettings->type */ -typedef enum CollectionEngineSettingsType { - COLLECTION_MODE_NONE = 0, - COLLECTION_MODE_OBJECT = 1, - COLLECTION_MODE_EDIT = 2, - COLLECTION_MODE_PAINT_WEIGHT = 5, - COLLECTION_MODE_PAINT_VERTEX = 6, -} CollectionModeSettingsType; - -/* *************************************************************** */ - - #ifdef __cplusplus } #endif diff --git a/source/blender/makesdna/DNA_scene_types.h b/source/blender/makesdna/DNA_scene_types.h index 03f3f80f807..2f3d5a82730 100644 --- a/source/blender/makesdna/DNA_scene_types.h +++ b/source/blender/makesdna/DNA_scene_types.h @@ -1208,7 +1208,6 @@ typedef struct ToolSettings { float vgroup_weight; float doublimit; /* remove doubles limit */ - float normalsize; /* size of normals */ short automerge; /* Selection Mode for Mesh */ @@ -1233,6 +1232,8 @@ typedef struct ToolSettings { char gpencil_v2d_align; /* : General 2D Editor */ char gpencil_seq_align; /* : Sequencer Preview */ char gpencil_ima_align; /* : Image Editor */ + + char _pad3[4]; /* Grease Pencil Sculpt */ struct GP_BrushEdit_Settings gp_sculpt; diff --git a/source/blender/makesdna/DNA_view3d_types.h b/source/blender/makesdna/DNA_view3d_types.h index 8e5deb7133b..ef2944c12a2 100644 --- a/source/blender/makesdna/DNA_view3d_types.h +++ b/source/blender/makesdna/DNA_view3d_types.h @@ -146,6 +146,14 @@ typedef struct View3DShading { /* 3D Viewport Overlay setings */ typedef struct View3DOverlay { int flag; + + /* Edit mode settings */ + int edit_flag; + float normals_length; + float backwire_opacity; + + /* Paint mode settings */ + int paint_flag; int pad; } View3DOverlay; @@ -330,8 +338,24 @@ enum { /* View3DOverlay->flag */ enum { - V3D_OVERLAY_FACE_ORIENTATION = (1 << 0), - V3D_OVERLAY_HIDE_CURSOR = (1 << 1), + V3D_OVERLAY_FACE_ORIENTATION = (1 << 0), + V3D_OVERLAY_HIDE_CURSOR = (1 << 1), +}; + +/* View3DOverlay->edit_flag */ +enum { + V3D_OVERLAY_EDIT_VERT_NORMALS = (1 << 0), + V3D_OVERLAY_EDIT_LOOP_NORMALS = (1 << 1), + V3D_OVERLAY_EDIT_FACE_NORMALS = (1 << 2), + + V3D_OVERLAY_EDIT_OCCLUDE_WIRE = (1 << 3), + + V3D_OVERLAY_EDIT_WEIGHT = (1 << 4), +}; + +/* View3DOverlay->paint_flag */ +enum { + V3D_OVERLAY_PAINT_WIRE = (1 << 0), }; /* View3D->around */ diff --git a/source/blender/makesrna/intern/rna_layer.c b/source/blender/makesrna/intern/rna_layer.c index cbc88835c1b..c9728e82442 100644 --- a/source/blender/makesrna/intern/rna_layer.c +++ b/source/blender/makesrna/intern/rna_layer.c @@ -47,14 +47,6 @@ #include "rna_internal.h" -const EnumPropertyItem rna_enum_layer_collection_mode_settings_type_items[] = { - {COLLECTION_MODE_OBJECT, "OBJECT", 0, "Object", ""}, - {COLLECTION_MODE_EDIT, "EDIT", 0, "Edit", ""}, - {COLLECTION_MODE_PAINT_WEIGHT, "PAINT_WEIGHT", 0, "Weight Paint", ""}, - {COLLECTION_MODE_PAINT_WEIGHT, "PAINT_VERTEX", 0, "Vertex Paint", ""}, - {0, NULL, 0, NULL, NULL} -}; - const EnumPropertyItem rna_enum_collection_type_items[] = { {COLLECTION_TYPE_NONE, "NONE", 0, "Normal", ""}, {COLLECTION_TYPE_GROUP_INTERNAL, "GROUP_INTERNAL", 0, "Group Internal", ""}, @@ -257,7 +249,7 @@ static void rna_SceneCollection_object_unlink( /****** layer collection engine settings *******/ -#define RNA_LAYER_ENGINE_GET_SET(_TYPE_, _ENGINE_, _MODE_, _NAME_) \ +#define RNA_LAYER_ENGINE_GET_SET(_TYPE_, _ENGINE_, _NAME_) \ static _TYPE_ rna_LayerEngineSettings_##_ENGINE_##_##_NAME_##_get(PointerRNA *ptr) \ { \ IDProperty *props = (IDProperty *)ptr->data; \ @@ -270,7 +262,7 @@ static void rna_LayerEngineSettings_##_ENGINE_##_##_NAME_##_set(PointerRNA *ptr, BKE_collection_engine_property_value_set_##_TYPE_(props, #_NAME_, value); \ } -#define RNA_LAYER_ENGINE_GET_SET_ARRAY(_TYPE_, _ENGINE_, _MODE_, _NAME_, _LEN_) \ +#define RNA_LAYER_ENGINE_GET_SET_ARRAY(_TYPE_, _ENGINE_, _NAME_, _LEN_) \ static void rna_LayerEngineSettings_##_ENGINE_##_##_NAME_##_get(PointerRNA *ptr, _TYPE_ *values) \ { \ IDProperty *props = (IDProperty *)ptr->data; \ @@ -287,66 +279,40 @@ static void rna_LayerEngineSettings_##_ENGINE_##_##_NAME_##_set(PointerRNA *ptr, } #define RNA_LAYER_ENGINE_CLAY_GET_SET_FLOAT(_NAME_) \ - RNA_LAYER_ENGINE_GET_SET(float, Clay, COLLECTION_MODE_NONE, _NAME_) + RNA_LAYER_ENGINE_GET_SET(float, Clay, _NAME_) #define RNA_LAYER_ENGINE_CLAY_GET_SET_FLOAT_ARRAY(_NAME_, _LEN_) \ - RNA_LAYER_ENGINE_GET_SET_ARRAY(float, Clay, COLLECTION_MODE_NONE, _NAME_, _LEN_) + RNA_LAYER_ENGINE_GET_SET_ARRAY(float, Clay, _NAME_, _LEN_) #define RNA_LAYER_ENGINE_CLAY_GET_SET_INT(_NAME_) \ - RNA_LAYER_ENGINE_GET_SET(int, Clay, COLLECTION_MODE_NONE, _NAME_) + RNA_LAYER_ENGINE_GET_SET(int, Clay, _NAME_) #define RNA_LAYER_ENGINE_CLAY_GET_SET_BOOL(_NAME_) \ - RNA_LAYER_ENGINE_GET_SET(bool, Clay, COLLECTION_MODE_NONE, _NAME_) + RNA_LAYER_ENGINE_GET_SET(bool, Clay, _NAME_) #define RNA_LAYER_ENGINE_EEVEE_GET_SET_FLOAT(_NAME_) \ - RNA_LAYER_ENGINE_GET_SET(float, Eevee, COLLECTION_MODE_NONE, _NAME_) + RNA_LAYER_ENGINE_GET_SET(float, Eevee, _NAME_) #define RNA_LAYER_ENGINE_EEVEE_GET_SET_FLOAT_ARRAY(_NAME_, _LEN_) \ - RNA_LAYER_ENGINE_GET_SET_ARRAY(float, Eevee, COLLECTION_MODE_NONE, _NAME_, _LEN_) + RNA_LAYER_ENGINE_GET_SET_ARRAY(float, Eevee, _NAME_, _LEN_) #define RNA_LAYER_ENGINE_EEVEE_GET_SET_INT(_NAME_) \ - RNA_LAYER_ENGINE_GET_SET(int, Eevee, COLLECTION_MODE_NONE, _NAME_) + RNA_LAYER_ENGINE_GET_SET(int, Eevee, _NAME_) #define RNA_LAYER_ENGINE_EEVEE_GET_SET_BOOL(_NAME_) \ - RNA_LAYER_ENGINE_GET_SET(bool, Eevee, COLLECTION_MODE_NONE, _NAME_) + RNA_LAYER_ENGINE_GET_SET(bool, Eevee, _NAME_) #define RNA_LAYER_ENGINE_WORKBENCH_GET_SET_FLOAT_ARRAY(_NAME_, _LEN_) \ - RNA_LAYER_ENGINE_GET_SET_ARRAY(float, Workbench, COLLECTION_MODE_NONE, _NAME_, _LEN_) + RNA_LAYER_ENGINE_GET_SET_ARRAY(float, Workbench, _NAME_, _LEN_) #define RNA_LAYER_ENGINE_WORKBENCH_GET_SET_FLOAT(_NAME_) \ - RNA_LAYER_ENGINE_GET_SET(float, Workbench, COLLECTION_MODE_NONE, _NAME_) + RNA_LAYER_ENGINE_GET_SET(float, Workbench, _NAME_) #define RNA_LAYER_ENGINE_WORKBENCH_GET_SET_INT(_NAME_) \ - RNA_LAYER_ENGINE_GET_SET(int, Workbench, COLLECTION_MODE_NONE, _NAME_) + RNA_LAYER_ENGINE_GET_SET(int, Workbench, _NAME_) #define RNA_LAYER_ENGINE_WORKBENCH_GET_SET_BOOL(_NAME_) \ - RNA_LAYER_ENGINE_GET_SET(bool, Workbench, COLLECTION_MODE_NONE, _NAME_) - -/* mode engines */ - -#define RNA_LAYER_MODE_OBJECT_GET_SET_FLOAT(_NAME_) \ - RNA_LAYER_ENGINE_GET_SET(float, ObjectMode, COLLECTION_MODE_OBJECT, _NAME_) - -#define RNA_LAYER_MODE_OBJECT_GET_SET_INT(_NAME_) \ - RNA_LAYER_ENGINE_GET_SET(int, ObjectMode, COLLECTION_MODE_OBJECT, _NAME_) - -#define RNA_LAYER_MODE_OBJECT_GET_SET_BOOL(_NAME_) \ - RNA_LAYER_ENGINE_GET_SET(bool, ObjectMode, COLLECTION_MODE_OBJECT, _NAME_) - -#define RNA_LAYER_MODE_EDIT_GET_SET_FLOAT(_NAME_) \ - RNA_LAYER_ENGINE_GET_SET(float, EditMode, COLLECTION_MODE_EDIT, _NAME_) - -#define RNA_LAYER_MODE_EDIT_GET_SET_INT(_NAME_) \ - RNA_LAYER_ENGINE_GET_SET(int, EditMode, COLLECTION_MODE_EDIT, _NAME_) - -#define RNA_LAYER_MODE_EDIT_GET_SET_BOOL(_NAME_) \ - RNA_LAYER_ENGINE_GET_SET(bool, EditMode, COLLECTION_MODE_EDIT, _NAME_) - -#define RNA_LAYER_MODE_PAINT_WEIGHT_GET_SET_BOOL(_NAME_) \ - RNA_LAYER_ENGINE_GET_SET(bool, PaintWeightMode, COLLECTION_MODE_PAINT_WEIGHT, _NAME_) - -#define RNA_LAYER_MODE_PAINT_VERTEX_GET_SET_BOOL(_NAME_) \ - RNA_LAYER_ENGINE_GET_SET(bool, PaintVertexMode, COLLECTION_MODE_PAINT_VERTEX, _NAME_) + RNA_LAYER_ENGINE_GET_SET(bool, Workbench, _NAME_) /* clay engine */ #ifdef WITH_CLAY_ENGINE @@ -428,27 +394,6 @@ RNA_LAYER_ENGINE_EEVEE_GET_SET_INT(gi_diffuse_bounces) RNA_LAYER_ENGINE_EEVEE_GET_SET_INT(gi_cubemap_resolution) RNA_LAYER_ENGINE_EEVEE_GET_SET_INT(gi_visibility_resolution) -/* object engine */ -RNA_LAYER_MODE_OBJECT_GET_SET_BOOL(show_wire) -RNA_LAYER_MODE_OBJECT_GET_SET_BOOL(show_backface_culling) - -/* mesh engine */ -RNA_LAYER_MODE_EDIT_GET_SET_BOOL(show_occlude_wire) -RNA_LAYER_MODE_EDIT_GET_SET_BOOL(show_weight) -RNA_LAYER_MODE_EDIT_GET_SET_BOOL(face_normals_show) -RNA_LAYER_MODE_EDIT_GET_SET_BOOL(vert_normals_show) -RNA_LAYER_MODE_EDIT_GET_SET_BOOL(loop_normals_show) -RNA_LAYER_MODE_EDIT_GET_SET_FLOAT(normals_length) -RNA_LAYER_MODE_EDIT_GET_SET_FLOAT(backwire_opacity) - -/* weight paint engine */ -RNA_LAYER_MODE_PAINT_WEIGHT_GET_SET_BOOL(use_shading) -RNA_LAYER_MODE_PAINT_WEIGHT_GET_SET_BOOL(use_wire) - -/* vertex paint engine */ -RNA_LAYER_MODE_PAINT_VERTEX_GET_SET_BOOL(use_shading) -RNA_LAYER_MODE_PAINT_VERTEX_GET_SET_BOOL(use_wire) - #undef RNA_LAYER_ENGINE_GET_SET static void rna_ViewLayerEngineSettings_update(bContext *C, PointerRNA *UNUSED(ptr)) @@ -471,20 +416,6 @@ static void rna_LayerCollectionEngineSettings_update(bContext *UNUSED(C), Pointe WM_main_add_notifier(NC_SCENE | ND_LAYER_CONTENT, NULL); } -static void rna_LayerCollectionEngineSettings_wire_update(bContext *C, PointerRNA *UNUSED(ptr)) -{ - Scene *scene = CTX_data_scene(C); - ViewLayer *view_layer = CTX_data_view_layer(C); - Object *ob = OBACT(view_layer); - - if (ob != NULL && ob->type == OB_MESH) { - BKE_mesh_batch_cache_dirty(ob->data, BKE_MESH_BATCH_DIRTY_ALL); - } - - /* TODO(sergey): Use proper flag for tagging here. */ - DEG_id_tag_update(&scene->id, 0); -} - /***********************************/ static void engine_settings_use(IDProperty *root, IDProperty *props, PointerRNA *props_ptr, const char *identifier) @@ -543,10 +474,6 @@ static StructRNA *rna_ViewLayerSettings_refine(PointerRNA *ptr) return &RNA_ViewLayerEngineSettingsWorkbench; } break; - case IDP_GROUP_SUB_MODE_OBJECT: - case IDP_GROUP_SUB_MODE_EDIT: - case IDP_GROUP_SUB_MODE_PAINT_WEIGHT: - case IDP_GROUP_SUB_MODE_PAINT_VERTEX: default: BLI_assert(!"Mode not fully implemented"); break; @@ -573,7 +500,7 @@ static void rna_ViewLayerSettings_use(ID *id, IDProperty *props, const char *ide PointerRNA scene_props_ptr; IDProperty *scene_props; - scene_props = BKE_view_layer_engine_scene_get(scene, COLLECTION_MODE_NONE, props->name); + scene_props = BKE_view_layer_engine_scene_get(scene, props->name); RNA_pointer_create(id, &RNA_ViewLayerSettings, scene_props, &scene_props_ptr); engine_settings_use(props, scene_props, &scene_props_ptr, identifier); @@ -611,18 +538,6 @@ static StructRNA *rna_LayerCollectionSettings_refine(PointerRNA *ptr) return &RNA_LayerCollectionSettings; } break; - case IDP_GROUP_SUB_MODE_OBJECT: - return &RNA_LayerCollectionModeSettingsObject; - break; - case IDP_GROUP_SUB_MODE_EDIT: - return &RNA_LayerCollectionModeSettingsEdit; - break; - case IDP_GROUP_SUB_MODE_PAINT_WEIGHT: - return &RNA_LayerCollectionModeSettingsPaintWeight; - break; - case IDP_GROUP_SUB_MODE_PAINT_VERTEX: - return &RNA_LayerCollectionModeSettingsPaintVertex; - break; default: BLI_assert(!"Mode not fully implemented"); break; @@ -649,7 +564,7 @@ static void rna_LayerCollectionSettings_use(ID *id, IDProperty *props, const cha PointerRNA scene_props_ptr; IDProperty *scene_props; - scene_props = BKE_layer_collection_engine_scene_get(scene, COLLECTION_MODE_NONE, props->name); + scene_props = BKE_layer_collection_engine_scene_get(scene, props->name); RNA_pointer_create(id, &RNA_LayerCollectionSettings, scene_props, &scene_props_ptr); engine_settings_use(props, scene_props, &scene_props_ptr, identifier); @@ -1752,143 +1667,6 @@ static void rna_def_layer_collection_engine_settings_workbench(BlenderRNA *brna) RNA_define_verify_sdna(1); /* not in sdna */ } -static void rna_def_layer_collection_mode_settings_object(BlenderRNA *brna) -{ - StructRNA *srna; - PropertyRNA *prop; - - srna = RNA_def_struct(brna, "LayerCollectionModeSettingsObject", "LayerCollectionSettings"); - RNA_def_struct_ui_text(srna, "Collections Object Mode Settings", "Object Mode specific settings for this collection"); - RNA_define_verify_sdna(0); /* not in sdna */ - - /* see RNA_LAYER_ENGINE_GET_SET macro */ - - prop = RNA_def_property(srna, "show_wire", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_ui_text(prop, "Wire", "Add the object's wireframe over solid drawing"); - RNA_def_property_boolean_funcs(prop, "rna_LayerEngineSettings_ObjectMode_show_wire_get", "rna_LayerEngineSettings_ObjectMode_show_wire_set"); - RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE); - RNA_def_property_update(prop, 0, "rna_LayerCollectionEngineSettings_update"); - - prop = RNA_def_property(srna, "show_backface_culling", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_ui_text(prop, "Backface Culling", ""); - RNA_def_property_boolean_funcs(prop, "rna_LayerEngineSettings_ObjectMode_show_backface_culling_get", "rna_LayerEngineSettings_ObjectMode_show_backface_culling_set"); - RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE); - RNA_def_property_update(prop, 0, "rna_LayerCollectionEngineSettings_update"); - - RNA_define_verify_sdna(1); /* not in sdna */ -} - -static void rna_def_layer_collection_mode_settings_edit(BlenderRNA *brna) -{ - StructRNA *srna; - PropertyRNA *prop; - - srna = RNA_def_struct(brna, "LayerCollectionModeSettingsEdit", "LayerCollectionSettings"); - RNA_def_struct_ui_text(srna, "Collections Edit Mode Settings", "Edit Mode specific settings to be overridden per collection"); - RNA_define_verify_sdna(0); /* not in sdna */ - - /* see RNA_LAYER_ENGINE_GET_SET macro */ - - prop = RNA_def_property(srna, "show_occlude_wire", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_ui_text(prop, "Hidden Wire", "Use hidden wireframe display"); - RNA_def_property_boolean_funcs(prop, "rna_LayerEngineSettings_EditMode_show_occlude_wire_get", "rna_LayerEngineSettings_EditMode_show_occlude_wire_set"); - RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE); - RNA_def_property_update(prop, 0, "rna_LayerCollectionEngineSettings_update"); - - prop = RNA_def_property(srna, "show_weight", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_ui_text(prop, "Show Weights", "Draw weights in editmode"); - RNA_def_property_boolean_funcs(prop, "rna_LayerEngineSettings_EditMode_show_weight_get", "rna_LayerEngineSettings_EditMode_show_weight_set"); - RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE); - RNA_def_property_update(prop, 0, "rna_LayerCollectionEngineSettings_update"); - - prop = RNA_def_property(srna, "face_normals_show", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_ui_text(prop, "Draw Normals", "Display face normals as lines"); - RNA_def_property_boolean_funcs(prop, "rna_LayerEngineSettings_EditMode_face_normals_show_get", "rna_LayerEngineSettings_EditMode_face_normals_show_set"); - RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE); - RNA_def_property_update(prop, 0, "rna_LayerCollectionEngineSettings_update"); - - prop = RNA_def_property(srna, "vert_normals_show", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_ui_text(prop, "Draw Vertex Normals", "Display vertex normals as lines"); - RNA_def_property_boolean_funcs(prop, "rna_LayerEngineSettings_EditMode_vert_normals_show_get", "rna_LayerEngineSettings_EditMode_vert_normals_show_set"); - RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE); - RNA_def_property_update(prop, 0, "rna_LayerCollectionEngineSettings_update"); - - prop = RNA_def_property(srna, "loop_normals_show", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_ui_text(prop, "Draw Split Normals", "Display vertex-per-face normals as lines"); - RNA_def_property_boolean_funcs(prop, "rna_LayerEngineSettings_EditMode_loop_normals_show_get", "rna_LayerEngineSettings_EditMode_loop_normals_show_set"); - RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE); - RNA_def_property_update(prop, 0, "rna_LayerCollectionEngineSettings_update"); - - prop = RNA_def_property(srna, "normals_length", PROP_FLOAT, PROP_FACTOR); - RNA_def_property_ui_text(prop, "Normal Size", "Display size for normals in the 3D view"); - RNA_def_property_float_funcs(prop, "rna_LayerEngineSettings_EditMode_normals_length_get", "rna_LayerEngineSettings_EditMode_normals_length_set", NULL); - RNA_def_property_range(prop, 0.00001, 1000.0); - RNA_def_property_ui_range(prop, 0.01, 10.0, 10.0, 2); - RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE); - RNA_def_property_update(prop, 0, "rna_LayerCollectionEngineSettings_update"); - - prop = RNA_def_property(srna, "backwire_opacity", PROP_FLOAT, PROP_FACTOR); - RNA_def_property_ui_text(prop, "Backwire Opacity", "Opacity when rendering transparent wires"); - RNA_def_property_float_funcs(prop, "rna_LayerEngineSettings_EditMode_backwire_opacity_get", "rna_LayerEngineSettings_EditMode_backwire_opacity_set", NULL); - RNA_def_property_range(prop, 0.0f, 1.0f); - RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE); - RNA_def_property_update(prop, 0, "rna_LayerCollectionEngineSettings_update"); - - RNA_define_verify_sdna(1); /* not in sdna */ -} - -static void rna_def_layer_collection_mode_settings_paint_weight(BlenderRNA *brna) -{ - StructRNA *srna; - PropertyRNA *prop; - - srna = RNA_def_struct(brna, "LayerCollectionModeSettingsPaintWeight", "LayerCollectionSettings"); - RNA_def_struct_ui_text(srna, "Collections Weight Paint Mode Settings", "Weight Paint Mode specific settings to be overridden per collection"); - RNA_define_verify_sdna(0); /* not in sdna */ - - /* see RNA_LAYER_ENGINE_GET_SET macro */ - - prop = RNA_def_property(srna, "use_shading", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_ui_text(prop, "Use Shading", "Whether to use shaded or shadeless drawing"); - RNA_def_property_boolean_funcs(prop, "rna_LayerEngineSettings_PaintWeightMode_use_shading_get", "rna_LayerEngineSettings_PaintWeightMode_use_shading_set"); - RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE); - RNA_def_property_update(prop, 0, "rna_LayerCollectionEngineSettings_update"); - - prop = RNA_def_property(srna, "use_wire", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_ui_text(prop, "Show Wire", "Whether to overlay wireframe onto the mesh"); - RNA_def_property_boolean_funcs(prop, "rna_LayerEngineSettings_PaintWeightMode_use_wire_get", "rna_LayerEngineSettings_PaintWeightMode_use_wire_set"); - RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE); - RNA_def_property_update(prop, NC_SCENE | ND_LAYER_CONTENT, "rna_LayerCollectionEngineSettings_wire_update"); - - RNA_define_verify_sdna(1); /* not in sdna */ -} - -static void rna_def_layer_collection_mode_settings_paint_vertex(BlenderRNA *brna) -{ - StructRNA *srna; - PropertyRNA *prop; - - srna = RNA_def_struct(brna, "LayerCollectionModeSettingsPaintVertex", "LayerCollectionSettings"); - RNA_def_struct_ui_text(srna, "Collections Vertex Paint Mode Settings", "Vertex Paint Mode specific settings to be overridden per collection"); - RNA_define_verify_sdna(0); /* not in sdna */ - - /* see RNA_LAYER_ENGINE_GET_SET macro */ - - prop = RNA_def_property(srna, "use_shading", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_ui_text(prop, "Use Shading", "Whether to use shaded or shadeless drawing"); - RNA_def_property_boolean_funcs(prop, "rna_LayerEngineSettings_PaintVertexMode_use_shading_get", "rna_LayerEngineSettings_PaintVertexMode_use_shading_set"); - RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE); - RNA_def_property_update(prop, 0, "rna_LayerCollectionEngineSettings_update"); - - prop = RNA_def_property(srna, "use_wire", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_ui_text(prop, "Show Wire", "Whether to overlay wireframe onto the mesh"); - RNA_def_property_boolean_funcs(prop, "rna_LayerEngineSettings_PaintVertexMode_use_wire_get", "rna_LayerEngineSettings_PaintVertexMode_use_wire_set"); - RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE); - RNA_def_property_update(prop, NC_SCENE | ND_LAYER_CONTENT, "rna_LayerCollectionEngineSettings_wire_update"); - - RNA_define_verify_sdna(1); /* not in sdna */ -} - static void rna_def_view_layer_settings(BlenderRNA *brna) { StructRNA *srna; @@ -1928,13 +1706,6 @@ static void rna_def_view_layer_settings(BlenderRNA *brna) rna_def_view_layer_engine_settings_workbench(brna); rna_def_view_layer_engine_settings_eevee(brna); -#if 0 - rna_def_view_layer_mode_settings_object(brna); - rna_def_view_layer_mode_settings_edit(brna); - rna_def_view_layer_mode_settings_paint_weight(brna); - rna_def_view_layer_mode_settings_paint_vertex(brna); -#endif - RNA_define_verify_sdna(1); } @@ -1976,10 +1747,6 @@ static void rna_def_layer_collection_settings(BlenderRNA *brna) #endif rna_def_layer_collection_engine_settings_workbench(brna); - rna_def_layer_collection_mode_settings_object(brna); - rna_def_layer_collection_mode_settings_edit(brna); - rna_def_layer_collection_mode_settings_paint_weight(brna); - rna_def_layer_collection_mode_settings_paint_vertex(brna); RNA_define_verify_sdna(1); } diff --git a/source/blender/makesrna/intern/rna_mesh.c b/source/blender/makesrna/intern/rna_mesh.c index 79a9d072ad2..9ec196034f3 100644 --- a/source/blender/makesrna/intern/rna_mesh.c +++ b/source/blender/makesrna/intern/rna_mesh.c @@ -3516,26 +3516,6 @@ static void rna_def_mesh(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Draw Faces", "Display all faces as shades in the 3D view and UV editor"); RNA_def_property_update(prop, 0, "rna_Mesh_update_draw"); - prop = RNA_def_property(srna, "show_normal_face", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "drawflag", ME_DRAWNORMALS); - RNA_def_property_ui_text(prop, "Draw Normals", "Display face normals as lines"); - RNA_def_property_update(prop, 0, "rna_Mesh_update_draw"); - - prop = RNA_def_property(srna, "show_normal_loop", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "drawflag", ME_DRAW_LNORMALS); - RNA_def_property_ui_text(prop, "Draw Split Normals", "Display vertex-per-face normals as lines"); - RNA_def_property_update(prop, 0, "rna_Mesh_update_draw"); - - prop = RNA_def_property(srna, "show_normal_vertex", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "drawflag", ME_DRAW_VNORMALS); - RNA_def_property_ui_text(prop, "Draw Vertex Normals", "Display vertex normals as lines"); - RNA_def_property_update(prop, 0, "rna_Mesh_update_draw"); - - prop = RNA_def_property(srna, "show_weight", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "drawflag", ME_DRAWEIGHT); - RNA_def_property_ui_text(prop, "Show Weights", "Draw weights in editmode"); - RNA_def_property_update(prop, 0, "rna_Mesh_update_data_edit_color"); /* needs to rebuild 'dm' */ - prop = RNA_def_property(srna, "show_edge_crease", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "drawflag", ME_DRAWCREASES); RNA_def_property_ui_text(prop, "Draw Creases", "Display creases created for Subdivision Surface modifier"); diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c index b93c3cf1dc6..f55247df15d 100644 --- a/source/blender/makesrna/intern/rna_scene.c +++ b/source/blender/makesrna/intern/rna_scene.c @@ -2582,13 +2582,6 @@ static void rna_def_tool_settings(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Proportional Size", "Display size for proportional editing circle"); RNA_def_property_range(prop, 0.00001, 5000.0); - prop = RNA_def_property(srna, "normal_size", PROP_FLOAT, PROP_DISTANCE); - RNA_def_property_float_sdna(prop, NULL, "normalsize"); - RNA_def_property_ui_text(prop, "Normal Size", "Display size for normals in the 3D view"); - RNA_def_property_range(prop, 0.00001, 1000.0); - RNA_def_property_ui_range(prop, 0.01, 10.0, 10.0, 2); - RNA_def_property_update(prop, NC_GEOM | ND_DATA, NULL); - prop = RNA_def_property(srna, "double_threshold", PROP_FLOAT, PROP_DISTANCE); RNA_def_property_float_sdna(prop, NULL, "doublimit"); RNA_def_property_ui_text(prop, "Double Threshold", "Limit for removing duplicates and 'Auto Merge'"); diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c index 4b726e6b993..101ef0a2e9a 100644 --- a/source/blender/makesrna/intern/rna_space.c +++ b/source/blender/makesrna/intern/rna_space.c @@ -2197,49 +2197,50 @@ static void rna_def_space_view3d_shading(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Viewport Shading", "Method to display/shade objects in the 3D View"); RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, "rna_3DViewShading_type_update"); - RNA_def_struct_sdna(srna, "View3DShading"); - prop = RNA_def_property(srna, "light", PROP_ENUM, PROP_NONE); - RNA_def_property_enum_sdna(prop, NULL, "light"); + RNA_def_property_enum_sdna(prop, NULL, "shading.light"); RNA_def_property_enum_items(prop, rna_enum_viewport_lighting_items); RNA_def_property_ui_text(prop, "Lighting", "Lighting Method for Solid/Texture Viewport Shading"); - RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, "rna_3DViewShading_type_update"); + RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL); prop = RNA_def_property(srna, "show_object_overlap", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "flag", V3D_SHADING_OBJECT_OVERLAP); + RNA_def_property_boolean_sdna(prop, NULL, "shading.flag", V3D_SHADING_OBJECT_OVERLAP); RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); RNA_def_property_ui_text(prop, "Object Overlap", "Show Object Overlap"); - RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, "rna_3DViewShading_type_update"); + RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL); prop = RNA_def_property(srna, "studio_light", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_sdna(prop, NULL, "shading.studio_light"); RNA_def_property_enum_items(prop, studio_lighting_items); RNA_def_property_ui_text(prop, "Studiolight", "Studio lighting setup"); - RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, "rna_3DViewShading_type_update"); + RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL); prop = RNA_def_property(srna, "color_type", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_sdna(prop, NULL, "shading.color_type"); RNA_def_property_enum_items(prop, color_type_items); RNA_def_property_ui_text(prop, "Color", "Color Type"); - RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, "rna_3DViewShading_type_update"); + RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL); prop = RNA_def_property(srna, "single_color", PROP_FLOAT, PROP_COLOR); + RNA_def_property_float_sdna(prop, NULL, "shading.single_color"); RNA_def_property_array(prop, 3); RNA_def_property_ui_text(prop, "Color", "Color for single color mode"); - RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, "rna_3DViewShading_type_update"); + RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL); prop = RNA_def_property(srna, "show_shadows", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "flag", V3D_SHADING_SHADOW); + RNA_def_property_boolean_sdna(prop, NULL, "shading.flag", V3D_SHADING_SHADOW); RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); RNA_def_property_ui_text(prop, "Shadow", "Show Shadow"); - RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, "rna_3DViewShading_type_update"); + RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL); prop = RNA_def_property(srna, "ambient_light_intensity", PROP_FLOAT, PROP_NONE); - RNA_def_property_float_sdna(prop, NULL, "ambient_intensity"); + RNA_def_property_float_sdna(prop, NULL, "shading.ambient_intensity"); RNA_def_property_float_default(prop, 0.5); RNA_def_property_ui_text(prop, "Ambient Light", "Intensity of ambient light for shadows"); RNA_def_property_range(prop, 0.0f, 1.0f); RNA_def_property_ui_range(prop, 0.00f, 1.0f, 1, 3); RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); - RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, "rna_3DViewShading_type_update"); + RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL); } static void rna_def_space_view3d_overlay(BlenderRNA *brna) @@ -2323,20 +2324,65 @@ static void rna_def_space_view3d_overlay(BlenderRNA *brna) "Show dashed lines indicating parent or constraint relationships"); RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL); - RNA_def_struct_sdna(srna, "View3DOverlay"); + /* TODO: this should become a per object setting? */ + prop = RNA_def_property(srna, "show_backface_culling", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flag2", V3D_BACKFACE_CULLING); + RNA_def_property_ui_text(prop, "Backface Culling", "Use back face culling to hide the back side of faces"); + RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL); prop = RNA_def_property(srna, "show_cursor", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", V3D_OVERLAY_HIDE_CURSOR); + RNA_def_property_boolean_negative_sdna(prop, NULL, "overlay.flag", V3D_OVERLAY_HIDE_CURSOR); RNA_def_property_ui_text(prop, "Show 3D Cursor", "Display 3D Cursor Overlay"); RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL); prop = RNA_def_property(srna, "show_face_orientation", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "flag", V3D_OVERLAY_FACE_ORIENTATION); + RNA_def_property_boolean_sdna(prop, NULL, "overlay.flag", V3D_OVERLAY_FACE_ORIENTATION); RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); RNA_def_property_ui_text(prop, "Face Orientation", "Show the Face Orientation Overlay"); - RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, "rna_3DViewShading_type_update"); + RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL); + prop = RNA_def_property(srna, "show_paint_wire", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "overlay.paint_flag", V3D_OVERLAY_PAINT_WIRE); + RNA_def_property_ui_text(prop, "Show Wire", "Use wireframe display in painting modes"); + RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL); + + prop = RNA_def_property(srna, "show_occlude_wire", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "overlay.edit_flag", V3D_OVERLAY_EDIT_OCCLUDE_WIRE); + RNA_def_property_ui_text(prop, "Hidden Wire", "Use hidden wireframe display in edit mode"); + RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL); + + prop = RNA_def_property(srna, "show_weight", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "overlay.edit_flag", V3D_OVERLAY_EDIT_WEIGHT); + RNA_def_property_ui_text(prop, "Show Weights", "Draw weights in editmode"); + RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL); + prop = RNA_def_property(srna, "show_face_normals", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "overlay.edit_flag", V3D_OVERLAY_EDIT_FACE_NORMALS); + RNA_def_property_ui_text(prop, "Draw Normals", "Display face normals as lines"); + RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL); + + prop = RNA_def_property(srna, "show_vertex_normals", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "overlay.edit_flag", V3D_OVERLAY_EDIT_VERT_NORMALS); + RNA_def_property_ui_text(prop, "Draw Vertex Normals", "Display vertex normals as lines"); + RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL); + + prop = RNA_def_property(srna, "show_split_normals", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "overlay.edit_flag", V3D_OVERLAY_EDIT_LOOP_NORMALS); + RNA_def_property_ui_text(prop, "Draw Split Normals", "Display vertex-per-face normals as lines"); + RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL); + + prop = RNA_def_property(srna, "normals_length", PROP_FLOAT, PROP_FACTOR); + RNA_def_property_float_sdna(prop, NULL, "overlay.normals_length"); + RNA_def_property_ui_text(prop, "Normal Size", "Display size for normals in the 3D view"); + RNA_def_property_range(prop, 0.00001, 1000.0); + RNA_def_property_ui_range(prop, 0.01, 10.0, 10.0, 2); + RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL); + + prop = RNA_def_property(srna, "backwire_opacity", PROP_FLOAT, PROP_FACTOR); + RNA_def_property_float_sdna(prop, NULL, "overlay.backwire_opacity"); + RNA_def_property_ui_text(prop, "Backwire Opacity", "Opacity when rendering transparent wires"); + RNA_def_property_range(prop, 0.0f, 1.0f); + RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL); } static void rna_def_space_view3d(BlenderRNA *brna) @@ -2495,11 +2541,6 @@ static void rna_def_space_view3d(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Textured Solid", "Display face-assigned textures in solid view"); RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL); - prop = RNA_def_property(srna, "show_backface_culling", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "flag2", V3D_BACKFACE_CULLING); - RNA_def_property_ui_text(prop, "Backface Culling", "Use back face culling to hide the back side of faces"); - RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL); - prop = RNA_def_property(srna, "show_mode_shade_override", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag2", V3D_SHOW_MODE_SHADE_OVERRIDE); RNA_def_property_ui_text(prop, "Full Shading", "Use full shading for mode drawing (to view final result)"); |