CAD_Sketcher icon indicating copy to clipboard operation
CAD_Sketcher copied to clipboard

Invoke constraint popup on constraint creation

Open hlorus opened this issue 3 years ago • 9 comments

Allows to quickly enter a dimension value when adding a dimensional constraint. Ideally allows to directly enter a number.

hlorus avatar Aug 19 '22 11:08 hlorus

A question about this; I can see a smal dialog that shows on the bottom of the screen when creating a constraint.

Which part of the code is responsible for creating it? Would that window qualify for punching in the numbers if we can give focus to it?

image

amrsoll avatar Aug 24 '22 14:08 amrsoll

Afaik that's called the operator redo panel. An operator can define a draw method which will be used to draw that panel. There's likeley no support to give it focus, therefor i don't think that's the right approach.

hlorus avatar Aug 29 '22 09:08 hlorus

So we we want a pop up right next to the entity/constraint we create in the 3D view?

Example from fusion 360 image

amrsoll avatar Sep 03 '22 21:09 amrsoll

Yep, well basically just invoke the menu that appears when you click on a constraint.

hlorus avatar Sep 04 '22 06:09 hlorus

Founds the proper thing we want to use from the documentation: Panels (and not menus)

https://docs.blender.org/api/current/bpy.types.Panel.html

Which you can spawn using Operator.draw(), and we can even pass the UILayout element to my_constraint.draw_props(layout) to reuse the menu items from the right-click menu :smile:

I'll try making a prototype this weekend if nobody else is tackling this :)

amrsoll avatar Sep 15 '22 08:09 amrsoll

I've tried implementing the functionality already, spawning the menu isn't a big deal, the bigger problem is to activate the value property so users could directly enter a number. IMO that's needed otherwise it just feels annoying.

The layout type has some attributes which i though would work for this, "active_default" and "activate_init" but that doesn't seem to be the case... https://docs.blender.org/api/current/bpy.types.UILayout.html

hlorus avatar Sep 15 '22 09:09 hlorus

I've posted a bug report at blender regarding the activate_init issue: https://developer.blender.org/T101113

hlorus avatar Sep 16 '22 08:09 hlorus

I guess we could do a basic text parser for now if only text input work with activate_init, might also be helpful for people who want to put units in the input, but that would be secondary .

amrsoll avatar Sep 16 '22 09:09 amrsoll

I guess we could do a basic text parser for now if only text input work with activate_init,

True but i wouldn't recommend such a workaround, this task is really just a quality of life improvement.

might also be helpful for people who want to put units in the input, but that would be secondary .

That's already supported with Integer/Float properties.

hlorus avatar Sep 16 '22 10:09 hlorus