Commit: 3103b819aa530da29e9853cb67e3f0b77d349d4e Author: Luca Rood Date: Thu May 4 19:59:27 2017 +0200 Branches: blender2.8 https://developer.blender.org/rB3103b819aa530da29e9853cb67e3f0b77d349d4e
Vertex paint with draw manager Reviewers: fclem Subscribers: campbellbarton, dfelinto Differential Revision: https://developer.blender.org/D2658 =================================================================== M release/scripts/startup/bl_ui/properties_collection.py M source/blender/blenkernel/BKE_mesh.h M source/blender/blenkernel/intern/deform.c M source/blender/blenkernel/intern/layer.c M source/blender/blenkernel/intern/object_deform.c M source/blender/draw/DRW_engine.h M source/blender/draw/intern/draw_cache.c M source/blender/draw/intern/draw_cache.h M source/blender/draw/intern/draw_cache_impl.h M source/blender/draw/intern/draw_cache_impl_mesh.c M source/blender/draw/modes/object_mode.c M source/blender/draw/modes/paint_vertex_mode.c M source/blender/draw/modes/paint_weight_mode.c M source/blender/editors/mesh/editface.c M source/blender/editors/sculpt_paint/paint_vertex.c M source/blender/makesdna/DNA_ID.h M source/blender/makesdna/DNA_layer_types.h M source/blender/makesrna/intern/rna_mesh.c M source/blender/makesrna/intern/rna_scene.c =================================================================== diff --git a/release/scripts/startup/bl_ui/properties_collection.py b/release/scripts/startup/bl_ui/properties_collection.py index 0cd0194ff33..dc02037586c 100644 --- a/release/scripts/startup/bl_ui/properties_collection.py +++ b/release/scripts/startup/bl_ui/properties_collection.py @@ -130,12 +130,33 @@ class COLLECTION_PT_paint_weight_mode_settings(CollectionButtonsPanel, Panel): 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 = context.layer_collection + 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/source/blender/blenkernel/BKE_mesh.h b/source/blender/blenkernel/BKE_mesh.h index db6f40756a4..e0f62cfd894 100644 --- a/source/blender/blenkernel/BKE_mesh.h +++ b/source/blender/blenkernel/BKE_mesh.h @@ -411,7 +411,7 @@ void BKE_mesh_eval_geometry(struct EvaluationContext *eval_ctx, enum { BKE_MESH_BATCH_DIRTY_ALL = 0, BKE_MESH_BATCH_DIRTY_SELECT, - BKE_MESH_BATCH_DIRTY_WEIGHT, + BKE_MESH_BATCH_DIRTY_PAINT, }; void BKE_mesh_batch_cache_dirty(struct Mesh *me, int mode); void BKE_mesh_batch_cache_free(struct Mesh *me); diff --git a/source/blender/blenkernel/intern/deform.c b/source/blender/blenkernel/intern/deform.c index 22ba050e4fb..3b91534e321 100644 --- a/source/blender/blenkernel/intern/deform.c +++ b/source/blender/blenkernel/intern/deform.c @@ -74,7 +74,7 @@ bDeformGroup *BKE_defgroup_new(Object *ob, const char *name) BLI_addtail(&ob->defbase, defgroup); defgroup_unique_name(defgroup, ob); - BKE_mesh_batch_cache_dirty(ob->data, BKE_MESH_BATCH_DIRTY_WEIGHT); + BKE_mesh_batch_cache_dirty(ob->data, BKE_MESH_BATCH_DIRTY_PAINT); return defgroup; } diff --git a/source/blender/blenkernel/intern/layer.c b/source/blender/blenkernel/intern/layer.c index 8182d7d0706..a136728ecc4 100644 --- a/source/blender/blenkernel/intern/layer.c +++ b/source/blender/blenkernel/intern/layer.c @@ -1105,6 +1105,22 @@ static void layer_collection_create_mode_settings_paint_weight(IDProperty *root, 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 collection_create_render_settings(IDProperty *root, const bool populate) { CollectionEngineSettingsCB_Type *ces_type; @@ -1121,6 +1137,7 @@ static void collection_create_mode_settings(IDProperty *root, const bool populat 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 int idproperty_group_subtype(const int mode_type) @@ -1137,6 +1154,9 @@ static int idproperty_group_subtype(const int mode_type) 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; diff --git a/source/blender/blenkernel/intern/object_deform.c b/source/blender/blenkernel/intern/object_deform.c index 990c96c9576..455c4b6352d 100644 --- a/source/blender/blenkernel/intern/object_deform.c +++ b/source/blender/blenkernel/intern/object_deform.c @@ -407,7 +407,7 @@ void BKE_object_defgroup_remove(Object *ob, bDeformGroup *defgroup) else object_defgroup_remove_object_mode(ob, defgroup); - BKE_mesh_batch_cache_dirty(ob->data, BKE_MESH_BATCH_DIRTY_WEIGHT); + BKE_mesh_batch_cache_dirty(ob->data, BKE_MESH_BATCH_DIRTY_PAINT); } /** diff --git a/source/blender/draw/DRW_engine.h b/source/blender/draw/DRW_engine.h index 239919fd826..c5cf029febb 100644 --- a/source/blender/draw/DRW_engine.h +++ b/source/blender/draw/DRW_engine.h @@ -90,5 +90,6 @@ 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); #endif /* __DRW_ENGINE_H__ */ diff --git a/source/blender/draw/intern/draw_cache.c b/source/blender/draw/intern/draw_cache.c index 9fa79c41265..7e49d998fa0 100644 --- a/source/blender/draw/intern/draw_cache.c +++ b/source/blender/draw/intern/draw_cache.c @@ -1777,6 +1777,14 @@ Batch *DRW_cache_mesh_surface_weights_get(Object *ob) return DRW_mesh_batch_cache_get_triangles_with_normals_and_weights(me, ob->actdef - 1); } +Batch *DRW_cache_mesh_surface_vert_colors_get(Object *ob) +{ + BLI_assert(ob->type == OB_MESH); + + Mesh *me = ob->data; + return DRW_mesh_batch_cache_get_triangles_with_normals_and_vert_colors(me); +} + /* Return list of batches */ Batch **DRW_cache_mesh_surface_shaded_get(Object *ob) { @@ -1810,12 +1818,12 @@ Batch *DRW_cache_mesh_verts_get(Object *ob) return DRW_mesh_batch_cache_get_all_verts(me); } -Batch *DRW_cache_mesh_edges_weight_overlay_get(Object *ob, bool use_wire, bool use_sel) +Batch *DRW_cache_mesh_edges_paint_overlay_get(Object *ob, bool use_wire, bool use_sel, bool use_theme) { BLI_assert(ob->type == OB_MESH); Mesh *me = ob->data; - return DRW_mesh_batch_cache_get_weight_overlay_edges(me, use_wire, use_sel); + return DRW_mesh_batch_cache_get_weight_overlay_edges(me, use_wire, use_sel, use_theme); } Batch *DRW_cache_mesh_faces_weight_overlay_get(Object *ob) diff --git a/source/blender/draw/intern/draw_cache.h b/source/blender/draw/intern/draw_cache.h index a725eb2c37a..160cfaf1693 100644 --- a/source/blender/draw/intern/draw_cache.h +++ b/source/blender/draw/intern/draw_cache.h @@ -95,10 +95,11 @@ struct Batch *DRW_cache_face_centers_get(struct Object *ob); struct Batch *DRW_cache_mesh_wire_outline_get(struct Object *ob); struct Batch *DRW_cache_mesh_surface_get(struct Object *ob); struct Batch *DRW_cache_mesh_surface_weights_get(struct Object *ob); +struct Batch *DRW_cache_mesh_surface_vert_colors_get(struct Object *ob); struct Batch *DRW_cache_mesh_surface_verts_get(struct Object *ob); struct Batch *DRW_cache_mesh_edges_get(struct Object *ob); struct Batch *DRW_cache_mesh_verts_get(struct Object *ob); -struct Batch *DRW_cache_mesh_edges_weight_overlay_get(struct Object *ob, bool use_wire, bool use_sel); +struct Batch *DRW_cache_mesh_edges_paint_overlay_get(struct Object *ob, bool use_wire, bool use_sel, bool use_theme); struct Batch *DRW_cache_mesh_faces_weight_overlay_get(struct Object *ob); struct Batch *DRW_cache_mesh_verts_weight_overlay_get(struct Object *ob); struct Batch **DRW_cache_mesh_surface_shaded_get(struct Object *ob); diff --git a/source/blender/draw/intern/draw_cache_impl.h b/source/blender/draw/intern/draw_cache_impl.h index adda538f761..9216e05604e 100644 --- a/source/blender/draw/intern/draw_cache_impl.h +++ b/source/blender/draw/intern/draw_cache_impl.h @@ -68,13 +68,14 @@ struct Batch *DRW_lattice_batch_cache_get_overlay_verts(struct Lattice *lt); /* Mesh */ struct Batch **DRW_mesh_batch_cache_get_surface_shaded(struct Mesh *me); -struct Batch *DRW_mesh_batch_cache_get_weight_overlay_edges(struct Mesh *me, bool use_wire, bool use_sel); +struct Batch *DRW_mesh_batch_cache_get_weight_overlay_edges(struct Mesh *me, bool use_wire, bool use_sel, bool use_theme); struct Batch *DRW_mesh_batch_cache_get_weight_overlay_faces(struct Mesh *me); struct Batch *DRW_mesh_batch_cache_get_weight_overlay_verts(struct Mesh *me); struct Batch *DRW_mesh_batch_cache_get_all_edges(struct Mesh *me); struct Batch *DRW_mesh_batch_cache_get_all_triangles(struct Mesh *me); struct Batch *DRW_mesh_batch_cache_get_triangles_with_normals(struct Mesh *me); struct Batch *DRW_mesh_batch_cache_get_triangles_with_normals_and_weights(struct Mesh *me, int defgroup); +struct Batch *DRW_mesh_batch_cache_get_triangles_with_normals_and_vert_colors(struct Mesh *me); struct Batch *DRW_mesh_batch_cache_get_points_with_normals(struct Mesh *me); struct Batch *DRW_mesh_batch_cache_get_all_verts(struct Mesh *me); struct Batch *DRW_mesh_batch_cache_get_fancy_edges(struct Mesh *me); diff --git a/source/blender/draw/intern/draw_cache_impl_mesh.c b/source/blender/draw/intern/draw_cache_impl_mesh.c index 9d7763a2c9a..5504a94d929 100644 --- a/source/blender/draw/intern/draw_cache_impl_mesh.c +++ b/source/blender/draw/intern/draw_cache_impl_mesh.c @@ -50,6 +50,8 @@ #include "GPU_batch.h" +#include "UI_resources.h" + #include "draw_cache_impl.h" /* own include */ static void mesh_batch_cache_clear(Mesh *me); @@ -124,6 +126,7 @@ typedef struct MeshRenderData { MLoopCol **mloopcol; float (**mtangent)[4]; MDeformVert *dvert; + MLoopCol *loopcol; BMVert *eve_act; BMEdge *eed_act; @@ -156,7 +159,8 @@ typedef struct MeshRenderData { int *loose_ve @@ Diff output truncated at 10240 characters. @@ _______________________________________________ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs