Shrink/Fatten "Offset Even" can not be used as default #54325

Open
opened 2018-03-14 23:10:35 +01:00 by sicutunum · 15 comments

The "Offset Even" option is turned on by default for the Shrink/Fatten (Alt-S) tool. You can see this by opening user preferences, selecting the input tab and opening the Shrink/Fatten menu under the Mesh menu. However, if you use the tool, you'll see checking or unchecking this default option makes no difference. The tool always defaults to off.

It doesn't seem currently possible, even with custom coding, to have this option on by default. I disabled all transform modal map keys just to be sure they weren't interfering. They are not. I also tried changing the default key to something else (Ctrl-K). It seems nothing can be done to have this tool use "Offset Even" (i.e. even thickness) by default.

The "Offset Even" option is turned on by default for the Shrink/Fatten (Alt-S) tool. You can see this by opening user preferences, selecting the input tab and opening the Shrink/Fatten menu under the Mesh menu. However, if you use the tool, you'll see checking or unchecking this default option makes no difference. The tool always defaults to off. It doesn't seem currently possible, even with custom coding, to have this option on by default. I disabled all transform modal map keys just to be sure they weren't interfering. They are not. I also tried changing the default key to something else (Ctrl-K). It seems nothing can be done to have this tool use "Offset Even" (i.e. even thickness) by default.
Author

Added subscriber: @sicutunum

Added subscriber: @sicutunum

#66600 was marked as duplicate of this issue

#66600 was marked as duplicate of this issue
Member

Added subscribers: @ideasman42, @lichtwerk

Added subscribers: @ideasman42, @lichtwerk
Philipp Oeser self-assigned this 2018-04-20 15:47:41 +02:00
Member

Confirming on first sight, but need to have a closer look later

See here and note that it finds the property, but RNA_property_is_set is not True [it is on redo though]. Like I said: will have a closer look later (and maybe pass on to @ideasman42 if that doesnt succeed)

