From 9e40977c271e7cc3f0f0bf6acaf46949daac7a5f Mon Sep 17 00:00:00 2001 From: Aaron Carlisle Date: Fri, 21 Jul 2017 16:46:35 -0400 Subject: [PATCH 1/3] UI: Add Open Image button to Mask Stencil Image panel In the future we should make these two buttons on one line However because we need `gen_context = 'PAINT_STENCIL'` this is a little hard and we need to find a proper solution. One might be using `context_pointer_set` Patch by @craig_jones with edits by @blendify Differential Revision: https://developer.blender.org/D2710 --- .../startup/bl_ui/space_view3d_toolbar.py | 34 +++++++++++-------- 1 file changed, 19 insertions(+), 15 deletions(-) diff --git a/release/scripts/startup/bl_ui/space_view3d_toolbar.py b/release/scripts/startup/bl_ui/space_view3d_toolbar.py index 2e291d3d471..798c3aafe0b 100644 --- a/release/scripts/startup/bl_ui/space_view3d_toolbar.py +++ b/release/scripts/startup/bl_ui/space_view3d_toolbar.py @@ -916,16 +916,18 @@ class VIEW3D_PT_imapaint_tools_missing(Panel, View3DPaintPanel): col.separator() col.label("Missing Canvas", icon='INFO') col.label("Add or assign a canvas image below") - col.label("Canvas Image") - col.template_ID(toolsettings, "canvas") + col.label("Canvas Image:") + # todo this should be combinded into a single row + col.template_ID(toolsettings, "canvas", open="image.open") col.operator("image.new", text="New").gen_context = 'PAINT_CANVAS' if toolsettings.missing_stencil: col.separator() col.label("Missing Stencil", icon='INFO') col.label("Add or assign a stencil image below") - col.label("Stencil Image") - col.template_ID(toolsettings, "stencil_image") + col.label("Stencil Image:") + # todo this should be combinded into a single row + col.template_ID(toolsettings, "stencil_image", open="image.open") col.operator("image.new", text="New").gen_context = 'PAINT_STENCIL' @@ -1200,20 +1202,20 @@ class VIEW3D_PT_slots_projectpaint(View3DPanel, Panel): ob = context.active_object col = layout.column() - col.label("Painting Mode") + col.label("Painting Mode:") col.prop(settings, "mode", text="") col.separator() if settings.mode == 'MATERIAL': if len(ob.material_slots) > 1: - col.label("Materials") + col.label("Materials:") col.template_list("MATERIAL_UL_matslots", "layers", ob, "material_slots", ob, "active_material_index", rows=2) mat = ob.active_material if mat: - col.label("Available Paint Slots") + col.label("Available Paint Slots:") col.template_list("TEXTURE_UL_texpaintslots", "", mat, "texture_paint_images", mat, "paint_active_slot", rows=2) @@ -1233,16 +1235,17 @@ class VIEW3D_PT_slots_projectpaint(View3DPanel, Panel): col.separator() if slot and slot.index != -1: - col.label("UV Map") + col.label("UV Map:") col.prop_search(slot, "uv_layer", ob.data, "uv_textures", text="") elif settings.mode == 'IMAGE': mesh = ob.data uv_text = mesh.uv_textures.active.name if mesh.uv_textures.active else "" - col.label("Canvas Image") - col.template_ID(settings, "canvas") + col.label("Canvas Image:") + # todo this should be combinded into a single row + col.template_ID(settings, "canvas", col.template_ID) col.operator("image.new", text="New").gen_context = 'PAINT_CANVAS' - col.label("UV Map") + col.label("UV Map:") col.menu("VIEW3D_MT_tools_projectpaint_uvlayer", text=uv_text, translate=False) col.separator() @@ -1276,14 +1279,15 @@ class VIEW3D_PT_stencil_projectpaint(View3DPanel, Panel): col.active = ipaint.use_stencil_layer stencil_text = mesh.uv_texture_stencil.name if mesh.uv_texture_stencil else "" - col.label("UV Map") + col.label("UV Map:") col.menu("VIEW3D_MT_tools_projectpaint_stencil", text=stencil_text, translate=False) - col.label("Stencil Image") - col.template_ID(ipaint, "stencil_image") + col.label("Stencil Image:") + # todo this should be combinded into a single row + col.template_ID(ipaint, "stencil_image", open="image.open") col.operator("image.new", text="New").gen_context = 'PAINT_STENCIL' - col.label("Visualization") + col.label("Visualization:") row = col.row(align=True) row.prop(ipaint, "stencil_color", text="") row.prop(ipaint, "invert_stencil", text="", icon='IMAGE_ALPHA') From 70eac432b7ad5a702c7fb4e4a85433d5ca36e4cf Mon Sep 17 00:00:00 2001 From: Aaron Carlisle Date: Fri, 21 Jul 2017 16:46:35 -0400 Subject: [PATCH 2/3] UI: Add Open Image button to Mask Stencil Image panel In the future we should make these two buttons on one line However because we need `gen_context = 'PAINT_STENCIL'` this is a little hard and we need to find a proper solution. One might be using `context_pointer_set` Patch by @craig_jones with edits by @blendify Differential Revision: https://developer.blender.org/D2710 --- release/scripts/startup/bl_ui/space_view3d_toolbar.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/release/scripts/startup/bl_ui/space_view3d_toolbar.py b/release/scripts/startup/bl_ui/space_view3d_toolbar.py index 798c3aafe0b..4026bc972fe 100644 --- a/release/scripts/startup/bl_ui/space_view3d_toolbar.py +++ b/release/scripts/startup/bl_ui/space_view3d_toolbar.py @@ -1243,7 +1243,7 @@ class VIEW3D_PT_slots_projectpaint(View3DPanel, Panel): uv_text = mesh.uv_textures.active.name if mesh.uv_textures.active else "" col.label("Canvas Image:") # todo this should be combinded into a single row - col.template_ID(settings, "canvas", col.template_ID) + col.template_ID(settings, "canvas", open="image.open") col.operator("image.new", text="New").gen_context = 'PAINT_CANVAS' col.label("UV Map:") col.menu("VIEW3D_MT_tools_projectpaint_uvlayer", text=uv_text, translate=False) From a27b6ae4a98c6f72d669b71c402291d6690c9e82 Mon Sep 17 00:00:00 2001 From: mano-wii Date: Fri, 21 Jul 2017 18:04:05 -0300 Subject: [PATCH 3/3] Transform: remove unused argument --- .../editors/transform/transform_snap_object.c | 22 +++++++++---------- 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/source/blender/editors/transform/transform_snap_object.c b/source/blender/editors/transform/transform_snap_object.c index 378742c63b8..6c62c091a78 100644 --- a/source/blender/editors/transform/transform_snap_object.c +++ b/source/blender/editors/transform/transform_snap_object.c @@ -365,7 +365,7 @@ static void raycast_all_cb(void *userdata, int index, const BVHTreeRay *ray, BVH static bool raycastDerivedMesh( SnapObjectContext *sctx, - const float ray_orig[3], const float ray_start[3], const float ray_dir[3], + const float ray_start[3], const float ray_dir[3], Object *ob, DerivedMesh *dm, float obmat[4][4], const unsigned int ob_index, /* read/write args */ float *ray_depth, @@ -549,7 +549,7 @@ static bool raycastDerivedMesh( static bool raycastEditMesh( SnapObjectContext *sctx, - const float ray_orig[3], const float ray_start[3], const float ray_dir[3], + const float ray_start[3], const float ray_dir[3], Object *ob, BMEditMesh *em, float obmat[4][4], const unsigned int ob_index, /* read/write args */ float *ray_depth, @@ -710,7 +710,7 @@ static bool raycastEditMesh( */ static bool raycastObj( SnapObjectContext *sctx, - const float ray_orig[3], const float ray_start[3], const float ray_dir[3], + const float ray_start[3], const float ray_dir[3], Object *ob, float obmat[4][4], const unsigned int ob_index, bool use_obedit, /* read/write args */ @@ -729,7 +729,7 @@ static bool raycastObj( em = BKE_editmesh_from_object(ob); retval = raycastEditMesh( sctx, - ray_orig, ray_start, ray_dir, + ray_start, ray_dir, ob, em, obmat, ob_index, ray_depth, r_loc, r_no, r_index, r_hit_list); } @@ -746,7 +746,7 @@ static bool raycastObj( } retval = raycastDerivedMesh( sctx, - ray_orig, ray_start, ray_dir, + ray_start, ray_dir, ob, dm, obmat, ob_index, ray_depth, r_loc, r_no, r_index, r_hit_list); @@ -766,7 +766,6 @@ static bool raycastObj( struct RaycastObjUserData { - const float *ray_orig; const float *ray_start; const float *ray_dir; unsigned int ob_index; @@ -787,7 +786,7 @@ static void raycast_obj_cb(SnapObjectContext *sctx, bool is_obedit, Object *ob, struct RaycastObjUserData *dt = data; dt->ret |= raycastObj( sctx, - dt->ray_orig, dt->ray_start, dt->ray_dir, + dt->ray_start, dt->ray_dir, ob, obmat, dt->ob_index++, is_obedit, dt->ray_depth, dt->r_loc, dt->r_no, dt->r_index, @@ -826,7 +825,7 @@ static void raycast_obj_cb(SnapObjectContext *sctx, bool is_obedit, Object *ob, */ static bool raycastObjects( SnapObjectContext *sctx, - const float ray_orig[3], const float ray_start[3], const float ray_dir[3], + const float ray_start[3], const float ray_dir[3], const SnapSelect snap_select, const bool use_object_edit_cage, /* read/write args */ float *ray_depth, @@ -838,7 +837,6 @@ static bool raycastObjects( Object *obedit = use_object_edit_cage ? sctx->scene->obedit : NULL; struct RaycastObjUserData data = { - .ray_orig = ray_orig, .ray_start = ray_start, .ray_dir = ray_dir, .ob_index = 0, @@ -2207,7 +2205,7 @@ bool ED_transform_snap_object_project_ray_ex( { return raycastObjects( sctx, - ray_start, ray_start, ray_normal, + ray_start, ray_normal, params->snap_select, params->use_object_edit_cage, ray_depth, r_loc, r_no, r_index, r_ob, r_obmat, NULL); } @@ -2236,7 +2234,7 @@ bool ED_transform_snap_object_project_ray_all( bool retval = raycastObjects( sctx, - ray_start, ray_start, ray_normal, + ray_start, ray_normal, params->snap_select, params->use_object_edit_cage, &ray_depth, NULL, NULL, NULL, NULL, NULL, r_hit_list); @@ -2419,7 +2417,7 @@ bool ED_transform_snap_object_project_view3d_ex( if (snap_to == SCE_SNAP_MODE_FACE) { return raycastObjects( sctx, - ray_origin, ray_start, ray_normal, + ray_start, ray_normal, params->snap_select, params->use_object_edit_cage, ray_depth, r_loc, r_no, r_index, NULL, NULL, NULL); }