Confirming on first sight, but need to have a closer look later See [here ](https://developer.blender.org/diffusion/B/browse/master/source/blender/editors/transform/transform_generics.c;e5bb234f6433af9c28b2aec0a4b07c7598a4943f$1200) and note that it finds the property, but `RNA_property_is_set` is not True [it is on redo though]. Like I said: will have a closer look later (and maybe pass on to @ideasman42 if that doesnt succeed)
Member

OK, so did a bit more reading code here.
Sorry if this blathering is a bit of a detour, but I'm keeping this as a reference (for myself, but maybe for others as well...)
And: please correct me if I'm wrong!

Regarding my last comment (RNA_property_is_set is not True):
Seems like operator properties start off being an PROP_IDPROPERTY (not a DNA one) and are flagged IDP_FLAG_GHOST
This happens when you do RNA_def_boolean(ot->srna, "use_even_offset", true, "Offset Even", "Scale the offset to give more even thickness");
If a property is flagged IDP_FLAG_GHOST the property is set but RNA will return false when checking RNA_property_is_set().
This way code can distigush between defaults and something that was explicitly set.
When redoing an operator the properties wont be flagged IDP_FLAG_GHOST anymore (because they have all been explicitly set)
So whenever you call RNA_boolean_set(), it will most likely end up in rna_idproperty_touch which unsets IDP_FLAG_GHOST.
If we wanted the keymap to actually have an effect in initTransInfo , we would simply have to do something like D3388

But more problems arise with above diff
So initTransInfo would go fine (it would pick up the prop and set transform flag accordingly)
But now comes transformEvent (called from transform_modal).
This toggles the transform flag according to pressing S (defined in transform modal keymap) or pressing/releasing ALT (hardcoded).
So releasing ALT will set Offset Even to OFF.
If you invoke the tool with ALT+S then you probably release the keys shortly after. Hm. This was not a problem before D3388 (it was OFF anyways), but now it will be.
So as long as you hold the ALT key, D3388 should work.
We could of course disable ALT for Shrink/Fatten (see P688), or move to other keys? (Note this will unfortunately need update in translations, because of header text...)

What about 2.8?
This should still aplly there, too right?

@ideasman42 : any thoughts?

OK, so did a bit more reading code here. Sorry if this blathering is a bit of a detour, but I'm keeping this as a reference (for myself, but maybe for others as well...) And: please correct me if I'm wrong! **Regarding my last comment (RNA_property_is_set is not True):** Seems like operator properties start off being an `PROP_IDPROPERTY` (not a DNA one) and are flagged `IDP_FLAG_GHOST` This happens when you do `RNA_def_boolean(ot->srna, "use_even_offset", true, "Offset Even", "Scale the offset to give more even thickness");` If a property is flagged `IDP_FLAG_GHOST` the property is set but RNA will return false when checking `RNA_property_is_set()`. This way code can distigush between defaults and something that was explicitly set. When redoing an operator the properties wont be flagged `IDP_FLAG_GHOST` anymore (because they have all been explicitly set) So whenever you call `RNA_boolean_set()`, it will most likely end up in `rna_idproperty_touch` which unsets `IDP_FLAG_GHOST`. If we wanted the keymap to actually have an effect [in initTransInfo ](https://developer.blender.org/diffusion/B/browse/master/source/blender/editors/transform/transform_generics.c;e5bb234f6433af9c28b2aec0a4b07c7598a4943f$1200), we would simply have to do something like [D3388](https://archive.blender.org/developer/D3388) **But more problems arise with above diff** So `initTransInfo` would go fine (it would pick up the prop and set transform flag accordingly) But now comes `transformEvent` (called from `transform_modal`). This toggles the transform flag according to pressing `S` (defined in transform modal keymap) or pressing/releasing `ALT` (hardcoded). So releasing `ALT` will set `Offset Even` to OFF. If you invoke the tool with ALT+S then you probably release the keys shortly after. Hm. This was not a problem before [D3388](https://archive.blender.org/developer/D3388) (it was OFF anyways), but now it will be. So as long as you hold the ALT key, [D3388](https://archive.blender.org/developer/D3388) should work. We could of course disable ALT for Shrink/Fatten (see [P688](https://archive.blender.org/developer/P688.txt)), or move to other keys? (Note this will unfortunately need update in translations, because of header text...) **What about 2.8?** This should still aplly there, too right? @ideasman42 : any thoughts?
Author

If it means anything, my main concern with this as an addon developer is being able to use the functionality of even offset fat/shrinking within custom modal operators. The fact that there is currently no way to invoke even offset fat/shrinking kills the potential of more useful tools (without having to result to emulating this operator via custom coding adding significant unnecessary overhead). Probably on a larger scale, modal operators should follow a protocol where-in this kind of thing could not become an issue.

If it means anything, my main concern with this as an addon developer is being able to use the functionality of even offset fat/shrinking within custom modal operators. The fact that there is currently no way to invoke even offset fat/shrinking kills the potential of more useful tools (without having to result to emulating this operator via custom coding adding significant unnecessary overhead). Probably on a larger scale, modal operators should follow a protocol where-in this kind of thing could not become an issue.
Member

@sicutunum : wasnt aware this is about usage from python as well...

from python you can actually invoke it like this, no?
bpy.ops.transform.shrink_fatten('INVOKE_DEFAULT', use_even_offset=True)

So quickly putting this into a custom modal op like this seems to do it (unless I am misunderstanding something...)

import bpy

class ModalOperator(bpy.types.Operator):
    """Move an object with the mouse, example"""
    bl_idname = "object.modal_operator"
    bl_label = "Simple Modal Operator"

    def modal(self, context, event):

        if event.type == 'LEFTMOUSE':
            bpy.ops.transform.shrink_fatten('INVOKE_DEFAULT', use_even_offset=True)
            return {'FINISHED'}

        elif event.type in {'RIGHTMOUSE', 'ESC'}:
            return {'CANCELLED'}

        return {'RUNNING_MODAL'}

    def invoke(self, context, event):
        if context.object and context.object.mode == 'EDIT':
            context.window_manager.modal_handler_add(self)
            return {'RUNNING_MODAL'}
        else:
            self.report({'WARNING'}, "No active object in editmode, could not finish")
            return {'CANCELLED'}

def register():
    bpy.utils.register_class(ModalOperator)

def unregister():
    bpy.utils.unregister_class(ModalOperator)

if __name__ == "__main__":
    register()

Keymap is for invoking the tool via... well keys, that's not defining the default for python behavior to my knowledge.
If you wanted to pick this preference up from python you could also get it with the following I think:
bpy.context.window_manager.keyconfigs.default.keymaps['Mesh'].keymap_items['transform.shrink_fatten'].properties.use_even_offset

Hope this helps

@sicutunum : wasnt aware this is about usage from python as well... from python you can actually invoke it like this, no? `bpy.ops.transform.shrink_fatten('INVOKE_DEFAULT', use_even_offset=True)` So quickly putting this into a custom modal op like this seems to do it (unless I am misunderstanding something...) ``` import bpy class ModalOperator(bpy.types.Operator): """Move an object with the mouse, example""" bl_idname = "object.modal_operator" bl_label = "Simple Modal Operator" def modal(self, context, event): if event.type == 'LEFTMOUSE': bpy.ops.transform.shrink_fatten('INVOKE_DEFAULT', use_even_offset=True) return {'FINISHED'} elif event.type in {'RIGHTMOUSE', 'ESC'}: return {'CANCELLED'} return {'RUNNING_MODAL'} def invoke(self, context, event): if context.object and context.object.mode == 'EDIT': context.window_manager.modal_handler_add(self) return {'RUNNING_MODAL'} else: self.report({'WARNING'}, "No active object in editmode, could not finish") return {'CANCELLED'} def register(): bpy.utils.register_class(ModalOperator) def unregister(): bpy.utils.unregister_class(ModalOperator) if __name__ == "__main__": register() ``` Keymap is for invoking the tool via... well keys, that's not defining the default for python behavior to my knowledge. If you wanted to pick this preference up from python you could also get it with the following I think: `bpy.context.window_manager.keyconfigs.default.keymaps['Mesh'].keymap_items['transform.shrink_fatten'].properties.use_even_offset` Hope this helps
Author

@lichtwerk Hi. This is strange. I reported this bug because similar code I was using wasn't allowing for even offset. I was invoking it and using the same option as your code above and it kept defaulting to off. It's working now. Not sure why. Thanks though. I'm confused about your statement above "So as long as you hold the ALT key should work". This doesn't seem to be the case. It's always off even if I never release the Alt or S keys. Actually if I release Alt and keep holding S the option starts rapidly blinking. As far as there needing to be a protocol for this sort of thing, what I meant was that all 3D View modal operators released from blender.org should use mappable modal keymaps like with translate. There shouldn't be any 3D View modal operators (official ones from blender.org) that have any hard coded modifiers such as "Alt". Is there some reason they should?

@lichtwerk Hi. This is strange. I reported this bug because similar code I was using wasn't allowing for even offset. I was invoking it and using the same option as your code above and it kept defaulting to off. It's working now. Not sure why. Thanks though. I'm confused about your statement above "So as long as you hold the ALT key should work". This doesn't seem to be the case. It's always off even if I never release the Alt or S keys. Actually if I release Alt and keep holding S the option starts rapidly blinking. As far as there needing to be a protocol for this sort of thing, what I meant was that all 3D View modal operators released from blender.org should use mappable modal keymaps like with translate. There shouldn't be any 3D View modal operators (official ones from blender.org) that have any hard coded modifiers such as "Alt". Is there some reason they should?
Member

I'm confused about your statement above "So as long as you hold the ALT key should work". This doesn't seem to be the case. It's always off even if I never release the Alt.

That's relevant only with the D3388 patch applied to the current code. Have you tried the patch?

Actually if I release Alt and keep holding S the option starts rapidly blinking

yep, thats expected. ALT is enabling temporarily (while keeping pressed), S toggles (all the time)

There shouldn't be any 3D View modal operators (official ones from blender.org) that have any hard coded modifiers such as "Alt". Is there some reason they should?

Havent checked that in depth, I guess some modifierskeys just havent been converted from ancient past (but there might be reasons these are still hardcoded which I havent investigated yet)

> I'm confused about your statement above "So as long as you hold the ALT key should work". This doesn't seem to be the case. It's always off even if I never release the Alt. That's relevant only with the [D3388](https://archive.blender.org/developer/D3388) patch applied to the current code. Have you tried the patch? > Actually if I release Alt and keep holding S the option starts rapidly blinking yep, thats expected. `ALT` is enabling temporarily (while keeping pressed), `S` toggles (all the time) > There shouldn't be any 3D View modal operators (official ones from blender.org) that have any hard coded modifiers such as "Alt". Is there some reason they should? Havent checked that in depth, I guess some modifierskeys just havent been converted from ancient past (but there might be reasons these are still hardcoded which I havent investigated yet)
Member

Added subscriber: @BillySmith-1

Added subscriber: @BillySmith-1

Wow it working if you keep holding down Alt or assign it to a not use the Alt modifier in the hotkey is the weirdest bug.

Holding feels so bad and counter intuitive vs all the other tools in Blender and now that I know I can have it work by avoiding the Alt key in the hotkey I will, but at the same time I like the Alt + S hotkey so that's both a nice discovery and a bummer.

Wow it working if you keep holding down Alt or assign it to a not use the Alt modifier in the hotkey is the weirdest bug. Holding feels so bad and counter intuitive vs all the other tools in Blender and now that I know I can have it work by avoiding the Alt key in the hotkey I will, but at the same time I like the Alt + S hotkey so that's both a nice discovery and a bummer.
Philipp Oeser removed their assignment 2019-11-12 19:48:22 +01:00

Added subscriber: @IihT2cWA9xiP30BsYphz3EiEISNoScoe

Added subscriber: @IihT2cWA9xiP30BsYphz3EiEISNoScoe

I'm having the same issue, changing away from "Alt" fixes it but is a hassle to remember the new hotkey

I'm having the same issue, changing away from "Alt" fixes it but is a hassle to remember the new hotkey

Added subscriber: @Floatharr

Added subscriber: @Floatharr
Philipp Oeser removed the
Interest
Modeling
label 2023-02-09 15:30:03 +01:00

@lichtwerk hi

Guys, the point is:

The tool is launched with the ALT + S hotkey, which has an ALT hold option.

You run ALT + S and immediately ALT gets processed by overwriting the state "Offset Even" (use_even_offset).

That is, the "Offset Even" parameter does not make sense until either the hotkey is changed, where there is no Alt, or the behavior of the tool itself, for example:

  • remove the Alt handler
  • make the Alt Toggle handler the same as S
  • replace Alt in the handler with another function button
@lichtwerk hi Guys, the point is: The tool is launched with the ALT + S hotkey, which has an ALT hold option. You run ALT + S and immediately ALT gets processed by overwriting the state "Offset Even" (use_even_offset). That is, the "Offset Even" parameter does not make sense until either the hotkey is changed, where there is no Alt, or the behavior of the tool itself, for example: - remove the Alt handler - make the Alt Toggle handler the same as S - replace Alt in the handler with another function button
Sign in to join this conversation.
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser
Interest
Asset Browser Project Overview
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
EEVEE & Viewport
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
EEVEE & Viewport
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
7 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender#54325
No description provided.